From: Cris Di Sclafani Date: Thu, 27 Aug 2020 14:02:04 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.0 X-Git-Url: http://repos.xcallymotion.com/base//%22https:/www.w3.org/TR/wai-aria-practices?a=commitdiff_plain;h=9ca3b5be41bc8ef6cc6bc07ca292d1afd032ec9b;p=motion2.git Built motion from commit (unavailable).|2.5.0 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 152f1c6..d275aa3 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.0", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-08-27T13:54:54.656Z", "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 b53a77a..30647d7 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 _0xcf33=['script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','STRING','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','VIRTUAL','getDataValue','action','integration','motionbar','jscripty','urlForward','bot'];(function(_0xe44684,_0x14139f){var _0x32da66=function(_0x450841){while(--_0x450841){_0xe44684['push'](_0xe44684['shift']());}};_0x32da66(++_0x14139f);}(_0xcf33,0x97));var _0x3cf3=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xcf33[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require(_0x3cf3('0x0'));module['exports']={'name':{'type':Sequelize[_0x3cf3('0x1')],'get':function(_0x6a1bc1){return this[_0x3cf3('0x2')](_0x3cf3('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x3cf3('0x4'),_0x3cf3('0x5'),_0x3cf3('0x6'),_0x3cf3('0x7'),'browser',_0x3cf3('0x8'),_0x3cf3('0x9')]],'msg':_0x3cf3('0xa')}},'comment':_0x3cf3('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x3cf3('0xb')},'data2':{'type':Sequelize[_0x3cf3('0xc')](0x1000),'comment':_0x3cf3('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x3cf3('0xe')},'data4':{'type':Sequelize[_0x3cf3('0xc')](0x1000)},'data5':{'type':Sequelize[_0x3cf3('0xc')](0x1000)},'data6':{'type':Sequelize[_0x3cf3('0xc')]},'data7':{'type':Sequelize[_0x3cf3('0xf')]}}; \ No newline at end of file +var _0x98c8=['STRING','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','TEXT','sequelize','VIRTUAL','getDataValue','action','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'];(function(_0x5aac8d,_0x42b1a7){var _0x410411=function(_0x1e9bc8){while(--_0x1e9bc8){_0x5aac8d['push'](_0x5aac8d['shift']());}};_0x410411(++_0x42b1a7);}(_0x98c8,0x16b));var _0x898c=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x98c8[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x898c('0x0'));module['exports']={'name':{'type':Sequelize[_0x898c('0x1')],'get':function(_0xe476ed){return this[_0x898c('0x2')](_0x898c('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0x898c('0x4'),_0x898c('0x5'),_0x898c('0x6'),_0x898c('0x7'),_0x898c('0x8'),_0x898c('0x9')]],'msg':_0x898c('0xa')}},'comment':_0x898c('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x898c('0xb')},'data2':{'type':Sequelize[_0x898c('0xc')](0x1000),'comment':_0x898c('0xd')},'data3':{'type':Sequelize[_0x898c('0xc')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0x898c('0xc')](0x1000)},'data5':{'type':Sequelize[_0x898c('0xc')](0x1000)},'data6':{'type':Sequelize[_0x898c('0xc')]},'data7':{'type':Sequelize[_0x898c('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index d932bc8..0b6b9d2 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 _0xfbe5=['json','count','offset','set','Content-Range','apply','then','destroy','end','sendStatus','error','stack','name','update','body','Action','params','find','catch','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','status'];(function(_0x4f1ff3,_0x2736a1){var _0x1768a5=function(_0xa12836){while(--_0xa12836){_0x4f1ff3['push'](_0x4f1ff3['shift']());}};_0x1768a5(++_0x2736a1);}(_0xfbe5,0x1ad));var _0x5fbe=function(_0x10bab5,_0x4fde6f){_0x10bab5=_0x10bab5-0x0;var _0x4c2264=_0xfbe5[_0x10bab5];return _0x4c2264;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5fbe('0x0'));var rimraf=require(_0x5fbe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5fbe('0x2'));var moment=require(_0x5fbe('0x3'));var BPromise=require(_0x5fbe('0x4'));var Mustache=require(_0x5fbe('0x5'));var util=require(_0x5fbe('0x6'));var path=require(_0x5fbe('0x7'));var sox=require(_0x5fbe('0x8'));var csv=require(_0x5fbe('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5fbe('0xa'));var squel=require(_0x5fbe('0xb'));var crypto=require('crypto');var jsforce=require(_0x5fbe('0xc'));var deskjs=require(_0x5fbe('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5fbe('0xe'));var Papa=require('papaparse');var Redis=require(_0x5fbe('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5fbe('0x10'));var as=require(_0x5fbe('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fbe('0x12'))('api');var utils=require(_0x5fbe('0x13'));var config=require(_0x5fbe('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x465a9b,_0x580b46){_0x580b46=_0x580b46||0xcc;return function(_0x1cb2f4){if(_0x1cb2f4){return _0x465a9b['sendStatus'](_0x580b46);}return _0x465a9b[_0x5fbe('0x15')](_0x580b46)['end']();};}function respondWithResult(_0x231c4a,_0x32c848){_0x32c848=_0x32c848||0xc8;return function(_0x31a320){if(_0x31a320){return _0x231c4a[_0x5fbe('0x15')](_0x32c848)[_0x5fbe('0x16')](_0x31a320);}};}function respondWithFilteredResult(_0x1b4a90,_0x44682a){return function(_0x11d4ef){if(_0x11d4ef){var _0x568861=_0x11d4ef[_0x5fbe('0x17')],_0x38b536=_0x44682a[_0x5fbe('0x18')],_0x4c5419=_0x44682a[_0x5fbe('0x18')]+_0x44682a['limit'],_0x1a73ba;if(_0x4c5419>=_0x568861){_0x4c5419=_0x568861;_0x1a73ba=0xc8;}else{_0x1a73ba=0xce;}_0x1b4a90[_0x5fbe('0x15')](_0x1a73ba);return _0x1b4a90[_0x5fbe('0x19')](_0x5fbe('0x1a'),_0x38b536+'-'+_0x4c5419+'/'+_0x568861)['json'](_0x11d4ef);}return null;};}function patchUpdates(_0x5ba243){return function(_0x2e29f3){try{jsonpatch[_0x5fbe('0x1b')](_0x2e29f3,_0x5ba243,!![]);}catch(_0x3b9bba){return BPromise['reject'](_0x3b9bba);}return _0x2e29f3['save']();};}function saveUpdates(_0x1728f6,_0x30b49a){return function(_0x103c07){if(_0x103c07){return _0x103c07['update'](_0x1728f6)[_0x5fbe('0x1c')](function(_0x47c17d){return _0x47c17d;});}return null;};}function removeEntity(_0x5b12fb,_0x5686ff){return function(_0x2f118f){if(_0x2f118f){return _0x2f118f[_0x5fbe('0x1d')]()[_0x5fbe('0x1c')](function(){_0x5b12fb[_0x5fbe('0x15')](0xcc)[_0x5fbe('0x1e')]();});}};}function handleEntityNotFound(_0x38f2b0,_0x3cd07b){return function(_0x388a5c){if(!_0x388a5c){_0x38f2b0[_0x5fbe('0x1f')](0x194);}return _0x388a5c;};}function handleError(_0x4ad913,_0x221da8){_0x221da8=_0x221da8||0x1f4;return function(_0x5f332d){logger[_0x5fbe('0x20')](_0x5f332d[_0x5fbe('0x21')]);if(_0x5f332d[_0x5fbe('0x22')]){delete _0x5f332d[_0x5fbe('0x22')];}_0x4ad913[_0x5fbe('0x15')](_0x221da8)['send'](_0x5f332d);};}exports[_0x5fbe('0x23')]=function(_0x47e3bb,_0xeeb29a){if(_0x47e3bb[_0x5fbe('0x24')]['id']){delete _0x47e3bb['body']['id'];}return db[_0x5fbe('0x25')]['find']({'where':{'id':_0x47e3bb[_0x5fbe('0x26')]['id']}})[_0x5fbe('0x1c')](handleEntityNotFound(_0xeeb29a,null))['then'](saveUpdates(_0x47e3bb['body'],null))[_0x5fbe('0x1c')](respondWithResult(_0xeeb29a,null))['catch'](handleError(_0xeeb29a,null));};exports[_0x5fbe('0x1d')]=function(_0x1407c8,_0x4f1d8c){return db[_0x5fbe('0x25')][_0x5fbe('0x27')]({'where':{'id':_0x1407c8['params']['id']}})[_0x5fbe('0x1c')](handleEntityNotFound(_0x4f1d8c,null))[_0x5fbe('0x1c')](removeEntity(_0x4f1d8c,null))[_0x5fbe('0x28')](handleError(_0x4f1d8c,null));}; \ No newline at end of file +var _0xaec8=['sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','body','Action','find','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xaec8,0x18c));var _0x8aec=function(_0x1e438c,_0x5201e9){_0x1e438c=_0x1e438c-0x0;var _0x37947d=_0xaec8[_0x1e438c];return _0x37947d;};'use strict';var pdf=require(_0x8aec('0x0'));var emlformat=require(_0x8aec('0x1'));var rimraf=require(_0x8aec('0x2'));var zipdir=require(_0x8aec('0x3'));var jsonpatch=require(_0x8aec('0x4'));var rp=require('request-promise');var moment=require(_0x8aec('0x5'));var BPromise=require(_0x8aec('0x6'));var Mustache=require(_0x8aec('0x7'));var util=require(_0x8aec('0x8'));var path=require('path');var sox=require(_0x8aec('0x9'));var csv=require(_0x8aec('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8aec('0xb'));var squel=require(_0x8aec('0xc'));var crypto=require(_0x8aec('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8aec('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aec('0xf'));var Papa=require(_0x8aec('0x10'));var Redis=require(_0x8aec('0x11'));var authService=require(_0x8aec('0x12'));var qs=require(_0x8aec('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8aec('0x14'));var utils=require(_0x8aec('0x15'));var config=require(_0x8aec('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f0713,_0x1dffa2){_0x1dffa2=_0x1dffa2||0xcc;return function(_0x433a26){if(_0x433a26){return _0x4f0713['sendStatus'](_0x1dffa2);}return _0x4f0713['status'](_0x1dffa2)[_0x8aec('0x17')]();};}function respondWithResult(_0x338102,_0x235375){_0x235375=_0x235375||0xc8;return function(_0x4204e9){if(_0x4204e9){return _0x338102[_0x8aec('0x18')](_0x235375)[_0x8aec('0x19')](_0x4204e9);}};}function respondWithFilteredResult(_0x167e66,_0x246206){return function(_0x1549e7){if(_0x1549e7){var _0x3257e0=_0x1549e7[_0x8aec('0x1a')],_0x32af2a=_0x246206['offset'],_0x445872=_0x246206[_0x8aec('0x1b')]+_0x246206[_0x8aec('0x1c')],_0x2d2252;if(_0x445872>=_0x3257e0){_0x445872=_0x3257e0;_0x2d2252=0xc8;}else{_0x2d2252=0xce;}_0x167e66[_0x8aec('0x18')](_0x2d2252);return _0x167e66[_0x8aec('0x1d')](_0x8aec('0x1e'),_0x32af2a+'-'+_0x445872+'/'+_0x3257e0)[_0x8aec('0x19')](_0x1549e7);}return null;};}function patchUpdates(_0x19cb49){return function(_0x13ddd8){try{jsonpatch[_0x8aec('0x1f')](_0x13ddd8,_0x19cb49,!![]);}catch(_0x1f654b){return BPromise[_0x8aec('0x20')](_0x1f654b);}return _0x13ddd8[_0x8aec('0x21')]();};}function saveUpdates(_0x12197a,_0x2e6123){return function(_0x34d30e){if(_0x34d30e){return _0x34d30e['update'](_0x12197a)[_0x8aec('0x22')](function(_0x5dfbf7){return _0x5dfbf7;});}return null;};}function removeEntity(_0x389451,_0x3dade5){return function(_0x413bc3){if(_0x413bc3){return _0x413bc3[_0x8aec('0x23')]()[_0x8aec('0x22')](function(){_0x389451[_0x8aec('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34f5e3,_0x57e2c8){return function(_0x50dd51){if(!_0x50dd51){_0x34f5e3[_0x8aec('0x24')](0x194);}return _0x50dd51;};}function handleError(_0x26b325,_0x52e52e){_0x52e52e=_0x52e52e||0x1f4;return function(_0xdcdb97){logger[_0x8aec('0x25')](_0xdcdb97[_0x8aec('0x26')]);if(_0xdcdb97[_0x8aec('0x27')]){delete _0xdcdb97['name'];}_0x26b325[_0x8aec('0x18')](_0x52e52e)['send'](_0xdcdb97);};}exports['update']=function(_0x2466f8,_0x3119f8){if(_0x2466f8[_0x8aec('0x28')]['id']){delete _0x2466f8[_0x8aec('0x28')]['id'];}return db[_0x8aec('0x29')][_0x8aec('0x2a')]({'where':{'id':_0x2466f8[_0x8aec('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3119f8,null))[_0x8aec('0x22')](saveUpdates(_0x2466f8[_0x8aec('0x28')],null))[_0x8aec('0x22')](respondWithResult(_0x3119f8,null))['catch'](handleError(_0x3119f8,null));};exports[_0x8aec('0x23')]=function(_0x26cfa7,_0x1be0e9){return db[_0x8aec('0x29')][_0x8aec('0x2a')]({'where':{'id':_0x26cfa7[_0x8aec('0x2b')]['id']}})[_0x8aec('0x22')](handleEntityNotFound(_0x1be0e9,null))[_0x8aec('0x22')](removeEntity(_0x1be0e9,null))[_0x8aec('0x2c')](handleError(_0x1be0e9,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 4195359..113818a 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 _0x7f59=['./action.attributes','exports','define','Action','tools_actions','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x571abd,_0x27a95a){var _0x57309d=function(_0x2b8605){while(--_0x2b8605){_0x571abd['push'](_0x571abd['shift']());}};_0x57309d(++_0x27a95a);}(_0x7f59,0xc5));var _0x97f5=function(_0x1ce242,_0x575ca3){_0x1ce242=_0x1ce242-0x0;var _0x521d78=_0x7f59[_0x1ce242];return _0x521d78;};'use strict';var _=require(_0x97f5('0x0'));var util=require(_0x97f5('0x1'));var logger=require('../../config/logger')(_0x97f5('0x2'));var moment=require(_0x97f5('0x3'));var BPromise=require('bluebird');var rp=require(_0x97f5('0x4'));var fs=require('fs');var path=require(_0x97f5('0x5'));var rimraf=require(_0x97f5('0x6'));var config=require('../../config/environment');var attributes=require(_0x97f5('0x7'));module[_0x97f5('0x8')]=function(_0x240d17,_0x24142d){return _0x240d17[_0x97f5('0x9')](_0x97f5('0xa'),attributes,{'tableName':_0x97f5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f68=['Action','tools_actions','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5ebbe0,_0x2cc634){var _0x240399=function(_0x3dade1){while(--_0x3dade1){_0x5ebbe0['push'](_0x5ebbe0['shift']());}};_0x240399(++_0x2cc634);}(_0x8f68,0x86));var _0x88f6=function(_0x5b813f,_0xf640a1){_0x5b813f=_0x5b813f-0x0;var _0x5644ce=_0x8f68[_0x5b813f];return _0x5644ce;};'use strict';var _=require('lodash');var util=require(_0x88f6('0x0'));var logger=require(_0x88f6('0x1'))(_0x88f6('0x2'));var moment=require('moment');var BPromise=require(_0x88f6('0x3'));var rp=require(_0x88f6('0x4'));var fs=require('fs');var path=require(_0x88f6('0x5'));var rimraf=require(_0x88f6('0x6'));var config=require(_0x88f6('0x7'));var attributes=require('./action.attributes');module[_0x88f6('0x8')]=function(_0x568c49,_0x553c5a){return _0x568c49['define'](_0x88f6('0x9'),attributes,{'tableName':_0x88f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 2be670d..aca34cf 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x41be16,_0xe37491){var _0x474e9a=function(_0x338359){while(--_0x338359){_0x41be16['push'](_0x41be16['shift']());}};_0x474e9a(++_0xe37491);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5ef56f,_0x415acc){var _0x24306e=function(_0x463407){while(--_0x463407){_0x5ef56f['push'](_0x5ef56f['shift']());}};_0x24306e(++_0x415acc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 46c6db2..5c3fb65 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 _0x6623=['update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6623,0x113));var _0x3662=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x6623[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x3662('0x0'));var util=require(_0x3662('0x1'));var path=require(_0x3662('0x2'));var timeout=require(_0x3662('0x3'));var express=require('express');var router=express[_0x3662('0x4')]();var auth=require(_0x3662('0x5'));var interaction=require(_0x3662('0x6'));var config=require(_0x3662('0x7'));var controller=require('./action.controller');router[_0x3662('0x8')]('/:id',auth[_0x3662('0x9')](),controller[_0x3662('0xa')]);router[_0x3662('0xb')](_0x3662('0xc'),auth['isAuthenticated'](),controller[_0x3662('0xd')]);module[_0x3662('0xe')]=router; \ No newline at end of file +var _0xc817=['put','/:id','isAuthenticated','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./action.controller'];(function(_0x4fadef,_0x1461e4){var _0x328465=function(_0x3030fe){while(--_0x3030fe){_0x4fadef['push'](_0x4fadef['shift']());}};_0x328465(++_0x1461e4);}(_0xc817,0x19d));var _0x7c81=function(_0x273ea9,_0x51fd00){_0x273ea9=_0x273ea9-0x0;var _0x1debce=_0xc817[_0x273ea9];return _0x1debce;};'use strict';var multer=require(_0x7c81('0x0'));var util=require('util');var path=require(_0x7c81('0x1'));var timeout=require(_0x7c81('0x2'));var express=require(_0x7c81('0x3'));var router=express[_0x7c81('0x4')]();var auth=require(_0x7c81('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7c81('0x6'));router[_0x7c81('0x7')](_0x7c81('0x8'),auth[_0x7c81('0x9')](),controller['update']);router['delete'](_0x7c81('0x8'),auth['isAuthenticated'](),controller[_0x7c81('0xa')]);module[_0x7c81('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index e0b92bc..8b65baf 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 _0xa9fd=['sequelize','exports','STRING','TEXT'];(function(_0x36453b,_0x104046){var _0x1173aa=function(_0x132779){while(--_0x132779){_0x36453b['push'](_0x36453b['shift']());}};_0x1173aa(++_0x104046);}(_0xa9fd,0x1d4));var _0xda9f=function(_0x2c2607,_0x595bd5){_0x2c2607=_0x2c2607-0x0;var _0x10afdc=_0xa9fd[_0x2c2607];return _0x10afdc;};'use strict';var Sequelize=require(_0xda9f('0x0'));module[_0xda9f('0x1')]={'name':{'type':Sequelize[_0xda9f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xda9f('0x2')]},'parent':{'type':Sequelize[_0xda9f('0x2')]},'table':{'type':Sequelize[_0xda9f('0x2')]},'conditions':{'type':Sequelize[_0xda9f('0x3')]},'joins':{'type':Sequelize[_0xda9f('0x3')]}}; \ No newline at end of file +var _0x9aee=['TEXT','STRING'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9aee,0x101));var _0xe9ae=function(_0x3f9612,_0x3a561d){_0x3f9612=_0x3f9612-0x0;var _0x4c2905=_0x9aee[_0x3f9612];return _0x4c2905;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xe9ae('0x0')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xe9ae('0x1')]},'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 50f5b3a..5b23bd4 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 _0xebd9=['AnalyticCustomReport','rawAttributes','key','query','keys','intersection','fields','attributes','model','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','userProfileId','UserProfileResource','error','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','HOUR(%s)','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','select','order','orderBy','DESC','QueryTypes','No\x20available\x20data','output','web','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','run','DATE(%s)','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','Content-Range','save','update','then','destroy','get','sendStatus','stack','name','send','map'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xebd9,0x1b0));var _0x9ebd=function(_0x23f18c,_0x2638c8){_0x23f18c=_0x23f18c-0x0;var _0x4a42e6=_0xebd9[_0x23f18c];return _0x4a42e6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9ebd('0x0'));var rimraf=require(_0x9ebd('0x1'));var zipdir=require(_0x9ebd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ebd('0x3'));var moment=require('moment');var BPromise=require(_0x9ebd('0x4'));var Mustache=require(_0x9ebd('0x5'));var util=require(_0x9ebd('0x6'));var path=require(_0x9ebd('0x7'));var sox=require('sox');var csv=require(_0x9ebd('0x8'));var ejs=require(_0x9ebd('0x9'));var fs=require('fs');var _=require(_0x9ebd('0xa'));var squel=require('squel');var crypto=require(_0x9ebd('0xb'));var jsforce=require(_0x9ebd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9ebd('0x8'));var querystring=require('querystring');var Papa=require(_0x9ebd('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9ebd('0xe'));var as=require(_0x9ebd('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ebd('0x10'))('api');var utils=require(_0x9ebd('0x11'));var config=require(_0x9ebd('0x12'));var db=require(_0x9ebd('0x13'))['db'];function respondWithStatusCode(_0xaa2d39,_0x26e604){_0x26e604=_0x26e604||0xcc;return function(_0x14009a){if(_0x14009a){return _0xaa2d39['sendStatus'](_0x26e604);}return _0xaa2d39[_0x9ebd('0x14')](_0x26e604)[_0x9ebd('0x15')]();};}function respondWithResult(_0x2ecd1f,_0x1c4d09){_0x1c4d09=_0x1c4d09||0xc8;return function(_0x42b270){if(_0x42b270){return _0x2ecd1f[_0x9ebd('0x14')](_0x1c4d09)[_0x9ebd('0x16')](_0x42b270);}};}function respondWithFilteredResult(_0x4720a5,_0x11e809){return function(_0x35ea4c){if(_0x35ea4c){var _0x5e60a8=_0x35ea4c['count'],_0x4c6832=_0x11e809[_0x9ebd('0x17')],_0x10b193=_0x11e809[_0x9ebd('0x17')]+_0x11e809[_0x9ebd('0x18')],_0x562db2;if(_0x10b193>=_0x5e60a8){_0x10b193=_0x5e60a8;_0x562db2=0xc8;}else{_0x562db2=0xce;}_0x4720a5[_0x9ebd('0x14')](_0x562db2);return _0x4720a5['set'](_0x9ebd('0x19'),_0x4c6832+'-'+_0x10b193+'/'+_0x5e60a8)['json'](_0x35ea4c);}return null;};}function patchUpdates(_0x52c482){return function(_0x50dd53){try{jsonpatch['apply'](_0x50dd53,_0x52c482,!![]);}catch(_0x1af126){return BPromise['reject'](_0x1af126);}return _0x50dd53[_0x9ebd('0x1a')]();};}function saveUpdates(_0x339f43,_0x2b9c16){return function(_0x267dcf){if(_0x267dcf){return _0x267dcf[_0x9ebd('0x1b')](_0x339f43)[_0x9ebd('0x1c')](function(_0xa13dd1){return _0xa13dd1;});}return null;};}function removeEntity(_0xc76e40,_0x21de99){return function(_0x38ed51){if(_0x38ed51){return _0x38ed51[_0x9ebd('0x1d')]()[_0x9ebd('0x1c')](function(){var _0x119e35=_0x38ed51[_0x9ebd('0x1e')]({'plain':!![]});var _0x9da481='CustomReports';return db['UserProfileResource'][_0x9ebd('0x1d')]({'where':{'type':_0x9da481,'resourceId':_0x119e35['id']}})['then'](function(){return _0x38ed51;});})['then'](function(){_0xc76e40[_0x9ebd('0x14')](0xcc)[_0x9ebd('0x15')]();});}};}function handleEntityNotFound(_0x24f3f6,_0x4798db){return function(_0x22f35b){if(!_0x22f35b){_0x24f3f6[_0x9ebd('0x1f')](0x194);}return _0x22f35b;};}function handleError(_0x333169,_0x378d75){_0x378d75=_0x378d75||0x1f4;return function(_0x2ce8b4){logger['error'](_0x2ce8b4[_0x9ebd('0x20')]);if(_0x2ce8b4[_0x9ebd('0x21')]){delete _0x2ce8b4['name'];}_0x333169[_0x9ebd('0x14')](_0x378d75)[_0x9ebd('0x22')](_0x2ce8b4);};}exports['index']=function(_0x5afd40,_0x20a2e3){var _0x48f835={},_0x1d69dd={},_0xe11522={'count':0x0,'rows':[]};var _0x1e12a9=_[_0x9ebd('0x23')](db[_0x9ebd('0x24')][_0x9ebd('0x25')],function(_0x217327){return{'name':_0x217327['fieldName'],'type':_0x217327['type'][_0x9ebd('0x26')]};});_0x1d69dd['model']=_['map'](_0x1e12a9,'name');_0x1d69dd[_0x9ebd('0x27')]=_[_0x9ebd('0x28')](_0x5afd40['query']);_0x1d69dd['filters']=_[_0x9ebd('0x29')](_0x1d69dd['model'],_0x1d69dd[_0x9ebd('0x27')]);_0x48f835['attributes']=_[_0x9ebd('0x29')](_0x1d69dd['model'],qs[_0x9ebd('0x2a')](_0x5afd40[_0x9ebd('0x27')]['fields']));_0x48f835[_0x9ebd('0x2b')]=_0x48f835['attributes']['length']?_0x48f835[_0x9ebd('0x2b')]:_0x1d69dd[_0x9ebd('0x2c')];if(!_0x5afd40[_0x9ebd('0x27')]['hasOwnProperty'](_0x9ebd('0x2d'))){_0x48f835[_0x9ebd('0x18')]=qs[_0x9ebd('0x18')](_0x5afd40[_0x9ebd('0x27')][_0x9ebd('0x18')]);_0x48f835[_0x9ebd('0x17')]=qs[_0x9ebd('0x17')](_0x5afd40['query'][_0x9ebd('0x17')]);}_0x48f835['order']=qs[_0x9ebd('0x2e')](_0x5afd40[_0x9ebd('0x27')][_0x9ebd('0x2e')]);_0x48f835[_0x9ebd('0x2f')]=qs['filters'](_[_0x9ebd('0x30')](_0x5afd40['query'],_0x1d69dd[_0x9ebd('0x31')]));if(_0x5afd40[_0x9ebd('0x27')][_0x9ebd('0x32')]){_0x48f835['where']=_[_0x9ebd('0x33')](_0x48f835[_0x9ebd('0x2f')],{'$or':_[_0x9ebd('0x23')](_0x1e12a9,function(_0x407c39){if(_0x407c39[_0x9ebd('0x34')]!==_0x9ebd('0x35')){var _0x57f172={};_0x57f172[_0x407c39[_0x9ebd('0x21')]]={'$like':'%'+_0x5afd40['query'][_0x9ebd('0x32')]+'%'};return _0x57f172;}})});}_0x48f835=_[_0x9ebd('0x33')]({},_0x48f835,_0x5afd40[_0x9ebd('0x36')]);var _0x25abba={'where':_0x48f835[_0x9ebd('0x2f')]};return db['AnalyticCustomReport']['count'](_0x25abba)[_0x9ebd('0x1c')](function(_0x329365){_0xe11522[_0x9ebd('0x37')]=_0x329365;if(_0x5afd40[_0x9ebd('0x27')][_0x9ebd('0x38')]){_0x48f835[_0x9ebd('0x39')]=[{'all':!![]}];}return db[_0x9ebd('0x24')][_0x9ebd('0x3a')](_0x48f835);})[_0x9ebd('0x1c')](function(_0xa0480b){_0xe11522['rows']=_0xa0480b;return _0xe11522;})['then'](respondWithFilteredResult(_0x20a2e3,_0x48f835))[_0x9ebd('0x3b')](handleError(_0x20a2e3,null));};exports[_0x9ebd('0x3c')]=function(_0x10fd99,_0x12132c){var _0x7fc09e={'raw':![],'where':{'id':_0x10fd99['params']['id']}},_0x212fc9={};_0x212fc9[_0x9ebd('0x2c')]=_[_0x9ebd('0x28')](db[_0x9ebd('0x24')]['rawAttributes']);_0x212fc9['query']=_[_0x9ebd('0x28')](_0x10fd99[_0x9ebd('0x27')]);_0x212fc9['filters']=_[_0x9ebd('0x29')](_0x212fc9['model'],_0x212fc9['query']);_0x7fc09e[_0x9ebd('0x2b')]=_[_0x9ebd('0x29')](_0x212fc9[_0x9ebd('0x2c')],qs[_0x9ebd('0x2a')](_0x10fd99['query'][_0x9ebd('0x2a')]));_0x7fc09e[_0x9ebd('0x2b')]=_0x7fc09e['attributes'][_0x9ebd('0x3d')]?_0x7fc09e['attributes']:_0x212fc9['model'];if(_0x10fd99[_0x9ebd('0x27')][_0x9ebd('0x38')]){_0x7fc09e[_0x9ebd('0x39')]=[{'all':!![]}];}_0x7fc09e=_[_0x9ebd('0x33')]({},_0x7fc09e,_0x10fd99[_0x9ebd('0x36')]);return db[_0x9ebd('0x24')][_0x9ebd('0x3e')](_0x7fc09e)[_0x9ebd('0x1c')](handleEntityNotFound(_0x12132c,null))[_0x9ebd('0x1c')](respondWithResult(_0x12132c,null))['catch'](handleError(_0x12132c,null));};exports[_0x9ebd('0x3f')]=function(_0x458af8,_0x1345fc){return db[_0x9ebd('0x24')][_0x9ebd('0x3f')](_0x458af8[_0x9ebd('0x40')],{})[_0x9ebd('0x1c')](function(_0x2dd2b5){var _0x410171=_0x458af8['user'][_0x9ebd('0x1e')]({'plain':!![]});if(!_0x410171)throw new Error(_0x9ebd('0x41'));if(_0x410171['role']===_0x9ebd('0x42')){var _0x442b5e=_0x2dd2b5[_0x9ebd('0x1e')]({'plain':!![]});var _0x7d7b38=_0x9ebd('0x43');return db[_0x9ebd('0x44')][_0x9ebd('0x3e')]({'where':{'name':_0x7d7b38,'userProfileId':_0x410171[_0x9ebd('0x45')]},'raw':!![]})[_0x9ebd('0x1c')](function(_0xe92503){if(_0xe92503&&_0xe92503['autoAssociation']===0x0){return db[_0x9ebd('0x46')][_0x9ebd('0x3f')]({'name':_0x442b5e[_0x9ebd('0x21')],'resourceId':_0x442b5e['id'],'type':'CustomReports','sectionId':_0xe92503['id']},{})['then'](function(){return _0x2dd2b5;});}else{return _0x2dd2b5;}})['catch'](function(_0x33093d){logger[_0x9ebd('0x47')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33093d);throw _0x33093d;});}return _0x2dd2b5;})['then'](respondWithResult(_0x1345fc,0xc9))[_0x9ebd('0x3b')](handleError(_0x1345fc,null));};exports[_0x9ebd('0x1b')]=function(_0x3528fb,_0x210fe5){if(_0x3528fb['body']['id']){delete _0x3528fb[_0x9ebd('0x40')]['id'];}return db[_0x9ebd('0x24')][_0x9ebd('0x3e')]({'where':{'id':_0x3528fb[_0x9ebd('0x48')]['id']}})[_0x9ebd('0x1c')](handleEntityNotFound(_0x210fe5,null))['then'](saveUpdates(_0x3528fb[_0x9ebd('0x40')],null))[_0x9ebd('0x1c')](respondWithResult(_0x210fe5,null))[_0x9ebd('0x3b')](handleError(_0x210fe5,null));};exports[_0x9ebd('0x1d')]=function(_0xa99d33,_0x5913c1){return db['AnalyticCustomReport']['find']({'where':{'id':_0xa99d33['params']['id']}})[_0x9ebd('0x1c')](handleEntityNotFound(_0x5913c1,null))['then'](removeEntity(_0x5913c1,null))[_0x9ebd('0x3b')](handleError(_0x5913c1,null));};exports[_0x9ebd('0x49')]=function(_0x480655,_0x504edf){var _0x4b75f0=0xa;var _0x48fa53=[_0x9ebd('0x4a'),_0x9ebd('0x4b'),_0x9ebd('0x4c'),_0x9ebd('0x4d')];var _0x5d2b0f={'SUM':_0x9ebd('0x4e'),'COUNT':_0x9ebd('0x4f'),'COUNT DISTINCT':_0x9ebd('0x50'),'MAX':_0x9ebd('0x51'),'MIN':_0x9ebd('0x52'),'AVG':_0x9ebd('0x53'),'GROUP_CONCAT':_0x9ebd('0x54'),'GROUP_CONCAT ASC':_0x9ebd('0x55'),'GROUP_CONCAT DESC':_0x9ebd('0x56')};var _0x408c21={'SEC_TO_TIME':_0x9ebd('0x57'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9ebd('0x58'),'UNIX_TIMESTAMP':_0x9ebd('0x59')};var _0x49686b=function(_0x333cd9){return!_[_0x9ebd('0x5a')]([_0x9ebd('0x5b'),_0x9ebd('0x5c'),_0x9ebd('0x5d'),'IS\x20NOT\x20EMPTY'],_0x333cd9);};var _0xb3fe8d=function(_0x3819ea){if(!_0x3819ea||!_0x3819ea[_0x9ebd('0x5e')][_0x9ebd('0x3d')]){return'';}for(var _0x332690='(',_0x72d156=0x0;_0x72d156<_0x3819ea['rules'][_0x9ebd('0x3d')];_0x72d156+=0x1){_0x72d156>0x0&&(_0x332690+='\x20'+_0x3819ea[_0x9ebd('0x5f')]+'\x20');_0x332690+=_0x3819ea['rules'][_0x72d156][_0x9ebd('0x60')]?_0xb3fe8d(_0x3819ea[_0x9ebd('0x5e')][_0x72d156][_0x9ebd('0x60')]):_0x3819ea[_0x9ebd('0x5e')][_0x72d156][_0x9ebd('0x61')]+'\x20'+_0x3819ea[_0x9ebd('0x5e')][_0x72d156][_0x9ebd('0x62')]+(_0x49686b(_0x3819ea[_0x9ebd('0x5e')][_0x72d156]['condition'])?'\x20'+_0x3819ea[_0x9ebd('0x5e')][_0x72d156]['value']:'');}return _0x332690+')';};var _0x49d523={'where':{'id':_0x480655['params']['id']}},_0xf56957,_0x1bea91,_0x10f5c1,_0x4fdeed,_0x3c2821;_0x49d523=_['merge']({},_0x49d523,_0x480655['options']);return db['AnalyticCustomReport'][_0x9ebd('0x3e')](_0x49d523)[_0x9ebd('0x1c')](function(_0x79eb0c){if(_0x79eb0c){_0xf56957=_0x79eb0c;return _0x79eb0c['getFields']();}return null;})[_0x9ebd('0x1c')](function(_0x51491b){if(_0x51491b){if(!_0x51491b[_0x9ebd('0x3d')]){throw new db[(_0x9ebd('0x63'))][(_0x9ebd('0x64'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1bea91=_0x51491b;return db[_0x9ebd('0x65')]['findAll']({'raw':!![]});}return null;})[_0x9ebd('0x1c')](function(_0x325c5d){if(_0x325c5d){_0x10f5c1=_[_0x9ebd('0x66')](_0x325c5d,'id');var _0x5ac4e0;var _0x41f83e=squel['select']();_0x41f83e[_0x9ebd('0x67')](_0xf56957[_0x9ebd('0x68')]);for(var _0x4dbf1e=0x0;_0x4dbf1e<_0x1bea91[_0x9ebd('0x3d')];_0x4dbf1e+=0x1){_0x5ac4e0=_0x1bea91[_0x4dbf1e][_0x9ebd('0x69')]?_0x10f5c1[_0x1bea91[_0x4dbf1e][_0x9ebd('0x69')]][_0x9ebd('0x6a')]:_0x1bea91[_0x4dbf1e][_0x9ebd('0x61')];_0x5ac4e0=_0x1bea91[_0x4dbf1e][_0x9ebd('0x6b')]?_[_0x9ebd('0x6c')](_0x5d2b0f[_0x1bea91[_0x4dbf1e][_0x9ebd('0x6b')]],'%s',_0x5ac4e0):_0x5ac4e0;_0x5ac4e0=_0x1bea91[_0x4dbf1e][_0x9ebd('0x6d')]?_[_0x9ebd('0x6c')](_0x408c21[_0x1bea91[_0x4dbf1e][_0x9ebd('0x6d')]],'%s',_0x5ac4e0):_0x5ac4e0;if(_0x1bea91[_0x4dbf1e][_0x9ebd('0x6e')]){_0x41f83e[_0x9ebd('0x60')](_0x5ac4e0);}_0x1bea91[_0x4dbf1e]['orderBy']&&_0x41f83e['order'](_0x5ac4e0,_0x1bea91[_0x4dbf1e]['orderBy']==='DESC'?![]:!![]);_0x41f83e[_0x9ebd('0x61')](_0x5ac4e0,_0x1bea91[_0x4dbf1e][_0x9ebd('0x6f')]||_0x5ac4e0);}if(_0xf56957[_0x9ebd('0x70')]){_0xf56957[_0x9ebd('0x70')]=JSON[_0x9ebd('0x71')](_0xf56957[_0x9ebd('0x70')]);for(var _0x1f6d20=0x0;_0x1f6d20<_0xf56957[_0x9ebd('0x70')][_0x9ebd('0x3d')];_0x1f6d20+=0x1){if(_0xf56957[_0x9ebd('0x70')][_0x1f6d20]['type']&&_[_0x9ebd('0x5a')](_0x48fa53,_0xf56957[_0x9ebd('0x70')][_0x1f6d20][_0x9ebd('0x34')])&&_0xf56957[_0x9ebd('0x70')][_0x1f6d20][_0x9ebd('0x72')]&&_0xf56957['joins'][_0x1f6d20]['foreignTable']&&_0xf56957[_0x9ebd('0x70')][_0x1f6d20]['foreignKey']){_0x41f83e[_0xf56957[_0x9ebd('0x70')][_0x1f6d20]['type']](_0xf56957[_0x9ebd('0x70')][_0x1f6d20][_0x9ebd('0x73')],null,util[_0x9ebd('0x6d')](_0x9ebd('0x74'),_0xf56957[_0x9ebd('0x68')],_0xf56957[_0x9ebd('0x70')][_0x1f6d20][_0x9ebd('0x72')],_0xf56957[_0x9ebd('0x70')][_0x1f6d20]['foreignTable'],_0xf56957[_0x9ebd('0x70')][_0x1f6d20][_0x9ebd('0x75')]));}}}if(_0xf56957[_0x9ebd('0x76')]){_0xf56957[_0x9ebd('0x76')]=JSON['parse'](_0xf56957[_0x9ebd('0x76')]);_0x41f83e[_0x9ebd('0x2f')](_0xb3fe8d(_0xf56957[_0x9ebd('0x76')][_0x9ebd('0x60')]));}_0x3c2821=_0x41f83e[_0x9ebd('0x77')]();_0x41f83e[_0x9ebd('0x18')](_0x4b75f0);_0x41f83e[_0x9ebd('0x17')](0x0);logger[_0x9ebd('0x78')](_0x9ebd('0x79'),_0x41f83e[_0x9ebd('0x7a')]());return db['sequelize'][_0x9ebd('0x27')](_0x41f83e[_0x9ebd('0x7a')](),{'type':db[_0x9ebd('0x7b')]['QueryTypes'][_0x9ebd('0x7c')]});}})['then'](respondWithResult(_0x504edf,null))['catch'](handleError(_0x504edf,null));};function runReport(_0x3f3751,_0x5494fe,_0x262998){var _0x47b6bd=_0x5494fe[_0x9ebd('0x21')];var _0x2558aa=0xa;var _0x10b027=[_0x9ebd('0x4a'),'left_join',_0x9ebd('0x4c'),_0x9ebd('0x4d')];var _0x265316={'SUM':_0x9ebd('0x4e'),'COUNT':_0x9ebd('0x4f'),'COUNT DISTINCT':_0x9ebd('0x50'),'MAX':_0x9ebd('0x51'),'MIN':_0x9ebd('0x52'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9ebd('0x54'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9ebd('0x56')};var _0x752a3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x9ebd('0x7d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9ebd('0x59')};var _0x40c9d3=function(_0x27012f){return!_['includes']([_0x9ebd('0x5b'),_0x9ebd('0x5c'),_0x9ebd('0x5d'),'IS\x20NOT\x20EMPTY'],_0x27012f);};var _0x5b255e=function(_0x132b22){if(!_0x132b22||!_0x132b22[_0x9ebd('0x5e')]['length']){return'';}for(var _0x30b0ba='(',_0xfc07ff=0x0;_0xfc07ff<_0x132b22[_0x9ebd('0x5e')][_0x9ebd('0x3d')];_0xfc07ff+=0x1){_0xfc07ff>0x0&&(_0x30b0ba+='\x20'+_0x132b22['operator']+'\x20');_0x30b0ba+=_0x132b22[_0x9ebd('0x5e')][_0xfc07ff][_0x9ebd('0x60')]?_0x5b255e(_0x132b22[_0x9ebd('0x5e')][_0xfc07ff][_0x9ebd('0x60')]):_0x132b22[_0x9ebd('0x5e')][_0xfc07ff][_0x9ebd('0x61')]+'\x20'+_0x132b22[_0x9ebd('0x5e')][_0xfc07ff]['condition']+(_0x40c9d3(_0x132b22['rules'][_0xfc07ff][_0x9ebd('0x62')])?'\x20'+_0x132b22[_0x9ebd('0x5e')][_0xfc07ff][_0x9ebd('0x7e')]:'');}return _0x30b0ba+')';};var _0x2a607b={'where':{'id':_0x3f3751['id']}},_0x55d0f9,_0x3ca2d9,_0x289626,_0x268c2a,_0x52660d;_0x2a607b=_[_0x9ebd('0x33')]({},_0x2a607b,_0x262998);return db[_0x9ebd('0x24')][_0x9ebd('0x3e')](_0x2a607b)[_0x9ebd('0x1c')](function(_0x51d83a){if(_0x51d83a){_0x55d0f9=_0x51d83a;return _0x51d83a[_0x9ebd('0x7f')]();}return null;})[_0x9ebd('0x1c')](function(_0x40b991){if(_0x40b991){if(!_0x40b991[_0x9ebd('0x3d')]){throw new db[(_0x9ebd('0x63'))][(_0x9ebd('0x64'))](_0x9ebd('0x80'),0x193);}_0x3ca2d9=_0x40b991;return db[_0x9ebd('0x65')]['findAll']({'raw':!![]});}return null;})[_0x9ebd('0x1c')](function(_0x27f56a){if(_0x27f56a){_0x289626=_[_0x9ebd('0x66')](_0x27f56a,'id');var _0x9faf4b;var _0x4c547f=squel[_0x9ebd('0x81')]();_0x4c547f[_0x9ebd('0x67')](_0x55d0f9[_0x9ebd('0x68')]);for(var _0x3eb756=0x0;_0x3eb756<_0x3ca2d9[_0x9ebd('0x3d')];_0x3eb756+=0x1){_0x9faf4b=_0x3ca2d9[_0x3eb756][_0x9ebd('0x69')]?_0x289626[_0x3ca2d9[_0x3eb756]['MetricId']][_0x9ebd('0x6a')]:_0x3ca2d9[_0x3eb756][_0x9ebd('0x61')];_0x9faf4b=_0x3ca2d9[_0x3eb756][_0x9ebd('0x6b')]?_[_0x9ebd('0x6c')](_0x265316[_0x3ca2d9[_0x3eb756][_0x9ebd('0x6b')]],'%s',_0x9faf4b):_0x9faf4b;_0x9faf4b=_0x3ca2d9[_0x3eb756][_0x9ebd('0x6d')]?_[_0x9ebd('0x6c')](_0x752a3[_0x3ca2d9[_0x3eb756][_0x9ebd('0x6d')]],'%s',_0x9faf4b):_0x9faf4b;if(_0x3ca2d9[_0x3eb756][_0x9ebd('0x6e')]){_0x4c547f[_0x9ebd('0x60')](_0x9faf4b);}_0x3ca2d9[_0x3eb756]['orderBy']&&_0x4c547f[_0x9ebd('0x82')](_0x9faf4b,_0x3ca2d9[_0x3eb756][_0x9ebd('0x83')]===_0x9ebd('0x84')?![]:!![]);_0x4c547f['field'](_0x9faf4b,_0x3ca2d9[_0x3eb756][_0x9ebd('0x6f')]||_0x9faf4b);}if(_0x55d0f9[_0x9ebd('0x70')]){_0x55d0f9[_0x9ebd('0x70')]=JSON['parse'](_0x55d0f9[_0x9ebd('0x70')]);for(var _0x351e72=0x0;_0x351e72<_0x55d0f9[_0x9ebd('0x70')]['length'];_0x351e72+=0x1){if(_0x55d0f9[_0x9ebd('0x70')][_0x351e72][_0x9ebd('0x34')]&&_[_0x9ebd('0x5a')](_0x10b027,_0x55d0f9[_0x9ebd('0x70')][_0x351e72][_0x9ebd('0x34')])&&_0x55d0f9['joins'][_0x351e72][_0x9ebd('0x72')]&&_0x55d0f9[_0x9ebd('0x70')][_0x351e72][_0x9ebd('0x73')]&&_0x55d0f9[_0x9ebd('0x70')][_0x351e72][_0x9ebd('0x75')]){_0x4c547f[_0x55d0f9[_0x9ebd('0x70')][_0x351e72][_0x9ebd('0x34')]](_0x55d0f9['joins'][_0x351e72][_0x9ebd('0x73')],null,util[_0x9ebd('0x6d')](_0x9ebd('0x74'),_0x55d0f9['table'],_0x55d0f9[_0x9ebd('0x70')][_0x351e72][_0x9ebd('0x72')],_0x55d0f9[_0x9ebd('0x70')][_0x351e72]['foreignTable'],_0x55d0f9[_0x9ebd('0x70')][_0x351e72][_0x9ebd('0x75')]));}}}if(_0x55d0f9['conditions']){_0x55d0f9[_0x9ebd('0x76')]=JSON[_0x9ebd('0x71')](_0x55d0f9[_0x9ebd('0x76')]);_0x4c547f[_0x9ebd('0x2f')](_0x5b255e(_0x55d0f9[_0x9ebd('0x76')][_0x9ebd('0x60')]));}_0x52660d=_0x4c547f[_0x9ebd('0x77')]();_0x4c547f[_0x9ebd('0x18')](_0x2558aa);_0x4c547f[_0x9ebd('0x17')](0x0);logger[_0x9ebd('0x78')](_0x9ebd('0x79'),_0x4c547f[_0x9ebd('0x7a')]());return db[_0x9ebd('0x7b')][_0x9ebd('0x27')](_0x4c547f[_0x9ebd('0x7a')](),{'type':db['sequelize'][_0x9ebd('0x85')]['SELECT']});}})[_0x9ebd('0x1c')](function(_0x1db4e3){if(!_0x1db4e3[_0x9ebd('0x3d')]){throw new db[(_0x9ebd('0x63'))][(_0x9ebd('0x64'))](_0x9ebd('0x86'),0xcc);}if(_0x5494fe[_0x9ebd('0x87')]===_0x9ebd('0x88')){return null;}var _0x401e30=_[_0x9ebd('0x33')](_0x5494fe,{'name':_0x5494fe[_0x9ebd('0x89')]||_0x5494fe['name']||_0x55d0f9[_0x9ebd('0x21')],'basename':_0x47b6bd,'savename':util[_0x9ebd('0x6d')](_0x9ebd('0x8a'),_0x5494fe[_0x9ebd('0x21')]||_0x55d0f9['name'],require('randomstring')[_0x9ebd('0x8b')](0x4),_0x5494fe[_0x9ebd('0x87')]||_0x9ebd('0x8c')),'reportId':_0x55d0f9['id'],'reportType':_0x9ebd('0x8d')});return db[_0x9ebd('0x8e')][_0x9ebd('0x3f')](_0x401e30,{'raw':!![]});})[_0x9ebd('0x1c')](function(_0x297ed3){if(_0x55d0f9['table']==='cdr'){_0x52660d['where'](_0x55d0f9['table']+_0x9ebd('0x8f'),_0x5494fe['startDate'],_0x5494fe[_0x9ebd('0x90')]);}else{_0x52660d[_0x9ebd('0x2f')](_0x55d0f9[_0x9ebd('0x68')]+_0x9ebd('0x91'),_0x5494fe[_0x9ebd('0x92')],_0x5494fe[_0x9ebd('0x90')]);}if(_0x297ed3){logger['info'](_0x9ebd('0x93'),_0x52660d['toString']());require(_0x9ebd('0x94'))[_0x9ebd('0x95')](path[_0x9ebd('0x4a')](__dirname,_0x9ebd('0x96'),_0x297ed3['output']),[_0x297ed3['id'],_0x52660d['toString'](),path['join'](__dirname,'../../files/reports',_0x297ed3[_0x9ebd('0x97')]),_0x47b6bd]);return _0x297ed3;}else{var _0x33339=squel[_0x9ebd('0x81')]();_0x33339[_0x9ebd('0x67')]('('+_0x52660d['toString']()+')',_0x9ebd('0x98'));_0x33339['field'](_0x9ebd('0x99'),_0x9ebd('0x37'));_0x52660d[_0x9ebd('0x18')](_0x5494fe[_0x9ebd('0x18')]||_0x2558aa);_0x52660d[_0x9ebd('0x17')](_0x5494fe[_0x9ebd('0x17')]||0x0);return db[_0x9ebd('0x7b')][_0x9ebd('0x27')](_0x33339[_0x9ebd('0x7a')](),{'type':db[_0x9ebd('0x7b')]['QueryTypes'][_0x9ebd('0x7c')]})[_0x9ebd('0x1c')](function(_0x1915ba){if(!_0x1915ba['length']){_0x268c2a=0x0;}else{_0x268c2a=_0x1915ba[0x0][_0x9ebd('0x37')]||0x0;}return db[_0x9ebd('0x7b')][_0x9ebd('0x27')](_0x52660d[_0x9ebd('0x7a')](),{'type':db['sequelize'][_0x9ebd('0x85')][_0x9ebd('0x7c')]});})[_0x9ebd('0x1c')](function(_0x32b74){return{'rows':_0x32b74||[],'count':_0x268c2a};});}});}exports[_0x9ebd('0x9a')]=function(_0x9db8f8,_0x2e160f){return runReport(_0x9db8f8[_0x9ebd('0x48')],_0x9db8f8[_0x9ebd('0x27')],_0x9db8f8[_0x9ebd('0x36')])['then'](respondWithResult(_0x2e160f,null))[_0x9ebd('0x3b')](handleError(_0x2e160f,null));};exports['runReport']=runReport;exports[_0x9ebd('0x27')]=function(_0x5275c4,_0x1facd2){var _0x4157c7=0xa;var _0x42bf4b=[_0x9ebd('0x4a'),_0x9ebd('0x4b'),'right_join',_0x9ebd('0x4d')];var _0x1ed454={'SUM':_0x9ebd('0x4e'),'COUNT':_0x9ebd('0x4f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9ebd('0x51'),'MIN':_0x9ebd('0x52'),'AVG':_0x9ebd('0x53'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x9ebd('0x55'),'GROUP_CONCAT DESC':_0x9ebd('0x56')};var _0x54d354={'SEC_TO_TIME':_0x9ebd('0x57'),'DATE':_0x9ebd('0x9b'),'HOUR':_0x9ebd('0x7d'),'ROUND':_0x9ebd('0x58'),'UNIX_TIMESTAMP':_0x9ebd('0x59')};var _0x2c786b=function(_0x2fd284){return!_[_0x9ebd('0x5a')](['IS\x20NULL',_0x9ebd('0x5c'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x2fd284);};var _0x31ff56=function(_0x2f19cf){if(!_0x2f19cf||!_0x2f19cf['rules']['length']){return'';}for(var _0x33aeb1='(',_0x56147b=0x0;_0x56147b<_0x2f19cf[_0x9ebd('0x5e')][_0x9ebd('0x3d')];_0x56147b+=0x1){_0x56147b>0x0&&(_0x33aeb1+='\x20'+_0x2f19cf['operator']+'\x20');_0x33aeb1+=_0x2f19cf[_0x9ebd('0x5e')][_0x56147b][_0x9ebd('0x60')]?_0x31ff56(_0x2f19cf[_0x9ebd('0x5e')][_0x56147b][_0x9ebd('0x60')]):_0x2f19cf[_0x9ebd('0x5e')][_0x56147b][_0x9ebd('0x61')]+'\x20'+_0x2f19cf[_0x9ebd('0x5e')][_0x56147b][_0x9ebd('0x62')]+(_0x2c786b(_0x2f19cf['rules'][_0x56147b][_0x9ebd('0x62')])?'\x20'+_0x2f19cf[_0x9ebd('0x5e')][_0x56147b][_0x9ebd('0x7e')]:'');}return _0x33aeb1+')';};var _0x85c007={'where':{'id':_0x5275c4[_0x9ebd('0x48')]['id']}},_0x336844,_0x4b5bee,_0x13e018,_0x38048c,_0x182722;_0x85c007=_[_0x9ebd('0x33')]({},_0x85c007,_0x5275c4[_0x9ebd('0x36')]);return db[_0x9ebd('0x24')][_0x9ebd('0x3e')](_0x85c007)[_0x9ebd('0x1c')](function(_0x59c1d8){if(_0x59c1d8){_0x336844=_0x59c1d8;return _0x59c1d8[_0x9ebd('0x7f')]();}return null;})[_0x9ebd('0x1c')](function(_0x4cd1db){if(_0x4cd1db){if(!_0x4cd1db[_0x9ebd('0x3d')]){throw new db['Sequelize'][(_0x9ebd('0x64'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4b5bee=_0x4cd1db;return db[_0x9ebd('0x65')][_0x9ebd('0x3a')]({'raw':!![]});}return null;})[_0x9ebd('0x1c')](function(_0x41a572){if(_0x41a572){_0x13e018=_[_0x9ebd('0x66')](_0x41a572,'id');var _0x93ee0f;var _0x48d82e=squel['select']();_0x48d82e[_0x9ebd('0x67')](_0x336844['table']);for(var _0xabb8dc=0x0;_0xabb8dc<_0x4b5bee[_0x9ebd('0x3d')];_0xabb8dc+=0x1){_0x93ee0f=_0x4b5bee[_0xabb8dc]['MetricId']?_0x13e018[_0x4b5bee[_0xabb8dc][_0x9ebd('0x69')]][_0x9ebd('0x6a')]:_0x4b5bee[_0xabb8dc][_0x9ebd('0x61')];_0x93ee0f=_0x4b5bee[_0xabb8dc][_0x9ebd('0x6b')]?_[_0x9ebd('0x6c')](_0x1ed454[_0x4b5bee[_0xabb8dc][_0x9ebd('0x6b')]],'%s',_0x93ee0f):_0x93ee0f;_0x93ee0f=_0x4b5bee[_0xabb8dc][_0x9ebd('0x6d')]?_['replace'](_0x54d354[_0x4b5bee[_0xabb8dc][_0x9ebd('0x6d')]],'%s',_0x93ee0f):_0x93ee0f;if(_0x4b5bee[_0xabb8dc][_0x9ebd('0x6e')]){_0x48d82e[_0x9ebd('0x60')](_0x93ee0f);}_0x4b5bee[_0xabb8dc][_0x9ebd('0x83')]&&_0x48d82e[_0x9ebd('0x82')](_0x93ee0f,_0x4b5bee[_0xabb8dc][_0x9ebd('0x83')]==='DESC'?![]:!![]);_0x48d82e['field'](_0x93ee0f,_0x4b5bee[_0xabb8dc][_0x9ebd('0x6f')]||_0x93ee0f);}if(_0x336844['joins']){_0x336844[_0x9ebd('0x70')]=JSON['parse'](_0x336844[_0x9ebd('0x70')]);for(var _0x32097d=0x0;_0x32097d<_0x336844['joins']['length'];_0x32097d+=0x1){if(_0x336844[_0x9ebd('0x70')][_0x32097d][_0x9ebd('0x34')]&&_[_0x9ebd('0x5a')](_0x42bf4b,_0x336844[_0x9ebd('0x70')][_0x32097d][_0x9ebd('0x34')])&&_0x336844[_0x9ebd('0x70')][_0x32097d]['parentKey']&&_0x336844['joins'][_0x32097d]['foreignTable']&&_0x336844['joins'][_0x32097d][_0x9ebd('0x75')]){_0x48d82e[_0x336844[_0x9ebd('0x70')][_0x32097d][_0x9ebd('0x34')]](_0x336844['joins'][_0x32097d][_0x9ebd('0x73')],null,util[_0x9ebd('0x6d')]('%s.%s\x20=\x20%s.%s',_0x336844[_0x9ebd('0x68')],_0x336844[_0x9ebd('0x70')][_0x32097d][_0x9ebd('0x72')],_0x336844[_0x9ebd('0x70')][_0x32097d][_0x9ebd('0x73')],_0x336844[_0x9ebd('0x70')][_0x32097d][_0x9ebd('0x75')]));}}}if(_0x336844['conditions']){_0x336844[_0x9ebd('0x76')]=JSON[_0x9ebd('0x71')](_0x336844[_0x9ebd('0x76')]);_0x48d82e['where'](_0x31ff56(_0x336844['conditions']['group']));}_0x182722=_0x48d82e[_0x9ebd('0x77')]();_0x48d82e[_0x9ebd('0x18')](_0x4157c7);_0x48d82e[_0x9ebd('0x17')](0x0);logger[_0x9ebd('0x78')]('Limited\x20Query:',_0x48d82e[_0x9ebd('0x7a')]());return db['sequelize']['query'](_0x48d82e[_0x9ebd('0x7a')](),{'type':db[_0x9ebd('0x7b')]['QueryTypes'][_0x9ebd('0x7c')]});}})['then'](function(){return{'sql':_0x182722['toString']()};})[_0x9ebd('0x1c')](respondWithResult(_0x1facd2,null))[_0x9ebd('0x3b')](handleError(_0x1facd2,null));}; \ No newline at end of file +var _0xa1bb=['query','keys','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','get','Reports','UserProfileSection','autoAssociation','preview','left_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','rules','group','field','condition','value','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','join','right_join','cross_join','COUNT(%s)','ROUND(%s)','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','select','QueryTypes','No\x20available\x20data','output','web','%s-%s.%s','csv','startDate','endDate','info','fork','../../files/reports','countTable','run','runReport','MAX(%s)','DATE(%s)','alias','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','apply','reject','save','update','destroy','UserProfileResource','then','sendStatus','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model'];(function(_0x514049,_0x2ace1e){var _0x20c1c3=function(_0x2eefeb){while(--_0x2eefeb){_0x514049['push'](_0x514049['shift']());}};_0x20c1c3(++_0x2ace1e);}(_0xa1bb,0x69));var _0xba1b=function(_0x5cd0db,_0x3a6b29){_0x5cd0db=_0x5cd0db-0x0;var _0xeb78e3=_0xa1bb[_0x5cd0db];return _0xeb78e3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xba1b('0x0'));var rimraf=require(_0xba1b('0x1'));var zipdir=require(_0xba1b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba1b('0x3'));var moment=require(_0xba1b('0x4'));var BPromise=require(_0xba1b('0x5'));var Mustache=require(_0xba1b('0x6'));var util=require(_0xba1b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xba1b('0x8'));var ejs=require(_0xba1b('0x9'));var fs=require('fs');var _=require(_0xba1b('0xa'));var squel=require(_0xba1b('0xb'));var crypto=require(_0xba1b('0xc'));var jsforce=require(_0xba1b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xba1b('0x8'));var querystring=require(_0xba1b('0xe'));var Papa=require(_0xba1b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xba1b('0x10'));var hardwareService=require(_0xba1b('0x11'));var logger=require(_0xba1b('0x12'))(_0xba1b('0x13'));var utils=require(_0xba1b('0x14'));var config=require('../../config/environment');var db=require(_0xba1b('0x15'))['db'];function respondWithStatusCode(_0x3c5faa,_0x3925d1){_0x3925d1=_0x3925d1||0xcc;return function(_0x3d566e){if(_0x3d566e){return _0x3c5faa['sendStatus'](_0x3925d1);}return _0x3c5faa[_0xba1b('0x16')](_0x3925d1)[_0xba1b('0x17')]();};}function respondWithResult(_0x13c8fc,_0xb1aad7){_0xb1aad7=_0xb1aad7||0xc8;return function(_0x313e98){if(_0x313e98){return _0x13c8fc[_0xba1b('0x16')](_0xb1aad7)[_0xba1b('0x18')](_0x313e98);}};}function respondWithFilteredResult(_0x2e6135,_0x158f90){return function(_0x559b25){if(_0x559b25){var _0x4e8258=_0x559b25['count'],_0x524518=_0x158f90[_0xba1b('0x19')],_0x2c7ed0=_0x158f90[_0xba1b('0x19')]+_0x158f90[_0xba1b('0x1a')],_0x3bc4ae;if(_0x2c7ed0>=_0x4e8258){_0x2c7ed0=_0x4e8258;_0x3bc4ae=0xc8;}else{_0x3bc4ae=0xce;}_0x2e6135[_0xba1b('0x16')](_0x3bc4ae);return _0x2e6135['set']('Content-Range',_0x524518+'-'+_0x2c7ed0+'/'+_0x4e8258)[_0xba1b('0x18')](_0x559b25);}return null;};}function patchUpdates(_0x4741e3){return function(_0x295d35){try{jsonpatch[_0xba1b('0x1b')](_0x295d35,_0x4741e3,!![]);}catch(_0x2c110a){return BPromise[_0xba1b('0x1c')](_0x2c110a);}return _0x295d35[_0xba1b('0x1d')]();};}function saveUpdates(_0x2238f5,_0x2dcb5f){return function(_0x671f0d){if(_0x671f0d){return _0x671f0d[_0xba1b('0x1e')](_0x2238f5)['then'](function(_0x1c08c6){return _0x1c08c6;});}return null;};}function removeEntity(_0x4cd70b,_0x3f72a8){return function(_0x4ec08a){if(_0x4ec08a){return _0x4ec08a[_0xba1b('0x1f')]()['then'](function(){var _0x27a6a0=_0x4ec08a['get']({'plain':!![]});var _0x20a87d='CustomReports';return db[_0xba1b('0x20')][_0xba1b('0x1f')]({'where':{'type':_0x20a87d,'resourceId':_0x27a6a0['id']}})[_0xba1b('0x21')](function(){return _0x4ec08a;});})[_0xba1b('0x21')](function(){_0x4cd70b['status'](0xcc)[_0xba1b('0x17')]();});}};}function handleEntityNotFound(_0x6d3cb0,_0x1c55b5){return function(_0x3f9676){if(!_0x3f9676){_0x6d3cb0[_0xba1b('0x22')](0x194);}return _0x3f9676;};}function handleError(_0x5c9388,_0x63ff3a){_0x63ff3a=_0x63ff3a||0x1f4;return function(_0x5836f9){logger[_0xba1b('0x23')](_0x5836f9[_0xba1b('0x24')]);if(_0x5836f9['name']){delete _0x5836f9[_0xba1b('0x25')];}_0x5c9388[_0xba1b('0x16')](_0x63ff3a)[_0xba1b('0x26')](_0x5836f9);};}exports['index']=function(_0x55d6ca,_0x476a42){var _0x4a22b0={},_0x5b1b19={},_0x18602d={'count':0x0,'rows':[]};var _0x4c795d=_[_0xba1b('0x27')](db[_0xba1b('0x28')][_0xba1b('0x29')],function(_0x53ec41){return{'name':_0x53ec41[_0xba1b('0x2a')],'type':_0x53ec41[_0xba1b('0x2b')][_0xba1b('0x2c')]};});_0x5b1b19[_0xba1b('0x2d')]=_[_0xba1b('0x27')](_0x4c795d,'name');_0x5b1b19[_0xba1b('0x2e')]=_[_0xba1b('0x2f')](_0x55d6ca[_0xba1b('0x2e')]);_0x5b1b19['filters']=_['intersection'](_0x5b1b19['model'],_0x5b1b19[_0xba1b('0x2e')]);_0x4a22b0[_0xba1b('0x30')]=_['intersection'](_0x5b1b19[_0xba1b('0x2d')],qs['fields'](_0x55d6ca[_0xba1b('0x2e')][_0xba1b('0x31')]));_0x4a22b0[_0xba1b('0x30')]=_0x4a22b0[_0xba1b('0x30')][_0xba1b('0x32')]?_0x4a22b0['attributes']:_0x5b1b19[_0xba1b('0x2d')];if(!_0x55d6ca[_0xba1b('0x2e')][_0xba1b('0x33')]('nolimit')){_0x4a22b0[_0xba1b('0x1a')]=qs[_0xba1b('0x1a')](_0x55d6ca[_0xba1b('0x2e')]['limit']);_0x4a22b0[_0xba1b('0x19')]=qs[_0xba1b('0x19')](_0x55d6ca[_0xba1b('0x2e')][_0xba1b('0x19')]);}_0x4a22b0[_0xba1b('0x34')]=qs[_0xba1b('0x35')](_0x55d6ca[_0xba1b('0x2e')][_0xba1b('0x35')]);_0x4a22b0[_0xba1b('0x36')]=qs[_0xba1b('0x37')](_[_0xba1b('0x38')](_0x55d6ca[_0xba1b('0x2e')],_0x5b1b19['filters']));if(_0x55d6ca[_0xba1b('0x2e')][_0xba1b('0x39')]){_0x4a22b0['where']=_[_0xba1b('0x3a')](_0x4a22b0['where'],{'$or':_['map'](_0x4c795d,function(_0x55bc31){if(_0x55bc31[_0xba1b('0x2b')]!==_0xba1b('0x3b')){var _0x2c1ef9={};_0x2c1ef9[_0x55bc31[_0xba1b('0x25')]]={'$like':'%'+_0x55d6ca[_0xba1b('0x2e')][_0xba1b('0x39')]+'%'};return _0x2c1ef9;}})});}_0x4a22b0=_[_0xba1b('0x3a')]({},_0x4a22b0,_0x55d6ca[_0xba1b('0x3c')]);var _0x299558={'where':_0x4a22b0[_0xba1b('0x36')]};return db[_0xba1b('0x28')][_0xba1b('0x3d')](_0x299558)[_0xba1b('0x21')](function(_0x1544cb){_0x18602d[_0xba1b('0x3d')]=_0x1544cb;if(_0x55d6ca['query']['includeAll']){_0x4a22b0['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xba1b('0x3e')](_0x4a22b0);})['then'](function(_0x41b7df){_0x18602d[_0xba1b('0x3f')]=_0x41b7df;return _0x18602d;})['then'](respondWithFilteredResult(_0x476a42,_0x4a22b0))[_0xba1b('0x40')](handleError(_0x476a42,null));};exports[_0xba1b('0x41')]=function(_0x30ed30,_0x257b9b){var _0x911b0e={'raw':![],'where':{'id':_0x30ed30[_0xba1b('0x42')]['id']}},_0x29361c={};_0x29361c[_0xba1b('0x2d')]=_[_0xba1b('0x2f')](db['AnalyticCustomReport'][_0xba1b('0x29')]);_0x29361c[_0xba1b('0x2e')]=_[_0xba1b('0x2f')](_0x30ed30['query']);_0x29361c[_0xba1b('0x37')]=_['intersection'](_0x29361c['model'],_0x29361c[_0xba1b('0x2e')]);_0x911b0e[_0xba1b('0x30')]=_['intersection'](_0x29361c['model'],qs[_0xba1b('0x31')](_0x30ed30['query'][_0xba1b('0x31')]));_0x911b0e[_0xba1b('0x30')]=_0x911b0e['attributes'][_0xba1b('0x32')]?_0x911b0e[_0xba1b('0x30')]:_0x29361c['model'];if(_0x30ed30['query'][_0xba1b('0x43')]){_0x911b0e[_0xba1b('0x44')]=[{'all':!![]}];}_0x911b0e=_[_0xba1b('0x3a')]({},_0x911b0e,_0x30ed30['options']);return db[_0xba1b('0x28')][_0xba1b('0x45')](_0x911b0e)[_0xba1b('0x21')](handleEntityNotFound(_0x257b9b,null))[_0xba1b('0x21')](respondWithResult(_0x257b9b,null))[_0xba1b('0x40')](handleError(_0x257b9b,null));};exports[_0xba1b('0x46')]=function(_0x5a192c,_0x575898){return db[_0xba1b('0x28')][_0xba1b('0x46')](_0x5a192c[_0xba1b('0x47')],{})[_0xba1b('0x21')](function(_0x546770){var _0x3cba40=_0x5a192c[_0xba1b('0x48')][_0xba1b('0x49')]({'plain':!![]});if(!_0x3cba40)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cba40['role']==='user'){var _0x55fb73=_0x546770[_0xba1b('0x49')]({'plain':!![]});var _0x198b63=_0xba1b('0x4a');return db[_0xba1b('0x4b')][_0xba1b('0x45')]({'where':{'name':_0x198b63,'userProfileId':_0x3cba40['userProfileId']},'raw':!![]})[_0xba1b('0x21')](function(_0x45a352){if(_0x45a352&&_0x45a352[_0xba1b('0x4c')]===0x0){return db[_0xba1b('0x20')][_0xba1b('0x46')]({'name':_0x55fb73[_0xba1b('0x25')],'resourceId':_0x55fb73['id'],'type':'CustomReports','sectionId':_0x45a352['id']},{})[_0xba1b('0x21')](function(){return _0x546770;});}else{return _0x546770;}})[_0xba1b('0x40')](function(_0x43bf92){logger[_0xba1b('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43bf92);throw _0x43bf92;});}return _0x546770;})['then'](respondWithResult(_0x575898,0xc9))[_0xba1b('0x40')](handleError(_0x575898,null));};exports[_0xba1b('0x1e')]=function(_0x44e953,_0x3dbb76){if(_0x44e953['body']['id']){delete _0x44e953[_0xba1b('0x47')]['id'];}return db[_0xba1b('0x28')][_0xba1b('0x45')]({'where':{'id':_0x44e953[_0xba1b('0x42')]['id']}})[_0xba1b('0x21')](handleEntityNotFound(_0x3dbb76,null))['then'](saveUpdates(_0x44e953[_0xba1b('0x47')],null))[_0xba1b('0x21')](respondWithResult(_0x3dbb76,null))[_0xba1b('0x40')](handleError(_0x3dbb76,null));};exports['destroy']=function(_0x175504,_0x4e08fa){return db['AnalyticCustomReport'][_0xba1b('0x45')]({'where':{'id':_0x175504['params']['id']}})[_0xba1b('0x21')](handleEntityNotFound(_0x4e08fa,null))[_0xba1b('0x21')](removeEntity(_0x4e08fa,null))[_0xba1b('0x40')](handleError(_0x4e08fa,null));};exports[_0xba1b('0x4d')]=function(_0x48da71,_0x460504){var _0x35195c=0xa;var _0xf0fbf5=['join',_0xba1b('0x4e'),'right_join','cross_join'];var _0x230fe4={'SUM':_0xba1b('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xba1b('0x50'),'MAX':'MAX(%s)','MIN':_0xba1b('0x51'),'AVG':_0xba1b('0x52'),'GROUP_CONCAT':_0xba1b('0x53'),'GROUP_CONCAT ASC':_0xba1b('0x54'),'GROUP_CONCAT DESC':_0xba1b('0x55')};var _0x1178f7={'SEC_TO_TIME':_0xba1b('0x56'),'DATE':'DATE(%s)','HOUR':_0xba1b('0x57'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xba1b('0x58')};var _0xb05028=function(_0x4ab08b){return!_[_0xba1b('0x59')](['IS\x20NULL',_0xba1b('0x5a'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x4ab08b);};var _0x7fdb15=function(_0x57168c){if(!_0x57168c||!_0x57168c[_0xba1b('0x5b')][_0xba1b('0x32')]){return'';}for(var _0x289c65='(',_0x1ac8d7=0x0;_0x1ac8d7<_0x57168c['rules']['length'];_0x1ac8d7+=0x1){_0x1ac8d7>0x0&&(_0x289c65+='\x20'+_0x57168c['operator']+'\x20');_0x289c65+=_0x57168c[_0xba1b('0x5b')][_0x1ac8d7][_0xba1b('0x5c')]?_0x7fdb15(_0x57168c[_0xba1b('0x5b')][_0x1ac8d7][_0xba1b('0x5c')]):_0x57168c[_0xba1b('0x5b')][_0x1ac8d7][_0xba1b('0x5d')]+'\x20'+_0x57168c['rules'][_0x1ac8d7][_0xba1b('0x5e')]+(_0xb05028(_0x57168c[_0xba1b('0x5b')][_0x1ac8d7][_0xba1b('0x5e')])?'\x20'+_0x57168c[_0xba1b('0x5b')][_0x1ac8d7][_0xba1b('0x5f')]:'');}return _0x289c65+')';};var _0x568efd={'where':{'id':_0x48da71[_0xba1b('0x42')]['id']}},_0xc53235,_0x425e58,_0x2272f8,_0x144292,_0x13d65d;_0x568efd=_[_0xba1b('0x3a')]({},_0x568efd,_0x48da71[_0xba1b('0x3c')]);return db[_0xba1b('0x28')]['find'](_0x568efd)[_0xba1b('0x21')](function(_0x2d0004){if(_0x2d0004){_0xc53235=_0x2d0004;return _0x2d0004['getFields']();}return null;})['then'](function(_0x2e996d){if(_0x2e996d){if(!_0x2e996d[_0xba1b('0x32')]){throw new db['Sequelize'][(_0xba1b('0x60'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x425e58=_0x2e996d;return db[_0xba1b('0x61')][_0xba1b('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x5d6bac){if(_0x5d6bac){_0x2272f8=_[_0xba1b('0x62')](_0x5d6bac,'id');var _0x287f64;var _0x5e7d5a=squel['select']();_0x5e7d5a[_0xba1b('0x63')](_0xc53235[_0xba1b('0x64')]);for(var _0x4479cd=0x0;_0x4479cd<_0x425e58[_0xba1b('0x32')];_0x4479cd+=0x1){_0x287f64=_0x425e58[_0x4479cd][_0xba1b('0x65')]?_0x2272f8[_0x425e58[_0x4479cd][_0xba1b('0x65')]][_0xba1b('0x66')]:_0x425e58[_0x4479cd][_0xba1b('0x5d')];_0x287f64=_0x425e58[_0x4479cd][_0xba1b('0x67')]?_[_0xba1b('0x68')](_0x230fe4[_0x425e58[_0x4479cd]['function']],'%s',_0x287f64):_0x287f64;_0x287f64=_0x425e58[_0x4479cd][_0xba1b('0x69')]?_[_0xba1b('0x68')](_0x1178f7[_0x425e58[_0x4479cd][_0xba1b('0x69')]],'%s',_0x287f64):_0x287f64;if(_0x425e58[_0x4479cd][_0xba1b('0x6a')]){_0x5e7d5a['group'](_0x287f64);}_0x425e58[_0x4479cd][_0xba1b('0x6b')]&&_0x5e7d5a[_0xba1b('0x34')](_0x287f64,_0x425e58[_0x4479cd]['orderBy']===_0xba1b('0x6c')?![]:!![]);_0x5e7d5a['field'](_0x287f64,_0x425e58[_0x4479cd]['alias']||_0x287f64);}if(_0xc53235['joins']){_0xc53235[_0xba1b('0x6d')]=JSON[_0xba1b('0x6e')](_0xc53235[_0xba1b('0x6d')]);for(var _0x497acb=0x0;_0x497acb<_0xc53235[_0xba1b('0x6d')][_0xba1b('0x32')];_0x497acb+=0x1){if(_0xc53235['joins'][_0x497acb][_0xba1b('0x2b')]&&_[_0xba1b('0x59')](_0xf0fbf5,_0xc53235['joins'][_0x497acb][_0xba1b('0x2b')])&&_0xc53235['joins'][_0x497acb][_0xba1b('0x6f')]&&_0xc53235[_0xba1b('0x6d')][_0x497acb][_0xba1b('0x70')]&&_0xc53235[_0xba1b('0x6d')][_0x497acb][_0xba1b('0x71')]){_0x5e7d5a[_0xc53235[_0xba1b('0x6d')][_0x497acb]['type']](_0xc53235['joins'][_0x497acb]['foreignTable'],null,util[_0xba1b('0x69')](_0xba1b('0x72'),_0xc53235['table'],_0xc53235[_0xba1b('0x6d')][_0x497acb][_0xba1b('0x6f')],_0xc53235[_0xba1b('0x6d')][_0x497acb][_0xba1b('0x70')],_0xc53235[_0xba1b('0x6d')][_0x497acb]['foreignKey']));}}}if(_0xc53235['conditions']){_0xc53235[_0xba1b('0x73')]=JSON[_0xba1b('0x6e')](_0xc53235[_0xba1b('0x73')]);_0x5e7d5a[_0xba1b('0x36')](_0x7fdb15(_0xc53235['conditions']['group']));}_0x13d65d=_0x5e7d5a[_0xba1b('0x74')]();_0x5e7d5a[_0xba1b('0x1a')](_0x35195c);_0x5e7d5a[_0xba1b('0x19')](0x0);logger[_0xba1b('0x75')](_0xba1b('0x76'),_0x5e7d5a[_0xba1b('0x77')]());return db[_0xba1b('0x78')][_0xba1b('0x2e')](_0x5e7d5a[_0xba1b('0x77')](),{'type':db[_0xba1b('0x78')]['QueryTypes'][_0xba1b('0x79')]});}})['then'](respondWithResult(_0x460504,null))['catch'](handleError(_0x460504,null));};function runReport(_0x69a90e,_0x53ea93,_0xf3fffa){var _0x39f879=_0x53ea93[_0xba1b('0x25')];var _0x3afaa8=0xa;var _0x1b33dc=[_0xba1b('0x7a'),_0xba1b('0x4e'),_0xba1b('0x7b'),_0xba1b('0x7c')];var _0x5bc0bf={'SUM':'SUM(%s)','COUNT':_0xba1b('0x7d'),'COUNT DISTINCT':_0xba1b('0x50'),'MAX':'MAX(%s)','MIN':_0xba1b('0x51'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xba1b('0x53'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xba1b('0x55')};var _0x46c7e7={'SEC_TO_TIME':_0xba1b('0x56'),'DATE':'DATE(%s)','HOUR':_0xba1b('0x57'),'ROUND':_0xba1b('0x7e'),'UNIX_TIMESTAMP':_0xba1b('0x58')};var _0x2af5ae=function(_0xd5d45b){return!_[_0xba1b('0x59')]([_0xba1b('0x7f'),'IS\x20NOT\x20NULL',_0xba1b('0x80'),_0xba1b('0x81')],_0xd5d45b);};var _0x51719a=function(_0x4911f5){if(!_0x4911f5||!_0x4911f5['rules']['length']){return'';}for(var _0x2ae149='(',_0x14ccc3=0x0;_0x14ccc3<_0x4911f5[_0xba1b('0x5b')]['length'];_0x14ccc3+=0x1){_0x14ccc3>0x0&&(_0x2ae149+='\x20'+_0x4911f5[_0xba1b('0x82')]+'\x20');_0x2ae149+=_0x4911f5['rules'][_0x14ccc3]['group']?_0x51719a(_0x4911f5['rules'][_0x14ccc3]['group']):_0x4911f5[_0xba1b('0x5b')][_0x14ccc3][_0xba1b('0x5d')]+'\x20'+_0x4911f5['rules'][_0x14ccc3][_0xba1b('0x5e')]+(_0x2af5ae(_0x4911f5[_0xba1b('0x5b')][_0x14ccc3]['condition'])?'\x20'+_0x4911f5[_0xba1b('0x5b')][_0x14ccc3][_0xba1b('0x5f')]:'');}return _0x2ae149+')';};var _0x38f719={'where':{'id':_0x69a90e['id']}},_0x449817,_0x4fb0e2,_0x31d9c9,_0x428604,_0x2e422d;_0x38f719=_[_0xba1b('0x3a')]({},_0x38f719,_0xf3fffa);return db[_0xba1b('0x28')]['find'](_0x38f719)['then'](function(_0x476c0c){if(_0x476c0c){_0x449817=_0x476c0c;return _0x476c0c['getFields']();}return null;})[_0xba1b('0x21')](function(_0xaade7f){if(_0xaade7f){if(!_0xaade7f[_0xba1b('0x32')]){throw new db[(_0xba1b('0x83'))][(_0xba1b('0x60'))](_0xba1b('0x84'),0x193);}_0x4fb0e2=_0xaade7f;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xba1b('0x21')](function(_0x5e810e){if(_0x5e810e){_0x31d9c9=_[_0xba1b('0x62')](_0x5e810e,'id');var _0x1031a1;var _0x405e4c=squel[_0xba1b('0x85')]();_0x405e4c['from'](_0x449817[_0xba1b('0x64')]);for(var _0x379f2e=0x0;_0x379f2e<_0x4fb0e2['length'];_0x379f2e+=0x1){_0x1031a1=_0x4fb0e2[_0x379f2e][_0xba1b('0x65')]?_0x31d9c9[_0x4fb0e2[_0x379f2e][_0xba1b('0x65')]][_0xba1b('0x66')]:_0x4fb0e2[_0x379f2e][_0xba1b('0x5d')];_0x1031a1=_0x4fb0e2[_0x379f2e][_0xba1b('0x67')]?_['replace'](_0x5bc0bf[_0x4fb0e2[_0x379f2e]['function']],'%s',_0x1031a1):_0x1031a1;_0x1031a1=_0x4fb0e2[_0x379f2e][_0xba1b('0x69')]?_[_0xba1b('0x68')](_0x46c7e7[_0x4fb0e2[_0x379f2e][_0xba1b('0x69')]],'%s',_0x1031a1):_0x1031a1;if(_0x4fb0e2[_0x379f2e][_0xba1b('0x6a')]){_0x405e4c[_0xba1b('0x5c')](_0x1031a1);}_0x4fb0e2[_0x379f2e][_0xba1b('0x6b')]&&_0x405e4c[_0xba1b('0x34')](_0x1031a1,_0x4fb0e2[_0x379f2e]['orderBy']===_0xba1b('0x6c')?![]:!![]);_0x405e4c[_0xba1b('0x5d')](_0x1031a1,_0x4fb0e2[_0x379f2e]['alias']||_0x1031a1);}if(_0x449817['joins']){_0x449817[_0xba1b('0x6d')]=JSON[_0xba1b('0x6e')](_0x449817[_0xba1b('0x6d')]);for(var _0x550f00=0x0;_0x550f00<_0x449817[_0xba1b('0x6d')][_0xba1b('0x32')];_0x550f00+=0x1){if(_0x449817[_0xba1b('0x6d')][_0x550f00][_0xba1b('0x2b')]&&_['includes'](_0x1b33dc,_0x449817[_0xba1b('0x6d')][_0x550f00]['type'])&&_0x449817[_0xba1b('0x6d')][_0x550f00][_0xba1b('0x6f')]&&_0x449817[_0xba1b('0x6d')][_0x550f00][_0xba1b('0x70')]&&_0x449817[_0xba1b('0x6d')][_0x550f00]['foreignKey']){_0x405e4c[_0x449817[_0xba1b('0x6d')][_0x550f00][_0xba1b('0x2b')]](_0x449817[_0xba1b('0x6d')][_0x550f00][_0xba1b('0x70')],null,util['format'](_0xba1b('0x72'),_0x449817[_0xba1b('0x64')],_0x449817[_0xba1b('0x6d')][_0x550f00][_0xba1b('0x6f')],_0x449817[_0xba1b('0x6d')][_0x550f00][_0xba1b('0x70')],_0x449817[_0xba1b('0x6d')][_0x550f00][_0xba1b('0x71')]));}}}if(_0x449817[_0xba1b('0x73')]){_0x449817[_0xba1b('0x73')]=JSON[_0xba1b('0x6e')](_0x449817['conditions']);_0x405e4c[_0xba1b('0x36')](_0x51719a(_0x449817[_0xba1b('0x73')][_0xba1b('0x5c')]));}_0x2e422d=_0x405e4c[_0xba1b('0x74')]();_0x405e4c[_0xba1b('0x1a')](_0x3afaa8);_0x405e4c[_0xba1b('0x19')](0x0);logger[_0xba1b('0x75')](_0xba1b('0x76'),_0x405e4c['toString']());return db['sequelize'][_0xba1b('0x2e')](_0x405e4c[_0xba1b('0x77')](),{'type':db[_0xba1b('0x78')][_0xba1b('0x86')][_0xba1b('0x79')]});}})[_0xba1b('0x21')](function(_0x5c6fdf){if(!_0x5c6fdf[_0xba1b('0x32')]){throw new db[(_0xba1b('0x83'))][(_0xba1b('0x60'))](_0xba1b('0x87'),0xcc);}if(_0x53ea93[_0xba1b('0x88')]===_0xba1b('0x89')){return null;}var _0x2d0c85=_[_0xba1b('0x3a')](_0x53ea93,{'name':_0x53ea93['fullPath']||_0x53ea93[_0xba1b('0x25')]||_0x449817['name'],'basename':_0x39f879,'savename':util[_0xba1b('0x69')](_0xba1b('0x8a'),_0x53ea93[_0xba1b('0x25')]||_0x449817[_0xba1b('0x25')],require('randomstring')['generate'](0x4),_0x53ea93[_0xba1b('0x88')]||_0xba1b('0x8b')),'reportId':_0x449817['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0xba1b('0x46')](_0x2d0c85,{'raw':!![]});})[_0xba1b('0x21')](function(_0x67035d){if(_0x449817[_0xba1b('0x64')]==='cdr'){_0x2e422d[_0xba1b('0x36')](_0x449817['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x53ea93[_0xba1b('0x8c')],_0x53ea93[_0xba1b('0x8d')]);}else{_0x2e422d[_0xba1b('0x36')](_0x449817[_0xba1b('0x64')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x53ea93[_0xba1b('0x8c')],_0x53ea93[_0xba1b('0x8d')]);}if(_0x67035d){logger[_0xba1b('0x8e')]('Run\x20Query:',_0x2e422d[_0xba1b('0x77')]());require('child_process')[_0xba1b('0x8f')](path[_0xba1b('0x7a')](__dirname,'../../components/export/',_0x67035d[_0xba1b('0x88')]),[_0x67035d['id'],_0x2e422d[_0xba1b('0x77')](),path[_0xba1b('0x7a')](__dirname,_0xba1b('0x90'),_0x67035d['savename']),_0x39f879]);return _0x67035d;}else{var _0x439bae=squel[_0xba1b('0x85')]();_0x439bae[_0xba1b('0x63')]('('+_0x2e422d[_0xba1b('0x77')]()+')',_0xba1b('0x91'));_0x439bae[_0xba1b('0x5d')]('COUNT(*)',_0xba1b('0x3d'));_0x2e422d[_0xba1b('0x1a')](_0x53ea93['limit']||_0x3afaa8);_0x2e422d[_0xba1b('0x19')](_0x53ea93[_0xba1b('0x19')]||0x0);return db[_0xba1b('0x78')][_0xba1b('0x2e')](_0x439bae[_0xba1b('0x77')](),{'type':db['sequelize'][_0xba1b('0x86')][_0xba1b('0x79')]})[_0xba1b('0x21')](function(_0xf141ed){if(!_0xf141ed[_0xba1b('0x32')]){_0x428604=0x0;}else{_0x428604=_0xf141ed[0x0][_0xba1b('0x3d')]||0x0;}return db[_0xba1b('0x78')]['query'](_0x2e422d[_0xba1b('0x77')](),{'type':db[_0xba1b('0x78')][_0xba1b('0x86')][_0xba1b('0x79')]});})[_0xba1b('0x21')](function(_0x31b040){return{'rows':_0x31b040||[],'count':_0x428604};});}});}exports[_0xba1b('0x92')]=function(_0x423e50,_0x4df119){return runReport(_0x423e50[_0xba1b('0x42')],_0x423e50[_0xba1b('0x2e')],_0x423e50[_0xba1b('0x3c')])[_0xba1b('0x21')](respondWithResult(_0x4df119,null))[_0xba1b('0x40')](handleError(_0x4df119,null));};exports[_0xba1b('0x93')]=runReport;exports['query']=function(_0xeb59cb,_0x185ff4){var _0x112543=0xa;var _0x2e7805=[_0xba1b('0x7a'),_0xba1b('0x4e'),'right_join','cross_join'];var _0x20f5d4={'SUM':_0xba1b('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xba1b('0x50'),'MAX':_0xba1b('0x94'),'MIN':_0xba1b('0x51'),'AVG':_0xba1b('0x52'),'GROUP_CONCAT':_0xba1b('0x53'),'GROUP_CONCAT ASC':_0xba1b('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1af6d6={'SEC_TO_TIME':_0xba1b('0x56'),'DATE':_0xba1b('0x95'),'HOUR':'HOUR(%s)','ROUND':_0xba1b('0x7e'),'UNIX_TIMESTAMP':_0xba1b('0x58')};var _0x27f011=function(_0x34d42a){return!_[_0xba1b('0x59')](['IS\x20NULL',_0xba1b('0x5a'),_0xba1b('0x80'),_0xba1b('0x81')],_0x34d42a);};var _0x10290d=function(_0xad2575){if(!_0xad2575||!_0xad2575['rules'][_0xba1b('0x32')]){return'';}for(var _0x1ad0f6='(',_0xb3d9d0=0x0;_0xb3d9d0<_0xad2575[_0xba1b('0x5b')][_0xba1b('0x32')];_0xb3d9d0+=0x1){_0xb3d9d0>0x0&&(_0x1ad0f6+='\x20'+_0xad2575[_0xba1b('0x82')]+'\x20');_0x1ad0f6+=_0xad2575[_0xba1b('0x5b')][_0xb3d9d0]['group']?_0x10290d(_0xad2575[_0xba1b('0x5b')][_0xb3d9d0]['group']):_0xad2575[_0xba1b('0x5b')][_0xb3d9d0][_0xba1b('0x5d')]+'\x20'+_0xad2575[_0xba1b('0x5b')][_0xb3d9d0][_0xba1b('0x5e')]+(_0x27f011(_0xad2575[_0xba1b('0x5b')][_0xb3d9d0][_0xba1b('0x5e')])?'\x20'+_0xad2575[_0xba1b('0x5b')][_0xb3d9d0][_0xba1b('0x5f')]:'');}return _0x1ad0f6+')';};var _0x5fb5e6={'where':{'id':_0xeb59cb['params']['id']}},_0x50ea77,_0x589797,_0x3f1827,_0x54771a,_0x59ed64;_0x5fb5e6=_[_0xba1b('0x3a')]({},_0x5fb5e6,_0xeb59cb[_0xba1b('0x3c')]);return db[_0xba1b('0x28')][_0xba1b('0x45')](_0x5fb5e6)['then'](function(_0x1a2880){if(_0x1a2880){_0x50ea77=_0x1a2880;return _0x1a2880['getFields']();}return null;})[_0xba1b('0x21')](function(_0x4b65c8){if(_0x4b65c8){if(!_0x4b65c8[_0xba1b('0x32')]){throw new db[(_0xba1b('0x83'))][(_0xba1b('0x60'))](_0xba1b('0x84'),0x193);}_0x589797=_0x4b65c8;return db[_0xba1b('0x61')]['findAll']({'raw':!![]});}return null;})[_0xba1b('0x21')](function(_0x12682c){if(_0x12682c){_0x3f1827=_[_0xba1b('0x62')](_0x12682c,'id');var _0x59524e;var _0x413a35=squel['select']();_0x413a35['from'](_0x50ea77[_0xba1b('0x64')]);for(var _0x1e2b50=0x0;_0x1e2b50<_0x589797['length'];_0x1e2b50+=0x1){_0x59524e=_0x589797[_0x1e2b50][_0xba1b('0x65')]?_0x3f1827[_0x589797[_0x1e2b50][_0xba1b('0x65')]]['metric']:_0x589797[_0x1e2b50][_0xba1b('0x5d')];_0x59524e=_0x589797[_0x1e2b50][_0xba1b('0x67')]?_[_0xba1b('0x68')](_0x20f5d4[_0x589797[_0x1e2b50][_0xba1b('0x67')]],'%s',_0x59524e):_0x59524e;_0x59524e=_0x589797[_0x1e2b50][_0xba1b('0x69')]?_['replace'](_0x1af6d6[_0x589797[_0x1e2b50][_0xba1b('0x69')]],'%s',_0x59524e):_0x59524e;if(_0x589797[_0x1e2b50][_0xba1b('0x6a')]){_0x413a35[_0xba1b('0x5c')](_0x59524e);}_0x589797[_0x1e2b50][_0xba1b('0x6b')]&&_0x413a35[_0xba1b('0x34')](_0x59524e,_0x589797[_0x1e2b50][_0xba1b('0x6b')]==='DESC'?![]:!![]);_0x413a35[_0xba1b('0x5d')](_0x59524e,_0x589797[_0x1e2b50][_0xba1b('0x96')]||_0x59524e);}if(_0x50ea77['joins']){_0x50ea77[_0xba1b('0x6d')]=JSON[_0xba1b('0x6e')](_0x50ea77['joins']);for(var _0x35c48c=0x0;_0x35c48c<_0x50ea77[_0xba1b('0x6d')][_0xba1b('0x32')];_0x35c48c+=0x1){if(_0x50ea77[_0xba1b('0x6d')][_0x35c48c][_0xba1b('0x2b')]&&_[_0xba1b('0x59')](_0x2e7805,_0x50ea77[_0xba1b('0x6d')][_0x35c48c]['type'])&&_0x50ea77['joins'][_0x35c48c][_0xba1b('0x6f')]&&_0x50ea77[_0xba1b('0x6d')][_0x35c48c][_0xba1b('0x70')]&&_0x50ea77[_0xba1b('0x6d')][_0x35c48c]['foreignKey']){_0x413a35[_0x50ea77[_0xba1b('0x6d')][_0x35c48c][_0xba1b('0x2b')]](_0x50ea77[_0xba1b('0x6d')][_0x35c48c][_0xba1b('0x70')],null,util[_0xba1b('0x69')](_0xba1b('0x72'),_0x50ea77['table'],_0x50ea77[_0xba1b('0x6d')][_0x35c48c][_0xba1b('0x6f')],_0x50ea77[_0xba1b('0x6d')][_0x35c48c]['foreignTable'],_0x50ea77[_0xba1b('0x6d')][_0x35c48c][_0xba1b('0x71')]));}}}if(_0x50ea77[_0xba1b('0x73')]){_0x50ea77[_0xba1b('0x73')]=JSON[_0xba1b('0x6e')](_0x50ea77[_0xba1b('0x73')]);_0x413a35[_0xba1b('0x36')](_0x10290d(_0x50ea77['conditions'][_0xba1b('0x5c')]));}_0x59ed64=_0x413a35[_0xba1b('0x74')]();_0x413a35[_0xba1b('0x1a')](_0x112543);_0x413a35[_0xba1b('0x19')](0x0);logger[_0xba1b('0x75')](_0xba1b('0x76'),_0x413a35['toString']());return db[_0xba1b('0x78')][_0xba1b('0x2e')](_0x413a35['toString'](),{'type':db['sequelize'][_0xba1b('0x86')][_0xba1b('0x79')]});}})[_0xba1b('0x21')](function(){return{'sql':_0x59ed64[_0xba1b('0x77')]()};})[_0xba1b('0x21')](respondWithResult(_0x185ff4,null))['catch'](handleError(_0x185ff4,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index f02cd65..35de680 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 _0x1198=['./analyticCustomReport.attributes','exports','analytics_custom_reports','lodash','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x1198,0x193));var _0x8119=function(_0x5806ae,_0x34750e){_0x5806ae=_0x5806ae-0x0;var _0xf4f262=_0x1198[_0x5806ae];return _0xf4f262;};'use strict';var _=require(_0x8119('0x0'));var util=require(_0x8119('0x1'));var logger=require(_0x8119('0x2'))(_0x8119('0x3'));var moment=require(_0x8119('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8119('0x5'));var rimraf=require('rimraf');var config=require(_0x8119('0x6'));var attributes=require(_0x8119('0x7'));module[_0x8119('0x8')]=function(_0x5f43d5,_0x22937e){return _0x5f43d5['define']('AnalyticCustomReport',attributes,{'tableName':_0x8119('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fd8=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x3869fa,_0x16ef3f){var _0x209652=function(_0x527167){while(--_0x527167){_0x3869fa['push'](_0x3869fa['shift']());}};_0x209652(++_0x16ef3f);}(_0x9fd8,0x179));var _0x89fd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9fd8[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x89fd('0x0'))(_0x89fd('0x1'));var moment=require(_0x89fd('0x2'));var BPromise=require(_0x89fd('0x3'));var rp=require(_0x89fd('0x4'));var fs=require('fs');var path=require(_0x89fd('0x5'));var rimraf=require(_0x89fd('0x6'));var config=require(_0x89fd('0x7'));var attributes=require(_0x89fd('0x8'));module[_0x89fd('0x9')]=function(_0x1bb5e7,_0x536b8b){return _0x1bb5e7[_0x89fd('0xa')](_0x89fd('0xb'),attributes,{'tableName':_0x89fd('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 8cc061b..a5668cd 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 _0xde96=['client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x363333,_0x1b1dd6){var _0x522d1a=function(_0xd8a13f){while(--_0xd8a13f){_0x363333['push'](_0x363333['shift']());}};_0x522d1a(++_0x1b1dd6);}(_0xde96,0x19a));var _0x6de9=function(_0x19e3ea,_0x81cb0a){_0x19e3ea=_0x19e3ea-0x0;var _0x44d772=_0xde96[_0x19e3ea];return _0x44d772;};'use strict';var _=require(_0x6de9('0x0'));var util=require(_0x6de9('0x1'));var moment=require(_0x6de9('0x2'));var BPromise=require('bluebird');var rs=require(_0x6de9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6de9('0x4'))['db'];var utils=require(_0x6de9('0x5'));var logger=require(_0x6de9('0x6'))(_0x6de9('0x7'));var config=require(_0x6de9('0x8'));var jayson=require(_0x6de9('0x9'));var client=jayson[_0x6de9('0xa')][_0x6de9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ee113,_0x292945,_0x4012c7){return new BPromise(function(_0x28f6cc,_0x521cd8){return client[_0x6de9('0xc')](_0x5ee113,_0x4012c7)[_0x6de9('0xd')](function(_0x51fed5){logger[_0x6de9('0xe')](_0x6de9('0xf'),_0x292945,_0x6de9('0x10'));logger[_0x6de9('0x11')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x292945,_0x6de9('0x10'),JSON[_0x6de9('0x12')](_0x51fed5));if(_0x51fed5[_0x6de9('0x13')]){if(_0x51fed5[_0x6de9('0x13')]['code']===0x1f4){logger[_0x6de9('0x13')](_0x6de9('0xf'),_0x292945,_0x51fed5['error'][_0x6de9('0x14')]);return _0x521cd8(_0x51fed5['error'][_0x6de9('0x14')]);}logger[_0x6de9('0x13')](_0x6de9('0xf'),_0x292945,_0x51fed5[_0x6de9('0x13')][_0x6de9('0x14')]);return _0x28f6cc(_0x51fed5[_0x6de9('0x13')][_0x6de9('0x14')]);}else{logger['info'](_0x6de9('0xf'),_0x292945,_0x6de9('0x10'));_0x28f6cc(_0x51fed5['result'][_0x6de9('0x14')]);}})['catch'](function(_0x56ebce){logger[_0x6de9('0x13')](_0x6de9('0xf'),_0x292945,_0x56ebce);_0x521cd8(_0x56ebce);});});} \ No newline at end of file +var _0x824d=['error','code','message','AnalyticCustomReport,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x50478e,_0x404854){var _0x190c0e=function(_0x2a767e){while(--_0x2a767e){_0x50478e['push'](_0x50478e['shift']());}};_0x190c0e(++_0x404854);}(_0x824d,0x191));var _0xd824=function(_0x529bf5,_0x4568c0){_0x529bf5=_0x529bf5-0x0;var _0x4b136c=_0x824d[_0x529bf5];return _0x4b136c;};'use strict';var _=require(_0xd824('0x0'));var util=require('util');var moment=require(_0xd824('0x1'));var BPromise=require(_0xd824('0x2'));var rs=require(_0xd824('0x3'));var fs=require('fs');var Redis=require(_0xd824('0x4'));var db=require(_0xd824('0x5'))['db'];var utils=require(_0xd824('0x6'));var logger=require(_0xd824('0x7'))('rpc');var config=require(_0xd824('0x8'));var jayson=require(_0xd824('0x9'));var client=jayson['client'][_0xd824('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35e59a,_0x44c322,_0x1739c6){return new BPromise(function(_0x5c8e19,_0x18ce91){return client[_0xd824('0xb')](_0x35e59a,_0x1739c6)[_0xd824('0xc')](function(_0x5f147f){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x44c322,'request\x20sent');logger[_0xd824('0xd')](_0xd824('0xe'),_0x44c322,_0xd824('0xf'),JSON[_0xd824('0x10')](_0x5f147f));if(_0x5f147f[_0xd824('0x11')]){if(_0x5f147f[_0xd824('0x11')][_0xd824('0x12')]===0x1f4){logger[_0xd824('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x44c322,_0x5f147f[_0xd824('0x11')][_0xd824('0x13')]);return _0x18ce91(_0x5f147f['error']['message']);}logger[_0xd824('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x44c322,_0x5f147f[_0xd824('0x11')][_0xd824('0x13')]);return _0x5c8e19(_0x5f147f['error'][_0xd824('0x13')]);}else{logger['info'](_0xd824('0x14'),_0x44c322,'request\x20sent');_0x5c8e19(_0x5f147f['result']['message']);}})[_0xd824('0x15')](function(_0x5cf031){logger[_0xd824('0x11')](_0xd824('0x14'),_0x44c322,_0x5cf031);_0x18ce91(_0x5cf031);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 3f1165a..d2bd96e 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 _0x7d48=['exports','util','path','connect-timeout','Router','../../components/interaction/service','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','show','/:id/run','/:id/query','create','put','destroy'];(function(_0x3cf85e,_0x4b9ba1){var _0x58d667=function(_0x40850c){while(--_0x40850c){_0x3cf85e['push'](_0x3cf85e['shift']());}};_0x58d667(++_0x4b9ba1);}(_0x7d48,0x188));var _0x87d4=function(_0x1299d3,_0x3f159b){_0x1299d3=_0x1299d3-0x0;var _0x3658fe=_0x7d48[_0x1299d3];return _0x3658fe;};'use strict';var multer=require('multer');var util=require(_0x87d4('0x0'));var path=require(_0x87d4('0x1'));var timeout=require(_0x87d4('0x2'));var express=require('express');var router=express[_0x87d4('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x87d4('0x4'));var config=require('../../config/environment');var controller=require(_0x87d4('0x5'));router[_0x87d4('0x6')]('/',auth['isAuthenticated'](),controller[_0x87d4('0x7')]);router[_0x87d4('0x6')](_0x87d4('0x8'),auth[_0x87d4('0x9')](),controller[_0x87d4('0xa')]);router[_0x87d4('0x6')]('/:id/preview',auth['isAuthenticated'](),controller['preview']);router[_0x87d4('0x6')](_0x87d4('0xb'),auth['isAuthenticated'](),controller['run']);router[_0x87d4('0x6')](_0x87d4('0xc'),auth['isAuthenticated'](),controller['query']);router['post']('/',auth['isAuthenticated'](),controller[_0x87d4('0xd')]);router[_0x87d4('0xe')](_0x87d4('0x8'),auth[_0x87d4('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x87d4('0xf')]);module[_0x87d4('0x10')]=router; \ No newline at end of file +var _0x4a6b=['express','Router','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','/:id','get','/:id/preview','preview','run','/:id/query','post','create','put','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x44606e,_0x2bf244){var _0xe68388=function(_0x488a30){while(--_0x488a30){_0x44606e['push'](_0x44606e['shift']());}};_0xe68388(++_0x2bf244);}(_0x4a6b,0x6c));var _0xb4a6=function(_0x249517,_0x2e28c3){_0x249517=_0x249517-0x0;var _0x5a8498=_0x4a6b[_0x249517];return _0x5a8498;};'use strict';var multer=require(_0xb4a6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb4a6('0x1'));var express=require(_0xb4a6('0x2'));var router=express[_0xb4a6('0x3')]();var auth=require(_0xb4a6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb4a6('0x5'));var controller=require(_0xb4a6('0x6'));router['get']('/',auth[_0xb4a6('0x7')](),controller[_0xb4a6('0x8')]);router['get'](_0xb4a6('0x9'),auth[_0xb4a6('0x7')](),controller['show']);router[_0xb4a6('0xa')](_0xb4a6('0xb'),auth['isAuthenticated'](),controller[_0xb4a6('0xc')]);router[_0xb4a6('0xa')]('/:id/run',auth[_0xb4a6('0x7')](),controller[_0xb4a6('0xd')]);router[_0xb4a6('0xa')](_0xb4a6('0xe'),auth[_0xb4a6('0x7')](),controller['query']);router[_0xb4a6('0xf')]('/',auth[_0xb4a6('0x7')](),controller[_0xb4a6('0x10')]);router[_0xb4a6('0x11')](_0xb4a6('0x9'),auth[_0xb4a6('0x7')](),controller[_0xb4a6('0x12')]);router[_0xb4a6('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb4a6('0x14')]);module[_0xb4a6('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 4f78064..068afa1 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 _0x8a50=['exports','STRING','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a50,0x1c3));var _0x08a5=function(_0x2b0e12,_0x1e3500){_0x2b0e12=_0x2b0e12-0x0;var _0x4dc8c5=_0x8a50[_0x2b0e12];return _0x4dc8c5;};'use strict';var Sequelize=require(_0x08a5('0x0'));module[_0x08a5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x08a5('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x08a5('0x3')]},'joins':{'type':Sequelize[_0x08a5('0x3')]}}; \ No newline at end of file +var _0x25d3=['STRING','TEXT'];(function(_0x190349,_0x5b508e){var _0x1a236c=function(_0x4b1e56){while(--_0x4b1e56){_0x190349['push'](_0x190349['shift']());}};_0x1a236c(++_0x5b508e);}(_0x25d3,0x134));var _0x325d=function(_0x3fa097,_0x5074c4){_0x3fa097=_0x3fa097-0x0;var _0x1c6261=_0x25d3[_0x3fa097];return _0x1c6261;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x325d('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x325d('0x0')]},'table':{'type':Sequelize[_0x325d('0x0')]},'conditions':{'type':Sequelize[_0x325d('0x1')]},'joins':{'type':Sequelize[_0x325d('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index e19820e..293d1c1 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 _0x096f=['format','groupBy','orderBy','DESC','joins','parse','includes','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','join','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20NULL','Sequelize','findAll','metric','function','Limited\x20Query:','QueryTypes','SELECT','No\x20available\x20data','output','web','fullPath','randomstring','generate','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','HOUR(%s)','html-pdf','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','DefaultReports','UserProfileResource','then','end','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','rows','show','params','length','includeAll','include','find','catch','body','user','Reports','UserProfileSection','create','error','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','replace'];(function(_0x470d45,_0x55ac92){var _0x5b32aa=function(_0x45778e){while(--_0x45778e){_0x470d45['push'](_0x470d45['shift']());}};_0x5b32aa(++_0x55ac92);}(_0x096f,0x17a));var _0xf096=function(_0x168b72,_0x500dd9){_0x168b72=_0x168b72-0x0;var _0x1adfba=_0x096f[_0x168b72];return _0x1adfba;};'use strict';var pdf=require(_0xf096('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf096('0x1'));var zipdir=require(_0xf096('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf096('0x3'));var Mustache=require(_0xf096('0x4'));var util=require(_0xf096('0x5'));var path=require(_0xf096('0x6'));var sox=require(_0xf096('0x7'));var csv=require(_0xf096('0x8'));var ejs=require(_0xf096('0x9'));var fs=require('fs');var _=require(_0xf096('0xa'));var squel=require(_0xf096('0xb'));var crypto=require(_0xf096('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf096('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf096('0xe'));var Papa=require(_0xf096('0xf'));var Redis=require(_0xf096('0x10'));var authService=require(_0xf096('0x11'));var qs=require(_0xf096('0x12'));var as=require(_0xf096('0x13'));var hardwareService=require(_0xf096('0x14'));var logger=require(_0xf096('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf096('0x16'));var db=require(_0xf096('0x17'))['db'];function respondWithStatusCode(_0x260aab,_0x2c3bf5){_0x2c3bf5=_0x2c3bf5||0xcc;return function(_0x3bf341){if(_0x3bf341){return _0x260aab[_0xf096('0x18')](_0x2c3bf5);}return _0x260aab[_0xf096('0x19')](_0x2c3bf5)['end']();};}function respondWithResult(_0x2aa560,_0x21bf93){_0x21bf93=_0x21bf93||0xc8;return function(_0x305c58){if(_0x305c58){return _0x2aa560[_0xf096('0x19')](_0x21bf93)[_0xf096('0x1a')](_0x305c58);}};}function respondWithFilteredResult(_0x203448,_0xd3ab66){return function(_0x2f00d1){if(_0x2f00d1){var _0x17a945=_0x2f00d1[_0xf096('0x1b')],_0x43b948=_0xd3ab66[_0xf096('0x1c')],_0x4082f1=_0xd3ab66['offset']+_0xd3ab66[_0xf096('0x1d')],_0x7ad618;if(_0x4082f1>=_0x17a945){_0x4082f1=_0x17a945;_0x7ad618=0xc8;}else{_0x7ad618=0xce;}_0x203448[_0xf096('0x19')](_0x7ad618);return _0x203448[_0xf096('0x1e')](_0xf096('0x1f'),_0x43b948+'-'+_0x4082f1+'/'+_0x17a945)['json'](_0x2f00d1);}return null;};}function patchUpdates(_0xffa4d6){return function(_0x5c98b4){try{jsonpatch[_0xf096('0x20')](_0x5c98b4,_0xffa4d6,!![]);}catch(_0x2ee58a){return BPromise[_0xf096('0x21')](_0x2ee58a);}return _0x5c98b4[_0xf096('0x22')]();};}function saveUpdates(_0x17b521,_0xa9409a){return function(_0x107a9b){if(_0x107a9b){return _0x107a9b[_0xf096('0x23')](_0x17b521)['then'](function(_0x5c9950){return _0x5c9950;});}return null;};}function removeEntity(_0x5e598c,_0x47e1c6){return function(_0xf577df){if(_0xf577df){return _0xf577df[_0xf096('0x24')]()['then'](function(){var _0x1599a2=_0xf577df[_0xf096('0x25')]({'plain':!![]});var _0x281386=_0xf096('0x26');return db[_0xf096('0x27')][_0xf096('0x24')]({'where':{'type':_0x281386,'resourceId':_0x1599a2['id']}})[_0xf096('0x28')](function(){return _0xf577df;});})[_0xf096('0x28')](function(){_0x5e598c[_0xf096('0x19')](0xcc)[_0xf096('0x29')]();});}};}function handleEntityNotFound(_0x4920c6,_0x232e76){return function(_0x457fb7){if(!_0x457fb7){_0x4920c6[_0xf096('0x18')](0x194);}return _0x457fb7;};}function handleError(_0x3f06aa,_0x1d3f85){_0x1d3f85=_0x1d3f85||0x1f4;return function(_0x2c3dcc){logger['error'](_0x2c3dcc['stack']);if(_0x2c3dcc[_0xf096('0x2a')]){delete _0x2c3dcc[_0xf096('0x2a')];}_0x3f06aa[_0xf096('0x19')](_0x1d3f85)[_0xf096('0x2b')](_0x2c3dcc);};}exports[_0xf096('0x2c')]=function(_0x5eef50,_0x168dd0){var _0x57cd46={},_0x420292={},_0x1f82a9={'count':0x0,'rows':[]};var _0x299bb4=_[_0xf096('0x2d')](db[_0xf096('0x2e')][_0xf096('0x2f')],function(_0x164dbc){return{'name':_0x164dbc['fieldName'],'type':_0x164dbc[_0xf096('0x30')][_0xf096('0x31')]};});_0x420292['model']=_['map'](_0x299bb4,_0xf096('0x2a'));_0x420292[_0xf096('0x32')]=_[_0xf096('0x33')](_0x5eef50[_0xf096('0x32')]);_0x420292[_0xf096('0x34')]=_[_0xf096('0x35')](_0x420292[_0xf096('0x36')],_0x420292[_0xf096('0x32')]);_0x57cd46[_0xf096('0x37')]=_[_0xf096('0x35')](_0x420292[_0xf096('0x36')],qs[_0xf096('0x38')](_0x5eef50[_0xf096('0x32')][_0xf096('0x38')]));_0x57cd46['attributes']=_0x57cd46[_0xf096('0x37')]['length']?_0x57cd46[_0xf096('0x37')]:_0x420292[_0xf096('0x36')];if(!_0x5eef50[_0xf096('0x32')][_0xf096('0x39')](_0xf096('0x3a'))){_0x57cd46[_0xf096('0x1d')]=qs[_0xf096('0x1d')](_0x5eef50[_0xf096('0x32')][_0xf096('0x1d')]);_0x57cd46['offset']=qs[_0xf096('0x1c')](_0x5eef50['query'][_0xf096('0x1c')]);}_0x57cd46[_0xf096('0x3b')]=qs[_0xf096('0x3c')](_0x5eef50[_0xf096('0x32')]['sort']);_0x57cd46[_0xf096('0x3d')]=qs[_0xf096('0x34')](_['pick'](_0x5eef50[_0xf096('0x32')],_0x420292['filters']));if(_0x5eef50[_0xf096('0x32')][_0xf096('0x3e')]){_0x57cd46[_0xf096('0x3d')]=_['merge'](_0x57cd46[_0xf096('0x3d')],{'$or':_[_0xf096('0x2d')](_0x299bb4,function(_0x47b9b6){if(_0x47b9b6[_0xf096('0x30')]!==_0xf096('0x3f')){var _0x40c9e2={};_0x40c9e2[_0x47b9b6['name']]={'$like':'%'+_0x5eef50[_0xf096('0x32')][_0xf096('0x3e')]+'%'};return _0x40c9e2;}})});}_0x57cd46=_[_0xf096('0x40')]({},_0x57cd46,_0x5eef50[_0xf096('0x41')]);var _0x3d6755={'where':_0x57cd46[_0xf096('0x3d')]};return db[_0xf096('0x2e')]['count'](_0x3d6755)[_0xf096('0x28')](function(_0x133072){_0x1f82a9[_0xf096('0x1b')]=_0x133072;if(_0x5eef50[_0xf096('0x32')]['includeAll']){_0x57cd46['include']=[{'all':!![]}];}return db[_0xf096('0x2e')]['findAll'](_0x57cd46);})[_0xf096('0x28')](function(_0x16cb0a){_0x1f82a9[_0xf096('0x42')]=_0x16cb0a;return _0x1f82a9;})[_0xf096('0x28')](respondWithFilteredResult(_0x168dd0,_0x57cd46))['catch'](handleError(_0x168dd0,null));};exports[_0xf096('0x43')]=function(_0x49c69e,_0x2bc432){var _0x942113={'raw':!![],'where':{'id':_0x49c69e[_0xf096('0x44')]['id']}},_0x420a13={};_0x420a13[_0xf096('0x36')]=_[_0xf096('0x33')](db['AnalyticDefaultReport'][_0xf096('0x2f')]);_0x420a13[_0xf096('0x32')]=_['keys'](_0x49c69e[_0xf096('0x32')]);_0x420a13[_0xf096('0x34')]=_[_0xf096('0x35')](_0x420a13['model'],_0x420a13[_0xf096('0x32')]);_0x942113[_0xf096('0x37')]=_['intersection'](_0x420a13[_0xf096('0x36')],qs[_0xf096('0x38')](_0x49c69e[_0xf096('0x32')][_0xf096('0x38')]));_0x942113[_0xf096('0x37')]=_0x942113[_0xf096('0x37')][_0xf096('0x45')]?_0x942113[_0xf096('0x37')]:_0x420a13['model'];if(_0x49c69e['query'][_0xf096('0x46')]){_0x942113[_0xf096('0x47')]=[{'all':!![]}];}_0x942113=_['merge']({},_0x942113,_0x49c69e[_0xf096('0x41')]);return db[_0xf096('0x2e')][_0xf096('0x48')](_0x942113)[_0xf096('0x28')](handleEntityNotFound(_0x2bc432,null))[_0xf096('0x28')](respondWithResult(_0x2bc432,null))[_0xf096('0x49')](handleError(_0x2bc432,null));};exports['create']=function(_0x4a716d,_0x5899ff){return db['AnalyticDefaultReport']['create'](_0x4a716d[_0xf096('0x4a')],{})['then'](function(_0x4d5c2c){var _0x42da14=_0x4a716d[_0xf096('0x4b')][_0xf096('0x25')]({'plain':!![]});if(!_0x42da14)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42da14['role']==='user'){var _0x37231e=_0x4d5c2c['get']({'plain':!![]});var _0x3e038e=_0xf096('0x4c');return db[_0xf096('0x4d')]['find']({'where':{'name':_0x3e038e,'userProfileId':_0x42da14['userProfileId']},'raw':!![]})['then'](function(_0x37e5d4){if(_0x37e5d4&&_0x37e5d4['autoAssociation']===0x0){return db[_0xf096('0x27')][_0xf096('0x4e')]({'name':_0x37231e['name'],'resourceId':_0x37231e['id'],'type':_0xf096('0x26'),'sectionId':_0x37e5d4['id']},{})[_0xf096('0x28')](function(){return _0x4d5c2c;});}else{return _0x4d5c2c;}})[_0xf096('0x49')](function(_0x2d0d5d){logger[_0xf096('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d0d5d);throw _0x2d0d5d;});}return _0x4d5c2c;})[_0xf096('0x28')](respondWithResult(_0x5899ff,0xc9))[_0xf096('0x49')](handleError(_0x5899ff,null));};exports['update']=function(_0x47535c,_0x4c28a6){if(_0x47535c['body']['id']){delete _0x47535c[_0xf096('0x4a')]['id'];}return db[_0xf096('0x2e')]['find']({'where':{'id':_0x47535c['params']['id']}})[_0xf096('0x28')](handleEntityNotFound(_0x4c28a6,null))['then'](saveUpdates(_0x47535c[_0xf096('0x4a')],null))[_0xf096('0x28')](respondWithResult(_0x4c28a6,null))['catch'](handleError(_0x4c28a6,null));};exports[_0xf096('0x24')]=function(_0x2253ce,_0x43a8cf){return db['AnalyticDefaultReport'][_0xf096('0x48')]({'where':{'id':_0x2253ce[_0xf096('0x44')]['id']}})['then'](handleEntityNotFound(_0x43a8cf,null))[_0xf096('0x28')](removeEntity(_0x43a8cf,null))[_0xf096('0x49')](handleError(_0x43a8cf,null));};exports[_0xf096('0x50')]=function(_0x2a5887,_0x2c2430){var _0x5359b7=0xa;var _0x3dc849=['join',_0xf096('0x51'),_0xf096('0x52'),_0xf096('0x53')];var _0x1dfb76={'SUM':_0xf096('0x54'),'COUNT':_0xf096('0x55'),'COUNT DISTINCT':_0xf096('0x56'),'MAX':_0xf096('0x57'),'MIN':_0xf096('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf096('0x59')};var _0x242d43={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xf096('0x5a'),'UNIX_TIMESTAMP':_0xf096('0x5b')};var _0x413a14=function(_0x3e67ad){return!_['includes']([_0xf096('0x5c'),'IS\x20NOT\x20NULL',_0xf096('0x5d'),_0xf096('0x5e')],_0x3e67ad);};var _0x274861=function(_0x2e851e){if(!_0x2e851e||!_0x2e851e[_0xf096('0x5f')][_0xf096('0x45')]){return'';}for(var _0x5b76a9='(',_0x9beb3b=0x0;_0x9beb3b<_0x2e851e[_0xf096('0x5f')][_0xf096('0x45')];_0x9beb3b+=0x1){_0x9beb3b>0x0&&(_0x5b76a9+='\x20'+_0x2e851e[_0xf096('0x60')]+'\x20');_0x5b76a9+=_0x2e851e[_0xf096('0x5f')][_0x9beb3b][_0xf096('0x61')]?_0x274861(_0x2e851e['rules'][_0x9beb3b][_0xf096('0x61')]):_0x2e851e['rules'][_0x9beb3b][_0xf096('0x62')]+'\x20'+_0x2e851e[_0xf096('0x5f')][_0x9beb3b][_0xf096('0x63')]+(_0x413a14(_0x2e851e['rules'][_0x9beb3b][_0xf096('0x63')])?'\x20'+_0x2e851e['rules'][_0x9beb3b][_0xf096('0x64')]:'');}return _0x5b76a9+')';};var _0x4c265e={'where':{'id':_0x2a5887['params']['id']}},_0x1463af,_0x29dab4,_0x11c8b5,_0x5a432b,_0x21a727;_0x4c265e=_[_0xf096('0x40')]({},_0x4c265e,_0x2a5887[_0xf096('0x41')]);return db['AnalyticDefaultReport'][_0xf096('0x48')](_0x4c265e)[_0xf096('0x28')](function(_0x2d22f0){if(_0x2d22f0){_0x1463af=_0x2d22f0;return _0x2d22f0[_0xf096('0x65')]();}return null;})[_0xf096('0x28')](function(_0x4dfa46){if(_0x4dfa46){if(!_0x4dfa46['length']){throw new db['Sequelize'][(_0xf096('0x66'))](_0xf096('0x67'),0x193);}_0x29dab4=_0x4dfa46;return db[_0xf096('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1a17b0){if(_0x1a17b0){_0x11c8b5=_[_0xf096('0x69')](_0x1a17b0,'id');var _0x51e100;var _0x326eb0=squel[_0xf096('0x6a')]();_0x326eb0[_0xf096('0x6b')](_0x1463af[_0xf096('0x6c')]);for(var _0x2fa0a9=0x0;_0x2fa0a9<_0x29dab4[_0xf096('0x45')];_0x2fa0a9+=0x1){_0x51e100=_0x29dab4[_0x2fa0a9][_0xf096('0x6d')]?_0x11c8b5[_0x29dab4[_0x2fa0a9][_0xf096('0x6d')]]['metric']:_0x29dab4[_0x2fa0a9][_0xf096('0x62')];_0x51e100=_0x29dab4[_0x2fa0a9]['function']?_[_0xf096('0x6e')](_0x1dfb76[_0x29dab4[_0x2fa0a9]['function']],'%s',_0x51e100):_0x51e100;_0x51e100=_0x29dab4[_0x2fa0a9][_0xf096('0x6f')]?_[_0xf096('0x6e')](_0x242d43[_0x29dab4[_0x2fa0a9]['format']],'%s',_0x51e100):_0x51e100;if(_0x29dab4[_0x2fa0a9][_0xf096('0x70')]){_0x326eb0[_0xf096('0x61')](_0x51e100);}_0x29dab4[_0x2fa0a9][_0xf096('0x71')]&&_0x326eb0['order'](_0x51e100,_0x29dab4[_0x2fa0a9][_0xf096('0x71')]===_0xf096('0x72')?![]:!![]);_0x326eb0[_0xf096('0x62')](_0x51e100,_0x29dab4[_0x2fa0a9]['alias']||_0x51e100);}if(_0x1463af[_0xf096('0x73')]){_0x1463af[_0xf096('0x73')]=JSON[_0xf096('0x74')](_0x1463af[_0xf096('0x73')]);for(var _0x439ee1=0x0;_0x439ee1<_0x1463af[_0xf096('0x73')][_0xf096('0x45')];_0x439ee1+=0x1){if(_0x1463af['joins'][_0x439ee1][_0xf096('0x30')]&&_[_0xf096('0x75')](_0x3dc849,_0x1463af[_0xf096('0x73')][_0x439ee1][_0xf096('0x30')])&&_0x1463af[_0xf096('0x73')][_0x439ee1][_0xf096('0x76')]&&_0x1463af[_0xf096('0x73')][_0x439ee1]['foreignTable']&&_0x1463af[_0xf096('0x73')][_0x439ee1][_0xf096('0x77')]){_0x326eb0[_0x1463af['joins'][_0x439ee1]['type']](_0x1463af[_0xf096('0x73')][_0x439ee1][_0xf096('0x78')],null,util[_0xf096('0x6f')](_0xf096('0x79'),_0x1463af[_0xf096('0x6c')],_0x1463af[_0xf096('0x73')][_0x439ee1]['parentKey'],_0x1463af['joins'][_0x439ee1]['foreignTable'],_0x1463af[_0xf096('0x73')][_0x439ee1][_0xf096('0x77')]));}}}if(_0x1463af[_0xf096('0x7a')]){_0x1463af[_0xf096('0x7a')]=JSON[_0xf096('0x74')](_0x1463af[_0xf096('0x7a')]);_0x326eb0[_0xf096('0x3d')](_0x274861(_0x1463af[_0xf096('0x7a')][_0xf096('0x61')]));}_0x21a727=_0x326eb0[_0xf096('0x7b')]();_0x326eb0[_0xf096('0x1d')](_0x5359b7);_0x326eb0[_0xf096('0x1c')](0x0);logger[_0xf096('0x7c')]('Limited\x20Query:',_0x326eb0[_0xf096('0x7d')]());return db[_0xf096('0x7e')][_0xf096('0x32')](_0x326eb0[_0xf096('0x7d')](),{'type':db[_0xf096('0x7e')]['QueryTypes']['SELECT']});}})[_0xf096('0x28')](respondWithResult(_0x2c2430,null))[_0xf096('0x49')](handleError(_0x2c2430,null));};function runReport(_0x45a8a9,_0x40a469,_0x3ca306){var _0x53f1c9=_0x40a469[_0xf096('0x2a')];var _0x156101=0xa;var _0x1c0522=[_0xf096('0x7f'),_0xf096('0x51'),'right_join','cross_join'];var _0x4a8588={'SUM':_0xf096('0x54'),'COUNT':_0xf096('0x55'),'COUNT DISTINCT':_0xf096('0x56'),'MAX':'MAX(%s)','MIN':_0xf096('0x58'),'AVG':_0xf096('0x80'),'GROUP_CONCAT':_0xf096('0x81'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf096('0x59')};var _0x230a75={'SEC_TO_TIME':_0xf096('0x82'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xf096('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x42dd4c=function(_0x493847){return!_['includes']([_0xf096('0x5c'),_0xf096('0x83'),_0xf096('0x5d'),_0xf096('0x5e')],_0x493847);};var _0x260849=function(_0x2d30d1){if(!_0x2d30d1||!_0x2d30d1['rules']['length']){return'';}for(var _0x50f157='(',_0x1bc1b1=0x0;_0x1bc1b1<_0x2d30d1['rules'][_0xf096('0x45')];_0x1bc1b1+=0x1){_0x1bc1b1>0x0&&(_0x50f157+='\x20'+_0x2d30d1[_0xf096('0x60')]+'\x20');_0x50f157+=_0x2d30d1['rules'][_0x1bc1b1][_0xf096('0x61')]?_0x260849(_0x2d30d1[_0xf096('0x5f')][_0x1bc1b1][_0xf096('0x61')]):_0x2d30d1[_0xf096('0x5f')][_0x1bc1b1][_0xf096('0x62')]+'\x20'+_0x2d30d1[_0xf096('0x5f')][_0x1bc1b1][_0xf096('0x63')]+(_0x42dd4c(_0x2d30d1[_0xf096('0x5f')][_0x1bc1b1][_0xf096('0x63')])?'\x20'+_0x2d30d1[_0xf096('0x5f')][_0x1bc1b1][_0xf096('0x64')]:'');}return _0x50f157+')';};var _0x209364={'where':{'id':_0x45a8a9['id']}},_0x5ef46e,_0x21aea7,_0xae8e93,_0x3dc7be,_0x503306;_0x209364=_[_0xf096('0x40')]({},_0x209364,_0x3ca306);return db[_0xf096('0x2e')][_0xf096('0x48')](_0x209364)[_0xf096('0x28')](function(_0x229854){if(_0x229854){_0x5ef46e=_0x229854;return _0x229854[_0xf096('0x65')]();}return null;})[_0xf096('0x28')](function(_0x5b7eda){if(_0x5b7eda){if(!_0x5b7eda[_0xf096('0x45')]){throw new db[(_0xf096('0x84'))][(_0xf096('0x66'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x21aea7=_0x5b7eda;return db[_0xf096('0x68')][_0xf096('0x85')]({'raw':!![]});}return null;})[_0xf096('0x28')](function(_0xab286c){if(_0xab286c){_0xae8e93=_[_0xf096('0x69')](_0xab286c,'id');var _0x1359f5;var _0x3e864f=squel[_0xf096('0x6a')]();_0x3e864f[_0xf096('0x6b')](_0x5ef46e[_0xf096('0x6c')]);for(var _0x1f6f3d=0x0;_0x1f6f3d<_0x21aea7[_0xf096('0x45')];_0x1f6f3d+=0x1){_0x1359f5=_0x21aea7[_0x1f6f3d][_0xf096('0x6d')]?_0xae8e93[_0x21aea7[_0x1f6f3d][_0xf096('0x6d')]][_0xf096('0x86')]:_0x21aea7[_0x1f6f3d][_0xf096('0x62')];_0x1359f5=_0x21aea7[_0x1f6f3d]['function']?_['replace'](_0x4a8588[_0x21aea7[_0x1f6f3d][_0xf096('0x87')]],'%s',_0x1359f5):_0x1359f5;_0x1359f5=_0x21aea7[_0x1f6f3d][_0xf096('0x6f')]?_[_0xf096('0x6e')](_0x230a75[_0x21aea7[_0x1f6f3d]['format']],'%s',_0x1359f5):_0x1359f5;if(_0x21aea7[_0x1f6f3d][_0xf096('0x70')]){_0x3e864f[_0xf096('0x61')](_0x1359f5);}_0x21aea7[_0x1f6f3d][_0xf096('0x71')]&&_0x3e864f['order'](_0x1359f5,_0x21aea7[_0x1f6f3d][_0xf096('0x71')]===_0xf096('0x72')?![]:!![]);_0x3e864f[_0xf096('0x62')](_0x1359f5,_0x21aea7[_0x1f6f3d]['alias']||_0x1359f5);}if(_0x5ef46e[_0xf096('0x73')]){_0x5ef46e[_0xf096('0x73')]=JSON['parse'](_0x5ef46e[_0xf096('0x73')]);for(var _0x481b9b=0x0;_0x481b9b<_0x5ef46e['joins'][_0xf096('0x45')];_0x481b9b+=0x1){if(_0x5ef46e[_0xf096('0x73')][_0x481b9b][_0xf096('0x30')]&&_[_0xf096('0x75')](_0x1c0522,_0x5ef46e[_0xf096('0x73')][_0x481b9b]['type'])&&_0x5ef46e[_0xf096('0x73')][_0x481b9b][_0xf096('0x76')]&&_0x5ef46e[_0xf096('0x73')][_0x481b9b]['foreignTable']&&_0x5ef46e[_0xf096('0x73')][_0x481b9b][_0xf096('0x77')]){_0x3e864f[_0x5ef46e[_0xf096('0x73')][_0x481b9b][_0xf096('0x30')]](_0x5ef46e[_0xf096('0x73')][_0x481b9b][_0xf096('0x78')],null,util[_0xf096('0x6f')]('%s.%s\x20=\x20%s.%s',_0x5ef46e[_0xf096('0x6c')],_0x5ef46e[_0xf096('0x73')][_0x481b9b]['parentKey'],_0x5ef46e[_0xf096('0x73')][_0x481b9b]['foreignTable'],_0x5ef46e[_0xf096('0x73')][_0x481b9b][_0xf096('0x77')]));}}}if(_0x5ef46e[_0xf096('0x7a')]){_0x5ef46e[_0xf096('0x7a')]=JSON[_0xf096('0x74')](_0x5ef46e[_0xf096('0x7a')]);_0x3e864f[_0xf096('0x3d')](_0x260849(_0x5ef46e[_0xf096('0x7a')][_0xf096('0x61')]));}_0x503306=_0x3e864f['clone']();_0x3e864f['limit'](_0x156101);_0x3e864f[_0xf096('0x1c')](0x0);logger['debug'](_0xf096('0x88'),_0x3e864f[_0xf096('0x7d')]());return db[_0xf096('0x7e')][_0xf096('0x32')](_0x3e864f[_0xf096('0x7d')](),{'type':db[_0xf096('0x7e')][_0xf096('0x89')][_0xf096('0x8a')]});}})[_0xf096('0x28')](function(_0x266ad6){if(!_0x266ad6['length']){throw new db[(_0xf096('0x84'))][(_0xf096('0x66'))](_0xf096('0x8b'),0xcc);}if(_0x40a469[_0xf096('0x8c')]===_0xf096('0x8d')){return null;}var _0x1de5b9=_[_0xf096('0x40')](_0x40a469,{'name':_0x40a469[_0xf096('0x8e')]||_0x40a469[_0xf096('0x2a')]||_0x5ef46e[_0xf096('0x2a')],'basename':_0x53f1c9,'savename':util['format']('%s-%s.%s',_0x40a469['name']||_0x5ef46e[_0xf096('0x2a')],require(_0xf096('0x8f'))[_0xf096('0x90')](0x4),_0x40a469[_0xf096('0x8c')]||'csv'),'reportId':_0x5ef46e['id'],'reportType':'default'});return db[_0xf096('0x91')][_0xf096('0x4e')](_0x1de5b9,{'raw':!![]});})[_0xf096('0x28')](function(_0x317f95){if(_0x5ef46e[_0xf096('0x6c')]===_0xf096('0x92')){_0x503306[_0xf096('0x3d')](_0x5ef46e[_0xf096('0x6c')]+_0xf096('0x93'),_0x40a469[_0xf096('0x94')],_0x40a469[_0xf096('0x95')]);}else{_0x503306['where'](_0x5ef46e[_0xf096('0x6c')]+_0xf096('0x96'),_0x40a469[_0xf096('0x94')],_0x40a469[_0xf096('0x95')]);}if(_0x317f95){logger[_0xf096('0x97')](_0xf096('0x98'),_0x503306[_0xf096('0x7d')]());require(_0xf096('0x99'))['fork'](path['join'](__dirname,_0xf096('0x9a'),_0x317f95['output']),[_0x317f95['id'],_0x503306[_0xf096('0x7d')](),path[_0xf096('0x7f')](__dirname,_0xf096('0x9b'),_0x317f95[_0xf096('0x9c')]),_0x53f1c9]);return _0x317f95;}else{var _0x1ee0cd=squel[_0xf096('0x6a')]();_0x1ee0cd['from']('('+_0x503306[_0xf096('0x7d')]()+')',_0xf096('0x9d'));_0x1ee0cd[_0xf096('0x62')](_0xf096('0x9e'),_0xf096('0x1b'));_0x503306[_0xf096('0x1d')](_0x40a469['limit']||_0x156101);_0x503306[_0xf096('0x1c')](_0x40a469[_0xf096('0x1c')]||0x0);return db[_0xf096('0x7e')][_0xf096('0x32')](_0x1ee0cd['toString'](),{'type':db[_0xf096('0x7e')][_0xf096('0x89')][_0xf096('0x8a')]})[_0xf096('0x28')](function(_0x331741){if(!_0x331741['length']){_0x3dc7be=0x0;}else{_0x3dc7be=_0x331741[0x0][_0xf096('0x1b')]||0x0;}return db[_0xf096('0x7e')][_0xf096('0x32')](_0x503306[_0xf096('0x7d')](),{'type':db[_0xf096('0x7e')][_0xf096('0x89')][_0xf096('0x8a')]});})['then'](function(_0x449df1){return{'rows':_0x449df1||[],'count':_0x3dc7be};});}});}exports[_0xf096('0x9f')]=function(_0x2d2635,_0x587ac0){return runReport(_0x2d2635['params'],_0x2d2635[_0xf096('0x32')],_0x2d2635[_0xf096('0x41')])[_0xf096('0x28')](respondWithResult(_0x587ac0,null))[_0xf096('0x49')](handleError(_0x587ac0,null));};exports[_0xf096('0xa0')]=runReport;exports[_0xf096('0x32')]=function(_0x260ab4,_0x22b22e){var _0x42354d=0xa;var _0x3d90b0=['join',_0xf096('0x51'),_0xf096('0x52'),_0xf096('0x53')];var _0x2dc321={'SUM':_0xf096('0x54'),'COUNT':_0xf096('0x55'),'COUNT DISTINCT':_0xf096('0x56'),'MAX':_0xf096('0x57'),'MIN':_0xf096('0x58'),'AVG':_0xf096('0x80'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf096('0xa1'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x11d1f2={'SEC_TO_TIME':_0xf096('0x82'),'DATE':'DATE(%s)','HOUR':_0xf096('0xa2'),'ROUND':_0xf096('0x5a'),'UNIX_TIMESTAMP':_0xf096('0x5b')};var _0x56b6c9=function(_0x10176f){return!_[_0xf096('0x75')]([_0xf096('0x5c'),_0xf096('0x83'),_0xf096('0x5d'),'IS\x20NOT\x20EMPTY'],_0x10176f);};var _0x473ed5=function(_0x3f7db0){if(!_0x3f7db0||!_0x3f7db0['rules'][_0xf096('0x45')]){return'';}for(var _0xfe5026='(',_0x2da6ab=0x0;_0x2da6ab<_0x3f7db0[_0xf096('0x5f')][_0xf096('0x45')];_0x2da6ab+=0x1){_0x2da6ab>0x0&&(_0xfe5026+='\x20'+_0x3f7db0['operator']+'\x20');_0xfe5026+=_0x3f7db0['rules'][_0x2da6ab][_0xf096('0x61')]?_0x473ed5(_0x3f7db0['rules'][_0x2da6ab][_0xf096('0x61')]):_0x3f7db0[_0xf096('0x5f')][_0x2da6ab][_0xf096('0x62')]+'\x20'+_0x3f7db0['rules'][_0x2da6ab]['condition']+(_0x56b6c9(_0x3f7db0['rules'][_0x2da6ab][_0xf096('0x63')])?'\x20'+_0x3f7db0[_0xf096('0x5f')][_0x2da6ab][_0xf096('0x64')]:'');}return _0xfe5026+')';};var _0x487e54={'where':{'id':_0x260ab4['params']['id']}},_0x5ab407,_0x189574,_0x464195,_0x26008f,_0x1662c1;_0x487e54=_[_0xf096('0x40')]({},_0x487e54,_0x260ab4[_0xf096('0x41')]);return db[_0xf096('0x2e')][_0xf096('0x48')](_0x487e54)[_0xf096('0x28')](function(_0x5f06b6){if(_0x5f06b6){_0x5ab407=_0x5f06b6;return _0x5f06b6['getFields']();}return null;})[_0xf096('0x28')](function(_0xe700fe){if(_0xe700fe){if(!_0xe700fe[_0xf096('0x45')]){throw new db[(_0xf096('0x84'))][(_0xf096('0x66'))](_0xf096('0x67'),0x193);}_0x189574=_0xe700fe;return db[_0xf096('0x68')]['findAll']({'raw':!![]});}return null;})[_0xf096('0x28')](function(_0x3e65f8){if(_0x3e65f8){_0x464195=_[_0xf096('0x69')](_0x3e65f8,'id');var _0x3460cd;var _0x95cc43=squel[_0xf096('0x6a')]();_0x95cc43[_0xf096('0x6b')](_0x5ab407['table']);for(var _0x2f17ff=0x0;_0x2f17ff<_0x189574[_0xf096('0x45')];_0x2f17ff+=0x1){_0x3460cd=_0x189574[_0x2f17ff][_0xf096('0x6d')]?_0x464195[_0x189574[_0x2f17ff]['MetricId']]['metric']:_0x189574[_0x2f17ff][_0xf096('0x62')];_0x3460cd=_0x189574[_0x2f17ff][_0xf096('0x87')]?_[_0xf096('0x6e')](_0x2dc321[_0x189574[_0x2f17ff][_0xf096('0x87')]],'%s',_0x3460cd):_0x3460cd;_0x3460cd=_0x189574[_0x2f17ff][_0xf096('0x6f')]?_[_0xf096('0x6e')](_0x11d1f2[_0x189574[_0x2f17ff][_0xf096('0x6f')]],'%s',_0x3460cd):_0x3460cd;if(_0x189574[_0x2f17ff][_0xf096('0x70')]){_0x95cc43[_0xf096('0x61')](_0x3460cd);}_0x189574[_0x2f17ff]['orderBy']&&_0x95cc43[_0xf096('0x3b')](_0x3460cd,_0x189574[_0x2f17ff][_0xf096('0x71')]===_0xf096('0x72')?![]:!![]);_0x95cc43[_0xf096('0x62')](_0x3460cd,_0x189574[_0x2f17ff]['alias']||_0x3460cd);}if(_0x5ab407[_0xf096('0x73')]){_0x5ab407[_0xf096('0x73')]=JSON[_0xf096('0x74')](_0x5ab407[_0xf096('0x73')]);for(var _0x105e96=0x0;_0x105e96<_0x5ab407[_0xf096('0x73')][_0xf096('0x45')];_0x105e96+=0x1){if(_0x5ab407[_0xf096('0x73')][_0x105e96][_0xf096('0x30')]&&_[_0xf096('0x75')](_0x3d90b0,_0x5ab407[_0xf096('0x73')][_0x105e96][_0xf096('0x30')])&&_0x5ab407[_0xf096('0x73')][_0x105e96][_0xf096('0x76')]&&_0x5ab407[_0xf096('0x73')][_0x105e96]['foreignTable']&&_0x5ab407[_0xf096('0x73')][_0x105e96][_0xf096('0x77')]){_0x95cc43[_0x5ab407['joins'][_0x105e96]['type']](_0x5ab407[_0xf096('0x73')][_0x105e96][_0xf096('0x78')],null,util[_0xf096('0x6f')](_0xf096('0x79'),_0x5ab407[_0xf096('0x6c')],_0x5ab407[_0xf096('0x73')][_0x105e96][_0xf096('0x76')],_0x5ab407[_0xf096('0x73')][_0x105e96][_0xf096('0x78')],_0x5ab407[_0xf096('0x73')][_0x105e96][_0xf096('0x77')]));}}}if(_0x5ab407['conditions']){_0x5ab407[_0xf096('0x7a')]=JSON[_0xf096('0x74')](_0x5ab407[_0xf096('0x7a')]);_0x95cc43[_0xf096('0x3d')](_0x473ed5(_0x5ab407[_0xf096('0x7a')][_0xf096('0x61')]));}_0x1662c1=_0x95cc43[_0xf096('0x7b')]();_0x95cc43[_0xf096('0x1d')](_0x42354d);_0x95cc43[_0xf096('0x1c')](0x0);logger[_0xf096('0x7c')](_0xf096('0x88'),_0x95cc43['toString']());return db['sequelize'][_0xf096('0x32')](_0x95cc43[_0xf096('0x7d')](),{'type':db[_0xf096('0x7e')][_0xf096('0x89')][_0xf096('0x8a')]});}})['then'](function(){return{'sql':_0x1662c1[_0xf096('0x7d')]()};})['then'](respondWithResult(_0x22b22e,null))[_0xf096('0x49')](handleError(_0x22b22e,null));}; \ No newline at end of file +var _0xe6c2=['../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','destroy','error','name','index','map','AnalyticDefaultReport','fieldName','type','model','query','keys','intersection','attributes','fields','order','sort','where','pick','filters','merge','filter','options','includeAll','include','findAll','params','rawAttributes','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','preview','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','MAX(%s)','HOUR(%s)','IS\x20NOT\x20NULL','Sequelize','keyBy','from','table','DESC','debug','No\x20available\x20data','fullPath','generate','output','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','child_process','fork','../../components/export/','savename','select','countTable','runReport','left_join','DATE(%s)','IS\x20NOT\x20EMPTY','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x23636b,_0x5c831f){var _0x217c84=function(_0x4d21ef){while(--_0x4d21ef){_0x23636b['push'](_0x23636b['shift']());}};_0x217c84(++_0x5c831f);}(_0xe6c2,0x129));var _0x2e6c=function(_0x7b7391,_0x334649){_0x7b7391=_0x7b7391-0x0;var _0x5e2a2f=_0xe6c2[_0x7b7391];return _0x5e2a2f;};'use strict';var pdf=require(_0x2e6c('0x0'));var emlformat=require(_0x2e6c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2e6c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2e6c('0x3'));var moment=require(_0x2e6c('0x4'));var BPromise=require(_0x2e6c('0x5'));var Mustache=require(_0x2e6c('0x6'));var util=require(_0x2e6c('0x7'));var path=require(_0x2e6c('0x8'));var sox=require(_0x2e6c('0x9'));var csv=require(_0x2e6c('0xa'));var ejs=require(_0x2e6c('0xb'));var fs=require('fs');var _=require(_0x2e6c('0xc'));var squel=require(_0x2e6c('0xd'));var crypto=require(_0x2e6c('0xe'));var jsforce=require(_0x2e6c('0xf'));var deskjs=require(_0x2e6c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2e6c('0x11'));var Papa=require(_0x2e6c('0x12'));var Redis=require(_0x2e6c('0x13'));var authService=require(_0x2e6c('0x14'));var qs=require(_0x2e6c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e6c('0x16'))(_0x2e6c('0x17'));var utils=require(_0x2e6c('0x18'));var config=require(_0x2e6c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3debda,_0x4f7374){_0x4f7374=_0x4f7374||0xcc;return function(_0x4e4e07){if(_0x4e4e07){return _0x3debda[_0x2e6c('0x1a')](_0x4f7374);}return _0x3debda[_0x2e6c('0x1b')](_0x4f7374)['end']();};}function respondWithResult(_0x56db14,_0xb48273){_0xb48273=_0xb48273||0xc8;return function(_0x2857b0){if(_0x2857b0){return _0x56db14[_0x2e6c('0x1b')](_0xb48273)[_0x2e6c('0x1c')](_0x2857b0);}};}function respondWithFilteredResult(_0x267de1,_0x276d04){return function(_0xa0a64c){if(_0xa0a64c){var _0x6288a3=_0xa0a64c[_0x2e6c('0x1d')],_0x5cdea9=_0x276d04['offset'],_0x3b2bc5=_0x276d04[_0x2e6c('0x1e')]+_0x276d04[_0x2e6c('0x1f')],_0xa5f5c;if(_0x3b2bc5>=_0x6288a3){_0x3b2bc5=_0x6288a3;_0xa5f5c=0xc8;}else{_0xa5f5c=0xce;}_0x267de1[_0x2e6c('0x1b')](_0xa5f5c);return _0x267de1[_0x2e6c('0x20')](_0x2e6c('0x21'),_0x5cdea9+'-'+_0x3b2bc5+'/'+_0x6288a3)[_0x2e6c('0x1c')](_0xa0a64c);}return null;};}function patchUpdates(_0x5fb797){return function(_0x406742){try{jsonpatch[_0x2e6c('0x22')](_0x406742,_0x5fb797,!![]);}catch(_0x45823a){return BPromise[_0x2e6c('0x23')](_0x45823a);}return _0x406742[_0x2e6c('0x24')]();};}function saveUpdates(_0x14a8e9,_0x23b0d1){return function(_0x2d061e){if(_0x2d061e){return _0x2d061e[_0x2e6c('0x25')](_0x14a8e9)[_0x2e6c('0x26')](function(_0x2e4ee3){return _0x2e4ee3;});}return null;};}function removeEntity(_0x411b72,_0x5726d5){return function(_0x4e99ec){if(_0x4e99ec){return _0x4e99ec['destroy']()[_0x2e6c('0x26')](function(){var _0x269e77=_0x4e99ec[_0x2e6c('0x27')]({'plain':!![]});var _0x556d71=_0x2e6c('0x28');return db['UserProfileResource'][_0x2e6c('0x29')]({'where':{'type':_0x556d71,'resourceId':_0x269e77['id']}})[_0x2e6c('0x26')](function(){return _0x4e99ec;});})[_0x2e6c('0x26')](function(){_0x411b72[_0x2e6c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44a175,_0xf02f5){return function(_0x4f9d41){if(!_0x4f9d41){_0x44a175[_0x2e6c('0x1a')](0x194);}return _0x4f9d41;};}function handleError(_0x411fe7,_0xa02cad){_0xa02cad=_0xa02cad||0x1f4;return function(_0x1714af){logger[_0x2e6c('0x2a')](_0x1714af['stack']);if(_0x1714af[_0x2e6c('0x2b')]){delete _0x1714af[_0x2e6c('0x2b')];}_0x411fe7[_0x2e6c('0x1b')](_0xa02cad)['send'](_0x1714af);};}exports[_0x2e6c('0x2c')]=function(_0x40ce0e,_0x1367bd){var _0x25cd2b={},_0x4ead7a={},_0x3a96a6={'count':0x0,'rows':[]};var _0x8316cc=_[_0x2e6c('0x2d')](db[_0x2e6c('0x2e')]['rawAttributes'],function(_0x4d5c26){return{'name':_0x4d5c26[_0x2e6c('0x2f')],'type':_0x4d5c26[_0x2e6c('0x30')]['key']};});_0x4ead7a[_0x2e6c('0x31')]=_[_0x2e6c('0x2d')](_0x8316cc,_0x2e6c('0x2b'));_0x4ead7a[_0x2e6c('0x32')]=_[_0x2e6c('0x33')](_0x40ce0e[_0x2e6c('0x32')]);_0x4ead7a['filters']=_[_0x2e6c('0x34')](_0x4ead7a[_0x2e6c('0x31')],_0x4ead7a[_0x2e6c('0x32')]);_0x25cd2b[_0x2e6c('0x35')]=_['intersection'](_0x4ead7a[_0x2e6c('0x31')],qs[_0x2e6c('0x36')](_0x40ce0e[_0x2e6c('0x32')][_0x2e6c('0x36')]));_0x25cd2b[_0x2e6c('0x35')]=_0x25cd2b[_0x2e6c('0x35')]['length']?_0x25cd2b['attributes']:_0x4ead7a['model'];if(!_0x40ce0e['query']['hasOwnProperty']('nolimit')){_0x25cd2b['limit']=qs[_0x2e6c('0x1f')](_0x40ce0e[_0x2e6c('0x32')][_0x2e6c('0x1f')]);_0x25cd2b[_0x2e6c('0x1e')]=qs['offset'](_0x40ce0e['query'][_0x2e6c('0x1e')]);}_0x25cd2b[_0x2e6c('0x37')]=qs[_0x2e6c('0x38')](_0x40ce0e[_0x2e6c('0x32')]['sort']);_0x25cd2b[_0x2e6c('0x39')]=qs['filters'](_[_0x2e6c('0x3a')](_0x40ce0e[_0x2e6c('0x32')],_0x4ead7a[_0x2e6c('0x3b')]));if(_0x40ce0e[_0x2e6c('0x32')]['filter']){_0x25cd2b[_0x2e6c('0x39')]=_[_0x2e6c('0x3c')](_0x25cd2b[_0x2e6c('0x39')],{'$or':_['map'](_0x8316cc,function(_0x4134de){if(_0x4134de[_0x2e6c('0x30')]!=='VIRTUAL'){var _0x1994ee={};_0x1994ee[_0x4134de[_0x2e6c('0x2b')]]={'$like':'%'+_0x40ce0e['query'][_0x2e6c('0x3d')]+'%'};return _0x1994ee;}})});}_0x25cd2b=_[_0x2e6c('0x3c')]({},_0x25cd2b,_0x40ce0e[_0x2e6c('0x3e')]);var _0x45c6d4={'where':_0x25cd2b[_0x2e6c('0x39')]};return db[_0x2e6c('0x2e')][_0x2e6c('0x1d')](_0x45c6d4)[_0x2e6c('0x26')](function(_0x4f263f){_0x3a96a6[_0x2e6c('0x1d')]=_0x4f263f;if(_0x40ce0e[_0x2e6c('0x32')][_0x2e6c('0x3f')]){_0x25cd2b[_0x2e6c('0x40')]=[{'all':!![]}];}return db[_0x2e6c('0x2e')][_0x2e6c('0x41')](_0x25cd2b);})[_0x2e6c('0x26')](function(_0x4d9cfa){_0x3a96a6['rows']=_0x4d9cfa;return _0x3a96a6;})[_0x2e6c('0x26')](respondWithFilteredResult(_0x1367bd,_0x25cd2b))['catch'](handleError(_0x1367bd,null));};exports['show']=function(_0x476383,_0xcf1013){var _0x13ecc4={'raw':!![],'where':{'id':_0x476383[_0x2e6c('0x42')]['id']}},_0x35c0c4={};_0x35c0c4[_0x2e6c('0x31')]=_['keys'](db[_0x2e6c('0x2e')][_0x2e6c('0x43')]);_0x35c0c4[_0x2e6c('0x32')]=_[_0x2e6c('0x33')](_0x476383[_0x2e6c('0x32')]);_0x35c0c4[_0x2e6c('0x3b')]=_[_0x2e6c('0x34')](_0x35c0c4[_0x2e6c('0x31')],_0x35c0c4['query']);_0x13ecc4[_0x2e6c('0x35')]=_[_0x2e6c('0x34')](_0x35c0c4[_0x2e6c('0x31')],qs[_0x2e6c('0x36')](_0x476383[_0x2e6c('0x32')]['fields']));_0x13ecc4[_0x2e6c('0x35')]=_0x13ecc4[_0x2e6c('0x35')][_0x2e6c('0x44')]?_0x13ecc4[_0x2e6c('0x35')]:_0x35c0c4[_0x2e6c('0x31')];if(_0x476383[_0x2e6c('0x32')][_0x2e6c('0x3f')]){_0x13ecc4[_0x2e6c('0x40')]=[{'all':!![]}];}_0x13ecc4=_[_0x2e6c('0x3c')]({},_0x13ecc4,_0x476383[_0x2e6c('0x3e')]);return db['AnalyticDefaultReport'][_0x2e6c('0x45')](_0x13ecc4)['then'](handleEntityNotFound(_0xcf1013,null))[_0x2e6c('0x26')](respondWithResult(_0xcf1013,null))[_0x2e6c('0x46')](handleError(_0xcf1013,null));};exports[_0x2e6c('0x47')]=function(_0x3e7154,_0x195956){return db[_0x2e6c('0x2e')]['create'](_0x3e7154[_0x2e6c('0x48')],{})['then'](function(_0x3ddd1b){var _0x1e6fa7=_0x3e7154[_0x2e6c('0x49')][_0x2e6c('0x27')]({'plain':!![]});if(!_0x1e6fa7)throw new Error(_0x2e6c('0x4a'));if(_0x1e6fa7[_0x2e6c('0x4b')]===_0x2e6c('0x49')){var _0x3fea9f=_0x3ddd1b['get']({'plain':!![]});var _0x41e58e=_0x2e6c('0x4c');return db[_0x2e6c('0x4d')][_0x2e6c('0x45')]({'where':{'name':_0x41e58e,'userProfileId':_0x1e6fa7[_0x2e6c('0x4e')]},'raw':!![]})[_0x2e6c('0x26')](function(_0x55174b){if(_0x55174b&&_0x55174b[_0x2e6c('0x4f')]===0x0){return db[_0x2e6c('0x50')][_0x2e6c('0x47')]({'name':_0x3fea9f[_0x2e6c('0x2b')],'resourceId':_0x3fea9f['id'],'type':_0x2e6c('0x28'),'sectionId':_0x55174b['id']},{})[_0x2e6c('0x26')](function(){return _0x3ddd1b;});}else{return _0x3ddd1b;}})[_0x2e6c('0x46')](function(_0x4b7546){logger[_0x2e6c('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b7546);throw _0x4b7546;});}return _0x3ddd1b;})[_0x2e6c('0x26')](respondWithResult(_0x195956,0xc9))['catch'](handleError(_0x195956,null));};exports['update']=function(_0x44324b,_0x4c8da4){if(_0x44324b[_0x2e6c('0x48')]['id']){delete _0x44324b[_0x2e6c('0x48')]['id'];}return db['AnalyticDefaultReport'][_0x2e6c('0x45')]({'where':{'id':_0x44324b[_0x2e6c('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c8da4,null))[_0x2e6c('0x26')](saveUpdates(_0x44324b[_0x2e6c('0x48')],null))[_0x2e6c('0x26')](respondWithResult(_0x4c8da4,null))[_0x2e6c('0x46')](handleError(_0x4c8da4,null));};exports[_0x2e6c('0x29')]=function(_0x2f58b4,_0x476fd5){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x2f58b4[_0x2e6c('0x42')]['id']}})[_0x2e6c('0x26')](handleEntityNotFound(_0x476fd5,null))[_0x2e6c('0x26')](removeEntity(_0x476fd5,null))['catch'](handleError(_0x476fd5,null));};exports[_0x2e6c('0x51')]=function(_0x52ac21,_0x3f1e50){var _0x78cb54=0xa;var _0x153d27=[_0x2e6c('0x52'),'left_join',_0x2e6c('0x53'),_0x2e6c('0x54')];var _0xe70b3d={'SUM':'SUM(%s)','COUNT':_0x2e6c('0x55'),'COUNT DISTINCT':_0x2e6c('0x56'),'MAX':'MAX(%s)','MIN':_0x2e6c('0x57'),'AVG':_0x2e6c('0x58'),'GROUP_CONCAT':_0x2e6c('0x59'),'GROUP_CONCAT ASC':_0x2e6c('0x5a'),'GROUP_CONCAT DESC':_0x2e6c('0x5b')};var _0x251d42={'SEC_TO_TIME':_0x2e6c('0x5c'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x2e6c('0x5d'),'UNIX_TIMESTAMP':_0x2e6c('0x5e')};var _0x46c2f7=function(_0x5d6c86){return!_[_0x2e6c('0x5f')]([_0x2e6c('0x60'),'IS\x20NOT\x20NULL',_0x2e6c('0x61'),'IS\x20NOT\x20EMPTY'],_0x5d6c86);};var _0x178a5e=function(_0x3e7f9f){if(!_0x3e7f9f||!_0x3e7f9f['rules'][_0x2e6c('0x44')]){return'';}for(var _0x39bbcd='(',_0x1d52db=0x0;_0x1d52db<_0x3e7f9f[_0x2e6c('0x62')]['length'];_0x1d52db+=0x1){_0x1d52db>0x0&&(_0x39bbcd+='\x20'+_0x3e7f9f['operator']+'\x20');_0x39bbcd+=_0x3e7f9f[_0x2e6c('0x62')][_0x1d52db][_0x2e6c('0x63')]?_0x178a5e(_0x3e7f9f['rules'][_0x1d52db]['group']):_0x3e7f9f[_0x2e6c('0x62')][_0x1d52db][_0x2e6c('0x64')]+'\x20'+_0x3e7f9f[_0x2e6c('0x62')][_0x1d52db][_0x2e6c('0x65')]+(_0x46c2f7(_0x3e7f9f[_0x2e6c('0x62')][_0x1d52db]['condition'])?'\x20'+_0x3e7f9f[_0x2e6c('0x62')][_0x1d52db][_0x2e6c('0x66')]:'');}return _0x39bbcd+')';};var _0x1c8bdd={'where':{'id':_0x52ac21[_0x2e6c('0x42')]['id']}},_0x5a94a5,_0x2dcdbd,_0x2fb812,_0x56b80d,_0x27fa4b;_0x1c8bdd=_[_0x2e6c('0x3c')]({},_0x1c8bdd,_0x52ac21[_0x2e6c('0x3e')]);return db['AnalyticDefaultReport'][_0x2e6c('0x45')](_0x1c8bdd)[_0x2e6c('0x26')](function(_0x25ca18){if(_0x25ca18){_0x5a94a5=_0x25ca18;return _0x25ca18[_0x2e6c('0x67')]();}return null;})['then'](function(_0x59b2c6){if(_0x59b2c6){if(!_0x59b2c6['length']){throw new db['Sequelize'][(_0x2e6c('0x68'))](_0x2e6c('0x69'),0x193);}_0x2dcdbd=_0x59b2c6;return db[_0x2e6c('0x6a')][_0x2e6c('0x41')]({'raw':!![]});}return null;})[_0x2e6c('0x26')](function(_0x581a5d){if(_0x581a5d){_0x2fb812=_['keyBy'](_0x581a5d,'id');var _0xd4acd1;var _0x1b5fc4=squel['select']();_0x1b5fc4['from'](_0x5a94a5['table']);for(var _0x2bfa0f=0x0;_0x2bfa0f<_0x2dcdbd[_0x2e6c('0x44')];_0x2bfa0f+=0x1){_0xd4acd1=_0x2dcdbd[_0x2bfa0f][_0x2e6c('0x6b')]?_0x2fb812[_0x2dcdbd[_0x2bfa0f][_0x2e6c('0x6b')]][_0x2e6c('0x6c')]:_0x2dcdbd[_0x2bfa0f][_0x2e6c('0x64')];_0xd4acd1=_0x2dcdbd[_0x2bfa0f][_0x2e6c('0x6d')]?_[_0x2e6c('0x6e')](_0xe70b3d[_0x2dcdbd[_0x2bfa0f][_0x2e6c('0x6d')]],'%s',_0xd4acd1):_0xd4acd1;_0xd4acd1=_0x2dcdbd[_0x2bfa0f][_0x2e6c('0x6f')]?_[_0x2e6c('0x6e')](_0x251d42[_0x2dcdbd[_0x2bfa0f]['format']],'%s',_0xd4acd1):_0xd4acd1;if(_0x2dcdbd[_0x2bfa0f][_0x2e6c('0x70')]){_0x1b5fc4[_0x2e6c('0x63')](_0xd4acd1);}_0x2dcdbd[_0x2bfa0f][_0x2e6c('0x71')]&&_0x1b5fc4[_0x2e6c('0x37')](_0xd4acd1,_0x2dcdbd[_0x2bfa0f][_0x2e6c('0x71')]==='DESC'?![]:!![]);_0x1b5fc4[_0x2e6c('0x64')](_0xd4acd1,_0x2dcdbd[_0x2bfa0f][_0x2e6c('0x72')]||_0xd4acd1);}if(_0x5a94a5[_0x2e6c('0x73')]){_0x5a94a5[_0x2e6c('0x73')]=JSON[_0x2e6c('0x74')](_0x5a94a5[_0x2e6c('0x73')]);for(var _0x3d86e2=0x0;_0x3d86e2<_0x5a94a5[_0x2e6c('0x73')][_0x2e6c('0x44')];_0x3d86e2+=0x1){if(_0x5a94a5[_0x2e6c('0x73')][_0x3d86e2][_0x2e6c('0x30')]&&_[_0x2e6c('0x5f')](_0x153d27,_0x5a94a5['joins'][_0x3d86e2][_0x2e6c('0x30')])&&_0x5a94a5['joins'][_0x3d86e2][_0x2e6c('0x75')]&&_0x5a94a5[_0x2e6c('0x73')][_0x3d86e2]['foreignTable']&&_0x5a94a5['joins'][_0x3d86e2]['foreignKey']){_0x1b5fc4[_0x5a94a5[_0x2e6c('0x73')][_0x3d86e2][_0x2e6c('0x30')]](_0x5a94a5['joins'][_0x3d86e2][_0x2e6c('0x76')],null,util['format'](_0x2e6c('0x77'),_0x5a94a5['table'],_0x5a94a5['joins'][_0x3d86e2][_0x2e6c('0x75')],_0x5a94a5[_0x2e6c('0x73')][_0x3d86e2][_0x2e6c('0x76')],_0x5a94a5[_0x2e6c('0x73')][_0x3d86e2][_0x2e6c('0x78')]));}}}if(_0x5a94a5[_0x2e6c('0x79')]){_0x5a94a5['conditions']=JSON[_0x2e6c('0x74')](_0x5a94a5[_0x2e6c('0x79')]);_0x1b5fc4['where'](_0x178a5e(_0x5a94a5[_0x2e6c('0x79')][_0x2e6c('0x63')]));}_0x27fa4b=_0x1b5fc4[_0x2e6c('0x7a')]();_0x1b5fc4['limit'](_0x78cb54);_0x1b5fc4[_0x2e6c('0x1e')](0x0);logger['debug'](_0x2e6c('0x7b'),_0x1b5fc4[_0x2e6c('0x7c')]());return db[_0x2e6c('0x7d')][_0x2e6c('0x32')](_0x1b5fc4[_0x2e6c('0x7c')](),{'type':db[_0x2e6c('0x7d')][_0x2e6c('0x7e')][_0x2e6c('0x7f')]});}})[_0x2e6c('0x26')](respondWithResult(_0x3f1e50,null))[_0x2e6c('0x46')](handleError(_0x3f1e50,null));};function runReport(_0x54ae91,_0x48b66c,_0xdb9cfb){var _0x11155a=_0x48b66c[_0x2e6c('0x2b')];var _0x52c361=0xa;var _0x3d472f=[_0x2e6c('0x52'),'left_join',_0x2e6c('0x53'),_0x2e6c('0x54')];var _0x5d5fe1={'SUM':_0x2e6c('0x80'),'COUNT':_0x2e6c('0x55'),'COUNT DISTINCT':_0x2e6c('0x56'),'MAX':_0x2e6c('0x81'),'MIN':_0x2e6c('0x57'),'AVG':_0x2e6c('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x2e6c('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x366a5d={'SEC_TO_TIME':_0x2e6c('0x5c'),'DATE':'DATE(%s)','HOUR':_0x2e6c('0x82'),'ROUND':_0x2e6c('0x5d'),'UNIX_TIMESTAMP':_0x2e6c('0x5e')};var _0xbeb290=function(_0x4f0a16){return!_[_0x2e6c('0x5f')]([_0x2e6c('0x60'),_0x2e6c('0x83'),_0x2e6c('0x61'),'IS\x20NOT\x20EMPTY'],_0x4f0a16);};var _0x365e4f=function(_0x173079){if(!_0x173079||!_0x173079[_0x2e6c('0x62')][_0x2e6c('0x44')]){return'';}for(var _0x46e6a3='(',_0x293e9a=0x0;_0x293e9a<_0x173079['rules'][_0x2e6c('0x44')];_0x293e9a+=0x1){_0x293e9a>0x0&&(_0x46e6a3+='\x20'+_0x173079['operator']+'\x20');_0x46e6a3+=_0x173079[_0x2e6c('0x62')][_0x293e9a][_0x2e6c('0x63')]?_0x365e4f(_0x173079[_0x2e6c('0x62')][_0x293e9a][_0x2e6c('0x63')]):_0x173079[_0x2e6c('0x62')][_0x293e9a][_0x2e6c('0x64')]+'\x20'+_0x173079[_0x2e6c('0x62')][_0x293e9a]['condition']+(_0xbeb290(_0x173079[_0x2e6c('0x62')][_0x293e9a][_0x2e6c('0x65')])?'\x20'+_0x173079[_0x2e6c('0x62')][_0x293e9a][_0x2e6c('0x66')]:'');}return _0x46e6a3+')';};var _0x51822a={'where':{'id':_0x54ae91['id']}},_0x35750,_0x19d2d0,_0x301ac4,_0x39b29d,_0x480b2a;_0x51822a=_[_0x2e6c('0x3c')]({},_0x51822a,_0xdb9cfb);return db['AnalyticDefaultReport']['find'](_0x51822a)[_0x2e6c('0x26')](function(_0x4c080e){if(_0x4c080e){_0x35750=_0x4c080e;return _0x4c080e[_0x2e6c('0x67')]();}return null;})['then'](function(_0x21a0c3){if(_0x21a0c3){if(!_0x21a0c3[_0x2e6c('0x44')]){throw new db[(_0x2e6c('0x84'))][(_0x2e6c('0x68'))](_0x2e6c('0x69'),0x193);}_0x19d2d0=_0x21a0c3;return db[_0x2e6c('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x2e6c('0x26')](function(_0x45303f){if(_0x45303f){_0x301ac4=_[_0x2e6c('0x85')](_0x45303f,'id');var _0x57079e;var _0x3ed7a8=squel['select']();_0x3ed7a8[_0x2e6c('0x86')](_0x35750[_0x2e6c('0x87')]);for(var _0x3dda66=0x0;_0x3dda66<_0x19d2d0[_0x2e6c('0x44')];_0x3dda66+=0x1){_0x57079e=_0x19d2d0[_0x3dda66][_0x2e6c('0x6b')]?_0x301ac4[_0x19d2d0[_0x3dda66][_0x2e6c('0x6b')]]['metric']:_0x19d2d0[_0x3dda66][_0x2e6c('0x64')];_0x57079e=_0x19d2d0[_0x3dda66][_0x2e6c('0x6d')]?_[_0x2e6c('0x6e')](_0x5d5fe1[_0x19d2d0[_0x3dda66][_0x2e6c('0x6d')]],'%s',_0x57079e):_0x57079e;_0x57079e=_0x19d2d0[_0x3dda66][_0x2e6c('0x6f')]?_['replace'](_0x366a5d[_0x19d2d0[_0x3dda66][_0x2e6c('0x6f')]],'%s',_0x57079e):_0x57079e;if(_0x19d2d0[_0x3dda66]['groupBy']){_0x3ed7a8['group'](_0x57079e);}_0x19d2d0[_0x3dda66][_0x2e6c('0x71')]&&_0x3ed7a8[_0x2e6c('0x37')](_0x57079e,_0x19d2d0[_0x3dda66][_0x2e6c('0x71')]===_0x2e6c('0x88')?![]:!![]);_0x3ed7a8['field'](_0x57079e,_0x19d2d0[_0x3dda66][_0x2e6c('0x72')]||_0x57079e);}if(_0x35750[_0x2e6c('0x73')]){_0x35750[_0x2e6c('0x73')]=JSON['parse'](_0x35750['joins']);for(var _0x414611=0x0;_0x414611<_0x35750[_0x2e6c('0x73')][_0x2e6c('0x44')];_0x414611+=0x1){if(_0x35750[_0x2e6c('0x73')][_0x414611][_0x2e6c('0x30')]&&_['includes'](_0x3d472f,_0x35750['joins'][_0x414611][_0x2e6c('0x30')])&&_0x35750['joins'][_0x414611][_0x2e6c('0x75')]&&_0x35750['joins'][_0x414611][_0x2e6c('0x76')]&&_0x35750['joins'][_0x414611][_0x2e6c('0x78')]){_0x3ed7a8[_0x35750[_0x2e6c('0x73')][_0x414611][_0x2e6c('0x30')]](_0x35750['joins'][_0x414611][_0x2e6c('0x76')],null,util[_0x2e6c('0x6f')](_0x2e6c('0x77'),_0x35750[_0x2e6c('0x87')],_0x35750[_0x2e6c('0x73')][_0x414611][_0x2e6c('0x75')],_0x35750['joins'][_0x414611][_0x2e6c('0x76')],_0x35750[_0x2e6c('0x73')][_0x414611][_0x2e6c('0x78')]));}}}if(_0x35750[_0x2e6c('0x79')]){_0x35750[_0x2e6c('0x79')]=JSON[_0x2e6c('0x74')](_0x35750[_0x2e6c('0x79')]);_0x3ed7a8['where'](_0x365e4f(_0x35750[_0x2e6c('0x79')][_0x2e6c('0x63')]));}_0x480b2a=_0x3ed7a8['clone']();_0x3ed7a8[_0x2e6c('0x1f')](_0x52c361);_0x3ed7a8[_0x2e6c('0x1e')](0x0);logger[_0x2e6c('0x89')](_0x2e6c('0x7b'),_0x3ed7a8[_0x2e6c('0x7c')]());return db['sequelize']['query'](_0x3ed7a8['toString'](),{'type':db[_0x2e6c('0x7d')]['QueryTypes'][_0x2e6c('0x7f')]});}})[_0x2e6c('0x26')](function(_0x11df91){if(!_0x11df91['length']){throw new db[(_0x2e6c('0x84'))][(_0x2e6c('0x68'))](_0x2e6c('0x8a'),0xcc);}if(_0x48b66c['output']==='web'){return null;}var _0x210514=_[_0x2e6c('0x3c')](_0x48b66c,{'name':_0x48b66c[_0x2e6c('0x8b')]||_0x48b66c[_0x2e6c('0x2b')]||_0x35750[_0x2e6c('0x2b')],'basename':_0x11155a,'savename':util[_0x2e6c('0x6f')]('%s-%s.%s',_0x48b66c[_0x2e6c('0x2b')]||_0x35750['name'],require('randomstring')[_0x2e6c('0x8c')](0x4),_0x48b66c[_0x2e6c('0x8d')]||_0x2e6c('0x8e')),'reportId':_0x35750['id'],'reportType':_0x2e6c('0x8f')});return db[_0x2e6c('0x90')][_0x2e6c('0x47')](_0x210514,{'raw':!![]});})[_0x2e6c('0x26')](function(_0x15cfc4){if(_0x35750[_0x2e6c('0x87')]===_0x2e6c('0x91')){_0x480b2a[_0x2e6c('0x39')](_0x35750[_0x2e6c('0x87')]+_0x2e6c('0x92'),_0x48b66c[_0x2e6c('0x93')],_0x48b66c['endDate']);}else{_0x480b2a[_0x2e6c('0x39')](_0x35750[_0x2e6c('0x87')]+_0x2e6c('0x94'),_0x48b66c['startDate'],_0x48b66c[_0x2e6c('0x95')]);}if(_0x15cfc4){logger[_0x2e6c('0x96')]('Run\x20Query:',_0x480b2a[_0x2e6c('0x7c')]());require(_0x2e6c('0x97'))[_0x2e6c('0x98')](path[_0x2e6c('0x52')](__dirname,_0x2e6c('0x99'),_0x15cfc4['output']),[_0x15cfc4['id'],_0x480b2a[_0x2e6c('0x7c')](),path[_0x2e6c('0x52')](__dirname,'../../files/reports',_0x15cfc4[_0x2e6c('0x9a')]),_0x11155a]);return _0x15cfc4;}else{var _0x374d36=squel[_0x2e6c('0x9b')]();_0x374d36[_0x2e6c('0x86')]('('+_0x480b2a[_0x2e6c('0x7c')]()+')',_0x2e6c('0x9c'));_0x374d36[_0x2e6c('0x64')]('COUNT(*)',_0x2e6c('0x1d'));_0x480b2a[_0x2e6c('0x1f')](_0x48b66c['limit']||_0x52c361);_0x480b2a[_0x2e6c('0x1e')](_0x48b66c['offset']||0x0);return db[_0x2e6c('0x7d')][_0x2e6c('0x32')](_0x374d36[_0x2e6c('0x7c')](),{'type':db['sequelize'][_0x2e6c('0x7e')][_0x2e6c('0x7f')]})[_0x2e6c('0x26')](function(_0x4509c4){if(!_0x4509c4[_0x2e6c('0x44')]){_0x39b29d=0x0;}else{_0x39b29d=_0x4509c4[0x0][_0x2e6c('0x1d')]||0x0;}return db['sequelize'][_0x2e6c('0x32')](_0x480b2a[_0x2e6c('0x7c')](),{'type':db[_0x2e6c('0x7d')][_0x2e6c('0x7e')][_0x2e6c('0x7f')]});})[_0x2e6c('0x26')](function(_0x42b8ad){return{'rows':_0x42b8ad||[],'count':_0x39b29d};});}});}exports['run']=function(_0x90f6c2,_0x43a1d9){return runReport(_0x90f6c2['params'],_0x90f6c2[_0x2e6c('0x32')],_0x90f6c2[_0x2e6c('0x3e')])[_0x2e6c('0x26')](respondWithResult(_0x43a1d9,null))[_0x2e6c('0x46')](handleError(_0x43a1d9,null));};exports[_0x2e6c('0x9d')]=runReport;exports[_0x2e6c('0x32')]=function(_0x3bdf97,_0x2635e0){var _0x4e60e2=0xa;var _0xb576dc=[_0x2e6c('0x52'),_0x2e6c('0x9e'),_0x2e6c('0x53'),_0x2e6c('0x54')];var _0x4c0397={'SUM':_0x2e6c('0x80'),'COUNT':_0x2e6c('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2e6c('0x81'),'MIN':'MIN(%s)','AVG':_0x2e6c('0x58'),'GROUP_CONCAT':_0x2e6c('0x59'),'GROUP_CONCAT ASC':_0x2e6c('0x5a'),'GROUP_CONCAT DESC':_0x2e6c('0x5b')};var _0x200260={'SEC_TO_TIME':_0x2e6c('0x5c'),'DATE':_0x2e6c('0x9f'),'HOUR':'HOUR(%s)','ROUND':_0x2e6c('0x5d'),'UNIX_TIMESTAMP':_0x2e6c('0x5e')};var _0x491ce9=function(_0x1c8d2f){return!_[_0x2e6c('0x5f')]([_0x2e6c('0x60'),_0x2e6c('0x83'),_0x2e6c('0x61'),_0x2e6c('0xa0')],_0x1c8d2f);};var _0x453ca6=function(_0x548fc3){if(!_0x548fc3||!_0x548fc3[_0x2e6c('0x62')][_0x2e6c('0x44')]){return'';}for(var _0x2c2ee4='(',_0x31a8e7=0x0;_0x31a8e7<_0x548fc3[_0x2e6c('0x62')][_0x2e6c('0x44')];_0x31a8e7+=0x1){_0x31a8e7>0x0&&(_0x2c2ee4+='\x20'+_0x548fc3['operator']+'\x20');_0x2c2ee4+=_0x548fc3[_0x2e6c('0x62')][_0x31a8e7][_0x2e6c('0x63')]?_0x453ca6(_0x548fc3[_0x2e6c('0x62')][_0x31a8e7][_0x2e6c('0x63')]):_0x548fc3[_0x2e6c('0x62')][_0x31a8e7][_0x2e6c('0x64')]+'\x20'+_0x548fc3[_0x2e6c('0x62')][_0x31a8e7][_0x2e6c('0x65')]+(_0x491ce9(_0x548fc3[_0x2e6c('0x62')][_0x31a8e7][_0x2e6c('0x65')])?'\x20'+_0x548fc3[_0x2e6c('0x62')][_0x31a8e7][_0x2e6c('0x66')]:'');}return _0x2c2ee4+')';};var _0x59f7b2={'where':{'id':_0x3bdf97['params']['id']}},_0x48f1d2,_0x2bce09,_0x1c973a,_0x2d3b5a,_0x5b109d;_0x59f7b2=_[_0x2e6c('0x3c')]({},_0x59f7b2,_0x3bdf97[_0x2e6c('0x3e')]);return db[_0x2e6c('0x2e')][_0x2e6c('0x45')](_0x59f7b2)[_0x2e6c('0x26')](function(_0x4b807e){if(_0x4b807e){_0x48f1d2=_0x4b807e;return _0x4b807e[_0x2e6c('0x67')]();}return null;})[_0x2e6c('0x26')](function(_0x143493){if(_0x143493){if(!_0x143493[_0x2e6c('0x44')]){throw new db[(_0x2e6c('0x84'))][(_0x2e6c('0x68'))](_0x2e6c('0x69'),0x193);}_0x2bce09=_0x143493;return db[_0x2e6c('0x6a')][_0x2e6c('0x41')]({'raw':!![]});}return null;})[_0x2e6c('0x26')](function(_0xc79f3a){if(_0xc79f3a){_0x1c973a=_[_0x2e6c('0x85')](_0xc79f3a,'id');var _0x30728e;var _0x2d77ab=squel[_0x2e6c('0x9b')]();_0x2d77ab[_0x2e6c('0x86')](_0x48f1d2[_0x2e6c('0x87')]);for(var _0x2ef1a5=0x0;_0x2ef1a5<_0x2bce09[_0x2e6c('0x44')];_0x2ef1a5+=0x1){_0x30728e=_0x2bce09[_0x2ef1a5][_0x2e6c('0x6b')]?_0x1c973a[_0x2bce09[_0x2ef1a5]['MetricId']][_0x2e6c('0x6c')]:_0x2bce09[_0x2ef1a5][_0x2e6c('0x64')];_0x30728e=_0x2bce09[_0x2ef1a5][_0x2e6c('0x6d')]?_[_0x2e6c('0x6e')](_0x4c0397[_0x2bce09[_0x2ef1a5]['function']],'%s',_0x30728e):_0x30728e;_0x30728e=_0x2bce09[_0x2ef1a5][_0x2e6c('0x6f')]?_[_0x2e6c('0x6e')](_0x200260[_0x2bce09[_0x2ef1a5][_0x2e6c('0x6f')]],'%s',_0x30728e):_0x30728e;if(_0x2bce09[_0x2ef1a5][_0x2e6c('0x70')]){_0x2d77ab[_0x2e6c('0x63')](_0x30728e);}_0x2bce09[_0x2ef1a5][_0x2e6c('0x71')]&&_0x2d77ab[_0x2e6c('0x37')](_0x30728e,_0x2bce09[_0x2ef1a5][_0x2e6c('0x71')]===_0x2e6c('0x88')?![]:!![]);_0x2d77ab['field'](_0x30728e,_0x2bce09[_0x2ef1a5]['alias']||_0x30728e);}if(_0x48f1d2[_0x2e6c('0x73')]){_0x48f1d2[_0x2e6c('0x73')]=JSON[_0x2e6c('0x74')](_0x48f1d2['joins']);for(var _0x385f8d=0x0;_0x385f8d<_0x48f1d2[_0x2e6c('0x73')][_0x2e6c('0x44')];_0x385f8d+=0x1){if(_0x48f1d2['joins'][_0x385f8d][_0x2e6c('0x30')]&&_[_0x2e6c('0x5f')](_0xb576dc,_0x48f1d2[_0x2e6c('0x73')][_0x385f8d][_0x2e6c('0x30')])&&_0x48f1d2[_0x2e6c('0x73')][_0x385f8d]['parentKey']&&_0x48f1d2[_0x2e6c('0x73')][_0x385f8d][_0x2e6c('0x76')]&&_0x48f1d2['joins'][_0x385f8d][_0x2e6c('0x78')]){_0x2d77ab[_0x48f1d2[_0x2e6c('0x73')][_0x385f8d]['type']](_0x48f1d2[_0x2e6c('0x73')][_0x385f8d][_0x2e6c('0x76')],null,util['format'](_0x2e6c('0x77'),_0x48f1d2[_0x2e6c('0x87')],_0x48f1d2[_0x2e6c('0x73')][_0x385f8d][_0x2e6c('0x75')],_0x48f1d2[_0x2e6c('0x73')][_0x385f8d][_0x2e6c('0x76')],_0x48f1d2['joins'][_0x385f8d][_0x2e6c('0x78')]));}}}if(_0x48f1d2[_0x2e6c('0x79')]){_0x48f1d2['conditions']=JSON[_0x2e6c('0x74')](_0x48f1d2[_0x2e6c('0x79')]);_0x2d77ab[_0x2e6c('0x39')](_0x453ca6(_0x48f1d2[_0x2e6c('0x79')][_0x2e6c('0x63')]));}_0x5b109d=_0x2d77ab['clone']();_0x2d77ab[_0x2e6c('0x1f')](_0x4e60e2);_0x2d77ab[_0x2e6c('0x1e')](0x0);logger[_0x2e6c('0x89')]('Limited\x20Query:',_0x2d77ab[_0x2e6c('0x7c')]());return db[_0x2e6c('0x7d')][_0x2e6c('0x32')](_0x2d77ab[_0x2e6c('0x7c')](),{'type':db[_0x2e6c('0x7d')][_0x2e6c('0x7e')][_0x2e6c('0x7f')]});}})['then'](function(){return{'sql':_0x5b109d['toString']()};})[_0x2e6c('0x26')](respondWithResult(_0x2635e0,null))[_0x2e6c('0x46')](handleError(_0x2635e0,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 4cdec4f..a1422b4 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 _0x32c2=['analytics_default_reports','lodash','util','../../config/logger','api','path','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0xf5c78b,_0x1f61b0){var _0x460352=function(_0x1ec6cc){while(--_0x1ec6cc){_0xf5c78b['push'](_0xf5c78b['shift']());}};_0x460352(++_0x1f61b0);}(_0x32c2,0x90));var _0x232c=function(_0x271367,_0x140b0e){_0x271367=_0x271367-0x0;var _0x3c7bbe=_0x32c2[_0x271367];return _0x3c7bbe;};'use strict';var _=require(_0x232c('0x0'));var util=require(_0x232c('0x1'));var logger=require(_0x232c('0x2'))(_0x232c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x232c('0x4'));var rimraf=require('rimraf');var config=require(_0x232c('0x5'));var attributes=require(_0x232c('0x6'));module[_0x232c('0x7')]=function(_0xa72963,_0x15375d){return _0xa72963[_0x232c('0x8')](_0x232c('0x9'),attributes,{'tableName':_0x232c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba91=['define','analytics_default_reports','lodash','../../config/logger','api','moment','request-promise','rimraf','./analyticDefaultReport.attributes','exports'];(function(_0x20a69f,_0x51c793){var _0x197370=function(_0x411e13){while(--_0x411e13){_0x20a69f['push'](_0x20a69f['shift']());}};_0x197370(++_0x51c793);}(_0xba91,0xac));var _0x1ba9=function(_0x4bdbea,_0x3cec26){_0x4bdbea=_0x4bdbea-0x0;var _0x11e246=_0xba91[_0x4bdbea];return _0x11e246;};'use strict';var _=require(_0x1ba9('0x0'));var util=require('util');var logger=require(_0x1ba9('0x1'))(_0x1ba9('0x2'));var moment=require(_0x1ba9('0x3'));var BPromise=require('bluebird');var rp=require(_0x1ba9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ba9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1ba9('0x6'));module[_0x1ba9('0x7')]=function(_0x20a5e4,_0x5b7b79){return _0x20a5e4[_0x1ba9('0x8')]('AnalyticDefaultReport',attributes,{'tableName':_0x1ba9('0x9'),'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 b652598..75af8dc 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 _0xcd60=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x45b5bd,_0x1b2655){var _0x1af8bb=function(_0x16d485){while(--_0x16d485){_0x45b5bd['push'](_0x45b5bd['shift']());}};_0x1af8bb(++_0x1b2655);}(_0xcd60,0xf0));var _0x0cd6=function(_0x120fd9,_0x36eb6a){_0x120fd9=_0x120fd9-0x0;var _0x394e5a=_0xcd60[_0x120fd9];return _0x394e5a;};'use strict';var _=require(_0x0cd6('0x0'));var util=require(_0x0cd6('0x1'));var moment=require(_0x0cd6('0x2'));var BPromise=require(_0x0cd6('0x3'));var rs=require(_0x0cd6('0x4'));var fs=require('fs');var Redis=require(_0x0cd6('0x5'));var db=require(_0x0cd6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cd6('0x7'))(_0x0cd6('0x8'));var config=require(_0x0cd6('0x9'));var jayson=require(_0x0cd6('0xa'));var client=jayson[_0x0cd6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ceb47,_0x460833,_0x47c8b2){return new BPromise(function(_0x4714bf,_0x4fb298){return client[_0x0cd6('0xc')](_0x2ceb47,_0x47c8b2)[_0x0cd6('0xd')](function(_0x14f396){logger[_0x0cd6('0xe')](_0x0cd6('0xf'),_0x460833,'request\x20sent');logger[_0x0cd6('0x10')](_0x0cd6('0x11'),_0x460833,_0x0cd6('0x12'),JSON[_0x0cd6('0x13')](_0x14f396));if(_0x14f396[_0x0cd6('0x14')]){if(_0x14f396['error']['code']===0x1f4){logger[_0x0cd6('0x14')](_0x0cd6('0xf'),_0x460833,_0x14f396[_0x0cd6('0x14')]['message']);return _0x4fb298(_0x14f396[_0x0cd6('0x14')]['message']);}logger[_0x0cd6('0x14')](_0x0cd6('0xf'),_0x460833,_0x14f396[_0x0cd6('0x14')][_0x0cd6('0x15')]);return _0x4714bf(_0x14f396[_0x0cd6('0x14')][_0x0cd6('0x15')]);}else{logger[_0x0cd6('0xe')](_0x0cd6('0xf'),_0x460833,_0x0cd6('0x12'));_0x4714bf(_0x14f396[_0x0cd6('0x16')][_0x0cd6('0x15')]);}})[_0x0cd6('0x17')](function(_0x30d35c){logger[_0x0cd6('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x460833,_0x30d35c);_0x4fb298(_0x30d35c);});});} \ No newline at end of file +var _0xeebe=['jayson/promise','client','http','request','then','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','AnalyticDefaultReport,\x20%s,\x20%s','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4786c9,_0x12b4ee){var _0x1f97e7=function(_0x4c9f83){while(--_0x4c9f83){_0x4786c9['push'](_0x4786c9['shift']());}};_0x1f97e7(++_0x12b4ee);}(_0xeebe,0xff));var _0xeeeb=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xeebe[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0xeeeb('0x0'));var util=require('util');var moment=require(_0xeeeb('0x1'));var BPromise=require('bluebird');var rs=require(_0xeeeb('0x2'));var fs=require('fs');var Redis=require(_0xeeeb('0x3'));var db=require(_0xeeeb('0x4'))['db'];var utils=require(_0xeeeb('0x5'));var logger=require(_0xeeeb('0x6'))(_0xeeeb('0x7'));var config=require(_0xeeeb('0x8'));var jayson=require(_0xeeeb('0x9'));var client=jayson[_0xeeeb('0xa')][_0xeeeb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46c645,_0x3083ab,_0x41847e){return new BPromise(function(_0x1f88ea,_0xc3e1ba){return client[_0xeeeb('0xc')](_0x46c645,_0x41847e)[_0xeeeb('0xd')](function(_0x426a82){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x3083ab,_0xeeeb('0xe'));logger[_0xeeeb('0xf')](_0xeeeb('0x10'),_0x3083ab,'request\x20sent',JSON[_0xeeeb('0x11')](_0x426a82));if(_0x426a82[_0xeeeb('0x12')]){if(_0x426a82[_0xeeeb('0x12')]['code']===0x1f4){logger[_0xeeeb('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3083ab,_0x426a82['error'][_0xeeeb('0x13')]);return _0xc3e1ba(_0x426a82[_0xeeeb('0x12')][_0xeeeb('0x13')]);}logger[_0xeeeb('0x12')](_0xeeeb('0x14'),_0x3083ab,_0x426a82[_0xeeeb('0x12')][_0xeeeb('0x13')]);return _0x1f88ea(_0x426a82[_0xeeeb('0x12')][_0xeeeb('0x13')]);}else{logger[_0xeeeb('0x15')](_0xeeeb('0x14'),_0x3083ab,_0xeeeb('0xe'));_0x1f88ea(_0x426a82[_0xeeeb('0x16')][_0xeeeb('0x13')]);}})[_0xeeeb('0x17')](function(_0x1b1d02){logger[_0xeeeb('0x12')](_0xeeeb('0x14'),_0x3083ab,_0x1b1d02);_0xc3e1ba(_0x1b1d02);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 81eac45..acd0346 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 _0x82de=['./analyticDefaultReport.controller','get','isAuthenticated','/:id','/:id/preview','preview','run','/:id/query','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x82de,0x1b1));var _0xe82d=function(_0x23c2b7,_0x57b41a){_0x23c2b7=_0x23c2b7-0x0;var _0x4c7225=_0x82de[_0x23c2b7];return _0x4c7225;};'use strict';var multer=require(_0xe82d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe82d('0x1'));var express=require(_0xe82d('0x2'));var router=express[_0xe82d('0x3')]();var auth=require(_0xe82d('0x4'));var interaction=require(_0xe82d('0x5'));var config=require(_0xe82d('0x6'));var controller=require(_0xe82d('0x7'));router[_0xe82d('0x8')]('/',auth[_0xe82d('0x9')](),controller['index']);router[_0xe82d('0x8')](_0xe82d('0xa'),auth[_0xe82d('0x9')](),controller['show']);router['get'](_0xe82d('0xb'),auth[_0xe82d('0x9')](),controller[_0xe82d('0xc')]);router['get']('/:id/run',auth[_0xe82d('0x9')](),controller[_0xe82d('0xd')]);router[_0xe82d('0x8')](_0xe82d('0xe'),auth[_0xe82d('0x9')](),controller['query']);router[_0xe82d('0xf')]('/',auth[_0xe82d('0x9')](),controller[_0xe82d('0x10')]);router[_0xe82d('0x11')](_0xe82d('0xa'),auth[_0xe82d('0x9')](),controller[_0xe82d('0x12')]);router[_0xe82d('0x13')](_0xe82d('0xa'),auth['isAuthenticated'](),controller[_0xe82d('0x14')]);module[_0xe82d('0x15')]=router; \ No newline at end of file +var _0x3a2a=['index','/:id','show','/:id/preview','preview','/:id/run','run','query','put','update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a2a,0x1d9));var _0xa3a2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3a2a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xa3a2('0x0'));var util=require(_0xa3a2('0x1'));var path=require(_0xa3a2('0x2'));var timeout=require(_0xa3a2('0x3'));var express=require(_0xa3a2('0x4'));var router=express['Router']();var auth=require(_0xa3a2('0x5'));var interaction=require(_0xa3a2('0x6'));var config=require('../../config/environment');var controller=require(_0xa3a2('0x7'));router[_0xa3a2('0x8')]('/',auth[_0xa3a2('0x9')](),controller[_0xa3a2('0xa')]);router[_0xa3a2('0x8')](_0xa3a2('0xb'),auth['isAuthenticated'](),controller[_0xa3a2('0xc')]);router[_0xa3a2('0x8')](_0xa3a2('0xd'),auth[_0xa3a2('0x9')](),controller[_0xa3a2('0xe')]);router[_0xa3a2('0x8')](_0xa3a2('0xf'),auth[_0xa3a2('0x9')](),controller[_0xa3a2('0x10')]);router['get']('/:id/query',auth[_0xa3a2('0x9')](),controller[_0xa3a2('0x11')]);router['post']('/',auth[_0xa3a2('0x9')](),controller['create']);router[_0xa3a2('0x12')](_0xa3a2('0xb'),auth['isAuthenticated'](),controller[_0xa3a2('0x13')]);router['delete']('/:id',auth[_0xa3a2('0x9')](),controller[_0xa3a2('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 786c78f..52f26e9 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 _0xccdc=['UNSIGNED','moment','STRING','csv','xlsx','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x4682a1,_0x3d52d9){var _0x29f342=function(_0x17022f){while(--_0x17022f){_0x4682a1['push'](_0x4682a1['shift']());}};_0x29f342(++_0x3d52d9);}(_0xccdc,0x141));var _0xcccd=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xccdc[_0x15bc81];return _0x59440e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcccd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xcccd('0x1')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xcccd('0x2'),'pdf',_0xcccd('0x3')),'allowNull':![],'defaultValue':_0xcccd('0x2')},'savename':{'type':Sequelize[_0xcccd('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xcccd('0x4')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xcccd('0x1')],'defaultValue':_0xcccd('0x5')},'type':{'type':Sequelize['ENUM'](_0xcccd('0x6'),_0xcccd('0x7')),'allowNull':![],'defaultValue':_0xcccd('0x6')},'reportId':{'type':Sequelize[_0xcccd('0x8')](0xb)[_0xcccd('0x9')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc74b=['sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','scheduled','manual','INTEGER'];(function(_0xdf641d,_0x1d4cb7){var _0x2c3d56=function(_0x416bb9){while(--_0x416bb9){_0xdf641d['push'](_0xdf641d['shift']());}};_0x2c3d56(++_0x1d4cb7);}(_0xc74b,0x138));var _0xbc74=function(_0x562507,_0x40ffd0){_0x562507=_0x562507-0x0;var _0x1bc7f8=_0xc74b[_0x562507];return _0x1bc7f8;};'use strict';var Sequelize=require(_0xbc74('0x0'));var moment=require(_0xbc74('0x1'));module[_0xbc74('0x2')]={'name':{'type':Sequelize[_0xbc74('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xbc74('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xbc74('0x4')](_0xbc74('0x5'),_0xbc74('0x6'),_0xbc74('0x7')),'allowNull':![],'defaultValue':_0xbc74('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xbc74('0x8')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xbc74('0x3')],'defaultValue':_0xbc74('0x9')},'type':{'type':Sequelize[_0xbc74('0x4')]('manual',_0xbc74('0xa')),'allowNull':![],'defaultValue':_0xbc74('0xb')},'reportId':{'type':Sequelize[_0xbc74('0xc')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xbc74('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 77957e1..54a6c30 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 _0x666a=['%s.%s','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','get','ExtractedReports','UserProfileResource','end','name','AnalyticExtractedReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','root','format'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x666a,0x1e2));var _0xa666=function(_0x567b82,_0x3f1d98){_0x567b82=_0x567b82-0x0;var _0x576025=_0x666a[_0x567b82];return _0x576025;};'use strict';var pdf=require(_0xa666('0x0'));var emlformat=require(_0xa666('0x1'));var rimraf=require(_0xa666('0x2'));var zipdir=require(_0xa666('0x3'));var jsonpatch=require(_0xa666('0x4'));var rp=require(_0xa666('0x5'));var moment=require(_0xa666('0x6'));var BPromise=require(_0xa666('0x7'));var Mustache=require('mustache');var util=require(_0xa666('0x8'));var path=require('path');var sox=require(_0xa666('0x9'));var csv=require(_0xa666('0xa'));var ejs=require(_0xa666('0xb'));var fs=require('fs');var _=require(_0xa666('0xc'));var squel=require(_0xa666('0xd'));var crypto=require(_0xa666('0xe'));var jsforce=require(_0xa666('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa666('0xa'));var querystring=require(_0xa666('0x10'));var Papa=require(_0xa666('0x11'));var Redis=require(_0xa666('0x12'));var authService=require(_0xa666('0x13'));var qs=require(_0xa666('0x14'));var as=require(_0xa666('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa666('0x16'))(_0xa666('0x17'));var utils=require(_0xa666('0x18'));var config=require('../../config/environment');var db=require(_0xa666('0x19'))['db'];function respondWithStatusCode(_0x23f846,_0x284610){_0x284610=_0x284610||0xcc;return function(_0x4a96d4){if(_0x4a96d4){return _0x23f846[_0xa666('0x1a')](_0x284610);}return _0x23f846[_0xa666('0x1b')](_0x284610)['end']();};}function respondWithResult(_0x5e2435,_0x123562){_0x123562=_0x123562||0xc8;return function(_0x18e0dc){if(_0x18e0dc){return _0x5e2435[_0xa666('0x1b')](_0x123562)[_0xa666('0x1c')](_0x18e0dc);}};}function respondWithFilteredResult(_0x271c75,_0x1c9a20){return function(_0x4bd8dd){if(_0x4bd8dd){var _0x29e1b7=_0x4bd8dd[_0xa666('0x1d')],_0x365b55=_0x1c9a20[_0xa666('0x1e')],_0x49df3f=_0x1c9a20['offset']+_0x1c9a20[_0xa666('0x1f')],_0x3bcf4d;if(_0x49df3f>=_0x29e1b7){_0x49df3f=_0x29e1b7;_0x3bcf4d=0xc8;}else{_0x3bcf4d=0xce;}_0x271c75[_0xa666('0x1b')](_0x3bcf4d);return _0x271c75[_0xa666('0x20')](_0xa666('0x21'),_0x365b55+'-'+_0x49df3f+'/'+_0x29e1b7)['json'](_0x4bd8dd);}return null;};}function patchUpdates(_0x23be16){return function(_0x1dfeb2){try{jsonpatch['apply'](_0x1dfeb2,_0x23be16,!![]);}catch(_0x3a5d58){return BPromise[_0xa666('0x22')](_0x3a5d58);}return _0x1dfeb2[_0xa666('0x23')]();};}function saveUpdates(_0x15aaa3,_0x539cc8){return function(_0x3cffab){if(_0x3cffab){return _0x3cffab[_0xa666('0x24')](_0x15aaa3)['then'](function(_0xa64d2){return _0xa64d2;});}return null;};}function removeEntity(_0x5ccd4a,_0xc59b0){return function(_0x58a3d8){if(_0x58a3d8){return _0x58a3d8[_0xa666('0x25')]()[_0xa666('0x26')](function(){var _0x5d65f7=_0x58a3d8[_0xa666('0x27')]({'plain':!![]});var _0x148c20=_0xa666('0x28');return db[_0xa666('0x29')][_0xa666('0x25')]({'where':{'type':_0x148c20,'resourceId':_0x5d65f7['id']}})['then'](function(){return _0x58a3d8;});})['then'](function(){_0x5ccd4a['status'](0xcc)[_0xa666('0x2a')]();});}};}function handleEntityNotFound(_0x42bbb4,_0x2535c2){return function(_0x4f8da7){if(!_0x4f8da7){_0x42bbb4['sendStatus'](0x194);}return _0x4f8da7;};}function handleError(_0x542971,_0x5b5fdd){_0x5b5fdd=_0x5b5fdd||0x1f4;return function(_0x446eaf){logger['error'](_0x446eaf['stack']);if(_0x446eaf[_0xa666('0x2b')]){delete _0x446eaf[_0xa666('0x2b')];}_0x542971[_0xa666('0x1b')](_0x5b5fdd)['send'](_0x446eaf);};}exports['index']=function(_0x44920b,_0x3aadc5){var _0x32792c={},_0xd636b1={},_0x32dff2={'count':0x0,'rows':[]};var _0x585430=_['map'](db[_0xa666('0x2c')][_0xa666('0x2d')],function(_0x540320){return{'name':_0x540320[_0xa666('0x2e')],'type':_0x540320[_0xa666('0x2f')][_0xa666('0x30')]};});_0xd636b1['model']=_[_0xa666('0x31')](_0x585430,_0xa666('0x2b'));_0xd636b1[_0xa666('0x32')]=_['keys'](_0x44920b[_0xa666('0x32')]);_0xd636b1[_0xa666('0x33')]=_[_0xa666('0x34')](_0xd636b1['model'],_0xd636b1[_0xa666('0x32')]);_0x32792c[_0xa666('0x35')]=_['intersection'](_0xd636b1[_0xa666('0x36')],qs['fields'](_0x44920b[_0xa666('0x32')][_0xa666('0x37')]));_0x32792c['attributes']=_0x32792c[_0xa666('0x35')][_0xa666('0x38')]?_0x32792c[_0xa666('0x35')]:_0xd636b1[_0xa666('0x36')];if(!_0x44920b[_0xa666('0x32')][_0xa666('0x39')](_0xa666('0x3a'))){_0x32792c[_0xa666('0x1f')]=qs['limit'](_0x44920b[_0xa666('0x32')][_0xa666('0x1f')]);_0x32792c[_0xa666('0x1e')]=qs['offset'](_0x44920b[_0xa666('0x32')]['offset']);}_0x32792c['order']=qs[_0xa666('0x3b')](_0x44920b[_0xa666('0x32')][_0xa666('0x3b')]);_0x32792c[_0xa666('0x3c')]=qs['filters'](_[_0xa666('0x3d')](_0x44920b['query'],_0xd636b1[_0xa666('0x33')]));if(_0x44920b['query']['filter']){_0x32792c[_0xa666('0x3c')]=_['merge'](_0x32792c[_0xa666('0x3c')],{'$or':_[_0xa666('0x31')](_0x585430,function(_0x266fc2){if(_0x266fc2['type']!=='VIRTUAL'){var _0x3b5963={};_0x3b5963[_0x266fc2[_0xa666('0x2b')]]={'$like':'%'+_0x44920b[_0xa666('0x32')]['filter']+'%'};return _0x3b5963;}})});}_0x32792c=_[_0xa666('0x3e')]({},_0x32792c,_0x44920b[_0xa666('0x3f')]);var _0x213218={'where':_0x32792c[_0xa666('0x3c')]};return db[_0xa666('0x2c')]['count'](_0x213218)['then'](function(_0x331d53){_0x32dff2['count']=_0x331d53;if(_0x44920b[_0xa666('0x32')][_0xa666('0x40')]){_0x32792c[_0xa666('0x41')]=[{'all':!![]}];}return db[_0xa666('0x2c')][_0xa666('0x42')](_0x32792c);})[_0xa666('0x26')](function(_0x13a8b1){_0x32dff2[_0xa666('0x43')]=_0x13a8b1;return _0x32dff2;})[_0xa666('0x26')](respondWithFilteredResult(_0x3aadc5,_0x32792c))[_0xa666('0x44')](handleError(_0x3aadc5,null));};exports['show']=function(_0x3c614e,_0x24463a){var _0x2a9a80={'raw':!![],'where':{'id':_0x3c614e['params']['id']}},_0x49bd51={};_0x49bd51['model']=_['keys'](db[_0xa666('0x2c')][_0xa666('0x2d')]);_0x49bd51[_0xa666('0x32')]=_[_0xa666('0x45')](_0x3c614e[_0xa666('0x32')]);_0x49bd51[_0xa666('0x33')]=_['intersection'](_0x49bd51[_0xa666('0x36')],_0x49bd51[_0xa666('0x32')]);_0x2a9a80[_0xa666('0x35')]=_['intersection'](_0x49bd51[_0xa666('0x36')],qs[_0xa666('0x37')](_0x3c614e[_0xa666('0x32')]['fields']));_0x2a9a80[_0xa666('0x35')]=_0x2a9a80[_0xa666('0x35')][_0xa666('0x38')]?_0x2a9a80[_0xa666('0x35')]:_0x49bd51[_0xa666('0x36')];if(_0x3c614e[_0xa666('0x32')][_0xa666('0x40')]){_0x2a9a80[_0xa666('0x41')]=[{'all':!![]}];}_0x2a9a80=_[_0xa666('0x3e')]({},_0x2a9a80,_0x3c614e[_0xa666('0x3f')]);return db[_0xa666('0x2c')][_0xa666('0x46')](_0x2a9a80)[_0xa666('0x26')](handleEntityNotFound(_0x24463a,null))[_0xa666('0x26')](respondWithResult(_0x24463a,null))[_0xa666('0x44')](handleError(_0x24463a,null));};exports[_0xa666('0x47')]=function(_0x5dfdcb,_0x2ccd60){return db['AnalyticExtractedReport'][_0xa666('0x47')](_0x5dfdcb[_0xa666('0x48')],{})[_0xa666('0x26')](function(_0x59356b){var _0x9af94f=_0x5dfdcb[_0xa666('0x49')]['get']({'plain':!![]});if(!_0x9af94f)throw new Error(_0xa666('0x4a'));if(_0x9af94f[_0xa666('0x4b')]===_0xa666('0x49')){var _0x3451ac=_0x59356b['get']({'plain':!![]});var _0x54afdf=_0xa666('0x28');return db[_0xa666('0x4c')]['find']({'where':{'name':_0x54afdf,'userProfileId':_0x9af94f[_0xa666('0x4d')]},'raw':!![]})[_0xa666('0x26')](function(_0x813e16){if(_0x813e16&&_0x813e16[_0xa666('0x4e')]===0x0){return db[_0xa666('0x29')][_0xa666('0x47')]({'name':_0x3451ac['name'],'resourceId':_0x3451ac['id'],'type':_0x813e16[_0xa666('0x2b')],'sectionId':_0x813e16['id']},{})[_0xa666('0x26')](function(){return _0x59356b;});}else{return _0x59356b;}})[_0xa666('0x44')](function(_0x1bd820){logger[_0xa666('0x4f')](_0xa666('0x50'),_0x1bd820);throw _0x1bd820;});}return _0x59356b;})[_0xa666('0x26')](respondWithResult(_0x2ccd60,0xc9))[_0xa666('0x44')](handleError(_0x2ccd60,null));};exports[_0xa666('0x24')]=function(_0x418e26,_0x46b3f3){if(_0x418e26[_0xa666('0x48')]['id']){delete _0x418e26[_0xa666('0x48')]['id'];}return db[_0xa666('0x2c')][_0xa666('0x46')]({'where':{'id':_0x418e26[_0xa666('0x51')]['id']}})[_0xa666('0x26')](handleEntityNotFound(_0x46b3f3,null))[_0xa666('0x26')](saveUpdates(_0x418e26[_0xa666('0x48')],null))[_0xa666('0x26')](respondWithResult(_0x46b3f3,null))[_0xa666('0x44')](handleError(_0x46b3f3,null));};exports[_0xa666('0x25')]=function(_0x4d841b,_0x69ca82){return db[_0xa666('0x2c')]['find']({'where':{'id':_0x4d841b[_0xa666('0x51')]['id']}})[_0xa666('0x26')](handleEntityNotFound(_0x69ca82,null))[_0xa666('0x26')](removeEntity(_0x69ca82,null))[_0xa666('0x44')](handleError(_0x69ca82,null));};exports[_0xa666('0x52')]=function(_0x39f00e,_0x44ed3a,_0x233607){return db['AnalyticExtractedReport'][_0xa666('0x46')]({'where':{'id':_0x39f00e[_0xa666('0x51')]['id']},'attributes':['name',_0xa666('0x53'),_0xa666('0x54'),_0xa666('0x55')],'raw':!![]})[_0xa666('0x26')](handleEntityNotFound(_0x44ed3a,null))[_0xa666('0x26')](function(_0x5c7b9d){if(_0x5c7b9d){if(!fs[_0xa666('0x56')](path[_0xa666('0x57')](config['root'],_0xa666('0x58'),_0x5c7b9d['savename']))){throw new db[(_0xa666('0x59'))][(_0xa666('0x5a'))](_0xa666('0x5b'));}if(_0x39f00e[_0xa666('0x32')]['exists']){return _0x44ed3a[_0xa666('0x1a')](0xc8);}return _0x44ed3a[_0xa666('0x52')](path['join'](config[_0xa666('0x5c')],_0xa666('0x58'),_0x5c7b9d[_0xa666('0x54')]),util[_0xa666('0x5d')](_0xa666('0x5e'),_0x5c7b9d[_0xa666('0x53')]||_0x5c7b9d[_0xa666('0x2b')],_0x5c7b9d[_0xa666('0x55')][_0xa666('0x5f')]()));}})['catch'](handleError(_0x44ed3a,null));}; \ No newline at end of file +var _0x7cce=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','basename','savename','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation'];(function(_0x3b7c1a,_0x440dae){var _0x33a467=function(_0x301d83){while(--_0x301d83){_0x3b7c1a['push'](_0x3b7c1a['shift']());}};_0x33a467(++_0x440dae);}(_0x7cce,0x1f4));var _0xe7cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cce[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe7cc('0x0'));var rimraf=require(_0xe7cc('0x1'));var zipdir=require(_0xe7cc('0x2'));var jsonpatch=require(_0xe7cc('0x3'));var rp=require(_0xe7cc('0x4'));var moment=require(_0xe7cc('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe7cc('0x6'));var path=require(_0xe7cc('0x7'));var sox=require(_0xe7cc('0x8'));var csv=require(_0xe7cc('0x9'));var ejs=require(_0xe7cc('0xa'));var fs=require('fs');var _=require(_0xe7cc('0xb'));var squel=require(_0xe7cc('0xc'));var crypto=require(_0xe7cc('0xd'));var jsforce=require(_0xe7cc('0xe'));var deskjs=require(_0xe7cc('0xf'));var toCsv=require(_0xe7cc('0x9'));var querystring=require(_0xe7cc('0x10'));var Papa=require(_0xe7cc('0x11'));var Redis=require(_0xe7cc('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe7cc('0x13'));var hardwareService=require(_0xe7cc('0x14'));var logger=require(_0xe7cc('0x15'))(_0xe7cc('0x16'));var utils=require(_0xe7cc('0x17'));var config=require(_0xe7cc('0x18'));var db=require(_0xe7cc('0x19'))['db'];function respondWithStatusCode(_0xf3e979,_0x18e498){_0x18e498=_0x18e498||0xcc;return function(_0x3f466f){if(_0x3f466f){return _0xf3e979[_0xe7cc('0x1a')](_0x18e498);}return _0xf3e979[_0xe7cc('0x1b')](_0x18e498)['end']();};}function respondWithResult(_0x3d1411,_0x48ef66){_0x48ef66=_0x48ef66||0xc8;return function(_0x395f88){if(_0x395f88){return _0x3d1411[_0xe7cc('0x1b')](_0x48ef66)[_0xe7cc('0x1c')](_0x395f88);}};}function respondWithFilteredResult(_0x59bb17,_0x24fc23){return function(_0x141a6f){if(_0x141a6f){var _0x56ecfc=_0x141a6f[_0xe7cc('0x1d')],_0x59d84a=_0x24fc23[_0xe7cc('0x1e')],_0x415c2e=_0x24fc23[_0xe7cc('0x1e')]+_0x24fc23[_0xe7cc('0x1f')],_0x4c8041;if(_0x415c2e>=_0x56ecfc){_0x415c2e=_0x56ecfc;_0x4c8041=0xc8;}else{_0x4c8041=0xce;}_0x59bb17[_0xe7cc('0x1b')](_0x4c8041);return _0x59bb17[_0xe7cc('0x20')](_0xe7cc('0x21'),_0x59d84a+'-'+_0x415c2e+'/'+_0x56ecfc)[_0xe7cc('0x1c')](_0x141a6f);}return null;};}function patchUpdates(_0x4b2e4f){return function(_0x43e2cb){try{jsonpatch['apply'](_0x43e2cb,_0x4b2e4f,!![]);}catch(_0x46e042){return BPromise[_0xe7cc('0x22')](_0x46e042);}return _0x43e2cb['save']();};}function saveUpdates(_0x5b0cca,_0x585da1){return function(_0x1be2b4){if(_0x1be2b4){return _0x1be2b4[_0xe7cc('0x23')](_0x5b0cca)[_0xe7cc('0x24')](function(_0x2568aa){return _0x2568aa;});}return null;};}function removeEntity(_0x4c5105,_0x2a52eb){return function(_0x462d86){if(_0x462d86){return _0x462d86['destroy']()[_0xe7cc('0x24')](function(){var _0x232b2a=_0x462d86[_0xe7cc('0x25')]({'plain':!![]});var _0x5488a8='ExtractedReports';return db[_0xe7cc('0x26')][_0xe7cc('0x27')]({'where':{'type':_0x5488a8,'resourceId':_0x232b2a['id']}})['then'](function(){return _0x462d86;});})[_0xe7cc('0x24')](function(){_0x4c5105[_0xe7cc('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ae634,_0x2fa7ce){return function(_0x5aa34c){if(!_0x5aa34c){_0x4ae634['sendStatus'](0x194);}return _0x5aa34c;};}function handleError(_0x3435be,_0x117ac2){_0x117ac2=_0x117ac2||0x1f4;return function(_0x15dd05){logger[_0xe7cc('0x28')](_0x15dd05[_0xe7cc('0x29')]);if(_0x15dd05[_0xe7cc('0x2a')]){delete _0x15dd05[_0xe7cc('0x2a')];}_0x3435be[_0xe7cc('0x1b')](_0x117ac2)[_0xe7cc('0x2b')](_0x15dd05);};}exports[_0xe7cc('0x2c')]=function(_0x10586e,_0x5ad758){var _0xe6df0d={},_0x490bf1={},_0x47b4d8={'count':0x0,'rows':[]};var _0x32e230=_[_0xe7cc('0x2d')](db[_0xe7cc('0x2e')][_0xe7cc('0x2f')],function(_0xa95014){return{'name':_0xa95014[_0xe7cc('0x30')],'type':_0xa95014[_0xe7cc('0x31')][_0xe7cc('0x32')]};});_0x490bf1[_0xe7cc('0x33')]=_[_0xe7cc('0x2d')](_0x32e230,_0xe7cc('0x2a'));_0x490bf1[_0xe7cc('0x34')]=_[_0xe7cc('0x35')](_0x10586e[_0xe7cc('0x34')]);_0x490bf1[_0xe7cc('0x36')]=_[_0xe7cc('0x37')](_0x490bf1[_0xe7cc('0x33')],_0x490bf1[_0xe7cc('0x34')]);_0xe6df0d['attributes']=_[_0xe7cc('0x37')](_0x490bf1[_0xe7cc('0x33')],qs[_0xe7cc('0x38')](_0x10586e['query'][_0xe7cc('0x38')]));_0xe6df0d['attributes']=_0xe6df0d['attributes']['length']?_0xe6df0d[_0xe7cc('0x39')]:_0x490bf1[_0xe7cc('0x33')];if(!_0x10586e[_0xe7cc('0x34')]['hasOwnProperty'](_0xe7cc('0x3a'))){_0xe6df0d['limit']=qs[_0xe7cc('0x1f')](_0x10586e[_0xe7cc('0x34')][_0xe7cc('0x1f')]);_0xe6df0d[_0xe7cc('0x1e')]=qs[_0xe7cc('0x1e')](_0x10586e[_0xe7cc('0x34')][_0xe7cc('0x1e')]);}_0xe6df0d['order']=qs[_0xe7cc('0x3b')](_0x10586e[_0xe7cc('0x34')][_0xe7cc('0x3b')]);_0xe6df0d[_0xe7cc('0x3c')]=qs['filters'](_[_0xe7cc('0x3d')](_0x10586e[_0xe7cc('0x34')],_0x490bf1[_0xe7cc('0x36')]));if(_0x10586e[_0xe7cc('0x34')][_0xe7cc('0x3e')]){_0xe6df0d[_0xe7cc('0x3c')]=_[_0xe7cc('0x3f')](_0xe6df0d[_0xe7cc('0x3c')],{'$or':_[_0xe7cc('0x2d')](_0x32e230,function(_0x36e93e){if(_0x36e93e['type']!==_0xe7cc('0x40')){var _0x444746={};_0x444746[_0x36e93e['name']]={'$like':'%'+_0x10586e[_0xe7cc('0x34')][_0xe7cc('0x3e')]+'%'};return _0x444746;}})});}_0xe6df0d=_[_0xe7cc('0x3f')]({},_0xe6df0d,_0x10586e[_0xe7cc('0x41')]);var _0x355596={'where':_0xe6df0d['where']};return db[_0xe7cc('0x2e')]['count'](_0x355596)[_0xe7cc('0x24')](function(_0x6a9d09){_0x47b4d8[_0xe7cc('0x1d')]=_0x6a9d09;if(_0x10586e['query']['includeAll']){_0xe6df0d[_0xe7cc('0x42')]=[{'all':!![]}];}return db[_0xe7cc('0x2e')][_0xe7cc('0x43')](_0xe6df0d);})['then'](function(_0x5e4587){_0x47b4d8[_0xe7cc('0x44')]=_0x5e4587;return _0x47b4d8;})[_0xe7cc('0x24')](respondWithFilteredResult(_0x5ad758,_0xe6df0d))[_0xe7cc('0x45')](handleError(_0x5ad758,null));};exports[_0xe7cc('0x46')]=function(_0x408c51,_0x3a0937){var _0x976273={'raw':!![],'where':{'id':_0x408c51[_0xe7cc('0x47')]['id']}},_0xdceb54={};_0xdceb54[_0xe7cc('0x33')]=_[_0xe7cc('0x35')](db[_0xe7cc('0x2e')][_0xe7cc('0x2f')]);_0xdceb54[_0xe7cc('0x34')]=_[_0xe7cc('0x35')](_0x408c51['query']);_0xdceb54[_0xe7cc('0x36')]=_[_0xe7cc('0x37')](_0xdceb54[_0xe7cc('0x33')],_0xdceb54[_0xe7cc('0x34')]);_0x976273[_0xe7cc('0x39')]=_[_0xe7cc('0x37')](_0xdceb54['model'],qs[_0xe7cc('0x38')](_0x408c51[_0xe7cc('0x34')][_0xe7cc('0x38')]));_0x976273[_0xe7cc('0x39')]=_0x976273[_0xe7cc('0x39')][_0xe7cc('0x48')]?_0x976273[_0xe7cc('0x39')]:_0xdceb54['model'];if(_0x408c51[_0xe7cc('0x34')][_0xe7cc('0x49')]){_0x976273[_0xe7cc('0x42')]=[{'all':!![]}];}_0x976273=_[_0xe7cc('0x3f')]({},_0x976273,_0x408c51['options']);return db[_0xe7cc('0x2e')][_0xe7cc('0x4a')](_0x976273)[_0xe7cc('0x24')](handleEntityNotFound(_0x3a0937,null))[_0xe7cc('0x24')](respondWithResult(_0x3a0937,null))[_0xe7cc('0x45')](handleError(_0x3a0937,null));};exports['create']=function(_0x238e02,_0xac4f47){return db[_0xe7cc('0x2e')][_0xe7cc('0x4b')](_0x238e02['body'],{})['then'](function(_0x3bc979){var _0x4fdb44=_0x238e02[_0xe7cc('0x4c')]['get']({'plain':!![]});if(!_0x4fdb44)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fdb44[_0xe7cc('0x4d')]==='user'){var _0x4873ca=_0x3bc979[_0xe7cc('0x25')]({'plain':!![]});var _0x2df9ce=_0xe7cc('0x4e');return db[_0xe7cc('0x4f')][_0xe7cc('0x4a')]({'where':{'name':_0x2df9ce,'userProfileId':_0x4fdb44[_0xe7cc('0x50')]},'raw':!![]})[_0xe7cc('0x24')](function(_0x2ddfa3){if(_0x2ddfa3&&_0x2ddfa3[_0xe7cc('0x51')]===0x0){return db[_0xe7cc('0x26')][_0xe7cc('0x4b')]({'name':_0x4873ca[_0xe7cc('0x2a')],'resourceId':_0x4873ca['id'],'type':_0x2ddfa3['name'],'sectionId':_0x2ddfa3['id']},{})[_0xe7cc('0x24')](function(){return _0x3bc979;});}else{return _0x3bc979;}})[_0xe7cc('0x45')](function(_0x2119ce){logger[_0xe7cc('0x28')](_0xe7cc('0x52'),_0x2119ce);throw _0x2119ce;});}return _0x3bc979;})[_0xe7cc('0x24')](respondWithResult(_0xac4f47,0xc9))[_0xe7cc('0x45')](handleError(_0xac4f47,null));};exports[_0xe7cc('0x23')]=function(_0x28303b,_0x5a576f){if(_0x28303b[_0xe7cc('0x53')]['id']){delete _0x28303b[_0xe7cc('0x53')]['id'];}return db[_0xe7cc('0x2e')][_0xe7cc('0x4a')]({'where':{'id':_0x28303b[_0xe7cc('0x47')]['id']}})[_0xe7cc('0x24')](handleEntityNotFound(_0x5a576f,null))[_0xe7cc('0x24')](saveUpdates(_0x28303b[_0xe7cc('0x53')],null))['then'](respondWithResult(_0x5a576f,null))[_0xe7cc('0x45')](handleError(_0x5a576f,null));};exports[_0xe7cc('0x27')]=function(_0x3c84be,_0x4bde21){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x3c84be[_0xe7cc('0x47')]['id']}})[_0xe7cc('0x24')](handleEntityNotFound(_0x4bde21,null))[_0xe7cc('0x24')](removeEntity(_0x4bde21,null))[_0xe7cc('0x45')](handleError(_0x4bde21,null));};exports['download']=function(_0x1e279f,_0x35784c,_0x43af29){return db[_0xe7cc('0x2e')][_0xe7cc('0x4a')]({'where':{'id':_0x1e279f[_0xe7cc('0x47')]['id']},'attributes':['name',_0xe7cc('0x54'),_0xe7cc('0x55'),'output'],'raw':!![]})[_0xe7cc('0x24')](handleEntityNotFound(_0x35784c,null))[_0xe7cc('0x24')](function(_0x5191f7){if(_0x5191f7){if(!fs[_0xe7cc('0x56')](path[_0xe7cc('0x57')](config[_0xe7cc('0x58')],_0xe7cc('0x59'),_0x5191f7[_0xe7cc('0x55')]))){throw new db['Sequelize'][(_0xe7cc('0x5a'))](_0xe7cc('0x5b'));}if(_0x1e279f['query'][_0xe7cc('0x5c')]){return _0x35784c[_0xe7cc('0x1a')](0xc8);}return _0x35784c[_0xe7cc('0x5d')](path[_0xe7cc('0x57')](config[_0xe7cc('0x58')],'server/files/reports',_0x5191f7[_0xe7cc('0x55')]),util[_0xe7cc('0x5e')](_0xe7cc('0x5f'),_0x5191f7[_0xe7cc('0x54')]||_0x5191f7['name'],_0x5191f7['output'][_0xe7cc('0x60')]()));}})['catch'](handleError(_0x35784c,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 51b7b86..f00b8e7 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 _0xfdae=['AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdae,0xfe));var _0xefda=function(_0x25198d,_0x2145c8){_0x25198d=_0x25198d-0x0;var _0x3f9b10=_0xfdae[_0x25198d];return _0x3f9b10;};'use strict';var _=require(_0xefda('0x0'));var util=require(_0xefda('0x1'));var logger=require(_0xefda('0x2'))(_0xefda('0x3'));var moment=require(_0xefda('0x4'));var BPromise=require(_0xefda('0x5'));var rp=require(_0xefda('0x6'));var fs=require('fs');var path=require(_0xefda('0x7'));var rimraf=require(_0xefda('0x8'));var config=require(_0xefda('0x9'));var attributes=require('./analyticExtractedReport.attributes');module[_0xefda('0xa')]=function(_0x5cf7f0,_0x46d8e2){return _0x5cf7f0[_0xefda('0xb')](_0xefda('0xc'),attributes,{'tableName':_0xefda('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47b1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','analytics_extracted_reports','lodash','util','../../config/logger','api'];(function(_0x2e9780,_0x51e78b){var _0x4ed3cd=function(_0x49a0c9){while(--_0x49a0c9){_0x2e9780['push'](_0x2e9780['shift']());}};_0x4ed3cd(++_0x51e78b);}(_0x47b1,0xe6));var _0x147b=function(_0x1d5603,_0xf02205){_0x1d5603=_0x1d5603-0x0;var _0x2bb423=_0x47b1[_0x1d5603];return _0x2bb423;};'use strict';var _=require(_0x147b('0x0'));var util=require(_0x147b('0x1'));var logger=require(_0x147b('0x2'))(_0x147b('0x3'));var moment=require(_0x147b('0x4'));var BPromise=require(_0x147b('0x5'));var rp=require(_0x147b('0x6'));var fs=require('fs');var path=require(_0x147b('0x7'));var rimraf=require(_0x147b('0x8'));var config=require(_0x147b('0x9'));var attributes=require(_0x147b('0xa'));module[_0x147b('0xb')]=function(_0x212177,_0xa4c427){return _0x212177['define']('AnalyticExtractedReport',attributes,{'tableName':_0x147b('0xc'),'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 b960088..983ac21 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 _0x9b69=['../../config/environment','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3a56d7,_0x8efe26){var _0x2e93e0=function(_0x139697){while(--_0x139697){_0x3a56d7['push'](_0x3a56d7['shift']());}};_0x2e93e0(++_0x8efe26);}(_0x9b69,0x183));var _0x99b6=function(_0x6b9af3,_0x652cc5){_0x6b9af3=_0x6b9af3-0x0;var _0x421bfd=_0x9b69[_0x6b9af3];return _0x421bfd;};'use strict';var _=require(_0x99b6('0x0'));var util=require(_0x99b6('0x1'));var moment=require(_0x99b6('0x2'));var BPromise=require(_0x99b6('0x3'));var rs=require(_0x99b6('0x4'));var fs=require('fs');var Redis=require(_0x99b6('0x5'));var db=require(_0x99b6('0x6'))['db'];var utils=require(_0x99b6('0x7'));var logger=require('../../config/logger')(_0x99b6('0x8'));var config=require(_0x99b6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x99b6('0xa')][_0x99b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x286986,_0x53f72c,_0x460c5f){return new BPromise(function(_0xfdc87f,_0x7e529f){return client[_0x99b6('0xc')](_0x286986,_0x460c5f)[_0x99b6('0xd')](function(_0x46a00a){logger[_0x99b6('0xe')](_0x99b6('0xf'),_0x53f72c,_0x99b6('0x10'));logger[_0x99b6('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x53f72c,_0x99b6('0x10'),JSON[_0x99b6('0x12')](_0x46a00a));if(_0x46a00a[_0x99b6('0x13')]){if(_0x46a00a['error']['code']===0x1f4){logger['error'](_0x99b6('0xf'),_0x53f72c,_0x46a00a[_0x99b6('0x13')]['message']);return _0x7e529f(_0x46a00a['error'][_0x99b6('0x14')]);}logger[_0x99b6('0x13')](_0x99b6('0xf'),_0x53f72c,_0x46a00a[_0x99b6('0x13')][_0x99b6('0x14')]);return _0xfdc87f(_0x46a00a[_0x99b6('0x13')]['message']);}else{logger[_0x99b6('0xe')](_0x99b6('0xf'),_0x53f72c,_0x99b6('0x10'));_0xfdc87f(_0x46a00a[_0x99b6('0x15')][_0x99b6('0x14')]);}})['catch'](function(_0x182d25){logger[_0x99b6('0x13')](_0x99b6('0xf'),_0x53f72c,_0x182d25);_0x7e529f(_0x182d25);});});} \ No newline at end of file +var _0x7676=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x5df5e1,_0x3e0305){var _0x2fffd3=function(_0x532a7c){while(--_0x532a7c){_0x5df5e1['push'](_0x5df5e1['shift']());}};_0x2fffd3(++_0x3e0305);}(_0x7676,0x1b9));var _0x6767=function(_0x12902d,_0xaf93bc){_0x12902d=_0x12902d-0x0;var _0x1de616=_0x7676[_0x12902d];return _0x1de616;};'use strict';var _=require(_0x6767('0x0'));var util=require(_0x6767('0x1'));var moment=require(_0x6767('0x2'));var BPromise=require(_0x6767('0x3'));var rs=require(_0x6767('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6767('0x5'));var logger=require(_0x6767('0x6'))(_0x6767('0x7'));var config=require(_0x6767('0x8'));var jayson=require(_0x6767('0x9'));var client=jayson[_0x6767('0xa')][_0x6767('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3a26,_0x41887a,_0x2ee0a5){return new BPromise(function(_0x182cae,_0xf8b7d4){return client[_0x6767('0xc')](_0x1f3a26,_0x2ee0a5)['then'](function(_0x56fbc8){logger['info'](_0x6767('0xd'),_0x41887a,_0x6767('0xe'));logger['debug'](_0x6767('0xf'),_0x41887a,'request\x20sent',JSON['stringify'](_0x56fbc8));if(_0x56fbc8[_0x6767('0x10')]){if(_0x56fbc8['error'][_0x6767('0x11')]===0x1f4){logger[_0x6767('0x10')](_0x6767('0xd'),_0x41887a,_0x56fbc8[_0x6767('0x10')]['message']);return _0xf8b7d4(_0x56fbc8[_0x6767('0x10')][_0x6767('0x12')]);}logger[_0x6767('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x41887a,_0x56fbc8['error'][_0x6767('0x12')]);return _0x182cae(_0x56fbc8[_0x6767('0x10')][_0x6767('0x12')]);}else{logger['info'](_0x6767('0xd'),_0x41887a,_0x6767('0xe'));_0x182cae(_0x56fbc8[_0x6767('0x13')]['message']);}})[_0x6767('0x14')](function(_0x17eaef){logger[_0x6767('0x10')](_0x6767('0xd'),_0x41887a,_0x17eaef);_0xf8b7d4(_0x17eaef);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e42d49f..f0d74b0 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 _0x9e2d=['./analyticExtractedReport.controller','/:id','isAuthenticated','download','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../config/environment'];(function(_0x4a310d,_0x33322d){var _0x5eaf36=function(_0x233014){while(--_0x233014){_0x4a310d['push'](_0x4a310d['shift']());}};_0x5eaf36(++_0x33322d);}(_0x9e2d,0x16a));var _0xd9e2=function(_0x2d8235,_0x49ceb9){_0x2d8235=_0x2d8235-0x0;var _0x4dd54c=_0x9e2d[_0x2d8235];return _0x4dd54c;};'use strict';var multer=require(_0xd9e2('0x0'));var util=require(_0xd9e2('0x1'));var path=require(_0xd9e2('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9e2('0x3'));var router=express[_0xd9e2('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd9e2('0x5'));var controller=require(_0xd9e2('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd9e2('0x7'),auth[_0xd9e2('0x8')](),controller['show']);router['get']('/:id/download',auth[_0xd9e2('0x8')](),controller[_0xd9e2('0x9')]);router['post']('/',auth[_0xd9e2('0x8')](),controller[_0xd9e2('0xa')]);router[_0xd9e2('0xb')](_0xd9e2('0x7'),auth[_0xd9e2('0x8')](),controller[_0xd9e2('0xc')]);router[_0xd9e2('0xd')]('/:id',auth[_0xd9e2('0x8')](),controller[_0xd9e2('0xe')]);module[_0xd9e2('0xf')]=router; \ No newline at end of file +var _0x28b9=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','show','/:id/download','download','/:id'];(function(_0x514a8d,_0x5f04ed){var _0xceb41b=function(_0x5dd1ba){while(--_0x5dd1ba){_0x514a8d['push'](_0x514a8d['shift']());}};_0xceb41b(++_0x5f04ed);}(_0x28b9,0x180));var _0x928b=function(_0x3efe9b,_0x5b41a8){_0x3efe9b=_0x3efe9b-0x0;var _0x132073=_0x28b9[_0x3efe9b];return _0x132073;};'use strict';var multer=require(_0x928b('0x0'));var util=require(_0x928b('0x1'));var path=require(_0x928b('0x2'));var timeout=require(_0x928b('0x3'));var express=require(_0x928b('0x4'));var router=express[_0x928b('0x5')]();var auth=require(_0x928b('0x6'));var interaction=require(_0x928b('0x7'));var config=require(_0x928b('0x8'));var controller=require(_0x928b('0x9'));router[_0x928b('0xa')]('/',auth[_0x928b('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x928b('0xc')]);router[_0x928b('0xa')](_0x928b('0xd'),auth[_0x928b('0xb')](),controller[_0x928b('0xe')]);router['post']('/',auth[_0x928b('0xb')](),controller['create']);router['put'](_0x928b('0xf'),auth[_0x928b('0xb')](),controller[_0x928b('0x10')]);router[_0x928b('0x11')]('/:id',auth[_0x928b('0xb')](),controller[_0x928b('0x12')]);module[_0x928b('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 6e3735d..cf8f6b4 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x16dd19,_0x4e2c1a){var _0x163245=function(_0x290714){while(--_0x290714){_0x16dd19['push'](_0x16dd19['shift']());}};_0x163245(++_0x4e2c1a);}(_0x7217,0x19e));var _0x7721=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x7217[_0x18a79d];return _0x4f8848;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'field':{'type':Sequelize[_0x7721('0x1')]},'alias':{'type':Sequelize[_0x7721('0x2')]},'function':{'type':Sequelize[_0x7721('0x2')]},'format':{'type':Sequelize[_0x7721('0x2')]},'groupBy':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x814b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x505b9d,_0x14bcf4){var _0x491990=function(_0x4c544){while(--_0x4c544){_0x505b9d['push'](_0x505b9d['shift']());}};_0x491990(++_0x14bcf4);}(_0x814b,0x1a2));var _0xb814=function(_0x22889a,_0x4b75f7){_0x22889a=_0x22889a-0x0;var _0x763d34=_0x814b[_0x22889a];return _0x763d34;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'field':{'type':Sequelize[_0xb814('0x2')]},'alias':{'type':Sequelize[_0xb814('0x3')]},'function':{'type':Sequelize[_0xb814('0x3')]},'format':{'type':Sequelize[_0xb814('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb814('0x3')]},'custom':{'type':Sequelize[_0xb814('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 7147e2e..afbf624 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 _0xc029=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','send','index','map','AnalyticFieldReport','key','name','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','html-pdf'];(function(_0x381372,_0xf0a5a){var _0x4e959a=function(_0x25a897){while(--_0x25a897){_0x381372['push'](_0x381372['shift']());}};_0x4e959a(++_0xf0a5a);}(_0xc029,0x1df));var _0x9c02=function(_0x278d73,_0xb20d63){_0x278d73=_0x278d73-0x0;var _0x31ca5c=_0xc029[_0x278d73];return _0x31ca5c;};'use strict';var pdf=require(_0x9c02('0x0'));var emlformat=require(_0x9c02('0x1'));var rimraf=require(_0x9c02('0x2'));var zipdir=require(_0x9c02('0x3'));var jsonpatch=require(_0x9c02('0x4'));var rp=require(_0x9c02('0x5'));var moment=require(_0x9c02('0x6'));var BPromise=require(_0x9c02('0x7'));var Mustache=require(_0x9c02('0x8'));var util=require(_0x9c02('0x9'));var path=require(_0x9c02('0xa'));var sox=require(_0x9c02('0xb'));var csv=require(_0x9c02('0xc'));var ejs=require(_0x9c02('0xd'));var fs=require('fs');var _=require(_0x9c02('0xe'));var squel=require(_0x9c02('0xf'));var crypto=require(_0x9c02('0x10'));var jsforce=require(_0x9c02('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x9c02('0xc'));var querystring=require('querystring');var Papa=require(_0x9c02('0x12'));var Redis=require(_0x9c02('0x13'));var authService=require(_0x9c02('0x14'));var qs=require(_0x9c02('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c02('0x16'));var logger=require('../../config/logger')(_0x9c02('0x17'));var utils=require('../../config/utils');var config=require(_0x9c02('0x18'));var db=require(_0x9c02('0x19'))['db'];function respondWithStatusCode(_0x56086c,_0x90d45){_0x90d45=_0x90d45||0xcc;return function(_0x2190d9){if(_0x2190d9){return _0x56086c['sendStatus'](_0x90d45);}return _0x56086c[_0x9c02('0x1a')](_0x90d45)[_0x9c02('0x1b')]();};}function respondWithResult(_0x30677e,_0x531e65){_0x531e65=_0x531e65||0xc8;return function(_0x56bf05){if(_0x56bf05){return _0x30677e[_0x9c02('0x1a')](_0x531e65)[_0x9c02('0x1c')](_0x56bf05);}};}function respondWithFilteredResult(_0x1226e8,_0xcb970a){return function(_0x52b812){if(_0x52b812){var _0x456f4e=_0x52b812[_0x9c02('0x1d')],_0x38602c=_0xcb970a['offset'],_0xa6f21e=_0xcb970a[_0x9c02('0x1e')]+_0xcb970a[_0x9c02('0x1f')],_0x729f45;if(_0xa6f21e>=_0x456f4e){_0xa6f21e=_0x456f4e;_0x729f45=0xc8;}else{_0x729f45=0xce;}_0x1226e8[_0x9c02('0x1a')](_0x729f45);return _0x1226e8[_0x9c02('0x20')](_0x9c02('0x21'),_0x38602c+'-'+_0xa6f21e+'/'+_0x456f4e)[_0x9c02('0x1c')](_0x52b812);}return null;};}function patchUpdates(_0x592fed){return function(_0x1e9bea){try{jsonpatch[_0x9c02('0x22')](_0x1e9bea,_0x592fed,!![]);}catch(_0x2a3634){return BPromise[_0x9c02('0x23')](_0x2a3634);}return _0x1e9bea[_0x9c02('0x24')]();};}function saveUpdates(_0x36082e,_0x402d26){return function(_0x3f91f0){if(_0x3f91f0){return _0x3f91f0[_0x9c02('0x25')](_0x36082e)['then'](function(_0x54fdf4){return _0x54fdf4;});}return null;};}function removeEntity(_0x4ca166,_0x2c5a9c){return function(_0x4f8456){if(_0x4f8456){return _0x4f8456[_0x9c02('0x26')]()[_0x9c02('0x27')](function(){_0x4ca166[_0x9c02('0x1a')](0xcc)[_0x9c02('0x1b')]();});}};}function handleEntityNotFound(_0x12fd92,_0x37a9da){return function(_0x26cfdb){if(!_0x26cfdb){_0x12fd92[_0x9c02('0x28')](0x194);}return _0x26cfdb;};}function handleError(_0x4acbe0,_0xb89309){_0xb89309=_0xb89309||0x1f4;return function(_0x3e3da7){logger[_0x9c02('0x29')](_0x3e3da7['stack']);if(_0x3e3da7['name']){delete _0x3e3da7['name'];}_0x4acbe0['status'](_0xb89309)[_0x9c02('0x2a')](_0x3e3da7);};}exports[_0x9c02('0x2b')]=function(_0x205c36,_0x1b6a72){var _0xc40735={},_0x9d096={},_0x169416={'count':0x0,'rows':[]};var _0x201a63=_[_0x9c02('0x2c')](db[_0x9c02('0x2d')]['rawAttributes'],function(_0x157a7f){return{'name':_0x157a7f['fieldName'],'type':_0x157a7f['type'][_0x9c02('0x2e')]};});_0x9d096['model']=_[_0x9c02('0x2c')](_0x201a63,_0x9c02('0x2f'));_0x9d096[_0x9c02('0x30')]=_[_0x9c02('0x31')](_0x205c36[_0x9c02('0x30')]);_0x9d096['filters']=_[_0x9c02('0x32')](_0x9d096[_0x9c02('0x33')],_0x9d096[_0x9c02('0x30')]);_0xc40735[_0x9c02('0x34')]=_[_0x9c02('0x32')](_0x9d096[_0x9c02('0x33')],qs[_0x9c02('0x35')](_0x205c36[_0x9c02('0x30')][_0x9c02('0x35')]));_0xc40735[_0x9c02('0x34')]=_0xc40735[_0x9c02('0x34')][_0x9c02('0x36')]?_0xc40735[_0x9c02('0x34')]:_0x9d096[_0x9c02('0x33')];if(!_0x205c36[_0x9c02('0x30')]['hasOwnProperty']('nolimit')){_0xc40735['limit']=qs[_0x9c02('0x1f')](_0x205c36[_0x9c02('0x30')][_0x9c02('0x1f')]);_0xc40735[_0x9c02('0x1e')]=qs[_0x9c02('0x1e')](_0x205c36['query'][_0x9c02('0x1e')]);}_0xc40735[_0x9c02('0x37')]=qs[_0x9c02('0x38')](_0x205c36[_0x9c02('0x30')][_0x9c02('0x38')]);_0xc40735[_0x9c02('0x39')]=qs[_0x9c02('0x3a')](_['pick'](_0x205c36[_0x9c02('0x30')],_0x9d096[_0x9c02('0x3a')]));if(_0x205c36[_0x9c02('0x30')][_0x9c02('0x3b')]){_0xc40735[_0x9c02('0x39')]=_[_0x9c02('0x3c')](_0xc40735[_0x9c02('0x39')],{'$or':_[_0x9c02('0x2c')](_0x201a63,function(_0x1410fd){if(_0x1410fd[_0x9c02('0x3d')]!==_0x9c02('0x3e')){var _0xbe3818={};_0xbe3818[_0x1410fd[_0x9c02('0x2f')]]={'$like':'%'+_0x205c36[_0x9c02('0x30')][_0x9c02('0x3b')]+'%'};return _0xbe3818;}})});}_0xc40735=_[_0x9c02('0x3c')]({},_0xc40735,_0x205c36['options']);var _0x26e1ae={'where':_0xc40735[_0x9c02('0x39')]};return db[_0x9c02('0x2d')][_0x9c02('0x1d')](_0x26e1ae)[_0x9c02('0x27')](function(_0x4106c7){_0x169416[_0x9c02('0x1d')]=_0x4106c7;if(_0x205c36['query'][_0x9c02('0x3f')]){_0xc40735[_0x9c02('0x40')]=[{'all':!![]}];}return db[_0x9c02('0x2d')][_0x9c02('0x41')](_0xc40735);})[_0x9c02('0x27')](function(_0x4eb5f7){_0x169416[_0x9c02('0x42')]=_0x4eb5f7;return _0x169416;})[_0x9c02('0x27')](respondWithFilteredResult(_0x1b6a72,_0xc40735))[_0x9c02('0x43')](handleError(_0x1b6a72,null));};exports[_0x9c02('0x44')]=function(_0x24212e,_0x403d47){var _0x16c6c6={'raw':![],'where':{'id':_0x24212e[_0x9c02('0x45')]['id']}},_0x2bde7d={};_0x2bde7d[_0x9c02('0x33')]=_[_0x9c02('0x31')](db[_0x9c02('0x2d')]['rawAttributes']);_0x2bde7d[_0x9c02('0x30')]=_[_0x9c02('0x31')](_0x24212e[_0x9c02('0x30')]);_0x2bde7d['filters']=_['intersection'](_0x2bde7d[_0x9c02('0x33')],_0x2bde7d[_0x9c02('0x30')]);_0x16c6c6['attributes']=_['intersection'](_0x2bde7d[_0x9c02('0x33')],qs[_0x9c02('0x35')](_0x24212e['query']['fields']));_0x16c6c6['attributes']=_0x16c6c6[_0x9c02('0x34')][_0x9c02('0x36')]?_0x16c6c6[_0x9c02('0x34')]:_0x2bde7d['model'];if(_0x24212e[_0x9c02('0x30')][_0x9c02('0x3f')]){_0x16c6c6['include']=[{'all':!![]}];}_0x16c6c6=_[_0x9c02('0x3c')]({},_0x16c6c6,_0x24212e['options']);return db[_0x9c02('0x2d')][_0x9c02('0x46')](_0x16c6c6)[_0x9c02('0x27')](handleEntityNotFound(_0x403d47,null))['then'](respondWithResult(_0x403d47,null))[_0x9c02('0x43')](handleError(_0x403d47,null));};exports['create']=function(_0x42f5da,_0x5dff57){return db['AnalyticFieldReport'][_0x9c02('0x47')](_0x42f5da[_0x9c02('0x48')],{})[_0x9c02('0x27')](respondWithResult(_0x5dff57,0xc9))[_0x9c02('0x43')](handleError(_0x5dff57,null));};exports[_0x9c02('0x49')]=function(_0x4185d7,_0x52b99c){return db['AnalyticFieldReport'][_0x9c02('0x49')](_0x4185d7[_0x9c02('0x48')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x52b99c,0xc9))[_0x9c02('0x43')](handleError(_0x52b99c,null));};exports['update']=function(_0x222190,_0x31b3d9){if(_0x222190['body']['id']){delete _0x222190[_0x9c02('0x48')]['id'];}return db['AnalyticFieldReport'][_0x9c02('0x46')]({'where':{'id':_0x222190['params']['id']}})[_0x9c02('0x27')](handleEntityNotFound(_0x31b3d9,null))[_0x9c02('0x27')](saveUpdates(_0x222190[_0x9c02('0x48')],null))[_0x9c02('0x27')](respondWithResult(_0x31b3d9,null))[_0x9c02('0x43')](handleError(_0x31b3d9,null));};exports[_0x9c02('0x26')]=function(_0x30b447,_0x5a7262){return db[_0x9c02('0x2d')]['find']({'where':{'id':_0x30b447[_0x9c02('0x45')]['id']}})[_0x9c02('0x27')](handleEntityNotFound(_0x5a7262,null))[_0x9c02('0x27')](removeEntity(_0x5a7262,null))[_0x9c02('0x43')](handleError(_0x5a7262,null));};exports[_0x9c02('0x4a')]=function(_0x317257,_0xfa493b){return db[_0x9c02('0x2d')][_0x9c02('0x26')]({'where':{'id':_0x317257[_0x9c02('0x30')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x9c02('0x27')](respondWithResult(_0xfa493b,0xcc))[_0x9c02('0x43')](handleError(_0xfa493b,null));};exports[_0x9c02('0x4b')]=function(_0x31b7f5,_0x122166,_0xf02a7){return db[_0x9c02('0x4c')][_0x9c02('0x4d')]({'where':{'id':_0x31b7f5[_0x9c02('0x45')]['id']}})['then'](handleEntityNotFound(_0x122166,null))[_0x9c02('0x27')](function(_0x41544a){if(_0x41544a){return db[_0x9c02('0x4e')]['transaction'](function(_0x2a5cf4){return db[_0x9c02('0x2d')][_0x9c02('0x26')]({'where':{'CustomReportId':_0x31b7f5['params']['id']},'transaction':_0x2a5cf4})[_0x9c02('0x27')](function(_0x358df5){var _0x2e7a18=_[_0x9c02('0x2c')](_0x31b7f5[_0x9c02('0x48')],function(_0x4b1790){delete _0x4b1790['id'];_0x4b1790[_0x9c02('0x4f')]=_0x31b7f5[_0x9c02('0x45')]['id'];return _0x4b1790;});return db[_0x9c02('0x2d')]['bulkCreate'](_0x2e7a18,{'transaction':_0x2a5cf4});});})[_0x9c02('0x27')](function(){return db[_0x9c02('0x2d')][_0x9c02('0x41')]({'where':{'CustomReportId':_0x31b7f5[_0x9c02('0x45')]['id']}});});}})[_0x9c02('0x27')](respondWithResult(_0x122166,null))[_0x9c02('0x43')](handleError(_0x122166,null));}; \ No newline at end of file +var _0x5ae9=['fields','length','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','keys','options','create','body','find','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','params','bulkCreate','html-pdf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','count','offset','limit','set','json','apply','update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','type','key','model','filters','intersection','attributes'];(function(_0x22d4f0,_0x23edba){var _0x453942=function(_0x4d7a9b){while(--_0x4d7a9b){_0x22d4f0['push'](_0x22d4f0['shift']());}};_0x453942(++_0x23edba);}(_0x5ae9,0x19b));var _0x95ae=function(_0x4fd75e,_0x219e4a){_0x4fd75e=_0x4fd75e-0x0;var _0x5b6338=_0x5ae9[_0x4fd75e];return _0x5b6338;};'use strict';var pdf=require(_0x95ae('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x95ae('0x1'));var jsonpatch=require(_0x95ae('0x2'));var rp=require('request-promise');var moment=require(_0x95ae('0x3'));var BPromise=require(_0x95ae('0x4'));var Mustache=require('mustache');var util=require(_0x95ae('0x5'));var path=require('path');var sox=require(_0x95ae('0x6'));var csv=require(_0x95ae('0x7'));var ejs=require(_0x95ae('0x8'));var fs=require('fs');var _=require(_0x95ae('0x9'));var squel=require(_0x95ae('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x95ae('0xb'));var toCsv=require(_0x95ae('0x7'));var querystring=require(_0x95ae('0xc'));var Papa=require(_0x95ae('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x95ae('0xe'));var as=require(_0x95ae('0xf'));var hardwareService=require(_0x95ae('0x10'));var logger=require(_0x95ae('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x95ae('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x119b2d,_0x2a9b87){_0x2a9b87=_0x2a9b87||0xcc;return function(_0x530bb8){if(_0x530bb8){return _0x119b2d[_0x95ae('0x13')](_0x2a9b87);}return _0x119b2d[_0x95ae('0x14')](_0x2a9b87)[_0x95ae('0x15')]();};}function respondWithResult(_0x4e3050,_0x4685a4){_0x4685a4=_0x4685a4||0xc8;return function(_0x3af218){if(_0x3af218){return _0x4e3050[_0x95ae('0x14')](_0x4685a4)['json'](_0x3af218);}};}function respondWithFilteredResult(_0x1bc94f,_0x5ebbb7){return function(_0x210e00){if(_0x210e00){var _0x57bd67=_0x210e00[_0x95ae('0x16')],_0x2594fe=_0x5ebbb7[_0x95ae('0x17')],_0x194337=_0x5ebbb7[_0x95ae('0x17')]+_0x5ebbb7[_0x95ae('0x18')],_0x3fc518;if(_0x194337>=_0x57bd67){_0x194337=_0x57bd67;_0x3fc518=0xc8;}else{_0x3fc518=0xce;}_0x1bc94f[_0x95ae('0x14')](_0x3fc518);return _0x1bc94f[_0x95ae('0x19')]('Content-Range',_0x2594fe+'-'+_0x194337+'/'+_0x57bd67)[_0x95ae('0x1a')](_0x210e00);}return null;};}function patchUpdates(_0x23cb10){return function(_0x538552){try{jsonpatch[_0x95ae('0x1b')](_0x538552,_0x23cb10,!![]);}catch(_0x13d7a7){return BPromise['reject'](_0x13d7a7);}return _0x538552['save']();};}function saveUpdates(_0x2649c4,_0x16aa0c){return function(_0x1359a8){if(_0x1359a8){return _0x1359a8[_0x95ae('0x1c')](_0x2649c4)[_0x95ae('0x1d')](function(_0x530ca6){return _0x530ca6;});}return null;};}function removeEntity(_0x37d0be,_0x457324){return function(_0x1ecde4){if(_0x1ecde4){return _0x1ecde4[_0x95ae('0x1e')]()['then'](function(){_0x37d0be[_0x95ae('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7fd81f,_0x59f88a){return function(_0x2b46c5){if(!_0x2b46c5){_0x7fd81f[_0x95ae('0x13')](0x194);}return _0x2b46c5;};}function handleError(_0x198427,_0x4990f8){_0x4990f8=_0x4990f8||0x1f4;return function(_0xdc8e7e){logger[_0x95ae('0x1f')](_0xdc8e7e[_0x95ae('0x20')]);if(_0xdc8e7e[_0x95ae('0x21')]){delete _0xdc8e7e[_0x95ae('0x21')];}_0x198427['status'](_0x4990f8)[_0x95ae('0x22')](_0xdc8e7e);};}exports[_0x95ae('0x23')]=function(_0x1cfaf7,_0x23d006){var _0x3a3cd6={},_0x51ba5d={},_0x46b590={'count':0x0,'rows':[]};var _0x4d1708=_[_0x95ae('0x24')](db[_0x95ae('0x25')][_0x95ae('0x26')],function(_0x424e0f){return{'name':_0x424e0f['fieldName'],'type':_0x424e0f[_0x95ae('0x27')][_0x95ae('0x28')]};});_0x51ba5d[_0x95ae('0x29')]=_['map'](_0x4d1708,_0x95ae('0x21'));_0x51ba5d['query']=_['keys'](_0x1cfaf7['query']);_0x51ba5d[_0x95ae('0x2a')]=_[_0x95ae('0x2b')](_0x51ba5d[_0x95ae('0x29')],_0x51ba5d['query']);_0x3a3cd6[_0x95ae('0x2c')]=_['intersection'](_0x51ba5d[_0x95ae('0x29')],qs[_0x95ae('0x2d')](_0x1cfaf7['query'][_0x95ae('0x2d')]));_0x3a3cd6['attributes']=_0x3a3cd6[_0x95ae('0x2c')][_0x95ae('0x2e')]?_0x3a3cd6['attributes']:_0x51ba5d[_0x95ae('0x29')];if(!_0x1cfaf7[_0x95ae('0x2f')][_0x95ae('0x30')](_0x95ae('0x31'))){_0x3a3cd6[_0x95ae('0x18')]=qs[_0x95ae('0x18')](_0x1cfaf7[_0x95ae('0x2f')]['limit']);_0x3a3cd6['offset']=qs[_0x95ae('0x17')](_0x1cfaf7[_0x95ae('0x2f')][_0x95ae('0x17')]);}_0x3a3cd6[_0x95ae('0x32')]=qs[_0x95ae('0x33')](_0x1cfaf7['query'][_0x95ae('0x33')]);_0x3a3cd6[_0x95ae('0x34')]=qs[_0x95ae('0x2a')](_[_0x95ae('0x35')](_0x1cfaf7[_0x95ae('0x2f')],_0x51ba5d[_0x95ae('0x2a')]));if(_0x1cfaf7['query'][_0x95ae('0x36')]){_0x3a3cd6[_0x95ae('0x34')]=_[_0x95ae('0x37')](_0x3a3cd6[_0x95ae('0x34')],{'$or':_['map'](_0x4d1708,function(_0x20a0cc){if(_0x20a0cc['type']!==_0x95ae('0x38')){var _0x171e99={};_0x171e99[_0x20a0cc[_0x95ae('0x21')]]={'$like':'%'+_0x1cfaf7[_0x95ae('0x2f')][_0x95ae('0x36')]+'%'};return _0x171e99;}})});}_0x3a3cd6=_[_0x95ae('0x37')]({},_0x3a3cd6,_0x1cfaf7['options']);var _0x23b350={'where':_0x3a3cd6[_0x95ae('0x34')]};return db['AnalyticFieldReport']['count'](_0x23b350)[_0x95ae('0x1d')](function(_0x2209c9){_0x46b590[_0x95ae('0x16')]=_0x2209c9;if(_0x1cfaf7['query'][_0x95ae('0x39')]){_0x3a3cd6[_0x95ae('0x3a')]=[{'all':!![]}];}return db[_0x95ae('0x25')][_0x95ae('0x3b')](_0x3a3cd6);})[_0x95ae('0x1d')](function(_0x38b5f8){_0x46b590['rows']=_0x38b5f8;return _0x46b590;})[_0x95ae('0x1d')](respondWithFilteredResult(_0x23d006,_0x3a3cd6))[_0x95ae('0x3c')](handleError(_0x23d006,null));};exports[_0x95ae('0x3d')]=function(_0x165216,_0x198350){var _0xf41d5b={'raw':![],'where':{'id':_0x165216['params']['id']}},_0xa2df5d={};_0xa2df5d[_0x95ae('0x29')]=_[_0x95ae('0x3e')](db[_0x95ae('0x25')][_0x95ae('0x26')]);_0xa2df5d[_0x95ae('0x2f')]=_['keys'](_0x165216['query']);_0xa2df5d[_0x95ae('0x2a')]=_[_0x95ae('0x2b')](_0xa2df5d[_0x95ae('0x29')],_0xa2df5d[_0x95ae('0x2f')]);_0xf41d5b['attributes']=_['intersection'](_0xa2df5d['model'],qs[_0x95ae('0x2d')](_0x165216['query']['fields']));_0xf41d5b[_0x95ae('0x2c')]=_0xf41d5b[_0x95ae('0x2c')]['length']?_0xf41d5b[_0x95ae('0x2c')]:_0xa2df5d[_0x95ae('0x29')];if(_0x165216[_0x95ae('0x2f')][_0x95ae('0x39')]){_0xf41d5b['include']=[{'all':!![]}];}_0xf41d5b=_[_0x95ae('0x37')]({},_0xf41d5b,_0x165216[_0x95ae('0x3f')]);return db[_0x95ae('0x25')]['find'](_0xf41d5b)[_0x95ae('0x1d')](handleEntityNotFound(_0x198350,null))[_0x95ae('0x1d')](respondWithResult(_0x198350,null))[_0x95ae('0x3c')](handleError(_0x198350,null));};exports[_0x95ae('0x40')]=function(_0x3325c9,_0x1fb95c){return db[_0x95ae('0x25')][_0x95ae('0x40')](_0x3325c9[_0x95ae('0x41')],{})['then'](respondWithResult(_0x1fb95c,0xc9))[_0x95ae('0x3c')](handleError(_0x1fb95c,null));};exports['bulkCreate']=function(_0x41cec7,_0x16e6a9){return db[_0x95ae('0x25')]['bulkCreate'](_0x41cec7[_0x95ae('0x41')],{'raw':![],'individualHooks':!![]})[_0x95ae('0x1d')](respondWithResult(_0x16e6a9,0xc9))['catch'](handleError(_0x16e6a9,null));};exports[_0x95ae('0x1c')]=function(_0x468620,_0x49a875){if(_0x468620[_0x95ae('0x41')]['id']){delete _0x468620[_0x95ae('0x41')]['id'];}return db['AnalyticFieldReport'][_0x95ae('0x42')]({'where':{'id':_0x468620['params']['id']}})[_0x95ae('0x1d')](handleEntityNotFound(_0x49a875,null))[_0x95ae('0x1d')](saveUpdates(_0x468620[_0x95ae('0x41')],null))['then'](respondWithResult(_0x49a875,null))[_0x95ae('0x3c')](handleError(_0x49a875,null));};exports[_0x95ae('0x1e')]=function(_0x5322b1,_0xcae893){return db[_0x95ae('0x25')]['find']({'where':{'id':_0x5322b1['params']['id']}})[_0x95ae('0x1d')](handleEntityNotFound(_0xcae893,null))[_0x95ae('0x1d')](removeEntity(_0xcae893,null))['catch'](handleError(_0xcae893,null));};exports['bulkDestroy']=function(_0x5e7744,_0x2e1e53){return db[_0x95ae('0x25')][_0x95ae('0x1e')]({'where':{'id':_0x5e7744[_0x95ae('0x2f')][_0x95ae('0x43')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2e1e53,0xcc))[_0x95ae('0x3c')](handleError(_0x2e1e53,null));};exports[_0x95ae('0x44')]=function(_0x37db27,_0x3cd364,_0x5ca748){return db[_0x95ae('0x45')][_0x95ae('0x46')]({'where':{'id':_0x37db27['params']['id']}})[_0x95ae('0x1d')](handleEntityNotFound(_0x3cd364,null))['then'](function(_0x529683){if(_0x529683){return db[_0x95ae('0x47')][_0x95ae('0x48')](function(_0x54557f){return db[_0x95ae('0x25')][_0x95ae('0x1e')]({'where':{'CustomReportId':_0x37db27['params']['id']},'transaction':_0x54557f})[_0x95ae('0x1d')](function(_0x3b7562){var _0x4dbe2b=_[_0x95ae('0x24')](_0x37db27['body'],function(_0x3f988e){delete _0x3f988e['id'];_0x3f988e[_0x95ae('0x49')]=_0x37db27[_0x95ae('0x4a')]['id'];return _0x3f988e;});return db['AnalyticFieldReport'][_0x95ae('0x4b')](_0x4dbe2b,{'transaction':_0x54557f});});})[_0x95ae('0x1d')](function(){return db[_0x95ae('0x25')][_0x95ae('0x3b')]({'where':{'CustomReportId':_0x37db27['params']['id']}});});}})['then'](respondWithResult(_0x3cd364,null))[_0x95ae('0x3c')](handleError(_0x3cd364,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 0b65fdf..e75ab32 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 _0xa5bc=['define','AnalyticFieldReport','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0xa5bc,0x77));var _0xca5b=function(_0x48a326,_0x4cf645){_0x48a326=_0x48a326-0x0;var _0x22a0a3=_0xa5bc[_0x48a326];return _0x22a0a3;};'use strict';var _=require(_0xca5b('0x0'));var util=require(_0xca5b('0x1'));var logger=require(_0xca5b('0x2'))(_0xca5b('0x3'));var moment=require(_0xca5b('0x4'));var BPromise=require('bluebird');var rp=require(_0xca5b('0x5'));var fs=require('fs');var path=require(_0xca5b('0x6'));var rimraf=require(_0xca5b('0x7'));var config=require(_0xca5b('0x8'));var attributes=require(_0xca5b('0x9'));module[_0xca5b('0xa')]=function(_0x51bbcb,_0x3d5e04){return _0x51bbcb[_0xca5b('0xb')](_0xca5b('0xc'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ed5=['util','api','bluebird','request-promise','./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x3ed5,0x19d));var _0x53ed=function(_0x4bdb25,_0x94a3aa){_0x4bdb25=_0x4bdb25-0x0;var _0x5bff73=_0x3ed5[_0x4bdb25];return _0x5bff73;};'use strict';var _=require(_0x53ed('0x0'));var util=require(_0x53ed('0x1'));var logger=require('../../config/logger')(_0x53ed('0x2'));var moment=require('moment');var BPromise=require(_0x53ed('0x3'));var rp=require(_0x53ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x53ed('0x5'));module[_0x53ed('0x6')]=function(_0xa745d,_0x481062){return _0xa745d[_0x53ed('0x7')]('AnalyticFieldReport',attributes,{'tableName':_0x53ed('0x8'),'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 038e462..3ad8f6a 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 _0x06af=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0x453d74,_0x2dd33b){var _0x2a641a=function(_0x21601c){while(--_0x21601c){_0x453d74['push'](_0x453d74['shift']());}};_0x2a641a(++_0x2dd33b);}(_0x06af,0xbd));var _0xf06a=function(_0x53bf5f,_0x55f0b8){_0x53bf5f=_0x53bf5f-0x0;var _0x5c3a4d=_0x06af[_0x53bf5f];return _0x5c3a4d;};'use strict';var _=require(_0xf06a('0x0'));var util=require(_0xf06a('0x1'));var moment=require('moment');var BPromise=require(_0xf06a('0x2'));var rs=require(_0xf06a('0x3'));var fs=require('fs');var Redis=require(_0xf06a('0x4'));var db=require(_0xf06a('0x5'))['db'];var utils=require(_0xf06a('0x6'));var logger=require(_0xf06a('0x7'))('rpc');var config=require(_0xf06a('0x8'));var jayson=require(_0xf06a('0x9'));var client=jayson[_0xf06a('0xa')][_0xf06a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47c47a,_0xcca5b9,_0x31b3bb){return new BPromise(function(_0x2a1bab,_0x28c2f9){return client['request'](_0x47c47a,_0x31b3bb)[_0xf06a('0xc')](function(_0x10a19e){logger[_0xf06a('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0xcca5b9,_0xf06a('0xe'));logger[_0xf06a('0xf')](_0xf06a('0x10'),_0xcca5b9,_0xf06a('0xe'),JSON[_0xf06a('0x11')](_0x10a19e));if(_0x10a19e['error']){if(_0x10a19e[_0xf06a('0x12')][_0xf06a('0x13')]===0x1f4){logger[_0xf06a('0x12')](_0xf06a('0x14'),_0xcca5b9,_0x10a19e[_0xf06a('0x12')][_0xf06a('0x15')]);return _0x28c2f9(_0x10a19e[_0xf06a('0x12')]['message']);}logger[_0xf06a('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0xcca5b9,_0x10a19e[_0xf06a('0x12')][_0xf06a('0x15')]);return _0x2a1bab(_0x10a19e[_0xf06a('0x12')][_0xf06a('0x15')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0xcca5b9,_0xf06a('0xe'));_0x2a1bab(_0x10a19e[_0xf06a('0x16')]['message']);}})[_0xf06a('0x17')](function(_0x4d39ee){logger[_0xf06a('0x12')](_0xf06a('0x14'),_0xcca5b9,_0x4d39ee);_0x28c2f9(_0x4d39ee);});});} \ No newline at end of file +var _0xcdaa=['client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x53056c,_0x1d56a9){var _0x5cec88=function(_0x2ad06b){while(--_0x2ad06b){_0x53056c['push'](_0x53056c['shift']());}};_0x5cec88(++_0x1d56a9);}(_0xcdaa,0x89));var _0xacda=function(_0x5cf0ec,_0x3541f9){_0x5cf0ec=_0x5cf0ec-0x0;var _0x5990f0=_0xcdaa[_0x5cf0ec];return _0x5990f0;};'use strict';var _=require(_0xacda('0x0'));var util=require(_0xacda('0x1'));var moment=require(_0xacda('0x2'));var BPromise=require(_0xacda('0x3'));var rs=require(_0xacda('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xacda('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xacda('0x6'))(_0xacda('0x7'));var config=require(_0xacda('0x8'));var jayson=require(_0xacda('0x9'));var client=jayson[_0xacda('0xa')][_0xacda('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50be78,_0x1fadb7,_0x41d001){return new BPromise(function(_0x452bf0,_0x1f0c1a){return client[_0xacda('0xc')](_0x50be78,_0x41d001)['then'](function(_0x34b23e){logger[_0xacda('0xd')](_0xacda('0xe'),_0x1fadb7,_0xacda('0xf'));logger[_0xacda('0x10')](_0xacda('0x11'),_0x1fadb7,_0xacda('0xf'),JSON['stringify'](_0x34b23e));if(_0x34b23e[_0xacda('0x12')]){if(_0x34b23e['error'][_0xacda('0x13')]===0x1f4){logger['error'](_0xacda('0xe'),_0x1fadb7,_0x34b23e[_0xacda('0x12')][_0xacda('0x14')]);return _0x1f0c1a(_0x34b23e[_0xacda('0x12')]['message']);}logger[_0xacda('0x12')](_0xacda('0xe'),_0x1fadb7,_0x34b23e[_0xacda('0x12')]['message']);return _0x452bf0(_0x34b23e['error']['message']);}else{logger[_0xacda('0xd')](_0xacda('0xe'),_0x1fadb7,_0xacda('0xf'));_0x452bf0(_0x34b23e['result'][_0xacda('0x14')]);}})['catch'](function(_0x708fb3){logger['error'](_0xacda('0xe'),_0x1fadb7,_0x708fb3);_0x1f0c1a(_0x708fb3);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 0a62855..cc1273c 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['/:id/create_many','addFields','put','update','delete','bulkDestroy','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','bulkCreate'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x55ca,0x126));var _0xa55c=function(_0x3e8d78,_0xef4524){_0x3e8d78=_0x3e8d78-0x0;var _0x50532d=_0x55ca[_0x3e8d78];return _0x50532d;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0xb')]('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xb')]('/create_many',auth['isAuthenticated'](),controller[_0xa55c('0xd')]);router[_0xa55c('0xb')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x10')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/destroy_many',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file +var _0x55ca=['/:id/create_many','addFields','put','update','delete','bulkDestroy','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','bulkCreate'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x55ca,0x126));var _0xa55c=function(_0x21d7a2,_0x5aecda){_0x21d7a2=_0x21d7a2-0x0;var _0x1da981=_0x55ca[_0x21d7a2];return _0x1da981;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0xb')]('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xb')]('/create_many',auth['isAuthenticated'](),controller[_0xa55c('0xd')]);router[_0xa55c('0xb')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x10')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/destroy_many',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index e8c281a..0afb988 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 _0xd959=['exports','STRING','name','TEXT','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd959,0x1f3));var _0x9d95=function(_0x222138,_0x48c75e){_0x222138=_0x222138-0x0;var _0x2cbbe0=_0xd959[_0x222138];return _0x2cbbe0;};'use strict';var Sequelize=require(_0x9d95('0x0'));module[_0x9d95('0x1')]={'name':{'type':Sequelize[_0x9d95('0x2')],'allowNull':![],'unique':_0x9d95('0x3')},'table':{'type':Sequelize[_0x9d95('0x2')]},'metric':{'type':Sequelize[_0x9d95('0x4')]},'description':{'type':Sequelize[_0x9d95('0x2')]}}; \ No newline at end of file +var _0x6b0e=['exports','STRING','sequelize'];(function(_0x147007,_0x1f90b6){var _0x614f59=function(_0x1ee8d3){while(--_0x1ee8d3){_0x147007['push'](_0x147007['shift']());}};_0x614f59(++_0x1f90b6);}(_0x6b0e,0x185));var _0xe6b0=function(_0x109f62,_0x2a1093){_0x109f62=_0x109f62-0x0;var _0x2ac0cc=_0x6b0e[_0x109f62];return _0x2ac0cc;};'use strict';var Sequelize=require(_0xe6b0('0x0'));module[_0xe6b0('0x1')]={'name':{'type':Sequelize[_0xe6b0('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xe6b0('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xe6b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 6912a2c..c8eabbc 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 _0x725d=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','then','UserProfileResource','stack','name','index','AnalyticMetric','rawAttributes','type','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','options','includeAll','include','findAll','rows','catch','show','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv'];(function(_0x2523c8,_0x3ed923){var _0x5a4f94=function(_0x2fbdde){while(--_0x2fbdde){_0x2523c8['push'](_0x2523c8['shift']());}};_0x5a4f94(++_0x3ed923);}(_0x725d,0x97));var _0xd725=function(_0x5c9f9c,_0x2193ed){_0x5c9f9c=_0x5c9f9c-0x0;var _0x20350a=_0x725d[_0x5c9f9c];return _0x20350a;};'use strict';var pdf=require(_0xd725('0x0'));var emlformat=require(_0xd725('0x1'));var rimraf=require(_0xd725('0x2'));var zipdir=require(_0xd725('0x3'));var jsonpatch=require(_0xd725('0x4'));var rp=require(_0xd725('0x5'));var moment=require(_0xd725('0x6'));var BPromise=require(_0xd725('0x7'));var Mustache=require(_0xd725('0x8'));var util=require('util');var path=require('path');var sox=require(_0xd725('0x9'));var csv=require(_0xd725('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd725('0xb'));var squel=require(_0xd725('0xc'));var crypto=require(_0xd725('0xd'));var jsforce=require(_0xd725('0xe'));var deskjs=require(_0xd725('0xf'));var toCsv=require(_0xd725('0xa'));var querystring=require(_0xd725('0x10'));var Papa=require(_0xd725('0x11'));var Redis=require(_0xd725('0x12'));var authService=require(_0xd725('0x13'));var qs=require(_0xd725('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd725('0x15'));var logger=require(_0xd725('0x16'))(_0xd725('0x17'));var utils=require(_0xd725('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3de5a1,_0x5e7e45){_0x5e7e45=_0x5e7e45||0xcc;return function(_0x5e4955){if(_0x5e4955){return _0x3de5a1[_0xd725('0x19')](_0x5e7e45);}return _0x3de5a1[_0xd725('0x1a')](_0x5e7e45)[_0xd725('0x1b')]();};}function respondWithResult(_0x4da36c,_0x4e5872){_0x4e5872=_0x4e5872||0xc8;return function(_0x5d104e){if(_0x5d104e){return _0x4da36c['status'](_0x4e5872)[_0xd725('0x1c')](_0x5d104e);}};}function respondWithFilteredResult(_0xe1768c,_0x313076){return function(_0x18dc92){if(_0x18dc92){var _0x1f6732=_0x18dc92[_0xd725('0x1d')],_0x12eca8=_0x313076[_0xd725('0x1e')],_0x12d526=_0x313076[_0xd725('0x1e')]+_0x313076[_0xd725('0x1f')],_0x1e6007;if(_0x12d526>=_0x1f6732){_0x12d526=_0x1f6732;_0x1e6007=0xc8;}else{_0x1e6007=0xce;}_0xe1768c[_0xd725('0x1a')](_0x1e6007);return _0xe1768c[_0xd725('0x20')](_0xd725('0x21'),_0x12eca8+'-'+_0x12d526+'/'+_0x1f6732)[_0xd725('0x1c')](_0x18dc92);}return null;};}function patchUpdates(_0xb3e222){return function(_0x3cc0a4){try{jsonpatch[_0xd725('0x22')](_0x3cc0a4,_0xb3e222,!![]);}catch(_0x4d1336){return BPromise[_0xd725('0x23')](_0x4d1336);}return _0x3cc0a4['save']();};}function saveUpdates(_0x123ac9,_0x5c2889){return function(_0x12d202){if(_0x12d202){return _0x12d202['update'](_0x123ac9)['then'](function(_0x50f0b8){return _0x50f0b8;});}return null;};}function removeEntity(_0x43020c,_0x5e8d1f){return function(_0x2b5f17){if(_0x2b5f17){return _0x2b5f17[_0xd725('0x24')]()[_0xd725('0x25')](function(){var _0x1d306c=_0x2b5f17['get']({'plain':!![]});var _0x221d50='Metrics';return db[_0xd725('0x26')][_0xd725('0x24')]({'where':{'type':_0x221d50,'resourceId':_0x1d306c['id']}})['then'](function(){return _0x2b5f17;});})[_0xd725('0x25')](function(){_0x43020c['status'](0xcc)[_0xd725('0x1b')]();});}};}function handleEntityNotFound(_0x1797f2,_0x1ee721){return function(_0x440dca){if(!_0x440dca){_0x1797f2[_0xd725('0x19')](0x194);}return _0x440dca;};}function handleError(_0x33c24c,_0x43d456){_0x43d456=_0x43d456||0x1f4;return function(_0x4630fb){logger['error'](_0x4630fb[_0xd725('0x27')]);if(_0x4630fb['name']){delete _0x4630fb[_0xd725('0x28')];}_0x33c24c[_0xd725('0x1a')](_0x43d456)['send'](_0x4630fb);};}exports[_0xd725('0x29')]=function(_0x4be73f,_0x295306){var _0x58be79={},_0xf6ae6b={},_0x4ebd4f={'count':0x0,'rows':[]};var _0x4e6586=_['map'](db[_0xd725('0x2a')][_0xd725('0x2b')],function(_0x1c5359){return{'name':_0x1c5359['fieldName'],'type':_0x1c5359[_0xd725('0x2c')]['key']};});_0xf6ae6b['model']=_[_0xd725('0x2d')](_0x4e6586,_0xd725('0x28'));_0xf6ae6b[_0xd725('0x2e')]=_[_0xd725('0x2f')](_0x4be73f['query']);_0xf6ae6b['filters']=_[_0xd725('0x30')](_0xf6ae6b[_0xd725('0x31')],_0xf6ae6b[_0xd725('0x2e')]);_0x58be79['attributes']=_[_0xd725('0x30')](_0xf6ae6b['model'],qs[_0xd725('0x32')](_0x4be73f[_0xd725('0x2e')][_0xd725('0x32')]));_0x58be79[_0xd725('0x33')]=_0x58be79[_0xd725('0x33')]['length']?_0x58be79['attributes']:_0xf6ae6b[_0xd725('0x31')];if(!_0x4be73f[_0xd725('0x2e')][_0xd725('0x34')](_0xd725('0x35'))){_0x58be79[_0xd725('0x1f')]=qs['limit'](_0x4be73f[_0xd725('0x2e')][_0xd725('0x1f')]);_0x58be79[_0xd725('0x1e')]=qs[_0xd725('0x1e')](_0x4be73f['query'][_0xd725('0x1e')]);}_0x58be79['order']=qs[_0xd725('0x36')](_0x4be73f[_0xd725('0x2e')][_0xd725('0x36')]);_0x58be79[_0xd725('0x37')]=qs[_0xd725('0x38')](_[_0xd725('0x39')](_0x4be73f['query'],_0xf6ae6b[_0xd725('0x38')]));if(_0x4be73f[_0xd725('0x2e')][_0xd725('0x3a')]){_0x58be79[_0xd725('0x37')]=_['merge'](_0x58be79['where'],{'$or':_['map'](_0x4e6586,function(_0x21c5c7){if(_0x21c5c7[_0xd725('0x2c')]!=='VIRTUAL'){var _0x89a041={};_0x89a041[_0x21c5c7[_0xd725('0x28')]]={'$like':'%'+_0x4be73f['query'][_0xd725('0x3a')]+'%'};return _0x89a041;}})});}_0x58be79=_['merge']({},_0x58be79,_0x4be73f[_0xd725('0x3b')]);var _0x149847={'where':_0x58be79[_0xd725('0x37')]};return db[_0xd725('0x2a')][_0xd725('0x1d')](_0x149847)['then'](function(_0xa29ce){_0x4ebd4f[_0xd725('0x1d')]=_0xa29ce;if(_0x4be73f[_0xd725('0x2e')][_0xd725('0x3c')]){_0x58be79[_0xd725('0x3d')]=[{'all':!![]}];}return db[_0xd725('0x2a')][_0xd725('0x3e')](_0x58be79);})[_0xd725('0x25')](function(_0x4ed44b){_0x4ebd4f[_0xd725('0x3f')]=_0x4ed44b;return _0x4ebd4f;})[_0xd725('0x25')](respondWithFilteredResult(_0x295306,_0x58be79))[_0xd725('0x40')](handleError(_0x295306,null));};exports[_0xd725('0x41')]=function(_0x59bd01,_0x291d22){var _0x42586f={'raw':!![],'where':{'id':_0x59bd01['params']['id']}},_0x3e2eba={};_0x3e2eba['model']=_['keys'](db[_0xd725('0x2a')][_0xd725('0x2b')]);_0x3e2eba[_0xd725('0x2e')]=_[_0xd725('0x2f')](_0x59bd01[_0xd725('0x2e')]);_0x3e2eba['filters']=_['intersection'](_0x3e2eba['model'],_0x3e2eba[_0xd725('0x2e')]);_0x42586f[_0xd725('0x33')]=_[_0xd725('0x30')](_0x3e2eba[_0xd725('0x31')],qs[_0xd725('0x32')](_0x59bd01['query'][_0xd725('0x32')]));_0x42586f[_0xd725('0x33')]=_0x42586f[_0xd725('0x33')][_0xd725('0x42')]?_0x42586f[_0xd725('0x33')]:_0x3e2eba['model'];if(_0x59bd01[_0xd725('0x2e')][_0xd725('0x3c')]){_0x42586f[_0xd725('0x3d')]=[{'all':!![]}];}_0x42586f=_['merge']({},_0x42586f,_0x59bd01[_0xd725('0x3b')]);return db[_0xd725('0x2a')][_0xd725('0x43')](_0x42586f)['then'](handleEntityNotFound(_0x291d22,null))[_0xd725('0x25')](respondWithResult(_0x291d22,null))[_0xd725('0x40')](handleError(_0x291d22,null));};exports[_0xd725('0x44')]=function(_0x1aefb2,_0x3497b9){return db[_0xd725('0x2a')]['create'](_0x1aefb2['body'],{})[_0xd725('0x25')](function(_0x23c3df){var _0x22619b=_0x1aefb2[_0xd725('0x45')][_0xd725('0x46')]({'plain':!![]});if(!_0x22619b)throw new Error(_0xd725('0x47'));if(_0x22619b[_0xd725('0x48')]===_0xd725('0x45')){var _0x5ac42c=_0x23c3df[_0xd725('0x46')]({'plain':!![]});var _0x58d3d4=_0xd725('0x49');return db[_0xd725('0x4a')][_0xd725('0x43')]({'where':{'name':_0x58d3d4,'userProfileId':_0x22619b['userProfileId']},'raw':!![]})[_0xd725('0x25')](function(_0x2e6fe7){if(_0x2e6fe7&&_0x2e6fe7[_0xd725('0x4b')]===0x0){return db['UserProfileResource'][_0xd725('0x44')]({'name':_0x5ac42c[_0xd725('0x28')],'resourceId':_0x5ac42c['id'],'type':_0x2e6fe7['name'],'sectionId':_0x2e6fe7['id']},{})[_0xd725('0x25')](function(){return _0x23c3df;});}else{return _0x23c3df;}})[_0xd725('0x40')](function(_0x127362){logger[_0xd725('0x4c')](_0xd725('0x4d'),_0x127362);throw _0x127362;});}return _0x23c3df;})[_0xd725('0x25')](respondWithResult(_0x3497b9,0xc9))['catch'](handleError(_0x3497b9,null));};exports[_0xd725('0x4e')]=function(_0x7bf932,_0x3ffc21){if(_0x7bf932['body']['id']){delete _0x7bf932[_0xd725('0x4f')]['id'];}return db[_0xd725('0x2a')][_0xd725('0x43')]({'where':{'id':_0x7bf932[_0xd725('0x50')]['id']}})['then'](handleEntityNotFound(_0x3ffc21,null))[_0xd725('0x25')](saveUpdates(_0x7bf932[_0xd725('0x4f')],null))[_0xd725('0x25')](respondWithResult(_0x3ffc21,null))[_0xd725('0x40')](handleError(_0x3ffc21,null));};exports['destroy']=function(_0xec70b5,_0x3b91eb){return db[_0xd725('0x2a')]['find']({'where':{'id':_0xec70b5[_0xd725('0x50')]['id']}})[_0xd725('0x25')](handleEntityNotFound(_0x3b91eb,null))[_0xd725('0x25')](removeEntity(_0x3b91eb,null))[_0xd725('0x40')](handleError(_0x3b91eb,null));}; \ No newline at end of file +var _0x4ad0=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','find','catch','create','body','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','destroy','get','Metrics','then','error','stack','name','send','index','map','AnalyticMetric','rawAttributes'];(function(_0x4ed360,_0x42fd38){var _0x49918b=function(_0x40e60e){while(--_0x40e60e){_0x4ed360['push'](_0x4ed360['shift']());}};_0x49918b(++_0x42fd38);}(_0x4ad0,0x73));var _0x04ad=function(_0x1e8ec3,_0x3f0312){_0x1e8ec3=_0x1e8ec3-0x0;var _0x2d5f70=_0x4ad0[_0x1e8ec3];return _0x2d5f70;};'use strict';var pdf=require(_0x04ad('0x0'));var emlformat=require(_0x04ad('0x1'));var rimraf=require(_0x04ad('0x2'));var zipdir=require(_0x04ad('0x3'));var jsonpatch=require(_0x04ad('0x4'));var rp=require(_0x04ad('0x5'));var moment=require(_0x04ad('0x6'));var BPromise=require(_0x04ad('0x7'));var Mustache=require('mustache');var util=require(_0x04ad('0x8'));var path=require('path');var sox=require(_0x04ad('0x9'));var csv=require(_0x04ad('0xa'));var ejs=require(_0x04ad('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x04ad('0xc'));var jsforce=require(_0x04ad('0xd'));var deskjs=require(_0x04ad('0xe'));var toCsv=require(_0x04ad('0xa'));var querystring=require(_0x04ad('0xf'));var Papa=require(_0x04ad('0x10'));var Redis=require(_0x04ad('0x11'));var authService=require(_0x04ad('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x04ad('0x13'));var hardwareService=require(_0x04ad('0x14'));var logger=require(_0x04ad('0x15'))(_0x04ad('0x16'));var utils=require(_0x04ad('0x17'));var config=require(_0x04ad('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a776e,_0x5c27c6){_0x5c27c6=_0x5c27c6||0xcc;return function(_0xf5630e){if(_0xf5630e){return _0x4a776e[_0x04ad('0x19')](_0x5c27c6);}return _0x4a776e[_0x04ad('0x1a')](_0x5c27c6)[_0x04ad('0x1b')]();};}function respondWithResult(_0xeadace,_0x350fd0){_0x350fd0=_0x350fd0||0xc8;return function(_0x44379b){if(_0x44379b){return _0xeadace[_0x04ad('0x1a')](_0x350fd0)[_0x04ad('0x1c')](_0x44379b);}};}function respondWithFilteredResult(_0x8aa526,_0x3ce83f){return function(_0x34c825){if(_0x34c825){var _0x5c6bea=_0x34c825[_0x04ad('0x1d')],_0x5697db=_0x3ce83f[_0x04ad('0x1e')],_0x435d4b=_0x3ce83f[_0x04ad('0x1e')]+_0x3ce83f[_0x04ad('0x1f')],_0x3a03ac;if(_0x435d4b>=_0x5c6bea){_0x435d4b=_0x5c6bea;_0x3a03ac=0xc8;}else{_0x3a03ac=0xce;}_0x8aa526[_0x04ad('0x1a')](_0x3a03ac);return _0x8aa526[_0x04ad('0x20')](_0x04ad('0x21'),_0x5697db+'-'+_0x435d4b+'/'+_0x5c6bea)['json'](_0x34c825);}return null;};}function patchUpdates(_0x13ec57){return function(_0x16b40a){try{jsonpatch[_0x04ad('0x22')](_0x16b40a,_0x13ec57,!![]);}catch(_0x55e007){return BPromise['reject'](_0x55e007);}return _0x16b40a['save']();};}function saveUpdates(_0x54bcd9,_0x3d57e7){return function(_0x5e45e7){if(_0x5e45e7){return _0x5e45e7['update'](_0x54bcd9)['then'](function(_0x346d39){return _0x346d39;});}return null;};}function removeEntity(_0x374b85,_0x55a9e4){return function(_0x407b5c){if(_0x407b5c){return _0x407b5c[_0x04ad('0x23')]()['then'](function(){var _0x1ad001=_0x407b5c[_0x04ad('0x24')]({'plain':!![]});var _0x11d752=_0x04ad('0x25');return db['UserProfileResource'][_0x04ad('0x23')]({'where':{'type':_0x11d752,'resourceId':_0x1ad001['id']}})[_0x04ad('0x26')](function(){return _0x407b5c;});})['then'](function(){_0x374b85[_0x04ad('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x303981,_0x39ef69){return function(_0xa74496){if(!_0xa74496){_0x303981[_0x04ad('0x19')](0x194);}return _0xa74496;};}function handleError(_0x4be1db,_0x3ed4e1){_0x3ed4e1=_0x3ed4e1||0x1f4;return function(_0x56a4b1){logger[_0x04ad('0x27')](_0x56a4b1[_0x04ad('0x28')]);if(_0x56a4b1[_0x04ad('0x29')]){delete _0x56a4b1['name'];}_0x4be1db[_0x04ad('0x1a')](_0x3ed4e1)[_0x04ad('0x2a')](_0x56a4b1);};}exports[_0x04ad('0x2b')]=function(_0x5c293a,_0x345141){var _0x32a6b0={},_0x444fbd={},_0x5b8136={'count':0x0,'rows':[]};var _0x5e5891=_[_0x04ad('0x2c')](db[_0x04ad('0x2d')][_0x04ad('0x2e')],function(_0x5a91a8){return{'name':_0x5a91a8[_0x04ad('0x2f')],'type':_0x5a91a8[_0x04ad('0x30')][_0x04ad('0x31')]};});_0x444fbd[_0x04ad('0x32')]=_[_0x04ad('0x2c')](_0x5e5891,_0x04ad('0x29'));_0x444fbd[_0x04ad('0x33')]=_[_0x04ad('0x34')](_0x5c293a[_0x04ad('0x33')]);_0x444fbd[_0x04ad('0x35')]=_[_0x04ad('0x36')](_0x444fbd[_0x04ad('0x32')],_0x444fbd[_0x04ad('0x33')]);_0x32a6b0['attributes']=_[_0x04ad('0x36')](_0x444fbd['model'],qs[_0x04ad('0x37')](_0x5c293a['query']['fields']));_0x32a6b0[_0x04ad('0x38')]=_0x32a6b0[_0x04ad('0x38')][_0x04ad('0x39')]?_0x32a6b0['attributes']:_0x444fbd[_0x04ad('0x32')];if(!_0x5c293a[_0x04ad('0x33')][_0x04ad('0x3a')]('nolimit')){_0x32a6b0[_0x04ad('0x1f')]=qs['limit'](_0x5c293a[_0x04ad('0x33')]['limit']);_0x32a6b0[_0x04ad('0x1e')]=qs[_0x04ad('0x1e')](_0x5c293a[_0x04ad('0x33')][_0x04ad('0x1e')]);}_0x32a6b0[_0x04ad('0x3b')]=qs[_0x04ad('0x3c')](_0x5c293a['query'][_0x04ad('0x3c')]);_0x32a6b0[_0x04ad('0x3d')]=qs[_0x04ad('0x35')](_[_0x04ad('0x3e')](_0x5c293a['query'],_0x444fbd['filters']));if(_0x5c293a[_0x04ad('0x33')][_0x04ad('0x3f')]){_0x32a6b0[_0x04ad('0x3d')]=_['merge'](_0x32a6b0[_0x04ad('0x3d')],{'$or':_['map'](_0x5e5891,function(_0x2d35ba){if(_0x2d35ba[_0x04ad('0x30')]!=='VIRTUAL'){var _0x3e658a={};_0x3e658a[_0x2d35ba['name']]={'$like':'%'+_0x5c293a[_0x04ad('0x33')][_0x04ad('0x3f')]+'%'};return _0x3e658a;}})});}_0x32a6b0=_[_0x04ad('0x40')]({},_0x32a6b0,_0x5c293a[_0x04ad('0x41')]);var _0x3f283f={'where':_0x32a6b0['where']};return db[_0x04ad('0x2d')]['count'](_0x3f283f)[_0x04ad('0x26')](function(_0x1e3db9){_0x5b8136[_0x04ad('0x1d')]=_0x1e3db9;if(_0x5c293a[_0x04ad('0x33')][_0x04ad('0x42')]){_0x32a6b0[_0x04ad('0x43')]=[{'all':!![]}];}return db[_0x04ad('0x2d')]['findAll'](_0x32a6b0);})[_0x04ad('0x26')](function(_0x30c104){_0x5b8136[_0x04ad('0x44')]=_0x30c104;return _0x5b8136;})['then'](respondWithFilteredResult(_0x345141,_0x32a6b0))['catch'](handleError(_0x345141,null));};exports[_0x04ad('0x45')]=function(_0x1ed7bb,_0x953674){var _0x43e6db={'raw':!![],'where':{'id':_0x1ed7bb['params']['id']}},_0x30e3e0={};_0x30e3e0['model']=_['keys'](db[_0x04ad('0x2d')]['rawAttributes']);_0x30e3e0[_0x04ad('0x33')]=_[_0x04ad('0x34')](_0x1ed7bb['query']);_0x30e3e0[_0x04ad('0x35')]=_[_0x04ad('0x36')](_0x30e3e0['model'],_0x30e3e0[_0x04ad('0x33')]);_0x43e6db[_0x04ad('0x38')]=_[_0x04ad('0x36')](_0x30e3e0[_0x04ad('0x32')],qs[_0x04ad('0x37')](_0x1ed7bb[_0x04ad('0x33')][_0x04ad('0x37')]));_0x43e6db['attributes']=_0x43e6db['attributes']['length']?_0x43e6db['attributes']:_0x30e3e0['model'];if(_0x1ed7bb[_0x04ad('0x33')]['includeAll']){_0x43e6db[_0x04ad('0x43')]=[{'all':!![]}];}_0x43e6db=_[_0x04ad('0x40')]({},_0x43e6db,_0x1ed7bb[_0x04ad('0x41')]);return db[_0x04ad('0x2d')][_0x04ad('0x46')](_0x43e6db)[_0x04ad('0x26')](handleEntityNotFound(_0x953674,null))[_0x04ad('0x26')](respondWithResult(_0x953674,null))[_0x04ad('0x47')](handleError(_0x953674,null));};exports[_0x04ad('0x48')]=function(_0x527332,_0x3eccdd){return db['AnalyticMetric'][_0x04ad('0x48')](_0x527332[_0x04ad('0x49')],{})[_0x04ad('0x26')](function(_0x39e1c8){var _0x29095e=_0x527332['user'][_0x04ad('0x24')]({'plain':!![]});if(!_0x29095e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29095e['role']===_0x04ad('0x4a')){var _0x3153fb=_0x39e1c8['get']({'plain':!![]});var _0x1b4acf=_0x04ad('0x25');return db[_0x04ad('0x4b')][_0x04ad('0x46')]({'where':{'name':_0x1b4acf,'userProfileId':_0x29095e[_0x04ad('0x4c')]},'raw':!![]})[_0x04ad('0x26')](function(_0x279bd6){if(_0x279bd6&&_0x279bd6['autoAssociation']===0x0){return db[_0x04ad('0x4d')][_0x04ad('0x48')]({'name':_0x3153fb[_0x04ad('0x29')],'resourceId':_0x3153fb['id'],'type':_0x279bd6[_0x04ad('0x29')],'sectionId':_0x279bd6['id']},{})[_0x04ad('0x26')](function(){return _0x39e1c8;});}else{return _0x39e1c8;}})['catch'](function(_0x307db3){logger[_0x04ad('0x27')](_0x04ad('0x4e'),_0x307db3);throw _0x307db3;});}return _0x39e1c8;})[_0x04ad('0x26')](respondWithResult(_0x3eccdd,0xc9))[_0x04ad('0x47')](handleError(_0x3eccdd,null));};exports[_0x04ad('0x4f')]=function(_0x500d53,_0x33ea0a){if(_0x500d53[_0x04ad('0x49')]['id']){delete _0x500d53[_0x04ad('0x49')]['id'];}return db[_0x04ad('0x2d')][_0x04ad('0x46')]({'where':{'id':_0x500d53[_0x04ad('0x50')]['id']}})[_0x04ad('0x26')](handleEntityNotFound(_0x33ea0a,null))[_0x04ad('0x26')](saveUpdates(_0x500d53[_0x04ad('0x49')],null))[_0x04ad('0x26')](respondWithResult(_0x33ea0a,null))[_0x04ad('0x47')](handleError(_0x33ea0a,null));};exports[_0x04ad('0x23')]=function(_0x3371c8,_0x5b4580){return db[_0x04ad('0x2d')]['find']({'where':{'id':_0x3371c8[_0x04ad('0x50')]['id']}})[_0x04ad('0x26')](handleEntityNotFound(_0x5b4580,null))[_0x04ad('0x26')](removeEntity(_0x5b4580,null))[_0x04ad('0x47')](handleError(_0x5b4580,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 903612b..433dd24 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 _0x9768=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','lodash'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x9768,0x197));var _0x8976=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0x9768[_0x1b51ea];return _0x18bbdc;};'use strict';var _=require(_0x8976('0x0'));var util=require(_0x8976('0x1'));var logger=require(_0x8976('0x2'))('api');var moment=require(_0x8976('0x3'));var BPromise=require(_0x8976('0x4'));var rp=require(_0x8976('0x5'));var fs=require('fs');var path=require(_0x8976('0x6'));var rimraf=require(_0x8976('0x7'));var config=require(_0x8976('0x8'));var attributes=require(_0x8976('0x9'));module[_0x8976('0xa')]=function(_0x345679,_0x281628){return _0x345679['define'](_0x8976('0xb'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9451=['AnalyticMetric','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0x19c44d,_0x3366f8){var _0x53100d=function(_0x3f92fc){while(--_0x3f92fc){_0x19c44d['push'](_0x19c44d['shift']());}};_0x53100d(++_0x3366f8);}(_0x9451,0x91));var _0x1945=function(_0x5328f7,_0x378bcc){_0x5328f7=_0x5328f7-0x0;var _0xb135e=_0x9451[_0x5328f7];return _0xb135e;};'use strict';var _=require(_0x1945('0x0'));var util=require('util');var logger=require(_0x1945('0x1'))('api');var moment=require(_0x1945('0x2'));var BPromise=require(_0x1945('0x3'));var rp=require(_0x1945('0x4'));var fs=require('fs');var path=require(_0x1945('0x5'));var rimraf=require(_0x1945('0x6'));var config=require(_0x1945('0x7'));var attributes=require(_0x1945('0x8'));module[_0x1945('0x9')]=function(_0x220d9a,_0x3a0eeb){return _0x220d9a[_0x1945('0xa')](_0x1945('0xb'),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 327e7dc..c793cc4 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 _0x1593=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2e63e8,_0xed68f5){var _0x3fe904=function(_0x10e876){while(--_0x10e876){_0x2e63e8['push'](_0x2e63e8['shift']());}};_0x3fe904(++_0xed68f5);}(_0x1593,0x15a));var _0x3159=function(_0xfb53a4,_0x477204){_0xfb53a4=_0xfb53a4-0x0;var _0x4c77b1=_0x1593[_0xfb53a4];return _0x4c77b1;};'use strict';var _=require(_0x3159('0x0'));var util=require(_0x3159('0x1'));var moment=require(_0x3159('0x2'));var BPromise=require(_0x3159('0x3'));var rs=require(_0x3159('0x4'));var fs=require('fs');var Redis=require(_0x3159('0x5'));var db=require(_0x3159('0x6'))['db'];var utils=require(_0x3159('0x7'));var logger=require(_0x3159('0x8'))(_0x3159('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3159('0xa')][_0x3159('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d4f7f,_0x2d3832,_0x34381d){return new BPromise(function(_0x4812c5,_0x59059c){return client[_0x3159('0xc')](_0x2d4f7f,_0x34381d)[_0x3159('0xd')](function(_0x15c62f){logger[_0x3159('0xe')](_0x3159('0xf'),_0x2d3832,_0x3159('0x10'));logger['debug'](_0x3159('0x11'),_0x2d3832,_0x3159('0x10'),JSON[_0x3159('0x12')](_0x15c62f));if(_0x15c62f[_0x3159('0x13')]){if(_0x15c62f['error'][_0x3159('0x14')]===0x1f4){logger[_0x3159('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x2d3832,_0x15c62f[_0x3159('0x13')]['message']);return _0x59059c(_0x15c62f[_0x3159('0x13')]['message']);}logger[_0x3159('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x2d3832,_0x15c62f[_0x3159('0x13')][_0x3159('0x15')]);return _0x4812c5(_0x15c62f[_0x3159('0x13')]['message']);}else{logger[_0x3159('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x2d3832,_0x3159('0x10'));_0x4812c5(_0x15c62f['result'][_0x3159('0x15')]);}})[_0x3159('0x16')](function(_0x269c0d){logger[_0x3159('0x13')](_0x3159('0xf'),_0x2d3832,_0x269c0d);_0x59059c(_0x269c0d);});});} \ No newline at end of file +var _0xe842=['catch','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0xf9ea81,_0x174408){var _0x72bd29=function(_0x185aa9){while(--_0x185aa9){_0xf9ea81['push'](_0xf9ea81['shift']());}};_0x72bd29(++_0x174408);}(_0xe842,0x169));var _0x2e84=function(_0x2020b6,_0x2ff986){_0x2020b6=_0x2020b6-0x0;var _0x2e0f62=_0xe842[_0x2020b6];return _0x2e0f62;};'use strict';var _=require(_0x2e84('0x0'));var util=require('util');var moment=require(_0x2e84('0x1'));var BPromise=require('bluebird');var rs=require(_0x2e84('0x2'));var fs=require('fs');var Redis=require(_0x2e84('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e84('0x4'));var logger=require('../../config/logger')(_0x2e84('0x5'));var config=require(_0x2e84('0x6'));var jayson=require(_0x2e84('0x7'));var client=jayson[_0x2e84('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54c066,_0x26328b,_0x65220a){return new BPromise(function(_0x57a1d0,_0x30f756){return client[_0x2e84('0x9')](_0x54c066,_0x65220a)['then'](function(_0x27a22e){logger[_0x2e84('0xa')](_0x2e84('0xb'),_0x26328b,_0x2e84('0xc'));logger[_0x2e84('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x26328b,_0x2e84('0xc'),JSON[_0x2e84('0xe')](_0x27a22e));if(_0x27a22e[_0x2e84('0xf')]){if(_0x27a22e[_0x2e84('0xf')][_0x2e84('0x10')]===0x1f4){logger[_0x2e84('0xf')](_0x2e84('0xb'),_0x26328b,_0x27a22e[_0x2e84('0xf')][_0x2e84('0x11')]);return _0x30f756(_0x27a22e['error']['message']);}logger[_0x2e84('0xf')](_0x2e84('0xb'),_0x26328b,_0x27a22e['error'][_0x2e84('0x11')]);return _0x57a1d0(_0x27a22e[_0x2e84('0xf')][_0x2e84('0x11')]);}else{logger[_0x2e84('0xa')](_0x2e84('0xb'),_0x26328b,'request\x20sent');_0x57a1d0(_0x27a22e[_0x2e84('0x12')][_0x2e84('0x11')]);}})[_0x2e84('0x13')](function(_0x4f3ee6){logger[_0x2e84('0xf')](_0x2e84('0xb'),_0x26328b,_0x4f3ee6);_0x30f756(_0x4f3ee6);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 2b302c4..eaeae2a 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 _0xc6ac=['show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x1a6cad,_0x17582d){_0x1a6cad=_0x1a6cad-0x0;var _0x2b1676=_0xc6ac[_0x1a6cad];return _0x2b1676;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var auth=require(_0xcc6a('0x6'));var interaction=require(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var controller=require(_0xcc6a('0x9'));router[_0xcc6a('0xa')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xc')]);router[_0xcc6a('0xa')]('/:id',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xd')]);router[_0xcc6a('0xe')]('/',auth['isAuthenticated'](),controller[_0xcc6a('0xf')]);router[_0xcc6a('0x10')](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x12')]);router['delete'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x326f=['show','post','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x326f,0xd1));var _0xf326=function(_0x5dffc7,_0x86f2db){_0x5dffc7=_0x5dffc7-0x0;var _0x1cf287=_0x326f[_0x5dffc7];return _0x1cf287;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 9e64afb..74235a3 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x5633=['sequelize','exports'];(function(_0x341967,_0x3eea51){var _0x20f414=function(_0x332e11){while(--_0x332e11){_0x341967['push'](_0x341967['shift']());}};_0x20f414(++_0x3eea51);}(_0x5633,0xea));var _0x3563=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x5633[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require(_0x3563('0x0'));module[_0x3563('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index b4614a4..055b220 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 _0x087b=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','include','findAll','rows','catch','show','intersection','find','create','body','params','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x295d6e,_0xa71f5d){var _0x478150=function(_0x2bdbb0){while(--_0x2bdbb0){_0x295d6e['push'](_0x295d6e['shift']());}};_0x478150(++_0xa71f5d);}(_0x087b,0x11a));var _0xb087=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x087b[_0x45f951];return _0x24756c;};'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 db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x189e2b,_0x31f977){_0x31f977=_0x31f977||0xcc;return function(_0x323656){if(_0x323656){return _0x189e2b['sendStatus'](_0x31f977);}return _0x189e2b[_0xb087('0x1a')](_0x31f977)[_0xb087('0x1b')]();};}function respondWithResult(_0x43f136,_0x46410b){_0x46410b=_0x46410b||0xc8;return function(_0x11784c){if(_0x11784c){return _0x43f136[_0xb087('0x1a')](_0x46410b)[_0xb087('0x1c')](_0x11784c);}};}function respondWithFilteredResult(_0x5147e3,_0x24e1a3){return function(_0x16d0b7){if(_0x16d0b7){var _0x5193a4=_0x16d0b7[_0xb087('0x1d')],_0x43e576=_0x24e1a3[_0xb087('0x1e')],_0x412b48=_0x24e1a3[_0xb087('0x1e')]+_0x24e1a3['limit'],_0x597478;if(_0x412b48>=_0x5193a4){_0x412b48=_0x5193a4;_0x597478=0xc8;}else{_0x597478=0xce;}_0x5147e3[_0xb087('0x1a')](_0x597478);return _0x5147e3[_0xb087('0x1f')](_0xb087('0x20'),_0x43e576+'-'+_0x412b48+'/'+_0x5193a4)[_0xb087('0x1c')](_0x16d0b7);}return null;};}function patchUpdates(_0x4e333b){return function(_0x13d534){try{jsonpatch[_0xb087('0x21')](_0x13d534,_0x4e333b,!![]);}catch(_0x10bb5b){return BPromise[_0xb087('0x22')](_0x10bb5b);}return _0x13d534['save']();};}function saveUpdates(_0x5aeab1,_0x5ea3dc){return function(_0x49450a){if(_0x49450a){return _0x49450a[_0xb087('0x23')](_0x5aeab1)[_0xb087('0x24')](function(_0x3d0f57){return _0x3d0f57;});}return null;};}function removeEntity(_0x1f3c0e,_0x1fb765){return function(_0x258b4c){if(_0x258b4c){return _0x258b4c[_0xb087('0x25')]()['then'](function(){_0x1f3c0e[_0xb087('0x1a')](0xcc)[_0xb087('0x1b')]();});}};}function handleEntityNotFound(_0x1de654,_0x1cfb3e){return function(_0x3ad74e){if(!_0x3ad74e){_0x1de654['sendStatus'](0x194);}return _0x3ad74e;};}function handleError(_0x183eab,_0xdd4216){_0xdd4216=_0xdd4216||0x1f4;return function(_0x502438){logger['error'](_0x502438['stack']);if(_0x502438['name']){delete _0x502438['name'];}_0x183eab[_0xb087('0x1a')](_0xdd4216)[_0xb087('0x26')](_0x502438);};}exports[_0xb087('0x27')]=function(_0x3ca2df,_0xd9ec66){var _0xb72173={},_0xf3f41f={},_0x35a52c={'count':0x0,'rows':[]};var _0x6cfb22=_[_0xb087('0x28')](db[_0xb087('0x29')][_0xb087('0x2a')],function(_0xb0baf6){return{'name':_0xb0baf6[_0xb087('0x2b')],'type':_0xb0baf6['type'][_0xb087('0x2c')]};});_0xf3f41f[_0xb087('0x2d')]=_[_0xb087('0x28')](_0x6cfb22,_0xb087('0x2e'));_0xf3f41f[_0xb087('0x2f')]=_[_0xb087('0x30')](_0x3ca2df[_0xb087('0x2f')]);_0xf3f41f[_0xb087('0x31')]=_['intersection'](_0xf3f41f['model'],_0xf3f41f[_0xb087('0x2f')]);_0xb72173[_0xb087('0x32')]=_['intersection'](_0xf3f41f[_0xb087('0x2d')],qs[_0xb087('0x33')](_0x3ca2df[_0xb087('0x2f')][_0xb087('0x33')]));_0xb72173[_0xb087('0x32')]=_0xb72173[_0xb087('0x32')][_0xb087('0x34')]?_0xb72173[_0xb087('0x32')]:_0xf3f41f[_0xb087('0x2d')];if(!_0x3ca2df[_0xb087('0x2f')][_0xb087('0x35')](_0xb087('0x36'))){_0xb72173['limit']=qs[_0xb087('0x37')](_0x3ca2df['query'][_0xb087('0x37')]);_0xb72173[_0xb087('0x1e')]=qs[_0xb087('0x1e')](_0x3ca2df[_0xb087('0x2f')][_0xb087('0x1e')]);}_0xb72173[_0xb087('0x38')]=qs[_0xb087('0x39')](_0x3ca2df[_0xb087('0x2f')][_0xb087('0x39')]);_0xb72173['where']=qs['filters'](_[_0xb087('0x3a')](_0x3ca2df[_0xb087('0x2f')],_0xf3f41f[_0xb087('0x31')]));if(_0x3ca2df[_0xb087('0x2f')][_0xb087('0x3b')]){_0xb72173['where']=_[_0xb087('0x3c')](_0xb72173[_0xb087('0x3d')],{'$or':_['map'](_0x6cfb22,function(_0x480e22){if(_0x480e22[_0xb087('0x3e')]!==_0xb087('0x3f')){var _0x130ee9={};_0x130ee9[_0x480e22['name']]={'$like':'%'+_0x3ca2df[_0xb087('0x2f')][_0xb087('0x3b')]+'%'};return _0x130ee9;}})});}_0xb72173=_[_0xb087('0x3c')]({},_0xb72173,_0x3ca2df[_0xb087('0x40')]);var _0x3c8f51={'where':_0xb72173['where']};return db[_0xb087('0x29')]['count'](_0x3c8f51)[_0xb087('0x24')](function(_0x5a582d){_0x35a52c[_0xb087('0x1d')]=_0x5a582d;if(_0x3ca2df[_0xb087('0x2f')]['includeAll']){_0xb72173[_0xb087('0x41')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xb087('0x42')](_0xb72173);})['then'](function(_0x2d2c74){_0x35a52c[_0xb087('0x43')]=_0x2d2c74;return _0x35a52c;})[_0xb087('0x24')](respondWithFilteredResult(_0xd9ec66,_0xb72173))[_0xb087('0x44')](handleError(_0xd9ec66,null));};exports[_0xb087('0x45')]=function(_0x2a4787,_0x35d010){var _0x5e7690={'raw':!![],'where':{'id':_0x2a4787['params']['id']}},_0x1625f6={};_0x1625f6[_0xb087('0x2d')]=_[_0xb087('0x30')](db['AnalyticTreeReport'][_0xb087('0x2a')]);_0x1625f6[_0xb087('0x2f')]=_[_0xb087('0x30')](_0x2a4787['query']);_0x1625f6[_0xb087('0x31')]=_['intersection'](_0x1625f6[_0xb087('0x2d')],_0x1625f6[_0xb087('0x2f')]);_0x5e7690['attributes']=_[_0xb087('0x46')](_0x1625f6[_0xb087('0x2d')],qs['fields'](_0x2a4787[_0xb087('0x2f')][_0xb087('0x33')]));_0x5e7690['attributes']=_0x5e7690[_0xb087('0x32')][_0xb087('0x34')]?_0x5e7690[_0xb087('0x32')]:_0x1625f6[_0xb087('0x2d')];if(_0x2a4787['query']['includeAll']){_0x5e7690[_0xb087('0x41')]=[{'all':!![]}];}_0x5e7690=_[_0xb087('0x3c')]({},_0x5e7690,_0x2a4787[_0xb087('0x40')]);return db[_0xb087('0x29')][_0xb087('0x47')](_0x5e7690)[_0xb087('0x24')](handleEntityNotFound(_0x35d010,null))['then'](respondWithResult(_0x35d010,null))['catch'](handleError(_0x35d010,null));};exports[_0xb087('0x48')]=function(_0x520acc,_0x3a405b){return db[_0xb087('0x29')][_0xb087('0x48')](_0x520acc[_0xb087('0x49')],{})['then'](respondWithResult(_0x3a405b,0xc9))[_0xb087('0x44')](handleError(_0x3a405b,null));};exports['update']=function(_0x2fe8a0,_0x73413b){if(_0x2fe8a0[_0xb087('0x49')]['id']){delete _0x2fe8a0[_0xb087('0x49')]['id'];}return db[_0xb087('0x29')]['find']({'where':{'id':_0x2fe8a0[_0xb087('0x4a')]['id']}})[_0xb087('0x24')](handleEntityNotFound(_0x73413b,null))[_0xb087('0x24')](saveUpdates(_0x2fe8a0['body'],null))[_0xb087('0x24')](respondWithResult(_0x73413b,null))['catch'](handleError(_0x73413b,null));};exports['destroy']=function(_0x1c9f8f,_0x341665){return db['AnalyticTreeReport'][_0xb087('0x47')]({'where':{'id':_0x1c9f8f[_0xb087('0x4a')]['id']}})[_0xb087('0x24')](handleEntityNotFound(_0x341665,null))['then'](removeEntity(_0x341665,null))['catch'](handleError(_0x341665,null));}; \ No newline at end of file +var _0xa571=['set','apply','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticTreeReport','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','count','offset','limit'];(function(_0x100f83,_0x4ea15b){var _0x24761e=function(_0x4dad43){while(--_0x4dad43){_0x100f83['push'](_0x100f83['shift']());}};_0x24761e(++_0x4ea15b);}(_0xa571,0x107));var _0x1a57=function(_0x3356ad,_0x3df2c0){_0x3356ad=_0x3356ad-0x0;var _0x3cecec=_0xa571[_0x3356ad];return _0x3cecec;};'use strict';var pdf=require(_0x1a57('0x0'));var emlformat=require(_0x1a57('0x1'));var rimraf=require(_0x1a57('0x2'));var zipdir=require(_0x1a57('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a57('0x4'));var moment=require(_0x1a57('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a57('0x6'));var path=require('path');var sox=require(_0x1a57('0x7'));var csv=require(_0x1a57('0x8'));var ejs=require(_0x1a57('0x9'));var fs=require('fs');var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x8'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2256af,_0x1911b2){_0x1911b2=_0x1911b2||0xcc;return function(_0x202d9a){if(_0x202d9a){return _0x2256af['sendStatus'](_0x1911b2);}return _0x2256af[_0x1a57('0x17')](_0x1911b2)[_0x1a57('0x18')]();};}function respondWithResult(_0x4c5ed4,_0x503278){_0x503278=_0x503278||0xc8;return function(_0x587422){if(_0x587422){return _0x4c5ed4[_0x1a57('0x17')](_0x503278)[_0x1a57('0x19')](_0x587422);}};}function respondWithFilteredResult(_0x27e824,_0x153d01){return function(_0x5802d6){if(_0x5802d6){var _0x20f7ad=_0x5802d6[_0x1a57('0x1a')],_0x53c61f=_0x153d01[_0x1a57('0x1b')],_0x49ee05=_0x153d01['offset']+_0x153d01[_0x1a57('0x1c')],_0x1b58d7;if(_0x49ee05>=_0x20f7ad){_0x49ee05=_0x20f7ad;_0x1b58d7=0xc8;}else{_0x1b58d7=0xce;}_0x27e824[_0x1a57('0x17')](_0x1b58d7);return _0x27e824[_0x1a57('0x1d')]('Content-Range',_0x53c61f+'-'+_0x49ee05+'/'+_0x20f7ad)[_0x1a57('0x19')](_0x5802d6);}return null;};}function patchUpdates(_0x4262c8){return function(_0x451b34){try{jsonpatch[_0x1a57('0x1e')](_0x451b34,_0x4262c8,!![]);}catch(_0xe936dd){return BPromise['reject'](_0xe936dd);}return _0x451b34['save']();};}function saveUpdates(_0x439844,_0x21e811){return function(_0x211c63){if(_0x211c63){return _0x211c63['update'](_0x439844)['then'](function(_0x51e271){return _0x51e271;});}return null;};}function removeEntity(_0x154cf3,_0x113ad4){return function(_0x3f52b9){if(_0x3f52b9){return _0x3f52b9[_0x1a57('0x1f')]()[_0x1a57('0x20')](function(){_0x154cf3[_0x1a57('0x17')](0xcc)[_0x1a57('0x18')]();});}};}function handleEntityNotFound(_0x2f8b00,_0x183ca3){return function(_0x35d5dc){if(!_0x35d5dc){_0x2f8b00[_0x1a57('0x21')](0x194);}return _0x35d5dc;};}function handleError(_0x36b17e,_0x26cdd3){_0x26cdd3=_0x26cdd3||0x1f4;return function(_0x1b4cb5){logger[_0x1a57('0x22')](_0x1b4cb5[_0x1a57('0x23')]);if(_0x1b4cb5[_0x1a57('0x24')]){delete _0x1b4cb5[_0x1a57('0x24')];}_0x36b17e[_0x1a57('0x17')](_0x26cdd3)[_0x1a57('0x25')](_0x1b4cb5);};}exports[_0x1a57('0x26')]=function(_0x1dd939,_0x5a53c8){var _0x530401={},_0x139d8c={},_0x22549f={'count':0x0,'rows':[]};var _0x545041=_[_0x1a57('0x27')](db['AnalyticTreeReport'][_0x1a57('0x28')],function(_0x4a2901){return{'name':_0x4a2901['fieldName'],'type':_0x4a2901[_0x1a57('0x29')][_0x1a57('0x2a')]};});_0x139d8c[_0x1a57('0x2b')]=_[_0x1a57('0x27')](_0x545041,'name');_0x139d8c[_0x1a57('0x2c')]=_[_0x1a57('0x2d')](_0x1dd939[_0x1a57('0x2c')]);_0x139d8c[_0x1a57('0x2e')]=_['intersection'](_0x139d8c[_0x1a57('0x2b')],_0x139d8c[_0x1a57('0x2c')]);_0x530401[_0x1a57('0x2f')]=_[_0x1a57('0x30')](_0x139d8c[_0x1a57('0x2b')],qs[_0x1a57('0x31')](_0x1dd939[_0x1a57('0x2c')][_0x1a57('0x31')]));_0x530401[_0x1a57('0x2f')]=_0x530401['attributes'][_0x1a57('0x32')]?_0x530401[_0x1a57('0x2f')]:_0x139d8c['model'];if(!_0x1dd939['query'][_0x1a57('0x33')](_0x1a57('0x34'))){_0x530401[_0x1a57('0x1c')]=qs[_0x1a57('0x1c')](_0x1dd939[_0x1a57('0x2c')][_0x1a57('0x1c')]);_0x530401[_0x1a57('0x1b')]=qs[_0x1a57('0x1b')](_0x1dd939[_0x1a57('0x2c')][_0x1a57('0x1b')]);}_0x530401[_0x1a57('0x35')]=qs[_0x1a57('0x36')](_0x1dd939[_0x1a57('0x2c')][_0x1a57('0x36')]);_0x530401[_0x1a57('0x37')]=qs[_0x1a57('0x2e')](_[_0x1a57('0x38')](_0x1dd939[_0x1a57('0x2c')],_0x139d8c['filters']));if(_0x1dd939[_0x1a57('0x2c')][_0x1a57('0x39')]){_0x530401[_0x1a57('0x37')]=_[_0x1a57('0x3a')](_0x530401[_0x1a57('0x37')],{'$or':_[_0x1a57('0x27')](_0x545041,function(_0x939976){if(_0x939976[_0x1a57('0x29')]!==_0x1a57('0x3b')){var _0x490119={};_0x490119[_0x939976['name']]={'$like':'%'+_0x1dd939['query']['filter']+'%'};return _0x490119;}})});}_0x530401=_[_0x1a57('0x3a')]({},_0x530401,_0x1dd939[_0x1a57('0x3c')]);var _0xf58eb9={'where':_0x530401['where']};return db[_0x1a57('0x3d')][_0x1a57('0x1a')](_0xf58eb9)[_0x1a57('0x20')](function(_0x347d91){_0x22549f['count']=_0x347d91;if(_0x1dd939[_0x1a57('0x2c')]['includeAll']){_0x530401[_0x1a57('0x3e')]=[{'all':!![]}];}return db[_0x1a57('0x3d')][_0x1a57('0x3f')](_0x530401);})['then'](function(_0x1848cc){_0x22549f[_0x1a57('0x40')]=_0x1848cc;return _0x22549f;})[_0x1a57('0x20')](respondWithFilteredResult(_0x5a53c8,_0x530401))[_0x1a57('0x41')](handleError(_0x5a53c8,null));};exports[_0x1a57('0x42')]=function(_0x528ed3,_0x2eeb71){var _0x47e998={'raw':!![],'where':{'id':_0x528ed3[_0x1a57('0x43')]['id']}},_0x4ba6b3={};_0x4ba6b3['model']=_[_0x1a57('0x2d')](db[_0x1a57('0x3d')][_0x1a57('0x28')]);_0x4ba6b3['query']=_[_0x1a57('0x2d')](_0x528ed3[_0x1a57('0x2c')]);_0x4ba6b3[_0x1a57('0x2e')]=_[_0x1a57('0x30')](_0x4ba6b3['model'],_0x4ba6b3[_0x1a57('0x2c')]);_0x47e998[_0x1a57('0x2f')]=_['intersection'](_0x4ba6b3[_0x1a57('0x2b')],qs['fields'](_0x528ed3['query'][_0x1a57('0x31')]));_0x47e998[_0x1a57('0x2f')]=_0x47e998[_0x1a57('0x2f')][_0x1a57('0x32')]?_0x47e998['attributes']:_0x4ba6b3[_0x1a57('0x2b')];if(_0x528ed3[_0x1a57('0x2c')][_0x1a57('0x44')]){_0x47e998[_0x1a57('0x3e')]=[{'all':!![]}];}_0x47e998=_[_0x1a57('0x3a')]({},_0x47e998,_0x528ed3['options']);return db[_0x1a57('0x3d')][_0x1a57('0x45')](_0x47e998)[_0x1a57('0x20')](handleEntityNotFound(_0x2eeb71,null))[_0x1a57('0x20')](respondWithResult(_0x2eeb71,null))['catch'](handleError(_0x2eeb71,null));};exports[_0x1a57('0x46')]=function(_0x5f1d5f,_0x4bbfc3){return db[_0x1a57('0x3d')][_0x1a57('0x46')](_0x5f1d5f[_0x1a57('0x47')],{})[_0x1a57('0x20')](respondWithResult(_0x4bbfc3,0xc9))[_0x1a57('0x41')](handleError(_0x4bbfc3,null));};exports[_0x1a57('0x48')]=function(_0x401285,_0x29fe1f){if(_0x401285[_0x1a57('0x47')]['id']){delete _0x401285[_0x1a57('0x47')]['id'];}return db[_0x1a57('0x3d')][_0x1a57('0x45')]({'where':{'id':_0x401285['params']['id']}})[_0x1a57('0x20')](handleEntityNotFound(_0x29fe1f,null))[_0x1a57('0x20')](saveUpdates(_0x401285[_0x1a57('0x47')],null))[_0x1a57('0x20')](respondWithResult(_0x29fe1f,null))[_0x1a57('0x41')](handleError(_0x29fe1f,null));};exports[_0x1a57('0x1f')]=function(_0x323af1,_0x3cbb9e){return db[_0x1a57('0x3d')][_0x1a57('0x45')]({'where':{'id':_0x323af1[_0x1a57('0x43')]['id']}})['then'](handleEntityNotFound(_0x3cbb9e,null))[_0x1a57('0x20')](removeEntity(_0x3cbb9e,null))[_0x1a57('0x41')](handleError(_0x3cbb9e,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 90235fa..77c32ce 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 _0xf693=['request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','moment','bluebird'];(function(_0x4e0359,_0x205155){var _0x450f0a=function(_0x2056c6){while(--_0x2056c6){_0x4e0359['push'](_0x4e0359['shift']());}};_0x450f0a(++_0x205155);}(_0xf693,0x181));var _0x3f69=function(_0x57b6ef,_0x325aea){_0x57b6ef=_0x57b6ef-0x0;var _0xec812b=_0xf693[_0x57b6ef];return _0xec812b;};'use strict';var _=require('lodash');var util=require(_0x3f69('0x0'));var logger=require(_0x3f69('0x1'))(_0x3f69('0x2'));var moment=require(_0x3f69('0x3'));var BPromise=require(_0x3f69('0x4'));var rp=require(_0x3f69('0x5'));var fs=require('fs');var path=require(_0x3f69('0x6'));var rimraf=require('rimraf');var config=require(_0x3f69('0x7'));var attributes=require(_0x3f69('0x8'));module[_0x3f69('0x9')]=function(_0x489d4d,_0x3e4c37){return _0x489d4d[_0x3f69('0xa')](_0x3f69('0xb'),attributes,{'tableName':_0x3f69('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffd6=['path','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x3df871,_0xda2e11){var _0x570f7b=function(_0xfaac78){while(--_0xfaac78){_0x3df871['push'](_0x3df871['shift']());}};_0x570f7b(++_0xda2e11);}(_0xffd6,0x97));var _0x6ffd=function(_0x12b683,_0x124186){_0x12b683=_0x12b683-0x0;var _0xfb150b=_0xffd6[_0x12b683];return _0xfb150b;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var logger=require(_0x6ffd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ffd('0x3'));var rp=require(_0x6ffd('0x4'));var fs=require('fs');var path=require(_0x6ffd('0x5'));var rimraf=require('rimraf');var config=require(_0x6ffd('0x6'));var attributes=require(_0x6ffd('0x7'));module[_0x6ffd('0x8')]=function(_0x2949a4,_0x561055){return _0x2949a4[_0x6ffd('0x9')](_0x6ffd('0xa'),attributes,{'tableName':_0x6ffd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 17f7762..7fa9217 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 _0x1077=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x375072,_0x1ad2ed){var _0x3e82e7=function(_0x2a03ec){while(--_0x2a03ec){_0x375072['push'](_0x375072['shift']());}};_0x3e82e7(++_0x1ad2ed);}(_0x1077,0x162));var _0x7107=function(_0x4d563c,_0x3be4e9){_0x4d563c=_0x4d563c-0x0;var _0x4f1b03=_0x1077[_0x4d563c];return _0x4f1b03;};'use strict';var _=require(_0x7107('0x0'));var util=require('util');var moment=require(_0x7107('0x1'));var BPromise=require(_0x7107('0x2'));var rs=require(_0x7107('0x3'));var fs=require('fs');var Redis=require(_0x7107('0x4'));var db=require(_0x7107('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7107('0x6'))('rpc');var config=require(_0x7107('0x7'));var jayson=require(_0x7107('0x8'));var client=jayson[_0x7107('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c995a,_0x504d98,_0x445601){return new BPromise(function(_0x43435a,_0x4c8478){return client[_0x7107('0xa')](_0x1c995a,_0x445601)[_0x7107('0xb')](function(_0x768fe2){logger[_0x7107('0xc')](_0x7107('0xd'),_0x504d98,_0x7107('0xe'));logger['debug'](_0x7107('0xf'),_0x504d98,_0x7107('0xe'),JSON[_0x7107('0x10')](_0x768fe2));if(_0x768fe2['error']){if(_0x768fe2['error'][_0x7107('0x11')]===0x1f4){logger['error'](_0x7107('0xd'),_0x504d98,_0x768fe2[_0x7107('0x12')]['message']);return _0x4c8478(_0x768fe2['error'][_0x7107('0x13')]);}logger[_0x7107('0x12')](_0x7107('0xd'),_0x504d98,_0x768fe2['error'][_0x7107('0x13')]);return _0x43435a(_0x768fe2['error']['message']);}else{logger[_0x7107('0xc')](_0x7107('0xd'),_0x504d98,_0x7107('0xe'));_0x43435a(_0x768fe2[_0x7107('0x14')][_0x7107('0x13')]);}})[_0x7107('0x15')](function(_0x3a1e48){logger['error'](_0x7107('0xd'),_0x504d98,_0x3a1e48);_0x4c8478(_0x3a1e48);});});} \ No newline at end of file +var _0x1ea2=['result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4ced0c,_0x165f3c){var _0xcafda4=function(_0x926ab2){while(--_0x926ab2){_0x4ced0c['push'](_0x4ced0c['shift']());}};_0xcafda4(++_0x165f3c);}(_0x1ea2,0x161));var _0x21ea=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x1ea2[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x21ea('0x0'));var util=require(_0x21ea('0x1'));var moment=require(_0x21ea('0x2'));var BPromise=require(_0x21ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x21ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x21ea('0x5'));var logger=require(_0x21ea('0x6'))(_0x21ea('0x7'));var config=require(_0x21ea('0x8'));var jayson=require(_0x21ea('0x9'));var client=jayson[_0x21ea('0xa')][_0x21ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cb8be,_0x2cdcce,_0x2c46bb){return new BPromise(function(_0x36bd56,_0x16b44f){return client['request'](_0x2cb8be,_0x2c46bb)[_0x21ea('0xc')](function(_0x2a0589){logger[_0x21ea('0xd')](_0x21ea('0xe'),_0x2cdcce,_0x21ea('0xf'));logger[_0x21ea('0x10')](_0x21ea('0x11'),_0x2cdcce,_0x21ea('0xf'),JSON[_0x21ea('0x12')](_0x2a0589));if(_0x2a0589[_0x21ea('0x13')]){if(_0x2a0589[_0x21ea('0x13')]['code']===0x1f4){logger[_0x21ea('0x13')](_0x21ea('0xe'),_0x2cdcce,_0x2a0589[_0x21ea('0x13')][_0x21ea('0x14')]);return _0x16b44f(_0x2a0589[_0x21ea('0x13')]['message']);}logger['error'](_0x21ea('0xe'),_0x2cdcce,_0x2a0589[_0x21ea('0x13')][_0x21ea('0x14')]);return _0x36bd56(_0x2a0589[_0x21ea('0x13')][_0x21ea('0x14')]);}else{logger['info'](_0x21ea('0xe'),_0x2cdcce,_0x21ea('0xf'));_0x36bd56(_0x2a0589[_0x21ea('0x15')][_0x21ea('0x14')]);}})['catch'](function(_0x100ab1){logger[_0x21ea('0x13')](_0x21ea('0xe'),_0x2cdcce,_0x100ab1);_0x16b44f(_0x100ab1);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 8c4420f..f350905 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 _0x84e5=['create','put','update','delete','/:id','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','show','post'];(function(_0x46b5a8,_0x38d50b){var _0x425e38=function(_0x7f4c52){while(--_0x7f4c52){_0x46b5a8['push'](_0x46b5a8['shift']());}};_0x425e38(++_0x38d50b);}(_0x84e5,0x191));var _0x584e=function(_0x2cc711,_0x300328){_0x2cc711=_0x2cc711-0x0;var _0x31a52e=_0x84e5[_0x2cc711];return _0x31a52e;};'use strict';var multer=require(_0x584e('0x0'));var util=require('util');var path=require(_0x584e('0x1'));var timeout=require(_0x584e('0x2'));var express=require(_0x584e('0x3'));var router=express[_0x584e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x584e('0x5'));var config=require(_0x584e('0x6'));var controller=require(_0x584e('0x7'));router['get']('/',auth[_0x584e('0x8')](),controller[_0x584e('0x9')]);router[_0x584e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x584e('0xb')]);router[_0x584e('0xc')]('/',auth[_0x584e('0x8')](),controller[_0x584e('0xd')]);router[_0x584e('0xe')]('/:id',auth[_0x584e('0x8')](),controller[_0x584e('0xf')]);router[_0x584e('0x10')](_0x584e('0x11'),auth[_0x584e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8b42=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x5b62f1,_0x1a04d1){var _0x5c684b=function(_0xcfbe0f){while(--_0xcfbe0f){_0x5b62f1['push'](_0x5b62f1['shift']());}};_0x5c684b(++_0x1a04d1);}(_0x8b42,0xfd));var _0x28b4=function(_0x148858,_0x54d0b9){_0x148858=_0x148858-0x0;var _0x4fc9a4=_0x8b42[_0x148858];return _0x4fc9a4;};'use strict';var multer=require(_0x28b4('0x0'));var util=require('util');var path=require(_0x28b4('0x1'));var timeout=require(_0x28b4('0x2'));var express=require(_0x28b4('0x3'));var router=express[_0x28b4('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x28b4('0x5'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0x28b4('0x6')]('/',auth[_0x28b4('0x7')](),controller[_0x28b4('0x8')]);router[_0x28b4('0x6')](_0x28b4('0x9'),auth[_0x28b4('0x7')](),controller[_0x28b4('0xa')]);router[_0x28b4('0xb')]('/',auth[_0x28b4('0x7')](),controller[_0x28b4('0xc')]);router[_0x28b4('0xd')]('/:id',auth[_0x28b4('0x7')](),controller[_0x28b4('0xe')]);router[_0x28b4('0xf')](_0x28b4('0x9'),auth[_0x28b4('0x7')](),controller[_0x28b4('0x10')]);module[_0x28b4('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 6c36cd6..9976524 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 _0xe139=['exports','STRING','sequelize'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xe139,0x15b));var _0x9e13=function(_0x57fa72,_0x25a252){_0x57fa72=_0x57fa72-0x0;var _0x3f9bcc=_0xe139[_0x57fa72];return _0x3f9bcc;};'use strict';var Sequelize=require(_0x9e13('0x0'));module[_0x9e13('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x9e13('0x2')]},'type':{'type':Sequelize[_0x9e13('0x2')]}}; \ No newline at end of file +var _0xe102=['sequelize','exports','STRING'];(function(_0x3209fe,_0x2bb16b){var _0x11897d=function(_0x2bc4b9){while(--_0x2bc4b9){_0x3209fe['push'](_0x3209fe['shift']());}};_0x11897d(++_0x2bb16b);}(_0xe102,0xb4));var _0x2e10=function(_0x20065a,_0x518563){_0x20065a=_0x20065a-0x0;var _0x10b3c4=_0xe102[_0x20065a];return _0x10b3c4;};'use strict';var Sequelize=require(_0x2e10('0x0'));module[_0x2e10('0x1')]={'name':{'type':Sequelize[_0x2e10('0x2')]},'basename':{'type':Sequelize[_0x2e10('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 634e0d6..58dc708 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 _0x479c=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','Attachment','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','count','includeAll','findAll','rows','catch','show','params','include','clone','options','find','omit','createdAt','updatedAt','body','create','file','basename','filename','mimetype','download','join','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x479c,0x14a));var _0xc479=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x479c[_0x4a9fb1];return _0x348672;};'use strict';var pdf=require(_0xc479('0x0'));var emlformat=require(_0xc479('0x1'));var rimraf=require(_0xc479('0x2'));var zipdir=require(_0xc479('0x3'));var jsonpatch=require(_0xc479('0x4'));var rp=require('request-promise');var moment=require(_0xc479('0x5'));var BPromise=require(_0xc479('0x6'));var Mustache=require(_0xc479('0x7'));var util=require(_0xc479('0x8'));var path=require(_0xc479('0x9'));var sox=require(_0xc479('0xa'));var csv=require('to-csv');var ejs=require(_0xc479('0xb'));var fs=require('fs');var _=require(_0xc479('0xc'));var squel=require(_0xc479('0xd'));var crypto=require(_0xc479('0xe'));var jsforce=require(_0xc479('0xf'));var deskjs=require(_0xc479('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc479('0x11'));var Papa=require(_0xc479('0x12'));var Redis=require('ioredis');var authService=require(_0xc479('0x13'));var qs=require(_0xc479('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc479('0x15'));var logger=require(_0xc479('0x16'))(_0xc479('0x17'));var utils=require(_0xc479('0x18'));var config=require(_0xc479('0x19'));var db=require(_0xc479('0x1a'))['db'];function respondWithStatusCode(_0x84f9ca,_0x2a261a){_0x2a261a=_0x2a261a||0xcc;return function(_0x4fb67b){if(_0x4fb67b){return _0x84f9ca[_0xc479('0x1b')](_0x2a261a);}return _0x84f9ca['status'](_0x2a261a)[_0xc479('0x1c')]();};}function respondWithResult(_0x31f5af,_0x104721){_0x104721=_0x104721||0xc8;return function(_0x5e0f20){if(_0x5e0f20){return _0x31f5af[_0xc479('0x1d')](_0x104721)['json'](_0x5e0f20);}};}function respondWithFilteredResult(_0x2d1401,_0x51f610){return function(_0x551bad){if(_0x551bad){var _0xaec12f=_0x551bad['count'],_0x5bc7ee=_0x51f610[_0xc479('0x1e')],_0x53ca45=_0x51f610[_0xc479('0x1e')]+_0x51f610[_0xc479('0x1f')],_0x1f450d;if(_0x53ca45>=_0xaec12f){_0x53ca45=_0xaec12f;_0x1f450d=0xc8;}else{_0x1f450d=0xce;}_0x2d1401[_0xc479('0x1d')](_0x1f450d);return _0x2d1401['set'](_0xc479('0x20'),_0x5bc7ee+'-'+_0x53ca45+'/'+_0xaec12f)['json'](_0x551bad);}return null;};}function patchUpdates(_0x4a3ed6){return function(_0x3d7d20){try{jsonpatch[_0xc479('0x21')](_0x3d7d20,_0x4a3ed6,!![]);}catch(_0x26921e){return BPromise[_0xc479('0x22')](_0x26921e);}return _0x3d7d20[_0xc479('0x23')]();};}function saveUpdates(_0x1a4e3c,_0x2ab9e1){return function(_0xda51f7){if(_0xda51f7){return _0xda51f7[_0xc479('0x24')](_0x1a4e3c)[_0xc479('0x25')](function(_0x376c83){return _0x376c83;});}return null;};}function removeEntity(_0x255724,_0x43448f){return function(_0x1468ea){if(_0x1468ea){return _0x1468ea[_0xc479('0x26')]()[_0xc479('0x25')](function(){_0x255724[_0xc479('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c7a3e,_0x446818){return function(_0x44ecc4){if(!_0x44ecc4){_0x6c7a3e[_0xc479('0x1b')](0x194);}return _0x44ecc4;};}function handleError(_0x7f3f51,_0x411646){_0x411646=_0x411646||0x1f4;return function(_0x279c6e){logger[_0xc479('0x27')](_0x279c6e[_0xc479('0x28')]);if(_0x279c6e[_0xc479('0x29')]){delete _0x279c6e['name'];}_0x7f3f51[_0xc479('0x1d')](_0x411646)['send'](_0x279c6e);};}exports[_0xc479('0x2a')]=function(_0x36b323,_0x353dea){var _0x394798={},_0x5853ca={},_0x27fe9a={'count':0x0,'rows':[]};var _0xeed629=_[_0xc479('0x2b')](db[_0xc479('0x2c')][_0xc479('0x2d')],function(_0x4799ef){return{'name':_0x4799ef[_0xc479('0x2e')],'type':_0x4799ef[_0xc479('0x2f')][_0xc479('0x30')]};});_0x5853ca[_0xc479('0x31')]=_[_0xc479('0x2b')](_0xeed629,'name');_0x5853ca['query']=_[_0xc479('0x32')](_0x36b323[_0xc479('0x33')]);_0x5853ca[_0xc479('0x34')]=_[_0xc479('0x35')](_0x5853ca[_0xc479('0x31')],_0x5853ca['query']);_0x394798[_0xc479('0x36')]=_[_0xc479('0x35')](_0x5853ca[_0xc479('0x31')],qs[_0xc479('0x37')](_0x36b323[_0xc479('0x33')][_0xc479('0x37')]));_0x394798[_0xc479('0x36')]=_0x394798['attributes'][_0xc479('0x38')]?_0x394798[_0xc479('0x36')]:_0x5853ca[_0xc479('0x31')];if(!_0x36b323[_0xc479('0x33')][_0xc479('0x39')](_0xc479('0x3a'))){_0x394798[_0xc479('0x1f')]=qs[_0xc479('0x1f')](_0x36b323[_0xc479('0x33')][_0xc479('0x1f')]);_0x394798[_0xc479('0x1e')]=qs[_0xc479('0x1e')](_0x36b323[_0xc479('0x33')][_0xc479('0x1e')]);}_0x394798['order']=qs[_0xc479('0x3b')](_0x36b323['query'][_0xc479('0x3b')]);_0x394798['where']=qs[_0xc479('0x34')](_['pick'](_0x36b323['query'],_0x5853ca[_0xc479('0x34')]));if(_0x36b323[_0xc479('0x33')][_0xc479('0x3c')]){_0x394798['where']=_['merge'](_0x394798[_0xc479('0x3d')],{'$or':_[_0xc479('0x2b')](_0xeed629,function(_0x2f0e89){if(_0x2f0e89[_0xc479('0x2f')]!==_0xc479('0x3e')){var _0x78a4e6={};_0x78a4e6[_0x2f0e89[_0xc479('0x29')]]={'$like':'%'+_0x36b323['query'][_0xc479('0x3c')]+'%'};return _0x78a4e6;}})});}_0x394798=_[_0xc479('0x3f')]({},_0x394798,_0x36b323['options']);var _0x1235eb={'where':_0x394798[_0xc479('0x3d')]};return db[_0xc479('0x2c')]['count'](_0x1235eb)[_0xc479('0x25')](function(_0x2528c8){_0x27fe9a[_0xc479('0x40')]=_0x2528c8;if(_0x36b323[_0xc479('0x33')][_0xc479('0x41')]){_0x394798['include']=[{'all':!![]}];}return db[_0xc479('0x2c')][_0xc479('0x42')](_0x394798);})[_0xc479('0x25')](function(_0xfcde1f){_0x27fe9a[_0xc479('0x43')]=_0xfcde1f;return _0x27fe9a;})[_0xc479('0x25')](respondWithFilteredResult(_0x353dea,_0x394798))[_0xc479('0x44')](handleError(_0x353dea,null));};exports[_0xc479('0x45')]=function(_0x4b1934,_0x447d83){var _0x57e125={'raw':!![],'where':{'id':_0x4b1934[_0xc479('0x46')]['id']}},_0x32b1bf={};_0x32b1bf[_0xc479('0x31')]=_[_0xc479('0x32')](db[_0xc479('0x2c')][_0xc479('0x2d')]);_0x32b1bf[_0xc479('0x33')]=_[_0xc479('0x32')](_0x4b1934['query']);_0x32b1bf[_0xc479('0x34')]=_[_0xc479('0x35')](_0x32b1bf[_0xc479('0x31')],_0x32b1bf[_0xc479('0x33')]);_0x57e125[_0xc479('0x36')]=_[_0xc479('0x35')](_0x32b1bf[_0xc479('0x31')],qs[_0xc479('0x37')](_0x4b1934[_0xc479('0x33')][_0xc479('0x37')]));_0x57e125[_0xc479('0x36')]=_0x57e125[_0xc479('0x36')][_0xc479('0x38')]?_0x57e125['attributes']:_0x32b1bf[_0xc479('0x31')];if(_0x4b1934['query'][_0xc479('0x41')]){_0x57e125[_0xc479('0x47')]=[{'all':!![]}];}_0x57e125=_['merge']({},_0x57e125,_0x4b1934['options']);return db['Attachment']['find'](_0x57e125)[_0xc479('0x25')](handleEntityNotFound(_0x447d83,null))['then'](respondWithResult(_0x447d83,null))[_0xc479('0x44')](handleError(_0x447d83,null));};exports[_0xc479('0x48')]=function(_0x3a1956,_0x35ca9c){var _0x4b6ba6={'where':{'id':_0x3a1956[_0xc479('0x46')]['id']}},_0xf7062e={};_0xf7062e['model']=_[_0xc479('0x32')](db[_0xc479('0x2c')][_0xc479('0x2d')]);_0x4b6ba6[_0xc479('0x36')]=_['intersection'](_0xf7062e[_0xc479('0x31')],qs['fields'](_0x3a1956[_0xc479('0x33')][_0xc479('0x37')]));_0x4b6ba6[_0xc479('0x36')]=_0x4b6ba6[_0xc479('0x36')][_0xc479('0x38')]?_0x4b6ba6[_0xc479('0x36')]:_0xf7062e[_0xc479('0x31')];if(_0x3a1956[_0xc479('0x33')]['includeAll']){_0x4b6ba6[_0xc479('0x47')]=[{'all':!![]}];}_0x4b6ba6=_[_0xc479('0x3f')]({},_0x4b6ba6,_0x3a1956[_0xc479('0x49')]);return db[_0xc479('0x2c')][_0xc479('0x4a')](_0x4b6ba6)[_0xc479('0x25')](handleEntityNotFound(_0x35ca9c,null))['then'](function(_0x1d4fcc){if(_0x1d4fcc){var _0x5c3753=_0x1d4fcc['get']({'plain':!![]});_0x5c3753=qs[_0xc479('0x4b')](_0x5c3753,['id',_0xc479('0x4c'),_0xc479('0x4d')]);_0x3a1956['body']=_['omit'](_0x3a1956[_0xc479('0x4e')],['id','createdAt',_0xc479('0x4d')]);return db[_0xc479('0x2c')][_0xc479('0x4f')](_[_0xc479('0x3f')](_0x5c3753,_0x3a1956[_0xc479('0x4e')]),{'include':_0x3a1956[_0xc479('0x33')][_0xc479('0x41')]?[{'all':!![]}]:undefined});}})[_0xc479('0x25')](respondWithResult(_0x35ca9c,0xc9))[_0xc479('0x44')](handleError(_0x35ca9c,null));};exports[_0xc479('0x24')]=function(_0x231601,_0x431995){if(_0x231601['body']['id']){delete _0x231601[_0xc479('0x4e')]['id'];}return db['Attachment'][_0xc479('0x4a')]({'where':{'id':_0x231601['params']['id']}})[_0xc479('0x25')](handleEntityNotFound(_0x431995,null))[_0xc479('0x25')](saveUpdates(_0x231601[_0xc479('0x4e')],null))['then'](respondWithResult(_0x431995,null))['catch'](handleError(_0x431995,null));};exports[_0xc479('0x26')]=function(_0x3cdaa6,_0x692de8){return db['Attachment'][_0xc479('0x4a')]({'where':{'id':_0x3cdaa6[_0xc479('0x46')]['id']}})['then'](handleEntityNotFound(_0x692de8,null))['then'](removeEntity(_0x692de8,null))[_0xc479('0x44')](handleError(_0x692de8,null));};exports[_0xc479('0x4f')]=function(_0x14498d,_0x13a793,_0x2e872a){_0x14498d[_0xc479('0x4e')]['name']=_0x14498d[_0xc479('0x50')]['originalname'];_0x14498d[_0xc479('0x4e')][_0xc479('0x51')]=_0x14498d[_0xc479('0x50')][_0xc479('0x52')];_0x14498d[_0xc479('0x4e')]['type']=_0x14498d[_0xc479('0x50')][_0xc479('0x53')];return db['Attachment'][_0xc479('0x4f')](_0x14498d[_0xc479('0x4e')])[_0xc479('0x25')](respondWithResult(_0x13a793,0xc9))[_0xc479('0x44')](handleError(_0x13a793,null));};exports[_0xc479('0x54')]=function(_0x4cb777,_0x4416e6,_0x4d219f){return db['Attachment']['findOne']({'where':{'id':_0x4cb777['params']['id']},'raw':!![]})[_0xc479('0x25')](handleEntityNotFound(_0x4416e6,null))[_0xc479('0x25')](function(_0x2326a5){if(_0x2326a5){return _0x4416e6[_0xc479('0x54')](path[_0xc479('0x55')](config['root'],_0xc479('0x56'),_0x2326a5['basename']));}})[_0xc479('0x44')](handleError(_0x4416e6,null));}; \ No newline at end of file +var _0x7a3c=['save','update','then','destroy','error','stack','name','send','index','Attachment','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','options','include','findAll','rows','catch','show','rawAttributes','keys','intersection','includeAll','find','clone','params','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','mimetype','download','findOne','join','root','server/files/attachments/','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject'];(function(_0x48c9ad,_0x197d1c){var _0x2f2e88=function(_0x28be27){while(--_0x28be27){_0x48c9ad['push'](_0x48c9ad['shift']());}};_0x2f2e88(++_0x197d1c);}(_0x7a3c,0x13f));var _0xc7a3=function(_0x58894c,_0x52a0d9){_0x58894c=_0x58894c-0x0;var _0x2a32e3=_0x7a3c[_0x58894c];return _0x2a32e3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc7a3('0x0'));var rimraf=require(_0xc7a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc7a3('0x2'));var rp=require(_0xc7a3('0x3'));var moment=require(_0xc7a3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc7a3('0x5'));var util=require(_0xc7a3('0x6'));var path=require(_0xc7a3('0x7'));var sox=require(_0xc7a3('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc7a3('0x9'));var squel=require(_0xc7a3('0xa'));var crypto=require(_0xc7a3('0xb'));var jsforce=require(_0xc7a3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc7a3('0xd'));var querystring=require('querystring');var Papa=require(_0xc7a3('0xe'));var Redis=require(_0xc7a3('0xf'));var authService=require(_0xc7a3('0x10'));var qs=require(_0xc7a3('0x11'));var as=require(_0xc7a3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc7a3('0x13'))(_0xc7a3('0x14'));var utils=require('../../config/utils');var config=require(_0xc7a3('0x15'));var db=require(_0xc7a3('0x16'))['db'];function respondWithStatusCode(_0x5f4220,_0x39abfd){_0x39abfd=_0x39abfd||0xcc;return function(_0x4da325){if(_0x4da325){return _0x5f4220[_0xc7a3('0x17')](_0x39abfd);}return _0x5f4220[_0xc7a3('0x18')](_0x39abfd)[_0xc7a3('0x19')]();};}function respondWithResult(_0x1e2045,_0x224bfc){_0x224bfc=_0x224bfc||0xc8;return function(_0x1661f6){if(_0x1661f6){return _0x1e2045['status'](_0x224bfc)[_0xc7a3('0x1a')](_0x1661f6);}};}function respondWithFilteredResult(_0x5920ab,_0x2c511d){return function(_0x2d62e4){if(_0x2d62e4){var _0x18fb9d=_0x2d62e4[_0xc7a3('0x1b')],_0x610c7=_0x2c511d['offset'],_0x277e2f=_0x2c511d[_0xc7a3('0x1c')]+_0x2c511d[_0xc7a3('0x1d')],_0x4951d4;if(_0x277e2f>=_0x18fb9d){_0x277e2f=_0x18fb9d;_0x4951d4=0xc8;}else{_0x4951d4=0xce;}_0x5920ab[_0xc7a3('0x18')](_0x4951d4);return _0x5920ab[_0xc7a3('0x1e')]('Content-Range',_0x610c7+'-'+_0x277e2f+'/'+_0x18fb9d)[_0xc7a3('0x1a')](_0x2d62e4);}return null;};}function patchUpdates(_0x5e9d36){return function(_0x5b30de){try{jsonpatch[_0xc7a3('0x1f')](_0x5b30de,_0x5e9d36,!![]);}catch(_0x3f2bc9){return BPromise[_0xc7a3('0x20')](_0x3f2bc9);}return _0x5b30de[_0xc7a3('0x21')]();};}function saveUpdates(_0x12699f,_0x4b42e6){return function(_0x1361ab){if(_0x1361ab){return _0x1361ab[_0xc7a3('0x22')](_0x12699f)[_0xc7a3('0x23')](function(_0x27f5a8){return _0x27f5a8;});}return null;};}function removeEntity(_0x321111,_0x856cdf){return function(_0x4d09a4){if(_0x4d09a4){return _0x4d09a4[_0xc7a3('0x24')]()[_0xc7a3('0x23')](function(){_0x321111[_0xc7a3('0x18')](0xcc)[_0xc7a3('0x19')]();});}};}function handleEntityNotFound(_0x346725,_0x46190c){return function(_0x5e4a15){if(!_0x5e4a15){_0x346725['sendStatus'](0x194);}return _0x5e4a15;};}function handleError(_0x19f370,_0xa0f36d){_0xa0f36d=_0xa0f36d||0x1f4;return function(_0xf781e){logger[_0xc7a3('0x25')](_0xf781e[_0xc7a3('0x26')]);if(_0xf781e['name']){delete _0xf781e[_0xc7a3('0x27')];}_0x19f370[_0xc7a3('0x18')](_0xa0f36d)[_0xc7a3('0x28')](_0xf781e);};}exports[_0xc7a3('0x29')]=function(_0x180ba3,_0x1eff24){var _0x54024d={},_0x2b0faf={},_0x34bbfa={'count':0x0,'rows':[]};var _0x57dbd6=_['map'](db[_0xc7a3('0x2a')]['rawAttributes'],function(_0x3d66e6){return{'name':_0x3d66e6[_0xc7a3('0x2b')],'type':_0x3d66e6[_0xc7a3('0x2c')][_0xc7a3('0x2d')]};});_0x2b0faf[_0xc7a3('0x2e')]=_['map'](_0x57dbd6,_0xc7a3('0x27'));_0x2b0faf[_0xc7a3('0x2f')]=_['keys'](_0x180ba3[_0xc7a3('0x2f')]);_0x2b0faf['filters']=_['intersection'](_0x2b0faf[_0xc7a3('0x2e')],_0x2b0faf[_0xc7a3('0x2f')]);_0x54024d[_0xc7a3('0x30')]=_['intersection'](_0x2b0faf[_0xc7a3('0x2e')],qs['fields'](_0x180ba3['query'][_0xc7a3('0x31')]));_0x54024d[_0xc7a3('0x30')]=_0x54024d[_0xc7a3('0x30')][_0xc7a3('0x32')]?_0x54024d[_0xc7a3('0x30')]:_0x2b0faf['model'];if(!_0x180ba3[_0xc7a3('0x2f')][_0xc7a3('0x33')]('nolimit')){_0x54024d['limit']=qs[_0xc7a3('0x1d')](_0x180ba3[_0xc7a3('0x2f')][_0xc7a3('0x1d')]);_0x54024d['offset']=qs[_0xc7a3('0x1c')](_0x180ba3[_0xc7a3('0x2f')][_0xc7a3('0x1c')]);}_0x54024d[_0xc7a3('0x34')]=qs['sort'](_0x180ba3[_0xc7a3('0x2f')][_0xc7a3('0x35')]);_0x54024d[_0xc7a3('0x36')]=qs[_0xc7a3('0x37')](_[_0xc7a3('0x38')](_0x180ba3[_0xc7a3('0x2f')],_0x2b0faf[_0xc7a3('0x37')]));if(_0x180ba3[_0xc7a3('0x2f')][_0xc7a3('0x39')]){_0x54024d[_0xc7a3('0x36')]=_[_0xc7a3('0x3a')](_0x54024d[_0xc7a3('0x36')],{'$or':_[_0xc7a3('0x3b')](_0x57dbd6,function(_0x465eda){if(_0x465eda[_0xc7a3('0x2c')]!=='VIRTUAL'){var _0x583af2={};_0x583af2[_0x465eda[_0xc7a3('0x27')]]={'$like':'%'+_0x180ba3[_0xc7a3('0x2f')][_0xc7a3('0x39')]+'%'};return _0x583af2;}})});}_0x54024d=_[_0xc7a3('0x3a')]({},_0x54024d,_0x180ba3[_0xc7a3('0x3c')]);var _0x3c58ed={'where':_0x54024d[_0xc7a3('0x36')]};return db[_0xc7a3('0x2a')][_0xc7a3('0x1b')](_0x3c58ed)['then'](function(_0x248339){_0x34bbfa[_0xc7a3('0x1b')]=_0x248339;if(_0x180ba3[_0xc7a3('0x2f')]['includeAll']){_0x54024d[_0xc7a3('0x3d')]=[{'all':!![]}];}return db[_0xc7a3('0x2a')][_0xc7a3('0x3e')](_0x54024d);})[_0xc7a3('0x23')](function(_0x3faa3e){_0x34bbfa[_0xc7a3('0x3f')]=_0x3faa3e;return _0x34bbfa;})[_0xc7a3('0x23')](respondWithFilteredResult(_0x1eff24,_0x54024d))[_0xc7a3('0x40')](handleError(_0x1eff24,null));};exports[_0xc7a3('0x41')]=function(_0xefa5e4,_0x58e546){var _0x1a1e21={'raw':!![],'where':{'id':_0xefa5e4['params']['id']}},_0x16a236={};_0x16a236[_0xc7a3('0x2e')]=_['keys'](db[_0xc7a3('0x2a')][_0xc7a3('0x42')]);_0x16a236['query']=_[_0xc7a3('0x43')](_0xefa5e4[_0xc7a3('0x2f')]);_0x16a236[_0xc7a3('0x37')]=_[_0xc7a3('0x44')](_0x16a236[_0xc7a3('0x2e')],_0x16a236['query']);_0x1a1e21[_0xc7a3('0x30')]=_['intersection'](_0x16a236[_0xc7a3('0x2e')],qs[_0xc7a3('0x31')](_0xefa5e4[_0xc7a3('0x2f')][_0xc7a3('0x31')]));_0x1a1e21[_0xc7a3('0x30')]=_0x1a1e21[_0xc7a3('0x30')][_0xc7a3('0x32')]?_0x1a1e21[_0xc7a3('0x30')]:_0x16a236[_0xc7a3('0x2e')];if(_0xefa5e4['query'][_0xc7a3('0x45')]){_0x1a1e21[_0xc7a3('0x3d')]=[{'all':!![]}];}_0x1a1e21=_[_0xc7a3('0x3a')]({},_0x1a1e21,_0xefa5e4[_0xc7a3('0x3c')]);return db[_0xc7a3('0x2a')][_0xc7a3('0x46')](_0x1a1e21)[_0xc7a3('0x23')](handleEntityNotFound(_0x58e546,null))[_0xc7a3('0x23')](respondWithResult(_0x58e546,null))[_0xc7a3('0x40')](handleError(_0x58e546,null));};exports[_0xc7a3('0x47')]=function(_0xd6cfe0,_0x499eb1){var _0x1db638={'where':{'id':_0xd6cfe0[_0xc7a3('0x48')]['id']}},_0x37041e={};_0x37041e['model']=_[_0xc7a3('0x43')](db['Attachment'][_0xc7a3('0x42')]);_0x1db638[_0xc7a3('0x30')]=_[_0xc7a3('0x44')](_0x37041e[_0xc7a3('0x2e')],qs[_0xc7a3('0x31')](_0xd6cfe0[_0xc7a3('0x2f')]['fields']));_0x1db638[_0xc7a3('0x30')]=_0x1db638[_0xc7a3('0x30')]['length']?_0x1db638[_0xc7a3('0x30')]:_0x37041e['model'];if(_0xd6cfe0[_0xc7a3('0x2f')][_0xc7a3('0x45')]){_0x1db638[_0xc7a3('0x3d')]=[{'all':!![]}];}_0x1db638=_[_0xc7a3('0x3a')]({},_0x1db638,_0xd6cfe0[_0xc7a3('0x3c')]);return db['Attachment'][_0xc7a3('0x46')](_0x1db638)[_0xc7a3('0x23')](handleEntityNotFound(_0x499eb1,null))[_0xc7a3('0x23')](function(_0x156fa2){if(_0x156fa2){var _0x39f0bb=_0x156fa2[_0xc7a3('0x49')]({'plain':!![]});_0x39f0bb=qs[_0xc7a3('0x4a')](_0x39f0bb,['id',_0xc7a3('0x4b'),_0xc7a3('0x4c')]);_0xd6cfe0[_0xc7a3('0x4d')]=_[_0xc7a3('0x4a')](_0xd6cfe0[_0xc7a3('0x4d')],['id',_0xc7a3('0x4b'),_0xc7a3('0x4c')]);return db[_0xc7a3('0x2a')][_0xc7a3('0x4e')](_[_0xc7a3('0x3a')](_0x39f0bb,_0xd6cfe0[_0xc7a3('0x4d')]),{'include':_0xd6cfe0[_0xc7a3('0x2f')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xc7a3('0x23')](respondWithResult(_0x499eb1,0xc9))[_0xc7a3('0x40')](handleError(_0x499eb1,null));};exports[_0xc7a3('0x22')]=function(_0x2b5bd7,_0x976d6e){if(_0x2b5bd7['body']['id']){delete _0x2b5bd7['body']['id'];}return db['Attachment'][_0xc7a3('0x46')]({'where':{'id':_0x2b5bd7[_0xc7a3('0x48')]['id']}})[_0xc7a3('0x23')](handleEntityNotFound(_0x976d6e,null))[_0xc7a3('0x23')](saveUpdates(_0x2b5bd7[_0xc7a3('0x4d')],null))['then'](respondWithResult(_0x976d6e,null))[_0xc7a3('0x40')](handleError(_0x976d6e,null));};exports[_0xc7a3('0x24')]=function(_0x171da7,_0x750aca){return db[_0xc7a3('0x2a')][_0xc7a3('0x46')]({'where':{'id':_0x171da7[_0xc7a3('0x48')]['id']}})[_0xc7a3('0x23')](handleEntityNotFound(_0x750aca,null))['then'](removeEntity(_0x750aca,null))[_0xc7a3('0x40')](handleError(_0x750aca,null));};exports[_0xc7a3('0x4e')]=function(_0xb7d323,_0x1c1c23,_0x1195f2){_0xb7d323[_0xc7a3('0x4d')][_0xc7a3('0x27')]=_0xb7d323[_0xc7a3('0x4f')][_0xc7a3('0x50')];_0xb7d323[_0xc7a3('0x4d')][_0xc7a3('0x51')]=_0xb7d323['file']['filename'];_0xb7d323[_0xc7a3('0x4d')][_0xc7a3('0x2c')]=_0xb7d323[_0xc7a3('0x4f')][_0xc7a3('0x52')];return db[_0xc7a3('0x2a')][_0xc7a3('0x4e')](_0xb7d323['body'])[_0xc7a3('0x23')](respondWithResult(_0x1c1c23,0xc9))[_0xc7a3('0x40')](handleError(_0x1c1c23,null));};exports[_0xc7a3('0x53')]=function(_0x115263,_0x53d96a,_0x31ec5c){return db[_0xc7a3('0x2a')][_0xc7a3('0x54')]({'where':{'id':_0x115263[_0xc7a3('0x48')]['id']},'raw':!![]})[_0xc7a3('0x23')](handleEntityNotFound(_0x53d96a,null))[_0xc7a3('0x23')](function(_0x50b899){if(_0x50b899){return _0x53d96a[_0xc7a3('0x53')](path[_0xc7a3('0x55')](config[_0xc7a3('0x56')],_0xc7a3('0x57'),_0x50b899[_0xc7a3('0x51')]));}})['catch'](handleError(_0x53d96a,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index ae09ceb..86ebad8 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 _0x1131=['define','util','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0x1131,0x71));var _0x1113=function(_0x4c23f4,_0x252435){_0x4c23f4=_0x4c23f4-0x0;var _0x43f49d=_0x1131[_0x4c23f4];return _0x43f49d;};'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 +var _0x1eba=['define','Attachment','attachments','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./attachment.attributes','exports'];(function(_0x15f571,_0x26eac9){var _0x5625ae=function(_0x3ea717){while(--_0x3ea717){_0x15f571['push'](_0x15f571['shift']());}};_0x5625ae(++_0x26eac9);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0x1eba[_0x277fa3];return _0x2e4520;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var logger=require(_0xa1eb('0x2'))(_0xa1eb('0x3'));var moment=require(_0xa1eb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1eb('0x5'));var rimraf=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var attributes=require(_0xa1eb('0x8'));module[_0xa1eb('0x9')]=function(_0x2933d0,_0x1d0d67){return _0x2933d0[_0xa1eb('0xa')](_0xa1eb('0xb'),attributes,{'tableName':_0xa1eb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index a6f6d26..b2a666a 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 _0xba14=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','Attachment,\x20%s,\x20%s','message','request\x20sent','Attachment','body','options','raw','CreateAttachment'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xba14,0x6d));var _0x4ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4ba1('0x0'));var util=require(_0x4ba1('0x1'));var moment=require(_0x4ba1('0x2'));var BPromise=require(_0x4ba1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ba1('0x4'));var db=require(_0x4ba1('0x5'))['db'];var utils=require(_0x4ba1('0x6'));var logger=require(_0x4ba1('0x7'))(_0x4ba1('0x8'));var config=require(_0x4ba1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4ba1('0xa')][_0x4ba1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24c583,_0x43c4b3,_0x6a6aad){return new BPromise(function(_0xe2731f,_0x5380e4){return client['request'](_0x24c583,_0x6a6aad)[_0x4ba1('0xc')](function(_0x57fa27){logger[_0x4ba1('0xd')]('Attachment,\x20%s,\x20%s',_0x43c4b3,'request\x20sent');logger[_0x4ba1('0xe')](_0x4ba1('0xf'),_0x43c4b3,'request\x20sent',JSON[_0x4ba1('0x10')](_0x57fa27));if(_0x57fa27[_0x4ba1('0x11')]){if(_0x57fa27[_0x4ba1('0x11')]['code']===0x1f4){logger[_0x4ba1('0x11')](_0x4ba1('0x12'),_0x43c4b3,_0x57fa27[_0x4ba1('0x11')][_0x4ba1('0x13')]);return _0x5380e4(_0x57fa27[_0x4ba1('0x11')][_0x4ba1('0x13')]);}logger[_0x4ba1('0x11')](_0x4ba1('0x12'),_0x43c4b3,_0x57fa27[_0x4ba1('0x11')][_0x4ba1('0x13')]);return _0xe2731f(_0x57fa27['error'][_0x4ba1('0x13')]);}else{logger['info'](_0x4ba1('0x12'),_0x43c4b3,_0x4ba1('0x14'));_0xe2731f(_0x57fa27['result'][_0x4ba1('0x13')]);}})['catch'](function(_0x19e936){logger[_0x4ba1('0x11')]('Attachment,\x20%s,\x20%s',_0x43c4b3,_0x19e936);_0x5380e4(_0x19e936);});});}exports['CreateAttachment']=function(_0x2b152d){var _0x259eb3=this;return new Promise(function(_0x2b2ab9,_0x30dcda){return db[_0x4ba1('0x15')]['create'](_0x2b152d[_0x4ba1('0x16')],{'raw':_0x2b152d[_0x4ba1('0x17')]?_0x2b152d[_0x4ba1('0x17')][_0x4ba1('0x18')]===undefined?!![]:![]:!![]})[_0x4ba1('0xc')](function(_0x51ad7c){logger[_0x4ba1('0xd')](_0x4ba1('0x19'),_0x2b152d);logger['debug'](_0x4ba1('0x19'),_0x2b152d,JSON[_0x4ba1('0x10')](_0x51ad7c));_0x2b2ab9(_0x51ad7c);})[_0x4ba1('0x1a')](function(_0x512dcb){logger['error']('CreateAttachment',_0x512dcb[_0x4ba1('0x13')],_0x2b152d);_0x30dcda(_0x259eb3[_0x4ba1('0x11')](0x1f4,_0x512dcb[_0x4ba1('0x13')]));});});}; \ No newline at end of file +var _0x37e2=['http','request','request\x20sent','error','Attachment,\x20%s,\x20%s','message','info','result','catch','CreateAttachment','Attachment','body','options','raw','then','debug','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x119eca,_0x3637aa){var _0x2b032c=function(_0x4a8097){while(--_0x4a8097){_0x119eca['push'](_0x119eca['shift']());}};_0x2b032c(++_0x3637aa);}(_0x37e2,0x83));var _0x237e=function(_0x48f483,_0x3d4652){_0x48f483=_0x48f483-0x0;var _0x3c13de=_0x37e2[_0x48f483];return _0x3c13de;};'use strict';var _=require('lodash');var util=require(_0x237e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x237e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x237e('0x2'))['db'];var utils=require(_0x237e('0x3'));var logger=require(_0x237e('0x4'))(_0x237e('0x5'));var config=require('../../config/environment');var jayson=require(_0x237e('0x6'));var client=jayson['client'][_0x237e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x263101,_0xc6121f,_0x11fa07){return new BPromise(function(_0x444d90,_0xaa8470){return client[_0x237e('0x8')](_0x263101,_0x11fa07)['then'](function(_0x46cb80){logger['info']('Attachment,\x20%s,\x20%s',_0xc6121f,_0x237e('0x9'));logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0xc6121f,_0x237e('0x9'),JSON['stringify'](_0x46cb80));if(_0x46cb80[_0x237e('0xa')]){if(_0x46cb80[_0x237e('0xa')]['code']===0x1f4){logger['error'](_0x237e('0xb'),_0xc6121f,_0x46cb80[_0x237e('0xa')][_0x237e('0xc')]);return _0xaa8470(_0x46cb80[_0x237e('0xa')][_0x237e('0xc')]);}logger['error'](_0x237e('0xb'),_0xc6121f,_0x46cb80['error'][_0x237e('0xc')]);return _0x444d90(_0x46cb80[_0x237e('0xa')][_0x237e('0xc')]);}else{logger[_0x237e('0xd')](_0x237e('0xb'),_0xc6121f,_0x237e('0x9'));_0x444d90(_0x46cb80[_0x237e('0xe')][_0x237e('0xc')]);}})[_0x237e('0xf')](function(_0x38d776){logger[_0x237e('0xa')](_0x237e('0xb'),_0xc6121f,_0x38d776);_0xaa8470(_0x38d776);});});}exports[_0x237e('0x10')]=function(_0x12be04){var _0x526b0e=this;return new Promise(function(_0x2a3626,_0x2f80c0){return db[_0x237e('0x11')]['create'](_0x12be04[_0x237e('0x12')],{'raw':_0x12be04['options']?_0x12be04[_0x237e('0x13')][_0x237e('0x14')]===undefined?!![]:![]:!![]})[_0x237e('0x15')](function(_0xb09c6){logger[_0x237e('0xd')](_0x237e('0x10'),_0x12be04);logger[_0x237e('0x16')](_0x237e('0x10'),_0x12be04,JSON['stringify'](_0xb09c6));_0x2a3626(_0xb09c6);})[_0x237e('0xf')](function(_0x1c9dc1){logger[_0x237e('0xa')](_0x237e('0x10'),_0x1c9dc1[_0x237e('0xc')],_0x12be04);_0x2f80c0(_0x526b0e[_0x237e('0xa')](0x1f4,_0x1c9dc1[_0x237e('0xc')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 6dc996b..c8e5132 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 _0x5232=['get','isAuthenticated','index','/:id','show','/:id/download','download','post','clone','diskStorage','root','server/files/attachments/','format','%s-%s','originalname','replace','single','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x5e509d,_0xc57f9d){var _0x120f32=function(_0x38a2da){while(--_0x38a2da){_0x5e509d['push'](_0x5e509d['shift']());}};_0x120f32(++_0xc57f9d);}(_0x5232,0x1c9));var _0x2523=function(_0x2d6197,_0x82ebfb){_0x2d6197=_0x2d6197-0x0;var _0x4d0e75=_0x5232[_0x2d6197];return _0x4d0e75;};'use strict';var multer=require(_0x2523('0x0'));var util=require(_0x2523('0x1'));var path=require(_0x2523('0x2'));var timeout=require(_0x2523('0x3'));var express=require(_0x2523('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2523('0x5'));var config=require(_0x2523('0x6'));var controller=require('./attachment.controller');router[_0x2523('0x7')]('/',auth[_0x2523('0x8')](),controller[_0x2523('0x9')]);router[_0x2523('0x7')](_0x2523('0xa'),auth[_0x2523('0x8')](),controller[_0x2523('0xb')]);router[_0x2523('0x7')](_0x2523('0xc'),auth[_0x2523('0x8')](),controller[_0x2523('0xd')]);router[_0x2523('0xe')]('/:id/clone',auth[_0x2523('0x8')](),controller[_0x2523('0xf')]);var upload=multer({'storage':multer[_0x2523('0x10')]({'destination':function(_0x2f6bf5,_0xef9db1,_0x3ea8fa){_0x3ea8fa(null,path['join'](config[_0x2523('0x11')],_0x2523('0x12')));},'filename':function(_0x351a1f,_0x99685a,_0x5176d5){_0x5176d5(null,util[_0x2523('0x13')](_0x2523('0x14'),Date['now'](),_0x99685a[_0x2523('0x15')][_0x2523('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2523('0xe')]('/',upload[_0x2523('0x17')]('file'),controller[_0x2523('0x18')]);router['put'](_0x2523('0xa'),auth[_0x2523('0x8')](),controller[_0x2523('0x19')]);router[_0x2523('0x1a')]('/:id',auth[_0x2523('0x8')](),controller[_0x2523('0x1b')]);module[_0x2523('0x1c')]=router; \ No newline at end of file +var _0xe683=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','/:id/download','/:id/clone','diskStorage','join','root','server/files/attachments/','format','now','originalname','post','single','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x59e5df,_0x307565){var _0xbdb69e=function(_0x453f19){while(--_0x453f19){_0x59e5df['push'](_0x59e5df['shift']());}};_0xbdb69e(++_0x307565);}(_0xe683,0x1d7));var _0x3e68=function(_0x2c442c,_0x1ae260){_0x2c442c=_0x2c442c-0x0;var _0x226fe7=_0xe683[_0x2c442c];return _0x226fe7;};'use strict';var multer=require(_0x3e68('0x0'));var util=require(_0x3e68('0x1'));var path=require(_0x3e68('0x2'));var timeout=require(_0x3e68('0x3'));var express=require(_0x3e68('0x4'));var router=express[_0x3e68('0x5')]();var auth=require(_0x3e68('0x6'));var interaction=require(_0x3e68('0x7'));var config=require(_0x3e68('0x8'));var controller=require('./attachment.controller');router['get']('/',auth[_0x3e68('0x9')](),controller[_0x3e68('0xa')]);router['get'](_0x3e68('0xb'),auth[_0x3e68('0x9')](),controller['show']);router['get'](_0x3e68('0xc'),auth[_0x3e68('0x9')](),controller['download']);router['post'](_0x3e68('0xd'),auth[_0x3e68('0x9')](),controller['clone']);var upload=multer({'storage':multer[_0x3e68('0xe')]({'destination':function(_0x224429,_0x3d1f2e,_0xb56f6b){_0xb56f6b(null,path[_0x3e68('0xf')](config[_0x3e68('0x10')],_0x3e68('0x11')));},'filename':function(_0x5773e7,_0x32f661,_0x30b7a5){_0x30b7a5(null,util[_0x3e68('0x12')]('%s-%s',Date[_0x3e68('0x13')](),_0x32f661[_0x3e68('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3e68('0x15')]('/',upload[_0x3e68('0x16')]('file'),controller[_0x3e68('0x17')]);router[_0x3e68('0x18')](_0x3e68('0xb'),auth[_0x3e68('0x9')](),controller[_0x3e68('0x19')]);router['delete'](_0x3e68('0xb'),auth[_0x3e68('0x9')](),controller[_0x3e68('0x1a')]);module[_0x3e68('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 21ee5f2..aeab8b8 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 _0x8277=['add','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','callback','clientSecret','callbackURL','Setting','findOne','blockDuration','User','find','value','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0x8277,0x12d));var _0x7827=function(_0x4bfcbe,_0x4630f5){_0x4bfcbe=_0x4bfcbe-0x0;var _0x5b65e6=_0x8277[_0x4bfcbe];return _0x5b65e6;};'use strict';var _=require(_0x7827('0x0'));var passport=require(_0x7827('0x1'));var GoogleStrategy=require(_0x7827('0x2'))[_0x7827('0x3')];var moment=require(_0x7827('0x4'));var db=require(_0x7827('0x5'))['db'];var config=require(_0x7827('0x6'));var signToken=require(_0x7827('0x7'))[_0x7827('0x8')];var utils=require(_0x7827('0x9'));exports[_0x7827('0xa')]=passport[_0x7827('0xb')](_0x7827('0xc'),{'failureRedirect':_0x7827('0xd'),'scope':[_0x7827('0xe'),'email'],'session':![]});exports[_0x7827('0xf')]=passport[_0x7827('0xb')](_0x7827('0xc'),{'failureRedirect':'/login','session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x7827('0xc')]?config[_0x7827('0xc')]['clientID']:'id','clientSecret':config['google']?config[_0x7827('0xc')][_0x7827('0x10')]:'secret','callbackURL':config['google']?config['google'][_0x7827('0x11')]:''},function(_0x42cde3,_0x4fbcee,_0x3df77e,_0x3f402a){var _0x5c1375,_0x380d06;return db[_0x7827('0x12')][_0x7827('0x13')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x7827('0x14')],'raw':!![]})['then'](function(_0x402118){_0x5c1375=_0x402118;return db[_0x7827('0x15')][_0x7827('0x16')]({'where':{'email':_['map'](_0x3df77e['emails'],_0x7827('0x17')),'role':{'$or':['admin',_0x7827('0x18'),_0x7827('0x19')]}}});})[_0x7827('0x1a')](function(_0xb8d5cf){_0x380d06=_0xb8d5cf;if(_0x380d06){if(_0x380d06['disabled']){return _0x3f402a(_0x7827('0x1b'));}else if(_0x5c1375[_0x7827('0x14')]>0x0){if(_0x380d06['blocked']){if(moment(_0x380d06[_0x7827('0x1c')])[_0x7827('0x1d')](_0x5c1375['blockDuration'],'minutes')>moment()){return _0x3f402a(_0x7827('0x1b'));}else{return utils[_0x7827('0x1e')](_0x380d06,0x0,![],null)[_0x7827('0x1a')](function(){return utils[_0x7827('0x1f')](_0x380d06);})[_0x7827('0x1a')](function(){return _0x3f402a(null,_0x380d06);});}}else{return utils[_0x7827('0x1f')](_0x380d06)[_0x7827('0x1a')](function(){return _0x3f402a(null,_0x380d06);});}}else{return utils[_0x7827('0x1f')](_0x380d06)[_0x7827('0x1a')](function(){return _0x3f402a(null,_0x380d06);});}}return _0x3f402a('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x7827('0x20')](function(_0x529767){_0x3f402a(_0x529767);});})); \ No newline at end of file +var _0xbfb2=['disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','clearBlockUser','getLicense','passport','moment','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','login','google','profile','email','callback','authenticate','/login','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','value','admin','user','agent'];(function(_0x335dcc,_0x574dab){var _0x37cb0e=function(_0x52aae2){while(--_0x52aae2){_0x335dcc['push'](_0x335dcc['shift']());}};_0x37cb0e(++_0x574dab);}(_0xbfb2,0x1f0));var _0x2bfb=function(_0x614c96,_0x41b786){_0x614c96=_0x614c96-0x0;var _0x4b79ea=_0xbfb2[_0x614c96];return _0x4b79ea;};'use strict';var _=require('lodash');var passport=require(_0x2bfb('0x0'));var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var moment=require(_0x2bfb('0x1'));var db=require(_0x2bfb('0x2'))['db'];var config=require(_0x2bfb('0x3'));var signToken=require(_0x2bfb('0x4'))['signToken'];var utils=require(_0x2bfb('0x5'));exports[_0x2bfb('0x6')]=passport['authenticate'](_0x2bfb('0x7'),{'failureRedirect':'/login','scope':[_0x2bfb('0x8'),_0x2bfb('0x9')],'session':![]});exports[_0x2bfb('0xa')]=passport[_0x2bfb('0xb')](_0x2bfb('0x7'),{'failureRedirect':_0x2bfb('0xc'),'session':![]});passport[_0x2bfb('0xd')](new GoogleStrategy({'clientID':config['google']?config[_0x2bfb('0x7')][_0x2bfb('0xe')]:'id','clientSecret':config['google']?config['google'][_0x2bfb('0xf')]:_0x2bfb('0x10'),'callbackURL':config[_0x2bfb('0x7')]?config[_0x2bfb('0x7')][_0x2bfb('0x11')]:''},function(_0x473164,_0x5678b4,_0xa24dca,_0x333146){var _0x2ae101,_0x44e442;return db[_0x2bfb('0x12')][_0x2bfb('0x13')]({'where':{'id':0x1},'attributes':[_0x2bfb('0x14'),_0x2bfb('0x15')],'raw':!![]})[_0x2bfb('0x16')](function(_0x3b95fb){_0x2ae101=_0x3b95fb;return db[_0x2bfb('0x17')][_0x2bfb('0x18')]({'where':{'email':_['map'](_0xa24dca['emails'],_0x2bfb('0x19')),'role':{'$or':[_0x2bfb('0x1a'),_0x2bfb('0x1b'),_0x2bfb('0x1c')]}}});})[_0x2bfb('0x16')](function(_0x3a0151){_0x44e442=_0x3a0151;if(_0x44e442){if(_0x44e442[_0x2bfb('0x1d')]){return _0x333146(_0x2bfb('0x1e'));}else if(_0x2ae101[_0x2bfb('0x15')]>0x0){if(_0x44e442[_0x2bfb('0x1f')]){if(moment(_0x44e442['blockedAt'])[_0x2bfb('0x20')](_0x2ae101[_0x2bfb('0x15')],'minutes')>moment()){return _0x333146(_0x2bfb('0x1e'));}else{return utils[_0x2bfb('0x21')](_0x44e442,0x0,![],null)[_0x2bfb('0x16')](function(){return utils[_0x2bfb('0x22')](_0x44e442);})[_0x2bfb('0x16')](function(){return _0x333146(null,_0x44e442);});}}else{return utils[_0x2bfb('0x22')](_0x44e442)[_0x2bfb('0x16')](function(){return _0x333146(null,_0x44e442);});}}else{return utils[_0x2bfb('0x22')](_0x44e442)[_0x2bfb('0x16')](function(){return _0x333146(null,_0x44e442);});}}return _0x333146('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})['catch'](function(_0x260fbb){_0x333146(_0x260fbb);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 6dc2e3e..dbb2a02 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 _0x153f=['passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','callback','isMiddleware','login','setTokenCookie','exports','express'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x153f,0x15b));var _0xf153=function(_0x105743,_0x1bf35b){_0x105743=_0x105743-0x0;var _0x50b46e=_0x153f[_0x105743];return _0x50b46e;};'use strict';var express=require(_0xf153('0x0'));var passport=require(_0xf153('0x1'));var router=express[_0xf153('0x2')]();var controller=require(_0xf153('0x3'));var userController=require(_0xf153('0x4'));var authService=require(_0xf153('0x5'));router[_0xf153('0x6')]('/',controller['login']);router[_0xf153('0x6')]('/callback',controller[_0xf153('0x7')],authService[_0xf153('0x8')],userController[_0xf153('0x9')],authService[_0xf153('0xa')]);module[_0xf153('0xb')]=router; \ No newline at end of file +var _0x9d02=['express','Router','../user/user.controller.js','get','login','/callback','callback','isMiddleware'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x9d02,0x118));var _0x29d0=function(_0x1e4f60,_0x30de88){_0x1e4f60=_0x1e4f60-0x0;var _0x233711=_0x9d02[_0x1e4f60];return _0x233711;};'use strict';var express=require(_0x29d0('0x0'));var passport=require('passport');var router=express[_0x29d0('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0x29d0('0x2'));var authService=require('../../components/auth/service');router[_0x29d0('0x3')]('/',controller[_0x29d0('0x4')]);router['get'](_0x29d0('0x5'),controller[_0x29d0('0x6')],authService[_0x29d0('0x7')],userController['login'],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index c7532de..8ea7a65 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 _0x4108=['password','salt','role','disabled','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','blockDuration','add','minutes','clearBlockUser','getLicense','catch','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','port','secure','authentication','auth','pass','merge','\x22%s\x22\x20<%s>','email','request','error','message','stringify','status','send','test','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','host','/reset/','reset','User','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','resetPasswordToken','Password\x20reset!','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name'];(function(_0x1be191,_0x307824){var _0x174752=function(_0x449207){while(--_0x449207){_0x1be191['push'](_0x1be191['shift']());}};_0x174752(++_0x307824);}(_0x4108,0x1d0));var _0x8410=function(_0x187562,_0x326776){_0x187562=_0x187562-0x0;var _0x1a2fec=_0x4108[_0x187562];return _0x1a2fec;};'use strict';var util=require('util');var passport=require(_0x8410('0x0'));var LocalStrategy=require(_0x8410('0x1'))[_0x8410('0x2')];var jayson=require(_0x8410('0x3'));var _=require(_0x8410('0x4'));var rs=require('randomstring');var moment=require(_0x8410('0x5'));var db=require(_0x8410('0x6'))['db'];var authService=require(_0x8410('0x7'));var utils=require(_0x8410('0x8'));var client=jayson[_0x8410('0x9')][_0x8410('0xa')]({'port':0x232b});function localAuthenticate(_0x5267fd,_0x52cde2,_0x2ebf0e,_0x271c47){var _0x2f166f,_0x1f6675;return db[_0x8410('0xb')][_0x8410('0xc')]({'where':{'id':0x1},'attributes':[_0x8410('0xd'),'blockDuration'],'raw':!![]})[_0x8410('0xe')](function(_0x180025){_0x2f166f=_0x180025;return _0x5267fd[_0x8410('0xc')]({'attributes':['id',_0x8410('0xf'),_0x8410('0x10'),_0x8410('0x11'),_0x8410('0x12'),_0x8410('0x13'),'blocked',_0x8410('0x14'),_0x8410('0x15')],'where':{'name':_0x52cde2,'role':{'$or':[_0x8410('0x16'),_0x8410('0x17'),_0x8410('0x18')]}}});})[_0x8410('0xe')](function(_0x426877){if(!_0x426877||_0x426877&&_0x426877[_0x8410('0xf')]!==_0x52cde2){throw new Error(_0x8410('0x19'));}else{_0x1f6675=_0x426877;return _0x1f6675;}})[_0x8410('0xe')](function(){_0x1f6675[_0x8410('0x1a')](_0x2ebf0e,function(_0x715a9d,_0x1a597c){var _0x226e3a=_0x1f6675[_0x8410('0x15')]+0x1;if(_0x715a9d){return _0x271c47(_0x715a9d);}else if(!_0x1a597c){if(_0x1f6675['disabled']){return _0x271c47(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2f166f['allowedLoginAttempts']>0x0){if(_0x1f6675[_0x8410('0x1b')]){if(_0x2f166f[_0x8410('0x1c')]>0x0){if(moment(_0x1f6675['blockedAt'])[_0x8410('0x1d')](_0x2f166f[_0x8410('0x1c')],_0x8410('0x1e'))>moment()){return _0x271c47(null,![],{'message':_0x8410('0x19')});}else{return utils[_0x8410('0x1f')](_0x1f6675,_0x226e3a,![],null)[_0x8410('0xe')](function(){return _0x271c47(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x271c47(null,![],{'message':_0x8410('0x19')});}}else{if(_0x226e3a>=_0x2f166f[_0x8410('0xd')]){return utils[_0x8410('0x1f')](_0x1f6675,0x0,!![],moment())[_0x8410('0xe')](function(){return _0x271c47(null,![],{'message':_0x8410('0x19')});});}else{return utils[_0x8410('0x1f')](_0x1f6675,_0x226e3a,![],null)['then'](function(){return _0x271c47(null,![],{'message':_0x8410('0x19')});});}}}else{return _0x271c47(null,![],{'message':_0x8410('0x19')});}}else{if(_0x1f6675[_0x8410('0x13')]){return _0x271c47(null,![],{'message':_0x8410('0x19')});}else if(_0x2f166f[_0x8410('0xd')]>0x0){if(_0x1f6675[_0x8410('0x1b')]){if(_0x2f166f[_0x8410('0x1c')]>0x0){if(moment(_0x1f6675[_0x8410('0x14')])['add'](_0x2f166f[_0x8410('0x1c')],_0x8410('0x1e'))>moment()){return _0x271c47(null,![],{'message':_0x8410('0x19')});}else{return utils[_0x8410('0x1f')](_0x1f6675,0x0,![],null)[_0x8410('0xe')](function(){return utils[_0x8410('0x20')](_0x1f6675);})[_0x8410('0xe')](function(){return _0x271c47(null,_0x1f6675);});}}else{return _0x271c47(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x8410('0x1f')](_0x1f6675,0x0,![],null)[_0x8410('0xe')](function(){return utils['getLicense'](_0x1f6675);})[_0x8410('0xe')](function(){return _0x271c47(null,_0x1f6675);})[_0x8410('0x21')](function(_0x29da81){return _0x271c47(null,![],_0x29da81);});}}else{if(_0x1f6675['blocked']){return _0x271c47(null,![],{'message':_0x8410('0x19')});}else{return utils[_0x8410('0x20')](_0x1f6675)['then'](function(){return _0x271c47(null,_0x1f6675);});}}}});})[_0x8410('0x21')](function(_0x403e9f){return _0x271c47(null,![],_0x403e9f);});}function sendServiceMail(_0x1aeaa1){return db['MailAccount'][_0x8410('0x22')]({'where':{'service':!![]},'attributes':['id',_0x8410('0xf'),'email'],'include':[{'model':db[_0x8410('0x23')],'as':_0x8410('0x24')}]})[_0x8410('0xe')](function(_0xc044a9){if(!_0xc044a9){throw new Error(_0x8410('0x25'));}var _0x3852af={'tls':{'rejectUnauthorized':![]}};if(_0xc044a9[_0x8410('0x24')]['service']){_0x3852af[_0x8410('0x26')]=_0xc044a9[_0x8410('0x24')][_0x8410('0x26')];}else{_0x3852af['host']=_0xc044a9[_0x8410('0x24')]['host'];_0x3852af[_0x8410('0x27')]=_0xc044a9[_0x8410('0x24')][_0x8410('0x27')];_0x3852af[_0x8410('0x28')]=_0xc044a9[_0x8410('0x24')][_0x8410('0x28')];}if(_0xc044a9[_0x8410('0x24')][_0x8410('0x29')]){_0x3852af[_0x8410('0x2a')]={'user':_0xc044a9[_0x8410('0x24')]['user'],'pass':_0xc044a9[_0x8410('0x24')][_0x8410('0x2b')]};}var _0x3ee010={'account':_0x3852af,'message':_[_0x8410('0x2c')]({'from':util['format'](_0x8410('0x2d'),_0xc044a9[_0x8410('0xf')],_0xc044a9[_0x8410('0x2e')]||_0xc044a9[_0x8410('0x24')]['user'])},_0x1aeaa1)};return client[_0x8410('0x2f')]('SendMail',_0x3ee010);})[_0x8410('0xe')](function(_0x30cc64){if(_0x30cc64[_0x8410('0x30')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x30cc64[_0x8410('0x30')][_0x8410('0x31')]||JSON[_0x8410('0x32')](_0x30cc64['error'])));}return!![];});}function handleError(_0x753f5c,_0x73d154,_0x55ed86){return _0x753f5c[_0x8410('0x33')](_0x73d154||0x1f4)[_0x8410('0x34')]({'message':_0x55ed86?_0x55ed86[_0x8410('0x31')]||_0x55ed86:''});}function checkPasswordPattern(_0x3fec2e,_0x5383ae,_0x1cb360){if(_0x1cb360){var _0x53c36b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x53c36b[_0x8410('0x35')](_0x5383ae)){return _0x3fec2e;}else{throw new Error('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3fec2e;}}exports[_0x8410('0x36')]=function(_0x3ec54d,_0x1caf84,_0x49d564){passport['authenticate'](_0x8410('0x37'),function(_0x203c62,_0x307586,_0x39460c){var _0x34a7af=_0x203c62||_0x39460c;if(_0x34a7af){return handleError(_0x1caf84,0x191,_0x34a7af);}if(!_0x307586){return handleError(_0x1caf84,0x194,{'message':_0x8410('0x38')});}else{var _0x528cc1={'payload':{'id':_0x307586['id'],'role':_0x307586[_0x8410('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x8410('0x39')](_0x528cc1)[_0x8410('0xe')](function(_0x377560){_0x1caf84['json']({'id':_0x307586['id'],'token':_0x377560,'statusCall':'','isAlreadyLogged':_0x307586['online']});});}})(_0x3ec54d,_0x1caf84,_0x49d564);};exports[_0x8410('0x3a')]=function(_0x5d823b,_0x2c360c,_0x26bcc6){if(!_0x5d823b[_0x8410('0x3b')][_0x8410('0x2e')]){return handleError(_0x2c360c,0x1f4,{'message':_0x8410('0x3c')});}var _0x164648=rs[_0x8410('0x3d')]();_0x5d823b[_0x8410('0x3b')]['email']=_0x5d823b[_0x8410('0x3b')]['email']['trim']()[_0x8410('0x3e')]();var _0x2c79d5;return db[_0x8410('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x8410('0xd'),_0x8410('0x1c')],'raw':!![]})[_0x8410('0xe')](function(_0x2f1690){_0x2c79d5=_0x2f1690;return db['User'][_0x8410('0x22')]({'where':{'email':_0x5d823b[_0x8410('0x3b')][_0x8410('0x2e')]}});})[_0x8410('0xe')](function(_0x510713){if(!_0x510713){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x510713[_0x8410('0x13')]){throw new Error(_0x8410('0x3f'));}if(_0x510713['blocked']){if(moment(_0x510713[_0x8410('0x14')])[_0x8410('0x1d')](_0x2c79d5[_0x8410('0x1c')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x510713[_0x8410('0x1b')]=![];_0x510713['blockedAt']=null;}}_0x510713['resetPasswordToken']=_0x164648;_0x510713[_0x8410('0x40')]=Date[_0x8410('0x41')]()+0x36ee80;return _0x510713[_0x8410('0x42')]();})[_0x8410('0xe')](function(){return sendServiceMail({'to':_0x5d823b[_0x8410('0x3b')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x8410('0x43')+_0x8410('0x44')+_0x8410('0x45')+_0x5d823b[_0x8410('0x46')][_0x8410('0x47')]+_0x8410('0x48')+_0x164648+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x8410('0xe')](function(){_0x2c360c[_0x8410('0x33')](0xc8)[_0x8410('0x34')]({'message':'Reset\x20Email\x20sent!'});})[_0x8410('0x21')](function(_0x123c4d){return handleError(_0x2c360c,0x1f4,_0x123c4d);});};exports[_0x8410('0x49')]=function(_0x5d675b,_0x4154a3,_0x3bf8a0){var _0x4336fc;return db[_0x8410('0x4a')][_0x8410('0x22')]({'where':{'resetPasswordToken':_0x5d675b['params'][_0x8410('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x8410('0x41')]()}}})[_0x8410('0xe')](function(_0x5c6d9e){_0x4336fc=_0x5c6d9e;if(!_0x4336fc){throw new Error(_0x8410('0x4c'));}return db['Setting'][_0x8410('0xc')]({'attributes':['id',_0x8410('0x4d')]});})[_0x8410('0xe')](function(_0x171a44){return checkPasswordPattern(_0x171a44,_0x5d675b[_0x8410('0x3b')]['password'],_0x171a44[_0x8410('0x4d')]);})[_0x8410('0xe')](function(){_0x4336fc[_0x8410('0x10')]=_0x5d675b[_0x8410('0x3b')]['password'];_0x4336fc[_0x8410('0x4e')]=null;_0x4336fc[_0x8410('0x40')]=null;return _0x4336fc['save']();})['then'](function(){_0x4154a3[_0x8410('0x33')](0xc8)[_0x8410('0x34')]({'message':_0x8410('0x4f')});})[_0x8410('0x21')](function(_0x590a1e){return handleError(_0x4154a3,0x1f4,_0x590a1e);});};passport['use'](new LocalStrategy({'usernameField':_0x8410('0xf'),'passwordField':_0x8410('0x10')},function(_0x346174,_0xb14fe2,_0x5321e6){return localAuthenticate(db[_0x8410('0x4a')],_0x346174,_0xb14fe2,_0x5321e6);})); \ No newline at end of file +var _0x076e=['Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','auth','pass','format','email','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','test','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','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','http://','headers','Reset\x20Email\x20sent!','reset','now','securePassword','resetPasswordExpires','util','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','blockDuration','then','name','password','salt','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut'];(function(_0x5cbbcd,_0x32921d){var _0x31e8e2=function(_0x277545){while(--_0x277545){_0x5cbbcd['push'](_0x5cbbcd['shift']());}};_0x31e8e2(++_0x32921d);}(_0x076e,0x114));var _0xe076=function(_0x955539,_0x1d6045){_0x955539=_0x955539-0x0;var _0x1cf20c=_0x076e[_0x955539];return _0x1cf20c;};'use strict';var util=require(_0xe076('0x0'));var passport=require(_0xe076('0x1'));var LocalStrategy=require(_0xe076('0x2'))[_0xe076('0x3')];var jayson=require(_0xe076('0x4'));var _=require(_0xe076('0x5'));var rs=require('randomstring');var moment=require(_0xe076('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xe076('0x7'));var utils=require(_0xe076('0x8'));var client=jayson[_0xe076('0x9')][_0xe076('0xa')]({'port':0x232b});function localAuthenticate(_0x3c8a2b,_0x51beff,_0xe1cf84,_0x1ede0d){var _0x5b3987,_0x4d3eaf;return db[_0xe076('0xb')][_0xe076('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe076('0xd')],'raw':!![]})[_0xe076('0xe')](function(_0x14a787){_0x5b3987=_0x14a787;return _0x3c8a2b[_0xe076('0xc')]({'attributes':['id',_0xe076('0xf'),_0xe076('0x10'),_0xe076('0x11'),'role',_0xe076('0x12'),_0xe076('0x13'),_0xe076('0x14'),_0xe076('0x15')],'where':{'name':_0x51beff,'role':{'$or':[_0xe076('0x16'),_0xe076('0x17'),_0xe076('0x18')]}}});})[_0xe076('0xe')](function(_0x18197c){if(!_0x18197c||_0x18197c&&_0x18197c[_0xe076('0xf')]!==_0x51beff){throw new Error(_0xe076('0x19'));}else{_0x4d3eaf=_0x18197c;return _0x4d3eaf;}})[_0xe076('0xe')](function(){_0x4d3eaf[_0xe076('0x1a')](_0xe1cf84,function(_0x48fc1f,_0x4634e5){var _0x5f1f5c=_0x4d3eaf['loginAttempts']+0x1;if(_0x48fc1f){return _0x1ede0d(_0x48fc1f);}else if(!_0x4634e5){if(_0x4d3eaf[_0xe076('0x12')]){return _0x1ede0d(null,![],{'message':_0xe076('0x19')});}else if(_0x5b3987[_0xe076('0x1b')]>0x0){if(_0x4d3eaf[_0xe076('0x13')]){if(_0x5b3987[_0xe076('0xd')]>0x0){if(moment(_0x4d3eaf[_0xe076('0x14')])[_0xe076('0x1c')](_0x5b3987[_0xe076('0xd')],_0xe076('0x1d'))>moment()){return _0x1ede0d(null,![],{'message':_0xe076('0x19')});}else{return utils[_0xe076('0x1e')](_0x4d3eaf,_0x5f1f5c,![],null)['then'](function(){return _0x1ede0d(null,![],{'message':_0xe076('0x19')});});}}else{return _0x1ede0d(null,![],{'message':_0xe076('0x19')});}}else{if(_0x5f1f5c>=_0x5b3987[_0xe076('0x1b')]){return utils[_0xe076('0x1e')](_0x4d3eaf,0x0,!![],moment())[_0xe076('0xe')](function(){return _0x1ede0d(null,![],{'message':_0xe076('0x19')});});}else{return utils['clearBlockUser'](_0x4d3eaf,_0x5f1f5c,![],null)[_0xe076('0xe')](function(){return _0x1ede0d(null,![],{'message':_0xe076('0x19')});});}}}else{return _0x1ede0d(null,![],{'message':_0xe076('0x19')});}}else{if(_0x4d3eaf[_0xe076('0x12')]){return _0x1ede0d(null,![],{'message':_0xe076('0x19')});}else if(_0x5b3987['allowedLoginAttempts']>0x0){if(_0x4d3eaf['blocked']){if(_0x5b3987[_0xe076('0xd')]>0x0){if(moment(_0x4d3eaf[_0xe076('0x14')])[_0xe076('0x1c')](_0x5b3987[_0xe076('0xd')],_0xe076('0x1d'))>moment()){return _0x1ede0d(null,![],{'message':_0xe076('0x19')});}else{return utils['clearBlockUser'](_0x4d3eaf,0x0,![],null)[_0xe076('0xe')](function(){return utils[_0xe076('0x1f')](_0x4d3eaf);})[_0xe076('0xe')](function(){return _0x1ede0d(null,_0x4d3eaf);});}}else{return _0x1ede0d(null,![],{'message':_0xe076('0x19')});}}else{return utils[_0xe076('0x1e')](_0x4d3eaf,0x0,![],null)[_0xe076('0xe')](function(){return utils[_0xe076('0x1f')](_0x4d3eaf);})['then'](function(){return _0x1ede0d(null,_0x4d3eaf);})[_0xe076('0x20')](function(_0xb458a3){return _0x1ede0d(null,![],_0xb458a3);});}}else{if(_0x4d3eaf[_0xe076('0x13')]){return _0x1ede0d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xe076('0x1f')](_0x4d3eaf)[_0xe076('0xe')](function(){return _0x1ede0d(null,_0x4d3eaf);});}}}});})[_0xe076('0x20')](function(_0x2366bb){return _0x1ede0d(null,![],_0x2366bb);});}function sendServiceMail(_0x51ebbd){return db[_0xe076('0x21')][_0xe076('0x22')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0xe076('0x23')],'as':'Smtp'}]})['then'](function(_0x20688e){if(!_0x20688e){throw new Error(_0xe076('0x24'));}var _0x411952={'tls':{'rejectUnauthorized':![]}};if(_0x20688e[_0xe076('0x25')][_0xe076('0x26')]){_0x411952[_0xe076('0x26')]=_0x20688e['Smtp'][_0xe076('0x26')];}else{_0x411952[_0xe076('0x27')]=_0x20688e[_0xe076('0x25')][_0xe076('0x27')];_0x411952['port']=_0x20688e[_0xe076('0x25')][_0xe076('0x28')];_0x411952['secure']=_0x20688e[_0xe076('0x25')][_0xe076('0x29')];}if(_0x20688e[_0xe076('0x25')]['authentication']){_0x411952[_0xe076('0x2a')]={'user':_0x20688e[_0xe076('0x25')][_0xe076('0x17')],'pass':_0x20688e[_0xe076('0x25')][_0xe076('0x2b')]};}var _0x5ef5ff={'account':_0x411952,'message':_['merge']({'from':util[_0xe076('0x2c')]('\x22%s\x22\x20<%s>',_0x20688e['name'],_0x20688e[_0xe076('0x2d')]||_0x20688e[_0xe076('0x25')]['user'])},_0x51ebbd)};return client[_0xe076('0x2e')]('SendMail',_0x5ef5ff);})[_0xe076('0xe')](function(_0x2367af){if(_0x2367af[_0xe076('0x2f')]){throw new Error(util[_0xe076('0x2c')](_0xe076('0x30'),_0x2367af[_0xe076('0x2f')][_0xe076('0x31')]||JSON[_0xe076('0x32')](_0x2367af[_0xe076('0x2f')])));}return!![];});}function handleError(_0x1f685c,_0x4791a1,_0x17086e){return _0x1f685c[_0xe076('0x33')](_0x4791a1||0x1f4)[_0xe076('0x34')]({'message':_0x17086e?_0x17086e[_0xe076('0x31')]||_0x17086e:''});}function checkPasswordPattern(_0x2ffccd,_0x4a0177,_0x3b356c){if(_0x3b356c){var _0x540d6b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x540d6b[_0xe076('0x35')](_0x4a0177)){return _0x2ffccd;}else{throw new Error('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2ffccd;}}exports[_0xe076('0x36')]=function(_0x5d9f64,_0x5b99bc,_0xa7b292){passport[_0xe076('0x1a')](_0xe076('0x37'),function(_0x1f80d6,_0x18f18b,_0xe8219c){var _0x356865=_0x1f80d6||_0xe8219c;if(_0x356865){return handleError(_0x5b99bc,0x191,_0x356865);}if(!_0x18f18b){return handleError(_0x5b99bc,0x194,{'message':_0xe076('0x38')});}else{var _0xf55cae={'payload':{'id':_0x18f18b['id'],'role':_0x18f18b[_0xe076('0x39')]},'options':{'expiresIn':0x15180}};return authService[_0xe076('0x3a')](_0xf55cae)['then'](function(_0x1f6fc7){_0x5b99bc['json']({'id':_0x18f18b['id'],'token':_0x1f6fc7,'statusCall':'','isAlreadyLogged':_0x18f18b['online']});});}})(_0x5d9f64,_0x5b99bc,_0xa7b292);};exports['forgot']=function(_0x3928be,_0x1acf35,_0x1a3a9b){if(!_0x3928be[_0xe076('0x3b')][_0xe076('0x2d')]){return handleError(_0x1acf35,0x1f4,{'message':_0xe076('0x3c')});}var _0x23118f=rs['generate']();_0x3928be[_0xe076('0x3b')][_0xe076('0x2d')]=_0x3928be[_0xe076('0x3b')][_0xe076('0x2d')][_0xe076('0x3d')]()[_0xe076('0x3e')]();var _0x2e0975;return db[_0xe076('0xb')][_0xe076('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe076('0xd')],'raw':!![]})[_0xe076('0xe')](function(_0x317df3){_0x2e0975=_0x317df3;return db[_0xe076('0x3f')]['find']({'where':{'email':_0x3928be[_0xe076('0x3b')][_0xe076('0x2d')]}});})[_0xe076('0xe')](function(_0x3f3d82){if(!_0x3f3d82){throw new Error(_0xe076('0x40'));}if(_0x3f3d82['disabled']){throw new Error(_0xe076('0x41'));}if(_0x3f3d82[_0xe076('0x13')]){if(moment(_0x3f3d82[_0xe076('0x14')])[_0xe076('0x1c')](_0x2e0975['blockDuration'],'minutes')>moment()){throw new Error(_0xe076('0x42'));}else{_0x3f3d82[_0xe076('0x13')]=![];_0x3f3d82[_0xe076('0x14')]=null;}}_0x3f3d82[_0xe076('0x43')]=_0x23118f;_0x3f3d82['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x3f3d82[_0xe076('0x44')]();})[_0xe076('0xe')](function(){return sendServiceMail({'to':_0x3928be[_0xe076('0x3b')][_0xe076('0x2d')],'subject':_0xe076('0x45'),'text':_0xe076('0x46')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xe076('0x47')+_0x3928be[_0xe076('0x48')]['host']+'/reset/'+_0x23118f+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x1acf35[_0xe076('0x33')](0xc8)[_0xe076('0x34')]({'message':_0xe076('0x49')});})['catch'](function(_0x305677){return handleError(_0x1acf35,0x1f4,_0x305677);});};exports[_0xe076('0x4a')]=function(_0x466023,_0x173bd8,_0x19f7d7){var _0x2a7621;return db[_0xe076('0x3f')][_0xe076('0x22')]({'where':{'resetPasswordToken':_0x466023['params']['token'],'resetPasswordExpires':{'$gt':Date[_0xe076('0x4b')]()}}})[_0xe076('0xe')](function(_0x169857){_0x2a7621=_0x169857;if(!_0x2a7621){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xe076('0xb')]['findOne']({'attributes':['id',_0xe076('0x4c')]});})[_0xe076('0xe')](function(_0x52e449){return checkPasswordPattern(_0x52e449,_0x466023[_0xe076('0x3b')][_0xe076('0x10')],_0x52e449[_0xe076('0x4c')]);})[_0xe076('0xe')](function(){_0x2a7621['password']=_0x466023[_0xe076('0x3b')][_0xe076('0x10')];_0x2a7621[_0xe076('0x43')]=null;_0x2a7621[_0xe076('0x4d')]=null;return _0x2a7621['save']();})[_0xe076('0xe')](function(){_0x173bd8[_0xe076('0x33')](0xc8)[_0xe076('0x34')]({'message':'Password\x20reset!'});})[_0xe076('0x20')](function(_0x5c32ec){return handleError(_0x173bd8,0x1f4,_0x5c32ec);});};passport['use'](new LocalStrategy({'usernameField':_0xe076('0xf'),'passwordField':'password'},function(_0x8a8212,_0x3f0ef0,_0x332a5d){return localAuthenticate(db[_0xe076('0x3f')],_0x8a8212,_0x3f0ef0,_0x332a5d);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 3cf44ba..bbc8c60 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 _0x400c=['exports','express','Router','post','login','/forgot','forgot','/reset/:token'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x400c,0x81));var _0xc400=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x400c[_0x138adb];return _0x1b27f2;};'use strict';var express=require(_0xc400('0x0'));var router=express[_0xc400('0x1')]();var controller=require('./authLocal.controller');router[_0xc400('0x2')]('/',controller[_0xc400('0x3')]);router[_0xc400('0x2')](_0xc400('0x4'),controller[_0xc400('0x5')]);router[_0xc400('0x2')](_0xc400('0x6'),controller['reset']);module[_0xc400('0x7')]=router; \ No newline at end of file +var _0xa37f=['/reset/:token','reset','exports','express','Router','./authLocal.controller','post','login','/forgot'];(function(_0x5a7c63,_0x29525a){var _0x432be4=function(_0x5149a7){while(--_0x5149a7){_0x5a7c63['push'](_0x5a7c63['shift']());}};_0x432be4(++_0x29525a);}(_0xa37f,0x66));var _0xfa37=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa37f[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0xfa37('0x0'));var router=express[_0xfa37('0x1')]();var controller=require(_0xfa37('0x2'));router[_0xfa37('0x3')]('/',controller[_0xfa37('0x4')]);router[_0xfa37('0x3')](_0xfa37('0x5'),controller['forgot']);router[_0xfa37('0x3')](_0xfa37('0x6'),controller[_0xfa37('0x7')]);module[_0xfa37('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index ac314d2..e4498a4 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 _0xb5b4=['BOOLEAN','INTEGER','STRING'];(function(_0x2f87cd,_0xcaf299){var _0x5d7eda=function(_0x37ffb0){while(--_0x37ffb0){_0x2f87cd['push'](_0x2f87cd['shift']());}};_0x5d7eda(++_0xcaf299);}(_0xb5b4,0x9b));var _0x4b5b=function(_0x53d172,_0x46611b){_0x53d172=_0x53d172-0x0;var _0x1bd0a2=_0xb5b4[_0x53d172];return _0x1bd0a2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4b5b('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0x4b5b('0x0')]},'description':{'type':Sequelize[_0x4b5b('0x0')]},'status':{'type':Sequelize[_0x4b5b('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x4b5b('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x7953=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x4283c0,_0xc694d5){var _0x6b47ab=function(_0x4a8f0){while(--_0x4a8f0){_0x4283c0['push'](_0x4283c0['shift']());}};_0x6b47ab(++_0xc694d5);}(_0x7953,0x13d));var _0x3795=function(_0x5400b,_0x55943a){_0x5400b=_0x5400b-0x0;var _0x36a39b=_0x7953[_0x5400b];return _0x36a39b;};'use strict';var Sequelize=require(_0x3795('0x0'));module[_0x3795('0x1')]={'name':{'type':Sequelize[_0x3795('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x3795('0x2')]},'description':{'type':Sequelize[_0x3795('0x2')]},'status':{'type':Sequelize[_0x3795('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3795('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 ca9e257..f5b96f0 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 _0xd269=['offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','Automation','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','addConditions','Condition','ids','getConditions','findOne','hasOwnProperty','Action','omit','getActions','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x346adf,_0x1cfe1f){var _0x584630=function(_0x11379b){while(--_0x11379b){_0x346adf['push'](_0x346adf['shift']());}};_0x584630(++_0x1cfe1f);}(_0xd269,0x184));var _0x9d26=function(_0x33aff8,_0x5d1260){_0x33aff8=_0x33aff8-0x0;var _0x2ba02f=_0xd269[_0x33aff8];return _0x2ba02f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9d26('0x0'));var rimraf=require(_0x9d26('0x1'));var zipdir=require(_0x9d26('0x2'));var jsonpatch=require(_0x9d26('0x3'));var rp=require(_0x9d26('0x4'));var moment=require(_0x9d26('0x5'));var BPromise=require(_0x9d26('0x6'));var Mustache=require(_0x9d26('0x7'));var util=require(_0x9d26('0x8'));var path=require(_0x9d26('0x9'));var sox=require(_0x9d26('0xa'));var csv=require('to-csv');var ejs=require(_0x9d26('0xb'));var fs=require('fs');var _=require(_0x9d26('0xc'));var squel=require(_0x9d26('0xd'));var crypto=require(_0x9d26('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9d26('0xf'));var toCsv=require(_0x9d26('0x10'));var querystring=require(_0x9d26('0x11'));var Papa=require(_0x9d26('0x12'));var Redis=require('ioredis');var authService=require(_0x9d26('0x13'));var qs=require(_0x9d26('0x14'));var as=require(_0x9d26('0x15'));var hardwareService=require(_0x9d26('0x16'));var logger=require(_0x9d26('0x17'))(_0x9d26('0x18'));var utils=require(_0x9d26('0x19'));var config=require('../../config/environment');var db=require(_0x9d26('0x1a'))['db'];function respondWithStatusCode(_0x36e90b,_0x3801cc){_0x3801cc=_0x3801cc||0xcc;return function(_0xad55e0){if(_0xad55e0){return _0x36e90b[_0x9d26('0x1b')](_0x3801cc);}return _0x36e90b[_0x9d26('0x1c')](_0x3801cc)[_0x9d26('0x1d')]();};}function respondWithResult(_0x131fe1,_0x34d125){_0x34d125=_0x34d125||0xc8;return function(_0x10fdae){if(_0x10fdae){return _0x131fe1[_0x9d26('0x1c')](_0x34d125)[_0x9d26('0x1e')](_0x10fdae);}};}function respondWithFilteredResult(_0xa44d1b,_0x5909aa){return function(_0x13e36a){if(_0x13e36a){var _0x5bd943=_0x13e36a[_0x9d26('0x1f')],_0xee6765=_0x5909aa[_0x9d26('0x20')],_0x35373c=_0x5909aa['offset']+_0x5909aa[_0x9d26('0x21')],_0x2a5102;if(_0x35373c>=_0x5bd943){_0x35373c=_0x5bd943;_0x2a5102=0xc8;}else{_0x2a5102=0xce;}_0xa44d1b[_0x9d26('0x1c')](_0x2a5102);return _0xa44d1b[_0x9d26('0x22')](_0x9d26('0x23'),_0xee6765+'-'+_0x35373c+'/'+_0x5bd943)['json'](_0x13e36a);}return null;};}function patchUpdates(_0xcfd738){return function(_0x179acc){try{jsonpatch[_0x9d26('0x24')](_0x179acc,_0xcfd738,!![]);}catch(_0x173820){return BPromise['reject'](_0x173820);}return _0x179acc[_0x9d26('0x25')]();};}function saveUpdates(_0x2b2d77,_0x1e20c3){return function(_0x305317){if(_0x305317){return _0x305317[_0x9d26('0x26')](_0x2b2d77)[_0x9d26('0x27')](function(_0x1a2450){return _0x1a2450;});}return null;};}function removeEntity(_0x6f73a6,_0x557838){return function(_0x238eee){if(_0x238eee){return _0x238eee[_0x9d26('0x28')]()[_0x9d26('0x27')](function(){_0x6f73a6[_0x9d26('0x1c')](0xcc)[_0x9d26('0x1d')]();});}};}function handleEntityNotFound(_0x40cd6a,_0xf3343e){return function(_0xab04eb){if(!_0xab04eb){_0x40cd6a[_0x9d26('0x1b')](0x194);}return _0xab04eb;};}function handleError(_0xcf1c5,_0x374298){_0x374298=_0x374298||0x1f4;return function(_0x22e671){logger[_0x9d26('0x29')](_0x22e671[_0x9d26('0x2a')]);if(_0x22e671['name']){delete _0x22e671[_0x9d26('0x2b')];}_0xcf1c5[_0x9d26('0x1c')](_0x374298)[_0x9d26('0x2c')](_0x22e671);};}exports['index']=function(_0x5cdfe5,_0x69ee19){var _0x26cd7f={},_0x1aadaf={},_0x4c3a8a={'count':0x0,'rows':[]};var _0x225019=_[_0x9d26('0x2d')](db[_0x9d26('0x2e')][_0x9d26('0x2f')],function(_0x2549c1){return{'name':_0x2549c1[_0x9d26('0x30')],'type':_0x2549c1[_0x9d26('0x31')]['key']};});_0x1aadaf[_0x9d26('0x32')]=_[_0x9d26('0x2d')](_0x225019,'name');_0x1aadaf[_0x9d26('0x33')]=_[_0x9d26('0x34')](_0x5cdfe5['query']);_0x1aadaf['filters']=_[_0x9d26('0x35')](_0x1aadaf[_0x9d26('0x32')],_0x1aadaf[_0x9d26('0x33')]);_0x26cd7f[_0x9d26('0x36')]=_['intersection'](_0x1aadaf['model'],qs['fields'](_0x5cdfe5[_0x9d26('0x33')][_0x9d26('0x37')]));_0x26cd7f[_0x9d26('0x36')]=_0x26cd7f['attributes'][_0x9d26('0x38')]?_0x26cd7f[_0x9d26('0x36')]:_0x1aadaf[_0x9d26('0x32')];if(!_0x5cdfe5['query']['hasOwnProperty'](_0x9d26('0x39'))){_0x26cd7f['limit']=qs[_0x9d26('0x21')](_0x5cdfe5[_0x9d26('0x33')][_0x9d26('0x21')]);_0x26cd7f['offset']=qs['offset'](_0x5cdfe5[_0x9d26('0x33')][_0x9d26('0x20')]);}_0x26cd7f['order']=qs['sort'](_0x5cdfe5[_0x9d26('0x33')][_0x9d26('0x3a')]);_0x26cd7f[_0x9d26('0x3b')]=qs[_0x9d26('0x3c')](_[_0x9d26('0x3d')](_0x5cdfe5[_0x9d26('0x33')],_0x1aadaf['filters']));if(_0x5cdfe5[_0x9d26('0x33')]['filter']){_0x26cd7f[_0x9d26('0x3b')]=_[_0x9d26('0x3e')](_0x26cd7f[_0x9d26('0x3b')],{'$or':_[_0x9d26('0x2d')](_0x225019,function(_0x1b2d80){if(_0x1b2d80[_0x9d26('0x31')]!=='VIRTUAL'){var _0x4eb2e9={};_0x4eb2e9[_0x1b2d80[_0x9d26('0x2b')]]={'$like':'%'+_0x5cdfe5[_0x9d26('0x33')][_0x9d26('0x3f')]+'%'};return _0x4eb2e9;}})});}_0x26cd7f=_[_0x9d26('0x3e')]({},_0x26cd7f,_0x5cdfe5[_0x9d26('0x40')]);var _0x3e32e1={'where':_0x26cd7f[_0x9d26('0x3b')]};return db['Automation'][_0x9d26('0x1f')](_0x3e32e1)[_0x9d26('0x27')](function(_0x25619d){_0x4c3a8a[_0x9d26('0x1f')]=_0x25619d;if(_0x5cdfe5['query'][_0x9d26('0x41')]){_0x26cd7f[_0x9d26('0x42')]=[{'all':!![]}];}return db[_0x9d26('0x2e')][_0x9d26('0x43')](_0x26cd7f);})[_0x9d26('0x27')](function(_0x61a801){_0x4c3a8a[_0x9d26('0x44')]=_0x61a801;return _0x4c3a8a;})[_0x9d26('0x27')](respondWithFilteredResult(_0x69ee19,_0x26cd7f))[_0x9d26('0x45')](handleError(_0x69ee19,null));};exports[_0x9d26('0x46')]=function(_0x555819,_0x15e1c8){var _0x3dd0ff={'raw':![],'where':{'id':_0x555819[_0x9d26('0x47')]['id']}},_0xefcedc={};_0xefcedc['model']=_['keys'](db['Automation'][_0x9d26('0x2f')]);_0xefcedc[_0x9d26('0x33')]=_[_0x9d26('0x34')](_0x555819[_0x9d26('0x33')]);_0xefcedc[_0x9d26('0x3c')]=_[_0x9d26('0x35')](_0xefcedc['model'],_0xefcedc[_0x9d26('0x33')]);_0x3dd0ff[_0x9d26('0x36')]=_[_0x9d26('0x35')](_0xefcedc[_0x9d26('0x32')],qs[_0x9d26('0x37')](_0x555819['query'][_0x9d26('0x37')]));_0x3dd0ff[_0x9d26('0x36')]=_0x3dd0ff['attributes'][_0x9d26('0x38')]?_0x3dd0ff[_0x9d26('0x36')]:_0xefcedc[_0x9d26('0x32')];if(_0x555819[_0x9d26('0x33')][_0x9d26('0x41')]){_0x3dd0ff['include']=[{'all':!![]}];}_0x3dd0ff=_[_0x9d26('0x3e')]({},_0x3dd0ff,_0x555819[_0x9d26('0x40')]);return db[_0x9d26('0x2e')]['find'](_0x3dd0ff)[_0x9d26('0x27')](handleEntityNotFound(_0x15e1c8,null))[_0x9d26('0x27')](respondWithResult(_0x15e1c8,null))[_0x9d26('0x45')](handleError(_0x15e1c8,null));};exports[_0x9d26('0x48')]=function(_0x98eeed,_0x5aaa8e){return db[_0x9d26('0x2e')][_0x9d26('0x48')](_0x98eeed['body'],{})[_0x9d26('0x27')](respondWithResult(_0x5aaa8e,0xc9))[_0x9d26('0x45')](handleError(_0x5aaa8e,null));};exports[_0x9d26('0x26')]=function(_0x49148a,_0x54bce1){if(_0x49148a[_0x9d26('0x49')]['id']){delete _0x49148a[_0x9d26('0x49')]['id'];}return db[_0x9d26('0x2e')][_0x9d26('0x4a')]({'where':{'id':_0x49148a[_0x9d26('0x47')]['id']}})[_0x9d26('0x27')](handleEntityNotFound(_0x54bce1,null))['then'](saveUpdates(_0x49148a['body'],null))[_0x9d26('0x27')](respondWithResult(_0x54bce1,null))[_0x9d26('0x45')](handleError(_0x54bce1,null));};exports[_0x9d26('0x28')]=function(_0x16d0a4,_0x76f5c){return db[_0x9d26('0x2e')][_0x9d26('0x4a')]({'where':{'id':_0x16d0a4[_0x9d26('0x47')]['id']}})['then'](handleEntityNotFound(_0x76f5c,null))[_0x9d26('0x27')](removeEntity(_0x76f5c,null))[_0x9d26('0x45')](handleError(_0x76f5c,null));};exports[_0x9d26('0x4b')]=function(_0x570bbd,_0x428850,_0x49ec1c){return db[_0x9d26('0x4c')][_0x9d26('0x4a')]({'where':{'id':_0x570bbd[_0x9d26('0x47')]['id']}})[_0x9d26('0x27')](handleEntityNotFound(_0x428850,null))['then'](function(_0x2648fb){if(_0x2648fb){return _0x2648fb[_0x9d26('0x4b')](_0x570bbd[_0x9d26('0x49')][_0x9d26('0x4d')],_['omit'](_0x570bbd[_0x9d26('0x49')],[_0x9d26('0x4d'),'id'])||{});}})[_0x9d26('0x27')](respondWithResult(_0x428850,null))[_0x9d26('0x45')](handleError(_0x428850,null));};exports[_0x9d26('0x4e')]=function(_0x41171a,_0x19607f,_0xb72be3){var _0x1b0a80={};var _0x130c0d={};var _0x793da8;var _0x3553b9;return db[_0x9d26('0x2e')][_0x9d26('0x4f')]({'where':{'id':_0x41171a['params']['id']}})[_0x9d26('0x27')](handleEntityNotFound(_0x19607f,null))['then'](function(_0x6568f){if(_0x6568f){_0x793da8=_0x6568f;_0x130c0d[_0x9d26('0x32')]=_[_0x9d26('0x34')](db[_0x9d26('0x4c')][_0x9d26('0x2f')]);_0x130c0d['query']=_[_0x9d26('0x34')](_0x41171a[_0x9d26('0x33')]);_0x130c0d['filters']=_[_0x9d26('0x35')](_0x130c0d[_0x9d26('0x32')],_0x130c0d[_0x9d26('0x33')]);_0x1b0a80[_0x9d26('0x36')]=_[_0x9d26('0x35')](_0x130c0d[_0x9d26('0x32')],qs[_0x9d26('0x37')](_0x41171a[_0x9d26('0x33')][_0x9d26('0x37')]));_0x1b0a80[_0x9d26('0x36')]=_0x1b0a80[_0x9d26('0x36')][_0x9d26('0x38')]?_0x1b0a80[_0x9d26('0x36')]:_0x130c0d[_0x9d26('0x32')];_0x1b0a80['order']=qs[_0x9d26('0x3a')](_0x41171a[_0x9d26('0x33')][_0x9d26('0x3a')]);_0x1b0a80[_0x9d26('0x3b')]=qs[_0x9d26('0x3c')](_['pick'](_0x41171a[_0x9d26('0x33')],_0x130c0d[_0x9d26('0x3c')]));if(_0x41171a[_0x9d26('0x33')][_0x9d26('0x3f')]){_0x1b0a80['where']=_['merge'](_0x1b0a80[_0x9d26('0x3b')],{'$or':_[_0x9d26('0x2d')](_0x1b0a80[_0x9d26('0x36')],function(_0x2d726f){var _0x3cb87d={};_0x3cb87d[_0x2d726f]={'$like':'%'+_0x41171a[_0x9d26('0x33')]['filter']+'%'};return _0x3cb87d;})});}_0x1b0a80=_[_0x9d26('0x3e')]({},_0x1b0a80,_0x41171a['options']);return _0x793da8['getConditions'](_0x1b0a80);}})[_0x9d26('0x27')](function(_0xc3de6a){if(_0xc3de6a){_0x3553b9=_0xc3de6a[_0x9d26('0x38')];if(!_0x41171a['query'][_0x9d26('0x50')](_0x9d26('0x39'))){_0x1b0a80[_0x9d26('0x21')]=qs[_0x9d26('0x21')](_0x41171a[_0x9d26('0x33')][_0x9d26('0x21')]);_0x1b0a80[_0x9d26('0x20')]=qs[_0x9d26('0x20')](_0x41171a[_0x9d26('0x33')]['offset']);}return _0x793da8[_0x9d26('0x4e')](_0x1b0a80);}})[_0x9d26('0x27')](function(_0x82509d){if(_0x82509d){return _0x82509d?{'count':_0x3553b9,'rows':_0x82509d}:null;}})[_0x9d26('0x27')](respondWithResult(_0x19607f,null))[_0x9d26('0x45')](handleError(_0x19607f,null));};exports['addActions']=function(_0x26406b,_0x106f72,_0x2bc961){return db[_0x9d26('0x51')][_0x9d26('0x4a')]({'where':{'id':_0x26406b['params']['id']}})[_0x9d26('0x27')](handleEntityNotFound(_0x106f72,null))[_0x9d26('0x27')](function(_0x3b1345){if(_0x3b1345){return _0x3b1345['addActions'](_0x26406b[_0x9d26('0x49')]['ids'],_[_0x9d26('0x52')](_0x26406b[_0x9d26('0x49')],[_0x9d26('0x4d'),'id'])||{});}})[_0x9d26('0x27')](respondWithResult(_0x106f72,null))[_0x9d26('0x45')](handleError(_0x106f72,null));};exports[_0x9d26('0x53')]=function(_0x17eff1,_0xa2f46b,_0x376eee){var _0x27436e={};var _0x68c2a3={};var _0x40938e;var _0x5a90ff;return db[_0x9d26('0x2e')][_0x9d26('0x4f')]({'where':{'id':_0x17eff1[_0x9d26('0x47')]['id']}})[_0x9d26('0x27')](handleEntityNotFound(_0xa2f46b,null))['then'](function(_0x443987){if(_0x443987){_0x40938e=_0x443987;_0x68c2a3['model']=_[_0x9d26('0x34')](db[_0x9d26('0x51')][_0x9d26('0x2f')]);_0x68c2a3['query']=_[_0x9d26('0x34')](_0x17eff1['query']);_0x68c2a3[_0x9d26('0x3c')]=_[_0x9d26('0x35')](_0x68c2a3[_0x9d26('0x32')],_0x68c2a3[_0x9d26('0x33')]);_0x27436e[_0x9d26('0x36')]=_[_0x9d26('0x35')](_0x68c2a3[_0x9d26('0x32')],qs[_0x9d26('0x37')](_0x17eff1['query'][_0x9d26('0x37')]));_0x27436e['attributes']=_0x27436e['attributes'][_0x9d26('0x38')]?_0x27436e[_0x9d26('0x36')]:_0x68c2a3[_0x9d26('0x32')];_0x27436e['order']=qs[_0x9d26('0x3a')](_0x17eff1['query'][_0x9d26('0x3a')]);_0x27436e[_0x9d26('0x3b')]=qs[_0x9d26('0x3c')](_[_0x9d26('0x3d')](_0x17eff1['query'],_0x68c2a3[_0x9d26('0x3c')]));if(_0x17eff1[_0x9d26('0x33')][_0x9d26('0x3f')]){_0x27436e[_0x9d26('0x3b')]=_[_0x9d26('0x3e')](_0x27436e[_0x9d26('0x3b')],{'$or':_[_0x9d26('0x2d')](_0x27436e[_0x9d26('0x36')],function(_0x26d6ff){var _0x2be86e={};_0x2be86e[_0x26d6ff]={'$like':'%'+_0x17eff1[_0x9d26('0x33')][_0x9d26('0x3f')]+'%'};return _0x2be86e;})});}_0x27436e=_[_0x9d26('0x3e')]({},_0x27436e,_0x17eff1[_0x9d26('0x40')]);return _0x40938e[_0x9d26('0x53')](_0x27436e);}})[_0x9d26('0x27')](function(_0x2f3191){if(_0x2f3191){_0x5a90ff=_0x2f3191[_0x9d26('0x38')];if(!_0x17eff1['query'][_0x9d26('0x50')]('nolimit')){_0x27436e['limit']=qs[_0x9d26('0x21')](_0x17eff1[_0x9d26('0x33')][_0x9d26('0x21')]);_0x27436e[_0x9d26('0x20')]=qs['offset'](_0x17eff1[_0x9d26('0x33')]['offset']);}return _0x40938e[_0x9d26('0x53')](_0x27436e);}})[_0x9d26('0x27')](function(_0x17751d){if(_0x17751d){return _0x17751d?{'count':_0x5a90ff,'rows':_0x17751d}:null;}})[_0x9d26('0x27')](respondWithResult(_0xa2f46b,null))[_0x9d26('0x45')](handleError(_0xa2f46b,null));}; \ No newline at end of file +var _0xa217=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Automation','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','show','params','keys','length','options','find','catch','create','body','addConditions','Condition','ids','getConditions','nolimit','addActions','Action','omit','getActions','findOne','eml-format','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','squel','crypto'];(function(_0x12eb13,_0x4708fc){var _0x97e6b4=function(_0x344d75){while(--_0x344d75){_0x12eb13['push'](_0x12eb13['shift']());}};_0x97e6b4(++_0x4708fc);}(_0xa217,0x98));var _0x7a21=function(_0x48a0b4,_0x2a4c3f){_0x48a0b4=_0x48a0b4-0x0;var _0x44b1e6=_0xa217[_0x48a0b4];return _0x44b1e6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7a21('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7a21('0x1'));var rp=require(_0x7a21('0x2'));var moment=require(_0x7a21('0x3'));var BPromise=require(_0x7a21('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7a21('0x5'));var ejs=require(_0x7a21('0x6'));var fs=require('fs');var _=require(_0x7a21('0x7'));var squel=require(_0x7a21('0x8'));var crypto=require(_0x7a21('0x9'));var jsforce=require(_0x7a21('0xa'));var deskjs=require(_0x7a21('0xb'));var toCsv=require(_0x7a21('0x5'));var querystring=require(_0x7a21('0xc'));var Papa=require(_0x7a21('0xd'));var Redis=require(_0x7a21('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7a21('0xf'));var as=require(_0x7a21('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a21('0x11'))(_0x7a21('0x12'));var utils=require(_0x7a21('0x13'));var config=require(_0x7a21('0x14'));var db=require(_0x7a21('0x15'))['db'];function respondWithStatusCode(_0x497f23,_0x2ddd58){_0x2ddd58=_0x2ddd58||0xcc;return function(_0x44deff){if(_0x44deff){return _0x497f23[_0x7a21('0x16')](_0x2ddd58);}return _0x497f23[_0x7a21('0x17')](_0x2ddd58)[_0x7a21('0x18')]();};}function respondWithResult(_0x52138c,_0x44b82c){_0x44b82c=_0x44b82c||0xc8;return function(_0x4fea3a){if(_0x4fea3a){return _0x52138c[_0x7a21('0x17')](_0x44b82c)[_0x7a21('0x19')](_0x4fea3a);}};}function respondWithFilteredResult(_0x51646e,_0x3a858a){return function(_0x139e4b){if(_0x139e4b){var _0x48ac54=_0x139e4b['count'],_0x70d0e2=_0x3a858a[_0x7a21('0x1a')],_0x663fb2=_0x3a858a[_0x7a21('0x1a')]+_0x3a858a[_0x7a21('0x1b')],_0x520758;if(_0x663fb2>=_0x48ac54){_0x663fb2=_0x48ac54;_0x520758=0xc8;}else{_0x520758=0xce;}_0x51646e[_0x7a21('0x17')](_0x520758);return _0x51646e['set'](_0x7a21('0x1c'),_0x70d0e2+'-'+_0x663fb2+'/'+_0x48ac54)['json'](_0x139e4b);}return null;};}function patchUpdates(_0x2a2dda){return function(_0x276908){try{jsonpatch[_0x7a21('0x1d')](_0x276908,_0x2a2dda,!![]);}catch(_0x29362d){return BPromise[_0x7a21('0x1e')](_0x29362d);}return _0x276908[_0x7a21('0x1f')]();};}function saveUpdates(_0x52c643,_0x22cdcd){return function(_0x36d94f){if(_0x36d94f){return _0x36d94f[_0x7a21('0x20')](_0x52c643)[_0x7a21('0x21')](function(_0x531661){return _0x531661;});}return null;};}function removeEntity(_0x46e33e,_0x516c44){return function(_0x2feae6){if(_0x2feae6){return _0x2feae6[_0x7a21('0x22')]()['then'](function(){_0x46e33e[_0x7a21('0x17')](0xcc)[_0x7a21('0x18')]();});}};}function handleEntityNotFound(_0x23053f,_0x816b66){return function(_0x715440){if(!_0x715440){_0x23053f[_0x7a21('0x16')](0x194);}return _0x715440;};}function handleError(_0x476291,_0x180015){_0x180015=_0x180015||0x1f4;return function(_0x2eb0f4){logger[_0x7a21('0x23')](_0x2eb0f4[_0x7a21('0x24')]);if(_0x2eb0f4[_0x7a21('0x25')]){delete _0x2eb0f4['name'];}_0x476291['status'](_0x180015)[_0x7a21('0x26')](_0x2eb0f4);};}exports['index']=function(_0x40a6b6,_0x38ed69){var _0x23eed8={},_0x20f373={},_0x50deab={'count':0x0,'rows':[]};var _0x477824=_['map'](db[_0x7a21('0x27')][_0x7a21('0x28')],function(_0x311c8c){return{'name':_0x311c8c[_0x7a21('0x29')],'type':_0x311c8c[_0x7a21('0x2a')]['key']};});_0x20f373[_0x7a21('0x2b')]=_[_0x7a21('0x2c')](_0x477824,_0x7a21('0x25'));_0x20f373[_0x7a21('0x2d')]=_['keys'](_0x40a6b6[_0x7a21('0x2d')]);_0x20f373[_0x7a21('0x2e')]=_[_0x7a21('0x2f')](_0x20f373['model'],_0x20f373[_0x7a21('0x2d')]);_0x23eed8['attributes']=_[_0x7a21('0x2f')](_0x20f373[_0x7a21('0x2b')],qs[_0x7a21('0x30')](_0x40a6b6['query'][_0x7a21('0x30')]));_0x23eed8[_0x7a21('0x31')]=_0x23eed8['attributes']['length']?_0x23eed8[_0x7a21('0x31')]:_0x20f373['model'];if(!_0x40a6b6[_0x7a21('0x2d')][_0x7a21('0x32')]('nolimit')){_0x23eed8['limit']=qs[_0x7a21('0x1b')](_0x40a6b6[_0x7a21('0x2d')]['limit']);_0x23eed8[_0x7a21('0x1a')]=qs[_0x7a21('0x1a')](_0x40a6b6['query'][_0x7a21('0x1a')]);}_0x23eed8[_0x7a21('0x33')]=qs[_0x7a21('0x34')](_0x40a6b6[_0x7a21('0x2d')][_0x7a21('0x34')]);_0x23eed8['where']=qs[_0x7a21('0x2e')](_[_0x7a21('0x35')](_0x40a6b6[_0x7a21('0x2d')],_0x20f373[_0x7a21('0x2e')]));if(_0x40a6b6[_0x7a21('0x2d')][_0x7a21('0x36')]){_0x23eed8[_0x7a21('0x37')]=_[_0x7a21('0x38')](_0x23eed8[_0x7a21('0x37')],{'$or':_[_0x7a21('0x2c')](_0x477824,function(_0x5192a5){if(_0x5192a5[_0x7a21('0x2a')]!==_0x7a21('0x39')){var _0x40ebb0={};_0x40ebb0[_0x5192a5[_0x7a21('0x25')]]={'$like':'%'+_0x40a6b6[_0x7a21('0x2d')][_0x7a21('0x36')]+'%'};return _0x40ebb0;}})});}_0x23eed8=_[_0x7a21('0x38')]({},_0x23eed8,_0x40a6b6['options']);var _0x58f4b5={'where':_0x23eed8[_0x7a21('0x37')]};return db['Automation'][_0x7a21('0x3a')](_0x58f4b5)['then'](function(_0x2c9c79){_0x50deab[_0x7a21('0x3a')]=_0x2c9c79;if(_0x40a6b6[_0x7a21('0x2d')][_0x7a21('0x3b')]){_0x23eed8[_0x7a21('0x3c')]=[{'all':!![]}];}return db[_0x7a21('0x27')][_0x7a21('0x3d')](_0x23eed8);})[_0x7a21('0x21')](function(_0x440ac3){_0x50deab['rows']=_0x440ac3;return _0x50deab;})['then'](respondWithFilteredResult(_0x38ed69,_0x23eed8))['catch'](handleError(_0x38ed69,null));};exports[_0x7a21('0x3e')]=function(_0x497a30,_0x1d0bb6){var _0xcf52ab={'raw':![],'where':{'id':_0x497a30[_0x7a21('0x3f')]['id']}},_0x1d87e8={};_0x1d87e8[_0x7a21('0x2b')]=_[_0x7a21('0x40')](db[_0x7a21('0x27')][_0x7a21('0x28')]);_0x1d87e8['query']=_[_0x7a21('0x40')](_0x497a30[_0x7a21('0x2d')]);_0x1d87e8[_0x7a21('0x2e')]=_[_0x7a21('0x2f')](_0x1d87e8[_0x7a21('0x2b')],_0x1d87e8[_0x7a21('0x2d')]);_0xcf52ab['attributes']=_['intersection'](_0x1d87e8['model'],qs[_0x7a21('0x30')](_0x497a30[_0x7a21('0x2d')][_0x7a21('0x30')]));_0xcf52ab[_0x7a21('0x31')]=_0xcf52ab[_0x7a21('0x31')][_0x7a21('0x41')]?_0xcf52ab[_0x7a21('0x31')]:_0x1d87e8[_0x7a21('0x2b')];if(_0x497a30['query'][_0x7a21('0x3b')]){_0xcf52ab[_0x7a21('0x3c')]=[{'all':!![]}];}_0xcf52ab=_[_0x7a21('0x38')]({},_0xcf52ab,_0x497a30[_0x7a21('0x42')]);return db[_0x7a21('0x27')][_0x7a21('0x43')](_0xcf52ab)[_0x7a21('0x21')](handleEntityNotFound(_0x1d0bb6,null))['then'](respondWithResult(_0x1d0bb6,null))[_0x7a21('0x44')](handleError(_0x1d0bb6,null));};exports[_0x7a21('0x45')]=function(_0x383b59,_0x3a6db8){return db['Automation'][_0x7a21('0x45')](_0x383b59[_0x7a21('0x46')],{})[_0x7a21('0x21')](respondWithResult(_0x3a6db8,0xc9))['catch'](handleError(_0x3a6db8,null));};exports[_0x7a21('0x20')]=function(_0x1acc9e,_0x5a52d3){if(_0x1acc9e[_0x7a21('0x46')]['id']){delete _0x1acc9e[_0x7a21('0x46')]['id'];}return db['Automation']['find']({'where':{'id':_0x1acc9e[_0x7a21('0x3f')]['id']}})[_0x7a21('0x21')](handleEntityNotFound(_0x5a52d3,null))[_0x7a21('0x21')](saveUpdates(_0x1acc9e['body'],null))[_0x7a21('0x21')](respondWithResult(_0x5a52d3,null))[_0x7a21('0x44')](handleError(_0x5a52d3,null));};exports[_0x7a21('0x22')]=function(_0x1cb9e7,_0x1869b2){return db[_0x7a21('0x27')][_0x7a21('0x43')]({'where':{'id':_0x1cb9e7[_0x7a21('0x3f')]['id']}})[_0x7a21('0x21')](handleEntityNotFound(_0x1869b2,null))['then'](removeEntity(_0x1869b2,null))['catch'](handleError(_0x1869b2,null));};exports[_0x7a21('0x47')]=function(_0x733a7e,_0x151265,_0x288c0c){return db[_0x7a21('0x48')][_0x7a21('0x43')]({'where':{'id':_0x733a7e[_0x7a21('0x3f')]['id']}})[_0x7a21('0x21')](handleEntityNotFound(_0x151265,null))[_0x7a21('0x21')](function(_0x1a49c0){if(_0x1a49c0){return _0x1a49c0['addConditions'](_0x733a7e[_0x7a21('0x46')]['ids'],_['omit'](_0x733a7e['body'],[_0x7a21('0x49'),'id'])||{});}})[_0x7a21('0x21')](respondWithResult(_0x151265,null))[_0x7a21('0x44')](handleError(_0x151265,null));};exports[_0x7a21('0x4a')]=function(_0x1566ce,_0x4c477f,_0x4a5b8e){var _0x50c4eb={};var _0x173e74={};var _0x360906;var _0x50b126;return db['Automation']['findOne']({'where':{'id':_0x1566ce[_0x7a21('0x3f')]['id']}})[_0x7a21('0x21')](handleEntityNotFound(_0x4c477f,null))[_0x7a21('0x21')](function(_0x2fb57d){if(_0x2fb57d){_0x360906=_0x2fb57d;_0x173e74['model']=_[_0x7a21('0x40')](db[_0x7a21('0x48')]['rawAttributes']);_0x173e74[_0x7a21('0x2d')]=_[_0x7a21('0x40')](_0x1566ce['query']);_0x173e74[_0x7a21('0x2e')]=_[_0x7a21('0x2f')](_0x173e74[_0x7a21('0x2b')],_0x173e74['query']);_0x50c4eb[_0x7a21('0x31')]=_[_0x7a21('0x2f')](_0x173e74[_0x7a21('0x2b')],qs[_0x7a21('0x30')](_0x1566ce[_0x7a21('0x2d')][_0x7a21('0x30')]));_0x50c4eb[_0x7a21('0x31')]=_0x50c4eb['attributes']['length']?_0x50c4eb[_0x7a21('0x31')]:_0x173e74[_0x7a21('0x2b')];_0x50c4eb['order']=qs[_0x7a21('0x34')](_0x1566ce[_0x7a21('0x2d')][_0x7a21('0x34')]);_0x50c4eb[_0x7a21('0x37')]=qs[_0x7a21('0x2e')](_[_0x7a21('0x35')](_0x1566ce[_0x7a21('0x2d')],_0x173e74[_0x7a21('0x2e')]));if(_0x1566ce[_0x7a21('0x2d')][_0x7a21('0x36')]){_0x50c4eb[_0x7a21('0x37')]=_[_0x7a21('0x38')](_0x50c4eb[_0x7a21('0x37')],{'$or':_['map'](_0x50c4eb['attributes'],function(_0x39aa86){var _0x48807c={};_0x48807c[_0x39aa86]={'$like':'%'+_0x1566ce[_0x7a21('0x2d')][_0x7a21('0x36')]+'%'};return _0x48807c;})});}_0x50c4eb=_['merge']({},_0x50c4eb,_0x1566ce[_0x7a21('0x42')]);return _0x360906[_0x7a21('0x4a')](_0x50c4eb);}})[_0x7a21('0x21')](function(_0x3bd473){if(_0x3bd473){_0x50b126=_0x3bd473[_0x7a21('0x41')];if(!_0x1566ce['query'][_0x7a21('0x32')](_0x7a21('0x4b'))){_0x50c4eb['limit']=qs[_0x7a21('0x1b')](_0x1566ce['query'][_0x7a21('0x1b')]);_0x50c4eb[_0x7a21('0x1a')]=qs['offset'](_0x1566ce[_0x7a21('0x2d')][_0x7a21('0x1a')]);}return _0x360906[_0x7a21('0x4a')](_0x50c4eb);}})[_0x7a21('0x21')](function(_0x2c3548){if(_0x2c3548){return _0x2c3548?{'count':_0x50b126,'rows':_0x2c3548}:null;}})['then'](respondWithResult(_0x4c477f,null))[_0x7a21('0x44')](handleError(_0x4c477f,null));};exports[_0x7a21('0x4c')]=function(_0x5eda77,_0x1d1453,_0x32e343){return db[_0x7a21('0x4d')][_0x7a21('0x43')]({'where':{'id':_0x5eda77[_0x7a21('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1d1453,null))[_0x7a21('0x21')](function(_0x54ef20){if(_0x54ef20){return _0x54ef20[_0x7a21('0x4c')](_0x5eda77['body']['ids'],_[_0x7a21('0x4e')](_0x5eda77[_0x7a21('0x46')],[_0x7a21('0x49'),'id'])||{});}})[_0x7a21('0x21')](respondWithResult(_0x1d1453,null))[_0x7a21('0x44')](handleError(_0x1d1453,null));};exports[_0x7a21('0x4f')]=function(_0x4d5a49,_0x383760,_0x5307c7){var _0x31bac6={};var _0x32d453={};var _0x37987d;var _0x2b7e7b;return db[_0x7a21('0x27')][_0x7a21('0x50')]({'where':{'id':_0x4d5a49['params']['id']}})[_0x7a21('0x21')](handleEntityNotFound(_0x383760,null))[_0x7a21('0x21')](function(_0x1262b0){if(_0x1262b0){_0x37987d=_0x1262b0;_0x32d453[_0x7a21('0x2b')]=_[_0x7a21('0x40')](db[_0x7a21('0x4d')][_0x7a21('0x28')]);_0x32d453[_0x7a21('0x2d')]=_['keys'](_0x4d5a49[_0x7a21('0x2d')]);_0x32d453[_0x7a21('0x2e')]=_[_0x7a21('0x2f')](_0x32d453[_0x7a21('0x2b')],_0x32d453[_0x7a21('0x2d')]);_0x31bac6[_0x7a21('0x31')]=_[_0x7a21('0x2f')](_0x32d453[_0x7a21('0x2b')],qs[_0x7a21('0x30')](_0x4d5a49[_0x7a21('0x2d')][_0x7a21('0x30')]));_0x31bac6['attributes']=_0x31bac6[_0x7a21('0x31')][_0x7a21('0x41')]?_0x31bac6[_0x7a21('0x31')]:_0x32d453[_0x7a21('0x2b')];_0x31bac6[_0x7a21('0x33')]=qs[_0x7a21('0x34')](_0x4d5a49[_0x7a21('0x2d')][_0x7a21('0x34')]);_0x31bac6[_0x7a21('0x37')]=qs[_0x7a21('0x2e')](_[_0x7a21('0x35')](_0x4d5a49[_0x7a21('0x2d')],_0x32d453['filters']));if(_0x4d5a49['query'][_0x7a21('0x36')]){_0x31bac6[_0x7a21('0x37')]=_[_0x7a21('0x38')](_0x31bac6['where'],{'$or':_[_0x7a21('0x2c')](_0x31bac6['attributes'],function(_0x27b471){var _0x20d16c={};_0x20d16c[_0x27b471]={'$like':'%'+_0x4d5a49[_0x7a21('0x2d')]['filter']+'%'};return _0x20d16c;})});}_0x31bac6=_[_0x7a21('0x38')]({},_0x31bac6,_0x4d5a49[_0x7a21('0x42')]);return _0x37987d[_0x7a21('0x4f')](_0x31bac6);}})['then'](function(_0x416624){if(_0x416624){_0x2b7e7b=_0x416624[_0x7a21('0x41')];if(!_0x4d5a49[_0x7a21('0x2d')]['hasOwnProperty'](_0x7a21('0x4b'))){_0x31bac6[_0x7a21('0x1b')]=qs[_0x7a21('0x1b')](_0x4d5a49['query'][_0x7a21('0x1b')]);_0x31bac6[_0x7a21('0x1a')]=qs[_0x7a21('0x1a')](_0x4d5a49[_0x7a21('0x2d')]['offset']);}return _0x37987d[_0x7a21('0x4f')](_0x31bac6);}})[_0x7a21('0x21')](function(_0x19f269){if(_0x19f269){return _0x19f269?{'count':_0x2b7e7b,'rows':_0x19f269}:null;}})[_0x7a21('0x21')](respondWithResult(_0x383760,null))[_0x7a21('0x44')](handleError(_0x383760,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 06afb7b..ed81d30 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 _0x0268=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Automation','tools_automations','lodash','../../config/logger'];(function(_0x59f117,_0x3f05af){var _0x59b486=function(_0x4a31e5){while(--_0x4a31e5){_0x59f117['push'](_0x59f117['shift']());}};_0x59b486(++_0x3f05af);}(_0x0268,0x17e));var _0x8026=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0268[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8026('0x0'));var util=require('util');var logger=require(_0x8026('0x1'))(_0x8026('0x2'));var moment=require('moment');var BPromise=require(_0x8026('0x3'));var rp=require(_0x8026('0x4'));var fs=require('fs');var path=require(_0x8026('0x5'));var rimraf=require(_0x8026('0x6'));var config=require(_0x8026('0x7'));var attributes=require('./automation.attributes');module[_0x8026('0x8')]=function(_0x7a8ba2,_0x589205){return _0x7a8ba2[_0x8026('0x9')](_0x8026('0xa'),attributes,{'tableName':_0x8026('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdff=['tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','Automation'];(function(_0x32174f,_0x3b465e){var _0x230d4e=function(_0x43683f){while(--_0x43683f){_0x32174f['push'](_0x32174f['shift']());}};_0x230d4e(++_0x3b465e);}(_0xbdff,0x114));var _0xfbdf=function(_0x505aeb,_0x4811bd){_0x505aeb=_0x505aeb-0x0;var _0x4be043=_0xbdff[_0x505aeb];return _0x4be043;};'use strict';var _=require(_0xfbdf('0x0'));var util=require(_0xfbdf('0x1'));var logger=require(_0xfbdf('0x2'))(_0xfbdf('0x3'));var moment=require(_0xfbdf('0x4'));var BPromise=require(_0xfbdf('0x5'));var rp=require(_0xfbdf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbdf('0x7'));var config=require(_0xfbdf('0x8'));var attributes=require('./automation.attributes');module['exports']=function(_0x494351,_0x30d8e8){return _0x494351['define'](_0xfbdf('0x9'),attributes,{'tableName':_0xfbdf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index b988cb6..d5dfcaa 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 _0x294f=['http','request','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code','Automation,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x30183c,_0x41fa9c){var _0x57eaa1=function(_0x16053f){while(--_0x16053f){_0x30183c['push'](_0x30183c['shift']());}};_0x57eaa1(++_0x41fa9c);}(_0x294f,0x1ae));var _0xf294=function(_0x2b8f2b,_0x3e41ac){_0x2b8f2b=_0x2b8f2b-0x0;var _0x12b3ff=_0x294f[_0x2b8f2b];return _0x12b3ff;};'use strict';var _=require(_0xf294('0x0'));var util=require(_0xf294('0x1'));var moment=require(_0xf294('0x2'));var BPromise=require(_0xf294('0x3'));var rs=require(_0xf294('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf294('0x5'))['db'];var utils=require(_0xf294('0x6'));var logger=require(_0xf294('0x7'))(_0xf294('0x8'));var config=require('../../config/environment');var jayson=require(_0xf294('0x9'));var client=jayson['client'][_0xf294('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x497454,_0x5f5147,_0x4e066e){return new BPromise(function(_0x3df33d,_0x1fefd6){return client[_0xf294('0xb')](_0x497454,_0x4e066e)['then'](function(_0x38863e){logger[_0xf294('0xc')]('Automation,\x20%s,\x20%s',_0x5f5147,_0xf294('0xd'));logger['debug'](_0xf294('0xe'),_0x5f5147,_0xf294('0xd'),JSON['stringify'](_0x38863e));if(_0x38863e[_0xf294('0xf')]){if(_0x38863e[_0xf294('0xf')][_0xf294('0x10')]===0x1f4){logger[_0xf294('0xf')](_0xf294('0x11'),_0x5f5147,_0x38863e[_0xf294('0xf')][_0xf294('0x12')]);return _0x1fefd6(_0x38863e[_0xf294('0xf')][_0xf294('0x12')]);}logger[_0xf294('0xf')](_0xf294('0x11'),_0x5f5147,_0x38863e[_0xf294('0xf')][_0xf294('0x12')]);return _0x3df33d(_0x38863e[_0xf294('0xf')]['message']);}else{logger[_0xf294('0xc')](_0xf294('0x11'),_0x5f5147,_0xf294('0xd'));_0x3df33d(_0x38863e['result']['message']);}})[_0xf294('0x13')](function(_0x47b530){logger[_0xf294('0xf')](_0xf294('0x11'),_0x5f5147,_0x47b530);_0x1fefd6(_0x47b530);});});} \ No newline at end of file +var _0xd333=['../../config/logger','rpc','client','http','request','then','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Automation,\x20%s,\x20%s','info','result','moment','bluebird','ioredis','../../config/utils'];(function(_0x21c325,_0x3c481a){var _0x263653=function(_0x4cda9c){while(--_0x4cda9c){_0x21c325['push'](_0x21c325['shift']());}};_0x263653(++_0x3c481a);}(_0xd333,0x106));var _0x3d33=function(_0x4c7e75,_0xc8ca4e){_0x4c7e75=_0x4c7e75-0x0;var _0x4b0b1c=_0xd333[_0x4c7e75];return _0x4b0b1c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3d33('0x0'));var BPromise=require(_0x3d33('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d33('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d33('0x3'));var logger=require(_0x3d33('0x4'))(_0x3d33('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d33('0x6')][_0x3d33('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x24d336,_0x44a8bb,_0x35452c){return new BPromise(function(_0x4569f7,_0x17fd28){return client[_0x3d33('0x8')](_0x24d336,_0x35452c)[_0x3d33('0x9')](function(_0xb7edea){logger['info']('Automation,\x20%s,\x20%s',_0x44a8bb,'request\x20sent');logger[_0x3d33('0xa')](_0x3d33('0xb'),_0x44a8bb,'request\x20sent',JSON[_0x3d33('0xc')](_0xb7edea));if(_0xb7edea[_0x3d33('0xd')]){if(_0xb7edea[_0x3d33('0xd')][_0x3d33('0xe')]===0x1f4){logger[_0x3d33('0xd')]('Automation,\x20%s,\x20%s',_0x44a8bb,_0xb7edea[_0x3d33('0xd')][_0x3d33('0xf')]);return _0x17fd28(_0xb7edea['error'][_0x3d33('0xf')]);}logger[_0x3d33('0xd')](_0x3d33('0x10'),_0x44a8bb,_0xb7edea['error'][_0x3d33('0xf')]);return _0x4569f7(_0xb7edea[_0x3d33('0xd')][_0x3d33('0xf')]);}else{logger[_0x3d33('0x11')](_0x3d33('0x10'),_0x44a8bb,'request\x20sent');_0x4569f7(_0xb7edea[_0x3d33('0x12')][_0x3d33('0xf')]);}})['catch'](function(_0x2f8adf){logger[_0x3d33('0xd')](_0x3d33('0x10'),_0x44a8bb,_0x2f8adf);_0x17fd28(_0x2f8adf);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 430b042..effbcc9 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 _0xfe52=['update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','show','get','isAuthenticated','getConditions','getActions','post','create','/:id/conditions','addConditions','addActions','put'];(function(_0x553e2f,_0x41a2e9){var _0x571850=function(_0x2449ce){while(--_0x2449ce){_0x553e2f['push'](_0x553e2f['shift']());}};_0x571850(++_0x41a2e9);}(_0xfe52,0x93));var _0x2fe5=function(_0x2ab06a,_0x251476){_0x2ab06a=_0x2ab06a-0x0;var _0x18c5e9=_0xfe52[_0x2ab06a];return _0x18c5e9;};'use strict';var multer=require(_0x2fe5('0x0'));var util=require(_0x2fe5('0x1'));var path=require('path');var timeout=require(_0x2fe5('0x2'));var express=require(_0x2fe5('0x3'));var router=express[_0x2fe5('0x4')]();var auth=require(_0x2fe5('0x5'));var interaction=require(_0x2fe5('0x6'));var config=require(_0x2fe5('0x7'));var controller=require('./automation.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2fe5('0x8')]);router['get'](_0x2fe5('0x9'),auth['isAuthenticated'](),controller[_0x2fe5('0xa')]);router[_0x2fe5('0xb')]('/:id/conditions',auth[_0x2fe5('0xc')](),controller[_0x2fe5('0xd')]);router[_0x2fe5('0xb')]('/:id/actions',auth[_0x2fe5('0xc')](),controller[_0x2fe5('0xe')]);router[_0x2fe5('0xf')]('/',auth[_0x2fe5('0xc')](),controller[_0x2fe5('0x10')]);router[_0x2fe5('0xf')](_0x2fe5('0x11'),auth[_0x2fe5('0xc')](),controller[_0x2fe5('0x12')]);router[_0x2fe5('0xf')]('/:id/actions',auth['isAuthenticated'](),controller[_0x2fe5('0x13')]);router[_0x2fe5('0x14')](_0x2fe5('0x9'),auth['isAuthenticated'](),controller[_0x2fe5('0x15')]);router['delete'](_0x2fe5('0x9'),auth[_0x2fe5('0xc')](),controller[_0x2fe5('0x16')]);module[_0x2fe5('0x17')]=router; \ No newline at end of file +var _0x6e7c=['isAuthenticated','get','/:id','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','put','update','destroy','util','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0xa39654,_0x58e3be){var _0x1c929d=function(_0x54a65d){while(--_0x54a65d){_0xa39654['push'](_0xa39654['shift']());}};_0x1c929d(++_0x58e3be);}(_0x6e7c,0xb6));var _0xc6e7=function(_0x2c6da1,_0x232af9){_0x2c6da1=_0x2c6da1-0x0;var _0x45fa9e=_0x6e7c[_0x2c6da1];return _0x45fa9e;};'use strict';var multer=require('multer');var util=require(_0xc6e7('0x0'));var path=require('path');var timeout=require(_0xc6e7('0x1'));var express=require('express');var router=express[_0xc6e7('0x2')]();var auth=require(_0xc6e7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e7('0x4'));var controller=require('./automation.controller');router['get']('/',auth[_0xc6e7('0x5')](),controller['index']);router[_0xc6e7('0x6')](_0xc6e7('0x7'),auth[_0xc6e7('0x5')](),controller['show']);router[_0xc6e7('0x6')](_0xc6e7('0x8'),auth[_0xc6e7('0x5')](),controller[_0xc6e7('0x9')]);router[_0xc6e7('0x6')](_0xc6e7('0xa'),auth[_0xc6e7('0x5')](),controller['getActions']);router[_0xc6e7('0xb')]('/',auth['isAuthenticated'](),controller[_0xc6e7('0xc')]);router['post']('/:id/conditions',auth[_0xc6e7('0x5')](),controller[_0xc6e7('0xd')]);router[_0xc6e7('0xb')](_0xc6e7('0xa'),auth[_0xc6e7('0x5')](),controller['addActions']);router[_0xc6e7('0xe')](_0xc6e7('0x7'),auth[_0xc6e7('0x5')](),controller[_0xc6e7('0xf')]);router['delete'](_0xc6e7('0x7'),auth[_0xc6e7('0x5')](),controller[_0xc6e7('0x10')]);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 4738fbb..733dc18 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 _0x3fe7=['#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','onlyIfOpen','always','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','ENUM','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0x3fe7,0xa9));var _0x73fe=function(_0xd3348b,_0x288d47){_0xd3348b=_0xd3348b-0x0;var _0x583cdc=_0x3fe7[_0xd3348b];return _0x583cdc;};'use strict';var Sequelize=require(_0x73fe('0x0'));module[_0x73fe('0x1')]={'name':{'type':Sequelize[_0x73fe('0x2')],'unique':_0x73fe('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x73fe('0x4')),'allowNull':![],'defaultValue':_0x73fe('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x73fe('0x5')},'limitCalls':{'type':Sequelize[_0x73fe('0x6')](0x4)[_0x73fe('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x73fe('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x73fe('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x73fe('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x73fe('0x6')](0x3)[_0x73fe('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x73fe('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x73fe('0x6')](0x5)[_0x73fe('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x73fe('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x73fe('0x6')](0x3)[_0x73fe('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x73fe('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x73fe('0x6')](0x5)[_0x73fe('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x73fe('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x73fe('0x6')](0x3)[_0x73fe('0x7')],'defaultValue':0x3,'comment':_0x73fe('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x73fe('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x73fe('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x73fe('0x6')](0x3)[_0x73fe('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x73fe('0xf')},'dialTimezone':{'type':Sequelize[_0x73fe('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x73fe('0x10'),_0x73fe('0x11')),'defaultValue':_0x73fe('0x12')},'dialAMDActive':{'type':Sequelize[_0x73fe('0x13')],'defaultValue':0x0,'comment':_0x73fe('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x73fe('0x6')](0x9)[_0x73fe('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x73fe('0x15')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x73fe('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x73fe('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x73fe('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x73fe('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x73fe('0x6')](0x9)[_0x73fe('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x73fe('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x73fe('0x6')](0x9)[_0x73fe('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x73fe('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x73fe('0x6')](0x9)[_0x73fe('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x73fe('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x73fe('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x73fe('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x73fe('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x73fe('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x73fe('0x1d')](_0x73fe('0x1e'),_0x73fe('0x1f')),'defaultValue':_0x73fe('0x1e')},'dialPrefix':{'type':Sequelize[_0x73fe('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x73fe('0x6')](0x3)[_0x73fe('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x73fe('0x20')},'dialCutDigit':{'type':Sequelize[_0x73fe('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x73fe('0x21')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x73fe('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x73fe('0x22')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x73fe('0x6')](0x5)[_0x73fe('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x73fe('0x23')},'dialDropMaxRetry':{'type':Sequelize[_0x73fe('0x6')](0x3)[_0x73fe('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x73fe('0x24')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x73fe('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x73fe('0x6')](0x3)[_0x73fe('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x73fe('0x25')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x73fe('0x6')](0x5)[_0x73fe('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x73fe('0x26')},'dialMachineMaxRetry':{'type':Sequelize[_0x73fe('0x6')](0x3)[_0x73fe('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x73fe('0x6')](0x5)[_0x73fe('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x73fe('0x6')](0x3)[_0x73fe('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x73fe('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x73fe('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x73fe('0x28')}}; \ No newline at end of file +var _0xb3a0=['DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','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)','exports','STRING','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x52f73a,_0x4418dd){var _0x4b5d40=function(_0x3aea52){while(--_0x3aea52){_0x52f73a['push'](_0x52f73a['shift']());}};_0x4b5d40(++_0x4418dd);}(_0xb3a0,0x100));var _0x0b3a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb3a0[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x0b3a('0x0')]={'name':{'type':Sequelize[_0x0b3a('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0b3a('0x2')](_0x0b3a('0x3')),'allowNull':![],'defaultValue':_0x0b3a('0x3')},'description':{'type':Sequelize[_0x0b3a('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x0b3a('0x4')},'limitCalls':{'type':Sequelize[_0x0b3a('0x5')](0x4)[_0x0b3a('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0b3a('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0b3a('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0b3a('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x0b3a('0x5')](0x3)[_0x0b3a('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x0b3a('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b3a('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0b3a('0x5')](0x5)[_0x0b3a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x0b3a('0x5')](0x3)[_0x0b3a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x0b3a('0x5')](0x5)[_0x0b3a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b3a('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x0b3a('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b3a('0xb')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0b3a('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x0b3a('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0b3a('0x1')],'defaultValue':_0x0b3a('0xc')},'dialCheckDuplicateType':{'type':Sequelize[_0x0b3a('0x2')](_0x0b3a('0xd'),_0x0b3a('0xe'),'onlyIfOpen'),'defaultValue':_0x0b3a('0xd')},'dialAMDActive':{'type':Sequelize[_0x0b3a('0xf')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0b3a('0x5')](0x9)[_0x0b3a('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0b3a('0x10')},'dialAMDGreeting':{'type':Sequelize[_0x0b3a('0x5')](0x9)[_0x0b3a('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0b3a('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0b3a('0x5')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0b3a('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x0b3a('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0b3a('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0x0b3a('0x5')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0b3a('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0b3a('0x5')](0x9)[_0x0b3a('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0b3a('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0b3a('0x5')](0x9)[_0x0b3a('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0b3a('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x0b3a('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0b3a('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0b3a('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0b3a('0x2')](_0x0b3a('0x18'),_0x0b3a('0x19')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0b3a('0x5')](0x3)[_0x0b3a('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0b3a('0x1a')},'dialCutDigit':{'type':Sequelize[_0x0b3a('0x5')](0x3)[_0x0b3a('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0b3a('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0b3a('0x5')](0x3)[_0x0b3a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b3a('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0b3a('0x5')](0x5)[_0x0b3a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b3a('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x0b3a('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b3a('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x0b3a('0x5')](0x5)[_0x0b3a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b3a('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0b3a('0x5')](0x3)[_0x0b3a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0b3a('0x5')](0x5)[_0x0b3a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b3a('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x0b3a('0x5')](0x3)[_0x0b3a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0b3a('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0b3a('0x5')](0x5)[_0x0b3a('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0b3a('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0b3a('0x5')](0x3)[_0x0b3a('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0b3a('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index df342e9..406ed8f 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 _0x9bde=['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','clone','omit','createdAt','updatedAt','body','autoAssociation','getHoppers','CmHopper','pick','rows','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','select','field','phone','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','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','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','sendStatus','stack','name','send','index','map','Campaign','rawAttributes','type','key'];(function(_0x275dc8,_0x23df81){var _0x2e6cc3=function(_0x4c6602){while(--_0x4c6602){_0x275dc8['push'](_0x275dc8['shift']());}};_0x2e6cc3(++_0x23df81);}(_0x9bde,0xe1));var _0xe9bd=function(_0x105ac7,_0x364137){_0x105ac7=_0x105ac7-0x0;var _0x357be6=_0x9bde[_0x105ac7];return _0x357be6;};'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')]));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['Campaign'][_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['Campaign'][_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='IvrCampaigns';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('0x53')]=function(_0x5496d7,_0x55f619){var _0x4d6021={'where':{'id':_0x5496d7[_0xe9bd('0x47')]['id']}},_0x3aeda2={};_0x3aeda2[_0xe9bd('0x33')]=_['keys'](db[_0xe9bd('0x2f')][_0xe9bd('0x30')]);_0x4d6021[_0xe9bd('0x37')]=_[_0xe9bd('0x48')](_0x3aeda2['model'],qs['fields'](_0x5496d7[_0xe9bd('0x34')]['fields']));_0x4d6021[_0xe9bd('0x37')]=_0x4d6021[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x4d6021[_0xe9bd('0x37')]:_0x3aeda2[_0xe9bd('0x33')];if(_0x5496d7[_0xe9bd('0x34')][_0xe9bd('0x49')]){_0x4d6021[_0xe9bd('0x43')]=[{'all':!![]}];}_0x4d6021=_[_0xe9bd('0x40')]({},_0x4d6021,_0x5496d7[_0xe9bd('0x42')]);return db[_0xe9bd('0x2f')][_0xe9bd('0x4a')](_0x4d6021)['then'](handleEntityNotFound(_0x55f619,null))['then'](function(_0x566dd8){if(_0x566dd8){var _0x10e685=_0x566dd8['get']({'plain':!![]});_0x10e685=qs[_0xe9bd('0x54')](_0x10e685,['id',_0xe9bd('0x55'),_0xe9bd('0x56')]);_0x5496d7[_0xe9bd('0x57')]=_[_0xe9bd('0x54')](_0x5496d7[_0xe9bd('0x57')],['id',_0xe9bd('0x55'),_0xe9bd('0x56')]);return db[_0xe9bd('0x2f')]['create'](_[_0xe9bd('0x40')](_0x10e685,_0x5496d7[_0xe9bd('0x57')]),{'include':_0x5496d7[_0xe9bd('0x34')][_0xe9bd('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x1c8765){var _0xc44b92=_0x5496d7[_0xe9bd('0x4e')]['get']({'plain':!![]});if(!_0xc44b92)throw new Error(_0xe9bd('0x4c'));if(_0xc44b92[_0xe9bd('0x4d')]===_0xe9bd('0x4e')){var _0xfe82f7=_0x1c8765['get']({'plain':!![]});var _0x4b3447=_0xe9bd('0x28');return db[_0xe9bd('0x4f')][_0xe9bd('0x4a')]({'where':{'name':_0x4b3447,'userProfileId':_0xc44b92[_0xe9bd('0x50')]},'raw':!![]})['then'](function(_0x49add9){if(_0x49add9&&_0x49add9[_0xe9bd('0x58')]===0x0){return db[_0xe9bd('0x51')][_0xe9bd('0x4b')]({'name':_0xfe82f7[_0xe9bd('0x2b')],'resourceId':_0xfe82f7['id'],'type':_0x49add9[_0xe9bd('0x2b')],'sectionId':_0x49add9['id']},{})[_0xe9bd('0x25')](function(){return _0x1c8765;});}else{return _0x1c8765;}})['catch'](function(_0x179c8d){logger['error'](_0xe9bd('0x52'),_0x179c8d);throw _0x179c8d;});}return _0x1c8765;});}})[_0xe9bd('0x25')](respondWithResult(_0x55f619,0xc9))[_0xe9bd('0x45')](handleError(_0x55f619,null));};exports[_0xe9bd('0x24')]=function(_0x5bc1f8,_0x1cc054){if(_0x5bc1f8[_0xe9bd('0x57')]['id']){delete _0x5bc1f8[_0xe9bd('0x57')]['id'];}return db['Campaign'][_0xe9bd('0x4a')]({'where':{'id':_0x5bc1f8[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x1cc054,null))[_0xe9bd('0x25')](saveUpdates(_0x5bc1f8[_0xe9bd('0x57')],null))[_0xe9bd('0x25')](respondWithResult(_0x1cc054,null))[_0xe9bd('0x45')](handleError(_0x1cc054,null));};exports[_0xe9bd('0x26')]=function(_0x38e2bf,_0x37bb08){return db[_0xe9bd('0x2f')][_0xe9bd('0x4a')]({'where':{'id':_0x38e2bf['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x37bb08,null))[_0xe9bd('0x25')](removeEntity(_0x37bb08,null))['catch'](handleError(_0x37bb08,null));};exports[_0xe9bd('0x59')]=function(_0xe82570,_0x59b8be,_0x561165){var _0x3eeaa5={'raw':!![],'where':{}};var _0x4190f0={};var _0x4ec6ec={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0xe82570[_0xe9bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x59b8be,null))['then'](function(_0x4b5bfb){if(_0x4b5bfb){_0x4190f0['model']=_[_0xe9bd('0x35')](db[_0xe9bd('0x5a')][_0xe9bd('0x30')]);_0x4190f0['query']=_[_0xe9bd('0x35')](_0xe82570[_0xe9bd('0x34')]);_0x4190f0[_0xe9bd('0x36')]=_[_0xe9bd('0x48')](_0x4190f0['model'],_0x4190f0[_0xe9bd('0x34')]);_0x3eeaa5[_0xe9bd('0x37')]=_[_0xe9bd('0x48')](_0x4190f0['model'],qs['fields'](_0xe82570[_0xe9bd('0x34')][_0xe9bd('0x38')]));_0x3eeaa5[_0xe9bd('0x37')]=_0x3eeaa5[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x3eeaa5[_0xe9bd('0x37')]:_0x4190f0[_0xe9bd('0x33')];if(!_0xe82570[_0xe9bd('0x34')]['hasOwnProperty'](_0xe9bd('0x3b'))){_0x3eeaa5[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0xe82570[_0xe9bd('0x34')][_0xe9bd('0x1e')]);_0x3eeaa5['offset']=qs[_0xe9bd('0x1d')](_0xe82570['query']['offset']);}_0x3eeaa5[_0xe9bd('0x3c')]=qs[_0xe9bd('0x3d')](_0xe82570['query'][_0xe9bd('0x3d')]);_0x3eeaa5[_0xe9bd('0x3e')]=qs[_0xe9bd('0x36')](_[_0xe9bd('0x5b')](_0xe82570['query'],_0x4190f0[_0xe9bd('0x36')]));_0x3eeaa5[_0xe9bd('0x3e')]['CampaignId']=_0x4b5bfb['id'];if(_0xe82570[_0xe9bd('0x34')][_0xe9bd('0x3f')]){_0x3eeaa5[_0xe9bd('0x3e')]=_[_0xe9bd('0x40')](_0x3eeaa5[_0xe9bd('0x3e')],{'$or':_[_0xe9bd('0x2e')](_0x3eeaa5[_0xe9bd('0x37')],function(_0x5e127b){var _0x1b0929={};_0x1b0929[_0x5e127b]={'$like':'%'+_0xe82570[_0xe9bd('0x34')][_0xe9bd('0x3f')]+'%'};return _0x1b0929;})});}_0x3eeaa5=_[_0xe9bd('0x40')]({},_0x3eeaa5,_0xe82570[_0xe9bd('0x42')]);return db[_0xe9bd('0x5a')][_0xe9bd('0x1c')]({'where':_0x3eeaa5[_0xe9bd('0x3e')]})[_0xe9bd('0x25')](function(_0x5a7dfd){_0x4ec6ec[_0xe9bd('0x1c')]=_0x5a7dfd;if(_0xe82570[_0xe9bd('0x34')][_0xe9bd('0x49')]){_0x3eeaa5[_0xe9bd('0x43')]=[{'all':!![]}];}return db[_0xe9bd('0x5a')][_0xe9bd('0x44')](_0x3eeaa5);})[_0xe9bd('0x25')](function(_0x4b9c08){_0x4ec6ec[_0xe9bd('0x5c')]=_0x4b9c08;return _0x4ec6ec;});}})[_0xe9bd('0x25')](respondWithFilteredResult(_0x59b8be,_0x3eeaa5))['catch'](handleError(_0x59b8be,null));};exports[_0xe9bd('0x5d')]=function(_0x17f733,_0x2d86b6,_0x2083c4){var _0x242110={'raw':!![],'where':{}};var _0x332228={};var _0x28331d={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x17f733[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x2d86b6,null))[_0xe9bd('0x25')](function(_0x1b863f){if(_0x1b863f){_0x332228[_0xe9bd('0x33')]=_[_0xe9bd('0x35')](db[_0xe9bd('0x5e')]['rawAttributes']);_0x332228[_0xe9bd('0x34')]=_[_0xe9bd('0x35')](_0x17f733[_0xe9bd('0x34')]);_0x332228[_0xe9bd('0x36')]=_[_0xe9bd('0x48')](_0x332228[_0xe9bd('0x33')],_0x332228[_0xe9bd('0x34')]);_0x242110['attributes']=_['intersection'](_0x332228['model'],qs[_0xe9bd('0x38')](_0x17f733['query']['fields']));_0x242110['attributes']=_0x242110[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x242110[_0xe9bd('0x37')]:_0x332228[_0xe9bd('0x33')];if(!_0x17f733[_0xe9bd('0x34')][_0xe9bd('0x3a')](_0xe9bd('0x3b'))){_0x242110[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x17f733['query'][_0xe9bd('0x1e')]);_0x242110['offset']=qs[_0xe9bd('0x1d')](_0x17f733[_0xe9bd('0x34')][_0xe9bd('0x1d')]);}_0x242110[_0xe9bd('0x3c')]=qs[_0xe9bd('0x3d')](_0x17f733['query']['sort']);_0x242110['where']=qs[_0xe9bd('0x36')](_[_0xe9bd('0x5b')](_0x17f733['query'],_0x332228[_0xe9bd('0x36')]));_0x242110[_0xe9bd('0x3e')][_0xe9bd('0x5f')]=_0x1b863f['id'];if(_0x17f733[_0xe9bd('0x34')][_0xe9bd('0x3f')]){_0x242110['where']=_[_0xe9bd('0x40')](_0x242110[_0xe9bd('0x3e')],{'$or':_[_0xe9bd('0x2e')](_0x242110[_0xe9bd('0x37')],function(_0x399429){var _0x1f9829={};_0x1f9829[_0x399429]={'$like':'%'+_0x17f733[_0xe9bd('0x34')][_0xe9bd('0x3f')]+'%'};return _0x1f9829;})});}_0x242110=_[_0xe9bd('0x40')]({},_0x242110,_0x17f733[_0xe9bd('0x42')]);return db['CmHopperHistory']['count']({'where':_0x242110['where']})['then'](function(_0x4039c7){_0x28331d[_0xe9bd('0x1c')]=_0x4039c7;if(_0x17f733[_0xe9bd('0x34')]['includeAll']){_0x242110[_0xe9bd('0x43')]=[{'all':!![]}];}return db[_0xe9bd('0x5e')]['findAll'](_0x242110);})['then'](function(_0xb607c0){_0x28331d[_0xe9bd('0x5c')]=_0xb607c0;return _0x28331d;});}})[_0xe9bd('0x25')](respondWithFilteredResult(_0x2d86b6,_0x242110))[_0xe9bd('0x45')](handleError(_0x2d86b6,null));};exports[_0xe9bd('0x60')]=function(_0x59364c,_0x5bd400,_0x499771){var _0x223f56={'raw':!![],'where':{}};var _0x2c7a14={};var _0x448f82={'count':0x0,'rows':[]};return db[_0xe9bd('0x2f')][_0xe9bd('0x61')]({'where':{'id':_0x59364c[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x5bd400,null))[_0xe9bd('0x25')](function(_0x2fae04){if(_0x2fae04){_0x2c7a14[_0xe9bd('0x33')]=_['keys'](db[_0xe9bd('0x62')]['rawAttributes']);_0x2c7a14[_0xe9bd('0x34')]=_['keys'](_0x59364c['query']);_0x2c7a14[_0xe9bd('0x36')]=_['intersection'](_0x2c7a14[_0xe9bd('0x33')],_0x2c7a14['query']);_0x223f56[_0xe9bd('0x37')]=_[_0xe9bd('0x48')](_0x2c7a14[_0xe9bd('0x33')],qs[_0xe9bd('0x38')](_0x59364c[_0xe9bd('0x34')][_0xe9bd('0x38')]));_0x223f56['attributes']=_0x223f56[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x223f56['attributes']:_0x2c7a14[_0xe9bd('0x33')];if(!_0x59364c[_0xe9bd('0x34')][_0xe9bd('0x3a')]('nolimit')){_0x223f56[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x59364c[_0xe9bd('0x34')][_0xe9bd('0x1e')]);_0x223f56[_0xe9bd('0x1d')]=qs['offset'](_0x59364c[_0xe9bd('0x34')][_0xe9bd('0x1d')]);}_0x223f56['order']=qs[_0xe9bd('0x3d')](_0x59364c[_0xe9bd('0x34')][_0xe9bd('0x3d')]);_0x223f56[_0xe9bd('0x3e')]=qs['filters'](_[_0xe9bd('0x5b')](_0x59364c[_0xe9bd('0x34')],_0x2c7a14[_0xe9bd('0x36')]));_0x223f56[_0xe9bd('0x3e')][_0xe9bd('0x5f')]=_0x2fae04['id'];if(_0x59364c[_0xe9bd('0x34')][_0xe9bd('0x3f')]){_0x223f56['where']=_[_0xe9bd('0x40')](_0x223f56['where'],{'$or':_[_0xe9bd('0x2e')](_0x223f56[_0xe9bd('0x37')],function(_0x11ac8d){var _0x5e08e0={};_0x5e08e0[_0x11ac8d]={'$like':'%'+_0x59364c[_0xe9bd('0x34')]['filter']+'%'};return _0x5e08e0;})});}_0x223f56=_[_0xe9bd('0x40')]({},_0x223f56,_0x59364c[_0xe9bd('0x42')]);return db[_0xe9bd('0x62')][_0xe9bd('0x1c')]({'where':_0x223f56[_0xe9bd('0x3e')]})[_0xe9bd('0x25')](function(_0x4f6a50){_0x448f82[_0xe9bd('0x1c')]=_0x4f6a50;if(_0x59364c[_0xe9bd('0x34')][_0xe9bd('0x49')]){_0x223f56[_0xe9bd('0x43')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xe9bd('0x44')](_0x223f56);})[_0xe9bd('0x25')](function(_0x261af6){_0x448f82['rows']=_0x261af6;return _0x448f82;});}})[_0xe9bd('0x25')](respondWithFilteredResult(_0x5bd400,_0x223f56))[_0xe9bd('0x45')](handleError(_0x5bd400,null));};exports['getHopperBlacks']=function(_0x59bfc1,_0x571fc1,_0x52df8f){var _0x458bff={'raw':!![],'where':{}};var _0x3b32a9={};var _0x1c0c0a={'count':0x0,'rows':[]};return db['Campaign'][_0xe9bd('0x61')]({'where':{'id':_0x59bfc1[_0xe9bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x571fc1,null))[_0xe9bd('0x25')](function(_0x35894c){if(_0x35894c){_0x3b32a9[_0xe9bd('0x33')]=_[_0xe9bd('0x35')](db[_0xe9bd('0x63')]['rawAttributes']);_0x3b32a9[_0xe9bd('0x34')]=_[_0xe9bd('0x35')](_0x59bfc1['query']);_0x3b32a9['filters']=_['intersection'](_0x3b32a9['model'],_0x3b32a9[_0xe9bd('0x34')]);_0x458bff[_0xe9bd('0x37')]=_[_0xe9bd('0x48')](_0x3b32a9[_0xe9bd('0x33')],qs['fields'](_0x59bfc1['query'][_0xe9bd('0x38')]));_0x458bff[_0xe9bd('0x37')]=_0x458bff[_0xe9bd('0x37')]['length']?_0x458bff[_0xe9bd('0x37')]:_0x3b32a9[_0xe9bd('0x33')];if(!_0x59bfc1['query']['hasOwnProperty'](_0xe9bd('0x3b'))){_0x458bff[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x59bfc1[_0xe9bd('0x34')][_0xe9bd('0x1e')]);_0x458bff[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x59bfc1[_0xe9bd('0x34')][_0xe9bd('0x1d')]);}_0x458bff['order']=qs[_0xe9bd('0x3d')](_0x59bfc1[_0xe9bd('0x34')][_0xe9bd('0x3d')]);_0x458bff[_0xe9bd('0x3e')]=qs[_0xe9bd('0x36')](_[_0xe9bd('0x5b')](_0x59bfc1['query'],_0x3b32a9[_0xe9bd('0x36')]));_0x458bff['where'][_0xe9bd('0x5f')]=_0x35894c['id'];if(_0x59bfc1['query'][_0xe9bd('0x3f')]){_0x458bff[_0xe9bd('0x3e')]=_['merge'](_0x458bff[_0xe9bd('0x3e')],{'$or':_[_0xe9bd('0x2e')](_0x458bff['attributes'],function(_0x95e011){var _0x9bd62a={};_0x9bd62a[_0x95e011]={'$like':'%'+_0x59bfc1[_0xe9bd('0x34')][_0xe9bd('0x3f')]+'%'};return _0x9bd62a;})});}_0x458bff=_['merge']({},_0x458bff,_0x59bfc1[_0xe9bd('0x42')]);return db[_0xe9bd('0x63')]['count']({'where':_0x458bff[_0xe9bd('0x3e')]})[_0xe9bd('0x25')](function(_0x2d5601){_0x1c0c0a['count']=_0x2d5601;if(_0x59bfc1[_0xe9bd('0x34')][_0xe9bd('0x49')]){_0x458bff[_0xe9bd('0x43')]=[{'all':!![]}];}return db[_0xe9bd('0x63')][_0xe9bd('0x44')](_0x458bff);})[_0xe9bd('0x25')](function(_0x136aa0){_0x1c0c0a['rows']=_0x136aa0;return _0x1c0c0a;});}})[_0xe9bd('0x25')](respondWithFilteredResult(_0x571fc1,_0x458bff))[_0xe9bd('0x45')](handleError(_0x571fc1,null));};exports[_0xe9bd('0x64')]=function(_0x5a0758,_0x67bd92,_0x57c26d){var _0x5ba105={};var _0x4e1eb8={};var _0x1939ed;var _0x48af68;return db['Campaign'][_0xe9bd('0x61')]({'where':{'id':_0x5a0758[_0xe9bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x67bd92,null))[_0xe9bd('0x25')](function(_0x48f4cd){if(_0x48f4cd){_0x1939ed=_0x48f4cd;_0x4e1eb8['model']=_['keys'](db[_0xe9bd('0x65')]['rawAttributes']);_0x4e1eb8['query']=_[_0xe9bd('0x35')](_0x5a0758[_0xe9bd('0x34')]);_0x4e1eb8[_0xe9bd('0x36')]=_[_0xe9bd('0x48')](_0x4e1eb8[_0xe9bd('0x33')],_0x4e1eb8[_0xe9bd('0x34')]);_0x5ba105[_0xe9bd('0x37')]=_['intersection'](_0x4e1eb8[_0xe9bd('0x33')],qs['fields'](_0x5a0758['query'][_0xe9bd('0x38')]));_0x5ba105[_0xe9bd('0x37')]=_0x5ba105[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x5ba105[_0xe9bd('0x37')]:_0x4e1eb8['model'];_0x5ba105[_0xe9bd('0x3c')]=qs[_0xe9bd('0x3d')](_0x5a0758[_0xe9bd('0x34')][_0xe9bd('0x3d')]);_0x5ba105[_0xe9bd('0x3e')]=qs[_0xe9bd('0x36')](_['pick'](_0x5a0758[_0xe9bd('0x34')],_0x4e1eb8[_0xe9bd('0x36')]));if(_0x5a0758[_0xe9bd('0x34')][_0xe9bd('0x3f')]){_0x5ba105[_0xe9bd('0x3e')]=_[_0xe9bd('0x40')](_0x5ba105['where'],{'$or':_[_0xe9bd('0x2e')](_0x5ba105[_0xe9bd('0x37')],function(_0x4d88c8){var _0x1e5c54={};_0x1e5c54[_0x4d88c8]={'$like':'%'+_0x5a0758[_0xe9bd('0x34')][_0xe9bd('0x3f')]+'%'};return _0x1e5c54;})});}_0x5ba105=_[_0xe9bd('0x40')]({},_0x5ba105,_0x5a0758['options']);return _0x1939ed[_0xe9bd('0x64')](_0x5ba105);}})[_0xe9bd('0x25')](function(_0x4249f5){if(_0x4249f5){_0x48af68=_0x4249f5[_0xe9bd('0x39')];if(!_0x5a0758[_0xe9bd('0x34')][_0xe9bd('0x3a')](_0xe9bd('0x3b'))){_0x5ba105[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x5a0758['query'][_0xe9bd('0x1e')]);_0x5ba105[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x5a0758[_0xe9bd('0x34')][_0xe9bd('0x1d')]);}return _0x1939ed[_0xe9bd('0x64')](_0x5ba105);}})[_0xe9bd('0x25')](function(_0x4a8358){if(_0x4a8358){return _0x4a8358?{'count':_0x48af68,'rows':_0x4a8358}:null;}})[_0xe9bd('0x25')](respondWithResult(_0x67bd92,null))['catch'](handleError(_0x67bd92,null));};exports[_0xe9bd('0x66')]=function(_0xbc686e,_0x2db271,_0x1c2d6d){var _0x3f0e49,_0x2b8645;return db['Campaign'][_0xe9bd('0x4a')]({'where':{'id':_0xbc686e[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x2db271,null))['then'](function(_0x457536){if(_0x457536){_0x2b8645=_0x457536;return _0x457536[_0xe9bd('0x66')](_0xbc686e[_0xe9bd('0x57')][_0xe9bd('0x67')],_[_0xe9bd('0x54')](_0xbc686e[_0xe9bd('0x57')],[_0xe9bd('0x67'),'id'])||{});}return null;})[_0xe9bd('0x68')](function(_0x20a8ce){var _0x3b0874;_0x3f0e49=_0x20a8ce||[];var _0x5c0b2d=[];if(_0x20a8ce){for(var _0x464f7a=0x0;_0x464f7a<_0x20a8ce[_0xe9bd('0x39')];_0x464f7a+=0x1){var _0x31aae8=_0x20a8ce[_0x464f7a]['get']({'plain':!![]});_0x2b8645[_0xe9bd('0x69')]=_0xbc686e[_0xe9bd('0x57')][_0xe9bd('0x69')]?_0xbc686e['body']['dialCheckDuplicateType']:_0x2b8645[_0xe9bd('0x69')];switch(_0x2b8645[_0xe9bd('0x69')]){case _0xe9bd('0x6a'):_0x3b0874=squel[_0xe9bd('0x6b')]()[_0xe9bd('0x6c')](_0xe9bd('0x6d'))[_0xe9bd('0x6e')](['phone',_0xe9bd('0x6f'),_0xe9bd('0x70'),'ListId',_0xe9bd('0x5f'),_0xe9bd('0x55'),_0xe9bd('0x56')],squel[_0xe9bd('0x71')]()[_0xe9bd('0x72')](_0xe9bd('0x73'),_0xe9bd('0x73'))[_0xe9bd('0x72')](_0xe9bd('0x74'),_0xe9bd('0x6f'))[_0xe9bd('0x72')]('id',_0xe9bd('0x70'))[_0xe9bd('0x72')](_0x31aae8[_0xe9bd('0x75')][_0xe9bd('0x76')](),'ListId')[_0xe9bd('0x72')](_0xbc686e[_0xe9bd('0x47')]['id'][_0xe9bd('0x76')](),_0xe9bd('0x5f'))[_0xe9bd('0x72')]('NOW()',_0xe9bd('0x55'))[_0xe9bd('0x72')](_0xe9bd('0x74'),_0xe9bd('0x56'))[_0xe9bd('0x77')](_0xe9bd('0x78'))[_0xe9bd('0x3e')](_0xe9bd('0x79'))[_0xe9bd('0x3e')](_0xe9bd('0x7a'),_0x31aae8[_0xe9bd('0x75')][_0xe9bd('0x76')]())[_0xe9bd('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0xe9bd('0x3e')](_0xe9bd('0x7b'),squel[_0xe9bd('0x71')]()[_0xe9bd('0x72')](_0xe9bd('0x7c'))[_0xe9bd('0x77')](_0xe9bd('0x7d'))[_0xe9bd('0x3e')](_0xe9bd('0x7e'),_0xbc686e[_0xe9bd('0x47')]['id'][_0xe9bd('0x76')]()))[_0xe9bd('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe9bd('0x71')]()[_0xe9bd('0x72')](_0xe9bd('0x7f'))[_0xe9bd('0x77')](_0xe9bd('0x6d'))['where'](_0xe9bd('0x7e'),_0xbc686e[_0xe9bd('0x47')]['id'][_0xe9bd('0x76')]())))['toString']();break;case _0xe9bd('0x80'):_0x3b0874=squel[_0xe9bd('0x6b')]()['into']('cm_hopper')['fromQuery']([_0xe9bd('0x73'),_0xe9bd('0x6f'),'ContactId',_0xe9bd('0x81'),_0xe9bd('0x5f'),_0xe9bd('0x55'),'updatedAt'],squel[_0xe9bd('0x71')]()[_0xe9bd('0x72')](_0xe9bd('0x73'),_0xe9bd('0x73'))['field'](_0xe9bd('0x74'),_0xe9bd('0x6f'))['field']('id',_0xe9bd('0x70'))[_0xe9bd('0x72')](_0x31aae8[_0xe9bd('0x75')][_0xe9bd('0x76')](),'ListId')['field'](_0xbc686e['params']['id'][_0xe9bd('0x76')](),'CampaignId')[_0xe9bd('0x72')](_0xe9bd('0x74'),_0xe9bd('0x55'))[_0xe9bd('0x72')](_0xe9bd('0x74'),_0xe9bd('0x56'))['from'](_0xe9bd('0x78'))[_0xe9bd('0x3e')](_0xe9bd('0x79'))[_0xe9bd('0x3e')](_0xe9bd('0x7a'),_0x31aae8[_0xe9bd('0x75')][_0xe9bd('0x76')]())['where'](_0xe9bd('0x82'))[_0xe9bd('0x3e')](_0xe9bd('0x7b'),squel[_0xe9bd('0x71')]()['field'](_0xe9bd('0x7f'))[_0xe9bd('0x77')](_0xe9bd('0x6d'))[_0xe9bd('0x3e')](_0xe9bd('0x7e'),_0xbc686e[_0xe9bd('0x47')]['id'][_0xe9bd('0x76')]())))[_0xe9bd('0x76')]();break;default:_0x3b0874=squel[_0xe9bd('0x6b')]()[_0xe9bd('0x6c')](_0xe9bd('0x6d'))[_0xe9bd('0x6e')]([_0xe9bd('0x73'),'scheduledAt',_0xe9bd('0x70'),_0xe9bd('0x81'),'CampaignId',_0xe9bd('0x55'),_0xe9bd('0x56')],squel[_0xe9bd('0x71')]()['field'](_0xe9bd('0x73'),_0xe9bd('0x73'))[_0xe9bd('0x72')](_0xe9bd('0x74'),'scheduledAt')[_0xe9bd('0x72')]('id',_0xe9bd('0x70'))[_0xe9bd('0x72')](_0x31aae8[_0xe9bd('0x75')][_0xe9bd('0x76')](),_0xe9bd('0x81'))['field'](_0xbc686e[_0xe9bd('0x47')]['id']['toString'](),'CampaignId')[_0xe9bd('0x72')]('NOW()',_0xe9bd('0x55'))['field'](_0xe9bd('0x74'),_0xe9bd('0x56'))['from'](_0xe9bd('0x78'))[_0xe9bd('0x3e')](_0xe9bd('0x79'))[_0xe9bd('0x3e')](_0xe9bd('0x7a'),_0x31aae8[_0xe9bd('0x75')][_0xe9bd('0x76')]())['where'](_0xe9bd('0x82')))[_0xe9bd('0x76')]();}_0x5c0b2d[_0xe9bd('0x83')](db[_0xe9bd('0x84')][_0xe9bd('0x34')](_0x3b0874));}return BPromise[_0xe9bd('0x85')](_0x5c0b2d);}})['then'](function(){return _0x3f0e49;})[_0xe9bd('0x25')](respondWithResult(_0x2db271,null))[_0xe9bd('0x45')](handleError(_0x2db271,null));};exports[_0xe9bd('0x86')]=function(_0x377e3f,_0x4747de,_0x5692ab){return db['Campaign']['find']({'where':{'id':_0x377e3f[_0xe9bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x4747de,null))[_0xe9bd('0x25')](function(_0x1c340c){if(_0x1c340c){return _0x1c340c['removeLists'](_0x377e3f[_0xe9bd('0x34')][_0xe9bd('0x67')]);}})[_0xe9bd('0x25')](function(_0x3d9732){if(_0x3d9732){return db[_0xe9bd('0x5a')][_0xe9bd('0x26')]({'where':{'ListId':_0x377e3f[_0xe9bd('0x34')]['ids'],'CampaignId':_0x377e3f['params']['id']}})[_0xe9bd('0x25')](function(){return _0x3d9732;});}})['then'](respondWithStatusCode(_0x4747de,null))['catch'](handleError(_0x4747de,null));};exports[_0xe9bd('0x87')]=function(_0x7de714,_0x63af04,_0x391b6b){var _0x2d2872={'raw':!![],'where':{}};var _0x43fe2f={};var _0x3a9bc4={'count':0x0,'rows':[]};return db[_0xe9bd('0x2f')][_0xe9bd('0x61')]({'where':{'id':_0x7de714[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x63af04,null))['then'](function(_0x287012){if(_0x287012){_0x43fe2f['model']=_[_0xe9bd('0x35')](db[_0xe9bd('0x65')][_0xe9bd('0x30')]);_0x43fe2f[_0xe9bd('0x34')]=_['keys'](_0x7de714[_0xe9bd('0x34')]);_0x43fe2f[_0xe9bd('0x36')]=_[_0xe9bd('0x48')](_0x43fe2f['model'],_0x43fe2f['query']);_0x2d2872[_0xe9bd('0x37')]=_[_0xe9bd('0x48')](_0x43fe2f[_0xe9bd('0x33')],qs[_0xe9bd('0x38')](_0x7de714[_0xe9bd('0x34')][_0xe9bd('0x38')]));_0x2d2872['attributes']=_0x2d2872[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x2d2872[_0xe9bd('0x37')]:_0x43fe2f[_0xe9bd('0x33')];if(!_0x7de714['query'][_0xe9bd('0x3a')](_0xe9bd('0x3b'))){_0x2d2872[_0xe9bd('0x1e')]=qs['limit'](_0x7de714[_0xe9bd('0x34')][_0xe9bd('0x1e')]);_0x2d2872[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x7de714[_0xe9bd('0x34')][_0xe9bd('0x1d')]);}_0x2d2872[_0xe9bd('0x3c')]=qs['sort'](_0x7de714['query'][_0xe9bd('0x3d')]);_0x2d2872[_0xe9bd('0x3e')]=qs[_0xe9bd('0x36')](_['pick'](_0x7de714['query'],_0x43fe2f[_0xe9bd('0x36')]));_0x2d2872[_0xe9bd('0x3e')][_0xe9bd('0x5f')]=_0x287012['id'];if(_0x7de714['query'][_0xe9bd('0x3f')]){_0x2d2872['where']=_[_0xe9bd('0x40')](_0x2d2872[_0xe9bd('0x3e')],{'$or':_[_0xe9bd('0x2e')](_0x2d2872[_0xe9bd('0x37')],function(_0x1c1593){var _0x7673f3={};_0x7673f3[_0x1c1593]={'$like':'%'+_0x7de714[_0xe9bd('0x34')][_0xe9bd('0x3f')]+'%'};return _0x7673f3;})});}_0x2d2872=_[_0xe9bd('0x40')]({},_0x2d2872,_0x7de714['options']);return db['CmList'][_0xe9bd('0x1c')]({'where':_0x2d2872[_0xe9bd('0x3e')]})[_0xe9bd('0x25')](function(_0x2c0457){_0x3a9bc4[_0xe9bd('0x1c')]=_0x2c0457;if(_0x7de714[_0xe9bd('0x34')][_0xe9bd('0x49')]){_0x2d2872[_0xe9bd('0x43')]=[{'all':!![]}];}return db['CmList'][_0xe9bd('0x44')](_0x2d2872);})[_0xe9bd('0x25')](function(_0x55a0ec){_0x3a9bc4[_0xe9bd('0x5c')]=_0x55a0ec;return _0x3a9bc4;});}})['then'](respondWithFilteredResult(_0x63af04,_0x2d2872))[_0xe9bd('0x45')](handleError(_0x63af04,null));};exports[_0xe9bd('0x88')]=function(_0x401924,_0x5a7a61,_0x4c7419){var _0x1f0452,_0x488000;return db[_0xe9bd('0x2f')][_0xe9bd('0x4a')]({'where':{'id':_0x401924[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x5a7a61,null))[_0xe9bd('0x25')](function(_0x4eb22e){if(_0x4eb22e){_0x488000=_0x4eb22e;return _0x4eb22e[_0xe9bd('0x88')](_0x401924[_0xe9bd('0x57')][_0xe9bd('0x67')],_[_0xe9bd('0x54')](_0x401924[_0xe9bd('0x57')],[_0xe9bd('0x67'),'id'])||{});}return null;})['spread'](function(_0x39e8e5){var _0x5a2edb;_0x1f0452=_0x39e8e5||[];var _0x25d15b=[];if(_0x39e8e5){for(var _0x560ed7=0x0;_0x560ed7<_0x39e8e5[_0xe9bd('0x39')];_0x560ed7+=0x1){var _0x1ec28e=_0x39e8e5[_0x560ed7]['get']({'plain':!![]});_0x5a2edb=squel[_0xe9bd('0x6b')]()[_0xe9bd('0x6c')]('cm_hopper_black')[_0xe9bd('0x6e')](['phone','ContactId','ListId',_0xe9bd('0x5f'),_0xe9bd('0x55'),'updatedAt'],squel['select']()[_0xe9bd('0x72')]('phone',_0xe9bd('0x73'))[_0xe9bd('0x72')]('id','ContactId')[_0xe9bd('0x72')](_0x1ec28e[_0xe9bd('0x75')][_0xe9bd('0x76')](),_0xe9bd('0x81'))[_0xe9bd('0x72')](_0x401924[_0xe9bd('0x47')]['id'][_0xe9bd('0x76')](),_0xe9bd('0x5f'))[_0xe9bd('0x72')](_0xe9bd('0x74'),_0xe9bd('0x55'))[_0xe9bd('0x72')](_0xe9bd('0x74'),'updatedAt')[_0xe9bd('0x77')](_0xe9bd('0x78'))[_0xe9bd('0x3e')](_0xe9bd('0x79'))[_0xe9bd('0x3e')]('ListId\x20=\x20?',_0x1ec28e[_0xe9bd('0x75')][_0xe9bd('0x76')]())[_0xe9bd('0x3e')](_0xe9bd('0x82')))[_0xe9bd('0x76')]();_0x25d15b[_0xe9bd('0x83')](db[_0xe9bd('0x84')]['query'](_0x5a2edb));}return BPromise[_0xe9bd('0x85')](_0x25d15b);}})[_0xe9bd('0x25')](function(){return _0x1f0452;})['then'](respondWithResult(_0x5a7a61,null))[_0xe9bd('0x45')](handleError(_0x5a7a61,null));};exports[_0xe9bd('0x89')]=function(_0x3ea71a,_0x271ab8,_0x24aef6){return db[_0xe9bd('0x2f')][_0xe9bd('0x4a')]({'where':{'id':_0x3ea71a[_0xe9bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x271ab8,null))[_0xe9bd('0x25')](function(_0x1b52e2){if(_0x1b52e2){return _0x1b52e2[_0xe9bd('0x89')](_0x3ea71a['query'][_0xe9bd('0x67')]);}})[_0xe9bd('0x25')](function(_0x5ceed4){if(_0x5ceed4){return db['CmHopperBlack'][_0xe9bd('0x26')]({'where':{'ListId':_0x3ea71a['query'][_0xe9bd('0x67')],'CampaignId':_0x3ea71a[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](function(){return _0x5ceed4;});}})[_0xe9bd('0x25')](respondWithStatusCode(_0x271ab8,null))[_0xe9bd('0x45')](handleError(_0x271ab8,null));}; \ No newline at end of file +var _0xb903=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','end','status','offset','set','Content-Range','json','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','send','map','Campaign','rawAttributes','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','clone','find','omit','createdAt','updatedAt','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList','getLists','addLists','ids','dialCheckDuplicateType','always','insert','cm_hopper','phone','scheduledAt','select','field','NOW()','ContactId','CmListId','toString','ListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','fromQuery','ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x5e6e2a,_0x54984e){var _0x9ca794=function(_0x305a69){while(--_0x305a69){_0x5e6e2a['push'](_0x5e6e2a['shift']());}};_0x9ca794(++_0x54984e);}(_0xb903,0x185));var _0x3b90=function(_0x25723b,_0x4b2be7){_0x25723b=_0x25723b-0x0;var _0x125f8a=_0xb903[_0x25723b];return _0x125f8a;};'use strict';var pdf=require(_0x3b90('0x0'));var emlformat=require(_0x3b90('0x1'));var rimraf=require(_0x3b90('0x2'));var zipdir=require(_0x3b90('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b90('0x4'));var moment=require(_0x3b90('0x5'));var BPromise=require(_0x3b90('0x6'));var Mustache=require(_0x3b90('0x7'));var util=require(_0x3b90('0x8'));var path=require(_0x3b90('0x9'));var sox=require(_0x3b90('0xa'));var csv=require('to-csv');var ejs=require(_0x3b90('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3b90('0xc'));var jsforce=require(_0x3b90('0xd'));var deskjs=require(_0x3b90('0xe'));var toCsv=require(_0x3b90('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b90('0x10'));var logger=require(_0x3b90('0x11'))('api');var utils=require(_0x3b90('0x12'));var config=require(_0x3b90('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45b75f,_0x174c0d){_0x174c0d=_0x174c0d||0xcc;return function(_0x43c08c){if(_0x43c08c){return _0x45b75f['sendStatus'](_0x174c0d);}return _0x45b75f['status'](_0x174c0d)[_0x3b90('0x14')]();};}function respondWithResult(_0x542cb3,_0x492d39){_0x492d39=_0x492d39||0xc8;return function(_0x3a0a55){if(_0x3a0a55){return _0x542cb3[_0x3b90('0x15')](_0x492d39)['json'](_0x3a0a55);}};}function respondWithFilteredResult(_0x51fb66,_0x3725b9){return function(_0x1b6349){if(_0x1b6349){var _0x381a9e=_0x1b6349['count'],_0x1af265=_0x3725b9[_0x3b90('0x16')],_0x1efe01=_0x3725b9[_0x3b90('0x16')]+_0x3725b9['limit'],_0x529421;if(_0x1efe01>=_0x381a9e){_0x1efe01=_0x381a9e;_0x529421=0xc8;}else{_0x529421=0xce;}_0x51fb66[_0x3b90('0x15')](_0x529421);return _0x51fb66[_0x3b90('0x17')](_0x3b90('0x18'),_0x1af265+'-'+_0x1efe01+'/'+_0x381a9e)[_0x3b90('0x19')](_0x1b6349);}return null;};}function patchUpdates(_0x4f388b){return function(_0x3014d8){try{jsonpatch['apply'](_0x3014d8,_0x4f388b,!![]);}catch(_0xd8d873){return BPromise[_0x3b90('0x1a')](_0xd8d873);}return _0x3014d8['save']();};}function saveUpdates(_0x39ae7c,_0x12e1cf){return function(_0x3642c0){if(_0x3642c0){return _0x3642c0[_0x3b90('0x1b')](_0x39ae7c)[_0x3b90('0x1c')](function(_0x43deca){return _0x43deca;});}return null;};}function removeEntity(_0x3bc7d5,_0x2f4270){return function(_0xa98414){if(_0xa98414){return _0xa98414[_0x3b90('0x1d')]()['then'](function(){var _0x20b06a=_0xa98414[_0x3b90('0x1e')]({'plain':!![]});var _0x175b42=_0x3b90('0x1f');return db[_0x3b90('0x20')][_0x3b90('0x1d')]({'where':{'type':_0x175b42,'resourceId':_0x20b06a['id']}})['then'](function(){return _0xa98414;});})['then'](function(){_0x3bc7d5[_0x3b90('0x15')](0xcc)[_0x3b90('0x14')]();});}};}function handleEntityNotFound(_0x103324,_0x2ffa1a){return function(_0x583523){if(!_0x583523){_0x103324[_0x3b90('0x21')](0x194);}return _0x583523;};}function handleError(_0x2936d7,_0x1787d1){_0x1787d1=_0x1787d1||0x1f4;return function(_0x4caead){logger[_0x3b90('0x22')](_0x4caead[_0x3b90('0x23')]);if(_0x4caead[_0x3b90('0x24')]){delete _0x4caead[_0x3b90('0x24')];}_0x2936d7[_0x3b90('0x15')](_0x1787d1)[_0x3b90('0x25')](_0x4caead);};}exports['index']=function(_0x1a839d,_0x595ac1){var _0xaf453c={},_0x9891e4={},_0x1a193e={'count':0x0,'rows':[]};var _0x38eed0=_[_0x3b90('0x26')](db[_0x3b90('0x27')][_0x3b90('0x28')],function(_0x2430ec){return{'name':_0x2430ec['fieldName'],'type':_0x2430ec['type'][_0x3b90('0x29')]};});_0x9891e4[_0x3b90('0x2a')]=_[_0x3b90('0x26')](_0x38eed0,_0x3b90('0x24'));_0x9891e4['query']=_['keys'](_0x1a839d[_0x3b90('0x2b')]);_0x9891e4[_0x3b90('0x2c')]=_[_0x3b90('0x2d')](_0x9891e4['model'],_0x9891e4[_0x3b90('0x2b')]);_0xaf453c['attributes']=_['intersection'](_0x9891e4[_0x3b90('0x2a')],qs[_0x3b90('0x2e')](_0x1a839d['query'][_0x3b90('0x2e')]));_0xaf453c[_0x3b90('0x2f')]=_0xaf453c[_0x3b90('0x2f')]['length']?_0xaf453c['attributes']:_0x9891e4[_0x3b90('0x2a')];if(!_0x1a839d[_0x3b90('0x2b')][_0x3b90('0x30')](_0x3b90('0x31'))){_0xaf453c['limit']=qs['limit'](_0x1a839d[_0x3b90('0x2b')][_0x3b90('0x32')]);_0xaf453c['offset']=qs['offset'](_0x1a839d[_0x3b90('0x2b')][_0x3b90('0x16')]);}_0xaf453c[_0x3b90('0x33')]=qs[_0x3b90('0x34')](_0x1a839d['query'][_0x3b90('0x34')]);_0xaf453c['where']=qs[_0x3b90('0x2c')](_[_0x3b90('0x35')](_0x1a839d[_0x3b90('0x2b')],_0x9891e4[_0x3b90('0x2c')]));if(_0x1a839d[_0x3b90('0x2b')][_0x3b90('0x36')]){_0xaf453c[_0x3b90('0x37')]=_['merge'](_0xaf453c[_0x3b90('0x37')],{'$or':_[_0x3b90('0x26')](_0x38eed0,function(_0x2fd30c){if(_0x2fd30c[_0x3b90('0x38')]!==_0x3b90('0x39')){var _0x390952={};_0x390952[_0x2fd30c[_0x3b90('0x24')]]={'$like':'%'+_0x1a839d[_0x3b90('0x2b')][_0x3b90('0x36')]+'%'};return _0x390952;}})});}_0xaf453c=_['merge']({},_0xaf453c,_0x1a839d[_0x3b90('0x3a')]);var _0x1b915d={'where':_0xaf453c[_0x3b90('0x37')]};return db[_0x3b90('0x27')][_0x3b90('0x3b')](_0x1b915d)[_0x3b90('0x1c')](function(_0x1a76cb){_0x1a193e[_0x3b90('0x3b')]=_0x1a76cb;if(_0x1a839d[_0x3b90('0x2b')][_0x3b90('0x3c')]){_0xaf453c[_0x3b90('0x3d')]=[{'all':!![]}];}return db[_0x3b90('0x27')][_0x3b90('0x3e')](_0xaf453c);})[_0x3b90('0x1c')](function(_0x3f3e6b){_0x1a193e[_0x3b90('0x3f')]=_0x3f3e6b;return _0x1a193e;})[_0x3b90('0x1c')](respondWithFilteredResult(_0x595ac1,_0xaf453c))[_0x3b90('0x40')](handleError(_0x595ac1,null));};exports[_0x3b90('0x41')]=function(_0x37e8dd,_0x11698a){var _0x4d1157={'raw':![],'where':{'id':_0x37e8dd[_0x3b90('0x42')]['id']}},_0x28d70b={};_0x28d70b[_0x3b90('0x2a')]=_[_0x3b90('0x43')](db['Campaign'][_0x3b90('0x28')]);_0x28d70b['query']=_['keys'](_0x37e8dd[_0x3b90('0x2b')]);_0x28d70b[_0x3b90('0x2c')]=_['intersection'](_0x28d70b[_0x3b90('0x2a')],_0x28d70b[_0x3b90('0x2b')]);_0x4d1157[_0x3b90('0x2f')]=_[_0x3b90('0x2d')](_0x28d70b[_0x3b90('0x2a')],qs[_0x3b90('0x2e')](_0x37e8dd[_0x3b90('0x2b')][_0x3b90('0x2e')]));_0x4d1157[_0x3b90('0x2f')]=_0x4d1157['attributes'][_0x3b90('0x44')]?_0x4d1157[_0x3b90('0x2f')]:_0x28d70b['model'];if(_0x37e8dd[_0x3b90('0x2b')][_0x3b90('0x3c')]){_0x4d1157[_0x3b90('0x3d')]=[{'all':!![]}];}_0x4d1157=_[_0x3b90('0x45')]({},_0x4d1157,_0x37e8dd[_0x3b90('0x3a')]);return db['Campaign']['find'](_0x4d1157)[_0x3b90('0x1c')](handleEntityNotFound(_0x11698a,null))['then'](respondWithResult(_0x11698a,null))[_0x3b90('0x40')](handleError(_0x11698a,null));};exports[_0x3b90('0x46')]=function(_0x330002,_0x27d0a8){return db[_0x3b90('0x27')]['create'](_0x330002['body'],{})[_0x3b90('0x1c')](function(_0x6bc94a){var _0x9e2ee5=_0x330002['user'][_0x3b90('0x1e')]({'plain':!![]});if(!_0x9e2ee5)throw new Error(_0x3b90('0x47'));if(_0x9e2ee5[_0x3b90('0x48')]===_0x3b90('0x49')){var _0x41e951=_0x6bc94a[_0x3b90('0x1e')]({'plain':!![]});var _0x44b01b=_0x3b90('0x1f');return db[_0x3b90('0x4a')]['find']({'where':{'name':_0x44b01b,'userProfileId':_0x9e2ee5[_0x3b90('0x4b')]},'raw':!![]})[_0x3b90('0x1c')](function(_0x2b5b6f){if(_0x2b5b6f&&_0x2b5b6f['autoAssociation']===0x0){return db[_0x3b90('0x20')]['create']({'name':_0x41e951[_0x3b90('0x24')],'resourceId':_0x41e951['id'],'type':_0x2b5b6f[_0x3b90('0x24')],'sectionId':_0x2b5b6f['id']},{})[_0x3b90('0x1c')](function(){return _0x6bc94a;});}else{return _0x6bc94a;}})['catch'](function(_0x2a3fe8){logger[_0x3b90('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a3fe8);throw _0x2a3fe8;});}return _0x6bc94a;})['then'](respondWithResult(_0x27d0a8,0xc9))[_0x3b90('0x40')](handleError(_0x27d0a8,null));};exports[_0x3b90('0x4c')]=function(_0x1eb16e,_0x3f46cf){var _0x50462d={'where':{'id':_0x1eb16e[_0x3b90('0x42')]['id']}},_0x5ee7e2={};_0x5ee7e2[_0x3b90('0x2a')]=_[_0x3b90('0x43')](db[_0x3b90('0x27')][_0x3b90('0x28')]);_0x50462d[_0x3b90('0x2f')]=_[_0x3b90('0x2d')](_0x5ee7e2[_0x3b90('0x2a')],qs[_0x3b90('0x2e')](_0x1eb16e['query'][_0x3b90('0x2e')]));_0x50462d[_0x3b90('0x2f')]=_0x50462d['attributes'][_0x3b90('0x44')]?_0x50462d[_0x3b90('0x2f')]:_0x5ee7e2['model'];if(_0x1eb16e[_0x3b90('0x2b')][_0x3b90('0x3c')]){_0x50462d[_0x3b90('0x3d')]=[{'all':!![]}];}_0x50462d=_[_0x3b90('0x45')]({},_0x50462d,_0x1eb16e[_0x3b90('0x3a')]);return db[_0x3b90('0x27')][_0x3b90('0x4d')](_0x50462d)['then'](handleEntityNotFound(_0x3f46cf,null))[_0x3b90('0x1c')](function(_0x3f5e1d){if(_0x3f5e1d){var _0x32a179=_0x3f5e1d[_0x3b90('0x1e')]({'plain':!![]});_0x32a179=qs[_0x3b90('0x4e')](_0x32a179,['id',_0x3b90('0x4f'),_0x3b90('0x50')]);_0x1eb16e[_0x3b90('0x51')]=_[_0x3b90('0x4e')](_0x1eb16e[_0x3b90('0x51')],['id',_0x3b90('0x4f'),_0x3b90('0x50')]);return db[_0x3b90('0x27')][_0x3b90('0x46')](_[_0x3b90('0x45')](_0x32a179,_0x1eb16e['body']),{'include':_0x1eb16e[_0x3b90('0x2b')]['includeAll']?[{'all':!![]}]:undefined})[_0x3b90('0x1c')](function(_0x290550){var _0x25bdb2=_0x1eb16e[_0x3b90('0x49')][_0x3b90('0x1e')]({'plain':!![]});if(!_0x25bdb2)throw new Error(_0x3b90('0x47'));if(_0x25bdb2['role']===_0x3b90('0x49')){var _0x3ecb23=_0x290550[_0x3b90('0x1e')]({'plain':!![]});var _0x8e1229=_0x3b90('0x1f');return db[_0x3b90('0x4a')]['find']({'where':{'name':_0x8e1229,'userProfileId':_0x25bdb2[_0x3b90('0x4b')]},'raw':!![]})[_0x3b90('0x1c')](function(_0xb41920){if(_0xb41920&&_0xb41920['autoAssociation']===0x0){return db[_0x3b90('0x20')][_0x3b90('0x46')]({'name':_0x3ecb23[_0x3b90('0x24')],'resourceId':_0x3ecb23['id'],'type':_0xb41920[_0x3b90('0x24')],'sectionId':_0xb41920['id']},{})[_0x3b90('0x1c')](function(){return _0x290550;});}else{return _0x290550;}})[_0x3b90('0x40')](function(_0xbd986c){logger[_0x3b90('0x22')](_0x3b90('0x52'),_0xbd986c);throw _0xbd986c;});}return _0x290550;});}})['then'](respondWithResult(_0x3f46cf,0xc9))[_0x3b90('0x40')](handleError(_0x3f46cf,null));};exports['update']=function(_0x53d2d3,_0x3c29e0){if(_0x53d2d3[_0x3b90('0x51')]['id']){delete _0x53d2d3['body']['id'];}return db[_0x3b90('0x27')][_0x3b90('0x4d')]({'where':{'id':_0x53d2d3[_0x3b90('0x42')]['id']}})[_0x3b90('0x1c')](handleEntityNotFound(_0x3c29e0,null))[_0x3b90('0x1c')](saveUpdates(_0x53d2d3[_0x3b90('0x51')],null))[_0x3b90('0x1c')](respondWithResult(_0x3c29e0,null))['catch'](handleError(_0x3c29e0,null));};exports['destroy']=function(_0x3e5532,_0x5e5efa){return db[_0x3b90('0x27')]['find']({'where':{'id':_0x3e5532[_0x3b90('0x42')]['id']}})['then'](handleEntityNotFound(_0x5e5efa,null))['then'](removeEntity(_0x5e5efa,null))['catch'](handleError(_0x5e5efa,null));};exports[_0x3b90('0x53')]=function(_0x470fe3,_0x33fca6,_0x2d8a4b){var _0x1a0c78={'raw':!![],'where':{}};var _0x11c469={};var _0x323d49={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x470fe3['params']['id']}})[_0x3b90('0x1c')](handleEntityNotFound(_0x33fca6,null))[_0x3b90('0x1c')](function(_0x57d3df){if(_0x57d3df){_0x11c469[_0x3b90('0x2a')]=_[_0x3b90('0x43')](db[_0x3b90('0x54')][_0x3b90('0x28')]);_0x11c469[_0x3b90('0x2b')]=_[_0x3b90('0x43')](_0x470fe3[_0x3b90('0x2b')]);_0x11c469[_0x3b90('0x2c')]=_[_0x3b90('0x2d')](_0x11c469['model'],_0x11c469[_0x3b90('0x2b')]);_0x1a0c78['attributes']=_[_0x3b90('0x2d')](_0x11c469[_0x3b90('0x2a')],qs['fields'](_0x470fe3['query'][_0x3b90('0x2e')]));_0x1a0c78[_0x3b90('0x2f')]=_0x1a0c78[_0x3b90('0x2f')][_0x3b90('0x44')]?_0x1a0c78[_0x3b90('0x2f')]:_0x11c469[_0x3b90('0x2a')];if(!_0x470fe3['query'][_0x3b90('0x30')](_0x3b90('0x31'))){_0x1a0c78[_0x3b90('0x32')]=qs['limit'](_0x470fe3[_0x3b90('0x2b')]['limit']);_0x1a0c78[_0x3b90('0x16')]=qs[_0x3b90('0x16')](_0x470fe3[_0x3b90('0x2b')][_0x3b90('0x16')]);}_0x1a0c78[_0x3b90('0x33')]=qs[_0x3b90('0x34')](_0x470fe3['query'][_0x3b90('0x34')]);_0x1a0c78[_0x3b90('0x37')]=qs[_0x3b90('0x2c')](_[_0x3b90('0x35')](_0x470fe3[_0x3b90('0x2b')],_0x11c469[_0x3b90('0x2c')]));_0x1a0c78[_0x3b90('0x37')][_0x3b90('0x55')]=_0x57d3df['id'];if(_0x470fe3['query'][_0x3b90('0x36')]){_0x1a0c78[_0x3b90('0x37')]=_[_0x3b90('0x45')](_0x1a0c78[_0x3b90('0x37')],{'$or':_[_0x3b90('0x26')](_0x1a0c78[_0x3b90('0x2f')],function(_0x1af213){var _0x3e3f81={};_0x3e3f81[_0x1af213]={'$like':'%'+_0x470fe3['query']['filter']+'%'};return _0x3e3f81;})});}_0x1a0c78=_[_0x3b90('0x45')]({},_0x1a0c78,_0x470fe3[_0x3b90('0x3a')]);return db[_0x3b90('0x54')]['count']({'where':_0x1a0c78[_0x3b90('0x37')]})['then'](function(_0x4b70cb){_0x323d49[_0x3b90('0x3b')]=_0x4b70cb;if(_0x470fe3[_0x3b90('0x2b')][_0x3b90('0x3c')]){_0x1a0c78[_0x3b90('0x3d')]=[{'all':!![]}];}return db[_0x3b90('0x54')][_0x3b90('0x3e')](_0x1a0c78);})[_0x3b90('0x1c')](function(_0x37f7bc){_0x323d49[_0x3b90('0x3f')]=_0x37f7bc;return _0x323d49;});}})[_0x3b90('0x1c')](respondWithFilteredResult(_0x33fca6,_0x1a0c78))[_0x3b90('0x40')](handleError(_0x33fca6,null));};exports[_0x3b90('0x56')]=function(_0x2e621a,_0x241d6e,_0x122525){var _0x4e8614={'raw':!![],'where':{}};var _0x212aa4={};var _0x98d7b0={'count':0x0,'rows':[]};return db['Campaign'][_0x3b90('0x57')]({'where':{'id':_0x2e621a['params']['id']}})[_0x3b90('0x1c')](handleEntityNotFound(_0x241d6e,null))[_0x3b90('0x1c')](function(_0x323738){if(_0x323738){_0x212aa4['model']=_[_0x3b90('0x43')](db[_0x3b90('0x58')][_0x3b90('0x28')]);_0x212aa4[_0x3b90('0x2b')]=_[_0x3b90('0x43')](_0x2e621a[_0x3b90('0x2b')]);_0x212aa4[_0x3b90('0x2c')]=_[_0x3b90('0x2d')](_0x212aa4[_0x3b90('0x2a')],_0x212aa4[_0x3b90('0x2b')]);_0x4e8614[_0x3b90('0x2f')]=_[_0x3b90('0x2d')](_0x212aa4['model'],qs['fields'](_0x2e621a['query'][_0x3b90('0x2e')]));_0x4e8614[_0x3b90('0x2f')]=_0x4e8614[_0x3b90('0x2f')][_0x3b90('0x44')]?_0x4e8614[_0x3b90('0x2f')]:_0x212aa4[_0x3b90('0x2a')];if(!_0x2e621a[_0x3b90('0x2b')][_0x3b90('0x30')](_0x3b90('0x31'))){_0x4e8614[_0x3b90('0x32')]=qs[_0x3b90('0x32')](_0x2e621a['query']['limit']);_0x4e8614[_0x3b90('0x16')]=qs[_0x3b90('0x16')](_0x2e621a[_0x3b90('0x2b')][_0x3b90('0x16')]);}_0x4e8614[_0x3b90('0x33')]=qs[_0x3b90('0x34')](_0x2e621a[_0x3b90('0x2b')][_0x3b90('0x34')]);_0x4e8614[_0x3b90('0x37')]=qs[_0x3b90('0x2c')](_[_0x3b90('0x35')](_0x2e621a[_0x3b90('0x2b')],_0x212aa4[_0x3b90('0x2c')]));_0x4e8614[_0x3b90('0x37')][_0x3b90('0x55')]=_0x323738['id'];if(_0x2e621a[_0x3b90('0x2b')][_0x3b90('0x36')]){_0x4e8614[_0x3b90('0x37')]=_['merge'](_0x4e8614[_0x3b90('0x37')],{'$or':_[_0x3b90('0x26')](_0x4e8614[_0x3b90('0x2f')],function(_0x34fdf0){var _0x22d7cb={};_0x22d7cb[_0x34fdf0]={'$like':'%'+_0x2e621a['query'][_0x3b90('0x36')]+'%'};return _0x22d7cb;})});}_0x4e8614=_[_0x3b90('0x45')]({},_0x4e8614,_0x2e621a[_0x3b90('0x3a')]);return db[_0x3b90('0x58')][_0x3b90('0x3b')]({'where':_0x4e8614[_0x3b90('0x37')]})['then'](function(_0x18273c){_0x98d7b0['count']=_0x18273c;if(_0x2e621a['query'][_0x3b90('0x3c')]){_0x4e8614[_0x3b90('0x3d')]=[{'all':!![]}];}return db[_0x3b90('0x58')][_0x3b90('0x3e')](_0x4e8614);})[_0x3b90('0x1c')](function(_0x5de15a){_0x98d7b0[_0x3b90('0x3f')]=_0x5de15a;return _0x98d7b0;});}})[_0x3b90('0x1c')](respondWithFilteredResult(_0x241d6e,_0x4e8614))[_0x3b90('0x40')](handleError(_0x241d6e,null));};exports[_0x3b90('0x59')]=function(_0x21f529,_0x1f6140,_0x19b070){var _0x1e9291={'raw':!![],'where':{}};var _0x2c2e24={};var _0x45be4c={'count':0x0,'rows':[]};return db[_0x3b90('0x27')][_0x3b90('0x57')]({'where':{'id':_0x21f529[_0x3b90('0x42')]['id']}})[_0x3b90('0x1c')](handleEntityNotFound(_0x1f6140,null))[_0x3b90('0x1c')](function(_0x1af0ea){if(_0x1af0ea){_0x2c2e24['model']=_[_0x3b90('0x43')](db[_0x3b90('0x5a')][_0x3b90('0x28')]);_0x2c2e24[_0x3b90('0x2b')]=_[_0x3b90('0x43')](_0x21f529[_0x3b90('0x2b')]);_0x2c2e24['filters']=_[_0x3b90('0x2d')](_0x2c2e24[_0x3b90('0x2a')],_0x2c2e24[_0x3b90('0x2b')]);_0x1e9291[_0x3b90('0x2f')]=_[_0x3b90('0x2d')](_0x2c2e24['model'],qs[_0x3b90('0x2e')](_0x21f529[_0x3b90('0x2b')][_0x3b90('0x2e')]));_0x1e9291[_0x3b90('0x2f')]=_0x1e9291['attributes']['length']?_0x1e9291[_0x3b90('0x2f')]:_0x2c2e24['model'];if(!_0x21f529[_0x3b90('0x2b')][_0x3b90('0x30')](_0x3b90('0x31'))){_0x1e9291[_0x3b90('0x32')]=qs[_0x3b90('0x32')](_0x21f529['query'][_0x3b90('0x32')]);_0x1e9291['offset']=qs[_0x3b90('0x16')](_0x21f529[_0x3b90('0x2b')][_0x3b90('0x16')]);}_0x1e9291['order']=qs[_0x3b90('0x34')](_0x21f529[_0x3b90('0x2b')][_0x3b90('0x34')]);_0x1e9291['where']=qs[_0x3b90('0x2c')](_[_0x3b90('0x35')](_0x21f529[_0x3b90('0x2b')],_0x2c2e24['filters']));_0x1e9291[_0x3b90('0x37')][_0x3b90('0x55')]=_0x1af0ea['id'];if(_0x21f529[_0x3b90('0x2b')][_0x3b90('0x36')]){_0x1e9291[_0x3b90('0x37')]=_[_0x3b90('0x45')](_0x1e9291['where'],{'$or':_['map'](_0x1e9291['attributes'],function(_0x2ad6bc){var _0x4ca435={};_0x4ca435[_0x2ad6bc]={'$like':'%'+_0x21f529[_0x3b90('0x2b')][_0x3b90('0x36')]+'%'};return _0x4ca435;})});}_0x1e9291=_[_0x3b90('0x45')]({},_0x1e9291,_0x21f529[_0x3b90('0x3a')]);return db[_0x3b90('0x5a')]['count']({'where':_0x1e9291[_0x3b90('0x37')]})['then'](function(_0x74241a){_0x45be4c[_0x3b90('0x3b')]=_0x74241a;if(_0x21f529[_0x3b90('0x2b')]['includeAll']){_0x1e9291[_0x3b90('0x3d')]=[{'all':!![]}];}return db[_0x3b90('0x5a')][_0x3b90('0x3e')](_0x1e9291);})[_0x3b90('0x1c')](function(_0x1be56f){_0x45be4c[_0x3b90('0x3f')]=_0x1be56f;return _0x45be4c;});}})[_0x3b90('0x1c')](respondWithFilteredResult(_0x1f6140,_0x1e9291))[_0x3b90('0x40')](handleError(_0x1f6140,null));};exports['getHopperBlacks']=function(_0x38852a,_0x52c38a,_0x152170){var _0x171ac6={'raw':!![],'where':{}};var _0x337da6={};var _0x20c907={'count':0x0,'rows':[]};return db[_0x3b90('0x27')][_0x3b90('0x57')]({'where':{'id':_0x38852a[_0x3b90('0x42')]['id']}})['then'](handleEntityNotFound(_0x52c38a,null))['then'](function(_0x435eb8){if(_0x435eb8){_0x337da6[_0x3b90('0x2a')]=_[_0x3b90('0x43')](db[_0x3b90('0x5b')]['rawAttributes']);_0x337da6['query']=_[_0x3b90('0x43')](_0x38852a[_0x3b90('0x2b')]);_0x337da6['filters']=_[_0x3b90('0x2d')](_0x337da6[_0x3b90('0x2a')],_0x337da6[_0x3b90('0x2b')]);_0x171ac6[_0x3b90('0x2f')]=_[_0x3b90('0x2d')](_0x337da6[_0x3b90('0x2a')],qs['fields'](_0x38852a[_0x3b90('0x2b')][_0x3b90('0x2e')]));_0x171ac6[_0x3b90('0x2f')]=_0x171ac6[_0x3b90('0x2f')][_0x3b90('0x44')]?_0x171ac6[_0x3b90('0x2f')]:_0x337da6[_0x3b90('0x2a')];if(!_0x38852a[_0x3b90('0x2b')][_0x3b90('0x30')](_0x3b90('0x31'))){_0x171ac6[_0x3b90('0x32')]=qs['limit'](_0x38852a['query']['limit']);_0x171ac6['offset']=qs[_0x3b90('0x16')](_0x38852a[_0x3b90('0x2b')][_0x3b90('0x16')]);}_0x171ac6[_0x3b90('0x33')]=qs[_0x3b90('0x34')](_0x38852a[_0x3b90('0x2b')][_0x3b90('0x34')]);_0x171ac6[_0x3b90('0x37')]=qs[_0x3b90('0x2c')](_['pick'](_0x38852a[_0x3b90('0x2b')],_0x337da6['filters']));_0x171ac6['where'][_0x3b90('0x55')]=_0x435eb8['id'];if(_0x38852a[_0x3b90('0x2b')][_0x3b90('0x36')]){_0x171ac6[_0x3b90('0x37')]=_[_0x3b90('0x45')](_0x171ac6['where'],{'$or':_[_0x3b90('0x26')](_0x171ac6['attributes'],function(_0x2fc084){var _0x1a32b2={};_0x1a32b2[_0x2fc084]={'$like':'%'+_0x38852a[_0x3b90('0x2b')][_0x3b90('0x36')]+'%'};return _0x1a32b2;})});}_0x171ac6=_[_0x3b90('0x45')]({},_0x171ac6,_0x38852a[_0x3b90('0x3a')]);return db[_0x3b90('0x5b')][_0x3b90('0x3b')]({'where':_0x171ac6[_0x3b90('0x37')]})[_0x3b90('0x1c')](function(_0x504297){_0x20c907[_0x3b90('0x3b')]=_0x504297;if(_0x38852a[_0x3b90('0x2b')][_0x3b90('0x3c')]){_0x171ac6[_0x3b90('0x3d')]=[{'all':!![]}];}return db[_0x3b90('0x5b')][_0x3b90('0x3e')](_0x171ac6);})[_0x3b90('0x1c')](function(_0x22ecb9){_0x20c907[_0x3b90('0x3f')]=_0x22ecb9;return _0x20c907;});}})[_0x3b90('0x1c')](respondWithFilteredResult(_0x52c38a,_0x171ac6))[_0x3b90('0x40')](handleError(_0x52c38a,null));};exports['getLists']=function(_0x247492,_0x3f0a11,_0x501f79){var _0x3c042e={};var _0x18bcad={};var _0x82efc8;var _0xdeeffd;return db['Campaign'][_0x3b90('0x57')]({'where':{'id':_0x247492['params']['id']}})['then'](handleEntityNotFound(_0x3f0a11,null))['then'](function(_0x4eeedb){if(_0x4eeedb){_0x82efc8=_0x4eeedb;_0x18bcad[_0x3b90('0x2a')]=_[_0x3b90('0x43')](db[_0x3b90('0x5c')][_0x3b90('0x28')]);_0x18bcad[_0x3b90('0x2b')]=_[_0x3b90('0x43')](_0x247492[_0x3b90('0x2b')]);_0x18bcad[_0x3b90('0x2c')]=_['intersection'](_0x18bcad[_0x3b90('0x2a')],_0x18bcad[_0x3b90('0x2b')]);_0x3c042e['attributes']=_[_0x3b90('0x2d')](_0x18bcad[_0x3b90('0x2a')],qs['fields'](_0x247492[_0x3b90('0x2b')]['fields']));_0x3c042e[_0x3b90('0x2f')]=_0x3c042e['attributes'][_0x3b90('0x44')]?_0x3c042e[_0x3b90('0x2f')]:_0x18bcad['model'];_0x3c042e['order']=qs[_0x3b90('0x34')](_0x247492[_0x3b90('0x2b')][_0x3b90('0x34')]);_0x3c042e['where']=qs[_0x3b90('0x2c')](_['pick'](_0x247492[_0x3b90('0x2b')],_0x18bcad['filters']));if(_0x247492[_0x3b90('0x2b')][_0x3b90('0x36')]){_0x3c042e[_0x3b90('0x37')]=_[_0x3b90('0x45')](_0x3c042e[_0x3b90('0x37')],{'$or':_[_0x3b90('0x26')](_0x3c042e['attributes'],function(_0x424702){var _0x3863ef={};_0x3863ef[_0x424702]={'$like':'%'+_0x247492['query'][_0x3b90('0x36')]+'%'};return _0x3863ef;})});}_0x3c042e=_[_0x3b90('0x45')]({},_0x3c042e,_0x247492[_0x3b90('0x3a')]);return _0x82efc8[_0x3b90('0x5d')](_0x3c042e);}})['then'](function(_0x509694){if(_0x509694){_0xdeeffd=_0x509694[_0x3b90('0x44')];if(!_0x247492[_0x3b90('0x2b')]['hasOwnProperty']('nolimit')){_0x3c042e[_0x3b90('0x32')]=qs[_0x3b90('0x32')](_0x247492[_0x3b90('0x2b')]['limit']);_0x3c042e[_0x3b90('0x16')]=qs[_0x3b90('0x16')](_0x247492[_0x3b90('0x2b')][_0x3b90('0x16')]);}return _0x82efc8[_0x3b90('0x5d')](_0x3c042e);}})[_0x3b90('0x1c')](function(_0x305ace){if(_0x305ace){return _0x305ace?{'count':_0xdeeffd,'rows':_0x305ace}:null;}})['then'](respondWithResult(_0x3f0a11,null))[_0x3b90('0x40')](handleError(_0x3f0a11,null));};exports[_0x3b90('0x5e')]=function(_0xd84ba2,_0x364f0e,_0x450a46){var _0x264c54,_0x47e27f;return db['Campaign'][_0x3b90('0x4d')]({'where':{'id':_0xd84ba2[_0x3b90('0x42')]['id']}})[_0x3b90('0x1c')](handleEntityNotFound(_0x364f0e,null))[_0x3b90('0x1c')](function(_0x1f643c){if(_0x1f643c){_0x47e27f=_0x1f643c;return _0x1f643c['addLists'](_0xd84ba2[_0x3b90('0x51')][_0x3b90('0x5f')],_['omit'](_0xd84ba2[_0x3b90('0x51')],[_0x3b90('0x5f'),'id'])||{});}return null;})['spread'](function(_0x1a6ea5){var _0xbc60a4;_0x264c54=_0x1a6ea5||[];var _0x5b400c=[];if(_0x1a6ea5){for(var _0x5c6444=0x0;_0x5c6444<_0x1a6ea5['length'];_0x5c6444+=0x1){var _0x5a4736=_0x1a6ea5[_0x5c6444][_0x3b90('0x1e')]({'plain':!![]});_0x47e27f[_0x3b90('0x60')]=_0xd84ba2[_0x3b90('0x51')]['dialCheckDuplicateType']?_0xd84ba2[_0x3b90('0x51')][_0x3b90('0x60')]:_0x47e27f[_0x3b90('0x60')];switch(_0x47e27f[_0x3b90('0x60')]){case _0x3b90('0x61'):_0xbc60a4=squel[_0x3b90('0x62')]()['into'](_0x3b90('0x63'))['fromQuery']([_0x3b90('0x64'),_0x3b90('0x65'),'ContactId','ListId',_0x3b90('0x55'),_0x3b90('0x4f'),_0x3b90('0x50')],squel[_0x3b90('0x66')]()[_0x3b90('0x67')](_0x3b90('0x64'),_0x3b90('0x64'))[_0x3b90('0x67')](_0x3b90('0x68'),_0x3b90('0x65'))[_0x3b90('0x67')]('id',_0x3b90('0x69'))['field'](_0x5a4736[_0x3b90('0x6a')][_0x3b90('0x6b')](),_0x3b90('0x6c'))[_0x3b90('0x67')](_0xd84ba2[_0x3b90('0x42')]['id'][_0x3b90('0x6b')](),'CampaignId')[_0x3b90('0x67')](_0x3b90('0x68'),_0x3b90('0x4f'))['field'](_0x3b90('0x68'),_0x3b90('0x50'))['from'](_0x3b90('0x6d'))[_0x3b90('0x37')](_0x3b90('0x6e'))[_0x3b90('0x37')]('ListId\x20=\x20?',_0x5a4736[_0x3b90('0x6a')][_0x3b90('0x6b')]())[_0x3b90('0x37')](_0x3b90('0x6f'))['where'](_0x3b90('0x70'),squel[_0x3b90('0x66')]()[_0x3b90('0x67')](_0x3b90('0x71'))[_0x3b90('0x72')](_0x3b90('0x73'))[_0x3b90('0x37')](_0x3b90('0x74'),_0xd84ba2[_0x3b90('0x42')]['id'][_0x3b90('0x6b')]()))[_0x3b90('0x37')](_0x3b90('0x70'),squel[_0x3b90('0x66')]()[_0x3b90('0x67')](_0x3b90('0x75'))[_0x3b90('0x72')](_0x3b90('0x63'))['where'](_0x3b90('0x74'),_0xd84ba2['params']['id'][_0x3b90('0x6b')]())))[_0x3b90('0x6b')]();break;case _0x3b90('0x76'):_0xbc60a4=squel[_0x3b90('0x62')]()[_0x3b90('0x77')](_0x3b90('0x63'))[_0x3b90('0x78')]([_0x3b90('0x64'),_0x3b90('0x65'),_0x3b90('0x69'),_0x3b90('0x6c'),_0x3b90('0x55'),'createdAt','updatedAt'],squel[_0x3b90('0x66')]()['field'](_0x3b90('0x64'),_0x3b90('0x64'))[_0x3b90('0x67')](_0x3b90('0x68'),_0x3b90('0x65'))[_0x3b90('0x67')]('id','ContactId')[_0x3b90('0x67')](_0x5a4736[_0x3b90('0x6a')][_0x3b90('0x6b')](),_0x3b90('0x6c'))[_0x3b90('0x67')](_0xd84ba2[_0x3b90('0x42')]['id'][_0x3b90('0x6b')](),'CampaignId')['field'](_0x3b90('0x68'),_0x3b90('0x4f'))[_0x3b90('0x67')]('NOW()',_0x3b90('0x50'))[_0x3b90('0x72')](_0x3b90('0x6d'))[_0x3b90('0x37')](_0x3b90('0x6e'))[_0x3b90('0x37')](_0x3b90('0x79'),_0x5a4736['CmListId']['toString']())[_0x3b90('0x37')](_0x3b90('0x6f'))[_0x3b90('0x37')](_0x3b90('0x70'),squel[_0x3b90('0x66')]()[_0x3b90('0x67')](_0x3b90('0x75'))['from'](_0x3b90('0x63'))['where'](_0x3b90('0x74'),_0xd84ba2[_0x3b90('0x42')]['id'][_0x3b90('0x6b')]())))['toString']();break;default:_0xbc60a4=squel[_0x3b90('0x62')]()['into'](_0x3b90('0x63'))[_0x3b90('0x78')]([_0x3b90('0x64'),_0x3b90('0x65'),'ContactId',_0x3b90('0x6c'),_0x3b90('0x55'),_0x3b90('0x4f'),'updatedAt'],squel[_0x3b90('0x66')]()[_0x3b90('0x67')](_0x3b90('0x64'),_0x3b90('0x64'))[_0x3b90('0x67')](_0x3b90('0x68'),_0x3b90('0x65'))['field']('id','ContactId')[_0x3b90('0x67')](_0x5a4736[_0x3b90('0x6a')][_0x3b90('0x6b')](),'ListId')[_0x3b90('0x67')](_0xd84ba2[_0x3b90('0x42')]['id'][_0x3b90('0x6b')](),'CampaignId')[_0x3b90('0x67')](_0x3b90('0x68'),'createdAt')[_0x3b90('0x67')](_0x3b90('0x68'),_0x3b90('0x50'))[_0x3b90('0x72')](_0x3b90('0x6d'))[_0x3b90('0x37')]('deletedAt\x20IS\x20NULL')[_0x3b90('0x37')]('ListId\x20=\x20?',_0x5a4736[_0x3b90('0x6a')][_0x3b90('0x6b')]())['where'](_0x3b90('0x6f')))['toString']();}_0x5b400c[_0x3b90('0x7a')](db[_0x3b90('0x7b')][_0x3b90('0x2b')](_0xbc60a4));}return BPromise[_0x3b90('0x7c')](_0x5b400c);}})[_0x3b90('0x1c')](function(){return _0x264c54;})['then'](respondWithResult(_0x364f0e,null))[_0x3b90('0x40')](handleError(_0x364f0e,null));};exports['removeLists']=function(_0x10f4f3,_0x52765c,_0x432b63){return db[_0x3b90('0x27')][_0x3b90('0x4d')]({'where':{'id':_0x10f4f3[_0x3b90('0x42')]['id']}})[_0x3b90('0x1c')](handleEntityNotFound(_0x52765c,null))['then'](function(_0x479af8){if(_0x479af8){return _0x479af8[_0x3b90('0x7d')](_0x10f4f3['query'][_0x3b90('0x5f')]);}})[_0x3b90('0x1c')](function(_0xebae36){if(_0xebae36){return db[_0x3b90('0x54')][_0x3b90('0x1d')]({'where':{'ListId':_0x10f4f3[_0x3b90('0x2b')][_0x3b90('0x5f')],'CampaignId':_0x10f4f3[_0x3b90('0x42')]['id']}})[_0x3b90('0x1c')](function(){return _0xebae36;});}})[_0x3b90('0x1c')](respondWithStatusCode(_0x52765c,null))[_0x3b90('0x40')](handleError(_0x52765c,null));};exports[_0x3b90('0x7e')]=function(_0x2856f7,_0x679fd0,_0x5b5099){var _0x121183={'raw':!![],'where':{}};var _0x1259b9={};var _0x266fc3={'count':0x0,'rows':[]};return db[_0x3b90('0x27')][_0x3b90('0x57')]({'where':{'id':_0x2856f7['params']['id']}})[_0x3b90('0x1c')](handleEntityNotFound(_0x679fd0,null))['then'](function(_0x307477){if(_0x307477){_0x1259b9['model']=_[_0x3b90('0x43')](db[_0x3b90('0x5c')][_0x3b90('0x28')]);_0x1259b9[_0x3b90('0x2b')]=_[_0x3b90('0x43')](_0x2856f7[_0x3b90('0x2b')]);_0x1259b9[_0x3b90('0x2c')]=_[_0x3b90('0x2d')](_0x1259b9[_0x3b90('0x2a')],_0x1259b9[_0x3b90('0x2b')]);_0x121183[_0x3b90('0x2f')]=_[_0x3b90('0x2d')](_0x1259b9['model'],qs[_0x3b90('0x2e')](_0x2856f7[_0x3b90('0x2b')][_0x3b90('0x2e')]));_0x121183[_0x3b90('0x2f')]=_0x121183[_0x3b90('0x2f')][_0x3b90('0x44')]?_0x121183['attributes']:_0x1259b9[_0x3b90('0x2a')];if(!_0x2856f7[_0x3b90('0x2b')][_0x3b90('0x30')](_0x3b90('0x31'))){_0x121183[_0x3b90('0x32')]=qs['limit'](_0x2856f7[_0x3b90('0x2b')][_0x3b90('0x32')]);_0x121183[_0x3b90('0x16')]=qs['offset'](_0x2856f7['query']['offset']);}_0x121183['order']=qs[_0x3b90('0x34')](_0x2856f7[_0x3b90('0x2b')][_0x3b90('0x34')]);_0x121183[_0x3b90('0x37')]=qs[_0x3b90('0x2c')](_[_0x3b90('0x35')](_0x2856f7['query'],_0x1259b9[_0x3b90('0x2c')]));_0x121183[_0x3b90('0x37')][_0x3b90('0x55')]=_0x307477['id'];if(_0x2856f7[_0x3b90('0x2b')][_0x3b90('0x36')]){_0x121183['where']=_['merge'](_0x121183[_0x3b90('0x37')],{'$or':_['map'](_0x121183['attributes'],function(_0x758536){var _0x1cc739={};_0x1cc739[_0x758536]={'$like':'%'+_0x2856f7['query']['filter']+'%'};return _0x1cc739;})});}_0x121183=_[_0x3b90('0x45')]({},_0x121183,_0x2856f7[_0x3b90('0x3a')]);return db[_0x3b90('0x5c')]['count']({'where':_0x121183[_0x3b90('0x37')]})['then'](function(_0x1b2ea8){_0x266fc3[_0x3b90('0x3b')]=_0x1b2ea8;if(_0x2856f7[_0x3b90('0x2b')][_0x3b90('0x3c')]){_0x121183[_0x3b90('0x3d')]=[{'all':!![]}];}return db[_0x3b90('0x5c')][_0x3b90('0x3e')](_0x121183);})['then'](function(_0x411fcf){_0x266fc3[_0x3b90('0x3f')]=_0x411fcf;return _0x266fc3;});}})[_0x3b90('0x1c')](respondWithFilteredResult(_0x679fd0,_0x121183))[_0x3b90('0x40')](handleError(_0x679fd0,null));};exports[_0x3b90('0x7f')]=function(_0xd2ada3,_0x5b4a11,_0x3ff8ec){var _0xa5487d,_0x3b208e;return db[_0x3b90('0x27')][_0x3b90('0x4d')]({'where':{'id':_0xd2ada3[_0x3b90('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b4a11,null))['then'](function(_0x15050b){if(_0x15050b){_0x3b208e=_0x15050b;return _0x15050b[_0x3b90('0x7f')](_0xd2ada3[_0x3b90('0x51')][_0x3b90('0x5f')],_[_0x3b90('0x4e')](_0xd2ada3['body'],['ids','id'])||{});}return null;})[_0x3b90('0x80')](function(_0x423ad3){var _0x4b9466;_0xa5487d=_0x423ad3||[];var _0x1dc5db=[];if(_0x423ad3){for(var _0x3dc7b9=0x0;_0x3dc7b9<_0x423ad3[_0x3b90('0x44')];_0x3dc7b9+=0x1){var _0x381300=_0x423ad3[_0x3dc7b9]['get']({'plain':!![]});_0x4b9466=squel['insert']()['into'](_0x3b90('0x81'))[_0x3b90('0x78')]([_0x3b90('0x64'),_0x3b90('0x69'),_0x3b90('0x6c'),_0x3b90('0x55'),'createdAt',_0x3b90('0x50')],squel[_0x3b90('0x66')]()[_0x3b90('0x67')](_0x3b90('0x64'),_0x3b90('0x64'))[_0x3b90('0x67')]('id',_0x3b90('0x69'))[_0x3b90('0x67')](_0x381300[_0x3b90('0x6a')][_0x3b90('0x6b')](),'ListId')[_0x3b90('0x67')](_0xd2ada3[_0x3b90('0x42')]['id'][_0x3b90('0x6b')](),'CampaignId')['field'](_0x3b90('0x68'),_0x3b90('0x4f'))[_0x3b90('0x67')](_0x3b90('0x68'),_0x3b90('0x50'))['from'](_0x3b90('0x6d'))[_0x3b90('0x37')](_0x3b90('0x6e'))[_0x3b90('0x37')](_0x3b90('0x79'),_0x381300[_0x3b90('0x6a')][_0x3b90('0x6b')]())['where'](_0x3b90('0x6f')))['toString']();_0x1dc5db[_0x3b90('0x7a')](db['sequelize'][_0x3b90('0x2b')](_0x4b9466));}return BPromise[_0x3b90('0x7c')](_0x1dc5db);}})[_0x3b90('0x1c')](function(){return _0xa5487d;})[_0x3b90('0x1c')](respondWithResult(_0x5b4a11,null))[_0x3b90('0x40')](handleError(_0x5b4a11,null));};exports['removeBlackLists']=function(_0x70136,_0x276679,_0x55550f){return db[_0x3b90('0x27')][_0x3b90('0x4d')]({'where':{'id':_0x70136['params']['id']}})[_0x3b90('0x1c')](handleEntityNotFound(_0x276679,null))[_0x3b90('0x1c')](function(_0x44710c){if(_0x44710c){return _0x44710c[_0x3b90('0x82')](_0x70136[_0x3b90('0x2b')][_0x3b90('0x5f')]);}})['then'](function(_0x102592){if(_0x102592){return db[_0x3b90('0x5b')][_0x3b90('0x1d')]({'where':{'ListId':_0x70136[_0x3b90('0x2b')][_0x3b90('0x5f')],'CampaignId':_0x70136[_0x3b90('0x42')]['id']}})[_0x3b90('0x1c')](function(){return _0x102592;});}})[_0x3b90('0x1c')](respondWithStatusCode(_0x276679,null))['catch'](handleError(_0x276679,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 88f4754..d5571ad 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 _0x1f92=['./campaign.attributes','exports','Campaign','campaigns','lodash','util','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0x1f92,0x9e));var _0x21f9=function(_0x388c00,_0x538a5f){_0x388c00=_0x388c00-0x0;var _0x4fec3a=_0x1f92[_0x388c00];return _0x4fec3a;};'use strict';var _=require(_0x21f9('0x0'));var util=require(_0x21f9('0x1'));var logger=require(_0x21f9('0x2'))(_0x21f9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x21f9('0x4'));var rimraf=require(_0x21f9('0x5'));var config=require(_0x21f9('0x6'));var attributes=require(_0x21f9('0x7'));module[_0x21f9('0x8')]=function(_0xfc256d,_0x16c068){return _0xfc256d['define'](_0x21f9('0x9'),attributes,{'tableName':_0x21f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09a8=['Campaign','campaigns','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./campaign.attributes','exports'];(function(_0x21570d,_0x385033){var _0x284108=function(_0x207484){while(--_0x207484){_0x21570d['push'](_0x21570d['shift']());}};_0x284108(++_0x385033);}(_0x09a8,0xb8));var _0x809a=function(_0x2c3d41,_0x5a9c41){_0x2c3d41=_0x2c3d41-0x0;var _0x1d5685=_0x09a8[_0x2c3d41];return _0x1d5685;};'use strict';var _=require(_0x809a('0x0'));var util=require(_0x809a('0x1'));var logger=require(_0x809a('0x2'))(_0x809a('0x3'));var moment=require(_0x809a('0x4'));var BPromise=require(_0x809a('0x5'));var rp=require(_0x809a('0x6'));var fs=require('fs');var path=require(_0x809a('0x7'));var rimraf=require('rimraf');var config=require(_0x809a('0x8'));var attributes=require(_0x809a('0x9'));module[_0x809a('0xa')]=function(_0x151534,_0x2218d4){return _0x151534['define'](_0x809a('0xb'),attributes,{'tableName':_0x809a('0xc'),'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 8fb2e16..ab25a34 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(_0x81c647,_0x10fcc7){var _0x1fded6=function(_0x1c141b){while(--_0x1c141b){_0x81c647['push'](_0x81c647['shift']());}};_0x1fded6(++_0x10fcc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x5a26f9,_0x1b0bf6){var _0x478ffe=function(_0xc878e5){while(--_0xc878e5){_0x5a26f9['push'](_0x5a26f9['shift']());}};_0x478ffe(++_0x1b0bf6);}(_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 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 8393ed7..3ceb0c1 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 _0xb885=['addLists','/:id/blacklists','addBlackLists','put','delete','removeLists','removeBlackLists','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./campaign.controller','get','/:id','show','isAuthenticated','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getLists','create','post','clone','/:id/lists'];(function(_0x507965,_0x4944f4){var _0x3608fc=function(_0x14c8d0){while(--_0x14c8d0){_0x507965['push'](_0x507965['shift']());}};_0x3608fc(++_0x4944f4);}(_0xb885,0x1d8));var _0x5b88=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0xb885[_0x454e6d];return _0x4bc294;};'use strict';var multer=require('multer');var util=require(_0x5b88('0x0'));var path=require(_0x5b88('0x1'));var timeout=require('connect-timeout');var express=require(_0x5b88('0x2'));var router=express[_0x5b88('0x3')]();var auth=require(_0x5b88('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5b88('0x5'));var controller=require(_0x5b88('0x6'));router[_0x5b88('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5b88('0x7')](_0x5b88('0x8'),auth['isAuthenticated'](),controller[_0x5b88('0x9')]);router[_0x5b88('0x7')]('/:id/hoppers',auth[_0x5b88('0xa')](),controller[_0x5b88('0xb')]);router[_0x5b88('0x7')]('/:id/hopper_histories',auth[_0x5b88('0xa')](),controller[_0x5b88('0xc')]);router[_0x5b88('0x7')](_0x5b88('0xd'),auth[_0x5b88('0xa')](),controller[_0x5b88('0xe')]);router[_0x5b88('0x7')](_0x5b88('0xf'),auth[_0x5b88('0xa')](),controller['getHopperBlacks']);router[_0x5b88('0x7')]('/:id/lists',auth[_0x5b88('0xa')](),controller[_0x5b88('0x10')]);router[_0x5b88('0x7')]('/:id/blacklists',auth[_0x5b88('0xa')](),controller['getBlackLists']);router['post']('/',auth[_0x5b88('0xa')](),controller[_0x5b88('0x11')]);router[_0x5b88('0x12')]('/:id/clone',auth['isAuthenticated'](),controller[_0x5b88('0x13')]);router[_0x5b88('0x12')](_0x5b88('0x14'),auth['isAuthenticated'](),controller[_0x5b88('0x15')]);router[_0x5b88('0x12')](_0x5b88('0x16'),auth[_0x5b88('0xa')](),controller[_0x5b88('0x17')]);router[_0x5b88('0x18')](_0x5b88('0x8'),auth[_0x5b88('0xa')](),controller['update']);router[_0x5b88('0x19')]('/:id',auth[_0x5b88('0xa')](),controller['destroy']);router[_0x5b88('0x19')](_0x5b88('0x14'),auth[_0x5b88('0xa')](),controller[_0x5b88('0x1a')]);router[_0x5b88('0x19')](_0x5b88('0x16'),auth[_0x5b88('0xa')](),controller[_0x5b88('0x1b')]);module[_0x5b88('0x1c')]=router; \ No newline at end of file +var _0x29b1=['addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','express','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','post','/:id/clone','clone','/:id/lists'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0x29b1,0x9e));var _0x129b=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x29b1[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0x129b('0x0'));var util=require(_0x129b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x129b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x129b('0x3'));var controller=require(_0x129b('0x4'));router[_0x129b('0x5')]('/',auth['isAuthenticated'](),controller[_0x129b('0x6')]);router[_0x129b('0x5')](_0x129b('0x7'),auth[_0x129b('0x8')](),controller['show']);router[_0x129b('0x5')](_0x129b('0x9'),auth[_0x129b('0x8')](),controller[_0x129b('0xa')]);router[_0x129b('0x5')](_0x129b('0xb'),auth[_0x129b('0x8')](),controller[_0x129b('0xc')]);router['get'](_0x129b('0xd'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x129b('0x5')](_0x129b('0xe'),auth[_0x129b('0x8')](),controller[_0x129b('0xf')]);router[_0x129b('0x5')]('/:id/lists',auth[_0x129b('0x8')](),controller[_0x129b('0x10')]);router[_0x129b('0x5')](_0x129b('0x11'),auth[_0x129b('0x8')](),controller['getBlackLists']);router[_0x129b('0x12')]('/',auth[_0x129b('0x8')](),controller['create']);router[_0x129b('0x12')](_0x129b('0x13'),auth[_0x129b('0x8')](),controller[_0x129b('0x14')]);router['post'](_0x129b('0x15'),auth[_0x129b('0x8')](),controller['addLists']);router[_0x129b('0x12')](_0x129b('0x11'),auth[_0x129b('0x8')](),controller[_0x129b('0x16')]);router[_0x129b('0x17')](_0x129b('0x7'),auth[_0x129b('0x8')](),controller[_0x129b('0x18')]);router[_0x129b('0x19')]('/:id',auth[_0x129b('0x8')](),controller[_0x129b('0x1a')]);router['delete'](_0x129b('0x15'),auth[_0x129b('0x8')](),controller[_0x129b('0x1b')]);router['delete']('/:id/blacklists',auth[_0x129b('0x8')](),controller[_0x129b('0x1c')]);module[_0x129b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index e34617a..805270d 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 _0xf8bd=['VIRTUAL','getDataValue','key','STRING','TEXT'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf8bd,0x76));var _0xdf8b=function(_0x2a5042,_0x307d04){_0x2a5042=_0x2a5042-0x0;var _0x4bc22f=_0xf8bd[_0x2a5042];return _0x4bc22f;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0xdf8b('0x0')],'allowNull':![]},'value':{'type':Sequelize[_0xdf8b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xdf8b('0x0')]},'name':{'type':Sequelize[_0xdf8b('0x2')],'get':function(){return this[_0xdf8b('0x3')](_0xdf8b('0x4'));}}}; \ No newline at end of file +var _0x4004=['exports','STRING','TEXT','VIRTUAL','getDataValue','sequelize'];(function(_0x1bed4f,_0x1f6f84){var _0x5dda41=function(_0x27626b){while(--_0x27626b){_0x1bed4f['push'](_0x1bed4f['shift']());}};_0x5dda41(++_0x1f6f84);}(_0x4004,0xe9));var _0x4400=function(_0x3760f1,_0x498373){_0x3760f1=_0x3760f1-0x0;var _0x14d886=_0x4004[_0x3760f1];return _0x14d886;};'use strict';var Sequelize=require(_0x4400('0x0'));module[_0x4400('0x1')]={'key':{'type':Sequelize[_0x4400('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x4400('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x4400('0x2')]},'name':{'type':Sequelize[_0x4400('0x4')],'get':function(){return this[_0x4400('0x5')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index f2a75ac..1ef7ced 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 _0xa9e0=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','name','send','index','map','CannedAnswer','rawAttributes','type','key','model','query','keys'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){var _0x38e7c4=_0x588269[_0x0a9e('0x21')]({'plain':!![]});var _0x4abc77=_0x0a9e('0x22');return db[_0x0a9e('0x23')][_0x0a9e('0x20')]({'where':{'type':_0x4abc77,'resourceId':_0x38e7c4['id']}})[_0x0a9e('0x1f')](function(){return _0x588269;});})[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x24')]();});}};}function handleEntityNotFound(_0x5ea472,_0x59181e){return function(_0x197ec0){if(!_0x197ec0){_0x5ea472[_0x0a9e('0x14')](0x194);}return _0x197ec0;};}function handleError(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0x1f4;return function(_0x526cf3){logger[_0x0a9e('0x25')](_0x526cf3['stack']);if(_0x526cf3[_0x0a9e('0x26')]){delete _0x526cf3['name'];}_0x40c424[_0x0a9e('0x15')](_0x33161b)[_0x0a9e('0x27')](_0x526cf3);};}exports[_0x0a9e('0x28')]=function(_0x14433c,_0x140511){var _0x1538a4={},_0x11c3b6={},_0x14de77={'count':0x0,'rows':[]};var _0x5a101a=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x2ec755){return{'name':_0x2ec755['fieldName'],'type':_0x2ec755[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x11c3b6[_0x0a9e('0x2e')]=_[_0x0a9e('0x29')](_0x5a101a,_0x0a9e('0x26'));_0x11c3b6[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x14433c[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x31')]=_['intersection'](_0x11c3b6[_0x0a9e('0x2e')],_0x11c3b6['query']);_0x1538a4[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x11c3b6[_0x0a9e('0x2e')],qs[_0x0a9e('0x34')](_0x14433c[_0x0a9e('0x2f')]['fields']));_0x1538a4[_0x0a9e('0x32')]=_0x1538a4[_0x0a9e('0x32')][_0x0a9e('0x35')]?_0x1538a4[_0x0a9e('0x32')]:_0x11c3b6[_0x0a9e('0x2e')];if(!_0x14433c[_0x0a9e('0x2f')][_0x0a9e('0x36')](_0x0a9e('0x37'))){_0x1538a4['limit']=qs[_0x0a9e('0x38')](_0x14433c['query'][_0x0a9e('0x38')]);_0x1538a4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x2f')]['offset']);}_0x1538a4[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x14433c[_0x0a9e('0x2f')][_0x0a9e('0x3a')]);_0x1538a4['where']=qs['filters'](_[_0x0a9e('0x3b')](_0x14433c['query'],_0x11c3b6[_0x0a9e('0x31')]));if(_0x14433c[_0x0a9e('0x2f')][_0x0a9e('0x3c')]){_0x1538a4[_0x0a9e('0x3d')]=_['merge'](_0x1538a4[_0x0a9e('0x3d')],{'$or':_[_0x0a9e('0x29')](_0x5a101a,function(_0x3cae){if(_0x3cae['type']!==_0x0a9e('0x3e')){var _0x1a180b={};_0x1a180b[_0x3cae[_0x0a9e('0x26')]]={'$like':'%'+_0x14433c['query']['filter']+'%'};return _0x1a180b;}})});}_0x1538a4=_[_0x0a9e('0x3f')]({},_0x1538a4,_0x14433c[_0x0a9e('0x40')]);var _0x5adda1={'where':_0x1538a4[_0x0a9e('0x3d')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x17')](_0x5adda1)[_0x0a9e('0x1f')](function(_0x4b38d9){_0x14de77['count']=_0x4b38d9;if(_0x14433c[_0x0a9e('0x2f')][_0x0a9e('0x41')]){_0x1538a4['include']=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x42')](_0x1538a4);})[_0x0a9e('0x1f')](function(_0x5b4f5e){_0x14de77[_0x0a9e('0x43')]=_0x5b4f5e;return _0x14de77;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x140511,_0x1538a4))[_0x0a9e('0x44')](handleError(_0x140511,null));};exports[_0x0a9e('0x45')]=function(_0x13cb1f,_0xeaa5e5){var _0x2881b3={'raw':!![],'where':{'id':_0x13cb1f[_0x0a9e('0x46')]['id']}},_0x45a9b8={};_0x45a9b8[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x45a9b8[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x13cb1f['query']);_0x45a9b8['filters']=_[_0x0a9e('0x33')](_0x45a9b8[_0x0a9e('0x2e')],_0x45a9b8[_0x0a9e('0x2f')]);_0x2881b3[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x45a9b8[_0x0a9e('0x2e')],qs[_0x0a9e('0x34')](_0x13cb1f[_0x0a9e('0x2f')][_0x0a9e('0x34')]));_0x2881b3[_0x0a9e('0x32')]=_0x2881b3[_0x0a9e('0x32')][_0x0a9e('0x35')]?_0x2881b3['attributes']:_0x45a9b8[_0x0a9e('0x2e')];if(_0x13cb1f[_0x0a9e('0x2f')][_0x0a9e('0x41')]){_0x2881b3[_0x0a9e('0x47')]=[{'all':!![]}];}_0x2881b3=_[_0x0a9e('0x3f')]({},_0x2881b3,_0x13cb1f[_0x0a9e('0x40')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x48')](_0x2881b3)['then'](handleEntityNotFound(_0xeaa5e5,null))[_0x0a9e('0x1f')](respondWithResult(_0xeaa5e5,null))['catch'](handleError(_0xeaa5e5,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x49')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x476688[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x49')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x44')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x1b5e80[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));};exports[_0x0a9e('0x4a')]=function(_0x3fe430,_0x4f7240){var _0x4ae14b={'key':_0x3fe430['body'][_0x0a9e('0x2d')]};if(_0x3fe430[_0x0a9e('0x49')][_0x0a9e('0x4b')]){_0x4ae14b[_0x0a9e('0x4b')]=_0x3fe430[_0x0a9e('0x49')][_0x0a9e('0x4b')];}else if(_0x3fe430[_0x0a9e('0x49')][_0x0a9e('0x4c')]){_0x4ae14b['SmsAccountId']=_0x3fe430['body']['SmsAccountId'];}else if(_0x3fe430[_0x0a9e('0x49')][_0x0a9e('0x4d')]){_0x4ae14b[_0x0a9e('0x4d')]=_0x3fe430['body'][_0x0a9e('0x4d')];}else if(_0x3fe430[_0x0a9e('0x49')]['ChatWebsiteId']){_0x4ae14b['ChatWebsiteId']=_0x3fe430[_0x0a9e('0x49')]['ChatWebsiteId'];}return db[_0x0a9e('0x2a')]['find']({'where':_0x4ae14b})[_0x0a9e('0x1f')](function(_0x3c20b2){if(_0x3c20b2){throw new db[(_0x0a9e('0x4e'))]['ValidationError'](_0x0a9e('0x4f'));}return db[_0x0a9e('0x2a')]['create'](_0x3fe430['body']);})[_0x0a9e('0x1f')](function(_0x3aedd0){var _0x49c095=_0x3fe430[_0x0a9e('0x50')]['get']({'plain':!![]});if(!_0x49c095)throw new Error(_0x0a9e('0x51'));if(_0x49c095['role']===_0x0a9e('0x50')){var _0x4a6deb=_0x3aedd0['get']({'plain':!![]});return db['UserProfileSection'][_0x0a9e('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0x49c095[_0x0a9e('0x52')]},'raw':!![]})[_0x0a9e('0x1f')](function(_0x3cfd00){if(_0x3cfd00&&_0x3cfd00[_0x0a9e('0x53')]===0x0){return db[_0x0a9e('0x23')][_0x0a9e('0x4a')]({'name':_0x4a6deb[_0x0a9e('0x26')],'resourceId':_0x4a6deb['id'],'type':_0x3cfd00[_0x0a9e('0x26')],'sectionId':_0x3cfd00['id']},{})['then'](function(){return _0x3aedd0;});}else{return _0x3aedd0;}})[_0x0a9e('0x44')](function(_0x121cef){logger[_0x0a9e('0x25')](_0x0a9e('0x54'),_0x121cef);throw _0x121cef;});}return _0x3aedd0;})[_0x0a9e('0x1f')](respondWithResult(_0x4f7240,0xc9))[_0x0a9e('0x44')](handleError(_0x4f7240,null));}; \ No newline at end of file +var _0x34e8=['filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','include','findAll','catch','show','includeAll','find','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','CannedAnswers','destroy','sendStatus','error','stack','name','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0xa13090,_0x54c9d){var _0x3f7acd=function(_0x3b6cd5){while(--_0x3b6cd5){_0xa13090['push'](_0xa13090['shift']());}};_0x3f7acd(++_0x54c9d);}(_0x34e8,0x12c));var _0x834e=function(_0x45bbcd,_0x423499){_0x45bbcd=_0x45bbcd-0x0;var _0x9e4a9d=_0x34e8[_0x45bbcd];return _0x9e4a9d;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var Redis=require(_0x834e('0x13'));var authService=require(_0x834e('0x14'));var qs=require(_0x834e('0x15'));var as=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var db=require(_0x834e('0x1c'))['db'];function respondWithStatusCode(_0x538bb3,_0x5e5b6d){_0x5e5b6d=_0x5e5b6d||0xcc;return function(_0x6cd9b9){if(_0x6cd9b9){return _0x538bb3['sendStatus'](_0x5e5b6d);}return _0x538bb3[_0x834e('0x1d')](_0x5e5b6d)[_0x834e('0x1e')]();};}function respondWithResult(_0x28e659,_0x21cc0a){_0x21cc0a=_0x21cc0a||0xc8;return function(_0x50e860){if(_0x50e860){return _0x28e659[_0x834e('0x1d')](_0x21cc0a)[_0x834e('0x1f')](_0x50e860);}};}function respondWithFilteredResult(_0x57274a,_0x316205){return function(_0x4a9cdc){if(_0x4a9cdc){var _0x38a8cd=_0x4a9cdc[_0x834e('0x20')],_0x36d443=_0x316205[_0x834e('0x21')],_0x478afe=_0x316205['offset']+_0x316205[_0x834e('0x22')],_0x43ac41;if(_0x478afe>=_0x38a8cd){_0x478afe=_0x38a8cd;_0x43ac41=0xc8;}else{_0x43ac41=0xce;}_0x57274a[_0x834e('0x1d')](_0x43ac41);return _0x57274a[_0x834e('0x23')](_0x834e('0x24'),_0x36d443+'-'+_0x478afe+'/'+_0x38a8cd)[_0x834e('0x1f')](_0x4a9cdc);}return null;};}function patchUpdates(_0x254677){return function(_0x1dd214){try{jsonpatch['apply'](_0x1dd214,_0x254677,!![]);}catch(_0x2545b4){return BPromise[_0x834e('0x25')](_0x2545b4);}return _0x1dd214[_0x834e('0x26')]();};}function saveUpdates(_0x325a99,_0x4ab05d){return function(_0x45a630){if(_0x45a630){return _0x45a630[_0x834e('0x27')](_0x325a99)['then'](function(_0x1b4bdf){return _0x1b4bdf;});}return null;};}function removeEntity(_0x28d687,_0x8d406e){return function(_0x5c55ca){if(_0x5c55ca){return _0x5c55ca['destroy']()[_0x834e('0x28')](function(){var _0x34563b=_0x5c55ca['get']({'plain':!![]});var _0x25ee1d=_0x834e('0x29');return db['UserProfileResource'][_0x834e('0x2a')]({'where':{'type':_0x25ee1d,'resourceId':_0x34563b['id']}})[_0x834e('0x28')](function(){return _0x5c55ca;});})[_0x834e('0x28')](function(){_0x28d687['status'](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x3e310f,_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x3e310f[_0x834e('0x2b')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x2c')](_0x3f1b0b[_0x834e('0x2d')]);if(_0x3f1b0b[_0x834e('0x2e')]){delete _0x3f1b0b[_0x834e('0x2e')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={},_0x106d6a={},_0x5dacc1={'count':0x0,'rows':[]};var _0xb5bc06=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x4551f5){return{'name':_0x4551f5[_0x834e('0x32')],'type':_0x4551f5[_0x834e('0x33')][_0x834e('0x34')]};});_0x106d6a[_0x834e('0x35')]=_['map'](_0xb5bc06,_0x834e('0x2e'));_0x106d6a['query']=_[_0x834e('0x36')](_0x58c1d7[_0x834e('0x37')]);_0x106d6a[_0x834e('0x38')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],_0x106d6a[_0x834e('0x37')]);_0x567cea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],qs[_0x834e('0x3b')](_0x58c1d7['query'][_0x834e('0x3b')]));_0x567cea[_0x834e('0x3a')]=_0x567cea[_0x834e('0x3a')][_0x834e('0x3c')]?_0x567cea['attributes']:_0x106d6a[_0x834e('0x35')];if(!_0x58c1d7[_0x834e('0x37')]['hasOwnProperty']('nolimit')){_0x567cea['limit']=qs[_0x834e('0x22')](_0x58c1d7[_0x834e('0x37')][_0x834e('0x22')]);_0x567cea[_0x834e('0x21')]=qs[_0x834e('0x21')](_0x58c1d7[_0x834e('0x37')]['offset']);}_0x567cea[_0x834e('0x3d')]=qs['sort'](_0x58c1d7[_0x834e('0x37')][_0x834e('0x3e')]);_0x567cea['where']=qs[_0x834e('0x38')](_[_0x834e('0x3f')](_0x58c1d7['query'],_0x106d6a['filters']));if(_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]){_0x567cea[_0x834e('0x41')]=_[_0x834e('0x42')](_0x567cea[_0x834e('0x41')],{'$or':_['map'](_0xb5bc06,function(_0x1c5ed6){if(_0x1c5ed6['type']!=='VIRTUAL'){var _0x1b2edf={};_0x1b2edf[_0x1c5ed6['name']]={'$like':'%'+_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]+'%'};return _0x1b2edf;}})});}_0x567cea=_[_0x834e('0x42')]({},_0x567cea,_0x58c1d7[_0x834e('0x43')]);var _0x2b7933={'where':_0x567cea['where']};return db[_0x834e('0x30')][_0x834e('0x20')](_0x2b7933)[_0x834e('0x28')](function(_0x58c5fb){_0x5dacc1[_0x834e('0x20')]=_0x58c5fb;if(_0x58c1d7[_0x834e('0x37')]['includeAll']){_0x567cea[_0x834e('0x44')]=[{'all':!![]}];}return db['CannedAnswer'][_0x834e('0x45')](_0x567cea);})[_0x834e('0x28')](function(_0x4a18bb){_0x5dacc1['rows']=_0x4a18bb;return _0x5dacc1;})[_0x834e('0x28')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x46')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x47')]=function(_0xbc1571,_0x8ad264){var _0x23feea={'raw':!![],'where':{'id':_0xbc1571['params']['id']}},_0x195204={};_0x195204[_0x834e('0x35')]=_['keys'](db[_0x834e('0x30')]['rawAttributes']);_0x195204[_0x834e('0x37')]=_['keys'](_0xbc1571[_0x834e('0x37')]);_0x195204[_0x834e('0x38')]=_['intersection'](_0x195204[_0x834e('0x35')],_0x195204[_0x834e('0x37')]);_0x23feea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x195204[_0x834e('0x35')],qs[_0x834e('0x3b')](_0xbc1571[_0x834e('0x37')][_0x834e('0x3b')]));_0x23feea[_0x834e('0x3a')]=_0x23feea[_0x834e('0x3a')]['length']?_0x23feea[_0x834e('0x3a')]:_0x195204[_0x834e('0x35')];if(_0xbc1571['query'][_0x834e('0x48')]){_0x23feea[_0x834e('0x44')]=[{'all':!![]}];}_0x23feea=_[_0x834e('0x42')]({},_0x23feea,_0xbc1571[_0x834e('0x43')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x23feea)['then'](handleEntityNotFound(_0x8ad264,null))['then'](respondWithResult(_0x8ad264,null))[_0x834e('0x46')](handleError(_0x8ad264,null));};exports[_0x834e('0x27')]=function(_0x30568e,_0x40ff5a){if(_0x30568e[_0x834e('0x4a')]['id']){delete _0x30568e[_0x834e('0x4a')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x30568e[_0x834e('0x4b')]['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x40ff5a,null))[_0x834e('0x28')](saveUpdates(_0x30568e[_0x834e('0x4a')],null))[_0x834e('0x28')](respondWithResult(_0x40ff5a,null))[_0x834e('0x46')](handleError(_0x40ff5a,null));};exports[_0x834e('0x2a')]=function(_0x1a3855,_0x3df078){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1a3855[_0x834e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3df078,null))[_0x834e('0x28')](removeEntity(_0x3df078,null))[_0x834e('0x46')](handleError(_0x3df078,null));};exports['create']=function(_0x3c00a3,_0x3b0988){var _0x55d491={'key':_0x3c00a3[_0x834e('0x4a')][_0x834e('0x34')]};if(_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4c')]){_0x55d491[_0x834e('0x4c')]=_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4c')];}else if(_0x3c00a3['body'][_0x834e('0x4d')]){_0x55d491[_0x834e('0x4d')]=_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4d')];}else if(_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4e')]){_0x55d491[_0x834e('0x4e')]=_0x3c00a3[_0x834e('0x4a')]['OpenchannelAccountId'];}else if(_0x3c00a3[_0x834e('0x4a')]['ChatWebsiteId']){_0x55d491[_0x834e('0x4f')]=_0x3c00a3['body'][_0x834e('0x4f')];}return db['CannedAnswer']['find']({'where':_0x55d491})[_0x834e('0x28')](function(_0x3e1bee){if(_0x3e1bee){throw new db['Sequelize']['ValidationError'](_0x834e('0x50'));}return db[_0x834e('0x30')][_0x834e('0x51')](_0x3c00a3[_0x834e('0x4a')]);})[_0x834e('0x28')](function(_0x315858){var _0x3d3f2b=_0x3c00a3[_0x834e('0x52')]['get']({'plain':!![]});if(!_0x3d3f2b)throw new Error(_0x834e('0x53'));if(_0x3d3f2b[_0x834e('0x54')]==='user'){var _0x281342=_0x315858['get']({'plain':!![]});return db[_0x834e('0x55')][_0x834e('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x3d3f2b[_0x834e('0x56')]},'raw':!![]})[_0x834e('0x28')](function(_0x2de29a){if(_0x2de29a&&_0x2de29a[_0x834e('0x57')]===0x0){return db['UserProfileResource'][_0x834e('0x51')]({'name':_0x281342[_0x834e('0x2e')],'resourceId':_0x281342['id'],'type':_0x2de29a[_0x834e('0x2e')],'sectionId':_0x2de29a['id']},{})['then'](function(){return _0x315858;});}else{return _0x315858;}})[_0x834e('0x46')](function(_0x1fcae9){logger[_0x834e('0x2c')](_0x834e('0x58'),_0x1fcae9);throw _0x1fcae9;});}return _0x315858;})[_0x834e('0x28')](respondWithResult(_0x3b0988,0xc9))[_0x834e('0x46')](handleError(_0x3b0988,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 22c4252..7053e12 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 _0x22f6=['CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0x22f6,0x10e));var _0x622f=function(_0x531987,_0x3249ec){_0x531987=_0x531987-0x0;var _0x305fed=_0x22f6[_0x531987];return _0x305fed;};'use strict';var _=require(_0x622f('0x0'));var util=require('util');var logger=require(_0x622f('0x1'))('api');var moment=require(_0x622f('0x2'));var BPromise=require(_0x622f('0x3'));var rp=require(_0x622f('0x4'));var fs=require('fs');var path=require(_0x622f('0x5'));var rimraf=require(_0x622f('0x6'));var config=require(_0x622f('0x7'));var attributes=require(_0x622f('0x8'));module[_0x622f('0x9')]=function(_0x659c64,_0x342d96){return _0x659c64['define'](_0x622f('0xa'),attributes,{'tableName':_0x622f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x622f('0xc'),'collate':_0x622f('0xd')});}; \ No newline at end of file +var _0xb43b=['./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3cafb8,_0x32860e){var _0x4b7f85=function(_0x31b11d){while(--_0x31b11d){_0x3cafb8['push'](_0x3cafb8['shift']());}};_0x4b7f85(++_0x32860e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x20773d,_0x2aeb68){_0x20773d=_0x20773d-0x0;var _0x53296e=_0xb43b[_0x20773d];return _0x53296e;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbb43('0xb'),'collate':_0xbb43('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 4e513ba..e4760b6 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 _0x586b=['request','then','info','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CannedAnswer,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x586b,0x11d));var _0xb586=function(_0x164bdb,_0xadb4cf){_0x164bdb=_0x164bdb-0x0;var _0x2cdb69=_0x586b[_0x164bdb];return _0x2cdb69;};'use strict';var _=require(_0xb586('0x0'));var util=require(_0xb586('0x1'));var moment=require(_0xb586('0x2'));var BPromise=require('bluebird');var rs=require(_0xb586('0x3'));var fs=require('fs');var Redis=require(_0xb586('0x4'));var db=require(_0xb586('0x5'))['db'];var utils=require(_0xb586('0x6'));var logger=require('../../config/logger')(_0xb586('0x7'));var config=require('../../config/environment');var jayson=require(_0xb586('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d600a,_0x35f92e,_0x209720){return new BPromise(function(_0x34e49d,_0x50465f){return client[_0xb586('0x9')](_0x4d600a,_0x209720)[_0xb586('0xa')](function(_0x2cfa29){logger[_0xb586('0xb')]('CannedAnswer,\x20%s,\x20%s',_0x35f92e,_0xb586('0xc'));logger[_0xb586('0xd')](_0xb586('0xe'),_0x35f92e,'request\x20sent',JSON[_0xb586('0xf')](_0x2cfa29));if(_0x2cfa29[_0xb586('0x10')]){if(_0x2cfa29[_0xb586('0x10')][_0xb586('0x11')]===0x1f4){logger[_0xb586('0x10')]('CannedAnswer,\x20%s,\x20%s',_0x35f92e,_0x2cfa29[_0xb586('0x10')][_0xb586('0x12')]);return _0x50465f(_0x2cfa29[_0xb586('0x10')]['message']);}logger['error'](_0xb586('0x13'),_0x35f92e,_0x2cfa29[_0xb586('0x10')][_0xb586('0x12')]);return _0x34e49d(_0x2cfa29['error'][_0xb586('0x12')]);}else{logger[_0xb586('0xb')]('CannedAnswer,\x20%s,\x20%s',_0x35f92e,'request\x20sent');_0x34e49d(_0x2cfa29['result'][_0xb586('0x12')]);}})[_0xb586('0x14')](function(_0x39c79a){logger[_0xb586('0x10')](_0xb586('0x13'),_0x35f92e,_0x39c79a);_0x50465f(_0x39c79a);});});} \ No newline at end of file +var _0xeb1d=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x241bc4,_0xa92ffc){var _0x1b30b4=function(_0x3c1544){while(--_0x3c1544){_0x241bc4['push'](_0x241bc4['shift']());}};_0x1b30b4(++_0xa92ffc);}(_0xeb1d,0x1ce));var _0xdeb1=function(_0xe1184c,_0x3e2986){_0xe1184c=_0xe1184c-0x0;var _0x5f7293=_0xeb1d[_0xe1184c];return _0x5f7293;};'use strict';var _=require('lodash');var util=require(_0xdeb1('0x0'));var moment=require(_0xdeb1('0x1'));var BPromise=require(_0xdeb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdeb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdeb1('0x4'));var logger=require(_0xdeb1('0x5'))(_0xdeb1('0x6'));var config=require(_0xdeb1('0x7'));var jayson=require(_0xdeb1('0x8'));var client=jayson[_0xdeb1('0x9')][_0xdeb1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5de7a1,_0x141953,_0x216102){return new BPromise(function(_0xb6dbcc,_0x311128){return client['request'](_0x5de7a1,_0x216102)[_0xdeb1('0xb')](function(_0xb45bbb){logger[_0xdeb1('0xc')](_0xdeb1('0xd'),_0x141953,'request\x20sent');logger[_0xdeb1('0xe')](_0xdeb1('0xf'),_0x141953,_0xdeb1('0x10'),JSON[_0xdeb1('0x11')](_0xb45bbb));if(_0xb45bbb[_0xdeb1('0x12')]){if(_0xb45bbb['error'][_0xdeb1('0x13')]===0x1f4){logger[_0xdeb1('0x12')](_0xdeb1('0xd'),_0x141953,_0xb45bbb['error'][_0xdeb1('0x14')]);return _0x311128(_0xb45bbb['error']['message']);}logger[_0xdeb1('0x12')](_0xdeb1('0xd'),_0x141953,_0xb45bbb['error'][_0xdeb1('0x14')]);return _0xb6dbcc(_0xb45bbb['error']['message']);}else{logger['info'](_0xdeb1('0xd'),_0x141953,_0xdeb1('0x10'));_0xb6dbcc(_0xb45bbb[_0xdeb1('0x15')][_0xdeb1('0x14')]);}})['catch'](function(_0xb634cf){logger['error'](_0xdeb1('0xd'),_0x141953,_0xb634cf);_0x311128(_0xb634cf);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index fcf3b3c..c820f00 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 _0x5aa1=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post'];(function(_0x18a4e6,_0x462cdb){var _0xa27e8=function(_0x53ebcc){while(--_0x53ebcc){_0x18a4e6['push'](_0x18a4e6['shift']());}};_0xa27e8(++_0x462cdb);}(_0x5aa1,0x158));var _0x15aa=function(_0xe9f7c5,_0x32475a){_0xe9f7c5=_0xe9f7c5-0x0;var _0xd133c0=_0x5aa1[_0xe9f7c5];return _0xd133c0;};'use strict';var multer=require(_0x15aa('0x0'));var util=require(_0x15aa('0x1'));var path=require(_0x15aa('0x2'));var timeout=require(_0x15aa('0x3'));var express=require(_0x15aa('0x4'));var router=express['Router']();var auth=require(_0x15aa('0x5'));var interaction=require(_0x15aa('0x6'));var config=require('../../config/environment');var controller=require(_0x15aa('0x7'));router[_0x15aa('0x8')]('/',auth[_0x15aa('0x9')](),controller[_0x15aa('0xa')]);router['get'](_0x15aa('0xb'),auth[_0x15aa('0x9')](),controller['show']);router[_0x15aa('0xc')]('/',auth[_0x15aa('0x9')](),controller['create']);router['put'](_0x15aa('0xb'),auth[_0x15aa('0x9')](),controller[_0x15aa('0xd')]);router[_0x15aa('0xe')]('/:id',auth[_0x15aa('0x9')](),controller[_0x15aa('0xf')]);module[_0x15aa('0x10')]=router; \ No newline at end of file +var _0x755b=['../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3c4f40,_0x302e0b){var _0x12032f=function(_0x159d92){while(--_0x159d92){_0x3c4f40['push'](_0x3c4f40['shift']());}};_0x12032f(++_0x302e0b);}(_0x755b,0x1c7));var _0xb755=function(_0x1e0188,_0x16401f){_0x1e0188=_0x1e0188-0x0;var _0x4c231c=_0x755b[_0x1e0188];return _0x4c231c;};'use strict';var multer=require(_0xb755('0x0'));var util=require('util');var path=require(_0xb755('0x1'));var timeout=require(_0xb755('0x2'));var express=require(_0xb755('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb755('0x4'));var controller=require(_0xb755('0x5'));router[_0xb755('0x6')]('/',auth[_0xb755('0x7')](),controller['index']);router[_0xb755('0x6')](_0xb755('0x8'),auth[_0xb755('0x7')](),controller[_0xb755('0x9')]);router[_0xb755('0xa')]('/',auth[_0xb755('0x7')](),controller[_0xb755('0xb')]);router[_0xb755('0xc')](_0xb755('0x8'),auth[_0xb755('0x7')](),controller[_0xb755('0xd')]);router[_0xb755('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb755('0xf')]);module[_0xb755('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 2b7275c..ab06223 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 _0x8e41=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e41,0xe2));var _0x18e4=function(_0xe56fcb,_0x42f237){_0xe56fcb=_0xe56fcb-0x0;var _0x6037c7=_0x8e41[_0xe56fcb];return _0x6037c7;};'use strict';var Sequelize=require(_0x18e4('0x0'));module[_0x18e4('0x1')]={'calldate':{'type':Sequelize[_0x18e4('0x2')],'allowNull':![],'defaultValue':_0x18e4('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x18e4('0x4')]},'dst':{'type':Sequelize[_0x18e4('0x4')]},'dcontext':{'type':Sequelize[_0x18e4('0x4')]},'channel':{'type':Sequelize[_0x18e4('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x18e4('0x4')]},'lastdata':{'type':Sequelize[_0x18e4('0x4')]},'duration':{'type':Sequelize[_0x18e4('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x18e4('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x18e4('0x4')]},'amaflags':{'type':Sequelize[_0x18e4('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x18e4('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x18e4('0x4')]},'sequence':{'type':Sequelize[_0x18e4('0x4')]},'peeraccount':{'type':Sequelize[_0x18e4('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6d12=['1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0x6d12,0x1ad));var _0x26d1=function(_0xcd07c,_0x8f566c){_0xcd07c=_0xcd07c-0x0;var _0xb99e27=_0x6d12[_0xcd07c];return _0xb99e27;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x26d1('0x0')},'clid':{'type':Sequelize[_0x26d1('0x1')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x26d1('0x1')]},'dcontext':{'type':Sequelize[_0x26d1('0x1')]},'channel':{'type':Sequelize[_0x26d1('0x1')]},'dstchannel':{'type':Sequelize[_0x26d1('0x1')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x26d1('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x26d1('0x1')]},'amaflags':{'type':Sequelize[_0x26d1('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x26d1('0x1')]},'userfield':{'type':Sequelize[_0x26d1('0x1')]},'uniqueid':{'type':Sequelize[_0x26d1('0x1')]},'linkedid':{'type':Sequelize[_0x26d1('0x1')]},'sequence':{'type':Sequelize[_0x26d1('0x1')]},'peeraccount':{'type':Sequelize[_0x26d1('0x1')]},'type':{'type':Sequelize[_0x26d1('0x1')]},'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 be17ec8..043e223 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 _0xacb8=['fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','end','error','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','params','merge','options','find','create','body','html-pdf','rimraf','zip-dir'];(function(_0x309aa4,_0x5ef52f){var _0x28a466=function(_0x5ba2dc){while(--_0x5ba2dc){_0x309aa4['push'](_0x309aa4['shift']());}};_0x28a466(++_0x5ef52f);}(_0xacb8,0x119));var _0x8acb=function(_0x1c06f4,_0x2feba6){_0x1c06f4=_0x1c06f4-0x0;var _0x1a727e=_0xacb8[_0x1c06f4];return _0x1a727e;};'use strict';var pdf=require(_0x8acb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8acb('0x1'));var zipdir=require(_0x8acb('0x2'));var jsonpatch=require(_0x8acb('0x3'));var rp=require('request-promise');var moment=require(_0x8acb('0x4'));var BPromise=require(_0x8acb('0x5'));var Mustache=require('mustache');var util=require(_0x8acb('0x6'));var path=require(_0x8acb('0x7'));var sox=require(_0x8acb('0x8'));var csv=require(_0x8acb('0x9'));var ejs=require(_0x8acb('0xa'));var fs=require('fs');var _=require(_0x8acb('0xb'));var squel=require('squel');var crypto=require(_0x8acb('0xc'));var jsforce=require(_0x8acb('0xd'));var deskjs=require(_0x8acb('0xe'));var toCsv=require(_0x8acb('0x9'));var querystring=require(_0x8acb('0xf'));var Papa=require(_0x8acb('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8acb('0x11'));var as=require(_0x8acb('0x12'));var hardwareService=require(_0x8acb('0x13'));var logger=require(_0x8acb('0x14'))('api');var utils=require(_0x8acb('0x15'));var config=require(_0x8acb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fb8e4,_0x414e09){_0x414e09=_0x414e09||0xcc;return function(_0x7a7daa){if(_0x7a7daa){return _0x2fb8e4[_0x8acb('0x17')](_0x414e09);}return _0x2fb8e4[_0x8acb('0x18')](_0x414e09)['end']();};}function respondWithResult(_0x31fac7,_0x402959){_0x402959=_0x402959||0xc8;return function(_0x2b0fd4){if(_0x2b0fd4){return _0x31fac7[_0x8acb('0x18')](_0x402959)[_0x8acb('0x19')](_0x2b0fd4);}};}function respondWithFilteredResult(_0x13e779,_0x580151){return function(_0x4525b6){if(_0x4525b6){var _0x20b809=_0x4525b6[_0x8acb('0x1a')],_0x1fa864=_0x580151[_0x8acb('0x1b')],_0x924d47=_0x580151[_0x8acb('0x1b')]+_0x580151[_0x8acb('0x1c')],_0x1c1740;if(_0x924d47>=_0x20b809){_0x924d47=_0x20b809;_0x1c1740=0xc8;}else{_0x1c1740=0xce;}_0x13e779['status'](_0x1c1740);return _0x13e779[_0x8acb('0x1d')](_0x8acb('0x1e'),_0x1fa864+'-'+_0x924d47+'/'+_0x20b809)['json'](_0x4525b6);}return null;};}function patchUpdates(_0x4d6d45){return function(_0x2c2a74){try{jsonpatch['apply'](_0x2c2a74,_0x4d6d45,!![]);}catch(_0xb2630){return BPromise[_0x8acb('0x1f')](_0xb2630);}return _0x2c2a74['save']();};}function saveUpdates(_0x23569f,_0x926cd7){return function(_0x14865c){if(_0x14865c){return _0x14865c[_0x8acb('0x20')](_0x23569f)[_0x8acb('0x21')](function(_0x43b59b){return _0x43b59b;});}return null;};}function removeEntity(_0x284563,_0x52f6c3){return function(_0x494bff){if(_0x494bff){return _0x494bff[_0x8acb('0x22')]()[_0x8acb('0x21')](function(){_0x284563[_0x8acb('0x18')](0xcc)[_0x8acb('0x23')]();});}};}function handleEntityNotFound(_0x344bde,_0x3db998){return function(_0x38bb75){if(!_0x38bb75){_0x344bde[_0x8acb('0x17')](0x194);}return _0x38bb75;};}function handleError(_0x5238ba,_0x103793){_0x103793=_0x103793||0x1f4;return function(_0x5de59f){logger[_0x8acb('0x24')](_0x5de59f['stack']);if(_0x5de59f[_0x8acb('0x25')]){delete _0x5de59f[_0x8acb('0x25')];}_0x5238ba['status'](_0x103793)[_0x8acb('0x26')](_0x5de59f);};}exports['index']=function(_0xa0ae6d,_0x25e4ec){var _0x9c6ae1={},_0x30edf2={},_0x14954d={'count':0x0,'rows':[]};var _0x5d42d5=_[_0x8acb('0x27')](db[_0x8acb('0x28')][_0x8acb('0x29')],function(_0x31770d){return{'name':_0x31770d[_0x8acb('0x2a')],'type':_0x31770d[_0x8acb('0x2b')][_0x8acb('0x2c')]};});_0x30edf2[_0x8acb('0x2d')]=_[_0x8acb('0x27')](_0x5d42d5,'name');_0x30edf2[_0x8acb('0x2e')]=_[_0x8acb('0x2f')](_0xa0ae6d[_0x8acb('0x2e')]);_0x30edf2[_0x8acb('0x30')]=_[_0x8acb('0x31')](_0x30edf2[_0x8acb('0x2d')],_0x30edf2[_0x8acb('0x2e')]);_0x9c6ae1[_0x8acb('0x32')]=_[_0x8acb('0x31')](_0x30edf2['model'],qs[_0x8acb('0x33')](_0xa0ae6d['query']['fields']));_0x9c6ae1[_0x8acb('0x32')]=_0x9c6ae1['attributes'][_0x8acb('0x34')]?_0x9c6ae1[_0x8acb('0x32')]:_0x30edf2[_0x8acb('0x2d')];if(!_0xa0ae6d[_0x8acb('0x2e')][_0x8acb('0x35')](_0x8acb('0x36'))){_0x9c6ae1[_0x8acb('0x1c')]=qs[_0x8acb('0x1c')](_0xa0ae6d[_0x8acb('0x2e')][_0x8acb('0x1c')]);_0x9c6ae1[_0x8acb('0x1b')]=qs[_0x8acb('0x1b')](_0xa0ae6d[_0x8acb('0x2e')][_0x8acb('0x1b')]);}_0x9c6ae1[_0x8acb('0x37')]=qs[_0x8acb('0x38')](_0xa0ae6d[_0x8acb('0x2e')][_0x8acb('0x38')]);_0x9c6ae1[_0x8acb('0x39')]=qs[_0x8acb('0x30')](_[_0x8acb('0x3a')](_0xa0ae6d[_0x8acb('0x2e')],_0x30edf2['filters']));if(_0xa0ae6d['query'][_0x8acb('0x3b')]){_0x9c6ae1[_0x8acb('0x39')]=_['merge'](_0x9c6ae1[_0x8acb('0x39')],{'$or':_['map'](_0x5d42d5,function(_0xf73636){if(_0xf73636[_0x8acb('0x2b')]!==_0x8acb('0x3c')){var _0x1a7ac3={};_0x1a7ac3[_0xf73636[_0x8acb('0x25')]]={'$like':'%'+_0xa0ae6d[_0x8acb('0x2e')][_0x8acb('0x3b')]+'%'};return _0x1a7ac3;}})});}_0x9c6ae1=_['merge']({},_0x9c6ae1,_0xa0ae6d['options']);var _0x5676e7={'where':_0x9c6ae1[_0x8acb('0x39')]};return db[_0x8acb('0x28')][_0x8acb('0x1a')](_0x5676e7)['then'](function(_0x51611f){_0x14954d[_0x8acb('0x1a')]=_0x51611f;if(_0xa0ae6d[_0x8acb('0x2e')][_0x8acb('0x3d')]){_0x9c6ae1['include']=[{'all':!![]}];}return db[_0x8acb('0x28')][_0x8acb('0x3e')](_0x9c6ae1);})[_0x8acb('0x21')](function(_0x557c36){_0x14954d[_0x8acb('0x3f')]=_0x557c36;return _0x14954d;})[_0x8acb('0x21')](respondWithFilteredResult(_0x25e4ec,_0x9c6ae1))[_0x8acb('0x40')](handleError(_0x25e4ec,null));};exports['show']=function(_0x20ccf8,_0x3355ea){var _0x46a11e={'raw':!![],'where':{'id':_0x20ccf8[_0x8acb('0x41')]['id']}},_0x4b0fdf={};_0x4b0fdf['model']=_[_0x8acb('0x2f')](db[_0x8acb('0x28')]['rawAttributes']);_0x4b0fdf[_0x8acb('0x2e')]=_[_0x8acb('0x2f')](_0x20ccf8[_0x8acb('0x2e')]);_0x4b0fdf[_0x8acb('0x30')]=_['intersection'](_0x4b0fdf[_0x8acb('0x2d')],_0x4b0fdf['query']);_0x46a11e[_0x8acb('0x32')]=_['intersection'](_0x4b0fdf[_0x8acb('0x2d')],qs[_0x8acb('0x33')](_0x20ccf8['query'][_0x8acb('0x33')]));_0x46a11e[_0x8acb('0x32')]=_0x46a11e[_0x8acb('0x32')][_0x8acb('0x34')]?_0x46a11e['attributes']:_0x4b0fdf[_0x8acb('0x2d')];if(_0x20ccf8[_0x8acb('0x2e')][_0x8acb('0x3d')]){_0x46a11e['include']=[{'all':!![]}];}_0x46a11e=_[_0x8acb('0x42')]({},_0x46a11e,_0x20ccf8[_0x8acb('0x43')]);return db[_0x8acb('0x28')][_0x8acb('0x44')](_0x46a11e)[_0x8acb('0x21')](handleEntityNotFound(_0x3355ea,null))[_0x8acb('0x21')](respondWithResult(_0x3355ea,null))[_0x8acb('0x40')](handleError(_0x3355ea,null));};exports['create']=function(_0x11f260,_0x479ece){return db[_0x8acb('0x28')][_0x8acb('0x45')](_0x11f260[_0x8acb('0x46')],{})['then'](respondWithResult(_0x479ece,0xc9))[_0x8acb('0x40')](handleError(_0x479ece,null));};exports[_0x8acb('0x20')]=function(_0x5582bf,_0x18f702){if(_0x5582bf[_0x8acb('0x46')]['id']){delete _0x5582bf[_0x8acb('0x46')]['id'];}return db[_0x8acb('0x28')][_0x8acb('0x44')]({'where':{'id':_0x5582bf[_0x8acb('0x41')]['id']}})['then'](handleEntityNotFound(_0x18f702,null))[_0x8acb('0x21')](saveUpdates(_0x5582bf['body'],null))[_0x8acb('0x21')](respondWithResult(_0x18f702,null))[_0x8acb('0x40')](handleError(_0x18f702,null));};exports[_0x8acb('0x22')]=function(_0x26cb87,_0x19e70b){return db[_0x8acb('0x28')][_0x8acb('0x44')]({'where':{'id':_0x26cb87[_0x8acb('0x41')]['id']}})[_0x8acb('0x21')](handleEntityNotFound(_0x19e70b,null))[_0x8acb('0x21')](removeEntity(_0x19e70b,null))[_0x8acb('0x40')](handleError(_0x19e70b,null));};exports['describe']=function(_0x55ba2d,_0x388b76){return db[_0x8acb('0x28')]['describe']()[_0x8acb('0x21')](respondWithResult(_0x388b76,null))[_0x8acb('0x40')](handleError(_0x388b76,null));}; \ No newline at end of file +var _0x120b=['send','index','map','Cdr','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','show','params','rawAttributes','include','catch','create','body','destroy','describe','html-pdf','eml-format','zip-dir','moment','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','stack','name'];(function(_0x54c6ce,_0x5b6dbc){var _0x385155=function(_0x3b8ba1){while(--_0x3b8ba1){_0x54c6ce['push'](_0x54c6ce['shift']());}};_0x385155(++_0x5b6dbc);}(_0x120b,0x180));var _0xb120=function(_0x41b436,_0xb1121b){_0x41b436=_0x41b436-0x0;var _0x25e2d0=_0x120b[_0x41b436];return _0x25e2d0;};'use strict';var pdf=require(_0xb120('0x0'));var emlformat=require(_0xb120('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb120('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb120('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb120('0x4'));var util=require(_0xb120('0x5'));var path=require('path');var sox=require(_0xb120('0x6'));var csv=require('to-csv');var ejs=require(_0xb120('0x7'));var fs=require('fs');var _=require(_0xb120('0x8'));var squel=require(_0xb120('0x9'));var crypto=require(_0xb120('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb120('0xb'));var toCsv=require(_0xb120('0xc'));var querystring=require(_0xb120('0xd'));var Papa=require(_0xb120('0xe'));var Redis=require('ioredis');var authService=require(_0xb120('0xf'));var qs=require(_0xb120('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb120('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xb120('0x12'));var config=require(_0xb120('0x13'));var db=require(_0xb120('0x14'))['db'];function respondWithStatusCode(_0x30da1d,_0x21ca64){_0x21ca64=_0x21ca64||0xcc;return function(_0x967a75){if(_0x967a75){return _0x30da1d[_0xb120('0x15')](_0x21ca64);}return _0x30da1d[_0xb120('0x16')](_0x21ca64)[_0xb120('0x17')]();};}function respondWithResult(_0x2794bc,_0x5a3851){_0x5a3851=_0x5a3851||0xc8;return function(_0x12262){if(_0x12262){return _0x2794bc[_0xb120('0x16')](_0x5a3851)[_0xb120('0x18')](_0x12262);}};}function respondWithFilteredResult(_0x33f3db,_0x2dd69b){return function(_0x3a3dd9){if(_0x3a3dd9){var _0x294d1b=_0x3a3dd9[_0xb120('0x19')],_0x546b36=_0x2dd69b[_0xb120('0x1a')],_0x1da8c1=_0x2dd69b[_0xb120('0x1a')]+_0x2dd69b[_0xb120('0x1b')],_0x4ace12;if(_0x1da8c1>=_0x294d1b){_0x1da8c1=_0x294d1b;_0x4ace12=0xc8;}else{_0x4ace12=0xce;}_0x33f3db[_0xb120('0x16')](_0x4ace12);return _0x33f3db['set'](_0xb120('0x1c'),_0x546b36+'-'+_0x1da8c1+'/'+_0x294d1b)[_0xb120('0x18')](_0x3a3dd9);}return null;};}function patchUpdates(_0x3996d8){return function(_0x3e1405){try{jsonpatch[_0xb120('0x1d')](_0x3e1405,_0x3996d8,!![]);}catch(_0x2547c8){return BPromise[_0xb120('0x1e')](_0x2547c8);}return _0x3e1405[_0xb120('0x1f')]();};}function saveUpdates(_0x19a32d,_0x490699){return function(_0x27afd3){if(_0x27afd3){return _0x27afd3[_0xb120('0x20')](_0x19a32d)['then'](function(_0x29a02d){return _0x29a02d;});}return null;};}function removeEntity(_0x2bbc9b,_0x17843f){return function(_0x1d3a15){if(_0x1d3a15){return _0x1d3a15['destroy']()[_0xb120('0x21')](function(){_0x2bbc9b[_0xb120('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x62bed9,_0x109806){return function(_0x48bcf4){if(!_0x48bcf4){_0x62bed9['sendStatus'](0x194);}return _0x48bcf4;};}function handleError(_0x585139,_0x2244aa){_0x2244aa=_0x2244aa||0x1f4;return function(_0x534bf7){logger['error'](_0x534bf7[_0xb120('0x22')]);if(_0x534bf7[_0xb120('0x23')]){delete _0x534bf7['name'];}_0x585139[_0xb120('0x16')](_0x2244aa)[_0xb120('0x24')](_0x534bf7);};}exports[_0xb120('0x25')]=function(_0x207049,_0x31471a){var _0x305586={},_0x5a7b95={},_0x2af9f0={'count':0x0,'rows':[]};var _0x232d00=_[_0xb120('0x26')](db[_0xb120('0x27')]['rawAttributes'],function(_0xac2206){return{'name':_0xac2206[_0xb120('0x28')],'type':_0xac2206[_0xb120('0x29')]['key']};});_0x5a7b95['model']=_['map'](_0x232d00,_0xb120('0x23'));_0x5a7b95[_0xb120('0x2a')]=_[_0xb120('0x2b')](_0x207049[_0xb120('0x2a')]);_0x5a7b95[_0xb120('0x2c')]=_[_0xb120('0x2d')](_0x5a7b95['model'],_0x5a7b95[_0xb120('0x2a')]);_0x305586[_0xb120('0x2e')]=_[_0xb120('0x2d')](_0x5a7b95[_0xb120('0x2f')],qs[_0xb120('0x30')](_0x207049[_0xb120('0x2a')][_0xb120('0x30')]));_0x305586[_0xb120('0x2e')]=_0x305586['attributes'][_0xb120('0x31')]?_0x305586[_0xb120('0x2e')]:_0x5a7b95[_0xb120('0x2f')];if(!_0x207049[_0xb120('0x2a')]['hasOwnProperty'](_0xb120('0x32'))){_0x305586['limit']=qs['limit'](_0x207049[_0xb120('0x2a')][_0xb120('0x1b')]);_0x305586[_0xb120('0x1a')]=qs['offset'](_0x207049[_0xb120('0x2a')][_0xb120('0x1a')]);}_0x305586[_0xb120('0x33')]=qs[_0xb120('0x34')](_0x207049[_0xb120('0x2a')][_0xb120('0x34')]);_0x305586[_0xb120('0x35')]=qs[_0xb120('0x2c')](_[_0xb120('0x36')](_0x207049['query'],_0x5a7b95['filters']));if(_0x207049['query']['filter']){_0x305586[_0xb120('0x35')]=_[_0xb120('0x37')](_0x305586[_0xb120('0x35')],{'$or':_[_0xb120('0x26')](_0x232d00,function(_0x591cd0){if(_0x591cd0[_0xb120('0x29')]!==_0xb120('0x38')){var _0x17a0d2={};_0x17a0d2[_0x591cd0[_0xb120('0x23')]]={'$like':'%'+_0x207049['query'][_0xb120('0x39')]+'%'};return _0x17a0d2;}})});}_0x305586=_[_0xb120('0x37')]({},_0x305586,_0x207049[_0xb120('0x3a')]);var _0x184dc6={'where':_0x305586[_0xb120('0x35')]};return db[_0xb120('0x27')]['count'](_0x184dc6)[_0xb120('0x21')](function(_0x1145f2){_0x2af9f0['count']=_0x1145f2;if(_0x207049['query'][_0xb120('0x3b')]){_0x305586['include']=[{'all':!![]}];}return db[_0xb120('0x27')]['findAll'](_0x305586);})['then'](function(_0x547ecf){_0x2af9f0[_0xb120('0x3c')]=_0x547ecf;return _0x2af9f0;})[_0xb120('0x21')](respondWithFilteredResult(_0x31471a,_0x305586))['catch'](handleError(_0x31471a,null));};exports[_0xb120('0x3d')]=function(_0x4f3752,_0x35be2d){var _0x504200={'raw':!![],'where':{'id':_0x4f3752[_0xb120('0x3e')]['id']}},_0x50a365={};_0x50a365[_0xb120('0x2f')]=_['keys'](db[_0xb120('0x27')][_0xb120('0x3f')]);_0x50a365['query']=_['keys'](_0x4f3752[_0xb120('0x2a')]);_0x50a365['filters']=_[_0xb120('0x2d')](_0x50a365['model'],_0x50a365[_0xb120('0x2a')]);_0x504200[_0xb120('0x2e')]=_[_0xb120('0x2d')](_0x50a365[_0xb120('0x2f')],qs[_0xb120('0x30')](_0x4f3752[_0xb120('0x2a')][_0xb120('0x30')]));_0x504200[_0xb120('0x2e')]=_0x504200['attributes'][_0xb120('0x31')]?_0x504200[_0xb120('0x2e')]:_0x50a365[_0xb120('0x2f')];if(_0x4f3752[_0xb120('0x2a')][_0xb120('0x3b')]){_0x504200[_0xb120('0x40')]=[{'all':!![]}];}_0x504200=_[_0xb120('0x37')]({},_0x504200,_0x4f3752[_0xb120('0x3a')]);return db[_0xb120('0x27')]['find'](_0x504200)[_0xb120('0x21')](handleEntityNotFound(_0x35be2d,null))[_0xb120('0x21')](respondWithResult(_0x35be2d,null))[_0xb120('0x41')](handleError(_0x35be2d,null));};exports[_0xb120('0x42')]=function(_0x4f1e92,_0x4d3db7){return db[_0xb120('0x27')][_0xb120('0x42')](_0x4f1e92[_0xb120('0x43')],{})[_0xb120('0x21')](respondWithResult(_0x4d3db7,0xc9))[_0xb120('0x41')](handleError(_0x4d3db7,null));};exports['update']=function(_0x21479f,_0x1d6243){if(_0x21479f['body']['id']){delete _0x21479f[_0xb120('0x43')]['id'];}return db[_0xb120('0x27')]['find']({'where':{'id':_0x21479f[_0xb120('0x3e')]['id']}})[_0xb120('0x21')](handleEntityNotFound(_0x1d6243,null))['then'](saveUpdates(_0x21479f[_0xb120('0x43')],null))[_0xb120('0x21')](respondWithResult(_0x1d6243,null))[_0xb120('0x41')](handleError(_0x1d6243,null));};exports[_0xb120('0x44')]=function(_0x205ef8,_0x2e21f4){return db['Cdr']['find']({'where':{'id':_0x205ef8[_0xb120('0x3e')]['id']}})[_0xb120('0x21')](handleEntityNotFound(_0x2e21f4,null))[_0xb120('0x21')](removeEntity(_0x2e21f4,null))[_0xb120('0x41')](handleError(_0x2e21f4,null));};exports[_0xb120('0x45')]=function(_0x4ab095,_0x21dc38){return db[_0xb120('0x27')][_0xb120('0x45')]()[_0xb120('0x21')](respondWithResult(_0x21dc38,null))[_0xb120('0x41')](handleError(_0x21dc38,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 8c6e63d..ccb53fa 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 _0x1883=['dst','src','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition'];(function(_0x19c821,_0x74eeec){var _0x4e0faf=function(_0x415170){while(--_0x415170){_0x19c821['push'](_0x19c821['shift']());}};_0x4e0faf(++_0x74eeec);}(_0x1883,0xab));var _0x3188=function(_0x50d5ca,_0x445326){_0x50d5ca=_0x50d5ca-0x0;var _0x3f1615=_0x1883[_0x50d5ca];return _0x3f1615;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x3188('0xf')]},{'name':_0x3188('0x10'),'fields':['calldate']},{'name':_0x3188('0x11'),'fields':['disposition']},{'name':_0x3188('0x12'),'fields':[_0x3188('0x12')]},{'name':_0x3188('0x13'),'fields':[_0x3188('0x13')]},{'name':'uniqueid','fields':[_0x3188('0x14')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3f8a=['define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4be7a0,_0xfb3d5b){var _0x55482b=function(_0x2da935){while(--_0x2da935){_0x4be7a0['push'](_0x4be7a0['shift']());}};_0x55482b(++_0xfb3d5b);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2fde12,_0x32874){_0x2fde12=_0x2fde12-0x0;var _0x129efe=_0x3f8a[_0x2fde12];return _0x129efe;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));module[_0xa3f8('0xa')]=function(_0x471464,_0x1f160a){return _0x471464[_0xa3f8('0xb')](_0xa3f8('0xc'),attributes,{'tableName':_0xa3f8('0xd'),'paranoid':![],'indexes':[{'name':_0xa3f8('0xe'),'fields':[_0xa3f8('0xe')]},{'name':_0xa3f8('0xf'),'fields':[_0xa3f8('0xf')]},{'name':_0xa3f8('0x10'),'fields':['disposition']},{'name':_0xa3f8('0x11'),'fields':[_0xa3f8('0x11')]},{'name':_0xa3f8('0x12'),'fields':[_0xa3f8('0x12')]},{'name':'uniqueid','fields':[_0xa3f8('0x13')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 71d352d..de5b731 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 _0xd66a=['../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','Cdr,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3ec5a3,_0x40cac0){var _0x3bc8dc=function(_0x240980){while(--_0x240980){_0x3ec5a3['push'](_0x3ec5a3['shift']());}};_0x3bc8dc(++_0x40cac0);}(_0xd66a,0x114));var _0xad66=function(_0x280bef,_0x5e1bd3){_0x280bef=_0x280bef-0x0;var _0x56dc85=_0xd66a[_0x280bef];return _0x56dc85;};'use strict';var _=require(_0xad66('0x0'));var util=require(_0xad66('0x1'));var moment=require(_0xad66('0x2'));var BPromise=require(_0xad66('0x3'));var rs=require(_0xad66('0x4'));var fs=require('fs');var Redis=require(_0xad66('0x5'));var db=require(_0xad66('0x6'))['db'];var utils=require(_0xad66('0x7'));var logger=require(_0xad66('0x8'))(_0xad66('0x9'));var config=require(_0xad66('0xa'));var jayson=require(_0xad66('0xb'));var client=jayson[_0xad66('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fd2ec,_0x62bcb6,_0x4fde54){return new BPromise(function(_0x4787ec,_0x3bde50){return client[_0xad66('0xd')](_0x4fd2ec,_0x4fde54)[_0xad66('0xe')](function(_0x1fe6fd){logger['info']('Cdr,\x20%s,\x20%s',_0x62bcb6,_0xad66('0xf'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x62bcb6,'request\x20sent',JSON[_0xad66('0x10')](_0x1fe6fd));if(_0x1fe6fd[_0xad66('0x11')]){if(_0x1fe6fd[_0xad66('0x11')]['code']===0x1f4){logger[_0xad66('0x11')](_0xad66('0x12'),_0x62bcb6,_0x1fe6fd[_0xad66('0x11')][_0xad66('0x13')]);return _0x3bde50(_0x1fe6fd[_0xad66('0x11')][_0xad66('0x13')]);}logger[_0xad66('0x11')](_0xad66('0x12'),_0x62bcb6,_0x1fe6fd['error']['message']);return _0x4787ec(_0x1fe6fd['error'][_0xad66('0x13')]);}else{logger[_0xad66('0x14')](_0xad66('0x12'),_0x62bcb6,'request\x20sent');_0x4787ec(_0x1fe6fd[_0xad66('0x15')][_0xad66('0x13')]);}})['catch'](function(_0x157957){logger[_0xad66('0x11')](_0xad66('0x12'),_0x62bcb6,_0x157957);_0x3bde50(_0x157957);});});} \ No newline at end of file +var _0x1c2f=['error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x1c2f,0xf4));var _0xf1c2=function(_0x4ed2d2,_0x26f3d5){_0x4ed2d2=_0x4ed2d2-0x0;var _0x36e203=_0x1c2f[_0x4ed2d2];return _0x36e203;};'use strict';var _=require(_0xf1c2('0x0'));var util=require(_0xf1c2('0x1'));var moment=require(_0xf1c2('0x2'));var BPromise=require(_0xf1c2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf1c2('0x4'));var db=require(_0xf1c2('0x5'))['db'];var utils=require(_0xf1c2('0x6'));var logger=require(_0xf1c2('0x7'))(_0xf1c2('0x8'));var config=require(_0xf1c2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf1c2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2503af,_0x489f55,_0x5edbfd){return new BPromise(function(_0x25000c,_0x51ec4c){return client[_0xf1c2('0xb')](_0x2503af,_0x5edbfd)[_0xf1c2('0xc')](function(_0x1ac2d6){logger[_0xf1c2('0xd')](_0xf1c2('0xe'),_0x489f55,_0xf1c2('0xf'));logger[_0xf1c2('0x10')](_0xf1c2('0x11'),_0x489f55,_0xf1c2('0xf'),JSON[_0xf1c2('0x12')](_0x1ac2d6));if(_0x1ac2d6['error']){if(_0x1ac2d6['error'][_0xf1c2('0x13')]===0x1f4){logger[_0xf1c2('0x14')]('Cdr,\x20%s,\x20%s',_0x489f55,_0x1ac2d6[_0xf1c2('0x14')][_0xf1c2('0x15')]);return _0x51ec4c(_0x1ac2d6[_0xf1c2('0x14')][_0xf1c2('0x15')]);}logger[_0xf1c2('0x14')](_0xf1c2('0xe'),_0x489f55,_0x1ac2d6[_0xf1c2('0x14')]['message']);return _0x25000c(_0x1ac2d6[_0xf1c2('0x14')][_0xf1c2('0x15')]);}else{logger[_0xf1c2('0xd')](_0xf1c2('0xe'),_0x489f55,_0xf1c2('0xf'));_0x25000c(_0x1ac2d6[_0xf1c2('0x16')][_0xf1c2('0x15')]);}})[_0xf1c2('0x17')](function(_0x53b322){logger[_0xf1c2('0x14')]('Cdr,\x20%s,\x20%s',_0x489f55,_0x53b322);_0x51ec4c(_0x53b322);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 704cd89..df91b9a 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 _0xfa1f=['get','/:id','post','create','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cdr.controller','isAuthenticated','index','/describe'];(function(_0x2cc437,_0x1b4c3f){var _0x2e163a=function(_0x2db7dc){while(--_0x2db7dc){_0x2cc437['push'](_0x2cc437['shift']());}};_0x2e163a(++_0x1b4c3f);}(_0xfa1f,0xf5));var _0xffa1=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0xfa1f[_0x553a87];return _0x12d1e6;};'use strict';var multer=require('multer');var util=require(_0xffa1('0x0'));var path=require(_0xffa1('0x1'));var timeout=require(_0xffa1('0x2'));var express=require(_0xffa1('0x3'));var router=express[_0xffa1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xffa1('0x5'));var config=require(_0xffa1('0x6'));var controller=require(_0xffa1('0x7'));router['get']('/',auth[_0xffa1('0x8')](),controller[_0xffa1('0x9')]);router['get'](_0xffa1('0xa'),auth[_0xffa1('0x8')](),controller['describe']);router[_0xffa1('0xb')](_0xffa1('0xc'),auth[_0xffa1('0x8')](),controller['show']);router[_0xffa1('0xd')]('/',auth[_0xffa1('0x8')](),controller[_0xffa1('0xe')]);router['put']('/:id',auth[_0xffa1('0x8')](),controller['update']);router[_0xffa1('0xf')](_0xffa1('0xc'),auth[_0xffa1('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9a16=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy'];(function(_0xa42c63,_0x2074bc){var _0xcbd56b=function(_0x16958a){while(--_0x16958a){_0xa42c63['push'](_0xa42c63['shift']());}};_0xcbd56b(++_0x2074bc);}(_0x9a16,0x127));var _0x69a1=function(_0x48c02d,_0x53b0a6){_0x48c02d=_0x48c02d-0x0;var _0x3249a3=_0x9a16[_0x48c02d];return _0x3249a3;};'use strict';var multer=require(_0x69a1('0x0'));var util=require(_0x69a1('0x1'));var path=require(_0x69a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x69a1('0x3'));var router=express[_0x69a1('0x4')]();var auth=require(_0x69a1('0x5'));var interaction=require(_0x69a1('0x6'));var config=require(_0x69a1('0x7'));var controller=require(_0x69a1('0x8'));router[_0x69a1('0x9')]('/',auth[_0x69a1('0xa')](),controller[_0x69a1('0xb')]);router[_0x69a1('0x9')](_0x69a1('0xc'),auth[_0x69a1('0xa')](),controller[_0x69a1('0xd')]);router[_0x69a1('0x9')](_0x69a1('0xe'),auth[_0x69a1('0xa')](),controller['show']);router[_0x69a1('0xf')]('/',auth[_0x69a1('0xa')](),controller[_0x69a1('0x10')]);router[_0x69a1('0x11')](_0x69a1('0xe'),auth[_0x69a1('0xa')](),controller[_0x69a1('0x12')]);router['delete']('/:id',auth[_0x69a1('0xa')](),controller[_0x69a1('0x13')]);module[_0x69a1('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 7281bc5..8f42177 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 _0x3403=['exports','INTEGER','noop','STRING','sequelize'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x3403,0x108));var _0x3340=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3403[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x3340('0x0'));module[_0x3340('0x1')]={'priority':{'type':Sequelize[_0x3340('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3340('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3340('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xda69=['exports','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xda69,0x1e5));var _0x9da6=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0xda69[_0x58c20f];return _0x3b0318;};'use strict';var Sequelize=require(_0x9da6('0x0'));module[_0x9da6('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9da6('0x2')},'appdata':{'type':Sequelize[_0x9da6('0x3')]()},'description':{'type':Sequelize[_0x9da6('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9da6('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index b31b85c..9f7721b 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 _0x29fc=['sendStatus','end','status','json','count','offset','limit','set','save','then','error','name','show','params','keys','ChatApplication','query','filters','model','attributes','intersection','fields','includeAll','include','merge','options','find','catch','update','body','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x116b44,_0x4f6a64){var _0x36f0a0=function(_0x3d2f15){while(--_0x3d2f15){_0x116b44['push'](_0x116b44['shift']());}};_0x36f0a0(++_0x4f6a64);}(_0x29fc,0x17b));var _0xc29f=function(_0x29e702,_0x5950e4){_0x29e702=_0x29e702-0x0;var _0xa76fbf=_0x29fc[_0x29e702];return _0xa76fbf;};'use strict';var pdf=require(_0xc29f('0x0'));var emlformat=require(_0xc29f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc29f('0x2'));var jsonpatch=require(_0xc29f('0x3'));var rp=require(_0xc29f('0x4'));var moment=require(_0xc29f('0x5'));var BPromise=require(_0xc29f('0x6'));var Mustache=require(_0xc29f('0x7'));var util=require(_0xc29f('0x8'));var path=require(_0xc29f('0x9'));var sox=require('sox');var csv=require(_0xc29f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc29f('0xb'));var squel=require(_0xc29f('0xc'));var crypto=require(_0xc29f('0xd'));var jsforce=require(_0xc29f('0xe'));var deskjs=require(_0xc29f('0xf'));var toCsv=require(_0xc29f('0xa'));var querystring=require(_0xc29f('0x10'));var Papa=require(_0xc29f('0x11'));var Redis=require(_0xc29f('0x12'));var authService=require(_0xc29f('0x13'));var qs=require(_0xc29f('0x14'));var as=require(_0xc29f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc29f('0x16'))(_0xc29f('0x17'));var utils=require(_0xc29f('0x18'));var config=require(_0xc29f('0x19'));var db=require(_0xc29f('0x1a'))['db'];function respondWithStatusCode(_0x2b2884,_0x8fcb1){_0x8fcb1=_0x8fcb1||0xcc;return function(_0x30ffdf){if(_0x30ffdf){return _0x2b2884[_0xc29f('0x1b')](_0x8fcb1);}return _0x2b2884['status'](_0x8fcb1)[_0xc29f('0x1c')]();};}function respondWithResult(_0x49ad89,_0x35be61){_0x35be61=_0x35be61||0xc8;return function(_0x205047){if(_0x205047){return _0x49ad89[_0xc29f('0x1d')](_0x35be61)[_0xc29f('0x1e')](_0x205047);}};}function respondWithFilteredResult(_0x383891,_0x55f9f1){return function(_0x442385){if(_0x442385){var _0x4e88d0=_0x442385[_0xc29f('0x1f')],_0x1f992b=_0x55f9f1['offset'],_0x49de41=_0x55f9f1[_0xc29f('0x20')]+_0x55f9f1[_0xc29f('0x21')],_0x40acdb;if(_0x49de41>=_0x4e88d0){_0x49de41=_0x4e88d0;_0x40acdb=0xc8;}else{_0x40acdb=0xce;}_0x383891['status'](_0x40acdb);return _0x383891[_0xc29f('0x22')]('Content-Range',_0x1f992b+'-'+_0x49de41+'/'+_0x4e88d0)[_0xc29f('0x1e')](_0x442385);}return null;};}function patchUpdates(_0x5804e1){return function(_0x6fe7c2){try{jsonpatch['apply'](_0x6fe7c2,_0x5804e1,!![]);}catch(_0x35c532){return BPromise['reject'](_0x35c532);}return _0x6fe7c2[_0xc29f('0x23')]();};}function saveUpdates(_0x115d90,_0x5f50fa){return function(_0x2ee913){if(_0x2ee913){return _0x2ee913['update'](_0x115d90)[_0xc29f('0x24')](function(_0x44a794){return _0x44a794;});}return null;};}function removeEntity(_0x1cb299,_0x30876e){return function(_0x4807cc){if(_0x4807cc){return _0x4807cc['destroy']()[_0xc29f('0x24')](function(){_0x1cb299[_0xc29f('0x1d')](0xcc)[_0xc29f('0x1c')]();});}};}function handleEntityNotFound(_0x473a4e,_0x514af3){return function(_0x1d6c54){if(!_0x1d6c54){_0x473a4e[_0xc29f('0x1b')](0x194);}return _0x1d6c54;};}function handleError(_0x2f88fc,_0x21c396){_0x21c396=_0x21c396||0x1f4;return function(_0x52f758){logger[_0xc29f('0x25')](_0x52f758['stack']);if(_0x52f758[_0xc29f('0x26')]){delete _0x52f758[_0xc29f('0x26')];}_0x2f88fc['status'](_0x21c396)['send'](_0x52f758);};}exports[_0xc29f('0x27')]=function(_0x54ce53,_0x3f818a){var _0x3e6250={'raw':!![],'where':{'id':_0x54ce53[_0xc29f('0x28')]['id']}},_0x3f0100={};_0x3f0100['model']=_[_0xc29f('0x29')](db[_0xc29f('0x2a')]['rawAttributes']);_0x3f0100[_0xc29f('0x2b')]=_[_0xc29f('0x29')](_0x54ce53[_0xc29f('0x2b')]);_0x3f0100[_0xc29f('0x2c')]=_['intersection'](_0x3f0100[_0xc29f('0x2d')],_0x3f0100['query']);_0x3e6250[_0xc29f('0x2e')]=_[_0xc29f('0x2f')](_0x3f0100[_0xc29f('0x2d')],qs[_0xc29f('0x30')](_0x54ce53[_0xc29f('0x2b')][_0xc29f('0x30')]));_0x3e6250['attributes']=_0x3e6250['attributes']['length']?_0x3e6250[_0xc29f('0x2e')]:_0x3f0100['model'];if(_0x54ce53[_0xc29f('0x2b')][_0xc29f('0x31')]){_0x3e6250[_0xc29f('0x32')]=[{'all':!![]}];}_0x3e6250=_[_0xc29f('0x33')]({},_0x3e6250,_0x54ce53[_0xc29f('0x34')]);return db[_0xc29f('0x2a')][_0xc29f('0x35')](_0x3e6250)['then'](handleEntityNotFound(_0x3f818a,null))['then'](respondWithResult(_0x3f818a,null))[_0xc29f('0x36')](handleError(_0x3f818a,null));};exports[_0xc29f('0x37')]=function(_0xb75e3e,_0x37c97d){if(_0xb75e3e[_0xc29f('0x38')]['id']){delete _0xb75e3e[_0xc29f('0x38')]['id'];}return db[_0xc29f('0x2a')][_0xc29f('0x35')]({'where':{'id':_0xb75e3e[_0xc29f('0x28')]['id']}})[_0xc29f('0x24')](handleEntityNotFound(_0x37c97d,null))['then'](saveUpdates(_0xb75e3e[_0xc29f('0x38')],null))[_0xc29f('0x24')](respondWithResult(_0x37c97d,null))['catch'](handleError(_0x37c97d,null));};exports[_0xc29f('0x39')]=function(_0x16081e,_0x232f96){return db[_0xc29f('0x2a')][_0xc29f('0x35')]({'where':{'id':_0x16081e[_0xc29f('0x28')]['id']}})[_0xc29f('0x24')](handleEntityNotFound(_0x232f96,null))['then'](removeEntity(_0x232f96,null))[_0xc29f('0x36')](handleError(_0x232f96,null));}; \ No newline at end of file +var _0x31dc=['Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','model','query','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','ChatApplication','body','find','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set'];(function(_0x408631,_0x307b5d){var _0x574f62=function(_0x32a067){while(--_0x32a067){_0x408631['push'](_0x408631['shift']());}};_0x574f62(++_0x307b5d);}(_0x31dc,0x184));var _0xc31d=function(_0x45404b,_0x241080){_0x45404b=_0x45404b-0x0;var _0x1cb928=_0x31dc[_0x45404b];return _0x1cb928;};'use strict';var pdf=require(_0xc31d('0x0'));var emlformat=require(_0xc31d('0x1'));var rimraf=require(_0xc31d('0x2'));var zipdir=require(_0xc31d('0x3'));var jsonpatch=require(_0xc31d('0x4'));var rp=require(_0xc31d('0x5'));var moment=require('moment');var BPromise=require(_0xc31d('0x6'));var Mustache=require('mustache');var util=require(_0xc31d('0x7'));var path=require(_0xc31d('0x8'));var sox=require(_0xc31d('0x9'));var csv=require('to-csv');var ejs=require(_0xc31d('0xa'));var fs=require('fs');var _=require(_0xc31d('0xb'));var squel=require(_0xc31d('0xc'));var crypto=require(_0xc31d('0xd'));var jsforce=require(_0xc31d('0xe'));var deskjs=require(_0xc31d('0xf'));var toCsv=require(_0xc31d('0x10'));var querystring=require(_0xc31d('0x11'));var Papa=require('papaparse');var Redis=require(_0xc31d('0x12'));var authService=require(_0xc31d('0x13'));var qs=require(_0xc31d('0x14'));var as=require(_0xc31d('0x15'));var hardwareService=require(_0xc31d('0x16'));var logger=require(_0xc31d('0x17'))('api');var utils=require(_0xc31d('0x18'));var config=require(_0xc31d('0x19'));var db=require(_0xc31d('0x1a'))['db'];function respondWithStatusCode(_0x2a4367,_0xc10d8b){_0xc10d8b=_0xc10d8b||0xcc;return function(_0x1a6de2){if(_0x1a6de2){return _0x2a4367['sendStatus'](_0xc10d8b);}return _0x2a4367['status'](_0xc10d8b)['end']();};}function respondWithResult(_0x5698f8,_0x48ad91){_0x48ad91=_0x48ad91||0xc8;return function(_0x3209fd){if(_0x3209fd){return _0x5698f8[_0xc31d('0x1b')](_0x48ad91)['json'](_0x3209fd);}};}function respondWithFilteredResult(_0xff5cac,_0x26b964){return function(_0x5404ef){if(_0x5404ef){var _0x178f37=_0x5404ef[_0xc31d('0x1c')],_0x5510a3=_0x26b964[_0xc31d('0x1d')],_0x2d7780=_0x26b964[_0xc31d('0x1d')]+_0x26b964[_0xc31d('0x1e')],_0x19eadb;if(_0x2d7780>=_0x178f37){_0x2d7780=_0x178f37;_0x19eadb=0xc8;}else{_0x19eadb=0xce;}_0xff5cac[_0xc31d('0x1b')](_0x19eadb);return _0xff5cac[_0xc31d('0x1f')](_0xc31d('0x20'),_0x5510a3+'-'+_0x2d7780+'/'+_0x178f37)['json'](_0x5404ef);}return null;};}function patchUpdates(_0x1a3f61){return function(_0x52a78f){try{jsonpatch[_0xc31d('0x21')](_0x52a78f,_0x1a3f61,!![]);}catch(_0x57a025){return BPromise['reject'](_0x57a025);}return _0x52a78f[_0xc31d('0x22')]();};}function saveUpdates(_0x9d540c,_0x5ad464){return function(_0x1ada29){if(_0x1ada29){return _0x1ada29[_0xc31d('0x23')](_0x9d540c)[_0xc31d('0x24')](function(_0x42552f){return _0x42552f;});}return null;};}function removeEntity(_0xb4547c,_0x42859e){return function(_0x29847a){if(_0x29847a){return _0x29847a[_0xc31d('0x25')]()[_0xc31d('0x24')](function(){_0xb4547c[_0xc31d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3446cf,_0x33ae3f){return function(_0x30e5d0){if(!_0x30e5d0){_0x3446cf[_0xc31d('0x26')](0x194);}return _0x30e5d0;};}function handleError(_0x65f3e6,_0x441c0b){_0x441c0b=_0x441c0b||0x1f4;return function(_0x2dec1e){logger[_0xc31d('0x27')](_0x2dec1e[_0xc31d('0x28')]);if(_0x2dec1e['name']){delete _0x2dec1e[_0xc31d('0x29')];}_0x65f3e6[_0xc31d('0x1b')](_0x441c0b)[_0xc31d('0x2a')](_0x2dec1e);};}exports['show']=function(_0x8e2827,_0x1094be){var _0x16b6f4={'raw':!![],'where':{'id':_0x8e2827['params']['id']}},_0x4fc465={};_0x4fc465[_0xc31d('0x2b')]=_['keys'](db['ChatApplication']['rawAttributes']);_0x4fc465[_0xc31d('0x2c')]=_[_0xc31d('0x2d')](_0x8e2827[_0xc31d('0x2c')]);_0x4fc465[_0xc31d('0x2e')]=_[_0xc31d('0x2f')](_0x4fc465['model'],_0x4fc465[_0xc31d('0x2c')]);_0x16b6f4[_0xc31d('0x30')]=_[_0xc31d('0x2f')](_0x4fc465['model'],qs[_0xc31d('0x31')](_0x8e2827[_0xc31d('0x2c')][_0xc31d('0x31')]));_0x16b6f4[_0xc31d('0x30')]=_0x16b6f4[_0xc31d('0x30')][_0xc31d('0x32')]?_0x16b6f4[_0xc31d('0x30')]:_0x4fc465[_0xc31d('0x2b')];if(_0x8e2827['query'][_0xc31d('0x33')]){_0x16b6f4[_0xc31d('0x34')]=[{'all':!![]}];}_0x16b6f4=_[_0xc31d('0x35')]({},_0x16b6f4,_0x8e2827[_0xc31d('0x36')]);return db[_0xc31d('0x37')]['find'](_0x16b6f4)[_0xc31d('0x24')](handleEntityNotFound(_0x1094be,null))[_0xc31d('0x24')](respondWithResult(_0x1094be,null))['catch'](handleError(_0x1094be,null));};exports['update']=function(_0x20e21a,_0x33e350){if(_0x20e21a[_0xc31d('0x38')]['id']){delete _0x20e21a[_0xc31d('0x38')]['id'];}return db[_0xc31d('0x37')][_0xc31d('0x39')]({'where':{'id':_0x20e21a[_0xc31d('0x3a')]['id']}})[_0xc31d('0x24')](handleEntityNotFound(_0x33e350,null))[_0xc31d('0x24')](saveUpdates(_0x20e21a[_0xc31d('0x38')],null))[_0xc31d('0x24')](respondWithResult(_0x33e350,null))[_0xc31d('0x3b')](handleError(_0x33e350,null));};exports['destroy']=function(_0x36b595,_0x586470){return db['ChatApplication']['find']({'where':{'id':_0x36b595['params']['id']}})['then'](handleEntityNotFound(_0x586470,null))[_0xc31d('0x24')](removeEntity(_0x586470,null))['catch'](handleError(_0x586470,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 9635873..cca1e35 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(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 f40d5bd..a452de5 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 _0x8340=['../../config/logger','rpc','../../config/environment','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8340,0x13e));var _0x0834=function(_0x5493dd,_0x344271){_0x5493dd=_0x5493dd-0x0;var _0x616a2a=_0x8340[_0x5493dd];return _0x616a2a;};'use strict';var _=require(_0x0834('0x0'));var util=require('util');var moment=require(_0x0834('0x1'));var BPromise=require(_0x0834('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0834('0x3'));var db=require(_0x0834('0x4'))['db'];var utils=require(_0x0834('0x5'));var logger=require(_0x0834('0x6'))(_0x0834('0x7'));var config=require(_0x0834('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0834('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x542816,_0x500dbe,_0x17da5c){return new BPromise(function(_0x158caa,_0x4c7417){return client['request'](_0x542816,_0x17da5c)[_0x0834('0xa')](function(_0x532041){logger[_0x0834('0xb')](_0x0834('0xc'),_0x500dbe,'request\x20sent');logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x500dbe,_0x0834('0xd'),JSON['stringify'](_0x532041));if(_0x532041[_0x0834('0xe')]){if(_0x532041[_0x0834('0xe')][_0x0834('0xf')]===0x1f4){logger[_0x0834('0xe')]('ChatApplication,\x20%s,\x20%s',_0x500dbe,_0x532041['error'][_0x0834('0x10')]);return _0x4c7417(_0x532041['error'][_0x0834('0x10')]);}logger[_0x0834('0xe')](_0x0834('0xc'),_0x500dbe,_0x532041[_0x0834('0xe')][_0x0834('0x10')]);return _0x158caa(_0x532041['error'][_0x0834('0x10')]);}else{logger[_0x0834('0xb')]('ChatApplication,\x20%s,\x20%s',_0x500dbe,_0x0834('0xd'));_0x158caa(_0x532041[_0x0834('0x11')]['message']);}})['catch'](function(_0x4d7246){logger['error'](_0x0834('0xc'),_0x500dbe,_0x4d7246);_0x4c7417(_0x4d7246);});});} \ No newline at end of file +var _0xea47=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','bluebird'];(function(_0xacf8c,_0x1d484b){var _0x21fd7b=function(_0x10b1bf){while(--_0x10b1bf){_0xacf8c['push'](_0xacf8c['shift']());}};_0x21fd7b(++_0x1d484b);}(_0xea47,0x65));var _0x7ea4=function(_0x4618aa,_0x501421){_0x4618aa=_0x4618aa-0x0;var _0x1ef49a=_0xea47[_0x4618aa];return _0x1ef49a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7ea4('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ea4('0x1'))['db'];var utils=require(_0x7ea4('0x2'));var logger=require(_0x7ea4('0x3'))(_0x7ea4('0x4'));var config=require(_0x7ea4('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7ea4('0x6')][_0x7ea4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x385d36,_0x5a2bb5,_0x1daaf4){return new BPromise(function(_0x531285,_0x57ee0c){return client['request'](_0x385d36,_0x1daaf4)[_0x7ea4('0x8')](function(_0x57d2a1){logger[_0x7ea4('0x9')](_0x7ea4('0xa'),_0x5a2bb5,_0x7ea4('0xb'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x5a2bb5,_0x7ea4('0xb'),JSON[_0x7ea4('0xc')](_0x57d2a1));if(_0x57d2a1[_0x7ea4('0xd')]){if(_0x57d2a1[_0x7ea4('0xd')][_0x7ea4('0xe')]===0x1f4){logger[_0x7ea4('0xd')](_0x7ea4('0xa'),_0x5a2bb5,_0x57d2a1[_0x7ea4('0xd')][_0x7ea4('0xf')]);return _0x57ee0c(_0x57d2a1[_0x7ea4('0xd')][_0x7ea4('0xf')]);}logger[_0x7ea4('0xd')](_0x7ea4('0xa'),_0x5a2bb5,_0x57d2a1['error'][_0x7ea4('0xf')]);return _0x531285(_0x57d2a1[_0x7ea4('0xd')][_0x7ea4('0xf')]);}else{logger[_0x7ea4('0x9')](_0x7ea4('0xa'),_0x5a2bb5,_0x7ea4('0xb'));_0x531285(_0x57d2a1[_0x7ea4('0x10')][_0x7ea4('0xf')]);}})['catch'](function(_0x2eb8d9){logger['error'](_0x7ea4('0xa'),_0x5a2bb5,_0x2eb8d9);_0x57ee0c(_0x2eb8d9);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index b5b870d..47389f8 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 _0x168f=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','update','delete','destroy','exports'];(function(_0x3e40e1,_0x4b8d65){var _0xc079d=function(_0x470d0c){while(--_0x470d0c){_0x3e40e1['push'](_0x3e40e1['shift']());}};_0xc079d(++_0x4b8d65);}(_0x168f,0x90));var _0xf168=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x168f[_0x374ada];return _0x449ed8;};'use strict';var multer=require(_0xf168('0x0'));var util=require(_0xf168('0x1'));var path=require(_0xf168('0x2'));var timeout=require(_0xf168('0x3'));var express=require(_0xf168('0x4'));var router=express[_0xf168('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf168('0x6'));var config=require(_0xf168('0x7'));var controller=require('./chatApplication.controller');router[_0xf168('0x8')](_0xf168('0x9'),auth[_0xf168('0xa')](),controller[_0xf168('0xb')]);router['put'](_0xf168('0x9'),auth[_0xf168('0xa')](),controller[_0xf168('0xc')]);router[_0xf168('0xd')]('/:id',auth[_0xf168('0xa')](),controller[_0xf168('0xe')]);module[_0xf168('0xf')]=router; \ No newline at end of file +var _0x8ec7=['/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get'];(function(_0x4f6f84,_0x31e197){var _0x20d989=function(_0x34db70){while(--_0x34db70){_0x4f6f84['push'](_0x4f6f84['shift']());}};_0x20d989(++_0x31e197);}(_0x8ec7,0x1f1));var _0x78ec=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0x8ec7[_0x38854e];return _0x3f8415;};'use strict';var multer=require(_0x78ec('0x0'));var util=require(_0x78ec('0x1'));var path=require('path');var timeout=require(_0x78ec('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x78ec('0x3'));var interaction=require(_0x78ec('0x4'));var config=require('../../config/environment');var controller=require(_0x78ec('0x5'));router[_0x78ec('0x6')](_0x78ec('0x7'),auth[_0x78ec('0x8')](),controller[_0x78ec('0x9')]);router['put'](_0x78ec('0x7'),auth['isAuthenticated'](),controller[_0x78ec('0xa')]);router[_0x78ec('0xb')](_0x78ec('0x7'),auth['isAuthenticated'](),controller[_0x78ec('0xc')]);module[_0x78ec('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 88a43fc..56270b4 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 _0x4e93=['sequelize','exports','STRING','BOOLEAN'];(function(_0x48744b,_0x25223f){var _0x50920f=function(_0x56e8f8){while(--_0x56e8f8){_0x48744b['push'](_0x48744b['shift']());}};_0x50920f(++_0x25223f);}(_0x4e93,0x1ac));var _0x34e9=function(_0x4bb32f,_0x2217e){_0x4bb32f=_0x4bb32f-0x0;var _0x2dd6e6=_0x4e93[_0x4bb32f];return _0x2dd6e6;};'use strict';var Sequelize=require(_0x34e9('0x0'));module[_0x34e9('0x1')]={'name':{'type':Sequelize[_0x34e9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x34e9('0x2')]},'write':{'type':Sequelize[_0x34e9('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x00c0=['exports','STRING','sequelize'];(function(_0x1dc980,_0x1ba661){var _0x537a27=function(_0x198ac2){while(--_0x198ac2){_0x1dc980['push'](_0x1dc980['shift']());}};_0x537a27(++_0x1ba661);}(_0x00c0,0x107));var _0x000c=function(_0x200541,_0x1a5eea){_0x200541=_0x200541-0x0;var _0x2404b7=_0x00c0[_0x200541];return _0x2404b7;};'use strict';var Sequelize=require(_0x000c('0x0'));module[_0x000c('0x1')]={'name':{'type':Sequelize[_0x000c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x000c('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 1a4b359..7e35ade 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 _0xca94=['to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','stack','name','send','index','ChatGroup','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','rawAttributes','create','body','find','params','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','ids','omit','getMembers','User','removeMembers','addMessage','getMessages','findOne','$gte','split','format','html-pdf','eml-format','zip-dir','moment','bluebird','util','path','sox'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xca94,0xd2));var _0x4ca9=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0xca94[_0x11f249];return _0x5c3656;};'use strict';var pdf=require(_0x4ca9('0x0'));var emlformat=require(_0x4ca9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4ca9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4ca9('0x3'));var BPromise=require(_0x4ca9('0x4'));var Mustache=require('mustache');var util=require(_0x4ca9('0x5'));var path=require(_0x4ca9('0x6'));var sox=require(_0x4ca9('0x7'));var csv=require(_0x4ca9('0x8'));var ejs=require(_0x4ca9('0x9'));var fs=require('fs');var _=require(_0x4ca9('0xa'));var squel=require(_0x4ca9('0xb'));var crypto=require(_0x4ca9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4ca9('0xd'));var toCsv=require(_0x4ca9('0x8'));var querystring=require(_0x4ca9('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4ca9('0xf'));var as=require(_0x4ca9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4ca9('0x11'));var utils=require(_0x4ca9('0x12'));var config=require(_0x4ca9('0x13'));var db=require(_0x4ca9('0x14'))['db'];config[_0x4ca9('0x15')]=_[_0x4ca9('0x16')](config[_0x4ca9('0x15')],{'host':_0x4ca9('0x17'),'port':0x18eb});var socket=require(_0x4ca9('0x18'))(new Redis(config['redis']));require(_0x4ca9('0x19'))['register'](socket);var jayson=require(_0x4ca9('0x1a'));var client=jayson[_0x4ca9('0x1b')][_0x4ca9('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x1b6a74,_0x110cf9,_0x25c9b3){if(_0x25c9b3){var _0x50eada=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50eada[_0x4ca9('0x1d')](_0x110cf9)){return _0x1b6a74;}else{throw new db[(_0x4ca9('0x1e'))][(_0x4ca9('0x1f'))](_0x4ca9('0x20'));}}else{return _0x1b6a74;}}function respondWithRpcPromise(_0x51499f,_0x65b933,_0x6146f,_0xba0622){return new BPromise(function(_0x48507c,_0x1d329c){var _0x160cfd=_0xba0622||client;return _0x160cfd['request'](_0x51499f,_0x6146f)['then'](function(_0x2cfd64){logger[_0x4ca9('0x21')](_0x4ca9('0x22'),_0x65b933,_0x4ca9('0x23'));logger[_0x4ca9('0x24')](_0x4ca9('0x25'),_0x65b933,_0x4ca9('0x23'),JSON[_0x4ca9('0x26')](_0x2cfd64));if(_0x2cfd64[_0x4ca9('0x27')]){if(_0x2cfd64['error']['code']===0x1f4){logger[_0x4ca9('0x27')](_0x4ca9('0x22'),_0x65b933,_0x2cfd64[_0x4ca9('0x27')][_0x4ca9('0x28')]);return _0x1d329c(_0x2cfd64[_0x4ca9('0x27')]['message']);}logger[_0x4ca9('0x27')](_0x4ca9('0x22'),_0x65b933,_0x2cfd64[_0x4ca9('0x27')][_0x4ca9('0x28')]);return _0x48507c(_0x2cfd64[_0x4ca9('0x27')][_0x4ca9('0x28')]);}else{logger[_0x4ca9('0x21')](_0x4ca9('0x22'),_0x65b933,'request\x20sent');_0x48507c(_0x2cfd64[_0x4ca9('0x29')][_0x4ca9('0x28')]);}})[_0x4ca9('0x2a')](function(_0x3c046d){logger['error'](_0x4ca9('0x22'),_0x65b933,_0x3c046d);_0x1d329c(_0x3c046d);});});}function respondWithStatusCode(_0x492dcb,_0x4aa087){_0x4aa087=_0x4aa087||0xcc;return function(_0x14f7ab){if(_0x14f7ab){return _0x492dcb[_0x4ca9('0x2b')](_0x4aa087);}return _0x492dcb[_0x4ca9('0x2c')](_0x4aa087)[_0x4ca9('0x2d')]();};}function respondWithResult(_0x299331,_0x34f1a7){_0x34f1a7=_0x34f1a7||0xc8;return function(_0x19c306){if(_0x19c306){return _0x299331[_0x4ca9('0x2c')](_0x34f1a7)[_0x4ca9('0x2e')](_0x19c306);}};}function respondWithFilteredResult(_0x5b42f4,_0x3ff930){return function(_0x2a235e){if(_0x2a235e){var _0x76b5ca=_0x2a235e[_0x4ca9('0x2f')],_0xdb2d6e=_0x3ff930[_0x4ca9('0x30')],_0x1fc1c9=_0x3ff930[_0x4ca9('0x30')]+_0x3ff930[_0x4ca9('0x31')],_0x1d4248;if(_0x1fc1c9>=_0x76b5ca){_0x1fc1c9=_0x76b5ca;_0x1d4248=0xc8;}else{_0x1d4248=0xce;}_0x5b42f4[_0x4ca9('0x2c')](_0x1d4248);return _0x5b42f4[_0x4ca9('0x32')]('Content-Range',_0xdb2d6e+'-'+_0x1fc1c9+'/'+_0x76b5ca)[_0x4ca9('0x2e')](_0x2a235e);}return null;};}function patchUpdates(_0x4dd19f){return function(_0xfc55f5){try{jsonpatch[_0x4ca9('0x33')](_0xfc55f5,_0x4dd19f,!![]);}catch(_0x15863c){return BPromise[_0x4ca9('0x34')](_0x15863c);}return _0xfc55f5[_0x4ca9('0x35')]();};}function saveUpdates(_0x5f3ae7,_0x38e1c1){return function(_0x41c4d3){if(_0x41c4d3){return _0x41c4d3[_0x4ca9('0x36')](_0x5f3ae7)[_0x4ca9('0x37')](function(_0x58ac99){return _0x58ac99;});}return null;};}function removeEntity(_0x292ee2,_0x2a4505){return function(_0x350fca){if(_0x350fca){return _0x350fca['destroy']()[_0x4ca9('0x37')](function(){_0x292ee2[_0x4ca9('0x2c')](0xcc)[_0x4ca9('0x2d')]();});}};}function handleEntityNotFound(_0x125cf0,_0x47aad7){return function(_0x10c391){if(!_0x10c391){_0x125cf0[_0x4ca9('0x2b')](0x194);}return _0x10c391;};}function handleError(_0x3a726a,_0x1c8d6d){_0x1c8d6d=_0x1c8d6d||0x1f4;return function(_0x4a0f45){logger[_0x4ca9('0x27')](_0x4a0f45[_0x4ca9('0x38')]);if(_0x4a0f45[_0x4ca9('0x39')]){delete _0x4a0f45['name'];}_0x3a726a[_0x4ca9('0x2c')](_0x1c8d6d)[_0x4ca9('0x3a')](_0x4a0f45);};}exports[_0x4ca9('0x3b')]=function(_0x383ace,_0x5f40fe){var _0x11600e={},_0x278570={},_0x27ea57={'count':0x0,'rows':[]};var _0x40fca7=_['map'](db[_0x4ca9('0x3c')]['rawAttributes'],function(_0x4aae84){return{'name':_0x4aae84[_0x4ca9('0x3d')],'type':_0x4aae84['type'][_0x4ca9('0x3e')]};});_0x278570[_0x4ca9('0x3f')]=_[_0x4ca9('0x40')](_0x40fca7,_0x4ca9('0x39'));_0x278570[_0x4ca9('0x41')]=_[_0x4ca9('0x42')](_0x383ace[_0x4ca9('0x41')]);_0x278570['filters']=_[_0x4ca9('0x43')](_0x278570[_0x4ca9('0x3f')],_0x278570['query']);_0x11600e['attributes']=_[_0x4ca9('0x43')](_0x278570['model'],qs['fields'](_0x383ace['query'][_0x4ca9('0x44')]));_0x11600e[_0x4ca9('0x45')]=_0x11600e['attributes'][_0x4ca9('0x46')]?_0x11600e['attributes']:_0x278570[_0x4ca9('0x3f')];if(!_0x383ace['query'][_0x4ca9('0x47')](_0x4ca9('0x48'))){_0x11600e[_0x4ca9('0x31')]=qs[_0x4ca9('0x31')](_0x383ace['query'][_0x4ca9('0x31')]);_0x11600e[_0x4ca9('0x30')]=qs['offset'](_0x383ace[_0x4ca9('0x41')][_0x4ca9('0x30')]);}_0x11600e[_0x4ca9('0x49')]=qs['sort'](_0x383ace[_0x4ca9('0x41')][_0x4ca9('0x4a')]);_0x11600e[_0x4ca9('0x4b')]=qs['filters'](_[_0x4ca9('0x4c')](_0x383ace[_0x4ca9('0x41')],_0x278570[_0x4ca9('0x4d')]));if(_0x383ace['query']['filter']){_0x11600e[_0x4ca9('0x4b')]=_[_0x4ca9('0x4e')](_0x11600e[_0x4ca9('0x4b')],{'$or':_[_0x4ca9('0x40')](_0x40fca7,function(_0x354518){if(_0x354518['type']!==_0x4ca9('0x4f')){var _0xcd792b={};_0xcd792b[_0x354518['name']]={'$like':'%'+_0x383ace['query'][_0x4ca9('0x50')]+'%'};return _0xcd792b;}})});}_0x11600e=_[_0x4ca9('0x4e')]({},_0x11600e,_0x383ace[_0x4ca9('0x51')]);var _0x4b4a6c={'where':_0x11600e[_0x4ca9('0x4b')]};return db[_0x4ca9('0x3c')]['count'](_0x4b4a6c)[_0x4ca9('0x37')](function(_0x5e10dd){_0x27ea57['count']=_0x5e10dd;if(_0x383ace[_0x4ca9('0x41')][_0x4ca9('0x52')]){_0x11600e[_0x4ca9('0x53')]=[{'all':!![]}];}return db[_0x4ca9('0x3c')][_0x4ca9('0x54')](_0x11600e);})[_0x4ca9('0x37')](function(_0x2f0e55){_0x27ea57[_0x4ca9('0x55')]=_0x2f0e55;return _0x27ea57;})['then'](respondWithFilteredResult(_0x5f40fe,_0x11600e))[_0x4ca9('0x2a')](handleError(_0x5f40fe,null));};exports[_0x4ca9('0x56')]=function(_0x12c2d1,_0x30c26a){var _0x40b647={'raw':!![],'where':{'id':_0x12c2d1['params']['id']}},_0x4e0879={};_0x4e0879[_0x4ca9('0x3f')]=_[_0x4ca9('0x42')](db[_0x4ca9('0x3c')][_0x4ca9('0x57')]);_0x4e0879[_0x4ca9('0x41')]=_[_0x4ca9('0x42')](_0x12c2d1[_0x4ca9('0x41')]);_0x4e0879[_0x4ca9('0x4d')]=_[_0x4ca9('0x43')](_0x4e0879[_0x4ca9('0x3f')],_0x4e0879[_0x4ca9('0x41')]);_0x40b647[_0x4ca9('0x45')]=_[_0x4ca9('0x43')](_0x4e0879[_0x4ca9('0x3f')],qs[_0x4ca9('0x44')](_0x12c2d1[_0x4ca9('0x41')][_0x4ca9('0x44')]));_0x40b647[_0x4ca9('0x45')]=_0x40b647[_0x4ca9('0x45')][_0x4ca9('0x46')]?_0x40b647[_0x4ca9('0x45')]:_0x4e0879[_0x4ca9('0x3f')];if(_0x12c2d1[_0x4ca9('0x41')][_0x4ca9('0x52')]){_0x40b647[_0x4ca9('0x53')]=[{'all':!![]}];}_0x40b647=_['merge']({},_0x40b647,_0x12c2d1[_0x4ca9('0x51')]);return db[_0x4ca9('0x3c')]['find'](_0x40b647)[_0x4ca9('0x37')](handleEntityNotFound(_0x30c26a,null))[_0x4ca9('0x37')](respondWithResult(_0x30c26a,null))['catch'](handleError(_0x30c26a,null));};exports['create']=function(_0x315365,_0x417873){return db[_0x4ca9('0x3c')][_0x4ca9('0x58')](_0x315365[_0x4ca9('0x59')],{})[_0x4ca9('0x37')](respondWithResult(_0x417873,0xc9))['catch'](handleError(_0x417873,null));};exports[_0x4ca9('0x36')]=function(_0x52b5c4,_0x2904a0){if(_0x52b5c4[_0x4ca9('0x59')]['id']){delete _0x52b5c4[_0x4ca9('0x59')]['id'];}return db['ChatGroup'][_0x4ca9('0x5a')]({'where':{'id':_0x52b5c4[_0x4ca9('0x5b')]['id']}})[_0x4ca9('0x37')](handleEntityNotFound(_0x2904a0,null))[_0x4ca9('0x37')](saveUpdates(_0x52b5c4[_0x4ca9('0x59')],null))[_0x4ca9('0x37')](respondWithResult(_0x2904a0,null))[_0x4ca9('0x2a')](handleError(_0x2904a0,null));};exports[_0x4ca9('0x5c')]=function(_0x3215ae,_0x4f4cb0){return db[_0x4ca9('0x3c')][_0x4ca9('0x5a')]({'where':{'id':_0x3215ae['params']['id']}})['then'](handleEntityNotFound(_0x4f4cb0,null))[_0x4ca9('0x37')](removeEntity(_0x4f4cb0,null))[_0x4ca9('0x2a')](handleError(_0x4f4cb0,null));};exports[_0x4ca9('0x5d')]=function(_0x1e5994,_0x23f509){return db[_0x4ca9('0x3c')][_0x4ca9('0x5d')]()[_0x4ca9('0x37')](respondWithResult(_0x23f509,null))['catch'](handleError(_0x23f509,null));};exports[_0x4ca9('0x5e')]=function(_0x431bca,_0x1dadb5,_0x321986){return db[_0x4ca9('0x5f')][_0x4ca9('0x2f')]({'where':{'ChatGroupId':_0x431bca[_0x4ca9('0x5b')]['id'],'ToId':_0x431bca[_0x4ca9('0x60')]['id'],'read':![]}})['then'](function(_0x111d0a){return{'id':_[_0x4ca9('0x61')](_0x431bca[_0x4ca9('0x5b')]['id']),'count':_0x111d0a};})[_0x4ca9('0x37')](respondWithResult(_0x1dadb5,null))[_0x4ca9('0x2a')](handleError(_0x1dadb5,null));};exports['addMembers']=function(_0x135e37,_0x289325,_0x51d9f1){return db[_0x4ca9('0x3c')][_0x4ca9('0x5a')]({'where':{'id':_0x135e37[_0x4ca9('0x5b')]['id']}})[_0x4ca9('0x37')](handleEntityNotFound(_0x289325,null))[_0x4ca9('0x37')](function(_0xb677b3){if(_0xb677b3){return _0xb677b3['addMembers'](_0x135e37[_0x4ca9('0x59')][_0x4ca9('0x62')],_[_0x4ca9('0x63')](_0x135e37[_0x4ca9('0x59')],[_0x4ca9('0x62'),'id'])||{});}})[_0x4ca9('0x37')](respondWithResult(_0x289325,null))[_0x4ca9('0x2a')](handleError(_0x289325,null));};exports[_0x4ca9('0x64')]=function(_0x10bfbc,_0x1f5093,_0x192721){var _0x150ccf={};var _0x19d15f={};var _0x2a2bac;var _0x613ec1;return db[_0x4ca9('0x3c')]['findOne']({'where':{'id':_0x10bfbc[_0x4ca9('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1f5093,null))[_0x4ca9('0x37')](function(_0x14a8fa){if(_0x14a8fa){_0x2a2bac=_0x14a8fa;_0x19d15f[_0x4ca9('0x3f')]=_['keys'](db[_0x4ca9('0x65')][_0x4ca9('0x57')]);_0x19d15f[_0x4ca9('0x41')]=_[_0x4ca9('0x42')](_0x10bfbc[_0x4ca9('0x41')]);_0x19d15f['filters']=_[_0x4ca9('0x43')](_0x19d15f[_0x4ca9('0x3f')],_0x19d15f[_0x4ca9('0x41')]);_0x150ccf[_0x4ca9('0x45')]=_[_0x4ca9('0x43')](_0x19d15f[_0x4ca9('0x3f')],qs[_0x4ca9('0x44')](_0x10bfbc['query'][_0x4ca9('0x44')]));_0x150ccf[_0x4ca9('0x45')]=_0x150ccf[_0x4ca9('0x45')]['length']?_0x150ccf[_0x4ca9('0x45')]:_0x19d15f[_0x4ca9('0x3f')];_0x150ccf[_0x4ca9('0x49')]=qs[_0x4ca9('0x4a')](_0x10bfbc['query'][_0x4ca9('0x4a')]);_0x150ccf[_0x4ca9('0x4b')]=qs[_0x4ca9('0x4d')](_[_0x4ca9('0x4c')](_0x10bfbc[_0x4ca9('0x41')],_0x19d15f[_0x4ca9('0x4d')]));if(_0x10bfbc[_0x4ca9('0x41')]['filter']){_0x150ccf[_0x4ca9('0x4b')]=_[_0x4ca9('0x4e')](_0x150ccf['where'],{'$or':_[_0x4ca9('0x40')](_0x150ccf[_0x4ca9('0x45')],function(_0x95a920){var _0x2cfd8d={};_0x2cfd8d[_0x95a920]={'$like':'%'+_0x10bfbc[_0x4ca9('0x41')][_0x4ca9('0x50')]+'%'};return _0x2cfd8d;})});}_0x150ccf=_[_0x4ca9('0x4e')]({},_0x150ccf,_0x10bfbc['options']);return _0x2a2bac['getMembers'](_0x150ccf);}})[_0x4ca9('0x37')](function(_0x2d38fa){if(_0x2d38fa){_0x613ec1=_0x2d38fa['length'];if(!_0x10bfbc[_0x4ca9('0x41')][_0x4ca9('0x47')]('nolimit')){_0x150ccf[_0x4ca9('0x31')]=qs[_0x4ca9('0x31')](_0x10bfbc[_0x4ca9('0x41')]['limit']);_0x150ccf[_0x4ca9('0x30')]=qs[_0x4ca9('0x30')](_0x10bfbc['query'][_0x4ca9('0x30')]);}return _0x2a2bac['getMembers'](_0x150ccf);}})[_0x4ca9('0x37')](function(_0x158a98){if(_0x158a98){return _0x158a98?{'count':_0x613ec1,'rows':_0x158a98}:null;}})[_0x4ca9('0x37')](respondWithResult(_0x1f5093,null))[_0x4ca9('0x2a')](handleError(_0x1f5093,null));};exports['removeMembers']=function(_0x1a0bf7,_0xf4da0c,_0x253f9a){return db[_0x4ca9('0x3c')]['find']({'where':{'id':_0x1a0bf7[_0x4ca9('0x5b')]['id']}})[_0x4ca9('0x37')](handleEntityNotFound(_0xf4da0c,null))[_0x4ca9('0x37')](function(_0x461f16){if(_0x461f16){return _0x461f16[_0x4ca9('0x66')](_0x1a0bf7['query']['ids']);}})[_0x4ca9('0x37')](respondWithStatusCode(_0xf4da0c,null))[_0x4ca9('0x2a')](handleError(_0xf4da0c,null));};exports[_0x4ca9('0x67')]=function(_0x8f580a,_0x33ea29,_0x3e05b0){if(_0x8f580a[_0x4ca9('0x59')]['id']){delete _0x8f580a[_0x4ca9('0x59')]['id'];}return db[_0x4ca9('0x3c')][_0x4ca9('0x5a')]({'where':{'id':_0x8f580a[_0x4ca9('0x5b')]['id']}})[_0x4ca9('0x37')](handleEntityNotFound(_0x33ea29,null))[_0x4ca9('0x37')](function(_0x59adb4){if(_0x59adb4){_0x8f580a[_0x4ca9('0x59')]['ChatGroupId']=_0x59adb4['id'];return db[_0x4ca9('0x5f')][_0x4ca9('0x58')](_0x8f580a[_0x4ca9('0x59')]);}})[_0x4ca9('0x37')](respondWithResult(_0x33ea29,null))[_0x4ca9('0x2a')](handleError(_0x33ea29,null));};exports[_0x4ca9('0x68')]=function(_0x4a8452,_0x10c641,_0x5de96f){var _0x399bc7={};var _0x23167d={};var _0x37edb0;var _0xc8d0f8;return db[_0x4ca9('0x3c')][_0x4ca9('0x69')]({'where':{'id':_0x4a8452[_0x4ca9('0x5b')]['id']}})[_0x4ca9('0x37')](handleEntityNotFound(_0x10c641,null))[_0x4ca9('0x37')](function(_0x51d0ad){if(_0x51d0ad){_0x37edb0=_0x51d0ad;_0x23167d['model']=_[_0x4ca9('0x42')](db[_0x4ca9('0x5f')]['rawAttributes']);_0x23167d[_0x4ca9('0x41')]=_[_0x4ca9('0x42')](_0x4a8452[_0x4ca9('0x41')]);_0x23167d[_0x4ca9('0x4d')]=_['intersection'](_0x23167d[_0x4ca9('0x3f')],_0x23167d[_0x4ca9('0x41')]);_0x399bc7[_0x4ca9('0x45')]=_['intersection'](_0x23167d[_0x4ca9('0x3f')],qs[_0x4ca9('0x44')](_0x4a8452[_0x4ca9('0x41')]['fields']));_0x399bc7[_0x4ca9('0x45')]=_0x399bc7[_0x4ca9('0x45')]['length']?_0x399bc7['attributes']:_0x23167d['model'];_0x399bc7[_0x4ca9('0x49')]=qs['sort'](_0x4a8452[_0x4ca9('0x41')][_0x4ca9('0x4a')]);_0x399bc7[_0x4ca9('0x4b')]=qs[_0x4ca9('0x4d')](_[_0x4ca9('0x4c')](_0x4a8452['query'],_0x23167d[_0x4ca9('0x4d')]));if(_0x4a8452[_0x4ca9('0x41')][_0x4ca9('0x50')]){_0x399bc7[_0x4ca9('0x4b')]=_[_0x4ca9('0x4e')](_0x399bc7[_0x4ca9('0x4b')],{'$or':_['map'](_0x399bc7[_0x4ca9('0x45')],function(_0x2b52ea){var _0x533574={};_0x533574[_0x2b52ea]={'$like':'%'+_0x4a8452[_0x4ca9('0x41')]['filter']+'%'};return _0x533574;})});}if(_0x4a8452[_0x4ca9('0x41')][_0x4ca9('0x6a')]){var _0x5048e0=_0x4a8452[_0x4ca9('0x41')][_0x4ca9('0x6a')][_0x4ca9('0x6b')](',');var _0x28c327={};_0x28c327[_0x5048e0[0x0]]={'$gte':moment(_0x5048e0[0x1])[_0x4ca9('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x399bc7['where']=_[_0x4ca9('0x4e')](_0x399bc7[_0x4ca9('0x4b')],_0x28c327);}_0x399bc7=_['merge']({},_0x399bc7,_0x4a8452[_0x4ca9('0x51')]);return _0x37edb0[_0x4ca9('0x68')](_0x399bc7);}})[_0x4ca9('0x37')](function(_0x35c4ee){if(_0x35c4ee){_0xc8d0f8=_0x35c4ee[_0x4ca9('0x46')];if(!_0x4a8452[_0x4ca9('0x41')][_0x4ca9('0x47')](_0x4ca9('0x48'))){_0x399bc7[_0x4ca9('0x31')]=qs[_0x4ca9('0x31')](_0x4a8452['query'][_0x4ca9('0x31')]);_0x399bc7[_0x4ca9('0x30')]=qs[_0x4ca9('0x30')](_0x4a8452['query'][_0x4ca9('0x30')]);}return _0x37edb0['getMessages'](_0x399bc7);}})[_0x4ca9('0x37')](function(_0x4ac8df){if(_0x4ac8df){return _0x4ac8df?{'count':_0xc8d0f8,'rows':_0x4ac8df}:null;}})[_0x4ca9('0x37')](respondWithResult(_0x10c641,null))['catch'](handleError(_0x10c641,null));}; \ No newline at end of file +var _0x0b4f=['../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','test','request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','rows','include','find','create','body','params','describe','getUnread','ChatInternalMessage','user','addMembers','omit','ids','getMembers','findOne','User','hasOwnProperty','removeMembers','addMessage','ChatGroupId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils'];(function(_0x236673,_0x11daf2){var _0x44e60a=function(_0x10f2a5){while(--_0x10f2a5){_0x236673['push'](_0x236673['shift']());}};_0x44e60a(++_0x11daf2);}(_0x0b4f,0xbf));var _0xf0b4=function(_0x20d004,_0x261af8){_0x20d004=_0x20d004-0x0;var _0x30aca1=_0x0b4f[_0x20d004];return _0x30aca1;};'use strict';var pdf=require(_0xf0b4('0x0'));var emlformat=require(_0xf0b4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf0b4('0x2'));var jsonpatch=require(_0xf0b4('0x3'));var rp=require(_0xf0b4('0x4'));var moment=require('moment');var BPromise=require(_0xf0b4('0x5'));var Mustache=require('mustache');var util=require(_0xf0b4('0x6'));var path=require(_0xf0b4('0x7'));var sox=require(_0xf0b4('0x8'));var csv=require('to-csv');var ejs=require(_0xf0b4('0x9'));var fs=require('fs');var _=require(_0xf0b4('0xa'));var squel=require(_0xf0b4('0xb'));var crypto=require(_0xf0b4('0xc'));var jsforce=require(_0xf0b4('0xd'));var deskjs=require(_0xf0b4('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf0b4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf0b4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf0b4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf0b4('0x12'));var config=require(_0xf0b4('0x13'));var db=require('../../mysqldb')['db'];config[_0xf0b4('0x14')]=_[_0xf0b4('0x15')](config[_0xf0b4('0x14')],{'host':_0xf0b4('0x16'),'port':0x18eb});var socket=require(_0xf0b4('0x17'))(new Redis(config[_0xf0b4('0x14')]));require(_0xf0b4('0x18'))[_0xf0b4('0x19')](socket);var jayson=require(_0xf0b4('0x1a'));var client=jayson[_0xf0b4('0x1b')][_0xf0b4('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3a5156,_0x1c4c81,_0x32bc95){if(_0x32bc95){var _0x56f9da=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x56f9da[_0xf0b4('0x1d')](_0x1c4c81)){return _0x3a5156;}else{throw new db['Sequelize']['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3a5156;}}function respondWithRpcPromise(_0x5d5017,_0x2585ff,_0x2496ad,_0x25a40e){return new BPromise(function(_0x567591,_0x23c6d1){var _0x1aefb7=_0x25a40e||client;return _0x1aefb7[_0xf0b4('0x1e')](_0x5d5017,_0x2496ad)['then'](function(_0x3d4cce){logger[_0xf0b4('0x1f')]('ChatGroup,\x20%s,\x20%s',_0x2585ff,_0xf0b4('0x20'));logger[_0xf0b4('0x21')](_0xf0b4('0x22'),_0x2585ff,_0xf0b4('0x20'),JSON[_0xf0b4('0x23')](_0x3d4cce));if(_0x3d4cce[_0xf0b4('0x24')]){if(_0x3d4cce[_0xf0b4('0x24')][_0xf0b4('0x25')]===0x1f4){logger[_0xf0b4('0x24')]('ChatGroup,\x20%s,\x20%s',_0x2585ff,_0x3d4cce[_0xf0b4('0x24')][_0xf0b4('0x26')]);return _0x23c6d1(_0x3d4cce[_0xf0b4('0x24')][_0xf0b4('0x26')]);}logger['error'](_0xf0b4('0x27'),_0x2585ff,_0x3d4cce[_0xf0b4('0x24')]['message']);return _0x567591(_0x3d4cce[_0xf0b4('0x24')][_0xf0b4('0x26')]);}else{logger[_0xf0b4('0x1f')](_0xf0b4('0x27'),_0x2585ff,'request\x20sent');_0x567591(_0x3d4cce[_0xf0b4('0x28')]['message']);}})[_0xf0b4('0x29')](function(_0x45c124){logger[_0xf0b4('0x24')](_0xf0b4('0x27'),_0x2585ff,_0x45c124);_0x23c6d1(_0x45c124);});});}function respondWithStatusCode(_0x1767a2,_0x1ecb84){_0x1ecb84=_0x1ecb84||0xcc;return function(_0x3c024a){if(_0x3c024a){return _0x1767a2[_0xf0b4('0x2a')](_0x1ecb84);}return _0x1767a2[_0xf0b4('0x2b')](_0x1ecb84)['end']();};}function respondWithResult(_0x483a3a,_0x388b2e){_0x388b2e=_0x388b2e||0xc8;return function(_0x123916){if(_0x123916){return _0x483a3a['status'](_0x388b2e)[_0xf0b4('0x2c')](_0x123916);}};}function respondWithFilteredResult(_0x20463e,_0x34055f){return function(_0x5da109){if(_0x5da109){var _0x42df19=_0x5da109['count'],_0x2db6be=_0x34055f[_0xf0b4('0x2d')],_0x489ef5=_0x34055f[_0xf0b4('0x2d')]+_0x34055f[_0xf0b4('0x2e')],_0x1dc7f3;if(_0x489ef5>=_0x42df19){_0x489ef5=_0x42df19;_0x1dc7f3=0xc8;}else{_0x1dc7f3=0xce;}_0x20463e[_0xf0b4('0x2b')](_0x1dc7f3);return _0x20463e[_0xf0b4('0x2f')](_0xf0b4('0x30'),_0x2db6be+'-'+_0x489ef5+'/'+_0x42df19)[_0xf0b4('0x2c')](_0x5da109);}return null;};}function patchUpdates(_0x306bb4){return function(_0x2fe0ee){try{jsonpatch[_0xf0b4('0x31')](_0x2fe0ee,_0x306bb4,!![]);}catch(_0x4e285f){return BPromise[_0xf0b4('0x32')](_0x4e285f);}return _0x2fe0ee['save']();};}function saveUpdates(_0x22b9b7,_0x4910cd){return function(_0xcee043){if(_0xcee043){return _0xcee043[_0xf0b4('0x33')](_0x22b9b7)[_0xf0b4('0x34')](function(_0x3b8ae9){return _0x3b8ae9;});}return null;};}function removeEntity(_0x579bc0,_0x17b62d){return function(_0x5dd705){if(_0x5dd705){return _0x5dd705[_0xf0b4('0x35')]()[_0xf0b4('0x34')](function(){_0x579bc0[_0xf0b4('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf70b83,_0x1c197e){return function(_0x7340ae){if(!_0x7340ae){_0xf70b83['sendStatus'](0x194);}return _0x7340ae;};}function handleError(_0x455c62,_0x4c6825){_0x4c6825=_0x4c6825||0x1f4;return function(_0x4c542d){logger[_0xf0b4('0x24')](_0x4c542d[_0xf0b4('0x36')]);if(_0x4c542d[_0xf0b4('0x37')]){delete _0x4c542d[_0xf0b4('0x37')];}_0x455c62['status'](_0x4c6825)[_0xf0b4('0x38')](_0x4c542d);};}exports[_0xf0b4('0x39')]=function(_0xd9805d,_0x58b3e3){var _0x1e5d2b={},_0x186230={},_0x61102c={'count':0x0,'rows':[]};var _0x366235=_[_0xf0b4('0x3a')](db[_0xf0b4('0x3b')][_0xf0b4('0x3c')],function(_0x430041){return{'name':_0x430041['fieldName'],'type':_0x430041[_0xf0b4('0x3d')][_0xf0b4('0x3e')]};});_0x186230[_0xf0b4('0x3f')]=_[_0xf0b4('0x3a')](_0x366235,_0xf0b4('0x37'));_0x186230[_0xf0b4('0x40')]=_[_0xf0b4('0x41')](_0xd9805d[_0xf0b4('0x40')]);_0x186230[_0xf0b4('0x42')]=_['intersection'](_0x186230[_0xf0b4('0x3f')],_0x186230[_0xf0b4('0x40')]);_0x1e5d2b[_0xf0b4('0x43')]=_[_0xf0b4('0x44')](_0x186230['model'],qs[_0xf0b4('0x45')](_0xd9805d[_0xf0b4('0x40')][_0xf0b4('0x45')]));_0x1e5d2b[_0xf0b4('0x43')]=_0x1e5d2b['attributes'][_0xf0b4('0x46')]?_0x1e5d2b[_0xf0b4('0x43')]:_0x186230[_0xf0b4('0x3f')];if(!_0xd9805d[_0xf0b4('0x40')]['hasOwnProperty'](_0xf0b4('0x47'))){_0x1e5d2b[_0xf0b4('0x2e')]=qs[_0xf0b4('0x2e')](_0xd9805d[_0xf0b4('0x40')][_0xf0b4('0x2e')]);_0x1e5d2b[_0xf0b4('0x2d')]=qs[_0xf0b4('0x2d')](_0xd9805d['query'][_0xf0b4('0x2d')]);}_0x1e5d2b[_0xf0b4('0x48')]=qs[_0xf0b4('0x49')](_0xd9805d[_0xf0b4('0x40')][_0xf0b4('0x49')]);_0x1e5d2b[_0xf0b4('0x4a')]=qs[_0xf0b4('0x42')](_[_0xf0b4('0x4b')](_0xd9805d['query'],_0x186230[_0xf0b4('0x42')]));if(_0xd9805d['query'][_0xf0b4('0x4c')]){_0x1e5d2b['where']=_[_0xf0b4('0x4d')](_0x1e5d2b[_0xf0b4('0x4a')],{'$or':_[_0xf0b4('0x3a')](_0x366235,function(_0x48f752){if(_0x48f752['type']!=='VIRTUAL'){var _0x7d2938={};_0x7d2938[_0x48f752[_0xf0b4('0x37')]]={'$like':'%'+_0xd9805d[_0xf0b4('0x40')][_0xf0b4('0x4c')]+'%'};return _0x7d2938;}})});}_0x1e5d2b=_[_0xf0b4('0x4d')]({},_0x1e5d2b,_0xd9805d[_0xf0b4('0x4e')]);var _0x25a5d8={'where':_0x1e5d2b['where']};return db[_0xf0b4('0x3b')]['count'](_0x25a5d8)[_0xf0b4('0x34')](function(_0x585e97){_0x61102c[_0xf0b4('0x4f')]=_0x585e97;if(_0xd9805d[_0xf0b4('0x40')][_0xf0b4('0x50')]){_0x1e5d2b['include']=[{'all':!![]}];}return db[_0xf0b4('0x3b')]['findAll'](_0x1e5d2b);})[_0xf0b4('0x34')](function(_0x4b25c8){_0x61102c[_0xf0b4('0x51')]=_0x4b25c8;return _0x61102c;})['then'](respondWithFilteredResult(_0x58b3e3,_0x1e5d2b))[_0xf0b4('0x29')](handleError(_0x58b3e3,null));};exports['show']=function(_0x5535cd,_0x35cefb){var _0xf8256f={'raw':!![],'where':{'id':_0x5535cd['params']['id']}},_0x5af3fa={};_0x5af3fa[_0xf0b4('0x3f')]=_[_0xf0b4('0x41')](db['ChatGroup'][_0xf0b4('0x3c')]);_0x5af3fa[_0xf0b4('0x40')]=_[_0xf0b4('0x41')](_0x5535cd[_0xf0b4('0x40')]);_0x5af3fa['filters']=_['intersection'](_0x5af3fa[_0xf0b4('0x3f')],_0x5af3fa[_0xf0b4('0x40')]);_0xf8256f[_0xf0b4('0x43')]=_[_0xf0b4('0x44')](_0x5af3fa['model'],qs[_0xf0b4('0x45')](_0x5535cd[_0xf0b4('0x40')][_0xf0b4('0x45')]));_0xf8256f[_0xf0b4('0x43')]=_0xf8256f[_0xf0b4('0x43')]['length']?_0xf8256f['attributes']:_0x5af3fa[_0xf0b4('0x3f')];if(_0x5535cd[_0xf0b4('0x40')][_0xf0b4('0x50')]){_0xf8256f[_0xf0b4('0x52')]=[{'all':!![]}];}_0xf8256f=_['merge']({},_0xf8256f,_0x5535cd['options']);return db[_0xf0b4('0x3b')][_0xf0b4('0x53')](_0xf8256f)['then'](handleEntityNotFound(_0x35cefb,null))['then'](respondWithResult(_0x35cefb,null))[_0xf0b4('0x29')](handleError(_0x35cefb,null));};exports[_0xf0b4('0x54')]=function(_0x52e505,_0x9f388d){return db[_0xf0b4('0x3b')][_0xf0b4('0x54')](_0x52e505[_0xf0b4('0x55')],{})['then'](respondWithResult(_0x9f388d,0xc9))[_0xf0b4('0x29')](handleError(_0x9f388d,null));};exports['update']=function(_0x4d4a77,_0x4bf44a){if(_0x4d4a77[_0xf0b4('0x55')]['id']){delete _0x4d4a77[_0xf0b4('0x55')]['id'];}return db[_0xf0b4('0x3b')]['find']({'where':{'id':_0x4d4a77[_0xf0b4('0x56')]['id']}})[_0xf0b4('0x34')](handleEntityNotFound(_0x4bf44a,null))[_0xf0b4('0x34')](saveUpdates(_0x4d4a77[_0xf0b4('0x55')],null))[_0xf0b4('0x34')](respondWithResult(_0x4bf44a,null))[_0xf0b4('0x29')](handleError(_0x4bf44a,null));};exports[_0xf0b4('0x35')]=function(_0x162924,_0xbaa554){return db['ChatGroup'][_0xf0b4('0x53')]({'where':{'id':_0x162924[_0xf0b4('0x56')]['id']}})['then'](handleEntityNotFound(_0xbaa554,null))[_0xf0b4('0x34')](removeEntity(_0xbaa554,null))[_0xf0b4('0x29')](handleError(_0xbaa554,null));};exports[_0xf0b4('0x57')]=function(_0x3ca27a,_0x1827a5){return db['ChatGroup'][_0xf0b4('0x57')]()[_0xf0b4('0x34')](respondWithResult(_0x1827a5,null))['catch'](handleError(_0x1827a5,null));};exports[_0xf0b4('0x58')]=function(_0x85a744,_0x55787f,_0x1b8b43){return db[_0xf0b4('0x59')][_0xf0b4('0x4f')]({'where':{'ChatGroupId':_0x85a744[_0xf0b4('0x56')]['id'],'ToId':_0x85a744[_0xf0b4('0x5a')]['id'],'read':![]}})[_0xf0b4('0x34')](function(_0x15b69b){return{'id':_['toInteger'](_0x85a744[_0xf0b4('0x56')]['id']),'count':_0x15b69b};})[_0xf0b4('0x34')](respondWithResult(_0x55787f,null))[_0xf0b4('0x29')](handleError(_0x55787f,null));};exports[_0xf0b4('0x5b')]=function(_0x76494a,_0x43407c,_0x3ede8f){return db['ChatGroup'][_0xf0b4('0x53')]({'where':{'id':_0x76494a[_0xf0b4('0x56')]['id']}})[_0xf0b4('0x34')](handleEntityNotFound(_0x43407c,null))[_0xf0b4('0x34')](function(_0x517517){if(_0x517517){return _0x517517['addMembers'](_0x76494a[_0xf0b4('0x55')]['ids'],_[_0xf0b4('0x5c')](_0x76494a[_0xf0b4('0x55')],[_0xf0b4('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x43407c,null))['catch'](handleError(_0x43407c,null));};exports[_0xf0b4('0x5e')]=function(_0x10bffb,_0x3a1e96,_0x291f25){var _0x5bbe34={};var _0x23bede={};var _0x2e3d24;var _0x419202;return db[_0xf0b4('0x3b')][_0xf0b4('0x5f')]({'where':{'id':_0x10bffb[_0xf0b4('0x56')]['id']}})['then'](handleEntityNotFound(_0x3a1e96,null))[_0xf0b4('0x34')](function(_0x296076){if(_0x296076){_0x2e3d24=_0x296076;_0x23bede['model']=_[_0xf0b4('0x41')](db[_0xf0b4('0x60')][_0xf0b4('0x3c')]);_0x23bede[_0xf0b4('0x40')]=_['keys'](_0x10bffb[_0xf0b4('0x40')]);_0x23bede[_0xf0b4('0x42')]=_['intersection'](_0x23bede[_0xf0b4('0x3f')],_0x23bede[_0xf0b4('0x40')]);_0x5bbe34[_0xf0b4('0x43')]=_['intersection'](_0x23bede['model'],qs[_0xf0b4('0x45')](_0x10bffb['query'][_0xf0b4('0x45')]));_0x5bbe34[_0xf0b4('0x43')]=_0x5bbe34[_0xf0b4('0x43')]['length']?_0x5bbe34[_0xf0b4('0x43')]:_0x23bede[_0xf0b4('0x3f')];_0x5bbe34[_0xf0b4('0x48')]=qs[_0xf0b4('0x49')](_0x10bffb[_0xf0b4('0x40')][_0xf0b4('0x49')]);_0x5bbe34[_0xf0b4('0x4a')]=qs[_0xf0b4('0x42')](_['pick'](_0x10bffb[_0xf0b4('0x40')],_0x23bede[_0xf0b4('0x42')]));if(_0x10bffb[_0xf0b4('0x40')][_0xf0b4('0x4c')]){_0x5bbe34['where']=_[_0xf0b4('0x4d')](_0x5bbe34['where'],{'$or':_[_0xf0b4('0x3a')](_0x5bbe34[_0xf0b4('0x43')],function(_0x25bb1a){var _0x490c63={};_0x490c63[_0x25bb1a]={'$like':'%'+_0x10bffb['query'][_0xf0b4('0x4c')]+'%'};return _0x490c63;})});}_0x5bbe34=_[_0xf0b4('0x4d')]({},_0x5bbe34,_0x10bffb['options']);return _0x2e3d24[_0xf0b4('0x5e')](_0x5bbe34);}})[_0xf0b4('0x34')](function(_0x4bcc9a){if(_0x4bcc9a){_0x419202=_0x4bcc9a[_0xf0b4('0x46')];if(!_0x10bffb[_0xf0b4('0x40')][_0xf0b4('0x61')](_0xf0b4('0x47'))){_0x5bbe34[_0xf0b4('0x2e')]=qs[_0xf0b4('0x2e')](_0x10bffb[_0xf0b4('0x40')][_0xf0b4('0x2e')]);_0x5bbe34['offset']=qs[_0xf0b4('0x2d')](_0x10bffb['query']['offset']);}return _0x2e3d24[_0xf0b4('0x5e')](_0x5bbe34);}})[_0xf0b4('0x34')](function(_0x5342bb){if(_0x5342bb){return _0x5342bb?{'count':_0x419202,'rows':_0x5342bb}:null;}})[_0xf0b4('0x34')](respondWithResult(_0x3a1e96,null))[_0xf0b4('0x29')](handleError(_0x3a1e96,null));};exports[_0xf0b4('0x62')]=function(_0x45505f,_0x4c580f,_0x419d51){return db[_0xf0b4('0x3b')][_0xf0b4('0x53')]({'where':{'id':_0x45505f[_0xf0b4('0x56')]['id']}})[_0xf0b4('0x34')](handleEntityNotFound(_0x4c580f,null))[_0xf0b4('0x34')](function(_0x57eac1){if(_0x57eac1){return _0x57eac1['removeMembers'](_0x45505f[_0xf0b4('0x40')][_0xf0b4('0x5d')]);}})['then'](respondWithStatusCode(_0x4c580f,null))[_0xf0b4('0x29')](handleError(_0x4c580f,null));};exports[_0xf0b4('0x63')]=function(_0x535f7d,_0x1d7e91,_0x482bc9){if(_0x535f7d[_0xf0b4('0x55')]['id']){delete _0x535f7d[_0xf0b4('0x55')]['id'];}return db[_0xf0b4('0x3b')][_0xf0b4('0x53')]({'where':{'id':_0x535f7d['params']['id']}})['then'](handleEntityNotFound(_0x1d7e91,null))[_0xf0b4('0x34')](function(_0x4aeb10){if(_0x4aeb10){_0x535f7d[_0xf0b4('0x55')][_0xf0b4('0x64')]=_0x4aeb10['id'];return db[_0xf0b4('0x59')][_0xf0b4('0x54')](_0x535f7d[_0xf0b4('0x55')]);}})['then'](respondWithResult(_0x1d7e91,null))[_0xf0b4('0x29')](handleError(_0x1d7e91,null));};exports['getMessages']=function(_0x1ab8b2,_0x6740cf,_0x2520f4){var _0x3aa946={};var _0x320fe8={};var _0x106b44;var _0x17ffdf;return db[_0xf0b4('0x3b')][_0xf0b4('0x5f')]({'where':{'id':_0x1ab8b2[_0xf0b4('0x56')]['id']}})['then'](handleEntityNotFound(_0x6740cf,null))[_0xf0b4('0x34')](function(_0x5a03c0){if(_0x5a03c0){_0x106b44=_0x5a03c0;_0x320fe8[_0xf0b4('0x3f')]=_[_0xf0b4('0x41')](db['ChatInternalMessage']['rawAttributes']);_0x320fe8[_0xf0b4('0x40')]=_[_0xf0b4('0x41')](_0x1ab8b2[_0xf0b4('0x40')]);_0x320fe8[_0xf0b4('0x42')]=_[_0xf0b4('0x44')](_0x320fe8[_0xf0b4('0x3f')],_0x320fe8[_0xf0b4('0x40')]);_0x3aa946[_0xf0b4('0x43')]=_[_0xf0b4('0x44')](_0x320fe8[_0xf0b4('0x3f')],qs[_0xf0b4('0x45')](_0x1ab8b2[_0xf0b4('0x40')][_0xf0b4('0x45')]));_0x3aa946['attributes']=_0x3aa946[_0xf0b4('0x43')][_0xf0b4('0x46')]?_0x3aa946[_0xf0b4('0x43')]:_0x320fe8[_0xf0b4('0x3f')];_0x3aa946[_0xf0b4('0x48')]=qs[_0xf0b4('0x49')](_0x1ab8b2[_0xf0b4('0x40')][_0xf0b4('0x49')]);_0x3aa946[_0xf0b4('0x4a')]=qs[_0xf0b4('0x42')](_[_0xf0b4('0x4b')](_0x1ab8b2[_0xf0b4('0x40')],_0x320fe8[_0xf0b4('0x42')]));if(_0x1ab8b2['query'][_0xf0b4('0x4c')]){_0x3aa946[_0xf0b4('0x4a')]=_['merge'](_0x3aa946[_0xf0b4('0x4a')],{'$or':_[_0xf0b4('0x3a')](_0x3aa946['attributes'],function(_0x5ccc0b){var _0x16297a={};_0x16297a[_0x5ccc0b]={'$like':'%'+_0x1ab8b2[_0xf0b4('0x40')]['filter']+'%'};return _0x16297a;})});}if(_0x1ab8b2[_0xf0b4('0x40')][_0xf0b4('0x65')]){var _0x2ff6a8=_0x1ab8b2[_0xf0b4('0x40')]['$gte']['split'](',');var _0x5a0af1={};_0x5a0af1[_0x2ff6a8[0x0]]={'$gte':moment(_0x2ff6a8[0x1])[_0xf0b4('0x66')](_0xf0b4('0x67'))};_0x3aa946[_0xf0b4('0x4a')]=_[_0xf0b4('0x4d')](_0x3aa946[_0xf0b4('0x4a')],_0x5a0af1);}_0x3aa946=_[_0xf0b4('0x4d')]({},_0x3aa946,_0x1ab8b2[_0xf0b4('0x4e')]);return _0x106b44[_0xf0b4('0x68')](_0x3aa946);}})[_0xf0b4('0x34')](function(_0x2c02c6){if(_0x2c02c6){_0x17ffdf=_0x2c02c6[_0xf0b4('0x46')];if(!_0x1ab8b2[_0xf0b4('0x40')][_0xf0b4('0x61')](_0xf0b4('0x47'))){_0x3aa946['limit']=qs[_0xf0b4('0x2e')](_0x1ab8b2[_0xf0b4('0x40')][_0xf0b4('0x2e')]);_0x3aa946['offset']=qs[_0xf0b4('0x2d')](_0x1ab8b2['query']['offset']);}return _0x106b44[_0xf0b4('0x68')](_0x3aa946);}})[_0xf0b4('0x34')](function(_0x47cb4c){if(_0x47cb4c){return _0x47cb4c?{'count':_0x17ffdf,'rows':_0x47cb4c}:null;}})[_0xf0b4('0x34')](respondWithResult(_0x6740cf,null))[_0xf0b4('0x29')](handleError(_0x6740cf,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 866f3f5..c42ddc9 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x2860cc,_0x14d7bb){var _0x13c22d=function(_0x35ffc3){while(--_0x35ffc3){_0x2860cc['push'](_0x2860cc['shift']());}};_0x13c22d(++_0x14d7bb);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x65f6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){ChatGroupEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);ChatGroupEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x4a9065,_0x171006){var _0x37c393=function(_0x35504e){while(--_0x35504e){_0x4a9065['push'](_0x4a9065['shift']());}};_0x37c393(++_0x171006);}(_0x5f2f,0x73));var _0xf5f2=function(_0x38baac,_0x2772b3){_0x38baac=_0x38baac-0x0;var _0x47baf1=_0x5f2f[_0x38baac];return _0x47baf1;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatGroup=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatGroupEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatGroupEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatGroup[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 81cc989..7866d51 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 _0x95f4=['ChatGroup','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./chatGroup.attributes','exports','define'];(function(_0x30a22a,_0x28acd1){var _0x7946af=function(_0x5ce08f){while(--_0x5ce08f){_0x30a22a['push'](_0x30a22a['shift']());}};_0x7946af(++_0x28acd1);}(_0x95f4,0xf1));var _0x495f=function(_0x59f3dc,_0x54774f){_0x59f3dc=_0x59f3dc-0x0;var _0x16475b=_0x95f4[_0x59f3dc];return _0x16475b;};'use strict';var _=require(_0x495f('0x0'));var util=require(_0x495f('0x1'));var logger=require(_0x495f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x495f('0x3'));var rp=require(_0x495f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x495f('0x5'));var attributes=require(_0x495f('0x6'));module[_0x495f('0x7')]=function(_0x4a56a5,_0x704a46){return _0x4a56a5[_0x495f('0x8')](_0x495f('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2ef=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util'];(function(_0x511a87,_0xa77c7){var _0x586bdd=function(_0x2b4e17){while(--_0x2b4e17){_0x511a87['push'](_0x511a87['shift']());}};_0x586bdd(++_0xa77c7);}(_0xb2ef,0xa7));var _0xfb2e=function(_0x4a48ae,_0x426da9){_0x4a48ae=_0x4a48ae-0x0;var _0x58599a=_0xb2ef[_0x4a48ae];return _0x58599a;};'use strict';var _=require(_0xfb2e('0x0'));var util=require(_0xfb2e('0x1'));var logger=require(_0xfb2e('0x2'))('api');var moment=require(_0xfb2e('0x3'));var BPromise=require(_0xfb2e('0x4'));var rp=require(_0xfb2e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb2e('0x6'));var config=require(_0xfb2e('0x7'));var attributes=require(_0xfb2e('0x8'));module[_0xfb2e('0x9')]=function(_0x3069a,_0x2a1c23){return _0x3069a[_0xfb2e('0xa')](_0xfb2e('0xb'),attributes,{'tableName':_0xfb2e('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 b47534b..70e53d5 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 _0x73fc=['request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x73fc,0x6a));var _0xc73f=function(_0x26a544,_0x545e36){_0x26a544=_0x26a544-0x0;var _0x535a8c=_0x73fc[_0x26a544];return _0x535a8c;};'use strict';var _=require(_0xc73f('0x0'));var util=require(_0xc73f('0x1'));var moment=require(_0xc73f('0x2'));var BPromise=require(_0xc73f('0x3'));var rs=require(_0xc73f('0x4'));var fs=require('fs');var Redis=require(_0xc73f('0x5'));var db=require(_0xc73f('0x6'))['db'];var utils=require(_0xc73f('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc73f('0x8'));var client=jayson[_0xc73f('0x9')][_0xc73f('0xa')]({'port':0x232a});config['redis']=_[_0xc73f('0xb')](config['redis'],{'host':_0xc73f('0xc'),'port':0x18eb});var socket=require(_0xc73f('0xd'))(new Redis(config['redis']));require(_0xc73f('0xe'))['register'](socket);function respondWithRpcPromise(_0x3705fe,_0x3592e2,_0x2e94ac){return new BPromise(function(_0x4f0de5,_0xc5b056){return client[_0xc73f('0xf')](_0x3705fe,_0x2e94ac)[_0xc73f('0x10')](function(_0x37dccd){logger[_0xc73f('0x11')](_0xc73f('0x12'),_0x3592e2,_0xc73f('0x13'));logger[_0xc73f('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x3592e2,'request\x20sent',JSON['stringify'](_0x37dccd));if(_0x37dccd[_0xc73f('0x15')]){if(_0x37dccd[_0xc73f('0x15')][_0xc73f('0x16')]===0x1f4){logger[_0xc73f('0x15')](_0xc73f('0x12'),_0x3592e2,_0x37dccd[_0xc73f('0x15')][_0xc73f('0x17')]);return _0xc5b056(_0x37dccd[_0xc73f('0x15')][_0xc73f('0x17')]);}logger['error'](_0xc73f('0x12'),_0x3592e2,_0x37dccd['error']['message']);return _0x4f0de5(_0x37dccd[_0xc73f('0x15')]['message']);}else{logger[_0xc73f('0x11')](_0xc73f('0x12'),_0x3592e2,_0xc73f('0x13'));_0x4f0de5(_0x37dccd['result'][_0xc73f('0x17')]);}})[_0xc73f('0x18')](function(_0x9f17a7){logger[_0xc73f('0x15')](_0xc73f('0x12'),_0x3592e2,_0x9f17a7);_0xc5b056(_0x9f17a7);});});} \ No newline at end of file +var _0x8335=['error','ChatGroup,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x1e3377,_0x23fcaf){var _0x279ee8=function(_0x1f1dcf){while(--_0x1f1dcf){_0x1e3377['push'](_0x1e3377['shift']());}};_0x279ee8(++_0x23fcaf);}(_0x8335,0xef));var _0x5833=function(_0x2576ee,_0x1d30e8){_0x2576ee=_0x2576ee-0x0;var _0x4e60d8=_0x8335[_0x2576ee];return _0x4e60d8;};'use strict';var _=require('lodash');var util=require(_0x5833('0x0'));var moment=require(_0x5833('0x1'));var BPromise=require(_0x5833('0x2'));var rs=require(_0x5833('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5833('0x4'));var logger=require(_0x5833('0x5'))(_0x5833('0x6'));var config=require(_0x5833('0x7'));var jayson=require(_0x5833('0x8'));var client=jayson[_0x5833('0x9')][_0x5833('0xa')]({'port':0x232a});config[_0x5833('0xb')]=_[_0x5833('0xc')](config['redis'],{'host':_0x5833('0xd'),'port':0x18eb});var socket=require(_0x5833('0xe'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x5833('0xf')](socket);function respondWithRpcPromise(_0x535bdf,_0x5b85ed,_0x3713df){return new BPromise(function(_0x4e3a83,_0x20c6ff){return client[_0x5833('0x10')](_0x535bdf,_0x3713df)[_0x5833('0x11')](function(_0x156c53){logger[_0x5833('0x12')]('ChatGroup,\x20%s,\x20%s',_0x5b85ed,_0x5833('0x13'));logger['debug'](_0x5833('0x14'),_0x5b85ed,_0x5833('0x13'),JSON['stringify'](_0x156c53));if(_0x156c53['error']){if(_0x156c53[_0x5833('0x15')]['code']===0x1f4){logger['error'](_0x5833('0x16'),_0x5b85ed,_0x156c53[_0x5833('0x15')][_0x5833('0x17')]);return _0x20c6ff(_0x156c53[_0x5833('0x15')][_0x5833('0x17')]);}logger['error'](_0x5833('0x16'),_0x5b85ed,_0x156c53[_0x5833('0x15')][_0x5833('0x17')]);return _0x4e3a83(_0x156c53[_0x5833('0x15')][_0x5833('0x17')]);}else{logger[_0x5833('0x12')](_0x5833('0x16'),_0x5b85ed,_0x5833('0x13'));_0x4e3a83(_0x156c53[_0x5833('0x18')][_0x5833('0x17')]);}})[_0x5833('0x19')](function(_0x380cac){logger[_0x5833('0x15')](_0x5833('0x16'),_0x5b85ed,_0x380cac);_0x20c6ff(_0x380cac);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 7a270be..dc00204 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 _0xde31=['./chatGroup.events','save','remove','update','register','length'];(function(_0x3c68e4,_0x20e968){var _0x2b35e7=function(_0x1732a7){while(--_0x1732a7){_0x3c68e4['push'](_0x3c68e4['shift']());}};_0x2b35e7(++_0x20e968);}(_0xde31,0x126));var _0x1de3=function(_0x21481c,_0x1b51ba){_0x21481c=_0x21481c-0x0;var _0x5dd77a=_0xde31[_0x21481c];return _0x5dd77a;};'use strict';var ChatGroupEvents=require(_0x1de3('0x0'));var events=[_0x1de3('0x1'),_0x1de3('0x2'),_0x1de3('0x3')];function createListener(_0x2ca43b,_0x284e1a){return function(_0xb224db){_0x284e1a['emit'](_0x2ca43b,_0xb224db);};}function removeListener(_0x1b90c2,_0x459dcb){return function(){ChatGroupEvents['removeListener'](_0x1b90c2,_0x459dcb);};}exports[_0x1de3('0x4')]=function(_0x1ddcff){for(var _0xd9ffc6=0x0,_0x42367c=events[_0x1de3('0x5')];_0xd9ffc6<_0x42367c;_0xd9ffc6++){var _0x3def0f=events[_0xd9ffc6];var _0x227034=createListener('chatGroup:'+_0x3def0f,_0x1ddcff);ChatGroupEvents['on'](_0x3def0f,_0x227034);}}; \ No newline at end of file +var _0x42e2=['update','emit','removeListener','length','chatGroup:','save','remove'];(function(_0x4fc421,_0x94e88){var _0x8c6d63=function(_0x5b8b42){while(--_0x5b8b42){_0x4fc421['push'](_0x4fc421['shift']());}};_0x8c6d63(++_0x94e88);}(_0x42e2,0x1e1));var _0x242e=function(_0x4ad4c,_0xac80ae){_0x4ad4c=_0x4ad4c-0x0;var _0x4bd66d=_0x42e2[_0x4ad4c];return _0x4bd66d;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x242e('0x0'),_0x242e('0x1'),_0x242e('0x2')];function createListener(_0x6beafe,_0x2c5e11){return function(_0x239a7e){_0x2c5e11[_0x242e('0x3')](_0x6beafe,_0x239a7e);};}function removeListener(_0x8dfc85,_0x1063a8){return function(){ChatGroupEvents[_0x242e('0x4')](_0x8dfc85,_0x1063a8);};}exports['register']=function(_0x553a9a){for(var _0x27112f=0x0,_0x14c8cb=events[_0x242e('0x5')];_0x27112f<_0x14c8cb;_0x27112f++){var _0xabd16a=events[_0x27112f];var _0x208d5b=createListener(_0x242e('0x6')+_0xabd16a,_0x553a9a);ChatGroupEvents['on'](_0xabd16a,_0x208d5b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index d992646..d033f02 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 _0xecc8=['/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','update','delete','destroy','removeMembers','exports','multer','util','express','Router','../../components/interaction/service','./chatGroup.controller','index','get','/describe','isAuthenticated','describe','/:id'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xecc8,0x1c8));var _0x8ecc=function(_0x2a46b9,_0x1fefae){_0x2a46b9=_0x2a46b9-0x0;var _0x243516=_0xecc8[_0x2a46b9];return _0x243516;};'use strict';var multer=require(_0x8ecc('0x0'));var util=require(_0x8ecc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8ecc('0x2'));var router=express[_0x8ecc('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8ecc('0x4'));var config=require('../../config/environment');var controller=require(_0x8ecc('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x8ecc('0x6')]);router[_0x8ecc('0x7')](_0x8ecc('0x8'),auth[_0x8ecc('0x9')](),controller[_0x8ecc('0xa')]);router['get'](_0x8ecc('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8ecc('0x7')](_0x8ecc('0xc'),auth[_0x8ecc('0x9')](),controller[_0x8ecc('0xd')]);router[_0x8ecc('0x7')](_0x8ecc('0xe'),auth['isAuthenticated'](),controller[_0x8ecc('0xf')]);router[_0x8ecc('0x7')](_0x8ecc('0x10'),auth['isAuthenticated'](),controller[_0x8ecc('0x11')]);router['post']('/',auth[_0x8ecc('0x9')](),controller['create']);router[_0x8ecc('0x12')]('/:id/members',auth[_0x8ecc('0x9')](),controller[_0x8ecc('0x13')]);router['post'](_0x8ecc('0x10'),auth[_0x8ecc('0x9')](),controller[_0x8ecc('0x14')]);router['put'](_0x8ecc('0xb'),auth['isAuthenticated'](),controller[_0x8ecc('0x15')]);router[_0x8ecc('0x16')](_0x8ecc('0xb'),auth[_0x8ecc('0x9')](),controller[_0x8ecc('0x17')]);router[_0x8ecc('0x16')](_0x8ecc('0xe'),auth[_0x8ecc('0x9')](),controller[_0x8ecc('0x18')]);module[_0x8ecc('0x19')]=router; \ No newline at end of file +var _0xd944=['isAuthenticated','index','describe','get','show','/:id/unread','getUnread','/:id/members','getMembers','post','addMembers','/:id/messages','addMessage','/:id','update','delete','destroy','removeMembers','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd944,0x13b));var _0x4d94=function(_0xbdd78d,_0x4da511){_0xbdd78d=_0xbdd78d-0x0;var _0x1c4047=_0xd944[_0xbdd78d];return _0x1c4047;};'use strict';var multer=require(_0x4d94('0x0'));var util=require(_0x4d94('0x1'));var path=require(_0x4d94('0x2'));var timeout=require(_0x4d94('0x3'));var express=require(_0x4d94('0x4'));var router=express[_0x4d94('0x5')]();var auth=require(_0x4d94('0x6'));var interaction=require(_0x4d94('0x7'));var config=require(_0x4d94('0x8'));var controller=require('./chatGroup.controller');router['get']('/',auth[_0x4d94('0x9')](),controller[_0x4d94('0xa')]);router['get']('/describe',auth[_0x4d94('0x9')](),controller[_0x4d94('0xb')]);router[_0x4d94('0xc')]('/:id',auth[_0x4d94('0x9')](),controller[_0x4d94('0xd')]);router[_0x4d94('0xc')](_0x4d94('0xe'),auth[_0x4d94('0x9')](),controller[_0x4d94('0xf')]);router['get'](_0x4d94('0x10'),auth[_0x4d94('0x9')](),controller[_0x4d94('0x11')]);router[_0x4d94('0xc')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['post']('/',auth[_0x4d94('0x9')](),controller['create']);router[_0x4d94('0x12')](_0x4d94('0x10'),auth['isAuthenticated'](),controller[_0x4d94('0x13')]);router[_0x4d94('0x12')](_0x4d94('0x14'),auth[_0x4d94('0x9')](),controller[_0x4d94('0x15')]);router['put'](_0x4d94('0x16'),auth[_0x4d94('0x9')](),controller[_0x4d94('0x17')]);router[_0x4d94('0x18')](_0x4d94('0x16'),auth[_0x4d94('0x9')](),controller[_0x4d94('0x19')]);router[_0x4d94('0x18')](_0x4d94('0x10'),auth[_0x4d94('0x9')](),controller[_0x4d94('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 005c3da..cc4f543 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 _0xd390=['out','sequelize','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long'];(function(_0x43a3ba,_0x2afdec){var _0x396e25=function(_0x45d538){while(--_0x45d538){_0x43a3ba['push'](_0x43a3ba['shift']());}};_0x396e25(++_0x2afdec);}(_0xd390,0xdd));var _0x0d39=function(_0x36e4aa,_0x12b01a){_0x36e4aa=_0x36e4aa-0x0;var _0x1d99e5=_0xd390[_0x36e4aa];return _0x1d99e5;};'use strict';var Sequelize=require(_0x0d39('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x0d39('0x1')]},'ratingType':{'type':Sequelize[_0x0d39('0x2')](_0x0d39('0x3'),_0x0d39('0x4')),'defaultValue':_0x0d39('0x3')},'ratingMessage':{'type':Sequelize[_0x0d39('0x5')]},'pathTranscript':{'type':Sequelize[_0x0d39('0x5')]},'mailTranscript':{'type':Sequelize[_0x0d39('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x0d39('0x7')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0d39('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x0d39('0x6')]},'osName':{'type':Sequelize[_0x0d39('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x0d39('0x6')]},'deviceVendor':{'type':Sequelize[_0x0d39('0x6')]},'deviceType':{'type':Sequelize[_0x0d39('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x0d39('0x6')]},'formData':{'type':Sequelize[_0x0d39('0x5')](_0x0d39('0x8'))},'read1stAt':{'type':Sequelize[_0x0d39('0x7')]},'lastMsgAt':{'type':Sequelize[_0x0d39('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x0d39('0x2')]('in',_0x0d39('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x0d39('0x6')]}}; \ No newline at end of file +var _0x2b37=['BOOLEAN','ENUM','star','TEXT','STRING','DATE','long','sequelize','exports'];(function(_0xaeb128,_0x3401f3){var _0x3cf3fc=function(_0x3f5328){while(--_0x3f5328){_0xaeb128['push'](_0xaeb128['shift']());}};_0x3cf3fc(++_0x3401f3);}(_0x2b37,0xa0));var _0x72b3=function(_0x5f2a0d,_0x2425ed){_0x5f2a0d=_0x5f2a0d-0x0;var _0x73601a=_0x2b37[_0x5f2a0d];return _0x73601a;};'use strict';var Sequelize=require(_0x72b3('0x0'));module[_0x72b3('0x1')]={'closed':{'type':Sequelize[_0x72b3('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x72b3('0x3')]('star','thumb'),'defaultValue':_0x72b3('0x4')},'ratingMessage':{'type':Sequelize[_0x72b3('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x72b3('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x72b3('0x7')]},'disposition':{'type':Sequelize[_0x72b3('0x6')]},'note':{'type':Sequelize[_0x72b3('0x6')]},'browserName':{'type':Sequelize[_0x72b3('0x6')]},'browserVersion':{'type':Sequelize[_0x72b3('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x72b3('0x6')]},'deviceModel':{'type':Sequelize[_0x72b3('0x6')]},'deviceVendor':{'type':Sequelize[_0x72b3('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x72b3('0x6')]},'formData':{'type':Sequelize[_0x72b3('0x5')](_0x72b3('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x72b3('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x72b3('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x72b3('0x6')]},'customerPort':{'type':Sequelize[_0x72b3('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index ff4eb64..655103f 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 _0x2eb2=['Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','rows','show','includeAll','include','options','create','params','describe','customUpdate','abandon','entity\x20not\x20found','sendStatus','Sequelize','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','originalname','basename','filename','file','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','download','join','root','server/files/attachments/','mailTranscript','transcript-%s.txt','ChatMessage','User','ChatWebsite','Messages','%s%d','format','Visitor','agentIdentifier','website_alias','agentAlias','System','alias','[%s]\x20%s:\x20%s\x0a','findOne','Smtp','service','host','port','secure','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','nolimit','sort','$gte','findAll','getMyMessages','secret','includeAgent','addTags','setTags','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','files','tmp','server','attachments','transcript-%d-%s.zip','CmContact','lastName','direction','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','%s\x20#%d','Chat','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','firstName','read','renderFile','views','toFile','transcript-','.pdf','log','err','unlinkSync','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','defaults','redis','localhost','socket.io-emitter','register','client','http','ValidationError','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','end','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','stack','name','Users','map','fullname','TagIds','Tags','forEach','push','index','ChatInteraction','rawAttributes','type','key','filters','intersection','attributes','model','fields','query','hasOwnProperty','order','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','value','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','buildExpression','keys','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','`unreadMessages`\x20=\x200','tag','isArray','filter','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.mobile'];(function(_0x2fea45,_0x12b8c2){var _0x120133=function(_0x3f2507){while(--_0x3f2507){_0x2fea45['push'](_0x2fea45['shift']());}};_0x120133(++_0x12b8c2);}(_0x2eb2,0x19f));var _0x22eb=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x2eb2[_0x334841];return _0x5beb4b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x22eb('0x0'));var rimraf=require(_0x22eb('0x1'));var zipdir=require(_0x22eb('0x2'));var jsonpatch=require(_0x22eb('0x3'));var rp=require(_0x22eb('0x4'));var moment=require(_0x22eb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x22eb('0x6'));var util=require('util');var path=require('path');var sox=require(_0x22eb('0x7'));var csv=require(_0x22eb('0x8'));var ejs=require(_0x22eb('0x9'));var fs=require('fs');var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x8'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x22eb('0x16')](config[_0x22eb('0x17')],{'host':_0x22eb('0x18'),'port':0x18eb});var socket=require(_0x22eb('0x19'))(new Redis(config[_0x22eb('0x17')]));require('./chatInteraction.socket')[_0x22eb('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x22eb('0x1b')]['http']({'port':0x232b});var client9004=jayson[_0x22eb('0x1b')][_0x22eb('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x53abbf,_0x48b63c,_0x4bc29a){if(_0x4bc29a){var _0x2ed8a7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ed8a7['test'](_0x48b63c)){return _0x53abbf;}else{throw new db['Sequelize'][(_0x22eb('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x53abbf;}}function respondWithRpcPromise(_0x4d9b09,_0xb7a73a,_0x2a55e4,_0x385bcb){return new BPromise(function(_0x1ff041,_0x3b0940){var _0x4bc0a2=_0x385bcb||client;return _0x4bc0a2[_0x22eb('0x1e')](_0x4d9b09,_0x2a55e4)[_0x22eb('0x1f')](function(_0x10d182){logger[_0x22eb('0x20')](_0x22eb('0x21'),_0xb7a73a,'request\x20sent');logger[_0x22eb('0x22')](_0x22eb('0x23'),_0xb7a73a,_0x22eb('0x24'),JSON['stringify'](_0x10d182));if(_0x10d182['error']){if(_0x10d182[_0x22eb('0x25')][_0x22eb('0x26')]===0x1f4){logger[_0x22eb('0x25')](_0x22eb('0x21'),_0xb7a73a,_0x10d182[_0x22eb('0x25')][_0x22eb('0x27')]);return _0x3b0940(_0x10d182[_0x22eb('0x25')]['message']);}logger[_0x22eb('0x25')](_0x22eb('0x21'),_0xb7a73a,_0x10d182[_0x22eb('0x25')][_0x22eb('0x27')]);return _0x1ff041(_0x10d182[_0x22eb('0x25')]['message']);}else{logger[_0x22eb('0x20')](_0x22eb('0x21'),_0xb7a73a,_0x22eb('0x24'));_0x1ff041(_0x10d182['result'][_0x22eb('0x27')]);}})[_0x22eb('0x28')](function(_0x4b409a){logger[_0x22eb('0x25')](_0x22eb('0x21'),_0xb7a73a,_0x4b409a);_0x3b0940(_0x4b409a);});});}function respondWithStatusCode(_0x1e3015,_0x2924f6){_0x2924f6=_0x2924f6||0xcc;return function(_0x2da5c6){if(_0x2da5c6){return _0x1e3015['sendStatus'](_0x2924f6);}return _0x1e3015['status'](_0x2924f6)[_0x22eb('0x29')]();};}function respondWithResult(_0x25e5bc,_0x44cf91){_0x44cf91=_0x44cf91||0xc8;return function(_0x7c0119){if(_0x7c0119){return _0x25e5bc[_0x22eb('0x2a')](_0x44cf91)[_0x22eb('0x2b')](_0x7c0119);}};}function respondWithFilteredResult(_0x2375e7,_0x13814f){return function(_0x382784){if(_0x382784){var _0x39cec1=_0x382784[_0x22eb('0x2c')],_0x24e9dc=_0x13814f['offset'],_0x5a37f8=_0x13814f[_0x22eb('0x2d')]+_0x13814f[_0x22eb('0x2e')],_0x54f401;if(_0x5a37f8>=_0x39cec1){_0x5a37f8=_0x39cec1;_0x54f401=0xc8;}else{_0x54f401=0xce;}_0x2375e7[_0x22eb('0x2a')](_0x54f401);return _0x2375e7[_0x22eb('0x2f')](_0x22eb('0x30'),_0x24e9dc+'-'+_0x5a37f8+'/'+_0x39cec1)[_0x22eb('0x2b')](_0x382784);}return null;};}function patchUpdates(_0x35fb89){return function(_0x476cdb){try{jsonpatch[_0x22eb('0x31')](_0x476cdb,_0x35fb89,!![]);}catch(_0x232af4){return BPromise['reject'](_0x232af4);}return _0x476cdb['save']();};}function saveUpdates(_0x239a41,_0x5ceec1){return function(_0x55ee20){if(_0x55ee20){return _0x55ee20[_0x22eb('0x32')](_0x239a41)[_0x22eb('0x1f')](function(_0x39dbc6){return _0x39dbc6;});}return null;};}function removeEntity(_0x478289,_0x45c53e){return function(_0x332e9a){if(_0x332e9a){return _0x332e9a[_0x22eb('0x33')]()[_0x22eb('0x1f')](function(){_0x478289[_0x22eb('0x2a')](0xcc)[_0x22eb('0x29')]();});}};}function handleEntityNotFound(_0x5e8167,_0x9c8193){return function(_0x47be01){if(!_0x47be01){_0x5e8167['sendStatus'](0x194);}return _0x47be01;};}function handleError(_0x35a264,_0x2b5cb5){_0x2b5cb5=_0x2b5cb5||0x1f4;return function(_0x48e47e){logger[_0x22eb('0x25')](_0x48e47e[_0x22eb('0x34')]);if(_0x48e47e[_0x22eb('0x35')]){delete _0x48e47e[_0x22eb('0x35')];}_0x35a264[_0x22eb('0x2a')](_0x2b5cb5)['send'](_0x48e47e);};}function getInteractionUsers(_0x25f140,_0x1aea5f){return new BPromise(function(_0x5b8f98,_0x2170d4){try{if(_0x1aea5f[_0x25f140['id']]){_0x25f140[_0x22eb('0x36')]=_[_0x22eb('0x37')](_0x1aea5f[_0x25f140['id']],function(_0x2cc77c){return{'id':_0x2cc77c['id'],'fullname':_0x2cc77c[_0x22eb('0x38')]};});}}catch(_0x5382eb){_0x2170d4(_0x5382eb);}_0x5b8f98(_0x25f140);});}function getInteractionTags(_0x51c8b5,_0x2b1ae1){return new BPromise(function(_0x6cd651,_0x541153){try{if(_0x51c8b5[_0x22eb('0x39')]){_0x51c8b5[_0x22eb('0x3a')]=[];_0x51c8b5[_0x22eb('0x39')]['split'](',')[_0x22eb('0x3b')](function(_0x3377eb){_0x51c8b5[_0x22eb('0x3a')][_0x22eb('0x3c')](_0x2b1ae1[_0x3377eb]);});}delete _0x51c8b5[_0x22eb('0x39')];}catch(_0x39778e){_0x541153(_0x39778e);}_0x6cd651(_0x51c8b5);});}function updateChatInteraction(_0x513b65,_0x17d393,_0x3d2d1d){return new BPromise(function(_0x515b6d,_0x24ad2a){return getInteractionUsers(_0x513b65,_0x3d2d1d)[_0x22eb('0x1f')](function(_0x204092){return getInteractionTags(_0x204092,_0x17d393);})[_0x22eb('0x1f')](function(_0x18c6ed){_0x515b6d(_0x18c6ed);})[_0x22eb('0x28')](function(_0x1ff04a){_0x24ad2a(_0x1ff04a);});});}exports[_0x22eb('0x3d')]=function(_0x1bafa3,_0x82ace8){var _0x3e1826={},_0x1cf1e0={},_0x14cf61={'count':0x0,'rows':[]};var _0x27855c=_[_0x22eb('0x37')](db[_0x22eb('0x3e')][_0x22eb('0x3f')],function(_0x46e3ec){return{'name':_0x46e3ec['fieldName'],'type':_0x46e3ec[_0x22eb('0x40')][_0x22eb('0x41')]};});_0x1cf1e0['model']=_[_0x22eb('0x37')](_0x27855c,_0x22eb('0x35'));_0x1cf1e0['query']=_['keys'](_0x1bafa3['query']);_0x1cf1e0[_0x22eb('0x42')]=_[_0x22eb('0x43')](_0x1cf1e0['model'],_0x1cf1e0['query']);_0x3e1826[_0x22eb('0x44')]=_[_0x22eb('0x43')](_0x1cf1e0[_0x22eb('0x45')],qs[_0x22eb('0x46')](_0x1bafa3[_0x22eb('0x47')][_0x22eb('0x46')]));_0x3e1826[_0x22eb('0x44')]=_0x3e1826[_0x22eb('0x44')]['length']?_0x3e1826['attributes']:_0x1cf1e0[_0x22eb('0x45')];if(!_0x1bafa3['query'][_0x22eb('0x48')]('nolimit')){_0x3e1826[_0x22eb('0x2e')]=qs['limit'](_0x1bafa3['query']['limit']);_0x3e1826['offset']=qs[_0x22eb('0x2d')](_0x1bafa3['query'][_0x22eb('0x2d')]);}_0x3e1826[_0x22eb('0x49')]=qs['sort'](_0x1bafa3[_0x22eb('0x47')]['sort']);_0x3e1826[_0x22eb('0x4a')]=qs[_0x22eb('0x42')](_[_0x22eb('0x4b')](_0x1bafa3[_0x22eb('0x47')],_0x1cf1e0[_0x22eb('0x42')]));var _0x2891ac=[];var _0xc26ad7=squel[_0x22eb('0x4c')]()[_0x22eb('0x4d')]('id')['field'](_0x22eb('0x35'))[_0x22eb('0x4d')]('color')[_0x22eb('0x4e')](_0x22eb('0x4f'));var _0x4da671=squel[_0x22eb('0x4c')]()['field'](_0x22eb('0x50'))[_0x22eb('0x4d')](_0x22eb('0x51'))[_0x22eb('0x4d')](_0x22eb('0x52'))[_0x22eb('0x4e')]('user_has_chat_interactions','ui')[_0x22eb('0x53')]('users','u',_0x22eb('0x54'));var _0x5eecef=squel[_0x22eb('0x4c')]()[_0x22eb('0x4e')](_0x22eb('0x55'),'i')[_0x22eb('0x53')](_0x22eb('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x22eb('0x57'),'o',_0x22eb('0x58'))['left_join'](_0x22eb('0x59'),'a',_0x22eb('0x5a'))[_0x22eb('0x53')](_0x22eb('0x5b'),'me',_0x22eb('0x5c'))[_0x22eb('0x53')](_0x22eb('0x5d'),'it',_0x22eb('0x5e'))[_0x22eb('0x53')](_0x22eb('0x4f'),'t',_0x22eb('0x5f'));var _0x5f30c9=squel[_0x22eb('0x60')]();var _0x462f06=[];var _0x3764d4=squel[_0x22eb('0x60')]();var _0x45c682;if(_0x1bafa3[_0x22eb('0x47')][_0x22eb('0x61')]){_0x45c682=as[_0x22eb('0x62')](_0x1bafa3[_0x22eb('0x47')][_0x22eb('0x61')]);var _0x3e9ab5=_0x45c682[_0x22eb('0x63')];for(var _0x38d5aa=0x0;_0x38d5aa<_0x45c682[_0x22eb('0x64')]['length'];_0x38d5aa++){var _0x597497=_0x45c682[_0x22eb('0x64')][_0x38d5aa];var _0x91c8a3='i';var _0x165e79=_[_0x22eb('0x65')](_0x27855c,[_0x22eb('0x35'),_0x597497['field']]);if(!_0x165e79){switch(_0x597497[_0x22eb('0x4d')]){case _0x22eb('0x66'):if(_0x597497['value']==0x1){_0x5eecef['having']('`'+_0x597497[_0x22eb('0x4d')]+_0x22eb('0x67'));}else{_0x5eecef[_0x22eb('0x68')]('`'+_0x597497[_0x22eb('0x4d')]+_0x22eb('0x69'));}break;case _0x22eb('0x6a'):if(_0x597497[_0x22eb('0x6b')]===_0x22eb('0x6c')){if(_0x597497[_0x22eb('0x6d')][_0x22eb('0x6e')]('\x20')[_0x22eb('0x6f')]>0x1){_0x5f30c9[_0x3e9ab5](_0x22eb('0x70'),qs[_0x22eb('0x71')](_0x597497[_0x22eb('0x6d')]),null);}else{var _0x4aea9d='%'+_0x597497[_0x22eb('0x6d')]+'%';_0x5f30c9[_0x3e9ab5](_0x22eb('0x72'),_0x4aea9d,_0x4aea9d,_0x4aea9d);}}else{_0x165e79=_[_0x22eb('0x65')](_0x27855c,['name',_0x22eb('0x73')]);_0x597497['field']=_0x22eb('0x73');_0x5e46b0=as['buildExpression'](_0x91c8a3,_0x165e79[_0x22eb('0x40')],_0x597497);_0x5f30c9[_0x3e9ab5](_0x5e46b0[_0x22eb('0x74')],_0x5e46b0['value'][_0x22eb('0x75')],_0x5e46b0[_0x22eb('0x6d')]['end']);}break;case'Tag':var _0x32819b=_0x597497[_0x22eb('0x6d')][_0x22eb('0x6e')](',')[_0x22eb('0x37')](function(_0x3468ca){return Number(_0x3468ca);});_0x32819b[_0x22eb('0x3b')](function(_0x4f5eee){_0x3764d4['or'](_0x22eb('0x76'),'%,'+_0x4f5eee+',%');});_0x462f06=_['union'](_0x462f06,_0x32819b);break;case'User':if(_0x597497[_0x22eb('0x6b')]===_0x22eb('0x6c')){_0x5f30c9[_0x3e9ab5](_0x22eb('0x77'),'%'+_0x597497[_0x22eb('0x6d')]+'%',null);}else{_0x165e79=_[_0x22eb('0x65')](_0x27855c,[_0x22eb('0x35'),_0x22eb('0x78')]);_0x597497[_0x22eb('0x4d')]='UserId';_0x5e46b0=as['buildExpression'](_0x91c8a3,_0x165e79[_0x22eb('0x40')],_0x597497);_0x5f30c9[_0x3e9ab5](_0x5e46b0[_0x22eb('0x74')],_0x5e46b0['value'][_0x22eb('0x75')],_0x5e46b0[_0x22eb('0x6d')][_0x22eb('0x29')]);}break;case _0x22eb('0x79'):_0x5e46b0=as[_0x22eb('0x7a')]('me',null,_0x597497);_0x5f30c9[_0x3e9ab5](_0x5e46b0[_0x22eb('0x74')],_0x5e46b0['value'][_0x22eb('0x75')],_0x5e46b0[_0x22eb('0x6d')][_0x22eb('0x29')]);break;}}else{var _0x5e46b0=as['buildExpression'](_0x91c8a3,_0x165e79[_0x22eb('0x40')],_0x597497);_0x5f30c9[_0x3e9ab5](_0x5e46b0[_0x22eb('0x74')],_0x5e46b0[_0x22eb('0x6d')]['start'],_0x5e46b0[_0x22eb('0x6d')]['end']);}}}else{var _0x1a305d=_(_0x1bafa3[_0x22eb('0x47')])[_0x22eb('0x7b')]()[_0x22eb('0x37')](function(_0x5703ab){return _[_0x22eb('0x7c')](_0x27855c,[_0x22eb('0x35'),_0x5703ab])?_0x5703ab:undefined;})[_0x22eb('0x7d')]()[_0x22eb('0x6d')]();if(!_[_0x22eb('0x7e')](_0x1a305d)){_0x1a305d[_0x22eb('0x3b')](function(_0x24c150){if(_0x24c150===_0x22eb('0x7f')){_0x5eecef[_0x22eb('0x4a')](_0x22eb('0x80'),[][_0x22eb('0x81')](_0x1bafa3['query'][_0x24c150]));}else if(_0x24c150===_0x22eb('0x82')){var _0x3d8abf=JSON['parse'](_0x1bafa3['query'][_0x24c150])['$gte'];var _0x257c48=JSON[_0x22eb('0x83')](_0x1bafa3['query'][_0x24c150])[_0x22eb('0x84')];_0x5eecef[_0x22eb('0x4a')](_0x22eb('0x85'),_0x3d8abf,_0x257c48);}else{if(_0x1bafa3[_0x22eb('0x47')][_0x24c150]===_0x22eb('0x86')){_0x5eecef['where']('i.'+_0x24c150+'\x20IS\x20NULL');}else{_0x5eecef[_0x22eb('0x4a')]('i.'+_0x24c150+_0x22eb('0x87'),_0x1bafa3[_0x22eb('0x47')][_0x24c150]);}}});}if(_0x1bafa3['query']['read']){if(_0x1bafa3[_0x22eb('0x47')]['read']==0x1){_0x5eecef['having'](_0x22eb('0x88'));}else{_0x5eecef[_0x22eb('0x68')]('`unreadMessages`\x20>\x200');}}if(_0x1bafa3['query'][_0x22eb('0x89')]){_0x462f06=_[_0x22eb('0x8a')](_0x1bafa3['query'][_0x22eb('0x89')])?_0x1bafa3[_0x22eb('0x47')][_0x22eb('0x89')]:new Array(_0x1bafa3['query'][_0x22eb('0x89')]);_0x462f06[_0x22eb('0x3b')](function(_0x26a311){_0x3764d4['or'](_0x22eb('0x76'),'%,'+_0x26a311+',%');});}if(_0x1bafa3[_0x22eb('0x47')]['filter']){var _0x9147e2=_0x1bafa3[_0x22eb('0x47')][_0x22eb('0x8b')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x22eb('0x8c'));if(qs[_0x22eb('0x8d')](_0x9147e2)){_0x5f30c9['or'](_0x22eb('0x8e'),_0x9147e2+'%');}else{_0x5f30c9['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x22eb('0x71')](_0x9147e2))['or'](_0x22eb('0x8f'),_0x9147e2+'%');}}}_0x5eecef[_0x22eb('0x4a')](_0x5f30c9);_0x5eecef['group'](_0x22eb('0x90'));var _0x48fc8e={'type':db['Sequelize'][_0x22eb('0x91')][_0x22eb('0x92')],'raw':!![]};var _0x1057f2=_0x5eecef['clone']();_0x1057f2[_0x22eb('0x4d')](_0x22eb('0x90'));_0x1057f2[_0x22eb('0x4d')](_0x22eb('0x93'),_0x22eb('0x66'));if(_0x3e1826['order']){_0x3e1826[_0x22eb('0x49')]['forEach'](function(_0x36dde2){_0x5eecef[_0x22eb('0x49')]('i.'+_0x36dde2[0x0],_0x36dde2[0x1]===_0x22eb('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x462f06)){_0x5eecef[_0x22eb('0x68')](_0x3764d4);_0x1057f2[_0x22eb('0x4a')](_0x22eb('0x95'),_0x462f06);}BPromise[_0x22eb('0x96')]()[_0x22eb('0x1f')](function(){if(!_0x45c682){if(_0x1bafa3[_0x22eb('0x47')][_0x22eb('0x7f')]||_0x1bafa3[_0x22eb('0x47')][_0x22eb('0x97')])return;_0x1057f2[_0x22eb('0x4a')](_0x22eb('0x98'));_0x5eecef['where'](_0x22eb('0x98'));return;}return _0x1bafa3[_0x22eb('0x99')][_0x22eb('0x9a')]({'attributes':['id'],'raw':!![]})[_0x22eb('0x1f')](function(_0x4a5412){if(_[_0x22eb('0x7e')](_0x4a5412)){_0x1057f2[_0x22eb('0x4a')]('i.ChatWebsiteId\x20IS\x20NULL');_0x5eecef[_0x22eb('0x4a')](_0x22eb('0x9b'));}else{_0x1057f2[_0x22eb('0x4a')](_0x22eb('0x80'),_[_0x22eb('0x37')](_0x4a5412,'id'));_0x5eecef[_0x22eb('0x4a')](_0x22eb('0x80'),_['map'](_0x4a5412,'id'));}});})[_0x22eb('0x1f')](function(){db[_0x22eb('0x9c')]['query'](_0x1057f2['toString'](),_0x48fc8e)[_0x22eb('0x1f')](function(_0x31c40a){_0x14cf61[_0x22eb('0x2c')]=_0x31c40a[_0x22eb('0x6f')];if(_0x14cf61[_0x22eb('0x2c')]===0x0)return[];return db['sequelize']['query'](_0xc26ad7[_0x22eb('0x9d')](),_0x48fc8e)[_0x22eb('0x1f')](function(_0x5cf5e5){_0x2891ac=_[_0x22eb('0x9e')](_0x5cf5e5,'id');_0x48fc8e=_[_0x22eb('0x9f')](_0x48fc8e,{'model':db[_0x22eb('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1bafa3['query'][_0x22eb('0x46')]){_0x3e1826[_0x22eb('0x44')][_0x22eb('0x3b')](function(_0x402c2c){_0x5eecef[_0x22eb('0x4d')]('i.'+_0x402c2c);});}else{_0x5eecef[_0x22eb('0x4d')](_0x22eb('0x93'),_0x22eb('0x66'));_0x5eecef['field']('a.key','Account.key');_0x5eecef[_0x22eb('0x4d')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x5eecef[_0x22eb('0x4d')](_0x22eb('0xa0'));_0x5eecef['field'](_0x22eb('0xa1'),_0x22eb('0xa2'));_0x5eecef[_0x22eb('0x4d')](_0x22eb('0xa3'),'Contact.lastName');_0x5eecef[_0x22eb('0x4d')](_0x22eb('0xa4'),_0x22eb('0xa5'));_0x5eecef['field']('c.phone','Contact.phone');_0x5eecef[_0x22eb('0x4d')](_0x22eb('0xa6'),_0x22eb('0xa7'));_0x5eecef['field'](_0x22eb('0xa8'),'Contact.fax');_0x5eecef['field'](_0x22eb('0xa9'),_0x22eb('0xaa'));_0x5eecef['field']('o.internal',_0x22eb('0xab'));_0x5eecef[_0x22eb('0x4d')](_0x22eb('0xac'),_0x22eb('0x39'));}_0x5eecef[_0x22eb('0x2e')](_0x3e1826['limit']);_0x5eecef['offset'](_0x3e1826[_0x22eb('0x2d')]);return db[_0x22eb('0x9c')][_0x22eb('0x47')](_0x5eecef['toString'](),_0x48fc8e);})[_0x22eb('0x1f')](function(_0x5524dc){_0x4da671['where'](_0x22eb('0xad'),_[_0x22eb('0x37')](_0x5524dc,'id'));return db['sequelize'][_0x22eb('0x47')](_0x4da671['toString'](),_0x48fc8e)[_0x22eb('0x1f')](function(_0x53c585){var _0x2b0f2a=_['groupBy'](_0x53c585,_0x22eb('0xae'));var _0x3b8f42=[];_0x5524dc[_0x22eb('0x3b')](function(_0x461803){_0x3b8f42[_0x22eb('0x3c')](updateChatInteraction(_0x461803,_0x2891ac,_0x2b0f2a));});return BPromise['all'](_0x3b8f42);});});})[_0x22eb('0x1f')](function(_0x5eaacd){_0x14cf61[_0x22eb('0xaf')]=_0x5eaacd;return _0x14cf61;})[_0x22eb('0x1f')](respondWithFilteredResult(_0x82ace8,_0x3e1826));})[_0x22eb('0x28')](handleError(_0x82ace8,null));};exports[_0x22eb('0xb0')]=function(_0x2ecd26,_0x29931e){var _0x5c8aaf={'raw':![],'where':{'id':_0x2ecd26['params']['id']}},_0x1ec475={};_0x1ec475['model']=_[_0x22eb('0x7b')](db[_0x22eb('0x3e')][_0x22eb('0x3f')]);_0x1ec475['query']=_['keys'](_0x2ecd26[_0x22eb('0x47')]);_0x1ec475['filters']=_[_0x22eb('0x43')](_0x1ec475[_0x22eb('0x45')],_0x1ec475[_0x22eb('0x47')]);_0x5c8aaf[_0x22eb('0x44')]=_[_0x22eb('0x43')](_0x1ec475[_0x22eb('0x45')],qs[_0x22eb('0x46')](_0x2ecd26[_0x22eb('0x47')][_0x22eb('0x46')]));_0x5c8aaf['attributes']=_0x5c8aaf[_0x22eb('0x44')][_0x22eb('0x6f')]?_0x5c8aaf[_0x22eb('0x44')]:_0x1ec475[_0x22eb('0x45')];if(_0x2ecd26[_0x22eb('0x47')][_0x22eb('0xb1')]){_0x5c8aaf[_0x22eb('0xb2')]=[{'all':!![]}];}_0x5c8aaf=_[_0x22eb('0x9f')]({},_0x5c8aaf,_0x2ecd26[_0x22eb('0xb3')]);return db[_0x22eb('0x3e')]['find'](_0x5c8aaf)[_0x22eb('0x1f')](handleEntityNotFound(_0x29931e,null))['then'](respondWithResult(_0x29931e,null))[_0x22eb('0x28')](handleError(_0x29931e,null));};exports[_0x22eb('0xb4')]=function(_0x30a229,_0x411564){return db[_0x22eb('0x3e')]['create'](_0x30a229[_0x22eb('0x79')],{})[_0x22eb('0x1f')](respondWithResult(_0x411564,0xc9))[_0x22eb('0x28')](handleError(_0x411564,null));};exports[_0x22eb('0x32')]=function(_0x30b501,_0x3a8335){if(_0x30b501[_0x22eb('0x79')]['id']){delete _0x30b501['body']['id'];}return db[_0x22eb('0x3e')][_0x22eb('0x65')]({'where':{'id':_0x30b501[_0x22eb('0xb5')]['id']}})[_0x22eb('0x1f')](handleEntityNotFound(_0x3a8335,null))['then'](saveUpdates(_0x30b501[_0x22eb('0x79')],null))[_0x22eb('0x1f')](respondWithResult(_0x3a8335,null))[_0x22eb('0x28')](handleError(_0x3a8335,null));};exports[_0x22eb('0x33')]=function(_0xba0348,_0x2e4de7){return db[_0x22eb('0x3e')]['find']({'where':{'id':_0xba0348[_0x22eb('0xb5')]['id']}})[_0x22eb('0x1f')](handleEntityNotFound(_0x2e4de7,null))[_0x22eb('0x1f')](removeEntity(_0x2e4de7,null))[_0x22eb('0x28')](handleError(_0x2e4de7,null));};exports[_0x22eb('0xb6')]=function(_0x358f63,_0x26cd7b){return db['ChatInteraction']['describe']()[_0x22eb('0x1f')](respondWithResult(_0x26cd7b,null))['catch'](handleError(_0x26cd7b,null));};exports[_0x22eb('0xb7')]=function(_0x4c38a2,_0x495c09){if(_0x4c38a2[_0x22eb('0x79')]['id']){delete _0x4c38a2[_0x22eb('0x79')]['id'];}return db[_0x22eb('0x3e')][_0x22eb('0x65')]({'where':{'id':_0x4c38a2['params']['id']}})[_0x22eb('0x1f')](handleEntityNotFound(_0x495c09,null))[_0x22eb('0x1f')](saveUpdates(_0x4c38a2[_0x22eb('0x79')],null))['then'](respondWithResult(_0x495c09,null))[_0x22eb('0x28')](handleError(_0x495c09,null));};exports[_0x22eb('0xb8')]=function(_0x2030c1,_0x315a73,_0xc80612){if(_0x2030c1['body']['id']){delete _0x2030c1[_0x22eb('0x79')]['id'];}return db[_0x22eb('0x3e')][_0x22eb('0x65')]({'where':{'id':_0x2030c1[_0x22eb('0xb5')]['id']}})['then'](function(_0xc4a67b){if(!_0xc4a67b){logger[_0x22eb('0x25')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x22eb('0xb8'),0x194,_0x22eb('0xb9'));_0x315a73[_0x22eb('0xba')](0x194);}else{if(_0xc4a67b[_0x22eb('0x78')]){throw new db[(_0x22eb('0xbb'))][(_0x22eb('0x1d'))](_0x22eb('0xbc'));}}return _0xc4a67b;})[_0x22eb('0x1f')](function(_0x201a17){if(_0x201a17){return _0x201a17['update']({'closed':_0x2030c1[_0x22eb('0x79')][_0x22eb('0xbd')],'disposition':_0x2030c1[_0x22eb('0x79')][_0x22eb('0xbe')]})['then'](function(_0x4c7b08){return _0x4c7b08;});}})[_0x22eb('0x1f')](function(_0x57a334){return respondWithRpcPromise('AbandonInteraction',_0x22eb('0xb8'),_0x2030c1[_0x22eb('0x79')],client9004);})[_0x22eb('0x1f')](respondWithResult(_0x315a73,null))[_0x22eb('0x28')](handleError(_0x315a73,null));};exports[_0x22eb('0xbf')]=function(_0x44d9d5,_0x5cf6ee,_0x152919){_0x44d9d5[_0x22eb('0x79')][_0x22eb('0x35')]=_0x44d9d5['file'][_0x22eb('0xc0')];_0x44d9d5['body'][_0x22eb('0xc1')]=_0x44d9d5['file'][_0x22eb('0xc2')];_0x44d9d5['body'][_0x22eb('0x40')]=_0x44d9d5[_0x22eb('0xc3')][_0x22eb('0xc4')];return db[_0x22eb('0xc5')][_0x22eb('0xb4')](_0x44d9d5[_0x22eb('0x79')])[_0x22eb('0x1f')](respondWithResult(_0x5cf6ee,0xc9))[_0x22eb('0x28')](handleError(_0x5cf6ee,null));};exports[_0x22eb('0xc6')]=function(_0x23d2a3,_0x5020e2,_0x120a7a){return db[_0x22eb('0x3e')]['findOne']({'where':{'id':_0x23d2a3[_0x22eb('0xb5')]['id']},'raw':!![]})[_0x22eb('0x1f')](handleEntityNotFound(_0x5020e2,null))[_0x22eb('0x1f')](function(_0x28b451){if(_0x28b451){if(_0x28b451['closed']){return _0x5020e2['status'](0x193)['json']({'status':0x193,'message':_0x22eb('0xc7')});}return db['Attachment']['findOne']({'where':{'id':_0x23d2a3[_0x22eb('0x47')][_0x22eb('0xc8')]},'raw':!![]})[_0x22eb('0x1f')](handleEntityNotFound(_0x5020e2,null));}})['then'](function(_0x50193d){if(_0x50193d){return _0x5020e2[_0x22eb('0xc9')](path[_0x22eb('0xca')](config[_0x22eb('0xcb')],_0x22eb('0xcc'),_0x50193d[_0x22eb('0xc1')]));}})[_0x22eb('0x28')](handleError(_0x5020e2,null));};exports['close']=function(_0x5088e0,_0x19bc53){var _0x1fcd37=null;var _0x31322c=null;var _0x3ab927=null;var _0x108893=null;if(_0x5088e0[_0x22eb('0x79')]['id']){delete _0x5088e0[_0x22eb('0x79')]['id'];}if(_0x5088e0[_0x22eb('0x79')][_0x22eb('0xcd')]){_0x108893=path['join'](config[_0x22eb('0xcb')],'server/files/chat/upload/',util['format'](_0x22eb('0xce'),Date['now']()));_0x5088e0[_0x22eb('0x79')]['pathTranscript']=_0x108893;}return db[_0x22eb('0x3e')][_0x22eb('0x65')]({'where':{'id':_0x5088e0[_0x22eb('0xb5')]['id']},'include':[{'model':db[_0x22eb('0xcf')],'as':'Messages','include':[{'model':db[_0x22eb('0xd0')],'as':_0x22eb('0xd0')}]}]})[_0x22eb('0x1f')](handleEntityNotFound(_0x19bc53,null))[_0x22eb('0x1f')](saveUpdates(_0x5088e0[_0x22eb('0x79')],null))[_0x22eb('0x1f')](function(_0x5dee9f){if(_0x5dee9f){_0x1fcd37=_0x5dee9f;return db[_0x22eb('0xd1')][_0x22eb('0x65')]({'where':{'id':_0x1fcd37[_0x22eb('0x7f')]}});}})['then'](function(_0x139ef6){if(_0x139ef6){_0x3ab927=_0x139ef6;return db['CmContact'][_0x22eb('0x65')]({'where':{'id':_0x1fcd37[_0x22eb('0x73')]}});}})[_0x22eb('0x1f')](function(_0x2668ab){if(_0x2668ab){_0x31322c=_0x2668ab;if(_0x108893){var _0x310eb8=null;for(var _0x1ada3a=0x1;_0x1ada3a<_0x1fcd37[_0x22eb('0xd2')]['length'];++_0x1ada3a){_0x310eb8=_0x1fcd37[_0x22eb('0xd2')][_0x1ada3a];var _0x5e06cd=_0x310eb8[_0x22eb('0x78')]?util['format'](_0x22eb('0xd3'),_0x3ab927['agentAlias'],_0x310eb8[_0x22eb('0x78')]):'System';var _0x1596a0=_0x5088e0[_0x22eb('0x79')]['customer']||util[_0x22eb('0xd4')](_0x22eb('0xd3'),_0x22eb('0xd5'),_0x310eb8[_0x22eb('0x73')]);switch(_0x3ab927[_0x22eb('0xd6')]){case _0x22eb('0xd7'):_0x5e06cd=_0x310eb8[_0x22eb('0x78')]?util['format']('%s%d',_0x3ab927[_0x22eb('0xd8')],_0x310eb8[_0x22eb('0x78')]):_0x22eb('0xd9');break;case'agent_alias':_0x5e06cd=_0x310eb8['UserId']?_0x310eb8['User'][_0x22eb('0xda')]||_0x310eb8[_0x22eb('0xd0')][_0x22eb('0x38')]:_0x22eb('0xd9');break;case'agent_fullname':_0x5e06cd=_0x310eb8[_0x22eb('0x78')]?_0x310eb8['User'][_0x22eb('0x38')]:_0x22eb('0xd9');break;default:_0x5e06cd=_0x310eb8['UserId']?util[_0x22eb('0xd4')]('%s%d',_0x3ab927[_0x22eb('0xd8')],_0x310eb8['UserId']):_0x22eb('0xd9');}var _0x2d5e32=util['format'](_0x22eb('0xdb'),moment(_0x310eb8[_0x22eb('0x82')])[_0x22eb('0xd4')]('MM/DD/YYYY\x20HH:mm:ss'),_0x310eb8['direction']==='in'?_0x1596a0:_0x5e06cd,_0x310eb8[_0x22eb('0x79')]);if(!_0x310eb8['secret']){fs['appendFileSync'](_0x108893,_0x2d5e32);}}return db['MailAccount'][_0x22eb('0xdc')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x22eb('0xdd'),'raw':!![]}]});}}})[_0x22eb('0x1f')](function(_0x44f876){if(_0x44f876&&_0x44f876[_0x22eb('0xdd')]&&_0x5088e0[_0x22eb('0x79')]){var _0x43a590={'tls':{'rejectUnauthorized':![]}};if(_0x44f876[_0x22eb('0xdd')]['service']){_0x43a590[_0x22eb('0xde')]=_0x44f876[_0x22eb('0xdd')]['service'];}else{_0x43a590[_0x22eb('0xdf')]=_0x44f876[_0x22eb('0xdd')][_0x22eb('0xdf')];_0x43a590[_0x22eb('0xe0')]=_0x44f876[_0x22eb('0xdd')][_0x22eb('0xe0')];_0x43a590['secure']=_0x44f876[_0x22eb('0xdd')][_0x22eb('0xe1')];}if(_0x44f876['Smtp']['authentication']){_0x43a590[_0x22eb('0xe2')]={'user':_0x44f876['Smtp']['user'],'pass':_0x44f876[_0x22eb('0xdd')][_0x22eb('0xe3')]};}return respondWithRpcPromise('SendMail',_0x22eb('0xe4'),{'account':_0x43a590,'message':{'from':util['format'](_0x22eb('0xe5'),_0x44f876[_0x22eb('0x35')],_0x44f876[_0x22eb('0xe6')]||_0x44f876[_0x22eb('0xdd')][_0x22eb('0x99')]),'to':_0x5088e0[_0x22eb('0x79')]['mailTranscript'],'subject':_0x22eb('0xe7'),'text':util[_0x22eb('0xd4')](_0x22eb('0xe8'),_0x5088e0[_0x22eb('0x79')]['mailTranscript']),'attachments':[{'path':_0x108893}]}})[_0x22eb('0x1f')](function(){return _0x1fcd37;})[_0x22eb('0x28')](function(_0x18f49d){console[_0x22eb('0x25')](_0x18f49d);});}else{return _0x1fcd37;}})[_0x22eb('0x1f')](respondWithStatusCode(_0x19bc53,0xc8))[_0x22eb('0x28')](handleError(_0x19bc53,null));};exports[_0x22eb('0xe9')]=function(_0x54e5a8,_0x454624,_0x127a72){return db['ChatMessage'][_0x22eb('0x65')]({'where':{'id':_0x54e5a8[_0x22eb('0xb5')]['id']}})['then'](handleEntityNotFound(_0x454624,null))[_0x22eb('0x1f')](function(_0x290942){if(_0x290942){return _0x290942['addMessage'](_0x54e5a8[_0x22eb('0x79')][_0x22eb('0xea')],_['omit'](_0x54e5a8['body'],['ids','id'])||{});}})[_0x22eb('0x1f')](respondWithResult(_0x454624,null))[_0x22eb('0x28')](handleError(_0x454624,null));};exports['getMessages']=function(_0x22eba7,_0x10e9f1,_0x15b9d3){var _0x3d9c56={'raw':![],'where':{}};var _0x252ec9={};var _0x19e0a1={'count':0x0,'rows':[]};return db[_0x22eb('0x3e')]['findOne']({'where':{'id':_0x22eba7['params']['id']}})[_0x22eb('0x1f')](handleEntityNotFound(_0x10e9f1,null))[_0x22eb('0x1f')](function(_0x592cd3){if(_0x592cd3){_0x252ec9[_0x22eb('0x45')]=_[_0x22eb('0x7b')](db['ChatMessage']['rawAttributes']);_0x252ec9[_0x22eb('0x47')]=_[_0x22eb('0x7b')](_0x22eba7[_0x22eb('0x47')]);_0x252ec9[_0x22eb('0x42')]=_[_0x22eb('0x43')](_0x252ec9[_0x22eb('0x45')],_0x252ec9[_0x22eb('0x47')]);_0x3d9c56['attributes']=_[_0x22eb('0x43')](_0x252ec9['model'],qs[_0x22eb('0x46')](_0x22eba7[_0x22eb('0x47')][_0x22eb('0x46')]));_0x3d9c56[_0x22eb('0x44')]=_0x3d9c56['attributes'][_0x22eb('0x6f')]?_0x3d9c56[_0x22eb('0x44')]:_0x252ec9[_0x22eb('0x45')];if(!_0x22eba7[_0x22eb('0x47')][_0x22eb('0x48')](_0x22eb('0xeb'))){_0x3d9c56[_0x22eb('0x2e')]=qs['limit'](_0x22eba7[_0x22eb('0x47')][_0x22eb('0x2e')]);_0x3d9c56['offset']=qs[_0x22eb('0x2d')](_0x22eba7[_0x22eb('0x47')][_0x22eb('0x2d')]);}_0x3d9c56[_0x22eb('0x49')]=qs['sort'](_0x22eba7['query'][_0x22eb('0xec')]);_0x3d9c56[_0x22eb('0x4a')]=qs[_0x22eb('0x42')](_[_0x22eb('0x4b')](_0x22eba7[_0x22eb('0x47')],_0x252ec9[_0x22eb('0x42')]));_0x3d9c56[_0x22eb('0x4a')][_0x22eb('0xae')]=_0x592cd3['id'];if(_0x22eba7[_0x22eb('0x47')]['filter']){_0x3d9c56[_0x22eb('0x4a')]=_[_0x22eb('0x9f')](_0x3d9c56[_0x22eb('0x4a')],{'$or':_[_0x22eb('0x37')](_0x3d9c56[_0x22eb('0x44')],function(_0x28b264){var _0x586c17={};_0x586c17[_0x28b264]={'$like':'%'+_0x22eba7['query'][_0x22eb('0x8b')]+'%'};return _0x586c17;})});}if(_0x22eba7[_0x22eb('0x47')][_0x22eb('0xed')]){var _0xe6f0b=_0x22eba7[_0x22eb('0x47')]['$gte'][_0x22eb('0x6e')](',');var _0x4a6363={};_0x4a6363[_0xe6f0b[0x0]]={'$gte':moment(_0xe6f0b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3d9c56['where']=_[_0x22eb('0x9f')](_0x3d9c56[_0x22eb('0x4a')],_0x4a6363);}_0x3d9c56=_[_0x22eb('0x9f')]({},_0x3d9c56,_0x22eba7[_0x22eb('0xb3')]);return db['ChatMessage']['count']({'where':_0x3d9c56[_0x22eb('0x4a')]})[_0x22eb('0x1f')](function(_0x1ac3f4){_0x19e0a1[_0x22eb('0x2c')]=_0x1ac3f4;if(_0x22eba7['query'][_0x22eb('0xb1')]){_0x3d9c56['include']=[{'all':!![]}];}return db['ChatMessage'][_0x22eb('0xee')](_0x3d9c56);})[_0x22eb('0x1f')](function(_0x4c20d3){_0x19e0a1[_0x22eb('0xaf')]=_0x4c20d3;return _0x19e0a1;});}})['then'](respondWithFilteredResult(_0x10e9f1,_0x3d9c56))[_0x22eb('0x28')](handleError(_0x10e9f1,null));};exports[_0x22eb('0xef')]=function(_0xdf2b16,_0x1922da,_0x10889a){var _0x2c10e3={'where':{}},_0x1b60b3={},_0x419895={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x22eb('0xdc')]({'where':{'id':_0xdf2b16['params']['id']}})[_0x22eb('0x1f')](handleEntityNotFound(_0x1922da,null))[_0x22eb('0x1f')](function(_0x35b5f9){if(_0x35b5f9){_0x1b60b3[_0x22eb('0x45')]=_[_0x22eb('0x7b')](db[_0x22eb('0xcf')][_0x22eb('0x3f')]);_0x1b60b3[_0x22eb('0x47')]=_[_0x22eb('0x7b')](_0xdf2b16[_0x22eb('0x47')]);_0x1b60b3[_0x22eb('0x42')]=_[_0x22eb('0x43')](_0x1b60b3[_0x22eb('0x45')],_0x1b60b3[_0x22eb('0x47')]);_0x2c10e3[_0x22eb('0x44')]=_[_0x22eb('0x43')](_0x1b60b3[_0x22eb('0x45')],qs[_0x22eb('0x46')](_0xdf2b16['query'][_0x22eb('0x46')]));_0x2c10e3[_0x22eb('0x44')]=_0x2c10e3[_0x22eb('0x44')][_0x22eb('0x6f')]?_0x2c10e3[_0x22eb('0x44')]:_0x1b60b3['model'];if(!_0xdf2b16[_0x22eb('0x47')][_0x22eb('0x48')](_0x22eb('0xeb'))){_0x2c10e3[_0x22eb('0x2e')]=qs[_0x22eb('0x2e')](_0xdf2b16[_0x22eb('0x47')][_0x22eb('0x2e')]);_0x2c10e3[_0x22eb('0x2d')]=qs['offset'](_0xdf2b16['query'][_0x22eb('0x2d')]);}_0x2c10e3[_0x22eb('0x49')]=qs['sort'](_0xdf2b16[_0x22eb('0x47')][_0x22eb('0xec')]);_0x2c10e3['where']=qs[_0x22eb('0x42')](_[_0x22eb('0x4b')](_0xdf2b16[_0x22eb('0x47')],_0x1b60b3[_0x22eb('0x42')]));_0x2c10e3['where']['ChatInteractionId']=_0x35b5f9['id'];if(_0xdf2b16[_0x22eb('0x47')][_0x22eb('0x8b')]){_0x2c10e3['where']=_[_0x22eb('0x9f')](_0x2c10e3['where'],{'$or':_[_0x22eb('0x37')](_0x2c10e3['attributes'],function(_0x58da2f){var _0x17e131={};_0x17e131[_0x58da2f]={'$like':'%'+_0xdf2b16['query'][_0x22eb('0x8b')]+'%'};return _0x17e131;})});}_0x2c10e3[_0x22eb('0x4a')][_0x22eb('0xf0')]=![];if(_0xdf2b16[_0x22eb('0x47')]['id']){_0x2c10e3[_0x22eb('0x4a')]['id']={'$gt':_0xdf2b16[_0x22eb('0x47')]['id']};}_0x2c10e3=_[_0x22eb('0x9f')]({},_0x2c10e3,_0xdf2b16[_0x22eb('0xb3')]);return db['ChatMessage']['count']({'where':_0x2c10e3[_0x22eb('0x4a')]})['then'](function(_0x3cc077){_0x419895['count']=_0x3cc077;_0x2c10e3[_0x22eb('0xb2')]=[];if(_0xdf2b16[_0x22eb('0x47')][_0x22eb('0xf1')]){_0x2c10e3[_0x22eb('0xb2')][_0x22eb('0x3c')]({'model':db[_0x22eb('0xd0')],'as':_0x22eb('0xd0'),'attributes':['id',_0x22eb('0x38'),_0x22eb('0xda')]});}if(_0xdf2b16['query'][_0x22eb('0xb1')]){_0x2c10e3[_0x22eb('0xb2')]=[{'all':!![]}];}return db[_0x22eb('0xcf')][_0x22eb('0xee')](_0x2c10e3);})[_0x22eb('0x1f')](function(_0x321f2b){_0x419895['rows']=_0x321f2b;return _0x419895;});}})[_0x22eb('0x1f')](respondWithFilteredResult(_0x1922da,_0x2c10e3))[_0x22eb('0x28')](handleError(_0x1922da,null));};exports[_0x22eb('0xf2')]=function(_0x1a8680,_0x2f6160,_0x1eb1bb){return db[_0x22eb('0x3e')][_0x22eb('0x65')]({'where':{'id':_0x1a8680[_0x22eb('0xb5')]['id']}})[_0x22eb('0x1f')](handleEntityNotFound(_0x2f6160,null))[_0x22eb('0x1f')](function(_0x3b687d){if(_0x3b687d){return _0x3b687d[_0x22eb('0xf3')](_0x1a8680[_0x22eb('0x79')][_0x22eb('0xea')],_[_0x22eb('0xf4')](_0x1a8680['body'],[_0x22eb('0xea'),'id'])||{})[_0x22eb('0xf5')](function(){return db[_0x22eb('0xf6')][_0x22eb('0xee')]({'attributes':['id',_0x22eb('0x35'),_0x22eb('0xf7')],'where':{'id':_0x1a8680['body']['ids']}});})[_0x22eb('0x1f')](function(_0x100daf){socket[_0x22eb('0xf8')](_0x22eb('0xf9'),{'id':Number(_0x1a8680['params']['id']),'tags':_0x100daf||[]});return{'id':Number(_0x1a8680[_0x22eb('0xb5')]['id']),'tags':_0x100daf||[]};});}})[_0x22eb('0x1f')](respondWithResult(_0x2f6160,null))['catch'](handleError(_0x2f6160,null));};exports[_0x22eb('0xfa')]=function(_0x28307d,_0x120f85,_0x1efad4){return db[_0x22eb('0x3e')][_0x22eb('0x65')]({'where':{'id':_0x28307d[_0x22eb('0xb5')]['id']}})[_0x22eb('0x1f')](handleEntityNotFound(_0x120f85,null))[_0x22eb('0x1f')](function(_0x1743af){if(_0x1743af){return _0x1743af[_0x22eb('0xfa')](_0x28307d[_0x22eb('0x47')][_0x22eb('0xea')]);}})['then'](respondWithStatusCode(_0x120f85,null))[_0x22eb('0x28')](handleError(_0x120f85,null));};exports[_0x22eb('0xc9')]=function(_0x8fe16f,_0x508256){var _0x2ccb4a=moment()[_0x22eb('0xfb')]()[_0x22eb('0x9d')]();var _0x20b107=path[_0x22eb('0xca')](config['root'],'server',_0x22eb('0xfc'),_0x22eb('0xfd'));var _0x1272bc=path[_0x22eb('0xca')](config[_0x22eb('0xcb')],_0x22eb('0xfe'),_0x22eb('0xfc'),_0x22eb('0xff'));var _0x56e88a=path['join'](_0x20b107,_0x2ccb4a);var _0x13aa90=util['format'](_0x22eb('0x100'),_0x8fe16f[_0x22eb('0xb5')]['id'],_0x2ccb4a);var _0x504ad4=path[_0x22eb('0xca')](_0x20b107,_0x13aa90);var _0xe6b044=[];_0xe6b044['push']({'model':db[_0x22eb('0xd0')],'as':'User','attributes':['id',_0x22eb('0x38')],'raw':!![]});_0xe6b044[_0x22eb('0x3c')]({'model':db[_0x22eb('0x101')],'as':_0x22eb('0x6a'),'attributes':['id','firstName',_0x22eb('0x102')],'raw':!![]});if(_0x8fe16f[_0x22eb('0x47')][_0x22eb('0xff')]){_0xe6b044[_0x22eb('0x3c')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x4ce286=[{'model':db[_0x22eb('0xcf')],'as':_0x22eb('0xd2'),'attributes':['id','body',_0x22eb('0x82'),_0x22eb('0x103'),_0x22eb('0xf0'),'read'],'include':_0xe6b044}];_0x4ce286[_0x22eb('0x3c')]({'model':db[_0x22eb('0xd1')],'as':_0x22eb('0x104'),'attributes':['id',_0x22eb('0x35')]});_0x4ce286[_0x22eb('0x3c')]({'model':db[_0x22eb('0xd0')],'as':_0x22eb('0x105'),'attributes':['id',_0x22eb('0x38')]});return db[_0x22eb('0x3e')][_0x22eb('0x65')]({'where':{'id':_0x8fe16f['params']['id']},'include':_0x4ce286})[_0x22eb('0x1f')](handleEntityNotFound(_0x508256,null))[_0x22eb('0x1f')](function(_0x8f0e62){if(_0x8f0e62){var _0x2ed3da=_0x8f0e62[_0x22eb('0x106')]({'plain':!![]});fs[_0x22eb('0x107')](_0x56e88a);var _0x3334b9={'format':'A4','border':_0x22eb('0x108'),'header':{'height':_0x22eb('0x109'),'contents':{'first':_0x22eb('0x10a')}},'footer':{'height':'30px','contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x22eb('0xd4')](_0x22eb('0x10b'),_0x22eb('0x10c'),_0x2ed3da['id']),moment()['format'](_0x22eb('0x10d'))[_0x22eb('0x9d')]())}}};var _0x24b81c={'channel':_0x22eb('0x10c'),'account':_0x2ed3da[_0x22eb('0x104')]['name'],'agent':_0x2ed3da[_0x22eb('0x105')]?_0x2ed3da[_0x22eb('0x105')][_0x22eb('0x38')]:'N.A.','createdAt':moment(_0x2ed3da[_0x22eb('0x82')])[_0x22eb('0xd4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x22eb('0x9d')](),'closedAt':_0x2ed3da[_0x22eb('0xbd')]?moment(_0x2ed3da['closedAt'])[_0x22eb('0xd4')](_0x22eb('0x10e'))[_0x22eb('0x9d')]():'','disposition':_0x2ed3da[_0x22eb('0xbe')],'chatInfo':{'browser':_0x2ed3da[_0x22eb('0x10f')],'os':_0x2ed3da['osName'],'referer':_0x2ed3da[_0x22eb('0x110')],'customerIp':_0x2ed3da[_0x22eb('0x111')],'customerPort':_0x2ed3da[_0x22eb('0x112')]?_0x2ed3da[_0x22eb('0x112')]:'N.A.'},'messages':_(_0x2ed3da['Messages'])[_0x22eb('0x113')]()[_0x22eb('0x8b')]({'secret':![]})[_0x22eb('0x37')](function(_0x26944e){if(_0x26944e[_0x22eb('0xc5')]){var _0x4a8cc9=path[_0x22eb('0xca')](_0x1272bc,_0x26944e[_0x22eb('0xc5')][_0x22eb('0xc1')]);if(fs[_0x22eb('0x114')](_0x4a8cc9)){fs[_0x22eb('0x115')](_0x4a8cc9)[_0x22eb('0x116')](fs[_0x22eb('0x117')](path[_0x22eb('0xca')](_0x56e88a,_0x26944e[_0x22eb('0xc5')][_0x22eb('0xc1')])));}}return{'date':moment(_0x26944e[_0x22eb('0x82')])[_0x22eb('0xd4')](_0x22eb('0x10e'))[_0x22eb('0x9d')](),'sender':_0x26944e[_0x22eb('0x103')]===_0x22eb('0x118')?_0x26944e[_0x22eb('0xd0')]?_0x26944e[_0x22eb('0xd0')][_0x22eb('0x38')]:_0x22eb('0xd9'):_0x26944e['Contact'][_0x22eb('0x119')]+(_0x26944e[_0x22eb('0x6a')]['lastName']?'\x20'+_0x26944e[_0x22eb('0x6a')][_0x22eb('0x102')]:''),'body':_0x26944e['Attachment']?_0x26944e[_0x22eb('0xc5')][_0x22eb('0xc1')]:_0x26944e[_0x22eb('0x79')],'direction':_0x26944e[_0x22eb('0x103')]==='out'?'A':'C','secret':_0x26944e['secret'],'read':_0x26944e[_0x22eb('0x11a')],'attachment':_0x26944e[_0x22eb('0xc5')]};})[_0x22eb('0x6d')]()};return ejs[_0x22eb('0x11b')](path[_0x22eb('0xca')](config[_0x22eb('0xcb')],_0x22eb('0xfe'),_0x22eb('0x11c'),'downloadInteraction.html'),{'interaction':_0x24b81c})['then'](function(_0x52d61a){return new BPromise(function(_0x3e0740,_0x5e8a15){pdf[_0x22eb('0xb4')](_0x52d61a,_0x3334b9)[_0x22eb('0x11d')](path[_0x22eb('0xca')](_0x56e88a,_0x22eb('0x11e')+_0x2ed3da['id']+'-'+_0x2ccb4a+_0x22eb('0x11f')),function(_0x3cf8e5,_0x449c17){if(_0x3cf8e5)return _0x5e8a15(_0x3cf8e5);_0x3e0740(_0x449c17);});});})[_0x22eb('0x1f')](function(){return new BPromise(function(_0x1a06dc,_0xbe26d){zipdir(_0x56e88a,{'saveTo':_0x504ad4},function(_0x4ac25d,_0x363ddb){if(_0x4ac25d)return _0xbe26d(_0x4ac25d);return _0x1a06dc(_0x363ddb);});})[_0x22eb('0x1f')](function(){return new BPromise(function(_0x21366a,_0x5e4c0a){rimraf(_0x56e88a,function(_0x3eb636){if(_0x3eb636)_0x5e4c0a(_0x3eb636);return _0x21366a();});});})[_0x22eb('0x1f')](function(){return _0x508256[_0x22eb('0xc9')](_0x504ad4,_0x13aa90,function(_0x50613e){if(_0x50613e){console[_0x22eb('0x120')](_0x22eb('0x121'),_0x50613e);}else{fs[_0x22eb('0x122')](_0x504ad4);}});});});}else{return _0x508256[_0x22eb('0xba')](0xc8);}})[_0x22eb('0x28')](handleError(_0x508256,null));}; \ No newline at end of file +var _0x9957=['Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','isEmpty','resolve','then','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','ui.ChatInteractionId\x20IN\x20?','all','rows','show','params','includeAll','include','options','describe','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','Attachment','create','findOne','Unauthorized','attachId','download','join','root','server/files/attachments/','close','server/files/chat/upload/','transcript-%s.txt','pathTranscript','Messages','User','ChatWebsite','CmContact','format','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','pass','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ChatMessage','omit','ids','getMessages','ChatInteractionId','$gte','findAll','getMyMessages','includeAgent','alias','setTags','color','chatInteractionTags:save','removeTags','server','files','attachments','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','YYYY-MM-DD','N.A.','closedAt','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','customerPort','existsSync','createReadStream','pipe','createWriteStream','out','firstName','lastName','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','request\x20sent','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','sendStatus','end','status','count','limit','set','Content-Range','json','reject','update','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','ChatInteraction','rawAttributes','type','key','model','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','offset','sort','where','pick','select','field','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232b});var client9004=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x1a5310,_0x2202ce,_0x41cbf0){if(_0x41cbf0){var _0x5377e5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5377e5[_0x7995('0x21')](_0x2202ce)){return _0x1a5310;}else{throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x23'));}}else{return _0x1a5310;}}function respondWithRpcPromise(_0x43d4b8,_0x291317,_0x1e1415,_0x37a7d4){return new BPromise(function(_0x4faa60,_0x54c9ae){var _0x2536c8=_0x37a7d4||client;return _0x2536c8['request'](_0x43d4b8,_0x1e1415)['then'](function(_0x3ec178){logger[_0x7995('0x24')]('ChatInteraction,\x20%s,\x20%s',_0x291317,_0x7995('0x25'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x291317,_0x7995('0x25'),JSON[_0x7995('0x26')](_0x3ec178));if(_0x3ec178[_0x7995('0x27')]){if(_0x3ec178[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')]('ChatInteraction,\x20%s,\x20%s',_0x291317,_0x3ec178[_0x7995('0x27')][_0x7995('0x29')]);return _0x54c9ae(_0x3ec178[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x2a'),_0x291317,_0x3ec178[_0x7995('0x27')][_0x7995('0x29')]);return _0x4faa60(_0x3ec178['error'][_0x7995('0x29')]);}else{logger[_0x7995('0x24')](_0x7995('0x2a'),_0x291317,_0x7995('0x25'));_0x4faa60(_0x3ec178[_0x7995('0x2b')][_0x7995('0x29')]);}})['catch'](function(_0x47625f){logger['error'](_0x7995('0x2a'),_0x291317,_0x47625f);_0x54c9ae(_0x47625f);});});}function respondWithStatusCode(_0x49bc7e,_0xf16cc2){_0xf16cc2=_0xf16cc2||0xcc;return function(_0x132a42){if(_0x132a42){return _0x49bc7e[_0x7995('0x2c')](_0xf16cc2);}return _0x49bc7e['status'](_0xf16cc2)[_0x7995('0x2d')]();};}function respondWithResult(_0x514445,_0x456a28){_0x456a28=_0x456a28||0xc8;return function(_0x3250e0){if(_0x3250e0){return _0x514445[_0x7995('0x2e')](_0x456a28)['json'](_0x3250e0);}};}function respondWithFilteredResult(_0x530611,_0x48e573){return function(_0x3573be){if(_0x3573be){var _0xe6b0b3=_0x3573be[_0x7995('0x2f')],_0x327a81=_0x48e573['offset'],_0x2b874d=_0x48e573['offset']+_0x48e573[_0x7995('0x30')],_0x2e3493;if(_0x2b874d>=_0xe6b0b3){_0x2b874d=_0xe6b0b3;_0x2e3493=0xc8;}else{_0x2e3493=0xce;}_0x530611['status'](_0x2e3493);return _0x530611[_0x7995('0x31')](_0x7995('0x32'),_0x327a81+'-'+_0x2b874d+'/'+_0xe6b0b3)[_0x7995('0x33')](_0x3573be);}return null;};}function patchUpdates(_0x1e9fa4){return function(_0x1f7d27){try{jsonpatch['apply'](_0x1f7d27,_0x1e9fa4,!![]);}catch(_0x44309d){return BPromise[_0x7995('0x34')](_0x44309d);}return _0x1f7d27['save']();};}function saveUpdates(_0x48db25,_0x577412){return function(_0x45bc5e){if(_0x45bc5e){return _0x45bc5e[_0x7995('0x35')](_0x48db25)['then'](function(_0x3e7020){return _0x3e7020;});}return null;};}function removeEntity(_0x51b95d,_0x37917b){return function(_0x1cb058){if(_0x1cb058){return _0x1cb058[_0x7995('0x36')]()['then'](function(){_0x51b95d['status'](0xcc)[_0x7995('0x2d')]();});}};}function handleEntityNotFound(_0x5e67fe,_0x5d2428){return function(_0x3e99cd){if(!_0x3e99cd){_0x5e67fe[_0x7995('0x2c')](0x194);}return _0x3e99cd;};}function handleError(_0x5212ff,_0x1baa15){_0x1baa15=_0x1baa15||0x1f4;return function(_0x1922b4){logger[_0x7995('0x27')](_0x1922b4[_0x7995('0x37')]);if(_0x1922b4[_0x7995('0x38')]){delete _0x1922b4['name'];}_0x5212ff[_0x7995('0x2e')](_0x1baa15)[_0x7995('0x39')](_0x1922b4);};}function getInteractionUsers(_0xf612e6,_0x1d60b8){return new BPromise(function(_0x4b1541,_0x2be2c0){try{if(_0x1d60b8[_0xf612e6['id']]){_0xf612e6[_0x7995('0x3a')]=_[_0x7995('0x3b')](_0x1d60b8[_0xf612e6['id']],function(_0xe5ea43){return{'id':_0xe5ea43['id'],'fullname':_0xe5ea43[_0x7995('0x3c')]};});}}catch(_0x1035dc){_0x2be2c0(_0x1035dc);}_0x4b1541(_0xf612e6);});}function getInteractionTags(_0x5688a1,_0x183a68){return new BPromise(function(_0x3be298,_0x8a1be0){try{if(_0x5688a1[_0x7995('0x3d')]){_0x5688a1[_0x7995('0x3e')]=[];_0x5688a1[_0x7995('0x3d')][_0x7995('0x3f')](',')[_0x7995('0x40')](function(_0x1234e1){_0x5688a1[_0x7995('0x3e')][_0x7995('0x41')](_0x183a68[_0x1234e1]);});}delete _0x5688a1[_0x7995('0x3d')];}catch(_0x7b4e67){_0x8a1be0(_0x7b4e67);}_0x3be298(_0x5688a1);});}function updateChatInteraction(_0x53cda2,_0x50a98e,_0x334dff){return new BPromise(function(_0x7325e8,_0x58523e){return getInteractionUsers(_0x53cda2,_0x334dff)['then'](function(_0x3f8522){return getInteractionTags(_0x3f8522,_0x50a98e);})['then'](function(_0x504a33){_0x7325e8(_0x504a33);})[_0x7995('0x42')](function(_0x36e28b){_0x58523e(_0x36e28b);});});}exports[_0x7995('0x43')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={},_0x3993b5={},_0x5a8881={'count':0x0,'rows':[]};var _0x493066=_[_0x7995('0x3b')](db[_0x7995('0x44')][_0x7995('0x45')],function(_0x3f1c35){return{'name':_0x3f1c35['fieldName'],'type':_0x3f1c35[_0x7995('0x46')][_0x7995('0x47')]};});_0x3993b5[_0x7995('0x48')]=_[_0x7995('0x3b')](_0x493066,'name');_0x3993b5['query']=_[_0x7995('0x49')](_0x576b96['query']);_0x3993b5[_0x7995('0x4a')]=_['intersection'](_0x3993b5[_0x7995('0x48')],_0x3993b5['query']);_0x5e85b9[_0x7995('0x4b')]=_[_0x7995('0x4c')](_0x3993b5['model'],qs[_0x7995('0x4d')](_0x576b96[_0x7995('0x4e')][_0x7995('0x4d')]));_0x5e85b9[_0x7995('0x4b')]=_0x5e85b9['attributes'][_0x7995('0x4f')]?_0x5e85b9[_0x7995('0x4b')]:_0x3993b5[_0x7995('0x48')];if(!_0x576b96['query'][_0x7995('0x50')](_0x7995('0x51'))){_0x5e85b9[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x576b96[_0x7995('0x4e')]['limit']);_0x5e85b9[_0x7995('0x52')]=qs[_0x7995('0x52')](_0x576b96['query'][_0x7995('0x52')]);}_0x5e85b9['order']=qs[_0x7995('0x53')](_0x576b96[_0x7995('0x4e')][_0x7995('0x53')]);_0x5e85b9[_0x7995('0x54')]=qs[_0x7995('0x4a')](_[_0x7995('0x55')](_0x576b96[_0x7995('0x4e')],_0x3993b5['filters']));var _0x427dcf=[];var _0x32f4be=squel[_0x7995('0x56')]()['field']('id')[_0x7995('0x57')](_0x7995('0x38'))[_0x7995('0x57')]('color')['from']('tools_tags');var _0xb70620=squel[_0x7995('0x56')]()['field'](_0x7995('0x58'))[_0x7995('0x57')](_0x7995('0x59'))[_0x7995('0x57')](_0x7995('0x5a'))['from'](_0x7995('0x5b'),'ui')['left_join'](_0x7995('0x5c'),'u',_0x7995('0x5d'));var _0x206d2a=squel['select']()['from']('chat_interactions','i')['left_join'](_0x7995('0x5e'),'c',_0x7995('0x5f'))[_0x7995('0x60')](_0x7995('0x5c'),'o',_0x7995('0x61'))[_0x7995('0x60')](_0x7995('0x62'),'a',_0x7995('0x63'))[_0x7995('0x60')](_0x7995('0x64'),'me',_0x7995('0x65'))[_0x7995('0x60')](_0x7995('0x66'),'it',_0x7995('0x67'))[_0x7995('0x60')](_0x7995('0x68'),'t',_0x7995('0x69'));var _0x223e08=squel[_0x7995('0x6a')]();var _0x50b7c2=[];var _0x56a374=squel[_0x7995('0x6a')]();var _0x3b8a54;if(_0x576b96[_0x7995('0x4e')]['search']){_0x3b8a54=as['parseSearch'](_0x576b96[_0x7995('0x4e')][_0x7995('0x6b')]);var _0x5b9467=_0x3b8a54[_0x7995('0x6c')];for(var _0x51c50b=0x0;_0x51c50b<_0x3b8a54[_0x7995('0x6d')][_0x7995('0x4f')];_0x51c50b++){var _0xef5044=_0x3b8a54[_0x7995('0x6d')][_0x51c50b];var _0x502d43='i';var _0x5e2d97=_[_0x7995('0x6e')](_0x493066,[_0x7995('0x38'),_0xef5044[_0x7995('0x57')]]);if(!_0x5e2d97){switch(_0xef5044[_0x7995('0x57')]){case _0x7995('0x6f'):if(_0xef5044[_0x7995('0x70')]==0x1){_0x206d2a[_0x7995('0x71')]('`'+_0xef5044[_0x7995('0x57')]+_0x7995('0x72'));}else{_0x206d2a['having']('`'+_0xef5044[_0x7995('0x57')]+_0x7995('0x73'));}break;case _0x7995('0x74'):if(_0xef5044[_0x7995('0x75')]==='$substring'){if(_0xef5044['value'][_0x7995('0x3f')]('\x20')[_0x7995('0x4f')]>0x1){_0x223e08[_0x5b9467]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7995('0x76')](_0xef5044[_0x7995('0x70')]),null);}else{var _0x2e3421='%'+_0xef5044[_0x7995('0x70')]+'%';_0x223e08[_0x5b9467](_0x7995('0x77'),_0x2e3421,_0x2e3421,_0x2e3421);}}else{_0x5e2d97=_['find'](_0x493066,[_0x7995('0x38'),'ContactId']);_0xef5044[_0x7995('0x57')]=_0x7995('0x78');_0x1fe1cb=as[_0x7995('0x79')](_0x502d43,_0x5e2d97[_0x7995('0x46')],_0xef5044);_0x223e08[_0x5b9467](_0x1fe1cb[_0x7995('0x7a')],_0x1fe1cb[_0x7995('0x70')][_0x7995('0x7b')],_0x1fe1cb[_0x7995('0x70')][_0x7995('0x2d')]);}break;case _0x7995('0x7c'):var _0x2618c4=_0xef5044[_0x7995('0x70')]['split'](',')[_0x7995('0x3b')](function(_0x23bbc1){return Number(_0x23bbc1);});_0x2618c4[_0x7995('0x40')](function(_0xc2b660){_0x56a374['or'](_0x7995('0x7d'),'%,'+_0xc2b660+',%');});_0x50b7c2=_['union'](_0x50b7c2,_0x2618c4);break;case'User':if(_0xef5044[_0x7995('0x75')]===_0x7995('0x7e')){_0x223e08[_0x5b9467](_0x7995('0x7f'),'%'+_0xef5044[_0x7995('0x70')]+'%',null);}else{_0x5e2d97=_['find'](_0x493066,[_0x7995('0x38'),'UserId']);_0xef5044['field']=_0x7995('0x80');_0x1fe1cb=as[_0x7995('0x79')](_0x502d43,_0x5e2d97[_0x7995('0x46')],_0xef5044);_0x223e08[_0x5b9467](_0x1fe1cb[_0x7995('0x7a')],_0x1fe1cb[_0x7995('0x70')][_0x7995('0x7b')],_0x1fe1cb[_0x7995('0x70')][_0x7995('0x2d')]);}break;case _0x7995('0x81'):_0x1fe1cb=as[_0x7995('0x79')]('me',null,_0xef5044);_0x223e08[_0x5b9467](_0x1fe1cb['text'],_0x1fe1cb[_0x7995('0x70')][_0x7995('0x7b')],_0x1fe1cb[_0x7995('0x70')]['end']);break;}}else{var _0x1fe1cb=as[_0x7995('0x79')](_0x502d43,_0x5e2d97[_0x7995('0x46')],_0xef5044);_0x223e08[_0x5b9467](_0x1fe1cb[_0x7995('0x7a')],_0x1fe1cb[_0x7995('0x70')][_0x7995('0x7b')],_0x1fe1cb[_0x7995('0x70')][_0x7995('0x2d')]);}}}else{var _0x2f94c4=_(_0x576b96[_0x7995('0x4e')])[_0x7995('0x49')]()['map'](function(_0x5e8b4c){return _[_0x7995('0x82')](_0x493066,[_0x7995('0x38'),_0x5e8b4c])?_0x5e8b4c:undefined;})[_0x7995('0x83')]()[_0x7995('0x70')]();if(!_['isEmpty'](_0x2f94c4)){_0x2f94c4[_0x7995('0x40')](function(_0x2c9eb6){if(_0x2c9eb6==='ChatWebsiteId'){_0x206d2a['where'](_0x7995('0x84'),[][_0x7995('0x85')](_0x576b96['query'][_0x2c9eb6]));}else if(_0x2c9eb6===_0x7995('0x86')){var _0x5b1cba=JSON[_0x7995('0x87')](_0x576b96[_0x7995('0x4e')][_0x2c9eb6])['$gte'];var _0x5d9d33=JSON[_0x7995('0x87')](_0x576b96['query'][_0x2c9eb6])[_0x7995('0x88')];_0x206d2a[_0x7995('0x54')](_0x7995('0x89'),_0x5b1cba,_0x5d9d33);}else{if(_0x576b96[_0x7995('0x4e')][_0x2c9eb6]===_0x7995('0x8a')){_0x206d2a[_0x7995('0x54')]('i.'+_0x2c9eb6+_0x7995('0x8b'));}else{_0x206d2a[_0x7995('0x54')]('i.'+_0x2c9eb6+_0x7995('0x8c'),_0x576b96[_0x7995('0x4e')][_0x2c9eb6]);}}});}if(_0x576b96[_0x7995('0x4e')][_0x7995('0x8d')]){if(_0x576b96[_0x7995('0x4e')][_0x7995('0x8d')]==0x1){_0x206d2a[_0x7995('0x71')](_0x7995('0x8e'));}else{_0x206d2a[_0x7995('0x71')](_0x7995('0x8f'));}}if(_0x576b96[_0x7995('0x4e')][_0x7995('0x90')]){_0x50b7c2=_[_0x7995('0x91')](_0x576b96[_0x7995('0x4e')][_0x7995('0x90')])?_0x576b96[_0x7995('0x4e')][_0x7995('0x90')]:new Array(_0x576b96[_0x7995('0x4e')][_0x7995('0x90')]);_0x50b7c2[_0x7995('0x40')](function(_0x59efff){_0x56a374['or'](_0x7995('0x7d'),'%,'+_0x59efff+',%');});}if(_0x576b96[_0x7995('0x4e')]['filter']){var _0x4c85cb=_0x576b96[_0x7995('0x4e')][_0x7995('0x92')][_0x7995('0x93')]('\x5c','\x5c\x5c')[_0x7995('0x93')]('\x27\x27',_0x7995('0x94'));if(qs[_0x7995('0x95')](_0x4c85cb)){_0x223e08['or']('i.id\x20LIKE\x20?',_0x4c85cb+'%');}else{_0x223e08['or'](_0x7995('0x96'),qs[_0x7995('0x76')](_0x4c85cb))['or'](_0x7995('0x97'),_0x4c85cb+'%');}}}_0x206d2a[_0x7995('0x54')](_0x223e08);_0x206d2a[_0x7995('0x98')](_0x7995('0x99'));var _0x151d99={'type':db[_0x7995('0x9a')]['QueryTypes'][_0x7995('0x9b')],'raw':!![]};var _0x2b8217=_0x206d2a['clone']();_0x2b8217['field'](_0x7995('0x99'));_0x2b8217[_0x7995('0x57')](_0x7995('0x9c'),_0x7995('0x6f'));if(_0x5e85b9[_0x7995('0x9d')]){_0x5e85b9['order'][_0x7995('0x40')](function(_0x406054){_0x206d2a['order']('i.'+_0x406054[0x0],_0x406054[0x1]===_0x7995('0x9e')?![]:!![]);});}if(!_[_0x7995('0x9f')](_0x50b7c2)){_0x206d2a['having'](_0x56a374);_0x2b8217[_0x7995('0x54')]('t.id\x20IN\x20?',_0x50b7c2);}BPromise[_0x7995('0xa0')]()[_0x7995('0xa1')](function(){if(!_0x3b8a54){if(_0x576b96[_0x7995('0x4e')][_0x7995('0xa2')]||_0x576b96[_0x7995('0x4e')]['journey'])return;_0x2b8217[_0x7995('0x54')](_0x7995('0xa3'));_0x206d2a[_0x7995('0x54')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x576b96[_0x7995('0xa4')][_0x7995('0xa5')]({'attributes':['id'],'raw':!![]})[_0x7995('0xa1')](function(_0x308a26){if(_['isEmpty'](_0x308a26)){_0x2b8217[_0x7995('0x54')](_0x7995('0xa6'));_0x206d2a[_0x7995('0x54')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x2b8217['where'](_0x7995('0x84'),_[_0x7995('0x3b')](_0x308a26,'id'));_0x206d2a['where']('i.ChatWebsiteId\x20IN\x20?',_[_0x7995('0x3b')](_0x308a26,'id'));}});})[_0x7995('0xa1')](function(){db[_0x7995('0xa7')][_0x7995('0x4e')](_0x2b8217[_0x7995('0xa8')](),_0x151d99)['then'](function(_0x56003d){_0x5a8881[_0x7995('0x2f')]=_0x56003d['length'];if(_0x5a8881['count']===0x0)return[];return db[_0x7995('0xa7')][_0x7995('0x4e')](_0x32f4be[_0x7995('0xa8')](),_0x151d99)['then'](function(_0x3b1309){_0x427dcf=_[_0x7995('0xa9')](_0x3b1309,'id');_0x151d99=_[_0x7995('0xaa')](_0x151d99,{'model':db[_0x7995('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x576b96[_0x7995('0x4e')]['fields']){_0x5e85b9[_0x7995('0x4b')][_0x7995('0x40')](function(_0x1a2d6a){_0x206d2a[_0x7995('0x57')]('i.'+_0x1a2d6a);});}else{_0x206d2a['field'](_0x7995('0x9c'),_0x7995('0x6f'));_0x206d2a['field'](_0x7995('0xab'),_0x7995('0xac'));_0x206d2a['field'](_0x7995('0xad'),'Account.mandatoryDisposition');_0x206d2a[_0x7995('0x57')]('i.*');_0x206d2a[_0x7995('0x57')]('c.firstName',_0x7995('0xae'));_0x206d2a[_0x7995('0x57')]('c.lastName',_0x7995('0xaf'));_0x206d2a['field']('c.email',_0x7995('0xb0'));_0x206d2a[_0x7995('0x57')](_0x7995('0xb1'),_0x7995('0xb2'));_0x206d2a['field'](_0x7995('0xb3'),_0x7995('0xb4'));_0x206d2a['field']('c.fax',_0x7995('0xb5'));_0x206d2a['field'](_0x7995('0xb6'),_0x7995('0xb7'));_0x206d2a[_0x7995('0x57')]('o.internal','Owner.internal');_0x206d2a[_0x7995('0x57')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x7995('0x3d'));}_0x206d2a[_0x7995('0x30')](_0x5e85b9[_0x7995('0x30')]);_0x206d2a[_0x7995('0x52')](_0x5e85b9['offset']);return db['sequelize']['query'](_0x206d2a[_0x7995('0xa8')](),_0x151d99);})[_0x7995('0xa1')](function(_0x23b4c3){_0xb70620[_0x7995('0x54')](_0x7995('0xb8'),_[_0x7995('0x3b')](_0x23b4c3,'id'));return db['sequelize']['query'](_0xb70620[_0x7995('0xa8')](),_0x151d99)['then'](function(_0x4cfd78){var _0x17d00f=_['groupBy'](_0x4cfd78,'ChatInteractionId');var _0x35c3f3=[];_0x23b4c3[_0x7995('0x40')](function(_0x3873f3){_0x35c3f3['push'](updateChatInteraction(_0x3873f3,_0x427dcf,_0x17d00f));});return BPromise[_0x7995('0xb9')](_0x35c3f3);});});})[_0x7995('0xa1')](function(_0x1c4d23){_0x5a8881[_0x7995('0xba')]=_0x1c4d23;return _0x5a8881;})[_0x7995('0xa1')](respondWithFilteredResult(_0x46ac4f,_0x5e85b9));})[_0x7995('0x42')](handleError(_0x46ac4f,null));};exports[_0x7995('0xbb')]=function(_0x4093c5,_0x19d746){var _0x570b71={'raw':![],'where':{'id':_0x4093c5[_0x7995('0xbc')]['id']}},_0x3eb3fa={};_0x3eb3fa[_0x7995('0x48')]=_[_0x7995('0x49')](db[_0x7995('0x44')]['rawAttributes']);_0x3eb3fa[_0x7995('0x4e')]=_[_0x7995('0x49')](_0x4093c5[_0x7995('0x4e')]);_0x3eb3fa['filters']=_['intersection'](_0x3eb3fa['model'],_0x3eb3fa[_0x7995('0x4e')]);_0x570b71[_0x7995('0x4b')]=_[_0x7995('0x4c')](_0x3eb3fa[_0x7995('0x48')],qs[_0x7995('0x4d')](_0x4093c5[_0x7995('0x4e')]['fields']));_0x570b71[_0x7995('0x4b')]=_0x570b71['attributes'][_0x7995('0x4f')]?_0x570b71[_0x7995('0x4b')]:_0x3eb3fa[_0x7995('0x48')];if(_0x4093c5[_0x7995('0x4e')][_0x7995('0xbd')]){_0x570b71[_0x7995('0xbe')]=[{'all':!![]}];}_0x570b71=_[_0x7995('0xaa')]({},_0x570b71,_0x4093c5[_0x7995('0xbf')]);return db[_0x7995('0x44')][_0x7995('0x6e')](_0x570b71)[_0x7995('0xa1')](handleEntityNotFound(_0x19d746,null))['then'](respondWithResult(_0x19d746,null))[_0x7995('0x42')](handleError(_0x19d746,null));};exports['create']=function(_0x422d1f,_0x3d1298){return db['ChatInteraction']['create'](_0x422d1f[_0x7995('0x81')],{})[_0x7995('0xa1')](respondWithResult(_0x3d1298,0xc9))[_0x7995('0x42')](handleError(_0x3d1298,null));};exports[_0x7995('0x35')]=function(_0x260d46,_0xf8cb2){if(_0x260d46[_0x7995('0x81')]['id']){delete _0x260d46[_0x7995('0x81')]['id'];}return db[_0x7995('0x44')][_0x7995('0x6e')]({'where':{'id':_0x260d46[_0x7995('0xbc')]['id']}})[_0x7995('0xa1')](handleEntityNotFound(_0xf8cb2,null))['then'](saveUpdates(_0x260d46['body'],null))[_0x7995('0xa1')](respondWithResult(_0xf8cb2,null))[_0x7995('0x42')](handleError(_0xf8cb2,null));};exports[_0x7995('0x36')]=function(_0x1531a9,_0x100bde){return db['ChatInteraction'][_0x7995('0x6e')]({'where':{'id':_0x1531a9[_0x7995('0xbc')]['id']}})['then'](handleEntityNotFound(_0x100bde,null))[_0x7995('0xa1')](removeEntity(_0x100bde,null))['catch'](handleError(_0x100bde,null));};exports[_0x7995('0xc0')]=function(_0x30cda5,_0x234a40){return db['ChatInteraction'][_0x7995('0xc0')]()[_0x7995('0xa1')](respondWithResult(_0x234a40,null))[_0x7995('0x42')](handleError(_0x234a40,null));};exports[_0x7995('0xc1')]=function(_0x11f9fb,_0x8a5aa8){if(_0x11f9fb[_0x7995('0x81')]['id']){delete _0x11f9fb['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x11f9fb[_0x7995('0xbc')]['id']}})[_0x7995('0xa1')](handleEntityNotFound(_0x8a5aa8,null))['then'](saveUpdates(_0x11f9fb['body'],null))[_0x7995('0xa1')](respondWithResult(_0x8a5aa8,null))[_0x7995('0x42')](handleError(_0x8a5aa8,null));};exports['abandon']=function(_0x4b07de,_0x538bd3,_0x5b591b){if(_0x4b07de[_0x7995('0x81')]['id']){delete _0x4b07de[_0x7995('0x81')]['id'];}return db[_0x7995('0x44')][_0x7995('0x6e')]({'where':{'id':_0x4b07de['params']['id']}})[_0x7995('0xa1')](function(_0x248e7c){if(!_0x248e7c){logger['error'](_0x7995('0xc2'),_0x7995('0xc3'),0x194,_0x7995('0xc4'));_0x538bd3['sendStatus'](0x194);}else{if(_0x248e7c[_0x7995('0x80')]){throw new db[(_0x7995('0x9a'))]['ValidationError'](_0x7995('0xc5'));}}return _0x248e7c;})[_0x7995('0xa1')](function(_0x1fc75e){if(_0x1fc75e){return _0x1fc75e[_0x7995('0x35')]({'closed':_0x4b07de[_0x7995('0x81')][_0x7995('0xc6')],'disposition':_0x4b07de[_0x7995('0x81')][_0x7995('0xc7')]})[_0x7995('0xa1')](function(_0x278004){return _0x278004;});}})[_0x7995('0xa1')](function(_0x428e03){return respondWithRpcPromise(_0x7995('0xc8'),'abandon',_0x4b07de[_0x7995('0x81')],client9004);})[_0x7995('0xa1')](respondWithResult(_0x538bd3,null))[_0x7995('0x42')](handleError(_0x538bd3,null));};exports[_0x7995('0xc9')]=function(_0x59e356,_0x354058,_0x2e6f4e){_0x59e356[_0x7995('0x81')]['name']=_0x59e356[_0x7995('0xca')][_0x7995('0xcb')];_0x59e356[_0x7995('0x81')][_0x7995('0xcc')]=_0x59e356[_0x7995('0xca')][_0x7995('0xcd')];_0x59e356[_0x7995('0x81')]['type']=_0x59e356[_0x7995('0xca')]['mimetype'];return db[_0x7995('0xce')][_0x7995('0xcf')](_0x59e356[_0x7995('0x81')])['then'](respondWithResult(_0x354058,0xc9))[_0x7995('0x42')](handleError(_0x354058,null));};exports['attachmentDownload']=function(_0x5e1a13,_0x4ee5ee,_0x4b3170){return db[_0x7995('0x44')][_0x7995('0xd0')]({'where':{'id':_0x5e1a13['params']['id']},'raw':!![]})[_0x7995('0xa1')](handleEntityNotFound(_0x4ee5ee,null))[_0x7995('0xa1')](function(_0x50fccd){if(_0x50fccd){if(_0x50fccd[_0x7995('0xc6')]){return _0x4ee5ee[_0x7995('0x2e')](0x193)[_0x7995('0x33')]({'status':0x193,'message':_0x7995('0xd1')});}return db[_0x7995('0xce')]['findOne']({'where':{'id':_0x5e1a13[_0x7995('0x4e')][_0x7995('0xd2')]},'raw':!![]})[_0x7995('0xa1')](handleEntityNotFound(_0x4ee5ee,null));}})[_0x7995('0xa1')](function(_0x55387b){if(_0x55387b){return _0x4ee5ee[_0x7995('0xd3')](path[_0x7995('0xd4')](config[_0x7995('0xd5')],_0x7995('0xd6'),_0x55387b[_0x7995('0xcc')]));}})[_0x7995('0x42')](handleError(_0x4ee5ee,null));};exports[_0x7995('0xd7')]=function(_0x13d473,_0x1c3074){var _0x1fda95=null;var _0x5e08fa=null;var _0x3440e2=null;var _0x521712=null;if(_0x13d473[_0x7995('0x81')]['id']){delete _0x13d473[_0x7995('0x81')]['id'];}if(_0x13d473[_0x7995('0x81')]['mailTranscript']){_0x521712=path['join'](config[_0x7995('0xd5')],_0x7995('0xd8'),util['format'](_0x7995('0xd9'),Date['now']()));_0x13d473[_0x7995('0x81')][_0x7995('0xda')]=_0x521712;}return db[_0x7995('0x44')][_0x7995('0x6e')]({'where':{'id':_0x13d473['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0x7995('0xdb'),'include':[{'model':db[_0x7995('0xdc')],'as':_0x7995('0xdc')}]}]})[_0x7995('0xa1')](handleEntityNotFound(_0x1c3074,null))['then'](saveUpdates(_0x13d473[_0x7995('0x81')],null))[_0x7995('0xa1')](function(_0x8b820b){if(_0x8b820b){_0x1fda95=_0x8b820b;return db[_0x7995('0xdd')][_0x7995('0x6e')]({'where':{'id':_0x1fda95['ChatWebsiteId']}});}})['then'](function(_0x47989f){if(_0x47989f){_0x3440e2=_0x47989f;return db[_0x7995('0xde')][_0x7995('0x6e')]({'where':{'id':_0x1fda95['ContactId']}});}})[_0x7995('0xa1')](function(_0x5635d6){if(_0x5635d6){_0x5e08fa=_0x5635d6;if(_0x521712){var _0x29c0f4=null;for(var _0x19e449=0x1;_0x19e449<_0x1fda95[_0x7995('0xdb')][_0x7995('0x4f')];++_0x19e449){_0x29c0f4=_0x1fda95['Messages'][_0x19e449];var _0x3fbafb=_0x29c0f4[_0x7995('0x80')]?util[_0x7995('0xdf')](_0x7995('0xe0'),_0x3440e2[_0x7995('0xe1')],_0x29c0f4[_0x7995('0x80')]):_0x7995('0xe2');var _0x152c2a=_0x13d473[_0x7995('0x81')][_0x7995('0xe3')]||util[_0x7995('0xdf')](_0x7995('0xe0'),_0x7995('0xe4'),_0x29c0f4[_0x7995('0x78')]);switch(_0x3440e2['agentIdentifier']){case _0x7995('0xe5'):_0x3fbafb=_0x29c0f4['UserId']?util[_0x7995('0xdf')](_0x7995('0xe0'),_0x3440e2['agentAlias'],_0x29c0f4[_0x7995('0x80')]):'System';break;case _0x7995('0xe6'):_0x3fbafb=_0x29c0f4[_0x7995('0x80')]?_0x29c0f4['User']['alias']||_0x29c0f4['User'][_0x7995('0x3c')]:_0x7995('0xe2');break;case _0x7995('0xe7'):_0x3fbafb=_0x29c0f4[_0x7995('0x80')]?_0x29c0f4['User'][_0x7995('0x3c')]:_0x7995('0xe2');break;default:_0x3fbafb=_0x29c0f4[_0x7995('0x80')]?util[_0x7995('0xdf')](_0x7995('0xe0'),_0x3440e2[_0x7995('0xe1')],_0x29c0f4[_0x7995('0x80')]):_0x7995('0xe2');}var _0x47f0d9=util[_0x7995('0xdf')](_0x7995('0xe8'),moment(_0x29c0f4[_0x7995('0x86')])[_0x7995('0xdf')]('MM/DD/YYYY\x20HH:mm:ss'),_0x29c0f4[_0x7995('0xe9')]==='in'?_0x152c2a:_0x3fbafb,_0x29c0f4[_0x7995('0x81')]);if(!_0x29c0f4[_0x7995('0xea')]){fs[_0x7995('0xeb')](_0x521712,_0x47f0d9);}}return db[_0x7995('0xec')][_0x7995('0xd0')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x7995('0xed'),'raw':!![]}]});}}})[_0x7995('0xa1')](function(_0xea5614){if(_0xea5614&&_0xea5614[_0x7995('0xed')]&&_0x13d473[_0x7995('0x81')]){var _0x3e3b05={'tls':{'rejectUnauthorized':![]}};if(_0xea5614[_0x7995('0xed')][_0x7995('0xee')]){_0x3e3b05[_0x7995('0xee')]=_0xea5614[_0x7995('0xed')][_0x7995('0xee')];}else{_0x3e3b05[_0x7995('0xef')]=_0xea5614[_0x7995('0xed')][_0x7995('0xef')];_0x3e3b05[_0x7995('0xf0')]=_0xea5614[_0x7995('0xed')][_0x7995('0xf0')];_0x3e3b05[_0x7995('0xf1')]=_0xea5614[_0x7995('0xed')][_0x7995('0xf1')];}if(_0xea5614[_0x7995('0xed')]['authentication']){_0x3e3b05['auth']={'user':_0xea5614[_0x7995('0xed')][_0x7995('0xa4')],'pass':_0xea5614['Smtp'][_0x7995('0xf2')]};}return respondWithRpcPromise('SendMail',_0x7995('0xf3'),{'account':_0x3e3b05,'message':{'from':util['format'](_0x7995('0xf4'),_0xea5614[_0x7995('0x38')],_0xea5614[_0x7995('0xf5')]||_0xea5614[_0x7995('0xed')][_0x7995('0xa4')]),'to':_0x13d473[_0x7995('0x81')][_0x7995('0xf6')],'subject':_0x7995('0xf7'),'text':util[_0x7995('0xdf')](_0x7995('0xf8'),_0x13d473['body'][_0x7995('0xf6')]),'attachments':[{'path':_0x521712}]}})[_0x7995('0xa1')](function(){return _0x1fda95;})[_0x7995('0x42')](function(_0x3c83dd){console['error'](_0x3c83dd);});}else{return _0x1fda95;}})[_0x7995('0xa1')](respondWithStatusCode(_0x1c3074,0xc8))[_0x7995('0x42')](handleError(_0x1c3074,null));};exports[_0x7995('0xf9')]=function(_0x955034,_0x4d19b8,_0x32c550){return db[_0x7995('0xfa')][_0x7995('0x6e')]({'where':{'id':_0x955034[_0x7995('0xbc')]['id']}})[_0x7995('0xa1')](handleEntityNotFound(_0x4d19b8,null))[_0x7995('0xa1')](function(_0x43a607){if(_0x43a607){return _0x43a607[_0x7995('0xf9')](_0x955034[_0x7995('0x81')]['ids'],_[_0x7995('0xfb')](_0x955034['body'],[_0x7995('0xfc'),'id'])||{});}})[_0x7995('0xa1')](respondWithResult(_0x4d19b8,null))[_0x7995('0x42')](handleError(_0x4d19b8,null));};exports[_0x7995('0xfd')]=function(_0x4787b4,_0x40a98f,_0x3d2563){var _0x152c79={'raw':![],'where':{}};var _0x129198={};var _0x2c715={'count':0x0,'rows':[]};return db[_0x7995('0x44')][_0x7995('0xd0')]({'where':{'id':_0x4787b4[_0x7995('0xbc')]['id']}})[_0x7995('0xa1')](handleEntityNotFound(_0x40a98f,null))[_0x7995('0xa1')](function(_0x45f389){if(_0x45f389){_0x129198[_0x7995('0x48')]=_[_0x7995('0x49')](db[_0x7995('0xfa')]['rawAttributes']);_0x129198['query']=_[_0x7995('0x49')](_0x4787b4[_0x7995('0x4e')]);_0x129198[_0x7995('0x4a')]=_['intersection'](_0x129198[_0x7995('0x48')],_0x129198[_0x7995('0x4e')]);_0x152c79[_0x7995('0x4b')]=_['intersection'](_0x129198[_0x7995('0x48')],qs[_0x7995('0x4d')](_0x4787b4[_0x7995('0x4e')][_0x7995('0x4d')]));_0x152c79[_0x7995('0x4b')]=_0x152c79[_0x7995('0x4b')][_0x7995('0x4f')]?_0x152c79[_0x7995('0x4b')]:_0x129198[_0x7995('0x48')];if(!_0x4787b4[_0x7995('0x4e')][_0x7995('0x50')]('nolimit')){_0x152c79['limit']=qs[_0x7995('0x30')](_0x4787b4['query'][_0x7995('0x30')]);_0x152c79[_0x7995('0x52')]=qs[_0x7995('0x52')](_0x4787b4[_0x7995('0x4e')][_0x7995('0x52')]);}_0x152c79['order']=qs['sort'](_0x4787b4[_0x7995('0x4e')][_0x7995('0x53')]);_0x152c79[_0x7995('0x54')]=qs[_0x7995('0x4a')](_[_0x7995('0x55')](_0x4787b4[_0x7995('0x4e')],_0x129198[_0x7995('0x4a')]));_0x152c79[_0x7995('0x54')][_0x7995('0xfe')]=_0x45f389['id'];if(_0x4787b4[_0x7995('0x4e')]['filter']){_0x152c79[_0x7995('0x54')]=_[_0x7995('0xaa')](_0x152c79[_0x7995('0x54')],{'$or':_[_0x7995('0x3b')](_0x152c79['attributes'],function(_0x4d6da0){var _0x53e855={};_0x53e855[_0x4d6da0]={'$like':'%'+_0x4787b4['query']['filter']+'%'};return _0x53e855;})});}if(_0x4787b4[_0x7995('0x4e')]['$gte']){var _0x4e55a8=_0x4787b4[_0x7995('0x4e')][_0x7995('0xff')][_0x7995('0x3f')](',');var _0x48b807={};_0x48b807[_0x4e55a8[0x0]]={'$gte':moment(_0x4e55a8[0x1])[_0x7995('0xdf')]('YYYY-MM-DD\x20HH:mm:ss')};_0x152c79[_0x7995('0x54')]=_[_0x7995('0xaa')](_0x152c79[_0x7995('0x54')],_0x48b807);}_0x152c79=_['merge']({},_0x152c79,_0x4787b4[_0x7995('0xbf')]);return db[_0x7995('0xfa')][_0x7995('0x2f')]({'where':_0x152c79['where']})[_0x7995('0xa1')](function(_0x15cfd3){_0x2c715[_0x7995('0x2f')]=_0x15cfd3;if(_0x4787b4[_0x7995('0x4e')][_0x7995('0xbd')]){_0x152c79['include']=[{'all':!![]}];}return db[_0x7995('0xfa')][_0x7995('0x100')](_0x152c79);})[_0x7995('0xa1')](function(_0x484b6c){_0x2c715[_0x7995('0xba')]=_0x484b6c;return _0x2c715;});}})[_0x7995('0xa1')](respondWithFilteredResult(_0x40a98f,_0x152c79))[_0x7995('0x42')](handleError(_0x40a98f,null));};exports[_0x7995('0x101')]=function(_0x34454a,_0x510dc8,_0x2995a3){var _0x193f29={'where':{}},_0x134724={},_0x1512e5={'count':0x0,'rows':[]};return db[_0x7995('0x44')][_0x7995('0xd0')]({'where':{'id':_0x34454a[_0x7995('0xbc')]['id']}})['then'](handleEntityNotFound(_0x510dc8,null))['then'](function(_0x37e0b8){if(_0x37e0b8){_0x134724[_0x7995('0x48')]=_['keys'](db['ChatMessage'][_0x7995('0x45')]);_0x134724[_0x7995('0x4e')]=_[_0x7995('0x49')](_0x34454a[_0x7995('0x4e')]);_0x134724[_0x7995('0x4a')]=_[_0x7995('0x4c')](_0x134724[_0x7995('0x48')],_0x134724['query']);_0x193f29[_0x7995('0x4b')]=_[_0x7995('0x4c')](_0x134724[_0x7995('0x48')],qs[_0x7995('0x4d')](_0x34454a[_0x7995('0x4e')][_0x7995('0x4d')]));_0x193f29['attributes']=_0x193f29[_0x7995('0x4b')][_0x7995('0x4f')]?_0x193f29[_0x7995('0x4b')]:_0x134724[_0x7995('0x48')];if(!_0x34454a[_0x7995('0x4e')][_0x7995('0x50')](_0x7995('0x51'))){_0x193f29['limit']=qs[_0x7995('0x30')](_0x34454a[_0x7995('0x4e')][_0x7995('0x30')]);_0x193f29[_0x7995('0x52')]=qs['offset'](_0x34454a[_0x7995('0x4e')]['offset']);}_0x193f29[_0x7995('0x9d')]=qs[_0x7995('0x53')](_0x34454a['query']['sort']);_0x193f29['where']=qs[_0x7995('0x4a')](_[_0x7995('0x55')](_0x34454a[_0x7995('0x4e')],_0x134724[_0x7995('0x4a')]));_0x193f29[_0x7995('0x54')][_0x7995('0xfe')]=_0x37e0b8['id'];if(_0x34454a[_0x7995('0x4e')][_0x7995('0x92')]){_0x193f29[_0x7995('0x54')]=_[_0x7995('0xaa')](_0x193f29[_0x7995('0x54')],{'$or':_[_0x7995('0x3b')](_0x193f29['attributes'],function(_0x5264dc){var _0x2695eb={};_0x2695eb[_0x5264dc]={'$like':'%'+_0x34454a['query']['filter']+'%'};return _0x2695eb;})});}_0x193f29[_0x7995('0x54')][_0x7995('0xea')]=![];if(_0x34454a[_0x7995('0x4e')]['id']){_0x193f29[_0x7995('0x54')]['id']={'$gt':_0x34454a[_0x7995('0x4e')]['id']};}_0x193f29=_[_0x7995('0xaa')]({},_0x193f29,_0x34454a[_0x7995('0xbf')]);return db[_0x7995('0xfa')][_0x7995('0x2f')]({'where':_0x193f29[_0x7995('0x54')]})[_0x7995('0xa1')](function(_0x1152b0){_0x1512e5['count']=_0x1152b0;_0x193f29[_0x7995('0xbe')]=[];if(_0x34454a[_0x7995('0x4e')][_0x7995('0x102')]){_0x193f29[_0x7995('0xbe')][_0x7995('0x41')]({'model':db[_0x7995('0xdc')],'as':_0x7995('0xdc'),'attributes':['id','fullname',_0x7995('0x103')]});}if(_0x34454a[_0x7995('0x4e')][_0x7995('0xbd')]){_0x193f29[_0x7995('0xbe')]=[{'all':!![]}];}return db[_0x7995('0xfa')]['findAll'](_0x193f29);})[_0x7995('0xa1')](function(_0x5e7fde){_0x1512e5[_0x7995('0xba')]=_0x5e7fde;return _0x1512e5;});}})[_0x7995('0xa1')](respondWithFilteredResult(_0x510dc8,_0x193f29))[_0x7995('0x42')](handleError(_0x510dc8,null));};exports['addTags']=function(_0x260e84,_0x2ba39e,_0x1d15bd){return db[_0x7995('0x44')][_0x7995('0x6e')]({'where':{'id':_0x260e84[_0x7995('0xbc')]['id']}})[_0x7995('0xa1')](handleEntityNotFound(_0x2ba39e,null))['then'](function(_0x55656a){if(_0x55656a){return _0x55656a[_0x7995('0x104')](_0x260e84[_0x7995('0x81')][_0x7995('0xfc')],_[_0x7995('0xfb')](_0x260e84[_0x7995('0x81')],[_0x7995('0xfc'),'id'])||{})['spread'](function(){return db[_0x7995('0x7c')][_0x7995('0x100')]({'attributes':['id',_0x7995('0x38'),_0x7995('0x105')],'where':{'id':_0x260e84['body']['ids']}});})[_0x7995('0xa1')](function(_0x3abe47){socket['emit'](_0x7995('0x106'),{'id':Number(_0x260e84[_0x7995('0xbc')]['id']),'tags':_0x3abe47||[]});return{'id':Number(_0x260e84['params']['id']),'tags':_0x3abe47||[]};});}})[_0x7995('0xa1')](respondWithResult(_0x2ba39e,null))[_0x7995('0x42')](handleError(_0x2ba39e,null));};exports[_0x7995('0x107')]=function(_0x26ab59,_0xfe4f58,_0x4b3689){return db['ChatInteraction'][_0x7995('0x6e')]({'where':{'id':_0x26ab59[_0x7995('0xbc')]['id']}})[_0x7995('0xa1')](handleEntityNotFound(_0xfe4f58,null))[_0x7995('0xa1')](function(_0x37fd9b){if(_0x37fd9b){return _0x37fd9b['removeTags'](_0x26ab59[_0x7995('0x4e')][_0x7995('0xfc')]);}})[_0x7995('0xa1')](respondWithStatusCode(_0xfe4f58,null))[_0x7995('0x42')](handleError(_0xfe4f58,null));};exports[_0x7995('0xd3')]=function(_0x53b372,_0x5c3ae8){var _0x56c94b=moment()['unix']()[_0x7995('0xa8')]();var _0x318a40=path['join'](config[_0x7995('0xd5')],_0x7995('0x108'),'files','tmp');var _0x1f4b2f=path[_0x7995('0xd4')](config[_0x7995('0xd5')],_0x7995('0x108'),_0x7995('0x109'),_0x7995('0x10a'));var _0x2aa426=path['join'](_0x318a40,_0x56c94b);var _0x5b87a5=util[_0x7995('0xdf')](_0x7995('0x10b'),_0x53b372[_0x7995('0xbc')]['id'],_0x56c94b);var _0x4b6fda=path[_0x7995('0xd4')](_0x318a40,_0x5b87a5);var _0x39cc1a=[];_0x39cc1a[_0x7995('0x41')]({'model':db[_0x7995('0xdc')],'as':_0x7995('0xdc'),'attributes':['id',_0x7995('0x3c')],'raw':!![]});_0x39cc1a[_0x7995('0x41')]({'model':db[_0x7995('0xde')],'as':_0x7995('0x74'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x53b372[_0x7995('0x4e')]['attachments']){_0x39cc1a[_0x7995('0x41')]({'model':db['Attachment'],'as':_0x7995('0xce'),'raw':!![]});}var _0x6f17fa=[{'model':db[_0x7995('0xfa')],'as':'Messages','attributes':['id','body',_0x7995('0x86'),_0x7995('0xe9'),_0x7995('0xea'),_0x7995('0x8d')],'include':_0x39cc1a}];_0x6f17fa[_0x7995('0x41')]({'model':db[_0x7995('0xdd')],'as':_0x7995('0x10c'),'attributes':['id',_0x7995('0x38')]});_0x6f17fa[_0x7995('0x41')]({'model':db[_0x7995('0xdc')],'as':_0x7995('0x10d'),'attributes':['id','fullname']});return db[_0x7995('0x44')][_0x7995('0x6e')]({'where':{'id':_0x53b372[_0x7995('0xbc')]['id']},'include':_0x6f17fa})[_0x7995('0xa1')](handleEntityNotFound(_0x5c3ae8,null))[_0x7995('0xa1')](function(_0x478a3c){if(_0x478a3c){var _0x3b5edf=_0x478a3c[_0x7995('0x10e')]({'plain':!![]});fs[_0x7995('0x10f')](_0x2aa426);var _0x3946cb={'format':'A4','border':_0x7995('0x110'),'header':{'height':_0x7995('0x111'),'contents':{'first':_0x7995('0x112')}},'footer':{'height':_0x7995('0x113'),'contents':{'default':util[_0x7995('0xdf')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x7995('0x114'),_0x7995('0x115'),_0x3b5edf['id']),moment()[_0x7995('0xdf')](_0x7995('0x116'))[_0x7995('0xa8')]())}}};var _0x498d7c={'channel':_0x7995('0x115'),'account':_0x3b5edf[_0x7995('0x10c')][_0x7995('0x38')],'agent':_0x3b5edf[_0x7995('0x10d')]?_0x3b5edf[_0x7995('0x10d')][_0x7995('0x3c')]:_0x7995('0x117'),'createdAt':moment(_0x3b5edf[_0x7995('0x86')])[_0x7995('0xdf')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x3b5edf[_0x7995('0xc6')]?moment(_0x3b5edf[_0x7995('0x118')])[_0x7995('0xdf')](_0x7995('0x119'))[_0x7995('0xa8')]():'','disposition':_0x3b5edf[_0x7995('0xc7')],'chatInfo':{'browser':_0x3b5edf[_0x7995('0x11a')],'os':_0x3b5edf[_0x7995('0x11b')],'referer':_0x3b5edf['referer'],'customerIp':_0x3b5edf['customerIp'],'customerPort':_0x3b5edf[_0x7995('0x11c')]?_0x3b5edf[_0x7995('0x11c')]:_0x7995('0x117')},'messages':_(_0x3b5edf[_0x7995('0xdb')])['tail']()['filter']({'secret':![]})[_0x7995('0x3b')](function(_0x43c0c1){if(_0x43c0c1[_0x7995('0xce')]){var _0x1522c4=path[_0x7995('0xd4')](_0x1f4b2f,_0x43c0c1[_0x7995('0xce')][_0x7995('0xcc')]);if(fs[_0x7995('0x11d')](_0x1522c4)){fs[_0x7995('0x11e')](_0x1522c4)[_0x7995('0x11f')](fs[_0x7995('0x120')](path[_0x7995('0xd4')](_0x2aa426,_0x43c0c1['Attachment']['basename'])));}}return{'date':moment(_0x43c0c1[_0x7995('0x86')])[_0x7995('0xdf')](_0x7995('0x119'))[_0x7995('0xa8')](),'sender':_0x43c0c1['direction']===_0x7995('0x121')?_0x43c0c1['User']?_0x43c0c1[_0x7995('0xdc')][_0x7995('0x3c')]:_0x7995('0xe2'):_0x43c0c1[_0x7995('0x74')][_0x7995('0x122')]+(_0x43c0c1[_0x7995('0x74')]['lastName']?'\x20'+_0x43c0c1[_0x7995('0x74')][_0x7995('0x123')]:''),'body':_0x43c0c1[_0x7995('0xce')]?_0x43c0c1[_0x7995('0xce')]['basename']:_0x43c0c1['body'],'direction':_0x43c0c1[_0x7995('0xe9')]===_0x7995('0x121')?'A':'C','secret':_0x43c0c1[_0x7995('0xea')],'read':_0x43c0c1[_0x7995('0x8d')],'attachment':_0x43c0c1['Attachment']};})[_0x7995('0x70')]()};return ejs[_0x7995('0x124')](path[_0x7995('0xd4')](config['root'],_0x7995('0x108'),_0x7995('0x125'),_0x7995('0x126')),{'interaction':_0x498d7c})['then'](function(_0xad13){return new BPromise(function(_0xb259cc,_0x269493){pdf[_0x7995('0xcf')](_0xad13,_0x3946cb)[_0x7995('0x127')](path[_0x7995('0xd4')](_0x2aa426,_0x7995('0x128')+_0x3b5edf['id']+'-'+_0x56c94b+_0x7995('0x129')),function(_0x3a285b,_0x57fdc0){if(_0x3a285b)return _0x269493(_0x3a285b);_0xb259cc(_0x57fdc0);});});})[_0x7995('0xa1')](function(){return new BPromise(function(_0x16aaf9,_0x191da7){zipdir(_0x2aa426,{'saveTo':_0x4b6fda},function(_0x100c5b,_0x5eb18f){if(_0x100c5b)return _0x191da7(_0x100c5b);return _0x16aaf9(_0x5eb18f);});})[_0x7995('0xa1')](function(){return new BPromise(function(_0x25494f,_0x315777){rimraf(_0x2aa426,function(_0x117980){if(_0x117980)_0x315777(_0x117980);return _0x25494f();});});})['then'](function(){return _0x5c3ae8[_0x7995('0xd3')](_0x4b6fda,_0x5b87a5,function(_0x39b8d8){if(_0x39b8d8){console[_0x7995('0x12a')](_0x7995('0x12b'),_0x39b8d8);}else{fs[_0x7995('0x12c')](_0x4b6fda);}});});});}else{return _0x5c3ae8[_0x7995('0x2c')](0xc8);}})[_0x7995('0x42')](handleError(_0x5c3ae8,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 5168c90..19b6979 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 _0x7e15=['exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0x7e15,0x144));var _0x57e1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7e15[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x57e1('0x0'));var ChatInteraction=require(_0x57e1('0x1'))['db'][_0x57e1('0x2')];var ChatMessage=require(_0x57e1('0x1'))['db'][_0x57e1('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x57e1('0x4')](0x0);var events={'afterCreate':_0x57e1('0x5'),'afterUpdate':_0x57e1('0x6'),'afterDestroy':_0x57e1('0x7')};function emitEvent(_0x3288a5){return function(_0x2ea86e,_0x403828,_0x606568){_0x2ea86e[_0x57e1('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x954313){_0x2ea86e['setDataValue'](_0x57e1('0x9'),_0x954313[_0x57e1('0xa')](function(_0x1d237a){return{'id':_0x1d237a['id']};}));return ChatMessage[_0x57e1('0xb')]({'where':{'ChatInteractionId':_0x2ea86e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5daccb){_0x2ea86e[_0x57e1('0xc')](_0x57e1('0xd'),_0x5daccb[_0x57e1('0xe')]);ChatInteractionEvents['emit'](_0x3288a5+':'+_0x2ea86e['id'],_0x2ea86e);ChatInteractionEvents[_0x57e1('0xf')](_0x3288a5,_0x2ea86e);_0x606568(null);})[_0x57e1('0x10')](_0x606568(null));};}for(var e in events){if(events[_0x57e1('0x11')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x57e1('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0x7f59=['save','update','remove','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x7f59,0x12e));var _0x97f5=function(_0x551d3b,_0x38b288){_0x551d3b=_0x551d3b-0x0;var _0x585640=_0x7f59[_0x551d3b];return _0x585640;};'use strict';var EventEmitter=require(_0x97f5('0x0'));var ChatInteraction=require(_0x97f5('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x97f5('0x1'))['db'][_0x97f5('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x97f5('0x3')](0x0);var events={'afterCreate':_0x97f5('0x4'),'afterUpdate':_0x97f5('0x5'),'afterDestroy':_0x97f5('0x6')};function emitEvent(_0x29af72){return function(_0x5e6215,_0x507c36,_0x498110){_0x5e6215['getUsers']({'attributes':['id'],'raw':!![]})[_0x97f5('0x7')](function(_0x1d0a13){_0x5e6215[_0x97f5('0x8')](_0x97f5('0x9'),_0x1d0a13[_0x97f5('0xa')](function(_0x2d917c){return{'id':_0x2d917c['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x5e6215['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5416d1){_0x5e6215[_0x97f5('0x8')]('unreadMessages',_0x5416d1[_0x97f5('0xb')]);ChatInteractionEvents[_0x97f5('0xc')](_0x29af72+':'+_0x5e6215['id'],_0x5e6215);ChatInteractionEvents['emit'](_0x29af72,_0x5e6215);_0x498110(null);})[_0x97f5('0xd')](_0x498110(null));};}for(var e in events){if(events[_0x97f5('0xe')](e)){var event=events[e];ChatInteraction[_0x97f5('0xf')](e,emitEvent(event));}}module[_0x97f5('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 6d23e7d..6ae1f1d 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 _0x01a1=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf','exports','ChatInteraction','closed'];(function(_0x466e57,_0x21b819){var _0x34df42=function(_0x3e9758){while(--_0x3e9758){_0x466e57['push'](_0x466e57['shift']());}};_0x34df42(++_0x21b819);}(_0x01a1,0xba));var _0x101a=function(_0x596027,_0x1d359b){_0x596027=_0x596027-0x0;var _0x4d22c4=_0x01a1[_0x596027];return _0x4d22c4;};'use strict';var _=require(_0x101a('0x0'));var util=require('util');var logger=require(_0x101a('0x1'))(_0x101a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x101a('0x3'));var fs=require('fs');var path=require(_0x101a('0x4'));var rimraf=require(_0x101a('0x5'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x101a('0x6')]=function(_0x1b59eb,_0x2b1cef){return _0x1b59eb['define'](_0x101a('0x7'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x271339,_0x23fa2f,_0x5b7730){if(_0x271339['changed'](_0x101a('0x8'))){_0x271339[_0x101a('0x9')]=moment()[_0x101a('0xa')](_0x101a('0xb'));}_0x5b7730(null,_0x271339);}},'charset':'utf8mb4','collate':_0x101a('0xc')});}; \ No newline at end of file +var _0x7e65=['api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','format','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x7e65,0x7c));var _0x57e6=function(_0x333d03,_0x28fc54){_0x333d03=_0x333d03-0x0;var _0x3ee01b=_0x7e65[_0x333d03];return _0x3ee01b;};'use strict';var _=require(_0x57e6('0x0'));var util=require(_0x57e6('0x1'));var logger=require('../../config/logger')(_0x57e6('0x2'));var moment=require('moment');var BPromise=require(_0x57e6('0x3'));var rp=require(_0x57e6('0x4'));var fs=require('fs');var path=require(_0x57e6('0x5'));var rimraf=require(_0x57e6('0x6'));var config=require(_0x57e6('0x7'));var attributes=require(_0x57e6('0x8'));module[_0x57e6('0x9')]=function(_0x27a893,_0x24dd26){return _0x27a893[_0x57e6('0xa')](_0x57e6('0xb'),attributes,{'tableName':_0x57e6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x399a8c,_0x56fe5f,_0x5d7e78){if(_0x399a8c[_0x57e6('0xd')](_0x57e6('0xe'))){_0x399a8c['closedAt']=moment()[_0x57e6('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5d7e78(null,_0x399a8c);}},'charset':_0x57e6('0x10'),'collate':_0x57e6('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index a4f7f4b..ec4e491 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 _0x0774=['ChatInteraction,\x20%s,\x20%s','result','ChatInteraction','update','options','attributes','UpdateChatInteraction','catch','AddTagsToChatInteraction','find','addTags','ids','omit','body','spread','AddTags','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','request','then','info','request\x20sent','debug','error','code','message'];(function(_0x19e8ac,_0x4f194b){var _0x584855=function(_0x409ee3){while(--_0x409ee3){_0x19e8ac['push'](_0x19e8ac['shift']());}};_0x584855(++_0x4f194b);}(_0x0774,0x10c));var _0x4077=function(_0x139030,_0x4f4975){_0x139030=_0x139030-0x0;var _0x431626=_0x0774[_0x139030];return _0x431626;};'use strict';var _=require('lodash');var util=require(_0x4077('0x0'));var moment=require('moment');var BPromise=require(_0x4077('0x1'));var rs=require(_0x4077('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4077('0x3'))['db'];var utils=require(_0x4077('0x4'));var logger=require('../../config/logger')(_0x4077('0x5'));var config=require(_0x4077('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4077('0x7')][_0x4077('0x8')]({'port':0x232a});config[_0x4077('0x9')]=_[_0x4077('0xa')](config[_0x4077('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4077('0xb'))(new Redis(config[_0x4077('0x9')]));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x93358,_0xb40795,_0x3198ba){return new BPromise(function(_0x48485b,_0x2de616){return client[_0x4077('0xc')](_0x93358,_0x3198ba)[_0x4077('0xd')](function(_0x324d95){logger[_0x4077('0xe')]('ChatInteraction,\x20%s,\x20%s',_0xb40795,_0x4077('0xf'));logger[_0x4077('0x10')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xb40795,_0x4077('0xf'),JSON['stringify'](_0x324d95));if(_0x324d95[_0x4077('0x11')]){if(_0x324d95[_0x4077('0x11')][_0x4077('0x12')]===0x1f4){logger[_0x4077('0x11')]('ChatInteraction,\x20%s,\x20%s',_0xb40795,_0x324d95[_0x4077('0x11')][_0x4077('0x13')]);return _0x2de616(_0x324d95[_0x4077('0x11')]['message']);}logger[_0x4077('0x11')]('ChatInteraction,\x20%s,\x20%s',_0xb40795,_0x324d95[_0x4077('0x11')]['message']);return _0x48485b(_0x324d95[_0x4077('0x11')][_0x4077('0x13')]);}else{logger[_0x4077('0xe')](_0x4077('0x14'),_0xb40795,_0x4077('0xf'));_0x48485b(_0x324d95[_0x4077('0x15')][_0x4077('0x13')]);}})['catch'](function(_0x33b52d){logger[_0x4077('0x11')](_0x4077('0x14'),_0xb40795,_0x33b52d);_0x2de616(_0x33b52d);});});}exports['UpdateChatInteraction']=function(_0x99b06d){var _0xe086cc=this;return new Promise(function(_0x1e6c67,_0x37c042){return db[_0x4077('0x16')][_0x4077('0x17')](_0x99b06d['body'],{'raw':_0x99b06d[_0x4077('0x18')]?_0x99b06d[_0x4077('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x99b06d[_0x4077('0x18')]?_0x99b06d[_0x4077('0x18')]['where']||null:null,'attributes':_0x99b06d[_0x4077('0x18')]?_0x99b06d['options'][_0x4077('0x19')]||null:null,'limit':_0x99b06d[_0x4077('0x18')]?_0x99b06d['options']['limit']||null:null})[_0x4077('0xd')](function(_0x537213){logger['info'](_0x4077('0x1a'),_0x99b06d);logger[_0x4077('0x10')](_0x4077('0x1a'),_0x99b06d,JSON['stringify'](_0x537213));_0x1e6c67(_0x537213);})[_0x4077('0x1b')](function(_0x174f6f){logger[_0x4077('0x11')](_0x4077('0x1a'),_0x174f6f[_0x4077('0x13')],_0x99b06d);_0x37c042(_0xe086cc['error'](0x1f4,_0x174f6f['message']));});});};exports[_0x4077('0x1c')]=function(_0x6b539b){return new Promise(function(_0x3e7833,_0x237549){return db[_0x4077('0x16')][_0x4077('0x1d')]({'where':_0x6b539b['options']?_0x6b539b[_0x4077('0x18')]['where']||null:null})[_0x4077('0xd')](function(_0x11c84a){if(_0x11c84a){return _0x11c84a[_0x4077('0x1e')](_0x6b539b['body'][_0x4077('0x1f')],_[_0x4077('0x20')](_0x6b539b[_0x4077('0x21')],[_0x4077('0x1f'),'id'])||{});}})[_0x4077('0x22')](function(_0x5eccff){logger[_0x4077('0xe')](_0x4077('0x23'),_0x6b539b);logger[_0x4077('0x10')](_0x4077('0x23'),_0x6b539b,JSON['stringify'](_0x5eccff));_0x3e7833(_0x5eccff);})[_0x4077('0x1b')](function(_0x23f4d1){logger[_0x4077('0x11')](_0x4077('0x23'),_0x23f4d1['message'],_0x6b539b);_0x237549(_this['error'](0x1f4,_0x23f4d1['message']));});});}; \ No newline at end of file +var _0x5a32=['error','code','message','info','result','catch','ChatInteraction','update','options','raw','where','attributes','limit','then','UpdateChatInteraction','find','addTags','body','ids','omit','spread','AddTags','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x59128,_0x5a5650){var _0x436195=function(_0x3c72fb){while(--_0x3c72fb){_0x59128['push'](_0x59128['shift']());}};_0x436195(++_0x5a5650);}(_0x5a32,0x8e));var _0x25a3=function(_0x2f5776,_0x4c40ad){_0x2f5776=_0x2f5776-0x0;var _0x3559e7=_0x5a32[_0x2f5776];return _0x3559e7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x25a3('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25a3('0x1'));var db=require(_0x25a3('0x2'))['db'];var utils=require(_0x25a3('0x3'));var logger=require(_0x25a3('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25a3('0x5')]['http']({'port':0x232a});config['redis']=_[_0x25a3('0x6')](config[_0x25a3('0x7')],{'host':_0x25a3('0x8'),'port':0x18eb});var socket=require(_0x25a3('0x9'))(new Redis(config['redis']));require(_0x25a3('0xa'))[_0x25a3('0xb')](socket);function respondWithRpcPromise(_0x33c6ac,_0x359f65,_0x3a8f71){return new BPromise(function(_0x177bef,_0x308e4b){return client[_0x25a3('0xc')](_0x33c6ac,_0x3a8f71)['then'](function(_0x43828c){logger['info'](_0x25a3('0xd'),_0x359f65,_0x25a3('0xe'));logger[_0x25a3('0xf')](_0x25a3('0x10'),_0x359f65,_0x25a3('0xe'),JSON[_0x25a3('0x11')](_0x43828c));if(_0x43828c['error']){if(_0x43828c[_0x25a3('0x12')][_0x25a3('0x13')]===0x1f4){logger[_0x25a3('0x12')](_0x25a3('0xd'),_0x359f65,_0x43828c['error'][_0x25a3('0x14')]);return _0x308e4b(_0x43828c[_0x25a3('0x12')]['message']);}logger[_0x25a3('0x12')](_0x25a3('0xd'),_0x359f65,_0x43828c[_0x25a3('0x12')][_0x25a3('0x14')]);return _0x177bef(_0x43828c[_0x25a3('0x12')][_0x25a3('0x14')]);}else{logger[_0x25a3('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x359f65,_0x25a3('0xe'));_0x177bef(_0x43828c[_0x25a3('0x16')]['message']);}})[_0x25a3('0x17')](function(_0x3d043d){logger[_0x25a3('0x12')](_0x25a3('0xd'),_0x359f65,_0x3d043d);_0x308e4b(_0x3d043d);});});}exports['UpdateChatInteraction']=function(_0x286f23){var _0x456445=this;return new Promise(function(_0x382cd1,_0x2a5089){return db[_0x25a3('0x18')][_0x25a3('0x19')](_0x286f23['body'],{'raw':_0x286f23['options']?_0x286f23[_0x25a3('0x1a')][_0x25a3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x286f23['options']?_0x286f23['options'][_0x25a3('0x1c')]||null:null,'attributes':_0x286f23[_0x25a3('0x1a')]?_0x286f23['options'][_0x25a3('0x1d')]||null:null,'limit':_0x286f23[_0x25a3('0x1a')]?_0x286f23[_0x25a3('0x1a')][_0x25a3('0x1e')]||null:null})[_0x25a3('0x1f')](function(_0x1c5bf8){logger[_0x25a3('0x15')](_0x25a3('0x20'),_0x286f23);logger[_0x25a3('0xf')](_0x25a3('0x20'),_0x286f23,JSON[_0x25a3('0x11')](_0x1c5bf8));_0x382cd1(_0x1c5bf8);})[_0x25a3('0x17')](function(_0xbd50c7){logger[_0x25a3('0x12')](_0x25a3('0x20'),_0xbd50c7[_0x25a3('0x14')],_0x286f23);_0x2a5089(_0x456445[_0x25a3('0x12')](0x1f4,_0xbd50c7[_0x25a3('0x14')]));});});};exports['AddTagsToChatInteraction']=function(_0x1ad3fd){return new Promise(function(_0x137d36,_0x29977a){return db['ChatInteraction'][_0x25a3('0x21')]({'where':_0x1ad3fd[_0x25a3('0x1a')]?_0x1ad3fd[_0x25a3('0x1a')][_0x25a3('0x1c')]||null:null})['then'](function(_0x52715e){if(_0x52715e){return _0x52715e[_0x25a3('0x22')](_0x1ad3fd[_0x25a3('0x23')][_0x25a3('0x24')],_[_0x25a3('0x25')](_0x1ad3fd[_0x25a3('0x23')],[_0x25a3('0x24'),'id'])||{});}})[_0x25a3('0x26')](function(_0x34ed27){logger[_0x25a3('0x15')](_0x25a3('0x27'),_0x1ad3fd);logger[_0x25a3('0xf')](_0x25a3('0x27'),_0x1ad3fd,JSON[_0x25a3('0x11')](_0x34ed27));_0x137d36(_0x34ed27);})[_0x25a3('0x17')](function(_0x36f2e4){logger['error'](_0x25a3('0x27'),_0x36f2e4[_0x25a3('0x14')],_0x1ad3fd);_0x29977a(_this[_0x25a3('0x12')](0x1f4,_0x36f2e4[_0x25a3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 3c7705e..0da59ad 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 _0xa30d=['chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xa30d,0x91));var _0xda30=function(_0x36f343,_0x23736e){_0x36f343=_0x36f343-0x0;var _0x5cff2e=_0xa30d[_0x36f343];return _0x5cff2e;};'use strict';var ChatInteractionEvents=require(_0xda30('0x0'));var events=[_0xda30('0x1'),_0xda30('0x2'),_0xda30('0x3')];function createListener(_0x20654f,_0x529e26){return function(_0x1cc5ee){_0x529e26[_0xda30('0x4')](_0x20654f,_0x1cc5ee);};}function removeListener(_0xb969a6,_0x1fd679){return function(){ChatInteractionEvents[_0xda30('0x5')](_0xb969a6,_0x1fd679);};}exports[_0xda30('0x6')]=function(_0x5c5fa7){for(var _0xefec77=0x0,_0x412104=events[_0xda30('0x7')];_0xefec77<_0x412104;_0xefec77++){var _0x4fb003=events[_0xefec77];var _0x23fb39=createListener(_0xda30('0x8')+_0x4fb003,_0x5c5fa7);ChatInteractionEvents['on'](_0x4fb003,_0x23fb39);}}; \ No newline at end of file +var _0xb7f4=['chatInteraction:','./chatInteraction.events','remove','update','emit','removeListener','register'];(function(_0x3729a5,_0xb119ac){var _0x59c7ab=function(_0x720df5){while(--_0x720df5){_0x3729a5['push'](_0x3729a5['shift']());}};_0x59c7ab(++_0xb119ac);}(_0xb7f4,0x151));var _0x4b7f=function(_0x536689,_0x1f31ae){_0x536689=_0x536689-0x0;var _0x5084da=_0xb7f4[_0x536689];return _0x5084da;};'use strict';var ChatInteractionEvents=require(_0x4b7f('0x0'));var events=['save',_0x4b7f('0x1'),_0x4b7f('0x2')];function createListener(_0x14bf7,_0xecb255){return function(_0x2f7def){_0xecb255[_0x4b7f('0x3')](_0x14bf7,_0x2f7def);};}function removeListener(_0xd9ceb,_0x24a446){return function(){ChatInteractionEvents[_0x4b7f('0x4')](_0xd9ceb,_0x24a446);};}exports[_0x4b7f('0x5')]=function(_0x236504){for(var _0x2e420a=0x0,_0x3600e3=events['length'];_0x2e420a<_0x3600e3;_0x2e420a++){var _0x599ec1=events[_0x2e420a];var _0x3526a8=createListener(_0x4b7f('0x6')+_0x599ec1,_0x236504);ChatInteractionEvents['on'](_0x599ec1,_0x3526a8);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 976263e..0b28b9d 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 _0x2cb1=['isAuthenticated','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create','diskStorage','root','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','tracked','addTags','put','/:id','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe'];(function(_0x5749b7,_0x19e925){var _0x93a704=function(_0xa1e09a){while(--_0xa1e09a){_0x5749b7['push'](_0x5749b7['shift']());}};_0x93a704(++_0x19e925);}(_0x2cb1,0x1a3));var _0x12cb=function(_0x52c0be,_0x5db85b){_0x52c0be=_0x52c0be-0x0;var _0x43f1fa=_0x2cb1[_0x52c0be];return _0x43f1fa;};'use strict';var multer=require(_0x12cb('0x0'));var util=require(_0x12cb('0x1'));var path=require(_0x12cb('0x2'));var timeout=require(_0x12cb('0x3'));var express=require(_0x12cb('0x4'));var router=express[_0x12cb('0x5')]();var auth=require(_0x12cb('0x6'));var interaction=require(_0x12cb('0x7'));var config=require(_0x12cb('0x8'));var controller=require(_0x12cb('0x9'));router[_0x12cb('0xa')]('/',auth['isAuthenticated'](),controller[_0x12cb('0xb')]);router[_0x12cb('0xa')](_0x12cb('0xc'),auth[_0x12cb('0xd')](),controller['describe']);router[_0x12cb('0xa')]('/:id',auth[_0x12cb('0xe')](),controller[_0x12cb('0xf')]);router[_0x12cb('0xa')](_0x12cb('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x12cb('0x11')]);router['get'](_0x12cb('0x12'),auth['isAuthenticated'](),controller[_0x12cb('0x13')]);router['get'](_0x12cb('0x14'),auth[_0x12cb('0xe')](),controller[_0x12cb('0x15')]);router[_0x12cb('0xa')]('/:id/download',auth[_0x12cb('0xd')](),controller[_0x12cb('0x16')]);router[_0x12cb('0x17')]('/',auth[_0x12cb('0xd')](),controller[_0x12cb('0x18')]);var upload=multer({'storage':multer[_0x12cb('0x19')]({'destination':function(_0x555c00,_0x27777b,_0x1109ed){_0x1109ed(null,path['join'](config[_0x12cb('0x1a')],_0x12cb('0x1b')));},'filename':function(_0x5c000a,_0x5c4c5a,_0x1b399c){_0x1b399c(null,util[_0x12cb('0x1c')](_0x12cb('0x1d'),Date['now'](),_0x5c4c5a[_0x12cb('0x1e')][_0x12cb('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x12cb('0x17')](_0x12cb('0x20'),upload[_0x12cb('0x21')]('file'),controller[_0x12cb('0x22')]);router['post'](_0x12cb('0x12'),auth['isChatInteractionAuthorized'](),controller[_0x12cb('0x23')]);router[_0x12cb('0x17')]('/:id/tags',auth[_0x12cb('0xd')](),interaction[_0x12cb('0x24')]('chat','chatinteraction:addtags'),controller[_0x12cb('0x25')]);router[_0x12cb('0x26')](_0x12cb('0x27'),auth[_0x12cb('0xd')](),interaction['tracked'](_0x12cb('0x28'),_0x12cb('0x29')),controller[_0x12cb('0x2a')]);router[_0x12cb('0x26')](_0x12cb('0x2b'),controller[_0x12cb('0x2c')]);router[_0x12cb('0x26')](_0x12cb('0x2d'),auth['isChatInteractionAuthorized'](),controller[_0x12cb('0x2e')]);router[_0x12cb('0x26')](_0x12cb('0x2f'),controller[_0x12cb('0x30')]);router[_0x12cb('0x31')](_0x12cb('0x27'),auth['isAuthenticated'](),interaction['tracked']('chat',_0x12cb('0x32')),controller[_0x12cb('0x33')]);router['delete'](_0x12cb('0x34'),auth[_0x12cb('0xd')](),controller['removeTags']);module[_0x12cb('0x35')]=router; \ No newline at end of file +var _0x64af=['delete','chatinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','/describe','describe','get','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','post','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','/:id/abandon','abandon','/:id/close','close'];(function(_0x4baea5,_0x45804d){var _0xf0f767=function(_0x4a756e){while(--_0x4a756e){_0x4baea5['push'](_0x4baea5['shift']());}};_0xf0f767(++_0x45804d);}(_0x64af,0x69));var _0xf64a=function(_0x57fda8,_0x5e80a0){_0x57fda8=_0x57fda8-0x0;var _0x11c895=_0x64af[_0x57fda8];return _0x11c895;};'use strict';var multer=require('multer');var util=require(_0xf64a('0x0'));var path=require(_0xf64a('0x1'));var timeout=require(_0xf64a('0x2'));var express=require(_0xf64a('0x3'));var router=express['Router']();var auth=require(_0xf64a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf64a('0x5'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0xf64a('0x6')](),controller['index']);router['get'](_0xf64a('0x7'),auth[_0xf64a('0x6')](),controller[_0xf64a('0x8')]);router[_0xf64a('0x9')](_0xf64a('0xa'),auth[_0xf64a('0xb')](),controller[_0xf64a('0xc')]);router['get'](_0xf64a('0xd'),auth['isChatInteractionAuthorized'](),controller[_0xf64a('0xe')]);router[_0xf64a('0x9')](_0xf64a('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xf64a('0x10'),auth[_0xf64a('0xb')](),controller[_0xf64a('0x11')]);router[_0xf64a('0x9')](_0xf64a('0x12'),auth['isAuthenticated'](),controller[_0xf64a('0x13')]);router[_0xf64a('0x14')]('/',auth[_0xf64a('0x6')](),controller['create']);var upload=multer({'storage':multer[_0xf64a('0x15')]({'destination':function(_0x47f89d,_0x47242d,_0x1d2bb1){_0x1d2bb1(null,path['join'](config[_0xf64a('0x16')],_0xf64a('0x17')));},'filename':function(_0x4afd58,_0x3a9cfc,_0x513a06){_0x513a06(null,util[_0xf64a('0x18')](_0xf64a('0x19'),Date[_0xf64a('0x1a')](),_0x3a9cfc[_0xf64a('0x1b')][_0xf64a('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf64a('0x14')](_0xf64a('0x1d'),upload[_0xf64a('0x1e')](_0xf64a('0x1f')),controller['attachmentUpload']);router[_0xf64a('0x14')](_0xf64a('0xf'),auth[_0xf64a('0xb')](),controller[_0xf64a('0x20')]);router[_0xf64a('0x14')](_0xf64a('0x21'),auth[_0xf64a('0x6')](),interaction[_0xf64a('0x22')](_0xf64a('0x23'),_0xf64a('0x24')),controller[_0xf64a('0x25')]);router[_0xf64a('0x26')](_0xf64a('0xa'),auth['isAuthenticated'](),interaction[_0xf64a('0x22')]('chat',_0xf64a('0x27')),controller['update']);router['put'](_0xf64a('0x28'),controller['customUpdate']);router['put'](_0xf64a('0x29'),auth[_0xf64a('0xb')](),controller[_0xf64a('0x2a')]);router['put'](_0xf64a('0x2b'),controller[_0xf64a('0x2c')]);router[_0xf64a('0x2d')](_0xf64a('0xa'),auth[_0xf64a('0x6')](),interaction[_0xf64a('0x22')]('chat',_0xf64a('0x2e')),controller[_0xf64a('0x2f')]);router['delete']('/:id/tags',auth[_0xf64a('0x6')](),controller[_0xf64a('0x30')]);module[_0xf64a('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 666cdd2..521312c 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js +++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['exports','medium','BOOLEAN','INTEGER'];(function(_0x3e47a4,_0x56a82d){var _0x5d4261=function(_0x5b5bbf){while(--_0x5b5bbf){_0x3e47a4['push'](_0x3e47a4['shift']());}};_0x5d4261(++_0x56a82d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x65f6('0x3')]}}; \ No newline at end of file +var _0x57ca=['exports','TEXT','BOOLEAN','INTEGER'];(function(_0x276362,_0x307c93){var _0x202de5=function(_0x415a76){while(--_0x415a76){_0x276362['push'](_0x276362['shift']());}};_0x202de5(++_0x307c93);}(_0x57ca,0x108));var _0xa57c=function(_0x32d849,_0x574eb3){_0x32d849=_0x32d849-0x0;var _0x41be15=_0x57ca[_0x32d849];return _0x41be15;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'body':{'type':Sequelize[_0xa57c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa57c('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa57c('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f101281..b598e3b 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 _0x4cf5=['rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','ChatInternalMessage','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','user','role','userpic','internal','lastLoginAt','allowmessenger','-online','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','FromId','-createdAt','all','html-pdf','eml-format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4cf5,0x139));var _0x54cf=function(_0x9e43a9,_0x55b21d){_0x9e43a9=_0x9e43a9-0x0;var _0x1b340e=_0x4cf5[_0x9e43a9];return _0x1b340e;};'use strict';var pdf=require(_0x54cf('0x0'));var emlformat=require(_0x54cf('0x1'));var rimraf=require(_0x54cf('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x54cf('0x3'));var rp=require('request-promise');var moment=require(_0x54cf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x54cf('0x5'));var util=require('util');var path=require(_0x54cf('0x6'));var sox=require(_0x54cf('0x7'));var csv=require(_0x54cf('0x8'));var ejs=require(_0x54cf('0x9'));var fs=require('fs');var _=require(_0x54cf('0xa'));var squel=require(_0x54cf('0xb'));var crypto=require(_0x54cf('0xc'));var jsforce=require(_0x54cf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x54cf('0xe'));var Papa=require('papaparse');var Redis=require(_0x54cf('0xf'));var authService=require(_0x54cf('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x54cf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x54cf('0x12'))(_0x54cf('0x13'));var utils=require(_0x54cf('0x14'));var config=require(_0x54cf('0x15'));var db=require(_0x54cf('0x16'))['db'];config[_0x54cf('0x17')]=_[_0x54cf('0x18')](config[_0x54cf('0x17')],{'host':_0x54cf('0x19'),'port':0x18eb});var socket=require(_0x54cf('0x1a'))(new Redis(config[_0x54cf('0x17')]));require(_0x54cf('0x1b'))['register'](socket);function respondWithStatusCode(_0x3c10a6,_0x56dd39){_0x56dd39=_0x56dd39||0xcc;return function(_0x13c6f3){if(_0x13c6f3){return _0x3c10a6[_0x54cf('0x1c')](_0x56dd39);}return _0x3c10a6['status'](_0x56dd39)[_0x54cf('0x1d')]();};}function respondWithResult(_0x15c300,_0x4f1a25){_0x4f1a25=_0x4f1a25||0xc8;return function(_0xf54a6b){if(_0xf54a6b){return _0x15c300[_0x54cf('0x1e')](_0x4f1a25)[_0x54cf('0x1f')](_0xf54a6b);}};}function respondWithFilteredResult(_0xfb9f8f,_0x8170){return function(_0x8b96e0){if(_0x8b96e0){var _0x52ff21=_0x8b96e0[_0x54cf('0x20')],_0x3e1c0e=_0x8170[_0x54cf('0x21')],_0x544ace=_0x8170[_0x54cf('0x21')]+_0x8170[_0x54cf('0x22')],_0x5c5d95;if(_0x544ace>=_0x52ff21){_0x544ace=_0x52ff21;_0x5c5d95=0xc8;}else{_0x5c5d95=0xce;}_0xfb9f8f[_0x54cf('0x1e')](_0x5c5d95);return _0xfb9f8f[_0x54cf('0x23')](_0x54cf('0x24'),_0x3e1c0e+'-'+_0x544ace+'/'+_0x52ff21)[_0x54cf('0x1f')](_0x8b96e0);}return null;};}function patchUpdates(_0x421eeb){return function(_0x584675){try{jsonpatch[_0x54cf('0x25')](_0x584675,_0x421eeb,!![]);}catch(_0x293f19){return BPromise[_0x54cf('0x26')](_0x293f19);}return _0x584675[_0x54cf('0x27')]();};}function saveUpdates(_0x4ea85b,_0x5131ab){return function(_0x3b8bbe){if(_0x3b8bbe){return _0x3b8bbe[_0x54cf('0x28')](_0x4ea85b)[_0x54cf('0x29')](function(_0x704899){return _0x704899;});}return null;};}function removeEntity(_0x99a05f,_0xd2cbb7){return function(_0x4fe1e9){if(_0x4fe1e9){return _0x4fe1e9[_0x54cf('0x2a')]()[_0x54cf('0x29')](function(){_0x99a05f['status'](0xcc)[_0x54cf('0x1d')]();});}};}function handleEntityNotFound(_0x58e40c,_0xc021d0){return function(_0x31b734){if(!_0x31b734){_0x58e40c['sendStatus'](0x194);}return _0x31b734;};}function handleError(_0x3bbce2,_0x4dbc86){_0x4dbc86=_0x4dbc86||0x1f4;return function(_0x2d2063){logger['error'](_0x2d2063['stack']);if(_0x2d2063[_0x54cf('0x2b')]){delete _0x2d2063[_0x54cf('0x2b')];}_0x3bbce2[_0x54cf('0x1e')](_0x4dbc86)[_0x54cf('0x2c')](_0x2d2063);};}exports[_0x54cf('0x2d')]=function(_0x3ce30c,_0x2617b2){var _0x30698b={},_0x5eac9c={},_0x5692d8={'count':0x0,'rows':[]};var _0x220965=_[_0x54cf('0x2e')](db[_0x54cf('0x2f')][_0x54cf('0x30')],function(_0x3aa41f){return{'name':_0x3aa41f['fieldName'],'type':_0x3aa41f['type'][_0x54cf('0x31')]};});_0x5eac9c[_0x54cf('0x32')]=_['map'](_0x220965,_0x54cf('0x2b'));_0x5eac9c[_0x54cf('0x33')]=_[_0x54cf('0x34')](_0x3ce30c[_0x54cf('0x33')]);_0x5eac9c['filters']=_[_0x54cf('0x35')](_0x5eac9c[_0x54cf('0x32')],_0x5eac9c[_0x54cf('0x33')]);_0x30698b[_0x54cf('0x36')]=_[_0x54cf('0x35')](_0x5eac9c[_0x54cf('0x32')],qs[_0x54cf('0x37')](_0x3ce30c[_0x54cf('0x33')][_0x54cf('0x37')]));_0x30698b[_0x54cf('0x36')]=_0x30698b[_0x54cf('0x36')][_0x54cf('0x38')]?_0x30698b[_0x54cf('0x36')]:_0x5eac9c[_0x54cf('0x32')];if(!_0x3ce30c[_0x54cf('0x33')]['hasOwnProperty']('nolimit')){_0x30698b[_0x54cf('0x22')]=qs[_0x54cf('0x22')](_0x3ce30c[_0x54cf('0x33')]['limit']);_0x30698b['offset']=qs[_0x54cf('0x21')](_0x3ce30c[_0x54cf('0x33')]['offset']);}_0x30698b[_0x54cf('0x39')]=qs[_0x54cf('0x3a')](_0x3ce30c['query'][_0x54cf('0x3a')]);_0x30698b[_0x54cf('0x3b')]=qs[_0x54cf('0x3c')](_[_0x54cf('0x3d')](_0x3ce30c[_0x54cf('0x33')],_0x5eac9c[_0x54cf('0x3c')]));if(_0x3ce30c['query']['filter']){_0x30698b[_0x54cf('0x3b')]=_[_0x54cf('0x3e')](_0x30698b['where'],{'$or':_[_0x54cf('0x2e')](_0x220965,function(_0xdf9853){if(_0xdf9853[_0x54cf('0x3f')]!==_0x54cf('0x40')){var _0x4c1922={};_0x4c1922[_0xdf9853['name']]={'$like':'%'+_0x3ce30c[_0x54cf('0x33')][_0x54cf('0x41')]+'%'};return _0x4c1922;}})});}_0x30698b=_[_0x54cf('0x3e')]({},_0x30698b,_0x3ce30c[_0x54cf('0x42')]);var _0x286854={'where':_0x30698b[_0x54cf('0x3b')]};return db[_0x54cf('0x2f')][_0x54cf('0x20')](_0x286854)[_0x54cf('0x29')](function(_0x5d965d){_0x5692d8[_0x54cf('0x20')]=_0x5d965d;if(_0x3ce30c['query'][_0x54cf('0x43')]){_0x30698b[_0x54cf('0x44')]=[{'all':!![]}];}return db[_0x54cf('0x2f')][_0x54cf('0x45')](_0x30698b);})[_0x54cf('0x29')](function(_0x2167b3){_0x5692d8[_0x54cf('0x46')]=_0x2167b3;return _0x5692d8;})[_0x54cf('0x29')](respondWithFilteredResult(_0x2617b2,_0x30698b))['catch'](handleError(_0x2617b2,null));};exports[_0x54cf('0x47')]=function(_0x266522,_0x16e77e){var _0x1022ec={'raw':!![],'where':{'id':_0x266522[_0x54cf('0x48')]['id']}},_0x3e38a8={};_0x3e38a8[_0x54cf('0x32')]=_[_0x54cf('0x34')](db[_0x54cf('0x2f')][_0x54cf('0x30')]);_0x3e38a8['query']=_['keys'](_0x266522[_0x54cf('0x33')]);_0x3e38a8['filters']=_[_0x54cf('0x35')](_0x3e38a8[_0x54cf('0x32')],_0x3e38a8['query']);_0x1022ec[_0x54cf('0x36')]=_[_0x54cf('0x35')](_0x3e38a8[_0x54cf('0x32')],qs[_0x54cf('0x37')](_0x266522[_0x54cf('0x33')][_0x54cf('0x37')]));_0x1022ec['attributes']=_0x1022ec[_0x54cf('0x36')][_0x54cf('0x38')]?_0x1022ec[_0x54cf('0x36')]:_0x3e38a8[_0x54cf('0x32')];if(_0x266522['query'][_0x54cf('0x43')]){_0x1022ec[_0x54cf('0x44')]=[{'all':!![]}];}_0x1022ec=_['merge']({},_0x1022ec,_0x266522[_0x54cf('0x42')]);return db['ChatInternalMessage'][_0x54cf('0x49')](_0x1022ec)[_0x54cf('0x29')](handleEntityNotFound(_0x16e77e,null))[_0x54cf('0x29')](respondWithResult(_0x16e77e,null))[_0x54cf('0x4a')](handleError(_0x16e77e,null));};exports[_0x54cf('0x4b')]=function(_0x1ac4a5,_0x10a37c){return db[_0x54cf('0x2f')]['create'](_0x1ac4a5[_0x54cf('0x4c')],{})['then'](respondWithResult(_0x10a37c,0xc9))[_0x54cf('0x4a')](handleError(_0x10a37c,null));};exports[_0x54cf('0x28')]=function(_0x339444,_0xa7770a){if(_0x339444[_0x54cf('0x4c')]['id']){delete _0x339444[_0x54cf('0x4c')]['id'];}return db[_0x54cf('0x2f')][_0x54cf('0x49')]({'where':{'id':_0x339444['params']['id']}})[_0x54cf('0x29')](handleEntityNotFound(_0xa7770a,null))[_0x54cf('0x29')](saveUpdates(_0x339444['body'],null))[_0x54cf('0x29')](respondWithResult(_0xa7770a,null))[_0x54cf('0x4a')](handleError(_0xa7770a,null));};exports[_0x54cf('0x2a')]=function(_0x3e291d,_0x205a19){return db['ChatInternalMessage']['find']({'where':{'id':_0x3e291d[_0x54cf('0x48')]['id']}})['then'](handleEntityNotFound(_0x205a19,null))[_0x54cf('0x29')](removeEntity(_0x205a19,null))[_0x54cf('0x4a')](handleError(_0x205a19,null));};exports[_0x54cf('0x4d')]=function(_0x355722,_0x28a943){return db[_0x54cf('0x2f')][_0x54cf('0x4d')]()[_0x54cf('0x29')](respondWithResult(_0x28a943,null))['catch'](handleError(_0x28a943,null));};function wrapUser(_0x1e3290){return function(_0x2d3a58){var _0x20b2bb=_0x1e3290['get']({'plain':!![]});_0x20b2bb[_0x54cf('0x4e')]=[];if(_0x2d3a58){_0x20b2bb[_0x54cf('0x4f')]=_0x2d3a58[_0x54cf('0x50')];_0x20b2bb[_0x54cf('0x51')]=_0x2d3a58;}else{_0x20b2bb['lastMessageAt']=moment(0x0)[_0x54cf('0x52')](_0x54cf('0x53'));_0x20b2bb['lastMessage']={};}return _0x20b2bb;};}exports[_0x54cf('0x54')]=function(_0x49eceb,_0x10bb1c,_0x36afd8){var _0x549e08=[];return db[_0x54cf('0x55')][_0x54cf('0x45')]({'where':{'role':[_0x54cf('0x56'),'admin',_0x54cf('0x57')]},'attributes':['id','fullname',_0x54cf('0x2b'),_0x54cf('0x58'),_0x54cf('0x59'),_0x54cf('0x5a'),'online',_0x54cf('0x5b'),_0x54cf('0x5c'),'showWebBar'],'order':qs['sort'](_0x54cf('0x5d')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id','name',_0x54cf('0x3f')],'through':{'attributes':[]}}]})[_0x54cf('0x29')](function(_0x43722b){if(_0x43722b){var _0x2fc286=_0x49eceb['user']['get']({'plain':!![]});if(!_0x2fc286)throw new Error(_0x54cf('0x5e'));if(_0x2fc286['role']===_0x54cf('0x57')){return db[_0x54cf('0x5f')][_0x54cf('0x49')]({'where':{'name':_0x54cf('0x60'),'userProfileId':_0x2fc286[_0x54cf('0x61')]},'raw':!![]})[_0x54cf('0x29')](function(_0x5b3453){if(_0x5b3453){if(_0x5b3453[_0x54cf('0x62')]===0x0){return db[_0x54cf('0x63')][_0x54cf('0x45')]({'where':{'sectionId':_0x5b3453['id']},'raw':!![]})[_0x54cf('0x29')](function(_0x4b5796){var _0xf775ba=[];if(_['isEmpty'](_0x4b5796)){_0xf775ba=_[_0x54cf('0x41')](_0x43722b,function(_0x13cbc2){if(_0x13cbc2[_0x54cf('0x58')]!=='agent'){return _0x13cbc2;}});return _0xf775ba;}else{for(var _0x59e8ab=0x0;_0x59e8ab<_0x43722b['length'];_0x59e8ab++){var _0x432fd4=_0x43722b[_0x59e8ab];if(_0x432fd4[_0x54cf('0x58')]===_0x54cf('0x56')){var _0x5b891c=_[_0x54cf('0x49')](_0x4b5796,function(_0x52d3e3){return _0x52d3e3[_0x54cf('0x64')]===_0x432fd4['id'];});if(_0x5b891c)_0xf775ba[_0x54cf('0x65')](_0x432fd4);}else{_0xf775ba[_0x54cf('0x65')](_0x432fd4);}}return _0xf775ba;}});}else{return _0x43722b;}}else{var _0x4c3bc2=_[_0x54cf('0x41')](_0x43722b,function(_0x23024d){if(_0x23024d[_0x54cf('0x58')]!==_0x54cf('0x56')){return _0x23024d;}});return _0x4c3bc2;}});}else{return _0x43722b;}}})[_0x54cf('0x29')](function(_0x139861){var _0x1059aa=[];if(_0x139861){_0x549e08=_0x139861;for(var _0x666595=0x0;_0x666595<_0x139861['length'];_0x666595+=0x1){_0x549e08[_0x666595][_0x54cf('0x4e')]=[];_0x1059aa[_0x54cf('0x65')](db[_0x54cf('0x2f')][_0x54cf('0x49')]({'where':{'FromId':[_0x49eceb[_0x54cf('0x57')]['id'],_0x139861[_0x666595]['id']],'ToId':[_0x49eceb[_0x54cf('0x57')]['id'],_0x139861[_0x666595]['id']],'ChatGroupId':null},'attributes':['id',_0x54cf('0x50'),_0x54cf('0x66'),'ToId','read',_0x54cf('0x4c')],'order':qs[_0x54cf('0x3a')](_0x54cf('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x54cf('0x29')](wrapUser(_0x139861[_0x666595])));}return BPromise[_0x54cf('0x68')](_0x1059aa);}return[];})[_0x54cf('0x29')](function(_0x5ab2ce){return{'rows':_0x5ab2ce,'count':_0x5ab2ce[_0x54cf('0x38')]};})[_0x54cf('0x29')](respondWithResult(_0x10bb1c,null))[_0x54cf('0x4a')](handleError(_0x10bb1c,null));}; \ No newline at end of file +var _0xf132=['rows','catch','params','keys','find','create','body','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','role','userpic','online','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','ToId','read','-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x59bbaf,_0x4aa349){var _0xb95fe=function(_0x51fa8f){while(--_0x51fa8f){_0x59bbaf['push'](_0x59bbaf['shift']());}};_0xb95fe(++_0x4aa349);}(_0xf132,0x9b));var _0x2f13=function(_0x122866,_0x293d9b){_0x122866=_0x122866-0x0;var _0x4d1216=_0xf132[_0x122866];return _0x4d1216;};'use strict';var pdf=require(_0x2f13('0x0'));var emlformat=require(_0x2f13('0x1'));var rimraf=require(_0x2f13('0x2'));var zipdir=require(_0x2f13('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f13('0x4'));var moment=require(_0x2f13('0x5'));var BPromise=require(_0x2f13('0x6'));var Mustache=require(_0x2f13('0x7'));var util=require(_0x2f13('0x8'));var path=require(_0x2f13('0x9'));var sox=require(_0x2f13('0xa'));var csv=require(_0x2f13('0xb'));var ejs=require(_0x2f13('0xc'));var fs=require('fs');var _=require(_0x2f13('0xd'));var squel=require(_0x2f13('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2f13('0xf'));var toCsv=require(_0x2f13('0xb'));var querystring=require(_0x2f13('0x10'));var Papa=require(_0x2f13('0x11'));var Redis=require(_0x2f13('0x12'));var authService=require(_0x2f13('0x13'));var qs=require(_0x2f13('0x14'));var as=require(_0x2f13('0x15'));var hardwareService=require(_0x2f13('0x16'));var logger=require('../../config/logger')(_0x2f13('0x17'));var utils=require(_0x2f13('0x18'));var config=require(_0x2f13('0x19'));var db=require('../../mysqldb')['db'];config[_0x2f13('0x1a')]=_[_0x2f13('0x1b')](config[_0x2f13('0x1a')],{'host':_0x2f13('0x1c'),'port':0x18eb});var socket=require(_0x2f13('0x1d'))(new Redis(config[_0x2f13('0x1a')]));require(_0x2f13('0x1e'))[_0x2f13('0x1f')](socket);function respondWithStatusCode(_0x2d768b,_0x525270){_0x525270=_0x525270||0xcc;return function(_0x533c27){if(_0x533c27){return _0x2d768b[_0x2f13('0x20')](_0x525270);}return _0x2d768b['status'](_0x525270)[_0x2f13('0x21')]();};}function respondWithResult(_0x5d16db,_0x3fcc2b){_0x3fcc2b=_0x3fcc2b||0xc8;return function(_0x342fff){if(_0x342fff){return _0x5d16db[_0x2f13('0x22')](_0x3fcc2b)[_0x2f13('0x23')](_0x342fff);}};}function respondWithFilteredResult(_0x427dae,_0x228e0f){return function(_0x558d11){if(_0x558d11){var _0x22c6c9=_0x558d11[_0x2f13('0x24')],_0x3153e1=_0x228e0f[_0x2f13('0x25')],_0x439038=_0x228e0f[_0x2f13('0x25')]+_0x228e0f[_0x2f13('0x26')],_0x19fd2b;if(_0x439038>=_0x22c6c9){_0x439038=_0x22c6c9;_0x19fd2b=0xc8;}else{_0x19fd2b=0xce;}_0x427dae[_0x2f13('0x22')](_0x19fd2b);return _0x427dae[_0x2f13('0x27')](_0x2f13('0x28'),_0x3153e1+'-'+_0x439038+'/'+_0x22c6c9)['json'](_0x558d11);}return null;};}function patchUpdates(_0x117ded){return function(_0x27192e){try{jsonpatch[_0x2f13('0x29')](_0x27192e,_0x117ded,!![]);}catch(_0x21e0f7){return BPromise[_0x2f13('0x2a')](_0x21e0f7);}return _0x27192e[_0x2f13('0x2b')]();};}function saveUpdates(_0x56d6cd,_0x3dd543){return function(_0x95413e){if(_0x95413e){return _0x95413e[_0x2f13('0x2c')](_0x56d6cd)[_0x2f13('0x2d')](function(_0x535b43){return _0x535b43;});}return null;};}function removeEntity(_0x5ef1eb,_0x1b7ecd){return function(_0x413ba8){if(_0x413ba8){return _0x413ba8['destroy']()['then'](function(){_0x5ef1eb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21b856,_0x234fee){return function(_0x2852f1){if(!_0x2852f1){_0x21b856[_0x2f13('0x20')](0x194);}return _0x2852f1;};}function handleError(_0x65b51b,_0x421549){_0x421549=_0x421549||0x1f4;return function(_0x3a2043){logger['error'](_0x3a2043[_0x2f13('0x2e')]);if(_0x3a2043[_0x2f13('0x2f')]){delete _0x3a2043[_0x2f13('0x2f')];}_0x65b51b[_0x2f13('0x22')](_0x421549)[_0x2f13('0x30')](_0x3a2043);};}exports[_0x2f13('0x31')]=function(_0x11f258,_0x48836a){var _0x5884a1={},_0x4c105c={},_0x27fa68={'count':0x0,'rows':[]};var _0x5e8eff=_[_0x2f13('0x32')](db[_0x2f13('0x33')][_0x2f13('0x34')],function(_0xc97e86){return{'name':_0xc97e86[_0x2f13('0x35')],'type':_0xc97e86[_0x2f13('0x36')][_0x2f13('0x37')]};});_0x4c105c[_0x2f13('0x38')]=_[_0x2f13('0x32')](_0x5e8eff,_0x2f13('0x2f'));_0x4c105c['query']=_['keys'](_0x11f258[_0x2f13('0x39')]);_0x4c105c[_0x2f13('0x3a')]=_[_0x2f13('0x3b')](_0x4c105c[_0x2f13('0x38')],_0x4c105c[_0x2f13('0x39')]);_0x5884a1[_0x2f13('0x3c')]=_[_0x2f13('0x3b')](_0x4c105c['model'],qs['fields'](_0x11f258[_0x2f13('0x39')][_0x2f13('0x3d')]));_0x5884a1[_0x2f13('0x3c')]=_0x5884a1[_0x2f13('0x3c')][_0x2f13('0x3e')]?_0x5884a1[_0x2f13('0x3c')]:_0x4c105c[_0x2f13('0x38')];if(!_0x11f258[_0x2f13('0x39')]['hasOwnProperty'](_0x2f13('0x3f'))){_0x5884a1['limit']=qs[_0x2f13('0x26')](_0x11f258['query'][_0x2f13('0x26')]);_0x5884a1['offset']=qs[_0x2f13('0x25')](_0x11f258[_0x2f13('0x39')][_0x2f13('0x25')]);}_0x5884a1[_0x2f13('0x40')]=qs[_0x2f13('0x41')](_0x11f258[_0x2f13('0x39')]['sort']);_0x5884a1[_0x2f13('0x42')]=qs[_0x2f13('0x3a')](_[_0x2f13('0x43')](_0x11f258[_0x2f13('0x39')],_0x4c105c[_0x2f13('0x3a')]));if(_0x11f258[_0x2f13('0x39')][_0x2f13('0x44')]){_0x5884a1[_0x2f13('0x42')]=_[_0x2f13('0x45')](_0x5884a1['where'],{'$or':_[_0x2f13('0x32')](_0x5e8eff,function(_0x45b3ce){if(_0x45b3ce['type']!==_0x2f13('0x46')){var _0xb1ccf9={};_0xb1ccf9[_0x45b3ce['name']]={'$like':'%'+_0x11f258[_0x2f13('0x39')]['filter']+'%'};return _0xb1ccf9;}})});}_0x5884a1=_['merge']({},_0x5884a1,_0x11f258[_0x2f13('0x47')]);var _0x15ba18={'where':_0x5884a1[_0x2f13('0x42')]};return db[_0x2f13('0x33')][_0x2f13('0x24')](_0x15ba18)[_0x2f13('0x2d')](function(_0xa1f05d){_0x27fa68[_0x2f13('0x24')]=_0xa1f05d;if(_0x11f258[_0x2f13('0x39')][_0x2f13('0x48')]){_0x5884a1[_0x2f13('0x49')]=[{'all':!![]}];}return db[_0x2f13('0x33')][_0x2f13('0x4a')](_0x5884a1);})[_0x2f13('0x2d')](function(_0x16894b){_0x27fa68[_0x2f13('0x4b')]=_0x16894b;return _0x27fa68;})[_0x2f13('0x2d')](respondWithFilteredResult(_0x48836a,_0x5884a1))[_0x2f13('0x4c')](handleError(_0x48836a,null));};exports['show']=function(_0x343e03,_0x2c4793){var _0x4396ad={'raw':!![],'where':{'id':_0x343e03[_0x2f13('0x4d')]['id']}},_0xb955a4={};_0xb955a4[_0x2f13('0x38')]=_[_0x2f13('0x4e')](db[_0x2f13('0x33')][_0x2f13('0x34')]);_0xb955a4['query']=_[_0x2f13('0x4e')](_0x343e03[_0x2f13('0x39')]);_0xb955a4['filters']=_['intersection'](_0xb955a4[_0x2f13('0x38')],_0xb955a4['query']);_0x4396ad[_0x2f13('0x3c')]=_['intersection'](_0xb955a4['model'],qs[_0x2f13('0x3d')](_0x343e03[_0x2f13('0x39')][_0x2f13('0x3d')]));_0x4396ad[_0x2f13('0x3c')]=_0x4396ad['attributes'][_0x2f13('0x3e')]?_0x4396ad['attributes']:_0xb955a4['model'];if(_0x343e03[_0x2f13('0x39')][_0x2f13('0x48')]){_0x4396ad[_0x2f13('0x49')]=[{'all':!![]}];}_0x4396ad=_[_0x2f13('0x45')]({},_0x4396ad,_0x343e03['options']);return db['ChatInternalMessage'][_0x2f13('0x4f')](_0x4396ad)[_0x2f13('0x2d')](handleEntityNotFound(_0x2c4793,null))[_0x2f13('0x2d')](respondWithResult(_0x2c4793,null))[_0x2f13('0x4c')](handleError(_0x2c4793,null));};exports[_0x2f13('0x50')]=function(_0xe0de8c,_0x4cd49c){return db[_0x2f13('0x33')][_0x2f13('0x50')](_0xe0de8c[_0x2f13('0x51')],{})[_0x2f13('0x2d')](respondWithResult(_0x4cd49c,0xc9))[_0x2f13('0x4c')](handleError(_0x4cd49c,null));};exports[_0x2f13('0x2c')]=function(_0x5c6958,_0x48e4d9){if(_0x5c6958['body']['id']){delete _0x5c6958[_0x2f13('0x51')]['id'];}return db[_0x2f13('0x33')]['find']({'where':{'id':_0x5c6958[_0x2f13('0x4d')]['id']}})[_0x2f13('0x2d')](handleEntityNotFound(_0x48e4d9,null))['then'](saveUpdates(_0x5c6958[_0x2f13('0x51')],null))[_0x2f13('0x2d')](respondWithResult(_0x48e4d9,null))[_0x2f13('0x4c')](handleError(_0x48e4d9,null));};exports[_0x2f13('0x52')]=function(_0x9b3f3a,_0x109cdc){return db[_0x2f13('0x33')][_0x2f13('0x4f')]({'where':{'id':_0x9b3f3a[_0x2f13('0x4d')]['id']}})[_0x2f13('0x2d')](handleEntityNotFound(_0x109cdc,null))[_0x2f13('0x2d')](removeEntity(_0x109cdc,null))['catch'](handleError(_0x109cdc,null));};exports[_0x2f13('0x53')]=function(_0x369124,_0x15386b){return db['ChatInternalMessage'][_0x2f13('0x53')]()['then'](respondWithResult(_0x15386b,null))[_0x2f13('0x4c')](handleError(_0x15386b,null));};function wrapUser(_0x6d8283){return function(_0x11d801){var _0x4880ec=_0x6d8283[_0x2f13('0x54')]({'plain':!![]});_0x4880ec[_0x2f13('0x55')]=[];if(_0x11d801){_0x4880ec[_0x2f13('0x56')]=_0x11d801[_0x2f13('0x57')];_0x4880ec[_0x2f13('0x58')]=_0x11d801;}else{_0x4880ec[_0x2f13('0x56')]=moment(0x0)['format'](_0x2f13('0x59'));_0x4880ec[_0x2f13('0x58')]={};}return _0x4880ec;};}exports[_0x2f13('0x5a')]=function(_0x412345,_0xf392a4,_0x5d3b92){var _0x4a02ec=[];return db[_0x2f13('0x5b')][_0x2f13('0x4a')]({'where':{'role':['agent',_0x2f13('0x5c'),_0x2f13('0x5d')]},'attributes':['id','fullname','name',_0x2f13('0x5e'),_0x2f13('0x5f'),'internal',_0x2f13('0x60'),'lastLoginAt','allowmessenger',_0x2f13('0x61')],'order':qs[_0x2f13('0x41')](_0x2f13('0x62')),'include':[{'model':db[_0x2f13('0x63')],'as':_0x2f13('0x64'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x2f13('0x2d')](function(_0x428b6a){if(_0x428b6a){var _0x32482b=_0x412345['user'][_0x2f13('0x54')]({'plain':!![]});if(!_0x32482b)throw new Error(_0x2f13('0x65'));if(_0x32482b['role']===_0x2f13('0x5d')){return db[_0x2f13('0x66')][_0x2f13('0x4f')]({'where':{'name':_0x2f13('0x67'),'userProfileId':_0x32482b[_0x2f13('0x68')]},'raw':!![]})[_0x2f13('0x2d')](function(_0x5d93a1){if(_0x5d93a1){if(_0x5d93a1[_0x2f13('0x69')]===0x0){return db[_0x2f13('0x6a')][_0x2f13('0x4a')]({'where':{'sectionId':_0x5d93a1['id']},'raw':!![]})['then'](function(_0x115f46){var _0x3ef50c=[];if(_[_0x2f13('0x6b')](_0x115f46)){_0x3ef50c=_['filter'](_0x428b6a,function(_0x2069e6){if(_0x2069e6[_0x2f13('0x5e')]!==_0x2f13('0x6c')){return _0x2069e6;}});return _0x3ef50c;}else{for(var _0x441f12=0x0;_0x441f12<_0x428b6a[_0x2f13('0x3e')];_0x441f12++){var _0x41b112=_0x428b6a[_0x441f12];if(_0x41b112[_0x2f13('0x5e')]===_0x2f13('0x6c')){var _0x45e71a=_[_0x2f13('0x4f')](_0x115f46,function(_0x50ede2){return _0x50ede2[_0x2f13('0x6d')]===_0x41b112['id'];});if(_0x45e71a)_0x3ef50c['push'](_0x41b112);}else{_0x3ef50c[_0x2f13('0x6e')](_0x41b112);}}return _0x3ef50c;}});}else{return _0x428b6a;}}else{var _0x4b367e=_['filter'](_0x428b6a,function(_0x338997){if(_0x338997[_0x2f13('0x5e')]!==_0x2f13('0x6c')){return _0x338997;}});return _0x4b367e;}});}else{return _0x428b6a;}}})['then'](function(_0x3e2a0b){var _0x3032d3=[];if(_0x3e2a0b){_0x4a02ec=_0x3e2a0b;for(var _0x5eeb5c=0x0;_0x5eeb5c<_0x3e2a0b[_0x2f13('0x3e')];_0x5eeb5c+=0x1){_0x4a02ec[_0x5eeb5c]['messages']=[];_0x3032d3['push'](db[_0x2f13('0x33')][_0x2f13('0x4f')]({'where':{'FromId':[_0x412345[_0x2f13('0x5d')]['id'],_0x3e2a0b[_0x5eeb5c]['id']],'ToId':[_0x412345[_0x2f13('0x5d')]['id'],_0x3e2a0b[_0x5eeb5c]['id']],'ChatGroupId':null},'attributes':['id',_0x2f13('0x57'),'FromId',_0x2f13('0x6f'),_0x2f13('0x70'),'body'],'order':qs[_0x2f13('0x41')](_0x2f13('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2f13('0x2d')](wrapUser(_0x3e2a0b[_0x5eeb5c])));}return BPromise[_0x2f13('0x72')](_0x3032d3);}return[];})[_0x2f13('0x2d')](function(_0x3ecc8e){return{'rows':_0x3ecc8e,'count':_0x3ecc8e['length']};})['then'](respondWithResult(_0xf392a4,null))[_0x2f13('0x4c')](handleError(_0xf392a4,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 5bfaa0e..2fefd0c 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 _0xaa48=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update'];(function(_0x4dd4ef,_0x4bc2e8){var _0x5416ff=function(_0x4acee6){while(--_0x4acee6){_0x4dd4ef['push'](_0x4dd4ef['shift']());}};_0x5416ff(++_0x4bc2e8);}(_0xaa48,0x15a));var _0x8aa4=function(_0x4a4f98,_0x4d3536){_0x4a4f98=_0x4a4f98-0x0;var _0x492489=_0xaa48[_0x4a4f98];return _0x492489;};'use strict';var EventEmitter=require(_0x8aa4('0x0'));var ChatInternalMessage=require(_0x8aa4('0x1'))['db'][_0x8aa4('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x8aa4('0x3')](0x0);var events={'afterCreate':_0x8aa4('0x4'),'afterUpdate':_0x8aa4('0x5'),'afterDestroy':_0x8aa4('0x6')};function emitEvent(_0x4357b2){return function(_0x229357,_0x1005db,_0x2871a4){ChatInternalMessageEvents[_0x8aa4('0x7')](_0x4357b2+':'+_0x229357['id'],_0x229357);ChatInternalMessageEvents[_0x8aa4('0x7')](_0x4357b2,_0x229357);_0x2871a4(null);};}for(var e in events){if(events[_0x8aa4('0x8')](e)){var event=events[e];ChatInternalMessage[_0x8aa4('0x9')](e,emitEvent(event));}}module[_0x8aa4('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xfcbd=['events','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x2e5064,_0x724388){var _0x39c6d2=function(_0x42b810){while(--_0x42b810){_0x2e5064['push'](_0x2e5064['shift']());}};_0x39c6d2(++_0x724388);}(_0xfcbd,0x160));var _0xdfcb=function(_0x129216,_0x5c208d){_0x129216=_0x129216-0x0;var _0x2a0306=_0xfcbd[_0x129216];return _0x2a0306;};'use strict';var EventEmitter=require(_0xdfcb('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xdfcb('0x1')](0x0);var events={'afterCreate':_0xdfcb('0x2'),'afterUpdate':_0xdfcb('0x3'),'afterDestroy':_0xdfcb('0x4')};function emitEvent(_0x219e54){return function(_0xde9380,_0x545391,_0x14fb44){ChatInternalMessageEvents[_0xdfcb('0x5')](_0x219e54+':'+_0xde9380['id'],_0xde9380);ChatInternalMessageEvents['emit'](_0x219e54,_0xde9380);_0x14fb44(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xdfcb('0x6')](e,emitEvent(event));}}module[_0xdfcb('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 1705eee..860dd51 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 _0x0713=['../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5dbb84,_0x1bbce9){var _0x1d6eae=function(_0xd93967){while(--_0xd93967){_0x5dbb84['push'](_0x5dbb84['shift']());}};_0x1d6eae(++_0x1bbce9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3071('0xc'),'collate':_0x3071('0xd')});}; \ No newline at end of file +var _0xaa88=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage'];(function(_0x156831,_0x2d3a73){var _0x271dd1=function(_0x487389){while(--_0x487389){_0x156831['push'](_0x156831['shift']());}};_0x271dd1(++_0x2d3a73);}(_0xaa88,0x137));var _0x8aa8=function(_0x385eb1,_0x497a94){_0x385eb1=_0x385eb1-0x0;var _0x5d40eb=_0xaa88[_0x385eb1];return _0x5d40eb;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8aa8('0xc'),'collate':_0x8aa8('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 4fd362c..baa3d20 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 _0x0c42=['debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x454ecb,_0x42dccc){var _0x510c72=function(_0x31501b){while(--_0x31501b){_0x454ecb['push'](_0x454ecb['shift']());}};_0x510c72(++_0x42dccc);}(_0x0c42,0x157));var _0x20c4=function(_0xa34a17,_0x3f22c6){_0xa34a17=_0xa34a17-0x0;var _0x7f6ee5=_0x0c42[_0xa34a17];return _0x7f6ee5;};'use strict';var _=require('lodash');var util=require(_0x20c4('0x0'));var moment=require(_0x20c4('0x1'));var BPromise=require(_0x20c4('0x2'));var rs=require(_0x20c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x20c4('0x4'));var logger=require(_0x20c4('0x5'))(_0x20c4('0x6'));var config=require(_0x20c4('0x7'));var jayson=require(_0x20c4('0x8'));var client=jayson[_0x20c4('0x9')][_0x20c4('0xa')]({'port':0x232a});config[_0x20c4('0xb')]=_[_0x20c4('0xc')](config['redis'],{'host':_0x20c4('0xd'),'port':0x18eb});var socket=require(_0x20c4('0xe'))(new Redis(config[_0x20c4('0xb')]));require(_0x20c4('0xf'))['register'](socket);function respondWithRpcPromise(_0x28d3de,_0x156fe4,_0x14a2fc){return new BPromise(function(_0x2e3fbe,_0x2f7175){return client[_0x20c4('0x10')](_0x28d3de,_0x14a2fc)[_0x20c4('0x11')](function(_0x26732d){logger[_0x20c4('0x12')](_0x20c4('0x13'),_0x156fe4,_0x20c4('0x14'));logger[_0x20c4('0x15')](_0x20c4('0x16'),_0x156fe4,_0x20c4('0x14'),JSON[_0x20c4('0x17')](_0x26732d));if(_0x26732d[_0x20c4('0x18')]){if(_0x26732d[_0x20c4('0x18')]['code']===0x1f4){logger['error'](_0x20c4('0x13'),_0x156fe4,_0x26732d[_0x20c4('0x18')][_0x20c4('0x19')]);return _0x2f7175(_0x26732d['error']['message']);}logger[_0x20c4('0x18')](_0x20c4('0x13'),_0x156fe4,_0x26732d[_0x20c4('0x18')]['message']);return _0x2e3fbe(_0x26732d['error']['message']);}else{logger[_0x20c4('0x12')](_0x20c4('0x13'),_0x156fe4,_0x20c4('0x14'));_0x2e3fbe(_0x26732d[_0x20c4('0x1a')][_0x20c4('0x19')]);}})[_0x20c4('0x1b')](function(_0x2f37fd){logger['error'](_0x20c4('0x13'),_0x156fe4,_0x2f37fd);_0x2f7175(_0x2f37fd);});});} \ No newline at end of file +var _0x9adf=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9adf,0x130));var _0xf9ad=function(_0x32a576,_0x3123da){_0x32a576=_0x32a576-0x0;var _0x4feb6a=_0x9adf[_0x32a576];return _0x4feb6a;};'use strict';var _=require(_0xf9ad('0x0'));var util=require(_0xf9ad('0x1'));var moment=require(_0xf9ad('0x2'));var BPromise=require(_0xf9ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf9ad('0x4'))['db'];var utils=require(_0xf9ad('0x5'));var logger=require(_0xf9ad('0x6'))(_0xf9ad('0x7'));var config=require(_0xf9ad('0x8'));var jayson=require(_0xf9ad('0x9'));var client=jayson[_0xf9ad('0xa')][_0xf9ad('0xb')]({'port':0x232a});config[_0xf9ad('0xc')]=_['defaults'](config[_0xf9ad('0xc')],{'host':_0xf9ad('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf9ad('0xc')]));require(_0xf9ad('0xe'))[_0xf9ad('0xf')](socket);function respondWithRpcPromise(_0xe4f8fc,_0x4bb728,_0x4d2d7a){return new BPromise(function(_0x443431,_0x5f0fc1){return client[_0xf9ad('0x10')](_0xe4f8fc,_0x4d2d7a)[_0xf9ad('0x11')](function(_0x258102){logger[_0xf9ad('0x12')](_0xf9ad('0x13'),_0x4bb728,_0xf9ad('0x14'));logger[_0xf9ad('0x15')](_0xf9ad('0x16'),_0x4bb728,_0xf9ad('0x14'),JSON[_0xf9ad('0x17')](_0x258102));if(_0x258102[_0xf9ad('0x18')]){if(_0x258102['error']['code']===0x1f4){logger[_0xf9ad('0x18')](_0xf9ad('0x13'),_0x4bb728,_0x258102[_0xf9ad('0x18')][_0xf9ad('0x19')]);return _0x5f0fc1(_0x258102[_0xf9ad('0x18')][_0xf9ad('0x19')]);}logger[_0xf9ad('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x4bb728,_0x258102['error'][_0xf9ad('0x19')]);return _0x443431(_0x258102[_0xf9ad('0x18')]['message']);}else{logger['info'](_0xf9ad('0x13'),_0x4bb728,_0xf9ad('0x14'));_0x443431(_0x258102[_0xf9ad('0x1a')][_0xf9ad('0x19')]);}})[_0xf9ad('0x1b')](function(_0x107fe2){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x4bb728,_0x107fe2);_0x5f0fc1(_0x107fe2);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 09735de..5da36f4 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 _0xff96=['chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x34eb8b,_0x3bb75b){var _0x38cab8=function(_0x43989){while(--_0x43989){_0x34eb8b['push'](_0x34eb8b['shift']());}};_0x38cab8(++_0x3bb75b);}(_0xff96,0x179));var _0x6ff9=function(_0x163555,_0x27ce78){_0x163555=_0x163555-0x0;var _0x250307=_0xff96[_0x163555];return _0x250307;};'use strict';var ChatInternalMessageEvents=require(_0x6ff9('0x0'));var events=[_0x6ff9('0x1'),_0x6ff9('0x2'),_0x6ff9('0x3')];function createListener(_0xa3cf6b,_0x19b956){return function(_0xc1de29){_0x19b956[_0x6ff9('0x4')](_0xa3cf6b,_0xc1de29);};}function removeListener(_0x3561d7,_0x207c06){return function(){ChatInternalMessageEvents[_0x6ff9('0x5')](_0x3561d7,_0x207c06);};}exports[_0x6ff9('0x6')]=function(_0x4adb77){for(var _0x3efaff=0x0,_0x5509ee=events['length'];_0x3efaff<_0x5509ee;_0x3efaff++){var _0x4f982b=events[_0x3efaff];var _0x5d56f4=createListener(_0x6ff9('0x7')+_0x4f982b,_0x4adb77);ChatInternalMessageEvents['on'](_0x4f982b,_0x5d56f4);}}; \ No newline at end of file +var _0x795a=['save','remove','emit','removeListener','register','length'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x795a,0xa2));var _0xa795=function(_0x349781,_0x430786){_0x349781=_0x349781-0x0;var _0x39ea69=_0x795a[_0x349781];return _0x39ea69;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xa795('0x0'),_0xa795('0x1'),'update'];function createListener(_0x285f44,_0x4e8f61){return function(_0x237618){_0x4e8f61[_0xa795('0x2')](_0x285f44,_0x237618);};}function removeListener(_0x4ce3a0,_0x4f7e4e){return function(){ChatInternalMessageEvents[_0xa795('0x3')](_0x4ce3a0,_0x4f7e4e);};}exports[_0xa795('0x4')]=function(_0x26a4f2){for(var _0x2efc9b=0x0,_0x553cf3=events[_0xa795('0x5')];_0x2efc9b<_0x553cf3;_0x2efc9b++){var _0x58d69c=events[_0x2efc9b];var _0x36a3a9=createListener('chatInternalMessage:'+_0x58d69c,_0x26a4f2);ChatInternalMessageEvents['on'](_0x58d69c,_0x36a3a9);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 80f182f..fa7cc3c 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 _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(_0x15cf03,_0x151953){var _0x1912ad=function(_0x143813){while(--_0x143813){_0x15cf03['push'](_0x15cf03['shift']());}};_0x1912ad(++_0x151953);}(_0xe706,0xa3));var _0x6e70=function(_0x1a55c5,_0x4949a8){_0x1a55c5=_0x1a55c5-0x0;var _0x5eeeb2=_0xe706[_0x1a55c5];return _0x5eeeb2;};'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 +var _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0x598943,_0x56b6a8){var _0x30b021=function(_0x270eae){while(--_0x270eae){_0x598943['push'](_0x598943['shift']());}};_0x30b021(++_0x56b6a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getUsers']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['put']('/:id',controller['update']);router[_0x0a9e('0xe')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xf')]);module[_0x0a9e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index deeecdf..ddfa962 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 _0x01d1=['medium','BOOLEAN','out','DATE','sequelize','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01d1,0x1ba));var _0x101d=function(_0x5b25e0,_0xfb0f8e){_0x5b25e0=_0x5b25e0-0x0;var _0x435aa3=_0x01d1[_0x5b25e0];return _0x435aa3;};'use strict';var Sequelize=require(_0x101d('0x0'));module['exports']={'body':{'type':Sequelize[_0x101d('0x1')](_0x101d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x101d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x101d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x101d('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x101d('0x5')]}}; \ No newline at end of file +var _0xd45a=['medium','out'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd45a,0x120));var _0xad45=function(_0xda460d,_0x21a478){_0xda460d=_0xda460d-0x0;var _0x1de4a6=_0xd45a[_0xda460d];return _0x1de4a6;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xad45('0x0')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xad45('0x1')),'defaultValue':_0xad45('0x1'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index cab03c2..b92e631 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 _0xb0d8=['get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','info','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','EventManager','acceptmessage','parse','formData','agent','RejectMessage','rejectMessage','event','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','stack','name','send','ChatMessage','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','map','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','destroy','describe','chat-interactions','accept','chat','readAt','format','UserId','Contact'];(function(_0x4573ee,_0x2d7c69){var _0xbc2d00=function(_0x670ecc){while(--_0x670ecc){_0x4573ee['push'](_0x4573ee['shift']());}};_0xbc2d00(++_0x2d7c69);}(_0xb0d8,0x1a1));var _0x8b0d=function(_0x4d05a0,_0x53aa7e){_0x4d05a0=_0x4d05a0-0x0;var _0x4c999c=_0xb0d8[_0x4d05a0];return _0x4c999c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b0d('0x1'));var jsonpatch=require(_0x8b0d('0x2'));var rp=require(_0x8b0d('0x3'));var moment=require(_0x8b0d('0x4'));var BPromise=require(_0x8b0d('0x5'));var Mustache=require(_0x8b0d('0x6'));var util=require(_0x8b0d('0x7'));var path=require(_0x8b0d('0x8'));var sox=require(_0x8b0d('0x9'));var csv=require(_0x8b0d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8b0d('0xb'));var squel=require(_0x8b0d('0xc'));var crypto=require(_0x8b0d('0xd'));var jsforce=require(_0x8b0d('0xe'));var deskjs=require(_0x8b0d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8b0d('0x10'));var Redis=require(_0x8b0d('0x11'));var authService=require(_0x8b0d('0x12'));var qs=require(_0x8b0d('0x13'));var as=require(_0x8b0d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b0d('0x15'))(_0x8b0d('0x16'));var utils=require(_0x8b0d('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x8b0d('0x18')]=_[_0x8b0d('0x19')](config[_0x8b0d('0x18')],{'host':_0x8b0d('0x1a'),'port':0x18eb});var socket=require(_0x8b0d('0x1b'))(new Redis(config['redis']));require(_0x8b0d('0x1c'))[_0x8b0d('0x1d')](socket);var jayson=require(_0x8b0d('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x8b0d('0x1f')][_0x8b0d('0x20')]({'port':0x232a});function checkPasswordPattern(_0x6de7ae,_0x44db00,_0x2d7d5f){if(_0x2d7d5f){var _0x396a13=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x396a13[_0x8b0d('0x21')](_0x44db00)){return _0x6de7ae;}else{throw new db[(_0x8b0d('0x22'))][(_0x8b0d('0x23'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x6de7ae;}}function respondWithRpcPromise(_0x170b4f,_0x7ccc3d,_0x3fb5d4,_0x9be6c7){return new BPromise(function(_0x116df9,_0x2fb753){var _0xa8a4cb=_0x9be6c7||client;return _0xa8a4cb[_0x8b0d('0x24')](_0x170b4f,_0x3fb5d4)[_0x8b0d('0x25')](function(_0x1d97d4){logger['info'](_0x8b0d('0x26'),_0x7ccc3d,_0x8b0d('0x27'));logger[_0x8b0d('0x28')](_0x8b0d('0x29'),_0x7ccc3d,_0x8b0d('0x27'),JSON['stringify'](_0x1d97d4));if(_0x1d97d4[_0x8b0d('0x2a')]){if(_0x1d97d4[_0x8b0d('0x2a')][_0x8b0d('0x2b')]===0x1f4){logger[_0x8b0d('0x2a')](_0x8b0d('0x26'),_0x7ccc3d,_0x1d97d4[_0x8b0d('0x2a')][_0x8b0d('0x2c')]);return _0x2fb753(_0x1d97d4[_0x8b0d('0x2a')][_0x8b0d('0x2c')]);}logger[_0x8b0d('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x7ccc3d,_0x1d97d4[_0x8b0d('0x2a')][_0x8b0d('0x2c')]);return _0x116df9(_0x1d97d4[_0x8b0d('0x2a')][_0x8b0d('0x2c')]);}else{logger['info'](_0x8b0d('0x26'),_0x7ccc3d,_0x8b0d('0x27'));_0x116df9(_0x1d97d4[_0x8b0d('0x2d')][_0x8b0d('0x2c')]);}})[_0x8b0d('0x2e')](function(_0x18e4a2){logger[_0x8b0d('0x2a')](_0x8b0d('0x26'),_0x7ccc3d,_0x18e4a2);_0x2fb753(_0x18e4a2);});});}function respondWithStatusCode(_0x4a2a39,_0x20b4f4){_0x20b4f4=_0x20b4f4||0xcc;return function(_0x57d6bb){if(_0x57d6bb){return _0x4a2a39[_0x8b0d('0x2f')](_0x20b4f4);}return _0x4a2a39[_0x8b0d('0x30')](_0x20b4f4)[_0x8b0d('0x31')]();};}function respondWithResult(_0xdcc177,_0x5e132d){_0x5e132d=_0x5e132d||0xc8;return function(_0x47651d){if(_0x47651d){return _0xdcc177['status'](_0x5e132d)[_0x8b0d('0x32')](_0x47651d);}};}function respondWithFilteredResult(_0x1b3a6c,_0x53d11b){return function(_0x2fb145){if(_0x2fb145){var _0x21dc3d=_0x2fb145[_0x8b0d('0x33')],_0xb8dbf1=_0x53d11b[_0x8b0d('0x34')],_0x42c483=_0x53d11b['offset']+_0x53d11b['limit'],_0x28800d;if(_0x42c483>=_0x21dc3d){_0x42c483=_0x21dc3d;_0x28800d=0xc8;}else{_0x28800d=0xce;}_0x1b3a6c[_0x8b0d('0x30')](_0x28800d);return _0x1b3a6c[_0x8b0d('0x35')](_0x8b0d('0x36'),_0xb8dbf1+'-'+_0x42c483+'/'+_0x21dc3d)[_0x8b0d('0x32')](_0x2fb145);}return null;};}function patchUpdates(_0x3f814e){return function(_0x5b2472){try{jsonpatch[_0x8b0d('0x37')](_0x5b2472,_0x3f814e,!![]);}catch(_0x1c982b){return BPromise[_0x8b0d('0x38')](_0x1c982b);}return _0x5b2472[_0x8b0d('0x39')]();};}function saveUpdates(_0x340ae9,_0x172eab){return function(_0x58ead8){if(_0x58ead8){return _0x58ead8[_0x8b0d('0x3a')](_0x340ae9)['then'](function(_0x3bfec3){return _0x3bfec3;});}return null;};}function removeEntity(_0x1f5142,_0x22ed8c){return function(_0x116ad7){if(_0x116ad7){return _0x116ad7['destroy']()[_0x8b0d('0x25')](function(){_0x1f5142['status'](0xcc)[_0x8b0d('0x31')]();});}};}function handleEntityNotFound(_0x5e26f9,_0x37b999){return function(_0x4c5a77){if(!_0x4c5a77){_0x5e26f9['sendStatus'](0x194);}return _0x4c5a77;};}function handleError(_0x14c4a3,_0x3291be){_0x3291be=_0x3291be||0x1f4;return function(_0x503581){logger[_0x8b0d('0x2a')](_0x503581[_0x8b0d('0x3b')]);if(_0x503581['name']){delete _0x503581[_0x8b0d('0x3c')];}_0x14c4a3['status'](_0x3291be)[_0x8b0d('0x3d')](_0x503581);};}exports['index']=function(_0x35685c,_0x117eaf){var _0x116642={},_0xc479e2={},_0x31ae8d={'count':0x0,'rows':[]};var _0x3be843=_['map'](db[_0x8b0d('0x3e')][_0x8b0d('0x3f')],function(_0x448c63){return{'name':_0x448c63['fieldName'],'type':_0x448c63['type'][_0x8b0d('0x40')]};});_0xc479e2[_0x8b0d('0x41')]=_['map'](_0x3be843,'name');_0xc479e2[_0x8b0d('0x42')]=_['keys'](_0x35685c[_0x8b0d('0x42')]);_0xc479e2[_0x8b0d('0x43')]=_[_0x8b0d('0x44')](_0xc479e2['model'],_0xc479e2[_0x8b0d('0x42')]);_0x116642[_0x8b0d('0x45')]=_[_0x8b0d('0x44')](_0xc479e2[_0x8b0d('0x41')],qs['fields'](_0x35685c[_0x8b0d('0x42')][_0x8b0d('0x46')]));_0x116642['attributes']=_0x116642[_0x8b0d('0x45')][_0x8b0d('0x47')]?_0x116642['attributes']:_0xc479e2[_0x8b0d('0x41')];if(!_0x35685c['query'][_0x8b0d('0x48')](_0x8b0d('0x49'))){_0x116642[_0x8b0d('0x4a')]=qs[_0x8b0d('0x4a')](_0x35685c[_0x8b0d('0x42')]['limit']);_0x116642['offset']=qs[_0x8b0d('0x34')](_0x35685c['query']['offset']);}_0x116642[_0x8b0d('0x4b')]=qs['sort'](_0x35685c[_0x8b0d('0x42')]['sort']);_0x116642[_0x8b0d('0x4c')]=qs[_0x8b0d('0x43')](_[_0x8b0d('0x4d')](_0x35685c['query'],_0xc479e2[_0x8b0d('0x43')]));if(_0x35685c[_0x8b0d('0x42')]['filter']){_0x116642[_0x8b0d('0x4c')]=_[_0x8b0d('0x4e')](_0x116642[_0x8b0d('0x4c')],{'$or':_[_0x8b0d('0x4f')](_0x3be843,function(_0xd45f57){if(_0xd45f57[_0x8b0d('0x50')]!==_0x8b0d('0x51')){var _0x236e77={};_0x236e77[_0xd45f57[_0x8b0d('0x3c')]]={'$like':'%'+_0x35685c['query'][_0x8b0d('0x52')]+'%'};return _0x236e77;}})});}_0x116642=_[_0x8b0d('0x4e')]({},_0x116642,_0x35685c[_0x8b0d('0x53')]);var _0xc9e137={'where':_0x116642['where']};return db['ChatMessage'][_0x8b0d('0x33')](_0xc9e137)[_0x8b0d('0x25')](function(_0x8f6728){_0x31ae8d[_0x8b0d('0x33')]=_0x8f6728;if(_0x35685c['query'][_0x8b0d('0x54')]){_0x116642[_0x8b0d('0x55')]=[{'all':!![]}];}return db['ChatMessage'][_0x8b0d('0x56')](_0x116642);})[_0x8b0d('0x25')](function(_0x1913bc){_0x31ae8d[_0x8b0d('0x57')]=_0x1913bc;return _0x31ae8d;})['then'](respondWithFilteredResult(_0x117eaf,_0x116642))[_0x8b0d('0x2e')](handleError(_0x117eaf,null));};exports[_0x8b0d('0x58')]=function(_0x43d059,_0x17ab68){var _0x438bab={'raw':!![],'where':{'id':_0x43d059[_0x8b0d('0x59')]['id']}},_0x4b8859={};_0x4b8859['model']=_[_0x8b0d('0x5a')](db[_0x8b0d('0x3e')]['rawAttributes']);_0x4b8859[_0x8b0d('0x42')]=_[_0x8b0d('0x5a')](_0x43d059['query']);_0x4b8859[_0x8b0d('0x43')]=_['intersection'](_0x4b8859[_0x8b0d('0x41')],_0x4b8859[_0x8b0d('0x42')]);_0x438bab[_0x8b0d('0x45')]=_[_0x8b0d('0x44')](_0x4b8859[_0x8b0d('0x41')],qs[_0x8b0d('0x46')](_0x43d059['query']['fields']));_0x438bab['attributes']=_0x438bab[_0x8b0d('0x45')]['length']?_0x438bab[_0x8b0d('0x45')]:_0x4b8859[_0x8b0d('0x41')];if(_0x43d059[_0x8b0d('0x42')][_0x8b0d('0x54')]){_0x438bab[_0x8b0d('0x55')]=[{'all':!![]}];}_0x438bab=_[_0x8b0d('0x4e')]({},_0x438bab,_0x43d059['options']);return db['ChatMessage'][_0x8b0d('0x5b')](_0x438bab)['then'](handleEntityNotFound(_0x17ab68,null))[_0x8b0d('0x25')](respondWithResult(_0x17ab68,null))['catch'](handleError(_0x17ab68,null));};exports[_0x8b0d('0x5c')]=function(_0x1751a9,_0x20e7f8){return db['ChatMessage']['create'](_0x1751a9[_0x8b0d('0x5d')],{})[_0x8b0d('0x25')](respondWithResult(_0x20e7f8,0xc9))[_0x8b0d('0x2e')](handleError(_0x20e7f8,null));};exports[_0x8b0d('0x3a')]=function(_0x1867ce,_0x18e5cd){if(_0x1867ce[_0x8b0d('0x5d')]['id']){delete _0x1867ce[_0x8b0d('0x5d')]['id'];}return db['ChatMessage'][_0x8b0d('0x5b')]({'where':{'id':_0x1867ce[_0x8b0d('0x59')]['id']}})['then'](handleEntityNotFound(_0x18e5cd,null))['then'](saveUpdates(_0x1867ce[_0x8b0d('0x5d')],null))['then'](respondWithResult(_0x18e5cd,null))['catch'](handleError(_0x18e5cd,null));};exports[_0x8b0d('0x5e')]=function(_0x3cfbaa,_0x2d2709){return db[_0x8b0d('0x3e')][_0x8b0d('0x5b')]({'where':{'id':_0x3cfbaa[_0x8b0d('0x59')]['id']}})[_0x8b0d('0x25')](handleEntityNotFound(_0x2d2709,null))[_0x8b0d('0x25')](removeEntity(_0x2d2709,null))[_0x8b0d('0x2e')](handleError(_0x2d2709,null));};exports[_0x8b0d('0x5f')]=function(_0x546423,_0xa733bb){return db['ChatMessage']['describe']()[_0x8b0d('0x25')](respondWithResult(_0xa733bb,null))[_0x8b0d('0x2e')](handleError(_0xa733bb,null));};var interaction_log=require('../../config/logger')(_0x8b0d('0x60'));exports[_0x8b0d('0x61')]=function(_0x17d928,_0x324dee,_0x20aff5){var _0x55551c={'channel':_0x8b0d('0x62')};if(_0x17d928[_0x8b0d('0x5d')]['id']){delete _0x17d928['body']['id'];}_0x17d928['body']['read']=!![];_0x17d928['body'][_0x8b0d('0x63')]=moment()[_0x8b0d('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x17d928[_0x8b0d('0x5d')]['UserId']=_0x17d928[_0x8b0d('0x5d')][_0x8b0d('0x65')]||_0x17d928['user']['id'];return db[_0x8b0d('0x3e')][_0x8b0d('0x5b')]({'where':{'id':_0x17d928[_0x8b0d('0x59')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x8b0d('0x66')}]})[_0x8b0d('0x25')](handleEntityNotFound(_0x324dee,null))['then'](saveUpdates(_0x17d928[_0x8b0d('0x5d')],null))[_0x8b0d('0x25')](function(_0x102e75){if(_0x102e75){_0x55551c['message']=_0x102e75[_0x8b0d('0x67')]({'plain':!![]});return db[_0x8b0d('0x68')][_0x8b0d('0x5b')]({'where':{'id':_0x102e75[_0x8b0d('0x69')]}});}return null;})[_0x8b0d('0x25')](handleEntityNotFound(_0x324dee,null))[_0x8b0d('0x25')](function(_0x2c0a61){if(_0x2c0a61){return _0x2c0a61['update']({'UserId':_0x17d928[_0x8b0d('0x5d')][_0x8b0d('0x65')],'read1stAt':_[_0x8b0d('0x6a')](_0x2c0a61[_0x8b0d('0x6b')])?moment()[_0x8b0d('0x64')](_0x8b0d('0x6c')):undefined});}return null;})[_0x8b0d('0x25')](function(_0x43f5cd){if(_0x43f5cd){_0x55551c['interaction']=_0x43f5cd[_0x8b0d('0x67')]({'plain':!![]});interaction_log[_0x8b0d('0x6d')](_0x8b0d('0x6e'),_0x17d928[_0x8b0d('0x6f')]['id'],_0x17d928[_0x8b0d('0x6f')]['name'],_0x17d928[_0x8b0d('0x6f')][_0x8b0d('0x70')],_0x55551c[_0x8b0d('0x71')]['id'],_0x17d928[_0x8b0d('0x5d')]?JSON[_0x8b0d('0x72')](_0x17d928[_0x8b0d('0x5d')]):_0x8b0d('0x73'));return respondWithRpcPromise(_0x8b0d('0x74'),_0x8b0d('0x75'),_0x55551c);}return null;})[_0x8b0d('0x25')](function(_0x28d649){if(_0x28d649){if(_0x17d928[_0x8b0d('0x5d')]['manual']){_0x55551c[_0x8b0d('0x2c')][_0x8b0d('0x76')]=util[_0x8b0d('0x64')](_0x8b0d('0x77'),_0x17d928[_0x8b0d('0x6f')][_0x8b0d('0x3c')]);_0x55551c[_0x8b0d('0x2c')][_0x8b0d('0x78')]=_0x55551c['channel'];_0x55551c[_0x8b0d('0x2c')]['event']=_0x8b0d('0x61');return respondWithRpcPromise(_0x8b0d('0x79'),_0x8b0d('0x79'),{'event':_0x8b0d('0x7a'),'message':_['merge'](_0x55551c[_0x8b0d('0x2c')],JSON[_0x8b0d('0x7b')](_0x55551c[_0x8b0d('0x71')][_0x8b0d('0x7c')]))},client9002)['then'](function(){return _0x55551c;});}return _0x55551c;}return null;})[_0x8b0d('0x25')](respondWithResult(_0x324dee,null))[_0x8b0d('0x2e')](handleError(_0x324dee,null));};var interaction_log=require(_0x8b0d('0x15'))(_0x8b0d('0x60'));exports['reject']=function(_0x5efdd4,_0x1e6a28,_0x45a51f){var _0x225c09={'agent':{},'channel':'chat'};if(_0x5efdd4[_0x8b0d('0x5d')]['id']){delete _0x5efdd4[_0x8b0d('0x5d')]['id'];}_0x5efdd4[_0x8b0d('0x5d')][_0x8b0d('0x65')]=_0x5efdd4[_0x8b0d('0x5d')]['UserId']||_0x5efdd4[_0x8b0d('0x6f')]['id'];_0x225c09[_0x8b0d('0x7d')]['id']=_0x5efdd4[_0x8b0d('0x5d')][_0x8b0d('0x65')];return db[_0x8b0d('0x3e')]['find']({'where':{'id':_0x5efdd4[_0x8b0d('0x59')]['id'],'UserId':null}})[_0x8b0d('0x25')](handleEntityNotFound(_0x1e6a28,null))[_0x8b0d('0x25')](function(_0x7be20b){if(_0x7be20b){_0x225c09['message']=_0x7be20b[_0x8b0d('0x67')]({'plain':!![]});return db[_0x8b0d('0x68')][_0x8b0d('0x5b')]({'where':{'id':_0x7be20b[_0x8b0d('0x69')]}});}return null;})[_0x8b0d('0x25')](handleEntityNotFound(_0x1e6a28,null))[_0x8b0d('0x25')](function(_0x51ec15){if(_0x51ec15){_0x225c09[_0x8b0d('0x71')]=_0x51ec15[_0x8b0d('0x67')]({'plain':!![]});interaction_log[_0x8b0d('0x6d')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5efdd4[_0x8b0d('0x6f')]['id'],_0x5efdd4[_0x8b0d('0x6f')]['name'],_0x5efdd4[_0x8b0d('0x6f')][_0x8b0d('0x70')],_0x225c09['interaction']['id'],_0x5efdd4[_0x8b0d('0x5d')]?JSON[_0x8b0d('0x72')](_0x5efdd4[_0x8b0d('0x5d')]):'null');return respondWithRpcPromise(_0x8b0d('0x7e'),_0x8b0d('0x7f'),_0x225c09);}return null;})[_0x8b0d('0x25')](function(_0x1ef4a2){if(_0x1ef4a2){_0x1ef4a2['message'][_0x8b0d('0x76')]=util[_0x8b0d('0x64')](_0x8b0d('0x77'),_0x5efdd4[_0x8b0d('0x6f')][_0x8b0d('0x3c')]);_0x1ef4a2[_0x8b0d('0x2c')][_0x8b0d('0x78')]=_0x225c09[_0x8b0d('0x78')];_0x1ef4a2['message'][_0x8b0d('0x80')]=_0x8b0d('0x38');respondWithRpcPromise(_0x8b0d('0x79'),'EventManager',{'event':_0x8b0d('0x81'),'message':_0x1ef4a2[_0x8b0d('0x2c')]},client9002);return _0x225c09;}return null;})[_0x8b0d('0x25')](respondWithResult(_0x1e6a28,null))[_0x8b0d('0x2e')](handleError(_0x1e6a28,null));}; \ No newline at end of file +var _0x3460=['util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','./chatMessage.socket','register','jayson/promise','client','http','test','Sequelize','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','json','count','offset','limit','status','Content-Range','reject','save','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','describe','chat-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','formData','chat','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','html-pdf','zip-dir','fast-json-patch','moment','mustache'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x3460,0x16f));var _0x0346=function(_0x3dcf66,_0x32d42f){_0x3dcf66=_0x3dcf66-0x0;var _0x1983e3=_0x3460[_0x3dcf66];return _0x1983e3;};'use strict';var pdf=require(_0x0346('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0346('0x1'));var jsonpatch=require(_0x0346('0x2'));var rp=require('request-promise');var moment=require(_0x0346('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0346('0x4'));var util=require(_0x0346('0x5'));var path=require(_0x0346('0x6'));var sox=require(_0x0346('0x7'));var csv=require(_0x0346('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0346('0x9'));var squel=require(_0x0346('0xa'));var crypto=require('crypto');var jsforce=require(_0x0346('0xb'));var deskjs=require(_0x0346('0xc'));var toCsv=require(_0x0346('0x8'));var querystring=require(_0x0346('0xd'));var Papa=require(_0x0346('0xe'));var Redis=require(_0x0346('0xf'));var authService=require(_0x0346('0x10'));var qs=require(_0x0346('0x11'));var as=require(_0x0346('0x12'));var hardwareService=require(_0x0346('0x13'));var logger=require(_0x0346('0x14'))(_0x0346('0x15'));var utils=require('../../config/utils');var config=require(_0x0346('0x16'));var db=require('../../mysqldb')['db'];config[_0x0346('0x17')]=_[_0x0346('0x18')](config[_0x0346('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0346('0x17')]));require(_0x0346('0x19'))[_0x0346('0x1a')](socket);var jayson=require(_0x0346('0x1b'));var client=jayson[_0x0346('0x1c')][_0x0346('0x1d')]({'port':0x232c});var client9002=jayson[_0x0346('0x1c')][_0x0346('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x4c2faf,_0x455f20,_0x16c29b){if(_0x16c29b){var _0x34fab1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x34fab1[_0x0346('0x1e')](_0x455f20)){return _0x4c2faf;}else{throw new db[(_0x0346('0x1f'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4c2faf;}}function respondWithRpcPromise(_0x5b1a64,_0x3cd591,_0x1df237,_0x1e9b98){return new BPromise(function(_0x53eaa4,_0x3be400){var _0x58bc24=_0x1e9b98||client;return _0x58bc24[_0x0346('0x20')](_0x5b1a64,_0x1df237)[_0x0346('0x21')](function(_0xa4ea57){logger[_0x0346('0x22')](_0x0346('0x23'),_0x3cd591,_0x0346('0x24'));logger[_0x0346('0x25')](_0x0346('0x26'),_0x3cd591,'request\x20sent',JSON[_0x0346('0x27')](_0xa4ea57));if(_0xa4ea57['error']){if(_0xa4ea57[_0x0346('0x28')][_0x0346('0x29')]===0x1f4){logger[_0x0346('0x28')](_0x0346('0x23'),_0x3cd591,_0xa4ea57[_0x0346('0x28')][_0x0346('0x2a')]);return _0x3be400(_0xa4ea57[_0x0346('0x28')][_0x0346('0x2a')]);}logger[_0x0346('0x28')](_0x0346('0x23'),_0x3cd591,_0xa4ea57['error']['message']);return _0x53eaa4(_0xa4ea57['error']['message']);}else{logger['info'](_0x0346('0x23'),_0x3cd591,'request\x20sent');_0x53eaa4(_0xa4ea57[_0x0346('0x2b')]['message']);}})['catch'](function(_0x2c888a){logger[_0x0346('0x28')](_0x0346('0x23'),_0x3cd591,_0x2c888a);_0x3be400(_0x2c888a);});});}function respondWithStatusCode(_0x1631b9,_0x510a64){_0x510a64=_0x510a64||0xcc;return function(_0x351a7c){if(_0x351a7c){return _0x1631b9[_0x0346('0x2c')](_0x510a64);}return _0x1631b9['status'](_0x510a64)[_0x0346('0x2d')]();};}function respondWithResult(_0x5afc3b,_0x536351){_0x536351=_0x536351||0xc8;return function(_0x281e74){if(_0x281e74){return _0x5afc3b['status'](_0x536351)[_0x0346('0x2e')](_0x281e74);}};}function respondWithFilteredResult(_0x4e74f6,_0x17b256){return function(_0xb21a8e){if(_0xb21a8e){var _0x3dc37d=_0xb21a8e[_0x0346('0x2f')],_0x304391=_0x17b256[_0x0346('0x30')],_0x1426e2=_0x17b256[_0x0346('0x30')]+_0x17b256[_0x0346('0x31')],_0xeb4d66;if(_0x1426e2>=_0x3dc37d){_0x1426e2=_0x3dc37d;_0xeb4d66=0xc8;}else{_0xeb4d66=0xce;}_0x4e74f6[_0x0346('0x32')](_0xeb4d66);return _0x4e74f6['set'](_0x0346('0x33'),_0x304391+'-'+_0x1426e2+'/'+_0x3dc37d)[_0x0346('0x2e')](_0xb21a8e);}return null;};}function patchUpdates(_0x47a632){return function(_0x5408bd){try{jsonpatch['apply'](_0x5408bd,_0x47a632,!![]);}catch(_0x1c6285){return BPromise[_0x0346('0x34')](_0x1c6285);}return _0x5408bd[_0x0346('0x35')]();};}function saveUpdates(_0x43bc5a,_0x375601){return function(_0x4accd8){if(_0x4accd8){return _0x4accd8[_0x0346('0x36')](_0x43bc5a)[_0x0346('0x21')](function(_0x8053cd){return _0x8053cd;});}return null;};}function removeEntity(_0x426a8b,_0x4b19d1){return function(_0x39f088){if(_0x39f088){return _0x39f088[_0x0346('0x37')]()[_0x0346('0x21')](function(){_0x426a8b['status'](0xcc)[_0x0346('0x2d')]();});}};}function handleEntityNotFound(_0x21d20e,_0x28b2a2){return function(_0x580862){if(!_0x580862){_0x21d20e['sendStatus'](0x194);}return _0x580862;};}function handleError(_0x4644d3,_0x20a5fd){_0x20a5fd=_0x20a5fd||0x1f4;return function(_0x37108d){logger[_0x0346('0x28')](_0x37108d[_0x0346('0x38')]);if(_0x37108d[_0x0346('0x39')]){delete _0x37108d['name'];}_0x4644d3['status'](_0x20a5fd)[_0x0346('0x3a')](_0x37108d);};}exports[_0x0346('0x3b')]=function(_0x2ca528,_0x4ebec5){var _0x4af532={},_0x20fea5={},_0x31bd25={'count':0x0,'rows':[]};var _0x27b0af=_[_0x0346('0x3c')](db[_0x0346('0x3d')][_0x0346('0x3e')],function(_0x130624){return{'name':_0x130624[_0x0346('0x3f')],'type':_0x130624[_0x0346('0x40')][_0x0346('0x41')]};});_0x20fea5[_0x0346('0x42')]=_[_0x0346('0x3c')](_0x27b0af,_0x0346('0x39'));_0x20fea5[_0x0346('0x43')]=_[_0x0346('0x44')](_0x2ca528[_0x0346('0x43')]);_0x20fea5[_0x0346('0x45')]=_['intersection'](_0x20fea5['model'],_0x20fea5[_0x0346('0x43')]);_0x4af532[_0x0346('0x46')]=_[_0x0346('0x47')](_0x20fea5[_0x0346('0x42')],qs['fields'](_0x2ca528[_0x0346('0x43')][_0x0346('0x48')]));_0x4af532[_0x0346('0x46')]=_0x4af532[_0x0346('0x46')][_0x0346('0x49')]?_0x4af532[_0x0346('0x46')]:_0x20fea5[_0x0346('0x42')];if(!_0x2ca528[_0x0346('0x43')][_0x0346('0x4a')](_0x0346('0x4b'))){_0x4af532['limit']=qs['limit'](_0x2ca528[_0x0346('0x43')]['limit']);_0x4af532[_0x0346('0x30')]=qs['offset'](_0x2ca528[_0x0346('0x43')][_0x0346('0x30')]);}_0x4af532['order']=qs[_0x0346('0x4c')](_0x2ca528[_0x0346('0x43')]['sort']);_0x4af532['where']=qs[_0x0346('0x45')](_[_0x0346('0x4d')](_0x2ca528[_0x0346('0x43')],_0x20fea5[_0x0346('0x45')]));if(_0x2ca528['query'][_0x0346('0x4e')]){_0x4af532[_0x0346('0x4f')]=_[_0x0346('0x50')](_0x4af532[_0x0346('0x4f')],{'$or':_['map'](_0x27b0af,function(_0x33000f){if(_0x33000f[_0x0346('0x40')]!==_0x0346('0x51')){var _0x15ea01={};_0x15ea01[_0x33000f[_0x0346('0x39')]]={'$like':'%'+_0x2ca528[_0x0346('0x43')][_0x0346('0x4e')]+'%'};return _0x15ea01;}})});}_0x4af532=_['merge']({},_0x4af532,_0x2ca528[_0x0346('0x52')]);var _0x458773={'where':_0x4af532[_0x0346('0x4f')]};return db['ChatMessage'][_0x0346('0x2f')](_0x458773)['then'](function(_0x26082d){_0x31bd25[_0x0346('0x2f')]=_0x26082d;if(_0x2ca528[_0x0346('0x43')]['includeAll']){_0x4af532[_0x0346('0x53')]=[{'all':!![]}];}return db[_0x0346('0x3d')]['findAll'](_0x4af532);})[_0x0346('0x21')](function(_0x349191){_0x31bd25[_0x0346('0x54')]=_0x349191;return _0x31bd25;})[_0x0346('0x21')](respondWithFilteredResult(_0x4ebec5,_0x4af532))[_0x0346('0x55')](handleError(_0x4ebec5,null));};exports[_0x0346('0x56')]=function(_0x4eed6a,_0x45889e){var _0x2576f1={'raw':!![],'where':{'id':_0x4eed6a[_0x0346('0x57')]['id']}},_0x576f70={};_0x576f70[_0x0346('0x42')]=_['keys'](db[_0x0346('0x3d')][_0x0346('0x3e')]);_0x576f70[_0x0346('0x43')]=_[_0x0346('0x44')](_0x4eed6a['query']);_0x576f70[_0x0346('0x45')]=_[_0x0346('0x47')](_0x576f70['model'],_0x576f70[_0x0346('0x43')]);_0x2576f1[_0x0346('0x46')]=_[_0x0346('0x47')](_0x576f70[_0x0346('0x42')],qs[_0x0346('0x48')](_0x4eed6a['query'][_0x0346('0x48')]));_0x2576f1[_0x0346('0x46')]=_0x2576f1[_0x0346('0x46')][_0x0346('0x49')]?_0x2576f1[_0x0346('0x46')]:_0x576f70[_0x0346('0x42')];if(_0x4eed6a[_0x0346('0x43')][_0x0346('0x58')]){_0x2576f1['include']=[{'all':!![]}];}_0x2576f1=_['merge']({},_0x2576f1,_0x4eed6a[_0x0346('0x52')]);return db['ChatMessage'][_0x0346('0x59')](_0x2576f1)[_0x0346('0x21')](handleEntityNotFound(_0x45889e,null))['then'](respondWithResult(_0x45889e,null))[_0x0346('0x55')](handleError(_0x45889e,null));};exports[_0x0346('0x5a')]=function(_0x2e7d37,_0x58bed8){return db[_0x0346('0x3d')][_0x0346('0x5a')](_0x2e7d37[_0x0346('0x5b')],{})['then'](respondWithResult(_0x58bed8,0xc9))['catch'](handleError(_0x58bed8,null));};exports[_0x0346('0x36')]=function(_0x1435bb,_0x24ccc6){if(_0x1435bb[_0x0346('0x5b')]['id']){delete _0x1435bb['body']['id'];}return db['ChatMessage'][_0x0346('0x59')]({'where':{'id':_0x1435bb['params']['id']}})[_0x0346('0x21')](handleEntityNotFound(_0x24ccc6,null))['then'](saveUpdates(_0x1435bb[_0x0346('0x5b')],null))[_0x0346('0x21')](respondWithResult(_0x24ccc6,null))[_0x0346('0x55')](handleError(_0x24ccc6,null));};exports[_0x0346('0x37')]=function(_0x16939d,_0x48e0a9){return db[_0x0346('0x3d')][_0x0346('0x59')]({'where':{'id':_0x16939d[_0x0346('0x57')]['id']}})[_0x0346('0x21')](handleEntityNotFound(_0x48e0a9,null))[_0x0346('0x21')](removeEntity(_0x48e0a9,null))['catch'](handleError(_0x48e0a9,null));};exports[_0x0346('0x5c')]=function(_0x5ee3dd,_0x248cda){return db[_0x0346('0x3d')][_0x0346('0x5c')]()['then'](respondWithResult(_0x248cda,null))[_0x0346('0x55')](handleError(_0x248cda,null));};var interaction_log=require('../../config/logger')(_0x0346('0x5d'));exports[_0x0346('0x5e')]=function(_0x34b0e1,_0xfd64f8,_0x13faf3){var _0x3373eb={'channel':'chat'};if(_0x34b0e1[_0x0346('0x5b')]['id']){delete _0x34b0e1[_0x0346('0x5b')]['id'];}_0x34b0e1[_0x0346('0x5b')]['read']=!![];_0x34b0e1[_0x0346('0x5b')][_0x0346('0x5f')]=moment()[_0x0346('0x60')](_0x0346('0x61'));_0x34b0e1[_0x0346('0x5b')]['UserId']=_0x34b0e1[_0x0346('0x5b')][_0x0346('0x62')]||_0x34b0e1[_0x0346('0x63')]['id'];return db[_0x0346('0x3d')]['find']({'where':{'id':_0x34b0e1[_0x0346('0x57')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0xfd64f8,null))[_0x0346('0x21')](saveUpdates(_0x34b0e1[_0x0346('0x5b')],null))[_0x0346('0x21')](function(_0x36d251){if(_0x36d251){_0x3373eb[_0x0346('0x2a')]=_0x36d251[_0x0346('0x64')]({'plain':!![]});return db[_0x0346('0x65')][_0x0346('0x59')]({'where':{'id':_0x36d251[_0x0346('0x66')]}});}return null;})[_0x0346('0x21')](handleEntityNotFound(_0xfd64f8,null))['then'](function(_0x374b10){if(_0x374b10){return _0x374b10[_0x0346('0x36')]({'UserId':_0x34b0e1[_0x0346('0x5b')][_0x0346('0x62')],'read1stAt':_[_0x0346('0x67')](_0x374b10[_0x0346('0x68')])?moment()[_0x0346('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x27be72){if(_0x27be72){_0x3373eb[_0x0346('0x69')]=_0x27be72['get']({'plain':!![]});interaction_log['info'](_0x0346('0x6a'),_0x34b0e1[_0x0346('0x63')]['id'],_0x34b0e1[_0x0346('0x63')][_0x0346('0x39')],_0x34b0e1['user'][_0x0346('0x6b')],_0x3373eb[_0x0346('0x69')]['id'],_0x34b0e1[_0x0346('0x5b')]?JSON[_0x0346('0x27')](_0x34b0e1[_0x0346('0x5b')]):_0x0346('0x6c'));return respondWithRpcPromise(_0x0346('0x6d'),_0x0346('0x6e'),_0x3373eb);}return null;})['then'](function(_0x37890a){if(_0x37890a){if(_0x34b0e1[_0x0346('0x5b')][_0x0346('0x6f')]){_0x3373eb[_0x0346('0x2a')]['interface']=util[_0x0346('0x60')](_0x0346('0x70'),_0x34b0e1[_0x0346('0x63')][_0x0346('0x39')]);_0x3373eb['message'][_0x0346('0x71')]=_0x3373eb['channel'];_0x3373eb[_0x0346('0x2a')][_0x0346('0x72')]='accept';return respondWithRpcPromise(_0x0346('0x73'),_0x0346('0x73'),{'event':_0x0346('0x74'),'message':_[_0x0346('0x50')](_0x3373eb[_0x0346('0x2a')],JSON['parse'](_0x3373eb['interaction'][_0x0346('0x75')]))},client9002)[_0x0346('0x21')](function(){return _0x3373eb;});}return _0x3373eb;}return null;})[_0x0346('0x21')](respondWithResult(_0xfd64f8,null))['catch'](handleError(_0xfd64f8,null));};var interaction_log=require(_0x0346('0x14'))('chat-interactions');exports[_0x0346('0x34')]=function(_0x3733a3,_0x4744a5,_0x2a0b74){var _0xc20bf2={'agent':{},'channel':_0x0346('0x76')};if(_0x3733a3[_0x0346('0x5b')]['id']){delete _0x3733a3['body']['id'];}_0x3733a3[_0x0346('0x5b')][_0x0346('0x62')]=_0x3733a3['body']['UserId']||_0x3733a3[_0x0346('0x63')]['id'];_0xc20bf2[_0x0346('0x77')]['id']=_0x3733a3[_0x0346('0x5b')]['UserId'];return db[_0x0346('0x3d')][_0x0346('0x59')]({'where':{'id':_0x3733a3[_0x0346('0x57')]['id'],'UserId':null}})[_0x0346('0x21')](handleEntityNotFound(_0x4744a5,null))[_0x0346('0x21')](function(_0x1324b0){if(_0x1324b0){_0xc20bf2['message']=_0x1324b0[_0x0346('0x64')]({'plain':!![]});return db['ChatInteraction'][_0x0346('0x59')]({'where':{'id':_0x1324b0[_0x0346('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x4744a5,null))[_0x0346('0x21')](function(_0xad7f59){if(_0xad7f59){_0xc20bf2[_0x0346('0x69')]=_0xad7f59[_0x0346('0x64')]({'plain':!![]});interaction_log[_0x0346('0x22')](_0x0346('0x78'),_0x3733a3[_0x0346('0x63')]['id'],_0x3733a3[_0x0346('0x63')][_0x0346('0x39')],_0x3733a3[_0x0346('0x63')][_0x0346('0x6b')],_0xc20bf2[_0x0346('0x69')]['id'],_0x3733a3[_0x0346('0x5b')]?JSON[_0x0346('0x27')](_0x3733a3['body']):_0x0346('0x6c'));return respondWithRpcPromise(_0x0346('0x79'),_0x0346('0x7a'),_0xc20bf2);}return null;})[_0x0346('0x21')](function(_0x5d61fd){if(_0x5d61fd){_0x5d61fd[_0x0346('0x2a')][_0x0346('0x7b')]=util['format']('SIP/%s',_0x3733a3[_0x0346('0x63')][_0x0346('0x39')]);_0x5d61fd[_0x0346('0x2a')][_0x0346('0x71')]=_0xc20bf2[_0x0346('0x71')];_0x5d61fd[_0x0346('0x2a')]['event']=_0x0346('0x34');respondWithRpcPromise(_0x0346('0x73'),'EventManager',{'event':'rejectmessage','message':_0x5d61fd[_0x0346('0x2a')]},client9002);return _0xc20bf2;}return null;})[_0x0346('0x21')](respondWithResult(_0x4744a5,null))[_0x0346('0x55')](handleError(_0x4744a5,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 0b9356b..c014384 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 _0x1913=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x18920f,_0x7bfdb0){var _0x393602=function(_0x409e9e){while(--_0x409e9e){_0x18920f['push'](_0x18920f['shift']());}};_0x393602(++_0x7bfdb0);}(_0x1913,0x1ef));var _0x3191=function(_0x43f647,_0x2deefd){_0x43f647=_0x43f647-0x0;var _0x277702=_0x1913[_0x43f647];return _0x277702;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x3191('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3191('0x1')](0x0);var events={'afterCreate':_0x3191('0x2'),'afterUpdate':_0x3191('0x3'),'afterDestroy':_0x3191('0x4')};function emitEvent(_0x5b9857){return function(_0x4aade4,_0x1cfa85,_0x3e1621){ChatMessageEvents[_0x3191('0x5')](_0x5b9857+':'+_0x4aade4['id'],_0x4aade4);ChatMessageEvents['emit'](_0x5b9857,_0x4aade4);_0x3e1621(null);};}for(var e in events){if(events[_0x3191('0x6')](e)){var event=events[e];ChatMessage[_0x3191('0x7')](e,emitEvent(event));}}module[_0x3191('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x620f=['hook','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0xacabb,_0x1fbcd9){var _0x2b4a14=function(_0x3a2353){while(--_0x3a2353){_0xacabb['push'](_0xacabb['shift']());}};_0x2b4a14(++_0x1fbcd9);}(_0x620f,0xf2));var _0xf620=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x620f[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0xf620('0x0'));var ChatMessage=require(_0xf620('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf620('0x2'),'afterUpdate':_0xf620('0x3'),'afterDestroy':_0xf620('0x4')};function emitEvent(_0x552c90){return function(_0x23c1e9,_0x1d7938,_0x1bea12){ChatMessageEvents[_0xf620('0x5')](_0x552c90+':'+_0x23c1e9['id'],_0x23c1e9);ChatMessageEvents[_0xf620('0x5')](_0x552c90,_0x23c1e9);_0x1bea12(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xf620('0x6')](e,emitEvent(event));}}module[_0xf620('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 72a0a2f..957b197 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 _0x6314=['direction','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','catch','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','chat_messages','fti_chat_messages','body','get'];(function(_0x1f0790,_0x5dcbea){var _0xcfb1ae=function(_0x1de015){while(--_0x1de015){_0x1f0790['push'](_0x1f0790['shift']());}};_0xcfb1ae(++_0x5dcbea);}(_0x6314,0x7d));var _0x4631=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x6314[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x4631('0x0'));var util=require(_0x4631('0x1'));var logger=require('../../config/logger')(_0x4631('0x2'));var moment=require(_0x4631('0x3'));var BPromise=require(_0x4631('0x4'));var rp=require(_0x4631('0x5'));var fs=require('fs');var path=require(_0x4631('0x6'));var rimraf=require(_0x4631('0x7'));var config=require(_0x4631('0x8'));var attributes=require(_0x4631('0x9'));module[_0x4631('0xa')]=function(_0x46e453,_0x3015e3){return _0x46e453['define']('ChatMessage',attributes,{'tableName':_0x4631('0xb'),'paranoid':![],'indexes':[{'name':_0x4631('0xc'),'fields':[_0x4631('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3df49c,_0x5589c1,_0x494ae4){var _0xb648e7=_0x46e453['models'];var _0x17b444=_0x3df49c[_0x4631('0xe')]({'plain':!![]});if(_0x17b444['direction']['toLowerCase']()==='in'||_0x17b444[_0x4631('0xf')]['toLowerCase']()===_0x4631('0x10')&&!_0x17b444[_0x4631('0x11')]&&!_[_0x4631('0x12')](_0x17b444[_0x4631('0x13')])){_0xb648e7[_0x4631('0x14')][_0x4631('0x15')]({'where':{'id':_0x17b444[_0x4631('0x16')]}})[_0x4631('0x17')](function(_0x2131a2){if(_0x2131a2){_0x2131a2[_0x4631('0x18')]({'lastMsgAt':_0x17b444['createdAt'],'lastMsgDirection':_0x17b444[_0x4631('0xf')]['toLowerCase']()});}})[_0x4631('0x19')](function(_0x2d964b){console[_0x4631('0x1a')](_0x2d964b);});}_0x494ae4();}},'charset':'utf8mb4','collate':_0x4631('0x1b')});}; \ No newline at end of file +var _0x7ba4=['path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','catch','error','utf8mb4','lodash','../../config/logger','moment','request-promise'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x7ba4,0x191));var _0x47ba=function(_0x1b2179,_0x290070){_0x1b2179=_0x1b2179-0x0;var _0x4399dd=_0x7ba4[_0x1b2179];return _0x4399dd;};'use strict';var _=require(_0x47ba('0x0'));var util=require('util');var logger=require(_0x47ba('0x1'))('api');var moment=require(_0x47ba('0x2'));var BPromise=require('bluebird');var rp=require(_0x47ba('0x3'));var fs=require('fs');var path=require(_0x47ba('0x4'));var rimraf=require('rimraf');var config=require(_0x47ba('0x5'));var attributes=require(_0x47ba('0x6'));module[_0x47ba('0x7')]=function(_0x46860d,_0x29f877){return _0x46860d[_0x47ba('0x8')](_0x47ba('0x9'),attributes,{'tableName':_0x47ba('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x47ba('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x36df35,_0x4a6cb9,_0x5a11a4){var _0x2cb7d7=_0x46860d[_0x47ba('0xc')];var _0x45754c=_0x36df35['get']({'plain':!![]});if(_0x45754c[_0x47ba('0xd')]['toLowerCase']()==='in'||_0x45754c[_0x47ba('0xd')][_0x47ba('0xe')]()===_0x47ba('0xf')&&!_0x45754c[_0x47ba('0x10')]&&!_[_0x47ba('0x11')](_0x45754c[_0x47ba('0x12')])){_0x2cb7d7[_0x47ba('0x13')][_0x47ba('0x14')]({'where':{'id':_0x45754c[_0x47ba('0x15')]}})[_0x47ba('0x16')](function(_0x179b02){if(_0x179b02){_0x179b02[_0x47ba('0x17')]({'lastMsgAt':_0x45754c['createdAt'],'lastMsgDirection':_0x45754c[_0x47ba('0xd')][_0x47ba('0xe')]()});}})[_0x47ba('0x18')](function(_0x114dd0){console[_0x47ba('0x19')](_0x114dd0);});}_0x5a11a4();}},'charset':_0x47ba('0x1a'),'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 fbb55b4..8d0c8ae 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 _0x8fd9=['request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','CreateChatMessage','create','body','options','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register'];(function(_0x238579,_0x238994){var _0x45ab3f=function(_0x7934bd){while(--_0x7934bd){_0x238579['push'](_0x238579['shift']());}};_0x45ab3f(++_0x238994);}(_0x8fd9,0xce));var _0x98fd=function(_0x3e80e5,_0x5ba461){_0x3e80e5=_0x3e80e5-0x0;var _0x43a128=_0x8fd9[_0x3e80e5];return _0x43a128;};'use strict';var _=require(_0x98fd('0x0'));var util=require(_0x98fd('0x1'));var moment=require(_0x98fd('0x2'));var BPromise=require(_0x98fd('0x3'));var rs=require(_0x98fd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98fd('0x5'))['db'];var utils=require(_0x98fd('0x6'));var logger=require(_0x98fd('0x7'))(_0x98fd('0x8'));var config=require(_0x98fd('0x9'));var jayson=require(_0x98fd('0xa'));var client=jayson['client'][_0x98fd('0xb')]({'port':0x232a});config[_0x98fd('0xc')]=_[_0x98fd('0xd')](config[_0x98fd('0xc')],{'host':_0x98fd('0xe'),'port':0x18eb});var socket=require(_0x98fd('0xf'))(new Redis(config['redis']));require(_0x98fd('0x10'))[_0x98fd('0x11')](socket);function respondWithRpcPromise(_0x5b96c0,_0x3f4661,_0x3f9fa7){return new BPromise(function(_0x1776f2,_0x220099){return client[_0x98fd('0x12')](_0x5b96c0,_0x3f9fa7)[_0x98fd('0x13')](function(_0x8220d3){logger[_0x98fd('0x14')](_0x98fd('0x15'),_0x3f4661,_0x98fd('0x16'));logger[_0x98fd('0x17')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3f4661,_0x98fd('0x16'),JSON[_0x98fd('0x18')](_0x8220d3));if(_0x8220d3[_0x98fd('0x19')]){if(_0x8220d3[_0x98fd('0x19')]['code']===0x1f4){logger[_0x98fd('0x19')](_0x98fd('0x15'),_0x3f4661,_0x8220d3[_0x98fd('0x19')][_0x98fd('0x1a')]);return _0x220099(_0x8220d3['error'][_0x98fd('0x1a')]);}logger['error'](_0x98fd('0x15'),_0x3f4661,_0x8220d3[_0x98fd('0x19')][_0x98fd('0x1a')]);return _0x1776f2(_0x8220d3[_0x98fd('0x19')][_0x98fd('0x1a')]);}else{logger[_0x98fd('0x14')](_0x98fd('0x15'),_0x3f4661,'request\x20sent');_0x1776f2(_0x8220d3['result'][_0x98fd('0x1a')]);}})['catch'](function(_0x40f9c0){logger['error'](_0x98fd('0x15'),_0x3f4661,_0x40f9c0);_0x220099(_0x40f9c0);});});}exports[_0x98fd('0x1b')]=function(_0xb2cee0){var _0x2862c6=this;return new Promise(function(_0x59eb78,_0x2d9c48){return db['ChatMessage'][_0x98fd('0x1c')](_0xb2cee0[_0x98fd('0x1d')],{'raw':_0xb2cee0['options']?_0xb2cee0[_0x98fd('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x98fd('0x13')](function(_0x59c9db){logger[_0x98fd('0x14')](_0x98fd('0x1b'),_0xb2cee0);logger[_0x98fd('0x17')](_0x98fd('0x1b'),_0xb2cee0,JSON[_0x98fd('0x18')](_0x59c9db));_0x59eb78(_0x59c9db);})[_0x98fd('0x1f')](function(_0x47fe1a){logger[_0x98fd('0x19')]('CreateChatMessage',_0x47fe1a[_0x98fd('0x1a')],_0xb2cee0);_0x2d9c48(_0x2862c6[_0x98fd('0x19')](0x1f4,_0x47fe1a[_0x98fd('0x1a')]));});});}; \ No newline at end of file +var _0x5a5c=['message','result','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s'];(function(_0x559948,_0x5d7a75){var _0x4fc8d5=function(_0x4f77aa){while(--_0x4f77aa){_0x559948['push'](_0x559948['shift']());}};_0x4fc8d5(++_0x5d7a75);}(_0x5a5c,0x1a0));var _0xc5a5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a5c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc5a5('0x0'));var util=require('util');var moment=require(_0xc5a5('0x1'));var BPromise=require(_0xc5a5('0x2'));var rs=require(_0xc5a5('0x3'));var fs=require('fs');var Redis=require(_0xc5a5('0x4'));var db=require(_0xc5a5('0x5'))['db'];var utils=require(_0xc5a5('0x6'));var logger=require('../../config/logger')(_0xc5a5('0x7'));var config=require(_0xc5a5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc5a5('0x9')][_0xc5a5('0xa')]({'port':0x232a});config[_0xc5a5('0xb')]=_[_0xc5a5('0xc')](config['redis'],{'host':_0xc5a5('0xd'),'port':0x18eb});var socket=require(_0xc5a5('0xe'))(new Redis(config[_0xc5a5('0xb')]));require(_0xc5a5('0xf'))['register'](socket);function respondWithRpcPromise(_0x40c657,_0x145079,_0x2a7281){return new BPromise(function(_0x3be848,_0x4f0f4e){return client[_0xc5a5('0x10')](_0x40c657,_0x2a7281)[_0xc5a5('0x11')](function(_0x4e364e){logger[_0xc5a5('0x12')]('ChatMessage,\x20%s,\x20%s',_0x145079,_0xc5a5('0x13'));logger[_0xc5a5('0x14')](_0xc5a5('0x15'),_0x145079,_0xc5a5('0x13'),JSON[_0xc5a5('0x16')](_0x4e364e));if(_0x4e364e[_0xc5a5('0x17')]){if(_0x4e364e[_0xc5a5('0x17')][_0xc5a5('0x18')]===0x1f4){logger['error'](_0xc5a5('0x19'),_0x145079,_0x4e364e['error']['message']);return _0x4f0f4e(_0x4e364e['error'][_0xc5a5('0x1a')]);}logger[_0xc5a5('0x17')](_0xc5a5('0x19'),_0x145079,_0x4e364e[_0xc5a5('0x17')][_0xc5a5('0x1a')]);return _0x3be848(_0x4e364e[_0xc5a5('0x17')][_0xc5a5('0x1a')]);}else{logger[_0xc5a5('0x12')](_0xc5a5('0x19'),_0x145079,_0xc5a5('0x13'));_0x3be848(_0x4e364e[_0xc5a5('0x1b')][_0xc5a5('0x1a')]);}})['catch'](function(_0x4fd68d){logger[_0xc5a5('0x17')](_0xc5a5('0x19'),_0x145079,_0x4fd68d);_0x4f0f4e(_0x4fd68d);});});}exports[_0xc5a5('0x1c')]=function(_0x3930dd){var _0x4f3e51=this;return new Promise(function(_0x1da0fe,_0x446f3a){return db[_0xc5a5('0x1d')][_0xc5a5('0x1e')](_0x3930dd[_0xc5a5('0x1f')],{'raw':_0x3930dd[_0xc5a5('0x20')]?_0x3930dd[_0xc5a5('0x20')][_0xc5a5('0x21')]===undefined?!![]:![]:!![]})[_0xc5a5('0x11')](function(_0x43b23a){logger[_0xc5a5('0x12')](_0xc5a5('0x1c'),_0x3930dd);logger[_0xc5a5('0x14')](_0xc5a5('0x1c'),_0x3930dd,JSON[_0xc5a5('0x16')](_0x43b23a));_0x1da0fe(_0x43b23a);})['catch'](function(_0x610159){logger[_0xc5a5('0x17')](_0xc5a5('0x1c'),_0x610159[_0xc5a5('0x1a')],_0x3930dd);_0x446f3a(_0x4f3e51[_0xc5a5('0x17')](0x1f4,_0x610159[_0xc5a5('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 815adf6..2b99b46 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 _0xf61e=['chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x4ae2a1,_0x453065){var _0x49b5b7=function(_0xdc81b5){while(--_0xdc81b5){_0x4ae2a1['push'](_0x4ae2a1['shift']());}};_0x49b5b7(++_0x453065);}(_0xf61e,0x191));var _0xef61=function(_0x565b2a,_0x4d6a85){_0x565b2a=_0x565b2a-0x0;var _0xab711=_0xf61e[_0x565b2a];return _0xab711;};'use strict';var ChatMessageEvents=require(_0xef61('0x0'));var events=[_0xef61('0x1'),_0xef61('0x2'),_0xef61('0x3')];function createListener(_0x205269,_0xeccd26){return function(_0x3613e6){_0xeccd26[_0xef61('0x4')](_0x205269,_0x3613e6);};}function removeListener(_0x2bd1d0,_0x14122a){return function(){ChatMessageEvents[_0xef61('0x5')](_0x2bd1d0,_0x14122a);};}exports[_0xef61('0x6')]=function(_0x5b00b2){for(var _0x9e17f4=0x0,_0x3e2f79=events['length'];_0x9e17f4<_0x3e2f79;_0x9e17f4++){var _0x2242a7=events[_0x9e17f4];var _0x277fa1=createListener(_0xef61('0x7')+_0x2242a7,_0x5b00b2);ChatMessageEvents['on'](_0x2242a7,_0x277fa1);}}; \ No newline at end of file +var _0x5496=['chatMessage:','./chatMessage.events','save','remove','update','removeListener'];(function(_0x3e5828,_0x146fdf){var _0x5b447a=function(_0xafa25c){while(--_0xafa25c){_0x3e5828['push'](_0x3e5828['shift']());}};_0x5b447a(++_0x146fdf);}(_0x5496,0x175));var _0x6549=function(_0x5adec4,_0x7af866){_0x5adec4=_0x5adec4-0x0;var _0x134072=_0x5496[_0x5adec4];return _0x134072;};'use strict';var ChatMessageEvents=require(_0x6549('0x0'));var events=[_0x6549('0x1'),_0x6549('0x2'),_0x6549('0x3')];function createListener(_0x465fee,_0x4b616a){return function(_0x21585c){_0x4b616a['emit'](_0x465fee,_0x21585c);};}function removeListener(_0x2d2155,_0x8112c5){return function(){ChatMessageEvents[_0x6549('0x4')](_0x2d2155,_0x8112c5);};}exports['register']=function(_0x5a4658){for(var _0x43cb17=0x0,_0x1d8cea=events['length'];_0x43cb17<_0x1d8cea;_0x43cb17++){var _0x1ca8fc=events[_0x43cb17];var _0x3442c3=createListener(_0x6549('0x5')+_0x1ca8fc,_0x5a4658);ChatMessageEvents['on'](_0x1ca8fc,_0x3442c3);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 9d517e8..d87be9a 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 _0x40b3=['create','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','describe','/:id','show','chat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x40b3,0x14a));var _0x340b=function(_0x17823f,_0xffd807){_0x17823f=_0x17823f-0x0;var _0x51fc21=_0x40b3[_0x17823f];return _0x51fc21;};'use strict';var multer=require(_0x340b('0x0'));var util=require(_0x340b('0x1'));var path=require(_0x340b('0x2'));var timeout=require(_0x340b('0x3'));var express=require(_0x340b('0x4'));var router=express['Router']();var auth=require(_0x340b('0x5'));var interaction=require(_0x340b('0x6'));var config=require(_0x340b('0x7'));var controller=require(_0x340b('0x8'));router[_0x340b('0x9')]('/',auth[_0x340b('0xa')](),controller['index']);router[_0x340b('0x9')]('/describe',auth[_0x340b('0xa')](),controller[_0x340b('0xb')]);router['get'](_0x340b('0xc'),auth[_0x340b('0xa')](),controller[_0x340b('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0x340b('0xe'),'chatmessage:create'),controller[_0x340b('0xf')]);router[_0x340b('0x10')](_0x340b('0xc'),controller[_0x340b('0x11')]);router['put'](_0x340b('0x12'),auth['isAuthenticated'](),controller[_0x340b('0x13')]);router[_0x340b('0x10')]('/:id/reject',auth[_0x340b('0xa')](),controller[_0x340b('0x14')]);router['delete'](_0x340b('0xc'),auth[_0x340b('0xa')](),controller[_0x340b('0x15')]);module[_0x340b('0x16')]=router; \ No newline at end of file +var _0xd36a=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','describe','/:id','show','post','tracked','chatmessage:create','create','put','update','/:id/reject','reject','delete','exports'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xd36a,0x150));var _0xad36=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd36a[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xad36('0x0'));var util=require(_0xad36('0x1'));var path=require(_0xad36('0x2'));var timeout=require(_0xad36('0x3'));var express=require(_0xad36('0x4'));var router=express[_0xad36('0x5')]();var auth=require(_0xad36('0x6'));var interaction=require(_0xad36('0x7'));var config=require('../../config/environment');var controller=require(_0xad36('0x8'));router[_0xad36('0x9')]('/',auth[_0xad36('0xa')](),controller['index']);router[_0xad36('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xad36('0xb')]);router[_0xad36('0x9')](_0xad36('0xc'),auth[_0xad36('0xa')](),controller[_0xad36('0xd')]);router[_0xad36('0xe')]('/',auth['isAuthenticated'](),interaction[_0xad36('0xf')]('chat',_0xad36('0x10')),controller[_0xad36('0x11')]);router[_0xad36('0x12')](_0xad36('0xc'),controller[_0xad36('0x13')]);router[_0xad36('0x12')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0xad36('0x12')](_0xad36('0x14'),auth[_0xad36('0xa')](),controller[_0xad36('0x15')]);router[_0xad36('0x16')]('/:id',auth[_0xad36('0xa')](),controller['destroy']);module[_0xad36('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index f276477..5fdee5d 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 _0x3fe0=['exports'];(function(_0x4ca1a8,_0x585ef6){var _0x463a8f=function(_0x162031){while(--_0x162031){_0x4ca1a8['push'](_0x4ca1a8['shift']());}};_0x463a8f(++_0x585ef6);}(_0x3fe0,0x12f));var _0x03fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fe0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x03fe('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x1836=['medium','sequelize','TEXT'];(function(_0x4a7f3c,_0x74b703){var _0x89d3ae=function(_0x1ae014){while(--_0x1ae014){_0x4a7f3c['push'](_0x4a7f3c['shift']());}};_0x89d3ae(++_0x74b703);}(_0x1836,0x166));var _0x6183=function(_0x1508f1,_0x4d6acc){_0x1508f1=_0x1508f1-0x0;var _0x4f7311=_0x1836[_0x1508f1];return _0x4f7311;};'use strict';var Sequelize=require(_0x6183('0x0'));module['exports']={'body':{'type':Sequelize[_0x6183('0x1')](_0x6183('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 426a9ad..e92b752 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 _0xa7ac=['then','destroy','sendStatus','error','name','send','map','ChatOfflineMessage','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','save','update'];(function(_0x2393c0,_0x5d5d61){var _0x188aa9=function(_0x330de9){while(--_0x330de9){_0x2393c0['push'](_0x2393c0['shift']());}};_0x188aa9(++_0x5d5d61);}(_0xa7ac,0x72));var _0xca7a=function(_0x2940d0,_0x3c0ee1){_0x2940d0=_0x2940d0-0x0;var _0xe1121a=_0xa7ac[_0x2940d0];return _0xe1121a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xca7a('0x0'));var rimraf=require(_0xca7a('0x1'));var zipdir=require(_0xca7a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca7a('0x3'));var moment=require(_0xca7a('0x4'));var BPromise=require(_0xca7a('0x5'));var Mustache=require(_0xca7a('0x6'));var util=require(_0xca7a('0x7'));var path=require(_0xca7a('0x8'));var sox=require(_0xca7a('0x9'));var csv=require(_0xca7a('0xa'));var ejs=require(_0xca7a('0xb'));var fs=require('fs');var _=require(_0xca7a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xca7a('0xd'));var toCsv=require(_0xca7a('0xa'));var querystring=require(_0xca7a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xca7a('0xf'));var as=require(_0xca7a('0x10'));var hardwareService=require(_0xca7a('0x11'));var logger=require(_0xca7a('0x12'))(_0xca7a('0x13'));var utils=require(_0xca7a('0x14'));var config=require('../../config/environment');var db=require(_0xca7a('0x15'))['db'];function respondWithStatusCode(_0x170a0d,_0x495267){_0x495267=_0x495267||0xcc;return function(_0x2afa4f){if(_0x2afa4f){return _0x170a0d['sendStatus'](_0x495267);}return _0x170a0d[_0xca7a('0x16')](_0x495267)[_0xca7a('0x17')]();};}function respondWithResult(_0x4a741e,_0x3c5632){_0x3c5632=_0x3c5632||0xc8;return function(_0x480c41){if(_0x480c41){return _0x4a741e[_0xca7a('0x16')](_0x3c5632)[_0xca7a('0x18')](_0x480c41);}};}function respondWithFilteredResult(_0x5da696,_0x4181ac){return function(_0x1cc44c){if(_0x1cc44c){var _0x25311c=_0x1cc44c[_0xca7a('0x19')],_0x518b56=_0x4181ac[_0xca7a('0x1a')],_0x3f59bc=_0x4181ac[_0xca7a('0x1a')]+_0x4181ac['limit'],_0x396b95;if(_0x3f59bc>=_0x25311c){_0x3f59bc=_0x25311c;_0x396b95=0xc8;}else{_0x396b95=0xce;}_0x5da696[_0xca7a('0x16')](_0x396b95);return _0x5da696[_0xca7a('0x1b')](_0xca7a('0x1c'),_0x518b56+'-'+_0x3f59bc+'/'+_0x25311c)[_0xca7a('0x18')](_0x1cc44c);}return null;};}function patchUpdates(_0x13fff7){return function(_0x2c9707){try{jsonpatch[_0xca7a('0x1d')](_0x2c9707,_0x13fff7,!![]);}catch(_0xa0bb30){return BPromise['reject'](_0xa0bb30);}return _0x2c9707[_0xca7a('0x1e')]();};}function saveUpdates(_0x19bd1f,_0x1d75de){return function(_0x56fa69){if(_0x56fa69){return _0x56fa69[_0xca7a('0x1f')](_0x19bd1f)[_0xca7a('0x20')](function(_0x5bb4e6){return _0x5bb4e6;});}return null;};}function removeEntity(_0x545601,_0x4cc156){return function(_0x59d0d0){if(_0x59d0d0){return _0x59d0d0[_0xca7a('0x21')]()['then'](function(){_0x545601[_0xca7a('0x16')](0xcc)[_0xca7a('0x17')]();});}};}function handleEntityNotFound(_0x3d099b,_0x306577){return function(_0x17cf2c){if(!_0x17cf2c){_0x3d099b[_0xca7a('0x22')](0x194);}return _0x17cf2c;};}function handleError(_0x139bb2,_0x167907){_0x167907=_0x167907||0x1f4;return function(_0x37b1c6){logger[_0xca7a('0x23')](_0x37b1c6['stack']);if(_0x37b1c6['name']){delete _0x37b1c6[_0xca7a('0x24')];}_0x139bb2[_0xca7a('0x16')](_0x167907)[_0xca7a('0x25')](_0x37b1c6);};}exports['index']=function(_0x198250,_0x26655d){var _0xbd424a={},_0x331013={},_0x50a41c={'count':0x0,'rows':[]};var _0x2c05bc=_[_0xca7a('0x26')](db[_0xca7a('0x27')]['rawAttributes'],function(_0x42f684){return{'name':_0x42f684[_0xca7a('0x28')],'type':_0x42f684['type'][_0xca7a('0x29')]};});_0x331013[_0xca7a('0x2a')]=_[_0xca7a('0x26')](_0x2c05bc,_0xca7a('0x24'));_0x331013[_0xca7a('0x2b')]=_[_0xca7a('0x2c')](_0x198250[_0xca7a('0x2b')]);_0x331013['filters']=_[_0xca7a('0x2d')](_0x331013[_0xca7a('0x2a')],_0x331013[_0xca7a('0x2b')]);_0xbd424a[_0xca7a('0x2e')]=_['intersection'](_0x331013[_0xca7a('0x2a')],qs[_0xca7a('0x2f')](_0x198250[_0xca7a('0x2b')][_0xca7a('0x2f')]));_0xbd424a[_0xca7a('0x2e')]=_0xbd424a['attributes'][_0xca7a('0x30')]?_0xbd424a[_0xca7a('0x2e')]:_0x331013['model'];if(!_0x198250[_0xca7a('0x2b')][_0xca7a('0x31')](_0xca7a('0x32'))){_0xbd424a[_0xca7a('0x33')]=qs[_0xca7a('0x33')](_0x198250['query'][_0xca7a('0x33')]);_0xbd424a[_0xca7a('0x1a')]=qs[_0xca7a('0x1a')](_0x198250['query'][_0xca7a('0x1a')]);}_0xbd424a[_0xca7a('0x34')]=qs[_0xca7a('0x35')](_0x198250['query']['sort']);_0xbd424a[_0xca7a('0x36')]=qs[_0xca7a('0x37')](_[_0xca7a('0x38')](_0x198250['query'],_0x331013[_0xca7a('0x37')]));if(_0x198250['query'][_0xca7a('0x39')]){_0xbd424a['where']=_[_0xca7a('0x3a')](_0xbd424a[_0xca7a('0x36')],{'$or':_[_0xca7a('0x26')](_0x2c05bc,function(_0x2343c1){if(_0x2343c1[_0xca7a('0x3b')]!==_0xca7a('0x3c')){var _0x571130={};_0x571130[_0x2343c1[_0xca7a('0x24')]]={'$like':'%'+_0x198250[_0xca7a('0x2b')][_0xca7a('0x39')]+'%'};return _0x571130;}})});}_0xbd424a=_[_0xca7a('0x3a')]({},_0xbd424a,_0x198250[_0xca7a('0x3d')]);var _0x5dc6a5={'where':_0xbd424a[_0xca7a('0x36')]};return db[_0xca7a('0x27')][_0xca7a('0x19')](_0x5dc6a5)[_0xca7a('0x20')](function(_0xe07900){_0x50a41c['count']=_0xe07900;if(_0x198250[_0xca7a('0x2b')][_0xca7a('0x3e')]){_0xbd424a[_0xca7a('0x3f')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0xca7a('0x40')](_0xbd424a);})[_0xca7a('0x20')](function(_0x106e31){_0x50a41c['rows']=_0x106e31;return _0x50a41c;})[_0xca7a('0x20')](respondWithFilteredResult(_0x26655d,_0xbd424a))[_0xca7a('0x41')](handleError(_0x26655d,null));};exports[_0xca7a('0x42')]=function(_0x3f144e,_0x18f157){var _0x343146={'raw':!![],'where':{'id':_0x3f144e[_0xca7a('0x43')]['id']}},_0x4f8a3a={};_0x4f8a3a['model']=_[_0xca7a('0x2c')](db[_0xca7a('0x27')][_0xca7a('0x44')]);_0x4f8a3a[_0xca7a('0x2b')]=_[_0xca7a('0x2c')](_0x3f144e[_0xca7a('0x2b')]);_0x4f8a3a[_0xca7a('0x37')]=_[_0xca7a('0x2d')](_0x4f8a3a[_0xca7a('0x2a')],_0x4f8a3a[_0xca7a('0x2b')]);_0x343146['attributes']=_[_0xca7a('0x2d')](_0x4f8a3a[_0xca7a('0x2a')],qs[_0xca7a('0x2f')](_0x3f144e[_0xca7a('0x2b')][_0xca7a('0x2f')]));_0x343146['attributes']=_0x343146[_0xca7a('0x2e')]['length']?_0x343146[_0xca7a('0x2e')]:_0x4f8a3a[_0xca7a('0x2a')];if(_0x3f144e[_0xca7a('0x2b')][_0xca7a('0x3e')]){_0x343146[_0xca7a('0x3f')]=[{'all':!![]}];}_0x343146=_[_0xca7a('0x3a')]({},_0x343146,_0x3f144e['options']);return db[_0xca7a('0x27')]['find'](_0x343146)['then'](handleEntityNotFound(_0x18f157,null))[_0xca7a('0x20')](respondWithResult(_0x18f157,null))[_0xca7a('0x41')](handleError(_0x18f157,null));};exports['create']=function(_0x244550,_0x456e24){return db[_0xca7a('0x27')][_0xca7a('0x45')](_0x244550[_0xca7a('0x46')],{})['then'](respondWithResult(_0x456e24,0xc9))[_0xca7a('0x41')](handleError(_0x456e24,null));};exports[_0xca7a('0x1f')]=function(_0x4d2d9c,_0x5b1b1f){if(_0x4d2d9c[_0xca7a('0x46')]['id']){delete _0x4d2d9c['body']['id'];}return db[_0xca7a('0x27')]['find']({'where':{'id':_0x4d2d9c['params']['id']}})['then'](handleEntityNotFound(_0x5b1b1f,null))[_0xca7a('0x20')](saveUpdates(_0x4d2d9c[_0xca7a('0x46')],null))[_0xca7a('0x20')](respondWithResult(_0x5b1b1f,null))[_0xca7a('0x41')](handleError(_0x5b1b1f,null));};exports['destroy']=function(_0xc20dc0,_0x38c377){return db[_0xca7a('0x27')][_0xca7a('0x47')]({'where':{'id':_0xc20dc0[_0xca7a('0x43')]['id']}})[_0xca7a('0x20')](handleEntityNotFound(_0x38c377,null))[_0xca7a('0x20')](removeEntity(_0x38c377,null))[_0xca7a('0x41')](handleError(_0x38c377,null));};exports[_0xca7a('0x48')]=function(_0x2e6c22,_0x322d8b){return db[_0xca7a('0x27')]['describe']()['then'](respondWithResult(_0x322d8b,null))[_0xca7a('0x41')](handleError(_0x322d8b,null));}; \ No newline at end of file +var _0xbbdb=['ChatOfflineMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','index','map'];(function(_0x15d18f,_0x126b0e){var _0xd12bf7=function(_0x19e661){while(--_0x19e661){_0x15d18f['push'](_0x15d18f['shift']());}};_0xd12bf7(++_0x126b0e);}(_0xbbdb,0x6b));var _0xbbbd=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xbbdb[_0xdea41a];return _0x15d0d8;};'use strict';var pdf=require(_0xbbbd('0x0'));var emlformat=require(_0xbbbd('0x1'));var rimraf=require(_0xbbbd('0x2'));var zipdir=require(_0xbbbd('0x3'));var jsonpatch=require(_0xbbbd('0x4'));var rp=require(_0xbbbd('0x5'));var moment=require('moment');var BPromise=require(_0xbbbd('0x6'));var Mustache=require(_0xbbbd('0x7'));var util=require(_0xbbbd('0x8'));var path=require('path');var sox=require(_0xbbbd('0x9'));var csv=require(_0xbbbd('0xa'));var ejs=require(_0xbbbd('0xb'));var fs=require('fs');var _=require(_0xbbbd('0xc'));var squel=require(_0xbbbd('0xd'));var crypto=require(_0xbbbd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbbbd('0xf'));var toCsv=require(_0xbbbd('0xa'));var querystring=require('querystring');var Papa=require(_0xbbbd('0x10'));var Redis=require(_0xbbbd('0x11'));var authService=require(_0xbbbd('0x12'));var qs=require(_0xbbbd('0x13'));var as=require(_0xbbbd('0x14'));var hardwareService=require(_0xbbbd('0x15'));var logger=require('../../config/logger')(_0xbbbd('0x16'));var utils=require('../../config/utils');var config=require(_0xbbbd('0x17'));var db=require(_0xbbbd('0x18'))['db'];function respondWithStatusCode(_0x345cde,_0x343ba0){_0x343ba0=_0x343ba0||0xcc;return function(_0x33dd0b){if(_0x33dd0b){return _0x345cde[_0xbbbd('0x19')](_0x343ba0);}return _0x345cde[_0xbbbd('0x1a')](_0x343ba0)['end']();};}function respondWithResult(_0x3a5dd7,_0x3b790c){_0x3b790c=_0x3b790c||0xc8;return function(_0x4c4244){if(_0x4c4244){return _0x3a5dd7[_0xbbbd('0x1a')](_0x3b790c)[_0xbbbd('0x1b')](_0x4c4244);}};}function respondWithFilteredResult(_0x35e45c,_0x2b5591){return function(_0x222168){if(_0x222168){var _0x2826db=_0x222168[_0xbbbd('0x1c')],_0x5bd95f=_0x2b5591[_0xbbbd('0x1d')],_0x49267c=_0x2b5591['offset']+_0x2b5591[_0xbbbd('0x1e')],_0x193e04;if(_0x49267c>=_0x2826db){_0x49267c=_0x2826db;_0x193e04=0xc8;}else{_0x193e04=0xce;}_0x35e45c[_0xbbbd('0x1a')](_0x193e04);return _0x35e45c[_0xbbbd('0x1f')](_0xbbbd('0x20'),_0x5bd95f+'-'+_0x49267c+'/'+_0x2826db)[_0xbbbd('0x1b')](_0x222168);}return null;};}function patchUpdates(_0x3d994f){return function(_0x298ca0){try{jsonpatch[_0xbbbd('0x21')](_0x298ca0,_0x3d994f,!![]);}catch(_0x3b92d0){return BPromise[_0xbbbd('0x22')](_0x3b92d0);}return _0x298ca0['save']();};}function saveUpdates(_0x5016f3,_0x459b7c){return function(_0x140e73){if(_0x140e73){return _0x140e73[_0xbbbd('0x23')](_0x5016f3)['then'](function(_0xd4a0cb){return _0xd4a0cb;});}return null;};}function removeEntity(_0x5a9e16,_0x4705c6){return function(_0x1589b8){if(_0x1589b8){return _0x1589b8[_0xbbbd('0x24')]()[_0xbbbd('0x25')](function(){_0x5a9e16['status'](0xcc)[_0xbbbd('0x26')]();});}};}function handleEntityNotFound(_0xadabcc,_0x177295){return function(_0x22c3c5){if(!_0x22c3c5){_0xadabcc['sendStatus'](0x194);}return _0x22c3c5;};}function handleError(_0x3226df,_0x4110e9){_0x4110e9=_0x4110e9||0x1f4;return function(_0x1d5a70){logger[_0xbbbd('0x27')](_0x1d5a70[_0xbbbd('0x28')]);if(_0x1d5a70[_0xbbbd('0x29')]){delete _0x1d5a70['name'];}_0x3226df[_0xbbbd('0x1a')](_0x4110e9)[_0xbbbd('0x2a')](_0x1d5a70);};}exports[_0xbbbd('0x2b')]=function(_0x385b28,_0xdeac23){var _0x38614a={},_0x2e8589={},_0x547a52={'count':0x0,'rows':[]};var _0x1f2ca9=_[_0xbbbd('0x2c')](db[_0xbbbd('0x2d')][_0xbbbd('0x2e')],function(_0x2f22db){return{'name':_0x2f22db[_0xbbbd('0x2f')],'type':_0x2f22db[_0xbbbd('0x30')][_0xbbbd('0x31')]};});_0x2e8589[_0xbbbd('0x32')]=_[_0xbbbd('0x2c')](_0x1f2ca9,_0xbbbd('0x29'));_0x2e8589[_0xbbbd('0x33')]=_['keys'](_0x385b28[_0xbbbd('0x33')]);_0x2e8589[_0xbbbd('0x34')]=_[_0xbbbd('0x35')](_0x2e8589[_0xbbbd('0x32')],_0x2e8589[_0xbbbd('0x33')]);_0x38614a['attributes']=_[_0xbbbd('0x35')](_0x2e8589[_0xbbbd('0x32')],qs[_0xbbbd('0x36')](_0x385b28[_0xbbbd('0x33')][_0xbbbd('0x36')]));_0x38614a[_0xbbbd('0x37')]=_0x38614a[_0xbbbd('0x37')][_0xbbbd('0x38')]?_0x38614a[_0xbbbd('0x37')]:_0x2e8589['model'];if(!_0x385b28['query']['hasOwnProperty']('nolimit')){_0x38614a['limit']=qs[_0xbbbd('0x1e')](_0x385b28[_0xbbbd('0x33')][_0xbbbd('0x1e')]);_0x38614a[_0xbbbd('0x1d')]=qs[_0xbbbd('0x1d')](_0x385b28[_0xbbbd('0x33')]['offset']);}_0x38614a[_0xbbbd('0x39')]=qs[_0xbbbd('0x3a')](_0x385b28['query'][_0xbbbd('0x3a')]);_0x38614a[_0xbbbd('0x3b')]=qs[_0xbbbd('0x34')](_[_0xbbbd('0x3c')](_0x385b28['query'],_0x2e8589['filters']));if(_0x385b28[_0xbbbd('0x33')][_0xbbbd('0x3d')]){_0x38614a[_0xbbbd('0x3b')]=_['merge'](_0x38614a[_0xbbbd('0x3b')],{'$or':_[_0xbbbd('0x2c')](_0x1f2ca9,function(_0x151583){if(_0x151583[_0xbbbd('0x30')]!==_0xbbbd('0x3e')){var _0x418550={};_0x418550[_0x151583['name']]={'$like':'%'+_0x385b28[_0xbbbd('0x33')][_0xbbbd('0x3d')]+'%'};return _0x418550;}})});}_0x38614a=_[_0xbbbd('0x3f')]({},_0x38614a,_0x385b28[_0xbbbd('0x40')]);var _0x9e96c9={'where':_0x38614a[_0xbbbd('0x3b')]};return db[_0xbbbd('0x2d')][_0xbbbd('0x1c')](_0x9e96c9)['then'](function(_0x13fd1a){_0x547a52[_0xbbbd('0x1c')]=_0x13fd1a;if(_0x385b28[_0xbbbd('0x33')][_0xbbbd('0x41')]){_0x38614a[_0xbbbd('0x42')]=[{'all':!![]}];}return db[_0xbbbd('0x2d')][_0xbbbd('0x43')](_0x38614a);})[_0xbbbd('0x25')](function(_0x2cd031){_0x547a52[_0xbbbd('0x44')]=_0x2cd031;return _0x547a52;})['then'](respondWithFilteredResult(_0xdeac23,_0x38614a))[_0xbbbd('0x45')](handleError(_0xdeac23,null));};exports['show']=function(_0x272f05,_0x131b0f){var _0x49548c={'raw':!![],'where':{'id':_0x272f05[_0xbbbd('0x46')]['id']}},_0x7664de={};_0x7664de[_0xbbbd('0x32')]=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x7664de[_0xbbbd('0x33')]=_[_0xbbbd('0x47')](_0x272f05['query']);_0x7664de['filters']=_['intersection'](_0x7664de[_0xbbbd('0x32')],_0x7664de[_0xbbbd('0x33')]);_0x49548c[_0xbbbd('0x37')]=_['intersection'](_0x7664de[_0xbbbd('0x32')],qs[_0xbbbd('0x36')](_0x272f05[_0xbbbd('0x33')][_0xbbbd('0x36')]));_0x49548c[_0xbbbd('0x37')]=_0x49548c[_0xbbbd('0x37')]['length']?_0x49548c[_0xbbbd('0x37')]:_0x7664de['model'];if(_0x272f05[_0xbbbd('0x33')][_0xbbbd('0x41')]){_0x49548c[_0xbbbd('0x42')]=[{'all':!![]}];}_0x49548c=_['merge']({},_0x49548c,_0x272f05[_0xbbbd('0x40')]);return db[_0xbbbd('0x2d')][_0xbbbd('0x48')](_0x49548c)['then'](handleEntityNotFound(_0x131b0f,null))[_0xbbbd('0x25')](respondWithResult(_0x131b0f,null))[_0xbbbd('0x45')](handleError(_0x131b0f,null));};exports[_0xbbbd('0x49')]=function(_0x34b3f2,_0x524386){return db[_0xbbbd('0x2d')][_0xbbbd('0x49')](_0x34b3f2['body'],{})['then'](respondWithResult(_0x524386,0xc9))[_0xbbbd('0x45')](handleError(_0x524386,null));};exports[_0xbbbd('0x23')]=function(_0x240284,_0x418917){if(_0x240284[_0xbbbd('0x4a')]['id']){delete _0x240284[_0xbbbd('0x4a')]['id'];}return db['ChatOfflineMessage'][_0xbbbd('0x48')]({'where':{'id':_0x240284[_0xbbbd('0x46')]['id']}})['then'](handleEntityNotFound(_0x418917,null))[_0xbbbd('0x25')](saveUpdates(_0x240284[_0xbbbd('0x4a')],null))[_0xbbbd('0x25')](respondWithResult(_0x418917,null))[_0xbbbd('0x45')](handleError(_0x418917,null));};exports[_0xbbbd('0x24')]=function(_0x245c6e,_0x3d22f0){return db[_0xbbbd('0x2d')][_0xbbbd('0x48')]({'where':{'id':_0x245c6e['params']['id']}})['then'](handleEntityNotFound(_0x3d22f0,null))[_0xbbbd('0x25')](removeEntity(_0x3d22f0,null))[_0xbbbd('0x45')](handleError(_0x3d22f0,null));};exports[_0xbbbd('0x4b')]=function(_0x58ad08,_0x371888){return db[_0xbbbd('0x2d')][_0xbbbd('0x4b')]()['then'](respondWithResult(_0x371888,null))['catch'](handleError(_0x371888,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 16afab9..4809886 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 _0xbd50=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','ChatOfflineMessage','chat_offline_messages','lodash'];(function(_0x2b17e9,_0x485d48){var _0x14cd4c=function(_0x27f6c1){while(--_0x27f6c1){_0x2b17e9['push'](_0x2b17e9['shift']());}};_0x14cd4c(++_0x485d48);}(_0xbd50,0x196));var _0x0bd5=function(_0x383545,_0x4790bd){_0x383545=_0x383545-0x0;var _0x5ba15=_0xbd50[_0x383545];return _0x5ba15;};'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('./chatOfflineMessage.attributes');module['exports']=function(_0x376024,_0x2ef1d0){return _0x376024[_0x0bd5('0x8')](_0x0bd5('0x9'),attributes,{'tableName':_0x0bd5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe5b3=['../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5c515d,_0x4c58ed){var _0x3338a4=function(_0x1276f6){while(--_0x1276f6){_0x5c515d['push'](_0x5c515d['shift']());}};_0x3338a4(++_0x4c58ed);}(_0xe5b3,0x133));var _0x3e5b=function(_0x48f512,_0x5f1a4e){_0x48f512=_0x48f512-0x0;var _0x45cc88=_0xe5b3[_0x48f512];return _0x45cc88;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('ChatOfflineMessage',attributes,{'tableName':_0x3e5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3e5b('0xd'),'collate':_0x3e5b('0xe')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 6f4ca2c..247824e 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 _0x6411=['message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x58fc2f,_0x111399){var _0x3a1312=function(_0x3d2ff2){while(--_0x3d2ff2){_0x58fc2f['push'](_0x58fc2f['shift']());}};_0x3a1312(++_0x111399);}(_0x6411,0xa2));var _0x1641=function(_0x480c6d,_0x2dd2ec){_0x480c6d=_0x480c6d-0x0;var _0x568079=_0x6411[_0x480c6d];return _0x568079;};'use strict';var _=require(_0x1641('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1641('0x1'));var rs=require(_0x1641('0x2'));var fs=require('fs');var Redis=require(_0x1641('0x3'));var db=require(_0x1641('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1641('0x5'));var config=require(_0x1641('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1641('0x7')][_0x1641('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x358b77,_0x6a81e1,_0x4f339a){return new BPromise(function(_0x238a42,_0x250416){return client[_0x1641('0x9')](_0x358b77,_0x4f339a)[_0x1641('0xa')](function(_0x1c3ae3){logger[_0x1641('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x6a81e1,'request\x20sent');logger['debug'](_0x1641('0xc'),_0x6a81e1,_0x1641('0xd'),JSON[_0x1641('0xe')](_0x1c3ae3));if(_0x1c3ae3['error']){if(_0x1c3ae3[_0x1641('0xf')][_0x1641('0x10')]===0x1f4){logger[_0x1641('0xf')](_0x1641('0x11'),_0x6a81e1,_0x1c3ae3[_0x1641('0xf')]['message']);return _0x250416(_0x1c3ae3['error'][_0x1641('0x12')]);}logger['error'](_0x1641('0x11'),_0x6a81e1,_0x1c3ae3['error']['message']);return _0x238a42(_0x1c3ae3['error'][_0x1641('0x12')]);}else{logger[_0x1641('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x6a81e1,'request\x20sent');_0x238a42(_0x1c3ae3['result']['message']);}})[_0x1641('0x13')](function(_0xce517a){logger[_0x1641('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x6a81e1,_0xce517a);_0x250416(_0xce517a);});});} \ No newline at end of file +var _0xcf43=['ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x23685e,_0x1a73b1){var _0x420bb0=function(_0x44ca57){while(--_0x44ca57){_0x23685e['push'](_0x23685e['shift']());}};_0x420bb0(++_0x1a73b1);}(_0xcf43,0x184));var _0x3cf4=function(_0x51d008,_0x11d476){_0x51d008=_0x51d008-0x0;var _0x561487=_0xcf43[_0x51d008];return _0x561487;};'use strict';var _=require('lodash');var util=require(_0x3cf4('0x0'));var moment=require('moment');var BPromise=require(_0x3cf4('0x1'));var rs=require(_0x3cf4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3cf4('0x3'));var logger=require(_0x3cf4('0x4'))(_0x3cf4('0x5'));var config=require(_0x3cf4('0x6'));var jayson=require(_0x3cf4('0x7'));var client=jayson['client'][_0x3cf4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x401e3f,_0x63b8d2,_0x46af56){return new BPromise(function(_0xd2cefa,_0x194f04){return client['request'](_0x401e3f,_0x46af56)[_0x3cf4('0x9')](function(_0xbbc33f){logger[_0x3cf4('0xa')](_0x3cf4('0xb'),_0x63b8d2,'request\x20sent');logger['debug'](_0x3cf4('0xc'),_0x63b8d2,_0x3cf4('0xd'),JSON[_0x3cf4('0xe')](_0xbbc33f));if(_0xbbc33f[_0x3cf4('0xf')]){if(_0xbbc33f[_0x3cf4('0xf')][_0x3cf4('0x10')]===0x1f4){logger[_0x3cf4('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x63b8d2,_0xbbc33f[_0x3cf4('0xf')][_0x3cf4('0x11')]);return _0x194f04(_0xbbc33f[_0x3cf4('0xf')]['message']);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x63b8d2,_0xbbc33f[_0x3cf4('0xf')][_0x3cf4('0x11')]);return _0xd2cefa(_0xbbc33f[_0x3cf4('0xf')]['message']);}else{logger[_0x3cf4('0xa')](_0x3cf4('0xb'),_0x63b8d2,_0x3cf4('0xd'));_0xd2cefa(_0xbbc33f[_0x3cf4('0x12')][_0x3cf4('0x11')]);}})['catch'](function(_0x2e098f){logger[_0x3cf4('0xf')](_0x3cf4('0xb'),_0x63b8d2,_0x2e098f);_0x194f04(_0x2e098f);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index eb24cac..6c6bbfe 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 _0x2142=['../../components/interaction/service','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','delete','destroy','exports','path','../../components/auth/service'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x2142,0xde));var _0x2214=function(_0x595665,_0xeef749){_0x595665=_0x595665-0x0;var _0xfe2a65=_0x2142[_0x595665];return _0xfe2a65;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2214('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x2214('0x1'));var interaction=require(_0x2214('0x2'));var config=require('../../config/environment');var controller=require(_0x2214('0x3'));router[_0x2214('0x4')]('/',auth['isAuthenticated'](),controller[_0x2214('0x5')]);router[_0x2214('0x4')](_0x2214('0x6'),auth[_0x2214('0x7')](),controller[_0x2214('0x8')]);router['get'](_0x2214('0x9'),auth[_0x2214('0x7')](),controller[_0x2214('0xa')]);router[_0x2214('0xb')]('/',auth[_0x2214('0x7')](),controller[_0x2214('0xc')]);router['put'](_0x2214('0x9'),auth[_0x2214('0x7')](),controller['update']);router[_0x2214('0xd')](_0x2214('0x9'),auth[_0x2214('0x7')](),controller[_0x2214('0xe')]);module[_0x2214('0xf')]=router; \ No newline at end of file +var _0x01a2=['exports','path','express','Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy'];(function(_0x421331,_0x5a6e8a){var _0x141970=function(_0x1809c1){while(--_0x1809c1){_0x421331['push'](_0x421331['shift']());}};_0x141970(++_0x5a6e8a);}(_0x01a2,0xf8));var _0x201a=function(_0x5f4f63,_0xd33d13){_0x5f4f63=_0x5f4f63-0x0;var _0x43ca31=_0x01a2[_0x5f4f63];return _0x43ca31;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x201a('0x0'));var timeout=require('connect-timeout');var express=require(_0x201a('0x1'));var router=express[_0x201a('0x2')]();var auth=require(_0x201a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x201a('0x4'));var controller=require(_0x201a('0x5'));router[_0x201a('0x6')]('/',auth[_0x201a('0x7')](),controller[_0x201a('0x8')]);router[_0x201a('0x6')](_0x201a('0x9'),auth[_0x201a('0x7')](),controller[_0x201a('0xa')]);router[_0x201a('0x6')](_0x201a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x201a('0xc')]('/',auth[_0x201a('0x7')](),controller[_0x201a('0xd')]);router[_0x201a('0xe')](_0x201a('0xb'),auth[_0x201a('0x7')](),controller[_0x201a('0xf')]);router[_0x201a('0x10')](_0x201a('0xb'),auth['isAuthenticated'](),controller[_0x201a('0x11')]);module[_0x201a('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 1a62c26..5b6ccac 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 _0xd278=['mouseOver','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x513545,_0x158f2e){var _0x18b7c5=function(_0x58514c){while(--_0x58514c){_0x513545['push'](_0x513545['shift']());}};_0x18b7c5(++_0x158f2e);}(_0xd278,0x176));var _0x8d27=function(_0x4e9b67,_0x4d850d){_0x4e9b67=_0x4e9b67-0x0;var _0x18871a=_0xd278[_0x4e9b67];return _0x18871a;};'use strict';var Sequelize=require(_0x8d27('0x0'));module[_0x8d27('0x1')]={'name':{'type':Sequelize[_0x8d27('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8d27('0x3')]('mouseOver','timeout'),'defaultValue':_0x8d27('0x4')},'selector':{'type':Sequelize[_0x8d27('0x2')]},'timeout':{'type':Sequelize[_0x8d27('0x5')]}}; \ No newline at end of file +var _0x8380=['mouseOver','timeout','sequelize','ENUM'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x8380,0x1ce));var _0x0838=function(_0x4da26f,_0x1bf58a){_0x4da26f=_0x4da26f-0x0;var _0x4c37b9=_0x8380[_0x4da26f];return _0x4c37b9;};'use strict';var Sequelize=require(_0x0838('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0838('0x1')](_0x0838('0x2'),_0x0838('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index a371ed1..a6244c2 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.controller.js +++ b/server/api/chatProactiveAction/chatProactiveAction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','length','include','options','catch','create','body','find','html-pdf','eml-format','rimraf','request-promise','moment','bluebird'];(function(_0x45236b,_0xbd1f9f){var _0x24de85=function(_0x5609ce){while(--_0x5609ce){_0x45236b['push'](_0x45236b['shift']());}};_0x24de85(++_0xbd1f9f);}(_0x70e0,0x17b));var _0x070e=function(_0x5d33bd,_0xf3ec13){_0x5d33bd=_0x5d33bd-0x0;var _0x3da863=_0x70e0[_0x5d33bd];return _0x3da863;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={'raw':!![],'where':{'id':_0x1743cc[_0x070e('0x26')]['id']}},_0x374c54={};_0x374c54[_0x070e('0x27')]=_[_0x070e('0x28')](db[_0x070e('0x29')][_0x070e('0x2a')]);_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x28')](_0x1743cc['query']);_0x374c54[_0x070e('0x2c')]=_[_0x070e('0x2d')](_0x374c54[_0x070e('0x27')],_0x374c54['query']);_0x497f58['attributes']=_[_0x070e('0x2d')](_0x374c54[_0x070e('0x27')],qs[_0x070e('0x2e')](_0x1743cc['query'][_0x070e('0x2e')]));_0x497f58[_0x070e('0x2f')]=_0x497f58[_0x070e('0x2f')][_0x070e('0x30')]?_0x497f58['attributes']:_0x374c54['model'];if(_0x1743cc['query']['includeAll']){_0x497f58[_0x070e('0x31')]=[{'all':!![]}];}_0x497f58=_['merge']({},_0x497f58,_0x1743cc[_0x070e('0x32')]);return db[_0x070e('0x29')]['find'](_0x497f58)['then'](handleEntityNotFound(_0x4763c6,null))[_0x070e('0x20')](respondWithResult(_0x4763c6,null))[_0x070e('0x33')](handleError(_0x4763c6,null));};exports['create']=function(_0x546a16,_0x41ade4){return db[_0x070e('0x29')][_0x070e('0x34')](_0x546a16[_0x070e('0x35')],{})[_0x070e('0x20')](respondWithResult(_0x41ade4,0xc9))['catch'](handleError(_0x41ade4,null));};exports['update']=function(_0x24d17d,_0x3011c4){if(_0x24d17d[_0x070e('0x35')]['id']){delete _0x24d17d[_0x070e('0x35')]['id'];}return db[_0x070e('0x29')]['find']({'where':{'id':_0x24d17d[_0x070e('0x26')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x3011c4,null))['then'](saveUpdates(_0x24d17d[_0x070e('0x35')],null))[_0x070e('0x20')](respondWithResult(_0x3011c4,null))['catch'](handleError(_0x3011c4,null));};exports['destroy']=function(_0x5ddbe9,_0x363bff){return db[_0x070e('0x29')][_0x070e('0x36')]({'where':{'id':_0x5ddbe9[_0x070e('0x26')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x363bff,null))['then'](removeEntity(_0x363bff,null))[_0x070e('0x33')](handleError(_0x363bff,null));}; \ No newline at end of file +var _0x0713=['update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','includeAll','include','merge','options','find','catch','create','body'];(function(_0x1c1592,_0x1f508f){var _0x446342=function(_0x1c608c){while(--_0x1c608c){_0x1c1592['push'](_0x1c1592['shift']());}};_0x446342(++_0x1f508f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={'raw':!![],'where':{'id':_0x4d5c4b[_0x3071('0x2d')]['id']}},_0x163604={};_0x163604[_0x3071('0x2e')]=_[_0x3071('0x2f')](db[_0x3071('0x30')][_0x3071('0x31')]);_0x163604[_0x3071('0x32')]=_[_0x3071('0x2f')](_0x4d5c4b[_0x3071('0x32')]);_0x163604['filters']=_['intersection'](_0x163604[_0x3071('0x2e')],_0x163604[_0x3071('0x32')]);_0x28792d[_0x3071('0x33')]=_[_0x3071('0x34')](_0x163604[_0x3071('0x2e')],qs[_0x3071('0x35')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x35')]));_0x28792d['attributes']=_0x28792d['attributes']['length']?_0x28792d[_0x3071('0x33')]:_0x163604[_0x3071('0x2e')];if(_0x4d5c4b['query'][_0x3071('0x36')]){_0x28792d[_0x3071('0x37')]=[{'all':!![]}];}_0x28792d=_[_0x3071('0x38')]({},_0x28792d,_0x4d5c4b[_0x3071('0x39')]);return db['ChatProactiveAction'][_0x3071('0x3a')](_0x28792d)[_0x3071('0x26')](handleEntityNotFound(_0x4fb1ca,null))[_0x3071('0x26')](respondWithResult(_0x4fb1ca,null))[_0x3071('0x3b')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x3c')]=function(_0x2068ce,_0x3c55c){return db[_0x3071('0x30')]['create'](_0x2068ce[_0x3071('0x3d')],{})['then'](respondWithResult(_0x3c55c,0xc9))['catch'](handleError(_0x3c55c,null));};exports[_0x3071('0x3e')]=function(_0xa3a7ae,_0x54d9c3){if(_0xa3a7ae[_0x3071('0x3d')]['id']){delete _0xa3a7ae[_0x3071('0x3d')]['id'];}return db[_0x3071('0x30')][_0x3071('0x3a')]({'where':{'id':_0xa3a7ae[_0x3071('0x2d')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x54d9c3,null))['then'](saveUpdates(_0xa3a7ae[_0x3071('0x3d')],null))[_0x3071('0x26')](respondWithResult(_0x54d9c3,null))['catch'](handleError(_0x54d9c3,null));};exports[_0x3071('0x27')]=function(_0x5b1392,_0x28f855){return db[_0x3071('0x30')]['find']({'where':{'id':_0x5b1392['params']['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x28f855,null))[_0x3071('0x26')](removeEntity(_0x28f855,null))[_0x3071('0x3b')](handleError(_0x28f855,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index efe11ed..8d9f336 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 _0x6c5f=['path','rimraf','../../config/environment','exports','ChatProactiveAction','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x63874a,_0x3c03b3){var _0x3d44ca=function(_0x325dd4){while(--_0x325dd4){_0x63874a['push'](_0x63874a['shift']());}};_0x3d44ca(++_0x3c03b3);}(_0x6c5f,0x73));var _0xf6c5=function(_0xa7a5cf,_0x521f3d){_0xa7a5cf=_0xa7a5cf-0x0;var _0x113178=_0x6c5f[_0xa7a5cf];return _0x113178;};'use strict';var _=require(_0xf6c5('0x0'));var util=require('util');var logger=require(_0xf6c5('0x1'))(_0xf6c5('0x2'));var moment=require(_0xf6c5('0x3'));var BPromise=require(_0xf6c5('0x4'));var rp=require(_0xf6c5('0x5'));var fs=require('fs');var path=require(_0xf6c5('0x6'));var rimraf=require(_0xf6c5('0x7'));var config=require(_0xf6c5('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0xf6c5('0x9')]=function(_0x12a7bd,_0x5f70a4){return _0x12a7bd['define'](_0xf6c5('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15bf=['rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','api','bluebird','request-promise','path'];(function(_0x4a3c19,_0x43a8d0){var _0x4175f7=function(_0x54900c){while(--_0x54900c){_0x4a3c19['push'](_0x4a3c19['shift']());}};_0x4175f7(++_0x43a8d0);}(_0x15bf,0x1a7));var _0xf15b=function(_0x297c55,_0x34fa75){_0x297c55=_0x297c55-0x0;var _0x120389=_0x15bf[_0x297c55];return _0x120389;};'use strict';var _=require(_0xf15b('0x0'));var util=require(_0xf15b('0x1'));var logger=require('../../config/logger')(_0xf15b('0x2'));var moment=require('moment');var BPromise=require(_0xf15b('0x3'));var rp=require(_0xf15b('0x4'));var fs=require('fs');var path=require(_0xf15b('0x5'));var rimraf=require(_0xf15b('0x6'));var config=require(_0xf15b('0x7'));var attributes=require(_0xf15b('0x8'));module[_0xf15b('0x9')]=function(_0x155502,_0x49e836){return _0x155502[_0xf15b('0xa')](_0xf15b('0xb'),attributes,{'tableName':_0xf15b('0xc'),'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 e10d980..fb0e3bf 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 _0x38e2=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2931e6,_0x4b79a2){var _0x1b1208=function(_0x3012b0){while(--_0x3012b0){_0x2931e6['push'](_0x2931e6['shift']());}};_0x1b1208(++_0x4b79a2);}(_0x38e2,0x146));var _0x238e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x38e2[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x238e('0x0'));var moment=require(_0x238e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x238e('0x2'));var db=require(_0x238e('0x3'))['db'];var utils=require(_0x238e('0x4'));var logger=require(_0x238e('0x5'))('rpc');var config=require(_0x238e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x238e('0x7')][_0x238e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fc06f,_0xfff70,_0x2b3ffe){return new BPromise(function(_0x43775,_0x2366be){return client[_0x238e('0x9')](_0x3fc06f,_0x2b3ffe)[_0x238e('0xa')](function(_0x4fffdd){logger['info'](_0x238e('0xb'),_0xfff70,_0x238e('0xc'));logger[_0x238e('0xd')](_0x238e('0xe'),_0xfff70,_0x238e('0xc'),JSON['stringify'](_0x4fffdd));if(_0x4fffdd[_0x238e('0xf')]){if(_0x4fffdd[_0x238e('0xf')][_0x238e('0x10')]===0x1f4){logger[_0x238e('0xf')](_0x238e('0xb'),_0xfff70,_0x4fffdd[_0x238e('0xf')]['message']);return _0x2366be(_0x4fffdd[_0x238e('0xf')]['message']);}logger[_0x238e('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0xfff70,_0x4fffdd[_0x238e('0xf')][_0x238e('0x11')]);return _0x43775(_0x4fffdd[_0x238e('0xf')][_0x238e('0x11')]);}else{logger[_0x238e('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0xfff70,_0x238e('0xc'));_0x43775(_0x4fffdd['result'][_0x238e('0x11')]);}})[_0x238e('0x13')](function(_0x274837){logger[_0x238e('0xf')](_0x238e('0xb'),_0xfff70,_0x274837);_0x2366be(_0x274837);});});} \ No newline at end of file +var _0xaad1=['info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x2ea547,_0x418c3a){var _0x420629=function(_0x30720d){while(--_0x30720d){_0x2ea547['push'](_0x2ea547['shift']());}};_0x420629(++_0x418c3a);}(_0xaad1,0x95));var _0x1aad=function(_0x443b8e,_0x4586c8){_0x443b8e=_0x443b8e-0x0;var _0x17c4b7=_0xaad1[_0x443b8e];return _0x17c4b7;};'use strict';var _=require(_0x1aad('0x0'));var util=require(_0x1aad('0x1'));var moment=require(_0x1aad('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1aad('0x3'));var db=require(_0x1aad('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1aad('0x5'))(_0x1aad('0x6'));var config=require(_0x1aad('0x7'));var jayson=require(_0x1aad('0x8'));var client=jayson[_0x1aad('0x9')][_0x1aad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x282a08,_0x3a8b2f,_0x403542){return new BPromise(function(_0x572ac9,_0x37024a){return client['request'](_0x282a08,_0x403542)[_0x1aad('0xb')](function(_0x42750a){logger[_0x1aad('0xc')](_0x1aad('0xd'),_0x3a8b2f,_0x1aad('0xe'));logger[_0x1aad('0xf')](_0x1aad('0x10'),_0x3a8b2f,_0x1aad('0xe'),JSON[_0x1aad('0x11')](_0x42750a));if(_0x42750a[_0x1aad('0x12')]){if(_0x42750a['error'][_0x1aad('0x13')]===0x1f4){logger[_0x1aad('0x12')](_0x1aad('0xd'),_0x3a8b2f,_0x42750a[_0x1aad('0x12')][_0x1aad('0x14')]);return _0x37024a(_0x42750a['error']['message']);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x3a8b2f,_0x42750a[_0x1aad('0x12')]['message']);return _0x572ac9(_0x42750a[_0x1aad('0x12')][_0x1aad('0x14')]);}else{logger['info'](_0x1aad('0xd'),_0x3a8b2f,_0x1aad('0xe'));_0x572ac9(_0x42750a[_0x1aad('0x15')][_0x1aad('0x14')]);}})[_0x1aad('0x16')](function(_0x6c2a07){logger[_0x1aad('0x12')](_0x1aad('0xd'),_0x3a8b2f,_0x6c2a07);_0x37024a(_0x6c2a07);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 0f8e266..f8e68cf 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 _0xfd60=['exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','/:id','update','delete','destroy'];(function(_0x2f7231,_0x429f1e){var _0x234042=function(_0xfe04ce){while(--_0xfe04ce){_0x2f7231['push'](_0x2f7231['shift']());}};_0x234042(++_0x429f1e);}(_0xfd60,0x151));var _0x0fd6=function(_0x5a26db,_0x2c5ccd){_0x5a26db=_0x5a26db-0x0;var _0x4619dd=_0xfd60[_0x5a26db];return _0x4619dd;};'use strict';var multer=require(_0x0fd6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0fd6('0x1'));var express=require(_0x0fd6('0x2'));var router=express[_0x0fd6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0fd6('0x4'));var config=require(_0x0fd6('0x5'));var controller=require('./chatProactiveAction.controller');router[_0x0fd6('0x6')]('/:id',auth[_0x0fd6('0x7')](),controller['show']);router[_0x0fd6('0x8')]('/',auth[_0x0fd6('0x7')](),controller['create']);router['put'](_0x0fd6('0x9'),auth[_0x0fd6('0x7')](),controller[_0x0fd6('0xa')]);router[_0x0fd6('0xb')](_0x0fd6('0x9'),auth[_0x0fd6('0x7')](),controller[_0x0fd6('0xc')]);module[_0x0fd6('0xd')]=router; \ No newline at end of file +var _0x221b=['../../components/auth/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','put','delete','exports','multer','connect-timeout','express','Router'];(function(_0x3f048b,_0x513a72){var _0xab45da=function(_0x96f5d0){while(--_0x96f5d0){_0x3f048b['push'](_0x3f048b['shift']());}};_0xab45da(++_0x513a72);}(_0x221b,0xbf));var _0xb221=function(_0x43a70d,_0x11d1bf){_0x43a70d=_0x43a70d-0x0;var _0x57a8a9=_0x221b[_0x43a70d];return _0x57a8a9;};'use strict';var multer=require(_0xb221('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb221('0x1'));var express=require(_0xb221('0x2'));var router=express[_0xb221('0x3')]();var auth=require(_0xb221('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb221('0x5'));var controller=require(_0xb221('0x6'));router[_0xb221('0x7')](_0xb221('0x8'),auth[_0xb221('0x9')](),controller[_0xb221('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb221('0xb')]);router[_0xb221('0xc')]('/:id',auth[_0xb221('0x9')](),controller['update']);router[_0xb221('0xd')](_0xb221('0x8'),auth[_0xb221('0x9')](),controller['destroy']);module[_0xb221('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 28386aa..eada513 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 _0x9d58=['roundrobin','sequelize','exports','STRING','INTEGER','rrmemory'];(function(_0xbdc127,_0xdbd64c){var _0x5d45a2=function(_0x9d5b91){while(--_0x9d5b91){_0xbdc127['push'](_0xbdc127['shift']());}};_0x5d45a2(++_0xdbd64c);}(_0x9d58,0x8b));var _0x89d5=function(_0xab6a2b,_0x403a6b){_0xab6a2b=_0xab6a2b-0x0;var _0x33edba=_0x9d58[_0xab6a2b];return _0x33edba;};'use strict';var Sequelize=require(_0x89d5('0x0'));module[_0x89d5('0x1')]={'name':{'type':Sequelize[_0x89d5('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x89d5('0x2')]},'timeout':{'type':Sequelize[_0x89d5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x89d5('0x4'),'beepall',_0x89d5('0x5'))}}; \ No newline at end of file +var _0x21de=['rrmemory','beepall','sequelize','name','STRING','INTEGER'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x21de,0xb6));var _0xe21d=function(_0x2237bb,_0x46a955){_0x2237bb=_0x2237bb-0x0;var _0xdb379b=_0x21de[_0x2237bb];return _0xdb379b;};'use strict';var Sequelize=require(_0xe21d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe21d('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe21d('0x2')]},'timeout':{'type':Sequelize[_0xe21d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe21d('0x4'),_0xe21d('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index afc560d..31a5faa 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 _0x687b=['value','removeAgents','userChatQueue:remove','omit','spread','isArray','emit','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','ChatQueue','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','pick','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','forEach','userChatQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact'];(function(_0x5e5b5e,_0x1d4bde){var _0x296489=function(_0x55af5c){while(--_0x55af5c){_0x5e5b5e['push'](_0x5e5b5e['shift']());}};_0x296489(++_0x1d4bde);}(_0x687b,0x14a));var _0xb687=function(_0x1c1798,_0x24812b){_0x1c1798=_0x1c1798-0x0;var _0x4f235e=_0x687b[_0x1c1798];return _0x4f235e;};'use strict';var pdf=require(_0xb687('0x0'));var emlformat=require(_0xb687('0x1'));var rimraf=require(_0xb687('0x2'));var zipdir=require(_0xb687('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb687('0x4'));var BPromise=require(_0xb687('0x5'));var Mustache=require(_0xb687('0x6'));var util=require(_0xb687('0x7'));var path=require(_0xb687('0x8'));var sox=require(_0xb687('0x9'));var csv=require(_0xb687('0xa'));var ejs=require(_0xb687('0xb'));var fs=require('fs');var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var db=require(_0xb687('0x1a'))['db'];config[_0xb687('0x1b')]=_[_0xb687('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb687('0x1d'))(new Redis(config[_0xb687('0x1b')]));require('./chatQueue.socket')[_0xb687('0x1e')](socket);var jayson=require(_0xb687('0x1f'));var client=jayson[_0xb687('0x20')][_0xb687('0x21')]({'port':0x232a});function checkPasswordPattern(_0x838dd4,_0x3ab914,_0x30622f){if(_0x30622f){var _0x141375=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x141375[_0xb687('0x22')](_0x3ab914)){return _0x838dd4;}else{throw new db[(_0xb687('0x23'))][(_0xb687('0x24'))](_0xb687('0x25'));}}else{return _0x838dd4;}}function respondWithRpcPromise(_0x4f0fdb,_0x214b06,_0x328301,_0x30d370){return new BPromise(function(_0x5eb9b9,_0x48958d){var _0x12eff1=_0x30d370||client;return _0x12eff1[_0xb687('0x26')](_0x4f0fdb,_0x328301)[_0xb687('0x27')](function(_0x4b593b){logger[_0xb687('0x28')]('ChatQueue,\x20%s,\x20%s',_0x214b06,_0xb687('0x29'));logger[_0xb687('0x2a')](_0xb687('0x2b'),_0x214b06,_0xb687('0x29'),JSON['stringify'](_0x4b593b));if(_0x4b593b[_0xb687('0x2c')]){if(_0x4b593b['error'][_0xb687('0x2d')]===0x1f4){logger[_0xb687('0x2c')](_0xb687('0x2e'),_0x214b06,_0x4b593b['error'][_0xb687('0x2f')]);return _0x48958d(_0x4b593b[_0xb687('0x2c')][_0xb687('0x2f')]);}logger[_0xb687('0x2c')](_0xb687('0x2e'),_0x214b06,_0x4b593b[_0xb687('0x2c')][_0xb687('0x2f')]);return _0x5eb9b9(_0x4b593b[_0xb687('0x2c')]['message']);}else{logger[_0xb687('0x28')](_0xb687('0x2e'),_0x214b06,_0xb687('0x29'));_0x5eb9b9(_0x4b593b[_0xb687('0x30')][_0xb687('0x2f')]);}})[_0xb687('0x31')](function(_0x17ff2b){logger[_0xb687('0x2c')](_0xb687('0x2e'),_0x214b06,_0x17ff2b);_0x48958d(_0x17ff2b);});});}function respondWithStatusCode(_0x2e6185,_0x4a61ec){_0x4a61ec=_0x4a61ec||0xcc;return function(_0x3712cf){if(_0x3712cf){return _0x2e6185[_0xb687('0x32')](_0x4a61ec);}return _0x2e6185[_0xb687('0x33')](_0x4a61ec)[_0xb687('0x34')]();};}function respondWithResult(_0x2e5c8d,_0x173c58){_0x173c58=_0x173c58||0xc8;return function(_0x4e9a06){if(_0x4e9a06){return _0x2e5c8d[_0xb687('0x33')](_0x173c58)['json'](_0x4e9a06);}};}function respondWithFilteredResult(_0x360429,_0x40f35c){return function(_0x6df7a2){if(_0x6df7a2){var _0x245db1=_0x6df7a2['count'],_0x1ad3ef=_0x40f35c[_0xb687('0x35')],_0x43d20d=_0x40f35c[_0xb687('0x35')]+_0x40f35c[_0xb687('0x36')],_0xf1f0dd;if(_0x43d20d>=_0x245db1){_0x43d20d=_0x245db1;_0xf1f0dd=0xc8;}else{_0xf1f0dd=0xce;}_0x360429[_0xb687('0x33')](_0xf1f0dd);return _0x360429[_0xb687('0x37')](_0xb687('0x38'),_0x1ad3ef+'-'+_0x43d20d+'/'+_0x245db1)[_0xb687('0x39')](_0x6df7a2);}return null;};}function patchUpdates(_0x164353){return function(_0x3551df){try{jsonpatch[_0xb687('0x3a')](_0x3551df,_0x164353,!![]);}catch(_0x17185e){return BPromise['reject'](_0x17185e);}return _0x3551df['save']();};}function saveUpdates(_0x1807b3,_0xe4456){return function(_0x24c418){if(_0x24c418){return _0x24c418[_0xb687('0x3b')](_0x1807b3)['then'](function(_0x4f0b28){return _0x4f0b28;});}return null;};}function removeEntity(_0x1ccc25,_0x2f4773){return function(_0x491a8d){if(_0x491a8d){return _0x491a8d[_0xb687('0x3c')]()[_0xb687('0x27')](function(){var _0x548b83=_0x491a8d[_0xb687('0x3d')]({'plain':!![]});var _0x5c4964=_0xb687('0x3e');return db[_0xb687('0x3f')][_0xb687('0x3c')]({'where':{'type':_0x5c4964,'resourceId':_0x548b83['id']}})[_0xb687('0x27')](function(){return _0x491a8d;});})[_0xb687('0x27')](function(){_0x1ccc25[_0xb687('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x529b1a,_0x16c37d){return function(_0x2a73df){if(!_0x2a73df){_0x529b1a[_0xb687('0x32')](0x194);}return _0x2a73df;};}function handleError(_0x58b246,_0x43cd9f){_0x43cd9f=_0x43cd9f||0x1f4;return function(_0x100f4a){logger[_0xb687('0x2c')](_0x100f4a[_0xb687('0x40')]);if(_0x100f4a[_0xb687('0x41')]){delete _0x100f4a['name'];}_0x58b246[_0xb687('0x33')](_0x43cd9f)[_0xb687('0x42')](_0x100f4a);};}exports[_0xb687('0x43')]=function(_0xdf57ff,_0x24b785){var _0x29cf09={},_0x572b5a={},_0x5ad577={'count':0x0,'rows':[]};var _0x43f29c=_['map'](db[_0xb687('0x44')][_0xb687('0x45')],function(_0x48d3b1){return{'name':_0x48d3b1[_0xb687('0x46')],'type':_0x48d3b1[_0xb687('0x47')]['key']};});_0x572b5a[_0xb687('0x48')]=_[_0xb687('0x49')](_0x43f29c,_0xb687('0x41'));_0x572b5a['query']=_[_0xb687('0x4a')](_0xdf57ff[_0xb687('0x4b')]);_0x572b5a[_0xb687('0x4c')]=_[_0xb687('0x4d')](_0x572b5a[_0xb687('0x48')],_0x572b5a[_0xb687('0x4b')]);_0x29cf09[_0xb687('0x4e')]=_['intersection'](_0x572b5a[_0xb687('0x48')],qs['fields'](_0xdf57ff['query'][_0xb687('0x4f')]));_0x29cf09[_0xb687('0x4e')]=_0x29cf09['attributes'][_0xb687('0x50')]?_0x29cf09['attributes']:_0x572b5a[_0xb687('0x48')];if(!_0xdf57ff[_0xb687('0x4b')]['hasOwnProperty'](_0xb687('0x51'))){_0x29cf09[_0xb687('0x36')]=qs['limit'](_0xdf57ff[_0xb687('0x4b')][_0xb687('0x36')]);_0x29cf09[_0xb687('0x35')]=qs[_0xb687('0x35')](_0xdf57ff[_0xb687('0x4b')][_0xb687('0x35')]);}_0x29cf09[_0xb687('0x52')]=qs[_0xb687('0x53')](_0xdf57ff[_0xb687('0x4b')][_0xb687('0x53')]);_0x29cf09[_0xb687('0x54')]=qs[_0xb687('0x4c')](_['pick'](_0xdf57ff[_0xb687('0x4b')],_0x572b5a['filters']));if(_0xdf57ff[_0xb687('0x4b')][_0xb687('0x55')]){_0x29cf09[_0xb687('0x54')]=_[_0xb687('0x56')](_0x29cf09[_0xb687('0x54')],{'$or':_[_0xb687('0x49')](_0x43f29c,function(_0x49c2da){if(_0x49c2da['type']!==_0xb687('0x57')){var _0x3f1355={};_0x3f1355[_0x49c2da[_0xb687('0x41')]]={'$like':'%'+_0xdf57ff[_0xb687('0x4b')]['filter']+'%'};return _0x3f1355;}})});}_0x29cf09=_[_0xb687('0x56')]({},_0x29cf09,_0xdf57ff[_0xb687('0x58')]);var _0x19a828={'where':_0x29cf09[_0xb687('0x54')]};return db['ChatQueue'][_0xb687('0x59')](_0x19a828)[_0xb687('0x27')](function(_0x162b19){_0x5ad577[_0xb687('0x59')]=_0x162b19;if(_0xdf57ff['query']['includeAll']){_0x29cf09[_0xb687('0x5a')]=[{'all':!![]}];}return db[_0xb687('0x44')][_0xb687('0x5b')](_0x29cf09);})['then'](function(_0x5d92e7){_0x5ad577[_0xb687('0x5c')]=_0x5d92e7;return _0x5ad577;})[_0xb687('0x27')](respondWithFilteredResult(_0x24b785,_0x29cf09))[_0xb687('0x31')](handleError(_0x24b785,null));};exports[_0xb687('0x5d')]=function(_0x34205d,_0x1fb31a){var _0x602864={'raw':!![],'where':{'id':_0x34205d['params']['id']}},_0x4170f3={};_0x4170f3[_0xb687('0x48')]=_[_0xb687('0x4a')](db[_0xb687('0x44')]['rawAttributes']);_0x4170f3['query']=_['keys'](_0x34205d['query']);_0x4170f3[_0xb687('0x4c')]=_[_0xb687('0x4d')](_0x4170f3[_0xb687('0x48')],_0x4170f3[_0xb687('0x4b')]);_0x602864[_0xb687('0x4e')]=_[_0xb687('0x4d')](_0x4170f3[_0xb687('0x48')],qs[_0xb687('0x4f')](_0x34205d[_0xb687('0x4b')][_0xb687('0x4f')]));_0x602864[_0xb687('0x4e')]=_0x602864[_0xb687('0x4e')][_0xb687('0x50')]?_0x602864[_0xb687('0x4e')]:_0x4170f3[_0xb687('0x48')];if(_0x34205d[_0xb687('0x4b')][_0xb687('0x5e')]){_0x602864['include']=[{'all':!![]}];}_0x602864=_['merge']({},_0x602864,_0x34205d[_0xb687('0x58')]);return db[_0xb687('0x44')][_0xb687('0x5f')](_0x602864)[_0xb687('0x27')](handleEntityNotFound(_0x1fb31a,null))['then'](respondWithResult(_0x1fb31a,null))[_0xb687('0x31')](handleError(_0x1fb31a,null));};exports[_0xb687('0x60')]=function(_0x586eae,_0x115d14){return db['ChatQueue'][_0xb687('0x60')](_0x586eae[_0xb687('0x61')],{})['then'](function(_0x4fb188){var _0x13ad6a=_0x586eae[_0xb687('0x62')]['get']({'plain':!![]});if(!_0x13ad6a)throw new Error(_0xb687('0x63'));if(_0x13ad6a[_0xb687('0x64')]===_0xb687('0x62')){var _0x50c7e0=_0x4fb188[_0xb687('0x3d')]({'plain':!![]});var _0x5b3c93=_0xb687('0x3e');return db[_0xb687('0x65')][_0xb687('0x5f')]({'where':{'name':_0x5b3c93,'userProfileId':_0x13ad6a[_0xb687('0x66')]},'raw':!![]})[_0xb687('0x27')](function(_0x49b403){if(_0x49b403&&_0x49b403['autoAssociation']===0x0){return db[_0xb687('0x3f')]['create']({'name':_0x50c7e0['name'],'resourceId':_0x50c7e0['id'],'type':_0x49b403['name'],'sectionId':_0x49b403['id']},{})['then'](function(){return _0x4fb188;});}else{return _0x4fb188;}})[_0xb687('0x31')](function(_0x1db4ca){logger[_0xb687('0x2c')](_0xb687('0x67'),_0x1db4ca);throw _0x1db4ca;});}return _0x4fb188;})[_0xb687('0x27')](respondWithResult(_0x115d14,0xc9))[_0xb687('0x31')](handleError(_0x115d14,null));};exports[_0xb687('0x3b')]=function(_0x3c0348,_0x29871d){if(_0x3c0348[_0xb687('0x61')]['id']){delete _0x3c0348[_0xb687('0x61')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x3c0348[_0xb687('0x68')]['id']}})['then'](handleEntityNotFound(_0x29871d,null))[_0xb687('0x27')](saveUpdates(_0x3c0348[_0xb687('0x61')],null))[_0xb687('0x27')](respondWithResult(_0x29871d,null))[_0xb687('0x31')](handleError(_0x29871d,null));};exports[_0xb687('0x3c')]=function(_0x4b5f75,_0x22da49){return db['ChatQueue'][_0xb687('0x5f')]({'where':{'id':_0x4b5f75[_0xb687('0x68')]['id']}})[_0xb687('0x27')](handleEntityNotFound(_0x22da49,null))[_0xb687('0x27')](removeEntity(_0x22da49,null))[_0xb687('0x31')](handleError(_0x22da49,null));};exports[_0xb687('0x69')]=function(_0x2c0737,_0x5deb7a){return db[_0xb687('0x44')][_0xb687('0x69')]()[_0xb687('0x27')](respondWithResult(_0x5deb7a,null))[_0xb687('0x31')](handleError(_0x5deb7a,null));};exports[_0xb687('0x6a')]=function(_0x4e99c5,_0x2bd850,_0x2f892){var _0x1eb23c={'raw':!![],'where':{}},_0x319038={},_0x2f88c2;return db[_0xb687('0x44')][_0xb687('0x6b')]({'where':{'id':_0x4e99c5[_0xb687('0x68')]['id']}})[_0xb687('0x27')](handleEntityNotFound(_0x2bd850,null))[_0xb687('0x27')](function(_0x1c167c){if(_0x1c167c){_0x2f88c2=_0x1c167c['get']({'plain':!![]});_0x319038[_0xb687('0x48')]=_[_0xb687('0x4a')](db[_0xb687('0x6c')][_0xb687('0x45')]);_0x319038['query']=_[_0xb687('0x4a')](_0x4e99c5[_0xb687('0x4b')]);_0x319038['filters']=_[_0xb687('0x4d')](_0x319038[_0xb687('0x48')],_0x319038[_0xb687('0x4b')]);_0x1eb23c['attributes']=_[_0xb687('0x4d')](_0x319038[_0xb687('0x48')],qs['fields'](_0x4e99c5[_0xb687('0x4b')][_0xb687('0x4f')]));_0x1eb23c[_0xb687('0x4e')]=_0x1eb23c[_0xb687('0x4e')]['length']?_0x1eb23c[_0xb687('0x4e')]:_0x319038[_0xb687('0x48')];if(!_0x4e99c5['query'][_0xb687('0x6d')](_0xb687('0x51'))){_0x1eb23c['limit']=qs['limit'](_0x4e99c5[_0xb687('0x4b')]['limit']);_0x1eb23c[_0xb687('0x35')]=qs[_0xb687('0x35')](_0x4e99c5[_0xb687('0x4b')][_0xb687('0x35')]);}_0x1eb23c[_0xb687('0x52')]=qs[_0xb687('0x53')](_0x4e99c5[_0xb687('0x4b')][_0xb687('0x53')]);_0x1eb23c['where']=qs[_0xb687('0x4c')](_[_0xb687('0x6e')](_0x4e99c5[_0xb687('0x4b')],_0x319038[_0xb687('0x4c')]));_0x1eb23c[_0xb687('0x54')][_0xb687('0x6f')]=_0x1c167c['id'];if(_0x4e99c5['query'][_0xb687('0x55')]){_0x1eb23c[_0xb687('0x54')]=_['merge'](_0x1eb23c[_0xb687('0x54')],{'$or':_[_0xb687('0x49')](_0x1eb23c[_0xb687('0x4e')],function(_0x1227fe){var _0x5333e3={};_0x5333e3[_0x1227fe]={'$like':'%'+_0x4e99c5[_0xb687('0x4b')]['filter']+'%'};return _0x5333e3;})});}_0x1eb23c=_['merge']({},_0x1eb23c,_0x4e99c5[_0xb687('0x58')]);return db['UserChatQueue']['findAll'](_0x1eb23c);}})[_0xb687('0x27')](function(_0x5d127a){if(_0x5d127a){return db[_0xb687('0x70')][_0xb687('0x71')]({'where':{'id':_['map'](_0x5d127a,_0xb687('0x72')),'role':_0xb687('0x73')},'attributes':['id','name',_0xb687('0x74'),_0xb687('0x75'),_0xb687('0x76')]});}})[_0xb687('0x27')](function(_0x23cf29){if(_0x23cf29){return{'count':_0x23cf29[_0xb687('0x59')],'rows':_[_0xb687('0x49')](_0x23cf29[_0xb687('0x5c')],function(_0xab8e7d){return{'membername':_0xab8e7d[_0xb687('0x41')],'UserId':_0xab8e7d['id'],'queue_name':_0x2f88c2[_0xb687('0x41')],'ChatQueueId':_0x2f88c2['id'],'interface':util['format'](_0xb687('0x77'),'SIP',_0xab8e7d['name']),'penalty':0x0,'paused':_0xab8e7d[_0xb687('0x74')],'createdAt':_0xab8e7d[_0xb687('0x76')],'updatedAt':_0xab8e7d[_0xb687('0x75')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb687('0x27')](respondWithFilteredResult(_0x2bd850,_0x1eb23c))[_0xb687('0x31')](handleError(_0x2bd850,null));};exports['getTeams']=function(_0x59c94b,_0x29e27e,_0x316abd){var _0x309947={};var _0x452838={};var _0x4baf71;var _0x448d59;return db[_0xb687('0x44')][_0xb687('0x6b')]({'where':{'id':_0x59c94b[_0xb687('0x68')]['id']}})[_0xb687('0x27')](handleEntityNotFound(_0x29e27e,null))[_0xb687('0x27')](function(_0x3cbdd2){if(_0x3cbdd2){_0x4baf71=_0x3cbdd2;_0x452838[_0xb687('0x48')]=_[_0xb687('0x4a')](db['Team'][_0xb687('0x45')]);_0x452838[_0xb687('0x4b')]=_[_0xb687('0x4a')](_0x59c94b[_0xb687('0x4b')]);_0x452838[_0xb687('0x4c')]=_['intersection'](_0x452838[_0xb687('0x48')],_0x452838[_0xb687('0x4b')]);_0x309947['attributes']=_[_0xb687('0x4d')](_0x452838['model'],qs[_0xb687('0x4f')](_0x59c94b[_0xb687('0x4b')]['fields']));_0x309947[_0xb687('0x4e')]=_0x309947[_0xb687('0x4e')]['length']?_0x309947[_0xb687('0x4e')]:_0x452838[_0xb687('0x48')];_0x309947[_0xb687('0x52')]=qs[_0xb687('0x53')](_0x59c94b[_0xb687('0x4b')][_0xb687('0x53')]);_0x309947['where']=qs[_0xb687('0x4c')](_[_0xb687('0x6e')](_0x59c94b[_0xb687('0x4b')],_0x452838[_0xb687('0x4c')]));if(_0x59c94b[_0xb687('0x4b')][_0xb687('0x55')]){_0x309947[_0xb687('0x54')]=_[_0xb687('0x56')](_0x309947[_0xb687('0x54')],{'$or':_[_0xb687('0x49')](_0x309947[_0xb687('0x4e')],function(_0x5ee585){var _0x10fb0={};_0x10fb0[_0x5ee585]={'$like':'%'+_0x59c94b['query'][_0xb687('0x55')]+'%'};return _0x10fb0;})});}_0x309947=_[_0xb687('0x56')]({},_0x309947,_0x59c94b['options']);return _0x4baf71['getTeams'](_0x309947);}})[_0xb687('0x27')](function(_0x13c748){if(_0x13c748){_0x448d59=_0x13c748[_0xb687('0x50')];if(!_0x59c94b[_0xb687('0x4b')][_0xb687('0x6d')](_0xb687('0x51'))){_0x309947[_0xb687('0x36')]=qs[_0xb687('0x36')](_0x59c94b[_0xb687('0x4b')][_0xb687('0x36')]);_0x309947[_0xb687('0x35')]=qs[_0xb687('0x35')](_0x59c94b[_0xb687('0x4b')][_0xb687('0x35')]);}return _0x4baf71[_0xb687('0x78')](_0x309947);}})[_0xb687('0x27')](function(_0x508550){if(_0x508550){return _0x508550?{'count':_0x448d59,'rows':_0x508550}:null;}})['then'](respondWithResult(_0x29e27e,null))[_0xb687('0x31')](handleError(_0x29e27e,null));};exports['addTeams']=function(_0x5f2557,_0x3b8514,_0x385d2d){var _0x48fb24=_0x5f2557[_0xb687('0x61')][_0xb687('0x79')];return db['Team'][_0xb687('0x5b')]({'where':{'id':_0x48fb24},'attributes':['id'],'include':[{'model':db[_0xb687('0x70')],'as':_0xb687('0x7a'),'attributes':['id',_0xb687('0x41'),_0xb687('0x7b'),_0xb687('0x7c'),_0xb687('0x7d')],'raw':!![]}]})[_0xb687('0x27')](function(_0xf35e94){if(_0xf35e94){var _0x4c79f7=_[_0xb687('0x7e')](_0xf35e94,function(_0x30351a){var _0x4b11d0=_0x30351a[_0xb687('0x3d')]({'plain':!![]});return _0x4b11d0['Agents'];});return db[_0xb687('0x44')][_0xb687('0x5f')]({'where':{'id':_0x5f2557['params']['id']}})[_0xb687('0x27')](function(_0x20e46a){return db[_0xb687('0x7f')][_0xb687('0x80')](function(_0x446b2b){return _0x20e46a[_0xb687('0x81')](_0x48fb24,{'transaction':_0x446b2b})[_0xb687('0x27')](function(){return BPromise['each'](_0x4c79f7,function(_0x52063e){return db[_0xb687('0x6c')]['findOrCreate']({'where':{'UserId':_0x52063e['id'],'ChatQueueId':_0x5f2557[_0xb687('0x68')]['id']},'transaction':_0x446b2b});});})[_0xb687('0x27')](function(){_0x4c79f7[_0xb687('0x82')](function(_0x312529){socket['emit'](_0xb687('0x83'),{'UserId':_0x312529['id'],'ChatQueueId':_0x20e46a['id']});});});});});}})[_0xb687('0x27')](respondWithStatusCode(_0x3b8514,null))['catch'](handleError(_0x3b8514,null));};exports[_0xb687('0x84')]=function(_0x4546c5,_0x2c2914,_0x4747d5){return db[_0xb687('0x85')][_0xb687('0x5b')]({'where':{'id':_0x4546c5['query'][_0xb687('0x79')]},'attributes':['id'],'include':[{'model':db[_0xb687('0x70')],'as':_0xb687('0x7a'),'attributes':['id'],'raw':!![]}]})[_0xb687('0x27')](handleEntityNotFound(_0x2c2914,null))[_0xb687('0x27')](function(_0x27a2cd){var _0x1290c0=_[_0xb687('0x49')](_0x27a2cd,'id');var _0x1411bf=[];var _0x297a0b=[];var _0x4ff77d=squel['select']();_0x4ff77d[_0xb687('0x86')](_0xb687('0x87'))[_0xb687('0x88')](_0xb687('0x89'),'tq')[_0xb687('0x8a')](_0xb687('0x8b'),'ut',_0xb687('0x8c'))[_0xb687('0x54')](_0xb687('0x8d'),_0x4546c5['params']['id']);for(var _0x5bd572=0x0;_0x5bd572<_0x27a2cd['length'];_0x5bd572+=0x1){let _0x1b5ded=_0x27a2cd[_0x5bd572];for(var _0x360fce=0x0;_0x360fce<_0x1b5ded[_0xb687('0x7a')][_0xb687('0x50')];_0x360fce+=0x1){let _0x3b809a=_0x1b5ded[_0xb687('0x7a')][_0x360fce];var _0x473130=_0x4ff77d[_0xb687('0x8e')]();_0x473130['where'](_0xb687('0x8f'),_0x3b809a['id']);_0x297a0b[_0xb687('0x90')](db[_0xb687('0x7f')][_0xb687('0x4b')](_0x473130[_0xb687('0x91')](),{'type':db[_0xb687('0x7f')][_0xb687('0x92')][_0xb687('0x93')]})['then'](function(_0x1f08d2){if(_0x1f08d2['length']===0x1){return _0x3b809a['id'];}else{var _0x3cee8b=_[_0xb687('0x94')](_['map'](_0x1f08d2,_0xb687('0x95')),function(_0x20cc8f){return _[_0xb687('0x96')](_0x1290c0,_0x20cc8f);});if(_0x3cee8b){return _0x3b809a['id'];}}}));}}return BPromise['all'](_0x297a0b)[_0xb687('0x27')](function(_0x1dcb83){_0x1411bf=_(_0x1411bf)[_0xb687('0x97')](_0x1dcb83)[_0xb687('0x98')]()[_0xb687('0x99')]();return db[_0xb687('0x44')][_0xb687('0x5f')]({'where':{'id':_0x4546c5['params']['id']}})[_0xb687('0x27')](function(_0x22b8f2){return db[_0xb687('0x7f')][_0xb687('0x80')](function(_0x401b7e){return _0x22b8f2['removeTeams'](_0x4546c5[_0xb687('0x4b')][_0xb687('0x79')],{'transaction':_0x401b7e})[_0xb687('0x27')](function(){if(!_['isEmpty'](_0x1411bf)){return _0x22b8f2[_0xb687('0x9a')](_0x1411bf,{'transaction':_0x401b7e});}})['then'](function(){_0x1411bf[_0xb687('0x82')](function(_0x143374){socket['emit'](_0xb687('0x9b'),{'UserId':_0x143374,'ChatQueueId':_0x22b8f2['id']});});});});});});})[_0xb687('0x27')](respondWithStatusCode(_0x2c2914,null))[_0xb687('0x31')](handleError(_0x2c2914,null));};exports['addAgents']=function(_0x36db58,_0x32f637,_0x1eab89){return db[_0xb687('0x44')][_0xb687('0x5f')]({'where':{'id':_0x36db58[_0xb687('0x68')]['id']}})[_0xb687('0x27')](handleEntityNotFound(_0x32f637,null))[_0xb687('0x27')](function(_0x8f6ba0){if(_0x8f6ba0){return _0x8f6ba0['addAgents'](_0x36db58[_0xb687('0x61')][_0xb687('0x79')],_[_0xb687('0x9c')](_0x36db58['body'],['ids','id'])||{})[_0xb687('0x9d')](function(_0x4d6600){for(var _0x187810=0x0;_0x187810<_0x36db58[_0xb687('0x61')][_0xb687('0x79')]['length'];_0x187810+=0x1){socket['emit'](_0xb687('0x83'),{'UserId':_0x36db58[_0xb687('0x61')][_0xb687('0x79')][_0x187810],'ChatQueueId':_0x36db58[_0xb687('0x68')]['id']});}return _0x4d6600;});}})[_0xb687('0x27')](respondWithResult(_0x32f637,null))['catch'](handleError(_0x32f637,null));};exports[_0xb687('0x9a')]=function(_0x6abfcf,_0x522304,_0x1ad9fc){return db[_0xb687('0x44')]['find']({'where':{'id':_0x6abfcf[_0xb687('0x68')]['id']}})[_0xb687('0x27')](handleEntityNotFound(_0x522304,null))['then'](function(_0x1b8733){if(_0x1b8733){return _0x1b8733[_0xb687('0x9a')](_0x6abfcf[_0xb687('0x4b')][_0xb687('0x79')])[_0xb687('0x27')](function(){if(_[_0xb687('0x9e')](_0x6abfcf[_0xb687('0x4b')]['ids'])){for(var _0x394a94=0x0;_0x394a94<_0x6abfcf['query'][_0xb687('0x79')][_0xb687('0x50')];_0x394a94+=0x1){socket[_0xb687('0x9f')](_0xb687('0x9b'),{'UserId':Number(_0x6abfcf['query'][_0xb687('0x79')][_0x394a94]),'ChatQueueId':Number(_0x6abfcf['params']['id'])});}}else{socket['emit'](_0xb687('0x9b'),{'UserId':Number(_0x6abfcf[_0xb687('0x4b')][_0xb687('0x79')]),'ChatQueueId':Number(_0x6abfcf['params']['id'])});}});}})[_0xb687('0x27')](respondWithStatusCode(_0x522304,null))[_0xb687('0x31')](handleError(_0x522304,null));};exports['getAgents']=function(_0x36ff82,_0x4d6054,_0x22ec65){var _0x389d22={};var _0x4c965a={};var _0x477de0;var _0x4a99c4;return db[_0xb687('0x44')]['findOne']({'where':{'id':_0x36ff82['params']['id']}})[_0xb687('0x27')](handleEntityNotFound(_0x4d6054,null))[_0xb687('0x27')](function(_0x581338){if(_0x581338){_0x477de0=_0x581338;_0x4c965a[_0xb687('0x48')]=_['keys'](db[_0xb687('0x70')][_0xb687('0x45')]);_0x4c965a[_0xb687('0x4b')]=_['keys'](_0x36ff82[_0xb687('0x4b')]);_0x4c965a[_0xb687('0x4c')]=_[_0xb687('0x4d')](_0x4c965a[_0xb687('0x48')],_0x4c965a[_0xb687('0x4b')]);_0x389d22[_0xb687('0x4e')]=_['intersection'](_0x4c965a[_0xb687('0x48')],qs[_0xb687('0x4f')](_0x36ff82[_0xb687('0x4b')][_0xb687('0x4f')]));_0x389d22[_0xb687('0x4e')]=_0x389d22['attributes']['length']?_0x389d22[_0xb687('0x4e')]:_0x4c965a[_0xb687('0x48')];_0x389d22[_0xb687('0x52')]=qs[_0xb687('0x53')](_0x36ff82[_0xb687('0x4b')][_0xb687('0x53')]);_0x389d22[_0xb687('0x54')]=qs['filters'](_[_0xb687('0x6e')](_0x36ff82[_0xb687('0x4b')],_0x4c965a[_0xb687('0x4c')]));if(_0x36ff82['query'][_0xb687('0x55')]){_0x389d22[_0xb687('0x54')]=_[_0xb687('0x56')](_0x389d22['where'],{'$or':_[_0xb687('0x49')](_0x389d22[_0xb687('0x4e')],function(_0x5d6de9){var _0x4523e5={};_0x4523e5[_0x5d6de9]={'$like':'%'+_0x36ff82[_0xb687('0x4b')][_0xb687('0x55')]+'%'};return _0x4523e5;})});}_0x389d22=_[_0xb687('0x56')]({},_0x389d22,_0x36ff82['options']);return _0x477de0[_0xb687('0xa0')](_0x389d22);}})[_0xb687('0x27')](function(_0x14c0c7){if(_0x14c0c7){_0x4a99c4=_0x14c0c7[_0xb687('0x50')];if(!_0x36ff82[_0xb687('0x4b')]['hasOwnProperty'](_0xb687('0x51'))){_0x389d22[_0xb687('0x36')]=qs['limit'](_0x36ff82[_0xb687('0x4b')][_0xb687('0x36')]);_0x389d22['offset']=qs[_0xb687('0x35')](_0x36ff82[_0xb687('0x4b')][_0xb687('0x35')]);}return _0x477de0['getAgents'](_0x389d22);}})[_0xb687('0x27')](function(_0x19502a){if(_0x19502a){return _0x19502a?{'count':_0x4a99c4,'rows':_0x19502a}:null;}})['then'](respondWithResult(_0x4d6054,null))['catch'](handleError(_0x4d6054,null));}; \ No newline at end of file +var _0x4c60=['User','findAndCountAll','UserId','agent','chatPause','updatedAt','format','%s/%s','findOne','Team','options','getTeams','addTeams','Agents','online','interface','transaction','findOrCreate','emit','userChatQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','stringify','error','ChatQueue,\x20%s,\x20%s','message','info','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','type','key','model','keys','filters','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','show','params','rawAttributes','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','body','describe','UserChatQueue','hasOwnProperty'];(function(_0x4cf07f,_0xe6d006){var _0x531fe4=function(_0x4ec1a8){while(--_0x4ec1a8){_0x4cf07f['push'](_0x4cf07f['shift']());}};_0x531fe4(++_0xe6d006);}(_0x4c60,0xc1));var _0x04c6=function(_0x5453a4,_0x3de67c){_0x5453a4=_0x5453a4-0x0;var _0x483b76=_0x4c60[_0x5453a4];return _0x483b76;};'use strict';var pdf=require(_0x04c6('0x0'));var emlformat=require(_0x04c6('0x1'));var rimraf=require(_0x04c6('0x2'));var zipdir=require(_0x04c6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04c6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x04c6('0x5'));var sox=require(_0x04c6('0x6'));var csv=require(_0x04c6('0x7'));var ejs=require(_0x04c6('0x8'));var fs=require('fs');var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x7'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var db=require(_0x04c6('0x13'))['db'];config[_0x04c6('0x14')]=_[_0x04c6('0x15')](config['redis'],{'host':_0x04c6('0x16'),'port':0x18eb});var socket=require(_0x04c6('0x17'))(new Redis(config[_0x04c6('0x14')]));require('./chatQueue.socket')[_0x04c6('0x18')](socket);var jayson=require(_0x04c6('0x19'));var client=jayson[_0x04c6('0x1a')][_0x04c6('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x4760f8,_0x19a26f,_0x1cd963){if(_0x1cd963){var _0x3d46a9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3d46a9['test'](_0x19a26f)){return _0x4760f8;}else{throw new db[(_0x04c6('0x1c'))][(_0x04c6('0x1d'))](_0x04c6('0x1e'));}}else{return _0x4760f8;}}function respondWithRpcPromise(_0x2bc754,_0x43596a,_0xfb4db5,_0x21674a){return new BPromise(function(_0x423ea9,_0x47f400){var _0x142065=_0x21674a||client;return _0x142065[_0x04c6('0x1f')](_0x2bc754,_0xfb4db5)[_0x04c6('0x20')](function(_0x558b43){logger['info']('ChatQueue,\x20%s,\x20%s',_0x43596a,_0x04c6('0x21'));logger[_0x04c6('0x22')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x43596a,'request\x20sent',JSON[_0x04c6('0x23')](_0x558b43));if(_0x558b43[_0x04c6('0x24')]){if(_0x558b43[_0x04c6('0x24')]['code']===0x1f4){logger[_0x04c6('0x24')](_0x04c6('0x25'),_0x43596a,_0x558b43[_0x04c6('0x24')]['message']);return _0x47f400(_0x558b43[_0x04c6('0x24')][_0x04c6('0x26')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x43596a,_0x558b43['error'][_0x04c6('0x26')]);return _0x423ea9(_0x558b43[_0x04c6('0x24')][_0x04c6('0x26')]);}else{logger[_0x04c6('0x27')](_0x04c6('0x25'),_0x43596a,'request\x20sent');_0x423ea9(_0x558b43['result'][_0x04c6('0x26')]);}})[_0x04c6('0x28')](function(_0x9acfa){logger[_0x04c6('0x24')](_0x04c6('0x25'),_0x43596a,_0x9acfa);_0x47f400(_0x9acfa);});});}function respondWithStatusCode(_0x1f5aaf,_0x47c69a){_0x47c69a=_0x47c69a||0xcc;return function(_0x1d0d3f){if(_0x1d0d3f){return _0x1f5aaf[_0x04c6('0x29')](_0x47c69a);}return _0x1f5aaf['status'](_0x47c69a)[_0x04c6('0x2a')]();};}function respondWithResult(_0x1cd16a,_0x5f1331){_0x5f1331=_0x5f1331||0xc8;return function(_0x5c9003){if(_0x5c9003){return _0x1cd16a[_0x04c6('0x2b')](_0x5f1331)[_0x04c6('0x2c')](_0x5c9003);}};}function respondWithFilteredResult(_0x2a191f,_0xbb9e81){return function(_0x23c500){if(_0x23c500){var _0x43884e=_0x23c500[_0x04c6('0x2d')],_0x49c4ed=_0xbb9e81['offset'],_0x5d8c88=_0xbb9e81[_0x04c6('0x2e')]+_0xbb9e81[_0x04c6('0x2f')],_0x4fd842;if(_0x5d8c88>=_0x43884e){_0x5d8c88=_0x43884e;_0x4fd842=0xc8;}else{_0x4fd842=0xce;}_0x2a191f['status'](_0x4fd842);return _0x2a191f[_0x04c6('0x30')](_0x04c6('0x31'),_0x49c4ed+'-'+_0x5d8c88+'/'+_0x43884e)[_0x04c6('0x2c')](_0x23c500);}return null;};}function patchUpdates(_0x14b6f6){return function(_0x5b2056){try{jsonpatch[_0x04c6('0x32')](_0x5b2056,_0x14b6f6,!![]);}catch(_0x250bd6){return BPromise[_0x04c6('0x33')](_0x250bd6);}return _0x5b2056[_0x04c6('0x34')]();};}function saveUpdates(_0x3762af,_0x902e66){return function(_0x3e59b2){if(_0x3e59b2){return _0x3e59b2[_0x04c6('0x35')](_0x3762af)[_0x04c6('0x20')](function(_0xca0b8f){return _0xca0b8f;});}return null;};}function removeEntity(_0x3294af,_0x973c16){return function(_0x46eccb){if(_0x46eccb){return _0x46eccb[_0x04c6('0x36')]()[_0x04c6('0x20')](function(){var _0x5bb584=_0x46eccb[_0x04c6('0x37')]({'plain':!![]});var _0x1639a1=_0x04c6('0x38');return db[_0x04c6('0x39')]['destroy']({'where':{'type':_0x1639a1,'resourceId':_0x5bb584['id']}})[_0x04c6('0x20')](function(){return _0x46eccb;});})[_0x04c6('0x20')](function(){_0x3294af['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aac49,_0x4f0600){return function(_0x2382ff){if(!_0x2382ff){_0x4aac49['sendStatus'](0x194);}return _0x2382ff;};}function handleError(_0x3fbdd0,_0x4c8f4c){_0x4c8f4c=_0x4c8f4c||0x1f4;return function(_0x15c270){logger[_0x04c6('0x24')](_0x15c270[_0x04c6('0x3a')]);if(_0x15c270[_0x04c6('0x3b')]){delete _0x15c270['name'];}_0x3fbdd0['status'](_0x4c8f4c)[_0x04c6('0x3c')](_0x15c270);};}exports[_0x04c6('0x3d')]=function(_0x50041f,_0x3f4fad){var _0x5ce4b0={},_0x501d7d={},_0x317350={'count':0x0,'rows':[]};var _0x5aede6=_[_0x04c6('0x3e')](db[_0x04c6('0x3f')]['rawAttributes'],function(_0x69e2b6){return{'name':_0x69e2b6['fieldName'],'type':_0x69e2b6[_0x04c6('0x40')][_0x04c6('0x41')]};});_0x501d7d[_0x04c6('0x42')]=_[_0x04c6('0x3e')](_0x5aede6,_0x04c6('0x3b'));_0x501d7d['query']=_[_0x04c6('0x43')](_0x50041f['query']);_0x501d7d[_0x04c6('0x44')]=_['intersection'](_0x501d7d[_0x04c6('0x42')],_0x501d7d[_0x04c6('0x45')]);_0x5ce4b0[_0x04c6('0x46')]=_[_0x04c6('0x47')](_0x501d7d[_0x04c6('0x42')],qs[_0x04c6('0x48')](_0x50041f[_0x04c6('0x45')]['fields']));_0x5ce4b0[_0x04c6('0x46')]=_0x5ce4b0['attributes'][_0x04c6('0x49')]?_0x5ce4b0['attributes']:_0x501d7d['model'];if(!_0x50041f[_0x04c6('0x45')]['hasOwnProperty'](_0x04c6('0x4a'))){_0x5ce4b0[_0x04c6('0x2f')]=qs[_0x04c6('0x2f')](_0x50041f['query'][_0x04c6('0x2f')]);_0x5ce4b0[_0x04c6('0x2e')]=qs[_0x04c6('0x2e')](_0x50041f[_0x04c6('0x45')][_0x04c6('0x2e')]);}_0x5ce4b0[_0x04c6('0x4b')]=qs[_0x04c6('0x4c')](_0x50041f['query']['sort']);_0x5ce4b0[_0x04c6('0x4d')]=qs[_0x04c6('0x44')](_[_0x04c6('0x4e')](_0x50041f['query'],_0x501d7d[_0x04c6('0x44')]));if(_0x50041f[_0x04c6('0x45')][_0x04c6('0x4f')]){_0x5ce4b0['where']=_['merge'](_0x5ce4b0['where'],{'$or':_[_0x04c6('0x3e')](_0x5aede6,function(_0x25c185){if(_0x25c185['type']!==_0x04c6('0x50')){var _0x3de8a9={};_0x3de8a9[_0x25c185[_0x04c6('0x3b')]]={'$like':'%'+_0x50041f['query'][_0x04c6('0x4f')]+'%'};return _0x3de8a9;}})});}_0x5ce4b0=_[_0x04c6('0x51')]({},_0x5ce4b0,_0x50041f['options']);var _0x25a6fc={'where':_0x5ce4b0[_0x04c6('0x4d')]};return db[_0x04c6('0x3f')][_0x04c6('0x2d')](_0x25a6fc)['then'](function(_0x46f0ac){_0x317350[_0x04c6('0x2d')]=_0x46f0ac;if(_0x50041f[_0x04c6('0x45')][_0x04c6('0x52')]){_0x5ce4b0['include']=[{'all':!![]}];}return db[_0x04c6('0x3f')][_0x04c6('0x53')](_0x5ce4b0);})[_0x04c6('0x20')](function(_0x168933){_0x317350['rows']=_0x168933;return _0x317350;})[_0x04c6('0x20')](respondWithFilteredResult(_0x3f4fad,_0x5ce4b0))[_0x04c6('0x28')](handleError(_0x3f4fad,null));};exports[_0x04c6('0x54')]=function(_0x489361,_0x3119f0){var _0x234e97={'raw':!![],'where':{'id':_0x489361[_0x04c6('0x55')]['id']}},_0x2a342c={};_0x2a342c[_0x04c6('0x42')]=_[_0x04c6('0x43')](db[_0x04c6('0x3f')][_0x04c6('0x56')]);_0x2a342c[_0x04c6('0x45')]=_[_0x04c6('0x43')](_0x489361[_0x04c6('0x45')]);_0x2a342c[_0x04c6('0x44')]=_[_0x04c6('0x47')](_0x2a342c['model'],_0x2a342c[_0x04c6('0x45')]);_0x234e97[_0x04c6('0x46')]=_[_0x04c6('0x47')](_0x2a342c[_0x04c6('0x42')],qs[_0x04c6('0x48')](_0x489361['query'][_0x04c6('0x48')]));_0x234e97[_0x04c6('0x46')]=_0x234e97[_0x04c6('0x46')][_0x04c6('0x49')]?_0x234e97[_0x04c6('0x46')]:_0x2a342c[_0x04c6('0x42')];if(_0x489361[_0x04c6('0x45')][_0x04c6('0x52')]){_0x234e97[_0x04c6('0x57')]=[{'all':!![]}];}_0x234e97=_[_0x04c6('0x51')]({},_0x234e97,_0x489361['options']);return db['ChatQueue']['find'](_0x234e97)['then'](handleEntityNotFound(_0x3119f0,null))[_0x04c6('0x20')](respondWithResult(_0x3119f0,null))['catch'](handleError(_0x3119f0,null));};exports[_0x04c6('0x58')]=function(_0x570e25,_0x2860af){return db[_0x04c6('0x3f')]['create'](_0x570e25['body'],{})[_0x04c6('0x20')](function(_0x22f0dc){var _0x35020f=_0x570e25[_0x04c6('0x59')]['get']({'plain':!![]});if(!_0x35020f)throw new Error(_0x04c6('0x5a'));if(_0x35020f[_0x04c6('0x5b')]===_0x04c6('0x59')){var _0x18b51d=_0x22f0dc[_0x04c6('0x37')]({'plain':!![]});var _0x29c72f=_0x04c6('0x38');return db['UserProfileSection'][_0x04c6('0x5c')]({'where':{'name':_0x29c72f,'userProfileId':_0x35020f['userProfileId']},'raw':!![]})[_0x04c6('0x20')](function(_0x3bbd8b){if(_0x3bbd8b&&_0x3bbd8b['autoAssociation']===0x0){return db[_0x04c6('0x39')][_0x04c6('0x58')]({'name':_0x18b51d[_0x04c6('0x3b')],'resourceId':_0x18b51d['id'],'type':_0x3bbd8b[_0x04c6('0x3b')],'sectionId':_0x3bbd8b['id']},{})[_0x04c6('0x20')](function(){return _0x22f0dc;});}else{return _0x22f0dc;}})[_0x04c6('0x28')](function(_0xf073a8){logger[_0x04c6('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf073a8);throw _0xf073a8;});}return _0x22f0dc;})[_0x04c6('0x20')](respondWithResult(_0x2860af,0xc9))['catch'](handleError(_0x2860af,null));};exports[_0x04c6('0x35')]=function(_0x224910,_0x586f2c){if(_0x224910['body']['id']){delete _0x224910[_0x04c6('0x5d')]['id'];}return db['ChatQueue'][_0x04c6('0x5c')]({'where':{'id':_0x224910[_0x04c6('0x55')]['id']}})['then'](handleEntityNotFound(_0x586f2c,null))[_0x04c6('0x20')](saveUpdates(_0x224910[_0x04c6('0x5d')],null))[_0x04c6('0x20')](respondWithResult(_0x586f2c,null))[_0x04c6('0x28')](handleError(_0x586f2c,null));};exports[_0x04c6('0x36')]=function(_0xd12535,_0x3e5a53){return db[_0x04c6('0x3f')][_0x04c6('0x5c')]({'where':{'id':_0xd12535[_0x04c6('0x55')]['id']}})[_0x04c6('0x20')](handleEntityNotFound(_0x3e5a53,null))['then'](removeEntity(_0x3e5a53,null))[_0x04c6('0x28')](handleError(_0x3e5a53,null));};exports[_0x04c6('0x5e')]=function(_0x289612,_0x12394f){return db['ChatQueue'][_0x04c6('0x5e')]()[_0x04c6('0x20')](respondWithResult(_0x12394f,null))[_0x04c6('0x28')](handleError(_0x12394f,null));};exports['getMembers']=function(_0x563862,_0x1655af,_0x1bb3cb){var _0x2e8631={'raw':!![],'where':{}},_0x396f79={},_0x38d3c6;return db[_0x04c6('0x3f')]['findOne']({'where':{'id':_0x563862[_0x04c6('0x55')]['id']}})[_0x04c6('0x20')](handleEntityNotFound(_0x1655af,null))[_0x04c6('0x20')](function(_0x596ac0){if(_0x596ac0){_0x38d3c6=_0x596ac0['get']({'plain':!![]});_0x396f79[_0x04c6('0x42')]=_[_0x04c6('0x43')](db[_0x04c6('0x5f')][_0x04c6('0x56')]);_0x396f79['query']=_[_0x04c6('0x43')](_0x563862['query']);_0x396f79['filters']=_[_0x04c6('0x47')](_0x396f79[_0x04c6('0x42')],_0x396f79[_0x04c6('0x45')]);_0x2e8631[_0x04c6('0x46')]=_[_0x04c6('0x47')](_0x396f79[_0x04c6('0x42')],qs[_0x04c6('0x48')](_0x563862['query'][_0x04c6('0x48')]));_0x2e8631[_0x04c6('0x46')]=_0x2e8631[_0x04c6('0x46')][_0x04c6('0x49')]?_0x2e8631[_0x04c6('0x46')]:_0x396f79['model'];if(!_0x563862['query'][_0x04c6('0x60')](_0x04c6('0x4a'))){_0x2e8631[_0x04c6('0x2f')]=qs['limit'](_0x563862[_0x04c6('0x45')][_0x04c6('0x2f')]);_0x2e8631['offset']=qs[_0x04c6('0x2e')](_0x563862[_0x04c6('0x45')][_0x04c6('0x2e')]);}_0x2e8631[_0x04c6('0x4b')]=qs[_0x04c6('0x4c')](_0x563862[_0x04c6('0x45')][_0x04c6('0x4c')]);_0x2e8631[_0x04c6('0x4d')]=qs[_0x04c6('0x44')](_[_0x04c6('0x4e')](_0x563862[_0x04c6('0x45')],_0x396f79[_0x04c6('0x44')]));_0x2e8631[_0x04c6('0x4d')]['ChatQueueId']=_0x596ac0['id'];if(_0x563862[_0x04c6('0x45')][_0x04c6('0x4f')]){_0x2e8631['where']=_[_0x04c6('0x51')](_0x2e8631[_0x04c6('0x4d')],{'$or':_[_0x04c6('0x3e')](_0x2e8631[_0x04c6('0x46')],function(_0x172787){var _0x4e8d22={};_0x4e8d22[_0x172787]={'$like':'%'+_0x563862[_0x04c6('0x45')]['filter']+'%'};return _0x4e8d22;})});}_0x2e8631=_[_0x04c6('0x51')]({},_0x2e8631,_0x563862['options']);return db[_0x04c6('0x5f')][_0x04c6('0x53')](_0x2e8631);}})[_0x04c6('0x20')](function(_0x23ce75){if(_0x23ce75){return db[_0x04c6('0x61')][_0x04c6('0x62')]({'where':{'id':_[_0x04c6('0x3e')](_0x23ce75,_0x04c6('0x63')),'role':_0x04c6('0x64')},'attributes':['id','name',_0x04c6('0x65'),_0x04c6('0x66'),'createdAt']});}})[_0x04c6('0x20')](function(_0x5449fb){if(_0x5449fb){return{'count':_0x5449fb[_0x04c6('0x2d')],'rows':_[_0x04c6('0x3e')](_0x5449fb['rows'],function(_0xd01b0d){return{'membername':_0xd01b0d[_0x04c6('0x3b')],'UserId':_0xd01b0d['id'],'queue_name':_0x38d3c6['name'],'ChatQueueId':_0x38d3c6['id'],'interface':util[_0x04c6('0x67')](_0x04c6('0x68'),'SIP',_0xd01b0d[_0x04c6('0x3b')]),'penalty':0x0,'paused':_0xd01b0d[_0x04c6('0x65')],'createdAt':_0xd01b0d['createdAt'],'updatedAt':_0xd01b0d[_0x04c6('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x04c6('0x20')](respondWithFilteredResult(_0x1655af,_0x2e8631))['catch'](handleError(_0x1655af,null));};exports['getTeams']=function(_0x4ea186,_0x37d3e0,_0xeb5847){var _0x126c12={};var _0x463375={};var _0x44e7ac;var _0x4a718e;return db[_0x04c6('0x3f')][_0x04c6('0x69')]({'where':{'id':_0x4ea186[_0x04c6('0x55')]['id']}})[_0x04c6('0x20')](handleEntityNotFound(_0x37d3e0,null))[_0x04c6('0x20')](function(_0x57e90a){if(_0x57e90a){_0x44e7ac=_0x57e90a;_0x463375[_0x04c6('0x42')]=_['keys'](db[_0x04c6('0x6a')]['rawAttributes']);_0x463375[_0x04c6('0x45')]=_['keys'](_0x4ea186['query']);_0x463375[_0x04c6('0x44')]=_['intersection'](_0x463375[_0x04c6('0x42')],_0x463375[_0x04c6('0x45')]);_0x126c12[_0x04c6('0x46')]=_[_0x04c6('0x47')](_0x463375[_0x04c6('0x42')],qs['fields'](_0x4ea186['query'][_0x04c6('0x48')]));_0x126c12[_0x04c6('0x46')]=_0x126c12[_0x04c6('0x46')][_0x04c6('0x49')]?_0x126c12[_0x04c6('0x46')]:_0x463375[_0x04c6('0x42')];_0x126c12['order']=qs[_0x04c6('0x4c')](_0x4ea186['query']['sort']);_0x126c12[_0x04c6('0x4d')]=qs[_0x04c6('0x44')](_[_0x04c6('0x4e')](_0x4ea186[_0x04c6('0x45')],_0x463375[_0x04c6('0x44')]));if(_0x4ea186[_0x04c6('0x45')][_0x04c6('0x4f')]){_0x126c12[_0x04c6('0x4d')]=_[_0x04c6('0x51')](_0x126c12[_0x04c6('0x4d')],{'$or':_[_0x04c6('0x3e')](_0x126c12['attributes'],function(_0xc6e3a6){var _0x5608ce={};_0x5608ce[_0xc6e3a6]={'$like':'%'+_0x4ea186['query'][_0x04c6('0x4f')]+'%'};return _0x5608ce;})});}_0x126c12=_[_0x04c6('0x51')]({},_0x126c12,_0x4ea186[_0x04c6('0x6b')]);return _0x44e7ac[_0x04c6('0x6c')](_0x126c12);}})[_0x04c6('0x20')](function(_0x215eb3){if(_0x215eb3){_0x4a718e=_0x215eb3[_0x04c6('0x49')];if(!_0x4ea186[_0x04c6('0x45')][_0x04c6('0x60')](_0x04c6('0x4a'))){_0x126c12[_0x04c6('0x2f')]=qs['limit'](_0x4ea186['query'][_0x04c6('0x2f')]);_0x126c12[_0x04c6('0x2e')]=qs['offset'](_0x4ea186[_0x04c6('0x45')][_0x04c6('0x2e')]);}return _0x44e7ac['getTeams'](_0x126c12);}})[_0x04c6('0x20')](function(_0xdd49da){if(_0xdd49da){return _0xdd49da?{'count':_0x4a718e,'rows':_0xdd49da}:null;}})[_0x04c6('0x20')](respondWithResult(_0x37d3e0,null))[_0x04c6('0x28')](handleError(_0x37d3e0,null));};exports[_0x04c6('0x6d')]=function(_0x2cee80,_0x21bde2,_0x5efcc8){var _0x592b62=_0x2cee80[_0x04c6('0x5d')]['ids'];return db[_0x04c6('0x6a')][_0x04c6('0x53')]({'where':{'id':_0x592b62},'attributes':['id'],'include':[{'model':db[_0x04c6('0x61')],'as':_0x04c6('0x6e'),'attributes':['id',_0x04c6('0x3b'),_0x04c6('0x6f'),'voicePause',_0x04c6('0x70')],'raw':!![]}]})[_0x04c6('0x20')](function(_0x30705a){if(_0x30705a){var _0x54fe47=_['flatMap'](_0x30705a,function(_0x4f3e2b){var _0xcb5660=_0x4f3e2b[_0x04c6('0x37')]({'plain':!![]});return _0xcb5660['Agents'];});return db[_0x04c6('0x3f')][_0x04c6('0x5c')]({'where':{'id':_0x2cee80[_0x04c6('0x55')]['id']}})['then'](function(_0x343c1f){return db['sequelize'][_0x04c6('0x71')](function(_0x3a1b76){return _0x343c1f[_0x04c6('0x6d')](_0x592b62,{'transaction':_0x3a1b76})['then'](function(){return BPromise['each'](_0x54fe47,function(_0x2e314f){return db[_0x04c6('0x5f')][_0x04c6('0x72')]({'where':{'UserId':_0x2e314f['id'],'ChatQueueId':_0x2cee80[_0x04c6('0x55')]['id']},'transaction':_0x3a1b76});});})['then'](function(){_0x54fe47['forEach'](function(_0x3e12a4){socket[_0x04c6('0x73')](_0x04c6('0x74'),{'UserId':_0x3e12a4['id'],'ChatQueueId':_0x343c1f['id']});});});});});}})['then'](respondWithStatusCode(_0x21bde2,null))[_0x04c6('0x28')](handleError(_0x21bde2,null));};exports[_0x04c6('0x75')]=function(_0x2dd699,_0x3bfef2,_0x49f1e0){return db[_0x04c6('0x6a')][_0x04c6('0x53')]({'where':{'id':_0x2dd699[_0x04c6('0x45')][_0x04c6('0x76')]},'attributes':['id'],'include':[{'model':db[_0x04c6('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x04c6('0x20')](handleEntityNotFound(_0x3bfef2,null))[_0x04c6('0x20')](function(_0x117e5d){var _0x3287db=_[_0x04c6('0x3e')](_0x117e5d,'id');var _0x473c16=[];var _0x32b7b7=[];var _0x4a5853=squel[_0x04c6('0x77')]();_0x4a5853[_0x04c6('0x78')](_0x04c6('0x79'))[_0x04c6('0x7a')](_0x04c6('0x7b'),'tq')[_0x04c6('0x7c')](_0x04c6('0x7d'),'ut',_0x04c6('0x7e'))['where'](_0x04c6('0x7f'),_0x2dd699[_0x04c6('0x55')]['id']);for(var _0x5ce5fa=0x0;_0x5ce5fa<_0x117e5d[_0x04c6('0x49')];_0x5ce5fa+=0x1){let _0xf53e3e=_0x117e5d[_0x5ce5fa];for(var _0x23de34=0x0;_0x23de34<_0xf53e3e[_0x04c6('0x6e')][_0x04c6('0x49')];_0x23de34+=0x1){let _0x5106a1=_0xf53e3e['Agents'][_0x23de34];var _0xa33beb=_0x4a5853[_0x04c6('0x80')]();_0xa33beb[_0x04c6('0x4d')]('ut.UserId\x20=\x20?',_0x5106a1['id']);_0x32b7b7[_0x04c6('0x81')](db[_0x04c6('0x82')]['query'](_0xa33beb['toString'](),{'type':db[_0x04c6('0x82')][_0x04c6('0x83')]['SELECT']})[_0x04c6('0x20')](function(_0x108663){if(_0x108663[_0x04c6('0x49')]===0x1){return _0x5106a1['id'];}else{var _0xbaa7a1=_['every'](_[_0x04c6('0x3e')](_0x108663,_0x04c6('0x84')),function(_0x395aa9){return _[_0x04c6('0x85')](_0x3287db,_0x395aa9);});if(_0xbaa7a1){return _0x5106a1['id'];}}}));}}return BPromise[_0x04c6('0x86')](_0x32b7b7)[_0x04c6('0x20')](function(_0x57278a){_0x473c16=_(_0x473c16)[_0x04c6('0x87')](_0x57278a)[_0x04c6('0x88')]()[_0x04c6('0x89')]();return db[_0x04c6('0x3f')][_0x04c6('0x5c')]({'where':{'id':_0x2dd699[_0x04c6('0x55')]['id']}})[_0x04c6('0x20')](function(_0x2ce89b){return db['sequelize']['transaction'](function(_0x263c2e){return _0x2ce89b[_0x04c6('0x75')](_0x2dd699[_0x04c6('0x45')]['ids'],{'transaction':_0x263c2e})[_0x04c6('0x20')](function(){if(!_[_0x04c6('0x8a')](_0x473c16)){return _0x2ce89b[_0x04c6('0x8b')](_0x473c16,{'transaction':_0x263c2e});}})['then'](function(){_0x473c16['forEach'](function(_0xa28069){socket[_0x04c6('0x73')](_0x04c6('0x8c'),{'UserId':_0xa28069,'ChatQueueId':_0x2ce89b['id']});});});});});});})[_0x04c6('0x20')](respondWithStatusCode(_0x3bfef2,null))[_0x04c6('0x28')](handleError(_0x3bfef2,null));};exports[_0x04c6('0x8d')]=function(_0x5d521b,_0x52417e,_0x596ac3){return db[_0x04c6('0x3f')][_0x04c6('0x5c')]({'where':{'id':_0x5d521b['params']['id']}})[_0x04c6('0x20')](handleEntityNotFound(_0x52417e,null))[_0x04c6('0x20')](function(_0x15a74a){if(_0x15a74a){return _0x15a74a['addAgents'](_0x5d521b[_0x04c6('0x5d')][_0x04c6('0x76')],_[_0x04c6('0x8e')](_0x5d521b[_0x04c6('0x5d')],['ids','id'])||{})['spread'](function(_0x53f914){for(var _0x19f47b=0x0;_0x19f47b<_0x5d521b[_0x04c6('0x5d')]['ids']['length'];_0x19f47b+=0x1){socket['emit'](_0x04c6('0x74'),{'UserId':_0x5d521b['body'][_0x04c6('0x76')][_0x19f47b],'ChatQueueId':_0x5d521b[_0x04c6('0x55')]['id']});}return _0x53f914;});}})[_0x04c6('0x20')](respondWithResult(_0x52417e,null))[_0x04c6('0x28')](handleError(_0x52417e,null));};exports[_0x04c6('0x8b')]=function(_0x410bc2,_0x59a97f,_0xf3cde6){return db[_0x04c6('0x3f')][_0x04c6('0x5c')]({'where':{'id':_0x410bc2[_0x04c6('0x55')]['id']}})[_0x04c6('0x20')](handleEntityNotFound(_0x59a97f,null))['then'](function(_0xe33b5e){if(_0xe33b5e){return _0xe33b5e[_0x04c6('0x8b')](_0x410bc2[_0x04c6('0x45')]['ids'])[_0x04c6('0x20')](function(){if(_[_0x04c6('0x8f')](_0x410bc2[_0x04c6('0x45')]['ids'])){for(var _0x3deaf4=0x0;_0x3deaf4<_0x410bc2[_0x04c6('0x45')][_0x04c6('0x76')][_0x04c6('0x49')];_0x3deaf4+=0x1){socket[_0x04c6('0x73')](_0x04c6('0x8c'),{'UserId':Number(_0x410bc2[_0x04c6('0x45')][_0x04c6('0x76')][_0x3deaf4]),'ChatQueueId':Number(_0x410bc2['params']['id'])});}}else{socket[_0x04c6('0x73')](_0x04c6('0x8c'),{'UserId':Number(_0x410bc2[_0x04c6('0x45')]['ids']),'ChatQueueId':Number(_0x410bc2['params']['id'])});}});}})['then'](respondWithStatusCode(_0x59a97f,null))[_0x04c6('0x28')](handleError(_0x59a97f,null));};exports[_0x04c6('0x90')]=function(_0x243dc8,_0x579168,_0x1d83a3){var _0x767a84={};var _0x2e3fd6={};var _0x3aa0c7;var _0x4dc831;return db[_0x04c6('0x3f')][_0x04c6('0x69')]({'where':{'id':_0x243dc8[_0x04c6('0x55')]['id']}})[_0x04c6('0x20')](handleEntityNotFound(_0x579168,null))['then'](function(_0x1b5b5f){if(_0x1b5b5f){_0x3aa0c7=_0x1b5b5f;_0x2e3fd6['model']=_[_0x04c6('0x43')](db[_0x04c6('0x61')]['rawAttributes']);_0x2e3fd6[_0x04c6('0x45')]=_[_0x04c6('0x43')](_0x243dc8[_0x04c6('0x45')]);_0x2e3fd6['filters']=_[_0x04c6('0x47')](_0x2e3fd6[_0x04c6('0x42')],_0x2e3fd6[_0x04c6('0x45')]);_0x767a84['attributes']=_[_0x04c6('0x47')](_0x2e3fd6[_0x04c6('0x42')],qs['fields'](_0x243dc8['query']['fields']));_0x767a84['attributes']=_0x767a84[_0x04c6('0x46')][_0x04c6('0x49')]?_0x767a84['attributes']:_0x2e3fd6[_0x04c6('0x42')];_0x767a84[_0x04c6('0x4b')]=qs['sort'](_0x243dc8[_0x04c6('0x45')][_0x04c6('0x4c')]);_0x767a84['where']=qs[_0x04c6('0x44')](_[_0x04c6('0x4e')](_0x243dc8[_0x04c6('0x45')],_0x2e3fd6['filters']));if(_0x243dc8['query']['filter']){_0x767a84[_0x04c6('0x4d')]=_[_0x04c6('0x51')](_0x767a84[_0x04c6('0x4d')],{'$or':_['map'](_0x767a84['attributes'],function(_0x55c939){var _0x29e5b4={};_0x29e5b4[_0x55c939]={'$like':'%'+_0x243dc8['query']['filter']+'%'};return _0x29e5b4;})});}_0x767a84=_[_0x04c6('0x51')]({},_0x767a84,_0x243dc8['options']);return _0x3aa0c7[_0x04c6('0x90')](_0x767a84);}})[_0x04c6('0x20')](function(_0x3fecc9){if(_0x3fecc9){_0x4dc831=_0x3fecc9[_0x04c6('0x49')];if(!_0x243dc8[_0x04c6('0x45')]['hasOwnProperty']('nolimit')){_0x767a84[_0x04c6('0x2f')]=qs[_0x04c6('0x2f')](_0x243dc8[_0x04c6('0x45')][_0x04c6('0x2f')]);_0x767a84[_0x04c6('0x2e')]=qs[_0x04c6('0x2e')](_0x243dc8['query']['offset']);}return _0x3aa0c7[_0x04c6('0x90')](_0x767a84);}})[_0x04c6('0x20')](function(_0x50ee3c){if(_0x50ee3c){return _0x50ee3c?{'count':_0x4dc831,'rows':_0x50ee3c}:null;}})[_0x04c6('0x20')](respondWithResult(_0x579168,null))['catch'](handleError(_0x579168,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index f8ecc8d..8107262 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x3c13e7,_0x5c7290){var _0x1f8dc8=function(_0x28a111){while(--_0x28a111){_0x3c13e7['push'](_0x3c13e7['shift']());}};_0x1f8dc8(++_0x5c7290);}(_0xb10b,0x12a));var _0xbb10=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0xb10b[_0x1399d6];return _0x4a9db4;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x410acb,_0x50df4a){var _0x226c2d=function(_0x26b216){while(--_0x26b216){_0x410acb['push'](_0x410acb['shift']());}};_0x226c2d(++_0x50df4a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x379096,_0x2cfe71){_0x379096=_0x379096-0x0;var _0x169733=_0x5f2f[_0x379096];return _0x169733;};'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 diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 22f17ff..fe89b11 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 _0xa5f2=['request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x55291a,_0x814018){var _0x3c870c=function(_0x1fd787){while(--_0x1fd787){_0x55291a['push'](_0x55291a['shift']());}};_0x3c870c(++_0x814018);}(_0xa5f2,0xf6));var _0x2a5f=function(_0x3476b2,_0x3a31ee){_0x3476b2=_0x3476b2-0x0;var _0x208019=_0xa5f2[_0x3476b2];return _0x208019;};'use strict';var _=require(_0x2a5f('0x0'));var util=require(_0x2a5f('0x1'));var logger=require(_0x2a5f('0x2'))(_0x2a5f('0x3'));var moment=require(_0x2a5f('0x4'));var BPromise=require(_0x2a5f('0x5'));var rp=require(_0x2a5f('0x6'));var fs=require('fs');var path=require(_0x2a5f('0x7'));var rimraf=require(_0x2a5f('0x8'));var config=require(_0x2a5f('0x9'));var attributes=require(_0x2a5f('0xa'));module[_0x2a5f('0xb')]=function(_0x412c7e,_0x5621e6){return _0x412c7e[_0x2a5f('0xc')](_0x2a5f('0xd'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfe5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./chatQueue.attributes','exports','ChatQueue'];(function(_0xbd1419,_0x143f1b){var _0xeb64ba=function(_0x3018c1){while(--_0x3018c1){_0xbd1419['push'](_0xbd1419['shift']());}};_0xeb64ba(++_0x143f1b);}(_0xbfe5,0x1ce));var _0x5bfe=function(_0x29b3f9,_0x47e59d){_0x29b3f9=_0x29b3f9-0x0;var _0x3d4bef=_0xbfe5[_0x29b3f9];return _0x3d4bef;};'use strict';var _=require(_0x5bfe('0x0'));var util=require(_0x5bfe('0x1'));var logger=require(_0x5bfe('0x2'))(_0x5bfe('0x3'));var moment=require(_0x5bfe('0x4'));var BPromise=require(_0x5bfe('0x5'));var rp=require(_0x5bfe('0x6'));var fs=require('fs');var path=require(_0x5bfe('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5bfe('0x8'));module[_0x5bfe('0x9')]=function(_0x5efeb6,_0x3ae621){return _0x5efeb6['define'](_0x5bfe('0xa'),attributes,{'tableName':'chat_queues','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 229c779..bf54cfc 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 _0x2da6=['catch','ChatQueue','findAll','options','raw','where','attributes','include','map','model','info','GetChatQueue','stringify','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5451f8,_0x3bc505){var _0xff512f=function(_0x5f3829){while(--_0x5f3829){_0x5451f8['push'](_0x5451f8['shift']());}};_0xff512f(++_0x3bc505);}(_0x2da6,0x1dd));var _0x62da=function(_0x44bb10,_0x10e4cc){_0x44bb10=_0x44bb10-0x0;var _0x30fea8=_0x2da6[_0x44bb10];return _0x30fea8;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});config[_0x62da('0xc')]=_[_0x62da('0xd')](config[_0x62da('0xc')],{'host':_0x62da('0xe'),'port':0x18eb});var socket=require(_0x62da('0xf'))(new Redis(config['redis']));require(_0x62da('0x10'))[_0x62da('0x11')](socket);function respondWithRpcPromise(_0x2a3d7c,_0x1b68f8,_0x4cd5a2){return new BPromise(function(_0x241090,_0x3afe3b){return client[_0x62da('0x12')](_0x2a3d7c,_0x4cd5a2)[_0x62da('0x13')](function(_0x23be32){logger['info'](_0x62da('0x14'),_0x1b68f8,_0x62da('0x15'));logger[_0x62da('0x16')](_0x62da('0x17'),_0x1b68f8,_0x62da('0x15'),JSON['stringify'](_0x23be32));if(_0x23be32['error']){if(_0x23be32[_0x62da('0x18')][_0x62da('0x19')]===0x1f4){logger[_0x62da('0x18')](_0x62da('0x14'),_0x1b68f8,_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);return _0x3afe3b(_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);}logger[_0x62da('0x18')](_0x62da('0x14'),_0x1b68f8,_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);return _0x241090(_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x1b68f8,_0x62da('0x15'));_0x241090(_0x23be32['result'][_0x62da('0x1a')]);}})[_0x62da('0x1b')](function(_0x15b8d0){logger['error'](_0x62da('0x14'),_0x1b68f8,_0x15b8d0);_0x3afe3b(_0x15b8d0);});});}exports['GetChatQueue']=function(_0x2e6b7e){var _0x37c15d=this;return new Promise(function(_0x3b90c8,_0x2f7b01){return db[_0x62da('0x1c')][_0x62da('0x1d')]({'raw':_0x2e6b7e[_0x62da('0x1e')]?_0x2e6b7e[_0x62da('0x1e')][_0x62da('0x1f')]===undefined?!![]:![]:!![],'where':_0x2e6b7e['options']?_0x2e6b7e[_0x62da('0x1e')][_0x62da('0x20')]||null:null,'attributes':_0x2e6b7e[_0x62da('0x1e')]?_0x2e6b7e[_0x62da('0x1e')][_0x62da('0x21')]||null:null,'limit':_0x2e6b7e[_0x62da('0x1e')]?_0x2e6b7e[_0x62da('0x1e')]['limit']||null:null,'include':_0x2e6b7e['options']?_0x2e6b7e['options'][_0x62da('0x22')]?_[_0x62da('0x23')](_0x2e6b7e[_0x62da('0x1e')][_0x62da('0x22')],function(_0x4b1237){return{'model':db[_0x4b1237[_0x62da('0x24')]],'as':_0x4b1237['as'],'attributes':_0x4b1237[_0x62da('0x21')],'include':_0x4b1237['include']?_[_0x62da('0x23')](_0x4b1237[_0x62da('0x22')],function(_0x1775ea){return{'model':db[_0x1775ea['model']],'as':_0x1775ea['as'],'attributes':_0x1775ea[_0x62da('0x21')],'include':_0x1775ea[_0x62da('0x22')]?_[_0x62da('0x23')](_0x1775ea['include'],function(_0x4f5657){return{'model':db[_0x4f5657[_0x62da('0x24')]],'as':_0x4f5657['as'],'attributes':_0x4f5657[_0x62da('0x21')]};}):[]};}):[]};}):[]:[]})[_0x62da('0x13')](function(_0x594c5a){logger[_0x62da('0x25')](_0x62da('0x26'),_0x2e6b7e);logger[_0x62da('0x16')](_0x62da('0x26'),_0x2e6b7e,JSON[_0x62da('0x27')](_0x594c5a));_0x3b90c8(_0x594c5a);})[_0x62da('0x1b')](function(_0x592c6c){logger[_0x62da('0x18')]('GetChatQueue',_0x592c6c[_0x62da('0x1a')],_0x2e6b7e);_0x2f7b01(_0x37c15d[_0x62da('0x18')](0x1f4,_0x592c6c[_0x62da('0x1a')]));});});};exports[_0x62da('0x28')]=function(_0x10dd0d){var _0x1c4749=this;return new Promise(function(_0x5dfc92,_0x204f7b){return db[_0x62da('0x1c')][_0x62da('0x29')]({'raw':_0x10dd0d['options']?_0x10dd0d[_0x62da('0x1e')][_0x62da('0x1f')]===undefined?!![]:![]:!![],'where':_0x10dd0d[_0x62da('0x1e')]?_0x10dd0d['options'][_0x62da('0x20')]||null:null,'attributes':_0x10dd0d[_0x62da('0x1e')]?_0x10dd0d['options'][_0x62da('0x21')]||null:null,'include':_0x10dd0d[_0x62da('0x1e')]?_0x10dd0d['options'][_0x62da('0x22')]?_[_0x62da('0x23')](_0x10dd0d[_0x62da('0x1e')][_0x62da('0x22')],function(_0x557b6a){return{'model':db[_0x557b6a[_0x62da('0x24')]],'as':_0x557b6a['as'],'attributes':_0x557b6a[_0x62da('0x21')],'include':_0x557b6a[_0x62da('0x22')]?_[_0x62da('0x23')](_0x557b6a[_0x62da('0x22')],function(_0x1f6710){return{'model':db[_0x1f6710[_0x62da('0x24')]],'as':_0x1f6710['as'],'attributes':_0x1f6710[_0x62da('0x21')],'include':_0x1f6710[_0x62da('0x22')]?_[_0x62da('0x23')](_0x1f6710[_0x62da('0x22')],function(_0x3c37b6){return{'model':db[_0x3c37b6['model']],'as':_0x3c37b6['as'],'attributes':_0x3c37b6[_0x62da('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x326967){logger[_0x62da('0x25')](_0x62da('0x28'),_0x10dd0d);logger['debug'](_0x62da('0x28'),_0x10dd0d,JSON[_0x62da('0x27')](_0x326967));_0x5dfc92(_0x326967);})[_0x62da('0x1b')](function(_0x2be855){logger['error'](_0x62da('0x28'),_0x2be855[_0x62da('0x1a')],_0x10dd0d);_0x204f7b(_0x1c4749[_0x62da('0x18')](0x1f4,_0x2be855[_0x62da('0x1a')]));});});}; \ No newline at end of file +var _0xea12=['where','attributes','limit','include','map','model','ShowChatQueue','find','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','./chatQueue.socket','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw'];(function(_0x1df3e5,_0x2d37f1){var _0x422d0c=function(_0x51d43f){while(--_0x51d43f){_0x1df3e5['push'](_0x1df3e5['shift']());}};_0x422d0c(++_0x2d37f1);}(_0xea12,0x1c5));var _0x2ea1=function(_0x53800e,_0x1ade43){_0x53800e=_0x53800e-0x0;var _0x449d7a=_0xea12[_0x53800e];return _0x449d7a;};'use strict';var _=require(_0x2ea1('0x0'));var util=require(_0x2ea1('0x1'));var moment=require(_0x2ea1('0x2'));var BPromise=require(_0x2ea1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ea1('0x4'));var db=require(_0x2ea1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ea1('0x6'))(_0x2ea1('0x7'));var config=require(_0x2ea1('0x8'));var jayson=require(_0x2ea1('0x9'));var client=jayson['client'][_0x2ea1('0xa')]({'port':0x232a});config[_0x2ea1('0xb')]=_['defaults'](config[_0x2ea1('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ea1('0xb')]));require(_0x2ea1('0xc'))['register'](socket);function respondWithRpcPromise(_0x168ee3,_0x259d4e,_0x49a9cf){return new BPromise(function(_0x47a441,_0x5efe1d){return client[_0x2ea1('0xd')](_0x168ee3,_0x49a9cf)['then'](function(_0x4fdb2d){logger['info'](_0x2ea1('0xe'),_0x259d4e,_0x2ea1('0xf'));logger[_0x2ea1('0x10')](_0x2ea1('0x11'),_0x259d4e,'request\x20sent',JSON['stringify'](_0x4fdb2d));if(_0x4fdb2d[_0x2ea1('0x12')]){if(_0x4fdb2d[_0x2ea1('0x12')][_0x2ea1('0x13')]===0x1f4){logger[_0x2ea1('0x12')]('ChatQueue,\x20%s,\x20%s',_0x259d4e,_0x4fdb2d['error'][_0x2ea1('0x14')]);return _0x5efe1d(_0x4fdb2d[_0x2ea1('0x12')][_0x2ea1('0x14')]);}logger[_0x2ea1('0x12')](_0x2ea1('0xe'),_0x259d4e,_0x4fdb2d[_0x2ea1('0x12')][_0x2ea1('0x14')]);return _0x47a441(_0x4fdb2d[_0x2ea1('0x12')][_0x2ea1('0x14')]);}else{logger['info'](_0x2ea1('0xe'),_0x259d4e,'request\x20sent');_0x47a441(_0x4fdb2d[_0x2ea1('0x15')][_0x2ea1('0x14')]);}})[_0x2ea1('0x16')](function(_0x449d4d){logger[_0x2ea1('0x12')](_0x2ea1('0xe'),_0x259d4e,_0x449d4d);_0x5efe1d(_0x449d4d);});});}exports[_0x2ea1('0x17')]=function(_0x2ebb49){var _0x31fafe=this;return new Promise(function(_0x2bc20c,_0x59c1eb){return db[_0x2ea1('0x18')][_0x2ea1('0x19')]({'raw':_0x2ebb49[_0x2ea1('0x1a')]?_0x2ebb49['options'][_0x2ea1('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ebb49[_0x2ea1('0x1a')]?_0x2ebb49[_0x2ea1('0x1a')][_0x2ea1('0x1c')]||null:null,'attributes':_0x2ebb49[_0x2ea1('0x1a')]?_0x2ebb49[_0x2ea1('0x1a')][_0x2ea1('0x1d')]||null:null,'limit':_0x2ebb49[_0x2ea1('0x1a')]?_0x2ebb49['options'][_0x2ea1('0x1e')]||null:null,'include':_0x2ebb49[_0x2ea1('0x1a')]?_0x2ebb49[_0x2ea1('0x1a')][_0x2ea1('0x1f')]?_[_0x2ea1('0x20')](_0x2ebb49[_0x2ea1('0x1a')][_0x2ea1('0x1f')],function(_0x514182){return{'model':db[_0x514182[_0x2ea1('0x21')]],'as':_0x514182['as'],'attributes':_0x514182[_0x2ea1('0x1d')],'include':_0x514182[_0x2ea1('0x1f')]?_[_0x2ea1('0x20')](_0x514182['include'],function(_0x79fa04){return{'model':db[_0x79fa04[_0x2ea1('0x21')]],'as':_0x79fa04['as'],'attributes':_0x79fa04['attributes'],'include':_0x79fa04[_0x2ea1('0x1f')]?_[_0x2ea1('0x20')](_0x79fa04[_0x2ea1('0x1f')],function(_0x518faa){return{'model':db[_0x518faa[_0x2ea1('0x21')]],'as':_0x518faa['as'],'attributes':_0x518faa[_0x2ea1('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28470f){logger['info'](_0x2ea1('0x17'),_0x2ebb49);logger[_0x2ea1('0x10')](_0x2ea1('0x17'),_0x2ebb49,JSON['stringify'](_0x28470f));_0x2bc20c(_0x28470f);})[_0x2ea1('0x16')](function(_0x49b4f9){logger[_0x2ea1('0x12')](_0x2ea1('0x17'),_0x49b4f9[_0x2ea1('0x14')],_0x2ebb49);_0x59c1eb(_0x31fafe[_0x2ea1('0x12')](0x1f4,_0x49b4f9[_0x2ea1('0x14')]));});});};exports[_0x2ea1('0x22')]=function(_0x15d434){var _0x4d8ade=this;return new Promise(function(_0x75100a,_0x7c725d){return db[_0x2ea1('0x18')][_0x2ea1('0x23')]({'raw':_0x15d434[_0x2ea1('0x1a')]?_0x15d434[_0x2ea1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x15d434['options']?_0x15d434[_0x2ea1('0x1a')]['where']||null:null,'attributes':_0x15d434[_0x2ea1('0x1a')]?_0x15d434[_0x2ea1('0x1a')][_0x2ea1('0x1d')]||null:null,'include':_0x15d434['options']?_0x15d434[_0x2ea1('0x1a')]['include']?_[_0x2ea1('0x20')](_0x15d434['options']['include'],function(_0x5d9c75){return{'model':db[_0x5d9c75['model']],'as':_0x5d9c75['as'],'attributes':_0x5d9c75[_0x2ea1('0x1d')],'include':_0x5d9c75['include']?_[_0x2ea1('0x20')](_0x5d9c75[_0x2ea1('0x1f')],function(_0x5091f3){return{'model':db[_0x5091f3[_0x2ea1('0x21')]],'as':_0x5091f3['as'],'attributes':_0x5091f3[_0x2ea1('0x1d')],'include':_0x5091f3[_0x2ea1('0x1f')]?_['map'](_0x5091f3[_0x2ea1('0x1f')],function(_0x5ce2d1){return{'model':db[_0x5ce2d1[_0x2ea1('0x21')]],'as':_0x5ce2d1['as'],'attributes':_0x5ce2d1['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ea1('0x24')](function(_0x149115){logger['info'](_0x2ea1('0x22'),_0x15d434);logger['debug']('ShowChatQueue',_0x15d434,JSON['stringify'](_0x149115));_0x75100a(_0x149115);})[_0x2ea1('0x16')](function(_0x457948){logger[_0x2ea1('0x12')](_0x2ea1('0x22'),_0x457948['message'],_0x15d434);_0x7c725d(_0x4d8ade[_0x2ea1('0x12')](0x1f4,_0x457948[_0x2ea1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 0e95b80..d2360c4 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(_0x161f03,_0x5d141b){var _0x2f396f=function(_0x2c1b7a){while(--_0x2c1b7a){_0x161f03['push'](_0x161f03['shift']());}};_0x2f396f(++_0x5d141b);}(_0xb10b,0x12a));var _0xbb10=function(_0x499c7f,_0x2d8184){_0x499c7f=_0x499c7f-0x0;var _0x433bee=_0xb10b[_0x499c7f];return _0x433bee;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x5f2f,0x73));var _0xf5f2=function(_0x131d31,_0x36051f){_0x131d31=_0x131d31-0x0;var _0x55e281=_0x5f2f[_0x131d31];return _0x55e281;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 291a06a..be4924e 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 _0x2669=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x1eb164,_0x392952){var _0x326aa9=function(_0x440cd3){while(--_0x440cd3){_0x1eb164['push'](_0x1eb164['shift']());}};_0x326aa9(++_0x392952);}(_0x2669,0x1df));var _0x9266=function(_0xae7bc4,_0x355383){_0xae7bc4=_0xae7bc4-0x0;var _0x2155cb=_0x2669[_0xae7bc4];return _0x2155cb;};'use strict';var multer=require(_0x9266('0x0'));var util=require(_0x9266('0x1'));var path=require(_0x9266('0x2'));var timeout=require(_0x9266('0x3'));var express=require('express');var router=express[_0x9266('0x4')]();var auth=require(_0x9266('0x5'));var interaction=require(_0x9266('0x6'));var config=require(_0x9266('0x7'));var controller=require(_0x9266('0x8'));router[_0x9266('0x9')]('/',auth['isAuthenticated'](),controller[_0x9266('0xa')]);router[_0x9266('0x9')]('/describe',auth[_0x9266('0xb')](),controller[_0x9266('0xc')]);router[_0x9266('0x9')](_0x9266('0xd'),auth[_0x9266('0xb')](),controller['show']);router[_0x9266('0x9')](_0x9266('0xe'),auth[_0x9266('0xb')](),controller[_0x9266('0xf')]);router['get'](_0x9266('0x10'),auth[_0x9266('0xb')](),controller[_0x9266('0x11')]);router[_0x9266('0x9')](_0x9266('0x12'),auth[_0x9266('0xb')](),controller['getAgents']);router[_0x9266('0x13')]('/',auth[_0x9266('0xb')](),controller[_0x9266('0x14')]);router['post'](_0x9266('0x10'),auth[_0x9266('0xb')](),controller[_0x9266('0x15')]);router[_0x9266('0x13')](_0x9266('0x12'),auth['isAuthenticated'](),controller[_0x9266('0x16')]);router[_0x9266('0x17')](_0x9266('0xd'),auth[_0x9266('0xb')](),controller['update']);router[_0x9266('0x18')](_0x9266('0xd'),auth[_0x9266('0xb')](),controller[_0x9266('0x19')]);router['delete']('/:id/teams',auth[_0x9266('0xb')](),controller[_0x9266('0x1a')]);router[_0x9266('0x18')](_0x9266('0x12'),auth[_0x9266('0xb')](),controller[_0x9266('0x1b')]);module[_0x9266('0x1c')]=router; \ No newline at end of file +var _0x119a=['removeAgents','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x119a,0x1b4));var _0xa119=function(_0x5c89bf,_0x573a77){_0x5c89bf=_0x5c89bf-0x0;var _0x387dd9=_0x119a[_0x5c89bf];return _0x387dd9;};'use strict';var multer=require(_0xa119('0x0'));var util=require(_0xa119('0x1'));var path=require('path');var timeout=require(_0xa119('0x2'));var express=require('express');var router=express[_0xa119('0x3')]();var auth=require(_0xa119('0x4'));var interaction=require(_0xa119('0x5'));var config=require('../../config/environment');var controller=require(_0xa119('0x6'));router['get']('/',auth[_0xa119('0x7')](),controller[_0xa119('0x8')]);router[_0xa119('0x9')](_0xa119('0xa'),auth['isAuthenticated'](),controller[_0xa119('0xb')]);router[_0xa119('0x9')]('/:id',auth[_0xa119('0x7')](),controller[_0xa119('0xc')]);router[_0xa119('0x9')](_0xa119('0xd'),auth[_0xa119('0x7')](),controller[_0xa119('0xe')]);router[_0xa119('0x9')]('/:id/teams',auth[_0xa119('0x7')](),controller[_0xa119('0xf')]);router[_0xa119('0x9')](_0xa119('0x10'),auth[_0xa119('0x7')](),controller[_0xa119('0x11')]);router[_0xa119('0x12')]('/',auth['isAuthenticated'](),controller[_0xa119('0x13')]);router[_0xa119('0x12')](_0xa119('0x14'),auth['isAuthenticated'](),controller[_0xa119('0x15')]);router['post'](_0xa119('0x10'),auth[_0xa119('0x7')](),controller[_0xa119('0x16')]);router[_0xa119('0x17')](_0xa119('0x18'),auth['isAuthenticated'](),controller[_0xa119('0x19')]);router[_0xa119('0x1a')]('/:id',auth[_0xa119('0x7')](),controller[_0xa119('0x1b')]);router[_0xa119('0x1a')](_0xa119('0x14'),auth[_0xa119('0x7')](),controller[_0xa119('0x1c')]);router[_0xa119('0x1a')](_0xa119('0x10'),auth[_0xa119('0x7')](),controller[_0xa119('0x1d')]);module[_0xa119('0x1e')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index fbee766..3c726bf 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 _0xb45d=['exports','STRING','DATE','moment','sequelize'];(function(_0x5adf4d,_0xdfd7ef){var _0x17b2db=function(_0x5a9a2f){while(--_0x5a9a2f){_0x5adf4d['push'](_0x5adf4d['shift']());}};_0x17b2db(++_0xdfd7ef);}(_0xb45d,0x85));var _0xdb45=function(_0x239b31,_0x44a64d){_0x239b31=_0x239b31-0x0;var _0x41c8be=_0xb45d[_0x239b31];return _0x41c8be;};'use strict';var moment=require(_0xdb45('0x0'));var Sequelize=require(_0xdb45('0x1'));module[_0xdb45('0x2')]={'uniqueid':{'type':Sequelize[_0xdb45('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xdb45('0x3')]},'joinAt':{'type':Sequelize[_0xdb45('0x4')]},'leaveAt':{'type':Sequelize[_0xdb45('0x4')]},'acceptAt':{'type':Sequelize[_0xdb45('0x4')]},'exitAt':{'type':Sequelize[_0xdb45('0x4')]},'reason':{'type':Sequelize[_0xdb45('0x3')]}}; \ No newline at end of file +var _0xaa03=['moment','exports','STRING','DATE'];(function(_0x13b543,_0x422be8){var _0x16ad49=function(_0x1707e8){while(--_0x1707e8){_0x13b543['push'](_0x13b543['shift']());}};_0x16ad49(++_0x422be8);}(_0xaa03,0x64));var _0x3aa0=function(_0x470a7c,_0x501572){_0x470a7c=_0x470a7c-0x0;var _0x133ce7=_0xaa03[_0x470a7c];return _0x133ce7;};'use strict';var moment=require(_0x3aa0('0x0'));var Sequelize=require('sequelize');module[_0x3aa0('0x1')]={'uniqueid':{'type':Sequelize[_0x3aa0('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3aa0('0x2')]},'joinAt':{'type':Sequelize[_0x3aa0('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3aa0('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x3aa0('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 3c67adf..2c35199 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 _0x9247=['options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','map','ChatQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','rawAttributes'];(function(_0x1b117c,_0x447884){var _0x3acfb2=function(_0x26338a){while(--_0x26338a){_0x1b117c['push'](_0x1b117c['shift']());}};_0x3acfb2(++_0x447884);}(_0x9247,0x1cd));var _0x7924=function(_0x322522,_0x4db288){_0x322522=_0x322522-0x0;var _0x293bcf=_0x9247[_0x322522];return _0x293bcf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7924('0x0'));var rimraf=require(_0x7924('0x1'));var zipdir=require(_0x7924('0x2'));var jsonpatch=require(_0x7924('0x3'));var rp=require(_0x7924('0x4'));var moment=require(_0x7924('0x5'));var BPromise=require(_0x7924('0x6'));var Mustache=require(_0x7924('0x7'));var util=require(_0x7924('0x8'));var path=require(_0x7924('0x9'));var sox=require(_0x7924('0xa'));var csv=require(_0x7924('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7924('0xc'));var crypto=require(_0x7924('0xd'));var jsforce=require(_0x7924('0xe'));var deskjs=require(_0x7924('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7924('0x10'));var Papa=require(_0x7924('0x11'));var Redis=require(_0x7924('0x12'));var authService=require(_0x7924('0x13'));var qs=require(_0x7924('0x14'));var as=require(_0x7924('0x15'));var hardwareService=require(_0x7924('0x16'));var logger=require(_0x7924('0x17'))('api');var utils=require(_0x7924('0x18'));var config=require(_0x7924('0x19'));var db=require(_0x7924('0x1a'))['db'];function respondWithStatusCode(_0x1175c1,_0x47409d){_0x47409d=_0x47409d||0xcc;return function(_0x5998c6){if(_0x5998c6){return _0x1175c1[_0x7924('0x1b')](_0x47409d);}return _0x1175c1[_0x7924('0x1c')](_0x47409d)[_0x7924('0x1d')]();};}function respondWithResult(_0x42cd84,_0x2f5b98){_0x2f5b98=_0x2f5b98||0xc8;return function(_0x2f6ea5){if(_0x2f6ea5){return _0x42cd84[_0x7924('0x1c')](_0x2f5b98)['json'](_0x2f6ea5);}};}function respondWithFilteredResult(_0xb70690,_0x2e4eb0){return function(_0x5a8127){if(_0x5a8127){var _0x65b936=_0x5a8127[_0x7924('0x1e')],_0x469396=_0x2e4eb0['offset'],_0x2cef8d=_0x2e4eb0[_0x7924('0x1f')]+_0x2e4eb0[_0x7924('0x20')],_0x379182;if(_0x2cef8d>=_0x65b936){_0x2cef8d=_0x65b936;_0x379182=0xc8;}else{_0x379182=0xce;}_0xb70690[_0x7924('0x1c')](_0x379182);return _0xb70690[_0x7924('0x21')](_0x7924('0x22'),_0x469396+'-'+_0x2cef8d+'/'+_0x65b936)[_0x7924('0x23')](_0x5a8127);}return null;};}function patchUpdates(_0x1277c0){return function(_0x244d91){try{jsonpatch[_0x7924('0x24')](_0x244d91,_0x1277c0,!![]);}catch(_0x330ebe){return BPromise[_0x7924('0x25')](_0x330ebe);}return _0x244d91[_0x7924('0x26')]();};}function saveUpdates(_0x1438f2,_0x4d8be2){return function(_0x464fee){if(_0x464fee){return _0x464fee[_0x7924('0x27')](_0x1438f2)[_0x7924('0x28')](function(_0x4aac26){return _0x4aac26;});}return null;};}function removeEntity(_0x2e3de8,_0x2bf118){return function(_0x1c7fb6){if(_0x1c7fb6){return _0x1c7fb6[_0x7924('0x29')]()[_0x7924('0x28')](function(){_0x2e3de8['status'](0xcc)[_0x7924('0x1d')]();});}};}function handleEntityNotFound(_0x291df2,_0x132e11){return function(_0xebb632){if(!_0xebb632){_0x291df2[_0x7924('0x1b')](0x194);}return _0xebb632;};}function handleError(_0x5b16dd,_0x1d6525){_0x1d6525=_0x1d6525||0x1f4;return function(_0x13f10e){logger['error'](_0x13f10e['stack']);if(_0x13f10e[_0x7924('0x2a')]){delete _0x13f10e[_0x7924('0x2a')];}_0x5b16dd[_0x7924('0x1c')](_0x1d6525)[_0x7924('0x2b')](_0x13f10e);};}exports[_0x7924('0x2c')]=function(_0x1c88c8,_0x1c16b3){var _0x3ad7d0={},_0x44d332={},_0x334954={'count':0x0,'rows':[]};var _0x48b74d=_[_0x7924('0x2d')](db[_0x7924('0x2e')]['rawAttributes'],function(_0x5ba814){return{'name':_0x5ba814[_0x7924('0x2f')],'type':_0x5ba814[_0x7924('0x30')][_0x7924('0x31')]};});_0x44d332[_0x7924('0x32')]=_[_0x7924('0x2d')](_0x48b74d,_0x7924('0x2a'));_0x44d332[_0x7924('0x33')]=_[_0x7924('0x34')](_0x1c88c8['query']);_0x44d332[_0x7924('0x35')]=_[_0x7924('0x36')](_0x44d332[_0x7924('0x32')],_0x44d332[_0x7924('0x33')]);_0x3ad7d0[_0x7924('0x37')]=_[_0x7924('0x36')](_0x44d332[_0x7924('0x32')],qs[_0x7924('0x38')](_0x1c88c8['query'][_0x7924('0x38')]));_0x3ad7d0['attributes']=_0x3ad7d0[_0x7924('0x37')]['length']?_0x3ad7d0[_0x7924('0x37')]:_0x44d332[_0x7924('0x32')];if(!_0x1c88c8['query'][_0x7924('0x39')](_0x7924('0x3a'))){_0x3ad7d0['limit']=qs[_0x7924('0x20')](_0x1c88c8[_0x7924('0x33')]['limit']);_0x3ad7d0['offset']=qs[_0x7924('0x1f')](_0x1c88c8[_0x7924('0x33')]['offset']);}_0x3ad7d0['order']=qs[_0x7924('0x3b')](_0x1c88c8[_0x7924('0x33')][_0x7924('0x3b')]);_0x3ad7d0[_0x7924('0x3c')]=qs[_0x7924('0x35')](_[_0x7924('0x3d')](_0x1c88c8[_0x7924('0x33')],_0x44d332[_0x7924('0x35')]));if(_0x1c88c8[_0x7924('0x33')][_0x7924('0x3e')]){_0x3ad7d0[_0x7924('0x3c')]=_[_0x7924('0x3f')](_0x3ad7d0[_0x7924('0x3c')],{'$or':_[_0x7924('0x2d')](_0x48b74d,function(_0x4804ed){if(_0x4804ed['type']!==_0x7924('0x40')){var _0x155332={};_0x155332[_0x4804ed[_0x7924('0x2a')]]={'$like':'%'+_0x1c88c8[_0x7924('0x33')][_0x7924('0x3e')]+'%'};return _0x155332;}})});}_0x3ad7d0=_['merge']({},_0x3ad7d0,_0x1c88c8['options']);var _0x35f1e2={'where':_0x3ad7d0[_0x7924('0x3c')]};return db[_0x7924('0x2e')][_0x7924('0x1e')](_0x35f1e2)[_0x7924('0x28')](function(_0x5c272f){_0x334954['count']=_0x5c272f;if(_0x1c88c8['query'][_0x7924('0x41')]){_0x3ad7d0[_0x7924('0x42')]=[{'all':!![]}];}return db[_0x7924('0x2e')]['findAll'](_0x3ad7d0);})[_0x7924('0x28')](function(_0x47ee08){_0x334954['rows']=_0x47ee08;return _0x334954;})[_0x7924('0x28')](respondWithFilteredResult(_0x1c16b3,_0x3ad7d0))[_0x7924('0x43')](handleError(_0x1c16b3,null));};exports[_0x7924('0x44')]=function(_0x348490,_0x33b769){var _0x4a7a86={'raw':!![],'where':{'id':_0x348490[_0x7924('0x45')]['id']}},_0x8e023d={};_0x8e023d[_0x7924('0x32')]=_[_0x7924('0x34')](db[_0x7924('0x2e')][_0x7924('0x46')]);_0x8e023d[_0x7924('0x33')]=_['keys'](_0x348490[_0x7924('0x33')]);_0x8e023d[_0x7924('0x35')]=_[_0x7924('0x36')](_0x8e023d[_0x7924('0x32')],_0x8e023d[_0x7924('0x33')]);_0x4a7a86[_0x7924('0x37')]=_['intersection'](_0x8e023d['model'],qs[_0x7924('0x38')](_0x348490[_0x7924('0x33')]['fields']));_0x4a7a86[_0x7924('0x37')]=_0x4a7a86[_0x7924('0x37')]['length']?_0x4a7a86['attributes']:_0x8e023d['model'];if(_0x348490['query'][_0x7924('0x41')]){_0x4a7a86[_0x7924('0x42')]=[{'all':!![]}];}_0x4a7a86=_[_0x7924('0x3f')]({},_0x4a7a86,_0x348490[_0x7924('0x47')]);return db[_0x7924('0x2e')][_0x7924('0x48')](_0x4a7a86)[_0x7924('0x28')](handleEntityNotFound(_0x33b769,null))[_0x7924('0x28')](respondWithResult(_0x33b769,null))[_0x7924('0x43')](handleError(_0x33b769,null));};exports[_0x7924('0x49')]=function(_0x5505ea,_0x2368c0){return db[_0x7924('0x2e')][_0x7924('0x49')](_0x5505ea[_0x7924('0x4a')],{})[_0x7924('0x28')](respondWithResult(_0x2368c0,0xc9))[_0x7924('0x43')](handleError(_0x2368c0,null));};exports[_0x7924('0x27')]=function(_0x40cdb1,_0xba72a9){if(_0x40cdb1['body']['id']){delete _0x40cdb1[_0x7924('0x4a')]['id'];}return db[_0x7924('0x2e')][_0x7924('0x48')]({'where':{'id':_0x40cdb1['params']['id']}})[_0x7924('0x28')](handleEntityNotFound(_0xba72a9,null))[_0x7924('0x28')](saveUpdates(_0x40cdb1[_0x7924('0x4a')],null))[_0x7924('0x28')](respondWithResult(_0xba72a9,null))[_0x7924('0x43')](handleError(_0xba72a9,null));};exports[_0x7924('0x29')]=function(_0x4657ce,_0x4509bc){return db[_0x7924('0x2e')][_0x7924('0x48')]({'where':{'id':_0x4657ce['params']['id']}})[_0x7924('0x28')](handleEntityNotFound(_0x4509bc,null))[_0x7924('0x28')](removeEntity(_0x4509bc,null))['catch'](handleError(_0x4509bc,null));};exports[_0x7924('0x4b')]=function(_0xbe30e8,_0x51e7a2){return db[_0x7924('0x2e')]['describe']()[_0x7924('0x28')](respondWithResult(_0x51e7a2,null))[_0x7924('0x43')](handleError(_0x51e7a2,null));}; \ No newline at end of file +var _0x09ec=['status','json','offset','Content-Range','apply','save','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','ChatQueueReport','count','includeAll','rows','catch','params','include','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus'];(function(_0x4d254f,_0x4eb1a0){var _0x17133a=function(_0x2cff87){while(--_0x2cff87){_0x4d254f['push'](_0x4d254f['shift']());}};_0x17133a(++_0x4eb1a0);}(_0x09ec,0xba));var _0xc09e=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x09ec[_0x16d10f];return _0x50c823;};'use strict';var pdf=require(_0xc09e('0x0'));var emlformat=require(_0xc09e('0x1'));var rimraf=require(_0xc09e('0x2'));var zipdir=require(_0xc09e('0x3'));var jsonpatch=require(_0xc09e('0x4'));var rp=require(_0xc09e('0x5'));var moment=require(_0xc09e('0x6'));var BPromise=require(_0xc09e('0x7'));var Mustache=require(_0xc09e('0x8'));var util=require(_0xc09e('0x9'));var path=require(_0xc09e('0xa'));var sox=require('sox');var csv=require(_0xc09e('0xb'));var ejs=require(_0xc09e('0xc'));var fs=require('fs');var _=require(_0xc09e('0xd'));var squel=require(_0xc09e('0xe'));var crypto=require('crypto');var jsforce=require(_0xc09e('0xf'));var deskjs=require(_0xc09e('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc09e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc09e('0x12'));var as=require(_0xc09e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc09e('0x14'))('api');var utils=require(_0xc09e('0x15'));var config=require('../../config/environment');var db=require(_0xc09e('0x16'))['db'];function respondWithStatusCode(_0x3cb0ec,_0x455b3d){_0x455b3d=_0x455b3d||0xcc;return function(_0x574ef1){if(_0x574ef1){return _0x3cb0ec[_0xc09e('0x17')](_0x455b3d);}return _0x3cb0ec[_0xc09e('0x18')](_0x455b3d)['end']();};}function respondWithResult(_0x40cefd,_0x17ddfc){_0x17ddfc=_0x17ddfc||0xc8;return function(_0x4ea277){if(_0x4ea277){return _0x40cefd[_0xc09e('0x18')](_0x17ddfc)[_0xc09e('0x19')](_0x4ea277);}};}function respondWithFilteredResult(_0x5c5347,_0xe28b27){return function(_0x93c249){if(_0x93c249){var _0x42a6ac=_0x93c249['count'],_0x1433ed=_0xe28b27[_0xc09e('0x1a')],_0x2de349=_0xe28b27['offset']+_0xe28b27['limit'],_0x856fb7;if(_0x2de349>=_0x42a6ac){_0x2de349=_0x42a6ac;_0x856fb7=0xc8;}else{_0x856fb7=0xce;}_0x5c5347[_0xc09e('0x18')](_0x856fb7);return _0x5c5347['set'](_0xc09e('0x1b'),_0x1433ed+'-'+_0x2de349+'/'+_0x42a6ac)['json'](_0x93c249);}return null;};}function patchUpdates(_0x3f5792){return function(_0x17f550){try{jsonpatch[_0xc09e('0x1c')](_0x17f550,_0x3f5792,!![]);}catch(_0x44c6c0){return BPromise['reject'](_0x44c6c0);}return _0x17f550[_0xc09e('0x1d')]();};}function saveUpdates(_0x2e171a,_0x5649a1){return function(_0x1325a3){if(_0x1325a3){return _0x1325a3['update'](_0x2e171a)[_0xc09e('0x1e')](function(_0x48ed42){return _0x48ed42;});}return null;};}function removeEntity(_0x3f88c5,_0x450fff){return function(_0x2c90f0){if(_0x2c90f0){return _0x2c90f0['destroy']()[_0xc09e('0x1e')](function(){_0x3f88c5[_0xc09e('0x18')](0xcc)[_0xc09e('0x1f')]();});}};}function handleEntityNotFound(_0x24082a,_0xce610a){return function(_0x55c5c0){if(!_0x55c5c0){_0x24082a[_0xc09e('0x17')](0x194);}return _0x55c5c0;};}function handleError(_0x592a1a,_0x2b1b5e){_0x2b1b5e=_0x2b1b5e||0x1f4;return function(_0x54c382){logger[_0xc09e('0x20')](_0x54c382[_0xc09e('0x21')]);if(_0x54c382[_0xc09e('0x22')]){delete _0x54c382[_0xc09e('0x22')];}_0x592a1a[_0xc09e('0x18')](_0x2b1b5e)[_0xc09e('0x23')](_0x54c382);};}exports[_0xc09e('0x24')]=function(_0x41cc2e,_0x1af9fb){var _0x2ded27={},_0xa2ed4a={},_0x43c5a4={'count':0x0,'rows':[]};var _0x3fb241=_[_0xc09e('0x25')](db['ChatQueueReport'][_0xc09e('0x26')],function(_0x42078b){return{'name':_0x42078b[_0xc09e('0x27')],'type':_0x42078b['type'][_0xc09e('0x28')]};});_0xa2ed4a[_0xc09e('0x29')]=_['map'](_0x3fb241,'name');_0xa2ed4a[_0xc09e('0x2a')]=_[_0xc09e('0x2b')](_0x41cc2e[_0xc09e('0x2a')]);_0xa2ed4a[_0xc09e('0x2c')]=_[_0xc09e('0x2d')](_0xa2ed4a[_0xc09e('0x29')],_0xa2ed4a['query']);_0x2ded27[_0xc09e('0x2e')]=_[_0xc09e('0x2d')](_0xa2ed4a[_0xc09e('0x29')],qs[_0xc09e('0x2f')](_0x41cc2e['query'][_0xc09e('0x2f')]));_0x2ded27[_0xc09e('0x2e')]=_0x2ded27[_0xc09e('0x2e')][_0xc09e('0x30')]?_0x2ded27[_0xc09e('0x2e')]:_0xa2ed4a[_0xc09e('0x29')];if(!_0x41cc2e['query'][_0xc09e('0x31')]('nolimit')){_0x2ded27['limit']=qs[_0xc09e('0x32')](_0x41cc2e[_0xc09e('0x2a')][_0xc09e('0x32')]);_0x2ded27[_0xc09e('0x1a')]=qs[_0xc09e('0x1a')](_0x41cc2e[_0xc09e('0x2a')][_0xc09e('0x1a')]);}_0x2ded27[_0xc09e('0x33')]=qs['sort'](_0x41cc2e[_0xc09e('0x2a')][_0xc09e('0x34')]);_0x2ded27[_0xc09e('0x35')]=qs[_0xc09e('0x2c')](_[_0xc09e('0x36')](_0x41cc2e[_0xc09e('0x2a')],_0xa2ed4a[_0xc09e('0x2c')]));if(_0x41cc2e[_0xc09e('0x2a')][_0xc09e('0x37')]){_0x2ded27[_0xc09e('0x35')]=_[_0xc09e('0x38')](_0x2ded27['where'],{'$or':_[_0xc09e('0x25')](_0x3fb241,function(_0x484e16){if(_0x484e16['type']!=='VIRTUAL'){var _0x559122={};_0x559122[_0x484e16['name']]={'$like':'%'+_0x41cc2e[_0xc09e('0x2a')]['filter']+'%'};return _0x559122;}})});}_0x2ded27=_[_0xc09e('0x38')]({},_0x2ded27,_0x41cc2e[_0xc09e('0x39')]);var _0xf57d30={'where':_0x2ded27['where']};return db[_0xc09e('0x3a')][_0xc09e('0x3b')](_0xf57d30)[_0xc09e('0x1e')](function(_0x91643b){_0x43c5a4[_0xc09e('0x3b')]=_0x91643b;if(_0x41cc2e[_0xc09e('0x2a')][_0xc09e('0x3c')]){_0x2ded27['include']=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x2ded27);})[_0xc09e('0x1e')](function(_0x4811e7){_0x43c5a4[_0xc09e('0x3d')]=_0x4811e7;return _0x43c5a4;})['then'](respondWithFilteredResult(_0x1af9fb,_0x2ded27))[_0xc09e('0x3e')](handleError(_0x1af9fb,null));};exports['show']=function(_0x2c3198,_0x332568){var _0x2ef097={'raw':!![],'where':{'id':_0x2c3198[_0xc09e('0x3f')]['id']}},_0x2bac96={};_0x2bac96[_0xc09e('0x29')]=_[_0xc09e('0x2b')](db[_0xc09e('0x3a')][_0xc09e('0x26')]);_0x2bac96[_0xc09e('0x2a')]=_[_0xc09e('0x2b')](_0x2c3198[_0xc09e('0x2a')]);_0x2bac96[_0xc09e('0x2c')]=_[_0xc09e('0x2d')](_0x2bac96[_0xc09e('0x29')],_0x2bac96[_0xc09e('0x2a')]);_0x2ef097[_0xc09e('0x2e')]=_[_0xc09e('0x2d')](_0x2bac96[_0xc09e('0x29')],qs['fields'](_0x2c3198[_0xc09e('0x2a')][_0xc09e('0x2f')]));_0x2ef097[_0xc09e('0x2e')]=_0x2ef097['attributes'][_0xc09e('0x30')]?_0x2ef097[_0xc09e('0x2e')]:_0x2bac96[_0xc09e('0x29')];if(_0x2c3198[_0xc09e('0x2a')][_0xc09e('0x3c')]){_0x2ef097[_0xc09e('0x40')]=[{'all':!![]}];}_0x2ef097=_[_0xc09e('0x38')]({},_0x2ef097,_0x2c3198[_0xc09e('0x39')]);return db[_0xc09e('0x3a')][_0xc09e('0x41')](_0x2ef097)[_0xc09e('0x1e')](handleEntityNotFound(_0x332568,null))['then'](respondWithResult(_0x332568,null))['catch'](handleError(_0x332568,null));};exports[_0xc09e('0x42')]=function(_0x556003,_0x3a1ec6){return db[_0xc09e('0x3a')][_0xc09e('0x42')](_0x556003[_0xc09e('0x43')],{})[_0xc09e('0x1e')](respondWithResult(_0x3a1ec6,0xc9))[_0xc09e('0x3e')](handleError(_0x3a1ec6,null));};exports['update']=function(_0x4e4a8a,_0x3ae4a7){if(_0x4e4a8a[_0xc09e('0x43')]['id']){delete _0x4e4a8a[_0xc09e('0x43')]['id'];}return db[_0xc09e('0x3a')][_0xc09e('0x41')]({'where':{'id':_0x4e4a8a[_0xc09e('0x3f')]['id']}})[_0xc09e('0x1e')](handleEntityNotFound(_0x3ae4a7,null))[_0xc09e('0x1e')](saveUpdates(_0x4e4a8a[_0xc09e('0x43')],null))[_0xc09e('0x1e')](respondWithResult(_0x3ae4a7,null))[_0xc09e('0x3e')](handleError(_0x3ae4a7,null));};exports[_0xc09e('0x44')]=function(_0x55e358,_0x1b7462){return db[_0xc09e('0x3a')][_0xc09e('0x41')]({'where':{'id':_0x55e358['params']['id']}})[_0xc09e('0x1e')](handleEntityNotFound(_0x1b7462,null))['then'](removeEntity(_0x1b7462,null))[_0xc09e('0x3e')](handleError(_0x1b7462,null));};exports['describe']=function(_0x4c42b9,_0x2b3c89){return db[_0xc09e('0x3a')][_0xc09e('0x45')]()[_0xc09e('0x1e')](respondWithResult(_0x2b3c89,null))[_0xc09e('0x3e')](handleError(_0x2b3c89,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 12dfbda..3942132 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 _0x9bdb=['moment','bluebird','path','rimraf','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','api'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9bdb,0x1ad));var _0xb9bd=function(_0x53a454,_0x4da2bd){_0x53a454=_0x53a454-0x0;var _0x38bf8e=_0x9bdb[_0x53a454];return _0x38bf8e;};'use strict';var _=require(_0xb9bd('0x0'));var util=require(_0xb9bd('0x1'));var logger=require('../../config/logger')(_0xb9bd('0x2'));var moment=require(_0xb9bd('0x3'));var BPromise=require(_0xb9bd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9bd('0x5'));var rimraf=require(_0xb9bd('0x6'));var config=require('../../config/environment');var attributes=require('./chatQueueReport.attributes');module[_0xb9bd('0x7')]=function(_0x25a08c,_0x40b615){return _0x25a08c[_0xb9bd('0x8')](_0xb9bd('0x9'),attributes,{'tableName':_0xb9bd('0xa'),'paranoid':![],'indexes':[{'name':_0xb9bd('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7841=['api','bluebird','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash','util','../../config/logger'];(function(_0x482be1,_0x47cdc5){var _0x1439ac=function(_0x5c71bb){while(--_0x5c71bb){_0x482be1['push'](_0x482be1['shift']());}};_0x1439ac(++_0x47cdc5);}(_0x7841,0x19f));var _0x1784=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x7841[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x1784('0x0'));var util=require(_0x1784('0x1'));var logger=require(_0x1784('0x2'))(_0x1784('0x3'));var moment=require('moment');var BPromise=require(_0x1784('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1784('0x5'));var config=require(_0x1784('0x6'));var attributes=require(_0x1784('0x7'));module['exports']=function(_0x43fa5e,_0x4325d7){return _0x43fa5e[_0x1784('0x8')](_0x1784('0x9'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x1784('0xa'),'fields':[_0x1784('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 80849f3..c0a879c 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 _0x2df6=['../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x2df6,0x1b3));var _0x62df=function(_0x6f43d8,_0x36f6b1){_0x6f43d8=_0x6f43d8-0x0;var _0x28b2fb=_0x2df6[_0x6f43d8];return _0x28b2fb;};'use strict';var _=require(_0x62df('0x0'));var util=require(_0x62df('0x1'));var moment=require(_0x62df('0x2'));var BPromise=require('bluebird');var rs=require(_0x62df('0x3'));var fs=require('fs');var Redis=require(_0x62df('0x4'));var db=require(_0x62df('0x5'))['db'];var utils=require(_0x62df('0x6'));var logger=require(_0x62df('0x7'))(_0x62df('0x8'));var config=require(_0x62df('0x9'));var jayson=require(_0x62df('0xa'));var client=jayson[_0x62df('0xb')][_0x62df('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x528daa,_0x417120,_0x514955){return new BPromise(function(_0x32bbcc,_0x596c6c){return client[_0x62df('0xd')](_0x528daa,_0x514955)[_0x62df('0xe')](function(_0x18e1bb){logger[_0x62df('0xf')](_0x62df('0x10'),_0x417120,_0x62df('0x11'));logger[_0x62df('0x12')](_0x62df('0x13'),_0x417120,'request\x20sent',JSON[_0x62df('0x14')](_0x18e1bb));if(_0x18e1bb['error']){if(_0x18e1bb['error'][_0x62df('0x15')]===0x1f4){logger['error'](_0x62df('0x10'),_0x417120,_0x18e1bb['error']['message']);return _0x596c6c(_0x18e1bb[_0x62df('0x16')][_0x62df('0x17')]);}logger[_0x62df('0x16')]('ChatQueueReport,\x20%s,\x20%s',_0x417120,_0x18e1bb[_0x62df('0x16')]['message']);return _0x32bbcc(_0x18e1bb['error']['message']);}else{logger[_0x62df('0xf')](_0x62df('0x10'),_0x417120,'request\x20sent');_0x32bbcc(_0x18e1bb[_0x62df('0x18')]['message']);}})[_0x62df('0x19')](function(_0x5088a7){logger['error'](_0x62df('0x10'),_0x417120,_0x5088a7);_0x596c6c(_0x5088a7);});});}exports[_0x62df('0x1a')]=function(_0x856826){var _0x383a19=this;return new Promise(function(_0x28cd55,_0x59d867){return db[_0x62df('0x1b')][_0x62df('0x1c')](_0x856826[_0x62df('0x1d')],{'raw':_0x856826[_0x62df('0x1e')]?_0x856826[_0x62df('0x1e')][_0x62df('0x1f')]===undefined?!![]:![]:!![]})[_0x62df('0xe')](function(_0x157ea3){logger['info'](_0x62df('0x1a'),_0x856826);logger[_0x62df('0x12')](_0x62df('0x1a'),_0x856826,JSON[_0x62df('0x14')](_0x157ea3));_0x28cd55(_0x157ea3);})[_0x62df('0x19')](function(_0x2fd2f3){logger['error'](_0x62df('0x1a'),_0x2fd2f3[_0x62df('0x17')],_0x856826);_0x59d867(_0x383a19[_0x62df('0x16')](0x1f4,_0x2fd2f3[_0x62df('0x17')]));});});};exports[_0x62df('0x20')]=function(_0x1e9f89){var _0x1b4416=this;return new Promise(function(_0x41c7c4,_0x149615){return db['ChatQueueReport'][_0x62df('0x21')](_0x1e9f89[_0x62df('0x1d')],{'raw':_0x1e9f89['options']?_0x1e9f89[_0x62df('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e9f89[_0x62df('0x1e')]?_0x1e9f89['options'][_0x62df('0x22')]||null:null,'attributes':_0x1e9f89[_0x62df('0x1e')]?_0x1e9f89[_0x62df('0x1e')][_0x62df('0x23')]||null:null,'limit':_0x1e9f89[_0x62df('0x1e')]?_0x1e9f89[_0x62df('0x1e')][_0x62df('0x24')]||null:null})[_0x62df('0xe')](function(_0x98fb48){logger[_0x62df('0xf')](_0x62df('0x20'),_0x1e9f89);logger['debug'](_0x62df('0x20'),_0x1e9f89,JSON[_0x62df('0x14')](_0x98fb48));_0x41c7c4(_0x98fb48);})['catch'](function(_0x235001){logger[_0x62df('0x16')](_0x62df('0x20'),_0x235001[_0x62df('0x17')],_0x1e9f89);_0x149615(_0x1b4416[_0x62df('0x16')](0x1f4,_0x235001[_0x62df('0x17')]));});});}; \ No newline at end of file +var _0xc7e4=['limit','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateChatQueueReport','create','options','raw','info','stringify','UpdateChatQueueReport','update','body'];(function(_0x48cdc0,_0x178043){var _0x5c1e02=function(_0x39e12f){while(--_0x39e12f){_0x48cdc0['push'](_0x48cdc0['shift']());}};_0x5c1e02(++_0x178043);}(_0xc7e4,0x156));var _0x4c7e=function(_0xf6d34f,_0xaa0ceb){_0xf6d34f=_0xf6d34f-0x0;var _0x4dd500=_0xc7e4[_0xf6d34f];return _0x4dd500;};'use strict';var _=require(_0x4c7e('0x0'));var util=require(_0x4c7e('0x1'));var moment=require(_0x4c7e('0x2'));var BPromise=require(_0x4c7e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c7e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4c7e('0x5'))(_0x4c7e('0x6'));var config=require(_0x4c7e('0x7'));var jayson=require(_0x4c7e('0x8'));var client=jayson[_0x4c7e('0x9')][_0x4c7e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5060d1,_0xfa3131,_0x4caafd){return new BPromise(function(_0x318ed6,_0x14538e){return client[_0x4c7e('0xb')](_0x5060d1,_0x4caafd)[_0x4c7e('0xc')](function(_0x32399a){logger['info'](_0x4c7e('0xd'),_0xfa3131,_0x4c7e('0xe'));logger[_0x4c7e('0xf')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0xfa3131,_0x4c7e('0xe'),JSON['stringify'](_0x32399a));if(_0x32399a[_0x4c7e('0x10')]){if(_0x32399a[_0x4c7e('0x10')][_0x4c7e('0x11')]===0x1f4){logger[_0x4c7e('0x10')](_0x4c7e('0xd'),_0xfa3131,_0x32399a[_0x4c7e('0x10')][_0x4c7e('0x12')]);return _0x14538e(_0x32399a[_0x4c7e('0x10')][_0x4c7e('0x12')]);}logger[_0x4c7e('0x10')](_0x4c7e('0xd'),_0xfa3131,_0x32399a[_0x4c7e('0x10')][_0x4c7e('0x12')]);return _0x318ed6(_0x32399a['error']['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0xfa3131,_0x4c7e('0xe'));_0x318ed6(_0x32399a[_0x4c7e('0x13')][_0x4c7e('0x12')]);}})[_0x4c7e('0x14')](function(_0x420f90){logger[_0x4c7e('0x10')](_0x4c7e('0xd'),_0xfa3131,_0x420f90);_0x14538e(_0x420f90);});});}exports[_0x4c7e('0x15')]=function(_0x5058c3){var _0x2083ac=this;return new Promise(function(_0x243e58,_0x19a914){return db['ChatQueueReport'][_0x4c7e('0x16')](_0x5058c3['body'],{'raw':_0x5058c3[_0x4c7e('0x17')]?_0x5058c3[_0x4c7e('0x17')][_0x4c7e('0x18')]===undefined?!![]:![]:!![]})[_0x4c7e('0xc')](function(_0x2b0d70){logger[_0x4c7e('0x19')](_0x4c7e('0x15'),_0x5058c3);logger['debug'](_0x4c7e('0x15'),_0x5058c3,JSON[_0x4c7e('0x1a')](_0x2b0d70));_0x243e58(_0x2b0d70);})['catch'](function(_0x5345b8){logger[_0x4c7e('0x10')]('CreateChatQueueReport',_0x5345b8[_0x4c7e('0x12')],_0x5058c3);_0x19a914(_0x2083ac[_0x4c7e('0x10')](0x1f4,_0x5345b8[_0x4c7e('0x12')]));});});};exports[_0x4c7e('0x1b')]=function(_0x30e469){var _0xcb97a1=this;return new Promise(function(_0x19be46,_0x20a964){return db['ChatQueueReport'][_0x4c7e('0x1c')](_0x30e469[_0x4c7e('0x1d')],{'raw':_0x30e469[_0x4c7e('0x17')]?_0x30e469[_0x4c7e('0x17')][_0x4c7e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30e469['options']?_0x30e469[_0x4c7e('0x17')]['where']||null:null,'attributes':_0x30e469[_0x4c7e('0x17')]?_0x30e469[_0x4c7e('0x17')]['attributes']||null:null,'limit':_0x30e469[_0x4c7e('0x17')]?_0x30e469[_0x4c7e('0x17')][_0x4c7e('0x1e')]||null:null})[_0x4c7e('0xc')](function(_0x4797e9){logger[_0x4c7e('0x19')](_0x4c7e('0x1b'),_0x30e469);logger[_0x4c7e('0xf')]('UpdateChatQueueReport',_0x30e469,JSON['stringify'](_0x4797e9));_0x19be46(_0x4797e9);})[_0x4c7e('0x14')](function(_0x2c185d){logger[_0x4c7e('0x10')](_0x4c7e('0x1b'),_0x2c185d[_0x4c7e('0x12')],_0x30e469);_0x20a964(_0xcb97a1[_0x4c7e('0x10')](0x1f4,_0x2c185d[_0x4c7e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 2bdf4a6..d8bb8be 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 _0xdd7c=['util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x283495,_0x1bc000){var _0x2776f8=function(_0x3a1f97){while(--_0x3a1f97){_0x283495['push'](_0x283495['shift']());}};_0x2776f8(++_0x1bc000);}(_0xdd7c,0x13a));var _0xcdd7=function(_0x3e961c,_0x5747e7){_0x3e961c=_0x3e961c-0x0;var _0x474f9c=_0xdd7c[_0x3e961c];return _0x474f9c;};'use strict';var multer=require(_0xcdd7('0x0'));var util=require(_0xcdd7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcdd7('0x2')]();var auth=require(_0xcdd7('0x3'));var interaction=require(_0xcdd7('0x4'));var config=require(_0xcdd7('0x5'));var controller=require(_0xcdd7('0x6'));router['get']('/',auth[_0xcdd7('0x7')](),controller[_0xcdd7('0x8')]);router[_0xcdd7('0x9')](_0xcdd7('0xa'),auth['isAuthenticated'](),controller[_0xcdd7('0xb')]);router['get'](_0xcdd7('0xc'),auth['isAuthenticated'](),controller[_0xcdd7('0xd')]);router[_0xcdd7('0xe')]('/',auth['isAuthenticated'](),controller[_0xcdd7('0xf')]);router[_0xcdd7('0x10')](_0xcdd7('0xc'),auth[_0xcdd7('0x7')](),controller[_0xcdd7('0x11')]);router[_0xcdd7('0x12')](_0xcdd7('0xc'),auth['isAuthenticated'](),controller[_0xcdd7('0x13')]);module[_0xcdd7('0x14')]=router; \ No newline at end of file +var _0x8d98=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','destroy','exports','util','path','Router'];(function(_0x116648,_0x436a31){var _0x64da47=function(_0x50fc6e){while(--_0x50fc6e){_0x116648['push'](_0x116648['shift']());}};_0x64da47(++_0x436a31);}(_0x8d98,0x1b2));var _0x88d9=function(_0x2da0ce,_0x128df2){_0x2da0ce=_0x2da0ce-0x0;var _0x21edc6=_0x8d98[_0x2da0ce];return _0x21edc6;};'use strict';var multer=require('multer');var util=require(_0x88d9('0x0'));var path=require(_0x88d9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x88d9('0x2')]();var auth=require(_0x88d9('0x3'));var interaction=require(_0x88d9('0x4'));var config=require(_0x88d9('0x5'));var controller=require(_0x88d9('0x6'));router[_0x88d9('0x7')]('/',auth[_0x88d9('0x8')](),controller[_0x88d9('0x9')]);router[_0x88d9('0x7')](_0x88d9('0xa'),auth[_0x88d9('0x8')](),controller[_0x88d9('0xb')]);router[_0x88d9('0x7')](_0x88d9('0xc'),auth[_0x88d9('0x8')](),controller[_0x88d9('0xd')]);router[_0x88d9('0xe')]('/',auth[_0x88d9('0x8')](),controller[_0x88d9('0xf')]);router['put'](_0x88d9('0xc'),auth[_0x88d9('0x8')](),controller[_0x88d9('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x88d9('0x11')]);module[_0x88d9('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index e0c4612..6630d1f 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 _0x58a8=['NOW','moment','sequelize','exports','STRING','ENUM','account','queue','DATE'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x58a8,0x14e));var _0x858a=function(_0x3a5317,_0x34cce5){_0x3a5317=_0x3a5317-0x0;var _0x2f7bf8=_0x58a8[_0x3a5317];return _0x2f7bf8;};'use strict';var moment=require(_0x858a('0x0'));var Sequelize=require(_0x858a('0x1'));module[_0x858a('0x2')]={'uniqueid':{'type':Sequelize[_0x858a('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x858a('0x4')](_0x858a('0x5'),'agent',_0x858a('0x6')),'allowNull':![],'defaultValue':_0x858a('0x6')},'transferredAt':{'type':Sequelize[_0x858a('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x858a('0x8')]}}; \ No newline at end of file +var _0xcb46=['moment','sequelize','exports','STRING','ENUM','account','agent','queue','DATE','NOW'];(function(_0x201727,_0x9c626b){var _0x16384f=function(_0x4b5974){while(--_0x4b5974){_0x201727['push'](_0x201727['shift']());}};_0x16384f(++_0x9c626b);}(_0xcb46,0x1b8));var _0x6cb4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb46[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x6cb4('0x0'));var Sequelize=require(_0x6cb4('0x1'));module[_0x6cb4('0x2')]={'uniqueid':{'type':Sequelize[_0x6cb4('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6cb4('0x4')](_0x6cb4('0x5'),_0x6cb4('0x6'),_0x6cb4('0x7')),'allowNull':![],'defaultValue':_0x6cb4('0x7')},'transferredAt':{'type':Sequelize[_0x6cb4('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x6cb4('0x9')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 98a2140..11ddf1f 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 _0xd934=['status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ChatTransferReport','findAll','show','params','rawAttributes','filters','includeAll','include','find','catch','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xd934,0xc8));var _0x4d93=function(_0x33abe7,_0x51b0f0){_0x33abe7=_0x33abe7-0x0;var _0x292e39=_0xd934[_0x33abe7];return _0x292e39;};'use strict';var pdf=require(_0x4d93('0x0'));var emlformat=require(_0x4d93('0x1'));var rimraf=require(_0x4d93('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d93('0x3'));var rp=require(_0x4d93('0x4'));var moment=require(_0x4d93('0x5'));var BPromise=require(_0x4d93('0x6'));var Mustache=require(_0x4d93('0x7'));var util=require(_0x4d93('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x4d93('0x9'));var ejs=require(_0x4d93('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4d93('0xb'));var crypto=require('crypto');var jsforce=require(_0x4d93('0xc'));var deskjs=require(_0x4d93('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4d93('0xe'));var Papa=require(_0x4d93('0xf'));var Redis=require(_0x4d93('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4d93('0x11'));var hardwareService=require(_0x4d93('0x12'));var logger=require(_0x4d93('0x13'))(_0x4d93('0x14'));var utils=require(_0x4d93('0x15'));var config=require(_0x4d93('0x16'));var db=require(_0x4d93('0x17'))['db'];function respondWithStatusCode(_0x211f81,_0x4a1daa){_0x4a1daa=_0x4a1daa||0xcc;return function(_0xfcd13b){if(_0xfcd13b){return _0x211f81[_0x4d93('0x18')](_0x4a1daa);}return _0x211f81['status'](_0x4a1daa)['end']();};}function respondWithResult(_0x4b855d,_0x593cae){_0x593cae=_0x593cae||0xc8;return function(_0x89ff7f){if(_0x89ff7f){return _0x4b855d[_0x4d93('0x19')](_0x593cae)[_0x4d93('0x1a')](_0x89ff7f);}};}function respondWithFilteredResult(_0x22139a,_0x351d5d){return function(_0x4b0cf3){if(_0x4b0cf3){var _0x1fe0c2=_0x4b0cf3[_0x4d93('0x1b')],_0x16d211=_0x351d5d[_0x4d93('0x1c')],_0x261fb1=_0x351d5d[_0x4d93('0x1c')]+_0x351d5d[_0x4d93('0x1d')],_0x425ba4;if(_0x261fb1>=_0x1fe0c2){_0x261fb1=_0x1fe0c2;_0x425ba4=0xc8;}else{_0x425ba4=0xce;}_0x22139a[_0x4d93('0x19')](_0x425ba4);return _0x22139a[_0x4d93('0x1e')]('Content-Range',_0x16d211+'-'+_0x261fb1+'/'+_0x1fe0c2)[_0x4d93('0x1a')](_0x4b0cf3);}return null;};}function patchUpdates(_0x5144e8){return function(_0x4d1318){try{jsonpatch[_0x4d93('0x1f')](_0x4d1318,_0x5144e8,!![]);}catch(_0x40b4f5){return BPromise[_0x4d93('0x20')](_0x40b4f5);}return _0x4d1318[_0x4d93('0x21')]();};}function saveUpdates(_0x1cf73c,_0x3b8385){return function(_0x19ac4a){if(_0x19ac4a){return _0x19ac4a[_0x4d93('0x22')](_0x1cf73c)[_0x4d93('0x23')](function(_0x3aff69){return _0x3aff69;});}return null;};}function removeEntity(_0x10c827,_0x1693ee){return function(_0x12e2a6){if(_0x12e2a6){return _0x12e2a6[_0x4d93('0x24')]()['then'](function(){_0x10c827['status'](0xcc)[_0x4d93('0x25')]();});}};}function handleEntityNotFound(_0x54d414,_0x58bb0f){return function(_0x31f556){if(!_0x31f556){_0x54d414[_0x4d93('0x18')](0x194);}return _0x31f556;};}function handleError(_0x4972d9,_0x20302b){_0x20302b=_0x20302b||0x1f4;return function(_0x50477a){logger['error'](_0x50477a[_0x4d93('0x26')]);if(_0x50477a[_0x4d93('0x27')]){delete _0x50477a[_0x4d93('0x27')];}_0x4972d9['status'](_0x20302b)[_0x4d93('0x28')](_0x50477a);};}exports[_0x4d93('0x29')]=function(_0x2564b8,_0x394f0b){var _0x49a3ec={},_0x491619={},_0x33410c={'count':0x0,'rows':[]};var _0x2d66ea=_[_0x4d93('0x2a')](db['ChatTransferReport']['rawAttributes'],function(_0x4d0d98){return{'name':_0x4d0d98[_0x4d93('0x2b')],'type':_0x4d0d98[_0x4d93('0x2c')][_0x4d93('0x2d')]};});_0x491619['model']=_['map'](_0x2d66ea,_0x4d93('0x27'));_0x491619[_0x4d93('0x2e')]=_[_0x4d93('0x2f')](_0x2564b8['query']);_0x491619['filters']=_['intersection'](_0x491619[_0x4d93('0x30')],_0x491619['query']);_0x49a3ec[_0x4d93('0x31')]=_[_0x4d93('0x32')](_0x491619[_0x4d93('0x30')],qs[_0x4d93('0x33')](_0x2564b8[_0x4d93('0x2e')]['fields']));_0x49a3ec[_0x4d93('0x31')]=_0x49a3ec[_0x4d93('0x31')][_0x4d93('0x34')]?_0x49a3ec[_0x4d93('0x31')]:_0x491619['model'];if(!_0x2564b8[_0x4d93('0x2e')][_0x4d93('0x35')](_0x4d93('0x36'))){_0x49a3ec[_0x4d93('0x1d')]=qs[_0x4d93('0x1d')](_0x2564b8[_0x4d93('0x2e')]['limit']);_0x49a3ec[_0x4d93('0x1c')]=qs[_0x4d93('0x1c')](_0x2564b8['query'][_0x4d93('0x1c')]);}_0x49a3ec[_0x4d93('0x37')]=qs[_0x4d93('0x38')](_0x2564b8['query'][_0x4d93('0x38')]);_0x49a3ec[_0x4d93('0x39')]=qs['filters'](_[_0x4d93('0x3a')](_0x2564b8[_0x4d93('0x2e')],_0x491619['filters']));if(_0x2564b8[_0x4d93('0x2e')][_0x4d93('0x3b')]){_0x49a3ec['where']=_['merge'](_0x49a3ec[_0x4d93('0x39')],{'$or':_['map'](_0x2d66ea,function(_0x1b08a1){if(_0x1b08a1[_0x4d93('0x2c')]!=='VIRTUAL'){var _0x4ac6c7={};_0x4ac6c7[_0x1b08a1[_0x4d93('0x27')]]={'$like':'%'+_0x2564b8[_0x4d93('0x2e')][_0x4d93('0x3b')]+'%'};return _0x4ac6c7;}})});}_0x49a3ec=_[_0x4d93('0x3c')]({},_0x49a3ec,_0x2564b8[_0x4d93('0x3d')]);var _0x35e04b={'where':_0x49a3ec[_0x4d93('0x39')]};return db[_0x4d93('0x3e')][_0x4d93('0x1b')](_0x35e04b)[_0x4d93('0x23')](function(_0x300a94){_0x33410c[_0x4d93('0x1b')]=_0x300a94;if(_0x2564b8[_0x4d93('0x2e')]['includeAll']){_0x49a3ec['include']=[{'all':!![]}];}return db[_0x4d93('0x3e')][_0x4d93('0x3f')](_0x49a3ec);})[_0x4d93('0x23')](function(_0x3b6852){_0x33410c['rows']=_0x3b6852;return _0x33410c;})[_0x4d93('0x23')](respondWithFilteredResult(_0x394f0b,_0x49a3ec))['catch'](handleError(_0x394f0b,null));};exports[_0x4d93('0x40')]=function(_0x548355,_0x1883cd){var _0x5c7e9c={'raw':!![],'where':{'id':_0x548355[_0x4d93('0x41')]['id']}},_0xafd9ae={};_0xafd9ae[_0x4d93('0x30')]=_[_0x4d93('0x2f')](db[_0x4d93('0x3e')][_0x4d93('0x42')]);_0xafd9ae[_0x4d93('0x2e')]=_['keys'](_0x548355['query']);_0xafd9ae[_0x4d93('0x43')]=_[_0x4d93('0x32')](_0xafd9ae[_0x4d93('0x30')],_0xafd9ae['query']);_0x5c7e9c[_0x4d93('0x31')]=_[_0x4d93('0x32')](_0xafd9ae['model'],qs[_0x4d93('0x33')](_0x548355['query'][_0x4d93('0x33')]));_0x5c7e9c[_0x4d93('0x31')]=_0x5c7e9c[_0x4d93('0x31')][_0x4d93('0x34')]?_0x5c7e9c['attributes']:_0xafd9ae[_0x4d93('0x30')];if(_0x548355[_0x4d93('0x2e')][_0x4d93('0x44')]){_0x5c7e9c[_0x4d93('0x45')]=[{'all':!![]}];}_0x5c7e9c=_[_0x4d93('0x3c')]({},_0x5c7e9c,_0x548355[_0x4d93('0x3d')]);return db['ChatTransferReport'][_0x4d93('0x46')](_0x5c7e9c)[_0x4d93('0x23')](handleEntityNotFound(_0x1883cd,null))[_0x4d93('0x23')](respondWithResult(_0x1883cd,null))[_0x4d93('0x47')](handleError(_0x1883cd,null));};exports['create']=function(_0x338dd7,_0x5ed0a5){return db[_0x4d93('0x3e')][_0x4d93('0x48')](_0x338dd7[_0x4d93('0x49')],{})[_0x4d93('0x23')](respondWithResult(_0x5ed0a5,0xc9))['catch'](handleError(_0x5ed0a5,null));};exports[_0x4d93('0x22')]=function(_0x38983e,_0x3b3f7d){if(_0x38983e[_0x4d93('0x49')]['id']){delete _0x38983e[_0x4d93('0x49')]['id'];}return db[_0x4d93('0x3e')][_0x4d93('0x46')]({'where':{'id':_0x38983e[_0x4d93('0x41')]['id']}})['then'](handleEntityNotFound(_0x3b3f7d,null))[_0x4d93('0x23')](saveUpdates(_0x38983e['body'],null))[_0x4d93('0x23')](respondWithResult(_0x3b3f7d,null))[_0x4d93('0x47')](handleError(_0x3b3f7d,null));};exports[_0x4d93('0x24')]=function(_0x3d40a9,_0x3550a5){return db[_0x4d93('0x3e')][_0x4d93('0x46')]({'where':{'id':_0x3d40a9[_0x4d93('0x41')]['id']}})[_0x4d93('0x23')](handleEntityNotFound(_0x3550a5,null))['then'](removeEntity(_0x3550a5,null))['catch'](handleError(_0x3550a5,null));};exports[_0x4d93('0x4a')]=function(_0x2a50b2,_0x5da20a){return db[_0x4d93('0x3e')][_0x4d93('0x4a')]()[_0x4d93('0x23')](respondWithResult(_0x5da20a,null))[_0x4d93('0x47')](handleError(_0x5da20a,null));}; \ No newline at end of file +var _0xfc16=['save','then','destroy','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','VIRTUAL','merge','options','findAll','rows','catch','show','keys','includeAll','include','find','create','body','params','describe','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','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xfc16,0x10d));var _0x6fc1=function(_0x22b5da,_0x43cf53){_0x22b5da=_0x22b5da-0x0;var _0x46b7da=_0xfc16[_0x22b5da];return _0x46b7da;};'use strict';var pdf=require(_0x6fc1('0x0'));var emlformat=require(_0x6fc1('0x1'));var rimraf=require(_0x6fc1('0x2'));var zipdir=require(_0x6fc1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6fc1('0x4'));var moment=require(_0x6fc1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6fc1('0x6'));var util=require(_0x6fc1('0x7'));var path=require(_0x6fc1('0x8'));var sox=require(_0x6fc1('0x9'));var csv=require(_0x6fc1('0xa'));var ejs=require(_0x6fc1('0xb'));var fs=require('fs');var _=require(_0x6fc1('0xc'));var squel=require(_0x6fc1('0xd'));var crypto=require(_0x6fc1('0xe'));var jsforce=require(_0x6fc1('0xf'));var deskjs=require(_0x6fc1('0x10'));var toCsv=require(_0x6fc1('0xa'));var querystring=require(_0x6fc1('0x11'));var Papa=require(_0x6fc1('0x12'));var Redis=require(_0x6fc1('0x13'));var authService=require(_0x6fc1('0x14'));var qs=require(_0x6fc1('0x15'));var as=require(_0x6fc1('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6fc1('0x17'))(_0x6fc1('0x18'));var utils=require(_0x6fc1('0x19'));var config=require('../../config/environment');var db=require(_0x6fc1('0x1a'))['db'];function respondWithStatusCode(_0x258437,_0x2722d1){_0x2722d1=_0x2722d1||0xcc;return function(_0x566a1a){if(_0x566a1a){return _0x258437[_0x6fc1('0x1b')](_0x2722d1);}return _0x258437[_0x6fc1('0x1c')](_0x2722d1)[_0x6fc1('0x1d')]();};}function respondWithResult(_0x506e2e,_0x3a7d57){_0x3a7d57=_0x3a7d57||0xc8;return function(_0x584e86){if(_0x584e86){return _0x506e2e[_0x6fc1('0x1c')](_0x3a7d57)[_0x6fc1('0x1e')](_0x584e86);}};}function respondWithFilteredResult(_0x327e68,_0x1af9eb){return function(_0x53ea88){if(_0x53ea88){var _0x3fc642=_0x53ea88[_0x6fc1('0x1f')],_0x4b8451=_0x1af9eb[_0x6fc1('0x20')],_0x205aed=_0x1af9eb['offset']+_0x1af9eb[_0x6fc1('0x21')],_0xfbad5c;if(_0x205aed>=_0x3fc642){_0x205aed=_0x3fc642;_0xfbad5c=0xc8;}else{_0xfbad5c=0xce;}_0x327e68[_0x6fc1('0x1c')](_0xfbad5c);return _0x327e68[_0x6fc1('0x22')]('Content-Range',_0x4b8451+'-'+_0x205aed+'/'+_0x3fc642)[_0x6fc1('0x1e')](_0x53ea88);}return null;};}function patchUpdates(_0xfeb9a1){return function(_0x3adbd2){try{jsonpatch['apply'](_0x3adbd2,_0xfeb9a1,!![]);}catch(_0x199ff2){return BPromise['reject'](_0x199ff2);}return _0x3adbd2[_0x6fc1('0x23')]();};}function saveUpdates(_0x5ec425,_0x394420){return function(_0x4516ca){if(_0x4516ca){return _0x4516ca['update'](_0x5ec425)[_0x6fc1('0x24')](function(_0x1daac8){return _0x1daac8;});}return null;};}function removeEntity(_0x3584b0,_0x26ce64){return function(_0x34aeb5){if(_0x34aeb5){return _0x34aeb5[_0x6fc1('0x25')]()[_0x6fc1('0x24')](function(){_0x3584b0[_0x6fc1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e2590,_0x49095b){return function(_0x425c40){if(!_0x425c40){_0x1e2590['sendStatus'](0x194);}return _0x425c40;};}function handleError(_0x3557ac,_0x2c4d8d){_0x2c4d8d=_0x2c4d8d||0x1f4;return function(_0x5853ec){logger[_0x6fc1('0x26')](_0x5853ec[_0x6fc1('0x27')]);if(_0x5853ec[_0x6fc1('0x28')]){delete _0x5853ec[_0x6fc1('0x28')];}_0x3557ac[_0x6fc1('0x1c')](_0x2c4d8d)[_0x6fc1('0x29')](_0x5853ec);};}exports[_0x6fc1('0x2a')]=function(_0xdb4686,_0xe5d5e6){var _0xe05b6c={},_0x337ecd={},_0x2fb0bb={'count':0x0,'rows':[]};var _0x567c62=_[_0x6fc1('0x2b')](db[_0x6fc1('0x2c')][_0x6fc1('0x2d')],function(_0x3014d8){return{'name':_0x3014d8[_0x6fc1('0x2e')],'type':_0x3014d8[_0x6fc1('0x2f')][_0x6fc1('0x30')]};});_0x337ecd[_0x6fc1('0x31')]=_[_0x6fc1('0x2b')](_0x567c62,_0x6fc1('0x28'));_0x337ecd['query']=_['keys'](_0xdb4686[_0x6fc1('0x32')]);_0x337ecd['filters']=_['intersection'](_0x337ecd[_0x6fc1('0x31')],_0x337ecd[_0x6fc1('0x32')]);_0xe05b6c[_0x6fc1('0x33')]=_[_0x6fc1('0x34')](_0x337ecd['model'],qs['fields'](_0xdb4686['query'][_0x6fc1('0x35')]));_0xe05b6c[_0x6fc1('0x33')]=_0xe05b6c['attributes'][_0x6fc1('0x36')]?_0xe05b6c[_0x6fc1('0x33')]:_0x337ecd[_0x6fc1('0x31')];if(!_0xdb4686[_0x6fc1('0x32')][_0x6fc1('0x37')](_0x6fc1('0x38'))){_0xe05b6c[_0x6fc1('0x21')]=qs[_0x6fc1('0x21')](_0xdb4686['query']['limit']);_0xe05b6c['offset']=qs[_0x6fc1('0x20')](_0xdb4686['query'][_0x6fc1('0x20')]);}_0xe05b6c['order']=qs[_0x6fc1('0x39')](_0xdb4686[_0x6fc1('0x32')][_0x6fc1('0x39')]);_0xe05b6c['where']=qs[_0x6fc1('0x3a')](_['pick'](_0xdb4686[_0x6fc1('0x32')],_0x337ecd['filters']));if(_0xdb4686[_0x6fc1('0x32')][_0x6fc1('0x3b')]){_0xe05b6c[_0x6fc1('0x3c')]=_['merge'](_0xe05b6c[_0x6fc1('0x3c')],{'$or':_[_0x6fc1('0x2b')](_0x567c62,function(_0x277b1a){if(_0x277b1a[_0x6fc1('0x2f')]!==_0x6fc1('0x3d')){var _0x389e10={};_0x389e10[_0x277b1a[_0x6fc1('0x28')]]={'$like':'%'+_0xdb4686[_0x6fc1('0x32')][_0x6fc1('0x3b')]+'%'};return _0x389e10;}})});}_0xe05b6c=_[_0x6fc1('0x3e')]({},_0xe05b6c,_0xdb4686[_0x6fc1('0x3f')]);var _0x5b9a74={'where':_0xe05b6c[_0x6fc1('0x3c')]};return db['ChatTransferReport']['count'](_0x5b9a74)['then'](function(_0x24cb19){_0x2fb0bb[_0x6fc1('0x1f')]=_0x24cb19;if(_0xdb4686[_0x6fc1('0x32')]['includeAll']){_0xe05b6c['include']=[{'all':!![]}];}return db[_0x6fc1('0x2c')][_0x6fc1('0x40')](_0xe05b6c);})[_0x6fc1('0x24')](function(_0x40e665){_0x2fb0bb[_0x6fc1('0x41')]=_0x40e665;return _0x2fb0bb;})[_0x6fc1('0x24')](respondWithFilteredResult(_0xe5d5e6,_0xe05b6c))[_0x6fc1('0x42')](handleError(_0xe5d5e6,null));};exports[_0x6fc1('0x43')]=function(_0x140c51,_0x178a76){var _0x2b686c={'raw':!![],'where':{'id':_0x140c51['params']['id']}},_0x44522c={};_0x44522c[_0x6fc1('0x31')]=_[_0x6fc1('0x44')](db[_0x6fc1('0x2c')][_0x6fc1('0x2d')]);_0x44522c['query']=_['keys'](_0x140c51[_0x6fc1('0x32')]);_0x44522c['filters']=_['intersection'](_0x44522c['model'],_0x44522c[_0x6fc1('0x32')]);_0x2b686c['attributes']=_[_0x6fc1('0x34')](_0x44522c[_0x6fc1('0x31')],qs[_0x6fc1('0x35')](_0x140c51[_0x6fc1('0x32')][_0x6fc1('0x35')]));_0x2b686c['attributes']=_0x2b686c[_0x6fc1('0x33')]['length']?_0x2b686c[_0x6fc1('0x33')]:_0x44522c[_0x6fc1('0x31')];if(_0x140c51[_0x6fc1('0x32')][_0x6fc1('0x45')]){_0x2b686c[_0x6fc1('0x46')]=[{'all':!![]}];}_0x2b686c=_[_0x6fc1('0x3e')]({},_0x2b686c,_0x140c51['options']);return db['ChatTransferReport'][_0x6fc1('0x47')](_0x2b686c)[_0x6fc1('0x24')](handleEntityNotFound(_0x178a76,null))['then'](respondWithResult(_0x178a76,null))[_0x6fc1('0x42')](handleError(_0x178a76,null));};exports[_0x6fc1('0x48')]=function(_0x4820a8,_0x309c49){return db['ChatTransferReport'][_0x6fc1('0x48')](_0x4820a8[_0x6fc1('0x49')],{})[_0x6fc1('0x24')](respondWithResult(_0x309c49,0xc9))[_0x6fc1('0x42')](handleError(_0x309c49,null));};exports['update']=function(_0x26f654,_0x18d7bf){if(_0x26f654[_0x6fc1('0x49')]['id']){delete _0x26f654[_0x6fc1('0x49')]['id'];}return db[_0x6fc1('0x2c')][_0x6fc1('0x47')]({'where':{'id':_0x26f654[_0x6fc1('0x4a')]['id']}})[_0x6fc1('0x24')](handleEntityNotFound(_0x18d7bf,null))[_0x6fc1('0x24')](saveUpdates(_0x26f654[_0x6fc1('0x49')],null))[_0x6fc1('0x24')](respondWithResult(_0x18d7bf,null))['catch'](handleError(_0x18d7bf,null));};exports[_0x6fc1('0x25')]=function(_0x52458b,_0x4367b6){return db['ChatTransferReport'][_0x6fc1('0x47')]({'where':{'id':_0x52458b[_0x6fc1('0x4a')]['id']}})[_0x6fc1('0x24')](handleEntityNotFound(_0x4367b6,null))[_0x6fc1('0x24')](removeEntity(_0x4367b6,null))[_0x6fc1('0x42')](handleError(_0x4367b6,null));};exports[_0x6fc1('0x4b')]=function(_0xb925f0,_0x3cc5e6){return db[_0x6fc1('0x2c')][_0x6fc1('0x4b')]()[_0x6fc1('0x24')](respondWithResult(_0x3cc5e6,null))[_0x6fc1('0x42')](handleError(_0x3cc5e6,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 99842f6..95f96aa 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 _0xc469=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','define','report_chat_transfer','uniqueid'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc469,0x6e));var _0x9c46=function(_0x49cb71,_0x2f0149){_0x49cb71=_0x49cb71-0x0;var _0x3a50fd=_0xc469[_0x49cb71];return _0x3a50fd;};'use strict';var _=require(_0x9c46('0x0'));var util=require(_0x9c46('0x1'));var logger=require('../../config/logger')(_0x9c46('0x2'));var moment=require(_0x9c46('0x3'));var BPromise=require(_0x9c46('0x4'));var rp=require(_0x9c46('0x5'));var fs=require('fs');var path=require(_0x9c46('0x6'));var rimraf=require(_0x9c46('0x7'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x542cd0,_0x28fce2){return _0x542cd0[_0x9c46('0x8')]('ChatTransferReport',attributes,{'tableName':_0x9c46('0x9'),'paranoid':![],'indexes':[{'name':_0x9c46('0xa'),'fields':[_0x9c46('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d46=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x4d46,0x197));var _0x64d4=function(_0x2da4a6,_0x3feacf){_0x2da4a6=_0x2da4a6-0x0;var _0x794646=_0x4d46[_0x2da4a6];return _0x794646;};'use strict';var _=require(_0x64d4('0x0'));var util=require(_0x64d4('0x1'));var logger=require(_0x64d4('0x2'))(_0x64d4('0x3'));var moment=require(_0x64d4('0x4'));var BPromise=require(_0x64d4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64d4('0x6'));var rimraf=require(_0x64d4('0x7'));var config=require(_0x64d4('0x8'));var attributes=require(_0x64d4('0x9'));module[_0x64d4('0xa')]=function(_0x3b8932,_0x4d9222){return _0x3b8932[_0x64d4('0xb')](_0x64d4('0xc'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x64d4('0xd'),'fields':[_0x64d4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 8d2e11c..fa640a8 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 _0x457d=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','ioredis'];(function(_0x20f016,_0x4ecd32){var _0x1d91c0=function(_0xed7351){while(--_0xed7351){_0x20f016['push'](_0x20f016['shift']());}};_0x1d91c0(++_0x4ecd32);}(_0x457d,0x146));var _0xd457=function(_0x35731c,_0x5ab1d1){_0x35731c=_0x35731c-0x0;var _0x2f2957=_0x457d[_0x35731c];return _0x2f2957;};'use strict';var _=require('lodash');var util=require(_0xd457('0x0'));var moment=require('moment');var BPromise=require(_0xd457('0x1'));var rs=require(_0xd457('0x2'));var fs=require('fs');var Redis=require(_0xd457('0x3'));var db=require(_0xd457('0x4'))['db'];var utils=require(_0xd457('0x5'));var logger=require('../../config/logger')(_0xd457('0x6'));var config=require(_0xd457('0x7'));var jayson=require(_0xd457('0x8'));var client=jayson[_0xd457('0x9')][_0xd457('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bdd8c,_0x29def0,_0x148a24){return new BPromise(function(_0x38d818,_0x197bb7){return client[_0xd457('0xb')](_0x4bdd8c,_0x148a24)['then'](function(_0x4f021d){logger[_0xd457('0xc')](_0xd457('0xd'),_0x29def0,_0xd457('0xe'));logger[_0xd457('0xf')](_0xd457('0x10'),_0x29def0,_0xd457('0xe'),JSON[_0xd457('0x11')](_0x4f021d));if(_0x4f021d[_0xd457('0x12')]){if(_0x4f021d[_0xd457('0x12')][_0xd457('0x13')]===0x1f4){logger['error'](_0xd457('0xd'),_0x29def0,_0x4f021d[_0xd457('0x12')][_0xd457('0x14')]);return _0x197bb7(_0x4f021d[_0xd457('0x12')][_0xd457('0x14')]);}logger[_0xd457('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x29def0,_0x4f021d['error'][_0xd457('0x14')]);return _0x38d818(_0x4f021d[_0xd457('0x12')][_0xd457('0x14')]);}else{logger[_0xd457('0xc')](_0xd457('0xd'),_0x29def0,'request\x20sent');_0x38d818(_0x4f021d[_0xd457('0x15')][_0xd457('0x14')]);}})['catch'](function(_0x3630c7){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x29def0,_0x3630c7);_0x197bb7(_0x3630c7);});});} \ No newline at end of file +var _0xe87e=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ChatTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment'];(function(_0x6a4e3d,_0x128d3d){var _0x5d9f40=function(_0x2e8f70){while(--_0x2e8f70){_0x6a4e3d['push'](_0x6a4e3d['shift']());}};_0x5d9f40(++_0x128d3d);}(_0xe87e,0x75));var _0xee87=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0xe87e[_0x30033a];return _0x5e3518;};'use strict';var _=require(_0xee87('0x0'));var util=require(_0xee87('0x1'));var moment=require(_0xee87('0x2'));var BPromise=require(_0xee87('0x3'));var rs=require(_0xee87('0x4'));var fs=require('fs');var Redis=require(_0xee87('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xee87('0x6'));var logger=require('../../config/logger')(_0xee87('0x7'));var config=require(_0xee87('0x8'));var jayson=require(_0xee87('0x9'));var client=jayson[_0xee87('0xa')][_0xee87('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x156908,_0x483d8f,_0x4aaa8b){return new BPromise(function(_0x380f27,_0x576c6f){return client[_0xee87('0xc')](_0x156908,_0x4aaa8b)['then'](function(_0x333ee4){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x483d8f,_0xee87('0xd'));logger[_0xee87('0xe')](_0xee87('0xf'),_0x483d8f,'request\x20sent',JSON[_0xee87('0x10')](_0x333ee4));if(_0x333ee4[_0xee87('0x11')]){if(_0x333ee4[_0xee87('0x11')][_0xee87('0x12')]===0x1f4){logger[_0xee87('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x483d8f,_0x333ee4['error'][_0xee87('0x13')]);return _0x576c6f(_0x333ee4[_0xee87('0x11')]['message']);}logger[_0xee87('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x483d8f,_0x333ee4[_0xee87('0x11')][_0xee87('0x13')]);return _0x380f27(_0x333ee4[_0xee87('0x11')][_0xee87('0x13')]);}else{logger[_0xee87('0x14')](_0xee87('0x15'),_0x483d8f,_0xee87('0xd'));_0x380f27(_0x333ee4[_0xee87('0x16')]['message']);}})[_0xee87('0x17')](function(_0x4f1005){logger[_0xee87('0x11')](_0xee87('0x15'),_0x483d8f,_0x4f1005);_0x576c6f(_0x4f1005);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 9f34970..1e225b9 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['describe','get','/:id','show','create','put','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/describe',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller['update']);router[_0x65f6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x65f6('0x10')]);module['exports']=router; \ No newline at end of file +var _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(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'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 bd70bc9..b890011 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 _0x6f4c=['Agent','#9f946a','#ffffff','INTEGER','ENUM','squared','rounded','Chat','Send','Contact\x20us','BOOLEAN','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','parse','getDataValue','onlineForm','setDataValue','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','randomstring','exports','STRING','address','email'];(function(_0x38473a,_0x50d0fb){var _0xe7be67=function(_0x5dfcc5){while(--_0x5dfcc5){_0x38473a['push'](_0x38473a['shift']());}};_0xe7be67(++_0x50d0fb);}(_0x6f4c,0x8b));var _0xc6f4=function(_0x27c0e1,_0x14bf90){_0x27c0e1=_0x27c0e1-0x0;var _0x3a93d6=_0x6f4c[_0x27c0e1];return _0x3a93d6;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xc6f4('0x0'));module[_0xc6f4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xc6f4('0x2')],'allowNull':![],'unique':_0xc6f4('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0x4')},'mapKeyOffline':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0xc6f4('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0x5')},'customerAlias':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xc6f4('0x2')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xc6f4('0x2')],'allowNull':![],'defaultValue':_0xc6f4('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xc6f4('0x2')],'allowNull':![],'defaultValue':_0xc6f4('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xc6f4('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xc6f4('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xc6f4('0x9')]('rounded',_0xc6f4('0xa')),'defaultValue':_0xc6f4('0xb')},'header_online':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xc6f4('0xc')},'offline_chat_button':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0xd')},'header_offline':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xc6f4('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xc6f4('0xf')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xc6f4('0x10')]},'closingQuestion':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xc6f4('0x13')},'placeholderMessage':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0x14')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xc6f4('0x15')},'closingMessageButton':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0x16')},'conditionAgreement':{'type':Sequelize[_0xc6f4('0xf')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xc6f4('0xf')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xc6f4('0xf')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0x17')},'ratingType':{'type':Sequelize[_0xc6f4('0x9')](_0xc6f4('0x18'),_0xc6f4('0x19')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xc6f4('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xc6f4('0x10')],'defaultValue':function(){return JSON[_0xc6f4('0x1a')]({'items':[{'type':_0xc6f4('0x1b'),'variable':null,'config':{'placeholder':_0xc6f4('0x1c'),'type':'text','required':!![]},'props':{'title':_0xc6f4('0x1c'),'helpText':''}},{'type':_0xc6f4('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xc6f4('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0xc6f4('0x1d')](this[_0xc6f4('0x1e')](_0xc6f4('0x1f'))):{};},'set':function(_0x6b619d){return this[_0xc6f4('0x20')]('onlineForm',JSON[_0xc6f4('0x1a')](_0x6b619d));}},'offlineForm':{'type':Sequelize[_0xc6f4('0x10')],'defaultValue':function(){return JSON[_0xc6f4('0x1a')]({'items':[{'type':_0xc6f4('0x1b'),'props':{'title':_0xc6f4('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xc6f4('0x4'),'type':_0xc6f4('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0xc6f4('0x21')},'props':{'title':_0xc6f4('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xc6f4('0x1e')](_0xc6f4('0x22'))?JSON[_0xc6f4('0x1d')](this[_0xc6f4('0x1e')](_0xc6f4('0x22'))):{};},'set':function(_0x447659){return this['setDataValue']('offlineForm',JSON['stringify'](_0x447659));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xc6f4('0x23')]();}},'autoclose':{'type':Sequelize[_0xc6f4('0xf')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xc6f4('0xf')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xc6f4('0xf')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xc6f4('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xc6f4('0x24')},'waitingMessage':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0x26')},'offlineMessageBody':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0xc6f4('0xf')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xc6f4('0x16')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xc6f4('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xc6f4('0xf')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xc6f4('0xf')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xc6f4('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xc6f4('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc6f4('0x29');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0xc6f4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0x2b')},'verticalAlignment':{'type':Sequelize[_0xc6f4('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0x2c')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xc6f4('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xc6f4('0xf')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xc6f4('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc6f4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc6f4('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc6f4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xc6f4('0x2')],'defaultValue':_0xc6f4('0x2d')},'systemAvatar':{'type':Sequelize[_0xc6f4('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc6f4('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc6f4('0xf')],'defaultValue':![],'comment':_0xc6f4('0x2e'),'set':function(_0x10351c){if(!_0x10351c)this[_0xc6f4('0x20')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xc6f4('0x2f'),_0x10351c);}}}; \ No newline at end of file +var _0x2a32=['mandatoryDisposition','randomstring','STRING','address','email','#9f946a','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2a32,0x1d7));var _0x22a3=function(_0x4178af,_0x388652){_0x4178af=_0x4178af-0x0;var _0x20f4b1=_0x2a32[_0x4178af];return _0x20f4b1;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x22a3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x22a3('0x1')],'allowNull':![],'unique':_0x22a3('0x2')},'description':{'type':Sequelize[_0x22a3('0x1')]},'mapKey':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':_0x22a3('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0x22a3('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x22a3('0x1')],'allowNull':![],'defaultValue':_0x22a3('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x22a3('0x1')],'allowNull':![],'defaultValue':_0x22a3('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x22a3('0x1')],'allowNull':![],'defaultValue':_0x22a3('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x22a3('0x7')](_0x22a3('0x8'),_0x22a3('0x9')),'defaultValue':_0x22a3('0x8')},'header_online':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':_0x22a3('0xa')},'start_chat_button':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':_0x22a3('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x22a3('0xc')},'header_offline':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':_0x22a3('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x22a3('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x22a3('0xf')]},'closingQuestion':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':_0x22a3('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':_0x22a3('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':_0x22a3('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':_0x22a3('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x22a3('0x14')},'closingMessageButton':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':_0x22a3('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x22a3('0x15')},'conditionAgreement':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':_0x22a3('0x16')},'ratingType':{'type':Sequelize['ENUM'](_0x22a3('0x17'),_0x22a3('0x18')),'defaultValue':_0x22a3('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x22a3('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x22a3('0x19')]({'items':[{'type':_0x22a3('0x1a'),'variable':null,'config':{'placeholder':_0x22a3('0x1b'),'type':'text','required':!![]},'props':{'title':_0x22a3('0x1b'),'helpText':''}},{'type':'input','props':{'title':_0x22a3('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x22a3('0x3'),'type':_0x22a3('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x22a3('0x1c')](_0x22a3('0x1d'))?JSON[_0x22a3('0x1e')](this['getDataValue'](_0x22a3('0x1d'))):{};},'set':function(_0x59b52d){return this[_0x22a3('0x1f')](_0x22a3('0x1d'),JSON['stringify'](_0x59b52d));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x22a3('0x19')]({'items':[{'type':'input','props':{'title':_0x22a3('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x22a3('0x3'),'type':_0x22a3('0x3')},'variable':null},{'type':_0x22a3('0x20'),'config':{'placeholder':'Comments'},'props':{'title':_0x22a3('0x21'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x22a3('0x1c')](_0x22a3('0x22'))?JSON[_0x22a3('0x1e')](this[_0x22a3('0x1c')](_0x22a3('0x22'))):{};},'set':function(_0x3465be){return this[_0x22a3('0x1f')](_0x22a3('0x22'),JSON[_0x22a3('0x19')](_0x3465be));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x22a3('0x23')]();}},'autoclose':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x22a3('0x1')]},'waitingTitle':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':_0x22a3('0x24')},'offlineMessageBody':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x22a3('0x25')},'skipUnmanaged':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':_0x22a3('0x15')},'sendUnmanaged':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x22a3('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x22a3('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x22a3('0x26');}},'notificationSound':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x22a3('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':_0x22a3('0x27')},'verticalAlignment':{'type':Sequelize[_0x22a3('0xe')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x22a3('0x28')},'defaultTitle':{'type':Sequelize[_0x22a3('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x22a3('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x22a3('0x1')],'allowNull':![],'defaultValue':_0x22a3('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x22a3('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x22a3('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x22a3('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x22a3('0x1')],'defaultValue':_0x22a3('0x2a')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x22a3('0xe')],'comment':_0x22a3('0x2b')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x22a3('0x2c'),'set':function(_0x557cfb){if(!_0x557cfb)this[_0x22a3('0x1f')](_0x22a3('0x2d'),null);this[_0x22a3('0x1f')](_0x22a3('0x2e'),_0x557cfb);}}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 1104495..30992da 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 _0x2a1f=['sequelize','transaction','ChatApplication','bulkCreate','getApplications','chatProactiveAction','omit','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','count','limit','set','apply','reject','save','update','destroy','ChatWebsites','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','show','params','find','create','get','role','user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','Disposition','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','join','root','server/files/images/logos/default_logo.png','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','setUA','user-agent','chat','no\x20available\x20attributes','difference','createdAt','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','updatedAt','DESC','Applications','applications','list','orderBy','priority','asc','account','cf-connecting-ip','headers','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','format','%s\x20%s','unknown','version','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','contact','messageId','created','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','CompanyId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','getInteractions','Contact','Owner','fullname','Tag','Tags','tag','Command','getSnippet','iftime\x20%s,%s','interval','indexOf','ONLINE','OFFLINE','timezone','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','push','all','some','server/files/chat/iframe.js','utf8','x-real-ip','remoteAddress','replace','color','addApplications'];(function(_0x5ad2b2,_0x42b3af){var _0x1a18ec=function(_0xf89126){while(--_0xf89126){_0x5ad2b2['push'](_0x5ad2b2['shift']());}};_0x1a18ec(++_0x42b3af);}(_0x2a1f,0x138));var _0xf2a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a1f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xf2a1('0x0'));var emlformat=require(_0xf2a1('0x1'));var rimraf=require(_0xf2a1('0x2'));var zipdir=require(_0xf2a1('0x3'));var jsonpatch=require(_0xf2a1('0x4'));var rp=require(_0xf2a1('0x5'));var moment=require(_0xf2a1('0x6'));var BPromise=require(_0xf2a1('0x7'));var Mustache=require(_0xf2a1('0x8'));var util=require('util');var path=require(_0xf2a1('0x9'));var sox=require(_0xf2a1('0xa'));var csv=require(_0xf2a1('0xb'));var ejs=require(_0xf2a1('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf2a1('0xd'));var crypto=require(_0xf2a1('0xe'));var jsforce=require(_0xf2a1('0xf'));var deskjs=require(_0xf2a1('0x10'));var toCsv=require(_0xf2a1('0xb'));var querystring=require(_0xf2a1('0x11'));var Papa=require('papaparse');var Redis=require(_0xf2a1('0x12'));var authService=require(_0xf2a1('0x13'));var qs=require(_0xf2a1('0x14'));var as=require(_0xf2a1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2a1('0x16'))(_0xf2a1('0x17'));var utils=require(_0xf2a1('0x18'));var config=require(_0xf2a1('0x19'));var db=require(_0xf2a1('0x1a'))['db'];config['redis']=_[_0xf2a1('0x1b')](config[_0xf2a1('0x1c')],{'host':_0xf2a1('0x1d'),'port':0x18eb});var socket=require(_0xf2a1('0x1e'))(new Redis(config[_0xf2a1('0x1c')]));require(_0xf2a1('0x1f'))['register'](socket);var jayson=require(_0xf2a1('0x20'));var client=jayson[_0xf2a1('0x21')][_0xf2a1('0x22')]({'port':0x232c});var client9002=jayson[_0xf2a1('0x21')][_0xf2a1('0x22')]({'port':0x232a});var client9003=jayson['client'][_0xf2a1('0x22')]({'port':0x232b});function checkPasswordPattern(_0x974f0b,_0x37c1e9,_0x573321){if(_0x573321){var _0x1a0eae=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a0eae[_0xf2a1('0x23')](_0x37c1e9)){return _0x974f0b;}else{throw new db[(_0xf2a1('0x24'))][(_0xf2a1('0x25'))](_0xf2a1('0x26'));}}else{return _0x974f0b;}}function respondWithRpcPromise(_0x20f36d,_0x5e1307,_0x43e32e,_0x57ae3f){return new BPromise(function(_0x3253f0,_0x9456a2){var _0x461546=_0x57ae3f||client;return _0x461546['request'](_0x20f36d,_0x43e32e)[_0xf2a1('0x27')](function(_0x4cdcaf){logger[_0xf2a1('0x28')](_0xf2a1('0x29'),_0x5e1307,'request\x20sent');logger[_0xf2a1('0x2a')](_0xf2a1('0x2b'),_0x5e1307,_0xf2a1('0x2c'),JSON[_0xf2a1('0x2d')](_0x4cdcaf));if(_0x4cdcaf[_0xf2a1('0x2e')]){if(_0x4cdcaf[_0xf2a1('0x2e')]['code']===0x1f4){logger[_0xf2a1('0x2e')]('ChatWebsite,\x20%s,\x20%s',_0x5e1307,_0x4cdcaf['error']['message']);return _0x9456a2(_0x4cdcaf['error'][_0xf2a1('0x2f')]);}logger[_0xf2a1('0x2e')]('ChatWebsite,\x20%s,\x20%s',_0x5e1307,_0x4cdcaf[_0xf2a1('0x2e')][_0xf2a1('0x2f')]);return _0x3253f0(_0x4cdcaf['error'][_0xf2a1('0x2f')]);}else{logger[_0xf2a1('0x28')]('ChatWebsite,\x20%s,\x20%s',_0x5e1307,_0xf2a1('0x2c'));_0x3253f0(_0x4cdcaf[_0xf2a1('0x30')]['message']);}})[_0xf2a1('0x31')](function(_0x1a4221){logger[_0xf2a1('0x2e')](_0xf2a1('0x29'),_0x5e1307,_0x1a4221);_0x9456a2(_0x1a4221);});});}function respondWithStatusCode(_0x389f40,_0x3b5aad){_0x3b5aad=_0x3b5aad||0xcc;return function(_0x14c32d){if(_0x14c32d){return _0x389f40['sendStatus'](_0x3b5aad);}return _0x389f40[_0xf2a1('0x32')](_0x3b5aad)[_0xf2a1('0x33')]();};}function respondWithResult(_0x392657,_0x1c2e6f){_0x1c2e6f=_0x1c2e6f||0xc8;return function(_0x5a5453){if(_0x5a5453){return _0x392657[_0xf2a1('0x32')](_0x1c2e6f)[_0xf2a1('0x34')](_0x5a5453);}};}function respondWithFilteredResult(_0x493f22,_0x4b5163){return function(_0x3c4b24){if(_0x3c4b24){var _0x422b52=_0x3c4b24[_0xf2a1('0x35')],_0x462195=_0x4b5163['offset'],_0x197336=_0x4b5163['offset']+_0x4b5163[_0xf2a1('0x36')],_0x4a4179;if(_0x197336>=_0x422b52){_0x197336=_0x422b52;_0x4a4179=0xc8;}else{_0x4a4179=0xce;}_0x493f22[_0xf2a1('0x32')](_0x4a4179);return _0x493f22[_0xf2a1('0x37')]('Content-Range',_0x462195+'-'+_0x197336+'/'+_0x422b52)[_0xf2a1('0x34')](_0x3c4b24);}return null;};}function patchUpdates(_0x35f09f){return function(_0x2e0bd7){try{jsonpatch[_0xf2a1('0x38')](_0x2e0bd7,_0x35f09f,!![]);}catch(_0x28cd89){return BPromise[_0xf2a1('0x39')](_0x28cd89);}return _0x2e0bd7[_0xf2a1('0x3a')]();};}function saveUpdates(_0x25d968,_0x2de022){return function(_0x57e5c3){if(_0x57e5c3){return _0x57e5c3[_0xf2a1('0x3b')](_0x25d968)[_0xf2a1('0x27')](function(_0x1e8211){return _0x1e8211;});}return null;};}function removeEntity(_0x215090,_0x4cc101){return function(_0x4dda41){if(_0x4dda41){return _0x4dda41[_0xf2a1('0x3c')]()[_0xf2a1('0x27')](function(){var _0x10402e=_0x4dda41['get']({'plain':!![]});var _0x497d17=_0xf2a1('0x3d');return db['UserProfileResource'][_0xf2a1('0x3c')]({'where':{'type':_0x497d17,'resourceId':_0x10402e['id']}})[_0xf2a1('0x27')](function(){return _0x4dda41;});})['then'](function(){_0x215090[_0xf2a1('0x32')](0xcc)[_0xf2a1('0x33')]();});}};}function handleEntityNotFound(_0x1dc415,_0x5006c5){return function(_0x45445a){if(!_0x45445a){_0x1dc415['sendStatus'](0x194);}return _0x45445a;};}function handleError(_0x22734b,_0x25fe32){_0x25fe32=_0x25fe32||0x1f4;return function(_0x1b7e68){logger[_0xf2a1('0x2e')](_0x1b7e68['stack']);if(_0x1b7e68[_0xf2a1('0x3e')]){delete _0x1b7e68[_0xf2a1('0x3e')];}_0x22734b[_0xf2a1('0x32')](_0x25fe32)[_0xf2a1('0x3f')](_0x1b7e68);};}exports[_0xf2a1('0x40')]=function(_0x21fb63,_0x57e096){var _0x119755={'include':[{'model':db[_0xf2a1('0x41')],'as':_0xf2a1('0x42')}]},_0x5ba857={},_0x51d3ca={'count':0x0,'rows':[]};var _0x4b9036=_[_0xf2a1('0x43')](db[_0xf2a1('0x44')][_0xf2a1('0x45')],function(_0x188a0b){return{'name':_0x188a0b['fieldName'],'type':_0x188a0b[_0xf2a1('0x46')][_0xf2a1('0x47')]};});_0x5ba857[_0xf2a1('0x48')]=_[_0xf2a1('0x43')](_0x4b9036,'name');_0x5ba857['query']=_[_0xf2a1('0x49')](_0x21fb63['query']);_0x5ba857[_0xf2a1('0x4a')]=_[_0xf2a1('0x4b')](_0x5ba857[_0xf2a1('0x48')],_0x5ba857[_0xf2a1('0x4c')]);_0x119755['attributes']=_['intersection'](_0x5ba857[_0xf2a1('0x48')],qs[_0xf2a1('0x4d')](_0x21fb63[_0xf2a1('0x4c')][_0xf2a1('0x4d')]));_0x119755[_0xf2a1('0x4e')]=_0x119755[_0xf2a1('0x4e')][_0xf2a1('0x4f')]?_0x119755['attributes']:_0x5ba857['model'];if(!_0x21fb63[_0xf2a1('0x4c')][_0xf2a1('0x50')](_0xf2a1('0x51'))){_0x119755[_0xf2a1('0x36')]=qs[_0xf2a1('0x36')](_0x21fb63['query'][_0xf2a1('0x36')]);_0x119755[_0xf2a1('0x52')]=qs['offset'](_0x21fb63[_0xf2a1('0x4c')][_0xf2a1('0x52')]);}_0x119755[_0xf2a1('0x53')]=qs[_0xf2a1('0x54')](_0x21fb63[_0xf2a1('0x4c')][_0xf2a1('0x54')]);_0x119755['where']=qs['filters'](_[_0xf2a1('0x55')](_0x21fb63[_0xf2a1('0x4c')],_0x5ba857['filters']));if(_0x21fb63[_0xf2a1('0x4c')][_0xf2a1('0x56')]){_0x119755[_0xf2a1('0x57')]=_['merge'](_0x119755[_0xf2a1('0x57')],{'$or':_[_0xf2a1('0x43')](_0x4b9036,function(_0x12b369){if(_0x12b369[_0xf2a1('0x46')]!=='VIRTUAL'){var _0x2b0d2a={};_0x2b0d2a[_0x12b369['name']]={'$like':'%'+_0x21fb63[_0xf2a1('0x4c')][_0xf2a1('0x56')]+'%'};return _0x2b0d2a;}})});}_0x119755=_[_0xf2a1('0x58')]({},_0x119755,_0x21fb63[_0xf2a1('0x59')]);var _0x2d5994={'where':_0x119755['where']};return db['ChatWebsite'][_0xf2a1('0x35')](_0x2d5994)[_0xf2a1('0x27')](function(_0x535dec){_0x51d3ca['count']=_0x535dec;if(_0x21fb63[_0xf2a1('0x4c')][_0xf2a1('0x5a')]){_0x119755[_0xf2a1('0x5b')]=[{'all':!![]}];}return db['ChatWebsite'][_0xf2a1('0x5c')](_0x119755);})[_0xf2a1('0x27')](function(_0x476b7c){_0x51d3ca['rows']=_0x476b7c;return _0x51d3ca;})[_0xf2a1('0x27')](respondWithFilteredResult(_0x57e096,_0x119755))[_0xf2a1('0x31')](handleError(_0x57e096,null));};exports[_0xf2a1('0x5d')]=function(_0x190d57,_0x50038a){var _0x9cffae={'raw':![],'where':{'id':_0x190d57[_0xf2a1('0x5e')]['id']},'include':[{'model':db[_0xf2a1('0x41')],'as':_0xf2a1('0x42')}]},_0x5c10a1={};_0x5c10a1['model']=_[_0xf2a1('0x49')](db['ChatWebsite'][_0xf2a1('0x45')]);_0x5c10a1[_0xf2a1('0x4c')]=_[_0xf2a1('0x49')](_0x190d57['query']);_0x5c10a1[_0xf2a1('0x4a')]=_[_0xf2a1('0x4b')](_0x5c10a1['model'],_0x5c10a1[_0xf2a1('0x4c')]);_0x9cffae[_0xf2a1('0x4e')]=_[_0xf2a1('0x4b')](_0x5c10a1['model'],qs[_0xf2a1('0x4d')](_0x190d57[_0xf2a1('0x4c')][_0xf2a1('0x4d')]));_0x9cffae[_0xf2a1('0x4e')]=_0x9cffae[_0xf2a1('0x4e')][_0xf2a1('0x4f')]?_0x9cffae['attributes']:_0x5c10a1[_0xf2a1('0x48')];if(_0x190d57[_0xf2a1('0x4c')][_0xf2a1('0x5a')]){_0x9cffae[_0xf2a1('0x5b')]=[{'all':!![]}];}_0x9cffae=_['merge']({},_0x9cffae,_0x190d57[_0xf2a1('0x59')]);return db[_0xf2a1('0x44')][_0xf2a1('0x5f')](_0x9cffae)['then'](handleEntityNotFound(_0x50038a,null))[_0xf2a1('0x27')](respondWithResult(_0x50038a,null))[_0xf2a1('0x31')](handleError(_0x50038a,null));};exports[_0xf2a1('0x60')]=function(_0x3cffea,_0x552638){return db[_0xf2a1('0x44')][_0xf2a1('0x60')](_0x3cffea['body'],{})[_0xf2a1('0x27')](function(_0x10ff0d){var _0x27d7d2=_0x3cffea['user'][_0xf2a1('0x61')]({'plain':!![]});if(!_0x27d7d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27d7d2[_0xf2a1('0x62')]===_0xf2a1('0x63')){var _0x384f98=_0x10ff0d['get']({'plain':!![]});var _0x43b121=_0xf2a1('0x3d');return db['UserProfileSection'][_0xf2a1('0x5f')]({'where':{'name':_0x43b121,'userProfileId':_0x27d7d2['userProfileId']},'raw':!![]})[_0xf2a1('0x27')](function(_0x2a78b2){if(_0x2a78b2&&_0x2a78b2[_0xf2a1('0x64')]===0x0){return db[_0xf2a1('0x65')]['create']({'name':_0x384f98[_0xf2a1('0x3e')],'resourceId':_0x384f98['id'],'type':_0x2a78b2[_0xf2a1('0x3e')],'sectionId':_0x2a78b2['id']},{})[_0xf2a1('0x27')](function(){return _0x10ff0d;});}else{return _0x10ff0d;}})[_0xf2a1('0x31')](function(_0x10aeab){logger['error'](_0xf2a1('0x66'),_0x10aeab);throw _0x10aeab;});}return _0x10ff0d;})[_0xf2a1('0x27')](respondWithResult(_0x552638,0xc9))[_0xf2a1('0x31')](handleError(_0x552638,null));};exports[_0xf2a1('0x3b')]=function(_0x271023,_0x5474cb){if(_0x271023[_0xf2a1('0x67')]['id']){delete _0x271023[_0xf2a1('0x67')]['id'];}return db[_0xf2a1('0x44')][_0xf2a1('0x5f')]({'where':{'id':_0x271023[_0xf2a1('0x5e')]['id']},'include':[{'model':db[_0xf2a1('0x41')],'as':_0xf2a1('0x42')}]})[_0xf2a1('0x27')](handleEntityNotFound(_0x5474cb,null))['then'](saveUpdates(_0x271023[_0xf2a1('0x67')],null))[_0xf2a1('0x27')](respondWithResult(_0x5474cb,null))[_0xf2a1('0x31')](handleError(_0x5474cb,null));};exports[_0xf2a1('0x3c')]=function(_0x455ae4,_0x3b6b67){return db[_0xf2a1('0x44')][_0xf2a1('0x5f')]({'where':{'id':_0x455ae4[_0xf2a1('0x5e')]['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x3b6b67,null))[_0xf2a1('0x27')](removeEntity(_0x3b6b67,null))[_0xf2a1('0x31')](handleError(_0x3b6b67,null));};exports[_0xf2a1('0x68')]=function(_0x240710,_0x44bed3){return db['ChatWebsite']['describe']()['then'](respondWithResult(_0x44bed3,null))[_0xf2a1('0x31')](handleError(_0x44bed3,null));};exports[_0xf2a1('0x69')]=function(_0xfcf474,_0x257015,_0x1a00f9){if(_0xfcf474[_0xf2a1('0x67')]['id']){delete _0xfcf474[_0xf2a1('0x67')]['id'];}return db[_0xf2a1('0x44')][_0xf2a1('0x5f')]({'where':{'id':_0xfcf474[_0xf2a1('0x5e')]['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x257015,null))[_0xf2a1('0x27')](function(_0x371135){if(_0x371135){_0xfcf474[_0xf2a1('0x67')][_0xf2a1('0x6a')]=_0x371135['id'];return db[_0xf2a1('0x6b')]['create'](_0xfcf474[_0xf2a1('0x67')]);}})[_0xf2a1('0x27')](respondWithResult(_0x257015,null))[_0xf2a1('0x31')](handleError(_0x257015,null));};exports['getDispositions']=function(_0x123eca,_0x43940c,_0x23a263){var _0x5f2798={'raw':![],'where':{}};var _0xa2199f={};var _0x21e824={'count':0x0,'rows':[]};return db[_0xf2a1('0x44')][_0xf2a1('0x6c')]({'where':{'id':_0x123eca[_0xf2a1('0x5e')]['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x43940c,null))[_0xf2a1('0x27')](function(_0x594567){if(_0x594567){_0xa2199f[_0xf2a1('0x48')]=_[_0xf2a1('0x49')](db['Disposition'][_0xf2a1('0x45')]);_0xa2199f[_0xf2a1('0x4c')]=_[_0xf2a1('0x49')](_0x123eca[_0xf2a1('0x4c')]);_0xa2199f['filters']=_[_0xf2a1('0x4b')](_0xa2199f[_0xf2a1('0x48')],_0xa2199f[_0xf2a1('0x4c')]);_0x5f2798[_0xf2a1('0x4e')]=_[_0xf2a1('0x4b')](_0xa2199f[_0xf2a1('0x48')],qs[_0xf2a1('0x4d')](_0x123eca[_0xf2a1('0x4c')]['fields']));_0x5f2798[_0xf2a1('0x4e')]=_0x5f2798[_0xf2a1('0x4e')][_0xf2a1('0x4f')]?_0x5f2798['attributes']:_0xa2199f[_0xf2a1('0x48')];if(!_0x123eca[_0xf2a1('0x4c')][_0xf2a1('0x50')](_0xf2a1('0x51'))){_0x5f2798['limit']=qs[_0xf2a1('0x36')](_0x123eca[_0xf2a1('0x4c')][_0xf2a1('0x36')]);_0x5f2798['offset']=qs[_0xf2a1('0x52')](_0x123eca['query'][_0xf2a1('0x52')]);}_0x5f2798[_0xf2a1('0x53')]=qs[_0xf2a1('0x54')](_0x123eca[_0xf2a1('0x4c')][_0xf2a1('0x54')]);_0x5f2798[_0xf2a1('0x57')]=qs['filters'](_['pick'](_0x123eca[_0xf2a1('0x4c')],_0xa2199f[_0xf2a1('0x4a')]));_0x5f2798['where'][_0xf2a1('0x6a')]=_0x594567['id'];if(_0x123eca['query'][_0xf2a1('0x56')]){_0x5f2798[_0xf2a1('0x57')]=_[_0xf2a1('0x58')](_0x5f2798[_0xf2a1('0x57')],{'$or':_['map'](_0x5f2798[_0xf2a1('0x4e')],function(_0x364ca6){var _0x1e5421={};_0x1e5421[_0x364ca6]={'$like':'%'+_0x123eca['query']['filter']+'%'};return _0x1e5421;})});}_0x5f2798=_['merge']({},_0x5f2798,_0x123eca[_0xf2a1('0x59')]);return db[_0xf2a1('0x6b')][_0xf2a1('0x35')]({'where':_0x5f2798[_0xf2a1('0x57')]})[_0xf2a1('0x27')](function(_0x4ee776){_0x21e824[_0xf2a1('0x35')]=_0x4ee776;if(_0x123eca[_0xf2a1('0x4c')][_0xf2a1('0x5a')]){_0x5f2798['include']=[{'all':!![]}];}return db[_0xf2a1('0x6b')][_0xf2a1('0x5c')](_0x5f2798);})[_0xf2a1('0x27')](function(_0x402bee){_0x21e824[_0xf2a1('0x6d')]=_0x402bee;return _0x21e824;});}})[_0xf2a1('0x27')](respondWithFilteredResult(_0x43940c,_0x5f2798))[_0xf2a1('0x31')](handleError(_0x43940c,null));};exports[_0xf2a1('0x6e')]=function(_0x3b8243,_0x3664c7,_0x3458fb){return db[_0xf2a1('0x44')]['find']({'where':{'id':_0x3b8243[_0xf2a1('0x5e')]['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x3664c7,null))[_0xf2a1('0x27')](function(_0x59da93){if(_0x59da93){return _0x59da93[_0xf2a1('0x6e')](_0x3b8243[_0xf2a1('0x4c')][_0xf2a1('0x6f')]);}})[_0xf2a1('0x27')](respondWithStatusCode(_0x3664c7,null))['catch'](handleError(_0x3664c7,null));};exports[_0xf2a1('0x70')]=function(_0x536668,_0x1a322e,_0x1b3b85){if(_0x536668[_0xf2a1('0x67')]['id']){delete _0x536668['body']['id'];}return db['ChatWebsite'][_0xf2a1('0x5f')]({'where':{'id':_0x536668[_0xf2a1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1a322e,null))['then'](function(_0x42f55e){if(_0x42f55e){_0x536668[_0xf2a1('0x67')]['ChatWebsiteId']=_0x42f55e['id'];return db[_0xf2a1('0x71')]['create'](_0x536668[_0xf2a1('0x67')]);}})['then'](respondWithResult(_0x1a322e,null))[_0xf2a1('0x31')](handleError(_0x1a322e,null));};exports[_0xf2a1('0x72')]=function(_0x32725b,_0x17b709,_0x518994){var _0x421b44={'raw':![],'where':{}};var _0x4228ea={};var _0x5e6eb4={'count':0x0,'rows':[]};return db[_0xf2a1('0x44')][_0xf2a1('0x6c')]({'where':{'id':_0x32725b['params']['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x17b709,null))['then'](function(_0x18c504){if(_0x18c504){_0x4228ea[_0xf2a1('0x48')]=_[_0xf2a1('0x49')](db['CannedAnswer'][_0xf2a1('0x45')]);_0x4228ea[_0xf2a1('0x4c')]=_[_0xf2a1('0x49')](_0x32725b[_0xf2a1('0x4c')]);_0x4228ea[_0xf2a1('0x4a')]=_['intersection'](_0x4228ea[_0xf2a1('0x48')],_0x4228ea[_0xf2a1('0x4c')]);_0x421b44[_0xf2a1('0x4e')]=_[_0xf2a1('0x4b')](_0x4228ea['model'],qs[_0xf2a1('0x4d')](_0x32725b[_0xf2a1('0x4c')][_0xf2a1('0x4d')]));_0x421b44[_0xf2a1('0x4e')]=_0x421b44['attributes'][_0xf2a1('0x4f')]?_0x421b44[_0xf2a1('0x4e')]:_0x4228ea['model'];if(!_0x32725b[_0xf2a1('0x4c')]['hasOwnProperty'](_0xf2a1('0x51'))){_0x421b44['limit']=qs['limit'](_0x32725b[_0xf2a1('0x4c')][_0xf2a1('0x36')]);_0x421b44[_0xf2a1('0x52')]=qs[_0xf2a1('0x52')](_0x32725b[_0xf2a1('0x4c')]['offset']);}_0x421b44[_0xf2a1('0x53')]=qs[_0xf2a1('0x54')](_0x32725b[_0xf2a1('0x4c')]['sort']);_0x421b44[_0xf2a1('0x57')]=qs['filters'](_[_0xf2a1('0x55')](_0x32725b[_0xf2a1('0x4c')],_0x4228ea['filters']));_0x421b44[_0xf2a1('0x57')]['ChatWebsiteId']=_0x18c504['id'];if(_0x32725b['query'][_0xf2a1('0x56')]){_0x421b44[_0xf2a1('0x57')]=_[_0xf2a1('0x58')](_0x421b44['where'],{'$or':_[_0xf2a1('0x43')](_0x421b44['attributes'],function(_0x1360a2){var _0x444fab={};_0x444fab[_0x1360a2]={'$like':'%'+_0x32725b[_0xf2a1('0x4c')][_0xf2a1('0x56')]+'%'};return _0x444fab;})});}_0x421b44=_[_0xf2a1('0x58')]({},_0x421b44,_0x32725b['options']);return db[_0xf2a1('0x71')][_0xf2a1('0x35')]({'where':_0x421b44['where']})[_0xf2a1('0x27')](function(_0x21f7d5){_0x5e6eb4[_0xf2a1('0x35')]=_0x21f7d5;if(_0x32725b[_0xf2a1('0x4c')][_0xf2a1('0x5a')]){_0x421b44[_0xf2a1('0x5b')]=[{'all':!![]}];}return db[_0xf2a1('0x71')][_0xf2a1('0x5c')](_0x421b44);})[_0xf2a1('0x27')](function(_0x4096b5){_0x5e6eb4[_0xf2a1('0x6d')]=_0x4096b5;return _0x5e6eb4;});}})[_0xf2a1('0x27')](respondWithFilteredResult(_0x17b709,_0x421b44))[_0xf2a1('0x31')](handleError(_0x17b709,null));};exports[_0xf2a1('0x73')]=function(_0xad68a4,_0x2ab783,_0x466999){return db['ChatWebsite']['find']({'where':{'id':_0xad68a4['params']['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x2ab783,null))[_0xf2a1('0x27')](function(_0x4935a6){if(_0x4935a6){return _0x4935a6['removeAnswers'](_0xad68a4['query'][_0xf2a1('0x6f')]);}})[_0xf2a1('0x27')](respondWithStatusCode(_0x2ab783,null))[_0xf2a1('0x31')](handleError(_0x2ab783,null));};exports[_0xf2a1('0x74')]=function(_0xe39448,_0x141040,_0x482127){_0xe39448[_0xf2a1('0x67')][_0xf2a1('0x75')]=_0xe39448[_0xf2a1('0x76')]['filename'];return db[_0xf2a1('0x44')][_0xf2a1('0x5f')]({'where':{'id':_0xe39448[_0xf2a1('0x5e')]['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x141040,null))[_0xf2a1('0x27')](saveUpdates(_0xe39448['body'],null))[_0xf2a1('0x27')](respondWithResult(_0x141040,null))[_0xf2a1('0x31')](handleError(_0x141040,null));};exports[_0xf2a1('0x77')]=function(_0x28b534,_0x1217d1,_0x5dc43d){_0x28b534[_0xf2a1('0x67')][_0xf2a1('0x78')]=_0x28b534[_0xf2a1('0x76')][_0xf2a1('0x79')];return db[_0xf2a1('0x44')][_0xf2a1('0x5f')]({'where':{'id':_0x28b534[_0xf2a1('0x5e')]['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x1217d1,null))[_0xf2a1('0x27')](saveUpdates(_0x28b534[_0xf2a1('0x67')],null))[_0xf2a1('0x27')](respondWithResult(_0x1217d1,null))['catch'](handleError(_0x1217d1,null));};exports[_0xf2a1('0x7a')]=function(_0x1c3f2d,_0x2fb66c,_0x2f0b09){_0x1c3f2d['body'][_0xf2a1('0x7b')]=_0x1c3f2d[_0xf2a1('0x76')][_0xf2a1('0x79')];return db[_0xf2a1('0x44')][_0xf2a1('0x5f')]({'where':{'id':_0x1c3f2d[_0xf2a1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2fb66c,null))[_0xf2a1('0x27')](saveUpdates(_0x1c3f2d[_0xf2a1('0x67')],null))[_0xf2a1('0x27')](respondWithResult(_0x2fb66c,null))[_0xf2a1('0x31')](handleError(_0x2fb66c,null));};exports['addSystemAvatar']=function(_0x267524,_0x5dc4bb,_0x222e58){_0x267524[_0xf2a1('0x67')]['systemAvatar']=_0x267524['file']['filename'];return db[_0xf2a1('0x44')][_0xf2a1('0x5f')]({'where':{'id':_0x267524['params']['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x5dc4bb,null))[_0xf2a1('0x27')](saveUpdates(_0x267524[_0xf2a1('0x67')],null))[_0xf2a1('0x27')](respondWithResult(_0x5dc4bb,null))['catch'](handleError(_0x5dc4bb,null));};exports['getLogo']=function(_0x387776,_0x42979d,_0x61d73b){var _0x476e15=path[_0xf2a1('0x7c')](config[_0xf2a1('0x7d')],_0xf2a1('0x7e'));var _0x2cab1e={'where':{'id':_0x387776[_0xf2a1('0x5e')]['id']},'attributes':['id',_0xf2a1('0x75')],'raw':!![]};var _0x119f9d=![];return require(_0xf2a1('0x7f'))[_0xf2a1('0x80')]()[_0xf2a1('0x27')](function(_0x11c576){if(_0x11c576){_0x119f9d=_0x11c576[_0xf2a1('0x81')];}})['then'](function(){return db['ChatWebsite'][_0xf2a1('0x5f')](_0x2cab1e);})[_0xf2a1('0x27')](handleEntityNotFound(_0x42979d,null))[_0xf2a1('0x27')](function(_0x56ff8f){if(_0x56ff8f){if(!_[_0xf2a1('0x82')](_0x56ff8f[_0xf2a1('0x75')])){if(fs[_0xf2a1('0x83')](path['join'](config['root'],_0xf2a1('0x84'),_0x56ff8f[_0xf2a1('0x75')]))&&_0x119f9d){_0x476e15=path[_0xf2a1('0x7c')](config[_0xf2a1('0x7d')],_0xf2a1('0x84'),_0x56ff8f[_0xf2a1('0x75')]);}}return _0x42979d[_0xf2a1('0x85')](_0x476e15);}})[_0xf2a1('0x31')](handleError(_0x42979d,null));};exports[_0xf2a1('0x86')]=function(_0x34d556,_0x33c63f,_0x496b08){var _0xc14993=path[_0xf2a1('0x7c')](config[_0xf2a1('0x7d')],_0xf2a1('0x87'));var _0x5eea23={'where':{'id':_0x34d556[_0xf2a1('0x5e')]['id']},'attributes':['id',_0xf2a1('0x78')],'raw':!![]};return db[_0xf2a1('0x44')][_0xf2a1('0x5f')](_0x5eea23)['then'](handleEntityNotFound(_0x33c63f,null))[_0xf2a1('0x27')](function(_0x3bd59b){if(_0x3bd59b){if(!_[_0xf2a1('0x82')](_0x3bd59b[_0xf2a1('0x78')])){if(fs['existsSync'](path[_0xf2a1('0x7c')](config[_0xf2a1('0x7d')],_0xf2a1('0x88'),_0x3bd59b[_0xf2a1('0x78')]))){_0xc14993=path[_0xf2a1('0x7c')](config[_0xf2a1('0x7d')],_0xf2a1('0x88'),_0x3bd59b[_0xf2a1('0x78')]);}}return _0x33c63f[_0xf2a1('0x85')](_0xc14993);}})[_0xf2a1('0x31')](handleError(_0x33c63f,null));};exports[_0xf2a1('0x89')]=function(_0x418ed2,_0xb1d0fa,_0x32a2d2){var _0x1ec568=path[_0xf2a1('0x7c')](config[_0xf2a1('0x7d')],'server/files/images/avatars/customer_avatar.png');var _0x32e061={'where':{'id':_0x418ed2[_0xf2a1('0x5e')]['id']},'attributes':['id',_0xf2a1('0x7b'),_0xf2a1('0x8a')],'raw':!![]};return db[_0xf2a1('0x44')][_0xf2a1('0x5f')](_0x32e061)[_0xf2a1('0x27')](handleEntityNotFound(_0xb1d0fa,null))[_0xf2a1('0x27')](function(_0x7d5144){if(_0x7d5144){if(!_[_0xf2a1('0x82')](_0x7d5144[_0xf2a1('0x7b')])){if(fs[_0xf2a1('0x83')](path[_0xf2a1('0x7c')](config[_0xf2a1('0x7d')],_0xf2a1('0x88'),_0x7d5144['customerAvatar']))&&_0x7d5144['showCustomerAvatar']){_0x1ec568=path['join'](config['root'],_0xf2a1('0x88'),_0x7d5144[_0xf2a1('0x7b')]);}}return _0xb1d0fa[_0xf2a1('0x85')](_0x1ec568);}})[_0xf2a1('0x31')](handleError(_0xb1d0fa,null));};exports[_0xf2a1('0x8b')]=function(_0x4865a5,_0x9af36c,_0x2469d6){var _0x463cca=path['join'](config['root'],_0xf2a1('0x8c'));var _0x38f5e={'where':{'id':_0x4865a5[_0xf2a1('0x5e')]['id']},'attributes':['id',_0xf2a1('0x8d')],'raw':!![]};return db['ChatWebsite'][_0xf2a1('0x5f')](_0x38f5e)[_0xf2a1('0x27')](handleEntityNotFound(_0x9af36c,null))[_0xf2a1('0x27')](function(_0x460a9f){if(_0x460a9f){if(!_[_0xf2a1('0x82')](_0x460a9f['systemAvatar'])){if(fs[_0xf2a1('0x83')](path[_0xf2a1('0x7c')](config[_0xf2a1('0x7d')],_0xf2a1('0x88'),_0x460a9f['systemAvatar']))){_0x463cca=path[_0xf2a1('0x7c')](config[_0xf2a1('0x7d')],_0xf2a1('0x88'),_0x460a9f[_0xf2a1('0x8d')]);}}return _0x9af36c[_0xf2a1('0x85')](_0x463cca);}})[_0xf2a1('0x31')](handleError(_0x9af36c,null));};exports['notify']=function(_0x1c5376,_0x560837,_0x45789b){var _0x367614=require(_0xf2a1('0x8e'));var _0x494ff8=new _0x367614();var _0x42b2c6=_0x494ff8[_0xf2a1('0x8f')](_0x1c5376['headers'][_0xf2a1('0x90')])['getResult']();var _0x4d6b53={'body':_0x1c5376[_0xf2a1('0x67')],'channel':_0xf2a1('0x91')};var _0x12d1fc=[];var _0x1911ef=[];var _0x5b8baa={};var _0x206a25=![];return db['CmContact'][_0xf2a1('0x68')]()[_0xf2a1('0x27')](function(_0x48409e){if(!_0x48409e){throw new db[(_0xf2a1('0x24'))][(_0xf2a1('0x25'))](_0xf2a1('0x92'));}_0x12d1fc=_[_0xf2a1('0x93')](_[_0xf2a1('0x49')](_0x48409e),['createdAt','updatedAt']);_0x1911ef=_['difference'](_[_0xf2a1('0x49')](_0x48409e),[_0xf2a1('0x94'),'updatedAt','CompanyId',_0xf2a1('0x95')]);if(_0x1c5376[_0xf2a1('0x67')]['id']){delete _0x1c5376[_0xf2a1('0x67')]['id'];}if(_['isNil'](_0x1c5376[_0xf2a1('0x67')][_0xf2a1('0x96')])){throw new db[(_0xf2a1('0x24'))]['ValidationError'](_0xf2a1('0x97'));}if(_['isNil'](_0x1c5376[_0xf2a1('0x67')][_0xf2a1('0x67')])||_0x1c5376[_0xf2a1('0x67')][_0xf2a1('0x67')]===''){throw new db[(_0xf2a1('0x24'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1c5376['body'][_0xf2a1('0x98')])){throw new db[(_0xf2a1('0x24'))][(_0xf2a1('0x25'))](_0xf2a1('0x99')+_0x1911ef);}if(!_[_0xf2a1('0x9a')](_0x1911ef,_0x1c5376['body'][_0xf2a1('0x98')])){throw new db[(_0xf2a1('0x24'))][(_0xf2a1('0x25'))](_0xf2a1('0x9b')+_0x1911ef);}_0x5b8baa[_0x1c5376[_0xf2a1('0x67')][_0xf2a1('0x98')]]=_0x1c5376['body'][_0xf2a1('0x96')];})[_0xf2a1('0x27')](function(){return db[_0xf2a1('0x44')][_0xf2a1('0x5f')]({'where':{'id':_0x1c5376['params']['id']},'include':[{'model':db['CmList'],'as':_0xf2a1('0x9c'),'include':[{'model':db[_0xf2a1('0x9d')],'as':_0xf2a1('0x9e'),'where':_0x5b8baa,'limit':0x1,'order':[[_0xf2a1('0x9f'),_0xf2a1('0xa0')]]}]},{'model':db['ChatApplication'],'as':_0xf2a1('0xa1')}]});})['then'](handleEntityNotFound(_0x560837,null))[_0xf2a1('0x27')](function(_0x4e84cd){if(_0x4e84cd&&_0x4e84cd[_0xf2a1('0x9c')]){_0x4d6b53['account']=_0x4e84cd;_0x4d6b53[_0xf2a1('0xa2')]=_0x4e84cd[_0xf2a1('0xa1')];_0x4d6b53[_0xf2a1('0xa3')]=_0x4e84cd[_0xf2a1('0x9c')];_0x4d6b53[_0xf2a1('0xa2')]=_[_0xf2a1('0xa4')](_0x4d6b53[_0xf2a1('0xa2')],[_0xf2a1('0xa5')],[_0xf2a1('0xa6')]);if(_0x4d6b53[_0xf2a1('0xa7')][_0xf2a1('0xa1')]){delete _0x4d6b53[_0xf2a1('0xa7')][_0xf2a1('0xa1')];}if(_0x4d6b53[_0xf2a1('0xa7')]['List']&&_0x4d6b53[_0xf2a1('0xa7')]['List'][_0xf2a1('0x9e')][_0xf2a1('0x4f')]){return _0x4d6b53[_0xf2a1('0xa7')][_0xf2a1('0x9c')][_0xf2a1('0x9e')][0x0];}var _0x31286a=_[_0xf2a1('0x1b')](_0x1c5376[_0xf2a1('0x67')],{'firstName':_0x1c5376[_0xf2a1('0x67')][_0xf2a1('0x96')],'ListId':_0x4e84cd[_0xf2a1('0x95')]});_0x31286a[_0x1c5376[_0xf2a1('0x67')]['mapKey']]=_0x1c5376[_0xf2a1('0x67')][_0xf2a1('0x96')];return db[_0xf2a1('0x9d')][_0xf2a1('0x60')](_0x31286a,{'fields':_0x12d1fc,'raw':!![]});}})[_0xf2a1('0x27')](handleEntityNotFound(_0x560837,null))[_0xf2a1('0x27')](function(_0x3efa1a){_0x4d6b53['contact']=_0x3efa1a;var _0x28a45a=_0x1c5376['body']['customerIp'];if(_0x1c5376['headers'][_0xf2a1('0xa8')]){_0x28a45a=_0x1c5376[_0xf2a1('0xa9')][_0xf2a1('0xa8')];}else if(_0x1c5376['headers'][_0xf2a1('0xaa')]){_0x28a45a=_[_0xf2a1('0xab')](_0x1c5376['headers'][_0xf2a1('0xaa')][_0xf2a1('0xac')](','));}if(_0x3efa1a){var _0x17b22f={'ContactId':_0x3efa1a['id'],'ChatWebsiteId':_0x1c5376[_0xf2a1('0x5e')]['id'],'from':(_0x3efa1a[_0xf2a1('0xad')]||'')+'\x20'+(_0x3efa1a[_0xf2a1('0xae')]||''),'customerIp':_0x28a45a,'customerPort':_0x1c5376['headers']['x-real-port']?_0x1c5376[_0xf2a1('0xa9')][_0xf2a1('0xaf')]:null,'referer':_0x1c5376['body']['referer'],'browserName':_0x42b2c6['browser']['name']&&_0x42b2c6[_0xf2a1('0xb0')]['version']?util[_0xf2a1('0xb1')](_0xf2a1('0xb2'),_0x42b2c6[_0xf2a1('0xb0')][_0xf2a1('0x3e')],_0x42b2c6[_0xf2a1('0xb0')]['version']):_0xf2a1('0xb3'),'browserVersion':_0x42b2c6[_0xf2a1('0xb0')][_0xf2a1('0xb4')]||_0xf2a1('0xb3'),'osName':util[_0xf2a1('0xb1')](_0xf2a1('0xb2'),_0x42b2c6['os']['name'],_0x42b2c6['os'][_0xf2a1('0xb4')]),'osVersion':_0x42b2c6['os'][_0xf2a1('0xb4')],'deviceModel':_0x42b2c6[_0xf2a1('0xb5')][_0xf2a1('0x48')]&&_0x42b2c6['device'][_0xf2a1('0xb6')]?util[_0xf2a1('0xb1')]('%s\x20%s\x20%s',_0x42b2c6[_0xf2a1('0xb5')][_0xf2a1('0x48')],_0x42b2c6['device'][_0xf2a1('0xb6')],_0x42b2c6['device']['type']):null,'deviceVendor':_0x42b2c6[_0xf2a1('0xb5')][_0xf2a1('0xb6')],'deviceType':_0x42b2c6[_0xf2a1('0xb5')]['type'],'formData':JSON[_0xf2a1('0x2d')](_0x1c5376[_0xf2a1('0x67')])};var _0x2ca098={'ChatWebsiteId':_0x1c5376[_0xf2a1('0x5e')]['id'],'closed':![]};if(_0x1c5376[_0xf2a1('0x67')]['threadId']){_0x2ca098[_0xf2a1('0xb7')]=_0x1c5376[_0xf2a1('0x67')][_0xf2a1('0xb7')];return db[_0xf2a1('0xb8')][_0xf2a1('0x5f')]({'where':_0x2ca098})['then'](function(_0x397171){if(_0x397171){return[_0x397171,![]];}_0x17b22f[_0xf2a1('0xb7')]=_0x1c5376[_0xf2a1('0x67')][_0xf2a1('0xb7')];_0x17b22f[_0xf2a1('0xb9')]=_0x1c5376[_0xf2a1('0x67')][_0xf2a1('0xb9')];return db['ChatInteraction'][_0xf2a1('0x60')](_0x17b22f)[_0xf2a1('0x27')](function(_0x2162fb){return[_0x2162fb,!![]];});});}_0x2ca098[_0xf2a1('0xba')]=_0x3efa1a['id'];if(_0x1c5376[_0xf2a1('0x67')]['interaction']&&_0x1c5376[_0xf2a1('0x67')]['interaction']['id']){_0x2ca098['id']=_0x1c5376['body'][_0xf2a1('0xbb')]['id'];return db[_0xf2a1('0xb8')][_0xf2a1('0x5f')]({'where':_0x2ca098})[_0xf2a1('0x27')](function(_0x444d1a){if(_0x444d1a){return[_0x444d1a,![]];}return db['ChatInteraction']['create'](_0x17b22f)['then'](function(_0x28319e){return[_0x28319e,!![]];});});}return db[_0xf2a1('0xb8')][_0xf2a1('0x60')](_0x17b22f)[_0xf2a1('0x27')](function(_0x321a0e){return[_0x321a0e,!![]];});}})['spread'](function(_0x1cc8d6,_0x9a0320){if(_0x1cc8d6){_0x206a25=_0x9a0320;if(!_0x9a0320){var _0x487538={'from':(_0x4d6b53[_0xf2a1('0xbc')]['firstName']||'')+'\x20'+(_0x4d6b53[_0xf2a1('0xbc')][_0xf2a1('0xae')]||'')};if(_0x1c5376[_0xf2a1('0x67')][_0xf2a1('0xb7')]&&_0x1c5376['body'][_0xf2a1('0xbd')]&&_0x1c5376[_0xf2a1('0x67')][_0xf2a1('0xb7')]!=_0x1c5376[_0xf2a1('0x67')][_0xf2a1('0xbd')]){_0x487538[_0xf2a1('0xb7')]=_0x1c5376['body'][_0xf2a1('0xbd')];}return _0x1cc8d6['update'](_0x487538);}else{return _0x1cc8d6;}}})[_0xf2a1('0x27')](function(_0x3f50f6){_0x4d6b53[_0xf2a1('0xbb')]=_0x3f50f6[_0xf2a1('0x61')]({'plain':!![]});_0x4d6b53[_0xf2a1('0xbb')][_0xf2a1('0xbe')]=_0x206a25;if(_0x4d6b53[_0xf2a1('0xbb')][_0xf2a1('0xbe')]){if(_0x4d6b53['account']['autoclose']){_0x4d6b53[_0xf2a1('0xa2')]['push']({'id':0x0,'priority':_0x4d6b53[_0xf2a1('0xa2')][_0xf2a1('0x4f')]+0x1,'app':_0xf2a1('0xbf'),'appdata':_0xf2a1('0xc0'),'interval':_0xf2a1('0xc1')});}}return db['ChatMessage']['create']({'body':_0x1c5376[_0xf2a1('0x67')][_0xf2a1('0x67')],'ChatWebsiteId':_0x1c5376[_0xf2a1('0x5e')]['id'],'ChatInteractionId':_0x3f50f6['id'],'direction':'in','ContactId':_0x4d6b53[_0xf2a1('0xbc')]['id'],'AttachmentId':_0x1c5376[_0xf2a1('0x67')][_0xf2a1('0xc2')]});})[_0xf2a1('0x27')](function(_0x3d4691){_0x4d6b53[_0xf2a1('0x2f')]=_0x3d4691;if(_0x4d6b53[_0xf2a1('0xbb')][_0xf2a1('0xc3')]){return db[_0xf2a1('0xc4')][_0xf2a1('0x5f')]({'attributes':['id','name'],'where':{'id':_0x4d6b53[_0xf2a1('0xbb')][_0xf2a1('0xc3')]}})[_0xf2a1('0x27')](function(_0x275130){if(_0x275130){_0x4d6b53[_0xf2a1('0xa2')][_0xf2a1('0xc5')]({'id':0x0,'priority':0x0,'app':_0xf2a1('0xc6'),'appdata':_0x275130[_0xf2a1('0x3e')]+','+(_0x4d6b53['account'][_0xf2a1('0xc7')]||0xa),'interval':_0xf2a1('0xc1')});_0x4d6b53[_0xf2a1('0xc8')]=!![];}return respondWithRpcPromise(_0xf2a1('0xc9'),_0xf2a1('0xca'),_0x4d6b53);});}return respondWithRpcPromise('Start',_0xf2a1('0xca'),_0x4d6b53);})[_0xf2a1('0x27')](function(_0x3468c0){respondWithRpcPromise(_0xf2a1('0xcb'),_0xf2a1('0xcb'),{'event':_0xf2a1('0xcc'),'message':_0x3468c0},client9002);return _0x3468c0;})[_0xf2a1('0x27')](respondWithResult(_0x560837,null))[_0xf2a1('0x31')](handleError(_0x560837,null));};exports['offline']=function(_0x2e7ebd,_0x5e8e5c,_0x3358ab){var _0xe90a1a,_0x407d95,_0x40710d;var _0x5baa44=[];var _0x5e606b=[];var _0x4745e9={};return db['CmContact'][_0xf2a1('0x68')]()[_0xf2a1('0x27')](function(_0x406ff4){if(!_0x406ff4){throw new db[(_0xf2a1('0x24'))][(_0xf2a1('0x25'))]('no\x20available\x20attributes');}_0x5e606b=_[_0xf2a1('0x93')](_[_0xf2a1('0x49')](_0x406ff4),[_0xf2a1('0x94'),_0xf2a1('0x9f')]);_0x5baa44=_[_0xf2a1('0x93')](_['keys'](_0x406ff4),['createdAt',_0xf2a1('0x9f'),_0xf2a1('0xcd'),_0xf2a1('0x95')]);if(_0x2e7ebd[_0xf2a1('0x67')]['id']){delete _0x2e7ebd[_0xf2a1('0x67')]['id'];}if(_['isNil'](_0x2e7ebd[_0xf2a1('0x67')][_0xf2a1('0x96')])){throw _0x5e8e5c[_0xf2a1('0x32')](0x1f4)[_0xf2a1('0x3f')](new db[(_0xf2a1('0x24'))][(_0xf2a1('0x25'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x2e7ebd[_0xf2a1('0x67')][_0xf2a1('0x67')])||_0x2e7ebd[_0xf2a1('0x67')][_0xf2a1('0x67')]===''){throw _0x5e8e5c['status'](0x1f4)[_0xf2a1('0x3f')](new db['Sequelize']['ValidationError'](_0xf2a1('0xce')));}if(_[_0xf2a1('0x82')](_0x2e7ebd[_0xf2a1('0x67')][_0xf2a1('0xcf')])){throw _0x5e8e5c[_0xf2a1('0x32')](0x1f4)[_0xf2a1('0x3f')](new db[(_0xf2a1('0x24'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5baa44));}if(!_[_0xf2a1('0x9a')](_0x5baa44,_0x2e7ebd[_0xf2a1('0x67')][_0xf2a1('0xcf')])){throw _0x5e8e5c['status'](0x1f4)[_0xf2a1('0x3f')](new db[(_0xf2a1('0x24'))]['ValidationError'](_0xf2a1('0xd0')+_0x5baa44));}_0x4745e9[_0x2e7ebd['body']['mapKeyOffline']]=_0x2e7ebd[_0xf2a1('0x67')][_0xf2a1('0x96')];})[_0xf2a1('0x27')](function(){return db[_0xf2a1('0x44')][_0xf2a1('0x5f')]({'where':{'id':_0x2e7ebd[_0xf2a1('0x5e')]['id']},'include':[{'model':db[_0xf2a1('0xd1')],'as':_0xf2a1('0x9c')}]});})[_0xf2a1('0x27')](handleEntityNotFound(_0x5e8e5c,null))[_0xf2a1('0x27')](function(_0x5977b7){if(_0x5977b7&&_0x5977b7[_0xf2a1('0x9c')]){_0x407d95=_0x5977b7;var _0x7380b9=_[_0xf2a1('0x1b')](_0x2e7ebd['body'],{'firstName':_0x2e7ebd[_0xf2a1('0x67')][_0xf2a1('0x96')],'phone':_0x2e7ebd['body'][_0xf2a1('0x96')],'ListId':_0x5977b7['ListId']});_0x7380b9[_0x2e7ebd[_0xf2a1('0x67')]['mapKeyOffline']]=_0x2e7ebd['body'][_0xf2a1('0x96')];return db[_0xf2a1('0x9d')][_0xf2a1('0xd2')]({'where':_0x4745e9,'defaults':_0x7380b9});}})[_0xf2a1('0xd3')](function(_0x7b8510){if(_0x7b8510){_0x40710d=_0x7b8510;var _0x2d914c=fs[_0xf2a1('0xd4')](path[_0xf2a1('0x7c')](config[_0xf2a1('0x7d')],_0xf2a1('0xd5')),'utf8');var _0x523cce=ejs[_0xf2a1('0xd6')](_0x2d914c,{'body':_[_0xf2a1('0xd7')](_0x2e7ebd[_0xf2a1('0x67')]['body']),'bodyTitle':_0x407d95[_0xf2a1('0xd8')]});return db['ChatOfflineMessage'][_0xf2a1('0x60')]({'body':_0x523cce,'ContactId':_0x7b8510['id'],'ChatWebsiteId':_0x407d95['id']});}})['then'](function(_0x70035e){if(_0x70035e){_0xe90a1a=_0x70035e;return db[_0xf2a1('0xd9')][_0xf2a1('0x6c')]({'where':{'service':!![]},'include':[{'model':db[_0xf2a1('0xda')],'as':_0xf2a1('0xdb'),'raw':!![]}]});}})['then'](function(_0x42f147){if(_0x42f147&&_0x42f147[_0xf2a1('0xdb')]&&_0x407d95[_0xf2a1('0xdc')]){var _0x1d9af9={'tls':{'rejectUnauthorized':![]}};if(_0x42f147['Smtp'][_0xf2a1('0xdd')]){_0x1d9af9[_0xf2a1('0xdd')]=_0x42f147['Smtp']['service'];}else{_0x1d9af9['host']=_0x42f147[_0xf2a1('0xdb')][_0xf2a1('0xde')];_0x1d9af9[_0xf2a1('0xdf')]=_0x42f147[_0xf2a1('0xdb')][_0xf2a1('0xdf')];_0x1d9af9[_0xf2a1('0xe0')]=_0x42f147[_0xf2a1('0xdb')][_0xf2a1('0xe0')];}if(_0x42f147[_0xf2a1('0xdb')][_0xf2a1('0xe1')]){_0x1d9af9[_0xf2a1('0xe2')]={'user':_0x42f147[_0xf2a1('0xdb')]['user'],'pass':_0x42f147[_0xf2a1('0xdb')]['pass']};}return respondWithRpcPromise(_0xf2a1('0xe3'),_0xf2a1('0xe4'),{'account':_0x1d9af9,'message':{'from':util[_0xf2a1('0xb1')](_0xf2a1('0xe5'),_0x42f147[_0xf2a1('0x3e')],_0x42f147[_0xf2a1('0xe6')]||_0x42f147[_0xf2a1('0xdb')][_0xf2a1('0x63')]),'to':_0x407d95['forwardOfflineAddress'],'subject':_0x407d95[_0xf2a1('0xe7')],'text':_0xe90a1a[_0xf2a1('0x67')]}},client9003)[_0xf2a1('0x27')](function(){return _0xe90a1a;})[_0xf2a1('0x31')](function(_0x196a0f){console[_0xf2a1('0x2e')](_0x196a0f);});}})[_0xf2a1('0x27')](function(){if(_0xe90a1a){return _0xe90a1a;}})['then'](respondWithResult(_0x5e8e5c,null))['catch'](handleError(_0x5e8e5c,null));};exports['addInteraction']=function(_0x581c45,_0x20372a,_0x14f35a){return db[_0xf2a1('0xb8')][_0xf2a1('0x5f')]({'where':{'id':_0x581c45[_0xf2a1('0x5e')]['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x20372a,null))[_0xf2a1('0x27')](function(_0x433599){if(_0x433599){return _0x433599[_0xf2a1('0xe8')](_0x581c45[_0xf2a1('0x67')][_0xf2a1('0x6f')],_['omit'](_0x581c45['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x20372a,null))[_0xf2a1('0x31')](handleError(_0x20372a,null));};exports[_0xf2a1('0xe9')]=function(_0x1ea9bf,_0x233d9a,_0x342d91){var _0x8c30c5={'raw':![],'where':{}};var _0x3f361a={};var _0x3bee0c={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xf2a1('0x6c')]({'where':{'id':_0x1ea9bf[_0xf2a1('0x5e')]['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x233d9a,null))[_0xf2a1('0x27')](function(_0x45bc39){if(_0x45bc39){_0x3f361a[_0xf2a1('0x48')]=_['keys'](db[_0xf2a1('0xb8')][_0xf2a1('0x45')]);_0x3f361a[_0xf2a1('0x4c')]=_[_0xf2a1('0x49')](_0x1ea9bf[_0xf2a1('0x4c')]);_0x3f361a[_0xf2a1('0x4a')]=_[_0xf2a1('0x4b')](_0x3f361a['model'],_0x3f361a[_0xf2a1('0x4c')]);_0x8c30c5[_0xf2a1('0x4e')]=_[_0xf2a1('0x4b')](_0x3f361a[_0xf2a1('0x48')],qs['fields'](_0x1ea9bf[_0xf2a1('0x4c')][_0xf2a1('0x4d')]));_0x8c30c5[_0xf2a1('0x4e')]=_0x8c30c5[_0xf2a1('0x4e')][_0xf2a1('0x4f')]?_0x8c30c5[_0xf2a1('0x4e')]:_0x3f361a[_0xf2a1('0x48')];if(!_0x1ea9bf[_0xf2a1('0x4c')][_0xf2a1('0x50')](_0xf2a1('0x51'))){_0x8c30c5[_0xf2a1('0x36')]=qs['limit'](_0x1ea9bf[_0xf2a1('0x4c')][_0xf2a1('0x36')]);_0x8c30c5['offset']=qs[_0xf2a1('0x52')](_0x1ea9bf[_0xf2a1('0x4c')]['offset']);}_0x8c30c5[_0xf2a1('0x53')]=qs[_0xf2a1('0x54')](_0x1ea9bf[_0xf2a1('0x4c')][_0xf2a1('0x54')]);_0x8c30c5[_0xf2a1('0x57')]=qs[_0xf2a1('0x4a')](_[_0xf2a1('0x55')](_0x1ea9bf[_0xf2a1('0x4c')],_0x3f361a[_0xf2a1('0x4a')]));_0x8c30c5['where'][_0xf2a1('0x6a')]=_0x45bc39['id'];if(_0x1ea9bf[_0xf2a1('0x4c')][_0xf2a1('0x56')]){_0x8c30c5[_0xf2a1('0x57')]=_[_0xf2a1('0x58')](_0x8c30c5[_0xf2a1('0x57')],{'$or':_[_0xf2a1('0x43')](_0x8c30c5[_0xf2a1('0x4e')],function(_0x1b23dc){var _0x20c2c9={};_0x20c2c9[_0x1b23dc]={'$like':'%'+_0x1ea9bf[_0xf2a1('0x4c')]['filter']+'%'};return _0x20c2c9;})});}_0x8c30c5=_[_0xf2a1('0x58')]({},_0x8c30c5,_0x1ea9bf[_0xf2a1('0x59')]);return db[_0xf2a1('0xb8')][_0xf2a1('0x35')]({'where':_0x8c30c5[_0xf2a1('0x57')]})[_0xf2a1('0x27')](function(_0x24260d){_0x3bee0c[_0xf2a1('0x35')]=_0x24260d;if(_0x1ea9bf['query']['includeAll']){_0x8c30c5[_0xf2a1('0x5b')]=[{'model':db[_0xf2a1('0x9d')],'as':_0xf2a1('0xea'),'required':![]},{'model':db[_0xf2a1('0xc4')],'as':_0xf2a1('0xeb'),'attributes':[_0xf2a1('0x3e'),_0xf2a1('0xec'),'internal'],'required':![]},{'model':db[_0xf2a1('0xed')],'as':_0xf2a1('0xee'),'attributes':['id','name','color'],'where':_0x1ea9bf[_0xf2a1('0x4c')][_0xf2a1('0xef')]?{'id':_0x1ea9bf[_0xf2a1('0x4c')]['tag']}:undefined,'required':_0x1ea9bf[_0xf2a1('0x4c')][_0xf2a1('0xef')]?!![]:![]}];}return db[_0xf2a1('0xb8')]['findAll'](_0x8c30c5);})['then'](function(_0x5cae36){_0x3bee0c[_0xf2a1('0x6d')]=_0x5cae36;return _0x3bee0c;});}})['then'](respondWithFilteredResult(_0x233d9a,_0x8c30c5))[_0xf2a1('0x31')](handleError(_0x233d9a,null));};function iftimePromise(_0x4a3212,_0xc76792){return respondWithRpcPromise(_0xf2a1('0xf0'),_0xf2a1('0xf1'),{'command':_0xc76792['timezone']?util[_0xf2a1('0xb1')](_0xf2a1('0xf2'),_0x4a3212[_0xf2a1('0xf3')],_0xc76792['timezone']):util['format']('iftime\x20%s',_0x4a3212[_0xf2a1('0xf3')])},client9002)[_0xf2a1('0x27')](function(_0x5aec76){var _0x14666a=_0x5aec76&&_0x5aec76[_0xf2a1('0xf4')]('true')>=0x0?!![]:![];logger[_0xf2a1('0x28')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0xc76792['id'],_0x4a3212['id'],_0x4a3212[_0xf2a1('0xf3')],_0x14666a?_0xf2a1('0xf5'):_0xf2a1('0xf6'),_0xc76792['timezone']?_0xc76792[_0xf2a1('0xf7')]:_0xf2a1('0xf8'));return _0x14666a;})[_0xf2a1('0x31')](function(_0x1d4268){logger[_0xf2a1('0x2e')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0xc76792['id'],_0x4a3212['id'],_0x4a3212[_0xf2a1('0xf3')],util[_0xf2a1('0xf9')](_0x1d4268,{'showHidden':![],'depth':null}),_0xc76792[_0xf2a1('0xf7')]?_0xc76792[_0xf2a1('0xf7')]:_0xf2a1('0xf8'));return![];});}exports[_0xf2a1('0xf1')]=function(_0x176f04,_0x54e8c2,_0x5ba3d9){var _0x2e91f3=0x0;var _0x14c99c=0x0;var _0x5f0464=![];var _0x8b95ae;var _0x540ae3;return db[_0xf2a1('0x44')][_0xf2a1('0x5f')]({'where':{'id':_0x176f04['params']['id']},'include':[{'model':db[_0xf2a1('0xfa')],'as':_0xf2a1('0xfa'),'include':[{'model':db[_0xf2a1('0xfa')],'as':_0xf2a1('0xfb'),'attributes':['id',_0xf2a1('0xf3')],'raw':!![]}]}]})[_0xf2a1('0x27')](handleEntityNotFound(_0x54e8c2,null))['then'](function(_0x304e54){if(_0x304e54){_0x8b95ae=_0x304e54;return _0x304e54[_0xf2a1('0xfc')]({'raw':!![]});}})[_0xf2a1('0x27')](function(_0x563468){if(_0x8b95ae){if(_0x563468){_0x540ae3=_0x563468;}}return require(_0xf2a1('0x7f'))[_0xf2a1('0x80')]();})[_0xf2a1('0x27')](function(_0x36d6e9){if(_0x36d6e9){_0x14c99c=_0x36d6e9[_0xf2a1('0xfd')];_0x5f0464=_0x36d6e9['custom'];}})['then'](function(){return db['ChatInteraction'][_0xf2a1('0x35')]({'where':{'closed':![]}});})['then'](function(_0x90455f){_0x2e91f3=_0x90455f;if(_0x14c99c&&_0x90455f>_0x14c99c){return db[_0xf2a1('0xfe')]['findOne']({'where':{'id':0x1}})[_0xf2a1('0x27')](function(_0x5af8d4){if(_0x5af8d4){_0x5af8d4[_0xf2a1('0xff')]('chatLicenseExceeded');}});}})[_0xf2a1('0x27')](function(){if(_0x8b95ae['Interval']&&_0x8b95ae[_0xf2a1('0xfa')][_0xf2a1('0xfb')]){var _0x5cff72=[];for(var _0x1f9c39=0x0;_0x1f9c39<_0x8b95ae['Interval'][_0xf2a1('0xfb')][_0xf2a1('0x4f')];_0x1f9c39++){var _0x1b6d08=_0x8b95ae[_0xf2a1('0xfa')]['Intervals'][_0x1f9c39][_0xf2a1('0x61')]({'plain':!![]});_0x5cff72[_0xf2a1('0x100')](iftimePromise(_0x1b6d08,_0x8b95ae));}return BPromise[_0xf2a1('0x101')](_0x5cff72)[_0xf2a1('0x27')](function(_0x53a078){return _[_0xf2a1('0x102')](_0x53a078);});}else{return!![];}})[_0xf2a1('0x27')](function(_0x55f17f){var _0x3c142b=fs['readFileSync'](path['join'](config[_0xf2a1('0x7d')],_0xf2a1('0x103')),_0xf2a1('0x104'));var _0x3725d8={'remote':_0x8b95ae['remote'],'query':querystring[_0xf2a1('0x2d')](_[_0xf2a1('0x58')](_0x8b95ae[_0xf2a1('0x61')]({'plain':!![]}),{'customerIp':_0x176f04[_0xf2a1('0xa9')][_0xf2a1('0xaa')]||_0x176f04[_0xf2a1('0xa9')][_0xf2a1('0x105')]||_0x176f04['connection'][_0xf2a1('0x106')]||_0x176f04['ip'],'referer':_0x176f04[_0xf2a1('0xa9')]['referer'],'openedInteractions':_0x2e91f3,'maxInteractions':_0x14c99c,'virtual':_0x5f0464['virtual'],'online':_0x55f17f,'custom':_0x5f0464}))[_0xf2a1('0x107')](/'/g,'\x5c\x27')};_0x54e8c2['send'](ejs[_0xf2a1('0xd6')](Mustache['render'](_0x3c142b,_0x3725d8),{'proactiveActions':_0x540ae3,'alignment':_0x8b95ae['alignment'],'verticalAlignment':_0x8b95ae['verticalAlignment'],'div_color':_0x8b95ae[_0xf2a1('0x108')],'text_color':_0x8b95ae['textColor']}));})['catch'](handleError(_0x54e8c2,null));};exports[_0xf2a1('0x109')]=function(_0x5786f4,_0x567645,_0x26120c){return db[_0xf2a1('0x44')][_0xf2a1('0x6c')]({'where':{'id':_0x5786f4[_0xf2a1('0x5e')]['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x567645,null))[_0xf2a1('0x27')](function(_0x44a34f){if(_0x44a34f){return db[_0xf2a1('0x10a')][_0xf2a1('0x10b')](function(_0x497c3e){return db[_0xf2a1('0x10c')][_0xf2a1('0x3c')]({'where':{'ChatWebsiteId':_0x5786f4['params']['id']},'transaction':_0x497c3e})[_0xf2a1('0x27')](function(_0x2737f0){var _0x5b3d59=_[_0xf2a1('0x43')](_0x5786f4[_0xf2a1('0x67')],function(_0x20e9f9){_0x20e9f9['ChatWebsiteId']=_0x5786f4['params']['id'];return _0x20e9f9;});return db['ChatApplication'][_0xf2a1('0x10d')](_0x5b3d59,{'transaction':_0x497c3e});});})[_0xf2a1('0x27')](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x5786f4['params']['id']},'order':_0xf2a1('0xa5')});});}})['then'](respondWithResult(_0x567645,null))['catch'](handleError(_0x567645,null));};exports[_0xf2a1('0x10e')]=function(_0x17b8e0,_0x36903f,_0x146dce){var _0x2b325c={};var _0x3a4b51={};var _0x3678a1;var _0x5c6529;return db[_0xf2a1('0x44')][_0xf2a1('0x6c')]({'where':{'id':_0x17b8e0[_0xf2a1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x36903f,null))[_0xf2a1('0x27')](function(_0x516ade){if(_0x516ade){_0x3678a1=_0x516ade;_0x3a4b51[_0xf2a1('0x48')]=_[_0xf2a1('0x49')](db['ChatApplication'][_0xf2a1('0x45')]);_0x3a4b51['query']=_[_0xf2a1('0x49')](_0x17b8e0['query']);_0x3a4b51['filters']=_[_0xf2a1('0x4b')](_0x3a4b51[_0xf2a1('0x48')],_0x3a4b51[_0xf2a1('0x4c')]);_0x2b325c['attributes']=_['intersection'](_0x3a4b51[_0xf2a1('0x48')],qs[_0xf2a1('0x4d')](_0x17b8e0[_0xf2a1('0x4c')][_0xf2a1('0x4d')]));_0x2b325c[_0xf2a1('0x4e')]=_0x2b325c[_0xf2a1('0x4e')][_0xf2a1('0x4f')]?_0x2b325c['attributes']:_0x3a4b51[_0xf2a1('0x48')];_0x2b325c[_0xf2a1('0x53')]=qs[_0xf2a1('0x54')](_0x17b8e0[_0xf2a1('0x4c')]['sort']);_0x2b325c[_0xf2a1('0x57')]=qs['filters'](_['pick'](_0x17b8e0[_0xf2a1('0x4c')],_0x3a4b51[_0xf2a1('0x4a')]));if(_0x17b8e0[_0xf2a1('0x4c')][_0xf2a1('0x56')]){_0x2b325c[_0xf2a1('0x57')]=_['merge'](_0x2b325c[_0xf2a1('0x57')],{'$or':_[_0xf2a1('0x43')](_0x2b325c[_0xf2a1('0x4e')],function(_0x92c466){var _0x5e3842={};_0x5e3842[_0x92c466]={'$like':'%'+_0x17b8e0[_0xf2a1('0x4c')][_0xf2a1('0x56')]+'%'};return _0x5e3842;})});}_0x2b325c=_[_0xf2a1('0x58')]({},_0x2b325c,_0x17b8e0[_0xf2a1('0x59')]);return _0x3678a1[_0xf2a1('0x10e')](_0x2b325c);}})['then'](function(_0x11d854){if(_0x11d854){_0x5c6529=_0x11d854[_0xf2a1('0x4f')];if(!_0x17b8e0[_0xf2a1('0x4c')][_0xf2a1('0x50')](_0xf2a1('0x51'))){_0x2b325c['limit']=qs[_0xf2a1('0x36')](_0x17b8e0['query'][_0xf2a1('0x36')]);_0x2b325c[_0xf2a1('0x52')]=qs[_0xf2a1('0x52')](_0x17b8e0[_0xf2a1('0x4c')][_0xf2a1('0x52')]);}return _0x3678a1[_0xf2a1('0x10e')](_0x2b325c);}})[_0xf2a1('0x27')](function(_0x51378b){if(_0x51378b){return _0x51378b?{'count':_0x5c6529,'rows':_0x51378b}:null;}})['then'](respondWithResult(_0x36903f,null))[_0xf2a1('0x31')](handleError(_0x36903f,null));};exports['addProactiveActions']=function(_0x52bd9b,_0x13ce3a,_0x49cc9f){return db[_0xf2a1('0x10f')][_0xf2a1('0x5f')]({'where':{'id':_0x52bd9b[_0xf2a1('0x5e')]['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x13ce3a,null))[_0xf2a1('0x27')](function(_0x2e0609){if(_0x2e0609){return _0x2e0609['addProactiveActions'](_0x52bd9b[_0xf2a1('0x67')][_0xf2a1('0x6f')],_[_0xf2a1('0x110')](_0x52bd9b['body'],[_0xf2a1('0x6f'),'id'])||{});}})[_0xf2a1('0x27')](respondWithResult(_0x13ce3a,null))[_0xf2a1('0x31')](handleError(_0x13ce3a,null));};exports[_0xf2a1('0xfc')]=function(_0x2ed7bd,_0x407dfe,_0x4f3454){var _0xea428={};var _0x3d5c8f={};var _0x457c25;var _0x468820;return db['ChatWebsite']['findOne']({'where':{'id':_0x2ed7bd[_0xf2a1('0x5e')]['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x407dfe,null))[_0xf2a1('0x27')](function(_0x4bf8cc){if(_0x4bf8cc){_0x457c25=_0x4bf8cc;_0x3d5c8f[_0xf2a1('0x48')]=_[_0xf2a1('0x49')](db[_0xf2a1('0x111')][_0xf2a1('0x45')]);_0x3d5c8f[_0xf2a1('0x4c')]=_[_0xf2a1('0x49')](_0x2ed7bd['query']);_0x3d5c8f[_0xf2a1('0x4a')]=_[_0xf2a1('0x4b')](_0x3d5c8f[_0xf2a1('0x48')],_0x3d5c8f[_0xf2a1('0x4c')]);_0xea428[_0xf2a1('0x4e')]=_[_0xf2a1('0x4b')](_0x3d5c8f[_0xf2a1('0x48')],qs[_0xf2a1('0x4d')](_0x2ed7bd[_0xf2a1('0x4c')][_0xf2a1('0x4d')]));_0xea428[_0xf2a1('0x4e')]=_0xea428[_0xf2a1('0x4e')][_0xf2a1('0x4f')]?_0xea428[_0xf2a1('0x4e')]:_0x3d5c8f[_0xf2a1('0x48')];_0xea428[_0xf2a1('0x53')]=qs[_0xf2a1('0x54')](_0x2ed7bd[_0xf2a1('0x4c')][_0xf2a1('0x54')]);_0xea428[_0xf2a1('0x57')]=qs[_0xf2a1('0x4a')](_[_0xf2a1('0x55')](_0x2ed7bd[_0xf2a1('0x4c')],_0x3d5c8f[_0xf2a1('0x4a')]));if(_0x2ed7bd['query']['filter']){_0xea428[_0xf2a1('0x57')]=_[_0xf2a1('0x58')](_0xea428[_0xf2a1('0x57')],{'$or':_['map'](_0xea428[_0xf2a1('0x4e')],function(_0x1a049c){var _0x202951={};_0x202951[_0x1a049c]={'$like':'%'+_0x2ed7bd['query'][_0xf2a1('0x56')]+'%'};return _0x202951;})});}_0xea428=_['merge']({},_0xea428,_0x2ed7bd[_0xf2a1('0x59')]);return _0x457c25[_0xf2a1('0xfc')](_0xea428);}})[_0xf2a1('0x27')](function(_0x2ce7a8){if(_0x2ce7a8){_0x468820=_0x2ce7a8[_0xf2a1('0x4f')];if(!_0x2ed7bd[_0xf2a1('0x4c')][_0xf2a1('0x50')](_0xf2a1('0x51'))){_0xea428['limit']=qs['limit'](_0x2ed7bd['query']['limit']);_0xea428[_0xf2a1('0x52')]=qs[_0xf2a1('0x52')](_0x2ed7bd['query'][_0xf2a1('0x52')]);}return _0x457c25[_0xf2a1('0xfc')](_0xea428);}})['then'](function(_0x21bbb4){if(_0x21bbb4){return _0x21bbb4?{'count':_0x468820,'rows':_0x21bbb4}:null;}})[_0xf2a1('0x27')](respondWithResult(_0x407dfe,null))[_0xf2a1('0x31')](handleError(_0x407dfe,null));};exports[_0xf2a1('0x112')]=function(_0x195399,_0x4bff9f,_0x5195da){var _0x176eff=_0x195399[_0xf2a1('0x4c')][_0xf2a1('0x113')]===_0xf2a1('0x114')?_0xf2a1('0x115'):'onlineForm';return db['ChatWebsite'][_0xf2a1('0x5f')]({'attributes':['id',_0x176eff],'where':{'id':_0x195399[_0xf2a1('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4bff9f,null))['then'](function(_0xbd5bd9){if(_0xbd5bd9){var _0x510126=_0xbd5bd9[_0x176eff];var _0x4c7896=_0x510126&&_0x510126[_0xf2a1('0x116')]?_0x510126[_0xf2a1('0x116')]:[];_0x4bff9f[_0xf2a1('0x3f')]({'fromKey':_[_0xf2a1('0x82')](_0x510126['fromKey'])?undefined:_0x510126[_0xf2a1('0x117')],'count':_0x4c7896[_0xf2a1('0x4f')],'rows':_0x4c7896});}})[_0xf2a1('0x31')](handleError(_0x4bff9f,null));};exports[_0xf2a1('0x118')]=function(_0x2190f6,_0x525cc9,_0x247917){var _0x5b4a3e={'raw':![],'where':{}};var _0x1adfa8={};var _0x201e51={'count':0x0,'rows':[]};return db[_0xf2a1('0x44')][_0xf2a1('0x6c')]({'where':{'id':_0x2190f6[_0xf2a1('0x5e')]['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x525cc9,null))[_0xf2a1('0x27')](function(_0x2515d5){if(_0x2515d5){_0x1adfa8[_0xf2a1('0x48')]=_[_0xf2a1('0x49')](db[_0xf2a1('0x119')][_0xf2a1('0x45')]);_0x1adfa8[_0xf2a1('0x4c')]=_[_0xf2a1('0x49')](_0x2190f6[_0xf2a1('0x4c')]);_0x1adfa8[_0xf2a1('0x4a')]=_['intersection'](_0x1adfa8['model'],_0x1adfa8['query']);_0x5b4a3e[_0xf2a1('0x4e')]=_[_0xf2a1('0x4b')](_0x1adfa8[_0xf2a1('0x48')],qs[_0xf2a1('0x4d')](_0x2190f6['query'][_0xf2a1('0x4d')]));_0x5b4a3e['attributes']=_0x5b4a3e[_0xf2a1('0x4e')]['length']?_0x5b4a3e['attributes']:_0x1adfa8[_0xf2a1('0x48')];if(!_0x2190f6[_0xf2a1('0x4c')][_0xf2a1('0x50')](_0xf2a1('0x51'))){_0x5b4a3e[_0xf2a1('0x36')]=qs['limit'](_0x2190f6[_0xf2a1('0x4c')][_0xf2a1('0x36')]);_0x5b4a3e[_0xf2a1('0x52')]=qs['offset'](_0x2190f6[_0xf2a1('0x4c')][_0xf2a1('0x52')]);}_0x5b4a3e[_0xf2a1('0x53')]=qs[_0xf2a1('0x54')](_0x2190f6[_0xf2a1('0x4c')][_0xf2a1('0x54')]);_0x5b4a3e[_0xf2a1('0x57')]=qs[_0xf2a1('0x4a')](_[_0xf2a1('0x55')](_0x2190f6[_0xf2a1('0x4c')],_0x1adfa8[_0xf2a1('0x4a')]));_0x5b4a3e[_0xf2a1('0x57')][_0xf2a1('0x6a')]=_0x2515d5['id'];if(_0x2190f6[_0xf2a1('0x4c')][_0xf2a1('0x56')]){_0x5b4a3e[_0xf2a1('0x57')]=_[_0xf2a1('0x58')](_0x5b4a3e[_0xf2a1('0x57')],{'$or':_[_0xf2a1('0x43')](_0x5b4a3e[_0xf2a1('0x4e')],function(_0x32b92c){var _0x57c700={};_0x57c700[_0x32b92c]={'$like':'%'+_0x2190f6['query'][_0xf2a1('0x56')]+'%'};return _0x57c700;})});}_0x5b4a3e=_['merge']({},_0x5b4a3e,_0x2190f6['options']);return db[_0xf2a1('0x119')]['count']({'where':_0x5b4a3e['where']})[_0xf2a1('0x27')](function(_0x3dc072){_0x201e51[_0xf2a1('0x35')]=_0x3dc072;if(_0x2190f6[_0xf2a1('0x4c')][_0xf2a1('0x5a')]){_0x5b4a3e[_0xf2a1('0x5b')]=[{'all':!![]}];}else{_0x5b4a3e[_0xf2a1('0x5b')]=[{'model':db[_0xf2a1('0x9d')],'as':_0xf2a1('0xea'),'required':![]}];}return db['ChatOfflineMessage'][_0xf2a1('0x5c')](_0x5b4a3e);})[_0xf2a1('0x27')](function(_0x2a15ff){_0x201e51[_0xf2a1('0x6d')]=_0x2a15ff;return _0x201e51;});}})[_0xf2a1('0x27')](respondWithFilteredResult(_0x525cc9,_0x5b4a3e))[_0xf2a1('0x31')](handleError(_0x525cc9,null));};exports[_0xf2a1('0x11a')]=function(_0x58e086,_0xf70589,_0x13132d){return db[_0xf2a1('0x44')][_0xf2a1('0x5f')]({'where':{'id':_0x58e086['params']['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0xf70589,null))['then'](function(_0x1cafb1){if(_0x1cafb1){return _0x1cafb1[_0xf2a1('0x11a')](_0x58e086[_0xf2a1('0x67')]['ids'],_[_0xf2a1('0x110')](_0x58e086[_0xf2a1('0x67')],['ids','id'])||{})[_0xf2a1('0xd3')](function(_0x5cfd1e){for(var _0x237155=0x0;_0x237155<_0x58e086[_0xf2a1('0x67')][_0xf2a1('0x6f')][_0xf2a1('0x4f')];_0x237155+=0x1){socket[_0xf2a1('0x11b')](_0xf2a1('0x11c'),{'UserId':_0x58e086[_0xf2a1('0x67')][_0xf2a1('0x6f')][_0x237155],'ChatWebsiteId':_0x58e086[_0xf2a1('0x5e')]['id']});}return _0x5cfd1e;});}})[_0xf2a1('0x27')](respondWithResult(_0xf70589,null))['catch'](handleError(_0xf70589,null));};exports[_0xf2a1('0x11d')]=function(_0x5e44d5,_0x4ab69b,_0x44280d){return db[_0xf2a1('0x44')][_0xf2a1('0x5f')]({'where':{'id':_0x5e44d5[_0xf2a1('0x5e')]['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x4ab69b,null))['then'](function(_0x45dec3){if(_0x45dec3){return _0x45dec3[_0xf2a1('0x11d')](_0x5e44d5[_0xf2a1('0x4c')][_0xf2a1('0x6f')])[_0xf2a1('0x27')](function(){if(_[_0xf2a1('0x11e')](_0x5e44d5['query'][_0xf2a1('0x6f')])){for(var _0x3ba1c5=0x0;_0x3ba1c5<_0x5e44d5[_0xf2a1('0x4c')][_0xf2a1('0x6f')]['length'];_0x3ba1c5+=0x1){socket[_0xf2a1('0x11b')](_0xf2a1('0x11f'),{'UserId':Number(_0x5e44d5[_0xf2a1('0x4c')]['ids'][_0x3ba1c5]),'ChatWebsiteId':Number(_0x5e44d5[_0xf2a1('0x5e')]['id'])});}}else{socket[_0xf2a1('0x11b')](_0xf2a1('0x11f'),{'UserId':Number(_0x5e44d5['query'][_0xf2a1('0x6f')]),'ChatWebsiteId':Number(_0x5e44d5['params']['id'])});}});}})[_0xf2a1('0x27')](respondWithStatusCode(_0x4ab69b,null))[_0xf2a1('0x31')](handleError(_0x4ab69b,null));};exports[_0xf2a1('0x120')]=function(_0x3d59cd,_0x579443,_0x43b6cc){var _0x476a01={};var _0x332976={};var _0x200d29;var _0x28b45a;return db[_0xf2a1('0x44')][_0xf2a1('0x6c')]({'where':{'id':_0x3d59cd[_0xf2a1('0x5e')]['id']}})[_0xf2a1('0x27')](handleEntityNotFound(_0x579443,null))[_0xf2a1('0x27')](function(_0x1c19e3){if(_0x1c19e3){_0x200d29=_0x1c19e3;_0x332976[_0xf2a1('0x48')]=_[_0xf2a1('0x49')](db[_0xf2a1('0xc4')][_0xf2a1('0x45')]);_0x332976[_0xf2a1('0x4c')]=_[_0xf2a1('0x49')](_0x3d59cd[_0xf2a1('0x4c')]);_0x332976[_0xf2a1('0x4a')]=_[_0xf2a1('0x4b')](_0x332976[_0xf2a1('0x48')],_0x332976[_0xf2a1('0x4c')]);_0x476a01[_0xf2a1('0x4e')]=_[_0xf2a1('0x4b')](_0x332976[_0xf2a1('0x48')],qs[_0xf2a1('0x4d')](_0x3d59cd[_0xf2a1('0x4c')][_0xf2a1('0x4d')]));_0x476a01[_0xf2a1('0x4e')]=_0x476a01[_0xf2a1('0x4e')]['length']?_0x476a01[_0xf2a1('0x4e')]:_0x332976[_0xf2a1('0x48')];_0x476a01[_0xf2a1('0x53')]=qs[_0xf2a1('0x54')](_0x3d59cd[_0xf2a1('0x4c')]['sort']);_0x476a01[_0xf2a1('0x57')]=qs[_0xf2a1('0x4a')](_[_0xf2a1('0x55')](_0x3d59cd['query'],_0x332976[_0xf2a1('0x4a')]));if(_0x3d59cd['query'][_0xf2a1('0x56')]){_0x476a01[_0xf2a1('0x57')]=_[_0xf2a1('0x58')](_0x476a01[_0xf2a1('0x57')],{'$or':_['map'](_0x476a01[_0xf2a1('0x4e')],function(_0x327398){var _0x158704={};_0x158704[_0x327398]={'$like':'%'+_0x3d59cd[_0xf2a1('0x4c')]['filter']+'%'};return _0x158704;})});}_0x476a01=_[_0xf2a1('0x58')]({},_0x476a01,_0x3d59cd[_0xf2a1('0x59')]);return _0x200d29[_0xf2a1('0x120')](_0x476a01);}})[_0xf2a1('0x27')](function(_0x2b92e5){if(_0x2b92e5){_0x28b45a=_0x2b92e5[_0xf2a1('0x4f')];if(!_0x3d59cd[_0xf2a1('0x4c')][_0xf2a1('0x50')](_0xf2a1('0x51'))){_0x476a01[_0xf2a1('0x36')]=qs[_0xf2a1('0x36')](_0x3d59cd[_0xf2a1('0x4c')][_0xf2a1('0x36')]);_0x476a01[_0xf2a1('0x52')]=qs[_0xf2a1('0x52')](_0x3d59cd[_0xf2a1('0x4c')][_0xf2a1('0x52')]);}return _0x200d29[_0xf2a1('0x120')](_0x476a01);}})[_0xf2a1('0x27')](function(_0x3cceb1){if(_0x3cceb1){return _0x3cceb1?{'count':_0x28b45a,'rows':_0x3cceb1}:null;}})[_0xf2a1('0x27')](respondWithResult(_0x579443,null))[_0xf2a1('0x31')](handleError(_0x579443,null));}; \ No newline at end of file +var _0x4e97=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','ChatWebsite,\x20%s,\x20%s','message','info','catch','sendStatus','end','status','json','count','offset','limit','apply','reject','save','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','map','ChatWebsite','fieldName','type','keys','filters','intersection','attributes','fields','length','model','query','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','params','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','order','rows','removeDispositions','ids','CannedAnswer','getAnswers','rawAttributes','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','systemAvatar','join','server/files/images/logos/default_logo.png','../../config/license/util','getLicense','isNil','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','existsSync','getSystemAvatar','notify','headers','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','orderBy','applications','priority','asc','defaults','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','vendor','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','unmanaged','*,*,*,*','ChatMessage','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','EventManager','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','toPairs','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','internal','Tag','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','utf8','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','textColor','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x25f0f1,_0x405014){var _0x2c48f8=function(_0x4403b7){while(--_0x4403b7){_0x25f0f1['push'](_0x25f0f1['shift']());}};_0x2c48f8(++_0x405014);}(_0x4e97,0x115));var _0x74e9=function(_0x5c42c4,_0x485daf){_0x5c42c4=_0x5c42c4-0x0;var _0x5c5eb4=_0x4e97[_0x5c42c4];return _0x5c5eb4;};'use strict';var pdf=require(_0x74e9('0x0'));var emlformat=require(_0x74e9('0x1'));var rimraf=require(_0x74e9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x74e9('0x3'));var rp=require(_0x74e9('0x4'));var moment=require(_0x74e9('0x5'));var BPromise=require(_0x74e9('0x6'));var Mustache=require(_0x74e9('0x7'));var util=require(_0x74e9('0x8'));var path=require(_0x74e9('0x9'));var sox=require(_0x74e9('0xa'));var csv=require(_0x74e9('0xb'));var ejs=require(_0x74e9('0xc'));var fs=require('fs');var _=require(_0x74e9('0xd'));var squel=require(_0x74e9('0xe'));var crypto=require(_0x74e9('0xf'));var jsforce=require(_0x74e9('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x74e9('0x11'));var Papa=require(_0x74e9('0x12'));var Redis=require(_0x74e9('0x13'));var authService=require(_0x74e9('0x14'));var qs=require(_0x74e9('0x15'));var as=require(_0x74e9('0x16'));var hardwareService=require(_0x74e9('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x74e9('0x18'));var config=require('../../config/environment');var db=require(_0x74e9('0x19'))['db'];config[_0x74e9('0x1a')]=_['defaults'](config[_0x74e9('0x1a')],{'host':_0x74e9('0x1b'),'port':0x18eb});var socket=require(_0x74e9('0x1c'))(new Redis(config['redis']));require(_0x74e9('0x1d'))[_0x74e9('0x1e')](socket);var jayson=require(_0x74e9('0x1f'));var client=jayson[_0x74e9('0x20')][_0x74e9('0x21')]({'port':0x232c});var client9002=jayson[_0x74e9('0x20')][_0x74e9('0x21')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});function checkPasswordPattern(_0x222e04,_0x5a5643,_0x576454){if(_0x576454){var _0x597f97=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x597f97['test'](_0x5a5643)){return _0x222e04;}else{throw new db[(_0x74e9('0x22'))]['ValidationError'](_0x74e9('0x23'));}}else{return _0x222e04;}}function respondWithRpcPromise(_0x13c1d5,_0xc863eb,_0x298183,_0x3b9637){return new BPromise(function(_0x538af2,_0x18544a){var _0x35fb96=_0x3b9637||client;return _0x35fb96[_0x74e9('0x24')](_0x13c1d5,_0x298183)[_0x74e9('0x25')](function(_0x1c31ad){logger['info']('ChatWebsite,\x20%s,\x20%s',_0xc863eb,_0x74e9('0x26'));logger['debug'](_0x74e9('0x27'),_0xc863eb,_0x74e9('0x26'),JSON['stringify'](_0x1c31ad));if(_0x1c31ad[_0x74e9('0x28')]){if(_0x1c31ad['error']['code']===0x1f4){logger['error'](_0x74e9('0x29'),_0xc863eb,_0x1c31ad[_0x74e9('0x28')][_0x74e9('0x2a')]);return _0x18544a(_0x1c31ad[_0x74e9('0x28')][_0x74e9('0x2a')]);}logger[_0x74e9('0x28')](_0x74e9('0x29'),_0xc863eb,_0x1c31ad[_0x74e9('0x28')][_0x74e9('0x2a')]);return _0x538af2(_0x1c31ad['error'][_0x74e9('0x2a')]);}else{logger[_0x74e9('0x2b')](_0x74e9('0x29'),_0xc863eb,_0x74e9('0x26'));_0x538af2(_0x1c31ad['result'][_0x74e9('0x2a')]);}})[_0x74e9('0x2c')](function(_0x4f8cd4){logger['error'](_0x74e9('0x29'),_0xc863eb,_0x4f8cd4);_0x18544a(_0x4f8cd4);});});}function respondWithStatusCode(_0x3dd192,_0x36bea4){_0x36bea4=_0x36bea4||0xcc;return function(_0x59d8d1){if(_0x59d8d1){return _0x3dd192[_0x74e9('0x2d')](_0x36bea4);}return _0x3dd192['status'](_0x36bea4)[_0x74e9('0x2e')]();};}function respondWithResult(_0x104d49,_0x514f8f){_0x514f8f=_0x514f8f||0xc8;return function(_0x206cf7){if(_0x206cf7){return _0x104d49[_0x74e9('0x2f')](_0x514f8f)[_0x74e9('0x30')](_0x206cf7);}};}function respondWithFilteredResult(_0x1d434a,_0x2f18b6){return function(_0x229fe4){if(_0x229fe4){var _0x257d15=_0x229fe4[_0x74e9('0x31')],_0x40b60c=_0x2f18b6[_0x74e9('0x32')],_0x130c95=_0x2f18b6[_0x74e9('0x32')]+_0x2f18b6[_0x74e9('0x33')],_0x466a96;if(_0x130c95>=_0x257d15){_0x130c95=_0x257d15;_0x466a96=0xc8;}else{_0x466a96=0xce;}_0x1d434a[_0x74e9('0x2f')](_0x466a96);return _0x1d434a['set']('Content-Range',_0x40b60c+'-'+_0x130c95+'/'+_0x257d15)[_0x74e9('0x30')](_0x229fe4);}return null;};}function patchUpdates(_0x29df1c){return function(_0x59c9f9){try{jsonpatch[_0x74e9('0x34')](_0x59c9f9,_0x29df1c,!![]);}catch(_0x157c96){return BPromise[_0x74e9('0x35')](_0x157c96);}return _0x59c9f9[_0x74e9('0x36')]();};}function saveUpdates(_0x3910f1,_0xf6da93){return function(_0x296574){if(_0x296574){return _0x296574[_0x74e9('0x37')](_0x3910f1)['then'](function(_0x10e1c8){return _0x10e1c8;});}return null;};}function removeEntity(_0xb706b5,_0x33a41c){return function(_0x49ef48){if(_0x49ef48){return _0x49ef48[_0x74e9('0x38')]()['then'](function(){var _0x1a3471=_0x49ef48[_0x74e9('0x39')]({'plain':!![]});var _0x24b6a0=_0x74e9('0x3a');return db[_0x74e9('0x3b')]['destroy']({'where':{'type':_0x24b6a0,'resourceId':_0x1a3471['id']}})[_0x74e9('0x25')](function(){return _0x49ef48;});})[_0x74e9('0x25')](function(){_0xb706b5[_0x74e9('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c45c0,_0x2279f8){return function(_0x2bb37e){if(!_0x2bb37e){_0x3c45c0[_0x74e9('0x2d')](0x194);}return _0x2bb37e;};}function handleError(_0x3148c8,_0x44217d){_0x44217d=_0x44217d||0x1f4;return function(_0x28cf26){logger[_0x74e9('0x28')](_0x28cf26[_0x74e9('0x3c')]);if(_0x28cf26[_0x74e9('0x3d')]){delete _0x28cf26[_0x74e9('0x3d')];}_0x3148c8[_0x74e9('0x2f')](_0x44217d)[_0x74e9('0x3e')](_0x28cf26);};}exports[_0x74e9('0x3f')]=function(_0x1762f5,_0x342217){var _0x335256={'include':[{'model':db[_0x74e9('0x40')],'as':'mandatoryDispositionPause'}]},_0x579ddd={},_0x1dcb22={'count':0x0,'rows':[]};var _0x366b7c=_[_0x74e9('0x41')](db[_0x74e9('0x42')]['rawAttributes'],function(_0x5c316b){return{'name':_0x5c316b[_0x74e9('0x43')],'type':_0x5c316b[_0x74e9('0x44')]['key']};});_0x579ddd['model']=_[_0x74e9('0x41')](_0x366b7c,_0x74e9('0x3d'));_0x579ddd['query']=_[_0x74e9('0x45')](_0x1762f5['query']);_0x579ddd[_0x74e9('0x46')]=_[_0x74e9('0x47')](_0x579ddd['model'],_0x579ddd['query']);_0x335256[_0x74e9('0x48')]=_[_0x74e9('0x47')](_0x579ddd['model'],qs[_0x74e9('0x49')](_0x1762f5['query']['fields']));_0x335256[_0x74e9('0x48')]=_0x335256['attributes'][_0x74e9('0x4a')]?_0x335256['attributes']:_0x579ddd[_0x74e9('0x4b')];if(!_0x1762f5[_0x74e9('0x4c')][_0x74e9('0x4d')]('nolimit')){_0x335256[_0x74e9('0x33')]=qs['limit'](_0x1762f5['query'][_0x74e9('0x33')]);_0x335256['offset']=qs[_0x74e9('0x32')](_0x1762f5[_0x74e9('0x4c')][_0x74e9('0x32')]);}_0x335256['order']=qs[_0x74e9('0x4e')](_0x1762f5['query'][_0x74e9('0x4e')]);_0x335256[_0x74e9('0x4f')]=qs[_0x74e9('0x46')](_[_0x74e9('0x50')](_0x1762f5[_0x74e9('0x4c')],_0x579ddd[_0x74e9('0x46')]));if(_0x1762f5[_0x74e9('0x4c')][_0x74e9('0x51')]){_0x335256[_0x74e9('0x4f')]=_[_0x74e9('0x52')](_0x335256['where'],{'$or':_[_0x74e9('0x41')](_0x366b7c,function(_0x1db444){if(_0x1db444['type']!=='VIRTUAL'){var _0x24e1ef={};_0x24e1ef[_0x1db444[_0x74e9('0x3d')]]={'$like':'%'+_0x1762f5['query']['filter']+'%'};return _0x24e1ef;}})});}_0x335256=_[_0x74e9('0x52')]({},_0x335256,_0x1762f5[_0x74e9('0x53')]);var _0x240d42={'where':_0x335256[_0x74e9('0x4f')]};return db[_0x74e9('0x42')][_0x74e9('0x31')](_0x240d42)['then'](function(_0x2f1de4){_0x1dcb22[_0x74e9('0x31')]=_0x2f1de4;if(_0x1762f5[_0x74e9('0x4c')][_0x74e9('0x54')]){_0x335256[_0x74e9('0x55')]=[{'all':!![]}];}return db[_0x74e9('0x42')][_0x74e9('0x56')](_0x335256);})[_0x74e9('0x25')](function(_0x2ca9ad){_0x1dcb22['rows']=_0x2ca9ad;return _0x1dcb22;})['then'](respondWithFilteredResult(_0x342217,_0x335256))[_0x74e9('0x2c')](handleError(_0x342217,null));};exports['show']=function(_0x450461,_0x9ed458){var _0x32fed6={'raw':![],'where':{'id':_0x450461[_0x74e9('0x57')]['id']},'include':[{'model':db[_0x74e9('0x40')],'as':_0x74e9('0x58')}]},_0x2c6812={};_0x2c6812['model']=_[_0x74e9('0x45')](db[_0x74e9('0x42')]['rawAttributes']);_0x2c6812[_0x74e9('0x4c')]=_[_0x74e9('0x45')](_0x450461[_0x74e9('0x4c')]);_0x2c6812[_0x74e9('0x46')]=_[_0x74e9('0x47')](_0x2c6812[_0x74e9('0x4b')],_0x2c6812['query']);_0x32fed6[_0x74e9('0x48')]=_['intersection'](_0x2c6812[_0x74e9('0x4b')],qs['fields'](_0x450461['query'][_0x74e9('0x49')]));_0x32fed6[_0x74e9('0x48')]=_0x32fed6[_0x74e9('0x48')]['length']?_0x32fed6[_0x74e9('0x48')]:_0x2c6812[_0x74e9('0x4b')];if(_0x450461[_0x74e9('0x4c')]['includeAll']){_0x32fed6[_0x74e9('0x55')]=[{'all':!![]}];}_0x32fed6=_['merge']({},_0x32fed6,_0x450461['options']);return db[_0x74e9('0x42')][_0x74e9('0x59')](_0x32fed6)[_0x74e9('0x25')](handleEntityNotFound(_0x9ed458,null))[_0x74e9('0x25')](respondWithResult(_0x9ed458,null))[_0x74e9('0x2c')](handleError(_0x9ed458,null));};exports[_0x74e9('0x5a')]=function(_0x174267,_0x3d91ae){return db[_0x74e9('0x42')]['create'](_0x174267[_0x74e9('0x5b')],{})[_0x74e9('0x25')](function(_0x4d9247){var _0x462628=_0x174267[_0x74e9('0x5c')]['get']({'plain':!![]});if(!_0x462628)throw new Error(_0x74e9('0x5d'));if(_0x462628[_0x74e9('0x5e')]===_0x74e9('0x5c')){var _0x5e8984=_0x4d9247[_0x74e9('0x39')]({'plain':!![]});var _0x489125=_0x74e9('0x3a');return db['UserProfileSection'][_0x74e9('0x59')]({'where':{'name':_0x489125,'userProfileId':_0x462628['userProfileId']},'raw':!![]})['then'](function(_0x4166bd){if(_0x4166bd&&_0x4166bd[_0x74e9('0x5f')]===0x0){return db[_0x74e9('0x3b')][_0x74e9('0x5a')]({'name':_0x5e8984[_0x74e9('0x3d')],'resourceId':_0x5e8984['id'],'type':_0x4166bd['name'],'sectionId':_0x4166bd['id']},{})[_0x74e9('0x25')](function(){return _0x4d9247;});}else{return _0x4d9247;}})['catch'](function(_0x4f1818){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f1818);throw _0x4f1818;});}return _0x4d9247;})[_0x74e9('0x25')](respondWithResult(_0x3d91ae,0xc9))[_0x74e9('0x2c')](handleError(_0x3d91ae,null));};exports[_0x74e9('0x37')]=function(_0x524db6,_0xf5f3eb){if(_0x524db6[_0x74e9('0x5b')]['id']){delete _0x524db6[_0x74e9('0x5b')]['id'];}return db[_0x74e9('0x42')]['find']({'where':{'id':_0x524db6[_0x74e9('0x57')]['id']},'include':[{'model':db[_0x74e9('0x40')],'as':_0x74e9('0x58')}]})[_0x74e9('0x25')](handleEntityNotFound(_0xf5f3eb,null))['then'](saveUpdates(_0x524db6[_0x74e9('0x5b')],null))['then'](respondWithResult(_0xf5f3eb,null))[_0x74e9('0x2c')](handleError(_0xf5f3eb,null));};exports[_0x74e9('0x38')]=function(_0x2215ce,_0x5ad1e9){return db[_0x74e9('0x42')][_0x74e9('0x59')]({'where':{'id':_0x2215ce[_0x74e9('0x57')]['id']}})[_0x74e9('0x25')](handleEntityNotFound(_0x5ad1e9,null))[_0x74e9('0x25')](removeEntity(_0x5ad1e9,null))['catch'](handleError(_0x5ad1e9,null));};exports[_0x74e9('0x60')]=function(_0x357e71,_0x47bce8){return db[_0x74e9('0x42')][_0x74e9('0x60')]()[_0x74e9('0x25')](respondWithResult(_0x47bce8,null))['catch'](handleError(_0x47bce8,null));};exports[_0x74e9('0x61')]=function(_0x237f2a,_0xacee54,_0x5e4529){if(_0x237f2a[_0x74e9('0x5b')]['id']){delete _0x237f2a['body']['id'];}return db['ChatWebsite'][_0x74e9('0x59')]({'where':{'id':_0x237f2a['params']['id']}})[_0x74e9('0x25')](handleEntityNotFound(_0xacee54,null))[_0x74e9('0x25')](function(_0x2c1338){if(_0x2c1338){_0x237f2a[_0x74e9('0x5b')][_0x74e9('0x62')]=_0x2c1338['id'];return db[_0x74e9('0x63')]['create'](_0x237f2a['body']);}})[_0x74e9('0x25')](respondWithResult(_0xacee54,null))['catch'](handleError(_0xacee54,null));};exports[_0x74e9('0x64')]=function(_0x5750bc,_0x110e8e,_0x3b8f5e){var _0x277348={'raw':![],'where':{}};var _0xd2443a={};var _0x1ad2f7={'count':0x0,'rows':[]};return db[_0x74e9('0x42')][_0x74e9('0x65')]({'where':{'id':_0x5750bc[_0x74e9('0x57')]['id']}})['then'](handleEntityNotFound(_0x110e8e,null))['then'](function(_0x3fc24a){if(_0x3fc24a){_0xd2443a[_0x74e9('0x4b')]=_[_0x74e9('0x45')](db[_0x74e9('0x63')]['rawAttributes']);_0xd2443a[_0x74e9('0x4c')]=_[_0x74e9('0x45')](_0x5750bc[_0x74e9('0x4c')]);_0xd2443a[_0x74e9('0x46')]=_['intersection'](_0xd2443a[_0x74e9('0x4b')],_0xd2443a[_0x74e9('0x4c')]);_0x277348[_0x74e9('0x48')]=_[_0x74e9('0x47')](_0xd2443a[_0x74e9('0x4b')],qs[_0x74e9('0x49')](_0x5750bc['query'][_0x74e9('0x49')]));_0x277348[_0x74e9('0x48')]=_0x277348['attributes'][_0x74e9('0x4a')]?_0x277348[_0x74e9('0x48')]:_0xd2443a[_0x74e9('0x4b')];if(!_0x5750bc[_0x74e9('0x4c')][_0x74e9('0x4d')](_0x74e9('0x66'))){_0x277348[_0x74e9('0x33')]=qs[_0x74e9('0x33')](_0x5750bc[_0x74e9('0x4c')][_0x74e9('0x33')]);_0x277348[_0x74e9('0x32')]=qs[_0x74e9('0x32')](_0x5750bc['query'][_0x74e9('0x32')]);}_0x277348[_0x74e9('0x67')]=qs[_0x74e9('0x4e')](_0x5750bc[_0x74e9('0x4c')]['sort']);_0x277348['where']=qs[_0x74e9('0x46')](_['pick'](_0x5750bc[_0x74e9('0x4c')],_0xd2443a[_0x74e9('0x46')]));_0x277348[_0x74e9('0x4f')][_0x74e9('0x62')]=_0x3fc24a['id'];if(_0x5750bc['query'][_0x74e9('0x51')]){_0x277348[_0x74e9('0x4f')]=_[_0x74e9('0x52')](_0x277348['where'],{'$or':_[_0x74e9('0x41')](_0x277348[_0x74e9('0x48')],function(_0x427ad7){var _0x2fa6a6={};_0x2fa6a6[_0x427ad7]={'$like':'%'+_0x5750bc[_0x74e9('0x4c')][_0x74e9('0x51')]+'%'};return _0x2fa6a6;})});}_0x277348=_[_0x74e9('0x52')]({},_0x277348,_0x5750bc[_0x74e9('0x53')]);return db[_0x74e9('0x63')][_0x74e9('0x31')]({'where':_0x277348[_0x74e9('0x4f')]})['then'](function(_0xa9f524){_0x1ad2f7['count']=_0xa9f524;if(_0x5750bc[_0x74e9('0x4c')][_0x74e9('0x54')]){_0x277348['include']=[{'all':!![]}];}return db['Disposition'][_0x74e9('0x56')](_0x277348);})[_0x74e9('0x25')](function(_0x215af0){_0x1ad2f7[_0x74e9('0x68')]=_0x215af0;return _0x1ad2f7;});}})[_0x74e9('0x25')](respondWithFilteredResult(_0x110e8e,_0x277348))['catch'](handleError(_0x110e8e,null));};exports['removeDispositions']=function(_0x311814,_0x29203b,_0x17edf2){return db[_0x74e9('0x42')][_0x74e9('0x59')]({'where':{'id':_0x311814[_0x74e9('0x57')]['id']}})['then'](handleEntityNotFound(_0x29203b,null))[_0x74e9('0x25')](function(_0x521508){if(_0x521508){return _0x521508[_0x74e9('0x69')](_0x311814[_0x74e9('0x4c')][_0x74e9('0x6a')]);}})[_0x74e9('0x25')](respondWithStatusCode(_0x29203b,null))[_0x74e9('0x2c')](handleError(_0x29203b,null));};exports['addAnswer']=function(_0x4f242d,_0x20eb5f,_0x42228f){if(_0x4f242d[_0x74e9('0x5b')]['id']){delete _0x4f242d[_0x74e9('0x5b')]['id'];}return db['ChatWebsite'][_0x74e9('0x59')]({'where':{'id':_0x4f242d[_0x74e9('0x57')]['id']}})[_0x74e9('0x25')](handleEntityNotFound(_0x20eb5f,null))[_0x74e9('0x25')](function(_0x5b97f8){if(_0x5b97f8){_0x4f242d[_0x74e9('0x5b')][_0x74e9('0x62')]=_0x5b97f8['id'];return db[_0x74e9('0x6b')][_0x74e9('0x5a')](_0x4f242d[_0x74e9('0x5b')]);}})[_0x74e9('0x25')](respondWithResult(_0x20eb5f,null))[_0x74e9('0x2c')](handleError(_0x20eb5f,null));};exports[_0x74e9('0x6c')]=function(_0x107340,_0x318366,_0x2bd708){var _0x19c8d6={'raw':![],'where':{}};var _0x2d4b4f={};var _0x323847={'count':0x0,'rows':[]};return db[_0x74e9('0x42')][_0x74e9('0x65')]({'where':{'id':_0x107340['params']['id']}})[_0x74e9('0x25')](handleEntityNotFound(_0x318366,null))[_0x74e9('0x25')](function(_0x32d604){if(_0x32d604){_0x2d4b4f[_0x74e9('0x4b')]=_['keys'](db[_0x74e9('0x6b')][_0x74e9('0x6d')]);_0x2d4b4f[_0x74e9('0x4c')]=_[_0x74e9('0x45')](_0x107340[_0x74e9('0x4c')]);_0x2d4b4f[_0x74e9('0x46')]=_[_0x74e9('0x47')](_0x2d4b4f[_0x74e9('0x4b')],_0x2d4b4f[_0x74e9('0x4c')]);_0x19c8d6[_0x74e9('0x48')]=_[_0x74e9('0x47')](_0x2d4b4f[_0x74e9('0x4b')],qs[_0x74e9('0x49')](_0x107340['query']['fields']));_0x19c8d6[_0x74e9('0x48')]=_0x19c8d6[_0x74e9('0x48')][_0x74e9('0x4a')]?_0x19c8d6[_0x74e9('0x48')]:_0x2d4b4f[_0x74e9('0x4b')];if(!_0x107340[_0x74e9('0x4c')]['hasOwnProperty'](_0x74e9('0x66'))){_0x19c8d6[_0x74e9('0x33')]=qs[_0x74e9('0x33')](_0x107340[_0x74e9('0x4c')][_0x74e9('0x33')]);_0x19c8d6[_0x74e9('0x32')]=qs['offset'](_0x107340[_0x74e9('0x4c')][_0x74e9('0x32')]);}_0x19c8d6[_0x74e9('0x67')]=qs[_0x74e9('0x4e')](_0x107340[_0x74e9('0x4c')]['sort']);_0x19c8d6['where']=qs[_0x74e9('0x46')](_[_0x74e9('0x50')](_0x107340[_0x74e9('0x4c')],_0x2d4b4f[_0x74e9('0x46')]));_0x19c8d6['where']['ChatWebsiteId']=_0x32d604['id'];if(_0x107340[_0x74e9('0x4c')]['filter']){_0x19c8d6[_0x74e9('0x4f')]=_['merge'](_0x19c8d6[_0x74e9('0x4f')],{'$or':_[_0x74e9('0x41')](_0x19c8d6[_0x74e9('0x48')],function(_0xb4dfc5){var _0x589023={};_0x589023[_0xb4dfc5]={'$like':'%'+_0x107340[_0x74e9('0x4c')][_0x74e9('0x51')]+'%'};return _0x589023;})});}_0x19c8d6=_[_0x74e9('0x52')]({},_0x19c8d6,_0x107340[_0x74e9('0x53')]);return db['CannedAnswer'][_0x74e9('0x31')]({'where':_0x19c8d6[_0x74e9('0x4f')]})[_0x74e9('0x25')](function(_0xf782d0){_0x323847[_0x74e9('0x31')]=_0xf782d0;if(_0x107340[_0x74e9('0x4c')][_0x74e9('0x54')]){_0x19c8d6[_0x74e9('0x55')]=[{'all':!![]}];}return db[_0x74e9('0x6b')][_0x74e9('0x56')](_0x19c8d6);})[_0x74e9('0x25')](function(_0x5f0f07){_0x323847[_0x74e9('0x68')]=_0x5f0f07;return _0x323847;});}})[_0x74e9('0x25')](respondWithFilteredResult(_0x318366,_0x19c8d6))[_0x74e9('0x2c')](handleError(_0x318366,null));};exports['removeAnswers']=function(_0x4d0090,_0x42a9e1,_0x4482ff){return db[_0x74e9('0x42')][_0x74e9('0x59')]({'where':{'id':_0x4d0090[_0x74e9('0x57')]['id']}})['then'](handleEntityNotFound(_0x42a9e1,null))['then'](function(_0x38fdc1){if(_0x38fdc1){return _0x38fdc1[_0x74e9('0x6e')](_0x4d0090[_0x74e9('0x4c')][_0x74e9('0x6a')]);}})['then'](respondWithStatusCode(_0x42a9e1,null))[_0x74e9('0x2c')](handleError(_0x42a9e1,null));};exports[_0x74e9('0x6f')]=function(_0x548e8a,_0x3c4ec4,_0xa84822){_0x548e8a['body'][_0x74e9('0x70')]=_0x548e8a[_0x74e9('0x71')][_0x74e9('0x72')];return db[_0x74e9('0x42')]['find']({'where':{'id':_0x548e8a[_0x74e9('0x57')]['id']}})[_0x74e9('0x25')](handleEntityNotFound(_0x3c4ec4,null))[_0x74e9('0x25')](saveUpdates(_0x548e8a['body'],null))[_0x74e9('0x25')](respondWithResult(_0x3c4ec4,null))[_0x74e9('0x2c')](handleError(_0x3c4ec4,null));};exports[_0x74e9('0x73')]=function(_0x1f73f3,_0xce8f2e,_0x2ddcdd){_0x1f73f3[_0x74e9('0x5b')][_0x74e9('0x74')]=_0x1f73f3[_0x74e9('0x71')][_0x74e9('0x72')];return db[_0x74e9('0x42')]['find']({'where':{'id':_0x1f73f3[_0x74e9('0x57')]['id']}})[_0x74e9('0x25')](handleEntityNotFound(_0xce8f2e,null))[_0x74e9('0x25')](saveUpdates(_0x1f73f3[_0x74e9('0x5b')],null))[_0x74e9('0x25')](respondWithResult(_0xce8f2e,null))[_0x74e9('0x2c')](handleError(_0xce8f2e,null));};exports[_0x74e9('0x75')]=function(_0x408056,_0x3834ab,_0x8ee125){_0x408056[_0x74e9('0x5b')]['customerAvatar']=_0x408056[_0x74e9('0x71')][_0x74e9('0x72')];return db['ChatWebsite'][_0x74e9('0x59')]({'where':{'id':_0x408056[_0x74e9('0x57')]['id']}})['then'](handleEntityNotFound(_0x3834ab,null))['then'](saveUpdates(_0x408056[_0x74e9('0x5b')],null))[_0x74e9('0x25')](respondWithResult(_0x3834ab,null))[_0x74e9('0x2c')](handleError(_0x3834ab,null));};exports['addSystemAvatar']=function(_0x31de11,_0x4a1780,_0x35e7a6){_0x31de11[_0x74e9('0x5b')][_0x74e9('0x76')]=_0x31de11[_0x74e9('0x71')][_0x74e9('0x72')];return db['ChatWebsite']['find']({'where':{'id':_0x31de11['params']['id']}})['then'](handleEntityNotFound(_0x4a1780,null))[_0x74e9('0x25')](saveUpdates(_0x31de11[_0x74e9('0x5b')],null))[_0x74e9('0x25')](respondWithResult(_0x4a1780,null))[_0x74e9('0x2c')](handleError(_0x4a1780,null));};exports['getLogo']=function(_0x1c453a,_0xc9a1f7,_0x190e56){var _0x333955=path[_0x74e9('0x77')](config['root'],_0x74e9('0x78'));var _0x304489={'where':{'id':_0x1c453a[_0x74e9('0x57')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x642161=![];return require(_0x74e9('0x79'))[_0x74e9('0x7a')]()['then'](function(_0x5738f3){if(_0x5738f3){_0x642161=_0x5738f3['custom'];}})['then'](function(){return db[_0x74e9('0x42')]['find'](_0x304489);})[_0x74e9('0x25')](handleEntityNotFound(_0xc9a1f7,null))['then'](function(_0x33bf11){if(_0x33bf11){if(!_[_0x74e9('0x7b')](_0x33bf11[_0x74e9('0x70')])){if(fs['existsSync'](path[_0x74e9('0x77')](config[_0x74e9('0x7c')],_0x74e9('0x7d'),_0x33bf11[_0x74e9('0x70')]))&&_0x642161){_0x333955=path[_0x74e9('0x77')](config[_0x74e9('0x7c')],'server/files/images/logos/',_0x33bf11[_0x74e9('0x70')]);}}return _0xc9a1f7[_0x74e9('0x7e')](_0x333955);}})[_0x74e9('0x2c')](handleError(_0xc9a1f7,null));};exports[_0x74e9('0x7f')]=function(_0x4acd6e,_0x1b04a5,_0x5ae5c8){var _0x3396d0=path[_0x74e9('0x77')](config[_0x74e9('0x7c')],'server/files/images/avatars/default_avatar.png');var _0x3cb572={'where':{'id':_0x4acd6e['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x74e9('0x42')][_0x74e9('0x59')](_0x3cb572)[_0x74e9('0x25')](handleEntityNotFound(_0x1b04a5,null))[_0x74e9('0x25')](function(_0x42e3b6){if(_0x42e3b6){if(!_['isNil'](_0x42e3b6[_0x74e9('0x74')])){if(fs['existsSync'](path[_0x74e9('0x77')](config['root'],_0x74e9('0x80'),_0x42e3b6['agentAvatar']))){_0x3396d0=path['join'](config[_0x74e9('0x7c')],_0x74e9('0x80'),_0x42e3b6[_0x74e9('0x74')]);}}return _0x1b04a5[_0x74e9('0x7e')](_0x3396d0);}})[_0x74e9('0x2c')](handleError(_0x1b04a5,null));};exports['getCustomerAvatar']=function(_0x3d0071,_0x40656e,_0x5d30bc){var _0x3fc414=path[_0x74e9('0x77')](config['root'],_0x74e9('0x81'));var _0x46f106={'where':{'id':_0x3d0071[_0x74e9('0x57')]['id']},'attributes':['id',_0x74e9('0x82'),_0x74e9('0x83')],'raw':!![]};return db[_0x74e9('0x42')][_0x74e9('0x59')](_0x46f106)[_0x74e9('0x25')](handleEntityNotFound(_0x40656e,null))[_0x74e9('0x25')](function(_0x5b6e05){if(_0x5b6e05){if(!_[_0x74e9('0x7b')](_0x5b6e05['customerAvatar'])){if(fs[_0x74e9('0x84')](path[_0x74e9('0x77')](config[_0x74e9('0x7c')],_0x74e9('0x80'),_0x5b6e05[_0x74e9('0x82')]))&&_0x5b6e05['showCustomerAvatar']){_0x3fc414=path[_0x74e9('0x77')](config['root'],'server/files/images/avatars/',_0x5b6e05[_0x74e9('0x82')]);}}return _0x40656e['download'](_0x3fc414);}})[_0x74e9('0x2c')](handleError(_0x40656e,null));};exports[_0x74e9('0x85')]=function(_0x520156,_0x54f43a,_0x55b272){var _0x8af6c0=path['join'](config['root'],'server/files/images/avatars/system_avatar.png');var _0x423317={'where':{'id':_0x520156[_0x74e9('0x57')]['id']},'attributes':['id',_0x74e9('0x76')],'raw':!![]};return db[_0x74e9('0x42')][_0x74e9('0x59')](_0x423317)[_0x74e9('0x25')](handleEntityNotFound(_0x54f43a,null))[_0x74e9('0x25')](function(_0x9ab6fd){if(_0x9ab6fd){if(!_['isNil'](_0x9ab6fd[_0x74e9('0x76')])){if(fs[_0x74e9('0x84')](path[_0x74e9('0x77')](config['root'],_0x74e9('0x80'),_0x9ab6fd[_0x74e9('0x76')]))){_0x8af6c0=path[_0x74e9('0x77')](config[_0x74e9('0x7c')],_0x74e9('0x80'),_0x9ab6fd['systemAvatar']);}}return _0x54f43a[_0x74e9('0x7e')](_0x8af6c0);}})[_0x74e9('0x2c')](handleError(_0x54f43a,null));};exports[_0x74e9('0x86')]=function(_0x443b48,_0x159705,_0xb840de){var _0x4a59e9=require('user-agent-parser');var _0x3c28fd=new _0x4a59e9();var _0xca3ae4=_0x3c28fd['setUA'](_0x443b48[_0x74e9('0x87')][_0x74e9('0x88')])[_0x74e9('0x89')]();var _0x5d78df={'body':_0x443b48[_0x74e9('0x5b')],'channel':_0x74e9('0x8a')};var _0x4eea80=[];var _0x294d88=[];var _0x596b8f={};var _0x15d223=![];return db[_0x74e9('0x8b')][_0x74e9('0x60')]()[_0x74e9('0x25')](function(_0x365b7f){if(!_0x365b7f){throw new db['Sequelize'][(_0x74e9('0x8c'))](_0x74e9('0x8d'));}_0x4eea80=_[_0x74e9('0x8e')](_[_0x74e9('0x45')](_0x365b7f),[_0x74e9('0x8f'),_0x74e9('0x90')]);_0x294d88=_['difference'](_['keys'](_0x365b7f),[_0x74e9('0x8f'),_0x74e9('0x90'),_0x74e9('0x91'),_0x74e9('0x92')]);if(_0x443b48[_0x74e9('0x5b')]['id']){delete _0x443b48['body']['id'];}if(_[_0x74e9('0x7b')](_0x443b48[_0x74e9('0x5b')][_0x74e9('0x93')])){throw new db[(_0x74e9('0x22'))][(_0x74e9('0x8c'))](_0x74e9('0x94'));}if(_['isNil'](_0x443b48[_0x74e9('0x5b')][_0x74e9('0x5b')])||_0x443b48[_0x74e9('0x5b')][_0x74e9('0x5b')]===''){throw new db[(_0x74e9('0x22'))][(_0x74e9('0x8c'))](_0x74e9('0x95'));}if(_[_0x74e9('0x7b')](_0x443b48['body'][_0x74e9('0x96')])){throw new db['Sequelize'][(_0x74e9('0x8c'))](_0x74e9('0x97')+_0x294d88);}if(!_[_0x74e9('0x98')](_0x294d88,_0x443b48[_0x74e9('0x5b')]['mapKey'])){throw new db[(_0x74e9('0x22'))][(_0x74e9('0x8c'))](_0x74e9('0x99')+_0x294d88);}_0x596b8f[_0x443b48['body'][_0x74e9('0x96')]]=_0x443b48[_0x74e9('0x5b')][_0x74e9('0x93')];})[_0x74e9('0x25')](function(){return db[_0x74e9('0x42')][_0x74e9('0x59')]({'where':{'id':_0x443b48[_0x74e9('0x57')]['id']},'include':[{'model':db[_0x74e9('0x9a')],'as':_0x74e9('0x9b'),'include':[{'model':db[_0x74e9('0x8b')],'as':_0x74e9('0x9c'),'where':_0x596b8f,'limit':0x1,'order':[[_0x74e9('0x90'),_0x74e9('0x9d')]]}]},{'model':db[_0x74e9('0x9e')],'as':_0x74e9('0x9f')}]});})['then'](handleEntityNotFound(_0x159705,null))['then'](function(_0x57a922){if(_0x57a922&&_0x57a922['List']){_0x5d78df[_0x74e9('0xa0')]=_0x57a922;_0x5d78df['applications']=_0x57a922[_0x74e9('0x9f')];_0x5d78df['list']=_0x57a922['List'];_0x5d78df['applications']=_[_0x74e9('0xa1')](_0x5d78df[_0x74e9('0xa2')],[_0x74e9('0xa3')],[_0x74e9('0xa4')]);if(_0x5d78df[_0x74e9('0xa0')][_0x74e9('0x9f')]){delete _0x5d78df[_0x74e9('0xa0')]['Applications'];}if(_0x5d78df['account'][_0x74e9('0x9b')]&&_0x5d78df[_0x74e9('0xa0')][_0x74e9('0x9b')][_0x74e9('0x9c')][_0x74e9('0x4a')]){return _0x5d78df[_0x74e9('0xa0')][_0x74e9('0x9b')][_0x74e9('0x9c')][0x0];}var _0xd0fc9d=_[_0x74e9('0xa5')](_0x443b48['body'],{'firstName':_0x443b48[_0x74e9('0x5b')][_0x74e9('0x93')],'ListId':_0x57a922[_0x74e9('0x92')]});_0xd0fc9d[_0x443b48[_0x74e9('0x5b')][_0x74e9('0x96')]]=_0x443b48[_0x74e9('0x5b')][_0x74e9('0x93')];return db['CmContact'][_0x74e9('0x5a')](_0xd0fc9d,{'fields':_0x4eea80,'raw':!![]});}})['then'](handleEntityNotFound(_0x159705,null))['then'](function(_0x3c373d){_0x5d78df[_0x74e9('0xa6')]=_0x3c373d;var _0x19c279=_0x443b48[_0x74e9('0x5b')][_0x74e9('0xa7')];if(_0x443b48[_0x74e9('0x87')][_0x74e9('0xa8')]){_0x19c279=_0x443b48['headers'][_0x74e9('0xa8')];}else if(_0x443b48['headers']['x-forwarded-for']){_0x19c279=_[_0x74e9('0xa9')](_0x443b48[_0x74e9('0x87')][_0x74e9('0xaa')][_0x74e9('0xab')](','));}if(_0x3c373d){var _0x8a4c1a={'ContactId':_0x3c373d['id'],'ChatWebsiteId':_0x443b48[_0x74e9('0x57')]['id'],'from':(_0x3c373d[_0x74e9('0xac')]||'')+'\x20'+(_0x3c373d[_0x74e9('0xad')]||''),'customerIp':_0x19c279,'customerPort':_0x443b48[_0x74e9('0x87')][_0x74e9('0xae')]?_0x443b48[_0x74e9('0x87')]['x-real-port']:null,'referer':_0x443b48[_0x74e9('0x5b')][_0x74e9('0xaf')],'browserName':_0xca3ae4[_0x74e9('0xb0')][_0x74e9('0x3d')]&&_0xca3ae4[_0x74e9('0xb0')]['version']?util[_0x74e9('0xb1')](_0x74e9('0xb2'),_0xca3ae4[_0x74e9('0xb0')]['name'],_0xca3ae4['browser'][_0x74e9('0xb3')]):_0x74e9('0xb4'),'browserVersion':_0xca3ae4[_0x74e9('0xb0')][_0x74e9('0xb3')]||_0x74e9('0xb4'),'osName':util[_0x74e9('0xb1')](_0x74e9('0xb2'),_0xca3ae4['os'][_0x74e9('0x3d')],_0xca3ae4['os'][_0x74e9('0xb3')]),'osVersion':_0xca3ae4['os'][_0x74e9('0xb3')],'deviceModel':_0xca3ae4[_0x74e9('0xb5')][_0x74e9('0x4b')]&&_0xca3ae4[_0x74e9('0xb5')][_0x74e9('0xb6')]?util['format']('%s\x20%s\x20%s',_0xca3ae4['device'][_0x74e9('0x4b')],_0xca3ae4[_0x74e9('0xb5')][_0x74e9('0xb6')],_0xca3ae4['device'][_0x74e9('0x44')]):null,'deviceVendor':_0xca3ae4['device'][_0x74e9('0xb6')],'deviceType':_0xca3ae4[_0x74e9('0xb5')][_0x74e9('0x44')],'formData':JSON[_0x74e9('0xb7')](_0x443b48[_0x74e9('0x5b')])};var _0x224e9b={'ChatWebsiteId':_0x443b48[_0x74e9('0x57')]['id'],'closed':![]};if(_0x443b48[_0x74e9('0x5b')][_0x74e9('0xb8')]){_0x224e9b[_0x74e9('0xb8')]=_0x443b48[_0x74e9('0x5b')]['threadId'];return db[_0x74e9('0xb9')][_0x74e9('0x59')]({'where':_0x224e9b})['then'](function(_0x275ca7){if(_0x275ca7){return[_0x275ca7,![]];}_0x8a4c1a[_0x74e9('0xb8')]=_0x443b48[_0x74e9('0x5b')][_0x74e9('0xb8')];_0x8a4c1a[_0x74e9('0xba')]=_0x443b48[_0x74e9('0x5b')][_0x74e9('0xba')];return db[_0x74e9('0xb9')][_0x74e9('0x5a')](_0x8a4c1a)[_0x74e9('0x25')](function(_0x6854ee){return[_0x6854ee,!![]];});});}_0x224e9b[_0x74e9('0xbb')]=_0x3c373d['id'];if(_0x443b48[_0x74e9('0x5b')][_0x74e9('0xbc')]&&_0x443b48[_0x74e9('0x5b')][_0x74e9('0xbc')]['id']){_0x224e9b['id']=_0x443b48[_0x74e9('0x5b')][_0x74e9('0xbc')]['id'];return db[_0x74e9('0xb9')][_0x74e9('0x59')]({'where':_0x224e9b})[_0x74e9('0x25')](function(_0x2116f7){if(_0x2116f7){return[_0x2116f7,![]];}return db[_0x74e9('0xb9')][_0x74e9('0x5a')](_0x8a4c1a)['then'](function(_0x1c6bfc){return[_0x1c6bfc,!![]];});});}return db['ChatInteraction'][_0x74e9('0x5a')](_0x8a4c1a)[_0x74e9('0x25')](function(_0x405d01){return[_0x405d01,!![]];});}})['spread'](function(_0x45723b,_0x45ae11){if(_0x45723b){_0x15d223=_0x45ae11;if(!_0x45ae11){var _0x525af7={'from':(_0x5d78df[_0x74e9('0xa6')][_0x74e9('0xac')]||'')+'\x20'+(_0x5d78df[_0x74e9('0xa6')][_0x74e9('0xad')]||'')};if(_0x443b48[_0x74e9('0x5b')][_0x74e9('0xb8')]&&_0x443b48[_0x74e9('0x5b')][_0x74e9('0xbd')]&&_0x443b48['body'][_0x74e9('0xb8')]!=_0x443b48[_0x74e9('0x5b')][_0x74e9('0xbd')]){_0x525af7[_0x74e9('0xb8')]=_0x443b48[_0x74e9('0x5b')][_0x74e9('0xbd')];}return _0x45723b['update'](_0x525af7);}else{return _0x45723b;}}})[_0x74e9('0x25')](function(_0x855a8d){_0x5d78df[_0x74e9('0xbc')]=_0x855a8d[_0x74e9('0x39')]({'plain':!![]});_0x5d78df[_0x74e9('0xbc')]['created']=_0x15d223;if(_0x5d78df['interaction'][_0x74e9('0xbe')]){if(_0x5d78df[_0x74e9('0xa0')][_0x74e9('0xbf')]){_0x5d78df[_0x74e9('0xa2')]['push']({'id':0x0,'priority':_0x5d78df[_0x74e9('0xa2')][_0x74e9('0x4a')]+0x1,'app':'close','appdata':_0x74e9('0xc0'),'interval':_0x74e9('0xc1')});}}return db[_0x74e9('0xc2')][_0x74e9('0x5a')]({'body':_0x443b48['body'][_0x74e9('0x5b')],'ChatWebsiteId':_0x443b48['params']['id'],'ChatInteractionId':_0x855a8d['id'],'direction':'in','ContactId':_0x5d78df[_0x74e9('0xa6')]['id'],'AttachmentId':_0x443b48['body']['AttachmentId']});})[_0x74e9('0x25')](function(_0x16c08b){_0x5d78df[_0x74e9('0x2a')]=_0x16c08b;if(_0x5d78df[_0x74e9('0xbc')][_0x74e9('0xc3')]){return db[_0x74e9('0xc4')][_0x74e9('0x59')]({'attributes':['id',_0x74e9('0x3d')],'where':{'id':_0x5d78df[_0x74e9('0xbc')][_0x74e9('0xc3')]}})['then'](function(_0x5df10d){if(_0x5df10d){_0x5d78df[_0x74e9('0xa2')]['unshift']({'id':0x0,'priority':0x0,'app':_0x74e9('0xc5'),'appdata':_0x5df10d[_0x74e9('0x3d')]+','+(_0x5d78df[_0x74e9('0xa0')][_0x74e9('0xc6')]||0xa),'interval':'*,*,*,*'});_0x5d78df[_0x74e9('0xc7')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x5d78df);});}return respondWithRpcPromise('Start',_0x74e9('0xc8'),_0x5d78df);})[_0x74e9('0x25')](function(_0x281414){respondWithRpcPromise(_0x74e9('0xc9'),_0x74e9('0xc9'),{'event':_0x74e9('0x86'),'message':_0x281414},client9002);return _0x281414;})['then'](respondWithResult(_0x159705,null))[_0x74e9('0x2c')](handleError(_0x159705,null));};exports['offline']=function(_0x53d903,_0x53f164,_0x4ad4f5){var _0x1304a7,_0xc39d4,_0x320f6e;var _0x5e9539=[];var _0x35b316=[];var _0x4f3406={};return db[_0x74e9('0x8b')]['describe']()['then'](function(_0x979db5){if(!_0x979db5){throw new db[(_0x74e9('0x22'))][(_0x74e9('0x8c'))](_0x74e9('0x8d'));}_0x35b316=_[_0x74e9('0x8e')](_[_0x74e9('0x45')](_0x979db5),[_0x74e9('0x8f'),_0x74e9('0x90')]);_0x5e9539=_['difference'](_[_0x74e9('0x45')](_0x979db5),[_0x74e9('0x8f'),_0x74e9('0x90'),_0x74e9('0x91'),_0x74e9('0x92')]);if(_0x53d903[_0x74e9('0x5b')]['id']){delete _0x53d903[_0x74e9('0x5b')]['id'];}if(_[_0x74e9('0x7b')](_0x53d903[_0x74e9('0x5b')][_0x74e9('0x93')])){throw _0x53f164[_0x74e9('0x2f')](0x1f4)[_0x74e9('0x3e')](new db[(_0x74e9('0x22'))][(_0x74e9('0x8c'))](_0x74e9('0x94')));}if(_['isNil'](_0x53d903[_0x74e9('0x5b')]['body'])||_0x53d903['body'][_0x74e9('0x5b')]===''){throw _0x53f164['status'](0x1f4)[_0x74e9('0x3e')](new db['Sequelize'][(_0x74e9('0x8c'))](_0x74e9('0x95')));}if(_[_0x74e9('0x7b')](_0x53d903[_0x74e9('0x5b')]['mapKeyOffline'])){throw _0x53f164[_0x74e9('0x2f')](0x1f4)[_0x74e9('0x3e')](new db[(_0x74e9('0x22'))][(_0x74e9('0x8c'))](_0x74e9('0xca')+_0x5e9539));}if(!_[_0x74e9('0x98')](_0x5e9539,_0x53d903['body'][_0x74e9('0xcb')])){throw _0x53f164[_0x74e9('0x2f')](0x1f4)[_0x74e9('0x3e')](new db[(_0x74e9('0x22'))][(_0x74e9('0x8c'))](_0x74e9('0xcc')+_0x5e9539));}_0x4f3406[_0x53d903['body']['mapKeyOffline']]=_0x53d903[_0x74e9('0x5b')][_0x74e9('0x93')];})[_0x74e9('0x25')](function(){return db[_0x74e9('0x42')][_0x74e9('0x59')]({'where':{'id':_0x53d903['params']['id']},'include':[{'model':db[_0x74e9('0x9a')],'as':_0x74e9('0x9b')}]});})[_0x74e9('0x25')](handleEntityNotFound(_0x53f164,null))[_0x74e9('0x25')](function(_0xf537fa){if(_0xf537fa&&_0xf537fa[_0x74e9('0x9b')]){_0xc39d4=_0xf537fa;var _0x17e8f8=_[_0x74e9('0xa5')](_0x53d903['body'],{'firstName':_0x53d903[_0x74e9('0x5b')][_0x74e9('0x93')],'phone':_0x53d903['body'][_0x74e9('0x93')],'ListId':_0xf537fa[_0x74e9('0x92')]});_0x17e8f8[_0x53d903[_0x74e9('0x5b')]['mapKeyOffline']]=_0x53d903[_0x74e9('0x5b')][_0x74e9('0x93')];return db[_0x74e9('0x8b')][_0x74e9('0xcd')]({'where':_0x4f3406,'defaults':_0x17e8f8});}})['spread'](function(_0x374735){if(_0x374735){_0x320f6e=_0x374735;var _0x6593c6=fs[_0x74e9('0xce')](path[_0x74e9('0x77')](config[_0x74e9('0x7c')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x2560e0=ejs['render'](_0x6593c6,{'body':_[_0x74e9('0xcf')](_0x53d903[_0x74e9('0x5b')][_0x74e9('0x5b')]),'bodyTitle':_0xc39d4['offlineMessageBody']});return db[_0x74e9('0xd0')][_0x74e9('0x5a')]({'body':_0x2560e0,'ContactId':_0x374735['id'],'ChatWebsiteId':_0xc39d4['id']});}})[_0x74e9('0x25')](function(_0x598a55){if(_0x598a55){_0x1304a7=_0x598a55;return db[_0x74e9('0xd1')][_0x74e9('0x65')]({'where':{'service':!![]},'include':[{'model':db[_0x74e9('0xd2')],'as':'Smtp','raw':!![]}]});}})[_0x74e9('0x25')](function(_0x77c6d5){if(_0x77c6d5&&_0x77c6d5[_0x74e9('0xd3')]&&_0xc39d4[_0x74e9('0xd4')]){var _0x2874a0={'tls':{'rejectUnauthorized':![]}};if(_0x77c6d5['Smtp']['service']){_0x2874a0[_0x74e9('0xd5')]=_0x77c6d5[_0x74e9('0xd3')][_0x74e9('0xd5')];}else{_0x2874a0['host']=_0x77c6d5[_0x74e9('0xd3')]['host'];_0x2874a0[_0x74e9('0xd6')]=_0x77c6d5[_0x74e9('0xd3')][_0x74e9('0xd6')];_0x2874a0[_0x74e9('0xd7')]=_0x77c6d5[_0x74e9('0xd3')]['secure'];}if(_0x77c6d5[_0x74e9('0xd3')][_0x74e9('0xd8')]){_0x2874a0[_0x74e9('0xd9')]={'user':_0x77c6d5[_0x74e9('0xd3')][_0x74e9('0x5c')],'pass':_0x77c6d5[_0x74e9('0xd3')][_0x74e9('0xda')]};}return respondWithRpcPromise('SendMail',_0x74e9('0xdb'),{'account':_0x2874a0,'message':{'from':util[_0x74e9('0xb1')](_0x74e9('0xdc'),_0x77c6d5[_0x74e9('0x3d')],_0x77c6d5[_0x74e9('0xdd')]||_0x77c6d5[_0x74e9('0xd3')]['user']),'to':_0xc39d4[_0x74e9('0xd4')],'subject':_0xc39d4[_0x74e9('0xde')],'text':_0x1304a7[_0x74e9('0x5b')]}},client9003)[_0x74e9('0x25')](function(){return _0x1304a7;})['catch'](function(_0x21b714){console[_0x74e9('0x28')](_0x21b714);});}})[_0x74e9('0x25')](function(){if(_0x1304a7){return _0x1304a7;}})[_0x74e9('0x25')](respondWithResult(_0x53f164,null))[_0x74e9('0x2c')](handleError(_0x53f164,null));};exports[_0x74e9('0xdf')]=function(_0x194a32,_0x527f0d,_0x406218){return db[_0x74e9('0xb9')][_0x74e9('0x59')]({'where':{'id':_0x194a32['params']['id']}})[_0x74e9('0x25')](handleEntityNotFound(_0x527f0d,null))[_0x74e9('0x25')](function(_0x58ff69){if(_0x58ff69){return _0x58ff69['addInteraction'](_0x194a32[_0x74e9('0x5b')]['ids'],_[_0x74e9('0xe0')](_0x194a32[_0x74e9('0x5b')],['ids','id'])||{});}})[_0x74e9('0x25')](respondWithResult(_0x527f0d,null))[_0x74e9('0x2c')](handleError(_0x527f0d,null));};exports[_0x74e9('0xe1')]=function(_0x13b1cd,_0x2f306d,_0xed7a04){var _0x326b2d={'raw':![],'where':{}};var _0x352655={};var _0x34fc20={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x13b1cd[_0x74e9('0x57')]['id']}})[_0x74e9('0x25')](handleEntityNotFound(_0x2f306d,null))[_0x74e9('0x25')](function(_0x1416ea){if(_0x1416ea){_0x352655['model']=_['keys'](db[_0x74e9('0xb9')][_0x74e9('0x6d')]);_0x352655[_0x74e9('0x4c')]=_[_0x74e9('0x45')](_0x13b1cd[_0x74e9('0x4c')]);_0x352655['filters']=_[_0x74e9('0x47')](_0x352655['model'],_0x352655[_0x74e9('0x4c')]);_0x326b2d[_0x74e9('0x48')]=_[_0x74e9('0x47')](_0x352655['model'],qs['fields'](_0x13b1cd['query'][_0x74e9('0x49')]));_0x326b2d['attributes']=_0x326b2d['attributes'][_0x74e9('0x4a')]?_0x326b2d[_0x74e9('0x48')]:_0x352655[_0x74e9('0x4b')];if(!_0x13b1cd[_0x74e9('0x4c')][_0x74e9('0x4d')]('nolimit')){_0x326b2d['limit']=qs[_0x74e9('0x33')](_0x13b1cd['query'][_0x74e9('0x33')]);_0x326b2d[_0x74e9('0x32')]=qs[_0x74e9('0x32')](_0x13b1cd['query'][_0x74e9('0x32')]);}_0x326b2d['order']=qs[_0x74e9('0x4e')](_0x13b1cd[_0x74e9('0x4c')]['sort']);_0x326b2d[_0x74e9('0x4f')]=qs['filters'](_[_0x74e9('0x50')](_0x13b1cd[_0x74e9('0x4c')],_0x352655[_0x74e9('0x46')]));_0x326b2d[_0x74e9('0x4f')][_0x74e9('0x62')]=_0x1416ea['id'];if(_0x13b1cd[_0x74e9('0x4c')]['filter']){_0x326b2d[_0x74e9('0x4f')]=_[_0x74e9('0x52')](_0x326b2d['where'],{'$or':_[_0x74e9('0x41')](_0x326b2d[_0x74e9('0x48')],function(_0x4ec81c){var _0x4afcd0={};_0x4afcd0[_0x4ec81c]={'$like':'%'+_0x13b1cd['query'][_0x74e9('0x51')]+'%'};return _0x4afcd0;})});}_0x326b2d=_[_0x74e9('0x52')]({},_0x326b2d,_0x13b1cd[_0x74e9('0x53')]);return db[_0x74e9('0xb9')][_0x74e9('0x31')]({'where':_0x326b2d[_0x74e9('0x4f')]})['then'](function(_0x85b228){_0x34fc20['count']=_0x85b228;if(_0x13b1cd[_0x74e9('0x4c')][_0x74e9('0x54')]){_0x326b2d[_0x74e9('0x55')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x74e9('0xc4')],'as':'Owner','attributes':[_0x74e9('0x3d'),'fullname',_0x74e9('0xe2')],'required':![]},{'model':db[_0x74e9('0xe3')],'as':'Tags','attributes':['id',_0x74e9('0x3d'),_0x74e9('0xe4')],'where':_0x13b1cd['query']['tag']?{'id':_0x13b1cd[_0x74e9('0x4c')][_0x74e9('0xe5')]}:undefined,'required':_0x13b1cd['query'][_0x74e9('0xe5')]?!![]:![]}];}return db[_0x74e9('0xb9')][_0x74e9('0x56')](_0x326b2d);})[_0x74e9('0x25')](function(_0x1d280c){_0x34fc20['rows']=_0x1d280c;return _0x34fc20;});}})[_0x74e9('0x25')](respondWithFilteredResult(_0x2f306d,_0x326b2d))[_0x74e9('0x2c')](handleError(_0x2f306d,null));};function iftimePromise(_0x539355,_0x31e3ed){return respondWithRpcPromise(_0x74e9('0xe6'),_0x74e9('0xe7'),{'command':_0x31e3ed[_0x74e9('0xe8')]?util[_0x74e9('0xb1')]('iftime\x20%s,%s',_0x539355[_0x74e9('0xe9')],_0x31e3ed['timezone']):util[_0x74e9('0xb1')](_0x74e9('0xea'),_0x539355[_0x74e9('0xe9')])},client9002)[_0x74e9('0x25')](function(_0x2d01e8){var _0xde9dde=_0x2d01e8&&_0x2d01e8[_0x74e9('0xeb')](_0x74e9('0xec'))>=0x0?!![]:![];logger[_0x74e9('0x2b')](_0x74e9('0xed'),_0x31e3ed['id'],_0x539355['id'],_0x539355[_0x74e9('0xe9')],_0xde9dde?_0x74e9('0xee'):_0x74e9('0xef'),_0x31e3ed[_0x74e9('0xe8')]?_0x31e3ed['timezone']:_0x74e9('0xf0'));return _0xde9dde;})[_0x74e9('0x2c')](function(_0x47df6b){logger[_0x74e9('0x28')](_0x74e9('0xed'),_0x31e3ed['id'],_0x539355['id'],_0x539355[_0x74e9('0xe9')],util['inspect'](_0x47df6b,{'showHidden':![],'depth':null}),_0x31e3ed['timezone']?_0x31e3ed[_0x74e9('0xe8')]:'No\x20timezone');return![];});}exports[_0x74e9('0xe7')]=function(_0x21905a,_0x5cee67,_0x10f028){var _0x38b0b3=0x0;var _0x13e509=0x0;var _0x2cd604=![];var _0x1c30c0;var _0x5bb4c7;return db['ChatWebsite']['find']({'where':{'id':_0x21905a[_0x74e9('0x57')]['id']},'include':[{'model':db[_0x74e9('0xf1')],'as':_0x74e9('0xf1'),'include':[{'model':db[_0x74e9('0xf1')],'as':_0x74e9('0xf2'),'attributes':['id',_0x74e9('0xe9')],'raw':!![]}]}]})[_0x74e9('0x25')](handleEntityNotFound(_0x5cee67,null))[_0x74e9('0x25')](function(_0x4a7045){if(_0x4a7045){_0x1c30c0=_0x4a7045;return _0x4a7045['getProactiveActions']({'raw':!![]});}})[_0x74e9('0x25')](function(_0x262334){if(_0x1c30c0){if(_0x262334){_0x5bb4c7=_0x262334;}}return require('../../config/license/util')[_0x74e9('0x7a')]();})[_0x74e9('0x25')](function(_0xd2994f){if(_0xd2994f){_0x13e509=_0xd2994f['virtual'];_0x2cd604=_0xd2994f['custom'];}})['then'](function(){return db[_0x74e9('0xb9')][_0x74e9('0x31')]({'where':{'closed':![]}});})[_0x74e9('0x25')](function(_0xfe657e){_0x38b0b3=_0xfe657e;if(_0x13e509&&_0xfe657e>_0x13e509){return db[_0x74e9('0xf3')][_0x74e9('0x65')]({'where':{'id':0x1}})[_0x74e9('0x25')](function(_0x139076){if(_0x139076){_0x139076[_0x74e9('0xf4')](_0x74e9('0xf5'));}});}})[_0x74e9('0x25')](function(){if(_0x1c30c0[_0x74e9('0xf1')]&&_0x1c30c0[_0x74e9('0xf1')]['Intervals']){var _0x32d144=[];for(var _0x2e86d1=0x0;_0x2e86d1<_0x1c30c0[_0x74e9('0xf1')][_0x74e9('0xf2')]['length'];_0x2e86d1++){var _0x37cbbc=_0x1c30c0['Interval']['Intervals'][_0x2e86d1][_0x74e9('0x39')]({'plain':!![]});_0x32d144['push'](iftimePromise(_0x37cbbc,_0x1c30c0));}return BPromise[_0x74e9('0xf6')](_0x32d144)[_0x74e9('0x25')](function(_0x4878b3){return _[_0x74e9('0xf7')](_0x4878b3);});}else{return!![];}})['then'](function(_0x4727e8){var _0x67ff9a=fs[_0x74e9('0xce')](path['join'](config[_0x74e9('0x7c')],_0x74e9('0xf8')),_0x74e9('0xf9'));var _0xa2901b={'remote':_0x1c30c0[_0x74e9('0xfa')],'query':querystring[_0x74e9('0xb7')](_[_0x74e9('0x52')](_0x1c30c0['get']({'plain':!![]}),{'customerIp':_0x21905a['headers'][_0x74e9('0xaa')]||_0x21905a[_0x74e9('0x87')][_0x74e9('0xfb')]||_0x21905a[_0x74e9('0xfc')][_0x74e9('0xfd')]||_0x21905a['ip'],'referer':_0x21905a[_0x74e9('0x87')][_0x74e9('0xaf')],'openedInteractions':_0x38b0b3,'maxInteractions':_0x13e509,'virtual':_0x2cd604['virtual'],'online':_0x4727e8,'custom':_0x2cd604}))[_0x74e9('0xfe')](/'/g,'\x5c\x27')};_0x5cee67['send'](ejs[_0x74e9('0xff')](Mustache['render'](_0x67ff9a,_0xa2901b),{'proactiveActions':_0x5bb4c7,'alignment':_0x1c30c0[_0x74e9('0x100')],'verticalAlignment':_0x1c30c0[_0x74e9('0x101')],'div_color':_0x1c30c0[_0x74e9('0xe4')],'text_color':_0x1c30c0[_0x74e9('0x102')]}));})[_0x74e9('0x2c')](handleError(_0x5cee67,null));};exports['addApplications']=function(_0x43dee3,_0x3b049e,_0x19c978){return db[_0x74e9('0x42')][_0x74e9('0x65')]({'where':{'id':_0x43dee3[_0x74e9('0x57')]['id']}})['then'](handleEntityNotFound(_0x3b049e,null))[_0x74e9('0x25')](function(_0x4d23ce){if(_0x4d23ce){return db[_0x74e9('0x103')][_0x74e9('0x104')](function(_0x1d5aad){return db[_0x74e9('0x9e')][_0x74e9('0x38')]({'where':{'ChatWebsiteId':_0x43dee3['params']['id']},'transaction':_0x1d5aad})[_0x74e9('0x25')](function(_0x1e18b2){var _0x2a8978=_['map'](_0x43dee3[_0x74e9('0x5b')],function(_0x160bd2){_0x160bd2[_0x74e9('0x62')]=_0x43dee3[_0x74e9('0x57')]['id'];return _0x160bd2;});return db[_0x74e9('0x9e')][_0x74e9('0x105')](_0x2a8978,{'transaction':_0x1d5aad});});})[_0x74e9('0x25')](function(){return db[_0x74e9('0x9e')][_0x74e9('0x106')]({'where':{'ChatWebsiteId':_0x43dee3[_0x74e9('0x57')]['id']},'order':_0x74e9('0xa3')});});}})[_0x74e9('0x25')](respondWithResult(_0x3b049e,null))['catch'](handleError(_0x3b049e,null));};exports['getApplications']=function(_0x565cad,_0x439029,_0x868176){var _0x1005d7={};var _0x55f2d2={};var _0x3af499;var _0x5dc8f1;return db[_0x74e9('0x42')]['findOne']({'where':{'id':_0x565cad[_0x74e9('0x57')]['id']}})['then'](handleEntityNotFound(_0x439029,null))[_0x74e9('0x25')](function(_0x7058e4){if(_0x7058e4){_0x3af499=_0x7058e4;_0x55f2d2[_0x74e9('0x4b')]=_[_0x74e9('0x45')](db[_0x74e9('0x9e')][_0x74e9('0x6d')]);_0x55f2d2[_0x74e9('0x4c')]=_[_0x74e9('0x45')](_0x565cad['query']);_0x55f2d2[_0x74e9('0x46')]=_[_0x74e9('0x47')](_0x55f2d2['model'],_0x55f2d2[_0x74e9('0x4c')]);_0x1005d7[_0x74e9('0x48')]=_['intersection'](_0x55f2d2['model'],qs['fields'](_0x565cad['query'][_0x74e9('0x49')]));_0x1005d7[_0x74e9('0x48')]=_0x1005d7[_0x74e9('0x48')][_0x74e9('0x4a')]?_0x1005d7[_0x74e9('0x48')]:_0x55f2d2[_0x74e9('0x4b')];_0x1005d7[_0x74e9('0x67')]=qs['sort'](_0x565cad[_0x74e9('0x4c')][_0x74e9('0x4e')]);_0x1005d7['where']=qs['filters'](_[_0x74e9('0x50')](_0x565cad[_0x74e9('0x4c')],_0x55f2d2[_0x74e9('0x46')]));if(_0x565cad[_0x74e9('0x4c')]['filter']){_0x1005d7[_0x74e9('0x4f')]=_[_0x74e9('0x52')](_0x1005d7[_0x74e9('0x4f')],{'$or':_[_0x74e9('0x41')](_0x1005d7['attributes'],function(_0x34c3a9){var _0x118b43={};_0x118b43[_0x34c3a9]={'$like':'%'+_0x565cad[_0x74e9('0x4c')][_0x74e9('0x51')]+'%'};return _0x118b43;})});}_0x1005d7=_[_0x74e9('0x52')]({},_0x1005d7,_0x565cad['options']);return _0x3af499[_0x74e9('0x107')](_0x1005d7);}})[_0x74e9('0x25')](function(_0x55e7ce){if(_0x55e7ce){_0x5dc8f1=_0x55e7ce[_0x74e9('0x4a')];if(!_0x565cad['query'][_0x74e9('0x4d')](_0x74e9('0x66'))){_0x1005d7[_0x74e9('0x33')]=qs[_0x74e9('0x33')](_0x565cad[_0x74e9('0x4c')][_0x74e9('0x33')]);_0x1005d7['offset']=qs[_0x74e9('0x32')](_0x565cad[_0x74e9('0x4c')][_0x74e9('0x32')]);}return _0x3af499[_0x74e9('0x107')](_0x1005d7);}})[_0x74e9('0x25')](function(_0x292c7a){if(_0x292c7a){return _0x292c7a?{'count':_0x5dc8f1,'rows':_0x292c7a}:null;}})[_0x74e9('0x25')](respondWithResult(_0x439029,null))['catch'](handleError(_0x439029,null));};exports[_0x74e9('0x108')]=function(_0x40fdc6,_0x1523ff,_0x32c0f1){return db['chatProactiveAction'][_0x74e9('0x59')]({'where':{'id':_0x40fdc6['params']['id']}})['then'](handleEntityNotFound(_0x1523ff,null))[_0x74e9('0x25')](function(_0x1d004d){if(_0x1d004d){return _0x1d004d[_0x74e9('0x108')](_0x40fdc6[_0x74e9('0x5b')]['ids'],_['omit'](_0x40fdc6[_0x74e9('0x5b')],['ids','id'])||{});}})[_0x74e9('0x25')](respondWithResult(_0x1523ff,null))[_0x74e9('0x2c')](handleError(_0x1523ff,null));};exports['getProactiveActions']=function(_0x2826cd,_0x3da3cf,_0xaef2c){var _0x2cfe95={};var _0x4e666e={};var _0x383e4c;var _0x1264dc;return db[_0x74e9('0x42')]['findOne']({'where':{'id':_0x2826cd[_0x74e9('0x57')]['id']}})['then'](handleEntityNotFound(_0x3da3cf,null))[_0x74e9('0x25')](function(_0x396e2f){if(_0x396e2f){_0x383e4c=_0x396e2f;_0x4e666e[_0x74e9('0x4b')]=_[_0x74e9('0x45')](db['ChatProactiveAction'][_0x74e9('0x6d')]);_0x4e666e[_0x74e9('0x4c')]=_[_0x74e9('0x45')](_0x2826cd[_0x74e9('0x4c')]);_0x4e666e[_0x74e9('0x46')]=_[_0x74e9('0x47')](_0x4e666e[_0x74e9('0x4b')],_0x4e666e['query']);_0x2cfe95[_0x74e9('0x48')]=_[_0x74e9('0x47')](_0x4e666e['model'],qs['fields'](_0x2826cd[_0x74e9('0x4c')][_0x74e9('0x49')]));_0x2cfe95[_0x74e9('0x48')]=_0x2cfe95['attributes']['length']?_0x2cfe95['attributes']:_0x4e666e['model'];_0x2cfe95[_0x74e9('0x67')]=qs['sort'](_0x2826cd[_0x74e9('0x4c')]['sort']);_0x2cfe95[_0x74e9('0x4f')]=qs[_0x74e9('0x46')](_[_0x74e9('0x50')](_0x2826cd[_0x74e9('0x4c')],_0x4e666e[_0x74e9('0x46')]));if(_0x2826cd[_0x74e9('0x4c')][_0x74e9('0x51')]){_0x2cfe95[_0x74e9('0x4f')]=_[_0x74e9('0x52')](_0x2cfe95[_0x74e9('0x4f')],{'$or':_[_0x74e9('0x41')](_0x2cfe95[_0x74e9('0x48')],function(_0x25748c){var _0x5d4b10={};_0x5d4b10[_0x25748c]={'$like':'%'+_0x2826cd['query'][_0x74e9('0x51')]+'%'};return _0x5d4b10;})});}_0x2cfe95=_[_0x74e9('0x52')]({},_0x2cfe95,_0x2826cd['options']);return _0x383e4c[_0x74e9('0x109')](_0x2cfe95);}})[_0x74e9('0x25')](function(_0x15c506){if(_0x15c506){_0x1264dc=_0x15c506[_0x74e9('0x4a')];if(!_0x2826cd[_0x74e9('0x4c')][_0x74e9('0x4d')](_0x74e9('0x66'))){_0x2cfe95[_0x74e9('0x33')]=qs['limit'](_0x2826cd[_0x74e9('0x4c')][_0x74e9('0x33')]);_0x2cfe95[_0x74e9('0x32')]=qs[_0x74e9('0x32')](_0x2826cd['query'][_0x74e9('0x32')]);}return _0x383e4c[_0x74e9('0x109')](_0x2cfe95);}})['then'](function(_0x45f593){if(_0x45f593){return _0x45f593?{'count':_0x1264dc,'rows':_0x45f593}:null;}})[_0x74e9('0x25')](respondWithResult(_0x3da3cf,null))['catch'](handleError(_0x3da3cf,null));};exports[_0x74e9('0x10a')]=function(_0x5baabf,_0x393119,_0x4e735f){var _0x37bd4f=_0x5baabf[_0x74e9('0x4c')][_0x74e9('0x10b')]===_0x74e9('0x10c')?_0x74e9('0x10d'):_0x74e9('0x10e');return db[_0x74e9('0x42')][_0x74e9('0x59')]({'attributes':['id',_0x37bd4f],'where':{'id':_0x5baabf['params']['id']}})[_0x74e9('0x25')](handleEntityNotFound(_0x393119,null))['then'](function(_0x1bcd6c){if(_0x1bcd6c){var _0x5ed2aa=_0x1bcd6c[_0x37bd4f];var _0x3192c9=_0x5ed2aa&&_0x5ed2aa['items']?_0x5ed2aa[_0x74e9('0x10f')]:[];_0x393119[_0x74e9('0x3e')]({'fromKey':_[_0x74e9('0x7b')](_0x5ed2aa[_0x74e9('0x110')])?undefined:_0x5ed2aa[_0x74e9('0x110')],'count':_0x3192c9[_0x74e9('0x4a')],'rows':_0x3192c9});}})[_0x74e9('0x2c')](handleError(_0x393119,null));};exports[_0x74e9('0x111')]=function(_0xa8c227,_0x46636e,_0x68f381){var _0x314955={'raw':![],'where':{}};var _0x3cd748={};var _0x90dbc9={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x74e9('0x65')]({'where':{'id':_0xa8c227[_0x74e9('0x57')]['id']}})[_0x74e9('0x25')](handleEntityNotFound(_0x46636e,null))[_0x74e9('0x25')](function(_0x149079){if(_0x149079){_0x3cd748['model']=_['keys'](db[_0x74e9('0xd0')][_0x74e9('0x6d')]);_0x3cd748[_0x74e9('0x4c')]=_['keys'](_0xa8c227[_0x74e9('0x4c')]);_0x3cd748[_0x74e9('0x46')]=_[_0x74e9('0x47')](_0x3cd748[_0x74e9('0x4b')],_0x3cd748['query']);_0x314955['attributes']=_[_0x74e9('0x47')](_0x3cd748[_0x74e9('0x4b')],qs[_0x74e9('0x49')](_0xa8c227['query']['fields']));_0x314955[_0x74e9('0x48')]=_0x314955['attributes'][_0x74e9('0x4a')]?_0x314955[_0x74e9('0x48')]:_0x3cd748[_0x74e9('0x4b')];if(!_0xa8c227[_0x74e9('0x4c')]['hasOwnProperty'](_0x74e9('0x66'))){_0x314955[_0x74e9('0x33')]=qs[_0x74e9('0x33')](_0xa8c227[_0x74e9('0x4c')][_0x74e9('0x33')]);_0x314955[_0x74e9('0x32')]=qs[_0x74e9('0x32')](_0xa8c227['query']['offset']);}_0x314955['order']=qs['sort'](_0xa8c227[_0x74e9('0x4c')]['sort']);_0x314955[_0x74e9('0x4f')]=qs['filters'](_[_0x74e9('0x50')](_0xa8c227[_0x74e9('0x4c')],_0x3cd748['filters']));_0x314955['where'][_0x74e9('0x62')]=_0x149079['id'];if(_0xa8c227[_0x74e9('0x4c')][_0x74e9('0x51')]){_0x314955['where']=_[_0x74e9('0x52')](_0x314955[_0x74e9('0x4f')],{'$or':_[_0x74e9('0x41')](_0x314955['attributes'],function(_0x44e3ea){var _0x2447a2={};_0x2447a2[_0x44e3ea]={'$like':'%'+_0xa8c227[_0x74e9('0x4c')][_0x74e9('0x51')]+'%'};return _0x2447a2;})});}_0x314955=_[_0x74e9('0x52')]({},_0x314955,_0xa8c227['options']);return db[_0x74e9('0xd0')][_0x74e9('0x31')]({'where':_0x314955['where']})[_0x74e9('0x25')](function(_0x59df13){_0x90dbc9[_0x74e9('0x31')]=_0x59df13;if(_0xa8c227[_0x74e9('0x4c')][_0x74e9('0x54')]){_0x314955[_0x74e9('0x55')]=[{'all':!![]}];}else{_0x314955[_0x74e9('0x55')]=[{'model':db['CmContact'],'as':'Contact','required':![]}];}return db[_0x74e9('0xd0')][_0x74e9('0x56')](_0x314955);})[_0x74e9('0x25')](function(_0x2d3e8b){_0x90dbc9['rows']=_0x2d3e8b;return _0x90dbc9;});}})[_0x74e9('0x25')](respondWithFilteredResult(_0x46636e,_0x314955))['catch'](handleError(_0x46636e,null));};exports[_0x74e9('0x112')]=function(_0x4d2b60,_0x1e3d51,_0x2bad8a){return db[_0x74e9('0x42')][_0x74e9('0x59')]({'where':{'id':_0x4d2b60['params']['id']}})[_0x74e9('0x25')](handleEntityNotFound(_0x1e3d51,null))[_0x74e9('0x25')](function(_0x9bab1c){if(_0x9bab1c){return _0x9bab1c[_0x74e9('0x112')](_0x4d2b60['body'][_0x74e9('0x6a')],_[_0x74e9('0xe0')](_0x4d2b60[_0x74e9('0x5b')],['ids','id'])||{})[_0x74e9('0x113')](function(_0x687cff){for(var _0x3ee0fd=0x0;_0x3ee0fd<_0x4d2b60['body'][_0x74e9('0x6a')][_0x74e9('0x4a')];_0x3ee0fd+=0x1){socket[_0x74e9('0x114')](_0x74e9('0x115'),{'UserId':_0x4d2b60[_0x74e9('0x5b')][_0x74e9('0x6a')][_0x3ee0fd],'ChatWebsiteId':_0x4d2b60['params']['id']});}return _0x687cff;});}})[_0x74e9('0x25')](respondWithResult(_0x1e3d51,null))[_0x74e9('0x2c')](handleError(_0x1e3d51,null));};exports[_0x74e9('0x116')]=function(_0x120db9,_0x8d9c36,_0x417e3d){return db['ChatWebsite'][_0x74e9('0x59')]({'where':{'id':_0x120db9[_0x74e9('0x57')]['id']}})[_0x74e9('0x25')](handleEntityNotFound(_0x8d9c36,null))[_0x74e9('0x25')](function(_0x35f969){if(_0x35f969){return _0x35f969[_0x74e9('0x116')](_0x120db9[_0x74e9('0x4c')][_0x74e9('0x6a')])[_0x74e9('0x25')](function(){if(_[_0x74e9('0x117')](_0x120db9[_0x74e9('0x4c')][_0x74e9('0x6a')])){for(var _0x2dec36=0x0;_0x2dec36<_0x120db9[_0x74e9('0x4c')]['ids'][_0x74e9('0x4a')];_0x2dec36+=0x1){socket[_0x74e9('0x114')]('userChatWebsite:remove',{'UserId':Number(_0x120db9[_0x74e9('0x4c')]['ids'][_0x2dec36]),'ChatWebsiteId':Number(_0x120db9[_0x74e9('0x57')]['id'])});}}else{socket[_0x74e9('0x114')](_0x74e9('0x118'),{'UserId':Number(_0x120db9[_0x74e9('0x4c')][_0x74e9('0x6a')]),'ChatWebsiteId':Number(_0x120db9['params']['id'])});}});}})['then'](respondWithStatusCode(_0x8d9c36,null))[_0x74e9('0x2c')](handleError(_0x8d9c36,null));};exports[_0x74e9('0x119')]=function(_0x49204a,_0xe4f1a5,_0x42fa6f){var _0x4bc464={};var _0x5a3235={};var _0x2b1356;var _0x1b6e21;return db[_0x74e9('0x42')][_0x74e9('0x65')]({'where':{'id':_0x49204a[_0x74e9('0x57')]['id']}})['then'](handleEntityNotFound(_0xe4f1a5,null))[_0x74e9('0x25')](function(_0x1708da){if(_0x1708da){_0x2b1356=_0x1708da;_0x5a3235[_0x74e9('0x4b')]=_[_0x74e9('0x45')](db[_0x74e9('0xc4')][_0x74e9('0x6d')]);_0x5a3235[_0x74e9('0x4c')]=_['keys'](_0x49204a['query']);_0x5a3235[_0x74e9('0x46')]=_['intersection'](_0x5a3235[_0x74e9('0x4b')],_0x5a3235[_0x74e9('0x4c')]);_0x4bc464[_0x74e9('0x48')]=_[_0x74e9('0x47')](_0x5a3235[_0x74e9('0x4b')],qs[_0x74e9('0x49')](_0x49204a['query'][_0x74e9('0x49')]));_0x4bc464['attributes']=_0x4bc464[_0x74e9('0x48')][_0x74e9('0x4a')]?_0x4bc464[_0x74e9('0x48')]:_0x5a3235[_0x74e9('0x4b')];_0x4bc464[_0x74e9('0x67')]=qs[_0x74e9('0x4e')](_0x49204a['query'][_0x74e9('0x4e')]);_0x4bc464[_0x74e9('0x4f')]=qs[_0x74e9('0x46')](_['pick'](_0x49204a['query'],_0x5a3235[_0x74e9('0x46')]));if(_0x49204a[_0x74e9('0x4c')][_0x74e9('0x51')]){_0x4bc464[_0x74e9('0x4f')]=_['merge'](_0x4bc464[_0x74e9('0x4f')],{'$or':_[_0x74e9('0x41')](_0x4bc464[_0x74e9('0x48')],function(_0x2a4017){var _0x337492={};_0x337492[_0x2a4017]={'$like':'%'+_0x49204a[_0x74e9('0x4c')][_0x74e9('0x51')]+'%'};return _0x337492;})});}_0x4bc464=_['merge']({},_0x4bc464,_0x49204a[_0x74e9('0x53')]);return _0x2b1356[_0x74e9('0x119')](_0x4bc464);}})[_0x74e9('0x25')](function(_0x2f1456){if(_0x2f1456){_0x1b6e21=_0x2f1456[_0x74e9('0x4a')];if(!_0x49204a['query'][_0x74e9('0x4d')](_0x74e9('0x66'))){_0x4bc464['limit']=qs[_0x74e9('0x33')](_0x49204a['query'][_0x74e9('0x33')]);_0x4bc464[_0x74e9('0x32')]=qs[_0x74e9('0x32')](_0x49204a[_0x74e9('0x4c')]['offset']);}return _0x2b1356[_0x74e9('0x119')](_0x4bc464);}})[_0x74e9('0x25')](function(_0x3bdb68){if(_0x3bdb68){return _0x3bdb68?{'count':_0x1b6e21,'rows':_0x3bdb68}:null;}})[_0x74e9('0x25')](respondWithResult(_0xe4f1a5,null))[_0x74e9('0x2c')](handleError(_0xe4f1a5,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index a7cf7e2..02647af 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 _0xf3d0=['save','update','remove','emit','hasOwnProperty','exports','events','ChatWebsite','setMaxListeners'];(function(_0x350af1,_0x186025){var _0x3443d5=function(_0x4ce377){while(--_0x4ce377){_0x350af1['push'](_0x350af1['shift']());}};_0x3443d5(++_0x186025);}(_0xf3d0,0x1bf));var _0x0f3d=function(_0x5edbaa,_0x115faf){_0x5edbaa=_0x5edbaa-0x0;var _0x467cce=_0xf3d0[_0x5edbaa];return _0x467cce;};'use strict';var EventEmitter=require(_0x0f3d('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x0f3d('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0f3d('0x2')](0x0);var events={'afterCreate':_0x0f3d('0x3'),'afterUpdate':_0x0f3d('0x4'),'afterDestroy':_0x0f3d('0x5')};function emitEvent(_0x3d9caf){return function(_0x1b160f,_0x414425,_0x2d8810){ChatWebsiteEvents[_0x0f3d('0x6')](_0x3d9caf+':'+_0x1b160f['id'],_0x1b160f);ChatWebsiteEvents[_0x0f3d('0x6')](_0x3d9caf,_0x1b160f);_0x2d8810(null);};}for(var e in events){if(events[_0x0f3d('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x0f3d('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x09f4=['update','remove','emit','exports','ChatWebsite','setMaxListeners','save'];(function(_0x3df8ad,_0x5d2689){var _0x191dc4=function(_0x26fc8b){while(--_0x26fc8b){_0x3df8ad['push'](_0x3df8ad['shift']());}};_0x191dc4(++_0x5d2689);}(_0x09f4,0xe4));var _0x409f=function(_0x4e487e,_0x3df3a4){_0x4e487e=_0x4e487e-0x0;var _0x4ad7c3=_0x09f4[_0x4e487e];return _0x4ad7c3;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0x409f('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x409f('0x1')](0x0);var events={'afterCreate':_0x409f('0x2'),'afterUpdate':_0x409f('0x3'),'afterDestroy':_0x409f('0x4')};function emitEvent(_0x13f1a1){return function(_0x1d859b,_0x3c329a,_0x13f683){ChatWebsiteEvents[_0x409f('0x5')](_0x13f1a1+':'+_0x1d859b['id'],_0x1d859b);ChatWebsiteEvents[_0x409f('0x5')](_0x13f1a1,_0x1d859b);_0x13f683(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x409f('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index d800516..fbd1e21 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 _0x2750=['rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1146df,_0x1877f1){var _0x4bcc4e=function(_0x4a3534){while(--_0x4a3534){_0x1146df['push'](_0x1146df['shift']());}};_0x4bcc4e(++_0x1877f1);}(_0x2750,0x13b));var _0x0275=function(_0x2e030d,_0x3c9273){_0x2e030d=_0x2e030d-0x0;var _0x35167a=_0x2750[_0x2e030d];return _0x35167a;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var moment=require(_0x0275('0x3'));var BPromise=require(_0x0275('0x4'));var rp=require(_0x0275('0x5'));var fs=require('fs');var path=require(_0x0275('0x6'));var rimraf=require(_0x0275('0x7'));var config=require(_0x0275('0x8'));var attributes=require(_0x0275('0x9'));module[_0x0275('0xa')]=function(_0x5953f9,_0x3f645f){return _0x5953f9[_0x0275('0xb')](_0x0275('0xc'),attributes,{'tableName':_0x0275('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7980=['ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','define'];(function(_0x6fe60f,_0x1c081d){var _0xc6977f=function(_0x8fa93e){while(--_0x8fa93e){_0x6fe60f['push'](_0x6fe60f['shift']());}};_0xc6977f(++_0x1c081d);}(_0x7980,0xab));var _0x0798=function(_0x2c5b71,_0x12d4a2){_0x2c5b71=_0x2c5b71-0x0;var _0x297828=_0x7980[_0x2c5b71];return _0x297828;};'use strict';var _=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var logger=require(_0x0798('0x2'))(_0x0798('0x3'));var moment=require(_0x0798('0x4'));var BPromise=require('bluebird');var rp=require(_0x0798('0x5'));var fs=require('fs');var path=require(_0x0798('0x6'));var rimraf=require(_0x0798('0x7'));var config=require(_0x0798('0x8'));var attributes=require(_0x0798('0x9'));module['exports']=function(_0x22a0f0,_0x557325){return _0x22a0f0[_0x0798('0xa')](_0x0798('0xb'),attributes,{'tableName':_0x0798('0xc'),'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 5eeca4b..9bd6c07 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(_0x590a0c,_0xab1f66){var _0x32add4=function(_0x8e9352){while(--_0x8e9352){_0x590a0c['push'](_0x590a0c['shift']());}};_0x32add4(++_0xab1f66);}(_0x5c3c,0x132));var _0xc5c3=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x5c3c[_0xaa0309];return _0x5de7ce;};'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 _0x8e3f=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x277ce1,_0x6ed646){var _0x36ff3c=function(_0xf902b7){while(--_0xf902b7){_0x277ce1['push'](_0x277ce1['shift']());}};_0x36ff3c(++_0x6ed646);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8e3f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});config[_0xf8e3('0xb')]=_['defaults'](config[_0xf8e3('0xb')],{'host':_0xf8e3('0xc'),'port':0x18eb});var socket=require(_0xf8e3('0xd'))(new Redis(config[_0xf8e3('0xb')]));require(_0xf8e3('0xe'))[_0xf8e3('0xf')](socket);function respondWithRpcPromise(_0x299a7e,_0x2a3b59,_0x2d914d){return new BPromise(function(_0x2bc3cd,_0x28f5f0){return client[_0xf8e3('0x10')](_0x299a7e,_0x2d914d)['then'](function(_0xb7d14f){logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,'request\x20sent');logger[_0xf8e3('0x13')](_0xf8e3('0x14'),_0x2a3b59,_0xf8e3('0x15'),JSON[_0xf8e3('0x16')](_0xb7d14f));if(_0xb7d14f['error']){if(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x18')]===0x1f4){logger[_0xf8e3('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f[_0xf8e3('0x17')]['message']);return _0x28f5f0(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}logger[_0xf8e3('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x2a3b59,_0xb7d14f['error'][_0xf8e3('0x19')]);return _0x2bc3cd(_0xb7d14f[_0xf8e3('0x17')][_0xf8e3('0x19')]);}else{logger[_0xf8e3('0x11')](_0xf8e3('0x12'),_0x2a3b59,_0xf8e3('0x15'));_0x2bc3cd(_0xb7d14f[_0xf8e3('0x1a')][_0xf8e3('0x19')]);}})[_0xf8e3('0x1b')](function(_0x13fb31){logger['error'](_0xf8e3('0x12'),_0x2a3b59,_0x13fb31);_0x28f5f0(_0x13fb31);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 69f77f4..fccc02a 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(_0x93aa24,_0x2363ba){var _0x5252ad=function(_0x382c59){while(--_0x382c59){_0x93aa24['push'](_0x93aa24['shift']());}};_0x5252ad(++_0x2363ba);}(_0x5f2f,0x73));var _0xf5f2=function(_0x475db1,_0x26f01e){_0x475db1=_0x475db1-0x0;var _0x5cfb57=_0x5f2f[_0x475db1];return _0x5cfb57;};'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 _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x159a67,_0x301838){var _0x3fb80c=function(_0x4151ab){while(--_0x4151ab){_0x159a67['push'](_0x159a67['shift']());}};_0x3fb80c(++_0x301838);}(_0x7a54,0x106));var _0x47a5=function(_0x28ef8a,_0x1d176d){_0x28ef8a=_0x28ef8a-0x0;var _0x1f17ee=_0x7a54[_0x28ef8a];return _0x1f17ee;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 3d30eb0..e9a2b9b 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 _0x6669=['join','server/files/images/avatars/','now','originalname','/:id/customer_avatar','/:id/notify','notify','offline','addInteraction','addApplications','/:id/proactive_actions','addAgents','update','delete','destroy','removeAnswers','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','root','server/files/images/logos/','format','single','file','addLogo','diskStorage'];(function(_0x3a5c9a,_0x479498){var _0x422fa4=function(_0x597bbe){while(--_0x597bbe){_0x3a5c9a['push'](_0x3a5c9a['shift']());}};_0x422fa4(++_0x479498);}(_0x6669,0x184));var _0x9666=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x6669[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0x9666('0x0'));var util=require(_0x9666('0x1'));var path=require(_0x9666('0x2'));var timeout=require(_0x9666('0x3'));var express=require(_0x9666('0x4'));var router=express[_0x9666('0x5')]();var auth=require(_0x9666('0x6'));var interaction=require(_0x9666('0x7'));var config=require('../../config/environment');var controller=require(_0x9666('0x8'));router[_0x9666('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9666('0x9')]('/describe',auth[_0x9666('0xa')](),controller[_0x9666('0xb')]);router[_0x9666('0x9')](_0x9666('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x9666('0x9')](_0x9666('0xd'),auth[_0x9666('0xa')](),controller[_0x9666('0xe')]);router[_0x9666('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x9666('0xf')]);router[_0x9666('0x9')](_0x9666('0x10'),controller[_0x9666('0x11')]);router[_0x9666('0x9')](_0x9666('0x12'),controller[_0x9666('0x13')]);router[_0x9666('0x9')]('/:id/customer_avatar',controller[_0x9666('0x14')]);router[_0x9666('0x9')](_0x9666('0x15'),controller[_0x9666('0x16')]);router[_0x9666('0x9')](_0x9666('0x17'),auth['isAuthenticated'](),controller[_0x9666('0x18')]);router[_0x9666('0x9')](_0x9666('0x19'),controller[_0x9666('0x1a')]);router[_0x9666('0x9')](_0x9666('0x1b'),auth[_0x9666('0xa')](),controller[_0x9666('0x1c')]);router[_0x9666('0x9')]('/:id/proactive_actions',auth[_0x9666('0xa')](),controller[_0x9666('0x1d')]);router[_0x9666('0x9')]('/:id/fields',controller[_0x9666('0x1e')]);router[_0x9666('0x9')]('/:id/offline_messages',auth[_0x9666('0xa')](),controller[_0x9666('0x1f')]);router[_0x9666('0x9')](_0x9666('0x20'),auth[_0x9666('0xa')](),controller[_0x9666('0x21')]);router[_0x9666('0x22')]('/',auth[_0x9666('0xa')](),controller[_0x9666('0x23')]);router['post'](_0x9666('0xd'),auth[_0x9666('0xa')](),controller[_0x9666('0x24')]);router[_0x9666('0x22')](_0x9666('0x25'),auth[_0x9666('0xa')](),controller[_0x9666('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x526405,_0x57e510,_0x31e356){_0x31e356(null,path['join'](config[_0x9666('0x27')],_0x9666('0x28')));},'filename':function(_0xc9cc16,_0x5d43ef,_0x1ea3c8){_0x1ea3c8(null,util[_0x9666('0x29')]('%s-%s',Date['now'](),_0x5d43ef['originalname']));}})});router[_0x9666('0x22')](_0x9666('0x10'),upload[_0x9666('0x2a')](_0x9666('0x2b')),controller[_0x9666('0x2c')]);var upload=multer({'storage':multer[_0x9666('0x2d')]({'destination':function(_0x4c99b4,_0x32a4f3,_0x43bab5){_0x43bab5(null,path[_0x9666('0x2e')](config[_0x9666('0x27')],'server/files/images/avatars/'));},'filename':function(_0x77a796,_0x4e4b61,_0x270296){_0x270296(null,util[_0x9666('0x29')]('%s-%s',Date['now'](),_0x4e4b61['originalname']));}})});router[_0x9666('0x22')](_0x9666('0x12'),upload['single']('file'),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1cd2a8,_0x6ecd90,_0x4f4eb7){_0x4f4eb7(null,path[_0x9666('0x2e')](config[_0x9666('0x27')],_0x9666('0x2f')));},'filename':function(_0x212815,_0x51fda4,_0x405fd9){_0x405fd9(null,util[_0x9666('0x29')]('%s-%s',Date[_0x9666('0x30')](),_0x51fda4[_0x9666('0x31')]));}})});router[_0x9666('0x22')](_0x9666('0x32'),upload[_0x9666('0x2a')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x9666('0x2d')]({'destination':function(_0x210ec9,_0x5ca5c8,_0x1c65ad){_0x1c65ad(null,path['join'](config[_0x9666('0x27')],_0x9666('0x2f')));},'filename':function(_0x5b5d61,_0x461226,_0x3cee18){_0x3cee18(null,util[_0x9666('0x29')]('%s-%s',Date[_0x9666('0x30')](),_0x461226[_0x9666('0x31')]));}})});router['post'](_0x9666('0x15'),upload[_0x9666('0x2a')](_0x9666('0x2b')),controller['addSystemAvatar']);router[_0x9666('0x22')](_0x9666('0x33'),controller[_0x9666('0x34')]);router['post']('/:id/offline',controller[_0x9666('0x35')]);router['post'](_0x9666('0x17'),auth['isAuthenticated'](),controller[_0x9666('0x36')]);router[_0x9666('0x22')](_0x9666('0x1b'),auth['isAuthenticated'](),controller[_0x9666('0x37')]);router[_0x9666('0x22')](_0x9666('0x38'),auth[_0x9666('0xa')](),controller['addProactiveActions']);router[_0x9666('0x22')](_0x9666('0x20'),auth['isAuthenticated'](),controller[_0x9666('0x39')]);router['put']('/:id',auth[_0x9666('0xa')](),controller[_0x9666('0x3a')]);router[_0x9666('0x3b')](_0x9666('0xc'),auth[_0x9666('0xa')](),controller[_0x9666('0x3c')]);router[_0x9666('0x3b')](_0x9666('0xd'),auth[_0x9666('0xa')](),controller['removeDispositions']);router[_0x9666('0x3b')]('/:id/canned_answers',auth[_0x9666('0xa')](),controller[_0x9666('0x3d')]);router[_0x9666('0x3b')](_0x9666('0x20'),auth[_0x9666('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x4789=['addLogo','server/files/images/avatars/','format','now','addAvatar','diskStorage','%s-%s','addCustomerAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','addProactiveActions','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','addDisposition','/:id/canned_answers','addAnswer','join','root','server/files/images/logos/','originalname','single','file'];(function(_0x2aa48b,_0x5a4446){var _0x48caf8=function(_0x13230c){while(--_0x13230c){_0x2aa48b['push'](_0x2aa48b['shift']());}};_0x48caf8(++_0x5a4446);}(_0x4789,0xe1));var _0x9478=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0x4789[_0x54381d];return _0x5308a7;};'use strict';var multer=require(_0x9478('0x0'));var util=require(_0x9478('0x1'));var path=require(_0x9478('0x2'));var timeout=require(_0x9478('0x3'));var express=require(_0x9478('0x4'));var router=express[_0x9478('0x5')]();var auth=require(_0x9478('0x6'));var interaction=require(_0x9478('0x7'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0x9478('0x8')]('/',auth['isAuthenticated'](),controller[_0x9478('0x9')]);router[_0x9478('0x8')](_0x9478('0xa'),auth[_0x9478('0xb')](),controller['describe']);router[_0x9478('0x8')](_0x9478('0xc'),auth[_0x9478('0xb')](),controller[_0x9478('0xd')]);router[_0x9478('0x8')](_0x9478('0xe'),auth['isAuthenticated'](),controller[_0x9478('0xf')]);router[_0x9478('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x9478('0x10')]);router['get'](_0x9478('0x11'),controller[_0x9478('0x12')]);router[_0x9478('0x8')](_0x9478('0x13'),controller[_0x9478('0x14')]);router[_0x9478('0x8')]('/:id/customer_avatar',controller[_0x9478('0x15')]);router[_0x9478('0x8')](_0x9478('0x16'),controller[_0x9478('0x17')]);router[_0x9478('0x8')](_0x9478('0x18'),auth[_0x9478('0xb')](),controller[_0x9478('0x19')]);router[_0x9478('0x8')](_0x9478('0x1a'),controller[_0x9478('0x1b')]);router[_0x9478('0x8')](_0x9478('0x1c'),auth[_0x9478('0xb')](),controller[_0x9478('0x1d')]);router['get'](_0x9478('0x1e'),auth[_0x9478('0xb')](),controller[_0x9478('0x1f')]);router[_0x9478('0x8')](_0x9478('0x20'),controller[_0x9478('0x21')]);router['get'](_0x9478('0x22'),auth[_0x9478('0xb')](),controller[_0x9478('0x23')]);router[_0x9478('0x8')](_0x9478('0x24'),auth['isAuthenticated'](),controller['getAgents']);router[_0x9478('0x25')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9478('0x25')](_0x9478('0xe'),auth['isAuthenticated'](),controller[_0x9478('0x26')]);router[_0x9478('0x25')](_0x9478('0x27'),auth[_0x9478('0xb')](),controller[_0x9478('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x17a0a3,_0x1f1e0c,_0x4823b5){_0x4823b5(null,path[_0x9478('0x29')](config[_0x9478('0x2a')],_0x9478('0x2b')));},'filename':function(_0x444dd4,_0x277de8,_0x4235d4){_0x4235d4(null,util['format']('%s-%s',Date['now'](),_0x277de8[_0x9478('0x2c')]));}})});router[_0x9478('0x25')](_0x9478('0x11'),upload[_0x9478('0x2d')](_0x9478('0x2e')),controller[_0x9478('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x30913d,_0x12a0b9,_0x46d158){_0x46d158(null,path[_0x9478('0x29')](config['root'],_0x9478('0x30')));},'filename':function(_0x524702,_0x46aefc,_0x2f0bc4){_0x2f0bc4(null,util[_0x9478('0x31')]('%s-%s',Date[_0x9478('0x32')](),_0x46aefc[_0x9478('0x2c')]));}})});router[_0x9478('0x25')]('/:id/avatar',upload['single']('file'),controller[_0x9478('0x33')]);var upload=multer({'storage':multer[_0x9478('0x34')]({'destination':function(_0x1cec6d,_0x1e5e14,_0x2b57df){_0x2b57df(null,path['join'](config[_0x9478('0x2a')],_0x9478('0x30')));},'filename':function(_0x36c5b4,_0xbd03c8,_0x3ed474){_0x3ed474(null,util[_0x9478('0x31')](_0x9478('0x35'),Date['now'](),_0xbd03c8[_0x9478('0x2c')]));}})});router[_0x9478('0x25')]('/:id/customer_avatar',upload[_0x9478('0x2d')](_0x9478('0x2e')),controller[_0x9478('0x36')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x34be45,_0x3ac9da,_0x23b0e2){_0x23b0e2(null,path['join'](config['root'],_0x9478('0x30')));},'filename':function(_0x20b823,_0x56607a,_0x4998d9){_0x4998d9(null,util[_0x9478('0x31')](_0x9478('0x35'),Date[_0x9478('0x32')](),_0x56607a['originalname']));}})});router['post'](_0x9478('0x16'),upload[_0x9478('0x2d')](_0x9478('0x2e')),controller['addSystemAvatar']);router[_0x9478('0x25')](_0x9478('0x37'),controller[_0x9478('0x38')]);router['post'](_0x9478('0x39'),controller[_0x9478('0x3a')]);router[_0x9478('0x25')](_0x9478('0x18'),auth[_0x9478('0xb')](),controller[_0x9478('0x3b')]);router['post'](_0x9478('0x1c'),auth[_0x9478('0xb')](),controller['addApplications']);router[_0x9478('0x25')](_0x9478('0x1e'),auth['isAuthenticated'](),controller[_0x9478('0x3c')]);router['post'](_0x9478('0x24'),auth[_0x9478('0xb')](),controller['addAgents']);router[_0x9478('0x3d')]('/:id',auth[_0x9478('0xb')](),controller[_0x9478('0x3e')]);router[_0x9478('0x3f')](_0x9478('0xc'),auth[_0x9478('0xb')](),controller[_0x9478('0x40')]);router[_0x9478('0x3f')](_0x9478('0xe'),auth[_0x9478('0xb')](),controller[_0x9478('0x41')]);router[_0x9478('0x3f')]('/:id/canned_answers',auth[_0x9478('0xb')](),controller[_0x9478('0x42')]);router[_0x9478('0x3f')]('/:id/users',auth[_0x9478('0xb')](),controller['removeAgents']);module[_0x9478('0x43')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index ad6cb2e..aea66ab 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 _0x3c94=['Google','sequelize','exports','STRING','ENUM','AmazonAWS'];(function(_0xd8aad0,_0x4da2cd){var _0x570860=function(_0x1acc03){while(--_0x1acc03){_0xd8aad0['push'](_0xd8aad0['shift']());}};_0x570860(++_0x4da2cd);}(_0x3c94,0xcd));var _0x43c9=function(_0xd2548e,_0x556106){_0xd2548e=_0xd2548e-0x0;var _0x1258d3=_0x3c94[_0xd2548e];return _0x1258d3;};'use strict';var Sequelize=require(_0x43c9('0x0'));module[_0x43c9('0x1')]={'name':{'type':Sequelize[_0x43c9('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x43c9('0x3')](_0x43c9('0x4'),_0x43c9('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x43c9('0x2')]},'data2':{'type':Sequelize[_0x43c9('0x2')]}}; \ No newline at end of file +var _0x1bb4=['sequelize','exports','STRING','ENUM','AmazonAWS'];(function(_0x80ba8c,_0x5a0c71){var _0x1c8d12=function(_0xc848c9){while(--_0xc848c9){_0x80ba8c['push'](_0x80ba8c['shift']());}};_0x1c8d12(++_0x5a0c71);}(_0x1bb4,0x1c7));var _0x41bb=function(_0x35fbca,_0x3338ae){_0x35fbca=_0x35fbca-0x0;var _0x56edbf=_0x1bb4[_0x35fbca];return _0x56edbf;};'use strict';var Sequelize=require(_0x41bb('0x0'));module[_0x41bb('0x1')]={'name':{'type':Sequelize[_0x41bb('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x41bb('0x3')](_0x41bb('0x4'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x41bb('0x2')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e42522b..90cea7b 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 _0xec84=['filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','end','stack','name','index','map','CloudProvider','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x238e59,_0x3d5bd8){var _0x2cdb69=function(_0x45125b){while(--_0x45125b){_0x238e59['push'](_0x238e59['shift']());}};_0x2cdb69(++_0x3d5bd8);}(_0xec84,0xe7));var _0x4ec8=function(_0x314454,_0x58c3a7){_0x314454=_0x314454-0x0;var _0x1f8aac=_0xec84[_0x314454];return _0x1f8aac;};'use strict';var pdf=require(_0x4ec8('0x0'));var emlformat=require(_0x4ec8('0x1'));var rimraf=require(_0x4ec8('0x2'));var zipdir=require(_0x4ec8('0x3'));var jsonpatch=require(_0x4ec8('0x4'));var rp=require(_0x4ec8('0x5'));var moment=require(_0x4ec8('0x6'));var BPromise=require(_0x4ec8('0x7'));var Mustache=require(_0x4ec8('0x8'));var util=require(_0x4ec8('0x9'));var path=require(_0x4ec8('0xa'));var sox=require(_0x4ec8('0xb'));var csv=require('to-csv');var ejs=require(_0x4ec8('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4ec8('0xd'));var crypto=require('crypto');var jsforce=require(_0x4ec8('0xe'));var deskjs=require(_0x4ec8('0xf'));var toCsv=require(_0x4ec8('0x10'));var querystring=require('querystring');var Papa=require(_0x4ec8('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4ec8('0x12'));var hardwareService=require(_0x4ec8('0x13'));var logger=require(_0x4ec8('0x14'))('api');var utils=require(_0x4ec8('0x15'));var config=require(_0x4ec8('0x16'));var db=require(_0x4ec8('0x17'))['db'];function respondWithStatusCode(_0x55e4c8,_0x42e118){_0x42e118=_0x42e118||0xcc;return function(_0x107356){if(_0x107356){return _0x55e4c8[_0x4ec8('0x18')](_0x42e118);}return _0x55e4c8['status'](_0x42e118)['end']();};}function respondWithResult(_0x2596f0,_0x5b8e53){_0x5b8e53=_0x5b8e53||0xc8;return function(_0x796d38){if(_0x796d38){return _0x2596f0[_0x4ec8('0x19')](_0x5b8e53)[_0x4ec8('0x1a')](_0x796d38);}};}function respondWithFilteredResult(_0x12b064,_0x42dd9e){return function(_0x587ea2){if(_0x587ea2){var _0x4ab189=_0x587ea2[_0x4ec8('0x1b')],_0x349fd1=_0x42dd9e['offset'],_0x288f84=_0x42dd9e[_0x4ec8('0x1c')]+_0x42dd9e[_0x4ec8('0x1d')],_0x4f9a52;if(_0x288f84>=_0x4ab189){_0x288f84=_0x4ab189;_0x4f9a52=0xc8;}else{_0x4f9a52=0xce;}_0x12b064[_0x4ec8('0x19')](_0x4f9a52);return _0x12b064[_0x4ec8('0x1e')](_0x4ec8('0x1f'),_0x349fd1+'-'+_0x288f84+'/'+_0x4ab189)[_0x4ec8('0x1a')](_0x587ea2);}return null;};}function patchUpdates(_0x16acbf){return function(_0x4f236d){try{jsonpatch[_0x4ec8('0x20')](_0x4f236d,_0x16acbf,!![]);}catch(_0x14c8ff){return BPromise['reject'](_0x14c8ff);}return _0x4f236d['save']();};}function saveUpdates(_0x45587f,_0x50b354){return function(_0x41d508){if(_0x41d508){return _0x41d508[_0x4ec8('0x21')](_0x45587f)[_0x4ec8('0x22')](function(_0x21dadd){return _0x21dadd;});}return null;};}function removeEntity(_0xccd80c,_0x53d336){return function(_0x209d5d){if(_0x209d5d){return _0x209d5d['destroy']()['then'](function(){_0xccd80c[_0x4ec8('0x19')](0xcc)[_0x4ec8('0x23')]();});}};}function handleEntityNotFound(_0x42f377,_0x25536c){return function(_0x842609){if(!_0x842609){_0x42f377[_0x4ec8('0x18')](0x194);}return _0x842609;};}function handleError(_0x57000e,_0x453984){_0x453984=_0x453984||0x1f4;return function(_0x90a426){logger['error'](_0x90a426[_0x4ec8('0x24')]);if(_0x90a426[_0x4ec8('0x25')]){delete _0x90a426[_0x4ec8('0x25')];}_0x57000e['status'](_0x453984)['send'](_0x90a426);};}exports[_0x4ec8('0x26')]=function(_0x2cd8cc,_0x5b3e76){var _0x46903a={},_0x1bf73b={},_0x25ed04={'count':0x0,'rows':[]};var _0xc291d2=_[_0x4ec8('0x27')](db[_0x4ec8('0x28')][_0x4ec8('0x29')],function(_0x43fd0e){return{'name':_0x43fd0e['fieldName'],'type':_0x43fd0e[_0x4ec8('0x2a')][_0x4ec8('0x2b')]};});_0x1bf73b[_0x4ec8('0x2c')]=_[_0x4ec8('0x27')](_0xc291d2,_0x4ec8('0x25'));_0x1bf73b['query']=_[_0x4ec8('0x2d')](_0x2cd8cc[_0x4ec8('0x2e')]);_0x1bf73b[_0x4ec8('0x2f')]=_[_0x4ec8('0x30')](_0x1bf73b[_0x4ec8('0x2c')],_0x1bf73b[_0x4ec8('0x2e')]);_0x46903a[_0x4ec8('0x31')]=_[_0x4ec8('0x30')](_0x1bf73b[_0x4ec8('0x2c')],qs[_0x4ec8('0x32')](_0x2cd8cc['query'][_0x4ec8('0x32')]));_0x46903a[_0x4ec8('0x31')]=_0x46903a[_0x4ec8('0x31')][_0x4ec8('0x33')]?_0x46903a[_0x4ec8('0x31')]:_0x1bf73b[_0x4ec8('0x2c')];if(!_0x2cd8cc[_0x4ec8('0x2e')][_0x4ec8('0x34')](_0x4ec8('0x35'))){_0x46903a['limit']=qs[_0x4ec8('0x1d')](_0x2cd8cc[_0x4ec8('0x2e')]['limit']);_0x46903a[_0x4ec8('0x1c')]=qs['offset'](_0x2cd8cc[_0x4ec8('0x2e')][_0x4ec8('0x1c')]);}_0x46903a[_0x4ec8('0x36')]=qs[_0x4ec8('0x37')](_0x2cd8cc[_0x4ec8('0x2e')][_0x4ec8('0x37')]);_0x46903a['where']=qs[_0x4ec8('0x2f')](_[_0x4ec8('0x38')](_0x2cd8cc['query'],_0x1bf73b[_0x4ec8('0x2f')]),_0xc291d2);if(_0x2cd8cc[_0x4ec8('0x2e')][_0x4ec8('0x39')]){_0x46903a[_0x4ec8('0x3a')]=_[_0x4ec8('0x3b')](_0x46903a[_0x4ec8('0x3a')],{'$or':_[_0x4ec8('0x27')](_0xc291d2,function(_0x4eeab7){if(_0x4eeab7[_0x4ec8('0x2a')]!==_0x4ec8('0x3c')){var _0x1d8059={};_0x1d8059[_0x4eeab7[_0x4ec8('0x25')]]={'$like':'%'+_0x2cd8cc[_0x4ec8('0x2e')]['filter']+'%'};return _0x1d8059;}})});}_0x46903a=_[_0x4ec8('0x3b')]({},_0x46903a,_0x2cd8cc[_0x4ec8('0x3d')]);var _0x4c1a62={'where':_0x46903a[_0x4ec8('0x3a')]};return db['CloudProvider'][_0x4ec8('0x1b')](_0x4c1a62)[_0x4ec8('0x22')](function(_0x3a1c7c){_0x25ed04[_0x4ec8('0x1b')]=_0x3a1c7c;if(_0x2cd8cc[_0x4ec8('0x2e')][_0x4ec8('0x3e')]){_0x46903a['include']=[{'all':!![]}];}return db[_0x4ec8('0x28')][_0x4ec8('0x3f')](_0x46903a);})[_0x4ec8('0x22')](function(_0xdba9aa){_0x25ed04[_0x4ec8('0x40')]=_0xdba9aa;return _0x25ed04;})[_0x4ec8('0x22')](respondWithFilteredResult(_0x5b3e76,_0x46903a))[_0x4ec8('0x41')](handleError(_0x5b3e76,null));};exports[_0x4ec8('0x42')]=function(_0x14a47c,_0x1b1cf7){var _0x2ddedf={'raw':!![],'where':{'id':_0x14a47c[_0x4ec8('0x43')]['id']}},_0x36703b={};_0x36703b[_0x4ec8('0x2c')]=_[_0x4ec8('0x2d')](db[_0x4ec8('0x28')][_0x4ec8('0x29')]);_0x36703b[_0x4ec8('0x2e')]=_[_0x4ec8('0x2d')](_0x14a47c[_0x4ec8('0x2e')]);_0x36703b[_0x4ec8('0x2f')]=_[_0x4ec8('0x30')](_0x36703b['model'],_0x36703b[_0x4ec8('0x2e')]);_0x2ddedf[_0x4ec8('0x31')]=_[_0x4ec8('0x30')](_0x36703b[_0x4ec8('0x2c')],qs[_0x4ec8('0x32')](_0x14a47c['query'][_0x4ec8('0x32')]));_0x2ddedf[_0x4ec8('0x31')]=_0x2ddedf['attributes'][_0x4ec8('0x33')]?_0x2ddedf[_0x4ec8('0x31')]:_0x36703b[_0x4ec8('0x2c')];if(_0x14a47c[_0x4ec8('0x2e')]['includeAll']){_0x2ddedf['include']=[{'all':!![]}];}_0x2ddedf=_[_0x4ec8('0x3b')]({},_0x2ddedf,_0x14a47c['options']);return db['CloudProvider'][_0x4ec8('0x44')](_0x2ddedf)[_0x4ec8('0x22')](handleEntityNotFound(_0x1b1cf7,null))[_0x4ec8('0x22')](respondWithResult(_0x1b1cf7,null))[_0x4ec8('0x41')](handleError(_0x1b1cf7,null));};exports[_0x4ec8('0x45')]=function(_0x348212,_0x273bb6){return db['CloudProvider'][_0x4ec8('0x45')](_0x348212[_0x4ec8('0x46')],{})[_0x4ec8('0x22')](respondWithResult(_0x273bb6,0xc9))[_0x4ec8('0x41')](handleError(_0x273bb6,null));};exports[_0x4ec8('0x21')]=function(_0x31aeb1,_0x375e67){if(_0x31aeb1[_0x4ec8('0x46')]['id']){delete _0x31aeb1[_0x4ec8('0x46')]['id'];}return db[_0x4ec8('0x28')]['find']({'where':{'id':_0x31aeb1[_0x4ec8('0x43')]['id']}})[_0x4ec8('0x22')](handleEntityNotFound(_0x375e67,null))[_0x4ec8('0x22')](saveUpdates(_0x31aeb1[_0x4ec8('0x46')],null))[_0x4ec8('0x22')](respondWithResult(_0x375e67,null))['catch'](handleError(_0x375e67,null));};exports[_0x4ec8('0x47')]=function(_0x3bf1b9,_0x59e508){return db['CloudProvider'][_0x4ec8('0x44')]({'where':{'id':_0x3bf1b9[_0x4ec8('0x43')]['id']}})[_0x4ec8('0x22')](handleEntityNotFound(_0x59e508,null))['then'](removeEntity(_0x59e508,null))['catch'](handleError(_0x59e508,null));}; \ No newline at end of file +var _0xdc7c=['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','status','count','offset','limit','Content-Range','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','CloudProvider','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xdc7c,0x117));var _0xcdc7=function(_0x1b69f8,_0x305b7a){_0x1b69f8=_0x1b69f8-0x0;var _0x3b03d2=_0xdc7c[_0x1b69f8];return _0x3b03d2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xcdc7('0x0'));var zipdir=require(_0xcdc7('0x1'));var jsonpatch=require(_0xcdc7('0x2'));var rp=require(_0xcdc7('0x3'));var moment=require(_0xcdc7('0x4'));var BPromise=require(_0xcdc7('0x5'));var Mustache=require(_0xcdc7('0x6'));var util=require(_0xcdc7('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xcdc7('0x8'));var ejs=require(_0xcdc7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcdc7('0xa'));var crypto=require(_0xcdc7('0xb'));var jsforce=require(_0xcdc7('0xc'));var deskjs=require(_0xcdc7('0xd'));var toCsv=require(_0xcdc7('0x8'));var querystring=require(_0xcdc7('0xe'));var Papa=require(_0xcdc7('0xf'));var Redis=require(_0xcdc7('0x10'));var authService=require(_0xcdc7('0x11'));var qs=require(_0xcdc7('0x12'));var as=require(_0xcdc7('0x13'));var hardwareService=require(_0xcdc7('0x14'));var logger=require(_0xcdc7('0x15'))(_0xcdc7('0x16'));var utils=require(_0xcdc7('0x17'));var config=require(_0xcdc7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cadbb,_0x59203c){_0x59203c=_0x59203c||0xcc;return function(_0x450634){if(_0x450634){return _0x1cadbb['sendStatus'](_0x59203c);}return _0x1cadbb[_0xcdc7('0x19')](_0x59203c)['end']();};}function respondWithResult(_0x100fba,_0xb06b45){_0xb06b45=_0xb06b45||0xc8;return function(_0x1056ce){if(_0x1056ce){return _0x100fba[_0xcdc7('0x19')](_0xb06b45)['json'](_0x1056ce);}};}function respondWithFilteredResult(_0x1914b2,_0x3ddefc){return function(_0x4e7253){if(_0x4e7253){var _0x484b90=_0x4e7253[_0xcdc7('0x1a')],_0x45a4ef=_0x3ddefc[_0xcdc7('0x1b')],_0x47f897=_0x3ddefc['offset']+_0x3ddefc[_0xcdc7('0x1c')],_0x2a24f1;if(_0x47f897>=_0x484b90){_0x47f897=_0x484b90;_0x2a24f1=0xc8;}else{_0x2a24f1=0xce;}_0x1914b2[_0xcdc7('0x19')](_0x2a24f1);return _0x1914b2['set'](_0xcdc7('0x1d'),_0x45a4ef+'-'+_0x47f897+'/'+_0x484b90)['json'](_0x4e7253);}return null;};}function patchUpdates(_0x405428){return function(_0x5d3a7a){try{jsonpatch['apply'](_0x5d3a7a,_0x405428,!![]);}catch(_0x3c0a22){return BPromise[_0xcdc7('0x1e')](_0x3c0a22);}return _0x5d3a7a[_0xcdc7('0x1f')]();};}function saveUpdates(_0x5d70fd,_0x53942e){return function(_0x508035){if(_0x508035){return _0x508035[_0xcdc7('0x20')](_0x5d70fd)[_0xcdc7('0x21')](function(_0x33b8f6){return _0x33b8f6;});}return null;};}function removeEntity(_0x42c407,_0x23c3f6){return function(_0x4f0bb9){if(_0x4f0bb9){return _0x4f0bb9['destroy']()[_0xcdc7('0x21')](function(){_0x42c407[_0xcdc7('0x19')](0xcc)[_0xcdc7('0x22')]();});}};}function handleEntityNotFound(_0x459b99,_0x137250){return function(_0x4750c4){if(!_0x4750c4){_0x459b99[_0xcdc7('0x23')](0x194);}return _0x4750c4;};}function handleError(_0x14a062,_0xf89f11){_0xf89f11=_0xf89f11||0x1f4;return function(_0x1ecfc3){logger[_0xcdc7('0x24')](_0x1ecfc3[_0xcdc7('0x25')]);if(_0x1ecfc3[_0xcdc7('0x26')]){delete _0x1ecfc3[_0xcdc7('0x26')];}_0x14a062[_0xcdc7('0x19')](_0xf89f11)[_0xcdc7('0x27')](_0x1ecfc3);};}exports[_0xcdc7('0x28')]=function(_0x560aa9,_0x2c2ac4){var _0x52d881={},_0x3506a4={},_0x28bb7a={'count':0x0,'rows':[]};var _0x1c9feb=_[_0xcdc7('0x29')](db[_0xcdc7('0x2a')][_0xcdc7('0x2b')],function(_0x1dd74e){return{'name':_0x1dd74e['fieldName'],'type':_0x1dd74e['type'][_0xcdc7('0x2c')]};});_0x3506a4[_0xcdc7('0x2d')]=_[_0xcdc7('0x29')](_0x1c9feb,_0xcdc7('0x26'));_0x3506a4[_0xcdc7('0x2e')]=_['keys'](_0x560aa9[_0xcdc7('0x2e')]);_0x3506a4[_0xcdc7('0x2f')]=_[_0xcdc7('0x30')](_0x3506a4[_0xcdc7('0x2d')],_0x3506a4[_0xcdc7('0x2e')]);_0x52d881[_0xcdc7('0x31')]=_[_0xcdc7('0x30')](_0x3506a4[_0xcdc7('0x2d')],qs[_0xcdc7('0x32')](_0x560aa9[_0xcdc7('0x2e')][_0xcdc7('0x32')]));_0x52d881[_0xcdc7('0x31')]=_0x52d881[_0xcdc7('0x31')][_0xcdc7('0x33')]?_0x52d881[_0xcdc7('0x31')]:_0x3506a4[_0xcdc7('0x2d')];if(!_0x560aa9[_0xcdc7('0x2e')][_0xcdc7('0x34')](_0xcdc7('0x35'))){_0x52d881[_0xcdc7('0x1c')]=qs['limit'](_0x560aa9['query'][_0xcdc7('0x1c')]);_0x52d881['offset']=qs[_0xcdc7('0x1b')](_0x560aa9['query']['offset']);}_0x52d881['order']=qs[_0xcdc7('0x36')](_0x560aa9['query'][_0xcdc7('0x36')]);_0x52d881[_0xcdc7('0x37')]=qs['filters'](_[_0xcdc7('0x38')](_0x560aa9[_0xcdc7('0x2e')],_0x3506a4[_0xcdc7('0x2f')]),_0x1c9feb);if(_0x560aa9[_0xcdc7('0x2e')][_0xcdc7('0x39')]){_0x52d881[_0xcdc7('0x37')]=_[_0xcdc7('0x3a')](_0x52d881[_0xcdc7('0x37')],{'$or':_[_0xcdc7('0x29')](_0x1c9feb,function(_0x82e605){if(_0x82e605[_0xcdc7('0x3b')]!=='VIRTUAL'){var _0x10d511={};_0x10d511[_0x82e605[_0xcdc7('0x26')]]={'$like':'%'+_0x560aa9[_0xcdc7('0x2e')][_0xcdc7('0x39')]+'%'};return _0x10d511;}})});}_0x52d881=_['merge']({},_0x52d881,_0x560aa9[_0xcdc7('0x3c')]);var _0x459b43={'where':_0x52d881[_0xcdc7('0x37')]};return db['CloudProvider'][_0xcdc7('0x1a')](_0x459b43)['then'](function(_0x31b01a){_0x28bb7a[_0xcdc7('0x1a')]=_0x31b01a;if(_0x560aa9['query'][_0xcdc7('0x3d')]){_0x52d881[_0xcdc7('0x3e')]=[{'all':!![]}];}return db['CloudProvider'][_0xcdc7('0x3f')](_0x52d881);})[_0xcdc7('0x21')](function(_0x27ee28){_0x28bb7a[_0xcdc7('0x40')]=_0x27ee28;return _0x28bb7a;})['then'](respondWithFilteredResult(_0x2c2ac4,_0x52d881))[_0xcdc7('0x41')](handleError(_0x2c2ac4,null));};exports['show']=function(_0xef740a,_0xf4b52b){var _0x516207={'raw':!![],'where':{'id':_0xef740a[_0xcdc7('0x42')]['id']}},_0x2d6e4d={};_0x2d6e4d[_0xcdc7('0x2d')]=_[_0xcdc7('0x43')](db[_0xcdc7('0x2a')]['rawAttributes']);_0x2d6e4d[_0xcdc7('0x2e')]=_[_0xcdc7('0x43')](_0xef740a[_0xcdc7('0x2e')]);_0x2d6e4d[_0xcdc7('0x2f')]=_[_0xcdc7('0x30')](_0x2d6e4d[_0xcdc7('0x2d')],_0x2d6e4d[_0xcdc7('0x2e')]);_0x516207[_0xcdc7('0x31')]=_[_0xcdc7('0x30')](_0x2d6e4d[_0xcdc7('0x2d')],qs[_0xcdc7('0x32')](_0xef740a['query'][_0xcdc7('0x32')]));_0x516207[_0xcdc7('0x31')]=_0x516207[_0xcdc7('0x31')][_0xcdc7('0x33')]?_0x516207['attributes']:_0x2d6e4d[_0xcdc7('0x2d')];if(_0xef740a[_0xcdc7('0x2e')]['includeAll']){_0x516207[_0xcdc7('0x3e')]=[{'all':!![]}];}_0x516207=_[_0xcdc7('0x3a')]({},_0x516207,_0xef740a[_0xcdc7('0x3c')]);return db[_0xcdc7('0x2a')][_0xcdc7('0x44')](_0x516207)[_0xcdc7('0x21')](handleEntityNotFound(_0xf4b52b,null))[_0xcdc7('0x21')](respondWithResult(_0xf4b52b,null))['catch'](handleError(_0xf4b52b,null));};exports[_0xcdc7('0x45')]=function(_0x37416d,_0x21b7fb){return db['CloudProvider'][_0xcdc7('0x45')](_0x37416d[_0xcdc7('0x46')],{})[_0xcdc7('0x21')](respondWithResult(_0x21b7fb,0xc9))[_0xcdc7('0x41')](handleError(_0x21b7fb,null));};exports[_0xcdc7('0x20')]=function(_0x328aa9,_0x4730c8){if(_0x328aa9[_0xcdc7('0x46')]['id']){delete _0x328aa9[_0xcdc7('0x46')]['id'];}return db[_0xcdc7('0x2a')]['find']({'where':{'id':_0x328aa9['params']['id']}})[_0xcdc7('0x21')](handleEntityNotFound(_0x4730c8,null))[_0xcdc7('0x21')](saveUpdates(_0x328aa9[_0xcdc7('0x46')],null))[_0xcdc7('0x21')](respondWithResult(_0x4730c8,null))[_0xcdc7('0x41')](handleError(_0x4730c8,null));};exports[_0xcdc7('0x47')]=function(_0x1d72ee,_0x594d15){return db[_0xcdc7('0x2a')]['find']({'where':{'id':_0x1d72ee['params']['id']}})[_0xcdc7('0x21')](handleEntityNotFound(_0x594d15,null))[_0xcdc7('0x21')](removeEntity(_0x594d15,null))['catch'](handleError(_0x594d15,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 747e19c..a6d936e 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 _0xbd1c=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers','lodash','util'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xbd1c,0x150));var _0xcbd1=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xbd1c[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xcbd1('0x0'));var util=require(_0xcbd1('0x1'));var logger=require(_0xcbd1('0x2'))('api');var moment=require(_0xcbd1('0x3'));var BPromise=require(_0xcbd1('0x4'));var rp=require(_0xcbd1('0x5'));var fs=require('fs');var path=require(_0xcbd1('0x6'));var rimraf=require(_0xcbd1('0x7'));var config=require(_0xcbd1('0x8'));var attributes=require(_0xcbd1('0x9'));module[_0xcbd1('0xa')]=function(_0x2f83fe,_0x546e2a){return _0x2f83fe[_0xcbd1('0xb')]('CloudProvider',attributes,{'tableName':_0xcbd1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfda2=['rimraf','../../config/environment','./cloudProvider.attributes','CloudProvider','cloud_providers','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x5b26b9,_0x12d99c){var _0x3bebcf=function(_0x28861e){while(--_0x28861e){_0x5b26b9['push'](_0x5b26b9['shift']());}};_0x3bebcf(++_0x12d99c);}(_0xfda2,0x125));var _0x2fda=function(_0xcc118,_0x2a94be){_0xcc118=_0xcc118-0x0;var _0x43f193=_0xfda2[_0xcc118];return _0x43f193;};'use strict';var _=require(_0x2fda('0x0'));var util=require(_0x2fda('0x1'));var logger=require('../../config/logger')(_0x2fda('0x2'));var moment=require(_0x2fda('0x3'));var BPromise=require(_0x2fda('0x4'));var rp=require(_0x2fda('0x5'));var fs=require('fs');var path=require(_0x2fda('0x6'));var rimraf=require(_0x2fda('0x7'));var config=require(_0x2fda('0x8'));var attributes=require(_0x2fda('0x9'));module['exports']=function(_0xb5f231,_0x58b8ff){return _0xb5f231['define'](_0x2fda('0xa'),attributes,{'tableName':_0x2fda('0xb'),'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 9caeab4..c1a50da 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 _0xadd5=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1c8e75,_0xed0444){var _0x3ad55f=function(_0x2b414e){while(--_0x2b414e){_0x1c8e75['push'](_0x1c8e75['shift']());}};_0x3ad55f(++_0xed0444);}(_0xadd5,0x14b));var _0x5add=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadd5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5add('0x0'));var util=require(_0x5add('0x1'));var moment=require('moment');var BPromise=require(_0x5add('0x2'));var rs=require(_0x5add('0x3'));var fs=require('fs');var Redis=require(_0x5add('0x4'));var db=require(_0x5add('0x5'))['db'];var utils=require(_0x5add('0x6'));var logger=require('../../config/logger')(_0x5add('0x7'));var config=require(_0x5add('0x8'));var jayson=require(_0x5add('0x9'));var client=jayson[_0x5add('0xa')][_0x5add('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54c238,_0x11c9fa,_0x5c1c5e){return new BPromise(function(_0x384e6d,_0x24bd3b){return client[_0x5add('0xc')](_0x54c238,_0x5c1c5e)[_0x5add('0xd')](function(_0x37ed48){logger['info'](_0x5add('0xe'),_0x11c9fa,_0x5add('0xf'));logger[_0x5add('0x10')](_0x5add('0x11'),_0x11c9fa,_0x5add('0xf'),JSON[_0x5add('0x12')](_0x37ed48));if(_0x37ed48[_0x5add('0x13')]){if(_0x37ed48[_0x5add('0x13')][_0x5add('0x14')]===0x1f4){logger[_0x5add('0x13')](_0x5add('0xe'),_0x11c9fa,_0x37ed48[_0x5add('0x13')][_0x5add('0x15')]);return _0x24bd3b(_0x37ed48[_0x5add('0x13')][_0x5add('0x15')]);}logger[_0x5add('0x13')](_0x5add('0xe'),_0x11c9fa,_0x37ed48[_0x5add('0x13')][_0x5add('0x15')]);return _0x384e6d(_0x37ed48[_0x5add('0x13')][_0x5add('0x15')]);}else{logger['info'](_0x5add('0xe'),_0x11c9fa,_0x5add('0xf'));_0x384e6d(_0x37ed48['result']['message']);}})[_0x5add('0x16')](function(_0x12c2de){logger[_0x5add('0x13')]('CloudProvider,\x20%s,\x20%s',_0x11c9fa,_0x12c2de);_0x24bd3b(_0x12c2de);});});} \ No newline at end of file +var _0x1ef8=['code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0x1ef8,0x1a6));var _0x81ef=function(_0x145fb2,_0x41e7db){_0x145fb2=_0x145fb2-0x0;var _0x4b45fd=_0x1ef8[_0x145fb2];return _0x4b45fd;};'use strict';var _=require(_0x81ef('0x0'));var util=require(_0x81ef('0x1'));var moment=require(_0x81ef('0x2'));var BPromise=require(_0x81ef('0x3'));var rs=require(_0x81ef('0x4'));var fs=require('fs');var Redis=require(_0x81ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x81ef('0x6'));var logger=require(_0x81ef('0x7'))(_0x81ef('0x8'));var config=require(_0x81ef('0x9'));var jayson=require(_0x81ef('0xa'));var client=jayson[_0x81ef('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22cccb,_0x59a324,_0x1e6bfd){return new BPromise(function(_0x45bfc9,_0x1daa5e){return client[_0x81ef('0xc')](_0x22cccb,_0x1e6bfd)['then'](function(_0x29c2b4){logger[_0x81ef('0xd')](_0x81ef('0xe'),_0x59a324,_0x81ef('0xf'));logger[_0x81ef('0x10')](_0x81ef('0x11'),_0x59a324,_0x81ef('0xf'),JSON['stringify'](_0x29c2b4));if(_0x29c2b4['error']){if(_0x29c2b4['error'][_0x81ef('0x12')]===0x1f4){logger['error'](_0x81ef('0xe'),_0x59a324,_0x29c2b4['error']['message']);return _0x1daa5e(_0x29c2b4[_0x81ef('0x13')][_0x81ef('0x14')]);}logger[_0x81ef('0x13')](_0x81ef('0xe'),_0x59a324,_0x29c2b4['error']['message']);return _0x45bfc9(_0x29c2b4[_0x81ef('0x13')][_0x81ef('0x14')]);}else{logger['info'](_0x81ef('0xe'),_0x59a324,_0x81ef('0xf'));_0x45bfc9(_0x29c2b4[_0x81ef('0x15')][_0x81ef('0x14')]);}})['catch'](function(_0xc7a839){logger[_0x81ef('0x13')](_0x81ef('0xe'),_0x59a324,_0xc7a839);_0x1daa5e(_0xc7a839);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 4db662b..25cbd0a 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 _0xb601=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xb601,0x173));var _0x1b60=function(_0x5be8cc,_0x4a6037){_0x5be8cc=_0x5be8cc-0x0;var _0x5f1b7e=_0xb601[_0x5be8cc];return _0x5f1b7e;};'use strict';var multer=require('multer');var util=require(_0x1b60('0x0'));var path=require(_0x1b60('0x1'));var timeout=require(_0x1b60('0x2'));var express=require(_0x1b60('0x3'));var router=express['Router']();var auth=require(_0x1b60('0x4'));var interaction=require(_0x1b60('0x5'));var config=require(_0x1b60('0x6'));var controller=require('./cloudProvider.controller');router[_0x1b60('0x7')]('/',auth[_0x1b60('0x8')](),controller[_0x1b60('0x9')]);router[_0x1b60('0x7')](_0x1b60('0xa'),auth[_0x1b60('0x8')](),controller[_0x1b60('0xb')]);router['post']('/',auth[_0x1b60('0x8')](),controller[_0x1b60('0xc')]);router[_0x1b60('0xd')](_0x1b60('0xa'),auth[_0x1b60('0x8')](),controller[_0x1b60('0xe')]);router[_0x1b60('0xf')]('/:id',auth[_0x1b60('0x8')](),controller[_0x1b60('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1ec3=['../../components/auth/service','../../components/interaction/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x3e61dd,_0x7df97){var _0x44fb6f=function(_0x21a0b7){while(--_0x21a0b7){_0x3e61dd['push'](_0x3e61dd['shift']());}};_0x44fb6f(++_0x7df97);}(_0x1ec3,0x151));var _0x31ec=function(_0x3bea26,_0x574cda){_0x3bea26=_0x3bea26-0x0;var _0x4b8db1=_0x1ec3[_0x3bea26];return _0x4b8db1;};'use strict';var multer=require('multer');var util=require(_0x31ec('0x0'));var path=require(_0x31ec('0x1'));var timeout=require(_0x31ec('0x2'));var express=require(_0x31ec('0x3'));var router=express[_0x31ec('0x4')]();var auth=require(_0x31ec('0x5'));var interaction=require(_0x31ec('0x6'));var config=require('../../config/environment');var controller=require(_0x31ec('0x7'));router['get']('/',auth[_0x31ec('0x8')](),controller[_0x31ec('0x9')]);router[_0x31ec('0xa')](_0x31ec('0xb'),auth[_0x31ec('0x8')](),controller[_0x31ec('0xc')]);router['post']('/',auth[_0x31ec('0x8')](),controller[_0x31ec('0xd')]);router[_0x31ec('0xe')]('/:id',auth[_0x31ec('0x8')](),controller[_0x31ec('0xf')]);router[_0x31ec('0x10')](_0x31ec('0xb'),auth['isAuthenticated'](),controller[_0x31ec('0x11')]);module[_0x31ec('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 1619d34..351c99f 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 _0x98d3=['name','STRING','sequelize'];(function(_0x16848e,_0x8effbf){var _0x1c459c=function(_0xd926d1){while(--_0xd926d1){_0x16848e['push'](_0x16848e['shift']());}};_0x1c459c(++_0x8effbf);}(_0x98d3,0x143));var _0x398d=function(_0x19201b,_0x216e48){_0x19201b=_0x19201b-0x0;var _0x2a13e2=_0x98d3[_0x19201b];return _0x2a13e2;};'use strict';var Sequelize=require(_0x398d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x398d('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x398d('0x2')]},'companyId':{'type':Sequelize[_0x398d('0x2')]},'website':{'type':Sequelize[_0x398d('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x398d('0x2')]},'street':{'type':Sequelize[_0x398d('0x2')]},'postalCode':{'type':Sequelize[_0x398d('0x2')]},'city':{'type':Sequelize[_0x398d('0x2')]},'country':{'type':Sequelize[_0x398d('0x2')]},'email':{'type':Sequelize[_0x398d('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x398d('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x398d('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x398d('0x2')]},'description':{'type':Sequelize[_0x398d('0x2')]}}; \ No newline at end of file +var _0x3c24=['exports','STRING','name','sequelize'];(function(_0x59710f,_0x44c7f0){var _0xaae66a=function(_0x1c2397){while(--_0x1c2397){_0x59710f['push'](_0x59710f['shift']());}};_0xaae66a(++_0x44c7f0);}(_0x3c24,0x1a3));var _0x43c2=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x3c24[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require(_0x43c2('0x0'));module[_0x43c2('0x1')]={'name':{'type':Sequelize[_0x43c2('0x2')],'unique':_0x43c2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x43c2('0x2')]},'companyId':{'type':Sequelize[_0x43c2('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x43c2('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x43c2('0x2')]},'country':{'type':Sequelize[_0x43c2('0x2')]},'email':{'type':Sequelize[_0x43c2('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x43c2('0x2')]},'sPostalCode':{'type':Sequelize[_0x43c2('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x43c2('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 157766f..62d486e 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 _0x9cc3=['CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','addContacts','ids','omit','getContacts','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','status','end','json','offset','limit','apply','reject','save','update','destroy','then','get','Companies','UserProfileResource','error','stack','name','send'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x9cc3,0x174));var _0x39cc=function(_0x4a08c3,_0x3004de){_0x4a08c3=_0x4a08c3-0x0;var _0x580925=_0x9cc3[_0x4a08c3];return _0x580925;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x39cc('0x0'));var rimraf=require(_0x39cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39cc('0x2'));var rp=require(_0x39cc('0x3'));var moment=require(_0x39cc('0x4'));var BPromise=require(_0x39cc('0x5'));var Mustache=require(_0x39cc('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x39cc('0x7'));var ejs=require(_0x39cc('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x39cc('0x9'));var crypto=require('crypto');var jsforce=require(_0x39cc('0xa'));var deskjs=require(_0x39cc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x39cc('0xc'));var Papa=require(_0x39cc('0xd'));var Redis=require('ioredis');var authService=require(_0x39cc('0xe'));var qs=require(_0x39cc('0xf'));var as=require(_0x39cc('0x10'));var hardwareService=require(_0x39cc('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x39cc('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c70d6,_0x50f7df){_0x50f7df=_0x50f7df||0xcc;return function(_0x5ece92){if(_0x5ece92){return _0x2c70d6[_0x39cc('0x13')](_0x50f7df);}return _0x2c70d6[_0x39cc('0x14')](_0x50f7df)[_0x39cc('0x15')]();};}function respondWithResult(_0x1887d5,_0x465c8c){_0x465c8c=_0x465c8c||0xc8;return function(_0xcae86d){if(_0xcae86d){return _0x1887d5[_0x39cc('0x14')](_0x465c8c)[_0x39cc('0x16')](_0xcae86d);}};}function respondWithFilteredResult(_0x4e86de,_0x5dc4b9){return function(_0x525750){if(_0x525750){var _0x30cafd=_0x525750['count'],_0x36f4db=_0x5dc4b9[_0x39cc('0x17')],_0x4ce6b9=_0x5dc4b9[_0x39cc('0x17')]+_0x5dc4b9[_0x39cc('0x18')],_0x3927aa;if(_0x4ce6b9>=_0x30cafd){_0x4ce6b9=_0x30cafd;_0x3927aa=0xc8;}else{_0x3927aa=0xce;}_0x4e86de[_0x39cc('0x14')](_0x3927aa);return _0x4e86de['set']('Content-Range',_0x36f4db+'-'+_0x4ce6b9+'/'+_0x30cafd)[_0x39cc('0x16')](_0x525750);}return null;};}function patchUpdates(_0x502db1){return function(_0x2cd5c7){try{jsonpatch[_0x39cc('0x19')](_0x2cd5c7,_0x502db1,!![]);}catch(_0x212e24){return BPromise[_0x39cc('0x1a')](_0x212e24);}return _0x2cd5c7[_0x39cc('0x1b')]();};}function saveUpdates(_0x57718f,_0x1dd76a){return function(_0xf173d4){if(_0xf173d4){return _0xf173d4[_0x39cc('0x1c')](_0x57718f)['then'](function(_0x237bce){return _0x237bce;});}return null;};}function removeEntity(_0x303793,_0x50efe2){return function(_0x35934d){if(_0x35934d){return _0x35934d[_0x39cc('0x1d')]()[_0x39cc('0x1e')](function(){var _0x3e3ef2=_0x35934d[_0x39cc('0x1f')]({'plain':!![]});var _0x20aca9=_0x39cc('0x20');return db[_0x39cc('0x21')][_0x39cc('0x1d')]({'where':{'type':_0x20aca9,'resourceId':_0x3e3ef2['id']}})['then'](function(){return _0x35934d;});})[_0x39cc('0x1e')](function(){_0x303793[_0x39cc('0x14')](0xcc)[_0x39cc('0x15')]();});}};}function handleEntityNotFound(_0x3f2954,_0x3528f9){return function(_0xbdebe4){if(!_0xbdebe4){_0x3f2954[_0x39cc('0x13')](0x194);}return _0xbdebe4;};}function handleError(_0x3a9c64,_0x2421aa){_0x2421aa=_0x2421aa||0x1f4;return function(_0xe5fdae){logger[_0x39cc('0x22')](_0xe5fdae[_0x39cc('0x23')]);if(_0xe5fdae['name']){delete _0xe5fdae[_0x39cc('0x24')];}_0x3a9c64[_0x39cc('0x14')](_0x2421aa)[_0x39cc('0x25')](_0xe5fdae);};}exports['index']=function(_0x3f9726,_0x394dee){var _0x3cb961={},_0x24f477={},_0x32ab78={'count':0x0,'rows':[]};return db[_0x39cc('0x26')][_0x39cc('0x27')]()[_0x39cc('0x1e')](function(_0x3407c0){_0x24f477[_0x39cc('0x28')]=_['keys'](_0x3407c0);_0x24f477['query']=_[_0x39cc('0x29')](_0x3f9726[_0x39cc('0x2a')]);_0x24f477['filters']=_[_0x39cc('0x2b')](_0x24f477['model'],_0x24f477[_0x39cc('0x2a')]);_0x3cb961[_0x39cc('0x2c')]=_['intersection'](_0x24f477[_0x39cc('0x28')],qs[_0x39cc('0x2d')](_0x3f9726['query'][_0x39cc('0x2d')]));_0x3cb961[_0x39cc('0x2c')]=_0x3cb961['attributes'][_0x39cc('0x2e')]?_0x3cb961['attributes']:_0x24f477[_0x39cc('0x28')];if(!_0x3f9726[_0x39cc('0x2a')][_0x39cc('0x2f')](_0x39cc('0x30'))){_0x3cb961[_0x39cc('0x18')]=qs['limit'](_0x3f9726[_0x39cc('0x2a')][_0x39cc('0x18')]);_0x3cb961[_0x39cc('0x17')]=qs[_0x39cc('0x17')](_0x3f9726[_0x39cc('0x2a')]['offset']);}_0x3cb961[_0x39cc('0x31')]=qs[_0x39cc('0x32')](_0x3f9726['query'][_0x39cc('0x32')]);_0x3cb961[_0x39cc('0x33')]=qs[_0x39cc('0x34')](_[_0x39cc('0x35')](_0x3f9726[_0x39cc('0x2a')],_0x24f477['filters']));if(_0x3f9726[_0x39cc('0x2a')][_0x39cc('0x36')]){_0x3cb961['where']=_[_0x39cc('0x37')](_0x3cb961[_0x39cc('0x33')],{'$or':_[_0x39cc('0x38')](_0x3cb961[_0x39cc('0x2c')],function(_0xe42dee){var _0x41d7fa={};_0x41d7fa[_0xe42dee]={'$like':'%'+_0x3f9726[_0x39cc('0x2a')][_0x39cc('0x36')]+'%'};return _0x41d7fa;})});}_0x3cb961=_[_0x39cc('0x37')]({},_0x3cb961,_0x3f9726[_0x39cc('0x39')]);var _0x23f05f={'where':_0x3cb961[_0x39cc('0x33')]};return db[_0x39cc('0x26')][_0x39cc('0x3a')](_0x23f05f)['then'](function(_0x12eaed){_0x32ab78[_0x39cc('0x3a')]=_0x12eaed;if(_0x3f9726['query'][_0x39cc('0x3b')]){_0x3cb961[_0x39cc('0x3c')]=[{'all':!![]}];}return db[_0x39cc('0x26')][_0x39cc('0x3d')](_0x3cb961);})[_0x39cc('0x1e')](function(_0x4b14ae){_0x32ab78[_0x39cc('0x3e')]=_0x4b14ae;return _0x32ab78;})[_0x39cc('0x1e')](respondWithFilteredResult(_0x394dee,_0x3cb961))[_0x39cc('0x3f')](handleError(_0x394dee,null));})['catch'](handleError(_0x394dee,null));};exports[_0x39cc('0x40')]=function(_0x1db304,_0x426070){var _0x5ece99={'raw':![],'where':{'id':_0x1db304[_0x39cc('0x41')]['id']}},_0x3a7b={};_0x3a7b[_0x39cc('0x28')]=_[_0x39cc('0x29')](db[_0x39cc('0x26')][_0x39cc('0x42')]);_0x3a7b['query']=_['keys'](_0x1db304[_0x39cc('0x2a')]);_0x3a7b[_0x39cc('0x34')]=_[_0x39cc('0x2b')](_0x3a7b[_0x39cc('0x28')],_0x3a7b[_0x39cc('0x2a')]);_0x5ece99['attributes']=_['intersection'](_0x3a7b[_0x39cc('0x28')],qs[_0x39cc('0x2d')](_0x1db304[_0x39cc('0x2a')][_0x39cc('0x2d')]));_0x5ece99[_0x39cc('0x2c')]=_0x5ece99[_0x39cc('0x2c')]['length']?_0x5ece99[_0x39cc('0x2c')]:_0x3a7b[_0x39cc('0x28')];if(_0x1db304[_0x39cc('0x2a')]['includeAll']){_0x5ece99[_0x39cc('0x3c')]=[{'all':!![]}];}_0x5ece99=_[_0x39cc('0x37')]({},_0x5ece99,_0x1db304[_0x39cc('0x39')]);return db[_0x39cc('0x26')]['find'](_0x5ece99)[_0x39cc('0x1e')](handleEntityNotFound(_0x426070,null))[_0x39cc('0x1e')](respondWithResult(_0x426070,null))[_0x39cc('0x3f')](handleError(_0x426070,null));};exports[_0x39cc('0x43')]=function(_0x4865af,_0xdd3a97){return db[_0x39cc('0x26')][_0x39cc('0x43')](_0x4865af[_0x39cc('0x44')],{})[_0x39cc('0x1e')](function(_0x1bcd8a){var _0x344939=_0x4865af[_0x39cc('0x45')][_0x39cc('0x1f')]({'plain':!![]});if(!_0x344939)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x344939[_0x39cc('0x46')]===_0x39cc('0x45')){var _0x5475c9=_0x1bcd8a[_0x39cc('0x1f')]({'plain':!![]});var _0xd7c6b='Companies';return db[_0x39cc('0x47')][_0x39cc('0x48')]({'where':{'name':_0xd7c6b,'userProfileId':_0x344939[_0x39cc('0x49')]},'raw':!![]})[_0x39cc('0x1e')](function(_0x566349){if(_0x566349&&_0x566349[_0x39cc('0x4a')]===0x0){return db[_0x39cc('0x21')][_0x39cc('0x43')]({'name':_0x5475c9[_0x39cc('0x24')],'resourceId':_0x5475c9['id'],'type':_0x566349['name'],'sectionId':_0x566349['id']},{})[_0x39cc('0x1e')](function(){return _0x1bcd8a;});}else{return _0x1bcd8a;}})['catch'](function(_0x2ba4bc){logger[_0x39cc('0x22')](_0x39cc('0x4b'),_0x2ba4bc);throw _0x2ba4bc;});}return _0x1bcd8a;})[_0x39cc('0x1e')](respondWithResult(_0xdd3a97,0xc9))[_0x39cc('0x3f')](handleError(_0xdd3a97,null));};exports[_0x39cc('0x1c')]=function(_0x3eeae4,_0x59dc53){if(_0x3eeae4[_0x39cc('0x44')]['id']){delete _0x3eeae4[_0x39cc('0x44')]['id'];}return db[_0x39cc('0x26')][_0x39cc('0x48')]({'where':{'id':_0x3eeae4[_0x39cc('0x41')]['id']}})[_0x39cc('0x1e')](handleEntityNotFound(_0x59dc53,null))[_0x39cc('0x1e')](saveUpdates(_0x3eeae4[_0x39cc('0x44')],null))[_0x39cc('0x1e')](respondWithResult(_0x59dc53,null))[_0x39cc('0x3f')](handleError(_0x59dc53,null));};exports[_0x39cc('0x1d')]=function(_0x5a0605,_0x18aabd){return db[_0x39cc('0x26')]['find']({'where':{'id':_0x5a0605['params']['id']}})[_0x39cc('0x1e')](handleEntityNotFound(_0x18aabd,null))['then'](removeEntity(_0x18aabd,null))[_0x39cc('0x3f')](handleError(_0x18aabd,null));};exports[_0x39cc('0x27')]=function(_0x4b6e22,_0x36b3e6){return db[_0x39cc('0x26')][_0x39cc('0x27')]()[_0x39cc('0x1e')](respondWithResult(_0x36b3e6,null))[_0x39cc('0x3f')](handleError(_0x36b3e6,null));};exports['addContacts']=function(_0x26394b,_0x332fd1,_0x2ec4d8){return db[_0x39cc('0x4c')][_0x39cc('0x48')]({'where':{'id':_0x26394b[_0x39cc('0x41')]['id']}})[_0x39cc('0x1e')](handleEntityNotFound(_0x332fd1,null))[_0x39cc('0x1e')](function(_0x5b909f){if(_0x5b909f){return _0x5b909f[_0x39cc('0x4d')](_0x26394b[_0x39cc('0x44')][_0x39cc('0x4e')],_[_0x39cc('0x4f')](_0x26394b[_0x39cc('0x44')],[_0x39cc('0x4e'),'id'])||{});}})[_0x39cc('0x1e')](respondWithResult(_0x332fd1,null))[_0x39cc('0x3f')](handleError(_0x332fd1,null));};exports[_0x39cc('0x50')]=function(_0x5af264,_0x446eab,_0x3e269f){var _0x3fa16b={};var _0x4543f0={};var _0x499716;var _0x2f8e09;return db[_0x39cc('0x26')][_0x39cc('0x51')]({'where':{'id':_0x5af264[_0x39cc('0x41')]['id']}})[_0x39cc('0x1e')](handleEntityNotFound(_0x446eab,null))['then'](function(_0x3ff8c8){if(_0x3ff8c8){_0x499716=_0x3ff8c8;_0x4543f0[_0x39cc('0x28')]=_['keys'](db[_0x39cc('0x4c')][_0x39cc('0x42')]);_0x4543f0[_0x39cc('0x2a')]=_[_0x39cc('0x29')](_0x5af264[_0x39cc('0x2a')]);_0x4543f0[_0x39cc('0x34')]=_[_0x39cc('0x2b')](_0x4543f0[_0x39cc('0x28')],_0x4543f0[_0x39cc('0x2a')]);_0x3fa16b[_0x39cc('0x2c')]=_['intersection'](_0x4543f0[_0x39cc('0x28')],qs['fields'](_0x5af264[_0x39cc('0x2a')][_0x39cc('0x2d')]));_0x3fa16b[_0x39cc('0x2c')]=_0x3fa16b['attributes']['length']?_0x3fa16b[_0x39cc('0x2c')]:_0x4543f0['model'];_0x3fa16b['order']=qs[_0x39cc('0x32')](_0x5af264[_0x39cc('0x2a')][_0x39cc('0x32')]);_0x3fa16b['where']=qs[_0x39cc('0x34')](_[_0x39cc('0x35')](_0x5af264['query'],_0x4543f0['filters']));if(_0x5af264[_0x39cc('0x2a')][_0x39cc('0x36')]){_0x3fa16b[_0x39cc('0x33')]=_[_0x39cc('0x37')](_0x3fa16b[_0x39cc('0x33')],{'$or':_[_0x39cc('0x38')](_0x3fa16b['attributes'],function(_0x5f434d){var _0x2ae17a={};_0x2ae17a[_0x5f434d]={'$like':'%'+_0x5af264[_0x39cc('0x2a')][_0x39cc('0x36')]+'%'};return _0x2ae17a;})});}_0x3fa16b=_[_0x39cc('0x37')]({},_0x3fa16b,_0x5af264['options']);return _0x499716[_0x39cc('0x50')](_0x3fa16b);}})[_0x39cc('0x1e')](function(_0x37c633){if(_0x37c633){_0x2f8e09=_0x37c633[_0x39cc('0x2e')];if(!_0x5af264[_0x39cc('0x2a')][_0x39cc('0x2f')](_0x39cc('0x30'))){_0x3fa16b['limit']=qs[_0x39cc('0x18')](_0x5af264[_0x39cc('0x2a')]['limit']);_0x3fa16b['offset']=qs[_0x39cc('0x17')](_0x5af264[_0x39cc('0x2a')][_0x39cc('0x17')]);}return _0x499716[_0x39cc('0x50')](_0x3fa16b);}})[_0x39cc('0x1e')](function(_0x244801){if(_0x244801){return _0x244801?{'count':_0x2f8e09,'rows':_0x244801}:null;}})[_0x39cc('0x1e')](respondWithResult(_0x446eab,null))['catch'](handleError(_0x446eab,null));}; \ No newline at end of file +var _0x03e2=['rawAttributes','fields','includeAll','find','create','body','user','get','Companies','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','findOne','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','status','sendStatus','stack','name','index','CmCompany','describe','keys','query','intersection','model','attributes','length','nolimit','limit','sort','where','pick','filters','filter','merge','map','options','include','rows','catch','params'];(function(_0x44a41a,_0x2418e5){var _0x1d375d=function(_0x1a59a1){while(--_0x1a59a1){_0x44a41a['push'](_0x44a41a['shift']());}};_0x1d375d(++_0x2418e5);}(_0x03e2,0xbf));var _0x203e=function(_0x3ac67a,_0x3bebeb){_0x3ac67a=_0x3ac67a-0x0;var _0x4830b9=_0x03e2[_0x3ac67a];return _0x4830b9;};'use strict';var pdf=require(_0x203e('0x0'));var emlformat=require(_0x203e('0x1'));var rimraf=require(_0x203e('0x2'));var zipdir=require(_0x203e('0x3'));var jsonpatch=require(_0x203e('0x4'));var rp=require(_0x203e('0x5'));var moment=require(_0x203e('0x6'));var BPromise=require(_0x203e('0x7'));var Mustache=require(_0x203e('0x8'));var util=require(_0x203e('0x9'));var path=require(_0x203e('0xa'));var sox=require(_0x203e('0xb'));var csv=require(_0x203e('0xc'));var ejs=require(_0x203e('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x203e('0xe'));var crypto=require(_0x203e('0xf'));var jsforce=require(_0x203e('0x10'));var deskjs=require(_0x203e('0x11'));var toCsv=require(_0x203e('0xc'));var querystring=require('querystring');var Papa=require(_0x203e('0x12'));var Redis=require(_0x203e('0x13'));var authService=require(_0x203e('0x14'));var qs=require(_0x203e('0x15'));var as=require(_0x203e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x203e('0x17'))(_0x203e('0x18'));var utils=require(_0x203e('0x19'));var config=require(_0x203e('0x1a'));var db=require(_0x203e('0x1b'))['db'];function respondWithStatusCode(_0x5591fd,_0x4689e9){_0x4689e9=_0x4689e9||0xcc;return function(_0x1f91cd){if(_0x1f91cd){return _0x5591fd['sendStatus'](_0x4689e9);}return _0x5591fd['status'](_0x4689e9)[_0x203e('0x1c')]();};}function respondWithResult(_0x3c8b89,_0x4c318b){_0x4c318b=_0x4c318b||0xc8;return function(_0x13980){if(_0x13980){return _0x3c8b89['status'](_0x4c318b)[_0x203e('0x1d')](_0x13980);}};}function respondWithFilteredResult(_0x19917c,_0xb16f9){return function(_0x361932){if(_0x361932){var _0x1c2a6e=_0x361932[_0x203e('0x1e')],_0x11294b=_0xb16f9[_0x203e('0x1f')],_0x144d79=_0xb16f9[_0x203e('0x1f')]+_0xb16f9['limit'],_0x582eec;if(_0x144d79>=_0x1c2a6e){_0x144d79=_0x1c2a6e;_0x582eec=0xc8;}else{_0x582eec=0xce;}_0x19917c['status'](_0x582eec);return _0x19917c[_0x203e('0x20')](_0x203e('0x21'),_0x11294b+'-'+_0x144d79+'/'+_0x1c2a6e)['json'](_0x361932);}return null;};}function patchUpdates(_0x5650d5){return function(_0xeaf1f7){try{jsonpatch[_0x203e('0x22')](_0xeaf1f7,_0x5650d5,!![]);}catch(_0x9c1ccc){return BPromise['reject'](_0x9c1ccc);}return _0xeaf1f7[_0x203e('0x23')]();};}function saveUpdates(_0x46bb9a,_0x180b73){return function(_0x1664df){if(_0x1664df){return _0x1664df[_0x203e('0x24')](_0x46bb9a)[_0x203e('0x25')](function(_0x3cf0e3){return _0x3cf0e3;});}return null;};}function removeEntity(_0x38331a,_0x42b85b){return function(_0x7e91e7){if(_0x7e91e7){return _0x7e91e7[_0x203e('0x26')]()[_0x203e('0x25')](function(){var _0x5da059=_0x7e91e7['get']({'plain':!![]});var _0x6979c7='Companies';return db[_0x203e('0x27')][_0x203e('0x26')]({'where':{'type':_0x6979c7,'resourceId':_0x5da059['id']}})[_0x203e('0x25')](function(){return _0x7e91e7;});})[_0x203e('0x25')](function(){_0x38331a[_0x203e('0x28')](0xcc)[_0x203e('0x1c')]();});}};}function handleEntityNotFound(_0x2397d9,_0x16d3c7){return function(_0x4b5ab1){if(!_0x4b5ab1){_0x2397d9[_0x203e('0x29')](0x194);}return _0x4b5ab1;};}function handleError(_0x27b84c,_0x228775){_0x228775=_0x228775||0x1f4;return function(_0xf8779d){logger['error'](_0xf8779d[_0x203e('0x2a')]);if(_0xf8779d[_0x203e('0x2b')]){delete _0xf8779d[_0x203e('0x2b')];}_0x27b84c[_0x203e('0x28')](_0x228775)['send'](_0xf8779d);};}exports[_0x203e('0x2c')]=function(_0x46e3a6,_0x47cb3f){var _0x493060={},_0x408f09={},_0x3e0f8b={'count':0x0,'rows':[]};return db[_0x203e('0x2d')][_0x203e('0x2e')]()[_0x203e('0x25')](function(_0x11d550){_0x408f09['model']=_[_0x203e('0x2f')](_0x11d550);_0x408f09[_0x203e('0x30')]=_[_0x203e('0x2f')](_0x46e3a6[_0x203e('0x30')]);_0x408f09['filters']=_[_0x203e('0x31')](_0x408f09[_0x203e('0x32')],_0x408f09[_0x203e('0x30')]);_0x493060['attributes']=_['intersection'](_0x408f09[_0x203e('0x32')],qs['fields'](_0x46e3a6[_0x203e('0x30')]['fields']));_0x493060[_0x203e('0x33')]=_0x493060['attributes'][_0x203e('0x34')]?_0x493060['attributes']:_0x408f09[_0x203e('0x32')];if(!_0x46e3a6[_0x203e('0x30')]['hasOwnProperty'](_0x203e('0x35'))){_0x493060[_0x203e('0x36')]=qs['limit'](_0x46e3a6['query'][_0x203e('0x36')]);_0x493060[_0x203e('0x1f')]=qs['offset'](_0x46e3a6[_0x203e('0x30')][_0x203e('0x1f')]);}_0x493060['order']=qs[_0x203e('0x37')](_0x46e3a6[_0x203e('0x30')][_0x203e('0x37')]);_0x493060[_0x203e('0x38')]=qs['filters'](_[_0x203e('0x39')](_0x46e3a6[_0x203e('0x30')],_0x408f09[_0x203e('0x3a')]));if(_0x46e3a6[_0x203e('0x30')][_0x203e('0x3b')]){_0x493060[_0x203e('0x38')]=_[_0x203e('0x3c')](_0x493060['where'],{'$or':_[_0x203e('0x3d')](_0x493060[_0x203e('0x33')],function(_0x4d45f4){var _0x31d9e6={};_0x31d9e6[_0x4d45f4]={'$like':'%'+_0x46e3a6['query'][_0x203e('0x3b')]+'%'};return _0x31d9e6;})});}_0x493060=_[_0x203e('0x3c')]({},_0x493060,_0x46e3a6[_0x203e('0x3e')]);var _0x5e2064={'where':_0x493060[_0x203e('0x38')]};return db['CmCompany'][_0x203e('0x1e')](_0x5e2064)['then'](function(_0x55766a){_0x3e0f8b[_0x203e('0x1e')]=_0x55766a;if(_0x46e3a6[_0x203e('0x30')]['includeAll']){_0x493060[_0x203e('0x3f')]=[{'all':!![]}];}return db[_0x203e('0x2d')]['findAll'](_0x493060);})[_0x203e('0x25')](function(_0x1db2db){_0x3e0f8b[_0x203e('0x40')]=_0x1db2db;return _0x3e0f8b;})[_0x203e('0x25')](respondWithFilteredResult(_0x47cb3f,_0x493060))[_0x203e('0x41')](handleError(_0x47cb3f,null));})['catch'](handleError(_0x47cb3f,null));};exports['show']=function(_0x3b205a,_0x51531f){var _0x28331c={'raw':![],'where':{'id':_0x3b205a[_0x203e('0x42')]['id']}},_0x2971d8={};_0x2971d8[_0x203e('0x32')]=_[_0x203e('0x2f')](db[_0x203e('0x2d')][_0x203e('0x43')]);_0x2971d8[_0x203e('0x30')]=_[_0x203e('0x2f')](_0x3b205a['query']);_0x2971d8[_0x203e('0x3a')]=_['intersection'](_0x2971d8[_0x203e('0x32')],_0x2971d8['query']);_0x28331c[_0x203e('0x33')]=_['intersection'](_0x2971d8[_0x203e('0x32')],qs[_0x203e('0x44')](_0x3b205a[_0x203e('0x30')]['fields']));_0x28331c[_0x203e('0x33')]=_0x28331c[_0x203e('0x33')][_0x203e('0x34')]?_0x28331c[_0x203e('0x33')]:_0x2971d8[_0x203e('0x32')];if(_0x3b205a[_0x203e('0x30')][_0x203e('0x45')]){_0x28331c[_0x203e('0x3f')]=[{'all':!![]}];}_0x28331c=_[_0x203e('0x3c')]({},_0x28331c,_0x3b205a[_0x203e('0x3e')]);return db['CmCompany'][_0x203e('0x46')](_0x28331c)['then'](handleEntityNotFound(_0x51531f,null))[_0x203e('0x25')](respondWithResult(_0x51531f,null))[_0x203e('0x41')](handleError(_0x51531f,null));};exports[_0x203e('0x47')]=function(_0x3b4f85,_0x12b286){return db[_0x203e('0x2d')][_0x203e('0x47')](_0x3b4f85[_0x203e('0x48')],{})[_0x203e('0x25')](function(_0x3346a7){var _0x58348d=_0x3b4f85[_0x203e('0x49')][_0x203e('0x4a')]({'plain':!![]});if(!_0x58348d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58348d['role']===_0x203e('0x49')){var _0x31590a=_0x3346a7['get']({'plain':!![]});var _0x5948df=_0x203e('0x4b');return db['UserProfileSection'][_0x203e('0x46')]({'where':{'name':_0x5948df,'userProfileId':_0x58348d[_0x203e('0x4c')]},'raw':!![]})[_0x203e('0x25')](function(_0xacf33b){if(_0xacf33b&&_0xacf33b['autoAssociation']===0x0){return db[_0x203e('0x27')][_0x203e('0x47')]({'name':_0x31590a[_0x203e('0x2b')],'resourceId':_0x31590a['id'],'type':_0xacf33b[_0x203e('0x2b')],'sectionId':_0xacf33b['id']},{})[_0x203e('0x25')](function(){return _0x3346a7;});}else{return _0x3346a7;}})[_0x203e('0x41')](function(_0x216bbd){logger[_0x203e('0x4d')](_0x203e('0x4e'),_0x216bbd);throw _0x216bbd;});}return _0x3346a7;})[_0x203e('0x25')](respondWithResult(_0x12b286,0xc9))['catch'](handleError(_0x12b286,null));};exports['update']=function(_0x2e88c4,_0x351d58){if(_0x2e88c4[_0x203e('0x48')]['id']){delete _0x2e88c4[_0x203e('0x48')]['id'];}return db[_0x203e('0x2d')]['find']({'where':{'id':_0x2e88c4[_0x203e('0x42')]['id']}})['then'](handleEntityNotFound(_0x351d58,null))[_0x203e('0x25')](saveUpdates(_0x2e88c4[_0x203e('0x48')],null))[_0x203e('0x25')](respondWithResult(_0x351d58,null))['catch'](handleError(_0x351d58,null));};exports['destroy']=function(_0x573cd1,_0x132b3e){return db[_0x203e('0x2d')][_0x203e('0x46')]({'where':{'id':_0x573cd1['params']['id']}})[_0x203e('0x25')](handleEntityNotFound(_0x132b3e,null))['then'](removeEntity(_0x132b3e,null))['catch'](handleError(_0x132b3e,null));};exports[_0x203e('0x2e')]=function(_0x452e8a,_0x34e6cd){return db[_0x203e('0x2d')][_0x203e('0x2e')]()[_0x203e('0x25')](respondWithResult(_0x34e6cd,null))[_0x203e('0x41')](handleError(_0x34e6cd,null));};exports[_0x203e('0x4f')]=function(_0x179e70,_0x90c785,_0x50d89e){return db[_0x203e('0x50')][_0x203e('0x46')]({'where':{'id':_0x179e70[_0x203e('0x42')]['id']}})['then'](handleEntityNotFound(_0x90c785,null))[_0x203e('0x25')](function(_0x254ee4){if(_0x254ee4){return _0x254ee4['addContacts'](_0x179e70[_0x203e('0x48')][_0x203e('0x51')],_[_0x203e('0x52')](_0x179e70[_0x203e('0x48')],[_0x203e('0x51'),'id'])||{});}})[_0x203e('0x25')](respondWithResult(_0x90c785,null))[_0x203e('0x41')](handleError(_0x90c785,null));};exports[_0x203e('0x53')]=function(_0x48d9c6,_0x4aa7f7,_0x18afd0){var _0x40f0ba={};var _0x23e047={};var _0x38246a;var _0x457a8b;return db[_0x203e('0x2d')][_0x203e('0x54')]({'where':{'id':_0x48d9c6['params']['id']}})[_0x203e('0x25')](handleEntityNotFound(_0x4aa7f7,null))['then'](function(_0x193227){if(_0x193227){_0x38246a=_0x193227;_0x23e047[_0x203e('0x32')]=_['keys'](db[_0x203e('0x50')]['rawAttributes']);_0x23e047[_0x203e('0x30')]=_[_0x203e('0x2f')](_0x48d9c6[_0x203e('0x30')]);_0x23e047['filters']=_['intersection'](_0x23e047['model'],_0x23e047[_0x203e('0x30')]);_0x40f0ba[_0x203e('0x33')]=_[_0x203e('0x31')](_0x23e047[_0x203e('0x32')],qs[_0x203e('0x44')](_0x48d9c6[_0x203e('0x30')][_0x203e('0x44')]));_0x40f0ba[_0x203e('0x33')]=_0x40f0ba[_0x203e('0x33')][_0x203e('0x34')]?_0x40f0ba[_0x203e('0x33')]:_0x23e047[_0x203e('0x32')];_0x40f0ba['order']=qs[_0x203e('0x37')](_0x48d9c6[_0x203e('0x30')]['sort']);_0x40f0ba[_0x203e('0x38')]=qs[_0x203e('0x3a')](_[_0x203e('0x39')](_0x48d9c6[_0x203e('0x30')],_0x23e047[_0x203e('0x3a')]));if(_0x48d9c6[_0x203e('0x30')][_0x203e('0x3b')]){_0x40f0ba[_0x203e('0x38')]=_[_0x203e('0x3c')](_0x40f0ba['where'],{'$or':_[_0x203e('0x3d')](_0x40f0ba[_0x203e('0x33')],function(_0x140044){var _0x7983cf={};_0x7983cf[_0x140044]={'$like':'%'+_0x48d9c6[_0x203e('0x30')][_0x203e('0x3b')]+'%'};return _0x7983cf;})});}_0x40f0ba=_[_0x203e('0x3c')]({},_0x40f0ba,_0x48d9c6['options']);return _0x38246a[_0x203e('0x53')](_0x40f0ba);}})[_0x203e('0x25')](function(_0x347661){if(_0x347661){_0x457a8b=_0x347661[_0x203e('0x34')];if(!_0x48d9c6['query'][_0x203e('0x55')](_0x203e('0x35'))){_0x40f0ba[_0x203e('0x36')]=qs[_0x203e('0x36')](_0x48d9c6['query']['limit']);_0x40f0ba[_0x203e('0x1f')]=qs['offset'](_0x48d9c6[_0x203e('0x30')][_0x203e('0x1f')]);}return _0x38246a[_0x203e('0x53')](_0x40f0ba);}})[_0x203e('0x25')](function(_0x1ccbdd){if(_0x1ccbdd){return _0x1ccbdd?{'count':_0x457a8b,'rows':_0x1ccbdd}:null;}})[_0x203e('0x25')](respondWithResult(_0x4aa7f7,null))['catch'](handleError(_0x4aa7f7,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 7f028d8..57d6e7c 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 _0x86f4=['exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x29621f,_0x59e7e1){var _0x54e0e5=function(_0x347a19){while(--_0x347a19){_0x29621f['push'](_0x29621f['shift']());}};_0x54e0e5(++_0x59e7e1);}(_0x86f4,0x18a));var _0x486f=function(_0x5077f7,_0x447918){_0x5077f7=_0x5077f7-0x0;var _0x4ce131=_0x86f4[_0x5077f7];return _0x4ce131;};'use strict';var _=require(_0x486f('0x0'));var util=require(_0x486f('0x1'));var logger=require(_0x486f('0x2'))(_0x486f('0x3'));var moment=require(_0x486f('0x4'));var BPromise=require(_0x486f('0x5'));var rp=require(_0x486f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x486f('0x7'));var config=require(_0x486f('0x8'));var attributes=require('./cmCompany.attributes');module[_0x486f('0x9')]=function(_0x1adb27,_0x39f767){return _0x1adb27[_0x486f('0xa')](_0x486f('0xb'),attributes,{'tableName':_0x486f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d25=['path','../../config/environment','./cmCompany.attributes','exports','define','cm_companies','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d25,0xba));var _0x51d2=function(_0x18e52b,_0x1fae35){_0x18e52b=_0x18e52b-0x0;var _0x3d3062=_0x1d25[_0x18e52b];return _0x3d3062;};'use strict';var _=require(_0x51d2('0x0'));var util=require(_0x51d2('0x1'));var logger=require(_0x51d2('0x2'))(_0x51d2('0x3'));var moment=require(_0x51d2('0x4'));var BPromise=require('bluebird');var rp=require(_0x51d2('0x5'));var fs=require('fs');var path=require(_0x51d2('0x6'));var rimraf=require('rimraf');var config=require(_0x51d2('0x7'));var attributes=require(_0x51d2('0x8'));module[_0x51d2('0x9')]=function(_0x407091,_0x449fec){return _0x407091[_0x51d2('0xa')]('CmCompany',attributes,{'tableName':_0x51d2('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 2c105dd..b89509e 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 _0x734e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash'];(function(_0x156e99,_0x2bf27e){var _0x18870e=function(_0x3e6c3b){while(--_0x3e6c3b){_0x156e99['push'](_0x156e99['shift']());}};_0x18870e(++_0x2bf27e);}(_0x734e,0x153));var _0xe734=function(_0xec3cab,_0x3d89a1){_0xec3cab=_0xec3cab-0x0;var _0x2e4e51=_0x734e[_0xec3cab];return _0x2e4e51;};'use strict';var _=require(_0xe734('0x0'));var util=require('util');var moment=require(_0xe734('0x1'));var BPromise=require(_0xe734('0x2'));var rs=require(_0xe734('0x3'));var fs=require('fs');var Redis=require(_0xe734('0x4'));var db=require(_0xe734('0x5'))['db'];var utils=require(_0xe734('0x6'));var logger=require('../../config/logger')(_0xe734('0x7'));var config=require('../../config/environment');var jayson=require(_0xe734('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x41132a,_0x46dfc6,_0x1d554c){return new BPromise(function(_0x5dc7e8,_0x4aa6d8){return client['request'](_0x41132a,_0x1d554c)[_0xe734('0x9')](function(_0x345b3d){logger['info'](_0xe734('0xa'),_0x46dfc6,_0xe734('0xb'));logger[_0xe734('0xc')](_0xe734('0xd'),_0x46dfc6,_0xe734('0xb'),JSON[_0xe734('0xe')](_0x345b3d));if(_0x345b3d[_0xe734('0xf')]){if(_0x345b3d[_0xe734('0xf')][_0xe734('0x10')]===0x1f4){logger[_0xe734('0xf')](_0xe734('0xa'),_0x46dfc6,_0x345b3d[_0xe734('0xf')][_0xe734('0x11')]);return _0x4aa6d8(_0x345b3d[_0xe734('0xf')]['message']);}logger[_0xe734('0xf')](_0xe734('0xa'),_0x46dfc6,_0x345b3d['error']['message']);return _0x5dc7e8(_0x345b3d[_0xe734('0xf')][_0xe734('0x11')]);}else{logger[_0xe734('0x12')](_0xe734('0xa'),_0x46dfc6,_0xe734('0xb'));_0x5dc7e8(_0x345b3d['result'][_0xe734('0x11')]);}})[_0xe734('0x13')](function(_0x2775fb){logger[_0xe734('0xf')]('CmCompany,\x20%s,\x20%s',_0x46dfc6,_0x2775fb);_0x4aa6d8(_0x2775fb);});});} \ No newline at end of file +var _0xd8ee=['message','result','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x10e151,_0x136e6a){var _0x1a0248=function(_0x41c7f5){while(--_0x41c7f5){_0x10e151['push'](_0x10e151['shift']());}};_0x1a0248(++_0x136e6a);}(_0xd8ee,0xfe));var _0xed8e=function(_0x3c9eaa,_0x496585){_0x3c9eaa=_0x3c9eaa-0x0;var _0x91d9c6=_0xd8ee[_0x3c9eaa];return _0x91d9c6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xed8e('0x0'));var BPromise=require('bluebird');var rs=require(_0xed8e('0x1'));var fs=require('fs');var Redis=require(_0xed8e('0x2'));var db=require(_0xed8e('0x3'))['db'];var utils=require(_0xed8e('0x4'));var logger=require(_0xed8e('0x5'))(_0xed8e('0x6'));var config=require(_0xed8e('0x7'));var jayson=require(_0xed8e('0x8'));var client=jayson[_0xed8e('0x9')][_0xed8e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45faa4,_0x34794b,_0x97f293){return new BPromise(function(_0x464717,_0x8a6d03){return client[_0xed8e('0xb')](_0x45faa4,_0x97f293)['then'](function(_0xea62f){logger[_0xed8e('0xc')](_0xed8e('0xd'),_0x34794b,_0xed8e('0xe'));logger['debug'](_0xed8e('0xf'),_0x34794b,_0xed8e('0xe'),JSON[_0xed8e('0x10')](_0xea62f));if(_0xea62f[_0xed8e('0x11')]){if(_0xea62f[_0xed8e('0x11')][_0xed8e('0x12')]===0x1f4){logger[_0xed8e('0x11')](_0xed8e('0xd'),_0x34794b,_0xea62f['error']['message']);return _0x8a6d03(_0xea62f[_0xed8e('0x11')][_0xed8e('0x13')]);}logger['error'](_0xed8e('0xd'),_0x34794b,_0xea62f[_0xed8e('0x11')][_0xed8e('0x13')]);return _0x464717(_0xea62f[_0xed8e('0x11')][_0xed8e('0x13')]);}else{logger[_0xed8e('0xc')]('CmCompany,\x20%s,\x20%s',_0x34794b,_0xed8e('0xe'));_0x464717(_0xea62f[_0xed8e('0x14')][_0xed8e('0x13')]);}})['catch'](function(_0x1a2649){logger[_0xed8e('0x11')](_0xed8e('0xd'),_0x34794b,_0x1a2649);_0x8a6d03(_0x1a2649);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index adc5ee2..7fef846 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 _0xf2e3=['describe','/:id','show','/:id/contacts','getContacts','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated'];(function(_0x47d18a,_0xd53074){var _0x130c43=function(_0x380f11){while(--_0x380f11){_0x47d18a['push'](_0x47d18a['shift']());}};_0x130c43(++_0xd53074);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xf2e3[_0x243b59];return _0x3e1676;};'use strict';var multer=require(_0x3f2e('0x0'));var util=require('util');var path=require(_0x3f2e('0x1'));var timeout=require(_0x3f2e('0x2'));var express=require(_0x3f2e('0x3'));var router=express[_0x3f2e('0x4')]();var auth=require(_0x3f2e('0x5'));var interaction=require(_0x3f2e('0x6'));var config=require(_0x3f2e('0x7'));var controller=require(_0x3f2e('0x8'));router[_0x3f2e('0x9')]('/',auth['isAuthenticated'](),controller[_0x3f2e('0xa')]);router[_0x3f2e('0x9')](_0x3f2e('0xb'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0xd')]);router[_0x3f2e('0x9')](_0x3f2e('0xe'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0xf')]);router[_0x3f2e('0x9')](_0x3f2e('0x10'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0x11')]);router[_0x3f2e('0x12')]('/',auth[_0x3f2e('0xc')](),controller[_0x3f2e('0x13')]);router[_0x3f2e('0x12')](_0x3f2e('0x10'),auth[_0x3f2e('0xc')](),controller['addContacts']);router[_0x3f2e('0x14')](_0x3f2e('0xe'),auth['isAuthenticated'](),controller[_0x3f2e('0x15')]);router[_0x3f2e('0x16')](_0x3f2e('0xe'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0x17')]);module['exports']=router; \ No newline at end of file +var _0x3a6d=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','create','post','update','delete','destroy'];(function(_0x43e7a6,_0x8dc101){var _0x3a1620=function(_0x1e22b3){while(--_0x1e22b3){_0x43e7a6['push'](_0x43e7a6['shift']());}};_0x3a1620(++_0x8dc101);}(_0x3a6d,0x143));var _0xd3a6=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x3a6d[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var path=require('path');var timeout=require(_0xd3a6('0x2'));var express=require(_0xd3a6('0x3'));var router=express[_0xd3a6('0x4')]();var auth=require(_0xd3a6('0x5'));var interaction=require(_0xd3a6('0x6'));var config=require('../../config/environment');var controller=require(_0xd3a6('0x7'));router[_0xd3a6('0x8')]('/',auth[_0xd3a6('0x9')](),controller[_0xd3a6('0xa')]);router[_0xd3a6('0x8')](_0xd3a6('0xb'),auth['isAuthenticated'](),controller[_0xd3a6('0xc')]);router[_0xd3a6('0x8')](_0xd3a6('0xd'),auth[_0xd3a6('0x9')](),controller[_0xd3a6('0xe')]);router[_0xd3a6('0x8')](_0xd3a6('0xf'),auth[_0xd3a6('0x9')](),controller[_0xd3a6('0x10')]);router['post']('/',auth[_0xd3a6('0x9')](),controller[_0xd3a6('0x11')]);router[_0xd3a6('0x12')](_0xd3a6('0xf'),auth[_0xd3a6('0x9')](),controller['addContacts']);router['put']('/:id',auth[_0xd3a6('0x9')](),controller[_0xd3a6('0x13')]);router[_0xd3a6('0x14')](_0xd3a6('0xd'),auth[_0xd3a6('0x9')](),controller[_0xd3a6('0x15')]);module[_0xd3a6('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index f3e88ac..1bc195b 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 _0x8ec4=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x8ec4,0x18b));var _0x48ec=function(_0x11b24b,_0x224e06){_0x11b24b=_0x11b24b-0x0;var _0x10ba7b=_0x8ec4[_0x11b24b];return _0x10ba7b;};'use strict';var _=require(_0x48ec('0x0'));var Sequelize=require(_0x48ec('0x1'));module[_0x48ec('0x2')]={'firstName':{'type':Sequelize[_0x48ec('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x48ec('0x3')]},'street':{'type':Sequelize[_0x48ec('0x3')]},'postalCode':{'type':Sequelize[_0x48ec('0x3')]},'city':{'type':Sequelize[_0x48ec('0x3')]},'country':{'type':Sequelize[_0x48ec('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x48ec('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x48ec('0x3')]},'fax':{'type':Sequelize[_0x48ec('0x3')]},'email':{'type':Sequelize[_0x48ec('0x3')]},'url':{'type':Sequelize[_0x48ec('0x3')]},'facebook':{'type':Sequelize[_0x48ec('0x3')]},'fb_data':{'type':Sequelize[_0x48ec('0x3')]},'twitter':{'type':Sequelize[_0x48ec('0x3')]},'skype':{'type':Sequelize[_0x48ec('0x3')]},'teams':{'type':Sequelize[_0x48ec('0x3')]},'viber':{'type':Sequelize[_0x48ec('0x3')]},'line':{'type':Sequelize[_0x48ec('0x3')]},'wechat':{'type':Sequelize[_0x48ec('0x3')]},'telegram':{'type':Sequelize[_0x48ec('0x3')]},'UserId':{'type':Sequelize[_0x48ec('0x5')]},'priority':{'type':Sequelize[_0x48ec('0x5')](0x2)[_0x48ec('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x48ec('0x7')],'defaultValue':Sequelize[_0x48ec('0x8')]}}; \ No newline at end of file +var _0x48cb=['INTEGER','UNSIGNED','DATE','NOW','sequelize','exports','STRING','TEXT'];(function(_0x29f438,_0x1f8613){var _0x2cbba4=function(_0x1589cd){while(--_0x1589cd){_0x29f438['push'](_0x29f438['shift']());}};_0x2cbba4(++_0x1f8613);}(_0x48cb,0x124));var _0xb48c=function(_0x4452f1,_0x5ad396){_0x4452f1=_0x4452f1-0x0;var _0x6cedd0=_0x48cb[_0x4452f1];return _0x6cedd0;};'use strict';var _=require('lodash');var Sequelize=require(_0xb48c('0x0'));module[_0xb48c('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xb48c('0x2')]},'street':{'type':Sequelize[_0xb48c('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xb48c('0x2')]},'country':{'type':Sequelize[_0xb48c('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb48c('0x3')]},'phone':{'type':Sequelize[_0xb48c('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xb48c('0x2')]},'email':{'type':Sequelize[_0xb48c('0x2')]},'url':{'type':Sequelize[_0xb48c('0x2')]},'facebook':{'type':Sequelize[_0xb48c('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xb48c('0x2')]},'skype':{'type':Sequelize[_0xb48c('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xb48c('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xb48c('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xb48c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xb48c('0x6')],'defaultValue':Sequelize[_0xb48c('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 0bd3534..c7cbd69 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 _0x441b=['exit','error\x20child\x20process','html-pdf','zip-dir','moment','bluebird','mustache','util','path','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','index','CmContact','describe','keys','length','startsWith','cf_','push','findOne','trimStart','all','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','name','from','tools_tags','select','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','sqlOperator','conditions','find','Tag','value','split','map','forEach','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','text','start','isNil','Contact','isEmpty','ListId','\x20=\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','t.id\x20IN\x20?','resolve','user','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','c.id','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.deletedAt','TagIds','Tags','catch','params','tags','columnName','CmCustomField','findAll','custom','values','merge','body','get','join','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','each','duplicates','$or','findOrCreate','spread','error','show','color','format','cf_%d','omit','pickBy','table','id\x20=\x20?','toParam','phone','getTags','rawAttributes','options','setTags','getHoppers','ContactId','includeAll','include','rows','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','send','createReadStream','parse','meta','binding','stringify','message'];(function(_0x189ce6,_0x4c0280){var _0x26a196=function(_0x53855b){while(--_0x53855b){_0x189ce6['push'](_0x189ce6['shift']());}};_0x26a196(++_0x4c0280);}(_0x441b,0x1d4));var _0xb441=function(_0x5ae0bf,_0x5017a9){_0x5ae0bf=_0x5ae0bf-0x0;var _0x39ce79=_0x441b[_0x5ae0bf];return _0x39ce79;};'use strict';var pdf=require(_0xb441('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb441('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb441('0x2'));var BPromise=require(_0xb441('0x3'));var Mustache=require(_0xb441('0x4'));var util=require(_0xb441('0x5'));var path=require(_0xb441('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb441('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb441('0x8'));var crypto=require(_0xb441('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb441('0xa'));var toCsv=require(_0xb441('0xb'));var querystring=require(_0xb441('0xc'));var Papa=require(_0xb441('0xd'));var Redis=require(_0xb441('0xe'));var authService=require(_0xb441('0xf'));var qs=require(_0xb441('0x10'));var as=require(_0xb441('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb441('0x12'))(_0xb441('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb441('0x14'))['db'];config[_0xb441('0x15')]=_['defaults'](config['redis'],{'host':_0xb441('0x16'),'port':0x18eb});var socket=require(_0xb441('0x17'))(new Redis(config[_0xb441('0x15')]));require(_0xb441('0x18'))[_0xb441('0x19')](socket);function respondWithStatusCode(_0x5b8fb8,_0x46ef68){_0x46ef68=_0x46ef68||0xcc;return function(_0x4c006f){if(_0x4c006f){return _0x5b8fb8[_0xb441('0x1a')](_0x46ef68);}return _0x5b8fb8[_0xb441('0x1b')](_0x46ef68)[_0xb441('0x1c')]();};}function respondWithResult(_0x2130aa,_0x3acff5){_0x3acff5=_0x3acff5||0xc8;return function(_0x10e662){if(_0x10e662){return _0x2130aa[_0xb441('0x1b')](_0x3acff5)[_0xb441('0x1d')](_0x10e662);}};}function respondWithFilteredResult(_0x5de5f6,_0x7f6549){return function(_0x36ad3b){if(_0x36ad3b){var _0x3ebaf=_0x36ad3b[_0xb441('0x1e')],_0x5cd1eb=_0x7f6549[_0xb441('0x1f')],_0x5133e9=_0x7f6549['offset']+_0x7f6549['limit'],_0x2927d3;if(_0x5133e9>=_0x3ebaf){_0x5133e9=_0x3ebaf;_0x2927d3=0xc8;}else{_0x2927d3=0xce;}_0x5de5f6['status'](_0x2927d3);return _0x5de5f6[_0xb441('0x20')](_0xb441('0x21'),_0x5cd1eb+'-'+_0x5133e9+'/'+_0x3ebaf)[_0xb441('0x1d')](_0x36ad3b);}return null;};}function patchUpdates(_0x38a58e){return function(_0x39a655){try{jsonpatch[_0xb441('0x22')](_0x39a655,_0x38a58e,!![]);}catch(_0x43f236){return BPromise[_0xb441('0x23')](_0x43f236);}return _0x39a655[_0xb441('0x24')]();};}function saveUpdates(_0x23002c,_0x41584a){return function(_0x15aacd){if(_0x15aacd){return _0x15aacd['update'](_0x23002c)[_0xb441('0x25')](function(_0x23f3b2){return _0x23f3b2;});}return null;};}function removeEntity(_0x207781,_0xbe6a7e){return function(_0x379e62){if(_0x379e62){return _0x379e62[_0xb441('0x26')]()[_0xb441('0x25')](function(){_0x207781[_0xb441('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48d894,_0x2c0bbf){return function(_0x4868c8){if(!_0x4868c8){_0x48d894[_0xb441('0x1a')](0x194);}return _0x4868c8;};}function handleError(_0x4dddf8,_0x362e08){_0x362e08=_0x362e08||0x1f4;return function(_0x5872f7){logger['error'](_0x5872f7[_0xb441('0x27')]);if(_0x5872f7['name']){delete _0x5872f7['name'];}_0x4dddf8[_0xb441('0x1b')](_0x362e08)['send'](_0x5872f7);};}exports[_0xb441('0x28')]=function(_0x45fd71,_0x47be9e){var _0x3a4787={},_0x42485e={},_0x250480={'count':0x0,'rows':[]};return db[_0xb441('0x29')][_0xb441('0x2a')]()[_0xb441('0x25')](function(_0x31e432){var _0x5b9586=[];for(var _0x37e14c=0x0;_0x37e14c0x1){_0x51b8b3['or'](_0xb441('0x6c'),qs[_0xb441('0x6d')](_0x5abbc1),null);}else{if(qs[_0xb441('0x6e')](_0x5abbc1)){_0x51b8b3['or'](_0xb441('0x6f'),_0x5abbc1+'%');_0x51b8b3['or']('c.phone\x20LIKE\x20?',_0x5abbc1+'%');_0x51b8b3['or']('c.mobile\x20LIKE\x20?',_0x5abbc1+'%');_0x51b8b3['or']('c.fax\x20LIKE\x20?',_0x5abbc1+'%');}else if(qs[_0xb441('0x70')](_0x5abbc1)){_0x51b8b3['or'](_0xb441('0x71'),_0x5abbc1+'%');}else{_0x51b8b3['or']('c.firstName\x20LIKE\x20?','%'+_0x5abbc1+'%');_0x51b8b3['or'](_0xb441('0x72'),'%'+_0x5abbc1+'%');_0x51b8b3['or'](_0xb441('0x71'),'%'+_0x5abbc1+'%');}}}}_0x1d73a2[_0xb441('0x40')](_0x51b8b3);_0x1d73a2[_0xb441('0x73')]('c.id');var _0x5a98a1={'type':db[_0xb441('0x74')][_0xb441('0x75')][_0xb441('0x76')],'raw':!![]};var _0x664eb3=_0x1d73a2['clone']()['field']('c.id');if(_0x3a4787[_0xb441('0x3e')]){_0x3a4787[_0xb441('0x3e')][_0xb441('0x56')](function(_0x27023a){_0x1d73a2[_0xb441('0x3e')]('c.'+_0x27023a[0x0],_0x27023a[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x263bb1)){_0x1d73a2['having'](_0x206333);_0x664eb3['where'](_0xb441('0x77'),_0x263bb1);}BPromise[_0xb441('0x78')]()[_0xb441('0x25')](function(){if(_0x643ad8&&!_['some'](_0x643ad8[_0xb441('0x50')],['field','User'])){return _0x45fd71[_0xb441('0x79')][_0xb441('0x7a')]({'attributes':['id'],'raw':!![]})[_0xb441('0x25')](function(_0x4c5417){if(_['isEmpty'](_0x4c5417)){_0x664eb3[_0xb441('0x40')](_0xb441('0x7b'));_0x1d73a2[_0xb441('0x40')]('c.ListId\x20IS\x20NULL');}else{_0x664eb3['where'](_0xb441('0x7c'),_['map'](_0x4c5417,'id'));_0x1d73a2[_0xb441('0x40')](_0xb441('0x7c'),_[_0xb441('0x55')](_0x4c5417,'id'));}});}else{return;}})[_0xb441('0x25')](function(){db[_0xb441('0x7d')][_0xb441('0x36')](_0x664eb3[_0xb441('0x7e')](),_0x5a98a1)['then'](function(_0x391fa4){_0x250480[_0xb441('0x1e')]=_0x391fa4[_0xb441('0x2c')];if(_0x250480['count']===0x0)return[];return db['sequelize'][_0xb441('0x36')](_0xac6c17[_0xb441('0x7e')](),_0x5a98a1);})['then'](function(_0x54a5cd){_0x124d17=_['keyBy'](_0x54a5cd,'id');_0x5a98a1=_['merge'](_0x5a98a1,{'model':db[_0xb441('0x29')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x45fd71[_0xb441('0x36')][_0xb441('0x3a')]){_0x3a4787['attributes'][_0xb441('0x56')](function(_0x8316c4){_0x1d73a2[_0xb441('0x42')]('c.'+_0x8316c4);});}else{_0x1d73a2['field'](_0xb441('0x7f'));_0x1d73a2[_0xb441('0x42')](_0xb441('0x80'));_0x1d73a2[_0xb441('0x42')](_0xb441('0x81'));_0x1d73a2[_0xb441('0x42')](_0xb441('0x82'));_0x1d73a2['field'](_0xb441('0x83'));_0x1d73a2['field'](_0xb441('0x84'));_0x1d73a2[_0xb441('0x42')](_0xb441('0x85'));_0x1d73a2[_0xb441('0x42')]('c.ListId');_0x1d73a2[_0xb441('0x42')](_0xb441('0x86'));_0x1d73a2['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xb441('0x87'));}if(_0x3a4787[_0xb441('0x3d')])_0x1d73a2['limit'](_0x3a4787[_0xb441('0x3d')]);if(_0x3a4787['offset'])_0x1d73a2['offset'](_0x3a4787['offset']);return db[_0xb441('0x7d')]['query'](_0x1d73a2[_0xb441('0x7e')](),_0x5a98a1);})[_0xb441('0x25')](function(_0x358cc9){_0x358cc9[_0xb441('0x56')](function(_0xf7227){if(_0xf7227[_0xb441('0x87')]){_0xf7227['Tags']=[];_0xf7227[_0xb441('0x87')][_0xb441('0x54')](',')['forEach'](function(_0x479c92){_0xf7227[_0xb441('0x88')][_0xb441('0x2f')](_0x124d17[_0x479c92]);});}delete _0xf7227['TagIds'];});_0x250480['rows']=_0x358cc9;return _0x250480;})[_0xb441('0x25')](respondWithFilteredResult(_0x47be9e,_0x3a4787));});})[_0xb441('0x89')](handleError(_0x47be9e,null));};exports[_0xb441('0x26')]=function(_0x51cbba,_0xffffde){return db[_0xb441('0x29')][_0xb441('0x51')]({'where':{'id':_0x51cbba[_0xb441('0x8a')]['id']}})[_0xb441('0x25')](handleEntityNotFound(_0xffffde,null))[_0xb441('0x25')](removeEntity(_0xffffde,null))['catch'](handleError(_0xffffde,null));};exports[_0xb441('0x2a')]=function(_0x5bf388,_0x58536f){return db[_0xb441('0x29')][_0xb441('0x2a')]()['then'](function(_0x237a66){delete _0x237a66[_0xb441('0x8b')];for(var _0x24e928=0x0;_0x24e928=_0x1278d5){_0x205f4f=_0x1278d5;_0x2923ee=0xc8;}else{_0x2923ee=0xce;}_0x58360a[_0x58ef('0x1e')](_0x2923ee);return _0x58360a[_0x58ef('0x23')]('Content-Range',_0x2df822+'-'+_0x205f4f+'/'+_0x1278d5)[_0x58ef('0x1f')](_0x563222);}return null;};}function patchUpdates(_0x20fd49){return function(_0x55c40f){try{jsonpatch[_0x58ef('0x24')](_0x55c40f,_0x20fd49,!![]);}catch(_0x3dca3d){return BPromise[_0x58ef('0x25')](_0x3dca3d);}return _0x55c40f[_0x58ef('0x26')]();};}function saveUpdates(_0x83ec8a,_0x53176f){return function(_0x446149){if(_0x446149){return _0x446149[_0x58ef('0x27')](_0x83ec8a)[_0x58ef('0x28')](function(_0x2ccc73){return _0x2ccc73;});}return null;};}function removeEntity(_0x290119,_0xce4bb3){return function(_0x338b08){if(_0x338b08){return _0x338b08[_0x58ef('0x29')]()[_0x58ef('0x28')](function(){_0x290119[_0x58ef('0x1e')](0xcc)[_0x58ef('0x2a')]();});}};}function handleEntityNotFound(_0x35743c,_0x110742){return function(_0xaf0d2f){if(!_0xaf0d2f){_0x35743c[_0x58ef('0x1d')](0x194);}return _0xaf0d2f;};}function handleError(_0xbf3ce1,_0x225932){_0x225932=_0x225932||0x1f4;return function(_0xcdd320){logger[_0x58ef('0x2b')](_0xcdd320[_0x58ef('0x2c')]);if(_0xcdd320[_0x58ef('0x2d')]){delete _0xcdd320['name'];}_0xbf3ce1[_0x58ef('0x1e')](_0x225932)['send'](_0xcdd320);};}exports[_0x58ef('0x2e')]=function(_0x5a62d9,_0x199b78){var _0x178dd0={},_0x22ada0={},_0x195406={'count':0x0,'rows':[]};return db[_0x58ef('0x2f')][_0x58ef('0x30')]()[_0x58ef('0x28')](function(_0x456a77){var _0x43f955=[];for(var _0x53b154=0x0;_0x53b1540x1){_0x25c46c['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x58ef('0x70')](_0x47d649),null);}else{if(qs[_0x58ef('0x71')](_0x47d649)){_0x25c46c['or'](_0x58ef('0x72'),_0x47d649+'%');_0x25c46c['or'](_0x58ef('0x73'),_0x47d649+'%');_0x25c46c['or'](_0x58ef('0x74'),_0x47d649+'%');_0x25c46c['or']('c.fax\x20LIKE\x20?',_0x47d649+'%');}else if(qs[_0x58ef('0x75')](_0x47d649)){_0x25c46c['or'](_0x58ef('0x76'),_0x47d649+'%');}else{_0x25c46c['or'](_0x58ef('0x77'),'%'+_0x47d649+'%');_0x25c46c['or'](_0x58ef('0x78'),'%'+_0x47d649+'%');_0x25c46c['or']('c.email\x20LIKE\x20?','%'+_0x47d649+'%');}}}}_0x174b8c[_0x58ef('0x44')](_0x25c46c);_0x174b8c[_0x58ef('0x79')](_0x58ef('0x7a'));var _0x396da5={'type':db['Sequelize'][_0x58ef('0x7b')][_0x58ef('0x7c')],'raw':!![]};var _0x47e202=_0x174b8c[_0x58ef('0x7d')]()[_0x58ef('0x46')](_0x58ef('0x7a'));if(_0x178dd0['order']){_0x178dd0['order']['forEach'](function(_0x4c08aa){_0x174b8c[_0x58ef('0x42')]('c.'+_0x4c08aa[0x0],_0x4c08aa[0x1]===_0x58ef('0x7e')?![]:!![]);});}if(!_['isEmpty'](_0x22314f)){_0x174b8c['having'](_0x52ce9c);_0x47e202['where'](_0x58ef('0x7f'),_0x22314f);}BPromise[_0x58ef('0x80')]()[_0x58ef('0x28')](function(){if(_0x1c33af&&!_[_0x58ef('0x81')](_0x1c33af['conditions'],[_0x58ef('0x46'),_0x58ef('0x82')])){return _0x5a62d9['user']['getLists']({'attributes':['id'],'raw':!![]})[_0x58ef('0x28')](function(_0xd7273d){if(_[_0x58ef('0x67')](_0xd7273d)){_0x47e202['where']('c.ListId\x20IS\x20NULL');_0x174b8c[_0x58ef('0x44')](_0x58ef('0x83'));}else{_0x47e202[_0x58ef('0x44')](_0x58ef('0x69'),_[_0x58ef('0x5a')](_0xd7273d,'id'));_0x174b8c[_0x58ef('0x44')](_0x58ef('0x69'),_[_0x58ef('0x5a')](_0xd7273d,'id'));}});}else{return;}})[_0x58ef('0x28')](function(){db['sequelize'][_0x58ef('0x3b')](_0x47e202[_0x58ef('0x84')](),_0x396da5)[_0x58ef('0x28')](function(_0x1776ee){_0x195406[_0x58ef('0x20')]=_0x1776ee[_0x58ef('0x40')];if(_0x195406[_0x58ef('0x20')]===0x0)return[];return db[_0x58ef('0x85')][_0x58ef('0x3b')](_0x5d8236['toString'](),_0x396da5);})[_0x58ef('0x28')](function(_0x579bd0){_0x1a234c=_['keyBy'](_0x579bd0,'id');_0x396da5=_[_0x58ef('0x86')](_0x396da5,{'model':db[_0x58ef('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5a62d9[_0x58ef('0x3b')]['fields']){_0x178dd0[_0x58ef('0x3f')]['forEach'](function(_0x424ca0){_0x174b8c['field']('c.'+_0x424ca0);});}else{_0x174b8c[_0x58ef('0x46')](_0x58ef('0x7a'));_0x174b8c[_0x58ef('0x46')](_0x58ef('0x87'));_0x174b8c[_0x58ef('0x46')](_0x58ef('0x88'));_0x174b8c[_0x58ef('0x46')]('c.phone');_0x174b8c['field'](_0x58ef('0x89'));_0x174b8c['field'](_0x58ef('0x8a'));_0x174b8c['field'](_0x58ef('0x8b'));_0x174b8c[_0x58ef('0x46')]('c.ListId');_0x174b8c[_0x58ef('0x46')](_0x58ef('0x8c'));_0x174b8c[_0x58ef('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x58ef('0x8d'));}if(_0x178dd0[_0x58ef('0x22')])_0x174b8c[_0x58ef('0x22')](_0x178dd0['limit']);if(_0x178dd0['offset'])_0x174b8c[_0x58ef('0x21')](_0x178dd0[_0x58ef('0x21')]);return db[_0x58ef('0x85')][_0x58ef('0x3b')](_0x174b8c['toString'](),_0x396da5);})[_0x58ef('0x28')](function(_0x2bd11d){_0x2bd11d[_0x58ef('0x5b')](function(_0x53a208){if(_0x53a208[_0x58ef('0x8d')]){_0x53a208['Tags']=[];_0x53a208[_0x58ef('0x8d')][_0x58ef('0x59')](',')[_0x58ef('0x5b')](function(_0x17f998){_0x53a208[_0x58ef('0x8e')]['push'](_0x1a234c[_0x17f998]);});}delete _0x53a208[_0x58ef('0x8d')];});_0x195406[_0x58ef('0x8f')]=_0x2bd11d;return _0x195406;})[_0x58ef('0x28')](respondWithFilteredResult(_0x199b78,_0x178dd0));});})[_0x58ef('0x90')](handleError(_0x199b78,null));};exports['destroy']=function(_0xfa935c,_0x46ca88){return db[_0x58ef('0x2f')][_0x58ef('0x56')]({'where':{'id':_0xfa935c['params']['id']}})['then'](handleEntityNotFound(_0x46ca88,null))[_0x58ef('0x28')](removeEntity(_0x46ca88,null))[_0x58ef('0x90')](handleError(_0x46ca88,null));};exports[_0x58ef('0x30')]=function(_0x4061dd,_0x2e2b1e){return db[_0x58ef('0x2f')]['describe']()[_0x58ef('0x28')](function(_0x1ad543){delete _0x1ad543['tags'];for(var _0x3a2263=0x0;_0x3a2263{}\s\\|]/g,'-');_0x177ee1(null,util['format'](_0x43e7('0x1c'),path[_0x43e7('0x1d')](_0x191dd5[_0x43e7('0x1a')],path[_0x43e7('0x1e')](_0x191dd5[_0x43e7('0x1a')])),Date[_0x43e7('0x1f')](),path['extname'](_0x191dd5[_0x43e7('0x1a')])));}})});router['post']('/csv',upload[_0x43e7('0x20')](_0x43e7('0x21')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x43e7('0x16')]({'destination':function(_0x4ca5cf,_0x326dab,_0x5c5e67){_0x5c5e67(null,path[_0x43e7('0x17')](config[_0x43e7('0x18')],_0x43e7('0x19')));},'filename':function(_0x405f85,_0x51f4d7,_0x52b7b3){_0x51f4d7[_0x43e7('0x1a')]=_0x51f4d7['originalname'][_0x43e7('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52b7b3(null,util[_0x43e7('0x22')](_0x43e7('0x1c'),path[_0x43e7('0x1d')](_0x51f4d7['originalname'],path[_0x43e7('0x1e')](_0x51f4d7[_0x43e7('0x1a')])),Date[_0x43e7('0x1f')](),path[_0x43e7('0x1e')](_0x51f4d7[_0x43e7('0x1a')])));}})});router[_0x43e7('0x12')](_0x43e7('0x23'),upload[_0x43e7('0x20')](_0x43e7('0x21')),controller[_0x43e7('0x24')]);router[_0x43e7('0x12')](_0x43e7('0x25'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x26')]);router['put'](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x27')]);router[_0x43e7('0x28')](_0x43e7('0xa'),auth['isAuthenticated'](),controller[_0x43e7('0x29')]);module[_0x43e7('0x2a')]=router; \ No newline at end of file +var _0x0e85=['connect-timeout','express','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','getHopperHistories','getHopperFinals','/:id/jscripty_sessions','post','/merge','create','/create_many','bulkCreate','setTags','diskStorage','join','server/files/tmp','originalname','replace','%s-%s%s','basename','extname','file','uploadCsv','root','format','now','/upload','single','/upload/:id','put','exports','multer','util'];(function(_0x5e3f16,_0x442a18){var _0x2fd01c=function(_0x37eb87){while(--_0x37eb87){_0x5e3f16['push'](_0x5e3f16['shift']());}};_0x2fd01c(++_0x442a18);}(_0x0e85,0x7c));var _0x50e8=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x0e85[_0xb24a3e];return _0x4038d7;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x50e8('0x4'));var controller=require('./cmContact.controller');router[_0x50e8('0x5')]('/',auth[_0x50e8('0x6')](),controller[_0x50e8('0x7')]);router[_0x50e8('0x5')]('/describe',auth[_0x50e8('0x6')](),controller[_0x50e8('0x8')]);router[_0x50e8('0x5')](_0x50e8('0x9'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xa')]);router['get'](_0x50e8('0xb'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xc')]);router[_0x50e8('0x5')](_0x50e8('0xd'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xe')]);router[_0x50e8('0x5')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x50e8('0xf')]);router[_0x50e8('0x5')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x50e8('0x10')]);router[_0x50e8('0x5')](_0x50e8('0x11'),auth[_0x50e8('0x6')](),controller['getJscriptySessions']);router[_0x50e8('0x12')](_0x50e8('0x13'),auth[_0x50e8('0x6')](),controller['merge']);router['post']('/',auth[_0x50e8('0x6')](),controller[_0x50e8('0x14')]);router[_0x50e8('0x12')](_0x50e8('0x15'),auth[_0x50e8('0x6')](),controller[_0x50e8('0x16')]);router['post']('/:id/tags',auth[_0x50e8('0x6')](),controller[_0x50e8('0x17')]);var upload=multer({'storage':multer[_0x50e8('0x18')]({'destination':function(_0x45ce11,_0x5dae4e,_0x90c54c){_0x90c54c(null,path[_0x50e8('0x19')](config['root'],_0x50e8('0x1a')));},'filename':function(_0x55997c,_0x4d2318,_0xe04a5c){_0x4d2318[_0x50e8('0x1b')]=_0x4d2318[_0x50e8('0x1b')][_0x50e8('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xe04a5c(null,util['format'](_0x50e8('0x1d'),path[_0x50e8('0x1e')](_0x4d2318['originalname'],path[_0x50e8('0x1f')](_0x4d2318[_0x50e8('0x1b')])),Date['now'](),path[_0x50e8('0x1f')](_0x4d2318[_0x50e8('0x1b')])));}})});router['post']('/csv',upload['single'](_0x50e8('0x20')),controller[_0x50e8('0x21')]);var upload=multer({'storage':multer[_0x50e8('0x18')]({'destination':function(_0x371a1f,_0xc2f832,_0x13b6e9){_0x13b6e9(null,path['join'](config[_0x50e8('0x22')],_0x50e8('0x1a')));},'filename':function(_0x4b3a09,_0x177201,_0x2bc8d8){_0x177201[_0x50e8('0x1b')]=_0x177201[_0x50e8('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2bc8d8(null,util[_0x50e8('0x23')]('%s-%s%s',path[_0x50e8('0x1e')](_0x177201[_0x50e8('0x1b')],path[_0x50e8('0x1f')](_0x177201['originalname'])),Date[_0x50e8('0x24')](),path[_0x50e8('0x1f')](_0x177201[_0x50e8('0x1b')])));}})});router[_0x50e8('0x12')](_0x50e8('0x25'),upload[_0x50e8('0x26')](_0x50e8('0x20')),controller['upload']);router[_0x50e8('0x12')](_0x50e8('0x27'),auth['isAuthenticated'](),controller['import']);router[_0x50e8('0x28')](_0x50e8('0x9'),auth[_0x50e8('0x6')](),controller['update']);router['delete'](_0x50e8('0x9'),auth[_0x50e8('0x6')](),controller['destroy']);module[_0x50e8('0x29')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 9c94ee8..31145e6 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 _0xf95c=['exports','VIRTUAL','alias','getDataValue','name','TEXT','long','type','parse','values','isArray','setDataValue','stringify','sequelize','lodash'];(function(_0x5b0a4a,_0x11a985){var _0x2ce5c6=function(_0x4b3a55){while(--_0x4b3a55){_0x5b0a4a['push'](_0x5b0a4a['shift']());}};_0x2ce5c6(++_0x11a985);}(_0xf95c,0xc1));var _0xcf95=function(_0x4cf0f7,_0x32b087){_0x4cf0f7=_0x4cf0f7-0x0;var _0x46d03b=_0xf95c[_0x4cf0f7];return _0x46d03b;};'use strict';var Sequelize=require(_0xcf95('0x0'));var _=require(_0xcf95('0x1'));module[_0xcf95('0x2')]={'name':{'type':Sequelize[_0xcf95('0x3')],'get':function(_0x2321f3){return this['getDataValue'](_0xcf95('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x506fde){this['setDataValue'](_0xcf95('0x4'),_0x506fde?_0x506fde:this[_0xcf95('0x5')](_0xcf95('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xcf95('0x7')](_0xcf95('0x8')),'get':function(){if(this[_0xcf95('0x5')](_0xcf95('0x9'))==='select'){return JSON[_0xcf95('0xa')](this[_0xcf95('0x5')](_0xcf95('0xb')));}else{return this[_0xcf95('0x5')]('values');}},'set':function(_0x227a8a){if(Array[_0xcf95('0xc')](_0x227a8a)){this[_0xcf95('0xd')]('values',JSON[_0xcf95('0xe')](_0x227a8a));}else{this[_0xcf95('0xd')](_0xcf95('0xb'),_0x227a8a);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x79a3=['getDataValue','alias','STRING','setDataValue','TEXT','long','type','values','isArray','stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL'];(function(_0x52acf9,_0x325d20){var _0x11530c=function(_0x78af62){while(--_0x78af62){_0x52acf9['push'](_0x52acf9['shift']());}};_0x11530c(++_0x325d20);}(_0x79a3,0x10a));var _0x379a=function(_0x421d6f,_0x304e33){_0x421d6f=_0x421d6f-0x0;var _0x5b3fd2=_0x79a3[_0x421d6f];return _0x5b3fd2;};'use strict';var Sequelize=require(_0x379a('0x0'));var _=require(_0x379a('0x1'));module[_0x379a('0x2')]={'name':{'type':Sequelize[_0x379a('0x3')],'get':function(_0x1edc3){return this[_0x379a('0x4')](_0x379a('0x5'));}},'alias':{'type':Sequelize[_0x379a('0x6')],'allowNull':![],'set':function(_0x34e34a){this[_0x379a('0x7')](_0x379a('0x5'),_0x34e34a?_0x34e34a:this[_0x379a('0x4')]('name'));}},'type':{'type':Sequelize[_0x379a('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x379a('0x8')](_0x379a('0x9')),'get':function(){if(this[_0x379a('0x4')](_0x379a('0xa'))==='select'){return JSON['parse'](this[_0x379a('0x4')]('values'));}else{return this[_0x379a('0x4')](_0x379a('0xb'));}},'set':function(_0x506eba){if(Array[_0x379a('0xc')](_0x506eba)){this[_0x379a('0x7')](_0x379a('0xb'),JSON[_0x379a('0xd')](_0x506eba));}else{this[_0x379a('0x7')](_0x379a('0xb'),_0x506eba);}}},'required':{'type':Sequelize[_0x379a('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index c7e24c1..e9ee1e2 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 _0x6a05=['destroy','create','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','cm_contacts','cf_%d','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','key','model','differenceBy','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','options','CmCustomField','include','catch','show','merge','find','body','params'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0x6a05,0x153));var _0x56a0=function(_0x4032e3,_0x6d6449){_0x4032e3=_0x4032e3-0x0;var _0x34f51a=_0x6a05[_0x4032e3];return _0x34f51a;};'use strict';var pdf=require(_0x56a0('0x0'));var emlformat=require(_0x56a0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x56a0('0x2'));var rp=require(_0x56a0('0x3'));var moment=require(_0x56a0('0x4'));var BPromise=require(_0x56a0('0x5'));var Mustache=require('mustache');var util=require(_0x56a0('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x56a0('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x56a0('0x8'));var squel=require(_0x56a0('0x9'));var crypto=require(_0x56a0('0xa'));var jsforce=require(_0x56a0('0xb'));var deskjs=require(_0x56a0('0xc'));var toCsv=require(_0x56a0('0x7'));var querystring=require('querystring');var Papa=require(_0x56a0('0xd'));var Redis=require(_0x56a0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x56a0('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x56a0('0x10'))('api');var utils=require(_0x56a0('0x11'));var config=require(_0x56a0('0x12'));var db=require(_0x56a0('0x13'))['db'];function respondWithStatusCode(_0x1f8000,_0x477eb1){_0x477eb1=_0x477eb1||0xcc;return function(_0x2cdde5){if(_0x2cdde5){return _0x1f8000[_0x56a0('0x14')](_0x477eb1);}return _0x1f8000[_0x56a0('0x15')](_0x477eb1)[_0x56a0('0x16')]();};}function respondWithResult(_0x151177,_0x14d94f){_0x14d94f=_0x14d94f||0xc8;return function(_0x43f38d){if(_0x43f38d){return _0x151177[_0x56a0('0x15')](_0x14d94f)[_0x56a0('0x17')](_0x43f38d);}};}function respondWithFilteredResult(_0x47d065,_0x47efa5){return function(_0x700f18){if(_0x700f18){var _0x11102d=_0x700f18[_0x56a0('0x18')],_0x4f71d5=_0x47efa5[_0x56a0('0x19')],_0xefd0e2=_0x47efa5[_0x56a0('0x19')]+_0x47efa5[_0x56a0('0x1a')],_0x4d0ee6;if(_0xefd0e2>=_0x11102d){_0xefd0e2=_0x11102d;_0x4d0ee6=0xc8;}else{_0x4d0ee6=0xce;}_0x47d065[_0x56a0('0x15')](_0x4d0ee6);return _0x47d065[_0x56a0('0x1b')](_0x56a0('0x1c'),_0x4f71d5+'-'+_0xefd0e2+'/'+_0x11102d)[_0x56a0('0x17')](_0x700f18);}return null;};}function patchUpdates(_0xd039d3){return function(_0x33b18f){try{jsonpatch[_0x56a0('0x1d')](_0x33b18f,_0xd039d3,!![]);}catch(_0x47b2a2){return BPromise[_0x56a0('0x1e')](_0x47b2a2);}return _0x33b18f[_0x56a0('0x1f')]();};}function saveUpdates(_0x18268a,_0x55f5eb){return function(_0x88fcfa){if(_0x88fcfa){return _0x88fcfa[_0x56a0('0x20')](_0x18268a)[_0x56a0('0x21')](function(_0xd266d5){return _0xd266d5;});}return null;};}function removeEntity(_0x210fe8,_0x442293){return function(_0x287034){if(_0x287034){return _0x287034['destroy']()['then'](function(){_0x210fe8[_0x56a0('0x15')](0xcc)[_0x56a0('0x16')]();});}};}function handleEntityNotFound(_0x10cf8b,_0xfd208){return function(_0x5d1332){if(!_0x5d1332){_0x10cf8b[_0x56a0('0x14')](0x194);}return _0x5d1332;};}function handleError(_0xcf0f83,_0x37e470){_0x37e470=_0x37e470||0x1f4;return function(_0x5226bb){logger[_0x56a0('0x22')](_0x5226bb[_0x56a0('0x23')]);if(_0x5226bb['name']){delete _0x5226bb[_0x56a0('0x24')];}_0xcf0f83[_0x56a0('0x15')](_0x37e470)['send'](_0x5226bb);};}exports[_0x56a0('0x25')]=function(_0x195f16,_0x50ff05){var _0x2714f0={},_0xb20e32={},_0x26d51d={'count':0x0,'rows':[]};var _0x4e5985=_['map'](db['CmCustomField']['rawAttributes'],function(_0x16d46b){return{'name':_0x16d46b['fieldName'],'type':_0x16d46b['type'][_0x56a0('0x26')]};});_0xb20e32[_0x56a0('0x27')]=_[_0x56a0('0x28')](_[_0x56a0('0x29')](_0x4e5985,_0x56a0('0x24')),['name']);_0xb20e32['query']=_[_0x56a0('0x2a')](_0x195f16[_0x56a0('0x2b')]);_0xb20e32[_0x56a0('0x2c')]=_[_0x56a0('0x2d')](_0xb20e32[_0x56a0('0x27')],_0xb20e32[_0x56a0('0x2b')]);_0x2714f0[_0x56a0('0x2e')]=_['intersection'](_0xb20e32[_0x56a0('0x27')],qs[_0x56a0('0x2f')](_0x195f16[_0x56a0('0x2b')][_0x56a0('0x2f')]));_0x2714f0['attributes']=_0x2714f0[_0x56a0('0x2e')][_0x56a0('0x30')]?_0x2714f0[_0x56a0('0x2e')]:_0xb20e32['model'];if(!_0x195f16[_0x56a0('0x2b')][_0x56a0('0x31')](_0x56a0('0x32'))){_0x2714f0[_0x56a0('0x1a')]=qs['limit'](_0x195f16[_0x56a0('0x2b')]['limit']);_0x2714f0[_0x56a0('0x19')]=qs['offset'](_0x195f16['query'][_0x56a0('0x19')]);}_0x2714f0[_0x56a0('0x33')]=qs[_0x56a0('0x34')](_0x195f16[_0x56a0('0x2b')][_0x56a0('0x34')]);_0x2714f0[_0x56a0('0x35')]=qs['filters'](_['pick'](_0x195f16[_0x56a0('0x2b')],_0xb20e32[_0x56a0('0x2c')]));if(_0x195f16[_0x56a0('0x2b')][_0x56a0('0x36')]){_0x2714f0[_0x56a0('0x35')]=_['merge'](_0x2714f0[_0x56a0('0x35')],{'$or':_[_0x56a0('0x29')](_0x4e5985,function(_0x2ca9c1){if(_0x2ca9c1[_0x56a0('0x37')]!==_0x56a0('0x38')){var _0x47af7c={};_0x47af7c[_0x2ca9c1[_0x56a0('0x24')]]={'$like':'%'+_0x195f16[_0x56a0('0x2b')]['filter']+'%'};return _0x47af7c;}})});}_0x2714f0=_['merge']({},_0x2714f0,_0x195f16[_0x56a0('0x39')]);var _0x45a37b={'where':_0x2714f0[_0x56a0('0x35')]};return db[_0x56a0('0x3a')][_0x56a0('0x18')](_0x45a37b)[_0x56a0('0x21')](function(_0x132b09){_0x26d51d[_0x56a0('0x18')]=_0x132b09;if(_0x195f16['query']['includeAll']){_0x2714f0[_0x56a0('0x3b')]=[{'all':!![]}];}return db[_0x56a0('0x3a')]['findAll'](_0x2714f0);})[_0x56a0('0x21')](function(_0x232950){_0x26d51d['rows']=_0x232950;return _0x26d51d;})[_0x56a0('0x21')](respondWithFilteredResult(_0x50ff05,_0x2714f0))[_0x56a0('0x3c')](handleError(_0x50ff05,null));};exports[_0x56a0('0x3d')]=function(_0x505e82,_0x1c3fa0){var _0x252c00={'raw':!![],'where':{'id':_0x505e82['params']['id']}},_0xb1cb70={};_0xb1cb70[_0x56a0('0x27')]=_[_0x56a0('0x2a')](db[_0x56a0('0x3a')]['rawAttributes']);_0xb1cb70[_0x56a0('0x2b')]=_['keys'](_0x505e82[_0x56a0('0x2b')]);_0xb1cb70['filters']=_[_0x56a0('0x2d')](_0xb1cb70[_0x56a0('0x27')],_0xb1cb70[_0x56a0('0x2b')]);_0x252c00[_0x56a0('0x2e')]=_[_0x56a0('0x2d')](_0xb1cb70[_0x56a0('0x27')],qs[_0x56a0('0x2f')](_0x505e82[_0x56a0('0x2b')][_0x56a0('0x2f')]));_0x252c00[_0x56a0('0x2e')]=_0x252c00[_0x56a0('0x2e')][_0x56a0('0x30')]?_0x252c00['attributes']:_0xb1cb70[_0x56a0('0x27')];if(_0x505e82['query']['includeAll']){_0x252c00[_0x56a0('0x3b')]=[{'all':!![]}];}_0x252c00=_[_0x56a0('0x3e')]({},_0x252c00,_0x505e82['options']);return db[_0x56a0('0x3a')][_0x56a0('0x3f')](_0x252c00)[_0x56a0('0x21')](handleEntityNotFound(_0x1c3fa0,null))['then'](respondWithResult(_0x1c3fa0,null))[_0x56a0('0x3c')](handleError(_0x1c3fa0,null));};exports['update']=function(_0x4fb326,_0x110eef){if(_0x4fb326[_0x56a0('0x40')]['id']){delete _0x4fb326[_0x56a0('0x40')]['id'];}return db[_0x56a0('0x3a')][_0x56a0('0x3f')]({'where':{'id':_0x4fb326[_0x56a0('0x41')]['id']}})[_0x56a0('0x21')](handleEntityNotFound(_0x110eef,null))[_0x56a0('0x21')](saveUpdates(_0x4fb326[_0x56a0('0x40')],null))[_0x56a0('0x21')](respondWithResult(_0x110eef,null))['catch'](handleError(_0x110eef,null));};exports[_0x56a0('0x42')]=function(_0x377ee5,_0x1942e5){return db['CmCustomField'][_0x56a0('0x3f')]({'where':{'id':_0x377ee5[_0x56a0('0x41')]['id']}})['then'](handleEntityNotFound(_0x1942e5,null))[_0x56a0('0x21')](removeEntity(_0x1942e5,null))[_0x56a0('0x3c')](handleError(_0x1942e5,null));};exports[_0x56a0('0x43')]=function(_0x1fc853,_0x15002b){var _0xe737f7;return db['sequelize'][_0x56a0('0x44')](function(_0x3d4997){return db[_0x56a0('0x3a')]['create'](_0x1fc853[_0x56a0('0x40')],{'transaction':_0x3d4997})['then'](function(_0x57736c){_0xe737f7=_0x57736c;var _0x4e9ccc={'type':db[_0x56a0('0x45')][_0x56a0('0x46')],'transaction':_0x3d4997};switch(_0x1fc853[_0x56a0('0x40')][_0x56a0('0x37')]){case _0x56a0('0x47'):_0x4e9ccc['type']=db[_0x56a0('0x45')][_0x56a0('0x46')];break;case _0x56a0('0x48'):_0x4e9ccc[_0x56a0('0x37')]=db['Sequelize'][_0x56a0('0x49')];break;case _0x56a0('0x4a'):_0x4e9ccc[_0x56a0('0x37')]=db[_0x56a0('0x45')][_0x56a0('0x4b')];_0x4e9ccc[_0x56a0('0x4c')]=![];break;default:}return db[_0x56a0('0x4d')][_0x56a0('0x4e')]['addColumn'](_0x56a0('0x4f'),util['format'](_0x56a0('0x50'),_0xe737f7['id']),_0x4e9ccc);})[_0x56a0('0x21')](function(){return _0xe737f7;});})['then'](respondWithResult(_0x15002b,0xc9))[_0x56a0('0x3c')](handleError(_0x15002b,null));}; \ No newline at end of file +var _0xefff=['filter','CmCustomField','includeAll','findAll','catch','show','params','keys','include','options','find','body','create','TEXT','text','number','Sequelize','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','key','model','differenceBy','name','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL'];(function(_0x175559,_0x39e778){var _0x4e5bc5=function(_0x1e4a37){while(--_0x1e4a37){_0x175559['push'](_0x175559['shift']());}};_0x4e5bc5(++_0x39e778);}(_0xefff,0x15b));var _0xfeff=function(_0x2ddef7,_0x3bf08c){_0x2ddef7=_0x2ddef7-0x0;var _0x1f9f51=_0xefff[_0x2ddef7];return _0x1f9f51;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xfeff('0x0'));var zipdir=require(_0xfeff('0x1'));var jsonpatch=require(_0xfeff('0x2'));var rp=require('request-promise');var moment=require(_0xfeff('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfeff('0x4'));var sox=require(_0xfeff('0x5'));var csv=require(_0xfeff('0x6'));var ejs=require(_0xfeff('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfeff('0x8'));var crypto=require(_0xfeff('0x9'));var jsforce=require(_0xfeff('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfeff('0x6'));var querystring=require(_0xfeff('0xb'));var Papa=require(_0xfeff('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfeff('0xd'));var as=require(_0xfeff('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfeff('0xf'))(_0xfeff('0x10'));var utils=require(_0xfeff('0x11'));var config=require(_0xfeff('0x12'));var db=require(_0xfeff('0x13'))['db'];function respondWithStatusCode(_0x388054,_0x543f28){_0x543f28=_0x543f28||0xcc;return function(_0x43d9e4){if(_0x43d9e4){return _0x388054[_0xfeff('0x14')](_0x543f28);}return _0x388054[_0xfeff('0x15')](_0x543f28)[_0xfeff('0x16')]();};}function respondWithResult(_0x3e179e,_0x24e7f4){_0x24e7f4=_0x24e7f4||0xc8;return function(_0x21abbc){if(_0x21abbc){return _0x3e179e[_0xfeff('0x15')](_0x24e7f4)['json'](_0x21abbc);}};}function respondWithFilteredResult(_0x5eed78,_0x4ab5fb){return function(_0x27dd1d){if(_0x27dd1d){var _0x3402a5=_0x27dd1d[_0xfeff('0x17')],_0x4b2d45=_0x4ab5fb['offset'],_0x39bacf=_0x4ab5fb[_0xfeff('0x18')]+_0x4ab5fb[_0xfeff('0x19')],_0x5a1e20;if(_0x39bacf>=_0x3402a5){_0x39bacf=_0x3402a5;_0x5a1e20=0xc8;}else{_0x5a1e20=0xce;}_0x5eed78['status'](_0x5a1e20);return _0x5eed78['set'](_0xfeff('0x1a'),_0x4b2d45+'-'+_0x39bacf+'/'+_0x3402a5)[_0xfeff('0x1b')](_0x27dd1d);}return null;};}function patchUpdates(_0x6cd18e){return function(_0x1b3f06){try{jsonpatch[_0xfeff('0x1c')](_0x1b3f06,_0x6cd18e,!![]);}catch(_0x3619f1){return BPromise[_0xfeff('0x1d')](_0x3619f1);}return _0x1b3f06['save']();};}function saveUpdates(_0x4b1815,_0x49648e){return function(_0x2eb33d){if(_0x2eb33d){return _0x2eb33d[_0xfeff('0x1e')](_0x4b1815)[_0xfeff('0x1f')](function(_0x3b71cd){return _0x3b71cd;});}return null;};}function removeEntity(_0x5457e2,_0x5423b7){return function(_0x4caec4){if(_0x4caec4){return _0x4caec4[_0xfeff('0x20')]()[_0xfeff('0x1f')](function(){_0x5457e2[_0xfeff('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26714f,_0x279520){return function(_0x608cba){if(!_0x608cba){_0x26714f[_0xfeff('0x14')](0x194);}return _0x608cba;};}function handleError(_0x5836c9,_0x22ce9a){_0x22ce9a=_0x22ce9a||0x1f4;return function(_0x297c6d){logger[_0xfeff('0x21')](_0x297c6d[_0xfeff('0x22')]);if(_0x297c6d['name']){delete _0x297c6d['name'];}_0x5836c9['status'](_0x22ce9a)[_0xfeff('0x23')](_0x297c6d);};}exports[_0xfeff('0x24')]=function(_0x216bec,_0x5dc32d){var _0x41cf14={},_0x44c725={},_0x4f321a={'count':0x0,'rows':[]};var _0x16697c=_[_0xfeff('0x25')](db['CmCustomField'][_0xfeff('0x26')],function(_0x620956){return{'name':_0x620956[_0xfeff('0x27')],'type':_0x620956['type'][_0xfeff('0x28')]};});_0x44c725[_0xfeff('0x29')]=_[_0xfeff('0x2a')](_[_0xfeff('0x25')](_0x16697c,_0xfeff('0x2b')),[_0xfeff('0x2b')]);_0x44c725[_0xfeff('0x2c')]=_['keys'](_0x216bec[_0xfeff('0x2c')]);_0x44c725[_0xfeff('0x2d')]=_[_0xfeff('0x2e')](_0x44c725['model'],_0x44c725[_0xfeff('0x2c')]);_0x41cf14['attributes']=_[_0xfeff('0x2e')](_0x44c725['model'],qs['fields'](_0x216bec[_0xfeff('0x2c')]['fields']));_0x41cf14[_0xfeff('0x2f')]=_0x41cf14[_0xfeff('0x2f')][_0xfeff('0x30')]?_0x41cf14['attributes']:_0x44c725[_0xfeff('0x29')];if(!_0x216bec['query'][_0xfeff('0x31')](_0xfeff('0x32'))){_0x41cf14[_0xfeff('0x19')]=qs['limit'](_0x216bec['query'][_0xfeff('0x19')]);_0x41cf14[_0xfeff('0x18')]=qs[_0xfeff('0x18')](_0x216bec[_0xfeff('0x2c')]['offset']);}_0x41cf14[_0xfeff('0x33')]=qs['sort'](_0x216bec[_0xfeff('0x2c')][_0xfeff('0x34')]);_0x41cf14['where']=qs['filters'](_[_0xfeff('0x35')](_0x216bec['query'],_0x44c725['filters']));if(_0x216bec['query']['filter']){_0x41cf14[_0xfeff('0x36')]=_[_0xfeff('0x37')](_0x41cf14[_0xfeff('0x36')],{'$or':_['map'](_0x16697c,function(_0x15b5e8){if(_0x15b5e8[_0xfeff('0x38')]!==_0xfeff('0x39')){var _0x4a6a96={};_0x4a6a96[_0x15b5e8[_0xfeff('0x2b')]]={'$like':'%'+_0x216bec[_0xfeff('0x2c')][_0xfeff('0x3a')]+'%'};return _0x4a6a96;}})});}_0x41cf14=_[_0xfeff('0x37')]({},_0x41cf14,_0x216bec['options']);var _0xb522f3={'where':_0x41cf14[_0xfeff('0x36')]};return db[_0xfeff('0x3b')][_0xfeff('0x17')](_0xb522f3)[_0xfeff('0x1f')](function(_0x43366e){_0x4f321a['count']=_0x43366e;if(_0x216bec[_0xfeff('0x2c')][_0xfeff('0x3c')]){_0x41cf14['include']=[{'all':!![]}];}return db['CmCustomField'][_0xfeff('0x3d')](_0x41cf14);})[_0xfeff('0x1f')](function(_0x5eccb3){_0x4f321a['rows']=_0x5eccb3;return _0x4f321a;})[_0xfeff('0x1f')](respondWithFilteredResult(_0x5dc32d,_0x41cf14))[_0xfeff('0x3e')](handleError(_0x5dc32d,null));};exports[_0xfeff('0x3f')]=function(_0x1312b1,_0x2bcbf1){var _0x4d2c42={'raw':!![],'where':{'id':_0x1312b1[_0xfeff('0x40')]['id']}},_0x53edef={};_0x53edef[_0xfeff('0x29')]=_[_0xfeff('0x41')](db[_0xfeff('0x3b')][_0xfeff('0x26')]);_0x53edef[_0xfeff('0x2c')]=_[_0xfeff('0x41')](_0x1312b1[_0xfeff('0x2c')]);_0x53edef[_0xfeff('0x2d')]=_[_0xfeff('0x2e')](_0x53edef[_0xfeff('0x29')],_0x53edef[_0xfeff('0x2c')]);_0x4d2c42[_0xfeff('0x2f')]=_['intersection'](_0x53edef[_0xfeff('0x29')],qs['fields'](_0x1312b1[_0xfeff('0x2c')]['fields']));_0x4d2c42[_0xfeff('0x2f')]=_0x4d2c42['attributes']['length']?_0x4d2c42['attributes']:_0x53edef['model'];if(_0x1312b1[_0xfeff('0x2c')][_0xfeff('0x3c')]){_0x4d2c42[_0xfeff('0x42')]=[{'all':!![]}];}_0x4d2c42=_['merge']({},_0x4d2c42,_0x1312b1[_0xfeff('0x43')]);return db[_0xfeff('0x3b')][_0xfeff('0x44')](_0x4d2c42)[_0xfeff('0x1f')](handleEntityNotFound(_0x2bcbf1,null))[_0xfeff('0x1f')](respondWithResult(_0x2bcbf1,null))[_0xfeff('0x3e')](handleError(_0x2bcbf1,null));};exports[_0xfeff('0x1e')]=function(_0x479a18,_0x442509){if(_0x479a18[_0xfeff('0x45')]['id']){delete _0x479a18[_0xfeff('0x45')]['id'];}return db['CmCustomField'][_0xfeff('0x44')]({'where':{'id':_0x479a18[_0xfeff('0x40')]['id']}})[_0xfeff('0x1f')](handleEntityNotFound(_0x442509,null))[_0xfeff('0x1f')](saveUpdates(_0x479a18[_0xfeff('0x45')],null))[_0xfeff('0x1f')](respondWithResult(_0x442509,null))[_0xfeff('0x3e')](handleError(_0x442509,null));};exports[_0xfeff('0x20')]=function(_0x3a4761,_0x3f53ca){return db[_0xfeff('0x3b')][_0xfeff('0x44')]({'where':{'id':_0x3a4761[_0xfeff('0x40')]['id']}})['then'](handleEntityNotFound(_0x3f53ca,null))[_0xfeff('0x1f')](removeEntity(_0x3f53ca,null))[_0xfeff('0x3e')](handleError(_0x3f53ca,null));};exports[_0xfeff('0x46')]=function(_0x167d80,_0x3f2268){var _0x3fd7a9;return db['sequelize']['transaction'](function(_0x154669){return db[_0xfeff('0x3b')][_0xfeff('0x46')](_0x167d80[_0xfeff('0x45')],{'transaction':_0x154669})[_0xfeff('0x1f')](function(_0x4c8792){_0x3fd7a9=_0x4c8792;var _0x2fbeb6={'type':db['Sequelize'][_0xfeff('0x47')],'transaction':_0x154669};switch(_0x167d80[_0xfeff('0x45')][_0xfeff('0x38')]){case _0xfeff('0x48'):_0x2fbeb6[_0xfeff('0x38')]=db['Sequelize'][_0xfeff('0x47')];break;case _0xfeff('0x49'):_0x2fbeb6[_0xfeff('0x38')]=db[_0xfeff('0x4a')][_0xfeff('0x4b')];break;case _0xfeff('0x4c'):_0x2fbeb6[_0xfeff('0x38')]=db[_0xfeff('0x4a')][_0xfeff('0x4d')];_0x2fbeb6['defaultValue']=![];break;default:}return db['sequelize'][_0xfeff('0x4e')][_0xfeff('0x4f')](_0xfeff('0x50'),util['format']('cf_%d',_0x3fd7a9['id']),_0x2fbeb6);})[_0xfeff('0x1f')](function(){return _0x3fd7a9;});})[_0xfeff('0x1f')](respondWithResult(_0x3f2268,0xc9))[_0xfeff('0x3e')](handleError(_0x3f2268,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 76aacf6..3592d97 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 _0x57ee=['CmCustomField','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x57ee,0x199));var _0xe57e=function(_0x279b0d,_0x5a3a68){_0x279b0d=_0x279b0d-0x0;var _0x183dd9=_0x57ee[_0x279b0d];return _0x183dd9;};'use strict';var _=require(_0xe57e('0x0'));var util=require(_0xe57e('0x1'));var logger=require(_0xe57e('0x2'))('api');var moment=require(_0xe57e('0x3'));var BPromise=require(_0xe57e('0x4'));var rp=require(_0xe57e('0x5'));var fs=require('fs');var path=require(_0xe57e('0x6'));var rimraf=require(_0xe57e('0x7'));var config=require(_0xe57e('0x8'));var attributes=require('./cmCustomField.attributes');module[_0xe57e('0x9')]=function(_0x219554,_0x73cef5){return _0x219554[_0xe57e('0xa')](_0xe57e('0xb'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc641=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields'];(function(_0x2ab847,_0x4e223f){var _0x487e34=function(_0x1cb7dd){while(--_0x1cb7dd){_0x2ab847['push'](_0x2ab847['shift']());}};_0x487e34(++_0x4e223f);}(_0xc641,0x1d4));var _0x1c64=function(_0x4fc192,_0xbceb23){_0x4fc192=_0x4fc192-0x0;var _0x2a11cc=_0xc641[_0x4fc192];return _0x2a11cc;};'use strict';var _=require(_0x1c64('0x0'));var util=require(_0x1c64('0x1'));var logger=require(_0x1c64('0x2'))('api');var moment=require(_0x1c64('0x3'));var BPromise=require('bluebird');var rp=require(_0x1c64('0x4'));var fs=require('fs');var path=require(_0x1c64('0x5'));var rimraf=require(_0x1c64('0x6'));var config=require(_0x1c64('0x7'));var attributes=require(_0x1c64('0x8'));module['exports']=function(_0x31e81b,_0x250d38){return _0x31e81b[_0x1c64('0x9')](_0x1c64('0xa'),attributes,{'tableName':_0x1c64('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index b3b02e5..6d2927b 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 _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result'];(function(_0x994c63,_0x2e3666){var _0x2dc858=function(_0x442e49){while(--_0x442e49){_0x994c63['push'](_0x994c63['shift']());}};_0x2dc858(++_0x2e3666);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x415603,_0x21320c){_0x415603=_0x415603-0x0;var _0x131e72=_0xf3cd[_0x415603];return _0x131e72;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('CmCustomField,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('CmCustomField,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file +var _0x5178=['request','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x5178,0x171));var _0x8517=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5178[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x8517('0x0'));var moment=require(_0x8517('0x1'));var BPromise=require(_0x8517('0x2'));var rs=require(_0x8517('0x3'));var fs=require('fs');var Redis=require(_0x8517('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8517('0x5'))(_0x8517('0x6'));var config=require('../../config/environment');var jayson=require(_0x8517('0x7'));var client=jayson['client'][_0x8517('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45498e,_0x3615b2,_0x10f918){return new BPromise(function(_0x25146d,_0x49739b){return client[_0x8517('0x9')](_0x45498e,_0x10f918)['then'](function(_0x485677){logger[_0x8517('0xa')](_0x8517('0xb'),_0x3615b2,'request\x20sent');logger[_0x8517('0xc')](_0x8517('0xd'),_0x3615b2,_0x8517('0xe'),JSON[_0x8517('0xf')](_0x485677));if(_0x485677[_0x8517('0x10')]){if(_0x485677[_0x8517('0x10')][_0x8517('0x11')]===0x1f4){logger[_0x8517('0x10')]('CmCustomField,\x20%s,\x20%s',_0x3615b2,_0x485677[_0x8517('0x10')][_0x8517('0x12')]);return _0x49739b(_0x485677[_0x8517('0x10')][_0x8517('0x12')]);}logger[_0x8517('0x10')]('CmCustomField,\x20%s,\x20%s',_0x3615b2,_0x485677[_0x8517('0x10')][_0x8517('0x12')]);return _0x25146d(_0x485677[_0x8517('0x10')][_0x8517('0x12')]);}else{logger[_0x8517('0xa')](_0x8517('0xb'),_0x3615b2,_0x8517('0xe'));_0x25146d(_0x485677[_0x8517('0x13')][_0x8517('0x12')]);}})[_0x8517('0x14')](function(_0x22b687){logger[_0x8517('0x10')]('CmCustomField,\x20%s,\x20%s',_0x3615b2,_0x22b687);_0x49739b(_0x22b687);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 60b1ac3..8b0f086 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 _0x71bb=['/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','./cmCustomField.controller','get','index'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x71bb,0xe5));var _0xb71b=function(_0x103dfa,_0x4296cb){_0x103dfa=_0x103dfa-0x0;var _0x4a33e0=_0x71bb[_0x103dfa];return _0x4a33e0;};'use strict';var multer=require(_0xb71b('0x0'));var util=require(_0xb71b('0x1'));var path=require(_0xb71b('0x2'));var timeout=require(_0xb71b('0x3'));var express=require(_0xb71b('0x4'));var router=express[_0xb71b('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb71b('0x6'));router[_0xb71b('0x7')]('/',auth['isAuthenticated'](),controller[_0xb71b('0x8')]);router[_0xb71b('0x7')](_0xb71b('0x9'),auth[_0xb71b('0xa')](),controller[_0xb71b('0xb')]);router['post']('/',auth[_0xb71b('0xa')](),controller['create']);router[_0xb71b('0xc')]('/:id',auth[_0xb71b('0xa')](),controller[_0xb71b('0xd')]);router[_0xb71b('0xe')](_0xb71b('0x9'),auth[_0xb71b('0xa')](),controller[_0xb71b('0xf')]);module[_0xb71b('0x10')]=router; \ No newline at end of file +var _0x10df=['../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x45ee29,_0x45b4fc){var _0x11d78f=function(_0x5d7e76){while(--_0x5d7e76){_0x45ee29['push'](_0x45ee29['shift']());}};_0x11d78f(++_0x45b4fc);}(_0x10df,0x178));var _0xf10d=function(_0x401d4e,_0x2f6357){_0x401d4e=_0x401d4e-0x0;var _0x382ee1=_0x10df[_0x401d4e];return _0x382ee1;};'use strict';var multer=require(_0xf10d('0x0'));var util=require(_0xf10d('0x1'));var path=require('path');var timeout=require(_0xf10d('0x2'));var express=require('express');var router=express[_0xf10d('0x3')]();var auth=require(_0xf10d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf10d('0x5'));var controller=require(_0xf10d('0x6'));router[_0xf10d('0x7')]('/',auth[_0xf10d('0x8')](),controller[_0xf10d('0x9')]);router[_0xf10d('0x7')](_0xf10d('0xa'),auth[_0xf10d('0x8')](),controller[_0xf10d('0xb')]);router[_0xf10d('0xc')]('/',auth['isAuthenticated'](),controller[_0xf10d('0xd')]);router[_0xf10d('0xe')](_0xf10d('0xa'),auth[_0xf10d('0x8')](),controller[_0xf10d('0xf')]);router[_0xf10d('0x10')]('/:id',auth[_0xf10d('0x8')](),controller[_0xf10d('0x11')]);module[_0xf10d('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 8513fca..d4bdb09 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 _0x44e8=['STRING','BOOLEAN','DATE','format','INTEGER','UNSIGNED','contactListQueue','moment'];(function(_0x3a5c4a,_0x59df16){var _0xe088f3=function(_0x359cda){while(--_0x359cda){_0x3a5c4a['push'](_0x3a5c4a['shift']());}};_0xe088f3(++_0x59df16);}(_0x44e8,0xd7));var _0x844e=function(_0x414e56,_0x256aa6){_0x414e56=_0x414e56-0x0;var _0x1da96d=_0x44e8[_0x414e56];return _0x1da96d;};'use strict';var moment=require(_0x844e('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x844e('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x844e('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x844e('0x3')],'defaultValue':moment()[_0x844e('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x844e('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x844e('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x844e('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x844e('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x844e('0x3')]},'priority':{'type':Sequelize[_0x844e('0x5')](0x2)[_0x844e('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x844e('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x844e('0x7')},'ListId':{'type':Sequelize[_0x844e('0x5')],'unique':_0x844e('0x7')},'UserId':{'type':Sequelize[_0x844e('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x844e('0x5')],'unique':_0x844e('0x7')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x844e('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x844e('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x844e('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x844e('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x844e('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5292=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING','DATE','format'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5292,0xf7));var _0x2529=function(_0x103c4c,_0x285348){_0x103c4c=_0x103c4c-0x0;var _0x3fc15e=_0x5292[_0x103c4c];return _0x3fc15e;};'use strict';var moment=require(_0x2529('0x0'));var Sequelize=require(_0x2529('0x1'));module['exports']={'phone':{'type':Sequelize[_0x2529('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x2529('0x3')],'defaultValue':moment()[_0x2529('0x4')](_0x2529('0x5'))},'countbusyretry':{'type':Sequelize[_0x2529('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2529('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x2529('0x6')](0x2)[_0x2529('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x2529('0x8')},'ListId':{'type':Sequelize[_0x2529('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x2529('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x2529('0x6')],'unique':_0x2529('0x8')},'CampaignId':{'type':Sequelize[_0x2529('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x2529('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2529('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2529('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2529('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 96bf1c9..72dddad 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 _0x4629=['request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','key','model','query','filters','intersection','$and','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','CmHopper','count','includeAll','include','findAll','rows','catch','show','keys','find','create','body','describe','params','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','user','UserId','deleted','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','CmCompany','Company','CmList','Queue','dialActive','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','html-pdf','rimraf','fast-json-patch'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4629,0x1b9));var _0x9462=function(_0x41983e,_0x1db165){_0x41983e=_0x41983e-0x0;var _0x23cb77=_0x4629[_0x41983e];return _0x23cb77;};'use strict';var pdf=require(_0x9462('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9462('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9462('0x2'));var rp=require(_0x9462('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9462('0x4'));var util=require(_0x9462('0x5'));var path=require(_0x9462('0x6'));var sox=require(_0x9462('0x7'));var csv=require('to-csv');var ejs=require(_0x9462('0x8'));var fs=require('fs');var _=require(_0x9462('0x9'));var squel=require(_0x9462('0xa'));var crypto=require(_0x9462('0xb'));var jsforce=require(_0x9462('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9462('0xd'));var querystring=require(_0x9462('0xe'));var Papa=require(_0x9462('0xf'));var Redis=require(_0x9462('0x10'));var authService=require(_0x9462('0x11'));var qs=require(_0x9462('0x12'));var as=require(_0x9462('0x13'));var hardwareService=require(_0x9462('0x14'));var logger=require('../../config/logger')(_0x9462('0x15'));var utils=require('../../config/utils');var config=require(_0x9462('0x16'));var db=require(_0x9462('0x17'))['db'];function respondWithStatusCode(_0x3b8217,_0x2fa51b){_0x2fa51b=_0x2fa51b||0xcc;return function(_0x47775a){if(_0x47775a){return _0x3b8217['sendStatus'](_0x2fa51b);}return _0x3b8217[_0x9462('0x18')](_0x2fa51b)[_0x9462('0x19')]();};}function respondWithResult(_0x11329e,_0x3ada02){_0x3ada02=_0x3ada02||0xc8;return function(_0x2e66b5){if(_0x2e66b5){return _0x11329e['status'](_0x3ada02)['json'](_0x2e66b5);}};}function respondWithFilteredResult(_0x4ea579,_0x37767b){return function(_0x3f9e3a){if(_0x3f9e3a){var _0x1b4b72=_0x3f9e3a['count'],_0x345567=_0x37767b[_0x9462('0x1a')],_0x5b00e9=_0x37767b[_0x9462('0x1a')]+_0x37767b[_0x9462('0x1b')],_0x785d49;if(_0x5b00e9>=_0x1b4b72){_0x5b00e9=_0x1b4b72;_0x785d49=0xc8;}else{_0x785d49=0xce;}_0x4ea579[_0x9462('0x18')](_0x785d49);return _0x4ea579[_0x9462('0x1c')](_0x9462('0x1d'),_0x345567+'-'+_0x5b00e9+'/'+_0x1b4b72)['json'](_0x3f9e3a);}return null;};}function patchUpdates(_0x122671){return function(_0x3e4431){try{jsonpatch[_0x9462('0x1e')](_0x3e4431,_0x122671,!![]);}catch(_0xf29fd4){return BPromise[_0x9462('0x1f')](_0xf29fd4);}return _0x3e4431[_0x9462('0x20')]();};}function saveUpdates(_0x3ff22a,_0x25c4e6){return function(_0x324bab){if(_0x324bab){return _0x324bab[_0x9462('0x21')](_0x3ff22a)[_0x9462('0x22')](function(_0x199430){return _0x199430;});}return null;};}function removeEntity(_0x558c2e,_0x53cc02){return function(_0x168c1d){if(_0x168c1d){return _0x168c1d[_0x9462('0x23')]()[_0x9462('0x22')](function(){_0x558c2e[_0x9462('0x18')](0xcc)[_0x9462('0x19')]();});}};}function handleEntityNotFound(_0x6fdc01,_0x152378){return function(_0x499228){if(!_0x499228){_0x6fdc01['sendStatus'](0x194);}return _0x499228;};}function handleError(_0x34ea51,_0x14e48c){_0x14e48c=_0x14e48c||0x1f4;return function(_0x37c682){logger[_0x9462('0x24')](_0x37c682[_0x9462('0x25')]);if(_0x37c682[_0x9462('0x26')]){delete _0x37c682[_0x9462('0x26')];}_0x34ea51[_0x9462('0x18')](_0x14e48c)['send'](_0x37c682);};}exports[_0x9462('0x27')]=function(_0x646adb,_0xc9235f){var _0x505d23={},_0x1b2d44={},_0x357c9c={'count':0x0,'rows':[]};var _0x5bf8ac=_[_0x9462('0x28')](db['CmHopper'][_0x9462('0x29')],function(_0x37f618){return{'name':_0x37f618['fieldName'],'type':_0x37f618[_0x9462('0x2a')][_0x9462('0x2b')]};});_0x1b2d44[_0x9462('0x2c')]=_[_0x9462('0x28')](_0x5bf8ac,_0x9462('0x26'));_0x1b2d44[_0x9462('0x2d')]=_['keys'](_0x646adb['query']);_0x1b2d44[_0x9462('0x2e')]=_[_0x9462('0x2f')](_0x1b2d44['model'],_0x1b2d44[_0x9462('0x2d')]);_0x1b2d44[_0x9462('0x2e')]=_['concat'](_0x1b2d44[_0x9462('0x2e')],[_0x9462('0x30'),'$or',_0x9462('0x31'),_0x9462('0x32'),_0x9462('0x33'),_0x9462('0x34'),_0x9462('0x35'),'$eq',_0x9462('0x36'),_0x9462('0x37'),_0x9462('0x38'),'$in',_0x9462('0x39'),'$like',_0x9462('0x3a'),_0x9462('0x3b'),_0x9462('0x3c'),_0x9462('0x3d'),_0x9462('0x3e'),'$contains',_0x9462('0x3f'),_0x9462('0x40')]);_0x505d23[_0x9462('0x41')]=_[_0x9462('0x2f')](_0x1b2d44[_0x9462('0x2c')],qs[_0x9462('0x42')](_0x646adb[_0x9462('0x2d')][_0x9462('0x42')]));_0x505d23[_0x9462('0x41')]=_0x505d23[_0x9462('0x41')][_0x9462('0x43')]?_0x505d23[_0x9462('0x41')]:_0x1b2d44[_0x9462('0x2c')];if(!_0x646adb[_0x9462('0x2d')][_0x9462('0x44')](_0x9462('0x45'))){_0x505d23[_0x9462('0x1b')]=qs[_0x9462('0x1b')](_0x646adb[_0x9462('0x2d')]['limit']);_0x505d23[_0x9462('0x1a')]=qs[_0x9462('0x1a')](_0x646adb[_0x9462('0x2d')][_0x9462('0x1a')]);}_0x505d23[_0x9462('0x46')]=qs[_0x9462('0x47')](_0x646adb[_0x9462('0x2d')]['sort']);_0x505d23[_0x9462('0x48')]=qs[_0x9462('0x2e')](_[_0x9462('0x49')](_0x646adb[_0x9462('0x2d')],_0x1b2d44['filters']));if(_0x646adb[_0x9462('0x2d')][_0x9462('0x4a')]){_0x505d23[_0x9462('0x48')]=_['merge'](_0x505d23['where'],{'$or':_[_0x9462('0x28')](_0x5bf8ac,function(_0x31823d){if(_0x31823d[_0x9462('0x2a')]!==_0x9462('0x4b')){var _0xcf05d4={};_0xcf05d4[_0x31823d[_0x9462('0x26')]]={'$like':'%'+_0x646adb[_0x9462('0x2d')]['filter']+'%'};return _0xcf05d4;}})});}_0x505d23=_[_0x9462('0x4c')]({},_0x505d23,_0x646adb[_0x9462('0x4d')]);var _0x21a3bf={'where':_0x505d23[_0x9462('0x48')]};return db[_0x9462('0x4e')]['count'](_0x21a3bf)[_0x9462('0x22')](function(_0x493a8d){_0x357c9c[_0x9462('0x4f')]=_0x493a8d;if(_0x646adb[_0x9462('0x2d')][_0x9462('0x50')]){_0x505d23[_0x9462('0x51')]=[{'all':!![]}];}return db[_0x9462('0x4e')][_0x9462('0x52')](_0x505d23);})[_0x9462('0x22')](function(_0x48b1de){_0x357c9c[_0x9462('0x53')]=_0x48b1de;return _0x357c9c;})[_0x9462('0x22')](respondWithFilteredResult(_0xc9235f,_0x505d23))[_0x9462('0x54')](handleError(_0xc9235f,null));};exports[_0x9462('0x55')]=function(_0x530770,_0x4d4e55){var _0x2528d7={'raw':!![],'where':{'id':_0x530770['params']['id']}},_0x41c991={};_0x41c991[_0x9462('0x2c')]=_[_0x9462('0x56')](db['CmHopper'][_0x9462('0x29')]);_0x41c991[_0x9462('0x2d')]=_[_0x9462('0x56')](_0x530770[_0x9462('0x2d')]);_0x41c991[_0x9462('0x2e')]=_[_0x9462('0x2f')](_0x41c991[_0x9462('0x2c')],_0x41c991['query']);_0x2528d7[_0x9462('0x41')]=_['intersection'](_0x41c991[_0x9462('0x2c')],qs[_0x9462('0x42')](_0x530770['query'][_0x9462('0x42')]));_0x2528d7[_0x9462('0x41')]=_0x2528d7[_0x9462('0x41')][_0x9462('0x43')]?_0x2528d7[_0x9462('0x41')]:_0x41c991[_0x9462('0x2c')];if(_0x530770[_0x9462('0x2d')][_0x9462('0x50')]){_0x2528d7[_0x9462('0x51')]=[{'all':!![]}];}_0x2528d7=_[_0x9462('0x4c')]({},_0x2528d7,_0x530770['options']);return db['CmHopper'][_0x9462('0x57')](_0x2528d7)[_0x9462('0x22')](handleEntityNotFound(_0x4d4e55,null))[_0x9462('0x22')](respondWithResult(_0x4d4e55,null))['catch'](handleError(_0x4d4e55,null));};exports[_0x9462('0x58')]=function(_0x11b199,_0x44da87){return db[_0x9462('0x4e')][_0x9462('0x58')](_0x11b199[_0x9462('0x59')],{})[_0x9462('0x22')](respondWithResult(_0x44da87,0xc9))[_0x9462('0x54')](handleError(_0x44da87,null));};exports['update']=function(_0x535492,_0x4d3c61){if(_0x535492['body']['id']){delete _0x535492[_0x9462('0x59')]['id'];}return db[_0x9462('0x4e')][_0x9462('0x57')]({'where':{'id':_0x535492['params']['id']}})['then'](handleEntityNotFound(_0x4d3c61,null))['then'](saveUpdates(_0x535492[_0x9462('0x59')],null))[_0x9462('0x22')](respondWithResult(_0x4d3c61,null))[_0x9462('0x54')](handleError(_0x4d3c61,null));};exports[_0x9462('0x5a')]=function(_0x23d9a5,_0x4c1c55){return db[_0x9462('0x4e')]['describe']()[_0x9462('0x22')](respondWithResult(_0x4c1c55,null))[_0x9462('0x54')](handleError(_0x4c1c55,null));};exports[_0x9462('0x23')]=function(_0x2d4e7d,_0x224312){var _0x5a6873;return db[_0x9462('0x4e')]['find']({'where':{'id':_0x2d4e7d[_0x9462('0x5b')]['id']}})[_0x9462('0x22')](handleEntityNotFound(_0x224312,null))['then'](function(_0x772226){if(_0x772226){return _0x772226[_0x9462('0x23')]()[_0x9462('0x22')](function(_0x209215){return _0x209215;});}})['then'](function(_0x515ad3){_0x5a6873=_0x515ad3;if(_0x515ad3){if(_0x515ad3[_0x9462('0x5c')]||_0x515ad3[_0x9462('0x5d')]){return db[_0x515ad3[_0x9462('0x5c')]?_0x9462('0x5e'):_0x9462('0x5f')][_0x9462('0x57')]({'where':{'id':_0x515ad3[_0x9462('0x5c')]?_0x515ad3['VoiceQueueId']:_0x515ad3[_0x9462('0x5d')]},'attributes':['id',_0x9462('0x26')],'raw':!![]});}}})[_0x9462('0x22')](function(_0x17b0ea){var _0x110b2c={};if(_0x17b0ea){_[_0x9462('0x4c')](_0x110b2c,_[_0x9462('0x60')](_0x5a6873[_0x9462('0x61')],[_0x9462('0x62'),_0x9462('0x63'),'id']));_0x110b2c[_0x9462('0x64')]=0x15;_0x110b2c[_0x9462('0x65')]='deleted';_0x110b2c[_0x9462('0x66')]=_0x17b0ea['name'];_0x110b2c['membername']=_0x2d4e7d[_0x9462('0x67')][_0x9462('0x26')];_0x110b2c[_0x9462('0x68')]=_0x2d4e7d[_0x9462('0x67')]['id'];_0x110b2c[_0x9462('0x69')]=!![];_0x110b2c['deletedat']=moment()[_0x9462('0x6a')](_0x9462('0x6b'));_0x110b2c[_0x9462('0x6c')]=_0x5a6873['phone'];_0x110b2c[_0x9462('0x6d')]=_0x5a6873[_0x9462('0x5c')]?_0x9462('0x6e'):'ivr';return db[_0x9462('0x6f')]['find']({'where':{'id':_0x110b2c[_0x9462('0x70')]},'attributes':[_0x9462('0x71'),_0x9462('0x72')]})[_0x9462('0x22')](function(_0x167c7d){if(!_['isNil'](_0x224312)&&!_['isNil'](_0x167c7d[_0x9462('0x71')])){_0x110b2c['calleridname']=_0x167c7d[_0x9462('0x71')];if(!_[_0x9462('0x73')](_0x167c7d['lastName'])){_0x110b2c[_0x9462('0x74')]+='\x20'+_0x167c7d['lastName'];}}})['finally'](function(){return db['CmHopperFinal'][_0x9462('0x58')](_0x110b2c);});}})[_0x9462('0x22')](function(){return _0x224312[_0x9462('0x18')](0xcc)[_0x9462('0x19')]();})[_0x9462('0x54')](handleError(_0x224312,null));};exports[_0x9462('0x75')]=function(_0x55d641,_0x3f4995,_0x93b444){var _0x47be17=[];return db[_0x9462('0x6f')]['describe']()[_0x9462('0x22')](function(_0x558b60){_0x47be17=_[_0x9462('0x56')](_0x558b60);return _0x55d641[_0x9462('0x67')][_0x9462('0x76')]({'where':{'type':_0x9462('0x77'),'dialActive':!![],'dialMethod':_0x9462('0x78')},'attributes':['id',_0x9462('0x79')],'raw':!![]});})[_0x9462('0x22')](function(_0x2b15b3){if(_0x2b15b3&&_0x2b15b3[_0x9462('0x43')]){return db[_0x9462('0x7a')][_0x9462('0x7b')](function(_0x49949f){var _0x1cdbe8={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9462('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x2b15b3,'id')},'$or':[{'UserId':null},{'UserId':_0x55d641[_0x9462('0x67')]['id']}]};var _0x4a2350=[];if(_0x55d641[_0x9462('0x59')][_0x9462('0x7c')]&&_0x55d641[_0x9462('0x59')]['direction']===_0x9462('0x7d')){if(!_[_0x9462('0x7e')](_0x55d641[_0x9462('0x59')][_0x9462('0x7f')])){_0x1cdbe8['id']={'$in':_0x55d641[_0x9462('0x59')][_0x9462('0x7f')]};}_0x4a2350=[[_0x9462('0x80'),_0x9462('0x81')],[_0x9462('0x82'),_0x2b15b3[0x0][_0x9462('0x79')]==='ASC'?_0x9462('0x83'):_0x9462('0x81')],db['sequelize'][_0x9462('0x84')](_0x9462('0x85')),['id',_0x9462('0x83')]];}else{if(!_[_0x9462('0x7e')](_0x55d641['body'][_0x9462('0x7f')])){_0x1cdbe8['id']={'$notIn':_0x55d641[_0x9462('0x59')][_0x9462('0x7f')]};}_0x4a2350=[['priority',_0x9462('0x83')],[_0x9462('0x82'),_0x2b15b3[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0x9462('0x84')](_0x9462('0x86')),['id',_0x9462('0x81')]];}return db[_0x9462('0x4e')][_0x9462('0x87')]({'attributes':['id',_0x9462('0x88')],'where':_0x1cdbe8,'order':_0x4a2350,'transaction':_0x49949f,'lock':_0x49949f[_0x9462('0x89')][_0x9462('0x8a')],'include':[{'model':db[_0x9462('0x6f')],'as':'Contact','attributes':_0x47be17,'include':[{'model':db[_0x9462('0x8b')],'as':_0x9462('0x8c'),'attributes':['id','name']}]},{'model':db[_0x9462('0x8d')],'as':'List','attributes':['id',_0x9462('0x26')]},{'model':db[_0x9462('0x5e')],'as':_0x9462('0x8e'),'attributes':['id',_0x9462('0x26'),_0x9462('0x8f')]}]})['then'](function(_0x1f75fc){if(_0x1f75fc){return _0x1f75fc[_0x9462('0x21')]({'UserId':_0x55d641[_0x9462('0x67')]['id']},{'transaction':_0x49949f});}});});}})[_0x9462('0x22')](handleEntityNotFound(_0x3f4995,null))[_0x9462('0x22')](respondWithResult(_0x3f4995,null))[_0x9462('0x54')](handleError(_0x3f4995,null));};exports['getOpenContacts']=function(_0x5eb68b,_0x5dd892,_0xb11d0d){return _0x5eb68b[_0x9462('0x67')][_0x9462('0x76')]({'where':{'type':_0x9462('0x77'),'dialActive':!![],'dialMethod':_0x9462('0x78')},'attributes':['id'],'raw':!![]})[_0x9462('0x22')](function(_0x34a11a){if(_0x34a11a&&_0x34a11a[_0x9462('0x43')]){return db[_0x9462('0x4e')][_0x9462('0x4f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9462('0x6a')](_0x9462('0x6b'))},'VoiceQueueId':{'$in':_[_0x9462('0x28')](_0x34a11a,'id')},'$or':[{'UserId':null},{'UserId':_0x5eb68b[_0x9462('0x67')]['id']}]}});}return 0x0;})[_0x9462('0x22')](function(_0x3d6afc){if(!_[_0x9462('0x73')](_0x3d6afc)&&_[_0x9462('0x90')](_0x3d6afc)){return _0x5dd892[_0x9462('0x18')](0xc8)['json']({'contacts':_0x3d6afc});}else{logger['error'](_0x9462('0x91'),'getOpenContacts',0x194,_0x9462('0x92'));_0x5dd892[_0x9462('0x93')](0x194);}})[_0x9462('0x54')](handleError(_0x5dd892,null));}; \ No newline at end of file +var _0xc22f=['$and','$or','$gt','$gte','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','CmHopper','includeAll','include','findAll','catch','params','rawAttributes','options','create','body','find','describe','CampaignId','VoiceQueue','VoiceQueueId','dataValues','createdAt','updatedAt','state','statedesc','deleted','user','UserId','format','phone','campaigntype','queue','CmContact','ContactId','isNil','firstName','calleridname','lastName','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','YYYY-MM-DD\x20HH:mm:ss','direction','isEmpty','hopperIds','priority','ASC','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','Contact','CmCompany','CmList','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset','limit','set','json','update','then','destroy','error','name','index','map','fieldName','type','key','query','keys','filters','intersection','concat'];(function(_0x4380da,_0x14a45a){var _0x16c7f8=function(_0x7ed39c){while(--_0x7ed39c){_0x4380da['push'](_0x4380da['shift']());}};_0x16c7f8(++_0x14a45a);}(_0xc22f,0xe9));var _0xfc22=function(_0x2fc5a9,_0x47da7d){_0x2fc5a9=_0x2fc5a9-0x0;var _0x28111e=_0xc22f[_0x2fc5a9];return _0x28111e;};'use strict';var pdf=require(_0xfc22('0x0'));var emlformat=require(_0xfc22('0x1'));var rimraf=require(_0xfc22('0x2'));var zipdir=require(_0xfc22('0x3'));var jsonpatch=require(_0xfc22('0x4'));var rp=require(_0xfc22('0x5'));var moment=require('moment');var BPromise=require(_0xfc22('0x6'));var Mustache=require(_0xfc22('0x7'));var util=require('util');var path=require(_0xfc22('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfc22('0x9'));var fs=require('fs');var _=require(_0xfc22('0xa'));var squel=require(_0xfc22('0xb'));var crypto=require(_0xfc22('0xc'));var jsforce=require(_0xfc22('0xd'));var deskjs=require(_0xfc22('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfc22('0xf'));var Papa=require(_0xfc22('0x10'));var Redis=require('ioredis');var authService=require(_0xfc22('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfc22('0x12'));var hardwareService=require(_0xfc22('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xfc22('0x14'));var config=require(_0xfc22('0x15'));var db=require(_0xfc22('0x16'))['db'];function respondWithStatusCode(_0x3afdcd,_0x379565){_0x379565=_0x379565||0xcc;return function(_0x2cfd50){if(_0x2cfd50){return _0x3afdcd['sendStatus'](_0x379565);}return _0x3afdcd['status'](_0x379565)[_0xfc22('0x17')]();};}function respondWithResult(_0x4ba9c0,_0x3da051){_0x3da051=_0x3da051||0xc8;return function(_0x369fee){if(_0x369fee){return _0x4ba9c0[_0xfc22('0x18')](_0x3da051)['json'](_0x369fee);}};}function respondWithFilteredResult(_0xd36caa,_0x106d62){return function(_0x225a92){if(_0x225a92){var _0x40e7f1=_0x225a92[_0xfc22('0x19')],_0x3cf86=_0x106d62[_0xfc22('0x1a')],_0x1b5fd2=_0x106d62[_0xfc22('0x1a')]+_0x106d62[_0xfc22('0x1b')],_0x154b73;if(_0x1b5fd2>=_0x40e7f1){_0x1b5fd2=_0x40e7f1;_0x154b73=0xc8;}else{_0x154b73=0xce;}_0xd36caa['status'](_0x154b73);return _0xd36caa[_0xfc22('0x1c')]('Content-Range',_0x3cf86+'-'+_0x1b5fd2+'/'+_0x40e7f1)[_0xfc22('0x1d')](_0x225a92);}return null;};}function patchUpdates(_0x420d96){return function(_0x406aba){try{jsonpatch['apply'](_0x406aba,_0x420d96,!![]);}catch(_0x459614){return BPromise['reject'](_0x459614);}return _0x406aba['save']();};}function saveUpdates(_0x34213b,_0x5a8422){return function(_0x30df22){if(_0x30df22){return _0x30df22[_0xfc22('0x1e')](_0x34213b)[_0xfc22('0x1f')](function(_0x4df6d1){return _0x4df6d1;});}return null;};}function removeEntity(_0x3279c6,_0x2bb8c3){return function(_0xe4bae7){if(_0xe4bae7){return _0xe4bae7[_0xfc22('0x20')]()['then'](function(){_0x3279c6[_0xfc22('0x18')](0xcc)[_0xfc22('0x17')]();});}};}function handleEntityNotFound(_0x371919,_0x1f2f0d){return function(_0x44b925){if(!_0x44b925){_0x371919['sendStatus'](0x194);}return _0x44b925;};}function handleError(_0x5eb777,_0x4dcaf3){_0x4dcaf3=_0x4dcaf3||0x1f4;return function(_0x94f2a3){logger[_0xfc22('0x21')](_0x94f2a3['stack']);if(_0x94f2a3[_0xfc22('0x22')]){delete _0x94f2a3[_0xfc22('0x22')];}_0x5eb777[_0xfc22('0x18')](_0x4dcaf3)['send'](_0x94f2a3);};}exports[_0xfc22('0x23')]=function(_0xc51f68,_0x1adb7b){var _0x1429ff={},_0x985195={},_0x44cb5b={'count':0x0,'rows':[]};var _0x2b4436=_[_0xfc22('0x24')](db['CmHopper']['rawAttributes'],function(_0x434e18){return{'name':_0x434e18[_0xfc22('0x25')],'type':_0x434e18[_0xfc22('0x26')][_0xfc22('0x27')]};});_0x985195['model']=_[_0xfc22('0x24')](_0x2b4436,_0xfc22('0x22'));_0x985195[_0xfc22('0x28')]=_[_0xfc22('0x29')](_0xc51f68[_0xfc22('0x28')]);_0x985195[_0xfc22('0x2a')]=_[_0xfc22('0x2b')](_0x985195['model'],_0x985195[_0xfc22('0x28')]);_0x985195[_0xfc22('0x2a')]=_[_0xfc22('0x2c')](_0x985195[_0xfc22('0x2a')],[_0xfc22('0x2d'),_0xfc22('0x2e'),_0xfc22('0x2f'),_0xfc22('0x30'),'$lt',_0xfc22('0x31'),_0xfc22('0x32'),_0xfc22('0x33'),'$not',_0xfc22('0x34'),_0xfc22('0x35'),_0xfc22('0x36'),_0xfc22('0x37'),_0xfc22('0x38'),_0xfc22('0x39'),'$iLike',_0xfc22('0x3a'),'$like',_0xfc22('0x3b'),_0xfc22('0x3c'),_0xfc22('0x3d'),_0xfc22('0x3e')]);_0x1429ff[_0xfc22('0x3f')]=_[_0xfc22('0x2b')](_0x985195['model'],qs['fields'](_0xc51f68[_0xfc22('0x28')][_0xfc22('0x40')]));_0x1429ff[_0xfc22('0x3f')]=_0x1429ff[_0xfc22('0x3f')][_0xfc22('0x41')]?_0x1429ff[_0xfc22('0x3f')]:_0x985195[_0xfc22('0x42')];if(!_0xc51f68[_0xfc22('0x28')][_0xfc22('0x43')](_0xfc22('0x44'))){_0x1429ff[_0xfc22('0x1b')]=qs[_0xfc22('0x1b')](_0xc51f68['query']['limit']);_0x1429ff['offset']=qs[_0xfc22('0x1a')](_0xc51f68['query'][_0xfc22('0x1a')]);}_0x1429ff[_0xfc22('0x45')]=qs['sort'](_0xc51f68[_0xfc22('0x28')][_0xfc22('0x46')]);_0x1429ff[_0xfc22('0x47')]=qs['filters'](_[_0xfc22('0x48')](_0xc51f68[_0xfc22('0x28')],_0x985195['filters']));if(_0xc51f68[_0xfc22('0x28')][_0xfc22('0x49')]){_0x1429ff[_0xfc22('0x47')]=_['merge'](_0x1429ff[_0xfc22('0x47')],{'$or':_[_0xfc22('0x24')](_0x2b4436,function(_0xf61a21){if(_0xf61a21[_0xfc22('0x26')]!==_0xfc22('0x4a')){var _0x270335={};_0x270335[_0xf61a21[_0xfc22('0x22')]]={'$like':'%'+_0xc51f68[_0xfc22('0x28')][_0xfc22('0x49')]+'%'};return _0x270335;}})});}_0x1429ff=_[_0xfc22('0x4b')]({},_0x1429ff,_0xc51f68['options']);var _0x165777={'where':_0x1429ff[_0xfc22('0x47')]};return db[_0xfc22('0x4c')]['count'](_0x165777)[_0xfc22('0x1f')](function(_0x4cee2c){_0x44cb5b[_0xfc22('0x19')]=_0x4cee2c;if(_0xc51f68['query'][_0xfc22('0x4d')]){_0x1429ff[_0xfc22('0x4e')]=[{'all':!![]}];}return db[_0xfc22('0x4c')][_0xfc22('0x4f')](_0x1429ff);})[_0xfc22('0x1f')](function(_0x8108f8){_0x44cb5b['rows']=_0x8108f8;return _0x44cb5b;})['then'](respondWithFilteredResult(_0x1adb7b,_0x1429ff))[_0xfc22('0x50')](handleError(_0x1adb7b,null));};exports['show']=function(_0x5ca35b,_0x1bc795){var _0x2f6b48={'raw':!![],'where':{'id':_0x5ca35b[_0xfc22('0x51')]['id']}},_0x432ddc={};_0x432ddc['model']=_['keys'](db[_0xfc22('0x4c')][_0xfc22('0x52')]);_0x432ddc[_0xfc22('0x28')]=_[_0xfc22('0x29')](_0x5ca35b[_0xfc22('0x28')]);_0x432ddc['filters']=_['intersection'](_0x432ddc[_0xfc22('0x42')],_0x432ddc['query']);_0x2f6b48[_0xfc22('0x3f')]=_[_0xfc22('0x2b')](_0x432ddc[_0xfc22('0x42')],qs['fields'](_0x5ca35b[_0xfc22('0x28')][_0xfc22('0x40')]));_0x2f6b48[_0xfc22('0x3f')]=_0x2f6b48[_0xfc22('0x3f')][_0xfc22('0x41')]?_0x2f6b48[_0xfc22('0x3f')]:_0x432ddc[_0xfc22('0x42')];if(_0x5ca35b[_0xfc22('0x28')]['includeAll']){_0x2f6b48[_0xfc22('0x4e')]=[{'all':!![]}];}_0x2f6b48=_[_0xfc22('0x4b')]({},_0x2f6b48,_0x5ca35b[_0xfc22('0x53')]);return db[_0xfc22('0x4c')]['find'](_0x2f6b48)[_0xfc22('0x1f')](handleEntityNotFound(_0x1bc795,null))[_0xfc22('0x1f')](respondWithResult(_0x1bc795,null))[_0xfc22('0x50')](handleError(_0x1bc795,null));};exports['create']=function(_0x382e58,_0x4ac92b){return db['CmHopper'][_0xfc22('0x54')](_0x382e58[_0xfc22('0x55')],{})['then'](respondWithResult(_0x4ac92b,0xc9))[_0xfc22('0x50')](handleError(_0x4ac92b,null));};exports[_0xfc22('0x1e')]=function(_0x3ceb02,_0x392f05){if(_0x3ceb02[_0xfc22('0x55')]['id']){delete _0x3ceb02['body']['id'];}return db[_0xfc22('0x4c')][_0xfc22('0x56')]({'where':{'id':_0x3ceb02['params']['id']}})['then'](handleEntityNotFound(_0x392f05,null))['then'](saveUpdates(_0x3ceb02[_0xfc22('0x55')],null))[_0xfc22('0x1f')](respondWithResult(_0x392f05,null))['catch'](handleError(_0x392f05,null));};exports[_0xfc22('0x57')]=function(_0x2c4bd6,_0x368540){return db[_0xfc22('0x4c')]['describe']()['then'](respondWithResult(_0x368540,null))[_0xfc22('0x50')](handleError(_0x368540,null));};exports['destroy']=function(_0x28ef9f,_0x3f81b2){var _0x55f2aa;return db['CmHopper'][_0xfc22('0x56')]({'where':{'id':_0x28ef9f[_0xfc22('0x51')]['id']}})[_0xfc22('0x1f')](handleEntityNotFound(_0x3f81b2,null))['then'](function(_0x133b89){if(_0x133b89){return _0x133b89['destroy']()[_0xfc22('0x1f')](function(_0x9042c8){return _0x9042c8;});}})[_0xfc22('0x1f')](function(_0x59bfff){_0x55f2aa=_0x59bfff;if(_0x59bfff){if(_0x59bfff['VoiceQueueId']||_0x59bfff[_0xfc22('0x58')]){return db[_0x59bfff['VoiceQueueId']?_0xfc22('0x59'):'Campaign'][_0xfc22('0x56')]({'where':{'id':_0x59bfff[_0xfc22('0x5a')]?_0x59bfff[_0xfc22('0x5a')]:_0x59bfff['CampaignId']},'attributes':['id',_0xfc22('0x22')],'raw':!![]});}}})['then'](function(_0x5e0505){var _0x4c1a24={};if(_0x5e0505){_[_0xfc22('0x4b')](_0x4c1a24,_['omit'](_0x55f2aa[_0xfc22('0x5b')],[_0xfc22('0x5c'),_0xfc22('0x5d'),'id']));_0x4c1a24[_0xfc22('0x5e')]=0x15;_0x4c1a24[_0xfc22('0x5f')]=_0xfc22('0x60');_0x4c1a24['campaign']=_0x5e0505[_0xfc22('0x22')];_0x4c1a24['membername']=_0x28ef9f[_0xfc22('0x61')][_0xfc22('0x22')];_0x4c1a24[_0xfc22('0x62')]=_0x28ef9f[_0xfc22('0x61')]['id'];_0x4c1a24[_0xfc22('0x60')]=!![];_0x4c1a24['deletedat']=moment()[_0xfc22('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c1a24['calleridnum']=_0x55f2aa[_0xfc22('0x64')];_0x4c1a24[_0xfc22('0x65')]=_0x55f2aa[_0xfc22('0x5a')]?_0xfc22('0x66'):'ivr';return db[_0xfc22('0x67')][_0xfc22('0x56')]({'where':{'id':_0x4c1a24[_0xfc22('0x68')]},'attributes':['firstName','lastName']})[_0xfc22('0x1f')](function(_0x5283d7){if(!_[_0xfc22('0x69')](_0x3f81b2)&&!_[_0xfc22('0x69')](_0x5283d7[_0xfc22('0x6a')])){_0x4c1a24[_0xfc22('0x6b')]=_0x5283d7[_0xfc22('0x6a')];if(!_['isNil'](_0x5283d7[_0xfc22('0x6c')])){_0x4c1a24[_0xfc22('0x6b')]+='\x20'+_0x5283d7[_0xfc22('0x6c')];}}})[_0xfc22('0x6d')](function(){return db[_0xfc22('0x6e')][_0xfc22('0x54')](_0x4c1a24);});}})['then'](function(){return _0x3f81b2[_0xfc22('0x18')](0xcc)['end']();})[_0xfc22('0x50')](handleError(_0x3f81b2,null));};exports[_0xfc22('0x6f')]=function(_0x279446,_0x1438a9,_0x4be312){var _0x38dae9=[];return db[_0xfc22('0x67')][_0xfc22('0x57')]()['then'](function(_0x1156c9){_0x38dae9=_[_0xfc22('0x29')](_0x1156c9);return _0x279446[_0xfc22('0x61')][_0xfc22('0x70')]({'where':{'type':_0xfc22('0x71'),'dialActive':!![],'dialMethod':_0xfc22('0x72')},'attributes':['id',_0xfc22('0x73')],'raw':!![]});})[_0xfc22('0x1f')](function(_0x10fae3){if(_0x10fae3&&_0x10fae3[_0xfc22('0x41')]){return db['sequelize']['transaction'](function(_0x422913){var _0x385804={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xfc22('0x63')](_0xfc22('0x74'))},'VoiceQueueId':{'$in':_[_0xfc22('0x24')](_0x10fae3,'id')},'$or':[{'UserId':null},{'UserId':_0x279446[_0xfc22('0x61')]['id']}]};var _0x4d6bf7=[];if(_0x279446['body']['direction']&&_0x279446[_0xfc22('0x55')][_0xfc22('0x75')]==='prev'){if(!_[_0xfc22('0x76')](_0x279446[_0xfc22('0x55')]['hopperIds'])){_0x385804['id']={'$in':_0x279446['body'][_0xfc22('0x77')]};}_0x4d6bf7=[[_0xfc22('0x78'),_0xfc22('0x79')],['scheduledAt',_0x10fae3[0x0][_0xfc22('0x73')]==='ASC'?_0xfc22('0x7a'):_0xfc22('0x79')],db[_0xfc22('0x7b')][_0xfc22('0x7c')](_0xfc22('0x7d')),['id',_0xfc22('0x7a')]];}else{if(!_['isEmpty'](_0x279446[_0xfc22('0x55')][_0xfc22('0x77')])){_0x385804['id']={'$notIn':_0x279446[_0xfc22('0x55')][_0xfc22('0x77')]};}_0x4d6bf7=[[_0xfc22('0x78'),_0xfc22('0x7a')],[_0xfc22('0x7e'),_0x10fae3[0x0][_0xfc22('0x73')]],db[_0xfc22('0x7b')][_0xfc22('0x7c')](_0xfc22('0x7f')),['id',_0xfc22('0x79')]];}return db[_0xfc22('0x4c')][_0xfc22('0x80')]({'attributes':['id',_0xfc22('0x81')],'where':_0x385804,'order':_0x4d6bf7,'transaction':_0x422913,'lock':_0x422913['LOCK']['UPDATE'],'include':[{'model':db[_0xfc22('0x67')],'as':_0xfc22('0x82'),'attributes':_0x38dae9,'include':[{'model':db[_0xfc22('0x83')],'as':'Company','attributes':['id',_0xfc22('0x22')]}]},{'model':db[_0xfc22('0x84')],'as':'List','attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0xfc22('0x85'),'attributes':['id',_0xfc22('0x22'),_0xfc22('0x86')]}]})[_0xfc22('0x1f')](function(_0x2fcfcd){if(_0x2fcfcd){return _0x2fcfcd[_0xfc22('0x1e')]({'UserId':_0x279446[_0xfc22('0x61')]['id']},{'transaction':_0x422913});}});});}})[_0xfc22('0x1f')](handleEntityNotFound(_0x1438a9,null))[_0xfc22('0x1f')](respondWithResult(_0x1438a9,null))['catch'](handleError(_0x1438a9,null));};exports[_0xfc22('0x87')]=function(_0x3d97bb,_0x531341,_0x5a86c5){return _0x3d97bb['user'][_0xfc22('0x70')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xfc22('0x72')},'attributes':['id'],'raw':!![]})[_0xfc22('0x1f')](function(_0x1262a3){if(_0x1262a3&&_0x1262a3[_0xfc22('0x41')]){return db[_0xfc22('0x4c')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xfc22('0x63')](_0xfc22('0x74'))},'VoiceQueueId':{'$in':_['map'](_0x1262a3,'id')},'$or':[{'UserId':null},{'UserId':_0x3d97bb['user']['id']}]}});}return 0x0;})[_0xfc22('0x1f')](function(_0x57a9d2){if(!_[_0xfc22('0x69')](_0x57a9d2)&&_[_0xfc22('0x88')](_0x57a9d2)){return _0x531341[_0xfc22('0x18')](0xc8)[_0xfc22('0x1d')]({'contacts':_0x57a9d2});}else{logger[_0xfc22('0x21')](_0xfc22('0x89'),_0xfc22('0x87'),0x194,_0xfc22('0x8a'));_0x531341['sendStatus'](0x194);}})[_0xfc22('0x50')](handleError(_0x531341,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 2b13b1e..38ad569 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 _0xdb1d=['request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone','priority','util','api','moment'];(function(_0x3cfa25,_0x2606a6){var _0x4c3201=function(_0x423801){while(--_0x423801){_0x3cfa25['push'](_0x3cfa25['shift']());}};_0x4c3201(++_0x2606a6);}(_0xdb1d,0x65));var _0xddb1=function(_0x172623,_0x53aaa0){_0x172623=_0x172623-0x0;var _0x5bb26a=_0xdb1d[_0x172623];return _0x5bb26a;};'use strict';var _=require('lodash');var util=require(_0xddb1('0x0'));var logger=require('../../config/logger')(_0xddb1('0x1'));var moment=require(_0xddb1('0x2'));var BPromise=require('bluebird');var rp=require(_0xddb1('0x3'));var fs=require('fs');var path=require(_0xddb1('0x4'));var rimraf=require(_0xddb1('0x5'));var config=require(_0xddb1('0x6'));var attributes=require(_0xddb1('0x7'));module['exports']=function(_0x1d5dd3,_0x4e3f93){return _0x1d5dd3[_0xddb1('0x8')](_0xddb1('0x9'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xddb1('0xa'),'fields':[_0xddb1('0xa')]},{'name':_0xddb1('0xb'),'fields':[_0xddb1('0xb')]},{'name':_0xddb1('0xc'),'fields':[_0xddb1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5130=['path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone','priority','lodash','api','moment'];(function(_0xfbab52,_0x2425d1){var _0x35a8b2=function(_0x45441d){while(--_0x45441d){_0xfbab52['push'](_0xfbab52['shift']());}};_0x35a8b2(++_0x2425d1);}(_0x5130,0xa6));var _0x0513=function(_0x27031e,_0x1eb8cd){_0x27031e=_0x27031e-0x0;var _0xfd46b3=_0x5130[_0x27031e];return _0xfd46b3;};'use strict';var _=require(_0x0513('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0513('0x1'));var moment=require(_0x0513('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0513('0x3'));var rimraf=require(_0x0513('0x4'));var config=require(_0x0513('0x5'));var attributes=require(_0x0513('0x6'));module[_0x0513('0x7')]=function(_0xc3f181,_0xd3672c){return _0xc3f181[_0x0513('0x8')]('CmHopper',attributes,{'tableName':_0x0513('0x9'),'paranoid':![],'indexes':[{'name':_0x0513('0xa'),'fields':[_0x0513('0xa')]},{'name':_0x0513('0xb'),'fields':['phone']},{'name':_0x0513('0xc'),'fields':[_0x0513('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 39721f0..52b8a05 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 _0xb10b=['order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','all','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowCmHopper','CreateCmHopper','create','body','update','limit','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb10b,0x12a));var _0xbb10=function(_0x259449,_0x32f882){_0x259449=_0x259449-0x0;var _0x321ae4=_0xb10b[_0x259449];return _0x321ae4;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetCmHopper',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowCmHopper']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowCmHopper',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});};exports[_0xbb10('0x22')]=function(_0x4d5a9b){var _0x3c0cd7=this;return new Promise(function(_0x3e8538,_0x4345f3){return db['CmHopper'][_0xbb10('0x23')](_0x4d5a9b[_0xbb10('0x24')],{'raw':_0x4d5a9b[_0xbb10('0x18')]?_0x4d5a9b[_0xbb10('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0x110eb5){logger['info'](_0xbb10('0x22'),_0x4d5a9b);logger[_0xbb10('0x1f')](_0xbb10('0x22'),_0x4d5a9b,JSON[_0xbb10('0x11')](_0x110eb5));_0x3e8538(_0x110eb5);})[_0xbb10('0x20')](function(_0x185a52){logger['error'](_0xbb10('0x22'),_0x185a52[_0xbb10('0x13')],_0x4d5a9b);_0x4345f3(_0x3c0cd7[_0xbb10('0x12')](0x1f4,_0x185a52[_0xbb10('0x13')]));});});};exports['UpdateCmHopper']=function(_0x3fff6c){var _0x331751=this;return new Promise(function(_0x23dc18,_0x403beb){return db['CmHopper'][_0xbb10('0x25')](_0x3fff6c[_0xbb10('0x24')],{'raw':_0x3fff6c['options']?_0x3fff6c['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x3fff6c[_0xbb10('0x18')]?_0x3fff6c['options'][_0xbb10('0x26')]||null:null})[_0xbb10('0xc')](function(_0x3b9fdf){logger[_0xbb10('0xd')](_0xbb10('0x27'),_0x3fff6c);logger[_0xbb10('0x1f')](_0xbb10('0x27'),_0x3fff6c,JSON[_0xbb10('0x11')](_0x3b9fdf));_0x23dc18(_0x3b9fdf);})[_0xbb10('0x20')](function(_0x43b948){logger[_0xbb10('0x12')](_0xbb10('0x27'),_0x43b948['message'],_0x3fff6c);_0x403beb(_0x331751[_0xbb10('0x12')](0x1f4,_0x43b948[_0xbb10('0x13')]));});});};exports['DestroyCmHopper']=function(_0x14e1cb){var _0x2f5027=this;return new Promise(function(_0x1a7df6,_0x5a5226){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x14e1cb[_0xbb10('0x18')]?_0x14e1cb['options']['where']||null:null})[_0xbb10('0xc')](function(_0x76a208){logger[_0xbb10('0xd')]('DestroyCmHopper',_0x14e1cb);logger['debug'](_0xbb10('0x29'),_0x14e1cb,JSON[_0xbb10('0x11')](_0x76a208));_0x1a7df6(_0x76a208);})[_0xbb10('0x20')](function(_0xf820fe){logger[_0xbb10('0x12')](_0xbb10('0x29'),_0xf820fe[_0xbb10('0x13')],_0x14e1cb);_0x5a5226(_0x2f5027[_0xbb10('0x12')](0x1f4,_0xf820fe[_0xbb10('0x13')]));});});};exports[_0xbb10('0x2a')]=function(_0x550111){var _0x5eafac=this;return new Promise(function(_0x412e13,_0x467dba){return db[_0xbb10('0x2b')][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x440f9e){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x1c0d8f){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'where':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x550111[_0xbb10('0x18')]?_0x550111['options'][_0xbb10('0x1b')]||null:null,'limit':_0x550111['options']?_0x550111[_0xbb10('0x18')][_0xbb10('0x26')]||null:null,'order':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x2f')]||null:null,'transaction':_0x1c0d8f,'lock':_0x1c0d8f[_0xbb10('0x30')][_0xbb10('0x31')],'include':[{'model':db[_0xbb10('0x2b')],'as':_0xbb10('0x32'),'attributes':_[_0xbb10('0x33')](_0x440f9e)},{'model':db[_0xbb10('0x34')],'as':_0xbb10('0x35'),'attributes':['id',_0xbb10('0x36'),_0xbb10('0x37')]}]})[_0xbb10('0xc')](function(_0x5de0cc){var _0x4571b6=[];for(var _0x466eb7=0x0;_0x466eb7<_0x5de0cc[_0xbb10('0x38')];_0x466eb7+=0x1){_0x4571b6[_0xbb10('0x39')](_0x5de0cc[_0x466eb7][_0xbb10('0x25')](_0x550111[_0xbb10('0x24')],{'transaction':_0x1c0d8f}));}return BPromise['all'](_0x4571b6);});})[_0xbb10('0xc')](function(_0x4731ce){logger[_0xbb10('0xd')](_0xbb10('0x2a'),_0x550111);logger[_0xbb10('0x1f')](_0xbb10('0x2a'),_0x550111,JSON[_0xbb10('0x11')](_0x4731ce));_0x412e13(_0x4731ce);})[_0xbb10('0x20')](function(_0x205e01){logger[_0xbb10('0x12')](_0xbb10('0x2a'),_0x205e01[_0xbb10('0x13')],_0x550111);_0x467dba(_0x5eafac[_0xbb10('0x12')](0x1f4,_0x205e01['message']));});});});};exports['MoveContactManagedDialer']=function(_0x16272d){var _0x3e6338=this;return new Promise(function(_0x3d0cb7,_0x8b0a7d){return db['sequelize']['transaction'](function(_0x79411e){return db[_0xbb10('0x3a')][_0xbb10('0x23')](_0x16272d[_0xbb10('0x24')],{'raw':_0x16272d[_0xbb10('0x18')]?_0x16272d[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'transaction':_0x79411e})['then'](function(){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x16272d['options']?_0x16272d['options']['where']||null:null,'transaction':_0x79411e});});})[_0xbb10('0xc')](function(_0x31c727){logger[_0xbb10('0xd')]('MoveContactManagedDialer',_0x16272d);logger['debug']('MoveContactManagedDialer',_0x16272d,JSON[_0xbb10('0x11')](_0x31c727));_0x3d0cb7(_0x31c727);})[_0xbb10('0x20')](function(_0x45167a){logger['error'](_0xbb10('0x3b'),_0x45167a[_0xbb10('0x13')],_0x16272d);_0x8b0a7d(_0x3e6338['error'](0x1f4,_0x45167a['message']));});});};exports[_0xbb10('0x3c')]=function(_0x308896){var _0xd77753=this;return new Promise(function(_0x237246,_0x54b7c5){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x308896[_0xbb10('0x18')]?_0x308896['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x308896[_0xbb10('0x18')]?_0x308896[_0xbb10('0x18')]['where']||null:null,'attributes':[[db[_0xbb10('0x2d')]['fn'](_0xbb10('0x3d'),db[_0xbb10('0x2d')]['fn']('IF',db[_0xbb10('0x2d')]['literal'](_0xbb10('0x3e')+util[_0xbb10('0x3f')](_0xbb10('0x40'),moment()[_0xbb10('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xbb10('0x41')))),_0xbb10('0x42')]]})[_0xbb10('0xc')](function(_0x2ceb3e){logger[_0xbb10('0xd')](_0xbb10('0x3c'),_0x308896);logger[_0xbb10('0x1f')]('CountReScheduled',_0x308896,JSON['stringify'](_0x2ceb3e));_0x237246(_0x2ceb3e);})['catch'](function(_0xdfbc0b){logger[_0xbb10('0x12')](_0xbb10('0x3c'),_0xdfbc0b['message'],_0x308896);_0x54b7c5(_0xd77753['error'](0x1f4,_0xdfbc0b[_0xbb10('0x13')]));});});};exports[_0xbb10('0x43')]=function(_0xd9e743){var _0x3a9677=this;return new Promise(function(_0x260e06,_0x1ad2ed){return db['CmContact'][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x270fdb){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x5bfc68){return db['CmHopper']['findAll']({'where':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':0x1,'order':_0xd9e743['options']?_0xd9e743[_0xbb10('0x18')]['order']||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x5bfc68,'lock':_0x5bfc68[_0xbb10('0x30')][_0xbb10('0x31')],'include':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0xd9e743['options']['include'],function(_0x165fe9){return{'model':db[_0x165fe9[_0xbb10('0x1e')]],'as':_0x165fe9['as'],'attributes':_0x165fe9[_0xbb10('0x1b')],'include':_0x165fe9[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x165fe9['include'],function(_0x2d52ea){return{'model':db[_0x2d52ea[_0xbb10('0x1e')]],'as':_0x2d52ea['as'],'attributes':_0x2d52ea[_0xbb10('0x1b')],'include':_0x2d52ea[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x2d52ea[_0xbb10('0x1c')],function(_0x174395){return{'model':db[_0x174395['model']],'as':_0x174395['as'],'attributes':_0x174395[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x30f3ea){var _0x322b41=[];for(var _0x37b20e=0x0;_0x37b20e<_0x30f3ea[_0xbb10('0x38')];_0x37b20e+=0x1){_0x322b41[_0xbb10('0x39')](_0x30f3ea[_0x37b20e][_0xbb10('0x25')](_0xd9e743['body'],{'transaction':_0x5bfc68}));}return BPromise[_0xbb10('0x44')](_0x322b41);});})[_0xbb10('0xc')](function(_0x145baf){logger['info']('GetContactRecallMe',_0xd9e743);logger['debug'](_0xbb10('0x43'),_0xd9e743,JSON['stringify'](_0x145baf));_0x260e06(_0x145baf);})['catch'](function(_0x1701c5){logger[_0xbb10('0x12')](_0xbb10('0x43'),_0x1701c5[_0xbb10('0x13')],_0xd9e743);_0x1ad2ed(_0x3a9677[_0xbb10('0x12')](0x1f4,_0x1701c5[_0xbb10('0x13')]));});});});}; \ No newline at end of file +var _0xb10b=['order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','all','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowCmHopper','CreateCmHopper','create','body','update','limit','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb10b,0x12a));var _0xbb10=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0xb10b[_0x946518];return _0x909b69;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetCmHopper',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowCmHopper']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowCmHopper',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});};exports[_0xbb10('0x22')]=function(_0x4d5a9b){var _0x3c0cd7=this;return new Promise(function(_0x3e8538,_0x4345f3){return db['CmHopper'][_0xbb10('0x23')](_0x4d5a9b[_0xbb10('0x24')],{'raw':_0x4d5a9b[_0xbb10('0x18')]?_0x4d5a9b[_0xbb10('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0x110eb5){logger['info'](_0xbb10('0x22'),_0x4d5a9b);logger[_0xbb10('0x1f')](_0xbb10('0x22'),_0x4d5a9b,JSON[_0xbb10('0x11')](_0x110eb5));_0x3e8538(_0x110eb5);})[_0xbb10('0x20')](function(_0x185a52){logger['error'](_0xbb10('0x22'),_0x185a52[_0xbb10('0x13')],_0x4d5a9b);_0x4345f3(_0x3c0cd7[_0xbb10('0x12')](0x1f4,_0x185a52[_0xbb10('0x13')]));});});};exports['UpdateCmHopper']=function(_0x3fff6c){var _0x331751=this;return new Promise(function(_0x23dc18,_0x403beb){return db['CmHopper'][_0xbb10('0x25')](_0x3fff6c[_0xbb10('0x24')],{'raw':_0x3fff6c['options']?_0x3fff6c['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x3fff6c[_0xbb10('0x18')]?_0x3fff6c['options'][_0xbb10('0x26')]||null:null})[_0xbb10('0xc')](function(_0x3b9fdf){logger[_0xbb10('0xd')](_0xbb10('0x27'),_0x3fff6c);logger[_0xbb10('0x1f')](_0xbb10('0x27'),_0x3fff6c,JSON[_0xbb10('0x11')](_0x3b9fdf));_0x23dc18(_0x3b9fdf);})[_0xbb10('0x20')](function(_0x43b948){logger[_0xbb10('0x12')](_0xbb10('0x27'),_0x43b948['message'],_0x3fff6c);_0x403beb(_0x331751[_0xbb10('0x12')](0x1f4,_0x43b948[_0xbb10('0x13')]));});});};exports['DestroyCmHopper']=function(_0x14e1cb){var _0x2f5027=this;return new Promise(function(_0x1a7df6,_0x5a5226){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x14e1cb[_0xbb10('0x18')]?_0x14e1cb['options']['where']||null:null})[_0xbb10('0xc')](function(_0x76a208){logger[_0xbb10('0xd')]('DestroyCmHopper',_0x14e1cb);logger['debug'](_0xbb10('0x29'),_0x14e1cb,JSON[_0xbb10('0x11')](_0x76a208));_0x1a7df6(_0x76a208);})[_0xbb10('0x20')](function(_0xf820fe){logger[_0xbb10('0x12')](_0xbb10('0x29'),_0xf820fe[_0xbb10('0x13')],_0x14e1cb);_0x5a5226(_0x2f5027[_0xbb10('0x12')](0x1f4,_0xf820fe[_0xbb10('0x13')]));});});};exports[_0xbb10('0x2a')]=function(_0x550111){var _0x5eafac=this;return new Promise(function(_0x412e13,_0x467dba){return db[_0xbb10('0x2b')][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x440f9e){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x1c0d8f){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'where':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x550111[_0xbb10('0x18')]?_0x550111['options'][_0xbb10('0x1b')]||null:null,'limit':_0x550111['options']?_0x550111[_0xbb10('0x18')][_0xbb10('0x26')]||null:null,'order':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x2f')]||null:null,'transaction':_0x1c0d8f,'lock':_0x1c0d8f[_0xbb10('0x30')][_0xbb10('0x31')],'include':[{'model':db[_0xbb10('0x2b')],'as':_0xbb10('0x32'),'attributes':_[_0xbb10('0x33')](_0x440f9e)},{'model':db[_0xbb10('0x34')],'as':_0xbb10('0x35'),'attributes':['id',_0xbb10('0x36'),_0xbb10('0x37')]}]})[_0xbb10('0xc')](function(_0x5de0cc){var _0x4571b6=[];for(var _0x466eb7=0x0;_0x466eb7<_0x5de0cc[_0xbb10('0x38')];_0x466eb7+=0x1){_0x4571b6[_0xbb10('0x39')](_0x5de0cc[_0x466eb7][_0xbb10('0x25')](_0x550111[_0xbb10('0x24')],{'transaction':_0x1c0d8f}));}return BPromise['all'](_0x4571b6);});})[_0xbb10('0xc')](function(_0x4731ce){logger[_0xbb10('0xd')](_0xbb10('0x2a'),_0x550111);logger[_0xbb10('0x1f')](_0xbb10('0x2a'),_0x550111,JSON[_0xbb10('0x11')](_0x4731ce));_0x412e13(_0x4731ce);})[_0xbb10('0x20')](function(_0x205e01){logger[_0xbb10('0x12')](_0xbb10('0x2a'),_0x205e01[_0xbb10('0x13')],_0x550111);_0x467dba(_0x5eafac[_0xbb10('0x12')](0x1f4,_0x205e01['message']));});});});};exports['MoveContactManagedDialer']=function(_0x16272d){var _0x3e6338=this;return new Promise(function(_0x3d0cb7,_0x8b0a7d){return db['sequelize']['transaction'](function(_0x79411e){return db[_0xbb10('0x3a')][_0xbb10('0x23')](_0x16272d[_0xbb10('0x24')],{'raw':_0x16272d[_0xbb10('0x18')]?_0x16272d[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'transaction':_0x79411e})['then'](function(){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x16272d['options']?_0x16272d['options']['where']||null:null,'transaction':_0x79411e});});})[_0xbb10('0xc')](function(_0x31c727){logger[_0xbb10('0xd')]('MoveContactManagedDialer',_0x16272d);logger['debug']('MoveContactManagedDialer',_0x16272d,JSON[_0xbb10('0x11')](_0x31c727));_0x3d0cb7(_0x31c727);})[_0xbb10('0x20')](function(_0x45167a){logger['error'](_0xbb10('0x3b'),_0x45167a[_0xbb10('0x13')],_0x16272d);_0x8b0a7d(_0x3e6338['error'](0x1f4,_0x45167a['message']));});});};exports[_0xbb10('0x3c')]=function(_0x308896){var _0xd77753=this;return new Promise(function(_0x237246,_0x54b7c5){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x308896[_0xbb10('0x18')]?_0x308896['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x308896[_0xbb10('0x18')]?_0x308896[_0xbb10('0x18')]['where']||null:null,'attributes':[[db[_0xbb10('0x2d')]['fn'](_0xbb10('0x3d'),db[_0xbb10('0x2d')]['fn']('IF',db[_0xbb10('0x2d')]['literal'](_0xbb10('0x3e')+util[_0xbb10('0x3f')](_0xbb10('0x40'),moment()[_0xbb10('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xbb10('0x41')))),_0xbb10('0x42')]]})[_0xbb10('0xc')](function(_0x2ceb3e){logger[_0xbb10('0xd')](_0xbb10('0x3c'),_0x308896);logger[_0xbb10('0x1f')]('CountReScheduled',_0x308896,JSON['stringify'](_0x2ceb3e));_0x237246(_0x2ceb3e);})['catch'](function(_0xdfbc0b){logger[_0xbb10('0x12')](_0xbb10('0x3c'),_0xdfbc0b['message'],_0x308896);_0x54b7c5(_0xd77753['error'](0x1f4,_0xdfbc0b[_0xbb10('0x13')]));});});};exports[_0xbb10('0x43')]=function(_0xd9e743){var _0x3a9677=this;return new Promise(function(_0x260e06,_0x1ad2ed){return db['CmContact'][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x270fdb){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x5bfc68){return db['CmHopper']['findAll']({'where':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':0x1,'order':_0xd9e743['options']?_0xd9e743[_0xbb10('0x18')]['order']||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x5bfc68,'lock':_0x5bfc68[_0xbb10('0x30')][_0xbb10('0x31')],'include':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0xd9e743['options']['include'],function(_0x165fe9){return{'model':db[_0x165fe9[_0xbb10('0x1e')]],'as':_0x165fe9['as'],'attributes':_0x165fe9[_0xbb10('0x1b')],'include':_0x165fe9[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x165fe9['include'],function(_0x2d52ea){return{'model':db[_0x2d52ea[_0xbb10('0x1e')]],'as':_0x2d52ea['as'],'attributes':_0x2d52ea[_0xbb10('0x1b')],'include':_0x2d52ea[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x2d52ea[_0xbb10('0x1c')],function(_0x174395){return{'model':db[_0x174395['model']],'as':_0x174395['as'],'attributes':_0x174395[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x30f3ea){var _0x322b41=[];for(var _0x37b20e=0x0;_0x37b20e<_0x30f3ea[_0xbb10('0x38')];_0x37b20e+=0x1){_0x322b41[_0xbb10('0x39')](_0x30f3ea[_0x37b20e][_0xbb10('0x25')](_0xd9e743['body'],{'transaction':_0x5bfc68}));}return BPromise[_0xbb10('0x44')](_0x322b41);});})[_0xbb10('0xc')](function(_0x145baf){logger['info']('GetContactRecallMe',_0xd9e743);logger['debug'](_0xbb10('0x43'),_0xd9e743,JSON['stringify'](_0x145baf));_0x260e06(_0x145baf);})['catch'](function(_0x1701c5){logger[_0xbb10('0x12')](_0xbb10('0x43'),_0x1701c5[_0xbb10('0x13')],_0xd9e743);_0x1ad2ed(_0x3a9677[_0xbb10('0x12')](0x1f4,_0x1701c5[_0xbb10('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 5a71c2f..c3352e3 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 _0xd878=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','create','post','/preview','getPreview','/:id','update','destroy'];(function(_0x50787f,_0x3cab34){var _0x52842f=function(_0xe29611){while(--_0xe29611){_0x50787f['push'](_0x50787f['shift']());}};_0x52842f(++_0x3cab34);}(_0xd878,0x118));var _0x8d87=function(_0x5bd6b5,_0x16ee81){_0x5bd6b5=_0x5bd6b5-0x0;var _0x15316f=_0xd878[_0x5bd6b5];return _0x15316f;};'use strict';var multer=require(_0x8d87('0x0'));var util=require(_0x8d87('0x1'));var path=require(_0x8d87('0x2'));var timeout=require(_0x8d87('0x3'));var express=require(_0x8d87('0x4'));var router=express[_0x8d87('0x5')]();var auth=require(_0x8d87('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopper.controller');router[_0x8d87('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8d87('0x7')](_0x8d87('0x8'),auth[_0x8d87('0x9')](),controller[_0x8d87('0xa')]);router[_0x8d87('0x7')](_0x8d87('0xb'),auth[_0x8d87('0x9')](),controller[_0x8d87('0xc')]);router[_0x8d87('0x7')]('/:id',auth[_0x8d87('0x9')](),controller['show']);router['post']('/',auth[_0x8d87('0x9')](),controller[_0x8d87('0xd')]);router[_0x8d87('0xe')](_0x8d87('0xf'),auth[_0x8d87('0x9')](),controller[_0x8d87('0x10')]);router['put'](_0x8d87('0x11'),auth['isAuthenticated'](),controller[_0x8d87('0x12')]);router['delete'](_0x8d87('0x11'),auth[_0x8d87('0x9')](),controller[_0x8d87('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf79e=['describe','/opencontacts','/:id','show','post','create','getPreview','put','update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe'];(function(_0x565278,_0x37a56d){var _0x5d9777=function(_0x5c168a){while(--_0x5c168a){_0x565278['push'](_0x565278['shift']());}};_0x5d9777(++_0x37a56d);}(_0xf79e,0x185));var _0xef79=function(_0x589c08,_0x264b33){_0x589c08=_0x589c08-0x0;var _0xc21d72=_0xf79e[_0x589c08];return _0xc21d72;};'use strict';var multer=require('multer');var util=require(_0xef79('0x0'));var path=require(_0xef79('0x1'));var timeout=require(_0xef79('0x2'));var express=require('express');var router=express[_0xef79('0x3')]();var auth=require(_0xef79('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xef79('0x5'));router[_0xef79('0x6')]('/',auth[_0xef79('0x7')](),controller[_0xef79('0x8')]);router[_0xef79('0x6')](_0xef79('0x9'),auth['isAuthenticated'](),controller[_0xef79('0xa')]);router['get'](_0xef79('0xb'),auth[_0xef79('0x7')](),controller['getOpenContacts']);router[_0xef79('0x6')](_0xef79('0xc'),auth[_0xef79('0x7')](),controller[_0xef79('0xd')]);router[_0xef79('0xe')]('/',auth[_0xef79('0x7')](),controller[_0xef79('0xf')]);router[_0xef79('0xe')]('/preview',auth[_0xef79('0x7')](),controller[_0xef79('0x10')]);router[_0xef79('0x11')](_0xef79('0xc'),auth[_0xef79('0x7')](),controller[_0xef79('0x12')]);router[_0xef79('0x13')](_0xef79('0xc'),auth[_0xef79('0x7')](),controller[_0xef79('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 0dfb3a5..463ecbb 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 _0x9ca2=['exports','STRING','INTEGER','contactListQueue'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9ca2,0xb0));var _0x29ca=function(_0x1ef1ee,_0x50d68e){_0x1ef1ee=_0x1ef1ee-0x0;var _0x827eb6=_0x9ca2[_0x1ef1ee];return _0x827eb6;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x29ca('0x0')]={'phone':{'type':Sequelize[_0x29ca('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x29ca('0x2')],'unique':_0x29ca('0x3')},'ListId':{'type':Sequelize[_0x29ca('0x2')],'unique':_0x29ca('0x3')},'VoiceQueueId':{'type':Sequelize[_0x29ca('0x2')],'unique':_0x29ca('0x3')}}; \ No newline at end of file +var _0x8128=['INTEGER','contactListQueue','STRING'];(function(_0x24cbc3,_0x30b828){var _0x2bfe6c=function(_0x3f4d87){while(--_0x3f4d87){_0x24cbc3['push'](_0x24cbc3['shift']());}};_0x2bfe6c(++_0x30b828);}(_0x8128,0x173));var _0x8812=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x8128[_0x4fde08];return _0x12e725;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x8812('0x0')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x8812('0x1')],'unique':_0x8812('0x2')},'ListId':{'type':Sequelize[_0x8812('0x1')],'unique':_0x8812('0x2')},'VoiceQueueId':{'type':Sequelize[_0x8812('0x1')],'unique':_0x8812('0x2')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 01975fb..f99413c 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 _0xd945=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CmHopperBlack','includeAll','include','rows','show','find','body','catch','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5ba3c4,_0x3dcb83){var _0x3a4dd6=function(_0x2b9680){while(--_0x2b9680){_0x5ba3c4['push'](_0x5ba3c4['shift']());}};_0x3a4dd6(++_0x3dcb83);}(_0xd945,0x84));var _0x5d94=function(_0x468e81,_0x5bfb20){_0x468e81=_0x468e81-0x0;var _0x569328=_0xd945[_0x468e81];return _0x569328;};'use strict';var pdf=require(_0x5d94('0x0'));var emlformat=require(_0x5d94('0x1'));var rimraf=require(_0x5d94('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d94('0x3'));var rp=require(_0x5d94('0x4'));var moment=require(_0x5d94('0x5'));var BPromise=require(_0x5d94('0x6'));var Mustache=require(_0x5d94('0x7'));var util=require('util');var path=require(_0x5d94('0x8'));var sox=require(_0x5d94('0x9'));var csv=require(_0x5d94('0xa'));var ejs=require(_0x5d94('0xb'));var fs=require('fs');var _=require(_0x5d94('0xc'));var squel=require('squel');var crypto=require(_0x5d94('0xd'));var jsforce=require(_0x5d94('0xe'));var deskjs=require(_0x5d94('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5d94('0x10'));var Papa=require(_0x5d94('0x11'));var Redis=require(_0x5d94('0x12'));var authService=require(_0x5d94('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5d94('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d94('0x15'))(_0x5d94('0x16'));var utils=require(_0x5d94('0x17'));var config=require(_0x5d94('0x18'));var db=require(_0x5d94('0x19'))['db'];function respondWithStatusCode(_0x1c9f77,_0x3451fc){_0x3451fc=_0x3451fc||0xcc;return function(_0x42641b){if(_0x42641b){return _0x1c9f77[_0x5d94('0x1a')](_0x3451fc);}return _0x1c9f77[_0x5d94('0x1b')](_0x3451fc)['end']();};}function respondWithResult(_0x446b5b,_0x47616b){_0x47616b=_0x47616b||0xc8;return function(_0x592b93){if(_0x592b93){return _0x446b5b[_0x5d94('0x1b')](_0x47616b)[_0x5d94('0x1c')](_0x592b93);}};}function respondWithFilteredResult(_0xd78460,_0x10867c){return function(_0x1a0011){if(_0x1a0011){var _0x452a88=_0x1a0011[_0x5d94('0x1d')],_0x5c4d65=_0x10867c[_0x5d94('0x1e')],_0x555419=_0x10867c[_0x5d94('0x1e')]+_0x10867c[_0x5d94('0x1f')],_0x541ef1;if(_0x555419>=_0x452a88){_0x555419=_0x452a88;_0x541ef1=0xc8;}else{_0x541ef1=0xce;}_0xd78460[_0x5d94('0x1b')](_0x541ef1);return _0xd78460['set'](_0x5d94('0x20'),_0x5c4d65+'-'+_0x555419+'/'+_0x452a88)[_0x5d94('0x1c')](_0x1a0011);}return null;};}function patchUpdates(_0x338568){return function(_0x6c8f02){try{jsonpatch[_0x5d94('0x21')](_0x6c8f02,_0x338568,!![]);}catch(_0x45a565){return BPromise[_0x5d94('0x22')](_0x45a565);}return _0x6c8f02[_0x5d94('0x23')]();};}function saveUpdates(_0x36f6d4,_0x141783){return function(_0x1e9524){if(_0x1e9524){return _0x1e9524[_0x5d94('0x24')](_0x36f6d4)[_0x5d94('0x25')](function(_0x4df897){return _0x4df897;});}return null;};}function removeEntity(_0x2da8ba,_0x255e3f){return function(_0x15f9b4){if(_0x15f9b4){return _0x15f9b4[_0x5d94('0x26')]()[_0x5d94('0x25')](function(){_0x2da8ba[_0x5d94('0x1b')](0xcc)[_0x5d94('0x27')]();});}};}function handleEntityNotFound(_0x100832,_0x2f12d9){return function(_0x40c0a6){if(!_0x40c0a6){_0x100832[_0x5d94('0x1a')](0x194);}return _0x40c0a6;};}function handleError(_0x330d46,_0xba30ba){_0xba30ba=_0xba30ba||0x1f4;return function(_0x2c9057){logger[_0x5d94('0x28')](_0x2c9057['stack']);if(_0x2c9057[_0x5d94('0x29')]){delete _0x2c9057[_0x5d94('0x29')];}_0x330d46[_0x5d94('0x1b')](_0xba30ba)[_0x5d94('0x2a')](_0x2c9057);};}exports[_0x5d94('0x2b')]=function(_0x3a84e5,_0x27426f){var _0x140f8a={},_0x2f3b3e={},_0x456c59={'count':0x0,'rows':[]};var _0x235d18=_['map'](db['CmHopperBlack'][_0x5d94('0x2c')],function(_0x54d4df){return{'name':_0x54d4df[_0x5d94('0x2d')],'type':_0x54d4df[_0x5d94('0x2e')][_0x5d94('0x2f')]};});_0x2f3b3e[_0x5d94('0x30')]=_[_0x5d94('0x31')](_0x235d18,_0x5d94('0x29'));_0x2f3b3e[_0x5d94('0x32')]=_[_0x5d94('0x33')](_0x3a84e5[_0x5d94('0x32')]);_0x2f3b3e[_0x5d94('0x34')]=_['intersection'](_0x2f3b3e['model'],_0x2f3b3e[_0x5d94('0x32')]);_0x140f8a[_0x5d94('0x35')]=_[_0x5d94('0x36')](_0x2f3b3e['model'],qs['fields'](_0x3a84e5['query'][_0x5d94('0x37')]));_0x140f8a['attributes']=_0x140f8a[_0x5d94('0x35')][_0x5d94('0x38')]?_0x140f8a[_0x5d94('0x35')]:_0x2f3b3e[_0x5d94('0x30')];if(!_0x3a84e5[_0x5d94('0x32')][_0x5d94('0x39')](_0x5d94('0x3a'))){_0x140f8a[_0x5d94('0x1f')]=qs['limit'](_0x3a84e5[_0x5d94('0x32')][_0x5d94('0x1f')]);_0x140f8a[_0x5d94('0x1e')]=qs[_0x5d94('0x1e')](_0x3a84e5['query']['offset']);}_0x140f8a[_0x5d94('0x3b')]=qs['sort'](_0x3a84e5['query'][_0x5d94('0x3c')]);_0x140f8a[_0x5d94('0x3d')]=qs['filters'](_['pick'](_0x3a84e5[_0x5d94('0x32')],_0x2f3b3e[_0x5d94('0x34')]));if(_0x3a84e5['query'][_0x5d94('0x3e')]){_0x140f8a[_0x5d94('0x3d')]=_[_0x5d94('0x3f')](_0x140f8a[_0x5d94('0x3d')],{'$or':_[_0x5d94('0x31')](_0x235d18,function(_0x32f78a){if(_0x32f78a[_0x5d94('0x2e')]!==_0x5d94('0x40')){var _0x3ff75f={};_0x3ff75f[_0x32f78a[_0x5d94('0x29')]]={'$like':'%'+_0x3a84e5['query'][_0x5d94('0x3e')]+'%'};return _0x3ff75f;}})});}_0x140f8a=_[_0x5d94('0x3f')]({},_0x140f8a,_0x3a84e5[_0x5d94('0x41')]);var _0x240777={'where':_0x140f8a['where']};return db[_0x5d94('0x42')][_0x5d94('0x1d')](_0x240777)['then'](function(_0x52ba1a){_0x456c59[_0x5d94('0x1d')]=_0x52ba1a;if(_0x3a84e5[_0x5d94('0x32')][_0x5d94('0x43')]){_0x140f8a[_0x5d94('0x44')]=[{'all':!![]}];}return db[_0x5d94('0x42')]['findAll'](_0x140f8a);})[_0x5d94('0x25')](function(_0x5a4646){_0x456c59[_0x5d94('0x45')]=_0x5a4646;return _0x456c59;})[_0x5d94('0x25')](respondWithFilteredResult(_0x27426f,_0x140f8a))['catch'](handleError(_0x27426f,null));};exports[_0x5d94('0x46')]=function(_0xf4c197,_0x21c627){var _0x4b9b02={'raw':!![],'where':{'id':_0xf4c197['params']['id']}},_0x1bcbcb={};_0x1bcbcb['model']=_['keys'](db[_0x5d94('0x42')][_0x5d94('0x2c')]);_0x1bcbcb[_0x5d94('0x32')]=_[_0x5d94('0x33')](_0xf4c197['query']);_0x1bcbcb[_0x5d94('0x34')]=_[_0x5d94('0x36')](_0x1bcbcb['model'],_0x1bcbcb['query']);_0x4b9b02[_0x5d94('0x35')]=_[_0x5d94('0x36')](_0x1bcbcb['model'],qs[_0x5d94('0x37')](_0xf4c197['query'][_0x5d94('0x37')]));_0x4b9b02['attributes']=_0x4b9b02[_0x5d94('0x35')][_0x5d94('0x38')]?_0x4b9b02[_0x5d94('0x35')]:_0x1bcbcb[_0x5d94('0x30')];if(_0xf4c197[_0x5d94('0x32')][_0x5d94('0x43')]){_0x4b9b02['include']=[{'all':!![]}];}_0x4b9b02=_[_0x5d94('0x3f')]({},_0x4b9b02,_0xf4c197[_0x5d94('0x41')]);return db[_0x5d94('0x42')][_0x5d94('0x47')](_0x4b9b02)['then'](handleEntityNotFound(_0x21c627,null))[_0x5d94('0x25')](respondWithResult(_0x21c627,null))['catch'](handleError(_0x21c627,null));};exports['update']=function(_0x1a5886,_0x2f59a7){if(_0x1a5886[_0x5d94('0x48')]['id']){delete _0x1a5886[_0x5d94('0x48')]['id'];}return db[_0x5d94('0x42')][_0x5d94('0x47')]({'where':{'id':_0x1a5886['params']['id']}})['then'](handleEntityNotFound(_0x2f59a7,null))[_0x5d94('0x25')](saveUpdates(_0x1a5886[_0x5d94('0x48')],null))[_0x5d94('0x25')](respondWithResult(_0x2f59a7,null))[_0x5d94('0x49')](handleError(_0x2f59a7,null));};exports[_0x5d94('0x26')]=function(_0xb30659,_0x4112a6){return db['CmHopperBlack'][_0x5d94('0x47')]({'where':{'id':_0xb30659[_0x5d94('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4112a6,null))[_0x5d94('0x25')](removeEntity(_0x4112a6,null))[_0x5d94('0x49')](handleError(_0x4112a6,null));};exports[_0x5d94('0x4b')]=function(_0x20b2bc,_0x40e595){return db[_0x5d94('0x42')][_0x5d94('0x4b')]()[_0x5d94('0x25')](respondWithResult(_0x40e595,null))['catch'](handleError(_0x40e595,null));}; \ No newline at end of file +var _0x414f=['update','then','destroy','sendStatus','error','stack','name','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','length','hasOwnProperty','nolimit','order','where','filters','merge','map','type','filter','options','CmHopperBlack','count','includeAll','include','findAll','rows','catch','show','params','fields','body','find','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','apply'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x414f,0x13f));var _0xf414=function(_0x486c22,_0x306c6d){_0x486c22=_0x486c22-0x0;var _0xbad918=_0x414f[_0x486c22];return _0xbad918;};'use strict';var pdf=require(_0xf414('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf414('0x1'));var zipdir=require(_0xf414('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf414('0x3'));var moment=require(_0xf414('0x4'));var BPromise=require(_0xf414('0x5'));var Mustache=require(_0xf414('0x6'));var util=require(_0xf414('0x7'));var path=require(_0xf414('0x8'));var sox=require(_0xf414('0x9'));var csv=require('to-csv');var ejs=require(_0xf414('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf414('0xb'));var crypto=require(_0xf414('0xc'));var jsforce=require(_0xf414('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf414('0xe'));var Papa=require(_0xf414('0xf'));var Redis=require(_0xf414('0x10'));var authService=require(_0xf414('0x11'));var qs=require(_0xf414('0x12'));var as=require(_0xf414('0x13'));var hardwareService=require(_0xf414('0x14'));var logger=require(_0xf414('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf414('0x16'));var db=require(_0xf414('0x17'))['db'];function respondWithStatusCode(_0x1987f2,_0x396c30){_0x396c30=_0x396c30||0xcc;return function(_0x9be4f8){if(_0x9be4f8){return _0x1987f2['sendStatus'](_0x396c30);}return _0x1987f2[_0xf414('0x18')](_0x396c30)[_0xf414('0x19')]();};}function respondWithResult(_0x3ca9e7,_0x46d679){_0x46d679=_0x46d679||0xc8;return function(_0x99bbd1){if(_0x99bbd1){return _0x3ca9e7['status'](_0x46d679)[_0xf414('0x1a')](_0x99bbd1);}};}function respondWithFilteredResult(_0x107a83,_0x46fb28){return function(_0x706d2e){if(_0x706d2e){var _0x4d3021=_0x706d2e['count'],_0x17125d=_0x46fb28[_0xf414('0x1b')],_0x32651e=_0x46fb28[_0xf414('0x1b')]+_0x46fb28[_0xf414('0x1c')],_0x3ca4d5;if(_0x32651e>=_0x4d3021){_0x32651e=_0x4d3021;_0x3ca4d5=0xc8;}else{_0x3ca4d5=0xce;}_0x107a83[_0xf414('0x18')](_0x3ca4d5);return _0x107a83[_0xf414('0x1d')]('Content-Range',_0x17125d+'-'+_0x32651e+'/'+_0x4d3021)[_0xf414('0x1a')](_0x706d2e);}return null;};}function patchUpdates(_0x4b813f){return function(_0x5ede89){try{jsonpatch[_0xf414('0x1e')](_0x5ede89,_0x4b813f,!![]);}catch(_0x44b829){return BPromise['reject'](_0x44b829);}return _0x5ede89['save']();};}function saveUpdates(_0x5d1902,_0x3145ed){return function(_0x1ccfce){if(_0x1ccfce){return _0x1ccfce[_0xf414('0x1f')](_0x5d1902)[_0xf414('0x20')](function(_0x367227){return _0x367227;});}return null;};}function removeEntity(_0x24df6d,_0x3bbbe8){return function(_0x1e116c){if(_0x1e116c){return _0x1e116c[_0xf414('0x21')]()['then'](function(){_0x24df6d[_0xf414('0x18')](0xcc)[_0xf414('0x19')]();});}};}function handleEntityNotFound(_0x236504,_0x4999e4){return function(_0x8bd1d0){if(!_0x8bd1d0){_0x236504[_0xf414('0x22')](0x194);}return _0x8bd1d0;};}function handleError(_0x13b8b3,_0x40e93e){_0x40e93e=_0x40e93e||0x1f4;return function(_0x473685){logger[_0xf414('0x23')](_0x473685[_0xf414('0x24')]);if(_0x473685[_0xf414('0x25')]){delete _0x473685['name'];}_0x13b8b3[_0xf414('0x18')](_0x40e93e)['send'](_0x473685);};}exports['index']=function(_0x2153a4,_0x45dd53){var _0x2376c7={},_0x3e443d={},_0x27a5fa={'count':0x0,'rows':[]};var _0x269e4f=_['map'](db['CmHopperBlack'][_0xf414('0x26')],function(_0x25b40f){return{'name':_0x25b40f[_0xf414('0x27')],'type':_0x25b40f['type'][_0xf414('0x28')]};});_0x3e443d['model']=_['map'](_0x269e4f,_0xf414('0x25'));_0x3e443d[_0xf414('0x29')]=_[_0xf414('0x2a')](_0x2153a4['query']);_0x3e443d['filters']=_[_0xf414('0x2b')](_0x3e443d['model'],_0x3e443d[_0xf414('0x29')]);_0x2376c7[_0xf414('0x2c')]=_[_0xf414('0x2b')](_0x3e443d[_0xf414('0x2d')],qs['fields'](_0x2153a4[_0xf414('0x29')]['fields']));_0x2376c7['attributes']=_0x2376c7[_0xf414('0x2c')][_0xf414('0x2e')]?_0x2376c7[_0xf414('0x2c')]:_0x3e443d[_0xf414('0x2d')];if(!_0x2153a4[_0xf414('0x29')][_0xf414('0x2f')](_0xf414('0x30'))){_0x2376c7[_0xf414('0x1c')]=qs['limit'](_0x2153a4['query'][_0xf414('0x1c')]);_0x2376c7[_0xf414('0x1b')]=qs[_0xf414('0x1b')](_0x2153a4['query']['offset']);}_0x2376c7[_0xf414('0x31')]=qs['sort'](_0x2153a4[_0xf414('0x29')]['sort']);_0x2376c7[_0xf414('0x32')]=qs[_0xf414('0x33')](_['pick'](_0x2153a4[_0xf414('0x29')],_0x3e443d[_0xf414('0x33')]));if(_0x2153a4[_0xf414('0x29')]['filter']){_0x2376c7[_0xf414('0x32')]=_[_0xf414('0x34')](_0x2376c7[_0xf414('0x32')],{'$or':_[_0xf414('0x35')](_0x269e4f,function(_0x3e42b6){if(_0x3e42b6[_0xf414('0x36')]!=='VIRTUAL'){var _0x457fe4={};_0x457fe4[_0x3e42b6[_0xf414('0x25')]]={'$like':'%'+_0x2153a4[_0xf414('0x29')][_0xf414('0x37')]+'%'};return _0x457fe4;}})});}_0x2376c7=_[_0xf414('0x34')]({},_0x2376c7,_0x2153a4[_0xf414('0x38')]);var _0x2903eb={'where':_0x2376c7[_0xf414('0x32')]};return db[_0xf414('0x39')]['count'](_0x2903eb)[_0xf414('0x20')](function(_0x26f041){_0x27a5fa[_0xf414('0x3a')]=_0x26f041;if(_0x2153a4[_0xf414('0x29')][_0xf414('0x3b')]){_0x2376c7[_0xf414('0x3c')]=[{'all':!![]}];}return db[_0xf414('0x39')][_0xf414('0x3d')](_0x2376c7);})[_0xf414('0x20')](function(_0x46f670){_0x27a5fa[_0xf414('0x3e')]=_0x46f670;return _0x27a5fa;})[_0xf414('0x20')](respondWithFilteredResult(_0x45dd53,_0x2376c7))[_0xf414('0x3f')](handleError(_0x45dd53,null));};exports[_0xf414('0x40')]=function(_0x16b62d,_0x38b439){var _0x43d141={'raw':!![],'where':{'id':_0x16b62d[_0xf414('0x41')]['id']}},_0x4b2021={};_0x4b2021[_0xf414('0x2d')]=_['keys'](db[_0xf414('0x39')][_0xf414('0x26')]);_0x4b2021['query']=_[_0xf414('0x2a')](_0x16b62d[_0xf414('0x29')]);_0x4b2021[_0xf414('0x33')]=_[_0xf414('0x2b')](_0x4b2021[_0xf414('0x2d')],_0x4b2021[_0xf414('0x29')]);_0x43d141[_0xf414('0x2c')]=_['intersection'](_0x4b2021[_0xf414('0x2d')],qs[_0xf414('0x42')](_0x16b62d[_0xf414('0x29')][_0xf414('0x42')]));_0x43d141[_0xf414('0x2c')]=_0x43d141[_0xf414('0x2c')][_0xf414('0x2e')]?_0x43d141[_0xf414('0x2c')]:_0x4b2021[_0xf414('0x2d')];if(_0x16b62d['query'][_0xf414('0x3b')]){_0x43d141[_0xf414('0x3c')]=[{'all':!![]}];}_0x43d141=_[_0xf414('0x34')]({},_0x43d141,_0x16b62d[_0xf414('0x38')]);return db['CmHopperBlack']['find'](_0x43d141)[_0xf414('0x20')](handleEntityNotFound(_0x38b439,null))[_0xf414('0x20')](respondWithResult(_0x38b439,null))['catch'](handleError(_0x38b439,null));};exports['update']=function(_0x95c50c,_0x82d069){if(_0x95c50c[_0xf414('0x43')]['id']){delete _0x95c50c[_0xf414('0x43')]['id'];}return db[_0xf414('0x39')][_0xf414('0x44')]({'where':{'id':_0x95c50c[_0xf414('0x41')]['id']}})[_0xf414('0x20')](handleEntityNotFound(_0x82d069,null))[_0xf414('0x20')](saveUpdates(_0x95c50c[_0xf414('0x43')],null))[_0xf414('0x20')](respondWithResult(_0x82d069,null))[_0xf414('0x3f')](handleError(_0x82d069,null));};exports[_0xf414('0x21')]=function(_0x44daff,_0x7a240d){return db[_0xf414('0x39')]['find']({'where':{'id':_0x44daff[_0xf414('0x41')]['id']}})[_0xf414('0x20')](handleEntityNotFound(_0x7a240d,null))['then'](removeEntity(_0x7a240d,null))[_0xf414('0x3f')](handleError(_0x7a240d,null));};exports[_0xf414('0x45')]=function(_0x16bd10,_0x185c3c){return db[_0xf414('0x39')][_0xf414('0x45')]()['then'](respondWithResult(_0x185c3c,null))[_0xf414('0x3f')](handleError(_0x185c3c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 1574470..161b1a2 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 _0x14a0=['api','bluebird','path','rimraf','../../config/environment','./cmHopperBlack.attributes','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger'];(function(_0x8ab528,_0x532f43){var _0x4d7073=function(_0xf045aa){while(--_0xf045aa){_0x8ab528['push'](_0x8ab528['shift']());}};_0x4d7073(++_0x532f43);}(_0x14a0,0x131));var _0x014a=function(_0x16ef70,_0x129c2c){_0x16ef70=_0x16ef70-0x0;var _0x32b040=_0x14a0[_0x16ef70];return _0x32b040;};'use strict';var _=require(_0x014a('0x0'));var util=require(_0x014a('0x1'));var logger=require(_0x014a('0x2'))(_0x014a('0x3'));var moment=require('moment');var BPromise=require(_0x014a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x014a('0x5'));var rimraf=require(_0x014a('0x6'));var config=require(_0x014a('0x7'));var attributes=require(_0x014a('0x8'));module['exports']=function(_0x5b810f,_0x53d997){return _0x5b810f['define'](_0x014a('0x9'),attributes,{'tableName':_0x014a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc553=['define','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports'];(function(_0x334f34,_0x49eb20){var _0x46972b=function(_0x68364a){while(--_0x68364a){_0x334f34['push'](_0x334f34['shift']());}};_0x46972b(++_0x49eb20);}(_0xc553,0xb9));var _0x3c55=function(_0x13fd92,_0x1930d5){_0x13fd92=_0x13fd92-0x0;var _0x1ce811=_0xc553[_0x13fd92];return _0x1ce811;};'use strict';var _=require(_0x3c55('0x0'));var util=require(_0x3c55('0x1'));var logger=require('../../config/logger')(_0x3c55('0x2'));var moment=require(_0x3c55('0x3'));var BPromise=require(_0x3c55('0x4'));var rp=require(_0x3c55('0x5'));var fs=require('fs');var path=require(_0x3c55('0x6'));var rimraf=require(_0x3c55('0x7'));var config=require(_0x3c55('0x8'));var attributes=require(_0x3c55('0x9'));module[_0x3c55('0xa')]=function(_0x2272b8,_0x55ad96){return _0x2272b8[_0x3c55('0xb')](_0x3c55('0xc'),attributes,{'tableName':_0x3c55('0xd'),'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 f692ad3..6bc1028 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 _0x122a=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','attributes','limit','include','map','model','UpdateCmHopperBlack','update','raw','where','DestroyCmHopperBlack'];(function(_0x5256a1,_0x497e59){var _0x572549=function(_0xf46c4c){while(--_0xf46c4c){_0x5256a1['push'](_0x5256a1['shift']());}};_0x572549(++_0x497e59);}(_0x122a,0x1b8));var _0xa122=function(_0x671514,_0x4373a6){_0x671514=_0x671514-0x0;var _0x1a4b96=_0x122a[_0x671514];return _0x1a4b96;};'use strict';var _=require(_0xa122('0x0'));var util=require('util');var moment=require(_0xa122('0x1'));var BPromise=require(_0xa122('0x2'));var rs=require(_0xa122('0x3'));var fs=require('fs');var Redis=require(_0xa122('0x4'));var db=require(_0xa122('0x5'))['db'];var utils=require(_0xa122('0x6'));var logger=require(_0xa122('0x7'))(_0xa122('0x8'));var config=require(_0xa122('0x9'));var jayson=require(_0xa122('0xa'));var client=jayson[_0xa122('0xb')][_0xa122('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d7f16,_0x51e352,_0x14275f){return new BPromise(function(_0x4eb59a,_0x4261ab){return client[_0xa122('0xd')](_0x5d7f16,_0x14275f)[_0xa122('0xe')](function(_0x551e15){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x51e352,_0xa122('0xf'));logger[_0xa122('0x10')](_0xa122('0x11'),_0x51e352,_0xa122('0xf'),JSON[_0xa122('0x12')](_0x551e15));if(_0x551e15[_0xa122('0x13')]){if(_0x551e15[_0xa122('0x13')][_0xa122('0x14')]===0x1f4){logger[_0xa122('0x13')](_0xa122('0x15'),_0x51e352,_0x551e15['error'][_0xa122('0x16')]);return _0x4261ab(_0x551e15[_0xa122('0x13')]['message']);}logger[_0xa122('0x13')](_0xa122('0x15'),_0x51e352,_0x551e15[_0xa122('0x13')][_0xa122('0x16')]);return _0x4eb59a(_0x551e15[_0xa122('0x13')][_0xa122('0x16')]);}else{logger[_0xa122('0x17')](_0xa122('0x15'),_0x51e352,'request\x20sent');_0x4eb59a(_0x551e15[_0xa122('0x18')][_0xa122('0x16')]);}})[_0xa122('0x19')](function(_0xf3052f){logger[_0xa122('0x13')](_0xa122('0x15'),_0x51e352,_0xf3052f);_0x4261ab(_0xf3052f);});});}exports[_0xa122('0x1a')]=function(_0x3621b4){var _0x8bbc9f=this;return new Promise(function(_0x3965bf,_0x2a3c13){return db[_0xa122('0x1b')][_0xa122('0x1c')]({'raw':_0x3621b4[_0xa122('0x1d')]?_0x3621b4[_0xa122('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3621b4[_0xa122('0x1d')]?_0x3621b4[_0xa122('0x1d')]['where']||null:null,'attributes':_0x3621b4[_0xa122('0x1d')]?_0x3621b4[_0xa122('0x1d')][_0xa122('0x1e')]||null:null,'limit':_0x3621b4[_0xa122('0x1d')]?_0x3621b4[_0xa122('0x1d')][_0xa122('0x1f')]||null:null,'include':_0x3621b4['options']?_0x3621b4[_0xa122('0x1d')][_0xa122('0x20')]?_[_0xa122('0x21')](_0x3621b4[_0xa122('0x1d')][_0xa122('0x20')],function(_0xbbc7ac){return{'model':db[_0xbbc7ac[_0xa122('0x22')]],'as':_0xbbc7ac['as'],'attributes':_0xbbc7ac[_0xa122('0x1e')],'include':_0xbbc7ac[_0xa122('0x20')]?_[_0xa122('0x21')](_0xbbc7ac[_0xa122('0x20')],function(_0x381b3d){return{'model':db[_0x381b3d[_0xa122('0x22')]],'as':_0x381b3d['as'],'attributes':_0x381b3d[_0xa122('0x1e')],'include':_0x381b3d[_0xa122('0x20')]?_['map'](_0x381b3d[_0xa122('0x20')],function(_0x1f86d1){return{'model':db[_0x1f86d1['model']],'as':_0x1f86d1['as'],'attributes':_0x1f86d1['attributes']};}):[]};}):[]};}):[]:[]})[_0xa122('0xe')](function(_0x2a2ae8){logger['info'](_0xa122('0x1a'),_0x3621b4);logger['debug'](_0xa122('0x1a'),_0x3621b4,JSON['stringify'](_0x2a2ae8));_0x3965bf(_0x2a2ae8);})['catch'](function(_0x441c55){logger[_0xa122('0x13')]('GetCmHopperBlack',_0x441c55[_0xa122('0x16')],_0x3621b4);_0x2a3c13(_0x8bbc9f[_0xa122('0x13')](0x1f4,_0x441c55[_0xa122('0x16')]));});});};exports[_0xa122('0x23')]=function(_0x17262e){var _0x4d8fc8=this;return new Promise(function(_0x175720,_0x16a906){return db[_0xa122('0x1b')][_0xa122('0x24')](_0x17262e['body'],{'raw':_0x17262e['options']?_0x17262e[_0xa122('0x1d')][_0xa122('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17262e[_0xa122('0x1d')]?_0x17262e[_0xa122('0x1d')][_0xa122('0x26')]||null:null,'attributes':_0x17262e['options']?_0x17262e[_0xa122('0x1d')][_0xa122('0x1e')]||null:null,'limit':_0x17262e['options']?_0x17262e[_0xa122('0x1d')][_0xa122('0x1f')]||null:null})[_0xa122('0xe')](function(_0x1c4a88){logger[_0xa122('0x17')](_0xa122('0x23'),_0x17262e);logger[_0xa122('0x10')](_0xa122('0x23'),_0x17262e,JSON[_0xa122('0x12')](_0x1c4a88));_0x175720(_0x1c4a88);})['catch'](function(_0x2b0ddb){logger['error'](_0xa122('0x23'),_0x2b0ddb[_0xa122('0x16')],_0x17262e);_0x16a906(_0x4d8fc8[_0xa122('0x13')](0x1f4,_0x2b0ddb[_0xa122('0x16')]));});});};exports['DestroyCmHopperBlack']=function(_0x24c454){var _0x51f1dc=this;return new Promise(function(_0x38eb14,_0x1f3490){return db[_0xa122('0x1b')]['destroy']({'where':_0x24c454['options']?_0x24c454[_0xa122('0x1d')]['where']||null:null})['then'](function(_0x28dbeb){logger[_0xa122('0x17')]('DestroyCmHopperBlack',_0x24c454);logger[_0xa122('0x10')](_0xa122('0x27'),_0x24c454,JSON[_0xa122('0x12')](_0x28dbeb));_0x38eb14(_0x28dbeb);})[_0xa122('0x19')](function(_0xca3a8e){logger[_0xa122('0x13')](_0xa122('0x27'),_0xca3a8e['message'],_0x24c454);_0x1f3490(_0x51f1dc[_0xa122('0x13')](0x1f4,_0xca3a8e[_0xa122('0x16')]));});});}; \ No newline at end of file +var _0xb388=['code','error','message','result','catch','options','raw','attributes','limit','include','map','model','GetCmHopperBlack','debug','UpdateCmHopperBlack','update','body','where','DestroyCmHopperBlack','CmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x25d494,_0xad99ef){var _0x56b739=function(_0x435345){while(--_0x435345){_0x25d494['push'](_0x25d494['shift']());}};_0x56b739(++_0xad99ef);}(_0xb388,0x11f));var _0x8b38=function(_0x2cf849,_0x5a2e6c){_0x2cf849=_0x2cf849-0x0;var _0x56d3dd=_0xb388[_0x2cf849];return _0x56d3dd;};'use strict';var _=require(_0x8b38('0x0'));var util=require(_0x8b38('0x1'));var moment=require(_0x8b38('0x2'));var BPromise=require(_0x8b38('0x3'));var rs=require(_0x8b38('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b38('0x5'))['db'];var utils=require(_0x8b38('0x6'));var logger=require(_0x8b38('0x7'))('rpc');var config=require(_0x8b38('0x8'));var jayson=require(_0x8b38('0x9'));var client=jayson['client'][_0x8b38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43bf28,_0xdb783f,_0x2133db){return new BPromise(function(_0x5dd105,_0x5a3112){return client[_0x8b38('0xb')](_0x43bf28,_0x2133db)[_0x8b38('0xc')](function(_0x30aa55){logger[_0x8b38('0xd')](_0x8b38('0xe'),_0xdb783f,_0x8b38('0xf'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0xdb783f,'request\x20sent',JSON[_0x8b38('0x10')](_0x30aa55));if(_0x30aa55['error']){if(_0x30aa55['error'][_0x8b38('0x11')]===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0xdb783f,_0x30aa55[_0x8b38('0x12')]['message']);return _0x5a3112(_0x30aa55[_0x8b38('0x12')][_0x8b38('0x13')]);}logger['error'](_0x8b38('0xe'),_0xdb783f,_0x30aa55[_0x8b38('0x12')]['message']);return _0x5dd105(_0x30aa55[_0x8b38('0x12')][_0x8b38('0x13')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0xdb783f,_0x8b38('0xf'));_0x5dd105(_0x30aa55[_0x8b38('0x14')][_0x8b38('0x13')]);}})[_0x8b38('0x15')](function(_0x4966db){logger[_0x8b38('0x12')](_0x8b38('0xe'),_0xdb783f,_0x4966db);_0x5a3112(_0x4966db);});});}exports['GetCmHopperBlack']=function(_0x1452a8){var _0x5c8e2e=this;return new Promise(function(_0x134e63,_0x2797cd){return db['CmHopperBlack']['findAll']({'raw':_0x1452a8[_0x8b38('0x16')]?_0x1452a8[_0x8b38('0x16')][_0x8b38('0x17')]===undefined?!![]:![]:!![],'where':_0x1452a8[_0x8b38('0x16')]?_0x1452a8[_0x8b38('0x16')]['where']||null:null,'attributes':_0x1452a8[_0x8b38('0x16')]?_0x1452a8[_0x8b38('0x16')][_0x8b38('0x18')]||null:null,'limit':_0x1452a8[_0x8b38('0x16')]?_0x1452a8[_0x8b38('0x16')][_0x8b38('0x19')]||null:null,'include':_0x1452a8[_0x8b38('0x16')]?_0x1452a8[_0x8b38('0x16')][_0x8b38('0x1a')]?_['map'](_0x1452a8['options']['include'],function(_0x1ccadc){return{'model':db[_0x1ccadc['model']],'as':_0x1ccadc['as'],'attributes':_0x1ccadc[_0x8b38('0x18')],'include':_0x1ccadc[_0x8b38('0x1a')]?_[_0x8b38('0x1b')](_0x1ccadc[_0x8b38('0x1a')],function(_0x28ae0a){return{'model':db[_0x28ae0a['model']],'as':_0x28ae0a['as'],'attributes':_0x28ae0a[_0x8b38('0x18')],'include':_0x28ae0a[_0x8b38('0x1a')]?_[_0x8b38('0x1b')](_0x28ae0a[_0x8b38('0x1a')],function(_0x4d0d97){return{'model':db[_0x4d0d97[_0x8b38('0x1c')]],'as':_0x4d0d97['as'],'attributes':_0x4d0d97['attributes']};}):[]};}):[]};}):[]:[]})[_0x8b38('0xc')](function(_0x12f892){logger[_0x8b38('0xd')](_0x8b38('0x1d'),_0x1452a8);logger[_0x8b38('0x1e')](_0x8b38('0x1d'),_0x1452a8,JSON[_0x8b38('0x10')](_0x12f892));_0x134e63(_0x12f892);})[_0x8b38('0x15')](function(_0x358a44){logger['error'](_0x8b38('0x1d'),_0x358a44[_0x8b38('0x13')],_0x1452a8);_0x2797cd(_0x5c8e2e['error'](0x1f4,_0x358a44['message']));});});};exports[_0x8b38('0x1f')]=function(_0x30f0af){var _0x91a294=this;return new Promise(function(_0x303c3d,_0x243132){return db['CmHopperBlack'][_0x8b38('0x20')](_0x30f0af[_0x8b38('0x21')],{'raw':_0x30f0af[_0x8b38('0x16')]?_0x30f0af[_0x8b38('0x16')][_0x8b38('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30f0af[_0x8b38('0x16')]?_0x30f0af[_0x8b38('0x16')][_0x8b38('0x22')]||null:null,'attributes':_0x30f0af[_0x8b38('0x16')]?_0x30f0af[_0x8b38('0x16')]['attributes']||null:null,'limit':_0x30f0af['options']?_0x30f0af['options']['limit']||null:null})[_0x8b38('0xc')](function(_0x2da0b9){logger[_0x8b38('0xd')](_0x8b38('0x1f'),_0x30f0af);logger[_0x8b38('0x1e')]('UpdateCmHopperBlack',_0x30f0af,JSON[_0x8b38('0x10')](_0x2da0b9));_0x303c3d(_0x2da0b9);})[_0x8b38('0x15')](function(_0x6d443d){logger[_0x8b38('0x12')]('UpdateCmHopperBlack',_0x6d443d['message'],_0x30f0af);_0x243132(_0x91a294[_0x8b38('0x12')](0x1f4,_0x6d443d[_0x8b38('0x13')]));});});};exports[_0x8b38('0x23')]=function(_0x12dd46){var _0x5bf792=this;return new Promise(function(_0x36298b,_0x18c759){return db[_0x8b38('0x24')][_0x8b38('0x25')]({'where':_0x12dd46[_0x8b38('0x16')]?_0x12dd46[_0x8b38('0x16')]['where']||null:null})[_0x8b38('0xc')](function(_0x4cf144){logger['info'](_0x8b38('0x23'),_0x12dd46);logger[_0x8b38('0x1e')](_0x8b38('0x23'),_0x12dd46,JSON['stringify'](_0x4cf144));_0x36298b(_0x4cf144);})['catch'](function(_0x29de69){logger[_0x8b38('0x12')]('DestroyCmHopperBlack',_0x29de69[_0x8b38('0x13')],_0x12dd46);_0x18c759(_0x5bf792[_0x8b38('0x12')](0x1f4,_0x29de69[_0x8b38('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 3caa4ae..edb54fe 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 _0xb458=['show','put','/:id','delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe'];(function(_0x4a1e59,_0x52e37c){var _0x423442=function(_0x205a88){while(--_0x205a88){_0x4a1e59['push'](_0x4a1e59['shift']());}};_0x423442(++_0x52e37c);}(_0xb458,0x103));var _0x8b45=function(_0xb0f253,_0x476cc1){_0xb0f253=_0xb0f253-0x0;var _0x25dbbe=_0xb458[_0xb0f253];return _0x25dbbe;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b45('0x3')]();var auth=require(_0x8b45('0x4'));var interaction=require(_0x8b45('0x5'));var config=require(_0x8b45('0x6'));var controller=require('./cmHopperBlack.controller');router[_0x8b45('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8b45('0x7')](_0x8b45('0x8'),auth[_0x8b45('0x9')](),controller[_0x8b45('0xa')]);router[_0x8b45('0x7')]('/:id',auth[_0x8b45('0x9')](),controller[_0x8b45('0xb')]);router[_0x8b45('0xc')](_0x8b45('0xd'),auth[_0x8b45('0x9')](),controller['update']);router[_0x8b45('0xe')](_0x8b45('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe5b3=['destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','update','delete'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0xe5b3,0x133));var _0x3e5b=function(_0x11d51d,_0x5e07d1){_0x11d51d=_0x11d51d-0x0;var _0x598c50=_0xe5b3[_0x11d51d];return _0x598c50;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var auth=require(_0x3e5b('0x5'));var interaction=require(_0x3e5b('0x6'));var config=require(_0x3e5b('0x7'));var controller=require(_0x3e5b('0x8'));router[_0x3e5b('0x9')]('/',auth[_0x3e5b('0xa')](),controller['index']);router[_0x3e5b('0x9')](_0x3e5b('0xb'),auth['isAuthenticated'](),controller[_0x3e5b('0xc')]);router[_0x3e5b('0x9')](_0x3e5b('0xd'),auth[_0x3e5b('0xa')](),controller['show']);router['put'](_0x3e5b('0xd'),auth[_0x3e5b('0xa')](),controller[_0x3e5b('0xe')]);router[_0x3e5b('0xf')](_0x3e5b('0xd'),auth['isAuthenticated'](),controller[_0x3e5b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 74da703..a479f52 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 _0x8e03=['DATE','getDataValue','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING'];(function(_0x325ce5,_0x3c68b3){var _0x2347a2=function(_0x32ab3f){while(--_0x32ab3f){_0x325ce5['push'](_0x325ce5['shift']());}};_0x2347a2(++_0x3c68b3);}(_0x8e03,0x8a));var _0x38e0=function(_0x548279,_0x2f7069){_0x548279=_0x548279-0x0;var _0xa9adfb=_0x8e03[_0x548279];return _0xa9adfb;};'use strict';var Sequelize=require(_0x38e0('0x0'));var moment=require(_0x38e0('0x1'));module[_0x38e0('0x2')]={'state':{'type':Sequelize[_0x38e0('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x38e0('0x4')]},'scheduledat':{'type':Sequelize[_0x38e0('0x5')]},'countbusyretry':{'type':Sequelize[_0x38e0('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x38e0('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x38e0('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x38e0('0x4')]},'originatecalleridname':{'type':Sequelize[_0x38e0('0x4')]},'calleridnum':{'type':Sequelize[_0x38e0('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x38e0('0x5')]},'responsetime':{'type':Sequelize[_0x38e0('0x5')]},'answertime':{'type':Sequelize[_0x38e0('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x38e0('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x38e0('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x38e0('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x38e0('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x38e0('0x4')]},'campaigntype':{'type':Sequelize[_0x38e0('0x4')]},'membername':{'type':Sequelize[_0x38e0('0x4')]},'reason':{'type':Sequelize[_0x38e0('0x4')]},'disposition':{'type':Sequelize[_0x38e0('0x4')]},'dispositionat':{'type':Sequelize[_0x38e0('0x5')],'set':function(_0x36df1c){var _0x5e5768=this[_0x38e0('0x6')]('endtime');if(_0x5e5768&&_0x36df1c){this[_0x38e0('0x7')](_0x38e0('0x8'),moment(_0x36df1c)[_0x38e0('0x9')](moment(_0x5e5768),_0x38e0('0xa')));}return this[_0x38e0('0x7')](_0x38e0('0xb'),_0x36df1c);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x38e0('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x38e0('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x38e0('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x38e0('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x38e0('0x5')]},'deleted':{'type':Sequelize[_0x38e0('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x38e0('0x5')]},'recallme':{'type':Sequelize[_0x38e0('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x38e0('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x38e0('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x38e0('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x38e0('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8afb=['INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','moment','exports'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x8afb,0x176));var _0xb8af=function(_0x550eb7,_0x465856){_0x550eb7=_0x550eb7-0x0;var _0x33bffe=_0x8afb[_0x550eb7];return _0x33bffe;};'use strict';var Sequelize=require(_0xb8af('0x0'));var moment=require(_0xb8af('0x1'));module[_0xb8af('0x2')]={'state':{'type':Sequelize[_0xb8af('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xb8af('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb8af('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb8af('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xb8af('0x4')]},'originatecalleridname':{'type':Sequelize[_0xb8af('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb8af('0x4')]},'starttime':{'type':Sequelize[_0xb8af('0x5')]},'responsetime':{'type':Sequelize[_0xb8af('0x5')]},'answertime':{'type':Sequelize[_0xb8af('0x5')]},'droptime':{'type':Sequelize[_0xb8af('0x5')]},'endtime':{'type':Sequelize[_0xb8af('0x5')]},'ringtime':{'type':Sequelize[_0xb8af('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb8af('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb8af('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb8af('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb8af('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xb8af('0x4')]},'membername':{'type':Sequelize[_0xb8af('0x4')]},'reason':{'type':Sequelize[_0xb8af('0x4')]},'disposition':{'type':Sequelize[_0xb8af('0x4')]},'dispositionat':{'type':Sequelize[_0xb8af('0x5')],'set':function(_0x7daad2){var _0x4e245b=this[_0xb8af('0x6')]('endtime');if(_0x4e245b&&_0x7daad2){this[_0xb8af('0x7')](_0xb8af('0x8'),moment(_0x7daad2)[_0xb8af('0x9')](moment(_0x4e245b),_0xb8af('0xa')));}return this[_0xb8af('0x7')](_0xb8af('0xb'),_0x7daad2);}},'amd':{'type':Sequelize[_0xb8af('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb8af('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb8af('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xb8af('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb8af('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb8af('0x5')]},'deleted':{'type':Sequelize[_0xb8af('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xb8af('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xb8af('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb8af('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb8af('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 98e6bba..e712976 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 _0xb0a3=['type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','CmHopperFinal','include','findAll','rows','catch','show','params','keys','includeAll','options','describe','uniqueid','body','find','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','congestionContacts','dropContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','phone','select','calleridnum','from','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','NOW()','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','set','Content-Range','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName'];(function(_0x17927f,_0x4b7e50){var _0x4f524b=function(_0x5bbef8){while(--_0x5bbef8){_0x17927f['push'](_0x17927f['shift']());}};_0x4f524b(++_0x4b7e50);}(_0xb0a3,0xdc));var _0x3b0a=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0xb0a3[_0x309d93];return _0x2dd61d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3b0a('0x0'));var rimraf=require(_0x3b0a('0x1'));var zipdir=require(_0x3b0a('0x2'));var jsonpatch=require(_0x3b0a('0x3'));var rp=require('request-promise');var moment=require(_0x3b0a('0x4'));var BPromise=require(_0x3b0a('0x5'));var Mustache=require(_0x3b0a('0x6'));var util=require(_0x3b0a('0x7'));var path=require(_0x3b0a('0x8'));var sox=require(_0x3b0a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3b0a('0xa'));var squel=require('squel');var crypto=require(_0x3b0a('0xb'));var jsforce=require(_0x3b0a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3b0a('0xd'));var querystring=require('querystring');var Papa=require(_0x3b0a('0xe'));var Redis=require(_0x3b0a('0xf'));var authService=require(_0x3b0a('0x10'));var qs=require(_0x3b0a('0x11'));var as=require(_0x3b0a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b0a('0x13'))(_0x3b0a('0x14'));var utils=require(_0x3b0a('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19d29a,_0x145ece){_0x145ece=_0x145ece||0xcc;return function(_0x25444c){if(_0x25444c){return _0x19d29a[_0x3b0a('0x16')](_0x145ece);}return _0x19d29a['status'](_0x145ece)[_0x3b0a('0x17')]();};}function respondWithResult(_0x147c86,_0x470311){_0x470311=_0x470311||0xc8;return function(_0x123cff){if(_0x123cff){return _0x147c86[_0x3b0a('0x18')](_0x470311)[_0x3b0a('0x19')](_0x123cff);}};}function respondWithFilteredResult(_0xc13674,_0x1c4d27){return function(_0x348278){if(_0x348278){var _0x3fe8d4=_0x348278[_0x3b0a('0x1a')],_0x25ce66=_0x1c4d27[_0x3b0a('0x1b')],_0x51cf14=_0x1c4d27[_0x3b0a('0x1b')]+_0x1c4d27['limit'],_0x43dd4a;if(_0x51cf14>=_0x3fe8d4){_0x51cf14=_0x3fe8d4;_0x43dd4a=0xc8;}else{_0x43dd4a=0xce;}_0xc13674[_0x3b0a('0x18')](_0x43dd4a);return _0xc13674[_0x3b0a('0x1c')](_0x3b0a('0x1d'),_0x25ce66+'-'+_0x51cf14+'/'+_0x3fe8d4)[_0x3b0a('0x19')](_0x348278);}return null;};}function patchUpdates(_0x1e6989){return function(_0xd7407e){try{jsonpatch['apply'](_0xd7407e,_0x1e6989,!![]);}catch(_0x33a300){return BPromise['reject'](_0x33a300);}return _0xd7407e[_0x3b0a('0x1e')]();};}function saveUpdates(_0x5edd67,_0x4929b9){return function(_0x1245a4){if(_0x1245a4){return _0x1245a4[_0x3b0a('0x1f')](_0x5edd67)[_0x3b0a('0x20')](function(_0x5944fe){return _0x5944fe;});}return null;};}function removeEntity(_0x3bb5eb,_0x4f479f){return function(_0x507bbd){if(_0x507bbd){return _0x507bbd[_0x3b0a('0x21')]()['then'](function(){_0x3bb5eb['status'](0xcc)[_0x3b0a('0x17')]();});}};}function handleEntityNotFound(_0x1e74a1,_0x135326){return function(_0x25e78b){if(!_0x25e78b){_0x1e74a1[_0x3b0a('0x16')](0x194);}return _0x25e78b;};}function handleError(_0x2ec835,_0x5a7211){_0x5a7211=_0x5a7211||0x1f4;return function(_0x1330da){logger['error'](_0x1330da[_0x3b0a('0x22')]);if(_0x1330da[_0x3b0a('0x23')]){delete _0x1330da['name'];}_0x2ec835[_0x3b0a('0x18')](_0x5a7211)[_0x3b0a('0x24')](_0x1330da);};}exports[_0x3b0a('0x25')]=function(_0x452a23,_0x40509d){var _0x15c6da={},_0x50b5f0={},_0x572174={'count':0x0,'rows':[]};var _0x3a2565=_['map'](db['CmHopperFinal'][_0x3b0a('0x26')],function(_0x312e2f){return{'name':_0x312e2f[_0x3b0a('0x27')],'type':_0x312e2f[_0x3b0a('0x28')][_0x3b0a('0x29')]};});_0x50b5f0[_0x3b0a('0x2a')]=_[_0x3b0a('0x2b')](_0x3a2565,'name');_0x50b5f0[_0x3b0a('0x2c')]=_['keys'](_0x452a23[_0x3b0a('0x2c')]);_0x50b5f0[_0x3b0a('0x2d')]=_[_0x3b0a('0x2e')](_0x50b5f0[_0x3b0a('0x2a')],_0x50b5f0[_0x3b0a('0x2c')]);_0x15c6da[_0x3b0a('0x2f')]=_[_0x3b0a('0x2e')](_0x50b5f0[_0x3b0a('0x2a')],qs[_0x3b0a('0x30')](_0x452a23[_0x3b0a('0x2c')][_0x3b0a('0x30')]));_0x15c6da[_0x3b0a('0x2f')]=_0x15c6da[_0x3b0a('0x2f')][_0x3b0a('0x31')]?_0x15c6da[_0x3b0a('0x2f')]:_0x50b5f0[_0x3b0a('0x2a')];if(!_0x452a23['query'][_0x3b0a('0x32')](_0x3b0a('0x33'))){_0x15c6da[_0x3b0a('0x34')]=qs[_0x3b0a('0x34')](_0x452a23[_0x3b0a('0x2c')]['limit']);_0x15c6da[_0x3b0a('0x1b')]=qs[_0x3b0a('0x1b')](_0x452a23['query'][_0x3b0a('0x1b')]);}_0x15c6da[_0x3b0a('0x35')]=qs[_0x3b0a('0x36')](_0x452a23[_0x3b0a('0x2c')][_0x3b0a('0x36')]);_0x15c6da[_0x3b0a('0x37')]=qs['filters'](_[_0x3b0a('0x38')](_0x452a23[_0x3b0a('0x2c')],_0x50b5f0[_0x3b0a('0x2d')]));if(_0x452a23[_0x3b0a('0x2c')][_0x3b0a('0x39')]){_0x15c6da[_0x3b0a('0x37')]=_[_0x3b0a('0x3a')](_0x15c6da[_0x3b0a('0x37')],{'$or':_[_0x3b0a('0x2b')](_0x3a2565,function(_0x59e171){if(_0x59e171[_0x3b0a('0x28')]!==_0x3b0a('0x3b')){var _0x2a3dc6={};_0x2a3dc6[_0x59e171[_0x3b0a('0x23')]]={'$like':'%'+_0x452a23[_0x3b0a('0x2c')][_0x3b0a('0x39')]+'%'};return _0x2a3dc6;}})});}_0x15c6da=_[_0x3b0a('0x3a')]({},_0x15c6da,_0x452a23['options']);var _0x316714={'where':_0x15c6da['where']};return db[_0x3b0a('0x3c')][_0x3b0a('0x1a')](_0x316714)[_0x3b0a('0x20')](function(_0x245ffd){_0x572174['count']=_0x245ffd;if(_0x452a23[_0x3b0a('0x2c')]['includeAll']){_0x15c6da[_0x3b0a('0x3d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x3b0a('0x3e')](_0x15c6da);})[_0x3b0a('0x20')](function(_0x18a39f){_0x572174[_0x3b0a('0x3f')]=_0x18a39f;return _0x572174;})[_0x3b0a('0x20')](respondWithFilteredResult(_0x40509d,_0x15c6da))[_0x3b0a('0x40')](handleError(_0x40509d,null));};exports[_0x3b0a('0x41')]=function(_0x70ff29,_0x3f06bb){var _0x1b10ee={'raw':!![],'where':{'id':_0x70ff29[_0x3b0a('0x42')]['id']}},_0x2859b0={};_0x2859b0[_0x3b0a('0x2a')]=_[_0x3b0a('0x43')](db[_0x3b0a('0x3c')][_0x3b0a('0x26')]);_0x2859b0[_0x3b0a('0x2c')]=_['keys'](_0x70ff29[_0x3b0a('0x2c')]);_0x2859b0[_0x3b0a('0x2d')]=_[_0x3b0a('0x2e')](_0x2859b0['model'],_0x2859b0[_0x3b0a('0x2c')]);_0x1b10ee[_0x3b0a('0x2f')]=_['intersection'](_0x2859b0[_0x3b0a('0x2a')],qs[_0x3b0a('0x30')](_0x70ff29[_0x3b0a('0x2c')][_0x3b0a('0x30')]));_0x1b10ee[_0x3b0a('0x2f')]=_0x1b10ee[_0x3b0a('0x2f')][_0x3b0a('0x31')]?_0x1b10ee[_0x3b0a('0x2f')]:_0x2859b0[_0x3b0a('0x2a')];if(_0x70ff29[_0x3b0a('0x2c')][_0x3b0a('0x44')]){_0x1b10ee[_0x3b0a('0x3d')]=[{'all':!![]}];}_0x1b10ee=_[_0x3b0a('0x3a')]({},_0x1b10ee,_0x70ff29[_0x3b0a('0x45')]);return db['CmHopperFinal']['find'](_0x1b10ee)[_0x3b0a('0x20')](handleEntityNotFound(_0x3f06bb,null))[_0x3b0a('0x20')](respondWithResult(_0x3f06bb,null))[_0x3b0a('0x40')](handleError(_0x3f06bb,null));};exports[_0x3b0a('0x46')]=function(_0x4be947,_0x1e49a7){return db[_0x3b0a('0x3c')]['describe']()[_0x3b0a('0x20')](respondWithResult(_0x1e49a7,null))['catch'](handleError(_0x1e49a7,null));};exports[_0x3b0a('0x1f')]=function(_0x2a80cb,_0x2d3101){if(_0x2a80cb['body'][_0x3b0a('0x47')]){delete _0x2a80cb[_0x3b0a('0x48')][_0x3b0a('0x47')];}return db[_0x3b0a('0x3c')][_0x3b0a('0x49')]({'where':{'uniqueid':_0x2a80cb['params']['id']}})[_0x3b0a('0x20')](handleEntityNotFound(_0x2d3101,null))[_0x3b0a('0x20')](saveUpdates(_0x2a80cb[_0x3b0a('0x48')],null))['then'](respondWithResult(_0x2d3101,null))[_0x3b0a('0x40')](handleError(_0x2d3101,null));};exports[_0x3b0a('0x4a')]=function(_0x1289b1,_0x346d5,_0x4821b7){return db[_0x3b0a('0x3c')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x1289b1[_0x3b0a('0x42')]['id']},'attributes':[[db[_0x3b0a('0x4b')]['fn']('COUNT',db[_0x3b0a('0x4b')]['fn']('IF',db[_0x3b0a('0x4b')]['literal'](_0x3b0a('0x4c')))),_0x3b0a('0x4d')],[db[_0x3b0a('0x4b')]['fn'](_0x3b0a('0x4e'),db[_0x3b0a('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x3b0a('0x4f')))),'noAnswerContacts'],[db[_0x3b0a('0x4b')]['fn'](_0x3b0a('0x4e'),db[_0x3b0a('0x4b')]['fn']('IF',db[_0x3b0a('0x4b')][_0x3b0a('0x50')](_0x3b0a('0x51')))),_0x3b0a('0x52')],[db[_0x3b0a('0x4b')]['fn'](_0x3b0a('0x4e'),db[_0x3b0a('0x4b')]['fn']('IF',db[_0x3b0a('0x4b')][_0x3b0a('0x50')](_0x3b0a('0x53')))),'congestionContacts'],[db[_0x3b0a('0x4b')]['fn'](_0x3b0a('0x4e'),db[_0x3b0a('0x4b')]['fn']('IF',db['sequelize'][_0x3b0a('0x50')](_0x3b0a('0x54')))),'dropContacts'],[db['sequelize']['fn'](_0x3b0a('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x3b0a('0x50')](_0x3b0a('0x55')))),'abandonedContacts'],[db[_0x3b0a('0x4b')]['fn'](_0x3b0a('0x4e'),db[_0x3b0a('0x4b')]['fn']('IF',db[_0x3b0a('0x4b')][_0x3b0a('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3b0a('0x56')],[db[_0x3b0a('0x4b')]['fn']('COUNT',db[_0x3b0a('0x4b')]['fn']('IF',db[_0x3b0a('0x4b')][_0x3b0a('0x50')](_0x3b0a('0x57')))),_0x3b0a('0x58')]]})[_0x3b0a('0x20')](handleEntityNotFound(_0x346d5,null))[_0x3b0a('0x20')](respondWithResult(_0x346d5,null))[_0x3b0a('0x40')](handleError(_0x346d5,null));};exports[_0x3b0a('0x59')]=function(_0x3940e4,_0x5a4f44,_0x411772){return db[_0x3b0a('0x3c')][_0x3b0a('0x3e')]({'raw':![],'where':{'CampaignId':_0x3940e4['params']['id']},'attributes':[[db[_0x3b0a('0x4b')]['fn'](_0x3b0a('0x4e'),db[_0x3b0a('0x4b')]['fn']('IF',db['sequelize'][_0x3b0a('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0x3b0a('0x4d')],[db[_0x3b0a('0x4b')]['fn'](_0x3b0a('0x4e'),db[_0x3b0a('0x4b')]['fn']('IF',db[_0x3b0a('0x4b')][_0x3b0a('0x50')]('`state`\x20=\x203,\x201,\x20null'))),_0x3b0a('0x5a')],[db[_0x3b0a('0x4b')]['fn'](_0x3b0a('0x4e'),db[_0x3b0a('0x4b')]['fn']('IF',db[_0x3b0a('0x4b')]['literal'](_0x3b0a('0x51')))),_0x3b0a('0x52')],[db['sequelize']['fn'](_0x3b0a('0x4e'),db[_0x3b0a('0x4b')]['fn']('IF',db[_0x3b0a('0x4b')][_0x3b0a('0x50')](_0x3b0a('0x53')))),_0x3b0a('0x5b')],[db[_0x3b0a('0x4b')]['fn'](_0x3b0a('0x4e'),db[_0x3b0a('0x4b')]['fn']('IF',db[_0x3b0a('0x4b')][_0x3b0a('0x50')](_0x3b0a('0x54')))),_0x3b0a('0x5c')],[db[_0x3b0a('0x4b')]['fn'](_0x3b0a('0x4e'),db[_0x3b0a('0x4b')]['fn']('IF',db[_0x3b0a('0x4b')][_0x3b0a('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x3b0a('0x4b')]['fn'](_0x3b0a('0x4e'),db['sequelize']['fn']('IF',db[_0x3b0a('0x4b')][_0x3b0a('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3b0a('0x56')],[db[_0x3b0a('0x4b')]['fn'](_0x3b0a('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x3b0a('0x50')](_0x3b0a('0x57')))),_0x3b0a('0x58')]]})[_0x3b0a('0x20')](handleEntityNotFound(_0x5a4f44,null))[_0x3b0a('0x20')](respondWithResult(_0x5a4f44,null))[_0x3b0a('0x40')](handleError(_0x5a4f44,null));};exports[_0x3b0a('0x5d')]=function(_0x2630e8,_0x34f439,_0x11f204){return db['VoiceQueue'][_0x3b0a('0x49')]({'where':{'id':_0x2630e8[_0x3b0a('0x42')]['id']}})[_0x3b0a('0x20')](handleEntityNotFound(_0x34f439,null))[_0x3b0a('0x20')](function(_0x5b2a88){var _0x3df5f2;if(_0x5b2a88){_0x3df5f2=squel[_0x3b0a('0x5e')]()[_0x3b0a('0x5f')](_0x3b0a('0x60'))[_0x3b0a('0x61')](['phone',_0x3b0a('0x62'),_0x3b0a('0x63'),_0x3b0a('0x64'),_0x3b0a('0x65'),_0x3b0a('0x66'),_0x3b0a('0x67')],squel['select']()[_0x3b0a('0x68')](_0x3b0a('0x69'),'phone')['field']('NOW()','scheduledAt')[_0x3b0a('0x68')](_0x3b0a('0x6a'),_0x3b0a('0x63'))[_0x3b0a('0x68')]('ANY_VALUE(ListId)',_0x3b0a('0x64'))[_0x3b0a('0x68')](_0x3b0a('0x6b'),_0x3b0a('0x65'))['field']('NOW()',_0x3b0a('0x66'))[_0x3b0a('0x68')]('NOW()',_0x3b0a('0x67'))['from'](_0x3b0a('0x6c'))['where'](_0x3b0a('0x6d'),_0x2630e8[_0x3b0a('0x42')]['id']['toString']())['where'](_0x3b0a('0x6e'),_0x2630e8['body'][_0x3b0a('0x6f')][_0x3b0a('0x70')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x3b0a('0x37')](_0x3b0a('0x71'),squel['select']()[_0x3b0a('0x68')](_0x3b0a('0x72'))['from'](_0x3b0a('0x60'))[_0x3b0a('0x37')]('VoiceQueueId\x20=\x20?',_0x2630e8[_0x3b0a('0x42')]['id'][_0x3b0a('0x70')]()))[_0x3b0a('0x37')](_0x3b0a('0x71'),squel[_0x3b0a('0x73')]()['field'](_0x3b0a('0x74'))[_0x3b0a('0x75')](_0x3b0a('0x6c'))[_0x3b0a('0x37')]('VoiceQueueId\x20=\x20?',_0x2630e8['params']['id'][_0x3b0a('0x70')]())[_0x3b0a('0x37')](_0x3b0a('0x76')))['group'](_0x3b0a('0x63')))[_0x3b0a('0x70')]();return db[_0x3b0a('0x4b')]['query'](_0x3df5f2);}return[];})[_0x3b0a('0x20')](respondWithResult(_0x34f439,null))[_0x3b0a('0x40')](handleError(_0x34f439,null));};exports[_0x3b0a('0x77')]=function(_0x5b218f,_0x104b1a,_0x3890c0){return db[_0x3b0a('0x78')][_0x3b0a('0x49')]({'where':{'id':_0x5b218f['params']['id']}})['then'](handleEntityNotFound(_0x104b1a,null))[_0x3b0a('0x20')](function(_0x295860){var _0x468fcc;if(_0x295860){_0x468fcc=squel[_0x3b0a('0x5e')]()['into'](_0x3b0a('0x60'))['fromQuery']([_0x3b0a('0x72'),_0x3b0a('0x62'),'ContactId','ListId','CampaignId',_0x3b0a('0x66'),_0x3b0a('0x67')],squel['select']()[_0x3b0a('0x68')](_0x3b0a('0x69'),'phone')[_0x3b0a('0x68')](_0x3b0a('0x79'),_0x3b0a('0x62'))[_0x3b0a('0x68')](_0x3b0a('0x6a'),_0x3b0a('0x63'))[_0x3b0a('0x68')](_0x3b0a('0x7a'),'ListId')[_0x3b0a('0x68')](_0x3b0a('0x7b'),_0x3b0a('0x7c'))[_0x3b0a('0x68')](_0x3b0a('0x79'),_0x3b0a('0x66'))[_0x3b0a('0x68')]('NOW()','updatedAt')[_0x3b0a('0x75')](_0x3b0a('0x6c'))[_0x3b0a('0x37')]('CampaignId\x20=\x20?',_0x5b218f[_0x3b0a('0x42')]['id']['toString']())[_0x3b0a('0x37')](_0x3b0a('0x6e'),_0x5b218f[_0x3b0a('0x48')][_0x3b0a('0x6f')][_0x3b0a('0x70')]())[_0x3b0a('0x37')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x3b0a('0x37')](_0x3b0a('0x71'),squel['select']()[_0x3b0a('0x68')](_0x3b0a('0x72'))['from'](_0x3b0a('0x60'))[_0x3b0a('0x37')](_0x3b0a('0x7d'),_0x5b218f[_0x3b0a('0x42')]['id'][_0x3b0a('0x70')]()))['where'](_0x3b0a('0x71'),squel[_0x3b0a('0x73')]()[_0x3b0a('0x68')](_0x3b0a('0x74'))[_0x3b0a('0x75')](_0x3b0a('0x6c'))['where'](_0x3b0a('0x7d'),_0x5b218f[_0x3b0a('0x42')]['id'][_0x3b0a('0x70')]())[_0x3b0a('0x37')](_0x3b0a('0x76')))[_0x3b0a('0x7e')](_0x3b0a('0x63')))[_0x3b0a('0x70')]();return db['sequelize'][_0x3b0a('0x2c')](_0x468fcc);}return[];})[_0x3b0a('0x20')](respondWithResult(_0x104b1a,null))['catch'](handleError(_0x104b1a,null));};exports[_0x3b0a('0x7f')]=function(_0x24c4f9,_0x5a31ef,_0x131f33){return db[_0x3b0a('0x80')][_0x3b0a('0x81')]({'where':{'VoiceQueueId':_0x24c4f9[_0x3b0a('0x48')][_0x3b0a('0x65')],'CampaignId':_0x24c4f9[_0x3b0a('0x48')][_0x3b0a('0x7c')],'ContactId':_0x24c4f9[_0x3b0a('0x48')][_0x3b0a('0x63')]}})[_0x3b0a('0x20')](handleEntityNotFound(_0x5a31ef,null))[_0x3b0a('0x20')](function(_0x31fee7){if(_0x31fee7){return _0x31fee7;}return null;})[_0x3b0a('0x20')](respondWithResult(_0x5a31ef,null))[_0x3b0a('0x40')](handleError(_0x5a31ef,null));}; \ No newline at end of file +var _0x3243=['VIRTUAL','options','CmHopperFinal','includeAll','include','findAll','rows','catch','show','keys','find','describe','uniqueid','body','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','answeringMachine','`state`\x20=\x205,\x201,\x20null','busyContacts','dropContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','state\x20=\x20?','CampaignId\x20=\x20?','CmHopper','findOne','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x1b338e,_0x25ac31){var _0x3ae2f4=function(_0x229fc5){while(--_0x229fc5){_0x1b338e['push'](_0x1b338e['shift']());}};_0x3ae2f4(++_0x25ac31);}(_0x3243,0xcc));var _0x3324=function(_0x5c60ff,_0x573ef6){_0x5c60ff=_0x5c60ff-0x0;var _0x43f517=_0x3243[_0x5c60ff];return _0x43f517;};'use strict';var pdf=require(_0x3324('0x0'));var emlformat=require(_0x3324('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3324('0x2'));var jsonpatch=require(_0x3324('0x3'));var rp=require(_0x3324('0x4'));var moment=require('moment');var BPromise=require(_0x3324('0x5'));var Mustache=require(_0x3324('0x6'));var util=require(_0x3324('0x7'));var path=require(_0x3324('0x8'));var sox=require(_0x3324('0x9'));var csv=require(_0x3324('0xa'));var ejs=require(_0x3324('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3324('0xc'));var Papa=require('papaparse');var Redis=require(_0x3324('0xd'));var authService=require(_0x3324('0xe'));var qs=require(_0x3324('0xf'));var as=require(_0x3324('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3324('0x11'))(_0x3324('0x12'));var utils=require(_0x3324('0x13'));var config=require(_0x3324('0x14'));var db=require(_0x3324('0x15'))['db'];function respondWithStatusCode(_0x3695d0,_0x4233d5){_0x4233d5=_0x4233d5||0xcc;return function(_0x15b8b7){if(_0x15b8b7){return _0x3695d0['sendStatus'](_0x4233d5);}return _0x3695d0[_0x3324('0x16')](_0x4233d5)[_0x3324('0x17')]();};}function respondWithResult(_0x280e9d,_0x795856){_0x795856=_0x795856||0xc8;return function(_0x2588fa){if(_0x2588fa){return _0x280e9d[_0x3324('0x16')](_0x795856)['json'](_0x2588fa);}};}function respondWithFilteredResult(_0x3954b2,_0x3ad8d2){return function(_0x3cd0f9){if(_0x3cd0f9){var _0x249dcf=_0x3cd0f9[_0x3324('0x18')],_0x1f20c8=_0x3ad8d2[_0x3324('0x19')],_0x48c98b=_0x3ad8d2[_0x3324('0x19')]+_0x3ad8d2[_0x3324('0x1a')],_0x4dd872;if(_0x48c98b>=_0x249dcf){_0x48c98b=_0x249dcf;_0x4dd872=0xc8;}else{_0x4dd872=0xce;}_0x3954b2[_0x3324('0x16')](_0x4dd872);return _0x3954b2[_0x3324('0x1b')](_0x3324('0x1c'),_0x1f20c8+'-'+_0x48c98b+'/'+_0x249dcf)[_0x3324('0x1d')](_0x3cd0f9);}return null;};}function patchUpdates(_0x13ecfb){return function(_0x49c53c){try{jsonpatch[_0x3324('0x1e')](_0x49c53c,_0x13ecfb,!![]);}catch(_0x1967bf){return BPromise['reject'](_0x1967bf);}return _0x49c53c[_0x3324('0x1f')]();};}function saveUpdates(_0x1c79b8,_0xc0b640){return function(_0x36e143){if(_0x36e143){return _0x36e143[_0x3324('0x20')](_0x1c79b8)[_0x3324('0x21')](function(_0x4bcb4b){return _0x4bcb4b;});}return null;};}function removeEntity(_0x4483b5,_0x530de5){return function(_0x5edd48){if(_0x5edd48){return _0x5edd48[_0x3324('0x22')]()[_0x3324('0x21')](function(){_0x4483b5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5588fd,_0x548495){return function(_0x2119d5){if(!_0x2119d5){_0x5588fd[_0x3324('0x23')](0x194);}return _0x2119d5;};}function handleError(_0x1895bf,_0x28a336){_0x28a336=_0x28a336||0x1f4;return function(_0x4dd01a){logger[_0x3324('0x24')](_0x4dd01a[_0x3324('0x25')]);if(_0x4dd01a[_0x3324('0x26')]){delete _0x4dd01a[_0x3324('0x26')];}_0x1895bf[_0x3324('0x16')](_0x28a336)[_0x3324('0x27')](_0x4dd01a);};}exports[_0x3324('0x28')]=function(_0x25c22c,_0x259d11){var _0x5835fa={},_0x482894={},_0x313b30={'count':0x0,'rows':[]};var _0x2e0ec=_['map'](db['CmHopperFinal'][_0x3324('0x29')],function(_0x18af60){return{'name':_0x18af60[_0x3324('0x2a')],'type':_0x18af60[_0x3324('0x2b')]['key']};});_0x482894[_0x3324('0x2c')]=_[_0x3324('0x2d')](_0x2e0ec,_0x3324('0x26'));_0x482894[_0x3324('0x2e')]=_['keys'](_0x25c22c[_0x3324('0x2e')]);_0x482894[_0x3324('0x2f')]=_[_0x3324('0x30')](_0x482894[_0x3324('0x2c')],_0x482894[_0x3324('0x2e')]);_0x5835fa[_0x3324('0x31')]=_[_0x3324('0x30')](_0x482894[_0x3324('0x2c')],qs[_0x3324('0x32')](_0x25c22c[_0x3324('0x2e')][_0x3324('0x32')]));_0x5835fa[_0x3324('0x31')]=_0x5835fa[_0x3324('0x31')]['length']?_0x5835fa['attributes']:_0x482894[_0x3324('0x2c')];if(!_0x25c22c[_0x3324('0x2e')][_0x3324('0x33')]('nolimit')){_0x5835fa[_0x3324('0x1a')]=qs[_0x3324('0x1a')](_0x25c22c[_0x3324('0x2e')]['limit']);_0x5835fa[_0x3324('0x19')]=qs['offset'](_0x25c22c[_0x3324('0x2e')]['offset']);}_0x5835fa[_0x3324('0x34')]=qs[_0x3324('0x35')](_0x25c22c[_0x3324('0x2e')][_0x3324('0x35')]);_0x5835fa[_0x3324('0x36')]=qs['filters'](_[_0x3324('0x37')](_0x25c22c[_0x3324('0x2e')],_0x482894[_0x3324('0x2f')]));if(_0x25c22c[_0x3324('0x2e')][_0x3324('0x38')]){_0x5835fa[_0x3324('0x36')]=_[_0x3324('0x39')](_0x5835fa[_0x3324('0x36')],{'$or':_[_0x3324('0x2d')](_0x2e0ec,function(_0x39913f){if(_0x39913f[_0x3324('0x2b')]!==_0x3324('0x3a')){var _0x5d01c4={};_0x5d01c4[_0x39913f[_0x3324('0x26')]]={'$like':'%'+_0x25c22c['query'][_0x3324('0x38')]+'%'};return _0x5d01c4;}})});}_0x5835fa=_[_0x3324('0x39')]({},_0x5835fa,_0x25c22c[_0x3324('0x3b')]);var _0x182282={'where':_0x5835fa[_0x3324('0x36')]};return db[_0x3324('0x3c')][_0x3324('0x18')](_0x182282)['then'](function(_0x23cada){_0x313b30['count']=_0x23cada;if(_0x25c22c[_0x3324('0x2e')][_0x3324('0x3d')]){_0x5835fa[_0x3324('0x3e')]=[{'all':!![]}];}return db[_0x3324('0x3c')][_0x3324('0x3f')](_0x5835fa);})[_0x3324('0x21')](function(_0x532eb2){_0x313b30[_0x3324('0x40')]=_0x532eb2;return _0x313b30;})[_0x3324('0x21')](respondWithFilteredResult(_0x259d11,_0x5835fa))[_0x3324('0x41')](handleError(_0x259d11,null));};exports[_0x3324('0x42')]=function(_0x135676,_0x27b88c){var _0x46bd75={'raw':!![],'where':{'id':_0x135676['params']['id']}},_0x1bc0e1={};_0x1bc0e1['model']=_[_0x3324('0x43')](db[_0x3324('0x3c')][_0x3324('0x29')]);_0x1bc0e1[_0x3324('0x2e')]=_[_0x3324('0x43')](_0x135676[_0x3324('0x2e')]);_0x1bc0e1[_0x3324('0x2f')]=_[_0x3324('0x30')](_0x1bc0e1[_0x3324('0x2c')],_0x1bc0e1[_0x3324('0x2e')]);_0x46bd75[_0x3324('0x31')]=_[_0x3324('0x30')](_0x1bc0e1[_0x3324('0x2c')],qs[_0x3324('0x32')](_0x135676[_0x3324('0x2e')][_0x3324('0x32')]));_0x46bd75['attributes']=_0x46bd75[_0x3324('0x31')]['length']?_0x46bd75[_0x3324('0x31')]:_0x1bc0e1[_0x3324('0x2c')];if(_0x135676[_0x3324('0x2e')][_0x3324('0x3d')]){_0x46bd75[_0x3324('0x3e')]=[{'all':!![]}];}_0x46bd75=_['merge']({},_0x46bd75,_0x135676[_0x3324('0x3b')]);return db[_0x3324('0x3c')][_0x3324('0x44')](_0x46bd75)[_0x3324('0x21')](handleEntityNotFound(_0x27b88c,null))[_0x3324('0x21')](respondWithResult(_0x27b88c,null))[_0x3324('0x41')](handleError(_0x27b88c,null));};exports[_0x3324('0x45')]=function(_0x1773ca,_0x21d061){return db[_0x3324('0x3c')]['describe']()[_0x3324('0x21')](respondWithResult(_0x21d061,null))[_0x3324('0x41')](handleError(_0x21d061,null));};exports['update']=function(_0x29a0dd,_0x56d942){if(_0x29a0dd['body'][_0x3324('0x46')]){delete _0x29a0dd[_0x3324('0x47')][_0x3324('0x46')];}return db[_0x3324('0x3c')][_0x3324('0x44')]({'where':{'uniqueid':_0x29a0dd[_0x3324('0x48')]['id']}})[_0x3324('0x21')](handleEntityNotFound(_0x56d942,null))[_0x3324('0x21')](saveUpdates(_0x29a0dd[_0x3324('0x47')],null))[_0x3324('0x21')](respondWithResult(_0x56d942,null))[_0x3324('0x41')](handleError(_0x56d942,null));};exports[_0x3324('0x49')]=function(_0x3a2a4c,_0x3d77e5,_0x115a17){return db[_0x3324('0x3c')][_0x3324('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x3a2a4c['params']['id']},'attributes':[[db[_0x3324('0x4a')]['fn']('COUNT',db[_0x3324('0x4a')]['fn']('IF',db['sequelize'][_0x3324('0x4b')](_0x3324('0x4c')))),_0x3324('0x4d')],[db['sequelize']['fn'](_0x3324('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x3324('0x4b')](_0x3324('0x4f')))),_0x3324('0x50')],[db['sequelize']['fn'](_0x3324('0x4e'),db[_0x3324('0x4a')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x3324('0x4a')]['fn']('COUNT',db[_0x3324('0x4a')]['fn']('IF',db['sequelize'][_0x3324('0x4b')](_0x3324('0x51')))),_0x3324('0x52')],[db[_0x3324('0x4a')]['fn'](_0x3324('0x4e'),db[_0x3324('0x4a')]['fn']('IF',db[_0x3324('0x4a')][_0x3324('0x4b')](_0x3324('0x53')))),'dropContacts'],[db[_0x3324('0x4a')]['fn']('COUNT',db[_0x3324('0x4a')]['fn']('IF',db[_0x3324('0x4a')][_0x3324('0x4b')](_0x3324('0x54')))),_0x3324('0x55')],[db[_0x3324('0x4a')]['fn'](_0x3324('0x4e'),db[_0x3324('0x4a')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x3324('0x56')],[db[_0x3324('0x4a')]['fn'](_0x3324('0x4e'),db[_0x3324('0x4a')]['fn']('IF',db[_0x3324('0x4a')][_0x3324('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0x3324('0x57')]]})[_0x3324('0x21')](handleEntityNotFound(_0x3d77e5,null))[_0x3324('0x21')](respondWithResult(_0x3d77e5,null))['catch'](handleError(_0x3d77e5,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x124d7e,_0x337d4d,_0x12dab3){return db['CmHopperFinal'][_0x3324('0x3f')]({'raw':![],'where':{'CampaignId':_0x124d7e[_0x3324('0x48')]['id']},'attributes':[[db[_0x3324('0x4a')]['fn'](_0x3324('0x4e'),db[_0x3324('0x4a')]['fn']('IF',db[_0x3324('0x4a')][_0x3324('0x4b')]('`state`\x20=\x200,\x201,\x20null'))),_0x3324('0x4d')],[db[_0x3324('0x4a')]['fn'](_0x3324('0x4e'),db[_0x3324('0x4a')]['fn']('IF',db[_0x3324('0x4a')][_0x3324('0x4b')](_0x3324('0x4f')))),_0x3324('0x50')],[db['sequelize']['fn'](_0x3324('0x4e'),db[_0x3324('0x4a')]['fn']('IF',db[_0x3324('0x4a')][_0x3324('0x4b')](_0x3324('0x58')))),_0x3324('0x59')],[db['sequelize']['fn'](_0x3324('0x4e'),db[_0x3324('0x4a')]['fn']('IF',db[_0x3324('0x4a')][_0x3324('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x3324('0x52')],[db[_0x3324('0x4a')]['fn'](_0x3324('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x3324('0x4b')](_0x3324('0x53')))),_0x3324('0x5a')],[db['sequelize']['fn']('COUNT',db[_0x3324('0x4a')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3324('0x55')],[db[_0x3324('0x4a')]['fn'](_0x3324('0x4e'),db['sequelize']['fn']('IF',db[_0x3324('0x4a')]['literal'](_0x3324('0x5b')))),_0x3324('0x56')],[db['sequelize']['fn'](_0x3324('0x4e'),db[_0x3324('0x4a')]['fn']('IF',db[_0x3324('0x4a')][_0x3324('0x4b')](_0x3324('0x5c')))),_0x3324('0x57')]]})[_0x3324('0x21')](handleEntityNotFound(_0x337d4d,null))[_0x3324('0x21')](respondWithResult(_0x337d4d,null))[_0x3324('0x41')](handleError(_0x337d4d,null));};exports[_0x3324('0x5d')]=function(_0x132247,_0x241ab8,_0x3c105b){return db[_0x3324('0x5e')][_0x3324('0x44')]({'where':{'id':_0x132247[_0x3324('0x48')]['id']}})[_0x3324('0x21')](handleEntityNotFound(_0x241ab8,null))['then'](function(_0x491bb6){var _0x2a00c2;if(_0x491bb6){_0x2a00c2=squel[_0x3324('0x5f')]()[_0x3324('0x60')](_0x3324('0x61'))[_0x3324('0x62')]([_0x3324('0x63'),_0x3324('0x64'),_0x3324('0x65'),_0x3324('0x66'),'VoiceQueueId',_0x3324('0x67'),_0x3324('0x68')],squel[_0x3324('0x69')]()[_0x3324('0x6a')](_0x3324('0x6b'),_0x3324('0x63'))['field'](_0x3324('0x6c'),_0x3324('0x64'))['field'](_0x3324('0x6d'),_0x3324('0x65'))[_0x3324('0x6a')]('ANY_VALUE(ListId)',_0x3324('0x66'))[_0x3324('0x6a')](_0x3324('0x6e'),_0x3324('0x6f'))[_0x3324('0x6a')](_0x3324('0x6c'),_0x3324('0x67'))[_0x3324('0x6a')]('NOW()',_0x3324('0x68'))[_0x3324('0x70')](_0x3324('0x71'))[_0x3324('0x36')](_0x3324('0x72'),_0x132247['params']['id']['toString']())[_0x3324('0x36')]('state\x20=\x20?',_0x132247['body'][_0x3324('0x73')][_0x3324('0x74')]())[_0x3324('0x36')](_0x3324('0x75'))[_0x3324('0x36')](_0x3324('0x76'),squel[_0x3324('0x69')]()[_0x3324('0x6a')](_0x3324('0x63'))['from'](_0x3324('0x61'))[_0x3324('0x36')](_0x3324('0x72'),_0x132247[_0x3324('0x48')]['id'][_0x3324('0x74')]()))[_0x3324('0x36')](_0x3324('0x76'),squel[_0x3324('0x69')]()[_0x3324('0x6a')](_0x3324('0x77'))['from']('cm_hopper_final')[_0x3324('0x36')](_0x3324('0x72'),_0x132247[_0x3324('0x48')]['id'][_0x3324('0x74')]())[_0x3324('0x36')](_0x3324('0x78')))[_0x3324('0x79')]('ContactId'))[_0x3324('0x74')]();return db[_0x3324('0x4a')][_0x3324('0x2e')](_0x2a00c2);}return[];})['then'](respondWithResult(_0x241ab8,null))['catch'](handleError(_0x241ab8,null));};exports[_0x3324('0x7a')]=function(_0x11076c,_0x49ce96,_0x2daa34){return db[_0x3324('0x7b')]['find']({'where':{'id':_0x11076c[_0x3324('0x48')]['id']}})[_0x3324('0x21')](handleEntityNotFound(_0x49ce96,null))['then'](function(_0xc30a94){var _0x550914;if(_0xc30a94){_0x550914=squel[_0x3324('0x5f')]()['into'](_0x3324('0x61'))[_0x3324('0x62')]([_0x3324('0x63'),_0x3324('0x64'),_0x3324('0x65'),_0x3324('0x66'),_0x3324('0x7c'),_0x3324('0x67'),'updatedAt'],squel['select']()[_0x3324('0x6a')](_0x3324('0x6b'),_0x3324('0x63'))['field'](_0x3324('0x6c'),_0x3324('0x64'))[_0x3324('0x6a')]('ANY_VALUE(ContactId)',_0x3324('0x65'))[_0x3324('0x6a')](_0x3324('0x7d'),_0x3324('0x66'))[_0x3324('0x6a')](_0x3324('0x7e'),_0x3324('0x7c'))[_0x3324('0x6a')](_0x3324('0x6c'),'createdAt')[_0x3324('0x6a')](_0x3324('0x6c'),_0x3324('0x68'))[_0x3324('0x70')](_0x3324('0x71'))[_0x3324('0x36')]('CampaignId\x20=\x20?',_0x11076c[_0x3324('0x48')]['id'][_0x3324('0x74')]())[_0x3324('0x36')](_0x3324('0x7f'),_0x11076c[_0x3324('0x47')]['state']['toString']())[_0x3324('0x36')](_0x3324('0x75'))[_0x3324('0x36')](_0x3324('0x76'),squel[_0x3324('0x69')]()[_0x3324('0x6a')](_0x3324('0x63'))[_0x3324('0x70')]('cm_hopper')['where'](_0x3324('0x80'),_0x11076c[_0x3324('0x48')]['id'][_0x3324('0x74')]()))[_0x3324('0x36')](_0x3324('0x76'),squel['select']()[_0x3324('0x6a')](_0x3324('0x77'))['from'](_0x3324('0x71'))[_0x3324('0x36')](_0x3324('0x80'),_0x11076c[_0x3324('0x48')]['id'][_0x3324('0x74')]())[_0x3324('0x36')](_0x3324('0x78')))[_0x3324('0x79')](_0x3324('0x65')))['toString']();return db[_0x3324('0x4a')][_0x3324('0x2e')](_0x550914);}return[];})[_0x3324('0x21')](respondWithResult(_0x49ce96,null))[_0x3324('0x41')](handleError(_0x49ce96,null));};exports['checkContactHopper']=function(_0x3598ab,_0x18f1ff,_0x47402b){return db[_0x3324('0x81')][_0x3324('0x82')]({'where':{'VoiceQueueId':_0x3598ab[_0x3324('0x47')][_0x3324('0x6f')],'CampaignId':_0x3598ab[_0x3324('0x47')][_0x3324('0x7c')],'ContactId':_0x3598ab['body'][_0x3324('0x65')]}})['then'](handleEntityNotFound(_0x18f1ff,null))[_0x3324('0x21')](function(_0x2e7c16){if(_0x2e7c16){return _0x2e7c16;}return null;})[_0x3324('0x21')](respondWithResult(_0x18f1ff,null))[_0x3324('0x41')](handleError(_0x18f1ff,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index aef6d0d..40de9b3 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 _0x87e5=['path','rimraf','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x7cb905,_0x5c2772){var _0x411552=function(_0xa6c946){while(--_0xa6c946){_0x7cb905['push'](_0x7cb905['shift']());}};_0x411552(++_0x5c2772);}(_0x87e5,0x73));var _0x587e=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0x87e5[_0x352e09];return _0x1b7094;};'use strict';var _=require(_0x587e('0x0'));var util=require(_0x587e('0x1'));var logger=require(_0x587e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x587e('0x3'));var rp=require(_0x587e('0x4'));var fs=require('fs');var path=require(_0x587e('0x5'));var rimraf=require(_0x587e('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0x587e('0x7')]=function(_0x28ff95,_0x79410a){return _0x28ff95['define'](_0x587e('0x8'),attributes,{'tableName':_0x587e('0x9'),'paranoid':![],'indexes':[{'name':_0x587e('0xa'),'fields':[_0x587e('0xa')]},{'name':_0x587e('0xb'),'fields':[_0x587e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x589c=['cm_hopper_final','uniqueid','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x589c,0x84));var _0xc589=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x589c[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0xc589('0x0'));var util=require(_0xc589('0x1'));var logger=require('../../config/logger')(_0xc589('0x2'));var moment=require('moment');var BPromise=require(_0xc589('0x3'));var rp=require(_0xc589('0x4'));var fs=require('fs');var path=require(_0xc589('0x5'));var rimraf=require(_0xc589('0x6'));var config=require(_0xc589('0x7'));var attributes=require(_0xc589('0x8'));module[_0xc589('0x9')]=function(_0x5074ad,_0x541657){return _0x5074ad[_0xc589('0xa')]('CmHopperFinal',attributes,{'tableName':_0xc589('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':'uniqueid','fields':[_0xc589('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index b03e626..1515613 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 _0xb848=['debug','stringify','error','code','message','info','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopperFinal,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb848,0x1ad));var _0x8b84=function(_0x21ffae,_0x3940f3){_0x21ffae=_0x21ffae-0x0;var _0x3a4f20=_0xb848[_0x21ffae];return _0x3a4f20;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8b84('0x0'));var BPromise=require(_0x8b84('0x1'));var rs=require(_0x8b84('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b84('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b84('0x4'))(_0x8b84('0x5'));var config=require(_0x8b84('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8b84('0x7')][_0x8b84('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15d481,_0x12bcbf,_0x18bcf4){return new BPromise(function(_0x51d7b2,_0x3f17b2){return client[_0x8b84('0x9')](_0x15d481,_0x18bcf4)[_0x8b84('0xa')](function(_0x4887ab){logger['info'](_0x8b84('0xb'),_0x12bcbf,_0x8b84('0xc'));logger[_0x8b84('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x12bcbf,_0x8b84('0xc'),JSON[_0x8b84('0xe')](_0x4887ab));if(_0x4887ab[_0x8b84('0xf')]){if(_0x4887ab['error'][_0x8b84('0x10')]===0x1f4){logger[_0x8b84('0xf')](_0x8b84('0xb'),_0x12bcbf,_0x4887ab['error'][_0x8b84('0x11')]);return _0x3f17b2(_0x4887ab['error'][_0x8b84('0x11')]);}logger[_0x8b84('0xf')](_0x8b84('0xb'),_0x12bcbf,_0x4887ab[_0x8b84('0xf')]['message']);return _0x51d7b2(_0x4887ab['error'][_0x8b84('0x11')]);}else{logger[_0x8b84('0x12')](_0x8b84('0xb'),_0x12bcbf,_0x8b84('0xc'));_0x51d7b2(_0x4887ab[_0x8b84('0x13')]['message']);}})[_0x8b84('0x14')](function(_0x7a711c){logger[_0x8b84('0xf')](_0x8b84('0xb'),_0x12bcbf,_0x7a711c);_0x3f17b2(_0x7a711c);});});}exports[_0x8b84('0x15')]=function(_0x540498){var _0x21c3c5=this;return new Promise(function(_0x1f8f64,_0x428159){return db[_0x8b84('0x16')][_0x8b84('0x17')](_0x540498[_0x8b84('0x18')],{'raw':_0x540498[_0x8b84('0x19')]?_0x540498[_0x8b84('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8b84('0xa')](function(_0x4a7c40){logger[_0x8b84('0x12')](_0x8b84('0x15'),_0x540498);logger[_0x8b84('0xd')](_0x8b84('0x15'),_0x540498,JSON[_0x8b84('0xe')](_0x4a7c40));_0x1f8f64(_0x4a7c40);})['catch'](function(_0x274dda){logger[_0x8b84('0xf')](_0x8b84('0x15'),_0x274dda[_0x8b84('0x11')],_0x540498);_0x428159(_0x21c3c5[_0x8b84('0xf')](0x1f4,_0x274dda[_0x8b84('0x11')]));});});}; \ No newline at end of file +var _0x8b3d=['info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x43e849,_0x356305){var _0x270fb7=function(_0x53fb05){while(--_0x53fb05){_0x43e849['push'](_0x43e849['shift']());}};_0x270fb7(++_0x356305);}(_0x8b3d,0xb3));var _0xd8b3=function(_0x2d1402,_0x249b4f){_0x2d1402=_0x2d1402-0x0;var _0x9927b2=_0x8b3d[_0x2d1402];return _0x9927b2;};'use strict';var _=require('lodash');var util=require(_0xd8b3('0x0'));var moment=require('moment');var BPromise=require(_0xd8b3('0x1'));var rs=require(_0xd8b3('0x2'));var fs=require('fs');var Redis=require(_0xd8b3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd8b3('0x4'))(_0xd8b3('0x5'));var config=require(_0xd8b3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd8b3('0x7')][_0xd8b3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x94579d,_0x3315cd,_0x3f89dc){return new BPromise(function(_0x171b05,_0x201d65){return client['request'](_0x94579d,_0x3f89dc)[_0xd8b3('0x9')](function(_0x1da10b){logger[_0xd8b3('0xa')](_0xd8b3('0xb'),_0x3315cd,_0xd8b3('0xc'));logger[_0xd8b3('0xd')](_0xd8b3('0xe'),_0x3315cd,_0xd8b3('0xc'),JSON[_0xd8b3('0xf')](_0x1da10b));if(_0x1da10b['error']){if(_0x1da10b[_0xd8b3('0x10')][_0xd8b3('0x11')]===0x1f4){logger[_0xd8b3('0x10')](_0xd8b3('0xb'),_0x3315cd,_0x1da10b[_0xd8b3('0x10')][_0xd8b3('0x12')]);return _0x201d65(_0x1da10b['error']['message']);}logger[_0xd8b3('0x10')](_0xd8b3('0xb'),_0x3315cd,_0x1da10b[_0xd8b3('0x10')][_0xd8b3('0x12')]);return _0x171b05(_0x1da10b[_0xd8b3('0x10')][_0xd8b3('0x12')]);}else{logger[_0xd8b3('0xa')]('CmHopperFinal,\x20%s,\x20%s',_0x3315cd,_0xd8b3('0xc'));_0x171b05(_0x1da10b[_0xd8b3('0x13')][_0xd8b3('0x12')]);}})[_0xd8b3('0x14')](function(_0x416425){logger['error'](_0xd8b3('0xb'),_0x3315cd,_0x416425);_0x201d65(_0x416425);});});}exports[_0xd8b3('0x15')]=function(_0x13a475){var _0x44daa2=this;return new Promise(function(_0x4bf2a2,_0x328051){return db[_0xd8b3('0x16')][_0xd8b3('0x17')](_0x13a475[_0xd8b3('0x18')],{'raw':_0x13a475[_0xd8b3('0x19')]?_0x13a475[_0xd8b3('0x19')][_0xd8b3('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x59223d){logger[_0xd8b3('0xa')](_0xd8b3('0x15'),_0x13a475);logger[_0xd8b3('0xd')](_0xd8b3('0x15'),_0x13a475,JSON[_0xd8b3('0xf')](_0x59223d));_0x4bf2a2(_0x59223d);})[_0xd8b3('0x14')](function(_0x114ea1){logger['error']('CreateCmHopperFinal',_0x114ea1[_0xd8b3('0x12')],_0x13a475);_0x328051(_0x44daa2[_0xd8b3('0x10')](0x1f4,_0x114ea1[_0xd8b3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 41f64eb..65596b9 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 _0x4bed=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal','post','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x4bed,0x191));var _0xd4be=function(_0x1f4a6e,_0x3f9060){_0x1f4a6e=_0x1f4a6e-0x0;var _0x2c93ef=_0x4bed[_0x1f4a6e];return _0x2c93ef;};'use strict';var multer=require(_0xd4be('0x0'));var util=require('util');var path=require(_0xd4be('0x1'));var timeout=require(_0xd4be('0x2'));var express=require(_0xd4be('0x3'));var router=express[_0xd4be('0x4')]();var auth=require(_0xd4be('0x5'));var interaction=require(_0xd4be('0x6'));var config=require(_0xd4be('0x7'));var controller=require(_0xd4be('0x8'));router[_0xd4be('0x9')]('/',auth[_0xd4be('0xa')](),controller['index']);router[_0xd4be('0x9')](_0xd4be('0xb'),auth[_0xd4be('0xa')](),controller[_0xd4be('0xc')]);router[_0xd4be('0x9')](_0xd4be('0xd'),auth[_0xd4be('0xa')](),controller[_0xd4be('0xe')]);router[_0xd4be('0x9')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0xd4be('0xf')]);router['get'](_0xd4be('0x10'),auth[_0xd4be('0xa')](),controller[_0xd4be('0x11')]);router['post']('/voice/queue/moveContacts/:id',auth[_0xd4be('0xa')](),controller[_0xd4be('0x12')]);router[_0xd4be('0x13')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller[_0xd4be('0x14')]);router['post']('/checkContactHopper',auth[_0xd4be('0xa')](),controller[_0xd4be('0x15')]);router[_0xd4be('0x16')](_0xd4be('0xd'),auth[_0xd4be('0xa')](),controller[_0xd4be('0x17')]);module[_0xd4be('0x18')]=router; \ No newline at end of file +var _0xf324=['Router','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','describe','/:id','isAuthenticated','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x5b9454,_0x5dd3d7){var _0x5c34d5=function(_0x31339d){while(--_0x31339d){_0x5b9454['push'](_0x5b9454['shift']());}};_0x5c34d5(++_0x5dd3d7);}(_0xf324,0xe5));var _0x4f32=function(_0x42447b,_0x598111){_0x42447b=_0x42447b-0x0;var _0x5c57e4=_0xf324[_0x42447b];return _0x5c57e4;};'use strict';var multer=require(_0x4f32('0x0'));var util=require(_0x4f32('0x1'));var path=require(_0x4f32('0x2'));var timeout=require(_0x4f32('0x3'));var express=require(_0x4f32('0x4'));var router=express[_0x4f32('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4f32('0x6'));var config=require(_0x4f32('0x7'));var controller=require(_0x4f32('0x8'));router[_0x4f32('0x9')]('/',auth['isAuthenticated'](),controller[_0x4f32('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4f32('0xb')]);router[_0x4f32('0x9')](_0x4f32('0xc'),auth[_0x4f32('0xd')](),controller['show']);router[_0x4f32('0x9')](_0x4f32('0xe'),auth[_0x4f32('0xd')](),controller[_0x4f32('0xf')]);router['get'](_0x4f32('0x10'),auth['isAuthenticated'](),controller[_0x4f32('0x11')]);router[_0x4f32('0x12')](_0x4f32('0x13'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router['post']('/voice/campaign/moveContacts/:id',auth[_0x4f32('0xd')](),controller[_0x4f32('0x14')]);router[_0x4f32('0x12')](_0x4f32('0x15'),auth['isAuthenticated'](),controller[_0x4f32('0x16')]);router[_0x4f32('0x17')](_0x4f32('0xc'),auth[_0x4f32('0xd')](),controller[_0x4f32('0x18')]);module[_0x4f32('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 10e13ed..36038b6 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 _0xd81a=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x523976,_0x2a80f6){var _0x51900f=function(_0x1b7dc4){while(--_0x1b7dc4){_0x523976['push'](_0x523976['shift']());}};_0x51900f(++_0x2a80f6);}(_0xd81a,0x115));var _0xad81=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xd81a[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0xad81('0x0'));module[_0xad81('0x1')]={'state':{'type':Sequelize[_0xad81('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xad81('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xad81('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xad81('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xad81('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xad81('0x4')]},'answertime':{'type':Sequelize[_0xad81('0x4')]},'droptime':{'type':Sequelize[_0xad81('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xad81('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xad81('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xad81('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xad81('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xad81('0x3')]},'campaign':{'type':Sequelize[_0xad81('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xad81('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xad81('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xad81('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xad81('0x4')]},'recallme':{'type':Sequelize[_0xad81('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xad81('0x4')]},'edited':{'type':Sequelize[_0xad81('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xad81('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xad81('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xad81('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xad81('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd905=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0xd905,0x170));var _0x5d90=function(_0x1dcfc3,_0x45592d){_0x1dcfc3=_0x1dcfc3-0x0;var _0x2a2362=_0xd905[_0x1dcfc3];return _0x2a2362;};'use strict';var Sequelize=require(_0x5d90('0x0'));module[_0x5d90('0x1')]={'state':{'type':Sequelize[_0x5d90('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x5d90('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x5d90('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5d90('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5d90('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5d90('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x5d90('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x5d90('0x4')]},'responsetime':{'type':Sequelize[_0x5d90('0x4')]},'answertime':{'type':Sequelize[_0x5d90('0x4')]},'droptime':{'type':Sequelize[_0x5d90('0x4')]},'endtime':{'type':Sequelize[_0x5d90('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5d90('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5d90('0x3')]},'campaign':{'type':Sequelize[_0x5d90('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5d90('0x3')]},'reason':{'type':Sequelize[_0x5d90('0x3')]},'amd':{'type':Sequelize[_0x5d90('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x5d90('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x5d90('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5d90('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5d90('0x4')]},'recallme':{'type':Sequelize[_0x5d90('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5d90('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5d90('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5d90('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5d90('0x2')],'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 2e812b7..ef3474d 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 _0xaef6=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','end','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','fields','length','find','create','describe','body','uniqueid','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xaef6,0x84));var _0x6aef=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xaef6[_0x57b54c];return _0x59cc19;};'use strict';var pdf=require(_0x6aef('0x0'));var emlformat=require(_0x6aef('0x1'));var rimraf=require(_0x6aef('0x2'));var zipdir=require(_0x6aef('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6aef('0x4'));var Mustache=require(_0x6aef('0x5'));var util=require(_0x6aef('0x6'));var path=require('path');var sox=require(_0x6aef('0x7'));var csv=require(_0x6aef('0x8'));var ejs=require(_0x6aef('0x9'));var fs=require('fs');var _=require(_0x6aef('0xa'));var squel=require('squel');var crypto=require(_0x6aef('0xb'));var jsforce=require(_0x6aef('0xc'));var deskjs=require(_0x6aef('0xd'));var toCsv=require(_0x6aef('0x8'));var querystring=require(_0x6aef('0xe'));var Papa=require('papaparse');var Redis=require(_0x6aef('0xf'));var authService=require(_0x6aef('0x10'));var qs=require(_0x6aef('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6aef('0x12'))(_0x6aef('0x13'));var utils=require('../../config/utils');var config=require(_0x6aef('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x561d46,_0x2cf49d){_0x2cf49d=_0x2cf49d||0xcc;return function(_0x9318ec){if(_0x9318ec){return _0x561d46['sendStatus'](_0x2cf49d);}return _0x561d46['status'](_0x2cf49d)[_0x6aef('0x15')]();};}function respondWithResult(_0x46c2ca,_0x3073d7){_0x3073d7=_0x3073d7||0xc8;return function(_0x1fa012){if(_0x1fa012){return _0x46c2ca[_0x6aef('0x16')](_0x3073d7)[_0x6aef('0x17')](_0x1fa012);}};}function respondWithFilteredResult(_0x590675,_0x64f9d5){return function(_0x1eb94c){if(_0x1eb94c){var _0x6ba689=_0x1eb94c['count'],_0x1f8ca6=_0x64f9d5[_0x6aef('0x18')],_0x28403b=_0x64f9d5[_0x6aef('0x18')]+_0x64f9d5[_0x6aef('0x19')],_0x5785b4;if(_0x28403b>=_0x6ba689){_0x28403b=_0x6ba689;_0x5785b4=0xc8;}else{_0x5785b4=0xce;}_0x590675[_0x6aef('0x16')](_0x5785b4);return _0x590675['set'](_0x6aef('0x1a'),_0x1f8ca6+'-'+_0x28403b+'/'+_0x6ba689)['json'](_0x1eb94c);}return null;};}function patchUpdates(_0x475f74){return function(_0x21c661){try{jsonpatch[_0x6aef('0x1b')](_0x21c661,_0x475f74,!![]);}catch(_0x23c63b){return BPromise[_0x6aef('0x1c')](_0x23c63b);}return _0x21c661[_0x6aef('0x1d')]();};}function saveUpdates(_0x2c56bf,_0x125d88){return function(_0x29f5cd){if(_0x29f5cd){return _0x29f5cd[_0x6aef('0x1e')](_0x2c56bf)[_0x6aef('0x1f')](function(_0x115f81){return _0x115f81;});}return null;};}function removeEntity(_0x54c4fd,_0x3eb269){return function(_0x1ec737){if(_0x1ec737){return _0x1ec737[_0x6aef('0x20')]()['then'](function(){_0x54c4fd[_0x6aef('0x16')](0xcc)[_0x6aef('0x15')]();});}};}function handleEntityNotFound(_0x51b4e0,_0x3e9499){return function(_0x1a414f){if(!_0x1a414f){_0x51b4e0[_0x6aef('0x21')](0x194);}return _0x1a414f;};}function handleError(_0x5e7f75,_0xfb4b96){_0xfb4b96=_0xfb4b96||0x1f4;return function(_0xe0e6c0){logger['error'](_0xe0e6c0[_0x6aef('0x22')]);if(_0xe0e6c0[_0x6aef('0x23')]){delete _0xe0e6c0[_0x6aef('0x23')];}_0x5e7f75[_0x6aef('0x16')](_0xfb4b96)[_0x6aef('0x24')](_0xe0e6c0);};}exports['index']=function(_0x230d5b,_0x148338){var _0x5192eb={},_0x5223e4={},_0x39d876={'count':0x0,'rows':[]};var _0x15cc4e=_['map'](db[_0x6aef('0x25')][_0x6aef('0x26')],function(_0x4cc32e){return{'name':_0x4cc32e[_0x6aef('0x27')],'type':_0x4cc32e[_0x6aef('0x28')][_0x6aef('0x29')]};});_0x5223e4[_0x6aef('0x2a')]=_[_0x6aef('0x2b')](_0x15cc4e,_0x6aef('0x23'));_0x5223e4['query']=_[_0x6aef('0x2c')](_0x230d5b[_0x6aef('0x2d')]);_0x5223e4['filters']=_[_0x6aef('0x2e')](_0x5223e4[_0x6aef('0x2a')],_0x5223e4[_0x6aef('0x2d')]);_0x5192eb[_0x6aef('0x2f')]=_[_0x6aef('0x2e')](_0x5223e4[_0x6aef('0x2a')],qs['fields'](_0x230d5b[_0x6aef('0x2d')]['fields']));_0x5192eb['attributes']=_0x5192eb[_0x6aef('0x2f')]['length']?_0x5192eb[_0x6aef('0x2f')]:_0x5223e4[_0x6aef('0x2a')];if(!_0x230d5b[_0x6aef('0x2d')][_0x6aef('0x30')](_0x6aef('0x31'))){_0x5192eb[_0x6aef('0x19')]=qs[_0x6aef('0x19')](_0x230d5b[_0x6aef('0x2d')][_0x6aef('0x19')]);_0x5192eb['offset']=qs['offset'](_0x230d5b[_0x6aef('0x2d')]['offset']);}_0x5192eb[_0x6aef('0x32')]=qs[_0x6aef('0x33')](_0x230d5b[_0x6aef('0x2d')][_0x6aef('0x33')]);_0x5192eb[_0x6aef('0x34')]=qs[_0x6aef('0x35')](_[_0x6aef('0x36')](_0x230d5b[_0x6aef('0x2d')],_0x5223e4[_0x6aef('0x35')]));if(_0x230d5b[_0x6aef('0x2d')][_0x6aef('0x37')]){_0x5192eb['where']=_[_0x6aef('0x38')](_0x5192eb[_0x6aef('0x34')],{'$or':_[_0x6aef('0x2b')](_0x15cc4e,function(_0x2ac1c2){if(_0x2ac1c2[_0x6aef('0x28')]!==_0x6aef('0x39')){var _0x15b193={};_0x15b193[_0x2ac1c2['name']]={'$like':'%'+_0x230d5b[_0x6aef('0x2d')]['filter']+'%'};return _0x15b193;}})});}_0x5192eb=_[_0x6aef('0x38')]({},_0x5192eb,_0x230d5b[_0x6aef('0x3a')]);var _0x1e6ae9={'where':_0x5192eb['where']};return db[_0x6aef('0x25')][_0x6aef('0x3b')](_0x1e6ae9)['then'](function(_0x486678){_0x39d876[_0x6aef('0x3b')]=_0x486678;if(_0x230d5b[_0x6aef('0x2d')][_0x6aef('0x3c')]){_0x5192eb[_0x6aef('0x3d')]=[{'all':!![]}];}return db[_0x6aef('0x25')][_0x6aef('0x3e')](_0x5192eb);})['then'](function(_0x151967){_0x39d876[_0x6aef('0x3f')]=_0x151967;return _0x39d876;})[_0x6aef('0x1f')](respondWithFilteredResult(_0x148338,_0x5192eb))[_0x6aef('0x40')](handleError(_0x148338,null));};exports['show']=function(_0x23c8f9,_0x2bbd25){var _0x1bdb30={'raw':!![],'where':{'id':_0x23c8f9[_0x6aef('0x41')]['id']}},_0x3ab8d9={};_0x3ab8d9[_0x6aef('0x2a')]=_[_0x6aef('0x2c')](db[_0x6aef('0x25')][_0x6aef('0x26')]);_0x3ab8d9['query']=_[_0x6aef('0x2c')](_0x23c8f9[_0x6aef('0x2d')]);_0x3ab8d9['filters']=_[_0x6aef('0x2e')](_0x3ab8d9[_0x6aef('0x2a')],_0x3ab8d9['query']);_0x1bdb30[_0x6aef('0x2f')]=_[_0x6aef('0x2e')](_0x3ab8d9[_0x6aef('0x2a')],qs[_0x6aef('0x42')](_0x23c8f9['query'][_0x6aef('0x42')]));_0x1bdb30['attributes']=_0x1bdb30[_0x6aef('0x2f')][_0x6aef('0x43')]?_0x1bdb30[_0x6aef('0x2f')]:_0x3ab8d9['model'];if(_0x23c8f9['query']['includeAll']){_0x1bdb30['include']=[{'all':!![]}];}_0x1bdb30=_[_0x6aef('0x38')]({},_0x1bdb30,_0x23c8f9[_0x6aef('0x3a')]);return db[_0x6aef('0x25')][_0x6aef('0x44')](_0x1bdb30)[_0x6aef('0x1f')](handleEntityNotFound(_0x2bbd25,null))[_0x6aef('0x1f')](respondWithResult(_0x2bbd25,null))[_0x6aef('0x40')](handleError(_0x2bbd25,null));};exports[_0x6aef('0x45')]=function(_0x436574,_0x2c391c){return db[_0x6aef('0x25')][_0x6aef('0x45')](_0x436574['body'],{})[_0x6aef('0x1f')](respondWithResult(_0x2c391c,0xc9))[_0x6aef('0x40')](handleError(_0x2c391c,null));};exports[_0x6aef('0x46')]=function(_0x5889e5,_0x1184d2){return db['CmHopperHistory'][_0x6aef('0x46')]()[_0x6aef('0x1f')](respondWithResult(_0x1184d2,null))[_0x6aef('0x40')](handleError(_0x1184d2,null));};exports['update']=function(_0x49996b,_0x5eda54){if(_0x49996b[_0x6aef('0x47')][_0x6aef('0x48')]){delete _0x49996b[_0x6aef('0x47')]['uniqueid'];}return db[_0x6aef('0x25')][_0x6aef('0x44')]({'where':{'uniqueid':_0x49996b[_0x6aef('0x41')]['id']}})['then'](handleEntityNotFound(_0x5eda54,null))[_0x6aef('0x1f')](saveUpdates(_0x49996b['body'],null))[_0x6aef('0x1f')](respondWithResult(_0x5eda54,null))[_0x6aef('0x40')](handleError(_0x5eda54,null));}; \ No newline at end of file +var _0x6547=['fields','attributes','length','nolimit','limit','offset','sort','where','filter','merge','VIRTUAL','options','includeAll','include','CmHopperHistory','findAll','rows','catch','find','create','body','describe','uniqueid','params','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x2cba1a,_0x1817be){var _0x24eb6d=function(_0x2f7007){while(--_0x2f7007){_0x2cba1a['push'](_0x2cba1a['shift']());}};_0x24eb6d(++_0x1817be);}(_0x6547,0xa2));var _0x7654=function(_0x4723bc,_0x5b1faa){_0x4723bc=_0x4723bc-0x0;var _0x21ec23=_0x6547[_0x4723bc];return _0x21ec23;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7654('0x0'));var rimraf=require(_0x7654('0x1'));var zipdir=require(_0x7654('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7654('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7654('0x4'));var util=require(_0x7654('0x5'));var path=require(_0x7654('0x6'));var sox=require(_0x7654('0x7'));var csv=require('to-csv');var ejs=require(_0x7654('0x8'));var fs=require('fs');var _=require(_0x7654('0x9'));var squel=require(_0x7654('0xa'));var crypto=require(_0x7654('0xb'));var jsforce=require(_0x7654('0xc'));var deskjs=require(_0x7654('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7654('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7654('0xf'));var qs=require(_0x7654('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7654('0x11'))(_0x7654('0x12'));var utils=require(_0x7654('0x13'));var config=require('../../config/environment');var db=require(_0x7654('0x14'))['db'];function respondWithStatusCode(_0x3b878c,_0x21fcb1){_0x21fcb1=_0x21fcb1||0xcc;return function(_0x430d1f){if(_0x430d1f){return _0x3b878c[_0x7654('0x15')](_0x21fcb1);}return _0x3b878c[_0x7654('0x16')](_0x21fcb1)[_0x7654('0x17')]();};}function respondWithResult(_0x1bd1b8,_0x4c913e){_0x4c913e=_0x4c913e||0xc8;return function(_0x4a2746){if(_0x4a2746){return _0x1bd1b8[_0x7654('0x16')](_0x4c913e)[_0x7654('0x18')](_0x4a2746);}};}function respondWithFilteredResult(_0xfbb522,_0x38b1a0){return function(_0xb989a2){if(_0xb989a2){var _0x55ea92=_0xb989a2[_0x7654('0x19')],_0x53473e=_0x38b1a0['offset'],_0x1fc988=_0x38b1a0['offset']+_0x38b1a0['limit'],_0x5b488d;if(_0x1fc988>=_0x55ea92){_0x1fc988=_0x55ea92;_0x5b488d=0xc8;}else{_0x5b488d=0xce;}_0xfbb522[_0x7654('0x16')](_0x5b488d);return _0xfbb522['set']('Content-Range',_0x53473e+'-'+_0x1fc988+'/'+_0x55ea92)['json'](_0xb989a2);}return null;};}function patchUpdates(_0x3749ea){return function(_0x22b9d0){try{jsonpatch['apply'](_0x22b9d0,_0x3749ea,!![]);}catch(_0x2d9f62){return BPromise[_0x7654('0x1a')](_0x2d9f62);}return _0x22b9d0['save']();};}function saveUpdates(_0x5979c8,_0xf7014a){return function(_0x3abcde){if(_0x3abcde){return _0x3abcde[_0x7654('0x1b')](_0x5979c8)[_0x7654('0x1c')](function(_0x211752){return _0x211752;});}return null;};}function removeEntity(_0x5d2462,_0x44c3a6){return function(_0x373222){if(_0x373222){return _0x373222[_0x7654('0x1d')]()[_0x7654('0x1c')](function(){_0x5d2462['status'](0xcc)[_0x7654('0x17')]();});}};}function handleEntityNotFound(_0xbf4a84,_0x1c079d){return function(_0x2ee5fd){if(!_0x2ee5fd){_0xbf4a84[_0x7654('0x15')](0x194);}return _0x2ee5fd;};}function handleError(_0x8c5231,_0x16edbc){_0x16edbc=_0x16edbc||0x1f4;return function(_0x2e4d2d){logger[_0x7654('0x1e')](_0x2e4d2d[_0x7654('0x1f')]);if(_0x2e4d2d[_0x7654('0x20')]){delete _0x2e4d2d[_0x7654('0x20')];}_0x8c5231[_0x7654('0x16')](_0x16edbc)[_0x7654('0x21')](_0x2e4d2d);};}exports[_0x7654('0x22')]=function(_0x319915,_0x2e9967){var _0x54069a={},_0x3af786={},_0x29514b={'count':0x0,'rows':[]};var _0x176f1c=_[_0x7654('0x23')](db['CmHopperHistory'][_0x7654('0x24')],function(_0x167dc1){return{'name':_0x167dc1[_0x7654('0x25')],'type':_0x167dc1[_0x7654('0x26')][_0x7654('0x27')]};});_0x3af786[_0x7654('0x28')]=_['map'](_0x176f1c,'name');_0x3af786[_0x7654('0x29')]=_[_0x7654('0x2a')](_0x319915[_0x7654('0x29')]);_0x3af786[_0x7654('0x2b')]=_[_0x7654('0x2c')](_0x3af786[_0x7654('0x28')],_0x3af786[_0x7654('0x29')]);_0x54069a['attributes']=_[_0x7654('0x2c')](_0x3af786[_0x7654('0x28')],qs[_0x7654('0x2d')](_0x319915[_0x7654('0x29')][_0x7654('0x2d')]));_0x54069a[_0x7654('0x2e')]=_0x54069a['attributes'][_0x7654('0x2f')]?_0x54069a[_0x7654('0x2e')]:_0x3af786[_0x7654('0x28')];if(!_0x319915[_0x7654('0x29')]['hasOwnProperty'](_0x7654('0x30'))){_0x54069a[_0x7654('0x31')]=qs[_0x7654('0x31')](_0x319915[_0x7654('0x29')][_0x7654('0x31')]);_0x54069a[_0x7654('0x32')]=qs['offset'](_0x319915[_0x7654('0x29')][_0x7654('0x32')]);}_0x54069a['order']=qs['sort'](_0x319915[_0x7654('0x29')][_0x7654('0x33')]);_0x54069a[_0x7654('0x34')]=qs[_0x7654('0x2b')](_['pick'](_0x319915['query'],_0x3af786[_0x7654('0x2b')]));if(_0x319915[_0x7654('0x29')][_0x7654('0x35')]){_0x54069a[_0x7654('0x34')]=_[_0x7654('0x36')](_0x54069a[_0x7654('0x34')],{'$or':_[_0x7654('0x23')](_0x176f1c,function(_0x2f9b43){if(_0x2f9b43['type']!==_0x7654('0x37')){var _0x5113b9={};_0x5113b9[_0x2f9b43[_0x7654('0x20')]]={'$like':'%'+_0x319915['query'][_0x7654('0x35')]+'%'};return _0x5113b9;}})});}_0x54069a=_[_0x7654('0x36')]({},_0x54069a,_0x319915[_0x7654('0x38')]);var _0x297dfc={'where':_0x54069a['where']};return db['CmHopperHistory'][_0x7654('0x19')](_0x297dfc)[_0x7654('0x1c')](function(_0x5c569c){_0x29514b[_0x7654('0x19')]=_0x5c569c;if(_0x319915['query'][_0x7654('0x39')]){_0x54069a[_0x7654('0x3a')]=[{'all':!![]}];}return db[_0x7654('0x3b')][_0x7654('0x3c')](_0x54069a);})[_0x7654('0x1c')](function(_0x1f276f){_0x29514b[_0x7654('0x3d')]=_0x1f276f;return _0x29514b;})[_0x7654('0x1c')](respondWithFilteredResult(_0x2e9967,_0x54069a))[_0x7654('0x3e')](handleError(_0x2e9967,null));};exports['show']=function(_0xd8f1ea,_0x3a6ad1){var _0x344e71={'raw':!![],'where':{'id':_0xd8f1ea['params']['id']}},_0x4fddb={};_0x4fddb['model']=_['keys'](db[_0x7654('0x3b')][_0x7654('0x24')]);_0x4fddb[_0x7654('0x29')]=_[_0x7654('0x2a')](_0xd8f1ea[_0x7654('0x29')]);_0x4fddb[_0x7654('0x2b')]=_[_0x7654('0x2c')](_0x4fddb['model'],_0x4fddb[_0x7654('0x29')]);_0x344e71['attributes']=_[_0x7654('0x2c')](_0x4fddb[_0x7654('0x28')],qs[_0x7654('0x2d')](_0xd8f1ea[_0x7654('0x29')][_0x7654('0x2d')]));_0x344e71['attributes']=_0x344e71[_0x7654('0x2e')]['length']?_0x344e71[_0x7654('0x2e')]:_0x4fddb[_0x7654('0x28')];if(_0xd8f1ea['query'][_0x7654('0x39')]){_0x344e71[_0x7654('0x3a')]=[{'all':!![]}];}_0x344e71=_[_0x7654('0x36')]({},_0x344e71,_0xd8f1ea[_0x7654('0x38')]);return db[_0x7654('0x3b')][_0x7654('0x3f')](_0x344e71)[_0x7654('0x1c')](handleEntityNotFound(_0x3a6ad1,null))['then'](respondWithResult(_0x3a6ad1,null))[_0x7654('0x3e')](handleError(_0x3a6ad1,null));};exports['create']=function(_0x55a11e,_0xa205ef){return db[_0x7654('0x3b')][_0x7654('0x40')](_0x55a11e[_0x7654('0x41')],{})[_0x7654('0x1c')](respondWithResult(_0xa205ef,0xc9))['catch'](handleError(_0xa205ef,null));};exports[_0x7654('0x42')]=function(_0x182f2f,_0x64bda9){return db[_0x7654('0x3b')][_0x7654('0x42')]()[_0x7654('0x1c')](respondWithResult(_0x64bda9,null))[_0x7654('0x3e')](handleError(_0x64bda9,null));};exports[_0x7654('0x1b')]=function(_0x420337,_0x134637){if(_0x420337['body'][_0x7654('0x43')]){delete _0x420337['body'][_0x7654('0x43')];}return db[_0x7654('0x3b')][_0x7654('0x3f')]({'where':{'uniqueid':_0x420337[_0x7654('0x44')]['id']}})[_0x7654('0x1c')](handleEntityNotFound(_0x134637,null))[_0x7654('0x1c')](saveUpdates(_0x420337[_0x7654('0x41')],null))[_0x7654('0x1c')](respondWithResult(_0x134637,null))['catch'](handleError(_0x134637,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index f061fbb..7e5329d 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 _0x09c5=['cm_hopper_history','endtime','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','CmHopperHistory'];(function(_0x319e1c,_0x3b4634){var _0x49c88d=function(_0x4574cb){while(--_0x4574cb){_0x319e1c['push'](_0x319e1c['shift']());}};_0x49c88d(++_0x3b4634);}(_0x09c5,0xec));var _0x509c=function(_0x466e89,_0x237ae3){_0x466e89=_0x466e89-0x0;var _0x580986=_0x09c5[_0x466e89];return _0x580986;};'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('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x509c('0x6'));var config=require(_0x509c('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0x509c('0x8')]=function(_0x370f95,_0x48bda5){return _0x370f95[_0x509c('0x9')](_0x509c('0xa'),attributes,{'tableName':_0x509c('0xb'),'paranoid':![],'indexes':[{'name':_0x509c('0xc'),'fields':[_0x509c('0xc')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c4a=['path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','api','bluebird','request-promise'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4c4a,0x190));var _0xa4c4=function(_0x4b7e6f,_0x3043db){_0x4b7e6f=_0x4b7e6f-0x0;var _0x6f71b4=_0x4c4a[_0x4b7e6f];return _0x6f71b4;};'use strict';var _=require(_0xa4c4('0x0'));var util=require(_0xa4c4('0x1'));var logger=require('../../config/logger')(_0xa4c4('0x2'));var moment=require('moment');var BPromise=require(_0xa4c4('0x3'));var rp=require(_0xa4c4('0x4'));var fs=require('fs');var path=require(_0xa4c4('0x5'));var rimraf=require(_0xa4c4('0x6'));var config=require(_0xa4c4('0x7'));var attributes=require(_0xa4c4('0x8'));module[_0xa4c4('0x9')]=function(_0x250934,_0x19fe54){return _0x250934[_0xa4c4('0xa')](_0xa4c4('0xb'),attributes,{'tableName':_0xa4c4('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xa4c4('0xd')]},{'name':_0xa4c4('0xe'),'fields':[_0xa4c4('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 056a6ed..c641f83 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 _0xb58b=['CmHopperHistory','create','body','options','raw','debug','catch','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb58b,0x1f1));var _0xbb58=function(_0x16f48e,_0x2d2d97){_0x16f48e=_0x16f48e-0x0;var _0x11524f=_0xb58b[_0x16f48e];return _0x11524f;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});}exports[_0xbb58('0x14')]=function(_0x3134ea){var _0x48f3e0=this;return new Promise(function(_0xbee66,_0x497653){return db[_0xbb58('0x15')][_0xbb58('0x16')](_0x3134ea[_0xbb58('0x17')],{'raw':_0x3134ea[_0xbb58('0x18')]?_0x3134ea[_0xbb58('0x18')][_0xbb58('0x19')]===undefined?!![]:![]:!![]})[_0xbb58('0xa')](function(_0x497fd0){logger[_0xbb58('0xb')](_0xbb58('0x14'),_0x3134ea);logger[_0xbb58('0x1a')](_0xbb58('0x14'),_0x3134ea,JSON[_0xbb58('0xf')](_0x497fd0));_0xbee66(_0x497fd0);})[_0xbb58('0x1b')](function(_0x49453a){logger[_0xbb58('0x10')](_0xbb58('0x14'),_0x49453a['message'],_0x3134ea);_0x497653(_0x48f3e0[_0xbb58('0x10')](0x1f4,_0x49453a['message']));});});};exports[_0xbb58('0x1c')]=function(_0x287822){var _0x152f22=this;return new Promise(function(_0x3e215c,_0x2d111c){return db[_0xbb58('0x15')][_0xbb58('0x1d')]({'raw':_0x287822[_0xbb58('0x18')]?_0x287822['options'][_0xbb58('0x19')]===undefined?!![]:![]:!![],'where':_0x287822[_0xbb58('0x18')]?_0x287822[_0xbb58('0x18')][_0xbb58('0x1e')]||null:null,'attributes':[[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')][_0xbb58('0x21')]('id')),_0xbb58('0x22')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x24')))),'predictiveIntervalAnsweredCalls'],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x25')))),_0xbb58('0x26')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db['sequelize']['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x27')))),_0xbb58('0x28')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x29'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x2a')))),_0xbb58('0x2b')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x29'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xbb58('0x2c')))),_0xbb58('0x2d')]]})[_0xbb58('0xa')](function(_0x3c7627){logger[_0xbb58('0xb')](_0xbb58('0x1c'),_0x287822);logger[_0xbb58('0x1a')](_0xbb58('0x1c'),_0x287822,JSON['stringify'](_0x3c7627));_0x3e215c(_0x3c7627);})[_0xbb58('0x1b')](function(_0x230859){logger['error'](_0xbb58('0x1c'),_0x230859['message'],_0x287822);_0x2d111c(_0x152f22[_0xbb58('0x10')](0x1f4,_0x230859['message']));});});};exports[_0xbb58('0x2e')]=function(_0x36c7b4){var _0x52f4af=this;return new Promise(function(_0x3d3aee,_0x300c7b){return db[_0xbb58('0x15')][_0xbb58('0x1d')]({'raw':_0x36c7b4[_0xbb58('0x18')]?_0x36c7b4[_0xbb58('0x18')][_0xbb58('0x19')]===undefined?!![]:![]:!![],'where':_0x36c7b4[_0xbb58('0x18')]?_0x36c7b4['options'][_0xbb58('0x1e')]||null:null,'attributes':[[_0xbb58('0x2f'),_0xbb58('0x30')],[db['sequelize']['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db['sequelize'][_0xbb58('0x23')](_0xbb58('0x31')))),_0xbb58('0x32')],[db['sequelize']['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x33')))),_0xbb58('0x34')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x24')))),_0xbb58('0x35')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db['sequelize'][_0xbb58('0x23')](_0xbb58('0x36')))),_0xbb58('0x37')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x38')))),'outboundCongestionCallsDay'],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x39')))),_0xbb58('0x3a')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x3b')))),_0xbb58('0x3c')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xbb58('0x3d')))),_0xbb58('0x3e')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x3f')))),_0xbb58('0x40')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db['sequelize']['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')]('`state`\x20=\x2014,\x201,\x20null'))),_0xbb58('0x41')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db['sequelize'][_0xbb58('0x23')]('`state`\x20=\x2018,\x201,\x20null'))),_0xbb58('0x42')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db['sequelize']['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),_0xbb58('0x43')],[db['sequelize']['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')](_0xbb58('0x44')))),_0xbb58('0x42')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')]['literal'](_0xbb58('0x45')))),_0xbb58('0x46')]],'group':['campaign']})[_0xbb58('0xa')](function(_0x44636b){logger[_0xbb58('0xb')]('GetVoiceQueueHopperHistory',_0x36c7b4);logger[_0xbb58('0x1a')](_0xbb58('0x2e'),_0x36c7b4,JSON[_0xbb58('0xf')](_0x44636b));_0x3d3aee(_0x44636b);})['catch'](function(_0x537ed5){logger['error'](_0xbb58('0x2e'),_0x537ed5[_0xbb58('0x12')],_0x36c7b4);_0x300c7b(_0x52f4af[_0xbb58('0x10')](0x1f4,_0x537ed5['message']));});});};exports['GetCampaignHopperHistory']=function(_0x1573d1){var _0x40c55d=this;return new Promise(function(_0x37bb99,_0x23ed08){return db[_0xbb58('0x15')]['findAll']({'raw':_0x1573d1[_0xbb58('0x18')]?_0x1573d1[_0xbb58('0x18')][_0xbb58('0x19')]===undefined?!![]:![]:!![],'where':_0x1573d1['options']?_0x1573d1[_0xbb58('0x18')][_0xbb58('0x1e')]||null:null,'attributes':[[_0xbb58('0x2f'),_0xbb58('0x30')],[db[_0xbb58('0x1f')]['fn']('COUNT',db[_0xbb58('0x1f')][_0xbb58('0x21')]('id')),_0xbb58('0x47')],[db[_0xbb58('0x1f')]['fn'](_0xbb58('0x20'),db[_0xbb58('0x1f')]['fn']('IF',db[_0xbb58('0x1f')][_0xbb58('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0xbb58('0x48')]],'group':['campaign']})[_0xbb58('0xa')](function(_0x29c28b){logger[_0xbb58('0xb')](_0xbb58('0x49'),_0x1573d1);logger[_0xbb58('0x1a')](_0xbb58('0x49'),_0x1573d1,JSON[_0xbb58('0xf')](_0x29c28b));_0x37bb99(_0x29c28b);})[_0xbb58('0x1b')](function(_0x19ef37){logger[_0xbb58('0x10')](_0xbb58('0x49'),_0x19ef37['message'],_0x1573d1);_0x23ed08(_0x40c55d[_0xbb58('0x10')](0x1f4,_0x19ef37[_0xbb58('0x12')]));});});}; \ No newline at end of file +var _0xa571=['CreateCmHopperHistory','CmHopperHistory','create','body','options','AvgHandleTime','findAll','raw','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa571,0x107));var _0x1a57=function(_0x6f76f5,_0x29737e){_0x6f76f5=_0x6f76f5-0x0;var _0x4b11e6=_0xa571[_0x6f76f5];return _0x4b11e6;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var moment=require(_0x1a57('0x2'));var BPromise=require(_0x1a57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a57('0x4'));var db=require(_0x1a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a57('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a57('0x7'));var client=jayson[_0x1a57('0x8')][_0x1a57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5352,_0x2492f5,_0x924873){return new BPromise(function(_0x5d9f45,_0x3edb40){return client[_0x1a57('0xa')](_0x3c5352,_0x924873)[_0x1a57('0xb')](function(_0x58e266){logger[_0x1a57('0xc')](_0x1a57('0xd'),_0x2492f5,_0x1a57('0xe'));logger[_0x1a57('0xf')](_0x1a57('0x10'),_0x2492f5,_0x1a57('0xe'),JSON[_0x1a57('0x11')](_0x58e266));if(_0x58e266[_0x1a57('0x12')]){if(_0x58e266['error']['code']===0x1f4){logger[_0x1a57('0x12')](_0x1a57('0xd'),_0x2492f5,_0x58e266[_0x1a57('0x12')]['message']);return _0x3edb40(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}logger['error'](_0x1a57('0xd'),_0x2492f5,_0x58e266['error'][_0x1a57('0x13')]);return _0x5d9f45(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}else{logger[_0x1a57('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x2492f5,_0x1a57('0xe'));_0x5d9f45(_0x58e266['result']['message']);}})[_0x1a57('0x14')](function(_0x1c537f){logger[_0x1a57('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x2492f5,_0x1c537f);_0x3edb40(_0x1c537f);});});}exports[_0x1a57('0x15')]=function(_0x1662a3){var _0x80f8c1=this;return new Promise(function(_0x53bb20,_0x3daa66){return db[_0x1a57('0x16')][_0x1a57('0x17')](_0x1662a3[_0x1a57('0x18')],{'raw':_0x1662a3[_0x1a57('0x19')]?_0x1662a3['options']['raw']===undefined?!![]:![]:!![]})[_0x1a57('0xb')](function(_0x21e811){logger[_0x1a57('0xc')]('CreateCmHopperHistory',_0x1662a3);logger['debug']('CreateCmHopperHistory',_0x1662a3,JSON[_0x1a57('0x11')](_0x21e811));_0x53bb20(_0x21e811);})[_0x1a57('0x14')](function(_0x3f52b9){logger[_0x1a57('0x12')](_0x1a57('0x15'),_0x3f52b9[_0x1a57('0x13')],_0x1662a3);_0x3daa66(_0x80f8c1[_0x1a57('0x12')](0x1f4,_0x3f52b9[_0x1a57('0x13')]));});});};exports[_0x1a57('0x1a')]=function(_0x35d5dc){var _0x29e7cd=this;return new Promise(function(_0x36b17e,_0x26cdd3){return db[_0x1a57('0x16')][_0x1a57('0x1b')]({'raw':_0x35d5dc[_0x1a57('0x19')]?_0x35d5dc[_0x1a57('0x19')][_0x1a57('0x1c')]===undefined?!![]:![]:!![],'where':_0x35d5dc[_0x1a57('0x19')]?_0x35d5dc[_0x1a57('0x19')][_0x1a57('0x1d')]||null:null,'attributes':[[db[_0x1a57('0x1e')]['fn']('COUNT',db['sequelize'][_0x1a57('0x1f')]('id')),_0x1a57('0x20')],[db['sequelize']['fn'](_0x1a57('0x21'),db['sequelize']['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x1a57('0x23')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db['sequelize'][_0x1a57('0x22')](_0x1a57('0x24')))),_0x1a57('0x25')],[db[_0x1a57('0x1e')]['fn']('COUNT',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x26')))),_0x1a57('0x27')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x28'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')]['literal'](_0x1a57('0x29')))),_0x1a57('0x2a')],[db['sequelize']['fn']('AVG',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x2b')))),_0x1a57('0x2c')]]})[_0x1a57('0xb')](function(_0xe80d94){logger[_0x1a57('0xc')](_0x1a57('0x1a'),_0x35d5dc);logger[_0x1a57('0xf')](_0x1a57('0x1a'),_0x35d5dc,JSON[_0x1a57('0x11')](_0xe80d94));_0x36b17e(_0xe80d94);})[_0x1a57('0x14')](function(_0x1a6231){logger[_0x1a57('0x12')](_0x1a57('0x1a'),_0x1a6231[_0x1a57('0x13')],_0x35d5dc);_0x26cdd3(_0x29e7cd[_0x1a57('0x12')](0x1f4,_0x1a6231['message']));});});};exports[_0x1a57('0x2d')]=function(_0x173671){var _0x137920=this;return new Promise(function(_0x3dad7c,_0x58b7dc){return db[_0x1a57('0x16')][_0x1a57('0x1b')]({'raw':_0x173671[_0x1a57('0x19')]?_0x173671[_0x1a57('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x173671['options']?_0x173671['options']['where']||null:null,'attributes':[[_0x1a57('0x2e'),_0x1a57('0x2f')],[db[_0x1a57('0x1e')]['fn']('COUNT',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x30')))),'outboundNoSuchCallsDay'],[db[_0x1a57('0x1e')]['fn']('COUNT',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0x1a57('0x31')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')]['literal'](_0x1a57('0x32')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x1a57('0x21'),db['sequelize']['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x33')))),'outboundBusyCallsDay'],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')]['literal'](_0x1a57('0x34')))),_0x1a57('0x35')],[db['sequelize']['fn'](_0x1a57('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x1a57('0x22')](_0x1a57('0x36')))),_0x1a57('0x37')],[db[_0x1a57('0x1e')]['fn']('COUNT',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x38')))),_0x1a57('0x39')],[db['sequelize']['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0x1a57('0x3a')],[db['sequelize']['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x3b')))),_0x1a57('0x3c')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x3d')))),_0x1a57('0x3e')],[db['sequelize']['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x3f')))),_0x1a57('0x40')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),_0x1a57('0x41')],[db[_0x1a57('0x1e')]['fn']('COUNT',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')]['literal'](_0x1a57('0x42')))),_0x1a57('0x40')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x1a57('0x43')]],'group':[_0x1a57('0x2e')]})['then'](function(_0x5e510e){logger['info'](_0x1a57('0x2d'),_0x173671);logger[_0x1a57('0xf')](_0x1a57('0x2d'),_0x173671,JSON[_0x1a57('0x11')](_0x5e510e));_0x3dad7c(_0x5e510e);})[_0x1a57('0x14')](function(_0x33379c){logger[_0x1a57('0x12')](_0x1a57('0x2d'),_0x33379c['message'],_0x173671);_0x58b7dc(_0x137920['error'](0x1f4,_0x33379c['message']));});});};exports['GetCampaignHopperHistory']=function(_0x554208){var _0xd0261c=this;return new Promise(function(_0x13c04d,_0xcba9f0){return db[_0x1a57('0x16')][_0x1a57('0x1b')]({'raw':_0x554208[_0x1a57('0x19')]?_0x554208[_0x1a57('0x19')][_0x1a57('0x1c')]===undefined?!![]:![]:!![],'where':_0x554208['options']?_0x554208['options']['where']||null:null,'attributes':[[_0x1a57('0x2e'),'name'],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')][_0x1a57('0x1f')]('id')),_0x1a57('0x44')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x1a57('0x32')))),_0x1a57('0x45')]],'group':[_0x1a57('0x2e')]})[_0x1a57('0xb')](function(_0x2db770){logger[_0x1a57('0xc')](_0x1a57('0x46'),_0x554208);logger['debug']('GetCampaignHopperHistory',_0x554208,JSON[_0x1a57('0x11')](_0x2db770));_0x13c04d(_0x2db770);})[_0x1a57('0x14')](function(_0x231154){logger[_0x1a57('0x12')](_0x1a57('0x46'),_0x231154[_0x1a57('0x13')],_0x554208);_0xcba9f0(_0xd0261c['error'](0x1f4,_0x231154['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 34b6213..b5b3314 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 _0x477f=['index','/describe','/:id','show','post','create','put','update','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x477f,0x1dc));var _0xf477=function(_0x542a25,_0x73c181){_0x542a25=_0x542a25-0x0;var _0x5b837f=_0x477f[_0x542a25];return _0x5b837f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf477('0x0'));var timeout=require(_0xf477('0x1'));var express=require(_0xf477('0x2'));var router=express[_0xf477('0x3')]();var auth=require(_0xf477('0x4'));var interaction=require(_0xf477('0x5'));var config=require(_0xf477('0x6'));var controller=require(_0xf477('0x7'));router[_0xf477('0x8')]('/',auth[_0xf477('0x9')](),controller[_0xf477('0xa')]);router['get'](_0xf477('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xf477('0x8')](_0xf477('0xc'),auth[_0xf477('0x9')](),controller[_0xf477('0xd')]);router[_0xf477('0xe')]('/',auth['isAuthenticated'](),controller[_0xf477('0xf')]);router[_0xf477('0x10')](_0xf477('0xc'),auth[_0xf477('0x9')](),controller[_0xf477('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6d41=['describe','show','create','put','/:id','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','isAuthenticated'];(function(_0x5c4669,_0x7f9bcd){var _0xf18b6a=function(_0x5ba22d){while(--_0x5ba22d){_0x5c4669['push'](_0x5c4669['shift']());}};_0xf18b6a(++_0x7f9bcd);}(_0x6d41,0x123));var _0x16d4=function(_0x2ed211,_0x489e2a){_0x2ed211=_0x2ed211-0x0;var _0x3434ec=_0x6d41[_0x2ed211];return _0x3434ec;};'use strict';var multer=require(_0x16d4('0x0'));var util=require(_0x16d4('0x1'));var path=require(_0x16d4('0x2'));var timeout=require(_0x16d4('0x3'));var express=require('express');var router=express[_0x16d4('0x4')]();var auth=require(_0x16d4('0x5'));var interaction=require(_0x16d4('0x6'));var config=require(_0x16d4('0x7'));var controller=require(_0x16d4('0x8'));router[_0x16d4('0x9')]('/',auth['isAuthenticated'](),controller[_0x16d4('0xa')]);router[_0x16d4('0x9')](_0x16d4('0xb'),auth[_0x16d4('0xc')](),controller[_0x16d4('0xd')]);router[_0x16d4('0x9')]('/:id',auth[_0x16d4('0xc')](),controller[_0x16d4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x16d4('0xf')]);router[_0x16d4('0x10')](_0x16d4('0x11'),auth[_0x16d4('0xc')](),controller['update']);module[_0x16d4('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index b77e468..24238a4 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 _0x4d4b=['exports','STRING','name','sequelize'];(function(_0x24e432,_0xd8b203){var _0x157292=function(_0x25af05){while(--_0x25af05){_0x24e432['push'](_0x24e432['shift']());}};_0x157292(++_0xd8b203);}(_0x4d4b,0x1e7));var _0xb4d4=function(_0x216c63,_0x46684b){_0x216c63=_0x216c63-0x0;var _0x38ad8a=_0x4d4b[_0x216c63];return _0x38ad8a;};'use strict';var Sequelize=require(_0xb4d4('0x0'));module[_0xb4d4('0x1')]={'name':{'type':Sequelize[_0xb4d4('0x2')],'unique':_0xb4d4('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb4d4('0x2')]},'dialPrefix':{'type':Sequelize[_0xb4d4('0x2')]}}; \ No newline at end of file +var _0x0ffe=['name','sequelize','STRING'];(function(_0x3105db,_0x335f6e){var _0x4fc28e=function(_0x4769fd){while(--_0x4769fd){_0x3105db['push'](_0x3105db['shift']());}};_0x4fc28e(++_0x335f6e);}(_0x0ffe,0xc4));var _0xe0ff=function(_0x6f2ce5,_0x4231eb){_0x6f2ce5=_0x6f2ce5-0x0;var _0x28a54a=_0x0ffe[_0x6f2ce5];return _0x28a54a;};'use strict';var Sequelize=require(_0xe0ff('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0ff('0x1')],'unique':_0xe0ff('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe0ff('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 3b55a49..ff84e55 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 _0xcb91=['bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','update','then','get','Lists','destroy','error','name','index','map','CmList','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','addDisposition','ListId','Disposition','getDispositions','sort','includeAll','rows','removeDispositions','CmContact','tags','isArray','join','each','omit','ids','success','dataValues','errors','push','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cf_%s','getCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5216e0,_0x4f8cb9){var _0x5b3f40=function(_0x30c832){while(--_0x30c832){_0x5216e0['push'](_0x5216e0['shift']());}};_0x5b3f40(++_0x4f8cb9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0xcb91[_0x593564];return _0x211a89;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];config[_0x1cb9('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1cb9('0x17'))(new Redis(config[_0x1cb9('0x16')]));require(_0x1cb9('0x18'))[_0x1cb9('0x19')](socket);function respondWithStatusCode(_0x56884d,_0x397727){_0x397727=_0x397727||0xcc;return function(_0x6ef389){if(_0x6ef389){return _0x56884d[_0x1cb9('0x1a')](_0x397727);}return _0x56884d[_0x1cb9('0x1b')](_0x397727)[_0x1cb9('0x1c')]();};}function respondWithResult(_0x5806d8,_0x5572cb){_0x5572cb=_0x5572cb||0xc8;return function(_0xd446a3){if(_0xd446a3){return _0x5806d8[_0x1cb9('0x1b')](_0x5572cb)[_0x1cb9('0x1d')](_0xd446a3);}};}function respondWithFilteredResult(_0x3f1376,_0x3e21e0){return function(_0xf22920){if(_0xf22920){var _0x23d3a9=_0xf22920[_0x1cb9('0x1e')],_0x4e1340=_0x3e21e0[_0x1cb9('0x1f')],_0x479d43=_0x3e21e0[_0x1cb9('0x1f')]+_0x3e21e0[_0x1cb9('0x20')],_0x1b2fa6;if(_0x479d43>=_0x23d3a9){_0x479d43=_0x23d3a9;_0x1b2fa6=0xc8;}else{_0x1b2fa6=0xce;}_0x3f1376[_0x1cb9('0x1b')](_0x1b2fa6);return _0x3f1376[_0x1cb9('0x21')]('Content-Range',_0x4e1340+'-'+_0x479d43+'/'+_0x23d3a9)['json'](_0xf22920);}return null;};}function patchUpdates(_0x1a5a72){return function(_0x5dbfae){try{jsonpatch[_0x1cb9('0x22')](_0x5dbfae,_0x1a5a72,!![]);}catch(_0x2265ea){return BPromise['reject'](_0x2265ea);}return _0x5dbfae['save']();};}function saveUpdates(_0x2e3854,_0x325637){return function(_0x103a63){if(_0x103a63){return _0x103a63[_0x1cb9('0x23')](_0x2e3854)[_0x1cb9('0x24')](function(_0x27db16){return _0x27db16;});}return null;};}function removeEntity(_0x59ebea,_0x55b232){return function(_0x6c6f61){if(_0x6c6f61){return _0x6c6f61['destroy']()[_0x1cb9('0x24')](function(){var _0x2b1275=_0x6c6f61[_0x1cb9('0x25')]({'plain':!![]});var _0x44d3c4=_0x1cb9('0x26');return db['UserProfileResource'][_0x1cb9('0x27')]({'where':{'type':_0x44d3c4,'resourceId':_0x2b1275['id']}})[_0x1cb9('0x24')](function(){return _0x6c6f61;});})['then'](function(){_0x59ebea[_0x1cb9('0x1b')](0xcc)[_0x1cb9('0x1c')]();});}};}function handleEntityNotFound(_0x41a9a0,_0x1804fd){return function(_0x406821){if(!_0x406821){_0x41a9a0[_0x1cb9('0x1a')](0x194);}return _0x406821;};}function handleError(_0x2e28fe,_0xb644b3){_0xb644b3=_0xb644b3||0x1f4;return function(_0x41e5c2){logger[_0x1cb9('0x28')](_0x41e5c2['stack']);if(_0x41e5c2[_0x1cb9('0x29')]){delete _0x41e5c2['name'];}_0x2e28fe[_0x1cb9('0x1b')](_0xb644b3)['send'](_0x41e5c2);};}exports[_0x1cb9('0x2a')]=function(_0x41011c,_0x3cd7f5){var _0x2038aa={},_0x561d89={},_0x1c701f={'count':0x0,'rows':[]};var _0x4eba82=_[_0x1cb9('0x2b')](db[_0x1cb9('0x2c')][_0x1cb9('0x2d')],function(_0x5d8793){return{'name':_0x5d8793[_0x1cb9('0x2e')],'type':_0x5d8793['type'][_0x1cb9('0x2f')]};});_0x561d89['model']=_[_0x1cb9('0x2b')](_0x4eba82,_0x1cb9('0x29'));_0x561d89[_0x1cb9('0x30')]=_[_0x1cb9('0x31')](_0x41011c['query']);_0x561d89[_0x1cb9('0x32')]=_[_0x1cb9('0x33')](_0x561d89[_0x1cb9('0x34')],_0x561d89[_0x1cb9('0x30')]);_0x2038aa[_0x1cb9('0x35')]=_[_0x1cb9('0x33')](_0x561d89[_0x1cb9('0x34')],qs[_0x1cb9('0x36')](_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x2038aa[_0x1cb9('0x35')]=_0x2038aa[_0x1cb9('0x35')][_0x1cb9('0x37')]?_0x2038aa['attributes']:_0x561d89['model'];if(!_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x38')](_0x1cb9('0x39'))){_0x2038aa[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x20')]);_0x2038aa[_0x1cb9('0x1f')]=qs['offset'](_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x1f')]);}_0x2038aa[_0x1cb9('0x3a')]=qs['sort'](_0x41011c[_0x1cb9('0x30')]['sort']);_0x2038aa[_0x1cb9('0x3b')]=qs['filters'](_[_0x1cb9('0x3c')](_0x41011c[_0x1cb9('0x30')],_0x561d89[_0x1cb9('0x32')]));if(_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x3d')]){_0x2038aa[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x2038aa['where'],{'$or':_['map'](_0x4eba82,function(_0x4111b8){if(_0x4111b8[_0x1cb9('0x3f')]!==_0x1cb9('0x40')){var _0x16ad1c={};_0x16ad1c[_0x4111b8[_0x1cb9('0x29')]]={'$like':'%'+_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x3d')]+'%'};return _0x16ad1c;}})});}_0x2038aa=_['merge']({},_0x2038aa,_0x41011c[_0x1cb9('0x41')]);var _0x47edad={'where':_0x2038aa['where']};return db['CmList'][_0x1cb9('0x1e')](_0x47edad)[_0x1cb9('0x24')](function(_0x1bf51c){_0x1c701f[_0x1cb9('0x1e')]=_0x1bf51c;if(_0x41011c[_0x1cb9('0x30')]['includeAll']){_0x2038aa[_0x1cb9('0x42')]=[{'all':!![]}];}return db['CmList'][_0x1cb9('0x43')](_0x2038aa);})[_0x1cb9('0x24')](function(_0x38d973){_0x1c701f['rows']=_0x38d973;return _0x1c701f;})[_0x1cb9('0x24')](respondWithFilteredResult(_0x3cd7f5,_0x2038aa))['catch'](handleError(_0x3cd7f5,null));};exports[_0x1cb9('0x44')]=function(_0xbc36fc,_0x51a898){var _0x5839aa={'raw':![],'where':{'id':_0xbc36fc[_0x1cb9('0x45')]['id']}},_0x24c643={};_0x24c643[_0x1cb9('0x34')]=_[_0x1cb9('0x31')](db[_0x1cb9('0x2c')]['rawAttributes']);_0x24c643[_0x1cb9('0x30')]=_['keys'](_0xbc36fc['query']);_0x24c643['filters']=_[_0x1cb9('0x33')](_0x24c643[_0x1cb9('0x34')],_0x24c643[_0x1cb9('0x30')]);_0x5839aa[_0x1cb9('0x35')]=_[_0x1cb9('0x33')](_0x24c643[_0x1cb9('0x34')],qs[_0x1cb9('0x36')](_0xbc36fc[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x5839aa[_0x1cb9('0x35')]=_0x5839aa[_0x1cb9('0x35')]['length']?_0x5839aa[_0x1cb9('0x35')]:_0x24c643[_0x1cb9('0x34')];if(_0xbc36fc[_0x1cb9('0x30')]['includeAll']){_0x5839aa[_0x1cb9('0x42')]=[{'all':!![]}];}_0x5839aa=_[_0x1cb9('0x3e')]({},_0x5839aa,_0xbc36fc[_0x1cb9('0x41')]);return db[_0x1cb9('0x2c')][_0x1cb9('0x46')](_0x5839aa)['then'](handleEntityNotFound(_0x51a898,null))[_0x1cb9('0x24')](respondWithResult(_0x51a898,null))['catch'](handleError(_0x51a898,null));};exports[_0x1cb9('0x47')]=function(_0x4ac483,_0x1cf2ee){return db[_0x1cb9('0x2c')][_0x1cb9('0x47')](_0x4ac483[_0x1cb9('0x48')],{})['then'](function(_0x298475){var _0x1149b9=_0x4ac483[_0x1cb9('0x49')][_0x1cb9('0x25')]({'plain':!![]});if(!_0x1149b9)throw new Error(_0x1cb9('0x4a'));if(_0x1149b9[_0x1cb9('0x4b')]===_0x1cb9('0x49')){var _0x3b6a92=_0x298475[_0x1cb9('0x25')]({'plain':!![]});var _0x17f10e='Lists';return db['UserProfileSection'][_0x1cb9('0x46')]({'where':{'name':_0x17f10e,'userProfileId':_0x1149b9[_0x1cb9('0x4c')]},'raw':!![]})[_0x1cb9('0x24')](function(_0x1e073d){if(_0x1e073d&&_0x1e073d[_0x1cb9('0x4d')]===0x0){return db[_0x1cb9('0x4e')][_0x1cb9('0x47')]({'name':_0x3b6a92[_0x1cb9('0x29')],'resourceId':_0x3b6a92['id'],'type':_0x1e073d[_0x1cb9('0x29')],'sectionId':_0x1e073d['id']},{})[_0x1cb9('0x24')](function(){return _0x298475;});}else{return _0x298475;}})['catch'](function(_0x2cf8e2){logger['error'](_0x1cb9('0x4f'),_0x2cf8e2);throw _0x2cf8e2;});}return _0x298475;})['then'](respondWithResult(_0x1cf2ee,0xc9))[_0x1cb9('0x50')](handleError(_0x1cf2ee,null));};exports['update']=function(_0x5e5174,_0x44e918){if(_0x5e5174[_0x1cb9('0x48')]['id']){delete _0x5e5174[_0x1cb9('0x48')]['id'];}return db['CmList'][_0x1cb9('0x46')]({'where':{'id':_0x5e5174[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x44e918,null))['then'](saveUpdates(_0x5e5174[_0x1cb9('0x48')],null))[_0x1cb9('0x24')](respondWithResult(_0x44e918,null))[_0x1cb9('0x50')](handleError(_0x44e918,null));};exports[_0x1cb9('0x27')]=function(_0x3de325,_0x310d6d){return db[_0x1cb9('0x2c')]['find']({'where':{'id':_0x3de325[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x310d6d,null))[_0x1cb9('0x24')](removeEntity(_0x310d6d,null))['catch'](handleError(_0x310d6d,null));};exports[_0x1cb9('0x51')]=function(_0x9893a3,_0x1651c5){return db[_0x1cb9('0x2c')][_0x1cb9('0x51')]()[_0x1cb9('0x24')](respondWithResult(_0x1651c5,null))['catch'](handleError(_0x1651c5,null));};exports[_0x1cb9('0x52')]=function(_0x36c40d,_0x41e81f,_0x128c5b){if(_0x36c40d[_0x1cb9('0x48')]['id']){delete _0x36c40d[_0x1cb9('0x48')]['id'];}return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x36c40d[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x41e81f,null))[_0x1cb9('0x24')](function(_0x55fb51){if(_0x55fb51){_0x36c40d[_0x1cb9('0x48')][_0x1cb9('0x53')]=_0x55fb51['id'];return db[_0x1cb9('0x54')][_0x1cb9('0x47')](_0x36c40d['body']);}})['then'](respondWithResult(_0x41e81f,null))[_0x1cb9('0x50')](handleError(_0x41e81f,null));};exports[_0x1cb9('0x55')]=function(_0x31eccc,_0x173db5,_0x3c2f9c){var _0x75c734={'raw':![],'where':{}};var _0xc515a6={};var _0xd010a9={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x31eccc[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x173db5,null))['then'](function(_0x4ca5bc){if(_0x4ca5bc){_0xc515a6['model']=_['keys'](db[_0x1cb9('0x54')][_0x1cb9('0x2d')]);_0xc515a6[_0x1cb9('0x30')]=_[_0x1cb9('0x31')](_0x31eccc[_0x1cb9('0x30')]);_0xc515a6[_0x1cb9('0x32')]=_['intersection'](_0xc515a6[_0x1cb9('0x34')],_0xc515a6[_0x1cb9('0x30')]);_0x75c734['attributes']=_['intersection'](_0xc515a6[_0x1cb9('0x34')],qs[_0x1cb9('0x36')](_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x75c734[_0x1cb9('0x35')]=_0x75c734['attributes']['length']?_0x75c734['attributes']:_0xc515a6[_0x1cb9('0x34')];if(!_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x38')](_0x1cb9('0x39'))){_0x75c734[_0x1cb9('0x20')]=qs['limit'](_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x20')]);_0x75c734['offset']=qs['offset'](_0x31eccc[_0x1cb9('0x30')]['offset']);}_0x75c734[_0x1cb9('0x3a')]=qs[_0x1cb9('0x56')](_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x56')]);_0x75c734[_0x1cb9('0x3b')]=qs[_0x1cb9('0x32')](_['pick'](_0x31eccc[_0x1cb9('0x30')],_0xc515a6[_0x1cb9('0x32')]));_0x75c734[_0x1cb9('0x3b')][_0x1cb9('0x53')]=_0x4ca5bc['id'];if(_0x31eccc['query']['filter']){_0x75c734[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x75c734[_0x1cb9('0x3b')],{'$or':_[_0x1cb9('0x2b')](_0x75c734[_0x1cb9('0x35')],function(_0x267a3c){var _0x4f8756={};_0x4f8756[_0x267a3c]={'$like':'%'+_0x31eccc[_0x1cb9('0x30')]['filter']+'%'};return _0x4f8756;})});}_0x75c734=_[_0x1cb9('0x3e')]({},_0x75c734,_0x31eccc[_0x1cb9('0x41')]);return db['Disposition'][_0x1cb9('0x1e')]({'where':_0x75c734[_0x1cb9('0x3b')]})[_0x1cb9('0x24')](function(_0x539514){_0xd010a9[_0x1cb9('0x1e')]=_0x539514;if(_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x57')]){_0x75c734[_0x1cb9('0x42')]=[{'all':!![]}];}return db[_0x1cb9('0x54')][_0x1cb9('0x43')](_0x75c734);})['then'](function(_0x2b2874){_0xd010a9[_0x1cb9('0x58')]=_0x2b2874;return _0xd010a9;});}})[_0x1cb9('0x24')](respondWithFilteredResult(_0x173db5,_0x75c734))[_0x1cb9('0x50')](handleError(_0x173db5,null));};exports[_0x1cb9('0x59')]=function(_0x1da41c,_0x128a41,_0x37bcd9){return db['CmList'][_0x1cb9('0x46')]({'where':{'id':_0x1da41c[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x128a41,null))[_0x1cb9('0x24')](function(_0x5415fa){if(_0x5415fa){return _0x5415fa[_0x1cb9('0x59')](_0x1da41c['query']['ids']);}})[_0x1cb9('0x24')](respondWithStatusCode(_0x128a41,null))[_0x1cb9('0x50')](handleError(_0x128a41,null));};exports['addContacts']=function(_0x342cb1,_0x5b5419,_0x3d6474){return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x342cb1[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x5b5419,null))[_0x1cb9('0x24')](function(_0x3d25a3){if(_0x3d25a3){var _0x2a157d=[];var _0x27cc3c={'success':[],'errors':[]};return db[_0x1cb9('0x5a')][_0x1cb9('0x51')]()['then'](function(_0x248946){if(_0x342cb1[_0x1cb9('0x48')][_0x1cb9('0x5b')]&&_[_0x1cb9('0x5c')](_0x342cb1[_0x1cb9('0x48')][_0x1cb9('0x5b')])){if(_0x342cb1['body'][_0x1cb9('0x5b')][_0x1cb9('0x37')]){_0x342cb1['body'][_0x1cb9('0x5b')]=_0x342cb1[_0x1cb9('0x48')][_0x1cb9('0x5b')][_0x1cb9('0x5d')](';')+';';}else{_0x342cb1[_0x1cb9('0x48')][_0x1cb9('0x5b')]=null;}}else{_0x342cb1[_0x1cb9('0x48')]['tags']=null;}if(_0x342cb1[_0x1cb9('0x48')]&&_['isArray'](_0x342cb1[_0x1cb9('0x48')])){for(var _0xb5eac1=0x0;_0xb5eac1<_0x342cb1['body'][_0x1cb9('0x37')];_0xb5eac1+=0x1){_0x342cb1[_0x1cb9('0x48')][_0xb5eac1][_0x1cb9('0x53')]=_0x342cb1[_0x1cb9('0x45')]['id'];_0x2a157d['push'](_0x342cb1[_0x1cb9('0x48')][_0xb5eac1]);}return BPromise[_0x1cb9('0x5e')](_0x2a157d,function(_0x429371){return db['CmContact'][_0x1cb9('0x47')](_[_0x1cb9('0x5f')](_0x429371,[_0x1cb9('0x60'),'id'])||{},{'fields':_[_0x1cb9('0x31')](_0x248946),'raw':!![]})[_0x1cb9('0x24')](function(_0x1ea329){_0x27cc3c[_0x1cb9('0x61')]['push'](_0x1ea329[_0x1cb9('0x62')]);})['catch'](function(_0x27f1d2){_0x27cc3c[_0x1cb9('0x63')][_0x1cb9('0x64')]({'data':_0x429371,'error':_0x27f1d2[_0x1cb9('0x65')]});});})['then'](function(_0x1ff5e9){return _0x27cc3c;})[_0x1cb9('0x50')](function(_0x5e68a1){return _0x5e68a1;});}else{_0x5b5419[_0x1cb9('0x1b')](0x190)[_0x1cb9('0x1d')]({'message':_0x1cb9('0x66')});}});}})[_0x1cb9('0x24')](respondWithResult(_0x5b5419,null))[_0x1cb9('0x50')](handleError(_0x5b5419,null));};exports['getContacts']=function(_0x5e0e56,_0x544d2d,_0x5ad853){var _0x19daa1;return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x5e0e56[_0x1cb9('0x45')]['id']},'include':[{'model':db[_0x1cb9('0x67')],'as':_0x1cb9('0x68')}]})[_0x1cb9('0x24')](handleEntityNotFound(_0x544d2d,null))[_0x1cb9('0x24')](function(_0x4e969a){if(_0x4e969a){_0x19daa1=_0x4e969a;return db[_0x1cb9('0x5a')][_0x1cb9('0x2d')];}})[_0x1cb9('0x24')](function(_0x5eff1e){if(_0x5eff1e){var _0x10977f={};var _0xc6b64c={};_0xc6b64c['model']=_[_0x1cb9('0x69')](_[_0x1cb9('0x31')](_0x5eff1e),_[_0x1cb9('0x2b')](_0x19daa1[_0x1cb9('0x68')],function(_0x5cb5e5){return util[_0x1cb9('0x6a')](_0x1cb9('0x6b'),_0x5cb5e5['id']);}));_0xc6b64c['query']=_['keys'](_0x5e0e56[_0x1cb9('0x30')]);_0xc6b64c[_0x1cb9('0x32')]=_['intersection'](_0xc6b64c['model'],_0xc6b64c[_0x1cb9('0x30')]);_0x10977f[_0x1cb9('0x35')]=_['intersection'](_0xc6b64c['model'],qs[_0x1cb9('0x36')](_0x5e0e56['query']['fields']));_0x10977f['attributes']=_0x10977f[_0x1cb9('0x35')]['length']?_0x10977f[_0x1cb9('0x35')]:_0xc6b64c[_0x1cb9('0x34')];if(!_0x5e0e56[_0x1cb9('0x30')]['hasOwnProperty'](_0x1cb9('0x39'))){_0x10977f[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x5e0e56['query'][_0x1cb9('0x20')]);_0x10977f[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x5e0e56[_0x1cb9('0x30')][_0x1cb9('0x1f')]);}_0x10977f['order']=qs[_0x1cb9('0x56')](_0x5e0e56[_0x1cb9('0x30')][_0x1cb9('0x56')]);_0x10977f['where']=qs[_0x1cb9('0x32')](_[_0x1cb9('0x3c')](_0x5e0e56[_0x1cb9('0x30')],_0xc6b64c[_0x1cb9('0x32')]));_0x10977f[_0x1cb9('0x6c')]=!![];if(_0x5e0e56['query'][_0x1cb9('0x3d')]){_0x10977f[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x10977f[_0x1cb9('0x3b')],{'$or':_[_0x1cb9('0x2b')](_0x10977f[_0x1cb9('0x35')],function(_0x37affa){var _0x36864c={};_0x36864c[_0x37affa]={'$like':'%'+_0x5e0e56[_0x1cb9('0x30')][_0x1cb9('0x3d')]+'%'};return _0x36864c;})});}_0x10977f=_[_0x1cb9('0x3e')]({},_0x10977f,_0x5e0e56[_0x1cb9('0x41')]);return _0x19daa1[_0x1cb9('0x6d')](_0x10977f);}})[_0x1cb9('0x24')](respondWithResult(_0x544d2d,null))[_0x1cb9('0x50')](handleError(_0x544d2d,null));};exports[_0x1cb9('0x6e')]=function(_0x37b290,_0xf25415,_0x48e879){var _0x508a75;return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x37b290[_0x1cb9('0x45')]['id']},'include':[{'model':db[_0x1cb9('0x67')],'as':_0x1cb9('0x68')}]})[_0x1cb9('0x24')](handleEntityNotFound(_0xf25415,null))[_0x1cb9('0x24')](function(_0x56251d){if(_0x56251d){_0x508a75=_0x56251d;return db['CmContact'][_0x1cb9('0x2d')];}})[_0x1cb9('0x24')](function(_0x29b478){if(_0x29b478){var _0x11a46b={};var _0xed8968={};_0xed8968['model']=_[_0x1cb9('0x69')](_[_0x1cb9('0x31')](_0x29b478),_[_0x1cb9('0x2b')](_0x508a75['CustomFields'],function(_0x36faa4){return util[_0x1cb9('0x6a')](_0x1cb9('0x6b'),_0x36faa4['id']);}));_0xed8968['query']=_[_0x1cb9('0x31')](_0x37b290[_0x1cb9('0x30')]);_0xed8968[_0x1cb9('0x32')]=_['intersection'](_0xed8968['model'],_0xed8968['query']);_0x11a46b[_0x1cb9('0x35')]=_[_0x1cb9('0x33')](_0xed8968[_0x1cb9('0x34')],qs['fields'](_0x37b290[_0x1cb9('0x30')]['fields']));_0x11a46b['attributes']=_0x11a46b[_0x1cb9('0x35')][_0x1cb9('0x37')]?_0x11a46b[_0x1cb9('0x35')]:_0xed8968[_0x1cb9('0x34')];if(!_0x37b290[_0x1cb9('0x30')][_0x1cb9('0x38')](_0x1cb9('0x39'))){_0x11a46b[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x37b290[_0x1cb9('0x30')]['limit']);_0x11a46b['offset']=qs[_0x1cb9('0x1f')](_0x37b290[_0x1cb9('0x30')]['offset']);}_0x11a46b['order']=qs['sort'](_0x37b290['query'][_0x1cb9('0x56')]);_0x11a46b[_0x1cb9('0x3b')]=qs['filters'](_[_0x1cb9('0x3c')](_0x37b290[_0x1cb9('0x30')],_0xed8968[_0x1cb9('0x32')]));_0x11a46b[_0x1cb9('0x6c')]=!![];if(_0x37b290[_0x1cb9('0x30')]['filter']){_0x11a46b[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x11a46b[_0x1cb9('0x3b')],{'$or':_[_0x1cb9('0x2b')](_0x11a46b['attributes'],function(_0x19f3db){var _0x3d82b0={};_0x3d82b0[_0x19f3db]={'$like':'%'+_0x37b290['query']['filter']+'%'};return _0x3d82b0;})});}_0x11a46b=_['merge']({},_0x11a46b,_0x37b290[_0x1cb9('0x41')]);return _0x508a75['getContacts'](_0x11a46b);}})[_0x1cb9('0x24')](function(_0x3506d7){if(!_[_0x1cb9('0x6f')](_0x3506d7)){var _0xf3c554=toCsv(_0x3506d7);var _0x31d1e5=Date[_0x1cb9('0x70')]();fs['writeFileSync'](util[_0x1cb9('0x6a')](_0x1cb9('0x71'),_0x508a75['id'],_0x31d1e5),_0xf3c554);_0xf25415[_0x1cb9('0x72')](_0x1cb9('0x73'),_0x1cb9('0x74')+util[_0x1cb9('0x6a')](_0x1cb9('0x75'),_0x508a75['id'],_0x31d1e5));_0xf25415[_0x1cb9('0x72')](_0x1cb9('0x76'),_0x1cb9('0x77'));return _0xf25415[_0x1cb9('0x78')](util[_0x1cb9('0x6a')](_0x1cb9('0x71'),_0x508a75['id'],_0x31d1e5));}else{return _0xf25415[_0x1cb9('0x1a')](0xcc);}})[_0x1cb9('0x50')](handleError(_0xf25415,null));};exports['addCustomField']=function(_0x592c04,_0x5aae4c,_0x9b1c60){var _0x35792e;delete _0x592c04['body']['id'];return db[_0x1cb9('0x2c')][_0x1cb9('0x79')]({'where':{'id':_0x592c04[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x5aae4c,null))[_0x1cb9('0x24')](function(_0x3f817e){if(_0x3f817e){return db[_0x1cb9('0x7a')][_0x1cb9('0x7b')](function(_0x45b2e4){return db['CmCustomField'][_0x1cb9('0x47')](_0x592c04['body'],{'transaction':_0x45b2e4})['then'](function(_0x191988){_0x35792e=_0x191988;return _0x3f817e[_0x1cb9('0x7c')](_0x191988,{'transaction':_0x45b2e4});})[_0x1cb9('0x24')](function(){var _0x2e9d88={'type':db[_0x1cb9('0x7d')][_0x1cb9('0x7e')],'transaction':_0x45b2e4};switch(_0x592c04[_0x1cb9('0x48')][_0x1cb9('0x3f')]){case'text':_0x2e9d88[_0x1cb9('0x3f')]=db[_0x1cb9('0x7d')][_0x1cb9('0x7e')];break;case _0x1cb9('0x7f'):_0x2e9d88[_0x1cb9('0x3f')]=db['Sequelize'][_0x1cb9('0x80')];break;case _0x1cb9('0x81'):_0x2e9d88[_0x1cb9('0x3f')]=db[_0x1cb9('0x7d')][_0x1cb9('0x82')];_0x2e9d88['defaultValue']=![];break;default:}return db[_0x1cb9('0x7a')][_0x1cb9('0x83')][_0x1cb9('0x84')]('cm_contacts',util[_0x1cb9('0x6a')](_0x1cb9('0x85'),_0x35792e['id']),_0x2e9d88);})[_0x1cb9('0x24')](function(){return _0x35792e;});});}})[_0x1cb9('0x24')](respondWithResult(_0x5aae4c,null))[_0x1cb9('0x50')](handleError(_0x5aae4c,null));};exports[_0x1cb9('0x86')]=function(_0x4e3ad0,_0x45dc8c,_0x7118bb){var _0x17fdd1={};var _0x5d230a={};var _0x142f08;var _0x2485b9;return db['CmList']['findOne']({'where':{'id':_0x4e3ad0[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x45dc8c,null))[_0x1cb9('0x24')](function(_0x208ce1){if(_0x208ce1){_0x142f08=_0x208ce1;_0x5d230a[_0x1cb9('0x34')]=_['keys'](db[_0x1cb9('0x67')][_0x1cb9('0x2d')]);_0x5d230a[_0x1cb9('0x30')]=_[_0x1cb9('0x31')](_0x4e3ad0[_0x1cb9('0x30')]);_0x5d230a['filters']=_['intersection'](_0x5d230a[_0x1cb9('0x34')],_0x5d230a[_0x1cb9('0x30')]);_0x17fdd1[_0x1cb9('0x35')]=_['intersection'](_0x5d230a['model'],qs[_0x1cb9('0x36')](_0x4e3ad0[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x17fdd1['attributes']=_0x17fdd1['attributes']['length']?_0x17fdd1[_0x1cb9('0x35')]:_0x5d230a[_0x1cb9('0x34')];_0x17fdd1[_0x1cb9('0x3a')]=qs['sort'](_0x4e3ad0[_0x1cb9('0x30')]['sort']);_0x17fdd1[_0x1cb9('0x3b')]=qs[_0x1cb9('0x32')](_[_0x1cb9('0x3c')](_0x4e3ad0[_0x1cb9('0x30')],_0x5d230a[_0x1cb9('0x32')]));_0x17fdd1['where']=_[_0x1cb9('0x3e')](_0x17fdd1['where'],{'$or':[{'ListId':_0x208ce1['id']},{'ListId':null}]});if(_0x4e3ad0[_0x1cb9('0x30')][_0x1cb9('0x3d')]){_0x17fdd1[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x17fdd1[_0x1cb9('0x3b')],{'$or':_['map'](_0x17fdd1[_0x1cb9('0x35')],function(_0x174147){var _0xb4ea43={};_0xb4ea43[_0x174147]={'$like':'%'+_0x4e3ad0[_0x1cb9('0x30')][_0x1cb9('0x3d')]+'%'};return _0xb4ea43;})});}_0x17fdd1=_[_0x1cb9('0x3e')]({},_0x17fdd1,_0x4e3ad0[_0x1cb9('0x41')]);return db['CmCustomField']['findAndCountAll'](_0x17fdd1);}})[_0x1cb9('0x24')](respondWithResult(_0x45dc8c,null))[_0x1cb9('0x50')](handleError(_0x45dc8c,null));};exports[_0x1cb9('0x87')]=function(_0x1cdff0,_0x106fe7,_0x54b0d0){return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x1cdff0['params']['id']}})['then'](handleEntityNotFound(_0x106fe7,null))[_0x1cb9('0x24')](function(_0x48c8e7){if(_0x48c8e7){return _0x48c8e7[_0x1cb9('0x87')](_0x1cdff0['body'][_0x1cb9('0x60')],_[_0x1cb9('0x5f')](_0x1cdff0[_0x1cb9('0x48')],[_0x1cb9('0x60'),'id'])||{})[_0x1cb9('0x88')](function(_0x345e13){for(var _0x2c7326=0x0;_0x2c7326<_0x1cdff0[_0x1cb9('0x48')][_0x1cb9('0x60')][_0x1cb9('0x37')];_0x2c7326+=0x1){socket[_0x1cb9('0x89')](_0x1cb9('0x8a'),{'UserId':_0x1cdff0['body']['ids'][_0x2c7326],'CmListId':_0x1cdff0['params']['id']});}return _0x345e13;});}})['then'](respondWithResult(_0x106fe7,null))[_0x1cb9('0x50')](handleError(_0x106fe7,null));};exports[_0x1cb9('0x8b')]=function(_0x550877,_0x5b2b21,_0x4e46c1){return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x550877[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x5b2b21,null))['then'](function(_0x178cba){if(_0x178cba){return _0x178cba[_0x1cb9('0x8b')](_0x550877[_0x1cb9('0x30')]['ids'])[_0x1cb9('0x24')](function(){if(_[_0x1cb9('0x5c')](_0x550877['query'][_0x1cb9('0x60')])){for(var _0x57c3c4=0x0;_0x57c3c4<_0x550877[_0x1cb9('0x30')][_0x1cb9('0x60')][_0x1cb9('0x37')];_0x57c3c4+=0x1){socket[_0x1cb9('0x89')](_0x1cb9('0x8c'),{'UserId':Number(_0x550877[_0x1cb9('0x30')][_0x1cb9('0x60')][_0x57c3c4]),'CmListId':Number(_0x550877['params']['id'])});}}else{socket[_0x1cb9('0x89')](_0x1cb9('0x8c'),{'UserId':Number(_0x550877[_0x1cb9('0x30')][_0x1cb9('0x60')]),'CmListId':Number(_0x550877[_0x1cb9('0x45')]['id'])});}});}})[_0x1cb9('0x24')](respondWithStatusCode(_0x5b2b21,null))[_0x1cb9('0x50')](handleError(_0x5b2b21,null));};exports[_0x1cb9('0x8d')]=function(_0x181146,_0x394a89,_0x4a050d){var _0x183dbf={};var _0x32f255={};var _0x32be25;var _0x3e9fca;return db[_0x1cb9('0x2c')]['findOne']({'where':{'id':_0x181146[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x394a89,null))['then'](function(_0x44f38a){if(_0x44f38a){_0x32be25=_0x44f38a;_0x32f255[_0x1cb9('0x34')]=_[_0x1cb9('0x31')](db[_0x1cb9('0x8e')][_0x1cb9('0x2d')]);_0x32f255[_0x1cb9('0x30')]=_[_0x1cb9('0x31')](_0x181146[_0x1cb9('0x30')]);_0x32f255[_0x1cb9('0x32')]=_['intersection'](_0x32f255['model'],_0x32f255[_0x1cb9('0x30')]);_0x183dbf[_0x1cb9('0x35')]=_[_0x1cb9('0x33')](_0x32f255[_0x1cb9('0x34')],qs[_0x1cb9('0x36')](_0x181146[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x183dbf[_0x1cb9('0x35')]=_0x183dbf[_0x1cb9('0x35')][_0x1cb9('0x37')]?_0x183dbf['attributes']:_0x32f255[_0x1cb9('0x34')];_0x183dbf[_0x1cb9('0x3a')]=qs[_0x1cb9('0x56')](_0x181146[_0x1cb9('0x30')][_0x1cb9('0x56')]);_0x183dbf[_0x1cb9('0x3b')]=qs['filters'](_[_0x1cb9('0x3c')](_0x181146[_0x1cb9('0x30')],_0x32f255[_0x1cb9('0x32')]));if(_0x181146[_0x1cb9('0x30')][_0x1cb9('0x3d')]){_0x183dbf[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x183dbf['where'],{'$or':_[_0x1cb9('0x2b')](_0x183dbf[_0x1cb9('0x35')],function(_0x276900){var _0x45c0e6={};_0x45c0e6[_0x276900]={'$like':'%'+_0x181146[_0x1cb9('0x30')][_0x1cb9('0x3d')]+'%'};return _0x45c0e6;})});}_0x183dbf=_[_0x1cb9('0x3e')]({},_0x183dbf,_0x181146[_0x1cb9('0x41')]);return _0x32be25[_0x1cb9('0x8d')](_0x183dbf);}})[_0x1cb9('0x24')](function(_0x27390a){if(_0x27390a){_0x3e9fca=_0x27390a[_0x1cb9('0x37')];if(!_0x181146[_0x1cb9('0x30')][_0x1cb9('0x38')](_0x1cb9('0x39'))){_0x183dbf[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x181146[_0x1cb9('0x30')][_0x1cb9('0x20')]);_0x183dbf[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x181146[_0x1cb9('0x30')]['offset']);}return _0x32be25[_0x1cb9('0x8d')](_0x183dbf);}})[_0x1cb9('0x24')](function(_0x16ec06){if(_0x16ec06){return _0x16ec06?{'count':_0x3e9fca,'rows':_0x16ec06}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x394a89,null))[_0x1cb9('0x50')](handleError(_0x394a89,null));}; \ No newline at end of file +var _0x70e0=['offset','limit','apply','reject','update','then','destroy','end','error','stack','name','send','map','CmList','rawAttributes','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','type','merge','includeAll','include','catch','show','params','keys','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','findOne','rows','removeDispositions','addContacts','tags','join','isArray','ListId','push','each','CmContact','omit','ids','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','hasOwnProperty','isEmpty','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmList.socket','sendStatus','status','count'];(function(_0x19babd,_0x1d4ef7){var _0x314eaf=function(_0x24ea35){while(--_0x24ea35){_0x19babd['push'](_0x19babd['shift']());}};_0x314eaf(++_0x1d4ef7);}(_0x70e0,0x17b));var _0x070e=function(_0x343c76,_0x5ed1cb){_0x343c76=_0x343c76-0x0;var _0x1cdbd5=_0x70e0[_0x343c76];return _0x1cdbd5;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];config[_0x070e('0x16')]=_[_0x070e('0x17')](config[_0x070e('0x16')],{'host':_0x070e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x070e('0x19'))['register'](socket);function respondWithStatusCode(_0x4a33d2,_0x5bae0f){_0x5bae0f=_0x5bae0f||0xcc;return function(_0x11d2ce){if(_0x11d2ce){return _0x4a33d2[_0x070e('0x1a')](_0x5bae0f);}return _0x4a33d2['status'](_0x5bae0f)['end']();};}function respondWithResult(_0x373d86,_0xeae1a5){_0xeae1a5=_0xeae1a5||0xc8;return function(_0x180897){if(_0x180897){return _0x373d86[_0x070e('0x1b')](_0xeae1a5)['json'](_0x180897);}};}function respondWithFilteredResult(_0x49861b,_0x17e2e4){return function(_0x2bd937){if(_0x2bd937){var _0x38f6e6=_0x2bd937[_0x070e('0x1c')],_0x2060cc=_0x17e2e4[_0x070e('0x1d')],_0x364b3f=_0x17e2e4[_0x070e('0x1d')]+_0x17e2e4[_0x070e('0x1e')],_0x5037eb;if(_0x364b3f>=_0x38f6e6){_0x364b3f=_0x38f6e6;_0x5037eb=0xc8;}else{_0x5037eb=0xce;}_0x49861b[_0x070e('0x1b')](_0x5037eb);return _0x49861b['set']('Content-Range',_0x2060cc+'-'+_0x364b3f+'/'+_0x38f6e6)['json'](_0x2bd937);}return null;};}function patchUpdates(_0x9907cf){return function(_0x3004f0){try{jsonpatch[_0x070e('0x1f')](_0x3004f0,_0x9907cf,!![]);}catch(_0x4be0d7){return BPromise[_0x070e('0x20')](_0x4be0d7);}return _0x3004f0['save']();};}function saveUpdates(_0xf8dd5d,_0x3f6985){return function(_0x27a01e){if(_0x27a01e){return _0x27a01e[_0x070e('0x21')](_0xf8dd5d)[_0x070e('0x22')](function(_0xa86797){return _0xa86797;});}return null;};}function removeEntity(_0xe405e,_0x164cdf){return function(_0x595c7e){if(_0x595c7e){return _0x595c7e[_0x070e('0x23')]()[_0x070e('0x22')](function(){var _0x4790eb=_0x595c7e['get']({'plain':!![]});var _0xf17c56='Lists';return db['UserProfileResource'][_0x070e('0x23')]({'where':{'type':_0xf17c56,'resourceId':_0x4790eb['id']}})[_0x070e('0x22')](function(){return _0x595c7e;});})[_0x070e('0x22')](function(){_0xe405e[_0x070e('0x1b')](0xcc)[_0x070e('0x24')]();});}};}function handleEntityNotFound(_0x497f58,_0x374c54){return function(_0x219e48){if(!_0x219e48){_0x497f58[_0x070e('0x1a')](0x194);}return _0x219e48;};}function handleError(_0x1d2a34,_0x43dd96){_0x43dd96=_0x43dd96||0x1f4;return function(_0x28d7f2){logger[_0x070e('0x25')](_0x28d7f2[_0x070e('0x26')]);if(_0x28d7f2['name']){delete _0x28d7f2[_0x070e('0x27')];}_0x1d2a34[_0x070e('0x1b')](_0x43dd96)[_0x070e('0x28')](_0x28d7f2);};}exports['index']=function(_0x5c5f0d,_0x13097f){var _0x46065c={},_0xa6c0ab={},_0x51402c={'count':0x0,'rows':[]};var _0x3fa994=_[_0x070e('0x29')](db[_0x070e('0x2a')][_0x070e('0x2b')],function(_0x53d473){return{'name':_0x53d473['fieldName'],'type':_0x53d473['type']['key']};});_0xa6c0ab[_0x070e('0x2c')]=_['map'](_0x3fa994,_0x070e('0x27'));_0xa6c0ab[_0x070e('0x2d')]=_['keys'](_0x5c5f0d['query']);_0xa6c0ab[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0xa6c0ab['model'],_0xa6c0ab['query']);_0x46065c[_0x070e('0x30')]=_[_0x070e('0x2f')](_0xa6c0ab[_0x070e('0x2c')],qs[_0x070e('0x31')](_0x5c5f0d[_0x070e('0x2d')]['fields']));_0x46065c['attributes']=_0x46065c[_0x070e('0x30')][_0x070e('0x32')]?_0x46065c[_0x070e('0x30')]:_0xa6c0ab[_0x070e('0x2c')];if(!_0x5c5f0d[_0x070e('0x2d')]['hasOwnProperty'](_0x070e('0x33'))){_0x46065c[_0x070e('0x1e')]=qs['limit'](_0x5c5f0d[_0x070e('0x2d')][_0x070e('0x1e')]);_0x46065c['offset']=qs['offset'](_0x5c5f0d['query'][_0x070e('0x1d')]);}_0x46065c[_0x070e('0x34')]=qs[_0x070e('0x35')](_0x5c5f0d[_0x070e('0x2d')][_0x070e('0x35')]);_0x46065c['where']=qs[_0x070e('0x2e')](_[_0x070e('0x36')](_0x5c5f0d[_0x070e('0x2d')],_0xa6c0ab['filters']));if(_0x5c5f0d[_0x070e('0x2d')][_0x070e('0x37')]){_0x46065c[_0x070e('0x38')]=_['merge'](_0x46065c[_0x070e('0x38')],{'$or':_[_0x070e('0x29')](_0x3fa994,function(_0x4800a9){if(_0x4800a9[_0x070e('0x39')]!=='VIRTUAL'){var _0x18dae9={};_0x18dae9[_0x4800a9[_0x070e('0x27')]]={'$like':'%'+_0x5c5f0d[_0x070e('0x2d')][_0x070e('0x37')]+'%'};return _0x18dae9;}})});}_0x46065c=_[_0x070e('0x3a')]({},_0x46065c,_0x5c5f0d['options']);var _0xd18220={'where':_0x46065c['where']};return db['CmList'][_0x070e('0x1c')](_0xd18220)[_0x070e('0x22')](function(_0x38879f){_0x51402c['count']=_0x38879f;if(_0x5c5f0d[_0x070e('0x2d')][_0x070e('0x3b')]){_0x46065c[_0x070e('0x3c')]=[{'all':!![]}];}return db[_0x070e('0x2a')]['findAll'](_0x46065c);})[_0x070e('0x22')](function(_0x5851ab){_0x51402c['rows']=_0x5851ab;return _0x51402c;})['then'](respondWithFilteredResult(_0x13097f,_0x46065c))[_0x070e('0x3d')](handleError(_0x13097f,null));};exports[_0x070e('0x3e')]=function(_0x26b3e2,_0x29dccd){var _0x34f23e={'raw':![],'where':{'id':_0x26b3e2[_0x070e('0x3f')]['id']}},_0x562aa4={};_0x562aa4['model']=_[_0x070e('0x40')](db[_0x070e('0x2a')][_0x070e('0x2b')]);_0x562aa4['query']=_['keys'](_0x26b3e2[_0x070e('0x2d')]);_0x562aa4['filters']=_[_0x070e('0x2f')](_0x562aa4[_0x070e('0x2c')],_0x562aa4[_0x070e('0x2d')]);_0x34f23e['attributes']=_[_0x070e('0x2f')](_0x562aa4[_0x070e('0x2c')],qs['fields'](_0x26b3e2['query'][_0x070e('0x31')]));_0x34f23e[_0x070e('0x30')]=_0x34f23e[_0x070e('0x30')][_0x070e('0x32')]?_0x34f23e[_0x070e('0x30')]:_0x562aa4['model'];if(_0x26b3e2[_0x070e('0x2d')][_0x070e('0x3b')]){_0x34f23e[_0x070e('0x3c')]=[{'all':!![]}];}_0x34f23e=_[_0x070e('0x3a')]({},_0x34f23e,_0x26b3e2[_0x070e('0x41')]);return db[_0x070e('0x2a')][_0x070e('0x42')](_0x34f23e)[_0x070e('0x22')](handleEntityNotFound(_0x29dccd,null))[_0x070e('0x22')](respondWithResult(_0x29dccd,null))[_0x070e('0x3d')](handleError(_0x29dccd,null));};exports[_0x070e('0x43')]=function(_0x3be553,_0x5254f8){return db[_0x070e('0x2a')][_0x070e('0x43')](_0x3be553['body'],{})[_0x070e('0x22')](function(_0xa7a41b){var _0x40298a=_0x3be553[_0x070e('0x44')][_0x070e('0x45')]({'plain':!![]});if(!_0x40298a)throw new Error(_0x070e('0x46'));if(_0x40298a[_0x070e('0x47')]===_0x070e('0x44')){var _0x1c64d2=_0xa7a41b['get']({'plain':!![]});var _0x251696='Lists';return db[_0x070e('0x48')][_0x070e('0x42')]({'where':{'name':_0x251696,'userProfileId':_0x40298a['userProfileId']},'raw':!![]})[_0x070e('0x22')](function(_0x130a50){if(_0x130a50&&_0x130a50[_0x070e('0x49')]===0x0){return db[_0x070e('0x4a')][_0x070e('0x43')]({'name':_0x1c64d2[_0x070e('0x27')],'resourceId':_0x1c64d2['id'],'type':_0x130a50[_0x070e('0x27')],'sectionId':_0x130a50['id']},{})['then'](function(){return _0xa7a41b;});}else{return _0xa7a41b;}})[_0x070e('0x3d')](function(_0x5bacbd){logger['error'](_0x070e('0x4b'),_0x5bacbd);throw _0x5bacbd;});}return _0xa7a41b;})[_0x070e('0x22')](respondWithResult(_0x5254f8,0xc9))[_0x070e('0x3d')](handleError(_0x5254f8,null));};exports[_0x070e('0x21')]=function(_0x202015,_0x7948ed){if(_0x202015[_0x070e('0x4c')]['id']){delete _0x202015[_0x070e('0x4c')]['id'];}return db['CmList'][_0x070e('0x42')]({'where':{'id':_0x202015['params']['id']}})['then'](handleEntityNotFound(_0x7948ed,null))[_0x070e('0x22')](saveUpdates(_0x202015[_0x070e('0x4c')],null))['then'](respondWithResult(_0x7948ed,null))[_0x070e('0x3d')](handleError(_0x7948ed,null));};exports[_0x070e('0x23')]=function(_0x210f4a,_0x2f8104){return db[_0x070e('0x2a')][_0x070e('0x42')]({'where':{'id':_0x210f4a[_0x070e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2f8104,null))['then'](removeEntity(_0x2f8104,null))['catch'](handleError(_0x2f8104,null));};exports[_0x070e('0x4d')]=function(_0x1948a5,_0x29f497){return db[_0x070e('0x2a')]['describe']()[_0x070e('0x22')](respondWithResult(_0x29f497,null))['catch'](handleError(_0x29f497,null));};exports[_0x070e('0x4e')]=function(_0x1cbb7e,_0x476804,_0x24f303){if(_0x1cbb7e[_0x070e('0x4c')]['id']){delete _0x1cbb7e[_0x070e('0x4c')]['id'];}return db['CmList'][_0x070e('0x42')]({'where':{'id':_0x1cbb7e[_0x070e('0x3f')]['id']}})[_0x070e('0x22')](handleEntityNotFound(_0x476804,null))['then'](function(_0x1d7873){if(_0x1d7873){_0x1cbb7e[_0x070e('0x4c')]['ListId']=_0x1d7873['id'];return db[_0x070e('0x4f')]['create'](_0x1cbb7e[_0x070e('0x4c')]);}})['then'](respondWithResult(_0x476804,null))['catch'](handleError(_0x476804,null));};exports['getDispositions']=function(_0xbaf43e,_0x1ae5cb,_0x1100d8){var _0x122198={'raw':![],'where':{}};var _0x3cb9ee={};var _0x3a00bb={'count':0x0,'rows':[]};return db['CmList'][_0x070e('0x50')]({'where':{'id':_0xbaf43e['params']['id']}})[_0x070e('0x22')](handleEntityNotFound(_0x1ae5cb,null))['then'](function(_0x2e10f7){if(_0x2e10f7){_0x3cb9ee[_0x070e('0x2c')]=_['keys'](db[_0x070e('0x4f')]['rawAttributes']);_0x3cb9ee[_0x070e('0x2d')]=_[_0x070e('0x40')](_0xbaf43e[_0x070e('0x2d')]);_0x3cb9ee[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x3cb9ee[_0x070e('0x2c')],_0x3cb9ee[_0x070e('0x2d')]);_0x122198[_0x070e('0x30')]=_[_0x070e('0x2f')](_0x3cb9ee[_0x070e('0x2c')],qs[_0x070e('0x31')](_0xbaf43e[_0x070e('0x2d')][_0x070e('0x31')]));_0x122198[_0x070e('0x30')]=_0x122198['attributes'][_0x070e('0x32')]?_0x122198[_0x070e('0x30')]:_0x3cb9ee[_0x070e('0x2c')];if(!_0xbaf43e[_0x070e('0x2d')]['hasOwnProperty'](_0x070e('0x33'))){_0x122198[_0x070e('0x1e')]=qs[_0x070e('0x1e')](_0xbaf43e[_0x070e('0x2d')][_0x070e('0x1e')]);_0x122198[_0x070e('0x1d')]=qs['offset'](_0xbaf43e[_0x070e('0x2d')][_0x070e('0x1d')]);}_0x122198[_0x070e('0x34')]=qs[_0x070e('0x35')](_0xbaf43e['query'][_0x070e('0x35')]);_0x122198['where']=qs[_0x070e('0x2e')](_[_0x070e('0x36')](_0xbaf43e[_0x070e('0x2d')],_0x3cb9ee[_0x070e('0x2e')]));_0x122198[_0x070e('0x38')]['ListId']=_0x2e10f7['id'];if(_0xbaf43e[_0x070e('0x2d')][_0x070e('0x37')]){_0x122198[_0x070e('0x38')]=_[_0x070e('0x3a')](_0x122198['where'],{'$or':_[_0x070e('0x29')](_0x122198['attributes'],function(_0x399055){var _0x44e465={};_0x44e465[_0x399055]={'$like':'%'+_0xbaf43e[_0x070e('0x2d')]['filter']+'%'};return _0x44e465;})});}_0x122198=_[_0x070e('0x3a')]({},_0x122198,_0xbaf43e['options']);return db[_0x070e('0x4f')]['count']({'where':_0x122198[_0x070e('0x38')]})[_0x070e('0x22')](function(_0x5cb168){_0x3a00bb[_0x070e('0x1c')]=_0x5cb168;if(_0xbaf43e['query'][_0x070e('0x3b')]){_0x122198[_0x070e('0x3c')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x122198);})[_0x070e('0x22')](function(_0x3022cd){_0x3a00bb[_0x070e('0x51')]=_0x3022cd;return _0x3a00bb;});}})[_0x070e('0x22')](respondWithFilteredResult(_0x1ae5cb,_0x122198))[_0x070e('0x3d')](handleError(_0x1ae5cb,null));};exports[_0x070e('0x52')]=function(_0x280d62,_0x332c8a,_0x25b599){return db[_0x070e('0x2a')][_0x070e('0x42')]({'where':{'id':_0x280d62[_0x070e('0x3f')]['id']}})[_0x070e('0x22')](handleEntityNotFound(_0x332c8a,null))['then'](function(_0x3308b5){if(_0x3308b5){return _0x3308b5[_0x070e('0x52')](_0x280d62['query']['ids']);}})[_0x070e('0x22')](respondWithStatusCode(_0x332c8a,null))[_0x070e('0x3d')](handleError(_0x332c8a,null));};exports[_0x070e('0x53')]=function(_0x24bbc7,_0x3b3e96,_0x12fe4f){return db[_0x070e('0x2a')][_0x070e('0x42')]({'where':{'id':_0x24bbc7[_0x070e('0x3f')]['id']}})[_0x070e('0x22')](handleEntityNotFound(_0x3b3e96,null))[_0x070e('0x22')](function(_0x2084a1){if(_0x2084a1){var _0x46ec49=[];var _0x595e2e={'success':[],'errors':[]};return db['CmContact']['describe']()[_0x070e('0x22')](function(_0x2e4b4a){if(_0x24bbc7[_0x070e('0x4c')][_0x070e('0x54')]&&_['isArray'](_0x24bbc7[_0x070e('0x4c')][_0x070e('0x54')])){if(_0x24bbc7[_0x070e('0x4c')][_0x070e('0x54')][_0x070e('0x32')]){_0x24bbc7[_0x070e('0x4c')]['tags']=_0x24bbc7[_0x070e('0x4c')]['tags'][_0x070e('0x55')](';')+';';}else{_0x24bbc7[_0x070e('0x4c')][_0x070e('0x54')]=null;}}else{_0x24bbc7[_0x070e('0x4c')][_0x070e('0x54')]=null;}if(_0x24bbc7['body']&&_[_0x070e('0x56')](_0x24bbc7[_0x070e('0x4c')])){for(var _0x5d3bd8=0x0;_0x5d3bd8<_0x24bbc7[_0x070e('0x4c')][_0x070e('0x32')];_0x5d3bd8+=0x1){_0x24bbc7['body'][_0x5d3bd8][_0x070e('0x57')]=_0x24bbc7[_0x070e('0x3f')]['id'];_0x46ec49[_0x070e('0x58')](_0x24bbc7['body'][_0x5d3bd8]);}return BPromise[_0x070e('0x59')](_0x46ec49,function(_0xe8c476){return db[_0x070e('0x5a')][_0x070e('0x43')](_[_0x070e('0x5b')](_0xe8c476,[_0x070e('0x5c'),'id'])||{},{'fields':_[_0x070e('0x40')](_0x2e4b4a),'raw':!![]})[_0x070e('0x22')](function(_0x206b97){_0x595e2e[_0x070e('0x5d')][_0x070e('0x58')](_0x206b97[_0x070e('0x5e')]);})[_0x070e('0x3d')](function(_0x4b058d){_0x595e2e[_0x070e('0x5f')][_0x070e('0x58')]({'data':_0xe8c476,'error':_0x4b058d[_0x070e('0x60')]});});})[_0x070e('0x22')](function(_0x1dceda){return _0x595e2e;})[_0x070e('0x3d')](function(_0x5c4352){return _0x5c4352;});}else{_0x3b3e96['status'](0x190)['json']({'message':_0x070e('0x61')});}});}})[_0x070e('0x22')](respondWithResult(_0x3b3e96,null))[_0x070e('0x3d')](handleError(_0x3b3e96,null));};exports[_0x070e('0x62')]=function(_0x4b4b9a,_0x7f3f5,_0x20cd8a){var _0x370209;return db['CmList'][_0x070e('0x42')]({'where':{'id':_0x4b4b9a['params']['id']},'include':[{'model':db[_0x070e('0x63')],'as':_0x070e('0x64')}]})['then'](handleEntityNotFound(_0x7f3f5,null))['then'](function(_0x2048e9){if(_0x2048e9){_0x370209=_0x2048e9;return db[_0x070e('0x5a')]['rawAttributes'];}})[_0x070e('0x22')](function(_0x596beb){if(_0x596beb){var _0x4e8af1={};var _0x4caaa9={};_0x4caaa9[_0x070e('0x2c')]=_[_0x070e('0x65')](_[_0x070e('0x40')](_0x596beb),_[_0x070e('0x29')](_0x370209[_0x070e('0x64')],function(_0x341756){return util[_0x070e('0x66')](_0x070e('0x67'),_0x341756['id']);}));_0x4caaa9[_0x070e('0x2d')]=_[_0x070e('0x40')](_0x4b4b9a[_0x070e('0x2d')]);_0x4caaa9[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x4caaa9[_0x070e('0x2c')],_0x4caaa9[_0x070e('0x2d')]);_0x4e8af1[_0x070e('0x30')]=_[_0x070e('0x2f')](_0x4caaa9[_0x070e('0x2c')],qs[_0x070e('0x31')](_0x4b4b9a[_0x070e('0x2d')][_0x070e('0x31')]));_0x4e8af1[_0x070e('0x30')]=_0x4e8af1['attributes'][_0x070e('0x32')]?_0x4e8af1[_0x070e('0x30')]:_0x4caaa9[_0x070e('0x2c')];if(!_0x4b4b9a[_0x070e('0x2d')]['hasOwnProperty'](_0x070e('0x33'))){_0x4e8af1[_0x070e('0x1e')]=qs[_0x070e('0x1e')](_0x4b4b9a[_0x070e('0x2d')][_0x070e('0x1e')]);_0x4e8af1[_0x070e('0x1d')]=qs['offset'](_0x4b4b9a['query']['offset']);}_0x4e8af1[_0x070e('0x34')]=qs['sort'](_0x4b4b9a[_0x070e('0x2d')][_0x070e('0x35')]);_0x4e8af1['where']=qs[_0x070e('0x2e')](_[_0x070e('0x36')](_0x4b4b9a['query'],_0x4caaa9['filters']));_0x4e8af1[_0x070e('0x68')]=!![];if(_0x4b4b9a[_0x070e('0x2d')][_0x070e('0x37')]){_0x4e8af1[_0x070e('0x38')]=_[_0x070e('0x3a')](_0x4e8af1['where'],{'$or':_[_0x070e('0x29')](_0x4e8af1['attributes'],function(_0x44feba){var _0x1219b4={};_0x1219b4[_0x44feba]={'$like':'%'+_0x4b4b9a['query'][_0x070e('0x37')]+'%'};return _0x1219b4;})});}_0x4e8af1=_[_0x070e('0x3a')]({},_0x4e8af1,_0x4b4b9a[_0x070e('0x41')]);return _0x370209[_0x070e('0x62')](_0x4e8af1);}})[_0x070e('0x22')](respondWithResult(_0x7f3f5,null))[_0x070e('0x3d')](handleError(_0x7f3f5,null));};exports['getContactsCsv']=function(_0x41a3cc,_0x3b75f3,_0xde8455){var _0x1ba0de;return db[_0x070e('0x2a')]['find']({'where':{'id':_0x41a3cc[_0x070e('0x3f')]['id']},'include':[{'model':db[_0x070e('0x63')],'as':_0x070e('0x64')}]})[_0x070e('0x22')](handleEntityNotFound(_0x3b75f3,null))[_0x070e('0x22')](function(_0x31ceee){if(_0x31ceee){_0x1ba0de=_0x31ceee;return db[_0x070e('0x5a')][_0x070e('0x2b')];}})[_0x070e('0x22')](function(_0xfe61be){if(_0xfe61be){var _0x1e14b5={};var _0x2614b2={};_0x2614b2[_0x070e('0x2c')]=_[_0x070e('0x65')](_[_0x070e('0x40')](_0xfe61be),_[_0x070e('0x29')](_0x1ba0de['CustomFields'],function(_0x48fe1d){return util[_0x070e('0x66')](_0x070e('0x67'),_0x48fe1d['id']);}));_0x2614b2['query']=_['keys'](_0x41a3cc['query']);_0x2614b2['filters']=_[_0x070e('0x2f')](_0x2614b2[_0x070e('0x2c')],_0x2614b2[_0x070e('0x2d')]);_0x1e14b5[_0x070e('0x30')]=_[_0x070e('0x2f')](_0x2614b2[_0x070e('0x2c')],qs[_0x070e('0x31')](_0x41a3cc[_0x070e('0x2d')][_0x070e('0x31')]));_0x1e14b5[_0x070e('0x30')]=_0x1e14b5['attributes'][_0x070e('0x32')]?_0x1e14b5[_0x070e('0x30')]:_0x2614b2['model'];if(!_0x41a3cc[_0x070e('0x2d')][_0x070e('0x69')](_0x070e('0x33'))){_0x1e14b5[_0x070e('0x1e')]=qs['limit'](_0x41a3cc[_0x070e('0x2d')][_0x070e('0x1e')]);_0x1e14b5[_0x070e('0x1d')]=qs[_0x070e('0x1d')](_0x41a3cc['query'][_0x070e('0x1d')]);}_0x1e14b5[_0x070e('0x34')]=qs[_0x070e('0x35')](_0x41a3cc[_0x070e('0x2d')][_0x070e('0x35')]);_0x1e14b5[_0x070e('0x38')]=qs[_0x070e('0x2e')](_[_0x070e('0x36')](_0x41a3cc[_0x070e('0x2d')],_0x2614b2[_0x070e('0x2e')]));_0x1e14b5[_0x070e('0x68')]=!![];if(_0x41a3cc['query'][_0x070e('0x37')]){_0x1e14b5[_0x070e('0x38')]=_['merge'](_0x1e14b5['where'],{'$or':_[_0x070e('0x29')](_0x1e14b5['attributes'],function(_0x2c759a){var _0x24612f={};_0x24612f[_0x2c759a]={'$like':'%'+_0x41a3cc[_0x070e('0x2d')][_0x070e('0x37')]+'%'};return _0x24612f;})});}_0x1e14b5=_[_0x070e('0x3a')]({},_0x1e14b5,_0x41a3cc[_0x070e('0x41')]);return _0x1ba0de[_0x070e('0x62')](_0x1e14b5);}})['then'](function(_0x20493c){if(!_[_0x070e('0x6a')](_0x20493c)){var _0x2543df=toCsv(_0x20493c);var _0x2a80bd=Date['now']();fs['writeFileSync'](util[_0x070e('0x66')](_0x070e('0x6b'),_0x1ba0de['id'],_0x2a80bd),_0x2543df);_0x3b75f3[_0x070e('0x6c')]('Content-disposition',_0x070e('0x6d')+util[_0x070e('0x66')]('list_%d_%s.csv',_0x1ba0de['id'],_0x2a80bd));_0x3b75f3[_0x070e('0x6c')](_0x070e('0x6e'),_0x070e('0x6f'));return _0x3b75f3[_0x070e('0x70')](util[_0x070e('0x66')](_0x070e('0x6b'),_0x1ba0de['id'],_0x2a80bd));}else{return _0x3b75f3['sendStatus'](0xcc);}})['catch'](handleError(_0x3b75f3,null));};exports[_0x070e('0x71')]=function(_0x54b6af,_0xc7f214,_0x270d47){var _0x4cf2b8;delete _0x54b6af[_0x070e('0x4c')]['id'];return db['CmList'][_0x070e('0x50')]({'where':{'id':_0x54b6af[_0x070e('0x3f')]['id']}})[_0x070e('0x22')](handleEntityNotFound(_0xc7f214,null))[_0x070e('0x22')](function(_0x207a7a){if(_0x207a7a){return db[_0x070e('0x72')]['transaction'](function(_0x434723){return db[_0x070e('0x63')]['create'](_0x54b6af['body'],{'transaction':_0x434723})[_0x070e('0x22')](function(_0x8e9b5c){_0x4cf2b8=_0x8e9b5c;return _0x207a7a[_0x070e('0x73')](_0x8e9b5c,{'transaction':_0x434723});})[_0x070e('0x22')](function(){var _0x3893a5={'type':db[_0x070e('0x74')][_0x070e('0x75')],'transaction':_0x434723};switch(_0x54b6af[_0x070e('0x4c')]['type']){case _0x070e('0x76'):_0x3893a5[_0x070e('0x39')]=db[_0x070e('0x74')][_0x070e('0x75')];break;case _0x070e('0x77'):_0x3893a5[_0x070e('0x39')]=db[_0x070e('0x74')][_0x070e('0x78')];break;case'switch':_0x3893a5[_0x070e('0x39')]=db[_0x070e('0x74')][_0x070e('0x79')];_0x3893a5[_0x070e('0x7a')]=![];break;default:}return db[_0x070e('0x72')][_0x070e('0x7b')][_0x070e('0x7c')](_0x070e('0x7d'),util[_0x070e('0x66')](_0x070e('0x7e'),_0x4cf2b8['id']),_0x3893a5);})['then'](function(){return _0x4cf2b8;});});}})['then'](respondWithResult(_0xc7f214,null))[_0x070e('0x3d')](handleError(_0xc7f214,null));};exports[_0x070e('0x7f')]=function(_0x256105,_0x567202,_0xefd35a){var _0x36dfb5={};var _0x5f00d0={};var _0x26901c;var _0x2b6909;return db[_0x070e('0x2a')][_0x070e('0x50')]({'where':{'id':_0x256105[_0x070e('0x3f')]['id']}})[_0x070e('0x22')](handleEntityNotFound(_0x567202,null))['then'](function(_0x4de58b){if(_0x4de58b){_0x26901c=_0x4de58b;_0x5f00d0[_0x070e('0x2c')]=_[_0x070e('0x40')](db['CmCustomField'][_0x070e('0x2b')]);_0x5f00d0[_0x070e('0x2d')]=_[_0x070e('0x40')](_0x256105[_0x070e('0x2d')]);_0x5f00d0[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x5f00d0['model'],_0x5f00d0[_0x070e('0x2d')]);_0x36dfb5[_0x070e('0x30')]=_['intersection'](_0x5f00d0[_0x070e('0x2c')],qs[_0x070e('0x31')](_0x256105[_0x070e('0x2d')][_0x070e('0x31')]));_0x36dfb5['attributes']=_0x36dfb5['attributes'][_0x070e('0x32')]?_0x36dfb5[_0x070e('0x30')]:_0x5f00d0[_0x070e('0x2c')];_0x36dfb5[_0x070e('0x34')]=qs[_0x070e('0x35')](_0x256105[_0x070e('0x2d')][_0x070e('0x35')]);_0x36dfb5[_0x070e('0x38')]=qs[_0x070e('0x2e')](_[_0x070e('0x36')](_0x256105['query'],_0x5f00d0[_0x070e('0x2e')]));_0x36dfb5[_0x070e('0x38')]=_[_0x070e('0x3a')](_0x36dfb5[_0x070e('0x38')],{'$or':[{'ListId':_0x4de58b['id']},{'ListId':null}]});if(_0x256105['query'][_0x070e('0x37')]){_0x36dfb5[_0x070e('0x38')]=_['merge'](_0x36dfb5['where'],{'$or':_[_0x070e('0x29')](_0x36dfb5[_0x070e('0x30')],function(_0x1abf03){var _0x5f0d6a={};_0x5f0d6a[_0x1abf03]={'$like':'%'+_0x256105[_0x070e('0x2d')][_0x070e('0x37')]+'%'};return _0x5f0d6a;})});}_0x36dfb5=_[_0x070e('0x3a')]({},_0x36dfb5,_0x256105[_0x070e('0x41')]);return db[_0x070e('0x63')]['findAndCountAll'](_0x36dfb5);}})[_0x070e('0x22')](respondWithResult(_0x567202,null))[_0x070e('0x3d')](handleError(_0x567202,null));};exports['addAgents']=function(_0x2a94f9,_0x4b3fbc,_0x5326f2){return db['CmList'][_0x070e('0x42')]({'where':{'id':_0x2a94f9[_0x070e('0x3f')]['id']}})[_0x070e('0x22')](handleEntityNotFound(_0x4b3fbc,null))[_0x070e('0x22')](function(_0x4f5c50){if(_0x4f5c50){return _0x4f5c50[_0x070e('0x80')](_0x2a94f9[_0x070e('0x4c')]['ids'],_[_0x070e('0x5b')](_0x2a94f9[_0x070e('0x4c')],[_0x070e('0x5c'),'id'])||{})[_0x070e('0x81')](function(_0x4ea0a6){for(var _0x445182=0x0;_0x445182<_0x2a94f9['body'][_0x070e('0x5c')]['length'];_0x445182+=0x1){socket[_0x070e('0x82')](_0x070e('0x83'),{'UserId':_0x2a94f9[_0x070e('0x4c')]['ids'][_0x445182],'CmListId':_0x2a94f9[_0x070e('0x3f')]['id']});}return _0x4ea0a6;});}})[_0x070e('0x22')](respondWithResult(_0x4b3fbc,null))[_0x070e('0x3d')](handleError(_0x4b3fbc,null));};exports['removeAgents']=function(_0xbaed32,_0x3a5086,_0x52545e){return db[_0x070e('0x2a')][_0x070e('0x42')]({'where':{'id':_0xbaed32['params']['id']}})['then'](handleEntityNotFound(_0x3a5086,null))['then'](function(_0x5e1fee){if(_0x5e1fee){return _0x5e1fee[_0x070e('0x84')](_0xbaed32[_0x070e('0x2d')][_0x070e('0x5c')])[_0x070e('0x22')](function(){if(_[_0x070e('0x56')](_0xbaed32[_0x070e('0x2d')][_0x070e('0x5c')])){for(var _0x472fc9=0x0;_0x472fc9<_0xbaed32['query']['ids']['length'];_0x472fc9+=0x1){socket['emit'](_0x070e('0x85'),{'UserId':Number(_0xbaed32[_0x070e('0x2d')][_0x070e('0x5c')][_0x472fc9]),'CmListId':Number(_0xbaed32[_0x070e('0x3f')]['id'])});}}else{socket[_0x070e('0x82')]('userCmList:remove',{'UserId':Number(_0xbaed32['query'][_0x070e('0x5c')]),'CmListId':Number(_0xbaed32[_0x070e('0x3f')]['id'])});}});}})['then'](respondWithStatusCode(_0x3a5086,null))[_0x070e('0x3d')](handleError(_0x3a5086,null));};exports[_0x070e('0x86')]=function(_0x239385,_0x75ea53,_0x38b0e1){var _0x15b1f6={};var _0x5e71ab={};var _0x202ebf;var _0x1d48a9;return db[_0x070e('0x2a')]['findOne']({'where':{'id':_0x239385[_0x070e('0x3f')]['id']}})[_0x070e('0x22')](handleEntityNotFound(_0x75ea53,null))[_0x070e('0x22')](function(_0x281b3d){if(_0x281b3d){_0x202ebf=_0x281b3d;_0x5e71ab['model']=_[_0x070e('0x40')](db[_0x070e('0x87')]['rawAttributes']);_0x5e71ab[_0x070e('0x2d')]=_[_0x070e('0x40')](_0x239385['query']);_0x5e71ab[_0x070e('0x2e')]=_['intersection'](_0x5e71ab[_0x070e('0x2c')],_0x5e71ab['query']);_0x15b1f6[_0x070e('0x30')]=_['intersection'](_0x5e71ab['model'],qs[_0x070e('0x31')](_0x239385['query']['fields']));_0x15b1f6[_0x070e('0x30')]=_0x15b1f6[_0x070e('0x30')][_0x070e('0x32')]?_0x15b1f6[_0x070e('0x30')]:_0x5e71ab[_0x070e('0x2c')];_0x15b1f6['order']=qs[_0x070e('0x35')](_0x239385[_0x070e('0x2d')][_0x070e('0x35')]);_0x15b1f6[_0x070e('0x38')]=qs[_0x070e('0x2e')](_[_0x070e('0x36')](_0x239385['query'],_0x5e71ab[_0x070e('0x2e')]));if(_0x239385[_0x070e('0x2d')][_0x070e('0x37')]){_0x15b1f6[_0x070e('0x38')]=_['merge'](_0x15b1f6['where'],{'$or':_[_0x070e('0x29')](_0x15b1f6[_0x070e('0x30')],function(_0x287f59){var _0xacac33={};_0xacac33[_0x287f59]={'$like':'%'+_0x239385[_0x070e('0x2d')][_0x070e('0x37')]+'%'};return _0xacac33;})});}_0x15b1f6=_['merge']({},_0x15b1f6,_0x239385[_0x070e('0x41')]);return _0x202ebf[_0x070e('0x86')](_0x15b1f6);}})[_0x070e('0x22')](function(_0x3a894e){if(_0x3a894e){_0x1d48a9=_0x3a894e[_0x070e('0x32')];if(!_0x239385[_0x070e('0x2d')]['hasOwnProperty']('nolimit')){_0x15b1f6[_0x070e('0x1e')]=qs[_0x070e('0x1e')](_0x239385[_0x070e('0x2d')][_0x070e('0x1e')]);_0x15b1f6[_0x070e('0x1d')]=qs[_0x070e('0x1d')](_0x239385[_0x070e('0x2d')]['offset']);}return _0x202ebf[_0x070e('0x86')](_0x15b1f6);}})['then'](function(_0xfe12a6){if(_0xfe12a6){return _0xfe12a6?{'count':_0x1d48a9,'rows':_0xfe12a6}:null;}})['then'](respondWithResult(_0x75ea53,null))['catch'](handleError(_0x75ea53,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index a2b66b5..18cfcf7 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 _0x5be3=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x218e04,_0x1c52db){var _0xb251f4=function(_0x2da1d3){while(--_0x2da1d3){_0x218e04['push'](_0x218e04['shift']());}};_0xb251f4(++_0x1c52db);}(_0x5be3,0x126));var _0x35be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5be3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x35be('0x0'));var CmList=require(_0x35be('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35be('0x2')](0x0);var events={'afterCreate':_0x35be('0x3'),'afterUpdate':_0x35be('0x4'),'afterDestroy':_0x35be('0x5')};function emitEvent(_0x57f680){return function(_0x582bd2,_0x727393,_0x5c81f1){CmListEvents[_0x35be('0x6')](_0x57f680+':'+_0x582bd2['id'],_0x582bd2);CmListEvents[_0x35be('0x6')](_0x57f680,_0x582bd2);_0x5c81f1(null);};}for(var e in events){if(events[_0x35be('0x7')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x3d43=['emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save','remove'];(function(_0x3ca18a,_0x2b0b40){var _0x586862=function(_0x566b97){while(--_0x566b97){_0x3ca18a['push'](_0x3ca18a['shift']());}};_0x586862(++_0x2b0b40);}(_0x3d43,0xc0));var _0x33d4=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0x3d43[_0x349367];return _0x14179b;};'use strict';var EventEmitter=require(_0x33d4('0x0'));var CmList=require(_0x33d4('0x1'))['db'][_0x33d4('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x33d4('0x3')](0x0);var events={'afterCreate':_0x33d4('0x4'),'afterUpdate':'update','afterDestroy':_0x33d4('0x5')};function emitEvent(_0x3cdf1b){return function(_0x58fdeb,_0x36aadc,_0x58d609){CmListEvents[_0x33d4('0x6')](_0x3cdf1b+':'+_0x58fdeb['id'],_0x58fdeb);CmListEvents[_0x33d4('0x6')](_0x3cdf1b,_0x58fdeb);_0x58d609(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x33d4('0x7')](e,emitEvent(event));}}module[_0x33d4('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index d2d1d7e..13b4372 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 _0xf483=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','util','../../config/logger'];(function(_0x501f84,_0x291f25){var _0x2c6649=function(_0x64df4){while(--_0x64df4){_0x501f84['push'](_0x501f84['shift']());}};_0x2c6649(++_0x291f25);}(_0xf483,0x15e));var _0x3f48=function(_0x4b6053,_0x302ff9){_0x4b6053=_0x4b6053-0x0;var _0x211dbd=_0xf483[_0x4b6053];return _0x211dbd;};'use strict';var _=require('lodash');var util=require(_0x3f48('0x0'));var logger=require(_0x3f48('0x1'))(_0x3f48('0x2'));var moment=require(_0x3f48('0x3'));var BPromise=require(_0x3f48('0x4'));var rp=require(_0x3f48('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f48('0x6'));var config=require(_0x3f48('0x7'));var attributes=require(_0x3f48('0x8'));module['exports']=function(_0x1dcf1d,_0x4ddd65){return _0x1dcf1d['define'](_0x3f48('0x9'),attributes,{'tableName':_0x3f48('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87eb=['path','../../config/environment','./cmList.attributes','exports','CmList','lodash','util','../../config/logger','api','bluebird'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x87eb,0x109));var _0xb87e=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x87eb[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xb87e('0x0'));var util=require(_0xb87e('0x1'));var logger=require(_0xb87e('0x2'))(_0xb87e('0x3'));var moment=require('moment');var BPromise=require(_0xb87e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb87e('0x5'));var rimraf=require('rimraf');var config=require(_0xb87e('0x6'));var attributes=require(_0xb87e('0x7'));module[_0xb87e('0x8')]=function(_0x9afed8,_0x4bf1ba){return _0x9afed8['define'](_0xb87e('0x9'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index ea38cd6..babd70d 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 _0xd85c=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x2d3577,_0x30627c){var _0x28f161=function(_0x6bc313){while(--_0x6bc313){_0x2d3577['push'](_0x2d3577['shift']());}};_0x28f161(++_0x30627c);}(_0xd85c,0xb3));var _0xcd85=function(_0x52ddc8,_0xada5d6){_0x52ddc8=_0x52ddc8-0x0;var _0x41e9c3=_0xd85c[_0x52ddc8];return _0x41e9c3;};'use strict';var _=require(_0xcd85('0x0'));var util=require(_0xcd85('0x1'));var moment=require(_0xcd85('0x2'));var BPromise=require(_0xcd85('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd85('0x4'));var db=require(_0xcd85('0x5'))['db'];var utils=require(_0xcd85('0x6'));var logger=require(_0xcd85('0x7'))(_0xcd85('0x8'));var config=require(_0xcd85('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcd85('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xcd85('0xb')],{'host':_0xcd85('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcd85('0xb')]));require(_0xcd85('0xd'))[_0xcd85('0xe')](socket);function respondWithRpcPromise(_0x54b58c,_0x5e782c,_0x24143f){return new BPromise(function(_0x475499,_0xd2b606){return client[_0xcd85('0xf')](_0x54b58c,_0x24143f)[_0xcd85('0x10')](function(_0x1beba){logger[_0xcd85('0x11')](_0xcd85('0x12'),_0x5e782c,_0xcd85('0x13'));logger['debug'](_0xcd85('0x14'),_0x5e782c,_0xcd85('0x13'),JSON['stringify'](_0x1beba));if(_0x1beba[_0xcd85('0x15')]){if(_0x1beba[_0xcd85('0x15')][_0xcd85('0x16')]===0x1f4){logger[_0xcd85('0x15')](_0xcd85('0x12'),_0x5e782c,_0x1beba[_0xcd85('0x15')][_0xcd85('0x17')]);return _0xd2b606(_0x1beba[_0xcd85('0x15')][_0xcd85('0x17')]);}logger[_0xcd85('0x15')](_0xcd85('0x12'),_0x5e782c,_0x1beba[_0xcd85('0x15')][_0xcd85('0x17')]);return _0x475499(_0x1beba[_0xcd85('0x15')]['message']);}else{logger[_0xcd85('0x11')](_0xcd85('0x12'),_0x5e782c,'request\x20sent');_0x475499(_0x1beba[_0xcd85('0x18')]['message']);}})[_0xcd85('0x19')](function(_0x220d2d){logger[_0xcd85('0x15')](_0xcd85('0x12'),_0x5e782c,_0x220d2d);_0xd2b606(_0x220d2d);});});} \ No newline at end of file +var _0xb8c8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x19cade,_0x42510d){var _0xaf01fa=function(_0x229af4){while(--_0x229af4){_0x19cade['push'](_0x19cade['shift']());}};_0xaf01fa(++_0x42510d);}(_0xb8c8,0x72));var _0x8b8c=function(_0xce7358,_0x55fff8){_0xce7358=_0xce7358-0x0;var _0x497f7c=_0xb8c8[_0xce7358];return _0x497f7c;};'use strict';var _=require('lodash');var util=require(_0x8b8c('0x0'));var moment=require(_0x8b8c('0x1'));var BPromise=require(_0x8b8c('0x2'));var rs=require(_0x8b8c('0x3'));var fs=require('fs');var Redis=require(_0x8b8c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b8c('0x5'));var logger=require(_0x8b8c('0x6'))(_0x8b8c('0x7'));var config=require(_0x8b8c('0x8'));var jayson=require(_0x8b8c('0x9'));var client=jayson[_0x8b8c('0xa')][_0x8b8c('0xb')]({'port':0x232a});config[_0x8b8c('0xc')]=_[_0x8b8c('0xd')](config[_0x8b8c('0xc')],{'host':_0x8b8c('0xe'),'port':0x18eb});var socket=require(_0x8b8c('0xf'))(new Redis(config[_0x8b8c('0xc')]));require(_0x8b8c('0x10'))[_0x8b8c('0x11')](socket);function respondWithRpcPromise(_0x111d98,_0xcfe2a0,_0x478a00){return new BPromise(function(_0x2b0a77,_0x3267ec){return client[_0x8b8c('0x12')](_0x111d98,_0x478a00)[_0x8b8c('0x13')](function(_0x3f5df7){logger[_0x8b8c('0x14')](_0x8b8c('0x15'),_0xcfe2a0,_0x8b8c('0x16'));logger[_0x8b8c('0x17')](_0x8b8c('0x18'),_0xcfe2a0,_0x8b8c('0x16'),JSON[_0x8b8c('0x19')](_0x3f5df7));if(_0x3f5df7[_0x8b8c('0x1a')]){if(_0x3f5df7[_0x8b8c('0x1a')][_0x8b8c('0x1b')]===0x1f4){logger[_0x8b8c('0x1a')](_0x8b8c('0x15'),_0xcfe2a0,_0x3f5df7[_0x8b8c('0x1a')][_0x8b8c('0x1c')]);return _0x3267ec(_0x3f5df7[_0x8b8c('0x1a')][_0x8b8c('0x1c')]);}logger[_0x8b8c('0x1a')](_0x8b8c('0x15'),_0xcfe2a0,_0x3f5df7[_0x8b8c('0x1a')][_0x8b8c('0x1c')]);return _0x2b0a77(_0x3f5df7[_0x8b8c('0x1a')][_0x8b8c('0x1c')]);}else{logger[_0x8b8c('0x14')](_0x8b8c('0x15'),_0xcfe2a0,_0x8b8c('0x16'));_0x2b0a77(_0x3f5df7['result'][_0x8b8c('0x1c')]);}})[_0x8b8c('0x1d')](function(_0x4f584d){logger[_0x8b8c('0x1a')](_0x8b8c('0x15'),_0xcfe2a0,_0x4f584d);_0x3267ec(_0x4f584d);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 094dcf4..b9e33be 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 _0x1224=['update','emit','register','length','cmList:','./cmList.events','save','remove'];(function(_0x40ee45,_0x1be503){var _0x38b989=function(_0x559d7a){while(--_0x559d7a){_0x40ee45['push'](_0x40ee45['shift']());}};_0x38b989(++_0x1be503);}(_0x1224,0x10d));var _0x4122=function(_0x5ebcc4,_0x24356a){_0x5ebcc4=_0x5ebcc4-0x0;var _0xff2552=_0x1224[_0x5ebcc4];return _0xff2552;};'use strict';var CmListEvents=require(_0x4122('0x0'));var events=[_0x4122('0x1'),_0x4122('0x2'),_0x4122('0x3')];function createListener(_0x488f55,_0x3d42a9){return function(_0x51632b){_0x3d42a9[_0x4122('0x4')](_0x488f55,_0x51632b);};}function removeListener(_0x1f1533,_0x2f506b){return function(){CmListEvents['removeListener'](_0x1f1533,_0x2f506b);};}exports[_0x4122('0x5')]=function(_0x76278c){for(var _0xc6dfaf=0x0,_0x40b5e4=events[_0x4122('0x6')];_0xc6dfaf<_0x40b5e4;_0xc6dfaf++){var _0x431470=events[_0xc6dfaf];var _0x2444a3=createListener(_0x4122('0x7')+_0x431470,_0x76278c);CmListEvents['on'](_0x431470,_0x2444a3);}}; \ No newline at end of file +var _0x291c=['save','remove','update','emit','removeListener','length','cmList:','./cmList.events'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x291c,0x137));var _0xc291=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x291c[_0x1cc8fe];return _0x230054;};'use strict';var CmListEvents=require(_0xc291('0x0'));var events=[_0xc291('0x1'),_0xc291('0x2'),_0xc291('0x3')];function createListener(_0xfdfc37,_0x253ebb){return function(_0xc32916){_0x253ebb[_0xc291('0x4')](_0xfdfc37,_0xc32916);};}function removeListener(_0xafdfee,_0x118ddf){return function(){CmListEvents[_0xc291('0x5')](_0xafdfee,_0x118ddf);};}exports['register']=function(_0x2c96a8){for(var _0x5f2563=0x0,_0x5a7459=events[_0xc291('0x6')];_0x5f2563<_0x5a7459;_0x5f2563++){var _0x2d3526=events[_0x5f2563];var _0x42a6ac=createListener(_0xc291('0x7')+_0x2d3526,_0x2c96a8);CmListEvents['on'](_0x2d3526,_0x42a6ac);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 281b53d..d7ac1fa 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 _0xb30a=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','update','delete','destroy','removeAgents'];(function(_0x38c23e,_0x2f25cb){var _0x54f594=function(_0x38ec6f){while(--_0x38ec6f){_0x38c23e['push'](_0x38c23e['shift']());}};_0x54f594(++_0x2f25cb);}(_0xb30a,0x1cf));var _0xab30=function(_0x2b9148,_0x48a4a6){_0x2b9148=_0x2b9148-0x0;var _0xfcaeae=_0xb30a[_0x2b9148];return _0xfcaeae;};'use strict';var multer=require(_0xab30('0x0'));var util=require('util');var path=require(_0xab30('0x1'));var timeout=require(_0xab30('0x2'));var express=require(_0xab30('0x3'));var router=express[_0xab30('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xab30('0x5'));var config=require(_0xab30('0x6'));var controller=require(_0xab30('0x7'));router[_0xab30('0x8')]('/',auth[_0xab30('0x9')](),controller['index']);router['get'](_0xab30('0xa'),auth[_0xab30('0x9')](),controller['describe']);router[_0xab30('0x8')](_0xab30('0xb'),auth[_0xab30('0x9')](),controller[_0xab30('0xc')]);router['get']('/:id/dispositions',auth[_0xab30('0x9')](),controller[_0xab30('0xd')]);router[_0xab30('0x8')](_0xab30('0xe'),auth[_0xab30('0x9')](),controller[_0xab30('0xf')]);router[_0xab30('0x8')](_0xab30('0x10'),auth[_0xab30('0x9')](),controller[_0xab30('0x11')]);router['get'](_0xab30('0x12'),auth['isAuthenticated'](),controller[_0xab30('0x13')]);router[_0xab30('0x8')](_0xab30('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0xab30('0x15')]('/',auth['isAuthenticated'](),controller[_0xab30('0x16')]);router['post'](_0xab30('0x17'),auth[_0xab30('0x9')](),controller[_0xab30('0x18')]);router[_0xab30('0x15')](_0xab30('0xe'),auth[_0xab30('0x9')](),controller[_0xab30('0x19')]);router[_0xab30('0x15')](_0xab30('0x12'),auth[_0xab30('0x9')](),controller[_0xab30('0x1a')]);router[_0xab30('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xab30('0x1b')]);router['put']('/:id',auth[_0xab30('0x9')](),controller[_0xab30('0x1c')]);router[_0xab30('0x1d')](_0xab30('0xb'),auth[_0xab30('0x9')](),controller[_0xab30('0x1e')]);router[_0xab30('0x1d')](_0xab30('0x17'),auth[_0xab30('0x9')](),controller['removeDispositions']);router[_0xab30('0x1d')](_0xab30('0x14'),auth['isAuthenticated'](),controller[_0xab30('0x1f')]);module[_0xab30('0x20')]=router; \ No newline at end of file +var _0x5399=['getCustomFields','/:id/users','post','addDisposition','addContacts','/:id/fields','put','update','delete','destroy','removeDispositions','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv'];(function(_0x277fd8,_0x60bee1){var _0x1b8208=function(_0x32915c){while(--_0x32915c){_0x277fd8['push'](_0x277fd8['shift']());}};_0x1b8208(++_0x60bee1);}(_0x5399,0xde));var _0x9539=function(_0x1e9d62,_0x25bb8e){_0x1e9d62=_0x1e9d62-0x0;var _0x56c490=_0x5399[_0x1e9d62];return _0x56c490;};'use strict';var multer=require(_0x9539('0x0'));var util=require(_0x9539('0x1'));var path=require('path');var timeout=require(_0x9539('0x2'));var express=require(_0x9539('0x3'));var router=express[_0x9539('0x4')]();var auth=require(_0x9539('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9539('0x6'));var controller=require(_0x9539('0x7'));router[_0x9539('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x9539('0x9')](),controller[_0x9539('0xa')]);router[_0x9539('0x8')](_0x9539('0xb'),auth[_0x9539('0x9')](),controller['show']);router[_0x9539('0x8')](_0x9539('0xc'),auth[_0x9539('0x9')](),controller[_0x9539('0xd')]);router[_0x9539('0x8')](_0x9539('0xe'),auth[_0x9539('0x9')](),controller[_0x9539('0xf')]);router[_0x9539('0x8')](_0x9539('0x10'),auth[_0x9539('0x9')](),controller[_0x9539('0x11')]);router['get']('/:id/fields',auth[_0x9539('0x9')](),controller[_0x9539('0x12')]);router[_0x9539('0x8')](_0x9539('0x13'),auth[_0x9539('0x9')](),controller['getAgents']);router[_0x9539('0x14')]('/',auth[_0x9539('0x9')](),controller['create']);router[_0x9539('0x14')]('/:id/dispositions',auth[_0x9539('0x9')](),controller[_0x9539('0x15')]);router[_0x9539('0x14')](_0x9539('0xe'),auth[_0x9539('0x9')](),controller[_0x9539('0x16')]);router['post'](_0x9539('0x17'),auth[_0x9539('0x9')](),controller['addCustomField']);router[_0x9539('0x14')]('/:id/users',auth[_0x9539('0x9')](),controller['addAgents']);router[_0x9539('0x18')]('/:id',auth[_0x9539('0x9')](),controller[_0x9539('0x19')]);router[_0x9539('0x1a')](_0x9539('0xb'),auth[_0x9539('0x9')](),controller[_0x9539('0x1b')]);router[_0x9539('0x1a')](_0x9539('0xc'),auth[_0x9539('0x9')](),controller[_0x9539('0x1c')]);router[_0x9539('0x1a')](_0x9539('0x13'),auth[_0x9539('0x9')](),controller[_0x9539('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 5812276..d942cb2 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(_0xb40e12,_0x4b28e3){var _0x461aa0=function(_0x2308d0){while(--_0x2308d0){_0xb40e12['push'](_0xb40e12['shift']());}};_0x461aa0(++_0x4b28e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0xded4ca,_0x27c4da){var _0x1e1d84=function(_0x3bc1e1){while(--_0x3bc1e1){_0xded4ca['push'](_0xded4ca['shift']());}};_0x1e1d84(++_0x27c4da);}(_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')],'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 cfc2507..9c3d1be 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 _0x7f23=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','then','error','stack','name','update','body','Condition','find','catch','destroy'];(function(_0x1b2b51,_0x186c97){var _0x2dac3b=function(_0x48b404){while(--_0x48b404){_0x1b2b51['push'](_0x1b2b51['shift']());}};_0x2dac3b(++_0x186c97);}(_0x7f23,0x1ef));var _0x37f2=function(_0x132978,_0x1bdc98){_0x132978=_0x132978-0x0;var _0x4e61ca=_0x7f23[_0x132978];return _0x4e61ca;};'use strict';var pdf=require(_0x37f2('0x0'));var emlformat=require(_0x37f2('0x1'));var rimraf=require(_0x37f2('0x2'));var zipdir=require(_0x37f2('0x3'));var jsonpatch=require(_0x37f2('0x4'));var rp=require('request-promise');var moment=require(_0x37f2('0x5'));var BPromise=require(_0x37f2('0x6'));var Mustache=require(_0x37f2('0x7'));var util=require(_0x37f2('0x8'));var path=require(_0x37f2('0x9'));var sox=require(_0x37f2('0xa'));var csv=require('to-csv');var ejs=require(_0x37f2('0xb'));var fs=require('fs');var _=require(_0x37f2('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x37f2('0xd'));var deskjs=require(_0x37f2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x37f2('0xf'));var Papa=require(_0x37f2('0x10'));var Redis=require('ioredis');var authService=require(_0x37f2('0x11'));var qs=require(_0x37f2('0x12'));var as=require(_0x37f2('0x13'));var hardwareService=require(_0x37f2('0x14'));var logger=require(_0x37f2('0x15'))('api');var utils=require(_0x37f2('0x16'));var config=require(_0x37f2('0x17'));var db=require(_0x37f2('0x18'))['db'];function respondWithStatusCode(_0x4fb1ce,_0x126223){_0x126223=_0x126223||0xcc;return function(_0x5be982){if(_0x5be982){return _0x4fb1ce[_0x37f2('0x19')](_0x126223);}return _0x4fb1ce[_0x37f2('0x1a')](_0x126223)[_0x37f2('0x1b')]();};}function respondWithResult(_0x1b2869,_0x45c754){_0x45c754=_0x45c754||0xc8;return function(_0x375e93){if(_0x375e93){return _0x1b2869[_0x37f2('0x1a')](_0x45c754)[_0x37f2('0x1c')](_0x375e93);}};}function respondWithFilteredResult(_0x2ddf44,_0x214151){return function(_0x4a8509){if(_0x4a8509){var _0x5d2db9=_0x4a8509[_0x37f2('0x1d')],_0x23e654=_0x214151[_0x37f2('0x1e')],_0x11cc21=_0x214151[_0x37f2('0x1e')]+_0x214151[_0x37f2('0x1f')],_0x76e8bf;if(_0x11cc21>=_0x5d2db9){_0x11cc21=_0x5d2db9;_0x76e8bf=0xc8;}else{_0x76e8bf=0xce;}_0x2ddf44[_0x37f2('0x1a')](_0x76e8bf);return _0x2ddf44[_0x37f2('0x20')]('Content-Range',_0x23e654+'-'+_0x11cc21+'/'+_0x5d2db9)[_0x37f2('0x1c')](_0x4a8509);}return null;};}function patchUpdates(_0x58aded){return function(_0x1d0899){try{jsonpatch[_0x37f2('0x21')](_0x1d0899,_0x58aded,!![]);}catch(_0x395669){return BPromise['reject'](_0x395669);}return _0x1d0899[_0x37f2('0x22')]();};}function saveUpdates(_0x76f22d,_0x23c590){return function(_0x25933b){if(_0x25933b){return _0x25933b['update'](_0x76f22d)['then'](function(_0x5674ee){return _0x5674ee;});}return null;};}function removeEntity(_0x170925,_0x28e88a){return function(_0xb954ad){if(_0xb954ad){return _0xb954ad['destroy']()[_0x37f2('0x23')](function(){_0x170925[_0x37f2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x509ea9,_0x4034f3){return function(_0x39338f){if(!_0x39338f){_0x509ea9[_0x37f2('0x19')](0x194);}return _0x39338f;};}function handleError(_0x2b4109,_0x11f818){_0x11f818=_0x11f818||0x1f4;return function(_0x5dfaec){logger[_0x37f2('0x24')](_0x5dfaec[_0x37f2('0x25')]);if(_0x5dfaec[_0x37f2('0x26')]){delete _0x5dfaec[_0x37f2('0x26')];}_0x2b4109[_0x37f2('0x1a')](_0x11f818)['send'](_0x5dfaec);};}exports[_0x37f2('0x27')]=function(_0x728d52,_0x45f2a3){if(_0x728d52[_0x37f2('0x28')]['id']){delete _0x728d52[_0x37f2('0x28')]['id'];}return db[_0x37f2('0x29')][_0x37f2('0x2a')]({'where':{'id':_0x728d52['params']['id']}})['then'](handleEntityNotFound(_0x45f2a3,null))[_0x37f2('0x23')](saveUpdates(_0x728d52['body'],null))[_0x37f2('0x23')](respondWithResult(_0x45f2a3,null))[_0x37f2('0x2b')](handleError(_0x45f2a3,null));};exports[_0x37f2('0x2c')]=function(_0x8cd54e,_0x1b2ae2){return db['Condition'][_0x37f2('0x2a')]({'where':{'id':_0x8cd54e['params']['id']}})[_0x37f2('0x23')](handleEntityNotFound(_0x1b2ae2,null))[_0x37f2('0x23')](removeEntity(_0x1b2ae2,null))['catch'](handleError(_0x1b2ae2,null));}; \ No newline at end of file +var _0xf29f=['then','destroy','error','name','send','body','Condition','find','params','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update'];(function(_0x16946a,_0x23903d){var _0x516509=function(_0x56e12e){while(--_0x56e12e){_0x16946a['push'](_0x16946a['shift']());}};_0x516509(++_0x23903d);}(_0xf29f,0x18d));var _0xff29=function(_0xc8e52b,_0x4c0db8){_0xc8e52b=_0xc8e52b-0x0;var _0x41b72e=_0xf29f[_0xc8e52b];return _0x41b72e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xff29('0x0'));var rimraf=require(_0xff29('0x1'));var zipdir=require(_0xff29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff29('0x3'));var moment=require(_0xff29('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xff29('0x5'));var util=require(_0xff29('0x6'));var path=require('path');var sox=require(_0xff29('0x7'));var csv=require(_0xff29('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xff29('0x9'));var crypto=require('crypto');var jsforce=require(_0xff29('0xa'));var deskjs=require(_0xff29('0xb'));var toCsv=require(_0xff29('0x8'));var querystring=require(_0xff29('0xc'));var Papa=require(_0xff29('0xd'));var Redis=require(_0xff29('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xff29('0xf'));var hardwareService=require(_0xff29('0x10'));var logger=require(_0xff29('0x11'))(_0xff29('0x12'));var utils=require(_0xff29('0x13'));var config=require(_0xff29('0x14'));var db=require(_0xff29('0x15'))['db'];function respondWithStatusCode(_0x45750e,_0x18c3f2){_0x18c3f2=_0x18c3f2||0xcc;return function(_0x1f4a9c){if(_0x1f4a9c){return _0x45750e[_0xff29('0x16')](_0x18c3f2);}return _0x45750e[_0xff29('0x17')](_0x18c3f2)[_0xff29('0x18')]();};}function respondWithResult(_0x6fc0a5,_0x284823){_0x284823=_0x284823||0xc8;return function(_0x518c75){if(_0x518c75){return _0x6fc0a5[_0xff29('0x17')](_0x284823)[_0xff29('0x19')](_0x518c75);}};}function respondWithFilteredResult(_0x4c458c,_0x2228fb){return function(_0xbd98f5){if(_0xbd98f5){var _0x24567d=_0xbd98f5[_0xff29('0x1a')],_0x2d633b=_0x2228fb[_0xff29('0x1b')],_0x197034=_0x2228fb[_0xff29('0x1b')]+_0x2228fb[_0xff29('0x1c')],_0x438518;if(_0x197034>=_0x24567d){_0x197034=_0x24567d;_0x438518=0xc8;}else{_0x438518=0xce;}_0x4c458c[_0xff29('0x17')](_0x438518);return _0x4c458c['set'](_0xff29('0x1d'),_0x2d633b+'-'+_0x197034+'/'+_0x24567d)[_0xff29('0x19')](_0xbd98f5);}return null;};}function patchUpdates(_0x41fbaa){return function(_0x115c19){try{jsonpatch[_0xff29('0x1e')](_0x115c19,_0x41fbaa,!![]);}catch(_0x566843){return BPromise['reject'](_0x566843);}return _0x115c19[_0xff29('0x1f')]();};}function saveUpdates(_0x26f301,_0x202748){return function(_0x43f2b6){if(_0x43f2b6){return _0x43f2b6[_0xff29('0x20')](_0x26f301)[_0xff29('0x21')](function(_0x322d11){return _0x322d11;});}return null;};}function removeEntity(_0x32cc78,_0x2ccbb0){return function(_0x33612d){if(_0x33612d){return _0x33612d[_0xff29('0x22')]()[_0xff29('0x21')](function(){_0x32cc78[_0xff29('0x17')](0xcc)[_0xff29('0x18')]();});}};}function handleEntityNotFound(_0x39f505,_0x331de6){return function(_0x2b157d){if(!_0x2b157d){_0x39f505['sendStatus'](0x194);}return _0x2b157d;};}function handleError(_0x21b7f3,_0x15cd08){_0x15cd08=_0x15cd08||0x1f4;return function(_0x597ebb){logger[_0xff29('0x23')](_0x597ebb['stack']);if(_0x597ebb['name']){delete _0x597ebb[_0xff29('0x24')];}_0x21b7f3['status'](_0x15cd08)[_0xff29('0x25')](_0x597ebb);};}exports[_0xff29('0x20')]=function(_0x3215c1,_0xdbe40b){if(_0x3215c1[_0xff29('0x26')]['id']){delete _0x3215c1['body']['id'];}return db[_0xff29('0x27')][_0xff29('0x28')]({'where':{'id':_0x3215c1[_0xff29('0x29')]['id']}})[_0xff29('0x21')](handleEntityNotFound(_0xdbe40b,null))[_0xff29('0x21')](saveUpdates(_0x3215c1[_0xff29('0x26')],null))[_0xff29('0x21')](respondWithResult(_0xdbe40b,null))[_0xff29('0x2a')](handleError(_0xdbe40b,null));};exports[_0xff29('0x22')]=function(_0x41dfc9,_0x3f79fa){return db[_0xff29('0x27')][_0xff29('0x28')]({'where':{'id':_0x41dfc9['params']['id']}})[_0xff29('0x21')](handleEntityNotFound(_0x3f79fa,null))[_0xff29('0x21')](removeEntity(_0x3f79fa,null))[_0xff29('0x2a')](handleError(_0x3f79fa,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 8c564ef..4f46da1 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 _0x3771=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','Condition','lodash'];(function(_0x4bd7c4,_0x2af68e){var _0x323c27=function(_0x1d7e8e){while(--_0x1d7e8e){_0x4bd7c4['push'](_0x4bd7c4['shift']());}};_0x323c27(++_0x2af68e);}(_0x3771,0x155));var _0x1377=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x3771[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x1377('0x0'));var util=require(_0x1377('0x1'));var logger=require(_0x1377('0x2'))(_0x1377('0x3'));var moment=require(_0x1377('0x4'));var BPromise=require(_0x1377('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1377('0x6'));var config=require(_0x1377('0x7'));var attributes=require('./condition.attributes');module['exports']=function(_0x44dfc6,_0x51f335){return _0x44dfc6['define'](_0x1377('0x8'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23f5=['define','Condition','tools_conditions','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x35639c,_0xfba17c){var _0x1ca47a=function(_0x523339){while(--_0x523339){_0x35639c['push'](_0x35639c['shift']());}};_0x1ca47a(++_0xfba17c);}(_0x23f5,0xb3));var _0x523f=function(_0x3124f8,_0x1a8b23){_0x3124f8=_0x3124f8-0x0;var _0x5bab5f=_0x23f5[_0x3124f8];return _0x5bab5f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x523f('0x0'))(_0x523f('0x1'));var moment=require(_0x523f('0x2'));var BPromise=require('bluebird');var rp=require(_0x523f('0x3'));var fs=require('fs');var path=require(_0x523f('0x4'));var rimraf=require(_0x523f('0x5'));var config=require(_0x523f('0x6'));var attributes=require('./condition.attributes');module[_0x523f('0x7')]=function(_0x11eb16,_0x58d541){return _0x11eb16[_0x523f('0x8')](_0x523f('0x9'),attributes,{'tableName':_0x523f('0xa'),'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 0ec6ecf..3988a3b 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 _0x815f=['Condition,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','client','http','request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code'];(function(_0xdda98,_0x40508d){var _0x1fe0c0=function(_0x49c853){while(--_0x49c853){_0xdda98['push'](_0xdda98['shift']());}};_0x1fe0c0(++_0x40508d);}(_0x815f,0x11f));var _0xf815=function(_0x36bfe3,_0x358938){_0x36bfe3=_0x36bfe3-0x0;var _0x9b0436=_0x815f[_0x36bfe3];return _0x9b0436;};'use strict';var _=require(_0xf815('0x0'));var util=require(_0xf815('0x1'));var moment=require(_0xf815('0x2'));var BPromise=require(_0xf815('0x3'));var rs=require(_0xf815('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf815('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf815('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf815('0x7')][_0xf815('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c576d,_0x3f9db5,_0x252613){return new BPromise(function(_0x12f846,_0x3a1661){return client[_0xf815('0x9')](_0x3c576d,_0x252613)[_0xf815('0xa')](function(_0x29e3cc){logger[_0xf815('0xb')]('Condition,\x20%s,\x20%s',_0x3f9db5,_0xf815('0xc'));logger[_0xf815('0xd')](_0xf815('0xe'),_0x3f9db5,_0xf815('0xc'),JSON['stringify'](_0x29e3cc));if(_0x29e3cc[_0xf815('0xf')]){if(_0x29e3cc[_0xf815('0xf')][_0xf815('0x10')]===0x1f4){logger[_0xf815('0xf')](_0xf815('0x11'),_0x3f9db5,_0x29e3cc['error'][_0xf815('0x12')]);return _0x3a1661(_0x29e3cc[_0xf815('0xf')]['message']);}logger[_0xf815('0xf')](_0xf815('0x11'),_0x3f9db5,_0x29e3cc['error'][_0xf815('0x12')]);return _0x12f846(_0x29e3cc[_0xf815('0xf')][_0xf815('0x12')]);}else{logger[_0xf815('0xb')](_0xf815('0x11'),_0x3f9db5,'request\x20sent');_0x12f846(_0x29e3cc['result']['message']);}})['catch'](function(_0xff63e7){logger[_0xf815('0xf')]('Condition,\x20%s,\x20%s',_0x3f9db5,_0xff63e7);_0x3a1661(_0xff63e7);});});} \ No newline at end of file +var _0xadf2=['../../config/environment','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xadf2,0xb5));var _0x2adf=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xadf2[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0x2adf('0x0'));var util=require(_0x2adf('0x1'));var moment=require(_0x2adf('0x2'));var BPromise=require(_0x2adf('0x3'));var rs=require(_0x2adf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2adf('0x5'));var logger=require(_0x2adf('0x6'))(_0x2adf('0x7'));var config=require(_0x2adf('0x8'));var jayson=require(_0x2adf('0x9'));var client=jayson['client'][_0x2adf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x446214,_0x32fc9f,_0x385c9d){return new BPromise(function(_0x3e1d75,_0xc3d5f2){return client[_0x2adf('0xb')](_0x446214,_0x385c9d)[_0x2adf('0xc')](function(_0x1e902a){logger[_0x2adf('0xd')](_0x2adf('0xe'),_0x32fc9f,_0x2adf('0xf'));logger[_0x2adf('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x32fc9f,_0x2adf('0xf'),JSON['stringify'](_0x1e902a));if(_0x1e902a[_0x2adf('0x11')]){if(_0x1e902a[_0x2adf('0x11')]['code']===0x1f4){logger[_0x2adf('0x11')](_0x2adf('0xe'),_0x32fc9f,_0x1e902a[_0x2adf('0x11')][_0x2adf('0x12')]);return _0xc3d5f2(_0x1e902a[_0x2adf('0x11')]['message']);}logger[_0x2adf('0x11')]('Condition,\x20%s,\x20%s',_0x32fc9f,_0x1e902a[_0x2adf('0x11')][_0x2adf('0x12')]);return _0x3e1d75(_0x1e902a[_0x2adf('0x11')][_0x2adf('0x12')]);}else{logger['info'](_0x2adf('0xe'),_0x32fc9f,_0x2adf('0xf'));_0x3e1d75(_0x1e902a[_0x2adf('0x13')][_0x2adf('0x12')]);}})[_0x2adf('0x14')](function(_0x45adec){logger[_0x2adf('0x11')](_0x2adf('0xe'),_0x32fc9f,_0x45adec);_0xc3d5f2(_0x45adec);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 2a5d4ae..fe1ad8d 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 _0x26ff=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','put'];(function(_0x2a9dcf,_0x4939b1){var _0x46560e=function(_0x193f0a){while(--_0x193f0a){_0x2a9dcf['push'](_0x2a9dcf['shift']());}};_0x46560e(++_0x4939b1);}(_0x26ff,0x1b3));var _0xf26f=function(_0x489f67,_0x3553ce){_0x489f67=_0x489f67-0x0;var _0xf07801=_0x26ff[_0x489f67];return _0xf07801;};'use strict';var multer=require(_0xf26f('0x0'));var util=require(_0xf26f('0x1'));var path=require(_0xf26f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf26f('0x3')]();var auth=require(_0xf26f('0x4'));var interaction=require(_0xf26f('0x5'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0xf26f('0x6')](_0xf26f('0x7'),auth[_0xf26f('0x8')](),controller[_0xf26f('0x9')]);router[_0xf26f('0xa')](_0xf26f('0x7'),auth[_0xf26f('0x8')](),controller[_0xf26f('0xb')]);module[_0xf26f('0xc')]=router; \ No newline at end of file +var _0xd0af=['../../components/auth/service','../../components/interaction/service','./condition.controller','put','isAuthenticated','update','/:id','exports','path','express','Router'];(function(_0x35c2ea,_0x4a1870){var _0xebb387=function(_0x36de58){while(--_0x36de58){_0x35c2ea['push'](_0x35c2ea['shift']());}};_0xebb387(++_0x4a1870);}(_0xd0af,0x13c));var _0xfd0a=function(_0x384447,_0x41669a){_0x384447=_0x384447-0x0;var _0x3810db=_0xd0af[_0x384447];return _0x3810db;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfd0a('0x0'));var timeout=require('connect-timeout');var express=require(_0xfd0a('0x1'));var router=express[_0xfd0a('0x2')]();var auth=require(_0xfd0a('0x3'));var interaction=require(_0xfd0a('0x4'));var config=require('../../config/environment');var controller=require(_0xfd0a('0x5'));router[_0xfd0a('0x6')]('/:id',auth[_0xfd0a('0x7')](),controller[_0xfd0a('0x8')]);router['delete'](_0xfd0a('0x9'),auth[_0xfd0a('0x7')](),controller['destroy']);module[_0xfd0a('0xa')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index e64fb4b..322df21 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 _0x5410=['name','exports','STRING'];(function(_0x2cc9c8,_0x19bbe8){var _0x5eefb7=function(_0x559f1a){while(--_0x559f1a){_0x2cc9c8['push'](_0x2cc9c8['shift']());}};_0x5eefb7(++_0x19bbe8);}(_0x5410,0xa0));var _0x0541=function(_0x5e0b14,_0x5dbd82){_0x5e0b14=_0x5e0b14-0x0;var _0x23428e=_0x5410[_0x5e0b14];return _0x23428e;};'use strict';var Sequelize=require('sequelize');module[_0x0541('0x0')]={'name':{'type':Sequelize[_0x0541('0x1')],'allowNull':![],'unique':_0x0541('0x2')},'description':{'type':Sequelize[_0x0541('0x1')]}}; \ No newline at end of file +var _0x872f=['exports','STRING','name','sequelize'];(function(_0x382c95,_0x3aed3d){var _0x38e393=function(_0x12575c){while(--_0x12575c){_0x382c95['push'](_0x382c95['shift']());}};_0x38e393(++_0x3aed3d);}(_0x872f,0x143));var _0xf872=function(_0x3a7257,_0x30b139){_0x3a7257=_0x3a7257-0x0;var _0x467d25=_0x872f[_0x3a7257];return _0x467d25;};'use strict';var Sequelize=require(_0xf872('0x0'));module[_0xf872('0x1')]={'name':{'type':Sequelize[_0xf872('0x2')],'allowNull':![],'unique':_0xf872('0x3')},'description':{'type':Sequelize[_0xf872('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b08ac59..fc8ece1 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 _0xcea2=['../../config/logger','api','../../mysqldb','redis','localhost','./dashboard.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','filters','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','fields','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','sort','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x185ae9,_0x4381c7){var _0x4ea424=function(_0x205d80){while(--_0x205d80){_0x185ae9['push'](_0x185ae9['shift']());}};_0x4ea424(++_0x4381c7);}(_0xcea2,0x15a));var _0x2cea=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xcea2[_0x47aa64];return _0x549c7a;};'use strict';var pdf=require(_0x2cea('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2cea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2cea('0x2'));var rp=require(_0x2cea('0x3'));var moment=require(_0x2cea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2cea('0x5'));var util=require(_0x2cea('0x6'));var path=require(_0x2cea('0x7'));var sox=require('sox');var csv=require(_0x2cea('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2cea('0x9'));var squel=require(_0x2cea('0xa'));var crypto=require(_0x2cea('0xb'));var jsforce=require(_0x2cea('0xc'));var deskjs=require(_0x2cea('0xd'));var toCsv=require(_0x2cea('0x8'));var querystring=require('querystring');var Papa=require(_0x2cea('0xe'));var Redis=require(_0x2cea('0xf'));var authService=require(_0x2cea('0x10'));var qs=require(_0x2cea('0x11'));var as=require(_0x2cea('0x12'));var hardwareService=require(_0x2cea('0x13'));var logger=require(_0x2cea('0x14'))(_0x2cea('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2cea('0x16'))['db'];config[_0x2cea('0x17')]=_['defaults'](config['redis'],{'host':_0x2cea('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2cea('0x17')]));require(_0x2cea('0x19'))[_0x2cea('0x1a')](socket);function respondWithStatusCode(_0x5cf805,_0x4d7f8b){_0x4d7f8b=_0x4d7f8b||0xcc;return function(_0x578c3e){if(_0x578c3e){return _0x5cf805[_0x2cea('0x1b')](_0x4d7f8b);}return _0x5cf805['status'](_0x4d7f8b)[_0x2cea('0x1c')]();};}function respondWithResult(_0x338669,_0x981e3f){_0x981e3f=_0x981e3f||0xc8;return function(_0x17322c){if(_0x17322c){return _0x338669[_0x2cea('0x1d')](_0x981e3f)[_0x2cea('0x1e')](_0x17322c);}};}function respondWithFilteredResult(_0x3530d7,_0x1ead4c){return function(_0x5eee09){if(_0x5eee09){var _0x19927a=_0x5eee09[_0x2cea('0x1f')],_0x464f7d=_0x1ead4c[_0x2cea('0x20')],_0x20c46c=_0x1ead4c['offset']+_0x1ead4c[_0x2cea('0x21')],_0x43ae15;if(_0x20c46c>=_0x19927a){_0x20c46c=_0x19927a;_0x43ae15=0xc8;}else{_0x43ae15=0xce;}_0x3530d7['status'](_0x43ae15);return _0x3530d7[_0x2cea('0x22')](_0x2cea('0x23'),_0x464f7d+'-'+_0x20c46c+'/'+_0x19927a)[_0x2cea('0x1e')](_0x5eee09);}return null;};}function patchUpdates(_0x4fd3d5){return function(_0x46a112){try{jsonpatch[_0x2cea('0x24')](_0x46a112,_0x4fd3d5,!![]);}catch(_0x210d7e){return BPromise[_0x2cea('0x25')](_0x210d7e);}return _0x46a112[_0x2cea('0x26')]();};}function saveUpdates(_0x3f6f0e,_0x10f13a){return function(_0x566ce2){if(_0x566ce2){return _0x566ce2[_0x2cea('0x27')](_0x3f6f0e)['then'](function(_0x7d88b9){return _0x7d88b9;});}return null;};}function removeEntity(_0x4926ff,_0x3966d5){return function(_0x18a394){if(_0x18a394){return _0x18a394['destroy']()[_0x2cea('0x28')](function(){var _0xd4bd54=_0x18a394[_0x2cea('0x29')]({'plain':!![]});var _0xf0bfbe=_0x2cea('0x2a');return db[_0x2cea('0x2b')]['destroy']({'where':{'type':_0xf0bfbe,'resourceId':_0xd4bd54['id']}})[_0x2cea('0x28')](function(){return _0x18a394;});})[_0x2cea('0x28')](function(){_0x4926ff[_0x2cea('0x1d')](0xcc)[_0x2cea('0x1c')]();});}};}function handleEntityNotFound(_0x46ef5a,_0x3ea40c){return function(_0xe99cca){if(!_0xe99cca){_0x46ef5a[_0x2cea('0x1b')](0x194);}return _0xe99cca;};}function handleError(_0x4e9cab,_0xff69ad){_0xff69ad=_0xff69ad||0x1f4;return function(_0x128863){logger['error'](_0x128863[_0x2cea('0x2c')]);if(_0x128863[_0x2cea('0x2d')]){delete _0x128863[_0x2cea('0x2d')];}_0x4e9cab[_0x2cea('0x1d')](_0xff69ad)['send'](_0x128863);};}exports[_0x2cea('0x2e')]=function(_0x128934,_0x4a51e5){var _0x2bf4e9={},_0x2e3d44={},_0xa8f660={'count':0x0,'rows':[]};var _0x393d30=_[_0x2cea('0x2f')](db[_0x2cea('0x30')][_0x2cea('0x31')],function(_0x3d1ea2){return{'name':_0x3d1ea2[_0x2cea('0x32')],'type':_0x3d1ea2[_0x2cea('0x33')][_0x2cea('0x34')]};});_0x2e3d44['model']=_[_0x2cea('0x2f')](_0x393d30,_0x2cea('0x2d'));_0x2e3d44[_0x2cea('0x35')]=_[_0x2cea('0x36')](_0x128934['query']);_0x2e3d44['filters']=_[_0x2cea('0x37')](_0x2e3d44[_0x2cea('0x38')],_0x2e3d44['query']);_0x2bf4e9[_0x2cea('0x39')]=_['intersection'](_0x2e3d44[_0x2cea('0x38')],qs['fields'](_0x128934[_0x2cea('0x35')]['fields']));_0x2bf4e9[_0x2cea('0x39')]=_0x2bf4e9[_0x2cea('0x39')]['length']?_0x2bf4e9[_0x2cea('0x39')]:_0x2e3d44[_0x2cea('0x38')];if(!_0x128934['query'][_0x2cea('0x3a')](_0x2cea('0x3b'))){_0x2bf4e9[_0x2cea('0x21')]=qs[_0x2cea('0x21')](_0x128934[_0x2cea('0x35')]['limit']);_0x2bf4e9[_0x2cea('0x20')]=qs[_0x2cea('0x20')](_0x128934['query']['offset']);}_0x2bf4e9[_0x2cea('0x3c')]=qs['sort'](_0x128934['query']['sort']);_0x2bf4e9['where']=qs[_0x2cea('0x3d')](_[_0x2cea('0x3e')](_0x128934['query'],_0x2e3d44[_0x2cea('0x3d')]));if(_0x128934[_0x2cea('0x35')][_0x2cea('0x3f')]){_0x2bf4e9['where']=_[_0x2cea('0x40')](_0x2bf4e9[_0x2cea('0x41')],{'$or':_[_0x2cea('0x2f')](_0x393d30,function(_0x37d175){if(_0x37d175[_0x2cea('0x33')]!==_0x2cea('0x42')){var _0x3afee0={};_0x3afee0[_0x37d175[_0x2cea('0x2d')]]={'$like':'%'+_0x128934[_0x2cea('0x35')][_0x2cea('0x3f')]+'%'};return _0x3afee0;}})});}_0x2bf4e9=_[_0x2cea('0x40')]({},_0x2bf4e9,_0x128934[_0x2cea('0x43')]);var _0x370190={'where':_0x2bf4e9[_0x2cea('0x41')]};return db[_0x2cea('0x30')][_0x2cea('0x1f')](_0x370190)[_0x2cea('0x28')](function(_0xa0692d){_0xa8f660['count']=_0xa0692d;if(_0x128934[_0x2cea('0x35')]['includeAll']){_0x2bf4e9[_0x2cea('0x44')]=[{'all':!![]}];}return db[_0x2cea('0x30')][_0x2cea('0x45')](_0x2bf4e9);})[_0x2cea('0x28')](function(_0x2c703b){_0xa8f660[_0x2cea('0x46')]=_0x2c703b;return _0xa8f660;})[_0x2cea('0x28')](respondWithFilteredResult(_0x4a51e5,_0x2bf4e9))[_0x2cea('0x47')](handleError(_0x4a51e5,null));};exports[_0x2cea('0x48')]=function(_0x2aba98,_0x4ac055){var _0x515494={'raw':![],'where':{'id':_0x2aba98[_0x2cea('0x49')]['id']}},_0x1be683={};_0x1be683['model']=_[_0x2cea('0x36')](db['Dashboard'][_0x2cea('0x31')]);_0x1be683['query']=_[_0x2cea('0x36')](_0x2aba98[_0x2cea('0x35')]);_0x1be683[_0x2cea('0x3d')]=_[_0x2cea('0x37')](_0x1be683[_0x2cea('0x38')],_0x1be683[_0x2cea('0x35')]);_0x515494[_0x2cea('0x39')]=_[_0x2cea('0x37')](_0x1be683[_0x2cea('0x38')],qs[_0x2cea('0x4a')](_0x2aba98['query'][_0x2cea('0x4a')]));_0x515494[_0x2cea('0x39')]=_0x515494[_0x2cea('0x39')][_0x2cea('0x4b')]?_0x515494['attributes']:_0x1be683['model'];if(_0x2aba98[_0x2cea('0x35')][_0x2cea('0x4c')]){_0x515494[_0x2cea('0x44')]=[{'all':!![]}];}_0x515494=_['merge']({},_0x515494,_0x2aba98[_0x2cea('0x43')]);return db[_0x2cea('0x30')][_0x2cea('0x4d')](_0x515494)[_0x2cea('0x28')](handleEntityNotFound(_0x4ac055,null))['then'](respondWithResult(_0x4ac055,null))[_0x2cea('0x47')](handleError(_0x4ac055,null));};exports['create']=function(_0x4d1b77,_0x42379a){return db[_0x2cea('0x30')][_0x2cea('0x4e')](_0x4d1b77[_0x2cea('0x4f')],{})['then'](function(_0x492fcf){var _0x3c8ede=_0x4d1b77[_0x2cea('0x50')][_0x2cea('0x29')]({'plain':!![]});if(!_0x3c8ede)throw new Error(_0x2cea('0x51'));if(_0x3c8ede['role']==='user'){var _0x5d7cb6=_0x492fcf[_0x2cea('0x29')]({'plain':!![]});var _0x3e7d11=_0x2cea('0x2a');return db[_0x2cea('0x52')][_0x2cea('0x4d')]({'where':{'name':_0x3e7d11,'userProfileId':_0x3c8ede[_0x2cea('0x53')]},'raw':!![]})[_0x2cea('0x28')](function(_0x4d31dc){if(_0x4d31dc&&_0x4d31dc[_0x2cea('0x54')]===0x0){return db[_0x2cea('0x2b')][_0x2cea('0x4e')]({'name':_0x5d7cb6['name'],'resourceId':_0x5d7cb6['id'],'type':_0x4d31dc[_0x2cea('0x2d')],'sectionId':_0x4d31dc['id']},{})['then'](function(){return _0x492fcf;});}else{return _0x492fcf;}})[_0x2cea('0x47')](function(_0x115b1a){logger[_0x2cea('0x55')](_0x2cea('0x56'),_0x115b1a);throw _0x115b1a;});}return _0x492fcf;})[_0x2cea('0x28')](respondWithResult(_0x42379a,0xc9))[_0x2cea('0x47')](handleError(_0x42379a,null));};exports[_0x2cea('0x57')]=function(_0x326fb2,_0x5b6baf){var _0x2a4148={'where':{'id':_0x326fb2[_0x2cea('0x49')]['id']}},_0x4e3a08={};_0x4e3a08[_0x2cea('0x38')]=_[_0x2cea('0x36')](db['Dashboard'][_0x2cea('0x31')]);_0x2a4148['attributes']=_['intersection'](_0x4e3a08[_0x2cea('0x38')],qs[_0x2cea('0x4a')](_0x326fb2[_0x2cea('0x35')][_0x2cea('0x4a')]));_0x2a4148[_0x2cea('0x39')]=_0x2a4148['attributes']['length']?_0x2a4148[_0x2cea('0x39')]:_0x4e3a08[_0x2cea('0x38')];if(_0x326fb2[_0x2cea('0x35')][_0x2cea('0x4c')]){_0x2a4148['include']=[{'all':!![]}];}_0x2a4148=_[_0x2cea('0x40')]({},_0x2a4148,_0x326fb2['options']);return db[_0x2cea('0x30')][_0x2cea('0x4d')](_0x2a4148)[_0x2cea('0x28')](handleEntityNotFound(_0x5b6baf,null))[_0x2cea('0x28')](function(_0x221c16){if(_0x221c16){var _0x50adbe=_0x221c16[_0x2cea('0x29')]({'plain':!![]});_0x50adbe=qs[_0x2cea('0x58')](_0x50adbe,['id',_0x2cea('0x59'),_0x2cea('0x5a')]);_0x326fb2[_0x2cea('0x4f')]=_['omit'](_0x326fb2[_0x2cea('0x4f')],['id',_0x2cea('0x59'),'updatedAt']);return db[_0x2cea('0x30')][_0x2cea('0x4e')](_[_0x2cea('0x40')](_0x50adbe,_0x326fb2[_0x2cea('0x4f')]),{'include':_0x326fb2['query']['includeAll']?[{'all':!![]}]:undefined})[_0x2cea('0x28')](function(_0x29e861){var _0x4c0b3f=_0x326fb2[_0x2cea('0x50')][_0x2cea('0x29')]({'plain':!![]});if(!_0x4c0b3f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c0b3f[_0x2cea('0x5b')]===_0x2cea('0x50')){var _0x82198=_0x29e861[_0x2cea('0x29')]({'plain':!![]});var _0x14daae='CustomDashboards';return db[_0x2cea('0x52')][_0x2cea('0x4d')]({'where':{'name':_0x14daae,'userProfileId':_0x4c0b3f['userProfileId']},'raw':!![]})[_0x2cea('0x28')](function(_0x1ee8bc){if(_0x1ee8bc&&_0x1ee8bc[_0x2cea('0x54')]===0x0){return db[_0x2cea('0x2b')][_0x2cea('0x4e')]({'name':_0x82198[_0x2cea('0x2d')],'resourceId':_0x82198['id'],'type':_0x1ee8bc[_0x2cea('0x2d')],'sectionId':_0x1ee8bc['id']},{})[_0x2cea('0x28')](function(){return _0x29e861;});}else{return _0x29e861;}})[_0x2cea('0x47')](function(_0x225d1b){logger[_0x2cea('0x55')](_0x2cea('0x56'),_0x225d1b);throw _0x225d1b;});}return _0x29e861;});}})[_0x2cea('0x28')](respondWithResult(_0x5b6baf,0xc9))['catch'](handleError(_0x5b6baf,null));};exports['update']=function(_0x1364c3,_0x2a00cc){if(_0x1364c3[_0x2cea('0x4f')]['id']){delete _0x1364c3[_0x2cea('0x4f')]['id'];}return db[_0x2cea('0x30')][_0x2cea('0x4d')]({'where':{'id':_0x1364c3[_0x2cea('0x49')]['id']}})['then'](handleEntityNotFound(_0x2a00cc,null))['then'](saveUpdates(_0x1364c3[_0x2cea('0x4f')],null))[_0x2cea('0x28')](respondWithResult(_0x2a00cc,null))[_0x2cea('0x47')](handleError(_0x2a00cc,null));};exports['destroy']=function(_0x4e00b6,_0x51a2f5){return db[_0x2cea('0x30')][_0x2cea('0x4d')]({'where':{'id':_0x4e00b6['params']['id']}})['then'](handleEntityNotFound(_0x51a2f5,null))[_0x2cea('0x28')](removeEntity(_0x51a2f5,null))[_0x2cea('0x47')](handleError(_0x51a2f5,null));};function widgetAttributes(_0x77f341){try{switch(_0x77f341[_0x2cea('0x33')]){case _0x2cea('0x5c'):return[{'name':_0x2cea('0x5d'),'value':_0x77f341[_0x2cea('0x5d')]||(_0x77f341[_0x2cea('0x5e')]&&_0x77f341['attrs'][0x0]?_0x77f341[_0x2cea('0x5e')][0x0][_0x2cea('0x5f')]:undefined)||_0x2cea('0x60')}];case _0x2cea('0x61'):return[{'name':_0x2cea('0x62'),'value':_0x77f341['attrPath']||(_0x77f341[_0x2cea('0x5e')]&&_0x77f341[_0x2cea('0x5e')][0x0]?_0x77f341['attrs'][0x0][_0x2cea('0x5f')]:undefined)||''}];case _0x2cea('0x63'):return[{'name':_0x2cea('0x64'),'value':_0x77f341[_0x2cea('0x64')]||(_0x77f341['attrs']&&_0x77f341[_0x2cea('0x5e')][0x0]?_0x77f341[_0x2cea('0x5e')][0x0][_0x2cea('0x5f')]:undefined)||'HH:mm:ss'},{'name':_0x2cea('0x65'),'value':_0x77f341[_0x2cea('0x65')]||(_0x77f341[_0x2cea('0x5e')]&&_0x77f341[_0x2cea('0x5e')][0x1]?_0x77f341[_0x2cea('0x5e')][0x1][_0x2cea('0x5f')]:undefined)||_0x2cea('0x66')},{'name':_0x2cea('0x67'),'value':_0x77f341[_0x2cea('0x67')]||(_0x77f341['attrs']&&_0x77f341[_0x2cea('0x5e')][0x2]?_0x77f341[_0x2cea('0x5e')][0x2][_0x2cea('0x5f')]:undefined)||0xc}];case _0x2cea('0x68'):return[{'name':'attrMetric','value':_0x77f341[_0x2cea('0x69')]||(_0x77f341[_0x2cea('0x5e')]&&_0x77f341[_0x2cea('0x5e')][0x0]?_0x77f341[_0x2cea('0x5e')][0x0]['value']:undefined)||_0x2cea('0x6a')},{'name':_0x2cea('0x6b'),'value':_0x77f341[_0x2cea('0x6b')]||(_0x77f341[_0x2cea('0x5e')]&&_0x77f341[_0x2cea('0x5e')][0x1]?_0x77f341[_0x2cea('0x5e')][0x1][_0x2cea('0x5f')]:undefined)||[]},{'name':_0x2cea('0x67'),'value':_0x77f341[_0x2cea('0x67')]||(_0x77f341[_0x2cea('0x5e')]&&_0x77f341[_0x2cea('0x5e')][0x2]?_0x77f341[_0x2cea('0x5e')][0x2][_0x2cea('0x5f')]:undefined)||0x14}];case _0x2cea('0x6c'):case'pie-chart':return[{'name':_0x2cea('0x6d'),'value':_0x77f341['attrSerie1']||(_0x77f341[_0x2cea('0x5e')]&&_0x77f341[_0x2cea('0x5e')][0x0]?_0x77f341[_0x2cea('0x5e')][0x0][_0x2cea('0x5f')]:undefined)||_0x2cea('0x6a')},{'name':'attrSerie2','value':_0x77f341[_0x2cea('0x6e')]||(_0x77f341['attrs']&&_0x77f341['attrs'][0x1]?_0x77f341[_0x2cea('0x5e')][0x1][_0x2cea('0x5f')]:undefined)||null},{'name':_0x2cea('0x6f'),'value':_0x77f341['attrSerie3']||(_0x77f341[_0x2cea('0x5e')]&&_0x77f341[_0x2cea('0x5e')][0x2]?_0x77f341[_0x2cea('0x5e')][0x2][_0x2cea('0x5f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x77f341[_0x2cea('0x6b')]||(_0x77f341[_0x2cea('0x5e')]&&_0x77f341['attrs'][0x3]?_0x77f341[_0x2cea('0x5e')][0x3][_0x2cea('0x5f')]:undefined)||[]}];case _0x2cea('0x70'):return[{'name':_0x2cea('0x71'),'type':_0x77f341['reportType']||(_0x77f341[_0x2cea('0x5e')]&&_0x77f341['attrs'][0x0]?_0x77f341[_0x2cea('0x5e')][0x0][_0x2cea('0x33')]:undefined)||null,'value':_0x77f341[_0x2cea('0x71')]||(_0x77f341[_0x2cea('0x5e')]&&_0x77f341[_0x2cea('0x5e')][0x0]?_0x77f341[_0x2cea('0x5e')][0x0][_0x2cea('0x5f')]:undefined)||null},{'name':_0x2cea('0x72'),'value':_0x77f341[_0x2cea('0x72')]||(_0x77f341[_0x2cea('0x5e')]&&_0x77f341[_0x2cea('0x5e')][0x1]?_0x77f341[_0x2cea('0x5e')][0x1][_0x2cea('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x2f3993){logger[_0x2cea('0x55')](_0x2cea('0x73'),JSON[_0x2cea('0x74')](_0x2f3993));return[];}}exports[_0x2cea('0x75')]=function(_0x3e5ddf,_0x3843fd,_0x3ee973){if(_0x3e5ddf['body']['id']){delete _0x3e5ddf[_0x2cea('0x4f')]['id'];}return db[_0x2cea('0x30')][_0x2cea('0x4d')]({'where':{'id':_0x3e5ddf['params']['id']}})[_0x2cea('0x28')](handleEntityNotFound(_0x3843fd,null))[_0x2cea('0x28')](function(_0x8e941b){if(_0x8e941b){_0x3e5ddf[_0x2cea('0x4f')][_0x2cea('0x76')]=_0x8e941b['id'];_0x3e5ddf['body']['attrs']=widgetAttributes(_0x3e5ddf['body']);return db['DashboardItem'][_0x2cea('0x4e')](_0x3e5ddf['body']);}})[_0x2cea('0x28')](respondWithResult(_0x3843fd,null))['catch'](handleError(_0x3843fd,null));};exports[_0x2cea('0x77')]=function(_0x1abeeb,_0x77794,_0x14d7bb){var _0x5e9c7e={};var _0x40a827={};var _0x535268;var _0x401fdb;return db[_0x2cea('0x30')][_0x2cea('0x78')]({'where':{'id':_0x1abeeb[_0x2cea('0x49')]['id']}})[_0x2cea('0x28')](handleEntityNotFound(_0x77794,null))['then'](function(_0x38cec2){if(_0x38cec2){_0x535268=_0x38cec2;_0x40a827['model']=_[_0x2cea('0x36')](db['DashboardItem'][_0x2cea('0x31')]);_0x40a827['query']=_[_0x2cea('0x36')](_0x1abeeb[_0x2cea('0x35')]);_0x40a827[_0x2cea('0x3d')]=_[_0x2cea('0x37')](_0x40a827[_0x2cea('0x38')],_0x40a827[_0x2cea('0x35')]);_0x5e9c7e[_0x2cea('0x39')]=_[_0x2cea('0x37')](_0x40a827['model'],qs[_0x2cea('0x4a')](_0x1abeeb['query'][_0x2cea('0x4a')]));_0x5e9c7e['attributes']=_0x5e9c7e[_0x2cea('0x39')][_0x2cea('0x4b')]?_0x5e9c7e['attributes']:_0x40a827[_0x2cea('0x38')];_0x5e9c7e[_0x2cea('0x3c')]=qs[_0x2cea('0x79')](_0x1abeeb[_0x2cea('0x35')][_0x2cea('0x79')]);_0x5e9c7e[_0x2cea('0x41')]=qs[_0x2cea('0x3d')](_[_0x2cea('0x3e')](_0x1abeeb[_0x2cea('0x35')],_0x40a827[_0x2cea('0x3d')]));if(_0x1abeeb[_0x2cea('0x35')][_0x2cea('0x3f')]){_0x5e9c7e[_0x2cea('0x41')]=_[_0x2cea('0x40')](_0x5e9c7e['where'],{'$or':_['map'](_0x5e9c7e[_0x2cea('0x39')],function(_0x3374b0){var _0x217ac0={};_0x217ac0[_0x3374b0]={'$like':'%'+_0x1abeeb[_0x2cea('0x35')][_0x2cea('0x3f')]+'%'};return _0x217ac0;})});}_0x5e9c7e=_['merge']({},_0x5e9c7e,_0x1abeeb['options']);return _0x535268[_0x2cea('0x77')](_0x5e9c7e);}})[_0x2cea('0x28')](function(_0x3ebc66){if(_0x3ebc66){_0x401fdb=_0x3ebc66[_0x2cea('0x4b')];if(!_0x1abeeb['query'][_0x2cea('0x3a')](_0x2cea('0x3b'))){_0x5e9c7e[_0x2cea('0x21')]=qs['limit'](_0x1abeeb[_0x2cea('0x35')][_0x2cea('0x21')]);_0x5e9c7e[_0x2cea('0x20')]=qs[_0x2cea('0x20')](_0x1abeeb[_0x2cea('0x35')][_0x2cea('0x20')]);}return _0x535268['getItems'](_0x5e9c7e);}})[_0x2cea('0x28')](function(_0xa9ab5a){if(_0xa9ab5a){return _0xa9ab5a?{'count':_0x401fdb,'rows':_0xa9ab5a}:null;}})['then'](respondWithResult(_0x77794,null))[_0x2cea('0x47')](handleError(_0x77794,null));}; \ No newline at end of file +var _0xbf82=['register','sendStatus','json','count','offset','limit','status','set','Content-Range','reject','save','update','then','get','destroy','end','error','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Dashboard','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','autoAssociation','iframe','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','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','nolimit','html-pdf','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter'];(function(_0x3f7d24,_0x3ce1d5){var _0x143f6e=function(_0x4689be){while(--_0x4689be){_0x3f7d24['push'](_0x3f7d24['shift']());}};_0x143f6e(++_0x3ce1d5);}(_0xbf82,0x1cb));var _0x2bf8=function(_0x4335ad,_0x64b18f){_0x4335ad=_0x4335ad-0x0;var _0x47b0db=_0xbf82[_0x4335ad];return _0x47b0db;};'use strict';var pdf=require(_0x2bf8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2bf8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2bf8('0x2'));var rp=require(_0x2bf8('0x3'));var moment=require(_0x2bf8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2bf8('0x5'));var path=require(_0x2bf8('0x6'));var sox=require(_0x2bf8('0x7'));var csv=require(_0x2bf8('0x8'));var ejs=require(_0x2bf8('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2bf8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2bf8('0xb'));var toCsv=require(_0x2bf8('0x8'));var querystring=require(_0x2bf8('0xc'));var Papa=require('papaparse');var Redis=require(_0x2bf8('0xd'));var authService=require(_0x2bf8('0xe'));var qs=require(_0x2bf8('0xf'));var as=require(_0x2bf8('0x10'));var hardwareService=require(_0x2bf8('0x11'));var logger=require(_0x2bf8('0x12'))(_0x2bf8('0x13'));var utils=require(_0x2bf8('0x14'));var config=require(_0x2bf8('0x15'));var db=require(_0x2bf8('0x16'))['db'];config[_0x2bf8('0x17')]=_['defaults'](config[_0x2bf8('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x2bf8('0x18'))(new Redis(config['redis']));require('./dashboard.socket')[_0x2bf8('0x19')](socket);function respondWithStatusCode(_0x16631e,_0xcfe46c){_0xcfe46c=_0xcfe46c||0xcc;return function(_0x1611e0){if(_0x1611e0){return _0x16631e[_0x2bf8('0x1a')](_0xcfe46c);}return _0x16631e['status'](_0xcfe46c)['end']();};}function respondWithResult(_0x169260,_0x3816ac){_0x3816ac=_0x3816ac||0xc8;return function(_0x405e72){if(_0x405e72){return _0x169260['status'](_0x3816ac)[_0x2bf8('0x1b')](_0x405e72);}};}function respondWithFilteredResult(_0x41b641,_0x1da540){return function(_0x1294d5){if(_0x1294d5){var _0x58a39f=_0x1294d5[_0x2bf8('0x1c')],_0x5da512=_0x1da540[_0x2bf8('0x1d')],_0x1882ae=_0x1da540['offset']+_0x1da540[_0x2bf8('0x1e')],_0x36600a;if(_0x1882ae>=_0x58a39f){_0x1882ae=_0x58a39f;_0x36600a=0xc8;}else{_0x36600a=0xce;}_0x41b641[_0x2bf8('0x1f')](_0x36600a);return _0x41b641[_0x2bf8('0x20')](_0x2bf8('0x21'),_0x5da512+'-'+_0x1882ae+'/'+_0x58a39f)[_0x2bf8('0x1b')](_0x1294d5);}return null;};}function patchUpdates(_0x42f58a){return function(_0x4ea3ae){try{jsonpatch['apply'](_0x4ea3ae,_0x42f58a,!![]);}catch(_0x117ca0){return BPromise[_0x2bf8('0x22')](_0x117ca0);}return _0x4ea3ae[_0x2bf8('0x23')]();};}function saveUpdates(_0x1490cd,_0x19baa7){return function(_0x3ee0c6){if(_0x3ee0c6){return _0x3ee0c6[_0x2bf8('0x24')](_0x1490cd)['then'](function(_0x210683){return _0x210683;});}return null;};}function removeEntity(_0x3991db,_0xe96c7){return function(_0x2d4dd7){if(_0x2d4dd7){return _0x2d4dd7['destroy']()[_0x2bf8('0x25')](function(){var _0x3f1b2a=_0x2d4dd7[_0x2bf8('0x26')]({'plain':!![]});var _0x1c7560='CustomDashboards';return db['UserProfileResource'][_0x2bf8('0x27')]({'where':{'type':_0x1c7560,'resourceId':_0x3f1b2a['id']}})[_0x2bf8('0x25')](function(){return _0x2d4dd7;});})[_0x2bf8('0x25')](function(){_0x3991db[_0x2bf8('0x1f')](0xcc)[_0x2bf8('0x28')]();});}};}function handleEntityNotFound(_0xcdd84d,_0x2ea1d6){return function(_0xb02fa3){if(!_0xb02fa3){_0xcdd84d[_0x2bf8('0x1a')](0x194);}return _0xb02fa3;};}function handleError(_0x117821,_0x319481){_0x319481=_0x319481||0x1f4;return function(_0xfe7006){logger[_0x2bf8('0x29')](_0xfe7006['stack']);if(_0xfe7006['name']){delete _0xfe7006[_0x2bf8('0x2a')];}_0x117821[_0x2bf8('0x1f')](_0x319481)['send'](_0xfe7006);};}exports[_0x2bf8('0x2b')]=function(_0x29f6dc,_0x36cd07){var _0x245caa={},_0x397bf0={},_0x18e7bd={'count':0x0,'rows':[]};var _0x1e0419=_[_0x2bf8('0x2c')](db['Dashboard'][_0x2bf8('0x2d')],function(_0x203627){return{'name':_0x203627[_0x2bf8('0x2e')],'type':_0x203627[_0x2bf8('0x2f')][_0x2bf8('0x30')]};});_0x397bf0[_0x2bf8('0x31')]=_[_0x2bf8('0x2c')](_0x1e0419,_0x2bf8('0x2a'));_0x397bf0[_0x2bf8('0x32')]=_['keys'](_0x29f6dc['query']);_0x397bf0[_0x2bf8('0x33')]=_['intersection'](_0x397bf0[_0x2bf8('0x31')],_0x397bf0[_0x2bf8('0x32')]);_0x245caa[_0x2bf8('0x34')]=_[_0x2bf8('0x35')](_0x397bf0[_0x2bf8('0x31')],qs[_0x2bf8('0x36')](_0x29f6dc[_0x2bf8('0x32')][_0x2bf8('0x36')]));_0x245caa[_0x2bf8('0x34')]=_0x245caa[_0x2bf8('0x34')][_0x2bf8('0x37')]?_0x245caa['attributes']:_0x397bf0[_0x2bf8('0x31')];if(!_0x29f6dc[_0x2bf8('0x32')][_0x2bf8('0x38')]('nolimit')){_0x245caa[_0x2bf8('0x1e')]=qs[_0x2bf8('0x1e')](_0x29f6dc[_0x2bf8('0x32')][_0x2bf8('0x1e')]);_0x245caa[_0x2bf8('0x1d')]=qs['offset'](_0x29f6dc[_0x2bf8('0x32')][_0x2bf8('0x1d')]);}_0x245caa[_0x2bf8('0x39')]=qs[_0x2bf8('0x3a')](_0x29f6dc[_0x2bf8('0x32')]['sort']);_0x245caa[_0x2bf8('0x3b')]=qs[_0x2bf8('0x33')](_[_0x2bf8('0x3c')](_0x29f6dc[_0x2bf8('0x32')],_0x397bf0['filters']));if(_0x29f6dc[_0x2bf8('0x32')][_0x2bf8('0x3d')]){_0x245caa[_0x2bf8('0x3b')]=_[_0x2bf8('0x3e')](_0x245caa[_0x2bf8('0x3b')],{'$or':_['map'](_0x1e0419,function(_0x244d93){if(_0x244d93['type']!==_0x2bf8('0x3f')){var _0x44e30c={};_0x44e30c[_0x244d93[_0x2bf8('0x2a')]]={'$like':'%'+_0x29f6dc['query'][_0x2bf8('0x3d')]+'%'};return _0x44e30c;}})});}_0x245caa=_['merge']({},_0x245caa,_0x29f6dc[_0x2bf8('0x40')]);var _0x3d8c0d={'where':_0x245caa[_0x2bf8('0x3b')]};return db[_0x2bf8('0x41')][_0x2bf8('0x1c')](_0x3d8c0d)['then'](function(_0x7c3ba3){_0x18e7bd[_0x2bf8('0x1c')]=_0x7c3ba3;if(_0x29f6dc[_0x2bf8('0x32')][_0x2bf8('0x42')]){_0x245caa[_0x2bf8('0x43')]=[{'all':!![]}];}return db[_0x2bf8('0x41')][_0x2bf8('0x44')](_0x245caa);})[_0x2bf8('0x25')](function(_0x4b6f85){_0x18e7bd[_0x2bf8('0x45')]=_0x4b6f85;return _0x18e7bd;})[_0x2bf8('0x25')](respondWithFilteredResult(_0x36cd07,_0x245caa))[_0x2bf8('0x46')](handleError(_0x36cd07,null));};exports[_0x2bf8('0x47')]=function(_0x2e3b46,_0x4214e7){var _0x89bf24={'raw':![],'where':{'id':_0x2e3b46[_0x2bf8('0x48')]['id']}},_0x3ba5cb={};_0x3ba5cb[_0x2bf8('0x31')]=_[_0x2bf8('0x49')](db[_0x2bf8('0x41')][_0x2bf8('0x2d')]);_0x3ba5cb[_0x2bf8('0x32')]=_[_0x2bf8('0x49')](_0x2e3b46[_0x2bf8('0x32')]);_0x3ba5cb[_0x2bf8('0x33')]=_['intersection'](_0x3ba5cb[_0x2bf8('0x31')],_0x3ba5cb[_0x2bf8('0x32')]);_0x89bf24[_0x2bf8('0x34')]=_[_0x2bf8('0x35')](_0x3ba5cb[_0x2bf8('0x31')],qs[_0x2bf8('0x36')](_0x2e3b46['query']['fields']));_0x89bf24['attributes']=_0x89bf24['attributes'][_0x2bf8('0x37')]?_0x89bf24[_0x2bf8('0x34')]:_0x3ba5cb[_0x2bf8('0x31')];if(_0x2e3b46['query'][_0x2bf8('0x42')]){_0x89bf24[_0x2bf8('0x43')]=[{'all':!![]}];}_0x89bf24=_['merge']({},_0x89bf24,_0x2e3b46[_0x2bf8('0x40')]);return db[_0x2bf8('0x41')][_0x2bf8('0x4a')](_0x89bf24)[_0x2bf8('0x25')](handleEntityNotFound(_0x4214e7,null))['then'](respondWithResult(_0x4214e7,null))[_0x2bf8('0x46')](handleError(_0x4214e7,null));};exports['create']=function(_0x1443f2,_0x5789e5){return db[_0x2bf8('0x41')][_0x2bf8('0x4b')](_0x1443f2[_0x2bf8('0x4c')],{})[_0x2bf8('0x25')](function(_0x128c94){var _0x3858d3=_0x1443f2[_0x2bf8('0x4d')]['get']({'plain':!![]});if(!_0x3858d3)throw new Error(_0x2bf8('0x4e'));if(_0x3858d3[_0x2bf8('0x4f')]===_0x2bf8('0x4d')){var _0x5d6b41=_0x128c94[_0x2bf8('0x26')]({'plain':!![]});var _0x3a822b=_0x2bf8('0x50');return db[_0x2bf8('0x51')][_0x2bf8('0x4a')]({'where':{'name':_0x3a822b,'userProfileId':_0x3858d3[_0x2bf8('0x52')]},'raw':!![]})[_0x2bf8('0x25')](function(_0x4d2c6b){if(_0x4d2c6b&&_0x4d2c6b['autoAssociation']===0x0){return db[_0x2bf8('0x53')][_0x2bf8('0x4b')]({'name':_0x5d6b41[_0x2bf8('0x2a')],'resourceId':_0x5d6b41['id'],'type':_0x4d2c6b[_0x2bf8('0x2a')],'sectionId':_0x4d2c6b['id']},{})['then'](function(){return _0x128c94;});}else{return _0x128c94;}})['catch'](function(_0x44bc66){logger[_0x2bf8('0x29')](_0x2bf8('0x54'),_0x44bc66);throw _0x44bc66;});}return _0x128c94;})[_0x2bf8('0x25')](respondWithResult(_0x5789e5,0xc9))['catch'](handleError(_0x5789e5,null));};exports[_0x2bf8('0x55')]=function(_0x3e0cff,_0x1db2c9){var _0x576390={'where':{'id':_0x3e0cff[_0x2bf8('0x48')]['id']}},_0x2a3668={};_0x2a3668[_0x2bf8('0x31')]=_[_0x2bf8('0x49')](db[_0x2bf8('0x41')]['rawAttributes']);_0x576390[_0x2bf8('0x34')]=_[_0x2bf8('0x35')](_0x2a3668[_0x2bf8('0x31')],qs[_0x2bf8('0x36')](_0x3e0cff[_0x2bf8('0x32')][_0x2bf8('0x36')]));_0x576390[_0x2bf8('0x34')]=_0x576390[_0x2bf8('0x34')]['length']?_0x576390[_0x2bf8('0x34')]:_0x2a3668[_0x2bf8('0x31')];if(_0x3e0cff[_0x2bf8('0x32')][_0x2bf8('0x42')]){_0x576390[_0x2bf8('0x43')]=[{'all':!![]}];}_0x576390=_[_0x2bf8('0x3e')]({},_0x576390,_0x3e0cff[_0x2bf8('0x40')]);return db['Dashboard'][_0x2bf8('0x4a')](_0x576390)['then'](handleEntityNotFound(_0x1db2c9,null))[_0x2bf8('0x25')](function(_0xfcb446){if(_0xfcb446){var _0x5a086f=_0xfcb446[_0x2bf8('0x26')]({'plain':!![]});_0x5a086f=qs[_0x2bf8('0x56')](_0x5a086f,['id',_0x2bf8('0x57'),'updatedAt']);_0x3e0cff['body']=_['omit'](_0x3e0cff[_0x2bf8('0x4c')],['id','createdAt',_0x2bf8('0x58')]);return db[_0x2bf8('0x41')][_0x2bf8('0x4b')](_['merge'](_0x5a086f,_0x3e0cff[_0x2bf8('0x4c')]),{'include':_0x3e0cff[_0x2bf8('0x32')][_0x2bf8('0x42')]?[{'all':!![]}]:undefined})[_0x2bf8('0x25')](function(_0x3a1059){var _0x2f77ce=_0x3e0cff[_0x2bf8('0x4d')]['get']({'plain':!![]});if(!_0x2f77ce)throw new Error(_0x2bf8('0x4e'));if(_0x2f77ce[_0x2bf8('0x4f')]===_0x2bf8('0x4d')){var _0x4ed017=_0x3a1059[_0x2bf8('0x26')]({'plain':!![]});var _0x257564='CustomDashboards';return db['UserProfileSection'][_0x2bf8('0x4a')]({'where':{'name':_0x257564,'userProfileId':_0x2f77ce['userProfileId']},'raw':!![]})[_0x2bf8('0x25')](function(_0x53e3f6){if(_0x53e3f6&&_0x53e3f6[_0x2bf8('0x59')]===0x0){return db[_0x2bf8('0x53')]['create']({'name':_0x4ed017[_0x2bf8('0x2a')],'resourceId':_0x4ed017['id'],'type':_0x53e3f6[_0x2bf8('0x2a')],'sectionId':_0x53e3f6['id']},{})['then'](function(){return _0x3a1059;});}else{return _0x3a1059;}})[_0x2bf8('0x46')](function(_0x1706ed){logger[_0x2bf8('0x29')](_0x2bf8('0x54'),_0x1706ed);throw _0x1706ed;});}return _0x3a1059;});}})['then'](respondWithResult(_0x1db2c9,0xc9))[_0x2bf8('0x46')](handleError(_0x1db2c9,null));};exports[_0x2bf8('0x24')]=function(_0x588e83,_0x374b88){if(_0x588e83[_0x2bf8('0x4c')]['id']){delete _0x588e83[_0x2bf8('0x4c')]['id'];}return db[_0x2bf8('0x41')][_0x2bf8('0x4a')]({'where':{'id':_0x588e83[_0x2bf8('0x48')]['id']}})['then'](handleEntityNotFound(_0x374b88,null))[_0x2bf8('0x25')](saveUpdates(_0x588e83[_0x2bf8('0x4c')],null))[_0x2bf8('0x25')](respondWithResult(_0x374b88,null))[_0x2bf8('0x46')](handleError(_0x374b88,null));};exports[_0x2bf8('0x27')]=function(_0x383b94,_0x45ab33){return db[_0x2bf8('0x41')]['find']({'where':{'id':_0x383b94[_0x2bf8('0x48')]['id']}})[_0x2bf8('0x25')](handleEntityNotFound(_0x45ab33,null))['then'](removeEntity(_0x45ab33,null))[_0x2bf8('0x46')](handleError(_0x45ab33,null));};function widgetAttributes(_0x396b0e){try{switch(_0x396b0e['type']){case _0x2bf8('0x5a'):return[{'name':'attrUrl','value':_0x396b0e[_0x2bf8('0x5b')]||(_0x396b0e['attrs']&&_0x396b0e[_0x2bf8('0x5c')][0x0]?_0x396b0e[_0x2bf8('0x5c')][0x0]['value']:undefined)||_0x2bf8('0x5d')}];case _0x2bf8('0x5e'):return[{'name':_0x2bf8('0x5f'),'value':_0x396b0e[_0x2bf8('0x5f')]||(_0x396b0e[_0x2bf8('0x5c')]&&_0x396b0e[_0x2bf8('0x5c')][0x0]?_0x396b0e[_0x2bf8('0x5c')][0x0][_0x2bf8('0x60')]:undefined)||''}];case _0x2bf8('0x61'):return[{'name':'attrHourFormat','value':_0x396b0e[_0x2bf8('0x62')]||(_0x396b0e[_0x2bf8('0x5c')]&&_0x396b0e[_0x2bf8('0x5c')][0x0]?_0x396b0e[_0x2bf8('0x5c')][0x0][_0x2bf8('0x60')]:undefined)||'HH:mm:ss'},{'name':_0x2bf8('0x63'),'value':_0x396b0e[_0x2bf8('0x63')]||(_0x396b0e['attrs']&&_0x396b0e[_0x2bf8('0x5c')][0x1]?_0x396b0e[_0x2bf8('0x5c')][0x1][_0x2bf8('0x60')]:undefined)||_0x2bf8('0x64')},{'name':_0x2bf8('0x65'),'value':_0x396b0e['attrFontSize']||(_0x396b0e[_0x2bf8('0x5c')]&&_0x396b0e[_0x2bf8('0x5c')][0x2]?_0x396b0e[_0x2bf8('0x5c')][0x2][_0x2bf8('0x60')]:undefined)||0xc}];case _0x2bf8('0x66'):return[{'name':_0x2bf8('0x67'),'value':_0x396b0e[_0x2bf8('0x67')]||(_0x396b0e['attrs']&&_0x396b0e[_0x2bf8('0x5c')][0x0]?_0x396b0e['attrs'][0x0][_0x2bf8('0x60')]:undefined)||_0x2bf8('0x68')},{'name':'attrVoiceQueues','value':_0x396b0e[_0x2bf8('0x69')]||(_0x396b0e[_0x2bf8('0x5c')]&&_0x396b0e[_0x2bf8('0x5c')][0x1]?_0x396b0e[_0x2bf8('0x5c')][0x1][_0x2bf8('0x60')]:undefined)||[]},{'name':_0x2bf8('0x65'),'value':_0x396b0e[_0x2bf8('0x65')]||(_0x396b0e[_0x2bf8('0x5c')]&&_0x396b0e[_0x2bf8('0x5c')][0x2]?_0x396b0e['attrs'][0x2][_0x2bf8('0x60')]:undefined)||0x14}];case _0x2bf8('0x6a'):case _0x2bf8('0x6b'):return[{'name':_0x2bf8('0x6c'),'value':_0x396b0e[_0x2bf8('0x6c')]||(_0x396b0e[_0x2bf8('0x5c')]&&_0x396b0e['attrs'][0x0]?_0x396b0e[_0x2bf8('0x5c')][0x0][_0x2bf8('0x60')]:undefined)||_0x2bf8('0x68')},{'name':_0x2bf8('0x6d'),'value':_0x396b0e[_0x2bf8('0x6d')]||(_0x396b0e['attrs']&&_0x396b0e[_0x2bf8('0x5c')][0x1]?_0x396b0e['attrs'][0x1][_0x2bf8('0x60')]:undefined)||null},{'name':_0x2bf8('0x6e'),'value':_0x396b0e[_0x2bf8('0x6e')]||(_0x396b0e[_0x2bf8('0x5c')]&&_0x396b0e['attrs'][0x2]?_0x396b0e[_0x2bf8('0x5c')][0x2][_0x2bf8('0x60')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x396b0e[_0x2bf8('0x69')]||(_0x396b0e['attrs']&&_0x396b0e['attrs'][0x3]?_0x396b0e['attrs'][0x3][_0x2bf8('0x60')]:undefined)||[]}];case _0x2bf8('0x6f'):return[{'name':_0x2bf8('0x70'),'type':_0x396b0e[_0x2bf8('0x71')]||(_0x396b0e['attrs']&&_0x396b0e[_0x2bf8('0x5c')][0x0]?_0x396b0e[_0x2bf8('0x5c')][0x0][_0x2bf8('0x2f')]:undefined)||null,'value':_0x396b0e[_0x2bf8('0x70')]||(_0x396b0e[_0x2bf8('0x5c')]&&_0x396b0e['attrs'][0x0]?_0x396b0e[_0x2bf8('0x5c')][0x0]['value']:undefined)||null},{'name':_0x2bf8('0x72'),'value':_0x396b0e[_0x2bf8('0x72')]||(_0x396b0e['attrs']&&_0x396b0e[_0x2bf8('0x5c')][0x1]?_0x396b0e[_0x2bf8('0x5c')][0x1][_0x2bf8('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x5891a9){logger[_0x2bf8('0x29')](_0x2bf8('0x73'),JSON[_0x2bf8('0x74')](_0x5891a9));return[];}}exports[_0x2bf8('0x75')]=function(_0x26cae1,_0x4384e6,_0x8cc948){if(_0x26cae1[_0x2bf8('0x4c')]['id']){delete _0x26cae1[_0x2bf8('0x4c')]['id'];}return db[_0x2bf8('0x41')][_0x2bf8('0x4a')]({'where':{'id':_0x26cae1[_0x2bf8('0x48')]['id']}})[_0x2bf8('0x25')](handleEntityNotFound(_0x4384e6,null))['then'](function(_0x253cdd){if(_0x253cdd){_0x26cae1[_0x2bf8('0x4c')]['DashboardId']=_0x253cdd['id'];_0x26cae1[_0x2bf8('0x4c')][_0x2bf8('0x5c')]=widgetAttributes(_0x26cae1[_0x2bf8('0x4c')]);return db[_0x2bf8('0x76')][_0x2bf8('0x4b')](_0x26cae1[_0x2bf8('0x4c')]);}})[_0x2bf8('0x25')](respondWithResult(_0x4384e6,null))[_0x2bf8('0x46')](handleError(_0x4384e6,null));};exports[_0x2bf8('0x77')]=function(_0x43ae12,_0x44e76c,_0x175cd0){var _0x16b984={};var _0x121e62={};var _0xf1e1bb;var _0x254d5d;return db[_0x2bf8('0x41')]['findOne']({'where':{'id':_0x43ae12[_0x2bf8('0x48')]['id']}})[_0x2bf8('0x25')](handleEntityNotFound(_0x44e76c,null))['then'](function(_0x54fabe){if(_0x54fabe){_0xf1e1bb=_0x54fabe;_0x121e62[_0x2bf8('0x31')]=_[_0x2bf8('0x49')](db[_0x2bf8('0x76')][_0x2bf8('0x2d')]);_0x121e62[_0x2bf8('0x32')]=_[_0x2bf8('0x49')](_0x43ae12['query']);_0x121e62[_0x2bf8('0x33')]=_['intersection'](_0x121e62['model'],_0x121e62[_0x2bf8('0x32')]);_0x16b984[_0x2bf8('0x34')]=_[_0x2bf8('0x35')](_0x121e62[_0x2bf8('0x31')],qs['fields'](_0x43ae12[_0x2bf8('0x32')][_0x2bf8('0x36')]));_0x16b984[_0x2bf8('0x34')]=_0x16b984['attributes'][_0x2bf8('0x37')]?_0x16b984[_0x2bf8('0x34')]:_0x121e62[_0x2bf8('0x31')];_0x16b984['order']=qs[_0x2bf8('0x3a')](_0x43ae12[_0x2bf8('0x32')]['sort']);_0x16b984['where']=qs[_0x2bf8('0x33')](_[_0x2bf8('0x3c')](_0x43ae12[_0x2bf8('0x32')],_0x121e62[_0x2bf8('0x33')]));if(_0x43ae12[_0x2bf8('0x32')][_0x2bf8('0x3d')]){_0x16b984['where']=_[_0x2bf8('0x3e')](_0x16b984[_0x2bf8('0x3b')],{'$or':_['map'](_0x16b984['attributes'],function(_0x254779){var _0x2f85bf={};_0x2f85bf[_0x254779]={'$like':'%'+_0x43ae12[_0x2bf8('0x32')][_0x2bf8('0x3d')]+'%'};return _0x2f85bf;})});}_0x16b984=_[_0x2bf8('0x3e')]({},_0x16b984,_0x43ae12[_0x2bf8('0x40')]);return _0xf1e1bb[_0x2bf8('0x77')](_0x16b984);}})[_0x2bf8('0x25')](function(_0x1455df){if(_0x1455df){_0x254d5d=_0x1455df['length'];if(!_0x43ae12[_0x2bf8('0x32')][_0x2bf8('0x38')](_0x2bf8('0x78'))){_0x16b984[_0x2bf8('0x1e')]=qs[_0x2bf8('0x1e')](_0x43ae12[_0x2bf8('0x32')][_0x2bf8('0x1e')]);_0x16b984[_0x2bf8('0x1d')]=qs[_0x2bf8('0x1d')](_0x43ae12[_0x2bf8('0x32')][_0x2bf8('0x1d')]);}return _0xf1e1bb['getItems'](_0x16b984);}})['then'](function(_0x51f3e2){if(_0x51f3e2){return _0x51f3e2?{'count':_0x254d5d,'rows':_0x51f3e2}:null;}})[_0x2bf8('0x25')](respondWithResult(_0x44e76c,null))[_0x2bf8('0x46')](handleError(_0x44e76c,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 6cc2c70..dbfa8bd 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 _0x5841=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x2f6046,_0x32c821){var _0x39a58e=function(_0x457983){while(--_0x457983){_0x2f6046['push'](_0x2f6046['shift']());}};_0x39a58e(++_0x32c821);}(_0x5841,0x107));var _0x1584=function(_0x235a43,_0x246c45){_0x235a43=_0x235a43-0x0;var _0x46258b=_0x5841[_0x235a43];return _0x46258b;};'use strict';var EventEmitter=require(_0x1584('0x0'));var Dashboard=require(_0x1584('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1584('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1584('0x3'),'afterDestroy':_0x1584('0x4')};function emitEvent(_0x277637){return function(_0x2f5c02,_0x2e1028,_0xcfcad){DashboardEvents[_0x1584('0x5')](_0x277637+':'+_0x2f5c02['id'],_0x2f5c02);DashboardEvents['emit'](_0x277637,_0x2f5c02);_0xcfcad(null);};}for(var e in events){if(events[_0x1584('0x6')](e)){var event=events[e];Dashboard[_0x1584('0x7')](e,emitEvent(event));}}module[_0x1584('0x8')]=DashboardEvents; \ No newline at end of file +var _0x1ec5=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard'];(function(_0x766608,_0x10b2a3){var _0x40c14e=function(_0x343137){while(--_0x343137){_0x766608['push'](_0x766608['shift']());}};_0x40c14e(++_0x10b2a3);}(_0x1ec5,0x9d));var _0x51ec=function(_0x3d1f88,_0x34575b){_0x3d1f88=_0x3d1f88-0x0;var _0x343a2b=_0x1ec5[_0x3d1f88];return _0x343a2b;};'use strict';var EventEmitter=require(_0x51ec('0x0'));var Dashboard=require(_0x51ec('0x1'))['db'][_0x51ec('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x51ec('0x3')](0x0);var events={'afterCreate':_0x51ec('0x4'),'afterUpdate':_0x51ec('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38488a){return function(_0x4cad27,_0x491939,_0x2aeee8){DashboardEvents[_0x51ec('0x6')](_0x38488a+':'+_0x4cad27['id'],_0x4cad27);DashboardEvents[_0x51ec('0x6')](_0x38488a,_0x4cad27);_0x2aeee8(null);};}for(var e in events){if(events[_0x51ec('0x7')](e)){var event=events[e];Dashboard[_0x51ec('0x8')](e,emitEvent(event));}}module[_0x51ec('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 551c158..03e0017 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 _0x2275=['bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','lodash','api','moment'];(function(_0x9dca4c,_0xc09e49){var _0x4c8506=function(_0x8305bf){while(--_0x8305bf){_0x9dca4c['push'](_0x9dca4c['shift']());}};_0x4c8506(++_0xc09e49);}(_0x2275,0xfa));var _0x5227=function(_0x4de9e5,_0x114e64){_0x4de9e5=_0x4de9e5-0x0;var _0x1ab394=_0x2275[_0x4de9e5];return _0x1ab394;};'use strict';var _=require(_0x5227('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5227('0x1'));var moment=require(_0x5227('0x2'));var BPromise=require(_0x5227('0x3'));var rp=require(_0x5227('0x4'));var fs=require('fs');var path=require(_0x5227('0x5'));var rimraf=require(_0x5227('0x6'));var config=require(_0x5227('0x7'));var attributes=require(_0x5227('0x8'));module[_0x5227('0x9')]=function(_0x5b38f6,_0x488764){return _0x5b38f6['define'](_0x5227('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaced=['./dashboard.attributes','define','Dashboard','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x5ca207,_0x2738df){var _0x5f414d=function(_0x149b23){while(--_0x149b23){_0x5ca207['push'](_0x5ca207['shift']());}};_0x5f414d(++_0x2738df);}(_0xaced,0xfd));var _0xdace=function(_0x2fe5b8,_0x18e108){_0x2fe5b8=_0x2fe5b8-0x0;var _0x1f97bb=_0xaced[_0x2fe5b8];return _0x1f97bb;};'use strict';var _=require(_0xdace('0x0'));var util=require('util');var logger=require(_0xdace('0x1'))(_0xdace('0x2'));var moment=require('moment');var BPromise=require(_0xdace('0x3'));var rp=require(_0xdace('0x4'));var fs=require('fs');var path=require(_0xdace('0x5'));var rimraf=require('rimraf');var config=require(_0xdace('0x6'));var attributes=require(_0xdace('0x7'));module['exports']=function(_0x1aa0ed,_0xfb72dc){return _0x1aa0ed[_0xdace('0x8')](_0xdace('0x9'),attributes,{'tableName':'dashboards','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 fc005ad..8a5270b 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 _0xddf6=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4cb272,_0x52c0e9){var _0x57b4aa=function(_0x1efefb){while(--_0x1efefb){_0x4cb272['push'](_0x4cb272['shift']());}};_0x57b4aa(++_0x52c0e9);}(_0xddf6,0x6e));var _0x6ddf=function(_0xd69848,_0x304d63){_0xd69848=_0xd69848-0x0;var _0x8da69f=_0xddf6[_0xd69848];return _0x8da69f;};'use strict';var _=require(_0x6ddf('0x0'));var util=require(_0x6ddf('0x1'));var moment=require('moment');var BPromise=require(_0x6ddf('0x2'));var rs=require(_0x6ddf('0x3'));var fs=require('fs');var Redis=require(_0x6ddf('0x4'));var db=require(_0x6ddf('0x5'))['db'];var utils=require(_0x6ddf('0x6'));var logger=require(_0x6ddf('0x7'))(_0x6ddf('0x8'));var config=require('../../config/environment');var jayson=require(_0x6ddf('0x9'));var client=jayson[_0x6ddf('0xa')][_0x6ddf('0xb')]({'port':0x232a});config['redis']=_[_0x6ddf('0xc')](config[_0x6ddf('0xd')],{'host':_0x6ddf('0xe'),'port':0x18eb});var socket=require(_0x6ddf('0xf'))(new Redis(config[_0x6ddf('0xd')]));require('./dashboard.socket')[_0x6ddf('0x10')](socket);function respondWithRpcPromise(_0x273f4b,_0x56c807,_0x5b5989){return new BPromise(function(_0x59fe02,_0x113a3c){return client[_0x6ddf('0x11')](_0x273f4b,_0x5b5989)[_0x6ddf('0x12')](function(_0x5624a2){logger[_0x6ddf('0x13')](_0x6ddf('0x14'),_0x56c807,_0x6ddf('0x15'));logger[_0x6ddf('0x16')](_0x6ddf('0x17'),_0x56c807,'request\x20sent',JSON['stringify'](_0x5624a2));if(_0x5624a2[_0x6ddf('0x18')]){if(_0x5624a2[_0x6ddf('0x18')][_0x6ddf('0x19')]===0x1f4){logger[_0x6ddf('0x18')](_0x6ddf('0x14'),_0x56c807,_0x5624a2[_0x6ddf('0x18')]['message']);return _0x113a3c(_0x5624a2[_0x6ddf('0x18')][_0x6ddf('0x1a')]);}logger['error'](_0x6ddf('0x14'),_0x56c807,_0x5624a2[_0x6ddf('0x18')]['message']);return _0x59fe02(_0x5624a2[_0x6ddf('0x18')][_0x6ddf('0x1a')]);}else{logger[_0x6ddf('0x13')]('Dashboard,\x20%s,\x20%s',_0x56c807,'request\x20sent');_0x59fe02(_0x5624a2[_0x6ddf('0x1b')][_0x6ddf('0x1a')]);}})[_0x6ddf('0x1c')](function(_0x1c2b56){logger['error'](_0x6ddf('0x14'),_0x56c807,_0x1c2b56);_0x113a3c(_0x1c2b56);});});} \ No newline at end of file +var _0x6b8f=['../../config/environment','jayson/promise','http','localhost','socket.io-emitter','redis','register','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','Dashboard,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2e495c,_0x1d438f){var _0x20e17a=function(_0x1cee82){while(--_0x1cee82){_0x2e495c['push'](_0x2e495c['shift']());}};_0x20e17a(++_0x1d438f);}(_0x6b8f,0x7a));var _0xf6b8=function(_0x4cbbcd,_0x568b01){_0x4cbbcd=_0x4cbbcd-0x0;var _0x2ecc28=_0x6b8f[_0x4cbbcd];return _0x2ecc28;};'use strict';var _=require(_0xf6b8('0x0'));var util=require(_0xf6b8('0x1'));var moment=require(_0xf6b8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6b8('0x3'));var db=require(_0xf6b8('0x4'))['db'];var utils=require(_0xf6b8('0x5'));var logger=require(_0xf6b8('0x6'))(_0xf6b8('0x7'));var config=require(_0xf6b8('0x8'));var jayson=require(_0xf6b8('0x9'));var client=jayson['client'][_0xf6b8('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xf6b8('0xb'),'port':0x18eb});var socket=require(_0xf6b8('0xc'))(new Redis(config[_0xf6b8('0xd')]));require('./dashboard.socket')[_0xf6b8('0xe')](socket);function respondWithRpcPromise(_0x34d67e,_0x374cfe,_0x115353){return new BPromise(function(_0x2d48e7,_0x4df763){return client[_0xf6b8('0xf')](_0x34d67e,_0x115353)[_0xf6b8('0x10')](function(_0x1a0b83){logger[_0xf6b8('0x11')]('Dashboard,\x20%s,\x20%s',_0x374cfe,_0xf6b8('0x12'));logger[_0xf6b8('0x13')](_0xf6b8('0x14'),_0x374cfe,_0xf6b8('0x12'),JSON['stringify'](_0x1a0b83));if(_0x1a0b83[_0xf6b8('0x15')]){if(_0x1a0b83['error'][_0xf6b8('0x16')]===0x1f4){logger['error'](_0xf6b8('0x17'),_0x374cfe,_0x1a0b83['error'][_0xf6b8('0x18')]);return _0x4df763(_0x1a0b83['error'][_0xf6b8('0x18')]);}logger[_0xf6b8('0x15')](_0xf6b8('0x17'),_0x374cfe,_0x1a0b83['error'][_0xf6b8('0x18')]);return _0x2d48e7(_0x1a0b83[_0xf6b8('0x15')]['message']);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x374cfe,_0xf6b8('0x12'));_0x2d48e7(_0x1a0b83[_0xf6b8('0x19')][_0xf6b8('0x18')]);}})['catch'](function(_0x22fd9c){logger[_0xf6b8('0x15')](_0xf6b8('0x17'),_0x374cfe,_0x22fd9c);_0x4df763(_0x22fd9c);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 5439cee..9acf5fd 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 _0x12af=['removeListener','register','length','./dashboard.events','save','remove','update'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0x12af,0x145));var _0xf12a=function(_0x1ad394,_0x1beea7){_0x1ad394=_0x1ad394-0x0;var _0x7548c=_0x12af[_0x1ad394];return _0x7548c;};'use strict';var DashboardEvents=require(_0xf12a('0x0'));var events=[_0xf12a('0x1'),_0xf12a('0x2'),_0xf12a('0x3')];function createListener(_0x10b685,_0x466ba3){return function(_0x863987){_0x466ba3['emit'](_0x10b685,_0x863987);};}function removeListener(_0x451cdb,_0x16ed1d){return function(){DashboardEvents[_0xf12a('0x4')](_0x451cdb,_0x16ed1d);};}exports[_0xf12a('0x5')]=function(_0x4f30f6){for(var _0x3030a0=0x0,_0x282b54=events[_0xf12a('0x6')];_0x3030a0<_0x282b54;_0x3030a0++){var _0x37c6d3=events[_0x3030a0];var _0x30ad47=createListener('dashboard:'+_0x37c6d3,_0x4f30f6);DashboardEvents['on'](_0x37c6d3,_0x30ad47);}}; \ No newline at end of file +var _0xd9b8=['remove','update','emit','removeListener','length','dashboard:','save'];(function(_0x55cb50,_0x387933){var _0x22cfcf=function(_0x4ace4e){while(--_0x4ace4e){_0x55cb50['push'](_0x55cb50['shift']());}};_0x22cfcf(++_0x387933);}(_0xd9b8,0x1e9));var _0x8d9b=function(_0x21b706,_0x1022f4){_0x21b706=_0x21b706-0x0;var _0x13b94a=_0xd9b8[_0x21b706];return _0x13b94a;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x8d9b('0x0'),_0x8d9b('0x1'),_0x8d9b('0x2')];function createListener(_0x494cac,_0x237269){return function(_0x2b4fdc){_0x237269[_0x8d9b('0x3')](_0x494cac,_0x2b4fdc);};}function removeListener(_0x5bbb1c,_0x2aff7a){return function(){DashboardEvents[_0x8d9b('0x4')](_0x5bbb1c,_0x2aff7a);};}exports['register']=function(_0x3d6ff0){for(var _0x47f26a=0x0,_0x1470a3=events[_0x8d9b('0x5')];_0x47f26a<_0x1470a3;_0x47f26a++){var _0x3ccb35=events[_0x47f26a];var _0x1c8714=createListener(_0x8d9b('0x6')+_0x3ccb35,_0x3d6ff0);DashboardEvents['on'](_0x3ccb35,_0x1c8714);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 18bd84e..40a00f0 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','multer','util','path','express','Router'];(function(_0x35b195,_0x8893d5){var _0x2433bf=function(_0x22be07){while(--_0x22be07){_0x35b195['push'](_0x35b195['shift']());}};_0x2433bf(++_0x8893d5);}(_0xe706,0xa3));var _0x6e70=function(_0x566816,_0x73fea5){_0x566816=_0x566816-0x0;var _0x36719c=_0xe706[_0x566816];return _0x36719c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x10')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x10')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['post']('/:id/items',auth[_0x6e70('0xa')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd8b0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','Router'];(function(_0x4da690,_0x12d136){var _0x263c53=function(_0x1832fa){while(--_0x1832fa){_0x4da690['push'](_0x4da690['shift']());}};_0x263c53(++_0x12d136);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xd')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller['clone']);router[_0x0d8b('0xd')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);module[_0x0d8b('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 7e4b596..3ed04c3 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 _0x073a=['exports','STRING','TEXT','long','parse','getDataValue','setDataValue','attrs','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash'];(function(_0x361fda,_0x141d5f){var _0x57e1ed=function(_0xea0ae3){while(--_0xea0ae3){_0x361fda['push'](_0x361fda['shift']());}};_0x57e1ed(++_0x141d5f);}(_0x073a,0xb1));var _0xa073=function(_0x43bcda,_0x13f528){_0x43bcda=_0x43bcda-0x0;var _0xa01d71=_0x073a[_0x43bcda];return _0xa01d71;};'use strict';var Sequelize=require(_0xa073('0x0'));var squel=require(_0xa073('0x1'));var _=require(_0xa073('0x2'));module[_0xa073('0x3')]={'title':{'type':Sequelize[_0xa073('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xa073('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xa073('0x5')](_0xa073('0x6')),'get':function(){try{return JSON[_0xa073('0x7')](this[_0xa073('0x8')]('attrs'));}catch(_0xc2a96f){return[];}},'set':function(_0x3c900b){try{this[_0xa073('0x9')](_0xa073('0xa'),JSON[_0xa073('0xb')](_0x3c900b));}catch(_0x4a7c58){this[_0xa073('0x9')](_0xa073('0xa'),JSON[_0xa073('0xb')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xa073('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xa073('0xc')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa073('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xa073('0x4')],'allowNull':![],'defaultValue':_0xa073('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xa073('0x4')]}}; \ No newline at end of file +var _0xc1e8=['#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER'];(function(_0x4b9e80,_0x2b3179){var _0xc73b33=function(_0x256723){while(--_0x256723){_0x4b9e80['push'](_0x4b9e80['shift']());}};_0xc73b33(++_0x2b3179);}(_0xc1e8,0x11f));var _0x8c1e=function(_0x481604,_0x276ff8){_0x481604=_0x481604-0x0;var _0x1ca4ed=_0xc1e8[_0x481604];return _0x1ca4ed;};'use strict';var Sequelize=require(_0x8c1e('0x0'));var squel=require(_0x8c1e('0x1'));var _=require(_0x8c1e('0x2'));module[_0x8c1e('0x3')]={'title':{'type':Sequelize[_0x8c1e('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x8c1e('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x8c1e('0x5')](_0x8c1e('0x6')),'get':function(){try{return JSON[_0x8c1e('0x7')](this[_0x8c1e('0x8')](_0x8c1e('0x9')));}catch(_0x42ae94){return[];}},'set':function(_0x74b9ea){try{this['setDataValue'](_0x8c1e('0x9'),JSON[_0x8c1e('0xa')](_0x74b9ea));}catch(_0x4f295a){this[_0x8c1e('0xb')]('attrs',JSON[_0x8c1e('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x8c1e('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x8c1e('0xc')]},'col':{'type':Sequelize[_0x8c1e('0xc')]},'background':{'type':Sequelize[_0x8c1e('0x4')],'allowNull':![],'defaultValue':_0x8c1e('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x8c1e('0x4')],'allowNull':![],'defaultValue':_0x8c1e('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8c1e('0x4')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 5ce2875..07f5195 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 _0x8860=['stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','merge','options','find','catch','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','html-pdf','rimraf','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./dashboardItem.socket','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','then','destroy','error'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x8860,0x193));var _0x0886=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x8860[_0x5416db];return _0x243e35;};'use strict';var pdf=require(_0x0886('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0886('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0886('0x2'));var rp=require('request-promise');var moment=require(_0x0886('0x3'));var BPromise=require(_0x0886('0x4'));var Mustache=require('mustache');var util=require(_0x0886('0x5'));var path=require(_0x0886('0x6'));var sox=require(_0x0886('0x7'));var csv=require(_0x0886('0x8'));var ejs=require(_0x0886('0x9'));var fs=require('fs');var _=require(_0x0886('0xa'));var squel=require(_0x0886('0xb'));var crypto=require(_0x0886('0xc'));var jsforce=require(_0x0886('0xd'));var deskjs=require(_0x0886('0xe'));var toCsv=require(_0x0886('0x8'));var querystring=require(_0x0886('0xf'));var Papa=require(_0x0886('0x10'));var Redis=require(_0x0886('0x11'));var authService=require(_0x0886('0x12'));var qs=require(_0x0886('0x13'));var as=require(_0x0886('0x14'));var hardwareService=require(_0x0886('0x15'));var logger=require(_0x0886('0x16'))(_0x0886('0x17'));var utils=require(_0x0886('0x18'));var config=require(_0x0886('0x19'));var db=require('../../mysqldb')['db'];config[_0x0886('0x1a')]=_[_0x0886('0x1b')](config[_0x0886('0x1a')],{'host':_0x0886('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0886('0x1a')]));require(_0x0886('0x1d'))['register'](socket);function respondWithStatusCode(_0x58d864,_0x12579a){_0x12579a=_0x12579a||0xcc;return function(_0x1a4677){if(_0x1a4677){return _0x58d864[_0x0886('0x1e')](_0x12579a);}return _0x58d864[_0x0886('0x1f')](_0x12579a)[_0x0886('0x20')]();};}function respondWithResult(_0x50225d,_0x5c66a6){_0x5c66a6=_0x5c66a6||0xc8;return function(_0x47514a){if(_0x47514a){return _0x50225d[_0x0886('0x1f')](_0x5c66a6)[_0x0886('0x21')](_0x47514a);}};}function respondWithFilteredResult(_0x129ff5,_0x2a7fb4){return function(_0x527dc5){if(_0x527dc5){var _0x60aba0=_0x527dc5['count'],_0x4bba6e=_0x2a7fb4[_0x0886('0x22')],_0x3921cf=_0x2a7fb4[_0x0886('0x22')]+_0x2a7fb4[_0x0886('0x23')],_0x4f77b5;if(_0x3921cf>=_0x60aba0){_0x3921cf=_0x60aba0;_0x4f77b5=0xc8;}else{_0x4f77b5=0xce;}_0x129ff5[_0x0886('0x1f')](_0x4f77b5);return _0x129ff5[_0x0886('0x24')](_0x0886('0x25'),_0x4bba6e+'-'+_0x3921cf+'/'+_0x60aba0)['json'](_0x527dc5);}return null;};}function patchUpdates(_0xc2cde2){return function(_0x336557){try{jsonpatch['apply'](_0x336557,_0xc2cde2,!![]);}catch(_0xd3cd8c){return BPromise[_0x0886('0x26')](_0xd3cd8c);}return _0x336557['save']();};}function saveUpdates(_0x2c3947,_0x51a097){return function(_0x4929ae){if(_0x4929ae){return _0x4929ae['update'](_0x2c3947)[_0x0886('0x27')](function(_0x330af3){return _0x330af3;});}return null;};}function removeEntity(_0x3e43c3,_0x2b3db1){return function(_0x5a0340){if(_0x5a0340){return _0x5a0340[_0x0886('0x28')]()['then'](function(){_0x3e43c3[_0x0886('0x1f')](0xcc)[_0x0886('0x20')]();});}};}function handleEntityNotFound(_0x117520,_0x5c551d){return function(_0x15dea9){if(!_0x15dea9){_0x117520[_0x0886('0x1e')](0x194);}return _0x15dea9;};}function handleError(_0x1b3612,_0x19e187){_0x19e187=_0x19e187||0x1f4;return function(_0x4d13ee){logger[_0x0886('0x29')](_0x4d13ee[_0x0886('0x2a')]);if(_0x4d13ee[_0x0886('0x2b')]){delete _0x4d13ee[_0x0886('0x2b')];}_0x1b3612[_0x0886('0x1f')](_0x19e187)[_0x0886('0x2c')](_0x4d13ee);};}exports[_0x0886('0x2d')]=function(_0x55f92c,_0x4e7dbb){var _0x1d9f7d={'raw':![],'where':{'id':_0x55f92c[_0x0886('0x2e')]['id']}},_0x4a50d2={};_0x4a50d2[_0x0886('0x2f')]=_[_0x0886('0x30')](db[_0x0886('0x31')][_0x0886('0x32')]);_0x4a50d2[_0x0886('0x33')]=_[_0x0886('0x30')](_0x55f92c[_0x0886('0x33')]);_0x4a50d2[_0x0886('0x34')]=_[_0x0886('0x35')](_0x4a50d2[_0x0886('0x2f')],_0x4a50d2[_0x0886('0x33')]);_0x1d9f7d[_0x0886('0x36')]=_[_0x0886('0x35')](_0x4a50d2[_0x0886('0x2f')],qs['fields'](_0x55f92c[_0x0886('0x33')]['fields']));_0x1d9f7d[_0x0886('0x36')]=_0x1d9f7d[_0x0886('0x36')][_0x0886('0x37')]?_0x1d9f7d[_0x0886('0x36')]:_0x4a50d2[_0x0886('0x2f')];if(_0x55f92c[_0x0886('0x33')][_0x0886('0x38')]){_0x1d9f7d[_0x0886('0x39')]=[{'all':!![]}];}_0x1d9f7d=_[_0x0886('0x3a')]({},_0x1d9f7d,_0x55f92c[_0x0886('0x3b')]);return db[_0x0886('0x31')][_0x0886('0x3c')](_0x1d9f7d)['then'](handleEntityNotFound(_0x4e7dbb,null))[_0x0886('0x27')](respondWithResult(_0x4e7dbb,null))[_0x0886('0x3d')](handleError(_0x4e7dbb,null));};exports['destroy']=function(_0x7e003b,_0x26a37f){return db['DashboardItem'][_0x0886('0x3c')]({'where':{'id':_0x7e003b['params']['id']}})['then'](handleEntityNotFound(_0x26a37f,null))[_0x0886('0x27')](removeEntity(_0x26a37f,null))['catch'](handleError(_0x26a37f,null));};function widgetAttributes(_0x4ef0ab){try{switch(_0x4ef0ab['type']){case _0x0886('0x3e'):return[{'name':'attrUrl','value':_0x4ef0ab[_0x0886('0x3f')]||(_0x4ef0ab[_0x0886('0x40')]&&_0x4ef0ab[_0x0886('0x40')][0x0]?_0x4ef0ab[_0x0886('0x40')][0x0][_0x0886('0x41')]:undefined)||_0x0886('0x42')}];case'custom':return[{'name':_0x0886('0x43'),'value':_0x4ef0ab[_0x0886('0x43')]||(_0x4ef0ab[_0x0886('0x40')]&&_0x4ef0ab[_0x0886('0x40')][0x0]?_0x4ef0ab[_0x0886('0x40')][0x0][_0x0886('0x41')]:undefined)||''}];case _0x0886('0x44'):return[{'name':_0x0886('0x45'),'value':_0x4ef0ab['attrHourFormat']||(_0x4ef0ab[_0x0886('0x40')]&&_0x4ef0ab[_0x0886('0x40')][0x0]?_0x4ef0ab[_0x0886('0x40')][0x0][_0x0886('0x41')]:undefined)||'HH:mm:ss'},{'name':_0x0886('0x46'),'value':_0x4ef0ab[_0x0886('0x46')]||(_0x4ef0ab[_0x0886('0x40')]&&_0x4ef0ab[_0x0886('0x40')][0x1]?_0x4ef0ab[_0x0886('0x40')][0x1]['value']:undefined)||_0x0886('0x47')},{'name':_0x0886('0x48'),'value':_0x4ef0ab[_0x0886('0x48')]||(_0x4ef0ab[_0x0886('0x40')]&&_0x4ef0ab[_0x0886('0x40')][0x2]?_0x4ef0ab['attrs'][0x2][_0x0886('0x41')]:undefined)||0xc}];case'counter':return[{'name':_0x0886('0x49'),'value':_0x4ef0ab[_0x0886('0x49')]||(_0x4ef0ab[_0x0886('0x40')]&&_0x4ef0ab[_0x0886('0x40')][0x0]?_0x4ef0ab['attrs'][0x0][_0x0886('0x41')]:undefined)||_0x0886('0x4a')},{'name':_0x0886('0x4b'),'value':_0x4ef0ab['attrVoiceQueues']||(_0x4ef0ab[_0x0886('0x40')]&&_0x4ef0ab[_0x0886('0x40')][0x1]?_0x4ef0ab[_0x0886('0x40')][0x1][_0x0886('0x41')]:undefined)||[]},{'name':_0x0886('0x48'),'value':_0x4ef0ab[_0x0886('0x48')]||(_0x4ef0ab[_0x0886('0x40')]&&_0x4ef0ab[_0x0886('0x40')][0x2]?_0x4ef0ab[_0x0886('0x40')][0x2][_0x0886('0x41')]:undefined)||0x14}];case _0x0886('0x4c'):case _0x0886('0x4d'):return[{'name':_0x0886('0x4e'),'value':_0x4ef0ab[_0x0886('0x4e')]||(_0x4ef0ab[_0x0886('0x40')]&&_0x4ef0ab[_0x0886('0x40')][0x0]?_0x4ef0ab[_0x0886('0x40')][0x0][_0x0886('0x41')]:undefined)||_0x0886('0x4a')},{'name':'attrSerie2','value':_0x4ef0ab[_0x0886('0x4f')]||(_0x4ef0ab[_0x0886('0x40')]&&_0x4ef0ab[_0x0886('0x40')][0x1]?_0x4ef0ab[_0x0886('0x40')][0x1][_0x0886('0x41')]:undefined)||null},{'name':_0x0886('0x50'),'value':_0x4ef0ab[_0x0886('0x50')]||(_0x4ef0ab['attrs']&&_0x4ef0ab['attrs'][0x2]?_0x4ef0ab[_0x0886('0x40')][0x2]['value']:undefined)||null},{'name':_0x0886('0x4b'),'value':_0x4ef0ab[_0x0886('0x4b')]||(_0x4ef0ab['attrs']&&_0x4ef0ab[_0x0886('0x40')][0x3]?_0x4ef0ab[_0x0886('0x40')][0x3][_0x0886('0x41')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0x4ef0ab[_0x0886('0x51')]||(_0x4ef0ab[_0x0886('0x40')]&&_0x4ef0ab['attrs'][0x0]?_0x4ef0ab[_0x0886('0x40')][0x0][_0x0886('0x52')]:undefined)||null,'value':_0x4ef0ab['attrReport']||(_0x4ef0ab[_0x0886('0x40')]&&_0x4ef0ab[_0x0886('0x40')][0x0]?_0x4ef0ab['attrs'][0x0][_0x0886('0x41')]:undefined)||null},{'name':_0x0886('0x53'),'value':_0x4ef0ab[_0x0886('0x53')]||(_0x4ef0ab[_0x0886('0x40')]&&_0x4ef0ab[_0x0886('0x40')][0x1]?_0x4ef0ab[_0x0886('0x40')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x599469){logger['error'](_0x0886('0x54'),JSON[_0x0886('0x55')](_0x599469));return[];}}exports[_0x0886('0x56')]=function(_0xa715f9,_0x1acabf){if(_0xa715f9[_0x0886('0x57')]){_0xa715f9[_0x0886('0x57')][_0x0886('0x40')]=widgetAttributes(_0xa715f9[_0x0886('0x57')]);}return db[_0x0886('0x31')][_0x0886('0x56')](_0xa715f9['body'],{})[_0x0886('0x27')](respondWithResult(_0x1acabf,0xc9))[_0x0886('0x3d')](handleError(_0x1acabf,null));};exports[_0x0886('0x58')]=function(_0x2020c9,_0x183b2f){if(_0x2020c9['body']['id']){delete _0x2020c9['body']['id'];}_0x2020c9[_0x0886('0x57')][_0x0886('0x40')]=widgetAttributes(_0x2020c9['body']);return db['DashboardItem']['find']({'where':{'id':_0x2020c9[_0x0886('0x2e')]['id']}})[_0x0886('0x27')](handleEntityNotFound(_0x183b2f,null))['then'](saveUpdates(_0x2020c9[_0x0886('0x57')],null))[_0x0886('0x27')](respondWithResult(_0x183b2f,null))[_0x0886('0x3d')](handleError(_0x183b2f,null));}; \ No newline at end of file +var _0xf94a=['pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','body','create','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','type','attrUrl','attrs','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','value','counter','attrMetric','total','attrVoiceQueues'];(function(_0x24f91c,_0x4d39db){var _0x202136=function(_0x27eb0b){while(--_0x27eb0b){_0x24f91c['push'](_0x24f91c['shift']());}};_0x202136(++_0x4d39db);}(_0xf94a,0x1d9));var _0xaf94=function(_0x4a3a00,_0x13c6c7){_0x4a3a00=_0x4a3a00-0x0;var _0x26fb5e=_0xf94a[_0x4a3a00];return _0x26fb5e;};'use strict';var pdf=require(_0xaf94('0x0'));var emlformat=require(_0xaf94('0x1'));var rimraf=require(_0xaf94('0x2'));var zipdir=require(_0xaf94('0x3'));var jsonpatch=require(_0xaf94('0x4'));var rp=require(_0xaf94('0x5'));var moment=require(_0xaf94('0x6'));var BPromise=require(_0xaf94('0x7'));var Mustache=require(_0xaf94('0x8'));var util=require(_0xaf94('0x9'));var path=require(_0xaf94('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf94('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaf94('0xc'));var crypto=require('crypto');var jsforce=require(_0xaf94('0xd'));var deskjs=require(_0xaf94('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaf94('0xf'));var Papa=require(_0xaf94('0x10'));var Redis=require(_0xaf94('0x11'));var authService=require(_0xaf94('0x12'));var qs=require(_0xaf94('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf94('0x14'));var logger=require(_0xaf94('0x15'))(_0xaf94('0x16'));var utils=require('../../config/utils');var config=require(_0xaf94('0x17'));var db=require('../../mysqldb')['db'];config[_0xaf94('0x18')]=_[_0xaf94('0x19')](config[_0xaf94('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xaf94('0x1a'))(new Redis(config['redis']));require(_0xaf94('0x1b'))[_0xaf94('0x1c')](socket);function respondWithStatusCode(_0xd90ce3,_0x54ad88){_0x54ad88=_0x54ad88||0xcc;return function(_0x27bfd6){if(_0x27bfd6){return _0xd90ce3[_0xaf94('0x1d')](_0x54ad88);}return _0xd90ce3[_0xaf94('0x1e')](_0x54ad88)[_0xaf94('0x1f')]();};}function respondWithResult(_0x1f404b,_0x1bae82){_0x1bae82=_0x1bae82||0xc8;return function(_0x2a78e8){if(_0x2a78e8){return _0x1f404b['status'](_0x1bae82)[_0xaf94('0x20')](_0x2a78e8);}};}function respondWithFilteredResult(_0x581430,_0x58c031){return function(_0x1764be){if(_0x1764be){var _0xbc3d7c=_0x1764be['count'],_0x13624a=_0x58c031[_0xaf94('0x21')],_0xa7ff44=_0x58c031[_0xaf94('0x21')]+_0x58c031[_0xaf94('0x22')],_0x4d9307;if(_0xa7ff44>=_0xbc3d7c){_0xa7ff44=_0xbc3d7c;_0x4d9307=0xc8;}else{_0x4d9307=0xce;}_0x581430[_0xaf94('0x1e')](_0x4d9307);return _0x581430[_0xaf94('0x23')]('Content-Range',_0x13624a+'-'+_0xa7ff44+'/'+_0xbc3d7c)['json'](_0x1764be);}return null;};}function patchUpdates(_0x2bbe3a){return function(_0x5a359e){try{jsonpatch[_0xaf94('0x24')](_0x5a359e,_0x2bbe3a,!![]);}catch(_0x3c0bed){return BPromise[_0xaf94('0x25')](_0x3c0bed);}return _0x5a359e[_0xaf94('0x26')]();};}function saveUpdates(_0x20506c,_0x17c5b3){return function(_0xaa00ea){if(_0xaa00ea){return _0xaa00ea[_0xaf94('0x27')](_0x20506c)[_0xaf94('0x28')](function(_0x1891a3){return _0x1891a3;});}return null;};}function removeEntity(_0x35660f,_0x5cc608){return function(_0x6074c1){if(_0x6074c1){return _0x6074c1[_0xaf94('0x29')]()['then'](function(){_0x35660f[_0xaf94('0x1e')](0xcc)[_0xaf94('0x1f')]();});}};}function handleEntityNotFound(_0x2c7f50,_0x17e7fd){return function(_0x32a0d3){if(!_0x32a0d3){_0x2c7f50['sendStatus'](0x194);}return _0x32a0d3;};}function handleError(_0x3fef31,_0x4908ea){_0x4908ea=_0x4908ea||0x1f4;return function(_0x2af57e){logger['error'](_0x2af57e[_0xaf94('0x2a')]);if(_0x2af57e[_0xaf94('0x2b')]){delete _0x2af57e[_0xaf94('0x2b')];}_0x3fef31[_0xaf94('0x1e')](_0x4908ea)[_0xaf94('0x2c')](_0x2af57e);};}exports[_0xaf94('0x2d')]=function(_0xfd3100,_0x14afc6){var _0xcc2b70={'raw':![],'where':{'id':_0xfd3100[_0xaf94('0x2e')]['id']}},_0x1c8884={};_0x1c8884[_0xaf94('0x2f')]=_[_0xaf94('0x30')](db[_0xaf94('0x31')][_0xaf94('0x32')]);_0x1c8884[_0xaf94('0x33')]=_['keys'](_0xfd3100[_0xaf94('0x33')]);_0x1c8884[_0xaf94('0x34')]=_[_0xaf94('0x35')](_0x1c8884[_0xaf94('0x2f')],_0x1c8884[_0xaf94('0x33')]);_0xcc2b70[_0xaf94('0x36')]=_['intersection'](_0x1c8884['model'],qs[_0xaf94('0x37')](_0xfd3100['query'][_0xaf94('0x37')]));_0xcc2b70['attributes']=_0xcc2b70[_0xaf94('0x36')][_0xaf94('0x38')]?_0xcc2b70[_0xaf94('0x36')]:_0x1c8884[_0xaf94('0x2f')];if(_0xfd3100[_0xaf94('0x33')][_0xaf94('0x39')]){_0xcc2b70[_0xaf94('0x3a')]=[{'all':!![]}];}_0xcc2b70=_[_0xaf94('0x3b')]({},_0xcc2b70,_0xfd3100[_0xaf94('0x3c')]);return db[_0xaf94('0x31')][_0xaf94('0x3d')](_0xcc2b70)[_0xaf94('0x28')](handleEntityNotFound(_0x14afc6,null))[_0xaf94('0x28')](respondWithResult(_0x14afc6,null))[_0xaf94('0x3e')](handleError(_0x14afc6,null));};exports[_0xaf94('0x29')]=function(_0x48339c,_0x5a99b5){return db[_0xaf94('0x31')][_0xaf94('0x3d')]({'where':{'id':_0x48339c['params']['id']}})[_0xaf94('0x28')](handleEntityNotFound(_0x5a99b5,null))[_0xaf94('0x28')](removeEntity(_0x5a99b5,null))[_0xaf94('0x3e')](handleError(_0x5a99b5,null));};function widgetAttributes(_0x25e86b){try{switch(_0x25e86b[_0xaf94('0x3f')]){case'iframe':return[{'name':_0xaf94('0x40'),'value':_0x25e86b[_0xaf94('0x40')]||(_0x25e86b[_0xaf94('0x41')]&&_0x25e86b[_0xaf94('0x41')][0x0]?_0x25e86b[_0xaf94('0x41')][0x0]['value']:undefined)||_0xaf94('0x42')}];case _0xaf94('0x43'):return[{'name':'attrPath','value':_0x25e86b[_0xaf94('0x44')]||(_0x25e86b[_0xaf94('0x41')]&&_0x25e86b['attrs'][0x0]?_0x25e86b[_0xaf94('0x41')][0x0]['value']:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x25e86b[_0xaf94('0x45')]||(_0x25e86b[_0xaf94('0x41')]&&_0x25e86b[_0xaf94('0x41')][0x0]?_0x25e86b['attrs'][0x0]['value']:undefined)||_0xaf94('0x46')},{'name':_0xaf94('0x47'),'value':_0x25e86b[_0xaf94('0x47')]||(_0x25e86b[_0xaf94('0x41')]&&_0x25e86b[_0xaf94('0x41')][0x1]?_0x25e86b[_0xaf94('0x41')][0x1]['value']:undefined)||_0xaf94('0x48')},{'name':'attrFontSize','value':_0x25e86b[_0xaf94('0x49')]||(_0x25e86b['attrs']&&_0x25e86b[_0xaf94('0x41')][0x2]?_0x25e86b[_0xaf94('0x41')][0x2][_0xaf94('0x4a')]:undefined)||0xc}];case _0xaf94('0x4b'):return[{'name':_0xaf94('0x4c'),'value':_0x25e86b['attrMetric']||(_0x25e86b[_0xaf94('0x41')]&&_0x25e86b[_0xaf94('0x41')][0x0]?_0x25e86b['attrs'][0x0][_0xaf94('0x4a')]:undefined)||_0xaf94('0x4d')},{'name':_0xaf94('0x4e'),'value':_0x25e86b[_0xaf94('0x4e')]||(_0x25e86b[_0xaf94('0x41')]&&_0x25e86b[_0xaf94('0x41')][0x1]?_0x25e86b['attrs'][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x25e86b[_0xaf94('0x49')]||(_0x25e86b[_0xaf94('0x41')]&&_0x25e86b['attrs'][0x2]?_0x25e86b[_0xaf94('0x41')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0xaf94('0x4f'):return[{'name':_0xaf94('0x50'),'value':_0x25e86b[_0xaf94('0x50')]||(_0x25e86b[_0xaf94('0x41')]&&_0x25e86b[_0xaf94('0x41')][0x0]?_0x25e86b[_0xaf94('0x41')][0x0]['value']:undefined)||_0xaf94('0x4d')},{'name':_0xaf94('0x51'),'value':_0x25e86b[_0xaf94('0x51')]||(_0x25e86b[_0xaf94('0x41')]&&_0x25e86b[_0xaf94('0x41')][0x1]?_0x25e86b[_0xaf94('0x41')][0x1][_0xaf94('0x4a')]:undefined)||null},{'name':'attrSerie3','value':_0x25e86b[_0xaf94('0x52')]||(_0x25e86b[_0xaf94('0x41')]&&_0x25e86b['attrs'][0x2]?_0x25e86b[_0xaf94('0x41')][0x2]['value']:undefined)||null},{'name':_0xaf94('0x4e'),'value':_0x25e86b[_0xaf94('0x4e')]||(_0x25e86b[_0xaf94('0x41')]&&_0x25e86b['attrs'][0x3]?_0x25e86b['attrs'][0x3][_0xaf94('0x4a')]:undefined)||[]}];case _0xaf94('0x53'):return[{'name':_0xaf94('0x54'),'type':_0x25e86b[_0xaf94('0x55')]||(_0x25e86b[_0xaf94('0x41')]&&_0x25e86b[_0xaf94('0x41')][0x0]?_0x25e86b[_0xaf94('0x41')][0x0][_0xaf94('0x3f')]:undefined)||null,'value':_0x25e86b[_0xaf94('0x54')]||(_0x25e86b[_0xaf94('0x41')]&&_0x25e86b['attrs'][0x0]?_0x25e86b[_0xaf94('0x41')][0x0]['value']:undefined)||null},{'name':_0xaf94('0x56'),'value':_0x25e86b[_0xaf94('0x56')]||(_0x25e86b['attrs']&&_0x25e86b['attrs'][0x1]?_0x25e86b[_0xaf94('0x41')][0x1][_0xaf94('0x4a')]:undefined)||0x0}];default:return[];}}catch(_0x3d3215){logger[_0xaf94('0x57')](_0xaf94('0x58'),JSON[_0xaf94('0x59')](_0x3d3215));return[];}}exports['create']=function(_0x267751,_0x7a18d8){if(_0x267751['body']){_0x267751[_0xaf94('0x5a')]['attrs']=widgetAttributes(_0x267751[_0xaf94('0x5a')]);}return db[_0xaf94('0x31')][_0xaf94('0x5b')](_0x267751[_0xaf94('0x5a')],{})[_0xaf94('0x28')](respondWithResult(_0x7a18d8,0xc9))['catch'](handleError(_0x7a18d8,null));};exports[_0xaf94('0x27')]=function(_0x30bae5,_0xe25e38){if(_0x30bae5[_0xaf94('0x5a')]['id']){delete _0x30bae5[_0xaf94('0x5a')]['id'];}_0x30bae5[_0xaf94('0x5a')][_0xaf94('0x41')]=widgetAttributes(_0x30bae5['body']);return db[_0xaf94('0x31')][_0xaf94('0x3d')]({'where':{'id':_0x30bae5[_0xaf94('0x2e')]['id']}})['then'](handleEntityNotFound(_0xe25e38,null))[_0xaf94('0x28')](saveUpdates(_0x30bae5[_0xaf94('0x5a')],null))[_0xaf94('0x28')](respondWithResult(_0xe25e38,null))['catch'](handleError(_0xe25e38,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 8e70f14..4fe6db4 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 _0x0604=['DashboardItem','setMaxListeners','save','update','emit','exports','../../mysqldb'];(function(_0x5448a9,_0x4764da){var _0x1924af=function(_0x34f9bf){while(--_0x34f9bf){_0x5448a9['push'](_0x5448a9['shift']());}};_0x1924af(++_0x4764da);}(_0x0604,0x179));var _0x4060=function(_0x14525d,_0x1c42d7){_0x14525d=_0x14525d-0x0;var _0x3f7842=_0x0604[_0x14525d];return _0x3f7842;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x4060('0x0'))['db'][_0x4060('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x4060('0x2')](0x0);var events={'afterCreate':_0x4060('0x3'),'afterUpdate':_0x4060('0x4'),'afterDestroy':'remove'};function emitEvent(_0x504ad9){return function(_0x1f5d34,_0x170ab7,_0x69da45){DashboardItemEvents[_0x4060('0x5')](_0x504ad9+':'+_0x1f5d34['id'],_0x1f5d34);DashboardItemEvents[_0x4060('0x5')](_0x504ad9,_0x1f5d34);_0x69da45(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x4060('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x7b14=['remove','emit','hasOwnProperty','hook','exports','events','update'];(function(_0x29ccdf,_0x276ba3){var _0x571781=function(_0x3c9605){while(--_0x3c9605){_0x29ccdf['push'](_0x29ccdf['shift']());}};_0x571781(++_0x276ba3);}(_0x7b14,0x91));var _0x47b1=function(_0x164b89,_0x4b7190){_0x164b89=_0x164b89-0x0;var _0x2b1a08=_0x7b14[_0x164b89];return _0x2b1a08;};'use strict';var EventEmitter=require(_0x47b1('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x47b1('0x1'),'afterDestroy':_0x47b1('0x2')};function emitEvent(_0x30667c){return function(_0x25eb3f,_0x544514,_0x5bccc1){DashboardItemEvents[_0x47b1('0x3')](_0x30667c+':'+_0x25eb3f['id'],_0x25eb3f);DashboardItemEvents[_0x47b1('0x3')](_0x30667c,_0x25eb3f);_0x5bccc1(null);};}for(var e in events){if(events[_0x47b1('0x4')](e)){var event=events[e];DashboardItem[_0x47b1('0x5')](e,emitEvent(event));}}module[_0x47b1('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 97b047e..3d035cd 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 _0x8048=['dashboard_items','lodash','util','../../config/logger','moment','bluebird','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x16ff2f,_0x298d81){var _0x4ca515=function(_0x5dc220){while(--_0x5dc220){_0x16ff2f['push'](_0x16ff2f['shift']());}};_0x4ca515(++_0x298d81);}(_0x8048,0x118));var _0x8804=function(_0x5a130d,_0x5a9e96){_0x5a130d=_0x5a130d-0x0;var _0x1822f2=_0x8048[_0x5a130d];return _0x1822f2;};'use strict';var _=require(_0x8804('0x0'));var util=require(_0x8804('0x1'));var logger=require(_0x8804('0x2'))('api');var moment=require(_0x8804('0x3'));var BPromise=require(_0x8804('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8804('0x5'));var attributes=require(_0x8804('0x6'));module[_0x8804('0x7')]=function(_0x5562a7,_0x3e8272){return _0x5562a7['define']('DashboardItem',attributes,{'tableName':_0x8804('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a40=['../../config/logger','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','util'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x8a40,0xbc));var _0x08a4=function(_0x26eb7b,_0x594bf5){_0x26eb7b=_0x26eb7b-0x0;var _0x2e59ed=_0x8a40[_0x26eb7b];return _0x2e59ed;};'use strict';var _=require('lodash');var util=require(_0x08a4('0x0'));var logger=require(_0x08a4('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x08a4('0x2'));var rimraf=require(_0x08a4('0x3'));var config=require(_0x08a4('0x4'));var attributes=require(_0x08a4('0x5'));module[_0x08a4('0x6')]=function(_0x36f5a2,_0x36c7b5){return _0x36f5a2['define'](_0x08a4('0x7'),attributes,{'tableName':_0x08a4('0x8'),'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 1fbe3a8..6d4506e 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 _0x79ea=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3d8a94,_0x4294a4){var _0x20d4c8=function(_0x665503){while(--_0x665503){_0x3d8a94['push'](_0x3d8a94['shift']());}};_0x20d4c8(++_0x4294a4);}(_0x79ea,0xff));var _0xa79e=function(_0x1e24b1,_0x14ab30){_0x1e24b1=_0x1e24b1-0x0;var _0x212baf=_0x79ea[_0x1e24b1];return _0x212baf;};'use strict';var _=require(_0xa79e('0x0'));var util=require(_0xa79e('0x1'));var moment=require(_0xa79e('0x2'));var BPromise=require(_0xa79e('0x3'));var rs=require(_0xa79e('0x4'));var fs=require('fs');var Redis=require(_0xa79e('0x5'));var db=require(_0xa79e('0x6'))['db'];var utils=require(_0xa79e('0x7'));var logger=require(_0xa79e('0x8'))(_0xa79e('0x9'));var config=require(_0xa79e('0xa'));var jayson=require(_0xa79e('0xb'));var client=jayson[_0xa79e('0xc')][_0xa79e('0xd')]({'port':0x232a});config[_0xa79e('0xe')]=_['defaults'](config[_0xa79e('0xe')],{'host':_0xa79e('0xf'),'port':0x18eb});var socket=require(_0xa79e('0x10'))(new Redis(config['redis']));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x5f2690,_0x528ee0,_0x24add9){return new BPromise(function(_0x5ce0ad,_0x3486c2){return client['request'](_0x5f2690,_0x24add9)[_0xa79e('0x11')](function(_0x4ec6ba){logger[_0xa79e('0x12')](_0xa79e('0x13'),_0x528ee0,_0xa79e('0x14'));logger[_0xa79e('0x15')](_0xa79e('0x16'),_0x528ee0,_0xa79e('0x14'),JSON[_0xa79e('0x17')](_0x4ec6ba));if(_0x4ec6ba[_0xa79e('0x18')]){if(_0x4ec6ba[_0xa79e('0x18')][_0xa79e('0x19')]===0x1f4){logger[_0xa79e('0x18')](_0xa79e('0x13'),_0x528ee0,_0x4ec6ba[_0xa79e('0x18')][_0xa79e('0x1a')]);return _0x3486c2(_0x4ec6ba[_0xa79e('0x18')][_0xa79e('0x1a')]);}logger[_0xa79e('0x18')](_0xa79e('0x13'),_0x528ee0,_0x4ec6ba['error'][_0xa79e('0x1a')]);return _0x5ce0ad(_0x4ec6ba[_0xa79e('0x18')][_0xa79e('0x1a')]);}else{logger[_0xa79e('0x12')](_0xa79e('0x13'),_0x528ee0,'request\x20sent');_0x5ce0ad(_0x4ec6ba[_0xa79e('0x1b')][_0xa79e('0x1a')]);}})['catch'](function(_0x4f4ff6){logger[_0xa79e('0x18')](_0xa79e('0x13'),_0x528ee0,_0x4f4ff6);_0x3486c2(_0x4f4ff6);});});} \ No newline at end of file +var _0x1ac7=['error','code','DashboardItem,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','request','then','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ac7,0x11e));var _0x71ac=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x1ac7[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0x71ac('0x0'));var util=require(_0x71ac('0x1'));var moment=require(_0x71ac('0x2'));var BPromise=require(_0x71ac('0x3'));var rs=require(_0x71ac('0x4'));var fs=require('fs');var Redis=require(_0x71ac('0x5'));var db=require(_0x71ac('0x6'))['db'];var utils=require(_0x71ac('0x7'));var logger=require(_0x71ac('0x8'))(_0x71ac('0x9'));var config=require(_0x71ac('0xa'));var jayson=require(_0x71ac('0xb'));var client=jayson[_0x71ac('0xc')][_0x71ac('0xd')]({'port':0x232a});config[_0x71ac('0xe')]=_[_0x71ac('0xf')](config[_0x71ac('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x71ac('0x10'))(new Redis(config[_0x71ac('0xe')]));require(_0x71ac('0x11'))['register'](socket);function respondWithRpcPromise(_0x455013,_0x352409,_0x5265d4){return new BPromise(function(_0x114b32,_0x5a69b4){return client[_0x71ac('0x12')](_0x455013,_0x5265d4)[_0x71ac('0x13')](function(_0x236d48){logger['info']('DashboardItem,\x20%s,\x20%s',_0x352409,_0x71ac('0x14'));logger['debug'](_0x71ac('0x15'),_0x352409,_0x71ac('0x14'),JSON['stringify'](_0x236d48));if(_0x236d48[_0x71ac('0x16')]){if(_0x236d48[_0x71ac('0x16')][_0x71ac('0x17')]===0x1f4){logger[_0x71ac('0x16')](_0x71ac('0x18'),_0x352409,_0x236d48[_0x71ac('0x16')]['message']);return _0x5a69b4(_0x236d48[_0x71ac('0x16')][_0x71ac('0x19')]);}logger[_0x71ac('0x16')](_0x71ac('0x18'),_0x352409,_0x236d48[_0x71ac('0x16')][_0x71ac('0x19')]);return _0x114b32(_0x236d48['error'][_0x71ac('0x19')]);}else{logger[_0x71ac('0x1a')](_0x71ac('0x18'),_0x352409,_0x71ac('0x14'));_0x114b32(_0x236d48['result']['message']);}})[_0x71ac('0x1b')](function(_0x27d31d){logger[_0x71ac('0x16')](_0x71ac('0x18'),_0x352409,_0x27d31d);_0x5a69b4(_0x27d31d);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 66a569e..9ab8325 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 _0x67f5=['dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','register','length'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x67f5,0x1de));var _0x567f=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x67f5[_0x47e7cb];return _0x2a8874;};'use strict';var DashboardItemEvents=require(_0x567f('0x0'));var events=[_0x567f('0x1'),_0x567f('0x2'),_0x567f('0x3')];function createListener(_0xb693bf,_0x369392){return function(_0x155ba2){_0x369392[_0x567f('0x4')](_0xb693bf,_0x155ba2);};}function removeListener(_0x467b28,_0x182848){return function(){DashboardItemEvents[_0x567f('0x5')](_0x467b28,_0x182848);};}exports[_0x567f('0x6')]=function(_0x284ecf){for(var _0x55b8f5=0x0,_0x5753d2=events[_0x567f('0x7')];_0x55b8f5<_0x5753d2;_0x55b8f5++){var _0x1201e7=events[_0x55b8f5];var _0x196237=createListener(_0x567f('0x8')+_0x1201e7,_0x284ecf);DashboardItemEvents['on'](_0x1201e7,_0x196237);}}; \ No newline at end of file +var _0x5f64=['./dashboardItem.events','remove','update','emit','removeListener','length'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x5f64,0x180));var _0x45f6=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x5f64[_0x2bf141];return _0x48277b;};'use strict';var DashboardItemEvents=require(_0x45f6('0x0'));var events=['save',_0x45f6('0x1'),_0x45f6('0x2')];function createListener(_0x25ed5e,_0x7cb6c4){return function(_0x228688){_0x7cb6c4[_0x45f6('0x3')](_0x25ed5e,_0x228688);};}function removeListener(_0x54e06e,_0x50a7ef){return function(){DashboardItemEvents[_0x45f6('0x4')](_0x54e06e,_0x50a7ef);};}exports['register']=function(_0x4d8323){for(var _0xdca9cb=0x0,_0x35383a=events[_0x45f6('0x5')];_0xdca9cb<_0x35383a;_0xdca9cb++){var _0x184cd3=events[_0xdca9cb];var _0x5134d0=createListener('dashboardItem:'+_0x184cd3,_0x4d8323);DashboardItemEvents['on'](_0x184cd3,_0x5134d0);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index bfe592c..9f6e70a 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 _0x3f8a=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x447e7c,_0x413259){_0x447e7c=_0x447e7c-0x0;var _0x2d7330=_0x3f8a[_0x447e7c];return _0x2d7330;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')](_0xa3f8('0xa'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xd')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xf')](_0xa3f8('0xa'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router[_0xa3f8('0x11')]('/:id',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x12')]);module[_0xa3f8('0x13')]=router; \ No newline at end of file +var _0x4975=['/:id','show','isAuthenticated','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x4975,0x86));var _0x5497=function(_0x43c994,_0x5cde16){_0x43c994=_0x43c994-0x0;var _0x4917cc=_0x4975[_0x43c994];return _0x4917cc;};'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')](_0x5497('0xa'),auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['post']('/',auth[_0x5497('0xc')](),controller[_0x5497('0xd')]);router[_0x5497('0xe')]('/:id',auth[_0x5497('0xc')](),controller['update']);router[_0x5497('0xf')](_0x5497('0xa'),auth[_0x5497('0xc')](),controller[_0x5497('0x10')]);module[_0x5497('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 7cf5532..e104d5e 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 _0x69d0=['sequelize','exports','STRING'];(function(_0x259d11,_0x222597){var _0x34f70c=function(_0x5b6321){while(--_0x5b6321){_0x259d11['push'](_0x259d11['shift']());}};_0x34f70c(++_0x222597);}(_0x69d0,0x1b9));var _0x069d=function(_0x58a1de,_0xd7bc68){_0x58a1de=_0x58a1de-0x0;var _0x510813=_0x69d0[_0x58a1de];return _0x510813;};'use strict';var Sequelize=require(_0x069d('0x0'));module[_0x069d('0x1')]={'name':{'type':Sequelize[_0x069d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5e59=['exports','STRING','sequelize'];(function(_0x357979,_0x56feef){var _0xabb42f=function(_0x447f9d){while(--_0x447f9d){_0x357979['push'](_0x357979['shift']());}};_0xabb42f(++_0x56feef);}(_0x5e59,0xcb));var _0x95e5=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x5e59[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require(_0x95e5('0x0'));module[_0x95e5('0x1')]={'name':{'type':Sequelize[_0x95e5('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 29000d9..a6ee307 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 _0x5075=['model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Dispositions','UserProfileResource','name','send','index','map','Disposition','rawAttributes','key'];(function(_0x406493,_0x186a9d){var _0xdc8c8e=function(_0x44f96d){while(--_0x44f96d){_0x406493['push'](_0x406493['shift']());}};_0xdc8c8e(++_0x186a9d);}(_0x5075,0x73));var _0x5507=function(_0x2ace72,_0x814809){_0x2ace72=_0x2ace72-0x0;var _0x33d102=_0x5075[_0x2ace72];return _0x33d102;};'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 db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37a1de,_0x2a2ea0){_0x2a2ea0=_0x2a2ea0||0xcc;return function(_0x32c872){if(_0x32c872){return _0x37a1de[_0x5507('0x17')](_0x2a2ea0);}return _0x37a1de[_0x5507('0x18')](_0x2a2ea0)[_0x5507('0x19')]();};}function respondWithResult(_0x59889b,_0x9cc3f9){_0x9cc3f9=_0x9cc3f9||0xc8;return function(_0x2b7c43){if(_0x2b7c43){return _0x59889b[_0x5507('0x18')](_0x9cc3f9)[_0x5507('0x1a')](_0x2b7c43);}};}function respondWithFilteredResult(_0x4df473,_0x49e400){return function(_0x10d7b9){if(_0x10d7b9){var _0x2dfd06=_0x10d7b9[_0x5507('0x1b')],_0x1ab167=_0x49e400[_0x5507('0x1c')],_0xa6e4b3=_0x49e400[_0x5507('0x1c')]+_0x49e400[_0x5507('0x1d')],_0x2ede34;if(_0xa6e4b3>=_0x2dfd06){_0xa6e4b3=_0x2dfd06;_0x2ede34=0xc8;}else{_0x2ede34=0xce;}_0x4df473[_0x5507('0x18')](_0x2ede34);return _0x4df473[_0x5507('0x1e')](_0x5507('0x1f'),_0x1ab167+'-'+_0xa6e4b3+'/'+_0x2dfd06)['json'](_0x10d7b9);}return null;};}function patchUpdates(_0x14dab0){return function(_0x276a81){try{jsonpatch[_0x5507('0x20')](_0x276a81,_0x14dab0,!![]);}catch(_0x193eda){return BPromise['reject'](_0x193eda);}return _0x276a81[_0x5507('0x21')]();};}function saveUpdates(_0x1af06e,_0x1a54b0){return function(_0x3ca1f7){if(_0x3ca1f7){return _0x3ca1f7[_0x5507('0x22')](_0x1af06e)[_0x5507('0x23')](function(_0x501a94){return _0x501a94;});}return null;};}function removeEntity(_0x475970,_0x105535){return function(_0x1f6325){if(_0x1f6325){return _0x1f6325[_0x5507('0x24')]()[_0x5507('0x23')](function(){var _0x2de482=_0x1f6325[_0x5507('0x25')]({'plain':!![]});var _0x10f149=_0x5507('0x26');return db[_0x5507('0x27')][_0x5507('0x24')]({'where':{'type':_0x10f149,'resourceId':_0x2de482['id']}})[_0x5507('0x23')](function(){return _0x1f6325;});})[_0x5507('0x23')](function(){_0x475970[_0x5507('0x18')](0xcc)[_0x5507('0x19')]();});}};}function handleEntityNotFound(_0x4915ed,_0x4e8906){return function(_0x5b74c0){if(!_0x5b74c0){_0x4915ed[_0x5507('0x17')](0x194);}return _0x5b74c0;};}function handleError(_0x4ea271,_0xa66a01){_0xa66a01=_0xa66a01||0x1f4;return function(_0x24668b){logger['error'](_0x24668b['stack']);if(_0x24668b[_0x5507('0x28')]){delete _0x24668b[_0x5507('0x28')];}_0x4ea271['status'](_0xa66a01)[_0x5507('0x29')](_0x24668b);};}exports[_0x5507('0x2a')]=function(_0x85d383,_0x38f4d9){var _0x1e5ce6={},_0x14fdea={},_0x55e889={'count':0x0,'rows':[]};var _0x4422ef=_[_0x5507('0x2b')](db[_0x5507('0x2c')][_0x5507('0x2d')],function(_0x29dd58){return{'name':_0x29dd58['fieldName'],'type':_0x29dd58['type'][_0x5507('0x2e')]};});_0x14fdea[_0x5507('0x2f')]=_[_0x5507('0x2b')](_0x4422ef,_0x5507('0x28'));_0x14fdea['query']=_[_0x5507('0x30')](_0x85d383[_0x5507('0x31')]);_0x14fdea[_0x5507('0x32')]=_[_0x5507('0x33')](_0x14fdea[_0x5507('0x2f')],_0x14fdea[_0x5507('0x31')]);_0x1e5ce6[_0x5507('0x34')]=_[_0x5507('0x33')](_0x14fdea['model'],qs[_0x5507('0x35')](_0x85d383[_0x5507('0x31')][_0x5507('0x35')]));_0x1e5ce6['attributes']=_0x1e5ce6['attributes'][_0x5507('0x36')]?_0x1e5ce6[_0x5507('0x34')]:_0x14fdea[_0x5507('0x2f')];if(!_0x85d383[_0x5507('0x31')][_0x5507('0x37')]('nolimit')){_0x1e5ce6['limit']=qs[_0x5507('0x1d')](_0x85d383[_0x5507('0x31')][_0x5507('0x1d')]);_0x1e5ce6[_0x5507('0x1c')]=qs['offset'](_0x85d383['query'][_0x5507('0x1c')]);}_0x1e5ce6['order']=qs[_0x5507('0x38')](_0x85d383[_0x5507('0x31')][_0x5507('0x38')]);_0x1e5ce6[_0x5507('0x39')]=qs[_0x5507('0x32')](_[_0x5507('0x3a')](_0x85d383[_0x5507('0x31')],_0x14fdea[_0x5507('0x32')]));if(_0x85d383[_0x5507('0x31')][_0x5507('0x3b')]){_0x1e5ce6['where']=_['merge'](_0x1e5ce6['where'],{'$or':_['map'](_0x4422ef,function(_0x526022){if(_0x526022[_0x5507('0x3c')]!==_0x5507('0x3d')){var _0x854262={};_0x854262[_0x526022[_0x5507('0x28')]]={'$like':'%'+_0x85d383[_0x5507('0x31')][_0x5507('0x3b')]+'%'};return _0x854262;}})});}_0x1e5ce6=_[_0x5507('0x3e')]({},_0x1e5ce6,_0x85d383[_0x5507('0x3f')]);var _0x84db0a={'where':_0x1e5ce6[_0x5507('0x39')]};return db[_0x5507('0x2c')][_0x5507('0x1b')](_0x84db0a)[_0x5507('0x23')](function(_0x4fe79b){_0x55e889['count']=_0x4fe79b;if(_0x85d383['query'][_0x5507('0x40')]){_0x1e5ce6[_0x5507('0x41')]=[{'all':!![]}];}return db[_0x5507('0x2c')][_0x5507('0x42')](_0x1e5ce6);})[_0x5507('0x23')](function(_0x17d7db){_0x55e889[_0x5507('0x43')]=_0x17d7db;return _0x55e889;})[_0x5507('0x23')](respondWithFilteredResult(_0x38f4d9,_0x1e5ce6))[_0x5507('0x44')](handleError(_0x38f4d9,null));};exports[_0x5507('0x45')]=function(_0x1a2df8,_0x192a00){var _0x24d7b5={'raw':!![],'where':{'id':_0x1a2df8[_0x5507('0x46')]['id']}},_0x25496b={};_0x25496b[_0x5507('0x2f')]=_[_0x5507('0x30')](db[_0x5507('0x2c')][_0x5507('0x2d')]);_0x25496b['query']=_[_0x5507('0x30')](_0x1a2df8[_0x5507('0x31')]);_0x25496b['filters']=_['intersection'](_0x25496b[_0x5507('0x2f')],_0x25496b[_0x5507('0x31')]);_0x24d7b5[_0x5507('0x34')]=_[_0x5507('0x33')](_0x25496b[_0x5507('0x2f')],qs['fields'](_0x1a2df8[_0x5507('0x31')][_0x5507('0x35')]));_0x24d7b5[_0x5507('0x34')]=_0x24d7b5['attributes'][_0x5507('0x36')]?_0x24d7b5[_0x5507('0x34')]:_0x25496b[_0x5507('0x2f')];if(_0x1a2df8[_0x5507('0x31')][_0x5507('0x40')]){_0x24d7b5['include']=[{'all':!![]}];}_0x24d7b5=_[_0x5507('0x3e')]({},_0x24d7b5,_0x1a2df8['options']);return db[_0x5507('0x2c')][_0x5507('0x47')](_0x24d7b5)[_0x5507('0x23')](handleEntityNotFound(_0x192a00,null))[_0x5507('0x23')](respondWithResult(_0x192a00,null))[_0x5507('0x44')](handleError(_0x192a00,null));};exports[_0x5507('0x48')]=function(_0x418c2e,_0x3452e4){return db['Disposition'][_0x5507('0x48')](_0x418c2e[_0x5507('0x49')],{})['then'](function(_0x4a2d14){var _0x4e5825=_0x418c2e[_0x5507('0x4a')]['get']({'plain':!![]});if(!_0x4e5825)throw new Error(_0x5507('0x4b'));if(_0x4e5825['role']===_0x5507('0x4a')){var _0x55f8c2=_0x4a2d14['get']({'plain':!![]});var _0x3b98ae=_0x5507('0x26');return db[_0x5507('0x4c')][_0x5507('0x47')]({'where':{'name':_0x3b98ae,'userProfileId':_0x4e5825[_0x5507('0x4d')]},'raw':!![]})[_0x5507('0x23')](function(_0x57819a){if(_0x57819a&&_0x57819a[_0x5507('0x4e')]===0x0){return db[_0x5507('0x27')][_0x5507('0x48')]({'name':_0x55f8c2['name'],'resourceId':_0x55f8c2['id'],'type':_0x57819a[_0x5507('0x28')],'sectionId':_0x57819a['id']},{})[_0x5507('0x23')](function(){return _0x4a2d14;});}else{return _0x4a2d14;}})[_0x5507('0x44')](function(_0x2e0cfc){logger[_0x5507('0x4f')](_0x5507('0x50'),_0x2e0cfc);throw _0x2e0cfc;});}return _0x4a2d14;})[_0x5507('0x23')](respondWithResult(_0x3452e4,0xc9))[_0x5507('0x44')](handleError(_0x3452e4,null));};exports[_0x5507('0x22')]=function(_0x245456,_0x1bb575){if(_0x245456['body']['id']){delete _0x245456['body']['id'];}return db[_0x5507('0x2c')][_0x5507('0x47')]({'where':{'id':_0x245456[_0x5507('0x46')]['id']}})[_0x5507('0x23')](handleEntityNotFound(_0x1bb575,null))[_0x5507('0x23')](saveUpdates(_0x245456[_0x5507('0x49')],null))[_0x5507('0x23')](respondWithResult(_0x1bb575,null))[_0x5507('0x44')](handleError(_0x1bb575,null));};exports[_0x5507('0x24')]=function(_0x35f2e5,_0x40cda2){return db[_0x5507('0x2c')][_0x5507('0x47')]({'where':{'id':_0x35f2e5[_0x5507('0x46')]['id']}})[_0x5507('0x23')](handleEntityNotFound(_0x40cda2,null))[_0x5507('0x23')](removeEntity(_0x40cda2,null))['catch'](handleError(_0x40cda2,null));}; \ No newline at end of file +var _0xed1f=['length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','end','count','offset','limit','status','apply','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','Disposition','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xed1f,0x6a));var _0xfed1=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xed1f[_0x5f3f88];return _0xd08119;};'use strict';var pdf=require(_0xfed1('0x0'));var emlformat=require(_0xfed1('0x1'));var rimraf=require(_0xfed1('0x2'));var zipdir=require(_0xfed1('0x3'));var jsonpatch=require(_0xfed1('0x4'));var rp=require(_0xfed1('0x5'));var moment=require(_0xfed1('0x6'));var BPromise=require(_0xfed1('0x7'));var Mustache=require(_0xfed1('0x8'));var util=require(_0xfed1('0x9'));var path=require(_0xfed1('0xa'));var sox=require(_0xfed1('0xb'));var csv=require(_0xfed1('0xc'));var ejs=require(_0xfed1('0xd'));var fs=require('fs');var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xc'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfed1('0x18'))['db'];function respondWithStatusCode(_0xe84ba6,_0x569a6e){_0x569a6e=_0x569a6e||0xcc;return function(_0x17f4fe){if(_0x17f4fe){return _0xe84ba6['sendStatus'](_0x569a6e);}return _0xe84ba6['status'](_0x569a6e)[_0xfed1('0x19')]();};}function respondWithResult(_0x397af9,_0x532537){_0x532537=_0x532537||0xc8;return function(_0x2dde3a){if(_0x2dde3a){return _0x397af9['status'](_0x532537)['json'](_0x2dde3a);}};}function respondWithFilteredResult(_0xde25db,_0x39aa0c){return function(_0x1fbb7a){if(_0x1fbb7a){var _0x123c46=_0x1fbb7a[_0xfed1('0x1a')],_0x582e67=_0x39aa0c[_0xfed1('0x1b')],_0x1a00f6=_0x39aa0c['offset']+_0x39aa0c[_0xfed1('0x1c')],_0x4af928;if(_0x1a00f6>=_0x123c46){_0x1a00f6=_0x123c46;_0x4af928=0xc8;}else{_0x4af928=0xce;}_0xde25db[_0xfed1('0x1d')](_0x4af928);return _0xde25db['set']('Content-Range',_0x582e67+'-'+_0x1a00f6+'/'+_0x123c46)['json'](_0x1fbb7a);}return null;};}function patchUpdates(_0x1e5afb){return function(_0x51f12a){try{jsonpatch[_0xfed1('0x1e')](_0x51f12a,_0x1e5afb,!![]);}catch(_0x34fa04){return BPromise['reject'](_0x34fa04);}return _0x51f12a[_0xfed1('0x1f')]();};}function saveUpdates(_0x65f14b,_0x59ee9d){return function(_0x3ce944){if(_0x3ce944){return _0x3ce944[_0xfed1('0x20')](_0x65f14b)[_0xfed1('0x21')](function(_0x92b92d){return _0x92b92d;});}return null;};}function removeEntity(_0x4bac79,_0x203cec){return function(_0x59333e){if(_0x59333e){return _0x59333e[_0xfed1('0x22')]()[_0xfed1('0x21')](function(){var _0x37c384=_0x59333e['get']({'plain':!![]});var _0x41d22c='Dispositions';return db[_0xfed1('0x23')][_0xfed1('0x22')]({'where':{'type':_0x41d22c,'resourceId':_0x37c384['id']}})[_0xfed1('0x21')](function(){return _0x59333e;});})[_0xfed1('0x21')](function(){_0x4bac79[_0xfed1('0x1d')](0xcc)[_0xfed1('0x19')]();});}};}function handleEntityNotFound(_0x527fc7,_0x465ce6){return function(_0xcb1cdc){if(!_0xcb1cdc){_0x527fc7['sendStatus'](0x194);}return _0xcb1cdc;};}function handleError(_0x1d6c72,_0x2b9dd2){_0x2b9dd2=_0x2b9dd2||0x1f4;return function(_0x1b871a){logger[_0xfed1('0x24')](_0x1b871a[_0xfed1('0x25')]);if(_0x1b871a[_0xfed1('0x26')]){delete _0x1b871a['name'];}_0x1d6c72[_0xfed1('0x1d')](_0x2b9dd2)['send'](_0x1b871a);};}exports[_0xfed1('0x27')]=function(_0x4e5249,_0x53b0c9){var _0x1cec64={},_0x42c950={},_0x2d334e={'count':0x0,'rows':[]};var _0x599c23=_[_0xfed1('0x28')](db[_0xfed1('0x29')][_0xfed1('0x2a')],function(_0x383955){return{'name':_0x383955[_0xfed1('0x2b')],'type':_0x383955[_0xfed1('0x2c')]['key']};});_0x42c950[_0xfed1('0x2d')]=_[_0xfed1('0x28')](_0x599c23,'name');_0x42c950['query']=_[_0xfed1('0x2e')](_0x4e5249[_0xfed1('0x2f')]);_0x42c950[_0xfed1('0x30')]=_[_0xfed1('0x31')](_0x42c950[_0xfed1('0x2d')],_0x42c950['query']);_0x1cec64[_0xfed1('0x32')]=_[_0xfed1('0x31')](_0x42c950[_0xfed1('0x2d')],qs[_0xfed1('0x33')](_0x4e5249[_0xfed1('0x2f')]['fields']));_0x1cec64[_0xfed1('0x32')]=_0x1cec64['attributes'][_0xfed1('0x34')]?_0x1cec64[_0xfed1('0x32')]:_0x42c950[_0xfed1('0x2d')];if(!_0x4e5249[_0xfed1('0x2f')][_0xfed1('0x35')](_0xfed1('0x36'))){_0x1cec64[_0xfed1('0x1c')]=qs[_0xfed1('0x1c')](_0x4e5249['query'][_0xfed1('0x1c')]);_0x1cec64[_0xfed1('0x1b')]=qs[_0xfed1('0x1b')](_0x4e5249[_0xfed1('0x2f')]['offset']);}_0x1cec64['order']=qs[_0xfed1('0x37')](_0x4e5249[_0xfed1('0x2f')][_0xfed1('0x37')]);_0x1cec64[_0xfed1('0x38')]=qs[_0xfed1('0x30')](_[_0xfed1('0x39')](_0x4e5249[_0xfed1('0x2f')],_0x42c950[_0xfed1('0x30')]));if(_0x4e5249['query']['filter']){_0x1cec64[_0xfed1('0x38')]=_[_0xfed1('0x3a')](_0x1cec64['where'],{'$or':_[_0xfed1('0x28')](_0x599c23,function(_0x15339c){if(_0x15339c[_0xfed1('0x2c')]!==_0xfed1('0x3b')){var _0x2807c={};_0x2807c[_0x15339c[_0xfed1('0x26')]]={'$like':'%'+_0x4e5249[_0xfed1('0x2f')][_0xfed1('0x3c')]+'%'};return _0x2807c;}})});}_0x1cec64=_[_0xfed1('0x3a')]({},_0x1cec64,_0x4e5249['options']);var _0x4eec55={'where':_0x1cec64['where']};return db[_0xfed1('0x29')][_0xfed1('0x1a')](_0x4eec55)[_0xfed1('0x21')](function(_0x496a5d){_0x2d334e[_0xfed1('0x1a')]=_0x496a5d;if(_0x4e5249['query'][_0xfed1('0x3d')]){_0x1cec64[_0xfed1('0x3e')]=[{'all':!![]}];}return db[_0xfed1('0x29')]['findAll'](_0x1cec64);})[_0xfed1('0x21')](function(_0x6f1647){_0x2d334e[_0xfed1('0x3f')]=_0x6f1647;return _0x2d334e;})['then'](respondWithFilteredResult(_0x53b0c9,_0x1cec64))[_0xfed1('0x40')](handleError(_0x53b0c9,null));};exports['show']=function(_0x256b1d,_0xf1f739){var _0x229fc7={'raw':!![],'where':{'id':_0x256b1d[_0xfed1('0x41')]['id']}},_0x13c087={};_0x13c087[_0xfed1('0x2d')]=_[_0xfed1('0x2e')](db[_0xfed1('0x29')][_0xfed1('0x2a')]);_0x13c087['query']=_[_0xfed1('0x2e')](_0x256b1d[_0xfed1('0x2f')]);_0x13c087[_0xfed1('0x30')]=_['intersection'](_0x13c087['model'],_0x13c087[_0xfed1('0x2f')]);_0x229fc7[_0xfed1('0x32')]=_[_0xfed1('0x31')](_0x13c087[_0xfed1('0x2d')],qs[_0xfed1('0x33')](_0x256b1d[_0xfed1('0x2f')][_0xfed1('0x33')]));_0x229fc7[_0xfed1('0x32')]=_0x229fc7[_0xfed1('0x32')][_0xfed1('0x34')]?_0x229fc7[_0xfed1('0x32')]:_0x13c087[_0xfed1('0x2d')];if(_0x256b1d['query'][_0xfed1('0x3d')]){_0x229fc7[_0xfed1('0x3e')]=[{'all':!![]}];}_0x229fc7=_[_0xfed1('0x3a')]({},_0x229fc7,_0x256b1d[_0xfed1('0x42')]);return db[_0xfed1('0x29')][_0xfed1('0x43')](_0x229fc7)['then'](handleEntityNotFound(_0xf1f739,null))[_0xfed1('0x21')](respondWithResult(_0xf1f739,null))[_0xfed1('0x40')](handleError(_0xf1f739,null));};exports[_0xfed1('0x44')]=function(_0x4afcc1,_0x22874a){return db[_0xfed1('0x29')][_0xfed1('0x44')](_0x4afcc1[_0xfed1('0x45')],{})['then'](function(_0x2e0de7){var _0x2a346e=_0x4afcc1[_0xfed1('0x46')][_0xfed1('0x47')]({'plain':!![]});if(!_0x2a346e)throw new Error(_0xfed1('0x48'));if(_0x2a346e[_0xfed1('0x49')]===_0xfed1('0x46')){var _0x18d761=_0x2e0de7[_0xfed1('0x47')]({'plain':!![]});var _0x326f68=_0xfed1('0x4a');return db[_0xfed1('0x4b')][_0xfed1('0x43')]({'where':{'name':_0x326f68,'userProfileId':_0x2a346e[_0xfed1('0x4c')]},'raw':!![]})[_0xfed1('0x21')](function(_0x37418b){if(_0x37418b&&_0x37418b[_0xfed1('0x4d')]===0x0){return db[_0xfed1('0x23')]['create']({'name':_0x18d761['name'],'resourceId':_0x18d761['id'],'type':_0x37418b[_0xfed1('0x26')],'sectionId':_0x37418b['id']},{})[_0xfed1('0x21')](function(){return _0x2e0de7;});}else{return _0x2e0de7;}})[_0xfed1('0x40')](function(_0x1358c1){logger['error'](_0xfed1('0x4e'),_0x1358c1);throw _0x1358c1;});}return _0x2e0de7;})[_0xfed1('0x21')](respondWithResult(_0x22874a,0xc9))['catch'](handleError(_0x22874a,null));};exports['update']=function(_0x49f696,_0x2376b3){if(_0x49f696[_0xfed1('0x45')]['id']){delete _0x49f696[_0xfed1('0x45')]['id'];}return db[_0xfed1('0x29')][_0xfed1('0x43')]({'where':{'id':_0x49f696[_0xfed1('0x41')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x2376b3,null))[_0xfed1('0x21')](saveUpdates(_0x49f696[_0xfed1('0x45')],null))[_0xfed1('0x21')](respondWithResult(_0x2376b3,null))['catch'](handleError(_0x2376b3,null));};exports['destroy']=function(_0x30e869,_0x2a2eaa){return db[_0xfed1('0x29')][_0xfed1('0x43')]({'where':{'id':_0x30e869[_0xfed1('0x41')]['id']}})[_0xfed1('0x21')](handleEntityNotFound(_0x2a2eaa,null))[_0xfed1('0x21')](removeEntity(_0x2a2eaa,null))[_0xfed1('0x40')](handleError(_0x2a2eaa,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index ed5ed9e..f62a6b3 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 _0xdb37=['./disposition.attributes','exports','define','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb37,0xae));var _0x7db3=function(_0x12991b,_0x39bc73){_0x12991b=_0x12991b-0x0;var _0x1bde5f=_0xdb37[_0x12991b];return _0x1bde5f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7db3('0x0'))(_0x7db3('0x1'));var moment=require('moment');var BPromise=require(_0x7db3('0x2'));var rp=require(_0x7db3('0x3'));var fs=require('fs');var path=require(_0x7db3('0x4'));var rimraf=require(_0x7db3('0x5'));var config=require('../../config/environment');var attributes=require(_0x7db3('0x6'));module[_0x7db3('0x7')]=function(_0x3f1090,_0x3a6669){return _0x3f1090[_0x7db3('0x8')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x7db3('0x9'),'fields':[_0x7db3('0xa'),_0x7db3('0xb')]},{'unique':!![],'name':_0x7db3('0xc'),'fields':['name',_0x7db3('0xd')]},{'unique':!![],'name':'name_mail','fields':[_0x7db3('0xa'),_0x7db3('0xe')]},{'unique':!![],'name':'name_sms','fields':[_0x7db3('0xa'),_0x7db3('0xf')]},{'unique':!![],'name':_0x7db3('0x10'),'fields':[_0x7db3('0xa'),_0x7db3('0x11')]},{'unique':!![],'name':_0x7db3('0x12'),'fields':['name',_0x7db3('0x13')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f9d=['ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','Disposition','name','ListId','name_chat'];(function(_0x2b0f81,_0x3917f0){var _0x5ce74c=function(_0x12dc0d){while(--_0x12dc0d){_0x2b0f81['push'](_0x2b0f81['shift']());}};_0x5ce74c(++_0x3917f0);}(_0x8f9d,0x1d6));var _0xd8f9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8f9d[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xd8f9('0x0'));var util=require(_0xd8f9('0x1'));var logger=require('../../config/logger')(_0xd8f9('0x2'));var moment=require(_0xd8f9('0x3'));var BPromise=require('bluebird');var rp=require(_0xd8f9('0x4'));var fs=require('fs');var path=require(_0xd8f9('0x5'));var rimraf=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var attributes=require('./disposition.attributes');module[_0xd8f9('0x8')]=function(_0x38c817,_0x4aa25a){return _0x38c817['define'](_0xd8f9('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xd8f9('0xa'),_0xd8f9('0xb')]},{'unique':!![],'name':_0xd8f9('0xc'),'fields':[_0xd8f9('0xa'),_0xd8f9('0xd')]},{'unique':!![],'name':_0xd8f9('0xe'),'fields':[_0xd8f9('0xa'),'MailAccountId']},{'unique':!![],'name':_0xd8f9('0xf'),'fields':[_0xd8f9('0xa'),_0xd8f9('0x10')]},{'unique':!![],'name':_0xd8f9('0x11'),'fields':['name',_0xd8f9('0x12')]},{'unique':!![],'name':_0xd8f9('0x13'),'fields':['name',_0xd8f9('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 2226dec..dc331bd 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 _0x6bd3=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','util'];(function(_0x39b3bd,_0x1c307a){var _0x46c65d=function(_0x185209){while(--_0x185209){_0x39b3bd['push'](_0x39b3bd['shift']());}};_0x46c65d(++_0x1c307a);}(_0x6bd3,0x1de));var _0x36bd=function(_0x1e6b10,_0x4c284d){_0x1e6b10=_0x1e6b10-0x0;var _0x3c6396=_0x6bd3[_0x1e6b10];return _0x3c6396;};'use strict';var _=require(_0x36bd('0x0'));var util=require(_0x36bd('0x1'));var moment=require(_0x36bd('0x2'));var BPromise=require('bluebird');var rs=require(_0x36bd('0x3'));var fs=require('fs');var Redis=require(_0x36bd('0x4'));var db=require(_0x36bd('0x5'))['db'];var utils=require(_0x36bd('0x6'));var logger=require(_0x36bd('0x7'))(_0x36bd('0x8'));var config=require(_0x36bd('0x9'));var jayson=require(_0x36bd('0xa'));var client=jayson[_0x36bd('0xb')][_0x36bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b46bc,_0x4fb50e,_0x362265){return new BPromise(function(_0x4fc2cd,_0x4f0c5c){return client['request'](_0x1b46bc,_0x362265)[_0x36bd('0xd')](function(_0xf60601){logger[_0x36bd('0xe')](_0x36bd('0xf'),_0x4fb50e,_0x36bd('0x10'));logger[_0x36bd('0x11')]('Disposition,\x20%s,\x20%s,\x20%s',_0x4fb50e,'request\x20sent',JSON[_0x36bd('0x12')](_0xf60601));if(_0xf60601['error']){if(_0xf60601['error'][_0x36bd('0x13')]===0x1f4){logger[_0x36bd('0x14')](_0x36bd('0xf'),_0x4fb50e,_0xf60601[_0x36bd('0x14')]['message']);return _0x4f0c5c(_0xf60601[_0x36bd('0x14')]['message']);}logger['error'](_0x36bd('0xf'),_0x4fb50e,_0xf60601[_0x36bd('0x14')][_0x36bd('0x15')]);return _0x4fc2cd(_0xf60601[_0x36bd('0x14')][_0x36bd('0x15')]);}else{logger[_0x36bd('0xe')](_0x36bd('0xf'),_0x4fb50e,'request\x20sent');_0x4fc2cd(_0xf60601[_0x36bd('0x16')][_0x36bd('0x15')]);}})[_0x36bd('0x17')](function(_0x4eef9d){logger['error']('Disposition,\x20%s,\x20%s',_0x4fb50e,_0x4eef9d);_0x4f0c5c(_0x4eef9d);});});} \ No newline at end of file +var _0xd34c=['request','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http'];(function(_0x51c5a6,_0x5413c7){var _0x3edab7=function(_0x4400df){while(--_0x4400df){_0x51c5a6['push'](_0x51c5a6['shift']());}};_0x3edab7(++_0x5413c7);}(_0xd34c,0xab));var _0xcd34=function(_0x5db800,_0x9c38a4){_0x5db800=_0x5db800-0x0;var _0x2195d9=_0xd34c[_0x5db800];return _0x2195d9;};'use strict';var _=require(_0xcd34('0x0'));var util=require(_0xcd34('0x1'));var moment=require('moment');var BPromise=require(_0xcd34('0x2'));var rs=require(_0xcd34('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd34('0x4'))['db'];var utils=require(_0xcd34('0x5'));var logger=require(_0xcd34('0x6'))(_0xcd34('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xcd34('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2bb9fb,_0x1fd55c,_0x55028c){return new BPromise(function(_0x167e61,_0x30e2d5){return client[_0xcd34('0x9')](_0x2bb9fb,_0x55028c)['then'](function(_0x540918){logger['info'](_0xcd34('0xa'),_0x1fd55c,_0xcd34('0xb'));logger[_0xcd34('0xc')](_0xcd34('0xd'),_0x1fd55c,'request\x20sent',JSON[_0xcd34('0xe')](_0x540918));if(_0x540918[_0xcd34('0xf')]){if(_0x540918[_0xcd34('0xf')][_0xcd34('0x10')]===0x1f4){logger[_0xcd34('0xf')](_0xcd34('0xa'),_0x1fd55c,_0x540918['error']['message']);return _0x30e2d5(_0x540918['error']['message']);}logger[_0xcd34('0xf')](_0xcd34('0xa'),_0x1fd55c,_0x540918['error'][_0xcd34('0x11')]);return _0x167e61(_0x540918[_0xcd34('0xf')][_0xcd34('0x11')]);}else{logger[_0xcd34('0x12')](_0xcd34('0xa'),_0x1fd55c,_0xcd34('0xb'));_0x167e61(_0x540918[_0xcd34('0x13')][_0xcd34('0x11')]);}})['catch'](function(_0x59180c){logger[_0xcd34('0xf')](_0xcd34('0xa'),_0x1fd55c,_0x59180c);_0x30e2d5(_0x59180c);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 00799b7..c795d8b 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 _0x3266=['../../config/environment','get','index','/:id','show','isAuthenticated','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x43ed38,_0x507af1){var _0x181497=function(_0x153d8e){while(--_0x153d8e){_0x43ed38['push'](_0x43ed38['shift']());}};_0x181497(++_0x507af1);}(_0x3266,0x6a));var _0x6326=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0x3266[_0x31eb67];return _0x2a8cb8;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var auth=require(_0x6326('0x6'));var interaction=require(_0x6326('0x7'));var config=require(_0x6326('0x8'));var controller=require('./disposition.controller');router[_0x6326('0x9')]('/',auth['isAuthenticated'](),controller[_0x6326('0xa')]);router[_0x6326('0x9')](_0x6326('0xb'),auth['isAuthenticated'](),controller[_0x6326('0xc')]);router['post']('/',auth[_0x6326('0xd')](),controller[_0x6326('0xe')]);router[_0x6326('0xf')](_0x6326('0xb'),auth[_0x6326('0xd')](),controller['update']);router[_0x6326('0x10')](_0x6326('0xb'),auth[_0x6326('0xd')](),controller[_0x6326('0x11')]);module[_0x6326('0x12')]=router; \ No newline at end of file +var _0x8579=['Router','../../components/auth/service','isAuthenticated','index','get','/:id','show','create','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0xdeb4c9,_0x4c1740){var _0x335f74=function(_0x59f98a){while(--_0x59f98a){_0xdeb4c9['push'](_0xdeb4c9['shift']());}};_0x335f74(++_0x4c1740);}(_0x8579,0x16c));var _0x9857=function(_0x259bcf,_0x574802){_0x259bcf=_0x259bcf-0x0;var _0x41df16=_0x8579[_0x259bcf];return _0x41df16;};'use strict';var multer=require(_0x9857('0x0'));var util=require(_0x9857('0x1'));var path=require('path');var timeout=require(_0x9857('0x2'));var express=require(_0x9857('0x3'));var router=express[_0x9857('0x4')]();var auth=require(_0x9857('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router['get']('/',auth[_0x9857('0x6')](),controller[_0x9857('0x7')]);router[_0x9857('0x8')](_0x9857('0x9'),auth[_0x9857('0x6')](),controller[_0x9857('0xa')]);router['post']('/',auth[_0x9857('0x6')](),controller[_0x9857('0xb')]);router[_0x9857('0xc')](_0x9857('0x9'),auth[_0x9857('0x6')](),controller[_0x9857('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9857('0xe')]);module[_0x9857('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 55c2a29..71f9fb1 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 _0x2d68=['mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','12000','14400','7200','9600','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2d68,0x1ac));var _0x82d6=function(_0x1f57e7,_0x31455f){_0x1f57e7=_0x1f57e7-0x0;var _0xc38613=_0x2d68[_0x1f57e7];return _0xc38613;};'use strict';var Sequelize=require(_0x82d6('0x0'));module[_0x82d6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x82d6('0x2')]},'ecm':{'type':Sequelize[_0x82d6('0x3')](_0x82d6('0x4'),'no'),'defaultValue':_0x82d6('0x4')},'headerinfo':{'type':Sequelize[_0x82d6('0x2')],'defaultValue':_0x82d6('0x5')},'localstationid':{'type':Sequelize[_0x82d6('0x2')],'unique':_0x82d6('0x6')},'minrate':{'type':Sequelize[_0x82d6('0x3')](_0x82d6('0x7'),_0x82d6('0x8'),'7200','9600',_0x82d6('0x9'),_0x82d6('0xa')),'defaultValue':_0x82d6('0x8')},'maxrate':{'type':Sequelize[_0x82d6('0x3')](_0x82d6('0x7'),_0x82d6('0x8'),_0x82d6('0xb'),_0x82d6('0xc'),_0x82d6('0x9'),_0x82d6('0xa')),'defaultValue':_0x82d6('0xa')},'modem':{'type':Sequelize[_0x82d6('0x2')],'defaultValue':_0x82d6('0xd')},'gateway':{'type':Sequelize[_0x82d6('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x82d6('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x82d6('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x82d6('0x3')](_0x82d6('0xf'),_0x82d6('0x10'),_0x82d6('0x11'),_0x82d6('0x12')),'defaultValue':_0x82d6('0xf')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x82d6('0x13');}},'notificationSound':{'type':Sequelize[_0x82d6('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x82d6('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x82d6('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x82d6('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x82d6('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x82d6('0xe')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x82d6('0x14')],'defaultValue':![],'comment':_0x82d6('0x15'),'set':function(_0x5cfb28){if(!_0x5cfb28)this['setDataValue'](_0x82d6('0x16'),null);this[_0x82d6('0x17')](_0x82d6('0x18'),_0x5cfb28);}}}; \ No newline at end of file +var _0x4205=['ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','12000','14400','9600','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4205,0x137));var _0x5420=function(_0x558950,_0x42aaef){_0x558950=_0x558950-0x0;var _0x2f2efc=_0x4205[_0x558950];return _0x2f2efc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5420('0x0')]},'ecm':{'type':Sequelize[_0x5420('0x1')](_0x5420('0x2'),'no'),'defaultValue':_0x5420('0x2')},'headerinfo':{'type':Sequelize[_0x5420('0x0')],'defaultValue':_0x5420('0x3')},'localstationid':{'type':Sequelize[_0x5420('0x0')],'unique':_0x5420('0x4')},'minrate':{'type':Sequelize[_0x5420('0x1')](_0x5420('0x5'),_0x5420('0x6'),_0x5420('0x7'),'9600',_0x5420('0x8'),_0x5420('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x5420('0x1')](_0x5420('0x5'),_0x5420('0x6'),_0x5420('0x7'),_0x5420('0xa'),_0x5420('0x8'),'14400'),'defaultValue':_0x5420('0x9')},'modem':{'type':Sequelize[_0x5420('0x0')],'defaultValue':_0x5420('0xb')},'gateway':{'type':Sequelize[_0x5420('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5420('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5420('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x5420('0x1')]('SIP',_0x5420('0xd'),_0x5420('0xe'),_0x5420('0xf')),'defaultValue':_0x5420('0x10')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5420('0x11')],'defaultValue':function(){return _0x5420('0x12');}},'notificationSound':{'type':Sequelize[_0x5420('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5420('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5420('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5420('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5420('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5420('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5420('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x5420('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x5420('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1404b6){if(!_0x1404b6)this[_0x5420('0x15')](_0x5420('0x16'),null);this[_0x5420('0x15')](_0x5420('0x17'),_0x1404b6);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 2ba7a03..813b705 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 _0x5946=['end','status','json','count','offset','limit','set','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','findAll','show','rawAttributes','length','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','pick','rows','ids','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','omit','CmContact','User','Owner','Tag','color','tag','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','system','description','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','key','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','ListId','Send\x20Fax\x20failed','Contact\x20not\x20found','spread','filename','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray','userFaxAccount:remove','emit','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus'];(function(_0x1e399a,_0x351c59){var _0x539897=function(_0x2986fa){while(--_0x2986fa){_0x1e399a['push'](_0x1e399a['shift']());}};_0x539897(++_0x351c59);}(_0x5946,0x8f));var _0x6594=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0x5946[_0x351b46];return _0x1515df;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6594('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6594('0x1'));var jsonpatch=require(_0x6594('0x2'));var rp=require(_0x6594('0x3'));var moment=require(_0x6594('0x4'));var BPromise=require(_0x6594('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6594('0x6'));var sox=require(_0x6594('0x7'));var csv=require(_0x6594('0x8'));var ejs=require(_0x6594('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6594('0xa'));var crypto=require('crypto');var jsforce=require(_0x6594('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6594('0xc'));var Papa=require(_0x6594('0xd'));var Redis=require(_0x6594('0xe'));var authService=require(_0x6594('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6594('0x10'));var hardwareService=require(_0x6594('0x11'));var logger=require(_0x6594('0x12'))(_0x6594('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x6594('0x14')](config[_0x6594('0x15')],{'host':_0x6594('0x16'),'port':0x18eb});var socket=require(_0x6594('0x17'))(new Redis(config[_0x6594('0x15')]));require(_0x6594('0x18'))[_0x6594('0x19')](socket);var jayson=require(_0x6594('0x1a'));var client=jayson[_0x6594('0x1b')][_0x6594('0x1c')]({'port':0x232c});var client9002=jayson[_0x6594('0x1b')][_0x6594('0x1c')]({'port':0x232a});function checkPasswordPattern(_0xbc777c,_0xd7f404,_0xb9313d){if(_0xb9313d){var _0x191860=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x191860[_0x6594('0x1d')](_0xd7f404)){return _0xbc777c;}else{throw new db[(_0x6594('0x1e'))][(_0x6594('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xbc777c;}}function respondWithRpcPromise(_0x292f8b,_0xc0cdd,_0x170e82,_0x2ea02c){return new BPromise(function(_0x58f8f2,_0x43e5d2){var _0x4dd45d=_0x2ea02c||client;return _0x4dd45d[_0x6594('0x20')](_0x292f8b,_0x170e82)[_0x6594('0x21')](function(_0x3053ee){logger[_0x6594('0x22')](_0x6594('0x23'),_0xc0cdd,_0x6594('0x24'));logger[_0x6594('0x25')](_0x6594('0x26'),_0xc0cdd,_0x6594('0x24'),JSON[_0x6594('0x27')](_0x3053ee));if(_0x3053ee[_0x6594('0x28')]){if(_0x3053ee[_0x6594('0x28')]['code']===0x1f4){logger[_0x6594('0x28')](_0x6594('0x23'),_0xc0cdd,_0x3053ee[_0x6594('0x28')][_0x6594('0x29')]);return _0x43e5d2(_0x3053ee[_0x6594('0x28')][_0x6594('0x29')]);}logger['error'](_0x6594('0x23'),_0xc0cdd,_0x3053ee['error'][_0x6594('0x29')]);return _0x58f8f2(_0x3053ee[_0x6594('0x28')][_0x6594('0x29')]);}else{logger[_0x6594('0x22')](_0x6594('0x23'),_0xc0cdd,_0x6594('0x24'));_0x58f8f2(_0x3053ee['result']['message']);}})[_0x6594('0x2a')](function(_0x575017){logger['error'](_0x6594('0x23'),_0xc0cdd,_0x575017);_0x43e5d2(_0x575017);});});}function respondWithStatusCode(_0x49e3ec,_0x431bcb){_0x431bcb=_0x431bcb||0xcc;return function(_0x2781d5){if(_0x2781d5){return _0x49e3ec[_0x6594('0x2b')](_0x431bcb);}return _0x49e3ec['status'](_0x431bcb)[_0x6594('0x2c')]();};}function respondWithResult(_0x473efd,_0x1193ac){_0x1193ac=_0x1193ac||0xc8;return function(_0x1ce5ce){if(_0x1ce5ce){return _0x473efd[_0x6594('0x2d')](_0x1193ac)[_0x6594('0x2e')](_0x1ce5ce);}};}function respondWithFilteredResult(_0x40e891,_0x1492ac){return function(_0x94c294){if(_0x94c294){var _0x590603=_0x94c294[_0x6594('0x2f')],_0x299a55=_0x1492ac[_0x6594('0x30')],_0x53467e=_0x1492ac[_0x6594('0x30')]+_0x1492ac[_0x6594('0x31')],_0x3752eb;if(_0x53467e>=_0x590603){_0x53467e=_0x590603;_0x3752eb=0xc8;}else{_0x3752eb=0xce;}_0x40e891[_0x6594('0x2d')](_0x3752eb);return _0x40e891[_0x6594('0x32')]('Content-Range',_0x299a55+'-'+_0x53467e+'/'+_0x590603)[_0x6594('0x2e')](_0x94c294);}return null;};}function patchUpdates(_0x4e30d7){return function(_0x3c6068){try{jsonpatch['apply'](_0x3c6068,_0x4e30d7,!![]);}catch(_0x4940e7){return BPromise[_0x6594('0x33')](_0x4940e7);}return _0x3c6068['save']();};}function saveUpdates(_0x13c43a,_0x3cba5a){return function(_0x91dba7){if(_0x91dba7){return _0x91dba7[_0x6594('0x34')](_0x13c43a)[_0x6594('0x21')](function(_0x310ec5){return _0x310ec5;});}return null;};}function removeEntity(_0x2189c0,_0x435e04){return function(_0x4caeb0){if(_0x4caeb0){return _0x4caeb0[_0x6594('0x35')]()[_0x6594('0x21')](function(){var _0x54b865=_0x4caeb0[_0x6594('0x36')]({'plain':!![]});var _0x3db7a3='FaxAccounts';return db[_0x6594('0x37')]['destroy']({'where':{'type':_0x3db7a3,'resourceId':_0x54b865['id']}})[_0x6594('0x21')](function(){return _0x4caeb0;});})[_0x6594('0x21')](function(){_0x2189c0[_0x6594('0x2d')](0xcc)[_0x6594('0x2c')]();});}};}function handleEntityNotFound(_0x5c8376,_0x1c1e22){return function(_0x3fa4d3){if(!_0x3fa4d3){_0x5c8376['sendStatus'](0x194);}return _0x3fa4d3;};}function handleError(_0x3ec1cf,_0xf1be08){_0xf1be08=_0xf1be08||0x1f4;return function(_0x5c53a1){logger[_0x6594('0x28')](_0x5c53a1[_0x6594('0x38')]);if(_0x5c53a1[_0x6594('0x39')]){delete _0x5c53a1[_0x6594('0x39')];}_0x3ec1cf[_0x6594('0x2d')](_0xf1be08)[_0x6594('0x3a')](_0x5c53a1);};}exports[_0x6594('0x3b')]=function(_0x58998c,_0x8ac892){var _0x187dce={'include':[{'model':db[_0x6594('0x3c')],'as':_0x6594('0x3d')}]},_0x402368={},_0x169c76={'count':0x0,'rows':[]};var _0x4f28c1=_[_0x6594('0x3e')](db[_0x6594('0x3f')]['rawAttributes'],function(_0x7cb356){return{'name':_0x7cb356[_0x6594('0x40')],'type':_0x7cb356[_0x6594('0x41')]['key']};});_0x402368[_0x6594('0x42')]=_[_0x6594('0x3e')](_0x4f28c1,_0x6594('0x39'));_0x402368[_0x6594('0x43')]=_[_0x6594('0x44')](_0x58998c['query']);_0x402368[_0x6594('0x45')]=_[_0x6594('0x46')](_0x402368[_0x6594('0x42')],_0x402368[_0x6594('0x43')]);_0x187dce[_0x6594('0x47')]=_['intersection'](_0x402368[_0x6594('0x42')],qs[_0x6594('0x48')](_0x58998c[_0x6594('0x43')][_0x6594('0x48')]));_0x187dce[_0x6594('0x47')]=_0x187dce['attributes']['length']?_0x187dce[_0x6594('0x47')]:_0x402368[_0x6594('0x42')];if(!_0x58998c['query'][_0x6594('0x49')](_0x6594('0x4a'))){_0x187dce[_0x6594('0x31')]=qs['limit'](_0x58998c[_0x6594('0x43')]['limit']);_0x187dce[_0x6594('0x30')]=qs['offset'](_0x58998c[_0x6594('0x43')][_0x6594('0x30')]);}_0x187dce[_0x6594('0x4b')]=qs[_0x6594('0x4c')](_0x58998c[_0x6594('0x43')]['sort']);_0x187dce['where']=qs['filters'](_['pick'](_0x58998c[_0x6594('0x43')],_0x402368[_0x6594('0x45')]));if(_0x58998c[_0x6594('0x43')][_0x6594('0x4d')]){_0x187dce['where']=_[_0x6594('0x4e')](_0x187dce[_0x6594('0x4f')],{'$or':_['map'](_0x4f28c1,function(_0x221130){if(_0x221130[_0x6594('0x41')]!==_0x6594('0x50')){var _0xd04602={};_0xd04602[_0x221130[_0x6594('0x39')]]={'$like':'%'+_0x58998c[_0x6594('0x43')][_0x6594('0x4d')]+'%'};return _0xd04602;}})});}_0x187dce=_[_0x6594('0x4e')]({},_0x187dce,_0x58998c[_0x6594('0x51')]);var _0x1f0144={'where':_0x187dce['where']};return db[_0x6594('0x3f')][_0x6594('0x2f')](_0x1f0144)['then'](function(_0x4e21c2){_0x169c76['count']=_0x4e21c2;if(_0x58998c[_0x6594('0x43')][_0x6594('0x52')]){_0x187dce['include']=[{'all':!![]}];}return db['FaxAccount'][_0x6594('0x53')](_0x187dce);})[_0x6594('0x21')](function(_0x420e9a){_0x169c76['rows']=_0x420e9a;return _0x169c76;})[_0x6594('0x21')](respondWithFilteredResult(_0x8ac892,_0x187dce))[_0x6594('0x2a')](handleError(_0x8ac892,null));};exports[_0x6594('0x54')]=function(_0x4e10f2,_0x63436c){var _0x4fadde={'raw':![],'where':{'id':_0x4e10f2['params']['id']},'include':[{'model':db[_0x6594('0x3c')],'as':_0x6594('0x3d')}]},_0x199a5a={};_0x199a5a[_0x6594('0x42')]=_[_0x6594('0x44')](db[_0x6594('0x3f')][_0x6594('0x55')]);_0x199a5a[_0x6594('0x43')]=_[_0x6594('0x44')](_0x4e10f2[_0x6594('0x43')]);_0x199a5a[_0x6594('0x45')]=_[_0x6594('0x46')](_0x199a5a['model'],_0x199a5a[_0x6594('0x43')]);_0x4fadde['attributes']=_['intersection'](_0x199a5a[_0x6594('0x42')],qs[_0x6594('0x48')](_0x4e10f2[_0x6594('0x43')]['fields']));_0x4fadde['attributes']=_0x4fadde['attributes'][_0x6594('0x56')]?_0x4fadde[_0x6594('0x47')]:_0x199a5a[_0x6594('0x42')];if(_0x4e10f2['query'][_0x6594('0x52')]){_0x4fadde[_0x6594('0x57')]=[{'all':!![]}];}_0x4fadde=_[_0x6594('0x4e')]({},_0x4fadde,_0x4e10f2['options']);return db[_0x6594('0x3f')]['find'](_0x4fadde)[_0x6594('0x21')](handleEntityNotFound(_0x63436c,null))[_0x6594('0x21')](respondWithResult(_0x63436c,null))[_0x6594('0x2a')](handleError(_0x63436c,null));};exports[_0x6594('0x58')]=function(_0x538916,_0xce01a4){return db[_0x6594('0x3f')]['create'](_0x538916['body'],{})[_0x6594('0x21')](function(_0x4c9f3f){var _0x6e536f=_0x538916[_0x6594('0x59')][_0x6594('0x36')]({'plain':!![]});if(!_0x6e536f)throw new Error(_0x6594('0x5a'));if(_0x6e536f[_0x6594('0x5b')]==='user'){var _0x45198d=_0x4c9f3f[_0x6594('0x36')]({'plain':!![]});var _0x470e30=_0x6594('0x5c');return db[_0x6594('0x5d')]['find']({'where':{'name':_0x470e30,'userProfileId':_0x6e536f[_0x6594('0x5e')]},'raw':!![]})[_0x6594('0x21')](function(_0x4bdafb){if(_0x4bdafb&&_0x4bdafb[_0x6594('0x5f')]===0x0){return db[_0x6594('0x37')][_0x6594('0x58')]({'name':_0x45198d[_0x6594('0x39')],'resourceId':_0x45198d['id'],'type':_0x4bdafb['name'],'sectionId':_0x4bdafb['id']},{})[_0x6594('0x21')](function(){return _0x4c9f3f;});}else{return _0x4c9f3f;}})[_0x6594('0x2a')](function(_0x5fe6f0){logger['error'](_0x6594('0x60'),_0x5fe6f0);throw _0x5fe6f0;});}return _0x4c9f3f;})['then'](respondWithResult(_0xce01a4,0xc9))[_0x6594('0x2a')](handleError(_0xce01a4,null));};exports['update']=function(_0x578e01,_0x1fa516){if(_0x578e01[_0x6594('0x61')]['id']){delete _0x578e01['body']['id'];}return db[_0x6594('0x3f')][_0x6594('0x62')]({'where':{'id':_0x578e01[_0x6594('0x63')]['id']},'include':[{'model':db['Pause'],'as':_0x6594('0x3d')}]})[_0x6594('0x21')](handleEntityNotFound(_0x1fa516,null))[_0x6594('0x21')](saveUpdates(_0x578e01['body'],null))[_0x6594('0x21')](respondWithResult(_0x1fa516,null))[_0x6594('0x2a')](handleError(_0x1fa516,null));};exports[_0x6594('0x35')]=function(_0x1a4f0e,_0x375780){return db[_0x6594('0x3f')][_0x6594('0x62')]({'where':{'id':_0x1a4f0e['params']['id']}})['then'](handleEntityNotFound(_0x375780,null))[_0x6594('0x21')](removeEntity(_0x375780,null))[_0x6594('0x2a')](handleError(_0x375780,null));};exports[_0x6594('0x64')]=function(_0x4b2777,_0x5ec609){return db['FaxAccount'][_0x6594('0x64')]()[_0x6594('0x21')](respondWithResult(_0x5ec609,null))[_0x6594('0x2a')](handleError(_0x5ec609,null));};exports[_0x6594('0x65')]=function(_0x4d6d50,_0x53445e,_0x1c311c){if(_0x4d6d50[_0x6594('0x61')]['id']){delete _0x4d6d50[_0x6594('0x61')]['id'];}return db[_0x6594('0x3f')][_0x6594('0x62')]({'where':{'id':_0x4d6d50['params']['id']}})['then'](handleEntityNotFound(_0x53445e,null))[_0x6594('0x21')](function(_0x3f48ef){if(_0x3f48ef){_0x4d6d50[_0x6594('0x61')][_0x6594('0x66')]=_0x3f48ef['id'];return db[_0x6594('0x67')]['create'](_0x4d6d50[_0x6594('0x61')]);}})['then'](respondWithResult(_0x53445e,null))['catch'](handleError(_0x53445e,null));};exports[_0x6594('0x68')]=function(_0x55077f,_0x5619a4,_0x551247){var _0x4848bf={'raw':![],'where':{}};var _0x4ed008={};var _0xd5e8a9={'count':0x0,'rows':[]};return db['FaxAccount'][_0x6594('0x69')]({'where':{'id':_0x55077f[_0x6594('0x63')]['id']}})['then'](handleEntityNotFound(_0x5619a4,null))[_0x6594('0x21')](function(_0x2cf4f9){if(_0x2cf4f9){_0x4ed008['model']=_['keys'](db[_0x6594('0x67')][_0x6594('0x55')]);_0x4ed008[_0x6594('0x43')]=_[_0x6594('0x44')](_0x55077f[_0x6594('0x43')]);_0x4ed008[_0x6594('0x45')]=_[_0x6594('0x46')](_0x4ed008[_0x6594('0x42')],_0x4ed008[_0x6594('0x43')]);_0x4848bf[_0x6594('0x47')]=_[_0x6594('0x46')](_0x4ed008['model'],qs[_0x6594('0x48')](_0x55077f[_0x6594('0x43')][_0x6594('0x48')]));_0x4848bf[_0x6594('0x47')]=_0x4848bf[_0x6594('0x47')][_0x6594('0x56')]?_0x4848bf[_0x6594('0x47')]:_0x4ed008[_0x6594('0x42')];if(!_0x55077f[_0x6594('0x43')]['hasOwnProperty'](_0x6594('0x4a'))){_0x4848bf['limit']=qs[_0x6594('0x31')](_0x55077f[_0x6594('0x43')][_0x6594('0x31')]);_0x4848bf[_0x6594('0x30')]=qs[_0x6594('0x30')](_0x55077f[_0x6594('0x43')][_0x6594('0x30')]);}_0x4848bf[_0x6594('0x4b')]=qs[_0x6594('0x4c')](_0x55077f['query'][_0x6594('0x4c')]);_0x4848bf[_0x6594('0x4f')]=qs[_0x6594('0x45')](_[_0x6594('0x6a')](_0x55077f[_0x6594('0x43')],_0x4ed008[_0x6594('0x45')]));_0x4848bf[_0x6594('0x4f')]['FaxAccountId']=_0x2cf4f9['id'];if(_0x55077f['query']['filter']){_0x4848bf[_0x6594('0x4f')]=_[_0x6594('0x4e')](_0x4848bf['where'],{'$or':_[_0x6594('0x3e')](_0x4848bf['attributes'],function(_0x8dec09){var _0x4440fa={};_0x4440fa[_0x8dec09]={'$like':'%'+_0x55077f[_0x6594('0x43')][_0x6594('0x4d')]+'%'};return _0x4440fa;})});}_0x4848bf=_[_0x6594('0x4e')]({},_0x4848bf,_0x55077f[_0x6594('0x51')]);return db[_0x6594('0x67')][_0x6594('0x2f')]({'where':_0x4848bf[_0x6594('0x4f')]})['then'](function(_0x40ef49){_0xd5e8a9[_0x6594('0x2f')]=_0x40ef49;if(_0x55077f[_0x6594('0x43')][_0x6594('0x52')]){_0x4848bf['include']=[{'all':!![]}];}return db[_0x6594('0x67')][_0x6594('0x53')](_0x4848bf);})[_0x6594('0x21')](function(_0x277a9f){_0xd5e8a9[_0x6594('0x6b')]=_0x277a9f;return _0xd5e8a9;});}})[_0x6594('0x21')](respondWithFilteredResult(_0x5619a4,_0x4848bf))['catch'](handleError(_0x5619a4,null));};exports['removeDispositions']=function(_0x2f910c,_0xcb51fc,_0x2ee949){return db[_0x6594('0x3f')][_0x6594('0x62')]({'where':{'id':_0x2f910c['params']['id']}})[_0x6594('0x21')](handleEntityNotFound(_0xcb51fc,null))[_0x6594('0x21')](function(_0x17aab8){if(_0x17aab8){return _0x17aab8['removeDispositions'](_0x2f910c[_0x6594('0x43')][_0x6594('0x6c')]);}})[_0x6594('0x21')](respondWithStatusCode(_0xcb51fc,null))[_0x6594('0x2a')](handleError(_0xcb51fc,null));};exports['addAnswer']=function(_0x585bbc,_0x260110,_0x5d5cac){if(_0x585bbc[_0x6594('0x61')]['id']){delete _0x585bbc['body']['id'];}return db[_0x6594('0x3f')][_0x6594('0x62')]({'where':{'id':_0x585bbc[_0x6594('0x63')]['id']}})[_0x6594('0x21')](handleEntityNotFound(_0x260110,null))['then'](function(_0x51de7b){if(_0x51de7b){_0x585bbc[_0x6594('0x61')]['FaxAccountId']=_0x51de7b['id'];return db[_0x6594('0x6d')][_0x6594('0x58')](_0x585bbc['body']);}})[_0x6594('0x21')](respondWithResult(_0x260110,null))['catch'](handleError(_0x260110,null));};exports[_0x6594('0x6e')]=function(_0x3e4bef,_0x4f4556,_0x2919a2){var _0x483ce3={'raw':![],'where':{}};var _0x47944a={};var _0x2cef22={'count':0x0,'rows':[]};return db[_0x6594('0x3f')][_0x6594('0x69')]({'where':{'id':_0x3e4bef[_0x6594('0x63')]['id']}})[_0x6594('0x21')](handleEntityNotFound(_0x4f4556,null))[_0x6594('0x21')](function(_0x56e9dc){if(_0x56e9dc){_0x47944a[_0x6594('0x42')]=_[_0x6594('0x44')](db['CannedAnswer'][_0x6594('0x55')]);_0x47944a[_0x6594('0x43')]=_[_0x6594('0x44')](_0x3e4bef['query']);_0x47944a['filters']=_['intersection'](_0x47944a['model'],_0x47944a['query']);_0x483ce3['attributes']=_['intersection'](_0x47944a[_0x6594('0x42')],qs[_0x6594('0x48')](_0x3e4bef[_0x6594('0x43')][_0x6594('0x48')]));_0x483ce3[_0x6594('0x47')]=_0x483ce3[_0x6594('0x47')]['length']?_0x483ce3[_0x6594('0x47')]:_0x47944a[_0x6594('0x42')];if(!_0x3e4bef[_0x6594('0x43')][_0x6594('0x49')](_0x6594('0x4a'))){_0x483ce3[_0x6594('0x31')]=qs[_0x6594('0x31')](_0x3e4bef['query'][_0x6594('0x31')]);_0x483ce3[_0x6594('0x30')]=qs[_0x6594('0x30')](_0x3e4bef[_0x6594('0x43')][_0x6594('0x30')]);}_0x483ce3[_0x6594('0x4b')]=qs['sort'](_0x3e4bef['query'][_0x6594('0x4c')]);_0x483ce3['where']=qs[_0x6594('0x45')](_['pick'](_0x3e4bef[_0x6594('0x43')],_0x47944a['filters']));_0x483ce3[_0x6594('0x4f')][_0x6594('0x66')]=_0x56e9dc['id'];if(_0x3e4bef['query'][_0x6594('0x4d')]){_0x483ce3[_0x6594('0x4f')]=_[_0x6594('0x4e')](_0x483ce3[_0x6594('0x4f')],{'$or':_[_0x6594('0x3e')](_0x483ce3['attributes'],function(_0x201ed6){var _0x2e5359={};_0x2e5359[_0x201ed6]={'$like':'%'+_0x3e4bef[_0x6594('0x43')][_0x6594('0x4d')]+'%'};return _0x2e5359;})});}_0x483ce3=_['merge']({},_0x483ce3,_0x3e4bef[_0x6594('0x51')]);return db['CannedAnswer'][_0x6594('0x2f')]({'where':_0x483ce3['where']})[_0x6594('0x21')](function(_0x1a2484){_0x2cef22[_0x6594('0x2f')]=_0x1a2484;if(_0x3e4bef[_0x6594('0x43')][_0x6594('0x52')]){_0x483ce3[_0x6594('0x57')]=[{'all':!![]}];}return db[_0x6594('0x6d')][_0x6594('0x53')](_0x483ce3);})[_0x6594('0x21')](function(_0x449097){_0x2cef22[_0x6594('0x6b')]=_0x449097;return _0x2cef22;});}})[_0x6594('0x21')](respondWithFilteredResult(_0x4f4556,_0x483ce3))[_0x6594('0x2a')](handleError(_0x4f4556,null));};exports['removeAnswers']=function(_0x5f0bd9,_0x21971a,_0xc44916){return db[_0x6594('0x3f')][_0x6594('0x62')]({'where':{'id':_0x5f0bd9['params']['id']}})[_0x6594('0x21')](handleEntityNotFound(_0x21971a,null))[_0x6594('0x21')](function(_0x1a98c4){if(_0x1a98c4){return _0x1a98c4[_0x6594('0x6f')](_0x5f0bd9[_0x6594('0x43')]['ids']);}})[_0x6594('0x21')](respondWithStatusCode(_0x21971a,null))[_0x6594('0x2a')](handleError(_0x21971a,null));};exports['addInteraction']=function(_0x5464d5,_0x23214b,_0xf3966a){return db[_0x6594('0x70')]['find']({'where':{'id':_0x5464d5[_0x6594('0x63')]['id']}})[_0x6594('0x21')](handleEntityNotFound(_0x23214b,null))['then'](function(_0x47b405){if(_0x47b405){return _0x47b405['addInteraction'](_0x5464d5['body'][_0x6594('0x6c')],_[_0x6594('0x71')](_0x5464d5['body'],[_0x6594('0x6c'),'id'])||{});}})[_0x6594('0x21')](respondWithResult(_0x23214b,null))[_0x6594('0x2a')](handleError(_0x23214b,null));};exports['getInteractions']=function(_0x24e520,_0x4af8d7,_0x15126b){var _0x57a4c5={'raw':![],'where':{}};var _0x4f8be7={};var _0x4980ff={'count':0x0,'rows':[]};return db['FaxAccount'][_0x6594('0x69')]({'where':{'id':_0x24e520['params']['id']}})['then'](handleEntityNotFound(_0x4af8d7,null))[_0x6594('0x21')](function(_0x22062e){if(_0x22062e){_0x4f8be7[_0x6594('0x42')]=_[_0x6594('0x44')](db[_0x6594('0x70')][_0x6594('0x55')]);_0x4f8be7[_0x6594('0x43')]=_[_0x6594('0x44')](_0x24e520[_0x6594('0x43')]);_0x4f8be7[_0x6594('0x45')]=_[_0x6594('0x46')](_0x4f8be7[_0x6594('0x42')],_0x4f8be7[_0x6594('0x43')]);_0x57a4c5[_0x6594('0x47')]=_['intersection'](_0x4f8be7['model'],qs[_0x6594('0x48')](_0x24e520[_0x6594('0x43')]['fields']));_0x57a4c5[_0x6594('0x47')]=_0x57a4c5['attributes']['length']?_0x57a4c5['attributes']:_0x4f8be7[_0x6594('0x42')];if(!_0x24e520[_0x6594('0x43')][_0x6594('0x49')](_0x6594('0x4a'))){_0x57a4c5['limit']=qs[_0x6594('0x31')](_0x24e520[_0x6594('0x43')][_0x6594('0x31')]);_0x57a4c5[_0x6594('0x30')]=qs[_0x6594('0x30')](_0x24e520[_0x6594('0x43')][_0x6594('0x30')]);}_0x57a4c5[_0x6594('0x4b')]=qs['sort'](_0x24e520['query'][_0x6594('0x4c')]);_0x57a4c5[_0x6594('0x4f')]=qs['filters'](_['pick'](_0x24e520['query'],_0x4f8be7['filters']));_0x57a4c5['where'][_0x6594('0x66')]=_0x22062e['id'];if(_0x24e520[_0x6594('0x43')][_0x6594('0x4d')]){_0x57a4c5[_0x6594('0x4f')]=_['merge'](_0x57a4c5[_0x6594('0x4f')],{'$or':_[_0x6594('0x3e')](_0x57a4c5[_0x6594('0x47')],function(_0x3ab123){var _0x3a064a={};_0x3a064a[_0x3ab123]={'$like':'%'+_0x24e520[_0x6594('0x43')][_0x6594('0x4d')]+'%'};return _0x3a064a;})});}_0x57a4c5=_[_0x6594('0x4e')]({},_0x57a4c5,_0x24e520['options']);return db[_0x6594('0x70')][_0x6594('0x2f')]({'where':_0x57a4c5[_0x6594('0x4f')]})[_0x6594('0x21')](function(_0x5c71df){_0x4980ff[_0x6594('0x2f')]=_0x5c71df;if(_0x24e520[_0x6594('0x43')][_0x6594('0x52')]){_0x57a4c5[_0x6594('0x57')]=[{'model':db[_0x6594('0x72')],'as':'Contact','required':![]},{'model':db[_0x6594('0x73')],'as':_0x6594('0x74'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0x6594('0x75')],'as':'Tags','attributes':['id','name',_0x6594('0x76')],'where':_0x24e520[_0x6594('0x43')][_0x6594('0x77')]?{'id':_0x24e520[_0x6594('0x43')][_0x6594('0x77')]}:undefined,'required':_0x24e520[_0x6594('0x43')]['tag']?!![]:![]}];}return db[_0x6594('0x70')][_0x6594('0x53')](_0x57a4c5);})[_0x6594('0x21')](function(_0x48d984){_0x4980ff['rows']=_0x48d984;return _0x4980ff;});}})[_0x6594('0x21')](respondWithFilteredResult(_0x4af8d7,_0x57a4c5))[_0x6594('0x2a')](handleError(_0x4af8d7,null));};exports['addApplications']=function(_0x2947af,_0x428e6b,_0x5296e6){return db['FaxAccount'][_0x6594('0x69')]({'where':{'id':_0x2947af[_0x6594('0x63')]['id']}})[_0x6594('0x21')](handleEntityNotFound(_0x428e6b,null))[_0x6594('0x21')](function(_0x3a4d69){if(_0x3a4d69){return db[_0x6594('0x78')][_0x6594('0x79')](function(_0x2cbc08){return db[_0x6594('0x7a')][_0x6594('0x35')]({'where':{'FaxAccountId':_0x2947af[_0x6594('0x63')]['id']},'transaction':_0x2cbc08})[_0x6594('0x21')](function(_0x4c5c9a){var _0x493a1b=_[_0x6594('0x3e')](_0x2947af[_0x6594('0x61')],function(_0x90ee40){_0x90ee40[_0x6594('0x66')]=_0x2947af[_0x6594('0x63')]['id'];return _0x90ee40;});return db[_0x6594('0x7a')][_0x6594('0x7b')](_0x493a1b,{'transaction':_0x2cbc08});});})[_0x6594('0x21')](function(){return db[_0x6594('0x7a')][_0x6594('0x7c')]({'where':{'FaxAccountId':_0x2947af[_0x6594('0x63')]['id']},'order':_0x6594('0x7d')});});}})[_0x6594('0x21')](respondWithResult(_0x428e6b,null))[_0x6594('0x2a')](handleError(_0x428e6b,null));};exports[_0x6594('0x7e')]=function(_0x46a39d,_0x4e45a9,_0x5f3ea1){var _0x4f8c34={};var _0x7552c1={};var _0x45241f;var _0x52ff34;return db[_0x6594('0x3f')][_0x6594('0x69')]({'where':{'id':_0x46a39d[_0x6594('0x63')]['id']}})[_0x6594('0x21')](handleEntityNotFound(_0x4e45a9,null))[_0x6594('0x21')](function(_0x16a381){if(_0x16a381){_0x45241f=_0x16a381;_0x7552c1[_0x6594('0x42')]=_[_0x6594('0x44')](db[_0x6594('0x7a')][_0x6594('0x55')]);_0x7552c1['query']=_[_0x6594('0x44')](_0x46a39d[_0x6594('0x43')]);_0x7552c1['filters']=_[_0x6594('0x46')](_0x7552c1[_0x6594('0x42')],_0x7552c1[_0x6594('0x43')]);_0x4f8c34[_0x6594('0x47')]=_['intersection'](_0x7552c1[_0x6594('0x42')],qs['fields'](_0x46a39d['query'][_0x6594('0x48')]));_0x4f8c34[_0x6594('0x47')]=_0x4f8c34[_0x6594('0x47')][_0x6594('0x56')]?_0x4f8c34['attributes']:_0x7552c1['model'];_0x4f8c34['order']=qs[_0x6594('0x4c')](_0x46a39d[_0x6594('0x43')][_0x6594('0x4c')]);_0x4f8c34[_0x6594('0x4f')]=qs[_0x6594('0x45')](_[_0x6594('0x6a')](_0x46a39d['query'],_0x7552c1[_0x6594('0x45')]));if(_0x46a39d[_0x6594('0x43')][_0x6594('0x4d')]){_0x4f8c34[_0x6594('0x4f')]=_[_0x6594('0x4e')](_0x4f8c34[_0x6594('0x4f')],{'$or':_[_0x6594('0x3e')](_0x4f8c34[_0x6594('0x47')],function(_0x5eccbf){var _0x39a524={};_0x39a524[_0x5eccbf]={'$like':'%'+_0x46a39d['query']['filter']+'%'};return _0x39a524;})});}_0x4f8c34=_[_0x6594('0x4e')]({},_0x4f8c34,_0x46a39d[_0x6594('0x51')]);return _0x45241f['getApplications'](_0x4f8c34);}})[_0x6594('0x21')](function(_0x36da59){if(_0x36da59){_0x52ff34=_0x36da59[_0x6594('0x56')];if(!_0x46a39d['query'][_0x6594('0x49')](_0x6594('0x4a'))){_0x4f8c34[_0x6594('0x31')]=qs['limit'](_0x46a39d[_0x6594('0x43')]['limit']);_0x4f8c34[_0x6594('0x30')]=qs[_0x6594('0x30')](_0x46a39d[_0x6594('0x43')][_0x6594('0x30')]);}return _0x45241f['getApplications'](_0x4f8c34);}})[_0x6594('0x21')](function(_0x1ed349){if(_0x1ed349){return _0x1ed349?{'count':_0x52ff34,'rows':_0x1ed349}:null;}})['then'](respondWithResult(_0x4e45a9,null))[_0x6594('0x2a')](handleError(_0x4e45a9,null));};function Extension(_0x4a84ed,_0x1db2fc,_0x31f225,_0x464fb2){this['context']=_0x6594('0x7f');this[_0x6594('0x80')]=_0x4a84ed[_0x6594('0x81')];this[_0x6594('0x82')]=_0x464fb2;this[_0x6594('0x41')]=_0x6594('0x83');this[_0x6594('0x84')]='Fax\x20Extension';this[_0x6594('0x66')]=_0x4a84ed['id'];this[_0x6594('0x7d')]=_0x1db2fc;this[_0x6594('0x85')]=_0x31f225;}function createExtensionsReciveFax(_0x4e8c22){var _0x1ee457=0x1;var _0x51c8cb=[];_0x51c8cb[_0x6594('0x86')](new Extension(_0x4e8c22,_0x1ee457,'',_0x6594('0x87')));_0x1ee457+=0x1;_0x51c8cb[_0x6594('0x86')](new Extension(_0x4e8c22,_0x1ee457,_0x6594('0x88'),_0x6594('0x89')));_0x1ee457+=0x1;for(var _0x5ab2bb in _0x4e8c22){if(_0x4e8c22[_0x6594('0x49')](_0x5ab2bb)&&(_0x5ab2bb==='ecm'||_0x5ab2bb===_0x6594('0x81')||_0x5ab2bb===_0x6594('0x8a')||_0x5ab2bb==='faxdetect'||_0x5ab2bb===_0x6594('0x8b')||_0x5ab2bb===_0x6594('0x8c')||_0x5ab2bb===_0x6594('0x8d')||_0x5ab2bb===_0x6594('0x8e')||_0x5ab2bb===_0x6594('0x8f'))){_0x51c8cb[_0x6594('0x86')](new Extension(_0x4e8c22,_0x1ee457,_0x6594('0x90')+_0x5ab2bb+')='+_0x4e8c22[_0x5ab2bb],'Set'));_0x1ee457+=0x1;}}_0x51c8cb['push'](new Extension(_0x4e8c22,_0x1ee457,'6',_0x6594('0x91')));_0x1ee457+=0x1;_0x51c8cb[_0x6594('0x86')](new Extension(_0x4e8c22,_0x1ee457,'/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',_0x6594('0x92')));_0x1ee457=0x0;return _0x51c8cb;}exports[_0x6594('0x93')]=function(_0x179eda,_0x2cb6f0,_0x320596){var _0x559ece;return db[_0x6594('0x78')][_0x6594('0x79')](function(_0x138c96){return db[_0x6594('0x3f')][_0x6594('0x58')](_0x179eda['body'],{'transaction':_0x138c96})['then'](function(_0x3c3451){_0x559ece=_0x3c3451['get']({'plain':!![]});return db['VoiceExtension'][_0x6594('0x7b')](createExtensionsReciveFax(_0x559ece),{'transaction':_0x138c96});});})[_0x6594('0x21')](function(){return _0x559ece;})[_0x6594('0x21')](respondWithResult(_0x2cb6f0,null))[_0x6594('0x2a')](handleError(_0x2cb6f0,null));};exports[_0x6594('0x94')]=function(_0x421782,_0x2171fb,_0x38311f){var _0x3afa01;return db['sequelize'][_0x6594('0x79')](function(_0x19eab1){return db[_0x6594('0x3f')][_0x6594('0x34')](_0x421782[_0x6594('0x61')],{'where':{'id':_0x421782[_0x6594('0x61')]['id']},'transaction':_0x19eab1})[_0x6594('0x21')](function(_0x38564a){return db[_0x6594('0x95')][_0x6594('0x35')]({'where':{'FaxAccountId':_0x421782[_0x6594('0x61')]['id']},'transaction':_0x19eab1})[_0x6594('0x21')](function(_0x3b7a68){return db[_0x6594('0x95')][_0x6594('0x7b')](createExtensionsReciveFax(_['omit'](_0x421782[_0x6594('0x61')],[_0x6594('0x96'),_0x6594('0x97'),_0x6594('0x98'),_0x6594('0x99'),_0x6594('0x9a'),'ListId'])),{'transaction':_0x19eab1});});});})[_0x6594('0x21')](function(){return db['FaxAccount'][_0x6594('0x9b')](_0x421782[_0x6594('0x61')]['id']);})[_0x6594('0x21')](respondWithResult(_0x2171fb,null))['catch'](handleError(_0x2171fb,null));};exports[_0x6594('0x9c')]=function(_0x4cd1f6,_0x31dc9d,_0x3f7fad){var _0x559b7f={'raw':!![],'where':{}};var _0x22d57e={};var _0x4e3ba8={'count':0x0,'rows':[]};return db[_0x6594('0x3f')][_0x6594('0x69')]({'where':{'id':_0x4cd1f6[_0x6594('0x63')]['id']}})['then'](handleEntityNotFound(_0x31dc9d,null))[_0x6594('0x21')](function(_0x5d4073){if(_0x5d4073){_0x22d57e[_0x6594('0x42')]=_['keys'](db[_0x6594('0x9d')][_0x6594('0x55')]);_0x22d57e[_0x6594('0x43')]=_[_0x6594('0x44')](_0x4cd1f6[_0x6594('0x43')]);_0x22d57e[_0x6594('0x45')]=_[_0x6594('0x46')](_0x22d57e[_0x6594('0x42')],_0x22d57e['query']);_0x559b7f[_0x6594('0x47')]=_[_0x6594('0x46')](_0x22d57e[_0x6594('0x42')],qs[_0x6594('0x48')](_0x4cd1f6[_0x6594('0x43')][_0x6594('0x48')]));_0x559b7f[_0x6594('0x47')]=_0x559b7f['attributes'][_0x6594('0x56')]?_0x559b7f[_0x6594('0x47')]:_0x22d57e[_0x6594('0x42')];if(!_0x4cd1f6[_0x6594('0x43')]['hasOwnProperty'](_0x6594('0x4a'))){_0x559b7f[_0x6594('0x31')]=qs[_0x6594('0x31')](_0x4cd1f6[_0x6594('0x43')][_0x6594('0x31')]);_0x559b7f[_0x6594('0x30')]=qs[_0x6594('0x30')](_0x4cd1f6[_0x6594('0x43')][_0x6594('0x30')]);}_0x559b7f[_0x6594('0x4b')]=qs[_0x6594('0x4c')](_0x4cd1f6[_0x6594('0x43')][_0x6594('0x4c')]);_0x559b7f['where']=qs['filters'](_['pick'](_0x4cd1f6[_0x6594('0x43')],_0x22d57e[_0x6594('0x45')]));_0x559b7f[_0x6594('0x4f')][_0x6594('0x66')]=_0x5d4073['id'];if(_0x4cd1f6[_0x6594('0x43')][_0x6594('0x4d')]){_0x559b7f[_0x6594('0x4f')]=_[_0x6594('0x4e')](_0x559b7f[_0x6594('0x4f')],{'$or':_['map'](_0x559b7f[_0x6594('0x47')],function(_0x4fb63c){var _0x41a9fa={};_0x41a9fa[_0x4fb63c]={'$like':'%'+_0x4cd1f6[_0x6594('0x43')]['filter']+'%'};return _0x41a9fa;})});}if(_0x4cd1f6['query'][_0x6594('0x9e')]){var _0x1cc8c8=_0x4cd1f6[_0x6594('0x43')][_0x6594('0x9e')]['split'](',');var _0x32d64f={};_0x32d64f[_0x1cc8c8[0x0]]={'$gte':moment(_0x1cc8c8[0x1])['format'](_0x6594('0x9f'))};_0x559b7f[_0x6594('0x4f')]=_[_0x6594('0x4e')](_0x559b7f['where'],_0x32d64f);}_0x559b7f=_[_0x6594('0x4e')]({},_0x559b7f,_0x4cd1f6[_0x6594('0x51')]);return db[_0x6594('0x9d')][_0x6594('0x2f')]({'where':_0x559b7f[_0x6594('0x4f')]})[_0x6594('0x21')](function(_0x2a6a81){_0x4e3ba8[_0x6594('0x2f')]=_0x2a6a81;if(_0x4cd1f6['query'][_0x6594('0x52')]){_0x559b7f['include']=[{'all':!![]}];}return db[_0x6594('0x9d')][_0x6594('0x53')](_0x559b7f);})['then'](function(_0x2ceceb){_0x4e3ba8['rows']=_0x2ceceb;return _0x4e3ba8;});}})['then'](respondWithFilteredResult(_0x31dc9d,_0x559b7f))[_0x6594('0x2a')](handleError(_0x31dc9d,null));};exports[_0x6594('0x3a')]=function(_0x1ae24b,_0x53c866,_0x1ef84d){var _0x3dde7f,_0x2de6a9={},_0x217719;if(_0x1ae24b['body']['to']){_0x217719=_0x1ae24b['body']['to'][0x0];}return db[_0x6594('0x3f')][_0x6594('0x62')]({'where':{'id':_0x1ae24b[_0x6594('0x63')]['id']},'include':[{'model':db[_0x6594('0xa0')],'as':_0x6594('0xa1'),'include':[{'model':db[_0x6594('0x72')],'as':_0x6594('0xa2'),'where':{'fax':_0x217719},'limit':0x1,'order':[[_0x6594('0x99'),'DESC']]}]}]})[_0x6594('0x21')](handleEntityNotFound(_0x53c866,null))[_0x6594('0x21')](function(_0x539b69){_0x3dde7f=_0x539b69;if(_0x1ae24b[_0x6594('0x61')][_0x6594('0xa3')]&&_0x1ae24b[_0x6594('0x61')][_0x6594('0xa3')][_0x6594('0x56')]){for(var _0x455c1b=0x0;_0x455c1b<_0x1ae24b[_0x6594('0x61')][_0x6594('0xa3')][_0x6594('0x56')];_0x455c1b+=0x1){_0x1ae24b[_0x6594('0x61')][_0x6594('0xa3')][_0x455c1b]={'filename':_0x1ae24b[_0x6594('0x61')][_0x6594('0xa3')][_0x455c1b][_0x6594('0x39')],'id':_0x1ae24b['body']['attachments'][_0x455c1b]['id'],'path':path[_0x6594('0xa4')](config[_0x6594('0xa5')],_0x6594('0xa6'),_0x1ae24b[_0x6594('0x61')]['attachments'][_0x455c1b]['basename'])};}}return respondWithRpcPromise(_0x6594('0xa7'),_0x6594('0xa7'),{'FaxAccountId':_[_0x6594('0xa8')](_0x1ae24b[_0x6594('0x63')]['id'])?undefined:_0x1ae24b[_0x6594('0x63')]['id'],'path':_[_0x6594('0xa8')](_0x1ae24b[_0x6594('0x61')][_0x6594('0xa3')][0x0][_0x6594('0x6')])?undefined:_0x1ae24b[_0x6594('0x61')]['attachments'][0x0][_0x6594('0x6')],'fax':_['isNil'](_0x1ae24b[_0x6594('0x61')]['to'][0x0])?undefined:_0x1ae24b[_0x6594('0x61')]['to'][0x0]},client9002);})[_0x6594('0x21')](function(){if(_0x3dde7f){if(_['isNil'](_0x1ae24b[_0x6594('0x61')][_0x6594('0xa9')])){_0x1ae24b[_0x6594('0x61')][_0x6594('0xa9')]=util[_0x6594('0xaa')](_0x6594('0xab'),_0x3dde7f['name'],_0x3dde7f['fax']);}if(_0x3dde7f['List']){if(_0x3dde7f['List'][_0x6594('0xa2')]['length']){return _0x3dde7f[_0x6594('0xa1')][_0x6594('0xa2')][0x0];}else{return db[_0x6594('0x72')][_0x6594('0x58')](_[_0x6594('0x14')](_0x1ae24b[_0x6594('0x61')],{'firstName':_0x1ae24b['body']['to'][0x0],'phone':_0x1ae24b[_0x6594('0x61')]['to'][0x0],'fax':_0x1ae24b[_0x6594('0x61')]['to'][0x0],'ListId':_0x3dde7f[_0x6594('0xac')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x6594('0xad'));}})[_0x6594('0x21')](function(_0x4ce26c){if(_0x4ce26c){return db[_0x6594('0x70')][_0x6594('0x62')]({'where':{'ContactId':_0x4ce26c['id'],'closed':![],'FaxAccountId':_0x3dde7f['id']}})[_0x6594('0x21')](function(_0x4ad139){if(_0x4ad139){return[_0x4ad139,![]];}return db[_0x6594('0x70')][_0x6594('0x58')]({'UserId':_0x1ae24b[_0x6594('0x59')]['id'],'ContactId':_0x4ce26c['id'],'FaxAccountId':_0x3dde7f['id'],'fax':_0x1ae24b[_0x6594('0x61')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x6594('0x4e')](_0x1ae24b[_0x6594('0x61')],{'read':![],'body':_0x1ae24b['body'][_0x6594('0xa3')][0x0]['filename'],'FaxAccountId':_0x3dde7f['id'],'UserId':_0x1ae24b[_0x6594('0x59')]['id'],'ContactId':_0x4ce26c['id'],'AttachmentId':_0x1ae24b[_0x6594('0x61')][_0x6594('0xa3')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})['then'](function(_0x412aac){return[_0x412aac,!![]];});});}else{throw new Error(_0x6594('0xae'));}})[_0x6594('0xaf')](function(_0x174e75,_0x3c61b9){if(_0x3c61b9){return _0x174e75;}return db[_0x6594('0x9d')][_0x6594('0x58')]({'direction':'out','read':![],'body':_0x1ae24b[_0x6594('0x61')][_0x6594('0xa3')][0x0][_0x6594('0xb0')],'FaxAccountId':_0x3dde7f['id'],'FaxInteractionId':_0x174e75['id'],'UserId':_0x1ae24b[_0x6594('0x59')]['id'],'ContactId':_0x174e75['ContactId'],'AttachmentId':_0x1ae24b[_0x6594('0x61')][_0x6594('0xa3')][0x0]['id']})[_0x6594('0x21')](function(_0x59d3c6){_0x174e75['dataValues']['Messages']=[];_0x174e75[_0x6594('0xb1')][_0x6594('0xb2')]['push'](_0x59d3c6[_0x6594('0xb1')]);return _0x174e75;});})[_0x6594('0x21')](function(_0x3cb0b7){respondWithRpcPromise(_0x6594('0xb3'),_0x6594('0xb3'),{'FaxAccountId':_[_0x6594('0xa8')](_0x1ae24b['params']['id'])?undefined:_0x1ae24b['params']['id'],'path':_[_0x6594('0xa8')](_0x1ae24b['body']['attachments'][0x0][_0x6594('0x6')])?undefined:_0x1ae24b[_0x6594('0x61')][_0x6594('0xa3')][0x0]['path'],'fax':_[_0x6594('0xa8')](_0x1ae24b[_0x6594('0x61')]['to'][0x0])?undefined:_0x1ae24b['body']['to'][0x0],'AttachmentId':_0x1ae24b[_0x6594('0x61')][_0x6594('0xa3')][0x0]['id']},client9002)['then'](function(_0x369a32){logger[_0x6594('0x22')](_0x6594('0xb4'),_0x369a32);})[_0x6594('0x2a')](function(_0x3a2728){logger[_0x6594('0x22')]('SendFaxRpc,\x20%s',_0x3a2728);});return _0x3cb0b7;})['then'](respondWithResult(_0x53c866,null))[_0x6594('0x2a')](handleError(_0x53c866,null));};exports[_0x6594('0xb5')]=function(_0x595e8e,_0xa4690d,_0x27280e){return db[_0x6594('0x3f')][_0x6594('0x62')]({'where':{'id':_0x595e8e[_0x6594('0x63')]['id']}})['then'](handleEntityNotFound(_0xa4690d,null))[_0x6594('0x21')](function(_0x29a4a7){if(_0x29a4a7){return _0x29a4a7['addAgents'](_0x595e8e[_0x6594('0x61')][_0x6594('0x6c')],_['omit'](_0x595e8e['body'],[_0x6594('0x6c'),'id'])||{})[_0x6594('0xaf')](function(_0x560a6d){for(var _0x4e8651=0x0;_0x4e8651<_0x595e8e[_0x6594('0x61')][_0x6594('0x6c')][_0x6594('0x56')];_0x4e8651+=0x1){socket['emit']('userFaxAccount:save',{'UserId':_0x595e8e[_0x6594('0x61')][_0x6594('0x6c')][_0x4e8651],'FaxAccountId':_0x595e8e[_0x6594('0x63')]['id']});}return _0x560a6d;});}})[_0x6594('0x21')](respondWithResult(_0xa4690d,null))[_0x6594('0x2a')](handleError(_0xa4690d,null));};exports['removeAgents']=function(_0x4228a9,_0x139320,_0x55f90e){return db[_0x6594('0x3f')][_0x6594('0x62')]({'where':{'id':_0x4228a9['params']['id']}})['then'](handleEntityNotFound(_0x139320,null))[_0x6594('0x21')](function(_0x3973a4){if(_0x3973a4){return _0x3973a4[_0x6594('0xb6')](_0x4228a9[_0x6594('0x43')][_0x6594('0x6c')])[_0x6594('0x21')](function(){if(_[_0x6594('0xb7')](_0x4228a9[_0x6594('0x43')][_0x6594('0x6c')])){for(var _0x3dbe67=0x0;_0x3dbe67<_0x4228a9[_0x6594('0x43')]['ids'][_0x6594('0x56')];_0x3dbe67+=0x1){socket['emit'](_0x6594('0xb8'),{'UserId':Number(_0x4228a9[_0x6594('0x43')]['ids'][_0x3dbe67]),'FaxAccountId':Number(_0x4228a9[_0x6594('0x63')]['id'])});}}else{socket[_0x6594('0xb9')](_0x6594('0xb8'),{'UserId':Number(_0x4228a9['query']['ids']),'FaxAccountId':Number(_0x4228a9['params']['id'])});}});}})['then'](respondWithStatusCode(_0x139320,null))[_0x6594('0x2a')](handleError(_0x139320,null));};exports[_0x6594('0xba')]=function(_0x1fd4a1,_0x362344,_0x4461ba){var _0x4480aa={};var _0x199bca={};var _0x5b1e21;var _0x3339fa;return db[_0x6594('0x3f')][_0x6594('0x69')]({'where':{'id':_0x1fd4a1[_0x6594('0x63')]['id']}})[_0x6594('0x21')](handleEntityNotFound(_0x362344,null))[_0x6594('0x21')](function(_0x2c8b04){if(_0x2c8b04){_0x5b1e21=_0x2c8b04;_0x199bca[_0x6594('0x42')]=_['keys'](db[_0x6594('0x73')]['rawAttributes']);_0x199bca[_0x6594('0x43')]=_['keys'](_0x1fd4a1[_0x6594('0x43')]);_0x199bca[_0x6594('0x45')]=_[_0x6594('0x46')](_0x199bca[_0x6594('0x42')],_0x199bca['query']);_0x4480aa[_0x6594('0x47')]=_[_0x6594('0x46')](_0x199bca['model'],qs[_0x6594('0x48')](_0x1fd4a1[_0x6594('0x43')][_0x6594('0x48')]));_0x4480aa[_0x6594('0x47')]=_0x4480aa['attributes'][_0x6594('0x56')]?_0x4480aa[_0x6594('0x47')]:_0x199bca[_0x6594('0x42')];_0x4480aa[_0x6594('0x4b')]=qs[_0x6594('0x4c')](_0x1fd4a1[_0x6594('0x43')]['sort']);_0x4480aa['where']=qs['filters'](_[_0x6594('0x6a')](_0x1fd4a1['query'],_0x199bca['filters']));if(_0x1fd4a1['query'][_0x6594('0x4d')]){_0x4480aa[_0x6594('0x4f')]=_[_0x6594('0x4e')](_0x4480aa['where'],{'$or':_['map'](_0x4480aa[_0x6594('0x47')],function(_0x295bbf){var _0x4ecbdb={};_0x4ecbdb[_0x295bbf]={'$like':'%'+_0x1fd4a1[_0x6594('0x43')][_0x6594('0x4d')]+'%'};return _0x4ecbdb;})});}_0x4480aa=_['merge']({},_0x4480aa,_0x1fd4a1[_0x6594('0x51')]);return _0x5b1e21[_0x6594('0xba')](_0x4480aa);}})['then'](function(_0x535b0d){if(_0x535b0d){_0x3339fa=_0x535b0d['length'];if(!_0x1fd4a1['query'][_0x6594('0x49')](_0x6594('0x4a'))){_0x4480aa[_0x6594('0x31')]=qs[_0x6594('0x31')](_0x1fd4a1[_0x6594('0x43')][_0x6594('0x31')]);_0x4480aa[_0x6594('0x30')]=qs[_0x6594('0x30')](_0x1fd4a1[_0x6594('0x43')]['offset']);}return _0x5b1e21[_0x6594('0xba')](_0x4480aa);}})[_0x6594('0x21')](function(_0x4a81ca){if(_0x4a81ca){return _0x4a81ca?{'count':_0x3339fa,'rows':_0x4a81ca}:null;}})[_0x6594('0x21')](respondWithResult(_0x362344,null))[_0x6594('0x2a')](handleError(_0x362344,null));}; \ No newline at end of file +var _0xc43b=['attributes','fields','length','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','params','Pause','rawAttributes','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','destroy','describe','FaxAccountId','findOne','Disposition','nolimit','rows','removeDispositions','ids','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','hasOwnProperty','Contact','User','Owner','fullname','internal','color','tag','findAll','addApplications','sequelize','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','exten','app','system','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','addAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','CmList','List','CmContact','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFaxRpc,\x20%s','info','addAgents','spread','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','get','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','key','model','query','keys','filters','intersection'];(function(_0x50b11a,_0x1b337d){var _0x32a4d4=function(_0x33a8e2){while(--_0x33a8e2){_0x50b11a['push'](_0x50b11a['shift']());}};_0x32a4d4(++_0x1b337d);}(_0xc43b,0x134));var _0xbc43=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc43b[_0x68c979];return _0x4f0001;};'use strict';var pdf=require(_0xbc43('0x0'));var emlformat=require(_0xbc43('0x1'));var rimraf=require(_0xbc43('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc43('0x3'));var rp=require(_0xbc43('0x4'));var moment=require(_0xbc43('0x5'));var BPromise=require(_0xbc43('0x6'));var Mustache=require(_0xbc43('0x7'));var util=require('util');var path=require(_0xbc43('0x8'));var sox=require(_0xbc43('0x9'));var csv=require(_0xbc43('0xa'));var ejs=require(_0xbc43('0xb'));var fs=require('fs');var _=require(_0xbc43('0xc'));var squel=require(_0xbc43('0xd'));var crypto=require(_0xbc43('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbc43('0xf'));var toCsv=require(_0xbc43('0xa'));var querystring=require(_0xbc43('0x10'));var Papa=require('papaparse');var Redis=require(_0xbc43('0x11'));var authService=require(_0xbc43('0x12'));var qs=require(_0xbc43('0x13'));var as=require(_0xbc43('0x14'));var hardwareService=require(_0xbc43('0x15'));var logger=require('../../config/logger')(_0xbc43('0x16'));var utils=require(_0xbc43('0x17'));var config=require('../../config/environment');var db=require(_0xbc43('0x18'))['db'];config['redis']=_[_0xbc43('0x19')](config[_0xbc43('0x1a')],{'host':_0xbc43('0x1b'),'port':0x18eb});var socket=require(_0xbc43('0x1c'))(new Redis(config['redis']));require(_0xbc43('0x1d'))[_0xbc43('0x1e')](socket);var jayson=require(_0xbc43('0x1f'));var client=jayson['client'][_0xbc43('0x20')]({'port':0x232c});var client9002=jayson[_0xbc43('0x21')][_0xbc43('0x20')]({'port':0x232a});function checkPasswordPattern(_0x210070,_0x5efb9f,_0x1654ad){if(_0x1654ad){var _0x23613f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x23613f[_0xbc43('0x22')](_0x5efb9f)){return _0x210070;}else{throw new db[(_0xbc43('0x23'))][(_0xbc43('0x24'))](_0xbc43('0x25'));}}else{return _0x210070;}}function respondWithRpcPromise(_0x5675b3,_0x21e863,_0x408461,_0x215240){return new BPromise(function(_0x4d1fb8,_0x3092f2){var _0x21b7ab=_0x215240||client;return _0x21b7ab['request'](_0x5675b3,_0x408461)[_0xbc43('0x26')](function(_0x3c3b67){logger['info'](_0xbc43('0x27'),_0x21e863,_0xbc43('0x28'));logger[_0xbc43('0x29')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x21e863,_0xbc43('0x28'),JSON[_0xbc43('0x2a')](_0x3c3b67));if(_0x3c3b67['error']){if(_0x3c3b67['error'][_0xbc43('0x2b')]===0x1f4){logger[_0xbc43('0x2c')]('FaxAccount,\x20%s,\x20%s',_0x21e863,_0x3c3b67['error'][_0xbc43('0x2d')]);return _0x3092f2(_0x3c3b67['error'][_0xbc43('0x2d')]);}logger[_0xbc43('0x2c')](_0xbc43('0x27'),_0x21e863,_0x3c3b67[_0xbc43('0x2c')][_0xbc43('0x2d')]);return _0x4d1fb8(_0x3c3b67['error']['message']);}else{logger['info'](_0xbc43('0x27'),_0x21e863,_0xbc43('0x28'));_0x4d1fb8(_0x3c3b67[_0xbc43('0x2e')][_0xbc43('0x2d')]);}})['catch'](function(_0x19de90){logger[_0xbc43('0x2c')](_0xbc43('0x27'),_0x21e863,_0x19de90);_0x3092f2(_0x19de90);});});}function respondWithStatusCode(_0x34544f,_0x33e307){_0x33e307=_0x33e307||0xcc;return function(_0x2afc05){if(_0x2afc05){return _0x34544f[_0xbc43('0x2f')](_0x33e307);}return _0x34544f[_0xbc43('0x30')](_0x33e307)[_0xbc43('0x31')]();};}function respondWithResult(_0x9c2393,_0x2871d8){_0x2871d8=_0x2871d8||0xc8;return function(_0x20da9c){if(_0x20da9c){return _0x9c2393[_0xbc43('0x30')](_0x2871d8)[_0xbc43('0x32')](_0x20da9c);}};}function respondWithFilteredResult(_0x44e443,_0x2bb6db){return function(_0x3a0369){if(_0x3a0369){var _0x4b2f07=_0x3a0369[_0xbc43('0x33')],_0x22e767=_0x2bb6db[_0xbc43('0x34')],_0x4e907b=_0x2bb6db['offset']+_0x2bb6db[_0xbc43('0x35')],_0x11018b;if(_0x4e907b>=_0x4b2f07){_0x4e907b=_0x4b2f07;_0x11018b=0xc8;}else{_0x11018b=0xce;}_0x44e443['status'](_0x11018b);return _0x44e443['set'](_0xbc43('0x36'),_0x22e767+'-'+_0x4e907b+'/'+_0x4b2f07)[_0xbc43('0x32')](_0x3a0369);}return null;};}function patchUpdates(_0x5430b4){return function(_0x47572d){try{jsonpatch[_0xbc43('0x37')](_0x47572d,_0x5430b4,!![]);}catch(_0x312a5d){return BPromise['reject'](_0x312a5d);}return _0x47572d['save']();};}function saveUpdates(_0x71a5c4,_0x3389a6){return function(_0x52a091){if(_0x52a091){return _0x52a091[_0xbc43('0x38')](_0x71a5c4)[_0xbc43('0x26')](function(_0x402796){return _0x402796;});}return null;};}function removeEntity(_0x8b5d09,_0x54c723){return function(_0x540f9d){if(_0x540f9d){return _0x540f9d['destroy']()[_0xbc43('0x26')](function(){var _0x5cb9a1=_0x540f9d[_0xbc43('0x39')]({'plain':!![]});var _0x12f864='FaxAccounts';return db[_0xbc43('0x3a')]['destroy']({'where':{'type':_0x12f864,'resourceId':_0x5cb9a1['id']}})[_0xbc43('0x26')](function(){return _0x540f9d;});})[_0xbc43('0x26')](function(){_0x8b5d09[_0xbc43('0x30')](0xcc)[_0xbc43('0x31')]();});}};}function handleEntityNotFound(_0x5bcee8,_0x24fbf0){return function(_0xd38a7){if(!_0xd38a7){_0x5bcee8[_0xbc43('0x2f')](0x194);}return _0xd38a7;};}function handleError(_0x3394bc,_0x1263f9){_0x1263f9=_0x1263f9||0x1f4;return function(_0x31e496){logger['error'](_0x31e496[_0xbc43('0x3b')]);if(_0x31e496['name']){delete _0x31e496[_0xbc43('0x3c')];}_0x3394bc[_0xbc43('0x30')](_0x1263f9)[_0xbc43('0x3d')](_0x31e496);};}exports[_0xbc43('0x3e')]=function(_0x122540,_0x36fb04){var _0x29130e={'include':[{'model':db['Pause'],'as':_0xbc43('0x3f')}]},_0x3e941a={},_0x112a7c={'count':0x0,'rows':[]};var _0x31f6d6=_[_0xbc43('0x40')](db[_0xbc43('0x41')]['rawAttributes'],function(_0x1c4810){return{'name':_0x1c4810['fieldName'],'type':_0x1c4810['type'][_0xbc43('0x42')]};});_0x3e941a[_0xbc43('0x43')]=_[_0xbc43('0x40')](_0x31f6d6,_0xbc43('0x3c'));_0x3e941a[_0xbc43('0x44')]=_[_0xbc43('0x45')](_0x122540[_0xbc43('0x44')]);_0x3e941a[_0xbc43('0x46')]=_[_0xbc43('0x47')](_0x3e941a[_0xbc43('0x43')],_0x3e941a[_0xbc43('0x44')]);_0x29130e[_0xbc43('0x48')]=_[_0xbc43('0x47')](_0x3e941a[_0xbc43('0x43')],qs['fields'](_0x122540[_0xbc43('0x44')][_0xbc43('0x49')]));_0x29130e[_0xbc43('0x48')]=_0x29130e['attributes'][_0xbc43('0x4a')]?_0x29130e['attributes']:_0x3e941a[_0xbc43('0x43')];if(!_0x122540['query']['hasOwnProperty']('nolimit')){_0x29130e[_0xbc43('0x35')]=qs[_0xbc43('0x35')](_0x122540[_0xbc43('0x44')][_0xbc43('0x35')]);_0x29130e[_0xbc43('0x34')]=qs['offset'](_0x122540[_0xbc43('0x44')]['offset']);}_0x29130e[_0xbc43('0x4b')]=qs[_0xbc43('0x4c')](_0x122540['query'][_0xbc43('0x4c')]);_0x29130e['where']=qs[_0xbc43('0x46')](_[_0xbc43('0x4d')](_0x122540[_0xbc43('0x44')],_0x3e941a[_0xbc43('0x46')]));if(_0x122540[_0xbc43('0x44')][_0xbc43('0x4e')]){_0x29130e[_0xbc43('0x4f')]=_[_0xbc43('0x50')](_0x29130e[_0xbc43('0x4f')],{'$or':_[_0xbc43('0x40')](_0x31f6d6,function(_0x4316e5){if(_0x4316e5[_0xbc43('0x51')]!==_0xbc43('0x52')){var _0x4108fa={};_0x4108fa[_0x4316e5[_0xbc43('0x3c')]]={'$like':'%'+_0x122540[_0xbc43('0x44')][_0xbc43('0x4e')]+'%'};return _0x4108fa;}})});}_0x29130e=_[_0xbc43('0x50')]({},_0x29130e,_0x122540[_0xbc43('0x53')]);var _0x283634={'where':_0x29130e[_0xbc43('0x4f')]};return db[_0xbc43('0x41')]['count'](_0x283634)[_0xbc43('0x26')](function(_0x38062e){_0x112a7c[_0xbc43('0x33')]=_0x38062e;if(_0x122540[_0xbc43('0x44')]['includeAll']){_0x29130e[_0xbc43('0x54')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x29130e);})[_0xbc43('0x26')](function(_0x3b0b7b){_0x112a7c['rows']=_0x3b0b7b;return _0x112a7c;})[_0xbc43('0x26')](respondWithFilteredResult(_0x36fb04,_0x29130e))['catch'](handleError(_0x36fb04,null));};exports['show']=function(_0x2780ce,_0x19dc80){var _0xc6e7c={'raw':![],'where':{'id':_0x2780ce[_0xbc43('0x55')]['id']},'include':[{'model':db[_0xbc43('0x56')],'as':_0xbc43('0x3f')}]},_0x58a15d={};_0x58a15d[_0xbc43('0x43')]=_['keys'](db[_0xbc43('0x41')][_0xbc43('0x57')]);_0x58a15d['query']=_[_0xbc43('0x45')](_0x2780ce[_0xbc43('0x44')]);_0x58a15d[_0xbc43('0x46')]=_[_0xbc43('0x47')](_0x58a15d['model'],_0x58a15d[_0xbc43('0x44')]);_0xc6e7c[_0xbc43('0x48')]=_['intersection'](_0x58a15d[_0xbc43('0x43')],qs[_0xbc43('0x49')](_0x2780ce[_0xbc43('0x44')][_0xbc43('0x49')]));_0xc6e7c[_0xbc43('0x48')]=_0xc6e7c[_0xbc43('0x48')][_0xbc43('0x4a')]?_0xc6e7c['attributes']:_0x58a15d['model'];if(_0x2780ce['query'][_0xbc43('0x58')]){_0xc6e7c['include']=[{'all':!![]}];}_0xc6e7c=_['merge']({},_0xc6e7c,_0x2780ce[_0xbc43('0x53')]);return db['FaxAccount'][_0xbc43('0x59')](_0xc6e7c)[_0xbc43('0x26')](handleEntityNotFound(_0x19dc80,null))[_0xbc43('0x26')](respondWithResult(_0x19dc80,null))[_0xbc43('0x5a')](handleError(_0x19dc80,null));};exports['create']=function(_0x45f25b,_0x19cab5){return db[_0xbc43('0x41')][_0xbc43('0x5b')](_0x45f25b['body'],{})['then'](function(_0x3a9b69){var _0x376b83=_0x45f25b[_0xbc43('0x5c')][_0xbc43('0x39')]({'plain':!![]});if(!_0x376b83)throw new Error(_0xbc43('0x5d'));if(_0x376b83[_0xbc43('0x5e')]===_0xbc43('0x5c')){var _0x570ccc=_0x3a9b69[_0xbc43('0x39')]({'plain':!![]});var _0x5c6385='FaxAccounts';return db[_0xbc43('0x5f')][_0xbc43('0x59')]({'where':{'name':_0x5c6385,'userProfileId':_0x376b83[_0xbc43('0x60')]},'raw':!![]})[_0xbc43('0x26')](function(_0x159e06){if(_0x159e06&&_0x159e06[_0xbc43('0x61')]===0x0){return db[_0xbc43('0x3a')][_0xbc43('0x5b')]({'name':_0x570ccc[_0xbc43('0x3c')],'resourceId':_0x570ccc['id'],'type':_0x159e06[_0xbc43('0x3c')],'sectionId':_0x159e06['id']},{})['then'](function(){return _0x3a9b69;});}else{return _0x3a9b69;}})[_0xbc43('0x5a')](function(_0x2efea0){logger[_0xbc43('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2efea0);throw _0x2efea0;});}return _0x3a9b69;})[_0xbc43('0x26')](respondWithResult(_0x19cab5,0xc9))[_0xbc43('0x5a')](handleError(_0x19cab5,null));};exports[_0xbc43('0x38')]=function(_0x150550,_0x3edaef){if(_0x150550['body']['id']){delete _0x150550[_0xbc43('0x62')]['id'];}return db[_0xbc43('0x41')][_0xbc43('0x59')]({'where':{'id':_0x150550['params']['id']},'include':[{'model':db[_0xbc43('0x56')],'as':'mandatoryDispositionPause'}]})[_0xbc43('0x26')](handleEntityNotFound(_0x3edaef,null))[_0xbc43('0x26')](saveUpdates(_0x150550[_0xbc43('0x62')],null))[_0xbc43('0x26')](respondWithResult(_0x3edaef,null))[_0xbc43('0x5a')](handleError(_0x3edaef,null));};exports[_0xbc43('0x63')]=function(_0x17b1f6,_0x8f95b8){return db['FaxAccount'][_0xbc43('0x59')]({'where':{'id':_0x17b1f6[_0xbc43('0x55')]['id']}})['then'](handleEntityNotFound(_0x8f95b8,null))[_0xbc43('0x26')](removeEntity(_0x8f95b8,null))[_0xbc43('0x5a')](handleError(_0x8f95b8,null));};exports[_0xbc43('0x64')]=function(_0x4c2297,_0x1f1e0b){return db[_0xbc43('0x41')][_0xbc43('0x64')]()[_0xbc43('0x26')](respondWithResult(_0x1f1e0b,null))[_0xbc43('0x5a')](handleError(_0x1f1e0b,null));};exports['addDisposition']=function(_0x470bc8,_0x5fe558,_0x237490){if(_0x470bc8[_0xbc43('0x62')]['id']){delete _0x470bc8[_0xbc43('0x62')]['id'];}return db[_0xbc43('0x41')][_0xbc43('0x59')]({'where':{'id':_0x470bc8[_0xbc43('0x55')]['id']}})[_0xbc43('0x26')](handleEntityNotFound(_0x5fe558,null))[_0xbc43('0x26')](function(_0x56293b){if(_0x56293b){_0x470bc8[_0xbc43('0x62')][_0xbc43('0x65')]=_0x56293b['id'];return db['Disposition'][_0xbc43('0x5b')](_0x470bc8[_0xbc43('0x62')]);}})[_0xbc43('0x26')](respondWithResult(_0x5fe558,null))[_0xbc43('0x5a')](handleError(_0x5fe558,null));};exports['getDispositions']=function(_0x2ccc10,_0x13d453,_0x19f486){var _0x55a411={'raw':![],'where':{}};var _0x4f76a1={};var _0x37c096={'count':0x0,'rows':[]};return db[_0xbc43('0x41')][_0xbc43('0x66')]({'where':{'id':_0x2ccc10['params']['id']}})[_0xbc43('0x26')](handleEntityNotFound(_0x13d453,null))['then'](function(_0x39d78d){if(_0x39d78d){_0x4f76a1[_0xbc43('0x43')]=_[_0xbc43('0x45')](db[_0xbc43('0x67')][_0xbc43('0x57')]);_0x4f76a1[_0xbc43('0x44')]=_[_0xbc43('0x45')](_0x2ccc10['query']);_0x4f76a1[_0xbc43('0x46')]=_['intersection'](_0x4f76a1[_0xbc43('0x43')],_0x4f76a1[_0xbc43('0x44')]);_0x55a411['attributes']=_[_0xbc43('0x47')](_0x4f76a1['model'],qs[_0xbc43('0x49')](_0x2ccc10[_0xbc43('0x44')]['fields']));_0x55a411[_0xbc43('0x48')]=_0x55a411[_0xbc43('0x48')]['length']?_0x55a411['attributes']:_0x4f76a1[_0xbc43('0x43')];if(!_0x2ccc10['query']['hasOwnProperty'](_0xbc43('0x68'))){_0x55a411['limit']=qs['limit'](_0x2ccc10[_0xbc43('0x44')]['limit']);_0x55a411['offset']=qs[_0xbc43('0x34')](_0x2ccc10[_0xbc43('0x44')][_0xbc43('0x34')]);}_0x55a411[_0xbc43('0x4b')]=qs[_0xbc43('0x4c')](_0x2ccc10[_0xbc43('0x44')][_0xbc43('0x4c')]);_0x55a411['where']=qs[_0xbc43('0x46')](_[_0xbc43('0x4d')](_0x2ccc10[_0xbc43('0x44')],_0x4f76a1[_0xbc43('0x46')]));_0x55a411[_0xbc43('0x4f')][_0xbc43('0x65')]=_0x39d78d['id'];if(_0x2ccc10[_0xbc43('0x44')][_0xbc43('0x4e')]){_0x55a411[_0xbc43('0x4f')]=_['merge'](_0x55a411[_0xbc43('0x4f')],{'$or':_[_0xbc43('0x40')](_0x55a411[_0xbc43('0x48')],function(_0x3bd2bd){var _0x22493b={};_0x22493b[_0x3bd2bd]={'$like':'%'+_0x2ccc10['query'][_0xbc43('0x4e')]+'%'};return _0x22493b;})});}_0x55a411=_[_0xbc43('0x50')]({},_0x55a411,_0x2ccc10[_0xbc43('0x53')]);return db[_0xbc43('0x67')][_0xbc43('0x33')]({'where':_0x55a411['where']})[_0xbc43('0x26')](function(_0x1fabb7){_0x37c096[_0xbc43('0x33')]=_0x1fabb7;if(_0x2ccc10['query'][_0xbc43('0x58')]){_0x55a411[_0xbc43('0x54')]=[{'all':!![]}];}return db[_0xbc43('0x67')]['findAll'](_0x55a411);})['then'](function(_0x54971c){_0x37c096[_0xbc43('0x69')]=_0x54971c;return _0x37c096;});}})[_0xbc43('0x26')](respondWithFilteredResult(_0x13d453,_0x55a411))[_0xbc43('0x5a')](handleError(_0x13d453,null));};exports['removeDispositions']=function(_0x13c054,_0x5dcecc,_0x5d0d12){return db[_0xbc43('0x41')][_0xbc43('0x59')]({'where':{'id':_0x13c054['params']['id']}})[_0xbc43('0x26')](handleEntityNotFound(_0x5dcecc,null))[_0xbc43('0x26')](function(_0x233cbe){if(_0x233cbe){return _0x233cbe[_0xbc43('0x6a')](_0x13c054[_0xbc43('0x44')][_0xbc43('0x6b')]);}})['then'](respondWithStatusCode(_0x5dcecc,null))[_0xbc43('0x5a')](handleError(_0x5dcecc,null));};exports['addAnswer']=function(_0x34e439,_0x28a86f,_0x574a1c){if(_0x34e439['body']['id']){delete _0x34e439[_0xbc43('0x62')]['id'];}return db[_0xbc43('0x41')]['find']({'where':{'id':_0x34e439['params']['id']}})['then'](handleEntityNotFound(_0x28a86f,null))[_0xbc43('0x26')](function(_0x2a67cf){if(_0x2a67cf){_0x34e439[_0xbc43('0x62')][_0xbc43('0x65')]=_0x2a67cf['id'];return db[_0xbc43('0x6c')][_0xbc43('0x5b')](_0x34e439[_0xbc43('0x62')]);}})[_0xbc43('0x26')](respondWithResult(_0x28a86f,null))[_0xbc43('0x5a')](handleError(_0x28a86f,null));};exports['getAnswers']=function(_0x3299f6,_0x3f6bc8,_0x56b206){var _0x210209={'raw':![],'where':{}};var _0xeeb7de={};var _0x2ffac1={'count':0x0,'rows':[]};return db[_0xbc43('0x41')][_0xbc43('0x66')]({'where':{'id':_0x3299f6[_0xbc43('0x55')]['id']}})['then'](handleEntityNotFound(_0x3f6bc8,null))[_0xbc43('0x26')](function(_0x45c0ab){if(_0x45c0ab){_0xeeb7de[_0xbc43('0x43')]=_['keys'](db[_0xbc43('0x6c')][_0xbc43('0x57')]);_0xeeb7de['query']=_[_0xbc43('0x45')](_0x3299f6[_0xbc43('0x44')]);_0xeeb7de[_0xbc43('0x46')]=_[_0xbc43('0x47')](_0xeeb7de[_0xbc43('0x43')],_0xeeb7de[_0xbc43('0x44')]);_0x210209[_0xbc43('0x48')]=_[_0xbc43('0x47')](_0xeeb7de['model'],qs[_0xbc43('0x49')](_0x3299f6['query'][_0xbc43('0x49')]));_0x210209[_0xbc43('0x48')]=_0x210209[_0xbc43('0x48')][_0xbc43('0x4a')]?_0x210209[_0xbc43('0x48')]:_0xeeb7de[_0xbc43('0x43')];if(!_0x3299f6[_0xbc43('0x44')]['hasOwnProperty'](_0xbc43('0x68'))){_0x210209['limit']=qs[_0xbc43('0x35')](_0x3299f6[_0xbc43('0x44')]['limit']);_0x210209[_0xbc43('0x34')]=qs[_0xbc43('0x34')](_0x3299f6[_0xbc43('0x44')][_0xbc43('0x34')]);}_0x210209['order']=qs[_0xbc43('0x4c')](_0x3299f6['query'][_0xbc43('0x4c')]);_0x210209['where']=qs['filters'](_[_0xbc43('0x4d')](_0x3299f6[_0xbc43('0x44')],_0xeeb7de[_0xbc43('0x46')]));_0x210209[_0xbc43('0x4f')][_0xbc43('0x65')]=_0x45c0ab['id'];if(_0x3299f6[_0xbc43('0x44')][_0xbc43('0x4e')]){_0x210209['where']=_[_0xbc43('0x50')](_0x210209['where'],{'$or':_[_0xbc43('0x40')](_0x210209[_0xbc43('0x48')],function(_0x2f7409){var _0x877c46={};_0x877c46[_0x2f7409]={'$like':'%'+_0x3299f6[_0xbc43('0x44')][_0xbc43('0x4e')]+'%'};return _0x877c46;})});}_0x210209=_[_0xbc43('0x50')]({},_0x210209,_0x3299f6[_0xbc43('0x53')]);return db['CannedAnswer'][_0xbc43('0x33')]({'where':_0x210209[_0xbc43('0x4f')]})[_0xbc43('0x26')](function(_0x49e441){_0x2ffac1[_0xbc43('0x33')]=_0x49e441;if(_0x3299f6[_0xbc43('0x44')][_0xbc43('0x58')]){_0x210209[_0xbc43('0x54')]=[{'all':!![]}];}return db[_0xbc43('0x6c')]['findAll'](_0x210209);})['then'](function(_0x1bdf3f){_0x2ffac1[_0xbc43('0x69')]=_0x1bdf3f;return _0x2ffac1;});}})['then'](respondWithFilteredResult(_0x3f6bc8,_0x210209))[_0xbc43('0x5a')](handleError(_0x3f6bc8,null));};exports[_0xbc43('0x6d')]=function(_0x5c0716,_0x17ffb4,_0x5e2769){return db[_0xbc43('0x41')]['find']({'where':{'id':_0x5c0716[_0xbc43('0x55')]['id']}})[_0xbc43('0x26')](handleEntityNotFound(_0x17ffb4,null))['then'](function(_0x3647d4){if(_0x3647d4){return _0x3647d4[_0xbc43('0x6d')](_0x5c0716[_0xbc43('0x44')][_0xbc43('0x6b')]);}})['then'](respondWithStatusCode(_0x17ffb4,null))[_0xbc43('0x5a')](handleError(_0x17ffb4,null));};exports[_0xbc43('0x6e')]=function(_0xb4b2d0,_0x1d496a,_0xaa8d3f){return db[_0xbc43('0x6f')][_0xbc43('0x59')]({'where':{'id':_0xb4b2d0[_0xbc43('0x55')]['id']}})['then'](handleEntityNotFound(_0x1d496a,null))[_0xbc43('0x26')](function(_0x44e4e4){if(_0x44e4e4){return _0x44e4e4[_0xbc43('0x6e')](_0xb4b2d0[_0xbc43('0x62')][_0xbc43('0x6b')],_['omit'](_0xb4b2d0['body'],[_0xbc43('0x6b'),'id'])||{});}})[_0xbc43('0x26')](respondWithResult(_0x1d496a,null))[_0xbc43('0x5a')](handleError(_0x1d496a,null));};exports['getInteractions']=function(_0xbae9df,_0x25e797,_0xc3acfc){var _0x1d05d9={'raw':![],'where':{}};var _0x4a1436={};var _0x10593d={'count':0x0,'rows':[]};return db[_0xbc43('0x41')]['findOne']({'where':{'id':_0xbae9df[_0xbc43('0x55')]['id']}})[_0xbc43('0x26')](handleEntityNotFound(_0x25e797,null))[_0xbc43('0x26')](function(_0x5e6d56){if(_0x5e6d56){_0x4a1436[_0xbc43('0x43')]=_[_0xbc43('0x45')](db[_0xbc43('0x6f')][_0xbc43('0x57')]);_0x4a1436[_0xbc43('0x44')]=_[_0xbc43('0x45')](_0xbae9df[_0xbc43('0x44')]);_0x4a1436['filters']=_['intersection'](_0x4a1436[_0xbc43('0x43')],_0x4a1436['query']);_0x1d05d9[_0xbc43('0x48')]=_[_0xbc43('0x47')](_0x4a1436[_0xbc43('0x43')],qs[_0xbc43('0x49')](_0xbae9df[_0xbc43('0x44')][_0xbc43('0x49')]));_0x1d05d9[_0xbc43('0x48')]=_0x1d05d9[_0xbc43('0x48')][_0xbc43('0x4a')]?_0x1d05d9['attributes']:_0x4a1436['model'];if(!_0xbae9df[_0xbc43('0x44')][_0xbc43('0x70')](_0xbc43('0x68'))){_0x1d05d9[_0xbc43('0x35')]=qs['limit'](_0xbae9df[_0xbc43('0x44')][_0xbc43('0x35')]);_0x1d05d9[_0xbc43('0x34')]=qs[_0xbc43('0x34')](_0xbae9df[_0xbc43('0x44')][_0xbc43('0x34')]);}_0x1d05d9[_0xbc43('0x4b')]=qs[_0xbc43('0x4c')](_0xbae9df[_0xbc43('0x44')][_0xbc43('0x4c')]);_0x1d05d9[_0xbc43('0x4f')]=qs[_0xbc43('0x46')](_['pick'](_0xbae9df[_0xbc43('0x44')],_0x4a1436['filters']));_0x1d05d9['where'][_0xbc43('0x65')]=_0x5e6d56['id'];if(_0xbae9df[_0xbc43('0x44')][_0xbc43('0x4e')]){_0x1d05d9[_0xbc43('0x4f')]=_[_0xbc43('0x50')](_0x1d05d9[_0xbc43('0x4f')],{'$or':_[_0xbc43('0x40')](_0x1d05d9[_0xbc43('0x48')],function(_0x596563){var _0x1c7f3a={};_0x1c7f3a[_0x596563]={'$like':'%'+_0xbae9df[_0xbc43('0x44')][_0xbc43('0x4e')]+'%'};return _0x1c7f3a;})});}_0x1d05d9=_[_0xbc43('0x50')]({},_0x1d05d9,_0xbae9df[_0xbc43('0x53')]);return db[_0xbc43('0x6f')][_0xbc43('0x33')]({'where':_0x1d05d9[_0xbc43('0x4f')]})[_0xbc43('0x26')](function(_0x2d365a){_0x10593d[_0xbc43('0x33')]=_0x2d365a;if(_0xbae9df[_0xbc43('0x44')][_0xbc43('0x58')]){_0x1d05d9[_0xbc43('0x54')]=[{'model':db['CmContact'],'as':_0xbc43('0x71'),'required':![]},{'model':db[_0xbc43('0x72')],'as':_0xbc43('0x73'),'attributes':['name',_0xbc43('0x74'),_0xbc43('0x75')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xbc43('0x3c'),_0xbc43('0x76')],'where':_0xbae9df[_0xbc43('0x44')]['tag']?{'id':_0xbae9df[_0xbc43('0x44')][_0xbc43('0x77')]}:undefined,'required':_0xbae9df['query'][_0xbc43('0x77')]?!![]:![]}];}return db[_0xbc43('0x6f')][_0xbc43('0x78')](_0x1d05d9);})['then'](function(_0x275954){_0x10593d[_0xbc43('0x69')]=_0x275954;return _0x10593d;});}})['then'](respondWithFilteredResult(_0x25e797,_0x1d05d9))['catch'](handleError(_0x25e797,null));};exports[_0xbc43('0x79')]=function(_0x2b50a6,_0x4c990d,_0x38fbda){return db[_0xbc43('0x41')]['findOne']({'where':{'id':_0x2b50a6[_0xbc43('0x55')]['id']}})[_0xbc43('0x26')](handleEntityNotFound(_0x4c990d,null))[_0xbc43('0x26')](function(_0x3d22f9){if(_0x3d22f9){return db[_0xbc43('0x7a')]['transaction'](function(_0x3deaee){return db[_0xbc43('0x7b')][_0xbc43('0x63')]({'where':{'FaxAccountId':_0x2b50a6[_0xbc43('0x55')]['id']},'transaction':_0x3deaee})['then'](function(_0x186c2b){var _0x42c971=_[_0xbc43('0x40')](_0x2b50a6['body'],function(_0x48ab28){_0x48ab28[_0xbc43('0x65')]=_0x2b50a6['params']['id'];return _0x48ab28;});return db[_0xbc43('0x7b')][_0xbc43('0x7c')](_0x42c971,{'transaction':_0x3deaee});});})[_0xbc43('0x26')](function(){return db[_0xbc43('0x7b')][_0xbc43('0x7d')]({'where':{'FaxAccountId':_0x2b50a6[_0xbc43('0x55')]['id']},'order':_0xbc43('0x7e')});});}})['then'](respondWithResult(_0x4c990d,null))[_0xbc43('0x5a')](handleError(_0x4c990d,null));};exports[_0xbc43('0x7f')]=function(_0x1b02a1,_0xcaea8d,_0x4acb6d){var _0x19128a={};var _0x512a7c={};var _0x425ec0;var _0x7e72d7;return db[_0xbc43('0x41')][_0xbc43('0x66')]({'where':{'id':_0x1b02a1['params']['id']}})['then'](handleEntityNotFound(_0xcaea8d,null))[_0xbc43('0x26')](function(_0x35e4d3){if(_0x35e4d3){_0x425ec0=_0x35e4d3;_0x512a7c[_0xbc43('0x43')]=_[_0xbc43('0x45')](db[_0xbc43('0x7b')][_0xbc43('0x57')]);_0x512a7c[_0xbc43('0x44')]=_['keys'](_0x1b02a1[_0xbc43('0x44')]);_0x512a7c[_0xbc43('0x46')]=_['intersection'](_0x512a7c[_0xbc43('0x43')],_0x512a7c[_0xbc43('0x44')]);_0x19128a[_0xbc43('0x48')]=_[_0xbc43('0x47')](_0x512a7c[_0xbc43('0x43')],qs[_0xbc43('0x49')](_0x1b02a1['query'][_0xbc43('0x49')]));_0x19128a[_0xbc43('0x48')]=_0x19128a[_0xbc43('0x48')][_0xbc43('0x4a')]?_0x19128a[_0xbc43('0x48')]:_0x512a7c[_0xbc43('0x43')];_0x19128a['order']=qs[_0xbc43('0x4c')](_0x1b02a1[_0xbc43('0x44')][_0xbc43('0x4c')]);_0x19128a[_0xbc43('0x4f')]=qs[_0xbc43('0x46')](_[_0xbc43('0x4d')](_0x1b02a1[_0xbc43('0x44')],_0x512a7c[_0xbc43('0x46')]));if(_0x1b02a1[_0xbc43('0x44')][_0xbc43('0x4e')]){_0x19128a[_0xbc43('0x4f')]=_[_0xbc43('0x50')](_0x19128a[_0xbc43('0x4f')],{'$or':_[_0xbc43('0x40')](_0x19128a['attributes'],function(_0x152bb7){var _0x2fc16f={};_0x2fc16f[_0x152bb7]={'$like':'%'+_0x1b02a1[_0xbc43('0x44')]['filter']+'%'};return _0x2fc16f;})});}_0x19128a=_[_0xbc43('0x50')]({},_0x19128a,_0x1b02a1['options']);return _0x425ec0[_0xbc43('0x7f')](_0x19128a);}})[_0xbc43('0x26')](function(_0xfc1cf0){if(_0xfc1cf0){_0x7e72d7=_0xfc1cf0['length'];if(!_0x1b02a1['query'][_0xbc43('0x70')](_0xbc43('0x68'))){_0x19128a[_0xbc43('0x35')]=qs[_0xbc43('0x35')](_0x1b02a1[_0xbc43('0x44')][_0xbc43('0x35')]);_0x19128a[_0xbc43('0x34')]=qs[_0xbc43('0x34')](_0x1b02a1[_0xbc43('0x44')][_0xbc43('0x34')]);}return _0x425ec0[_0xbc43('0x7f')](_0x19128a);}})[_0xbc43('0x26')](function(_0x10df10){if(_0x10df10){return _0x10df10?{'count':_0x7e72d7,'rows':_0x10df10}:null;}})[_0xbc43('0x26')](respondWithResult(_0xcaea8d,null))[_0xbc43('0x5a')](handleError(_0xcaea8d,null));};function Extension(_0x3937ff,_0x685a5e,_0x57d79e,_0x5df8c3){this[_0xbc43('0x80')]='from-voip-provider';this[_0xbc43('0x81')]=_0x3937ff['localstationid'];this[_0xbc43('0x82')]=_0x5df8c3;this[_0xbc43('0x51')]=_0xbc43('0x83');this['description']='Fax\x20Extension';this['FaxAccountId']=_0x3937ff['id'];this['priority']=_0x685a5e;this[_0xbc43('0x84')]=_0x57d79e;}function createExtensionsReciveFax(_0x80eaf3){var _0x19c51f=0x1;var _0x152f6f=[];_0x152f6f[_0xbc43('0x85')](new Extension(_0x80eaf3,_0x19c51f,'',_0xbc43('0x86')));_0x19c51f+=0x1;_0x152f6f[_0xbc43('0x85')](new Extension(_0x80eaf3,_0x19c51f,_0xbc43('0x87'),_0xbc43('0x88')));_0x19c51f+=0x1;for(var _0x39e14a in _0x80eaf3){if(_0x80eaf3['hasOwnProperty'](_0x39e14a)&&(_0x39e14a===_0xbc43('0x89')||_0x39e14a===_0xbc43('0x8a')||_0x39e14a===_0xbc43('0x8b')||_0x39e14a===_0xbc43('0x8c')||_0x39e14a===_0xbc43('0x8d')||_0x39e14a===_0xbc43('0x8e')||_0x39e14a===_0xbc43('0x8f')||_0x39e14a===_0xbc43('0x90')||_0x39e14a===_0xbc43('0x91'))){_0x152f6f['push'](new Extension(_0x80eaf3,_0x19c51f,_0xbc43('0x92')+_0x39e14a+')='+_0x80eaf3[_0x39e14a],_0xbc43('0x88')));_0x19c51f+=0x1;}}_0x152f6f[_0xbc43('0x85')](new Extension(_0x80eaf3,_0x19c51f,'6','Wait'));_0x19c51f+=0x1;_0x152f6f[_0xbc43('0x85')](new Extension(_0x80eaf3,_0x19c51f,'/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'));_0x19c51f=0x0;return _0x152f6f;}exports[_0xbc43('0x93')]=function(_0x2c921f,_0x2d6549,_0x1c896b){var _0x3c70f2;return db[_0xbc43('0x7a')]['transaction'](function(_0x2f5ee0){return db['FaxAccount'][_0xbc43('0x5b')](_0x2c921f[_0xbc43('0x62')],{'transaction':_0x2f5ee0})[_0xbc43('0x26')](function(_0xec32a3){_0x3c70f2=_0xec32a3[_0xbc43('0x39')]({'plain':!![]});return db[_0xbc43('0x94')][_0xbc43('0x7c')](createExtensionsReciveFax(_0x3c70f2),{'transaction':_0x2f5ee0});});})[_0xbc43('0x26')](function(){return _0x3c70f2;})[_0xbc43('0x26')](respondWithResult(_0x2d6549,null))[_0xbc43('0x5a')](handleError(_0x2d6549,null));};exports['updateAccountApplications']=function(_0x561bc9,_0x472f58,_0x176a18){var _0x2f55d2;return db[_0xbc43('0x7a')]['transaction'](function(_0x6bf816){return db[_0xbc43('0x41')][_0xbc43('0x38')](_0x561bc9[_0xbc43('0x62')],{'where':{'id':_0x561bc9[_0xbc43('0x62')]['id']},'transaction':_0x6bf816})[_0xbc43('0x26')](function(_0x317838){return db[_0xbc43('0x94')]['destroy']({'where':{'FaxAccountId':_0x561bc9[_0xbc43('0x62')]['id']},'transaction':_0x6bf816})[_0xbc43('0x26')](function(_0x3cccbd){return db[_0xbc43('0x94')][_0xbc43('0x7c')](createExtensionsReciveFax(_['omit'](_0x561bc9['body'],[_0xbc43('0x95'),_0xbc43('0x42'),_0xbc43('0x96'),_0xbc43('0x97'),_0xbc43('0x98'),_0xbc43('0x99')])),{'transaction':_0x6bf816});});});})[_0xbc43('0x26')](function(){return db[_0xbc43('0x41')][_0xbc43('0x9a')](_0x561bc9[_0xbc43('0x62')]['id']);})[_0xbc43('0x26')](respondWithResult(_0x472f58,null))['catch'](handleError(_0x472f58,null));};exports[_0xbc43('0x9b')]=function(_0x4d1d5c,_0x418591,_0x19e1f3){var _0x5343e8={'raw':!![],'where':{}};var _0x10f174={};var _0x1e3c3c={'count':0x0,'rows':[]};return db[_0xbc43('0x41')]['findOne']({'where':{'id':_0x4d1d5c[_0xbc43('0x55')]['id']}})[_0xbc43('0x26')](handleEntityNotFound(_0x418591,null))[_0xbc43('0x26')](function(_0x5c637c){if(_0x5c637c){_0x10f174[_0xbc43('0x43')]=_[_0xbc43('0x45')](db[_0xbc43('0x9c')][_0xbc43('0x57')]);_0x10f174[_0xbc43('0x44')]=_[_0xbc43('0x45')](_0x4d1d5c[_0xbc43('0x44')]);_0x10f174[_0xbc43('0x46')]=_[_0xbc43('0x47')](_0x10f174[_0xbc43('0x43')],_0x10f174[_0xbc43('0x44')]);_0x5343e8['attributes']=_[_0xbc43('0x47')](_0x10f174[_0xbc43('0x43')],qs['fields'](_0x4d1d5c[_0xbc43('0x44')][_0xbc43('0x49')]));_0x5343e8[_0xbc43('0x48')]=_0x5343e8[_0xbc43('0x48')][_0xbc43('0x4a')]?_0x5343e8[_0xbc43('0x48')]:_0x10f174[_0xbc43('0x43')];if(!_0x4d1d5c[_0xbc43('0x44')]['hasOwnProperty'](_0xbc43('0x68'))){_0x5343e8[_0xbc43('0x35')]=qs[_0xbc43('0x35')](_0x4d1d5c[_0xbc43('0x44')][_0xbc43('0x35')]);_0x5343e8[_0xbc43('0x34')]=qs[_0xbc43('0x34')](_0x4d1d5c['query'][_0xbc43('0x34')]);}_0x5343e8[_0xbc43('0x4b')]=qs[_0xbc43('0x4c')](_0x4d1d5c[_0xbc43('0x44')][_0xbc43('0x4c')]);_0x5343e8[_0xbc43('0x4f')]=qs[_0xbc43('0x46')](_[_0xbc43('0x4d')](_0x4d1d5c[_0xbc43('0x44')],_0x10f174[_0xbc43('0x46')]));_0x5343e8['where'][_0xbc43('0x65')]=_0x5c637c['id'];if(_0x4d1d5c[_0xbc43('0x44')][_0xbc43('0x4e')]){_0x5343e8[_0xbc43('0x4f')]=_[_0xbc43('0x50')](_0x5343e8[_0xbc43('0x4f')],{'$or':_[_0xbc43('0x40')](_0x5343e8[_0xbc43('0x48')],function(_0x29311c){var _0xd4165e={};_0xd4165e[_0x29311c]={'$like':'%'+_0x4d1d5c[_0xbc43('0x44')][_0xbc43('0x4e')]+'%'};return _0xd4165e;})});}if(_0x4d1d5c['query'][_0xbc43('0x9d')]){var _0x5e06cc=_0x4d1d5c[_0xbc43('0x44')][_0xbc43('0x9d')]['split'](',');var _0x4fee52={};_0x4fee52[_0x5e06cc[0x0]]={'$gte':moment(_0x5e06cc[0x1])[_0xbc43('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5343e8[_0xbc43('0x4f')]=_[_0xbc43('0x50')](_0x5343e8['where'],_0x4fee52);}_0x5343e8=_[_0xbc43('0x50')]({},_0x5343e8,_0x4d1d5c[_0xbc43('0x53')]);return db['FaxMessage']['count']({'where':_0x5343e8[_0xbc43('0x4f')]})[_0xbc43('0x26')](function(_0x52e6d6){_0x1e3c3c[_0xbc43('0x33')]=_0x52e6d6;if(_0x4d1d5c[_0xbc43('0x44')][_0xbc43('0x58')]){_0x5343e8[_0xbc43('0x54')]=[{'all':!![]}];}return db[_0xbc43('0x9c')][_0xbc43('0x78')](_0x5343e8);})[_0xbc43('0x26')](function(_0x37371d){_0x1e3c3c['rows']=_0x37371d;return _0x1e3c3c;});}})[_0xbc43('0x26')](respondWithFilteredResult(_0x418591,_0x5343e8))[_0xbc43('0x5a')](handleError(_0x418591,null));};exports[_0xbc43('0x3d')]=function(_0x4010a8,_0xe3043d,_0x4e7d63){var _0x4fa15a,_0x38797f={},_0x820b46;if(_0x4010a8['body']['to']){_0x820b46=_0x4010a8[_0xbc43('0x62')]['to'][0x0];}return db['FaxAccount'][_0xbc43('0x59')]({'where':{'id':_0x4010a8[_0xbc43('0x55')]['id']},'include':[{'model':db[_0xbc43('0x9f')],'as':_0xbc43('0xa0'),'include':[{'model':db[_0xbc43('0xa1')],'as':'Contacts','where':{'fax':_0x820b46},'limit':0x1,'order':[[_0xbc43('0x97'),_0xbc43('0xa2')]]}]}]})[_0xbc43('0x26')](handleEntityNotFound(_0xe3043d,null))[_0xbc43('0x26')](function(_0x54d873){_0x4fa15a=_0x54d873;if(_0x4010a8['body'][_0xbc43('0xa3')]&&_0x4010a8[_0xbc43('0x62')][_0xbc43('0xa3')][_0xbc43('0x4a')]){for(var _0x35c68e=0x0;_0x35c68e<_0x4010a8['body'][_0xbc43('0xa3')][_0xbc43('0x4a')];_0x35c68e+=0x1){_0x4010a8[_0xbc43('0x62')][_0xbc43('0xa3')][_0x35c68e]={'filename':_0x4010a8['body'][_0xbc43('0xa3')][_0x35c68e][_0xbc43('0x3c')],'id':_0x4010a8['body']['attachments'][_0x35c68e]['id'],'path':path['join'](config[_0xbc43('0xa4')],_0xbc43('0xa5'),_0x4010a8[_0xbc43('0x62')][_0xbc43('0xa3')][_0x35c68e][_0xbc43('0xa6')])};}}return respondWithRpcPromise(_0xbc43('0xa7'),_0xbc43('0xa7'),{'FaxAccountId':_['isNil'](_0x4010a8[_0xbc43('0x55')]['id'])?undefined:_0x4010a8[_0xbc43('0x55')]['id'],'path':_[_0xbc43('0xa8')](_0x4010a8[_0xbc43('0x62')][_0xbc43('0xa3')][0x0][_0xbc43('0x8')])?undefined:_0x4010a8[_0xbc43('0x62')]['attachments'][0x0][_0xbc43('0x8')],'fax':_[_0xbc43('0xa8')](_0x4010a8[_0xbc43('0x62')]['to'][0x0])?undefined:_0x4010a8[_0xbc43('0x62')]['to'][0x0]},client9002);})['then'](function(){if(_0x4fa15a){if(_[_0xbc43('0xa8')](_0x4010a8['body'][_0xbc43('0xa9')])){_0x4010a8[_0xbc43('0x62')][_0xbc43('0xa9')]=util['format'](_0xbc43('0xaa'),_0x4fa15a[_0xbc43('0x3c')],_0x4fa15a[_0xbc43('0xab')]);}if(_0x4fa15a[_0xbc43('0xa0')]){if(_0x4fa15a['List'][_0xbc43('0xac')][_0xbc43('0x4a')]){return _0x4fa15a[_0xbc43('0xa0')]['Contacts'][0x0];}else{return db[_0xbc43('0xa1')]['create'](_[_0xbc43('0x19')](_0x4010a8[_0xbc43('0x62')],{'firstName':_0x4010a8[_0xbc43('0x62')]['to'][0x0],'phone':_0x4010a8[_0xbc43('0x62')]['to'][0x0],'fax':_0x4010a8['body']['to'][0x0],'ListId':_0x4fa15a[_0xbc43('0x99')]}));}}else{throw new Error(_0xbc43('0xad'));}}else{throw new Error(_0xbc43('0xae'));}})['then'](function(_0x2740ff){if(_0x2740ff){return db[_0xbc43('0x6f')][_0xbc43('0x59')]({'where':{'ContactId':_0x2740ff['id'],'closed':![],'FaxAccountId':_0x4fa15a['id']}})[_0xbc43('0x26')](function(_0x5d88a5){if(_0x5d88a5){return[_0x5d88a5,![]];}return db[_0xbc43('0x6f')][_0xbc43('0x5b')]({'UserId':_0x4010a8[_0xbc43('0x5c')]['id'],'ContactId':_0x2740ff['id'],'FaxAccountId':_0x4fa15a['id'],'fax':_0x4010a8[_0xbc43('0x62')]['to'][0x0],'firstMsgDirection':_0xbc43('0xaf'),'Messages':[_[_0xbc43('0x50')](_0x4010a8[_0xbc43('0x62')],{'read':![],'body':_0x4010a8['body'][_0xbc43('0xa3')][0x0][_0xbc43('0xb0')],'FaxAccountId':_0x4fa15a['id'],'UserId':_0x4010a8[_0xbc43('0x5c')]['id'],'ContactId':_0x2740ff['id'],'AttachmentId':_0x4010a8[_0xbc43('0x62')][_0xbc43('0xa3')][0x0]['id']})]},{'include':[{'model':db[_0xbc43('0x9c')],'as':_0xbc43('0xb1')}]})[_0xbc43('0x26')](function(_0xe91d1c){return[_0xe91d1c,!![]];});});}else{throw new Error(_0xbc43('0xb2'));}})['spread'](function(_0xd7e5de,_0x551a87){if(_0x551a87){return _0xd7e5de;}return db[_0xbc43('0x9c')][_0xbc43('0x5b')]({'direction':_0xbc43('0xaf'),'read':![],'body':_0x4010a8[_0xbc43('0x62')][_0xbc43('0xa3')][0x0][_0xbc43('0xb0')],'FaxAccountId':_0x4fa15a['id'],'FaxInteractionId':_0xd7e5de['id'],'UserId':_0x4010a8[_0xbc43('0x5c')]['id'],'ContactId':_0xd7e5de[_0xbc43('0xb3')],'AttachmentId':_0x4010a8[_0xbc43('0x62')][_0xbc43('0xa3')][0x0]['id']})[_0xbc43('0x26')](function(_0x27d34f){_0xd7e5de[_0xbc43('0xb4')][_0xbc43('0xb1')]=[];_0xd7e5de['dataValues'][_0xbc43('0xb1')][_0xbc43('0x85')](_0x27d34f[_0xbc43('0xb4')]);return _0xd7e5de;});})[_0xbc43('0x26')](function(_0x3b544a){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xbc43('0xa8')](_0x4010a8[_0xbc43('0x55')]['id'])?undefined:_0x4010a8[_0xbc43('0x55')]['id'],'path':_[_0xbc43('0xa8')](_0x4010a8[_0xbc43('0x62')][_0xbc43('0xa3')][0x0][_0xbc43('0x8')])?undefined:_0x4010a8['body'][_0xbc43('0xa3')][0x0][_0xbc43('0x8')],'fax':_['isNil'](_0x4010a8['body']['to'][0x0])?undefined:_0x4010a8[_0xbc43('0x62')]['to'][0x0],'AttachmentId':_0x4010a8[_0xbc43('0x62')]['attachments'][0x0]['id']},client9002)[_0xbc43('0x26')](function(_0x25f719){logger['info'](_0xbc43('0xb5'),_0x25f719);})[_0xbc43('0x5a')](function(_0x54368c){logger[_0xbc43('0xb6')]('SendFaxRpc,\x20%s',_0x54368c);});return _0x3b544a;})[_0xbc43('0x26')](respondWithResult(_0xe3043d,null))[_0xbc43('0x5a')](handleError(_0xe3043d,null));};exports[_0xbc43('0xb7')]=function(_0x2c5a46,_0x3f585b,_0x502594){return db[_0xbc43('0x41')][_0xbc43('0x59')]({'where':{'id':_0x2c5a46['params']['id']}})['then'](handleEntityNotFound(_0x3f585b,null))[_0xbc43('0x26')](function(_0x28f149){if(_0x28f149){return _0x28f149[_0xbc43('0xb7')](_0x2c5a46[_0xbc43('0x62')]['ids'],_['omit'](_0x2c5a46[_0xbc43('0x62')],[_0xbc43('0x6b'),'id'])||{})[_0xbc43('0xb8')](function(_0x5e934b){for(var _0x26778c=0x0;_0x26778c<_0x2c5a46[_0xbc43('0x62')]['ids']['length'];_0x26778c+=0x1){socket[_0xbc43('0xb9')]('userFaxAccount:save',{'UserId':_0x2c5a46['body'][_0xbc43('0x6b')][_0x26778c],'FaxAccountId':_0x2c5a46[_0xbc43('0x55')]['id']});}return _0x5e934b;});}})[_0xbc43('0x26')](respondWithResult(_0x3f585b,null))[_0xbc43('0x5a')](handleError(_0x3f585b,null));};exports[_0xbc43('0xba')]=function(_0x1548ba,_0x4d9cc1,_0x5acba6){return db[_0xbc43('0x41')][_0xbc43('0x59')]({'where':{'id':_0x1548ba['params']['id']}})['then'](handleEntityNotFound(_0x4d9cc1,null))['then'](function(_0x5a03bf){if(_0x5a03bf){return _0x5a03bf[_0xbc43('0xba')](_0x1548ba['query']['ids'])['then'](function(){if(_[_0xbc43('0xbb')](_0x1548ba[_0xbc43('0x44')][_0xbc43('0x6b')])){for(var _0x3d085f=0x0;_0x3d085f<_0x1548ba[_0xbc43('0x44')][_0xbc43('0x6b')][_0xbc43('0x4a')];_0x3d085f+=0x1){socket[_0xbc43('0xb9')](_0xbc43('0xbc'),{'UserId':Number(_0x1548ba[_0xbc43('0x44')][_0xbc43('0x6b')][_0x3d085f]),'FaxAccountId':Number(_0x1548ba[_0xbc43('0x55')]['id'])});}}else{socket[_0xbc43('0xb9')]('userFaxAccount:remove',{'UserId':Number(_0x1548ba[_0xbc43('0x44')]['ids']),'FaxAccountId':Number(_0x1548ba['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4d9cc1,null))[_0xbc43('0x5a')](handleError(_0x4d9cc1,null));};exports[_0xbc43('0xbd')]=function(_0x3814bc,_0x420db5,_0x3bae70){var _0x154b63={};var _0x2df3d4={};var _0x393888;var _0x541887;return db[_0xbc43('0x41')][_0xbc43('0x66')]({'where':{'id':_0x3814bc[_0xbc43('0x55')]['id']}})['then'](handleEntityNotFound(_0x420db5,null))[_0xbc43('0x26')](function(_0x7cb055){if(_0x7cb055){_0x393888=_0x7cb055;_0x2df3d4[_0xbc43('0x43')]=_['keys'](db['User'][_0xbc43('0x57')]);_0x2df3d4['query']=_[_0xbc43('0x45')](_0x3814bc[_0xbc43('0x44')]);_0x2df3d4[_0xbc43('0x46')]=_[_0xbc43('0x47')](_0x2df3d4[_0xbc43('0x43')],_0x2df3d4[_0xbc43('0x44')]);_0x154b63[_0xbc43('0x48')]=_['intersection'](_0x2df3d4[_0xbc43('0x43')],qs[_0xbc43('0x49')](_0x3814bc[_0xbc43('0x44')][_0xbc43('0x49')]));_0x154b63['attributes']=_0x154b63['attributes'][_0xbc43('0x4a')]?_0x154b63[_0xbc43('0x48')]:_0x2df3d4[_0xbc43('0x43')];_0x154b63[_0xbc43('0x4b')]=qs['sort'](_0x3814bc[_0xbc43('0x44')]['sort']);_0x154b63['where']=qs[_0xbc43('0x46')](_[_0xbc43('0x4d')](_0x3814bc[_0xbc43('0x44')],_0x2df3d4[_0xbc43('0x46')]));if(_0x3814bc[_0xbc43('0x44')][_0xbc43('0x4e')]){_0x154b63[_0xbc43('0x4f')]=_[_0xbc43('0x50')](_0x154b63[_0xbc43('0x4f')],{'$or':_[_0xbc43('0x40')](_0x154b63[_0xbc43('0x48')],function(_0x4974c4){var _0x417324={};_0x417324[_0x4974c4]={'$like':'%'+_0x3814bc['query']['filter']+'%'};return _0x417324;})});}_0x154b63=_[_0xbc43('0x50')]({},_0x154b63,_0x3814bc['options']);return _0x393888[_0xbc43('0xbd')](_0x154b63);}})[_0xbc43('0x26')](function(_0x3008b6){if(_0x3008b6){_0x541887=_0x3008b6[_0xbc43('0x4a')];if(!_0x3814bc['query']['hasOwnProperty'](_0xbc43('0x68'))){_0x154b63[_0xbc43('0x35')]=qs['limit'](_0x3814bc[_0xbc43('0x44')]['limit']);_0x154b63[_0xbc43('0x34')]=qs[_0xbc43('0x34')](_0x3814bc[_0xbc43('0x44')][_0xbc43('0x34')]);}return _0x393888['getAgents'](_0x154b63);}})[_0xbc43('0x26')](function(_0xa60ce3){if(_0xa60ce3){return _0xa60ce3?{'count':_0x541887,'rows':_0xa60ce3}:null;}})['then'](respondWithResult(_0x420db5,null))['catch'](handleError(_0x420db5,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 3618a31..b6bf170 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 _0x1aea=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x131faf,_0x1f91b8){var _0x39f8bf=function(_0x1e1ed3){while(--_0x1e1ed3){_0x131faf['push'](_0x131faf['shift']());}};_0x39f8bf(++_0x1f91b8);}(_0x1aea,0x163));var _0xa1ae=function(_0x4b9978,_0x58eb71){_0x4b9978=_0x4b9978-0x0;var _0x42f0e5=_0x1aea[_0x4b9978];return _0x42f0e5;};'use strict';var EventEmitter=require(_0xa1ae('0x0'));var FaxAccount=require(_0xa1ae('0x1'))['db'][_0xa1ae('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa1ae('0x3')](0x0);var events={'afterCreate':_0xa1ae('0x4'),'afterUpdate':'update','afterDestroy':_0xa1ae('0x5')};function emitEvent(_0x455956){return function(_0x50f9d6,_0x32f96d,_0x18c0d7){FaxAccountEvents[_0xa1ae('0x6')](_0x455956+':'+_0x50f9d6['id'],_0x50f9d6);FaxAccountEvents[_0xa1ae('0x6')](_0x455956,_0x50f9d6);_0x18c0d7(null);};}for(var e in events){if(events[_0xa1ae('0x7')](e)){var event=events[e];FaxAccount[_0xa1ae('0x8')](e,emitEvent(event));}}module[_0xa1ae('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x38ba=['update','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x38ba,0x134));var _0xa38b=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x38ba[_0x51020b];return _0x371e47;};'use strict';var EventEmitter=require(_0xa38b('0x0'));var FaxAccount=require(_0xa38b('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa38b('0x2')](0x0);var events={'afterCreate':_0xa38b('0x3'),'afterUpdate':_0xa38b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x375466){return function(_0x304354,_0xbe59b4,_0x39c50c){FaxAccountEvents[_0xa38b('0x5')](_0x375466+':'+_0x304354['id'],_0x304354);FaxAccountEvents[_0xa38b('0x5')](_0x375466,_0x304354);_0x39c50c(null);};}for(var e in events){if(events[_0xa38b('0x6')](e)){var event=events[e];FaxAccount[_0xa38b('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 20abaee..afb8f56 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 _0x4fb4=['path','./faxAccount.attributes','exports','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x170856,_0x316f40){var _0x2682b9=function(_0x40ebd2){while(--_0x40ebd2){_0x170856['push'](_0x170856['shift']());}};_0x2682b9(++_0x316f40);}(_0x4fb4,0x1bd));var _0x44fb=function(_0x4bd0cb,_0x37b00c){_0x4bd0cb=_0x4bd0cb-0x0;var _0x5c1a5b=_0x4fb4[_0x4bd0cb];return _0x5c1a5b;};'use strict';var _=require(_0x44fb('0x0'));var util=require(_0x44fb('0x1'));var logger=require(_0x44fb('0x2'))(_0x44fb('0x3'));var moment=require('moment');var BPromise=require(_0x44fb('0x4'));var rp=require(_0x44fb('0x5'));var fs=require('fs');var path=require(_0x44fb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x44fb('0x7'));module[_0x44fb('0x8')]=function(_0x268be7,_0x1ca649){return _0x268be7['define'](_0x44fb('0x9'),attributes,{'tableName':_0x44fb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6529=['../../config/environment','./faxAccount.attributes','define','lodash','moment','request-promise','path','rimraf'];(function(_0x53a785,_0x49bc70){var _0x2d1d71=function(_0x9cf230){while(--_0x9cf230){_0x53a785['push'](_0x53a785['shift']());}};_0x2d1d71(++_0x49bc70);}(_0x6529,0x1eb));var _0x9652=function(_0x276108,_0x4c8922){_0x276108=_0x276108-0x0;var _0x4fb626=_0x6529[_0x276108];return _0x4fb626;};'use strict';var _=require(_0x9652('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9652('0x1'));var BPromise=require('bluebird');var rp=require(_0x9652('0x2'));var fs=require('fs');var path=require(_0x9652('0x3'));var rimraf=require(_0x9652('0x4'));var config=require(_0x9652('0x5'));var attributes=require(_0x9652('0x6'));module['exports']=function(_0x2d857c,_0x48c3ae){return _0x2d857c[_0x9652('0x7')]('FaxAccount',attributes,{'tableName':'fax_accounts','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 12110f9..1d18f7f 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 _0x729d=['limit','include','model','map','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','FaxAccount','find','account','List','Contacts','DESC','Applications','get','applications','priority','asc','length','ListId','create','contact','fax','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','User','UserId','unshift','name','waitForTheAssignedAgent','startRouting','Start','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxAccount','options','attributes'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x729d,0x1e4));var _0xd729=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0x729d[_0x5ad0d7];return _0xd83bd;};'use strict';var _=require(_0xd729('0x0'));var util=require(_0xd729('0x1'));var moment=require('moment');var BPromise=require(_0xd729('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd729('0x3'));var db=require(_0xd729('0x4'))['db'];var utils=require(_0xd729('0x5'));var logger=require(_0xd729('0x6'))(_0xd729('0x7'));var config=require(_0xd729('0x8'));var jayson=require(_0xd729('0x9'));var client=jayson[_0xd729('0xa')][_0xd729('0xb')]({'port':0x232c});config['redis']=_[_0xd729('0xc')](config['redis'],{'host':_0xd729('0xd'),'port':0x18eb});var socket=require(_0xd729('0xe'))(new Redis(config['redis']));require(_0xd729('0xf'))[_0xd729('0x10')](socket);function respondWithRpcPromise(_0x5504e9,_0x52b247,_0x5bfd3f){return new BPromise(function(_0x470b72,_0x3d2632){return client[_0xd729('0x11')](_0x5504e9,_0x5bfd3f)[_0xd729('0x12')](function(_0x469028){logger[_0xd729('0x13')](_0xd729('0x14'),_0x52b247,_0xd729('0x15'));logger[_0xd729('0x16')](_0xd729('0x17'),_0x52b247,_0xd729('0x15'),JSON['stringify'](_0x469028));if(_0x469028[_0xd729('0x18')]){if(_0x469028[_0xd729('0x18')][_0xd729('0x19')]===0x1f4){logger['error'](_0xd729('0x14'),_0x52b247,_0x469028[_0xd729('0x18')][_0xd729('0x1a')]);return _0x3d2632(_0x469028['error'][_0xd729('0x1a')]);}logger[_0xd729('0x18')]('FaxAccount,\x20%s,\x20%s',_0x52b247,_0x469028['error'][_0xd729('0x1a')]);return _0x470b72(_0x469028[_0xd729('0x18')]['message']);}else{logger[_0xd729('0x13')](_0xd729('0x14'),_0x52b247,_0xd729('0x15'));_0x470b72(_0x469028[_0xd729('0x1b')]['message']);}})[_0xd729('0x1c')](function(_0x2f4ece){logger[_0xd729('0x18')](_0xd729('0x14'),_0x52b247,_0x2f4ece);_0x3d2632(_0x2f4ece);});});}exports[_0xd729('0x1d')]=function(_0xcf30f6){var _0x3f442c=this;return new Promise(function(_0x3ad9f2,_0x537c7d){return db['FaxAccount']['findAll']({'raw':_0xcf30f6['options']?_0xcf30f6['options']['raw']===undefined?!![]:![]:!![],'where':_0xcf30f6['options']?_0xcf30f6[_0xd729('0x1e')]['where']||null:null,'attributes':_0xcf30f6[_0xd729('0x1e')]?_0xcf30f6['options'][_0xd729('0x1f')]||null:null,'limit':_0xcf30f6['options']?_0xcf30f6[_0xd729('0x1e')][_0xd729('0x20')]||null:null,'include':_0xcf30f6['options']?_0xcf30f6[_0xd729('0x1e')][_0xd729('0x21')]?_['map'](_0xcf30f6[_0xd729('0x1e')]['include'],function(_0x50cebd){return{'model':db[_0x50cebd[_0xd729('0x22')]],'as':_0x50cebd['as'],'attributes':_0x50cebd[_0xd729('0x1f')],'include':_0x50cebd[_0xd729('0x21')]?_[_0xd729('0x23')](_0x50cebd[_0xd729('0x21')],function(_0x241ce4){return{'model':db[_0x241ce4[_0xd729('0x22')]],'as':_0x241ce4['as'],'attributes':_0x241ce4[_0xd729('0x1f')],'include':_0x241ce4[_0xd729('0x21')]?_[_0xd729('0x23')](_0x241ce4[_0xd729('0x21')],function(_0x10292f){return{'model':db[_0x10292f['model']],'as':_0x10292f['as'],'attributes':_0x10292f[_0xd729('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd729('0x12')](function(_0x28a02e){logger[_0xd729('0x13')](_0xd729('0x1d'),_0xcf30f6);logger[_0xd729('0x16')](_0xd729('0x1d'),_0xcf30f6,JSON['stringify'](_0x28a02e));_0x3ad9f2(_0x28a02e);})['catch'](function(_0x48fc8e){logger[_0xd729('0x18')]('GetFaxAccount',_0x48fc8e[_0xd729('0x1a')],_0xcf30f6);_0x537c7d(_0x3f442c['error'](0x1f4,_0x48fc8e['message']));});});};exports[_0xd729('0x24')]=function(_0x58af3c,_0x3b6131,_0x2cec48){var _0x308e7a=this;return new Promise(function(_0x145d24,_0x6588e2){var _0x59c59b={'body':_0x58af3c[_0xd729('0x25')],'channel':'fax'};var _0x362cb6=[];var _0x23f6e0=[];var _0x1886fd={};return db[_0xd729('0x26')][_0xd729('0x27')]()[_0xd729('0x12')](function(_0x1965c3){if(!_0x1965c3){throw new db[(_0xd729('0x28'))][(_0xd729('0x29'))](_0xd729('0x2a'));}_0x362cb6=_[_0xd729('0x2b')](_[_0xd729('0x2c')](_0x1965c3),[_0xd729('0x2d'),_0xd729('0x2e')]);_0x23f6e0=_['difference'](_['keys'](_0x1965c3),['createdAt',_0xd729('0x2e'),'CompanyId','ListId']);if(_0x58af3c[_0xd729('0x25')]['id']){delete _0x58af3c[_0xd729('0x25')]['id'];}if(_[_0xd729('0x2f')](_0x58af3c['body'][_0xd729('0x30')])){throw new db['Sequelize'][(_0xd729('0x29'))](_0xd729('0x31'));}if(_['isNil'](_0x58af3c[_0xd729('0x25')][_0xd729('0x25')])||_0x58af3c[_0xd729('0x25')][_0xd729('0x25')]===''){throw new db[(_0xd729('0x28'))][(_0xd729('0x29'))](_0xd729('0x32'));}if(_['isNil'](_0x58af3c[_0xd729('0x25')][_0xd729('0x33')])){throw new db[(_0xd729('0x28'))][(_0xd729('0x29'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x23f6e0);}if(!_[_0xd729('0x34')](_0x23f6e0,_0x58af3c['body'][_0xd729('0x33')])){throw new db[(_0xd729('0x28'))][(_0xd729('0x29'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x23f6e0);}_0x1886fd[_0x58af3c['body'][_0xd729('0x33')]]=_0x58af3c[_0xd729('0x25')][_0xd729('0x30')];})[_0xd729('0x12')](function(){return db[_0xd729('0x35')][_0xd729('0x36')]({'where':{'id':_0x58af3c[_0xd729('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0xd729('0x38'),'include':[{'model':db[_0xd729('0x26')],'as':_0xd729('0x39'),'where':_0x1886fd,'limit':0x1,'order':[[_0xd729('0x2e'),_0xd729('0x3a')]]}]},{'model':db['FaxApplication'],'as':_0xd729('0x3b')}]});})[_0xd729('0x12')](function(_0x44402e){if(_0x44402e&&_0x44402e[_0xd729('0x38')]){var _0x22d075=_0x44402e[_0xd729('0x3c')]({'plain':!![]});_0x59c59b[_0xd729('0x37')]=_0x22d075;_0x59c59b[_0xd729('0x3d')]=_0x22d075['Applications'];_0x59c59b['list']=_0x22d075['List'];_0x59c59b[_0xd729('0x3d')]=_['orderBy'](_0x59c59b['applications'],[_0xd729('0x3e')],[_0xd729('0x3f')]);if(_0x59c59b['account']['Applications']){delete _0x59c59b[_0xd729('0x37')][_0xd729('0x3b')];}if(_0x59c59b[_0xd729('0x37')]['List']&&_0x59c59b[_0xd729('0x37')][_0xd729('0x38')][_0xd729('0x39')][_0xd729('0x40')]){return _0x59c59b[_0xd729('0x37')]['List'][_0xd729('0x39')][0x0];}var _0x5ec5e0=_[_0xd729('0xc')](_0x58af3c[_0xd729('0x25')],{'firstName':_0x58af3c[_0xd729('0x25')][_0xd729('0x30')],'ListId':_0x22d075[_0xd729('0x41')]});_0x5ec5e0[_0x58af3c[_0xd729('0x25')][_0xd729('0x33')]]=_0x58af3c[_0xd729('0x25')]['from'];return db['CmContact'][_0xd729('0x42')](_0x5ec5e0,{'fields':_0x362cb6,'raw':!![]});}})[_0xd729('0x12')](function(_0x3e416e){_0x59c59b[_0xd729('0x43')]=_0x3e416e;if(_0x3e416e){var _0x2cda8c={'ContactId':_0x3e416e['id'],'FaxAccountId':_0x58af3c[_0xd729('0x37')]['id'],'fax':_0x3e416e[_0xd729('0x44')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x3e416e['id'],'closed':![],'FaxAccountId':_0x58af3c['account']['id']}})['then'](function(_0xe791cb){if(_0xe791cb){return[_0xe791cb,![]];}return db['FaxInteraction'][_0xd729('0x42')](_0x2cda8c)[_0xd729('0x12')](function(_0x5c9832){return[_0x5c9832,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xd729('0x45')](function(_0x4d80cd,_0x26c547){var _0x39e1c5=_0x4d80cd[_0xd729('0x3c')]({'plain':!![]});if(_0x26c547){if(_0x59c59b['account'][_0xd729('0x46')]){_0x59c59b[_0xd729('0x3d')][_0xd729('0x47')]({'id':0x0,'priority':_0x59c59b[_0xd729('0x3d')][_0xd729('0x40')]+0x1,'app':_0xd729('0x48'),'appdata':_0xd729('0x49'),'interval':_0xd729('0x4a')});}_0x39e1c5[_0xd729('0x4b')]=!![];}else{_0x39e1c5[_0xd729('0x4b')]=![];}_0x59c59b[_0xd729('0x4c')]=_0x39e1c5;return db[_0xd729('0x4d')][_0xd729('0x42')]({'body':_0x58af3c[_0xd729('0x25')]['body'],'FaxAccountId':_0x58af3c[_0xd729('0x37')]['id'],'FaxInteractionId':_0x4d80cd['id'],'direction':'in','ContactId':_0x4d80cd[_0xd729('0x4e')],'AttachmentId':_0x58af3c[_0xd729('0x25')]['AttachmentId']});})[_0xd729('0x12')](function(_0x23e2f1){_0x59c59b[_0xd729('0x1a')]=_0x23e2f1;if(_0x59c59b[_0xd729('0x4c')]['UserId']){return db[_0xd729('0x4f')][_0xd729('0x36')]({'attributes':['id','name'],'where':{'id':_0x59c59b[_0xd729('0x4c')][_0xd729('0x50')]}})[_0xd729('0x12')](function(_0x1a9c0f){if(_0x1a9c0f){_0x59c59b[_0xd729('0x3d')][_0xd729('0x51')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1a9c0f[_0xd729('0x52')]+','+(_0x59c59b[_0xd729('0x37')][_0xd729('0x53')]||0xa),'interval':_0xd729('0x4a')});}return respondWithRpcPromise('Start',_0xd729('0x54'),_0x59c59b);});}return respondWithRpcPromise(_0xd729('0x55'),_0xd729('0x54'),_0x59c59b);})[_0xd729('0x12')](function(_0x3d52dd){_0x145d24(_0x3d52dd);})[_0xd729('0x1c')](function(_0x4ac690){_0x6588e2(_0x308e7a[_0xd729('0x18')](0x1f4,_0x4ac690['message']));});});}; \ No newline at end of file +var _0x897b=['fax','CmContact','describe','then','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','DESC','FaxApplication','Applications','get','applications','priority','asc','length','contact','FaxInteraction','find','create','Contact\x20not\x20found','autoclose','push','close','unmanaged','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','./faxAccount.socket','register','request','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','NotifyFaxAccount','body'];(function(_0x7fb1e5,_0x1bea01){var _0x3c102e=function(_0x227613){while(--_0x227613){_0x7fb1e5['push'](_0x7fb1e5['shift']());}};_0x3c102e(++_0x1bea01);}(_0x897b,0x90));var _0xb897=function(_0x496b86,_0x448df6){_0x496b86=_0x496b86-0x0;var _0x316114=_0x897b[_0x496b86];return _0x316114;};'use strict';var _=require(_0xb897('0x0'));var util=require(_0xb897('0x1'));var moment=require(_0xb897('0x2'));var BPromise=require(_0xb897('0x3'));var rs=require(_0xb897('0x4'));var fs=require('fs');var Redis=require(_0xb897('0x5'));var db=require(_0xb897('0x6'))['db'];var utils=require(_0xb897('0x7'));var logger=require(_0xb897('0x8'))(_0xb897('0x9'));var config=require('../../config/environment');var jayson=require(_0xb897('0xa'));var client=jayson[_0xb897('0xb')][_0xb897('0xc')]({'port':0x232c});config[_0xb897('0xd')]=_['defaults'](config[_0xb897('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb897('0xd')]));require(_0xb897('0xe'))[_0xb897('0xf')](socket);function respondWithRpcPromise(_0x2995b5,_0xdcac84,_0x429759){return new BPromise(function(_0x2a6b54,_0x55ff49){return client[_0xb897('0x10')](_0x2995b5,_0x429759)['then'](function(_0x12803a){logger['info']('FaxAccount,\x20%s,\x20%s',_0xdcac84,_0xb897('0x11'));logger[_0xb897('0x12')](_0xb897('0x13'),_0xdcac84,_0xb897('0x11'),JSON[_0xb897('0x14')](_0x12803a));if(_0x12803a[_0xb897('0x15')]){if(_0x12803a[_0xb897('0x15')][_0xb897('0x16')]===0x1f4){logger[_0xb897('0x15')](_0xb897('0x17'),_0xdcac84,_0x12803a[_0xb897('0x15')][_0xb897('0x18')]);return _0x55ff49(_0x12803a[_0xb897('0x15')][_0xb897('0x18')]);}logger[_0xb897('0x15')](_0xb897('0x17'),_0xdcac84,_0x12803a['error'][_0xb897('0x18')]);return _0x2a6b54(_0x12803a['error']['message']);}else{logger[_0xb897('0x19')]('FaxAccount,\x20%s,\x20%s',_0xdcac84,_0xb897('0x11'));_0x2a6b54(_0x12803a[_0xb897('0x1a')][_0xb897('0x18')]);}})[_0xb897('0x1b')](function(_0x24478b){logger[_0xb897('0x15')](_0xb897('0x17'),_0xdcac84,_0x24478b);_0x55ff49(_0x24478b);});});}exports[_0xb897('0x1c')]=function(_0x1cecc4){var _0x3bcdf7=this;return new Promise(function(_0x2d610b,_0x1d6dd3){return db[_0xb897('0x1d')][_0xb897('0x1e')]({'raw':_0x1cecc4[_0xb897('0x1f')]?_0x1cecc4[_0xb897('0x1f')][_0xb897('0x20')]===undefined?!![]:![]:!![],'where':_0x1cecc4[_0xb897('0x1f')]?_0x1cecc4[_0xb897('0x1f')]['where']||null:null,'attributes':_0x1cecc4[_0xb897('0x1f')]?_0x1cecc4[_0xb897('0x1f')][_0xb897('0x21')]||null:null,'limit':_0x1cecc4[_0xb897('0x1f')]?_0x1cecc4['options'][_0xb897('0x22')]||null:null,'include':_0x1cecc4[_0xb897('0x1f')]?_0x1cecc4['options'][_0xb897('0x23')]?_[_0xb897('0x24')](_0x1cecc4['options']['include'],function(_0x54aa98){return{'model':db[_0x54aa98[_0xb897('0x25')]],'as':_0x54aa98['as'],'attributes':_0x54aa98[_0xb897('0x21')],'include':_0x54aa98['include']?_['map'](_0x54aa98[_0xb897('0x23')],function(_0x41e1e5){return{'model':db[_0x41e1e5[_0xb897('0x25')]],'as':_0x41e1e5['as'],'attributes':_0x41e1e5['attributes'],'include':_0x41e1e5[_0xb897('0x23')]?_[_0xb897('0x24')](_0x41e1e5[_0xb897('0x23')],function(_0x47f2cf){return{'model':db[_0x47f2cf[_0xb897('0x25')]],'as':_0x47f2cf['as'],'attributes':_0x47f2cf[_0xb897('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40038e){logger[_0xb897('0x19')](_0xb897('0x1c'),_0x1cecc4);logger[_0xb897('0x12')](_0xb897('0x1c'),_0x1cecc4,JSON[_0xb897('0x14')](_0x40038e));_0x2d610b(_0x40038e);})['catch'](function(_0x1aa4d3){logger[_0xb897('0x15')](_0xb897('0x1c'),_0x1aa4d3[_0xb897('0x18')],_0x1cecc4);_0x1d6dd3(_0x3bcdf7[_0xb897('0x15')](0x1f4,_0x1aa4d3[_0xb897('0x18')]));});});};exports[_0xb897('0x26')]=function(_0x5c4140,_0x3fa013,_0x3303f1){var _0x4a9719=this;return new Promise(function(_0x3fbd2d,_0xd2cca6){var _0x22a8d4={'body':_0x5c4140[_0xb897('0x27')],'channel':_0xb897('0x28')};var _0x4fc44e=[];var _0x9035d=[];var _0x66ef46={};return db[_0xb897('0x29')][_0xb897('0x2a')]()[_0xb897('0x2b')](function(_0x4bd2d8){if(!_0x4bd2d8){throw new db['Sequelize']['ValidationError'](_0xb897('0x2c'));}_0x4fc44e=_[_0xb897('0x2d')](_['keys'](_0x4bd2d8),[_0xb897('0x2e'),_0xb897('0x2f')]);_0x9035d=_[_0xb897('0x2d')](_[_0xb897('0x30')](_0x4bd2d8),[_0xb897('0x2e'),_0xb897('0x2f'),_0xb897('0x31'),_0xb897('0x32')]);if(_0x5c4140[_0xb897('0x27')]['id']){delete _0x5c4140[_0xb897('0x27')]['id'];}if(_[_0xb897('0x33')](_0x5c4140[_0xb897('0x27')][_0xb897('0x34')])){throw new db[(_0xb897('0x35'))]['ValidationError'](_0xb897('0x36'));}if(_[_0xb897('0x33')](_0x5c4140['body'][_0xb897('0x27')])||_0x5c4140['body'][_0xb897('0x27')]===''){throw new db[(_0xb897('0x35'))]['ValidationError'](_0xb897('0x37'));}if(_[_0xb897('0x33')](_0x5c4140['body']['mapKey'])){throw new db[(_0xb897('0x35'))][(_0xb897('0x38'))](_0xb897('0x39')+_0x9035d);}if(!_[_0xb897('0x3a')](_0x9035d,_0x5c4140[_0xb897('0x27')][_0xb897('0x3b')])){throw new db[(_0xb897('0x35'))][(_0xb897('0x38'))](_0xb897('0x3c')+_0x9035d);}_0x66ef46[_0x5c4140[_0xb897('0x27')][_0xb897('0x3b')]]=_0x5c4140['body']['from'];})[_0xb897('0x2b')](function(){return db[_0xb897('0x1d')]['find']({'where':{'id':_0x5c4140[_0xb897('0x3d')]['id']},'include':[{'model':db['CmList'],'as':_0xb897('0x3e'),'include':[{'model':db['CmContact'],'as':_0xb897('0x3f'),'where':_0x66ef46,'limit':0x1,'order':[[_0xb897('0x2f'),_0xb897('0x40')]]}]},{'model':db[_0xb897('0x41')],'as':_0xb897('0x42')}]});})[_0xb897('0x2b')](function(_0x435bfc){if(_0x435bfc&&_0x435bfc[_0xb897('0x3e')]){var _0x319748=_0x435bfc[_0xb897('0x43')]({'plain':!![]});_0x22a8d4['account']=_0x319748;_0x22a8d4[_0xb897('0x44')]=_0x319748[_0xb897('0x42')];_0x22a8d4['list']=_0x319748['List'];_0x22a8d4[_0xb897('0x44')]=_['orderBy'](_0x22a8d4[_0xb897('0x44')],[_0xb897('0x45')],[_0xb897('0x46')]);if(_0x22a8d4[_0xb897('0x3d')]['Applications']){delete _0x22a8d4[_0xb897('0x3d')][_0xb897('0x42')];}if(_0x22a8d4['account'][_0xb897('0x3e')]&&_0x22a8d4[_0xb897('0x3d')][_0xb897('0x3e')][_0xb897('0x3f')][_0xb897('0x47')]){return _0x22a8d4['account']['List'][_0xb897('0x3f')][0x0];}var _0x32b45f=_['defaults'](_0x5c4140[_0xb897('0x27')],{'firstName':_0x5c4140[_0xb897('0x27')]['from'],'ListId':_0x319748[_0xb897('0x32')]});_0x32b45f[_0x5c4140['body'][_0xb897('0x3b')]]=_0x5c4140['body'][_0xb897('0x34')];return db[_0xb897('0x29')]['create'](_0x32b45f,{'fields':_0x4fc44e,'raw':!![]});}})['then'](function(_0x411608){_0x22a8d4[_0xb897('0x48')]=_0x411608;if(_0x411608){var _0x347acc={'ContactId':_0x411608['id'],'FaxAccountId':_0x5c4140['account']['id'],'fax':_0x411608[_0xb897('0x28')]};return db[_0xb897('0x49')][_0xb897('0x4a')]({'where':{'ContactId':_0x411608['id'],'closed':![],'FaxAccountId':_0x5c4140[_0xb897('0x3d')]['id']}})[_0xb897('0x2b')](function(_0x7c031a){if(_0x7c031a){return[_0x7c031a,![]];}return db[_0xb897('0x49')][_0xb897('0x4b')](_0x347acc)['then'](function(_0x33932e){return[_0x33932e,!![]];});});}else{throw new Error(_0xb897('0x4c'));}})['spread'](function(_0x8017f4,_0x552383){var _0x57c971=_0x8017f4[_0xb897('0x43')]({'plain':!![]});if(_0x552383){if(_0x22a8d4[_0xb897('0x3d')][_0xb897('0x4d')]){_0x22a8d4[_0xb897('0x44')][_0xb897('0x4e')]({'id':0x0,'priority':_0x22a8d4[_0xb897('0x44')][_0xb897('0x47')]+0x1,'app':_0xb897('0x4f'),'appdata':_0xb897('0x50'),'interval':'*,*,*,*'});}_0x57c971[_0xb897('0x51')]=!![];}else{_0x57c971['created']=![];}_0x22a8d4[_0xb897('0x52')]=_0x57c971;return db[_0xb897('0x53')][_0xb897('0x4b')]({'body':_0x5c4140[_0xb897('0x27')][_0xb897('0x27')],'FaxAccountId':_0x5c4140[_0xb897('0x3d')]['id'],'FaxInteractionId':_0x8017f4['id'],'direction':'in','ContactId':_0x8017f4['ContactId'],'AttachmentId':_0x5c4140['body'][_0xb897('0x54')]});})[_0xb897('0x2b')](function(_0x219269){_0x22a8d4['message']=_0x219269;if(_0x22a8d4[_0xb897('0x52')][_0xb897('0x55')]){return db[_0xb897('0x56')][_0xb897('0x4a')]({'attributes':['id',_0xb897('0x57')],'where':{'id':_0x22a8d4[_0xb897('0x52')][_0xb897('0x55')]}})['then'](function(_0x336ad1){if(_0x336ad1){_0x22a8d4[_0xb897('0x44')][_0xb897('0x58')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x336ad1[_0xb897('0x57')]+','+(_0x22a8d4[_0xb897('0x3d')][_0xb897('0x59')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb897('0x5a'),_0xb897('0x5b'),_0x22a8d4);});}return respondWithRpcPromise(_0xb897('0x5a'),_0xb897('0x5b'),_0x22a8d4);})[_0xb897('0x2b')](function(_0x74ed2){_0x3fbd2d(_0x74ed2);})[_0xb897('0x1b')](function(_0x1f272d){_0xd2cca6(_0x4a9719[_0xb897('0x15')](0x1f4,_0x1f272d[_0xb897('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 11d8dd5..00677b4 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 _0x7a54=['remove','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x36cc2c,_0xe0db08){var _0x4081d8=function(_0x387b24){while(--_0x387b24){_0x36cc2c['push'](_0x36cc2c['shift']());}};_0x4081d8(++_0xe0db08);}(_0x7a54,0x106));var _0x47a5=function(_0x644270,_0x24511b){_0x644270=_0x644270-0x0;var _0x899e98=_0x7a54[_0x644270];return _0x899e98;};'use strict';var FaxAccountEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){FaxAccountEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);FaxAccountEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0x6a95=['register','length','faxAccount:','./faxAccount.events','save','remove','update','removeListener'];(function(_0x2a6501,_0x9c5a0e){var _0x34d3ae=function(_0x204c8b){while(--_0x204c8b){_0x2a6501['push'](_0x2a6501['shift']());}};_0x34d3ae(++_0x9c5a0e);}(_0x6a95,0x1db));var _0x56a9=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x6a95[_0x25bea7];return _0x175952;};'use strict';var FaxAccountEvents=require(_0x56a9('0x0'));var events=[_0x56a9('0x1'),_0x56a9('0x2'),_0x56a9('0x3')];function createListener(_0x36f87a,_0x26e006){return function(_0x235917){_0x26e006['emit'](_0x36f87a,_0x235917);};}function removeListener(_0x512f52,_0x12cd60){return function(){FaxAccountEvents[_0x56a9('0x4')](_0x512f52,_0x12cd60);};}exports[_0x56a9('0x5')]=function(_0x2eb132){for(var _0x3c15b6=0x0,_0x365093=events[_0x56a9('0x6')];_0x3c15b6<_0x365093;_0x3c15b6++){var _0x5d3e80=events[_0x3c15b6];var _0x5f0dcb=createListener(_0x56a9('0x7')+_0x5d3e80,_0x2eb132);FaxAccountEvents['on'](_0x5d3e80,_0x5f0dcb);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 61b54b3..a9a96e3 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 _0xfd32=['../../config/environment','./faxAccount.controller','get','isAuthenticated','/describe','describe','/:id/dispositions','getDispositions','/:id/interactions','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','send','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x27426e,_0x4ca8c3){var _0x269ab0=function(_0x53f161){while(--_0x53f161){_0x27426e['push'](_0x27426e['shift']());}};_0x269ab0(++_0x4ca8c3);}(_0xfd32,0x96));var _0x2fd3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd32[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x2fd3('0x0'));var path=require(_0x2fd3('0x1'));var timeout=require(_0x2fd3('0x2'));var express=require(_0x2fd3('0x3'));var router=express[_0x2fd3('0x4')]();var auth=require(_0x2fd3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2fd3('0x6'));var controller=require(_0x2fd3('0x7'));router[_0x2fd3('0x8')]('/',auth[_0x2fd3('0x9')](),controller['index']);router[_0x2fd3('0x8')](_0x2fd3('0xa'),auth['isAuthenticated'](),controller[_0x2fd3('0xb')]);router[_0x2fd3('0x8')]('/:id',auth[_0x2fd3('0x9')](),controller['show']);router[_0x2fd3('0x8')](_0x2fd3('0xc'),auth[_0x2fd3('0x9')](),controller[_0x2fd3('0xd')]);router[_0x2fd3('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0x2fd3('0x8')](_0x2fd3('0xe'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x2fd3('0x8')]('/:id/applications',auth[_0x2fd3('0x9')](),controller['getApplications']);router[_0x2fd3('0x8')](_0x2fd3('0xf'),auth['isAuthenticated'](),controller[_0x2fd3('0x10')]);router[_0x2fd3('0x8')](_0x2fd3('0x11'),auth[_0x2fd3('0x9')](),controller[_0x2fd3('0x12')]);router[_0x2fd3('0x13')]('/',auth[_0x2fd3('0x9')](),controller[_0x2fd3('0x14')]);router[_0x2fd3('0x13')]('/:id/dispositions',auth[_0x2fd3('0x9')](),controller[_0x2fd3('0x15')]);router[_0x2fd3('0x13')](_0x2fd3('0x16'),auth[_0x2fd3('0x9')](),controller[_0x2fd3('0x17')]);router[_0x2fd3('0x13')]('/:id/interactions',auth[_0x2fd3('0x9')](),controller['addInteraction']);router[_0x2fd3('0x13')](_0x2fd3('0x18'),auth['isAuthenticated'](),controller[_0x2fd3('0x19')]);router[_0x2fd3('0x13')](_0x2fd3('0x1a'),auth['isAuthenticated'](),controller[_0x2fd3('0x1b')]);router['post'](_0x2fd3('0x1c'),auth[_0x2fd3('0x9')](),controller['updateAccountApplications']);router[_0x2fd3('0x13')]('/:id/send',auth[_0x2fd3('0x9')](),controller[_0x2fd3('0x1d')]);router[_0x2fd3('0x13')]('/:id/users',auth[_0x2fd3('0x9')](),controller[_0x2fd3('0x1e')]);router[_0x2fd3('0x1f')](_0x2fd3('0x20'),auth[_0x2fd3('0x9')](),controller[_0x2fd3('0x21')]);router[_0x2fd3('0x22')](_0x2fd3('0x20'),auth[_0x2fd3('0x9')](),controller[_0x2fd3('0x23')]);router['delete'](_0x2fd3('0xc'),auth[_0x2fd3('0x9')](),controller[_0x2fd3('0x24')]);router[_0x2fd3('0x22')](_0x2fd3('0x16'),auth[_0x2fd3('0x9')](),controller[_0x2fd3('0x25')]);router[_0x2fd3('0x22')](_0x2fd3('0x11'),auth['isAuthenticated'](),controller[_0x2fd3('0x26')]);module['exports']=router; \ No newline at end of file +var _0xaef7=['./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','addAnswer','addInteraction','/addaccountapplications','addAccountApplications','updateAccountApplications','send','put','update','removeDispositions','delete','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xaef7,0x160));var _0x7aef=function(_0x41227c,_0x5485f2){_0x41227c=_0x41227c-0x0;var _0x47f3a8=_0xaef7[_0x41227c];return _0x47f3a8;};'use strict';var multer=require(_0x7aef('0x0'));var util=require(_0x7aef('0x1'));var path=require(_0x7aef('0x2'));var timeout=require(_0x7aef('0x3'));var express=require(_0x7aef('0x4'));var router=express[_0x7aef('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7aef('0x6'));var config=require(_0x7aef('0x7'));var controller=require(_0x7aef('0x8'));router[_0x7aef('0x9')]('/',auth[_0x7aef('0xa')](),controller[_0x7aef('0xb')]);router[_0x7aef('0x9')](_0x7aef('0xc'),auth[_0x7aef('0xa')](),controller[_0x7aef('0xd')]);router[_0x7aef('0x9')](_0x7aef('0xe'),auth[_0x7aef('0xa')](),controller[_0x7aef('0xf')]);router[_0x7aef('0x9')](_0x7aef('0x10'),auth[_0x7aef('0xa')](),controller[_0x7aef('0x11')]);router[_0x7aef('0x9')](_0x7aef('0x12'),auth[_0x7aef('0xa')](),controller['getAnswers']);router['get'](_0x7aef('0x13'),auth[_0x7aef('0xa')](),controller['getInteractions']);router['get'](_0x7aef('0x14'),auth[_0x7aef('0xa')](),controller[_0x7aef('0x15')]);router[_0x7aef('0x9')](_0x7aef('0x16'),auth[_0x7aef('0xa')](),controller[_0x7aef('0x17')]);router[_0x7aef('0x9')](_0x7aef('0x18'),auth[_0x7aef('0xa')](),controller[_0x7aef('0x19')]);router[_0x7aef('0x1a')]('/',auth[_0x7aef('0xa')](),controller['create']);router[_0x7aef('0x1a')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x7aef('0x1b')]);router[_0x7aef('0x1a')]('/:id/canned_answers',auth[_0x7aef('0xa')](),controller[_0x7aef('0x1c')]);router['post']('/:id/interactions',auth[_0x7aef('0xa')](),controller[_0x7aef('0x1d')]);router['post'](_0x7aef('0x14'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x7aef('0x1e'),auth[_0x7aef('0xa')](),controller[_0x7aef('0x1f')]);router[_0x7aef('0x1a')]('/updateaccountapplications',auth['isAuthenticated'](),controller[_0x7aef('0x20')]);router[_0x7aef('0x1a')]('/:id/send',auth[_0x7aef('0xa')](),controller[_0x7aef('0x21')]);router[_0x7aef('0x1a')](_0x7aef('0x18'),auth[_0x7aef('0xa')](),controller['addAgents']);router[_0x7aef('0x22')]('/:id',auth[_0x7aef('0xa')](),controller[_0x7aef('0x23')]);router['delete'](_0x7aef('0xe'),auth[_0x7aef('0xa')](),controller['destroy']);router['delete'](_0x7aef('0x10'),auth[_0x7aef('0xa')](),controller[_0x7aef('0x24')]);router[_0x7aef('0x25')](_0x7aef('0x12'),auth['isAuthenticated'](),controller[_0x7aef('0x26')]);router[_0x7aef('0x25')]('/:id/users',auth[_0x7aef('0xa')](),controller[_0x7aef('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 3a4a86f..3db63c8 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 _0xf29d=['TEXT','sequelize','exports','STRING','noop'];(function(_0x4d4596,_0x5e413b){var _0x157881=function(_0x477e27){while(--_0x477e27){_0x4d4596['push'](_0x4d4596['shift']());}};_0x157881(++_0x5e413b);}(_0xf29d,0xc4));var _0xdf29=function(_0x238b73,_0x5df76f){_0x238b73=_0x238b73-0x0;var _0x5966d9=_0xf29d[_0x238b73];return _0x5966d9;};'use strict';var Sequelize=require(_0xdf29('0x0'));module[_0xdf29('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xdf29('0x2')],'allowNull':![],'defaultValue':_0xdf29('0x3')},'appdata':{'type':Sequelize[_0xdf29('0x4')]()},'description':{'type':Sequelize[_0xdf29('0x2')]},'interval':{'type':Sequelize[_0xdf29('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x299a=['*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0xe3025,_0x686182){var _0x592d0b=function(_0x4d249f){while(--_0x4d249f){_0xe3025['push'](_0xe3025['shift']());}};_0x592d0b(++_0x686182);}(_0x299a,0x182));var _0xa299=function(_0x4e413f,_0x266ab4){_0x4e413f=_0x4e413f-0x0;var _0x2eca8a=_0x299a[_0x4e413f];return _0x2eca8a;};'use strict';var Sequelize=require('sequelize');module[_0xa299('0x0')]={'priority':{'type':Sequelize[_0xa299('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa299('0x2')],'allowNull':![],'defaultValue':_0xa299('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa299('0x2')]},'interval':{'type':Sequelize[_0xa299('0x2')],'defaultValue':_0xa299('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index da5b725..df4d50e 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 _0xb2ff=['VIRTUAL','filter','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','update','params','html-pdf','eml-format','zip-dir','bluebird','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','apply','destroy','then','error','stack','name','send','index','map','FaxApplication','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','merge'];(function(_0x1fb4e1,_0x3d4ce6){var _0x22d1b0=function(_0x553822){while(--_0x553822){_0x1fb4e1['push'](_0x1fb4e1['shift']());}};_0x22d1b0(++_0x3d4ce6);}(_0xb2ff,0x123));var _0xfb2f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb2ff[_0x4b369d];return _0x571a98;};'use strict';var pdf=require(_0xfb2f('0x0'));var emlformat=require(_0xfb2f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfb2f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfb2f('0x3'));var Mustache=require('mustache');var util=require(_0xfb2f('0x4'));var path=require(_0xfb2f('0x5'));var sox=require(_0xfb2f('0x6'));var csv=require(_0xfb2f('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfb2f('0x8'));var crypto=require('crypto');var jsforce=require(_0xfb2f('0x9'));var deskjs=require(_0xfb2f('0xa'));var toCsv=require(_0xfb2f('0x7'));var querystring=require(_0xfb2f('0xb'));var Papa=require('papaparse');var Redis=require(_0xfb2f('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xfb2f('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb2f('0xe'));var logger=require(_0xfb2f('0xf'))(_0xfb2f('0x10'));var utils=require(_0xfb2f('0x11'));var config=require(_0xfb2f('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36af84,_0x21f3fb){_0x21f3fb=_0x21f3fb||0xcc;return function(_0x2b5de4){if(_0x2b5de4){return _0x36af84[_0xfb2f('0x13')](_0x21f3fb);}return _0x36af84[_0xfb2f('0x14')](_0x21f3fb)[_0xfb2f('0x15')]();};}function respondWithResult(_0x36562f,_0x1fb289){_0x1fb289=_0x1fb289||0xc8;return function(_0x5f3893){if(_0x5f3893){return _0x36562f[_0xfb2f('0x14')](_0x1fb289)[_0xfb2f('0x16')](_0x5f3893);}};}function respondWithFilteredResult(_0x45c69d,_0xbfd8c2){return function(_0x34a57f){if(_0x34a57f){var _0x50c6cf=_0x34a57f[_0xfb2f('0x17')],_0xb6177a=_0xbfd8c2[_0xfb2f('0x18')],_0x1b23bb=_0xbfd8c2[_0xfb2f('0x18')]+_0xbfd8c2['limit'],_0x254f88;if(_0x1b23bb>=_0x50c6cf){_0x1b23bb=_0x50c6cf;_0x254f88=0xc8;}else{_0x254f88=0xce;}_0x45c69d[_0xfb2f('0x14')](_0x254f88);return _0x45c69d[_0xfb2f('0x19')]('Content-Range',_0xb6177a+'-'+_0x1b23bb+'/'+_0x50c6cf)[_0xfb2f('0x16')](_0x34a57f);}return null;};}function patchUpdates(_0x20d056){return function(_0xc3da81){try{jsonpatch[_0xfb2f('0x1a')](_0xc3da81,_0x20d056,!![]);}catch(_0x448216){return BPromise['reject'](_0x448216);}return _0xc3da81['save']();};}function saveUpdates(_0x3d3541,_0x5d0afa){return function(_0x26fc89){if(_0x26fc89){return _0x26fc89['update'](_0x3d3541)['then'](function(_0x2e285a){return _0x2e285a;});}return null;};}function removeEntity(_0x40cd2f,_0x4b9135){return function(_0x296340){if(_0x296340){return _0x296340[_0xfb2f('0x1b')]()[_0xfb2f('0x1c')](function(){_0x40cd2f[_0xfb2f('0x14')](0xcc)[_0xfb2f('0x15')]();});}};}function handleEntityNotFound(_0x5c9262,_0x3ed758){return function(_0x89d720){if(!_0x89d720){_0x5c9262['sendStatus'](0x194);}return _0x89d720;};}function handleError(_0x196d3c,_0x4f458a){_0x4f458a=_0x4f458a||0x1f4;return function(_0x4fa23e){logger[_0xfb2f('0x1d')](_0x4fa23e[_0xfb2f('0x1e')]);if(_0x4fa23e[_0xfb2f('0x1f')]){delete _0x4fa23e[_0xfb2f('0x1f')];}_0x196d3c['status'](_0x4f458a)[_0xfb2f('0x20')](_0x4fa23e);};}exports[_0xfb2f('0x21')]=function(_0x1faa59,_0x2321cf){var _0x464909={},_0x1d1ad4={},_0x5b1efa={'count':0x0,'rows':[]};var _0x2e27c0=_[_0xfb2f('0x22')](db[_0xfb2f('0x23')][_0xfb2f('0x24')],function(_0x52c8d8){return{'name':_0x52c8d8['fieldName'],'type':_0x52c8d8[_0xfb2f('0x25')][_0xfb2f('0x26')]};});_0x1d1ad4[_0xfb2f('0x27')]=_['map'](_0x2e27c0,_0xfb2f('0x1f'));_0x1d1ad4['query']=_['keys'](_0x1faa59[_0xfb2f('0x28')]);_0x1d1ad4['filters']=_[_0xfb2f('0x29')](_0x1d1ad4[_0xfb2f('0x27')],_0x1d1ad4[_0xfb2f('0x28')]);_0x464909[_0xfb2f('0x2a')]=_[_0xfb2f('0x29')](_0x1d1ad4['model'],qs[_0xfb2f('0x2b')](_0x1faa59[_0xfb2f('0x28')]['fields']));_0x464909['attributes']=_0x464909['attributes'][_0xfb2f('0x2c')]?_0x464909[_0xfb2f('0x2a')]:_0x1d1ad4[_0xfb2f('0x27')];if(!_0x1faa59[_0xfb2f('0x28')][_0xfb2f('0x2d')](_0xfb2f('0x2e'))){_0x464909[_0xfb2f('0x2f')]=qs[_0xfb2f('0x2f')](_0x1faa59[_0xfb2f('0x28')][_0xfb2f('0x2f')]);_0x464909[_0xfb2f('0x18')]=qs[_0xfb2f('0x18')](_0x1faa59[_0xfb2f('0x28')]['offset']);}_0x464909[_0xfb2f('0x30')]=qs[_0xfb2f('0x31')](_0x1faa59[_0xfb2f('0x28')][_0xfb2f('0x31')]);_0x464909['where']=qs[_0xfb2f('0x32')](_[_0xfb2f('0x33')](_0x1faa59[_0xfb2f('0x28')],_0x1d1ad4[_0xfb2f('0x32')]));if(_0x1faa59[_0xfb2f('0x28')]['filter']){_0x464909[_0xfb2f('0x34')]=_[_0xfb2f('0x35')](_0x464909[_0xfb2f('0x34')],{'$or':_[_0xfb2f('0x22')](_0x2e27c0,function(_0x52b2b7){if(_0x52b2b7[_0xfb2f('0x25')]!==_0xfb2f('0x36')){var _0x12d2aa={};_0x12d2aa[_0x52b2b7[_0xfb2f('0x1f')]]={'$like':'%'+_0x1faa59['query'][_0xfb2f('0x37')]+'%'};return _0x12d2aa;}})});}_0x464909=_[_0xfb2f('0x35')]({},_0x464909,_0x1faa59[_0xfb2f('0x38')]);var _0x4afeff={'where':_0x464909['where']};return db['FaxApplication']['count'](_0x4afeff)['then'](function(_0x1797f4){_0x5b1efa[_0xfb2f('0x17')]=_0x1797f4;if(_0x1faa59[_0xfb2f('0x28')]['includeAll']){_0x464909[_0xfb2f('0x39')]=[{'all':!![]}];}return db[_0xfb2f('0x23')][_0xfb2f('0x3a')](_0x464909);})[_0xfb2f('0x1c')](function(_0x20b34b){_0x5b1efa[_0xfb2f('0x3b')]=_0x20b34b;return _0x5b1efa;})[_0xfb2f('0x1c')](respondWithFilteredResult(_0x2321cf,_0x464909))[_0xfb2f('0x3c')](handleError(_0x2321cf,null));};exports[_0xfb2f('0x3d')]=function(_0x56ceac,_0x3a54ce){var _0x5d26ca={'raw':!![],'where':{'id':_0x56ceac['params']['id']}},_0x5aa838={};_0x5aa838[_0xfb2f('0x27')]=_[_0xfb2f('0x3e')](db[_0xfb2f('0x23')][_0xfb2f('0x24')]);_0x5aa838[_0xfb2f('0x28')]=_[_0xfb2f('0x3e')](_0x56ceac['query']);_0x5aa838[_0xfb2f('0x32')]=_['intersection'](_0x5aa838[_0xfb2f('0x27')],_0x5aa838[_0xfb2f('0x28')]);_0x5d26ca['attributes']=_[_0xfb2f('0x29')](_0x5aa838['model'],qs[_0xfb2f('0x2b')](_0x56ceac[_0xfb2f('0x28')][_0xfb2f('0x2b')]));_0x5d26ca['attributes']=_0x5d26ca[_0xfb2f('0x2a')][_0xfb2f('0x2c')]?_0x5d26ca[_0xfb2f('0x2a')]:_0x5aa838[_0xfb2f('0x27')];if(_0x56ceac[_0xfb2f('0x28')][_0xfb2f('0x3f')]){_0x5d26ca[_0xfb2f('0x39')]=[{'all':!![]}];}_0x5d26ca=_[_0xfb2f('0x35')]({},_0x5d26ca,_0x56ceac[_0xfb2f('0x38')]);return db[_0xfb2f('0x23')][_0xfb2f('0x40')](_0x5d26ca)[_0xfb2f('0x1c')](handleEntityNotFound(_0x3a54ce,null))[_0xfb2f('0x1c')](respondWithResult(_0x3a54ce,null))[_0xfb2f('0x3c')](handleError(_0x3a54ce,null));};exports[_0xfb2f('0x41')]=function(_0x57241c,_0x31b76c){return db[_0xfb2f('0x23')]['create'](_0x57241c[_0xfb2f('0x42')],{})['then'](respondWithResult(_0x31b76c,0xc9))[_0xfb2f('0x3c')](handleError(_0x31b76c,null));};exports[_0xfb2f('0x43')]=function(_0x73bc1,_0x844784){if(_0x73bc1[_0xfb2f('0x42')]['id']){delete _0x73bc1[_0xfb2f('0x42')]['id'];}return db['FaxApplication'][_0xfb2f('0x40')]({'where':{'id':_0x73bc1['params']['id']}})['then'](handleEntityNotFound(_0x844784,null))[_0xfb2f('0x1c')](saveUpdates(_0x73bc1['body'],null))['then'](respondWithResult(_0x844784,null))[_0xfb2f('0x3c')](handleError(_0x844784,null));};exports[_0xfb2f('0x1b')]=function(_0x31936c,_0x3b4e4d){return db['FaxApplication'][_0xfb2f('0x40')]({'where':{'id':_0x31936c[_0xfb2f('0x44')]['id']}})[_0xfb2f('0x1c')](handleEntityNotFound(_0x3b4e4d,null))[_0xfb2f('0x1c')](removeEntity(_0x3b4e4d,null))[_0xfb2f('0x3c')](handleError(_0x3b4e4d,null));}; \ No newline at end of file +var _0xe799=['FaxApplication','catch','show','params','find','create','body','destroy','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','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/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include'];(function(_0x1c1c98,_0x2f1602){var _0x28feae=function(_0x384951){while(--_0x384951){_0x1c1c98['push'](_0x1c1c98['shift']());}};_0x28feae(++_0x2f1602);}(_0xe799,0x170));var _0x9e79=function(_0x52df20,_0x3b990e){_0x52df20=_0x52df20-0x0;var _0x2f2d8b=_0xe799[_0x52df20];return _0x2f2d8b;};'use strict';var pdf=require(_0x9e79('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9e79('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e79('0x2'));var rp=require(_0x9e79('0x3'));var moment=require('moment');var BPromise=require(_0x9e79('0x4'));var Mustache=require(_0x9e79('0x5'));var util=require(_0x9e79('0x6'));var path=require('path');var sox=require(_0x9e79('0x7'));var csv=require('to-csv');var ejs=require(_0x9e79('0x8'));var fs=require('fs');var _=require(_0x9e79('0x9'));var squel=require(_0x9e79('0xa'));var crypto=require('crypto');var jsforce=require(_0x9e79('0xb'));var deskjs=require(_0x9e79('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9e79('0xd'));var Papa=require(_0x9e79('0xe'));var Redis=require(_0x9e79('0xf'));var authService=require(_0x9e79('0x10'));var qs=require(_0x9e79('0x11'));var as=require(_0x9e79('0x12'));var hardwareService=require(_0x9e79('0x13'));var logger=require('../../config/logger')(_0x9e79('0x14'));var utils=require(_0x9e79('0x15'));var config=require(_0x9e79('0x16'));var db=require(_0x9e79('0x17'))['db'];function respondWithStatusCode(_0x3b5fd7,_0x4cf63d){_0x4cf63d=_0x4cf63d||0xcc;return function(_0x27f4cb){if(_0x27f4cb){return _0x3b5fd7[_0x9e79('0x18')](_0x4cf63d);}return _0x3b5fd7[_0x9e79('0x19')](_0x4cf63d)[_0x9e79('0x1a')]();};}function respondWithResult(_0x449b8e,_0x9dc07c){_0x9dc07c=_0x9dc07c||0xc8;return function(_0xc939){if(_0xc939){return _0x449b8e[_0x9e79('0x19')](_0x9dc07c)[_0x9e79('0x1b')](_0xc939);}};}function respondWithFilteredResult(_0x23cad2,_0x425a31){return function(_0x107233){if(_0x107233){var _0x55becf=_0x107233[_0x9e79('0x1c')],_0xcf0458=_0x425a31['offset'],_0x591a49=_0x425a31[_0x9e79('0x1d')]+_0x425a31[_0x9e79('0x1e')],_0x45b958;if(_0x591a49>=_0x55becf){_0x591a49=_0x55becf;_0x45b958=0xc8;}else{_0x45b958=0xce;}_0x23cad2['status'](_0x45b958);return _0x23cad2['set'](_0x9e79('0x1f'),_0xcf0458+'-'+_0x591a49+'/'+_0x55becf)[_0x9e79('0x1b')](_0x107233);}return null;};}function patchUpdates(_0x33e7a2){return function(_0x205531){try{jsonpatch[_0x9e79('0x20')](_0x205531,_0x33e7a2,!![]);}catch(_0x48591f){return BPromise[_0x9e79('0x21')](_0x48591f);}return _0x205531[_0x9e79('0x22')]();};}function saveUpdates(_0x3664e5,_0x2f499b){return function(_0x5a0891){if(_0x5a0891){return _0x5a0891[_0x9e79('0x23')](_0x3664e5)[_0x9e79('0x24')](function(_0x567a19){return _0x567a19;});}return null;};}function removeEntity(_0x4559e6,_0x222fb5){return function(_0x4d76be){if(_0x4d76be){return _0x4d76be['destroy']()['then'](function(){_0x4559e6['status'](0xcc)[_0x9e79('0x1a')]();});}};}function handleEntityNotFound(_0xa55ae0,_0x57cb8f){return function(_0x270e75){if(!_0x270e75){_0xa55ae0[_0x9e79('0x18')](0x194);}return _0x270e75;};}function handleError(_0x1b164a,_0x1c43ee){_0x1c43ee=_0x1c43ee||0x1f4;return function(_0x55d42c){logger[_0x9e79('0x25')](_0x55d42c[_0x9e79('0x26')]);if(_0x55d42c['name']){delete _0x55d42c[_0x9e79('0x27')];}_0x1b164a[_0x9e79('0x19')](_0x1c43ee)['send'](_0x55d42c);};}exports[_0x9e79('0x28')]=function(_0x386ea2,_0x2e6fb3){var _0x2764dd={},_0x207e64={},_0x348c31={'count':0x0,'rows':[]};var _0x4b69c2=_['map'](db['FaxApplication'][_0x9e79('0x29')],function(_0x2b5d54){return{'name':_0x2b5d54[_0x9e79('0x2a')],'type':_0x2b5d54[_0x9e79('0x2b')][_0x9e79('0x2c')]};});_0x207e64[_0x9e79('0x2d')]=_['map'](_0x4b69c2,'name');_0x207e64[_0x9e79('0x2e')]=_[_0x9e79('0x2f')](_0x386ea2['query']);_0x207e64[_0x9e79('0x30')]=_[_0x9e79('0x31')](_0x207e64['model'],_0x207e64[_0x9e79('0x2e')]);_0x2764dd[_0x9e79('0x32')]=_['intersection'](_0x207e64['model'],qs[_0x9e79('0x33')](_0x386ea2[_0x9e79('0x2e')]['fields']));_0x2764dd[_0x9e79('0x32')]=_0x2764dd[_0x9e79('0x32')][_0x9e79('0x34')]?_0x2764dd[_0x9e79('0x32')]:_0x207e64['model'];if(!_0x386ea2[_0x9e79('0x2e')][_0x9e79('0x35')]('nolimit')){_0x2764dd[_0x9e79('0x1e')]=qs[_0x9e79('0x1e')](_0x386ea2[_0x9e79('0x2e')][_0x9e79('0x1e')]);_0x2764dd[_0x9e79('0x1d')]=qs[_0x9e79('0x1d')](_0x386ea2[_0x9e79('0x2e')][_0x9e79('0x1d')]);}_0x2764dd['order']=qs[_0x9e79('0x36')](_0x386ea2['query'][_0x9e79('0x36')]);_0x2764dd[_0x9e79('0x37')]=qs[_0x9e79('0x30')](_[_0x9e79('0x38')](_0x386ea2['query'],_0x207e64[_0x9e79('0x30')]));if(_0x386ea2[_0x9e79('0x2e')]['filter']){_0x2764dd[_0x9e79('0x37')]=_[_0x9e79('0x39')](_0x2764dd[_0x9e79('0x37')],{'$or':_[_0x9e79('0x3a')](_0x4b69c2,function(_0x468fd1){if(_0x468fd1[_0x9e79('0x2b')]!==_0x9e79('0x3b')){var _0x4e673a={};_0x4e673a[_0x468fd1[_0x9e79('0x27')]]={'$like':'%'+_0x386ea2[_0x9e79('0x2e')][_0x9e79('0x3c')]+'%'};return _0x4e673a;}})});}_0x2764dd=_[_0x9e79('0x39')]({},_0x2764dd,_0x386ea2[_0x9e79('0x3d')]);var _0x5d494c={'where':_0x2764dd['where']};return db['FaxApplication'][_0x9e79('0x1c')](_0x5d494c)[_0x9e79('0x24')](function(_0x5247e7){_0x348c31[_0x9e79('0x1c')]=_0x5247e7;if(_0x386ea2[_0x9e79('0x2e')][_0x9e79('0x3e')]){_0x2764dd[_0x9e79('0x3f')]=[{'all':!![]}];}return db[_0x9e79('0x40')]['findAll'](_0x2764dd);})['then'](function(_0x2f6e1d){_0x348c31['rows']=_0x2f6e1d;return _0x348c31;})[_0x9e79('0x24')](respondWithFilteredResult(_0x2e6fb3,_0x2764dd))[_0x9e79('0x41')](handleError(_0x2e6fb3,null));};exports[_0x9e79('0x42')]=function(_0x16d0aa,_0x5b3ea7){var _0x588f0e={'raw':!![],'where':{'id':_0x16d0aa[_0x9e79('0x43')]['id']}},_0x3d8bcc={};_0x3d8bcc['model']=_[_0x9e79('0x2f')](db[_0x9e79('0x40')][_0x9e79('0x29')]);_0x3d8bcc['query']=_[_0x9e79('0x2f')](_0x16d0aa[_0x9e79('0x2e')]);_0x3d8bcc[_0x9e79('0x30')]=_[_0x9e79('0x31')](_0x3d8bcc[_0x9e79('0x2d')],_0x3d8bcc['query']);_0x588f0e['attributes']=_['intersection'](_0x3d8bcc['model'],qs[_0x9e79('0x33')](_0x16d0aa[_0x9e79('0x2e')][_0x9e79('0x33')]));_0x588f0e[_0x9e79('0x32')]=_0x588f0e[_0x9e79('0x32')][_0x9e79('0x34')]?_0x588f0e[_0x9e79('0x32')]:_0x3d8bcc[_0x9e79('0x2d')];if(_0x16d0aa[_0x9e79('0x2e')][_0x9e79('0x3e')]){_0x588f0e[_0x9e79('0x3f')]=[{'all':!![]}];}_0x588f0e=_[_0x9e79('0x39')]({},_0x588f0e,_0x16d0aa[_0x9e79('0x3d')]);return db[_0x9e79('0x40')][_0x9e79('0x44')](_0x588f0e)[_0x9e79('0x24')](handleEntityNotFound(_0x5b3ea7,null))[_0x9e79('0x24')](respondWithResult(_0x5b3ea7,null))[_0x9e79('0x41')](handleError(_0x5b3ea7,null));};exports['create']=function(_0x4dbef8,_0x32ced0){return db[_0x9e79('0x40')][_0x9e79('0x45')](_0x4dbef8[_0x9e79('0x46')],{})['then'](respondWithResult(_0x32ced0,0xc9))['catch'](handleError(_0x32ced0,null));};exports['update']=function(_0x36c378,_0x5da845){if(_0x36c378[_0x9e79('0x46')]['id']){delete _0x36c378['body']['id'];}return db['FaxApplication'][_0x9e79('0x44')]({'where':{'id':_0x36c378[_0x9e79('0x43')]['id']}})[_0x9e79('0x24')](handleEntityNotFound(_0x5da845,null))[_0x9e79('0x24')](saveUpdates(_0x36c378['body'],null))[_0x9e79('0x24')](respondWithResult(_0x5da845,null))[_0x9e79('0x41')](handleError(_0x5da845,null));};exports[_0x9e79('0x47')]=function(_0x3959ef,_0x2da85e){return db['FaxApplication']['find']({'where':{'id':_0x3959ef[_0x9e79('0x43')]['id']}})[_0x9e79('0x24')](handleEntityNotFound(_0x2da85e,null))['then'](removeEntity(_0x2da85e,null))[_0x9e79('0x41')](handleError(_0x2da85e,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index ab7f7ff..e70db3b 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 _0x6efa=['./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6efa,0x10b));var _0xa6ef=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x6efa[_0x20ef64];return _0x3707d8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa6ef('0x0'))(_0xa6ef('0x1'));var moment=require(_0xa6ef('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa6ef('0x3'));module[_0xa6ef('0x4')]=function(_0xa4ff6d,_0x327721){return _0xa4ff6d[_0xa6ef('0x5')](_0xa6ef('0x6'),attributes,{'tableName':_0xa6ef('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa6ef('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9b7d=['exports','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path','../../config/environment'];(function(_0x3620a3,_0x1e8376){var _0x55985f=function(_0x3da5d4){while(--_0x3da5d4){_0x3620a3['push'](_0x3620a3['shift']());}};_0x55985f(++_0x1e8376);}(_0x9b7d,0x18a));var _0xd9b7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9b7d[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xd9b7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd9b7('0x1'));var moment=require('moment');var BPromise=require(_0xd9b7('0x2'));var rp=require(_0xd9b7('0x3'));var fs=require('fs');var path=require(_0xd9b7('0x4'));var rimraf=require('rimraf');var config=require(_0xd9b7('0x5'));var attributes=require('./faxApplication.attributes');module[_0xd9b7('0x6')]=function(_0x451707,_0x3f722d){return _0x451707['define'](_0xd9b7('0x7'),attributes,{'tableName':_0xd9b7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd9b7('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 78ccb52..dc20fc5 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 _0x5da7=['jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','attributes','limit','debug','stringify','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xf4af9,_0x59edaa){var _0x2cbde9=function(_0x2dd66a){while(--_0x2dd66a){_0xf4af9['push'](_0xf4af9['shift']());}};_0x2cbde9(++_0x59edaa);}(_0x5da7,0x138));var _0x75da=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5da7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x75da('0x0'));var util=require(_0x75da('0x1'));var moment=require('moment');var BPromise=require(_0x75da('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x75da('0x3'));var logger=require(_0x75da('0x4'))(_0x75da('0x5'));var config=require(_0x75da('0x6'));var jayson=require(_0x75da('0x7'));var client=jayson['client'][_0x75da('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x272c9c,_0x1bab75,_0x459788){return new BPromise(function(_0xa36dad,_0x1c56eb){return client[_0x75da('0x9')](_0x272c9c,_0x459788)[_0x75da('0xa')](function(_0x1cedc8){logger[_0x75da('0xb')](_0x75da('0xc'),_0x1bab75,_0x75da('0xd'));logger['debug'](_0x75da('0xe'),_0x1bab75,_0x75da('0xd'),JSON['stringify'](_0x1cedc8));if(_0x1cedc8[_0x75da('0xf')]){if(_0x1cedc8[_0x75da('0xf')][_0x75da('0x10')]===0x1f4){logger[_0x75da('0xf')](_0x75da('0xc'),_0x1bab75,_0x1cedc8[_0x75da('0xf')][_0x75da('0x11')]);return _0x1c56eb(_0x1cedc8[_0x75da('0xf')]['message']);}logger['error'](_0x75da('0xc'),_0x1bab75,_0x1cedc8['error']['message']);return _0xa36dad(_0x1cedc8[_0x75da('0xf')][_0x75da('0x11')]);}else{logger[_0x75da('0xb')]('FaxApplication,\x20%s,\x20%s',_0x1bab75,_0x75da('0xd'));_0xa36dad(_0x1cedc8['result'][_0x75da('0x11')]);}})[_0x75da('0x12')](function(_0x4234c1){logger[_0x75da('0xf')](_0x75da('0xc'),_0x1bab75,_0x4234c1);_0x1c56eb(_0x4234c1);});});}exports[_0x75da('0x13')]=function(_0x4d451a){var _0x56f584=this;return new Promise(function(_0x414fb0,_0x19557c){return db[_0x75da('0x14')][_0x75da('0x15')](_0x4d451a[_0x75da('0x16')],{'raw':_0x4d451a[_0x75da('0x17')]?_0x4d451a[_0x75da('0x17')][_0x75da('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d451a[_0x75da('0x17')]?_0x4d451a[_0x75da('0x17')]['where']||null:null,'attributes':_0x4d451a[_0x75da('0x17')]?_0x4d451a[_0x75da('0x17')][_0x75da('0x19')]||null:null,'limit':_0x4d451a[_0x75da('0x17')]?_0x4d451a[_0x75da('0x17')][_0x75da('0x1a')]||null:null})[_0x75da('0xa')](function(_0x49c19c){logger[_0x75da('0xb')](_0x75da('0x13'),_0x4d451a);logger[_0x75da('0x1b')](_0x75da('0x13'),_0x4d451a,JSON[_0x75da('0x1c')](_0x49c19c));_0x414fb0(_0x49c19c);})[_0x75da('0x12')](function(_0x4756da){logger[_0x75da('0xf')](_0x75da('0x13'),_0x4756da[_0x75da('0x11')],_0x4d451a);_0x19557c(_0x56f584[_0x75da('0xf')](0x1f4,_0x4756da[_0x75da('0x11')]));});});}; \ No newline at end of file +var _0x3001=['update','body','options','raw','attributes','limit','UpdateFaxApplication','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxApplication'];(function(_0x7c38a9,_0x192f0e){var _0x16a8a4=function(_0x198ec0){while(--_0x198ec0){_0x7c38a9['push'](_0x7c38a9['shift']());}};_0x16a8a4(++_0x192f0e);}(_0x3001,0xc8));var _0x1300=function(_0x13ae31,_0x204bb4){_0x13ae31=_0x13ae31-0x0;var _0x2bf337=_0x3001[_0x13ae31];return _0x2bf337;};'use strict';var _=require(_0x1300('0x0'));var util=require(_0x1300('0x1'));var moment=require(_0x1300('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1300('0x3'));var db=require(_0x1300('0x4'))['db'];var utils=require(_0x1300('0x5'));var logger=require(_0x1300('0x6'))(_0x1300('0x7'));var config=require(_0x1300('0x8'));var jayson=require(_0x1300('0x9'));var client=jayson[_0x1300('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cc5d5,_0x5f5464,_0x1f8e99){return new BPromise(function(_0x3b3e0b,_0x1e863f){return client[_0x1300('0xb')](_0x3cc5d5,_0x1f8e99)[_0x1300('0xc')](function(_0x4686e7){logger[_0x1300('0xd')](_0x1300('0xe'),_0x5f5464,_0x1300('0xf'));logger['debug'](_0x1300('0x10'),_0x5f5464,_0x1300('0xf'),JSON[_0x1300('0x11')](_0x4686e7));if(_0x4686e7['error']){if(_0x4686e7[_0x1300('0x12')][_0x1300('0x13')]===0x1f4){logger[_0x1300('0x12')](_0x1300('0xe'),_0x5f5464,_0x4686e7['error'][_0x1300('0x14')]);return _0x1e863f(_0x4686e7[_0x1300('0x12')][_0x1300('0x14')]);}logger[_0x1300('0x12')](_0x1300('0xe'),_0x5f5464,_0x4686e7[_0x1300('0x12')][_0x1300('0x14')]);return _0x3b3e0b(_0x4686e7[_0x1300('0x12')]['message']);}else{logger[_0x1300('0xd')](_0x1300('0xe'),_0x5f5464,_0x1300('0xf'));_0x3b3e0b(_0x4686e7[_0x1300('0x15')]['message']);}})[_0x1300('0x16')](function(_0x58cfdf){logger[_0x1300('0x12')](_0x1300('0xe'),_0x5f5464,_0x58cfdf);_0x1e863f(_0x58cfdf);});});}exports['UpdateFaxApplication']=function(_0x294d11){var _0x220e7d=this;return new Promise(function(_0x2124e1,_0x428a51){return db[_0x1300('0x17')][_0x1300('0x18')](_0x294d11[_0x1300('0x19')],{'raw':_0x294d11[_0x1300('0x1a')]?_0x294d11[_0x1300('0x1a')][_0x1300('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x294d11['options']?_0x294d11[_0x1300('0x1a')]['where']||null:null,'attributes':_0x294d11[_0x1300('0x1a')]?_0x294d11[_0x1300('0x1a')][_0x1300('0x1c')]||null:null,'limit':_0x294d11['options']?_0x294d11['options'][_0x1300('0x1d')]||null:null})['then'](function(_0x27de49){logger[_0x1300('0xd')](_0x1300('0x1e'),_0x294d11);logger[_0x1300('0x1f')]('UpdateFaxApplication',_0x294d11,JSON[_0x1300('0x11')](_0x27de49));_0x2124e1(_0x27de49);})[_0x1300('0x16')](function(_0x182b93){logger['error'](_0x1300('0x1e'),_0x182b93[_0x1300('0x14')],_0x294d11);_0x428a51(_0x220e7d[_0x1300('0x12')](0x1f4,_0x182b93[_0x1300('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 0bbf121..b166f99 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 _0x98a8=['express','Router','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x4b2ddd,_0x58e277){var _0x43ca52=function(_0x26ab62){while(--_0x26ab62){_0x4b2ddd['push'](_0x4b2ddd['shift']());}};_0x43ca52(++_0x58e277);}(_0x98a8,0x12c));var _0x898a=function(_0x5ca76f,_0x11a6c9){_0x5ca76f=_0x5ca76f-0x0;var _0x4f10d5=_0x98a8[_0x5ca76f];return _0x4f10d5;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['post']('/',auth[_0x898a('0xa')](),controller[_0x898a('0xe')]);router[_0x898a('0xf')](_0x898a('0xc'),auth[_0x898a('0xa')](),controller[_0x898a('0x10')]);router[_0x898a('0x11')](_0x898a('0xc'),auth[_0x898a('0xa')](),controller['destroy']);module[_0x898a('0x12')]=router; \ No newline at end of file +var _0x6aa7=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','path'];(function(_0x165af6,_0x1a98a7){var _0x2f7cf2=function(_0x2514bb){while(--_0x2514bb){_0x165af6['push'](_0x165af6['shift']());}};_0x2f7cf2(++_0x1a98a7);}(_0x6aa7,0x178));var _0x76aa=function(_0x4d0c91,_0x14bf3f){_0x4d0c91=_0x4d0c91-0x0;var _0xccf029=_0x6aa7[_0x4d0c91];return _0xccf029;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x76aa('0x5'));var config=require(_0x76aa('0x6'));var controller=require(_0x76aa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x76aa('0x8')]);router['get'](_0x76aa('0x9'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xb')]);router['post']('/',auth[_0x76aa('0xa')](),controller[_0x76aa('0xc')]);router[_0x76aa('0xd')]('/:id',auth[_0x76aa('0xa')](),controller[_0x76aa('0xe')]);router[_0x76aa('0xf')](_0x76aa('0x9'),auth[_0x76aa('0xa')](),controller[_0x76aa('0x10')]);module[_0x76aa('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 4967a2c..fd6715a 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 _0xb111=['ENUM','out','exports','BOOLEAN','STRING','DATE'];(function(_0x586321,_0x2f18ac){var _0x1ee843=function(_0x4db1ad){while(--_0x4db1ad){_0x586321['push'](_0x586321['shift']());}};_0x1ee843(++_0x2f18ac);}(_0xb111,0x1ac));var _0x1b11=function(_0x30dfa4,_0x1a6275){_0x30dfa4=_0x30dfa4-0x0;var _0x185b37=_0xb111[_0x30dfa4];return _0x185b37;};'use strict';var Sequelize=require('sequelize');module[_0x1b11('0x0')]={'closed':{'type':Sequelize[_0x1b11('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1b11('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1b11('0x3')]},'fax':{'type':Sequelize[_0x1b11('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x1b11('0x4')]('in',_0x1b11('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1b11('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xa358=['exports','DATE','STRING','ENUM','out'];(function(_0x3cdc99,_0x24114e){var _0x424631=function(_0x5e68a0){while(--_0x5e68a0){_0x3cdc99['push'](_0x3cdc99['shift']());}};_0x424631(++_0x24114e);}(_0xa358,0x11d));var _0x8a35=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa358[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x8a35('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8a35('0x1')]},'disposition':{'type':Sequelize[_0x8a35('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x8a35('0x1')]},'fax':{'type':Sequelize[_0x8a35('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x8a35('0x3')]('in',_0x8a35('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8a35('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x8a35('0x3')]('in',_0x8a35('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index c714807..1c80f8e 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 _0xee93=['conditions','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','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','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','start','some','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.fax\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','params','include','options','create','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','findAll','emit','faxInteractionTags:save','removeTags','unix','root','files','join','server','attachments','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','createWriteStream','resolve','download','log','err','unlinkSync','sendStatus','html-pdf','eml-format','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','catch','FaxInteraction','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','filters','pick','select','field','color','from','tools_tags','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','cm_contacts','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','parseSearch'];(function(_0x37e967,_0xb3c159){var _0x259861=function(_0x59ec14){while(--_0x59ec14){_0x37e967['push'](_0x37e967['shift']());}};_0x259861(++_0xb3c159);}(_0xee93,0x150));var _0x3ee9=function(_0x28e69f,_0x3ce461){_0x28e69f=_0x28e69f-0x0;var _0x1beff1=_0xee93[_0x28e69f];return _0x1beff1;};'use strict';var pdf=require(_0x3ee9('0x0'));var emlformat=require(_0x3ee9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3ee9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3ee9('0x3'));var util=require(_0x3ee9('0x4'));var path=require(_0x3ee9('0x5'));var sox=require(_0x3ee9('0x6'));var csv=require(_0x3ee9('0x7'));var ejs=require(_0x3ee9('0x8'));var fs=require('fs');var _=require(_0x3ee9('0x9'));var squel=require(_0x3ee9('0xa'));var crypto=require(_0x3ee9('0xb'));var jsforce=require(_0x3ee9('0xc'));var deskjs=require(_0x3ee9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3ee9('0xe'));var Papa=require(_0x3ee9('0xf'));var Redis=require(_0x3ee9('0x10'));var authService=require(_0x3ee9('0x11'));var qs=require(_0x3ee9('0x12'));var as=require(_0x3ee9('0x13'));var hardwareService=require(_0x3ee9('0x14'));var logger=require(_0x3ee9('0x15'))('api');var utils=require(_0x3ee9('0x16'));var config=require(_0x3ee9('0x17'));var db=require(_0x3ee9('0x18'))['db'];config[_0x3ee9('0x19')]=_[_0x3ee9('0x1a')](config[_0x3ee9('0x19')],{'host':_0x3ee9('0x1b'),'port':0x18eb});var socket=require(_0x3ee9('0x1c'))(new Redis(config[_0x3ee9('0x19')]));require(_0x3ee9('0x1d'))[_0x3ee9('0x1e')](socket);function respondWithStatusCode(_0x5828be,_0x56792d){_0x56792d=_0x56792d||0xcc;return function(_0x186c71){if(_0x186c71){return _0x5828be['sendStatus'](_0x56792d);}return _0x5828be[_0x3ee9('0x1f')](_0x56792d)[_0x3ee9('0x20')]();};}function respondWithResult(_0x1c2986,_0x19dedd){_0x19dedd=_0x19dedd||0xc8;return function(_0x5127cc){if(_0x5127cc){return _0x1c2986[_0x3ee9('0x1f')](_0x19dedd)[_0x3ee9('0x21')](_0x5127cc);}};}function respondWithFilteredResult(_0x28b5fc,_0x5a065b){return function(_0x49e7e1){if(_0x49e7e1){var _0x45d06c=_0x49e7e1[_0x3ee9('0x22')],_0x30cd96=_0x5a065b['offset'],_0x3b889b=_0x5a065b['offset']+_0x5a065b[_0x3ee9('0x23')],_0x3253b0;if(_0x3b889b>=_0x45d06c){_0x3b889b=_0x45d06c;_0x3253b0=0xc8;}else{_0x3253b0=0xce;}_0x28b5fc[_0x3ee9('0x1f')](_0x3253b0);return _0x28b5fc[_0x3ee9('0x24')](_0x3ee9('0x25'),_0x30cd96+'-'+_0x3b889b+'/'+_0x45d06c)[_0x3ee9('0x21')](_0x49e7e1);}return null;};}function patchUpdates(_0x12f457){return function(_0x549216){try{jsonpatch['apply'](_0x549216,_0x12f457,!![]);}catch(_0x5eccae){return BPromise[_0x3ee9('0x26')](_0x5eccae);}return _0x549216[_0x3ee9('0x27')]();};}function saveUpdates(_0x1b6592,_0x224f89){return function(_0x23d9a5){if(_0x23d9a5){return _0x23d9a5[_0x3ee9('0x28')](_0x1b6592)[_0x3ee9('0x29')](function(_0x273a5e){return _0x273a5e;});}return null;};}function removeEntity(_0x1d6116,_0x3c4209){return function(_0x556d0c){if(_0x556d0c){return _0x556d0c[_0x3ee9('0x2a')]()[_0x3ee9('0x29')](function(){_0x1d6116[_0x3ee9('0x1f')](0xcc)[_0x3ee9('0x20')]();});}};}function handleEntityNotFound(_0xef7b60,_0x188f6e){return function(_0xa0b422){if(!_0xa0b422){_0xef7b60['sendStatus'](0x194);}return _0xa0b422;};}function handleError(_0x210cb6,_0x2eac19){_0x2eac19=_0x2eac19||0x1f4;return function(_0x3fce35){logger[_0x3ee9('0x2b')](_0x3fce35[_0x3ee9('0x2c')]);if(_0x3fce35[_0x3ee9('0x2d')]){delete _0x3fce35[_0x3ee9('0x2d')];}_0x210cb6[_0x3ee9('0x1f')](_0x2eac19)[_0x3ee9('0x2e')](_0x3fce35);};}function getInteractionUsers(_0x4cc861,_0x183f64){return new BPromise(function(_0x1873c8,_0x571f0a){try{if(_0x183f64[_0x4cc861['id']]){_0x4cc861[_0x3ee9('0x2f')]=_['map'](_0x183f64[_0x4cc861['id']],function(_0x2c6604){return{'id':_0x2c6604['id'],'fullname':_0x2c6604[_0x3ee9('0x30')]};});}}catch(_0x1d5ed9){_0x571f0a(_0x1d5ed9);}_0x1873c8(_0x4cc861);});}function getInteractionTags(_0x1e5e06,_0x3b47d3){return new BPromise(function(_0x2f3848,_0x46a5b4){try{if(_0x1e5e06[_0x3ee9('0x31')]){_0x1e5e06[_0x3ee9('0x32')]=[];_0x1e5e06[_0x3ee9('0x31')][_0x3ee9('0x33')](',')[_0x3ee9('0x34')](function(_0x379e4c){_0x1e5e06[_0x3ee9('0x32')][_0x3ee9('0x35')](_0x3b47d3[_0x379e4c]);});}delete _0x1e5e06[_0x3ee9('0x31')];}catch(_0x4b922d){_0x46a5b4(_0x4b922d);}_0x2f3848(_0x1e5e06);});}function updateFaxInteraction(_0x2bfa79,_0x42fa18,_0x2d88af){return new BPromise(function(_0x32cf64,_0x3eca92){return getInteractionUsers(_0x2bfa79,_0x2d88af)[_0x3ee9('0x29')](function(_0x584848){return getInteractionTags(_0x584848,_0x42fa18);})[_0x3ee9('0x29')](function(_0x4b32e7){_0x32cf64(_0x4b32e7);})[_0x3ee9('0x36')](function(_0x49f052){_0x3eca92(_0x49f052);});});}exports['index']=function(_0x93882c,_0x497606){var _0x307597={},_0xe4d7b0={},_0x2b6aa4={'count':0x0,'rows':[]};var _0xa16e7b=_['map'](db[_0x3ee9('0x37')][_0x3ee9('0x38')],function(_0x48729f){return{'name':_0x48729f[_0x3ee9('0x39')],'type':_0x48729f[_0x3ee9('0x3a')][_0x3ee9('0x3b')]};});_0xe4d7b0[_0x3ee9('0x3c')]=_[_0x3ee9('0x3d')](_0xa16e7b,_0x3ee9('0x2d'));_0xe4d7b0[_0x3ee9('0x3e')]=_[_0x3ee9('0x3f')](_0x93882c['query']);_0xe4d7b0['filters']=_[_0x3ee9('0x40')](_0xe4d7b0[_0x3ee9('0x3c')],_0xe4d7b0[_0x3ee9('0x3e')]);_0x307597['attributes']=_[_0x3ee9('0x40')](_0xe4d7b0[_0x3ee9('0x3c')],qs[_0x3ee9('0x41')](_0x93882c[_0x3ee9('0x3e')][_0x3ee9('0x41')]));_0x307597['attributes']=_0x307597[_0x3ee9('0x42')][_0x3ee9('0x43')]?_0x307597[_0x3ee9('0x42')]:_0xe4d7b0[_0x3ee9('0x3c')];if(!_0x93882c['query'][_0x3ee9('0x44')](_0x3ee9('0x45'))){_0x307597[_0x3ee9('0x23')]=qs[_0x3ee9('0x23')](_0x93882c['query'][_0x3ee9('0x23')]);_0x307597[_0x3ee9('0x46')]=qs[_0x3ee9('0x46')](_0x93882c[_0x3ee9('0x3e')][_0x3ee9('0x46')]);}_0x307597[_0x3ee9('0x47')]=qs[_0x3ee9('0x48')](_0x93882c['query']['sort']);_0x307597['where']=qs[_0x3ee9('0x49')](_[_0x3ee9('0x4a')](_0x93882c[_0x3ee9('0x3e')],_0xe4d7b0[_0x3ee9('0x49')]));var _0xa74911=[];var _0x2fea85=squel[_0x3ee9('0x4b')]()['field']('id')[_0x3ee9('0x4c')](_0x3ee9('0x2d'))[_0x3ee9('0x4c')](_0x3ee9('0x4d'))[_0x3ee9('0x4e')](_0x3ee9('0x4f'));var _0x150874=squel[_0x3ee9('0x4b')]()['field']('u.id')[_0x3ee9('0x4c')](_0x3ee9('0x50'))[_0x3ee9('0x4c')](_0x3ee9('0x51'))['from'](_0x3ee9('0x52'),'ui')[_0x3ee9('0x53')](_0x3ee9('0x54'),'u','u.id\x20=\x20ui.UserId');var _0x7f7957=squel[_0x3ee9('0x4b')]()['from'](_0x3ee9('0x55'),'i')[_0x3ee9('0x53')](_0x3ee9('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x3ee9('0x53')]('users','o','o.id\x20=\x20i.UserId')[_0x3ee9('0x53')](_0x3ee9('0x57'),'a','a.id\x20=\x20i.FaxAccountId')[_0x3ee9('0x53')](_0x3ee9('0x58'),'me',_0x3ee9('0x59'))[_0x3ee9('0x53')](_0x3ee9('0x5a'),'it',_0x3ee9('0x5b'))[_0x3ee9('0x53')](_0x3ee9('0x4f'),'t','t.id\x20=\x20it.TagId');var _0x626861=squel[_0x3ee9('0x5c')]();var _0x4a277d=[];var _0x4cae1e=squel[_0x3ee9('0x5c')]();var _0x599a55;if(_0x93882c[_0x3ee9('0x3e')]['search']){_0x599a55=as[_0x3ee9('0x5d')](_0x93882c['query']['search']);var _0x565591=_0x599a55['sqlOperator'];for(var _0x2c305b=0x0;_0x2c305b<_0x599a55['conditions']['length'];_0x2c305b++){var _0x5ebd27=_0x599a55[_0x3ee9('0x5e')][_0x2c305b];var _0xa30105='i';var _0x37c9ec=_[_0x3ee9('0x5f')](_0xa16e7b,[_0x3ee9('0x2d'),_0x5ebd27[_0x3ee9('0x4c')]]);if(!_0x37c9ec){switch(_0x5ebd27[_0x3ee9('0x4c')]){case _0x3ee9('0x60'):if(_0x5ebd27['value']==0x1){_0x7f7957['having']('`'+_0x5ebd27[_0x3ee9('0x4c')]+_0x3ee9('0x61'));}else{_0x7f7957[_0x3ee9('0x62')]('`'+_0x5ebd27[_0x3ee9('0x4c')]+_0x3ee9('0x63'));}break;case _0x3ee9('0x64'):if(_0x5ebd27['operator']===_0x3ee9('0x65')){if(_0x5ebd27['value'][_0x3ee9('0x33')]('\x20')[_0x3ee9('0x43')]>0x1){_0x626861[_0x565591](_0x3ee9('0x66'),qs['getFullTextValue'](_0x5ebd27['value']),null);}else{var _0x12555a='%'+_0x5ebd27[_0x3ee9('0x67')]+'%';_0x626861[_0x565591](_0x3ee9('0x68'),_0x12555a,_0x12555a,_0x12555a);}}else{_0x37c9ec=_[_0x3ee9('0x5f')](_0xa16e7b,[_0x3ee9('0x2d'),_0x3ee9('0x69')]);_0x5ebd27[_0x3ee9('0x4c')]=_0x3ee9('0x69');_0x5ccb2a=as[_0x3ee9('0x6a')](_0xa30105,_0x37c9ec[_0x3ee9('0x3a')],_0x5ebd27);_0x626861[_0x565591](_0x5ccb2a[_0x3ee9('0x6b')],_0x5ccb2a['value']['start'],_0x5ccb2a[_0x3ee9('0x67')]['end']);}break;case _0x3ee9('0x6c'):var _0x1e2177=_0x5ebd27[_0x3ee9('0x67')][_0x3ee9('0x33')](',')[_0x3ee9('0x3d')](function(_0x3fc6cf){return Number(_0x3fc6cf);});_0x1e2177['forEach'](function(_0x2cea0c){_0x4cae1e['or'](_0x3ee9('0x6d'),'%,'+_0x2cea0c+',%');});_0x4a277d=_[_0x3ee9('0x6e')](_0x4a277d,_0x1e2177);break;case'User':if(_0x5ebd27['operator']==='$substring'){_0x626861[_0x565591](_0x3ee9('0x6f'),'%'+_0x5ebd27[_0x3ee9('0x67')]+'%',null);}else{_0x37c9ec=_[_0x3ee9('0x5f')](_0xa16e7b,[_0x3ee9('0x2d'),'UserId']);_0x5ebd27[_0x3ee9('0x4c')]=_0x3ee9('0x70');_0x5ccb2a=as[_0x3ee9('0x6a')](_0xa30105,_0x37c9ec[_0x3ee9('0x3a')],_0x5ebd27);_0x626861[_0x565591](_0x5ccb2a['text'],_0x5ccb2a[_0x3ee9('0x67')]['start'],_0x5ccb2a[_0x3ee9('0x67')][_0x3ee9('0x20')]);}break;case _0x3ee9('0x71'):_0x5ccb2a=as[_0x3ee9('0x6a')]('me',null,_0x5ebd27);_0x626861[_0x565591](_0x5ccb2a[_0x3ee9('0x6b')],_0x5ccb2a[_0x3ee9('0x67')][_0x3ee9('0x72')],_0x5ccb2a['value'][_0x3ee9('0x20')]);break;}}else{var _0x5ccb2a=as[_0x3ee9('0x6a')](_0xa30105,_0x37c9ec[_0x3ee9('0x3a')],_0x5ebd27);_0x626861[_0x565591](_0x5ccb2a['text'],_0x5ccb2a[_0x3ee9('0x67')][_0x3ee9('0x72')],_0x5ccb2a[_0x3ee9('0x67')]['end']);}}}else{var _0x1b80a1=_(_0x93882c['query'])['keys']()['map'](function(_0x454242){return _[_0x3ee9('0x73')](_0xa16e7b,[_0x3ee9('0x2d'),_0x454242])?_0x454242:undefined;})['compact']()[_0x3ee9('0x67')]();if(!_[_0x3ee9('0x74')](_0x1b80a1)){_0x1b80a1[_0x3ee9('0x34')](function(_0x3c8c8f){if(_0x3c8c8f===_0x3ee9('0x75')){_0x7f7957[_0x3ee9('0x76')](_0x3ee9('0x77'),[][_0x3ee9('0x78')](_0x93882c[_0x3ee9('0x3e')][_0x3c8c8f]));}else if(_0x3c8c8f===_0x3ee9('0x79')){var _0xd9d45d=JSON[_0x3ee9('0x7a')](_0x93882c[_0x3ee9('0x3e')][_0x3c8c8f])[_0x3ee9('0x7b')];var _0x24dbcf=JSON[_0x3ee9('0x7a')](_0x93882c[_0x3ee9('0x3e')][_0x3c8c8f])['$lte'];_0x7f7957[_0x3ee9('0x76')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xd9d45d,_0x24dbcf);}else{if(_0x93882c[_0x3ee9('0x3e')][_0x3c8c8f]==='null'){_0x7f7957[_0x3ee9('0x76')]('i.'+_0x3c8c8f+_0x3ee9('0x7c'));}else{_0x7f7957[_0x3ee9('0x76')]('i.'+_0x3c8c8f+_0x3ee9('0x7d'),_0x93882c[_0x3ee9('0x3e')][_0x3c8c8f]);}}});}if(_0x93882c[_0x3ee9('0x3e')][_0x3ee9('0x7e')]){if(_0x93882c['query'][_0x3ee9('0x7e')]==0x1){_0x7f7957['having'](_0x3ee9('0x7f'));}else{_0x7f7957[_0x3ee9('0x62')](_0x3ee9('0x80'));}}if(_0x93882c[_0x3ee9('0x3e')][_0x3ee9('0x81')]){_0x4a277d=_[_0x3ee9('0x82')](_0x93882c[_0x3ee9('0x3e')]['tag'])?_0x93882c[_0x3ee9('0x3e')][_0x3ee9('0x81')]:new Array(_0x93882c[_0x3ee9('0x3e')][_0x3ee9('0x81')]);_0x4a277d[_0x3ee9('0x34')](function(_0x4a2247){_0x4cae1e['or'](_0x3ee9('0x6d'),'%,'+_0x4a2247+',%');});}if(_0x93882c[_0x3ee9('0x3e')][_0x3ee9('0x83')]){var _0x3dbb8f=_0x93882c[_0x3ee9('0x3e')]['filter'][_0x3ee9('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x3ee9('0x85'));if(qs[_0x3ee9('0x86')](_0x3dbb8f)){_0x626861['or']('i.id\x20LIKE\x20?',_0x3dbb8f+'%')['or'](_0x3ee9('0x87'),_0x3dbb8f+'%');}_0x626861['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3dbb8f+'%');}}_0x7f7957[_0x3ee9('0x76')](_0x626861);_0x7f7957['group']('i.id');var _0x506ea5={'type':db[_0x3ee9('0x88')][_0x3ee9('0x89')][_0x3ee9('0x8a')],'raw':!![]};var _0x5e637c=_0x7f7957[_0x3ee9('0x8b')]();_0x5e637c[_0x3ee9('0x4c')](_0x3ee9('0x8c'));_0x5e637c['field'](_0x3ee9('0x8d'),_0x3ee9('0x60'));if(_0x307597['order']){_0x307597[_0x3ee9('0x47')]['forEach'](function(_0x365316){_0x7f7957[_0x3ee9('0x47')]('i.'+_0x365316[0x0],_0x365316[0x1]===_0x3ee9('0x8e')?![]:!![]);});}if(!_[_0x3ee9('0x74')](_0x4a277d)){_0x7f7957[_0x3ee9('0x62')](_0x4cae1e);_0x5e637c[_0x3ee9('0x76')](_0x3ee9('0x8f'),_0x4a277d);}BPromise['resolve']()[_0x3ee9('0x29')](function(){if(!_0x599a55){if(_0x93882c['query'][_0x3ee9('0x75')]||_0x93882c[_0x3ee9('0x3e')][_0x3ee9('0x90')])return;_0x5e637c['where'](_0x3ee9('0x91'));_0x7f7957[_0x3ee9('0x76')](_0x3ee9('0x91'));return;}return _0x93882c[_0x3ee9('0x92')][_0x3ee9('0x93')]({'attributes':['id'],'raw':!![]})[_0x3ee9('0x29')](function(_0x29125f){if(_[_0x3ee9('0x74')](_0x29125f)){_0x5e637c[_0x3ee9('0x76')](_0x3ee9('0x94'));_0x7f7957[_0x3ee9('0x76')](_0x3ee9('0x94'));}else{_0x5e637c[_0x3ee9('0x76')]('i.FaxAccountId\x20IN\x20?',_[_0x3ee9('0x3d')](_0x29125f,'id'));_0x7f7957['where'](_0x3ee9('0x77'),_[_0x3ee9('0x3d')](_0x29125f,'id'));}});})[_0x3ee9('0x29')](function(){db[_0x3ee9('0x95')][_0x3ee9('0x3e')](_0x5e637c['toString'](),_0x506ea5)[_0x3ee9('0x29')](function(_0x1ee627){_0x2b6aa4[_0x3ee9('0x22')]=_0x1ee627[_0x3ee9('0x43')];if(_0x2b6aa4[_0x3ee9('0x22')]===0x0)return[];return db['sequelize']['query'](_0x2fea85['toString'](),_0x506ea5)[_0x3ee9('0x29')](function(_0x223a8d){_0xa74911=_[_0x3ee9('0x96')](_0x223a8d,'id');_0x506ea5=_[_0x3ee9('0x97')](_0x506ea5,{'model':db[_0x3ee9('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x93882c[_0x3ee9('0x3e')][_0x3ee9('0x41')]){_0x307597[_0x3ee9('0x42')][_0x3ee9('0x34')](function(_0x27bd28){_0x7f7957['field']('i.'+_0x27bd28);});}else{_0x7f7957[_0x3ee9('0x4c')](_0x3ee9('0x8d'),_0x3ee9('0x60'));_0x7f7957[_0x3ee9('0x4c')](_0x3ee9('0x98'),'Account.key');_0x7f7957['field'](_0x3ee9('0x99'),_0x3ee9('0x9a'));_0x7f7957[_0x3ee9('0x4c')]('i.*');_0x7f7957[_0x3ee9('0x4c')](_0x3ee9('0x9b'),_0x3ee9('0x9c'));_0x7f7957[_0x3ee9('0x4c')]('c.lastName',_0x3ee9('0x9d'));_0x7f7957[_0x3ee9('0x4c')](_0x3ee9('0x9e'),_0x3ee9('0x9f'));_0x7f7957['field'](_0x3ee9('0xa0'),_0x3ee9('0xa1'));_0x7f7957[_0x3ee9('0x4c')]('c.mobile',_0x3ee9('0xa2'));_0x7f7957['field']('c.fax',_0x3ee9('0xa3'));_0x7f7957[_0x3ee9('0x4c')](_0x3ee9('0xa4'),_0x3ee9('0xa5'));_0x7f7957[_0x3ee9('0x4c')](_0x3ee9('0xa6'),_0x3ee9('0xa7'));_0x7f7957[_0x3ee9('0x4c')](_0x3ee9('0xa8'),'TagIds');}_0x7f7957[_0x3ee9('0x23')](_0x307597['limit']);_0x7f7957[_0x3ee9('0x46')](_0x307597[_0x3ee9('0x46')]);return db[_0x3ee9('0x95')][_0x3ee9('0x3e')](_0x7f7957[_0x3ee9('0xa9')](),_0x506ea5);})[_0x3ee9('0x29')](function(_0x198073){_0x150874[_0x3ee9('0x76')](_0x3ee9('0xaa'),_[_0x3ee9('0x3d')](_0x198073,'id'));return db[_0x3ee9('0x95')]['query'](_0x150874[_0x3ee9('0xa9')](),_0x506ea5)[_0x3ee9('0x29')](function(_0x922e40){var _0x26cfd5=_[_0x3ee9('0xab')](_0x922e40,_0x3ee9('0xac'));var _0x12ebdb=[];_0x198073['forEach'](function(_0x3a97ae){_0x12ebdb[_0x3ee9('0x35')](updateFaxInteraction(_0x3a97ae,_0xa74911,_0x26cfd5));});return BPromise[_0x3ee9('0xad')](_0x12ebdb);});});})[_0x3ee9('0x29')](function(_0x4f161b){_0x2b6aa4['rows']=_0x4f161b;return _0x2b6aa4;})[_0x3ee9('0x29')](respondWithFilteredResult(_0x497606,_0x307597));})[_0x3ee9('0x36')](handleError(_0x497606,null));};exports[_0x3ee9('0xae')]=function(_0xedd6f4,_0x3c6f52){var _0x4c2f5a={'raw':![],'where':{'id':_0xedd6f4[_0x3ee9('0xaf')]['id']}},_0x5e3006={};_0x5e3006[_0x3ee9('0x3c')]=_[_0x3ee9('0x3f')](db['FaxInteraction'][_0x3ee9('0x38')]);_0x5e3006['query']=_['keys'](_0xedd6f4[_0x3ee9('0x3e')]);_0x5e3006[_0x3ee9('0x49')]=_[_0x3ee9('0x40')](_0x5e3006[_0x3ee9('0x3c')],_0x5e3006[_0x3ee9('0x3e')]);_0x4c2f5a['attributes']=_[_0x3ee9('0x40')](_0x5e3006[_0x3ee9('0x3c')],qs[_0x3ee9('0x41')](_0xedd6f4['query'][_0x3ee9('0x41')]));_0x4c2f5a[_0x3ee9('0x42')]=_0x4c2f5a[_0x3ee9('0x42')][_0x3ee9('0x43')]?_0x4c2f5a[_0x3ee9('0x42')]:_0x5e3006[_0x3ee9('0x3c')];if(_0xedd6f4['query']['includeAll']){_0x4c2f5a[_0x3ee9('0xb0')]=[{'all':!![]}];}_0x4c2f5a=_['merge']({},_0x4c2f5a,_0xedd6f4[_0x3ee9('0xb1')]);return db[_0x3ee9('0x37')]['find'](_0x4c2f5a)[_0x3ee9('0x29')](handleEntityNotFound(_0x3c6f52,null))[_0x3ee9('0x29')](respondWithResult(_0x3c6f52,null))[_0x3ee9('0x36')](handleError(_0x3c6f52,null));};exports[_0x3ee9('0xb2')]=function(_0x42b2bd,_0xb2dc1a){return db[_0x3ee9('0x37')][_0x3ee9('0xb2')](_0x42b2bd[_0x3ee9('0x71')],{})['then'](respondWithResult(_0xb2dc1a,0xc9))[_0x3ee9('0x36')](handleError(_0xb2dc1a,null));};exports['update']=function(_0x4411f2,_0x41a4a3){if(_0x4411f2[_0x3ee9('0x71')]['id']){delete _0x4411f2['body']['id'];}return db[_0x3ee9('0x37')]['find']({'where':{'id':_0x4411f2[_0x3ee9('0xaf')]['id']}})[_0x3ee9('0x29')](handleEntityNotFound(_0x41a4a3,null))[_0x3ee9('0x29')](saveUpdates(_0x4411f2[_0x3ee9('0x71')],null))[_0x3ee9('0x29')](respondWithResult(_0x41a4a3,null))[_0x3ee9('0x36')](handleError(_0x41a4a3,null));};exports[_0x3ee9('0x2a')]=function(_0x2f9910,_0x37db83){return db['FaxInteraction'][_0x3ee9('0x5f')]({'where':{'id':_0x2f9910[_0x3ee9('0xaf')]['id']}})[_0x3ee9('0x29')](handleEntityNotFound(_0x37db83,null))[_0x3ee9('0x29')](removeEntity(_0x37db83,null))[_0x3ee9('0x36')](handleError(_0x37db83,null));};exports[_0x3ee9('0xb3')]=function(_0x21003c,_0x236260){return db[_0x3ee9('0x37')][_0x3ee9('0xb3')]()[_0x3ee9('0x29')](respondWithResult(_0x236260,null))['catch'](handleError(_0x236260,null));};exports[_0x3ee9('0xb4')]=function(_0x289ac3,_0xb64f1,_0x3fe812){return db[_0x3ee9('0xb5')][_0x3ee9('0x5f')]({'where':{'id':_0x289ac3[_0x3ee9('0xaf')]['id']}})['then'](handleEntityNotFound(_0xb64f1,null))['then'](function(_0x4b439b){if(_0x4b439b){return _0x4b439b[_0x3ee9('0xb4')](_0x289ac3[_0x3ee9('0x71')]['ids'],_[_0x3ee9('0xb6')](_0x289ac3['body'],[_0x3ee9('0xb7'),'id'])||{});}})[_0x3ee9('0x29')](respondWithResult(_0xb64f1,null))[_0x3ee9('0x36')](handleError(_0xb64f1,null));};exports[_0x3ee9('0xb8')]=function(_0x530145,_0x27e4ad,_0x352c28){var _0xf9933f={'raw':![],'where':{}};var _0x185481={};var _0x4d2c98={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x3ee9('0xb9')]({'where':{'id':_0x530145[_0x3ee9('0xaf')]['id']}})[_0x3ee9('0x29')](handleEntityNotFound(_0x27e4ad,null))[_0x3ee9('0x29')](function(_0x325f37){if(_0x325f37){_0x185481[_0x3ee9('0x3c')]=_[_0x3ee9('0x3f')](db[_0x3ee9('0xb5')][_0x3ee9('0x38')]);_0x185481[_0x3ee9('0x3e')]=_[_0x3ee9('0x3f')](_0x530145[_0x3ee9('0x3e')]);_0x185481[_0x3ee9('0x49')]=_['intersection'](_0x185481['model'],_0x185481['query']);_0xf9933f[_0x3ee9('0x42')]=_[_0x3ee9('0x40')](_0x185481[_0x3ee9('0x3c')],qs[_0x3ee9('0x41')](_0x530145[_0x3ee9('0x3e')][_0x3ee9('0x41')]));_0xf9933f['attributes']=_0xf9933f[_0x3ee9('0x42')][_0x3ee9('0x43')]?_0xf9933f[_0x3ee9('0x42')]:_0x185481['model'];if(!_0x530145[_0x3ee9('0x3e')]['hasOwnProperty'](_0x3ee9('0x45'))){_0xf9933f['limit']=qs[_0x3ee9('0x23')](_0x530145[_0x3ee9('0x3e')][_0x3ee9('0x23')]);_0xf9933f['offset']=qs[_0x3ee9('0x46')](_0x530145[_0x3ee9('0x3e')][_0x3ee9('0x46')]);}_0xf9933f['order']=qs[_0x3ee9('0x48')](_0x530145[_0x3ee9('0x3e')][_0x3ee9('0x48')]);_0xf9933f[_0x3ee9('0x76')]=qs[_0x3ee9('0x49')](_[_0x3ee9('0x4a')](_0x530145['query'],_0x185481[_0x3ee9('0x49')]));_0xf9933f[_0x3ee9('0x76')][_0x3ee9('0xac')]=_0x325f37['id'];if(_0x530145[_0x3ee9('0x3e')][_0x3ee9('0x83')]){_0xf9933f['where']=_[_0x3ee9('0x97')](_0xf9933f[_0x3ee9('0x76')],{'$or':_[_0x3ee9('0x3d')](_0xf9933f[_0x3ee9('0x42')],function(_0x51e6f2){var _0xda76a9={};_0xda76a9[_0x51e6f2]={'$like':'%'+_0x530145['query'][_0x3ee9('0x83')]+'%'};return _0xda76a9;})});}if(_0x530145['query'][_0x3ee9('0x7b')]){var _0x3bbfb0=_0x530145[_0x3ee9('0x3e')][_0x3ee9('0x7b')][_0x3ee9('0x33')](',');var _0x367285={};_0x367285[_0x3bbfb0[0x0]]={'$gte':moment(_0x3bbfb0[0x1])[_0x3ee9('0xba')](_0x3ee9('0xbb'))};_0xf9933f['where']=_[_0x3ee9('0x97')](_0xf9933f[_0x3ee9('0x76')],_0x367285);}_0xf9933f=_[_0x3ee9('0x97')]({},_0xf9933f,_0x530145[_0x3ee9('0xb1')]);return db[_0x3ee9('0xb5')][_0x3ee9('0x22')]({'where':_0xf9933f['where']})[_0x3ee9('0x29')](function(_0x5a5768){_0x4d2c98['count']=_0x5a5768;if(_0x530145[_0x3ee9('0x3e')]['includeAll']){_0xf9933f[_0x3ee9('0xb0')]=[{'all':!![]}];}return db[_0x3ee9('0xb5')]['findAll'](_0xf9933f);})[_0x3ee9('0x29')](function(_0x287941){_0x4d2c98[_0x3ee9('0xbc')]=_0x287941;return _0x4d2c98;});}})[_0x3ee9('0x29')](respondWithFilteredResult(_0x27e4ad,_0xf9933f))[_0x3ee9('0x36')](handleError(_0x27e4ad,null));};exports[_0x3ee9('0xbd')]=function(_0x3cdbc2,_0x622a36,_0x2c0a82){return db[_0x3ee9('0x37')][_0x3ee9('0x5f')]({'where':{'id':_0x3cdbc2[_0x3ee9('0xaf')]['id']}})['then'](handleEntityNotFound(_0x622a36,null))['then'](function(_0x454192){if(_0x454192){return _0x454192[_0x3ee9('0xbe')](_0x3cdbc2[_0x3ee9('0x71')][_0x3ee9('0xb7')],_[_0x3ee9('0xb6')](_0x3cdbc2['body'],[_0x3ee9('0xb7'),'id'])||{})['spread'](function(){return db[_0x3ee9('0x6c')][_0x3ee9('0xbf')]({'attributes':['id',_0x3ee9('0x2d'),'color'],'where':{'id':_0x3cdbc2[_0x3ee9('0x71')][_0x3ee9('0xb7')]}});})['then'](function(_0x36a062){socket[_0x3ee9('0xc0')](_0x3ee9('0xc1'),{'id':Number(_0x3cdbc2[_0x3ee9('0xaf')]['id']),'tags':_0x36a062||[]});return{'id':Number(_0x3cdbc2[_0x3ee9('0xaf')]['id']),'tags':_0x36a062||[]};});}})[_0x3ee9('0x29')](respondWithResult(_0x622a36,null))[_0x3ee9('0x36')](handleError(_0x622a36,null));};exports[_0x3ee9('0xc2')]=function(_0x767a0f,_0x18c44a,_0x3bf995){return db[_0x3ee9('0x37')][_0x3ee9('0x5f')]({'where':{'id':_0x767a0f[_0x3ee9('0xaf')]['id']}})[_0x3ee9('0x29')](handleEntityNotFound(_0x18c44a,null))[_0x3ee9('0x29')](function(_0x153125){if(_0x153125){return _0x153125['removeTags'](_0x767a0f[_0x3ee9('0x3e')]['ids']);}})[_0x3ee9('0x29')](respondWithStatusCode(_0x18c44a,null))[_0x3ee9('0x36')](handleError(_0x18c44a,null));};exports['download']=function(_0x2366b9,_0x2a6dce){var _0x22dcdb=moment()[_0x3ee9('0xc3')]()['toString']();var _0x1ae2d2=path['join'](config[_0x3ee9('0xc4')],'server',_0x3ee9('0xc5'),'tmp');var _0x38e471=path[_0x3ee9('0xc6')](config[_0x3ee9('0xc4')],_0x3ee9('0xc7'),'files',_0x3ee9('0xc8'));var _0x36c5b4=path[_0x3ee9('0xc6')](_0x1ae2d2,_0x22dcdb);var _0x56b5cf=util[_0x3ee9('0xba')](_0x3ee9('0xc9'),_0x2366b9[_0x3ee9('0xaf')]['id'],_0x22dcdb);var _0x2def18=path[_0x3ee9('0xc6')](_0x1ae2d2,_0x56b5cf);var _0x1202c3=[];_0x1202c3['push']({'model':db[_0x3ee9('0xca')],'as':_0x3ee9('0xca'),'raw':!![]});var _0x278ac7=[{'model':db[_0x3ee9('0xb5')],'as':_0x3ee9('0xcb'),'attributes':['id','body',_0x3ee9('0x79')],'include':_0x1202c3}];return db[_0x3ee9('0x37')]['find']({'where':{'id':_0x2366b9[_0x3ee9('0xaf')]['id']},'include':_0x278ac7})[_0x3ee9('0x29')](handleEntityNotFound(_0x2a6dce,null))[_0x3ee9('0x29')](function(_0x2682c5){if(_0x2682c5&&_0x2682c5[_0x3ee9('0xcb')]){var _0x4dfb37=_0x2682c5['get']({'plain':!![]});fs[_0x3ee9('0xcc')](_0x36c5b4);for(var _0x4ccd33=0x0;_0x4ccd33<_0x4dfb37[_0x3ee9('0xcb')][_0x3ee9('0x43')];_0x4ccd33++){var _0x125fe0=_0x4dfb37[_0x3ee9('0xcb')][_0x4ccd33][_0x3ee9('0xca')];if(_0x125fe0){var _0x3e2287=path['join'](_0x38e471,_0x125fe0[_0x3ee9('0xcd')]);if(fs[_0x3ee9('0xce')](_0x3e2287)){fs[_0x3ee9('0xcf')](_0x3e2287)['pipe'](fs[_0x3ee9('0xd0')](path[_0x3ee9('0xc6')](_0x36c5b4,_0x125fe0[_0x3ee9('0xcd')])));}}}return BPromise[_0x3ee9('0xd1')]()[_0x3ee9('0x29')](function(){return new BPromise(function(_0x35463f,_0x19abbe){zipdir(_0x36c5b4,{'saveTo':_0x2def18},function(_0xa12026,_0x460379){if(_0xa12026)return _0x19abbe(_0xa12026);return _0x35463f(_0x460379);});})[_0x3ee9('0x29')](function(){return new BPromise(function(_0x58b5f4,_0x2d1a59){rimraf(_0x36c5b4,function(_0x4c774a){if(_0x4c774a)_0x2d1a59(_0x4c774a);return _0x58b5f4();});});})[_0x3ee9('0x29')](function(){return _0x2a6dce[_0x3ee9('0xd2')](_0x2def18,_0x56b5cf,function(_0x30fb6a){if(_0x30fb6a){console[_0x3ee9('0xd3')](_0x3ee9('0xd4'),_0x30fb6a);}else{fs[_0x3ee9('0xd5')](_0x2def18);}});});});}else{return _0x2a6dce[_0x3ee9('0xd6')](0xc8);}})[_0x3ee9('0x36')](handleError(_0x2a6dce,null));}; \ No newline at end of file +var _0x1b85=['params','includeAll','include','create','describe','addMessage','ids','omit','getMessages','pick','format','YYYY-MM-DD\x20HH:mm:ss','options','FaxMessage','rows','setTags','spread','findAll','emit','faxInteractionTags:save','removeTags','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','download','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./faxInteraction.socket','register','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','then','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\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','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','having','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','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','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','fields','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','Contact.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','show'];(function(_0x241d9b,_0x45d294){var _0x4e5a52=function(_0x35b39d){while(--_0x35b39d){_0x241d9b['push'](_0x241d9b['shift']());}};_0x4e5a52(++_0x45d294);}(_0x1b85,0x1d3));var _0x51b8=function(_0x2c5d4e,_0x6d5975){_0x2c5d4e=_0x2c5d4e-0x0;var _0xe27290=_0x1b85[_0x2c5d4e];return _0xe27290;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x51b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x51b8('0x1'));var jsonpatch=require(_0x51b8('0x2'));var rp=require(_0x51b8('0x3'));var moment=require(_0x51b8('0x4'));var BPromise=require(_0x51b8('0x5'));var Mustache=require(_0x51b8('0x6'));var util=require(_0x51b8('0x7'));var path=require(_0x51b8('0x8'));var sox=require(_0x51b8('0x9'));var csv=require(_0x51b8('0xa'));var ejs=require(_0x51b8('0xb'));var fs=require('fs');var _=require(_0x51b8('0xc'));var squel=require(_0x51b8('0xd'));var crypto=require('crypto');var jsforce=require(_0x51b8('0xe'));var deskjs=require(_0x51b8('0xf'));var toCsv=require(_0x51b8('0xa'));var querystring=require(_0x51b8('0x10'));var Papa=require(_0x51b8('0x11'));var Redis=require(_0x51b8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x51b8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x51b8('0x14'));var logger=require(_0x51b8('0x15'))(_0x51b8('0x16'));var utils=require(_0x51b8('0x17'));var config=require(_0x51b8('0x18'));var db=require(_0x51b8('0x19'))['db'];config['redis']=_['defaults'](config[_0x51b8('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x51b8('0x1b'))(new Redis(config[_0x51b8('0x1a')]));require(_0x51b8('0x1c'))[_0x51b8('0x1d')](socket);function respondWithStatusCode(_0x589ea8,_0x575490){_0x575490=_0x575490||0xcc;return function(_0x1c84a1){if(_0x1c84a1){return _0x589ea8['sendStatus'](_0x575490);}return _0x589ea8[_0x51b8('0x1e')](_0x575490)[_0x51b8('0x1f')]();};}function respondWithResult(_0x3963c0,_0x2df933){_0x2df933=_0x2df933||0xc8;return function(_0x4d291c){if(_0x4d291c){return _0x3963c0['status'](_0x2df933)[_0x51b8('0x20')](_0x4d291c);}};}function respondWithFilteredResult(_0xf70a28,_0x3cdb4e){return function(_0x5d1622){if(_0x5d1622){var _0x5f5a7b=_0x5d1622['count'],_0x45d450=_0x3cdb4e[_0x51b8('0x21')],_0x4250a9=_0x3cdb4e['offset']+_0x3cdb4e[_0x51b8('0x22')],_0x2d3b75;if(_0x4250a9>=_0x5f5a7b){_0x4250a9=_0x5f5a7b;_0x2d3b75=0xc8;}else{_0x2d3b75=0xce;}_0xf70a28[_0x51b8('0x1e')](_0x2d3b75);return _0xf70a28[_0x51b8('0x23')](_0x51b8('0x24'),_0x45d450+'-'+_0x4250a9+'/'+_0x5f5a7b)[_0x51b8('0x20')](_0x5d1622);}return null;};}function patchUpdates(_0x353a41){return function(_0x5bc40e){try{jsonpatch[_0x51b8('0x25')](_0x5bc40e,_0x353a41,!![]);}catch(_0x5e241d){return BPromise[_0x51b8('0x26')](_0x5e241d);}return _0x5bc40e[_0x51b8('0x27')]();};}function saveUpdates(_0x54c9e4,_0x23f4ff){return function(_0x12e902){if(_0x12e902){return _0x12e902[_0x51b8('0x28')](_0x54c9e4)['then'](function(_0x336ed2){return _0x336ed2;});}return null;};}function removeEntity(_0xd38044,_0x12f234){return function(_0x21245d){if(_0x21245d){return _0x21245d[_0x51b8('0x29')]()['then'](function(){_0xd38044[_0x51b8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d1e63,_0x4940f9){return function(_0x28cfde){if(!_0x28cfde){_0x5d1e63[_0x51b8('0x2a')](0x194);}return _0x28cfde;};}function handleError(_0x315e4c,_0x2aca32){_0x2aca32=_0x2aca32||0x1f4;return function(_0x50f8ed){logger[_0x51b8('0x2b')](_0x50f8ed[_0x51b8('0x2c')]);if(_0x50f8ed[_0x51b8('0x2d')]){delete _0x50f8ed[_0x51b8('0x2d')];}_0x315e4c[_0x51b8('0x1e')](_0x2aca32)[_0x51b8('0x2e')](_0x50f8ed);};}function getInteractionUsers(_0xe55bf1,_0x462126){return new BPromise(function(_0x1dd62c,_0x195ce8){try{if(_0x462126[_0xe55bf1['id']]){_0xe55bf1[_0x51b8('0x2f')]=_[_0x51b8('0x30')](_0x462126[_0xe55bf1['id']],function(_0x1fc012){return{'id':_0x1fc012['id'],'fullname':_0x1fc012[_0x51b8('0x31')]};});}}catch(_0x2a7b05){_0x195ce8(_0x2a7b05);}_0x1dd62c(_0xe55bf1);});}function getInteractionTags(_0x1ab1bb,_0x176bbb){return new BPromise(function(_0xf865f4,_0x30eccc){try{if(_0x1ab1bb[_0x51b8('0x32')]){_0x1ab1bb['Tags']=[];_0x1ab1bb[_0x51b8('0x32')][_0x51b8('0x33')](',')[_0x51b8('0x34')](function(_0x39b530){_0x1ab1bb['Tags']['push'](_0x176bbb[_0x39b530]);});}delete _0x1ab1bb[_0x51b8('0x32')];}catch(_0x402252){_0x30eccc(_0x402252);}_0xf865f4(_0x1ab1bb);});}function updateFaxInteraction(_0x2482bd,_0x1a266d,_0x32eced){return new BPromise(function(_0x3eb8ee,_0x47ce05){return getInteractionUsers(_0x2482bd,_0x32eced)[_0x51b8('0x35')](function(_0x5ca16f){return getInteractionTags(_0x5ca16f,_0x1a266d);})['then'](function(_0x4964d3){_0x3eb8ee(_0x4964d3);})[_0x51b8('0x36')](function(_0x30d50f){_0x47ce05(_0x30d50f);});});}exports[_0x51b8('0x37')]=function(_0x3c5d2b,_0x4abeed){var _0x352eab={},_0x32ac13={},_0x2b8a4d={'count':0x0,'rows':[]};var _0x3b7bce=_[_0x51b8('0x30')](db[_0x51b8('0x38')][_0x51b8('0x39')],function(_0x27bde4){return{'name':_0x27bde4[_0x51b8('0x3a')],'type':_0x27bde4[_0x51b8('0x3b')][_0x51b8('0x3c')]};});_0x32ac13['model']=_[_0x51b8('0x30')](_0x3b7bce,_0x51b8('0x2d'));_0x32ac13[_0x51b8('0x3d')]=_[_0x51b8('0x3e')](_0x3c5d2b[_0x51b8('0x3d')]);_0x32ac13[_0x51b8('0x3f')]=_[_0x51b8('0x40')](_0x32ac13[_0x51b8('0x41')],_0x32ac13[_0x51b8('0x3d')]);_0x352eab[_0x51b8('0x42')]=_[_0x51b8('0x40')](_0x32ac13[_0x51b8('0x41')],qs['fields'](_0x3c5d2b[_0x51b8('0x3d')]['fields']));_0x352eab[_0x51b8('0x42')]=_0x352eab[_0x51b8('0x42')][_0x51b8('0x43')]?_0x352eab[_0x51b8('0x42')]:_0x32ac13[_0x51b8('0x41')];if(!_0x3c5d2b[_0x51b8('0x3d')][_0x51b8('0x44')](_0x51b8('0x45'))){_0x352eab[_0x51b8('0x22')]=qs['limit'](_0x3c5d2b[_0x51b8('0x3d')][_0x51b8('0x22')]);_0x352eab[_0x51b8('0x21')]=qs[_0x51b8('0x21')](_0x3c5d2b[_0x51b8('0x3d')][_0x51b8('0x21')]);}_0x352eab['order']=qs[_0x51b8('0x46')](_0x3c5d2b[_0x51b8('0x3d')]['sort']);_0x352eab[_0x51b8('0x47')]=qs['filters'](_['pick'](_0x3c5d2b[_0x51b8('0x3d')],_0x32ac13[_0x51b8('0x3f')]));var _0x5b5439=[];var _0x31ed58=squel[_0x51b8('0x48')]()['field']('id')[_0x51b8('0x49')](_0x51b8('0x2d'))[_0x51b8('0x49')](_0x51b8('0x4a'))[_0x51b8('0x4b')](_0x51b8('0x4c'));var _0x473f27=squel['select']()[_0x51b8('0x49')](_0x51b8('0x4d'))[_0x51b8('0x49')](_0x51b8('0x4e'))[_0x51b8('0x49')](_0x51b8('0x4f'))[_0x51b8('0x4b')](_0x51b8('0x50'),'ui')[_0x51b8('0x51')]('users','u',_0x51b8('0x52'));var _0x1b2da1=squel[_0x51b8('0x48')]()[_0x51b8('0x4b')](_0x51b8('0x53'),'i')[_0x51b8('0x51')]('cm_contacts','c',_0x51b8('0x54'))[_0x51b8('0x51')]('users','o',_0x51b8('0x55'))[_0x51b8('0x51')]('fax_accounts','a',_0x51b8('0x56'))[_0x51b8('0x51')](_0x51b8('0x57'),'me',_0x51b8('0x58'))['left_join'](_0x51b8('0x59'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x51b8('0x51')](_0x51b8('0x4c'),'t',_0x51b8('0x5a'));var _0x4644a3=squel[_0x51b8('0x5b')]();var _0x4cfce0=[];var _0x44473f=squel[_0x51b8('0x5b')]();var _0x763dbb;if(_0x3c5d2b[_0x51b8('0x3d')][_0x51b8('0x5c')]){_0x763dbb=as[_0x51b8('0x5d')](_0x3c5d2b[_0x51b8('0x3d')][_0x51b8('0x5c')]);var _0x54d004=_0x763dbb[_0x51b8('0x5e')];for(var _0x7ba5b3=0x0;_0x7ba5b3<_0x763dbb[_0x51b8('0x5f')][_0x51b8('0x43')];_0x7ba5b3++){var _0x108ba2=_0x763dbb[_0x51b8('0x5f')][_0x7ba5b3];var _0x1cfb72='i';var _0x4a480c=_[_0x51b8('0x60')](_0x3b7bce,[_0x51b8('0x2d'),_0x108ba2[_0x51b8('0x49')]]);if(!_0x4a480c){switch(_0x108ba2['field']){case _0x51b8('0x61'):if(_0x108ba2[_0x51b8('0x62')]==0x1){_0x1b2da1['having']('`'+_0x108ba2[_0x51b8('0x49')]+_0x51b8('0x63'));}else{_0x1b2da1['having']('`'+_0x108ba2['field']+_0x51b8('0x64'));}break;case _0x51b8('0x65'):if(_0x108ba2['operator']===_0x51b8('0x66')){if(_0x108ba2[_0x51b8('0x62')][_0x51b8('0x33')]('\x20')[_0x51b8('0x43')]>0x1){_0x4644a3[_0x54d004](_0x51b8('0x67'),qs[_0x51b8('0x68')](_0x108ba2[_0x51b8('0x62')]),null);}else{var _0x3a6514='%'+_0x108ba2[_0x51b8('0x62')]+'%';_0x4644a3[_0x54d004](_0x51b8('0x69'),_0x3a6514,_0x3a6514,_0x3a6514);}}else{_0x4a480c=_[_0x51b8('0x60')](_0x3b7bce,[_0x51b8('0x2d'),_0x51b8('0x6a')]);_0x108ba2[_0x51b8('0x49')]=_0x51b8('0x6a');_0x5696c7=as[_0x51b8('0x6b')](_0x1cfb72,_0x4a480c[_0x51b8('0x3b')],_0x108ba2);_0x4644a3[_0x54d004](_0x5696c7[_0x51b8('0x6c')],_0x5696c7[_0x51b8('0x62')][_0x51b8('0x6d')],_0x5696c7[_0x51b8('0x62')][_0x51b8('0x1f')]);}break;case _0x51b8('0x6e'):var _0x4dfeb1=_0x108ba2[_0x51b8('0x62')]['split'](',')[_0x51b8('0x30')](function(_0x3c5892){return Number(_0x3c5892);});_0x4dfeb1[_0x51b8('0x34')](function(_0x263211){_0x44473f['or'](_0x51b8('0x6f'),'%,'+_0x263211+',%');});_0x4cfce0=_[_0x51b8('0x70')](_0x4cfce0,_0x4dfeb1);break;case'User':if(_0x108ba2[_0x51b8('0x71')]===_0x51b8('0x66')){_0x4644a3[_0x54d004](_0x51b8('0x72'),'%'+_0x108ba2[_0x51b8('0x62')]+'%',null);}else{_0x4a480c=_['find'](_0x3b7bce,[_0x51b8('0x2d'),_0x51b8('0x73')]);_0x108ba2[_0x51b8('0x49')]='UserId';_0x5696c7=as[_0x51b8('0x6b')](_0x1cfb72,_0x4a480c[_0x51b8('0x3b')],_0x108ba2);_0x4644a3[_0x54d004](_0x5696c7[_0x51b8('0x6c')],_0x5696c7[_0x51b8('0x62')][_0x51b8('0x6d')],_0x5696c7['value'][_0x51b8('0x1f')]);}break;case _0x51b8('0x74'):_0x5696c7=as[_0x51b8('0x6b')]('me',null,_0x108ba2);_0x4644a3[_0x54d004](_0x5696c7[_0x51b8('0x6c')],_0x5696c7['value'][_0x51b8('0x6d')],_0x5696c7[_0x51b8('0x62')][_0x51b8('0x1f')]);break;}}else{var _0x5696c7=as['buildExpression'](_0x1cfb72,_0x4a480c[_0x51b8('0x3b')],_0x108ba2);_0x4644a3[_0x54d004](_0x5696c7[_0x51b8('0x6c')],_0x5696c7[_0x51b8('0x62')]['start'],_0x5696c7[_0x51b8('0x62')][_0x51b8('0x1f')]);}}}else{var _0xb72f99=_(_0x3c5d2b[_0x51b8('0x3d')])[_0x51b8('0x3e')]()[_0x51b8('0x30')](function(_0x4aef48){return _[_0x51b8('0x75')](_0x3b7bce,[_0x51b8('0x2d'),_0x4aef48])?_0x4aef48:undefined;})['compact']()['value']();if(!_['isEmpty'](_0xb72f99)){_0xb72f99['forEach'](function(_0x37c39d){if(_0x37c39d===_0x51b8('0x76')){_0x1b2da1['where'](_0x51b8('0x77'),[][_0x51b8('0x78')](_0x3c5d2b[_0x51b8('0x3d')][_0x37c39d]));}else if(_0x37c39d===_0x51b8('0x79')){var _0x307613=JSON[_0x51b8('0x7a')](_0x3c5d2b[_0x51b8('0x3d')][_0x37c39d])[_0x51b8('0x7b')];var _0x9a140=JSON[_0x51b8('0x7a')](_0x3c5d2b[_0x51b8('0x3d')][_0x37c39d])[_0x51b8('0x7c')];_0x1b2da1[_0x51b8('0x47')](_0x51b8('0x7d'),_0x307613,_0x9a140);}else{if(_0x3c5d2b[_0x51b8('0x3d')][_0x37c39d]==='null'){_0x1b2da1[_0x51b8('0x47')]('i.'+_0x37c39d+_0x51b8('0x7e'));}else{_0x1b2da1['where']('i.'+_0x37c39d+'\x20=\x20?',_0x3c5d2b[_0x51b8('0x3d')][_0x37c39d]);}}});}if(_0x3c5d2b[_0x51b8('0x3d')]['read']){if(_0x3c5d2b['query'][_0x51b8('0x7f')]==0x1){_0x1b2da1['having']('`unreadMessages`\x20=\x200');}else{_0x1b2da1[_0x51b8('0x80')]('`unreadMessages`\x20>\x200');}}if(_0x3c5d2b[_0x51b8('0x3d')]['tag']){_0x4cfce0=_['isArray'](_0x3c5d2b[_0x51b8('0x3d')]['tag'])?_0x3c5d2b[_0x51b8('0x3d')][_0x51b8('0x81')]:new Array(_0x3c5d2b['query'][_0x51b8('0x81')]);_0x4cfce0[_0x51b8('0x34')](function(_0x4bfcd3){_0x44473f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4bfcd3+',%');});}if(_0x3c5d2b[_0x51b8('0x3d')]['filter']){var _0xc98c8e=_0x3c5d2b['query'][_0x51b8('0x82')][_0x51b8('0x83')]('\x5c','\x5c\x5c')[_0x51b8('0x83')]('\x27\x27',_0x51b8('0x84'));if(qs[_0x51b8('0x85')](_0xc98c8e)){_0x4644a3['or'](_0x51b8('0x86'),_0xc98c8e+'%')['or']('i.fax\x20LIKE\x20?',_0xc98c8e+'%');}_0x4644a3['or'](_0x51b8('0x87'),_0xc98c8e+'%');}}_0x1b2da1[_0x51b8('0x47')](_0x4644a3);_0x1b2da1[_0x51b8('0x88')](_0x51b8('0x89'));var _0x37d51f={'type':db[_0x51b8('0x8a')][_0x51b8('0x8b')]['SELECT'],'raw':!![]};var _0x31a408=_0x1b2da1[_0x51b8('0x8c')]();_0x31a408[_0x51b8('0x49')](_0x51b8('0x89'));_0x31a408['field'](_0x51b8('0x8d'),_0x51b8('0x61'));if(_0x352eab[_0x51b8('0x8e')]){_0x352eab[_0x51b8('0x8e')][_0x51b8('0x34')](function(_0x25e9b2){_0x1b2da1[_0x51b8('0x8e')]('i.'+_0x25e9b2[0x0],_0x25e9b2[0x1]===_0x51b8('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x4cfce0)){_0x1b2da1[_0x51b8('0x80')](_0x44473f);_0x31a408[_0x51b8('0x47')](_0x51b8('0x90'),_0x4cfce0);}BPromise[_0x51b8('0x91')]()[_0x51b8('0x35')](function(){if(!_0x763dbb){if(_0x3c5d2b[_0x51b8('0x3d')][_0x51b8('0x76')]||_0x3c5d2b[_0x51b8('0x3d')][_0x51b8('0x92')])return;_0x31a408[_0x51b8('0x47')](_0x51b8('0x93'));_0x1b2da1[_0x51b8('0x47')](_0x51b8('0x93'));return;}return _0x3c5d2b[_0x51b8('0x94')][_0x51b8('0x95')]({'attributes':['id'],'raw':!![]})[_0x51b8('0x35')](function(_0x228efc){if(_[_0x51b8('0x96')](_0x228efc)){_0x31a408[_0x51b8('0x47')](_0x51b8('0x97'));_0x1b2da1['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x31a408[_0x51b8('0x47')](_0x51b8('0x77'),_[_0x51b8('0x30')](_0x228efc,'id'));_0x1b2da1[_0x51b8('0x47')](_0x51b8('0x77'),_['map'](_0x228efc,'id'));}});})[_0x51b8('0x35')](function(){db[_0x51b8('0x98')]['query'](_0x31a408[_0x51b8('0x99')](),_0x37d51f)['then'](function(_0x4921f9){_0x2b8a4d[_0x51b8('0x9a')]=_0x4921f9[_0x51b8('0x43')];if(_0x2b8a4d[_0x51b8('0x9a')]===0x0)return[];return db[_0x51b8('0x98')][_0x51b8('0x3d')](_0x31ed58['toString'](),_0x37d51f)[_0x51b8('0x35')](function(_0x282eab){_0x5b5439=_[_0x51b8('0x9b')](_0x282eab,'id');_0x37d51f=_[_0x51b8('0x9c')](_0x37d51f,{'model':db[_0x51b8('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3c5d2b[_0x51b8('0x3d')][_0x51b8('0x9d')]){_0x352eab['attributes'][_0x51b8('0x34')](function(_0x5e0bb6){_0x1b2da1[_0x51b8('0x49')]('i.'+_0x5e0bb6);});}else{_0x1b2da1[_0x51b8('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x51b8('0x61'));_0x1b2da1[_0x51b8('0x49')](_0x51b8('0x9e'),'Account.key');_0x1b2da1[_0x51b8('0x49')](_0x51b8('0x9f'),_0x51b8('0xa0'));_0x1b2da1['field'](_0x51b8('0xa1'));_0x1b2da1[_0x51b8('0x49')](_0x51b8('0xa2'),_0x51b8('0xa3'));_0x1b2da1['field'](_0x51b8('0xa4'),'Contact.lastName');_0x1b2da1[_0x51b8('0x49')](_0x51b8('0xa5'),'Contact.email');_0x1b2da1[_0x51b8('0x49')](_0x51b8('0xa6'),_0x51b8('0xa7'));_0x1b2da1[_0x51b8('0x49')]('c.mobile','Contact.mobile');_0x1b2da1[_0x51b8('0x49')]('c.fax',_0x51b8('0xa8'));_0x1b2da1[_0x51b8('0x49')]('o.fullname','Owner.fullname');_0x1b2da1[_0x51b8('0x49')](_0x51b8('0xa9'),'Owner.internal');_0x1b2da1[_0x51b8('0x49')](_0x51b8('0xaa'),_0x51b8('0x32'));}_0x1b2da1[_0x51b8('0x22')](_0x352eab['limit']);_0x1b2da1[_0x51b8('0x21')](_0x352eab['offset']);return db['sequelize'][_0x51b8('0x3d')](_0x1b2da1[_0x51b8('0x99')](),_0x37d51f);})[_0x51b8('0x35')](function(_0x206861){_0x473f27['where']('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x206861,'id'));return db[_0x51b8('0x98')][_0x51b8('0x3d')](_0x473f27['toString'](),_0x37d51f)[_0x51b8('0x35')](function(_0x232c3e){var _0x2ff2b8=_[_0x51b8('0xab')](_0x232c3e,_0x51b8('0xac'));var _0x588cda=[];_0x206861[_0x51b8('0x34')](function(_0x1ede08){_0x588cda['push'](updateFaxInteraction(_0x1ede08,_0x5b5439,_0x2ff2b8));});return BPromise[_0x51b8('0xad')](_0x588cda);});});})[_0x51b8('0x35')](function(_0x18691a){_0x2b8a4d['rows']=_0x18691a;return _0x2b8a4d;})[_0x51b8('0x35')](respondWithFilteredResult(_0x4abeed,_0x352eab));})[_0x51b8('0x36')](handleError(_0x4abeed,null));};exports[_0x51b8('0xae')]=function(_0x9cc820,_0x579783){var _0x4dad55={'raw':![],'where':{'id':_0x9cc820[_0x51b8('0xaf')]['id']}},_0x560933={};_0x560933[_0x51b8('0x41')]=_[_0x51b8('0x3e')](db[_0x51b8('0x38')][_0x51b8('0x39')]);_0x560933[_0x51b8('0x3d')]=_['keys'](_0x9cc820[_0x51b8('0x3d')]);_0x560933[_0x51b8('0x3f')]=_[_0x51b8('0x40')](_0x560933['model'],_0x560933[_0x51b8('0x3d')]);_0x4dad55[_0x51b8('0x42')]=_[_0x51b8('0x40')](_0x560933[_0x51b8('0x41')],qs[_0x51b8('0x9d')](_0x9cc820[_0x51b8('0x3d')][_0x51b8('0x9d')]));_0x4dad55[_0x51b8('0x42')]=_0x4dad55['attributes'][_0x51b8('0x43')]?_0x4dad55[_0x51b8('0x42')]:_0x560933[_0x51b8('0x41')];if(_0x9cc820['query'][_0x51b8('0xb0')]){_0x4dad55[_0x51b8('0xb1')]=[{'all':!![]}];}_0x4dad55=_[_0x51b8('0x9c')]({},_0x4dad55,_0x9cc820['options']);return db[_0x51b8('0x38')][_0x51b8('0x60')](_0x4dad55)['then'](handleEntityNotFound(_0x579783,null))['then'](respondWithResult(_0x579783,null))[_0x51b8('0x36')](handleError(_0x579783,null));};exports[_0x51b8('0xb2')]=function(_0x27233d,_0x5a460c){return db['FaxInteraction'][_0x51b8('0xb2')](_0x27233d[_0x51b8('0x74')],{})[_0x51b8('0x35')](respondWithResult(_0x5a460c,0xc9))[_0x51b8('0x36')](handleError(_0x5a460c,null));};exports['update']=function(_0x441166,_0x3a277a){if(_0x441166[_0x51b8('0x74')]['id']){delete _0x441166[_0x51b8('0x74')]['id'];}return db['FaxInteraction'][_0x51b8('0x60')]({'where':{'id':_0x441166[_0x51b8('0xaf')]['id']}})['then'](handleEntityNotFound(_0x3a277a,null))[_0x51b8('0x35')](saveUpdates(_0x441166['body'],null))[_0x51b8('0x35')](respondWithResult(_0x3a277a,null))[_0x51b8('0x36')](handleError(_0x3a277a,null));};exports[_0x51b8('0x29')]=function(_0x40780d,_0x3e31a3){return db[_0x51b8('0x38')]['find']({'where':{'id':_0x40780d[_0x51b8('0xaf')]['id']}})[_0x51b8('0x35')](handleEntityNotFound(_0x3e31a3,null))[_0x51b8('0x35')](removeEntity(_0x3e31a3,null))[_0x51b8('0x36')](handleError(_0x3e31a3,null));};exports[_0x51b8('0xb3')]=function(_0x155754,_0x56b8d9){return db[_0x51b8('0x38')][_0x51b8('0xb3')]()[_0x51b8('0x35')](respondWithResult(_0x56b8d9,null))['catch'](handleError(_0x56b8d9,null));};exports[_0x51b8('0xb4')]=function(_0x523ca4,_0x11792,_0x214164){return db['FaxMessage'][_0x51b8('0x60')]({'where':{'id':_0x523ca4[_0x51b8('0xaf')]['id']}})[_0x51b8('0x35')](handleEntityNotFound(_0x11792,null))['then'](function(_0x27945c){if(_0x27945c){return _0x27945c['addMessage'](_0x523ca4[_0x51b8('0x74')][_0x51b8('0xb5')],_[_0x51b8('0xb6')](_0x523ca4[_0x51b8('0x74')],[_0x51b8('0xb5'),'id'])||{});}})[_0x51b8('0x35')](respondWithResult(_0x11792,null))[_0x51b8('0x36')](handleError(_0x11792,null));};exports[_0x51b8('0xb7')]=function(_0x2384d5,_0x34a41b,_0x51f12b){var _0x13d165={'raw':![],'where':{}};var _0x1cba45={};var _0x53e054={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x2384d5['params']['id']}})[_0x51b8('0x35')](handleEntityNotFound(_0x34a41b,null))[_0x51b8('0x35')](function(_0xcc4fd){if(_0xcc4fd){_0x1cba45[_0x51b8('0x41')]=_[_0x51b8('0x3e')](db['FaxMessage'][_0x51b8('0x39')]);_0x1cba45['query']=_[_0x51b8('0x3e')](_0x2384d5[_0x51b8('0x3d')]);_0x1cba45['filters']=_[_0x51b8('0x40')](_0x1cba45[_0x51b8('0x41')],_0x1cba45['query']);_0x13d165[_0x51b8('0x42')]=_[_0x51b8('0x40')](_0x1cba45['model'],qs[_0x51b8('0x9d')](_0x2384d5[_0x51b8('0x3d')]['fields']));_0x13d165[_0x51b8('0x42')]=_0x13d165[_0x51b8('0x42')]['length']?_0x13d165['attributes']:_0x1cba45[_0x51b8('0x41')];if(!_0x2384d5['query'][_0x51b8('0x44')]('nolimit')){_0x13d165[_0x51b8('0x22')]=qs[_0x51b8('0x22')](_0x2384d5[_0x51b8('0x3d')][_0x51b8('0x22')]);_0x13d165[_0x51b8('0x21')]=qs['offset'](_0x2384d5[_0x51b8('0x3d')]['offset']);}_0x13d165[_0x51b8('0x8e')]=qs['sort'](_0x2384d5[_0x51b8('0x3d')][_0x51b8('0x46')]);_0x13d165[_0x51b8('0x47')]=qs[_0x51b8('0x3f')](_[_0x51b8('0xb8')](_0x2384d5[_0x51b8('0x3d')],_0x1cba45[_0x51b8('0x3f')]));_0x13d165[_0x51b8('0x47')]['FaxInteractionId']=_0xcc4fd['id'];if(_0x2384d5[_0x51b8('0x3d')][_0x51b8('0x82')]){_0x13d165[_0x51b8('0x47')]=_[_0x51b8('0x9c')](_0x13d165[_0x51b8('0x47')],{'$or':_['map'](_0x13d165[_0x51b8('0x42')],function(_0x3fe028){var _0x4be7d2={};_0x4be7d2[_0x3fe028]={'$like':'%'+_0x2384d5['query'][_0x51b8('0x82')]+'%'};return _0x4be7d2;})});}if(_0x2384d5[_0x51b8('0x3d')][_0x51b8('0x7b')]){var _0xf17bba=_0x2384d5[_0x51b8('0x3d')][_0x51b8('0x7b')]['split'](',');var _0x1616cb={};_0x1616cb[_0xf17bba[0x0]]={'$gte':moment(_0xf17bba[0x1])[_0x51b8('0xb9')](_0x51b8('0xba'))};_0x13d165[_0x51b8('0x47')]=_[_0x51b8('0x9c')](_0x13d165['where'],_0x1616cb);}_0x13d165=_[_0x51b8('0x9c')]({},_0x13d165,_0x2384d5[_0x51b8('0xbb')]);return db[_0x51b8('0xbc')][_0x51b8('0x9a')]({'where':_0x13d165[_0x51b8('0x47')]})['then'](function(_0x2d398b){_0x53e054[_0x51b8('0x9a')]=_0x2d398b;if(_0x2384d5[_0x51b8('0x3d')]['includeAll']){_0x13d165[_0x51b8('0xb1')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x13d165);})[_0x51b8('0x35')](function(_0x1615eb){_0x53e054[_0x51b8('0xbd')]=_0x1615eb;return _0x53e054;});}})[_0x51b8('0x35')](respondWithFilteredResult(_0x34a41b,_0x13d165))[_0x51b8('0x36')](handleError(_0x34a41b,null));};exports['addTags']=function(_0x5723b7,_0x473f1d,_0x1f1b02){return db[_0x51b8('0x38')][_0x51b8('0x60')]({'where':{'id':_0x5723b7[_0x51b8('0xaf')]['id']}})[_0x51b8('0x35')](handleEntityNotFound(_0x473f1d,null))[_0x51b8('0x35')](function(_0x4d0e84){if(_0x4d0e84){return _0x4d0e84[_0x51b8('0xbe')](_0x5723b7[_0x51b8('0x74')][_0x51b8('0xb5')],_['omit'](_0x5723b7[_0x51b8('0x74')],['ids','id'])||{})[_0x51b8('0xbf')](function(){return db[_0x51b8('0x6e')][_0x51b8('0xc0')]({'attributes':['id',_0x51b8('0x2d'),'color'],'where':{'id':_0x5723b7['body'][_0x51b8('0xb5')]}});})[_0x51b8('0x35')](function(_0x3dfae3){socket[_0x51b8('0xc1')](_0x51b8('0xc2'),{'id':Number(_0x5723b7[_0x51b8('0xaf')]['id']),'tags':_0x3dfae3||[]});return{'id':Number(_0x5723b7[_0x51b8('0xaf')]['id']),'tags':_0x3dfae3||[]};});}})[_0x51b8('0x35')](respondWithResult(_0x473f1d,null))['catch'](handleError(_0x473f1d,null));};exports[_0x51b8('0xc3')]=function(_0x263c1f,_0xad7b50,_0x36d5a5){return db['FaxInteraction'][_0x51b8('0x60')]({'where':{'id':_0x263c1f['params']['id']}})[_0x51b8('0x35')](handleEntityNotFound(_0xad7b50,null))[_0x51b8('0x35')](function(_0x273c9c){if(_0x273c9c){return _0x273c9c['removeTags'](_0x263c1f[_0x51b8('0x3d')][_0x51b8('0xb5')]);}})[_0x51b8('0x35')](respondWithStatusCode(_0xad7b50,null))[_0x51b8('0x36')](handleError(_0xad7b50,null));};exports['download']=function(_0x22c9eb,_0x22553f){var _0x13b576=moment()['unix']()[_0x51b8('0x99')]();var _0x9e6e96=path[_0x51b8('0xc4')](config[_0x51b8('0xc5')],_0x51b8('0xc6'),'files','tmp');var _0x43ad01=path[_0x51b8('0xc4')](config[_0x51b8('0xc5')],_0x51b8('0xc6'),_0x51b8('0xc7'),_0x51b8('0xc8'));var _0x23672c=path[_0x51b8('0xc4')](_0x9e6e96,_0x13b576);var _0x17f5b2=util[_0x51b8('0xb9')](_0x51b8('0xc9'),_0x22c9eb[_0x51b8('0xaf')]['id'],_0x13b576);var _0x1ac1e1=path[_0x51b8('0xc4')](_0x9e6e96,_0x17f5b2);var _0x5c4234=[];_0x5c4234['push']({'model':db['Attachment'],'as':_0x51b8('0xca'),'raw':!![]});var _0x158e7e=[{'model':db[_0x51b8('0xbc')],'as':_0x51b8('0xcb'),'attributes':['id',_0x51b8('0x74'),_0x51b8('0x79')],'include':_0x5c4234}];return db[_0x51b8('0x38')][_0x51b8('0x60')]({'where':{'id':_0x22c9eb['params']['id']},'include':_0x158e7e})[_0x51b8('0x35')](handleEntityNotFound(_0x22553f,null))[_0x51b8('0x35')](function(_0x2fdee3){if(_0x2fdee3&&_0x2fdee3[_0x51b8('0xcb')]){var _0x5dd1ff=_0x2fdee3['get']({'plain':!![]});fs[_0x51b8('0xcc')](_0x23672c);for(var _0x225acc=0x0;_0x225acc<_0x5dd1ff['Messages'][_0x51b8('0x43')];_0x225acc++){var _0x4eebd6=_0x5dd1ff['Messages'][_0x225acc][_0x51b8('0xca')];if(_0x4eebd6){var _0x30e3e6=path[_0x51b8('0xc4')](_0x43ad01,_0x4eebd6[_0x51b8('0xcd')]);if(fs[_0x51b8('0xce')](_0x30e3e6)){fs[_0x51b8('0xcf')](_0x30e3e6)[_0x51b8('0xd0')](fs[_0x51b8('0xd1')](path['join'](_0x23672c,_0x4eebd6[_0x51b8('0xcd')])));}}}return BPromise[_0x51b8('0x91')]()['then'](function(){return new BPromise(function(_0x2fbf30,_0x51b1c9){zipdir(_0x23672c,{'saveTo':_0x1ac1e1},function(_0x37731f,_0x2785e3){if(_0x37731f)return _0x51b1c9(_0x37731f);return _0x2fbf30(_0x2785e3);});})['then'](function(){return new BPromise(function(_0x99d7cc,_0x14eeab){rimraf(_0x23672c,function(_0x4ee571){if(_0x4ee571)_0x14eeab(_0x4ee571);return _0x99d7cc();});});})[_0x51b8('0x35')](function(){return _0x22553f[_0x51b8('0xd2')](_0x1ac1e1,_0x17f5b2,function(_0x37b8a4){if(_0x37b8a4){console[_0x51b8('0xd3')](_0x51b8('0xd4'),_0x37b8a4);}else{fs[_0x51b8('0xd5')](_0x1ac1e1);}});});});}else{return _0x22553f[_0x51b8('0x2a')](0xc8);}})[_0x51b8('0x36')](handleError(_0x22553f,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 4b06859..c004113 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','getUsers','then','setDataValue','findAll'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc4aa[_0x8c43de];return _0xa6591b;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var FaxInteraction=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var FaxMessage=require(_0xac4a('0x1'))['db'][_0xac4a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xac4a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f48ed){return function(_0x15b967,_0x730a38,_0x215f39){_0x15b967[_0xac4a('0x5')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x6')](function(_0x3ef77c){_0x15b967[_0xac4a('0x7')]('Users',_0x3ef77c['map'](function(_0x1aba6d){return{'id':_0x1aba6d['id']};}));return FaxMessage[_0xac4a('0x8')]({'where':{'FaxInteractionId':_0x15b967['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac4a('0x6')](function(_0x4f4146){_0x15b967[_0xac4a('0x7')](_0xac4a('0x9'),_0x4f4146[_0xac4a('0xa')]);FaxInteractionEvents['emit'](_0x2f48ed+':'+_0x15b967['id'],_0x15b967);FaxInteractionEvents[_0xac4a('0xb')](_0x2f48ed,_0x15b967);_0x215f39(null);})['catch'](_0x215f39(null));};}for(var e in events){if(events[_0xac4a('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xac4a('0xd')]=FaxInteractionEvents; \ No newline at end of file +var _0x2ef3=['remove','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2ef3,0xba));var _0x32ef=function(_0x3bf034,_0x437f8c){_0x3bf034=_0x3bf034-0x0;var _0x25ab8b=_0x2ef3[_0x3bf034];return _0x25ab8b;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var FaxInteraction=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var FaxMessage=require(_0x32ef('0x1'))['db'][_0x32ef('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x32ef('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x32ef('0x5'),'afterDestroy':_0x32ef('0x6')};function emitEvent(_0x524ab6){return function(_0x402857,_0x37dd1d,_0x4c8104){_0x402857['getUsers']({'attributes':['id'],'raw':!![]})[_0x32ef('0x7')](function(_0x4bfcf8){_0x402857[_0x32ef('0x8')](_0x32ef('0x9'),_0x4bfcf8[_0x32ef('0xa')](function(_0x298066){return{'id':_0x298066['id']};}));return FaxMessage[_0x32ef('0xb')]({'where':{'FaxInteractionId':_0x402857['id'],'direction':'in','read':![]},'raw':!![]});})[_0x32ef('0x7')](function(_0x28275c){_0x402857[_0x32ef('0x8')]('unreadMessages',_0x28275c['length']);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6+':'+_0x402857['id'],_0x402857);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6,_0x402857);_0x4c8104(null);})[_0x32ef('0xd')](_0x4c8104(null));};}for(var e in events){if(events[_0x32ef('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x32ef('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index bb8676b..138a322 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 _0x5d88=['rimraf','../../config/environment','./faxInteraction.attributes','exports','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x268d93,_0xd653f6){var _0x149c82=function(_0xe32f74){while(--_0xe32f74){_0x268d93['push'](_0x268d93['shift']());}};_0x149c82(++_0xd653f6);}(_0x5d88,0xc5));var _0x85d8=function(_0x1795f8,_0x27fe71){_0x1795f8=_0x1795f8-0x0;var _0x3bed40=_0x5d88[_0x1795f8];return _0x3bed40;};'use strict';var _=require(_0x85d8('0x0'));var util=require(_0x85d8('0x1'));var logger=require(_0x85d8('0x2'))(_0x85d8('0x3'));var moment=require(_0x85d8('0x4'));var BPromise=require(_0x85d8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x85d8('0x6'));var rimraf=require(_0x85d8('0x7'));var config=require(_0x85d8('0x8'));var attributes=require(_0x85d8('0x9'));module[_0x85d8('0xa')]=function(_0x5f514c,_0x4f70fc){return _0x5f514c[_0x85d8('0xb')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d1c10,_0x511787,_0x1db94e){if(_0x1d1c10[_0x85d8('0xc')](_0x85d8('0xd'))){_0x1d1c10[_0x85d8('0xe')]=moment()[_0x85d8('0xf')](_0x85d8('0x10'));}_0x1db94e(null,_0x1d1c10);}}});}; \ No newline at end of file +var _0x33f7=['YYYY-MM-DD\x20HH:mm:ss','util','api','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','changed','closed','closedAt'];(function(_0x3b8f2e,_0x5a99a8){var _0x1433d5=function(_0x5e0353){while(--_0x5e0353){_0x3b8f2e['push'](_0x3b8f2e['shift']());}};_0x1433d5(++_0x5a99a8);}(_0x33f7,0x139));var _0x733f=function(_0x1417c6,_0x194309){_0x1417c6=_0x1417c6-0x0;var _0x44db97=_0x33f7[_0x1417c6];return _0x44db97;};'use strict';var _=require('lodash');var util=require(_0x733f('0x0'));var logger=require('../../config/logger')(_0x733f('0x1'));var moment=require('moment');var BPromise=require(_0x733f('0x2'));var rp=require(_0x733f('0x3'));var fs=require('fs');var path=require(_0x733f('0x4'));var rimraf=require('rimraf');var config=require(_0x733f('0x5'));var attributes=require(_0x733f('0x6'));module[_0x733f('0x7')]=function(_0x27e051,_0x5aa8bd){return _0x27e051['define']('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27418e,_0x2d1ba0,_0x13746c){if(_0x27418e[_0x733f('0x8')](_0x733f('0x9'))){_0x27418e[_0x733f('0xa')]=moment()['format'](_0x733f('0xb'));}_0x13746c(null,_0x27418e);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index cf68ff9..15dfedf 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 _0xd1d2=['ids','omit','body','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','update','options','raw','where','attributes','limit','then','info','FaxInteraction','find','addTags'];(function(_0x13930a,_0x1b39ae){var _0x39b27e=function(_0x2cbd28){while(--_0x2cbd28){_0x13930a['push'](_0x13930a['shift']());}};_0x39b27e(++_0x1b39ae);}(_0xd1d2,0x11d));var _0x2d1d=function(_0x4dedd3,_0x175841){_0x4dedd3=_0x4dedd3-0x0;var _0x48f768=_0xd1d2[_0x4dedd3];return _0x48f768;};'use strict';var _=require(_0x2d1d('0x0'));var util=require(_0x2d1d('0x1'));var moment=require(_0x2d1d('0x2'));var BPromise=require(_0x2d1d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d1d('0x4'));var db=require(_0x2d1d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2d1d('0x6'));var jayson=require(_0x2d1d('0x7'));var client=jayson[_0x2d1d('0x8')][_0x2d1d('0x9')]({'port':0x232a});config[_0x2d1d('0xa')]=_[_0x2d1d('0xb')](config[_0x2d1d('0xa')],{'host':_0x2d1d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2d1d('0xa')]));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2add58,_0x2f2c23,_0x26a8ad){return new BPromise(function(_0xcb65b2,_0x31a4ef){return client['request'](_0x2add58,_0x26a8ad)['then'](function(_0x534b2e){logger['info'](_0x2d1d('0xd'),_0x2f2c23,_0x2d1d('0xe'));logger[_0x2d1d('0xf')](_0x2d1d('0x10'),_0x2f2c23,_0x2d1d('0xe'),JSON[_0x2d1d('0x11')](_0x534b2e));if(_0x534b2e[_0x2d1d('0x12')]){if(_0x534b2e['error'][_0x2d1d('0x13')]===0x1f4){logger[_0x2d1d('0x12')](_0x2d1d('0xd'),_0x2f2c23,_0x534b2e[_0x2d1d('0x12')][_0x2d1d('0x14')]);return _0x31a4ef(_0x534b2e['error']['message']);}logger[_0x2d1d('0x12')](_0x2d1d('0xd'),_0x2f2c23,_0x534b2e[_0x2d1d('0x12')][_0x2d1d('0x14')]);return _0xcb65b2(_0x534b2e['error'][_0x2d1d('0x14')]);}else{logger['info'](_0x2d1d('0xd'),_0x2f2c23,_0x2d1d('0xe'));_0xcb65b2(_0x534b2e[_0x2d1d('0x15')][_0x2d1d('0x14')]);}})[_0x2d1d('0x16')](function(_0x146ff2){logger[_0x2d1d('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x2f2c23,_0x146ff2);_0x31a4ef(_0x146ff2);});});}exports[_0x2d1d('0x17')]=function(_0x354dca){var _0x40da31=this;return new Promise(function(_0x41bd32,_0x4ce0e6){return db['FaxInteraction'][_0x2d1d('0x18')](_0x354dca['body'],{'raw':_0x354dca[_0x2d1d('0x19')]?_0x354dca['options'][_0x2d1d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x354dca[_0x2d1d('0x19')]?_0x354dca[_0x2d1d('0x19')][_0x2d1d('0x1b')]||null:null,'attributes':_0x354dca['options']?_0x354dca[_0x2d1d('0x19')][_0x2d1d('0x1c')]||null:null,'limit':_0x354dca['options']?_0x354dca['options'][_0x2d1d('0x1d')]||null:null})[_0x2d1d('0x1e')](function(_0x566c83){logger[_0x2d1d('0x1f')](_0x2d1d('0x17'),_0x354dca);logger[_0x2d1d('0xf')]('UpdateFaxInteraction',_0x354dca,JSON[_0x2d1d('0x11')](_0x566c83));_0x41bd32(_0x566c83);})[_0x2d1d('0x16')](function(_0xf61b34){logger[_0x2d1d('0x12')]('UpdateFaxInteraction',_0xf61b34[_0x2d1d('0x14')],_0x354dca);_0x4ce0e6(_0x40da31[_0x2d1d('0x12')](0x1f4,_0xf61b34['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x126d2b){return new Promise(function(_0x25f943,_0x3751e4){return db[_0x2d1d('0x20')][_0x2d1d('0x21')]({'where':_0x126d2b[_0x2d1d('0x19')]?_0x126d2b[_0x2d1d('0x19')]['where']||null:null})['then'](function(_0x1451a8){if(_0x1451a8){return _0x1451a8[_0x2d1d('0x22')](_0x126d2b['body'][_0x2d1d('0x23')],_[_0x2d1d('0x24')](_0x126d2b[_0x2d1d('0x25')],[_0x2d1d('0x23'),'id'])||{});}})[_0x2d1d('0x26')](function(_0x2e126a){logger[_0x2d1d('0x1f')](_0x2d1d('0x27'),_0x126d2b);logger[_0x2d1d('0xf')](_0x2d1d('0x27'),_0x126d2b,JSON[_0x2d1d('0x11')](_0x2e126a));_0x25f943(_0x2e126a);})[_0x2d1d('0x16')](function(_0x507708){logger['error'](_0x2d1d('0x27'),_0x507708[_0x2d1d('0x14')],_0x126d2b);_0x3751e4(_this[_0x2d1d('0x12')](0x1f4,_0x507708[_0x2d1d('0x14')]));});});}; \ No newline at end of file +var _0x2087=['./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','stringify','find','addTags','ids','omit','spread','AddTags','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost'];(function(_0x55043f,_0x30ed0c){var _0x3b1d78=function(_0x587496){while(--_0x587496){_0x55043f['push'](_0x55043f['shift']());}};_0x3b1d78(++_0x30ed0c);}(_0x2087,0x71));var _0x7208=function(_0x4ab98e,_0x1c9ce1){_0x4ab98e=_0x4ab98e-0x0;var _0x17945b=_0x2087[_0x4ab98e];return _0x17945b;};'use strict';var _=require(_0x7208('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7208('0x1'));var rs=require(_0x7208('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7208('0x3'))['db'];var utils=require(_0x7208('0x4'));var logger=require(_0x7208('0x5'))(_0x7208('0x6'));var config=require(_0x7208('0x7'));var jayson=require(_0x7208('0x8'));var client=jayson[_0x7208('0x9')]['http']({'port':0x232a});config[_0x7208('0xa')]=_[_0x7208('0xb')](config['redis'],{'host':_0x7208('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7208('0xa')]));require(_0x7208('0xd'))[_0x7208('0xe')](socket);function respondWithRpcPromise(_0x1e6473,_0x5e1d38,_0x390341){return new BPromise(function(_0x76d481,_0xfa458c){return client[_0x7208('0xf')](_0x1e6473,_0x390341)[_0x7208('0x10')](function(_0xbb9ba3){logger['info'](_0x7208('0x11'),_0x5e1d38,_0x7208('0x12'));logger[_0x7208('0x13')](_0x7208('0x14'),_0x5e1d38,_0x7208('0x12'),JSON['stringify'](_0xbb9ba3));if(_0xbb9ba3[_0x7208('0x15')]){if(_0xbb9ba3[_0x7208('0x15')][_0x7208('0x16')]===0x1f4){logger[_0x7208('0x15')](_0x7208('0x11'),_0x5e1d38,_0xbb9ba3[_0x7208('0x15')]['message']);return _0xfa458c(_0xbb9ba3['error'][_0x7208('0x17')]);}logger[_0x7208('0x15')](_0x7208('0x11'),_0x5e1d38,_0xbb9ba3[_0x7208('0x15')][_0x7208('0x17')]);return _0x76d481(_0xbb9ba3[_0x7208('0x15')][_0x7208('0x17')]);}else{logger[_0x7208('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x5e1d38,_0x7208('0x12'));_0x76d481(_0xbb9ba3['result']['message']);}})[_0x7208('0x19')](function(_0x4bb6f9){logger[_0x7208('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x5e1d38,_0x4bb6f9);_0xfa458c(_0x4bb6f9);});});}exports[_0x7208('0x1a')]=function(_0x24e602){var _0x429305=this;return new Promise(function(_0x18d80f,_0x32a371){return db[_0x7208('0x1b')][_0x7208('0x1c')](_0x24e602[_0x7208('0x1d')],{'raw':_0x24e602[_0x7208('0x1e')]?_0x24e602['options'][_0x7208('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24e602[_0x7208('0x1e')]?_0x24e602[_0x7208('0x1e')][_0x7208('0x20')]||null:null,'attributes':_0x24e602['options']?_0x24e602[_0x7208('0x1e')][_0x7208('0x21')]||null:null,'limit':_0x24e602[_0x7208('0x1e')]?_0x24e602['options'][_0x7208('0x22')]||null:null})[_0x7208('0x10')](function(_0x2bde36){logger[_0x7208('0x18')](_0x7208('0x1a'),_0x24e602);logger[_0x7208('0x13')](_0x7208('0x1a'),_0x24e602,JSON[_0x7208('0x23')](_0x2bde36));_0x18d80f(_0x2bde36);})[_0x7208('0x19')](function(_0x458c6a){logger[_0x7208('0x15')](_0x7208('0x1a'),_0x458c6a[_0x7208('0x17')],_0x24e602);_0x32a371(_0x429305[_0x7208('0x15')](0x1f4,_0x458c6a[_0x7208('0x17')]));});});};exports['AddTagsToFaxInteraction']=function(_0x15ed95){return new Promise(function(_0x22cf07,_0x6ee02){return db[_0x7208('0x1b')][_0x7208('0x24')]({'where':_0x15ed95[_0x7208('0x1e')]?_0x15ed95['options'][_0x7208('0x20')]||null:null})[_0x7208('0x10')](function(_0x5e0276){if(_0x5e0276){return _0x5e0276[_0x7208('0x25')](_0x15ed95[_0x7208('0x1d')][_0x7208('0x26')],_[_0x7208('0x27')](_0x15ed95['body'],[_0x7208('0x26'),'id'])||{});}})[_0x7208('0x28')](function(_0x34cb42){logger[_0x7208('0x18')]('AddTags',_0x15ed95);logger['debug'](_0x7208('0x29'),_0x15ed95,JSON[_0x7208('0x23')](_0x34cb42));_0x22cf07(_0x34cb42);})[_0x7208('0x19')](function(_0x5b5c0c){logger[_0x7208('0x15')](_0x7208('0x29'),_0x5b5c0c[_0x7208('0x17')],_0x15ed95);_0x6ee02(_this[_0x7208('0x15')](0x1f4,_0x5b5c0c[_0x7208('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 3be46a1..1864185 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 _0x709c=['remove','update','emit','removeListener','register','./faxInteraction.events','save'];(function(_0x1311ee,_0x537b0d){var _0x23bb62=function(_0x1e6d5e){while(--_0x1e6d5e){_0x1311ee['push'](_0x1311ee['shift']());}};_0x23bb62(++_0x537b0d);}(_0x709c,0xc2));var _0xc709=function(_0x1cf0a8,_0x562a4f){_0x1cf0a8=_0x1cf0a8-0x0;var _0x38517a=_0x709c[_0x1cf0a8];return _0x38517a;};'use strict';var FaxInteractionEvents=require(_0xc709('0x0'));var events=[_0xc709('0x1'),_0xc709('0x2'),_0xc709('0x3')];function createListener(_0xac3ad3,_0x5d50f8){return function(_0x4dfaf4){_0x5d50f8[_0xc709('0x4')](_0xac3ad3,_0x4dfaf4);};}function removeListener(_0x4f97d9,_0x442825){return function(){FaxInteractionEvents[_0xc709('0x5')](_0x4f97d9,_0x442825);};}exports[_0xc709('0x6')]=function(_0x39308a){for(var _0x4df02d=0x0,_0x7b50cd=events['length'];_0x4df02d<_0x7b50cd;_0x4df02d++){var _0x5185b4=events[_0x4df02d];var _0x21d993=createListener('faxInteraction:'+_0x5185b4,_0x39308a);FaxInteractionEvents['on'](_0x5185b4,_0x21d993);}}; \ No newline at end of file +var _0xf899=['emit','removeListener','register','length','faxInteraction:','remove'];(function(_0x106355,_0x41a63c){var _0x275936=function(_0x4f30b1){while(--_0x4f30b1){_0x106355['push'](_0x106355['shift']());}};_0x275936(++_0x41a63c);}(_0xf899,0x19d));var _0x9f89=function(_0x238e12,_0x353adc){_0x238e12=_0x238e12-0x0;var _0x31edde=_0xf899[_0x238e12];return _0x31edde;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x9f89('0x0'),'update'];function createListener(_0x11777e,_0x5a7ec7){return function(_0x14f093){_0x5a7ec7[_0x9f89('0x1')](_0x11777e,_0x14f093);};}function removeListener(_0x12344a,_0x110c2b){return function(){FaxInteractionEvents[_0x9f89('0x2')](_0x12344a,_0x110c2b);};}exports[_0x9f89('0x3')]=function(_0x56b324){for(var _0x45349f=0x0,_0xda93fd=events[_0x9f89('0x4')];_0x45349f<_0xda93fd;_0x45349f++){var _0x30acc0=events[_0x45349f];var _0x19175a=createListener(_0x9f89('0x5')+_0x30acc0,_0x56b324);FaxInteractionEvents['on'](_0x30acc0,_0x19175a);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index a876dc1..4b53df3 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 _0x8145=['/:id/tags','tracked','fax','addTags','put','delete','destroy','removeTags','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','post','create'];(function(_0x56b3e6,_0x4e5e2a){var _0x225815=function(_0x5e663c){while(--_0x5e663c){_0x56b3e6['push'](_0x56b3e6['shift']());}};_0x225815(++_0x4e5e2a);}(_0x8145,0xb8));var _0x5814=function(_0x587f88,_0x299a03){_0x587f88=_0x587f88-0x0;var _0x306efa=_0x8145[_0x587f88];return _0x306efa;};'use strict';var multer=require(_0x5814('0x0'));var util=require(_0x5814('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5814('0x2'));var router=express[_0x5814('0x3')]();var auth=require(_0x5814('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5814('0x5'));var controller=require('./faxInteraction.controller');router[_0x5814('0x6')]('/',auth[_0x5814('0x7')](),controller[_0x5814('0x8')]);router[_0x5814('0x6')](_0x5814('0x9'),auth[_0x5814('0x7')](),controller[_0x5814('0xa')]);router[_0x5814('0x6')](_0x5814('0xb'),auth[_0x5814('0x7')](),controller[_0x5814('0xc')]);router[_0x5814('0x6')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5814('0xd')]);router[_0x5814('0x6')]('/:id/download',auth[_0x5814('0x7')](),controller['download']);router[_0x5814('0xe')]('/',auth['isAuthenticated'](),controller[_0x5814('0xf')]);router[_0x5814('0xe')]('/:id/messages',auth[_0x5814('0x7')](),controller['addMessage']);router[_0x5814('0xe')](_0x5814('0x10'),auth[_0x5814('0x7')](),interaction[_0x5814('0x11')](_0x5814('0x12'),'faxinteraction:addtags'),controller[_0x5814('0x13')]);router[_0x5814('0x14')](_0x5814('0xb'),auth['isAuthenticated'](),interaction[_0x5814('0x11')](_0x5814('0x12'),'faxinteraction:update'),controller['update']);router[_0x5814('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0x5814('0x11')](_0x5814('0x12'),'faxinteraction:destroy'),controller[_0x5814('0x16')]);router['delete'](_0x5814('0x10'),auth['isAuthenticated'](),controller[_0x5814('0x17')]);module[_0x5814('0x18')]=router; \ No newline at end of file +var _0x4e2d=['get','isAuthenticated','describe','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports','multer','util','express','Router','../../components/interaction/service','./faxInteraction.controller'];(function(_0x1b26ac,_0x5ea577){var _0x2d88ec=function(_0x4d6110){while(--_0x4d6110){_0x1b26ac['push'](_0x1b26ac['shift']());}};_0x2d88ec(++_0x5ea577);}(_0x4e2d,0x11c));var _0xd4e2=function(_0x5c01a8,_0x5da35a){_0x5c01a8=_0x5c01a8-0x0;var _0x3ae173=_0x4e2d[_0x5c01a8];return _0x3ae173;};'use strict';var multer=require(_0xd4e2('0x0'));var util=require(_0xd4e2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd4e2('0x2'));var router=express[_0xd4e2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd4e2('0x4'));var config=require('../../config/environment');var controller=require(_0xd4e2('0x5'));router[_0xd4e2('0x6')]('/',auth[_0xd4e2('0x7')](),controller['index']);router[_0xd4e2('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xd4e2('0x8')]);router[_0xd4e2('0x6')]('/:id',auth[_0xd4e2('0x7')](),controller[_0xd4e2('0x9')]);router[_0xd4e2('0x6')](_0xd4e2('0xa'),auth['isAuthenticated'](),controller[_0xd4e2('0xb')]);router['get']('/:id/download',auth[_0xd4e2('0x7')](),controller[_0xd4e2('0xc')]);router[_0xd4e2('0xd')]('/',auth[_0xd4e2('0x7')](),controller[_0xd4e2('0xe')]);router['post'](_0xd4e2('0xa'),auth[_0xd4e2('0x7')](),controller[_0xd4e2('0xf')]);router[_0xd4e2('0xd')](_0xd4e2('0x10'),auth[_0xd4e2('0x7')](),interaction[_0xd4e2('0x11')](_0xd4e2('0x12'),_0xd4e2('0x13')),controller[_0xd4e2('0x14')]);router[_0xd4e2('0x15')](_0xd4e2('0x16'),auth[_0xd4e2('0x7')](),interaction[_0xd4e2('0x11')](_0xd4e2('0x12'),_0xd4e2('0x17')),controller[_0xd4e2('0x18')]);router[_0xd4e2('0x19')]('/:id',auth[_0xd4e2('0x7')](),interaction[_0xd4e2('0x11')]('fax',_0xd4e2('0x1a')),controller['destroy']);router[_0xd4e2('0x19')](_0xd4e2('0x10'),auth['isAuthenticated'](),controller[_0xd4e2('0x1b')]);module[_0xd4e2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index a249241..464a7d7 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 _0x14a5=['out','DATE','sequelize','exports','TEXT','medium','ENUM'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x14a5,0x18a));var _0x514a=function(_0x1d8a9e,_0x4bafbc){_0x1d8a9e=_0x1d8a9e-0x0;var _0x5e36d3=_0x14a5[_0x1d8a9e];return _0x5e36d3;};'use strict';var Sequelize=require(_0x514a('0x0'));module[_0x514a('0x1')]={'body':{'type':Sequelize[_0x514a('0x2')](_0x514a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x514a('0x4')]('in',_0x514a('0x5')),'defaultValue':_0x514a('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x514a('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x514a('0x6')]}}; \ No newline at end of file +var _0xa262=['out','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x30b96c,_0x117d8f){var _0x19b434=function(_0x24047f){while(--_0x24047f){_0x30b96c['push'](_0x30b96c['shift']());}};_0x19b434(++_0x117d8f);}(_0xa262,0x128));var _0x2a26=function(_0x5b005b,_0x2c5f11){_0x5b005b=_0x5b005b-0x0;var _0x28a1c9=_0xa262[_0x5b005b];return _0x28a1c9;};'use strict';var Sequelize=require(_0x2a26('0x0'));module['exports']={'body':{'type':Sequelize[_0x2a26('0x1')](_0x2a26('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2a26('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2a26('0x4')]('in','out'),'defaultValue':_0x2a26('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x2a26('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2a26('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 09b7fc2..f7a15f2 100644 --- a/server/api/faxMessage/faxMessage.controller.js +++ b/server/api/faxMessage/faxMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['format','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','acceptMessage','interface','channel','event','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','EventManager','rejectmessage','create','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','join','server','files','attachments','Attachment','download','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','name','options','FaxMessage','includeAll','include','findAll','rows','show','intersection','find','body','params','describe','../../config/logger','fax-interactions','accept','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteraction','isNil','read1stAt'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];config[_0x0a9e('0x14')]=_[_0x0a9e('0x15')](config[_0x0a9e('0x14')],{'host':_0x0a9e('0x16'),'port':0x18eb});var socket=require(_0x0a9e('0x17'))(new Redis(config['redis']));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson[_0x0a9e('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x22dccb,_0x5d0880,_0x1985b6){if(_0x1985b6){var _0x519dfd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x519dfd[_0x0a9e('0x1d')](_0x5d0880)){return _0x22dccb;}else{throw new db[(_0x0a9e('0x1e'))]['ValidationError'](_0x0a9e('0x1f'));}}else{return _0x22dccb;}}function respondWithRpcPromise(_0x5a0a06,_0x459eb1,_0x478723,_0x106033){return new BPromise(function(_0x205fd6,_0x31b1ca){var _0x2eb11f=_0x106033||client;return _0x2eb11f[_0x0a9e('0x20')](_0x5a0a06,_0x478723)[_0x0a9e('0x21')](function(_0x1314ae){logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x459eb1,_0x0a9e('0x24'));logger['debug'](_0x0a9e('0x25'),_0x459eb1,_0x0a9e('0x24'),JSON['stringify'](_0x1314ae));if(_0x1314ae[_0x0a9e('0x26')]){if(_0x1314ae['error']['code']===0x1f4){logger[_0x0a9e('0x26')](_0x0a9e('0x23'),_0x459eb1,_0x1314ae[_0x0a9e('0x26')][_0x0a9e('0x27')]);return _0x31b1ca(_0x1314ae['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x26')](_0x0a9e('0x23'),_0x459eb1,_0x1314ae[_0x0a9e('0x26')][_0x0a9e('0x27')]);return _0x205fd6(_0x1314ae[_0x0a9e('0x26')][_0x0a9e('0x27')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x459eb1,_0x0a9e('0x24'));_0x205fd6(_0x1314ae[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})[_0x0a9e('0x29')](function(_0x526cf3){logger[_0x0a9e('0x26')]('FaxMessage,\x20%s,\x20%s',_0x459eb1,_0x526cf3);_0x31b1ca(_0x526cf3);});});}function respondWithStatusCode(_0x45a1e7,_0x5bfb33){_0x5bfb33=_0x5bfb33||0xcc;return function(_0x1dc186){if(_0x1dc186){return _0x45a1e7[_0x0a9e('0x2a')](_0x5bfb33);}return _0x45a1e7[_0x0a9e('0x2b')](_0x5bfb33)[_0x0a9e('0x2c')]();};}function respondWithResult(_0x140511,_0x1538a4){_0x1538a4=_0x1538a4||0xc8;return function(_0x11c3b6){if(_0x11c3b6){return _0x140511[_0x0a9e('0x2b')](_0x1538a4)['json'](_0x11c3b6);}};}function respondWithFilteredResult(_0x3652a7,_0x468813){return function(_0x2b1f27){if(_0x2b1f27){var _0x2ec755=_0x2b1f27[_0x0a9e('0x2d')],_0x5c877d=_0x468813[_0x0a9e('0x2e')],_0x15b200=_0x468813[_0x0a9e('0x2e')]+_0x468813[_0x0a9e('0x2f')],_0x40e7a3;if(_0x15b200>=_0x2ec755){_0x15b200=_0x2ec755;_0x40e7a3=0xc8;}else{_0x40e7a3=0xce;}_0x3652a7[_0x0a9e('0x2b')](_0x40e7a3);return _0x3652a7[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5c877d+'-'+_0x15b200+'/'+_0x2ec755)['json'](_0x2b1f27);}return null;};}function patchUpdates(_0x426950){return function(_0x5d1e0e){try{jsonpatch[_0x0a9e('0x32')](_0x5d1e0e,_0x426950,!![]);}catch(_0x3ae878){return BPromise[_0x0a9e('0x33')](_0x3ae878);}return _0x5d1e0e[_0x0a9e('0x34')]();};}function saveUpdates(_0x25ce3a,_0x5180f1){return function(_0x66c1d2){if(_0x66c1d2){return _0x66c1d2[_0x0a9e('0x35')](_0x25ce3a)[_0x0a9e('0x21')](function(_0x2da5c0){return _0x2da5c0;});}return null;};}function removeEntity(_0x2b45ea,_0x409319){return function(_0x332d35){if(_0x332d35){return _0x332d35[_0x0a9e('0x36')]()['then'](function(){_0x2b45ea[_0x0a9e('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cc7a0,_0x14b13f){return function(_0x2b7e7f){if(!_0x2b7e7f){_0x2cc7a0[_0x0a9e('0x2a')](0x194);}return _0x2b7e7f;};}function handleError(_0x567193,_0x191e91){_0x191e91=_0x191e91||0x1f4;return function(_0xd1836d){logger[_0x0a9e('0x26')](_0xd1836d[_0x0a9e('0x37')]);if(_0xd1836d['name']){delete _0xd1836d['name'];}_0x567193[_0x0a9e('0x2b')](_0x191e91)['send'](_0xd1836d);};}exports[_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x39')](db['FaxMessage'][_0x0a9e('0x3a')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x3b')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x3c')]=_[_0x0a9e('0x39')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x3d9717[_0x0a9e('0x3d')]);_0x4f41ae[_0x0a9e('0x3f')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x3d')]);_0x1ef87a[_0x0a9e('0x40')]=_['intersection'](_0x4f41ae[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x3d')]['fields']));_0x1ef87a[_0x0a9e('0x40')]=_0x1ef87a[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x1ef87a[_0x0a9e('0x40')]:_0x4f41ae[_0x0a9e('0x3c')];if(!_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x1ef87a[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x2f')]);_0x1ef87a[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x3d9717[_0x0a9e('0x3d')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x45')](_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x45')]);_0x1ef87a[_0x0a9e('0x46')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x47')](_0x3d9717[_0x0a9e('0x3d')],_0x4f41ae[_0x0a9e('0x3f')]));if(_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x48')]){_0x1ef87a[_0x0a9e('0x46')]=_[_0x0a9e('0x49')](_0x1ef87a['where'],{'$or':_[_0x0a9e('0x39')](_0x3bfce8,function(_0x138b8b){if(_0x138b8b[_0x0a9e('0x4a')]!==_0x0a9e('0x4b')){var _0x2e8caf={};_0x2e8caf[_0x138b8b[_0x0a9e('0x4c')]]={'$like':'%'+_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x48')]+'%'};return _0x2e8caf;}})});}_0x1ef87a=_['merge']({},_0x1ef87a,_0x3d9717[_0x0a9e('0x4d')]);var _0x48fd45={'where':_0x1ef87a[_0x0a9e('0x46')]};return db[_0x0a9e('0x4e')][_0x0a9e('0x2d')](_0x48fd45)['then'](function(_0x14bec2){_0x31916f[_0x0a9e('0x2d')]=_0x14bec2;if(_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x4f')]){_0x1ef87a[_0x0a9e('0x50')]=[{'all':!![]}];}return db[_0x0a9e('0x4e')][_0x0a9e('0x51')](_0x1ef87a);})['then'](function(_0x13f44d){_0x31916f[_0x0a9e('0x52')]=_0x13f44d;return _0x31916f;})[_0x0a9e('0x21')](respondWithFilteredResult(_0x381c37,_0x1ef87a))[_0x0a9e('0x29')](handleError(_0x381c37,null));};exports[_0x0a9e('0x53')]=function(_0x992c77,_0x6054ee){var _0x19383e={'raw':!![],'where':{'id':_0x992c77['params']['id']}},_0x34febd={};_0x34febd[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db['FaxMessage']['rawAttributes']);_0x34febd['query']=_[_0x0a9e('0x3e')](_0x992c77[_0x0a9e('0x3d')]);_0x34febd[_0x0a9e('0x3f')]=_[_0x0a9e('0x54')](_0x34febd[_0x0a9e('0x3c')],_0x34febd[_0x0a9e('0x3d')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x54')](_0x34febd['model'],qs['fields'](_0x992c77['query'][_0x0a9e('0x41')]));_0x19383e[_0x0a9e('0x40')]=_0x19383e[_0x0a9e('0x40')]['length']?_0x19383e[_0x0a9e('0x40')]:_0x34febd[_0x0a9e('0x3c')];if(_0x992c77['query']['includeAll']){_0x19383e[_0x0a9e('0x50')]=[{'all':!![]}];}_0x19383e=_['merge']({},_0x19383e,_0x992c77[_0x0a9e('0x4d')]);return db['FaxMessage'][_0x0a9e('0x55')](_0x19383e)[_0x0a9e('0x21')](handleEntityNotFound(_0x6054ee,null))[_0x0a9e('0x21')](respondWithResult(_0x6054ee,null))['catch'](handleError(_0x6054ee,null));};exports[_0x0a9e('0x35')]=function(_0x1bf38a,_0x508b47){if(_0x1bf38a['body']['id']){delete _0x1bf38a[_0x0a9e('0x56')]['id'];}return db[_0x0a9e('0x4e')]['find']({'where':{'id':_0x1bf38a[_0x0a9e('0x57')]['id']}})['then'](handleEntityNotFound(_0x508b47,null))[_0x0a9e('0x21')](saveUpdates(_0x1bf38a['body'],null))[_0x0a9e('0x21')](respondWithResult(_0x508b47,null))['catch'](handleError(_0x508b47,null));};exports['destroy']=function(_0x5df0ad,_0x2da03c){return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x5df0ad[_0x0a9e('0x57')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x2da03c,null))[_0x0a9e('0x21')](removeEntity(_0x2da03c,null))[_0x0a9e('0x29')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x58')]=function(_0xd10662,_0x28d814){return db['FaxMessage'][_0x0a9e('0x58')]()[_0x0a9e('0x21')](respondWithResult(_0x28d814,null))[_0x0a9e('0x29')](handleError(_0x28d814,null));};var interaction_log=require(_0x0a9e('0x59'))(_0x0a9e('0x5a'));exports[_0x0a9e('0x5b')]=function(_0x5d86e9,_0x956fbe,_0x26bc80){var _0x5239ef={'channel':_0x0a9e('0x5c')};if(_0x5d86e9['body']['id']){delete _0x5d86e9[_0x0a9e('0x56')]['id'];}_0x5d86e9['body']['read']=!![];_0x5d86e9['body'][_0x0a9e('0x5d')]=moment()['format'](_0x0a9e('0x5e'));_0x5d86e9[_0x0a9e('0x56')][_0x0a9e('0x5f')]=_0x5d86e9[_0x0a9e('0x56')][_0x0a9e('0x5f')]||_0x5d86e9[_0x0a9e('0x60')]['id'];return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x5d86e9['params']['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x61')],'as':_0x0a9e('0x62')}]})[_0x0a9e('0x21')](handleEntityNotFound(_0x956fbe,null))['then'](saveUpdates(_0x5d86e9[_0x0a9e('0x56')],null))[_0x0a9e('0x21')](function(_0x119677){if(_0x119677){_0x5239ef[_0x0a9e('0x27')]=_0x119677['get']({'plain':!![]});return db[_0x0a9e('0x63')][_0x0a9e('0x55')]({'where':{'id':_0x119677['FaxInteractionId']}});}return null;})[_0x0a9e('0x21')](handleEntityNotFound(_0x956fbe,null))[_0x0a9e('0x21')](function(_0x88dcbf){if(_0x88dcbf){return _0x88dcbf[_0x0a9e('0x35')]({'UserId':_0x5d86e9[_0x0a9e('0x56')]['UserId'],'read1stAt':_[_0x0a9e('0x64')](_0x88dcbf[_0x0a9e('0x65')])?moment()[_0x0a9e('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0a9e('0x21')](function(_0x4f1e60){if(_0x4f1e60){_0x5239ef['interaction']=_0x4f1e60[_0x0a9e('0x67')]({'plain':!![]});interaction_log[_0x0a9e('0x22')](_0x0a9e('0x68'),_0x5d86e9[_0x0a9e('0x60')]['id'],_0x5d86e9[_0x0a9e('0x60')][_0x0a9e('0x4c')],_0x5d86e9[_0x0a9e('0x60')][_0x0a9e('0x69')],_0x5239ef[_0x0a9e('0x6a')]['id'],_0x5d86e9[_0x0a9e('0x56')]?JSON[_0x0a9e('0x6b')](_0x5d86e9[_0x0a9e('0x56')]):_0x0a9e('0x6c'));return respondWithRpcPromise(_0x0a9e('0x6d'),_0x0a9e('0x6e'),_0x5239ef);}return null;})[_0x0a9e('0x21')](function(_0x2a28c0){if(_0x2a28c0){if(_0x5d86e9[_0x0a9e('0x56')]['manual']){_0x5239ef[_0x0a9e('0x27')][_0x0a9e('0x6f')]=util[_0x0a9e('0x66')]('SIP/%s',_0x5d86e9[_0x0a9e('0x60')][_0x0a9e('0x4c')]);_0x5239ef['message'][_0x0a9e('0x70')]=_0x5239ef[_0x0a9e('0x70')];_0x5239ef[_0x0a9e('0x27')][_0x0a9e('0x71')]=_0x0a9e('0x5b');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x5239ef[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x21')](function(){return _0x5239ef;});}return _0x5239ef;}return null;})[_0x0a9e('0x21')](respondWithResult(_0x956fbe,null))[_0x0a9e('0x29')](handleError(_0x956fbe,null));};var interaction_log=require(_0x0a9e('0x59'))(_0x0a9e('0x5a'));exports[_0x0a9e('0x33')]=function(_0x1a0677,_0x5512d1,_0x235f8f){var _0xcbc8b2={'agent':{},'channel':_0x0a9e('0x5c')};if(_0x1a0677['body']['id']){delete _0x1a0677[_0x0a9e('0x56')]['id'];}_0x1a0677['body'][_0x0a9e('0x5f')]=_0x1a0677[_0x0a9e('0x56')]['UserId']||_0x1a0677[_0x0a9e('0x60')]['id'];_0xcbc8b2[_0x0a9e('0x72')]['id']=_0x1a0677[_0x0a9e('0x56')][_0x0a9e('0x5f')];return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x1a0677[_0x0a9e('0x57')]['id'],'UserId':null}})[_0x0a9e('0x21')](handleEntityNotFound(_0x5512d1,null))[_0x0a9e('0x21')](function(_0x5b7fc3){if(_0x5b7fc3){_0xcbc8b2[_0x0a9e('0x27')]=_0x5b7fc3[_0x0a9e('0x67')]({'plain':!![]});return db[_0x0a9e('0x63')][_0x0a9e('0x55')]({'where':{'id':_0x5b7fc3['FaxInteractionId']}});}return null;})[_0x0a9e('0x21')](handleEntityNotFound(_0x5512d1,null))[_0x0a9e('0x21')](function(_0x30a4c7){if(_0x30a4c7){_0xcbc8b2[_0x0a9e('0x6a')]=_0x30a4c7[_0x0a9e('0x67')]({'plain':!![]});interaction_log[_0x0a9e('0x22')](_0x0a9e('0x73'),_0x1a0677[_0x0a9e('0x60')]['id'],_0x1a0677[_0x0a9e('0x60')][_0x0a9e('0x4c')],_0x1a0677[_0x0a9e('0x60')][_0x0a9e('0x69')],_0xcbc8b2[_0x0a9e('0x6a')]['id'],_0x1a0677[_0x0a9e('0x56')]?JSON['stringify'](_0x1a0677[_0x0a9e('0x56')]):_0x0a9e('0x6c'));return respondWithRpcPromise(_0x0a9e('0x74'),'rejectMessage',_0xcbc8b2);}return null;})[_0x0a9e('0x21')](function(_0x33dda0){if(_0x33dda0){_0x33dda0[_0x0a9e('0x27')][_0x0a9e('0x6f')]=util['format']('SIP/%s',_0x1a0677[_0x0a9e('0x60')][_0x0a9e('0x4c')]);_0x33dda0['message'][_0x0a9e('0x70')]=_0xcbc8b2['channel'];_0x33dda0[_0x0a9e('0x27')][_0x0a9e('0x71')]='reject';respondWithRpcPromise(_0x0a9e('0x75'),_0x0a9e('0x75'),{'event':_0x0a9e('0x76'),'message':_0x33dda0[_0x0a9e('0x27')]},client9002);return _0xcbc8b2;}return null;})[_0x0a9e('0x21')](respondWithResult(_0x5512d1,null))[_0x0a9e('0x29')](handleError(_0x5512d1,null));};exports[_0x0a9e('0x77')]=function(_0x482ca2,_0x2973d3){var _0x3ca9b9;return db[_0x0a9e('0x4e')][_0x0a9e('0x77')](_0x482ca2['body'],{})[_0x0a9e('0x21')](function(_0xf0db1){_0x3ca9b9=_0xf0db1;return db['CmContact'][_0x0a9e('0x78')]({'where':{'id':_0x3ca9b9['ContactId']}});})[_0x0a9e('0x21')](function(_0x2bb25a){if(_[_0x0a9e('0x64')](_0x2bb25a)){return;}else{_0x3ca9b9[_0x0a9e('0x5c')]=_0x2bb25a['fax'];return db['Attachment'][_0x0a9e('0x78')]({'where':{'id':_0x3ca9b9[_0x0a9e('0x79')]}});}})[_0x0a9e('0x21')](function(_0x5ac73d){return respondWithRpcPromise(_0x0a9e('0x7a'),_0x0a9e('0x7a'),{'FaxAccountId':_['isNil'](_0x482ca2['body'])?undefined:_0x482ca2[_0x0a9e('0x56')]['FaxAccountId'],'path':_['isNil'](_0x5ac73d)?undefined:util['format'](_0x0a9e('0x7b'),_0x5ac73d[_0x0a9e('0x7c')]),'fax':_[_0x0a9e('0x64')](_0x3ca9b9[_0x0a9e('0x5c')])?undefined:_0x3ca9b9[_0x0a9e('0x5c')],'AttachmentId':_0x3ca9b9[_0x0a9e('0x79')]},client9002);})['then'](respondWithResult(_0x2973d3,0xc9))[_0x0a9e('0x29')](handleError(_0x2973d3,null));};exports['download']=function(_0x2871c1,_0x2aabab){var _0x18ad56=path[_0x0a9e('0x7d')](config['root'],_0x0a9e('0x7e'),_0x0a9e('0x7f'),_0x0a9e('0x80'));return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x2871c1[_0x0a9e('0x57')]['id']},'include':[{'model':db[_0x0a9e('0x81')],'as':_0x0a9e('0x81')}]})[_0x0a9e('0x21')](handleEntityNotFound(_0x2aabab,null))[_0x0a9e('0x21')](function(_0x32b9bd){if(_0x32b9bd){return _0x2aabab[_0x0a9e('0x82')](path['join'](_0x18ad56,_0x32b9bd[_0x0a9e('0x81')][_0x0a9e('0x7c')]));}})['catch'](handleError(_0x2aabab,null));}; \ No newline at end of file +var _0xa9e0=['format','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','acceptMessage','interface','channel','event','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','EventManager','rejectmessage','create','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','join','server','files','attachments','Attachment','download','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','name','options','FaxMessage','includeAll','include','findAll','rows','show','intersection','find','body','params','describe','../../config/logger','fax-interactions','accept','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteraction','isNil','read1stAt'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];config[_0x0a9e('0x14')]=_[_0x0a9e('0x15')](config[_0x0a9e('0x14')],{'host':_0x0a9e('0x16'),'port':0x18eb});var socket=require(_0x0a9e('0x17'))(new Redis(config['redis']));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson[_0x0a9e('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x22dccb,_0x5d0880,_0x1985b6){if(_0x1985b6){var _0x519dfd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x519dfd[_0x0a9e('0x1d')](_0x5d0880)){return _0x22dccb;}else{throw new db[(_0x0a9e('0x1e'))]['ValidationError'](_0x0a9e('0x1f'));}}else{return _0x22dccb;}}function respondWithRpcPromise(_0x5a0a06,_0x459eb1,_0x478723,_0x106033){return new BPromise(function(_0x205fd6,_0x31b1ca){var _0x2eb11f=_0x106033||client;return _0x2eb11f[_0x0a9e('0x20')](_0x5a0a06,_0x478723)[_0x0a9e('0x21')](function(_0x1314ae){logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x459eb1,_0x0a9e('0x24'));logger['debug'](_0x0a9e('0x25'),_0x459eb1,_0x0a9e('0x24'),JSON['stringify'](_0x1314ae));if(_0x1314ae[_0x0a9e('0x26')]){if(_0x1314ae['error']['code']===0x1f4){logger[_0x0a9e('0x26')](_0x0a9e('0x23'),_0x459eb1,_0x1314ae[_0x0a9e('0x26')][_0x0a9e('0x27')]);return _0x31b1ca(_0x1314ae['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x26')](_0x0a9e('0x23'),_0x459eb1,_0x1314ae[_0x0a9e('0x26')][_0x0a9e('0x27')]);return _0x205fd6(_0x1314ae[_0x0a9e('0x26')][_0x0a9e('0x27')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x459eb1,_0x0a9e('0x24'));_0x205fd6(_0x1314ae[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})[_0x0a9e('0x29')](function(_0x526cf3){logger[_0x0a9e('0x26')]('FaxMessage,\x20%s,\x20%s',_0x459eb1,_0x526cf3);_0x31b1ca(_0x526cf3);});});}function respondWithStatusCode(_0x45a1e7,_0x5bfb33){_0x5bfb33=_0x5bfb33||0xcc;return function(_0x1dc186){if(_0x1dc186){return _0x45a1e7[_0x0a9e('0x2a')](_0x5bfb33);}return _0x45a1e7[_0x0a9e('0x2b')](_0x5bfb33)[_0x0a9e('0x2c')]();};}function respondWithResult(_0x140511,_0x1538a4){_0x1538a4=_0x1538a4||0xc8;return function(_0x11c3b6){if(_0x11c3b6){return _0x140511[_0x0a9e('0x2b')](_0x1538a4)['json'](_0x11c3b6);}};}function respondWithFilteredResult(_0x3652a7,_0x468813){return function(_0x2b1f27){if(_0x2b1f27){var _0x2ec755=_0x2b1f27[_0x0a9e('0x2d')],_0x5c877d=_0x468813[_0x0a9e('0x2e')],_0x15b200=_0x468813[_0x0a9e('0x2e')]+_0x468813[_0x0a9e('0x2f')],_0x40e7a3;if(_0x15b200>=_0x2ec755){_0x15b200=_0x2ec755;_0x40e7a3=0xc8;}else{_0x40e7a3=0xce;}_0x3652a7[_0x0a9e('0x2b')](_0x40e7a3);return _0x3652a7[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5c877d+'-'+_0x15b200+'/'+_0x2ec755)['json'](_0x2b1f27);}return null;};}function patchUpdates(_0x426950){return function(_0x5d1e0e){try{jsonpatch[_0x0a9e('0x32')](_0x5d1e0e,_0x426950,!![]);}catch(_0x3ae878){return BPromise[_0x0a9e('0x33')](_0x3ae878);}return _0x5d1e0e[_0x0a9e('0x34')]();};}function saveUpdates(_0x25ce3a,_0x5180f1){return function(_0x66c1d2){if(_0x66c1d2){return _0x66c1d2[_0x0a9e('0x35')](_0x25ce3a)[_0x0a9e('0x21')](function(_0x2da5c0){return _0x2da5c0;});}return null;};}function removeEntity(_0x2b45ea,_0x409319){return function(_0x332d35){if(_0x332d35){return _0x332d35[_0x0a9e('0x36')]()['then'](function(){_0x2b45ea[_0x0a9e('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cc7a0,_0x14b13f){return function(_0x2b7e7f){if(!_0x2b7e7f){_0x2cc7a0[_0x0a9e('0x2a')](0x194);}return _0x2b7e7f;};}function handleError(_0x567193,_0x191e91){_0x191e91=_0x191e91||0x1f4;return function(_0xd1836d){logger[_0x0a9e('0x26')](_0xd1836d[_0x0a9e('0x37')]);if(_0xd1836d['name']){delete _0xd1836d['name'];}_0x567193[_0x0a9e('0x2b')](_0x191e91)['send'](_0xd1836d);};}exports[_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x39')](db['FaxMessage'][_0x0a9e('0x3a')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x3b')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x3c')]=_[_0x0a9e('0x39')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x3d9717[_0x0a9e('0x3d')]);_0x4f41ae[_0x0a9e('0x3f')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x3d')]);_0x1ef87a[_0x0a9e('0x40')]=_['intersection'](_0x4f41ae[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x3d')]['fields']));_0x1ef87a[_0x0a9e('0x40')]=_0x1ef87a[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x1ef87a[_0x0a9e('0x40')]:_0x4f41ae[_0x0a9e('0x3c')];if(!_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x1ef87a[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x2f')]);_0x1ef87a[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x3d9717[_0x0a9e('0x3d')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x45')](_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x45')]);_0x1ef87a[_0x0a9e('0x46')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x47')](_0x3d9717[_0x0a9e('0x3d')],_0x4f41ae[_0x0a9e('0x3f')]));if(_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x48')]){_0x1ef87a[_0x0a9e('0x46')]=_[_0x0a9e('0x49')](_0x1ef87a['where'],{'$or':_[_0x0a9e('0x39')](_0x3bfce8,function(_0x138b8b){if(_0x138b8b[_0x0a9e('0x4a')]!==_0x0a9e('0x4b')){var _0x2e8caf={};_0x2e8caf[_0x138b8b[_0x0a9e('0x4c')]]={'$like':'%'+_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x48')]+'%'};return _0x2e8caf;}})});}_0x1ef87a=_['merge']({},_0x1ef87a,_0x3d9717[_0x0a9e('0x4d')]);var _0x48fd45={'where':_0x1ef87a[_0x0a9e('0x46')]};return db[_0x0a9e('0x4e')][_0x0a9e('0x2d')](_0x48fd45)['then'](function(_0x14bec2){_0x31916f[_0x0a9e('0x2d')]=_0x14bec2;if(_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x4f')]){_0x1ef87a[_0x0a9e('0x50')]=[{'all':!![]}];}return db[_0x0a9e('0x4e')][_0x0a9e('0x51')](_0x1ef87a);})['then'](function(_0x13f44d){_0x31916f[_0x0a9e('0x52')]=_0x13f44d;return _0x31916f;})[_0x0a9e('0x21')](respondWithFilteredResult(_0x381c37,_0x1ef87a))[_0x0a9e('0x29')](handleError(_0x381c37,null));};exports[_0x0a9e('0x53')]=function(_0x992c77,_0x6054ee){var _0x19383e={'raw':!![],'where':{'id':_0x992c77['params']['id']}},_0x34febd={};_0x34febd[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db['FaxMessage']['rawAttributes']);_0x34febd['query']=_[_0x0a9e('0x3e')](_0x992c77[_0x0a9e('0x3d')]);_0x34febd[_0x0a9e('0x3f')]=_[_0x0a9e('0x54')](_0x34febd[_0x0a9e('0x3c')],_0x34febd[_0x0a9e('0x3d')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x54')](_0x34febd['model'],qs['fields'](_0x992c77['query'][_0x0a9e('0x41')]));_0x19383e[_0x0a9e('0x40')]=_0x19383e[_0x0a9e('0x40')]['length']?_0x19383e[_0x0a9e('0x40')]:_0x34febd[_0x0a9e('0x3c')];if(_0x992c77['query']['includeAll']){_0x19383e[_0x0a9e('0x50')]=[{'all':!![]}];}_0x19383e=_['merge']({},_0x19383e,_0x992c77[_0x0a9e('0x4d')]);return db['FaxMessage'][_0x0a9e('0x55')](_0x19383e)[_0x0a9e('0x21')](handleEntityNotFound(_0x6054ee,null))[_0x0a9e('0x21')](respondWithResult(_0x6054ee,null))['catch'](handleError(_0x6054ee,null));};exports[_0x0a9e('0x35')]=function(_0x1bf38a,_0x508b47){if(_0x1bf38a['body']['id']){delete _0x1bf38a[_0x0a9e('0x56')]['id'];}return db[_0x0a9e('0x4e')]['find']({'where':{'id':_0x1bf38a[_0x0a9e('0x57')]['id']}})['then'](handleEntityNotFound(_0x508b47,null))[_0x0a9e('0x21')](saveUpdates(_0x1bf38a['body'],null))[_0x0a9e('0x21')](respondWithResult(_0x508b47,null))['catch'](handleError(_0x508b47,null));};exports['destroy']=function(_0x5df0ad,_0x2da03c){return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x5df0ad[_0x0a9e('0x57')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x2da03c,null))[_0x0a9e('0x21')](removeEntity(_0x2da03c,null))[_0x0a9e('0x29')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x58')]=function(_0xd10662,_0x28d814){return db['FaxMessage'][_0x0a9e('0x58')]()[_0x0a9e('0x21')](respondWithResult(_0x28d814,null))[_0x0a9e('0x29')](handleError(_0x28d814,null));};var interaction_log=require(_0x0a9e('0x59'))(_0x0a9e('0x5a'));exports[_0x0a9e('0x5b')]=function(_0x5d86e9,_0x956fbe,_0x26bc80){var _0x5239ef={'channel':_0x0a9e('0x5c')};if(_0x5d86e9['body']['id']){delete _0x5d86e9[_0x0a9e('0x56')]['id'];}_0x5d86e9['body']['read']=!![];_0x5d86e9['body'][_0x0a9e('0x5d')]=moment()['format'](_0x0a9e('0x5e'));_0x5d86e9[_0x0a9e('0x56')][_0x0a9e('0x5f')]=_0x5d86e9[_0x0a9e('0x56')][_0x0a9e('0x5f')]||_0x5d86e9[_0x0a9e('0x60')]['id'];return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x5d86e9['params']['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x61')],'as':_0x0a9e('0x62')}]})[_0x0a9e('0x21')](handleEntityNotFound(_0x956fbe,null))['then'](saveUpdates(_0x5d86e9[_0x0a9e('0x56')],null))[_0x0a9e('0x21')](function(_0x119677){if(_0x119677){_0x5239ef[_0x0a9e('0x27')]=_0x119677['get']({'plain':!![]});return db[_0x0a9e('0x63')][_0x0a9e('0x55')]({'where':{'id':_0x119677['FaxInteractionId']}});}return null;})[_0x0a9e('0x21')](handleEntityNotFound(_0x956fbe,null))[_0x0a9e('0x21')](function(_0x88dcbf){if(_0x88dcbf){return _0x88dcbf[_0x0a9e('0x35')]({'UserId':_0x5d86e9[_0x0a9e('0x56')]['UserId'],'read1stAt':_[_0x0a9e('0x64')](_0x88dcbf[_0x0a9e('0x65')])?moment()[_0x0a9e('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0a9e('0x21')](function(_0x4f1e60){if(_0x4f1e60){_0x5239ef['interaction']=_0x4f1e60[_0x0a9e('0x67')]({'plain':!![]});interaction_log[_0x0a9e('0x22')](_0x0a9e('0x68'),_0x5d86e9[_0x0a9e('0x60')]['id'],_0x5d86e9[_0x0a9e('0x60')][_0x0a9e('0x4c')],_0x5d86e9[_0x0a9e('0x60')][_0x0a9e('0x69')],_0x5239ef[_0x0a9e('0x6a')]['id'],_0x5d86e9[_0x0a9e('0x56')]?JSON[_0x0a9e('0x6b')](_0x5d86e9[_0x0a9e('0x56')]):_0x0a9e('0x6c'));return respondWithRpcPromise(_0x0a9e('0x6d'),_0x0a9e('0x6e'),_0x5239ef);}return null;})[_0x0a9e('0x21')](function(_0x2a28c0){if(_0x2a28c0){if(_0x5d86e9[_0x0a9e('0x56')]['manual']){_0x5239ef[_0x0a9e('0x27')][_0x0a9e('0x6f')]=util[_0x0a9e('0x66')]('SIP/%s',_0x5d86e9[_0x0a9e('0x60')][_0x0a9e('0x4c')]);_0x5239ef['message'][_0x0a9e('0x70')]=_0x5239ef[_0x0a9e('0x70')];_0x5239ef[_0x0a9e('0x27')][_0x0a9e('0x71')]=_0x0a9e('0x5b');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x5239ef[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x21')](function(){return _0x5239ef;});}return _0x5239ef;}return null;})[_0x0a9e('0x21')](respondWithResult(_0x956fbe,null))[_0x0a9e('0x29')](handleError(_0x956fbe,null));};var interaction_log=require(_0x0a9e('0x59'))(_0x0a9e('0x5a'));exports[_0x0a9e('0x33')]=function(_0x1a0677,_0x5512d1,_0x235f8f){var _0xcbc8b2={'agent':{},'channel':_0x0a9e('0x5c')};if(_0x1a0677['body']['id']){delete _0x1a0677[_0x0a9e('0x56')]['id'];}_0x1a0677['body'][_0x0a9e('0x5f')]=_0x1a0677[_0x0a9e('0x56')]['UserId']||_0x1a0677[_0x0a9e('0x60')]['id'];_0xcbc8b2[_0x0a9e('0x72')]['id']=_0x1a0677[_0x0a9e('0x56')][_0x0a9e('0x5f')];return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x1a0677[_0x0a9e('0x57')]['id'],'UserId':null}})[_0x0a9e('0x21')](handleEntityNotFound(_0x5512d1,null))[_0x0a9e('0x21')](function(_0x5b7fc3){if(_0x5b7fc3){_0xcbc8b2[_0x0a9e('0x27')]=_0x5b7fc3[_0x0a9e('0x67')]({'plain':!![]});return db[_0x0a9e('0x63')][_0x0a9e('0x55')]({'where':{'id':_0x5b7fc3['FaxInteractionId']}});}return null;})[_0x0a9e('0x21')](handleEntityNotFound(_0x5512d1,null))[_0x0a9e('0x21')](function(_0x30a4c7){if(_0x30a4c7){_0xcbc8b2[_0x0a9e('0x6a')]=_0x30a4c7[_0x0a9e('0x67')]({'plain':!![]});interaction_log[_0x0a9e('0x22')](_0x0a9e('0x73'),_0x1a0677[_0x0a9e('0x60')]['id'],_0x1a0677[_0x0a9e('0x60')][_0x0a9e('0x4c')],_0x1a0677[_0x0a9e('0x60')][_0x0a9e('0x69')],_0xcbc8b2[_0x0a9e('0x6a')]['id'],_0x1a0677[_0x0a9e('0x56')]?JSON['stringify'](_0x1a0677[_0x0a9e('0x56')]):_0x0a9e('0x6c'));return respondWithRpcPromise(_0x0a9e('0x74'),'rejectMessage',_0xcbc8b2);}return null;})[_0x0a9e('0x21')](function(_0x33dda0){if(_0x33dda0){_0x33dda0[_0x0a9e('0x27')][_0x0a9e('0x6f')]=util['format']('SIP/%s',_0x1a0677[_0x0a9e('0x60')][_0x0a9e('0x4c')]);_0x33dda0['message'][_0x0a9e('0x70')]=_0xcbc8b2['channel'];_0x33dda0[_0x0a9e('0x27')][_0x0a9e('0x71')]='reject';respondWithRpcPromise(_0x0a9e('0x75'),_0x0a9e('0x75'),{'event':_0x0a9e('0x76'),'message':_0x33dda0[_0x0a9e('0x27')]},client9002);return _0xcbc8b2;}return null;})[_0x0a9e('0x21')](respondWithResult(_0x5512d1,null))[_0x0a9e('0x29')](handleError(_0x5512d1,null));};exports[_0x0a9e('0x77')]=function(_0x482ca2,_0x2973d3){var _0x3ca9b9;return db[_0x0a9e('0x4e')][_0x0a9e('0x77')](_0x482ca2['body'],{})[_0x0a9e('0x21')](function(_0xf0db1){_0x3ca9b9=_0xf0db1;return db['CmContact'][_0x0a9e('0x78')]({'where':{'id':_0x3ca9b9['ContactId']}});})[_0x0a9e('0x21')](function(_0x2bb25a){if(_[_0x0a9e('0x64')](_0x2bb25a)){return;}else{_0x3ca9b9[_0x0a9e('0x5c')]=_0x2bb25a['fax'];return db['Attachment'][_0x0a9e('0x78')]({'where':{'id':_0x3ca9b9[_0x0a9e('0x79')]}});}})[_0x0a9e('0x21')](function(_0x5ac73d){return respondWithRpcPromise(_0x0a9e('0x7a'),_0x0a9e('0x7a'),{'FaxAccountId':_['isNil'](_0x482ca2['body'])?undefined:_0x482ca2[_0x0a9e('0x56')]['FaxAccountId'],'path':_['isNil'](_0x5ac73d)?undefined:util['format'](_0x0a9e('0x7b'),_0x5ac73d[_0x0a9e('0x7c')]),'fax':_[_0x0a9e('0x64')](_0x3ca9b9[_0x0a9e('0x5c')])?undefined:_0x3ca9b9[_0x0a9e('0x5c')],'AttachmentId':_0x3ca9b9[_0x0a9e('0x79')]},client9002);})['then'](respondWithResult(_0x2973d3,0xc9))[_0x0a9e('0x29')](handleError(_0x2973d3,null));};exports['download']=function(_0x2871c1,_0x2aabab){var _0x18ad56=path[_0x0a9e('0x7d')](config['root'],_0x0a9e('0x7e'),_0x0a9e('0x7f'),_0x0a9e('0x80'));return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x2871c1[_0x0a9e('0x57')]['id']},'include':[{'model':db[_0x0a9e('0x81')],'as':_0x0a9e('0x81')}]})[_0x0a9e('0x21')](handleEntityNotFound(_0x2aabab,null))[_0x0a9e('0x21')](function(_0x32b9bd){if(_0x32b9bd){return _0x2aabab[_0x0a9e('0x82')](path['join'](_0x18ad56,_0x32b9bd[_0x0a9e('0x81')][_0x0a9e('0x7c')]));}})['catch'](handleError(_0x2aabab,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 71826d2..41e37a4 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 _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x34e8,0x12c));var _0x834e=function(_0x5b8fd2,_0x2a6ef2){_0x5b8fd2=_0x5b8fd2-0x0;var _0x14b512=_0x34e8[_0x5b8fd2];return _0x14b512;};'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 +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe14b,0x93));var _0xbe14=function(_0x266823,_0x2d93b4){_0x266823=_0x266823-0x0;var _0x6812f5=_0xe14b[_0x266823];return _0x6812f5;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var FaxMessage=require(_0xbe14('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){FaxMessageEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);FaxMessageEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];FaxMessage[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 0c6fa6a..d923e6c 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 _0x1fcc=['FaxInteractionId','then','update','catch','utf8mb4','util','api','moment','request-promise','path','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne'];(function(_0x356633,_0x2b5e28){var _0xda2de5=function(_0x64f3a6){while(--_0x64f3a6){_0x356633['push'](_0x356633['shift']());}};_0xda2de5(++_0x2b5e28);}(_0x1fcc,0x6d));var _0xc1fc=function(_0x5e9d35,_0x382c91){_0x5e9d35=_0x5e9d35-0x0;var _0x3beb2e=_0x1fcc[_0x5e9d35];return _0x3beb2e;};'use strict';var _=require('lodash');var util=require(_0xc1fc('0x0'));var logger=require('../../config/logger')(_0xc1fc('0x1'));var moment=require(_0xc1fc('0x2'));var BPromise=require('bluebird');var rp=require(_0xc1fc('0x3'));var fs=require('fs');var path=require(_0xc1fc('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc1fc('0x5'));module[_0xc1fc('0x6')]=function(_0x44595a,_0x47b563){return _0x44595a[_0xc1fc('0x7')](_0xc1fc('0x8'),attributes,{'tableName':_0xc1fc('0x9'),'paranoid':![],'indexes':[{'name':_0xc1fc('0xa'),'fields':[_0xc1fc('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3766c9,_0x40e327,_0x47f16a){var _0x2d61ce=_0x44595a[_0xc1fc('0xc')];var _0x96165f=_0x3766c9[_0xc1fc('0xd')]({'plain':!![]});if(_0x96165f[_0xc1fc('0xe')][_0xc1fc('0xf')]()==='in'||_0x96165f['direction'][_0xc1fc('0xf')]()===_0xc1fc('0x10')&&!_0x96165f['secret']&&!_[_0xc1fc('0x11')](_0x96165f[_0xc1fc('0x12')])){_0x2d61ce[_0xc1fc('0x13')][_0xc1fc('0x14')]({'where':{'id':_0x96165f[_0xc1fc('0x15')]}})[_0xc1fc('0x16')](function(_0x40cf99){if(_0x40cf99){_0x40cf99[_0xc1fc('0x17')]({'lastMsgAt':_0x96165f['createdAt'],'lastMsgDirection':_0x96165f['direction'][_0xc1fc('0xf')]()});}})[_0xc1fc('0x18')](function(_0x485319){console['error'](_0x485319);});}_0x47f16a();}},'charset':_0xc1fc('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5d49=['body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x5d49,0x11e));var _0x95d4=function(_0x39a0be,_0x35ad99){_0x39a0be=_0x39a0be-0x0;var _0x5f385e=_0x5d49[_0x39a0be];return _0x5f385e;};'use strict';var _=require(_0x95d4('0x0'));var util=require(_0x95d4('0x1'));var logger=require(_0x95d4('0x2'))(_0x95d4('0x3'));var moment=require(_0x95d4('0x4'));var BPromise=require(_0x95d4('0x5'));var rp=require(_0x95d4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95d4('0x7'));var config=require(_0x95d4('0x8'));var attributes=require(_0x95d4('0x9'));module[_0x95d4('0xa')]=function(_0x5624d1,_0x5237a1){return _0x5624d1[_0x95d4('0xb')](_0x95d4('0xc'),attributes,{'tableName':_0x95d4('0xd'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x95d4('0xe')],'type':_0x95d4('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa3ae51,_0x594d9f,_0x2f7c9d){var _0x4b5728=_0x5624d1[_0x95d4('0x10')];var _0x50ed8b=_0xa3ae51['get']({'plain':!![]});if(_0x50ed8b[_0x95d4('0x11')][_0x95d4('0x12')]()==='in'||_0x50ed8b[_0x95d4('0x11')][_0x95d4('0x12')]()===_0x95d4('0x13')&&!_0x50ed8b[_0x95d4('0x14')]&&!_['isNil'](_0x50ed8b[_0x95d4('0x15')])){_0x4b5728[_0x95d4('0x16')]['findOne']({'where':{'id':_0x50ed8b[_0x95d4('0x17')]}})[_0x95d4('0x18')](function(_0x1506e0){if(_0x1506e0){_0x1506e0[_0x95d4('0x19')]({'lastMsgAt':_0x50ed8b[_0x95d4('0x1a')],'lastMsgDirection':_0x50ed8b['direction'][_0x95d4('0x12')]()});}})[_0x95d4('0x1b')](function(_0x1d788e){console['error'](_0x1d788e);});}_0x2f7c9d();}},'charset':_0x95d4('0x1c'),'collate':_0x95d4('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index e47a1aa..193a6f1 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 _0xcf5c=['FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','create','body','raw','UpdateFaxMessage','update','options','where','attributes','limit','debug','lodash','util','../../mysqldb','../../config/logger','rpc','http','redis','defaults','localhost','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x5a546b,_0x49512d){var _0x7e2a19=function(_0x514584){while(--_0x514584){_0x5a546b['push'](_0x5a546b['shift']());}};_0x7e2a19(++_0x49512d);}(_0xcf5c,0x14e));var _0xccf5=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xcf5c[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xccf5('0x0'));var util=require(_0xccf5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xccf5('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xccf5('0x3'))(_0xccf5('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xccf5('0x5')]({'port':0x232a});config[_0xccf5('0x6')]=_[_0xccf5('0x7')](config[_0xccf5('0x6')],{'host':_0xccf5('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xccf5('0x9'))[_0xccf5('0xa')](socket);function respondWithRpcPromise(_0x469a23,_0x3671eb,_0x11c471){return new BPromise(function(_0x2445b9,_0x3567ba){return client[_0xccf5('0xb')](_0x469a23,_0x11c471)[_0xccf5('0xc')](function(_0x2781f3){logger[_0xccf5('0xd')](_0xccf5('0xe'),_0x3671eb,_0xccf5('0xf'));logger['debug'](_0xccf5('0x10'),_0x3671eb,_0xccf5('0xf'),JSON[_0xccf5('0x11')](_0x2781f3));if(_0x2781f3[_0xccf5('0x12')]){if(_0x2781f3[_0xccf5('0x12')][_0xccf5('0x13')]===0x1f4){logger['error'](_0xccf5('0xe'),_0x3671eb,_0x2781f3[_0xccf5('0x12')][_0xccf5('0x14')]);return _0x3567ba(_0x2781f3['error'][_0xccf5('0x14')]);}logger['error'](_0xccf5('0xe'),_0x3671eb,_0x2781f3[_0xccf5('0x12')]['message']);return _0x2445b9(_0x2781f3[_0xccf5('0x12')][_0xccf5('0x14')]);}else{logger[_0xccf5('0xd')](_0xccf5('0xe'),_0x3671eb,_0xccf5('0xf'));_0x2445b9(_0x2781f3[_0xccf5('0x15')][_0xccf5('0x14')]);}})[_0xccf5('0x16')](function(_0x3f12d6){logger[_0xccf5('0x12')](_0xccf5('0xe'),_0x3671eb,_0x3f12d6);_0x3567ba(_0x3f12d6);});});}exports[_0xccf5('0x17')]=function(_0x57b908){var _0x4314e2=this;return new Promise(function(_0x10d42e,_0x467c8c){return db[_0xccf5('0x18')][_0xccf5('0x19')](_0x57b908[_0xccf5('0x1a')],{'raw':_0x57b908['options']?_0x57b908['options'][_0xccf5('0x1b')]===undefined?!![]:![]:!![]})[_0xccf5('0xc')](function(_0x22e0d3){logger['info'](_0xccf5('0x17'),_0x57b908);logger['debug'](_0xccf5('0x17'),_0x57b908,JSON[_0xccf5('0x11')](_0x22e0d3));_0x10d42e(_0x22e0d3);})['catch'](function(_0xd76e36){logger[_0xccf5('0x12')](_0xccf5('0x17'),_0xd76e36[_0xccf5('0x14')],_0x57b908);_0x467c8c(_0x4314e2[_0xccf5('0x12')](0x1f4,_0xd76e36[_0xccf5('0x14')]));});});};exports[_0xccf5('0x1c')]=function(_0x4aa257){var _0x432d7e=this;return new Promise(function(_0x98455f,_0x34a0cf){return db[_0xccf5('0x18')][_0xccf5('0x1d')](_0x4aa257['body'],{'raw':_0x4aa257[_0xccf5('0x1e')]?_0x4aa257['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4aa257[_0xccf5('0x1e')]?_0x4aa257['options'][_0xccf5('0x1f')]||null:null,'attributes':_0x4aa257[_0xccf5('0x1e')]?_0x4aa257[_0xccf5('0x1e')][_0xccf5('0x20')]||null:null,'limit':_0x4aa257[_0xccf5('0x1e')]?_0x4aa257[_0xccf5('0x1e')][_0xccf5('0x21')]||null:null})[_0xccf5('0xc')](function(_0x1aab0c){logger['info']('UpdateFaxMessage',_0x4aa257);logger[_0xccf5('0x22')](_0xccf5('0x1c'),_0x4aa257,JSON[_0xccf5('0x11')](_0x1aab0c));_0x98455f(_0x1aab0c);})[_0xccf5('0x16')](function(_0x3e5c90){logger[_0xccf5('0x12')](_0xccf5('0x1c'),_0x3e5c90['message'],_0x4aa257);_0x34a0cf(_0x432d7e[_0xccf5('0x12')](0x1f4,_0x3e5c90[_0xccf5('0x14')]));});});}; \ No newline at end of file +var _0x2bc9=['rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','FaxMessage,\x20%s,\x20%s','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','debug','update','where','attributes','limit','UpdateFaxMessage','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4a9634,_0x5dcf8d){var _0x3248f5=function(_0x3d101f){while(--_0x3d101f){_0x4a9634['push'](_0x4a9634['shift']());}};_0x3248f5(++_0x5dcf8d);}(_0x2bc9,0x1a7));var _0x92bc=function(_0x218091,_0x2bdbe5){_0x218091=_0x218091-0x0;var _0x105aa1=_0x2bc9[_0x218091];return _0x105aa1;};'use strict';var _=require('lodash');var util=require(_0x92bc('0x0'));var moment=require('moment');var BPromise=require(_0x92bc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92bc('0x2'));var db=require(_0x92bc('0x3'))['db'];var utils=require(_0x92bc('0x4'));var logger=require(_0x92bc('0x5'))(_0x92bc('0x6'));var config=require('../../config/environment');var jayson=require(_0x92bc('0x7'));var client=jayson[_0x92bc('0x8')][_0x92bc('0x9')]({'port':0x232a});config[_0x92bc('0xa')]=_['defaults'](config[_0x92bc('0xa')],{'host':_0x92bc('0xb'),'port':0x18eb});var socket=require(_0x92bc('0xc'))(new Redis(config[_0x92bc('0xa')]));require(_0x92bc('0xd'))[_0x92bc('0xe')](socket);function respondWithRpcPromise(_0x38f2ca,_0x58bb8e,_0x1ad541){return new BPromise(function(_0x3182cd,_0x4bf384){return client[_0x92bc('0xf')](_0x38f2ca,_0x1ad541)[_0x92bc('0x10')](function(_0x35ab5d){logger['info']('FaxMessage,\x20%s,\x20%s',_0x58bb8e,_0x92bc('0x11'));logger['debug'](_0x92bc('0x12'),_0x58bb8e,'request\x20sent',JSON[_0x92bc('0x13')](_0x35ab5d));if(_0x35ab5d[_0x92bc('0x14')]){if(_0x35ab5d['error'][_0x92bc('0x15')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x58bb8e,_0x35ab5d[_0x92bc('0x14')][_0x92bc('0x16')]);return _0x4bf384(_0x35ab5d[_0x92bc('0x14')][_0x92bc('0x16')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x58bb8e,_0x35ab5d[_0x92bc('0x14')][_0x92bc('0x16')]);return _0x3182cd(_0x35ab5d['error'][_0x92bc('0x16')]);}else{logger[_0x92bc('0x17')](_0x92bc('0x18'),_0x58bb8e,_0x92bc('0x11'));_0x3182cd(_0x35ab5d[_0x92bc('0x19')]['message']);}})[_0x92bc('0x1a')](function(_0x37176b){logger[_0x92bc('0x14')]('FaxMessage,\x20%s,\x20%s',_0x58bb8e,_0x37176b);_0x4bf384(_0x37176b);});});}exports['CreateFaxMessage']=function(_0x2e01bb){var _0xf9c58f=this;return new Promise(function(_0x11101d,_0x27150c){return db[_0x92bc('0x1b')][_0x92bc('0x1c')](_0x2e01bb[_0x92bc('0x1d')],{'raw':_0x2e01bb[_0x92bc('0x1e')]?_0x2e01bb[_0x92bc('0x1e')][_0x92bc('0x1f')]===undefined?!![]:![]:!![]})[_0x92bc('0x10')](function(_0x2b93de){logger[_0x92bc('0x17')](_0x92bc('0x20'),_0x2e01bb);logger[_0x92bc('0x21')]('CreateFaxMessage',_0x2e01bb,JSON[_0x92bc('0x13')](_0x2b93de));_0x11101d(_0x2b93de);})[_0x92bc('0x1a')](function(_0x20d89a){logger['error'](_0x92bc('0x20'),_0x20d89a['message'],_0x2e01bb);_0x27150c(_0xf9c58f[_0x92bc('0x14')](0x1f4,_0x20d89a[_0x92bc('0x16')]));});});};exports['UpdateFaxMessage']=function(_0x497093){var _0x6ef94b=this;return new Promise(function(_0x44bf74,_0x5b0415){return db[_0x92bc('0x1b')][_0x92bc('0x22')](_0x497093[_0x92bc('0x1d')],{'raw':_0x497093[_0x92bc('0x1e')]?_0x497093['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x497093['options']?_0x497093[_0x92bc('0x1e')][_0x92bc('0x23')]||null:null,'attributes':_0x497093[_0x92bc('0x1e')]?_0x497093[_0x92bc('0x1e')][_0x92bc('0x24')]||null:null,'limit':_0x497093[_0x92bc('0x1e')]?_0x497093[_0x92bc('0x1e')][_0x92bc('0x25')]||null:null})[_0x92bc('0x10')](function(_0x17058a){logger['info'](_0x92bc('0x26'),_0x497093);logger[_0x92bc('0x21')](_0x92bc('0x26'),_0x497093,JSON[_0x92bc('0x13')](_0x17058a));_0x44bf74(_0x17058a);})[_0x92bc('0x1a')](function(_0x583631){logger[_0x92bc('0x14')]('UpdateFaxMessage',_0x583631[_0x92bc('0x16')],_0x497093);_0x5b0415(_0x6ef94b[_0x92bc('0x14')](0x1f4,_0x583631[_0x92bc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 794834a..a67a6fa 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x38f737,_0x54f685){var _0x7afda3=function(_0x1ac1d7){while(--_0x1ac1d7){_0x38f737['push'](_0x38f737['shift']());}};_0x7afda3(++_0x54f685);}(_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 c4afba8..bae4d06 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 _0x105d=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','index','get','describe','/:id','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x2fcdef,_0x50f5e8){var _0x259114=function(_0x4e60ce){while(--_0x4e60ce){_0x2fcdef['push'](_0x2fcdef['shift']());}};_0x259114(++_0x50f5e8);}(_0x105d,0xf2));var _0xd105=function(_0xb2276b,_0x43e0e1){_0xb2276b=_0xb2276b-0x0;var _0x15ae8d=_0x105d[_0xb2276b];return _0x15ae8d;};'use strict';var multer=require(_0xd105('0x0'));var util=require(_0xd105('0x1'));var path=require(_0xd105('0x2'));var timeout=require(_0xd105('0x3'));var express=require(_0xd105('0x4'));var router=express[_0xd105('0x5')]();var auth=require(_0xd105('0x6'));var interaction=require(_0xd105('0x7'));var config=require(_0xd105('0x8'));var controller=require(_0xd105('0x9'));router['get']('/',auth[_0xd105('0xa')](),controller[_0xd105('0xb')]);router[_0xd105('0xc')]('/describe',auth[_0xd105('0xa')](),controller[_0xd105('0xd')]);router[_0xd105('0xc')](_0xd105('0xe'),auth[_0xd105('0xa')](),controller['show']);router['get']('/:id/download',auth[_0xd105('0xa')](),controller[_0xd105('0xf')]);router[_0xd105('0x10')]('/',auth[_0xd105('0xa')](),interaction[_0xd105('0x11')](_0xd105('0x12'),_0xd105('0x13')),controller[_0xd105('0x14')]);router[_0xd105('0x15')]('/:id',auth[_0xd105('0xa')](),controller[_0xd105('0x16')]);router[_0xd105('0x15')](_0xd105('0x17'),auth[_0xd105('0xa')](),controller[_0xd105('0x18')]);router[_0xd105('0x15')](_0xd105('0x19'),auth[_0xd105('0xa')](),controller[_0xd105('0x1a')]);router[_0xd105('0x1b')]('/:id',auth[_0xd105('0xa')](),controller[_0xd105('0x1c')]);module[_0xd105('0x1d')]=router; \ No newline at end of file +var _0x2f68=['multer','util','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','/:id/download','post','tracked','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0x2f68,0x1a9));var _0x82f6=function(_0x38f436,_0x135fa2){_0x38f436=_0x38f436-0x0;var _0x965d21=_0x2f68[_0x38f436];return _0x965d21;};'use strict';var multer=require(_0x82f6('0x0'));var util=require(_0x82f6('0x1'));var path=require('path');var timeout=require(_0x82f6('0x2'));var express=require(_0x82f6('0x3'));var router=express[_0x82f6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x82f6('0x5'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0x82f6('0x6')]('/',auth[_0x82f6('0x7')](),controller[_0x82f6('0x8')]);router[_0x82f6('0x6')](_0x82f6('0x9'),auth[_0x82f6('0x7')](),controller['describe']);router['get'](_0x82f6('0xa'),auth[_0x82f6('0x7')](),controller['show']);router['get'](_0x82f6('0xb'),auth[_0x82f6('0x7')](),controller['download']);router[_0x82f6('0xc')]('/',auth['isAuthenticated'](),interaction[_0x82f6('0xd')](_0x82f6('0xe'),_0x82f6('0xf')),controller['create']);router[_0x82f6('0x10')]('/:id',auth[_0x82f6('0x7')](),controller[_0x82f6('0x11')]);router['put'](_0x82f6('0x12'),auth[_0x82f6('0x7')](),controller[_0x82f6('0x13')]);router['put'](_0x82f6('0x14'),auth[_0x82f6('0x7')](),controller[_0x82f6('0x15')]);router[_0x82f6('0x16')](_0x82f6('0xa'),auth[_0x82f6('0x7')](),controller[_0x82f6('0x17')]);module[_0x82f6('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a000374..a3e58a5 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 _0xa218=['INTEGER','sequelize','exports','STRING','name','ENUM','roundrobin'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xa218,0x17b));var _0x8a21=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xa218[_0x1e4360];return _0x31e6b4;};'use strict';var Sequelize=require(_0x8a21('0x0'));module[_0x8a21('0x1')]={'name':{'type':Sequelize[_0x8a21('0x2')],'unique':_0x8a21('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8a21('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8a21('0x4')]('rrmemory','beepall',_0x8a21('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x8a21('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0b1f=['exports','STRING','name','INTEGER','roundrobin'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x0b1f,0x82));var _0xf0b1=function(_0x3d8cb5,_0x3d64ea){_0x3d8cb5=_0x3d8cb5-0x0;var _0x323059=_0x0b1f[_0x3d8cb5];return _0x323059;};'use strict';var Sequelize=require('sequelize');module[_0xf0b1('0x0')]={'name':{'type':Sequelize[_0xf0b1('0x1')],'unique':_0xf0b1('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf0b1('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xf0b1('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xf0b1('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 41f3c4b..e509bf8 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 _0x0abf=['FaxQueues','destroy','error','stack','name','send','index','FaxQueue','rawAttributes','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','params','UserFaxQueue','FaxQueueId','User','findAndCountAll','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','field','tq.TeamId','from','team_has_fax_queues','join','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','includes','all','union','isEmpty','removeAgents','userFaxQueue:remove','addAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0x0abf,0xe8));var _0xf0ab=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0abf[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0xf0ab('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf0ab('0x1'));var zipdir=require(_0xf0ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf0ab('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf0ab('0x4'));var util=require(_0xf0ab('0x5'));var path=require(_0xf0ab('0x6'));var sox=require(_0xf0ab('0x7'));var csv=require(_0xf0ab('0x8'));var ejs=require(_0xf0ab('0x9'));var fs=require('fs');var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x8'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var db=require(_0xf0ab('0x15'))['db'];config[_0xf0ab('0x16')]=_[_0xf0ab('0x17')](config[_0xf0ab('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xf0ab('0x18'))(new Redis(config[_0xf0ab('0x16')]));require(_0xf0ab('0x19'))[_0xf0ab('0x1a')](socket);function respondWithStatusCode(_0x1824ef,_0x36cabe){_0x36cabe=_0x36cabe||0xcc;return function(_0x3d7129){if(_0x3d7129){return _0x1824ef[_0xf0ab('0x1b')](_0x36cabe);}return _0x1824ef[_0xf0ab('0x1c')](_0x36cabe)[_0xf0ab('0x1d')]();};}function respondWithResult(_0x20f453,_0x221bac){_0x221bac=_0x221bac||0xc8;return function(_0x200cf5){if(_0x200cf5){return _0x20f453[_0xf0ab('0x1c')](_0x221bac)[_0xf0ab('0x1e')](_0x200cf5);}};}function respondWithFilteredResult(_0x54b0ce,_0x457465){return function(_0x9e3b47){if(_0x9e3b47){var _0x1803f0=_0x9e3b47[_0xf0ab('0x1f')],_0x1ffeb5=_0x457465[_0xf0ab('0x20')],_0x776619=_0x457465[_0xf0ab('0x20')]+_0x457465[_0xf0ab('0x21')],_0xb9a33;if(_0x776619>=_0x1803f0){_0x776619=_0x1803f0;_0xb9a33=0xc8;}else{_0xb9a33=0xce;}_0x54b0ce[_0xf0ab('0x1c')](_0xb9a33);return _0x54b0ce[_0xf0ab('0x22')](_0xf0ab('0x23'),_0x1ffeb5+'-'+_0x776619+'/'+_0x1803f0)[_0xf0ab('0x1e')](_0x9e3b47);}return null;};}function patchUpdates(_0x2cd961){return function(_0x45c1c9){try{jsonpatch['apply'](_0x45c1c9,_0x2cd961,!![]);}catch(_0x153492){return BPromise[_0xf0ab('0x24')](_0x153492);}return _0x45c1c9[_0xf0ab('0x25')]();};}function saveUpdates(_0x11ab3a,_0x3bf6a1){return function(_0x374531){if(_0x374531){return _0x374531[_0xf0ab('0x26')](_0x11ab3a)[_0xf0ab('0x27')](function(_0x36ad01){return _0x36ad01;});}return null;};}function removeEntity(_0x18bb37,_0x43119f){return function(_0x5645b2){if(_0x5645b2){return _0x5645b2['destroy']()['then'](function(){var _0x33aaa0=_0x5645b2['get']({'plain':!![]});var _0x3eca32=_0xf0ab('0x28');return db['UserProfileResource'][_0xf0ab('0x29')]({'where':{'type':_0x3eca32,'resourceId':_0x33aaa0['id']}})[_0xf0ab('0x27')](function(){return _0x5645b2;});})[_0xf0ab('0x27')](function(){_0x18bb37[_0xf0ab('0x1c')](0xcc)[_0xf0ab('0x1d')]();});}};}function handleEntityNotFound(_0x502921,_0x2d0da7){return function(_0x574ce7){if(!_0x574ce7){_0x502921['sendStatus'](0x194);}return _0x574ce7;};}function handleError(_0x1dcd2e,_0x4306c6){_0x4306c6=_0x4306c6||0x1f4;return function(_0x1b223d){logger[_0xf0ab('0x2a')](_0x1b223d[_0xf0ab('0x2b')]);if(_0x1b223d[_0xf0ab('0x2c')]){delete _0x1b223d[_0xf0ab('0x2c')];}_0x1dcd2e[_0xf0ab('0x1c')](_0x4306c6)[_0xf0ab('0x2d')](_0x1b223d);};}exports[_0xf0ab('0x2e')]=function(_0x21e8ac,_0x199753){var _0x58cbe1={},_0x1e1ffb={},_0x35973a={'count':0x0,'rows':[]};var _0x5e073a=_['map'](db[_0xf0ab('0x2f')][_0xf0ab('0x30')],function(_0x43e500){return{'name':_0x43e500['fieldName'],'type':_0x43e500['type'][_0xf0ab('0x31')]};});_0x1e1ffb['model']=_[_0xf0ab('0x32')](_0x5e073a,'name');_0x1e1ffb[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x21e8ac['query']);_0x1e1ffb['filters']=_[_0xf0ab('0x35')](_0x1e1ffb[_0xf0ab('0x36')],_0x1e1ffb[_0xf0ab('0x33')]);_0x58cbe1[_0xf0ab('0x37')]=_[_0xf0ab('0x35')](_0x1e1ffb[_0xf0ab('0x36')],qs[_0xf0ab('0x38')](_0x21e8ac[_0xf0ab('0x33')][_0xf0ab('0x38')]));_0x58cbe1[_0xf0ab('0x37')]=_0x58cbe1[_0xf0ab('0x37')][_0xf0ab('0x39')]?_0x58cbe1[_0xf0ab('0x37')]:_0x1e1ffb[_0xf0ab('0x36')];if(!_0x21e8ac['query'][_0xf0ab('0x3a')](_0xf0ab('0x3b'))){_0x58cbe1[_0xf0ab('0x21')]=qs['limit'](_0x21e8ac[_0xf0ab('0x33')][_0xf0ab('0x21')]);_0x58cbe1[_0xf0ab('0x20')]=qs['offset'](_0x21e8ac[_0xf0ab('0x33')]['offset']);}_0x58cbe1[_0xf0ab('0x3c')]=qs['sort'](_0x21e8ac[_0xf0ab('0x33')][_0xf0ab('0x3d')]);_0x58cbe1[_0xf0ab('0x3e')]=qs[_0xf0ab('0x3f')](_[_0xf0ab('0x40')](_0x21e8ac[_0xf0ab('0x33')],_0x1e1ffb['filters']));if(_0x21e8ac[_0xf0ab('0x33')][_0xf0ab('0x41')]){_0x58cbe1['where']=_[_0xf0ab('0x42')](_0x58cbe1[_0xf0ab('0x3e')],{'$or':_[_0xf0ab('0x32')](_0x5e073a,function(_0x44988b){if(_0x44988b[_0xf0ab('0x43')]!==_0xf0ab('0x44')){var _0x28c20c={};_0x28c20c[_0x44988b['name']]={'$like':'%'+_0x21e8ac[_0xf0ab('0x33')][_0xf0ab('0x41')]+'%'};return _0x28c20c;}})});}_0x58cbe1=_[_0xf0ab('0x42')]({},_0x58cbe1,_0x21e8ac['options']);var _0x1bd03b={'where':_0x58cbe1[_0xf0ab('0x3e')]};return db[_0xf0ab('0x2f')][_0xf0ab('0x1f')](_0x1bd03b)[_0xf0ab('0x27')](function(_0x553d07){_0x35973a[_0xf0ab('0x1f')]=_0x553d07;if(_0x21e8ac[_0xf0ab('0x33')][_0xf0ab('0x45')]){_0x58cbe1[_0xf0ab('0x46')]=[{'all':!![]}];}return db[_0xf0ab('0x2f')][_0xf0ab('0x47')](_0x58cbe1);})[_0xf0ab('0x27')](function(_0x413f5c){_0x35973a[_0xf0ab('0x48')]=_0x413f5c;return _0x35973a;})[_0xf0ab('0x27')](respondWithFilteredResult(_0x199753,_0x58cbe1))[_0xf0ab('0x49')](handleError(_0x199753,null));};exports[_0xf0ab('0x4a')]=function(_0x22a265,_0x5e6b6b){var _0x4c4ab9={'raw':!![],'where':{'id':_0x22a265['params']['id']}},_0x2fc677={};_0x2fc677[_0xf0ab('0x36')]=_[_0xf0ab('0x34')](db['FaxQueue'][_0xf0ab('0x30')]);_0x2fc677[_0xf0ab('0x33')]=_['keys'](_0x22a265[_0xf0ab('0x33')]);_0x2fc677[_0xf0ab('0x3f')]=_[_0xf0ab('0x35')](_0x2fc677[_0xf0ab('0x36')],_0x2fc677[_0xf0ab('0x33')]);_0x4c4ab9[_0xf0ab('0x37')]=_[_0xf0ab('0x35')](_0x2fc677[_0xf0ab('0x36')],qs[_0xf0ab('0x38')](_0x22a265[_0xf0ab('0x33')][_0xf0ab('0x38')]));_0x4c4ab9[_0xf0ab('0x37')]=_0x4c4ab9[_0xf0ab('0x37')][_0xf0ab('0x39')]?_0x4c4ab9['attributes']:_0x2fc677['model'];if(_0x22a265[_0xf0ab('0x33')]['includeAll']){_0x4c4ab9['include']=[{'all':!![]}];}_0x4c4ab9=_['merge']({},_0x4c4ab9,_0x22a265[_0xf0ab('0x4b')]);return db[_0xf0ab('0x2f')][_0xf0ab('0x4c')](_0x4c4ab9)[_0xf0ab('0x27')](handleEntityNotFound(_0x5e6b6b,null))[_0xf0ab('0x27')](respondWithResult(_0x5e6b6b,null))[_0xf0ab('0x49')](handleError(_0x5e6b6b,null));};exports[_0xf0ab('0x4d')]=function(_0x1a0f21,_0xc6862b){return db[_0xf0ab('0x2f')][_0xf0ab('0x4d')](_0x1a0f21[_0xf0ab('0x4e')],{})['then'](function(_0x393c9a){var _0x41065c=_0x1a0f21[_0xf0ab('0x4f')][_0xf0ab('0x50')]({'plain':!![]});if(!_0x41065c)throw new Error(_0xf0ab('0x51'));if(_0x41065c[_0xf0ab('0x52')]===_0xf0ab('0x4f')){var _0x2e6c5e=_0x393c9a['get']({'plain':!![]});var _0x5ac047='FaxQueues';return db[_0xf0ab('0x53')][_0xf0ab('0x4c')]({'where':{'name':_0x5ac047,'userProfileId':_0x41065c['userProfileId']},'raw':!![]})[_0xf0ab('0x27')](function(_0x22c7ae){if(_0x22c7ae&&_0x22c7ae['autoAssociation']===0x0){return db[_0xf0ab('0x54')][_0xf0ab('0x4d')]({'name':_0x2e6c5e[_0xf0ab('0x2c')],'resourceId':_0x2e6c5e['id'],'type':_0x22c7ae[_0xf0ab('0x2c')],'sectionId':_0x22c7ae['id']},{})[_0xf0ab('0x27')](function(){return _0x393c9a;});}else{return _0x393c9a;}})[_0xf0ab('0x49')](function(_0x26508b){logger['error'](_0xf0ab('0x55'),_0x26508b);throw _0x26508b;});}return _0x393c9a;})['then'](respondWithResult(_0xc6862b,0xc9))[_0xf0ab('0x49')](handleError(_0xc6862b,null));};exports['update']=function(_0x1a402b,_0x5c721a){if(_0x1a402b['body']['id']){delete _0x1a402b[_0xf0ab('0x4e')]['id'];}return db['FaxQueue'][_0xf0ab('0x4c')]({'where':{'id':_0x1a402b['params']['id']}})[_0xf0ab('0x27')](handleEntityNotFound(_0x5c721a,null))['then'](saveUpdates(_0x1a402b[_0xf0ab('0x4e')],null))[_0xf0ab('0x27')](respondWithResult(_0x5c721a,null))[_0xf0ab('0x49')](handleError(_0x5c721a,null));};exports['destroy']=function(_0x47f270,_0x57b05f){return db[_0xf0ab('0x2f')][_0xf0ab('0x4c')]({'where':{'id':_0x47f270['params']['id']}})['then'](handleEntityNotFound(_0x57b05f,null))[_0xf0ab('0x27')](removeEntity(_0x57b05f,null))[_0xf0ab('0x49')](handleError(_0x57b05f,null));};exports[_0xf0ab('0x56')]=function(_0x4ead7d,_0x227597){return db[_0xf0ab('0x2f')][_0xf0ab('0x56')]()[_0xf0ab('0x27')](respondWithResult(_0x227597,null))[_0xf0ab('0x49')](handleError(_0x227597,null));};exports[_0xf0ab('0x57')]=function(_0x1e6a4e,_0x4d80a6,_0x41ed17){var _0x5b24e3={'raw':!![],'where':{}},_0x185b3c={},_0x61d3db;return db[_0xf0ab('0x2f')][_0xf0ab('0x58')]({'where':{'id':_0x1e6a4e[_0xf0ab('0x59')]['id']}})[_0xf0ab('0x27')](handleEntityNotFound(_0x4d80a6,null))[_0xf0ab('0x27')](function(_0x1f11aa){if(_0x1f11aa){_0x61d3db=_0x1f11aa[_0xf0ab('0x50')]({'plain':!![]});_0x185b3c[_0xf0ab('0x36')]=_['keys'](db[_0xf0ab('0x5a')][_0xf0ab('0x30')]);_0x185b3c[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x1e6a4e[_0xf0ab('0x33')]);_0x185b3c[_0xf0ab('0x3f')]=_[_0xf0ab('0x35')](_0x185b3c[_0xf0ab('0x36')],_0x185b3c[_0xf0ab('0x33')]);_0x5b24e3['attributes']=_['intersection'](_0x185b3c[_0xf0ab('0x36')],qs[_0xf0ab('0x38')](_0x1e6a4e[_0xf0ab('0x33')]['fields']));_0x5b24e3[_0xf0ab('0x37')]=_0x5b24e3[_0xf0ab('0x37')][_0xf0ab('0x39')]?_0x5b24e3['attributes']:_0x185b3c[_0xf0ab('0x36')];if(!_0x1e6a4e[_0xf0ab('0x33')][_0xf0ab('0x3a')](_0xf0ab('0x3b'))){_0x5b24e3[_0xf0ab('0x21')]=qs['limit'](_0x1e6a4e[_0xf0ab('0x33')][_0xf0ab('0x21')]);_0x5b24e3[_0xf0ab('0x20')]=qs[_0xf0ab('0x20')](_0x1e6a4e[_0xf0ab('0x33')][_0xf0ab('0x20')]);}_0x5b24e3[_0xf0ab('0x3c')]=qs[_0xf0ab('0x3d')](_0x1e6a4e[_0xf0ab('0x33')][_0xf0ab('0x3d')]);_0x5b24e3[_0xf0ab('0x3e')]=qs[_0xf0ab('0x3f')](_[_0xf0ab('0x40')](_0x1e6a4e['query'],_0x185b3c['filters']));_0x5b24e3[_0xf0ab('0x3e')][_0xf0ab('0x5b')]=_0x1f11aa['id'];if(_0x1e6a4e[_0xf0ab('0x33')]['filter']){_0x5b24e3[_0xf0ab('0x3e')]=_['merge'](_0x5b24e3[_0xf0ab('0x3e')],{'$or':_[_0xf0ab('0x32')](_0x5b24e3[_0xf0ab('0x37')],function(_0x52e201){var _0x26cd0a={};_0x26cd0a[_0x52e201]={'$like':'%'+_0x1e6a4e['query']['filter']+'%'};return _0x26cd0a;})});}_0x5b24e3=_[_0xf0ab('0x42')]({},_0x5b24e3,_0x1e6a4e[_0xf0ab('0x4b')]);return db[_0xf0ab('0x5a')]['findAll'](_0x5b24e3);}})[_0xf0ab('0x27')](function(_0x92ade0){if(_0x92ade0){return db[_0xf0ab('0x5c')][_0xf0ab('0x5d')]({'where':{'id':_['map'](_0x92ade0,'UserId'),'role':'agent'},'attributes':['id',_0xf0ab('0x2c'),_0xf0ab('0x5e'),_0xf0ab('0x5f'),_0xf0ab('0x60')]});}})[_0xf0ab('0x27')](function(_0x1c6163){if(_0x1c6163){return{'count':_0x1c6163[_0xf0ab('0x1f')],'rows':_[_0xf0ab('0x32')](_0x1c6163[_0xf0ab('0x48')],function(_0xc59f93){return{'membername':_0xc59f93[_0xf0ab('0x2c')],'UserId':_0xc59f93['id'],'queue_name':_0x61d3db['name'],'FaxQueueId':_0x61d3db['id'],'interface':util[_0xf0ab('0x61')](_0xf0ab('0x62'),_0xf0ab('0x63'),_0xc59f93[_0xf0ab('0x2c')]),'penalty':0x0,'paused':_0xc59f93[_0xf0ab('0x5e')],'createdAt':_0xc59f93[_0xf0ab('0x60')],'updatedAt':_0xc59f93[_0xf0ab('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf0ab('0x27')](respondWithFilteredResult(_0x4d80a6,_0x5b24e3))['catch'](handleError(_0x4d80a6,null));};exports[_0xf0ab('0x64')]=function(_0x1276df,_0x4c8e95,_0x515e2f){var _0x4b1a28={};var _0x331433={};var _0x1a00fd;var _0x23864d;return db[_0xf0ab('0x2f')][_0xf0ab('0x58')]({'where':{'id':_0x1276df[_0xf0ab('0x59')]['id']}})['then'](handleEntityNotFound(_0x4c8e95,null))[_0xf0ab('0x27')](function(_0x5e7d84){if(_0x5e7d84){_0x1a00fd=_0x5e7d84;_0x331433[_0xf0ab('0x36')]=_['keys'](db[_0xf0ab('0x65')]['rawAttributes']);_0x331433[_0xf0ab('0x33')]=_['keys'](_0x1276df['query']);_0x331433[_0xf0ab('0x3f')]=_[_0xf0ab('0x35')](_0x331433[_0xf0ab('0x36')],_0x331433[_0xf0ab('0x33')]);_0x4b1a28[_0xf0ab('0x37')]=_[_0xf0ab('0x35')](_0x331433[_0xf0ab('0x36')],qs[_0xf0ab('0x38')](_0x1276df[_0xf0ab('0x33')][_0xf0ab('0x38')]));_0x4b1a28[_0xf0ab('0x37')]=_0x4b1a28[_0xf0ab('0x37')][_0xf0ab('0x39')]?_0x4b1a28['attributes']:_0x331433[_0xf0ab('0x36')];_0x4b1a28[_0xf0ab('0x3c')]=qs[_0xf0ab('0x3d')](_0x1276df[_0xf0ab('0x33')][_0xf0ab('0x3d')]);_0x4b1a28[_0xf0ab('0x3e')]=qs[_0xf0ab('0x3f')](_[_0xf0ab('0x40')](_0x1276df[_0xf0ab('0x33')],_0x331433[_0xf0ab('0x3f')]));if(_0x1276df[_0xf0ab('0x33')][_0xf0ab('0x41')]){_0x4b1a28['where']=_[_0xf0ab('0x42')](_0x4b1a28[_0xf0ab('0x3e')],{'$or':_[_0xf0ab('0x32')](_0x4b1a28[_0xf0ab('0x37')],function(_0x5e9205){var _0x1afade={};_0x1afade[_0x5e9205]={'$like':'%'+_0x1276df[_0xf0ab('0x33')][_0xf0ab('0x41')]+'%'};return _0x1afade;})});}_0x4b1a28=_[_0xf0ab('0x42')]({},_0x4b1a28,_0x1276df[_0xf0ab('0x4b')]);return _0x1a00fd['getTeams'](_0x4b1a28);}})[_0xf0ab('0x27')](function(_0x33bb1){if(_0x33bb1){_0x23864d=_0x33bb1['length'];if(!_0x1276df[_0xf0ab('0x33')]['hasOwnProperty'](_0xf0ab('0x3b'))){_0x4b1a28[_0xf0ab('0x21')]=qs['limit'](_0x1276df[_0xf0ab('0x33')][_0xf0ab('0x21')]);_0x4b1a28['offset']=qs['offset'](_0x1276df[_0xf0ab('0x33')]['offset']);}return _0x1a00fd[_0xf0ab('0x64')](_0x4b1a28);}})[_0xf0ab('0x27')](function(_0x499b8d){if(_0x499b8d){return _0x499b8d?{'count':_0x23864d,'rows':_0x499b8d}:null;}})['then'](respondWithResult(_0x4c8e95,null))['catch'](handleError(_0x4c8e95,null));};exports[_0xf0ab('0x66')]=function(_0x7e2b70,_0x365dea,_0x26715c){var _0x49c89f=_0x7e2b70[_0xf0ab('0x4e')][_0xf0ab('0x67')];return db[_0xf0ab('0x65')][_0xf0ab('0x47')]({'where':{'id':_0x49c89f},'attributes':['id'],'include':[{'model':db[_0xf0ab('0x5c')],'as':'Agents','attributes':['id','name',_0xf0ab('0x68'),_0xf0ab('0x69'),'interface'],'raw':!![]}]})['then'](function(_0x211796){if(_0x211796){var _0x36ac93=_[_0xf0ab('0x6a')](_0x211796,function(_0x42c860){var _0x24eeeb=_0x42c860[_0xf0ab('0x50')]({'plain':!![]});return _0x24eeeb[_0xf0ab('0x6b')];});return db[_0xf0ab('0x2f')][_0xf0ab('0x4c')]({'where':{'id':_0x7e2b70[_0xf0ab('0x59')]['id']}})[_0xf0ab('0x27')](function(_0x52eca9){return db['sequelize'][_0xf0ab('0x6c')](function(_0x5a67ea){return _0x52eca9[_0xf0ab('0x66')](_0x49c89f,{'transaction':_0x5a67ea})[_0xf0ab('0x27')](function(){return BPromise[_0xf0ab('0x6d')](_0x36ac93,function(_0x1c4d2a){return db['UserFaxQueue'][_0xf0ab('0x6e')]({'where':{'UserId':_0x1c4d2a['id'],'FaxQueueId':_0x7e2b70[_0xf0ab('0x59')]['id']},'transaction':_0x5a67ea});});})[_0xf0ab('0x27')](function(){_0x36ac93[_0xf0ab('0x6f')](function(_0x392f83){socket[_0xf0ab('0x70')](_0xf0ab('0x71'),{'UserId':_0x392f83['id'],'FaxQueueId':_0x52eca9['id']});});});});});}})[_0xf0ab('0x27')](respondWithStatusCode(_0x365dea,null))[_0xf0ab('0x49')](handleError(_0x365dea,null));};exports[_0xf0ab('0x72')]=function(_0x8671e7,_0x37e01f,_0x3fb1ff){return db[_0xf0ab('0x65')]['findAll']({'where':{'id':_0x8671e7[_0xf0ab('0x33')][_0xf0ab('0x67')]},'attributes':['id'],'include':[{'model':db[_0xf0ab('0x5c')],'as':_0xf0ab('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xf0ab('0x27')](handleEntityNotFound(_0x37e01f,null))[_0xf0ab('0x27')](function(_0x611cf7){var _0x4abb8f=_['map'](_0x611cf7,'id');var _0xc01930=[];var _0x200a20=[];var _0x434685=squel['select']();_0x434685[_0xf0ab('0x73')](_0xf0ab('0x74'))[_0xf0ab('0x75')](_0xf0ab('0x76'),'tq')[_0xf0ab('0x77')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf0ab('0x3e')]('FaxQueueId\x20=\x20?',_0x8671e7[_0xf0ab('0x59')]['id']);for(var _0x3867b3=0x0;_0x3867b3<_0x611cf7['length'];_0x3867b3+=0x1){let _0x319c9f=_0x611cf7[_0x3867b3];for(var _0x223090=0x0;_0x223090<_0x319c9f[_0xf0ab('0x6b')][_0xf0ab('0x39')];_0x223090+=0x1){let _0x263cec=_0x319c9f['Agents'][_0x223090];var _0x327321=_0x434685[_0xf0ab('0x78')]();_0x327321[_0xf0ab('0x3e')](_0xf0ab('0x79'),_0x263cec['id']);_0x200a20[_0xf0ab('0x7a')](db['sequelize'][_0xf0ab('0x33')](_0x327321[_0xf0ab('0x7b')](),{'type':db[_0xf0ab('0x7c')][_0xf0ab('0x7d')][_0xf0ab('0x7e')]})['then'](function(_0x144ae1){if(_0x144ae1[_0xf0ab('0x39')]===0x1){return _0x263cec['id'];}else{var _0xc7f8c7=_['every'](_[_0xf0ab('0x32')](_0x144ae1,'TeamId'),function(_0x4f8add){return _[_0xf0ab('0x7f')](_0x4abb8f,_0x4f8add);});if(_0xc7f8c7){return _0x263cec['id'];}}}));}}return BPromise[_0xf0ab('0x80')](_0x200a20)[_0xf0ab('0x27')](function(_0x511e42){_0xc01930=_(_0xc01930)[_0xf0ab('0x81')](_0x511e42)['compact']()['value']();return db[_0xf0ab('0x2f')]['find']({'where':{'id':_0x8671e7['params']['id']}})[_0xf0ab('0x27')](function(_0xe8a1aa){return db['sequelize']['transaction'](function(_0x5d5f3a){return _0xe8a1aa['removeTeams'](_0x8671e7[_0xf0ab('0x33')][_0xf0ab('0x67')],{'transaction':_0x5d5f3a})[_0xf0ab('0x27')](function(){if(!_[_0xf0ab('0x82')](_0xc01930)){return _0xe8a1aa[_0xf0ab('0x83')](_0xc01930,{'transaction':_0x5d5f3a});}})['then'](function(){_0xc01930[_0xf0ab('0x6f')](function(_0x2dd8c0){socket[_0xf0ab('0x70')](_0xf0ab('0x84'),{'UserId':_0x2dd8c0,'FaxQueueId':_0xe8a1aa['id']});});});});});});})[_0xf0ab('0x27')](respondWithStatusCode(_0x37e01f,null))[_0xf0ab('0x49')](handleError(_0x37e01f,null));};exports[_0xf0ab('0x85')]=function(_0x4ac031,_0x16dca7,_0x11e94d){return db[_0xf0ab('0x2f')][_0xf0ab('0x4c')]({'where':{'id':_0x4ac031[_0xf0ab('0x59')]['id']}})[_0xf0ab('0x27')](handleEntityNotFound(_0x16dca7,null))['then'](function(_0x47382a){if(_0x47382a){return _0x47382a[_0xf0ab('0x85')](_0x4ac031[_0xf0ab('0x4e')][_0xf0ab('0x67')],_['omit'](_0x4ac031[_0xf0ab('0x4e')],[_0xf0ab('0x67'),'id'])||{})['spread'](function(_0x4a0a43){for(var _0x4461c2=0x0;_0x4461c2<_0x4ac031[_0xf0ab('0x4e')][_0xf0ab('0x67')][_0xf0ab('0x39')];_0x4461c2+=0x1){socket[_0xf0ab('0x70')](_0xf0ab('0x71'),{'UserId':_0x4ac031[_0xf0ab('0x4e')][_0xf0ab('0x67')][_0x4461c2],'FaxQueueId':_0x4ac031['params']['id']});}return _0x4a0a43;});}})[_0xf0ab('0x27')](respondWithResult(_0x16dca7,null))['catch'](handleError(_0x16dca7,null));};exports['removeAgents']=function(_0x2e7aff,_0x1e9aab,_0x40b95d){return db[_0xf0ab('0x2f')][_0xf0ab('0x4c')]({'where':{'id':_0x2e7aff[_0xf0ab('0x59')]['id']}})[_0xf0ab('0x27')](handleEntityNotFound(_0x1e9aab,null))[_0xf0ab('0x27')](function(_0x574a75){if(_0x574a75){return _0x574a75[_0xf0ab('0x83')](_0x2e7aff[_0xf0ab('0x33')][_0xf0ab('0x67')])[_0xf0ab('0x27')](function(){if(_[_0xf0ab('0x86')](_0x2e7aff[_0xf0ab('0x33')][_0xf0ab('0x67')])){for(var _0x2a5dcb=0x0;_0x2a5dcb<_0x2e7aff[_0xf0ab('0x33')][_0xf0ab('0x67')]['length'];_0x2a5dcb+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x2e7aff[_0xf0ab('0x33')]['ids'][_0x2a5dcb]),'FaxQueueId':Number(_0x2e7aff['params']['id'])});}}else{socket[_0xf0ab('0x70')](_0xf0ab('0x84'),{'UserId':Number(_0x2e7aff[_0xf0ab('0x33')][_0xf0ab('0x67')]),'FaxQueueId':Number(_0x2e7aff[_0xf0ab('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x1e9aab,null))[_0xf0ab('0x49')](handleError(_0x1e9aab,null));};exports[_0xf0ab('0x87')]=function(_0x1ae976,_0x1654ee,_0x2dcaf5){var _0x1c7ced={};var _0x3130ea={};var _0x44d791;var _0x47e6ab;return db[_0xf0ab('0x2f')]['findOne']({'where':{'id':_0x1ae976[_0xf0ab('0x59')]['id']}})[_0xf0ab('0x27')](handleEntityNotFound(_0x1654ee,null))['then'](function(_0x2af10c){if(_0x2af10c){_0x44d791=_0x2af10c;_0x3130ea[_0xf0ab('0x36')]=_[_0xf0ab('0x34')](db[_0xf0ab('0x5c')][_0xf0ab('0x30')]);_0x3130ea[_0xf0ab('0x33')]=_[_0xf0ab('0x34')](_0x1ae976[_0xf0ab('0x33')]);_0x3130ea[_0xf0ab('0x3f')]=_['intersection'](_0x3130ea[_0xf0ab('0x36')],_0x3130ea[_0xf0ab('0x33')]);_0x1c7ced['attributes']=_[_0xf0ab('0x35')](_0x3130ea[_0xf0ab('0x36')],qs[_0xf0ab('0x38')](_0x1ae976[_0xf0ab('0x33')]['fields']));_0x1c7ced['attributes']=_0x1c7ced[_0xf0ab('0x37')][_0xf0ab('0x39')]?_0x1c7ced['attributes']:_0x3130ea[_0xf0ab('0x36')];_0x1c7ced[_0xf0ab('0x3c')]=qs[_0xf0ab('0x3d')](_0x1ae976[_0xf0ab('0x33')][_0xf0ab('0x3d')]);_0x1c7ced[_0xf0ab('0x3e')]=qs['filters'](_[_0xf0ab('0x40')](_0x1ae976['query'],_0x3130ea[_0xf0ab('0x3f')]));if(_0x1ae976[_0xf0ab('0x33')][_0xf0ab('0x41')]){_0x1c7ced['where']=_[_0xf0ab('0x42')](_0x1c7ced[_0xf0ab('0x3e')],{'$or':_[_0xf0ab('0x32')](_0x1c7ced[_0xf0ab('0x37')],function(_0x3b4538){var _0x25851a={};_0x25851a[_0x3b4538]={'$like':'%'+_0x1ae976[_0xf0ab('0x33')][_0xf0ab('0x41')]+'%'};return _0x25851a;})});}_0x1c7ced=_[_0xf0ab('0x42')]({},_0x1c7ced,_0x1ae976['options']);return _0x44d791['getAgents'](_0x1c7ced);}})[_0xf0ab('0x27')](function(_0x1ce59e){if(_0x1ce59e){_0x47e6ab=_0x1ce59e[_0xf0ab('0x39')];if(!_0x1ae976[_0xf0ab('0x33')][_0xf0ab('0x3a')](_0xf0ab('0x3b'))){_0x1c7ced[_0xf0ab('0x21')]=qs[_0xf0ab('0x21')](_0x1ae976[_0xf0ab('0x33')][_0xf0ab('0x21')]);_0x1c7ced['offset']=qs[_0xf0ab('0x20')](_0x1ae976[_0xf0ab('0x33')][_0xf0ab('0x20')]);}return _0x44d791[_0xf0ab('0x87')](_0x1c7ced);}})[_0xf0ab('0x27')](function(_0x461d30){if(_0x461d30){return _0x461d30?{'count':_0x47e6ab,'rows':_0x461d30}:null;}})['then'](respondWithResult(_0x1654ee,null))[_0xf0ab('0x49')](handleError(_0x1654ee,null));}; \ No newline at end of file +var _0x25a9=['update','then','destroy','get','FaxQueues','UserProfileResource','stack','name','send','index','FaxQueue','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','params','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','body','describe','getMembers','findOne','keys','UserFaxQueue','pick','User','findAndCountAll','UserId','agent','faxPause','updatedAt','format','SIP','createdAt','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','Agents','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','removeTeams','isEmpty','removeAgents','emit','addAgents','omit','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','set','apply','reject','save'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x25a9,0xf1));var _0x925a=function(_0x2397a6,_0x70972e){_0x2397a6=_0x2397a6-0x0;var _0x59b695=_0x25a9[_0x2397a6];return _0x59b695;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x925a('0x0'));var rimraf=require(_0x925a('0x1'));var zipdir=require(_0x925a('0x2'));var jsonpatch=require(_0x925a('0x3'));var rp=require(_0x925a('0x4'));var moment=require('moment');var BPromise=require(_0x925a('0x5'));var Mustache=require(_0x925a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x925a('0x7'));var csv=require('to-csv');var ejs=require(_0x925a('0x8'));var fs=require('fs');var _=require(_0x925a('0x9'));var squel=require(_0x925a('0xa'));var crypto=require(_0x925a('0xb'));var jsforce=require(_0x925a('0xc'));var deskjs=require(_0x925a('0xd'));var toCsv=require(_0x925a('0xe'));var querystring=require('querystring');var Papa=require(_0x925a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x925a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x925a('0x11'))(_0x925a('0x12'));var utils=require(_0x925a('0x13'));var config=require(_0x925a('0x14'));var db=require(_0x925a('0x15'))['db'];config[_0x925a('0x16')]=_['defaults'](config[_0x925a('0x16')],{'host':_0x925a('0x17'),'port':0x18eb});var socket=require(_0x925a('0x18'))(new Redis(config[_0x925a('0x16')]));require(_0x925a('0x19'))[_0x925a('0x1a')](socket);function respondWithStatusCode(_0x26e2c0,_0x530360){_0x530360=_0x530360||0xcc;return function(_0x1d5e5c){if(_0x1d5e5c){return _0x26e2c0[_0x925a('0x1b')](_0x530360);}return _0x26e2c0[_0x925a('0x1c')](_0x530360)[_0x925a('0x1d')]();};}function respondWithResult(_0x494bc5,_0xa915f0){_0xa915f0=_0xa915f0||0xc8;return function(_0x308baf){if(_0x308baf){return _0x494bc5['status'](_0xa915f0)[_0x925a('0x1e')](_0x308baf);}};}function respondWithFilteredResult(_0x1d1f17,_0x3a08f0){return function(_0x396954){if(_0x396954){var _0x54fa22=_0x396954[_0x925a('0x1f')],_0xc05d6f=_0x3a08f0[_0x925a('0x20')],_0x2643ad=_0x3a08f0['offset']+_0x3a08f0['limit'],_0x421cde;if(_0x2643ad>=_0x54fa22){_0x2643ad=_0x54fa22;_0x421cde=0xc8;}else{_0x421cde=0xce;}_0x1d1f17[_0x925a('0x1c')](_0x421cde);return _0x1d1f17[_0x925a('0x21')]('Content-Range',_0xc05d6f+'-'+_0x2643ad+'/'+_0x54fa22)[_0x925a('0x1e')](_0x396954);}return null;};}function patchUpdates(_0x374dd0){return function(_0x3af1af){try{jsonpatch[_0x925a('0x22')](_0x3af1af,_0x374dd0,!![]);}catch(_0xd04e8){return BPromise[_0x925a('0x23')](_0xd04e8);}return _0x3af1af[_0x925a('0x24')]();};}function saveUpdates(_0x3458d5,_0x5a0683){return function(_0x296bcb){if(_0x296bcb){return _0x296bcb[_0x925a('0x25')](_0x3458d5)[_0x925a('0x26')](function(_0x5be491){return _0x5be491;});}return null;};}function removeEntity(_0x3e8be6,_0x6079b9){return function(_0x4dc6c2){if(_0x4dc6c2){return _0x4dc6c2[_0x925a('0x27')]()['then'](function(){var _0x33ca0c=_0x4dc6c2[_0x925a('0x28')]({'plain':!![]});var _0x22c2dc=_0x925a('0x29');return db[_0x925a('0x2a')][_0x925a('0x27')]({'where':{'type':_0x22c2dc,'resourceId':_0x33ca0c['id']}})[_0x925a('0x26')](function(){return _0x4dc6c2;});})[_0x925a('0x26')](function(){_0x3e8be6[_0x925a('0x1c')](0xcc)[_0x925a('0x1d')]();});}};}function handleEntityNotFound(_0x47f8a8,_0xb1a056){return function(_0x43683c){if(!_0x43683c){_0x47f8a8[_0x925a('0x1b')](0x194);}return _0x43683c;};}function handleError(_0x417c7f,_0x5cb909){_0x5cb909=_0x5cb909||0x1f4;return function(_0x296337){logger['error'](_0x296337[_0x925a('0x2b')]);if(_0x296337['name']){delete _0x296337[_0x925a('0x2c')];}_0x417c7f[_0x925a('0x1c')](_0x5cb909)[_0x925a('0x2d')](_0x296337);};}exports[_0x925a('0x2e')]=function(_0x28e81b,_0x156372){var _0x1c951b={},_0x34e311={},_0x5f289a={'count':0x0,'rows':[]};var _0x1e85fc=_['map'](db[_0x925a('0x2f')][_0x925a('0x30')],function(_0xe9c070){return{'name':_0xe9c070['fieldName'],'type':_0xe9c070[_0x925a('0x31')][_0x925a('0x32')]};});_0x34e311[_0x925a('0x33')]=_[_0x925a('0x34')](_0x1e85fc,_0x925a('0x2c'));_0x34e311[_0x925a('0x35')]=_['keys'](_0x28e81b[_0x925a('0x35')]);_0x34e311[_0x925a('0x36')]=_[_0x925a('0x37')](_0x34e311[_0x925a('0x33')],_0x34e311['query']);_0x1c951b['attributes']=_[_0x925a('0x37')](_0x34e311[_0x925a('0x33')],qs[_0x925a('0x38')](_0x28e81b['query'][_0x925a('0x38')]));_0x1c951b[_0x925a('0x39')]=_0x1c951b[_0x925a('0x39')][_0x925a('0x3a')]?_0x1c951b['attributes']:_0x34e311['model'];if(!_0x28e81b[_0x925a('0x35')][_0x925a('0x3b')](_0x925a('0x3c'))){_0x1c951b[_0x925a('0x3d')]=qs[_0x925a('0x3d')](_0x28e81b[_0x925a('0x35')]['limit']);_0x1c951b[_0x925a('0x20')]=qs['offset'](_0x28e81b['query'][_0x925a('0x20')]);}_0x1c951b[_0x925a('0x3e')]=qs['sort'](_0x28e81b[_0x925a('0x35')][_0x925a('0x3f')]);_0x1c951b['where']=qs[_0x925a('0x36')](_['pick'](_0x28e81b['query'],_0x34e311['filters']));if(_0x28e81b[_0x925a('0x35')][_0x925a('0x40')]){_0x1c951b[_0x925a('0x41')]=_[_0x925a('0x42')](_0x1c951b[_0x925a('0x41')],{'$or':_[_0x925a('0x34')](_0x1e85fc,function(_0x599c1b){if(_0x599c1b[_0x925a('0x31')]!==_0x925a('0x43')){var _0x38bff9={};_0x38bff9[_0x599c1b[_0x925a('0x2c')]]={'$like':'%'+_0x28e81b[_0x925a('0x35')][_0x925a('0x40')]+'%'};return _0x38bff9;}})});}_0x1c951b=_[_0x925a('0x42')]({},_0x1c951b,_0x28e81b[_0x925a('0x44')]);var _0x33e071={'where':_0x1c951b[_0x925a('0x41')]};return db[_0x925a('0x2f')][_0x925a('0x1f')](_0x33e071)['then'](function(_0x5d9a1d){_0x5f289a[_0x925a('0x1f')]=_0x5d9a1d;if(_0x28e81b[_0x925a('0x35')][_0x925a('0x45')]){_0x1c951b['include']=[{'all':!![]}];}return db[_0x925a('0x2f')][_0x925a('0x46')](_0x1c951b);})[_0x925a('0x26')](function(_0x18fc3c){_0x5f289a['rows']=_0x18fc3c;return _0x5f289a;})[_0x925a('0x26')](respondWithFilteredResult(_0x156372,_0x1c951b))['catch'](handleError(_0x156372,null));};exports['show']=function(_0x3aa159,_0x3da366){var _0x59a75e={'raw':!![],'where':{'id':_0x3aa159[_0x925a('0x47')]['id']}},_0x5bd7f6={};_0x5bd7f6['model']=_['keys'](db[_0x925a('0x2f')][_0x925a('0x30')]);_0x5bd7f6[_0x925a('0x35')]=_['keys'](_0x3aa159[_0x925a('0x35')]);_0x5bd7f6[_0x925a('0x36')]=_[_0x925a('0x37')](_0x5bd7f6[_0x925a('0x33')],_0x5bd7f6[_0x925a('0x35')]);_0x59a75e[_0x925a('0x39')]=_[_0x925a('0x37')](_0x5bd7f6[_0x925a('0x33')],qs['fields'](_0x3aa159[_0x925a('0x35')][_0x925a('0x38')]));_0x59a75e[_0x925a('0x39')]=_0x59a75e[_0x925a('0x39')][_0x925a('0x3a')]?_0x59a75e['attributes']:_0x5bd7f6[_0x925a('0x33')];if(_0x3aa159[_0x925a('0x35')][_0x925a('0x45')]){_0x59a75e[_0x925a('0x48')]=[{'all':!![]}];}_0x59a75e=_[_0x925a('0x42')]({},_0x59a75e,_0x3aa159[_0x925a('0x44')]);return db['FaxQueue'][_0x925a('0x49')](_0x59a75e)[_0x925a('0x26')](handleEntityNotFound(_0x3da366,null))[_0x925a('0x26')](respondWithResult(_0x3da366,null))['catch'](handleError(_0x3da366,null));};exports[_0x925a('0x4a')]=function(_0x22db0b,_0xc9d4f2){return db['FaxQueue']['create'](_0x22db0b['body'],{})[_0x925a('0x26')](function(_0x1a1fba){var _0x128e38=_0x22db0b[_0x925a('0x4b')][_0x925a('0x28')]({'plain':!![]});if(!_0x128e38)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x128e38[_0x925a('0x4c')]===_0x925a('0x4b')){var _0x3c7543=_0x1a1fba[_0x925a('0x28')]({'plain':!![]});var _0x4fc0b6=_0x925a('0x29');return db[_0x925a('0x4d')][_0x925a('0x49')]({'where':{'name':_0x4fc0b6,'userProfileId':_0x128e38[_0x925a('0x4e')]},'raw':!![]})[_0x925a('0x26')](function(_0x4941b8){if(_0x4941b8&&_0x4941b8[_0x925a('0x4f')]===0x0){return db[_0x925a('0x2a')][_0x925a('0x4a')]({'name':_0x3c7543['name'],'resourceId':_0x3c7543['id'],'type':_0x4941b8[_0x925a('0x2c')],'sectionId':_0x4941b8['id']},{})[_0x925a('0x26')](function(){return _0x1a1fba;});}else{return _0x1a1fba;}})['catch'](function(_0xe98b59){logger[_0x925a('0x50')](_0x925a('0x51'),_0xe98b59);throw _0xe98b59;});}return _0x1a1fba;})['then'](respondWithResult(_0xc9d4f2,0xc9))[_0x925a('0x52')](handleError(_0xc9d4f2,null));};exports['update']=function(_0x2bf8ee,_0x379941){if(_0x2bf8ee[_0x925a('0x53')]['id']){delete _0x2bf8ee['body']['id'];}return db['FaxQueue']['find']({'where':{'id':_0x2bf8ee['params']['id']}})[_0x925a('0x26')](handleEntityNotFound(_0x379941,null))['then'](saveUpdates(_0x2bf8ee[_0x925a('0x53')],null))[_0x925a('0x26')](respondWithResult(_0x379941,null))[_0x925a('0x52')](handleError(_0x379941,null));};exports[_0x925a('0x27')]=function(_0x2fdb18,_0x16c368){return db[_0x925a('0x2f')]['find']({'where':{'id':_0x2fdb18[_0x925a('0x47')]['id']}})[_0x925a('0x26')](handleEntityNotFound(_0x16c368,null))[_0x925a('0x26')](removeEntity(_0x16c368,null))[_0x925a('0x52')](handleError(_0x16c368,null));};exports[_0x925a('0x54')]=function(_0x498f61,_0x4b8b7c){return db[_0x925a('0x2f')][_0x925a('0x54')]()['then'](respondWithResult(_0x4b8b7c,null))[_0x925a('0x52')](handleError(_0x4b8b7c,null));};exports[_0x925a('0x55')]=function(_0x3fc611,_0x6988bc,_0x2b3133){var _0x484097={'raw':!![],'where':{}},_0x47611b={},_0x564909;return db['FaxQueue'][_0x925a('0x56')]({'where':{'id':_0x3fc611[_0x925a('0x47')]['id']}})['then'](handleEntityNotFound(_0x6988bc,null))[_0x925a('0x26')](function(_0x4678cf){if(_0x4678cf){_0x564909=_0x4678cf[_0x925a('0x28')]({'plain':!![]});_0x47611b[_0x925a('0x33')]=_[_0x925a('0x57')](db[_0x925a('0x58')][_0x925a('0x30')]);_0x47611b[_0x925a('0x35')]=_[_0x925a('0x57')](_0x3fc611[_0x925a('0x35')]);_0x47611b[_0x925a('0x36')]=_[_0x925a('0x37')](_0x47611b['model'],_0x47611b[_0x925a('0x35')]);_0x484097[_0x925a('0x39')]=_['intersection'](_0x47611b[_0x925a('0x33')],qs[_0x925a('0x38')](_0x3fc611['query'][_0x925a('0x38')]));_0x484097[_0x925a('0x39')]=_0x484097[_0x925a('0x39')][_0x925a('0x3a')]?_0x484097[_0x925a('0x39')]:_0x47611b['model'];if(!_0x3fc611['query'][_0x925a('0x3b')](_0x925a('0x3c'))){_0x484097['limit']=qs['limit'](_0x3fc611[_0x925a('0x35')][_0x925a('0x3d')]);_0x484097[_0x925a('0x20')]=qs['offset'](_0x3fc611[_0x925a('0x35')][_0x925a('0x20')]);}_0x484097[_0x925a('0x3e')]=qs[_0x925a('0x3f')](_0x3fc611['query'][_0x925a('0x3f')]);_0x484097['where']=qs[_0x925a('0x36')](_[_0x925a('0x59')](_0x3fc611[_0x925a('0x35')],_0x47611b[_0x925a('0x36')]));_0x484097[_0x925a('0x41')]['FaxQueueId']=_0x4678cf['id'];if(_0x3fc611[_0x925a('0x35')][_0x925a('0x40')]){_0x484097['where']=_[_0x925a('0x42')](_0x484097['where'],{'$or':_[_0x925a('0x34')](_0x484097[_0x925a('0x39')],function(_0x33edfd){var _0x280410={};_0x280410[_0x33edfd]={'$like':'%'+_0x3fc611[_0x925a('0x35')][_0x925a('0x40')]+'%'};return _0x280410;})});}_0x484097=_[_0x925a('0x42')]({},_0x484097,_0x3fc611[_0x925a('0x44')]);return db[_0x925a('0x58')]['findAll'](_0x484097);}})[_0x925a('0x26')](function(_0x2ac150){if(_0x2ac150){return db[_0x925a('0x5a')][_0x925a('0x5b')]({'where':{'id':_['map'](_0x2ac150,_0x925a('0x5c')),'role':_0x925a('0x5d')},'attributes':['id',_0x925a('0x2c'),_0x925a('0x5e'),_0x925a('0x5f'),'createdAt']});}})[_0x925a('0x26')](function(_0x3c83b6){if(_0x3c83b6){return{'count':_0x3c83b6[_0x925a('0x1f')],'rows':_['map'](_0x3c83b6['rows'],function(_0x11e642){return{'membername':_0x11e642[_0x925a('0x2c')],'UserId':_0x11e642['id'],'queue_name':_0x564909[_0x925a('0x2c')],'FaxQueueId':_0x564909['id'],'interface':util[_0x925a('0x60')]('%s/%s',_0x925a('0x61'),_0x11e642[_0x925a('0x2c')]),'penalty':0x0,'paused':_0x11e642['faxPause'],'createdAt':_0x11e642[_0x925a('0x62')],'updatedAt':_0x11e642[_0x925a('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x925a('0x26')](respondWithFilteredResult(_0x6988bc,_0x484097))['catch'](handleError(_0x6988bc,null));};exports['getTeams']=function(_0x2866da,_0x40f31,_0x240d51){var _0x15e640={};var _0xe51355={};var _0xd9ddca;var _0x15a48b;return db['FaxQueue'][_0x925a('0x56')]({'where':{'id':_0x2866da[_0x925a('0x47')]['id']}})[_0x925a('0x26')](handleEntityNotFound(_0x40f31,null))[_0x925a('0x26')](function(_0x4d0e6c){if(_0x4d0e6c){_0xd9ddca=_0x4d0e6c;_0xe51355[_0x925a('0x33')]=_[_0x925a('0x57')](db['Team']['rawAttributes']);_0xe51355[_0x925a('0x35')]=_[_0x925a('0x57')](_0x2866da['query']);_0xe51355[_0x925a('0x36')]=_['intersection'](_0xe51355['model'],_0xe51355[_0x925a('0x35')]);_0x15e640['attributes']=_[_0x925a('0x37')](_0xe51355[_0x925a('0x33')],qs['fields'](_0x2866da[_0x925a('0x35')][_0x925a('0x38')]));_0x15e640['attributes']=_0x15e640[_0x925a('0x39')][_0x925a('0x3a')]?_0x15e640[_0x925a('0x39')]:_0xe51355[_0x925a('0x33')];_0x15e640[_0x925a('0x3e')]=qs[_0x925a('0x3f')](_0x2866da[_0x925a('0x35')][_0x925a('0x3f')]);_0x15e640['where']=qs[_0x925a('0x36')](_[_0x925a('0x59')](_0x2866da['query'],_0xe51355['filters']));if(_0x2866da[_0x925a('0x35')][_0x925a('0x40')]){_0x15e640[_0x925a('0x41')]=_[_0x925a('0x42')](_0x15e640[_0x925a('0x41')],{'$or':_[_0x925a('0x34')](_0x15e640[_0x925a('0x39')],function(_0xcf8bcc){var _0x24acf6={};_0x24acf6[_0xcf8bcc]={'$like':'%'+_0x2866da[_0x925a('0x35')][_0x925a('0x40')]+'%'};return _0x24acf6;})});}_0x15e640=_[_0x925a('0x42')]({},_0x15e640,_0x2866da[_0x925a('0x44')]);return _0xd9ddca[_0x925a('0x63')](_0x15e640);}})['then'](function(_0x4fa9a1){if(_0x4fa9a1){_0x15a48b=_0x4fa9a1['length'];if(!_0x2866da['query']['hasOwnProperty']('nolimit')){_0x15e640[_0x925a('0x3d')]=qs[_0x925a('0x3d')](_0x2866da[_0x925a('0x35')][_0x925a('0x3d')]);_0x15e640[_0x925a('0x20')]=qs['offset'](_0x2866da[_0x925a('0x35')][_0x925a('0x20')]);}return _0xd9ddca[_0x925a('0x63')](_0x15e640);}})[_0x925a('0x26')](function(_0x18ae22){if(_0x18ae22){return _0x18ae22?{'count':_0x15a48b,'rows':_0x18ae22}:null;}})[_0x925a('0x26')](respondWithResult(_0x40f31,null))[_0x925a('0x52')](handleError(_0x40f31,null));};exports[_0x925a('0x64')]=function(_0xeb622b,_0x547a2e,_0x5cf26e){var _0x4448ed=_0xeb622b['body'][_0x925a('0x65')];return db[_0x925a('0x66')][_0x925a('0x46')]({'where':{'id':_0x4448ed},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x925a('0x2c'),_0x925a('0x67'),_0x925a('0x68'),_0x925a('0x69')],'raw':!![]}]})[_0x925a('0x26')](function(_0x4f237c){if(_0x4f237c){var _0x53792f=_[_0x925a('0x6a')](_0x4f237c,function(_0xc9c963){var _0x5cb7f6=_0xc9c963['get']({'plain':!![]});return _0x5cb7f6['Agents'];});return db[_0x925a('0x2f')][_0x925a('0x49')]({'where':{'id':_0xeb622b[_0x925a('0x47')]['id']}})[_0x925a('0x26')](function(_0xc6c833){return db[_0x925a('0x6b')][_0x925a('0x6c')](function(_0x5243d1){return _0xc6c833[_0x925a('0x64')](_0x4448ed,{'transaction':_0x5243d1})[_0x925a('0x26')](function(){return BPromise[_0x925a('0x6d')](_0x53792f,function(_0x198718){return db[_0x925a('0x58')][_0x925a('0x6e')]({'where':{'UserId':_0x198718['id'],'FaxQueueId':_0xeb622b[_0x925a('0x47')]['id']},'transaction':_0x5243d1});});})[_0x925a('0x26')](function(){_0x53792f[_0x925a('0x6f')](function(_0xe31d13){socket['emit']('userFaxQueue:save',{'UserId':_0xe31d13['id'],'FaxQueueId':_0xc6c833['id']});});});});});}})['then'](respondWithStatusCode(_0x547a2e,null))[_0x925a('0x52')](handleError(_0x547a2e,null));};exports['removeTeams']=function(_0xdb4b68,_0x22f23d,_0x241ab4){return db[_0x925a('0x66')]['findAll']({'where':{'id':_0xdb4b68[_0x925a('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x925a('0x5a')],'as':_0x925a('0x70'),'attributes':['id'],'raw':!![]}]})[_0x925a('0x26')](handleEntityNotFound(_0x22f23d,null))[_0x925a('0x26')](function(_0x1a1e10){var _0x103c76=_[_0x925a('0x34')](_0x1a1e10,'id');var _0x1c48a6=[];var _0x21f312=[];var _0x3b31c6=squel[_0x925a('0x71')]();_0x3b31c6['field'](_0x925a('0x72'))[_0x925a('0x73')]('team_has_fax_queues','tq')[_0x925a('0x74')](_0x925a('0x75'),'ut',_0x925a('0x76'))[_0x925a('0x41')](_0x925a('0x77'),_0xdb4b68[_0x925a('0x47')]['id']);for(var _0x572f3f=0x0;_0x572f3f<_0x1a1e10[_0x925a('0x3a')];_0x572f3f+=0x1){let _0x3ccb3f=_0x1a1e10[_0x572f3f];for(var _0xcc0fba=0x0;_0xcc0fba<_0x3ccb3f[_0x925a('0x70')][_0x925a('0x3a')];_0xcc0fba+=0x1){let _0x5c0904=_0x3ccb3f['Agents'][_0xcc0fba];var _0x3ee0c0=_0x3b31c6[_0x925a('0x78')]();_0x3ee0c0[_0x925a('0x41')]('ut.UserId\x20=\x20?',_0x5c0904['id']);_0x21f312[_0x925a('0x79')](db[_0x925a('0x6b')]['query'](_0x3ee0c0[_0x925a('0x7a')](),{'type':db['sequelize'][_0x925a('0x7b')][_0x925a('0x7c')]})[_0x925a('0x26')](function(_0x276e8c){if(_0x276e8c[_0x925a('0x3a')]===0x1){return _0x5c0904['id'];}else{var _0x2129fe=_[_0x925a('0x7d')](_['map'](_0x276e8c,_0x925a('0x7e')),function(_0x123475){return _['includes'](_0x103c76,_0x123475);});if(_0x2129fe){return _0x5c0904['id'];}}}));}}return BPromise[_0x925a('0x7f')](_0x21f312)[_0x925a('0x26')](function(_0x1e45eb){_0x1c48a6=_(_0x1c48a6)['union'](_0x1e45eb)[_0x925a('0x80')]()['value']();return db['FaxQueue'][_0x925a('0x49')]({'where':{'id':_0xdb4b68[_0x925a('0x47')]['id']}})['then'](function(_0x5cd485){return db[_0x925a('0x6b')][_0x925a('0x6c')](function(_0x3305a2){return _0x5cd485[_0x925a('0x81')](_0xdb4b68['query'][_0x925a('0x65')],{'transaction':_0x3305a2})['then'](function(){if(!_[_0x925a('0x82')](_0x1c48a6)){return _0x5cd485[_0x925a('0x83')](_0x1c48a6,{'transaction':_0x3305a2});}})['then'](function(){_0x1c48a6[_0x925a('0x6f')](function(_0x4d569b){socket[_0x925a('0x84')]('userFaxQueue:remove',{'UserId':_0x4d569b,'FaxQueueId':_0x5cd485['id']});});});});});});})[_0x925a('0x26')](respondWithStatusCode(_0x22f23d,null))[_0x925a('0x52')](handleError(_0x22f23d,null));};exports[_0x925a('0x85')]=function(_0x285328,_0x21e8fe,_0x1d48f5){return db['FaxQueue'][_0x925a('0x49')]({'where':{'id':_0x285328['params']['id']}})['then'](handleEntityNotFound(_0x21e8fe,null))['then'](function(_0x193add){if(_0x193add){return _0x193add[_0x925a('0x85')](_0x285328['body'][_0x925a('0x65')],_[_0x925a('0x86')](_0x285328[_0x925a('0x53')],[_0x925a('0x65'),'id'])||{})['spread'](function(_0x2c61e0){for(var _0x2368d2=0x0;_0x2368d2<_0x285328[_0x925a('0x53')][_0x925a('0x65')]['length'];_0x2368d2+=0x1){socket['emit'](_0x925a('0x87'),{'UserId':_0x285328[_0x925a('0x53')][_0x925a('0x65')][_0x2368d2],'FaxQueueId':_0x285328[_0x925a('0x47')]['id']});}return _0x2c61e0;});}})[_0x925a('0x26')](respondWithResult(_0x21e8fe,null))[_0x925a('0x52')](handleError(_0x21e8fe,null));};exports['removeAgents']=function(_0x2dc37a,_0x1871b7,_0x7e52e2){return db[_0x925a('0x2f')][_0x925a('0x49')]({'where':{'id':_0x2dc37a[_0x925a('0x47')]['id']}})[_0x925a('0x26')](handleEntityNotFound(_0x1871b7,null))[_0x925a('0x26')](function(_0x2cb63e){if(_0x2cb63e){return _0x2cb63e[_0x925a('0x83')](_0x2dc37a[_0x925a('0x35')]['ids'])[_0x925a('0x26')](function(){if(_[_0x925a('0x88')](_0x2dc37a[_0x925a('0x35')][_0x925a('0x65')])){for(var _0x401d76=0x0;_0x401d76<_0x2dc37a['query'][_0x925a('0x65')]['length'];_0x401d76+=0x1){socket['emit'](_0x925a('0x89'),{'UserId':Number(_0x2dc37a['query']['ids'][_0x401d76]),'FaxQueueId':Number(_0x2dc37a[_0x925a('0x47')]['id'])});}}else{socket[_0x925a('0x84')](_0x925a('0x89'),{'UserId':Number(_0x2dc37a[_0x925a('0x35')]['ids']),'FaxQueueId':Number(_0x2dc37a[_0x925a('0x47')]['id'])});}});}})[_0x925a('0x26')](respondWithStatusCode(_0x1871b7,null))['catch'](handleError(_0x1871b7,null));};exports[_0x925a('0x8a')]=function(_0x30bcda,_0x5b46a0,_0x34f4ea){var _0xab7770={};var _0x2813ac={};var _0x256508;var _0x242b25;return db[_0x925a('0x2f')][_0x925a('0x56')]({'where':{'id':_0x30bcda[_0x925a('0x47')]['id']}})[_0x925a('0x26')](handleEntityNotFound(_0x5b46a0,null))[_0x925a('0x26')](function(_0x38749c){if(_0x38749c){_0x256508=_0x38749c;_0x2813ac[_0x925a('0x33')]=_[_0x925a('0x57')](db[_0x925a('0x5a')][_0x925a('0x30')]);_0x2813ac[_0x925a('0x35')]=_[_0x925a('0x57')](_0x30bcda['query']);_0x2813ac[_0x925a('0x36')]=_[_0x925a('0x37')](_0x2813ac['model'],_0x2813ac['query']);_0xab7770[_0x925a('0x39')]=_[_0x925a('0x37')](_0x2813ac[_0x925a('0x33')],qs['fields'](_0x30bcda[_0x925a('0x35')][_0x925a('0x38')]));_0xab7770['attributes']=_0xab7770[_0x925a('0x39')]['length']?_0xab7770[_0x925a('0x39')]:_0x2813ac['model'];_0xab7770[_0x925a('0x3e')]=qs[_0x925a('0x3f')](_0x30bcda['query'][_0x925a('0x3f')]);_0xab7770[_0x925a('0x41')]=qs[_0x925a('0x36')](_[_0x925a('0x59')](_0x30bcda['query'],_0x2813ac['filters']));if(_0x30bcda[_0x925a('0x35')][_0x925a('0x40')]){_0xab7770[_0x925a('0x41')]=_[_0x925a('0x42')](_0xab7770[_0x925a('0x41')],{'$or':_['map'](_0xab7770[_0x925a('0x39')],function(_0x19613d){var _0x5bc8ee={};_0x5bc8ee[_0x19613d]={'$like':'%'+_0x30bcda[_0x925a('0x35')][_0x925a('0x40')]+'%'};return _0x5bc8ee;})});}_0xab7770=_[_0x925a('0x42')]({},_0xab7770,_0x30bcda[_0x925a('0x44')]);return _0x256508[_0x925a('0x8a')](_0xab7770);}})['then'](function(_0x57f04f){if(_0x57f04f){_0x242b25=_0x57f04f['length'];if(!_0x30bcda[_0x925a('0x35')]['hasOwnProperty'](_0x925a('0x3c'))){_0xab7770[_0x925a('0x3d')]=qs['limit'](_0x30bcda[_0x925a('0x35')][_0x925a('0x3d')]);_0xab7770[_0x925a('0x20')]=qs['offset'](_0x30bcda[_0x925a('0x35')][_0x925a('0x20')]);}return _0x256508['getAgents'](_0xab7770);}})[_0x925a('0x26')](function(_0x208f23){if(_0x208f23){return _0x208f23?{'count':_0x242b25,'rows':_0x208f23}:null;}})[_0x925a('0x26')](respondWithResult(_0x5b46a0,null))[_0x925a('0x52')](handleError(_0x5b46a0,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 9f14be7..e2e8c9f 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 _0xc83d=['hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc83d,0x110));var _0xdc83=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc83d[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require(_0xdc83('0x0'));var FaxQueue=require(_0xdc83('0x1'))['db'][_0xdc83('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xdc83('0x3')](0x0);var events={'afterCreate':_0xdc83('0x4'),'afterUpdate':_0xdc83('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38323b){return function(_0x226ed0,_0x35aa88,_0xb1c624){FaxQueueEvents[_0xdc83('0x6')](_0x38323b+':'+_0x226ed0['id'],_0x226ed0);FaxQueueEvents['emit'](_0x38323b,_0x226ed0);_0xb1c624(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xdc83('0x7')](e,emitEvent(event));}}module[_0xdc83('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x7641=['FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','../../mysqldb'];(function(_0x3369e1,_0x1c0e52){var _0x4fb68f=function(_0x538c32){while(--_0x538c32){_0x3369e1['push'](_0x3369e1['shift']());}};_0x4fb68f(++_0x1c0e52);}(_0x7641,0x1c6));var _0x1764=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x7641[_0x2b5eae];return _0x5f3ac9;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x1764('0x0'))['db'][_0x1764('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1764('0x2')](0x0);var events={'afterCreate':_0x1764('0x3'),'afterUpdate':_0x1764('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5bdcbf){return function(_0x1fedd5,_0x312cb4,_0x5cbbc8){FaxQueueEvents[_0x1764('0x5')](_0x5bdcbf+':'+_0x1fedd5['id'],_0x1fedd5);FaxQueueEvents[_0x1764('0x5')](_0x5bdcbf,_0x1fedd5);_0x5cbbc8(null);};}for(var e in events){if(events[_0x1764('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 6cd6b87..3d343c4 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 _0xd44e=['path','define','FaxQueue','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x349a2c,_0x4655dc){var _0x93d984=function(_0x32869c){while(--_0x32869c){_0x349a2c['push'](_0x349a2c['shift']());}};_0x93d984(++_0x4655dc);}(_0xd44e,0x133));var _0xed44=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd44e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xed44('0x0'));var util=require('util');var logger=require(_0xed44('0x1'))('api');var moment=require(_0xed44('0x2'));var BPromise=require(_0xed44('0x3'));var rp=require(_0xed44('0x4'));var fs=require('fs');var path=require(_0xed44('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module['exports']=function(_0x19ceb3,_0x70fd4b){return _0x19ceb3[_0xed44('0x6')](_0xed44('0x7'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0d6=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0d6,0x151));var _0x6c0d=function(_0x1143e2,_0x4e8628){_0x1143e2=_0x1143e2-0x0;var _0x3faf5e=_0xc0d6[_0x1143e2];return _0x3faf5e;};'use strict';var _=require(_0x6c0d('0x0'));var util=require(_0x6c0d('0x1'));var logger=require(_0x6c0d('0x2'))(_0x6c0d('0x3'));var moment=require('moment');var BPromise=require(_0x6c0d('0x4'));var rp=require(_0x6c0d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c0d('0x6'));var config=require(_0x6c0d('0x7'));var attributes=require(_0x6c0d('0x8'));module[_0x6c0d('0x9')]=function(_0x39a669,_0x4b2119){return _0x39a669[_0x6c0d('0xa')](_0x6c0d('0xb'),attributes,{'tableName':_0x6c0d('0xc'),'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 47adad0..eed216e 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 _0xc6a1=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','model','map','then','debug','ShowFaxQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x5d84d6,_0x1a4671){var _0x2cd0f5=function(_0x243d25){while(--_0x243d25){_0x5d84d6['push'](_0x5d84d6['shift']());}};_0x2cd0f5(++_0x1a4671);}(_0xc6a1,0x1f0));var _0x1c6a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc6a1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1c6a('0x0'));var util=require(_0x1c6a('0x1'));var moment=require(_0x1c6a('0x2'));var BPromise=require('bluebird');var rs=require(_0x1c6a('0x3'));var fs=require('fs');var Redis=require(_0x1c6a('0x4'));var db=require(_0x1c6a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1c6a('0x6'));var config=require(_0x1c6a('0x7'));var jayson=require(_0x1c6a('0x8'));var client=jayson[_0x1c6a('0x9')][_0x1c6a('0xa')]({'port':0x232a});config[_0x1c6a('0xb')]=_[_0x1c6a('0xc')](config[_0x1c6a('0xb')],{'host':_0x1c6a('0xd'),'port':0x18eb});var socket=require(_0x1c6a('0xe'))(new Redis(config[_0x1c6a('0xb')]));require(_0x1c6a('0xf'))[_0x1c6a('0x10')](socket);function respondWithRpcPromise(_0xadb91b,_0x484b1a,_0x39a455){return new BPromise(function(_0x11bae0,_0x33d8c6){return client[_0x1c6a('0x11')](_0xadb91b,_0x39a455)['then'](function(_0x2f8f6f){logger[_0x1c6a('0x12')](_0x1c6a('0x13'),_0x484b1a,_0x1c6a('0x14'));logger['debug'](_0x1c6a('0x15'),_0x484b1a,_0x1c6a('0x14'),JSON[_0x1c6a('0x16')](_0x2f8f6f));if(_0x2f8f6f[_0x1c6a('0x17')]){if(_0x2f8f6f[_0x1c6a('0x17')][_0x1c6a('0x18')]===0x1f4){logger['error'](_0x1c6a('0x13'),_0x484b1a,_0x2f8f6f[_0x1c6a('0x17')][_0x1c6a('0x19')]);return _0x33d8c6(_0x2f8f6f['error'][_0x1c6a('0x19')]);}logger[_0x1c6a('0x17')](_0x1c6a('0x13'),_0x484b1a,_0x2f8f6f['error']['message']);return _0x11bae0(_0x2f8f6f['error'][_0x1c6a('0x19')]);}else{logger[_0x1c6a('0x12')](_0x1c6a('0x13'),_0x484b1a,_0x1c6a('0x14'));_0x11bae0(_0x2f8f6f[_0x1c6a('0x1a')][_0x1c6a('0x19')]);}})[_0x1c6a('0x1b')](function(_0x3cdc23){logger[_0x1c6a('0x17')](_0x1c6a('0x13'),_0x484b1a,_0x3cdc23);_0x33d8c6(_0x3cdc23);});});}exports[_0x1c6a('0x1c')]=function(_0x20ebec){var _0x198b65=this;return new Promise(function(_0x12665d,_0x12a34c){return db[_0x1c6a('0x1d')]['findAll']({'raw':_0x20ebec[_0x1c6a('0x1e')]?_0x20ebec[_0x1c6a('0x1e')][_0x1c6a('0x1f')]===undefined?!![]:![]:!![],'where':_0x20ebec['options']?_0x20ebec['options'][_0x1c6a('0x20')]||null:null,'attributes':_0x20ebec[_0x1c6a('0x1e')]?_0x20ebec[_0x1c6a('0x1e')][_0x1c6a('0x21')]||null:null,'limit':_0x20ebec[_0x1c6a('0x1e')]?_0x20ebec['options'][_0x1c6a('0x22')]||null:null,'include':_0x20ebec['options']?_0x20ebec[_0x1c6a('0x1e')]['include']?_['map'](_0x20ebec[_0x1c6a('0x1e')][_0x1c6a('0x23')],function(_0x3a4211){return{'model':db[_0x3a4211[_0x1c6a('0x24')]],'as':_0x3a4211['as'],'attributes':_0x3a4211[_0x1c6a('0x21')],'include':_0x3a4211['include']?_[_0x1c6a('0x25')](_0x3a4211['include'],function(_0x50eb6c){return{'model':db[_0x50eb6c[_0x1c6a('0x24')]],'as':_0x50eb6c['as'],'attributes':_0x50eb6c[_0x1c6a('0x21')],'include':_0x50eb6c[_0x1c6a('0x23')]?_['map'](_0x50eb6c['include'],function(_0x250ad6){return{'model':db[_0x250ad6['model']],'as':_0x250ad6['as'],'attributes':_0x250ad6[_0x1c6a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1c6a('0x26')](function(_0x286094){logger['info'](_0x1c6a('0x1c'),_0x20ebec);logger[_0x1c6a('0x27')]('GetFaxQueue',_0x20ebec,JSON[_0x1c6a('0x16')](_0x286094));_0x12665d(_0x286094);})[_0x1c6a('0x1b')](function(_0x33859c){logger[_0x1c6a('0x17')](_0x1c6a('0x1c'),_0x33859c[_0x1c6a('0x19')],_0x20ebec);_0x12a34c(_0x198b65[_0x1c6a('0x17')](0x1f4,_0x33859c['message']));});});};exports[_0x1c6a('0x28')]=function(_0x5e6787){var _0x45dd5a=this;return new Promise(function(_0x353cbd,_0x53901f){return db[_0x1c6a('0x1d')][_0x1c6a('0x29')]({'raw':_0x5e6787[_0x1c6a('0x1e')]?_0x5e6787['options']['raw']===undefined?!![]:![]:!![],'where':_0x5e6787[_0x1c6a('0x1e')]?_0x5e6787[_0x1c6a('0x1e')][_0x1c6a('0x20')]||null:null,'attributes':_0x5e6787[_0x1c6a('0x1e')]?_0x5e6787[_0x1c6a('0x1e')][_0x1c6a('0x21')]||null:null,'include':_0x5e6787['options']?_0x5e6787[_0x1c6a('0x1e')]['include']?_['map'](_0x5e6787[_0x1c6a('0x1e')][_0x1c6a('0x23')],function(_0x1a8cfe){return{'model':db[_0x1a8cfe['model']],'as':_0x1a8cfe['as'],'attributes':_0x1a8cfe[_0x1c6a('0x21')],'include':_0x1a8cfe['include']?_[_0x1c6a('0x25')](_0x1a8cfe['include'],function(_0x2dda78){return{'model':db[_0x2dda78[_0x1c6a('0x24')]],'as':_0x2dda78['as'],'attributes':_0x2dda78[_0x1c6a('0x21')],'include':_0x2dda78[_0x1c6a('0x23')]?_[_0x1c6a('0x25')](_0x2dda78['include'],function(_0x43f452){return{'model':db[_0x43f452[_0x1c6a('0x24')]],'as':_0x43f452['as'],'attributes':_0x43f452[_0x1c6a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1c6a('0x26')](function(_0xfb6cc8){logger[_0x1c6a('0x12')]('ShowFaxQueue',_0x5e6787);logger[_0x1c6a('0x27')](_0x1c6a('0x28'),_0x5e6787,JSON[_0x1c6a('0x16')](_0xfb6cc8));_0x353cbd(_0xfb6cc8);})['catch'](function(_0x298191){logger['error'](_0x1c6a('0x28'),_0x298191[_0x1c6a('0x19')],_0x5e6787);_0x53901f(_0x45dd5a[_0x1c6a('0x17')](0x1f4,_0x298191[_0x1c6a('0x19')]));});});}; \ No newline at end of file +var _0xb749=['message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','ShowFaxQueue','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','redis','localhost','socket.io-emitter','./faxQueue.socket','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x59f7e4,_0x2bf748){var _0x16af8d=function(_0x404470){while(--_0x404470){_0x59f7e4['push'](_0x59f7e4['shift']());}};_0x16af8d(++_0x2bf748);}(_0xb749,0xe1));var _0x9b74=function(_0x4737ed,_0x5c3f84){_0x4737ed=_0x4737ed-0x0;var _0x37e484=_0xb749[_0x4737ed];return _0x37e484;};'use strict';var _=require('lodash');var util=require(_0x9b74('0x0'));var moment=require(_0x9b74('0x1'));var BPromise=require(_0x9b74('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b74('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b74('0x4'));var logger=require(_0x9b74('0x5'))(_0x9b74('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x9b74('0x7')]=_['defaults'](config[_0x9b74('0x7')],{'host':_0x9b74('0x8'),'port':0x18eb});var socket=require(_0x9b74('0x9'))(new Redis(config[_0x9b74('0x7')]));require(_0x9b74('0xa'))['register'](socket);function respondWithRpcPromise(_0x3dc02e,_0x3e22ad,_0x470227){return new BPromise(function(_0x15d1e5,_0x138d40){return client['request'](_0x3dc02e,_0x470227)[_0x9b74('0xb')](function(_0x1f9dd7){logger[_0x9b74('0xc')](_0x9b74('0xd'),_0x3e22ad,'request\x20sent');logger[_0x9b74('0xe')](_0x9b74('0xf'),_0x3e22ad,_0x9b74('0x10'),JSON[_0x9b74('0x11')](_0x1f9dd7));if(_0x1f9dd7['error']){if(_0x1f9dd7[_0x9b74('0x12')][_0x9b74('0x13')]===0x1f4){logger[_0x9b74('0x12')]('FaxQueue,\x20%s,\x20%s',_0x3e22ad,_0x1f9dd7[_0x9b74('0x12')][_0x9b74('0x14')]);return _0x138d40(_0x1f9dd7[_0x9b74('0x12')][_0x9b74('0x14')]);}logger[_0x9b74('0x12')](_0x9b74('0xd'),_0x3e22ad,_0x1f9dd7[_0x9b74('0x12')]['message']);return _0x15d1e5(_0x1f9dd7[_0x9b74('0x12')][_0x9b74('0x14')]);}else{logger[_0x9b74('0xc')](_0x9b74('0xd'),_0x3e22ad,_0x9b74('0x10'));_0x15d1e5(_0x1f9dd7[_0x9b74('0x15')][_0x9b74('0x14')]);}})[_0x9b74('0x16')](function(_0x164695){logger[_0x9b74('0x12')](_0x9b74('0xd'),_0x3e22ad,_0x164695);_0x138d40(_0x164695);});});}exports[_0x9b74('0x17')]=function(_0x4e3e6b){var _0x53c361=this;return new Promise(function(_0x5a9f25,_0x430566){return db[_0x9b74('0x18')][_0x9b74('0x19')]({'raw':_0x4e3e6b['options']?_0x4e3e6b[_0x9b74('0x1a')][_0x9b74('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e3e6b[_0x9b74('0x1a')]?_0x4e3e6b[_0x9b74('0x1a')][_0x9b74('0x1c')]||null:null,'attributes':_0x4e3e6b[_0x9b74('0x1a')]?_0x4e3e6b['options'][_0x9b74('0x1d')]||null:null,'limit':_0x4e3e6b[_0x9b74('0x1a')]?_0x4e3e6b[_0x9b74('0x1a')][_0x9b74('0x1e')]||null:null,'include':_0x4e3e6b[_0x9b74('0x1a')]?_0x4e3e6b['options']['include']?_[_0x9b74('0x1f')](_0x4e3e6b[_0x9b74('0x1a')][_0x9b74('0x20')],function(_0x23200f){return{'model':db[_0x23200f[_0x9b74('0x21')]],'as':_0x23200f['as'],'attributes':_0x23200f[_0x9b74('0x1d')],'include':_0x23200f[_0x9b74('0x20')]?_['map'](_0x23200f[_0x9b74('0x20')],function(_0x205141){return{'model':db[_0x205141[_0x9b74('0x21')]],'as':_0x205141['as'],'attributes':_0x205141['attributes'],'include':_0x205141['include']?_[_0x9b74('0x1f')](_0x205141['include'],function(_0x4e5db1){return{'model':db[_0x4e5db1[_0x9b74('0x21')]],'as':_0x4e5db1['as'],'attributes':_0x4e5db1[_0x9b74('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9b74('0xb')](function(_0x1879df){logger['info']('GetFaxQueue',_0x4e3e6b);logger[_0x9b74('0xe')](_0x9b74('0x17'),_0x4e3e6b,JSON['stringify'](_0x1879df));_0x5a9f25(_0x1879df);})[_0x9b74('0x16')](function(_0x48a12e){logger[_0x9b74('0x12')](_0x9b74('0x17'),_0x48a12e[_0x9b74('0x14')],_0x4e3e6b);_0x430566(_0x53c361[_0x9b74('0x12')](0x1f4,_0x48a12e[_0x9b74('0x14')]));});});};exports[_0x9b74('0x22')]=function(_0x43c7c8){var _0x364205=this;return new Promise(function(_0xab23e7,_0x147858){return db[_0x9b74('0x18')]['find']({'raw':_0x43c7c8[_0x9b74('0x1a')]?_0x43c7c8[_0x9b74('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x43c7c8['options']?_0x43c7c8[_0x9b74('0x1a')][_0x9b74('0x1c')]||null:null,'attributes':_0x43c7c8[_0x9b74('0x1a')]?_0x43c7c8[_0x9b74('0x1a')][_0x9b74('0x1d')]||null:null,'include':_0x43c7c8[_0x9b74('0x1a')]?_0x43c7c8[_0x9b74('0x1a')][_0x9b74('0x20')]?_[_0x9b74('0x1f')](_0x43c7c8[_0x9b74('0x1a')]['include'],function(_0x23865d){return{'model':db[_0x23865d[_0x9b74('0x21')]],'as':_0x23865d['as'],'attributes':_0x23865d[_0x9b74('0x1d')],'include':_0x23865d[_0x9b74('0x20')]?_[_0x9b74('0x1f')](_0x23865d[_0x9b74('0x20')],function(_0x83873b){return{'model':db[_0x83873b[_0x9b74('0x21')]],'as':_0x83873b['as'],'attributes':_0x83873b[_0x9b74('0x1d')],'include':_0x83873b[_0x9b74('0x20')]?_[_0x9b74('0x1f')](_0x83873b['include'],function(_0x4497ed){return{'model':db[_0x4497ed[_0x9b74('0x21')]],'as':_0x4497ed['as'],'attributes':_0x4497ed[_0x9b74('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9b74('0xb')](function(_0x5877d3){logger['info'](_0x9b74('0x22'),_0x43c7c8);logger[_0x9b74('0xe')]('ShowFaxQueue',_0x43c7c8,JSON[_0x9b74('0x11')](_0x5877d3));_0xab23e7(_0x5877d3);})[_0x9b74('0x16')](function(_0x91b624){logger[_0x9b74('0x12')](_0x9b74('0x22'),_0x91b624['message'],_0x43c7c8);_0x147858(_0x364205[_0x9b74('0x12')](0x1f4,_0x91b624[_0x9b74('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index b555840..6f8958b 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 _0x8790=['./faxQueue.events','save','remove','update','emit','removeListener','register','length','faxQueue:'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x8790,0x1b0));var _0x0879=function(_0x2b1d94,_0x36febb){_0x2b1d94=_0x2b1d94-0x0;var _0x4d2cf7=_0x8790[_0x2b1d94];return _0x4d2cf7;};'use strict';var FaxQueueEvents=require(_0x0879('0x0'));var events=[_0x0879('0x1'),_0x0879('0x2'),_0x0879('0x3')];function createListener(_0x4c79c2,_0x2ae27c){return function(_0x2a5dbf){_0x2ae27c[_0x0879('0x4')](_0x4c79c2,_0x2a5dbf);};}function removeListener(_0xfbc3ee,_0x361ffb){return function(){FaxQueueEvents[_0x0879('0x5')](_0xfbc3ee,_0x361ffb);};}exports[_0x0879('0x6')]=function(_0x5d70f8){for(var _0x1fad8a=0x0,_0x54611b=events[_0x0879('0x7')];_0x1fad8a<_0x54611b;_0x1fad8a++){var _0x526559=events[_0x1fad8a];var _0x542be4=createListener(_0x0879('0x8')+_0x526559,_0x5d70f8);FaxQueueEvents['on'](_0x526559,_0x542be4);}}; \ No newline at end of file +var _0x25e6=['emit','removeListener','length','./faxQueue.events','save','remove','update'];(function(_0x3b10a0,_0x43bc){var _0x2bccbc=function(_0x3d0529){while(--_0x3d0529){_0x3b10a0['push'](_0x3b10a0['shift']());}};_0x2bccbc(++_0x43bc);}(_0x25e6,0x1b5));var _0x625e=function(_0x57d64f,_0x37dd28){_0x57d64f=_0x57d64f-0x0;var _0x32d618=_0x25e6[_0x57d64f];return _0x32d618;};'use strict';var FaxQueueEvents=require(_0x625e('0x0'));var events=[_0x625e('0x1'),_0x625e('0x2'),_0x625e('0x3')];function createListener(_0x31bc5f,_0x542889){return function(_0x5439f5){_0x542889[_0x625e('0x4')](_0x31bc5f,_0x5439f5);};}function removeListener(_0x2afbf6,_0x314e4e){return function(){FaxQueueEvents[_0x625e('0x5')](_0x2afbf6,_0x314e4e);};}exports['register']=function(_0x5ab989){for(var _0x4b30a0=0x0,_0x3925ec=events[_0x625e('0x6')];_0x4b30a0<_0x3925ec;_0x4b30a0++){var _0x1113f6=events[_0x4b30a0];var _0x1cc871=createListener('faxQueue:'+_0x1113f6,_0x5ab989);FaxQueueEvents['on'](_0x1113f6,_0x1cc871);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 8c0bdb3..5d602c3 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','index','get','/describe','describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','exports','multer'];(function(_0x53fd07,_0x556231){var _0x528da9=function(_0x44f160){while(--_0x44f160){_0x53fd07['push'](_0x53fd07['shift']());}};_0x528da9(++_0x556231);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['get'](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x13')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);router[_0x0d8b('0x13')](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x16')]);router['put'](_0x0d8b('0x17'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x18')]);router[_0x0d8b('0x19')](_0x0d8b('0x17'),auth['isAuthenticated'](),controller[_0x0d8b('0x1a')]);router[_0x0d8b('0x19')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x1b')]);router[_0x0d8b('0x19')](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller['removeAgents']);module[_0x0d8b('0x1c')]=router; \ No newline at end of file +var _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(_0x3f7879,_0x32cca7){var _0x2817ac=function(_0x5e963e){while(--_0x5e963e){_0x3f7879['push'](_0x3f7879['shift']());}};_0x2817ac(++_0x32cca7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 29071c8..166f080 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 _0x0f16=['STRING','DATE','moment','exports'];(function(_0x8ebada,_0x12fbcf){var _0x2a0d05=function(_0x5c993f){while(--_0x5c993f){_0x8ebada['push'](_0x8ebada['shift']());}};_0x2a0d05(++_0x12fbcf);}(_0x0f16,0x72));var _0x60f1=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0f16[_0x4b369d];return _0x571a98;};'use strict';var moment=require(_0x60f1('0x0'));var Sequelize=require('sequelize');module[_0x60f1('0x1')]={'uniqueid':{'type':Sequelize[_0x60f1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x60f1('0x2')]},'joinAt':{'type':Sequelize[_0x60f1('0x3')]},'leaveAt':{'type':Sequelize[_0x60f1('0x3')]},'acceptAt':{'type':Sequelize[_0x60f1('0x3')]},'exitAt':{'type':Sequelize[_0x60f1('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x426e=['DATE','moment','sequelize','exports'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x426e,0x79));var _0xe426=function(_0x18849f,_0x2918bf){_0x18849f=_0x18849f-0x0;var _0x586bcb=_0x426e[_0x18849f];return _0x586bcb;};'use strict';var moment=require(_0xe426('0x0'));var Sequelize=require(_0xe426('0x1'));module[_0xe426('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xe426('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe426('0x3')]},'exitAt':{'type':Sequelize[_0xe426('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 4f1226c..3736b02 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 _0x0cc8=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','limit','set','apply','reject','save','update','then','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','ejs','lodash','squel','crypto','jsforce'];(function(_0x1693a4,_0x346ff4){var _0x1e828d=function(_0x2ce485){while(--_0x2ce485){_0x1693a4['push'](_0x1693a4['shift']());}};_0x1e828d(++_0x346ff4);}(_0x0cc8,0xd3));var _0x80cc=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0x0cc8[_0x54de5d];return _0x1b349e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x80cc('0x0'));var rimraf=require(_0x80cc('0x1'));var zipdir=require(_0x80cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x80cc('0x3'));var moment=require('moment');var BPromise=require(_0x80cc('0x4'));var Mustache=require(_0x80cc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x80cc('0x6'));var fs=require('fs');var _=require(_0x80cc('0x7'));var squel=require(_0x80cc('0x8'));var crypto=require(_0x80cc('0x9'));var jsforce=require(_0x80cc('0xa'));var deskjs=require(_0x80cc('0xb'));var toCsv=require(_0x80cc('0xc'));var querystring=require(_0x80cc('0xd'));var Papa=require(_0x80cc('0xe'));var Redis=require(_0x80cc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x80cc('0x10'));var as=require(_0x80cc('0x11'));var hardwareService=require(_0x80cc('0x12'));var logger=require('../../config/logger')(_0x80cc('0x13'));var utils=require(_0x80cc('0x14'));var config=require('../../config/environment');var db=require(_0x80cc('0x15'))['db'];function respondWithStatusCode(_0x5dec2e,_0x1cfdfe){_0x1cfdfe=_0x1cfdfe||0xcc;return function(_0x469d7a){if(_0x469d7a){return _0x5dec2e[_0x80cc('0x16')](_0x1cfdfe);}return _0x5dec2e[_0x80cc('0x17')](_0x1cfdfe)['end']();};}function respondWithResult(_0xed4a2d,_0x269138){_0x269138=_0x269138||0xc8;return function(_0x5364ac){if(_0x5364ac){return _0xed4a2d[_0x80cc('0x17')](_0x269138)[_0x80cc('0x18')](_0x5364ac);}};}function respondWithFilteredResult(_0x59b7f3,_0x6d60d5){return function(_0x13e928){if(_0x13e928){var _0x45ddd1=_0x13e928['count'],_0x5bec74=_0x6d60d5['offset'],_0x1741ee=_0x6d60d5['offset']+_0x6d60d5[_0x80cc('0x19')],_0x37bab1;if(_0x1741ee>=_0x45ddd1){_0x1741ee=_0x45ddd1;_0x37bab1=0xc8;}else{_0x37bab1=0xce;}_0x59b7f3[_0x80cc('0x17')](_0x37bab1);return _0x59b7f3[_0x80cc('0x1a')]('Content-Range',_0x5bec74+'-'+_0x1741ee+'/'+_0x45ddd1)[_0x80cc('0x18')](_0x13e928);}return null;};}function patchUpdates(_0x12191f){return function(_0x107b35){try{jsonpatch[_0x80cc('0x1b')](_0x107b35,_0x12191f,!![]);}catch(_0x5273c5){return BPromise[_0x80cc('0x1c')](_0x5273c5);}return _0x107b35[_0x80cc('0x1d')]();};}function saveUpdates(_0x16bc87,_0x596979){return function(_0x453914){if(_0x453914){return _0x453914[_0x80cc('0x1e')](_0x16bc87)[_0x80cc('0x1f')](function(_0x13541c){return _0x13541c;});}return null;};}function removeEntity(_0x37d1da,_0x195661){return function(_0x29110a){if(_0x29110a){return _0x29110a['destroy']()[_0x80cc('0x1f')](function(){_0x37d1da[_0x80cc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x154fe6,_0x4592a4){return function(_0x55f40f){if(!_0x55f40f){_0x154fe6[_0x80cc('0x16')](0x194);}return _0x55f40f;};}function handleError(_0x3632ff,_0x2deffd){_0x2deffd=_0x2deffd||0x1f4;return function(_0x4983d3){logger[_0x80cc('0x20')](_0x4983d3[_0x80cc('0x21')]);if(_0x4983d3['name']){delete _0x4983d3[_0x80cc('0x22')];}_0x3632ff['status'](_0x2deffd)[_0x80cc('0x23')](_0x4983d3);};}exports[_0x80cc('0x24')]=function(_0x28350b,_0x6d5837){var _0x504b41={},_0x126d10={},_0x4a4216={'count':0x0,'rows':[]};var _0x12e7f0=_['map'](db[_0x80cc('0x25')][_0x80cc('0x26')],function(_0x57a6b4){return{'name':_0x57a6b4[_0x80cc('0x27')],'type':_0x57a6b4['type'][_0x80cc('0x28')]};});_0x126d10['model']=_[_0x80cc('0x29')](_0x12e7f0,_0x80cc('0x22'));_0x126d10[_0x80cc('0x2a')]=_[_0x80cc('0x2b')](_0x28350b[_0x80cc('0x2a')]);_0x126d10[_0x80cc('0x2c')]=_[_0x80cc('0x2d')](_0x126d10[_0x80cc('0x2e')],_0x126d10[_0x80cc('0x2a')]);_0x504b41[_0x80cc('0x2f')]=_['intersection'](_0x126d10[_0x80cc('0x2e')],qs[_0x80cc('0x30')](_0x28350b[_0x80cc('0x2a')][_0x80cc('0x30')]));_0x504b41['attributes']=_0x504b41[_0x80cc('0x2f')][_0x80cc('0x31')]?_0x504b41[_0x80cc('0x2f')]:_0x126d10[_0x80cc('0x2e')];if(!_0x28350b[_0x80cc('0x2a')]['hasOwnProperty'](_0x80cc('0x32'))){_0x504b41[_0x80cc('0x19')]=qs[_0x80cc('0x19')](_0x28350b[_0x80cc('0x2a')][_0x80cc('0x19')]);_0x504b41['offset']=qs[_0x80cc('0x33')](_0x28350b[_0x80cc('0x2a')]['offset']);}_0x504b41[_0x80cc('0x34')]=qs[_0x80cc('0x35')](_0x28350b[_0x80cc('0x2a')]['sort']);_0x504b41[_0x80cc('0x36')]=qs['filters'](_[_0x80cc('0x37')](_0x28350b[_0x80cc('0x2a')],_0x126d10[_0x80cc('0x2c')]));if(_0x28350b['query'][_0x80cc('0x38')]){_0x504b41[_0x80cc('0x36')]=_[_0x80cc('0x39')](_0x504b41['where'],{'$or':_[_0x80cc('0x29')](_0x12e7f0,function(_0x345d95){if(_0x345d95[_0x80cc('0x3a')]!==_0x80cc('0x3b')){var _0x3b2c7b={};_0x3b2c7b[_0x345d95[_0x80cc('0x22')]]={'$like':'%'+_0x28350b[_0x80cc('0x2a')][_0x80cc('0x38')]+'%'};return _0x3b2c7b;}})});}_0x504b41=_[_0x80cc('0x39')]({},_0x504b41,_0x28350b[_0x80cc('0x3c')]);var _0x58de47={'where':_0x504b41['where']};return db[_0x80cc('0x25')][_0x80cc('0x3d')](_0x58de47)[_0x80cc('0x1f')](function(_0xcdb5d2){_0x4a4216['count']=_0xcdb5d2;if(_0x28350b[_0x80cc('0x2a')][_0x80cc('0x3e')]){_0x504b41[_0x80cc('0x3f')]=[{'all':!![]}];}return db[_0x80cc('0x25')][_0x80cc('0x40')](_0x504b41);})[_0x80cc('0x1f')](function(_0x47d4ca){_0x4a4216[_0x80cc('0x41')]=_0x47d4ca;return _0x4a4216;})[_0x80cc('0x1f')](respondWithFilteredResult(_0x6d5837,_0x504b41))[_0x80cc('0x42')](handleError(_0x6d5837,null));};exports[_0x80cc('0x43')]=function(_0x1ca595,_0x122a17){var _0xbbfaa3={'raw':!![],'where':{'id':_0x1ca595['params']['id']}},_0x369b43={};_0x369b43[_0x80cc('0x2e')]=_[_0x80cc('0x2b')](db[_0x80cc('0x25')]['rawAttributes']);_0x369b43[_0x80cc('0x2a')]=_['keys'](_0x1ca595[_0x80cc('0x2a')]);_0x369b43[_0x80cc('0x2c')]=_[_0x80cc('0x2d')](_0x369b43[_0x80cc('0x2e')],_0x369b43[_0x80cc('0x2a')]);_0xbbfaa3[_0x80cc('0x2f')]=_[_0x80cc('0x2d')](_0x369b43[_0x80cc('0x2e')],qs[_0x80cc('0x30')](_0x1ca595[_0x80cc('0x2a')][_0x80cc('0x30')]));_0xbbfaa3[_0x80cc('0x2f')]=_0xbbfaa3[_0x80cc('0x2f')][_0x80cc('0x31')]?_0xbbfaa3[_0x80cc('0x2f')]:_0x369b43[_0x80cc('0x2e')];if(_0x1ca595[_0x80cc('0x2a')][_0x80cc('0x3e')]){_0xbbfaa3[_0x80cc('0x3f')]=[{'all':!![]}];}_0xbbfaa3=_['merge']({},_0xbbfaa3,_0x1ca595[_0x80cc('0x3c')]);return db[_0x80cc('0x25')][_0x80cc('0x44')](_0xbbfaa3)[_0x80cc('0x1f')](handleEntityNotFound(_0x122a17,null))[_0x80cc('0x1f')](respondWithResult(_0x122a17,null))[_0x80cc('0x42')](handleError(_0x122a17,null));};exports['create']=function(_0x5e9dfb,_0x434077){return db['FaxQueueReport'][_0x80cc('0x45')](_0x5e9dfb['body'],{})['then'](respondWithResult(_0x434077,0xc9))[_0x80cc('0x42')](handleError(_0x434077,null));};exports[_0x80cc('0x1e')]=function(_0x1b65f1,_0x1cc490){if(_0x1b65f1['body']['id']){delete _0x1b65f1[_0x80cc('0x46')]['id'];}return db[_0x80cc('0x25')][_0x80cc('0x44')]({'where':{'id':_0x1b65f1[_0x80cc('0x47')]['id']}})['then'](handleEntityNotFound(_0x1cc490,null))['then'](saveUpdates(_0x1b65f1['body'],null))[_0x80cc('0x1f')](respondWithResult(_0x1cc490,null))[_0x80cc('0x42')](handleError(_0x1cc490,null));};exports[_0x80cc('0x48')]=function(_0x210714,_0x3e416b){return db[_0x80cc('0x25')][_0x80cc('0x44')]({'where':{'id':_0x210714[_0x80cc('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e416b,null))['then'](removeEntity(_0x3e416b,null))[_0x80cc('0x42')](handleError(_0x3e416b,null));};exports['describe']=function(_0x24f57c,_0x5bdace){return db[_0x80cc('0x25')][_0x80cc('0x49')]()[_0x80cc('0x1f')](respondWithResult(_0x5bdace,null))[_0x80cc('0x42')](handleError(_0x5bdace,null));}; \ No newline at end of file +var _0x5e64=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x45518f,_0x475a6b){var _0x198175=function(_0x40d333){while(--_0x40d333){_0x45518f['push'](_0x45518f['shift']());}};_0x198175(++_0x475a6b);}(_0x5e64,0x6b));var _0x45e6=function(_0x309313,_0x31809f){_0x309313=_0x309313-0x0;var _0x148143=_0x5e64[_0x309313];return _0x148143;};'use strict';var pdf=require(_0x45e6('0x0'));var emlformat=require(_0x45e6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x45e6('0x2'));var jsonpatch=require(_0x45e6('0x3'));var rp=require('request-promise');var moment=require(_0x45e6('0x4'));var BPromise=require(_0x45e6('0x5'));var Mustache=require('mustache');var util=require(_0x45e6('0x6'));var path=require(_0x45e6('0x7'));var sox=require(_0x45e6('0x8'));var csv=require(_0x45e6('0x9'));var ejs=require(_0x45e6('0xa'));var fs=require('fs');var _=require(_0x45e6('0xb'));var squel=require('squel');var crypto=require(_0x45e6('0xc'));var jsforce=require(_0x45e6('0xd'));var deskjs=require(_0x45e6('0xe'));var toCsv=require(_0x45e6('0x9'));var querystring=require('querystring');var Papa=require(_0x45e6('0xf'));var Redis=require(_0x45e6('0x10'));var authService=require(_0x45e6('0x11'));var qs=require(_0x45e6('0x12'));var as=require(_0x45e6('0x13'));var hardwareService=require(_0x45e6('0x14'));var logger=require(_0x45e6('0x15'))(_0x45e6('0x16'));var utils=require(_0x45e6('0x17'));var config=require(_0x45e6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f3e7e,_0x5919ef){_0x5919ef=_0x5919ef||0xcc;return function(_0x509fdb){if(_0x509fdb){return _0x4f3e7e[_0x45e6('0x19')](_0x5919ef);}return _0x4f3e7e[_0x45e6('0x1a')](_0x5919ef)[_0x45e6('0x1b')]();};}function respondWithResult(_0x159c4e,_0x3e4a86){_0x3e4a86=_0x3e4a86||0xc8;return function(_0xd3f366){if(_0xd3f366){return _0x159c4e[_0x45e6('0x1a')](_0x3e4a86)[_0x45e6('0x1c')](_0xd3f366);}};}function respondWithFilteredResult(_0x58d3c4,_0x2a2d3b){return function(_0xc6067b){if(_0xc6067b){var _0x38753d=_0xc6067b[_0x45e6('0x1d')],_0x15b343=_0x2a2d3b[_0x45e6('0x1e')],_0x22ba83=_0x2a2d3b['offset']+_0x2a2d3b[_0x45e6('0x1f')],_0x4c8bea;if(_0x22ba83>=_0x38753d){_0x22ba83=_0x38753d;_0x4c8bea=0xc8;}else{_0x4c8bea=0xce;}_0x58d3c4[_0x45e6('0x1a')](_0x4c8bea);return _0x58d3c4[_0x45e6('0x20')](_0x45e6('0x21'),_0x15b343+'-'+_0x22ba83+'/'+_0x38753d)[_0x45e6('0x1c')](_0xc6067b);}return null;};}function patchUpdates(_0x33f253){return function(_0x3db2a6){try{jsonpatch[_0x45e6('0x22')](_0x3db2a6,_0x33f253,!![]);}catch(_0x358e2){return BPromise[_0x45e6('0x23')](_0x358e2);}return _0x3db2a6[_0x45e6('0x24')]();};}function saveUpdates(_0x521320,_0x36324a){return function(_0x1d1d12){if(_0x1d1d12){return _0x1d1d12[_0x45e6('0x25')](_0x521320)[_0x45e6('0x26')](function(_0x57875f){return _0x57875f;});}return null;};}function removeEntity(_0x2d493d,_0x2b72fd){return function(_0x5c7b4c){if(_0x5c7b4c){return _0x5c7b4c[_0x45e6('0x27')]()[_0x45e6('0x26')](function(){_0x2d493d[_0x45e6('0x1a')](0xcc)[_0x45e6('0x1b')]();});}};}function handleEntityNotFound(_0x323aed,_0x1a30a3){return function(_0x3e0915){if(!_0x3e0915){_0x323aed['sendStatus'](0x194);}return _0x3e0915;};}function handleError(_0x15684f,_0x2d8907){_0x2d8907=_0x2d8907||0x1f4;return function(_0x390295){logger[_0x45e6('0x28')](_0x390295[_0x45e6('0x29')]);if(_0x390295[_0x45e6('0x2a')]){delete _0x390295[_0x45e6('0x2a')];}_0x15684f[_0x45e6('0x1a')](_0x2d8907)['send'](_0x390295);};}exports[_0x45e6('0x2b')]=function(_0x20966d,_0x2eac44){var _0x3ab619={},_0x29bf5d={},_0x27dca8={'count':0x0,'rows':[]};var _0x40b2a2=_[_0x45e6('0x2c')](db[_0x45e6('0x2d')][_0x45e6('0x2e')],function(_0x123268){return{'name':_0x123268[_0x45e6('0x2f')],'type':_0x123268[_0x45e6('0x30')][_0x45e6('0x31')]};});_0x29bf5d[_0x45e6('0x32')]=_[_0x45e6('0x2c')](_0x40b2a2,_0x45e6('0x2a'));_0x29bf5d[_0x45e6('0x33')]=_[_0x45e6('0x34')](_0x20966d[_0x45e6('0x33')]);_0x29bf5d[_0x45e6('0x35')]=_[_0x45e6('0x36')](_0x29bf5d[_0x45e6('0x32')],_0x29bf5d[_0x45e6('0x33')]);_0x3ab619[_0x45e6('0x37')]=_[_0x45e6('0x36')](_0x29bf5d[_0x45e6('0x32')],qs[_0x45e6('0x38')](_0x20966d[_0x45e6('0x33')][_0x45e6('0x38')]));_0x3ab619[_0x45e6('0x37')]=_0x3ab619[_0x45e6('0x37')][_0x45e6('0x39')]?_0x3ab619[_0x45e6('0x37')]:_0x29bf5d[_0x45e6('0x32')];if(!_0x20966d[_0x45e6('0x33')][_0x45e6('0x3a')](_0x45e6('0x3b'))){_0x3ab619[_0x45e6('0x1f')]=qs['limit'](_0x20966d['query'][_0x45e6('0x1f')]);_0x3ab619[_0x45e6('0x1e')]=qs['offset'](_0x20966d[_0x45e6('0x33')]['offset']);}_0x3ab619[_0x45e6('0x3c')]=qs[_0x45e6('0x3d')](_0x20966d[_0x45e6('0x33')][_0x45e6('0x3d')]);_0x3ab619['where']=qs[_0x45e6('0x35')](_[_0x45e6('0x3e')](_0x20966d[_0x45e6('0x33')],_0x29bf5d[_0x45e6('0x35')]));if(_0x20966d[_0x45e6('0x33')]['filter']){_0x3ab619[_0x45e6('0x3f')]=_['merge'](_0x3ab619[_0x45e6('0x3f')],{'$or':_[_0x45e6('0x2c')](_0x40b2a2,function(_0x2d6b55){if(_0x2d6b55[_0x45e6('0x30')]!==_0x45e6('0x40')){var _0x43d03d={};_0x43d03d[_0x2d6b55[_0x45e6('0x2a')]]={'$like':'%'+_0x20966d['query'][_0x45e6('0x41')]+'%'};return _0x43d03d;}})});}_0x3ab619=_[_0x45e6('0x42')]({},_0x3ab619,_0x20966d[_0x45e6('0x43')]);var _0x3f6c08={'where':_0x3ab619[_0x45e6('0x3f')]};return db[_0x45e6('0x2d')][_0x45e6('0x1d')](_0x3f6c08)[_0x45e6('0x26')](function(_0x2bd4de){_0x27dca8['count']=_0x2bd4de;if(_0x20966d[_0x45e6('0x33')]['includeAll']){_0x3ab619[_0x45e6('0x44')]=[{'all':!![]}];}return db[_0x45e6('0x2d')][_0x45e6('0x45')](_0x3ab619);})[_0x45e6('0x26')](function(_0x483ff5){_0x27dca8[_0x45e6('0x46')]=_0x483ff5;return _0x27dca8;})[_0x45e6('0x26')](respondWithFilteredResult(_0x2eac44,_0x3ab619))[_0x45e6('0x47')](handleError(_0x2eac44,null));};exports[_0x45e6('0x48')]=function(_0x1c2115,_0x19d797){var _0x31876b={'raw':!![],'where':{'id':_0x1c2115[_0x45e6('0x49')]['id']}},_0x36d656={};_0x36d656[_0x45e6('0x32')]=_[_0x45e6('0x34')](db['FaxQueueReport']['rawAttributes']);_0x36d656['query']=_[_0x45e6('0x34')](_0x1c2115['query']);_0x36d656[_0x45e6('0x35')]=_[_0x45e6('0x36')](_0x36d656[_0x45e6('0x32')],_0x36d656[_0x45e6('0x33')]);_0x31876b[_0x45e6('0x37')]=_[_0x45e6('0x36')](_0x36d656[_0x45e6('0x32')],qs[_0x45e6('0x38')](_0x1c2115[_0x45e6('0x33')][_0x45e6('0x38')]));_0x31876b[_0x45e6('0x37')]=_0x31876b['attributes'][_0x45e6('0x39')]?_0x31876b['attributes']:_0x36d656[_0x45e6('0x32')];if(_0x1c2115[_0x45e6('0x33')][_0x45e6('0x4a')]){_0x31876b[_0x45e6('0x44')]=[{'all':!![]}];}_0x31876b=_[_0x45e6('0x42')]({},_0x31876b,_0x1c2115[_0x45e6('0x43')]);return db['FaxQueueReport'][_0x45e6('0x4b')](_0x31876b)[_0x45e6('0x26')](handleEntityNotFound(_0x19d797,null))[_0x45e6('0x26')](respondWithResult(_0x19d797,null))[_0x45e6('0x47')](handleError(_0x19d797,null));};exports[_0x45e6('0x4c')]=function(_0x3e891f,_0x2b3750){return db[_0x45e6('0x2d')][_0x45e6('0x4c')](_0x3e891f['body'],{})[_0x45e6('0x26')](respondWithResult(_0x2b3750,0xc9))[_0x45e6('0x47')](handleError(_0x2b3750,null));};exports['update']=function(_0x1da9c4,_0x596f8f){if(_0x1da9c4[_0x45e6('0x4d')]['id']){delete _0x1da9c4[_0x45e6('0x4d')]['id'];}return db[_0x45e6('0x2d')]['find']({'where':{'id':_0x1da9c4[_0x45e6('0x49')]['id']}})[_0x45e6('0x26')](handleEntityNotFound(_0x596f8f,null))[_0x45e6('0x26')](saveUpdates(_0x1da9c4[_0x45e6('0x4d')],null))[_0x45e6('0x26')](respondWithResult(_0x596f8f,null))[_0x45e6('0x47')](handleError(_0x596f8f,null));};exports[_0x45e6('0x27')]=function(_0x4ffe09,_0x165322){return db[_0x45e6('0x2d')]['find']({'where':{'id':_0x4ffe09[_0x45e6('0x49')]['id']}})[_0x45e6('0x26')](handleEntityNotFound(_0x165322,null))['then'](removeEntity(_0x165322,null))[_0x45e6('0x47')](handleError(_0x165322,null));};exports['describe']=function(_0x11e365,_0x413775){return db['FaxQueueReport'][_0x45e6('0x4e')]()[_0x45e6('0x26')](respondWithResult(_0x413775,null))[_0x45e6('0x47')](handleError(_0x413775,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 6744228..28aaa89 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 _0xd24c=['report_fax_queue','uniqueid','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','FaxQueueReport'];(function(_0x28a475,_0x14fc07){var _0x388a1e=function(_0x36c52d){while(--_0x36c52d){_0x28a475['push'](_0x28a475['shift']());}};_0x388a1e(++_0x14fc07);}(_0xd24c,0x1ec));var _0xcd24=function(_0x2dcbf4,_0x57769b){_0x2dcbf4=_0x2dcbf4-0x0;var _0x4fe17b=_0xd24c[_0x2dcbf4];return _0x4fe17b;};'use strict';var _=require(_0xcd24('0x0'));var util=require('util');var logger=require(_0xcd24('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcd24('0x2'));var rp=require(_0xcd24('0x3'));var fs=require('fs');var path=require(_0xcd24('0x4'));var rimraf=require(_0xcd24('0x5'));var config=require(_0xcd24('0x6'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x137d24,_0x46b24c){return _0x137d24['define'](_0xcd24('0x7'),attributes,{'tableName':_0xcd24('0x8'),'paranoid':![],'indexes':[{'name':_0xcd24('0x9'),'fields':[_0xcd24('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb4a6=['uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','FaxQueueReport','report_fax_queue'];(function(_0x111a70,_0x2e189b){var _0x5c07aa=function(_0x3a678b){while(--_0x3a678b){_0x111a70['push'](_0x111a70['shift']());}};_0x5c07aa(++_0x2e189b);}(_0xb4a6,0xfd));var _0x6b4a=function(_0x2e38e3,_0x5c443e){_0x2e38e3=_0x2e38e3-0x0;var _0x5cb83c=_0xb4a6[_0x2e38e3];return _0x5cb83c;};'use strict';var _=require(_0x6b4a('0x0'));var util=require('util');var logger=require(_0x6b4a('0x1'))(_0x6b4a('0x2'));var moment=require(_0x6b4a('0x3'));var BPromise=require('bluebird');var rp=require(_0x6b4a('0x4'));var fs=require('fs');var path=require(_0x6b4a('0x5'));var rimraf=require(_0x6b4a('0x6'));var config=require(_0x6b4a('0x7'));var attributes=require(_0x6b4a('0x8'));module['exports']=function(_0x2b6d39,_0x4ee255){return _0x2b6d39['define'](_0x6b4a('0x9'),attributes,{'tableName':_0x6b4a('0xa'),'paranoid':![],'indexes':[{'name':_0x6b4a('0xb'),'fields':[_0x6b4a('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 094708b..15034d1 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 _0xe7b5=['then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','debug','update','where','attributes','limit','UpdateFaxQueueReport','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x594a78,_0xd0c92d){var _0x546d27=function(_0x33ab7e){while(--_0x33ab7e){_0x594a78['push'](_0x594a78['shift']());}};_0x546d27(++_0xd0c92d);}(_0xe7b5,0x1b5));var _0x5e7b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe7b5[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x5e7b('0x0'));var moment=require(_0x5e7b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e7b('0x2'));var db=require(_0x5e7b('0x3'))['db'];var utils=require(_0x5e7b('0x4'));var logger=require(_0x5e7b('0x5'))(_0x5e7b('0x6'));var config=require('../../config/environment');var jayson=require(_0x5e7b('0x7'));var client=jayson[_0x5e7b('0x8')][_0x5e7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c1c46,_0x42685d,_0x5b8bd6){return new BPromise(function(_0x7fafd5,_0x597f64){return client[_0x5e7b('0xa')](_0x1c1c46,_0x5b8bd6)[_0x5e7b('0xb')](function(_0x4629e6){logger[_0x5e7b('0xc')](_0x5e7b('0xd'),_0x42685d,_0x5e7b('0xe'));logger['debug'](_0x5e7b('0xf'),_0x42685d,_0x5e7b('0xe'),JSON[_0x5e7b('0x10')](_0x4629e6));if(_0x4629e6[_0x5e7b('0x11')]){if(_0x4629e6[_0x5e7b('0x11')][_0x5e7b('0x12')]===0x1f4){logger['error'](_0x5e7b('0xd'),_0x42685d,_0x4629e6[_0x5e7b('0x11')][_0x5e7b('0x13')]);return _0x597f64(_0x4629e6[_0x5e7b('0x11')][_0x5e7b('0x13')]);}logger[_0x5e7b('0x11')](_0x5e7b('0xd'),_0x42685d,_0x4629e6['error'][_0x5e7b('0x13')]);return _0x7fafd5(_0x4629e6[_0x5e7b('0x11')][_0x5e7b('0x13')]);}else{logger[_0x5e7b('0xc')](_0x5e7b('0xd'),_0x42685d,_0x5e7b('0xe'));_0x7fafd5(_0x4629e6['result'][_0x5e7b('0x13')]);}})[_0x5e7b('0x14')](function(_0x79169e){logger[_0x5e7b('0x11')](_0x5e7b('0xd'),_0x42685d,_0x79169e);_0x597f64(_0x79169e);});});}exports[_0x5e7b('0x15')]=function(_0x5a3495){var _0x44087a=this;return new Promise(function(_0x5a3ec3,_0x755166){return db[_0x5e7b('0x16')]['create'](_0x5a3495[_0x5e7b('0x17')],{'raw':_0x5a3495[_0x5e7b('0x18')]?_0x5a3495[_0x5e7b('0x18')][_0x5e7b('0x19')]===undefined?!![]:![]:!![]})[_0x5e7b('0xb')](function(_0x344c70){logger['info']('CreateFaxQueueReport',_0x5a3495);logger[_0x5e7b('0x1a')]('CreateFaxQueueReport',_0x5a3495,JSON[_0x5e7b('0x10')](_0x344c70));_0x5a3ec3(_0x344c70);})[_0x5e7b('0x14')](function(_0x17ae52){logger[_0x5e7b('0x11')](_0x5e7b('0x15'),_0x17ae52[_0x5e7b('0x13')],_0x5a3495);_0x755166(_0x44087a[_0x5e7b('0x11')](0x1f4,_0x17ae52['message']));});});};exports['UpdateFaxQueueReport']=function(_0x124b0f){var _0x3e56d3=this;return new Promise(function(_0x557a26,_0x45cadb){return db[_0x5e7b('0x16')][_0x5e7b('0x1b')](_0x124b0f[_0x5e7b('0x17')],{'raw':_0x124b0f['options']?_0x124b0f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x124b0f['options']?_0x124b0f['options'][_0x5e7b('0x1c')]||null:null,'attributes':_0x124b0f['options']?_0x124b0f[_0x5e7b('0x18')][_0x5e7b('0x1d')]||null:null,'limit':_0x124b0f['options']?_0x124b0f[_0x5e7b('0x18')][_0x5e7b('0x1e')]||null:null})[_0x5e7b('0xb')](function(_0x46a1d9){logger[_0x5e7b('0xc')](_0x5e7b('0x1f'),_0x124b0f);logger['debug']('UpdateFaxQueueReport',_0x124b0f,JSON[_0x5e7b('0x10')](_0x46a1d9));_0x557a26(_0x46a1d9);})[_0x5e7b('0x14')](function(_0x583fb7){logger[_0x5e7b('0x11')](_0x5e7b('0x1f'),_0x583fb7[_0x5e7b('0x13')],_0x124b0f);_0x45cadb(_0x3e56d3[_0x5e7b('0x11')](0x1f4,_0x583fb7[_0x5e7b('0x13')]));});});}; \ No newline at end of file +var _0x220e=['options','raw','catch','update','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateFaxQueueReport','FaxQueueReport','body'];(function(_0x17a79e,_0xe61bd8){var _0x497339=function(_0x4f6d50){while(--_0x4f6d50){_0x17a79e['push'](_0x17a79e['shift']());}};_0x497339(++_0xe61bd8);}(_0x220e,0x128));var _0xe220=function(_0x532d78,_0x25b6a8){_0x532d78=_0x532d78-0x0;var _0x5990c4=_0x220e[_0x532d78];return _0x5990c4;};'use strict';var _=require(_0xe220('0x0'));var util=require(_0xe220('0x1'));var moment=require(_0xe220('0x2'));var BPromise=require('bluebird');var rs=require(_0xe220('0x3'));var fs=require('fs');var Redis=require(_0xe220('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe220('0x5'));var logger=require(_0xe220('0x6'))(_0xe220('0x7'));var config=require(_0xe220('0x8'));var jayson=require(_0xe220('0x9'));var client=jayson[_0xe220('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x271095,_0x5cc1aa,_0x449dc3){return new BPromise(function(_0x3572e2,_0x4896ac){return client[_0xe220('0xb')](_0x271095,_0x449dc3)[_0xe220('0xc')](function(_0x2fd5a1){logger[_0xe220('0xd')](_0xe220('0xe'),_0x5cc1aa,_0xe220('0xf'));logger[_0xe220('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x5cc1aa,_0xe220('0xf'),JSON[_0xe220('0x11')](_0x2fd5a1));if(_0x2fd5a1[_0xe220('0x12')]){if(_0x2fd5a1['error']['code']===0x1f4){logger[_0xe220('0x12')](_0xe220('0xe'),_0x5cc1aa,_0x2fd5a1[_0xe220('0x12')][_0xe220('0x13')]);return _0x4896ac(_0x2fd5a1[_0xe220('0x12')][_0xe220('0x13')]);}logger[_0xe220('0x12')](_0xe220('0xe'),_0x5cc1aa,_0x2fd5a1['error'][_0xe220('0x13')]);return _0x3572e2(_0x2fd5a1['error']['message']);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x5cc1aa,_0xe220('0xf'));_0x3572e2(_0x2fd5a1[_0xe220('0x14')][_0xe220('0x13')]);}})['catch'](function(_0x4fc14b){logger[_0xe220('0x12')](_0xe220('0xe'),_0x5cc1aa,_0x4fc14b);_0x4896ac(_0x4fc14b);});});}exports[_0xe220('0x15')]=function(_0x1e30f3){var _0x2914c6=this;return new Promise(function(_0x31754b,_0xc58e2){return db[_0xe220('0x16')]['create'](_0x1e30f3[_0xe220('0x17')],{'raw':_0x1e30f3['options']?_0x1e30f3[_0xe220('0x18')][_0xe220('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x33e996){logger[_0xe220('0xd')](_0xe220('0x15'),_0x1e30f3);logger[_0xe220('0x10')](_0xe220('0x15'),_0x1e30f3,JSON[_0xe220('0x11')](_0x33e996));_0x31754b(_0x33e996);})[_0xe220('0x1a')](function(_0x16145a){logger[_0xe220('0x12')](_0xe220('0x15'),_0x16145a[_0xe220('0x13')],_0x1e30f3);_0xc58e2(_0x2914c6[_0xe220('0x12')](0x1f4,_0x16145a[_0xe220('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x559a69){var _0x55572b=this;return new Promise(function(_0xaaf71e,_0x327d52){return db[_0xe220('0x16')][_0xe220('0x1b')](_0x559a69[_0xe220('0x17')],{'raw':_0x559a69[_0xe220('0x18')]?_0x559a69['options'][_0xe220('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x559a69[_0xe220('0x18')]?_0x559a69[_0xe220('0x18')][_0xe220('0x1c')]||null:null,'attributes':_0x559a69[_0xe220('0x18')]?_0x559a69[_0xe220('0x18')][_0xe220('0x1d')]||null:null,'limit':_0x559a69[_0xe220('0x18')]?_0x559a69[_0xe220('0x18')][_0xe220('0x1e')]||null:null})[_0xe220('0xc')](function(_0x595288){logger['info']('UpdateFaxQueueReport',_0x559a69);logger[_0xe220('0x10')](_0xe220('0x1f'),_0x559a69,JSON[_0xe220('0x11')](_0x595288));_0xaaf71e(_0x595288);})[_0xe220('0x1a')](function(_0x6d5da0){logger[_0xe220('0x12')]('UpdateFaxQueueReport',_0x6d5da0[_0xe220('0x13')],_0x559a69);_0x327d52(_0x55572b[_0xe220('0x12')](0x1f4,_0x6d5da0[_0xe220('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index bed5666..7ca93d5 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 _0x7382=['isAuthenticated','index','get','describe','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./faxQueueReport.controller'];(function(_0x260bf8,_0x164ae1){var _0x3e4bf4=function(_0x326cfe){while(--_0x326cfe){_0x260bf8['push'](_0x260bf8['shift']());}};_0x3e4bf4(++_0x164ae1);}(_0x7382,0x14e));var _0x2738=function(_0x5baf4e,_0x1da203){_0x5baf4e=_0x5baf4e-0x0;var _0x5c7dee=_0x7382[_0x5baf4e];return _0x5c7dee;};'use strict';var multer=require(_0x2738('0x0'));var util=require(_0x2738('0x1'));var path=require(_0x2738('0x2'));var timeout=require(_0x2738('0x3'));var express=require(_0x2738('0x4'));var router=express['Router']();var auth=require(_0x2738('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2738('0x6'));var controller=require(_0x2738('0x7'));router['get']('/',auth[_0x2738('0x8')](),controller[_0x2738('0x9')]);router[_0x2738('0xa')]('/describe',auth[_0x2738('0x8')](),controller[_0x2738('0xb')]);router['get'](_0x2738('0xc'),auth[_0x2738('0x8')](),controller[_0x2738('0xd')]);router['post']('/',auth[_0x2738('0x8')](),controller[_0x2738('0xe')]);router[_0x2738('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2738('0x10')]);router[_0x2738('0x11')](_0x2738('0xc'),auth['isAuthenticated'](),controller[_0x2738('0x12')]);module['exports']=router; \ No newline at end of file +var _0x615c=['show','post','update','delete','destroy','multer','util','connect-timeout','isAuthenticated','index','/describe','describe','/:id'];(function(_0x19e3cc,_0x418341){var _0x321593=function(_0x469474){while(--_0x469474){_0x19e3cc['push'](_0x19e3cc['shift']());}};_0x321593(++_0x418341);}(_0x615c,0xe2));var _0xc615=function(_0x2b9847,_0x5b5294){_0x2b9847=_0x2b9847-0x0;var _0x4e393f=_0x615c[_0x2b9847];return _0x4e393f;};'use strict';var multer=require(_0xc615('0x0'));var util=require(_0xc615('0x1'));var path=require('path');var timeout=require(_0xc615('0x2'));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('./faxQueueReport.controller');router['get']('/',auth[_0xc615('0x3')](),controller[_0xc615('0x4')]);router['get'](_0xc615('0x5'),auth[_0xc615('0x3')](),controller[_0xc615('0x6')]);router['get'](_0xc615('0x7'),auth['isAuthenticated'](),controller[_0xc615('0x8')]);router[_0xc615('0x9')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc615('0x7'),auth[_0xc615('0x3')](),controller[_0xc615('0xa')]);router[_0xc615('0xb')](_0xc615('0x7'),auth[_0xc615('0x3')](),controller[_0xc615('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index c28756b..c0248ee 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 _0xe6c0=['NOW','moment','sequelize','exports','STRING','ENUM','agent','queue','DATE'];(function(_0x2fe1f9,_0x1250e9){var _0x1fc742=function(_0x38a6af){while(--_0x38a6af){_0x2fe1f9['push'](_0x2fe1f9['shift']());}};_0x1fc742(++_0x1250e9);}(_0xe6c0,0x1e7));var _0x0e6c=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xe6c0[_0x433a86];return _0x23000c;};'use strict';var moment=require(_0x0e6c('0x0'));var Sequelize=require(_0x0e6c('0x1'));module[_0x0e6c('0x2')]={'uniqueid':{'type':Sequelize[_0x0e6c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0e6c('0x4')]('account',_0x0e6c('0x5'),_0x0e6c('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x0e6c('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x0e6c('0x8')]}}; \ No newline at end of file +var _0x1964=['queue','moment','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x164d43,_0x449ecd){var _0x113c4f=function(_0x121374){while(--_0x121374){_0x164d43['push'](_0x164d43['shift']());}};_0x113c4f(++_0x449ecd);}(_0x1964,0x89));var _0x4196=function(_0x8958ab,_0xf7e95){_0x8958ab=_0x8958ab-0x0;var _0x1c8d86=_0x1964[_0x8958ab];return _0x1c8d86;};'use strict';var moment=require(_0x4196('0x0'));var Sequelize=require(_0x4196('0x1'));module[_0x4196('0x2')]={'uniqueid':{'type':Sequelize[_0x4196('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4196('0x4')](_0x4196('0x5'),_0x4196('0x6'),_0x4196('0x7')),'allowNull':![],'defaultValue':_0x4196('0x7')},'transferredAt':{'type':Sequelize['DATE'],'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 d15cf3b..7c64a2f 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 _0x90c1=['../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','length','includeAll','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x90c1,0x80));var _0x190c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x90c1[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x190c('0x0'));var emlformat=require(_0x190c('0x1'));var rimraf=require(_0x190c('0x2'));var zipdir=require(_0x190c('0x3'));var jsonpatch=require(_0x190c('0x4'));var rp=require(_0x190c('0x5'));var moment=require(_0x190c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x190c('0x7'));var util=require(_0x190c('0x8'));var path=require(_0x190c('0x9'));var sox=require(_0x190c('0xa'));var csv=require(_0x190c('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x190c('0xc'));var squel=require(_0x190c('0xd'));var crypto=require(_0x190c('0xe'));var jsforce=require(_0x190c('0xf'));var deskjs=require(_0x190c('0x10'));var toCsv=require(_0x190c('0xb'));var querystring=require(_0x190c('0x11'));var Papa=require(_0x190c('0x12'));var Redis=require(_0x190c('0x13'));var authService=require(_0x190c('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x190c('0x15'));var logger=require(_0x190c('0x16'))(_0x190c('0x17'));var utils=require(_0x190c('0x18'));var config=require(_0x190c('0x19'));var db=require(_0x190c('0x1a'))['db'];function respondWithStatusCode(_0x51f3fd,_0x309e24){_0x309e24=_0x309e24||0xcc;return function(_0x133b7a){if(_0x133b7a){return _0x51f3fd[_0x190c('0x1b')](_0x309e24);}return _0x51f3fd['status'](_0x309e24)['end']();};}function respondWithResult(_0x5c92ed,_0x506f97){_0x506f97=_0x506f97||0xc8;return function(_0x1fc956){if(_0x1fc956){return _0x5c92ed[_0x190c('0x1c')](_0x506f97)['json'](_0x1fc956);}};}function respondWithFilteredResult(_0x34b809,_0x3c8f07){return function(_0x28e5aa){if(_0x28e5aa){var _0x18d2ac=_0x28e5aa[_0x190c('0x1d')],_0x7ad25=_0x3c8f07[_0x190c('0x1e')],_0x58795b=_0x3c8f07['offset']+_0x3c8f07[_0x190c('0x1f')],_0x27c0b5;if(_0x58795b>=_0x18d2ac){_0x58795b=_0x18d2ac;_0x27c0b5=0xc8;}else{_0x27c0b5=0xce;}_0x34b809[_0x190c('0x1c')](_0x27c0b5);return _0x34b809['set'](_0x190c('0x20'),_0x7ad25+'-'+_0x58795b+'/'+_0x18d2ac)[_0x190c('0x21')](_0x28e5aa);}return null;};}function patchUpdates(_0x11b63){return function(_0x5e68a4){try{jsonpatch[_0x190c('0x22')](_0x5e68a4,_0x11b63,!![]);}catch(_0x3d2752){return BPromise['reject'](_0x3d2752);}return _0x5e68a4[_0x190c('0x23')]();};}function saveUpdates(_0x580d3d,_0x5bfba7){return function(_0x55e705){if(_0x55e705){return _0x55e705[_0x190c('0x24')](_0x580d3d)[_0x190c('0x25')](function(_0x55c4cf){return _0x55c4cf;});}return null;};}function removeEntity(_0x113ce6,_0x4a6684){return function(_0x581c2c){if(_0x581c2c){return _0x581c2c[_0x190c('0x26')]()[_0x190c('0x25')](function(){_0x113ce6[_0x190c('0x1c')](0xcc)[_0x190c('0x27')]();});}};}function handleEntityNotFound(_0x30d583,_0xf521b5){return function(_0x38cbce){if(!_0x38cbce){_0x30d583[_0x190c('0x1b')](0x194);}return _0x38cbce;};}function handleError(_0x279968,_0x582be2){_0x582be2=_0x582be2||0x1f4;return function(_0x1fff07){logger[_0x190c('0x28')](_0x1fff07[_0x190c('0x29')]);if(_0x1fff07[_0x190c('0x2a')]){delete _0x1fff07[_0x190c('0x2a')];}_0x279968[_0x190c('0x1c')](_0x582be2)['send'](_0x1fff07);};}exports[_0x190c('0x2b')]=function(_0x3b3f04,_0x2cf451){var _0x20355b={},_0x894cbc={},_0x3c5f09={'count':0x0,'rows':[]};var _0x4d6353=_[_0x190c('0x2c')](db[_0x190c('0x2d')][_0x190c('0x2e')],function(_0x13460e){return{'name':_0x13460e[_0x190c('0x2f')],'type':_0x13460e['type'][_0x190c('0x30')]};});_0x894cbc[_0x190c('0x31')]=_['map'](_0x4d6353,_0x190c('0x2a'));_0x894cbc[_0x190c('0x32')]=_[_0x190c('0x33')](_0x3b3f04[_0x190c('0x32')]);_0x894cbc['filters']=_['intersection'](_0x894cbc['model'],_0x894cbc[_0x190c('0x32')]);_0x20355b[_0x190c('0x34')]=_[_0x190c('0x35')](_0x894cbc[_0x190c('0x31')],qs['fields'](_0x3b3f04[_0x190c('0x32')][_0x190c('0x36')]));_0x20355b[_0x190c('0x34')]=_0x20355b[_0x190c('0x34')]['length']?_0x20355b['attributes']:_0x894cbc[_0x190c('0x31')];if(!_0x3b3f04[_0x190c('0x32')]['hasOwnProperty'](_0x190c('0x37'))){_0x20355b[_0x190c('0x1f')]=qs[_0x190c('0x1f')](_0x3b3f04['query']['limit']);_0x20355b['offset']=qs['offset'](_0x3b3f04[_0x190c('0x32')][_0x190c('0x1e')]);}_0x20355b['order']=qs[_0x190c('0x38')](_0x3b3f04['query'][_0x190c('0x38')]);_0x20355b[_0x190c('0x39')]=qs[_0x190c('0x3a')](_[_0x190c('0x3b')](_0x3b3f04[_0x190c('0x32')],_0x894cbc[_0x190c('0x3a')]));if(_0x3b3f04['query'][_0x190c('0x3c')]){_0x20355b[_0x190c('0x39')]=_[_0x190c('0x3d')](_0x20355b[_0x190c('0x39')],{'$or':_[_0x190c('0x2c')](_0x4d6353,function(_0x2293d9){if(_0x2293d9[_0x190c('0x3e')]!==_0x190c('0x3f')){var _0x2f43ac={};_0x2f43ac[_0x2293d9[_0x190c('0x2a')]]={'$like':'%'+_0x3b3f04[_0x190c('0x32')][_0x190c('0x3c')]+'%'};return _0x2f43ac;}})});}_0x20355b=_[_0x190c('0x3d')]({},_0x20355b,_0x3b3f04[_0x190c('0x40')]);var _0x26d02c={'where':_0x20355b[_0x190c('0x39')]};return db[_0x190c('0x2d')][_0x190c('0x1d')](_0x26d02c)[_0x190c('0x25')](function(_0x3b58d1){_0x3c5f09['count']=_0x3b58d1;if(_0x3b3f04['query']['includeAll']){_0x20355b[_0x190c('0x41')]=[{'all':!![]}];}return db[_0x190c('0x2d')][_0x190c('0x42')](_0x20355b);})[_0x190c('0x25')](function(_0x4d02b7){_0x3c5f09[_0x190c('0x43')]=_0x4d02b7;return _0x3c5f09;})[_0x190c('0x25')](respondWithFilteredResult(_0x2cf451,_0x20355b))[_0x190c('0x44')](handleError(_0x2cf451,null));};exports[_0x190c('0x45')]=function(_0x5a5c4b,_0x25b812){var _0x147f55={'raw':!![],'where':{'id':_0x5a5c4b['params']['id']}},_0x8532b5={};_0x8532b5[_0x190c('0x31')]=_[_0x190c('0x33')](db['FaxTransferReport'][_0x190c('0x2e')]);_0x8532b5[_0x190c('0x32')]=_[_0x190c('0x33')](_0x5a5c4b[_0x190c('0x32')]);_0x8532b5[_0x190c('0x3a')]=_['intersection'](_0x8532b5[_0x190c('0x31')],_0x8532b5['query']);_0x147f55[_0x190c('0x34')]=_[_0x190c('0x35')](_0x8532b5[_0x190c('0x31')],qs[_0x190c('0x36')](_0x5a5c4b[_0x190c('0x32')][_0x190c('0x36')]));_0x147f55[_0x190c('0x34')]=_0x147f55['attributes'][_0x190c('0x46')]?_0x147f55['attributes']:_0x8532b5['model'];if(_0x5a5c4b[_0x190c('0x32')][_0x190c('0x47')]){_0x147f55['include']=[{'all':!![]}];}_0x147f55=_['merge']({},_0x147f55,_0x5a5c4b[_0x190c('0x40')]);return db[_0x190c('0x2d')][_0x190c('0x48')](_0x147f55)[_0x190c('0x25')](handleEntityNotFound(_0x25b812,null))['then'](respondWithResult(_0x25b812,null))[_0x190c('0x44')](handleError(_0x25b812,null));};exports[_0x190c('0x49')]=function(_0x1d4d96,_0x1ba7c2){return db[_0x190c('0x2d')][_0x190c('0x49')](_0x1d4d96[_0x190c('0x4a')],{})[_0x190c('0x25')](respondWithResult(_0x1ba7c2,0xc9))[_0x190c('0x44')](handleError(_0x1ba7c2,null));};exports['update']=function(_0x57a064,_0xcc188d){if(_0x57a064[_0x190c('0x4a')]['id']){delete _0x57a064[_0x190c('0x4a')]['id'];}return db[_0x190c('0x2d')]['find']({'where':{'id':_0x57a064['params']['id']}})['then'](handleEntityNotFound(_0xcc188d,null))['then'](saveUpdates(_0x57a064['body'],null))[_0x190c('0x25')](respondWithResult(_0xcc188d,null))['catch'](handleError(_0xcc188d,null));};exports[_0x190c('0x26')]=function(_0x4064be,_0x1cef5e){return db['FaxTransferReport'][_0x190c('0x48')]({'where':{'id':_0x4064be[_0x190c('0x4b')]['id']}})[_0x190c('0x25')](handleEntityNotFound(_0x1cef5e,null))[_0x190c('0x25')](removeEntity(_0x1cef5e,null))[_0x190c('0x44')](handleError(_0x1cef5e,null));};exports[_0x190c('0x4c')]=function(_0x2f7a4f,_0x5ea455){return db[_0x190c('0x2d')]['describe']()[_0x190c('0x25')](respondWithResult(_0x5ea455,null))[_0x190c('0x44')](handleError(_0x5ea455,null));}; \ No newline at end of file +var _0x57e3=['path','sox','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','error','stack','name','index','map','FaxTransferReport','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4b072c,_0x583d0f){var _0x41af00=function(_0x56d095){while(--_0x56d095){_0x4b072c['push'](_0x4b072c['shift']());}};_0x41af00(++_0x583d0f);}(_0x57e3,0xde));var _0x357e=function(_0xdc593a,_0xb9bfbd){_0xdc593a=_0xdc593a-0x0;var _0x1bd386=_0x57e3[_0xdc593a];return _0x1bd386;};'use strict';var pdf=require(_0x357e('0x0'));var emlformat=require(_0x357e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x357e('0x2'));var jsonpatch=require(_0x357e('0x3'));var rp=require(_0x357e('0x4'));var moment=require(_0x357e('0x5'));var BPromise=require(_0x357e('0x6'));var Mustache=require(_0x357e('0x7'));var util=require(_0x357e('0x8'));var path=require(_0x357e('0x9'));var sox=require(_0x357e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x357e('0xb'));var squel=require('squel');var crypto=require(_0x357e('0xc'));var jsforce=require(_0x357e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x357e('0xe'));var querystring=require(_0x357e('0xf'));var Papa=require(_0x357e('0x10'));var Redis=require(_0x357e('0x11'));var authService=require(_0x357e('0x12'));var qs=require(_0x357e('0x13'));var as=require(_0x357e('0x14'));var hardwareService=require(_0x357e('0x15'));var logger=require('../../config/logger')(_0x357e('0x16'));var utils=require(_0x357e('0x17'));var config=require(_0x357e('0x18'));var db=require(_0x357e('0x19'))['db'];function respondWithStatusCode(_0x7859b5,_0x349b36){_0x349b36=_0x349b36||0xcc;return function(_0x25bd80){if(_0x25bd80){return _0x7859b5[_0x357e('0x1a')](_0x349b36);}return _0x7859b5[_0x357e('0x1b')](_0x349b36)[_0x357e('0x1c')]();};}function respondWithResult(_0x4c2ede,_0x5de739){_0x5de739=_0x5de739||0xc8;return function(_0x1bb673){if(_0x1bb673){return _0x4c2ede['status'](_0x5de739)[_0x357e('0x1d')](_0x1bb673);}};}function respondWithFilteredResult(_0x132dc6,_0xbfd90){return function(_0x723226){if(_0x723226){var _0x200aba=_0x723226[_0x357e('0x1e')],_0x2e586b=_0xbfd90[_0x357e('0x1f')],_0x284cbc=_0xbfd90['offset']+_0xbfd90['limit'],_0xad823b;if(_0x284cbc>=_0x200aba){_0x284cbc=_0x200aba;_0xad823b=0xc8;}else{_0xad823b=0xce;}_0x132dc6[_0x357e('0x1b')](_0xad823b);return _0x132dc6[_0x357e('0x20')](_0x357e('0x21'),_0x2e586b+'-'+_0x284cbc+'/'+_0x200aba)['json'](_0x723226);}return null;};}function patchUpdates(_0x15f5e3){return function(_0x24a1e5){try{jsonpatch['apply'](_0x24a1e5,_0x15f5e3,!![]);}catch(_0x367438){return BPromise[_0x357e('0x22')](_0x367438);}return _0x24a1e5[_0x357e('0x23')]();};}function saveUpdates(_0x43f03d,_0x11e54f){return function(_0x10be8d){if(_0x10be8d){return _0x10be8d[_0x357e('0x24')](_0x43f03d)['then'](function(_0x1612aa){return _0x1612aa;});}return null;};}function removeEntity(_0x43ef5d,_0x5aa983){return function(_0x33c7b0){if(_0x33c7b0){return _0x33c7b0[_0x357e('0x25')]()['then'](function(){_0x43ef5d['status'](0xcc)[_0x357e('0x1c')]();});}};}function handleEntityNotFound(_0x2e8a3e,_0x328fc8){return function(_0x33b46b){if(!_0x33b46b){_0x2e8a3e[_0x357e('0x1a')](0x194);}return _0x33b46b;};}function handleError(_0x2be373,_0x4ce1c5){_0x4ce1c5=_0x4ce1c5||0x1f4;return function(_0x9a2825){logger[_0x357e('0x26')](_0x9a2825[_0x357e('0x27')]);if(_0x9a2825[_0x357e('0x28')]){delete _0x9a2825[_0x357e('0x28')];}_0x2be373[_0x357e('0x1b')](_0x4ce1c5)['send'](_0x9a2825);};}exports[_0x357e('0x29')]=function(_0x36276b,_0x1fb294){var _0x280737={},_0x228a33={},_0x632ee4={'count':0x0,'rows':[]};var _0x5f3957=_[_0x357e('0x2a')](db[_0x357e('0x2b')]['rawAttributes'],function(_0x219279){return{'name':_0x219279[_0x357e('0x2c')],'type':_0x219279[_0x357e('0x2d')]['key']};});_0x228a33['model']=_[_0x357e('0x2a')](_0x5f3957,'name');_0x228a33[_0x357e('0x2e')]=_[_0x357e('0x2f')](_0x36276b['query']);_0x228a33[_0x357e('0x30')]=_[_0x357e('0x31')](_0x228a33[_0x357e('0x32')],_0x228a33[_0x357e('0x2e')]);_0x280737[_0x357e('0x33')]=_['intersection'](_0x228a33[_0x357e('0x32')],qs[_0x357e('0x34')](_0x36276b[_0x357e('0x2e')][_0x357e('0x34')]));_0x280737[_0x357e('0x33')]=_0x280737[_0x357e('0x33')]['length']?_0x280737['attributes']:_0x228a33[_0x357e('0x32')];if(!_0x36276b['query'][_0x357e('0x35')](_0x357e('0x36'))){_0x280737[_0x357e('0x37')]=qs[_0x357e('0x37')](_0x36276b[_0x357e('0x2e')][_0x357e('0x37')]);_0x280737[_0x357e('0x1f')]=qs[_0x357e('0x1f')](_0x36276b['query'][_0x357e('0x1f')]);}_0x280737[_0x357e('0x38')]=qs[_0x357e('0x39')](_0x36276b['query'][_0x357e('0x39')]);_0x280737[_0x357e('0x3a')]=qs[_0x357e('0x30')](_[_0x357e('0x3b')](_0x36276b['query'],_0x228a33[_0x357e('0x30')]));if(_0x36276b[_0x357e('0x2e')][_0x357e('0x3c')]){_0x280737[_0x357e('0x3a')]=_[_0x357e('0x3d')](_0x280737[_0x357e('0x3a')],{'$or':_[_0x357e('0x2a')](_0x5f3957,function(_0x8cbdf6){if(_0x8cbdf6[_0x357e('0x2d')]!==_0x357e('0x3e')){var _0x17294e={};_0x17294e[_0x8cbdf6[_0x357e('0x28')]]={'$like':'%'+_0x36276b[_0x357e('0x2e')]['filter']+'%'};return _0x17294e;}})});}_0x280737=_[_0x357e('0x3d')]({},_0x280737,_0x36276b[_0x357e('0x3f')]);var _0x2394bd={'where':_0x280737[_0x357e('0x3a')]};return db['FaxTransferReport'][_0x357e('0x1e')](_0x2394bd)['then'](function(_0x19b06a){_0x632ee4['count']=_0x19b06a;if(_0x36276b[_0x357e('0x2e')][_0x357e('0x40')]){_0x280737[_0x357e('0x41')]=[{'all':!![]}];}return db[_0x357e('0x2b')][_0x357e('0x42')](_0x280737);})[_0x357e('0x43')](function(_0x4fd08a){_0x632ee4[_0x357e('0x44')]=_0x4fd08a;return _0x632ee4;})['then'](respondWithFilteredResult(_0x1fb294,_0x280737))[_0x357e('0x45')](handleError(_0x1fb294,null));};exports[_0x357e('0x46')]=function(_0x5661db,_0x107487){var _0xc43250={'raw':!![],'where':{'id':_0x5661db[_0x357e('0x47')]['id']}},_0x383bcc={};_0x383bcc[_0x357e('0x32')]=_[_0x357e('0x2f')](db[_0x357e('0x2b')][_0x357e('0x48')]);_0x383bcc[_0x357e('0x2e')]=_[_0x357e('0x2f')](_0x5661db['query']);_0x383bcc['filters']=_[_0x357e('0x31')](_0x383bcc[_0x357e('0x32')],_0x383bcc[_0x357e('0x2e')]);_0xc43250[_0x357e('0x33')]=_[_0x357e('0x31')](_0x383bcc[_0x357e('0x32')],qs[_0x357e('0x34')](_0x5661db[_0x357e('0x2e')][_0x357e('0x34')]));_0xc43250[_0x357e('0x33')]=_0xc43250[_0x357e('0x33')]['length']?_0xc43250['attributes']:_0x383bcc[_0x357e('0x32')];if(_0x5661db['query'][_0x357e('0x40')]){_0xc43250[_0x357e('0x41')]=[{'all':!![]}];}_0xc43250=_['merge']({},_0xc43250,_0x5661db[_0x357e('0x3f')]);return db[_0x357e('0x2b')][_0x357e('0x49')](_0xc43250)[_0x357e('0x43')](handleEntityNotFound(_0x107487,null))[_0x357e('0x43')](respondWithResult(_0x107487,null))[_0x357e('0x45')](handleError(_0x107487,null));};exports[_0x357e('0x4a')]=function(_0x5995c0,_0x28e516){return db['FaxTransferReport']['create'](_0x5995c0[_0x357e('0x4b')],{})[_0x357e('0x43')](respondWithResult(_0x28e516,0xc9))[_0x357e('0x45')](handleError(_0x28e516,null));};exports[_0x357e('0x24')]=function(_0x18478b,_0x4ab05a){if(_0x18478b[_0x357e('0x4b')]['id']){delete _0x18478b[_0x357e('0x4b')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x18478b[_0x357e('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ab05a,null))[_0x357e('0x43')](saveUpdates(_0x18478b[_0x357e('0x4b')],null))[_0x357e('0x43')](respondWithResult(_0x4ab05a,null))['catch'](handleError(_0x4ab05a,null));};exports[_0x357e('0x25')]=function(_0x549a38,_0x5c7b82){return db[_0x357e('0x2b')][_0x357e('0x49')]({'where':{'id':_0x549a38[_0x357e('0x47')]['id']}})['then'](handleEntityNotFound(_0x5c7b82,null))[_0x357e('0x43')](removeEntity(_0x5c7b82,null))[_0x357e('0x45')](handleError(_0x5c7b82,null));};exports[_0x357e('0x4c')]=function(_0x5614cf,_0x3a955d){return db[_0x357e('0x2b')][_0x357e('0x4c')]()[_0x357e('0x43')](respondWithResult(_0x3a955d,null))['catch'](handleError(_0x3a955d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 1fe599c..7206828 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 _0x4bb9=['define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4bb9,0x114));var _0x94bb=function(_0x41a2e9,_0x4c68ce){_0x41a2e9=_0x41a2e9-0x0;var _0x56fe09=_0x4bb9[_0x41a2e9];return _0x56fe09;};'use strict';var _=require(_0x94bb('0x0'));var util=require(_0x94bb('0x1'));var logger=require(_0x94bb('0x2'))('api');var moment=require(_0x94bb('0x3'));var BPromise=require(_0x94bb('0x4'));var rp=require(_0x94bb('0x5'));var fs=require('fs');var path=require(_0x94bb('0x6'));var rimraf=require(_0x94bb('0x7'));var config=require(_0x94bb('0x8'));var attributes=require(_0x94bb('0x9'));module['exports']=function(_0x2cb134,_0x5a2f6d){return _0x2cb134[_0x94bb('0xa')]('FaxTransferReport',attributes,{'tableName':_0x94bb('0xb'),'paranoid':![],'indexes':[{'name':_0x94bb('0xc'),'fields':[_0x94bb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x28f9=['path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x28f9,0x174));var _0x928f=function(_0x197b17,_0x4ff850){_0x197b17=_0x197b17-0x0;var _0x173fcf=_0x28f9[_0x197b17];return _0x173fcf;};'use strict';var _=require(_0x928f('0x0'));var util=require(_0x928f('0x1'));var logger=require(_0x928f('0x2'))(_0x928f('0x3'));var moment=require(_0x928f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x928f('0x5'));var rimraf=require(_0x928f('0x6'));var config=require(_0x928f('0x7'));var attributes=require(_0x928f('0x8'));module[_0x928f('0x9')]=function(_0x5d085d,_0x4f8fc4){return _0x5d085d[_0x928f('0xa')](_0x928f('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x928f('0xc'),'fields':[_0x928f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index ca07280..d654b72 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 _0x1bcd=['FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1673bb,_0x53b9d6){var _0x569af9=function(_0x1f9b98){while(--_0x1f9b98){_0x1673bb['push'](_0x1673bb['shift']());}};_0x569af9(++_0x53b9d6);}(_0x1bcd,0x1e6));var _0xd1bc=function(_0xdf7264,_0x1acc65){_0xdf7264=_0xdf7264-0x0;var _0x2a36d1=_0x1bcd[_0xdf7264];return _0x2a36d1;};'use strict';var _=require(_0xd1bc('0x0'));var util=require(_0xd1bc('0x1'));var moment=require(_0xd1bc('0x2'));var BPromise=require(_0xd1bc('0x3'));var rs=require(_0xd1bc('0x4'));var fs=require('fs');var Redis=require(_0xd1bc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd1bc('0x6'));var logger=require(_0xd1bc('0x7'))(_0xd1bc('0x8'));var config=require(_0xd1bc('0x9'));var jayson=require(_0xd1bc('0xa'));var client=jayson[_0xd1bc('0xb')][_0xd1bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cc1ff,_0x1690d4,_0x390c1f){return new BPromise(function(_0x5eec28,_0x1ee99a){return client[_0xd1bc('0xd')](_0x4cc1ff,_0x390c1f)[_0xd1bc('0xe')](function(_0x294b31){logger['info'](_0xd1bc('0xf'),_0x1690d4,_0xd1bc('0x10'));logger[_0xd1bc('0x11')](_0xd1bc('0x12'),_0x1690d4,'request\x20sent',JSON[_0xd1bc('0x13')](_0x294b31));if(_0x294b31[_0xd1bc('0x14')]){if(_0x294b31['error']['code']===0x1f4){logger[_0xd1bc('0x14')](_0xd1bc('0xf'),_0x1690d4,_0x294b31[_0xd1bc('0x14')][_0xd1bc('0x15')]);return _0x1ee99a(_0x294b31[_0xd1bc('0x14')][_0xd1bc('0x15')]);}logger[_0xd1bc('0x14')](_0xd1bc('0xf'),_0x1690d4,_0x294b31[_0xd1bc('0x14')]['message']);return _0x5eec28(_0x294b31[_0xd1bc('0x14')][_0xd1bc('0x15')]);}else{logger[_0xd1bc('0x16')](_0xd1bc('0xf'),_0x1690d4,'request\x20sent');_0x5eec28(_0x294b31['result'][_0xd1bc('0x15')]);}})[_0xd1bc('0x17')](function(_0x381ae3){logger[_0xd1bc('0x14')](_0xd1bc('0xf'),_0x1690d4,_0x381ae3);_0x1ee99a(_0x381ae3);});});} \ No newline at end of file +var _0xe12e=['request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s'];(function(_0x2f2f60,_0x2e6671){var _0x26f1d2=function(_0x591f35){while(--_0x591f35){_0x2f2f60['push'](_0x2f2f60['shift']());}};_0x26f1d2(++_0x2e6671);}(_0xe12e,0xc4));var _0xee12=function(_0x58696a,_0x2aed89){_0x58696a=_0x58696a-0x0;var _0x32393a=_0xe12e[_0x58696a];return _0x32393a;};'use strict';var _=require('lodash');var util=require(_0xee12('0x0'));var moment=require(_0xee12('0x1'));var BPromise=require(_0xee12('0x2'));var rs=require(_0xee12('0x3'));var fs=require('fs');var Redis=require(_0xee12('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xee12('0x5'));var logger=require('../../config/logger')(_0xee12('0x6'));var config=require('../../config/environment');var jayson=require(_0xee12('0x7'));var client=jayson['client'][_0xee12('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b66d4,_0x58218a,_0x4d6994){return new BPromise(function(_0x4f8b00,_0x3360a5){return client[_0xee12('0x9')](_0x5b66d4,_0x4d6994)[_0xee12('0xa')](function(_0x1af159){logger[_0xee12('0xb')](_0xee12('0xc'),_0x58218a,_0xee12('0xd'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x58218a,_0xee12('0xd'),JSON[_0xee12('0xe')](_0x1af159));if(_0x1af159[_0xee12('0xf')]){if(_0x1af159['error'][_0xee12('0x10')]===0x1f4){logger[_0xee12('0xf')](_0xee12('0xc'),_0x58218a,_0x1af159[_0xee12('0xf')]['message']);return _0x3360a5(_0x1af159[_0xee12('0xf')][_0xee12('0x11')]);}logger[_0xee12('0xf')](_0xee12('0xc'),_0x58218a,_0x1af159[_0xee12('0xf')][_0xee12('0x11')]);return _0x4f8b00(_0x1af159[_0xee12('0xf')][_0xee12('0x11')]);}else{logger[_0xee12('0xb')](_0xee12('0xc'),_0x58218a,_0xee12('0xd'));_0x4f8b00(_0x1af159['result'][_0xee12('0x11')]);}})[_0xee12('0x12')](function(_0x4abe7f){logger['error'](_0xee12('0xc'),_0x58218a,_0x4abe7f);_0x3360a5(_0x4abe7f);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index d63aee6..c920d0a 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 _0x5cca=['../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xeb495a,_0x14fa1a){var _0x4af1e1=function(_0x1aea12){while(--_0x1aea12){_0xeb495a['push'](_0xeb495a['shift']());}};_0x4af1e1(++_0x14fa1a);}(_0x5cca,0x1c4));var _0xa5cc=function(_0x7472aa,_0x3971a1){_0x7472aa=_0x7472aa-0x0;var _0x12e552=_0x5cca[_0x7472aa];return _0x12e552;};'use strict';var multer=require(_0xa5cc('0x0'));var util=require(_0xa5cc('0x1'));var path=require(_0xa5cc('0x2'));var timeout=require(_0xa5cc('0x3'));var express=require(_0xa5cc('0x4'));var router=express[_0xa5cc('0x5')]();var auth=require(_0xa5cc('0x6'));var interaction=require(_0xa5cc('0x7'));var config=require(_0xa5cc('0x8'));var controller=require(_0xa5cc('0x9'));router[_0xa5cc('0xa')]('/',auth[_0xa5cc('0xb')](),controller[_0xa5cc('0xc')]);router[_0xa5cc('0xa')](_0xa5cc('0xd'),auth[_0xa5cc('0xb')](),controller['describe']);router[_0xa5cc('0xa')](_0xa5cc('0xe'),auth[_0xa5cc('0xb')](),controller[_0xa5cc('0xf')]);router[_0xa5cc('0x10')]('/',auth[_0xa5cc('0xb')](),controller[_0xa5cc('0x11')]);router[_0xa5cc('0x12')](_0xa5cc('0xe'),auth[_0xa5cc('0xb')](),controller[_0xa5cc('0x13')]);router[_0xa5cc('0x14')](_0xa5cc('0xe'),auth[_0xa5cc('0xb')](),controller[_0xa5cc('0x15')]);module[_0xa5cc('0x16')]=router; \ No newline at end of file +var _0x3c0a=['util','path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','show','create','put','/:id','update','delete','exports','multer'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3c0a,0x97));var _0xa3c0=function(_0x144fd7,_0x12fea4){_0x144fd7=_0x144fd7-0x0;var _0x296266=_0x3c0a[_0x144fd7];return _0x296266;};'use strict';var multer=require(_0xa3c0('0x0'));var util=require(_0xa3c0('0x1'));var path=require(_0xa3c0('0x2'));var timeout=require(_0xa3c0('0x3'));var express=require(_0xa3c0('0x4'));var router=express[_0xa3c0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa3c0('0x6'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0xa3c0('0x7')](),controller[_0xa3c0('0x8')]);router[_0xa3c0('0x9')](_0xa3c0('0xa'),auth[_0xa3c0('0x7')](),controller[_0xa3c0('0xb')]);router[_0xa3c0('0x9')]('/:id',auth[_0xa3c0('0x7')](),controller[_0xa3c0('0xc')]);router['post']('/',auth[_0xa3c0('0x7')](),controller[_0xa3c0('0xd')]);router[_0xa3c0('0xe')](_0xa3c0('0xf'),auth[_0xa3c0('0x7')](),controller[_0xa3c0('0x10')]);router[_0xa3c0('0x11')](_0xa3c0('0xf'),auth[_0xa3c0('0x7')](),controller['destroy']);module[_0xa3c0('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 802c3cf..757cbfe 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 _0x6f47=['destroy','util','path','express','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x6f47,0xc7));var _0x76f4=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x6f47[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var auth=require(_0x76f4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x76f4('0x4'));var controller=require(_0x76f4('0x5'));router[_0x76f4('0x6')]('/',auth[_0x76f4('0x7')](),controller['index']);router[_0x76f4('0x6')](_0x76f4('0x8'),auth[_0x76f4('0x7')](),controller['show']);router[_0x76f4('0x6')](_0x76f4('0x9'),auth[_0x76f4('0x7')](),controller[_0x76f4('0xa')]);router[_0x76f4('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0x76f4('0xb')]);router[_0x76f4('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x76f4('0xc')](_0x76f4('0x9'),auth[_0x76f4('0x7')](),controller[_0x76f4('0xd')]);router[_0x76f4('0xe')](_0x76f4('0x8'),auth[_0x76f4('0x7')](),controller[_0x76f4('0xf')]);router[_0x76f4('0x10')]('/:id',auth[_0x76f4('0x7')](),controller[_0x76f4('0x11')]);module['exports']=router; \ No newline at end of file +var _0x98a8=['./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x98a8,0x12c));var _0x898a=function(_0x4b5cb4,_0x3a840f){_0x4b5cb4=_0x4b5cb4-0x0;var _0x5cf1fb=_0x98a8[_0x4b5cb4];return _0x5cf1fb;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['get'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0xf')]);router[_0x898a('0x9')](_0x898a('0x10'),auth[_0x898a('0xa')](),controller[_0x898a('0x11')]);router[_0x898a('0x12')]('/',auth[_0x898a('0xa')](),controller['create']);router[_0x898a('0x12')]('/:id/configurations',auth[_0x898a('0xa')](),controller['addConfiguration']);router[_0x898a('0x13')](_0x898a('0xc'),auth[_0x898a('0xa')](),controller['update']);router['delete']('/:id',auth[_0x898a('0xa')](),controller[_0x898a('0x14')]);module[_0x898a('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 5c240d7..cf3d0d3 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 _0x97cb=['basic','integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x4ed2ef,_0xcd6b25){var _0x15bf40=function(_0x5d3952){while(--_0x5d3952){_0x4ed2ef['push'](_0x4ed2ef['shift']());}};_0x15bf40(++_0xcd6b25);}(_0x97cb,0xc7));var _0xb97c=function(_0xaaa0c0,_0x59b040){_0xaaa0c0=_0xaaa0c0-0x0;var _0x5e7ccf=_0x97cb[_0xaaa0c0];return _0x5e7ccf;};'use strict';var Sequelize=require(_0xb97c('0x0'));module[_0xb97c('0x1')]={'name':{'type':Sequelize[_0xb97c('0x2')]},'description':{'type':Sequelize[_0xb97c('0x2')]},'username':{'type':Sequelize[_0xb97c('0x2')]},'remoteUri':{'type':Sequelize[_0xb97c('0x2')]},'authType':{'type':Sequelize[_0xb97c('0x3')](_0xb97c('0x4')),'defaultValue':_0xb97c('0x4')},'password':{'type':Sequelize[_0xb97c('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xb97c('0x2')]},'token':{'type':Sequelize[_0xb97c('0x2')]},'tokenSecret':{'type':Sequelize[_0xb97c('0x2')]},'serverUrl':{'type':Sequelize[_0xb97c('0x2')]},'type':{'type':Sequelize[_0xb97c('0x3')](_0xb97c('0x5'),_0xb97c('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xcbb1=['integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x240f50,_0x2918d3){var _0x168da4=function(_0x38b01d){while(--_0x38b01d){_0x240f50['push'](_0x240f50['shift']());}};_0x168da4(++_0x2918d3);}(_0xcbb1,0xbc));var _0x1cbb=function(_0x1ff5d7,_0x14c4b7){_0x1ff5d7=_0x1ff5d7-0x0;var _0xa2f1c3=_0xcbb1[_0x1ff5d7];return _0xa2f1c3;};'use strict';var Sequelize=require(_0x1cbb('0x0'));module[_0x1cbb('0x1')]={'name':{'type':Sequelize[_0x1cbb('0x2')]},'description':{'type':Sequelize[_0x1cbb('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1cbb('0x2')]},'authType':{'type':Sequelize[_0x1cbb('0x3')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize[_0x1cbb('0x2')]},'consumerKey':{'type':Sequelize[_0x1cbb('0x2')]},'consumerSecret':{'type':Sequelize[_0x1cbb('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x1cbb('0x2')]},'serverUrl':{'type':Sequelize[_0x1cbb('0x2')]},'type':{'type':Sequelize[_0x1cbb('0x3')](_0x1cbb('0x4'),_0x1cbb('0x5')),'defaultValue':_0x1cbb('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 7c38f78..0519e8e 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 _0x06ce=['%s:%s','toString','base64','concat','_embedded','active','label','getFields,\x20%s,\x20%s,\x20%s','statusCode','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','ejs','lodash','squel','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','end','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','model','query','keys','attributes','fields','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','intersection','find','create','body','destroy','getConfigurations','DeskConfiguration','length','nolimit','findOne','AccountId','getSubjects','Descriptions','getDescriptions','channel','Subjects','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','lastIndexOf','GET','format','application/json','basic','headers','Basic\x20%s'];(function(_0x598f21,_0x122523){var _0x127aab=function(_0x1860b8){while(--_0x1860b8){_0x598f21['push'](_0x598f21['shift']());}};_0x127aab(++_0x122523);}(_0x06ce,0xf7));var _0xe06c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x06ce[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0xe06c('0x0'));var emlformat=require(_0xe06c('0x1'));var rimraf=require(_0xe06c('0x2'));var zipdir=require(_0xe06c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe06c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe06c('0x5'));var util=require(_0xe06c('0x6'));var path=require(_0xe06c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe06c('0x8'));var fs=require('fs');var _=require(_0xe06c('0x9'));var squel=require(_0xe06c('0xa'));var crypto=require('crypto');var jsforce=require(_0xe06c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe06c('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe06c('0xd'));var as=require(_0xe06c('0xe'));var hardwareService=require(_0xe06c('0xf'));var logger=require('../../config/logger')(_0xe06c('0x10'));var utils=require(_0xe06c('0x11'));var config=require('../../config/environment');var db=require(_0xe06c('0x12'))['db'];var integrations=require(_0xe06c('0x13'));var jayson=require(_0xe06c('0x14'));var client=jayson[_0xe06c('0x15')][_0xe06c('0x16')]({'port':0x232a});function checkPasswordPattern(_0x526487,_0x2e6551,_0x2ee9ea){if(_0x2ee9ea){var _0x3326d2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3326d2[_0xe06c('0x17')](_0x2e6551)){return _0x526487;}else{throw new db['Sequelize'][(_0xe06c('0x18'))](_0xe06c('0x19'));}}else{return _0x526487;}}function respondWithRpcPromise(_0x434925,_0x208ca,_0x34dc01,_0x14cbf0){return new BPromise(function(_0x56cb8f,_0x36fc2d){var _0x912f92=_0x14cbf0||client;return _0x912f92[_0xe06c('0x1a')](_0x434925,_0x34dc01)[_0xe06c('0x1b')](function(_0x4d78cb){logger['info']('DeskAccount,\x20%s,\x20%s',_0x208ca,_0xe06c('0x1c'));logger['debug'](_0xe06c('0x1d'),_0x208ca,_0xe06c('0x1c'),JSON[_0xe06c('0x1e')](_0x4d78cb));if(_0x4d78cb[_0xe06c('0x1f')]){if(_0x4d78cb[_0xe06c('0x1f')][_0xe06c('0x20')]===0x1f4){logger[_0xe06c('0x1f')](_0xe06c('0x21'),_0x208ca,_0x4d78cb[_0xe06c('0x1f')][_0xe06c('0x22')]);return _0x36fc2d(_0x4d78cb[_0xe06c('0x1f')]['message']);}logger[_0xe06c('0x1f')](_0xe06c('0x21'),_0x208ca,_0x4d78cb[_0xe06c('0x1f')][_0xe06c('0x22')]);return _0x56cb8f(_0x4d78cb[_0xe06c('0x1f')]['message']);}else{logger['info'](_0xe06c('0x21'),_0x208ca,_0xe06c('0x1c'));_0x56cb8f(_0x4d78cb[_0xe06c('0x23')]['message']);}})['catch'](function(_0x2b1389){logger[_0xe06c('0x1f')](_0xe06c('0x21'),_0x208ca,_0x2b1389);_0x36fc2d(_0x2b1389);});});}function respondWithStatusCode(_0x3df7b4,_0x227d21){_0x227d21=_0x227d21||0xcc;return function(_0x43ce60){if(_0x43ce60){return _0x3df7b4['sendStatus'](_0x227d21);}return _0x3df7b4[_0xe06c('0x24')](_0x227d21)['end']();};}function respondWithResult(_0x4dac7d,_0x3f6f49){_0x3f6f49=_0x3f6f49||0xc8;return function(_0x564961){if(_0x564961){return _0x4dac7d[_0xe06c('0x24')](_0x3f6f49)[_0xe06c('0x25')](_0x564961);}};}function respondWithFilteredResult(_0x2cb310,_0x5b90f5){return function(_0x15eec6){if(_0x15eec6){var _0x558aa0=_0x15eec6[_0xe06c('0x26')],_0x4cbb55=_0x5b90f5[_0xe06c('0x27')],_0x263680=_0x5b90f5['offset']+_0x5b90f5[_0xe06c('0x28')],_0xf43573;if(_0x263680>=_0x558aa0){_0x263680=_0x558aa0;_0xf43573=0xc8;}else{_0xf43573=0xce;}_0x2cb310['status'](_0xf43573);return _0x2cb310[_0xe06c('0x29')](_0xe06c('0x2a'),_0x4cbb55+'-'+_0x263680+'/'+_0x558aa0)[_0xe06c('0x25')](_0x15eec6);}return null;};}function patchUpdates(_0x2a3b30){return function(_0x3f4441){try{jsonpatch[_0xe06c('0x2b')](_0x3f4441,_0x2a3b30,!![]);}catch(_0x3c166d){return BPromise[_0xe06c('0x2c')](_0x3c166d);}return _0x3f4441[_0xe06c('0x2d')]();};}function saveUpdates(_0x15d68e,_0x3348c9){return function(_0x1e72e9){if(_0x1e72e9){return _0x1e72e9[_0xe06c('0x2e')](_0x15d68e)['then'](function(_0x2e452c){return _0x2e452c;});}return null;};}function removeEntity(_0x2c9ed7,_0x26bb44){return function(_0x2dc8d9){if(_0x2dc8d9){return _0x2dc8d9['destroy']()[_0xe06c('0x1b')](function(){_0x2c9ed7[_0xe06c('0x24')](0xcc)[_0xe06c('0x2f')]();});}};}function handleEntityNotFound(_0x370311,_0x4db781){return function(_0xdeaba6){if(!_0xdeaba6){_0x370311['sendStatus'](0x194);}return _0xdeaba6;};}function handleError(_0x1966e5,_0x1d75fe){_0x1d75fe=_0x1d75fe||0x1f4;return function(_0x1bffd6){logger[_0xe06c('0x1f')](_0x1bffd6[_0xe06c('0x30')]);if(_0x1bffd6['name']){delete _0x1bffd6[_0xe06c('0x31')];}_0x1966e5['status'](_0x1d75fe)[_0xe06c('0x32')](_0x1bffd6);};}exports[_0xe06c('0x33')]=function(_0x500aff,_0x4ba9fd){var _0x328a84={},_0x4a5fa4={},_0x33b7da={'count':0x0,'rows':[]};var _0x3614f6=_[_0xe06c('0x34')](db[_0xe06c('0x35')][_0xe06c('0x36')],function(_0x2942af){return{'name':_0x2942af[_0xe06c('0x37')],'type':_0x2942af['type']['key']};});_0x4a5fa4[_0xe06c('0x38')]=_[_0xe06c('0x34')](_0x3614f6,'name');_0x4a5fa4[_0xe06c('0x39')]=_[_0xe06c('0x3a')](_0x500aff[_0xe06c('0x39')]);_0x4a5fa4['filters']=_['intersection'](_0x4a5fa4[_0xe06c('0x38')],_0x4a5fa4[_0xe06c('0x39')]);_0x328a84[_0xe06c('0x3b')]=_['intersection'](_0x4a5fa4[_0xe06c('0x38')],qs[_0xe06c('0x3c')](_0x500aff[_0xe06c('0x39')][_0xe06c('0x3c')]));_0x328a84[_0xe06c('0x3b')]=_0x328a84[_0xe06c('0x3b')]['length']?_0x328a84[_0xe06c('0x3b')]:_0x4a5fa4[_0xe06c('0x38')];if(!_0x500aff['query']['hasOwnProperty']('nolimit')){_0x328a84['limit']=qs[_0xe06c('0x28')](_0x500aff[_0xe06c('0x39')]['limit']);_0x328a84[_0xe06c('0x27')]=qs[_0xe06c('0x27')](_0x500aff[_0xe06c('0x39')][_0xe06c('0x27')]);}_0x328a84[_0xe06c('0x3d')]=qs[_0xe06c('0x3e')](_0x500aff[_0xe06c('0x39')][_0xe06c('0x3e')]);_0x328a84[_0xe06c('0x3f')]=qs[_0xe06c('0x40')](_[_0xe06c('0x41')](_0x500aff[_0xe06c('0x39')],_0x4a5fa4['filters']));if(_0x500aff['query'][_0xe06c('0x42')]){_0x328a84[_0xe06c('0x3f')]=_[_0xe06c('0x43')](_0x328a84[_0xe06c('0x3f')],{'$or':_[_0xe06c('0x34')](_0x3614f6,function(_0x30a8e6){if(_0x30a8e6[_0xe06c('0x44')]!==_0xe06c('0x45')){var _0x274160={};_0x274160[_0x30a8e6[_0xe06c('0x31')]]={'$like':'%'+_0x500aff[_0xe06c('0x39')][_0xe06c('0x42')]+'%'};return _0x274160;}})});}_0x328a84=_[_0xe06c('0x43')]({},_0x328a84,_0x500aff[_0xe06c('0x46')]);var _0x4cca45={'where':_0x328a84[_0xe06c('0x3f')]};return db[_0xe06c('0x35')][_0xe06c('0x26')](_0x4cca45)['then'](function(_0x43f943){_0x33b7da[_0xe06c('0x26')]=_0x43f943;if(_0x500aff[_0xe06c('0x39')][_0xe06c('0x47')]){_0x328a84[_0xe06c('0x48')]=[{'all':!![]}];}return db[_0xe06c('0x35')]['findAll'](_0x328a84);})['then'](function(_0x1491be){_0x33b7da[_0xe06c('0x49')]=_0x1491be;return _0x33b7da;})['then'](respondWithFilteredResult(_0x4ba9fd,_0x328a84))[_0xe06c('0x4a')](handleError(_0x4ba9fd,null));};exports[_0xe06c('0x4b')]=function(_0x57cb88,_0x4efc01){var _0x23f3ae={'raw':![],'where':{'id':_0x57cb88[_0xe06c('0x4c')]['id']}},_0x5bef7c={};_0x5bef7c[_0xe06c('0x38')]=_[_0xe06c('0x3a')](db[_0xe06c('0x35')][_0xe06c('0x36')]);_0x5bef7c['query']=_['keys'](_0x57cb88[_0xe06c('0x39')]);_0x5bef7c[_0xe06c('0x40')]=_['intersection'](_0x5bef7c['model'],_0x5bef7c['query']);_0x23f3ae[_0xe06c('0x3b')]=_[_0xe06c('0x4d')](_0x5bef7c[_0xe06c('0x38')],qs[_0xe06c('0x3c')](_0x57cb88[_0xe06c('0x39')][_0xe06c('0x3c')]));_0x23f3ae[_0xe06c('0x3b')]=_0x23f3ae[_0xe06c('0x3b')]['length']?_0x23f3ae['attributes']:_0x5bef7c['model'];if(_0x57cb88[_0xe06c('0x39')][_0xe06c('0x47')]){_0x23f3ae[_0xe06c('0x48')]=[{'all':!![]}];}_0x23f3ae=_[_0xe06c('0x43')]({},_0x23f3ae,_0x57cb88['options']);return db[_0xe06c('0x35')][_0xe06c('0x4e')](_0x23f3ae)[_0xe06c('0x1b')](handleEntityNotFound(_0x4efc01,null))[_0xe06c('0x1b')](respondWithResult(_0x4efc01,null))[_0xe06c('0x4a')](handleError(_0x4efc01,null));};exports[_0xe06c('0x4f')]=function(_0x2909e9,_0x361ec4){return db['DeskAccount'][_0xe06c('0x4f')](_0x2909e9['body'],{})[_0xe06c('0x1b')](respondWithResult(_0x361ec4,0xc9))[_0xe06c('0x4a')](handleError(_0x361ec4,null));};exports['update']=function(_0x4f8906,_0xd60cb2){if(_0x4f8906['body']['id']){delete _0x4f8906[_0xe06c('0x50')]['id'];}return db[_0xe06c('0x35')]['find']({'where':{'id':_0x4f8906[_0xe06c('0x4c')]['id']}})[_0xe06c('0x1b')](handleEntityNotFound(_0xd60cb2,null))[_0xe06c('0x1b')](saveUpdates(_0x4f8906[_0xe06c('0x50')],null))[_0xe06c('0x1b')](respondWithResult(_0xd60cb2,null))[_0xe06c('0x4a')](handleError(_0xd60cb2,null));};exports[_0xe06c('0x51')]=function(_0x23a42a,_0x2b324e){return db[_0xe06c('0x35')][_0xe06c('0x4e')]({'where':{'id':_0x23a42a['params']['id']}})[_0xe06c('0x1b')](handleEntityNotFound(_0x2b324e,null))['then'](removeEntity(_0x2b324e,null))[_0xe06c('0x4a')](handleError(_0x2b324e,null));};exports[_0xe06c('0x52')]=function(_0x63ee4c,_0x311260,_0x12008d){var _0x10cb3c={};var _0x52e7ed={};var _0x5e4067;var _0x20e994;return db[_0xe06c('0x35')]['findOne']({'where':{'id':_0x63ee4c[_0xe06c('0x4c')]['id']}})[_0xe06c('0x1b')](handleEntityNotFound(_0x311260,null))['then'](function(_0x260a75){if(_0x260a75){_0x5e4067=_0x260a75;_0x52e7ed[_0xe06c('0x38')]=_['keys'](db[_0xe06c('0x53')][_0xe06c('0x36')]);_0x52e7ed[_0xe06c('0x39')]=_[_0xe06c('0x3a')](_0x63ee4c['query']);_0x52e7ed[_0xe06c('0x40')]=_[_0xe06c('0x4d')](_0x52e7ed[_0xe06c('0x38')],_0x52e7ed[_0xe06c('0x39')]);_0x10cb3c[_0xe06c('0x3b')]=_['intersection'](_0x52e7ed[_0xe06c('0x38')],qs['fields'](_0x63ee4c[_0xe06c('0x39')][_0xe06c('0x3c')]));_0x10cb3c[_0xe06c('0x3b')]=_0x10cb3c[_0xe06c('0x3b')][_0xe06c('0x54')]?_0x10cb3c[_0xe06c('0x3b')]:_0x52e7ed[_0xe06c('0x38')];_0x10cb3c[_0xe06c('0x3d')]=qs[_0xe06c('0x3e')](_0x63ee4c['query'][_0xe06c('0x3e')]);_0x10cb3c['where']=qs[_0xe06c('0x40')](_[_0xe06c('0x41')](_0x63ee4c[_0xe06c('0x39')],_0x52e7ed['filters']));if(_0x63ee4c[_0xe06c('0x39')][_0xe06c('0x42')]){_0x10cb3c[_0xe06c('0x3f')]=_[_0xe06c('0x43')](_0x10cb3c['where'],{'$or':_[_0xe06c('0x34')](_0x10cb3c[_0xe06c('0x3b')],function(_0x472d6d){var _0x22d18e={};_0x22d18e[_0x472d6d]={'$like':'%'+_0x63ee4c[_0xe06c('0x39')][_0xe06c('0x42')]+'%'};return _0x22d18e;})});}_0x10cb3c=_['merge']({},_0x10cb3c,_0x63ee4c['options']);return _0x5e4067[_0xe06c('0x52')](_0x10cb3c);}})[_0xe06c('0x1b')](function(_0x4d567e){if(_0x4d567e){_0x20e994=_0x4d567e[_0xe06c('0x54')];if(!_0x63ee4c[_0xe06c('0x39')]['hasOwnProperty'](_0xe06c('0x55'))){_0x10cb3c[_0xe06c('0x28')]=qs[_0xe06c('0x28')](_0x63ee4c[_0xe06c('0x39')]['limit']);_0x10cb3c[_0xe06c('0x27')]=qs[_0xe06c('0x27')](_0x63ee4c[_0xe06c('0x39')][_0xe06c('0x27')]);}return _0x5e4067['getConfigurations'](_0x10cb3c);}})[_0xe06c('0x1b')](function(_0xee1c47){if(_0xee1c47){return _0xee1c47?{'count':_0x20e994,'rows':_0xee1c47}:null;}})[_0xe06c('0x1b')](respondWithResult(_0x311260,null))['catch'](handleError(_0x311260,null));};exports['addConfiguration']=function(_0x572d27,_0x394417,_0x5081a6){if(_0x572d27[_0xe06c('0x50')]['id']){delete _0x572d27[_0xe06c('0x50')]['id'];}return db['DeskAccount'][_0xe06c('0x56')]({'where':{'id':_0x572d27[_0xe06c('0x4c')]['id']}})[_0xe06c('0x1b')](handleEntityNotFound(_0x394417,null))[_0xe06c('0x1b')](function(_0x21b534){if(_0x21b534){_0x572d27[_0xe06c('0x50')][_0xe06c('0x57')]=_0x21b534['id'];_0x572d27['body']['Subjects']=integrations[_0xe06c('0x58')](_0x572d27[_0xe06c('0x50')]['channel'],_0x572d27['body'][_0xe06c('0x44')]);_0x572d27[_0xe06c('0x50')][_0xe06c('0x59')]=integrations[_0xe06c('0x5a')](_0x572d27[_0xe06c('0x50')][_0xe06c('0x5b')],_0x572d27[_0xe06c('0x50')][_0xe06c('0x44')]);return db[_0xe06c('0x53')]['create'](_0x572d27['body'],{'include':[{'model':db['DeskField'],'as':_0xe06c('0x5c')},{'model':db['DeskField'],'as':_0xe06c('0x59')}]});}return null;})[_0xe06c('0x1b')](respondWithResult(_0x394417,null))[_0xe06c('0x4a')](handleError(_0x394417,null));};exports[_0xe06c('0x5d')]=function(_0x1eb8d7,_0x3fb753,_0x45de70){var _0x55353d=[{'name':_0xe06c('0x5e'),'label':_0xe06c('0x5e'),'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 _0x2ef897='';return db['DeskAccount']['findOne']({'where':{'id':_0x1eb8d7[_0xe06c('0x4c')]['id']},'attributes':['id',_0xe06c('0x5f'),_0xe06c('0x60'),_0xe06c('0x61'),_0xe06c('0x62'),_0xe06c('0x63'),_0xe06c('0x64'),_0xe06c('0x65'),_0xe06c('0x66')]})[_0xe06c('0x1b')](handleEntityNotFound(_0x3fb753,null))['then'](function(_0x49c8d9){if(_0x49c8d9){_0x2ef897=_0x49c8d9[_0xe06c('0x5f')];var _0x414991=_0x2ef897['slice'](-0x1);if(_0x414991==='/'){_0x2ef897=_0x2ef897['substring'](0x0,_0x2ef897[_0xe06c('0x67')](_0x414991));}var _0x53e968={'method':_0xe06c('0x68'),'uri':util[_0xe06c('0x69')]('%s/custom_fields',_0x2ef897),'headers':{'Content-Type':_0xe06c('0x6a'),'Accept':'application/json'},'json':!![]};if(_0x49c8d9[_0xe06c('0x60')]===_0xe06c('0x6b')){_0x53e968[_0xe06c('0x6c')]['Authorization']=util[_0xe06c('0x69')](_0xe06c('0x6d'),new Buffer(util['format'](_0xe06c('0x6e'),_0x49c8d9['username'],_0x49c8d9[_0xe06c('0x62')]))[_0xe06c('0x6f')](_0xe06c('0x70')));}return rp(_0x53e968)[_0xe06c('0x1b')](function(_0x98e1a){return _0x55353d[_0xe06c('0x71')](_[_0xe06c('0x34')](_0x98e1a[_0xe06c('0x72')]['entries'],function(_0x3cfe2d){return{'id':_0x3cfe2d[_0xe06c('0x31')],'name':_0x3cfe2d['name'],'type':_0x3cfe2d['type'],'active':_0x3cfe2d[_0xe06c('0x73')],'label':_0x3cfe2d[_0xe06c('0x74')],'custom':!![]};}));});}})['then'](function(_0x1a2a6f){return{'count':_0x1a2a6f[_0xe06c('0x54')],'rows':_0x1a2a6f};})[_0xe06c('0x1b')](respondWithResult(_0x3fb753,null))[_0xe06c('0x4a')](function(_0x8442a0){var _0x4b08c3=_0x1eb8d7[_0xe06c('0x39')]['test']?0x1f4:_0x8442a0['statusCode']||0x1f4;logger[_0xe06c('0x1f')](_0xe06c('0x75'),_0xe06c('0x5d'),_0x4b08c3,JSON[_0xe06c('0x1e')](_0x8442a0));delete _0x8442a0['name'];if(_0x4b08c3===0x191){_0x4b08c3=0x190;}_0x3fb753['status'](_0x4b08c3)[_0xe06c('0x32')](_0x1eb8d7[_0xe06c('0x39')][_0xe06c('0x17')]?{'message':'Wrong\x20credentials','statusCode':_0x8442a0[_0xe06c('0x76')]}:_0x8442a0);});}; \ No newline at end of file +var _0x3a9f=['path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','status','json','offset','limit','set','Content-Range','reject','save','update','end','sendStatus','stack','name','index','map','DeskAccount','rawAttributes','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','destroy','findOne','DeskConfiguration','order','getConfigurations','AccountId','getSubjects','channel','getDescriptions','type','Descriptions','remoteUri','authType','username','password','consumerKey','consumerSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','toString','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x130657,_0x1df6b0){var _0xe593ec=function(_0x233b6d){while(--_0x233b6d){_0x130657['push'](_0x130657['shift']());}};_0xe593ec(++_0x1df6b0);}(_0x3a9f,0x1e8));var _0xf3a9=function(_0x1d3577,_0x17a32e){_0x1d3577=_0x1d3577-0x0;var _0x277d9a=_0x3a9f[_0x1d3577];return _0x277d9a;};'use strict';var pdf=require(_0xf3a9('0x0'));var emlformat=require(_0xf3a9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf3a9('0x2'));var jsonpatch=require(_0xf3a9('0x3'));var rp=require('request-promise');var moment=require(_0xf3a9('0x4'));var BPromise=require(_0xf3a9('0x5'));var Mustache=require(_0xf3a9('0x6'));var util=require(_0xf3a9('0x7'));var path=require(_0xf3a9('0x8'));var sox=require(_0xf3a9('0x9'));var csv=require(_0xf3a9('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf3a9('0xb'));var crypto=require(_0xf3a9('0xc'));var jsforce=require(_0xf3a9('0xd'));var deskjs=require(_0xf3a9('0xe'));var toCsv=require(_0xf3a9('0xa'));var querystring=require(_0xf3a9('0xf'));var Papa=require(_0xf3a9('0x10'));var Redis=require('ioredis');var authService=require(_0xf3a9('0x11'));var qs=require(_0xf3a9('0x12'));var as=require(_0xf3a9('0x13'));var hardwareService=require(_0xf3a9('0x14'));var logger=require('../../config/logger')(_0xf3a9('0x15'));var utils=require(_0xf3a9('0x16'));var config=require(_0xf3a9('0x17'));var db=require(_0xf3a9('0x18'))['db'];var integrations=require(_0xf3a9('0x19'));var jayson=require('jayson/promise');var client=jayson[_0xf3a9('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x4c592f,_0x1f9936,_0x5ce2ac){if(_0x5ce2ac){var _0x21253a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x21253a[_0xf3a9('0x1b')](_0x1f9936)){return _0x4c592f;}else{throw new db[(_0xf3a9('0x1c'))][(_0xf3a9('0x1d'))](_0xf3a9('0x1e'));}}else{return _0x4c592f;}}function respondWithRpcPromise(_0x4e7031,_0x3b62be,_0x3c0794,_0x5aafec){return new BPromise(function(_0x36edfe,_0x24b2cd){var _0x27691e=_0x5aafec||client;return _0x27691e[_0xf3a9('0x1f')](_0x4e7031,_0x3c0794)[_0xf3a9('0x20')](function(_0x17166a){logger['info'](_0xf3a9('0x21'),_0x3b62be,_0xf3a9('0x22'));logger[_0xf3a9('0x23')](_0xf3a9('0x24'),_0x3b62be,_0xf3a9('0x22'),JSON['stringify'](_0x17166a));if(_0x17166a[_0xf3a9('0x25')]){if(_0x17166a['error'][_0xf3a9('0x26')]===0x1f4){logger[_0xf3a9('0x25')](_0xf3a9('0x21'),_0x3b62be,_0x17166a['error'][_0xf3a9('0x27')]);return _0x24b2cd(_0x17166a['error']['message']);}logger[_0xf3a9('0x25')]('DeskAccount,\x20%s,\x20%s',_0x3b62be,_0x17166a[_0xf3a9('0x25')][_0xf3a9('0x27')]);return _0x36edfe(_0x17166a[_0xf3a9('0x25')][_0xf3a9('0x27')]);}else{logger[_0xf3a9('0x28')](_0xf3a9('0x21'),_0x3b62be,_0xf3a9('0x22'));_0x36edfe(_0x17166a[_0xf3a9('0x29')][_0xf3a9('0x27')]);}})['catch'](function(_0x5a83a4){logger[_0xf3a9('0x25')](_0xf3a9('0x21'),_0x3b62be,_0x5a83a4);_0x24b2cd(_0x5a83a4);});});}function respondWithStatusCode(_0x1c97cc,_0x43738d){_0x43738d=_0x43738d||0xcc;return function(_0x4e1af7){if(_0x4e1af7){return _0x1c97cc['sendStatus'](_0x43738d);}return _0x1c97cc[_0xf3a9('0x2a')](_0x43738d)['end']();};}function respondWithResult(_0x50b742,_0x5d3e72){_0x5d3e72=_0x5d3e72||0xc8;return function(_0x5b9c44){if(_0x5b9c44){return _0x50b742[_0xf3a9('0x2a')](_0x5d3e72)[_0xf3a9('0x2b')](_0x5b9c44);}};}function respondWithFilteredResult(_0x2e001e,_0x1adac9){return function(_0x42b842){if(_0x42b842){var _0x1e367c=_0x42b842['count'],_0x49aeaa=_0x1adac9[_0xf3a9('0x2c')],_0x5ba66c=_0x1adac9[_0xf3a9('0x2c')]+_0x1adac9[_0xf3a9('0x2d')],_0x326391;if(_0x5ba66c>=_0x1e367c){_0x5ba66c=_0x1e367c;_0x326391=0xc8;}else{_0x326391=0xce;}_0x2e001e[_0xf3a9('0x2a')](_0x326391);return _0x2e001e[_0xf3a9('0x2e')](_0xf3a9('0x2f'),_0x49aeaa+'-'+_0x5ba66c+'/'+_0x1e367c)[_0xf3a9('0x2b')](_0x42b842);}return null;};}function patchUpdates(_0x230782){return function(_0x32d0cc){try{jsonpatch['apply'](_0x32d0cc,_0x230782,!![]);}catch(_0x22e6cb){return BPromise[_0xf3a9('0x30')](_0x22e6cb);}return _0x32d0cc[_0xf3a9('0x31')]();};}function saveUpdates(_0x1d8cb4,_0x260676){return function(_0x41a9f0){if(_0x41a9f0){return _0x41a9f0[_0xf3a9('0x32')](_0x1d8cb4)['then'](function(_0x5dc481){return _0x5dc481;});}return null;};}function removeEntity(_0x4d9bfd,_0x455cf7){return function(_0xe7551c){if(_0xe7551c){return _0xe7551c['destroy']()[_0xf3a9('0x20')](function(){_0x4d9bfd[_0xf3a9('0x2a')](0xcc)[_0xf3a9('0x33')]();});}};}function handleEntityNotFound(_0x2601ba,_0x31b94c){return function(_0x51be7d){if(!_0x51be7d){_0x2601ba[_0xf3a9('0x34')](0x194);}return _0x51be7d;};}function handleError(_0x3a08bf,_0x3746e1){_0x3746e1=_0x3746e1||0x1f4;return function(_0x5c7ab5){logger[_0xf3a9('0x25')](_0x5c7ab5[_0xf3a9('0x35')]);if(_0x5c7ab5[_0xf3a9('0x36')]){delete _0x5c7ab5['name'];}_0x3a08bf['status'](_0x3746e1)['send'](_0x5c7ab5);};}exports[_0xf3a9('0x37')]=function(_0x524612,_0xa6c183){var _0x35e79d={},_0x3345d1={},_0x129279={'count':0x0,'rows':[]};var _0x354ad9=_[_0xf3a9('0x38')](db[_0xf3a9('0x39')][_0xf3a9('0x3a')],function(_0x576fb9){return{'name':_0x576fb9[_0xf3a9('0x3b')],'type':_0x576fb9['type'][_0xf3a9('0x3c')]};});_0x3345d1[_0xf3a9('0x3d')]=_[_0xf3a9('0x38')](_0x354ad9,_0xf3a9('0x36'));_0x3345d1['query']=_[_0xf3a9('0x3e')](_0x524612['query']);_0x3345d1[_0xf3a9('0x3f')]=_[_0xf3a9('0x40')](_0x3345d1[_0xf3a9('0x3d')],_0x3345d1['query']);_0x35e79d[_0xf3a9('0x41')]=_['intersection'](_0x3345d1[_0xf3a9('0x3d')],qs[_0xf3a9('0x42')](_0x524612[_0xf3a9('0x43')][_0xf3a9('0x42')]));_0x35e79d[_0xf3a9('0x41')]=_0x35e79d['attributes'][_0xf3a9('0x44')]?_0x35e79d['attributes']:_0x3345d1[_0xf3a9('0x3d')];if(!_0x524612[_0xf3a9('0x43')][_0xf3a9('0x45')](_0xf3a9('0x46'))){_0x35e79d[_0xf3a9('0x2d')]=qs[_0xf3a9('0x2d')](_0x524612['query']['limit']);_0x35e79d[_0xf3a9('0x2c')]=qs['offset'](_0x524612['query']['offset']);}_0x35e79d['order']=qs['sort'](_0x524612[_0xf3a9('0x43')][_0xf3a9('0x47')]);_0x35e79d['where']=qs[_0xf3a9('0x3f')](_['pick'](_0x524612[_0xf3a9('0x43')],_0x3345d1[_0xf3a9('0x3f')]));if(_0x524612[_0xf3a9('0x43')]['filter']){_0x35e79d[_0xf3a9('0x48')]=_[_0xf3a9('0x49')](_0x35e79d[_0xf3a9('0x48')],{'$or':_[_0xf3a9('0x38')](_0x354ad9,function(_0x566a61){if(_0x566a61['type']!==_0xf3a9('0x4a')){var _0x44e8d1={};_0x44e8d1[_0x566a61[_0xf3a9('0x36')]]={'$like':'%'+_0x524612['query'][_0xf3a9('0x4b')]+'%'};return _0x44e8d1;}})});}_0x35e79d=_['merge']({},_0x35e79d,_0x524612[_0xf3a9('0x4c')]);var _0x2b5a03={'where':_0x35e79d[_0xf3a9('0x48')]};return db[_0xf3a9('0x39')]['count'](_0x2b5a03)[_0xf3a9('0x20')](function(_0x33f30c){_0x129279['count']=_0x33f30c;if(_0x524612[_0xf3a9('0x43')]['includeAll']){_0x35e79d[_0xf3a9('0x4d')]=[{'all':!![]}];}return db[_0xf3a9('0x39')][_0xf3a9('0x4e')](_0x35e79d);})['then'](function(_0x487abc){_0x129279[_0xf3a9('0x4f')]=_0x487abc;return _0x129279;})[_0xf3a9('0x20')](respondWithFilteredResult(_0xa6c183,_0x35e79d))[_0xf3a9('0x50')](handleError(_0xa6c183,null));};exports[_0xf3a9('0x51')]=function(_0x43e749,_0x48afb0){var _0x19d473={'raw':![],'where':{'id':_0x43e749[_0xf3a9('0x52')]['id']}},_0x349e20={};_0x349e20['model']=_[_0xf3a9('0x3e')](db[_0xf3a9('0x39')][_0xf3a9('0x3a')]);_0x349e20[_0xf3a9('0x43')]=_[_0xf3a9('0x3e')](_0x43e749[_0xf3a9('0x43')]);_0x349e20[_0xf3a9('0x3f')]=_[_0xf3a9('0x40')](_0x349e20['model'],_0x349e20[_0xf3a9('0x43')]);_0x19d473[_0xf3a9('0x41')]=_['intersection'](_0x349e20[_0xf3a9('0x3d')],qs[_0xf3a9('0x42')](_0x43e749[_0xf3a9('0x43')][_0xf3a9('0x42')]));_0x19d473['attributes']=_0x19d473[_0xf3a9('0x41')][_0xf3a9('0x44')]?_0x19d473[_0xf3a9('0x41')]:_0x349e20[_0xf3a9('0x3d')];if(_0x43e749[_0xf3a9('0x43')][_0xf3a9('0x53')]){_0x19d473[_0xf3a9('0x4d')]=[{'all':!![]}];}_0x19d473=_[_0xf3a9('0x49')]({},_0x19d473,_0x43e749['options']);return db[_0xf3a9('0x39')]['find'](_0x19d473)[_0xf3a9('0x20')](handleEntityNotFound(_0x48afb0,null))[_0xf3a9('0x20')](respondWithResult(_0x48afb0,null))['catch'](handleError(_0x48afb0,null));};exports[_0xf3a9('0x54')]=function(_0x4754a3,_0x1951dc){return db[_0xf3a9('0x39')][_0xf3a9('0x54')](_0x4754a3[_0xf3a9('0x55')],{})[_0xf3a9('0x20')](respondWithResult(_0x1951dc,0xc9))[_0xf3a9('0x50')](handleError(_0x1951dc,null));};exports[_0xf3a9('0x32')]=function(_0x39bb02,_0x1b145d){if(_0x39bb02[_0xf3a9('0x55')]['id']){delete _0x39bb02['body']['id'];}return db[_0xf3a9('0x39')][_0xf3a9('0x56')]({'where':{'id':_0x39bb02[_0xf3a9('0x52')]['id']}})[_0xf3a9('0x20')](handleEntityNotFound(_0x1b145d,null))['then'](saveUpdates(_0x39bb02[_0xf3a9('0x55')],null))[_0xf3a9('0x20')](respondWithResult(_0x1b145d,null))[_0xf3a9('0x50')](handleError(_0x1b145d,null));};exports[_0xf3a9('0x57')]=function(_0x3e1a0e,_0x43acfb){return db[_0xf3a9('0x39')][_0xf3a9('0x56')]({'where':{'id':_0x3e1a0e[_0xf3a9('0x52')]['id']}})['then'](handleEntityNotFound(_0x43acfb,null))['then'](removeEntity(_0x43acfb,null))['catch'](handleError(_0x43acfb,null));};exports['getConfigurations']=function(_0x1caba6,_0x499c5d,_0x31c89d){var _0x101718={};var _0x572da4={};var _0x22d0a4;var _0x234b5d;return db[_0xf3a9('0x39')][_0xf3a9('0x58')]({'where':{'id':_0x1caba6[_0xf3a9('0x52')]['id']}})[_0xf3a9('0x20')](handleEntityNotFound(_0x499c5d,null))['then'](function(_0x290950){if(_0x290950){_0x22d0a4=_0x290950;_0x572da4[_0xf3a9('0x3d')]=_[_0xf3a9('0x3e')](db[_0xf3a9('0x59')][_0xf3a9('0x3a')]);_0x572da4[_0xf3a9('0x43')]=_[_0xf3a9('0x3e')](_0x1caba6['query']);_0x572da4[_0xf3a9('0x3f')]=_['intersection'](_0x572da4['model'],_0x572da4[_0xf3a9('0x43')]);_0x101718[_0xf3a9('0x41')]=_[_0xf3a9('0x40')](_0x572da4[_0xf3a9('0x3d')],qs['fields'](_0x1caba6[_0xf3a9('0x43')][_0xf3a9('0x42')]));_0x101718[_0xf3a9('0x41')]=_0x101718[_0xf3a9('0x41')]['length']?_0x101718['attributes']:_0x572da4[_0xf3a9('0x3d')];_0x101718[_0xf3a9('0x5a')]=qs['sort'](_0x1caba6['query']['sort']);_0x101718['where']=qs[_0xf3a9('0x3f')](_['pick'](_0x1caba6['query'],_0x572da4[_0xf3a9('0x3f')]));if(_0x1caba6[_0xf3a9('0x43')][_0xf3a9('0x4b')]){_0x101718[_0xf3a9('0x48')]=_[_0xf3a9('0x49')](_0x101718[_0xf3a9('0x48')],{'$or':_['map'](_0x101718[_0xf3a9('0x41')],function(_0x4b965e){var _0x1ce796={};_0x1ce796[_0x4b965e]={'$like':'%'+_0x1caba6[_0xf3a9('0x43')]['filter']+'%'};return _0x1ce796;})});}_0x101718=_[_0xf3a9('0x49')]({},_0x101718,_0x1caba6[_0xf3a9('0x4c')]);return _0x22d0a4[_0xf3a9('0x5b')](_0x101718);}})[_0xf3a9('0x20')](function(_0x59e0de){if(_0x59e0de){_0x234b5d=_0x59e0de[_0xf3a9('0x44')];if(!_0x1caba6['query'][_0xf3a9('0x45')](_0xf3a9('0x46'))){_0x101718[_0xf3a9('0x2d')]=qs[_0xf3a9('0x2d')](_0x1caba6['query'][_0xf3a9('0x2d')]);_0x101718['offset']=qs[_0xf3a9('0x2c')](_0x1caba6[_0xf3a9('0x43')]['offset']);}return _0x22d0a4[_0xf3a9('0x5b')](_0x101718);}})[_0xf3a9('0x20')](function(_0x259209){if(_0x259209){return _0x259209?{'count':_0x234b5d,'rows':_0x259209}:null;}})[_0xf3a9('0x20')](respondWithResult(_0x499c5d,null))[_0xf3a9('0x50')](handleError(_0x499c5d,null));};exports['addConfiguration']=function(_0x1ecfa6,_0x3aea59,_0x46e8aa){if(_0x1ecfa6['body']['id']){delete _0x1ecfa6[_0xf3a9('0x55')]['id'];}return db[_0xf3a9('0x39')][_0xf3a9('0x58')]({'where':{'id':_0x1ecfa6[_0xf3a9('0x52')]['id']}})[_0xf3a9('0x20')](handleEntityNotFound(_0x3aea59,null))[_0xf3a9('0x20')](function(_0x2753be){if(_0x2753be){_0x1ecfa6[_0xf3a9('0x55')][_0xf3a9('0x5c')]=_0x2753be['id'];_0x1ecfa6[_0xf3a9('0x55')]['Subjects']=integrations[_0xf3a9('0x5d')](_0x1ecfa6[_0xf3a9('0x55')][_0xf3a9('0x5e')],_0x1ecfa6['body']['type']);_0x1ecfa6[_0xf3a9('0x55')]['Descriptions']=integrations[_0xf3a9('0x5f')](_0x1ecfa6[_0xf3a9('0x55')]['channel'],_0x1ecfa6[_0xf3a9('0x55')][_0xf3a9('0x60')]);return db[_0xf3a9('0x59')][_0xf3a9('0x54')](_0x1ecfa6[_0xf3a9('0x55')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db['DeskField'],'as':_0xf3a9('0x61')}]});}return null;})[_0xf3a9('0x20')](respondWithResult(_0x3aea59,null))[_0xf3a9('0x50')](handleError(_0x3aea59,null));};exports['getFields']=function(_0x484139,_0x2b3483,_0x53f26f){var _0x359957=[{'name':'priority','label':'priority','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 _0x28fa31='';return db[_0xf3a9('0x39')][_0xf3a9('0x58')]({'where':{'id':_0x484139[_0xf3a9('0x52')]['id']},'attributes':['id',_0xf3a9('0x62'),_0xf3a9('0x63'),_0xf3a9('0x64'),_0xf3a9('0x65'),_0xf3a9('0x66'),_0xf3a9('0x67'),'token','tokenSecret']})[_0xf3a9('0x20')](handleEntityNotFound(_0x2b3483,null))[_0xf3a9('0x20')](function(_0x23d5b9){if(_0x23d5b9){_0x28fa31=_0x23d5b9['remoteUri'];var _0x3a8528=_0x28fa31['slice'](-0x1);if(_0x3a8528==='/'){_0x28fa31=_0x28fa31[_0xf3a9('0x68')](0x0,_0x28fa31[_0xf3a9('0x69')](_0x3a8528));}var _0x283fbf={'method':_0xf3a9('0x6a'),'uri':util[_0xf3a9('0x6b')](_0xf3a9('0x6c'),_0x28fa31),'headers':{'Content-Type':_0xf3a9('0x6d'),'Accept':_0xf3a9('0x6d')},'json':!![]};if(_0x23d5b9[_0xf3a9('0x63')]===_0xf3a9('0x6e')){_0x283fbf[_0xf3a9('0x6f')][_0xf3a9('0x70')]=util[_0xf3a9('0x6b')](_0xf3a9('0x71'),new Buffer(util[_0xf3a9('0x6b')]('%s:%s',_0x23d5b9[_0xf3a9('0x64')],_0x23d5b9[_0xf3a9('0x65')]))[_0xf3a9('0x72')]('base64'));}return rp(_0x283fbf)['then'](function(_0x433ced){return _0x359957['concat'](_[_0xf3a9('0x38')](_0x433ced['_embedded'][_0xf3a9('0x73')],function(_0x25f37){return{'id':_0x25f37['name'],'name':_0x25f37[_0xf3a9('0x36')],'type':_0x25f37['type'],'active':_0x25f37[_0xf3a9('0x74')],'label':_0x25f37[_0xf3a9('0x75')],'custom':!![]};}));});}})[_0xf3a9('0x20')](function(_0x31d227){return{'count':_0x31d227[_0xf3a9('0x44')],'rows':_0x31d227};})[_0xf3a9('0x20')](respondWithResult(_0x2b3483,null))[_0xf3a9('0x50')](function(_0x377931){var _0x508e5b=_0x484139['query'][_0xf3a9('0x1b')]?0x1f4:_0x377931[_0xf3a9('0x76')]||0x1f4;logger[_0xf3a9('0x25')](_0xf3a9('0x77'),_0xf3a9('0x78'),_0x508e5b,JSON[_0xf3a9('0x79')](_0x377931));delete _0x377931[_0xf3a9('0x36')];if(_0x508e5b===0x191){_0x508e5b=0x190;}_0x2b3483['status'](_0x508e5b)[_0xf3a9('0x7a')](_0x484139[_0xf3a9('0x43')]['test']?{'message':_0xf3a9('0x7b'),'statusCode':_0x377931[_0xf3a9('0x76')]}:_0x377931);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 2c9ae47..982963a 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 _0x9cad=['int_desk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9cad,0xaa));var _0xd9ca=function(_0x196dc5,_0x50be9d){_0x196dc5=_0x196dc5-0x0;var _0x56458e=_0x9cad[_0x196dc5];return _0x56458e;};'use strict';var _=require(_0xd9ca('0x0'));var util=require(_0xd9ca('0x1'));var logger=require('../../config/logger')(_0xd9ca('0x2'));var moment=require(_0xd9ca('0x3'));var BPromise=require(_0xd9ca('0x4'));var rp=require(_0xd9ca('0x5'));var fs=require('fs');var path=require(_0xd9ca('0x6'));var rimraf=require(_0xd9ca('0x7'));var config=require(_0xd9ca('0x8'));var attributes=require(_0xd9ca('0x9'));var integrations=require(_0xd9ca('0xa'));module['exports']=function(_0x48dc0c,_0x38caa9){return _0x48dc0c[_0xd9ca('0xb')]('DeskAccount',attributes,{'tableName':_0xd9ca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe38a=['DeskAccount','../../config/logger','bluebird','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x19ff50,_0x4ec334){var _0x33b996=function(_0x203a79){while(--_0x203a79){_0x19ff50['push'](_0x19ff50['shift']());}};_0x33b996(++_0x4ec334);}(_0xe38a,0x6d));var _0xae38=function(_0x11dcf0,_0x4eb137){_0x11dcf0=_0x11dcf0-0x0;var _0x4f9831=_0xe38a[_0x11dcf0];return _0x4f9831;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xae38('0x0'))('api');var moment=require('moment');var BPromise=require(_0xae38('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae38('0x2'));var rimraf=require('rimraf');var config=require(_0xae38('0x3'));var attributes=require(_0xae38('0x4'));var integrations=require(_0xae38('0x5'));module[_0xae38('0x6')]=function(_0x21cc56,_0x5cffbc){return _0x21cc56[_0xae38('0x7')](_0xae38('0x8'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index b992410..ce6aa2f 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 _0x3617=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','findAll','options','where','attributes','limit','include','model','map','GetDeskAccount','ShowDeskAccount','DeskAccount'];(function(_0x2e3520,_0x39da26){var _0x4537a8=function(_0x419a21){while(--_0x419a21){_0x2e3520['push'](_0x2e3520['shift']());}};_0x4537a8(++_0x39da26);}(_0x3617,0xba));var _0x7361=function(_0x36ab58,_0x2768c0){_0x36ab58=_0x36ab58-0x0;var _0x230fc3=_0x3617[_0x36ab58];return _0x230fc3;};'use strict';var _=require(_0x7361('0x0'));var util=require(_0x7361('0x1'));var moment=require(_0x7361('0x2'));var BPromise=require(_0x7361('0x3'));var rs=require(_0x7361('0x4'));var fs=require('fs');var Redis=require(_0x7361('0x5'));var db=require(_0x7361('0x6'))['db'];var utils=require(_0x7361('0x7'));var logger=require(_0x7361('0x8'))(_0x7361('0x9'));var config=require('../../config/environment');var jayson=require(_0x7361('0xa'));var client=jayson[_0x7361('0xb')][_0x7361('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dc19e,_0x14b3c9,_0x4088f9){return new BPromise(function(_0x54e15a,_0x4e875a){return client[_0x7361('0xd')](_0x2dc19e,_0x4088f9)[_0x7361('0xe')](function(_0x1d4cb4){logger[_0x7361('0xf')](_0x7361('0x10'),_0x14b3c9,'request\x20sent');logger[_0x7361('0x11')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x14b3c9,_0x7361('0x12'),JSON[_0x7361('0x13')](_0x1d4cb4));if(_0x1d4cb4[_0x7361('0x14')]){if(_0x1d4cb4['error'][_0x7361('0x15')]===0x1f4){logger[_0x7361('0x14')](_0x7361('0x10'),_0x14b3c9,_0x1d4cb4[_0x7361('0x14')][_0x7361('0x16')]);return _0x4e875a(_0x1d4cb4[_0x7361('0x14')]['message']);}logger[_0x7361('0x14')]('DeskAccount,\x20%s,\x20%s',_0x14b3c9,_0x1d4cb4[_0x7361('0x14')]['message']);return _0x54e15a(_0x1d4cb4[_0x7361('0x14')][_0x7361('0x16')]);}else{logger[_0x7361('0xf')](_0x7361('0x10'),_0x14b3c9,'request\x20sent');_0x54e15a(_0x1d4cb4[_0x7361('0x17')][_0x7361('0x16')]);}})[_0x7361('0x18')](function(_0x3286b2){logger[_0x7361('0x14')](_0x7361('0x10'),_0x14b3c9,_0x3286b2);_0x4e875a(_0x3286b2);});});}exports['GetDeskAccount']=function(_0xe7629c){var _0x2ec8c4=this;return new Promise(function(_0x1ae925,_0xb29d0){return db['DeskAccount'][_0x7361('0x19')]({'raw':_0xe7629c[_0x7361('0x1a')]?_0xe7629c[_0x7361('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xe7629c[_0x7361('0x1a')]?_0xe7629c[_0x7361('0x1a')][_0x7361('0x1b')]||null:null,'attributes':_0xe7629c[_0x7361('0x1a')]?_0xe7629c['options'][_0x7361('0x1c')]||null:null,'limit':_0xe7629c['options']?_0xe7629c[_0x7361('0x1a')][_0x7361('0x1d')]||null:null,'include':_0xe7629c[_0x7361('0x1a')]?_0xe7629c[_0x7361('0x1a')]['include']?_['map'](_0xe7629c['options'][_0x7361('0x1e')],function(_0x33dd4a){return{'model':db[_0x33dd4a[_0x7361('0x1f')]],'as':_0x33dd4a['as'],'attributes':_0x33dd4a[_0x7361('0x1c')],'include':_0x33dd4a[_0x7361('0x1e')]?_[_0x7361('0x20')](_0x33dd4a[_0x7361('0x1e')],function(_0x340ecb){return{'model':db[_0x340ecb[_0x7361('0x1f')]],'as':_0x340ecb['as'],'attributes':_0x340ecb[_0x7361('0x1c')],'include':_0x340ecb[_0x7361('0x1e')]?_[_0x7361('0x20')](_0x340ecb[_0x7361('0x1e')],function(_0xb8bf12){return{'model':db[_0xb8bf12['model']],'as':_0xb8bf12['as'],'attributes':_0xb8bf12[_0x7361('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7361('0xe')](function(_0x386ba4){logger[_0x7361('0xf')](_0x7361('0x21'),_0xe7629c);logger['debug'](_0x7361('0x21'),_0xe7629c,JSON[_0x7361('0x13')](_0x386ba4));_0x1ae925(_0x386ba4);})[_0x7361('0x18')](function(_0x178f1d){logger[_0x7361('0x14')](_0x7361('0x21'),_0x178f1d[_0x7361('0x16')],_0xe7629c);_0xb29d0(_0x2ec8c4[_0x7361('0x14')](0x1f4,_0x178f1d[_0x7361('0x16')]));});});};exports[_0x7361('0x22')]=function(_0x2d753f){var _0x1dc391=this;return new Promise(function(_0x59bbbd,_0x1290ee){return db[_0x7361('0x23')][_0x7361('0x24')]({'raw':_0x2d753f['options']?_0x2d753f[_0x7361('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2d753f[_0x7361('0x1a')]?_0x2d753f['options'][_0x7361('0x1b')]||null:null,'attributes':_0x2d753f[_0x7361('0x1a')]?_0x2d753f[_0x7361('0x1a')][_0x7361('0x1c')]||null:null,'include':_0x2d753f['options']?_0x2d753f[_0x7361('0x1a')][_0x7361('0x1e')]?_[_0x7361('0x20')](_0x2d753f[_0x7361('0x1a')]['include'],function(_0xbc4cf){return{'model':db[_0xbc4cf['model']],'as':_0xbc4cf['as'],'attributes':_0xbc4cf[_0x7361('0x1c')],'include':_0xbc4cf[_0x7361('0x1e')]?_[_0x7361('0x20')](_0xbc4cf[_0x7361('0x1e')],function(_0x4e2379){return{'model':db[_0x4e2379['model']],'as':_0x4e2379['as'],'attributes':_0x4e2379[_0x7361('0x1c')],'include':_0x4e2379[_0x7361('0x1e')]?_[_0x7361('0x20')](_0x4e2379[_0x7361('0x1e')],function(_0x45ba41){return{'model':db[_0x45ba41['model']],'as':_0x45ba41['as'],'attributes':_0x45ba41[_0x7361('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7361('0xe')](function(_0x374b0a){logger[_0x7361('0xf')](_0x7361('0x22'),_0x2d753f);logger[_0x7361('0x11')](_0x7361('0x22'),_0x2d753f,JSON['stringify'](_0x374b0a));_0x59bbbd(_0x374b0a);})[_0x7361('0x18')](function(_0x386fa9){logger['error']('ShowDeskAccount',_0x386fa9[_0x7361('0x16')],_0x2d753f);_0x1290ee(_0x1dc391[_0x7361('0x14')](0x1f4,_0x386fa9[_0x7361('0x16')]));});});}; \ No newline at end of file +var _0xa05b=['ShowDeskAccount','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetDeskAccount','DeskAccount','options','where','attributes','limit','include','model','map','stringify'];(function(_0x3ffacb,_0x5b43b7){var _0x34b2fb=function(_0x4717f4){while(--_0x4717f4){_0x3ffacb['push'](_0x3ffacb['shift']());}};_0x34b2fb(++_0x5b43b7);}(_0xa05b,0x86));var _0xba05=function(_0x336264,_0x32e1d9){_0x336264=_0x336264-0x0;var _0x53cf91=_0xa05b[_0x336264];return _0x53cf91;};'use strict';var _=require(_0xba05('0x0'));var util=require(_0xba05('0x1'));var moment=require(_0xba05('0x2'));var BPromise=require('bluebird');var rs=require(_0xba05('0x3'));var fs=require('fs');var Redis=require(_0xba05('0x4'));var db=require(_0xba05('0x5'))['db'];var utils=require(_0xba05('0x6'));var logger=require(_0xba05('0x7'))(_0xba05('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e1cbd,_0x18f55e,_0x4a5541){return new BPromise(function(_0x19a734,_0x19e0b2){return client[_0xba05('0x9')](_0x1e1cbd,_0x4a5541)[_0xba05('0xa')](function(_0x59d454){logger['info'](_0xba05('0xb'),_0x18f55e,_0xba05('0xc'));logger[_0xba05('0xd')](_0xba05('0xe'),_0x18f55e,_0xba05('0xc'),JSON['stringify'](_0x59d454));if(_0x59d454[_0xba05('0xf')]){if(_0x59d454[_0xba05('0xf')][_0xba05('0x10')]===0x1f4){logger[_0xba05('0xf')](_0xba05('0xb'),_0x18f55e,_0x59d454[_0xba05('0xf')][_0xba05('0x11')]);return _0x19e0b2(_0x59d454[_0xba05('0xf')][_0xba05('0x11')]);}logger[_0xba05('0xf')]('DeskAccount,\x20%s,\x20%s',_0x18f55e,_0x59d454[_0xba05('0xf')]['message']);return _0x19a734(_0x59d454['error'][_0xba05('0x11')]);}else{logger[_0xba05('0x12')]('DeskAccount,\x20%s,\x20%s',_0x18f55e,_0xba05('0xc'));_0x19a734(_0x59d454[_0xba05('0x13')][_0xba05('0x11')]);}})[_0xba05('0x14')](function(_0x219325){logger[_0xba05('0xf')](_0xba05('0xb'),_0x18f55e,_0x219325);_0x19e0b2(_0x219325);});});}exports[_0xba05('0x15')]=function(_0x5c61e2){var _0x1e6577=this;return new Promise(function(_0x11290d,_0x2e9c0a){return db[_0xba05('0x16')]['findAll']({'raw':_0x5c61e2['options']?_0x5c61e2[_0xba05('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5c61e2['options']?_0x5c61e2[_0xba05('0x17')][_0xba05('0x18')]||null:null,'attributes':_0x5c61e2[_0xba05('0x17')]?_0x5c61e2['options'][_0xba05('0x19')]||null:null,'limit':_0x5c61e2[_0xba05('0x17')]?_0x5c61e2[_0xba05('0x17')][_0xba05('0x1a')]||null:null,'include':_0x5c61e2[_0xba05('0x17')]?_0x5c61e2[_0xba05('0x17')][_0xba05('0x1b')]?_['map'](_0x5c61e2[_0xba05('0x17')][_0xba05('0x1b')],function(_0x3b605e){return{'model':db[_0x3b605e[_0xba05('0x1c')]],'as':_0x3b605e['as'],'attributes':_0x3b605e['attributes'],'include':_0x3b605e[_0xba05('0x1b')]?_['map'](_0x3b605e[_0xba05('0x1b')],function(_0x391307){return{'model':db[_0x391307['model']],'as':_0x391307['as'],'attributes':_0x391307['attributes'],'include':_0x391307['include']?_[_0xba05('0x1d')](_0x391307[_0xba05('0x1b')],function(_0x150958){return{'model':db[_0x150958[_0xba05('0x1c')]],'as':_0x150958['as'],'attributes':_0x150958[_0xba05('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c6ad7){logger[_0xba05('0x12')](_0xba05('0x15'),_0x5c61e2);logger[_0xba05('0xd')](_0xba05('0x15'),_0x5c61e2,JSON[_0xba05('0x1e')](_0x4c6ad7));_0x11290d(_0x4c6ad7);})['catch'](function(_0x325207){logger[_0xba05('0xf')](_0xba05('0x15'),_0x325207[_0xba05('0x11')],_0x5c61e2);_0x2e9c0a(_0x1e6577[_0xba05('0xf')](0x1f4,_0x325207['message']));});});};exports[_0xba05('0x1f')]=function(_0x59c93e){var _0x2d0115=this;return new Promise(function(_0x11c5f3,_0x3b0740){return db['DeskAccount']['find']({'raw':_0x59c93e[_0xba05('0x17')]?_0x59c93e[_0xba05('0x17')][_0xba05('0x20')]===undefined?!![]:![]:!![],'where':_0x59c93e[_0xba05('0x17')]?_0x59c93e[_0xba05('0x17')][_0xba05('0x18')]||null:null,'attributes':_0x59c93e[_0xba05('0x17')]?_0x59c93e['options'][_0xba05('0x19')]||null:null,'include':_0x59c93e[_0xba05('0x17')]?_0x59c93e['options'][_0xba05('0x1b')]?_[_0xba05('0x1d')](_0x59c93e[_0xba05('0x17')][_0xba05('0x1b')],function(_0x2896ec){return{'model':db[_0x2896ec[_0xba05('0x1c')]],'as':_0x2896ec['as'],'attributes':_0x2896ec[_0xba05('0x19')],'include':_0x2896ec[_0xba05('0x1b')]?_[_0xba05('0x1d')](_0x2896ec['include'],function(_0x465e99){return{'model':db[_0x465e99[_0xba05('0x1c')]],'as':_0x465e99['as'],'attributes':_0x465e99[_0xba05('0x19')],'include':_0x465e99[_0xba05('0x1b')]?_[_0xba05('0x1d')](_0x465e99['include'],function(_0x5ae5bd){return{'model':db[_0x5ae5bd[_0xba05('0x1c')]],'as':_0x5ae5bd['as'],'attributes':_0x5ae5bd[_0xba05('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fbcde){logger['info'](_0xba05('0x1f'),_0x59c93e);logger['debug'](_0xba05('0x1f'),_0x59c93e,JSON[_0xba05('0x1e')](_0x4fbcde));_0x11c5f3(_0x4fbcde);})[_0xba05('0x14')](function(_0x5dbf74){logger['error'](_0xba05('0x1f'),_0x5dbf74[_0xba05('0x11')],_0x59c93e);_0x3b0740(_0x2d0115['error'](0x1f4,_0x5dbf74['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 714b68f..7962408 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 _0xa413=['getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','multer','path','express','Router','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa413,0x1e5));var _0x3a41=function(_0x144dfc,_0x1e19b3){_0x144dfc=_0x144dfc-0x0;var _0x48774f=_0xa413[_0x144dfc];return _0x48774f;};'use strict';var multer=require(_0x3a41('0x0'));var util=require('util');var path=require(_0x3a41('0x1'));var timeout=require('connect-timeout');var express=require(_0x3a41('0x2'));var router=express[_0x3a41('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3a41('0x4'));var controller=require(_0x3a41('0x5'));router[_0x3a41('0x6')]('/',auth[_0x3a41('0x7')](),controller[_0x3a41('0x8')]);router[_0x3a41('0x6')](_0x3a41('0x9'),auth[_0x3a41('0x7')](),controller[_0x3a41('0xa')]);router[_0x3a41('0x6')](_0x3a41('0xb'),auth['isAuthenticated'](),controller[_0x3a41('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x3a41('0xd')]);router['get'](_0x3a41('0xe'),auth['isAuthenticated'](),controller[_0x3a41('0xf')]);router[_0x3a41('0x6')]('/:id/tags',auth[_0x3a41('0x7')](),controller[_0x3a41('0x10')]);router[_0x3a41('0x11')]('/',auth[_0x3a41('0x7')](),controller[_0x3a41('0x12')]);router['post'](_0x3a41('0x13'),auth[_0x3a41('0x7')](),controller[_0x3a41('0x14')]);router[_0x3a41('0x15')](_0x3a41('0x9'),auth[_0x3a41('0x7')](),controller[_0x3a41('0x16')]);router[_0x3a41('0x17')](_0x3a41('0x9'),auth[_0x3a41('0x7')](),controller[_0x3a41('0x18')]);module['exports']=router; \ No newline at end of file +var _0x1d63=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','delete'];(function(_0x468c57,_0x2607bf){var _0x5ce052=function(_0x17c922){while(--_0x17c922){_0x468c57['push'](_0x468c57['shift']());}};_0x5ce052(++_0x2607bf);}(_0x1d63,0xa4));var _0x31d6=function(_0x351437,_0x5868f3){_0x351437=_0x351437-0x0;var _0x542e91=_0x1d63[_0x351437];return _0x542e91;};'use strict';var multer=require(_0x31d6('0x0'));var util=require(_0x31d6('0x1'));var path=require(_0x31d6('0x2'));var timeout=require(_0x31d6('0x3'));var express=require(_0x31d6('0x4'));var router=express['Router']();var auth=require(_0x31d6('0x5'));var interaction=require(_0x31d6('0x6'));var config=require(_0x31d6('0x7'));var controller=require(_0x31d6('0x8'));router[_0x31d6('0x9')]('/',auth[_0x31d6('0xa')](),controller[_0x31d6('0xb')]);router['get'](_0x31d6('0xc'),auth[_0x31d6('0xa')](),controller['show']);router[_0x31d6('0x9')](_0x31d6('0xd'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x31d6('0xe'),auth[_0x31d6('0xa')](),controller[_0x31d6('0xf')]);router['get'](_0x31d6('0x10'),auth[_0x31d6('0xa')](),controller[_0x31d6('0x11')]);router[_0x31d6('0x9')](_0x31d6('0x12'),auth['isAuthenticated'](),controller[_0x31d6('0x13')]);router[_0x31d6('0x14')]('/',auth[_0x31d6('0xa')](),controller[_0x31d6('0x15')]);router[_0x31d6('0x14')](_0x31d6('0x12'),auth['isAuthenticated'](),controller[_0x31d6('0x16')]);router[_0x31d6('0x17')](_0x31d6('0xc'),auth[_0x31d6('0xa')](),controller['update']);router[_0x31d6('0x18')]('/:id',auth[_0x31d6('0xa')](),controller[_0x31d6('0x19')]);module[_0x31d6('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 dc5b098..6e6ef92 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 _0x637d=['sequelize','exports','STRING'];(function(_0x592fcd,_0x2a9b70){var _0x1e7542=function(_0x2784ee){while(--_0x2784ee){_0x592fcd['push'](_0x592fcd['shift']());}};_0x1e7542(++_0x2a9b70);}(_0x637d,0x13e));var _0xd637=function(_0x105763,_0xb6a729){_0x105763=_0x105763-0x0;var _0x2f0c30=_0x637d[_0x105763];return _0x2f0c30;};'use strict';var Sequelize=require(_0xd637('0x0'));module[_0xd637('0x1')]={'name':{'type':Sequelize[_0xd637('0x2')]},'description':{'type':Sequelize[_0xd637('0x2')]}}; \ No newline at end of file +var _0x69db=['exports','STRING'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x69db,0xc2));var _0xb69d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x69db[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0xb69d('0x0')]={'name':{'type':Sequelize[_0xb69d('0x1')]},'description':{'type':Sequelize[_0xb69d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 676a2ba..2ecbf91 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 _0xe4aa=['DeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','apply','reject','save','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','model','map','query','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','keys','intersection','find','create','body','update','getFields'];(function(_0x16f271,_0x290aed){var _0x3a9a92=function(_0x4c79b8){while(--_0x4c79b8){_0x16f271['push'](_0x16f271['shift']());}};_0x3a9a92(++_0x290aed);}(_0xe4aa,0x183));var _0xae4a=function(_0x316176,_0x104416){_0x316176=_0x316176-0x0;var _0xfd65bb=_0xe4aa[_0x316176];return _0xfd65bb;};'use strict';var pdf=require(_0xae4a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xae4a('0x1'));var jsonpatch=require(_0xae4a('0x2'));var rp=require(_0xae4a('0x3'));var moment=require(_0xae4a('0x4'));var BPromise=require(_0xae4a('0x5'));var Mustache=require(_0xae4a('0x6'));var util=require(_0xae4a('0x7'));var path=require(_0xae4a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xae4a('0x9'));var fs=require('fs');var _=require(_0xae4a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xae4a('0xb'));var deskjs=require(_0xae4a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xae4a('0xd'));var Papa=require('papaparse');var Redis=require(_0xae4a('0xe'));var authService=require(_0xae4a('0xf'));var qs=require(_0xae4a('0x10'));var as=require(_0xae4a('0x11'));var hardwareService=require(_0xae4a('0x12'));var logger=require(_0xae4a('0x13'))(_0xae4a('0x14'));var utils=require(_0xae4a('0x15'));var config=require(_0xae4a('0x16'));var db=require(_0xae4a('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xae4a('0x18')][_0xae4a('0x19')]({'port':0x232a});function checkPasswordPattern(_0x598737,_0xb3312d,_0x19d8d5){if(_0x19d8d5){var _0x466096=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x466096['test'](_0xb3312d)){return _0x598737;}else{throw new db[(_0xae4a('0x1a'))][(_0xae4a('0x1b'))](_0xae4a('0x1c'));}}else{return _0x598737;}}function respondWithRpcPromise(_0x423c11,_0x47d6d3,_0x28687b,_0x4dfcea){return new BPromise(function(_0x4bb136,_0x5ceaeb){var _0x1f839d=_0x4dfcea||client;return _0x1f839d[_0xae4a('0x1d')](_0x423c11,_0x28687b)[_0xae4a('0x1e')](function(_0x560553){logger[_0xae4a('0x1f')](_0xae4a('0x20'),_0x47d6d3,_0xae4a('0x21'));logger[_0xae4a('0x22')](_0xae4a('0x23'),_0x47d6d3,_0xae4a('0x21'),JSON[_0xae4a('0x24')](_0x560553));if(_0x560553[_0xae4a('0x25')]){if(_0x560553['error'][_0xae4a('0x26')]===0x1f4){logger['error'](_0xae4a('0x20'),_0x47d6d3,_0x560553['error'][_0xae4a('0x27')]);return _0x5ceaeb(_0x560553[_0xae4a('0x25')][_0xae4a('0x27')]);}logger[_0xae4a('0x25')](_0xae4a('0x20'),_0x47d6d3,_0x560553[_0xae4a('0x25')]['message']);return _0x4bb136(_0x560553[_0xae4a('0x25')]['message']);}else{logger[_0xae4a('0x1f')](_0xae4a('0x20'),_0x47d6d3,_0xae4a('0x21'));_0x4bb136(_0x560553[_0xae4a('0x28')]['message']);}})[_0xae4a('0x29')](function(_0x18bad1){logger[_0xae4a('0x25')](_0xae4a('0x20'),_0x47d6d3,_0x18bad1);_0x5ceaeb(_0x18bad1);});});}function respondWithStatusCode(_0x3cb197,_0x35c450){_0x35c450=_0x35c450||0xcc;return function(_0x3743fb){if(_0x3743fb){return _0x3cb197[_0xae4a('0x2a')](_0x35c450);}return _0x3cb197['status'](_0x35c450)[_0xae4a('0x2b')]();};}function respondWithResult(_0x3cef5b,_0x37ee0c){_0x37ee0c=_0x37ee0c||0xc8;return function(_0x1ad369){if(_0x1ad369){return _0x3cef5b[_0xae4a('0x2c')](_0x37ee0c)[_0xae4a('0x2d')](_0x1ad369);}};}function respondWithFilteredResult(_0x36b151,_0x50c42c){return function(_0x35c212){if(_0x35c212){var _0xbc1fd3=_0x35c212[_0xae4a('0x2e')],_0x563830=_0x50c42c['offset'],_0x4b2f46=_0x50c42c[_0xae4a('0x2f')]+_0x50c42c['limit'],_0x48acdf;if(_0x4b2f46>=_0xbc1fd3){_0x4b2f46=_0xbc1fd3;_0x48acdf=0xc8;}else{_0x48acdf=0xce;}_0x36b151['status'](_0x48acdf);return _0x36b151[_0xae4a('0x30')]('Content-Range',_0x563830+'-'+_0x4b2f46+'/'+_0xbc1fd3)[_0xae4a('0x2d')](_0x35c212);}return null;};}function patchUpdates(_0x4dbbf0){return function(_0x1d7559){try{jsonpatch[_0xae4a('0x31')](_0x1d7559,_0x4dbbf0,!![]);}catch(_0x261baf){return BPromise[_0xae4a('0x32')](_0x261baf);}return _0x1d7559[_0xae4a('0x33')]();};}function saveUpdates(_0x495d21,_0xe2e2a2){return function(_0x1b3c6c){if(_0x1b3c6c){return _0x1b3c6c['update'](_0x495d21)[_0xae4a('0x1e')](function(_0x49be53){return _0x49be53;});}return null;};}function removeEntity(_0x1c6583,_0x4595ab){return function(_0x35105a){if(_0x35105a){return _0x35105a['destroy']()[_0xae4a('0x1e')](function(){_0x1c6583[_0xae4a('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e9e3,_0x5103d3){return function(_0x2f21a7){if(!_0x2f21a7){_0x17e9e3[_0xae4a('0x2a')](0x194);}return _0x2f21a7;};}function handleError(_0x200888,_0x1eba31){_0x1eba31=_0x1eba31||0x1f4;return function(_0x16e934){logger[_0xae4a('0x25')](_0x16e934[_0xae4a('0x34')]);if(_0x16e934[_0xae4a('0x35')]){delete _0x16e934[_0xae4a('0x35')];}_0x200888[_0xae4a('0x2c')](_0x1eba31)[_0xae4a('0x36')](_0x16e934);};}exports[_0xae4a('0x37')]=function(_0x1de6d1,_0x3a4d68){var _0x3adec0={},_0x4436e6={},_0x1a4067={'count':0x0,'rows':[]};var _0x4cf6e2=_['map'](db[_0xae4a('0x38')][_0xae4a('0x39')],function(_0x1ffbd4){return{'name':_0x1ffbd4[_0xae4a('0x3a')],'type':_0x1ffbd4['type']['key']};});_0x4436e6[_0xae4a('0x3b')]=_[_0xae4a('0x3c')](_0x4cf6e2,_0xae4a('0x35'));_0x4436e6[_0xae4a('0x3d')]=_['keys'](_0x1de6d1[_0xae4a('0x3d')]);_0x4436e6[_0xae4a('0x3e')]=_['intersection'](_0x4436e6[_0xae4a('0x3b')],_0x4436e6[_0xae4a('0x3d')]);_0x3adec0['attributes']=_['intersection'](_0x4436e6[_0xae4a('0x3b')],qs[_0xae4a('0x3f')](_0x1de6d1['query'][_0xae4a('0x3f')]));_0x3adec0['attributes']=_0x3adec0[_0xae4a('0x40')][_0xae4a('0x41')]?_0x3adec0['attributes']:_0x4436e6[_0xae4a('0x3b')];if(!_0x1de6d1[_0xae4a('0x3d')][_0xae4a('0x42')](_0xae4a('0x43'))){_0x3adec0[_0xae4a('0x44')]=qs[_0xae4a('0x44')](_0x1de6d1[_0xae4a('0x3d')][_0xae4a('0x44')]);_0x3adec0[_0xae4a('0x2f')]=qs[_0xae4a('0x2f')](_0x1de6d1[_0xae4a('0x3d')][_0xae4a('0x2f')]);}_0x3adec0[_0xae4a('0x45')]=qs['sort'](_0x1de6d1[_0xae4a('0x3d')][_0xae4a('0x46')]);_0x3adec0[_0xae4a('0x47')]=qs[_0xae4a('0x3e')](_[_0xae4a('0x48')](_0x1de6d1['query'],_0x4436e6[_0xae4a('0x3e')]));if(_0x1de6d1[_0xae4a('0x3d')][_0xae4a('0x49')]){_0x3adec0[_0xae4a('0x47')]=_[_0xae4a('0x4a')](_0x3adec0[_0xae4a('0x47')],{'$or':_[_0xae4a('0x3c')](_0x4cf6e2,function(_0xa2e735){if(_0xa2e735['type']!==_0xae4a('0x4b')){var _0x56d3d5={};_0x56d3d5[_0xa2e735[_0xae4a('0x35')]]={'$like':'%'+_0x1de6d1[_0xae4a('0x3d')]['filter']+'%'};return _0x56d3d5;}})});}_0x3adec0=_[_0xae4a('0x4a')]({},_0x3adec0,_0x1de6d1[_0xae4a('0x4c')]);var _0x133c8e={'where':_0x3adec0['where']};return db['DeskConfiguration'][_0xae4a('0x2e')](_0x133c8e)[_0xae4a('0x1e')](function(_0x40dbd5){_0x1a4067[_0xae4a('0x2e')]=_0x40dbd5;if(_0x1de6d1[_0xae4a('0x3d')][_0xae4a('0x4d')]){_0x3adec0[_0xae4a('0x4e')]=[{'all':!![]}];}return db[_0xae4a('0x38')]['findAll'](_0x3adec0);})[_0xae4a('0x1e')](function(_0x22b49d){_0x1a4067[_0xae4a('0x4f')]=_0x22b49d;return _0x1a4067;})[_0xae4a('0x1e')](respondWithFilteredResult(_0x3a4d68,_0x3adec0))[_0xae4a('0x29')](handleError(_0x3a4d68,null));};exports['show']=function(_0x54a470,_0x5f1a24){var _0x4598bd={'raw':![],'where':{'id':_0x54a470[_0xae4a('0x50')]['id']}},_0x535b6c={};_0x535b6c[_0xae4a('0x3b')]=_[_0xae4a('0x51')](db[_0xae4a('0x38')][_0xae4a('0x39')]);_0x535b6c[_0xae4a('0x3d')]=_[_0xae4a('0x51')](_0x54a470['query']);_0x535b6c['filters']=_[_0xae4a('0x52')](_0x535b6c[_0xae4a('0x3b')],_0x535b6c['query']);_0x4598bd[_0xae4a('0x40')]=_[_0xae4a('0x52')](_0x535b6c['model'],qs['fields'](_0x54a470[_0xae4a('0x3d')]['fields']));_0x4598bd[_0xae4a('0x40')]=_0x4598bd[_0xae4a('0x40')][_0xae4a('0x41')]?_0x4598bd[_0xae4a('0x40')]:_0x535b6c[_0xae4a('0x3b')];if(_0x54a470[_0xae4a('0x3d')][_0xae4a('0x4d')]){_0x4598bd['include']=[{'all':!![]}];}_0x4598bd=_['merge']({},_0x4598bd,_0x54a470['options']);return db[_0xae4a('0x38')][_0xae4a('0x53')](_0x4598bd)['then'](handleEntityNotFound(_0x5f1a24,null))['then'](respondWithResult(_0x5f1a24,null))[_0xae4a('0x29')](handleError(_0x5f1a24,null));};exports['create']=function(_0x5c72e1,_0xca4a81){return db[_0xae4a('0x38')][_0xae4a('0x54')](_0x5c72e1[_0xae4a('0x55')],{})['then'](respondWithResult(_0xca4a81,0xc9))['catch'](handleError(_0xca4a81,null));};exports[_0xae4a('0x56')]=function(_0x24e83c,_0x5a9c53){if(_0x24e83c[_0xae4a('0x55')]['id']){delete _0x24e83c[_0xae4a('0x55')]['id'];}return db[_0xae4a('0x38')][_0xae4a('0x53')]({'where':{'id':_0x24e83c[_0xae4a('0x50')]['id']}})['then'](handleEntityNotFound(_0x5a9c53,null))[_0xae4a('0x1e')](saveUpdates(_0x24e83c[_0xae4a('0x55')],null))[_0xae4a('0x1e')](respondWithResult(_0x5a9c53,null))[_0xae4a('0x29')](handleError(_0x5a9c53,null));};exports['destroy']=function(_0x2b4154,_0x1d7a48){return db[_0xae4a('0x38')][_0xae4a('0x53')]({'where':{'id':_0x2b4154[_0xae4a('0x50')]['id']}})[_0xae4a('0x1e')](handleEntityNotFound(_0x1d7a48,null))[_0xae4a('0x1e')](removeEntity(_0x1d7a48,null))[_0xae4a('0x29')](handleError(_0x1d7a48,null));};exports[_0xae4a('0x57')]=function(_0x1b0a35,_0x4122c0,_0x52e780){var _0x37c87c={};var _0x3a8b96={};var _0x288b14;var _0x15d704;return db[_0xae4a('0x38')]['findOne']({'where':{'id':_0x1b0a35[_0xae4a('0x50')]['id']}})[_0xae4a('0x1e')](handleEntityNotFound(_0x4122c0,null))['then'](function(_0x5ee5e6){if(_0x5ee5e6){_0x288b14=_0x5ee5e6;_0x3a8b96[_0xae4a('0x3b')]=_[_0xae4a('0x51')](db[_0xae4a('0x58')][_0xae4a('0x39')]);_0x3a8b96[_0xae4a('0x3d')]=_[_0xae4a('0x51')](_0x1b0a35[_0xae4a('0x3d')]);_0x3a8b96[_0xae4a('0x3e')]=_['intersection'](_0x3a8b96[_0xae4a('0x3b')],_0x3a8b96[_0xae4a('0x3d')]);_0x37c87c[_0xae4a('0x40')]=_[_0xae4a('0x52')](_0x3a8b96['model'],qs['fields'](_0x1b0a35[_0xae4a('0x3d')][_0xae4a('0x3f')]));_0x37c87c[_0xae4a('0x40')]=_0x37c87c['attributes'][_0xae4a('0x41')]?_0x37c87c['attributes']:_0x3a8b96['model'];_0x37c87c['order']=qs[_0xae4a('0x46')](_0x1b0a35[_0xae4a('0x3d')]['sort']);_0x37c87c[_0xae4a('0x47')]=qs[_0xae4a('0x3e')](_['pick'](_0x1b0a35[_0xae4a('0x3d')],_0x3a8b96['filters']));if(_0x1b0a35[_0xae4a('0x3d')][_0xae4a('0x49')]){_0x37c87c[_0xae4a('0x47')]=_[_0xae4a('0x4a')](_0x37c87c['where'],{'$or':_[_0xae4a('0x3c')](_0x37c87c[_0xae4a('0x40')],function(_0x59f42e){var _0x1e6b49={};_0x1e6b49[_0x59f42e]={'$like':'%'+_0x1b0a35[_0xae4a('0x3d')]['filter']+'%'};return _0x1e6b49;})});}_0x37c87c=_[_0xae4a('0x4a')]({},_0x37c87c,_0x1b0a35[_0xae4a('0x4c')]);return _0x288b14['getFields'](_0x37c87c);}})[_0xae4a('0x1e')](function(_0x9a50d7){if(_0x9a50d7){_0x15d704=_0x9a50d7['length'];if(!_0x1b0a35[_0xae4a('0x3d')]['hasOwnProperty'](_0xae4a('0x43'))){_0x37c87c[_0xae4a('0x44')]=qs['limit'](_0x1b0a35[_0xae4a('0x3d')][_0xae4a('0x44')]);_0x37c87c[_0xae4a('0x2f')]=qs['offset'](_0x1b0a35[_0xae4a('0x3d')][_0xae4a('0x2f')]);}return _0x288b14[_0xae4a('0x57')](_0x37c87c);}})[_0xae4a('0x1e')](function(_0x4342f0){if(_0x4342f0){return _0x4342f0?{'count':_0x15d704,'rows':_0x4342f0}:null;}})[_0xae4a('0x1e')](respondWithResult(_0x4122c0,null))[_0xae4a('0x29')](handleError(_0x4122c0,null));};exports[_0xae4a('0x59')]=function(_0x4b2626,_0x501cca,_0x513e7d){var _0x4c5c14={};var _0xe8fd9e={};var _0x3e940b;var _0x216318;return db[_0xae4a('0x38')][_0xae4a('0x5a')]({'where':{'id':_0x4b2626[_0xae4a('0x50')]['id']}})[_0xae4a('0x1e')](handleEntityNotFound(_0x501cca,null))[_0xae4a('0x1e')](function(_0x58b16b){if(_0x58b16b){_0x3e940b=_0x58b16b;_0xe8fd9e[_0xae4a('0x3b')]=_[_0xae4a('0x51')](db[_0xae4a('0x58')][_0xae4a('0x39')]);_0xe8fd9e[_0xae4a('0x3d')]=_['keys'](_0x4b2626[_0xae4a('0x3d')]);_0xe8fd9e[_0xae4a('0x3e')]=_[_0xae4a('0x52')](_0xe8fd9e[_0xae4a('0x3b')],_0xe8fd9e[_0xae4a('0x3d')]);_0x4c5c14['attributes']=_[_0xae4a('0x52')](_0xe8fd9e[_0xae4a('0x3b')],qs[_0xae4a('0x3f')](_0x4b2626[_0xae4a('0x3d')][_0xae4a('0x3f')]));_0x4c5c14['attributes']=_0x4c5c14['attributes'][_0xae4a('0x41')]?_0x4c5c14[_0xae4a('0x40')]:_0xe8fd9e[_0xae4a('0x3b')];_0x4c5c14[_0xae4a('0x45')]=qs[_0xae4a('0x46')](_0x4b2626['query'][_0xae4a('0x46')]);_0x4c5c14['where']=qs[_0xae4a('0x3e')](_[_0xae4a('0x48')](_0x4b2626[_0xae4a('0x3d')],_0xe8fd9e[_0xae4a('0x3e')]));if(_0x4b2626[_0xae4a('0x3d')]['filter']){_0x4c5c14[_0xae4a('0x47')]=_[_0xae4a('0x4a')](_0x4c5c14[_0xae4a('0x47')],{'$or':_[_0xae4a('0x3c')](_0x4c5c14[_0xae4a('0x40')],function(_0x5a9817){var _0x54b78a={};_0x54b78a[_0x5a9817]={'$like':'%'+_0x4b2626[_0xae4a('0x3d')][_0xae4a('0x49')]+'%'};return _0x54b78a;})});}_0x4c5c14=_['merge']({},_0x4c5c14,_0x4b2626[_0xae4a('0x4c')]);return _0x3e940b[_0xae4a('0x59')](_0x4c5c14);}})[_0xae4a('0x1e')](function(_0xeb6c0c){if(_0xeb6c0c){_0x216318=_0xeb6c0c[_0xae4a('0x41')];if(!_0x4b2626['query'][_0xae4a('0x42')](_0xae4a('0x43'))){_0x4c5c14['limit']=qs[_0xae4a('0x44')](_0x4b2626['query'][_0xae4a('0x44')]);_0x4c5c14[_0xae4a('0x2f')]=qs['offset'](_0x4b2626[_0xae4a('0x3d')][_0xae4a('0x2f')]);}return _0x3e940b[_0xae4a('0x59')](_0x4c5c14);}})['then'](function(_0x4754c3){if(_0x4754c3){return _0x4754c3?{'count':_0x216318,'rows':_0x4754c3}:null;}})['then'](respondWithResult(_0x501cca,null))[_0xae4a('0x29')](handleError(_0x501cca,null));};exports['getDescriptions']=function(_0x408c0d,_0x81233,_0x386929){var _0x111524={};var _0x4377e2={};var _0x30c948;var _0x14026a;return db[_0xae4a('0x38')]['findOne']({'where':{'id':_0x408c0d['params']['id']}})[_0xae4a('0x1e')](handleEntityNotFound(_0x81233,null))[_0xae4a('0x1e')](function(_0x12aadb){if(_0x12aadb){_0x30c948=_0x12aadb;_0x4377e2[_0xae4a('0x3b')]=_[_0xae4a('0x51')](db[_0xae4a('0x58')][_0xae4a('0x39')]);_0x4377e2[_0xae4a('0x3d')]=_[_0xae4a('0x51')](_0x408c0d[_0xae4a('0x3d')]);_0x4377e2[_0xae4a('0x3e')]=_['intersection'](_0x4377e2[_0xae4a('0x3b')],_0x4377e2[_0xae4a('0x3d')]);_0x111524['attributes']=_[_0xae4a('0x52')](_0x4377e2[_0xae4a('0x3b')],qs[_0xae4a('0x3f')](_0x408c0d['query'][_0xae4a('0x3f')]));_0x111524[_0xae4a('0x40')]=_0x111524['attributes'][_0xae4a('0x41')]?_0x111524['attributes']:_0x4377e2[_0xae4a('0x3b')];_0x111524[_0xae4a('0x45')]=qs['sort'](_0x408c0d[_0xae4a('0x3d')]['sort']);_0x111524['where']=qs[_0xae4a('0x3e')](_['pick'](_0x408c0d[_0xae4a('0x3d')],_0x4377e2[_0xae4a('0x3e')]));if(_0x408c0d['query'][_0xae4a('0x49')]){_0x111524['where']=_[_0xae4a('0x4a')](_0x111524[_0xae4a('0x47')],{'$or':_[_0xae4a('0x3c')](_0x111524[_0xae4a('0x40')],function(_0x2bcbd6){var _0x4f781b={};_0x4f781b[_0x2bcbd6]={'$like':'%'+_0x408c0d[_0xae4a('0x3d')]['filter']+'%'};return _0x4f781b;})});}_0x111524=_['merge']({},_0x111524,_0x408c0d['options']);return _0x30c948[_0xae4a('0x5b')](_0x111524);}})[_0xae4a('0x1e')](function(_0x30ca60){if(_0x30ca60){_0x14026a=_0x30ca60[_0xae4a('0x41')];if(!_0x408c0d['query'][_0xae4a('0x42')](_0xae4a('0x43'))){_0x111524[_0xae4a('0x44')]=qs[_0xae4a('0x44')](_0x408c0d[_0xae4a('0x3d')]['limit']);_0x111524[_0xae4a('0x2f')]=qs[_0xae4a('0x2f')](_0x408c0d[_0xae4a('0x3d')][_0xae4a('0x2f')]);}return _0x30c948[_0xae4a('0x5b')](_0x111524);}})[_0xae4a('0x1e')](function(_0x40d7de){if(_0x40d7de){return _0x40d7de?{'count':_0x14026a,'rows':_0x40d7de}:null;}})[_0xae4a('0x1e')](respondWithResult(_0x81233,null))[_0xae4a('0x29')](handleError(_0x81233,null));};exports[_0xae4a('0x5c')]=function(_0x4c3e7a,_0x65198a,_0x1498ef){var _0x3f438a={};var _0x101133={};var _0x4c1d02;var _0x38892a;return db[_0xae4a('0x38')]['findOne']({'where':{'id':_0x4c3e7a[_0xae4a('0x50')]['id']}})[_0xae4a('0x1e')](handleEntityNotFound(_0x65198a,null))[_0xae4a('0x1e')](function(_0x5a51fb){if(_0x5a51fb){_0x4c1d02=_0x5a51fb;_0x101133[_0xae4a('0x3b')]=_[_0xae4a('0x51')](db[_0xae4a('0x5d')][_0xae4a('0x39')]);_0x101133['query']=_[_0xae4a('0x51')](_0x4c3e7a['query']);_0x101133['filters']=_[_0xae4a('0x52')](_0x101133[_0xae4a('0x3b')],_0x101133[_0xae4a('0x3d')]);_0x3f438a[_0xae4a('0x40')]=_[_0xae4a('0x52')](_0x101133[_0xae4a('0x3b')],qs[_0xae4a('0x3f')](_0x4c3e7a['query'][_0xae4a('0x3f')]));_0x3f438a[_0xae4a('0x40')]=_0x3f438a[_0xae4a('0x40')][_0xae4a('0x41')]?_0x3f438a[_0xae4a('0x40')]:_0x101133[_0xae4a('0x3b')];_0x3f438a[_0xae4a('0x45')]=qs[_0xae4a('0x46')](_0x4c3e7a[_0xae4a('0x3d')][_0xae4a('0x46')]);_0x3f438a[_0xae4a('0x47')]=qs[_0xae4a('0x3e')](_[_0xae4a('0x48')](_0x4c3e7a[_0xae4a('0x3d')],_0x101133['filters']));if(_0x4c3e7a[_0xae4a('0x3d')][_0xae4a('0x49')]){_0x3f438a['where']=_['merge'](_0x3f438a[_0xae4a('0x47')],{'$or':_[_0xae4a('0x3c')](_0x3f438a[_0xae4a('0x40')],function(_0x121b47){var _0x3e2af6={};_0x3e2af6[_0x121b47]={'$like':'%'+_0x4c3e7a[_0xae4a('0x3d')]['filter']+'%'};return _0x3e2af6;})});}_0x3f438a=_[_0xae4a('0x4a')]({},_0x3f438a,_0x4c3e7a[_0xae4a('0x4c')]);return _0x4c1d02[_0xae4a('0x5c')](_0x3f438a);}})[_0xae4a('0x1e')](function(_0x158405){if(_0x158405){_0x38892a=_0x158405[_0xae4a('0x41')];if(!_0x4c3e7a[_0xae4a('0x3d')]['hasOwnProperty'](_0xae4a('0x43'))){_0x3f438a['limit']=qs[_0xae4a('0x44')](_0x4c3e7a[_0xae4a('0x3d')][_0xae4a('0x44')]);_0x3f438a[_0xae4a('0x2f')]=qs[_0xae4a('0x2f')](_0x4c3e7a['query']['offset']);}return _0x4c1d02[_0xae4a('0x5c')](_0x3f438a);}})['then'](function(_0x327538){if(_0x327538){return _0x327538?{'count':_0x38892a,'rows':_0x327538}:null;}})[_0xae4a('0x1e')](respondWithResult(_0x65198a,null))[_0xae4a('0x29')](handleError(_0x65198a,null));};exports['setTags']=function(_0x4544c5,_0x70cd60,_0x3a35ad){if(_0x4544c5[_0xae4a('0x55')]['id']){delete _0x4544c5['body']['id'];}return db[_0xae4a('0x38')][_0xae4a('0x5a')]({'where':{'id':_0x4544c5[_0xae4a('0x50')]['id']}})[_0xae4a('0x1e')](handleEntityNotFound(_0x70cd60,null))[_0xae4a('0x1e')](function(_0xab473){if(_0xab473){return _0xab473[_0xae4a('0x5e')](_0x4544c5[_0xae4a('0x55')]['ids']||[]);}return null;})[_0xae4a('0x1e')](respondWithResult(_0x70cd60,null))[_0xae4a('0x29')](handleError(_0x70cd60,null));}; \ No newline at end of file +var _0xa21d=['where','filter','merge','options','count','includeAll','include','findAll','rows','show','params','create','body','find','findOne','DeskField','getFields','getSubjects','getDescriptions','pick','getTags','Tag','setTags','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','status','json','offset','limit','apply','save','update','end','sendStatus','stack','name','DeskConfiguration','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x52c826,_0x2707ff){var _0x36adf4=function(_0x260362){while(--_0x260362){_0x52c826['push'](_0x52c826['shift']());}};_0x36adf4(++_0x2707ff);}(_0xa21d,0x18b));var _0xda21=function(_0x2f5007,_0x3dd3ad){_0x2f5007=_0x2f5007-0x0;var _0x12c52d=_0xa21d[_0x2f5007];return _0x12c52d;};'use strict';var pdf=require(_0xda21('0x0'));var emlformat=require(_0xda21('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xda21('0x2'));var rp=require('request-promise');var moment=require(_0xda21('0x3'));var BPromise=require(_0xda21('0x4'));var Mustache=require(_0xda21('0x5'));var util=require(_0xda21('0x6'));var path=require(_0xda21('0x7'));var sox=require(_0xda21('0x8'));var csv=require(_0xda21('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xda21('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xda21('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xda21('0x9'));var querystring=require(_0xda21('0xc'));var Papa=require(_0xda21('0xd'));var Redis=require(_0xda21('0xe'));var authService=require(_0xda21('0xf'));var qs=require(_0xda21('0x10'));var as=require(_0xda21('0x11'));var hardwareService=require(_0xda21('0x12'));var logger=require(_0xda21('0x13'))(_0xda21('0x14'));var utils=require(_0xda21('0x15'));var config=require(_0xda21('0x16'));var db=require(_0xda21('0x17'))['db'];var jayson=require(_0xda21('0x18'));var client=jayson[_0xda21('0x19')][_0xda21('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x39e0ff,_0x424d1e,_0x3025e4){if(_0x3025e4){var _0x484729=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x484729['test'](_0x424d1e)){return _0x39e0ff;}else{throw new db[(_0xda21('0x1b'))][(_0xda21('0x1c'))](_0xda21('0x1d'));}}else{return _0x39e0ff;}}function respondWithRpcPromise(_0x240e68,_0x4db0df,_0xb50342,_0x358d4c){return new BPromise(function(_0x365199,_0x11642d){var _0x53762f=_0x358d4c||client;return _0x53762f[_0xda21('0x1e')](_0x240e68,_0xb50342)[_0xda21('0x1f')](function(_0x14019f){logger['info'](_0xda21('0x20'),_0x4db0df,'request\x20sent');logger[_0xda21('0x21')](_0xda21('0x22'),_0x4db0df,_0xda21('0x23'),JSON['stringify'](_0x14019f));if(_0x14019f[_0xda21('0x24')]){if(_0x14019f[_0xda21('0x24')][_0xda21('0x25')]===0x1f4){logger['error'](_0xda21('0x20'),_0x4db0df,_0x14019f[_0xda21('0x24')][_0xda21('0x26')]);return _0x11642d(_0x14019f[_0xda21('0x24')][_0xda21('0x26')]);}logger[_0xda21('0x24')](_0xda21('0x20'),_0x4db0df,_0x14019f['error'][_0xda21('0x26')]);return _0x365199(_0x14019f['error'][_0xda21('0x26')]);}else{logger[_0xda21('0x27')](_0xda21('0x20'),_0x4db0df,_0xda21('0x23'));_0x365199(_0x14019f[_0xda21('0x28')]['message']);}})[_0xda21('0x29')](function(_0x3162a5){logger[_0xda21('0x24')](_0xda21('0x20'),_0x4db0df,_0x3162a5);_0x11642d(_0x3162a5);});});}function respondWithStatusCode(_0xc0c47,_0x3b5e3d){_0x3b5e3d=_0x3b5e3d||0xcc;return function(_0x1886fe){if(_0x1886fe){return _0xc0c47['sendStatus'](_0x3b5e3d);}return _0xc0c47['status'](_0x3b5e3d)['end']();};}function respondWithResult(_0x50b8a8,_0x1d219a){_0x1d219a=_0x1d219a||0xc8;return function(_0x14340d){if(_0x14340d){return _0x50b8a8[_0xda21('0x2a')](_0x1d219a)[_0xda21('0x2b')](_0x14340d);}};}function respondWithFilteredResult(_0x2133b2,_0x393f27){return function(_0x29175a){if(_0x29175a){var _0x42ed90=_0x29175a['count'],_0x4dbfb1=_0x393f27[_0xda21('0x2c')],_0x1e01f4=_0x393f27[_0xda21('0x2c')]+_0x393f27[_0xda21('0x2d')],_0x1181ba;if(_0x1e01f4>=_0x42ed90){_0x1e01f4=_0x42ed90;_0x1181ba=0xc8;}else{_0x1181ba=0xce;}_0x2133b2[_0xda21('0x2a')](_0x1181ba);return _0x2133b2['set']('Content-Range',_0x4dbfb1+'-'+_0x1e01f4+'/'+_0x42ed90)[_0xda21('0x2b')](_0x29175a);}return null;};}function patchUpdates(_0x16d1fa){return function(_0x2d925a){try{jsonpatch[_0xda21('0x2e')](_0x2d925a,_0x16d1fa,!![]);}catch(_0x12d750){return BPromise['reject'](_0x12d750);}return _0x2d925a[_0xda21('0x2f')]();};}function saveUpdates(_0x1b9020,_0x233fc2){return function(_0x1dd5c6){if(_0x1dd5c6){return _0x1dd5c6[_0xda21('0x30')](_0x1b9020)[_0xda21('0x1f')](function(_0x46c0eb){return _0x46c0eb;});}return null;};}function removeEntity(_0x1a2313,_0x5e49d8){return function(_0x21ac34){if(_0x21ac34){return _0x21ac34['destroy']()[_0xda21('0x1f')](function(){_0x1a2313[_0xda21('0x2a')](0xcc)[_0xda21('0x31')]();});}};}function handleEntityNotFound(_0x23d6b4,_0x10eb88){return function(_0x5f274e){if(!_0x5f274e){_0x23d6b4[_0xda21('0x32')](0x194);}return _0x5f274e;};}function handleError(_0x1fd816,_0x204806){_0x204806=_0x204806||0x1f4;return function(_0x4a24ad){logger[_0xda21('0x24')](_0x4a24ad[_0xda21('0x33')]);if(_0x4a24ad[_0xda21('0x34')]){delete _0x4a24ad[_0xda21('0x34')];}_0x1fd816['status'](_0x204806)['send'](_0x4a24ad);};}exports['index']=function(_0x9a9a79,_0x4c6c99){var _0x3b75d1={},_0x4ad692={},_0x1e2b4a={'count':0x0,'rows':[]};var _0x9ba9c1=_['map'](db[_0xda21('0x35')][_0xda21('0x36')],function(_0x591a19){return{'name':_0x591a19['fieldName'],'type':_0x591a19[_0xda21('0x37')][_0xda21('0x38')]};});_0x4ad692[_0xda21('0x39')]=_[_0xda21('0x3a')](_0x9ba9c1,_0xda21('0x34'));_0x4ad692['query']=_[_0xda21('0x3b')](_0x9a9a79[_0xda21('0x3c')]);_0x4ad692[_0xda21('0x3d')]=_[_0xda21('0x3e')](_0x4ad692[_0xda21('0x39')],_0x4ad692[_0xda21('0x3c')]);_0x3b75d1[_0xda21('0x3f')]=_[_0xda21('0x3e')](_0x4ad692[_0xda21('0x39')],qs[_0xda21('0x40')](_0x9a9a79[_0xda21('0x3c')][_0xda21('0x40')]));_0x3b75d1[_0xda21('0x3f')]=_0x3b75d1[_0xda21('0x3f')][_0xda21('0x41')]?_0x3b75d1[_0xda21('0x3f')]:_0x4ad692[_0xda21('0x39')];if(!_0x9a9a79[_0xda21('0x3c')][_0xda21('0x42')](_0xda21('0x43'))){_0x3b75d1[_0xda21('0x2d')]=qs[_0xda21('0x2d')](_0x9a9a79[_0xda21('0x3c')][_0xda21('0x2d')]);_0x3b75d1[_0xda21('0x2c')]=qs[_0xda21('0x2c')](_0x9a9a79[_0xda21('0x3c')][_0xda21('0x2c')]);}_0x3b75d1[_0xda21('0x44')]=qs[_0xda21('0x45')](_0x9a9a79[_0xda21('0x3c')][_0xda21('0x45')]);_0x3b75d1[_0xda21('0x46')]=qs[_0xda21('0x3d')](_['pick'](_0x9a9a79[_0xda21('0x3c')],_0x4ad692['filters']));if(_0x9a9a79['query'][_0xda21('0x47')]){_0x3b75d1[_0xda21('0x46')]=_[_0xda21('0x48')](_0x3b75d1['where'],{'$or':_[_0xda21('0x3a')](_0x9ba9c1,function(_0x4be8f7){if(_0x4be8f7[_0xda21('0x37')]!=='VIRTUAL'){var _0x34e3f1={};_0x34e3f1[_0x4be8f7[_0xda21('0x34')]]={'$like':'%'+_0x9a9a79[_0xda21('0x3c')][_0xda21('0x47')]+'%'};return _0x34e3f1;}})});}_0x3b75d1=_['merge']({},_0x3b75d1,_0x9a9a79[_0xda21('0x49')]);var _0x4ac150={'where':_0x3b75d1[_0xda21('0x46')]};return db['DeskConfiguration'][_0xda21('0x4a')](_0x4ac150)[_0xda21('0x1f')](function(_0x3ec8b2){_0x1e2b4a[_0xda21('0x4a')]=_0x3ec8b2;if(_0x9a9a79['query'][_0xda21('0x4b')]){_0x3b75d1[_0xda21('0x4c')]=[{'all':!![]}];}return db[_0xda21('0x35')][_0xda21('0x4d')](_0x3b75d1);})[_0xda21('0x1f')](function(_0x554f5a){_0x1e2b4a[_0xda21('0x4e')]=_0x554f5a;return _0x1e2b4a;})['then'](respondWithFilteredResult(_0x4c6c99,_0x3b75d1))[_0xda21('0x29')](handleError(_0x4c6c99,null));};exports[_0xda21('0x4f')]=function(_0x54f376,_0x1b5912){var _0x2b2923={'raw':![],'where':{'id':_0x54f376[_0xda21('0x50')]['id']}},_0xd9c132={};_0xd9c132[_0xda21('0x39')]=_['keys'](db[_0xda21('0x35')]['rawAttributes']);_0xd9c132[_0xda21('0x3c')]=_[_0xda21('0x3b')](_0x54f376[_0xda21('0x3c')]);_0xd9c132[_0xda21('0x3d')]=_[_0xda21('0x3e')](_0xd9c132[_0xda21('0x39')],_0xd9c132[_0xda21('0x3c')]);_0x2b2923[_0xda21('0x3f')]=_[_0xda21('0x3e')](_0xd9c132[_0xda21('0x39')],qs['fields'](_0x54f376[_0xda21('0x3c')][_0xda21('0x40')]));_0x2b2923[_0xda21('0x3f')]=_0x2b2923[_0xda21('0x3f')][_0xda21('0x41')]?_0x2b2923[_0xda21('0x3f')]:_0xd9c132['model'];if(_0x54f376[_0xda21('0x3c')][_0xda21('0x4b')]){_0x2b2923[_0xda21('0x4c')]=[{'all':!![]}];}_0x2b2923=_[_0xda21('0x48')]({},_0x2b2923,_0x54f376[_0xda21('0x49')]);return db[_0xda21('0x35')]['find'](_0x2b2923)[_0xda21('0x1f')](handleEntityNotFound(_0x1b5912,null))['then'](respondWithResult(_0x1b5912,null))['catch'](handleError(_0x1b5912,null));};exports[_0xda21('0x51')]=function(_0x460d88,_0x163d19){return db[_0xda21('0x35')][_0xda21('0x51')](_0x460d88['body'],{})[_0xda21('0x1f')](respondWithResult(_0x163d19,0xc9))[_0xda21('0x29')](handleError(_0x163d19,null));};exports[_0xda21('0x30')]=function(_0x491992,_0x20fb5d){if(_0x491992[_0xda21('0x52')]['id']){delete _0x491992[_0xda21('0x52')]['id'];}return db['DeskConfiguration'][_0xda21('0x53')]({'where':{'id':_0x491992['params']['id']}})['then'](handleEntityNotFound(_0x20fb5d,null))['then'](saveUpdates(_0x491992[_0xda21('0x52')],null))[_0xda21('0x1f')](respondWithResult(_0x20fb5d,null))['catch'](handleError(_0x20fb5d,null));};exports['destroy']=function(_0x185254,_0x3c7573){return db['DeskConfiguration'][_0xda21('0x53')]({'where':{'id':_0x185254[_0xda21('0x50')]['id']}})[_0xda21('0x1f')](handleEntityNotFound(_0x3c7573,null))[_0xda21('0x1f')](removeEntity(_0x3c7573,null))[_0xda21('0x29')](handleError(_0x3c7573,null));};exports['getFields']=function(_0x5f4522,_0x35efe1,_0x3f65d7){var _0x50ac5a={};var _0x44ae0f={};var _0x3d990e;var _0x5816a2;return db[_0xda21('0x35')][_0xda21('0x54')]({'where':{'id':_0x5f4522[_0xda21('0x50')]['id']}})[_0xda21('0x1f')](handleEntityNotFound(_0x35efe1,null))[_0xda21('0x1f')](function(_0xccda50){if(_0xccda50){_0x3d990e=_0xccda50;_0x44ae0f[_0xda21('0x39')]=_[_0xda21('0x3b')](db[_0xda21('0x55')][_0xda21('0x36')]);_0x44ae0f[_0xda21('0x3c')]=_[_0xda21('0x3b')](_0x5f4522['query']);_0x44ae0f[_0xda21('0x3d')]=_[_0xda21('0x3e')](_0x44ae0f[_0xda21('0x39')],_0x44ae0f[_0xda21('0x3c')]);_0x50ac5a[_0xda21('0x3f')]=_[_0xda21('0x3e')](_0x44ae0f[_0xda21('0x39')],qs[_0xda21('0x40')](_0x5f4522[_0xda21('0x3c')][_0xda21('0x40')]));_0x50ac5a['attributes']=_0x50ac5a[_0xda21('0x3f')]['length']?_0x50ac5a[_0xda21('0x3f')]:_0x44ae0f['model'];_0x50ac5a[_0xda21('0x44')]=qs[_0xda21('0x45')](_0x5f4522[_0xda21('0x3c')][_0xda21('0x45')]);_0x50ac5a[_0xda21('0x46')]=qs['filters'](_['pick'](_0x5f4522[_0xda21('0x3c')],_0x44ae0f['filters']));if(_0x5f4522[_0xda21('0x3c')]['filter']){_0x50ac5a[_0xda21('0x46')]=_[_0xda21('0x48')](_0x50ac5a['where'],{'$or':_['map'](_0x50ac5a[_0xda21('0x3f')],function(_0x1574e2){var _0x45b945={};_0x45b945[_0x1574e2]={'$like':'%'+_0x5f4522['query'][_0xda21('0x47')]+'%'};return _0x45b945;})});}_0x50ac5a=_['merge']({},_0x50ac5a,_0x5f4522[_0xda21('0x49')]);return _0x3d990e['getFields'](_0x50ac5a);}})[_0xda21('0x1f')](function(_0x32053a){if(_0x32053a){_0x5816a2=_0x32053a[_0xda21('0x41')];if(!_0x5f4522['query'][_0xda21('0x42')](_0xda21('0x43'))){_0x50ac5a[_0xda21('0x2d')]=qs['limit'](_0x5f4522[_0xda21('0x3c')]['limit']);_0x50ac5a[_0xda21('0x2c')]=qs[_0xda21('0x2c')](_0x5f4522[_0xda21('0x3c')][_0xda21('0x2c')]);}return _0x3d990e[_0xda21('0x56')](_0x50ac5a);}})['then'](function(_0x1147bb){if(_0x1147bb){return _0x1147bb?{'count':_0x5816a2,'rows':_0x1147bb}:null;}})[_0xda21('0x1f')](respondWithResult(_0x35efe1,null))['catch'](handleError(_0x35efe1,null));};exports[_0xda21('0x57')]=function(_0x4a0a63,_0x1cf999,_0x19240e){var _0x227f4c={};var _0x2b7d9f={};var _0x3549c7;var _0x26ff9c;return db[_0xda21('0x35')][_0xda21('0x54')]({'where':{'id':_0x4a0a63['params']['id']}})['then'](handleEntityNotFound(_0x1cf999,null))[_0xda21('0x1f')](function(_0x44caa9){if(_0x44caa9){_0x3549c7=_0x44caa9;_0x2b7d9f[_0xda21('0x39')]=_[_0xda21('0x3b')](db['DeskField']['rawAttributes']);_0x2b7d9f[_0xda21('0x3c')]=_['keys'](_0x4a0a63[_0xda21('0x3c')]);_0x2b7d9f[_0xda21('0x3d')]=_[_0xda21('0x3e')](_0x2b7d9f['model'],_0x2b7d9f['query']);_0x227f4c[_0xda21('0x3f')]=_[_0xda21('0x3e')](_0x2b7d9f['model'],qs[_0xda21('0x40')](_0x4a0a63[_0xda21('0x3c')][_0xda21('0x40')]));_0x227f4c[_0xda21('0x3f')]=_0x227f4c[_0xda21('0x3f')][_0xda21('0x41')]?_0x227f4c[_0xda21('0x3f')]:_0x2b7d9f[_0xda21('0x39')];_0x227f4c['order']=qs[_0xda21('0x45')](_0x4a0a63['query'][_0xda21('0x45')]);_0x227f4c[_0xda21('0x46')]=qs[_0xda21('0x3d')](_['pick'](_0x4a0a63[_0xda21('0x3c')],_0x2b7d9f[_0xda21('0x3d')]));if(_0x4a0a63[_0xda21('0x3c')][_0xda21('0x47')]){_0x227f4c[_0xda21('0x46')]=_['merge'](_0x227f4c[_0xda21('0x46')],{'$or':_[_0xda21('0x3a')](_0x227f4c['attributes'],function(_0x399583){var _0x6dd43b={};_0x6dd43b[_0x399583]={'$like':'%'+_0x4a0a63[_0xda21('0x3c')][_0xda21('0x47')]+'%'};return _0x6dd43b;})});}_0x227f4c=_[_0xda21('0x48')]({},_0x227f4c,_0x4a0a63[_0xda21('0x49')]);return _0x3549c7[_0xda21('0x57')](_0x227f4c);}})[_0xda21('0x1f')](function(_0x37ed45){if(_0x37ed45){_0x26ff9c=_0x37ed45[_0xda21('0x41')];if(!_0x4a0a63[_0xda21('0x3c')][_0xda21('0x42')](_0xda21('0x43'))){_0x227f4c[_0xda21('0x2d')]=qs[_0xda21('0x2d')](_0x4a0a63['query'][_0xda21('0x2d')]);_0x227f4c[_0xda21('0x2c')]=qs[_0xda21('0x2c')](_0x4a0a63[_0xda21('0x3c')][_0xda21('0x2c')]);}return _0x3549c7[_0xda21('0x57')](_0x227f4c);}})[_0xda21('0x1f')](function(_0x28cd57){if(_0x28cd57){return _0x28cd57?{'count':_0x26ff9c,'rows':_0x28cd57}:null;}})[_0xda21('0x1f')](respondWithResult(_0x1cf999,null))[_0xda21('0x29')](handleError(_0x1cf999,null));};exports[_0xda21('0x58')]=function(_0x2f5955,_0x3f76ea,_0x258d13){var _0x327f4b={};var _0x3874f7={};var _0x299038;var _0x2330c9;return db[_0xda21('0x35')][_0xda21('0x54')]({'where':{'id':_0x2f5955[_0xda21('0x50')]['id']}})[_0xda21('0x1f')](handleEntityNotFound(_0x3f76ea,null))[_0xda21('0x1f')](function(_0x5e0c97){if(_0x5e0c97){_0x299038=_0x5e0c97;_0x3874f7[_0xda21('0x39')]=_[_0xda21('0x3b')](db[_0xda21('0x55')][_0xda21('0x36')]);_0x3874f7[_0xda21('0x3c')]=_['keys'](_0x2f5955[_0xda21('0x3c')]);_0x3874f7['filters']=_[_0xda21('0x3e')](_0x3874f7[_0xda21('0x39')],_0x3874f7[_0xda21('0x3c')]);_0x327f4b[_0xda21('0x3f')]=_[_0xda21('0x3e')](_0x3874f7[_0xda21('0x39')],qs['fields'](_0x2f5955['query'][_0xda21('0x40')]));_0x327f4b[_0xda21('0x3f')]=_0x327f4b[_0xda21('0x3f')]['length']?_0x327f4b['attributes']:_0x3874f7['model'];_0x327f4b[_0xda21('0x44')]=qs['sort'](_0x2f5955[_0xda21('0x3c')][_0xda21('0x45')]);_0x327f4b[_0xda21('0x46')]=qs['filters'](_[_0xda21('0x59')](_0x2f5955[_0xda21('0x3c')],_0x3874f7[_0xda21('0x3d')]));if(_0x2f5955['query'][_0xda21('0x47')]){_0x327f4b[_0xda21('0x46')]=_[_0xda21('0x48')](_0x327f4b[_0xda21('0x46')],{'$or':_[_0xda21('0x3a')](_0x327f4b[_0xda21('0x3f')],function(_0x24ffac){var _0x243797={};_0x243797[_0x24ffac]={'$like':'%'+_0x2f5955[_0xda21('0x3c')][_0xda21('0x47')]+'%'};return _0x243797;})});}_0x327f4b=_[_0xda21('0x48')]({},_0x327f4b,_0x2f5955[_0xda21('0x49')]);return _0x299038[_0xda21('0x58')](_0x327f4b);}})[_0xda21('0x1f')](function(_0x5b9f4a){if(_0x5b9f4a){_0x2330c9=_0x5b9f4a[_0xda21('0x41')];if(!_0x2f5955[_0xda21('0x3c')][_0xda21('0x42')]('nolimit')){_0x327f4b['limit']=qs['limit'](_0x2f5955[_0xda21('0x3c')][_0xda21('0x2d')]);_0x327f4b['offset']=qs[_0xda21('0x2c')](_0x2f5955[_0xda21('0x3c')][_0xda21('0x2c')]);}return _0x299038[_0xda21('0x58')](_0x327f4b);}})[_0xda21('0x1f')](function(_0x2d51cc){if(_0x2d51cc){return _0x2d51cc?{'count':_0x2330c9,'rows':_0x2d51cc}:null;}})[_0xda21('0x1f')](respondWithResult(_0x3f76ea,null))['catch'](handleError(_0x3f76ea,null));};exports[_0xda21('0x5a')]=function(_0x163bf9,_0x5dfbe4,_0x410cb4){var _0x204e08={};var _0x40a3a4={};var _0x20dc3b;var _0x4aca31;return db[_0xda21('0x35')][_0xda21('0x54')]({'where':{'id':_0x163bf9[_0xda21('0x50')]['id']}})['then'](handleEntityNotFound(_0x5dfbe4,null))[_0xda21('0x1f')](function(_0x55d258){if(_0x55d258){_0x20dc3b=_0x55d258;_0x40a3a4[_0xda21('0x39')]=_[_0xda21('0x3b')](db[_0xda21('0x5b')][_0xda21('0x36')]);_0x40a3a4[_0xda21('0x3c')]=_['keys'](_0x163bf9[_0xda21('0x3c')]);_0x40a3a4[_0xda21('0x3d')]=_[_0xda21('0x3e')](_0x40a3a4[_0xda21('0x39')],_0x40a3a4[_0xda21('0x3c')]);_0x204e08[_0xda21('0x3f')]=_[_0xda21('0x3e')](_0x40a3a4[_0xda21('0x39')],qs[_0xda21('0x40')](_0x163bf9[_0xda21('0x3c')][_0xda21('0x40')]));_0x204e08[_0xda21('0x3f')]=_0x204e08['attributes'][_0xda21('0x41')]?_0x204e08[_0xda21('0x3f')]:_0x40a3a4[_0xda21('0x39')];_0x204e08['order']=qs['sort'](_0x163bf9['query'][_0xda21('0x45')]);_0x204e08[_0xda21('0x46')]=qs[_0xda21('0x3d')](_[_0xda21('0x59')](_0x163bf9[_0xda21('0x3c')],_0x40a3a4[_0xda21('0x3d')]));if(_0x163bf9['query'][_0xda21('0x47')]){_0x204e08[_0xda21('0x46')]=_['merge'](_0x204e08['where'],{'$or':_['map'](_0x204e08[_0xda21('0x3f')],function(_0x1a1882){var _0x43ed48={};_0x43ed48[_0x1a1882]={'$like':'%'+_0x163bf9[_0xda21('0x3c')][_0xda21('0x47')]+'%'};return _0x43ed48;})});}_0x204e08=_[_0xda21('0x48')]({},_0x204e08,_0x163bf9[_0xda21('0x49')]);return _0x20dc3b[_0xda21('0x5a')](_0x204e08);}})[_0xda21('0x1f')](function(_0x182aa8){if(_0x182aa8){_0x4aca31=_0x182aa8[_0xda21('0x41')];if(!_0x163bf9['query'][_0xda21('0x42')]('nolimit')){_0x204e08[_0xda21('0x2d')]=qs[_0xda21('0x2d')](_0x163bf9[_0xda21('0x3c')]['limit']);_0x204e08[_0xda21('0x2c')]=qs[_0xda21('0x2c')](_0x163bf9['query']['offset']);}return _0x20dc3b[_0xda21('0x5a')](_0x204e08);}})[_0xda21('0x1f')](function(_0x190255){if(_0x190255){return _0x190255?{'count':_0x4aca31,'rows':_0x190255}:null;}})[_0xda21('0x1f')](respondWithResult(_0x5dfbe4,null))[_0xda21('0x29')](handleError(_0x5dfbe4,null));};exports[_0xda21('0x5c')]=function(_0x1195b5,_0x363097,_0x527f39){if(_0x1195b5['body']['id']){delete _0x1195b5[_0xda21('0x52')]['id'];}return db[_0xda21('0x35')]['findOne']({'where':{'id':_0x1195b5[_0xda21('0x50')]['id']}})[_0xda21('0x1f')](handleEntityNotFound(_0x363097,null))['then'](function(_0x98b745){if(_0x98b745){return _0x98b745[_0xda21('0x5c')](_0x1195b5[_0xda21('0x52')]['ids']||[]);}return null;})[_0xda21('0x1f')](respondWithResult(_0x363097,null))[_0xda21('0x29')](handleError(_0x363097,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index f73433a..4d74ef6 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 _0x6bae=['exports','define','DeskConfiguration','lodash','../../config/logger','api','bluebird','request-promise','rimraf','./intDeskConfiguration.attributes'];(function(_0x300022,_0x4f8091){var _0x3b74fc=function(_0x47c4e5){while(--_0x47c4e5){_0x300022['push'](_0x300022['shift']());}};_0x3b74fc(++_0x4f8091);}(_0x6bae,0x1d9));var _0xe6ba=function(_0x2d402d,_0x4dff66){_0x2d402d=_0x2d402d-0x0;var _0x303960=_0x6bae[_0x2d402d];return _0x303960;};'use strict';var _=require(_0xe6ba('0x0'));var util=require('util');var logger=require(_0xe6ba('0x1'))(_0xe6ba('0x2'));var moment=require('moment');var BPromise=require(_0xe6ba('0x3'));var rp=require(_0xe6ba('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6ba('0x5'));var config=require('../../config/environment');var attributes=require(_0xe6ba('0x6'));module[_0xe6ba('0x7')]=function(_0x290f5a,_0xd90d6e){return _0x290f5a[_0xe6ba('0x8')](_0xe6ba('0x9'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0656=['path','../../config/environment','exports','define','DeskConfiguration','lodash','util','../../config/logger','moment','bluebird'];(function(_0x422a42,_0x2edb42){var _0x3ca02b=function(_0xb5e642){while(--_0xb5e642){_0x422a42['push'](_0x422a42['shift']());}};_0x3ca02b(++_0x2edb42);}(_0x0656,0x181));var _0x6065=function(_0x18ee83,_0x564f04){_0x18ee83=_0x18ee83-0x0;var _0x3f1836=_0x0656[_0x18ee83];return _0x3f1836;};'use strict';var _=require(_0x6065('0x0'));var util=require(_0x6065('0x1'));var logger=require(_0x6065('0x2'))('api');var moment=require(_0x6065('0x3'));var BPromise=require(_0x6065('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6065('0x5'));var rimraf=require('rimraf');var config=require(_0x6065('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0x6065('0x7')]=function(_0x10b23e,_0x51bae5){return _0x10b23e[_0x6065('0x8')](_0x6065('0x9'),attributes,{'tableName':'int_desk_configurations','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 8ac79be..e0ba68c 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 _0x5668=['debug','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3f3700,_0x1df7f9){var _0x5bdeaa=function(_0x1ed5d9){while(--_0x1ed5d9){_0x3f3700['push'](_0x3f3700['shift']());}};_0x5bdeaa(++_0x1df7f9);}(_0x5668,0x8b));var _0x8566=function(_0x4d0e9f,_0x51ecc4){_0x4d0e9f=_0x4d0e9f-0x0;var _0x1268da=_0x5668[_0x4d0e9f];return _0x1268da;};'use strict';var _=require(_0x8566('0x0'));var util=require(_0x8566('0x1'));var moment=require(_0x8566('0x2'));var BPromise=require(_0x8566('0x3'));var rs=require(_0x8566('0x4'));var fs=require('fs');var Redis=require(_0x8566('0x5'));var db=require(_0x8566('0x6'))['db'];var utils=require(_0x8566('0x7'));var logger=require(_0x8566('0x8'))(_0x8566('0x9'));var config=require(_0x8566('0xa'));var jayson=require(_0x8566('0xb'));var client=jayson[_0x8566('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x355fce,_0x2ffec4,_0x49f55a){return new BPromise(function(_0x4aaf3f,_0x4045ed){return client['request'](_0x355fce,_0x49f55a)['then'](function(_0x1a01a2){logger['info'](_0x8566('0xd'),_0x2ffec4,_0x8566('0xe'));logger[_0x8566('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2ffec4,_0x8566('0xe'),JSON[_0x8566('0x10')](_0x1a01a2));if(_0x1a01a2['error']){if(_0x1a01a2['error']['code']===0x1f4){logger['error'](_0x8566('0xd'),_0x2ffec4,_0x1a01a2[_0x8566('0x11')][_0x8566('0x12')]);return _0x4045ed(_0x1a01a2[_0x8566('0x11')][_0x8566('0x12')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x2ffec4,_0x1a01a2['error']['message']);return _0x4aaf3f(_0x1a01a2['error'][_0x8566('0x12')]);}else{logger[_0x8566('0x13')](_0x8566('0xd'),_0x2ffec4,_0x8566('0xe'));_0x4aaf3f(_0x1a01a2[_0x8566('0x14')]['message']);}})[_0x8566('0x15')](function(_0xe208c7){logger[_0x8566('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x2ffec4,_0xe208c7);_0x4045ed(_0xe208c7);});});} \ No newline at end of file +var _0xbf83=['jayson/promise','client','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x466500,_0x50c147){var _0x3fdebd=function(_0x4b1c84){while(--_0x4b1c84){_0x466500['push'](_0x466500['shift']());}};_0x3fdebd(++_0x50c147);}(_0xbf83,0x11e));var _0x3bf8=function(_0xec5770,_0x5d1105){_0xec5770=_0xec5770-0x0;var _0x2f1b37=_0xbf83[_0xec5770];return _0x2f1b37;};'use strict';var _=require(_0x3bf8('0x0'));var util=require('util');var moment=require(_0x3bf8('0x1'));var BPromise=require(_0x3bf8('0x2'));var rs=require(_0x3bf8('0x3'));var fs=require('fs');var Redis=require(_0x3bf8('0x4'));var db=require(_0x3bf8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3bf8('0x6'));var config=require(_0x3bf8('0x7'));var jayson=require(_0x3bf8('0x8'));var client=jayson[_0x3bf8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b0c12,_0x168a20,_0x2df7c9){return new BPromise(function(_0x4adc52,_0x27c23f){return client['request'](_0x5b0c12,_0x2df7c9)[_0x3bf8('0xa')](function(_0x2eca24){logger[_0x3bf8('0xb')](_0x3bf8('0xc'),_0x168a20,_0x3bf8('0xd'));logger[_0x3bf8('0xe')](_0x3bf8('0xf'),_0x168a20,'request\x20sent',JSON[_0x3bf8('0x10')](_0x2eca24));if(_0x2eca24[_0x3bf8('0x11')]){if(_0x2eca24['error'][_0x3bf8('0x12')]===0x1f4){logger[_0x3bf8('0x11')](_0x3bf8('0xc'),_0x168a20,_0x2eca24[_0x3bf8('0x11')][_0x3bf8('0x13')]);return _0x27c23f(_0x2eca24[_0x3bf8('0x11')][_0x3bf8('0x13')]);}logger[_0x3bf8('0x11')](_0x3bf8('0xc'),_0x168a20,_0x2eca24[_0x3bf8('0x11')]['message']);return _0x4adc52(_0x2eca24['error'][_0x3bf8('0x13')]);}else{logger[_0x3bf8('0xb')](_0x3bf8('0xc'),_0x168a20,_0x3bf8('0xd'));_0x4adc52(_0x2eca24['result'][_0x3bf8('0x13')]);}})[_0x3bf8('0x14')](function(_0x1a77fc){logger[_0x3bf8('0x11')](_0x3bf8('0xc'),_0x168a20,_0x1a77fc);_0x27c23f(_0x1a77fc);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index ce32027..b0a1539 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 _0x8092=['Router','../../components/interaction/service','./intDeskField.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','express'];(function(_0x378d41,_0x4d688c){var _0xa8c290=function(_0x188d96){while(--_0x188d96){_0x378d41['push'](_0x378d41['shift']());}};_0xa8c290(++_0x4d688c);}(_0x8092,0xa1));var _0x2809=function(_0x56cf93,_0xd0068e){_0x56cf93=_0x56cf93-0x0;var _0x1835fe=_0x8092[_0x56cf93];return _0x1835fe;};'use strict';var multer=require(_0x2809('0x0'));var util=require(_0x2809('0x1'));var path=require(_0x2809('0x2'));var timeout=require('connect-timeout');var express=require(_0x2809('0x3'));var router=express[_0x2809('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2809('0x5'));var config=require('../../config/environment');var controller=require(_0x2809('0x6'));router['get']('/',auth[_0x2809('0x7')](),controller['index']);router[_0x2809('0x8')]('/:id',auth[_0x2809('0x7')](),controller[_0x2809('0x9')]);router['post']('/',auth[_0x2809('0x7')](),controller[_0x2809('0xa')]);router['put'](_0x2809('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x2809('0xc')](_0x2809('0xb'),auth[_0x2809('0x7')](),controller[_0x2809('0xd')]);module[_0x2809('0xe')]=router; \ No newline at end of file +var _0xbee1=['/:id','show','post','create','put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','./intDeskField.controller','get','isAuthenticated','index'];(function(_0x71a70,_0x4e1cdd){var _0x3a2b22=function(_0x17d53f){while(--_0x17d53f){_0x71a70['push'](_0x71a70['shift']());}};_0x3a2b22(++_0x4e1cdd);}(_0xbee1,0x1b1));var _0x1bee=function(_0x29a617,_0x12d9e6){_0x29a617=_0x29a617-0x0;var _0x508e6b=_0xbee1[_0x29a617];return _0x508e6b;};'use strict';var multer=require(_0x1bee('0x0'));var util=require(_0x1bee('0x1'));var path=require(_0x1bee('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1bee('0x3')]();var auth=require(_0x1bee('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1bee('0x5'));router[_0x1bee('0x6')]('/',auth[_0x1bee('0x7')](),controller[_0x1bee('0x8')]);router['get'](_0x1bee('0x9'),auth['isAuthenticated'](),controller[_0x1bee('0xa')]);router[_0x1bee('0xb')]('/',auth[_0x1bee('0x7')](),controller[_0x1bee('0xc')]);router[_0x1bee('0xd')](_0x1bee('0x9'),auth[_0x1bee('0x7')](),controller[_0x1bee('0xe')]);router['delete'](_0x1bee('0x9'),auth['isAuthenticated'](),controller[_0x1bee('0xf')]);module[_0x1bee('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 4b7db8b..224b487 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 _0x4e30=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x1130cd,_0x516cd3){var _0x212668=function(_0x2157dd){while(--_0x2157dd){_0x1130cd['push'](_0x1130cd['shift']());}};_0x212668(++_0x516cd3);}(_0x4e30,0x151));var _0x04e3=function(_0x2cbbcd,_0x4ab8c8){_0x2cbbcd=_0x2cbbcd-0x0;var _0xc87abb=_0x4e30[_0x2cbbcd];return _0xc87abb;};'use strict';var Sequelize=require(_0x04e3('0x0'));module[_0x04e3('0x1')]={'type':{'type':Sequelize[_0x04e3('0x2')](_0x04e3('0x3'),_0x04e3('0x4'),_0x04e3('0x5'),_0x04e3('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x04e3('0x7')]},'key':{'type':Sequelize[_0x04e3('0x7')]},'keyType':{'type':Sequelize[_0x04e3('0x2')]('string',_0x04e3('0x4'),_0x04e3('0x5'))},'keyContent':{'type':Sequelize[_0x04e3('0x7')]},'idField':{'type':Sequelize[_0x04e3('0x7')]},'nameField':{'type':Sequelize[_0x04e3('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x04e3('0x7')]}}; \ No newline at end of file +var _0xdfd4=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue','STRING','variable'];(function(_0x5ef13d,_0x1c5956){var _0x79941=function(_0x32bc62){while(--_0x32bc62){_0x5ef13d['push'](_0x5ef13d['shift']());}};_0x79941(++_0x1c5956);}(_0xdfd4,0x1f1));var _0x4dfd=function(_0xf5d1f5,_0x4494d2){_0xf5d1f5=_0xf5d1f5-0x0;var _0x5f5bbd=_0xdfd4[_0xf5d1f5];return _0x5f5bbd;};'use strict';var Sequelize=require(_0x4dfd('0x0'));module[_0x4dfd('0x1')]={'type':{'type':Sequelize[_0x4dfd('0x2')](_0x4dfd('0x3'),'variable','customVariable',_0x4dfd('0x4')),'defaultValue':_0x4dfd('0x3')},'content':{'type':Sequelize[_0x4dfd('0x5')]},'key':{'type':Sequelize[_0x4dfd('0x5')]},'keyType':{'type':Sequelize[_0x4dfd('0x2')](_0x4dfd('0x3'),_0x4dfd('0x6'),_0x4dfd('0x7'))},'keyContent':{'type':Sequelize[_0x4dfd('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4dfd('0x5')]},'customField':{'type':Sequelize[_0x4dfd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4dfd('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index d07301c..6e4f612 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 _0xd67b=['model','query','keys','attributes','fields','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','DeskField','count','findAll','catch','show','params','rawAttributes','intersection','length','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','index','map','fieldName','type','key'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xd67b,0x133));var _0xbd67=function(_0x158c42,_0xac04f4){_0x158c42=_0x158c42-0x0;var _0x513397=_0xd67b[_0x158c42];return _0x513397;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbd67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd67('0x1'));var jsonpatch=require(_0xbd67('0x2'));var rp=require(_0xbd67('0x3'));var moment=require('moment');var BPromise=require(_0xbd67('0x4'));var Mustache=require('mustache');var util=require(_0xbd67('0x5'));var path=require('path');var sox=require(_0xbd67('0x6'));var csv=require(_0xbd67('0x7'));var ejs=require(_0xbd67('0x8'));var fs=require('fs');var _=require(_0xbd67('0x9'));var squel=require(_0xbd67('0xa'));var crypto=require(_0xbd67('0xb'));var jsforce=require(_0xbd67('0xc'));var deskjs=require(_0xbd67('0xd'));var toCsv=require(_0xbd67('0x7'));var querystring=require(_0xbd67('0xe'));var Papa=require(_0xbd67('0xf'));var Redis=require(_0xbd67('0x10'));var authService=require(_0xbd67('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd67('0x12'));var logger=require('../../config/logger')(_0xbd67('0x13'));var utils=require(_0xbd67('0x14'));var config=require(_0xbd67('0x15'));var db=require(_0xbd67('0x16'))['db'];function respondWithStatusCode(_0x137b8c,_0xb05237){_0xb05237=_0xb05237||0xcc;return function(_0x3621ad){if(_0x3621ad){return _0x137b8c[_0xbd67('0x17')](_0xb05237);}return _0x137b8c[_0xbd67('0x18')](_0xb05237)[_0xbd67('0x19')]();};}function respondWithResult(_0x4c078c,_0xbe923c){_0xbe923c=_0xbe923c||0xc8;return function(_0x46d881){if(_0x46d881){return _0x4c078c[_0xbd67('0x18')](_0xbe923c)[_0xbd67('0x1a')](_0x46d881);}};}function respondWithFilteredResult(_0x84bdf1,_0x23b626){return function(_0x44c025){if(_0x44c025){var _0xbdd027=_0x44c025['count'],_0xa45c76=_0x23b626[_0xbd67('0x1b')],_0x140df9=_0x23b626[_0xbd67('0x1b')]+_0x23b626[_0xbd67('0x1c')],_0x591de9;if(_0x140df9>=_0xbdd027){_0x140df9=_0xbdd027;_0x591de9=0xc8;}else{_0x591de9=0xce;}_0x84bdf1['status'](_0x591de9);return _0x84bdf1[_0xbd67('0x1d')](_0xbd67('0x1e'),_0xa45c76+'-'+_0x140df9+'/'+_0xbdd027)[_0xbd67('0x1a')](_0x44c025);}return null;};}function patchUpdates(_0x4b764f){return function(_0x5906a2){try{jsonpatch['apply'](_0x5906a2,_0x4b764f,!![]);}catch(_0x1f9193){return BPromise[_0xbd67('0x1f')](_0x1f9193);}return _0x5906a2[_0xbd67('0x20')]();};}function saveUpdates(_0x5e42c7,_0x3c4102){return function(_0x40ec96){if(_0x40ec96){return _0x40ec96[_0xbd67('0x21')](_0x5e42c7)[_0xbd67('0x22')](function(_0x419a6a){return _0x419a6a;});}return null;};}function removeEntity(_0x4576c4,_0x5a95b6){return function(_0x3ee2f1){if(_0x3ee2f1){return _0x3ee2f1[_0xbd67('0x23')]()[_0xbd67('0x22')](function(){_0x4576c4[_0xbd67('0x18')](0xcc)[_0xbd67('0x19')]();});}};}function handleEntityNotFound(_0x33fd8c,_0x46c519){return function(_0x922df8){if(!_0x922df8){_0x33fd8c[_0xbd67('0x17')](0x194);}return _0x922df8;};}function handleError(_0x36f7c8,_0x46b7ff){_0x46b7ff=_0x46b7ff||0x1f4;return function(_0x57602d){logger[_0xbd67('0x24')](_0x57602d['stack']);if(_0x57602d[_0xbd67('0x25')]){delete _0x57602d[_0xbd67('0x25')];}_0x36f7c8[_0xbd67('0x18')](_0x46b7ff)['send'](_0x57602d);};}exports[_0xbd67('0x26')]=function(_0x410baa,_0x4dfa19){var _0x3a062e={},_0x1b3253={},_0x374f1b={'count':0x0,'rows':[]};var _0x1c66ae=_[_0xbd67('0x27')](db['DeskField']['rawAttributes'],function(_0x41856b){return{'name':_0x41856b[_0xbd67('0x28')],'type':_0x41856b[_0xbd67('0x29')][_0xbd67('0x2a')]};});_0x1b3253[_0xbd67('0x2b')]=_[_0xbd67('0x27')](_0x1c66ae,_0xbd67('0x25'));_0x1b3253[_0xbd67('0x2c')]=_[_0xbd67('0x2d')](_0x410baa[_0xbd67('0x2c')]);_0x1b3253['filters']=_['intersection'](_0x1b3253[_0xbd67('0x2b')],_0x1b3253[_0xbd67('0x2c')]);_0x3a062e[_0xbd67('0x2e')]=_['intersection'](_0x1b3253[_0xbd67('0x2b')],qs[_0xbd67('0x2f')](_0x410baa[_0xbd67('0x2c')][_0xbd67('0x2f')]));_0x3a062e['attributes']=_0x3a062e['attributes']['length']?_0x3a062e[_0xbd67('0x2e')]:_0x1b3253[_0xbd67('0x2b')];if(!_0x410baa[_0xbd67('0x2c')]['hasOwnProperty']('nolimit')){_0x3a062e[_0xbd67('0x1c')]=qs[_0xbd67('0x1c')](_0x410baa[_0xbd67('0x2c')][_0xbd67('0x1c')]);_0x3a062e[_0xbd67('0x1b')]=qs[_0xbd67('0x1b')](_0x410baa['query'][_0xbd67('0x1b')]);}_0x3a062e[_0xbd67('0x30')]=qs[_0xbd67('0x31')](_0x410baa['query'][_0xbd67('0x31')]);_0x3a062e['where']=qs[_0xbd67('0x32')](_[_0xbd67('0x33')](_0x410baa['query'],_0x1b3253[_0xbd67('0x32')]));if(_0x410baa[_0xbd67('0x2c')][_0xbd67('0x34')]){_0x3a062e[_0xbd67('0x35')]=_[_0xbd67('0x36')](_0x3a062e[_0xbd67('0x35')],{'$or':_['map'](_0x1c66ae,function(_0x383c65){if(_0x383c65[_0xbd67('0x29')]!==_0xbd67('0x37')){var _0x41149d={};_0x41149d[_0x383c65[_0xbd67('0x25')]]={'$like':'%'+_0x410baa['query']['filter']+'%'};return _0x41149d;}})});}_0x3a062e=_[_0xbd67('0x36')]({},_0x3a062e,_0x410baa[_0xbd67('0x38')]);var _0x32fc09={'where':_0x3a062e['where']};return db[_0xbd67('0x39')][_0xbd67('0x3a')](_0x32fc09)[_0xbd67('0x22')](function(_0x194c1f){_0x374f1b['count']=_0x194c1f;if(_0x410baa['query']['includeAll']){_0x3a062e['include']=[{'all':!![]}];}return db['DeskField'][_0xbd67('0x3b')](_0x3a062e);})['then'](function(_0x4d08a6){_0x374f1b['rows']=_0x4d08a6;return _0x374f1b;})[_0xbd67('0x22')](respondWithFilteredResult(_0x4dfa19,_0x3a062e))[_0xbd67('0x3c')](handleError(_0x4dfa19,null));};exports[_0xbd67('0x3d')]=function(_0x2ca134,_0x4bece3){var _0x41f158={'raw':!![],'where':{'id':_0x2ca134[_0xbd67('0x3e')]['id']}},_0x43caa9={};_0x43caa9[_0xbd67('0x2b')]=_[_0xbd67('0x2d')](db[_0xbd67('0x39')][_0xbd67('0x3f')]);_0x43caa9['query']=_[_0xbd67('0x2d')](_0x2ca134['query']);_0x43caa9[_0xbd67('0x32')]=_[_0xbd67('0x40')](_0x43caa9[_0xbd67('0x2b')],_0x43caa9[_0xbd67('0x2c')]);_0x41f158[_0xbd67('0x2e')]=_[_0xbd67('0x40')](_0x43caa9[_0xbd67('0x2b')],qs[_0xbd67('0x2f')](_0x2ca134['query'][_0xbd67('0x2f')]));_0x41f158[_0xbd67('0x2e')]=_0x41f158['attributes'][_0xbd67('0x41')]?_0x41f158[_0xbd67('0x2e')]:_0x43caa9[_0xbd67('0x2b')];if(_0x2ca134['query']['includeAll']){_0x41f158[_0xbd67('0x42')]=[{'all':!![]}];}_0x41f158=_[_0xbd67('0x36')]({},_0x41f158,_0x2ca134[_0xbd67('0x38')]);return db['DeskField'][_0xbd67('0x43')](_0x41f158)[_0xbd67('0x22')](handleEntityNotFound(_0x4bece3,null))['then'](respondWithResult(_0x4bece3,null))['catch'](handleError(_0x4bece3,null));};exports['create']=function(_0x58328f,_0x4696ea){return db[_0xbd67('0x39')][_0xbd67('0x44')](_0x58328f[_0xbd67('0x45')],{})[_0xbd67('0x22')](respondWithResult(_0x4696ea,0xc9))['catch'](handleError(_0x4696ea,null));};exports[_0xbd67('0x21')]=function(_0x171d86,_0x584aa8){if(_0x171d86[_0xbd67('0x45')]['id']){delete _0x171d86[_0xbd67('0x45')]['id'];}return db[_0xbd67('0x39')][_0xbd67('0x43')]({'where':{'id':_0x171d86[_0xbd67('0x3e')]['id']}})['then'](handleEntityNotFound(_0x584aa8,null))[_0xbd67('0x22')](saveUpdates(_0x171d86['body'],null))[_0xbd67('0x22')](respondWithResult(_0x584aa8,null))[_0xbd67('0x3c')](handleError(_0x584aa8,null));};exports['destroy']=function(_0x1951d2,_0x8f5702){return db[_0xbd67('0x39')]['find']({'where':{'id':_0x1951d2[_0xbd67('0x3e')]['id']}})[_0xbd67('0x22')](handleEntityNotFound(_0x8f5702,null))[_0xbd67('0x22')](removeEntity(_0x8f5702,null))[_0xbd67('0x3c')](handleError(_0x8f5702,null));}; \ No newline at end of file +var _0xb07f=['status','json','count','offset','set','Content-Range','reject','save','update','then','end','error','stack','name','index','map','DeskField','rawAttributes','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','includeAll','include','findAll','catch','intersection','length','options','find','create','body','destroy','params','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','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xb07f,0x109));var _0xfb07=function(_0x4f68ae,_0x292eaf){_0x4f68ae=_0x4f68ae-0x0;var _0x362e5c=_0xb07f[_0x4f68ae];return _0x362e5c;};'use strict';var pdf=require(_0xfb07('0x0'));var emlformat=require(_0xfb07('0x1'));var rimraf=require(_0xfb07('0x2'));var zipdir=require(_0xfb07('0x3'));var jsonpatch=require(_0xfb07('0x4'));var rp=require(_0xfb07('0x5'));var moment=require(_0xfb07('0x6'));var BPromise=require(_0xfb07('0x7'));var Mustache=require(_0xfb07('0x8'));var util=require(_0xfb07('0x9'));var path=require(_0xfb07('0xa'));var sox=require('sox');var csv=require(_0xfb07('0xb'));var ejs=require(_0xfb07('0xc'));var fs=require('fs');var _=require(_0xfb07('0xd'));var squel=require(_0xfb07('0xe'));var crypto=require(_0xfb07('0xf'));var jsforce=require(_0xfb07('0x10'));var deskjs=require(_0xfb07('0x11'));var toCsv=require(_0xfb07('0xb'));var querystring=require(_0xfb07('0x12'));var Papa=require(_0xfb07('0x13'));var Redis=require(_0xfb07('0x14'));var authService=require(_0xfb07('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb07('0x16'))(_0xfb07('0x17'));var utils=require('../../config/utils');var config=require(_0xfb07('0x18'));var db=require(_0xfb07('0x19'))['db'];function respondWithStatusCode(_0xc4978c,_0x13275d){_0x13275d=_0x13275d||0xcc;return function(_0x2ad2cf){if(_0x2ad2cf){return _0xc4978c[_0xfb07('0x1a')](_0x13275d);}return _0xc4978c[_0xfb07('0x1b')](_0x13275d)['end']();};}function respondWithResult(_0x5780f8,_0x40bf71){_0x40bf71=_0x40bf71||0xc8;return function(_0x3c69db){if(_0x3c69db){return _0x5780f8[_0xfb07('0x1b')](_0x40bf71)[_0xfb07('0x1c')](_0x3c69db);}};}function respondWithFilteredResult(_0x3c283d,_0x29cbae){return function(_0x228e2a){if(_0x228e2a){var _0x2363d6=_0x228e2a[_0xfb07('0x1d')],_0x6a14e0=_0x29cbae[_0xfb07('0x1e')],_0x3dde76=_0x29cbae['offset']+_0x29cbae['limit'],_0x1cfc43;if(_0x3dde76>=_0x2363d6){_0x3dde76=_0x2363d6;_0x1cfc43=0xc8;}else{_0x1cfc43=0xce;}_0x3c283d[_0xfb07('0x1b')](_0x1cfc43);return _0x3c283d[_0xfb07('0x1f')](_0xfb07('0x20'),_0x6a14e0+'-'+_0x3dde76+'/'+_0x2363d6)['json'](_0x228e2a);}return null;};}function patchUpdates(_0x3923c0){return function(_0x3a88d9){try{jsonpatch['apply'](_0x3a88d9,_0x3923c0,!![]);}catch(_0x4fc244){return BPromise[_0xfb07('0x21')](_0x4fc244);}return _0x3a88d9[_0xfb07('0x22')]();};}function saveUpdates(_0x2d2d33,_0x2c6c44){return function(_0x388995){if(_0x388995){return _0x388995[_0xfb07('0x23')](_0x2d2d33)[_0xfb07('0x24')](function(_0x23c2be){return _0x23c2be;});}return null;};}function removeEntity(_0x19ad99,_0x578bb2){return function(_0x45806a){if(_0x45806a){return _0x45806a['destroy']()[_0xfb07('0x24')](function(){_0x19ad99[_0xfb07('0x1b')](0xcc)[_0xfb07('0x25')]();});}};}function handleEntityNotFound(_0x301c1a,_0xb2063a){return function(_0x508d3b){if(!_0x508d3b){_0x301c1a[_0xfb07('0x1a')](0x194);}return _0x508d3b;};}function handleError(_0x451cd8,_0x10835a){_0x10835a=_0x10835a||0x1f4;return function(_0x47523e){logger[_0xfb07('0x26')](_0x47523e[_0xfb07('0x27')]);if(_0x47523e['name']){delete _0x47523e[_0xfb07('0x28')];}_0x451cd8[_0xfb07('0x1b')](_0x10835a)['send'](_0x47523e);};}exports[_0xfb07('0x29')]=function(_0x89f385,_0xe813a7){var _0x149ac0={},_0x46927a={},_0x2b0650={'count':0x0,'rows':[]};var _0x20f01a=_[_0xfb07('0x2a')](db[_0xfb07('0x2b')][_0xfb07('0x2c')],function(_0x1332e1){return{'name':_0x1332e1['fieldName'],'type':_0x1332e1[_0xfb07('0x2d')][_0xfb07('0x2e')]};});_0x46927a[_0xfb07('0x2f')]=_[_0xfb07('0x2a')](_0x20f01a,'name');_0x46927a[_0xfb07('0x30')]=_[_0xfb07('0x31')](_0x89f385['query']);_0x46927a[_0xfb07('0x32')]=_['intersection'](_0x46927a[_0xfb07('0x2f')],_0x46927a['query']);_0x149ac0[_0xfb07('0x33')]=_['intersection'](_0x46927a[_0xfb07('0x2f')],qs[_0xfb07('0x34')](_0x89f385[_0xfb07('0x30')][_0xfb07('0x34')]));_0x149ac0[_0xfb07('0x33')]=_0x149ac0[_0xfb07('0x33')]['length']?_0x149ac0['attributes']:_0x46927a[_0xfb07('0x2f')];if(!_0x89f385[_0xfb07('0x30')][_0xfb07('0x35')](_0xfb07('0x36'))){_0x149ac0['limit']=qs['limit'](_0x89f385[_0xfb07('0x30')][_0xfb07('0x37')]);_0x149ac0[_0xfb07('0x1e')]=qs[_0xfb07('0x1e')](_0x89f385[_0xfb07('0x30')][_0xfb07('0x1e')]);}_0x149ac0['order']=qs['sort'](_0x89f385['query'][_0xfb07('0x38')]);_0x149ac0[_0xfb07('0x39')]=qs[_0xfb07('0x32')](_[_0xfb07('0x3a')](_0x89f385['query'],_0x46927a['filters']));if(_0x89f385[_0xfb07('0x30')][_0xfb07('0x3b')]){_0x149ac0['where']=_['merge'](_0x149ac0['where'],{'$or':_[_0xfb07('0x2a')](_0x20f01a,function(_0x10cd8b){if(_0x10cd8b['type']!=='VIRTUAL'){var _0x3c0deb={};_0x3c0deb[_0x10cd8b[_0xfb07('0x28')]]={'$like':'%'+_0x89f385[_0xfb07('0x30')][_0xfb07('0x3b')]+'%'};return _0x3c0deb;}})});}_0x149ac0=_[_0xfb07('0x3c')]({},_0x149ac0,_0x89f385['options']);var _0x1644e8={'where':_0x149ac0[_0xfb07('0x39')]};return db[_0xfb07('0x2b')][_0xfb07('0x1d')](_0x1644e8)['then'](function(_0x4ab5dd){_0x2b0650[_0xfb07('0x1d')]=_0x4ab5dd;if(_0x89f385[_0xfb07('0x30')][_0xfb07('0x3d')]){_0x149ac0[_0xfb07('0x3e')]=[{'all':!![]}];}return db[_0xfb07('0x2b')][_0xfb07('0x3f')](_0x149ac0);})[_0xfb07('0x24')](function(_0x5a292d){_0x2b0650['rows']=_0x5a292d;return _0x2b0650;})[_0xfb07('0x24')](respondWithFilteredResult(_0xe813a7,_0x149ac0))[_0xfb07('0x40')](handleError(_0xe813a7,null));};exports['show']=function(_0x5df46c,_0x10a317){var _0x20d682={'raw':!![],'where':{'id':_0x5df46c['params']['id']}},_0x190268={};_0x190268['model']=_[_0xfb07('0x31')](db[_0xfb07('0x2b')][_0xfb07('0x2c')]);_0x190268[_0xfb07('0x30')]=_[_0xfb07('0x31')](_0x5df46c[_0xfb07('0x30')]);_0x190268[_0xfb07('0x32')]=_[_0xfb07('0x41')](_0x190268[_0xfb07('0x2f')],_0x190268['query']);_0x20d682[_0xfb07('0x33')]=_[_0xfb07('0x41')](_0x190268[_0xfb07('0x2f')],qs[_0xfb07('0x34')](_0x5df46c[_0xfb07('0x30')][_0xfb07('0x34')]));_0x20d682[_0xfb07('0x33')]=_0x20d682[_0xfb07('0x33')][_0xfb07('0x42')]?_0x20d682[_0xfb07('0x33')]:_0x190268['model'];if(_0x5df46c['query'][_0xfb07('0x3d')]){_0x20d682[_0xfb07('0x3e')]=[{'all':!![]}];}_0x20d682=_['merge']({},_0x20d682,_0x5df46c[_0xfb07('0x43')]);return db[_0xfb07('0x2b')][_0xfb07('0x44')](_0x20d682)[_0xfb07('0x24')](handleEntityNotFound(_0x10a317,null))[_0xfb07('0x24')](respondWithResult(_0x10a317,null))['catch'](handleError(_0x10a317,null));};exports['create']=function(_0x1a3458,_0x3e3ab5){return db[_0xfb07('0x2b')][_0xfb07('0x45')](_0x1a3458[_0xfb07('0x46')],{})[_0xfb07('0x24')](respondWithResult(_0x3e3ab5,0xc9))[_0xfb07('0x40')](handleError(_0x3e3ab5,null));};exports[_0xfb07('0x23')]=function(_0x186987,_0x28e66f){if(_0x186987['body']['id']){delete _0x186987['body']['id'];}return db['DeskField'][_0xfb07('0x44')]({'where':{'id':_0x186987['params']['id']}})[_0xfb07('0x24')](handleEntityNotFound(_0x28e66f,null))[_0xfb07('0x24')](saveUpdates(_0x186987[_0xfb07('0x46')],null))[_0xfb07('0x24')](respondWithResult(_0x28e66f,null))[_0xfb07('0x40')](handleError(_0x28e66f,null));};exports[_0xfb07('0x47')]=function(_0x4d464e,_0x3b2cce){return db[_0xfb07('0x2b')][_0xfb07('0x44')]({'where':{'id':_0x4d464e[_0xfb07('0x48')]['id']}})[_0xfb07('0x24')](handleEntityNotFound(_0x3b2cce,null))['then'](removeEntity(_0x3b2cce,null))[_0xfb07('0x40')](handleError(_0x3b2cce,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 0bc7cce..68231c0 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 _0x0ac8=['api','moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields','FieldId','util'];(function(_0x5c0a45,_0x4fe66d){var _0x76c83f=function(_0x23e9e6){while(--_0x23e9e6){_0x5c0a45['push'](_0x5c0a45['shift']());}};_0x76c83f(++_0x4fe66d);}(_0x0ac8,0xfb));var _0x80ac=function(_0x18bac5,_0x2e54fc){_0x18bac5=_0x18bac5-0x0;var _0xdc6c44=_0x0ac8[_0x18bac5];return _0xdc6c44;};'use strict';var _=require('lodash');var util=require(_0x80ac('0x0'));var logger=require('../../config/logger')(_0x80ac('0x1'));var moment=require(_0x80ac('0x2'));var BPromise=require(_0x80ac('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80ac('0x4'));var rimraf=require(_0x80ac('0x5'));var config=require(_0x80ac('0x6'));var attributes=require(_0x80ac('0x7'));module['exports']=function(_0x332aa2,_0x5d7f83){return _0x332aa2[_0x80ac('0x8')](_0x80ac('0x9'),attributes,{'tableName':_0x80ac('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0x80ac('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac15=['DeskField','int_desk_fields','desk_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0xac15,0x84));var _0x5ac1=function(_0x2f9bf0,_0x5051fb){_0x2f9bf0=_0x2f9bf0-0x0;var _0x285c09=_0xac15[_0x2f9bf0];return _0x285c09;};'use strict';var _=require('lodash');var util=require(_0x5ac1('0x0'));var logger=require(_0x5ac1('0x1'))(_0x5ac1('0x2'));var moment=require(_0x5ac1('0x3'));var BPromise=require(_0x5ac1('0x4'));var rp=require(_0x5ac1('0x5'));var fs=require('fs');var path=require(_0x5ac1('0x6'));var rimraf=require(_0x5ac1('0x7'));var config=require(_0x5ac1('0x8'));var attributes=require(_0x5ac1('0x9'));module[_0x5ac1('0xa')]=function(_0x3cdd58,_0x4bccdd){return _0x3cdd58[_0x5ac1('0xb')](_0x5ac1('0xc'),attributes,{'tableName':_0x5ac1('0xd'),'paranoid':![],'indexes':[{'name':_0x5ac1('0xe'),'fields':['idField',_0x5ac1('0xf')],'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 e84cb63..0374196 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 _0xcb31=['client','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4bbc00,_0x13de77){var _0x2f5fad=function(_0x4d01d8){while(--_0x4d01d8){_0x4bbc00['push'](_0x4bbc00['shift']());}};_0x2f5fad(++_0x13de77);}(_0xcb31,0x139));var _0x1cb3=function(_0x5d2a3e,_0x5ba125){_0x5d2a3e=_0x5d2a3e-0x0;var _0x32424e=_0xcb31[_0x5d2a3e];return _0x32424e;};'use strict';var _=require('lodash');var util=require(_0x1cb3('0x0'));var moment=require(_0x1cb3('0x1'));var BPromise=require(_0x1cb3('0x2'));var rs=require(_0x1cb3('0x3'));var fs=require('fs');var Redis=require(_0x1cb3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb3('0x5'));var logger=require('../../config/logger')(_0x1cb3('0x6'));var config=require(_0x1cb3('0x7'));var jayson=require(_0x1cb3('0x8'));var client=jayson[_0x1cb3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe9c825,_0x5ec297,_0x2ab2a6){return new BPromise(function(_0x19592c,_0x4f3ea5){return client[_0x1cb3('0xa')](_0xe9c825,_0x2ab2a6)[_0x1cb3('0xb')](function(_0x102fba){logger[_0x1cb3('0xc')](_0x1cb3('0xd'),_0x5ec297,_0x1cb3('0xe'));logger[_0x1cb3('0xf')](_0x1cb3('0x10'),_0x5ec297,_0x1cb3('0xe'),JSON[_0x1cb3('0x11')](_0x102fba));if(_0x102fba[_0x1cb3('0x12')]){if(_0x102fba[_0x1cb3('0x12')][_0x1cb3('0x13')]===0x1f4){logger[_0x1cb3('0x12')](_0x1cb3('0xd'),_0x5ec297,_0x102fba[_0x1cb3('0x12')][_0x1cb3('0x14')]);return _0x4f3ea5(_0x102fba[_0x1cb3('0x12')][_0x1cb3('0x14')]);}logger[_0x1cb3('0x12')]('DeskField,\x20%s,\x20%s',_0x5ec297,_0x102fba[_0x1cb3('0x12')][_0x1cb3('0x14')]);return _0x19592c(_0x102fba['error']['message']);}else{logger[_0x1cb3('0xc')](_0x1cb3('0xd'),_0x5ec297,'request\x20sent');_0x19592c(_0x102fba[_0x1cb3('0x15')][_0x1cb3('0x14')]);}})[_0x1cb3('0x16')](function(_0x359770){logger[_0x1cb3('0x12')]('DeskField,\x20%s,\x20%s',_0x5ec297,_0x359770);_0x4f3ea5(_0x359770);});});} \ No newline at end of file +var _0x4ca7=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x402ccc,_0x1ba3cc){var _0x342cf3=function(_0xb99ef9){while(--_0xb99ef9){_0x402ccc['push'](_0x402ccc['shift']());}};_0x342cf3(++_0x1ba3cc);}(_0x4ca7,0x1ba));var _0x74ca=function(_0x4b3c63,_0x7c566b){_0x4b3c63=_0x4b3c63-0x0;var _0x4bb6a7=_0x4ca7[_0x4b3c63];return _0x4bb6a7;};'use strict';var _=require(_0x74ca('0x0'));var util=require(_0x74ca('0x1'));var moment=require(_0x74ca('0x2'));var BPromise=require('bluebird');var rs=require(_0x74ca('0x3'));var fs=require('fs');var Redis=require(_0x74ca('0x4'));var db=require(_0x74ca('0x5'))['db'];var utils=require(_0x74ca('0x6'));var logger=require(_0x74ca('0x7'))(_0x74ca('0x8'));var config=require(_0x74ca('0x9'));var jayson=require(_0x74ca('0xa'));var client=jayson['client'][_0x74ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10edcb,_0x52b83c,_0x23aeef){return new BPromise(function(_0x37f21f,_0x4ae19f){return client[_0x74ca('0xc')](_0x10edcb,_0x23aeef)[_0x74ca('0xd')](function(_0x5e7026){logger['info'](_0x74ca('0xe'),_0x52b83c,_0x74ca('0xf'));logger[_0x74ca('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x52b83c,_0x74ca('0xf'),JSON[_0x74ca('0x11')](_0x5e7026));if(_0x5e7026['error']){if(_0x5e7026[_0x74ca('0x12')]['code']===0x1f4){logger[_0x74ca('0x12')](_0x74ca('0xe'),_0x52b83c,_0x5e7026[_0x74ca('0x12')][_0x74ca('0x13')]);return _0x4ae19f(_0x5e7026[_0x74ca('0x12')][_0x74ca('0x13')]);}logger[_0x74ca('0x12')](_0x74ca('0xe'),_0x52b83c,_0x5e7026['error'][_0x74ca('0x13')]);return _0x37f21f(_0x5e7026[_0x74ca('0x12')][_0x74ca('0x13')]);}else{logger['info'](_0x74ca('0xe'),_0x52b83c,_0x74ca('0xf'));_0x37f21f(_0x5e7026['result'][_0x74ca('0x13')]);}})[_0x74ca('0x14')](function(_0x4d3707){logger['error'](_0x74ca('0xe'),_0x52b83c,_0x4d3707);_0x4ae19f(_0x4d3707);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 239f13d..076f2cb 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 _0x9246=['util','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','delete','/:id','destroy','exports'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x9246,0xc6));var _0x6924=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x9246[_0x42bdad];return _0x122626;};'use strict';var multer=require('multer');var util=require(_0x6924('0x0'));var path=require('path');var timeout=require(_0x6924('0x1'));var express=require(_0x6924('0x2'));var router=express[_0x6924('0x3')]();var auth=require(_0x6924('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDynamics365Account.controller');router[_0x6924('0x5')]('/',auth[_0x6924('0x6')](),controller['index']);router[_0x6924('0x5')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6924('0x5')](_0x6924('0x7'),auth[_0x6924('0x6')](),controller[_0x6924('0x8')]);router['get']('/:id/fields',auth[_0x6924('0x6')](),controller[_0x6924('0x9')]);router[_0x6924('0xa')]('/',auth[_0x6924('0x6')](),controller[_0x6924('0xb')]);router[_0x6924('0xa')](_0x6924('0x7'),auth[_0x6924('0x6')](),controller[_0x6924('0xc')]);router[_0x6924('0xd')]('/:id',auth[_0x6924('0x6')](),controller['update']);router[_0x6924('0xe')](_0x6924('0xf'),auth[_0x6924('0x6')](),controller[_0x6924('0x10')]);module[_0x6924('0x11')]=router; \ No newline at end of file +var _0x6aaa=['/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations'];(function(_0x1b76a8,_0x4ec861){var _0x1c6904=function(_0x5a3670){while(--_0x5a3670){_0x1b76a8['push'](_0x1b76a8['shift']());}};_0x1c6904(++_0x4ec861);}(_0x6aaa,0x1bf));var _0xa6aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aaa[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa6aa('0x0'));var util=require(_0xa6aa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa6aa('0x2'));var router=express['Router']();var auth=require(_0xa6aa('0x3'));var interaction=require(_0xa6aa('0x4'));var config=require(_0xa6aa('0x5'));var controller=require(_0xa6aa('0x6'));router[_0xa6aa('0x7')]('/',auth[_0xa6aa('0x8')](),controller[_0xa6aa('0x9')]);router[_0xa6aa('0x7')](_0xa6aa('0xa'),auth[_0xa6aa('0x8')](),controller['show']);router[_0xa6aa('0x7')](_0xa6aa('0xb'),auth[_0xa6aa('0x8')](),controller[_0xa6aa('0xc')]);router['get'](_0xa6aa('0xd'),auth[_0xa6aa('0x8')](),controller[_0xa6aa('0xe')]);router['post']('/',auth[_0xa6aa('0x8')](),controller[_0xa6aa('0xf')]);router[_0xa6aa('0x10')](_0xa6aa('0xb'),auth[_0xa6aa('0x8')](),controller[_0xa6aa('0x11')]);router[_0xa6aa('0x12')](_0xa6aa('0xa'),auth[_0xa6aa('0x8')](),controller[_0xa6aa('0x13')]);router[_0xa6aa('0x14')]('/:id',auth[_0xa6aa('0x8')](),controller[_0xa6aa('0x15')]);module[_0xa6aa('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 bc0ad5d..8819efe 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 _0xf59c=['STRING','sequelize','exports'];(function(_0xc4cad,_0x18d8f9){var _0x400764=function(_0x3111da){while(--_0x3111da){_0xc4cad['push'](_0xc4cad['shift']());}};_0x400764(++_0x18d8f9);}(_0xf59c,0x13f));var _0xcf59=function(_0xe2dfc6,_0x502811){_0xe2dfc6=_0xe2dfc6-0x0;var _0x5b1b72=_0xf59c[_0xe2dfc6];return _0x5b1b72;};'use strict';var Sequelize=require(_0xcf59('0x0'));module[_0xcf59('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xcf59('0x2')]},'password':{'type':Sequelize[_0xcf59('0x2')]},'remoteUri':{'type':Sequelize[_0xcf59('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xcf59('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xcf59('0x2')]},'description':{'type':Sequelize[_0xcf59('0x2')]}}; \ No newline at end of file +var _0x10f1=['sequelize','exports','STRING'];(function(_0x40be1a,_0x13b843){var _0x4e6f36=function(_0x85771f){while(--_0x85771f){_0x40be1a['push'](_0x40be1a['shift']());}};_0x4e6f36(++_0x13b843);}(_0x10f1,0x6f));var _0x110f=function(_0x465f75,_0x4b9141){_0x465f75=_0x465f75-0x0;var _0x53f44a=_0x10f1[_0x465f75];return _0x53f44a;};'use strict';var Sequelize=require(_0x110f('0x0'));module[_0x110f('0x1')]={'name':{'type':Sequelize[_0x110f('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x110f('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x110f('0x2')]},'clientId':{'type':Sequelize[_0x110f('0x2')]},'clientSecret':{'type':Sequelize[_0x110f('0x2')]},'serverUrl':{'type':Sequelize[_0x110f('0x2')]},'description':{'type':Sequelize[_0x110f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 41cc3a2..0b3ccb3 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 _0x7732=['ticketType','incident','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statuscode','subjectidname','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','substring','format','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','Bearer\x20','4.0','value','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','MetadataId','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','stack',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','limit','set','apply','reject','save','update','destroy','end','sendStatus','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','nolimit','order','sort','filters','pick','filter','merge','where','options','includeAll','params','length','include','create','body','find','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','Dynamics365Field','getFields'];(function(_0x1a3a24,_0x1d58dd){var _0x56185a=function(_0x2202f2){while(--_0x2202f2){_0x1a3a24['push'](_0x1a3a24['shift']());}};_0x56185a(++_0x1d58dd);}(_0x7732,0x7d));var _0x2773=function(_0x5b36bd,_0x4dfb36){_0x5b36bd=_0x5b36bd-0x0;var _0x1614fe=_0x7732[_0x5b36bd];return _0x1614fe;};'use strict';var pdf=require(_0x2773('0x0'));var emlformat=require(_0x2773('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2773('0x2'));var jsonpatch=require(_0x2773('0x3'));var rp=require(_0x2773('0x4'));var moment=require(_0x2773('0x5'));var BPromise=require(_0x2773('0x6'));var Mustache=require(_0x2773('0x7'));var util=require(_0x2773('0x8'));var path=require(_0x2773('0x9'));var sox=require('sox');var csv=require(_0x2773('0xa'));var ejs=require(_0x2773('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2773('0xc'));var crypto=require(_0x2773('0xd'));var jsforce=require(_0x2773('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2773('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2773('0xf'));var qs=require(_0x2773('0x10'));var as=require(_0x2773('0x11'));var hardwareService=require(_0x2773('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2773('0x13'));var config=require(_0x2773('0x14'));var db=require(_0x2773('0x15'))['db'];var integrations=require(_0x2773('0x16'));var jayson=require('jayson/promise');var client=jayson[_0x2773('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x5df6af,_0x157f4f,_0x2c34d1){if(_0x2c34d1){var _0x13f322=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x13f322[_0x2773('0x18')](_0x157f4f)){return _0x5df6af;}else{throw new db[(_0x2773('0x19'))][(_0x2773('0x1a'))](_0x2773('0x1b'));}}else{return _0x5df6af;}}function respondWithRpcPromise(_0x84a0d9,_0x2889b6,_0x421c9b,_0x26ce19){return new BPromise(function(_0x25d884,_0x238c9a){var _0x50fefe=_0x26ce19||client;return _0x50fefe['request'](_0x84a0d9,_0x421c9b)[_0x2773('0x1c')](function(_0x10c79f){logger['info'](_0x2773('0x1d'),_0x2889b6,_0x2773('0x1e'));logger[_0x2773('0x1f')](_0x2773('0x20'),_0x2889b6,_0x2773('0x1e'),JSON[_0x2773('0x21')](_0x10c79f));if(_0x10c79f[_0x2773('0x22')]){if(_0x10c79f['error'][_0x2773('0x23')]===0x1f4){logger[_0x2773('0x22')](_0x2773('0x1d'),_0x2889b6,_0x10c79f[_0x2773('0x22')][_0x2773('0x24')]);return _0x238c9a(_0x10c79f['error'][_0x2773('0x24')]);}logger[_0x2773('0x22')](_0x2773('0x1d'),_0x2889b6,_0x10c79f['error'][_0x2773('0x24')]);return _0x25d884(_0x10c79f[_0x2773('0x22')][_0x2773('0x24')]);}else{logger['info'](_0x2773('0x1d'),_0x2889b6,'request\x20sent');_0x25d884(_0x10c79f[_0x2773('0x25')][_0x2773('0x24')]);}})[_0x2773('0x26')](function(_0x49b537){logger[_0x2773('0x22')]('Dynamics365Account,\x20%s,\x20%s',_0x2889b6,_0x49b537);_0x238c9a(_0x49b537);});});}function respondWithStatusCode(_0x5c3337,_0x3000c1){_0x3000c1=_0x3000c1||0xcc;return function(_0x3d3283){if(_0x3d3283){return _0x5c3337['sendStatus'](_0x3000c1);}return _0x5c3337[_0x2773('0x27')](_0x3000c1)['end']();};}function respondWithResult(_0x274f9f,_0x478da4){_0x478da4=_0x478da4||0xc8;return function(_0x3aa282){if(_0x3aa282){return _0x274f9f[_0x2773('0x27')](_0x478da4)[_0x2773('0x28')](_0x3aa282);}};}function respondWithFilteredResult(_0x2cf303,_0x21ad6b){return function(_0xe02608){if(_0xe02608){var _0x596935=_0xe02608[_0x2773('0x29')],_0x5499a7=_0x21ad6b[_0x2773('0x2a')],_0x49d035=_0x21ad6b['offset']+_0x21ad6b[_0x2773('0x2b')],_0x4b99f5;if(_0x49d035>=_0x596935){_0x49d035=_0x596935;_0x4b99f5=0xc8;}else{_0x4b99f5=0xce;}_0x2cf303[_0x2773('0x27')](_0x4b99f5);return _0x2cf303[_0x2773('0x2c')]('Content-Range',_0x5499a7+'-'+_0x49d035+'/'+_0x596935)[_0x2773('0x28')](_0xe02608);}return null;};}function patchUpdates(_0x5a91f1){return function(_0x40f879){try{jsonpatch[_0x2773('0x2d')](_0x40f879,_0x5a91f1,!![]);}catch(_0x5c8427){return BPromise[_0x2773('0x2e')](_0x5c8427);}return _0x40f879[_0x2773('0x2f')]();};}function saveUpdates(_0x1d75c4,_0x26a035){return function(_0xe2a092){if(_0xe2a092){return _0xe2a092[_0x2773('0x30')](_0x1d75c4)[_0x2773('0x1c')](function(_0x48d172){return _0x48d172;});}return null;};}function removeEntity(_0x55eed4,_0x2649d8){return function(_0x165c0e){if(_0x165c0e){return _0x165c0e[_0x2773('0x31')]()['then'](function(){_0x55eed4[_0x2773('0x27')](0xcc)[_0x2773('0x32')]();});}};}function handleEntityNotFound(_0x43136d,_0x2c50e9){return function(_0x26d089){if(!_0x26d089){_0x43136d[_0x2773('0x33')](0x194);}return _0x26d089;};}function handleError(_0x104d1f,_0x5f0be4){_0x5f0be4=_0x5f0be4||0x1f4;return function(_0x351bd9){logger[_0x2773('0x22')](_0x351bd9['stack']);if(_0x351bd9[_0x2773('0x34')]){delete _0x351bd9['name'];}_0x104d1f[_0x2773('0x27')](_0x5f0be4)[_0x2773('0x35')](_0x351bd9);};}exports[_0x2773('0x36')]=function(_0x3f6023,_0x5a9051){var _0x40ad6e={},_0x2f13f7={},_0x226dac={'count':0x0,'rows':[]};var _0x1cfe56=_[_0x2773('0x37')](db[_0x2773('0x38')][_0x2773('0x39')],function(_0x105e8){return{'name':_0x105e8[_0x2773('0x3a')],'type':_0x105e8[_0x2773('0x3b')][_0x2773('0x3c')]};});_0x2f13f7['model']=_['map'](_0x1cfe56,'name');_0x2f13f7[_0x2773('0x3d')]=_[_0x2773('0x3e')](_0x3f6023[_0x2773('0x3d')]);_0x2f13f7['filters']=_[_0x2773('0x3f')](_0x2f13f7[_0x2773('0x40')],_0x2f13f7[_0x2773('0x3d')]);_0x40ad6e[_0x2773('0x41')]=_[_0x2773('0x3f')](_0x2f13f7[_0x2773('0x40')],qs[_0x2773('0x42')](_0x3f6023[_0x2773('0x3d')][_0x2773('0x42')]));_0x40ad6e[_0x2773('0x41')]=_0x40ad6e[_0x2773('0x41')]['length']?_0x40ad6e[_0x2773('0x41')]:_0x2f13f7[_0x2773('0x40')];if(!_0x3f6023[_0x2773('0x3d')]['hasOwnProperty'](_0x2773('0x43'))){_0x40ad6e['limit']=qs[_0x2773('0x2b')](_0x3f6023[_0x2773('0x3d')][_0x2773('0x2b')]);_0x40ad6e[_0x2773('0x2a')]=qs[_0x2773('0x2a')](_0x3f6023[_0x2773('0x3d')][_0x2773('0x2a')]);}_0x40ad6e[_0x2773('0x44')]=qs[_0x2773('0x45')](_0x3f6023[_0x2773('0x3d')][_0x2773('0x45')]);_0x40ad6e['where']=qs[_0x2773('0x46')](_[_0x2773('0x47')](_0x3f6023[_0x2773('0x3d')],_0x2f13f7[_0x2773('0x46')]));if(_0x3f6023[_0x2773('0x3d')][_0x2773('0x48')]){_0x40ad6e['where']=_[_0x2773('0x49')](_0x40ad6e[_0x2773('0x4a')],{'$or':_[_0x2773('0x37')](_0x1cfe56,function(_0x18c39d){if(_0x18c39d[_0x2773('0x3b')]!=='VIRTUAL'){var _0x3dfb44={};_0x3dfb44[_0x18c39d[_0x2773('0x34')]]={'$like':'%'+_0x3f6023[_0x2773('0x3d')][_0x2773('0x48')]+'%'};return _0x3dfb44;}})});}_0x40ad6e=_[_0x2773('0x49')]({},_0x40ad6e,_0x3f6023[_0x2773('0x4b')]);var _0x1111a9={'where':_0x40ad6e[_0x2773('0x4a')]};return db['Dynamics365Account'][_0x2773('0x29')](_0x1111a9)['then'](function(_0x2e7299){_0x226dac[_0x2773('0x29')]=_0x2e7299;if(_0x3f6023[_0x2773('0x3d')][_0x2773('0x4c')]){_0x40ad6e['include']=[{'all':!![]}];}return db[_0x2773('0x38')]['findAll'](_0x40ad6e);})[_0x2773('0x1c')](function(_0x71eb83){_0x226dac['rows']=_0x71eb83;return _0x226dac;})[_0x2773('0x1c')](respondWithFilteredResult(_0x5a9051,_0x40ad6e))[_0x2773('0x26')](handleError(_0x5a9051,null));};exports['show']=function(_0x40f0a3,_0x40a72b){var _0x2ba916={'raw':![],'where':{'id':_0x40f0a3[_0x2773('0x4d')]['id']}},_0x41fdd8={};_0x41fdd8['model']=_[_0x2773('0x3e')](db[_0x2773('0x38')][_0x2773('0x39')]);_0x41fdd8[_0x2773('0x3d')]=_[_0x2773('0x3e')](_0x40f0a3[_0x2773('0x3d')]);_0x41fdd8[_0x2773('0x46')]=_[_0x2773('0x3f')](_0x41fdd8[_0x2773('0x40')],_0x41fdd8[_0x2773('0x3d')]);_0x2ba916[_0x2773('0x41')]=_[_0x2773('0x3f')](_0x41fdd8['model'],qs[_0x2773('0x42')](_0x40f0a3[_0x2773('0x3d')][_0x2773('0x42')]));_0x2ba916[_0x2773('0x41')]=_0x2ba916[_0x2773('0x41')][_0x2773('0x4e')]?_0x2ba916[_0x2773('0x41')]:_0x41fdd8[_0x2773('0x40')];if(_0x40f0a3[_0x2773('0x3d')][_0x2773('0x4c')]){_0x2ba916[_0x2773('0x4f')]=[{'all':!![]}];}_0x2ba916=_[_0x2773('0x49')]({},_0x2ba916,_0x40f0a3[_0x2773('0x4b')]);return db[_0x2773('0x38')]['find'](_0x2ba916)[_0x2773('0x1c')](handleEntityNotFound(_0x40a72b,null))['then'](respondWithResult(_0x40a72b,null))[_0x2773('0x26')](handleError(_0x40a72b,null));};exports['create']=function(_0x1e1e59,_0x5281b8){return db[_0x2773('0x38')][_0x2773('0x50')](_0x1e1e59['body'],{})[_0x2773('0x1c')](respondWithResult(_0x5281b8,0xc9))[_0x2773('0x26')](handleError(_0x5281b8,null));};exports['update']=function(_0x3d8c2d,_0x5e4da9){if(_0x3d8c2d[_0x2773('0x51')]['id']){delete _0x3d8c2d['body']['id'];}return db[_0x2773('0x38')][_0x2773('0x52')]({'where':{'id':_0x3d8c2d[_0x2773('0x4d')]['id']}})[_0x2773('0x1c')](handleEntityNotFound(_0x5e4da9,null))['then'](saveUpdates(_0x3d8c2d[_0x2773('0x51')],null))[_0x2773('0x1c')](respondWithResult(_0x5e4da9,null))[_0x2773('0x26')](handleError(_0x5e4da9,null));};exports[_0x2773('0x31')]=function(_0xacc18f,_0x326fe3){return db['Dynamics365Account'][_0x2773('0x52')]({'where':{'id':_0xacc18f[_0x2773('0x4d')]['id']}})[_0x2773('0x1c')](handleEntityNotFound(_0x326fe3,null))['then'](removeEntity(_0x326fe3,null))[_0x2773('0x26')](handleError(_0x326fe3,null));};exports[_0x2773('0x53')]=function(_0x57a0d0,_0x8c8c85,_0x59a12d){var _0x3c8bdd={};var _0x13d929={};var _0x5855a7;var _0x36fd19;return db[_0x2773('0x38')][_0x2773('0x54')]({'where':{'id':_0x57a0d0[_0x2773('0x4d')]['id']}})[_0x2773('0x1c')](handleEntityNotFound(_0x8c8c85,null))['then'](function(_0x2bfcfa){if(_0x2bfcfa){_0x5855a7=_0x2bfcfa;_0x13d929[_0x2773('0x40')]=_['keys'](db[_0x2773('0x55')][_0x2773('0x39')]);_0x13d929[_0x2773('0x3d')]=_['keys'](_0x57a0d0[_0x2773('0x3d')]);_0x13d929['filters']=_[_0x2773('0x3f')](_0x13d929[_0x2773('0x40')],_0x13d929[_0x2773('0x3d')]);_0x3c8bdd['attributes']=_['intersection'](_0x13d929[_0x2773('0x40')],qs[_0x2773('0x42')](_0x57a0d0['query'][_0x2773('0x42')]));_0x3c8bdd[_0x2773('0x41')]=_0x3c8bdd['attributes']['length']?_0x3c8bdd['attributes']:_0x13d929[_0x2773('0x40')];_0x3c8bdd[_0x2773('0x44')]=qs['sort'](_0x57a0d0['query'][_0x2773('0x45')]);_0x3c8bdd[_0x2773('0x4a')]=qs[_0x2773('0x46')](_[_0x2773('0x47')](_0x57a0d0[_0x2773('0x3d')],_0x13d929[_0x2773('0x46')]));if(_0x57a0d0['query'][_0x2773('0x48')]){_0x3c8bdd[_0x2773('0x4a')]=_['merge'](_0x3c8bdd[_0x2773('0x4a')],{'$or':_['map'](_0x3c8bdd['attributes'],function(_0x5333a5){var _0x176776={};_0x176776[_0x5333a5]={'$like':'%'+_0x57a0d0[_0x2773('0x3d')][_0x2773('0x48')]+'%'};return _0x176776;})});}_0x3c8bdd=_[_0x2773('0x49')]({},_0x3c8bdd,_0x57a0d0[_0x2773('0x4b')]);return _0x5855a7[_0x2773('0x53')](_0x3c8bdd);}})[_0x2773('0x1c')](function(_0x3165fc){if(_0x3165fc){_0x36fd19=_0x3165fc[_0x2773('0x4e')];if(!_0x57a0d0[_0x2773('0x3d')][_0x2773('0x56')]('nolimit')){_0x3c8bdd['limit']=qs[_0x2773('0x2b')](_0x57a0d0['query'][_0x2773('0x2b')]);_0x3c8bdd[_0x2773('0x2a')]=qs[_0x2773('0x2a')](_0x57a0d0[_0x2773('0x3d')][_0x2773('0x2a')]);}return _0x5855a7[_0x2773('0x53')](_0x3c8bdd);}})[_0x2773('0x1c')](function(_0x512d16){if(_0x512d16){return _0x512d16?{'count':_0x36fd19,'rows':_0x512d16}:null;}})[_0x2773('0x1c')](respondWithResult(_0x8c8c85,null))[_0x2773('0x26')](handleError(_0x8c8c85,null));};exports[_0x2773('0x57')]=function(_0x3a2648,_0x1e374e,_0x19072e){if(_0x3a2648[_0x2773('0x51')]['id']){delete _0x3a2648['body']['id'];}return db[_0x2773('0x38')]['findOne']({'where':{'id':_0x3a2648[_0x2773('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1e374e,null))['then'](function(_0x469099){if(_0x469099){_0x3a2648[_0x2773('0x51')][_0x2773('0x58')]=_0x469099['id'];_0x3a2648['body'][_0x2773('0x59')]=integrations['getSubjects'](_0x3a2648[_0x2773('0x51')]['channel'],_0x3a2648[_0x2773('0x51')][_0x2773('0x3b')]);_0x3a2648['body'][_0x2773('0x5a')]=integrations[_0x2773('0x5b')](_0x3a2648[_0x2773('0x51')]['channel'],_0x3a2648[_0x2773('0x51')]['type']);return db[_0x2773('0x55')]['create'](_0x3a2648[_0x2773('0x51')],{'include':[{'model':db[_0x2773('0x5c')],'as':'Subjects'},{'model':db[_0x2773('0x5c')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1e374e,null))[_0x2773('0x26')](handleError(_0x1e374e,null));};exports[_0x2773('0x5d')]=function(_0x1ef797,_0x16dcf7,_0x29e361){var _0x1c700c=_0x1ef797['query'][_0x2773('0x5e')];var _0x443550=_0x1c700c===_0x2773('0x5f')?_0x2773('0x60'):_0x2773('0x61');var _0x1901f9='';var _0x45ad68='';var _0x38764f='';var _0x1582af='';var _0x268d9a='';var _0x4812d5='';var _0x40f1d3='';var _0xdff114='';var _0xd89d77=['title',_0x2773('0x62'),_0x2773('0x63'),_0x2773('0x64'),_0x2773('0x65'),_0x2773('0x66'),_0x2773('0x67'),_0x2773('0x68'),'directioncode','phonecall_activity_parties'];var _0x56a895=[_0x2773('0x69'),'accountidyominame',_0x2773('0x6a'),_0x2773('0x6b'),_0x2773('0x6c'),_0x2773('0x6d'),_0x2773('0x6e'),_0x2773('0x6f'),'createdbyexternalpartyname',_0x2773('0x70'),_0x2773('0x71'),_0x2773('0x72'),'createdon',_0x2773('0x73'),_0x2773('0x74'),_0x2773('0x75'),_0x2773('0x76'),_0x2773('0x77'),_0x2773('0x78'),_0x2773('0x79'),_0x2773('0x7a'),_0x2773('0x7b'),_0x2773('0x7c'),_0x2773('0x7d'),'firstresponsebykpiidname','followupby',_0x2773('0x7e'),_0x2773('0x7f'),_0x2773('0x80'),_0x2773('0x81'),_0x2773('0x82'),_0x2773('0x83'),_0x2773('0x84'),_0x2773('0x85'),_0x2773('0x86'),_0x2773('0x87'),_0x2773('0x88'),_0x2773('0x89'),'msdyn_incidenttypename',_0x2773('0x8a'),_0x2773('0x8b'),_0x2773('0x8c'),_0x2773('0x8d'),_0x2773('0x8e'),_0x2773('0x8f'),_0x2773('0x90'),_0x2773('0x91'),_0x2773('0x92'),_0x2773('0x93'),'prioritycodename',_0x2773('0x94'),'productserialnumber',_0x2773('0x95'),_0x2773('0x96'),_0x2773('0x97'),_0x2773('0x98'),_0x2773('0x99'),_0x2773('0x9a'),_0x2773('0x9b'),_0x2773('0x9c'),'socialprofileidname','statecode',_0x2773('0x9d'),_0x2773('0x9e'),'ticketnumber',_0x2773('0x9f'),'transactioncurrencyidname',_0x2773('0xa0'),_0x2773('0xa1'),_0x2773('0xa2')];var _0x2b89c7=_0xd89d77[_0x2773('0xa3')](_0x56a895);return db[_0x2773('0x38')][_0x2773('0x54')]({'where':{'id':_0x1ef797['params']['id']},'attributes':['id',_0x2773('0xa4'),_0x2773('0xa5'),_0x2773('0xa6'),_0x2773('0xa7'),_0x2773('0xa8'),_0x2773('0xa9')]})[_0x2773('0x1c')](handleEntityNotFound(_0x16dcf7,null))[_0x2773('0x1c')](function(_0x177403){if(_0x177403){_0xdff114=_0x177403['remoteUri'];var _0x55c96e=_0xdff114['slice'](-0x1);if(_0x55c96e==='/'){_0xdff114=_0xdff114[_0x2773('0xaa')](0x0,_0xdff114['lastIndexOf'](_0x55c96e));}_0x40f1d3=util[_0x2773('0xab')]('%s/api/data/v9.0/',_0xdff114);var _0x5f1085={'method':_0x2773('0xac'),'uri':_0x2773('0xad')+_0x177403[_0x2773('0xa7')]+_0x2773('0xae'),'form':{'client_id':_0x177403[_0x2773('0xa8')],'resource':_0xdff114,'username':_0x177403[_0x2773('0xa4')],'password':_0x177403[_0x2773('0xa5')],'grant_type':_0x2773('0xa5'),'client_secret':_0x177403[_0x2773('0xa9')]},'json':!![]};return rp(_0x5f1085);}})[_0x2773('0x1c')](function(_0x559a50){_0x4812d5=_0x559a50[_0x2773('0xaf')];var _0x3cf49f={'method':'GET','uri':encodeURI(_0x40f1d3+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x443550+'\x27'),'headers':{'Authorization':_0x2773('0xb0')+_0x4812d5,'If-None-Match':null,'OData-Version':_0x2773('0xb1')},'json':!![]};return rp(_0x3cf49f);})[_0x2773('0x1c')](function(_0x318a30){var _0x2f2ddb=_0x318a30[_0x2773('0xb2')][0x0];var _0x36d317=_0x2f2ddb['MetadataId'];var _0x210da0={'method':_0x2773('0xb3'),'uri':_0x40f1d3+_0x2773('0xb4')+_0x36d317+_0x2773('0xb5'),'headers':{'Authorization':_0x2773('0xb0')+_0x4812d5,'If-None-Match':null,'OData-Version':_0x2773('0xb1')},'json':!![]};return rp(_0x210da0);})[_0x2773('0x1c')](function(_0x56003e){_0x1901f9=_0x56003e;_0x45ad68=_0x1901f9['Attributes'];_0x45ad68=_[_0x2773('0xb6')](_0x45ad68,function(_0x2c209d){return!_0x2b89c7[_0x2773('0xb7')](_0x2c209d[_0x2773('0xb8')]);});var _0x4b06cb=[];var _0x51e073=[];_0x45ad68[_0x2773('0xb9')](function(_0x446fc7){if(_0x446fc7[_0x2773('0xba')]){var _0x4cb758=_0x446fc7[_0x2773('0xba')][_0x2773('0xaa')](_0x446fc7[_0x2773('0xba')][_0x2773('0xbb')]('.')+0x1);if(_0x4cb758===_0x2773('0xbc')){_0x4b06cb[_0x2773('0xbd')](getSelectList(_0x40f1d3,_0x1c700c,_0x51e073,_0x1901f9['MetadataId'],_0x446fc7['MetadataId'],_0x4812d5));}}});return Promise['all'](_0x4b06cb);})[_0x2773('0x1c')](function(_0x22dd4d){_0x38764f=_0x22dd4d[0x0];var _0x440173=[];var _0x59a5d7=[];_0x45ad68[_0x2773('0xb9')](function(_0x315b80){if(!_[_0x2773('0xbe')](_0x315b80[_0x2773('0xba')])){var _0x1861ab=_0x315b80[_0x2773('0xba')]['substring'](_0x315b80[_0x2773('0xba')]['lastIndexOf']('.')+0x1);if(_0x1861ab===_0x2773('0xbf')){_0x440173[_0x2773('0xbd')](getBooleanList(_0x40f1d3,_0x1c700c,_0x59a5d7,_0x1901f9[_0x2773('0xc0')],_0x315b80['MetadataId'],_0x4812d5));}}});return Promise[_0x2773('0xc1')](_0x440173);})[_0x2773('0x1c')](function(_0x203ae7){_0x1582af=_0x203ae7[0x0];var _0x5f01f7=[];var _0x40c40b=[];_0x45ad68[_0x2773('0xb9')](function(_0x13232f){if(_0x13232f[_0x2773('0xba')]){var _0x210e41=_0x13232f[_0x2773('0xba')][_0x2773('0xaa')](_0x13232f[_0x2773('0xba')]['lastIndexOf']('.')+0x1);if(_0x210e41===_0x2773('0xc2')||_0x210e41===_0x2773('0xc3')||_0x210e41===_0x2773('0xc4')||_0x210e41===_0x2773('0xc5')||_0x210e41===_0x2773('0xc6')||_0x210e41===_0x2773('0xc7')||_0x210e41===_0x2773('0xc8')||_0x210e41===_0x2773('0xc9')||_0x210e41===_0x2773('0xca')||_0x210e41===_0x2773('0xcb')){_0x5f01f7[_0x2773('0xbd')](getInputList(_0x40f1d3,_0x1c700c,_0x210e41,_0x40c40b,_0x1901f9[_0x2773('0xc0')],_0x13232f['MetadataId'],_0x4812d5));}}});return Promise[_0x2773('0xc1')](_0x5f01f7);})['then'](function(_0xc25eea){_0x268d9a=_0xc25eea[0x0];var _0x5d741b=_0x38764f['concat'](_0x1582af)[_0x2773('0xa3')](_0x268d9a);var _0x1cbfe5={'count':_0x5d741b['length'],'rows':_0x5d741b};return _0x1cbfe5;})['then'](respondWithResult(_0x16dcf7,null))['catch'](function(_0x25bc05){var _0x38ca94=_0x1ef797[_0x2773('0x3d')]['test']?0x1f4:_0x25bc05[_0x2773('0xcc')]||0x1f4;logger[_0x2773('0x22')](_0x25bc05[_0x2773('0xcd')]);delete _0x25bc05[_0x2773('0x34')];if(_0x38ca94===0x191){_0x38ca94=0x190;}_0x16dcf7[_0x2773('0x27')](_0x38ca94)[_0x2773('0x35')](_0x1ef797['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x25bc05[_0x2773('0xcc')]}:_0x25bc05);});};function getSelectList(_0x2312a7,_0x1bc399,_0x70efa,_0x3703eb,_0x1e5a7d,_0x23798d){var _0x12a6ce={'method':_0x2773('0xb3'),'uri':_0x2312a7+'EntityDefinitions('+_0x3703eb+')/Attributes('+_0x1e5a7d+_0x2773('0xce')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x23798d,'If-None-Match':null,'OData-Version':_0x2773('0xb1')},'json':!![]};return rp(_0x12a6ce)['then'](function(_0x199077){var _0x32cffd=[];var _0x2f71dd=_0x199077[_0x2773('0xcf')][_0x2773('0xd0')];_0x2f71dd['forEach'](function(_0xf0d687){_0x32cffd[_0x2773('0xbd')]({'name':_0xf0d687[_0x2773('0xd1')][_0x2773('0xd2')][_0x2773('0xd1')],'value':String(_0xf0d687['Value'])});});var _0xc30582={'id':_0x1bc399+'_'+_0x199077[_0x2773('0xb8')],'name':_0x199077['DisplayName'][_0x2773('0xd2')][_0x2773('0xd1')],'custom':![],'options':_0x32cffd};_0x70efa[_0x2773('0xbd')](_0xc30582);return _0x70efa;});}function getBooleanList(_0x2f2f4b,_0x220aa3,_0x4984f4,_0x1bc668,_0x16948e,_0x424959){var _0x1322ef={'method':_0x2773('0xb3'),'uri':_0x2f2f4b+_0x2773('0xb4')+_0x1bc668+_0x2773('0xd3')+_0x16948e+_0x2773('0xd4'),'headers':{'Authorization':_0x2773('0xb0')+_0x424959,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1322ef)[_0x2773('0x1c')](function(_0x7830c1){var _0x46c743=[];_0x46c743[_0x2773('0xbd')]({'name':_0x7830c1[_0x2773('0xcf')][_0x2773('0xd5')]['Label']['UserLocalizedLabel'][_0x2773('0xd1')],'value':_0x2773('0xd6')},{'name':_0x7830c1[_0x2773('0xcf')]['FalseOption'][_0x2773('0xd1')]['UserLocalizedLabel'][_0x2773('0xd1')],'value':_0x2773('0xd7')});var _0x10bb60={'id':_0x220aa3+'_'+_0x7830c1[_0x2773('0xb8')],'name':_0x7830c1['DisplayName'][_0x2773('0xd2')][_0x2773('0xd1')],'custom':![],'options':_0x46c743};_0x4984f4[_0x2773('0xbd')](_0x10bb60);return _0x4984f4;});}function getInputList(_0x5e5fe1,_0x1cdb16,_0x27954e,_0x5298c6,_0x316494,_0x1234a1,_0xe03b26){var _0xb3e0db={'method':_0x2773('0xb3'),'uri':_0x5e5fe1+'EntityDefinitions('+_0x316494+_0x2773('0xd3')+_0x1234a1+_0x2773('0xd8')+_0x27954e+_0x2773('0xd9'),'headers':{'Authorization':'Bearer\x20'+_0xe03b26,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xb3e0db)[_0x2773('0x1c')](function(_0x5c2e3f){var _0x283eff={'id':_0x1cdb16+'_'+_0x5c2e3f['LogicalName'],'name':_0x5c2e3f[_0x2773('0xda')][_0x2773('0xd2')]?_0x5c2e3f[_0x2773('0xda')][_0x2773('0xd2')][_0x2773('0xd1')]:_0x5c2e3f[_0x2773('0xb8')],'custom':![],'options':[]};_0x5298c6[_0x2773('0xbd')](_0x283eff);return _0x5298c6;});} \ No newline at end of file +var _0x3423=['Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','destroy','stack','name','send','index','Dynamics365Account','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','findOne','getConfigurations','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','customerid','caseorigincode','subject','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','escalatedon','followupby','importsequencenumber','kbarticleidname','masteridname','modifiedbyname','modifiedbyyominame','modifiedon','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','parentcaseidname','primarycontactidname','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','username','remoteUri','tenantId','clientSecret','slice','substring','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','password','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','forEach','@odata.type','push','all','isNil','lastIndexOf','BooleanAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','concat','statusCode','Wrong\x20credentials','GET',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Value','LogicalName','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','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','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','request','then','info'];(function(_0x423ae5,_0x587052){var _0x2bcf22=function(_0x36a47b){while(--_0x36a47b){_0x423ae5['push'](_0x423ae5['shift']());}};_0x2bcf22(++_0x587052);}(_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 db=require(_0x3342('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x3342('0x16'));var client=jayson[_0x3342('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x3e418d,_0x334f0e,_0x38e3f7){if(_0x38e3f7){var _0xe4689e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe4689e[_0x3342('0x18')](_0x334f0e)){return _0x3e418d;}else{throw new db[(_0x3342('0x19'))][(_0x3342('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3e418d;}}function respondWithRpcPromise(_0x3e44f3,_0x19bd71,_0x49afe3,_0x40d609){return new BPromise(function(_0x2c9df0,_0x51ef91){var _0x554f9c=_0x40d609||client;return _0x554f9c[_0x3342('0x1b')](_0x3e44f3,_0x49afe3)[_0x3342('0x1c')](function(_0x6949fc){logger[_0x3342('0x1d')](_0x3342('0x1e'),_0x19bd71,_0x3342('0x1f'));logger[_0x3342('0x20')](_0x3342('0x21'),_0x19bd71,_0x3342('0x1f'),JSON['stringify'](_0x6949fc));if(_0x6949fc[_0x3342('0x22')]){if(_0x6949fc[_0x3342('0x22')][_0x3342('0x23')]===0x1f4){logger['error'](_0x3342('0x1e'),_0x19bd71,_0x6949fc[_0x3342('0x22')]['message']);return _0x51ef91(_0x6949fc[_0x3342('0x22')][_0x3342('0x24')]);}logger['error'](_0x3342('0x1e'),_0x19bd71,_0x6949fc['error'][_0x3342('0x24')]);return _0x2c9df0(_0x6949fc[_0x3342('0x22')][_0x3342('0x24')]);}else{logger[_0x3342('0x1d')](_0x3342('0x1e'),_0x19bd71,_0x3342('0x1f'));_0x2c9df0(_0x6949fc[_0x3342('0x25')][_0x3342('0x24')]);}})['catch'](function(_0x30ffc9){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x19bd71,_0x30ffc9);_0x51ef91(_0x30ffc9);});});}function respondWithStatusCode(_0x986ab0,_0x52ba65){_0x52ba65=_0x52ba65||0xcc;return function(_0x5d2f0b){if(_0x5d2f0b){return _0x986ab0[_0x3342('0x26')](_0x52ba65);}return _0x986ab0['status'](_0x52ba65)[_0x3342('0x27')]();};}function respondWithResult(_0x543ec3,_0x524286){_0x524286=_0x524286||0xc8;return function(_0x55cddd){if(_0x55cddd){return _0x543ec3[_0x3342('0x28')](_0x524286)[_0x3342('0x29')](_0x55cddd);}};}function respondWithFilteredResult(_0x1dd607,_0x5eef2b){return function(_0xc275a1){if(_0xc275a1){var _0x1275e2=_0xc275a1[_0x3342('0x2a')],_0x1cc542=_0x5eef2b[_0x3342('0x2b')],_0x272a52=_0x5eef2b[_0x3342('0x2b')]+_0x5eef2b[_0x3342('0x2c')],_0x4fbfb7;if(_0x272a52>=_0x1275e2){_0x272a52=_0x1275e2;_0x4fbfb7=0xc8;}else{_0x4fbfb7=0xce;}_0x1dd607[_0x3342('0x28')](_0x4fbfb7);return _0x1dd607[_0x3342('0x2d')](_0x3342('0x2e'),_0x1cc542+'-'+_0x272a52+'/'+_0x1275e2)['json'](_0xc275a1);}return null;};}function patchUpdates(_0x2e0bde){return function(_0x4dafa3){try{jsonpatch[_0x3342('0x2f')](_0x4dafa3,_0x2e0bde,!![]);}catch(_0x407f8c){return BPromise['reject'](_0x407f8c);}return _0x4dafa3[_0x3342('0x30')]();};}function saveUpdates(_0x1cc42d,_0x347d52){return function(_0x4e7410){if(_0x4e7410){return _0x4e7410['update'](_0x1cc42d)[_0x3342('0x1c')](function(_0x246944){return _0x246944;});}return null;};}function removeEntity(_0x311cfe,_0x948535){return function(_0x3156b5){if(_0x3156b5){return _0x3156b5[_0x3342('0x31')]()[_0x3342('0x1c')](function(){_0x311cfe[_0x3342('0x28')](0xcc)[_0x3342('0x27')]();});}};}function handleEntityNotFound(_0xc28249,_0x46cdbd){return function(_0x30dcea){if(!_0x30dcea){_0xc28249['sendStatus'](0x194);}return _0x30dcea;};}function handleError(_0x478c8d,_0x1dc9b3){_0x1dc9b3=_0x1dc9b3||0x1f4;return function(_0x58157e){logger[_0x3342('0x22')](_0x58157e[_0x3342('0x32')]);if(_0x58157e[_0x3342('0x33')]){delete _0x58157e[_0x3342('0x33')];}_0x478c8d[_0x3342('0x28')](_0x1dc9b3)[_0x3342('0x34')](_0x58157e);};}exports[_0x3342('0x35')]=function(_0x5d460c,_0x4754d9){var _0x2db4ac={},_0x23dbe8={},_0x155493={'count':0x0,'rows':[]};var _0x32f644=_['map'](db[_0x3342('0x36')]['rawAttributes'],function(_0x22ca76){return{'name':_0x22ca76[_0x3342('0x37')],'type':_0x22ca76[_0x3342('0x38')][_0x3342('0x39')]};});_0x23dbe8['model']=_[_0x3342('0x3a')](_0x32f644,'name');_0x23dbe8[_0x3342('0x3b')]=_[_0x3342('0x3c')](_0x5d460c[_0x3342('0x3b')]);_0x23dbe8[_0x3342('0x3d')]=_[_0x3342('0x3e')](_0x23dbe8[_0x3342('0x3f')],_0x23dbe8[_0x3342('0x3b')]);_0x2db4ac['attributes']=_[_0x3342('0x3e')](_0x23dbe8[_0x3342('0x3f')],qs['fields'](_0x5d460c[_0x3342('0x3b')][_0x3342('0x40')]));_0x2db4ac['attributes']=_0x2db4ac[_0x3342('0x41')][_0x3342('0x42')]?_0x2db4ac['attributes']:_0x23dbe8['model'];if(!_0x5d460c['query'][_0x3342('0x43')](_0x3342('0x44'))){_0x2db4ac['limit']=qs[_0x3342('0x2c')](_0x5d460c[_0x3342('0x3b')][_0x3342('0x2c')]);_0x2db4ac[_0x3342('0x2b')]=qs[_0x3342('0x2b')](_0x5d460c[_0x3342('0x3b')][_0x3342('0x2b')]);}_0x2db4ac[_0x3342('0x45')]=qs['sort'](_0x5d460c['query'][_0x3342('0x46')]);_0x2db4ac[_0x3342('0x47')]=qs[_0x3342('0x3d')](_[_0x3342('0x48')](_0x5d460c[_0x3342('0x3b')],_0x23dbe8[_0x3342('0x3d')]));if(_0x5d460c['query'][_0x3342('0x49')]){_0x2db4ac[_0x3342('0x47')]=_[_0x3342('0x4a')](_0x2db4ac[_0x3342('0x47')],{'$or':_[_0x3342('0x3a')](_0x32f644,function(_0x365d6f){if(_0x365d6f['type']!==_0x3342('0x4b')){var _0x4b267c={};_0x4b267c[_0x365d6f[_0x3342('0x33')]]={'$like':'%'+_0x5d460c[_0x3342('0x3b')][_0x3342('0x49')]+'%'};return _0x4b267c;}})});}_0x2db4ac=_[_0x3342('0x4a')]({},_0x2db4ac,_0x5d460c['options']);var _0x122265={'where':_0x2db4ac[_0x3342('0x47')]};return db['Dynamics365Account'][_0x3342('0x2a')](_0x122265)[_0x3342('0x1c')](function(_0x169549){_0x155493[_0x3342('0x2a')]=_0x169549;if(_0x5d460c['query'][_0x3342('0x4c')]){_0x2db4ac[_0x3342('0x4d')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x3342('0x4e')](_0x2db4ac);})['then'](function(_0x5683e0){_0x155493[_0x3342('0x4f')]=_0x5683e0;return _0x155493;})[_0x3342('0x1c')](respondWithFilteredResult(_0x4754d9,_0x2db4ac))[_0x3342('0x50')](handleError(_0x4754d9,null));};exports[_0x3342('0x51')]=function(_0x23925e,_0x171387){var _0x2bc5bd={'raw':![],'where':{'id':_0x23925e['params']['id']}},_0x4f2c1a={};_0x4f2c1a[_0x3342('0x3f')]=_['keys'](db[_0x3342('0x36')]['rawAttributes']);_0x4f2c1a['query']=_['keys'](_0x23925e[_0x3342('0x3b')]);_0x4f2c1a[_0x3342('0x3d')]=_[_0x3342('0x3e')](_0x4f2c1a[_0x3342('0x3f')],_0x4f2c1a['query']);_0x2bc5bd[_0x3342('0x41')]=_[_0x3342('0x3e')](_0x4f2c1a['model'],qs[_0x3342('0x40')](_0x23925e[_0x3342('0x3b')][_0x3342('0x40')]));_0x2bc5bd['attributes']=_0x2bc5bd[_0x3342('0x41')][_0x3342('0x42')]?_0x2bc5bd[_0x3342('0x41')]:_0x4f2c1a[_0x3342('0x3f')];if(_0x23925e[_0x3342('0x3b')]['includeAll']){_0x2bc5bd[_0x3342('0x4d')]=[{'all':!![]}];}_0x2bc5bd=_[_0x3342('0x4a')]({},_0x2bc5bd,_0x23925e[_0x3342('0x52')]);return db[_0x3342('0x36')][_0x3342('0x53')](_0x2bc5bd)[_0x3342('0x1c')](handleEntityNotFound(_0x171387,null))[_0x3342('0x1c')](respondWithResult(_0x171387,null))[_0x3342('0x50')](handleError(_0x171387,null));};exports[_0x3342('0x54')]=function(_0x542181,_0x218181){return db['Dynamics365Account'][_0x3342('0x54')](_0x542181['body'],{})['then'](respondWithResult(_0x218181,0xc9))['catch'](handleError(_0x218181,null));};exports['update']=function(_0x204e35,_0xdaabb4){if(_0x204e35[_0x3342('0x55')]['id']){delete _0x204e35[_0x3342('0x55')]['id'];}return db[_0x3342('0x36')][_0x3342('0x53')]({'where':{'id':_0x204e35[_0x3342('0x56')]['id']}})[_0x3342('0x1c')](handleEntityNotFound(_0xdaabb4,null))[_0x3342('0x1c')](saveUpdates(_0x204e35[_0x3342('0x55')],null))[_0x3342('0x1c')](respondWithResult(_0xdaabb4,null))['catch'](handleError(_0xdaabb4,null));};exports['destroy']=function(_0x11719c,_0x53e54b){return db[_0x3342('0x36')]['find']({'where':{'id':_0x11719c['params']['id']}})[_0x3342('0x1c')](handleEntityNotFound(_0x53e54b,null))[_0x3342('0x1c')](removeEntity(_0x53e54b,null))[_0x3342('0x50')](handleError(_0x53e54b,null));};exports['getConfigurations']=function(_0x58d37a,_0x54b41d,_0x3cc92a){var _0x5e9161={};var _0x2da4b7={};var _0x219a17;var _0x372af5;return db['Dynamics365Account'][_0x3342('0x57')]({'where':{'id':_0x58d37a[_0x3342('0x56')]['id']}})[_0x3342('0x1c')](handleEntityNotFound(_0x54b41d,null))[_0x3342('0x1c')](function(_0x18ed0c){if(_0x18ed0c){_0x219a17=_0x18ed0c;_0x2da4b7[_0x3342('0x3f')]=_[_0x3342('0x3c')](db['Dynamics365Configuration']['rawAttributes']);_0x2da4b7[_0x3342('0x3b')]=_['keys'](_0x58d37a[_0x3342('0x3b')]);_0x2da4b7[_0x3342('0x3d')]=_[_0x3342('0x3e')](_0x2da4b7[_0x3342('0x3f')],_0x2da4b7[_0x3342('0x3b')]);_0x5e9161['attributes']=_[_0x3342('0x3e')](_0x2da4b7[_0x3342('0x3f')],qs['fields'](_0x58d37a[_0x3342('0x3b')][_0x3342('0x40')]));_0x5e9161[_0x3342('0x41')]=_0x5e9161[_0x3342('0x41')][_0x3342('0x42')]?_0x5e9161[_0x3342('0x41')]:_0x2da4b7[_0x3342('0x3f')];_0x5e9161[_0x3342('0x45')]=qs[_0x3342('0x46')](_0x58d37a[_0x3342('0x3b')][_0x3342('0x46')]);_0x5e9161[_0x3342('0x47')]=qs[_0x3342('0x3d')](_['pick'](_0x58d37a['query'],_0x2da4b7[_0x3342('0x3d')]));if(_0x58d37a[_0x3342('0x3b')][_0x3342('0x49')]){_0x5e9161[_0x3342('0x47')]=_['merge'](_0x5e9161['where'],{'$or':_[_0x3342('0x3a')](_0x5e9161[_0x3342('0x41')],function(_0x1bbffe){var _0x2aed01={};_0x2aed01[_0x1bbffe]={'$like':'%'+_0x58d37a[_0x3342('0x3b')][_0x3342('0x49')]+'%'};return _0x2aed01;})});}_0x5e9161=_[_0x3342('0x4a')]({},_0x5e9161,_0x58d37a[_0x3342('0x52')]);return _0x219a17[_0x3342('0x58')](_0x5e9161);}})[_0x3342('0x1c')](function(_0x4887d4){if(_0x4887d4){_0x372af5=_0x4887d4[_0x3342('0x42')];if(!_0x58d37a['query'][_0x3342('0x43')](_0x3342('0x44'))){_0x5e9161['limit']=qs[_0x3342('0x2c')](_0x58d37a[_0x3342('0x3b')]['limit']);_0x5e9161[_0x3342('0x2b')]=qs[_0x3342('0x2b')](_0x58d37a[_0x3342('0x3b')][_0x3342('0x2b')]);}return _0x219a17[_0x3342('0x58')](_0x5e9161);}})[_0x3342('0x1c')](function(_0x28d937){if(_0x28d937){return _0x28d937?{'count':_0x372af5,'rows':_0x28d937}:null;}})['then'](respondWithResult(_0x54b41d,null))[_0x3342('0x50')](handleError(_0x54b41d,null));};exports['addConfiguration']=function(_0x56a30b,_0x3ab670,_0x28624b){if(_0x56a30b[_0x3342('0x55')]['id']){delete _0x56a30b[_0x3342('0x55')]['id'];}return db[_0x3342('0x36')][_0x3342('0x57')]({'where':{'id':_0x56a30b[_0x3342('0x56')]['id']}})[_0x3342('0x1c')](handleEntityNotFound(_0x3ab670,null))['then'](function(_0x3c8fd5){if(_0x3c8fd5){_0x56a30b[_0x3342('0x55')][_0x3342('0x59')]=_0x3c8fd5['id'];_0x56a30b[_0x3342('0x55')][_0x3342('0x5a')]=integrations[_0x3342('0x5b')](_0x56a30b[_0x3342('0x55')]['channel'],_0x56a30b[_0x3342('0x55')][_0x3342('0x38')]);_0x56a30b[_0x3342('0x55')][_0x3342('0x5c')]=integrations[_0x3342('0x5d')](_0x56a30b[_0x3342('0x55')]['channel'],_0x56a30b['body']['type']);return db[_0x3342('0x5e')][_0x3342('0x54')](_0x56a30b[_0x3342('0x55')],{'include':[{'model':db[_0x3342('0x5f')],'as':_0x3342('0x5a')},{'model':db[_0x3342('0x5f')],'as':_0x3342('0x5c')}]});}return null;})[_0x3342('0x1c')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports[_0x3342('0x60')]=function(_0x1b24d2,_0x2967d6,_0x42782f){var _0x5f4f56=_0x1b24d2[_0x3342('0x3b')][_0x3342('0x61')];var _0x3cbe12=_0x5f4f56===_0x3342('0x62')?_0x3342('0x63'):_0x3342('0x64');var _0x35c53='';var _0x212ba9='';var _0x3d2745='';var _0x5e85e5='';var _0xdc419a='';var _0x1862b8='';var _0x58c1b1='';var _0x58405='';var _0x5164eb=[_0x3342('0x65'),'description',_0x3342('0x66'),'ownerid',_0x3342('0x67'),_0x3342('0x68'),'phonenumber',_0x3342('0x69'),_0x3342('0x6a'),'phonecall_activity_parties'];var _0xe5acb2=[_0x3342('0x6b'),_0x3342('0x6c'),_0x3342('0x6d'),_0x3342('0x6e'),_0x3342('0x6f'),'contactidyominame',_0x3342('0x70'),_0x3342('0x71'),_0x3342('0x72'),_0x3342('0x73'),_0x3342('0x74'),_0x3342('0x75'),_0x3342('0x76'),_0x3342('0x77'),_0x3342('0x78'),_0x3342('0x79'),'customeridtype',_0x3342('0x7a'),_0x3342('0x7b'),_0x3342('0x7c'),'entityimage_timestamp','entityimage_url',_0x3342('0x7d'),'exchangerate','firstresponsebykpiidname',_0x3342('0x7e'),_0x3342('0x7f'),'influencescore',_0x3342('0x80'),'lastonholdtime',_0x3342('0x81'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0x3342('0x82'),_0x3342('0x83'),_0x3342('0x84'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0x3342('0x85'),'msdyn_iotalertname',_0x3342('0x86'),_0x3342('0x87'),_0x3342('0x88'),_0x3342('0x89'),'owneridtype','owneridyominame',_0x3342('0x8a'),_0x3342('0x8b'),'primarycontactidyominame',_0x3342('0x8c'),'productidname',_0x3342('0x8d'),_0x3342('0x8e'),_0x3342('0x8f'),_0x3342('0x90'),_0x3342('0x91'),'responsiblecontactidyominame','sentimentvalue','slainvokedidname',_0x3342('0x92'),_0x3342('0x93'),_0x3342('0x94'),'statuscode',_0x3342('0x95'),_0x3342('0x96'),_0x3342('0x97'),_0x3342('0x98'),_0x3342('0x99'),_0x3342('0x9a'),'versionnumber'];var _0x100e23=_0x5164eb['concat'](_0xe5acb2);return db['Dynamics365Account']['findOne']({'where':{'id':_0x1b24d2[_0x3342('0x56')]['id']},'attributes':['id',_0x3342('0x9b'),'password',_0x3342('0x9c'),_0x3342('0x9d'),'clientId',_0x3342('0x9e')]})[_0x3342('0x1c')](handleEntityNotFound(_0x2967d6,null))[_0x3342('0x1c')](function(_0x464e4c){if(_0x464e4c){_0x58405=_0x464e4c[_0x3342('0x9c')];var _0x83f96b=_0x58405[_0x3342('0x9f')](-0x1);if(_0x83f96b==='/'){_0x58405=_0x58405[_0x3342('0xa0')](0x0,_0x58405['lastIndexOf'](_0x83f96b));}_0x58c1b1=util[_0x3342('0xa1')](_0x3342('0xa2'),_0x58405);var _0x13738c={'method':_0x3342('0xa3'),'uri':_0x3342('0xa4')+_0x464e4c[_0x3342('0x9d')]+_0x3342('0xa5'),'form':{'client_id':_0x464e4c['clientId'],'resource':_0x58405,'username':_0x464e4c['username'],'password':_0x464e4c[_0x3342('0xa6')],'grant_type':_0x3342('0xa6'),'client_secret':_0x464e4c[_0x3342('0x9e')]},'json':!![]};return rp(_0x13738c);}})[_0x3342('0x1c')](function(_0x15c44b){_0x1862b8=_0x15c44b[_0x3342('0xa7')];var _0x1abdfa={'method':'GET','uri':encodeURI(_0x58c1b1+_0x3342('0xa8')+_0x3cbe12+'\x27'),'headers':{'Authorization':_0x3342('0xa9')+_0x1862b8,'If-None-Match':null,'OData-Version':_0x3342('0xaa')},'json':!![]};return rp(_0x1abdfa);})[_0x3342('0x1c')](function(_0x439a6b){var _0x492975=_0x439a6b[_0x3342('0xab')][0x0];var _0x15a83b=_0x492975[_0x3342('0xac')];var _0x46cd38={'method':'GET','uri':_0x58c1b1+_0x3342('0xad')+_0x15a83b+_0x3342('0xae'),'headers':{'Authorization':_0x3342('0xa9')+_0x1862b8,'If-None-Match':null,'OData-Version':_0x3342('0xaa')},'json':!![]};return rp(_0x46cd38);})[_0x3342('0x1c')](function(_0x388499){_0x35c53=_0x388499;_0x212ba9=_0x35c53[_0x3342('0xaf')];_0x212ba9=_['remove'](_0x212ba9,function(_0x53a9e1){return!_0x100e23[_0x3342('0xb0')](_0x53a9e1['LogicalName']);});var _0x122a34=[];var _0x38c9c4=[];_0x212ba9[_0x3342('0xb1')](function(_0x23b307){if(_0x23b307[_0x3342('0xb2')]){var _0x4d3415=_0x23b307[_0x3342('0xb2')][_0x3342('0xa0')](_0x23b307[_0x3342('0xb2')]['lastIndexOf']('.')+0x1);if(_0x4d3415==='PicklistAttributeMetadata'){_0x122a34[_0x3342('0xb3')](getSelectList(_0x58c1b1,_0x5f4f56,_0x38c9c4,_0x35c53[_0x3342('0xac')],_0x23b307[_0x3342('0xac')],_0x1862b8));}}});return Promise[_0x3342('0xb4')](_0x122a34);})[_0x3342('0x1c')](function(_0x1bfd8b){_0x3d2745=_0x1bfd8b[0x0];var _0x3c8470=[];var _0x2c8c08=[];_0x212ba9[_0x3342('0xb1')](function(_0x304dd0){if(!_[_0x3342('0xb5')](_0x304dd0[_0x3342('0xb2')])){var _0x5b75d9=_0x304dd0['@odata.type']['substring'](_0x304dd0[_0x3342('0xb2')][_0x3342('0xb6')]('.')+0x1);if(_0x5b75d9===_0x3342('0xb7')){_0x3c8470[_0x3342('0xb3')](getBooleanList(_0x58c1b1,_0x5f4f56,_0x2c8c08,_0x35c53[_0x3342('0xac')],_0x304dd0['MetadataId'],_0x1862b8));}}});return Promise[_0x3342('0xb4')](_0x3c8470);})[_0x3342('0x1c')](function(_0x3ccb7b){_0x5e85e5=_0x3ccb7b[0x0];var _0x537b31=[];var _0x22eb3b=[];_0x212ba9[_0x3342('0xb1')](function(_0x5982e6){if(_0x5982e6['@odata.type']){var _0x49325d=_0x5982e6[_0x3342('0xb2')][_0x3342('0xa0')](_0x5982e6[_0x3342('0xb2')][_0x3342('0xb6')]('.')+0x1);if(_0x49325d==='StringAttributeMetadata'||_0x49325d==='DoubleAttributeMetadata'||_0x49325d===_0x3342('0xb8')||_0x49325d===_0x3342('0xb9')||_0x49325d===_0x3342('0xba')||_0x49325d===_0x3342('0xbb')||_0x49325d===_0x3342('0xbc')||_0x49325d===_0x3342('0xbd')||_0x49325d===_0x3342('0xbe')||_0x49325d==='DecimalAttributeMetadata'){_0x537b31['push'](getInputList(_0x58c1b1,_0x5f4f56,_0x49325d,_0x22eb3b,_0x35c53['MetadataId'],_0x5982e6[_0x3342('0xac')],_0x1862b8));}}});return Promise['all'](_0x537b31);})['then'](function(_0x5f561d){_0xdc419a=_0x5f561d[0x0];var _0x3c1c34=_0x3d2745[_0x3342('0xbf')](_0x5e85e5)['concat'](_0xdc419a);var _0x36739b={'count':_0x3c1c34['length'],'rows':_0x3c1c34};return _0x36739b;})['then'](respondWithResult(_0x2967d6,null))[_0x3342('0x50')](function(_0x554259){var _0x22522d=_0x1b24d2[_0x3342('0x3b')][_0x3342('0x18')]?0x1f4:_0x554259[_0x3342('0xc0')]||0x1f4;logger[_0x3342('0x22')](_0x554259[_0x3342('0x32')]);delete _0x554259['name'];if(_0x22522d===0x191){_0x22522d=0x190;}_0x2967d6[_0x3342('0x28')](_0x22522d)[_0x3342('0x34')](_0x1b24d2[_0x3342('0x3b')]['test']?{'message':_0x3342('0xc1'),'statusCode':_0x554259[_0x3342('0xc0')]}:_0x554259);});};function getSelectList(_0x3b206a,_0x1f7b91,_0x10eb7b,_0x41de0c,_0x47a824,_0x25b617){var _0x1653c9={'method':_0x3342('0xc2'),'uri':_0x3b206a+_0x3342('0xad')+_0x41de0c+_0x3342('0xc3')+_0x47a824+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x3342('0xc4'),'headers':{'Authorization':_0x3342('0xa9')+_0x25b617,'If-None-Match':null,'OData-Version':_0x3342('0xaa')},'json':!![]};return rp(_0x1653c9)[_0x3342('0x1c')](function(_0x498de2){var _0x100d41=[];var _0x56251e=_0x498de2[_0x3342('0xc5')][_0x3342('0xc6')];_0x56251e[_0x3342('0xb1')](function(_0x4f4819){_0x100d41[_0x3342('0xb3')]({'name':_0x4f4819['Label'][_0x3342('0xc7')]['Label'],'value':String(_0x4f4819[_0x3342('0xc8')])});});var _0xe6d040={'id':_0x1f7b91+'_'+_0x498de2[_0x3342('0xc9')],'name':_0x498de2['DisplayName'][_0x3342('0xc7')][_0x3342('0xca')],'custom':![],'options':_0x100d41};_0x10eb7b[_0x3342('0xb3')](_0xe6d040);return _0x10eb7b;});}function getBooleanList(_0x26da43,_0x224680,_0x45821b,_0xf97bcb,_0x4d86c3,_0x296ae6){var _0x2d7ba8={'method':_0x3342('0xc2'),'uri':_0x26da43+'EntityDefinitions('+_0xf97bcb+_0x3342('0xc3')+_0x4d86c3+_0x3342('0xcb'),'headers':{'Authorization':_0x3342('0xa9')+_0x296ae6,'If-None-Match':null,'OData-Version':_0x3342('0xaa')},'json':!![]};return rp(_0x2d7ba8)[_0x3342('0x1c')](function(_0x157c6d){var _0x1d67d8=[];_0x1d67d8[_0x3342('0xb3')]({'name':_0x157c6d['OptionSet'][_0x3342('0xcc')][_0x3342('0xca')]['UserLocalizedLabel'][_0x3342('0xca')],'value':_0x3342('0xcd')},{'name':_0x157c6d[_0x3342('0xc5')][_0x3342('0xce')][_0x3342('0xca')][_0x3342('0xc7')][_0x3342('0xca')],'value':_0x3342('0xcf')});var _0x25e9f8={'id':_0x224680+'_'+_0x157c6d[_0x3342('0xc9')],'name':_0x157c6d[_0x3342('0xd0')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x1d67d8};_0x45821b[_0x3342('0xb3')](_0x25e9f8);return _0x45821b;});}function getInputList(_0x36e47d,_0x107e1b,_0x60d3ad,_0x2124ba,_0x1bed4c,_0x34f15a,_0x2e4199){var _0x41baae={'method':_0x3342('0xc2'),'uri':_0x36e47d+_0x3342('0xad')+_0x1bed4c+_0x3342('0xc3')+_0x34f15a+_0x3342('0xd1')+_0x60d3ad+_0x3342('0xd2'),'headers':{'Authorization':_0x3342('0xa9')+_0x2e4199,'If-None-Match':null,'OData-Version':_0x3342('0xaa')},'json':!![]};return rp(_0x41baae)['then'](function(_0x4e1359){var _0x399d30={'id':_0x107e1b+'_'+_0x4e1359[_0x3342('0xc9')],'name':_0x4e1359['DisplayName'][_0x3342('0xc7')]?_0x4e1359[_0x3342('0xd0')]['UserLocalizedLabel'][_0x3342('0xca')]:_0x4e1359['LogicalName'],'custom':![],'options':[]};_0x2124ba[_0x3342('0xb3')](_0x399d30);return _0x2124ba;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 793b8cd..d060985 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 _0x35fa=['exports','define','lodash','util','moment','request-promise','../../components/integrations/configuration'];(function(_0x53b53d,_0x4f6b23){var _0x175de7=function(_0x1940e3){while(--_0x1940e3){_0x53b53d['push'](_0x53b53d['shift']());}};_0x175de7(++_0x4f6b23);}(_0x35fa,0xf0));var _0xa35f=function(_0x57df3a,_0x196175){_0x57df3a=_0x57df3a-0x0;var _0x2fe386=_0x35fa[_0x57df3a];return _0x2fe386;};'use strict';var _=require(_0xa35f('0x0'));var util=require(_0xa35f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa35f('0x2'));var BPromise=require('bluebird');var rp=require(_0xa35f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0xa35f('0x4'));module[_0xa35f('0x5')]=function(_0x4430de,_0x402547){return _0x4430de[_0xa35f('0x6')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf177=['./intDynamics365Account.attributes','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util','api','moment','bluebird','rimraf'];(function(_0x96f3ea,_0x54cec0){var _0xaf754f=function(_0x12db70){while(--_0x12db70){_0x96f3ea['push'](_0x96f3ea['shift']());}};_0xaf754f(++_0x54cec0);}(_0xf177,0x1d3));var _0x7f17=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf177[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x7f17('0x0'));var util=require(_0x7f17('0x1'));var logger=require('../../config/logger')(_0x7f17('0x2'));var moment=require(_0x7f17('0x3'));var BPromise=require(_0x7f17('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7f17('0x5'));var config=require('../../config/environment');var attributes=require(_0x7f17('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x7f17('0x7')]=function(_0x2a70a1,_0x179a8b){return _0x2a70a1[_0x7f17('0x8')](_0x7f17('0x9'),attributes,{'tableName':_0x7f17('0xa'),'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 9fb4a1b..f5bf6ee 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 _0xdcd5=['catch','GetDynamics365Account','Dynamics365Account','options','raw','where','limit','include','map','attributes','model','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xdcd5,0x110));var _0x5dcd=function(_0x15dbca,_0x1d7c3c){_0x15dbca=_0x15dbca-0x0;var _0x326533=_0xdcd5[_0x15dbca];return _0x326533;};'use strict';var _=require(_0x5dcd('0x0'));var util=require(_0x5dcd('0x1'));var moment=require(_0x5dcd('0x2'));var BPromise=require(_0x5dcd('0x3'));var rs=require(_0x5dcd('0x4'));var fs=require('fs');var Redis=require(_0x5dcd('0x5'));var db=require(_0x5dcd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5dcd('0x7'))(_0x5dcd('0x8'));var config=require(_0x5dcd('0x9'));var jayson=require(_0x5dcd('0xa'));var client=jayson[_0x5dcd('0xb')][_0x5dcd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c7e52,_0x3273c5,_0x5b70b8){return new BPromise(function(_0x593f16,_0x1680f9){return client[_0x5dcd('0xd')](_0x3c7e52,_0x5b70b8)[_0x5dcd('0xe')](function(_0x55037e){logger[_0x5dcd('0xf')](_0x5dcd('0x10'),_0x3273c5,_0x5dcd('0x11'));logger[_0x5dcd('0x12')](_0x5dcd('0x13'),_0x3273c5,_0x5dcd('0x11'),JSON[_0x5dcd('0x14')](_0x55037e));if(_0x55037e['error']){if(_0x55037e['error'][_0x5dcd('0x15')]===0x1f4){logger[_0x5dcd('0x16')]('Dynamics365Account,\x20%s,\x20%s',_0x3273c5,_0x55037e[_0x5dcd('0x16')][_0x5dcd('0x17')]);return _0x1680f9(_0x55037e[_0x5dcd('0x16')][_0x5dcd('0x17')]);}logger[_0x5dcd('0x16')](_0x5dcd('0x10'),_0x3273c5,_0x55037e[_0x5dcd('0x16')][_0x5dcd('0x17')]);return _0x593f16(_0x55037e['error'][_0x5dcd('0x17')]);}else{logger[_0x5dcd('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x3273c5,_0x5dcd('0x11'));_0x593f16(_0x55037e['result'][_0x5dcd('0x17')]);}})[_0x5dcd('0x18')](function(_0x1fd337){logger['error'](_0x5dcd('0x10'),_0x3273c5,_0x1fd337);_0x1680f9(_0x1fd337);});});}exports[_0x5dcd('0x19')]=function(_0xc7d7d7){var _0x5074b2=this;return new Promise(function(_0x3e23fa,_0x186e84){return db[_0x5dcd('0x1a')]['findAll']({'raw':_0xc7d7d7[_0x5dcd('0x1b')]?_0xc7d7d7[_0x5dcd('0x1b')][_0x5dcd('0x1c')]===undefined?!![]:![]:!![],'where':_0xc7d7d7[_0x5dcd('0x1b')]?_0xc7d7d7['options'][_0x5dcd('0x1d')]||null:null,'attributes':_0xc7d7d7[_0x5dcd('0x1b')]?_0xc7d7d7['options']['attributes']||null:null,'limit':_0xc7d7d7[_0x5dcd('0x1b')]?_0xc7d7d7[_0x5dcd('0x1b')][_0x5dcd('0x1e')]||null:null,'include':_0xc7d7d7[_0x5dcd('0x1b')]?_0xc7d7d7[_0x5dcd('0x1b')][_0x5dcd('0x1f')]?_[_0x5dcd('0x20')](_0xc7d7d7[_0x5dcd('0x1b')][_0x5dcd('0x1f')],function(_0x270390){return{'model':db[_0x270390['model']],'as':_0x270390['as'],'attributes':_0x270390[_0x5dcd('0x21')],'include':_0x270390[_0x5dcd('0x1f')]?_[_0x5dcd('0x20')](_0x270390['include'],function(_0x30fe1f){return{'model':db[_0x30fe1f[_0x5dcd('0x22')]],'as':_0x30fe1f['as'],'attributes':_0x30fe1f[_0x5dcd('0x21')],'include':_0x30fe1f[_0x5dcd('0x1f')]?_[_0x5dcd('0x20')](_0x30fe1f['include'],function(_0xf30ac6){return{'model':db[_0xf30ac6[_0x5dcd('0x22')]],'as':_0xf30ac6['as'],'attributes':_0xf30ac6[_0x5dcd('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5dcd('0xe')](function(_0x379f3c){logger['info'](_0x5dcd('0x19'),_0xc7d7d7);logger[_0x5dcd('0x12')](_0x5dcd('0x19'),_0xc7d7d7,JSON[_0x5dcd('0x14')](_0x379f3c));_0x3e23fa(_0x379f3c);})[_0x5dcd('0x18')](function(_0x1ba4cf){logger[_0x5dcd('0x16')](_0x5dcd('0x19'),_0x1ba4cf[_0x5dcd('0x17')],_0xc7d7d7);_0x186e84(_0x5074b2[_0x5dcd('0x16')](0x1f4,_0x1ba4cf['message']));});});};exports[_0x5dcd('0x23')]=function(_0x510e49){var _0x4f65bf=this;return new Promise(function(_0x376ec6,_0x204e3a){return db['Dynamics365Account'][_0x5dcd('0x24')]({'raw':_0x510e49[_0x5dcd('0x1b')]?_0x510e49['options'][_0x5dcd('0x1c')]===undefined?!![]:![]:!![],'where':_0x510e49[_0x5dcd('0x1b')]?_0x510e49[_0x5dcd('0x1b')][_0x5dcd('0x1d')]||null:null,'attributes':_0x510e49['options']?_0x510e49['options'][_0x5dcd('0x21')]||null:null,'include':_0x510e49[_0x5dcd('0x1b')]?_0x510e49['options']['include']?_[_0x5dcd('0x20')](_0x510e49['options'][_0x5dcd('0x1f')],function(_0x517d00){return{'model':db[_0x517d00['model']],'as':_0x517d00['as'],'attributes':_0x517d00[_0x5dcd('0x21')],'include':_0x517d00[_0x5dcd('0x1f')]?_[_0x5dcd('0x20')](_0x517d00[_0x5dcd('0x1f')],function(_0x1f0f5d){return{'model':db[_0x1f0f5d[_0x5dcd('0x22')]],'as':_0x1f0f5d['as'],'attributes':_0x1f0f5d[_0x5dcd('0x21')],'include':_0x1f0f5d[_0x5dcd('0x1f')]?_[_0x5dcd('0x20')](_0x1f0f5d[_0x5dcd('0x1f')],function(_0xd71429){return{'model':db[_0xd71429[_0x5dcd('0x22')]],'as':_0xd71429['as'],'attributes':_0xd71429[_0x5dcd('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5dcd('0xe')](function(_0xd60d64){logger[_0x5dcd('0xf')](_0x5dcd('0x23'),_0x510e49);logger[_0x5dcd('0x12')](_0x5dcd('0x23'),_0x510e49,JSON['stringify'](_0xd60d64));_0x376ec6(_0xd60d64);})[_0x5dcd('0x18')](function(_0x154a83){logger['error'](_0x5dcd('0x23'),_0x154a83[_0x5dcd('0x17')],_0x510e49);_0x204e3a(_0x4f65bf[_0x5dcd('0x16')](0x1f4,_0x154a83[_0x5dcd('0x17')]));});});}; \ No newline at end of file +var _0xf105=['request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xf105,0x1b0));var _0x5f10=function(_0x1e8483,_0x275850){_0x1e8483=_0x1e8483-0x0;var _0x23dbf7=_0xf105[_0x1e8483];return _0x23dbf7;};'use strict';var _=require(_0x5f10('0x0'));var util=require(_0x5f10('0x1'));var moment=require(_0x5f10('0x2'));var BPromise=require(_0x5f10('0x3'));var rs=require(_0x5f10('0x4'));var fs=require('fs');var Redis=require(_0x5f10('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f10('0x6'));var logger=require('../../config/logger')(_0x5f10('0x7'));var config=require(_0x5f10('0x8'));var jayson=require(_0x5f10('0x9'));var client=jayson[_0x5f10('0xa')][_0x5f10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2871bb,_0x34bd06,_0x445aa4){return new BPromise(function(_0x509e76,_0x1c8d67){return client[_0x5f10('0xc')](_0x2871bb,_0x445aa4)[_0x5f10('0xd')](function(_0x1a7318){logger[_0x5f10('0xe')](_0x5f10('0xf'),_0x34bd06,'request\x20sent');logger[_0x5f10('0x10')](_0x5f10('0x11'),_0x34bd06,_0x5f10('0x12'),JSON[_0x5f10('0x13')](_0x1a7318));if(_0x1a7318[_0x5f10('0x14')]){if(_0x1a7318[_0x5f10('0x14')]['code']===0x1f4){logger[_0x5f10('0x14')](_0x5f10('0xf'),_0x34bd06,_0x1a7318[_0x5f10('0x14')][_0x5f10('0x15')]);return _0x1c8d67(_0x1a7318['error']['message']);}logger[_0x5f10('0x14')](_0x5f10('0xf'),_0x34bd06,_0x1a7318['error']['message']);return _0x509e76(_0x1a7318[_0x5f10('0x14')]['message']);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x34bd06,_0x5f10('0x12'));_0x509e76(_0x1a7318[_0x5f10('0x16')]['message']);}})[_0x5f10('0x17')](function(_0x209fa0){logger['error'](_0x5f10('0xf'),_0x34bd06,_0x209fa0);_0x1c8d67(_0x209fa0);});});}exports[_0x5f10('0x18')]=function(_0x25d01b){var _0x1cf554=this;return new Promise(function(_0x565c4f,_0x5b4ad7){return db[_0x5f10('0x19')][_0x5f10('0x1a')]({'raw':_0x25d01b[_0x5f10('0x1b')]?_0x25d01b['options'][_0x5f10('0x1c')]===undefined?!![]:![]:!![],'where':_0x25d01b[_0x5f10('0x1b')]?_0x25d01b['options'][_0x5f10('0x1d')]||null:null,'attributes':_0x25d01b['options']?_0x25d01b[_0x5f10('0x1b')][_0x5f10('0x1e')]||null:null,'limit':_0x25d01b[_0x5f10('0x1b')]?_0x25d01b[_0x5f10('0x1b')][_0x5f10('0x1f')]||null:null,'include':_0x25d01b['options']?_0x25d01b['options'][_0x5f10('0x20')]?_[_0x5f10('0x21')](_0x25d01b[_0x5f10('0x1b')][_0x5f10('0x20')],function(_0x54cad7){return{'model':db[_0x54cad7['model']],'as':_0x54cad7['as'],'attributes':_0x54cad7[_0x5f10('0x1e')],'include':_0x54cad7[_0x5f10('0x20')]?_[_0x5f10('0x21')](_0x54cad7[_0x5f10('0x20')],function(_0x577569){return{'model':db[_0x577569['model']],'as':_0x577569['as'],'attributes':_0x577569[_0x5f10('0x1e')],'include':_0x577569[_0x5f10('0x20')]?_[_0x5f10('0x21')](_0x577569[_0x5f10('0x20')],function(_0x42f009){return{'model':db[_0x42f009[_0x5f10('0x22')]],'as':_0x42f009['as'],'attributes':_0x42f009[_0x5f10('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5f10('0xd')](function(_0x2b216c){logger[_0x5f10('0xe')](_0x5f10('0x18'),_0x25d01b);logger[_0x5f10('0x10')](_0x5f10('0x18'),_0x25d01b,JSON[_0x5f10('0x13')](_0x2b216c));_0x565c4f(_0x2b216c);})[_0x5f10('0x17')](function(_0x480627){logger[_0x5f10('0x14')](_0x5f10('0x18'),_0x480627['message'],_0x25d01b);_0x5b4ad7(_0x1cf554[_0x5f10('0x14')](0x1f4,_0x480627[_0x5f10('0x15')]));});});};exports[_0x5f10('0x23')]=function(_0x3d57e3){var _0x1ff9a4=this;return new Promise(function(_0x3972ed,_0x53aff3){return db['Dynamics365Account'][_0x5f10('0x24')]({'raw':_0x3d57e3[_0x5f10('0x1b')]?_0x3d57e3[_0x5f10('0x1b')][_0x5f10('0x1c')]===undefined?!![]:![]:!![],'where':_0x3d57e3['options']?_0x3d57e3[_0x5f10('0x1b')][_0x5f10('0x1d')]||null:null,'attributes':_0x3d57e3[_0x5f10('0x1b')]?_0x3d57e3['options'][_0x5f10('0x1e')]||null:null,'include':_0x3d57e3[_0x5f10('0x1b')]?_0x3d57e3[_0x5f10('0x1b')][_0x5f10('0x20')]?_[_0x5f10('0x21')](_0x3d57e3[_0x5f10('0x1b')][_0x5f10('0x20')],function(_0x482b17){return{'model':db[_0x482b17[_0x5f10('0x22')]],'as':_0x482b17['as'],'attributes':_0x482b17[_0x5f10('0x1e')],'include':_0x482b17[_0x5f10('0x20')]?_[_0x5f10('0x21')](_0x482b17['include'],function(_0x5c361a){return{'model':db[_0x5c361a[_0x5f10('0x22')]],'as':_0x5c361a['as'],'attributes':_0x5c361a[_0x5f10('0x1e')],'include':_0x5c361a[_0x5f10('0x20')]?_[_0x5f10('0x21')](_0x5c361a[_0x5f10('0x20')],function(_0x2b155f){return{'model':db[_0x2b155f['model']],'as':_0x2b155f['as'],'attributes':_0x2b155f['attributes']};}):[]};}):[]};}):[]:[]})[_0x5f10('0xd')](function(_0x297049){logger[_0x5f10('0xe')](_0x5f10('0x23'),_0x3d57e3);logger[_0x5f10('0x10')](_0x5f10('0x23'),_0x3d57e3,JSON[_0x5f10('0x13')](_0x297049));_0x3972ed(_0x297049);})[_0x5f10('0x17')](function(_0x44dab6){logger[_0x5f10('0x14')](_0x5f10('0x23'),_0x44dab6[_0x5f10('0x15')],_0x3d57e3);_0x53aff3(_0x1ff9a4[_0x5f10('0x14')](0x1f4,_0x44dab6[_0x5f10('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 396d5db..4933122 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 _0xf060=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','exports'];(function(_0x362d0e,_0x532c82){var _0x1125e9=function(_0x6ae92a){while(--_0x6ae92a){_0x362d0e['push'](_0x362d0e['shift']());}};_0x1125e9(++_0x532c82);}(_0xf060,0x93));var _0x0f06=function(_0x208bc9,_0x4f36f6){_0x208bc9=_0x208bc9-0x0;var _0x2675a8=_0xf060[_0x208bc9];return _0x2675a8;};'use strict';var multer=require(_0x0f06('0x0'));var util=require(_0x0f06('0x1'));var path=require('path');var timeout=require(_0x0f06('0x2'));var express=require(_0x0f06('0x3'));var router=express[_0x0f06('0x4')]();var auth=require(_0x0f06('0x5'));var interaction=require(_0x0f06('0x6'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x0f06('0x7')]('/',auth[_0x0f06('0x8')](),controller[_0x0f06('0x9')]);router[_0x0f06('0x7')]('/:id',auth[_0x0f06('0x8')](),controller['show']);router[_0x0f06('0x7')](_0x0f06('0xa'),auth[_0x0f06('0x8')](),controller['getFields']);router['get'](_0x0f06('0xb'),auth[_0x0f06('0x8')](),controller[_0x0f06('0xc')]);router['get'](_0x0f06('0xd'),auth[_0x0f06('0x8')](),controller[_0x0f06('0xe')]);router[_0x0f06('0xf')]('/',auth[_0x0f06('0x8')](),controller[_0x0f06('0x10')]);router[_0x0f06('0x11')](_0x0f06('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x0f06('0x13')](_0x0f06('0x12'),auth[_0x0f06('0x8')](),controller['destroy']);module[_0x0f06('0x14')]=router; \ No newline at end of file +var _0x619a=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields'];(function(_0x183c17,_0x330723){var _0x3b7e11=function(_0xed4c05){while(--_0xed4c05){_0x183c17['push'](_0x183c17['shift']());}};_0x3b7e11(++_0x330723);}(_0x619a,0x14c));var _0xa619=function(_0x3669f8,_0xf387cf){_0x3669f8=_0x3669f8-0x0;var _0x4586a7=_0x619a[_0x3669f8];return _0x4586a7;};'use strict';var multer=require(_0xa619('0x0'));var util=require('util');var path=require(_0xa619('0x1'));var timeout=require(_0xa619('0x2'));var express=require(_0xa619('0x3'));var router=express[_0xa619('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa619('0x5'));var config=require(_0xa619('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0xa619('0x7')]('/',auth[_0xa619('0x8')](),controller['index']);router[_0xa619('0x7')](_0xa619('0x9'),auth[_0xa619('0x8')](),controller[_0xa619('0xa')]);router['get'](_0xa619('0xb'),auth[_0xa619('0x8')](),controller[_0xa619('0xc')]);router[_0xa619('0x7')](_0xa619('0xd'),auth['isAuthenticated'](),controller[_0xa619('0xe')]);router[_0xa619('0x7')](_0xa619('0xf'),auth[_0xa619('0x8')](),controller[_0xa619('0x10')]);router[_0xa619('0x11')]('/',auth[_0xa619('0x8')](),controller[_0xa619('0x12')]);router[_0xa619('0x13')](_0xa619('0x9'),auth[_0xa619('0x8')](),controller[_0xa619('0x14')]);router[_0xa619('0x15')](_0xa619('0x9'),auth[_0xa619('0x8')](),controller[_0xa619('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 0b11f27..151ce90 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 _0x697c=['STRING','ENUM','incident','sequelize','exports'];(function(_0x1c2c61,_0x5d3c35){var _0x2ed5c3=function(_0xcad2dc){while(--_0xcad2dc){_0x1c2c61['push'](_0x1c2c61['shift']());}};_0x2ed5c3(++_0x5d3c35);}(_0x697c,0x80));var _0xc697=function(_0x20f02a,_0x119d35){_0x20f02a=_0x20f02a-0x0;var _0x1eeab9=_0x697c[_0x20f02a];return _0x1eeab9;};'use strict';var Sequelize=require(_0xc697('0x0'));module[_0xc697('0x1')]={'name':{'type':Sequelize[_0xc697('0x2')]},'description':{'type':Sequelize[_0xc697('0x2')]},'ticketType':{'type':Sequelize[_0xc697('0x3')](_0xc697('0x4'),'phonecall'),'defaultValue':_0xc697('0x4')}}; \ No newline at end of file +var _0xdf3c=['incident','sequelize','exports','STRING','ENUM'];(function(_0x486061,_0x59ec2f){var _0x5ce3a7=function(_0x15efcc){while(--_0x15efcc){_0x486061['push'](_0x486061['shift']());}};_0x5ce3a7(++_0x59ec2f);}(_0xdf3c,0x1af));var _0xcdf3=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdf3c[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xcdf3('0x0'));module[_0xcdf3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcdf3('0x2')]},'ticketType':{'type':Sequelize[_0xcdf3('0x3')](_0xcdf3('0x4'),'phonecall'),'defaultValue':_0xcdf3('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 9da6587..22aa1ae 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 _0x7803=['type','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','count','includeAll','rows','show','params','keys','length','include','find','body','getFields','Dynamics365Field','pick','options','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7803,0x194));var _0x3780=function(_0x540da3,_0x3d7cf4){_0x540da3=_0x540da3-0x0;var _0x298d0f=_0x7803[_0x540da3];return _0x298d0f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3780('0x0'));var rimraf=require(_0x3780('0x1'));var zipdir=require(_0x3780('0x2'));var jsonpatch=require(_0x3780('0x3'));var rp=require(_0x3780('0x4'));var moment=require(_0x3780('0x5'));var BPromise=require(_0x3780('0x6'));var Mustache=require(_0x3780('0x7'));var util=require(_0x3780('0x8'));var path=require(_0x3780('0x9'));var sox=require(_0x3780('0xa'));var csv=require('to-csv');var ejs=require(_0x3780('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3780('0xc'));var crypto=require(_0x3780('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3780('0xe'));var toCsv=require(_0x3780('0xf'));var querystring=require(_0x3780('0x10'));var Papa=require(_0x3780('0x11'));var Redis=require(_0x3780('0x12'));var authService=require(_0x3780('0x13'));var qs=require(_0x3780('0x14'));var as=require(_0x3780('0x15'));var hardwareService=require(_0x3780('0x16'));var logger=require(_0x3780('0x17'))(_0x3780('0x18'));var utils=require('../../config/utils');var config=require(_0x3780('0x19'));var db=require(_0x3780('0x1a'))['db'];var jayson=require(_0x3780('0x1b'));var client=jayson['client'][_0x3780('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x128764,_0x5cf131,_0x19a553){if(_0x19a553){var _0x3e3a38=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e3a38[_0x3780('0x1d')](_0x5cf131)){return _0x128764;}else{throw new db[(_0x3780('0x1e'))]['ValidationError'](_0x3780('0x1f'));}}else{return _0x128764;}}function respondWithRpcPromise(_0x4466a7,_0xcb76e7,_0x504b80,_0x2ae583){return new BPromise(function(_0x353361,_0x4fb787){var _0x47a886=_0x2ae583||client;return _0x47a886['request'](_0x4466a7,_0x504b80)[_0x3780('0x20')](function(_0x3cf3d2){logger[_0x3780('0x21')](_0x3780('0x22'),_0xcb76e7,_0x3780('0x23'));logger['debug'](_0x3780('0x24'),_0xcb76e7,_0x3780('0x23'),JSON[_0x3780('0x25')](_0x3cf3d2));if(_0x3cf3d2[_0x3780('0x26')]){if(_0x3cf3d2['error'][_0x3780('0x27')]===0x1f4){logger[_0x3780('0x26')](_0x3780('0x22'),_0xcb76e7,_0x3cf3d2[_0x3780('0x26')][_0x3780('0x28')]);return _0x4fb787(_0x3cf3d2[_0x3780('0x26')][_0x3780('0x28')]);}logger[_0x3780('0x26')]('Dynamics365Configuration,\x20%s,\x20%s',_0xcb76e7,_0x3cf3d2[_0x3780('0x26')]['message']);return _0x353361(_0x3cf3d2['error']['message']);}else{logger[_0x3780('0x21')](_0x3780('0x22'),_0xcb76e7,'request\x20sent');_0x353361(_0x3cf3d2[_0x3780('0x29')][_0x3780('0x28')]);}})[_0x3780('0x2a')](function(_0x3da503){logger[_0x3780('0x26')](_0x3780('0x22'),_0xcb76e7,_0x3da503);_0x4fb787(_0x3da503);});});}function respondWithStatusCode(_0x5e77ae,_0x3c6440){_0x3c6440=_0x3c6440||0xcc;return function(_0x4d630f){if(_0x4d630f){return _0x5e77ae[_0x3780('0x2b')](_0x3c6440);}return _0x5e77ae[_0x3780('0x2c')](_0x3c6440)[_0x3780('0x2d')]();};}function respondWithResult(_0xeb82a7,_0x4f85b5){_0x4f85b5=_0x4f85b5||0xc8;return function(_0x3c29d5){if(_0x3c29d5){return _0xeb82a7[_0x3780('0x2c')](_0x4f85b5)[_0x3780('0x2e')](_0x3c29d5);}};}function respondWithFilteredResult(_0x4dcb6e,_0x29e751){return function(_0x5c90fb){if(_0x5c90fb){var _0x1a955c=_0x5c90fb['count'],_0x5cd49f=_0x29e751[_0x3780('0x2f')],_0x5e71c0=_0x29e751[_0x3780('0x2f')]+_0x29e751[_0x3780('0x30')],_0x2860ed;if(_0x5e71c0>=_0x1a955c){_0x5e71c0=_0x1a955c;_0x2860ed=0xc8;}else{_0x2860ed=0xce;}_0x4dcb6e['status'](_0x2860ed);return _0x4dcb6e[_0x3780('0x31')](_0x3780('0x32'),_0x5cd49f+'-'+_0x5e71c0+'/'+_0x1a955c)[_0x3780('0x2e')](_0x5c90fb);}return null;};}function patchUpdates(_0x54b76b){return function(_0x5ed522){try{jsonpatch[_0x3780('0x33')](_0x5ed522,_0x54b76b,!![]);}catch(_0x5df213){return BPromise[_0x3780('0x34')](_0x5df213);}return _0x5ed522['save']();};}function saveUpdates(_0x48ab85,_0x1f9dfb){return function(_0x5f4597){if(_0x5f4597){return _0x5f4597[_0x3780('0x35')](_0x48ab85)[_0x3780('0x20')](function(_0x1a95f9){return _0x1a95f9;});}return null;};}function removeEntity(_0x5bf01c,_0x5e9a10){return function(_0x22bc91){if(_0x22bc91){return _0x22bc91['destroy']()[_0x3780('0x20')](function(){_0x5bf01c[_0x3780('0x2c')](0xcc)[_0x3780('0x2d')]();});}};}function handleEntityNotFound(_0x5e0c89,_0x643bc7){return function(_0x14c2d4){if(!_0x14c2d4){_0x5e0c89[_0x3780('0x2b')](0x194);}return _0x14c2d4;};}function handleError(_0x2e44e9,_0x16232f){_0x16232f=_0x16232f||0x1f4;return function(_0x275d06){logger[_0x3780('0x26')](_0x275d06['stack']);if(_0x275d06[_0x3780('0x36')]){delete _0x275d06[_0x3780('0x36')];}_0x2e44e9[_0x3780('0x2c')](_0x16232f)[_0x3780('0x37')](_0x275d06);};}exports[_0x3780('0x38')]=function(_0xa9bcab,_0x5a8756){var _0x23c087={},_0x5d327f={},_0x160431={'count':0x0,'rows':[]};var _0x13e53b=_[_0x3780('0x39')](db[_0x3780('0x3a')][_0x3780('0x3b')],function(_0x55f235){return{'name':_0x55f235[_0x3780('0x3c')],'type':_0x55f235[_0x3780('0x3d')]['key']};});_0x5d327f['model']=_[_0x3780('0x39')](_0x13e53b,_0x3780('0x36'));_0x5d327f[_0x3780('0x3e')]=_['keys'](_0xa9bcab[_0x3780('0x3e')]);_0x5d327f[_0x3780('0x3f')]=_[_0x3780('0x40')](_0x5d327f['model'],_0x5d327f[_0x3780('0x3e')]);_0x23c087[_0x3780('0x41')]=_[_0x3780('0x40')](_0x5d327f[_0x3780('0x42')],qs['fields'](_0xa9bcab[_0x3780('0x3e')][_0x3780('0x43')]));_0x23c087[_0x3780('0x41')]=_0x23c087[_0x3780('0x41')]['length']?_0x23c087[_0x3780('0x41')]:_0x5d327f['model'];if(!_0xa9bcab[_0x3780('0x3e')][_0x3780('0x44')](_0x3780('0x45'))){_0x23c087['limit']=qs[_0x3780('0x30')](_0xa9bcab[_0x3780('0x3e')]['limit']);_0x23c087[_0x3780('0x2f')]=qs[_0x3780('0x2f')](_0xa9bcab[_0x3780('0x3e')][_0x3780('0x2f')]);}_0x23c087[_0x3780('0x46')]=qs[_0x3780('0x47')](_0xa9bcab[_0x3780('0x3e')][_0x3780('0x47')]);_0x23c087['where']=qs['filters'](_['pick'](_0xa9bcab[_0x3780('0x3e')],_0x5d327f[_0x3780('0x3f')]));if(_0xa9bcab[_0x3780('0x3e')][_0x3780('0x48')]){_0x23c087[_0x3780('0x49')]=_[_0x3780('0x4a')](_0x23c087['where'],{'$or':_[_0x3780('0x39')](_0x13e53b,function(_0x44aa99){if(_0x44aa99['type']!==_0x3780('0x4b')){var _0x5cb31a={};_0x5cb31a[_0x44aa99[_0x3780('0x36')]]={'$like':'%'+_0xa9bcab['query'][_0x3780('0x48')]+'%'};return _0x5cb31a;}})});}_0x23c087=_[_0x3780('0x4a')]({},_0x23c087,_0xa9bcab['options']);var _0x4f0a29={'where':_0x23c087[_0x3780('0x49')]};return db['Dynamics365Configuration'][_0x3780('0x4c')](_0x4f0a29)[_0x3780('0x20')](function(_0x4beac6){_0x160431['count']=_0x4beac6;if(_0xa9bcab[_0x3780('0x3e')][_0x3780('0x4d')]){_0x23c087['include']=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x23c087);})[_0x3780('0x20')](function(_0x10ec54){_0x160431[_0x3780('0x4e')]=_0x10ec54;return _0x160431;})['then'](respondWithFilteredResult(_0x5a8756,_0x23c087))[_0x3780('0x2a')](handleError(_0x5a8756,null));};exports[_0x3780('0x4f')]=function(_0x31478f,_0xb4ce84){var _0x1a65fb={'raw':![],'where':{'id':_0x31478f[_0x3780('0x50')]['id']}},_0x19cb78={};_0x19cb78[_0x3780('0x42')]=_['keys'](db[_0x3780('0x3a')][_0x3780('0x3b')]);_0x19cb78[_0x3780('0x3e')]=_[_0x3780('0x51')](_0x31478f[_0x3780('0x3e')]);_0x19cb78[_0x3780('0x3f')]=_[_0x3780('0x40')](_0x19cb78[_0x3780('0x42')],_0x19cb78[_0x3780('0x3e')]);_0x1a65fb[_0x3780('0x41')]=_['intersection'](_0x19cb78[_0x3780('0x42')],qs[_0x3780('0x43')](_0x31478f[_0x3780('0x3e')][_0x3780('0x43')]));_0x1a65fb[_0x3780('0x41')]=_0x1a65fb[_0x3780('0x41')][_0x3780('0x52')]?_0x1a65fb[_0x3780('0x41')]:_0x19cb78[_0x3780('0x42')];if(_0x31478f[_0x3780('0x3e')][_0x3780('0x4d')]){_0x1a65fb[_0x3780('0x53')]=[{'all':!![]}];}_0x1a65fb=_[_0x3780('0x4a')]({},_0x1a65fb,_0x31478f['options']);return db['Dynamics365Configuration'][_0x3780('0x54')](_0x1a65fb)[_0x3780('0x20')](handleEntityNotFound(_0xb4ce84,null))[_0x3780('0x20')](respondWithResult(_0xb4ce84,null))[_0x3780('0x2a')](handleError(_0xb4ce84,null));};exports['create']=function(_0x88ed3a,_0x5b9b71){return db[_0x3780('0x3a')]['create'](_0x88ed3a[_0x3780('0x55')],{})['then'](respondWithResult(_0x5b9b71,0xc9))[_0x3780('0x2a')](handleError(_0x5b9b71,null));};exports[_0x3780('0x35')]=function(_0x4b13b9,_0x278c4a){if(_0x4b13b9[_0x3780('0x55')]['id']){delete _0x4b13b9[_0x3780('0x55')]['id'];}return db['Dynamics365Configuration'][_0x3780('0x54')]({'where':{'id':_0x4b13b9[_0x3780('0x50')]['id']}})[_0x3780('0x20')](handleEntityNotFound(_0x278c4a,null))[_0x3780('0x20')](saveUpdates(_0x4b13b9[_0x3780('0x55')],null))[_0x3780('0x20')](respondWithResult(_0x278c4a,null))[_0x3780('0x2a')](handleError(_0x278c4a,null));};exports['destroy']=function(_0x24c250,_0xf7743f){return db[_0x3780('0x3a')][_0x3780('0x54')]({'where':{'id':_0x24c250['params']['id']}})[_0x3780('0x20')](handleEntityNotFound(_0xf7743f,null))[_0x3780('0x20')](removeEntity(_0xf7743f,null))[_0x3780('0x2a')](handleError(_0xf7743f,null));};exports[_0x3780('0x56')]=function(_0x44fddc,_0x3fe0c9,_0x5a98b5){var _0x48c23e={};var _0x3a04b={};var _0x4347c4;var _0x366f17;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x44fddc[_0x3780('0x50')]['id']}})[_0x3780('0x20')](handleEntityNotFound(_0x3fe0c9,null))[_0x3780('0x20')](function(_0x7a9ddb){if(_0x7a9ddb){_0x4347c4=_0x7a9ddb;_0x3a04b[_0x3780('0x42')]=_[_0x3780('0x51')](db[_0x3780('0x57')]['rawAttributes']);_0x3a04b['query']=_[_0x3780('0x51')](_0x44fddc[_0x3780('0x3e')]);_0x3a04b[_0x3780('0x3f')]=_['intersection'](_0x3a04b['model'],_0x3a04b[_0x3780('0x3e')]);_0x48c23e[_0x3780('0x41')]=_['intersection'](_0x3a04b[_0x3780('0x42')],qs[_0x3780('0x43')](_0x44fddc[_0x3780('0x3e')][_0x3780('0x43')]));_0x48c23e[_0x3780('0x41')]=_0x48c23e['attributes'][_0x3780('0x52')]?_0x48c23e['attributes']:_0x3a04b[_0x3780('0x42')];_0x48c23e[_0x3780('0x46')]=qs['sort'](_0x44fddc[_0x3780('0x3e')][_0x3780('0x47')]);_0x48c23e[_0x3780('0x49')]=qs[_0x3780('0x3f')](_[_0x3780('0x58')](_0x44fddc[_0x3780('0x3e')],_0x3a04b[_0x3780('0x3f')]));if(_0x44fddc[_0x3780('0x3e')][_0x3780('0x48')]){_0x48c23e[_0x3780('0x49')]=_['merge'](_0x48c23e[_0x3780('0x49')],{'$or':_[_0x3780('0x39')](_0x48c23e[_0x3780('0x41')],function(_0x46b761){var _0x352b1d={};_0x352b1d[_0x46b761]={'$like':'%'+_0x44fddc[_0x3780('0x3e')][_0x3780('0x48')]+'%'};return _0x352b1d;})});}_0x48c23e=_[_0x3780('0x4a')]({},_0x48c23e,_0x44fddc[_0x3780('0x59')]);return _0x4347c4[_0x3780('0x56')](_0x48c23e);}})[_0x3780('0x20')](function(_0x12eabc){if(_0x12eabc){_0x366f17=_0x12eabc['length'];if(!_0x44fddc[_0x3780('0x3e')][_0x3780('0x44')](_0x3780('0x45'))){_0x48c23e[_0x3780('0x30')]=qs[_0x3780('0x30')](_0x44fddc[_0x3780('0x3e')][_0x3780('0x30')]);_0x48c23e[_0x3780('0x2f')]=qs['offset'](_0x44fddc[_0x3780('0x3e')][_0x3780('0x2f')]);}return _0x4347c4['getFields'](_0x48c23e);}})[_0x3780('0x20')](function(_0x228393){if(_0x228393){return _0x228393?{'count':_0x366f17,'rows':_0x228393}:null;}})['then'](respondWithResult(_0x3fe0c9,null))[_0x3780('0x2a')](handleError(_0x3fe0c9,null));};exports[_0x3780('0x5a')]=function(_0x1ce98a,_0x5560d1,_0x283411){var _0xf3955e={};var _0x1f0c9d={};var _0x20b8d2;var _0x25db96;return db[_0x3780('0x3a')][_0x3780('0x5b')]({'where':{'id':_0x1ce98a[_0x3780('0x50')]['id']}})[_0x3780('0x20')](handleEntityNotFound(_0x5560d1,null))[_0x3780('0x20')](function(_0xaa4a27){if(_0xaa4a27){_0x20b8d2=_0xaa4a27;_0x1f0c9d[_0x3780('0x42')]=_[_0x3780('0x51')](db[_0x3780('0x57')][_0x3780('0x3b')]);_0x1f0c9d[_0x3780('0x3e')]=_[_0x3780('0x51')](_0x1ce98a[_0x3780('0x3e')]);_0x1f0c9d['filters']=_[_0x3780('0x40')](_0x1f0c9d[_0x3780('0x42')],_0x1f0c9d[_0x3780('0x3e')]);_0xf3955e[_0x3780('0x41')]=_[_0x3780('0x40')](_0x1f0c9d['model'],qs[_0x3780('0x43')](_0x1ce98a[_0x3780('0x3e')]['fields']));_0xf3955e[_0x3780('0x41')]=_0xf3955e[_0x3780('0x41')]['length']?_0xf3955e[_0x3780('0x41')]:_0x1f0c9d[_0x3780('0x42')];_0xf3955e[_0x3780('0x46')]=qs[_0x3780('0x47')](_0x1ce98a[_0x3780('0x3e')]['sort']);_0xf3955e[_0x3780('0x49')]=qs[_0x3780('0x3f')](_['pick'](_0x1ce98a[_0x3780('0x3e')],_0x1f0c9d[_0x3780('0x3f')]));if(_0x1ce98a[_0x3780('0x3e')][_0x3780('0x48')]){_0xf3955e[_0x3780('0x49')]=_['merge'](_0xf3955e['where'],{'$or':_[_0x3780('0x39')](_0xf3955e[_0x3780('0x41')],function(_0x162283){var _0xd2891a={};_0xd2891a[_0x162283]={'$like':'%'+_0x1ce98a['query'][_0x3780('0x48')]+'%'};return _0xd2891a;})});}_0xf3955e=_['merge']({},_0xf3955e,_0x1ce98a['options']);return _0x20b8d2[_0x3780('0x5a')](_0xf3955e);}})[_0x3780('0x20')](function(_0x4a2751){if(_0x4a2751){_0x25db96=_0x4a2751[_0x3780('0x52')];if(!_0x1ce98a[_0x3780('0x3e')][_0x3780('0x44')](_0x3780('0x45'))){_0xf3955e[_0x3780('0x30')]=qs[_0x3780('0x30')](_0x1ce98a['query']['limit']);_0xf3955e[_0x3780('0x2f')]=qs['offset'](_0x1ce98a[_0x3780('0x3e')][_0x3780('0x2f')]);}return _0x20b8d2['getSubjects'](_0xf3955e);}})[_0x3780('0x20')](function(_0x101c03){if(_0x101c03){return _0x101c03?{'count':_0x25db96,'rows':_0x101c03}:null;}})[_0x3780('0x20')](respondWithResult(_0x5560d1,null))[_0x3780('0x2a')](handleError(_0x5560d1,null));};exports[_0x3780('0x5c')]=function(_0x14dc56,_0x21aea7,_0x490448){var _0x4271ae={};var _0x5c1315={};var _0x1c89ae;var _0x153436;return db[_0x3780('0x3a')][_0x3780('0x5b')]({'where':{'id':_0x14dc56['params']['id']}})[_0x3780('0x20')](handleEntityNotFound(_0x21aea7,null))[_0x3780('0x20')](function(_0x3242c7){if(_0x3242c7){_0x1c89ae=_0x3242c7;_0x5c1315[_0x3780('0x42')]=_[_0x3780('0x51')](db[_0x3780('0x57')][_0x3780('0x3b')]);_0x5c1315[_0x3780('0x3e')]=_[_0x3780('0x51')](_0x14dc56['query']);_0x5c1315[_0x3780('0x3f')]=_[_0x3780('0x40')](_0x5c1315[_0x3780('0x42')],_0x5c1315['query']);_0x4271ae['attributes']=_[_0x3780('0x40')](_0x5c1315[_0x3780('0x42')],qs[_0x3780('0x43')](_0x14dc56[_0x3780('0x3e')]['fields']));_0x4271ae[_0x3780('0x41')]=_0x4271ae[_0x3780('0x41')][_0x3780('0x52')]?_0x4271ae[_0x3780('0x41')]:_0x5c1315[_0x3780('0x42')];_0x4271ae[_0x3780('0x46')]=qs['sort'](_0x14dc56[_0x3780('0x3e')][_0x3780('0x47')]);_0x4271ae[_0x3780('0x49')]=qs[_0x3780('0x3f')](_['pick'](_0x14dc56[_0x3780('0x3e')],_0x5c1315[_0x3780('0x3f')]));if(_0x14dc56['query'][_0x3780('0x48')]){_0x4271ae[_0x3780('0x49')]=_[_0x3780('0x4a')](_0x4271ae[_0x3780('0x49')],{'$or':_['map'](_0x4271ae[_0x3780('0x41')],function(_0x25f5f9){var _0x24a49a={};_0x24a49a[_0x25f5f9]={'$like':'%'+_0x14dc56[_0x3780('0x3e')][_0x3780('0x48')]+'%'};return _0x24a49a;})});}_0x4271ae=_['merge']({},_0x4271ae,_0x14dc56['options']);return _0x1c89ae[_0x3780('0x5c')](_0x4271ae);}})['then'](function(_0x6f9b56){if(_0x6f9b56){_0x153436=_0x6f9b56['length'];if(!_0x14dc56[_0x3780('0x3e')]['hasOwnProperty'](_0x3780('0x45'))){_0x4271ae[_0x3780('0x30')]=qs['limit'](_0x14dc56[_0x3780('0x3e')]['limit']);_0x4271ae[_0x3780('0x2f')]=qs['offset'](_0x14dc56[_0x3780('0x3e')]['offset']);}return _0x1c89ae[_0x3780('0x5c')](_0x4271ae);}})[_0x3780('0x20')](function(_0x361baf){if(_0x361baf){return _0x361baf?{'count':_0x153436,'rows':_0x361baf}:null;}})['then'](respondWithResult(_0x21aea7,null))[_0x3780('0x2a')](handleError(_0x21aea7,null));}; \ No newline at end of file +var _0xf68f=['send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','Dynamics365Configuration','findAll','show','find','body','params','findOne','Dynamics365Field','getFields','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','Sequelize','ValidationError','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xf68f,0xdd));var _0xff68=function(_0x5b4289,_0x5e13fa){_0x5b4289=_0x5b4289-0x0;var _0x583e7a=_0xf68f[_0x5b4289];return _0x583e7a;};'use strict';var pdf=require(_0xff68('0x0'));var emlformat=require(_0xff68('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xff68('0x2'));var jsonpatch=require(_0xff68('0x3'));var rp=require(_0xff68('0x4'));var moment=require(_0xff68('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xff68('0x6'));var path=require(_0xff68('0x7'));var sox=require(_0xff68('0x8'));var csv=require(_0xff68('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xff68('0xa'));var squel=require(_0xff68('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xff68('0xc'));var toCsv=require(_0xff68('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xff68('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xff68('0xe'));var as=require(_0xff68('0xf'));var hardwareService=require(_0xff68('0x10'));var logger=require(_0xff68('0x11'))(_0xff68('0x12'));var utils=require(_0xff68('0x13'));var config=require('../../config/environment');var db=require(_0xff68('0x14'))['db'];var jayson=require(_0xff68('0x15'));var client=jayson['client'][_0xff68('0x16')]({'port':0x232a});function checkPasswordPattern(_0x1a8a35,_0x44e597,_0x22d5e3){if(_0x22d5e3){var _0x4fed44=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4fed44['test'](_0x44e597)){return _0x1a8a35;}else{throw new db[(_0xff68('0x17'))][(_0xff68('0x18'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1a8a35;}}function respondWithRpcPromise(_0x254a55,_0xbe5294,_0x2b4f6a,_0x10e88f){return new BPromise(function(_0x12f128,_0x15f22a){var _0x2104f1=_0x10e88f||client;return _0x2104f1[_0xff68('0x19')](_0x254a55,_0x2b4f6a)['then'](function(_0x1f6392){logger[_0xff68('0x1a')](_0xff68('0x1b'),_0xbe5294,_0xff68('0x1c'));logger[_0xff68('0x1d')](_0xff68('0x1e'),_0xbe5294,'request\x20sent',JSON['stringify'](_0x1f6392));if(_0x1f6392[_0xff68('0x1f')]){if(_0x1f6392[_0xff68('0x1f')][_0xff68('0x20')]===0x1f4){logger[_0xff68('0x1f')](_0xff68('0x1b'),_0xbe5294,_0x1f6392[_0xff68('0x1f')]['message']);return _0x15f22a(_0x1f6392[_0xff68('0x1f')][_0xff68('0x21')]);}logger[_0xff68('0x1f')](_0xff68('0x1b'),_0xbe5294,_0x1f6392['error']['message']);return _0x12f128(_0x1f6392[_0xff68('0x1f')][_0xff68('0x21')]);}else{logger['info'](_0xff68('0x1b'),_0xbe5294,'request\x20sent');_0x12f128(_0x1f6392[_0xff68('0x22')][_0xff68('0x21')]);}})[_0xff68('0x23')](function(_0x5bb47d){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0xbe5294,_0x5bb47d);_0x15f22a(_0x5bb47d);});});}function respondWithStatusCode(_0x3202d8,_0x1f5277){_0x1f5277=_0x1f5277||0xcc;return function(_0x247f1c){if(_0x247f1c){return _0x3202d8[_0xff68('0x24')](_0x1f5277);}return _0x3202d8[_0xff68('0x25')](_0x1f5277)['end']();};}function respondWithResult(_0x2d399d,_0x1f7fee){_0x1f7fee=_0x1f7fee||0xc8;return function(_0x1cbcab){if(_0x1cbcab){return _0x2d399d[_0xff68('0x25')](_0x1f7fee)[_0xff68('0x26')](_0x1cbcab);}};}function respondWithFilteredResult(_0x43d7ec,_0x1eb8af){return function(_0x23efe0){if(_0x23efe0){var _0x461e0b=_0x23efe0[_0xff68('0x27')],_0x3efc50=_0x1eb8af['offset'],_0x222f8c=_0x1eb8af['offset']+_0x1eb8af[_0xff68('0x28')],_0x334bfe;if(_0x222f8c>=_0x461e0b){_0x222f8c=_0x461e0b;_0x334bfe=0xc8;}else{_0x334bfe=0xce;}_0x43d7ec[_0xff68('0x25')](_0x334bfe);return _0x43d7ec[_0xff68('0x29')](_0xff68('0x2a'),_0x3efc50+'-'+_0x222f8c+'/'+_0x461e0b)['json'](_0x23efe0);}return null;};}function patchUpdates(_0x40d96b){return function(_0x42e6c8){try{jsonpatch[_0xff68('0x2b')](_0x42e6c8,_0x40d96b,!![]);}catch(_0x29a953){return BPromise[_0xff68('0x2c')](_0x29a953);}return _0x42e6c8[_0xff68('0x2d')]();};}function saveUpdates(_0x5d8951,_0x1fbbd1){return function(_0x27a58b){if(_0x27a58b){return _0x27a58b[_0xff68('0x2e')](_0x5d8951)[_0xff68('0x2f')](function(_0x29efe6){return _0x29efe6;});}return null;};}function removeEntity(_0x45ccfa,_0x1ab5f2){return function(_0x522ba6){if(_0x522ba6){return _0x522ba6[_0xff68('0x30')]()[_0xff68('0x2f')](function(){_0x45ccfa[_0xff68('0x25')](0xcc)[_0xff68('0x31')]();});}};}function handleEntityNotFound(_0x390f82,_0x18b79e){return function(_0x265924){if(!_0x265924){_0x390f82[_0xff68('0x24')](0x194);}return _0x265924;};}function handleError(_0x569283,_0x50dc00){_0x50dc00=_0x50dc00||0x1f4;return function(_0x3978b6){logger[_0xff68('0x1f')](_0x3978b6[_0xff68('0x32')]);if(_0x3978b6[_0xff68('0x33')]){delete _0x3978b6[_0xff68('0x33')];}_0x569283[_0xff68('0x25')](_0x50dc00)[_0xff68('0x34')](_0x3978b6);};}exports[_0xff68('0x35')]=function(_0x184b29,_0x38a99e){var _0x2d7426={},_0x1f6272={},_0xdfc2ed={'count':0x0,'rows':[]};var _0x39eb91=_['map'](db['Dynamics365Configuration'][_0xff68('0x36')],function(_0x2c4a3b){return{'name':_0x2c4a3b[_0xff68('0x37')],'type':_0x2c4a3b[_0xff68('0x38')][_0xff68('0x39')]};});_0x1f6272[_0xff68('0x3a')]=_[_0xff68('0x3b')](_0x39eb91,_0xff68('0x33'));_0x1f6272[_0xff68('0x3c')]=_[_0xff68('0x3d')](_0x184b29[_0xff68('0x3c')]);_0x1f6272[_0xff68('0x3e')]=_[_0xff68('0x3f')](_0x1f6272['model'],_0x1f6272[_0xff68('0x3c')]);_0x2d7426[_0xff68('0x40')]=_[_0xff68('0x3f')](_0x1f6272[_0xff68('0x3a')],qs[_0xff68('0x41')](_0x184b29[_0xff68('0x3c')][_0xff68('0x41')]));_0x2d7426[_0xff68('0x40')]=_0x2d7426[_0xff68('0x40')][_0xff68('0x42')]?_0x2d7426[_0xff68('0x40')]:_0x1f6272[_0xff68('0x3a')];if(!_0x184b29[_0xff68('0x3c')][_0xff68('0x43')]('nolimit')){_0x2d7426[_0xff68('0x28')]=qs[_0xff68('0x28')](_0x184b29[_0xff68('0x3c')]['limit']);_0x2d7426[_0xff68('0x44')]=qs[_0xff68('0x44')](_0x184b29[_0xff68('0x3c')][_0xff68('0x44')]);}_0x2d7426[_0xff68('0x45')]=qs[_0xff68('0x46')](_0x184b29[_0xff68('0x3c')]['sort']);_0x2d7426['where']=qs[_0xff68('0x3e')](_[_0xff68('0x47')](_0x184b29[_0xff68('0x3c')],_0x1f6272[_0xff68('0x3e')]));if(_0x184b29[_0xff68('0x3c')][_0xff68('0x48')]){_0x2d7426[_0xff68('0x49')]=_[_0xff68('0x4a')](_0x2d7426[_0xff68('0x49')],{'$or':_[_0xff68('0x3b')](_0x39eb91,function(_0x46bf1d){if(_0x46bf1d[_0xff68('0x38')]!==_0xff68('0x4b')){var _0xf50d9d={};_0xf50d9d[_0x46bf1d[_0xff68('0x33')]]={'$like':'%'+_0x184b29['query']['filter']+'%'};return _0xf50d9d;}})});}_0x2d7426=_[_0xff68('0x4a')]({},_0x2d7426,_0x184b29[_0xff68('0x4c')]);var _0x5a9677={'where':_0x2d7426[_0xff68('0x49')]};return db['Dynamics365Configuration']['count'](_0x5a9677)[_0xff68('0x2f')](function(_0x3bea55){_0xdfc2ed[_0xff68('0x27')]=_0x3bea55;if(_0x184b29[_0xff68('0x3c')][_0xff68('0x4d')]){_0x2d7426[_0xff68('0x4e')]=[{'all':!![]}];}return db[_0xff68('0x4f')][_0xff68('0x50')](_0x2d7426);})['then'](function(_0x1311ca){_0xdfc2ed['rows']=_0x1311ca;return _0xdfc2ed;})[_0xff68('0x2f')](respondWithFilteredResult(_0x38a99e,_0x2d7426))[_0xff68('0x23')](handleError(_0x38a99e,null));};exports[_0xff68('0x51')]=function(_0x25098c,_0x6ab40a){var _0x417519={'raw':![],'where':{'id':_0x25098c['params']['id']}},_0x3c7471={};_0x3c7471[_0xff68('0x3a')]=_[_0xff68('0x3d')](db['Dynamics365Configuration'][_0xff68('0x36')]);_0x3c7471[_0xff68('0x3c')]=_[_0xff68('0x3d')](_0x25098c[_0xff68('0x3c')]);_0x3c7471[_0xff68('0x3e')]=_[_0xff68('0x3f')](_0x3c7471['model'],_0x3c7471['query']);_0x417519['attributes']=_['intersection'](_0x3c7471['model'],qs['fields'](_0x25098c[_0xff68('0x3c')][_0xff68('0x41')]));_0x417519[_0xff68('0x40')]=_0x417519[_0xff68('0x40')][_0xff68('0x42')]?_0x417519[_0xff68('0x40')]:_0x3c7471['model'];if(_0x25098c['query']['includeAll']){_0x417519[_0xff68('0x4e')]=[{'all':!![]}];}_0x417519=_[_0xff68('0x4a')]({},_0x417519,_0x25098c[_0xff68('0x4c')]);return db[_0xff68('0x4f')][_0xff68('0x52')](_0x417519)[_0xff68('0x2f')](handleEntityNotFound(_0x6ab40a,null))[_0xff68('0x2f')](respondWithResult(_0x6ab40a,null))[_0xff68('0x23')](handleError(_0x6ab40a,null));};exports['create']=function(_0x1890fa,_0x2c2f58){return db[_0xff68('0x4f')]['create'](_0x1890fa[_0xff68('0x53')],{})[_0xff68('0x2f')](respondWithResult(_0x2c2f58,0xc9))['catch'](handleError(_0x2c2f58,null));};exports['update']=function(_0x5ab5fb,_0x40a256){if(_0x5ab5fb['body']['id']){delete _0x5ab5fb[_0xff68('0x53')]['id'];}return db[_0xff68('0x4f')][_0xff68('0x52')]({'where':{'id':_0x5ab5fb[_0xff68('0x54')]['id']}})[_0xff68('0x2f')](handleEntityNotFound(_0x40a256,null))[_0xff68('0x2f')](saveUpdates(_0x5ab5fb[_0xff68('0x53')],null))[_0xff68('0x2f')](respondWithResult(_0x40a256,null))['catch'](handleError(_0x40a256,null));};exports[_0xff68('0x30')]=function(_0x38905e,_0x545f62){return db[_0xff68('0x4f')][_0xff68('0x52')]({'where':{'id':_0x38905e[_0xff68('0x54')]['id']}})[_0xff68('0x2f')](handleEntityNotFound(_0x545f62,null))[_0xff68('0x2f')](removeEntity(_0x545f62,null))[_0xff68('0x23')](handleError(_0x545f62,null));};exports['getFields']=function(_0x42f926,_0x59f10e,_0x481b80){var _0x501a23={};var _0x298a95={};var _0x433074;var _0x38c796;return db[_0xff68('0x4f')][_0xff68('0x55')]({'where':{'id':_0x42f926['params']['id']}})[_0xff68('0x2f')](handleEntityNotFound(_0x59f10e,null))[_0xff68('0x2f')](function(_0x40c9a0){if(_0x40c9a0){_0x433074=_0x40c9a0;_0x298a95[_0xff68('0x3a')]=_[_0xff68('0x3d')](db[_0xff68('0x56')]['rawAttributes']);_0x298a95[_0xff68('0x3c')]=_[_0xff68('0x3d')](_0x42f926[_0xff68('0x3c')]);_0x298a95['filters']=_[_0xff68('0x3f')](_0x298a95[_0xff68('0x3a')],_0x298a95[_0xff68('0x3c')]);_0x501a23['attributes']=_['intersection'](_0x298a95['model'],qs[_0xff68('0x41')](_0x42f926['query'][_0xff68('0x41')]));_0x501a23[_0xff68('0x40')]=_0x501a23[_0xff68('0x40')]['length']?_0x501a23[_0xff68('0x40')]:_0x298a95[_0xff68('0x3a')];_0x501a23[_0xff68('0x45')]=qs[_0xff68('0x46')](_0x42f926[_0xff68('0x3c')][_0xff68('0x46')]);_0x501a23['where']=qs[_0xff68('0x3e')](_[_0xff68('0x47')](_0x42f926[_0xff68('0x3c')],_0x298a95[_0xff68('0x3e')]));if(_0x42f926[_0xff68('0x3c')][_0xff68('0x48')]){_0x501a23['where']=_[_0xff68('0x4a')](_0x501a23[_0xff68('0x49')],{'$or':_[_0xff68('0x3b')](_0x501a23[_0xff68('0x40')],function(_0x2d905c){var _0x3cc609={};_0x3cc609[_0x2d905c]={'$like':'%'+_0x42f926[_0xff68('0x3c')][_0xff68('0x48')]+'%'};return _0x3cc609;})});}_0x501a23=_['merge']({},_0x501a23,_0x42f926[_0xff68('0x4c')]);return _0x433074[_0xff68('0x57')](_0x501a23);}})[_0xff68('0x2f')](function(_0x44864e){if(_0x44864e){_0x38c796=_0x44864e[_0xff68('0x42')];if(!_0x42f926[_0xff68('0x3c')][_0xff68('0x43')](_0xff68('0x58'))){_0x501a23[_0xff68('0x28')]=qs['limit'](_0x42f926['query'][_0xff68('0x28')]);_0x501a23[_0xff68('0x44')]=qs['offset'](_0x42f926[_0xff68('0x3c')]['offset']);}return _0x433074['getFields'](_0x501a23);}})['then'](function(_0x3ebd85){if(_0x3ebd85){return _0x3ebd85?{'count':_0x38c796,'rows':_0x3ebd85}:null;}})[_0xff68('0x2f')](respondWithResult(_0x59f10e,null))[_0xff68('0x23')](handleError(_0x59f10e,null));};exports[_0xff68('0x59')]=function(_0x311e98,_0x1d90c3,_0x351a06){var _0x12e95b={};var _0x3ab9db={};var _0xe0ac3f;var _0x5c8053;return db[_0xff68('0x4f')][_0xff68('0x55')]({'where':{'id':_0x311e98[_0xff68('0x54')]['id']}})[_0xff68('0x2f')](handleEntityNotFound(_0x1d90c3,null))['then'](function(_0x4ca457){if(_0x4ca457){_0xe0ac3f=_0x4ca457;_0x3ab9db['model']=_['keys'](db[_0xff68('0x56')][_0xff68('0x36')]);_0x3ab9db[_0xff68('0x3c')]=_['keys'](_0x311e98[_0xff68('0x3c')]);_0x3ab9db[_0xff68('0x3e')]=_[_0xff68('0x3f')](_0x3ab9db[_0xff68('0x3a')],_0x3ab9db[_0xff68('0x3c')]);_0x12e95b[_0xff68('0x40')]=_[_0xff68('0x3f')](_0x3ab9db[_0xff68('0x3a')],qs[_0xff68('0x41')](_0x311e98['query'][_0xff68('0x41')]));_0x12e95b[_0xff68('0x40')]=_0x12e95b['attributes'][_0xff68('0x42')]?_0x12e95b['attributes']:_0x3ab9db['model'];_0x12e95b[_0xff68('0x45')]=qs['sort'](_0x311e98['query'][_0xff68('0x46')]);_0x12e95b['where']=qs[_0xff68('0x3e')](_[_0xff68('0x47')](_0x311e98[_0xff68('0x3c')],_0x3ab9db[_0xff68('0x3e')]));if(_0x311e98[_0xff68('0x3c')][_0xff68('0x48')]){_0x12e95b[_0xff68('0x49')]=_['merge'](_0x12e95b['where'],{'$or':_[_0xff68('0x3b')](_0x12e95b[_0xff68('0x40')],function(_0x55c32b){var _0x8f12cc={};_0x8f12cc[_0x55c32b]={'$like':'%'+_0x311e98[_0xff68('0x3c')]['filter']+'%'};return _0x8f12cc;})});}_0x12e95b=_[_0xff68('0x4a')]({},_0x12e95b,_0x311e98[_0xff68('0x4c')]);return _0xe0ac3f[_0xff68('0x59')](_0x12e95b);}})[_0xff68('0x2f')](function(_0x16cb96){if(_0x16cb96){_0x5c8053=_0x16cb96[_0xff68('0x42')];if(!_0x311e98[_0xff68('0x3c')][_0xff68('0x43')](_0xff68('0x58'))){_0x12e95b['limit']=qs[_0xff68('0x28')](_0x311e98['query'][_0xff68('0x28')]);_0x12e95b[_0xff68('0x44')]=qs[_0xff68('0x44')](_0x311e98[_0xff68('0x3c')][_0xff68('0x44')]);}return _0xe0ac3f[_0xff68('0x59')](_0x12e95b);}})[_0xff68('0x2f')](function(_0x464571){if(_0x464571){return _0x464571?{'count':_0x5c8053,'rows':_0x464571}:null;}})[_0xff68('0x2f')](respondWithResult(_0x1d90c3,null))[_0xff68('0x23')](handleError(_0x1d90c3,null));};exports[_0xff68('0x5a')]=function(_0x13717f,_0x424582,_0x5488fe){var _0x395c15={};var _0x533194={};var _0x31cd87;var _0x56536c;return db[_0xff68('0x4f')][_0xff68('0x55')]({'where':{'id':_0x13717f[_0xff68('0x54')]['id']}})[_0xff68('0x2f')](handleEntityNotFound(_0x424582,null))[_0xff68('0x2f')](function(_0x530cbd){if(_0x530cbd){_0x31cd87=_0x530cbd;_0x533194[_0xff68('0x3a')]=_['keys'](db[_0xff68('0x56')][_0xff68('0x36')]);_0x533194[_0xff68('0x3c')]=_[_0xff68('0x3d')](_0x13717f[_0xff68('0x3c')]);_0x533194[_0xff68('0x3e')]=_[_0xff68('0x3f')](_0x533194[_0xff68('0x3a')],_0x533194['query']);_0x395c15[_0xff68('0x40')]=_[_0xff68('0x3f')](_0x533194[_0xff68('0x3a')],qs['fields'](_0x13717f[_0xff68('0x3c')]['fields']));_0x395c15['attributes']=_0x395c15[_0xff68('0x40')][_0xff68('0x42')]?_0x395c15[_0xff68('0x40')]:_0x533194['model'];_0x395c15[_0xff68('0x45')]=qs[_0xff68('0x46')](_0x13717f[_0xff68('0x3c')]['sort']);_0x395c15['where']=qs[_0xff68('0x3e')](_[_0xff68('0x47')](_0x13717f[_0xff68('0x3c')],_0x533194[_0xff68('0x3e')]));if(_0x13717f[_0xff68('0x3c')][_0xff68('0x48')]){_0x395c15[_0xff68('0x49')]=_[_0xff68('0x4a')](_0x395c15[_0xff68('0x49')],{'$or':_[_0xff68('0x3b')](_0x395c15[_0xff68('0x40')],function(_0x1928eb){var _0x2e8925={};_0x2e8925[_0x1928eb]={'$like':'%'+_0x13717f['query'][_0xff68('0x48')]+'%'};return _0x2e8925;})});}_0x395c15=_['merge']({},_0x395c15,_0x13717f['options']);return _0x31cd87[_0xff68('0x5a')](_0x395c15);}})[_0xff68('0x2f')](function(_0xc4aa01){if(_0xc4aa01){_0x56536c=_0xc4aa01[_0xff68('0x42')];if(!_0x13717f[_0xff68('0x3c')][_0xff68('0x43')](_0xff68('0x58'))){_0x395c15[_0xff68('0x28')]=qs[_0xff68('0x28')](_0x13717f['query'][_0xff68('0x28')]);_0x395c15[_0xff68('0x44')]=qs[_0xff68('0x44')](_0x13717f['query'][_0xff68('0x44')]);}return _0x31cd87[_0xff68('0x5a')](_0x395c15);}})['then'](function(_0xd0b14){if(_0xd0b14){return _0xd0b14?{'count':_0x56536c,'rows':_0xd0b14}:null;}})[_0xff68('0x2f')](respondWithResult(_0x424582,null))[_0xff68('0x23')](handleError(_0x424582,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 017cf06..9b15b4e 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 _0xa385=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration'];(function(_0x81119e,_0x1789cc){var _0x26bc19=function(_0x1ecaaf){while(--_0x1ecaaf){_0x81119e['push'](_0x81119e['shift']());}};_0x26bc19(++_0x1789cc);}(_0xa385,0x150));var _0x5a38=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xa385[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x5a38('0x0'));var util=require(_0x5a38('0x1'));var logger=require(_0x5a38('0x2'))(_0x5a38('0x3'));var moment=require(_0x5a38('0x4'));var BPromise=require(_0x5a38('0x5'));var rp=require(_0x5a38('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a38('0x7'));var config=require(_0x5a38('0x8'));var attributes=require(_0x5a38('0x9'));module['exports']=function(_0x419fa1,_0x5aac27){return _0x419fa1[_0x5a38('0xa')](_0x5a38('0xb'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5689=['./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4b10cc,_0xfe8b79){var _0x2ebfd9=function(_0x19f33e){while(--_0x19f33e){_0x4b10cc['push'](_0x4b10cc['shift']());}};_0x2ebfd9(++_0xfe8b79);}(_0x5689,0x108));var _0x9568=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0x5689[_0x121b1a];return _0x2d89a6;};'use strict';var _=require(_0x9568('0x0'));var util=require('util');var logger=require(_0x9568('0x1'))(_0x9568('0x2'));var moment=require(_0x9568('0x3'));var BPromise=require(_0x9568('0x4'));var rp=require(_0x9568('0x5'));var fs=require('fs');var path=require(_0x9568('0x6'));var rimraf=require(_0x9568('0x7'));var config=require(_0x9568('0x8'));var attributes=require(_0x9568('0x9'));module[_0x9568('0xa')]=function(_0x17f8a8,_0x31ab7b){return _0x17f8a8['define'](_0x9568('0xb'),attributes,{'tableName':_0x9568('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index ccbdbc4..9a1d8b4 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 _0xbec2=['bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','util','moment'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xbec2,0x12a));var _0x2bec=function(_0x20d9c2,_0x3bd11a){_0x20d9c2=_0x20d9c2-0x0;var _0x47488b=_0xbec2[_0x20d9c2];return _0x47488b;};'use strict';var _=require('lodash');var util=require(_0x2bec('0x0'));var moment=require(_0x2bec('0x1'));var BPromise=require(_0x2bec('0x2'));var rs=require(_0x2bec('0x3'));var fs=require('fs');var Redis=require(_0x2bec('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2bec('0x5'))(_0x2bec('0x6'));var config=require('../../config/environment');var jayson=require(_0x2bec('0x7'));var client=jayson[_0x2bec('0x8')][_0x2bec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18aaf7,_0x5f47cb,_0x1326a8){return new BPromise(function(_0x49a940,_0x55f0ce){return client[_0x2bec('0xa')](_0x18aaf7,_0x1326a8)['then'](function(_0x3805dc){logger[_0x2bec('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5f47cb,'request\x20sent');logger['debug'](_0x2bec('0xc'),_0x5f47cb,_0x2bec('0xd'),JSON[_0x2bec('0xe')](_0x3805dc));if(_0x3805dc[_0x2bec('0xf')]){if(_0x3805dc['error']['code']===0x1f4){logger[_0x2bec('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5f47cb,_0x3805dc[_0x2bec('0xf')][_0x2bec('0x10')]);return _0x55f0ce(_0x3805dc[_0x2bec('0xf')][_0x2bec('0x10')]);}logger[_0x2bec('0xf')](_0x2bec('0x11'),_0x5f47cb,_0x3805dc['error']['message']);return _0x49a940(_0x3805dc[_0x2bec('0xf')][_0x2bec('0x10')]);}else{logger[_0x2bec('0xb')](_0x2bec('0x11'),_0x5f47cb,'request\x20sent');_0x49a940(_0x3805dc[_0x2bec('0x12')][_0x2bec('0x10')]);}})[_0x2bec('0x13')](function(_0xcac9c7){logger[_0x2bec('0xf')](_0x2bec('0x11'),_0x5f47cb,_0xcac9c7);_0x55f0ce(_0xcac9c7);});});} \ No newline at end of file +var _0x1eb7=['error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xba204f,_0x17ea2d){var _0x4b08ab=function(_0x12e115){while(--_0x12e115){_0xba204f['push'](_0xba204f['shift']());}};_0x4b08ab(++_0x17ea2d);}(_0x1eb7,0x138));var _0x71eb=function(_0x400bb0,_0x17b35e){_0x400bb0=_0x400bb0-0x0;var _0x37a6fb=_0x1eb7[_0x400bb0];return _0x37a6fb;};'use strict';var _=require(_0x71eb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x71eb('0x1'));var fs=require('fs');var Redis=require(_0x71eb('0x2'));var db=require(_0x71eb('0x3'))['db'];var utils=require(_0x71eb('0x4'));var logger=require('../../config/logger')(_0x71eb('0x5'));var config=require(_0x71eb('0x6'));var jayson=require(_0x71eb('0x7'));var client=jayson['client'][_0x71eb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dacb2,_0x34aeec,_0x35c0b3){return new BPromise(function(_0xaf84b,_0xd0628b){return client['request'](_0x4dacb2,_0x35c0b3)[_0x71eb('0x9')](function(_0x4a42d0){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x34aeec,'request\x20sent');logger['debug'](_0x71eb('0xa'),_0x34aeec,_0x71eb('0xb'),JSON['stringify'](_0x4a42d0));if(_0x4a42d0[_0x71eb('0xc')]){if(_0x4a42d0[_0x71eb('0xc')][_0x71eb('0xd')]===0x1f4){logger[_0x71eb('0xc')](_0x71eb('0xe'),_0x34aeec,_0x4a42d0[_0x71eb('0xc')][_0x71eb('0xf')]);return _0xd0628b(_0x4a42d0[_0x71eb('0xc')][_0x71eb('0xf')]);}logger['error'](_0x71eb('0xe'),_0x34aeec,_0x4a42d0[_0x71eb('0xc')][_0x71eb('0xf')]);return _0xaf84b(_0x4a42d0[_0x71eb('0xc')]['message']);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x34aeec,_0x71eb('0xb'));_0xaf84b(_0x4a42d0[_0x71eb('0x10')]['message']);}})[_0x71eb('0x11')](function(_0x3e01f0){logger[_0x71eb('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x34aeec,_0x3e01f0);_0xd0628b(_0x3e01f0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index aa7fe3d..ec021b7 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 _0x41bb=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer'];(function(_0x2c8a17,_0x1841c4){var _0x126c37=function(_0x2b733d){while(--_0x2b733d){_0x2c8a17['push'](_0x2c8a17['shift']());}};_0x126c37(++_0x1841c4);}(_0x41bb,0xc5));var _0xb41b=function(_0x3387c8,_0x54cc53){_0x3387c8=_0x3387c8-0x0;var _0x78ae0c=_0x41bb[_0x3387c8];return _0x78ae0c;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var auth=require(_0xb41b('0x4'));var interaction=require(_0xb41b('0x5'));var config=require(_0xb41b('0x6'));var controller=require('./intDynamics365Field.controller');router[_0xb41b('0x7')]('/',auth[_0xb41b('0x8')](),controller[_0xb41b('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb41b('0xa')]);router[_0xb41b('0xb')]('/',auth['isAuthenticated'](),controller[_0xb41b('0xc')]);router[_0xb41b('0xd')](_0xb41b('0xe'),auth[_0xb41b('0x8')](),controller[_0xb41b('0xf')]);router[_0xb41b('0x10')](_0xb41b('0xe'),auth['isAuthenticated'](),controller[_0xb41b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x49e9=['util','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer'];(function(_0x5812a9,_0x5293cf){var _0x96f750=function(_0x3747d3){while(--_0x3747d3){_0x5812a9['push'](_0x5812a9['shift']());}};_0x96f750(++_0x5293cf);}(_0x49e9,0x10f));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x949e('0x0'));var util=require(_0x949e('0x1'));var path=require('path');var timeout=require(_0x949e('0x2'));var express=require(_0x949e('0x3'));var router=express[_0x949e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x949e('0x5'));var controller=require('./intDynamics365Field.controller');router[_0x949e('0x6')]('/',auth[_0x949e('0x7')](),controller[_0x949e('0x8')]);router['get'](_0x949e('0x9'),auth[_0x949e('0x7')](),controller[_0x949e('0xa')]);router[_0x949e('0xb')]('/',auth[_0x949e('0x7')](),controller[_0x949e('0xc')]);router[_0x949e('0xd')]('/:id',auth[_0x949e('0x7')](),controller['update']);router[_0x949e('0xe')](_0x949e('0x9'),auth[_0x949e('0x7')](),controller['destroy']);module[_0x949e('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 5281043..c92e5de 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 _0x3045=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string'];(function(_0x2dc28f,_0x3b0c6c){var _0xeed1ef=function(_0x2b8553){while(--_0x2b8553){_0x2dc28f['push'](_0x2dc28f['shift']());}};_0xeed1ef(++_0x3b0c6c);}(_0x3045,0x134));var _0x5304=function(_0x45d7da,_0x5c843a){_0x45d7da=_0x45d7da-0x0;var _0x1b8372=_0x3045[_0x45d7da];return _0x1b8372;};'use strict';var Sequelize=require(_0x5304('0x0'));module[_0x5304('0x1')]={'type':{'type':Sequelize[_0x5304('0x2')]('string',_0x5304('0x3'),_0x5304('0x4'),_0x5304('0x5')),'defaultValue':_0x5304('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x5304('0x3'),_0x5304('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5304('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5304('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5304('0x7')]}}; \ No newline at end of file +var _0x98b7=['keyValue','STRING','ENUM','customVariable','sequelize','string','variable'];(function(_0xba5a8a,_0xb328f3){var _0x5219b6=function(_0x3c7b4f){while(--_0x3c7b4f){_0xba5a8a['push'](_0xba5a8a['shift']());}};_0x5219b6(++_0xb328f3);}(_0x98b7,0xcf));var _0x798b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x98b7[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x798b('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x798b('0x1'),_0x798b('0x2'),'customVariable',_0x798b('0x3')),'defaultValue':_0x798b('0x1')},'content':{'type':Sequelize[_0x798b('0x4')]},'key':{'type':Sequelize[_0x798b('0x4')]},'keyType':{'type':Sequelize[_0x798b('0x5')](_0x798b('0x1'),_0x798b('0x2'),_0x798b('0x6'))},'keyContent':{'type':Sequelize[_0x798b('0x4')]},'idField':{'type':Sequelize[_0x798b('0x4')]},'nameField':{'type':Sequelize[_0x798b('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x798b('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 8b26ef6..02d0ff6 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 _0xab54=['keys','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','update','then','destroy','error','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xab54,0x115));var _0x4ab5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab54[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4ab5('0x0'));var rimraf=require(_0x4ab5('0x1'));var zipdir=require(_0x4ab5('0x2'));var jsonpatch=require(_0x4ab5('0x3'));var rp=require(_0x4ab5('0x4'));var moment=require('moment');var BPromise=require(_0x4ab5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4ab5('0x6'));var csv=require(_0x4ab5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4ab5('0x8'));var squel=require('squel');var crypto=require(_0x4ab5('0x9'));var jsforce=require(_0x4ab5('0xa'));var deskjs=require(_0x4ab5('0xb'));var toCsv=require(_0x4ab5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4ab5('0xc'));var qs=require(_0x4ab5('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ab5('0xe'));var logger=require(_0x4ab5('0xf'))('api');var utils=require(_0x4ab5('0x10'));var config=require(_0x4ab5('0x11'));var db=require(_0x4ab5('0x12'))['db'];function respondWithStatusCode(_0x19d68e,_0x34d4e5){_0x34d4e5=_0x34d4e5||0xcc;return function(_0xfb4366){if(_0xfb4366){return _0x19d68e[_0x4ab5('0x13')](_0x34d4e5);}return _0x19d68e[_0x4ab5('0x14')](_0x34d4e5)[_0x4ab5('0x15')]();};}function respondWithResult(_0x430f92,_0x4486bb){_0x4486bb=_0x4486bb||0xc8;return function(_0x35abf2){if(_0x35abf2){return _0x430f92[_0x4ab5('0x14')](_0x4486bb)[_0x4ab5('0x16')](_0x35abf2);}};}function respondWithFilteredResult(_0x553247,_0x3b9e16){return function(_0x4b48bf){if(_0x4b48bf){var _0x1c19f7=_0x4b48bf[_0x4ab5('0x17')],_0x5d0cbf=_0x3b9e16[_0x4ab5('0x18')],_0x5ce262=_0x3b9e16[_0x4ab5('0x18')]+_0x3b9e16['limit'],_0x474dbe;if(_0x5ce262>=_0x1c19f7){_0x5ce262=_0x1c19f7;_0x474dbe=0xc8;}else{_0x474dbe=0xce;}_0x553247[_0x4ab5('0x14')](_0x474dbe);return _0x553247[_0x4ab5('0x19')]('Content-Range',_0x5d0cbf+'-'+_0x5ce262+'/'+_0x1c19f7)['json'](_0x4b48bf);}return null;};}function patchUpdates(_0x5d0afa){return function(_0x30c1af){try{jsonpatch['apply'](_0x30c1af,_0x5d0afa,!![]);}catch(_0x546e3b){return BPromise[_0x4ab5('0x1a')](_0x546e3b);}return _0x30c1af[_0x4ab5('0x1b')]();};}function saveUpdates(_0x2995cc,_0x267466){return function(_0x1fa0e7){if(_0x1fa0e7){return _0x1fa0e7[_0x4ab5('0x1c')](_0x2995cc)[_0x4ab5('0x1d')](function(_0x4a6742){return _0x4a6742;});}return null;};}function removeEntity(_0x194352,_0x918d1a){return function(_0x334304){if(_0x334304){return _0x334304[_0x4ab5('0x1e')]()[_0x4ab5('0x1d')](function(){_0x194352[_0x4ab5('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe5e093,_0x5af3df){return function(_0x100f38){if(!_0x100f38){_0xe5e093[_0x4ab5('0x13')](0x194);}return _0x100f38;};}function handleError(_0x38bdb3,_0x24a585){_0x24a585=_0x24a585||0x1f4;return function(_0x31fb57){logger[_0x4ab5('0x1f')](_0x31fb57[_0x4ab5('0x20')]);if(_0x31fb57[_0x4ab5('0x21')]){delete _0x31fb57[_0x4ab5('0x21')];}_0x38bdb3[_0x4ab5('0x14')](_0x24a585)['send'](_0x31fb57);};}exports[_0x4ab5('0x22')]=function(_0x3df860,_0x251564){var _0x278938={},_0x1c3a2e={},_0x384474={'count':0x0,'rows':[]};var _0x2d5bf2=_[_0x4ab5('0x23')](db[_0x4ab5('0x24')][_0x4ab5('0x25')],function(_0x1c93e2){return{'name':_0x1c93e2[_0x4ab5('0x26')],'type':_0x1c93e2[_0x4ab5('0x27')][_0x4ab5('0x28')]};});_0x1c3a2e['model']=_[_0x4ab5('0x23')](_0x2d5bf2,_0x4ab5('0x21'));_0x1c3a2e[_0x4ab5('0x29')]=_['keys'](_0x3df860['query']);_0x1c3a2e[_0x4ab5('0x2a')]=_[_0x4ab5('0x2b')](_0x1c3a2e[_0x4ab5('0x2c')],_0x1c3a2e[_0x4ab5('0x29')]);_0x278938['attributes']=_[_0x4ab5('0x2b')](_0x1c3a2e[_0x4ab5('0x2c')],qs['fields'](_0x3df860[_0x4ab5('0x29')][_0x4ab5('0x2d')]));_0x278938[_0x4ab5('0x2e')]=_0x278938['attributes'][_0x4ab5('0x2f')]?_0x278938[_0x4ab5('0x2e')]:_0x1c3a2e[_0x4ab5('0x2c')];if(!_0x3df860['query'][_0x4ab5('0x30')]('nolimit')){_0x278938[_0x4ab5('0x31')]=qs['limit'](_0x3df860[_0x4ab5('0x29')][_0x4ab5('0x31')]);_0x278938[_0x4ab5('0x18')]=qs[_0x4ab5('0x18')](_0x3df860['query'][_0x4ab5('0x18')]);}_0x278938[_0x4ab5('0x32')]=qs['sort'](_0x3df860[_0x4ab5('0x29')][_0x4ab5('0x33')]);_0x278938[_0x4ab5('0x34')]=qs[_0x4ab5('0x2a')](_[_0x4ab5('0x35')](_0x3df860[_0x4ab5('0x29')],_0x1c3a2e['filters']));if(_0x3df860[_0x4ab5('0x29')][_0x4ab5('0x36')]){_0x278938[_0x4ab5('0x34')]=_['merge'](_0x278938[_0x4ab5('0x34')],{'$or':_[_0x4ab5('0x23')](_0x2d5bf2,function(_0x6e7b30){if(_0x6e7b30[_0x4ab5('0x27')]!==_0x4ab5('0x37')){var _0x2d698b={};_0x2d698b[_0x6e7b30[_0x4ab5('0x21')]]={'$like':'%'+_0x3df860[_0x4ab5('0x29')]['filter']+'%'};return _0x2d698b;}})});}_0x278938=_[_0x4ab5('0x38')]({},_0x278938,_0x3df860['options']);var _0x8b9fc9={'where':_0x278938[_0x4ab5('0x34')]};return db[_0x4ab5('0x24')][_0x4ab5('0x17')](_0x8b9fc9)[_0x4ab5('0x1d')](function(_0x1bbf05){_0x384474[_0x4ab5('0x17')]=_0x1bbf05;if(_0x3df860[_0x4ab5('0x29')][_0x4ab5('0x39')]){_0x278938['include']=[{'all':!![]}];}return db[_0x4ab5('0x24')][_0x4ab5('0x3a')](_0x278938);})['then'](function(_0x19823b){_0x384474[_0x4ab5('0x3b')]=_0x19823b;return _0x384474;})[_0x4ab5('0x1d')](respondWithFilteredResult(_0x251564,_0x278938))[_0x4ab5('0x3c')](handleError(_0x251564,null));};exports[_0x4ab5('0x3d')]=function(_0x368ee0,_0x26c05a){var _0x4f7d44={'raw':!![],'where':{'id':_0x368ee0[_0x4ab5('0x3e')]['id']}},_0x397878={};_0x397878[_0x4ab5('0x2c')]=_[_0x4ab5('0x3f')](db[_0x4ab5('0x24')][_0x4ab5('0x25')]);_0x397878[_0x4ab5('0x29')]=_[_0x4ab5('0x3f')](_0x368ee0['query']);_0x397878[_0x4ab5('0x2a')]=_[_0x4ab5('0x2b')](_0x397878[_0x4ab5('0x2c')],_0x397878[_0x4ab5('0x29')]);_0x4f7d44[_0x4ab5('0x2e')]=_[_0x4ab5('0x2b')](_0x397878[_0x4ab5('0x2c')],qs[_0x4ab5('0x2d')](_0x368ee0['query'][_0x4ab5('0x2d')]));_0x4f7d44['attributes']=_0x4f7d44[_0x4ab5('0x2e')][_0x4ab5('0x2f')]?_0x4f7d44[_0x4ab5('0x2e')]:_0x397878['model'];if(_0x368ee0[_0x4ab5('0x29')][_0x4ab5('0x39')]){_0x4f7d44[_0x4ab5('0x40')]=[{'all':!![]}];}_0x4f7d44=_['merge']({},_0x4f7d44,_0x368ee0['options']);return db[_0x4ab5('0x24')][_0x4ab5('0x41')](_0x4f7d44)['then'](handleEntityNotFound(_0x26c05a,null))['then'](respondWithResult(_0x26c05a,null))[_0x4ab5('0x3c')](handleError(_0x26c05a,null));};exports[_0x4ab5('0x42')]=function(_0x5eb4a2,_0x4ad12c){return db['Dynamics365Field'][_0x4ab5('0x42')](_0x5eb4a2[_0x4ab5('0x43')],{})['then'](respondWithResult(_0x4ad12c,0xc9))[_0x4ab5('0x3c')](handleError(_0x4ad12c,null));};exports['update']=function(_0x3daff0,_0xd35a9e){if(_0x3daff0[_0x4ab5('0x43')]['id']){delete _0x3daff0[_0x4ab5('0x43')]['id'];}return db[_0x4ab5('0x24')][_0x4ab5('0x41')]({'where':{'id':_0x3daff0[_0x4ab5('0x3e')]['id']}})[_0x4ab5('0x1d')](handleEntityNotFound(_0xd35a9e,null))['then'](saveUpdates(_0x3daff0[_0x4ab5('0x43')],null))[_0x4ab5('0x1d')](respondWithResult(_0xd35a9e,null))['catch'](handleError(_0xd35a9e,null));};exports['destroy']=function(_0xd46416,_0x7d4126){return db['Dynamics365Field'][_0x4ab5('0x41')]({'where':{'id':_0xd46416['params']['id']}})[_0x4ab5('0x1d')](handleEntityNotFound(_0x7d4126,null))['then'](removeEntity(_0x7d4126,null))[_0x4ab5('0x3c')](handleError(_0x7d4126,null));}; \ No newline at end of file +var _0x07d7=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js'];(function(_0x23f921,_0x1e742a){var _0x150d98=function(_0x403531){while(--_0x403531){_0x23f921['push'](_0x23f921['shift']());}};_0x150d98(++_0x1e742a);}(_0x07d7,0x85));var _0x707d=function(_0x2e655a,_0x6d5799){_0x2e655a=_0x2e655a-0x0;var _0x26f13b=_0x07d7[_0x2e655a];return _0x26f13b;};'use strict';var pdf=require(_0x707d('0x0'));var emlformat=require(_0x707d('0x1'));var rimraf=require(_0x707d('0x2'));var zipdir=require(_0x707d('0x3'));var jsonpatch=require(_0x707d('0x4'));var rp=require(_0x707d('0x5'));var moment=require(_0x707d('0x6'));var BPromise=require(_0x707d('0x7'));var Mustache=require(_0x707d('0x8'));var util=require(_0x707d('0x9'));var path=require(_0x707d('0xa'));var sox=require(_0x707d('0xb'));var csv=require(_0x707d('0xc'));var ejs=require(_0x707d('0xd'));var fs=require('fs');var _=require(_0x707d('0xe'));var squel=require(_0x707d('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x707d('0x10'));var toCsv=require(_0x707d('0xc'));var querystring=require(_0x707d('0x11'));var Papa=require(_0x707d('0x12'));var Redis=require(_0x707d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x707d('0x14'));var as=require(_0x707d('0x15'));var hardwareService=require(_0x707d('0x16'));var logger=require('../../config/logger')(_0x707d('0x17'));var utils=require(_0x707d('0x18'));var config=require(_0x707d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x524f9e,_0x5aabfe){_0x5aabfe=_0x5aabfe||0xcc;return function(_0x252e8c){if(_0x252e8c){return _0x524f9e[_0x707d('0x1a')](_0x5aabfe);}return _0x524f9e[_0x707d('0x1b')](_0x5aabfe)['end']();};}function respondWithResult(_0x3d84a8,_0x52c447){_0x52c447=_0x52c447||0xc8;return function(_0x1c18a6){if(_0x1c18a6){return _0x3d84a8[_0x707d('0x1b')](_0x52c447)['json'](_0x1c18a6);}};}function respondWithFilteredResult(_0x4d598e,_0x30d583){return function(_0x5b4700){if(_0x5b4700){var _0x2f993c=_0x5b4700[_0x707d('0x1c')],_0x2c63c9=_0x30d583[_0x707d('0x1d')],_0xeed67d=_0x30d583[_0x707d('0x1d')]+_0x30d583['limit'],_0x1f4f0e;if(_0xeed67d>=_0x2f993c){_0xeed67d=_0x2f993c;_0x1f4f0e=0xc8;}else{_0x1f4f0e=0xce;}_0x4d598e[_0x707d('0x1b')](_0x1f4f0e);return _0x4d598e[_0x707d('0x1e')](_0x707d('0x1f'),_0x2c63c9+'-'+_0xeed67d+'/'+_0x2f993c)['json'](_0x5b4700);}return null;};}function patchUpdates(_0x291864){return function(_0x13208a){try{jsonpatch[_0x707d('0x20')](_0x13208a,_0x291864,!![]);}catch(_0x8e524c){return BPromise[_0x707d('0x21')](_0x8e524c);}return _0x13208a[_0x707d('0x22')]();};}function saveUpdates(_0xb7171a,_0x446629){return function(_0x33a726){if(_0x33a726){return _0x33a726[_0x707d('0x23')](_0xb7171a)[_0x707d('0x24')](function(_0x366ef7){return _0x366ef7;});}return null;};}function removeEntity(_0x475c62,_0x3dc9c9){return function(_0xd97d6b){if(_0xd97d6b){return _0xd97d6b[_0x707d('0x25')]()[_0x707d('0x24')](function(){_0x475c62['status'](0xcc)[_0x707d('0x26')]();});}};}function handleEntityNotFound(_0x487a9c,_0xe548a4){return function(_0x139ad5){if(!_0x139ad5){_0x487a9c[_0x707d('0x1a')](0x194);}return _0x139ad5;};}function handleError(_0x1a5e03,_0x12d4da){_0x12d4da=_0x12d4da||0x1f4;return function(_0x52549f){logger[_0x707d('0x27')](_0x52549f[_0x707d('0x28')]);if(_0x52549f[_0x707d('0x29')]){delete _0x52549f[_0x707d('0x29')];}_0x1a5e03[_0x707d('0x1b')](_0x12d4da)[_0x707d('0x2a')](_0x52549f);};}exports[_0x707d('0x2b')]=function(_0x468f6b,_0x38b4fe){var _0x2f03bc={},_0x2c5ac4={},_0x19bf0b={'count':0x0,'rows':[]};var _0x2c5ace=_[_0x707d('0x2c')](db[_0x707d('0x2d')][_0x707d('0x2e')],function(_0x2102e6){return{'name':_0x2102e6[_0x707d('0x2f')],'type':_0x2102e6['type'][_0x707d('0x30')]};});_0x2c5ac4[_0x707d('0x31')]=_[_0x707d('0x2c')](_0x2c5ace,'name');_0x2c5ac4['query']=_['keys'](_0x468f6b[_0x707d('0x32')]);_0x2c5ac4[_0x707d('0x33')]=_[_0x707d('0x34')](_0x2c5ac4[_0x707d('0x31')],_0x2c5ac4[_0x707d('0x32')]);_0x2f03bc[_0x707d('0x35')]=_[_0x707d('0x34')](_0x2c5ac4[_0x707d('0x31')],qs[_0x707d('0x36')](_0x468f6b[_0x707d('0x32')][_0x707d('0x36')]));_0x2f03bc[_0x707d('0x35')]=_0x2f03bc['attributes'][_0x707d('0x37')]?_0x2f03bc[_0x707d('0x35')]:_0x2c5ac4[_0x707d('0x31')];if(!_0x468f6b[_0x707d('0x32')][_0x707d('0x38')]('nolimit')){_0x2f03bc[_0x707d('0x39')]=qs[_0x707d('0x39')](_0x468f6b['query'][_0x707d('0x39')]);_0x2f03bc[_0x707d('0x1d')]=qs[_0x707d('0x1d')](_0x468f6b[_0x707d('0x32')][_0x707d('0x1d')]);}_0x2f03bc[_0x707d('0x3a')]=qs[_0x707d('0x3b')](_0x468f6b[_0x707d('0x32')][_0x707d('0x3b')]);_0x2f03bc['where']=qs[_0x707d('0x33')](_[_0x707d('0x3c')](_0x468f6b[_0x707d('0x32')],_0x2c5ac4[_0x707d('0x33')]));if(_0x468f6b[_0x707d('0x32')]['filter']){_0x2f03bc[_0x707d('0x3d')]=_[_0x707d('0x3e')](_0x2f03bc[_0x707d('0x3d')],{'$or':_['map'](_0x2c5ace,function(_0x337bba){if(_0x337bba['type']!==_0x707d('0x3f')){var _0x41cf7a={};_0x41cf7a[_0x337bba[_0x707d('0x29')]]={'$like':'%'+_0x468f6b[_0x707d('0x32')]['filter']+'%'};return _0x41cf7a;}})});}_0x2f03bc=_['merge']({},_0x2f03bc,_0x468f6b[_0x707d('0x40')]);var _0xea831e={'where':_0x2f03bc['where']};return db['Dynamics365Field'][_0x707d('0x1c')](_0xea831e)['then'](function(_0x4c3a23){_0x19bf0b[_0x707d('0x1c')]=_0x4c3a23;if(_0x468f6b[_0x707d('0x32')][_0x707d('0x41')]){_0x2f03bc[_0x707d('0x42')]=[{'all':!![]}];}return db[_0x707d('0x2d')]['findAll'](_0x2f03bc);})[_0x707d('0x24')](function(_0x122609){_0x19bf0b[_0x707d('0x43')]=_0x122609;return _0x19bf0b;})[_0x707d('0x24')](respondWithFilteredResult(_0x38b4fe,_0x2f03bc))[_0x707d('0x44')](handleError(_0x38b4fe,null));};exports[_0x707d('0x45')]=function(_0x18fdfe,_0x1041a7){var _0x6553d2={'raw':!![],'where':{'id':_0x18fdfe[_0x707d('0x46')]['id']}},_0x17a87d={};_0x17a87d['model']=_[_0x707d('0x47')](db[_0x707d('0x2d')]['rawAttributes']);_0x17a87d[_0x707d('0x32')]=_[_0x707d('0x47')](_0x18fdfe[_0x707d('0x32')]);_0x17a87d[_0x707d('0x33')]=_[_0x707d('0x34')](_0x17a87d['model'],_0x17a87d[_0x707d('0x32')]);_0x6553d2[_0x707d('0x35')]=_[_0x707d('0x34')](_0x17a87d[_0x707d('0x31')],qs[_0x707d('0x36')](_0x18fdfe[_0x707d('0x32')][_0x707d('0x36')]));_0x6553d2[_0x707d('0x35')]=_0x6553d2[_0x707d('0x35')]['length']?_0x6553d2[_0x707d('0x35')]:_0x17a87d['model'];if(_0x18fdfe[_0x707d('0x32')][_0x707d('0x41')]){_0x6553d2[_0x707d('0x42')]=[{'all':!![]}];}_0x6553d2=_[_0x707d('0x3e')]({},_0x6553d2,_0x18fdfe[_0x707d('0x40')]);return db[_0x707d('0x2d')][_0x707d('0x48')](_0x6553d2)[_0x707d('0x24')](handleEntityNotFound(_0x1041a7,null))['then'](respondWithResult(_0x1041a7,null))[_0x707d('0x44')](handleError(_0x1041a7,null));};exports[_0x707d('0x49')]=function(_0x39b291,_0x3f9c77){return db[_0x707d('0x2d')][_0x707d('0x49')](_0x39b291['body'],{})[_0x707d('0x24')](respondWithResult(_0x3f9c77,0xc9))[_0x707d('0x44')](handleError(_0x3f9c77,null));};exports[_0x707d('0x23')]=function(_0x3986d4,_0x3a8260){if(_0x3986d4[_0x707d('0x4a')]['id']){delete _0x3986d4['body']['id'];}return db['Dynamics365Field'][_0x707d('0x48')]({'where':{'id':_0x3986d4[_0x707d('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a8260,null))[_0x707d('0x24')](saveUpdates(_0x3986d4[_0x707d('0x4a')],null))[_0x707d('0x24')](respondWithResult(_0x3a8260,null))[_0x707d('0x44')](handleError(_0x3a8260,null));};exports['destroy']=function(_0x26b5ea,_0xdcb210){return db[_0x707d('0x2d')]['find']({'where':{'id':_0x26b5ea[_0x707d('0x46')]['id']}})[_0x707d('0x24')](handleEntityNotFound(_0xdcb210,null))['then'](removeEntity(_0xdcb210,null))[_0x707d('0x44')](handleError(_0xdcb210,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 1a71f1c..28388a9 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 _0x67c0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','util','api'];(function(_0x3318f0,_0x359d62){var _0x12bc0b=function(_0x27e74a){while(--_0x27e74a){_0x3318f0['push'](_0x3318f0['shift']());}};_0x12bc0b(++_0x359d62);}(_0x67c0,0x183));var _0x067c=function(_0x3a1f7e,_0x9449c4){_0x3a1f7e=_0x3a1f7e-0x0;var _0x3f1742=_0x67c0[_0x3a1f7e];return _0x3f1742;};'use strict';var _=require(_0x067c('0x0'));var util=require(_0x067c('0x1'));var logger=require('../../config/logger')(_0x067c('0x2'));var moment=require(_0x067c('0x3'));var BPromise=require(_0x067c('0x4'));var rp=require(_0x067c('0x5'));var fs=require('fs');var path=require(_0x067c('0x6'));var rimraf=require(_0x067c('0x7'));var config=require(_0x067c('0x8'));var attributes=require(_0x067c('0x9'));module[_0x067c('0xa')]=function(_0x1309c3,_0x252091){return _0x1309c3['define'](_0x067c('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x067c('0xc'),'fields':[_0x067c('0xd'),_0x067c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x75b2=['path','rimraf','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','../../config/logger','api','bluebird'];(function(_0x1156ce,_0x50f233){var _0x2b6d72=function(_0x36a033){while(--_0x36a033){_0x1156ce['push'](_0x1156ce['shift']());}};_0x2b6d72(++_0x50f233);}(_0x75b2,0x1e5));var _0x275b=function(_0x6476f4,_0x37dff4){_0x6476f4=_0x6476f4-0x0;var _0x2753a4=_0x75b2[_0x6476f4];return _0x2753a4;};'use strict';var _=require(_0x275b('0x0'));var util=require(_0x275b('0x1'));var logger=require(_0x275b('0x2'))(_0x275b('0x3'));var moment=require('moment');var BPromise=require(_0x275b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x275b('0x5'));var rimraf=require(_0x275b('0x6'));var config=require(_0x275b('0x7'));var attributes=require('./intDynamics365Field.attributes');module[_0x275b('0x8')]=function(_0x5430d9,_0x576f78){return _0x5430d9[_0x275b('0x9')](_0x275b('0xa'),attributes,{'tableName':_0x275b('0xb'),'paranoid':![],'indexes':[{'name':_0x275b('0xc'),'fields':[_0x275b('0xd'),'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 badc49e..136355e 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 _0x5353=['Dynamics365Field,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent'];(function(_0x64d54c,_0x466ec9){var _0x5e31e5=function(_0x146ef2){while(--_0x146ef2){_0x64d54c['push'](_0x64d54c['shift']());}};_0x5e31e5(++_0x466ec9);}(_0x5353,0x12f));var _0x3535=function(_0x328b5e,_0x2086c1){_0x328b5e=_0x328b5e-0x0;var _0x28e575=_0x5353[_0x328b5e];return _0x28e575;};'use strict';var _=require(_0x3535('0x0'));var util=require('util');var moment=require(_0x3535('0x1'));var BPromise=require(_0x3535('0x2'));var rs=require(_0x3535('0x3'));var fs=require('fs');var Redis=require(_0x3535('0x4'));var db=require(_0x3535('0x5'))['db'];var utils=require(_0x3535('0x6'));var logger=require(_0x3535('0x7'))(_0x3535('0x8'));var config=require(_0x3535('0x9'));var jayson=require(_0x3535('0xa'));var client=jayson['client'][_0x3535('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x498868,_0x1c92fd,_0x268873){return new BPromise(function(_0x3e3500,_0x5437a2){return client[_0x3535('0xc')](_0x498868,_0x268873)[_0x3535('0xd')](function(_0x2da555){logger[_0x3535('0xe')](_0x3535('0xf'),_0x1c92fd,_0x3535('0x10'));logger['debug'](_0x3535('0x11'),_0x1c92fd,_0x3535('0x10'),JSON['stringify'](_0x2da555));if(_0x2da555[_0x3535('0x12')]){if(_0x2da555['error']['code']===0x1f4){logger[_0x3535('0x12')](_0x3535('0xf'),_0x1c92fd,_0x2da555[_0x3535('0x12')][_0x3535('0x13')]);return _0x5437a2(_0x2da555[_0x3535('0x12')][_0x3535('0x13')]);}logger[_0x3535('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x1c92fd,_0x2da555[_0x3535('0x12')]['message']);return _0x3e3500(_0x2da555[_0x3535('0x12')][_0x3535('0x13')]);}else{logger[_0x3535('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x1c92fd,_0x3535('0x10'));_0x3e3500(_0x2da555['result'][_0x3535('0x13')]);}})['catch'](function(_0x519c33){logger[_0x3535('0x12')](_0x3535('0xf'),_0x1c92fd,_0x519c33);_0x5437a2(_0x519c33);});});} \ No newline at end of file +var _0x0eeb=['client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x163895,_0x14e1ac){var _0x41f94f=function(_0xa2f9a9){while(--_0xa2f9a9){_0x163895['push'](_0x163895['shift']());}};_0x41f94f(++_0x14e1ac);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eeb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var moment=require(_0xb0ee('0x2'));var BPromise=require(_0xb0ee('0x3'));var rs=require(_0xb0ee('0x4'));var fs=require('fs');var Redis=require(_0xb0ee('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb0ee('0x6'))(_0xb0ee('0x7'));var config=require(_0xb0ee('0x8'));var jayson=require(_0xb0ee('0x9'));var client=jayson[_0xb0ee('0xa')][_0xb0ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17f445,_0x5377b4,_0x207a85){return new BPromise(function(_0x586bc9,_0x13c198){return client[_0xb0ee('0xc')](_0x17f445,_0x207a85)[_0xb0ee('0xd')](function(_0x308603){logger[_0xb0ee('0xe')](_0xb0ee('0xf'),_0x5377b4,'request\x20sent');logger['debug'](_0xb0ee('0x10'),_0x5377b4,_0xb0ee('0x11'),JSON['stringify'](_0x308603));if(_0x308603['error']){if(_0x308603[_0xb0ee('0x12')][_0xb0ee('0x13')]===0x1f4){logger[_0xb0ee('0x12')](_0xb0ee('0xf'),_0x5377b4,_0x308603['error'][_0xb0ee('0x14')]);return _0x13c198(_0x308603['error']['message']);}logger['error'](_0xb0ee('0xf'),_0x5377b4,_0x308603[_0xb0ee('0x12')]['message']);return _0x586bc9(_0x308603[_0xb0ee('0x12')][_0xb0ee('0x14')]);}else{logger[_0xb0ee('0xe')](_0xb0ee('0xf'),_0x5377b4,_0xb0ee('0x11'));_0x586bc9(_0x308603[_0xb0ee('0x15')][_0xb0ee('0x14')]);}})[_0xb0ee('0x16')](function(_0x549e64){logger['error'](_0xb0ee('0xf'),_0x5377b4,_0x549e64);_0x13c198(_0x549e64);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 91a156b..4c40e12 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 _0x7628=['./intFreshdeskAccount.controller','get','index','show','/:id/configurations','isAuthenticated','/:id/fields','getFields','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x7628,0xe0));var _0x8762=function(_0x33fb16,_0x2ccd63){_0x33fb16=_0x33fb16-0x0;var _0x514b4b=_0x7628[_0x33fb16];return _0x514b4b;};'use strict';var multer=require(_0x8762('0x0'));var util=require(_0x8762('0x1'));var path=require(_0x8762('0x2'));var timeout=require(_0x8762('0x3'));var express=require(_0x8762('0x4'));var router=express[_0x8762('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8762('0x6'));var controller=require(_0x8762('0x7'));router[_0x8762('0x8')]('/',auth['isAuthenticated'](),controller[_0x8762('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8762('0xa')]);router['get'](_0x8762('0xb'),auth[_0x8762('0xc')](),controller['getConfigurations']);router[_0x8762('0x8')](_0x8762('0xd'),auth[_0x8762('0xc')](),controller[_0x8762('0xe')]);router[_0x8762('0xf')]('/',auth[_0x8762('0xc')](),controller[_0x8762('0x10')]);router[_0x8762('0xf')](_0x8762('0xb'),auth[_0x8762('0xc')](),controller['addConfiguration']);router['put'](_0x8762('0x11'),auth[_0x8762('0xc')](),controller['update']);router[_0x8762('0x12')](_0x8762('0x11'),auth['isAuthenticated'](),controller[_0x8762('0x13')]);module[_0x8762('0x14')]=router; \ No newline at end of file +var _0x0a2c=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x2eac4f,_0x5173f9){var _0x58f73b=function(_0x529f28){while(--_0x529f28){_0x2eac4f['push'](_0x2eac4f['shift']());}};_0x58f73b(++_0x5173f9);}(_0x0a2c,0xf9));var _0xc0a2=function(_0xb0c044,_0x3ee130){_0xb0c044=_0xb0c044-0x0;var _0x48a693=_0x0a2c[_0xb0c044];return _0x48a693;};'use strict';var multer=require(_0xc0a2('0x0'));var util=require('util');var path=require(_0xc0a2('0x1'));var timeout=require(_0xc0a2('0x2'));var express=require(_0xc0a2('0x3'));var router=express[_0xc0a2('0x4')]();var auth=require(_0xc0a2('0x5'));var interaction=require(_0xc0a2('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xc0a2('0x7')]('/',auth[_0xc0a2('0x8')](),controller[_0xc0a2('0x9')]);router[_0xc0a2('0x7')](_0xc0a2('0xa'),auth['isAuthenticated'](),controller[_0xc0a2('0xb')]);router[_0xc0a2('0x7')](_0xc0a2('0xc'),auth[_0xc0a2('0x8')](),controller[_0xc0a2('0xd')]);router['get'](_0xc0a2('0xe'),auth['isAuthenticated'](),controller[_0xc0a2('0xf')]);router[_0xc0a2('0x10')]('/',auth['isAuthenticated'](),controller[_0xc0a2('0x11')]);router['post'](_0xc0a2('0xc'),auth[_0xc0a2('0x8')](),controller[_0xc0a2('0x12')]);router[_0xc0a2('0x13')](_0xc0a2('0xa'),auth[_0xc0a2('0x8')](),controller[_0xc0a2('0x14')]);router[_0xc0a2('0x15')](_0xc0a2('0xa'),auth['isAuthenticated'](),controller[_0xc0a2('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index ab3390c..b815f7f 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 _0xfb67=['remoteUri','sequelize','exports','STRING','username'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfb67,0xdd));var _0x7fb6=function(_0x5350be,_0x3f0f15){_0x5350be=_0x5350be-0x0;var _0x451f2a=_0xfb67[_0x5350be];return _0x451f2a;};'use strict';var Sequelize=require(_0x7fb6('0x0'));module[_0x7fb6('0x1')]={'name':{'type':Sequelize[_0x7fb6('0x2')]},'description':{'type':Sequelize[_0x7fb6('0x2')]},'username':{'type':Sequelize[_0x7fb6('0x2')],'unique':_0x7fb6('0x3')},'apiKey':{'type':Sequelize[_0x7fb6('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x7fb6('0x4')},'serverUrl':{'type':Sequelize[_0x7fb6('0x2')]}}; \ No newline at end of file +var _0x677a=['username','remoteUri','sequelize','STRING'];(function(_0x35ce55,_0x4f17cc){var _0x310de2=function(_0x5b7ee1){while(--_0x5b7ee1){_0x35ce55['push'](_0x35ce55['shift']());}};_0x310de2(++_0x4f17cc);}(_0x677a,0xd6));var _0xa677=function(_0x2ed209,_0x10560e){_0x2ed209=_0x2ed209-0x0;var _0x594fb2=_0x677a[_0x2ed209];return _0x594fb2;};'use strict';var Sequelize=require(_0xa677('0x0'));module['exports']={'name':{'type':Sequelize[_0xa677('0x1')]},'description':{'type':Sequelize[_0xa677('0x1')]},'username':{'type':Sequelize[_0xa677('0x1')],'unique':_0xa677('0x2')},'apiKey':{'type':Sequelize[_0xa677('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa677('0x3')},'serverUrl':{'type':Sequelize[_0xa677('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 5e19830..a41e4d3 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 _0xe351=['where','merge','options','FreshdeskAccount','includeAll','include','rows','show','find','create','body','params','destroy','getConfigurations','findOne','FreshdeskConfiguration','nolimit','addConfiguration','Subjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','apiKey','remoteUri','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','requester','subject','agent','description','priority','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','html-pdf','eml-format','zip-dir','moment','bluebird','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/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','json','count','offset','Content-Range','reject','save','update','status','stack','name','send','map','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','filters','pick','filter'];(function(_0x256a99,_0x5705b8){var _0x5b1105=function(_0x189521){while(--_0x189521){_0x256a99['push'](_0x256a99['shift']());}};_0x5b1105(++_0x5705b8);}(_0xe351,0x19d));var _0x1e35=function(_0x16b46e,_0x103b93){_0x16b46e=_0x16b46e-0x0;var _0x472cff=_0xe351[_0x16b46e];return _0x472cff;};'use strict';var pdf=require(_0x1e35('0x0'));var emlformat=require(_0x1e35('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1e35('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1e35('0x3'));var BPromise=require(_0x1e35('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1e35('0x5'));var sox=require(_0x1e35('0x6'));var csv=require(_0x1e35('0x7'));var ejs=require(_0x1e35('0x8'));var fs=require('fs');var _=require(_0x1e35('0x9'));var squel=require(_0x1e35('0xa'));var crypto=require(_0x1e35('0xb'));var jsforce=require(_0x1e35('0xc'));var deskjs=require(_0x1e35('0xd'));var toCsv=require(_0x1e35('0x7'));var querystring=require(_0x1e35('0xe'));var Papa=require(_0x1e35('0xf'));var Redis=require('ioredis');var authService=require(_0x1e35('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1e35('0x11'));var hardwareService=require(_0x1e35('0x12'));var logger=require(_0x1e35('0x13'))(_0x1e35('0x14'));var utils=require(_0x1e35('0x15'));var config=require(_0x1e35('0x16'));var db=require(_0x1e35('0x17'))['db'];var integrations=require(_0x1e35('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x1e35('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x3f1086,_0xf03146,_0x2720a1){if(_0x2720a1){var _0x3e42a0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e42a0['test'](_0xf03146)){return _0x3f1086;}else{throw new db[(_0x1e35('0x1a'))][(_0x1e35('0x1b'))](_0x1e35('0x1c'));}}else{return _0x3f1086;}}function respondWithRpcPromise(_0x1a18a9,_0xaa9121,_0x41c62a,_0x5ae2fe){return new BPromise(function(_0x4334d9,_0x57effe){var _0x40fa64=_0x5ae2fe||client;return _0x40fa64[_0x1e35('0x1d')](_0x1a18a9,_0x41c62a)[_0x1e35('0x1e')](function(_0x510d60){logger[_0x1e35('0x1f')]('FreshdeskAccount,\x20%s,\x20%s',_0xaa9121,_0x1e35('0x20'));logger[_0x1e35('0x21')](_0x1e35('0x22'),_0xaa9121,'request\x20sent',JSON['stringify'](_0x510d60));if(_0x510d60[_0x1e35('0x23')]){if(_0x510d60[_0x1e35('0x23')][_0x1e35('0x24')]===0x1f4){logger['error'](_0x1e35('0x25'),_0xaa9121,_0x510d60['error'][_0x1e35('0x26')]);return _0x57effe(_0x510d60[_0x1e35('0x23')][_0x1e35('0x26')]);}logger[_0x1e35('0x23')](_0x1e35('0x25'),_0xaa9121,_0x510d60[_0x1e35('0x23')]['message']);return _0x4334d9(_0x510d60[_0x1e35('0x23')][_0x1e35('0x26')]);}else{logger[_0x1e35('0x1f')](_0x1e35('0x25'),_0xaa9121,'request\x20sent');_0x4334d9(_0x510d60[_0x1e35('0x27')][_0x1e35('0x26')]);}})[_0x1e35('0x28')](function(_0x3902dc){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0xaa9121,_0x3902dc);_0x57effe(_0x3902dc);});});}function respondWithStatusCode(_0x8e4108,_0x64c667){_0x64c667=_0x64c667||0xcc;return function(_0x2eab23){if(_0x2eab23){return _0x8e4108[_0x1e35('0x29')](_0x64c667);}return _0x8e4108['status'](_0x64c667)[_0x1e35('0x2a')]();};}function respondWithResult(_0x1eaf48,_0x19dffa){_0x19dffa=_0x19dffa||0xc8;return function(_0x512c8e){if(_0x512c8e){return _0x1eaf48['status'](_0x19dffa)[_0x1e35('0x2b')](_0x512c8e);}};}function respondWithFilteredResult(_0x560772,_0xe68b9e){return function(_0x306c22){if(_0x306c22){var _0x306b1f=_0x306c22[_0x1e35('0x2c')],_0x3d735c=_0xe68b9e[_0x1e35('0x2d')],_0x492d56=_0xe68b9e['offset']+_0xe68b9e['limit'],_0x14b242;if(_0x492d56>=_0x306b1f){_0x492d56=_0x306b1f;_0x14b242=0xc8;}else{_0x14b242=0xce;}_0x560772['status'](_0x14b242);return _0x560772['set'](_0x1e35('0x2e'),_0x3d735c+'-'+_0x492d56+'/'+_0x306b1f)[_0x1e35('0x2b')](_0x306c22);}return null;};}function patchUpdates(_0x23ee1f){return function(_0x298d58){try{jsonpatch['apply'](_0x298d58,_0x23ee1f,!![]);}catch(_0x1ef66a){return BPromise[_0x1e35('0x2f')](_0x1ef66a);}return _0x298d58[_0x1e35('0x30')]();};}function saveUpdates(_0x260444,_0x320bc3){return function(_0x514b10){if(_0x514b10){return _0x514b10[_0x1e35('0x31')](_0x260444)[_0x1e35('0x1e')](function(_0x395654){return _0x395654;});}return null;};}function removeEntity(_0xba3f2d,_0x10fddb){return function(_0x5a8081){if(_0x5a8081){return _0x5a8081['destroy']()[_0x1e35('0x1e')](function(){_0xba3f2d[_0x1e35('0x32')](0xcc)[_0x1e35('0x2a')]();});}};}function handleEntityNotFound(_0x218347,_0x492b54){return function(_0x4fe2d2){if(!_0x4fe2d2){_0x218347['sendStatus'](0x194);}return _0x4fe2d2;};}function handleError(_0x4703e1,_0x5521f5){_0x5521f5=_0x5521f5||0x1f4;return function(_0x2bd74f){logger[_0x1e35('0x23')](_0x2bd74f[_0x1e35('0x33')]);if(_0x2bd74f[_0x1e35('0x34')]){delete _0x2bd74f[_0x1e35('0x34')];}_0x4703e1[_0x1e35('0x32')](_0x5521f5)[_0x1e35('0x35')](_0x2bd74f);};}exports['index']=function(_0x22ab1d,_0x365730){var _0x59de9b={},_0x4e3ce7={},_0x96f638={'count':0x0,'rows':[]};var _0x1d5ff6=_[_0x1e35('0x36')](db['FreshdeskAccount'][_0x1e35('0x37')],function(_0x2c0459){return{'name':_0x2c0459['fieldName'],'type':_0x2c0459[_0x1e35('0x38')]['key']};});_0x4e3ce7['model']=_[_0x1e35('0x36')](_0x1d5ff6,_0x1e35('0x34'));_0x4e3ce7[_0x1e35('0x39')]=_[_0x1e35('0x3a')](_0x22ab1d[_0x1e35('0x39')]);_0x4e3ce7['filters']=_[_0x1e35('0x3b')](_0x4e3ce7[_0x1e35('0x3c')],_0x4e3ce7[_0x1e35('0x39')]);_0x59de9b[_0x1e35('0x3d')]=_[_0x1e35('0x3b')](_0x4e3ce7['model'],qs[_0x1e35('0x3e')](_0x22ab1d[_0x1e35('0x39')][_0x1e35('0x3e')]));_0x59de9b[_0x1e35('0x3d')]=_0x59de9b['attributes'][_0x1e35('0x3f')]?_0x59de9b[_0x1e35('0x3d')]:_0x4e3ce7[_0x1e35('0x3c')];if(!_0x22ab1d[_0x1e35('0x39')][_0x1e35('0x40')]('nolimit')){_0x59de9b['limit']=qs[_0x1e35('0x41')](_0x22ab1d[_0x1e35('0x39')][_0x1e35('0x41')]);_0x59de9b[_0x1e35('0x2d')]=qs[_0x1e35('0x2d')](_0x22ab1d[_0x1e35('0x39')][_0x1e35('0x2d')]);}_0x59de9b[_0x1e35('0x42')]=qs[_0x1e35('0x43')](_0x22ab1d[_0x1e35('0x39')]['sort']);_0x59de9b['where']=qs[_0x1e35('0x44')](_[_0x1e35('0x45')](_0x22ab1d['query'],_0x4e3ce7[_0x1e35('0x44')]));if(_0x22ab1d[_0x1e35('0x39')][_0x1e35('0x46')]){_0x59de9b[_0x1e35('0x47')]=_[_0x1e35('0x48')](_0x59de9b[_0x1e35('0x47')],{'$or':_[_0x1e35('0x36')](_0x1d5ff6,function(_0x3aa2f1){if(_0x3aa2f1[_0x1e35('0x38')]!=='VIRTUAL'){var _0x4ab01b={};_0x4ab01b[_0x3aa2f1[_0x1e35('0x34')]]={'$like':'%'+_0x22ab1d[_0x1e35('0x39')][_0x1e35('0x46')]+'%'};return _0x4ab01b;}})});}_0x59de9b=_['merge']({},_0x59de9b,_0x22ab1d[_0x1e35('0x49')]);var _0x383595={'where':_0x59de9b[_0x1e35('0x47')]};return db[_0x1e35('0x4a')]['count'](_0x383595)[_0x1e35('0x1e')](function(_0x4e6758){_0x96f638['count']=_0x4e6758;if(_0x22ab1d['query'][_0x1e35('0x4b')]){_0x59de9b[_0x1e35('0x4c')]=[{'all':!![]}];}return db[_0x1e35('0x4a')]['findAll'](_0x59de9b);})[_0x1e35('0x1e')](function(_0x34712f){_0x96f638[_0x1e35('0x4d')]=_0x34712f;return _0x96f638;})[_0x1e35('0x1e')](respondWithFilteredResult(_0x365730,_0x59de9b))[_0x1e35('0x28')](handleError(_0x365730,null));};exports[_0x1e35('0x4e')]=function(_0xaea419,_0x4c499d){var _0x4dcb99={'raw':![],'where':{'id':_0xaea419['params']['id']}},_0x2aa46d={};_0x2aa46d[_0x1e35('0x3c')]=_[_0x1e35('0x3a')](db[_0x1e35('0x4a')][_0x1e35('0x37')]);_0x2aa46d[_0x1e35('0x39')]=_['keys'](_0xaea419['query']);_0x2aa46d[_0x1e35('0x44')]=_[_0x1e35('0x3b')](_0x2aa46d[_0x1e35('0x3c')],_0x2aa46d[_0x1e35('0x39')]);_0x4dcb99['attributes']=_['intersection'](_0x2aa46d[_0x1e35('0x3c')],qs[_0x1e35('0x3e')](_0xaea419[_0x1e35('0x39')][_0x1e35('0x3e')]));_0x4dcb99[_0x1e35('0x3d')]=_0x4dcb99[_0x1e35('0x3d')]['length']?_0x4dcb99[_0x1e35('0x3d')]:_0x2aa46d[_0x1e35('0x3c')];if(_0xaea419[_0x1e35('0x39')][_0x1e35('0x4b')]){_0x4dcb99[_0x1e35('0x4c')]=[{'all':!![]}];}_0x4dcb99=_[_0x1e35('0x48')]({},_0x4dcb99,_0xaea419[_0x1e35('0x49')]);return db[_0x1e35('0x4a')][_0x1e35('0x4f')](_0x4dcb99)[_0x1e35('0x1e')](handleEntityNotFound(_0x4c499d,null))['then'](respondWithResult(_0x4c499d,null))[_0x1e35('0x28')](handleError(_0x4c499d,null));};exports[_0x1e35('0x50')]=function(_0xbf64f2,_0x257ca3){return db[_0x1e35('0x4a')][_0x1e35('0x50')](_0xbf64f2[_0x1e35('0x51')],{})[_0x1e35('0x1e')](respondWithResult(_0x257ca3,0xc9))[_0x1e35('0x28')](handleError(_0x257ca3,null));};exports['update']=function(_0x10f553,_0x2eeeb2){if(_0x10f553[_0x1e35('0x51')]['id']){delete _0x10f553[_0x1e35('0x51')]['id'];}return db[_0x1e35('0x4a')][_0x1e35('0x4f')]({'where':{'id':_0x10f553[_0x1e35('0x52')]['id']}})['then'](handleEntityNotFound(_0x2eeeb2,null))[_0x1e35('0x1e')](saveUpdates(_0x10f553[_0x1e35('0x51')],null))[_0x1e35('0x1e')](respondWithResult(_0x2eeeb2,null))['catch'](handleError(_0x2eeeb2,null));};exports[_0x1e35('0x53')]=function(_0xe1c547,_0x4c5c18){return db[_0x1e35('0x4a')][_0x1e35('0x4f')]({'where':{'id':_0xe1c547[_0x1e35('0x52')]['id']}})[_0x1e35('0x1e')](handleEntityNotFound(_0x4c5c18,null))[_0x1e35('0x1e')](removeEntity(_0x4c5c18,null))[_0x1e35('0x28')](handleError(_0x4c5c18,null));};exports[_0x1e35('0x54')]=function(_0x31ff53,_0x10b9e9,_0x497d4c){var _0x3efad2={};var _0x1a1f3f={};var _0x97c1b0;var _0xccd105;return db['FreshdeskAccount'][_0x1e35('0x55')]({'where':{'id':_0x31ff53[_0x1e35('0x52')]['id']}})[_0x1e35('0x1e')](handleEntityNotFound(_0x10b9e9,null))['then'](function(_0x14d839){if(_0x14d839){_0x97c1b0=_0x14d839;_0x1a1f3f[_0x1e35('0x3c')]=_[_0x1e35('0x3a')](db[_0x1e35('0x56')]['rawAttributes']);_0x1a1f3f[_0x1e35('0x39')]=_[_0x1e35('0x3a')](_0x31ff53[_0x1e35('0x39')]);_0x1a1f3f[_0x1e35('0x44')]=_[_0x1e35('0x3b')](_0x1a1f3f['model'],_0x1a1f3f[_0x1e35('0x39')]);_0x3efad2[_0x1e35('0x3d')]=_[_0x1e35('0x3b')](_0x1a1f3f['model'],qs[_0x1e35('0x3e')](_0x31ff53[_0x1e35('0x39')][_0x1e35('0x3e')]));_0x3efad2[_0x1e35('0x3d')]=_0x3efad2[_0x1e35('0x3d')]['length']?_0x3efad2['attributes']:_0x1a1f3f[_0x1e35('0x3c')];_0x3efad2['order']=qs[_0x1e35('0x43')](_0x31ff53[_0x1e35('0x39')][_0x1e35('0x43')]);_0x3efad2[_0x1e35('0x47')]=qs[_0x1e35('0x44')](_[_0x1e35('0x45')](_0x31ff53[_0x1e35('0x39')],_0x1a1f3f[_0x1e35('0x44')]));if(_0x31ff53['query'][_0x1e35('0x46')]){_0x3efad2[_0x1e35('0x47')]=_[_0x1e35('0x48')](_0x3efad2[_0x1e35('0x47')],{'$or':_['map'](_0x3efad2[_0x1e35('0x3d')],function(_0x15de4a){var _0x597d74={};_0x597d74[_0x15de4a]={'$like':'%'+_0x31ff53[_0x1e35('0x39')]['filter']+'%'};return _0x597d74;})});}_0x3efad2=_[_0x1e35('0x48')]({},_0x3efad2,_0x31ff53[_0x1e35('0x49')]);return _0x97c1b0[_0x1e35('0x54')](_0x3efad2);}})[_0x1e35('0x1e')](function(_0x18f69b){if(_0x18f69b){_0xccd105=_0x18f69b[_0x1e35('0x3f')];if(!_0x31ff53['query'][_0x1e35('0x40')](_0x1e35('0x57'))){_0x3efad2[_0x1e35('0x41')]=qs[_0x1e35('0x41')](_0x31ff53[_0x1e35('0x39')]['limit']);_0x3efad2[_0x1e35('0x2d')]=qs[_0x1e35('0x2d')](_0x31ff53['query'][_0x1e35('0x2d')]);}return _0x97c1b0[_0x1e35('0x54')](_0x3efad2);}})[_0x1e35('0x1e')](function(_0x195836){if(_0x195836){return _0x195836?{'count':_0xccd105,'rows':_0x195836}:null;}})[_0x1e35('0x1e')](respondWithResult(_0x10b9e9,null))[_0x1e35('0x28')](handleError(_0x10b9e9,null));};exports[_0x1e35('0x58')]=function(_0x876a83,_0x114679,_0x4eae01){if(_0x876a83['body']['id']){delete _0x876a83['body']['id'];}return db[_0x1e35('0x4a')][_0x1e35('0x55')]({'where':{'id':_0x876a83['params']['id']}})[_0x1e35('0x1e')](handleEntityNotFound(_0x114679,null))[_0x1e35('0x1e')](function(_0x4ac397){if(_0x4ac397){_0x876a83[_0x1e35('0x51')]['AccountId']=_0x4ac397['id'];_0x876a83[_0x1e35('0x51')][_0x1e35('0x59')]=integrations['getSubjects'](_0x876a83[_0x1e35('0x51')][_0x1e35('0x5a')],_0x876a83[_0x1e35('0x51')][_0x1e35('0x38')]);_0x876a83[_0x1e35('0x51')]['Descriptions']=integrations[_0x1e35('0x5b')](_0x876a83[_0x1e35('0x51')][_0x1e35('0x5a')],_0x876a83['body'][_0x1e35('0x38')]);return db[_0x1e35('0x56')]['create'](_0x876a83[_0x1e35('0x51')],{'include':[{'model':db[_0x1e35('0x5c')],'as':_0x1e35('0x59')},{'model':db[_0x1e35('0x5c')],'as':_0x1e35('0x5d')}]});}return null;})['then'](respondWithResult(_0x114679,null))[_0x1e35('0x28')](handleError(_0x114679,null));};exports[_0x1e35('0x5e')]=function(_0x5b16a3,_0x457240,_0x14fe24){var _0x403563='';return db[_0x1e35('0x4a')][_0x1e35('0x55')]({'where':{'id':_0x5b16a3['params']['id']},'attributes':['id','remoteUri',_0x1e35('0x5f')]})[_0x1e35('0x1e')](handleEntityNotFound(_0x457240,null))[_0x1e35('0x1e')](function(_0x2d0ad6){if(_0x2d0ad6){_0x403563=_0x2d0ad6[_0x1e35('0x60')];var _0x3d0219=_0x403563['slice'](-0x1);if(_0x3d0219==='/'){_0x403563=_0x403563[_0x1e35('0x61')](0x0,_0x403563[_0x1e35('0x62')](_0x3d0219));}return rp({'method':_0x1e35('0x63'),'uri':util[_0x1e35('0x64')](_0x1e35('0x65'),_0x403563,_0x1e35('0x66')),'headers':{'Authorization':util[_0x1e35('0x64')]('Basic\x20%s',new Buffer(util[_0x1e35('0x64')](_0x1e35('0x67'),_0x2d0ad6[_0x1e35('0x5f')]))[_0x1e35('0x68')]('base64'))},'json':!![]});}})[_0x1e35('0x1e')](function(_0x1363f3){if(_0x1363f3){var _0x495f7d=[_0x1e35('0x69'),_0x1e35('0x6a'),_0x1e35('0x6b'),_0x1e35('0x6c'),_0x1e35('0x32'),_0x1e35('0x6d'),'group','source','ticket_type','group',_0x1e35('0x6e')];_['remove'](_0x1363f3,function(_0x51cf10){return _0x495f7d[_0x1e35('0x6f')](_0x51cf10[_0x1e35('0x34')])||!_0x51cf10[_0x1e35('0x70')]&&_0x51cf10[_0x1e35('0x38')]!==_0x1e35('0x71')&&_0x51cf10[_0x1e35('0x38')]!==_0x1e35('0x72');});return{'count':_0x1363f3[_0x1e35('0x3f')],'rows':_[_0x1e35('0x36')](_0x1363f3,function(_0x13a3c2){return{'id':_0x13a3c2[_0x1e35('0x34')],'name':_0x13a3c2[_0x1e35('0x73')],'custom':!_0x13a3c2[_0x1e35('0x70')],'options':_0x13a3c2[_0x1e35('0x74')]?_[_0x1e35('0x36')](_0x13a3c2[_0x1e35('0x74')],function(_0xb851c1){return{'name':_[_0x1e35('0x75')](_0xb851c1),'value':_0xb851c1};}):[]};})};}})[_0x1e35('0x1e')](respondWithResult(_0x457240,null))[_0x1e35('0x28')](function(_0x2c973c){var _0x1dc259=_0x5b16a3[_0x1e35('0x39')]['test']?0x1f4:_0x2c973c[_0x1e35('0x76')]||0x1f4;logger[_0x1e35('0x23')](_0x1e35('0x77'),'getFields',_0x1dc259,JSON[_0x1e35('0x78')](_0x2c973c));delete _0x2c973c[_0x1e35('0x34')];if(_0x1dc259===0x191){_0x1dc259=0x190;}_0x457240[_0x1e35('0x32')](_0x1dc259)[_0x1e35('0x35')](_0x5b16a3['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x2c973c['statusCode']}:_0x2c973c);});}; \ No newline at end of file +var _0x6874=['error','code','message','info','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','length','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','Subjects','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','subject','agent','description','priority','source','ticket_type','group','remove','includes','default','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0x6874,0x1e7));var _0x4687=function(_0x28f6c5,_0x48e43f){_0x28f6c5=_0x28f6c5-0x0;var _0x317bcf=_0x6874[_0x28f6c5];return _0x317bcf;};'use strict';var pdf=require(_0x4687('0x0'));var emlformat=require(_0x4687('0x1'));var rimraf=require(_0x4687('0x2'));var zipdir=require(_0x4687('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4687('0x4'));var moment=require(_0x4687('0x5'));var BPromise=require(_0x4687('0x6'));var Mustache=require(_0x4687('0x7'));var util=require('util');var path=require('path');var sox=require(_0x4687('0x8'));var csv=require(_0x4687('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4687('0xa'));var squel=require(_0x4687('0xb'));var crypto=require(_0x4687('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4687('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4687('0xe'));var Papa=require('papaparse');var Redis=require(_0x4687('0xf'));var authService=require(_0x4687('0x10'));var qs=require(_0x4687('0x11'));var as=require(_0x4687('0x12'));var hardwareService=require(_0x4687('0x13'));var logger=require(_0x4687('0x14'))(_0x4687('0x15'));var utils=require(_0x4687('0x16'));var config=require(_0x4687('0x17'));var db=require(_0x4687('0x18'))['db'];var integrations=require(_0x4687('0x19'));var jayson=require(_0x4687('0x1a'));var client=jayson[_0x4687('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x1e32f5,_0x170b70,_0x3acb49){if(_0x3acb49){var _0x38b223=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38b223[_0x4687('0x1c')](_0x170b70)){return _0x1e32f5;}else{throw new db[(_0x4687('0x1d'))][(_0x4687('0x1e'))](_0x4687('0x1f'));}}else{return _0x1e32f5;}}function respondWithRpcPromise(_0x42c790,_0x143ab8,_0x5b5634,_0x2db193){return new BPromise(function(_0x80468b,_0x5c5d3a){var _0x2ba52d=_0x2db193||client;return _0x2ba52d[_0x4687('0x20')](_0x42c790,_0x5b5634)[_0x4687('0x21')](function(_0x494702){logger['info'](_0x4687('0x22'),_0x143ab8,'request\x20sent');logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x143ab8,_0x4687('0x23'),JSON[_0x4687('0x24')](_0x494702));if(_0x494702[_0x4687('0x25')]){if(_0x494702[_0x4687('0x25')][_0x4687('0x26')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x143ab8,_0x494702[_0x4687('0x25')][_0x4687('0x27')]);return _0x5c5d3a(_0x494702[_0x4687('0x25')][_0x4687('0x27')]);}logger[_0x4687('0x25')](_0x4687('0x22'),_0x143ab8,_0x494702['error'][_0x4687('0x27')]);return _0x80468b(_0x494702[_0x4687('0x25')][_0x4687('0x27')]);}else{logger[_0x4687('0x28')](_0x4687('0x22'),_0x143ab8,'request\x20sent');_0x80468b(_0x494702[_0x4687('0x29')][_0x4687('0x27')]);}})[_0x4687('0x2a')](function(_0x5258f3){logger['error'](_0x4687('0x22'),_0x143ab8,_0x5258f3);_0x5c5d3a(_0x5258f3);});});}function respondWithStatusCode(_0x3e268b,_0x31edcb){_0x31edcb=_0x31edcb||0xcc;return function(_0x395c41){if(_0x395c41){return _0x3e268b[_0x4687('0x2b')](_0x31edcb);}return _0x3e268b['status'](_0x31edcb)[_0x4687('0x2c')]();};}function respondWithResult(_0x4fdd13,_0x30f6ab){_0x30f6ab=_0x30f6ab||0xc8;return function(_0x5cda00){if(_0x5cda00){return _0x4fdd13[_0x4687('0x2d')](_0x30f6ab)['json'](_0x5cda00);}};}function respondWithFilteredResult(_0x5b2e9f,_0xe3aaa4){return function(_0x23f201){if(_0x23f201){var _0x16a3bc=_0x23f201[_0x4687('0x2e')],_0x2c4f22=_0xe3aaa4[_0x4687('0x2f')],_0x4cfad2=_0xe3aaa4['offset']+_0xe3aaa4[_0x4687('0x30')],_0x1f851b;if(_0x4cfad2>=_0x16a3bc){_0x4cfad2=_0x16a3bc;_0x1f851b=0xc8;}else{_0x1f851b=0xce;}_0x5b2e9f[_0x4687('0x2d')](_0x1f851b);return _0x5b2e9f[_0x4687('0x31')](_0x4687('0x32'),_0x2c4f22+'-'+_0x4cfad2+'/'+_0x16a3bc)['json'](_0x23f201);}return null;};}function patchUpdates(_0x3abcdd){return function(_0x7a7e55){try{jsonpatch[_0x4687('0x33')](_0x7a7e55,_0x3abcdd,!![]);}catch(_0x4f0390){return BPromise[_0x4687('0x34')](_0x4f0390);}return _0x7a7e55[_0x4687('0x35')]();};}function saveUpdates(_0x3cecfb,_0x214b07){return function(_0x54c515){if(_0x54c515){return _0x54c515[_0x4687('0x36')](_0x3cecfb)[_0x4687('0x21')](function(_0x24c025){return _0x24c025;});}return null;};}function removeEntity(_0x266470,_0x13040a){return function(_0x2fa41e){if(_0x2fa41e){return _0x2fa41e[_0x4687('0x37')]()[_0x4687('0x21')](function(){_0x266470[_0x4687('0x2d')](0xcc)[_0x4687('0x2c')]();});}};}function handleEntityNotFound(_0x49ba53,_0x250daf){return function(_0x4090d2){if(!_0x4090d2){_0x49ba53[_0x4687('0x2b')](0x194);}return _0x4090d2;};}function handleError(_0x45697d,_0x1eef3d){_0x1eef3d=_0x1eef3d||0x1f4;return function(_0x33caaf){logger[_0x4687('0x25')](_0x33caaf[_0x4687('0x38')]);if(_0x33caaf[_0x4687('0x39')]){delete _0x33caaf[_0x4687('0x39')];}_0x45697d['status'](_0x1eef3d)[_0x4687('0x3a')](_0x33caaf);};}exports['index']=function(_0x3fe961,_0x32b6f8){var _0x21e7db={},_0xa96330={},_0x189cd9={'count':0x0,'rows':[]};var _0x1bce87=_[_0x4687('0x3b')](db[_0x4687('0x3c')][_0x4687('0x3d')],function(_0x4c129f){return{'name':_0x4c129f[_0x4687('0x3e')],'type':_0x4c129f[_0x4687('0x3f')][_0x4687('0x40')]};});_0xa96330[_0x4687('0x41')]=_['map'](_0x1bce87,_0x4687('0x39'));_0xa96330[_0x4687('0x42')]=_[_0x4687('0x43')](_0x3fe961[_0x4687('0x42')]);_0xa96330[_0x4687('0x44')]=_['intersection'](_0xa96330['model'],_0xa96330[_0x4687('0x42')]);_0x21e7db[_0x4687('0x45')]=_[_0x4687('0x46')](_0xa96330[_0x4687('0x41')],qs[_0x4687('0x47')](_0x3fe961[_0x4687('0x42')]['fields']));_0x21e7db[_0x4687('0x45')]=_0x21e7db[_0x4687('0x45')]['length']?_0x21e7db[_0x4687('0x45')]:_0xa96330['model'];if(!_0x3fe961['query'][_0x4687('0x48')](_0x4687('0x49'))){_0x21e7db[_0x4687('0x30')]=qs[_0x4687('0x30')](_0x3fe961[_0x4687('0x42')]['limit']);_0x21e7db[_0x4687('0x2f')]=qs[_0x4687('0x2f')](_0x3fe961[_0x4687('0x42')][_0x4687('0x2f')]);}_0x21e7db[_0x4687('0x4a')]=qs['sort'](_0x3fe961[_0x4687('0x42')][_0x4687('0x4b')]);_0x21e7db[_0x4687('0x4c')]=qs['filters'](_[_0x4687('0x4d')](_0x3fe961['query'],_0xa96330[_0x4687('0x44')]));if(_0x3fe961[_0x4687('0x42')][_0x4687('0x4e')]){_0x21e7db[_0x4687('0x4c')]=_[_0x4687('0x4f')](_0x21e7db[_0x4687('0x4c')],{'$or':_[_0x4687('0x3b')](_0x1bce87,function(_0x5b9ab5){if(_0x5b9ab5[_0x4687('0x3f')]!==_0x4687('0x50')){var _0x5841a0={};_0x5841a0[_0x5b9ab5[_0x4687('0x39')]]={'$like':'%'+_0x3fe961[_0x4687('0x42')][_0x4687('0x4e')]+'%'};return _0x5841a0;}})});}_0x21e7db=_[_0x4687('0x4f')]({},_0x21e7db,_0x3fe961[_0x4687('0x51')]);var _0x383382={'where':_0x21e7db[_0x4687('0x4c')]};return db[_0x4687('0x3c')]['count'](_0x383382)['then'](function(_0x5c9d95){_0x189cd9[_0x4687('0x2e')]=_0x5c9d95;if(_0x3fe961[_0x4687('0x42')][_0x4687('0x52')]){_0x21e7db['include']=[{'all':!![]}];}return db[_0x4687('0x3c')][_0x4687('0x53')](_0x21e7db);})['then'](function(_0x3e2881){_0x189cd9['rows']=_0x3e2881;return _0x189cd9;})[_0x4687('0x21')](respondWithFilteredResult(_0x32b6f8,_0x21e7db))[_0x4687('0x2a')](handleError(_0x32b6f8,null));};exports[_0x4687('0x54')]=function(_0x6e012a,_0x304b76){var _0x4d7b2a={'raw':![],'where':{'id':_0x6e012a[_0x4687('0x55')]['id']}},_0x48207e={};_0x48207e[_0x4687('0x41')]=_[_0x4687('0x43')](db[_0x4687('0x3c')][_0x4687('0x3d')]);_0x48207e['query']=_[_0x4687('0x43')](_0x6e012a[_0x4687('0x42')]);_0x48207e['filters']=_[_0x4687('0x46')](_0x48207e[_0x4687('0x41')],_0x48207e[_0x4687('0x42')]);_0x4d7b2a['attributes']=_['intersection'](_0x48207e[_0x4687('0x41')],qs['fields'](_0x6e012a[_0x4687('0x42')][_0x4687('0x47')]));_0x4d7b2a[_0x4687('0x45')]=_0x4d7b2a[_0x4687('0x45')]['length']?_0x4d7b2a[_0x4687('0x45')]:_0x48207e[_0x4687('0x41')];if(_0x6e012a[_0x4687('0x42')]['includeAll']){_0x4d7b2a[_0x4687('0x56')]=[{'all':!![]}];}_0x4d7b2a=_[_0x4687('0x4f')]({},_0x4d7b2a,_0x6e012a[_0x4687('0x51')]);return db[_0x4687('0x3c')][_0x4687('0x57')](_0x4d7b2a)['then'](handleEntityNotFound(_0x304b76,null))[_0x4687('0x21')](respondWithResult(_0x304b76,null))[_0x4687('0x2a')](handleError(_0x304b76,null));};exports[_0x4687('0x58')]=function(_0x5da718,_0x420b1f){return db['FreshdeskAccount'][_0x4687('0x58')](_0x5da718['body'],{})[_0x4687('0x21')](respondWithResult(_0x420b1f,0xc9))[_0x4687('0x2a')](handleError(_0x420b1f,null));};exports[_0x4687('0x36')]=function(_0x212cc9,_0x33ffc2){if(_0x212cc9[_0x4687('0x59')]['id']){delete _0x212cc9[_0x4687('0x59')]['id'];}return db[_0x4687('0x3c')][_0x4687('0x57')]({'where':{'id':_0x212cc9[_0x4687('0x55')]['id']}})[_0x4687('0x21')](handleEntityNotFound(_0x33ffc2,null))[_0x4687('0x21')](saveUpdates(_0x212cc9['body'],null))['then'](respondWithResult(_0x33ffc2,null))[_0x4687('0x2a')](handleError(_0x33ffc2,null));};exports[_0x4687('0x37')]=function(_0x498b15,_0x1d9bdf){return db['FreshdeskAccount'][_0x4687('0x57')]({'where':{'id':_0x498b15[_0x4687('0x55')]['id']}})[_0x4687('0x21')](handleEntityNotFound(_0x1d9bdf,null))[_0x4687('0x21')](removeEntity(_0x1d9bdf,null))[_0x4687('0x2a')](handleError(_0x1d9bdf,null));};exports[_0x4687('0x5a')]=function(_0x10e6a4,_0x5536b5,_0x1af8b7){var _0x1c95c5={};var _0x2eb424={};var _0x5628af;var _0x444c24;return db['FreshdeskAccount'][_0x4687('0x5b')]({'where':{'id':_0x10e6a4[_0x4687('0x55')]['id']}})[_0x4687('0x21')](handleEntityNotFound(_0x5536b5,null))[_0x4687('0x21')](function(_0x3d7910){if(_0x3d7910){_0x5628af=_0x3d7910;_0x2eb424[_0x4687('0x41')]=_[_0x4687('0x43')](db[_0x4687('0x5c')][_0x4687('0x3d')]);_0x2eb424['query']=_['keys'](_0x10e6a4[_0x4687('0x42')]);_0x2eb424['filters']=_['intersection'](_0x2eb424[_0x4687('0x41')],_0x2eb424[_0x4687('0x42')]);_0x1c95c5[_0x4687('0x45')]=_[_0x4687('0x46')](_0x2eb424[_0x4687('0x41')],qs[_0x4687('0x47')](_0x10e6a4[_0x4687('0x42')][_0x4687('0x47')]));_0x1c95c5[_0x4687('0x45')]=_0x1c95c5[_0x4687('0x45')][_0x4687('0x5d')]?_0x1c95c5[_0x4687('0x45')]:_0x2eb424[_0x4687('0x41')];_0x1c95c5['order']=qs['sort'](_0x10e6a4[_0x4687('0x42')]['sort']);_0x1c95c5[_0x4687('0x4c')]=qs[_0x4687('0x44')](_['pick'](_0x10e6a4[_0x4687('0x42')],_0x2eb424[_0x4687('0x44')]));if(_0x10e6a4[_0x4687('0x42')][_0x4687('0x4e')]){_0x1c95c5[_0x4687('0x4c')]=_[_0x4687('0x4f')](_0x1c95c5[_0x4687('0x4c')],{'$or':_[_0x4687('0x3b')](_0x1c95c5[_0x4687('0x45')],function(_0x412ba1){var _0x49a86a={};_0x49a86a[_0x412ba1]={'$like':'%'+_0x10e6a4['query']['filter']+'%'};return _0x49a86a;})});}_0x1c95c5=_[_0x4687('0x4f')]({},_0x1c95c5,_0x10e6a4[_0x4687('0x51')]);return _0x5628af[_0x4687('0x5a')](_0x1c95c5);}})[_0x4687('0x21')](function(_0x324af0){if(_0x324af0){_0x444c24=_0x324af0[_0x4687('0x5d')];if(!_0x10e6a4[_0x4687('0x42')][_0x4687('0x48')]('nolimit')){_0x1c95c5[_0x4687('0x30')]=qs[_0x4687('0x30')](_0x10e6a4[_0x4687('0x42')][_0x4687('0x30')]);_0x1c95c5[_0x4687('0x2f')]=qs[_0x4687('0x2f')](_0x10e6a4[_0x4687('0x42')][_0x4687('0x2f')]);}return _0x5628af[_0x4687('0x5a')](_0x1c95c5);}})[_0x4687('0x21')](function(_0x37e86f){if(_0x37e86f){return _0x37e86f?{'count':_0x444c24,'rows':_0x37e86f}:null;}})[_0x4687('0x21')](respondWithResult(_0x5536b5,null))[_0x4687('0x2a')](handleError(_0x5536b5,null));};exports[_0x4687('0x5e')]=function(_0x4db238,_0x5c082d,_0x15828f){if(_0x4db238['body']['id']){delete _0x4db238[_0x4687('0x59')]['id'];}return db['FreshdeskAccount'][_0x4687('0x5b')]({'where':{'id':_0x4db238[_0x4687('0x55')]['id']}})[_0x4687('0x21')](handleEntityNotFound(_0x5c082d,null))[_0x4687('0x21')](function(_0x1832bc){if(_0x1832bc){_0x4db238[_0x4687('0x59')]['AccountId']=_0x1832bc['id'];_0x4db238[_0x4687('0x59')]['Subjects']=integrations[_0x4687('0x5f')](_0x4db238[_0x4687('0x59')]['channel'],_0x4db238[_0x4687('0x59')][_0x4687('0x3f')]);_0x4db238[_0x4687('0x59')][_0x4687('0x60')]=integrations[_0x4687('0x61')](_0x4db238[_0x4687('0x59')][_0x4687('0x62')],_0x4db238['body'][_0x4687('0x3f')]);return db[_0x4687('0x5c')][_0x4687('0x58')](_0x4db238[_0x4687('0x59')],{'include':[{'model':db[_0x4687('0x63')],'as':_0x4687('0x64')},{'model':db[_0x4687('0x63')],'as':_0x4687('0x60')}]});}return null;})[_0x4687('0x21')](respondWithResult(_0x5c082d,null))[_0x4687('0x2a')](handleError(_0x5c082d,null));};exports[_0x4687('0x65')]=function(_0x335cba,_0x3ac947,_0x1d371b){var _0x5d0e86='';return db[_0x4687('0x3c')][_0x4687('0x5b')]({'where':{'id':_0x335cba[_0x4687('0x55')]['id']},'attributes':['id','remoteUri',_0x4687('0x66')]})[_0x4687('0x21')](handleEntityNotFound(_0x3ac947,null))[_0x4687('0x21')](function(_0x283053){if(_0x283053){_0x5d0e86=_0x283053[_0x4687('0x67')];var _0x40e6a7=_0x5d0e86[_0x4687('0x68')](-0x1);if(_0x40e6a7==='/'){_0x5d0e86=_0x5d0e86[_0x4687('0x69')](0x0,_0x5d0e86[_0x4687('0x6a')](_0x40e6a7));}return rp({'method':_0x4687('0x6b'),'uri':util[_0x4687('0x6c')]('%s/%s',_0x5d0e86,_0x4687('0x6d')),'headers':{'Authorization':util[_0x4687('0x6c')](_0x4687('0x6e'),new Buffer(util[_0x4687('0x6c')]('%s:X',_0x283053[_0x4687('0x66')]))[_0x4687('0x6f')](_0x4687('0x70')))},'json':!![]});}})[_0x4687('0x21')](function(_0x4f9c27){if(_0x4f9c27){var _0x35fe53=[_0x4687('0x71'),_0x4687('0x72'),_0x4687('0x73'),_0x4687('0x74'),_0x4687('0x2d'),_0x4687('0x75'),'group',_0x4687('0x76'),_0x4687('0x77'),_0x4687('0x78'),'company'];_[_0x4687('0x79')](_0x4f9c27,function(_0x55419c){return _0x35fe53[_0x4687('0x7a')](_0x55419c[_0x4687('0x39')])||!_0x55419c[_0x4687('0x7b')]&&_0x55419c['type']!=='custom_text'&&_0x55419c[_0x4687('0x3f')]!==_0x4687('0x7c');});return{'count':_0x4f9c27[_0x4687('0x5d')],'rows':_[_0x4687('0x3b')](_0x4f9c27,function(_0x4c8a51){return{'id':_0x4c8a51[_0x4687('0x39')],'name':_0x4c8a51[_0x4687('0x7d')],'custom':!_0x4c8a51['default'],'options':_0x4c8a51[_0x4687('0x7e')]?_[_0x4687('0x3b')](_0x4c8a51['choices'],function(_0x2172c6){return{'name':_[_0x4687('0x7f')](_0x2172c6),'value':_0x2172c6};}):[]};})};}})[_0x4687('0x21')](respondWithResult(_0x3ac947,null))['catch'](function(_0x39ac40){var _0x320d1a=_0x335cba[_0x4687('0x42')][_0x4687('0x1c')]?0x1f4:_0x39ac40[_0x4687('0x80')]||0x1f4;logger['error'](_0x4687('0x81'),'getFields',_0x320d1a,JSON[_0x4687('0x24')](_0x39ac40));delete _0x39ac40[_0x4687('0x39')];if(_0x320d1a===0x191){_0x320d1a=0x190;}_0x3ac947[_0x4687('0x2d')](_0x320d1a)[_0x4687('0x3a')](_0x335cba[_0x4687('0x42')][_0x4687('0x1c')]?{'message':_0x4687('0x82'),'statusCode':_0x39ac40[_0x4687('0x80')]}:_0x39ac40);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ac46dc4..10d1baa 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 _0x23d1=['rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','moment','bluebird'];(function(_0x35ad40,_0x51a847){var _0xf1acc=function(_0x38dc08){while(--_0x38dc08){_0x35ad40['push'](_0x35ad40['shift']());}};_0xf1acc(++_0x51a847);}(_0x23d1,0xed));var _0x123d=function(_0x37f770,_0x6637fb){_0x37f770=_0x37f770-0x0;var _0x3af072=_0x23d1[_0x37f770];return _0x3af072;};'use strict';var _=require(_0x123d('0x0'));var util=require(_0x123d('0x1'));var logger=require('../../config/logger')(_0x123d('0x2'));var moment=require(_0x123d('0x3'));var BPromise=require(_0x123d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x123d('0x5'));var config=require(_0x123d('0x6'));var attributes=require(_0x123d('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x123d('0x8')]=function(_0x1825ed,_0x29cccd){return _0x1825ed['define'](_0x123d('0x9'),attributes,{'tableName':_0x123d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb76b=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger'];(function(_0xc20dd3,_0x24824f){var _0xa83da2=function(_0x607b06){while(--_0x607b06){_0xc20dd3['push'](_0xc20dd3['shift']());}};_0xa83da2(++_0x24824f);}(_0xb76b,0x177));var _0xbb76=function(_0x953485,_0x1109cf){_0x953485=_0x953485-0x0;var _0xaed5c=_0xb76b[_0x953485];return _0xaed5c;};'use strict';var _=require(_0xbb76('0x0'));var util=require('util');var logger=require(_0xbb76('0x1'))(_0xbb76('0x2'));var moment=require(_0xbb76('0x3'));var BPromise=require(_0xbb76('0x4'));var rp=require(_0xbb76('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb76('0x6'));var config=require(_0xbb76('0x7'));var attributes=require(_0xbb76('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xbb76('0x9')]=function(_0x55980e,_0x3d32c3){return _0x55980e[_0xbb76('0xa')](_0xbb76('0xb'),attributes,{'tableName':_0xbb76('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 119be0f..03fd044 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 _0x1540=['message','info','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowFreshdeskAccount','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5a62fd,_0x17c07){var _0x4abf96=function(_0x519b8a){while(--_0x519b8a){_0x5a62fd['push'](_0x5a62fd['shift']());}};_0x4abf96(++_0x17c07);}(_0x1540,0x10f));var _0x0154=function(_0x4fda17,_0x47a968){_0x4fda17=_0x4fda17-0x0;var _0x46d3c6=_0x1540[_0x4fda17];return _0x46d3c6;};'use strict';var _=require(_0x0154('0x0'));var util=require(_0x0154('0x1'));var moment=require(_0x0154('0x2'));var BPromise=require(_0x0154('0x3'));var rs=require(_0x0154('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0154('0x5'));var logger=require(_0x0154('0x6'))('rpc');var config=require(_0x0154('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0154('0x8')][_0x0154('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x99fe20,_0x2fa5eb,_0x3a4e66){return new BPromise(function(_0x525fb8,_0xa83245){return client['request'](_0x99fe20,_0x3a4e66)[_0x0154('0xa')](function(_0x43893d){logger['info'](_0x0154('0xb'),_0x2fa5eb,_0x0154('0xc'));logger[_0x0154('0xd')](_0x0154('0xe'),_0x2fa5eb,'request\x20sent',JSON['stringify'](_0x43893d));if(_0x43893d[_0x0154('0xf')]){if(_0x43893d[_0x0154('0xf')][_0x0154('0x10')]===0x1f4){logger[_0x0154('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x2fa5eb,_0x43893d[_0x0154('0xf')]['message']);return _0xa83245(_0x43893d[_0x0154('0xf')][_0x0154('0x11')]);}logger[_0x0154('0xf')](_0x0154('0xb'),_0x2fa5eb,_0x43893d[_0x0154('0xf')][_0x0154('0x11')]);return _0x525fb8(_0x43893d[_0x0154('0xf')]['message']);}else{logger[_0x0154('0x12')](_0x0154('0xb'),_0x2fa5eb,_0x0154('0xc'));_0x525fb8(_0x43893d['result'][_0x0154('0x11')]);}})[_0x0154('0x13')](function(_0x100937){logger[_0x0154('0xf')](_0x0154('0xb'),_0x2fa5eb,_0x100937);_0xa83245(_0x100937);});});}exports[_0x0154('0x14')]=function(_0x11581a){var _0x2cbdf0=this;return new Promise(function(_0x1f45c6,_0x5942a1){return db[_0x0154('0x15')][_0x0154('0x16')]({'raw':_0x11581a[_0x0154('0x17')]?_0x11581a[_0x0154('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x11581a[_0x0154('0x17')]?_0x11581a[_0x0154('0x17')][_0x0154('0x18')]||null:null,'attributes':_0x11581a[_0x0154('0x17')]?_0x11581a[_0x0154('0x17')][_0x0154('0x19')]||null:null,'limit':_0x11581a[_0x0154('0x17')]?_0x11581a[_0x0154('0x17')][_0x0154('0x1a')]||null:null,'include':_0x11581a[_0x0154('0x17')]?_0x11581a[_0x0154('0x17')][_0x0154('0x1b')]?_[_0x0154('0x1c')](_0x11581a[_0x0154('0x17')][_0x0154('0x1b')],function(_0x55f182){return{'model':db[_0x55f182[_0x0154('0x1d')]],'as':_0x55f182['as'],'attributes':_0x55f182[_0x0154('0x19')],'include':_0x55f182[_0x0154('0x1b')]?_[_0x0154('0x1c')](_0x55f182[_0x0154('0x1b')],function(_0x3ed5cb){return{'model':db[_0x3ed5cb[_0x0154('0x1d')]],'as':_0x3ed5cb['as'],'attributes':_0x3ed5cb[_0x0154('0x19')],'include':_0x3ed5cb[_0x0154('0x1b')]?_[_0x0154('0x1c')](_0x3ed5cb['include'],function(_0x4c1f53){return{'model':db[_0x4c1f53['model']],'as':_0x4c1f53['as'],'attributes':_0x4c1f53[_0x0154('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0154('0xa')](function(_0x12e238){logger[_0x0154('0x12')]('GetFreshdeskAccount',_0x11581a);logger[_0x0154('0xd')]('GetFreshdeskAccount',_0x11581a,JSON['stringify'](_0x12e238));_0x1f45c6(_0x12e238);})[_0x0154('0x13')](function(_0x117838){logger[_0x0154('0xf')](_0x0154('0x14'),_0x117838['message'],_0x11581a);_0x5942a1(_0x2cbdf0[_0x0154('0xf')](0x1f4,_0x117838[_0x0154('0x11')]));});});};exports['ShowFreshdeskAccount']=function(_0x1ec9c0){var _0x5297ef=this;return new Promise(function(_0x1e3deb,_0x2f92da){return db[_0x0154('0x15')]['find']({'raw':_0x1ec9c0[_0x0154('0x17')]?_0x1ec9c0['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ec9c0[_0x0154('0x17')]?_0x1ec9c0[_0x0154('0x17')][_0x0154('0x18')]||null:null,'attributes':_0x1ec9c0[_0x0154('0x17')]?_0x1ec9c0[_0x0154('0x17')][_0x0154('0x19')]||null:null,'include':_0x1ec9c0[_0x0154('0x17')]?_0x1ec9c0[_0x0154('0x17')][_0x0154('0x1b')]?_[_0x0154('0x1c')](_0x1ec9c0['options']['include'],function(_0x44e2d2){return{'model':db[_0x44e2d2[_0x0154('0x1d')]],'as':_0x44e2d2['as'],'attributes':_0x44e2d2[_0x0154('0x19')],'include':_0x44e2d2['include']?_[_0x0154('0x1c')](_0x44e2d2[_0x0154('0x1b')],function(_0x40e596){return{'model':db[_0x40e596[_0x0154('0x1d')]],'as':_0x40e596['as'],'attributes':_0x40e596['attributes'],'include':_0x40e596['include']?_[_0x0154('0x1c')](_0x40e596[_0x0154('0x1b')],function(_0x541d0f){return{'model':db[_0x541d0f[_0x0154('0x1d')]],'as':_0x541d0f['as'],'attributes':_0x541d0f[_0x0154('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0154('0xa')](function(_0x14b5cd){logger[_0x0154('0x12')](_0x0154('0x1e'),_0x1ec9c0);logger[_0x0154('0xd')](_0x0154('0x1e'),_0x1ec9c0,JSON[_0x0154('0x1f')](_0x14b5cd));_0x1e3deb(_0x14b5cd);})['catch'](function(_0x453765){logger[_0x0154('0xf')](_0x0154('0x1e'),_0x453765[_0x0154('0x11')],_0x1ec9c0);_0x2f92da(_0x5297ef[_0x0154('0xf')](0x1f4,_0x453765['message']));});});}; \ No newline at end of file +var _0x4211=['model','ShowFreshdeskAccount','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','include','map'];(function(_0x4ae29a,_0x4752df){var _0x439da4=function(_0x102af1){while(--_0x102af1){_0x4ae29a['push'](_0x4ae29a['shift']());}};_0x439da4(++_0x4752df);}(_0x4211,0x19b));var _0x1421=function(_0xf507d0,_0x552d20){_0xf507d0=_0xf507d0-0x0;var _0x3c505d=_0x4211[_0xf507d0];return _0x3c505d;};'use strict';var _=require(_0x1421('0x0'));var util=require(_0x1421('0x1'));var moment=require('moment');var BPromise=require(_0x1421('0x2'));var rs=require(_0x1421('0x3'));var fs=require('fs');var Redis=require(_0x1421('0x4'));var db=require(_0x1421('0x5'))['db'];var utils=require(_0x1421('0x6'));var logger=require(_0x1421('0x7'))(_0x1421('0x8'));var config=require(_0x1421('0x9'));var jayson=require(_0x1421('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xcb1be2,_0x5d5102,_0x26d390){return new BPromise(function(_0x5ad19c,_0x26514a){return client[_0x1421('0xb')](_0xcb1be2,_0x26d390)[_0x1421('0xc')](function(_0x3f8545){logger[_0x1421('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x5d5102,'request\x20sent');logger[_0x1421('0xe')](_0x1421('0xf'),_0x5d5102,_0x1421('0x10'),JSON['stringify'](_0x3f8545));if(_0x3f8545['error']){if(_0x3f8545[_0x1421('0x11')]['code']===0x1f4){logger['error'](_0x1421('0x12'),_0x5d5102,_0x3f8545[_0x1421('0x11')][_0x1421('0x13')]);return _0x26514a(_0x3f8545[_0x1421('0x11')]['message']);}logger[_0x1421('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x5d5102,_0x3f8545[_0x1421('0x11')][_0x1421('0x13')]);return _0x5ad19c(_0x3f8545['error'][_0x1421('0x13')]);}else{logger[_0x1421('0xd')](_0x1421('0x12'),_0x5d5102,_0x1421('0x10'));_0x5ad19c(_0x3f8545[_0x1421('0x14')][_0x1421('0x13')]);}})[_0x1421('0x15')](function(_0x43afa7){logger[_0x1421('0x11')](_0x1421('0x12'),_0x5d5102,_0x43afa7);_0x26514a(_0x43afa7);});});}exports[_0x1421('0x16')]=function(_0x16a97e){var _0x26e9d1=this;return new Promise(function(_0x30e8ba,_0x106f5d){return db[_0x1421('0x17')]['findAll']({'raw':_0x16a97e[_0x1421('0x18')]?_0x16a97e[_0x1421('0x18')][_0x1421('0x19')]===undefined?!![]:![]:!![],'where':_0x16a97e['options']?_0x16a97e[_0x1421('0x18')][_0x1421('0x1a')]||null:null,'attributes':_0x16a97e[_0x1421('0x18')]?_0x16a97e[_0x1421('0x18')][_0x1421('0x1b')]||null:null,'limit':_0x16a97e[_0x1421('0x18')]?_0x16a97e['options'][_0x1421('0x1c')]||null:null,'include':_0x16a97e[_0x1421('0x18')]?_0x16a97e['options'][_0x1421('0x1d')]?_[_0x1421('0x1e')](_0x16a97e['options'][_0x1421('0x1d')],function(_0x5b35b1){return{'model':db[_0x5b35b1[_0x1421('0x1f')]],'as':_0x5b35b1['as'],'attributes':_0x5b35b1[_0x1421('0x1b')],'include':_0x5b35b1[_0x1421('0x1d')]?_['map'](_0x5b35b1[_0x1421('0x1d')],function(_0x3b70c0){return{'model':db[_0x3b70c0['model']],'as':_0x3b70c0['as'],'attributes':_0x3b70c0[_0x1421('0x1b')],'include':_0x3b70c0[_0x1421('0x1d')]?_['map'](_0x3b70c0[_0x1421('0x1d')],function(_0x316ed5){return{'model':db[_0x316ed5['model']],'as':_0x316ed5['as'],'attributes':_0x316ed5['attributes']};}):[]};}):[]};}):[]:[]})[_0x1421('0xc')](function(_0xbe9e02){logger[_0x1421('0xd')](_0x1421('0x16'),_0x16a97e);logger[_0x1421('0xe')](_0x1421('0x16'),_0x16a97e,JSON['stringify'](_0xbe9e02));_0x30e8ba(_0xbe9e02);})[_0x1421('0x15')](function(_0x4a7cab){logger[_0x1421('0x11')](_0x1421('0x16'),_0x4a7cab['message'],_0x16a97e);_0x106f5d(_0x26e9d1['error'](0x1f4,_0x4a7cab[_0x1421('0x13')]));});});};exports[_0x1421('0x20')]=function(_0x25c9a9){var _0xed85fe=this;return new Promise(function(_0x76898c,_0x5369d4){return db[_0x1421('0x17')]['find']({'raw':_0x25c9a9[_0x1421('0x18')]?_0x25c9a9[_0x1421('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x25c9a9['options']?_0x25c9a9[_0x1421('0x18')][_0x1421('0x1a')]||null:null,'attributes':_0x25c9a9['options']?_0x25c9a9[_0x1421('0x18')][_0x1421('0x1b')]||null:null,'include':_0x25c9a9[_0x1421('0x18')]?_0x25c9a9[_0x1421('0x18')][_0x1421('0x1d')]?_[_0x1421('0x1e')](_0x25c9a9['options'][_0x1421('0x1d')],function(_0x234898){return{'model':db[_0x234898['model']],'as':_0x234898['as'],'attributes':_0x234898[_0x1421('0x1b')],'include':_0x234898['include']?_['map'](_0x234898[_0x1421('0x1d')],function(_0x5b592b){return{'model':db[_0x5b592b[_0x1421('0x1f')]],'as':_0x5b592b['as'],'attributes':_0x5b592b[_0x1421('0x1b')],'include':_0x5b592b['include']?_[_0x1421('0x1e')](_0x5b592b[_0x1421('0x1d')],function(_0x2cffa9){return{'model':db[_0x2cffa9[_0x1421('0x1f')]],'as':_0x2cffa9['as'],'attributes':_0x2cffa9[_0x1421('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1421('0xc')](function(_0x2cd50f){logger[_0x1421('0xd')]('ShowFreshdeskAccount',_0x25c9a9);logger['debug']('ShowFreshdeskAccount',_0x25c9a9,JSON[_0x1421('0x21')](_0x2cd50f));_0x76898c(_0x2cd50f);})[_0x1421('0x15')](function(_0x3e45a4){logger['error'](_0x1421('0x20'),_0x3e45a4[_0x1421('0x13')],_0x25c9a9);_0x5369d4(_0xed85fe[_0x1421('0x11')](0x1f4,_0x3e45a4[_0x1421('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 090839a..54183ff 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 _0x04f4=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects'];(function(_0x459017,_0x2e46b5){var _0x870ff7=function(_0x43c1fd){while(--_0x43c1fd){_0x459017['push'](_0x459017['shift']());}};_0x870ff7(++_0x2e46b5);}(_0x04f4,0x181));var _0x404f=function(_0x7df6d9,_0x3dbee1){_0x7df6d9=_0x7df6d9-0x0;var _0x233f4b=_0x04f4[_0x7df6d9];return _0x233f4b;};'use strict';var multer=require(_0x404f('0x0'));var util=require(_0x404f('0x1'));var path=require(_0x404f('0x2'));var timeout=require(_0x404f('0x3'));var express=require('express');var router=express[_0x404f('0x4')]();var auth=require(_0x404f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x404f('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x404f('0x7')]('/',auth['isAuthenticated'](),controller[_0x404f('0x8')]);router[_0x404f('0x7')](_0x404f('0x9'),auth[_0x404f('0xa')](),controller[_0x404f('0xb')]);router[_0x404f('0x7')](_0x404f('0xc'),auth[_0x404f('0xa')](),controller[_0x404f('0xd')]);router[_0x404f('0x7')](_0x404f('0xe'),auth['isAuthenticated'](),controller[_0x404f('0xf')]);router[_0x404f('0x7')](_0x404f('0x10'),auth['isAuthenticated'](),controller[_0x404f('0x11')]);router['get']('/:id/tags',auth[_0x404f('0xa')](),controller[_0x404f('0x12')]);router[_0x404f('0x13')]('/',auth[_0x404f('0xa')](),controller[_0x404f('0x14')]);router[_0x404f('0x13')](_0x404f('0x15'),auth[_0x404f('0xa')](),controller[_0x404f('0x16')]);router['put'](_0x404f('0x9'),auth[_0x404f('0xa')](),controller['update']);router[_0x404f('0x17')](_0x404f('0x9'),auth[_0x404f('0xa')](),controller[_0x404f('0x18')]);module['exports']=router; \ No newline at end of file +var _0x69ab=['exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','post','create','put','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69ab,0xbe));var _0xb69a=function(_0x24203c,_0x2445b7){_0x24203c=_0x24203c-0x0;var _0x18ab61=_0x69ab[_0x24203c];return _0x18ab61;};'use strict';var multer=require(_0xb69a('0x0'));var util=require(_0xb69a('0x1'));var path=require(_0xb69a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb69a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb69a('0x4'));var config=require(_0xb69a('0x5'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0xb69a('0x6')](),controller['index']);router['get'](_0xb69a('0x7'),auth[_0xb69a('0x6')](),controller[_0xb69a('0x8')]);router[_0xb69a('0x9')](_0xb69a('0xa'),auth[_0xb69a('0x6')](),controller[_0xb69a('0xb')]);router[_0xb69a('0x9')](_0xb69a('0xc'),auth[_0xb69a('0x6')](),controller[_0xb69a('0xd')]);router[_0xb69a('0x9')](_0xb69a('0xe'),auth[_0xb69a('0x6')](),controller['getDescriptions']);router[_0xb69a('0x9')](_0xb69a('0xf'),auth[_0xb69a('0x6')](),controller['getTags']);router[_0xb69a('0x10')]('/',auth[_0xb69a('0x6')](),controller[_0xb69a('0x11')]);router[_0xb69a('0x10')](_0xb69a('0xf'),auth['isAuthenticated'](),controller['setTags']);router[_0xb69a('0x12')](_0xb69a('0x7'),auth[_0xb69a('0x6')](),controller['update']);router['delete'](_0xb69a('0x7'),auth[_0xb69a('0x6')](),controller[_0xb69a('0x13')]);module[_0xb69a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 7d6df0a..071e57f 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 _0x9e17=['STRING','sequelize','exports'];(function(_0x44df8a,_0x2cd410){var _0x2a714b=function(_0x1dd208){while(--_0x1dd208){_0x44df8a['push'](_0x44df8a['shift']());}};_0x2a714b(++_0x2cd410);}(_0x9e17,0x178));var _0x79e1=function(_0x21ef85,_0x2d9f4f){_0x21ef85=_0x21ef85-0x0;var _0x5b9a7d=_0x9e17[_0x21ef85];return _0x5b9a7d;};'use strict';var Sequelize=require(_0x79e1('0x0'));module[_0x79e1('0x1')]={'name':{'type':Sequelize[_0x79e1('0x2')]},'description':{'type':Sequelize[_0x79e1('0x2')]}}; \ No newline at end of file +var _0x0dab=['sequelize','exports','STRING'];(function(_0x47aa7a,_0xdbc03a){var _0x5869b0=function(_0x38840d){while(--_0x38840d){_0x47aa7a['push'](_0x47aa7a['shift']());}};_0x5869b0(++_0xdbc03a);}(_0x0dab,0x126));var _0xb0da=function(_0x13ee42,_0xa42310){_0x13ee42=_0x13ee42-0x0;var _0x3e4651=_0x0dab[_0x13ee42];return _0x3e4651;};'use strict';var Sequelize=require(_0xb0da('0x0'));module[_0xb0da('0x1')]={'name':{'type':Sequelize[_0xb0da('0x2')]},'description':{'type':Sequelize[_0xb0da('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 36ad7c1..fbf29fe 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 _0xbd85=['set','Content-Range','apply','reject','save','update','destroy','end','stack','name','map','FreshdeskConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','include','findAll','show','rawAttributes','fields','length','includeAll','options','find','create','body','params','getFields','findOne','FreshdeskField','getSubjects','hasOwnProperty','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','sendStatus','status','json','count','offset','limit'];(function(_0x3094a4,_0x3af762){var _0x5c1cda=function(_0x949933){while(--_0x949933){_0x3094a4['push'](_0x3094a4['shift']());}};_0x5c1cda(++_0x3af762);}(_0xbd85,0xf9));var _0x5bd8=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0xbd85[_0x3ba924];return _0x4cc1df;};'use strict';var pdf=require(_0x5bd8('0x0'));var emlformat=require(_0x5bd8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5bd8('0x2'));var jsonpatch=require(_0x5bd8('0x3'));var rp=require(_0x5bd8('0x4'));var moment=require(_0x5bd8('0x5'));var BPromise=require(_0x5bd8('0x6'));var Mustache=require(_0x5bd8('0x7'));var util=require(_0x5bd8('0x8'));var path=require(_0x5bd8('0x9'));var sox=require('sox');var csv=require(_0x5bd8('0xa'));var ejs=require(_0x5bd8('0xb'));var fs=require('fs');var _=require(_0x5bd8('0xc'));var squel=require(_0x5bd8('0xd'));var crypto=require(_0x5bd8('0xe'));var jsforce=require(_0x5bd8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5bd8('0xa'));var querystring=require('querystring');var Papa=require(_0x5bd8('0x10'));var Redis=require(_0x5bd8('0x11'));var authService=require(_0x5bd8('0x12'));var qs=require(_0x5bd8('0x13'));var as=require(_0x5bd8('0x14'));var hardwareService=require(_0x5bd8('0x15'));var logger=require(_0x5bd8('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x5bd8('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x5bd8('0x18')][_0x5bd8('0x19')]({'port':0x232a});function checkPasswordPattern(_0x538628,_0x5b5b19,_0x7940f2){if(_0x7940f2){var _0x36e9ab=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x36e9ab[_0x5bd8('0x1a')](_0x5b5b19)){return _0x538628;}else{throw new db[(_0x5bd8('0x1b'))][(_0x5bd8('0x1c'))](_0x5bd8('0x1d'));}}else{return _0x538628;}}function respondWithRpcPromise(_0xf98118,_0x2d1d6e,_0x518a83,_0x15220d){return new BPromise(function(_0x8a97d5,_0xf82ed3){var _0x5845ec=_0x15220d||client;return _0x5845ec[_0x5bd8('0x1e')](_0xf98118,_0x518a83)[_0x5bd8('0x1f')](function(_0x3606e2){logger[_0x5bd8('0x20')](_0x5bd8('0x21'),_0x2d1d6e,'request\x20sent');logger[_0x5bd8('0x22')](_0x5bd8('0x23'),_0x2d1d6e,_0x5bd8('0x24'),JSON['stringify'](_0x3606e2));if(_0x3606e2['error']){if(_0x3606e2['error'][_0x5bd8('0x25')]===0x1f4){logger[_0x5bd8('0x26')](_0x5bd8('0x21'),_0x2d1d6e,_0x3606e2[_0x5bd8('0x26')][_0x5bd8('0x27')]);return _0xf82ed3(_0x3606e2['error'][_0x5bd8('0x27')]);}logger[_0x5bd8('0x26')](_0x5bd8('0x21'),_0x2d1d6e,_0x3606e2[_0x5bd8('0x26')][_0x5bd8('0x27')]);return _0x8a97d5(_0x3606e2[_0x5bd8('0x26')]['message']);}else{logger[_0x5bd8('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2d1d6e,_0x5bd8('0x24'));_0x8a97d5(_0x3606e2[_0x5bd8('0x28')][_0x5bd8('0x27')]);}})[_0x5bd8('0x29')](function(_0x1f2168){logger[_0x5bd8('0x26')](_0x5bd8('0x21'),_0x2d1d6e,_0x1f2168);_0xf82ed3(_0x1f2168);});});}function respondWithStatusCode(_0x33c910,_0x4ea8cc){_0x4ea8cc=_0x4ea8cc||0xcc;return function(_0x4fed10){if(_0x4fed10){return _0x33c910[_0x5bd8('0x2a')](_0x4ea8cc);}return _0x33c910[_0x5bd8('0x2b')](_0x4ea8cc)['end']();};}function respondWithResult(_0x1399b9,_0x3b0cc9){_0x3b0cc9=_0x3b0cc9||0xc8;return function(_0x2c053e){if(_0x2c053e){return _0x1399b9[_0x5bd8('0x2b')](_0x3b0cc9)[_0x5bd8('0x2c')](_0x2c053e);}};}function respondWithFilteredResult(_0x3afff0,_0x5e1bb2){return function(_0x1c95b0){if(_0x1c95b0){var _0x345582=_0x1c95b0[_0x5bd8('0x2d')],_0x4947eb=_0x5e1bb2[_0x5bd8('0x2e')],_0x4bcfbe=_0x5e1bb2[_0x5bd8('0x2e')]+_0x5e1bb2[_0x5bd8('0x2f')],_0xb78bb;if(_0x4bcfbe>=_0x345582){_0x4bcfbe=_0x345582;_0xb78bb=0xc8;}else{_0xb78bb=0xce;}_0x3afff0[_0x5bd8('0x2b')](_0xb78bb);return _0x3afff0[_0x5bd8('0x30')](_0x5bd8('0x31'),_0x4947eb+'-'+_0x4bcfbe+'/'+_0x345582)[_0x5bd8('0x2c')](_0x1c95b0);}return null;};}function patchUpdates(_0x20d25c){return function(_0x347d9e){try{jsonpatch[_0x5bd8('0x32')](_0x347d9e,_0x20d25c,!![]);}catch(_0x2e7473){return BPromise[_0x5bd8('0x33')](_0x2e7473);}return _0x347d9e[_0x5bd8('0x34')]();};}function saveUpdates(_0x5f3c25,_0x24a227){return function(_0x33b3aa){if(_0x33b3aa){return _0x33b3aa[_0x5bd8('0x35')](_0x5f3c25)[_0x5bd8('0x1f')](function(_0x5f2061){return _0x5f2061;});}return null;};}function removeEntity(_0x1e9dda,_0x32207b){return function(_0x49c43c){if(_0x49c43c){return _0x49c43c[_0x5bd8('0x36')]()[_0x5bd8('0x1f')](function(){_0x1e9dda[_0x5bd8('0x2b')](0xcc)[_0x5bd8('0x37')]();});}};}function handleEntityNotFound(_0x926ced,_0x3fde52){return function(_0x326220){if(!_0x326220){_0x926ced['sendStatus'](0x194);}return _0x326220;};}function handleError(_0x3861f1,_0xdd9ab4){_0xdd9ab4=_0xdd9ab4||0x1f4;return function(_0x2e5b13){logger['error'](_0x2e5b13[_0x5bd8('0x38')]);if(_0x2e5b13['name']){delete _0x2e5b13[_0x5bd8('0x39')];}_0x3861f1[_0x5bd8('0x2b')](_0xdd9ab4)['send'](_0x2e5b13);};}exports['index']=function(_0x11f5d1,_0x2254fd){var _0x59fc12={},_0x4c6414={},_0x337776={'count':0x0,'rows':[]};var _0x4a8f10=_[_0x5bd8('0x3a')](db[_0x5bd8('0x3b')]['rawAttributes'],function(_0xe44215){return{'name':_0xe44215[_0x5bd8('0x3c')],'type':_0xe44215['type'][_0x5bd8('0x3d')]};});_0x4c6414[_0x5bd8('0x3e')]=_[_0x5bd8('0x3a')](_0x4a8f10,_0x5bd8('0x39'));_0x4c6414[_0x5bd8('0x3f')]=_[_0x5bd8('0x40')](_0x11f5d1[_0x5bd8('0x3f')]);_0x4c6414[_0x5bd8('0x41')]=_[_0x5bd8('0x42')](_0x4c6414[_0x5bd8('0x3e')],_0x4c6414[_0x5bd8('0x3f')]);_0x59fc12[_0x5bd8('0x43')]=_[_0x5bd8('0x42')](_0x4c6414[_0x5bd8('0x3e')],qs['fields'](_0x11f5d1[_0x5bd8('0x3f')]['fields']));_0x59fc12['attributes']=_0x59fc12['attributes']['length']?_0x59fc12[_0x5bd8('0x43')]:_0x4c6414[_0x5bd8('0x3e')];if(!_0x11f5d1[_0x5bd8('0x3f')]['hasOwnProperty'](_0x5bd8('0x44'))){_0x59fc12[_0x5bd8('0x2f')]=qs[_0x5bd8('0x2f')](_0x11f5d1[_0x5bd8('0x3f')]['limit']);_0x59fc12[_0x5bd8('0x2e')]=qs['offset'](_0x11f5d1[_0x5bd8('0x3f')][_0x5bd8('0x2e')]);}_0x59fc12[_0x5bd8('0x45')]=qs[_0x5bd8('0x46')](_0x11f5d1['query'][_0x5bd8('0x46')]);_0x59fc12['where']=qs['filters'](_[_0x5bd8('0x47')](_0x11f5d1['query'],_0x4c6414[_0x5bd8('0x41')]));if(_0x11f5d1['query'][_0x5bd8('0x48')]){_0x59fc12['where']=_['merge'](_0x59fc12[_0x5bd8('0x49')],{'$or':_['map'](_0x4a8f10,function(_0x48d036){if(_0x48d036[_0x5bd8('0x4a')]!==_0x5bd8('0x4b')){var _0xbe65a7={};_0xbe65a7[_0x48d036[_0x5bd8('0x39')]]={'$like':'%'+_0x11f5d1[_0x5bd8('0x3f')][_0x5bd8('0x48')]+'%'};return _0xbe65a7;}})});}_0x59fc12=_[_0x5bd8('0x4c')]({},_0x59fc12,_0x11f5d1['options']);var _0x436229={'where':_0x59fc12[_0x5bd8('0x49')]};return db[_0x5bd8('0x3b')][_0x5bd8('0x2d')](_0x436229)[_0x5bd8('0x1f')](function(_0x1f2e22){_0x337776[_0x5bd8('0x2d')]=_0x1f2e22;if(_0x11f5d1[_0x5bd8('0x3f')]['includeAll']){_0x59fc12[_0x5bd8('0x4d')]=[{'all':!![]}];}return db[_0x5bd8('0x3b')][_0x5bd8('0x4e')](_0x59fc12);})[_0x5bd8('0x1f')](function(_0x49ef24){_0x337776['rows']=_0x49ef24;return _0x337776;})['then'](respondWithFilteredResult(_0x2254fd,_0x59fc12))['catch'](handleError(_0x2254fd,null));};exports[_0x5bd8('0x4f')]=function(_0x1c9338,_0x3fbadf){var _0x5906b={'raw':![],'where':{'id':_0x1c9338['params']['id']}},_0x85f432={};_0x85f432[_0x5bd8('0x3e')]=_[_0x5bd8('0x40')](db[_0x5bd8('0x3b')][_0x5bd8('0x50')]);_0x85f432[_0x5bd8('0x3f')]=_[_0x5bd8('0x40')](_0x1c9338[_0x5bd8('0x3f')]);_0x85f432[_0x5bd8('0x41')]=_['intersection'](_0x85f432['model'],_0x85f432[_0x5bd8('0x3f')]);_0x5906b['attributes']=_[_0x5bd8('0x42')](_0x85f432['model'],qs[_0x5bd8('0x51')](_0x1c9338[_0x5bd8('0x3f')][_0x5bd8('0x51')]));_0x5906b[_0x5bd8('0x43')]=_0x5906b[_0x5bd8('0x43')][_0x5bd8('0x52')]?_0x5906b[_0x5bd8('0x43')]:_0x85f432[_0x5bd8('0x3e')];if(_0x1c9338[_0x5bd8('0x3f')][_0x5bd8('0x53')]){_0x5906b[_0x5bd8('0x4d')]=[{'all':!![]}];}_0x5906b=_['merge']({},_0x5906b,_0x1c9338[_0x5bd8('0x54')]);return db['FreshdeskConfiguration'][_0x5bd8('0x55')](_0x5906b)[_0x5bd8('0x1f')](handleEntityNotFound(_0x3fbadf,null))['then'](respondWithResult(_0x3fbadf,null))[_0x5bd8('0x29')](handleError(_0x3fbadf,null));};exports['create']=function(_0x537215,_0x235f06){return db[_0x5bd8('0x3b')][_0x5bd8('0x56')](_0x537215[_0x5bd8('0x57')],{})[_0x5bd8('0x1f')](respondWithResult(_0x235f06,0xc9))[_0x5bd8('0x29')](handleError(_0x235f06,null));};exports[_0x5bd8('0x35')]=function(_0x149320,_0x3e968c){if(_0x149320['body']['id']){delete _0x149320[_0x5bd8('0x57')]['id'];}return db[_0x5bd8('0x3b')][_0x5bd8('0x55')]({'where':{'id':_0x149320[_0x5bd8('0x58')]['id']}})[_0x5bd8('0x1f')](handleEntityNotFound(_0x3e968c,null))[_0x5bd8('0x1f')](saveUpdates(_0x149320[_0x5bd8('0x57')],null))['then'](respondWithResult(_0x3e968c,null))[_0x5bd8('0x29')](handleError(_0x3e968c,null));};exports[_0x5bd8('0x36')]=function(_0x3ed5dc,_0x5dcf35){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x3ed5dc[_0x5bd8('0x58')]['id']}})[_0x5bd8('0x1f')](handleEntityNotFound(_0x5dcf35,null))[_0x5bd8('0x1f')](removeEntity(_0x5dcf35,null))[_0x5bd8('0x29')](handleError(_0x5dcf35,null));};exports[_0x5bd8('0x59')]=function(_0x5ebc46,_0x3ef7cc,_0x4da681){var _0x34d8a6={};var _0x23a3ec={};var _0x4bf422;var _0x5e0295;return db[_0x5bd8('0x3b')][_0x5bd8('0x5a')]({'where':{'id':_0x5ebc46[_0x5bd8('0x58')]['id']}})['then'](handleEntityNotFound(_0x3ef7cc,null))[_0x5bd8('0x1f')](function(_0xeb9dad){if(_0xeb9dad){_0x4bf422=_0xeb9dad;_0x23a3ec[_0x5bd8('0x3e')]=_[_0x5bd8('0x40')](db[_0x5bd8('0x5b')][_0x5bd8('0x50')]);_0x23a3ec[_0x5bd8('0x3f')]=_[_0x5bd8('0x40')](_0x5ebc46[_0x5bd8('0x3f')]);_0x23a3ec[_0x5bd8('0x41')]=_[_0x5bd8('0x42')](_0x23a3ec[_0x5bd8('0x3e')],_0x23a3ec[_0x5bd8('0x3f')]);_0x34d8a6[_0x5bd8('0x43')]=_['intersection'](_0x23a3ec[_0x5bd8('0x3e')],qs[_0x5bd8('0x51')](_0x5ebc46[_0x5bd8('0x3f')][_0x5bd8('0x51')]));_0x34d8a6[_0x5bd8('0x43')]=_0x34d8a6[_0x5bd8('0x43')]['length']?_0x34d8a6[_0x5bd8('0x43')]:_0x23a3ec[_0x5bd8('0x3e')];_0x34d8a6[_0x5bd8('0x45')]=qs[_0x5bd8('0x46')](_0x5ebc46[_0x5bd8('0x3f')][_0x5bd8('0x46')]);_0x34d8a6['where']=qs['filters'](_[_0x5bd8('0x47')](_0x5ebc46[_0x5bd8('0x3f')],_0x23a3ec[_0x5bd8('0x41')]));if(_0x5ebc46[_0x5bd8('0x3f')]['filter']){_0x34d8a6[_0x5bd8('0x49')]=_[_0x5bd8('0x4c')](_0x34d8a6[_0x5bd8('0x49')],{'$or':_[_0x5bd8('0x3a')](_0x34d8a6[_0x5bd8('0x43')],function(_0xa74c4c){var _0x1d883f={};_0x1d883f[_0xa74c4c]={'$like':'%'+_0x5ebc46[_0x5bd8('0x3f')][_0x5bd8('0x48')]+'%'};return _0x1d883f;})});}_0x34d8a6=_[_0x5bd8('0x4c')]({},_0x34d8a6,_0x5ebc46['options']);return _0x4bf422['getFields'](_0x34d8a6);}})[_0x5bd8('0x1f')](function(_0x25aebe){if(_0x25aebe){_0x5e0295=_0x25aebe[_0x5bd8('0x52')];if(!_0x5ebc46[_0x5bd8('0x3f')]['hasOwnProperty'](_0x5bd8('0x44'))){_0x34d8a6[_0x5bd8('0x2f')]=qs[_0x5bd8('0x2f')](_0x5ebc46[_0x5bd8('0x3f')][_0x5bd8('0x2f')]);_0x34d8a6[_0x5bd8('0x2e')]=qs[_0x5bd8('0x2e')](_0x5ebc46['query'][_0x5bd8('0x2e')]);}return _0x4bf422[_0x5bd8('0x59')](_0x34d8a6);}})[_0x5bd8('0x1f')](function(_0x26b333){if(_0x26b333){return _0x26b333?{'count':_0x5e0295,'rows':_0x26b333}:null;}})[_0x5bd8('0x1f')](respondWithResult(_0x3ef7cc,null))[_0x5bd8('0x29')](handleError(_0x3ef7cc,null));};exports[_0x5bd8('0x5c')]=function(_0x33ccb4,_0xf9f1a0,_0x3bbf7d){var _0x5e9b62={};var _0x29f0c2={};var _0x555a19;var _0x3adade;return db[_0x5bd8('0x3b')][_0x5bd8('0x5a')]({'where':{'id':_0x33ccb4['params']['id']}})[_0x5bd8('0x1f')](handleEntityNotFound(_0xf9f1a0,null))[_0x5bd8('0x1f')](function(_0x38976f){if(_0x38976f){_0x555a19=_0x38976f;_0x29f0c2[_0x5bd8('0x3e')]=_[_0x5bd8('0x40')](db[_0x5bd8('0x5b')]['rawAttributes']);_0x29f0c2[_0x5bd8('0x3f')]=_['keys'](_0x33ccb4['query']);_0x29f0c2[_0x5bd8('0x41')]=_[_0x5bd8('0x42')](_0x29f0c2[_0x5bd8('0x3e')],_0x29f0c2[_0x5bd8('0x3f')]);_0x5e9b62[_0x5bd8('0x43')]=_[_0x5bd8('0x42')](_0x29f0c2[_0x5bd8('0x3e')],qs[_0x5bd8('0x51')](_0x33ccb4[_0x5bd8('0x3f')][_0x5bd8('0x51')]));_0x5e9b62[_0x5bd8('0x43')]=_0x5e9b62[_0x5bd8('0x43')][_0x5bd8('0x52')]?_0x5e9b62[_0x5bd8('0x43')]:_0x29f0c2[_0x5bd8('0x3e')];_0x5e9b62['order']=qs['sort'](_0x33ccb4[_0x5bd8('0x3f')]['sort']);_0x5e9b62['where']=qs[_0x5bd8('0x41')](_['pick'](_0x33ccb4[_0x5bd8('0x3f')],_0x29f0c2[_0x5bd8('0x41')]));if(_0x33ccb4[_0x5bd8('0x3f')]['filter']){_0x5e9b62[_0x5bd8('0x49')]=_[_0x5bd8('0x4c')](_0x5e9b62[_0x5bd8('0x49')],{'$or':_[_0x5bd8('0x3a')](_0x5e9b62['attributes'],function(_0xff902){var _0x48351c={};_0x48351c[_0xff902]={'$like':'%'+_0x33ccb4[_0x5bd8('0x3f')][_0x5bd8('0x48')]+'%'};return _0x48351c;})});}_0x5e9b62=_[_0x5bd8('0x4c')]({},_0x5e9b62,_0x33ccb4[_0x5bd8('0x54')]);return _0x555a19[_0x5bd8('0x5c')](_0x5e9b62);}})[_0x5bd8('0x1f')](function(_0x1cea0b){if(_0x1cea0b){_0x3adade=_0x1cea0b[_0x5bd8('0x52')];if(!_0x33ccb4[_0x5bd8('0x3f')][_0x5bd8('0x5d')](_0x5bd8('0x44'))){_0x5e9b62['limit']=qs[_0x5bd8('0x2f')](_0x33ccb4[_0x5bd8('0x3f')]['limit']);_0x5e9b62['offset']=qs[_0x5bd8('0x2e')](_0x33ccb4[_0x5bd8('0x3f')][_0x5bd8('0x2e')]);}return _0x555a19[_0x5bd8('0x5c')](_0x5e9b62);}})[_0x5bd8('0x1f')](function(_0x12cb14){if(_0x12cb14){return _0x12cb14?{'count':_0x3adade,'rows':_0x12cb14}:null;}})[_0x5bd8('0x1f')](respondWithResult(_0xf9f1a0,null))[_0x5bd8('0x29')](handleError(_0xf9f1a0,null));};exports['getDescriptions']=function(_0x52cd1b,_0x55471b,_0x291854){var _0x36fb95={};var _0x3326e8={};var _0x147bbe;var _0x27de4e;return db[_0x5bd8('0x3b')]['findOne']({'where':{'id':_0x52cd1b[_0x5bd8('0x58')]['id']}})[_0x5bd8('0x1f')](handleEntityNotFound(_0x55471b,null))['then'](function(_0x16b9de){if(_0x16b9de){_0x147bbe=_0x16b9de;_0x3326e8[_0x5bd8('0x3e')]=_[_0x5bd8('0x40')](db[_0x5bd8('0x5b')][_0x5bd8('0x50')]);_0x3326e8[_0x5bd8('0x3f')]=_[_0x5bd8('0x40')](_0x52cd1b['query']);_0x3326e8['filters']=_[_0x5bd8('0x42')](_0x3326e8[_0x5bd8('0x3e')],_0x3326e8[_0x5bd8('0x3f')]);_0x36fb95['attributes']=_['intersection'](_0x3326e8[_0x5bd8('0x3e')],qs[_0x5bd8('0x51')](_0x52cd1b['query'][_0x5bd8('0x51')]));_0x36fb95[_0x5bd8('0x43')]=_0x36fb95[_0x5bd8('0x43')][_0x5bd8('0x52')]?_0x36fb95[_0x5bd8('0x43')]:_0x3326e8[_0x5bd8('0x3e')];_0x36fb95[_0x5bd8('0x45')]=qs[_0x5bd8('0x46')](_0x52cd1b['query'][_0x5bd8('0x46')]);_0x36fb95[_0x5bd8('0x49')]=qs[_0x5bd8('0x41')](_[_0x5bd8('0x47')](_0x52cd1b[_0x5bd8('0x3f')],_0x3326e8[_0x5bd8('0x41')]));if(_0x52cd1b[_0x5bd8('0x3f')][_0x5bd8('0x48')]){_0x36fb95['where']=_[_0x5bd8('0x4c')](_0x36fb95[_0x5bd8('0x49')],{'$or':_[_0x5bd8('0x3a')](_0x36fb95[_0x5bd8('0x43')],function(_0x5579f0){var _0x35fd31={};_0x35fd31[_0x5579f0]={'$like':'%'+_0x52cd1b[_0x5bd8('0x3f')][_0x5bd8('0x48')]+'%'};return _0x35fd31;})});}_0x36fb95=_[_0x5bd8('0x4c')]({},_0x36fb95,_0x52cd1b[_0x5bd8('0x54')]);return _0x147bbe['getDescriptions'](_0x36fb95);}})['then'](function(_0x35c98c){if(_0x35c98c){_0x27de4e=_0x35c98c[_0x5bd8('0x52')];if(!_0x52cd1b[_0x5bd8('0x3f')][_0x5bd8('0x5d')](_0x5bd8('0x44'))){_0x36fb95[_0x5bd8('0x2f')]=qs[_0x5bd8('0x2f')](_0x52cd1b[_0x5bd8('0x3f')][_0x5bd8('0x2f')]);_0x36fb95['offset']=qs[_0x5bd8('0x2e')](_0x52cd1b[_0x5bd8('0x3f')][_0x5bd8('0x2e')]);}return _0x147bbe[_0x5bd8('0x5e')](_0x36fb95);}})[_0x5bd8('0x1f')](function(_0x2c1f9a){if(_0x2c1f9a){return _0x2c1f9a?{'count':_0x27de4e,'rows':_0x2c1f9a}:null;}})[_0x5bd8('0x1f')](respondWithResult(_0x55471b,null))['catch'](handleError(_0x55471b,null));};exports['getTags']=function(_0x51b0dd,_0x36888e,_0x41e3e6){var _0xe0975={};var _0x4893dc={};var _0x4ab74b;var _0x182fe9;return db[_0x5bd8('0x3b')]['findOne']({'where':{'id':_0x51b0dd[_0x5bd8('0x58')]['id']}})['then'](handleEntityNotFound(_0x36888e,null))['then'](function(_0x2c98dc){if(_0x2c98dc){_0x4ab74b=_0x2c98dc;_0x4893dc['model']=_[_0x5bd8('0x40')](db[_0x5bd8('0x5f')]['rawAttributes']);_0x4893dc['query']=_[_0x5bd8('0x40')](_0x51b0dd[_0x5bd8('0x3f')]);_0x4893dc['filters']=_[_0x5bd8('0x42')](_0x4893dc[_0x5bd8('0x3e')],_0x4893dc[_0x5bd8('0x3f')]);_0xe0975[_0x5bd8('0x43')]=_[_0x5bd8('0x42')](_0x4893dc[_0x5bd8('0x3e')],qs[_0x5bd8('0x51')](_0x51b0dd[_0x5bd8('0x3f')]['fields']));_0xe0975[_0x5bd8('0x43')]=_0xe0975['attributes'][_0x5bd8('0x52')]?_0xe0975[_0x5bd8('0x43')]:_0x4893dc['model'];_0xe0975['order']=qs['sort'](_0x51b0dd['query'][_0x5bd8('0x46')]);_0xe0975[_0x5bd8('0x49')]=qs[_0x5bd8('0x41')](_[_0x5bd8('0x47')](_0x51b0dd[_0x5bd8('0x3f')],_0x4893dc['filters']));if(_0x51b0dd[_0x5bd8('0x3f')][_0x5bd8('0x48')]){_0xe0975[_0x5bd8('0x49')]=_[_0x5bd8('0x4c')](_0xe0975[_0x5bd8('0x49')],{'$or':_[_0x5bd8('0x3a')](_0xe0975[_0x5bd8('0x43')],function(_0xbbc43a){var _0x89cd41={};_0x89cd41[_0xbbc43a]={'$like':'%'+_0x51b0dd[_0x5bd8('0x3f')]['filter']+'%'};return _0x89cd41;})});}_0xe0975=_[_0x5bd8('0x4c')]({},_0xe0975,_0x51b0dd[_0x5bd8('0x54')]);return _0x4ab74b[_0x5bd8('0x60')](_0xe0975);}})[_0x5bd8('0x1f')](function(_0x240467){if(_0x240467){_0x182fe9=_0x240467['length'];if(!_0x51b0dd[_0x5bd8('0x3f')][_0x5bd8('0x5d')](_0x5bd8('0x44'))){_0xe0975[_0x5bd8('0x2f')]=qs['limit'](_0x51b0dd['query'][_0x5bd8('0x2f')]);_0xe0975[_0x5bd8('0x2e')]=qs[_0x5bd8('0x2e')](_0x51b0dd['query'][_0x5bd8('0x2e')]);}return _0x4ab74b[_0x5bd8('0x60')](_0xe0975);}})[_0x5bd8('0x1f')](function(_0x95cc03){if(_0x95cc03){return _0x95cc03?{'count':_0x182fe9,'rows':_0x95cc03}:null;}})[_0x5bd8('0x1f')](respondWithResult(_0x36888e,null))[_0x5bd8('0x29')](handleError(_0x36888e,null));};exports[_0x5bd8('0x61')]=function(_0x3898dc,_0x535adf,_0x1ee151){if(_0x3898dc[_0x5bd8('0x57')]['id']){delete _0x3898dc[_0x5bd8('0x57')]['id'];}return db[_0x5bd8('0x3b')][_0x5bd8('0x5a')]({'where':{'id':_0x3898dc['params']['id']}})[_0x5bd8('0x1f')](handleEntityNotFound(_0x535adf,null))[_0x5bd8('0x1f')](function(_0x1ccd76){if(_0x1ccd76){return _0x1ccd76[_0x5bd8('0x61')](_0x3898dc['body'][_0x5bd8('0x62')]||[]);}return null;})[_0x5bd8('0x1f')](respondWithResult(_0x535adf,null))[_0x5bd8('0x29')](handleError(_0x535adf,null));}; \ No newline at end of file +var _0xe903=['to-csv','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','count','limit','set','reject','save','update','destroy','sendStatus','stack','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','getFields','FreshdeskField','merge','filter','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0xe903,0x17d));var _0x3e90=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xe903[_0x2b5eae];return _0x5f3ac9;};'use strict';var pdf=require(_0x3e90('0x0'));var emlformat=require(_0x3e90('0x1'));var rimraf=require(_0x3e90('0x2'));var zipdir=require(_0x3e90('0x3'));var jsonpatch=require(_0x3e90('0x4'));var rp=require('request-promise');var moment=require(_0x3e90('0x5'));var BPromise=require(_0x3e90('0x6'));var Mustache=require(_0x3e90('0x7'));var util=require(_0x3e90('0x8'));var path=require(_0x3e90('0x9'));var sox=require(_0x3e90('0xa'));var csv=require(_0x3e90('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3e90('0xc'));var deskjs=require(_0x3e90('0xd'));var toCsv=require(_0x3e90('0xb'));var querystring=require(_0x3e90('0xe'));var Papa=require(_0x3e90('0xf'));var Redis=require(_0x3e90('0x10'));var authService=require(_0x3e90('0x11'));var qs=require(_0x3e90('0x12'));var as=require(_0x3e90('0x13'));var hardwareService=require(_0x3e90('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x3e90('0x15'));var config=require(_0x3e90('0x16'));var db=require(_0x3e90('0x17'))['db'];var jayson=require(_0x3e90('0x18'));var client=jayson[_0x3e90('0x19')][_0x3e90('0x1a')]({'port':0x232a});function checkPasswordPattern(_0xdc474f,_0x51a6c9,_0x346dcf){if(_0x346dcf){var _0x2a3f09=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a3f09[_0x3e90('0x1b')](_0x51a6c9)){return _0xdc474f;}else{throw new db[(_0x3e90('0x1c'))][(_0x3e90('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xdc474f;}}function respondWithRpcPromise(_0x5ab11b,_0x1a30d0,_0x42b394,_0x142e62){return new BPromise(function(_0xfab73b,_0x22556e){var _0x2705b2=_0x142e62||client;return _0x2705b2[_0x3e90('0x1e')](_0x5ab11b,_0x42b394)[_0x3e90('0x1f')](function(_0x2fb75e){logger[_0x3e90('0x20')](_0x3e90('0x21'),_0x1a30d0,'request\x20sent');logger[_0x3e90('0x22')](_0x3e90('0x23'),_0x1a30d0,_0x3e90('0x24'),JSON[_0x3e90('0x25')](_0x2fb75e));if(_0x2fb75e[_0x3e90('0x26')]){if(_0x2fb75e[_0x3e90('0x26')][_0x3e90('0x27')]===0x1f4){logger[_0x3e90('0x26')](_0x3e90('0x21'),_0x1a30d0,_0x2fb75e[_0x3e90('0x26')][_0x3e90('0x28')]);return _0x22556e(_0x2fb75e['error'][_0x3e90('0x28')]);}logger[_0x3e90('0x26')](_0x3e90('0x21'),_0x1a30d0,_0x2fb75e[_0x3e90('0x26')][_0x3e90('0x28')]);return _0xfab73b(_0x2fb75e['error'][_0x3e90('0x28')]);}else{logger[_0x3e90('0x20')](_0x3e90('0x21'),_0x1a30d0,'request\x20sent');_0xfab73b(_0x2fb75e['result'][_0x3e90('0x28')]);}})[_0x3e90('0x29')](function(_0x5436d7){logger[_0x3e90('0x26')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1a30d0,_0x5436d7);_0x22556e(_0x5436d7);});});}function respondWithStatusCode(_0x420eaf,_0x3efab1){_0x3efab1=_0x3efab1||0xcc;return function(_0x3819a4){if(_0x3819a4){return _0x420eaf['sendStatus'](_0x3efab1);}return _0x420eaf[_0x3e90('0x2a')](_0x3efab1)[_0x3e90('0x2b')]();};}function respondWithResult(_0x28b852,_0x21390c){_0x21390c=_0x21390c||0xc8;return function(_0x2ac52f){if(_0x2ac52f){return _0x28b852[_0x3e90('0x2a')](_0x21390c)['json'](_0x2ac52f);}};}function respondWithFilteredResult(_0x20b327,_0x503cf2){return function(_0x33c3d4){if(_0x33c3d4){var _0x278970=_0x33c3d4[_0x3e90('0x2c')],_0x4311f8=_0x503cf2['offset'],_0x18c57e=_0x503cf2['offset']+_0x503cf2[_0x3e90('0x2d')],_0x4cf016;if(_0x18c57e>=_0x278970){_0x18c57e=_0x278970;_0x4cf016=0xc8;}else{_0x4cf016=0xce;}_0x20b327[_0x3e90('0x2a')](_0x4cf016);return _0x20b327[_0x3e90('0x2e')]('Content-Range',_0x4311f8+'-'+_0x18c57e+'/'+_0x278970)['json'](_0x33c3d4);}return null;};}function patchUpdates(_0x352859){return function(_0x57ada0){try{jsonpatch['apply'](_0x57ada0,_0x352859,!![]);}catch(_0x40b09d){return BPromise[_0x3e90('0x2f')](_0x40b09d);}return _0x57ada0[_0x3e90('0x30')]();};}function saveUpdates(_0x513636,_0x281e48){return function(_0x479ca5){if(_0x479ca5){return _0x479ca5[_0x3e90('0x31')](_0x513636)['then'](function(_0x5e07f1){return _0x5e07f1;});}return null;};}function removeEntity(_0x5271b2,_0x25c2ab){return function(_0x28899a){if(_0x28899a){return _0x28899a[_0x3e90('0x32')]()[_0x3e90('0x1f')](function(){_0x5271b2['status'](0xcc)[_0x3e90('0x2b')]();});}};}function handleEntityNotFound(_0x28beef,_0x33bbb6){return function(_0x25f839){if(!_0x25f839){_0x28beef[_0x3e90('0x33')](0x194);}return _0x25f839;};}function handleError(_0x828ddb,_0x19dc47){_0x19dc47=_0x19dc47||0x1f4;return function(_0x1aa6fc){logger[_0x3e90('0x26')](_0x1aa6fc[_0x3e90('0x34')]);if(_0x1aa6fc[_0x3e90('0x35')]){delete _0x1aa6fc[_0x3e90('0x35')];}_0x828ddb[_0x3e90('0x2a')](_0x19dc47)[_0x3e90('0x36')](_0x1aa6fc);};}exports[_0x3e90('0x37')]=function(_0x260f46,_0x2eded4){var _0x1cc41f={},_0x315504={},_0x8d374={'count':0x0,'rows':[]};var _0x4b56ca=_['map'](db[_0x3e90('0x38')][_0x3e90('0x39')],function(_0x64b454){return{'name':_0x64b454[_0x3e90('0x3a')],'type':_0x64b454[_0x3e90('0x3b')][_0x3e90('0x3c')]};});_0x315504[_0x3e90('0x3d')]=_[_0x3e90('0x3e')](_0x4b56ca,_0x3e90('0x35'));_0x315504[_0x3e90('0x3f')]=_[_0x3e90('0x40')](_0x260f46[_0x3e90('0x3f')]);_0x315504[_0x3e90('0x41')]=_[_0x3e90('0x42')](_0x315504[_0x3e90('0x3d')],_0x315504[_0x3e90('0x3f')]);_0x1cc41f['attributes']=_[_0x3e90('0x42')](_0x315504['model'],qs[_0x3e90('0x43')](_0x260f46[_0x3e90('0x3f')][_0x3e90('0x43')]));_0x1cc41f[_0x3e90('0x44')]=_0x1cc41f[_0x3e90('0x44')][_0x3e90('0x45')]?_0x1cc41f[_0x3e90('0x44')]:_0x315504['model'];if(!_0x260f46[_0x3e90('0x3f')][_0x3e90('0x46')](_0x3e90('0x47'))){_0x1cc41f['limit']=qs['limit'](_0x260f46[_0x3e90('0x3f')][_0x3e90('0x2d')]);_0x1cc41f[_0x3e90('0x48')]=qs[_0x3e90('0x48')](_0x260f46[_0x3e90('0x3f')][_0x3e90('0x48')]);}_0x1cc41f[_0x3e90('0x49')]=qs[_0x3e90('0x4a')](_0x260f46[_0x3e90('0x3f')][_0x3e90('0x4a')]);_0x1cc41f[_0x3e90('0x4b')]=qs[_0x3e90('0x41')](_[_0x3e90('0x4c')](_0x260f46[_0x3e90('0x3f')],_0x315504['filters']));if(_0x260f46[_0x3e90('0x3f')]['filter']){_0x1cc41f[_0x3e90('0x4b')]=_['merge'](_0x1cc41f[_0x3e90('0x4b')],{'$or':_['map'](_0x4b56ca,function(_0x3f4c48){if(_0x3f4c48[_0x3e90('0x3b')]!==_0x3e90('0x4d')){var _0x4cf0c5={};_0x4cf0c5[_0x3f4c48[_0x3e90('0x35')]]={'$like':'%'+_0x260f46[_0x3e90('0x3f')]['filter']+'%'};return _0x4cf0c5;}})});}_0x1cc41f=_['merge']({},_0x1cc41f,_0x260f46[_0x3e90('0x4e')]);var _0x3c3833={'where':_0x1cc41f['where']};return db['FreshdeskConfiguration'][_0x3e90('0x2c')](_0x3c3833)[_0x3e90('0x1f')](function(_0x23a9e5){_0x8d374[_0x3e90('0x2c')]=_0x23a9e5;if(_0x260f46[_0x3e90('0x3f')][_0x3e90('0x4f')]){_0x1cc41f[_0x3e90('0x50')]=[{'all':!![]}];}return db[_0x3e90('0x38')][_0x3e90('0x51')](_0x1cc41f);})[_0x3e90('0x1f')](function(_0x4de004){_0x8d374['rows']=_0x4de004;return _0x8d374;})[_0x3e90('0x1f')](respondWithFilteredResult(_0x2eded4,_0x1cc41f))[_0x3e90('0x29')](handleError(_0x2eded4,null));};exports[_0x3e90('0x52')]=function(_0x13cdae,_0x1e58a2){var _0x4cbc98={'raw':![],'where':{'id':_0x13cdae[_0x3e90('0x53')]['id']}},_0x2a9a6f={};_0x2a9a6f[_0x3e90('0x3d')]=_[_0x3e90('0x40')](db['FreshdeskConfiguration']['rawAttributes']);_0x2a9a6f[_0x3e90('0x3f')]=_[_0x3e90('0x40')](_0x13cdae['query']);_0x2a9a6f[_0x3e90('0x41')]=_[_0x3e90('0x42')](_0x2a9a6f[_0x3e90('0x3d')],_0x2a9a6f[_0x3e90('0x3f')]);_0x4cbc98['attributes']=_[_0x3e90('0x42')](_0x2a9a6f[_0x3e90('0x3d')],qs[_0x3e90('0x43')](_0x13cdae[_0x3e90('0x3f')][_0x3e90('0x43')]));_0x4cbc98['attributes']=_0x4cbc98[_0x3e90('0x44')][_0x3e90('0x45')]?_0x4cbc98[_0x3e90('0x44')]:_0x2a9a6f[_0x3e90('0x3d')];if(_0x13cdae['query'][_0x3e90('0x4f')]){_0x4cbc98[_0x3e90('0x50')]=[{'all':!![]}];}_0x4cbc98=_['merge']({},_0x4cbc98,_0x13cdae[_0x3e90('0x4e')]);return db['FreshdeskConfiguration'][_0x3e90('0x54')](_0x4cbc98)['then'](handleEntityNotFound(_0x1e58a2,null))[_0x3e90('0x1f')](respondWithResult(_0x1e58a2,null))[_0x3e90('0x29')](handleError(_0x1e58a2,null));};exports[_0x3e90('0x55')]=function(_0x188c49,_0x15a606){return db[_0x3e90('0x38')][_0x3e90('0x55')](_0x188c49[_0x3e90('0x56')],{})[_0x3e90('0x1f')](respondWithResult(_0x15a606,0xc9))['catch'](handleError(_0x15a606,null));};exports['update']=function(_0x41ed29,_0x4ccd00){if(_0x41ed29[_0x3e90('0x56')]['id']){delete _0x41ed29[_0x3e90('0x56')]['id'];}return db[_0x3e90('0x38')][_0x3e90('0x54')]({'where':{'id':_0x41ed29[_0x3e90('0x53')]['id']}})[_0x3e90('0x1f')](handleEntityNotFound(_0x4ccd00,null))[_0x3e90('0x1f')](saveUpdates(_0x41ed29[_0x3e90('0x56')],null))[_0x3e90('0x1f')](respondWithResult(_0x4ccd00,null))[_0x3e90('0x29')](handleError(_0x4ccd00,null));};exports[_0x3e90('0x32')]=function(_0x504f1e,_0x166c5b){return db[_0x3e90('0x38')][_0x3e90('0x54')]({'where':{'id':_0x504f1e[_0x3e90('0x53')]['id']}})[_0x3e90('0x1f')](handleEntityNotFound(_0x166c5b,null))['then'](removeEntity(_0x166c5b,null))[_0x3e90('0x29')](handleError(_0x166c5b,null));};exports[_0x3e90('0x57')]=function(_0x1d2558,_0x5b1a50,_0x46dce5){var _0x25f75a={};var _0xcd2033={};var _0x3c705b;var _0x246f86;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x1d2558[_0x3e90('0x53')]['id']}})[_0x3e90('0x1f')](handleEntityNotFound(_0x5b1a50,null))[_0x3e90('0x1f')](function(_0x3ba362){if(_0x3ba362){_0x3c705b=_0x3ba362;_0xcd2033['model']=_['keys'](db[_0x3e90('0x58')]['rawAttributes']);_0xcd2033[_0x3e90('0x3f')]=_[_0x3e90('0x40')](_0x1d2558[_0x3e90('0x3f')]);_0xcd2033[_0x3e90('0x41')]=_[_0x3e90('0x42')](_0xcd2033['model'],_0xcd2033[_0x3e90('0x3f')]);_0x25f75a[_0x3e90('0x44')]=_[_0x3e90('0x42')](_0xcd2033['model'],qs[_0x3e90('0x43')](_0x1d2558['query'][_0x3e90('0x43')]));_0x25f75a[_0x3e90('0x44')]=_0x25f75a[_0x3e90('0x44')][_0x3e90('0x45')]?_0x25f75a['attributes']:_0xcd2033[_0x3e90('0x3d')];_0x25f75a[_0x3e90('0x49')]=qs[_0x3e90('0x4a')](_0x1d2558[_0x3e90('0x3f')][_0x3e90('0x4a')]);_0x25f75a[_0x3e90('0x4b')]=qs[_0x3e90('0x41')](_[_0x3e90('0x4c')](_0x1d2558['query'],_0xcd2033['filters']));if(_0x1d2558[_0x3e90('0x3f')]['filter']){_0x25f75a[_0x3e90('0x4b')]=_[_0x3e90('0x59')](_0x25f75a['where'],{'$or':_[_0x3e90('0x3e')](_0x25f75a[_0x3e90('0x44')],function(_0x2d04c4){var _0x52a4a9={};_0x52a4a9[_0x2d04c4]={'$like':'%'+_0x1d2558[_0x3e90('0x3f')][_0x3e90('0x5a')]+'%'};return _0x52a4a9;})});}_0x25f75a=_[_0x3e90('0x59')]({},_0x25f75a,_0x1d2558[_0x3e90('0x4e')]);return _0x3c705b[_0x3e90('0x57')](_0x25f75a);}})[_0x3e90('0x1f')](function(_0x66b4c9){if(_0x66b4c9){_0x246f86=_0x66b4c9[_0x3e90('0x45')];if(!_0x1d2558['query']['hasOwnProperty'](_0x3e90('0x47'))){_0x25f75a[_0x3e90('0x2d')]=qs[_0x3e90('0x2d')](_0x1d2558[_0x3e90('0x3f')][_0x3e90('0x2d')]);_0x25f75a[_0x3e90('0x48')]=qs[_0x3e90('0x48')](_0x1d2558[_0x3e90('0x3f')][_0x3e90('0x48')]);}return _0x3c705b['getFields'](_0x25f75a);}})['then'](function(_0x29788b){if(_0x29788b){return _0x29788b?{'count':_0x246f86,'rows':_0x29788b}:null;}})[_0x3e90('0x1f')](respondWithResult(_0x5b1a50,null))['catch'](handleError(_0x5b1a50,null));};exports[_0x3e90('0x5b')]=function(_0x4604de,_0x1ca343,_0x46e020){var _0x40ca46={};var _0x73e8cb={};var _0x8426a8;var _0x54db4a;return db[_0x3e90('0x38')][_0x3e90('0x5c')]({'where':{'id':_0x4604de['params']['id']}})[_0x3e90('0x1f')](handleEntityNotFound(_0x1ca343,null))[_0x3e90('0x1f')](function(_0xea18d4){if(_0xea18d4){_0x8426a8=_0xea18d4;_0x73e8cb[_0x3e90('0x3d')]=_[_0x3e90('0x40')](db[_0x3e90('0x58')][_0x3e90('0x39')]);_0x73e8cb[_0x3e90('0x3f')]=_[_0x3e90('0x40')](_0x4604de[_0x3e90('0x3f')]);_0x73e8cb[_0x3e90('0x41')]=_[_0x3e90('0x42')](_0x73e8cb[_0x3e90('0x3d')],_0x73e8cb['query']);_0x40ca46[_0x3e90('0x44')]=_[_0x3e90('0x42')](_0x73e8cb[_0x3e90('0x3d')],qs[_0x3e90('0x43')](_0x4604de[_0x3e90('0x3f')][_0x3e90('0x43')]));_0x40ca46[_0x3e90('0x44')]=_0x40ca46['attributes'][_0x3e90('0x45')]?_0x40ca46['attributes']:_0x73e8cb[_0x3e90('0x3d')];_0x40ca46[_0x3e90('0x49')]=qs[_0x3e90('0x4a')](_0x4604de['query'][_0x3e90('0x4a')]);_0x40ca46[_0x3e90('0x4b')]=qs['filters'](_[_0x3e90('0x4c')](_0x4604de[_0x3e90('0x3f')],_0x73e8cb[_0x3e90('0x41')]));if(_0x4604de[_0x3e90('0x3f')][_0x3e90('0x5a')]){_0x40ca46[_0x3e90('0x4b')]=_['merge'](_0x40ca46[_0x3e90('0x4b')],{'$or':_[_0x3e90('0x3e')](_0x40ca46['attributes'],function(_0x56730e){var _0x3ef1b5={};_0x3ef1b5[_0x56730e]={'$like':'%'+_0x4604de['query'][_0x3e90('0x5a')]+'%'};return _0x3ef1b5;})});}_0x40ca46=_[_0x3e90('0x59')]({},_0x40ca46,_0x4604de[_0x3e90('0x4e')]);return _0x8426a8[_0x3e90('0x5b')](_0x40ca46);}})[_0x3e90('0x1f')](function(_0x55593f){if(_0x55593f){_0x54db4a=_0x55593f[_0x3e90('0x45')];if(!_0x4604de[_0x3e90('0x3f')][_0x3e90('0x46')](_0x3e90('0x47'))){_0x40ca46[_0x3e90('0x2d')]=qs[_0x3e90('0x2d')](_0x4604de[_0x3e90('0x3f')][_0x3e90('0x2d')]);_0x40ca46[_0x3e90('0x48')]=qs[_0x3e90('0x48')](_0x4604de[_0x3e90('0x3f')]['offset']);}return _0x8426a8[_0x3e90('0x5b')](_0x40ca46);}})['then'](function(_0x196d08){if(_0x196d08){return _0x196d08?{'count':_0x54db4a,'rows':_0x196d08}:null;}})['then'](respondWithResult(_0x1ca343,null))[_0x3e90('0x29')](handleError(_0x1ca343,null));};exports['getDescriptions']=function(_0x3a64e3,_0x4e004d,_0x10f119){var _0x3b6e0f={};var _0x4f4d05={};var _0x23f29f;var _0x41dfa3;return db[_0x3e90('0x38')][_0x3e90('0x5c')]({'where':{'id':_0x3a64e3[_0x3e90('0x53')]['id']}})[_0x3e90('0x1f')](handleEntityNotFound(_0x4e004d,null))[_0x3e90('0x1f')](function(_0x533574){if(_0x533574){_0x23f29f=_0x533574;_0x4f4d05['model']=_[_0x3e90('0x40')](db[_0x3e90('0x58')][_0x3e90('0x39')]);_0x4f4d05[_0x3e90('0x3f')]=_['keys'](_0x3a64e3[_0x3e90('0x3f')]);_0x4f4d05[_0x3e90('0x41')]=_[_0x3e90('0x42')](_0x4f4d05[_0x3e90('0x3d')],_0x4f4d05[_0x3e90('0x3f')]);_0x3b6e0f[_0x3e90('0x44')]=_['intersection'](_0x4f4d05['model'],qs[_0x3e90('0x43')](_0x3a64e3[_0x3e90('0x3f')][_0x3e90('0x43')]));_0x3b6e0f[_0x3e90('0x44')]=_0x3b6e0f[_0x3e90('0x44')][_0x3e90('0x45')]?_0x3b6e0f[_0x3e90('0x44')]:_0x4f4d05[_0x3e90('0x3d')];_0x3b6e0f[_0x3e90('0x49')]=qs[_0x3e90('0x4a')](_0x3a64e3[_0x3e90('0x3f')][_0x3e90('0x4a')]);_0x3b6e0f[_0x3e90('0x4b')]=qs[_0x3e90('0x41')](_[_0x3e90('0x4c')](_0x3a64e3[_0x3e90('0x3f')],_0x4f4d05[_0x3e90('0x41')]));if(_0x3a64e3[_0x3e90('0x3f')][_0x3e90('0x5a')]){_0x3b6e0f[_0x3e90('0x4b')]=_[_0x3e90('0x59')](_0x3b6e0f[_0x3e90('0x4b')],{'$or':_[_0x3e90('0x3e')](_0x3b6e0f[_0x3e90('0x44')],function(_0x5ab1b3){var _0x197f46={};_0x197f46[_0x5ab1b3]={'$like':'%'+_0x3a64e3[_0x3e90('0x3f')][_0x3e90('0x5a')]+'%'};return _0x197f46;})});}_0x3b6e0f=_[_0x3e90('0x59')]({},_0x3b6e0f,_0x3a64e3[_0x3e90('0x4e')]);return _0x23f29f[_0x3e90('0x5d')](_0x3b6e0f);}})[_0x3e90('0x1f')](function(_0x3375c7){if(_0x3375c7){_0x41dfa3=_0x3375c7[_0x3e90('0x45')];if(!_0x3a64e3[_0x3e90('0x3f')][_0x3e90('0x46')](_0x3e90('0x47'))){_0x3b6e0f[_0x3e90('0x2d')]=qs[_0x3e90('0x2d')](_0x3a64e3['query']['limit']);_0x3b6e0f[_0x3e90('0x48')]=qs[_0x3e90('0x48')](_0x3a64e3['query'][_0x3e90('0x48')]);}return _0x23f29f[_0x3e90('0x5d')](_0x3b6e0f);}})[_0x3e90('0x1f')](function(_0x314afd){if(_0x314afd){return _0x314afd?{'count':_0x41dfa3,'rows':_0x314afd}:null;}})[_0x3e90('0x1f')](respondWithResult(_0x4e004d,null))[_0x3e90('0x29')](handleError(_0x4e004d,null));};exports[_0x3e90('0x5e')]=function(_0x5e2454,_0x47b501,_0x1a59fe){var _0x2a812b={};var _0x11aa04={};var _0x424ea6;var _0x23e0a5;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x5e2454[_0x3e90('0x53')]['id']}})[_0x3e90('0x1f')](handleEntityNotFound(_0x47b501,null))[_0x3e90('0x1f')](function(_0x4737c1){if(_0x4737c1){_0x424ea6=_0x4737c1;_0x11aa04[_0x3e90('0x3d')]=_[_0x3e90('0x40')](db[_0x3e90('0x5f')][_0x3e90('0x39')]);_0x11aa04[_0x3e90('0x3f')]=_[_0x3e90('0x40')](_0x5e2454[_0x3e90('0x3f')]);_0x11aa04['filters']=_[_0x3e90('0x42')](_0x11aa04[_0x3e90('0x3d')],_0x11aa04['query']);_0x2a812b[_0x3e90('0x44')]=_['intersection'](_0x11aa04[_0x3e90('0x3d')],qs[_0x3e90('0x43')](_0x5e2454['query'][_0x3e90('0x43')]));_0x2a812b['attributes']=_0x2a812b[_0x3e90('0x44')][_0x3e90('0x45')]?_0x2a812b[_0x3e90('0x44')]:_0x11aa04[_0x3e90('0x3d')];_0x2a812b[_0x3e90('0x49')]=qs[_0x3e90('0x4a')](_0x5e2454[_0x3e90('0x3f')]['sort']);_0x2a812b[_0x3e90('0x4b')]=qs['filters'](_[_0x3e90('0x4c')](_0x5e2454[_0x3e90('0x3f')],_0x11aa04['filters']));if(_0x5e2454[_0x3e90('0x3f')][_0x3e90('0x5a')]){_0x2a812b[_0x3e90('0x4b')]=_[_0x3e90('0x59')](_0x2a812b[_0x3e90('0x4b')],{'$or':_[_0x3e90('0x3e')](_0x2a812b[_0x3e90('0x44')],function(_0x523538){var _0x2caab0={};_0x2caab0[_0x523538]={'$like':'%'+_0x5e2454['query']['filter']+'%'};return _0x2caab0;})});}_0x2a812b=_[_0x3e90('0x59')]({},_0x2a812b,_0x5e2454[_0x3e90('0x4e')]);return _0x424ea6[_0x3e90('0x5e')](_0x2a812b);}})[_0x3e90('0x1f')](function(_0x3dabab){if(_0x3dabab){_0x23e0a5=_0x3dabab[_0x3e90('0x45')];if(!_0x5e2454[_0x3e90('0x3f')][_0x3e90('0x46')](_0x3e90('0x47'))){_0x2a812b[_0x3e90('0x2d')]=qs[_0x3e90('0x2d')](_0x5e2454[_0x3e90('0x3f')][_0x3e90('0x2d')]);_0x2a812b['offset']=qs['offset'](_0x5e2454['query'][_0x3e90('0x48')]);}return _0x424ea6['getTags'](_0x2a812b);}})[_0x3e90('0x1f')](function(_0x3e1a48){if(_0x3e1a48){return _0x3e1a48?{'count':_0x23e0a5,'rows':_0x3e1a48}:null;}})[_0x3e90('0x1f')](respondWithResult(_0x47b501,null))[_0x3e90('0x29')](handleError(_0x47b501,null));};exports[_0x3e90('0x60')]=function(_0x47be13,_0x15c724,_0x1daf29){if(_0x47be13[_0x3e90('0x56')]['id']){delete _0x47be13[_0x3e90('0x56')]['id'];}return db[_0x3e90('0x38')]['findOne']({'where':{'id':_0x47be13[_0x3e90('0x53')]['id']}})['then'](handleEntityNotFound(_0x15c724,null))[_0x3e90('0x1f')](function(_0x3d7a26){if(_0x3d7a26){return _0x3d7a26[_0x3e90('0x60')](_0x47be13[_0x3e90('0x56')][_0x3e90('0x61')]||[]);}return null;})[_0x3e90('0x1f')](respondWithResult(_0x15c724,null))['catch'](handleError(_0x15c724,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index f174f9a..b107e46 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 _0xee3f=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4aa4a5,_0x1978e7){var _0x163677=function(_0x360565){while(--_0x360565){_0x4aa4a5['push'](_0x4aa4a5['shift']());}};_0x163677(++_0x1978e7);}(_0xee3f,0x118));var _0xfee3=function(_0x48cac5,_0x30ea0d){_0x48cac5=_0x48cac5-0x0;var _0x1120e0=_0xee3f[_0x48cac5];return _0x1120e0;};'use strict';var _=require('lodash');var util=require(_0xfee3('0x0'));var logger=require('../../config/logger')(_0xfee3('0x1'));var moment=require(_0xfee3('0x2'));var BPromise=require(_0xfee3('0x3'));var rp=require(_0xfee3('0x4'));var fs=require('fs');var path=require(_0xfee3('0x5'));var rimraf=require(_0xfee3('0x6'));var config=require(_0xfee3('0x7'));var attributes=require(_0xfee3('0x8'));module[_0xfee3('0x9')]=function(_0xad1239,_0x33a0b6){return _0xad1239[_0xfee3('0xa')](_0xfee3('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa25e=['moment','bluebird','request-promise','path','../../config/environment','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api'];(function(_0x538bd3,_0x1e3c75){var _0x5e2fd7=function(_0x2d41b0){while(--_0x2d41b0){_0x538bd3['push'](_0x538bd3['shift']());}};_0x5e2fd7(++_0x1e3c75);}(_0xa25e,0x97));var _0xea25=function(_0x3b045c,_0x15e404){_0x3b045c=_0x3b045c-0x0;var _0x43b235=_0xa25e[_0x3b045c];return _0x43b235;};'use strict';var _=require(_0xea25('0x0'));var util=require(_0xea25('0x1'));var logger=require('../../config/logger')(_0xea25('0x2'));var moment=require(_0xea25('0x3'));var BPromise=require(_0xea25('0x4'));var rp=require(_0xea25('0x5'));var fs=require('fs');var path=require(_0xea25('0x6'));var rimraf=require('rimraf');var config=require(_0xea25('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xea25('0x8')]=function(_0x55293c,_0x5dd121){return _0x55293c['define'](_0xea25('0x9'),attributes,{'tableName':_0xea25('0xa'),'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 2fdef71..2817b09 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 _0xd21f=['randomstring','../../config/logger','rpc','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird'];(function(_0x205394,_0xb86c74){var _0xb533c7=function(_0x1209c3){while(--_0x1209c3){_0x205394['push'](_0x205394['shift']());}};_0xb533c7(++_0xb86c74);}(_0xd21f,0xde));var _0xfd21=function(_0x38080e,_0x95512d){_0x38080e=_0x38080e-0x0;var _0x4e4c87=_0xd21f[_0x38080e];return _0x4e4c87;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfd21('0x0'));var BPromise=require(_0xfd21('0x1'));var rs=require(_0xfd21('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfd21('0x3'))(_0xfd21('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfd21('0x5')][_0xfd21('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x370c6b,_0x30d2e3,_0x3f5a95){return new BPromise(function(_0x469aaf,_0x44ab48){return client['request'](_0x370c6b,_0x3f5a95)[_0xfd21('0x7')](function(_0x37d8be){logger[_0xfd21('0x8')](_0xfd21('0x9'),_0x30d2e3,_0xfd21('0xa'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x30d2e3,_0xfd21('0xa'),JSON[_0xfd21('0xb')](_0x37d8be));if(_0x37d8be[_0xfd21('0xc')]){if(_0x37d8be[_0xfd21('0xc')][_0xfd21('0xd')]===0x1f4){logger[_0xfd21('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x30d2e3,_0x37d8be[_0xfd21('0xc')][_0xfd21('0xe')]);return _0x44ab48(_0x37d8be['error'][_0xfd21('0xe')]);}logger[_0xfd21('0xc')](_0xfd21('0x9'),_0x30d2e3,_0x37d8be[_0xfd21('0xc')][_0xfd21('0xe')]);return _0x469aaf(_0x37d8be['error'][_0xfd21('0xe')]);}else{logger[_0xfd21('0x8')](_0xfd21('0x9'),_0x30d2e3,_0xfd21('0xa'));_0x469aaf(_0x37d8be[_0xfd21('0xf')]['message']);}})['catch'](function(_0x168d41){logger[_0xfd21('0xc')](_0xfd21('0x9'),_0x30d2e3,_0x168d41);_0x44ab48(_0x168d41);});});} \ No newline at end of file +var _0x97e7=['FreshdeskConfiguration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x1a8952,_0xf6e979){var _0x76f154=function(_0x632303){while(--_0x632303){_0x1a8952['push'](_0x1a8952['shift']());}};_0x76f154(++_0xf6e979);}(_0x97e7,0x9c));var _0x797e=function(_0x59520e,_0x520fb9){_0x59520e=_0x59520e-0x0;var _0x358563=_0x97e7[_0x59520e];return _0x358563;};'use strict';var _=require(_0x797e('0x0'));var util=require(_0x797e('0x1'));var moment=require(_0x797e('0x2'));var BPromise=require(_0x797e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x797e('0x4'));var db=require(_0x797e('0x5'))['db'];var utils=require(_0x797e('0x6'));var logger=require(_0x797e('0x7'))(_0x797e('0x8'));var config=require(_0x797e('0x9'));var jayson=require(_0x797e('0xa'));var client=jayson[_0x797e('0xb')][_0x797e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x28220e,_0x4c4345,_0x263c7b){return new BPromise(function(_0x74cfb1,_0x31eff4){return client[_0x797e('0xd')](_0x28220e,_0x263c7b)[_0x797e('0xe')](function(_0x3b5b00){logger[_0x797e('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4c4345,'request\x20sent');logger[_0x797e('0x10')](_0x797e('0x11'),_0x4c4345,_0x797e('0x12'),JSON['stringify'](_0x3b5b00));if(_0x3b5b00[_0x797e('0x13')]){if(_0x3b5b00['error']['code']===0x1f4){logger[_0x797e('0x13')](_0x797e('0x14'),_0x4c4345,_0x3b5b00[_0x797e('0x13')][_0x797e('0x15')]);return _0x31eff4(_0x3b5b00[_0x797e('0x13')]['message']);}logger[_0x797e('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4c4345,_0x3b5b00[_0x797e('0x13')][_0x797e('0x15')]);return _0x74cfb1(_0x3b5b00[_0x797e('0x13')][_0x797e('0x15')]);}else{logger[_0x797e('0xf')](_0x797e('0x14'),_0x4c4345,'request\x20sent');_0x74cfb1(_0x3b5b00['result'][_0x797e('0x15')]);}})['catch'](function(_0x52be13){logger['error'](_0x797e('0x14'),_0x4c4345,_0x52be13);_0x31eff4(_0x52be13);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index fde57e7..a439e50 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 _0x70e0=['create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','post','isAuthenticated'];(function(_0x550151,_0x49d953){var _0x1ba3cb=function(_0x530de2){while(--_0x530de2){_0x550151['push'](_0x550151['shift']());}};_0x1ba3cb(++_0x49d953);}(_0x70e0,0x17b));var _0x070e=function(_0x370040,_0x4aba7e){_0x370040=_0x370040-0x0;var _0x48a419=_0x70e0[_0x370040];return _0x48a419;};'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 +var _0xedd9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0xedd9,0xfc));var _0x9edd=function(_0x1bd937,_0x367f92){_0x1bd937=_0x1bd937-0x0;var _0x21e16a=_0xedd9[_0x1bd937];return _0x21e16a;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0xb')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router[_0x9edd('0xd')]('/:id',auth[_0x9edd('0x9')](),controller['update']);router[_0x9edd('0xe')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);module[_0x9edd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index dcb716b..5e9ac31 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 _0xcdb1=['keyValue','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xcdb1,0x1eb));var _0x1cdb=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xcdb1[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require('sequelize');module[_0x1cdb('0x0')]={'type':{'type':Sequelize[_0x1cdb('0x1')](_0x1cdb('0x2'),_0x1cdb('0x3'),_0x1cdb('0x4'),_0x1cdb('0x5')),'defaultValue':_0x1cdb('0x2')},'content':{'type':Sequelize[_0x1cdb('0x6')]},'key':{'type':Sequelize[_0x1cdb('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x1cdb('0x2'),_0x1cdb('0x3'),_0x1cdb('0x4'))},'keyContent':{'type':Sequelize[_0x1cdb('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1cdb('0x6')]},'customField':{'type':Sequelize[_0x1cdb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1cdb('0x6')]}}; \ No newline at end of file +var _0x0851=['STRING','variable','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0x0851,0x8a));var _0x1085=function(_0x30ce9b,_0x2225c6){_0x30ce9b=_0x30ce9b-0x0;var _0x2dbab0=_0x0851[_0x30ce9b];return _0x2dbab0;};'use strict';var Sequelize=require(_0x1085('0x0'));module[_0x1085('0x1')]={'type':{'type':Sequelize[_0x1085('0x2')](_0x1085('0x3'),'variable',_0x1085('0x4'),_0x1085('0x5')),'defaultValue':_0x1085('0x3')},'content':{'type':Sequelize[_0x1085('0x6')]},'key':{'type':Sequelize[_0x1085('0x6')]},'keyType':{'type':Sequelize[_0x1085('0x2')](_0x1085('0x3'),_0x1085('0x7'),_0x1085('0x4'))},'keyContent':{'type':Sequelize[_0x1085('0x6')]},'idField':{'type':Sequelize[_0x1085('0x6')]},'nameField':{'type':Sequelize[_0x1085('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 9e28957..2058910 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 _0x98ea=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','reject','save','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','FreshdeskField','include','findAll','catch','show','params','find','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x5d7c4e,_0x2dfc65){var _0xc87e9e=function(_0x30395e){while(--_0x30395e){_0x5d7c4e['push'](_0x5d7c4e['shift']());}};_0xc87e9e(++_0x2dfc65);}(_0x98ea,0xcc));var _0xa98e=function(_0x571d09,_0x47c516){_0x571d09=_0x571d09-0x0;var _0x352552=_0x98ea[_0x571d09];return _0x352552;};'use strict';var pdf=require(_0xa98e('0x0'));var emlformat=require(_0xa98e('0x1'));var rimraf=require(_0xa98e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa98e('0x3'));var rp=require(_0xa98e('0x4'));var moment=require(_0xa98e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa98e('0x6'));var util=require(_0xa98e('0x7'));var path=require(_0xa98e('0x8'));var sox=require(_0xa98e('0x9'));var csv=require(_0xa98e('0xa'));var ejs=require(_0xa98e('0xb'));var fs=require('fs');var _=require(_0xa98e('0xc'));var squel=require(_0xa98e('0xd'));var crypto=require(_0xa98e('0xe'));var jsforce=require(_0xa98e('0xf'));var deskjs=require(_0xa98e('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa98e('0x11'));var Papa=require(_0xa98e('0x12'));var Redis=require(_0xa98e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa98e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa98e('0x15'));var logger=require('../../config/logger')(_0xa98e('0x16'));var utils=require(_0xa98e('0x17'));var config=require('../../config/environment');var db=require(_0xa98e('0x18'))['db'];function respondWithStatusCode(_0x201a49,_0x2c1f75){_0x2c1f75=_0x2c1f75||0xcc;return function(_0x459664){if(_0x459664){return _0x201a49[_0xa98e('0x19')](_0x2c1f75);}return _0x201a49[_0xa98e('0x1a')](_0x2c1f75)['end']();};}function respondWithResult(_0x238cf9,_0x1f22fa){_0x1f22fa=_0x1f22fa||0xc8;return function(_0x47a1b8){if(_0x47a1b8){return _0x238cf9[_0xa98e('0x1a')](_0x1f22fa)['json'](_0x47a1b8);}};}function respondWithFilteredResult(_0x264b6c,_0x411c63){return function(_0x29bbd9){if(_0x29bbd9){var _0x5d18db=_0x29bbd9[_0xa98e('0x1b')],_0x121050=_0x411c63[_0xa98e('0x1c')],_0x175c61=_0x411c63[_0xa98e('0x1c')]+_0x411c63[_0xa98e('0x1d')],_0xdd29ac;if(_0x175c61>=_0x5d18db){_0x175c61=_0x5d18db;_0xdd29ac=0xc8;}else{_0xdd29ac=0xce;}_0x264b6c[_0xa98e('0x1a')](_0xdd29ac);return _0x264b6c[_0xa98e('0x1e')](_0xa98e('0x1f'),_0x121050+'-'+_0x175c61+'/'+_0x5d18db)['json'](_0x29bbd9);}return null;};}function patchUpdates(_0x46a7f7){return function(_0x48a2b1){try{jsonpatch['apply'](_0x48a2b1,_0x46a7f7,!![]);}catch(_0x3b0f0f){return BPromise[_0xa98e('0x20')](_0x3b0f0f);}return _0x48a2b1[_0xa98e('0x21')]();};}function saveUpdates(_0x5095ae,_0x3451c2){return function(_0xbcf3e0){if(_0xbcf3e0){return _0xbcf3e0['update'](_0x5095ae)['then'](function(_0x191713){return _0x191713;});}return null;};}function removeEntity(_0x4e8fee,_0x196377){return function(_0x8ff537){if(_0x8ff537){return _0x8ff537[_0xa98e('0x22')]()[_0xa98e('0x23')](function(){_0x4e8fee[_0xa98e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2319b0,_0x11daa7){return function(_0xb1e236){if(!_0xb1e236){_0x2319b0['sendStatus'](0x194);}return _0xb1e236;};}function handleError(_0x423468,_0x3cb95a){_0x3cb95a=_0x3cb95a||0x1f4;return function(_0x4cba86){logger[_0xa98e('0x24')](_0x4cba86[_0xa98e('0x25')]);if(_0x4cba86[_0xa98e('0x26')]){delete _0x4cba86['name'];}_0x423468[_0xa98e('0x1a')](_0x3cb95a)[_0xa98e('0x27')](_0x4cba86);};}exports[_0xa98e('0x28')]=function(_0x4bfc1c,_0x4a6d5a){var _0x4ca016={},_0x3f3dcc={},_0x3e0843={'count':0x0,'rows':[]};var _0x5e871e=_[_0xa98e('0x29')](db['FreshdeskField'][_0xa98e('0x2a')],function(_0xcc4863){return{'name':_0xcc4863[_0xa98e('0x2b')],'type':_0xcc4863[_0xa98e('0x2c')][_0xa98e('0x2d')]};});_0x3f3dcc[_0xa98e('0x2e')]=_[_0xa98e('0x29')](_0x5e871e,_0xa98e('0x26'));_0x3f3dcc['query']=_[_0xa98e('0x2f')](_0x4bfc1c[_0xa98e('0x30')]);_0x3f3dcc[_0xa98e('0x31')]=_[_0xa98e('0x32')](_0x3f3dcc['model'],_0x3f3dcc[_0xa98e('0x30')]);_0x4ca016[_0xa98e('0x33')]=_[_0xa98e('0x32')](_0x3f3dcc[_0xa98e('0x2e')],qs[_0xa98e('0x34')](_0x4bfc1c[_0xa98e('0x30')][_0xa98e('0x34')]));_0x4ca016['attributes']=_0x4ca016[_0xa98e('0x33')][_0xa98e('0x35')]?_0x4ca016[_0xa98e('0x33')]:_0x3f3dcc[_0xa98e('0x2e')];if(!_0x4bfc1c['query'][_0xa98e('0x36')](_0xa98e('0x37'))){_0x4ca016['limit']=qs[_0xa98e('0x1d')](_0x4bfc1c[_0xa98e('0x30')][_0xa98e('0x1d')]);_0x4ca016[_0xa98e('0x1c')]=qs['offset'](_0x4bfc1c['query'][_0xa98e('0x1c')]);}_0x4ca016[_0xa98e('0x38')]=qs[_0xa98e('0x39')](_0x4bfc1c['query'][_0xa98e('0x39')]);_0x4ca016['where']=qs[_0xa98e('0x31')](_[_0xa98e('0x3a')](_0x4bfc1c['query'],_0x3f3dcc[_0xa98e('0x31')]));if(_0x4bfc1c[_0xa98e('0x30')][_0xa98e('0x3b')]){_0x4ca016[_0xa98e('0x3c')]=_['merge'](_0x4ca016[_0xa98e('0x3c')],{'$or':_[_0xa98e('0x29')](_0x5e871e,function(_0xf4259d){if(_0xf4259d[_0xa98e('0x2c')]!==_0xa98e('0x3d')){var _0x5011bd={};_0x5011bd[_0xf4259d[_0xa98e('0x26')]]={'$like':'%'+_0x4bfc1c[_0xa98e('0x30')]['filter']+'%'};return _0x5011bd;}})});}_0x4ca016=_[_0xa98e('0x3e')]({},_0x4ca016,_0x4bfc1c[_0xa98e('0x3f')]);var _0x3d8ca5={'where':_0x4ca016[_0xa98e('0x3c')]};return db[_0xa98e('0x40')]['count'](_0x3d8ca5)[_0xa98e('0x23')](function(_0x46eb3e){_0x3e0843[_0xa98e('0x1b')]=_0x46eb3e;if(_0x4bfc1c[_0xa98e('0x30')]['includeAll']){_0x4ca016[_0xa98e('0x41')]=[{'all':!![]}];}return db['FreshdeskField'][_0xa98e('0x42')](_0x4ca016);})['then'](function(_0x2c1c44){_0x3e0843['rows']=_0x2c1c44;return _0x3e0843;})['then'](respondWithFilteredResult(_0x4a6d5a,_0x4ca016))[_0xa98e('0x43')](handleError(_0x4a6d5a,null));};exports[_0xa98e('0x44')]=function(_0x1f214d,_0x405a19){var _0x38cc1d={'raw':!![],'where':{'id':_0x1f214d[_0xa98e('0x45')]['id']}},_0x8a6c88={};_0x8a6c88['model']=_['keys'](db[_0xa98e('0x40')][_0xa98e('0x2a')]);_0x8a6c88['query']=_[_0xa98e('0x2f')](_0x1f214d[_0xa98e('0x30')]);_0x8a6c88[_0xa98e('0x31')]=_[_0xa98e('0x32')](_0x8a6c88[_0xa98e('0x2e')],_0x8a6c88['query']);_0x38cc1d[_0xa98e('0x33')]=_[_0xa98e('0x32')](_0x8a6c88[_0xa98e('0x2e')],qs['fields'](_0x1f214d[_0xa98e('0x30')]['fields']));_0x38cc1d[_0xa98e('0x33')]=_0x38cc1d['attributes'][_0xa98e('0x35')]?_0x38cc1d[_0xa98e('0x33')]:_0x8a6c88[_0xa98e('0x2e')];if(_0x1f214d[_0xa98e('0x30')]['includeAll']){_0x38cc1d[_0xa98e('0x41')]=[{'all':!![]}];}_0x38cc1d=_[_0xa98e('0x3e')]({},_0x38cc1d,_0x1f214d[_0xa98e('0x3f')]);return db[_0xa98e('0x40')][_0xa98e('0x46')](_0x38cc1d)['then'](handleEntityNotFound(_0x405a19,null))[_0xa98e('0x23')](respondWithResult(_0x405a19,null))['catch'](handleError(_0x405a19,null));};exports[_0xa98e('0x47')]=function(_0x4a1a62,_0x5dd57b){return db[_0xa98e('0x40')][_0xa98e('0x47')](_0x4a1a62[_0xa98e('0x48')],{})[_0xa98e('0x23')](respondWithResult(_0x5dd57b,0xc9))[_0xa98e('0x43')](handleError(_0x5dd57b,null));};exports[_0xa98e('0x49')]=function(_0x47d35a,_0x2009f3){if(_0x47d35a['body']['id']){delete _0x47d35a[_0xa98e('0x48')]['id'];}return db[_0xa98e('0x40')][_0xa98e('0x46')]({'where':{'id':_0x47d35a[_0xa98e('0x45')]['id']}})[_0xa98e('0x23')](handleEntityNotFound(_0x2009f3,null))[_0xa98e('0x23')](saveUpdates(_0x47d35a[_0xa98e('0x48')],null))[_0xa98e('0x23')](respondWithResult(_0x2009f3,null))[_0xa98e('0x43')](handleError(_0x2009f3,null));};exports[_0xa98e('0x22')]=function(_0xb4e5e9,_0x1dd7c5){return db[_0xa98e('0x40')][_0xa98e('0x46')]({'where':{'id':_0xb4e5e9[_0xa98e('0x45')]['id']}})[_0xa98e('0x23')](handleEntityNotFound(_0x1dd7c5,null))[_0xa98e('0x23')](removeEntity(_0x1dd7c5,null))[_0xa98e('0x43')](handleError(_0x1dd7c5,null));}; \ No newline at end of file +var _0x0fd2=['Content-Range','apply','reject','save','then','destroy','error','stack','name','index','FreshdeskField','rawAttributes','fieldName','type','key','map','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','set'];(function(_0x225074,_0x1abb16){var _0x3fb50c=function(_0xf22c61){while(--_0xf22c61){_0x225074['push'](_0x225074['shift']());}};_0x3fb50c(++_0x1abb16);}(_0x0fd2,0x1e8));var _0x20fd=function(_0x88782c,_0x14a535){_0x88782c=_0x88782c-0x0;var _0x41fea9=_0x0fd2[_0x88782c];return _0x41fea9;};'use strict';var pdf=require(_0x20fd('0x0'));var emlformat=require(_0x20fd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x20fd('0x2'));var jsonpatch=require(_0x20fd('0x3'));var rp=require(_0x20fd('0x4'));var moment=require(_0x20fd('0x5'));var BPromise=require(_0x20fd('0x6'));var Mustache=require(_0x20fd('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x20fd('0x8'));var ejs=require(_0x20fd('0x9'));var fs=require('fs');var _=require(_0x20fd('0xa'));var squel=require(_0x20fd('0xb'));var crypto=require('crypto');var jsforce=require(_0x20fd('0xc'));var deskjs=require(_0x20fd('0xd'));var toCsv=require('to-csv');var querystring=require(_0x20fd('0xe'));var Papa=require(_0x20fd('0xf'));var Redis=require(_0x20fd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x20fd('0x11'));var as=require(_0x20fd('0x12'));var hardwareService=require(_0x20fd('0x13'));var logger=require(_0x20fd('0x14'))(_0x20fd('0x15'));var utils=require('../../config/utils');var config=require(_0x20fd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x148858,_0x5bfb3b){_0x5bfb3b=_0x5bfb3b||0xcc;return function(_0x4d53ca){if(_0x4d53ca){return _0x148858[_0x20fd('0x17')](_0x5bfb3b);}return _0x148858[_0x20fd('0x18')](_0x5bfb3b)[_0x20fd('0x19')]();};}function respondWithResult(_0xb6823a,_0x5e526e){_0x5e526e=_0x5e526e||0xc8;return function(_0x18a186){if(_0x18a186){return _0xb6823a[_0x20fd('0x18')](_0x5e526e)[_0x20fd('0x1a')](_0x18a186);}};}function respondWithFilteredResult(_0x54841c,_0xf500bb){return function(_0x2fecc2){if(_0x2fecc2){var _0x6a2c3e=_0x2fecc2[_0x20fd('0x1b')],_0x41d53a=_0xf500bb[_0x20fd('0x1c')],_0x3eea29=_0xf500bb['offset']+_0xf500bb['limit'],_0x3b7f26;if(_0x3eea29>=_0x6a2c3e){_0x3eea29=_0x6a2c3e;_0x3b7f26=0xc8;}else{_0x3b7f26=0xce;}_0x54841c['status'](_0x3b7f26);return _0x54841c[_0x20fd('0x1d')](_0x20fd('0x1e'),_0x41d53a+'-'+_0x3eea29+'/'+_0x6a2c3e)[_0x20fd('0x1a')](_0x2fecc2);}return null;};}function patchUpdates(_0x3407ce){return function(_0x2430bf){try{jsonpatch[_0x20fd('0x1f')](_0x2430bf,_0x3407ce,!![]);}catch(_0x32c1e1){return BPromise[_0x20fd('0x20')](_0x32c1e1);}return _0x2430bf[_0x20fd('0x21')]();};}function saveUpdates(_0x145c17,_0x1dc301){return function(_0x345f2e){if(_0x345f2e){return _0x345f2e['update'](_0x145c17)[_0x20fd('0x22')](function(_0xbb950a){return _0xbb950a;});}return null;};}function removeEntity(_0x5b4a4f,_0xcd83df){return function(_0x2ef1a5){if(_0x2ef1a5){return _0x2ef1a5[_0x20fd('0x23')]()['then'](function(){_0x5b4a4f[_0x20fd('0x18')](0xcc)[_0x20fd('0x19')]();});}};}function handleEntityNotFound(_0x4df196,_0x4a7c9e){return function(_0x5a2696){if(!_0x5a2696){_0x4df196[_0x20fd('0x17')](0x194);}return _0x5a2696;};}function handleError(_0x121f09,_0x1da6ea){_0x1da6ea=_0x1da6ea||0x1f4;return function(_0x4eb1d3){logger[_0x20fd('0x24')](_0x4eb1d3[_0x20fd('0x25')]);if(_0x4eb1d3['name']){delete _0x4eb1d3[_0x20fd('0x26')];}_0x121f09[_0x20fd('0x18')](_0x1da6ea)['send'](_0x4eb1d3);};}exports[_0x20fd('0x27')]=function(_0x398116,_0x308f09){var _0x5338fe={},_0x56b3cc={},_0xa166c4={'count':0x0,'rows':[]};var _0x26ea73=_['map'](db[_0x20fd('0x28')][_0x20fd('0x29')],function(_0xb80148){return{'name':_0xb80148[_0x20fd('0x2a')],'type':_0xb80148[_0x20fd('0x2b')][_0x20fd('0x2c')]};});_0x56b3cc['model']=_[_0x20fd('0x2d')](_0x26ea73,_0x20fd('0x26'));_0x56b3cc['query']=_[_0x20fd('0x2e')](_0x398116[_0x20fd('0x2f')]);_0x56b3cc['filters']=_[_0x20fd('0x30')](_0x56b3cc[_0x20fd('0x31')],_0x56b3cc[_0x20fd('0x2f')]);_0x5338fe[_0x20fd('0x32')]=_['intersection'](_0x56b3cc[_0x20fd('0x31')],qs[_0x20fd('0x33')](_0x398116[_0x20fd('0x2f')][_0x20fd('0x33')]));_0x5338fe[_0x20fd('0x32')]=_0x5338fe[_0x20fd('0x32')]['length']?_0x5338fe[_0x20fd('0x32')]:_0x56b3cc[_0x20fd('0x31')];if(!_0x398116[_0x20fd('0x2f')][_0x20fd('0x34')](_0x20fd('0x35'))){_0x5338fe[_0x20fd('0x36')]=qs[_0x20fd('0x36')](_0x398116['query'][_0x20fd('0x36')]);_0x5338fe['offset']=qs['offset'](_0x398116[_0x20fd('0x2f')][_0x20fd('0x1c')]);}_0x5338fe[_0x20fd('0x37')]=qs[_0x20fd('0x38')](_0x398116[_0x20fd('0x2f')][_0x20fd('0x38')]);_0x5338fe[_0x20fd('0x39')]=qs[_0x20fd('0x3a')](_['pick'](_0x398116[_0x20fd('0x2f')],_0x56b3cc[_0x20fd('0x3a')]));if(_0x398116['query']['filter']){_0x5338fe[_0x20fd('0x39')]=_[_0x20fd('0x3b')](_0x5338fe['where'],{'$or':_[_0x20fd('0x2d')](_0x26ea73,function(_0x4747c3){if(_0x4747c3[_0x20fd('0x2b')]!==_0x20fd('0x3c')){var _0x37d779={};_0x37d779[_0x4747c3[_0x20fd('0x26')]]={'$like':'%'+_0x398116['query'][_0x20fd('0x3d')]+'%'};return _0x37d779;}})});}_0x5338fe=_[_0x20fd('0x3b')]({},_0x5338fe,_0x398116['options']);var _0x513812={'where':_0x5338fe[_0x20fd('0x39')]};return db[_0x20fd('0x28')]['count'](_0x513812)['then'](function(_0x59ae37){_0xa166c4['count']=_0x59ae37;if(_0x398116[_0x20fd('0x2f')][_0x20fd('0x3e')]){_0x5338fe[_0x20fd('0x3f')]=[{'all':!![]}];}return db['FreshdeskField'][_0x20fd('0x40')](_0x5338fe);})[_0x20fd('0x22')](function(_0x4d9c6c){_0xa166c4[_0x20fd('0x41')]=_0x4d9c6c;return _0xa166c4;})[_0x20fd('0x22')](respondWithFilteredResult(_0x308f09,_0x5338fe))[_0x20fd('0x42')](handleError(_0x308f09,null));};exports[_0x20fd('0x43')]=function(_0x50cc42,_0x26db5a){var _0x416dd9={'raw':!![],'where':{'id':_0x50cc42[_0x20fd('0x44')]['id']}},_0x2437c8={};_0x2437c8[_0x20fd('0x31')]=_[_0x20fd('0x2e')](db['FreshdeskField']['rawAttributes']);_0x2437c8[_0x20fd('0x2f')]=_[_0x20fd('0x2e')](_0x50cc42[_0x20fd('0x2f')]);_0x2437c8[_0x20fd('0x3a')]=_['intersection'](_0x2437c8[_0x20fd('0x31')],_0x2437c8['query']);_0x416dd9[_0x20fd('0x32')]=_[_0x20fd('0x30')](_0x2437c8[_0x20fd('0x31')],qs[_0x20fd('0x33')](_0x50cc42[_0x20fd('0x2f')][_0x20fd('0x33')]));_0x416dd9['attributes']=_0x416dd9[_0x20fd('0x32')][_0x20fd('0x45')]?_0x416dd9[_0x20fd('0x32')]:_0x2437c8['model'];if(_0x50cc42[_0x20fd('0x2f')][_0x20fd('0x3e')]){_0x416dd9[_0x20fd('0x3f')]=[{'all':!![]}];}_0x416dd9=_[_0x20fd('0x3b')]({},_0x416dd9,_0x50cc42[_0x20fd('0x46')]);return db[_0x20fd('0x28')][_0x20fd('0x47')](_0x416dd9)[_0x20fd('0x22')](handleEntityNotFound(_0x26db5a,null))['then'](respondWithResult(_0x26db5a,null))[_0x20fd('0x42')](handleError(_0x26db5a,null));};exports[_0x20fd('0x48')]=function(_0x13cbe8,_0x51718f){return db[_0x20fd('0x28')][_0x20fd('0x48')](_0x13cbe8[_0x20fd('0x49')],{})['then'](respondWithResult(_0x51718f,0xc9))[_0x20fd('0x42')](handleError(_0x51718f,null));};exports['update']=function(_0x71269b,_0x3475b1){if(_0x71269b[_0x20fd('0x49')]['id']){delete _0x71269b[_0x20fd('0x49')]['id'];}return db['FreshdeskField'][_0x20fd('0x47')]({'where':{'id':_0x71269b[_0x20fd('0x44')]['id']}})[_0x20fd('0x22')](handleEntityNotFound(_0x3475b1,null))[_0x20fd('0x22')](saveUpdates(_0x71269b[_0x20fd('0x49')],null))[_0x20fd('0x22')](respondWithResult(_0x3475b1,null))['catch'](handleError(_0x3475b1,null));};exports['destroy']=function(_0x5dca80,_0x58b7af){return db[_0x20fd('0x28')][_0x20fd('0x47')]({'where':{'id':_0x5dca80[_0x20fd('0x44')]['id']}})[_0x20fd('0x22')](handleEntityNotFound(_0x58b7af,null))[_0x20fd('0x22')](removeEntity(_0x58b7af,null))[_0x20fd('0x42')](handleError(_0x58b7af,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 602ec08..6ede516 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 _0x3486=['FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x55d911,_0x2b768c){var _0x3104c2=function(_0x1b4386){while(--_0x1b4386){_0x55d911['push'](_0x55d911['shift']());}};_0x3104c2(++_0x2b768c);}(_0x3486,0x1a5));var _0x6348=function(_0x43347e,_0x12f3ac){_0x43347e=_0x43347e-0x0;var _0xcb5363=_0x3486[_0x43347e];return _0xcb5363;};'use strict';var _=require(_0x6348('0x0'));var util=require(_0x6348('0x1'));var logger=require(_0x6348('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6348('0x3'));var rp=require(_0x6348('0x4'));var fs=require('fs');var path=require(_0x6348('0x5'));var rimraf=require('rimraf');var config=require(_0x6348('0x6'));var attributes=require(_0x6348('0x7'));module[_0x6348('0x8')]=function(_0x4841bd,_0x55650c){return _0x4841bd[_0x6348('0x9')]('FreshdeskField',attributes,{'tableName':_0x6348('0xa'),'paranoid':![],'indexes':[{'name':_0x6348('0xb'),'fields':[_0x6348('0xc'),_0x6348('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ea2=['api','moment','request-promise','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x2a7f9b,_0x48d0ff){var _0x20274c=function(_0x3c42ea){while(--_0x3c42ea){_0x2a7f9b['push'](_0x2a7f9b['shift']());}};_0x20274c(++_0x48d0ff);}(_0x8ea2,0xe2));var _0x28ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x28ea('0x0'));var util=require('util');var logger=require(_0x28ea('0x1'))(_0x28ea('0x2'));var moment=require(_0x28ea('0x3'));var BPromise=require('bluebird');var rp=require(_0x28ea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x28ea('0x5'));module[_0x28ea('0x6')]=function(_0x45ac9a,_0xd1d56c){return _0x45ac9a[_0x28ea('0x7')](_0x28ea('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x28ea('0x9'),'fields':[_0x28ea('0xa'),_0x28ea('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index dbaf82e..a542732 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xd98db1,_0x25b09f){var _0x5a7bd1=function(_0x3e21f9){while(--_0x3e21f9){_0xd98db1['push'](_0xd98db1['shift']());}};_0x5a7bd1(++_0x25b09f);}(_0xb10b,0x12a));var _0xbb10=function(_0x223729,_0x470bb5){_0x223729=_0x223729-0x0;var _0x2119b6=_0xb10b[_0x223729];return _0x2119b6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2da567,_0x42b150){var _0x5678c0=function(_0x34e1e5){while(--_0x34e1e5){_0x2da567['push'](_0x2da567['shift']());}};_0x5678c0(++_0x42b150);}(_0xb10b,0x12a));var _0xbb10=function(_0x4d2169,_0x353eb9){_0x4d2169=_0x4d2169-0x0;var _0x52e417=_0xb10b[_0x4d2169];return _0x52e417;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 1a3c63b..3f6ea07 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 _0xd2f4=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','destroy','util'];(function(_0x1d2a8f,_0x1c2e1a){var _0x39ca93=function(_0x303ce4){while(--_0x303ce4){_0x1d2a8f['push'](_0x1d2a8f['shift']());}};_0x39ca93(++_0x1c2e1a);}(_0xd2f4,0xc5));var _0x4d2f=function(_0x2b06aa,_0x3d0819){_0x2b06aa=_0x2b06aa-0x0;var _0x2a4f57=_0xd2f4[_0x2b06aa];return _0x2a4f57;};'use strict';var multer=require('multer');var util=require(_0x4d2f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4d2f('0x1'));var router=express[_0x4d2f('0x2')]();var auth=require(_0x4d2f('0x3'));var interaction=require(_0x4d2f('0x4'));var config=require(_0x4d2f('0x5'));var controller=require(_0x4d2f('0x6'));router[_0x4d2f('0x7')]('/',auth[_0x4d2f('0x8')](),controller['index']);router['get'](_0x4d2f('0x9'),auth[_0x4d2f('0x8')](),controller['show']);router[_0x4d2f('0x7')](_0x4d2f('0xa'),auth[_0x4d2f('0x8')](),controller[_0x4d2f('0xb')]);router[_0x4d2f('0x7')](_0x4d2f('0xc'),auth['isAuthenticated'](),controller[_0x4d2f('0xd')]);router['post']('/',auth[_0x4d2f('0x8')](),controller[_0x4d2f('0xe')]);router[_0x4d2f('0xf')](_0x4d2f('0xa'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4d2f('0x10')](_0x4d2f('0x9'),auth[_0x4d2f('0x8')](),controller['update']);router['delete'](_0x4d2f('0x9'),auth[_0x4d2f('0x8')](),controller[_0x4d2f('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd51d=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x31093f,_0x3fd53b){var _0x2f0e5d=function(_0x2abfcc){while(--_0x2abfcc){_0x31093f['push'](_0x31093f['shift']());}};_0x2f0e5d(++_0x3fd53b);}(_0xd51d,0x1b4));var _0xdd51=function(_0x43037d,_0x36c76f){_0x43037d=_0x43037d-0x0;var _0x13d7e6=_0xd51d[_0x43037d];return _0x13d7e6;};'use strict';var multer=require(_0xdd51('0x0'));var util=require('util');var path=require(_0xdd51('0x1'));var timeout=require(_0xdd51('0x2'));var express=require(_0xdd51('0x3'));var router=express['Router']();var auth=require(_0xdd51('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdd51('0x5'));var controller=require(_0xdd51('0x6'));router[_0xdd51('0x7')]('/',auth[_0xdd51('0x8')](),controller[_0xdd51('0x9')]);router[_0xdd51('0x7')](_0xdd51('0xa'),auth[_0xdd51('0x8')](),controller['show']);router[_0xdd51('0x7')](_0xdd51('0xb'),auth[_0xdd51('0x8')](),controller[_0xdd51('0xc')]);router[_0xdd51('0x7')](_0xdd51('0xd'),auth['isAuthenticated'](),controller[_0xdd51('0xe')]);router[_0xdd51('0xf')]('/',auth['isAuthenticated'](),controller[_0xdd51('0x10')]);router[_0xdd51('0xf')](_0xdd51('0xb'),auth[_0xdd51('0x8')](),controller['addConfiguration']);router[_0xdd51('0x11')]('/:id',auth[_0xdd51('0x8')](),controller[_0xdd51('0x12')]);router[_0xdd51('0x13')](_0xdd51('0xa'),auth[_0xdd51('0x8')](),controller['destroy']);module[_0xdd51('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 871adcd..d38d547 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 _0x25e7=['sequelize','exports','STRING','username','remoteUri'];(function(_0x1d603a,_0x2b814e){var _0x4b76b4=function(_0x2ac4d1){while(--_0x2ac4d1){_0x1d603a['push'](_0x1d603a['shift']());}};_0x4b76b4(++_0x2b814e);}(_0x25e7,0x1d6));var _0x725e=function(_0x24fd11,_0x57c976){_0x24fd11=_0x24fd11-0x0;var _0x5da68f=_0x25e7[_0x24fd11];return _0x5da68f;};'use strict';var Sequelize=require(_0x725e('0x0'));module[_0x725e('0x1')]={'name':{'type':Sequelize[_0x725e('0x2')]},'description':{'type':Sequelize[_0x725e('0x2')]},'username':{'type':Sequelize[_0x725e('0x2')],'unique':_0x725e('0x3')},'apiKey':{'type':Sequelize[_0x725e('0x2')]},'remoteUri':{'type':Sequelize[_0x725e('0x2')],'unique':_0x725e('0x4')},'serverUrl':{'type':Sequelize[_0x725e('0x2')]}}; \ No newline at end of file +var _0x352e=['STRING','username','sequelize','exports'];(function(_0x38833a,_0x151c2d){var _0x2ec16=function(_0x148af7){while(--_0x148af7){_0x38833a['push'](_0x38833a['shift']());}};_0x2ec16(++_0x151c2d);}(_0x352e,0x1a6));var _0xe352=function(_0x3642f6,_0x30d59b){_0x3642f6=_0x3642f6-0x0;var _0x44038e=_0x352e[_0x3642f6];return _0x44038e;};'use strict';var Sequelize=require(_0xe352('0x0'));module[_0xe352('0x1')]={'name':{'type':Sequelize[_0xe352('0x2')]},'description':{'type':Sequelize[_0xe352('0x2')]},'username':{'type':Sequelize[_0xe352('0x2')],'unique':_0xe352('0x3')},'apiKey':{'type':Sequelize[_0xe352('0x2')]},'remoteUri':{'type':Sequelize[_0xe352('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xe352('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 85596fb..a989d52 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 _0x4615=['code','message','result','catch','sendStatus','count','offset','limit','status','set','save','update','destroy','stack','name','index','map','FreshsalesAccount','rawAttributes','type','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter','where','merge','options','includeAll','include','show','params','find','create','body','findOne','length','order','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','lastIndexOf','GET','format','%s%s','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0xf6c9c2,_0x4f4f23){var _0x473da7=function(_0x150650){while(--_0x150650){_0xf6c9c2['push'](_0xf6c9c2['shift']());}};_0x473da7(++_0x4f4f23);}(_0x4615,0xae));var _0x5461=function(_0xb7295b,_0x24ecd2){_0xb7295b=_0xb7295b-0x0;var _0x26674f=_0x4615[_0xb7295b];return _0x26674f;};'use strict';var pdf=require(_0x5461('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5461('0x1'));var jsonpatch=require(_0x5461('0x2'));var rp=require('request-promise');var moment=require(_0x5461('0x3'));var BPromise=require(_0x5461('0x4'));var Mustache=require(_0x5461('0x5'));var util=require(_0x5461('0x6'));var path=require(_0x5461('0x7'));var sox=require(_0x5461('0x8'));var csv=require(_0x5461('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5461('0xa'));var squel=require(_0x5461('0xb'));var crypto=require('crypto');var jsforce=require(_0x5461('0xc'));var deskjs=require(_0x5461('0xd'));var toCsv=require(_0x5461('0x9'));var querystring=require(_0x5461('0xe'));var Papa=require(_0x5461('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5461('0x10'));var as=require(_0x5461('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5461('0x12'));var utils=require(_0x5461('0x13'));var config=require('../../config/environment');var db=require(_0x5461('0x14'))['db'];var integrations=require(_0x5461('0x15'));var jayson=require(_0x5461('0x16'));var client=jayson[_0x5461('0x17')][_0x5461('0x18')]({'port':0x232a});function checkPasswordPattern(_0x584e2c,_0x5c30a4,_0x3194de){if(_0x3194de){var _0x58cc8f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58cc8f[_0x5461('0x19')](_0x5c30a4)){return _0x584e2c;}else{throw new db[(_0x5461('0x1a'))][(_0x5461('0x1b'))](_0x5461('0x1c'));}}else{return _0x584e2c;}}function respondWithRpcPromise(_0x265e66,_0x3aef63,_0x54c9aa,_0x19876f){return new BPromise(function(_0x297a98,_0x286b18){var _0x1da5b4=_0x19876f||client;return _0x1da5b4[_0x5461('0x1d')](_0x265e66,_0x54c9aa)[_0x5461('0x1e')](function(_0x69f429){logger[_0x5461('0x1f')](_0x5461('0x20'),_0x3aef63,'request\x20sent');logger[_0x5461('0x21')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3aef63,_0x5461('0x22'),JSON['stringify'](_0x69f429));if(_0x69f429[_0x5461('0x23')]){if(_0x69f429['error'][_0x5461('0x24')]===0x1f4){logger[_0x5461('0x23')](_0x5461('0x20'),_0x3aef63,_0x69f429['error'][_0x5461('0x25')]);return _0x286b18(_0x69f429[_0x5461('0x23')]['message']);}logger['error'](_0x5461('0x20'),_0x3aef63,_0x69f429[_0x5461('0x23')][_0x5461('0x25')]);return _0x297a98(_0x69f429[_0x5461('0x23')][_0x5461('0x25')]);}else{logger[_0x5461('0x1f')](_0x5461('0x20'),_0x3aef63,_0x5461('0x22'));_0x297a98(_0x69f429[_0x5461('0x26')][_0x5461('0x25')]);}})[_0x5461('0x27')](function(_0x257f5f){logger[_0x5461('0x23')](_0x5461('0x20'),_0x3aef63,_0x257f5f);_0x286b18(_0x257f5f);});});}function respondWithStatusCode(_0x190892,_0x255ad1){_0x255ad1=_0x255ad1||0xcc;return function(_0xd31433){if(_0xd31433){return _0x190892[_0x5461('0x28')](_0x255ad1);}return _0x190892['status'](_0x255ad1)['end']();};}function respondWithResult(_0x14137e,_0x2e5c2b){_0x2e5c2b=_0x2e5c2b||0xc8;return function(_0x210953){if(_0x210953){return _0x14137e['status'](_0x2e5c2b)['json'](_0x210953);}};}function respondWithFilteredResult(_0xe3ccf7,_0x547fca){return function(_0x4c74ee){if(_0x4c74ee){var _0x3f4d13=_0x4c74ee[_0x5461('0x29')],_0x2726e9=_0x547fca[_0x5461('0x2a')],_0x3fa0da=_0x547fca[_0x5461('0x2a')]+_0x547fca[_0x5461('0x2b')],_0x586d01;if(_0x3fa0da>=_0x3f4d13){_0x3fa0da=_0x3f4d13;_0x586d01=0xc8;}else{_0x586d01=0xce;}_0xe3ccf7[_0x5461('0x2c')](_0x586d01);return _0xe3ccf7[_0x5461('0x2d')]('Content-Range',_0x2726e9+'-'+_0x3fa0da+'/'+_0x3f4d13)['json'](_0x4c74ee);}return null;};}function patchUpdates(_0x15c6a0){return function(_0x42fd6c){try{jsonpatch['apply'](_0x42fd6c,_0x15c6a0,!![]);}catch(_0x445e7b){return BPromise['reject'](_0x445e7b);}return _0x42fd6c[_0x5461('0x2e')]();};}function saveUpdates(_0x4a87d8,_0x597680){return function(_0x218878){if(_0x218878){return _0x218878[_0x5461('0x2f')](_0x4a87d8)[_0x5461('0x1e')](function(_0x372374){return _0x372374;});}return null;};}function removeEntity(_0x4995b5,_0xe3c7a9){return function(_0x145376){if(_0x145376){return _0x145376[_0x5461('0x30')]()[_0x5461('0x1e')](function(){_0x4995b5[_0x5461('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x594795,_0x5d1004){return function(_0x54c7c4){if(!_0x54c7c4){_0x594795[_0x5461('0x28')](0x194);}return _0x54c7c4;};}function handleError(_0x2c20d7,_0x29a003){_0x29a003=_0x29a003||0x1f4;return function(_0x5b890b){logger[_0x5461('0x23')](_0x5b890b[_0x5461('0x31')]);if(_0x5b890b[_0x5461('0x32')]){delete _0x5b890b[_0x5461('0x32')];}_0x2c20d7[_0x5461('0x2c')](_0x29a003)['send'](_0x5b890b);};}exports[_0x5461('0x33')]=function(_0x663580,_0x2526bb){var _0x5e9524={},_0x2a74c2={},_0x1ca821={'count':0x0,'rows':[]};var _0x12c572=_[_0x5461('0x34')](db[_0x5461('0x35')][_0x5461('0x36')],function(_0x16f055){return{'name':_0x16f055['fieldName'],'type':_0x16f055[_0x5461('0x37')]['key']};});_0x2a74c2['model']=_[_0x5461('0x34')](_0x12c572,_0x5461('0x32'));_0x2a74c2[_0x5461('0x38')]=_[_0x5461('0x39')](_0x663580[_0x5461('0x38')]);_0x2a74c2[_0x5461('0x3a')]=_['intersection'](_0x2a74c2[_0x5461('0x3b')],_0x2a74c2['query']);_0x5e9524[_0x5461('0x3c')]=_[_0x5461('0x3d')](_0x2a74c2[_0x5461('0x3b')],qs[_0x5461('0x3e')](_0x663580[_0x5461('0x38')]['fields']));_0x5e9524[_0x5461('0x3c')]=_0x5e9524['attributes']['length']?_0x5e9524['attributes']:_0x2a74c2[_0x5461('0x3b')];if(!_0x663580[_0x5461('0x38')][_0x5461('0x3f')](_0x5461('0x40'))){_0x5e9524['limit']=qs[_0x5461('0x2b')](_0x663580[_0x5461('0x38')][_0x5461('0x2b')]);_0x5e9524[_0x5461('0x2a')]=qs[_0x5461('0x2a')](_0x663580[_0x5461('0x38')][_0x5461('0x2a')]);}_0x5e9524['order']=qs[_0x5461('0x41')](_0x663580[_0x5461('0x38')]['sort']);_0x5e9524['where']=qs['filters'](_['pick'](_0x663580[_0x5461('0x38')],_0x2a74c2[_0x5461('0x3a')]));if(_0x663580[_0x5461('0x38')][_0x5461('0x42')]){_0x5e9524[_0x5461('0x43')]=_['merge'](_0x5e9524[_0x5461('0x43')],{'$or':_[_0x5461('0x34')](_0x12c572,function(_0x4f4ef7){if(_0x4f4ef7[_0x5461('0x37')]!=='VIRTUAL'){var _0x102303={};_0x102303[_0x4f4ef7['name']]={'$like':'%'+_0x663580['query']['filter']+'%'};return _0x102303;}})});}_0x5e9524=_[_0x5461('0x44')]({},_0x5e9524,_0x663580[_0x5461('0x45')]);var _0x5b3899={'where':_0x5e9524[_0x5461('0x43')]};return db['FreshsalesAccount']['count'](_0x5b3899)['then'](function(_0x39aa87){_0x1ca821['count']=_0x39aa87;if(_0x663580[_0x5461('0x38')][_0x5461('0x46')]){_0x5e9524[_0x5461('0x47')]=[{'all':!![]}];}return db[_0x5461('0x35')]['findAll'](_0x5e9524);})['then'](function(_0x4cda68){_0x1ca821['rows']=_0x4cda68;return _0x1ca821;})[_0x5461('0x1e')](respondWithFilteredResult(_0x2526bb,_0x5e9524))['catch'](handleError(_0x2526bb,null));};exports[_0x5461('0x48')]=function(_0x325912,_0x240f50){var _0x3b4cc7={'raw':![],'where':{'id':_0x325912[_0x5461('0x49')]['id']}},_0x2fd543={};_0x2fd543[_0x5461('0x3b')]=_[_0x5461('0x39')](db[_0x5461('0x35')][_0x5461('0x36')]);_0x2fd543[_0x5461('0x38')]=_[_0x5461('0x39')](_0x325912[_0x5461('0x38')]);_0x2fd543[_0x5461('0x3a')]=_[_0x5461('0x3d')](_0x2fd543[_0x5461('0x3b')],_0x2fd543[_0x5461('0x38')]);_0x3b4cc7[_0x5461('0x3c')]=_[_0x5461('0x3d')](_0x2fd543[_0x5461('0x3b')],qs[_0x5461('0x3e')](_0x325912[_0x5461('0x38')][_0x5461('0x3e')]));_0x3b4cc7[_0x5461('0x3c')]=_0x3b4cc7['attributes']['length']?_0x3b4cc7['attributes']:_0x2fd543[_0x5461('0x3b')];if(_0x325912[_0x5461('0x38')]['includeAll']){_0x3b4cc7[_0x5461('0x47')]=[{'all':!![]}];}_0x3b4cc7=_[_0x5461('0x44')]({},_0x3b4cc7,_0x325912[_0x5461('0x45')]);return db[_0x5461('0x35')][_0x5461('0x4a')](_0x3b4cc7)['then'](handleEntityNotFound(_0x240f50,null))['then'](respondWithResult(_0x240f50,null))[_0x5461('0x27')](handleError(_0x240f50,null));};exports[_0x5461('0x4b')]=function(_0x4b1e58,_0x20bc1b){return db[_0x5461('0x35')][_0x5461('0x4b')](_0x4b1e58[_0x5461('0x4c')],{})[_0x5461('0x1e')](respondWithResult(_0x20bc1b,0xc9))['catch'](handleError(_0x20bc1b,null));};exports[_0x5461('0x2f')]=function(_0x4186cb,_0x1a0ea4){if(_0x4186cb[_0x5461('0x4c')]['id']){delete _0x4186cb['body']['id'];}return db[_0x5461('0x35')][_0x5461('0x4a')]({'where':{'id':_0x4186cb[_0x5461('0x49')]['id']}})[_0x5461('0x1e')](handleEntityNotFound(_0x1a0ea4,null))[_0x5461('0x1e')](saveUpdates(_0x4186cb[_0x5461('0x4c')],null))[_0x5461('0x1e')](respondWithResult(_0x1a0ea4,null))[_0x5461('0x27')](handleError(_0x1a0ea4,null));};exports[_0x5461('0x30')]=function(_0x3fdb21,_0x22932e){return db[_0x5461('0x35')][_0x5461('0x4a')]({'where':{'id':_0x3fdb21[_0x5461('0x49')]['id']}})['then'](handleEntityNotFound(_0x22932e,null))[_0x5461('0x1e')](removeEntity(_0x22932e,null))[_0x5461('0x27')](handleError(_0x22932e,null));};exports['getConfigurations']=function(_0x4a9889,_0x497918,_0x3b0b6c){var _0x3e7cef={};var _0x3a864c={};var _0x493dca;var _0x204763;return db[_0x5461('0x35')][_0x5461('0x4d')]({'where':{'id':_0x4a9889[_0x5461('0x49')]['id']}})[_0x5461('0x1e')](handleEntityNotFound(_0x497918,null))['then'](function(_0x2512ab){if(_0x2512ab){_0x493dca=_0x2512ab;_0x3a864c[_0x5461('0x3b')]=_[_0x5461('0x39')](db['FreshsalesConfiguration'][_0x5461('0x36')]);_0x3a864c[_0x5461('0x38')]=_[_0x5461('0x39')](_0x4a9889[_0x5461('0x38')]);_0x3a864c[_0x5461('0x3a')]=_[_0x5461('0x3d')](_0x3a864c['model'],_0x3a864c[_0x5461('0x38')]);_0x3e7cef[_0x5461('0x3c')]=_['intersection'](_0x3a864c[_0x5461('0x3b')],qs[_0x5461('0x3e')](_0x4a9889['query'][_0x5461('0x3e')]));_0x3e7cef['attributes']=_0x3e7cef[_0x5461('0x3c')][_0x5461('0x4e')]?_0x3e7cef[_0x5461('0x3c')]:_0x3a864c['model'];_0x3e7cef[_0x5461('0x4f')]=qs['sort'](_0x4a9889[_0x5461('0x38')][_0x5461('0x41')]);_0x3e7cef['where']=qs['filters'](_['pick'](_0x4a9889[_0x5461('0x38')],_0x3a864c[_0x5461('0x3a')]));if(_0x4a9889[_0x5461('0x38')][_0x5461('0x42')]){_0x3e7cef['where']=_['merge'](_0x3e7cef['where'],{'$or':_[_0x5461('0x34')](_0x3e7cef['attributes'],function(_0x210f8e){var _0x5f3ebb={};_0x5f3ebb[_0x210f8e]={'$like':'%'+_0x4a9889[_0x5461('0x38')][_0x5461('0x42')]+'%'};return _0x5f3ebb;})});}_0x3e7cef=_[_0x5461('0x44')]({},_0x3e7cef,_0x4a9889[_0x5461('0x45')]);return _0x493dca[_0x5461('0x50')](_0x3e7cef);}})[_0x5461('0x1e')](function(_0x19ac96){if(_0x19ac96){_0x204763=_0x19ac96[_0x5461('0x4e')];if(!_0x4a9889['query'][_0x5461('0x3f')](_0x5461('0x40'))){_0x3e7cef['limit']=qs['limit'](_0x4a9889[_0x5461('0x38')][_0x5461('0x2b')]);_0x3e7cef['offset']=qs[_0x5461('0x2a')](_0x4a9889['query'][_0x5461('0x2a')]);}return _0x493dca[_0x5461('0x50')](_0x3e7cef);}})['then'](function(_0xc528e5){if(_0xc528e5){return _0xc528e5?{'count':_0x204763,'rows':_0xc528e5}:null;}})[_0x5461('0x1e')](respondWithResult(_0x497918,null))[_0x5461('0x27')](handleError(_0x497918,null));};exports[_0x5461('0x51')]=function(_0x464ced,_0xb4c4dd,_0x505353){if(_0x464ced[_0x5461('0x4c')]['id']){delete _0x464ced[_0x5461('0x4c')]['id'];}return db[_0x5461('0x35')][_0x5461('0x4d')]({'where':{'id':_0x464ced[_0x5461('0x49')]['id']}})[_0x5461('0x1e')](handleEntityNotFound(_0xb4c4dd,null))[_0x5461('0x1e')](function(_0xe39812){if(_0xe39812){_0x464ced[_0x5461('0x4c')]['AccountId']=_0xe39812['id'];_0x464ced['body'][_0x5461('0x52')]=integrations[_0x5461('0x53')](_0x464ced[_0x5461('0x4c')][_0x5461('0x54')],_0x464ced[_0x5461('0x4c')][_0x5461('0x37')]);_0x464ced[_0x5461('0x4c')][_0x5461('0x55')]=integrations[_0x5461('0x56')](_0x464ced[_0x5461('0x4c')]['channel'],_0x464ced['body'][_0x5461('0x37')]);return db[_0x5461('0x57')]['create'](_0x464ced[_0x5461('0x4c')],{'include':[{'model':db[_0x5461('0x58')],'as':_0x5461('0x52')},{'model':db[_0x5461('0x58')],'as':_0x5461('0x55')}]});}return null;})[_0x5461('0x1e')](respondWithResult(_0xb4c4dd,null))[_0x5461('0x27')](handleError(_0xb4c4dd,null));};exports[_0x5461('0x59')]=function(_0x24f405,_0x2b98a3,_0xbba10e){var _0x2440f8='';var _0x2b22d4='';return db[_0x5461('0x35')]['findOne']({'where':{'id':_0x24f405[_0x5461('0x49')]['id']},'attributes':['id',_0x5461('0x5a'),_0x5461('0x5b'),_0x5461('0x5c')]})[_0x5461('0x1e')](handleEntityNotFound(_0x2b98a3,null))['then'](function(_0x2469a0){if(_0x2469a0){_0x2b22d4=_0x2469a0[_0x5461('0x5a')];_0x2440f8=_0x2469a0[_0x5461('0x5b')];var _0xc0914a=_0x2469a0['remoteUri']['slice'](-0x1);if(_0xc0914a==='/'){_0x2440f8=_0x2440f8['substring'](0x0,_0x2440f8[_0x5461('0x5d')](_0xc0914a));}return rp({'method':_0x5461('0x5e'),'uri':util[_0x5461('0x5f')](_0x5461('0x60'),_0x2440f8,'/api/selector/owners'),'headers':{'Authorization':_0x5461('0x61')+_0x2469a0[_0x5461('0x5c')]},'json':!![]});}})[_0x5461('0x1e')](function(_0x2397ec){if(_0x2397ec){var _0x1b2e02=_0x2397ec['users'];var _0xe0cce0=![];var _0x590761=null;for(_0x590761=0x0;_0x590761<_0x1b2e02[_0x5461('0x4e')];_0x590761++){if(_0x1b2e02[_0x590761][_0x5461('0x62')]===_0x2b22d4){_0xe0cce0=!![];}}if(_0xe0cce0){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5461('0x63')});}}})['then'](respondWithResult(_0x2b98a3,null))[_0x5461('0x27')](function(_0x276195){var _0x3957fc=_0x24f405['query']['test']?0x1f4:_0x276195[_0x5461('0x64')]||0x1f4;logger[_0x5461('0x23')](_0x5461('0x65'),_0x5461('0x59'),_0x3957fc,JSON[_0x5461('0x66')](_0x276195));delete _0x276195[_0x5461('0x32')];if(_0x3957fc===0x191){_0x3957fc=0x190;}_0x2b98a3[_0x5461('0x2c')](_0x3957fc)[_0x5461('0x67')](_0x24f405[_0x5461('0x38')][_0x5461('0x19')]?{'message':_0x5461('0x68'),'statusCode':_0x276195[_0x5461('0x64')]}:_0x276195);});}; \ No newline at end of file +var _0x4c5e=['Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','count','offset','limit','set','apply','reject','update','destroy','end','sendStatus','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','options','findAll','rows','show','params','length','includeAll','include','find','create','body','getConfigurations','findOne','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','username','remoteUri','slice','substring','GET','format','%s%s','/api/selector/owners','apiKey','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields'];(function(_0x43e81d,_0x30bab7){var _0x4379b2=function(_0x2efa4e){while(--_0x2efa4e){_0x43e81d['push'](_0x43e81d['shift']());}};_0x4379b2(++_0x30bab7);}(_0x4c5e,0x73));var _0xe4c5=function(_0x43f76c,_0x2e909d){_0x43f76c=_0x43f76c-0x0;var _0x5e5d7f=_0x4c5e[_0x43f76c];return _0x5e5d7f;};'use strict';var pdf=require(_0xe4c5('0x0'));var emlformat=require(_0xe4c5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe4c5('0x2'));var jsonpatch=require(_0xe4c5('0x3'));var rp=require(_0xe4c5('0x4'));var moment=require(_0xe4c5('0x5'));var BPromise=require(_0xe4c5('0x6'));var Mustache=require(_0xe4c5('0x7'));var util=require(_0xe4c5('0x8'));var path=require(_0xe4c5('0x9'));var sox=require(_0xe4c5('0xa'));var csv=require(_0xe4c5('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe4c5('0xc'));var crypto=require(_0xe4c5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe4c5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe4c5('0xf'));var Papa=require(_0xe4c5('0x10'));var Redis=require('ioredis');var authService=require(_0xe4c5('0x11'));var qs=require(_0xe4c5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4c5('0x13'));var logger=require(_0xe4c5('0x14'))(_0xe4c5('0x15'));var utils=require('../../config/utils');var config=require(_0xe4c5('0x16'));var db=require(_0xe4c5('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xe4c5('0x18'));var client=jayson[_0xe4c5('0x19')][_0xe4c5('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1e5431,_0x473c70,_0x210898){if(_0x210898){var _0x5c8819=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c8819[_0xe4c5('0x1b')](_0x473c70)){return _0x1e5431;}else{throw new db[(_0xe4c5('0x1c'))][(_0xe4c5('0x1d'))](_0xe4c5('0x1e'));}}else{return _0x1e5431;}}function respondWithRpcPromise(_0x70094d,_0x20a4aa,_0x4d834f,_0x2c7e3c){return new BPromise(function(_0x55a556,_0x580fae){var _0x1892a0=_0x2c7e3c||client;return _0x1892a0[_0xe4c5('0x1f')](_0x70094d,_0x4d834f)[_0xe4c5('0x20')](function(_0x4b2a97){logger[_0xe4c5('0x21')](_0xe4c5('0x22'),_0x20a4aa,_0xe4c5('0x23'));logger['debug'](_0xe4c5('0x24'),_0x20a4aa,_0xe4c5('0x23'),JSON[_0xe4c5('0x25')](_0x4b2a97));if(_0x4b2a97[_0xe4c5('0x26')]){if(_0x4b2a97[_0xe4c5('0x26')][_0xe4c5('0x27')]===0x1f4){logger[_0xe4c5('0x26')](_0xe4c5('0x22'),_0x20a4aa,_0x4b2a97['error'][_0xe4c5('0x28')]);return _0x580fae(_0x4b2a97[_0xe4c5('0x26')]['message']);}logger[_0xe4c5('0x26')](_0xe4c5('0x22'),_0x20a4aa,_0x4b2a97[_0xe4c5('0x26')][_0xe4c5('0x28')]);return _0x55a556(_0x4b2a97['error'][_0xe4c5('0x28')]);}else{logger[_0xe4c5('0x21')](_0xe4c5('0x22'),_0x20a4aa,_0xe4c5('0x23'));_0x55a556(_0x4b2a97['result'][_0xe4c5('0x28')]);}})[_0xe4c5('0x29')](function(_0x222a43){logger['error'](_0xe4c5('0x22'),_0x20a4aa,_0x222a43);_0x580fae(_0x222a43);});});}function respondWithStatusCode(_0x4507bf,_0x5c85c8){_0x5c85c8=_0x5c85c8||0xcc;return function(_0x55310e){if(_0x55310e){return _0x4507bf['sendStatus'](_0x5c85c8);}return _0x4507bf[_0xe4c5('0x2a')](_0x5c85c8)['end']();};}function respondWithResult(_0x3fa4ec,_0x44229f){_0x44229f=_0x44229f||0xc8;return function(_0x5af06b){if(_0x5af06b){return _0x3fa4ec[_0xe4c5('0x2a')](_0x44229f)[_0xe4c5('0x2b')](_0x5af06b);}};}function respondWithFilteredResult(_0x16286f,_0x3957a0){return function(_0x35ef84){if(_0x35ef84){var _0x56a802=_0x35ef84[_0xe4c5('0x2c')],_0x44e92b=_0x3957a0[_0xe4c5('0x2d')],_0x450e1f=_0x3957a0[_0xe4c5('0x2d')]+_0x3957a0[_0xe4c5('0x2e')],_0x4205fc;if(_0x450e1f>=_0x56a802){_0x450e1f=_0x56a802;_0x4205fc=0xc8;}else{_0x4205fc=0xce;}_0x16286f['status'](_0x4205fc);return _0x16286f[_0xe4c5('0x2f')]('Content-Range',_0x44e92b+'-'+_0x450e1f+'/'+_0x56a802)[_0xe4c5('0x2b')](_0x35ef84);}return null;};}function patchUpdates(_0x51c7e3){return function(_0xa2aa73){try{jsonpatch[_0xe4c5('0x30')](_0xa2aa73,_0x51c7e3,!![]);}catch(_0x3bc1eb){return BPromise[_0xe4c5('0x31')](_0x3bc1eb);}return _0xa2aa73['save']();};}function saveUpdates(_0x23ee37,_0x56a1d2){return function(_0x1e3b1b){if(_0x1e3b1b){return _0x1e3b1b[_0xe4c5('0x32')](_0x23ee37)[_0xe4c5('0x20')](function(_0x322ddc){return _0x322ddc;});}return null;};}function removeEntity(_0x50556a,_0x34e8dc){return function(_0x11ee65){if(_0x11ee65){return _0x11ee65[_0xe4c5('0x33')]()['then'](function(){_0x50556a[_0xe4c5('0x2a')](0xcc)[_0xe4c5('0x34')]();});}};}function handleEntityNotFound(_0x519a6d,_0x3f07c0){return function(_0xa96489){if(!_0xa96489){_0x519a6d[_0xe4c5('0x35')](0x194);}return _0xa96489;};}function handleError(_0x16e33f,_0x4d4767){_0x4d4767=_0x4d4767||0x1f4;return function(_0x202b01){logger[_0xe4c5('0x26')](_0x202b01['stack']);if(_0x202b01[_0xe4c5('0x36')]){delete _0x202b01[_0xe4c5('0x36')];}_0x16e33f[_0xe4c5('0x2a')](_0x4d4767)[_0xe4c5('0x37')](_0x202b01);};}exports[_0xe4c5('0x38')]=function(_0x35de2e,_0x5e6e0b){var _0x3a6496={},_0x3ed35c={},_0x2ad2d8={'count':0x0,'rows':[]};var _0x1ae551=_[_0xe4c5('0x39')](db[_0xe4c5('0x3a')][_0xe4c5('0x3b')],function(_0x270ece){return{'name':_0x270ece[_0xe4c5('0x3c')],'type':_0x270ece[_0xe4c5('0x3d')][_0xe4c5('0x3e')]};});_0x3ed35c[_0xe4c5('0x3f')]=_['map'](_0x1ae551,'name');_0x3ed35c[_0xe4c5('0x40')]=_[_0xe4c5('0x41')](_0x35de2e['query']);_0x3ed35c[_0xe4c5('0x42')]=_[_0xe4c5('0x43')](_0x3ed35c[_0xe4c5('0x3f')],_0x3ed35c[_0xe4c5('0x40')]);_0x3a6496[_0xe4c5('0x44')]=_[_0xe4c5('0x43')](_0x3ed35c['model'],qs[_0xe4c5('0x45')](_0x35de2e['query']['fields']));_0x3a6496['attributes']=_0x3a6496['attributes']['length']?_0x3a6496['attributes']:_0x3ed35c['model'];if(!_0x35de2e[_0xe4c5('0x40')]['hasOwnProperty'](_0xe4c5('0x46'))){_0x3a6496[_0xe4c5('0x2e')]=qs[_0xe4c5('0x2e')](_0x35de2e[_0xe4c5('0x40')][_0xe4c5('0x2e')]);_0x3a6496[_0xe4c5('0x2d')]=qs['offset'](_0x35de2e['query'][_0xe4c5('0x2d')]);}_0x3a6496['order']=qs[_0xe4c5('0x47')](_0x35de2e[_0xe4c5('0x40')]['sort']);_0x3a6496[_0xe4c5('0x48')]=qs[_0xe4c5('0x42')](_[_0xe4c5('0x49')](_0x35de2e[_0xe4c5('0x40')],_0x3ed35c[_0xe4c5('0x42')]));if(_0x35de2e['query'][_0xe4c5('0x4a')]){_0x3a6496['where']=_['merge'](_0x3a6496[_0xe4c5('0x48')],{'$or':_['map'](_0x1ae551,function(_0x3e97de){if(_0x3e97de[_0xe4c5('0x3d')]!=='VIRTUAL'){var _0x2e6f21={};_0x2e6f21[_0x3e97de[_0xe4c5('0x36')]]={'$like':'%'+_0x35de2e['query'][_0xe4c5('0x4a')]+'%'};return _0x2e6f21;}})});}_0x3a6496=_[_0xe4c5('0x4b')]({},_0x3a6496,_0x35de2e[_0xe4c5('0x4c')]);var _0x43647d={'where':_0x3a6496[_0xe4c5('0x48')]};return db[_0xe4c5('0x3a')][_0xe4c5('0x2c')](_0x43647d)[_0xe4c5('0x20')](function(_0x228f55){_0x2ad2d8[_0xe4c5('0x2c')]=_0x228f55;if(_0x35de2e[_0xe4c5('0x40')]['includeAll']){_0x3a6496['include']=[{'all':!![]}];}return db[_0xe4c5('0x3a')][_0xe4c5('0x4d')](_0x3a6496);})[_0xe4c5('0x20')](function(_0x20956b){_0x2ad2d8[_0xe4c5('0x4e')]=_0x20956b;return _0x2ad2d8;})[_0xe4c5('0x20')](respondWithFilteredResult(_0x5e6e0b,_0x3a6496))[_0xe4c5('0x29')](handleError(_0x5e6e0b,null));};exports[_0xe4c5('0x4f')]=function(_0x3c3a93,_0x162fa0){var _0x42554f={'raw':![],'where':{'id':_0x3c3a93[_0xe4c5('0x50')]['id']}},_0xcab8ab={};_0xcab8ab[_0xe4c5('0x3f')]=_['keys'](db['FreshsalesAccount'][_0xe4c5('0x3b')]);_0xcab8ab[_0xe4c5('0x40')]=_[_0xe4c5('0x41')](_0x3c3a93[_0xe4c5('0x40')]);_0xcab8ab[_0xe4c5('0x42')]=_['intersection'](_0xcab8ab[_0xe4c5('0x3f')],_0xcab8ab[_0xe4c5('0x40')]);_0x42554f['attributes']=_['intersection'](_0xcab8ab[_0xe4c5('0x3f')],qs[_0xe4c5('0x45')](_0x3c3a93[_0xe4c5('0x40')][_0xe4c5('0x45')]));_0x42554f[_0xe4c5('0x44')]=_0x42554f[_0xe4c5('0x44')][_0xe4c5('0x51')]?_0x42554f[_0xe4c5('0x44')]:_0xcab8ab['model'];if(_0x3c3a93[_0xe4c5('0x40')][_0xe4c5('0x52')]){_0x42554f[_0xe4c5('0x53')]=[{'all':!![]}];}_0x42554f=_[_0xe4c5('0x4b')]({},_0x42554f,_0x3c3a93[_0xe4c5('0x4c')]);return db['FreshsalesAccount'][_0xe4c5('0x54')](_0x42554f)[_0xe4c5('0x20')](handleEntityNotFound(_0x162fa0,null))['then'](respondWithResult(_0x162fa0,null))['catch'](handleError(_0x162fa0,null));};exports[_0xe4c5('0x55')]=function(_0x27d468,_0x451094){return db[_0xe4c5('0x3a')]['create'](_0x27d468[_0xe4c5('0x56')],{})[_0xe4c5('0x20')](respondWithResult(_0x451094,0xc9))['catch'](handleError(_0x451094,null));};exports[_0xe4c5('0x32')]=function(_0x495361,_0x14c606){if(_0x495361[_0xe4c5('0x56')]['id']){delete _0x495361[_0xe4c5('0x56')]['id'];}return db[_0xe4c5('0x3a')]['find']({'where':{'id':_0x495361[_0xe4c5('0x50')]['id']}})[_0xe4c5('0x20')](handleEntityNotFound(_0x14c606,null))[_0xe4c5('0x20')](saveUpdates(_0x495361[_0xe4c5('0x56')],null))['then'](respondWithResult(_0x14c606,null))[_0xe4c5('0x29')](handleError(_0x14c606,null));};exports[_0xe4c5('0x33')]=function(_0x521806,_0x2bfde8){return db[_0xe4c5('0x3a')]['find']({'where':{'id':_0x521806[_0xe4c5('0x50')]['id']}})['then'](handleEntityNotFound(_0x2bfde8,null))[_0xe4c5('0x20')](removeEntity(_0x2bfde8,null))[_0xe4c5('0x29')](handleError(_0x2bfde8,null));};exports[_0xe4c5('0x57')]=function(_0x17fff0,_0x2c083c,_0x596397){var _0x319dd7={};var _0x2af094={};var _0x1270a8;var _0x10e0ee;return db['FreshsalesAccount'][_0xe4c5('0x58')]({'where':{'id':_0x17fff0[_0xe4c5('0x50')]['id']}})['then'](handleEntityNotFound(_0x2c083c,null))[_0xe4c5('0x20')](function(_0x4dba72){if(_0x4dba72){_0x1270a8=_0x4dba72;_0x2af094[_0xe4c5('0x3f')]=_[_0xe4c5('0x41')](db['FreshsalesConfiguration'][_0xe4c5('0x3b')]);_0x2af094[_0xe4c5('0x40')]=_[_0xe4c5('0x41')](_0x17fff0[_0xe4c5('0x40')]);_0x2af094['filters']=_[_0xe4c5('0x43')](_0x2af094['model'],_0x2af094['query']);_0x319dd7[_0xe4c5('0x44')]=_[_0xe4c5('0x43')](_0x2af094[_0xe4c5('0x3f')],qs[_0xe4c5('0x45')](_0x17fff0[_0xe4c5('0x40')][_0xe4c5('0x45')]));_0x319dd7[_0xe4c5('0x44')]=_0x319dd7[_0xe4c5('0x44')]['length']?_0x319dd7[_0xe4c5('0x44')]:_0x2af094['model'];_0x319dd7[_0xe4c5('0x59')]=qs['sort'](_0x17fff0[_0xe4c5('0x40')][_0xe4c5('0x47')]);_0x319dd7[_0xe4c5('0x48')]=qs['filters'](_[_0xe4c5('0x49')](_0x17fff0['query'],_0x2af094[_0xe4c5('0x42')]));if(_0x17fff0['query'][_0xe4c5('0x4a')]){_0x319dd7['where']=_[_0xe4c5('0x4b')](_0x319dd7[_0xe4c5('0x48')],{'$or':_[_0xe4c5('0x39')](_0x319dd7[_0xe4c5('0x44')],function(_0x565d8b){var _0x27a3bb={};_0x27a3bb[_0x565d8b]={'$like':'%'+_0x17fff0['query']['filter']+'%'};return _0x27a3bb;})});}_0x319dd7=_[_0xe4c5('0x4b')]({},_0x319dd7,_0x17fff0[_0xe4c5('0x4c')]);return _0x1270a8[_0xe4c5('0x57')](_0x319dd7);}})[_0xe4c5('0x20')](function(_0x391a84){if(_0x391a84){_0x10e0ee=_0x391a84['length'];if(!_0x17fff0[_0xe4c5('0x40')][_0xe4c5('0x5a')]('nolimit')){_0x319dd7['limit']=qs[_0xe4c5('0x2e')](_0x17fff0[_0xe4c5('0x40')][_0xe4c5('0x2e')]);_0x319dd7[_0xe4c5('0x2d')]=qs[_0xe4c5('0x2d')](_0x17fff0[_0xe4c5('0x40')][_0xe4c5('0x2d')]);}return _0x1270a8[_0xe4c5('0x57')](_0x319dd7);}})['then'](function(_0x10aa47){if(_0x10aa47){return _0x10aa47?{'count':_0x10e0ee,'rows':_0x10aa47}:null;}})[_0xe4c5('0x20')](respondWithResult(_0x2c083c,null))['catch'](handleError(_0x2c083c,null));};exports[_0xe4c5('0x5b')]=function(_0x528ad4,_0x53faf0,_0x46d92b){if(_0x528ad4['body']['id']){delete _0x528ad4[_0xe4c5('0x56')]['id'];}return db[_0xe4c5('0x3a')][_0xe4c5('0x58')]({'where':{'id':_0x528ad4[_0xe4c5('0x50')]['id']}})[_0xe4c5('0x20')](handleEntityNotFound(_0x53faf0,null))[_0xe4c5('0x20')](function(_0x1cd079){if(_0x1cd079){_0x528ad4['body'][_0xe4c5('0x5c')]=_0x1cd079['id'];_0x528ad4[_0xe4c5('0x56')][_0xe4c5('0x5d')]=integrations[_0xe4c5('0x5e')](_0x528ad4[_0xe4c5('0x56')]['channel'],_0x528ad4[_0xe4c5('0x56')]['type']);_0x528ad4[_0xe4c5('0x56')][_0xe4c5('0x5f')]=integrations[_0xe4c5('0x60')](_0x528ad4['body'][_0xe4c5('0x61')],_0x528ad4[_0xe4c5('0x56')]['type']);return db[_0xe4c5('0x62')][_0xe4c5('0x55')](_0x528ad4['body'],{'include':[{'model':db[_0xe4c5('0x63')],'as':'Subjects'},{'model':db[_0xe4c5('0x63')],'as':'Descriptions'}]});}return null;})[_0xe4c5('0x20')](respondWithResult(_0x53faf0,null))[_0xe4c5('0x29')](handleError(_0x53faf0,null));};exports['getFields']=function(_0x287390,_0x18feea,_0x1a2470){var _0x338e33='';var _0x1ce853='';return db[_0xe4c5('0x3a')][_0xe4c5('0x58')]({'where':{'id':_0x287390[_0xe4c5('0x50')]['id']},'attributes':['id',_0xe4c5('0x64'),_0xe4c5('0x65'),'apiKey']})[_0xe4c5('0x20')](handleEntityNotFound(_0x18feea,null))[_0xe4c5('0x20')](function(_0x44da2d){if(_0x44da2d){_0x1ce853=_0x44da2d[_0xe4c5('0x64')];_0x338e33=_0x44da2d['remoteUri'];var _0xd1242a=_0x44da2d[_0xe4c5('0x65')][_0xe4c5('0x66')](-0x1);if(_0xd1242a==='/'){_0x338e33=_0x338e33[_0xe4c5('0x67')](0x0,_0x338e33['lastIndexOf'](_0xd1242a));}return rp({'method':_0xe4c5('0x68'),'uri':util[_0xe4c5('0x69')](_0xe4c5('0x6a'),_0x338e33,_0xe4c5('0x6b')),'headers':{'Authorization':'Token\x20token='+_0x44da2d[_0xe4c5('0x6c')]},'json':!![]});}})['then'](function(_0x539139){if(_0x539139){var _0x3f14bd=_0x539139['users'];var _0x2635ed=![];var _0xf4ddcd=null;for(_0xf4ddcd=0x0;_0xf4ddcd<_0x3f14bd['length'];_0xf4ddcd++){if(_0x3f14bd[_0xf4ddcd][_0xe4c5('0x6d')]===_0x1ce853){_0x2635ed=!![];}}if(_0x2635ed){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x18feea,null))['catch'](function(_0x11a287){var _0x29733d=_0x287390[_0xe4c5('0x40')][_0xe4c5('0x1b')]?0x1f4:_0x11a287[_0xe4c5('0x6e')]||0x1f4;logger['error'](_0xe4c5('0x6f'),_0xe4c5('0x70'),_0x29733d,JSON['stringify'](_0x11a287));delete _0x11a287[_0xe4c5('0x36')];if(_0x29733d===0x191){_0x29733d=0x190;}_0x18feea[_0xe4c5('0x2a')](_0x29733d)[_0xe4c5('0x37')](_0x287390[_0xe4c5('0x40')][_0xe4c5('0x1b')]?{'message':_0xe4c5('0x71'),'statusCode':_0x11a287[_0xe4c5('0x6e')]}:_0x11a287);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 2a5017a..c788374 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 _0xa25d=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x20008b,_0x44aced){var _0x379c2d=function(_0x14385e){while(--_0x14385e){_0x20008b['push'](_0x20008b['shift']());}};_0x379c2d(++_0x44aced);}(_0xa25d,0x1b3));var _0xda25=function(_0x228394,_0x2bcb15){_0x228394=_0x228394-0x0;var _0x1f4a17=_0xa25d[_0x228394];return _0x1f4a17;};'use strict';var _=require(_0xda25('0x0'));var util=require(_0xda25('0x1'));var logger=require(_0xda25('0x2'))('api');var moment=require(_0xda25('0x3'));var BPromise=require(_0xda25('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda25('0x5'));var rimraf=require(_0xda25('0x6'));var config=require(_0xda25('0x7'));var attributes=require(_0xda25('0x8'));var integrations=require(_0xda25('0x9'));module['exports']=function(_0x682a21,_0x214c80){return _0x682a21[_0xda25('0xa')]('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x187c=['util','moment','bluebird','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash'];(function(_0xc45f3f,_0x325364){var _0x1f01e9=function(_0xb163c7){while(--_0xb163c7){_0xc45f3f['push'](_0xc45f3f['shift']());}};_0x1f01e9(++_0x325364);}(_0x187c,0x11d));var _0xc187=function(_0xcf7b9b,_0x1265c7){_0xcf7b9b=_0xcf7b9b-0x0;var _0x19d04f=_0x187c[_0xcf7b9b];return _0x19d04f;};'use strict';var _=require(_0xc187('0x0'));var util=require(_0xc187('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc187('0x2'));var BPromise=require(_0xc187('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc187('0x4'));var config=require(_0xc187('0x5'));var attributes=require(_0xc187('0x6'));var integrations=require(_0xc187('0x7'));module[_0xc187('0x8')]=function(_0x1e47d4,_0x2e6d12){return _0x1e47d4['define'](_0xc187('0x9'),attributes,{'tableName':_0xc187('0xa'),'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 dc05d95..a64f97f 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 _0x7292=['where','attributes','include','map','model','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw'];(function(_0x16d538,_0x412911){var _0x5bc072=function(_0x40e1c2){while(--_0x40e1c2){_0x16d538['push'](_0x16d538['shift']());}};_0x5bc072(++_0x412911);}(_0x7292,0x6d));var _0x2729=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x7292[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x2729('0x0'));var util=require(_0x2729('0x1'));var moment=require(_0x2729('0x2'));var BPromise=require(_0x2729('0x3'));var rs=require(_0x2729('0x4'));var fs=require('fs');var Redis=require(_0x2729('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2729('0x6'));var logger=require(_0x2729('0x7'))(_0x2729('0x8'));var config=require(_0x2729('0x9'));var jayson=require(_0x2729('0xa'));var client=jayson['client'][_0x2729('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e9245,_0x32c498,_0x15612c){return new BPromise(function(_0x3b4f90,_0x33d118){return client['request'](_0x3e9245,_0x15612c)[_0x2729('0xc')](function(_0x5b3014){logger[_0x2729('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x32c498,'request\x20sent');logger[_0x2729('0xe')](_0x2729('0xf'),_0x32c498,_0x2729('0x10'),JSON[_0x2729('0x11')](_0x5b3014));if(_0x5b3014[_0x2729('0x12')]){if(_0x5b3014[_0x2729('0x12')]['code']===0x1f4){logger['error'](_0x2729('0x13'),_0x32c498,_0x5b3014[_0x2729('0x12')][_0x2729('0x14')]);return _0x33d118(_0x5b3014['error']['message']);}logger[_0x2729('0x12')](_0x2729('0x13'),_0x32c498,_0x5b3014[_0x2729('0x12')]['message']);return _0x3b4f90(_0x5b3014[_0x2729('0x12')][_0x2729('0x14')]);}else{logger[_0x2729('0xd')](_0x2729('0x13'),_0x32c498,_0x2729('0x10'));_0x3b4f90(_0x5b3014['result'][_0x2729('0x14')]);}})[_0x2729('0x15')](function(_0x1a2333){logger[_0x2729('0x12')](_0x2729('0x13'),_0x32c498,_0x1a2333);_0x33d118(_0x1a2333);});});}exports[_0x2729('0x16')]=function(_0x2b5bad){var _0x418b89=this;return new Promise(function(_0x807abf,_0xe4dc1d){return db[_0x2729('0x17')][_0x2729('0x18')]({'raw':_0x2b5bad[_0x2729('0x19')]?_0x2b5bad[_0x2729('0x19')][_0x2729('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b5bad[_0x2729('0x19')]?_0x2b5bad[_0x2729('0x19')][_0x2729('0x1b')]||null:null,'attributes':_0x2b5bad[_0x2729('0x19')]?_0x2b5bad[_0x2729('0x19')][_0x2729('0x1c')]||null:null,'limit':_0x2b5bad[_0x2729('0x19')]?_0x2b5bad[_0x2729('0x19')]['limit']||null:null,'include':_0x2b5bad['options']?_0x2b5bad[_0x2729('0x19')][_0x2729('0x1d')]?_[_0x2729('0x1e')](_0x2b5bad[_0x2729('0x19')]['include'],function(_0x16d69f){return{'model':db[_0x16d69f['model']],'as':_0x16d69f['as'],'attributes':_0x16d69f[_0x2729('0x1c')],'include':_0x16d69f[_0x2729('0x1d')]?_[_0x2729('0x1e')](_0x16d69f['include'],function(_0x320de3){return{'model':db[_0x320de3['model']],'as':_0x320de3['as'],'attributes':_0x320de3[_0x2729('0x1c')],'include':_0x320de3['include']?_[_0x2729('0x1e')](_0x320de3[_0x2729('0x1d')],function(_0x56e64d){return{'model':db[_0x56e64d[_0x2729('0x1f')]],'as':_0x56e64d['as'],'attributes':_0x56e64d[_0x2729('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b40bd){logger[_0x2729('0xd')](_0x2729('0x16'),_0x2b5bad);logger[_0x2729('0xe')](_0x2729('0x16'),_0x2b5bad,JSON['stringify'](_0x5b40bd));_0x807abf(_0x5b40bd);})[_0x2729('0x15')](function(_0x23d7ed){logger[_0x2729('0x12')](_0x2729('0x16'),_0x23d7ed[_0x2729('0x14')],_0x2b5bad);_0xe4dc1d(_0x418b89[_0x2729('0x12')](0x1f4,_0x23d7ed[_0x2729('0x14')]));});});};exports[_0x2729('0x20')]=function(_0x16c700){var _0x38cbab=this;return new Promise(function(_0x5e122f,_0x4dd9e2){return db[_0x2729('0x17')][_0x2729('0x21')]({'raw':_0x16c700[_0x2729('0x19')]?_0x16c700['options']['raw']===undefined?!![]:![]:!![],'where':_0x16c700['options']?_0x16c700[_0x2729('0x19')][_0x2729('0x1b')]||null:null,'attributes':_0x16c700[_0x2729('0x19')]?_0x16c700['options'][_0x2729('0x1c')]||null:null,'include':_0x16c700[_0x2729('0x19')]?_0x16c700[_0x2729('0x19')][_0x2729('0x1d')]?_[_0x2729('0x1e')](_0x16c700['options'][_0x2729('0x1d')],function(_0x4aa819){return{'model':db[_0x4aa819[_0x2729('0x1f')]],'as':_0x4aa819['as'],'attributes':_0x4aa819[_0x2729('0x1c')],'include':_0x4aa819['include']?_['map'](_0x4aa819[_0x2729('0x1d')],function(_0x508efc){return{'model':db[_0x508efc['model']],'as':_0x508efc['as'],'attributes':_0x508efc['attributes'],'include':_0x508efc[_0x2729('0x1d')]?_[_0x2729('0x1e')](_0x508efc[_0x2729('0x1d')],function(_0x22fdbb){return{'model':db[_0x22fdbb[_0x2729('0x1f')]],'as':_0x22fdbb['as'],'attributes':_0x22fdbb[_0x2729('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2729('0xc')](function(_0x1fc20d){logger['info']('ShowFreshsalesAccount',_0x16c700);logger[_0x2729('0xe')](_0x2729('0x20'),_0x16c700,JSON['stringify'](_0x1fc20d));_0x5e122f(_0x1fc20d);})['catch'](function(_0x41fa5c){logger[_0x2729('0x12')](_0x2729('0x20'),_0x41fa5c[_0x2729('0x14')],_0x16c700);_0x4dd9e2(_0x38cbab[_0x2729('0x12')](0x1f4,_0x41fa5c[_0x2729('0x14')]));});});}; \ No newline at end of file +var _0x7fea=['FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','raw','options','where','attributes','limit','include','map','model','then','debug','stringify','ShowFreshsalesAccount','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x7fea,0x149));var _0xa7fe=function(_0xad9bc,_0x358088){_0xad9bc=_0xad9bc-0x0;var _0x3f6f2d=_0x7fea[_0xad9bc];return _0x3f6f2d;};'use strict';var _=require('lodash');var util=require(_0xa7fe('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa7fe('0x1'));var fs=require('fs');var Redis=require(_0xa7fe('0x2'));var db=require(_0xa7fe('0x3'))['db'];var utils=require(_0xa7fe('0x4'));var logger=require(_0xa7fe('0x5'))(_0xa7fe('0x6'));var config=require('../../config/environment');var jayson=require(_0xa7fe('0x7'));var client=jayson[_0xa7fe('0x8')][_0xa7fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1132f1,_0x45f967,_0x3597b0){return new BPromise(function(_0x4668f0,_0x3d9135){return client['request'](_0x1132f1,_0x3597b0)['then'](function(_0x1db10e){logger[_0xa7fe('0xa')](_0xa7fe('0xb'),_0x45f967,_0xa7fe('0xc'));logger['debug'](_0xa7fe('0xd'),_0x45f967,_0xa7fe('0xc'),JSON['stringify'](_0x1db10e));if(_0x1db10e[_0xa7fe('0xe')]){if(_0x1db10e['error'][_0xa7fe('0xf')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x45f967,_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);return _0x3d9135(_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);}logger[_0xa7fe('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x45f967,_0x1db10e['error'][_0xa7fe('0x10')]);return _0x4668f0(_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);}else{logger[_0xa7fe('0xa')](_0xa7fe('0xb'),_0x45f967,'request\x20sent');_0x4668f0(_0x1db10e[_0xa7fe('0x11')][_0xa7fe('0x10')]);}})[_0xa7fe('0x12')](function(_0x253293){logger[_0xa7fe('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x45f967,_0x253293);_0x3d9135(_0x253293);});});}exports[_0xa7fe('0x13')]=function(_0x1e4966){var _0x2bf8db=this;return new Promise(function(_0x2ef53c,_0x179b9e){return db[_0xa7fe('0x14')][_0xa7fe('0x15')]({'raw':_0x1e4966['options']?_0x1e4966['options'][_0xa7fe('0x16')]===undefined?!![]:![]:!![],'where':_0x1e4966[_0xa7fe('0x17')]?_0x1e4966[_0xa7fe('0x17')][_0xa7fe('0x18')]||null:null,'attributes':_0x1e4966[_0xa7fe('0x17')]?_0x1e4966[_0xa7fe('0x17')][_0xa7fe('0x19')]||null:null,'limit':_0x1e4966['options']?_0x1e4966[_0xa7fe('0x17')][_0xa7fe('0x1a')]||null:null,'include':_0x1e4966[_0xa7fe('0x17')]?_0x1e4966[_0xa7fe('0x17')][_0xa7fe('0x1b')]?_[_0xa7fe('0x1c')](_0x1e4966[_0xa7fe('0x17')][_0xa7fe('0x1b')],function(_0x4ac7e0){return{'model':db[_0x4ac7e0[_0xa7fe('0x1d')]],'as':_0x4ac7e0['as'],'attributes':_0x4ac7e0['attributes'],'include':_0x4ac7e0['include']?_[_0xa7fe('0x1c')](_0x4ac7e0[_0xa7fe('0x1b')],function(_0x24ec1b){return{'model':db[_0x24ec1b[_0xa7fe('0x1d')]],'as':_0x24ec1b['as'],'attributes':_0x24ec1b[_0xa7fe('0x19')],'include':_0x24ec1b['include']?_[_0xa7fe('0x1c')](_0x24ec1b[_0xa7fe('0x1b')],function(_0xa3fde9){return{'model':db[_0xa3fde9[_0xa7fe('0x1d')]],'as':_0xa3fde9['as'],'attributes':_0xa3fde9[_0xa7fe('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa7fe('0x1e')](function(_0x11aff3){logger[_0xa7fe('0xa')](_0xa7fe('0x13'),_0x1e4966);logger[_0xa7fe('0x1f')](_0xa7fe('0x13'),_0x1e4966,JSON[_0xa7fe('0x20')](_0x11aff3));_0x2ef53c(_0x11aff3);})[_0xa7fe('0x12')](function(_0x42ca9d){logger[_0xa7fe('0xe')](_0xa7fe('0x13'),_0x42ca9d[_0xa7fe('0x10')],_0x1e4966);_0x179b9e(_0x2bf8db[_0xa7fe('0xe')](0x1f4,_0x42ca9d[_0xa7fe('0x10')]));});});};exports[_0xa7fe('0x21')]=function(_0x5bd01d){var _0x3f900a=this;return new Promise(function(_0x3198f9,_0x5bde8b){return db['FreshsalesAccount']['find']({'raw':_0x5bd01d[_0xa7fe('0x17')]?_0x5bd01d[_0xa7fe('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5bd01d[_0xa7fe('0x17')]?_0x5bd01d[_0xa7fe('0x17')][_0xa7fe('0x18')]||null:null,'attributes':_0x5bd01d[_0xa7fe('0x17')]?_0x5bd01d[_0xa7fe('0x17')][_0xa7fe('0x19')]||null:null,'include':_0x5bd01d[_0xa7fe('0x17')]?_0x5bd01d[_0xa7fe('0x17')][_0xa7fe('0x1b')]?_['map'](_0x5bd01d[_0xa7fe('0x17')]['include'],function(_0x279f57){return{'model':db[_0x279f57[_0xa7fe('0x1d')]],'as':_0x279f57['as'],'attributes':_0x279f57[_0xa7fe('0x19')],'include':_0x279f57['include']?_[_0xa7fe('0x1c')](_0x279f57[_0xa7fe('0x1b')],function(_0x1618e1){return{'model':db[_0x1618e1[_0xa7fe('0x1d')]],'as':_0x1618e1['as'],'attributes':_0x1618e1['attributes'],'include':_0x1618e1[_0xa7fe('0x1b')]?_[_0xa7fe('0x1c')](_0x1618e1['include'],function(_0x1d4b04){return{'model':db[_0x1d4b04[_0xa7fe('0x1d')]],'as':_0x1d4b04['as'],'attributes':_0x1d4b04[_0xa7fe('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa7fe('0x1e')](function(_0xe730b){logger[_0xa7fe('0xa')](_0xa7fe('0x21'),_0x5bd01d);logger[_0xa7fe('0x1f')](_0xa7fe('0x21'),_0x5bd01d,JSON[_0xa7fe('0x20')](_0xe730b));_0x3198f9(_0xe730b);})[_0xa7fe('0x12')](function(_0x36897b){logger[_0xa7fe('0xe')](_0xa7fe('0x21'),_0x36897b[_0xa7fe('0x10')],_0x5bd01d);_0x5bde8b(_0x3f900a[_0xa7fe('0xe')](0x1f4,_0x36897b['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 093e7b2..fe34446 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 _0xc2fc=['/:id/descriptions','getDescriptions','/:id/fields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show'];(function(_0x26e6d8,_0x108ccd){var _0x1d3224=function(_0x3edab5){while(--_0x3edab5){_0x26e6d8['push'](_0x26e6d8['shift']());}};_0x1d3224(++_0x108ccd);}(_0xc2fc,0x16a));var _0xcc2f=function(_0x59f261,_0x4eb1a5){_0x59f261=_0x59f261-0x0;var _0x3c0e46=_0xc2fc[_0x59f261];return _0x3c0e46;};'use strict';var multer=require(_0xcc2f('0x0'));var util=require(_0xcc2f('0x1'));var path=require(_0xcc2f('0x2'));var timeout=require(_0xcc2f('0x3'));var express=require('express');var router=express[_0xcc2f('0x4')]();var auth=require(_0xcc2f('0x5'));var interaction=require(_0xcc2f('0x6'));var config=require(_0xcc2f('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0xcc2f('0x8')](),controller['index']);router[_0xcc2f('0x9')](_0xcc2f('0xa'),auth['isAuthenticated'](),controller[_0xcc2f('0xb')]);router['get']('/:id/subjects',auth[_0xcc2f('0x8')](),controller['getSubjects']);router[_0xcc2f('0x9')](_0xcc2f('0xc'),auth[_0xcc2f('0x8')](),controller[_0xcc2f('0xd')]);router[_0xcc2f('0x9')](_0xcc2f('0xe'),auth[_0xcc2f('0x8')](),controller['getFields']);router[_0xcc2f('0xf')]('/',auth[_0xcc2f('0x8')](),controller[_0xcc2f('0x10')]);router[_0xcc2f('0x11')](_0xcc2f('0xa'),auth['isAuthenticated'](),controller[_0xcc2f('0x12')]);router[_0xcc2f('0x13')](_0xcc2f('0xa'),auth[_0xcc2f('0x8')](),controller[_0xcc2f('0x14')]);module[_0xcc2f('0x15')]=router; \ No newline at end of file +var _0xcc7d=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x6fe62,_0x3ba41b){var _0x3e289b=function(_0x3d2861){while(--_0x3d2861){_0x6fe62['push'](_0x6fe62['shift']());}};_0x3e289b(++_0x3ba41b);}(_0xcc7d,0x1ae));var _0xdcc7=function(_0x23f853,_0xd4d98e){_0x23f853=_0x23f853-0x0;var _0x49b09=_0xcc7d[_0x23f853];return _0x49b09;};'use strict';var multer=require(_0xdcc7('0x0'));var util=require(_0xdcc7('0x1'));var path=require('path');var timeout=require(_0xdcc7('0x2'));var express=require(_0xdcc7('0x3'));var router=express[_0xdcc7('0x4')]();var auth=require(_0xdcc7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdcc7('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xdcc7('0x7')]('/',auth[_0xdcc7('0x8')](),controller[_0xdcc7('0x9')]);router[_0xdcc7('0x7')]('/:id',auth[_0xdcc7('0x8')](),controller['show']);router[_0xdcc7('0x7')](_0xdcc7('0xa'),auth[_0xdcc7('0x8')](),controller[_0xdcc7('0xb')]);router[_0xdcc7('0x7')](_0xdcc7('0xc'),auth[_0xdcc7('0x8')](),controller[_0xdcc7('0xd')]);router['get'](_0xdcc7('0xe'),auth[_0xdcc7('0x8')](),controller[_0xdcc7('0xf')]);router[_0xdcc7('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdcc7('0x11')](_0xdcc7('0x12'),auth['isAuthenticated'](),controller[_0xdcc7('0x13')]);router[_0xdcc7('0x14')](_0xdcc7('0x12'),auth[_0xdcc7('0x8')](),controller[_0xdcc7('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 1e07876..f8182d6 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 _0x3bed=['STRING','sequelize','exports'];(function(_0x39a621,_0xc278b4){var _0x470c4a=function(_0x317c91){while(--_0x317c91){_0x39a621['push'](_0x39a621['shift']());}};_0x470c4a(++_0xc278b4);}(_0x3bed,0x73));var _0xd3be=function(_0xe3a359,_0x1b143b){_0xe3a359=_0xe3a359-0x0;var _0x847253=_0x3bed[_0xe3a359];return _0x847253;};'use strict';var Sequelize=require(_0xd3be('0x0'));module[_0xd3be('0x1')]={'name':{'type':Sequelize[_0xd3be('0x2')]},'description':{'type':Sequelize[_0xd3be('0x2')]}}; \ No newline at end of file +var _0x01b1=['sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x01b1,0xf9));var _0x101b=function(_0x441d65,_0x566c1f){_0x441d65=_0x441d65-0x0;var _0x2d05da=_0x01b1[_0x441d65];return _0x2d05da;};'use strict';var Sequelize=require(_0x101b('0x0'));module[_0x101b('0x1')]={'name':{'type':Sequelize[_0x101b('0x2')]},'description':{'type':Sequelize[_0x101b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 9a40983..ea20bd4 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 _0xfb65=['index','map','FreshsalesConfiguration','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','getSubjects','nolimit','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','apply','reject','update','destroy','name','send'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0xfb65,0x82));var _0x5fb6=function(_0x242a98,_0x13988e){_0x242a98=_0x242a98-0x0;var _0x580999=_0xfb65[_0x242a98];return _0x580999;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5fb6('0x0'));var rimraf=require(_0x5fb6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5fb6('0x2'));var rp=require('request-promise');var moment=require(_0x5fb6('0x3'));var BPromise=require(_0x5fb6('0x4'));var Mustache=require(_0x5fb6('0x5'));var util=require(_0x5fb6('0x6'));var path=require(_0x5fb6('0x7'));var sox=require(_0x5fb6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5fb6('0x9'));var squel=require(_0x5fb6('0xa'));var crypto=require(_0x5fb6('0xb'));var jsforce=require(_0x5fb6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5fb6('0xd'));var querystring=require(_0x5fb6('0xe'));var Papa=require(_0x5fb6('0xf'));var Redis=require(_0x5fb6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5fb6('0x11'));var as=require(_0x5fb6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fb6('0x13'))(_0x5fb6('0x14'));var utils=require(_0x5fb6('0x15'));var config=require(_0x5fb6('0x16'));var db=require(_0x5fb6('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5fb6('0x18')][_0x5fb6('0x19')]({'port':0x232a});function checkPasswordPattern(_0x42285b,_0x41d503,_0x6b58a2){if(_0x6b58a2){var _0x1bab1f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1bab1f[_0x5fb6('0x1a')](_0x41d503)){return _0x42285b;}else{throw new db[(_0x5fb6('0x1b'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x42285b;}}function respondWithRpcPromise(_0x46f1cf,_0xfaea56,_0x58febe,_0x1d57b1){return new BPromise(function(_0x21ddd3,_0x11bb78){var _0x5d71c0=_0x1d57b1||client;return _0x5d71c0[_0x5fb6('0x1c')](_0x46f1cf,_0x58febe)[_0x5fb6('0x1d')](function(_0x27bd8b){logger[_0x5fb6('0x1e')](_0x5fb6('0x1f'),_0xfaea56,_0x5fb6('0x20'));logger['debug'](_0x5fb6('0x21'),_0xfaea56,'request\x20sent',JSON[_0x5fb6('0x22')](_0x27bd8b));if(_0x27bd8b['error']){if(_0x27bd8b[_0x5fb6('0x23')][_0x5fb6('0x24')]===0x1f4){logger[_0x5fb6('0x23')](_0x5fb6('0x1f'),_0xfaea56,_0x27bd8b[_0x5fb6('0x23')][_0x5fb6('0x25')]);return _0x11bb78(_0x27bd8b[_0x5fb6('0x23')]['message']);}logger['error'](_0x5fb6('0x1f'),_0xfaea56,_0x27bd8b[_0x5fb6('0x23')]['message']);return _0x21ddd3(_0x27bd8b[_0x5fb6('0x23')][_0x5fb6('0x25')]);}else{logger[_0x5fb6('0x1e')](_0x5fb6('0x1f'),_0xfaea56,'request\x20sent');_0x21ddd3(_0x27bd8b[_0x5fb6('0x26')][_0x5fb6('0x25')]);}})[_0x5fb6('0x27')](function(_0x20de69){logger[_0x5fb6('0x23')](_0x5fb6('0x1f'),_0xfaea56,_0x20de69);_0x11bb78(_0x20de69);});});}function respondWithStatusCode(_0x4e2bff,_0x4cbdaf){_0x4cbdaf=_0x4cbdaf||0xcc;return function(_0x298b44){if(_0x298b44){return _0x4e2bff[_0x5fb6('0x28')](_0x4cbdaf);}return _0x4e2bff[_0x5fb6('0x29')](_0x4cbdaf)[_0x5fb6('0x2a')]();};}function respondWithResult(_0x2731a3,_0x1c3b0f){_0x1c3b0f=_0x1c3b0f||0xc8;return function(_0x36ac58){if(_0x36ac58){return _0x2731a3['status'](_0x1c3b0f)[_0x5fb6('0x2b')](_0x36ac58);}};}function respondWithFilteredResult(_0x3f9b86,_0xac9a34){return function(_0x5a1f0d){if(_0x5a1f0d){var _0x2afc08=_0x5a1f0d[_0x5fb6('0x2c')],_0x1b4ae4=_0xac9a34['offset'],_0x49a828=_0xac9a34[_0x5fb6('0x2d')]+_0xac9a34['limit'],_0x218428;if(_0x49a828>=_0x2afc08){_0x49a828=_0x2afc08;_0x218428=0xc8;}else{_0x218428=0xce;}_0x3f9b86[_0x5fb6('0x29')](_0x218428);return _0x3f9b86['set']('Content-Range',_0x1b4ae4+'-'+_0x49a828+'/'+_0x2afc08)[_0x5fb6('0x2b')](_0x5a1f0d);}return null;};}function patchUpdates(_0x30bc6c){return function(_0x3199d4){try{jsonpatch[_0x5fb6('0x2e')](_0x3199d4,_0x30bc6c,!![]);}catch(_0x36fc09){return BPromise[_0x5fb6('0x2f')](_0x36fc09);}return _0x3199d4['save']();};}function saveUpdates(_0x1db4ac,_0x39569e){return function(_0x11b2d1){if(_0x11b2d1){return _0x11b2d1[_0x5fb6('0x30')](_0x1db4ac)[_0x5fb6('0x1d')](function(_0x407d86){return _0x407d86;});}return null;};}function removeEntity(_0x238a37,_0xf78e09){return function(_0x396e72){if(_0x396e72){return _0x396e72[_0x5fb6('0x31')]()[_0x5fb6('0x1d')](function(){_0x238a37['status'](0xcc)[_0x5fb6('0x2a')]();});}};}function handleEntityNotFound(_0x1aa02b,_0x5acfe6){return function(_0x3ca41f){if(!_0x3ca41f){_0x1aa02b['sendStatus'](0x194);}return _0x3ca41f;};}function handleError(_0x5b155c,_0x27eb44){_0x27eb44=_0x27eb44||0x1f4;return function(_0x1fc7c9){logger[_0x5fb6('0x23')](_0x1fc7c9['stack']);if(_0x1fc7c9[_0x5fb6('0x32')]){delete _0x1fc7c9['name'];}_0x5b155c['status'](_0x27eb44)[_0x5fb6('0x33')](_0x1fc7c9);};}exports[_0x5fb6('0x34')]=function(_0x1b4709,_0x1d0e01){var _0x18b905={},_0x1b96c0={},_0x3a6f88={'count':0x0,'rows':[]};var _0x236e4e=_[_0x5fb6('0x35')](db[_0x5fb6('0x36')][_0x5fb6('0x37')],function(_0x6bfdc2){return{'name':_0x6bfdc2['fieldName'],'type':_0x6bfdc2[_0x5fb6('0x38')][_0x5fb6('0x39')]};});_0x1b96c0[_0x5fb6('0x3a')]=_['map'](_0x236e4e,_0x5fb6('0x32'));_0x1b96c0['query']=_[_0x5fb6('0x3b')](_0x1b4709['query']);_0x1b96c0[_0x5fb6('0x3c')]=_[_0x5fb6('0x3d')](_0x1b96c0[_0x5fb6('0x3a')],_0x1b96c0[_0x5fb6('0x3e')]);_0x18b905[_0x5fb6('0x3f')]=_['intersection'](_0x1b96c0[_0x5fb6('0x3a')],qs[_0x5fb6('0x40')](_0x1b4709[_0x5fb6('0x3e')][_0x5fb6('0x40')]));_0x18b905['attributes']=_0x18b905[_0x5fb6('0x3f')][_0x5fb6('0x41')]?_0x18b905[_0x5fb6('0x3f')]:_0x1b96c0[_0x5fb6('0x3a')];if(!_0x1b4709[_0x5fb6('0x3e')][_0x5fb6('0x42')]('nolimit')){_0x18b905[_0x5fb6('0x43')]=qs[_0x5fb6('0x43')](_0x1b4709[_0x5fb6('0x3e')][_0x5fb6('0x43')]);_0x18b905[_0x5fb6('0x2d')]=qs[_0x5fb6('0x2d')](_0x1b4709[_0x5fb6('0x3e')][_0x5fb6('0x2d')]);}_0x18b905[_0x5fb6('0x44')]=qs[_0x5fb6('0x45')](_0x1b4709[_0x5fb6('0x3e')]['sort']);_0x18b905[_0x5fb6('0x46')]=qs['filters'](_[_0x5fb6('0x47')](_0x1b4709[_0x5fb6('0x3e')],_0x1b96c0['filters']));if(_0x1b4709[_0x5fb6('0x3e')][_0x5fb6('0x48')]){_0x18b905[_0x5fb6('0x46')]=_['merge'](_0x18b905['where'],{'$or':_[_0x5fb6('0x35')](_0x236e4e,function(_0x777235){if(_0x777235[_0x5fb6('0x38')]!==_0x5fb6('0x49')){var _0x43b442={};_0x43b442[_0x777235[_0x5fb6('0x32')]]={'$like':'%'+_0x1b4709[_0x5fb6('0x3e')][_0x5fb6('0x48')]+'%'};return _0x43b442;}})});}_0x18b905=_[_0x5fb6('0x4a')]({},_0x18b905,_0x1b4709[_0x5fb6('0x4b')]);var _0xb32da8={'where':_0x18b905['where']};return db[_0x5fb6('0x36')]['count'](_0xb32da8)['then'](function(_0x2d8b10){_0x3a6f88[_0x5fb6('0x2c')]=_0x2d8b10;if(_0x1b4709[_0x5fb6('0x3e')][_0x5fb6('0x4c')]){_0x18b905[_0x5fb6('0x4d')]=[{'all':!![]}];}return db[_0x5fb6('0x36')][_0x5fb6('0x4e')](_0x18b905);})['then'](function(_0x3c29b4){_0x3a6f88[_0x5fb6('0x4f')]=_0x3c29b4;return _0x3a6f88;})['then'](respondWithFilteredResult(_0x1d0e01,_0x18b905))[_0x5fb6('0x27')](handleError(_0x1d0e01,null));};exports[_0x5fb6('0x50')]=function(_0x1d6188,_0x3fc547){var _0x3b508a={'raw':![],'where':{'id':_0x1d6188[_0x5fb6('0x51')]['id']}},_0x136a54={};_0x136a54[_0x5fb6('0x3a')]=_['keys'](db[_0x5fb6('0x36')][_0x5fb6('0x37')]);_0x136a54['query']=_[_0x5fb6('0x3b')](_0x1d6188[_0x5fb6('0x3e')]);_0x136a54[_0x5fb6('0x3c')]=_[_0x5fb6('0x3d')](_0x136a54['model'],_0x136a54['query']);_0x3b508a[_0x5fb6('0x3f')]=_[_0x5fb6('0x3d')](_0x136a54[_0x5fb6('0x3a')],qs['fields'](_0x1d6188[_0x5fb6('0x3e')]['fields']));_0x3b508a[_0x5fb6('0x3f')]=_0x3b508a['attributes'][_0x5fb6('0x41')]?_0x3b508a[_0x5fb6('0x3f')]:_0x136a54[_0x5fb6('0x3a')];if(_0x1d6188['query'][_0x5fb6('0x4c')]){_0x3b508a[_0x5fb6('0x4d')]=[{'all':!![]}];}_0x3b508a=_[_0x5fb6('0x4a')]({},_0x3b508a,_0x1d6188[_0x5fb6('0x4b')]);return db[_0x5fb6('0x36')][_0x5fb6('0x52')](_0x3b508a)[_0x5fb6('0x1d')](handleEntityNotFound(_0x3fc547,null))[_0x5fb6('0x1d')](respondWithResult(_0x3fc547,null))[_0x5fb6('0x27')](handleError(_0x3fc547,null));};exports[_0x5fb6('0x53')]=function(_0xff6370,_0x4ae2fb){return db[_0x5fb6('0x36')]['create'](_0xff6370[_0x5fb6('0x54')],{})[_0x5fb6('0x1d')](respondWithResult(_0x4ae2fb,0xc9))[_0x5fb6('0x27')](handleError(_0x4ae2fb,null));};exports[_0x5fb6('0x30')]=function(_0x43b602,_0x2e74d0){if(_0x43b602['body']['id']){delete _0x43b602['body']['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x43b602[_0x5fb6('0x51')]['id']}})[_0x5fb6('0x1d')](handleEntityNotFound(_0x2e74d0,null))[_0x5fb6('0x1d')](saveUpdates(_0x43b602[_0x5fb6('0x54')],null))['then'](respondWithResult(_0x2e74d0,null))[_0x5fb6('0x27')](handleError(_0x2e74d0,null));};exports[_0x5fb6('0x31')]=function(_0x568f98,_0xbd31ab){return db['FreshsalesConfiguration'][_0x5fb6('0x52')]({'where':{'id':_0x568f98[_0x5fb6('0x51')]['id']}})['then'](handleEntityNotFound(_0xbd31ab,null))[_0x5fb6('0x1d')](removeEntity(_0xbd31ab,null))[_0x5fb6('0x27')](handleError(_0xbd31ab,null));};exports[_0x5fb6('0x55')]=function(_0x4da260,_0x300225,_0x3b3f98){var _0x27ae23={};var _0x3b154b={};var _0x1a90a7;var _0x3d05c2;return db[_0x5fb6('0x36')]['findOne']({'where':{'id':_0x4da260[_0x5fb6('0x51')]['id']}})[_0x5fb6('0x1d')](handleEntityNotFound(_0x300225,null))[_0x5fb6('0x1d')](function(_0x327c16){if(_0x327c16){_0x1a90a7=_0x327c16;_0x3b154b[_0x5fb6('0x3a')]=_[_0x5fb6('0x3b')](db['FreshsalesField'][_0x5fb6('0x37')]);_0x3b154b['query']=_[_0x5fb6('0x3b')](_0x4da260[_0x5fb6('0x3e')]);_0x3b154b[_0x5fb6('0x3c')]=_[_0x5fb6('0x3d')](_0x3b154b[_0x5fb6('0x3a')],_0x3b154b[_0x5fb6('0x3e')]);_0x27ae23[_0x5fb6('0x3f')]=_[_0x5fb6('0x3d')](_0x3b154b['model'],qs['fields'](_0x4da260[_0x5fb6('0x3e')][_0x5fb6('0x40')]));_0x27ae23[_0x5fb6('0x3f')]=_0x27ae23[_0x5fb6('0x3f')]['length']?_0x27ae23['attributes']:_0x3b154b[_0x5fb6('0x3a')];_0x27ae23['order']=qs['sort'](_0x4da260[_0x5fb6('0x3e')][_0x5fb6('0x45')]);_0x27ae23[_0x5fb6('0x46')]=qs[_0x5fb6('0x3c')](_[_0x5fb6('0x47')](_0x4da260['query'],_0x3b154b[_0x5fb6('0x3c')]));if(_0x4da260['query'][_0x5fb6('0x48')]){_0x27ae23[_0x5fb6('0x46')]=_[_0x5fb6('0x4a')](_0x27ae23[_0x5fb6('0x46')],{'$or':_[_0x5fb6('0x35')](_0x27ae23[_0x5fb6('0x3f')],function(_0x4c1f69){var _0x87a269={};_0x87a269[_0x4c1f69]={'$like':'%'+_0x4da260[_0x5fb6('0x3e')][_0x5fb6('0x48')]+'%'};return _0x87a269;})});}_0x27ae23=_['merge']({},_0x27ae23,_0x4da260['options']);return _0x1a90a7['getSubjects'](_0x27ae23);}})[_0x5fb6('0x1d')](function(_0x53d281){if(_0x53d281){_0x3d05c2=_0x53d281[_0x5fb6('0x41')];if(!_0x4da260[_0x5fb6('0x3e')][_0x5fb6('0x42')](_0x5fb6('0x56'))){_0x27ae23[_0x5fb6('0x43')]=qs['limit'](_0x4da260[_0x5fb6('0x3e')][_0x5fb6('0x43')]);_0x27ae23[_0x5fb6('0x2d')]=qs[_0x5fb6('0x2d')](_0x4da260[_0x5fb6('0x3e')]['offset']);}return _0x1a90a7['getSubjects'](_0x27ae23);}})[_0x5fb6('0x1d')](function(_0x547006){if(_0x547006){return _0x547006?{'count':_0x3d05c2,'rows':_0x547006}:null;}})['then'](respondWithResult(_0x300225,null))[_0x5fb6('0x27')](handleError(_0x300225,null));};exports['getDescriptions']=function(_0x4e01ab,_0x5bbca4,_0x4683fb){var _0x5b95b2={};var _0x11ec8a={};var _0x39e103;var _0x284e09;return db[_0x5fb6('0x36')][_0x5fb6('0x57')]({'where':{'id':_0x4e01ab[_0x5fb6('0x51')]['id']}})[_0x5fb6('0x1d')](handleEntityNotFound(_0x5bbca4,null))[_0x5fb6('0x1d')](function(_0x2a081b){if(_0x2a081b){_0x39e103=_0x2a081b;_0x11ec8a[_0x5fb6('0x3a')]=_[_0x5fb6('0x3b')](db[_0x5fb6('0x58')][_0x5fb6('0x37')]);_0x11ec8a[_0x5fb6('0x3e')]=_[_0x5fb6('0x3b')](_0x4e01ab[_0x5fb6('0x3e')]);_0x11ec8a['filters']=_['intersection'](_0x11ec8a[_0x5fb6('0x3a')],_0x11ec8a['query']);_0x5b95b2['attributes']=_[_0x5fb6('0x3d')](_0x11ec8a[_0x5fb6('0x3a')],qs['fields'](_0x4e01ab[_0x5fb6('0x3e')][_0x5fb6('0x40')]));_0x5b95b2[_0x5fb6('0x3f')]=_0x5b95b2['attributes'][_0x5fb6('0x41')]?_0x5b95b2[_0x5fb6('0x3f')]:_0x11ec8a[_0x5fb6('0x3a')];_0x5b95b2[_0x5fb6('0x44')]=qs[_0x5fb6('0x45')](_0x4e01ab['query']['sort']);_0x5b95b2['where']=qs[_0x5fb6('0x3c')](_[_0x5fb6('0x47')](_0x4e01ab[_0x5fb6('0x3e')],_0x11ec8a[_0x5fb6('0x3c')]));if(_0x4e01ab[_0x5fb6('0x3e')][_0x5fb6('0x48')]){_0x5b95b2[_0x5fb6('0x46')]=_[_0x5fb6('0x4a')](_0x5b95b2[_0x5fb6('0x46')],{'$or':_[_0x5fb6('0x35')](_0x5b95b2[_0x5fb6('0x3f')],function(_0x502646){var _0x52f576={};_0x52f576[_0x502646]={'$like':'%'+_0x4e01ab['query'][_0x5fb6('0x48')]+'%'};return _0x52f576;})});}_0x5b95b2=_[_0x5fb6('0x4a')]({},_0x5b95b2,_0x4e01ab[_0x5fb6('0x4b')]);return _0x39e103[_0x5fb6('0x59')](_0x5b95b2);}})[_0x5fb6('0x1d')](function(_0x5bd17e){if(_0x5bd17e){_0x284e09=_0x5bd17e[_0x5fb6('0x41')];if(!_0x4e01ab['query'][_0x5fb6('0x42')](_0x5fb6('0x56'))){_0x5b95b2['limit']=qs[_0x5fb6('0x43')](_0x4e01ab['query'][_0x5fb6('0x43')]);_0x5b95b2[_0x5fb6('0x2d')]=qs[_0x5fb6('0x2d')](_0x4e01ab[_0x5fb6('0x3e')]['offset']);}return _0x39e103[_0x5fb6('0x59')](_0x5b95b2);}})[_0x5fb6('0x1d')](function(_0x34a69a){if(_0x34a69a){return _0x34a69a?{'count':_0x284e09,'rows':_0x34a69a}:null;}})[_0x5fb6('0x1d')](respondWithResult(_0x5bbca4,null))[_0x5fb6('0x27')](handleError(_0x5bbca4,null));};exports[_0x5fb6('0x5a')]=function(_0x1394db,_0x34e91e,_0x31c297){var _0x39d738={};var _0x2809a2={};var _0x7871be;var _0x56276c;return db[_0x5fb6('0x36')][_0x5fb6('0x57')]({'where':{'id':_0x1394db[_0x5fb6('0x51')]['id']}})[_0x5fb6('0x1d')](handleEntityNotFound(_0x34e91e,null))[_0x5fb6('0x1d')](function(_0x4a3c8b){if(_0x4a3c8b){_0x7871be=_0x4a3c8b;_0x2809a2[_0x5fb6('0x3a')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x2809a2[_0x5fb6('0x3e')]=_[_0x5fb6('0x3b')](_0x1394db[_0x5fb6('0x3e')]);_0x2809a2['filters']=_[_0x5fb6('0x3d')](_0x2809a2['model'],_0x2809a2['query']);_0x39d738[_0x5fb6('0x3f')]=_[_0x5fb6('0x3d')](_0x2809a2[_0x5fb6('0x3a')],qs[_0x5fb6('0x40')](_0x1394db[_0x5fb6('0x3e')][_0x5fb6('0x40')]));_0x39d738[_0x5fb6('0x3f')]=_0x39d738[_0x5fb6('0x3f')][_0x5fb6('0x41')]?_0x39d738[_0x5fb6('0x3f')]:_0x2809a2['model'];_0x39d738['order']=qs[_0x5fb6('0x45')](_0x1394db[_0x5fb6('0x3e')][_0x5fb6('0x45')]);_0x39d738[_0x5fb6('0x46')]=qs[_0x5fb6('0x3c')](_[_0x5fb6('0x47')](_0x1394db[_0x5fb6('0x3e')],_0x2809a2[_0x5fb6('0x3c')]));if(_0x1394db[_0x5fb6('0x3e')][_0x5fb6('0x48')]){_0x39d738[_0x5fb6('0x46')]=_[_0x5fb6('0x4a')](_0x39d738[_0x5fb6('0x46')],{'$or':_[_0x5fb6('0x35')](_0x39d738[_0x5fb6('0x3f')],function(_0x498b66){var _0x4dd7af={};_0x4dd7af[_0x498b66]={'$like':'%'+_0x1394db['query'][_0x5fb6('0x48')]+'%'};return _0x4dd7af;})});}_0x39d738=_[_0x5fb6('0x4a')]({},_0x39d738,_0x1394db[_0x5fb6('0x4b')]);return _0x7871be[_0x5fb6('0x5a')](_0x39d738);}})[_0x5fb6('0x1d')](function(_0x4b1f02){if(_0x4b1f02){_0x56276c=_0x4b1f02[_0x5fb6('0x41')];if(!_0x1394db[_0x5fb6('0x3e')]['hasOwnProperty'](_0x5fb6('0x56'))){_0x39d738[_0x5fb6('0x43')]=qs[_0x5fb6('0x43')](_0x1394db[_0x5fb6('0x3e')][_0x5fb6('0x43')]);_0x39d738[_0x5fb6('0x2d')]=qs[_0x5fb6('0x2d')](_0x1394db[_0x5fb6('0x3e')][_0x5fb6('0x2d')]);}return _0x7871be['getFields'](_0x39d738);}})[_0x5fb6('0x1d')](function(_0x355887){if(_0x355887){return _0x355887?{'count':_0x56276c,'rows':_0x355887}:null;}})['then'](respondWithResult(_0x34e91e,null))[_0x5fb6('0x27')](handleError(_0x34e91e,null));}; \ No newline at end of file +var _0x6d19=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','nolimit','limit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','getSubjects','findOne','FreshsalesField','pick','hasOwnProperty','getDescriptions','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x21eaa9,_0x5dc7c6){var _0x3c34e7=function(_0x403915){while(--_0x403915){_0x21eaa9['push'](_0x21eaa9['shift']());}};_0x3c34e7(++_0x5dc7c6);}(_0x6d19,0x160));var _0x96d1=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x6d19[_0x8c43de];return _0xa6591b;};'use strict';var pdf=require(_0x96d1('0x0'));var emlformat=require(_0x96d1('0x1'));var rimraf=require(_0x96d1('0x2'));var zipdir=require(_0x96d1('0x3'));var jsonpatch=require(_0x96d1('0x4'));var rp=require(_0x96d1('0x5'));var moment=require(_0x96d1('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x96d1('0x7'));var util=require(_0x96d1('0x8'));var path=require(_0x96d1('0x9'));var sox=require(_0x96d1('0xa'));var csv=require('to-csv');var ejs=require(_0x96d1('0xb'));var fs=require('fs');var _=require(_0x96d1('0xc'));var squel=require(_0x96d1('0xd'));var crypto=require('crypto');var jsforce=require(_0x96d1('0xe'));var deskjs=require(_0x96d1('0xf'));var toCsv=require(_0x96d1('0x10'));var querystring=require(_0x96d1('0x11'));var Papa=require(_0x96d1('0x12'));var Redis=require(_0x96d1('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x96d1('0x14'));var hardwareService=require(_0x96d1('0x15'));var logger=require('../../config/logger')(_0x96d1('0x16'));var utils=require('../../config/utils');var config=require(_0x96d1('0x17'));var db=require(_0x96d1('0x18'))['db'];var jayson=require(_0x96d1('0x19'));var client=jayson[_0x96d1('0x1a')][_0x96d1('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x673a11,_0x4f6657,_0x35e728){if(_0x35e728){var _0xd63104=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd63104[_0x96d1('0x1c')](_0x4f6657)){return _0x673a11;}else{throw new db[(_0x96d1('0x1d'))][(_0x96d1('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x673a11;}}function respondWithRpcPromise(_0x52e614,_0x2e4cf5,_0x446023,_0x21d7a4){return new BPromise(function(_0x9eb2c4,_0x2d521d){var _0x3e9a0=_0x21d7a4||client;return _0x3e9a0[_0x96d1('0x1f')](_0x52e614,_0x446023)[_0x96d1('0x20')](function(_0x913482){logger['info'](_0x96d1('0x21'),_0x2e4cf5,_0x96d1('0x22'));logger[_0x96d1('0x23')](_0x96d1('0x24'),_0x2e4cf5,_0x96d1('0x22'),JSON['stringify'](_0x913482));if(_0x913482[_0x96d1('0x25')]){if(_0x913482[_0x96d1('0x25')][_0x96d1('0x26')]===0x1f4){logger[_0x96d1('0x25')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2e4cf5,_0x913482[_0x96d1('0x25')][_0x96d1('0x27')]);return _0x2d521d(_0x913482[_0x96d1('0x25')][_0x96d1('0x27')]);}logger['error'](_0x96d1('0x21'),_0x2e4cf5,_0x913482[_0x96d1('0x25')][_0x96d1('0x27')]);return _0x9eb2c4(_0x913482[_0x96d1('0x25')]['message']);}else{logger[_0x96d1('0x28')](_0x96d1('0x21'),_0x2e4cf5,'request\x20sent');_0x9eb2c4(_0x913482[_0x96d1('0x29')][_0x96d1('0x27')]);}})['catch'](function(_0x1130ba){logger[_0x96d1('0x25')](_0x96d1('0x21'),_0x2e4cf5,_0x1130ba);_0x2d521d(_0x1130ba);});});}function respondWithStatusCode(_0x5462ec,_0x424d1e){_0x424d1e=_0x424d1e||0xcc;return function(_0x46aa64){if(_0x46aa64){return _0x5462ec[_0x96d1('0x2a')](_0x424d1e);}return _0x5462ec['status'](_0x424d1e)['end']();};}function respondWithResult(_0xd88eb7,_0x510a23){_0x510a23=_0x510a23||0xc8;return function(_0x3728c8){if(_0x3728c8){return _0xd88eb7[_0x96d1('0x2b')](_0x510a23)[_0x96d1('0x2c')](_0x3728c8);}};}function respondWithFilteredResult(_0x312394,_0x3bfde7){return function(_0x4eb09a){if(_0x4eb09a){var _0x1b42a0=_0x4eb09a[_0x96d1('0x2d')],_0xdfa409=_0x3bfde7[_0x96d1('0x2e')],_0x433b36=_0x3bfde7[_0x96d1('0x2e')]+_0x3bfde7['limit'],_0x443f9c;if(_0x433b36>=_0x1b42a0){_0x433b36=_0x1b42a0;_0x443f9c=0xc8;}else{_0x443f9c=0xce;}_0x312394['status'](_0x443f9c);return _0x312394[_0x96d1('0x2f')](_0x96d1('0x30'),_0xdfa409+'-'+_0x433b36+'/'+_0x1b42a0)[_0x96d1('0x2c')](_0x4eb09a);}return null;};}function patchUpdates(_0x29dc82){return function(_0x43cfc7){try{jsonpatch[_0x96d1('0x31')](_0x43cfc7,_0x29dc82,!![]);}catch(_0x5938ce){return BPromise[_0x96d1('0x32')](_0x5938ce);}return _0x43cfc7[_0x96d1('0x33')]();};}function saveUpdates(_0x4b7e21,_0x38d662){return function(_0x231601){if(_0x231601){return _0x231601[_0x96d1('0x34')](_0x4b7e21)['then'](function(_0x1d24f4){return _0x1d24f4;});}return null;};}function removeEntity(_0x276a58,_0x113dfe){return function(_0x3da771){if(_0x3da771){return _0x3da771[_0x96d1('0x35')]()[_0x96d1('0x20')](function(){_0x276a58['status'](0xcc)[_0x96d1('0x36')]();});}};}function handleEntityNotFound(_0x59225b,_0x49033d){return function(_0x5769d8){if(!_0x5769d8){_0x59225b[_0x96d1('0x2a')](0x194);}return _0x5769d8;};}function handleError(_0x35940e,_0xb814ac){_0xb814ac=_0xb814ac||0x1f4;return function(_0x1e6b73){logger[_0x96d1('0x25')](_0x1e6b73['stack']);if(_0x1e6b73[_0x96d1('0x37')]){delete _0x1e6b73[_0x96d1('0x37')];}_0x35940e[_0x96d1('0x2b')](_0xb814ac)[_0x96d1('0x38')](_0x1e6b73);};}exports[_0x96d1('0x39')]=function(_0x1fca6d,_0x4b22c1){var _0x2b8273={},_0x315c34={},_0x670eb2={'count':0x0,'rows':[]};var _0x74ec34=_[_0x96d1('0x3a')](db[_0x96d1('0x3b')][_0x96d1('0x3c')],function(_0x4d70be){return{'name':_0x4d70be['fieldName'],'type':_0x4d70be[_0x96d1('0x3d')][_0x96d1('0x3e')]};});_0x315c34[_0x96d1('0x3f')]=_[_0x96d1('0x3a')](_0x74ec34,_0x96d1('0x37'));_0x315c34['query']=_[_0x96d1('0x40')](_0x1fca6d[_0x96d1('0x41')]);_0x315c34['filters']=_[_0x96d1('0x42')](_0x315c34[_0x96d1('0x3f')],_0x315c34[_0x96d1('0x41')]);_0x2b8273[_0x96d1('0x43')]=_['intersection'](_0x315c34[_0x96d1('0x3f')],qs['fields'](_0x1fca6d['query'][_0x96d1('0x44')]));_0x2b8273[_0x96d1('0x43')]=_0x2b8273['attributes']['length']?_0x2b8273[_0x96d1('0x43')]:_0x315c34['model'];if(!_0x1fca6d[_0x96d1('0x41')]['hasOwnProperty'](_0x96d1('0x45'))){_0x2b8273['limit']=qs[_0x96d1('0x46')](_0x1fca6d['query']['limit']);_0x2b8273[_0x96d1('0x2e')]=qs['offset'](_0x1fca6d['query'][_0x96d1('0x2e')]);}_0x2b8273[_0x96d1('0x47')]=qs[_0x96d1('0x48')](_0x1fca6d[_0x96d1('0x41')][_0x96d1('0x48')]);_0x2b8273['where']=qs['filters'](_['pick'](_0x1fca6d[_0x96d1('0x41')],_0x315c34[_0x96d1('0x49')]));if(_0x1fca6d[_0x96d1('0x41')][_0x96d1('0x4a')]){_0x2b8273[_0x96d1('0x4b')]=_[_0x96d1('0x4c')](_0x2b8273['where'],{'$or':_['map'](_0x74ec34,function(_0x3ab61a){if(_0x3ab61a[_0x96d1('0x3d')]!==_0x96d1('0x4d')){var _0x1037a7={};_0x1037a7[_0x3ab61a[_0x96d1('0x37')]]={'$like':'%'+_0x1fca6d[_0x96d1('0x41')][_0x96d1('0x4a')]+'%'};return _0x1037a7;}})});}_0x2b8273=_[_0x96d1('0x4c')]({},_0x2b8273,_0x1fca6d['options']);var _0x4de79b={'where':_0x2b8273[_0x96d1('0x4b')]};return db[_0x96d1('0x3b')]['count'](_0x4de79b)[_0x96d1('0x20')](function(_0x4cabf5){_0x670eb2[_0x96d1('0x2d')]=_0x4cabf5;if(_0x1fca6d[_0x96d1('0x41')][_0x96d1('0x4e')]){_0x2b8273[_0x96d1('0x4f')]=[{'all':!![]}];}return db[_0x96d1('0x3b')][_0x96d1('0x50')](_0x2b8273);})['then'](function(_0xa1bd8d){_0x670eb2[_0x96d1('0x51')]=_0xa1bd8d;return _0x670eb2;})['then'](respondWithFilteredResult(_0x4b22c1,_0x2b8273))[_0x96d1('0x52')](handleError(_0x4b22c1,null));};exports[_0x96d1('0x53')]=function(_0x3b618d,_0x39e32b){var _0x33970f={'raw':![],'where':{'id':_0x3b618d[_0x96d1('0x54')]['id']}},_0x30f13d={};_0x30f13d[_0x96d1('0x3f')]=_[_0x96d1('0x40')](db[_0x96d1('0x3b')][_0x96d1('0x3c')]);_0x30f13d[_0x96d1('0x41')]=_[_0x96d1('0x40')](_0x3b618d[_0x96d1('0x41')]);_0x30f13d['filters']=_[_0x96d1('0x42')](_0x30f13d[_0x96d1('0x3f')],_0x30f13d[_0x96d1('0x41')]);_0x33970f[_0x96d1('0x43')]=_[_0x96d1('0x42')](_0x30f13d[_0x96d1('0x3f')],qs['fields'](_0x3b618d[_0x96d1('0x41')][_0x96d1('0x44')]));_0x33970f['attributes']=_0x33970f[_0x96d1('0x43')][_0x96d1('0x55')]?_0x33970f[_0x96d1('0x43')]:_0x30f13d['model'];if(_0x3b618d[_0x96d1('0x41')]['includeAll']){_0x33970f[_0x96d1('0x4f')]=[{'all':!![]}];}_0x33970f=_['merge']({},_0x33970f,_0x3b618d[_0x96d1('0x56')]);return db[_0x96d1('0x3b')][_0x96d1('0x57')](_0x33970f)[_0x96d1('0x20')](handleEntityNotFound(_0x39e32b,null))[_0x96d1('0x20')](respondWithResult(_0x39e32b,null))['catch'](handleError(_0x39e32b,null));};exports[_0x96d1('0x58')]=function(_0xbe8602,_0x36a054){return db['FreshsalesConfiguration'][_0x96d1('0x58')](_0xbe8602[_0x96d1('0x59')],{})['then'](respondWithResult(_0x36a054,0xc9))['catch'](handleError(_0x36a054,null));};exports[_0x96d1('0x34')]=function(_0x31cc2a,_0x1569e2){if(_0x31cc2a['body']['id']){delete _0x31cc2a[_0x96d1('0x59')]['id'];}return db['FreshsalesConfiguration'][_0x96d1('0x57')]({'where':{'id':_0x31cc2a[_0x96d1('0x54')]['id']}})[_0x96d1('0x20')](handleEntityNotFound(_0x1569e2,null))['then'](saveUpdates(_0x31cc2a[_0x96d1('0x59')],null))[_0x96d1('0x20')](respondWithResult(_0x1569e2,null))[_0x96d1('0x52')](handleError(_0x1569e2,null));};exports[_0x96d1('0x35')]=function(_0x1c7bf5,_0x172d81){return db[_0x96d1('0x3b')][_0x96d1('0x57')]({'where':{'id':_0x1c7bf5[_0x96d1('0x54')]['id']}})['then'](handleEntityNotFound(_0x172d81,null))[_0x96d1('0x20')](removeEntity(_0x172d81,null))[_0x96d1('0x52')](handleError(_0x172d81,null));};exports[_0x96d1('0x5a')]=function(_0x2f2f93,_0x252cc4,_0x2b6442){var _0x1e3ef1={};var _0x36b1d5={};var _0x38ec5f;var _0x5afe42;return db[_0x96d1('0x3b')][_0x96d1('0x5b')]({'where':{'id':_0x2f2f93[_0x96d1('0x54')]['id']}})['then'](handleEntityNotFound(_0x252cc4,null))['then'](function(_0x595a09){if(_0x595a09){_0x38ec5f=_0x595a09;_0x36b1d5['model']=_[_0x96d1('0x40')](db[_0x96d1('0x5c')][_0x96d1('0x3c')]);_0x36b1d5[_0x96d1('0x41')]=_[_0x96d1('0x40')](_0x2f2f93[_0x96d1('0x41')]);_0x36b1d5['filters']=_[_0x96d1('0x42')](_0x36b1d5[_0x96d1('0x3f')],_0x36b1d5[_0x96d1('0x41')]);_0x1e3ef1[_0x96d1('0x43')]=_[_0x96d1('0x42')](_0x36b1d5[_0x96d1('0x3f')],qs[_0x96d1('0x44')](_0x2f2f93[_0x96d1('0x41')][_0x96d1('0x44')]));_0x1e3ef1[_0x96d1('0x43')]=_0x1e3ef1[_0x96d1('0x43')]['length']?_0x1e3ef1['attributes']:_0x36b1d5[_0x96d1('0x3f')];_0x1e3ef1[_0x96d1('0x47')]=qs[_0x96d1('0x48')](_0x2f2f93[_0x96d1('0x41')][_0x96d1('0x48')]);_0x1e3ef1[_0x96d1('0x4b')]=qs[_0x96d1('0x49')](_[_0x96d1('0x5d')](_0x2f2f93[_0x96d1('0x41')],_0x36b1d5['filters']));if(_0x2f2f93['query'][_0x96d1('0x4a')]){_0x1e3ef1[_0x96d1('0x4b')]=_[_0x96d1('0x4c')](_0x1e3ef1[_0x96d1('0x4b')],{'$or':_[_0x96d1('0x3a')](_0x1e3ef1[_0x96d1('0x43')],function(_0x1cf4c3){var _0x296afe={};_0x296afe[_0x1cf4c3]={'$like':'%'+_0x2f2f93[_0x96d1('0x41')][_0x96d1('0x4a')]+'%'};return _0x296afe;})});}_0x1e3ef1=_[_0x96d1('0x4c')]({},_0x1e3ef1,_0x2f2f93['options']);return _0x38ec5f[_0x96d1('0x5a')](_0x1e3ef1);}})[_0x96d1('0x20')](function(_0x3071d1){if(_0x3071d1){_0x5afe42=_0x3071d1[_0x96d1('0x55')];if(!_0x2f2f93[_0x96d1('0x41')][_0x96d1('0x5e')](_0x96d1('0x45'))){_0x1e3ef1[_0x96d1('0x46')]=qs['limit'](_0x2f2f93['query'][_0x96d1('0x46')]);_0x1e3ef1[_0x96d1('0x2e')]=qs['offset'](_0x2f2f93[_0x96d1('0x41')][_0x96d1('0x2e')]);}return _0x38ec5f[_0x96d1('0x5a')](_0x1e3ef1);}})['then'](function(_0x4b619a){if(_0x4b619a){return _0x4b619a?{'count':_0x5afe42,'rows':_0x4b619a}:null;}})['then'](respondWithResult(_0x252cc4,null))['catch'](handleError(_0x252cc4,null));};exports[_0x96d1('0x5f')]=function(_0x5291fe,_0x356646,_0x166121){var _0xe49047={};var _0x2fd213={};var _0x58570d;var _0x328dea;return db['FreshsalesConfiguration'][_0x96d1('0x5b')]({'where':{'id':_0x5291fe[_0x96d1('0x54')]['id']}})['then'](handleEntityNotFound(_0x356646,null))[_0x96d1('0x20')](function(_0x2bcdfe){if(_0x2bcdfe){_0x58570d=_0x2bcdfe;_0x2fd213[_0x96d1('0x3f')]=_['keys'](db[_0x96d1('0x5c')]['rawAttributes']);_0x2fd213['query']=_['keys'](_0x5291fe[_0x96d1('0x41')]);_0x2fd213[_0x96d1('0x49')]=_[_0x96d1('0x42')](_0x2fd213[_0x96d1('0x3f')],_0x2fd213[_0x96d1('0x41')]);_0xe49047[_0x96d1('0x43')]=_[_0x96d1('0x42')](_0x2fd213[_0x96d1('0x3f')],qs['fields'](_0x5291fe[_0x96d1('0x41')][_0x96d1('0x44')]));_0xe49047['attributes']=_0xe49047['attributes'][_0x96d1('0x55')]?_0xe49047['attributes']:_0x2fd213[_0x96d1('0x3f')];_0xe49047['order']=qs['sort'](_0x5291fe[_0x96d1('0x41')][_0x96d1('0x48')]);_0xe49047['where']=qs[_0x96d1('0x49')](_[_0x96d1('0x5d')](_0x5291fe['query'],_0x2fd213[_0x96d1('0x49')]));if(_0x5291fe['query'][_0x96d1('0x4a')]){_0xe49047[_0x96d1('0x4b')]=_[_0x96d1('0x4c')](_0xe49047[_0x96d1('0x4b')],{'$or':_[_0x96d1('0x3a')](_0xe49047[_0x96d1('0x43')],function(_0x5bf430){var _0x1b2e85={};_0x1b2e85[_0x5bf430]={'$like':'%'+_0x5291fe[_0x96d1('0x41')][_0x96d1('0x4a')]+'%'};return _0x1b2e85;})});}_0xe49047=_[_0x96d1('0x4c')]({},_0xe49047,_0x5291fe[_0x96d1('0x56')]);return _0x58570d[_0x96d1('0x5f')](_0xe49047);}})[_0x96d1('0x20')](function(_0x1a1e9c){if(_0x1a1e9c){_0x328dea=_0x1a1e9c['length'];if(!_0x5291fe[_0x96d1('0x41')][_0x96d1('0x5e')](_0x96d1('0x45'))){_0xe49047[_0x96d1('0x46')]=qs[_0x96d1('0x46')](_0x5291fe[_0x96d1('0x41')][_0x96d1('0x46')]);_0xe49047[_0x96d1('0x2e')]=qs['offset'](_0x5291fe[_0x96d1('0x41')][_0x96d1('0x2e')]);}return _0x58570d[_0x96d1('0x5f')](_0xe49047);}})[_0x96d1('0x20')](function(_0x3785d7){if(_0x3785d7){return _0x3785d7?{'count':_0x328dea,'rows':_0x3785d7}:null;}})['then'](respondWithResult(_0x356646,null))[_0x96d1('0x52')](handleError(_0x356646,null));};exports[_0x96d1('0x60')]=function(_0x3b5a32,_0x590a38,_0x1c5301){var _0x357068={};var _0x56e0aa={};var _0xd72b8e;var _0x3fe792;return db['FreshsalesConfiguration'][_0x96d1('0x5b')]({'where':{'id':_0x3b5a32[_0x96d1('0x54')]['id']}})[_0x96d1('0x20')](handleEntityNotFound(_0x590a38,null))[_0x96d1('0x20')](function(_0x5986ae){if(_0x5986ae){_0xd72b8e=_0x5986ae;_0x56e0aa[_0x96d1('0x3f')]=_[_0x96d1('0x40')](db[_0x96d1('0x5c')][_0x96d1('0x3c')]);_0x56e0aa[_0x96d1('0x41')]=_['keys'](_0x3b5a32[_0x96d1('0x41')]);_0x56e0aa[_0x96d1('0x49')]=_[_0x96d1('0x42')](_0x56e0aa['model'],_0x56e0aa[_0x96d1('0x41')]);_0x357068['attributes']=_[_0x96d1('0x42')](_0x56e0aa[_0x96d1('0x3f')],qs[_0x96d1('0x44')](_0x3b5a32['query']['fields']));_0x357068[_0x96d1('0x43')]=_0x357068[_0x96d1('0x43')][_0x96d1('0x55')]?_0x357068['attributes']:_0x56e0aa[_0x96d1('0x3f')];_0x357068['order']=qs[_0x96d1('0x48')](_0x3b5a32[_0x96d1('0x41')]['sort']);_0x357068[_0x96d1('0x4b')]=qs['filters'](_['pick'](_0x3b5a32[_0x96d1('0x41')],_0x56e0aa[_0x96d1('0x49')]));if(_0x3b5a32[_0x96d1('0x41')][_0x96d1('0x4a')]){_0x357068['where']=_[_0x96d1('0x4c')](_0x357068[_0x96d1('0x4b')],{'$or':_['map'](_0x357068[_0x96d1('0x43')],function(_0x18e1d6){var _0x132cb0={};_0x132cb0[_0x18e1d6]={'$like':'%'+_0x3b5a32[_0x96d1('0x41')][_0x96d1('0x4a')]+'%'};return _0x132cb0;})});}_0x357068=_['merge']({},_0x357068,_0x3b5a32[_0x96d1('0x56')]);return _0xd72b8e[_0x96d1('0x60')](_0x357068);}})[_0x96d1('0x20')](function(_0x40450f){if(_0x40450f){_0x3fe792=_0x40450f[_0x96d1('0x55')];if(!_0x3b5a32[_0x96d1('0x41')][_0x96d1('0x5e')]('nolimit')){_0x357068[_0x96d1('0x46')]=qs[_0x96d1('0x46')](_0x3b5a32[_0x96d1('0x41')][_0x96d1('0x46')]);_0x357068[_0x96d1('0x2e')]=qs['offset'](_0x3b5a32['query']['offset']);}return _0xd72b8e[_0x96d1('0x60')](_0x357068);}})[_0x96d1('0x20')](function(_0x404b26){if(_0x404b26){return _0x404b26?{'count':_0x3fe792,'rows':_0x404b26}:null;}})[_0x96d1('0x20')](respondWithResult(_0x590a38,null))[_0x96d1('0x52')](handleError(_0x590a38,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 759756a..2c55cb0 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 _0x9f3e=['int_freshsales_configurations','lodash','util','../../config/logger','api','moment','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x163bb8,_0x10160b){var _0x436e49=function(_0x4b7e0c){while(--_0x4b7e0c){_0x163bb8['push'](_0x163bb8['shift']());}};_0x436e49(++_0x10160b);}(_0x9f3e,0x1c4));var _0xe9f3=function(_0x3039aa,_0x59745d){_0x3039aa=_0x3039aa-0x0;var _0xfa68e8=_0x9f3e[_0x3039aa];return _0xfa68e8;};'use strict';var _=require(_0xe9f3('0x0'));var util=require(_0xe9f3('0x1'));var logger=require(_0xe9f3('0x2'))(_0xe9f3('0x3'));var moment=require(_0xe9f3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe9f3('0x5'));var config=require('../../config/environment');var attributes=require(_0xe9f3('0x6'));module[_0xe9f3('0x7')]=function(_0x46f926,_0x3693ef){return _0x46f926[_0xe9f3('0x8')](_0xe9f3('0x9'),attributes,{'tableName':_0xe9f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf72b=['./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x426301,_0x1cc958){var _0x689c14=function(_0x565aee){while(--_0x565aee){_0x426301['push'](_0x426301['shift']());}};_0x689c14(++_0x1cc958);}(_0xf72b,0x1d9));var _0xbf72=function(_0xb5a7d0,_0x1eebe8){_0xb5a7d0=_0xb5a7d0-0x0;var _0x29b496=_0xf72b[_0xb5a7d0];return _0x29b496;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var logger=require(_0xbf72('0x1'))('api');var moment=require(_0xbf72('0x2'));var BPromise=require(_0xbf72('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf72('0x4'));var rimraf=require(_0xbf72('0x5'));var config=require(_0xbf72('0x6'));var attributes=require(_0xbf72('0x7'));module[_0xbf72('0x8')]=function(_0x2b8440,_0x5ee060){return _0x2b8440[_0xbf72('0x9')](_0xbf72('0xa'),attributes,{'tableName':_0xbf72('0xb'),'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 e370bd6..78c87d7 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 _0xc15c=['stringify','error','message','catch','moment','bluebird','randomstring','../../mysqldb','rpc','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xef66cb,_0x2d4dc5){var _0x1b9542=function(_0x4ca1de){while(--_0x4ca1de){_0xef66cb['push'](_0xef66cb['shift']());}};_0x1b9542(++_0x2d4dc5);}(_0xc15c,0xae));var _0xcc15=function(_0x4a8345,_0x4f3372){_0x4a8345=_0x4a8345-0x0;var _0x13eb62=_0xc15c[_0x4a8345];return _0x13eb62;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcc15('0x0'));var BPromise=require(_0xcc15('0x1'));var rs=require(_0xcc15('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc15('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcc15('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcc15('0x5')][_0xcc15('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x597a7e,_0x5a5a15,_0x5de043){return new BPromise(function(_0x25fee6,_0x16c0bd){return client[_0xcc15('0x7')](_0x597a7e,_0x5de043)[_0xcc15('0x8')](function(_0x5eafea){logger[_0xcc15('0x9')](_0xcc15('0xa'),_0x5a5a15,_0xcc15('0xb'));logger[_0xcc15('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x5a5a15,_0xcc15('0xb'),JSON[_0xcc15('0xd')](_0x5eafea));if(_0x5eafea[_0xcc15('0xe')]){if(_0x5eafea['error']['code']===0x1f4){logger[_0xcc15('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5a5a15,_0x5eafea[_0xcc15('0xe')]['message']);return _0x16c0bd(_0x5eafea[_0xcc15('0xe')]['message']);}logger[_0xcc15('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5a5a15,_0x5eafea[_0xcc15('0xe')][_0xcc15('0xf')]);return _0x25fee6(_0x5eafea[_0xcc15('0xe')][_0xcc15('0xf')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5a5a15,'request\x20sent');_0x25fee6(_0x5eafea['result'][_0xcc15('0xf')]);}})[_0xcc15('0x10')](function(_0x1b1882){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5a5a15,_0x1b1882);_0x16c0bd(_0x1b1882);});});} \ No newline at end of file +var _0x43c8=['client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x43c8,0xaf));var _0x843c=function(_0x56d495,_0x2e20b8){_0x56d495=_0x56d495-0x0;var _0x39b5bc=_0x43c8[_0x56d495];return _0x39b5bc;};'use strict';var _=require('lodash');var util=require(_0x843c('0x0'));var moment=require('moment');var BPromise=require(_0x843c('0x1'));var rs=require(_0x843c('0x2'));var fs=require('fs');var Redis=require(_0x843c('0x3'));var db=require(_0x843c('0x4'))['db'];var utils=require(_0x843c('0x5'));var logger=require(_0x843c('0x6'))(_0x843c('0x7'));var config=require('../../config/environment');var jayson=require(_0x843c('0x8'));var client=jayson[_0x843c('0x9')][_0x843c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15bb1f,_0xd198e5,_0x49aee7){return new BPromise(function(_0x327327,_0x41f56d){return client['request'](_0x15bb1f,_0x49aee7)[_0x843c('0xb')](function(_0x566777){logger['info'](_0x843c('0xc'),_0xd198e5,'request\x20sent');logger[_0x843c('0xd')](_0x843c('0xe'),_0xd198e5,_0x843c('0xf'),JSON[_0x843c('0x10')](_0x566777));if(_0x566777['error']){if(_0x566777[_0x843c('0x11')][_0x843c('0x12')]===0x1f4){logger[_0x843c('0x11')](_0x843c('0xc'),_0xd198e5,_0x566777[_0x843c('0x11')][_0x843c('0x13')]);return _0x41f56d(_0x566777[_0x843c('0x11')][_0x843c('0x13')]);}logger[_0x843c('0x11')](_0x843c('0xc'),_0xd198e5,_0x566777[_0x843c('0x11')][_0x843c('0x13')]);return _0x327327(_0x566777[_0x843c('0x11')][_0x843c('0x13')]);}else{logger[_0x843c('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xd198e5,_0x843c('0xf'));_0x327327(_0x566777[_0x843c('0x15')][_0x843c('0x13')]);}})[_0x843c('0x16')](function(_0x16e8f6){logger['error'](_0x843c('0xc'),_0xd198e5,_0x16e8f6);_0x41f56d(_0x16e8f6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 577f4e8..27c510a 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 _0x05aa=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports'];(function(_0x21d697,_0x44cd29){var _0x31fa63=function(_0x2e3ac0){while(--_0x2e3ac0){_0x21d697['push'](_0x21d697['shift']());}};_0x31fa63(++_0x44cd29);}(_0x05aa,0xff));var _0xa05a=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x05aa[_0x5f3f88];return _0xd08119;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa05a('0x0'));var timeout=require('connect-timeout');var express=require(_0xa05a('0x1'));var router=express[_0xa05a('0x2')]();var auth=require(_0xa05a('0x3'));var interaction=require(_0xa05a('0x4'));var config=require(_0xa05a('0x5'));var controller=require(_0xa05a('0x6'));router[_0xa05a('0x7')]('/',auth[_0xa05a('0x8')](),controller[_0xa05a('0x9')]);router[_0xa05a('0x7')](_0xa05a('0xa'),auth[_0xa05a('0x8')](),controller[_0xa05a('0xb')]);router['post']('/',auth[_0xa05a('0x8')](),controller[_0xa05a('0xc')]);router['put'](_0xa05a('0xa'),auth[_0xa05a('0x8')](),controller[_0xa05a('0xd')]);router[_0xa05a('0xe')](_0xa05a('0xa'),auth['isAuthenticated'](),controller[_0xa05a('0xf')]);module[_0xa05a('0x10')]=router; \ No newline at end of file +var _0x5351=['get','index','/:id','show','post','isAuthenticated','put','update','delete','destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5351,0x14f));var _0x1535=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5351[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x1535('0x0'));var path=require(_0x1535('0x1'));var timeout=require('connect-timeout');var express=require(_0x1535('0x2'));var router=express[_0x1535('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1535('0x4'));var config=require(_0x1535('0x5'));var controller=require(_0x1535('0x6'));router[_0x1535('0x7')]('/',auth['isAuthenticated'](),controller[_0x1535('0x8')]);router[_0x1535('0x7')](_0x1535('0x9'),auth['isAuthenticated'](),controller[_0x1535('0xa')]);router[_0x1535('0xb')]('/',auth[_0x1535('0xc')](),controller['create']);router[_0x1535('0xd')]('/:id',auth[_0x1535('0xc')](),controller[_0x1535('0xe')]);router[_0x1535('0xf')](_0x1535('0x9'),auth[_0x1535('0xc')](),controller[_0x1535('0x10')]);module[_0x1535('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 77b4811..e957831 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 _0x0141=['string','STRING','variable','BOOLEAN','exports','ENUM','customVariable'];(function(_0x11b181,_0xd7514a){var _0x240589=function(_0x40f9f9){while(--_0x40f9f9){_0x11b181['push'](_0x11b181['shift']());}};_0x240589(++_0xd7514a);}(_0x0141,0x107));var _0x1014=function(_0x4e90dd,_0x2ee0ea){_0x4e90dd=_0x4e90dd-0x0;var _0x2e05a6=_0x0141[_0x4e90dd];return _0x2e05a6;};'use strict';var Sequelize=require('sequelize');module[_0x1014('0x0')]={'type':{'type':Sequelize[_0x1014('0x1')]('string','variable',_0x1014('0x2'),'keyValue'),'defaultValue':_0x1014('0x3')},'content':{'type':Sequelize[_0x1014('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x1014('0x3'),_0x1014('0x5'),'customVariable')},'keyContent':{'type':Sequelize[_0x1014('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1014('0x4')]},'customField':{'type':Sequelize[_0x1014('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1014('0x4')]}}; \ No newline at end of file +var _0xa6cd=['exports','ENUM','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0x3d3590,_0x23bd12){var _0x1348ff=function(_0x26a61a){while(--_0x26a61a){_0x3d3590['push'](_0x3d3590['shift']());}};_0x1348ff(++_0x23bd12);}(_0xa6cd,0x107));var _0xda6c=function(_0x10acca,_0x1219e1){_0x10acca=_0x10acca-0x0;var _0xb3bef3=_0xa6cd[_0x10acca];return _0xb3bef3;};'use strict';var Sequelize=require(_0xda6c('0x0'));module[_0xda6c('0x1')]={'type':{'type':Sequelize[_0xda6c('0x2')](_0xda6c('0x3'),_0xda6c('0x4'),_0xda6c('0x5'),_0xda6c('0x6')),'defaultValue':_0xda6c('0x3')},'content':{'type':Sequelize[_0xda6c('0x7')]},'key':{'type':Sequelize[_0xda6c('0x7')]},'keyType':{'type':Sequelize[_0xda6c('0x2')]('string',_0xda6c('0x4'),_0xda6c('0x5'))},'keyContent':{'type':Sequelize[_0xda6c('0x7')]},'idField':{'type':Sequelize[_0xda6c('0x7')]},'nameField':{'type':Sequelize[_0xda6c('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index c5eac53..0a86649 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 _0x765e=['where','type','VIRTUAL','options','includeAll','include','rows','catch','show','length','find','create','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x765e,0x131));var _0xe765=function(_0x3213d6,_0x27ee37){_0x3213d6=_0x3213d6-0x0;var _0xc30680=_0x765e[_0x3213d6];return _0xc30680;};'use strict';var pdf=require(_0xe765('0x0'));var emlformat=require(_0xe765('0x1'));var rimraf=require(_0xe765('0x2'));var zipdir=require(_0xe765('0x3'));var jsonpatch=require(_0xe765('0x4'));var rp=require(_0xe765('0x5'));var moment=require(_0xe765('0x6'));var BPromise=require(_0xe765('0x7'));var Mustache=require(_0xe765('0x8'));var util=require(_0xe765('0x9'));var path=require(_0xe765('0xa'));var sox=require(_0xe765('0xb'));var csv=require(_0xe765('0xc'));var ejs=require(_0xe765('0xd'));var fs=require('fs');var _=require(_0xe765('0xe'));var squel=require('squel');var crypto=require(_0xe765('0xf'));var jsforce=require(_0xe765('0x10'));var deskjs=require(_0xe765('0x11'));var toCsv=require(_0xe765('0xc'));var querystring=require(_0xe765('0x12'));var Papa=require(_0xe765('0x13'));var Redis=require(_0xe765('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xe765('0x15'));var as=require(_0xe765('0x16'));var hardwareService=require(_0xe765('0x17'));var logger=require('../../config/logger')(_0xe765('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35ac59,_0x18177f){_0x18177f=_0x18177f||0xcc;return function(_0x9411a0){if(_0x9411a0){return _0x35ac59[_0xe765('0x19')](_0x18177f);}return _0x35ac59[_0xe765('0x1a')](_0x18177f)['end']();};}function respondWithResult(_0x3e2ffb,_0x3a26d8){_0x3a26d8=_0x3a26d8||0xc8;return function(_0x395312){if(_0x395312){return _0x3e2ffb[_0xe765('0x1a')](_0x3a26d8)[_0xe765('0x1b')](_0x395312);}};}function respondWithFilteredResult(_0x5b9436,_0x50e2ab){return function(_0x2f673b){if(_0x2f673b){var _0x1b1cfe=_0x2f673b[_0xe765('0x1c')],_0x3c887b=_0x50e2ab[_0xe765('0x1d')],_0x4856fe=_0x50e2ab[_0xe765('0x1d')]+_0x50e2ab[_0xe765('0x1e')],_0xb240d6;if(_0x4856fe>=_0x1b1cfe){_0x4856fe=_0x1b1cfe;_0xb240d6=0xc8;}else{_0xb240d6=0xce;}_0x5b9436[_0xe765('0x1a')](_0xb240d6);return _0x5b9436[_0xe765('0x1f')](_0xe765('0x20'),_0x3c887b+'-'+_0x4856fe+'/'+_0x1b1cfe)[_0xe765('0x1b')](_0x2f673b);}return null;};}function patchUpdates(_0x57fb61){return function(_0x17b670){try{jsonpatch['apply'](_0x17b670,_0x57fb61,!![]);}catch(_0x14a3c3){return BPromise[_0xe765('0x21')](_0x14a3c3);}return _0x17b670['save']();};}function saveUpdates(_0x4733dc,_0x59118f){return function(_0x1c73c8){if(_0x1c73c8){return _0x1c73c8[_0xe765('0x22')](_0x4733dc)[_0xe765('0x23')](function(_0x50970b){return _0x50970b;});}return null;};}function removeEntity(_0x51813d,_0x4b789b){return function(_0x1c6de4){if(_0x1c6de4){return _0x1c6de4[_0xe765('0x24')]()[_0xe765('0x23')](function(){_0x51813d[_0xe765('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50cfcb,_0x18ba77){return function(_0x2e2a34){if(!_0x2e2a34){_0x50cfcb[_0xe765('0x19')](0x194);}return _0x2e2a34;};}function handleError(_0x18ddd4,_0xad34a7){_0xad34a7=_0xad34a7||0x1f4;return function(_0x52bf11){logger[_0xe765('0x25')](_0x52bf11['stack']);if(_0x52bf11[_0xe765('0x26')]){delete _0x52bf11[_0xe765('0x26')];}_0x18ddd4[_0xe765('0x1a')](_0xad34a7)[_0xe765('0x27')](_0x52bf11);};}exports[_0xe765('0x28')]=function(_0x2194ab,_0x471d57){var _0x530838={},_0x55086d={},_0x52476f={'count':0x0,'rows':[]};var _0x4bc5c1=_[_0xe765('0x29')](db[_0xe765('0x2a')][_0xe765('0x2b')],function(_0x64ffd4){return{'name':_0x64ffd4[_0xe765('0x2c')],'type':_0x64ffd4['type'][_0xe765('0x2d')]};});_0x55086d[_0xe765('0x2e')]=_[_0xe765('0x29')](_0x4bc5c1,'name');_0x55086d['query']=_[_0xe765('0x2f')](_0x2194ab['query']);_0x55086d[_0xe765('0x30')]=_[_0xe765('0x31')](_0x55086d[_0xe765('0x2e')],_0x55086d[_0xe765('0x32')]);_0x530838[_0xe765('0x33')]=_['intersection'](_0x55086d['model'],qs[_0xe765('0x34')](_0x2194ab[_0xe765('0x32')][_0xe765('0x34')]));_0x530838[_0xe765('0x33')]=_0x530838[_0xe765('0x33')]['length']?_0x530838['attributes']:_0x55086d[_0xe765('0x2e')];if(!_0x2194ab['query'][_0xe765('0x35')](_0xe765('0x36'))){_0x530838[_0xe765('0x1e')]=qs[_0xe765('0x1e')](_0x2194ab[_0xe765('0x32')][_0xe765('0x1e')]);_0x530838[_0xe765('0x1d')]=qs['offset'](_0x2194ab['query']['offset']);}_0x530838[_0xe765('0x37')]=qs[_0xe765('0x38')](_0x2194ab[_0xe765('0x32')][_0xe765('0x38')]);_0x530838['where']=qs[_0xe765('0x30')](_[_0xe765('0x39')](_0x2194ab[_0xe765('0x32')],_0x55086d[_0xe765('0x30')]));if(_0x2194ab['query'][_0xe765('0x3a')]){_0x530838['where']=_[_0xe765('0x3b')](_0x530838[_0xe765('0x3c')],{'$or':_[_0xe765('0x29')](_0x4bc5c1,function(_0x1f58ef){if(_0x1f58ef[_0xe765('0x3d')]!==_0xe765('0x3e')){var _0xcc4e48={};_0xcc4e48[_0x1f58ef[_0xe765('0x26')]]={'$like':'%'+_0x2194ab[_0xe765('0x32')][_0xe765('0x3a')]+'%'};return _0xcc4e48;}})});}_0x530838=_['merge']({},_0x530838,_0x2194ab[_0xe765('0x3f')]);var _0x17d60e={'where':_0x530838[_0xe765('0x3c')]};return db['FreshsalesField']['count'](_0x17d60e)['then'](function(_0x43bea6){_0x52476f['count']=_0x43bea6;if(_0x2194ab[_0xe765('0x32')][_0xe765('0x40')]){_0x530838[_0xe765('0x41')]=[{'all':!![]}];}return db[_0xe765('0x2a')]['findAll'](_0x530838);})[_0xe765('0x23')](function(_0x132d49){_0x52476f[_0xe765('0x42')]=_0x132d49;return _0x52476f;})[_0xe765('0x23')](respondWithFilteredResult(_0x471d57,_0x530838))[_0xe765('0x43')](handleError(_0x471d57,null));};exports[_0xe765('0x44')]=function(_0x25c500,_0x18356e){var _0xb92246={'raw':!![],'where':{'id':_0x25c500['params']['id']}},_0x1eb14d={};_0x1eb14d[_0xe765('0x2e')]=_['keys'](db[_0xe765('0x2a')][_0xe765('0x2b')]);_0x1eb14d['query']=_[_0xe765('0x2f')](_0x25c500['query']);_0x1eb14d['filters']=_['intersection'](_0x1eb14d[_0xe765('0x2e')],_0x1eb14d[_0xe765('0x32')]);_0xb92246[_0xe765('0x33')]=_['intersection'](_0x1eb14d[_0xe765('0x2e')],qs[_0xe765('0x34')](_0x25c500[_0xe765('0x32')][_0xe765('0x34')]));_0xb92246[_0xe765('0x33')]=_0xb92246[_0xe765('0x33')][_0xe765('0x45')]?_0xb92246[_0xe765('0x33')]:_0x1eb14d[_0xe765('0x2e')];if(_0x25c500['query'][_0xe765('0x40')]){_0xb92246['include']=[{'all':!![]}];}_0xb92246=_['merge']({},_0xb92246,_0x25c500[_0xe765('0x3f')]);return db['FreshsalesField'][_0xe765('0x46')](_0xb92246)[_0xe765('0x23')](handleEntityNotFound(_0x18356e,null))[_0xe765('0x23')](respondWithResult(_0x18356e,null))['catch'](handleError(_0x18356e,null));};exports[_0xe765('0x47')]=function(_0x53f02c,_0x3d9530){return db[_0xe765('0x2a')][_0xe765('0x47')](_0x53f02c['body'],{})[_0xe765('0x23')](respondWithResult(_0x3d9530,0xc9))[_0xe765('0x43')](handleError(_0x3d9530,null));};exports[_0xe765('0x22')]=function(_0x2d360e,_0x5268ed){if(_0x2d360e['body']['id']){delete _0x2d360e['body']['id'];}return db[_0xe765('0x2a')][_0xe765('0x46')]({'where':{'id':_0x2d360e[_0xe765('0x48')]['id']}})['then'](handleEntityNotFound(_0x5268ed,null))[_0xe765('0x23')](saveUpdates(_0x2d360e['body'],null))[_0xe765('0x23')](respondWithResult(_0x5268ed,null))[_0xe765('0x43')](handleError(_0x5268ed,null));};exports[_0xe765('0x24')]=function(_0x29e661,_0x7f132f){return db[_0xe765('0x2a')]['find']({'where':{'id':_0x29e661[_0xe765('0x48')]['id']}})[_0xe765('0x23')](handleEntityNotFound(_0x7f132f,null))[_0xe765('0x23')](removeEntity(_0x7f132f,null))[_0xe765('0x43')](handleError(_0x7f132f,null));}; \ No newline at end of file +var _0x9348=['destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','then','error','name','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','pick','filter','where','merge','options','include','catch','show','params','keys','create','body','find'];(function(_0x3419b0,_0x255acd){var _0x2fddb6=function(_0x3de0a1){while(--_0x3de0a1){_0x3419b0['push'](_0x3419b0['shift']());}};_0x2fddb6(++_0x255acd);}(_0x9348,0x10d));var _0x8934=function(_0xc623dd,_0x443a7a){_0xc623dd=_0xc623dd-0x0;var _0x3b2b42=_0x9348[_0xc623dd];return _0x3b2b42;};'use strict';var pdf=require(_0x8934('0x0'));var emlformat=require(_0x8934('0x1'));var rimraf=require(_0x8934('0x2'));var zipdir=require(_0x8934('0x3'));var jsonpatch=require(_0x8934('0x4'));var rp=require('request-promise');var moment=require(_0x8934('0x5'));var BPromise=require(_0x8934('0x6'));var Mustache=require('mustache');var util=require(_0x8934('0x7'));var path=require(_0x8934('0x8'));var sox=require(_0x8934('0x9'));var csv=require(_0x8934('0xa'));var ejs=require(_0x8934('0xb'));var fs=require('fs');var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var db=require(_0x8934('0x17'))['db'];function respondWithStatusCode(_0xbb421b,_0x4a999c){_0x4a999c=_0x4a999c||0xcc;return function(_0x68427d){if(_0x68427d){return _0xbb421b[_0x8934('0x18')](_0x4a999c);}return _0xbb421b[_0x8934('0x19')](_0x4a999c)[_0x8934('0x1a')]();};}function respondWithResult(_0xbc487e,_0xdf59f4){_0xdf59f4=_0xdf59f4||0xc8;return function(_0x5b560f){if(_0x5b560f){return _0xbc487e[_0x8934('0x19')](_0xdf59f4)[_0x8934('0x1b')](_0x5b560f);}};}function respondWithFilteredResult(_0xdfc97c,_0x94b948){return function(_0x34d4dc){if(_0x34d4dc){var _0x41e6a9=_0x34d4dc[_0x8934('0x1c')],_0x2a5b04=_0x94b948[_0x8934('0x1d')],_0x357cf8=_0x94b948[_0x8934('0x1d')]+_0x94b948['limit'],_0x52de6a;if(_0x357cf8>=_0x41e6a9){_0x357cf8=_0x41e6a9;_0x52de6a=0xc8;}else{_0x52de6a=0xce;}_0xdfc97c['status'](_0x52de6a);return _0xdfc97c['set'](_0x8934('0x1e'),_0x2a5b04+'-'+_0x357cf8+'/'+_0x41e6a9)['json'](_0x34d4dc);}return null;};}function patchUpdates(_0xe64ebd){return function(_0xa9c394){try{jsonpatch[_0x8934('0x1f')](_0xa9c394,_0xe64ebd,!![]);}catch(_0x36c3b9){return BPromise[_0x8934('0x20')](_0x36c3b9);}return _0xa9c394['save']();};}function saveUpdates(_0xf3998,_0x5ae49f){return function(_0x476c6c){if(_0x476c6c){return _0x476c6c[_0x8934('0x21')](_0xf3998)[_0x8934('0x22')](function(_0x379445){return _0x379445;});}return null;};}function removeEntity(_0x2500ec,_0x331e18){return function(_0x36fe20){if(_0x36fe20){return _0x36fe20['destroy']()[_0x8934('0x22')](function(){_0x2500ec[_0x8934('0x19')](0xcc)[_0x8934('0x1a')]();});}};}function handleEntityNotFound(_0x343e09,_0x43b89a){return function(_0x5e593b){if(!_0x5e593b){_0x343e09[_0x8934('0x18')](0x194);}return _0x5e593b;};}function handleError(_0x1c15c5,_0x1b5775){_0x1b5775=_0x1b5775||0x1f4;return function(_0x50ceda){logger[_0x8934('0x23')](_0x50ceda['stack']);if(_0x50ceda[_0x8934('0x24')]){delete _0x50ceda[_0x8934('0x24')];}_0x1c15c5[_0x8934('0x19')](_0x1b5775)['send'](_0x50ceda);};}exports[_0x8934('0x25')]=function(_0x15910b,_0x310454){var _0x50b89e={},_0x4b5780={},_0x3db790={'count':0x0,'rows':[]};var _0x249031=_[_0x8934('0x26')](db[_0x8934('0x27')][_0x8934('0x28')],function(_0x20d448){return{'name':_0x20d448[_0x8934('0x29')],'type':_0x20d448[_0x8934('0x2a')][_0x8934('0x2b')]};});_0x4b5780[_0x8934('0x2c')]=_['map'](_0x249031,_0x8934('0x24'));_0x4b5780[_0x8934('0x2d')]=_['keys'](_0x15910b[_0x8934('0x2d')]);_0x4b5780[_0x8934('0x2e')]=_[_0x8934('0x2f')](_0x4b5780[_0x8934('0x2c')],_0x4b5780['query']);_0x50b89e[_0x8934('0x30')]=_[_0x8934('0x2f')](_0x4b5780[_0x8934('0x2c')],qs[_0x8934('0x31')](_0x15910b[_0x8934('0x2d')]['fields']));_0x50b89e[_0x8934('0x30')]=_0x50b89e['attributes']['length']?_0x50b89e[_0x8934('0x30')]:_0x4b5780[_0x8934('0x2c')];if(!_0x15910b[_0x8934('0x2d')][_0x8934('0x32')]('nolimit')){_0x50b89e[_0x8934('0x33')]=qs[_0x8934('0x33')](_0x15910b[_0x8934('0x2d')][_0x8934('0x33')]);_0x50b89e[_0x8934('0x1d')]=qs['offset'](_0x15910b[_0x8934('0x2d')][_0x8934('0x1d')]);}_0x50b89e['order']=qs['sort'](_0x15910b[_0x8934('0x2d')][_0x8934('0x34')]);_0x50b89e['where']=qs['filters'](_[_0x8934('0x35')](_0x15910b[_0x8934('0x2d')],_0x4b5780[_0x8934('0x2e')]));if(_0x15910b[_0x8934('0x2d')][_0x8934('0x36')]){_0x50b89e[_0x8934('0x37')]=_[_0x8934('0x38')](_0x50b89e[_0x8934('0x37')],{'$or':_[_0x8934('0x26')](_0x249031,function(_0x2d2a98){if(_0x2d2a98[_0x8934('0x2a')]!=='VIRTUAL'){var _0x31c805={};_0x31c805[_0x2d2a98[_0x8934('0x24')]]={'$like':'%'+_0x15910b['query'][_0x8934('0x36')]+'%'};return _0x31c805;}})});}_0x50b89e=_[_0x8934('0x38')]({},_0x50b89e,_0x15910b[_0x8934('0x39')]);var _0x40733b={'where':_0x50b89e[_0x8934('0x37')]};return db['FreshsalesField']['count'](_0x40733b)['then'](function(_0x3962d5){_0x3db790[_0x8934('0x1c')]=_0x3962d5;if(_0x15910b[_0x8934('0x2d')]['includeAll']){_0x50b89e[_0x8934('0x3a')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x50b89e);})[_0x8934('0x22')](function(_0x1f36d0){_0x3db790['rows']=_0x1f36d0;return _0x3db790;})['then'](respondWithFilteredResult(_0x310454,_0x50b89e))[_0x8934('0x3b')](handleError(_0x310454,null));};exports[_0x8934('0x3c')]=function(_0x3d2b14,_0x4b94b0){var _0x46bfe7={'raw':!![],'where':{'id':_0x3d2b14[_0x8934('0x3d')]['id']}},_0x5e543c={};_0x5e543c['model']=_[_0x8934('0x3e')](db[_0x8934('0x27')][_0x8934('0x28')]);_0x5e543c['query']=_[_0x8934('0x3e')](_0x3d2b14[_0x8934('0x2d')]);_0x5e543c[_0x8934('0x2e')]=_[_0x8934('0x2f')](_0x5e543c['model'],_0x5e543c[_0x8934('0x2d')]);_0x46bfe7[_0x8934('0x30')]=_[_0x8934('0x2f')](_0x5e543c[_0x8934('0x2c')],qs[_0x8934('0x31')](_0x3d2b14[_0x8934('0x2d')][_0x8934('0x31')]));_0x46bfe7[_0x8934('0x30')]=_0x46bfe7['attributes']['length']?_0x46bfe7['attributes']:_0x5e543c[_0x8934('0x2c')];if(_0x3d2b14[_0x8934('0x2d')]['includeAll']){_0x46bfe7[_0x8934('0x3a')]=[{'all':!![]}];}_0x46bfe7=_['merge']({},_0x46bfe7,_0x3d2b14[_0x8934('0x39')]);return db[_0x8934('0x27')]['find'](_0x46bfe7)[_0x8934('0x22')](handleEntityNotFound(_0x4b94b0,null))[_0x8934('0x22')](respondWithResult(_0x4b94b0,null))[_0x8934('0x3b')](handleError(_0x4b94b0,null));};exports[_0x8934('0x3f')]=function(_0x5426fc,_0x2adb63){return db[_0x8934('0x27')]['create'](_0x5426fc[_0x8934('0x40')],{})[_0x8934('0x22')](respondWithResult(_0x2adb63,0xc9))[_0x8934('0x3b')](handleError(_0x2adb63,null));};exports[_0x8934('0x21')]=function(_0x406d0a,_0x419e30){if(_0x406d0a[_0x8934('0x40')]['id']){delete _0x406d0a[_0x8934('0x40')]['id'];}return db[_0x8934('0x27')][_0x8934('0x41')]({'where':{'id':_0x406d0a[_0x8934('0x3d')]['id']}})[_0x8934('0x22')](handleEntityNotFound(_0x419e30,null))[_0x8934('0x22')](saveUpdates(_0x406d0a[_0x8934('0x40')],null))[_0x8934('0x22')](respondWithResult(_0x419e30,null))[_0x8934('0x3b')](handleError(_0x419e30,null));};exports[_0x8934('0x42')]=function(_0x248d88,_0x53d058){return db[_0x8934('0x27')][_0x8934('0x41')]({'where':{'id':_0x248d88['params']['id']}})['then'](handleEntityNotFound(_0x53d058,null))['then'](removeEntity(_0x53d058,null))['catch'](handleError(_0x53d058,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index f725cd7..113523e 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 _0xc841=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash'];(function(_0x34b856,_0x2faac8){var _0x41455c=function(_0x568bbc){while(--_0x568bbc){_0x34b856['push'](_0x34b856['shift']());}};_0x41455c(++_0x2faac8);}(_0xc841,0xed));var _0x1c84=function(_0x107c11,_0x44c3f5){_0x107c11=_0x107c11-0x0;var _0x1a076d=_0xc841[_0x107c11];return _0x1a076d;};'use strict';var _=require(_0x1c84('0x0'));var util=require('util');var logger=require(_0x1c84('0x1'))(_0x1c84('0x2'));var moment=require(_0x1c84('0x3'));var BPromise=require('bluebird');var rp=require(_0x1c84('0x4'));var fs=require('fs');var path=require(_0x1c84('0x5'));var rimraf=require(_0x1c84('0x6'));var config=require(_0x1c84('0x7'));var attributes=require(_0x1c84('0x8'));module['exports']=function(_0x844ec3,_0x4c39e7){return _0x844ec3['define'](_0x1c84('0x9'),attributes,{'tableName':_0x1c84('0xa'),'paranoid':![],'indexes':[{'name':_0x1c84('0xb'),'fields':[_0x1c84('0xc'),_0x1c84('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xff84=['freshsales_unique_index','idField','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields'];(function(_0x247186,_0x1bc1a7){var _0x4ff0c1=function(_0x414a5e){while(--_0x414a5e){_0x247186['push'](_0x247186['shift']());}};_0x4ff0c1(++_0x1bc1a7);}(_0xff84,0x13a));var _0x4ff8=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xff84[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4ff8('0x0'));var moment=require(_0x4ff8('0x1'));var BPromise=require('bluebird');var rp=require(_0x4ff8('0x2'));var fs=require('fs');var path=require(_0x4ff8('0x3'));var rimraf=require(_0x4ff8('0x4'));var config=require(_0x4ff8('0x5'));var attributes=require(_0x4ff8('0x6'));module[_0x4ff8('0x7')]=function(_0xa8350e,_0x100238){return _0xa8350e[_0x4ff8('0x8')](_0x4ff8('0x9'),attributes,{'tableName':_0x4ff8('0xa'),'paranoid':![],'indexes':[{'name':_0x4ff8('0xb'),'fields':[_0x4ff8('0xc'),'FieldId'],'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 2f29850..b733eb3 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 _0x30bd=['FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x30bd,0xf7));var _0xd30b=function(_0x48a034,_0x1b990b){_0x48a034=_0x48a034-0x0;var _0x6ab270=_0x30bd[_0x48a034];return _0x6ab270;};'use strict';var _=require(_0xd30b('0x0'));var util=require(_0xd30b('0x1'));var moment=require('moment');var BPromise=require(_0xd30b('0x2'));var rs=require(_0xd30b('0x3'));var fs=require('fs');var Redis=require(_0xd30b('0x4'));var db=require(_0xd30b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd30b('0x6'))(_0xd30b('0x7'));var config=require(_0xd30b('0x8'));var jayson=require(_0xd30b('0x9'));var client=jayson[_0xd30b('0xa')][_0xd30b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4447e2,_0x1eabc0,_0x369998){return new BPromise(function(_0x3e8626,_0x1e2e9b){return client[_0xd30b('0xc')](_0x4447e2,_0x369998)[_0xd30b('0xd')](function(_0x1bdf87){logger['info'](_0xd30b('0xe'),_0x1eabc0,_0xd30b('0xf'));logger[_0xd30b('0x10')](_0xd30b('0x11'),_0x1eabc0,_0xd30b('0xf'),JSON[_0xd30b('0x12')](_0x1bdf87));if(_0x1bdf87[_0xd30b('0x13')]){if(_0x1bdf87[_0xd30b('0x13')]['code']===0x1f4){logger[_0xd30b('0x13')](_0xd30b('0xe'),_0x1eabc0,_0x1bdf87[_0xd30b('0x13')][_0xd30b('0x14')]);return _0x1e2e9b(_0x1bdf87[_0xd30b('0x13')][_0xd30b('0x14')]);}logger[_0xd30b('0x13')](_0xd30b('0xe'),_0x1eabc0,_0x1bdf87[_0xd30b('0x13')][_0xd30b('0x14')]);return _0x3e8626(_0x1bdf87['error']['message']);}else{logger[_0xd30b('0x15')]('FreshsalesField,\x20%s,\x20%s',_0x1eabc0,_0xd30b('0xf'));_0x3e8626(_0x1bdf87[_0xd30b('0x16')]['message']);}})[_0xd30b('0x17')](function(_0x479f91){logger[_0xd30b('0x13')](_0xd30b('0xe'),_0x1eabc0,_0x479f91);_0x1e2e9b(_0x479f91);});});} \ No newline at end of file +var _0x7ce1=['http','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x356bb6,_0x2a6853){var _0x4825fa=function(_0x18f565){while(--_0x18f565){_0x356bb6['push'](_0x356bb6['shift']());}};_0x4825fa(++_0x2a6853);}(_0x7ce1,0x131));var _0x17ce=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0x7ce1[_0x28394f];return _0x2618d2;};'use strict';var _=require('lodash');var util=require(_0x17ce('0x0'));var moment=require('moment');var BPromise=require(_0x17ce('0x1'));var rs=require(_0x17ce('0x2'));var fs=require('fs');var Redis=require(_0x17ce('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x17ce('0x4'));var logger=require(_0x17ce('0x5'))(_0x17ce('0x6'));var config=require(_0x17ce('0x7'));var jayson=require(_0x17ce('0x8'));var client=jayson[_0x17ce('0x9')][_0x17ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a4c53,_0x3a44ec,_0xccc1b8){return new BPromise(function(_0x301e7d,_0x270274){return client['request'](_0x2a4c53,_0xccc1b8)['then'](function(_0x4af7df){logger[_0x17ce('0xb')](_0x17ce('0xc'),_0x3a44ec,_0x17ce('0xd'));logger[_0x17ce('0xe')](_0x17ce('0xf'),_0x3a44ec,_0x17ce('0xd'),JSON[_0x17ce('0x10')](_0x4af7df));if(_0x4af7df[_0x17ce('0x11')]){if(_0x4af7df['error'][_0x17ce('0x12')]===0x1f4){logger['error'](_0x17ce('0xc'),_0x3a44ec,_0x4af7df[_0x17ce('0x11')][_0x17ce('0x13')]);return _0x270274(_0x4af7df[_0x17ce('0x11')][_0x17ce('0x13')]);}logger[_0x17ce('0x11')](_0x17ce('0xc'),_0x3a44ec,_0x4af7df[_0x17ce('0x11')]['message']);return _0x301e7d(_0x4af7df[_0x17ce('0x11')][_0x17ce('0x13')]);}else{logger[_0x17ce('0xb')](_0x17ce('0xc'),_0x3a44ec,_0x17ce('0xd'));_0x301e7d(_0x4af7df[_0x17ce('0x14')][_0x17ce('0x13')]);}})['catch'](function(_0x3039b7){logger[_0x17ce('0x11')](_0x17ce('0xc'),_0x3a44ec,_0x3039b7);_0x270274(_0x3039b7);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 3a06537..2d927c1 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 _0xb761=['getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','index','get','/:id','isAuthenticated','show','/:id/configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb761,0x113));var _0x1b76=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0xb761[_0x2becba];return _0x90b5dd;};'use strict';var multer=require(_0x1b76('0x0'));var util=require(_0x1b76('0x1'));var path=require(_0x1b76('0x2'));var timeout=require(_0x1b76('0x3'));var express=require(_0x1b76('0x4'));var router=express[_0x1b76('0x5')]();var auth=require(_0x1b76('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSalesforceAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1b76('0x7')]);router[_0x1b76('0x8')](_0x1b76('0x9'),auth[_0x1b76('0xa')](),controller[_0x1b76('0xb')]);router['get'](_0x1b76('0xc'),auth['isAuthenticated'](),controller[_0x1b76('0xd')]);router[_0x1b76('0x8')](_0x1b76('0xe'),auth[_0x1b76('0xa')](),controller[_0x1b76('0xf')]);router[_0x1b76('0x10')]('/',auth[_0x1b76('0xa')](),controller[_0x1b76('0x11')]);router[_0x1b76('0x10')](_0x1b76('0xc'),auth['isAuthenticated'](),controller[_0x1b76('0x12')]);router[_0x1b76('0x13')](_0x1b76('0x9'),auth[_0x1b76('0xa')](),controller[_0x1b76('0x14')]);router[_0x1b76('0x15')](_0x1b76('0x9'),auth[_0x1b76('0xa')](),controller[_0x1b76('0x16')]);module[_0x1b76('0x17')]=router; \ No newline at end of file +var _0x22d3=['delete','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0x22d3,0x66));var _0x322d=function(_0x5d225a,_0x2debe9){_0x5d225a=_0x5d225a-0x0;var _0x1e7761=_0x22d3[_0x5d225a];return _0x1e7761;};'use strict';var multer=require('multer');var util=require(_0x322d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x322d('0x1'));var router=express[_0x322d('0x2')]();var auth=require(_0x322d('0x3'));var interaction=require(_0x322d('0x4'));var config=require(_0x322d('0x5'));var controller=require('./intSalesforceAccount.controller');router[_0x322d('0x6')]('/',auth[_0x322d('0x7')](),controller['index']);router[_0x322d('0x6')](_0x322d('0x8'),auth[_0x322d('0x7')](),controller[_0x322d('0x9')]);router['get'](_0x322d('0xa'),auth[_0x322d('0x7')](),controller[_0x322d('0xb')]);router[_0x322d('0x6')](_0x322d('0xc'),auth[_0x322d('0x7')](),controller[_0x322d('0xd')]);router[_0x322d('0xe')]('/',auth[_0x322d('0x7')](),controller[_0x322d('0xf')]);router['post']('/:id/configurations',auth[_0x322d('0x7')](),controller['addConfiguration']);router[_0x322d('0x10')]('/:id',auth[_0x322d('0x7')](),controller[_0x322d('0x11')]);router[_0x322d('0x12')](_0x322d('0x8'),auth[_0x322d('0x7')](),controller['destroy']);module[_0x322d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index f15caa4..ef9eeaa 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 _0x7217=['sequelize','STRING','username','ENUM','integrationTab','newTab'];(function(_0x8a917c,_0x19c5f6){var _0x2c704e=function(_0x342f3a){while(--_0x342f3a){_0x8a917c['push'](_0x8a917c['shift']());}};_0x2c704e(++_0x19c5f6);}(_0x7217,0x19e));var _0x7721=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x7217[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')]},'description':{'type':Sequelize[_0x7721('0x1')]},'username':{'type':Sequelize[_0x7721('0x1')],'unique':_0x7721('0x2')},'remoteUri':{'type':Sequelize[_0x7721('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x7721('0x1')]},'securityToken':{'type':Sequelize[_0x7721('0x1')]},'serverUrl':{'type':Sequelize[_0x7721('0x1')]},'type':{'type':Sequelize[_0x7721('0x3')](_0x7721('0x4'),_0x7721('0x5')),'defaultValue':_0x7721('0x4')}}; \ No newline at end of file +var _0xf494=['exports','STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x5504b2,_0x1cb150){var _0xf90b03=function(_0x3c3585){while(--_0x3c3585){_0x5504b2['push'](_0x5504b2['shift']());}};_0xf90b03(++_0x1cb150);}(_0xf494,0x1c6));var _0x4f49=function(_0x455108,_0x375582){_0x455108=_0x455108-0x0;var _0x1fca42=_0xf494[_0x455108];return _0x1fca42;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4f49('0x2')],'unique':_0x4f49('0x3')},'remoteUri':{'type':Sequelize[_0x4f49('0x2')]},'password':{'type':Sequelize[_0x4f49('0x2')]},'clientId':{'type':Sequelize[_0x4f49('0x2')]},'clientSecret':{'type':Sequelize[_0x4f49('0x2')]},'securityToken':{'type':Sequelize[_0x4f49('0x2')]},'serverUrl':{'type':Sequelize[_0x4f49('0x2')]},'type':{'type':Sequelize[_0x4f49('0x4')](_0x4f49('0x5'),_0x4f49('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 844f4d2..574ff43 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 _0x1261=['where','VIRTUAL','options','include','params','keys','length','includeAll','create','body','find','getConfigurations','findOne','SalesforceConfiguration','filter','merge','addConfiguration','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','securityToken','slice','lastIndexOf','Connection','clientSecret','login','password','concat','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','CallType','Priority','Status','Type','Origin','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','picklistValues','label','value','boolean','False','getFields,\x20%s,\x20%s,\x20%s','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','request\x20sent','debug','stringify','error','code','message','SalesforceAccount,\x20%s,\x20%s','catch','sendStatus','end','json','count','offset','status','apply','reject','save','update','destroy','stack','send','map','SalesforceAccount','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1261,0x144));var _0x1126=function(_0x573c9e,_0xd4ab71){_0x573c9e=_0x573c9e-0x0;var _0x5d0714=_0x1261[_0x573c9e];return _0x5d0714;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var db=require(_0x1126('0x16'))['db'];var integrations=require(_0x1126('0x17'));var jayson=require(_0x1126('0x18'));var client=jayson[_0x1126('0x19')][_0x1126('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3f10e9,_0xd8ca42,_0x2048ad){if(_0x2048ad){var _0x43850b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x43850b['test'](_0xd8ca42)){return _0x3f10e9;}else{throw new db['Sequelize'][(_0x1126('0x1b'))](_0x1126('0x1c'));}}else{return _0x3f10e9;}}function respondWithRpcPromise(_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return new BPromise(function(_0x35fe9f,_0x42f379){var _0x257b5f=_0x4794a7||client;return _0x257b5f['request'](_0x279455,_0x45149c)[_0x1126('0x1d')](function(_0x1695f6){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x4be0c6,_0x1126('0x1e'));logger[_0x1126('0x1f')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4be0c6,'request\x20sent',JSON[_0x1126('0x20')](_0x1695f6));if(_0x1695f6['error']){if(_0x1695f6[_0x1126('0x21')][_0x1126('0x22')]===0x1f4){logger[_0x1126('0x21')]('SalesforceAccount,\x20%s,\x20%s',_0x4be0c6,_0x1695f6[_0x1126('0x21')]['message']);return _0x42f379(_0x1695f6['error'][_0x1126('0x23')]);}logger[_0x1126('0x21')](_0x1126('0x24'),_0x4be0c6,_0x1695f6[_0x1126('0x21')]['message']);return _0x35fe9f(_0x1695f6[_0x1126('0x21')][_0x1126('0x23')]);}else{logger['info'](_0x1126('0x24'),_0x4be0c6,'request\x20sent');_0x35fe9f(_0x1695f6['result']['message']);}})[_0x1126('0x25')](function(_0x15bcc3){logger[_0x1126('0x21')](_0x1126('0x24'),_0x4be0c6,_0x15bcc3);_0x42f379(_0x15bcc3);});});}function respondWithStatusCode(_0x566c09,_0x1b07a7){_0x1b07a7=_0x1b07a7||0xcc;return function(_0xea0971){if(_0xea0971){return _0x566c09[_0x1126('0x26')](_0x1b07a7);}return _0x566c09['status'](_0x1b07a7)[_0x1126('0x27')]();};}function respondWithResult(_0x375e59,_0xa293f4){_0xa293f4=_0xa293f4||0xc8;return function(_0x5ddf63){if(_0x5ddf63){return _0x375e59['status'](_0xa293f4)[_0x1126('0x28')](_0x5ddf63);}};}function respondWithFilteredResult(_0x39bf0e,_0x55e195){return function(_0x2fb797){if(_0x2fb797){var _0x23d2bc=_0x2fb797[_0x1126('0x29')],_0x4a334a=_0x55e195['offset'],_0x3fa694=_0x55e195[_0x1126('0x2a')]+_0x55e195['limit'],_0x4bf807;if(_0x3fa694>=_0x23d2bc){_0x3fa694=_0x23d2bc;_0x4bf807=0xc8;}else{_0x4bf807=0xce;}_0x39bf0e[_0x1126('0x2b')](_0x4bf807);return _0x39bf0e['set']('Content-Range',_0x4a334a+'-'+_0x3fa694+'/'+_0x23d2bc)['json'](_0x2fb797);}return null;};}function patchUpdates(_0x17646e){return function(_0xa8906d){try{jsonpatch[_0x1126('0x2c')](_0xa8906d,_0x17646e,!![]);}catch(_0x5b8bea){return BPromise[_0x1126('0x2d')](_0x5b8bea);}return _0xa8906d[_0x1126('0x2e')]();};}function saveUpdates(_0x56f7f8,_0x3dd50e){return function(_0x1e80aa){if(_0x1e80aa){return _0x1e80aa[_0x1126('0x2f')](_0x56f7f8)[_0x1126('0x1d')](function(_0x5836a2){return _0x5836a2;});}return null;};}function removeEntity(_0x5ecbc3,_0x2a7edc){return function(_0x19e6e4){if(_0x19e6e4){return _0x19e6e4[_0x1126('0x30')]()[_0x1126('0x1d')](function(){_0x5ecbc3['status'](0xcc)[_0x1126('0x27')]();});}};}function handleEntityNotFound(_0x6f4312,_0x313ebe){return function(_0x22436c){if(!_0x22436c){_0x6f4312[_0x1126('0x26')](0x194);}return _0x22436c;};}function handleError(_0x5df232,_0x2a0dfe){_0x2a0dfe=_0x2a0dfe||0x1f4;return function(_0x457efd){logger[_0x1126('0x21')](_0x457efd[_0x1126('0x31')]);if(_0x457efd['name']){delete _0x457efd['name'];}_0x5df232[_0x1126('0x2b')](_0x2a0dfe)[_0x1126('0x32')](_0x457efd);};}exports['index']=function(_0xde37cf,_0xf3c21b){var _0x11b0f6={},_0x5c08b9={},_0x4b3859={'count':0x0,'rows':[]};var _0x522c14=_[_0x1126('0x33')](db[_0x1126('0x34')][_0x1126('0x35')],function(_0x4a202e){return{'name':_0x4a202e[_0x1126('0x36')],'type':_0x4a202e['type'][_0x1126('0x37')]};});_0x5c08b9[_0x1126('0x38')]=_[_0x1126('0x33')](_0x522c14,_0x1126('0x39'));_0x5c08b9[_0x1126('0x3a')]=_['keys'](_0xde37cf[_0x1126('0x3a')]);_0x5c08b9[_0x1126('0x3b')]=_[_0x1126('0x3c')](_0x5c08b9[_0x1126('0x38')],_0x5c08b9[_0x1126('0x3a')]);_0x11b0f6[_0x1126('0x3d')]=_[_0x1126('0x3c')](_0x5c08b9['model'],qs[_0x1126('0x3e')](_0xde37cf[_0x1126('0x3a')][_0x1126('0x3e')]));_0x11b0f6[_0x1126('0x3d')]=_0x11b0f6[_0x1126('0x3d')]['length']?_0x11b0f6['attributes']:_0x5c08b9[_0x1126('0x38')];if(!_0xde37cf[_0x1126('0x3a')][_0x1126('0x3f')](_0x1126('0x40'))){_0x11b0f6[_0x1126('0x41')]=qs[_0x1126('0x41')](_0xde37cf['query']['limit']);_0x11b0f6['offset']=qs[_0x1126('0x2a')](_0xde37cf['query'][_0x1126('0x2a')]);}_0x11b0f6[_0x1126('0x42')]=qs[_0x1126('0x43')](_0xde37cf[_0x1126('0x3a')]['sort']);_0x11b0f6['where']=qs[_0x1126('0x3b')](_[_0x1126('0x44')](_0xde37cf[_0x1126('0x3a')],_0x5c08b9['filters']));if(_0xde37cf[_0x1126('0x3a')]['filter']){_0x11b0f6[_0x1126('0x45')]=_['merge'](_0x11b0f6[_0x1126('0x45')],{'$or':_[_0x1126('0x33')](_0x522c14,function(_0x1006fb){if(_0x1006fb['type']!==_0x1126('0x46')){var _0x2ffccc={};_0x2ffccc[_0x1006fb[_0x1126('0x39')]]={'$like':'%'+_0xde37cf['query']['filter']+'%'};return _0x2ffccc;}})});}_0x11b0f6=_['merge']({},_0x11b0f6,_0xde37cf[_0x1126('0x47')]);var _0x520b62={'where':_0x11b0f6[_0x1126('0x45')]};return db['SalesforceAccount'][_0x1126('0x29')](_0x520b62)[_0x1126('0x1d')](function(_0x146066){_0x4b3859[_0x1126('0x29')]=_0x146066;if(_0xde37cf[_0x1126('0x3a')]['includeAll']){_0x11b0f6[_0x1126('0x48')]=[{'all':!![]}];}return db[_0x1126('0x34')]['findAll'](_0x11b0f6);})[_0x1126('0x1d')](function(_0x13dc39){_0x4b3859['rows']=_0x13dc39;return _0x4b3859;})[_0x1126('0x1d')](respondWithFilteredResult(_0xf3c21b,_0x11b0f6))[_0x1126('0x25')](handleError(_0xf3c21b,null));};exports['show']=function(_0x3e4eeb,_0xbdde58){var _0x213a76={'raw':![],'where':{'id':_0x3e4eeb[_0x1126('0x49')]['id']}},_0x59656d={};_0x59656d[_0x1126('0x38')]=_[_0x1126('0x4a')](db[_0x1126('0x34')][_0x1126('0x35')]);_0x59656d[_0x1126('0x3a')]=_[_0x1126('0x4a')](_0x3e4eeb[_0x1126('0x3a')]);_0x59656d['filters']=_[_0x1126('0x3c')](_0x59656d['model'],_0x59656d[_0x1126('0x3a')]);_0x213a76[_0x1126('0x3d')]=_['intersection'](_0x59656d['model'],qs[_0x1126('0x3e')](_0x3e4eeb[_0x1126('0x3a')][_0x1126('0x3e')]));_0x213a76['attributes']=_0x213a76[_0x1126('0x3d')][_0x1126('0x4b')]?_0x213a76[_0x1126('0x3d')]:_0x59656d[_0x1126('0x38')];if(_0x3e4eeb['query'][_0x1126('0x4c')]){_0x213a76[_0x1126('0x48')]=[{'all':!![]}];}_0x213a76=_['merge']({},_0x213a76,_0x3e4eeb['options']);return db['SalesforceAccount']['find'](_0x213a76)[_0x1126('0x1d')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x1d')](respondWithResult(_0xbdde58,null))['catch'](handleError(_0xbdde58,null));};exports[_0x1126('0x4d')]=function(_0x1c7a2b,_0x38093e){return db[_0x1126('0x34')][_0x1126('0x4d')](_0x1c7a2b['body'],{})[_0x1126('0x1d')](respondWithResult(_0x38093e,0xc9))[_0x1126('0x25')](handleError(_0x38093e,null));};exports['update']=function(_0x322016,_0x476aca){if(_0x322016[_0x1126('0x4e')]['id']){delete _0x322016[_0x1126('0x4e')]['id'];}return db[_0x1126('0x34')]['find']({'where':{'id':_0x322016[_0x1126('0x49')]['id']}})['then'](handleEntityNotFound(_0x476aca,null))[_0x1126('0x1d')](saveUpdates(_0x322016[_0x1126('0x4e')],null))[_0x1126('0x1d')](respondWithResult(_0x476aca,null))['catch'](handleError(_0x476aca,null));};exports[_0x1126('0x30')]=function(_0x2340f8,_0x5763b4){return db[_0x1126('0x34')][_0x1126('0x4f')]({'where':{'id':_0x2340f8[_0x1126('0x49')]['id']}})['then'](handleEntityNotFound(_0x5763b4,null))[_0x1126('0x1d')](removeEntity(_0x5763b4,null))[_0x1126('0x25')](handleError(_0x5763b4,null));};exports[_0x1126('0x50')]=function(_0x308ee4,_0x128c94,_0x26949c){var _0x30c848={};var _0x114be2={};var _0x47e53d;var _0x2b23e3;return db[_0x1126('0x34')][_0x1126('0x51')]({'where':{'id':_0x308ee4[_0x1126('0x49')]['id']}})[_0x1126('0x1d')](handleEntityNotFound(_0x128c94,null))['then'](function(_0xcc1a95){if(_0xcc1a95){_0x47e53d=_0xcc1a95;_0x114be2[_0x1126('0x38')]=_['keys'](db[_0x1126('0x52')]['rawAttributes']);_0x114be2[_0x1126('0x3a')]=_[_0x1126('0x4a')](_0x308ee4['query']);_0x114be2[_0x1126('0x3b')]=_[_0x1126('0x3c')](_0x114be2[_0x1126('0x38')],_0x114be2['query']);_0x30c848[_0x1126('0x3d')]=_['intersection'](_0x114be2['model'],qs[_0x1126('0x3e')](_0x308ee4[_0x1126('0x3a')][_0x1126('0x3e')]));_0x30c848[_0x1126('0x3d')]=_0x30c848[_0x1126('0x3d')][_0x1126('0x4b')]?_0x30c848[_0x1126('0x3d')]:_0x114be2['model'];_0x30c848[_0x1126('0x42')]=qs[_0x1126('0x43')](_0x308ee4[_0x1126('0x3a')][_0x1126('0x43')]);_0x30c848[_0x1126('0x45')]=qs[_0x1126('0x3b')](_['pick'](_0x308ee4['query'],_0x114be2[_0x1126('0x3b')]));if(_0x308ee4[_0x1126('0x3a')]['filter']){_0x30c848['where']=_['merge'](_0x30c848['where'],{'$or':_[_0x1126('0x33')](_0x30c848[_0x1126('0x3d')],function(_0x3440c5){var _0x50f9c7={};_0x50f9c7[_0x3440c5]={'$like':'%'+_0x308ee4[_0x1126('0x3a')][_0x1126('0x53')]+'%'};return _0x50f9c7;})});}_0x30c848=_[_0x1126('0x54')]({},_0x30c848,_0x308ee4[_0x1126('0x47')]);return _0x47e53d[_0x1126('0x50')](_0x30c848);}})[_0x1126('0x1d')](function(_0x131056){if(_0x131056){_0x2b23e3=_0x131056['length'];if(!_0x308ee4[_0x1126('0x3a')][_0x1126('0x3f')](_0x1126('0x40'))){_0x30c848[_0x1126('0x41')]=qs[_0x1126('0x41')](_0x308ee4['query']['limit']);_0x30c848[_0x1126('0x2a')]=qs[_0x1126('0x2a')](_0x308ee4['query'][_0x1126('0x2a')]);}return _0x47e53d[_0x1126('0x50')](_0x30c848);}})[_0x1126('0x1d')](function(_0x6a41c0){if(_0x6a41c0){return _0x6a41c0?{'count':_0x2b23e3,'rows':_0x6a41c0}:null;}})[_0x1126('0x1d')](respondWithResult(_0x128c94,null))[_0x1126('0x25')](handleError(_0x128c94,null));};exports[_0x1126('0x55')]=function(_0x247f12,_0xd20fbe,_0x3d5e15){if(_0x247f12[_0x1126('0x4e')]['id']){delete _0x247f12[_0x1126('0x4e')]['id'];}return db[_0x1126('0x34')]['findOne']({'where':{'id':_0x247f12[_0x1126('0x49')]['id']}})[_0x1126('0x1d')](handleEntityNotFound(_0xd20fbe,null))[_0x1126('0x1d')](function(_0x53ea9a){if(_0x53ea9a){_0x247f12['body'][_0x1126('0x56')]=_0x53ea9a['id'];_0x247f12[_0x1126('0x4e')][_0x1126('0x57')]=integrations[_0x1126('0x58')](_0x247f12['body']['channel'],_0x247f12['body'][_0x1126('0x59')]);_0x247f12[_0x1126('0x4e')][_0x1126('0x5a')]=integrations[_0x1126('0x5b')](_0x247f12['body'][_0x1126('0x5c')],_0x247f12['body'][_0x1126('0x59')]);return db[_0x1126('0x52')][_0x1126('0x4d')](_0x247f12[_0x1126('0x4e')],{'include':[{'model':db[_0x1126('0x5d')],'as':_0x1126('0x57')},{'model':db[_0x1126('0x5d')],'as':'Descriptions'}]});}return null;})[_0x1126('0x1d')](respondWithResult(_0xd20fbe,null))['catch'](handleError(_0xd20fbe,null));};exports[_0x1126('0x5e')]=function(_0x906531,_0x4dd275,_0x376175){var _0x372fbe;var _0x5f3b19='';var _0x29daa6=_0x1126('0x5f');return db['SalesforceAccount']['findOne']({'where':{'id':_0x906531[_0x1126('0x49')]['id']},'attributes':['id',_0x1126('0x60'),_0x1126('0x61'),'clientSecret','username','password',_0x1126('0x62')]})['then'](handleEntityNotFound(_0x4dd275,null))['then'](function(_0x2db627){if(_0x2db627){_0x5f3b19=_0x2db627['remoteUri'];var _0x1f320e=_0x5f3b19[_0x1126('0x63')](-0x1);if(_0x1f320e==='/'){_0x5f3b19=_0x5f3b19['substring'](0x0,_0x5f3b19[_0x1126('0x64')](_0x1f320e));}_0x372fbe=new jsforce[(_0x1126('0x65'))]({'oauth2':{'loginUrl':_0x5f3b19,'clientId':_0x2db627[_0x1126('0x61')],'clientSecret':_0x2db627[_0x1126('0x66')]}});return _0x372fbe[_0x1126('0x67')](_0x2db627['username'],_0x2db627[_0x1126('0x68')][_0x1126('0x69')](_0x2db627['securityToken']));}})[_0x1126('0x1d')](function(_0x2d6fcf){if(_0x2d6fcf){if(!_[_0x1126('0x6a')](_0x906531[_0x1126('0x3a')][_0x1126('0x6b')])){_0x29daa6=_0x906531[_0x1126('0x3a')][_0x1126('0x6b')];}return _0x372fbe[_0x1126('0x6c')](_0x29daa6)[_0x1126('0x6d')]();}})[_0x1126('0x1d')](function(_0xbe2a8f){var _0x3af321=[_0x1126('0x6e'),_0x1126('0x6f'),_0x1126('0x70'),_0x1126('0x71'),'IsArchived',_0x1126('0x72'),_0x1126('0x73'),_0x1126('0x74')];if(!_[_0x1126('0x6a')](_0x906531[_0x1126('0x3a')]['ticketType'])&&_0x906531[_0x1126('0x3a')]['ticketType']==='Case'){_0x3af321=[_0x1126('0x74'),_0x1126('0x75'),'Reason','Status',_0x1126('0x72'),_0x1126('0x76'),_0x1126('0x77'),_0x1126('0x78')];}if(_0xbe2a8f){_[_0x1126('0x79')](_0xbe2a8f[_0x1126('0x3e')],function(_0x2d7150){return _0x2d7150[_0x1126('0x7a')]===![]&&!_0x3af321[_0x1126('0x7b')](_0x2d7150['name']);});return{'count':_0xbe2a8f[_0x1126('0x3e')][_0x1126('0x4b')],'rows':_[_0x1126('0x33')](_0xbe2a8f[_0x1126('0x3e')],function(_0x23c4ab){return{'id':_0x23c4ab[_0x1126('0x39')],'name':_0x23c4ab['label'],'custom':_0x23c4ab[_0x1126('0x7a')],'options':_0x23c4ab[_0x1126('0x7c')][_0x1126('0x4b')]>0x0?_[_0x1126('0x33')](_0x23c4ab[_0x1126('0x7c')],function(_0x1796eb){return{'name':_0x1796eb[_0x1126('0x7d')],'value':_0x1796eb[_0x1126('0x7e')]};}):_0x23c4ab[_0x1126('0x59')]==_0x1126('0x7f')?[{'name':'True','value':'true'},{'name':_0x1126('0x80'),'value':'false'}]:[]};})};}})[_0x1126('0x1d')](respondWithResult(_0x4dd275,null))['catch'](function(_0x4461ae){var _0x5059d3=_0x906531[_0x1126('0x3a')]['test']?0x1f4:_0x4461ae['statusCode']||0x1f4;logger['error'](_0x1126('0x81'),_0x1126('0x5e'),_0x5059d3,JSON['stringify'](_0x4461ae));delete _0x4461ae['name'];if(_0x5059d3===0x191){_0x5059d3=0x190;}_0x4dd275[_0x1126('0x2b')](_0x5059d3)[_0x1126('0x32')](_0x906531[_0x1126('0x3a')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4461ae[_0x1126('0x82')]}:_0x4461ae);});}; \ No newline at end of file +var _0x0295=['info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','SalesforceAccount','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceConfiguration','SalesforceField','getFields','clientId','clientSecret','username','securityToken','remoteUri','substring','lastIndexOf','Connection','password','concat','isNil','ticketType','sobject','describe','CallDisposition','CallObject','CallType','IsArchived','Priority','Status','Case','IsEscalated','SuppliedName','SuppliedCompany','custom','label','picklistValues','value','True','False','false','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then'];(function(_0x58c3aa,_0x28c7c7){var _0x442385=function(_0x179c8b){while(--_0x179c8b){_0x58c3aa['push'](_0x58c3aa['shift']());}};_0x442385(++_0x28c7c7);}(_0x0295,0x1f0));var _0x5029=function(_0x73a84b,_0x23d3bb){_0x73a84b=_0x73a84b-0x0;var _0x9e2a66=_0x0295[_0x73a84b];return _0x9e2a66;};'use strict';var pdf=require(_0x5029('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5029('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5029('0x2'));var BPromise=require(_0x5029('0x3'));var Mustache=require(_0x5029('0x4'));var util=require(_0x5029('0x5'));var path=require(_0x5029('0x6'));var sox=require(_0x5029('0x7'));var csv=require(_0x5029('0x8'));var ejs=require(_0x5029('0x9'));var fs=require('fs');var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5029('0x14'));var jayson=require(_0x5029('0x15'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x49f836,_0x4aebb6,_0x2484ac){if(_0x2484ac){var _0x2e0369=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e0369[_0x5029('0x16')](_0x4aebb6)){return _0x49f836;}else{throw new db[(_0x5029('0x17'))][(_0x5029('0x18'))](_0x5029('0x19'));}}else{return _0x49f836;}}function respondWithRpcPromise(_0xe278b7,_0x317c20,_0x10bf55,_0x326923){return new BPromise(function(_0x457c73,_0x353cba){var _0x3786b5=_0x326923||client;return _0x3786b5[_0x5029('0x1a')](_0xe278b7,_0x10bf55)[_0x5029('0x1b')](function(_0x4f7ab4){logger[_0x5029('0x1c')](_0x5029('0x1d'),_0x317c20,_0x5029('0x1e'));logger[_0x5029('0x1f')](_0x5029('0x20'),_0x317c20,_0x5029('0x1e'),JSON[_0x5029('0x21')](_0x4f7ab4));if(_0x4f7ab4['error']){if(_0x4f7ab4[_0x5029('0x22')]['code']===0x1f4){logger[_0x5029('0x22')](_0x5029('0x1d'),_0x317c20,_0x4f7ab4[_0x5029('0x22')][_0x5029('0x23')]);return _0x353cba(_0x4f7ab4['error']['message']);}logger[_0x5029('0x22')]('SalesforceAccount,\x20%s,\x20%s',_0x317c20,_0x4f7ab4[_0x5029('0x22')][_0x5029('0x23')]);return _0x457c73(_0x4f7ab4[_0x5029('0x22')][_0x5029('0x23')]);}else{logger[_0x5029('0x1c')](_0x5029('0x1d'),_0x317c20,_0x5029('0x1e'));_0x457c73(_0x4f7ab4[_0x5029('0x24')][_0x5029('0x23')]);}})['catch'](function(_0x564866){logger['error'](_0x5029('0x1d'),_0x317c20,_0x564866);_0x353cba(_0x564866);});});}function respondWithStatusCode(_0x45666c,_0x51093c){_0x51093c=_0x51093c||0xcc;return function(_0x5727e9){if(_0x5727e9){return _0x45666c[_0x5029('0x25')](_0x51093c);}return _0x45666c[_0x5029('0x26')](_0x51093c)[_0x5029('0x27')]();};}function respondWithResult(_0x5527fc,_0x2c501f){_0x2c501f=_0x2c501f||0xc8;return function(_0xb14bc){if(_0xb14bc){return _0x5527fc['status'](_0x2c501f)[_0x5029('0x28')](_0xb14bc);}};}function respondWithFilteredResult(_0x31f0a0,_0x16ad8b){return function(_0x4a24b9){if(_0x4a24b9){var _0x32da06=_0x4a24b9[_0x5029('0x29')],_0x251f99=_0x16ad8b[_0x5029('0x2a')],_0xe5313e=_0x16ad8b['offset']+_0x16ad8b[_0x5029('0x2b')],_0x4b6f92;if(_0xe5313e>=_0x32da06){_0xe5313e=_0x32da06;_0x4b6f92=0xc8;}else{_0x4b6f92=0xce;}_0x31f0a0[_0x5029('0x26')](_0x4b6f92);return _0x31f0a0[_0x5029('0x2c')](_0x5029('0x2d'),_0x251f99+'-'+_0xe5313e+'/'+_0x32da06)[_0x5029('0x28')](_0x4a24b9);}return null;};}function patchUpdates(_0x2a1ed6){return function(_0x44255a){try{jsonpatch[_0x5029('0x2e')](_0x44255a,_0x2a1ed6,!![]);}catch(_0x250156){return BPromise[_0x5029('0x2f')](_0x250156);}return _0x44255a[_0x5029('0x30')]();};}function saveUpdates(_0x4519c8,_0x4ff3db){return function(_0x11ae38){if(_0x11ae38){return _0x11ae38['update'](_0x4519c8)[_0x5029('0x1b')](function(_0x4f672e){return _0x4f672e;});}return null;};}function removeEntity(_0x48f387,_0x2bc434){return function(_0x447680){if(_0x447680){return _0x447680[_0x5029('0x31')]()['then'](function(){_0x48f387[_0x5029('0x26')](0xcc)[_0x5029('0x27')]();});}};}function handleEntityNotFound(_0x3f20fb,_0x29c59a){return function(_0x1bb896){if(!_0x1bb896){_0x3f20fb[_0x5029('0x25')](0x194);}return _0x1bb896;};}function handleError(_0x46ec59,_0x22205e){_0x22205e=_0x22205e||0x1f4;return function(_0x456cfc){logger['error'](_0x456cfc[_0x5029('0x32')]);if(_0x456cfc[_0x5029('0x33')]){delete _0x456cfc[_0x5029('0x33')];}_0x46ec59[_0x5029('0x26')](_0x22205e)['send'](_0x456cfc);};}exports[_0x5029('0x34')]=function(_0x388cca,_0x3e2d88){var _0x594549={},_0x4904cc={},_0x2d1ccb={'count':0x0,'rows':[]};var _0x17756b=_['map'](db['SalesforceAccount'][_0x5029('0x35')],function(_0x157969){return{'name':_0x157969[_0x5029('0x36')],'type':_0x157969[_0x5029('0x37')][_0x5029('0x38')]};});_0x4904cc[_0x5029('0x39')]=_[_0x5029('0x3a')](_0x17756b,_0x5029('0x33'));_0x4904cc[_0x5029('0x3b')]=_[_0x5029('0x3c')](_0x388cca[_0x5029('0x3b')]);_0x4904cc[_0x5029('0x3d')]=_[_0x5029('0x3e')](_0x4904cc[_0x5029('0x39')],_0x4904cc['query']);_0x594549['attributes']=_[_0x5029('0x3e')](_0x4904cc[_0x5029('0x39')],qs[_0x5029('0x3f')](_0x388cca['query'][_0x5029('0x3f')]));_0x594549[_0x5029('0x40')]=_0x594549['attributes'][_0x5029('0x41')]?_0x594549['attributes']:_0x4904cc[_0x5029('0x39')];if(!_0x388cca['query'][_0x5029('0x42')](_0x5029('0x43'))){_0x594549[_0x5029('0x2b')]=qs[_0x5029('0x2b')](_0x388cca[_0x5029('0x3b')][_0x5029('0x2b')]);_0x594549[_0x5029('0x2a')]=qs[_0x5029('0x2a')](_0x388cca[_0x5029('0x3b')]['offset']);}_0x594549[_0x5029('0x44')]=qs[_0x5029('0x45')](_0x388cca[_0x5029('0x3b')][_0x5029('0x45')]);_0x594549[_0x5029('0x46')]=qs[_0x5029('0x3d')](_['pick'](_0x388cca[_0x5029('0x3b')],_0x4904cc[_0x5029('0x3d')]));if(_0x388cca[_0x5029('0x3b')][_0x5029('0x47')]){_0x594549[_0x5029('0x46')]=_['merge'](_0x594549[_0x5029('0x46')],{'$or':_[_0x5029('0x3a')](_0x17756b,function(_0x248556){if(_0x248556[_0x5029('0x37')]!==_0x5029('0x48')){var _0x128aff={};_0x128aff[_0x248556[_0x5029('0x33')]]={'$like':'%'+_0x388cca[_0x5029('0x3b')][_0x5029('0x47')]+'%'};return _0x128aff;}})});}_0x594549=_['merge']({},_0x594549,_0x388cca[_0x5029('0x49')]);var _0x27d2ad={'where':_0x594549[_0x5029('0x46')]};return db[_0x5029('0x4a')]['count'](_0x27d2ad)['then'](function(_0x17a515){_0x2d1ccb[_0x5029('0x29')]=_0x17a515;if(_0x388cca[_0x5029('0x3b')][_0x5029('0x4b')]){_0x594549[_0x5029('0x4c')]=[{'all':!![]}];}return db[_0x5029('0x4a')][_0x5029('0x4d')](_0x594549);})[_0x5029('0x1b')](function(_0x1257a4){_0x2d1ccb[_0x5029('0x4e')]=_0x1257a4;return _0x2d1ccb;})[_0x5029('0x1b')](respondWithFilteredResult(_0x3e2d88,_0x594549))[_0x5029('0x4f')](handleError(_0x3e2d88,null));};exports[_0x5029('0x50')]=function(_0x18f1f5,_0x3168bd){var _0x175cc0={'raw':![],'where':{'id':_0x18f1f5[_0x5029('0x51')]['id']}},_0x10fc07={};_0x10fc07[_0x5029('0x39')]=_[_0x5029('0x3c')](db[_0x5029('0x4a')]['rawAttributes']);_0x10fc07[_0x5029('0x3b')]=_['keys'](_0x18f1f5[_0x5029('0x3b')]);_0x10fc07[_0x5029('0x3d')]=_['intersection'](_0x10fc07['model'],_0x10fc07[_0x5029('0x3b')]);_0x175cc0['attributes']=_['intersection'](_0x10fc07[_0x5029('0x39')],qs[_0x5029('0x3f')](_0x18f1f5[_0x5029('0x3b')]['fields']));_0x175cc0['attributes']=_0x175cc0[_0x5029('0x40')][_0x5029('0x41')]?_0x175cc0['attributes']:_0x10fc07[_0x5029('0x39')];if(_0x18f1f5['query'][_0x5029('0x4b')]){_0x175cc0['include']=[{'all':!![]}];}_0x175cc0=_[_0x5029('0x52')]({},_0x175cc0,_0x18f1f5[_0x5029('0x49')]);return db[_0x5029('0x4a')][_0x5029('0x53')](_0x175cc0)[_0x5029('0x1b')](handleEntityNotFound(_0x3168bd,null))[_0x5029('0x1b')](respondWithResult(_0x3168bd,null))[_0x5029('0x4f')](handleError(_0x3168bd,null));};exports[_0x5029('0x54')]=function(_0x586936,_0x1df044){return db['SalesforceAccount'][_0x5029('0x54')](_0x586936[_0x5029('0x55')],{})['then'](respondWithResult(_0x1df044,0xc9))[_0x5029('0x4f')](handleError(_0x1df044,null));};exports['update']=function(_0x58928f,_0x55c57c){if(_0x58928f[_0x5029('0x55')]['id']){delete _0x58928f['body']['id'];}return db[_0x5029('0x4a')][_0x5029('0x53')]({'where':{'id':_0x58928f[_0x5029('0x51')]['id']}})['then'](handleEntityNotFound(_0x55c57c,null))[_0x5029('0x1b')](saveUpdates(_0x58928f['body'],null))['then'](respondWithResult(_0x55c57c,null))[_0x5029('0x4f')](handleError(_0x55c57c,null));};exports[_0x5029('0x31')]=function(_0x81e39c,_0x448273){return db[_0x5029('0x4a')]['find']({'where':{'id':_0x81e39c[_0x5029('0x51')]['id']}})[_0x5029('0x1b')](handleEntityNotFound(_0x448273,null))[_0x5029('0x1b')](removeEntity(_0x448273,null))[_0x5029('0x4f')](handleError(_0x448273,null));};exports['getConfigurations']=function(_0x33812b,_0xfffc0d,_0x4d4a2d){var _0x512de9={};var _0x2afd44={};var _0x4685a6;var _0x1263ba;return db[_0x5029('0x4a')]['findOne']({'where':{'id':_0x33812b[_0x5029('0x51')]['id']}})[_0x5029('0x1b')](handleEntityNotFound(_0xfffc0d,null))[_0x5029('0x1b')](function(_0x2aebb3){if(_0x2aebb3){_0x4685a6=_0x2aebb3;_0x2afd44[_0x5029('0x39')]=_[_0x5029('0x3c')](db['SalesforceConfiguration']['rawAttributes']);_0x2afd44[_0x5029('0x3b')]=_[_0x5029('0x3c')](_0x33812b[_0x5029('0x3b')]);_0x2afd44['filters']=_[_0x5029('0x3e')](_0x2afd44[_0x5029('0x39')],_0x2afd44[_0x5029('0x3b')]);_0x512de9[_0x5029('0x40')]=_[_0x5029('0x3e')](_0x2afd44['model'],qs[_0x5029('0x3f')](_0x33812b[_0x5029('0x3b')][_0x5029('0x3f')]));_0x512de9['attributes']=_0x512de9[_0x5029('0x40')]['length']?_0x512de9[_0x5029('0x40')]:_0x2afd44['model'];_0x512de9[_0x5029('0x44')]=qs[_0x5029('0x45')](_0x33812b[_0x5029('0x3b')][_0x5029('0x45')]);_0x512de9[_0x5029('0x46')]=qs[_0x5029('0x3d')](_['pick'](_0x33812b[_0x5029('0x3b')],_0x2afd44[_0x5029('0x3d')]));if(_0x33812b[_0x5029('0x3b')][_0x5029('0x47')]){_0x512de9[_0x5029('0x46')]=_['merge'](_0x512de9[_0x5029('0x46')],{'$or':_['map'](_0x512de9[_0x5029('0x40')],function(_0x539f80){var _0xacab3={};_0xacab3[_0x539f80]={'$like':'%'+_0x33812b['query'][_0x5029('0x47')]+'%'};return _0xacab3;})});}_0x512de9=_['merge']({},_0x512de9,_0x33812b['options']);return _0x4685a6[_0x5029('0x56')](_0x512de9);}})['then'](function(_0x2d2a40){if(_0x2d2a40){_0x1263ba=_0x2d2a40[_0x5029('0x41')];if(!_0x33812b[_0x5029('0x3b')]['hasOwnProperty'](_0x5029('0x43'))){_0x512de9['limit']=qs[_0x5029('0x2b')](_0x33812b[_0x5029('0x3b')][_0x5029('0x2b')]);_0x512de9[_0x5029('0x2a')]=qs[_0x5029('0x2a')](_0x33812b['query'][_0x5029('0x2a')]);}return _0x4685a6[_0x5029('0x56')](_0x512de9);}})['then'](function(_0x6500bb){if(_0x6500bb){return _0x6500bb?{'count':_0x1263ba,'rows':_0x6500bb}:null;}})[_0x5029('0x1b')](respondWithResult(_0xfffc0d,null))[_0x5029('0x4f')](handleError(_0xfffc0d,null));};exports[_0x5029('0x57')]=function(_0x9b1c13,_0x1bd1c6,_0x5bd84e){if(_0x9b1c13['body']['id']){delete _0x9b1c13[_0x5029('0x55')]['id'];}return db['SalesforceAccount'][_0x5029('0x58')]({'where':{'id':_0x9b1c13[_0x5029('0x51')]['id']}})['then'](handleEntityNotFound(_0x1bd1c6,null))[_0x5029('0x1b')](function(_0x574d06){if(_0x574d06){_0x9b1c13['body'][_0x5029('0x59')]=_0x574d06['id'];_0x9b1c13[_0x5029('0x55')][_0x5029('0x5a')]=integrations[_0x5029('0x5b')](_0x9b1c13['body'][_0x5029('0x5c')],_0x9b1c13[_0x5029('0x55')]['type']);_0x9b1c13[_0x5029('0x55')][_0x5029('0x5d')]=integrations['getDescriptions'](_0x9b1c13['body']['channel'],_0x9b1c13[_0x5029('0x55')][_0x5029('0x37')]);return db[_0x5029('0x5e')][_0x5029('0x54')](_0x9b1c13[_0x5029('0x55')],{'include':[{'model':db[_0x5029('0x5f')],'as':_0x5029('0x5a')},{'model':db[_0x5029('0x5f')],'as':_0x5029('0x5d')}]});}return null;})['then'](respondWithResult(_0x1bd1c6,null))['catch'](handleError(_0x1bd1c6,null));};exports[_0x5029('0x60')]=function(_0x413f9e,_0xf51086,_0x15906f){var _0x2d8c9a;var _0x3f5115='';var _0x459230='Task';return db[_0x5029('0x4a')][_0x5029('0x58')]({'where':{'id':_0x413f9e[_0x5029('0x51')]['id']},'attributes':['id','remoteUri',_0x5029('0x61'),_0x5029('0x62'),_0x5029('0x63'),'password',_0x5029('0x64')]})[_0x5029('0x1b')](handleEntityNotFound(_0xf51086,null))[_0x5029('0x1b')](function(_0x50af55){if(_0x50af55){_0x3f5115=_0x50af55[_0x5029('0x65')];var _0x145616=_0x3f5115['slice'](-0x1);if(_0x145616==='/'){_0x3f5115=_0x3f5115[_0x5029('0x66')](0x0,_0x3f5115[_0x5029('0x67')](_0x145616));}_0x2d8c9a=new jsforce[(_0x5029('0x68'))]({'oauth2':{'loginUrl':_0x3f5115,'clientId':_0x50af55[_0x5029('0x61')],'clientSecret':_0x50af55[_0x5029('0x62')]}});return _0x2d8c9a['login'](_0x50af55[_0x5029('0x63')],_0x50af55[_0x5029('0x69')][_0x5029('0x6a')](_0x50af55[_0x5029('0x64')]));}})[_0x5029('0x1b')](function(_0x5e7f50){if(_0x5e7f50){if(!_[_0x5029('0x6b')](_0x413f9e[_0x5029('0x3b')][_0x5029('0x6c')])){_0x459230=_0x413f9e['query'][_0x5029('0x6c')];}return _0x2d8c9a[_0x5029('0x6d')](_0x459230)[_0x5029('0x6e')]();}})[_0x5029('0x1b')](function(_0x1b3860){var _0x320a91=[_0x5029('0x6f'),'CallDurationInSeconds',_0x5029('0x70'),_0x5029('0x71'),_0x5029('0x72'),_0x5029('0x73'),_0x5029('0x74'),'Type'];if(!_[_0x5029('0x6b')](_0x413f9e[_0x5029('0x3b')][_0x5029('0x6c')])&&_0x413f9e['query'][_0x5029('0x6c')]===_0x5029('0x75')){_0x320a91=['Type','Origin','Reason',_0x5029('0x74'),_0x5029('0x73'),_0x5029('0x76'),_0x5029('0x77'),_0x5029('0x78')];}if(_0x1b3860){_['remove'](_0x1b3860[_0x5029('0x3f')],function(_0x2e4782){return _0x2e4782[_0x5029('0x79')]===![]&&!_0x320a91['includes'](_0x2e4782['name']);});return{'count':_0x1b3860[_0x5029('0x3f')][_0x5029('0x41')],'rows':_[_0x5029('0x3a')](_0x1b3860[_0x5029('0x3f')],function(_0x597381){return{'id':_0x597381[_0x5029('0x33')],'name':_0x597381[_0x5029('0x7a')],'custom':_0x597381[_0x5029('0x79')],'options':_0x597381[_0x5029('0x7b')][_0x5029('0x41')]>0x0?_[_0x5029('0x3a')](_0x597381[_0x5029('0x7b')],function(_0xe4b730){return{'name':_0xe4b730['label'],'value':_0xe4b730[_0x5029('0x7c')]};}):_0x597381['type']=='boolean'?[{'name':_0x5029('0x7d'),'value':'true'},{'name':_0x5029('0x7e'),'value':_0x5029('0x7f')}]:[]};})};}})[_0x5029('0x1b')](respondWithResult(_0xf51086,null))[_0x5029('0x4f')](function(_0x1b6f4c){var _0x227d13=_0x413f9e[_0x5029('0x3b')][_0x5029('0x16')]?0x1f4:_0x1b6f4c['statusCode']||0x1f4;logger['error'](_0x5029('0x80'),'getFields',_0x227d13,JSON['stringify'](_0x1b6f4c));delete _0x1b6f4c[_0x5029('0x33')];if(_0x227d13===0x191){_0x227d13=0x190;}_0xf51086['status'](_0x227d13)['send'](_0x413f9e[_0x5029('0x3b')][_0x5029('0x16')]?{'message':_0x5029('0x81'),'statusCode':_0x1b6f4c[_0x5029('0x82')]}:_0x1b6f4c);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 49c2e7f..eec298a 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 _0x5a69=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount'];(function(_0x53380d,_0x5cdbf8){var _0x443593=function(_0x5d01d0){while(--_0x5d01d0){_0x53380d['push'](_0x53380d['shift']());}};_0x443593(++_0x5cdbf8);}(_0x5a69,0x68));var _0x95a6=function(_0x5cbaba,_0x46ef1d){_0x5cbaba=_0x5cbaba-0x0;var _0x5e668c=_0x5a69[_0x5cbaba];return _0x5e668c;};'use strict';var _=require(_0x95a6('0x0'));var util=require(_0x95a6('0x1'));var logger=require(_0x95a6('0x2'))(_0x95a6('0x3'));var moment=require(_0x95a6('0x4'));var BPromise=require(_0x95a6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95a6('0x6'));var rimraf=require(_0x95a6('0x7'));var config=require(_0x95a6('0x8'));var attributes=require(_0x95a6('0x9'));var integrations=require(_0x95a6('0xa'));module['exports']=function(_0x443a74,_0x33018c){return _0x443a74[_0x95a6('0xb')](_0x95a6('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64b2=['../../config/logger','api','moment','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util'];(function(_0x4b17b8,_0x26aabe){var _0x414f8d=function(_0x11c750){while(--_0x11c750){_0x4b17b8['push'](_0x4b17b8['shift']());}};_0x414f8d(++_0x26aabe);}(_0x64b2,0x143));var _0x264b=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x64b2[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0x264b('0x0'));var util=require(_0x264b('0x1'));var logger=require(_0x264b('0x2'))(_0x264b('0x3'));var moment=require(_0x264b('0x4'));var BPromise=require('bluebird');var rp=require(_0x264b('0x5'));var fs=require('fs');var path=require(_0x264b('0x6'));var rimraf=require(_0x264b('0x7'));var config=require('../../config/environment');var attributes=require(_0x264b('0x8'));var integrations=require(_0x264b('0x9'));module[_0x264b('0xa')]=function(_0x58dc15,_0x1c220d){return _0x58dc15[_0x264b('0xb')](_0x264b('0xc'),attributes,{'tableName':'int_salesforce_accounts','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 a43922c..1ba6330 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 _0x2e54=['error','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','map','include','model','ShowSalesforceAccount','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2644dd,_0x39d79e){var _0x4dad81=function(_0x4acbef){while(--_0x4acbef){_0x2644dd['push'](_0x2644dd['shift']());}};_0x4dad81(++_0x39d79e);}(_0x2e54,0x1dd));var _0x42e5=function(_0x334dd6,_0x33f834){_0x334dd6=_0x334dd6-0x0;var _0x562376=_0x2e54[_0x334dd6];return _0x562376;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x42e5('0x1'));var rs=require(_0x42e5('0x2'));var fs=require('fs');var Redis=require(_0x42e5('0x3'));var db=require(_0x42e5('0x4'))['db'];var utils=require(_0x42e5('0x5'));var logger=require(_0x42e5('0x6'))(_0x42e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x42e5('0x8'));var client=jayson[_0x42e5('0x9')][_0x42e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bed10,_0x2af5bb,_0x56be20){return new BPromise(function(_0x335b92,_0x490b99){return client[_0x42e5('0xb')](_0x4bed10,_0x56be20)[_0x42e5('0xc')](function(_0x10ee5a){logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));logger[_0x42e5('0x10')](_0x42e5('0x11'),_0x2af5bb,_0x42e5('0xf'),JSON['stringify'](_0x10ee5a));if(_0x10ee5a[_0x42e5('0x12')]){if(_0x10ee5a[_0x42e5('0x12')]['code']===0x1f4){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x490b99(_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);}logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x335b92(_0x10ee5a['error'][_0x42e5('0x13')]);}else{logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));_0x335b92(_0x10ee5a[_0x42e5('0x14')][_0x42e5('0x13')]);}})[_0x42e5('0x15')](function(_0x3abe3d){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x3abe3d);_0x490b99(_0x3abe3d);});});}exports[_0x42e5('0x16')]=function(_0x38282d){var _0x11550e=this;return new Promise(function(_0x23fe09,_0x54fcfc){return db[_0x42e5('0x17')]['findAll']({'raw':_0x38282d['options']?_0x38282d[_0x42e5('0x18')][_0x42e5('0x19')]===undefined?!![]:![]:!![],'where':_0x38282d['options']?_0x38282d[_0x42e5('0x18')][_0x42e5('0x1a')]||null:null,'attributes':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')][_0x42e5('0x1b')]||null:null,'limit':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')]['limit']||null:null,'include':_0x38282d['options']?_0x38282d[_0x42e5('0x18')]['include']?_[_0x42e5('0x1c')](_0x38282d[_0x42e5('0x18')][_0x42e5('0x1d')],function(_0x49490f){return{'model':db[_0x49490f[_0x42e5('0x1e')]],'as':_0x49490f['as'],'attributes':_0x49490f['attributes'],'include':_0x49490f[_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x49490f[_0x42e5('0x1d')],function(_0x275c80){return{'model':db[_0x275c80[_0x42e5('0x1e')]],'as':_0x275c80['as'],'attributes':_0x275c80['attributes'],'include':_0x275c80['include']?_[_0x42e5('0x1c')](_0x275c80['include'],function(_0x56f812){return{'model':db[_0x56f812[_0x42e5('0x1e')]],'as':_0x56f812['as'],'attributes':_0x56f812['attributes']};}):[]};}):[]};}):[]:[]})[_0x42e5('0xc')](function(_0x2d9e65){logger[_0x42e5('0xd')](_0x42e5('0x16'),_0x38282d);logger[_0x42e5('0x10')](_0x42e5('0x16'),_0x38282d,JSON['stringify'](_0x2d9e65));_0x23fe09(_0x2d9e65);})[_0x42e5('0x15')](function(_0x201d9e){logger[_0x42e5('0x12')](_0x42e5('0x16'),_0x201d9e[_0x42e5('0x13')],_0x38282d);_0x54fcfc(_0x11550e[_0x42e5('0x12')](0x1f4,_0x201d9e[_0x42e5('0x13')]));});});};exports[_0x42e5('0x1f')]=function(_0x5a4930){var _0x2ba9ef=this;return new Promise(function(_0x2c7542,_0x3d9e8b){return db[_0x42e5('0x17')]['find']({'raw':_0x5a4930[_0x42e5('0x18')]?_0x5a4930[_0x42e5('0x18')][_0x42e5('0x19')]===undefined?!![]:![]:!![],'where':_0x5a4930[_0x42e5('0x18')]?_0x5a4930['options']['where']||null:null,'attributes':_0x5a4930[_0x42e5('0x18')]?_0x5a4930['options'][_0x42e5('0x1b')]||null:null,'include':_0x5a4930['options']?_0x5a4930[_0x42e5('0x18')][_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x5a4930['options'][_0x42e5('0x1d')],function(_0x3a8d1c){return{'model':db[_0x3a8d1c['model']],'as':_0x3a8d1c['as'],'attributes':_0x3a8d1c[_0x42e5('0x1b')],'include':_0x3a8d1c['include']?_[_0x42e5('0x1c')](_0x3a8d1c[_0x42e5('0x1d')],function(_0x25a040){return{'model':db[_0x25a040[_0x42e5('0x1e')]],'as':_0x25a040['as'],'attributes':_0x25a040[_0x42e5('0x1b')],'include':_0x25a040[_0x42e5('0x1d')]?_[_0x42e5('0x1c')](_0x25a040['include'],function(_0x5a18cc){return{'model':db[_0x5a18cc[_0x42e5('0x1e')]],'as':_0x5a18cc['as'],'attributes':_0x5a18cc[_0x42e5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x42e5('0xc')](function(_0x4a1a8a){logger['info']('ShowSalesforceAccount',_0x5a4930);logger['debug'](_0x42e5('0x1f'),_0x5a4930,JSON[_0x42e5('0x20')](_0x4a1a8a));_0x2c7542(_0x4a1a8a);})[_0x42e5('0x15')](function(_0xedb7bc){logger[_0x42e5('0x12')](_0x42e5('0x1f'),_0xedb7bc[_0x42e5('0x13')],_0x5a4930);_0x3d9e8b(_0x2ba9ef[_0x42e5('0x12')](0x1f4,_0xedb7bc['message']));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','SalesforceAccount','findAll','options','raw','where','attributes','include','map','model','GetSalesforceAccount','stringify','ShowSalesforceAccount','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2f6f50,_0x1d21a7){var _0x2cf365=function(_0x1c40a7){while(--_0x1c40a7){_0x2f6f50['push'](_0x2f6f50['shift']());}};_0x2cf365(++_0x1d21a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetSalesforceAccount']=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')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowSalesforceAccount',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 8cba6e7..d66fa42 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 _0x1ee6=['./intSalesforceConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x1ee6,0xa1));var _0x61ee=function(_0x3235ae,_0x2e5eb7){_0x3235ae=_0x3235ae-0x0;var _0x56a87c=_0x1ee6[_0x3235ae];return _0x56a87c;};'use strict';var multer=require(_0x61ee('0x0'));var util=require(_0x61ee('0x1'));var path=require(_0x61ee('0x2'));var timeout=require(_0x61ee('0x3'));var express=require(_0x61ee('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x61ee('0x5'));var config=require(_0x61ee('0x6'));var controller=require(_0x61ee('0x7'));router[_0x61ee('0x8')]('/',auth[_0x61ee('0x9')](),controller['index']);router[_0x61ee('0x8')](_0x61ee('0xa'),auth[_0x61ee('0x9')](),controller[_0x61ee('0xb')]);router[_0x61ee('0x8')](_0x61ee('0xc'),auth[_0x61ee('0x9')](),controller['getFields']);router[_0x61ee('0x8')](_0x61ee('0xd'),auth[_0x61ee('0x9')](),controller[_0x61ee('0xe')]);router[_0x61ee('0x8')](_0x61ee('0xf'),auth['isAuthenticated'](),controller[_0x61ee('0x10')]);router['post']('/',auth[_0x61ee('0x9')](),controller['create']);router[_0x61ee('0x11')](_0x61ee('0xa'),auth[_0x61ee('0x9')](),controller[_0x61ee('0x12')]);router['delete'](_0x61ee('0xa'),auth[_0x61ee('0x9')](),controller[_0x61ee('0x13')]);module[_0x61ee('0x14')]=router; \ No newline at end of file +var _0xc322=['getDescriptions','post','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','/:id/descriptions'];(function(_0x309991,_0x457e73){var _0x4ca94d=function(_0x294acc){while(--_0x294acc){_0x309991['push'](_0x309991['shift']());}};_0x4ca94d(++_0x457e73);}(_0xc322,0x102));var _0x2c32=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xc322[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x2c32('0x0'));var util=require(_0x2c32('0x1'));var path=require(_0x2c32('0x2'));var timeout=require(_0x2c32('0x3'));var express=require(_0x2c32('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2c32('0x5'));var config=require(_0x2c32('0x6'));var controller=require(_0x2c32('0x7'));router[_0x2c32('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2c32('0x8')](_0x2c32('0x9'),auth[_0x2c32('0xa')](),controller[_0x2c32('0xb')]);router['get'](_0x2c32('0xc'),auth[_0x2c32('0xa')](),controller['getFields']);router[_0x2c32('0x8')](_0x2c32('0xd'),auth[_0x2c32('0xa')](),controller['getSubjects']);router['get'](_0x2c32('0xe'),auth['isAuthenticated'](),controller[_0x2c32('0xf')]);router[_0x2c32('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2c32('0x11')](_0x2c32('0x9'),auth[_0x2c32('0xa')](),controller[_0x2c32('0x12')]);router[_0x2c32('0x13')]('/:id',auth[_0x2c32('0xa')](),controller['destroy']);module[_0x2c32('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index dcd3370..b1cd669 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 _0xf7d3=['Task','Case','contact_lead','contact','lead','nothing','exports','ENUM'];(function(_0x1f1156,_0x36557b){var _0x4af64b=function(_0x454b60){while(--_0x454b60){_0x1f1156['push'](_0x1f1156['shift']());}};_0x4af64b(++_0x36557b);}(_0xf7d3,0xae));var _0x3f7d=function(_0x46c45b,_0x211f18){_0x46c45b=_0x46c45b-0x0;var _0x1fd488=_0xf7d3[_0x46c45b];return _0x1fd488;};'use strict';var Sequelize=require('sequelize');module[_0x3f7d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x3f7d('0x1')](_0x3f7d('0x2'),_0x3f7d('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x3f7d('0x1')](_0x3f7d('0x4'),_0x3f7d('0x5'),_0x3f7d('0x6')),'defaultValue':_0x3f7d('0x4')},'moduleCreate':{'type':Sequelize[_0x3f7d('0x1')](_0x3f7d('0x7'),_0x3f7d('0x5'),_0x3f7d('0x6')),'defaultValue':_0x3f7d('0x6')}}; \ No newline at end of file +var _0xc4a2=['STRING','Task','Case','ENUM','contact_lead','contact','lead','nothing','sequelize','exports'];(function(_0x4b12a6,_0x31f46b){var _0x16f236=function(_0x3123e2){while(--_0x3123e2){_0x4b12a6['push'](_0x4b12a6['shift']());}};_0x16f236(++_0x31f46b);}(_0xc4a2,0x102));var _0x2c4a=function(_0x256641,_0x5cdd79){_0x256641=_0x256641-0x0;var _0x198702=_0xc4a2[_0x256641];return _0x198702;};'use strict';var Sequelize=require(_0x2c4a('0x0'));module[_0x2c4a('0x1')]={'name':{'type':Sequelize[_0x2c4a('0x2')]},'description':{'type':Sequelize[_0x2c4a('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x2c4a('0x3'),_0x2c4a('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x2c4a('0x5')](_0x2c4a('0x6'),_0x2c4a('0x7'),_0x2c4a('0x8')),'defaultValue':_0x2c4a('0x6')},'moduleCreate':{'type':Sequelize[_0x2c4a('0x5')](_0x2c4a('0x9'),'contact',_0x2c4a('0x8')),'defaultValue':_0x2c4a('0x8')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 168657d..c8cc8c5 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 _0x2fb4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','destroy','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','rows','catch','show','params','find','create','body','update','getFields','SalesforceField','order','pick','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2fb4,0x1b6));var _0x42fb=function(_0x5d56a7,_0x343dbd){_0x5d56a7=_0x5d56a7-0x0;var _0x20352f=_0x2fb4[_0x5d56a7];return _0x20352f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x42fb('0x0'));var zipdir=require(_0x42fb('0x1'));var jsonpatch=require(_0x42fb('0x2'));var rp=require(_0x42fb('0x3'));var moment=require(_0x42fb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x42fb('0x5'));var path=require(_0x42fb('0x6'));var sox=require(_0x42fb('0x7'));var csv=require(_0x42fb('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x42fb('0x9'));var crypto=require(_0x42fb('0xa'));var jsforce=require(_0x42fb('0xb'));var deskjs=require(_0x42fb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x42fb('0xd'));var Papa=require(_0x42fb('0xe'));var Redis=require(_0x42fb('0xf'));var authService=require(_0x42fb('0x10'));var qs=require(_0x42fb('0x11'));var as=require(_0x42fb('0x12'));var hardwareService=require(_0x42fb('0x13'));var logger=require(_0x42fb('0x14'))(_0x42fb('0x15'));var utils=require(_0x42fb('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x42fb('0x17'));var client=jayson[_0x42fb('0x18')][_0x42fb('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1c14e9,_0x44d74e,_0x159c75){if(_0x159c75){var _0x47ed1e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47ed1e[_0x42fb('0x1a')](_0x44d74e)){return _0x1c14e9;}else{throw new db[(_0x42fb('0x1b'))]['ValidationError'](_0x42fb('0x1c'));}}else{return _0x1c14e9;}}function respondWithRpcPromise(_0x1c449d,_0x851016,_0x526fdd,_0x15daa5){return new BPromise(function(_0x2247bf,_0x260dc5){var _0x5a0abe=_0x15daa5||client;return _0x5a0abe['request'](_0x1c449d,_0x526fdd)[_0x42fb('0x1d')](function(_0x45f935){logger[_0x42fb('0x1e')](_0x42fb('0x1f'),_0x851016,_0x42fb('0x20'));logger[_0x42fb('0x21')](_0x42fb('0x22'),_0x851016,_0x42fb('0x20'),JSON[_0x42fb('0x23')](_0x45f935));if(_0x45f935[_0x42fb('0x24')]){if(_0x45f935['error'][_0x42fb('0x25')]===0x1f4){logger[_0x42fb('0x24')](_0x42fb('0x1f'),_0x851016,_0x45f935[_0x42fb('0x24')][_0x42fb('0x26')]);return _0x260dc5(_0x45f935[_0x42fb('0x24')][_0x42fb('0x26')]);}logger[_0x42fb('0x24')](_0x42fb('0x1f'),_0x851016,_0x45f935[_0x42fb('0x24')][_0x42fb('0x26')]);return _0x2247bf(_0x45f935[_0x42fb('0x24')][_0x42fb('0x26')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x851016,'request\x20sent');_0x2247bf(_0x45f935[_0x42fb('0x27')][_0x42fb('0x26')]);}})['catch'](function(_0xac4708){logger[_0x42fb('0x24')](_0x42fb('0x1f'),_0x851016,_0xac4708);_0x260dc5(_0xac4708);});});}function respondWithStatusCode(_0x231912,_0x4c51a4){_0x4c51a4=_0x4c51a4||0xcc;return function(_0x24fc4d){if(_0x24fc4d){return _0x231912[_0x42fb('0x28')](_0x4c51a4);}return _0x231912['status'](_0x4c51a4)[_0x42fb('0x29')]();};}function respondWithResult(_0x529e1a,_0x41f3a3){_0x41f3a3=_0x41f3a3||0xc8;return function(_0x3c6157){if(_0x3c6157){return _0x529e1a[_0x42fb('0x2a')](_0x41f3a3)[_0x42fb('0x2b')](_0x3c6157);}};}function respondWithFilteredResult(_0x1404d0,_0xb2f6ae){return function(_0x27bfc1){if(_0x27bfc1){var _0x53cd60=_0x27bfc1[_0x42fb('0x2c')],_0xbc331a=_0xb2f6ae[_0x42fb('0x2d')],_0x23becd=_0xb2f6ae[_0x42fb('0x2d')]+_0xb2f6ae[_0x42fb('0x2e')],_0x440cde;if(_0x23becd>=_0x53cd60){_0x23becd=_0x53cd60;_0x440cde=0xc8;}else{_0x440cde=0xce;}_0x1404d0[_0x42fb('0x2a')](_0x440cde);return _0x1404d0[_0x42fb('0x2f')](_0x42fb('0x30'),_0xbc331a+'-'+_0x23becd+'/'+_0x53cd60)['json'](_0x27bfc1);}return null;};}function patchUpdates(_0x414ea6){return function(_0x5adabd){try{jsonpatch[_0x42fb('0x31')](_0x5adabd,_0x414ea6,!![]);}catch(_0x5d77f5){return BPromise['reject'](_0x5d77f5);}return _0x5adabd['save']();};}function saveUpdates(_0x482871,_0x1e5408){return function(_0x2484ce){if(_0x2484ce){return _0x2484ce['update'](_0x482871)['then'](function(_0x57fa33){return _0x57fa33;});}return null;};}function removeEntity(_0xbd64d6,_0x425851){return function(_0x171132){if(_0x171132){return _0x171132[_0x42fb('0x32')]()[_0x42fb('0x1d')](function(){_0xbd64d6[_0x42fb('0x2a')](0xcc)[_0x42fb('0x29')]();});}};}function handleEntityNotFound(_0x2eb61c,_0xde39b4){return function(_0x3a5c80){if(!_0x3a5c80){_0x2eb61c[_0x42fb('0x28')](0x194);}return _0x3a5c80;};}function handleError(_0x3ed649,_0x33374c){_0x33374c=_0x33374c||0x1f4;return function(_0x183306){logger[_0x42fb('0x24')](_0x183306[_0x42fb('0x33')]);if(_0x183306['name']){delete _0x183306[_0x42fb('0x34')];}_0x3ed649[_0x42fb('0x2a')](_0x33374c)[_0x42fb('0x35')](_0x183306);};}exports['index']=function(_0x99474a,_0x561f60){var _0x2aecb9={},_0x2760b8={},_0x1bdabb={'count':0x0,'rows':[]};var _0x1aa4c8=_[_0x42fb('0x36')](db[_0x42fb('0x37')][_0x42fb('0x38')],function(_0xa3785c){return{'name':_0xa3785c[_0x42fb('0x39')],'type':_0xa3785c[_0x42fb('0x3a')][_0x42fb('0x3b')]};});_0x2760b8[_0x42fb('0x3c')]=_['map'](_0x1aa4c8,_0x42fb('0x34'));_0x2760b8[_0x42fb('0x3d')]=_[_0x42fb('0x3e')](_0x99474a[_0x42fb('0x3d')]);_0x2760b8[_0x42fb('0x3f')]=_[_0x42fb('0x40')](_0x2760b8[_0x42fb('0x3c')],_0x2760b8['query']);_0x2aecb9['attributes']=_[_0x42fb('0x40')](_0x2760b8[_0x42fb('0x3c')],qs['fields'](_0x99474a[_0x42fb('0x3d')][_0x42fb('0x41')]));_0x2aecb9['attributes']=_0x2aecb9[_0x42fb('0x42')][_0x42fb('0x43')]?_0x2aecb9[_0x42fb('0x42')]:_0x2760b8['model'];if(!_0x99474a['query'][_0x42fb('0x44')](_0x42fb('0x45'))){_0x2aecb9[_0x42fb('0x2e')]=qs[_0x42fb('0x2e')](_0x99474a['query'][_0x42fb('0x2e')]);_0x2aecb9['offset']=qs[_0x42fb('0x2d')](_0x99474a[_0x42fb('0x3d')]['offset']);}_0x2aecb9['order']=qs[_0x42fb('0x46')](_0x99474a[_0x42fb('0x3d')][_0x42fb('0x46')]);_0x2aecb9[_0x42fb('0x47')]=qs[_0x42fb('0x3f')](_['pick'](_0x99474a[_0x42fb('0x3d')],_0x2760b8[_0x42fb('0x3f')]));if(_0x99474a[_0x42fb('0x3d')][_0x42fb('0x48')]){_0x2aecb9[_0x42fb('0x47')]=_[_0x42fb('0x49')](_0x2aecb9[_0x42fb('0x47')],{'$or':_[_0x42fb('0x36')](_0x1aa4c8,function(_0x3e3333){if(_0x3e3333['type']!==_0x42fb('0x4a')){var _0xa1caa3={};_0xa1caa3[_0x3e3333[_0x42fb('0x34')]]={'$like':'%'+_0x99474a[_0x42fb('0x3d')][_0x42fb('0x48')]+'%'};return _0xa1caa3;}})});}_0x2aecb9=_['merge']({},_0x2aecb9,_0x99474a[_0x42fb('0x4b')]);var _0x2a4196={'where':_0x2aecb9['where']};return db['SalesforceConfiguration']['count'](_0x2a4196)[_0x42fb('0x1d')](function(_0x48e4f0){_0x1bdabb[_0x42fb('0x2c')]=_0x48e4f0;if(_0x99474a['query']['includeAll']){_0x2aecb9['include']=[{'all':!![]}];}return db[_0x42fb('0x37')]['findAll'](_0x2aecb9);})[_0x42fb('0x1d')](function(_0x4c4a9e){_0x1bdabb[_0x42fb('0x4c')]=_0x4c4a9e;return _0x1bdabb;})[_0x42fb('0x1d')](respondWithFilteredResult(_0x561f60,_0x2aecb9))[_0x42fb('0x4d')](handleError(_0x561f60,null));};exports[_0x42fb('0x4e')]=function(_0x2062d0,_0x246c94){var _0x37a5e0={'raw':![],'where':{'id':_0x2062d0[_0x42fb('0x4f')]['id']}},_0x5ce75c={};_0x5ce75c[_0x42fb('0x3c')]=_[_0x42fb('0x3e')](db['SalesforceConfiguration'][_0x42fb('0x38')]);_0x5ce75c[_0x42fb('0x3d')]=_['keys'](_0x2062d0[_0x42fb('0x3d')]);_0x5ce75c[_0x42fb('0x3f')]=_[_0x42fb('0x40')](_0x5ce75c[_0x42fb('0x3c')],_0x5ce75c[_0x42fb('0x3d')]);_0x37a5e0[_0x42fb('0x42')]=_[_0x42fb('0x40')](_0x5ce75c['model'],qs[_0x42fb('0x41')](_0x2062d0[_0x42fb('0x3d')][_0x42fb('0x41')]));_0x37a5e0[_0x42fb('0x42')]=_0x37a5e0[_0x42fb('0x42')][_0x42fb('0x43')]?_0x37a5e0['attributes']:_0x5ce75c[_0x42fb('0x3c')];if(_0x2062d0[_0x42fb('0x3d')]['includeAll']){_0x37a5e0['include']=[{'all':!![]}];}_0x37a5e0=_['merge']({},_0x37a5e0,_0x2062d0['options']);return db[_0x42fb('0x37')][_0x42fb('0x50')](_0x37a5e0)[_0x42fb('0x1d')](handleEntityNotFound(_0x246c94,null))[_0x42fb('0x1d')](respondWithResult(_0x246c94,null))[_0x42fb('0x4d')](handleError(_0x246c94,null));};exports['create']=function(_0xed0365,_0xb0617b){return db[_0x42fb('0x37')][_0x42fb('0x51')](_0xed0365[_0x42fb('0x52')],{})[_0x42fb('0x1d')](respondWithResult(_0xb0617b,0xc9))[_0x42fb('0x4d')](handleError(_0xb0617b,null));};exports[_0x42fb('0x53')]=function(_0x3586b8,_0x46c38c){if(_0x3586b8[_0x42fb('0x52')]['id']){delete _0x3586b8[_0x42fb('0x52')]['id'];}return db[_0x42fb('0x37')][_0x42fb('0x50')]({'where':{'id':_0x3586b8[_0x42fb('0x4f')]['id']}})[_0x42fb('0x1d')](handleEntityNotFound(_0x46c38c,null))['then'](saveUpdates(_0x3586b8[_0x42fb('0x52')],null))[_0x42fb('0x1d')](respondWithResult(_0x46c38c,null))[_0x42fb('0x4d')](handleError(_0x46c38c,null));};exports[_0x42fb('0x32')]=function(_0x54398b,_0x492666){return db[_0x42fb('0x37')]['find']({'where':{'id':_0x54398b[_0x42fb('0x4f')]['id']}})[_0x42fb('0x1d')](handleEntityNotFound(_0x492666,null))[_0x42fb('0x1d')](removeEntity(_0x492666,null))[_0x42fb('0x4d')](handleError(_0x492666,null));};exports[_0x42fb('0x54')]=function(_0x1a0354,_0x37effa,_0x502096){var _0x1a6e69={};var _0x5eb305={};var _0x281381;var _0x459ab3;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x1a0354[_0x42fb('0x4f')]['id']}})[_0x42fb('0x1d')](handleEntityNotFound(_0x37effa,null))[_0x42fb('0x1d')](function(_0x3c3d00){if(_0x3c3d00){_0x281381=_0x3c3d00;_0x5eb305[_0x42fb('0x3c')]=_[_0x42fb('0x3e')](db[_0x42fb('0x55')][_0x42fb('0x38')]);_0x5eb305[_0x42fb('0x3d')]=_['keys'](_0x1a0354[_0x42fb('0x3d')]);_0x5eb305[_0x42fb('0x3f')]=_[_0x42fb('0x40')](_0x5eb305['model'],_0x5eb305[_0x42fb('0x3d')]);_0x1a6e69[_0x42fb('0x42')]=_[_0x42fb('0x40')](_0x5eb305['model'],qs['fields'](_0x1a0354[_0x42fb('0x3d')]['fields']));_0x1a6e69['attributes']=_0x1a6e69[_0x42fb('0x42')][_0x42fb('0x43')]?_0x1a6e69['attributes']:_0x5eb305[_0x42fb('0x3c')];_0x1a6e69[_0x42fb('0x56')]=qs[_0x42fb('0x46')](_0x1a0354['query']['sort']);_0x1a6e69[_0x42fb('0x47')]=qs[_0x42fb('0x3f')](_[_0x42fb('0x57')](_0x1a0354[_0x42fb('0x3d')],_0x5eb305[_0x42fb('0x3f')]));if(_0x1a0354[_0x42fb('0x3d')][_0x42fb('0x48')]){_0x1a6e69[_0x42fb('0x47')]=_[_0x42fb('0x49')](_0x1a6e69[_0x42fb('0x47')],{'$or':_[_0x42fb('0x36')](_0x1a6e69[_0x42fb('0x42')],function(_0x387ed1){var _0x3ad278={};_0x3ad278[_0x387ed1]={'$like':'%'+_0x1a0354[_0x42fb('0x3d')][_0x42fb('0x48')]+'%'};return _0x3ad278;})});}_0x1a6e69=_[_0x42fb('0x49')]({},_0x1a6e69,_0x1a0354[_0x42fb('0x4b')]);return _0x281381['getFields'](_0x1a6e69);}})[_0x42fb('0x1d')](function(_0x2982ad){if(_0x2982ad){_0x459ab3=_0x2982ad[_0x42fb('0x43')];if(!_0x1a0354[_0x42fb('0x3d')][_0x42fb('0x44')]('nolimit')){_0x1a6e69['limit']=qs['limit'](_0x1a0354[_0x42fb('0x3d')][_0x42fb('0x2e')]);_0x1a6e69[_0x42fb('0x2d')]=qs[_0x42fb('0x2d')](_0x1a0354[_0x42fb('0x3d')][_0x42fb('0x2d')]);}return _0x281381[_0x42fb('0x54')](_0x1a6e69);}})[_0x42fb('0x1d')](function(_0x2b9827){if(_0x2b9827){return _0x2b9827?{'count':_0x459ab3,'rows':_0x2b9827}:null;}})['then'](respondWithResult(_0x37effa,null))[_0x42fb('0x4d')](handleError(_0x37effa,null));};exports[_0x42fb('0x58')]=function(_0x542a05,_0x4089cc,_0x189ac4){var _0x93412f={};var _0x34bbab={};var _0x3b7288;var _0x5f16f0;return db[_0x42fb('0x37')][_0x42fb('0x59')]({'where':{'id':_0x542a05[_0x42fb('0x4f')]['id']}})[_0x42fb('0x1d')](handleEntityNotFound(_0x4089cc,null))[_0x42fb('0x1d')](function(_0x4be8d1){if(_0x4be8d1){_0x3b7288=_0x4be8d1;_0x34bbab[_0x42fb('0x3c')]=_[_0x42fb('0x3e')](db[_0x42fb('0x55')]['rawAttributes']);_0x34bbab[_0x42fb('0x3d')]=_['keys'](_0x542a05[_0x42fb('0x3d')]);_0x34bbab['filters']=_['intersection'](_0x34bbab[_0x42fb('0x3c')],_0x34bbab[_0x42fb('0x3d')]);_0x93412f[_0x42fb('0x42')]=_[_0x42fb('0x40')](_0x34bbab[_0x42fb('0x3c')],qs['fields'](_0x542a05[_0x42fb('0x3d')][_0x42fb('0x41')]));_0x93412f['attributes']=_0x93412f['attributes'][_0x42fb('0x43')]?_0x93412f[_0x42fb('0x42')]:_0x34bbab[_0x42fb('0x3c')];_0x93412f[_0x42fb('0x56')]=qs[_0x42fb('0x46')](_0x542a05[_0x42fb('0x3d')]['sort']);_0x93412f[_0x42fb('0x47')]=qs[_0x42fb('0x3f')](_['pick'](_0x542a05[_0x42fb('0x3d')],_0x34bbab[_0x42fb('0x3f')]));if(_0x542a05[_0x42fb('0x3d')][_0x42fb('0x48')]){_0x93412f['where']=_[_0x42fb('0x49')](_0x93412f['where'],{'$or':_[_0x42fb('0x36')](_0x93412f[_0x42fb('0x42')],function(_0x336a86){var _0x42c908={};_0x42c908[_0x336a86]={'$like':'%'+_0x542a05[_0x42fb('0x3d')][_0x42fb('0x48')]+'%'};return _0x42c908;})});}_0x93412f=_[_0x42fb('0x49')]({},_0x93412f,_0x542a05[_0x42fb('0x4b')]);return _0x3b7288[_0x42fb('0x58')](_0x93412f);}})[_0x42fb('0x1d')](function(_0x4be456){if(_0x4be456){_0x5f16f0=_0x4be456[_0x42fb('0x43')];if(!_0x542a05[_0x42fb('0x3d')][_0x42fb('0x44')](_0x42fb('0x45'))){_0x93412f['limit']=qs[_0x42fb('0x2e')](_0x542a05[_0x42fb('0x3d')][_0x42fb('0x2e')]);_0x93412f[_0x42fb('0x2d')]=qs[_0x42fb('0x2d')](_0x542a05[_0x42fb('0x3d')]['offset']);}return _0x3b7288['getSubjects'](_0x93412f);}})[_0x42fb('0x1d')](function(_0x5a060e){if(_0x5a060e){return _0x5a060e?{'count':_0x5f16f0,'rows':_0x5a060e}:null;}})[_0x42fb('0x1d')](respondWithResult(_0x4089cc,null))[_0x42fb('0x4d')](handleError(_0x4089cc,null));};exports[_0x42fb('0x5a')]=function(_0x537af6,_0x51f15c,_0x417484){var _0x50a61c={};var _0x17ba05={};var _0x405fa1;var _0x2ade72;return db[_0x42fb('0x37')][_0x42fb('0x59')]({'where':{'id':_0x537af6[_0x42fb('0x4f')]['id']}})[_0x42fb('0x1d')](handleEntityNotFound(_0x51f15c,null))[_0x42fb('0x1d')](function(_0x73447a){if(_0x73447a){_0x405fa1=_0x73447a;_0x17ba05[_0x42fb('0x3c')]=_['keys'](db['SalesforceField'][_0x42fb('0x38')]);_0x17ba05[_0x42fb('0x3d')]=_[_0x42fb('0x3e')](_0x537af6[_0x42fb('0x3d')]);_0x17ba05[_0x42fb('0x3f')]=_[_0x42fb('0x40')](_0x17ba05[_0x42fb('0x3c')],_0x17ba05[_0x42fb('0x3d')]);_0x50a61c[_0x42fb('0x42')]=_[_0x42fb('0x40')](_0x17ba05[_0x42fb('0x3c')],qs[_0x42fb('0x41')](_0x537af6[_0x42fb('0x3d')][_0x42fb('0x41')]));_0x50a61c[_0x42fb('0x42')]=_0x50a61c[_0x42fb('0x42')][_0x42fb('0x43')]?_0x50a61c[_0x42fb('0x42')]:_0x17ba05[_0x42fb('0x3c')];_0x50a61c[_0x42fb('0x56')]=qs[_0x42fb('0x46')](_0x537af6[_0x42fb('0x3d')][_0x42fb('0x46')]);_0x50a61c[_0x42fb('0x47')]=qs[_0x42fb('0x3f')](_[_0x42fb('0x57')](_0x537af6[_0x42fb('0x3d')],_0x17ba05['filters']));if(_0x537af6[_0x42fb('0x3d')][_0x42fb('0x48')]){_0x50a61c['where']=_[_0x42fb('0x49')](_0x50a61c[_0x42fb('0x47')],{'$or':_[_0x42fb('0x36')](_0x50a61c[_0x42fb('0x42')],function(_0xc7d372){var _0x2b4776={};_0x2b4776[_0xc7d372]={'$like':'%'+_0x537af6[_0x42fb('0x3d')]['filter']+'%'};return _0x2b4776;})});}_0x50a61c=_[_0x42fb('0x49')]({},_0x50a61c,_0x537af6[_0x42fb('0x4b')]);return _0x405fa1['getDescriptions'](_0x50a61c);}})['then'](function(_0x39601e){if(_0x39601e){_0x2ade72=_0x39601e[_0x42fb('0x43')];if(!_0x537af6['query']['hasOwnProperty']('nolimit')){_0x50a61c[_0x42fb('0x2e')]=qs['limit'](_0x537af6[_0x42fb('0x3d')]['limit']);_0x50a61c[_0x42fb('0x2d')]=qs[_0x42fb('0x2d')](_0x537af6[_0x42fb('0x3d')][_0x42fb('0x2d')]);}return _0x405fa1['getDescriptions'](_0x50a61c);}})[_0x42fb('0x1d')](function(_0x3aa3eb){if(_0x3aa3eb){return _0x3aa3eb?{'count':_0x2ade72,'rows':_0x3aa3eb}:null;}})[_0x42fb('0x1d')](respondWithResult(_0x51f15c,null))['catch'](handleError(_0x51f15c,null));}; \ No newline at end of file +var _0x6b89=['eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','SalesforceConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','merge','type','VIRTUAL','options','findAll','rows','show','params','includeAll','find','create','body','getFields','findOne','SalesforceField','filter','length','getSubjects','rawAttributes','getDescriptions','nolimit'];(function(_0x12c2ed,_0x442419){var _0x1c6d47=function(_0x4bdeb8){while(--_0x4bdeb8){_0x12c2ed['push'](_0x12c2ed['shift']());}};_0x1c6d47(++_0x442419);}(_0x6b89,0x117));var _0x96b8=function(_0x460dab,_0x362cf8){_0x460dab=_0x460dab-0x0;var _0x421c7e=_0x6b89[_0x460dab];return _0x421c7e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x96b8('0x0'));var rimraf=require(_0x96b8('0x1'));var zipdir=require(_0x96b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x96b8('0x3'));var BPromise=require(_0x96b8('0x4'));var Mustache=require(_0x96b8('0x5'));var util=require(_0x96b8('0x6'));var path=require(_0x96b8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x96b8('0x8'));var squel=require('squel');var crypto=require(_0x96b8('0x9'));var jsforce=require(_0x96b8('0xa'));var deskjs=require(_0x96b8('0xb'));var toCsv=require(_0x96b8('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x96b8('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x96b8('0xe'));var as=require(_0x96b8('0xf'));var hardwareService=require(_0x96b8('0x10'));var logger=require(_0x96b8('0x11'))(_0x96b8('0x12'));var utils=require(_0x96b8('0x13'));var config=require(_0x96b8('0x14'));var db=require(_0x96b8('0x15'))['db'];var jayson=require(_0x96b8('0x16'));var client=jayson[_0x96b8('0x17')][_0x96b8('0x18')]({'port':0x232a});function checkPasswordPattern(_0x117422,_0x58bf25,_0x298771){if(_0x298771){var _0x39f9b4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x39f9b4[_0x96b8('0x19')](_0x58bf25)){return _0x117422;}else{throw new db[(_0x96b8('0x1a'))][(_0x96b8('0x1b'))](_0x96b8('0x1c'));}}else{return _0x117422;}}function respondWithRpcPromise(_0xa542d5,_0x3d647a,_0x3d7660,_0x507208){return new BPromise(function(_0x4d51e5,_0x42ce97){var _0x244286=_0x507208||client;return _0x244286['request'](_0xa542d5,_0x3d7660)[_0x96b8('0x1d')](function(_0x50ff47){logger[_0x96b8('0x1e')](_0x96b8('0x1f'),_0x3d647a,_0x96b8('0x20'));logger[_0x96b8('0x21')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3d647a,'request\x20sent',JSON[_0x96b8('0x22')](_0x50ff47));if(_0x50ff47[_0x96b8('0x23')]){if(_0x50ff47[_0x96b8('0x23')][_0x96b8('0x24')]===0x1f4){logger['error'](_0x96b8('0x1f'),_0x3d647a,_0x50ff47[_0x96b8('0x23')][_0x96b8('0x25')]);return _0x42ce97(_0x50ff47[_0x96b8('0x23')]['message']);}logger[_0x96b8('0x23')](_0x96b8('0x1f'),_0x3d647a,_0x50ff47[_0x96b8('0x23')][_0x96b8('0x25')]);return _0x4d51e5(_0x50ff47[_0x96b8('0x23')]['message']);}else{logger[_0x96b8('0x1e')](_0x96b8('0x1f'),_0x3d647a,_0x96b8('0x20'));_0x4d51e5(_0x50ff47['result']['message']);}})[_0x96b8('0x26')](function(_0x52279b){logger[_0x96b8('0x23')](_0x96b8('0x1f'),_0x3d647a,_0x52279b);_0x42ce97(_0x52279b);});});}function respondWithStatusCode(_0x31aef6,_0x3dac72){_0x3dac72=_0x3dac72||0xcc;return function(_0x1562a0){if(_0x1562a0){return _0x31aef6[_0x96b8('0x27')](_0x3dac72);}return _0x31aef6[_0x96b8('0x28')](_0x3dac72)[_0x96b8('0x29')]();};}function respondWithResult(_0x182e75,_0x511009){_0x511009=_0x511009||0xc8;return function(_0x188a49){if(_0x188a49){return _0x182e75[_0x96b8('0x28')](_0x511009)[_0x96b8('0x2a')](_0x188a49);}};}function respondWithFilteredResult(_0x58641d,_0x3455b7){return function(_0x1c6489){if(_0x1c6489){var _0x13fe36=_0x1c6489[_0x96b8('0x2b')],_0x2a30da=_0x3455b7[_0x96b8('0x2c')],_0x47a4eb=_0x3455b7[_0x96b8('0x2c')]+_0x3455b7['limit'],_0x5afc24;if(_0x47a4eb>=_0x13fe36){_0x47a4eb=_0x13fe36;_0x5afc24=0xc8;}else{_0x5afc24=0xce;}_0x58641d['status'](_0x5afc24);return _0x58641d[_0x96b8('0x2d')](_0x96b8('0x2e'),_0x2a30da+'-'+_0x47a4eb+'/'+_0x13fe36)[_0x96b8('0x2a')](_0x1c6489);}return null;};}function patchUpdates(_0x535890){return function(_0x491983){try{jsonpatch['apply'](_0x491983,_0x535890,!![]);}catch(_0xc5ccf3){return BPromise[_0x96b8('0x2f')](_0xc5ccf3);}return _0x491983[_0x96b8('0x30')]();};}function saveUpdates(_0x4ceb39,_0x356b2d){return function(_0x2e79e3){if(_0x2e79e3){return _0x2e79e3[_0x96b8('0x31')](_0x4ceb39)[_0x96b8('0x1d')](function(_0x36047f){return _0x36047f;});}return null;};}function removeEntity(_0x6feac6,_0x2a782f){return function(_0x48681c){if(_0x48681c){return _0x48681c[_0x96b8('0x32')]()[_0x96b8('0x1d')](function(){_0x6feac6[_0x96b8('0x28')](0xcc)[_0x96b8('0x29')]();});}};}function handleEntityNotFound(_0x30ecff,_0xfc4a9a){return function(_0x16416c){if(!_0x16416c){_0x30ecff['sendStatus'](0x194);}return _0x16416c;};}function handleError(_0x39828f,_0x2d7742){_0x2d7742=_0x2d7742||0x1f4;return function(_0x52da89){logger[_0x96b8('0x23')](_0x52da89[_0x96b8('0x33')]);if(_0x52da89[_0x96b8('0x34')]){delete _0x52da89['name'];}_0x39828f[_0x96b8('0x28')](_0x2d7742)[_0x96b8('0x35')](_0x52da89);};}exports[_0x96b8('0x36')]=function(_0x3a5ae4,_0xe5472f){var _0x39e483={},_0x52d107={},_0x5f3247={'count':0x0,'rows':[]};var _0x4cbabf=_[_0x96b8('0x37')](db[_0x96b8('0x38')]['rawAttributes'],function(_0x2d6b63){return{'name':_0x2d6b63[_0x96b8('0x39')],'type':_0x2d6b63['type'][_0x96b8('0x3a')]};});_0x52d107[_0x96b8('0x3b')]=_[_0x96b8('0x37')](_0x4cbabf,_0x96b8('0x34'));_0x52d107[_0x96b8('0x3c')]=_[_0x96b8('0x3d')](_0x3a5ae4['query']);_0x52d107[_0x96b8('0x3e')]=_[_0x96b8('0x3f')](_0x52d107[_0x96b8('0x3b')],_0x52d107[_0x96b8('0x3c')]);_0x39e483[_0x96b8('0x40')]=_[_0x96b8('0x3f')](_0x52d107[_0x96b8('0x3b')],qs[_0x96b8('0x41')](_0x3a5ae4[_0x96b8('0x3c')][_0x96b8('0x41')]));_0x39e483[_0x96b8('0x40')]=_0x39e483[_0x96b8('0x40')]['length']?_0x39e483[_0x96b8('0x40')]:_0x52d107[_0x96b8('0x3b')];if(!_0x3a5ae4[_0x96b8('0x3c')][_0x96b8('0x42')]('nolimit')){_0x39e483[_0x96b8('0x43')]=qs['limit'](_0x3a5ae4['query'][_0x96b8('0x43')]);_0x39e483[_0x96b8('0x2c')]=qs[_0x96b8('0x2c')](_0x3a5ae4['query'][_0x96b8('0x2c')]);}_0x39e483[_0x96b8('0x44')]=qs[_0x96b8('0x45')](_0x3a5ae4['query'][_0x96b8('0x45')]);_0x39e483[_0x96b8('0x46')]=qs[_0x96b8('0x3e')](_[_0x96b8('0x47')](_0x3a5ae4[_0x96b8('0x3c')],_0x52d107['filters']));if(_0x3a5ae4[_0x96b8('0x3c')]['filter']){_0x39e483[_0x96b8('0x46')]=_[_0x96b8('0x48')](_0x39e483['where'],{'$or':_[_0x96b8('0x37')](_0x4cbabf,function(_0x54af00){if(_0x54af00[_0x96b8('0x49')]!==_0x96b8('0x4a')){var _0x30d890={};_0x30d890[_0x54af00['name']]={'$like':'%'+_0x3a5ae4[_0x96b8('0x3c')]['filter']+'%'};return _0x30d890;}})});}_0x39e483=_[_0x96b8('0x48')]({},_0x39e483,_0x3a5ae4[_0x96b8('0x4b')]);var _0x3fa5c0={'where':_0x39e483[_0x96b8('0x46')]};return db[_0x96b8('0x38')][_0x96b8('0x2b')](_0x3fa5c0)['then'](function(_0x379c01){_0x5f3247[_0x96b8('0x2b')]=_0x379c01;if(_0x3a5ae4[_0x96b8('0x3c')]['includeAll']){_0x39e483['include']=[{'all':!![]}];}return db[_0x96b8('0x38')][_0x96b8('0x4c')](_0x39e483);})[_0x96b8('0x1d')](function(_0xec1376){_0x5f3247[_0x96b8('0x4d')]=_0xec1376;return _0x5f3247;})[_0x96b8('0x1d')](respondWithFilteredResult(_0xe5472f,_0x39e483))['catch'](handleError(_0xe5472f,null));};exports[_0x96b8('0x4e')]=function(_0x1586e1,_0x310463){var _0x91d005={'raw':![],'where':{'id':_0x1586e1[_0x96b8('0x4f')]['id']}},_0x4fa7b4={};_0x4fa7b4[_0x96b8('0x3b')]=_['keys'](db[_0x96b8('0x38')]['rawAttributes']);_0x4fa7b4['query']=_['keys'](_0x1586e1[_0x96b8('0x3c')]);_0x4fa7b4[_0x96b8('0x3e')]=_[_0x96b8('0x3f')](_0x4fa7b4[_0x96b8('0x3b')],_0x4fa7b4[_0x96b8('0x3c')]);_0x91d005[_0x96b8('0x40')]=_[_0x96b8('0x3f')](_0x4fa7b4['model'],qs['fields'](_0x1586e1[_0x96b8('0x3c')]['fields']));_0x91d005[_0x96b8('0x40')]=_0x91d005['attributes']['length']?_0x91d005['attributes']:_0x4fa7b4[_0x96b8('0x3b')];if(_0x1586e1[_0x96b8('0x3c')][_0x96b8('0x50')]){_0x91d005['include']=[{'all':!![]}];}_0x91d005=_[_0x96b8('0x48')]({},_0x91d005,_0x1586e1[_0x96b8('0x4b')]);return db[_0x96b8('0x38')][_0x96b8('0x51')](_0x91d005)[_0x96b8('0x1d')](handleEntityNotFound(_0x310463,null))[_0x96b8('0x1d')](respondWithResult(_0x310463,null))['catch'](handleError(_0x310463,null));};exports[_0x96b8('0x52')]=function(_0x3b4f55,_0x351e0b){return db[_0x96b8('0x38')]['create'](_0x3b4f55[_0x96b8('0x53')],{})[_0x96b8('0x1d')](respondWithResult(_0x351e0b,0xc9))['catch'](handleError(_0x351e0b,null));};exports['update']=function(_0x4cde42,_0x20f965){if(_0x4cde42['body']['id']){delete _0x4cde42['body']['id'];}return db[_0x96b8('0x38')]['find']({'where':{'id':_0x4cde42['params']['id']}})[_0x96b8('0x1d')](handleEntityNotFound(_0x20f965,null))[_0x96b8('0x1d')](saveUpdates(_0x4cde42[_0x96b8('0x53')],null))[_0x96b8('0x1d')](respondWithResult(_0x20f965,null))['catch'](handleError(_0x20f965,null));};exports['destroy']=function(_0x47dc58,_0x786c0f){return db[_0x96b8('0x38')][_0x96b8('0x51')]({'where':{'id':_0x47dc58[_0x96b8('0x4f')]['id']}})[_0x96b8('0x1d')](handleEntityNotFound(_0x786c0f,null))[_0x96b8('0x1d')](removeEntity(_0x786c0f,null))['catch'](handleError(_0x786c0f,null));};exports[_0x96b8('0x54')]=function(_0x1d3e9c,_0x77b9e0,_0x2b2c61){var _0x286968={};var _0x19a3f2={};var _0x1f90dc;var _0x5613b1;return db['SalesforceConfiguration'][_0x96b8('0x55')]({'where':{'id':_0x1d3e9c[_0x96b8('0x4f')]['id']}})[_0x96b8('0x1d')](handleEntityNotFound(_0x77b9e0,null))['then'](function(_0x2d0f4c){if(_0x2d0f4c){_0x1f90dc=_0x2d0f4c;_0x19a3f2[_0x96b8('0x3b')]=_['keys'](db[_0x96b8('0x56')]['rawAttributes']);_0x19a3f2[_0x96b8('0x3c')]=_[_0x96b8('0x3d')](_0x1d3e9c[_0x96b8('0x3c')]);_0x19a3f2[_0x96b8('0x3e')]=_[_0x96b8('0x3f')](_0x19a3f2['model'],_0x19a3f2[_0x96b8('0x3c')]);_0x286968[_0x96b8('0x40')]=_[_0x96b8('0x3f')](_0x19a3f2[_0x96b8('0x3b')],qs['fields'](_0x1d3e9c[_0x96b8('0x3c')][_0x96b8('0x41')]));_0x286968[_0x96b8('0x40')]=_0x286968['attributes']['length']?_0x286968[_0x96b8('0x40')]:_0x19a3f2[_0x96b8('0x3b')];_0x286968[_0x96b8('0x44')]=qs[_0x96b8('0x45')](_0x1d3e9c[_0x96b8('0x3c')][_0x96b8('0x45')]);_0x286968[_0x96b8('0x46')]=qs[_0x96b8('0x3e')](_['pick'](_0x1d3e9c[_0x96b8('0x3c')],_0x19a3f2[_0x96b8('0x3e')]));if(_0x1d3e9c[_0x96b8('0x3c')]['filter']){_0x286968['where']=_[_0x96b8('0x48')](_0x286968[_0x96b8('0x46')],{'$or':_['map'](_0x286968['attributes'],function(_0x2e8013){var _0x1c0b93={};_0x1c0b93[_0x2e8013]={'$like':'%'+_0x1d3e9c[_0x96b8('0x3c')][_0x96b8('0x57')]+'%'};return _0x1c0b93;})});}_0x286968=_[_0x96b8('0x48')]({},_0x286968,_0x1d3e9c[_0x96b8('0x4b')]);return _0x1f90dc[_0x96b8('0x54')](_0x286968);}})[_0x96b8('0x1d')](function(_0x94d69b){if(_0x94d69b){_0x5613b1=_0x94d69b[_0x96b8('0x58')];if(!_0x1d3e9c[_0x96b8('0x3c')][_0x96b8('0x42')]('nolimit')){_0x286968['limit']=qs[_0x96b8('0x43')](_0x1d3e9c[_0x96b8('0x3c')][_0x96b8('0x43')]);_0x286968[_0x96b8('0x2c')]=qs[_0x96b8('0x2c')](_0x1d3e9c[_0x96b8('0x3c')][_0x96b8('0x2c')]);}return _0x1f90dc['getFields'](_0x286968);}})[_0x96b8('0x1d')](function(_0x2ee8b8){if(_0x2ee8b8){return _0x2ee8b8?{'count':_0x5613b1,'rows':_0x2ee8b8}:null;}})['then'](respondWithResult(_0x77b9e0,null))[_0x96b8('0x26')](handleError(_0x77b9e0,null));};exports[_0x96b8('0x59')]=function(_0x2ba07d,_0x4c0be6,_0x38fb25){var _0x33eaba={};var _0x2216c6={};var _0x3f9c25;var _0x37b52c;return db[_0x96b8('0x38')][_0x96b8('0x55')]({'where':{'id':_0x2ba07d['params']['id']}})[_0x96b8('0x1d')](handleEntityNotFound(_0x4c0be6,null))[_0x96b8('0x1d')](function(_0x47fda8){if(_0x47fda8){_0x3f9c25=_0x47fda8;_0x2216c6['model']=_[_0x96b8('0x3d')](db[_0x96b8('0x56')][_0x96b8('0x5a')]);_0x2216c6[_0x96b8('0x3c')]=_[_0x96b8('0x3d')](_0x2ba07d[_0x96b8('0x3c')]);_0x2216c6[_0x96b8('0x3e')]=_[_0x96b8('0x3f')](_0x2216c6[_0x96b8('0x3b')],_0x2216c6['query']);_0x33eaba[_0x96b8('0x40')]=_[_0x96b8('0x3f')](_0x2216c6[_0x96b8('0x3b')],qs['fields'](_0x2ba07d['query']['fields']));_0x33eaba[_0x96b8('0x40')]=_0x33eaba[_0x96b8('0x40')][_0x96b8('0x58')]?_0x33eaba[_0x96b8('0x40')]:_0x2216c6['model'];_0x33eaba[_0x96b8('0x44')]=qs[_0x96b8('0x45')](_0x2ba07d['query']['sort']);_0x33eaba['where']=qs[_0x96b8('0x3e')](_[_0x96b8('0x47')](_0x2ba07d['query'],_0x2216c6[_0x96b8('0x3e')]));if(_0x2ba07d[_0x96b8('0x3c')][_0x96b8('0x57')]){_0x33eaba['where']=_[_0x96b8('0x48')](_0x33eaba['where'],{'$or':_[_0x96b8('0x37')](_0x33eaba['attributes'],function(_0x5a6338){var _0x4f30cf={};_0x4f30cf[_0x5a6338]={'$like':'%'+_0x2ba07d[_0x96b8('0x3c')][_0x96b8('0x57')]+'%'};return _0x4f30cf;})});}_0x33eaba=_['merge']({},_0x33eaba,_0x2ba07d['options']);return _0x3f9c25[_0x96b8('0x59')](_0x33eaba);}})[_0x96b8('0x1d')](function(_0x18d4b2){if(_0x18d4b2){_0x37b52c=_0x18d4b2[_0x96b8('0x58')];if(!_0x2ba07d[_0x96b8('0x3c')]['hasOwnProperty']('nolimit')){_0x33eaba[_0x96b8('0x43')]=qs[_0x96b8('0x43')](_0x2ba07d[_0x96b8('0x3c')][_0x96b8('0x43')]);_0x33eaba[_0x96b8('0x2c')]=qs['offset'](_0x2ba07d[_0x96b8('0x3c')][_0x96b8('0x2c')]);}return _0x3f9c25[_0x96b8('0x59')](_0x33eaba);}})[_0x96b8('0x1d')](function(_0x3a2753){if(_0x3a2753){return _0x3a2753?{'count':_0x37b52c,'rows':_0x3a2753}:null;}})[_0x96b8('0x1d')](respondWithResult(_0x4c0be6,null))[_0x96b8('0x26')](handleError(_0x4c0be6,null));};exports[_0x96b8('0x5b')]=function(_0x340fbf,_0x138bf0,_0x25d81b){var _0x88abb5={};var _0x2f6c32={};var _0x2f14ad;var _0x1e0860;return db[_0x96b8('0x38')][_0x96b8('0x55')]({'where':{'id':_0x340fbf[_0x96b8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x138bf0,null))[_0x96b8('0x1d')](function(_0x4850f0){if(_0x4850f0){_0x2f14ad=_0x4850f0;_0x2f6c32[_0x96b8('0x3b')]=_[_0x96b8('0x3d')](db[_0x96b8('0x56')][_0x96b8('0x5a')]);_0x2f6c32['query']=_['keys'](_0x340fbf[_0x96b8('0x3c')]);_0x2f6c32[_0x96b8('0x3e')]=_['intersection'](_0x2f6c32['model'],_0x2f6c32[_0x96b8('0x3c')]);_0x88abb5[_0x96b8('0x40')]=_['intersection'](_0x2f6c32[_0x96b8('0x3b')],qs[_0x96b8('0x41')](_0x340fbf['query'][_0x96b8('0x41')]));_0x88abb5[_0x96b8('0x40')]=_0x88abb5['attributes'][_0x96b8('0x58')]?_0x88abb5[_0x96b8('0x40')]:_0x2f6c32[_0x96b8('0x3b')];_0x88abb5[_0x96b8('0x44')]=qs[_0x96b8('0x45')](_0x340fbf[_0x96b8('0x3c')]['sort']);_0x88abb5[_0x96b8('0x46')]=qs[_0x96b8('0x3e')](_[_0x96b8('0x47')](_0x340fbf[_0x96b8('0x3c')],_0x2f6c32[_0x96b8('0x3e')]));if(_0x340fbf[_0x96b8('0x3c')]['filter']){_0x88abb5[_0x96b8('0x46')]=_[_0x96b8('0x48')](_0x88abb5[_0x96b8('0x46')],{'$or':_['map'](_0x88abb5[_0x96b8('0x40')],function(_0x125058){var _0x2fcfc8={};_0x2fcfc8[_0x125058]={'$like':'%'+_0x340fbf[_0x96b8('0x3c')][_0x96b8('0x57')]+'%'};return _0x2fcfc8;})});}_0x88abb5=_[_0x96b8('0x48')]({},_0x88abb5,_0x340fbf['options']);return _0x2f14ad[_0x96b8('0x5b')](_0x88abb5);}})[_0x96b8('0x1d')](function(_0x586b67){if(_0x586b67){_0x1e0860=_0x586b67[_0x96b8('0x58')];if(!_0x340fbf[_0x96b8('0x3c')][_0x96b8('0x42')](_0x96b8('0x5c'))){_0x88abb5[_0x96b8('0x43')]=qs[_0x96b8('0x43')](_0x340fbf[_0x96b8('0x3c')][_0x96b8('0x43')]);_0x88abb5[_0x96b8('0x2c')]=qs['offset'](_0x340fbf[_0x96b8('0x3c')]['offset']);}return _0x2f14ad[_0x96b8('0x5b')](_0x88abb5);}})['then'](function(_0x314dbf){if(_0x314dbf){return _0x314dbf?{'count':_0x1e0860,'rows':_0x314dbf}:null;}})[_0x96b8('0x1d')](respondWithResult(_0x138bf0,null))[_0x96b8('0x26')](handleError(_0x138bf0,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index b8caea9..4a5d1c4 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 _0x1647=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x8f1f55,_0x25e9e9){var _0x242ae9=function(_0xf863b8){while(--_0xf863b8){_0x8f1f55['push'](_0x8f1f55['shift']());}};_0x242ae9(++_0x25e9e9);}(_0x1647,0x166));var _0x7164=function(_0x261999,_0x15f7e8){_0x261999=_0x261999-0x0;var _0x109e04=_0x1647[_0x261999];return _0x109e04;};'use strict';var _=require('lodash');var util=require(_0x7164('0x0'));var logger=require(_0x7164('0x1'))(_0x7164('0x2'));var moment=require(_0x7164('0x3'));var BPromise=require(_0x7164('0x4'));var rp=require(_0x7164('0x5'));var fs=require('fs');var path=require(_0x7164('0x6'));var rimraf=require(_0x7164('0x7'));var config=require(_0x7164('0x8'));var attributes=require(_0x7164('0x9'));module[_0x7164('0xa')]=function(_0x157ac1,_0x57c0af){return _0x157ac1[_0x7164('0xb')]('SalesforceConfiguration',attributes,{'tableName':_0x7164('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd41=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','util'];(function(_0x3d5769,_0x10d297){var _0x46e7c4=function(_0x512330){while(--_0x512330){_0x3d5769['push'](_0x3d5769['shift']());}};_0x46e7c4(++_0x10d297);}(_0xcd41,0xcb));var _0x1cd4=function(_0x5f323e,_0x9e3f1e){_0x5f323e=_0x5f323e-0x0;var _0x1ef4a3=_0xcd41[_0x5f323e];return _0x1ef4a3;};'use strict';var _=require('lodash');var util=require(_0x1cd4('0x0'));var logger=require(_0x1cd4('0x1'))(_0x1cd4('0x2'));var moment=require(_0x1cd4('0x3'));var BPromise=require('bluebird');var rp=require(_0x1cd4('0x4'));var fs=require('fs');var path=require(_0x1cd4('0x5'));var rimraf=require(_0x1cd4('0x6'));var config=require(_0x1cd4('0x7'));var attributes=require(_0x1cd4('0x8'));module['exports']=function(_0x2ba29e,_0xddd53f){return _0x2ba29e[_0x1cd4('0x9')](_0x1cd4('0xa'),attributes,{'tableName':_0x1cd4('0xb'),'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 6d0374f..6798c9c 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 _0xfee2=['error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfee2,0x1e9));var _0x2fee=function(_0x922ec6,_0x3e0347){_0x922ec6=_0x922ec6-0x0;var _0xa629b3=_0xfee2[_0x922ec6];return _0xa629b3;};'use strict';var _=require(_0x2fee('0x0'));var util=require(_0x2fee('0x1'));var moment=require(_0x2fee('0x2'));var BPromise=require(_0x2fee('0x3'));var rs=require(_0x2fee('0x4'));var fs=require('fs');var Redis=require(_0x2fee('0x5'));var db=require(_0x2fee('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2fee('0x7'))('rpc');var config=require(_0x2fee('0x8'));var jayson=require(_0x2fee('0x9'));var client=jayson['client'][_0x2fee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cf571,_0x415535,_0x323d89){return new BPromise(function(_0x3808c7,_0x1923bd){return client[_0x2fee('0xb')](_0x1cf571,_0x323d89)[_0x2fee('0xc')](function(_0x4c5d6a){logger[_0x2fee('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x415535,_0x2fee('0xe'));logger[_0x2fee('0xf')](_0x2fee('0x10'),_0x415535,_0x2fee('0xe'),JSON['stringify'](_0x4c5d6a));if(_0x4c5d6a[_0x2fee('0x11')]){if(_0x4c5d6a['error'][_0x2fee('0x12')]===0x1f4){logger['error'](_0x2fee('0x13'),_0x415535,_0x4c5d6a[_0x2fee('0x11')][_0x2fee('0x14')]);return _0x1923bd(_0x4c5d6a[_0x2fee('0x11')][_0x2fee('0x14')]);}logger[_0x2fee('0x11')](_0x2fee('0x13'),_0x415535,_0x4c5d6a[_0x2fee('0x11')]['message']);return _0x3808c7(_0x4c5d6a[_0x2fee('0x11')][_0x2fee('0x14')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x415535,'request\x20sent');_0x3808c7(_0x4c5d6a[_0x2fee('0x15')][_0x2fee('0x14')]);}})['catch'](function(_0x1b8eaa){logger[_0x2fee('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x415535,_0x1b8eaa);_0x1923bd(_0x1b8eaa);});});} \ No newline at end of file +var _0xe5a3=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1a241a,_0xc0b628){var _0x2252a6=function(_0x559af4){while(--_0x559af4){_0x1a241a['push'](_0x1a241a['shift']());}};_0x2252a6(++_0xc0b628);}(_0xe5a3,0x9b));var _0x3e5a=function(_0x2f2bf2,_0x68f4d4){_0x2f2bf2=_0x2f2bf2-0x0;var _0x1952d7=_0xe5a3[_0x2f2bf2];return _0x1952d7;};'use strict';var _=require(_0x3e5a('0x0'));var util=require(_0x3e5a('0x1'));var moment=require(_0x3e5a('0x2'));var BPromise=require(_0x3e5a('0x3'));var rs=require(_0x3e5a('0x4'));var fs=require('fs');var Redis=require(_0x3e5a('0x5'));var db=require(_0x3e5a('0x6'))['db'];var utils=require(_0x3e5a('0x7'));var logger=require('../../config/logger')(_0x3e5a('0x8'));var config=require(_0x3e5a('0x9'));var jayson=require(_0x3e5a('0xa'));var client=jayson['client'][_0x3e5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa5832,_0x4d21b6,_0xafbba3){return new BPromise(function(_0x5ed429,_0x3e1aaa){return client[_0x3e5a('0xc')](_0xa5832,_0xafbba3)['then'](function(_0x1e9316){logger[_0x3e5a('0xd')](_0x3e5a('0xe'),_0x4d21b6,_0x3e5a('0xf'));logger[_0x3e5a('0x10')](_0x3e5a('0x11'),_0x4d21b6,'request\x20sent',JSON['stringify'](_0x1e9316));if(_0x1e9316[_0x3e5a('0x12')]){if(_0x1e9316[_0x3e5a('0x12')][_0x3e5a('0x13')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4d21b6,_0x1e9316['error'][_0x3e5a('0x14')]);return _0x3e1aaa(_0x1e9316[_0x3e5a('0x12')][_0x3e5a('0x14')]);}logger[_0x3e5a('0x12')](_0x3e5a('0xe'),_0x4d21b6,_0x1e9316[_0x3e5a('0x12')]['message']);return _0x5ed429(_0x1e9316[_0x3e5a('0x12')][_0x3e5a('0x14')]);}else{logger['info'](_0x3e5a('0xe'),_0x4d21b6,'request\x20sent');_0x5ed429(_0x1e9316[_0x3e5a('0x15')][_0x3e5a('0x14')]);}})[_0x3e5a('0x16')](function(_0x1b6a91){logger[_0x3e5a('0x12')](_0x3e5a('0xe'),_0x4d21b6,_0x1b6a91);_0x3e1aaa(_0x1b6a91);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 6a198e8..2ea5da0 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 _0x1db9=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','post','put','update','delete','multer'];(function(_0x4be00f,_0x439698){var _0x4fee70=function(_0x576e19){while(--_0x576e19){_0x4be00f['push'](_0x4be00f['shift']());}};_0x4fee70(++_0x439698);}(_0x1db9,0x176));var _0x91db=function(_0x206c77,_0x2f9b54){_0x206c77=_0x206c77-0x0;var _0x35a782=_0x1db9[_0x206c77];return _0x35a782;};'use strict';var multer=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var path=require(_0x91db('0x2'));var timeout=require(_0x91db('0x3'));var express=require(_0x91db('0x4'));var router=express[_0x91db('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x91db('0x6'));var config=require(_0x91db('0x7'));var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x91db('0x8')](),controller['index']);router['get'](_0x91db('0x9'),auth[_0x91db('0x8')](),controller[_0x91db('0xa')]);router[_0x91db('0xb')]('/',auth[_0x91db('0x8')](),controller['create']);router[_0x91db('0xc')]('/:id',auth[_0x91db('0x8')](),controller[_0x91db('0xd')]);router[_0x91db('0xe')]('/:id',auth[_0x91db('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf69d=['get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf69d,0xd3));var _0xdf69=function(_0x31f3d4,_0x593279){_0x31f3d4=_0x31f3d4-0x0;var _0x2db57b=_0xf69d[_0x31f3d4];return _0x2db57b;};'use strict';var multer=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var path=require(_0xdf69('0x2'));var timeout=require(_0xdf69('0x3'));var express=require(_0xdf69('0x4'));var router=express['Router']();var auth=require(_0xdf69('0x5'));var interaction=require(_0xdf69('0x6'));var config=require(_0xdf69('0x7'));var controller=require(_0xdf69('0x8'));router[_0xdf69('0x9')]('/',auth[_0xdf69('0xa')](),controller[_0xdf69('0xb')]);router[_0xdf69('0x9')](_0xdf69('0xc'),auth[_0xdf69('0xa')](),controller[_0xdf69('0xd')]);router[_0xdf69('0xe')]('/',auth[_0xdf69('0xa')](),controller[_0xdf69('0xf')]);router[_0xdf69('0x10')](_0xdf69('0xc'),auth[_0xdf69('0xa')](),controller['update']);router[_0xdf69('0x11')](_0xdf69('0xc'),auth[_0xdf69('0xa')](),controller[_0xdf69('0x12')]);module[_0xdf69('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 427c9ff..41e8b49 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 _0xbb6e=['ENUM','exports','variable','customVariable','keyValue','string','STRING'];(function(_0x2d77f3,_0x42c7c3){var _0x24bbf9=function(_0x366086){while(--_0x366086){_0x2d77f3['push'](_0x2d77f3['shift']());}};_0x24bbf9(++_0x42c7c3);}(_0xbb6e,0x135));var _0xebb6=function(_0x233004,_0x555669){_0x233004=_0x233004-0x0;var _0x262ae5=_0xbb6e[_0x233004];return _0x262ae5;};'use strict';var Sequelize=require('sequelize');module[_0xebb6('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xebb6('0x1'),_0xebb6('0x2'),_0xebb6('0x3')),'defaultValue':_0xebb6('0x4')},'content':{'type':Sequelize[_0xebb6('0x5')]},'key':{'type':Sequelize[_0xebb6('0x5')]},'keyType':{'type':Sequelize[_0xebb6('0x6')](_0xebb6('0x4'),_0xebb6('0x1'),_0xebb6('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xebb6('0x5')]}}; \ No newline at end of file +var _0xe3d3=['keyValue','STRING','ENUM','string','variable','customVariable'];(function(_0x29316f,_0x1de46e){var _0x6e8a1b=function(_0x270249){while(--_0x270249){_0x29316f['push'](_0x29316f['shift']());}};_0x6e8a1b(++_0x1de46e);}(_0xe3d3,0x104));var _0x3e3d=function(_0x43a323,_0x36e24f){_0x43a323=_0x43a323-0x0;var _0xac3c7e=_0xe3d3[_0x43a323];return _0xac3c7e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x3e3d('0x0')](_0x3e3d('0x1'),_0x3e3d('0x2'),_0x3e3d('0x3'),_0x3e3d('0x4')),'defaultValue':_0x3e3d('0x1')},'content':{'type':Sequelize[_0x3e3d('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3e3d('0x0')](_0x3e3d('0x1'),_0x3e3d('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x3e3d('0x5')]},'idField':{'type':Sequelize[_0x3e3d('0x5')]},'variableName':{'type':Sequelize[_0x3e3d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index ac26f1c..d872f5f 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 _0xadb5=['name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','VIRTUAL','merge','options','SalesforceField','findAll','rows','catch','show','rawAttributes','fields','includeAll','include','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','then','destroy','stack'];(function(_0x2adce9,_0x187186){var _0x1d0e97=function(_0x813ee4){while(--_0x813ee4){_0x2adce9['push'](_0x2adce9['shift']());}};_0x1d0e97(++_0x187186);}(_0xadb5,0xad));var _0x5adb=function(_0x3bfd11,_0x48be8a){_0x3bfd11=_0x3bfd11-0x0;var _0x262278=_0xadb5[_0x3bfd11];return _0x262278;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var db=require(_0x5adb('0x17'))['db'];function respondWithStatusCode(_0x56012f,_0x2a0b70){_0x2a0b70=_0x2a0b70||0xcc;return function(_0x5433bf){if(_0x5433bf){return _0x56012f[_0x5adb('0x18')](_0x2a0b70);}return _0x56012f[_0x5adb('0x19')](_0x2a0b70)[_0x5adb('0x1a')]();};}function respondWithResult(_0x5c929a,_0x2a545b){_0x2a545b=_0x2a545b||0xc8;return function(_0x34af2c){if(_0x34af2c){return _0x5c929a[_0x5adb('0x19')](_0x2a545b)['json'](_0x34af2c);}};}function respondWithFilteredResult(_0x2312de,_0x518823){return function(_0x367d82){if(_0x367d82){var _0x42a482=_0x367d82[_0x5adb('0x1b')],_0x30614e=_0x518823[_0x5adb('0x1c')],_0x304784=_0x518823[_0x5adb('0x1c')]+_0x518823[_0x5adb('0x1d')],_0x1c0f97;if(_0x304784>=_0x42a482){_0x304784=_0x42a482;_0x1c0f97=0xc8;}else{_0x1c0f97=0xce;}_0x2312de['status'](_0x1c0f97);return _0x2312de[_0x5adb('0x1e')]('Content-Range',_0x30614e+'-'+_0x304784+'/'+_0x42a482)[_0x5adb('0x1f')](_0x367d82);}return null;};}function patchUpdates(_0x558f76){return function(_0x3ef465){try{jsonpatch['apply'](_0x3ef465,_0x558f76,!![]);}catch(_0x5e218c){return BPromise[_0x5adb('0x20')](_0x5e218c);}return _0x3ef465[_0x5adb('0x21')]();};}function saveUpdates(_0x438671,_0x1fd4a7){return function(_0x99bc6c){if(_0x99bc6c){return _0x99bc6c['update'](_0x438671)[_0x5adb('0x22')](function(_0x5c296e){return _0x5c296e;});}return null;};}function removeEntity(_0x4e9f16,_0x3754cc){return function(_0x379b33){if(_0x379b33){return _0x379b33[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0x4e9f16[_0x5adb('0x19')](0xcc)[_0x5adb('0x1a')]();});}};}function handleEntityNotFound(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(!_0x4b1957){_0xfd9bb9[_0x5adb('0x18')](0x194);}return _0x4b1957;};}function handleError(_0x3220cd,_0x3839fb){_0x3839fb=_0x3839fb||0x1f4;return function(_0xeb556c){logger['error'](_0xeb556c[_0x5adb('0x24')]);if(_0xeb556c[_0x5adb('0x25')]){delete _0xeb556c['name'];}_0x3220cd[_0x5adb('0x19')](_0x3839fb)[_0x5adb('0x26')](_0xeb556c);};}exports[_0x5adb('0x27')]=function(_0x55b40a,_0x13ad1d){var _0xbe21b1={},_0x3a4fca={},_0x2c64a3={'count':0x0,'rows':[]};var _0x36459b=_[_0x5adb('0x28')](db['SalesforceField']['rawAttributes'],function(_0x5d457e){return{'name':_0x5d457e[_0x5adb('0x29')],'type':_0x5d457e[_0x5adb('0x2a')][_0x5adb('0x2b')]};});_0x3a4fca[_0x5adb('0x2c')]=_[_0x5adb('0x28')](_0x36459b,'name');_0x3a4fca[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x55b40a[_0x5adb('0x2d')]);_0x3a4fca[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x3a4fca[_0x5adb('0x2c')],_0x3a4fca[_0x5adb('0x2d')]);_0xbe21b1[_0x5adb('0x31')]=_[_0x5adb('0x30')](_0x3a4fca[_0x5adb('0x2c')],qs['fields'](_0x55b40a[_0x5adb('0x2d')]['fields']));_0xbe21b1[_0x5adb('0x31')]=_0xbe21b1[_0x5adb('0x31')]['length']?_0xbe21b1[_0x5adb('0x31')]:_0x3a4fca[_0x5adb('0x2c')];if(!_0x55b40a[_0x5adb('0x2d')]['hasOwnProperty'](_0x5adb('0x32'))){_0xbe21b1[_0x5adb('0x1d')]=qs['limit'](_0x55b40a['query'][_0x5adb('0x1d')]);_0xbe21b1['offset']=qs[_0x5adb('0x1c')](_0x55b40a[_0x5adb('0x2d')][_0x5adb('0x1c')]);}_0xbe21b1[_0x5adb('0x33')]=qs[_0x5adb('0x34')](_0x55b40a['query'][_0x5adb('0x34')]);_0xbe21b1[_0x5adb('0x35')]=qs[_0x5adb('0x2f')](_['pick'](_0x55b40a['query'],_0x3a4fca[_0x5adb('0x2f')]));if(_0x55b40a[_0x5adb('0x2d')]['filter']){_0xbe21b1[_0x5adb('0x35')]=_['merge'](_0xbe21b1[_0x5adb('0x35')],{'$or':_['map'](_0x36459b,function(_0x11cb37){if(_0x11cb37['type']!==_0x5adb('0x36')){var _0x23a1db={};_0x23a1db[_0x11cb37['name']]={'$like':'%'+_0x55b40a[_0x5adb('0x2d')]['filter']+'%'};return _0x23a1db;}})});}_0xbe21b1=_[_0x5adb('0x37')]({},_0xbe21b1,_0x55b40a[_0x5adb('0x38')]);var _0xd5660c={'where':_0xbe21b1['where']};return db[_0x5adb('0x39')][_0x5adb('0x1b')](_0xd5660c)[_0x5adb('0x22')](function(_0x132803){_0x2c64a3[_0x5adb('0x1b')]=_0x132803;if(_0x55b40a['query']['includeAll']){_0xbe21b1['include']=[{'all':!![]}];}return db['SalesforceField'][_0x5adb('0x3a')](_0xbe21b1);})[_0x5adb('0x22')](function(_0x3a104a){_0x2c64a3[_0x5adb('0x3b')]=_0x3a104a;return _0x2c64a3;})[_0x5adb('0x22')](respondWithFilteredResult(_0x13ad1d,_0xbe21b1))[_0x5adb('0x3c')](handleError(_0x13ad1d,null));};exports[_0x5adb('0x3d')]=function(_0x3bf282,_0x478a70){var _0x53f2c6={'raw':!![],'where':{'id':_0x3bf282['params']['id']}},_0x27dbb7={};_0x27dbb7[_0x5adb('0x2c')]=_[_0x5adb('0x2e')](db[_0x5adb('0x39')][_0x5adb('0x3e')]);_0x27dbb7[_0x5adb('0x2d')]=_['keys'](_0x3bf282[_0x5adb('0x2d')]);_0x27dbb7[_0x5adb('0x2f')]=_['intersection'](_0x27dbb7[_0x5adb('0x2c')],_0x27dbb7[_0x5adb('0x2d')]);_0x53f2c6['attributes']=_[_0x5adb('0x30')](_0x27dbb7[_0x5adb('0x2c')],qs[_0x5adb('0x3f')](_0x3bf282[_0x5adb('0x2d')][_0x5adb('0x3f')]));_0x53f2c6[_0x5adb('0x31')]=_0x53f2c6[_0x5adb('0x31')]['length']?_0x53f2c6['attributes']:_0x27dbb7[_0x5adb('0x2c')];if(_0x3bf282[_0x5adb('0x2d')][_0x5adb('0x40')]){_0x53f2c6[_0x5adb('0x41')]=[{'all':!![]}];}_0x53f2c6=_['merge']({},_0x53f2c6,_0x3bf282['options']);return db[_0x5adb('0x39')][_0x5adb('0x42')](_0x53f2c6)[_0x5adb('0x22')](handleEntityNotFound(_0x478a70,null))[_0x5adb('0x22')](respondWithResult(_0x478a70,null))[_0x5adb('0x3c')](handleError(_0x478a70,null));};exports['create']=function(_0x182cbc,_0x437f52){return db['SalesforceField'][_0x5adb('0x43')](_0x182cbc[_0x5adb('0x44')],{})[_0x5adb('0x22')](respondWithResult(_0x437f52,0xc9))[_0x5adb('0x3c')](handleError(_0x437f52,null));};exports[_0x5adb('0x45')]=function(_0x3a5409,_0x39840e){if(_0x3a5409[_0x5adb('0x44')]['id']){delete _0x3a5409['body']['id'];}return db[_0x5adb('0x39')]['find']({'where':{'id':_0x3a5409['params']['id']}})['then'](handleEntityNotFound(_0x39840e,null))[_0x5adb('0x22')](saveUpdates(_0x3a5409[_0x5adb('0x44')],null))[_0x5adb('0x22')](respondWithResult(_0x39840e,null))['catch'](handleError(_0x39840e,null));};exports[_0x5adb('0x23')]=function(_0x5cbab5,_0x177a81){return db[_0x5adb('0x39')][_0x5adb('0x42')]({'where':{'id':_0x5cbab5['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x177a81,null))['then'](removeEntity(_0x177a81,null))[_0x5adb('0x3c')](handleError(_0x177a81,null));}; \ No newline at end of file +var _0xdb28=['json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','SalesforceField','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter','merge','VIRTUAL','options','where','count','includeAll','include','findAll','rows','show','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','end','status'];(function(_0x10b317,_0x2adf32){var _0x1e3054=function(_0x38ed3e){while(--_0x38ed3e){_0x10b317['push'](_0x10b317['shift']());}};_0x1e3054(++_0x2adf32);}(_0xdb28,0x106));var _0x8db2=function(_0x81c7ca,_0x4a454f){_0x81c7ca=_0x81c7ca-0x0;var _0x28279e=_0xdb28[_0x81c7ca];return _0x28279e;};'use strict';var pdf=require(_0x8db2('0x0'));var emlformat=require(_0x8db2('0x1'));var rimraf=require(_0x8db2('0x2'));var zipdir=require(_0x8db2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8db2('0x4'));var moment=require(_0x8db2('0x5'));var BPromise=require(_0x8db2('0x6'));var Mustache=require(_0x8db2('0x7'));var util=require(_0x8db2('0x8'));var path=require('path');var sox=require(_0x8db2('0x9'));var csv=require(_0x8db2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0xa'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var db=require(_0x8db2('0x17'))['db'];function respondWithStatusCode(_0x1349f6,_0x204f49){_0x204f49=_0x204f49||0xcc;return function(_0x37d017){if(_0x37d017){return _0x1349f6['sendStatus'](_0x204f49);}return _0x1349f6['status'](_0x204f49)[_0x8db2('0x18')]();};}function respondWithResult(_0x15e87c,_0x350d61){_0x350d61=_0x350d61||0xc8;return function(_0x1d6a15){if(_0x1d6a15){return _0x15e87c[_0x8db2('0x19')](_0x350d61)[_0x8db2('0x1a')](_0x1d6a15);}};}function respondWithFilteredResult(_0x2f177a,_0x3c96a7){return function(_0x131252){if(_0x131252){var _0x16c8c2=_0x131252['count'],_0x5489a9=_0x3c96a7[_0x8db2('0x1b')],_0x13b0f5=_0x3c96a7[_0x8db2('0x1b')]+_0x3c96a7[_0x8db2('0x1c')],_0x24da1b;if(_0x13b0f5>=_0x16c8c2){_0x13b0f5=_0x16c8c2;_0x24da1b=0xc8;}else{_0x24da1b=0xce;}_0x2f177a[_0x8db2('0x19')](_0x24da1b);return _0x2f177a[_0x8db2('0x1d')](_0x8db2('0x1e'),_0x5489a9+'-'+_0x13b0f5+'/'+_0x16c8c2)['json'](_0x131252);}return null;};}function patchUpdates(_0x5df464){return function(_0x77789){try{jsonpatch[_0x8db2('0x1f')](_0x77789,_0x5df464,!![]);}catch(_0x1310d3){return BPromise[_0x8db2('0x20')](_0x1310d3);}return _0x77789['save']();};}function saveUpdates(_0x431d60,_0x36a9ff){return function(_0x260940){if(_0x260940){return _0x260940[_0x8db2('0x21')](_0x431d60)[_0x8db2('0x22')](function(_0x597260){return _0x597260;});}return null;};}function removeEntity(_0x124467,_0x3e30e6){return function(_0x18f69c){if(_0x18f69c){return _0x18f69c[_0x8db2('0x23')]()[_0x8db2('0x22')](function(){_0x124467[_0x8db2('0x19')](0xcc)[_0x8db2('0x18')]();});}};}function handleEntityNotFound(_0x5c6614,_0x256202){return function(_0x4f6516){if(!_0x4f6516){_0x5c6614['sendStatus'](0x194);}return _0x4f6516;};}function handleError(_0x52a9ca,_0x4d923c){_0x4d923c=_0x4d923c||0x1f4;return function(_0xec8cd2){logger[_0x8db2('0x24')](_0xec8cd2[_0x8db2('0x25')]);if(_0xec8cd2[_0x8db2('0x26')]){delete _0xec8cd2[_0x8db2('0x26')];}_0x52a9ca[_0x8db2('0x19')](_0x4d923c)['send'](_0xec8cd2);};}exports[_0x8db2('0x27')]=function(_0x372311,_0x430dd5){var _0x8b7cec={},_0x483aee={},_0x2e0691={'count':0x0,'rows':[]};var _0x11f398=_[_0x8db2('0x28')](db[_0x8db2('0x29')][_0x8db2('0x2a')],function(_0x21bae5){return{'name':_0x21bae5[_0x8db2('0x2b')],'type':_0x21bae5[_0x8db2('0x2c')][_0x8db2('0x2d')]};});_0x483aee['model']=_[_0x8db2('0x28')](_0x11f398,'name');_0x483aee['query']=_[_0x8db2('0x2e')](_0x372311[_0x8db2('0x2f')]);_0x483aee[_0x8db2('0x30')]=_['intersection'](_0x483aee[_0x8db2('0x31')],_0x483aee['query']);_0x8b7cec[_0x8db2('0x32')]=_[_0x8db2('0x33')](_0x483aee[_0x8db2('0x31')],qs['fields'](_0x372311['query'][_0x8db2('0x34')]));_0x8b7cec[_0x8db2('0x32')]=_0x8b7cec['attributes']['length']?_0x8b7cec[_0x8db2('0x32')]:_0x483aee[_0x8db2('0x31')];if(!_0x372311[_0x8db2('0x2f')][_0x8db2('0x35')](_0x8db2('0x36'))){_0x8b7cec[_0x8db2('0x1c')]=qs[_0x8db2('0x1c')](_0x372311[_0x8db2('0x2f')][_0x8db2('0x1c')]);_0x8b7cec[_0x8db2('0x1b')]=qs['offset'](_0x372311[_0x8db2('0x2f')][_0x8db2('0x1b')]);}_0x8b7cec['order']=qs[_0x8db2('0x37')](_0x372311[_0x8db2('0x2f')]['sort']);_0x8b7cec['where']=qs[_0x8db2('0x30')](_['pick'](_0x372311[_0x8db2('0x2f')],_0x483aee[_0x8db2('0x30')]));if(_0x372311[_0x8db2('0x2f')][_0x8db2('0x38')]){_0x8b7cec['where']=_[_0x8db2('0x39')](_0x8b7cec['where'],{'$or':_[_0x8db2('0x28')](_0x11f398,function(_0xd550ae){if(_0xd550ae[_0x8db2('0x2c')]!==_0x8db2('0x3a')){var _0x50e88a={};_0x50e88a[_0xd550ae['name']]={'$like':'%'+_0x372311[_0x8db2('0x2f')][_0x8db2('0x38')]+'%'};return _0x50e88a;}})});}_0x8b7cec=_['merge']({},_0x8b7cec,_0x372311[_0x8db2('0x3b')]);var _0x24bcfe={'where':_0x8b7cec[_0x8db2('0x3c')]};return db['SalesforceField'][_0x8db2('0x3d')](_0x24bcfe)[_0x8db2('0x22')](function(_0x953349){_0x2e0691[_0x8db2('0x3d')]=_0x953349;if(_0x372311[_0x8db2('0x2f')][_0x8db2('0x3e')]){_0x8b7cec[_0x8db2('0x3f')]=[{'all':!![]}];}return db[_0x8db2('0x29')][_0x8db2('0x40')](_0x8b7cec);})[_0x8db2('0x22')](function(_0x21cf7c){_0x2e0691[_0x8db2('0x41')]=_0x21cf7c;return _0x2e0691;})[_0x8db2('0x22')](respondWithFilteredResult(_0x430dd5,_0x8b7cec))['catch'](handleError(_0x430dd5,null));};exports[_0x8db2('0x42')]=function(_0x2b2472,_0x5e0382){var _0x49a7ae={'raw':!![],'where':{'id':_0x2b2472['params']['id']}},_0x249c73={};_0x249c73[_0x8db2('0x31')]=_[_0x8db2('0x2e')](db[_0x8db2('0x29')][_0x8db2('0x2a')]);_0x249c73[_0x8db2('0x2f')]=_[_0x8db2('0x2e')](_0x2b2472[_0x8db2('0x2f')]);_0x249c73['filters']=_[_0x8db2('0x33')](_0x249c73[_0x8db2('0x31')],_0x249c73[_0x8db2('0x2f')]);_0x49a7ae[_0x8db2('0x32')]=_['intersection'](_0x249c73[_0x8db2('0x31')],qs[_0x8db2('0x34')](_0x2b2472[_0x8db2('0x2f')][_0x8db2('0x34')]));_0x49a7ae['attributes']=_0x49a7ae[_0x8db2('0x32')]['length']?_0x49a7ae[_0x8db2('0x32')]:_0x249c73[_0x8db2('0x31')];if(_0x2b2472[_0x8db2('0x2f')]['includeAll']){_0x49a7ae['include']=[{'all':!![]}];}_0x49a7ae=_[_0x8db2('0x39')]({},_0x49a7ae,_0x2b2472['options']);return db[_0x8db2('0x29')][_0x8db2('0x43')](_0x49a7ae)[_0x8db2('0x22')](handleEntityNotFound(_0x5e0382,null))[_0x8db2('0x22')](respondWithResult(_0x5e0382,null))[_0x8db2('0x44')](handleError(_0x5e0382,null));};exports[_0x8db2('0x45')]=function(_0x4355e2,_0xab6bdd){return db[_0x8db2('0x29')][_0x8db2('0x45')](_0x4355e2[_0x8db2('0x46')],{})[_0x8db2('0x22')](respondWithResult(_0xab6bdd,0xc9))['catch'](handleError(_0xab6bdd,null));};exports[_0x8db2('0x21')]=function(_0x2ada52,_0xdbba64){if(_0x2ada52[_0x8db2('0x46')]['id']){delete _0x2ada52['body']['id'];}return db['SalesforceField'][_0x8db2('0x43')]({'where':{'id':_0x2ada52[_0x8db2('0x47')]['id']}})[_0x8db2('0x22')](handleEntityNotFound(_0xdbba64,null))['then'](saveUpdates(_0x2ada52['body'],null))['then'](respondWithResult(_0xdbba64,null))[_0x8db2('0x44')](handleError(_0xdbba64,null));};exports[_0x8db2('0x23')]=function(_0x55c7dd,_0x383fa1){return db[_0x8db2('0x29')][_0x8db2('0x43')]({'where':{'id':_0x55c7dd[_0x8db2('0x47')]['id']}})['then'](handleEntityNotFound(_0x383fa1,null))['then'](removeEntity(_0x383fa1,null))[_0x8db2('0x44')](handleError(_0x383fa1,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index af9b813..3743ab2 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 _0x64c4=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x64c4,0x11b));var _0x464c=function(_0x5e9c04,_0x5d0f0b){_0x5e9c04=_0x5e9c04-0x0;var _0x24a410=_0x64c4[_0x5e9c04];return _0x24a410;};'use strict';var _=require(_0x464c('0x0'));var util=require(_0x464c('0x1'));var logger=require(_0x464c('0x2'))(_0x464c('0x3'));var moment=require(_0x464c('0x4'));var BPromise=require(_0x464c('0x5'));var rp=require(_0x464c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x464c('0x7'));var config=require(_0x464c('0x8'));var attributes=require(_0x464c('0x9'));module['exports']=function(_0x50f541,_0x1ddd0b){return _0x50f541[_0x464c('0xa')](_0x464c('0xb'),attributes,{'tableName':_0x464c('0xc'),'paranoid':![],'indexes':[{'name':_0x464c('0xd'),'fields':['idField',_0x464c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4119=['bluebird','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x3d6ae5,_0x49631a){var _0x242ce1=function(_0x20ef0b){while(--_0x20ef0b){_0x3d6ae5['push'](_0x3d6ae5['shift']());}};_0x242ce1(++_0x49631a);}(_0x4119,0xfa));var _0x9411=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x4119[_0x4bb66f];return _0xf2772f;};'use strict';var _=require(_0x9411('0x0'));var util=require(_0x9411('0x1'));var logger=require(_0x9411('0x2'))(_0x9411('0x3'));var moment=require(_0x9411('0x4'));var BPromise=require(_0x9411('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9411('0x6'));var rimraf=require(_0x9411('0x7'));var config=require('../../config/environment');var attributes=require(_0x9411('0x8'));module[_0x9411('0x9')]=function(_0x2283c8,_0x1bd226){return _0x2283c8[_0x9411('0xa')](_0x9411('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x9411('0xc'),'fields':[_0x9411('0xd'),_0x9411('0xe')],'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 057951f..2a490e0 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 _0xa9e0=['http','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x287844,_0x19d7f7){var _0x2d12ce=function(_0xa5e249){while(--_0xa5e249){_0x287844['push'](_0x287844['shift']());}};_0x2d12ce(++_0x19d7f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 _0x9bde=['code','message','SalesforceField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x1257fc,_0xd88acf){var _0x5e8e16=function(_0x1c973e){while(--_0x1c973e){_0x1257fc['push'](_0x1257fc['shift']());}};_0x5e8e16(++_0xd88acf);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4d6947,_0x4c13c3){_0x4d6947=_0x4d6947-0x0;var _0x577031=_0x9bde[_0x4d6947];return _0x577031;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('SalesforceField,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 7d3cfe9..3e4fd3e 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 _0xfa5d=['create','/:id','update','delete','destroy','exports','multer','express','Router','../../config/environment','get','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post'];(function(_0x12921e,_0x431cd2){var _0x3ac81a=function(_0xd5834e){while(--_0xd5834e){_0x12921e['push'](_0x12921e['shift']());}};_0x3ac81a(++_0x431cd2);}(_0xfa5d,0x19e));var _0xdfa5=function(_0x4cf515,_0x1ddde4){_0x4cf515=_0x4cf515-0x0;var _0x1a9a20=_0xfa5d[_0x4cf515];return _0x1a9a20;};'use strict';var multer=require(_0xdfa5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdfa5('0x1'));var router=express[_0xdfa5('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdfa5('0x3'));var controller=require('./intServicenowAccount.controller');router[_0xdfa5('0x4')]('/',auth[_0xdfa5('0x5')](),controller['index']);router[_0xdfa5('0x4')]('/:id',auth[_0xdfa5('0x5')](),controller[_0xdfa5('0x6')]);router['get'](_0xdfa5('0x7'),auth['isAuthenticated'](),controller[_0xdfa5('0x8')]);router[_0xdfa5('0x4')]('/:id/fields',auth['isAuthenticated'](),controller[_0xdfa5('0x9')]);router[_0xdfa5('0xa')]('/',auth[_0xdfa5('0x5')](),controller[_0xdfa5('0xb')]);router[_0xdfa5('0xa')](_0xdfa5('0x7'),auth[_0xdfa5('0x5')](),controller['addConfiguration']);router['put'](_0xdfa5('0xc'),auth[_0xdfa5('0x5')](),controller[_0xdfa5('0xd')]);router[_0xdfa5('0xe')](_0xdfa5('0xc'),auth[_0xdfa5('0x5')](),controller[_0xdfa5('0xf')]);module[_0xdfa5('0x10')]=router; \ No newline at end of file +var _0x075e=['getFields','create','post','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations'];(function(_0x570f58,_0x31ab9f){var _0x5b91ed=function(_0x29e450){while(--_0x29e450){_0x570f58['push'](_0x570f58['shift']());}};_0x5b91ed(++_0x31ab9f);}(_0x075e,0x92));var _0xe075=function(_0x57e74d,_0x102be2){_0x57e74d=_0x57e74d-0x0;var _0x5dc482=_0x075e[_0x57e74d];return _0x5dc482;};'use strict';var multer=require('multer');var util=require(_0xe075('0x0'));var path=require(_0xe075('0x1'));var timeout=require(_0xe075('0x2'));var express=require(_0xe075('0x3'));var router=express[_0xe075('0x4')]();var auth=require(_0xe075('0x5'));var interaction=require(_0xe075('0x6'));var config=require(_0xe075('0x7'));var controller=require('./intServicenowAccount.controller');router[_0xe075('0x8')]('/',auth[_0xe075('0x9')](),controller['index']);router[_0xe075('0x8')](_0xe075('0xa'),auth[_0xe075('0x9')](),controller[_0xe075('0xb')]);router[_0xe075('0x8')](_0xe075('0xc'),auth['isAuthenticated'](),controller[_0xe075('0xd')]);router[_0xe075('0x8')]('/:id/fields',auth[_0xe075('0x9')](),controller[_0xe075('0xe')]);router['post']('/',auth[_0xe075('0x9')](),controller[_0xe075('0xf')]);router[_0xe075('0x10')](_0xe075('0xc'),auth[_0xe075('0x9')](),controller['addConfiguration']);router['put']('/:id',auth[_0xe075('0x9')](),controller[_0xe075('0x11')]);router[_0xe075('0x12')](_0xe075('0xa'),auth['isAuthenticated'](),controller[_0xe075('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 407d7f9..148f2e1 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 _0xaa4a=['username','remoteUri','sequelize','exports','STRING'];(function(_0xd597e6,_0x6516ab){var _0x277210=function(_0x313a8b){while(--_0x313a8b){_0xd597e6['push'](_0xd597e6['shift']());}};_0x277210(++_0x6516ab);}(_0xaa4a,0x11f));var _0xaaa4=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xaa4a[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0xaaa4('0x0'));module[_0xaaa4('0x1')]={'name':{'type':Sequelize[_0xaaa4('0x2')]},'description':{'type':Sequelize[_0xaaa4('0x2')]},'username':{'type':Sequelize[_0xaaa4('0x2')],'unique':_0xaaa4('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xaaa4('0x2')]},'remoteUri':{'type':Sequelize[_0xaaa4('0x2')],'unique':_0xaaa4('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8b40=['STRING','username','remoteUri','exports'];(function(_0x387cf8,_0x2f315e){var _0x5ea689=function(_0x19836a){while(--_0x19836a){_0x387cf8['push'](_0x387cf8['shift']());}};_0x5ea689(++_0x2f315e);}(_0x8b40,0x1d3));var _0x08b4=function(_0x2b1b19,_0x2eac02){_0x2b1b19=_0x2b1b19-0x0;var _0x511f69=_0x8b40[_0x2b1b19];return _0x511f69;};'use strict';var Sequelize=require('sequelize');module[_0x08b4('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x08b4('0x1')],'unique':_0x08b4('0x2')},'password':{'type':Sequelize[_0x08b4('0x1')]},'email':{'type':Sequelize[_0x08b4('0x1')]},'remoteUri':{'type':Sequelize[_0x08b4('0x1')],'unique':_0x08b4('0x3')},'serverUrl':{'type':Sequelize[_0x08b4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 7f0d489..f216b29 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 _0xb60c=['options','count','includeAll','include','ServicenowAccount','findAll','then','rows','show','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','incident_state','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','sys_updated_by','opened_by','sys_created_on','sys_domain','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','business_service','sys_domain_path','rfc','time_worked','expected_start','business_duration','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','assignment_group','additional_assignee_list','calendar_duration','notify','sys_class_name','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','%s/api/now/doc/table/schema/','format','GET','log','assign','remove','includes','forEach','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','all','concat','ServiceNow\x20error:\x20','statusCode','send','boolean','True','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','test','Sequelize','request','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0x19a32b,_0xd197f1){var _0x45a923=function(_0xd1a655){while(--_0xd1a655){_0x19a32b['push'](_0x19a32b['shift']());}};_0x45a923(++_0xd197f1);}(_0xb60c,0x128));var _0xcb60=function(_0x2422e9,_0x121e4d){_0x2422e9=_0x2422e9-0x0;var _0x232482=_0xb60c[_0x2422e9];return _0x232482;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcb60('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb60('0x1'));var jsonpatch=require(_0xcb60('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcb60('0x3'));var util=require(_0xcb60('0x4'));var path=require(_0xcb60('0x5'));var sox=require(_0xcb60('0x6'));var csv=require(_0xcb60('0x7'));var ejs=require(_0xcb60('0x8'));var fs=require('fs');var _=require(_0xcb60('0x9'));var squel=require('squel');var crypto=require(_0xcb60('0xa'));var jsforce=require(_0xcb60('0xb'));var deskjs=require(_0xcb60('0xc'));var toCsv=require(_0xcb60('0x7'));var querystring=require(_0xcb60('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcb60('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb60('0xf'));var logger=require(_0xcb60('0x10'))(_0xcb60('0x11'));var utils=require(_0xcb60('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x484c2b,_0x39d0d1,_0x114c89){if(_0x114c89){var _0x30864f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30864f[_0xcb60('0x13')](_0x39d0d1)){return _0x484c2b;}else{throw new db[(_0xcb60('0x14'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x484c2b;}}function respondWithRpcPromise(_0x5780bd,_0x4a938a,_0x4c4146,_0x54a00e){return new BPromise(function(_0x55153b,_0x3d3a76){var _0x315845=_0x54a00e||client;return _0x315845[_0xcb60('0x15')](_0x5780bd,_0x4c4146)['then'](function(_0x9d8ad1){logger[_0xcb60('0x16')](_0xcb60('0x17'),_0x4a938a,'request\x20sent');logger[_0xcb60('0x18')](_0xcb60('0x19'),_0x4a938a,_0xcb60('0x1a'),JSON[_0xcb60('0x1b')](_0x9d8ad1));if(_0x9d8ad1[_0xcb60('0x1c')]){if(_0x9d8ad1[_0xcb60('0x1c')][_0xcb60('0x1d')]===0x1f4){logger[_0xcb60('0x1c')](_0xcb60('0x17'),_0x4a938a,_0x9d8ad1[_0xcb60('0x1c')][_0xcb60('0x1e')]);return _0x3d3a76(_0x9d8ad1['error'][_0xcb60('0x1e')]);}logger[_0xcb60('0x1c')](_0xcb60('0x17'),_0x4a938a,_0x9d8ad1[_0xcb60('0x1c')]['message']);return _0x55153b(_0x9d8ad1['error'][_0xcb60('0x1e')]);}else{logger[_0xcb60('0x16')](_0xcb60('0x17'),_0x4a938a,_0xcb60('0x1a'));_0x55153b(_0x9d8ad1[_0xcb60('0x1f')][_0xcb60('0x1e')]);}})[_0xcb60('0x20')](function(_0x3e09e1){logger[_0xcb60('0x1c')](_0xcb60('0x17'),_0x4a938a,_0x3e09e1);_0x3d3a76(_0x3e09e1);});});}function respondWithStatusCode(_0x5e7550,_0x596074){_0x596074=_0x596074||0xcc;return function(_0x10302d){if(_0x10302d){return _0x5e7550[_0xcb60('0x21')](_0x596074);}return _0x5e7550[_0xcb60('0x22')](_0x596074)[_0xcb60('0x23')]();};}function respondWithResult(_0x213248,_0x178660){_0x178660=_0x178660||0xc8;return function(_0xa5e4b2){if(_0xa5e4b2){return _0x213248[_0xcb60('0x22')](_0x178660)[_0xcb60('0x24')](_0xa5e4b2);}};}function respondWithFilteredResult(_0x579e9c,_0x2456ec){return function(_0x542037){if(_0x542037){var _0x392048=_0x542037['count'],_0x49b3b1=_0x2456ec[_0xcb60('0x25')],_0x858f98=_0x2456ec[_0xcb60('0x25')]+_0x2456ec[_0xcb60('0x26')],_0x2b9306;if(_0x858f98>=_0x392048){_0x858f98=_0x392048;_0x2b9306=0xc8;}else{_0x2b9306=0xce;}_0x579e9c['status'](_0x2b9306);return _0x579e9c[_0xcb60('0x27')](_0xcb60('0x28'),_0x49b3b1+'-'+_0x858f98+'/'+_0x392048)[_0xcb60('0x24')](_0x542037);}return null;};}function patchUpdates(_0x512082){return function(_0x1855fd){try{jsonpatch['apply'](_0x1855fd,_0x512082,!![]);}catch(_0x13896b){return BPromise[_0xcb60('0x29')](_0x13896b);}return _0x1855fd[_0xcb60('0x2a')]();};}function saveUpdates(_0x3eb261,_0x3e7c3e){return function(_0x3908f2){if(_0x3908f2){return _0x3908f2[_0xcb60('0x2b')](_0x3eb261)['then'](function(_0x2aaadc){return _0x2aaadc;});}return null;};}function removeEntity(_0x1ac460,_0x573be1){return function(_0x439fe1){if(_0x439fe1){return _0x439fe1[_0xcb60('0x2c')]()['then'](function(){_0x1ac460[_0xcb60('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26dc13,_0x39151e){return function(_0x404283){if(!_0x404283){_0x26dc13[_0xcb60('0x21')](0x194);}return _0x404283;};}function handleError(_0x2ba920,_0x1cd493){_0x1cd493=_0x1cd493||0x1f4;return function(_0x7412d0){logger[_0xcb60('0x1c')](_0x7412d0[_0xcb60('0x2d')]);if(_0x7412d0[_0xcb60('0x2e')]){delete _0x7412d0['name'];}_0x2ba920[_0xcb60('0x22')](_0x1cd493)['send'](_0x7412d0);};}exports['index']=function(_0x4871f2,_0x460ccd){var _0x28573f={},_0x3f57d4={},_0x3e384e={'count':0x0,'rows':[]};var _0x44695e=_[_0xcb60('0x2f')](db['ServicenowAccount'][_0xcb60('0x30')],function(_0x1e25a4){return{'name':_0x1e25a4[_0xcb60('0x31')],'type':_0x1e25a4[_0xcb60('0x32')][_0xcb60('0x33')]};});_0x3f57d4[_0xcb60('0x34')]=_['map'](_0x44695e,_0xcb60('0x2e'));_0x3f57d4[_0xcb60('0x35')]=_[_0xcb60('0x36')](_0x4871f2['query']);_0x3f57d4[_0xcb60('0x37')]=_['intersection'](_0x3f57d4[_0xcb60('0x34')],_0x3f57d4[_0xcb60('0x35')]);_0x28573f[_0xcb60('0x38')]=_[_0xcb60('0x39')](_0x3f57d4['model'],qs[_0xcb60('0x3a')](_0x4871f2['query']['fields']));_0x28573f[_0xcb60('0x38')]=_0x28573f[_0xcb60('0x38')][_0xcb60('0x3b')]?_0x28573f[_0xcb60('0x38')]:_0x3f57d4[_0xcb60('0x34')];if(!_0x4871f2[_0xcb60('0x35')][_0xcb60('0x3c')](_0xcb60('0x3d'))){_0x28573f['limit']=qs['limit'](_0x4871f2[_0xcb60('0x35')][_0xcb60('0x26')]);_0x28573f[_0xcb60('0x25')]=qs['offset'](_0x4871f2['query'][_0xcb60('0x25')]);}_0x28573f[_0xcb60('0x3e')]=qs[_0xcb60('0x3f')](_0x4871f2['query'][_0xcb60('0x3f')]);_0x28573f[_0xcb60('0x40')]=qs[_0xcb60('0x37')](_['pick'](_0x4871f2[_0xcb60('0x35')],_0x3f57d4['filters']));if(_0x4871f2[_0xcb60('0x35')][_0xcb60('0x41')]){_0x28573f[_0xcb60('0x40')]=_['merge'](_0x28573f[_0xcb60('0x40')],{'$or':_[_0xcb60('0x2f')](_0x44695e,function(_0xa59c3){if(_0xa59c3[_0xcb60('0x32')]!==_0xcb60('0x42')){var _0x4ff820={};_0x4ff820[_0xa59c3[_0xcb60('0x2e')]]={'$like':'%'+_0x4871f2[_0xcb60('0x35')][_0xcb60('0x41')]+'%'};return _0x4ff820;}})});}_0x28573f=_[_0xcb60('0x43')]({},_0x28573f,_0x4871f2[_0xcb60('0x44')]);var _0x3674c5={'where':_0x28573f[_0xcb60('0x40')]};return db['ServicenowAccount'][_0xcb60('0x45')](_0x3674c5)['then'](function(_0x5f0826){_0x3e384e[_0xcb60('0x45')]=_0x5f0826;if(_0x4871f2[_0xcb60('0x35')][_0xcb60('0x46')]){_0x28573f[_0xcb60('0x47')]=[{'all':!![]}];}return db[_0xcb60('0x48')][_0xcb60('0x49')](_0x28573f);})[_0xcb60('0x4a')](function(_0x10c86f){_0x3e384e[_0xcb60('0x4b')]=_0x10c86f;return _0x3e384e;})[_0xcb60('0x4a')](respondWithFilteredResult(_0x460ccd,_0x28573f))[_0xcb60('0x20')](handleError(_0x460ccd,null));};exports[_0xcb60('0x4c')]=function(_0x42c096,_0x2792af){var _0x2c33cb={'raw':![],'where':{'id':_0x42c096['params']['id']}},_0x2a57fe={};_0x2a57fe['model']=_['keys'](db[_0xcb60('0x48')][_0xcb60('0x30')]);_0x2a57fe[_0xcb60('0x35')]=_[_0xcb60('0x36')](_0x42c096[_0xcb60('0x35')]);_0x2a57fe[_0xcb60('0x37')]=_[_0xcb60('0x39')](_0x2a57fe[_0xcb60('0x34')],_0x2a57fe['query']);_0x2c33cb[_0xcb60('0x38')]=_[_0xcb60('0x39')](_0x2a57fe[_0xcb60('0x34')],qs[_0xcb60('0x3a')](_0x42c096[_0xcb60('0x35')][_0xcb60('0x3a')]));_0x2c33cb[_0xcb60('0x38')]=_0x2c33cb[_0xcb60('0x38')][_0xcb60('0x3b')]?_0x2c33cb[_0xcb60('0x38')]:_0x2a57fe[_0xcb60('0x34')];if(_0x42c096[_0xcb60('0x35')][_0xcb60('0x46')]){_0x2c33cb[_0xcb60('0x47')]=[{'all':!![]}];}_0x2c33cb=_[_0xcb60('0x43')]({},_0x2c33cb,_0x42c096[_0xcb60('0x44')]);return db[_0xcb60('0x48')][_0xcb60('0x4d')](_0x2c33cb)[_0xcb60('0x4a')](handleEntityNotFound(_0x2792af,null))['then'](respondWithResult(_0x2792af,null))[_0xcb60('0x20')](handleError(_0x2792af,null));};exports[_0xcb60('0x4e')]=function(_0x2f41bb,_0x5e69e8){return db[_0xcb60('0x48')][_0xcb60('0x4e')](_0x2f41bb[_0xcb60('0x4f')],{})['then'](respondWithResult(_0x5e69e8,0xc9))[_0xcb60('0x20')](handleError(_0x5e69e8,null));};exports[_0xcb60('0x2b')]=function(_0x46ec75,_0x3d4aff){if(_0x46ec75[_0xcb60('0x4f')]['id']){delete _0x46ec75[_0xcb60('0x4f')]['id'];}return db[_0xcb60('0x48')][_0xcb60('0x4d')]({'where':{'id':_0x46ec75[_0xcb60('0x50')]['id']}})['then'](handleEntityNotFound(_0x3d4aff,null))[_0xcb60('0x4a')](saveUpdates(_0x46ec75[_0xcb60('0x4f')],null))[_0xcb60('0x4a')](respondWithResult(_0x3d4aff,null))[_0xcb60('0x20')](handleError(_0x3d4aff,null));};exports[_0xcb60('0x2c')]=function(_0x9df651,_0x276a03){return db[_0xcb60('0x48')][_0xcb60('0x4d')]({'where':{'id':_0x9df651[_0xcb60('0x50')]['id']}})['then'](handleEntityNotFound(_0x276a03,null))[_0xcb60('0x4a')](removeEntity(_0x276a03,null))[_0xcb60('0x20')](handleError(_0x276a03,null));};exports[_0xcb60('0x51')]=function(_0x20a60c,_0x4c2225,_0x141cbc){var _0x4cc1a5={};var _0x480e62={};var _0x28494d;var _0xcca6c8;return db['ServicenowAccount'][_0xcb60('0x52')]({'where':{'id':_0x20a60c[_0xcb60('0x50')]['id']}})[_0xcb60('0x4a')](handleEntityNotFound(_0x4c2225,null))[_0xcb60('0x4a')](function(_0x1704bd){if(_0x1704bd){_0x28494d=_0x1704bd;_0x480e62['model']=_[_0xcb60('0x36')](db[_0xcb60('0x53')][_0xcb60('0x30')]);_0x480e62[_0xcb60('0x35')]=_['keys'](_0x20a60c[_0xcb60('0x35')]);_0x480e62[_0xcb60('0x37')]=_[_0xcb60('0x39')](_0x480e62[_0xcb60('0x34')],_0x480e62[_0xcb60('0x35')]);_0x4cc1a5[_0xcb60('0x38')]=_[_0xcb60('0x39')](_0x480e62[_0xcb60('0x34')],qs['fields'](_0x20a60c[_0xcb60('0x35')][_0xcb60('0x3a')]));_0x4cc1a5[_0xcb60('0x38')]=_0x4cc1a5[_0xcb60('0x38')][_0xcb60('0x3b')]?_0x4cc1a5['attributes']:_0x480e62['model'];_0x4cc1a5[_0xcb60('0x3e')]=qs['sort'](_0x20a60c[_0xcb60('0x35')][_0xcb60('0x3f')]);_0x4cc1a5[_0xcb60('0x40')]=qs['filters'](_['pick'](_0x20a60c[_0xcb60('0x35')],_0x480e62['filters']));if(_0x20a60c[_0xcb60('0x35')][_0xcb60('0x41')]){_0x4cc1a5[_0xcb60('0x40')]=_['merge'](_0x4cc1a5[_0xcb60('0x40')],{'$or':_[_0xcb60('0x2f')](_0x4cc1a5[_0xcb60('0x38')],function(_0x2c07ed){var _0x20a43a={};_0x20a43a[_0x2c07ed]={'$like':'%'+_0x20a60c[_0xcb60('0x35')]['filter']+'%'};return _0x20a43a;})});}_0x4cc1a5=_[_0xcb60('0x43')]({},_0x4cc1a5,_0x20a60c[_0xcb60('0x44')]);return _0x28494d[_0xcb60('0x51')](_0x4cc1a5);}})[_0xcb60('0x4a')](function(_0x44acc2){if(_0x44acc2){_0xcca6c8=_0x44acc2[_0xcb60('0x3b')];if(!_0x20a60c[_0xcb60('0x35')][_0xcb60('0x3c')](_0xcb60('0x3d'))){_0x4cc1a5['limit']=qs[_0xcb60('0x26')](_0x20a60c['query']['limit']);_0x4cc1a5[_0xcb60('0x25')]=qs[_0xcb60('0x25')](_0x20a60c['query'][_0xcb60('0x25')]);}return _0x28494d[_0xcb60('0x51')](_0x4cc1a5);}})[_0xcb60('0x4a')](function(_0x4a202c){if(_0x4a202c){return _0x4a202c?{'count':_0xcca6c8,'rows':_0x4a202c}:null;}})[_0xcb60('0x4a')](respondWithResult(_0x4c2225,null))['catch'](handleError(_0x4c2225,null));};exports[_0xcb60('0x54')]=function(_0x226253,_0x2fe0e1,_0x98250b){if(_0x226253[_0xcb60('0x4f')]['id']){delete _0x226253[_0xcb60('0x4f')]['id'];}return db[_0xcb60('0x48')]['findOne']({'where':{'id':_0x226253[_0xcb60('0x50')]['id']}})[_0xcb60('0x4a')](handleEntityNotFound(_0x2fe0e1,null))[_0xcb60('0x4a')](function(_0x54126c){if(_0x54126c){_0x226253[_0xcb60('0x4f')][_0xcb60('0x55')]=_0x54126c['id'];_0x226253[_0xcb60('0x4f')][_0xcb60('0x56')]=integrations['getSubjects'](_0x226253['body']['channel'],_0x226253[_0xcb60('0x4f')][_0xcb60('0x32')]);_0x226253[_0xcb60('0x4f')][_0xcb60('0x57')]=integrations[_0xcb60('0x58')](_0x226253[_0xcb60('0x4f')][_0xcb60('0x59')],_0x226253[_0xcb60('0x4f')]['type']);return db['ServicenowConfiguration']['create'](_0x226253[_0xcb60('0x4f')],{'include':[{'model':db[_0xcb60('0x5a')],'as':_0xcb60('0x56')},{'model':db[_0xcb60('0x5a')],'as':_0xcb60('0x57')}]});}return null;})[_0xcb60('0x4a')](respondWithResult(_0x2fe0e1,null))[_0xcb60('0x20')](handleError(_0x2fe0e1,null));};exports[_0xcb60('0x5b')]=function(_0x4f2ff1,_0x830b4e,_0x18edd9){var _0x185627=[_0xcb60('0x5c'),_0xcb60('0x5d'),'knowledge',_0xcb60('0x5e'),_0xcb60('0x5f'),'notify',_0xcb60('0x60'),_0xcb60('0x61'),_0xcb60('0x62')];var _0x46086d=['parent',_0xcb60('0x5c'),_0xcb60('0x63'),_0xcb60('0x64'),_0xcb60('0x65'),_0xcb60('0x66'),'child_incidents',_0xcb60('0x5d'),_0xcb60('0x67'),'number','resolved_by',_0xcb60('0x68'),_0xcb60('0x69'),'user_input',_0xcb60('0x6a'),_0xcb60('0x6b'),'state','sys_created_by',_0xcb60('0x6c'),'order',_0xcb60('0x6d'),_0xcb60('0x6e'),_0xcb60('0x6f'),_0xcb60('0x70'),'impact','active','work_notes_list',_0xcb60('0x71'),'priority',_0xcb60('0x72'),_0xcb60('0x73'),_0xcb60('0x74'),_0xcb60('0x75'),'opened_at',_0xcb60('0x76'),'group_list',_0xcb60('0x77'),_0xcb60('0x78'),'resolved_at',_0xcb60('0x79'),_0xcb60('0x7a'),_0xcb60('0x5e'),_0xcb60('0x7b'),_0xcb60('0x7c'),_0xcb60('0x5f'),_0xcb60('0x7d'),_0xcb60('0x7e'),'work_start',_0xcb60('0x7f'),'business_stc',_0xcb60('0x80'),'description',_0xcb60('0x81'),_0xcb60('0x82'),_0xcb60('0x83'),'close_notes','closed_by','follow_up','parent_incident',_0xcb60('0x84'),_0xcb60('0x85'),_0xcb60('0x86'),_0xcb60('0x60'),_0xcb60('0x87'),'problem_id',_0xcb60('0x88'),_0xcb60('0x89'),_0xcb60('0x8a'),_0xcb60('0x8b'),'severity',_0xcb60('0x8c'),_0xcb60('0x8d'),_0xcb60('0x8e'),_0xcb60('0x8f'),_0xcb60('0x90'),_0xcb60('0x91'),_0xcb60('0x92'),'sys_tags',_0xcb60('0x93'),_0xcb60('0x94'),_0xcb60('0x95'),_0xcb60('0x96'),_0xcb60('0x62')];var _0x423edd='';var _0x37606c='';var _0x315910=[];var _0x15dd7d='';var _0xf9ef42='';var _0x5b94ee=[];var _0x11b422='';var _0x42aef8='';var _0x384f3d={};var _0x436f6e='';return db['ServicenowAccount'][_0xcb60('0x52')]({'where':{'id':_0x4f2ff1[_0xcb60('0x50')]['id']},'attributes':['id',_0xcb60('0x97'),_0xcb60('0x98'),_0xcb60('0x99'),_0xcb60('0x9a'),_0xcb60('0x9b')]})[_0xcb60('0x4a')](handleEntityNotFound(_0x830b4e,null))[_0xcb60('0x4a')](function(_0x1db637){if(_0x1db637){_0x436f6e=_0x1db637[_0xcb60('0x9a')];var _0x343f8e=_0x436f6e[_0xcb60('0x9c')](-0x1);if(_0x343f8e==='/'){_0x436f6e=_0x436f6e[_0xcb60('0x9d')](0x0,_0x436f6e['lastIndexOf'](_0x343f8e));}_0x42aef8=util['format'](_0xcb60('0x9e'),_0x436f6e);_0x11b422=util[_0xcb60('0x9f')]('%s/api/now/table/',_0x436f6e);_0x384f3d={'user':_0x1db637['username'],'pass':_0x1db637[_0xcb60('0x98')]};var _0x4164b3={'method':_0xcb60('0xa0'),'uri':_0x42aef8+'incident?sysparm_display_value=all','auth':_0x384f3d,'json':!![]};return rp(_0x4164b3);}})[_0xcb60('0x4a')](function(_0x2fdf6a){if(_0x2fdf6a[_0xcb60('0x1f')]['length']>0x0){_0x423edd=_0x2fdf6a[_0xcb60('0x1f')];}console[_0xcb60('0xa1')]('incident\x20table\x20objects',_0x423edd);_0x5b94ee=[];_0x37606c=Object[_0xcb60('0xa2')]([],_0x423edd);_[_0xcb60('0xa3')](_0x37606c,function(_0x390850){return!_0x185627[_0xcb60('0xa4')](_0x390850['name']);});_0x37606c[_0xcb60('0xa5')](function(_0x2fe059){var _0x3ee2d3=createFieldObject(_0x11b422,_0x384f3d,_0x2fe059['internalType'],_0x2fe059[_0xcb60('0x2e')],_0x2fe059[_0xcb60('0xa6')],![]);_0x5b94ee[_0xcb60('0xa7')](_0x3ee2d3);});return Promise['all'](_0x5b94ee);})['then'](function(_0x41e7e7){_0x315910=_0x41e7e7;_0x15dd7d=Object[_0xcb60('0xa2')]([],_0x423edd);console[_0xcb60('0xa1')](_0xcb60('0xa8'),_0x423edd);_['remove'](_0x15dd7d,function(_0x20c524){return _0x46086d['includes'](_0x20c524[_0xcb60('0x2e')]);});console[_0xcb60('0xa1')](_0xcb60('0xa9'),_0x15dd7d);_0x5b94ee=[];_0x15dd7d['forEach'](function(_0x44a1e4){var _0x30e329=createFieldObject(_0x11b422,_0x384f3d,_0x44a1e4[_0xcb60('0xaa')],_0x44a1e4['name'],_0x44a1e4[_0xcb60('0xa6')],!![]);_0x5b94ee[_0xcb60('0xa7')](_0x30e329);});return Promise[_0xcb60('0xab')](_0x5b94ee);})['then'](function(_0x250bde){_0xf9ef42=_0x250bde;var _0x3a05ed=_0x315910[_0xcb60('0xac')](_0xf9ef42);return{'count':_0x3a05ed[_0xcb60('0x3b')],'rows':_0x3a05ed};})[_0xcb60('0x4a')](respondWithResult(_0x830b4e,null))['catch'](function(_0x290cd0){console['log'](_0xcb60('0xad')+_0x290cd0);var _0x2bf0a5=_0x4f2ff1['query']['test']?0x1f4:_0x290cd0[_0xcb60('0xae')]||0x1f4;logger['error'](_0x290cd0['stack']);delete _0x290cd0[_0xcb60('0x2e')];if(_0x2bf0a5===0x191){_0x2bf0a5=0x190;}_0x830b4e['status'](_0x2bf0a5)[_0xcb60('0xaf')](_0x4f2ff1[_0xcb60('0x35')][_0xcb60('0x13')]?{'message':'Wrong\x20credentials','statusCode':_0x290cd0[_0xcb60('0xae')]}:_0x290cd0);});};function createFieldObject(_0x316d4d,_0x3e89a0,_0x39599a,_0x508039,_0x5a0730,_0x1d2cc4){return new Promise(function(_0x252e19,_0x2e2c5f){var _0xc37eff={'id':_0x508039,'name':_0x5a0730,'custom':_0x1d2cc4};if(_0x39599a===_0xcb60('0xb0')){_0xc37eff['options']=[{'name':_0xcb60('0xb1'),'value':'true'},{'name':'False','value':_0xcb60('0xb2')}];_0x252e19(_0xc37eff);}else{var _0xcae87b={'method':'GET','uri':_0x316d4d+_0xcb60('0xb3')+_0x508039,'auth':_0x3e89a0,'json':!![]};return rp(_0xcae87b)[_0xcb60('0x4a')](function(_0x420cda){var _0x4f1058=[];if(_0x420cda[_0xcb60('0x1f')][_0xcb60('0x3b')]>0x0){_0x420cda[_0xcb60('0x1f')][_0xcb60('0xa5')](function(_0x1921ea){if(_0x1921ea[_0xcb60('0xb4')]==='false'){var _0x4f4920={'name':_0x1921ea[_0xcb60('0xa6')],'value':_0x1921ea[_0xcb60('0xb5')]};_0x4f1058[_0xcb60('0xa7')](_0x4f4920);}});}_0xc37eff[_0xcb60('0x44')]=_0x4f1058;if(_0xc37eff['options'][_0xcb60('0x3b')]>0x0){_0x252e19(_0xc37eff);}else{if(_0x1d2cc4==![]){_0x252e19();}else{_0x252e19(_0xc37eff);}}});}});} \ No newline at end of file +var _0x6d8c=['reopened_by','problem_id','company','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','username','password','email','serverUrl','remoteUri','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','incident\x20table\x20objects','remove','forEach','push','all','includes','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','boolean','true','GET','sys_choice?sysparm_query=name=incident^element=','inactive','false','label','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','rows','show','params','length','create','body','find','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','sys_id'];(function(_0x425c5b,_0x5a23a5){var _0x3ec47a=function(_0x1aaef9){while(--_0x1aaef9){_0x425c5b['push'](_0x425c5b['shift']());}};_0x3ec47a(++_0x5a23a5);}(_0x6d8c,0xee));var _0xc6d8=function(_0x5b34a1,_0x2a24f7){_0x5b34a1=_0x5b34a1-0x0;var _0x332c71=_0x6d8c[_0x5b34a1];return _0x332c71;};'use strict';var pdf=require(_0xc6d8('0x0'));var emlformat=require(_0xc6d8('0x1'));var rimraf=require(_0xc6d8('0x2'));var zipdir=require(_0xc6d8('0x3'));var jsonpatch=require(_0xc6d8('0x4'));var rp=require(_0xc6d8('0x5'));var moment=require('moment');var BPromise=require(_0xc6d8('0x6'));var Mustache=require(_0xc6d8('0x7'));var util=require(_0xc6d8('0x8'));var path=require(_0xc6d8('0x9'));var sox=require(_0xc6d8('0xa'));var csv=require(_0xc6d8('0xb'));var ejs=require(_0xc6d8('0xc'));var fs=require('fs');var _=require(_0xc6d8('0xd'));var squel=require(_0xc6d8('0xe'));var crypto=require(_0xc6d8('0xf'));var jsforce=require(_0xc6d8('0x10'));var deskjs=require(_0xc6d8('0x11'));var toCsv=require(_0xc6d8('0xb'));var querystring=require(_0xc6d8('0x12'));var Papa=require(_0xc6d8('0x13'));var Redis=require(_0xc6d8('0x14'));var authService=require(_0xc6d8('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xc6d8('0x16'));var hardwareService=require(_0xc6d8('0x17'));var logger=require(_0xc6d8('0x18'))(_0xc6d8('0x19'));var utils=require('../../config/utils');var config=require(_0xc6d8('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc6d8('0x1b'));var jayson=require(_0xc6d8('0x1c'));var client=jayson[_0xc6d8('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x2e9f5b,_0x1cd8e3,_0x2c0a31){if(_0x2c0a31){var _0x3b1404=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3b1404[_0xc6d8('0x1e')](_0x1cd8e3)){return _0x2e9f5b;}else{throw new db['Sequelize'][(_0xc6d8('0x1f'))](_0xc6d8('0x20'));}}else{return _0x2e9f5b;}}function respondWithRpcPromise(_0xfa1d62,_0x2a3971,_0x473423,_0x113419){return new BPromise(function(_0x3046da,_0x275dc8){var _0x1af751=_0x113419||client;return _0x1af751[_0xc6d8('0x21')](_0xfa1d62,_0x473423)[_0xc6d8('0x22')](function(_0x38e9fd){logger['info'](_0xc6d8('0x23'),_0x2a3971,_0xc6d8('0x24'));logger[_0xc6d8('0x25')](_0xc6d8('0x26'),_0x2a3971,_0xc6d8('0x24'),JSON[_0xc6d8('0x27')](_0x38e9fd));if(_0x38e9fd['error']){if(_0x38e9fd[_0xc6d8('0x28')][_0xc6d8('0x29')]===0x1f4){logger[_0xc6d8('0x28')](_0xc6d8('0x23'),_0x2a3971,_0x38e9fd['error']['message']);return _0x275dc8(_0x38e9fd[_0xc6d8('0x28')]['message']);}logger['error'](_0xc6d8('0x23'),_0x2a3971,_0x38e9fd[_0xc6d8('0x28')][_0xc6d8('0x2a')]);return _0x3046da(_0x38e9fd[_0xc6d8('0x28')][_0xc6d8('0x2a')]);}else{logger[_0xc6d8('0x2b')](_0xc6d8('0x23'),_0x2a3971,'request\x20sent');_0x3046da(_0x38e9fd[_0xc6d8('0x2c')][_0xc6d8('0x2a')]);}})[_0xc6d8('0x2d')](function(_0x2924c5){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x2a3971,_0x2924c5);_0x275dc8(_0x2924c5);});});}function respondWithStatusCode(_0x1c3758,_0xea1bb1){_0xea1bb1=_0xea1bb1||0xcc;return function(_0x4b4878){if(_0x4b4878){return _0x1c3758[_0xc6d8('0x2e')](_0xea1bb1);}return _0x1c3758['status'](_0xea1bb1)['end']();};}function respondWithResult(_0x3a3dd9,_0x323718){_0x323718=_0x323718||0xc8;return function(_0x46c790){if(_0x46c790){return _0x3a3dd9['status'](_0x323718)[_0xc6d8('0x2f')](_0x46c790);}};}function respondWithFilteredResult(_0x5a81f8,_0x4c6ede){return function(_0xfd9d13){if(_0xfd9d13){var _0xcfbde=_0xfd9d13['count'],_0x4ef3f7=_0x4c6ede[_0xc6d8('0x30')],_0x51cd16=_0x4c6ede[_0xc6d8('0x30')]+_0x4c6ede[_0xc6d8('0x31')],_0x2a9a43;if(_0x51cd16>=_0xcfbde){_0x51cd16=_0xcfbde;_0x2a9a43=0xc8;}else{_0x2a9a43=0xce;}_0x5a81f8[_0xc6d8('0x32')](_0x2a9a43);return _0x5a81f8[_0xc6d8('0x33')](_0xc6d8('0x34'),_0x4ef3f7+'-'+_0x51cd16+'/'+_0xcfbde)[_0xc6d8('0x2f')](_0xfd9d13);}return null;};}function patchUpdates(_0x2f5668){return function(_0x433e54){try{jsonpatch[_0xc6d8('0x35')](_0x433e54,_0x2f5668,!![]);}catch(_0x1aa379){return BPromise[_0xc6d8('0x36')](_0x1aa379);}return _0x433e54[_0xc6d8('0x37')]();};}function saveUpdates(_0xc37ee7,_0x53df8c){return function(_0x2ac821){if(_0x2ac821){return _0x2ac821[_0xc6d8('0x38')](_0xc37ee7)[_0xc6d8('0x22')](function(_0x4b48a8){return _0x4b48a8;});}return null;};}function removeEntity(_0x48240a,_0x46e7da){return function(_0x464253){if(_0x464253){return _0x464253[_0xc6d8('0x39')]()[_0xc6d8('0x22')](function(){_0x48240a[_0xc6d8('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cafbd,_0x366628){return function(_0x37553f){if(!_0x37553f){_0x2cafbd[_0xc6d8('0x2e')](0x194);}return _0x37553f;};}function handleError(_0x40c767,_0x72c46c){_0x72c46c=_0x72c46c||0x1f4;return function(_0x9b03a1){logger[_0xc6d8('0x28')](_0x9b03a1[_0xc6d8('0x3a')]);if(_0x9b03a1['name']){delete _0x9b03a1[_0xc6d8('0x3b')];}_0x40c767[_0xc6d8('0x32')](_0x72c46c)[_0xc6d8('0x3c')](_0x9b03a1);};}exports[_0xc6d8('0x3d')]=function(_0x367d0d,_0x193093){var _0x2690a4={},_0x3591e6={},_0x7e5388={'count':0x0,'rows':[]};var _0x43c9b0=_[_0xc6d8('0x3e')](db[_0xc6d8('0x3f')][_0xc6d8('0x40')],function(_0x74fa82){return{'name':_0x74fa82[_0xc6d8('0x41')],'type':_0x74fa82[_0xc6d8('0x42')][_0xc6d8('0x43')]};});_0x3591e6[_0xc6d8('0x44')]=_[_0xc6d8('0x3e')](_0x43c9b0,'name');_0x3591e6[_0xc6d8('0x45')]=_[_0xc6d8('0x46')](_0x367d0d[_0xc6d8('0x45')]);_0x3591e6['filters']=_[_0xc6d8('0x47')](_0x3591e6[_0xc6d8('0x44')],_0x3591e6[_0xc6d8('0x45')]);_0x2690a4[_0xc6d8('0x48')]=_[_0xc6d8('0x47')](_0x3591e6[_0xc6d8('0x44')],qs[_0xc6d8('0x49')](_0x367d0d['query'][_0xc6d8('0x49')]));_0x2690a4[_0xc6d8('0x48')]=_0x2690a4['attributes']['length']?_0x2690a4['attributes']:_0x3591e6[_0xc6d8('0x44')];if(!_0x367d0d['query'][_0xc6d8('0x4a')](_0xc6d8('0x4b'))){_0x2690a4['limit']=qs[_0xc6d8('0x31')](_0x367d0d[_0xc6d8('0x45')][_0xc6d8('0x31')]);_0x2690a4[_0xc6d8('0x30')]=qs[_0xc6d8('0x30')](_0x367d0d[_0xc6d8('0x45')][_0xc6d8('0x30')]);}_0x2690a4[_0xc6d8('0x4c')]=qs[_0xc6d8('0x4d')](_0x367d0d[_0xc6d8('0x45')][_0xc6d8('0x4d')]);_0x2690a4[_0xc6d8('0x4e')]=qs[_0xc6d8('0x4f')](_[_0xc6d8('0x50')](_0x367d0d[_0xc6d8('0x45')],_0x3591e6[_0xc6d8('0x4f')]));if(_0x367d0d['query']['filter']){_0x2690a4[_0xc6d8('0x4e')]=_[_0xc6d8('0x51')](_0x2690a4['where'],{'$or':_[_0xc6d8('0x3e')](_0x43c9b0,function(_0x63d0e9){if(_0x63d0e9[_0xc6d8('0x42')]!==_0xc6d8('0x52')){var _0x144888={};_0x144888[_0x63d0e9[_0xc6d8('0x3b')]]={'$like':'%'+_0x367d0d[_0xc6d8('0x45')][_0xc6d8('0x53')]+'%'};return _0x144888;}})});}_0x2690a4=_[_0xc6d8('0x51')]({},_0x2690a4,_0x367d0d[_0xc6d8('0x54')]);var _0x1d656a={'where':_0x2690a4[_0xc6d8('0x4e')]};return db[_0xc6d8('0x3f')]['count'](_0x1d656a)['then'](function(_0x42ac9a){_0x7e5388[_0xc6d8('0x55')]=_0x42ac9a;if(_0x367d0d['query'][_0xc6d8('0x56')]){_0x2690a4[_0xc6d8('0x57')]=[{'all':!![]}];}return db[_0xc6d8('0x3f')]['findAll'](_0x2690a4);})[_0xc6d8('0x22')](function(_0x26fda1){_0x7e5388[_0xc6d8('0x58')]=_0x26fda1;return _0x7e5388;})[_0xc6d8('0x22')](respondWithFilteredResult(_0x193093,_0x2690a4))[_0xc6d8('0x2d')](handleError(_0x193093,null));};exports[_0xc6d8('0x59')]=function(_0x1a9ff2,_0x27d4d0){var _0x18963a={'raw':![],'where':{'id':_0x1a9ff2[_0xc6d8('0x5a')]['id']}},_0x3a305a={};_0x3a305a['model']=_[_0xc6d8('0x46')](db[_0xc6d8('0x3f')][_0xc6d8('0x40')]);_0x3a305a[_0xc6d8('0x45')]=_['keys'](_0x1a9ff2[_0xc6d8('0x45')]);_0x3a305a[_0xc6d8('0x4f')]=_['intersection'](_0x3a305a[_0xc6d8('0x44')],_0x3a305a[_0xc6d8('0x45')]);_0x18963a[_0xc6d8('0x48')]=_[_0xc6d8('0x47')](_0x3a305a[_0xc6d8('0x44')],qs['fields'](_0x1a9ff2[_0xc6d8('0x45')][_0xc6d8('0x49')]));_0x18963a[_0xc6d8('0x48')]=_0x18963a[_0xc6d8('0x48')][_0xc6d8('0x5b')]?_0x18963a[_0xc6d8('0x48')]:_0x3a305a[_0xc6d8('0x44')];if(_0x1a9ff2[_0xc6d8('0x45')]['includeAll']){_0x18963a[_0xc6d8('0x57')]=[{'all':!![]}];}_0x18963a=_[_0xc6d8('0x51')]({},_0x18963a,_0x1a9ff2[_0xc6d8('0x54')]);return db['ServicenowAccount']['find'](_0x18963a)[_0xc6d8('0x22')](handleEntityNotFound(_0x27d4d0,null))[_0xc6d8('0x22')](respondWithResult(_0x27d4d0,null))[_0xc6d8('0x2d')](handleError(_0x27d4d0,null));};exports['create']=function(_0x473a25,_0x1f7f19){return db[_0xc6d8('0x3f')][_0xc6d8('0x5c')](_0x473a25[_0xc6d8('0x5d')],{})[_0xc6d8('0x22')](respondWithResult(_0x1f7f19,0xc9))[_0xc6d8('0x2d')](handleError(_0x1f7f19,null));};exports[_0xc6d8('0x38')]=function(_0x8f82ab,_0x538251){if(_0x8f82ab[_0xc6d8('0x5d')]['id']){delete _0x8f82ab[_0xc6d8('0x5d')]['id'];}return db[_0xc6d8('0x3f')][_0xc6d8('0x5e')]({'where':{'id':_0x8f82ab[_0xc6d8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x538251,null))[_0xc6d8('0x22')](saveUpdates(_0x8f82ab[_0xc6d8('0x5d')],null))[_0xc6d8('0x22')](respondWithResult(_0x538251,null))['catch'](handleError(_0x538251,null));};exports['destroy']=function(_0x44108d,_0x3a2949){return db[_0xc6d8('0x3f')]['find']({'where':{'id':_0x44108d[_0xc6d8('0x5a')]['id']}})[_0xc6d8('0x22')](handleEntityNotFound(_0x3a2949,null))['then'](removeEntity(_0x3a2949,null))[_0xc6d8('0x2d')](handleError(_0x3a2949,null));};exports['getConfigurations']=function(_0x18876d,_0x28498c,_0x542620){var _0x435fa3={};var _0x3dde9a={};var _0x5f3eb2;var _0x99a435;return db['ServicenowAccount']['findOne']({'where':{'id':_0x18876d[_0xc6d8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x28498c,null))[_0xc6d8('0x22')](function(_0x43a842){if(_0x43a842){_0x5f3eb2=_0x43a842;_0x3dde9a[_0xc6d8('0x44')]=_['keys'](db['ServicenowConfiguration'][_0xc6d8('0x40')]);_0x3dde9a[_0xc6d8('0x45')]=_[_0xc6d8('0x46')](_0x18876d[_0xc6d8('0x45')]);_0x3dde9a[_0xc6d8('0x4f')]=_['intersection'](_0x3dde9a['model'],_0x3dde9a[_0xc6d8('0x45')]);_0x435fa3[_0xc6d8('0x48')]=_[_0xc6d8('0x47')](_0x3dde9a[_0xc6d8('0x44')],qs[_0xc6d8('0x49')](_0x18876d[_0xc6d8('0x45')][_0xc6d8('0x49')]));_0x435fa3[_0xc6d8('0x48')]=_0x435fa3[_0xc6d8('0x48')][_0xc6d8('0x5b')]?_0x435fa3[_0xc6d8('0x48')]:_0x3dde9a[_0xc6d8('0x44')];_0x435fa3[_0xc6d8('0x4c')]=qs[_0xc6d8('0x4d')](_0x18876d[_0xc6d8('0x45')][_0xc6d8('0x4d')]);_0x435fa3[_0xc6d8('0x4e')]=qs[_0xc6d8('0x4f')](_[_0xc6d8('0x50')](_0x18876d['query'],_0x3dde9a[_0xc6d8('0x4f')]));if(_0x18876d[_0xc6d8('0x45')][_0xc6d8('0x53')]){_0x435fa3[_0xc6d8('0x4e')]=_['merge'](_0x435fa3['where'],{'$or':_[_0xc6d8('0x3e')](_0x435fa3[_0xc6d8('0x48')],function(_0x522cbc){var _0x51c0e5={};_0x51c0e5[_0x522cbc]={'$like':'%'+_0x18876d[_0xc6d8('0x45')]['filter']+'%'};return _0x51c0e5;})});}_0x435fa3=_[_0xc6d8('0x51')]({},_0x435fa3,_0x18876d[_0xc6d8('0x54')]);return _0x5f3eb2['getConfigurations'](_0x435fa3);}})[_0xc6d8('0x22')](function(_0x1f4930){if(_0x1f4930){_0x99a435=_0x1f4930[_0xc6d8('0x5b')];if(!_0x18876d[_0xc6d8('0x45')]['hasOwnProperty'](_0xc6d8('0x4b'))){_0x435fa3[_0xc6d8('0x31')]=qs['limit'](_0x18876d[_0xc6d8('0x45')][_0xc6d8('0x31')]);_0x435fa3[_0xc6d8('0x30')]=qs[_0xc6d8('0x30')](_0x18876d[_0xc6d8('0x45')]['offset']);}return _0x5f3eb2[_0xc6d8('0x5f')](_0x435fa3);}})['then'](function(_0x2fe794){if(_0x2fe794){return _0x2fe794?{'count':_0x99a435,'rows':_0x2fe794}:null;}})[_0xc6d8('0x22')](respondWithResult(_0x28498c,null))[_0xc6d8('0x2d')](handleError(_0x28498c,null));};exports['addConfiguration']=function(_0x1f77a9,_0x2fbee3,_0x343ace){if(_0x1f77a9['body']['id']){delete _0x1f77a9['body']['id'];}return db[_0xc6d8('0x3f')][_0xc6d8('0x60')]({'where':{'id':_0x1f77a9[_0xc6d8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2fbee3,null))[_0xc6d8('0x22')](function(_0x2380fa){if(_0x2380fa){_0x1f77a9[_0xc6d8('0x5d')][_0xc6d8('0x61')]=_0x2380fa['id'];_0x1f77a9['body'][_0xc6d8('0x62')]=integrations[_0xc6d8('0x63')](_0x1f77a9['body'][_0xc6d8('0x64')],_0x1f77a9['body'][_0xc6d8('0x42')]);_0x1f77a9['body'][_0xc6d8('0x65')]=integrations[_0xc6d8('0x66')](_0x1f77a9[_0xc6d8('0x5d')][_0xc6d8('0x64')],_0x1f77a9[_0xc6d8('0x5d')][_0xc6d8('0x42')]);return db[_0xc6d8('0x67')][_0xc6d8('0x5c')](_0x1f77a9[_0xc6d8('0x5d')],{'include':[{'model':db[_0xc6d8('0x68')],'as':_0xc6d8('0x62')},{'model':db[_0xc6d8('0x68')],'as':_0xc6d8('0x65')}]});}return null;})[_0xc6d8('0x22')](respondWithResult(_0x2fbee3,null))[_0xc6d8('0x2d')](handleError(_0x2fbee3,null));};exports['getFields']=function(_0x2260a7,_0x418efb,_0x35db4d){var _0x4bc714=[_0xc6d8('0x69'),_0xc6d8('0x6a'),_0xc6d8('0x6b'),_0xc6d8('0x6c'),_0xc6d8('0x6d'),_0xc6d8('0x6e'),_0xc6d8('0x6f'),_0xc6d8('0x70'),_0xc6d8('0x71')];var _0x5e14da=[_0xc6d8('0x72'),_0xc6d8('0x69'),_0xc6d8('0x73'),_0xc6d8('0x74'),_0xc6d8('0x75'),'sys_updated_on',_0xc6d8('0x76'),_0xc6d8('0x6a'),_0xc6d8('0x77'),'number','resolved_by',_0xc6d8('0x78'),_0xc6d8('0x79'),_0xc6d8('0x7a'),_0xc6d8('0x7b'),_0xc6d8('0x7c'),'state',_0xc6d8('0x7d'),_0xc6d8('0x6b'),_0xc6d8('0x4c'),_0xc6d8('0x7e'),'closed_at',_0xc6d8('0x7f'),_0xc6d8('0x80'),'impact',_0xc6d8('0x81'),_0xc6d8('0x82'),_0xc6d8('0x83'),_0xc6d8('0x84'),'sys_domain_path','rfc',_0xc6d8('0x85'),_0xc6d8('0x86'),_0xc6d8('0x87'),_0xc6d8('0x88'),_0xc6d8('0x89'),'work_end',_0xc6d8('0x8a'),_0xc6d8('0x8b'),_0xc6d8('0x8c'),_0xc6d8('0x8d'),_0xc6d8('0x6c'),_0xc6d8('0x8e'),_0xc6d8('0x8f'),_0xc6d8('0x6d'),_0xc6d8('0x90'),_0xc6d8('0x91'),_0xc6d8('0x92'),_0xc6d8('0x93'),_0xc6d8('0x94'),_0xc6d8('0x95'),_0xc6d8('0x96'),'calendar_duration',_0xc6d8('0x6e'),_0xc6d8('0x97'),_0xc6d8('0x98'),_0xc6d8('0x99'),_0xc6d8('0x9a'),'parent_incident',_0xc6d8('0x9b'),'contact_type',_0xc6d8('0x9c'),'incident_state','urgency',_0xc6d8('0x9d'),_0xc6d8('0x9e'),'reassignment_count','activity_due','assigned_to','severity',_0xc6d8('0x9f'),'sla_due','approval',_0xc6d8('0xa0'),_0xc6d8('0xa1'),_0xc6d8('0xa2'),_0xc6d8('0xa3'),_0xc6d8('0xa4'),_0xc6d8('0xa5'),'upon_approval',_0xc6d8('0xa6'),_0xc6d8('0xa7'),_0xc6d8('0x71')];var _0x5b94ef='';var _0xd04566='';var _0x26efbb=[];var _0xd587fb='';var _0x51e76a='';var _0x1af322=[];var _0x563a2b='';var _0x4f9527='';var _0x94f87e={};var _0x87028b='';return db[_0xc6d8('0x3f')][_0xc6d8('0x60')]({'where':{'id':_0x2260a7[_0xc6d8('0x5a')]['id']},'attributes':['id',_0xc6d8('0xa8'),_0xc6d8('0xa9'),_0xc6d8('0xaa'),'remoteUri',_0xc6d8('0xab')]})[_0xc6d8('0x22')](handleEntityNotFound(_0x418efb,null))[_0xc6d8('0x22')](function(_0x1bbd11){if(_0x1bbd11){_0x87028b=_0x1bbd11[_0xc6d8('0xac')];var _0xd38e05=_0x87028b['slice'](-0x1);if(_0xd38e05==='/'){_0x87028b=_0x87028b['substring'](0x0,_0x87028b[_0xc6d8('0xad')](_0xd38e05));}_0x4f9527=util[_0xc6d8('0xae')](_0xc6d8('0xaf'),_0x87028b);_0x563a2b=util['format'](_0xc6d8('0xb0'),_0x87028b);_0x94f87e={'user':_0x1bbd11['username'],'pass':_0x1bbd11[_0xc6d8('0xa9')]};var _0xa44c57={'method':'GET','uri':_0x4f9527+_0xc6d8('0xb1'),'auth':_0x94f87e,'json':!![]};return rp(_0xa44c57);}})[_0xc6d8('0x22')](function(_0x4dc2d3){if(_0x4dc2d3['result'][_0xc6d8('0x5b')]>0x0){_0x5b94ef=_0x4dc2d3[_0xc6d8('0x2c')];}console['log'](_0xc6d8('0xb2'),_0x5b94ef);_0x1af322=[];_0xd04566=Object['assign']([],_0x5b94ef);_[_0xc6d8('0xb3')](_0xd04566,function(_0x217194){return!_0x4bc714['includes'](_0x217194[_0xc6d8('0x3b')]);});_0xd04566[_0xc6d8('0xb4')](function(_0x27c2d7){var _0x2f222e=createFieldObject(_0x563a2b,_0x94f87e,_0x27c2d7['internalType'],_0x27c2d7[_0xc6d8('0x3b')],_0x27c2d7['label'],![]);_0x1af322[_0xc6d8('0xb5')](_0x2f222e);});return Promise[_0xc6d8('0xb6')](_0x1af322);})[_0xc6d8('0x22')](function(_0xf38000){_0x26efbb=_0xf38000;_0xd587fb=Object['assign']([],_0x5b94ef);console['log']('TCL:\x20_object',_0x5b94ef);_[_0xc6d8('0xb3')](_0xd587fb,function(_0x3ef532){return _0x5e14da[_0xc6d8('0xb7')](_0x3ef532['name']);});console[_0xc6d8('0xb8')](_0xc6d8('0xb9'),_0xd587fb);_0x1af322=[];_0xd587fb[_0xc6d8('0xb4')](function(_0x3d9ee6){var _0xecbd94=createFieldObject(_0x563a2b,_0x94f87e,_0x3d9ee6['internalType'],_0x3d9ee6['name'],_0x3d9ee6['label'],!![]);_0x1af322['push'](_0xecbd94);});return Promise['all'](_0x1af322);})[_0xc6d8('0x22')](function(_0x1d0765){_0x51e76a=_0x1d0765;var _0x5b3093=_0x26efbb[_0xc6d8('0xba')](_0x51e76a);return{'count':_0x5b3093[_0xc6d8('0x5b')],'rows':_0x5b3093};})['then'](respondWithResult(_0x418efb,null))['catch'](function(_0x463366){console[_0xc6d8('0xb8')](_0xc6d8('0xbb')+_0x463366);var _0x20fcd5=_0x2260a7[_0xc6d8('0x45')]['test']?0x1f4:_0x463366[_0xc6d8('0xbc')]||0x1f4;logger['error'](_0x463366['stack']);delete _0x463366[_0xc6d8('0x3b')];if(_0x20fcd5===0x191){_0x20fcd5=0x190;}_0x418efb[_0xc6d8('0x32')](_0x20fcd5)[_0xc6d8('0x3c')](_0x2260a7[_0xc6d8('0x45')][_0xc6d8('0x1e')]?{'message':_0xc6d8('0xbd'),'statusCode':_0x463366[_0xc6d8('0xbc')]}:_0x463366);});};function createFieldObject(_0x49b514,_0x1f8c17,_0x5e8bb5,_0x4d9f15,_0x38f1f1,_0x544f66){return new Promise(function(_0x5bff08,_0x3d2c15){var _0x1bafb9={'id':_0x4d9f15,'name':_0x38f1f1,'custom':_0x544f66};if(_0x5e8bb5===_0xc6d8('0xbe')){_0x1bafb9['options']=[{'name':'True','value':_0xc6d8('0xbf')},{'name':'False','value':'false'}];_0x5bff08(_0x1bafb9);}else{var _0x54a8d2={'method':_0xc6d8('0xc0'),'uri':_0x49b514+_0xc6d8('0xc1')+_0x4d9f15,'auth':_0x1f8c17,'json':!![]};return rp(_0x54a8d2)[_0xc6d8('0x22')](function(_0x17fd47){var _0x5bdeb6=[];if(_0x17fd47[_0xc6d8('0x2c')][_0xc6d8('0x5b')]>0x0){_0x17fd47[_0xc6d8('0x2c')][_0xc6d8('0xb4')](function(_0xa0b14){if(_0xa0b14[_0xc6d8('0xc2')]===_0xc6d8('0xc3')){var _0x1144c5={'name':_0xa0b14[_0xc6d8('0xc4')],'value':_0xa0b14['value']};_0x5bdeb6[_0xc6d8('0xb5')](_0x1144c5);}});}_0x1bafb9[_0xc6d8('0x54')]=_0x5bdeb6;if(_0x1bafb9[_0xc6d8('0x54')][_0xc6d8('0x5b')]>0x0){_0x5bff08(_0x1bafb9);}else{if(_0x544f66==![]){_0x5bff08();}else{_0x5bff08(_0x1bafb9);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index ce0df8d..d0c879e 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 _0xeff8=['rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','api','moment','bluebird','path'];(function(_0x501401,_0x2d8737){var _0xfd0a47=function(_0x57decb){while(--_0x57decb){_0x501401['push'](_0x501401['shift']());}};_0xfd0a47(++_0x2d8737);}(_0xeff8,0x186));var _0x8eff=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xeff8[_0x34843e];return _0x598f7f;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8eff('0x9')]=function(_0xb54063,_0x3409bc){return _0xb54063[_0x8eff('0xa')]('ServicenowAccount',attributes,{'tableName':_0x8eff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x885a=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','int_servicenow_accounts'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x885a,0x180));var _0xa885=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x885a[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var BPromise=require('bluebird');var rp=require(_0xa885('0x4'));var fs=require('fs');var path=require(_0xa885('0x5'));var rimraf=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var attributes=require(_0xa885('0x8'));var integrations=require(_0xa885('0x9'));module['exports']=function(_0x7ac6bd,_0x1200c7){return _0x7ac6bd[_0xa885('0xa')]('ServicenowAccount',attributes,{'tableName':_0xa885('0xb'),'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 9118a2a..55786aa 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 _0xcfc3=['result','catch','GetServicenowAccount','findAll','options','where','limit','map','include','model','attributes','debug','ShowServicenowAccount','ServicenowAccount','find','raw','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x4ee89a,_0x56d642){var _0x42aca9=function(_0xa1f425){while(--_0xa1f425){_0x4ee89a['push'](_0x4ee89a['shift']());}};_0x42aca9(++_0x56d642);}(_0xcfc3,0x1a8));var _0x3cfc=function(_0x9bf10c,_0xcc7e3a){_0x9bf10c=_0x9bf10c-0x0;var _0x53f63d=_0xcfc3[_0x9bf10c];return _0x53f63d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3cfc('0x0'));var BPromise=require(_0x3cfc('0x1'));var rs=require(_0x3cfc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3cfc('0x3'))['db'];var utils=require(_0x3cfc('0x4'));var logger=require(_0x3cfc('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3cfc('0x6')][_0x3cfc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f56b3,_0x487ed2,_0x5e4063){return new BPromise(function(_0x486bd0,_0x5e2d1b){return client[_0x3cfc('0x8')](_0x4f56b3,_0x5e4063)[_0x3cfc('0x9')](function(_0x1c9cbb){logger['info'](_0x3cfc('0xa'),_0x487ed2,_0x3cfc('0xb'));logger['debug'](_0x3cfc('0xc'),_0x487ed2,_0x3cfc('0xb'),JSON[_0x3cfc('0xd')](_0x1c9cbb));if(_0x1c9cbb[_0x3cfc('0xe')]){if(_0x1c9cbb[_0x3cfc('0xe')][_0x3cfc('0xf')]===0x1f4){logger['error'](_0x3cfc('0xa'),_0x487ed2,_0x1c9cbb[_0x3cfc('0xe')]['message']);return _0x5e2d1b(_0x1c9cbb[_0x3cfc('0xe')]['message']);}logger[_0x3cfc('0xe')](_0x3cfc('0xa'),_0x487ed2,_0x1c9cbb['error']['message']);return _0x486bd0(_0x1c9cbb[_0x3cfc('0xe')][_0x3cfc('0x10')]);}else{logger[_0x3cfc('0x11')](_0x3cfc('0xa'),_0x487ed2,_0x3cfc('0xb'));_0x486bd0(_0x1c9cbb[_0x3cfc('0x12')][_0x3cfc('0x10')]);}})[_0x3cfc('0x13')](function(_0x17f673){logger[_0x3cfc('0xe')](_0x3cfc('0xa'),_0x487ed2,_0x17f673);_0x5e2d1b(_0x17f673);});});}exports[_0x3cfc('0x14')]=function(_0x5f4a42){var _0x514c2f=this;return new Promise(function(_0x470c96,_0x1823a8){return db['ServicenowAccount'][_0x3cfc('0x15')]({'raw':_0x5f4a42['options']?_0x5f4a42[_0x3cfc('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5f4a42[_0x3cfc('0x16')]?_0x5f4a42[_0x3cfc('0x16')][_0x3cfc('0x17')]||null:null,'attributes':_0x5f4a42[_0x3cfc('0x16')]?_0x5f4a42[_0x3cfc('0x16')]['attributes']||null:null,'limit':_0x5f4a42[_0x3cfc('0x16')]?_0x5f4a42[_0x3cfc('0x16')][_0x3cfc('0x18')]||null:null,'include':_0x5f4a42[_0x3cfc('0x16')]?_0x5f4a42[_0x3cfc('0x16')]['include']?_[_0x3cfc('0x19')](_0x5f4a42[_0x3cfc('0x16')]['include'],function(_0x2696f1){return{'model':db[_0x2696f1['model']],'as':_0x2696f1['as'],'attributes':_0x2696f1['attributes'],'include':_0x2696f1[_0x3cfc('0x1a')]?_['map'](_0x2696f1[_0x3cfc('0x1a')],function(_0x393790){return{'model':db[_0x393790[_0x3cfc('0x1b')]],'as':_0x393790['as'],'attributes':_0x393790[_0x3cfc('0x1c')],'include':_0x393790['include']?_['map'](_0x393790[_0x3cfc('0x1a')],function(_0x2964a1){return{'model':db[_0x2964a1[_0x3cfc('0x1b')]],'as':_0x2964a1['as'],'attributes':_0x2964a1[_0x3cfc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3cfc('0x9')](function(_0x13e097){logger[_0x3cfc('0x11')](_0x3cfc('0x14'),_0x5f4a42);logger[_0x3cfc('0x1d')](_0x3cfc('0x14'),_0x5f4a42,JSON[_0x3cfc('0xd')](_0x13e097));_0x470c96(_0x13e097);})['catch'](function(_0x161932){logger[_0x3cfc('0xe')](_0x3cfc('0x14'),_0x161932[_0x3cfc('0x10')],_0x5f4a42);_0x1823a8(_0x514c2f[_0x3cfc('0xe')](0x1f4,_0x161932[_0x3cfc('0x10')]));});});};exports[_0x3cfc('0x1e')]=function(_0x128c14){var _0x177e1f=this;return new Promise(function(_0x24b849,_0x49c73d){return db[_0x3cfc('0x1f')][_0x3cfc('0x20')]({'raw':_0x128c14[_0x3cfc('0x16')]?_0x128c14[_0x3cfc('0x16')][_0x3cfc('0x21')]===undefined?!![]:![]:!![],'where':_0x128c14[_0x3cfc('0x16')]?_0x128c14[_0x3cfc('0x16')][_0x3cfc('0x17')]||null:null,'attributes':_0x128c14['options']?_0x128c14[_0x3cfc('0x16')][_0x3cfc('0x1c')]||null:null,'include':_0x128c14[_0x3cfc('0x16')]?_0x128c14[_0x3cfc('0x16')][_0x3cfc('0x1a')]?_[_0x3cfc('0x19')](_0x128c14[_0x3cfc('0x16')][_0x3cfc('0x1a')],function(_0x3e9076){return{'model':db[_0x3e9076['model']],'as':_0x3e9076['as'],'attributes':_0x3e9076[_0x3cfc('0x1c')],'include':_0x3e9076['include']?_[_0x3cfc('0x19')](_0x3e9076[_0x3cfc('0x1a')],function(_0x2aa195){return{'model':db[_0x2aa195[_0x3cfc('0x1b')]],'as':_0x2aa195['as'],'attributes':_0x2aa195[_0x3cfc('0x1c')],'include':_0x2aa195['include']?_[_0x3cfc('0x19')](_0x2aa195[_0x3cfc('0x1a')],function(_0x4021d5){return{'model':db[_0x4021d5[_0x3cfc('0x1b')]],'as':_0x4021d5['as'],'attributes':_0x4021d5[_0x3cfc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3cfc('0x9')](function(_0x5f3a41){logger[_0x3cfc('0x11')](_0x3cfc('0x1e'),_0x128c14);logger[_0x3cfc('0x1d')](_0x3cfc('0x1e'),_0x128c14,JSON[_0x3cfc('0xd')](_0x5f3a41));_0x24b849(_0x5f3a41);})['catch'](function(_0x2db98f){logger['error'](_0x3cfc('0x1e'),_0x2db98f[_0x3cfc('0x10')],_0x128c14);_0x49c73d(_0x177e1f[_0x3cfc('0xe')](0x1f4,_0x2db98f[_0x3cfc('0x10')]));});});}; \ No newline at end of file +var _0xb5e3=['attributes','limit','map','model','include','debug','ShowServicenowAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowAccount,\x20%s,\x20%s','info','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xb5e3,0xe0));var _0x3b5e=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0xb5e3[_0x351509];return _0x4e9861;};'use strict';var _=require('lodash');var util=require(_0x3b5e('0x0'));var moment=require(_0x3b5e('0x1'));var BPromise=require(_0x3b5e('0x2'));var rs=require(_0x3b5e('0x3'));var fs=require('fs');var Redis=require(_0x3b5e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b5e('0x5'));var logger=require(_0x3b5e('0x6'))('rpc');var config=require(_0x3b5e('0x7'));var jayson=require(_0x3b5e('0x8'));var client=jayson[_0x3b5e('0x9')][_0x3b5e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43b528,_0x59daa9,_0x44d834){return new BPromise(function(_0x739568,_0x51ccc9){return client[_0x3b5e('0xb')](_0x43b528,_0x44d834)[_0x3b5e('0xc')](function(_0x3bae82){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x59daa9,_0x3b5e('0xd'));logger['debug'](_0x3b5e('0xe'),_0x59daa9,'request\x20sent',JSON[_0x3b5e('0xf')](_0x3bae82));if(_0x3bae82[_0x3b5e('0x10')]){if(_0x3bae82['error'][_0x3b5e('0x11')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x59daa9,_0x3bae82[_0x3b5e('0x10')][_0x3b5e('0x12')]);return _0x51ccc9(_0x3bae82['error'][_0x3b5e('0x12')]);}logger[_0x3b5e('0x10')](_0x3b5e('0x13'),_0x59daa9,_0x3bae82[_0x3b5e('0x10')][_0x3b5e('0x12')]);return _0x739568(_0x3bae82['error'][_0x3b5e('0x12')]);}else{logger[_0x3b5e('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x59daa9,_0x3b5e('0xd'));_0x739568(_0x3bae82[_0x3b5e('0x15')]['message']);}})[_0x3b5e('0x16')](function(_0x4b7ed5){logger[_0x3b5e('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x59daa9,_0x4b7ed5);_0x51ccc9(_0x4b7ed5);});});}exports[_0x3b5e('0x17')]=function(_0x3698a5){var _0x2115de=this;return new Promise(function(_0x22da35,_0x4a5c83){return db[_0x3b5e('0x18')]['findAll']({'raw':_0x3698a5[_0x3b5e('0x19')]?_0x3698a5[_0x3b5e('0x19')][_0x3b5e('0x1a')]===undefined?!![]:![]:!![],'where':_0x3698a5[_0x3b5e('0x19')]?_0x3698a5[_0x3b5e('0x19')][_0x3b5e('0x1b')]||null:null,'attributes':_0x3698a5['options']?_0x3698a5['options'][_0x3b5e('0x1c')]||null:null,'limit':_0x3698a5[_0x3b5e('0x19')]?_0x3698a5[_0x3b5e('0x19')][_0x3b5e('0x1d')]||null:null,'include':_0x3698a5[_0x3b5e('0x19')]?_0x3698a5['options']['include']?_[_0x3b5e('0x1e')](_0x3698a5[_0x3b5e('0x19')]['include'],function(_0x1095d1){return{'model':db[_0x1095d1[_0x3b5e('0x1f')]],'as':_0x1095d1['as'],'attributes':_0x1095d1[_0x3b5e('0x1c')],'include':_0x1095d1[_0x3b5e('0x20')]?_['map'](_0x1095d1[_0x3b5e('0x20')],function(_0x5d3dd5){return{'model':db[_0x5d3dd5['model']],'as':_0x5d3dd5['as'],'attributes':_0x5d3dd5[_0x3b5e('0x1c')],'include':_0x5d3dd5[_0x3b5e('0x20')]?_[_0x3b5e('0x1e')](_0x5d3dd5[_0x3b5e('0x20')],function(_0x14957d){return{'model':db[_0x14957d[_0x3b5e('0x1f')]],'as':_0x14957d['as'],'attributes':_0x14957d[_0x3b5e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x254982){logger['info']('GetServicenowAccount',_0x3698a5);logger[_0x3b5e('0x21')]('GetServicenowAccount',_0x3698a5,JSON['stringify'](_0x254982));_0x22da35(_0x254982);})[_0x3b5e('0x16')](function(_0x2c5a02){logger[_0x3b5e('0x10')](_0x3b5e('0x17'),_0x2c5a02[_0x3b5e('0x12')],_0x3698a5);_0x4a5c83(_0x2115de[_0x3b5e('0x10')](0x1f4,_0x2c5a02['message']));});});};exports[_0x3b5e('0x22')]=function(_0x37fc82){var _0x177974=this;return new Promise(function(_0x3963e2,_0x3fed41){return db[_0x3b5e('0x18')][_0x3b5e('0x23')]({'raw':_0x37fc82['options']?_0x37fc82[_0x3b5e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x37fc82[_0x3b5e('0x19')]?_0x37fc82[_0x3b5e('0x19')]['where']||null:null,'attributes':_0x37fc82[_0x3b5e('0x19')]?_0x37fc82[_0x3b5e('0x19')][_0x3b5e('0x1c')]||null:null,'include':_0x37fc82[_0x3b5e('0x19')]?_0x37fc82[_0x3b5e('0x19')][_0x3b5e('0x20')]?_['map'](_0x37fc82[_0x3b5e('0x19')][_0x3b5e('0x20')],function(_0xe894d7){return{'model':db[_0xe894d7['model']],'as':_0xe894d7['as'],'attributes':_0xe894d7[_0x3b5e('0x1c')],'include':_0xe894d7['include']?_[_0x3b5e('0x1e')](_0xe894d7['include'],function(_0x340c2a){return{'model':db[_0x340c2a[_0x3b5e('0x1f')]],'as':_0x340c2a['as'],'attributes':_0x340c2a[_0x3b5e('0x1c')],'include':_0x340c2a[_0x3b5e('0x20')]?_[_0x3b5e('0x1e')](_0x340c2a['include'],function(_0x1ac88b){return{'model':db[_0x1ac88b[_0x3b5e('0x1f')]],'as':_0x1ac88b['as'],'attributes':_0x1ac88b[_0x3b5e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1aa0f8){logger[_0x3b5e('0x14')](_0x3b5e('0x22'),_0x37fc82);logger['debug'](_0x3b5e('0x22'),_0x37fc82,JSON[_0x3b5e('0xf')](_0x1aa0f8));_0x3963e2(_0x1aa0f8);})[_0x3b5e('0x16')](function(_0x6d7feb){logger[_0x3b5e('0x10')](_0x3b5e('0x22'),_0x6d7feb[_0x3b5e('0x12')],_0x37fc82);_0x3fed41(_0x177974[_0x3b5e('0x10')](0x1f4,_0x6d7feb[_0x3b5e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 59e1f4d..03bb68a 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 _0xcc23=['getDescriptions','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions'];(function(_0x382168,_0xe03b6a){var _0x3ecf7e=function(_0x17b089){while(--_0x17b089){_0x382168['push'](_0x382168['shift']());}};_0x3ecf7e(++_0xe03b6a);}(_0xcc23,0x160));var _0x3cc2=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0xcc23[_0x2e3dfc];return _0x4b1245;};'use strict';var multer=require(_0x3cc2('0x0'));var util=require(_0x3cc2('0x1'));var path=require(_0x3cc2('0x2'));var timeout=require(_0x3cc2('0x3'));var express=require(_0x3cc2('0x4'));var router=express[_0x3cc2('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3cc2('0x6'));var controller=require(_0x3cc2('0x7'));router[_0x3cc2('0x8')]('/',auth[_0x3cc2('0x9')](),controller[_0x3cc2('0xa')]);router[_0x3cc2('0x8')](_0x3cc2('0xb'),auth['isAuthenticated'](),controller[_0x3cc2('0xc')]);router[_0x3cc2('0x8')](_0x3cc2('0xd'),auth[_0x3cc2('0x9')](),controller['getFields']);router[_0x3cc2('0x8')]('/:id/subjects',auth[_0x3cc2('0x9')](),controller[_0x3cc2('0xe')]);router[_0x3cc2('0x8')](_0x3cc2('0xf'),auth['isAuthenticated'](),controller[_0x3cc2('0x10')]);router['post']('/',auth[_0x3cc2('0x9')](),controller[_0x3cc2('0x11')]);router[_0x3cc2('0x12')](_0x3cc2('0xb'),auth['isAuthenticated'](),controller[_0x3cc2('0x13')]);router[_0x3cc2('0x14')](_0x3cc2('0xb'),auth[_0x3cc2('0x9')](),controller[_0x3cc2('0x15')]);module[_0x3cc2('0x16')]=router; \ No newline at end of file +var _0x2cd0=['isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller'];(function(_0x4b12ae,_0xf2b3b){var _0x16957b=function(_0x51932c){while(--_0x51932c){_0x4b12ae['push'](_0x4b12ae['shift']());}};_0x16957b(++_0xf2b3b);}(_0x2cd0,0x1ec));var _0x02cd=function(_0x4b5afa,_0x37bea1){_0x4b5afa=_0x4b5afa-0x0;var _0x12b4be=_0x2cd0[_0x4b5afa];return _0x12b4be;};'use strict';var multer=require(_0x02cd('0x0'));var util=require(_0x02cd('0x1'));var path=require(_0x02cd('0x2'));var timeout=require('connect-timeout');var express=require(_0x02cd('0x3'));var router=express[_0x02cd('0x4')]();var auth=require(_0x02cd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x02cd('0x6'));var controller=require(_0x02cd('0x7'));router['get']('/',auth[_0x02cd('0x8')](),controller[_0x02cd('0x9')]);router[_0x02cd('0xa')](_0x02cd('0xb'),auth[_0x02cd('0x8')](),controller[_0x02cd('0xc')]);router[_0x02cd('0xa')](_0x02cd('0xd'),auth[_0x02cd('0x8')](),controller[_0x02cd('0xe')]);router[_0x02cd('0xa')](_0x02cd('0xf'),auth[_0x02cd('0x8')](),controller[_0x02cd('0x10')]);router[_0x02cd('0xa')](_0x02cd('0x11'),auth['isAuthenticated'](),controller[_0x02cd('0x12')]);router[_0x02cd('0x13')]('/',auth['isAuthenticated'](),controller[_0x02cd('0x14')]);router[_0x02cd('0x15')](_0x02cd('0xb'),auth[_0x02cd('0x8')](),controller[_0x02cd('0x16')]);router['delete'](_0x02cd('0xb'),auth[_0x02cd('0x8')](),controller[_0x02cd('0x17')]);module[_0x02cd('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 5be6b5f..17ac289 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 _0x7c92=['sequelize','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7c92,0x180));var _0x27c9=function(_0x813aad,_0x3b114f){_0x813aad=_0x813aad-0x0;var _0x174bd8=_0x7c92[_0x813aad];return _0x174bd8;};'use strict';var Sequelize=require(_0x27c9('0x0'));module[_0x27c9('0x1')]={'name':{'type':Sequelize[_0x27c9('0x2')]},'description':{'type':Sequelize[_0x27c9('0x2')]}}; \ No newline at end of file +var _0x6123=['exports','STRING','sequelize'];(function(_0x5b5616,_0x29e59a){var _0x48fd7d=function(_0x302c6e){while(--_0x302c6e){_0x5b5616['push'](_0x5b5616['shift']());}};_0x48fd7d(++_0x29e59a);}(_0x6123,0x14f));var _0x3612=function(_0xe2b329,_0x61e1cd){_0xe2b329=_0xe2b329-0x0;var _0x385513=_0x6123[_0xe2b329];return _0x385513;};'use strict';var Sequelize=require(_0x3612('0x0'));module[_0x3612('0x1')]={'name':{'type':Sequelize[_0x3612('0x2')]},'description':{'type':Sequelize[_0x3612('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 648f9dd..61f3441 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 _0x7274=['where','filters','filter','merge','type','VIRTUAL','options','include','rows','show','params','find','create','body','destroy','getFields','findOne','ServicenowField','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','query','keys','attributes','intersection','model','fields','length','nolimit','limit','order','sort'];(function(_0x238947,_0x4402f5){var _0x1ef0cd=function(_0x4b8fcd){while(--_0x4b8fcd){_0x238947['push'](_0x238947['shift']());}};_0x1ef0cd(++_0x4402f5);}(_0x7274,0xcd));var _0x4727=function(_0xf461ec,_0x4f1210){_0xf461ec=_0xf461ec-0x0;var _0x46608c=_0x7274[_0xf461ec];return _0x46608c;};'use strict';var pdf=require(_0x4727('0x0'));var emlformat=require(_0x4727('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4727('0x2'));var jsonpatch=require(_0x4727('0x3'));var rp=require('request-promise');var moment=require(_0x4727('0x4'));var BPromise=require(_0x4727('0x5'));var Mustache=require(_0x4727('0x6'));var util=require(_0x4727('0x7'));var path=require(_0x4727('0x8'));var sox=require(_0x4727('0x9'));var csv=require('to-csv');var ejs=require(_0x4727('0xa'));var fs=require('fs');var _=require(_0x4727('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4727('0xc'));var deskjs=require(_0x4727('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4727('0xe'));var Papa=require(_0x4727('0xf'));var Redis=require(_0x4727('0x10'));var authService=require(_0x4727('0x11'));var qs=require(_0x4727('0x12'));var as=require(_0x4727('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4727('0x14'))('api');var utils=require(_0x4727('0x15'));var config=require(_0x4727('0x16'));var db=require(_0x4727('0x17'))['db'];var jayson=require(_0x4727('0x18'));var client=jayson['client'][_0x4727('0x19')]({'port':0x232a});function checkPasswordPattern(_0x496f0f,_0x314ec2,_0x4ecdac){if(_0x4ecdac){var _0x1a8520=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a8520[_0x4727('0x1a')](_0x314ec2)){return _0x496f0f;}else{throw new db['Sequelize'][(_0x4727('0x1b'))](_0x4727('0x1c'));}}else{return _0x496f0f;}}function respondWithRpcPromise(_0x1e831e,_0x87f0e,_0x318714,_0x1a3a12){return new BPromise(function(_0x2a16a1,_0x25dcd4){var _0x461c04=_0x1a3a12||client;return _0x461c04[_0x4727('0x1d')](_0x1e831e,_0x318714)[_0x4727('0x1e')](function(_0x4606a5){logger[_0x4727('0x1f')](_0x4727('0x20'),_0x87f0e,_0x4727('0x21'));logger['debug'](_0x4727('0x22'),_0x87f0e,_0x4727('0x21'),JSON[_0x4727('0x23')](_0x4606a5));if(_0x4606a5[_0x4727('0x24')]){if(_0x4606a5['error'][_0x4727('0x25')]===0x1f4){logger[_0x4727('0x24')](_0x4727('0x20'),_0x87f0e,_0x4606a5[_0x4727('0x24')][_0x4727('0x26')]);return _0x25dcd4(_0x4606a5[_0x4727('0x24')][_0x4727('0x26')]);}logger[_0x4727('0x24')](_0x4727('0x20'),_0x87f0e,_0x4606a5[_0x4727('0x24')][_0x4727('0x26')]);return _0x2a16a1(_0x4606a5['error'][_0x4727('0x26')]);}else{logger['info'](_0x4727('0x20'),_0x87f0e,_0x4727('0x21'));_0x2a16a1(_0x4606a5[_0x4727('0x27')][_0x4727('0x26')]);}})[_0x4727('0x28')](function(_0x596c85){logger['error'](_0x4727('0x20'),_0x87f0e,_0x596c85);_0x25dcd4(_0x596c85);});});}function respondWithStatusCode(_0x59f03a,_0x4ba093){_0x4ba093=_0x4ba093||0xcc;return function(_0x2e5c5f){if(_0x2e5c5f){return _0x59f03a[_0x4727('0x29')](_0x4ba093);}return _0x59f03a['status'](_0x4ba093)[_0x4727('0x2a')]();};}function respondWithResult(_0x15a36a,_0x29f8e2){_0x29f8e2=_0x29f8e2||0xc8;return function(_0x20de17){if(_0x20de17){return _0x15a36a[_0x4727('0x2b')](_0x29f8e2)[_0x4727('0x2c')](_0x20de17);}};}function respondWithFilteredResult(_0x44484a,_0x873456){return function(_0x76bb0d){if(_0x76bb0d){var _0x1a63a4=_0x76bb0d[_0x4727('0x2d')],_0x4b84ff=_0x873456[_0x4727('0x2e')],_0x1b492b=_0x873456[_0x4727('0x2e')]+_0x873456['limit'],_0x328f89;if(_0x1b492b>=_0x1a63a4){_0x1b492b=_0x1a63a4;_0x328f89=0xc8;}else{_0x328f89=0xce;}_0x44484a[_0x4727('0x2b')](_0x328f89);return _0x44484a['set'](_0x4727('0x2f'),_0x4b84ff+'-'+_0x1b492b+'/'+_0x1a63a4)[_0x4727('0x2c')](_0x76bb0d);}return null;};}function patchUpdates(_0x4cad8f){return function(_0x5f3320){try{jsonpatch[_0x4727('0x30')](_0x5f3320,_0x4cad8f,!![]);}catch(_0x27eac7){return BPromise[_0x4727('0x31')](_0x27eac7);}return _0x5f3320[_0x4727('0x32')]();};}function saveUpdates(_0xd73db6,_0x3629c4){return function(_0x499da0){if(_0x499da0){return _0x499da0[_0x4727('0x33')](_0xd73db6)['then'](function(_0x3ef99a){return _0x3ef99a;});}return null;};}function removeEntity(_0x35b77b,_0xd11072){return function(_0x4e5ab3){if(_0x4e5ab3){return _0x4e5ab3['destroy']()[_0x4727('0x1e')](function(){_0x35b77b[_0x4727('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54d308,_0x39a5f5){return function(_0x5e46a9){if(!_0x5e46a9){_0x54d308[_0x4727('0x29')](0x194);}return _0x5e46a9;};}function handleError(_0x17b72b,_0x9b1a0f){_0x9b1a0f=_0x9b1a0f||0x1f4;return function(_0x359791){logger[_0x4727('0x24')](_0x359791[_0x4727('0x34')]);if(_0x359791['name']){delete _0x359791[_0x4727('0x35')];}_0x17b72b[_0x4727('0x2b')](_0x9b1a0f)[_0x4727('0x36')](_0x359791);};}exports[_0x4727('0x37')]=function(_0x469ca9,_0x4fb5db){var _0xd5fde5={},_0x2dfd39={},_0x1f298d={'count':0x0,'rows':[]};var _0x52cf07=_[_0x4727('0x38')](db[_0x4727('0x39')][_0x4727('0x3a')],function(_0x20e14e){return{'name':_0x20e14e[_0x4727('0x3b')],'type':_0x20e14e['type']['key']};});_0x2dfd39['model']=_[_0x4727('0x38')](_0x52cf07,_0x4727('0x35'));_0x2dfd39[_0x4727('0x3c')]=_[_0x4727('0x3d')](_0x469ca9['query']);_0x2dfd39['filters']=_['intersection'](_0x2dfd39['model'],_0x2dfd39[_0x4727('0x3c')]);_0xd5fde5[_0x4727('0x3e')]=_[_0x4727('0x3f')](_0x2dfd39[_0x4727('0x40')],qs[_0x4727('0x41')](_0x469ca9[_0x4727('0x3c')][_0x4727('0x41')]));_0xd5fde5[_0x4727('0x3e')]=_0xd5fde5['attributes'][_0x4727('0x42')]?_0xd5fde5[_0x4727('0x3e')]:_0x2dfd39[_0x4727('0x40')];if(!_0x469ca9[_0x4727('0x3c')]['hasOwnProperty'](_0x4727('0x43'))){_0xd5fde5[_0x4727('0x44')]=qs[_0x4727('0x44')](_0x469ca9[_0x4727('0x3c')][_0x4727('0x44')]);_0xd5fde5[_0x4727('0x2e')]=qs['offset'](_0x469ca9[_0x4727('0x3c')]['offset']);}_0xd5fde5[_0x4727('0x45')]=qs[_0x4727('0x46')](_0x469ca9[_0x4727('0x3c')][_0x4727('0x46')]);_0xd5fde5[_0x4727('0x47')]=qs[_0x4727('0x48')](_['pick'](_0x469ca9[_0x4727('0x3c')],_0x2dfd39[_0x4727('0x48')]));if(_0x469ca9[_0x4727('0x3c')][_0x4727('0x49')]){_0xd5fde5[_0x4727('0x47')]=_[_0x4727('0x4a')](_0xd5fde5[_0x4727('0x47')],{'$or':_[_0x4727('0x38')](_0x52cf07,function(_0x5bf447){if(_0x5bf447[_0x4727('0x4b')]!==_0x4727('0x4c')){var _0xea8d84={};_0xea8d84[_0x5bf447[_0x4727('0x35')]]={'$like':'%'+_0x469ca9['query'][_0x4727('0x49')]+'%'};return _0xea8d84;}})});}_0xd5fde5=_[_0x4727('0x4a')]({},_0xd5fde5,_0x469ca9[_0x4727('0x4d')]);var _0x277189={'where':_0xd5fde5[_0x4727('0x47')]};return db[_0x4727('0x39')][_0x4727('0x2d')](_0x277189)['then'](function(_0x10dc1d){_0x1f298d[_0x4727('0x2d')]=_0x10dc1d;if(_0x469ca9[_0x4727('0x3c')]['includeAll']){_0xd5fde5[_0x4727('0x4e')]=[{'all':!![]}];}return db[_0x4727('0x39')]['findAll'](_0xd5fde5);})[_0x4727('0x1e')](function(_0x3499d0){_0x1f298d[_0x4727('0x4f')]=_0x3499d0;return _0x1f298d;})[_0x4727('0x1e')](respondWithFilteredResult(_0x4fb5db,_0xd5fde5))['catch'](handleError(_0x4fb5db,null));};exports[_0x4727('0x50')]=function(_0x7dea1,_0x10ca93){var _0x221cc5={'raw':![],'where':{'id':_0x7dea1[_0x4727('0x51')]['id']}},_0x1f03dd={};_0x1f03dd[_0x4727('0x40')]=_[_0x4727('0x3d')](db['ServicenowConfiguration'][_0x4727('0x3a')]);_0x1f03dd[_0x4727('0x3c')]=_[_0x4727('0x3d')](_0x7dea1[_0x4727('0x3c')]);_0x1f03dd['filters']=_[_0x4727('0x3f')](_0x1f03dd[_0x4727('0x40')],_0x1f03dd[_0x4727('0x3c')]);_0x221cc5['attributes']=_[_0x4727('0x3f')](_0x1f03dd['model'],qs[_0x4727('0x41')](_0x7dea1[_0x4727('0x3c')][_0x4727('0x41')]));_0x221cc5[_0x4727('0x3e')]=_0x221cc5['attributes'][_0x4727('0x42')]?_0x221cc5[_0x4727('0x3e')]:_0x1f03dd[_0x4727('0x40')];if(_0x7dea1['query']['includeAll']){_0x221cc5['include']=[{'all':!![]}];}_0x221cc5=_[_0x4727('0x4a')]({},_0x221cc5,_0x7dea1[_0x4727('0x4d')]);return db[_0x4727('0x39')][_0x4727('0x52')](_0x221cc5)[_0x4727('0x1e')](handleEntityNotFound(_0x10ca93,null))[_0x4727('0x1e')](respondWithResult(_0x10ca93,null))[_0x4727('0x28')](handleError(_0x10ca93,null));};exports[_0x4727('0x53')]=function(_0x1b70cc,_0x1f41e6){return db[_0x4727('0x39')][_0x4727('0x53')](_0x1b70cc[_0x4727('0x54')],{})[_0x4727('0x1e')](respondWithResult(_0x1f41e6,0xc9))[_0x4727('0x28')](handleError(_0x1f41e6,null));};exports[_0x4727('0x33')]=function(_0x5629e8,_0x2cb95c){if(_0x5629e8[_0x4727('0x54')]['id']){delete _0x5629e8[_0x4727('0x54')]['id'];}return db[_0x4727('0x39')][_0x4727('0x52')]({'where':{'id':_0x5629e8[_0x4727('0x51')]['id']}})[_0x4727('0x1e')](handleEntityNotFound(_0x2cb95c,null))[_0x4727('0x1e')](saveUpdates(_0x5629e8['body'],null))[_0x4727('0x1e')](respondWithResult(_0x2cb95c,null))[_0x4727('0x28')](handleError(_0x2cb95c,null));};exports[_0x4727('0x55')]=function(_0x1cd433,_0x37812f){return db['ServicenowConfiguration']['find']({'where':{'id':_0x1cd433[_0x4727('0x51')]['id']}})[_0x4727('0x1e')](handleEntityNotFound(_0x37812f,null))[_0x4727('0x1e')](removeEntity(_0x37812f,null))[_0x4727('0x28')](handleError(_0x37812f,null));};exports[_0x4727('0x56')]=function(_0x18e607,_0x547ca1,_0xc844f){var _0x1927e2={};var _0x1559d0={};var _0x848630;var _0x5c32c9;return db[_0x4727('0x39')][_0x4727('0x57')]({'where':{'id':_0x18e607[_0x4727('0x51')]['id']}})[_0x4727('0x1e')](handleEntityNotFound(_0x547ca1,null))[_0x4727('0x1e')](function(_0x488281){if(_0x488281){_0x848630=_0x488281;_0x1559d0[_0x4727('0x40')]=_['keys'](db[_0x4727('0x58')][_0x4727('0x3a')]);_0x1559d0[_0x4727('0x3c')]=_[_0x4727('0x3d')](_0x18e607[_0x4727('0x3c')]);_0x1559d0[_0x4727('0x48')]=_[_0x4727('0x3f')](_0x1559d0[_0x4727('0x40')],_0x1559d0['query']);_0x1927e2[_0x4727('0x3e')]=_['intersection'](_0x1559d0[_0x4727('0x40')],qs[_0x4727('0x41')](_0x18e607[_0x4727('0x3c')]['fields']));_0x1927e2[_0x4727('0x3e')]=_0x1927e2[_0x4727('0x3e')][_0x4727('0x42')]?_0x1927e2[_0x4727('0x3e')]:_0x1559d0[_0x4727('0x40')];_0x1927e2[_0x4727('0x45')]=qs['sort'](_0x18e607[_0x4727('0x3c')][_0x4727('0x46')]);_0x1927e2[_0x4727('0x47')]=qs['filters'](_['pick'](_0x18e607[_0x4727('0x3c')],_0x1559d0[_0x4727('0x48')]));if(_0x18e607[_0x4727('0x3c')][_0x4727('0x49')]){_0x1927e2[_0x4727('0x47')]=_[_0x4727('0x4a')](_0x1927e2['where'],{'$or':_['map'](_0x1927e2['attributes'],function(_0x156381){var _0x3edd7a={};_0x3edd7a[_0x156381]={'$like':'%'+_0x18e607[_0x4727('0x3c')]['filter']+'%'};return _0x3edd7a;})});}_0x1927e2=_[_0x4727('0x4a')]({},_0x1927e2,_0x18e607[_0x4727('0x4d')]);return _0x848630[_0x4727('0x56')](_0x1927e2);}})[_0x4727('0x1e')](function(_0x31f488){if(_0x31f488){_0x5c32c9=_0x31f488[_0x4727('0x42')];if(!_0x18e607[_0x4727('0x3c')][_0x4727('0x59')](_0x4727('0x43'))){_0x1927e2[_0x4727('0x44')]=qs[_0x4727('0x44')](_0x18e607[_0x4727('0x3c')]['limit']);_0x1927e2['offset']=qs[_0x4727('0x2e')](_0x18e607[_0x4727('0x3c')][_0x4727('0x2e')]);}return _0x848630[_0x4727('0x56')](_0x1927e2);}})['then'](function(_0x247962){if(_0x247962){return _0x247962?{'count':_0x5c32c9,'rows':_0x247962}:null;}})['then'](respondWithResult(_0x547ca1,null))[_0x4727('0x28')](handleError(_0x547ca1,null));};exports[_0x4727('0x5a')]=function(_0x51e556,_0x470919,_0x4f8786){var _0x5aaafe={};var _0x4ee8ae={};var _0x54f1b1;var _0x36a109;return db['ServicenowConfiguration'][_0x4727('0x57')]({'where':{'id':_0x51e556[_0x4727('0x51')]['id']}})[_0x4727('0x1e')](handleEntityNotFound(_0x470919,null))[_0x4727('0x1e')](function(_0x39f36d){if(_0x39f36d){_0x54f1b1=_0x39f36d;_0x4ee8ae['model']=_[_0x4727('0x3d')](db[_0x4727('0x58')][_0x4727('0x3a')]);_0x4ee8ae[_0x4727('0x3c')]=_[_0x4727('0x3d')](_0x51e556[_0x4727('0x3c')]);_0x4ee8ae[_0x4727('0x48')]=_['intersection'](_0x4ee8ae['model'],_0x4ee8ae[_0x4727('0x3c')]);_0x5aaafe[_0x4727('0x3e')]=_[_0x4727('0x3f')](_0x4ee8ae[_0x4727('0x40')],qs['fields'](_0x51e556[_0x4727('0x3c')][_0x4727('0x41')]));_0x5aaafe[_0x4727('0x3e')]=_0x5aaafe[_0x4727('0x3e')]['length']?_0x5aaafe[_0x4727('0x3e')]:_0x4ee8ae[_0x4727('0x40')];_0x5aaafe['order']=qs[_0x4727('0x46')](_0x51e556[_0x4727('0x3c')][_0x4727('0x46')]);_0x5aaafe['where']=qs[_0x4727('0x48')](_['pick'](_0x51e556[_0x4727('0x3c')],_0x4ee8ae[_0x4727('0x48')]));if(_0x51e556[_0x4727('0x3c')][_0x4727('0x49')]){_0x5aaafe[_0x4727('0x47')]=_[_0x4727('0x4a')](_0x5aaafe['where'],{'$or':_[_0x4727('0x38')](_0x5aaafe[_0x4727('0x3e')],function(_0x153b69){var _0x181645={};_0x181645[_0x153b69]={'$like':'%'+_0x51e556[_0x4727('0x3c')][_0x4727('0x49')]+'%'};return _0x181645;})});}_0x5aaafe=_['merge']({},_0x5aaafe,_0x51e556[_0x4727('0x4d')]);return _0x54f1b1[_0x4727('0x5a')](_0x5aaafe);}})['then'](function(_0x5b4218){if(_0x5b4218){_0x36a109=_0x5b4218[_0x4727('0x42')];if(!_0x51e556[_0x4727('0x3c')][_0x4727('0x59')](_0x4727('0x43'))){_0x5aaafe[_0x4727('0x44')]=qs[_0x4727('0x44')](_0x51e556[_0x4727('0x3c')][_0x4727('0x44')]);_0x5aaafe['offset']=qs[_0x4727('0x2e')](_0x51e556['query'][_0x4727('0x2e')]);}return _0x54f1b1[_0x4727('0x5a')](_0x5aaafe);}})[_0x4727('0x1e')](function(_0x41a781){if(_0x41a781){return _0x41a781?{'count':_0x36a109,'rows':_0x41a781}:null;}})['then'](respondWithResult(_0x470919,null))[_0x4727('0x28')](handleError(_0x470919,null));};exports[_0x4727('0x5b')]=function(_0x422459,_0x35e895,_0xdebbce){var _0x44490f={};var _0xea401d={};var _0xc10341;var _0x425e11;return db[_0x4727('0x39')]['findOne']({'where':{'id':_0x422459[_0x4727('0x51')]['id']}})[_0x4727('0x1e')](handleEntityNotFound(_0x35e895,null))[_0x4727('0x1e')](function(_0x2379b2){if(_0x2379b2){_0xc10341=_0x2379b2;_0xea401d[_0x4727('0x40')]=_[_0x4727('0x3d')](db[_0x4727('0x58')][_0x4727('0x3a')]);_0xea401d[_0x4727('0x3c')]=_['keys'](_0x422459['query']);_0xea401d[_0x4727('0x48')]=_['intersection'](_0xea401d['model'],_0xea401d[_0x4727('0x3c')]);_0x44490f[_0x4727('0x3e')]=_[_0x4727('0x3f')](_0xea401d['model'],qs[_0x4727('0x41')](_0x422459[_0x4727('0x3c')][_0x4727('0x41')]));_0x44490f[_0x4727('0x3e')]=_0x44490f[_0x4727('0x3e')][_0x4727('0x42')]?_0x44490f[_0x4727('0x3e')]:_0xea401d[_0x4727('0x40')];_0x44490f['order']=qs[_0x4727('0x46')](_0x422459[_0x4727('0x3c')][_0x4727('0x46')]);_0x44490f[_0x4727('0x47')]=qs[_0x4727('0x48')](_['pick'](_0x422459['query'],_0xea401d[_0x4727('0x48')]));if(_0x422459[_0x4727('0x3c')]['filter']){_0x44490f[_0x4727('0x47')]=_[_0x4727('0x4a')](_0x44490f[_0x4727('0x47')],{'$or':_[_0x4727('0x38')](_0x44490f[_0x4727('0x3e')],function(_0x5d91ea){var _0x1559b2={};_0x1559b2[_0x5d91ea]={'$like':'%'+_0x422459[_0x4727('0x3c')][_0x4727('0x49')]+'%'};return _0x1559b2;})});}_0x44490f=_[_0x4727('0x4a')]({},_0x44490f,_0x422459[_0x4727('0x4d')]);return _0xc10341['getDescriptions'](_0x44490f);}})[_0x4727('0x1e')](function(_0x589597){if(_0x589597){_0x425e11=_0x589597[_0x4727('0x42')];if(!_0x422459['query']['hasOwnProperty']('nolimit')){_0x44490f[_0x4727('0x44')]=qs[_0x4727('0x44')](_0x422459[_0x4727('0x3c')]['limit']);_0x44490f[_0x4727('0x2e')]=qs[_0x4727('0x2e')](_0x422459[_0x4727('0x3c')][_0x4727('0x2e')]);}return _0xc10341[_0x4727('0x5b')](_0x44490f);}})[_0x4727('0x1e')](function(_0x320242){if(_0x320242){return _0x320242?{'count':_0x425e11,'rows':_0x320242}:null;}})[_0x4727('0x1e')](respondWithResult(_0x35e895,null))[_0x4727('0x28')](handleError(_0x35e895,null));}; \ No newline at end of file +var _0x28b1=['find','create','update','body','getFields','findOne','ServicenowField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','error','message','request\x20sent','result','sendStatus','status','end','json','offset','limit','set','apply','reject','save','destroy','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','count','includeAll','findAll','catch','show','params','intersection'];(function(_0x503b00,_0x4e93cf){var _0x5a9fda=function(_0x56fa3b){while(--_0x56fa3b){_0x503b00['push'](_0x503b00['shift']());}};_0x5a9fda(++_0x4e93cf);}(_0x28b1,0x68));var _0x128b=function(_0x3fbeb7,_0x168135){_0x3fbeb7=_0x3fbeb7-0x0;var _0x17584d=_0x28b1[_0x3fbeb7];return _0x17584d;};'use strict';var pdf=require(_0x128b('0x0'));var emlformat=require(_0x128b('0x1'));var rimraf=require(_0x128b('0x2'));var zipdir=require(_0x128b('0x3'));var jsonpatch=require(_0x128b('0x4'));var rp=require(_0x128b('0x5'));var moment=require(_0x128b('0x6'));var BPromise=require(_0x128b('0x7'));var Mustache=require(_0x128b('0x8'));var util=require(_0x128b('0x9'));var path=require('path');var sox=require(_0x128b('0xa'));var csv=require(_0x128b('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x128b('0xc'));var squel=require(_0x128b('0xd'));var crypto=require(_0x128b('0xe'));var jsforce=require(_0x128b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x128b('0xb'));var querystring=require(_0x128b('0x10'));var Papa=require(_0x128b('0x11'));var Redis=require(_0x128b('0x12'));var authService=require(_0x128b('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x128b('0x14'));var logger=require(_0x128b('0x15'))(_0x128b('0x16'));var utils=require(_0x128b('0x17'));var config=require(_0x128b('0x18'));var db=require(_0x128b('0x19'))['db'];var jayson=require(_0x128b('0x1a'));var client=jayson['client'][_0x128b('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x96ed4d,_0x7a10b8,_0xab0a24){if(_0xab0a24){var _0x1efa08=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1efa08[_0x128b('0x1c')](_0x7a10b8)){return _0x96ed4d;}else{throw new db[(_0x128b('0x1d'))][(_0x128b('0x1e'))](_0x128b('0x1f'));}}else{return _0x96ed4d;}}function respondWithRpcPromise(_0x1a6c7,_0x555072,_0x4369e0,_0x559f52){return new BPromise(function(_0x2ac56b,_0x18bd0c){var _0x450e14=_0x559f52||client;return _0x450e14[_0x128b('0x20')](_0x1a6c7,_0x4369e0)[_0x128b('0x21')](function(_0x4d5cb0){logger[_0x128b('0x22')](_0x128b('0x23'),_0x555072,'request\x20sent');logger[_0x128b('0x24')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x555072,'request\x20sent',JSON['stringify'](_0x4d5cb0));if(_0x4d5cb0['error']){if(_0x4d5cb0[_0x128b('0x25')]['code']===0x1f4){logger[_0x128b('0x25')]('ServicenowConfiguration,\x20%s,\x20%s',_0x555072,_0x4d5cb0[_0x128b('0x25')]['message']);return _0x18bd0c(_0x4d5cb0['error'][_0x128b('0x26')]);}logger[_0x128b('0x25')](_0x128b('0x23'),_0x555072,_0x4d5cb0[_0x128b('0x25')]['message']);return _0x2ac56b(_0x4d5cb0[_0x128b('0x25')][_0x128b('0x26')]);}else{logger[_0x128b('0x22')]('ServicenowConfiguration,\x20%s,\x20%s',_0x555072,_0x128b('0x27'));_0x2ac56b(_0x4d5cb0[_0x128b('0x28')]['message']);}})['catch'](function(_0x73b111){logger[_0x128b('0x25')](_0x128b('0x23'),_0x555072,_0x73b111);_0x18bd0c(_0x73b111);});});}function respondWithStatusCode(_0x24b54e,_0xf2e17b){_0xf2e17b=_0xf2e17b||0xcc;return function(_0x3054b8){if(_0x3054b8){return _0x24b54e[_0x128b('0x29')](_0xf2e17b);}return _0x24b54e[_0x128b('0x2a')](_0xf2e17b)[_0x128b('0x2b')]();};}function respondWithResult(_0x4912dd,_0x1cf0c2){_0x1cf0c2=_0x1cf0c2||0xc8;return function(_0x3091bd){if(_0x3091bd){return _0x4912dd[_0x128b('0x2a')](_0x1cf0c2)[_0x128b('0x2c')](_0x3091bd);}};}function respondWithFilteredResult(_0xfd57ef,_0x48b8cd){return function(_0x38bf44){if(_0x38bf44){var _0x1b824e=_0x38bf44['count'],_0x5828a9=_0x48b8cd['offset'],_0x37ee3f=_0x48b8cd[_0x128b('0x2d')]+_0x48b8cd[_0x128b('0x2e')],_0xcff754;if(_0x37ee3f>=_0x1b824e){_0x37ee3f=_0x1b824e;_0xcff754=0xc8;}else{_0xcff754=0xce;}_0xfd57ef[_0x128b('0x2a')](_0xcff754);return _0xfd57ef[_0x128b('0x2f')]('Content-Range',_0x5828a9+'-'+_0x37ee3f+'/'+_0x1b824e)[_0x128b('0x2c')](_0x38bf44);}return null;};}function patchUpdates(_0x515dff){return function(_0xc008d8){try{jsonpatch[_0x128b('0x30')](_0xc008d8,_0x515dff,!![]);}catch(_0x362691){return BPromise[_0x128b('0x31')](_0x362691);}return _0xc008d8[_0x128b('0x32')]();};}function saveUpdates(_0x474329,_0xa311b4){return function(_0x551860){if(_0x551860){return _0x551860['update'](_0x474329)[_0x128b('0x21')](function(_0x5ad8fb){return _0x5ad8fb;});}return null;};}function removeEntity(_0x94c111,_0x1c9097){return function(_0x4eb31b){if(_0x4eb31b){return _0x4eb31b[_0x128b('0x33')]()[_0x128b('0x21')](function(){_0x94c111[_0x128b('0x2a')](0xcc)[_0x128b('0x2b')]();});}};}function handleEntityNotFound(_0x96fe6,_0x56861a){return function(_0x31de86){if(!_0x31de86){_0x96fe6[_0x128b('0x29')](0x194);}return _0x31de86;};}function handleError(_0x1ad9ce,_0x2975c8){_0x2975c8=_0x2975c8||0x1f4;return function(_0x125de0){logger['error'](_0x125de0[_0x128b('0x34')]);if(_0x125de0['name']){delete _0x125de0[_0x128b('0x35')];}_0x1ad9ce[_0x128b('0x2a')](_0x2975c8)[_0x128b('0x36')](_0x125de0);};}exports[_0x128b('0x37')]=function(_0x58e1fe,_0x50590a){var _0x1d2602={},_0x543402={},_0x36f5c3={'count':0x0,'rows':[]};var _0x4a385b=_['map'](db[_0x128b('0x38')][_0x128b('0x39')],function(_0x561c65){return{'name':_0x561c65[_0x128b('0x3a')],'type':_0x561c65[_0x128b('0x3b')][_0x128b('0x3c')]};});_0x543402[_0x128b('0x3d')]=_['map'](_0x4a385b,_0x128b('0x35'));_0x543402[_0x128b('0x3e')]=_[_0x128b('0x3f')](_0x58e1fe[_0x128b('0x3e')]);_0x543402[_0x128b('0x40')]=_['intersection'](_0x543402[_0x128b('0x3d')],_0x543402[_0x128b('0x3e')]);_0x1d2602[_0x128b('0x41')]=_['intersection'](_0x543402[_0x128b('0x3d')],qs['fields'](_0x58e1fe[_0x128b('0x3e')][_0x128b('0x42')]));_0x1d2602[_0x128b('0x41')]=_0x1d2602[_0x128b('0x41')][_0x128b('0x43')]?_0x1d2602[_0x128b('0x41')]:_0x543402['model'];if(!_0x58e1fe['query'][_0x128b('0x44')](_0x128b('0x45'))){_0x1d2602[_0x128b('0x2e')]=qs[_0x128b('0x2e')](_0x58e1fe[_0x128b('0x3e')][_0x128b('0x2e')]);_0x1d2602['offset']=qs[_0x128b('0x2d')](_0x58e1fe[_0x128b('0x3e')][_0x128b('0x2d')]);}_0x1d2602[_0x128b('0x46')]=qs[_0x128b('0x47')](_0x58e1fe[_0x128b('0x3e')][_0x128b('0x47')]);_0x1d2602['where']=qs[_0x128b('0x40')](_[_0x128b('0x48')](_0x58e1fe['query'],_0x543402[_0x128b('0x40')]));if(_0x58e1fe[_0x128b('0x3e')][_0x128b('0x49')]){_0x1d2602[_0x128b('0x4a')]=_[_0x128b('0x4b')](_0x1d2602[_0x128b('0x4a')],{'$or':_[_0x128b('0x4c')](_0x4a385b,function(_0x48cafc){if(_0x48cafc[_0x128b('0x3b')]!==_0x128b('0x4d')){var _0x290f61={};_0x290f61[_0x48cafc[_0x128b('0x35')]]={'$like':'%'+_0x58e1fe[_0x128b('0x3e')][_0x128b('0x49')]+'%'};return _0x290f61;}})});}_0x1d2602=_[_0x128b('0x4b')]({},_0x1d2602,_0x58e1fe[_0x128b('0x4e')]);var _0x242180={'where':_0x1d2602[_0x128b('0x4a')]};return db['ServicenowConfiguration'][_0x128b('0x4f')](_0x242180)[_0x128b('0x21')](function(_0x39bdf7){_0x36f5c3[_0x128b('0x4f')]=_0x39bdf7;if(_0x58e1fe['query'][_0x128b('0x50')]){_0x1d2602['include']=[{'all':!![]}];}return db[_0x128b('0x38')][_0x128b('0x51')](_0x1d2602);})['then'](function(_0x5a741c){_0x36f5c3['rows']=_0x5a741c;return _0x36f5c3;})['then'](respondWithFilteredResult(_0x50590a,_0x1d2602))[_0x128b('0x52')](handleError(_0x50590a,null));};exports[_0x128b('0x53')]=function(_0x392a2a,_0x3ba824){var _0xe5b3a8={'raw':![],'where':{'id':_0x392a2a[_0x128b('0x54')]['id']}},_0x5bcf81={};_0x5bcf81[_0x128b('0x3d')]=_[_0x128b('0x3f')](db[_0x128b('0x38')][_0x128b('0x39')]);_0x5bcf81['query']=_[_0x128b('0x3f')](_0x392a2a[_0x128b('0x3e')]);_0x5bcf81[_0x128b('0x40')]=_[_0x128b('0x55')](_0x5bcf81[_0x128b('0x3d')],_0x5bcf81[_0x128b('0x3e')]);_0xe5b3a8[_0x128b('0x41')]=_[_0x128b('0x55')](_0x5bcf81[_0x128b('0x3d')],qs['fields'](_0x392a2a[_0x128b('0x3e')][_0x128b('0x42')]));_0xe5b3a8[_0x128b('0x41')]=_0xe5b3a8[_0x128b('0x41')]['length']?_0xe5b3a8[_0x128b('0x41')]:_0x5bcf81[_0x128b('0x3d')];if(_0x392a2a['query']['includeAll']){_0xe5b3a8['include']=[{'all':!![]}];}_0xe5b3a8=_[_0x128b('0x4b')]({},_0xe5b3a8,_0x392a2a[_0x128b('0x4e')]);return db[_0x128b('0x38')][_0x128b('0x56')](_0xe5b3a8)['then'](handleEntityNotFound(_0x3ba824,null))[_0x128b('0x21')](respondWithResult(_0x3ba824,null))[_0x128b('0x52')](handleError(_0x3ba824,null));};exports[_0x128b('0x57')]=function(_0xf4d56b,_0x297e3a){return db['ServicenowConfiguration'][_0x128b('0x57')](_0xf4d56b['body'],{})[_0x128b('0x21')](respondWithResult(_0x297e3a,0xc9))['catch'](handleError(_0x297e3a,null));};exports[_0x128b('0x58')]=function(_0x24ff6d,_0x5d38f9){if(_0x24ff6d['body']['id']){delete _0x24ff6d[_0x128b('0x59')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x24ff6d['params']['id']}})[_0x128b('0x21')](handleEntityNotFound(_0x5d38f9,null))[_0x128b('0x21')](saveUpdates(_0x24ff6d[_0x128b('0x59')],null))[_0x128b('0x21')](respondWithResult(_0x5d38f9,null))['catch'](handleError(_0x5d38f9,null));};exports['destroy']=function(_0x5dec21,_0xe88353){return db[_0x128b('0x38')][_0x128b('0x56')]({'where':{'id':_0x5dec21['params']['id']}})[_0x128b('0x21')](handleEntityNotFound(_0xe88353,null))[_0x128b('0x21')](removeEntity(_0xe88353,null))[_0x128b('0x52')](handleError(_0xe88353,null));};exports[_0x128b('0x5a')]=function(_0x32e68f,_0x3758a2,_0x2650aa){var _0x2f2bbd={};var _0x5c0234={};var _0x4aa3a4;var _0x47589a;return db['ServicenowConfiguration'][_0x128b('0x5b')]({'where':{'id':_0x32e68f['params']['id']}})[_0x128b('0x21')](handleEntityNotFound(_0x3758a2,null))[_0x128b('0x21')](function(_0x4e58f8){if(_0x4e58f8){_0x4aa3a4=_0x4e58f8;_0x5c0234['model']=_[_0x128b('0x3f')](db[_0x128b('0x5c')][_0x128b('0x39')]);_0x5c0234[_0x128b('0x3e')]=_[_0x128b('0x3f')](_0x32e68f[_0x128b('0x3e')]);_0x5c0234[_0x128b('0x40')]=_['intersection'](_0x5c0234[_0x128b('0x3d')],_0x5c0234[_0x128b('0x3e')]);_0x2f2bbd['attributes']=_['intersection'](_0x5c0234['model'],qs['fields'](_0x32e68f[_0x128b('0x3e')][_0x128b('0x42')]));_0x2f2bbd[_0x128b('0x41')]=_0x2f2bbd[_0x128b('0x41')]['length']?_0x2f2bbd[_0x128b('0x41')]:_0x5c0234[_0x128b('0x3d')];_0x2f2bbd['order']=qs['sort'](_0x32e68f[_0x128b('0x3e')][_0x128b('0x47')]);_0x2f2bbd[_0x128b('0x4a')]=qs[_0x128b('0x40')](_[_0x128b('0x48')](_0x32e68f[_0x128b('0x3e')],_0x5c0234[_0x128b('0x40')]));if(_0x32e68f[_0x128b('0x3e')][_0x128b('0x49')]){_0x2f2bbd['where']=_[_0x128b('0x4b')](_0x2f2bbd[_0x128b('0x4a')],{'$or':_['map'](_0x2f2bbd[_0x128b('0x41')],function(_0x241e07){var _0x4d0154={};_0x4d0154[_0x241e07]={'$like':'%'+_0x32e68f[_0x128b('0x3e')][_0x128b('0x49')]+'%'};return _0x4d0154;})});}_0x2f2bbd=_[_0x128b('0x4b')]({},_0x2f2bbd,_0x32e68f[_0x128b('0x4e')]);return _0x4aa3a4[_0x128b('0x5a')](_0x2f2bbd);}})[_0x128b('0x21')](function(_0x1eb4c6){if(_0x1eb4c6){_0x47589a=_0x1eb4c6[_0x128b('0x43')];if(!_0x32e68f[_0x128b('0x3e')][_0x128b('0x44')](_0x128b('0x45'))){_0x2f2bbd[_0x128b('0x2e')]=qs[_0x128b('0x2e')](_0x32e68f[_0x128b('0x3e')]['limit']);_0x2f2bbd[_0x128b('0x2d')]=qs[_0x128b('0x2d')](_0x32e68f['query'][_0x128b('0x2d')]);}return _0x4aa3a4['getFields'](_0x2f2bbd);}})[_0x128b('0x21')](function(_0x45486b){if(_0x45486b){return _0x45486b?{'count':_0x47589a,'rows':_0x45486b}:null;}})[_0x128b('0x21')](respondWithResult(_0x3758a2,null))[_0x128b('0x52')](handleError(_0x3758a2,null));};exports['getSubjects']=function(_0x19a136,_0x33a499,_0x3c6eef){var _0x373fe0={};var _0x25d433={};var _0x121dce;var _0x4383e0;return db[_0x128b('0x38')][_0x128b('0x5b')]({'where':{'id':_0x19a136[_0x128b('0x54')]['id']}})[_0x128b('0x21')](handleEntityNotFound(_0x33a499,null))[_0x128b('0x21')](function(_0x474d45){if(_0x474d45){_0x121dce=_0x474d45;_0x25d433[_0x128b('0x3d')]=_[_0x128b('0x3f')](db[_0x128b('0x5c')]['rawAttributes']);_0x25d433[_0x128b('0x3e')]=_[_0x128b('0x3f')](_0x19a136[_0x128b('0x3e')]);_0x25d433[_0x128b('0x40')]=_[_0x128b('0x55')](_0x25d433[_0x128b('0x3d')],_0x25d433['query']);_0x373fe0['attributes']=_[_0x128b('0x55')](_0x25d433[_0x128b('0x3d')],qs[_0x128b('0x42')](_0x19a136[_0x128b('0x3e')][_0x128b('0x42')]));_0x373fe0[_0x128b('0x41')]=_0x373fe0[_0x128b('0x41')][_0x128b('0x43')]?_0x373fe0['attributes']:_0x25d433[_0x128b('0x3d')];_0x373fe0['order']=qs[_0x128b('0x47')](_0x19a136[_0x128b('0x3e')][_0x128b('0x47')]);_0x373fe0[_0x128b('0x4a')]=qs[_0x128b('0x40')](_[_0x128b('0x48')](_0x19a136[_0x128b('0x3e')],_0x25d433['filters']));if(_0x19a136[_0x128b('0x3e')][_0x128b('0x49')]){_0x373fe0[_0x128b('0x4a')]=_[_0x128b('0x4b')](_0x373fe0[_0x128b('0x4a')],{'$or':_[_0x128b('0x4c')](_0x373fe0[_0x128b('0x41')],function(_0x14e4f0){var _0x2bb6e8={};_0x2bb6e8[_0x14e4f0]={'$like':'%'+_0x19a136[_0x128b('0x3e')][_0x128b('0x49')]+'%'};return _0x2bb6e8;})});}_0x373fe0=_[_0x128b('0x4b')]({},_0x373fe0,_0x19a136[_0x128b('0x4e')]);return _0x121dce['getSubjects'](_0x373fe0);}})[_0x128b('0x21')](function(_0x56799a){if(_0x56799a){_0x4383e0=_0x56799a[_0x128b('0x43')];if(!_0x19a136[_0x128b('0x3e')][_0x128b('0x44')]('nolimit')){_0x373fe0['limit']=qs['limit'](_0x19a136[_0x128b('0x3e')][_0x128b('0x2e')]);_0x373fe0[_0x128b('0x2d')]=qs[_0x128b('0x2d')](_0x19a136[_0x128b('0x3e')]['offset']);}return _0x121dce[_0x128b('0x5d')](_0x373fe0);}})[_0x128b('0x21')](function(_0x2c99d9){if(_0x2c99d9){return _0x2c99d9?{'count':_0x4383e0,'rows':_0x2c99d9}:null;}})[_0x128b('0x21')](respondWithResult(_0x33a499,null))[_0x128b('0x52')](handleError(_0x33a499,null));};exports[_0x128b('0x5e')]=function(_0x303b6c,_0x31b4db,_0x1fedec){var _0x127544={};var _0x1d90bc={};var _0x235ecc;var _0x5f2e1f;return db[_0x128b('0x38')][_0x128b('0x5b')]({'where':{'id':_0x303b6c['params']['id']}})['then'](handleEntityNotFound(_0x31b4db,null))[_0x128b('0x21')](function(_0x2a742d){if(_0x2a742d){_0x235ecc=_0x2a742d;_0x1d90bc[_0x128b('0x3d')]=_[_0x128b('0x3f')](db[_0x128b('0x5c')][_0x128b('0x39')]);_0x1d90bc[_0x128b('0x3e')]=_['keys'](_0x303b6c[_0x128b('0x3e')]);_0x1d90bc['filters']=_[_0x128b('0x55')](_0x1d90bc['model'],_0x1d90bc[_0x128b('0x3e')]);_0x127544[_0x128b('0x41')]=_[_0x128b('0x55')](_0x1d90bc['model'],qs['fields'](_0x303b6c['query']['fields']));_0x127544[_0x128b('0x41')]=_0x127544['attributes']['length']?_0x127544[_0x128b('0x41')]:_0x1d90bc[_0x128b('0x3d')];_0x127544[_0x128b('0x46')]=qs[_0x128b('0x47')](_0x303b6c[_0x128b('0x3e')][_0x128b('0x47')]);_0x127544[_0x128b('0x4a')]=qs[_0x128b('0x40')](_[_0x128b('0x48')](_0x303b6c[_0x128b('0x3e')],_0x1d90bc[_0x128b('0x40')]));if(_0x303b6c[_0x128b('0x3e')][_0x128b('0x49')]){_0x127544['where']=_[_0x128b('0x4b')](_0x127544[_0x128b('0x4a')],{'$or':_['map'](_0x127544[_0x128b('0x41')],function(_0x3ee1f9){var _0x1467dc={};_0x1467dc[_0x3ee1f9]={'$like':'%'+_0x303b6c[_0x128b('0x3e')]['filter']+'%'};return _0x1467dc;})});}_0x127544=_[_0x128b('0x4b')]({},_0x127544,_0x303b6c[_0x128b('0x4e')]);return _0x235ecc[_0x128b('0x5e')](_0x127544);}})['then'](function(_0x531899){if(_0x531899){_0x5f2e1f=_0x531899[_0x128b('0x43')];if(!_0x303b6c[_0x128b('0x3e')][_0x128b('0x44')](_0x128b('0x45'))){_0x127544[_0x128b('0x2e')]=qs['limit'](_0x303b6c[_0x128b('0x3e')][_0x128b('0x2e')]);_0x127544['offset']=qs['offset'](_0x303b6c['query'][_0x128b('0x2d')]);}return _0x235ecc[_0x128b('0x5e')](_0x127544);}})[_0x128b('0x21')](function(_0x3dfc24){if(_0x3dfc24){return _0x3dfc24?{'count':_0x5f2e1f,'rows':_0x3dfc24}:null;}})[_0x128b('0x21')](respondWithResult(_0x31b4db,null))[_0x128b('0x52')](handleError(_0x31b4db,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 1265df5..ba18d59 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 _0x4703=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','bluebird','path','./intServicenowConfiguration.attributes'];(function(_0x5ee893,_0x260e68){var _0x79ab0e=function(_0x3581f3){while(--_0x3581f3){_0x5ee893['push'](_0x5ee893['shift']());}};_0x79ab0e(++_0x260e68);}(_0x4703,0xb7));var _0x3470=function(_0x168fad,_0x58d7ff){_0x168fad=_0x168fad-0x0;var _0x2b312f=_0x4703[_0x168fad];return _0x2b312f;};'use strict';var _=require(_0x3470('0x0'));var util=require('util');var logger=require(_0x3470('0x1'))(_0x3470('0x2'));var moment=require('moment');var BPromise=require(_0x3470('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3470('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3470('0x5'));module['exports']=function(_0x4ba093,_0x59372c){return _0x4ba093[_0x3470('0x6')](_0x3470('0x7'),attributes,{'tableName':_0x3470('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35bc=['exports','ServicenowConfiguration','int_servicenow_configurations','lodash','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3ce937,_0x568d7d){var _0x41d2fa=function(_0x19a409){while(--_0x19a409){_0x3ce937['push'](_0x3ce937['shift']());}};_0x41d2fa(++_0x568d7d);}(_0x35bc,0x1c5));var _0xc35b=function(_0x49cb92,_0x3c31a6){_0x49cb92=_0x49cb92-0x0;var _0x16ee5a=_0x35bc[_0x49cb92];return _0x16ee5a;};'use strict';var _=require(_0xc35b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc35b('0x1'));var moment=require(_0xc35b('0x2'));var BPromise=require(_0xc35b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc35b('0x4'));var rimraf=require(_0xc35b('0x5'));var config=require(_0xc35b('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xc35b('0x7')]=function(_0x38ff6c,_0x2826e9){return _0x38ff6c['define'](_0xc35b('0x8'),attributes,{'tableName':_0xc35b('0x9'),'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 46b7f44..34e133f 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 _0xe405=['client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x296b45,_0x1a2f28){var _0x538bb4=function(_0x1471b9){while(--_0x1471b9){_0x296b45['push'](_0x296b45['shift']());}};_0x538bb4(++_0x1a2f28);}(_0xe405,0xfe));var _0x5e40=function(_0x3ee585,_0x2bfe56){_0x3ee585=_0x3ee585-0x0;var _0x81b0e6=_0xe405[_0x3ee585];return _0x81b0e6;};'use strict';var _=require(_0x5e40('0x0'));var util=require('util');var moment=require(_0x5e40('0x1'));var BPromise=require(_0x5e40('0x2'));var rs=require(_0x5e40('0x3'));var fs=require('fs');var Redis=require(_0x5e40('0x4'));var db=require(_0x5e40('0x5'))['db'];var utils=require(_0x5e40('0x6'));var logger=require('../../config/logger')(_0x5e40('0x7'));var config=require(_0x5e40('0x8'));var jayson=require(_0x5e40('0x9'));var client=jayson[_0x5e40('0xa')][_0x5e40('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x236b8a,_0x30338e,_0x1c2dcf){return new BPromise(function(_0x35fb51,_0x41e51b){return client[_0x5e40('0xc')](_0x236b8a,_0x1c2dcf)[_0x5e40('0xd')](function(_0xad0748){logger['info'](_0x5e40('0xe'),_0x30338e,_0x5e40('0xf'));logger['debug'](_0x5e40('0x10'),_0x30338e,'request\x20sent',JSON[_0x5e40('0x11')](_0xad0748));if(_0xad0748['error']){if(_0xad0748[_0x5e40('0x12')][_0x5e40('0x13')]===0x1f4){logger[_0x5e40('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x30338e,_0xad0748[_0x5e40('0x12')][_0x5e40('0x14')]);return _0x41e51b(_0xad0748[_0x5e40('0x12')][_0x5e40('0x14')]);}logger[_0x5e40('0x12')](_0x5e40('0xe'),_0x30338e,_0xad0748[_0x5e40('0x12')]['message']);return _0x35fb51(_0xad0748[_0x5e40('0x12')]['message']);}else{logger[_0x5e40('0x15')]('ServicenowConfiguration,\x20%s,\x20%s',_0x30338e,'request\x20sent');_0x35fb51(_0xad0748[_0x5e40('0x16')][_0x5e40('0x14')]);}})[_0x5e40('0x17')](function(_0x3ede6d){logger[_0x5e40('0x12')](_0x5e40('0xe'),_0x30338e,_0x3ede6d);_0x41e51b(_0x3ede6d);});});} \ No newline at end of file +var _0xd719=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xd719,0x1dc));var _0x9d71=function(_0x1feefe,_0x2018ad){_0x1feefe=_0x1feefe-0x0;var _0x56471a=_0xd719[_0x1feefe];return _0x56471a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9d71('0x0'));var BPromise=require(_0x9d71('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d71('0x2'))['db'];var utils=require(_0x9d71('0x3'));var logger=require('../../config/logger')(_0x9d71('0x4'));var config=require(_0x9d71('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x9d71('0x6')][_0x9d71('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x123769,_0x4844af,_0x1221fa){return new BPromise(function(_0x3838b5,_0x452b62){return client[_0x9d71('0x8')](_0x123769,_0x1221fa)['then'](function(_0x5a41ca){logger[_0x9d71('0x9')](_0x9d71('0xa'),_0x4844af,_0x9d71('0xb'));logger[_0x9d71('0xc')](_0x9d71('0xd'),_0x4844af,'request\x20sent',JSON['stringify'](_0x5a41ca));if(_0x5a41ca['error']){if(_0x5a41ca[_0x9d71('0xe')][_0x9d71('0xf')]===0x1f4){logger[_0x9d71('0xe')](_0x9d71('0xa'),_0x4844af,_0x5a41ca[_0x9d71('0xe')][_0x9d71('0x10')]);return _0x452b62(_0x5a41ca[_0x9d71('0xe')]['message']);}logger[_0x9d71('0xe')](_0x9d71('0xa'),_0x4844af,_0x5a41ca['error']['message']);return _0x3838b5(_0x5a41ca[_0x9d71('0xe')][_0x9d71('0x10')]);}else{logger[_0x9d71('0x9')](_0x9d71('0xa'),_0x4844af,_0x9d71('0xb'));_0x3838b5(_0x5a41ca['result']['message']);}})[_0x9d71('0x11')](function(_0x2bdbc){logger['error'](_0x9d71('0xa'),_0x4844af,_0x2bdbc);_0x452b62(_0x2bdbc);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 80b430b..bd55e1e 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 _0xa7f9=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','path'];(function(_0x5355b3,_0x2f1e18){var _0x1dbf46=function(_0x2139fe){while(--_0x2139fe){_0x5355b3['push'](_0x5355b3['shift']());}};_0x1dbf46(++_0x2f1e18);}(_0xa7f9,0x185));var _0x9a7f=function(_0x1a8207,_0x576621){_0x1a8207=_0x1a8207-0x0;var _0x4bc774=_0xa7f9[_0x1a8207];return _0x4bc774;};'use strict';var multer=require(_0x9a7f('0x0'));var util=require('util');var path=require(_0x9a7f('0x1'));var timeout=require(_0x9a7f('0x2'));var express=require(_0x9a7f('0x3'));var router=express[_0x9a7f('0x4')]();var auth=require(_0x9a7f('0x5'));var interaction=require(_0x9a7f('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0x9a7f('0x7')]('/',auth[_0x9a7f('0x8')](),controller[_0x9a7f('0x9')]);router['get'](_0x9a7f('0xa'),auth['isAuthenticated'](),controller[_0x9a7f('0xb')]);router['post']('/',auth[_0x9a7f('0x8')](),controller[_0x9a7f('0xc')]);router[_0x9a7f('0xd')](_0x9a7f('0xa'),auth[_0x9a7f('0x8')](),controller[_0x9a7f('0xe')]);router['delete'](_0x9a7f('0xa'),auth[_0x9a7f('0x8')](),controller[_0x9a7f('0xf')]);module[_0x9a7f('0x10')]=router; \ No newline at end of file +var _0xbab9=['exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy'];(function(_0x24f292,_0x4b97e9){var _0x5e1e14=function(_0xf1e41f){while(--_0xf1e41f){_0x24f292['push'](_0x24f292['shift']());}};_0x5e1e14(++_0x4b97e9);}(_0xbab9,0x1b6));var _0x9bab=function(_0x5bc1b0,_0x4c2490){_0x5bc1b0=_0x5bc1b0-0x0;var _0x6d92cc=_0xbab9[_0x5bc1b0];return _0x6d92cc;};'use strict';var multer=require('multer');var util=require(_0x9bab('0x0'));var path=require(_0x9bab('0x1'));var timeout=require(_0x9bab('0x2'));var express=require(_0x9bab('0x3'));var router=express['Router']();var auth=require(_0x9bab('0x4'));var interaction=require(_0x9bab('0x5'));var config=require(_0x9bab('0x6'));var controller=require(_0x9bab('0x7'));router[_0x9bab('0x8')]('/',auth[_0x9bab('0x9')](),controller[_0x9bab('0xa')]);router['get'](_0x9bab('0xb'),auth[_0x9bab('0x9')](),controller[_0x9bab('0xc')]);router[_0x9bab('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9bab('0xe')](_0x9bab('0xb'),auth[_0x9bab('0x9')](),controller[_0x9bab('0xf')]);router[_0x9bab('0x10')](_0x9bab('0xb'),auth[_0x9bab('0x9')](),controller[_0x9bab('0x11')]);module[_0x9bab('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index c165c02..958049a 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 _0x6f70=['string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x6d070a,_0x47e825){var _0x2c065d=function(_0xd0565c){while(--_0xd0565c){_0x6d070a['push'](_0x6d070a['shift']());}};_0x2c065d(++_0x47e825);}(_0x6f70,0x1ec));var _0x06f7=function(_0xcd3127,_0x304d36){_0xcd3127=_0xcd3127-0x0;var _0x3497cf=_0x6f70[_0xcd3127];return _0x3497cf;};'use strict';var Sequelize=require(_0x06f7('0x0'));module[_0x06f7('0x1')]={'type':{'type':Sequelize[_0x06f7('0x2')](_0x06f7('0x3'),'variable',_0x06f7('0x4'),_0x06f7('0x5')),'defaultValue':_0x06f7('0x3')},'content':{'type':Sequelize[_0x06f7('0x6')]},'key':{'type':Sequelize[_0x06f7('0x6')]},'keyType':{'type':Sequelize[_0x06f7('0x2')](_0x06f7('0x3'),_0x06f7('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x06f7('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x06f7('0x6')]},'customField':{'type':Sequelize[_0x06f7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x766b=['variable','BOOLEAN','sequelize','exports','customVariable','keyValue','string','STRING','ENUM'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0x766b,0x158));var _0xb766=function(_0x125485,_0x2eaa5b){_0x125485=_0x125485-0x0;var _0x29ba65=_0x766b[_0x125485];return _0x29ba65;};'use strict';var Sequelize=require(_0xb766('0x0'));module[_0xb766('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xb766('0x2'),_0xb766('0x3')),'defaultValue':_0xb766('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb766('0x5')]},'keyType':{'type':Sequelize[_0xb766('0x6')]('string',_0xb766('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xb766('0x5')]},'idField':{'type':Sequelize[_0xb766('0x5')]},'nameField':{'type':Sequelize[_0xb766('0x5')]},'customField':{'type':Sequelize[_0xb766('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb766('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 5474bbe..268878a 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 _0x20fd=['lodash','squel','crypto','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','sendStatus','status','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','ServicenowField','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','nolimit','limit','offset','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x7fbee,_0x31f6d6){var _0x4fe1b5=function(_0xb868f4){while(--_0xb868f4){_0x7fbee['push'](_0x7fbee['shift']());}};_0x4fe1b5(++_0x31f6d6);}(_0x20fd,0x1a0));var _0xd20f=function(_0x1b42b5,_0x44070c){_0x1b42b5=_0x1b42b5-0x0;var _0x291823=_0x20fd[_0x1b42b5];return _0x291823;};'use strict';var pdf=require(_0xd20f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd20f('0x1'));var jsonpatch=require(_0xd20f('0x2'));var rp=require(_0xd20f('0x3'));var moment=require(_0xd20f('0x4'));var BPromise=require(_0xd20f('0x5'));var Mustache=require(_0xd20f('0x6'));var util=require(_0xd20f('0x7'));var path=require(_0xd20f('0x8'));var sox=require(_0xd20f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd20f('0xa'));var squel=require(_0xd20f('0xb'));var crypto=require(_0xd20f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd20f('0xd'));var querystring=require(_0xd20f('0xe'));var Papa=require(_0xd20f('0xf'));var Redis=require(_0xd20f('0x10'));var authService=require(_0xd20f('0x11'));var qs=require(_0xd20f('0x12'));var as=require(_0xd20f('0x13'));var hardwareService=require(_0xd20f('0x14'));var logger=require(_0xd20f('0x15'))(_0xd20f('0x16'));var utils=require(_0xd20f('0x17'));var config=require(_0xd20f('0x18'));var db=require(_0xd20f('0x19'))['db'];function respondWithStatusCode(_0x5d8d99,_0x5521cf){_0x5521cf=_0x5521cf||0xcc;return function(_0x517675){if(_0x517675){return _0x5d8d99[_0xd20f('0x1a')](_0x5521cf);}return _0x5d8d99[_0xd20f('0x1b')](_0x5521cf)['end']();};}function respondWithResult(_0x182049,_0xf40aee){_0xf40aee=_0xf40aee||0xc8;return function(_0x369f27){if(_0x369f27){return _0x182049[_0xd20f('0x1b')](_0xf40aee)['json'](_0x369f27);}};}function respondWithFilteredResult(_0x5f47ed,_0x4fdfdd){return function(_0x5d97f4){if(_0x5d97f4){var _0x157adb=_0x5d97f4[_0xd20f('0x1c')],_0x154d07=_0x4fdfdd['offset'],_0x1cfc6b=_0x4fdfdd['offset']+_0x4fdfdd['limit'],_0x3bfec8;if(_0x1cfc6b>=_0x157adb){_0x1cfc6b=_0x157adb;_0x3bfec8=0xc8;}else{_0x3bfec8=0xce;}_0x5f47ed[_0xd20f('0x1b')](_0x3bfec8);return _0x5f47ed[_0xd20f('0x1d')](_0xd20f('0x1e'),_0x154d07+'-'+_0x1cfc6b+'/'+_0x157adb)['json'](_0x5d97f4);}return null;};}function patchUpdates(_0x1d1b81){return function(_0xa875f0){try{jsonpatch[_0xd20f('0x1f')](_0xa875f0,_0x1d1b81,!![]);}catch(_0x10c267){return BPromise[_0xd20f('0x20')](_0x10c267);}return _0xa875f0['save']();};}function saveUpdates(_0x4703f4,_0x2d9528){return function(_0x1d5113){if(_0x1d5113){return _0x1d5113[_0xd20f('0x21')](_0x4703f4)[_0xd20f('0x22')](function(_0x199b9a){return _0x199b9a;});}return null;};}function removeEntity(_0x4bd748,_0x545519){return function(_0x370eca){if(_0x370eca){return _0x370eca[_0xd20f('0x23')]()['then'](function(){_0x4bd748['status'](0xcc)[_0xd20f('0x24')]();});}};}function handleEntityNotFound(_0x3f89a4,_0x3e75a3){return function(_0x4b3f5e){if(!_0x4b3f5e){_0x3f89a4[_0xd20f('0x1a')](0x194);}return _0x4b3f5e;};}function handleError(_0x243bb9,_0x473868){_0x473868=_0x473868||0x1f4;return function(_0x229d65){logger[_0xd20f('0x25')](_0x229d65[_0xd20f('0x26')]);if(_0x229d65[_0xd20f('0x27')]){delete _0x229d65[_0xd20f('0x27')];}_0x243bb9[_0xd20f('0x1b')](_0x473868)[_0xd20f('0x28')](_0x229d65);};}exports[_0xd20f('0x29')]=function(_0x8e29e,_0x590c1f){var _0x12841d={},_0x482567={},_0x44fe40={'count':0x0,'rows':[]};var _0x33ad8f=_[_0xd20f('0x2a')](db[_0xd20f('0x2b')][_0xd20f('0x2c')],function(_0xaa4d27){return{'name':_0xaa4d27['fieldName'],'type':_0xaa4d27[_0xd20f('0x2d')][_0xd20f('0x2e')]};});_0x482567[_0xd20f('0x2f')]=_['map'](_0x33ad8f,_0xd20f('0x27'));_0x482567['query']=_[_0xd20f('0x30')](_0x8e29e[_0xd20f('0x31')]);_0x482567[_0xd20f('0x32')]=_['intersection'](_0x482567[_0xd20f('0x2f')],_0x482567[_0xd20f('0x31')]);_0x12841d[_0xd20f('0x33')]=_[_0xd20f('0x34')](_0x482567[_0xd20f('0x2f')],qs[_0xd20f('0x35')](_0x8e29e[_0xd20f('0x31')][_0xd20f('0x35')]));_0x12841d[_0xd20f('0x33')]=_0x12841d['attributes']['length']?_0x12841d[_0xd20f('0x33')]:_0x482567[_0xd20f('0x2f')];if(!_0x8e29e[_0xd20f('0x31')]['hasOwnProperty'](_0xd20f('0x36'))){_0x12841d['limit']=qs[_0xd20f('0x37')](_0x8e29e['query'][_0xd20f('0x37')]);_0x12841d[_0xd20f('0x38')]=qs[_0xd20f('0x38')](_0x8e29e[_0xd20f('0x31')][_0xd20f('0x38')]);}_0x12841d['order']=qs['sort'](_0x8e29e['query']['sort']);_0x12841d[_0xd20f('0x39')]=qs['filters'](_[_0xd20f('0x3a')](_0x8e29e[_0xd20f('0x31')],_0x482567[_0xd20f('0x32')]));if(_0x8e29e['query'][_0xd20f('0x3b')]){_0x12841d[_0xd20f('0x39')]=_[_0xd20f('0x3c')](_0x12841d[_0xd20f('0x39')],{'$or':_[_0xd20f('0x2a')](_0x33ad8f,function(_0xbcdb16){if(_0xbcdb16[_0xd20f('0x2d')]!=='VIRTUAL'){var _0x3e142c={};_0x3e142c[_0xbcdb16[_0xd20f('0x27')]]={'$like':'%'+_0x8e29e['query']['filter']+'%'};return _0x3e142c;}})});}_0x12841d=_[_0xd20f('0x3c')]({},_0x12841d,_0x8e29e[_0xd20f('0x3d')]);var _0x34ef66={'where':_0x12841d[_0xd20f('0x39')]};return db[_0xd20f('0x2b')][_0xd20f('0x1c')](_0x34ef66)[_0xd20f('0x22')](function(_0x2f3cae){_0x44fe40['count']=_0x2f3cae;if(_0x8e29e[_0xd20f('0x31')][_0xd20f('0x3e')]){_0x12841d[_0xd20f('0x3f')]=[{'all':!![]}];}return db[_0xd20f('0x2b')][_0xd20f('0x40')](_0x12841d);})[_0xd20f('0x22')](function(_0x6bd33c){_0x44fe40[_0xd20f('0x41')]=_0x6bd33c;return _0x44fe40;})[_0xd20f('0x22')](respondWithFilteredResult(_0x590c1f,_0x12841d))[_0xd20f('0x42')](handleError(_0x590c1f,null));};exports['show']=function(_0x5181a8,_0x45e256){var _0x5b5a69={'raw':!![],'where':{'id':_0x5181a8[_0xd20f('0x43')]['id']}},_0xb87866={};_0xb87866[_0xd20f('0x2f')]=_[_0xd20f('0x30')](db['ServicenowField'][_0xd20f('0x2c')]);_0xb87866[_0xd20f('0x31')]=_[_0xd20f('0x30')](_0x5181a8[_0xd20f('0x31')]);_0xb87866[_0xd20f('0x32')]=_[_0xd20f('0x34')](_0xb87866[_0xd20f('0x2f')],_0xb87866[_0xd20f('0x31')]);_0x5b5a69[_0xd20f('0x33')]=_[_0xd20f('0x34')](_0xb87866[_0xd20f('0x2f')],qs[_0xd20f('0x35')](_0x5181a8[_0xd20f('0x31')][_0xd20f('0x35')]));_0x5b5a69['attributes']=_0x5b5a69[_0xd20f('0x33')]['length']?_0x5b5a69['attributes']:_0xb87866[_0xd20f('0x2f')];if(_0x5181a8[_0xd20f('0x31')]['includeAll']){_0x5b5a69[_0xd20f('0x3f')]=[{'all':!![]}];}_0x5b5a69=_[_0xd20f('0x3c')]({},_0x5b5a69,_0x5181a8['options']);return db[_0xd20f('0x2b')][_0xd20f('0x44')](_0x5b5a69)[_0xd20f('0x22')](handleEntityNotFound(_0x45e256,null))[_0xd20f('0x22')](respondWithResult(_0x45e256,null))[_0xd20f('0x42')](handleError(_0x45e256,null));};exports['create']=function(_0x2dfee3,_0x41b8b5){return db[_0xd20f('0x2b')][_0xd20f('0x45')](_0x2dfee3[_0xd20f('0x46')],{})['then'](respondWithResult(_0x41b8b5,0xc9))[_0xd20f('0x42')](handleError(_0x41b8b5,null));};exports['update']=function(_0x3ec4a0,_0x1ed54d){if(_0x3ec4a0[_0xd20f('0x46')]['id']){delete _0x3ec4a0[_0xd20f('0x46')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0x3ec4a0['params']['id']}})['then'](handleEntityNotFound(_0x1ed54d,null))['then'](saveUpdates(_0x3ec4a0['body'],null))[_0xd20f('0x22')](respondWithResult(_0x1ed54d,null))[_0xd20f('0x42')](handleError(_0x1ed54d,null));};exports[_0xd20f('0x23')]=function(_0x503667,_0x3c777d){return db['ServicenowField']['find']({'where':{'id':_0x503667[_0xd20f('0x43')]['id']}})[_0xd20f('0x22')](handleEntityNotFound(_0x3c777d,null))[_0xd20f('0x22')](removeEntity(_0x3c777d,null))[_0xd20f('0x42')](handleError(_0x3c777d,null));}; \ No newline at end of file +var _0xe633=['request-promise','bluebird','util','path','sox','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','rawAttributes','fieldName','type','key','name','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','ServicenowField','findAll','rows','catch','keys','create','body','params','eml-format','rimraf','fast-json-patch'];(function(_0x2850c0,_0x1363a7){var _0x21e830=function(_0x3ec70a){while(--_0x3ec70a){_0x2850c0['push'](_0x2850c0['shift']());}};_0x21e830(++_0x1363a7);}(_0xe633,0x1a1));var _0x3e63=function(_0x2443ff,_0x5c016c){_0x2443ff=_0x2443ff-0x0;var _0x33bbca=_0xe633[_0x2443ff];return _0x33bbca;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3e63('0x0'));var rimraf=require(_0x3e63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e63('0x2'));var rp=require(_0x3e63('0x3'));var moment=require('moment');var BPromise=require(_0x3e63('0x4'));var Mustache=require('mustache');var util=require(_0x3e63('0x5'));var path=require(_0x3e63('0x6'));var sox=require(_0x3e63('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3e63('0x8'));var deskjs=require(_0x3e63('0x9'));var toCsv=require(_0x3e63('0xa'));var querystring=require('querystring');var Papa=require(_0x3e63('0xb'));var Redis=require(_0x3e63('0xc'));var authService=require(_0x3e63('0xd'));var qs=require(_0x3e63('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e63('0xf'));var logger=require(_0x3e63('0x10'))(_0x3e63('0x11'));var utils=require(_0x3e63('0x12'));var config=require(_0x3e63('0x13'));var db=require(_0x3e63('0x14'))['db'];function respondWithStatusCode(_0x38dc19,_0x115b1a){_0x115b1a=_0x115b1a||0xcc;return function(_0x2c2347){if(_0x2c2347){return _0x38dc19[_0x3e63('0x15')](_0x115b1a);}return _0x38dc19[_0x3e63('0x16')](_0x115b1a)[_0x3e63('0x17')]();};}function respondWithResult(_0x33a3fb,_0x5b5877){_0x5b5877=_0x5b5877||0xc8;return function(_0x1f3d48){if(_0x1f3d48){return _0x33a3fb[_0x3e63('0x16')](_0x5b5877)['json'](_0x1f3d48);}};}function respondWithFilteredResult(_0x565f31,_0x5e4a0b){return function(_0x425594){if(_0x425594){var _0x108ac8=_0x425594[_0x3e63('0x18')],_0x9dee60=_0x5e4a0b[_0x3e63('0x19')],_0x18e34b=_0x5e4a0b['offset']+_0x5e4a0b[_0x3e63('0x1a')],_0x48a297;if(_0x18e34b>=_0x108ac8){_0x18e34b=_0x108ac8;_0x48a297=0xc8;}else{_0x48a297=0xce;}_0x565f31[_0x3e63('0x16')](_0x48a297);return _0x565f31[_0x3e63('0x1b')](_0x3e63('0x1c'),_0x9dee60+'-'+_0x18e34b+'/'+_0x108ac8)['json'](_0x425594);}return null;};}function patchUpdates(_0x3700e7){return function(_0x58f7fd){try{jsonpatch[_0x3e63('0x1d')](_0x58f7fd,_0x3700e7,!![]);}catch(_0x262e3a){return BPromise[_0x3e63('0x1e')](_0x262e3a);}return _0x58f7fd[_0x3e63('0x1f')]();};}function saveUpdates(_0x5dd94a,_0x5f3ed3){return function(_0xcac0bb){if(_0xcac0bb){return _0xcac0bb[_0x3e63('0x20')](_0x5dd94a)[_0x3e63('0x21')](function(_0x41dba5){return _0x41dba5;});}return null;};}function removeEntity(_0x5d19d2,_0x3ed860){return function(_0xc0ad26){if(_0xc0ad26){return _0xc0ad26[_0x3e63('0x22')]()[_0x3e63('0x21')](function(){_0x5d19d2[_0x3e63('0x16')](0xcc)[_0x3e63('0x17')]();});}};}function handleEntityNotFound(_0x1fe3aa,_0x2b09bc){return function(_0x504259){if(!_0x504259){_0x1fe3aa[_0x3e63('0x15')](0x194);}return _0x504259;};}function handleError(_0x5233a2,_0x5f322f){_0x5f322f=_0x5f322f||0x1f4;return function(_0x4c9a02){logger[_0x3e63('0x23')](_0x4c9a02[_0x3e63('0x24')]);if(_0x4c9a02['name']){delete _0x4c9a02['name'];}_0x5233a2[_0x3e63('0x16')](_0x5f322f)[_0x3e63('0x25')](_0x4c9a02);};}exports['index']=function(_0x42fe6e,_0x18c2e4){var _0x5d0288={},_0x35f7e7={},_0x268f00={'count':0x0,'rows':[]};var _0x18ccda=_[_0x3e63('0x26')](db['ServicenowField'][_0x3e63('0x27')],function(_0x2a66c6){return{'name':_0x2a66c6[_0x3e63('0x28')],'type':_0x2a66c6[_0x3e63('0x29')][_0x3e63('0x2a')]};});_0x35f7e7['model']=_['map'](_0x18ccda,_0x3e63('0x2b'));_0x35f7e7[_0x3e63('0x2c')]=_['keys'](_0x42fe6e[_0x3e63('0x2c')]);_0x35f7e7['filters']=_['intersection'](_0x35f7e7[_0x3e63('0x2d')],_0x35f7e7['query']);_0x5d0288[_0x3e63('0x2e')]=_[_0x3e63('0x2f')](_0x35f7e7['model'],qs[_0x3e63('0x30')](_0x42fe6e[_0x3e63('0x2c')]['fields']));_0x5d0288[_0x3e63('0x2e')]=_0x5d0288[_0x3e63('0x2e')][_0x3e63('0x31')]?_0x5d0288['attributes']:_0x35f7e7[_0x3e63('0x2d')];if(!_0x42fe6e[_0x3e63('0x2c')][_0x3e63('0x32')](_0x3e63('0x33'))){_0x5d0288[_0x3e63('0x1a')]=qs[_0x3e63('0x1a')](_0x42fe6e[_0x3e63('0x2c')]['limit']);_0x5d0288[_0x3e63('0x19')]=qs[_0x3e63('0x19')](_0x42fe6e[_0x3e63('0x2c')]['offset']);}_0x5d0288['order']=qs[_0x3e63('0x34')](_0x42fe6e[_0x3e63('0x2c')][_0x3e63('0x34')]);_0x5d0288[_0x3e63('0x35')]=qs[_0x3e63('0x36')](_[_0x3e63('0x37')](_0x42fe6e[_0x3e63('0x2c')],_0x35f7e7[_0x3e63('0x36')]));if(_0x42fe6e['query']['filter']){_0x5d0288[_0x3e63('0x35')]=_[_0x3e63('0x38')](_0x5d0288[_0x3e63('0x35')],{'$or':_['map'](_0x18ccda,function(_0x51ad68){if(_0x51ad68[_0x3e63('0x29')]!==_0x3e63('0x39')){var _0x5ef1de={};_0x5ef1de[_0x51ad68[_0x3e63('0x2b')]]={'$like':'%'+_0x42fe6e['query'][_0x3e63('0x3a')]+'%'};return _0x5ef1de;}})});}_0x5d0288=_[_0x3e63('0x38')]({},_0x5d0288,_0x42fe6e[_0x3e63('0x3b')]);var _0x411911={'where':_0x5d0288['where']};return db['ServicenowField'][_0x3e63('0x18')](_0x411911)[_0x3e63('0x21')](function(_0x2dd9ca){_0x268f00['count']=_0x2dd9ca;if(_0x42fe6e[_0x3e63('0x2c')][_0x3e63('0x3c')]){_0x5d0288[_0x3e63('0x3d')]=[{'all':!![]}];}return db[_0x3e63('0x3e')][_0x3e63('0x3f')](_0x5d0288);})[_0x3e63('0x21')](function(_0x54cfb8){_0x268f00[_0x3e63('0x40')]=_0x54cfb8;return _0x268f00;})[_0x3e63('0x21')](respondWithFilteredResult(_0x18c2e4,_0x5d0288))[_0x3e63('0x41')](handleError(_0x18c2e4,null));};exports['show']=function(_0x37ccf2,_0x21de8b){var _0x51936f={'raw':!![],'where':{'id':_0x37ccf2['params']['id']}},_0x4af99d={};_0x4af99d[_0x3e63('0x2d')]=_['keys'](db[_0x3e63('0x3e')][_0x3e63('0x27')]);_0x4af99d[_0x3e63('0x2c')]=_[_0x3e63('0x42')](_0x37ccf2[_0x3e63('0x2c')]);_0x4af99d['filters']=_[_0x3e63('0x2f')](_0x4af99d[_0x3e63('0x2d')],_0x4af99d[_0x3e63('0x2c')]);_0x51936f[_0x3e63('0x2e')]=_[_0x3e63('0x2f')](_0x4af99d[_0x3e63('0x2d')],qs[_0x3e63('0x30')](_0x37ccf2[_0x3e63('0x2c')][_0x3e63('0x30')]));_0x51936f[_0x3e63('0x2e')]=_0x51936f['attributes'][_0x3e63('0x31')]?_0x51936f['attributes']:_0x4af99d[_0x3e63('0x2d')];if(_0x37ccf2[_0x3e63('0x2c')][_0x3e63('0x3c')]){_0x51936f['include']=[{'all':!![]}];}_0x51936f=_['merge']({},_0x51936f,_0x37ccf2[_0x3e63('0x3b')]);return db[_0x3e63('0x3e')]['find'](_0x51936f)[_0x3e63('0x21')](handleEntityNotFound(_0x21de8b,null))[_0x3e63('0x21')](respondWithResult(_0x21de8b,null))[_0x3e63('0x41')](handleError(_0x21de8b,null));};exports[_0x3e63('0x43')]=function(_0x2af871,_0x4e1dd4){return db['ServicenowField'][_0x3e63('0x43')](_0x2af871[_0x3e63('0x44')],{})[_0x3e63('0x21')](respondWithResult(_0x4e1dd4,0xc9))[_0x3e63('0x41')](handleError(_0x4e1dd4,null));};exports[_0x3e63('0x20')]=function(_0x19b5eb,_0x442b01){if(_0x19b5eb[_0x3e63('0x44')]['id']){delete _0x19b5eb[_0x3e63('0x44')]['id'];}return db[_0x3e63('0x3e')]['find']({'where':{'id':_0x19b5eb[_0x3e63('0x45')]['id']}})['then'](handleEntityNotFound(_0x442b01,null))[_0x3e63('0x21')](saveUpdates(_0x19b5eb[_0x3e63('0x44')],null))[_0x3e63('0x21')](respondWithResult(_0x442b01,null))[_0x3e63('0x41')](handleError(_0x442b01,null));};exports[_0x3e63('0x22')]=function(_0x135315,_0x6497e7){return db['ServicenowField']['find']({'where':{'id':_0x135315[_0x3e63('0x45')]['id']}})[_0x3e63('0x21')](handleEntityNotFound(_0x6497e7,null))['then'](removeEntity(_0x6497e7,null))[_0x3e63('0x41')](handleError(_0x6497e7,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 04a4c25..bbf1781 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 _0x2805=['servicenow_unique_index','idField','util','moment','bluebird','path','rimraf','../../config/environment','exports','ServicenowField','int_servicenow_fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2805,0xe9));var _0x5280=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x2805[_0x397cfb];return _0x15fed9;};'use strict';var _=require('lodash');var util=require(_0x5280('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5280('0x1'));var BPromise=require(_0x5280('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5280('0x3'));var rimraf=require(_0x5280('0x4'));var config=require(_0x5280('0x5'));var attributes=require('./intServicenowField.attributes');module[_0x5280('0x6')]=function(_0x3b788b,_0x2c5995){return _0x3b788b['define'](_0x5280('0x7'),attributes,{'tableName':_0x5280('0x8'),'paranoid':![],'indexes':[{'name':_0x5280('0x9'),'fields':[_0x5280('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4bf4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField','servicenow_unique_index','idField','lodash'];(function(_0x2745be,_0x1f4e2e){var _0x8a47b0=function(_0x52df8a){while(--_0x52df8a){_0x2745be['push'](_0x2745be['shift']());}};_0x8a47b0(++_0x1f4e2e);}(_0x4bf4,0xb3));var _0x44bf=function(_0x1334aa,_0x2a09c9){_0x1334aa=_0x1334aa-0x0;var _0x1062f9=_0x4bf4[_0x1334aa];return _0x1062f9;};'use strict';var _=require(_0x44bf('0x0'));var util=require(_0x44bf('0x1'));var logger=require(_0x44bf('0x2'))(_0x44bf('0x3'));var moment=require(_0x44bf('0x4'));var BPromise=require(_0x44bf('0x5'));var rp=require(_0x44bf('0x6'));var fs=require('fs');var path=require(_0x44bf('0x7'));var rimraf=require(_0x44bf('0x8'));var config=require(_0x44bf('0x9'));var attributes=require(_0x44bf('0xa'));module['exports']=function(_0x4148ee,_0x545a33){return _0x4148ee[_0x44bf('0xb')](_0x44bf('0xc'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x44bf('0xd'),'fields':[_0x44bf('0xe'),'FieldId'],'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 bc3334a..40911a6 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 _0xe244=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','util','randomstring'];(function(_0x5d0eea,_0x4b09e3){var _0x21342c=function(_0xf53ab5){while(--_0xf53ab5){_0x5d0eea['push'](_0x5d0eea['shift']());}};_0x21342c(++_0x4b09e3);}(_0xe244,0x67));var _0x4e24=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xe244[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require(_0x4e24('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4e24('0x1'));var fs=require('fs');var Redis=require(_0x4e24('0x2'));var db=require(_0x4e24('0x3'))['db'];var utils=require(_0x4e24('0x4'));var logger=require(_0x4e24('0x5'))(_0x4e24('0x6'));var config=require(_0x4e24('0x7'));var jayson=require(_0x4e24('0x8'));var client=jayson['client'][_0x4e24('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5017ed,_0x2d9a6a,_0x1c4751){return new BPromise(function(_0x5f0e2d,_0x11e94e){return client[_0x4e24('0xa')](_0x5017ed,_0x1c4751)['then'](function(_0x1019a2){logger[_0x4e24('0xb')]('ServicenowField,\x20%s,\x20%s',_0x2d9a6a,_0x4e24('0xc'));logger[_0x4e24('0xd')](_0x4e24('0xe'),_0x2d9a6a,_0x4e24('0xc'),JSON[_0x4e24('0xf')](_0x1019a2));if(_0x1019a2[_0x4e24('0x10')]){if(_0x1019a2[_0x4e24('0x10')][_0x4e24('0x11')]===0x1f4){logger[_0x4e24('0x10')]('ServicenowField,\x20%s,\x20%s',_0x2d9a6a,_0x1019a2[_0x4e24('0x10')][_0x4e24('0x12')]);return _0x11e94e(_0x1019a2['error'][_0x4e24('0x12')]);}logger[_0x4e24('0x10')](_0x4e24('0x13'),_0x2d9a6a,_0x1019a2['error']['message']);return _0x5f0e2d(_0x1019a2['error'][_0x4e24('0x12')]);}else{logger[_0x4e24('0xb')](_0x4e24('0x13'),_0x2d9a6a,_0x4e24('0xc'));_0x5f0e2d(_0x1019a2['result'][_0x4e24('0x12')]);}})[_0x4e24('0x14')](function(_0x5d869a){logger['error'](_0x4e24('0x13'),_0x2d9a6a,_0x5d869a);_0x11e94e(_0x5d869a);});});} \ No newline at end of file +var _0xd09a=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info'];(function(_0x18959e,_0x24e830){var _0x308aba=function(_0x11ac72){while(--_0x11ac72){_0x18959e['push'](_0x18959e['shift']());}};_0x308aba(++_0x24e830);}(_0xd09a,0x127));var _0xad09=function(_0x51ede7,_0x5dd1d1){_0x51ede7=_0x51ede7-0x0;var _0x3bceb4=_0xd09a[_0x51ede7];return _0x3bceb4;};'use strict';var _=require('lodash');var util=require(_0xad09('0x0'));var moment=require('moment');var BPromise=require(_0xad09('0x1'));var rs=require(_0xad09('0x2'));var fs=require('fs');var Redis=require(_0xad09('0x3'));var db=require(_0xad09('0x4'))['db'];var utils=require(_0xad09('0x5'));var logger=require(_0xad09('0x6'))(_0xad09('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xad09('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c169f,_0x467c72,_0x12aec2){return new BPromise(function(_0x23af3d,_0x5d3870){return client[_0xad09('0x9')](_0x4c169f,_0x12aec2)['then'](function(_0x1bcc9b){logger[_0xad09('0xa')](_0xad09('0xb'),_0x467c72,_0xad09('0xc'));logger[_0xad09('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x467c72,_0xad09('0xc'),JSON[_0xad09('0xe')](_0x1bcc9b));if(_0x1bcc9b[_0xad09('0xf')]){if(_0x1bcc9b[_0xad09('0xf')]['code']===0x1f4){logger[_0xad09('0xf')](_0xad09('0xb'),_0x467c72,_0x1bcc9b['error'][_0xad09('0x10')]);return _0x5d3870(_0x1bcc9b['error'][_0xad09('0x10')]);}logger[_0xad09('0xf')](_0xad09('0xb'),_0x467c72,_0x1bcc9b[_0xad09('0xf')][_0xad09('0x10')]);return _0x23af3d(_0x1bcc9b[_0xad09('0xf')][_0xad09('0x10')]);}else{logger[_0xad09('0xa')](_0xad09('0xb'),_0x467c72,_0xad09('0xc'));_0x23af3d(_0x1bcc9b[_0xad09('0x11')][_0xad09('0x10')]);}})['catch'](function(_0x4b7c5a){logger[_0xad09('0xf')]('ServicenowField,\x20%s,\x20%s',_0x467c72,_0x4b7c5a);_0x5d3870(_0x4b7c5a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index da99f49..0da8bf1 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 _0xb874=['path','connect-timeout','Router','../../config/environment','./intSugarcrmAccount.controller','isAuthenticated','get','/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0xb874,0xe3));var _0x4b87=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb874[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x4b87('0x0'));var util=require('util');var path=require(_0x4b87('0x1'));var timeout=require(_0x4b87('0x2'));var express=require('express');var router=express[_0x4b87('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4b87('0x4'));var controller=require(_0x4b87('0x5'));router['get']('/',auth[_0x4b87('0x6')](),controller['index']);router[_0x4b87('0x7')](_0x4b87('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x4b87('0x7')](_0x4b87('0x9'),auth[_0x4b87('0x6')](),controller['getConfigurations']);router['get'](_0x4b87('0xa'),auth[_0x4b87('0x6')](),controller[_0x4b87('0xb')]);router[_0x4b87('0xc')]('/',auth[_0x4b87('0x6')](),controller['create']);router[_0x4b87('0xc')](_0x4b87('0x9'),auth['isAuthenticated'](),controller[_0x4b87('0xd')]);router[_0x4b87('0xe')](_0x4b87('0x8'),auth[_0x4b87('0x6')](),controller[_0x4b87('0xf')]);router[_0x4b87('0x10')]('/:id',auth[_0x4b87('0x6')](),controller[_0x4b87('0x11')]);module[_0x4b87('0x12')]=router; \ No newline at end of file +var _0x291e=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','update','delete','exports','multer','util','express'];(function(_0x3132bf,_0x44192e){var _0x2fdf07=function(_0x4f4027){while(--_0x4f4027){_0x3132bf['push'](_0x3132bf['shift']());}};_0x2fdf07(++_0x44192e);}(_0x291e,0x13f));var _0xe291=function(_0x1e4adf,_0x494ef7){_0x1e4adf=_0x1e4adf-0x0;var _0xc77dc5=_0x291e[_0x1e4adf];return _0xc77dc5;};'use strict';var multer=require(_0xe291('0x0'));var util=require(_0xe291('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe291('0x2'));var router=express[_0xe291('0x3')]();var auth=require(_0xe291('0x4'));var interaction=require(_0xe291('0x5'));var config=require(_0xe291('0x6'));var controller=require(_0xe291('0x7'));router[_0xe291('0x8')]('/',auth[_0xe291('0x9')](),controller[_0xe291('0xa')]);router['get']('/:id',auth[_0xe291('0x9')](),controller[_0xe291('0xb')]);router['get'](_0xe291('0xc'),auth[_0xe291('0x9')](),controller[_0xe291('0xd')]);router['get'](_0xe291('0xe'),auth[_0xe291('0x9')](),controller['getFields']);router[_0xe291('0xf')]('/',auth[_0xe291('0x9')](),controller[_0xe291('0x10')]);router['post'](_0xe291('0xc'),auth[_0xe291('0x9')](),controller[_0xe291('0x11')]);router[_0xe291('0x12')](_0xe291('0x13'),auth['isAuthenticated'](),controller[_0xe291('0x14')]);router[_0xe291('0x15')](_0xe291('0x13'),auth[_0xe291('0x9')](),controller['destroy']);module[_0xe291('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 3e81f83..e58a874 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 _0x6fd5=['sequelize','STRING','username','remoteUri'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6fd5,0xf0));var _0x56fd=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x6fd5[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0x56fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x56fd('0x1')]},'description':{'type':Sequelize[_0x56fd('0x1')]},'username':{'type':Sequelize[_0x56fd('0x1')],'unique':_0x56fd('0x2')},'password':{'type':Sequelize[_0x56fd('0x1')]},'remoteUri':{'type':Sequelize[_0x56fd('0x1')],'unique':_0x56fd('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4c5e=['sequelize','exports','STRING','username','remoteUri'];(function(_0x10ef1d,_0x356dd4){var _0x3f04b6=function(_0x301f08){while(--_0x301f08){_0x10ef1d['push'](_0x10ef1d['shift']());}};_0x3f04b6(++_0x356dd4);}(_0x4c5e,0x73));var _0xe4c5=function(_0x27eece,_0x5c37a4){_0x27eece=_0x27eece-0x0;var _0x212871=_0x4c5e[_0x27eece];return _0x212871;};'use strict';var Sequelize=require(_0xe4c5('0x0'));module[_0xe4c5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe4c5('0x2')]},'username':{'type':Sequelize[_0xe4c5('0x2')],'unique':_0xe4c5('0x3')},'password':{'type':Sequelize[_0xe4c5('0x2')]},'remoteUri':{'type':Sequelize[_0xe4c5('0x2')],'unique':_0xe4c5('0x4')},'serverUrl':{'type':Sequelize[_0xe4c5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 7244ceb..e2301ee 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 _0xdb92=['fieldName','key','model','query','attributes','fields','length','hasOwnProperty','sort','where','filters','merge','type','VIRTUAL','filter','SugarcrmAccount','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','getConfigurations','findOne','keys','intersection','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_type','direction','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','username','password','PLAIN','xCALLY\x20Motion\x20Integration','format','Calls','values','module_fields','remove','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes'];(function(_0x1436ef,_0xfcfd16){var _0x1dc2e4=function(_0x50a911){while(--_0x50a911){_0x1436ef['push'](_0x1436ef['shift']());}};_0x1dc2e4(++_0xfcfd16);}(_0xdb92,0xcd));var _0x2db9=function(_0x2cba16,_0x47c761){_0x2cba16=_0x2cba16-0x0;var _0x4d90b5=_0xdb92[_0x2cba16];return _0x4d90b5;};'use strict';var pdf=require(_0x2db9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2db9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2db9('0x2'));var rp=require(_0x2db9('0x3'));var moment=require(_0x2db9('0x4'));var BPromise=require(_0x2db9('0x5'));var Mustache=require('mustache');var util=require(_0x2db9('0x6'));var path=require(_0x2db9('0x7'));var sox=require(_0x2db9('0x8'));var csv=require(_0x2db9('0x9'));var ejs=require(_0x2db9('0xa'));var fs=require('fs');var _=require(_0x2db9('0xb'));var squel=require(_0x2db9('0xc'));var crypto=require(_0x2db9('0xd'));var jsforce=require(_0x2db9('0xe'));var deskjs=require(_0x2db9('0xf'));var toCsv=require(_0x2db9('0x9'));var querystring=require('querystring');var Papa=require(_0x2db9('0x10'));var Redis=require(_0x2db9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2db9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2db9('0x13'));var logger=require(_0x2db9('0x14'))(_0x2db9('0x15'));var utils=require(_0x2db9('0x16'));var config=require(_0x2db9('0x17'));var db=require(_0x2db9('0x18'))['db'];var integrations=require(_0x2db9('0x19'));var jayson=require(_0x2db9('0x1a'));var client=jayson['client'][_0x2db9('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x23f558,_0x1d7ef8,_0x153f87){if(_0x153f87){var _0x5c002a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c002a[_0x2db9('0x1c')](_0x1d7ef8)){return _0x23f558;}else{throw new db[(_0x2db9('0x1d'))][(_0x2db9('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x23f558;}}function respondWithRpcPromise(_0x30cf92,_0x335dd1,_0x1129da,_0x3cacc8){return new BPromise(function(_0xcf985d,_0x16bf4b){var _0x437db4=_0x3cacc8||client;return _0x437db4[_0x2db9('0x1f')](_0x30cf92,_0x1129da)[_0x2db9('0x20')](function(_0x310fa8){logger[_0x2db9('0x21')](_0x2db9('0x22'),_0x335dd1,_0x2db9('0x23'));logger[_0x2db9('0x24')](_0x2db9('0x25'),_0x335dd1,'request\x20sent',JSON[_0x2db9('0x26')](_0x310fa8));if(_0x310fa8[_0x2db9('0x27')]){if(_0x310fa8[_0x2db9('0x27')]['code']===0x1f4){logger[_0x2db9('0x27')](_0x2db9('0x22'),_0x335dd1,_0x310fa8[_0x2db9('0x27')]['message']);return _0x16bf4b(_0x310fa8['error'][_0x2db9('0x28')]);}logger[_0x2db9('0x27')](_0x2db9('0x22'),_0x335dd1,_0x310fa8[_0x2db9('0x27')][_0x2db9('0x28')]);return _0xcf985d(_0x310fa8[_0x2db9('0x27')]['message']);}else{logger[_0x2db9('0x21')]('SugarcrmAccount,\x20%s,\x20%s',_0x335dd1,'request\x20sent');_0xcf985d(_0x310fa8['result'][_0x2db9('0x28')]);}})['catch'](function(_0x1eeee7){logger[_0x2db9('0x27')](_0x2db9('0x22'),_0x335dd1,_0x1eeee7);_0x16bf4b(_0x1eeee7);});});}function respondWithStatusCode(_0x3d239b,_0x30b58d){_0x30b58d=_0x30b58d||0xcc;return function(_0x2da160){if(_0x2da160){return _0x3d239b[_0x2db9('0x29')](_0x30b58d);}return _0x3d239b[_0x2db9('0x2a')](_0x30b58d)[_0x2db9('0x2b')]();};}function respondWithResult(_0x456441,_0x23e234){_0x23e234=_0x23e234||0xc8;return function(_0x8dc5ab){if(_0x8dc5ab){return _0x456441[_0x2db9('0x2a')](_0x23e234)[_0x2db9('0x2c')](_0x8dc5ab);}};}function respondWithFilteredResult(_0x7265b5,_0x309ec7){return function(_0x6ec22c){if(_0x6ec22c){var _0x3e5732=_0x6ec22c[_0x2db9('0x2d')],_0x4aacc8=_0x309ec7['offset'],_0x140984=_0x309ec7[_0x2db9('0x2e')]+_0x309ec7[_0x2db9('0x2f')],_0x105945;if(_0x140984>=_0x3e5732){_0x140984=_0x3e5732;_0x105945=0xc8;}else{_0x105945=0xce;}_0x7265b5[_0x2db9('0x2a')](_0x105945);return _0x7265b5[_0x2db9('0x30')](_0x2db9('0x31'),_0x4aacc8+'-'+_0x140984+'/'+_0x3e5732)[_0x2db9('0x2c')](_0x6ec22c);}return null;};}function patchUpdates(_0x38c3f7){return function(_0x2bfa8b){try{jsonpatch[_0x2db9('0x32')](_0x2bfa8b,_0x38c3f7,!![]);}catch(_0x505c35){return BPromise[_0x2db9('0x33')](_0x505c35);}return _0x2bfa8b[_0x2db9('0x34')]();};}function saveUpdates(_0x533e0a,_0x176e14){return function(_0x1bc13b){if(_0x1bc13b){return _0x1bc13b[_0x2db9('0x35')](_0x533e0a)[_0x2db9('0x20')](function(_0x580615){return _0x580615;});}return null;};}function removeEntity(_0x36d830,_0x322d52){return function(_0x12854f){if(_0x12854f){return _0x12854f[_0x2db9('0x36')]()[_0x2db9('0x20')](function(){_0x36d830[_0x2db9('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6b3c59,_0x5f5362){return function(_0x564e35){if(!_0x564e35){_0x6b3c59[_0x2db9('0x29')](0x194);}return _0x564e35;};}function handleError(_0x2a1df8,_0x3e21ac){_0x3e21ac=_0x3e21ac||0x1f4;return function(_0xab20a7){logger[_0x2db9('0x27')](_0xab20a7[_0x2db9('0x37')]);if(_0xab20a7['name']){delete _0xab20a7[_0x2db9('0x38')];}_0x2a1df8[_0x2db9('0x2a')](_0x3e21ac)[_0x2db9('0x39')](_0xab20a7);};}exports[_0x2db9('0x3a')]=function(_0x6b24d0,_0x1e3964){var _0x471969={},_0x4311a2={},_0x2bb13d={'count':0x0,'rows':[]};var _0x22bd3e=_[_0x2db9('0x3b')](db['SugarcrmAccount'][_0x2db9('0x3c')],function(_0x1045d8){return{'name':_0x1045d8[_0x2db9('0x3d')],'type':_0x1045d8['type'][_0x2db9('0x3e')]};});_0x4311a2[_0x2db9('0x3f')]=_[_0x2db9('0x3b')](_0x22bd3e,_0x2db9('0x38'));_0x4311a2[_0x2db9('0x40')]=_['keys'](_0x6b24d0['query']);_0x4311a2['filters']=_['intersection'](_0x4311a2[_0x2db9('0x3f')],_0x4311a2[_0x2db9('0x40')]);_0x471969[_0x2db9('0x41')]=_['intersection'](_0x4311a2[_0x2db9('0x3f')],qs[_0x2db9('0x42')](_0x6b24d0[_0x2db9('0x40')][_0x2db9('0x42')]));_0x471969[_0x2db9('0x41')]=_0x471969[_0x2db9('0x41')][_0x2db9('0x43')]?_0x471969['attributes']:_0x4311a2[_0x2db9('0x3f')];if(!_0x6b24d0['query'][_0x2db9('0x44')]('nolimit')){_0x471969[_0x2db9('0x2f')]=qs[_0x2db9('0x2f')](_0x6b24d0[_0x2db9('0x40')]['limit']);_0x471969['offset']=qs[_0x2db9('0x2e')](_0x6b24d0[_0x2db9('0x40')]['offset']);}_0x471969['order']=qs[_0x2db9('0x45')](_0x6b24d0[_0x2db9('0x40')]['sort']);_0x471969[_0x2db9('0x46')]=qs[_0x2db9('0x47')](_['pick'](_0x6b24d0[_0x2db9('0x40')],_0x4311a2[_0x2db9('0x47')]));if(_0x6b24d0[_0x2db9('0x40')]['filter']){_0x471969[_0x2db9('0x46')]=_[_0x2db9('0x48')](_0x471969[_0x2db9('0x46')],{'$or':_[_0x2db9('0x3b')](_0x22bd3e,function(_0x3f1ea2){if(_0x3f1ea2[_0x2db9('0x49')]!==_0x2db9('0x4a')){var _0x419fb4={};_0x419fb4[_0x3f1ea2[_0x2db9('0x38')]]={'$like':'%'+_0x6b24d0[_0x2db9('0x40')][_0x2db9('0x4b')]+'%'};return _0x419fb4;}})});}_0x471969=_[_0x2db9('0x48')]({},_0x471969,_0x6b24d0['options']);var _0x21ab0a={'where':_0x471969['where']};return db[_0x2db9('0x4c')][_0x2db9('0x2d')](_0x21ab0a)['then'](function(_0x3eb617){_0x2bb13d[_0x2db9('0x2d')]=_0x3eb617;if(_0x6b24d0[_0x2db9('0x40')]['includeAll']){_0x471969[_0x2db9('0x4d')]=[{'all':!![]}];}return db[_0x2db9('0x4c')][_0x2db9('0x4e')](_0x471969);})[_0x2db9('0x20')](function(_0x3e4d11){_0x2bb13d[_0x2db9('0x4f')]=_0x3e4d11;return _0x2bb13d;})[_0x2db9('0x20')](respondWithFilteredResult(_0x1e3964,_0x471969))[_0x2db9('0x50')](handleError(_0x1e3964,null));};exports[_0x2db9('0x51')]=function(_0x37729e,_0x266a29){var _0x44a7b1={'raw':![],'where':{'id':_0x37729e[_0x2db9('0x52')]['id']}},_0xb30f58={};_0xb30f58[_0x2db9('0x3f')]=_['keys'](db[_0x2db9('0x4c')]['rawAttributes']);_0xb30f58['query']=_['keys'](_0x37729e[_0x2db9('0x40')]);_0xb30f58[_0x2db9('0x47')]=_['intersection'](_0xb30f58[_0x2db9('0x3f')],_0xb30f58['query']);_0x44a7b1[_0x2db9('0x41')]=_['intersection'](_0xb30f58[_0x2db9('0x3f')],qs[_0x2db9('0x42')](_0x37729e[_0x2db9('0x40')][_0x2db9('0x42')]));_0x44a7b1[_0x2db9('0x41')]=_0x44a7b1['attributes'][_0x2db9('0x43')]?_0x44a7b1[_0x2db9('0x41')]:_0xb30f58[_0x2db9('0x3f')];if(_0x37729e[_0x2db9('0x40')][_0x2db9('0x53')]){_0x44a7b1['include']=[{'all':!![]}];}_0x44a7b1=_['merge']({},_0x44a7b1,_0x37729e[_0x2db9('0x54')]);return db[_0x2db9('0x4c')][_0x2db9('0x55')](_0x44a7b1)[_0x2db9('0x20')](handleEntityNotFound(_0x266a29,null))[_0x2db9('0x20')](respondWithResult(_0x266a29,null))['catch'](handleError(_0x266a29,null));};exports['create']=function(_0x36ba89,_0xaeba6a){return db[_0x2db9('0x4c')][_0x2db9('0x56')](_0x36ba89[_0x2db9('0x57')],{})['then'](respondWithResult(_0xaeba6a,0xc9))['catch'](handleError(_0xaeba6a,null));};exports[_0x2db9('0x35')]=function(_0x4a4de3,_0x48ea84){if(_0x4a4de3[_0x2db9('0x57')]['id']){delete _0x4a4de3[_0x2db9('0x57')]['id'];}return db[_0x2db9('0x4c')][_0x2db9('0x55')]({'where':{'id':_0x4a4de3[_0x2db9('0x52')]['id']}})[_0x2db9('0x20')](handleEntityNotFound(_0x48ea84,null))[_0x2db9('0x20')](saveUpdates(_0x4a4de3['body'],null))[_0x2db9('0x20')](respondWithResult(_0x48ea84,null))[_0x2db9('0x50')](handleError(_0x48ea84,null));};exports[_0x2db9('0x36')]=function(_0x2b9c53,_0xd34f53){return db[_0x2db9('0x4c')][_0x2db9('0x55')]({'where':{'id':_0x2b9c53[_0x2db9('0x52')]['id']}})[_0x2db9('0x20')](handleEntityNotFound(_0xd34f53,null))['then'](removeEntity(_0xd34f53,null))['catch'](handleError(_0xd34f53,null));};exports[_0x2db9('0x58')]=function(_0x4badb7,_0x20e50c,_0x3c5f8e){var _0x5e1867={};var _0x136ed3={};var _0x1631cf;var _0xb058a4;return db[_0x2db9('0x4c')][_0x2db9('0x59')]({'where':{'id':_0x4badb7[_0x2db9('0x52')]['id']}})[_0x2db9('0x20')](handleEntityNotFound(_0x20e50c,null))[_0x2db9('0x20')](function(_0x24ad7c){if(_0x24ad7c){_0x1631cf=_0x24ad7c;_0x136ed3[_0x2db9('0x3f')]=_['keys'](db['SugarcrmConfiguration'][_0x2db9('0x3c')]);_0x136ed3[_0x2db9('0x40')]=_[_0x2db9('0x5a')](_0x4badb7[_0x2db9('0x40')]);_0x136ed3['filters']=_[_0x2db9('0x5b')](_0x136ed3[_0x2db9('0x3f')],_0x136ed3[_0x2db9('0x40')]);_0x5e1867['attributes']=_[_0x2db9('0x5b')](_0x136ed3[_0x2db9('0x3f')],qs['fields'](_0x4badb7['query']['fields']));_0x5e1867[_0x2db9('0x41')]=_0x5e1867[_0x2db9('0x41')][_0x2db9('0x43')]?_0x5e1867[_0x2db9('0x41')]:_0x136ed3[_0x2db9('0x3f')];_0x5e1867[_0x2db9('0x5c')]=qs['sort'](_0x4badb7[_0x2db9('0x40')][_0x2db9('0x45')]);_0x5e1867[_0x2db9('0x46')]=qs[_0x2db9('0x47')](_['pick'](_0x4badb7[_0x2db9('0x40')],_0x136ed3[_0x2db9('0x47')]));if(_0x4badb7[_0x2db9('0x40')]['filter']){_0x5e1867['where']=_[_0x2db9('0x48')](_0x5e1867[_0x2db9('0x46')],{'$or':_[_0x2db9('0x3b')](_0x5e1867[_0x2db9('0x41')],function(_0x2185d3){var _0xbe3523={};_0xbe3523[_0x2185d3]={'$like':'%'+_0x4badb7['query'][_0x2db9('0x4b')]+'%'};return _0xbe3523;})});}_0x5e1867=_[_0x2db9('0x48')]({},_0x5e1867,_0x4badb7['options']);return _0x1631cf[_0x2db9('0x58')](_0x5e1867);}})[_0x2db9('0x20')](function(_0x46033c){if(_0x46033c){_0xb058a4=_0x46033c[_0x2db9('0x43')];if(!_0x4badb7['query'][_0x2db9('0x44')](_0x2db9('0x5d'))){_0x5e1867[_0x2db9('0x2f')]=qs[_0x2db9('0x2f')](_0x4badb7[_0x2db9('0x40')][_0x2db9('0x2f')]);_0x5e1867[_0x2db9('0x2e')]=qs['offset'](_0x4badb7[_0x2db9('0x40')][_0x2db9('0x2e')]);}return _0x1631cf[_0x2db9('0x58')](_0x5e1867);}})['then'](function(_0x4ff6bb){if(_0x4ff6bb){return _0x4ff6bb?{'count':_0xb058a4,'rows':_0x4ff6bb}:null;}})['then'](respondWithResult(_0x20e50c,null))[_0x2db9('0x50')](handleError(_0x20e50c,null));};exports[_0x2db9('0x5e')]=function(_0x321862,_0x2997a5,_0x5f3fcd){if(_0x321862[_0x2db9('0x57')]['id']){delete _0x321862['body']['id'];}return db[_0x2db9('0x4c')]['findOne']({'where':{'id':_0x321862[_0x2db9('0x52')]['id']}})[_0x2db9('0x20')](handleEntityNotFound(_0x2997a5,null))[_0x2db9('0x20')](function(_0x13418b){if(_0x13418b){_0x321862[_0x2db9('0x57')][_0x2db9('0x5f')]=_0x13418b['id'];_0x321862[_0x2db9('0x57')][_0x2db9('0x60')]=integrations[_0x2db9('0x61')](_0x321862[_0x2db9('0x57')][_0x2db9('0x62')],_0x321862['body']['type']);_0x321862['body'][_0x2db9('0x63')]=integrations[_0x2db9('0x64')](_0x321862[_0x2db9('0x57')][_0x2db9('0x62')],_0x321862[_0x2db9('0x57')][_0x2db9('0x49')]);return db['SugarcrmConfiguration'][_0x2db9('0x56')](_0x321862['body'],{'include':[{'model':db[_0x2db9('0x65')],'as':_0x2db9('0x60')},{'model':db[_0x2db9('0x65')],'as':_0x2db9('0x63')}]});}return null;})[_0x2db9('0x20')](respondWithResult(_0x2997a5,null))['catch'](handleError(_0x2997a5,null));};exports[_0x2db9('0x66')]=function(_0x193b6a,_0x1ef58a,_0xfb537d){var _0x44ba39='';var _0x592409=['id',_0x2db9('0x38'),'assigned_user_id',_0x2db9('0x67'),_0x2db9('0x68'),_0x2db9('0x69'),_0x2db9('0x6a'),_0x2db9('0x6b'),'parent_id',_0x2db9('0x6c'),'parent_name',_0x2db9('0x6d')];return db['SugarcrmAccount'][_0x2db9('0x59')]({'where':{'id':_0x193b6a[_0x2db9('0x52')]['id']},'attributes':['id','username','password',_0x2db9('0x6e')]})[_0x2db9('0x20')](handleEntityNotFound(_0x1ef58a,null))[_0x2db9('0x20')](function(_0x55d790){if(_0x55d790){_0x44ba39=_0x55d790[_0x2db9('0x6e')];var _0x4a790e=_0x44ba39[_0x2db9('0x6f')](-0x1);if(_0x4a790e==='/'){_0x44ba39=_0x44ba39[_0x2db9('0x70')](0x0,_0x44ba39[_0x2db9('0x71')](_0x4a790e));}return rp({'method':_0x2db9('0x72'),'uri':util['format'](_0x2db9('0x73'),_0x44ba39,_0x2db9('0x74')),'json':!![],'form':{'method':_0x2db9('0x75'),'input_type':_0x2db9('0x76'),'response_type':_0x2db9('0x76'),'rest_data':JSON[_0x2db9('0x26')]({'user_auth':{'user_name':_0x55d790[_0x2db9('0x77')],'password':_0x55d790[_0x2db9('0x78')],'encryption':_0x2db9('0x79')},'application':_0x2db9('0x7a')})}});}})[_0x2db9('0x20')](function(_0x473996){if(_0x473996&&_0x473996[_0x2db9('0x38')]!=='Invalid\x20Login'&&_0x473996[_0x2db9('0x38')]!=='Password\x20Expired'){return rp({'method':_0x2db9('0x72'),'uri':util[_0x2db9('0x7b')](_0x2db9('0x73'),_0x44ba39,_0x2db9('0x74')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x2db9('0x76'),'response_type':_0x2db9('0x76'),'rest_data':JSON['stringify']({'session':_0x473996['id'],'module_name':_0x2db9('0x7c')})}})[_0x2db9('0x20')](function(_0x5b5cd2){if(_0x5b5cd2){var _0x112f50=_[_0x2db9('0x7d')](_0x5b5cd2[_0x2db9('0x7e')]);_[_0x2db9('0x7f')](_0x112f50,function(_0xe33f7d){return _0x592409['includes'](_0xe33f7d[_0x2db9('0x38')]);});return{'count':_0x112f50[_0x2db9('0x43')],'rows':_['map'](_0x112f50,function(_0x1557f9){return{'id':_0x1557f9[_0x2db9('0x38')],'name':_0x1557f9['label'],'custom':_[_0x2db9('0x80')](_0x1557f9[_0x2db9('0x38')],'_c')?!![]:![],'options':_0x1557f9[_0x2db9('0x54')]?_[_0x2db9('0x3b')](_[_0x2db9('0x7d')](_0x1557f9[_0x2db9('0x54')]),function(_0x48adc7){return{'name':_0x48adc7[_0x2db9('0x81')],'value':_0x48adc7['name']};}):[]};})};}})[_0x2db9('0x20')](respondWithResult(_0x1ef58a,null))[_0x2db9('0x50')](function(_0x46f820){var _0x31cccf=_0x193b6a['query'][_0x2db9('0x1c')]?0x1f4:_0x46f820[_0x2db9('0x82')]||0x1f4;logger['error'](_0x2db9('0x83'),_0x2db9('0x66'),_0x31cccf,JSON[_0x2db9('0x26')](_0x46f820));delete _0x46f820[_0x2db9('0x38')];if(_0x31cccf===0x191){_0x31cccf=0x190;}_0x1ef58a[_0x2db9('0x2a')](_0x31cccf)[_0x2db9('0x39')](_0x193b6a[_0x2db9('0x40')]['test']?{'message':_0x2db9('0x84'),'statusCode':_0x46f820['statusCode']}:_0x46f820);});}else{var _0x310b1f=0x1f4;_0x1ef58a[_0x2db9('0x2a')](_0x310b1f)[_0x2db9('0x39')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xf6dc=['getFields','assigned_user_id','created_by','description','date_start','duration_minutes','direction','username','password','remoteUri','format','/service/v4_1/rest.php','PLAIN','Invalid\x20Login','Password\x20Expired','POST','%s%s','JSON','values','module_fields','remove','includes','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','stringify','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','status','end','json','offset','limit','set','Content-Range','reject','save','update','sendStatus','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','show','params','fields','length','create','body','find','destroy','findOne','SugarcrmConfiguration','getConfigurations','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField'];(function(_0x47763d,_0x2b7979){var _0x573abe=function(_0x23c2c9){while(--_0x23c2c9){_0x47763d['push'](_0x47763d['shift']());}};_0x573abe(++_0x2b7979);}(_0xf6dc,0x11d));var _0xcf6d=function(_0x11c748,_0x1f3370){_0x11c748=_0x11c748-0x0;var _0x5a3947=_0xf6dc[_0x11c748];return _0x5a3947;};'use strict';var pdf=require(_0xcf6d('0x0'));var emlformat=require(_0xcf6d('0x1'));var rimraf=require(_0xcf6d('0x2'));var zipdir=require(_0xcf6d('0x3'));var jsonpatch=require(_0xcf6d('0x4'));var rp=require(_0xcf6d('0x5'));var moment=require('moment');var BPromise=require(_0xcf6d('0x6'));var Mustache=require('mustache');var util=require(_0xcf6d('0x7'));var path=require(_0xcf6d('0x8'));var sox=require(_0xcf6d('0x9'));var csv=require(_0xcf6d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcf6d('0xb'));var squel=require('squel');var crypto=require(_0xcf6d('0xc'));var jsforce=require(_0xcf6d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcf6d('0xa'));var querystring=require(_0xcf6d('0xe'));var Papa=require(_0xcf6d('0xf'));var Redis=require(_0xcf6d('0x10'));var authService=require(_0xcf6d('0x11'));var qs=require(_0xcf6d('0x12'));var as=require(_0xcf6d('0x13'));var hardwareService=require(_0xcf6d('0x14'));var logger=require(_0xcf6d('0x15'))(_0xcf6d('0x16'));var utils=require(_0xcf6d('0x17'));var config=require(_0xcf6d('0x18'));var db=require(_0xcf6d('0x19'))['db'];var integrations=require(_0xcf6d('0x1a'));var jayson=require(_0xcf6d('0x1b'));var client=jayson['client'][_0xcf6d('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3e4dcb,_0x1ed49d,_0x32ce47){if(_0x32ce47){var _0x550960=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x550960[_0xcf6d('0x1d')](_0x1ed49d)){return _0x3e4dcb;}else{throw new db[(_0xcf6d('0x1e'))][(_0xcf6d('0x1f'))](_0xcf6d('0x20'));}}else{return _0x3e4dcb;}}function respondWithRpcPromise(_0x254f1b,_0x19167b,_0x89958d,_0xd9a14d){return new BPromise(function(_0x5994a3,_0x146dd9){var _0x5e6ab7=_0xd9a14d||client;return _0x5e6ab7[_0xcf6d('0x21')](_0x254f1b,_0x89958d)[_0xcf6d('0x22')](function(_0x1cf557){logger[_0xcf6d('0x23')]('SugarcrmAccount,\x20%s,\x20%s',_0x19167b,_0xcf6d('0x24'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x19167b,'request\x20sent',JSON[_0xcf6d('0x25')](_0x1cf557));if(_0x1cf557[_0xcf6d('0x26')]){if(_0x1cf557[_0xcf6d('0x26')][_0xcf6d('0x27')]===0x1f4){logger[_0xcf6d('0x26')]('SugarcrmAccount,\x20%s,\x20%s',_0x19167b,_0x1cf557[_0xcf6d('0x26')][_0xcf6d('0x28')]);return _0x146dd9(_0x1cf557[_0xcf6d('0x26')][_0xcf6d('0x28')]);}logger['error'](_0xcf6d('0x29'),_0x19167b,_0x1cf557[_0xcf6d('0x26')][_0xcf6d('0x28')]);return _0x5994a3(_0x1cf557['error'][_0xcf6d('0x28')]);}else{logger[_0xcf6d('0x23')](_0xcf6d('0x29'),_0x19167b,_0xcf6d('0x24'));_0x5994a3(_0x1cf557[_0xcf6d('0x2a')][_0xcf6d('0x28')]);}})[_0xcf6d('0x2b')](function(_0xac46d){logger[_0xcf6d('0x26')](_0xcf6d('0x29'),_0x19167b,_0xac46d);_0x146dd9(_0xac46d);});});}function respondWithStatusCode(_0x23131d,_0x27eb5b){_0x27eb5b=_0x27eb5b||0xcc;return function(_0x5b0d53){if(_0x5b0d53){return _0x23131d['sendStatus'](_0x27eb5b);}return _0x23131d[_0xcf6d('0x2c')](_0x27eb5b)[_0xcf6d('0x2d')]();};}function respondWithResult(_0x415bd5,_0x41627c){_0x41627c=_0x41627c||0xc8;return function(_0xe01cdc){if(_0xe01cdc){return _0x415bd5[_0xcf6d('0x2c')](_0x41627c)[_0xcf6d('0x2e')](_0xe01cdc);}};}function respondWithFilteredResult(_0x293acd,_0x9a9b3c){return function(_0x14128d){if(_0x14128d){var _0x44ec3a=_0x14128d['count'],_0x2b61d3=_0x9a9b3c[_0xcf6d('0x2f')],_0x3d4ce6=_0x9a9b3c[_0xcf6d('0x2f')]+_0x9a9b3c[_0xcf6d('0x30')],_0x5445d2;if(_0x3d4ce6>=_0x44ec3a){_0x3d4ce6=_0x44ec3a;_0x5445d2=0xc8;}else{_0x5445d2=0xce;}_0x293acd[_0xcf6d('0x2c')](_0x5445d2);return _0x293acd[_0xcf6d('0x31')](_0xcf6d('0x32'),_0x2b61d3+'-'+_0x3d4ce6+'/'+_0x44ec3a)[_0xcf6d('0x2e')](_0x14128d);}return null;};}function patchUpdates(_0x596fc7){return function(_0x38e194){try{jsonpatch['apply'](_0x38e194,_0x596fc7,!![]);}catch(_0x44d30d){return BPromise[_0xcf6d('0x33')](_0x44d30d);}return _0x38e194[_0xcf6d('0x34')]();};}function saveUpdates(_0x26b719,_0xd92e26){return function(_0x48ff1e){if(_0x48ff1e){return _0x48ff1e[_0xcf6d('0x35')](_0x26b719)[_0xcf6d('0x22')](function(_0x3f1e5e){return _0x3f1e5e;});}return null;};}function removeEntity(_0xc98ef2,_0x2f7901){return function(_0x46e029){if(_0x46e029){return _0x46e029['destroy']()[_0xcf6d('0x22')](function(){_0xc98ef2['status'](0xcc)[_0xcf6d('0x2d')]();});}};}function handleEntityNotFound(_0x5fb4a0,_0x5165b3){return function(_0x46b118){if(!_0x46b118){_0x5fb4a0[_0xcf6d('0x36')](0x194);}return _0x46b118;};}function handleError(_0x4b3ea6,_0x4bc9cf){_0x4bc9cf=_0x4bc9cf||0x1f4;return function(_0x1e6684){logger['error'](_0x1e6684[_0xcf6d('0x37')]);if(_0x1e6684[_0xcf6d('0x38')]){delete _0x1e6684[_0xcf6d('0x38')];}_0x4b3ea6[_0xcf6d('0x2c')](_0x4bc9cf)[_0xcf6d('0x39')](_0x1e6684);};}exports['index']=function(_0x5b317d,_0xabc060){var _0x553693={},_0x4a1c35={},_0xac17f4={'count':0x0,'rows':[]};var _0x1f1e40=_[_0xcf6d('0x3a')](db[_0xcf6d('0x3b')][_0xcf6d('0x3c')],function(_0x5cfdf5){return{'name':_0x5cfdf5[_0xcf6d('0x3d')],'type':_0x5cfdf5[_0xcf6d('0x3e')][_0xcf6d('0x3f')]};});_0x4a1c35[_0xcf6d('0x40')]=_[_0xcf6d('0x3a')](_0x1f1e40,_0xcf6d('0x38'));_0x4a1c35[_0xcf6d('0x41')]=_[_0xcf6d('0x42')](_0x5b317d[_0xcf6d('0x41')]);_0x4a1c35[_0xcf6d('0x43')]=_[_0xcf6d('0x44')](_0x4a1c35[_0xcf6d('0x40')],_0x4a1c35[_0xcf6d('0x41')]);_0x553693[_0xcf6d('0x45')]=_[_0xcf6d('0x44')](_0x4a1c35['model'],qs['fields'](_0x5b317d[_0xcf6d('0x41')]['fields']));_0x553693['attributes']=_0x553693['attributes']['length']?_0x553693[_0xcf6d('0x45')]:_0x4a1c35['model'];if(!_0x5b317d[_0xcf6d('0x41')]['hasOwnProperty']('nolimit')){_0x553693[_0xcf6d('0x30')]=qs[_0xcf6d('0x30')](_0x5b317d['query'][_0xcf6d('0x30')]);_0x553693[_0xcf6d('0x2f')]=qs['offset'](_0x5b317d['query'][_0xcf6d('0x2f')]);}_0x553693[_0xcf6d('0x46')]=qs[_0xcf6d('0x47')](_0x5b317d[_0xcf6d('0x41')][_0xcf6d('0x47')]);_0x553693[_0xcf6d('0x48')]=qs[_0xcf6d('0x43')](_[_0xcf6d('0x49')](_0x5b317d[_0xcf6d('0x41')],_0x4a1c35[_0xcf6d('0x43')]));if(_0x5b317d[_0xcf6d('0x41')][_0xcf6d('0x4a')]){_0x553693[_0xcf6d('0x48')]=_['merge'](_0x553693[_0xcf6d('0x48')],{'$or':_[_0xcf6d('0x3a')](_0x1f1e40,function(_0x465f9f){if(_0x465f9f[_0xcf6d('0x3e')]!==_0xcf6d('0x4b')){var _0x55a921={};_0x55a921[_0x465f9f[_0xcf6d('0x38')]]={'$like':'%'+_0x5b317d['query'][_0xcf6d('0x4a')]+'%'};return _0x55a921;}})});}_0x553693=_[_0xcf6d('0x4c')]({},_0x553693,_0x5b317d[_0xcf6d('0x4d')]);var _0x48253d={'where':_0x553693[_0xcf6d('0x48')]};return db[_0xcf6d('0x3b')][_0xcf6d('0x4e')](_0x48253d)[_0xcf6d('0x22')](function(_0x410d6e){_0xac17f4[_0xcf6d('0x4e')]=_0x410d6e;if(_0x5b317d[_0xcf6d('0x41')][_0xcf6d('0x4f')]){_0x553693['include']=[{'all':!![]}];}return db[_0xcf6d('0x3b')][_0xcf6d('0x50')](_0x553693);})['then'](function(_0x2ea2a4){_0xac17f4['rows']=_0x2ea2a4;return _0xac17f4;})[_0xcf6d('0x22')](respondWithFilteredResult(_0xabc060,_0x553693))[_0xcf6d('0x2b')](handleError(_0xabc060,null));};exports[_0xcf6d('0x51')]=function(_0x5bfaa3,_0x240827){var _0x4b030d={'raw':![],'where':{'id':_0x5bfaa3[_0xcf6d('0x52')]['id']}},_0x31a27e={};_0x31a27e[_0xcf6d('0x40')]=_[_0xcf6d('0x42')](db[_0xcf6d('0x3b')][_0xcf6d('0x3c')]);_0x31a27e[_0xcf6d('0x41')]=_[_0xcf6d('0x42')](_0x5bfaa3[_0xcf6d('0x41')]);_0x31a27e[_0xcf6d('0x43')]=_[_0xcf6d('0x44')](_0x31a27e[_0xcf6d('0x40')],_0x31a27e[_0xcf6d('0x41')]);_0x4b030d[_0xcf6d('0x45')]=_[_0xcf6d('0x44')](_0x31a27e[_0xcf6d('0x40')],qs[_0xcf6d('0x53')](_0x5bfaa3['query'][_0xcf6d('0x53')]));_0x4b030d[_0xcf6d('0x45')]=_0x4b030d['attributes'][_0xcf6d('0x54')]?_0x4b030d[_0xcf6d('0x45')]:_0x31a27e[_0xcf6d('0x40')];if(_0x5bfaa3[_0xcf6d('0x41')][_0xcf6d('0x4f')]){_0x4b030d['include']=[{'all':!![]}];}_0x4b030d=_[_0xcf6d('0x4c')]({},_0x4b030d,_0x5bfaa3[_0xcf6d('0x4d')]);return db[_0xcf6d('0x3b')]['find'](_0x4b030d)[_0xcf6d('0x22')](handleEntityNotFound(_0x240827,null))[_0xcf6d('0x22')](respondWithResult(_0x240827,null))[_0xcf6d('0x2b')](handleError(_0x240827,null));};exports['create']=function(_0x3ae5e3,_0x56f5f0){return db[_0xcf6d('0x3b')][_0xcf6d('0x55')](_0x3ae5e3[_0xcf6d('0x56')],{})[_0xcf6d('0x22')](respondWithResult(_0x56f5f0,0xc9))[_0xcf6d('0x2b')](handleError(_0x56f5f0,null));};exports[_0xcf6d('0x35')]=function(_0x48b6db,_0x482d8f){if(_0x48b6db[_0xcf6d('0x56')]['id']){delete _0x48b6db[_0xcf6d('0x56')]['id'];}return db['SugarcrmAccount'][_0xcf6d('0x57')]({'where':{'id':_0x48b6db[_0xcf6d('0x52')]['id']}})[_0xcf6d('0x22')](handleEntityNotFound(_0x482d8f,null))[_0xcf6d('0x22')](saveUpdates(_0x48b6db[_0xcf6d('0x56')],null))[_0xcf6d('0x22')](respondWithResult(_0x482d8f,null))['catch'](handleError(_0x482d8f,null));};exports[_0xcf6d('0x58')]=function(_0x206ad4,_0x32c1d1){return db['SugarcrmAccount'][_0xcf6d('0x57')]({'where':{'id':_0x206ad4['params']['id']}})['then'](handleEntityNotFound(_0x32c1d1,null))[_0xcf6d('0x22')](removeEntity(_0x32c1d1,null))[_0xcf6d('0x2b')](handleError(_0x32c1d1,null));};exports['getConfigurations']=function(_0x54aa7e,_0x3dd74e,_0x5ef25f){var _0x2ecb7c={};var _0xe2e2eb={};var _0x5dc4d7;var _0x1db641;return db[_0xcf6d('0x3b')][_0xcf6d('0x59')]({'where':{'id':_0x54aa7e['params']['id']}})[_0xcf6d('0x22')](handleEntityNotFound(_0x3dd74e,null))['then'](function(_0x5da00e){if(_0x5da00e){_0x5dc4d7=_0x5da00e;_0xe2e2eb['model']=_[_0xcf6d('0x42')](db[_0xcf6d('0x5a')][_0xcf6d('0x3c')]);_0xe2e2eb['query']=_[_0xcf6d('0x42')](_0x54aa7e[_0xcf6d('0x41')]);_0xe2e2eb['filters']=_['intersection'](_0xe2e2eb['model'],_0xe2e2eb[_0xcf6d('0x41')]);_0x2ecb7c['attributes']=_[_0xcf6d('0x44')](_0xe2e2eb[_0xcf6d('0x40')],qs['fields'](_0x54aa7e[_0xcf6d('0x41')][_0xcf6d('0x53')]));_0x2ecb7c['attributes']=_0x2ecb7c[_0xcf6d('0x45')][_0xcf6d('0x54')]?_0x2ecb7c[_0xcf6d('0x45')]:_0xe2e2eb['model'];_0x2ecb7c[_0xcf6d('0x46')]=qs['sort'](_0x54aa7e['query'][_0xcf6d('0x47')]);_0x2ecb7c[_0xcf6d('0x48')]=qs[_0xcf6d('0x43')](_[_0xcf6d('0x49')](_0x54aa7e[_0xcf6d('0x41')],_0xe2e2eb[_0xcf6d('0x43')]));if(_0x54aa7e[_0xcf6d('0x41')][_0xcf6d('0x4a')]){_0x2ecb7c['where']=_[_0xcf6d('0x4c')](_0x2ecb7c[_0xcf6d('0x48')],{'$or':_[_0xcf6d('0x3a')](_0x2ecb7c[_0xcf6d('0x45')],function(_0x1fb45d){var _0x1acfc3={};_0x1acfc3[_0x1fb45d]={'$like':'%'+_0x54aa7e['query']['filter']+'%'};return _0x1acfc3;})});}_0x2ecb7c=_[_0xcf6d('0x4c')]({},_0x2ecb7c,_0x54aa7e[_0xcf6d('0x4d')]);return _0x5dc4d7[_0xcf6d('0x5b')](_0x2ecb7c);}})['then'](function(_0x34f4ab){if(_0x34f4ab){_0x1db641=_0x34f4ab[_0xcf6d('0x54')];if(!_0x54aa7e['query'][_0xcf6d('0x5c')](_0xcf6d('0x5d'))){_0x2ecb7c[_0xcf6d('0x30')]=qs[_0xcf6d('0x30')](_0x54aa7e['query']['limit']);_0x2ecb7c['offset']=qs[_0xcf6d('0x2f')](_0x54aa7e[_0xcf6d('0x41')][_0xcf6d('0x2f')]);}return _0x5dc4d7[_0xcf6d('0x5b')](_0x2ecb7c);}})['then'](function(_0x520f9f){if(_0x520f9f){return _0x520f9f?{'count':_0x1db641,'rows':_0x520f9f}:null;}})['then'](respondWithResult(_0x3dd74e,null))[_0xcf6d('0x2b')](handleError(_0x3dd74e,null));};exports[_0xcf6d('0x5e')]=function(_0x77cc2f,_0x505dc5,_0xa0f502){if(_0x77cc2f[_0xcf6d('0x56')]['id']){delete _0x77cc2f['body']['id'];}return db[_0xcf6d('0x3b')][_0xcf6d('0x59')]({'where':{'id':_0x77cc2f['params']['id']}})[_0xcf6d('0x22')](handleEntityNotFound(_0x505dc5,null))['then'](function(_0x4dc831){if(_0x4dc831){_0x77cc2f[_0xcf6d('0x56')][_0xcf6d('0x5f')]=_0x4dc831['id'];_0x77cc2f[_0xcf6d('0x56')][_0xcf6d('0x60')]=integrations[_0xcf6d('0x61')](_0x77cc2f[_0xcf6d('0x56')][_0xcf6d('0x62')],_0x77cc2f[_0xcf6d('0x56')][_0xcf6d('0x3e')]);_0x77cc2f['body'][_0xcf6d('0x63')]=integrations[_0xcf6d('0x64')](_0x77cc2f[_0xcf6d('0x56')][_0xcf6d('0x62')],_0x77cc2f[_0xcf6d('0x56')]['type']);return db[_0xcf6d('0x5a')][_0xcf6d('0x55')](_0x77cc2f[_0xcf6d('0x56')],{'include':[{'model':db[_0xcf6d('0x65')],'as':_0xcf6d('0x60')},{'model':db[_0xcf6d('0x65')],'as':_0xcf6d('0x63')}]});}return null;})[_0xcf6d('0x22')](respondWithResult(_0x505dc5,null))[_0xcf6d('0x2b')](handleError(_0x505dc5,null));};exports[_0xcf6d('0x66')]=function(_0x5084b8,_0x1e1372,_0x3d6a0b){var _0x44fd9a='';var _0x32a9b8=['id','name',_0xcf6d('0x67'),_0xcf6d('0x68'),_0xcf6d('0x69'),_0xcf6d('0x6a'),'duration_hours',_0xcf6d('0x6b'),'parent_id','parent_type','parent_name',_0xcf6d('0x6c')];return db[_0xcf6d('0x3b')][_0xcf6d('0x59')]({'where':{'id':_0x5084b8[_0xcf6d('0x52')]['id']},'attributes':['id',_0xcf6d('0x6d'),_0xcf6d('0x6e'),_0xcf6d('0x6f')]})[_0xcf6d('0x22')](handleEntityNotFound(_0x1e1372,null))['then'](function(_0x33f34f){if(_0x33f34f){_0x44fd9a=_0x33f34f[_0xcf6d('0x6f')];var _0x422b54=_0x44fd9a['slice'](-0x1);if(_0x422b54==='/'){_0x44fd9a=_0x44fd9a['substring'](0x0,_0x44fd9a['lastIndexOf'](_0x422b54));}return rp({'method':'POST','uri':util[_0xcf6d('0x70')]('%s%s',_0x44fd9a,_0xcf6d('0x71')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xcf6d('0x25')]({'user_auth':{'user_name':_0x33f34f[_0xcf6d('0x6d')],'password':_0x33f34f[_0xcf6d('0x6e')],'encryption':_0xcf6d('0x72')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xcf6d('0x22')](function(_0x5b1fe0){if(_0x5b1fe0&&_0x5b1fe0['name']!==_0xcf6d('0x73')&&_0x5b1fe0[_0xcf6d('0x38')]!==_0xcf6d('0x74')){return rp({'method':_0xcf6d('0x75'),'uri':util[_0xcf6d('0x70')](_0xcf6d('0x76'),_0x44fd9a,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0xcf6d('0x77'),'response_type':'JSON','rest_data':JSON[_0xcf6d('0x25')]({'session':_0x5b1fe0['id'],'module_name':'Calls'})}})[_0xcf6d('0x22')](function(_0xf51670){if(_0xf51670){var _0x5dbd8e=_[_0xcf6d('0x78')](_0xf51670[_0xcf6d('0x79')]);_[_0xcf6d('0x7a')](_0x5dbd8e,function(_0x2b8053){return _0x32a9b8[_0xcf6d('0x7b')](_0x2b8053[_0xcf6d('0x38')]);});return{'count':_0x5dbd8e[_0xcf6d('0x54')],'rows':_['map'](_0x5dbd8e,function(_0x251119){return{'id':_0x251119['name'],'name':_0x251119[_0xcf6d('0x7c')],'custom':_['endsWith'](_0x251119[_0xcf6d('0x38')],'_c')?!![]:![],'options':_0x251119[_0xcf6d('0x4d')]?_[_0xcf6d('0x3a')](_[_0xcf6d('0x78')](_0x251119['options']),function(_0x4a6bf4){return{'name':_0x4a6bf4[_0xcf6d('0x7d')],'value':_0x4a6bf4[_0xcf6d('0x38')]};}):[]};})};}})[_0xcf6d('0x22')](respondWithResult(_0x1e1372,null))[_0xcf6d('0x2b')](function(_0x21c238){var _0x585a2c=_0x5084b8[_0xcf6d('0x41')][_0xcf6d('0x1d')]?0x1f4:_0x21c238[_0xcf6d('0x7e')]||0x1f4;logger[_0xcf6d('0x26')](_0xcf6d('0x7f'),'getFields',_0x585a2c,JSON['stringify'](_0x21c238));delete _0x21c238[_0xcf6d('0x38')];if(_0x585a2c===0x191){_0x585a2c=0x190;}_0x1e1372['status'](_0x585a2c)[_0xcf6d('0x39')](_0x5084b8[_0xcf6d('0x41')][_0xcf6d('0x1d')]?{'message':_0xcf6d('0x80'),'statusCode':_0x21c238['statusCode']}:_0x21c238);});}else{var _0x17898b=0x1f4;_0x1e1372['status'](_0x17898b)[_0xcf6d('0x39')]({'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 1efe2e8..10e9e96 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 _0x0b9e=['request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','moment'];(function(_0x177452,_0x76dd98){var _0x4e41fa=function(_0x5826bc){while(--_0x5826bc){_0x177452['push'](_0x177452['shift']());}};_0x4e41fa(++_0x76dd98);}(_0x0b9e,0xcc));var _0xe0b9=function(_0x16402f,_0x400de4){_0x16402f=_0x16402f-0x0;var _0x3934eb=_0x0b9e[_0x16402f];return _0x3934eb;};'use strict';var _=require('lodash');var util=require(_0xe0b9('0x0'));var logger=require(_0xe0b9('0x1'))(_0xe0b9('0x2'));var moment=require(_0xe0b9('0x3'));var BPromise=require('bluebird');var rp=require(_0xe0b9('0x4'));var fs=require('fs');var path=require(_0xe0b9('0x5'));var rimraf=require(_0xe0b9('0x6'));var config=require(_0xe0b9('0x7'));var attributes=require(_0xe0b9('0x8'));var integrations=require(_0xe0b9('0x9'));module['exports']=function(_0x3f4389,_0x3d30bf){return _0x3f4389[_0xe0b9('0xa')](_0xe0b9('0xb'),attributes,{'tableName':_0xe0b9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e94=['moment','path','rimraf','../../config/environment','exports','define','SugarcrmAccount','lodash','util','../../config/logger'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0x4e94,0x101));var _0x44e9=function(_0x5c0979,_0x287854){_0x5c0979=_0x5c0979-0x0;var _0x309972=_0x4e94[_0x5c0979];return _0x309972;};'use strict';var _=require(_0x44e9('0x0'));var util=require(_0x44e9('0x1'));var logger=require(_0x44e9('0x2'))('api');var moment=require(_0x44e9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44e9('0x4'));var rimraf=require(_0x44e9('0x5'));var config=require(_0x44e9('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x44e9('0x7')]=function(_0x1236dc,_0x37ba76){return _0x1236dc[_0x44e9('0x8')](_0x44e9('0x9'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index d5f602e..08ee6a2 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 _0x979f=['GetSugarcrmAccount','findAll','raw','options','where','attributes','limit','include','map','model','debug','ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x5106c1,_0x13233a){var _0x5bcaac=function(_0x18c12e){while(--_0x18c12e){_0x5106c1['push'](_0x5106c1['shift']());}};_0x5bcaac(++_0x13233a);}(_0x979f,0x18f));var _0xf979=function(_0x19be86,_0x301d1c){_0x19be86=_0x19be86-0x0;var _0x5228bf=_0x979f[_0x19be86];return _0x5228bf;};'use strict';var _=require(_0xf979('0x0'));var util=require(_0xf979('0x1'));var moment=require(_0xf979('0x2'));var BPromise=require(_0xf979('0x3'));var rs=require(_0xf979('0x4'));var fs=require('fs');var Redis=require(_0xf979('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf979('0x6'))(_0xf979('0x7'));var config=require('../../config/environment');var jayson=require(_0xf979('0x8'));var client=jayson[_0xf979('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd364,_0x21ab9c,_0x3dffe5){return new BPromise(function(_0x546548,_0x43551c){return client[_0xf979('0xa')](_0x2fd364,_0x3dffe5)[_0xf979('0xb')](function(_0x279136){logger[_0xf979('0xc')](_0xf979('0xd'),_0x21ab9c,_0xf979('0xe'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x21ab9c,_0xf979('0xe'),JSON[_0xf979('0xf')](_0x279136));if(_0x279136[_0xf979('0x10')]){if(_0x279136[_0xf979('0x10')][_0xf979('0x11')]===0x1f4){logger['error'](_0xf979('0xd'),_0x21ab9c,_0x279136[_0xf979('0x10')][_0xf979('0x12')]);return _0x43551c(_0x279136[_0xf979('0x10')]['message']);}logger['error'](_0xf979('0xd'),_0x21ab9c,_0x279136[_0xf979('0x10')][_0xf979('0x12')]);return _0x546548(_0x279136[_0xf979('0x10')]['message']);}else{logger[_0xf979('0xc')](_0xf979('0xd'),_0x21ab9c,_0xf979('0xe'));_0x546548(_0x279136[_0xf979('0x13')][_0xf979('0x12')]);}})[_0xf979('0x14')](function(_0x4a4025){logger[_0xf979('0x10')](_0xf979('0xd'),_0x21ab9c,_0x4a4025);_0x43551c(_0x4a4025);});});}exports[_0xf979('0x15')]=function(_0x544c55){var _0x9d820c=this;return new Promise(function(_0x23e973,_0x859d2b){return db['SugarcrmAccount'][_0xf979('0x16')]({'raw':_0x544c55['options']?_0x544c55['options'][_0xf979('0x17')]===undefined?!![]:![]:!![],'where':_0x544c55[_0xf979('0x18')]?_0x544c55[_0xf979('0x18')][_0xf979('0x19')]||null:null,'attributes':_0x544c55[_0xf979('0x18')]?_0x544c55[_0xf979('0x18')][_0xf979('0x1a')]||null:null,'limit':_0x544c55[_0xf979('0x18')]?_0x544c55[_0xf979('0x18')][_0xf979('0x1b')]||null:null,'include':_0x544c55[_0xf979('0x18')]?_0x544c55[_0xf979('0x18')][_0xf979('0x1c')]?_[_0xf979('0x1d')](_0x544c55[_0xf979('0x18')][_0xf979('0x1c')],function(_0x5b633d){return{'model':db[_0x5b633d[_0xf979('0x1e')]],'as':_0x5b633d['as'],'attributes':_0x5b633d[_0xf979('0x1a')],'include':_0x5b633d['include']?_[_0xf979('0x1d')](_0x5b633d[_0xf979('0x1c')],function(_0x492e24){return{'model':db[_0x492e24[_0xf979('0x1e')]],'as':_0x492e24['as'],'attributes':_0x492e24[_0xf979('0x1a')],'include':_0x492e24[_0xf979('0x1c')]?_[_0xf979('0x1d')](_0x492e24['include'],function(_0x229aea){return{'model':db[_0x229aea[_0xf979('0x1e')]],'as':_0x229aea['as'],'attributes':_0x229aea[_0xf979('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf979('0xb')](function(_0x16df84){logger[_0xf979('0xc')](_0xf979('0x15'),_0x544c55);logger[_0xf979('0x1f')]('GetSugarcrmAccount',_0x544c55,JSON['stringify'](_0x16df84));_0x23e973(_0x16df84);})[_0xf979('0x14')](function(_0x3b2a93){logger[_0xf979('0x10')]('GetSugarcrmAccount',_0x3b2a93[_0xf979('0x12')],_0x544c55);_0x859d2b(_0x9d820c[_0xf979('0x10')](0x1f4,_0x3b2a93[_0xf979('0x12')]));});});};exports[_0xf979('0x20')]=function(_0x75b327){var _0x22f7b5=this;return new Promise(function(_0x128ba0,_0x5528e0){return db[_0xf979('0x21')][_0xf979('0x22')]({'raw':_0x75b327[_0xf979('0x18')]?_0x75b327['options'][_0xf979('0x17')]===undefined?!![]:![]:!![],'where':_0x75b327[_0xf979('0x18')]?_0x75b327[_0xf979('0x18')][_0xf979('0x19')]||null:null,'attributes':_0x75b327[_0xf979('0x18')]?_0x75b327[_0xf979('0x18')][_0xf979('0x1a')]||null:null,'include':_0x75b327[_0xf979('0x18')]?_0x75b327[_0xf979('0x18')][_0xf979('0x1c')]?_['map'](_0x75b327[_0xf979('0x18')]['include'],function(_0x470a8c){return{'model':db[_0x470a8c[_0xf979('0x1e')]],'as':_0x470a8c['as'],'attributes':_0x470a8c['attributes'],'include':_0x470a8c[_0xf979('0x1c')]?_['map'](_0x470a8c[_0xf979('0x1c')],function(_0x5c4b69){return{'model':db[_0x5c4b69['model']],'as':_0x5c4b69['as'],'attributes':_0x5c4b69['attributes'],'include':_0x5c4b69[_0xf979('0x1c')]?_['map'](_0x5c4b69[_0xf979('0x1c')],function(_0x45048b){return{'model':db[_0x45048b[_0xf979('0x1e')]],'as':_0x45048b['as'],'attributes':_0x45048b[_0xf979('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50420f){logger[_0xf979('0xc')](_0xf979('0x20'),_0x75b327);logger[_0xf979('0x1f')](_0xf979('0x20'),_0x75b327,JSON[_0xf979('0xf')](_0x50420f));_0x128ba0(_0x50420f);})[_0xf979('0x14')](function(_0x158cab){logger[_0xf979('0x10')]('ShowSugarcrmAccount',_0x158cab[_0xf979('0x12')],_0x75b327);_0x5528e0(_0x22f7b5[_0xf979('0x10')](0x1f4,_0x158cab[_0xf979('0x12')]));});});}; \ No newline at end of file +var _0xb9e4=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','map','model','debug','find','ShowSugarcrmAccount','util'];(function(_0x2ef573,_0x273e5f){var _0x52d12b=function(_0x4577f1){while(--_0x4577f1){_0x2ef573['push'](_0x2ef573['shift']());}};_0x52d12b(++_0x273e5f);}(_0xb9e4,0x143));var _0x4b9e=function(_0x40f08b,_0x2acb09){_0x40f08b=_0x40f08b-0x0;var _0x2416ee=_0xb9e4[_0x40f08b];return _0x2416ee;};'use strict';var _=require('lodash');var util=require(_0x4b9e('0x0'));var moment=require(_0x4b9e('0x1'));var BPromise=require(_0x4b9e('0x2'));var rs=require(_0x4b9e('0x3'));var fs=require('fs');var Redis=require(_0x4b9e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4b9e('0x5'));var logger=require(_0x4b9e('0x6'))(_0x4b9e('0x7'));var config=require(_0x4b9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4b9e('0x9')][_0x4b9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56873c,_0x4b0f2a,_0x803955){return new BPromise(function(_0x3d89d2,_0x5e14c7){return client[_0x4b9e('0xb')](_0x56873c,_0x803955)[_0x4b9e('0xc')](function(_0x431a1e){logger[_0x4b9e('0xd')](_0x4b9e('0xe'),_0x4b0f2a,_0x4b9e('0xf'));logger['debug'](_0x4b9e('0x10'),_0x4b0f2a,_0x4b9e('0xf'),JSON[_0x4b9e('0x11')](_0x431a1e));if(_0x431a1e[_0x4b9e('0x12')]){if(_0x431a1e[_0x4b9e('0x12')][_0x4b9e('0x13')]===0x1f4){logger[_0x4b9e('0x12')](_0x4b9e('0xe'),_0x4b0f2a,_0x431a1e['error'][_0x4b9e('0x14')]);return _0x5e14c7(_0x431a1e[_0x4b9e('0x12')][_0x4b9e('0x14')]);}logger[_0x4b9e('0x12')](_0x4b9e('0xe'),_0x4b0f2a,_0x431a1e[_0x4b9e('0x12')][_0x4b9e('0x14')]);return _0x3d89d2(_0x431a1e[_0x4b9e('0x12')][_0x4b9e('0x14')]);}else{logger[_0x4b9e('0xd')](_0x4b9e('0xe'),_0x4b0f2a,_0x4b9e('0xf'));_0x3d89d2(_0x431a1e[_0x4b9e('0x15')]['message']);}})[_0x4b9e('0x16')](function(_0x2c3a61){logger['error'](_0x4b9e('0xe'),_0x4b0f2a,_0x2c3a61);_0x5e14c7(_0x2c3a61);});});}exports[_0x4b9e('0x17')]=function(_0x18b8ce){var _0x491d72=this;return new Promise(function(_0x4a6bcf,_0x2b11b9){return db[_0x4b9e('0x18')][_0x4b9e('0x19')]({'raw':_0x18b8ce[_0x4b9e('0x1a')]?_0x18b8ce[_0x4b9e('0x1a')][_0x4b9e('0x1b')]===undefined?!![]:![]:!![],'where':_0x18b8ce[_0x4b9e('0x1a')]?_0x18b8ce[_0x4b9e('0x1a')][_0x4b9e('0x1c')]||null:null,'attributes':_0x18b8ce[_0x4b9e('0x1a')]?_0x18b8ce[_0x4b9e('0x1a')][_0x4b9e('0x1d')]||null:null,'limit':_0x18b8ce[_0x4b9e('0x1a')]?_0x18b8ce['options']['limit']||null:null,'include':_0x18b8ce[_0x4b9e('0x1a')]?_0x18b8ce[_0x4b9e('0x1a')][_0x4b9e('0x1e')]?_[_0x4b9e('0x1f')](_0x18b8ce[_0x4b9e('0x1a')]['include'],function(_0x2745bc){return{'model':db[_0x2745bc[_0x4b9e('0x20')]],'as':_0x2745bc['as'],'attributes':_0x2745bc[_0x4b9e('0x1d')],'include':_0x2745bc[_0x4b9e('0x1e')]?_['map'](_0x2745bc[_0x4b9e('0x1e')],function(_0x4d7ed7){return{'model':db[_0x4d7ed7['model']],'as':_0x4d7ed7['as'],'attributes':_0x4d7ed7['attributes'],'include':_0x4d7ed7[_0x4b9e('0x1e')]?_['map'](_0x4d7ed7[_0x4b9e('0x1e')],function(_0x413c97){return{'model':db[_0x413c97[_0x4b9e('0x20')]],'as':_0x413c97['as'],'attributes':_0x413c97[_0x4b9e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4b9e('0xc')](function(_0xcf503a){logger['info']('GetSugarcrmAccount',_0x18b8ce);logger[_0x4b9e('0x21')](_0x4b9e('0x17'),_0x18b8ce,JSON[_0x4b9e('0x11')](_0xcf503a));_0x4a6bcf(_0xcf503a);})['catch'](function(_0x506a0d){logger[_0x4b9e('0x12')]('GetSugarcrmAccount',_0x506a0d['message'],_0x18b8ce);_0x2b11b9(_0x491d72[_0x4b9e('0x12')](0x1f4,_0x506a0d[_0x4b9e('0x14')]));});});};exports['ShowSugarcrmAccount']=function(_0x50e3d5){var _0x3ab857=this;return new Promise(function(_0x5085ba,_0xfffb80){return db['SugarcrmAccount'][_0x4b9e('0x22')]({'raw':_0x50e3d5['options']?_0x50e3d5[_0x4b9e('0x1a')][_0x4b9e('0x1b')]===undefined?!![]:![]:!![],'where':_0x50e3d5[_0x4b9e('0x1a')]?_0x50e3d5[_0x4b9e('0x1a')]['where']||null:null,'attributes':_0x50e3d5[_0x4b9e('0x1a')]?_0x50e3d5['options'][_0x4b9e('0x1d')]||null:null,'include':_0x50e3d5[_0x4b9e('0x1a')]?_0x50e3d5[_0x4b9e('0x1a')][_0x4b9e('0x1e')]?_[_0x4b9e('0x1f')](_0x50e3d5[_0x4b9e('0x1a')][_0x4b9e('0x1e')],function(_0x2e28cd){return{'model':db[_0x2e28cd[_0x4b9e('0x20')]],'as':_0x2e28cd['as'],'attributes':_0x2e28cd['attributes'],'include':_0x2e28cd[_0x4b9e('0x1e')]?_[_0x4b9e('0x1f')](_0x2e28cd[_0x4b9e('0x1e')],function(_0x23bcd9){return{'model':db[_0x23bcd9[_0x4b9e('0x20')]],'as':_0x23bcd9['as'],'attributes':_0x23bcd9[_0x4b9e('0x1d')],'include':_0x23bcd9[_0x4b9e('0x1e')]?_[_0x4b9e('0x1f')](_0x23bcd9['include'],function(_0x5a830b){return{'model':db[_0x5a830b[_0x4b9e('0x20')]],'as':_0x5a830b['as'],'attributes':_0x5a830b[_0x4b9e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4b9e('0xc')](function(_0x391c91){logger[_0x4b9e('0xd')]('ShowSugarcrmAccount',_0x50e3d5);logger['debug'](_0x4b9e('0x23'),_0x50e3d5,JSON[_0x4b9e('0x11')](_0x391c91));_0x5085ba(_0x391c91);})[_0x4b9e('0x16')](function(_0x4afd5b){logger[_0x4b9e('0x12')]('ShowSugarcrmAccount',_0x4afd5b[_0x4b9e('0x14')],_0x50e3d5);_0xfffb80(_0x3ab857[_0x4b9e('0x12')](0x1f4,_0x4afd5b['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 0c01d4d..bdf8284 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 _0xc97d=['./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c5202,_0x5bc415){var _0xae684b=function(_0x3b2c80){while(--_0x3b2c80){_0x1c5202['push'](_0x1c5202['shift']());}};_0xae684b(++_0x5bc415);}(_0xc97d,0x12c));var _0xdc97=function(_0x29f8d3,_0x1de56a){_0x29f8d3=_0x29f8d3-0x0;var _0x515da2=_0xc97d[_0x29f8d3];return _0x515da2;};'use strict';var multer=require('multer');var util=require(_0xdc97('0x0'));var path=require(_0xdc97('0x1'));var timeout=require(_0xdc97('0x2'));var express=require(_0xdc97('0x3'));var router=express[_0xdc97('0x4')]();var auth=require(_0xdc97('0x5'));var interaction=require(_0xdc97('0x6'));var config=require(_0xdc97('0x7'));var controller=require(_0xdc97('0x8'));router[_0xdc97('0x9')]('/',auth[_0xdc97('0xa')](),controller[_0xdc97('0xb')]);router[_0xdc97('0x9')](_0xdc97('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xdc97('0x9')](_0xdc97('0xd'),auth[_0xdc97('0xa')](),controller[_0xdc97('0xe')]);router[_0xdc97('0x9')](_0xdc97('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xdc97('0x9')](_0xdc97('0x10'),auth[_0xdc97('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0xdc97('0xa')](),controller[_0xdc97('0x11')]);router[_0xdc97('0x12')]('/:id',auth[_0xdc97('0xa')](),controller[_0xdc97('0x13')]);router[_0xdc97('0x14')](_0xdc97('0xc'),auth[_0xdc97('0xa')](),controller['destroy']);module[_0xdc97('0x15')]=router; \ No newline at end of file +var _0x9991=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields'];(function(_0xdb8c35,_0x49387e){var _0x3636f6=function(_0x30e5e8){while(--_0x30e5e8){_0xdb8c35['push'](_0xdb8c35['shift']());}};_0x3636f6(++_0x49387e);}(_0x9991,0x155));var _0x1999=function(_0x116daa,_0x492358){_0x116daa=_0x116daa-0x0;var _0x57b035=_0x9991[_0x116daa];return _0x57b035;};'use strict';var multer=require('multer');var util=require(_0x1999('0x0'));var path=require('path');var timeout=require(_0x1999('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x1999('0x2'));var interaction=require(_0x1999('0x3'));var config=require('../../config/environment');var controller=require(_0x1999('0x4'));router['get']('/',auth[_0x1999('0x5')](),controller[_0x1999('0x6')]);router[_0x1999('0x7')](_0x1999('0x8'),auth[_0x1999('0x5')](),controller[_0x1999('0x9')]);router[_0x1999('0x7')](_0x1999('0xa'),auth['isAuthenticated'](),controller[_0x1999('0xb')]);router[_0x1999('0x7')](_0x1999('0xc'),auth[_0x1999('0x5')](),controller[_0x1999('0xd')]);router[_0x1999('0x7')](_0x1999('0xe'),auth[_0x1999('0x5')](),controller[_0x1999('0xf')]);router[_0x1999('0x10')]('/',auth[_0x1999('0x5')](),controller[_0x1999('0x11')]);router[_0x1999('0x12')](_0x1999('0x8'),auth['isAuthenticated'](),controller[_0x1999('0x13')]);router[_0x1999('0x14')](_0x1999('0x8'),auth[_0x1999('0x5')](),controller[_0x1999('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 5e8d283..97ec3d0 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 _0xbb9f=['STRING','sequelize'];(function(_0x266a58,_0x1e7591){var _0x2d3af5=function(_0x2e099e){while(--_0x2e099e){_0x266a58['push'](_0x266a58['shift']());}};_0x2d3af5(++_0x1e7591);}(_0xbb9f,0xb1));var _0xfbb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb9f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfbb9('0x0'));module['exports']={'name':{'type':Sequelize[_0xfbb9('0x1')]},'description':{'type':Sequelize[_0xfbb9('0x1')]}}; \ No newline at end of file +var _0x1686=['sequelize','exports','STRING'];(function(_0x5e7b0d,_0x141a25){var _0x45ed4b=function(_0x28b2fb){while(--_0x28b2fb){_0x5e7b0d['push'](_0x5e7b0d['shift']());}};_0x45ed4b(++_0x141a25);}(_0x1686,0x1bc));var _0x6168=function(_0x3909ad,_0x371de0){_0x3909ad=_0x3909ad-0x0;var _0x4e1df3=_0x1686[_0x3909ad];return _0x4e1df3;};'use strict';var Sequelize=require(_0x6168('0x0'));module[_0x6168('0x1')]={'name':{'type':Sequelize[_0x6168('0x2')]},'description':{'type':Sequelize[_0x6168('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 4c5c65b..c89eedc 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 _0x963e=['intersection','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','SugarcrmConfiguration','includeAll','include','params','options','create','body','find','findOne','SugarcrmField','order','getFields','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes'];(function(_0x49d95f,_0x44481a){var _0x3768fb=function(_0x8059fe){while(--_0x8059fe){_0x49d95f['push'](_0x49d95f['shift']());}};_0x3768fb(++_0x44481a);}(_0x963e,0x74));var _0xe963=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0x963e[_0x2f4c1c];return _0x25e0f2;};'use strict';var pdf=require(_0xe963('0x0'));var emlformat=require(_0xe963('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe963('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe963('0x3'));var moment=require(_0xe963('0x4'));var BPromise=require(_0xe963('0x5'));var Mustache=require(_0xe963('0x6'));var util=require(_0xe963('0x7'));var path=require(_0xe963('0x8'));var sox=require(_0xe963('0x9'));var csv=require('to-csv');var ejs=require(_0xe963('0xa'));var fs=require('fs');var _=require(_0xe963('0xb'));var squel=require(_0xe963('0xc'));var crypto=require(_0xe963('0xd'));var jsforce=require(_0xe963('0xe'));var deskjs=require(_0xe963('0xf'));var toCsv=require(_0xe963('0x10'));var querystring=require('querystring');var Papa=require(_0xe963('0x11'));var Redis=require(_0xe963('0x12'));var authService=require(_0xe963('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe963('0x14'));var utils=require(_0xe963('0x15'));var config=require(_0xe963('0x16'));var db=require(_0xe963('0x17'))['db'];var jayson=require(_0xe963('0x18'));var client=jayson[_0xe963('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x59fc9b,_0xa92bed,_0x3d202b){if(_0x3d202b){var _0x41cfd3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41cfd3['test'](_0xa92bed)){return _0x59fc9b;}else{throw new db['Sequelize'][(_0xe963('0x1a'))](_0xe963('0x1b'));}}else{return _0x59fc9b;}}function respondWithRpcPromise(_0xdd0f36,_0x19bec7,_0x521711,_0x50cf0e){return new BPromise(function(_0x257eb2,_0x5b6c93){var _0x523448=_0x50cf0e||client;return _0x523448[_0xe963('0x1c')](_0xdd0f36,_0x521711)[_0xe963('0x1d')](function(_0x3b499b){logger[_0xe963('0x1e')](_0xe963('0x1f'),_0x19bec7,_0xe963('0x20'));logger[_0xe963('0x21')](_0xe963('0x22'),_0x19bec7,'request\x20sent',JSON[_0xe963('0x23')](_0x3b499b));if(_0x3b499b[_0xe963('0x24')]){if(_0x3b499b['error'][_0xe963('0x25')]===0x1f4){logger[_0xe963('0x24')](_0xe963('0x1f'),_0x19bec7,_0x3b499b[_0xe963('0x24')][_0xe963('0x26')]);return _0x5b6c93(_0x3b499b[_0xe963('0x24')]['message']);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x19bec7,_0x3b499b[_0xe963('0x24')][_0xe963('0x26')]);return _0x257eb2(_0x3b499b[_0xe963('0x24')][_0xe963('0x26')]);}else{logger['info'](_0xe963('0x1f'),_0x19bec7,_0xe963('0x20'));_0x257eb2(_0x3b499b['result'][_0xe963('0x26')]);}})[_0xe963('0x27')](function(_0x2fea00){logger[_0xe963('0x24')](_0xe963('0x1f'),_0x19bec7,_0x2fea00);_0x5b6c93(_0x2fea00);});});}function respondWithStatusCode(_0x2ee5a0,_0x39719c){_0x39719c=_0x39719c||0xcc;return function(_0x5852fd){if(_0x5852fd){return _0x2ee5a0[_0xe963('0x28')](_0x39719c);}return _0x2ee5a0[_0xe963('0x29')](_0x39719c)['end']();};}function respondWithResult(_0x52345a,_0x5327d0){_0x5327d0=_0x5327d0||0xc8;return function(_0x583c0d){if(_0x583c0d){return _0x52345a[_0xe963('0x29')](_0x5327d0)['json'](_0x583c0d);}};}function respondWithFilteredResult(_0x3672fe,_0x2cea89){return function(_0x599169){if(_0x599169){var _0x23ce3a=_0x599169[_0xe963('0x2a')],_0x5a8cc1=_0x2cea89[_0xe963('0x2b')],_0x1654ca=_0x2cea89[_0xe963('0x2b')]+_0x2cea89[_0xe963('0x2c')],_0x22ede4;if(_0x1654ca>=_0x23ce3a){_0x1654ca=_0x23ce3a;_0x22ede4=0xc8;}else{_0x22ede4=0xce;}_0x3672fe['status'](_0x22ede4);return _0x3672fe[_0xe963('0x2d')](_0xe963('0x2e'),_0x5a8cc1+'-'+_0x1654ca+'/'+_0x23ce3a)[_0xe963('0x2f')](_0x599169);}return null;};}function patchUpdates(_0x5dadca){return function(_0x5513ea){try{jsonpatch[_0xe963('0x30')](_0x5513ea,_0x5dadca,!![]);}catch(_0xcbcb3b){return BPromise[_0xe963('0x31')](_0xcbcb3b);}return _0x5513ea[_0xe963('0x32')]();};}function saveUpdates(_0x5aad38,_0xbe2ab6){return function(_0x184f1c){if(_0x184f1c){return _0x184f1c[_0xe963('0x33')](_0x5aad38)[_0xe963('0x1d')](function(_0x16b40e){return _0x16b40e;});}return null;};}function removeEntity(_0x4b877b,_0x948f9){return function(_0x58acae){if(_0x58acae){return _0x58acae['destroy']()[_0xe963('0x1d')](function(){_0x4b877b['status'](0xcc)[_0xe963('0x34')]();});}};}function handleEntityNotFound(_0x4ce4cf,_0x355bf1){return function(_0x5ce1c0){if(!_0x5ce1c0){_0x4ce4cf[_0xe963('0x28')](0x194);}return _0x5ce1c0;};}function handleError(_0x4a4187,_0x21b20c){_0x21b20c=_0x21b20c||0x1f4;return function(_0x1f98d2){logger[_0xe963('0x24')](_0x1f98d2[_0xe963('0x35')]);if(_0x1f98d2[_0xe963('0x36')]){delete _0x1f98d2[_0xe963('0x36')];}_0x4a4187[_0xe963('0x29')](_0x21b20c)[_0xe963('0x37')](_0x1f98d2);};}exports[_0xe963('0x38')]=function(_0x3af05d,_0x2b161a){var _0x18002e={},_0x13775a={},_0x33450b={'count':0x0,'rows':[]};var _0x3aee65=_[_0xe963('0x39')](db['SugarcrmConfiguration'][_0xe963('0x3a')],function(_0x224c71){return{'name':_0x224c71[_0xe963('0x3b')],'type':_0x224c71['type'][_0xe963('0x3c')]};});_0x13775a[_0xe963('0x3d')]=_[_0xe963('0x39')](_0x3aee65,_0xe963('0x36'));_0x13775a[_0xe963('0x3e')]=_[_0xe963('0x3f')](_0x3af05d[_0xe963('0x3e')]);_0x13775a[_0xe963('0x40')]=_['intersection'](_0x13775a['model'],_0x13775a[_0xe963('0x3e')]);_0x18002e[_0xe963('0x41')]=_[_0xe963('0x42')](_0x13775a[_0xe963('0x3d')],qs[_0xe963('0x43')](_0x3af05d[_0xe963('0x3e')][_0xe963('0x43')]));_0x18002e[_0xe963('0x41')]=_0x18002e[_0xe963('0x41')][_0xe963('0x44')]?_0x18002e[_0xe963('0x41')]:_0x13775a[_0xe963('0x3d')];if(!_0x3af05d[_0xe963('0x3e')]['hasOwnProperty']('nolimit')){_0x18002e[_0xe963('0x2c')]=qs['limit'](_0x3af05d[_0xe963('0x3e')]['limit']);_0x18002e[_0xe963('0x2b')]=qs[_0xe963('0x2b')](_0x3af05d[_0xe963('0x3e')]['offset']);}_0x18002e['order']=qs[_0xe963('0x45')](_0x3af05d[_0xe963('0x3e')][_0xe963('0x45')]);_0x18002e[_0xe963('0x46')]=qs[_0xe963('0x40')](_[_0xe963('0x47')](_0x3af05d[_0xe963('0x3e')],_0x13775a[_0xe963('0x40')]));if(_0x3af05d['query'][_0xe963('0x48')]){_0x18002e[_0xe963('0x46')]=_[_0xe963('0x49')](_0x18002e[_0xe963('0x46')],{'$or':_[_0xe963('0x39')](_0x3aee65,function(_0x1bbaa4){if(_0x1bbaa4[_0xe963('0x4a')]!==_0xe963('0x4b')){var _0x200511={};_0x200511[_0x1bbaa4[_0xe963('0x36')]]={'$like':'%'+_0x3af05d[_0xe963('0x3e')][_0xe963('0x48')]+'%'};return _0x200511;}})});}_0x18002e=_[_0xe963('0x49')]({},_0x18002e,_0x3af05d['options']);var _0x32ac4d={'where':_0x18002e[_0xe963('0x46')]};return db[_0xe963('0x4c')][_0xe963('0x2a')](_0x32ac4d)[_0xe963('0x1d')](function(_0xf8daae){_0x33450b['count']=_0xf8daae;if(_0x3af05d[_0xe963('0x3e')][_0xe963('0x4d')]){_0x18002e[_0xe963('0x4e')]=[{'all':!![]}];}return db[_0xe963('0x4c')]['findAll'](_0x18002e);})[_0xe963('0x1d')](function(_0x2892ec){_0x33450b['rows']=_0x2892ec;return _0x33450b;})[_0xe963('0x1d')](respondWithFilteredResult(_0x2b161a,_0x18002e))[_0xe963('0x27')](handleError(_0x2b161a,null));};exports['show']=function(_0x421156,_0x48b007){var _0x5e6fef={'raw':![],'where':{'id':_0x421156[_0xe963('0x4f')]['id']}},_0x394878={};_0x394878[_0xe963('0x3d')]=_[_0xe963('0x3f')](db[_0xe963('0x4c')][_0xe963('0x3a')]);_0x394878[_0xe963('0x3e')]=_[_0xe963('0x3f')](_0x421156[_0xe963('0x3e')]);_0x394878['filters']=_[_0xe963('0x42')](_0x394878['model'],_0x394878[_0xe963('0x3e')]);_0x5e6fef[_0xe963('0x41')]=_['intersection'](_0x394878[_0xe963('0x3d')],qs[_0xe963('0x43')](_0x421156[_0xe963('0x3e')][_0xe963('0x43')]));_0x5e6fef['attributes']=_0x5e6fef['attributes'][_0xe963('0x44')]?_0x5e6fef[_0xe963('0x41')]:_0x394878['model'];if(_0x421156['query'][_0xe963('0x4d')]){_0x5e6fef[_0xe963('0x4e')]=[{'all':!![]}];}_0x5e6fef=_[_0xe963('0x49')]({},_0x5e6fef,_0x421156[_0xe963('0x50')]);return db[_0xe963('0x4c')]['find'](_0x5e6fef)[_0xe963('0x1d')](handleEntityNotFound(_0x48b007,null))['then'](respondWithResult(_0x48b007,null))[_0xe963('0x27')](handleError(_0x48b007,null));};exports[_0xe963('0x51')]=function(_0x18d460,_0x24a66d){return db['SugarcrmConfiguration'][_0xe963('0x51')](_0x18d460[_0xe963('0x52')],{})[_0xe963('0x1d')](respondWithResult(_0x24a66d,0xc9))[_0xe963('0x27')](handleError(_0x24a66d,null));};exports[_0xe963('0x33')]=function(_0x1c7561,_0x195f24){if(_0x1c7561[_0xe963('0x52')]['id']){delete _0x1c7561[_0xe963('0x52')]['id'];}return db[_0xe963('0x4c')][_0xe963('0x53')]({'where':{'id':_0x1c7561[_0xe963('0x4f')]['id']}})[_0xe963('0x1d')](handleEntityNotFound(_0x195f24,null))[_0xe963('0x1d')](saveUpdates(_0x1c7561[_0xe963('0x52')],null))[_0xe963('0x1d')](respondWithResult(_0x195f24,null))[_0xe963('0x27')](handleError(_0x195f24,null));};exports['destroy']=function(_0x3edfb2,_0x410352){return db[_0xe963('0x4c')][_0xe963('0x53')]({'where':{'id':_0x3edfb2[_0xe963('0x4f')]['id']}})['then'](handleEntityNotFound(_0x410352,null))[_0xe963('0x1d')](removeEntity(_0x410352,null))['catch'](handleError(_0x410352,null));};exports['getFields']=function(_0x33e264,_0x50da66,_0x2eab15){var _0x49876d={};var _0x3e09e7={};var _0x24962d;var _0x23ffa5;return db[_0xe963('0x4c')][_0xe963('0x54')]({'where':{'id':_0x33e264[_0xe963('0x4f')]['id']}})[_0xe963('0x1d')](handleEntityNotFound(_0x50da66,null))[_0xe963('0x1d')](function(_0x3a8b3c){if(_0x3a8b3c){_0x24962d=_0x3a8b3c;_0x3e09e7[_0xe963('0x3d')]=_[_0xe963('0x3f')](db[_0xe963('0x55')][_0xe963('0x3a')]);_0x3e09e7[_0xe963('0x3e')]=_[_0xe963('0x3f')](_0x33e264['query']);_0x3e09e7['filters']=_['intersection'](_0x3e09e7[_0xe963('0x3d')],_0x3e09e7[_0xe963('0x3e')]);_0x49876d[_0xe963('0x41')]=_[_0xe963('0x42')](_0x3e09e7[_0xe963('0x3d')],qs[_0xe963('0x43')](_0x33e264[_0xe963('0x3e')][_0xe963('0x43')]));_0x49876d[_0xe963('0x41')]=_0x49876d['attributes']['length']?_0x49876d[_0xe963('0x41')]:_0x3e09e7[_0xe963('0x3d')];_0x49876d[_0xe963('0x56')]=qs[_0xe963('0x45')](_0x33e264[_0xe963('0x3e')]['sort']);_0x49876d[_0xe963('0x46')]=qs[_0xe963('0x40')](_['pick'](_0x33e264['query'],_0x3e09e7[_0xe963('0x40')]));if(_0x33e264[_0xe963('0x3e')][_0xe963('0x48')]){_0x49876d['where']=_[_0xe963('0x49')](_0x49876d['where'],{'$or':_[_0xe963('0x39')](_0x49876d[_0xe963('0x41')],function(_0x1624e8){var _0x1767f4={};_0x1767f4[_0x1624e8]={'$like':'%'+_0x33e264['query'][_0xe963('0x48')]+'%'};return _0x1767f4;})});}_0x49876d=_[_0xe963('0x49')]({},_0x49876d,_0x33e264[_0xe963('0x50')]);return _0x24962d[_0xe963('0x57')](_0x49876d);}})[_0xe963('0x1d')](function(_0x59d8de){if(_0x59d8de){_0x23ffa5=_0x59d8de[_0xe963('0x44')];if(!_0x33e264['query']['hasOwnProperty'](_0xe963('0x58'))){_0x49876d[_0xe963('0x2c')]=qs[_0xe963('0x2c')](_0x33e264[_0xe963('0x3e')][_0xe963('0x2c')]);_0x49876d['offset']=qs[_0xe963('0x2b')](_0x33e264[_0xe963('0x3e')][_0xe963('0x2b')]);}return _0x24962d[_0xe963('0x57')](_0x49876d);}})[_0xe963('0x1d')](function(_0x1d2d3e){if(_0x1d2d3e){return _0x1d2d3e?{'count':_0x23ffa5,'rows':_0x1d2d3e}:null;}})[_0xe963('0x1d')](respondWithResult(_0x50da66,null))[_0xe963('0x27')](handleError(_0x50da66,null));};exports['getSubjects']=function(_0x922e54,_0x596659,_0x475191){var _0x22c0fa={};var _0x778217={};var _0x5f1ce4;var _0x1668d3;return db[_0xe963('0x4c')][_0xe963('0x54')]({'where':{'id':_0x922e54['params']['id']}})[_0xe963('0x1d')](handleEntityNotFound(_0x596659,null))['then'](function(_0x8b2448){if(_0x8b2448){_0x5f1ce4=_0x8b2448;_0x778217['model']=_[_0xe963('0x3f')](db[_0xe963('0x55')][_0xe963('0x3a')]);_0x778217[_0xe963('0x3e')]=_[_0xe963('0x3f')](_0x922e54[_0xe963('0x3e')]);_0x778217[_0xe963('0x40')]=_['intersection'](_0x778217[_0xe963('0x3d')],_0x778217[_0xe963('0x3e')]);_0x22c0fa[_0xe963('0x41')]=_['intersection'](_0x778217[_0xe963('0x3d')],qs[_0xe963('0x43')](_0x922e54[_0xe963('0x3e')][_0xe963('0x43')]));_0x22c0fa[_0xe963('0x41')]=_0x22c0fa[_0xe963('0x41')]['length']?_0x22c0fa['attributes']:_0x778217[_0xe963('0x3d')];_0x22c0fa['order']=qs[_0xe963('0x45')](_0x922e54[_0xe963('0x3e')]['sort']);_0x22c0fa[_0xe963('0x46')]=qs[_0xe963('0x40')](_[_0xe963('0x47')](_0x922e54[_0xe963('0x3e')],_0x778217[_0xe963('0x40')]));if(_0x922e54[_0xe963('0x3e')][_0xe963('0x48')]){_0x22c0fa[_0xe963('0x46')]=_[_0xe963('0x49')](_0x22c0fa['where'],{'$or':_[_0xe963('0x39')](_0x22c0fa['attributes'],function(_0x6ee4b6){var _0x29846e={};_0x29846e[_0x6ee4b6]={'$like':'%'+_0x922e54[_0xe963('0x3e')][_0xe963('0x48')]+'%'};return _0x29846e;})});}_0x22c0fa=_['merge']({},_0x22c0fa,_0x922e54[_0xe963('0x50')]);return _0x5f1ce4[_0xe963('0x59')](_0x22c0fa);}})[_0xe963('0x1d')](function(_0x206f5e){if(_0x206f5e){_0x1668d3=_0x206f5e[_0xe963('0x44')];if(!_0x922e54[_0xe963('0x3e')]['hasOwnProperty']('nolimit')){_0x22c0fa[_0xe963('0x2c')]=qs[_0xe963('0x2c')](_0x922e54['query'][_0xe963('0x2c')]);_0x22c0fa[_0xe963('0x2b')]=qs[_0xe963('0x2b')](_0x922e54[_0xe963('0x3e')][_0xe963('0x2b')]);}return _0x5f1ce4[_0xe963('0x59')](_0x22c0fa);}})[_0xe963('0x1d')](function(_0x1dabf4){if(_0x1dabf4){return _0x1dabf4?{'count':_0x1668d3,'rows':_0x1dabf4}:null;}})['then'](respondWithResult(_0x596659,null))[_0xe963('0x27')](handleError(_0x596659,null));};exports['getDescriptions']=function(_0x447192,_0x53814a,_0x194045){var _0x47e1dc={};var _0x4c9e23={};var _0x15f0df;var _0xc44698;return db[_0xe963('0x4c')][_0xe963('0x54')]({'where':{'id':_0x447192[_0xe963('0x4f')]['id']}})[_0xe963('0x1d')](handleEntityNotFound(_0x53814a,null))[_0xe963('0x1d')](function(_0x420ced){if(_0x420ced){_0x15f0df=_0x420ced;_0x4c9e23[_0xe963('0x3d')]=_[_0xe963('0x3f')](db[_0xe963('0x55')][_0xe963('0x3a')]);_0x4c9e23[_0xe963('0x3e')]=_[_0xe963('0x3f')](_0x447192[_0xe963('0x3e')]);_0x4c9e23[_0xe963('0x40')]=_[_0xe963('0x42')](_0x4c9e23[_0xe963('0x3d')],_0x4c9e23[_0xe963('0x3e')]);_0x47e1dc['attributes']=_['intersection'](_0x4c9e23['model'],qs[_0xe963('0x43')](_0x447192[_0xe963('0x3e')][_0xe963('0x43')]));_0x47e1dc['attributes']=_0x47e1dc['attributes'][_0xe963('0x44')]?_0x47e1dc[_0xe963('0x41')]:_0x4c9e23[_0xe963('0x3d')];_0x47e1dc['order']=qs['sort'](_0x447192[_0xe963('0x3e')]['sort']);_0x47e1dc['where']=qs[_0xe963('0x40')](_[_0xe963('0x47')](_0x447192[_0xe963('0x3e')],_0x4c9e23['filters']));if(_0x447192[_0xe963('0x3e')]['filter']){_0x47e1dc[_0xe963('0x46')]=_[_0xe963('0x49')](_0x47e1dc[_0xe963('0x46')],{'$or':_[_0xe963('0x39')](_0x47e1dc[_0xe963('0x41')],function(_0x424733){var _0x38bfe3={};_0x38bfe3[_0x424733]={'$like':'%'+_0x447192[_0xe963('0x3e')]['filter']+'%'};return _0x38bfe3;})});}_0x47e1dc=_[_0xe963('0x49')]({},_0x47e1dc,_0x447192['options']);return _0x15f0df[_0xe963('0x5a')](_0x47e1dc);}})[_0xe963('0x1d')](function(_0x1e5b32){if(_0x1e5b32){_0xc44698=_0x1e5b32['length'];if(!_0x447192['query']['hasOwnProperty'](_0xe963('0x58'))){_0x47e1dc[_0xe963('0x2c')]=qs[_0xe963('0x2c')](_0x447192[_0xe963('0x3e')][_0xe963('0x2c')]);_0x47e1dc['offset']=qs['offset'](_0x447192[_0xe963('0x3e')]['offset']);}return _0x15f0df[_0xe963('0x5a')](_0x47e1dc);}})[_0xe963('0x1d')](function(_0x489059){if(_0x489059){return _0x489059?{'count':_0xc44698,'rows':_0x489059}:null;}})[_0xe963('0x1d')](respondWithResult(_0x53814a,null))['catch'](handleError(_0x53814a,null));}; \ No newline at end of file +var _0xc2c9=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','name','merge','options','SugarcrmConfiguration','includeAll','include','findAll','rows','show','params','find','create','body','findOne','SugarcrmField','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','moment','util','sox','to-csv','ejs','squel','jsforce'];(function(_0x34b6aa,_0x5ddd29){var _0x3ead29=function(_0x53979c){while(--_0x53979c){_0x34b6aa['push'](_0x34b6aa['shift']());}};_0x3ead29(++_0x5ddd29);}(_0xc2c9,0x1c1));var _0x9c2c=function(_0x3e23fd,_0x324cb8){_0x3e23fd=_0x3e23fd-0x0;var _0x23e70d=_0xc2c9[_0x3e23fd];return _0x23e70d;};'use strict';var pdf=require(_0x9c2c('0x0'));var emlformat=require(_0x9c2c('0x1'));var rimraf=require(_0x9c2c('0x2'));var zipdir=require(_0x9c2c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9c2c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9c2c('0x5'));var path=require('path');var sox=require(_0x9c2c('0x6'));var csv=require(_0x9c2c('0x7'));var ejs=require(_0x9c2c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9c2c('0x9'));var crypto=require('crypto');var jsforce=require(_0x9c2c('0xa'));var deskjs=require(_0x9c2c('0xb'));var toCsv=require(_0x9c2c('0x7'));var querystring=require(_0x9c2c('0xc'));var Papa=require(_0x9c2c('0xd'));var Redis=require('ioredis');var authService=require(_0x9c2c('0xe'));var qs=require(_0x9c2c('0xf'));var as=require(_0x9c2c('0x10'));var hardwareService=require(_0x9c2c('0x11'));var logger=require(_0x9c2c('0x12'))(_0x9c2c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9c2c('0x14'))['db'];var jayson=require(_0x9c2c('0x15'));var client=jayson[_0x9c2c('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x482eed,_0x47d8b2,_0x4ac336){if(_0x4ac336){var _0xae4e1c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xae4e1c['test'](_0x47d8b2)){return _0x482eed;}else{throw new db[(_0x9c2c('0x17'))][(_0x9c2c('0x18'))](_0x9c2c('0x19'));}}else{return _0x482eed;}}function respondWithRpcPromise(_0x41bb94,_0x2f248a,_0x524a68,_0x7b5b94){return new BPromise(function(_0x2c4017,_0x445c59){var _0x4fae70=_0x7b5b94||client;return _0x4fae70['request'](_0x41bb94,_0x524a68)[_0x9c2c('0x1a')](function(_0x3dd0ea){logger['info'](_0x9c2c('0x1b'),_0x2f248a,_0x9c2c('0x1c'));logger[_0x9c2c('0x1d')](_0x9c2c('0x1e'),_0x2f248a,_0x9c2c('0x1c'),JSON[_0x9c2c('0x1f')](_0x3dd0ea));if(_0x3dd0ea[_0x9c2c('0x20')]){if(_0x3dd0ea[_0x9c2c('0x20')][_0x9c2c('0x21')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2f248a,_0x3dd0ea['error']['message']);return _0x445c59(_0x3dd0ea['error'][_0x9c2c('0x22')]);}logger['error'](_0x9c2c('0x1b'),_0x2f248a,_0x3dd0ea[_0x9c2c('0x20')][_0x9c2c('0x22')]);return _0x2c4017(_0x3dd0ea[_0x9c2c('0x20')]['message']);}else{logger[_0x9c2c('0x23')](_0x9c2c('0x1b'),_0x2f248a,'request\x20sent');_0x2c4017(_0x3dd0ea[_0x9c2c('0x24')][_0x9c2c('0x22')]);}})[_0x9c2c('0x25')](function(_0x31beb6){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2f248a,_0x31beb6);_0x445c59(_0x31beb6);});});}function respondWithStatusCode(_0x4fcad7,_0x1e229c){_0x1e229c=_0x1e229c||0xcc;return function(_0x2590d5){if(_0x2590d5){return _0x4fcad7[_0x9c2c('0x26')](_0x1e229c);}return _0x4fcad7[_0x9c2c('0x27')](_0x1e229c)[_0x9c2c('0x28')]();};}function respondWithResult(_0xa8647d,_0x5476b4){_0x5476b4=_0x5476b4||0xc8;return function(_0x3cecb3){if(_0x3cecb3){return _0xa8647d['status'](_0x5476b4)[_0x9c2c('0x29')](_0x3cecb3);}};}function respondWithFilteredResult(_0x59eb54,_0x2da639){return function(_0x1ef2ed){if(_0x1ef2ed){var _0x2f4952=_0x1ef2ed[_0x9c2c('0x2a')],_0x1e6d06=_0x2da639['offset'],_0xf7ef25=_0x2da639[_0x9c2c('0x2b')]+_0x2da639[_0x9c2c('0x2c')],_0x2fcd94;if(_0xf7ef25>=_0x2f4952){_0xf7ef25=_0x2f4952;_0x2fcd94=0xc8;}else{_0x2fcd94=0xce;}_0x59eb54[_0x9c2c('0x27')](_0x2fcd94);return _0x59eb54[_0x9c2c('0x2d')](_0x9c2c('0x2e'),_0x1e6d06+'-'+_0xf7ef25+'/'+_0x2f4952)[_0x9c2c('0x29')](_0x1ef2ed);}return null;};}function patchUpdates(_0x388587){return function(_0x4d2718){try{jsonpatch[_0x9c2c('0x2f')](_0x4d2718,_0x388587,!![]);}catch(_0x2272d6){return BPromise['reject'](_0x2272d6);}return _0x4d2718[_0x9c2c('0x30')]();};}function saveUpdates(_0x2254c7,_0x284f12){return function(_0x3c01ac){if(_0x3c01ac){return _0x3c01ac[_0x9c2c('0x31')](_0x2254c7)[_0x9c2c('0x1a')](function(_0x18f533){return _0x18f533;});}return null;};}function removeEntity(_0x652e31,_0x1d582f){return function(_0x272aae){if(_0x272aae){return _0x272aae[_0x9c2c('0x32')]()[_0x9c2c('0x1a')](function(){_0x652e31[_0x9c2c('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b8559,_0x37b75b){return function(_0x4dbfe5){if(!_0x4dbfe5){_0x1b8559[_0x9c2c('0x26')](0x194);}return _0x4dbfe5;};}function handleError(_0x284186,_0x289d42){_0x289d42=_0x289d42||0x1f4;return function(_0x41cd33){logger['error'](_0x41cd33['stack']);if(_0x41cd33['name']){delete _0x41cd33['name'];}_0x284186[_0x9c2c('0x27')](_0x289d42)[_0x9c2c('0x33')](_0x41cd33);};}exports[_0x9c2c('0x34')]=function(_0x35f49d,_0x31d3fc){var _0x2984ef={},_0xcd56ca={},_0x178422={'count':0x0,'rows':[]};var _0x1543fd=_[_0x9c2c('0x35')](db['SugarcrmConfiguration'][_0x9c2c('0x36')],function(_0xd2f132){return{'name':_0xd2f132[_0x9c2c('0x37')],'type':_0xd2f132['type'][_0x9c2c('0x38')]};});_0xcd56ca[_0x9c2c('0x39')]=_[_0x9c2c('0x35')](_0x1543fd,'name');_0xcd56ca[_0x9c2c('0x3a')]=_[_0x9c2c('0x3b')](_0x35f49d[_0x9c2c('0x3a')]);_0xcd56ca[_0x9c2c('0x3c')]=_[_0x9c2c('0x3d')](_0xcd56ca['model'],_0xcd56ca[_0x9c2c('0x3a')]);_0x2984ef[_0x9c2c('0x3e')]=_[_0x9c2c('0x3d')](_0xcd56ca[_0x9c2c('0x39')],qs['fields'](_0x35f49d[_0x9c2c('0x3a')][_0x9c2c('0x3f')]));_0x2984ef[_0x9c2c('0x3e')]=_0x2984ef[_0x9c2c('0x3e')][_0x9c2c('0x40')]?_0x2984ef[_0x9c2c('0x3e')]:_0xcd56ca[_0x9c2c('0x39')];if(!_0x35f49d[_0x9c2c('0x3a')][_0x9c2c('0x41')](_0x9c2c('0x42'))){_0x2984ef[_0x9c2c('0x2c')]=qs['limit'](_0x35f49d[_0x9c2c('0x3a')]['limit']);_0x2984ef[_0x9c2c('0x2b')]=qs[_0x9c2c('0x2b')](_0x35f49d[_0x9c2c('0x3a')][_0x9c2c('0x2b')]);}_0x2984ef[_0x9c2c('0x43')]=qs[_0x9c2c('0x44')](_0x35f49d[_0x9c2c('0x3a')][_0x9c2c('0x44')]);_0x2984ef[_0x9c2c('0x45')]=qs[_0x9c2c('0x3c')](_[_0x9c2c('0x46')](_0x35f49d[_0x9c2c('0x3a')],_0xcd56ca[_0x9c2c('0x3c')]));if(_0x35f49d[_0x9c2c('0x3a')][_0x9c2c('0x47')]){_0x2984ef['where']=_['merge'](_0x2984ef['where'],{'$or':_[_0x9c2c('0x35')](_0x1543fd,function(_0x3657e9){if(_0x3657e9[_0x9c2c('0x48')]!==_0x9c2c('0x49')){var _0x3ba12b={};_0x3ba12b[_0x3657e9[_0x9c2c('0x4a')]]={'$like':'%'+_0x35f49d['query']['filter']+'%'};return _0x3ba12b;}})});}_0x2984ef=_[_0x9c2c('0x4b')]({},_0x2984ef,_0x35f49d[_0x9c2c('0x4c')]);var _0x1d19af={'where':_0x2984ef[_0x9c2c('0x45')]};return db[_0x9c2c('0x4d')][_0x9c2c('0x2a')](_0x1d19af)[_0x9c2c('0x1a')](function(_0x44dd34){_0x178422[_0x9c2c('0x2a')]=_0x44dd34;if(_0x35f49d[_0x9c2c('0x3a')][_0x9c2c('0x4e')]){_0x2984ef[_0x9c2c('0x4f')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x9c2c('0x50')](_0x2984ef);})[_0x9c2c('0x1a')](function(_0x4adbeb){_0x178422[_0x9c2c('0x51')]=_0x4adbeb;return _0x178422;})[_0x9c2c('0x1a')](respondWithFilteredResult(_0x31d3fc,_0x2984ef))[_0x9c2c('0x25')](handleError(_0x31d3fc,null));};exports[_0x9c2c('0x52')]=function(_0x332bde,_0x4284c9){var _0x566002={'raw':![],'where':{'id':_0x332bde[_0x9c2c('0x53')]['id']}},_0x48729a={};_0x48729a[_0x9c2c('0x39')]=_['keys'](db[_0x9c2c('0x4d')]['rawAttributes']);_0x48729a[_0x9c2c('0x3a')]=_['keys'](_0x332bde[_0x9c2c('0x3a')]);_0x48729a[_0x9c2c('0x3c')]=_[_0x9c2c('0x3d')](_0x48729a['model'],_0x48729a[_0x9c2c('0x3a')]);_0x566002[_0x9c2c('0x3e')]=_[_0x9c2c('0x3d')](_0x48729a[_0x9c2c('0x39')],qs['fields'](_0x332bde['query'][_0x9c2c('0x3f')]));_0x566002[_0x9c2c('0x3e')]=_0x566002['attributes']['length']?_0x566002['attributes']:_0x48729a[_0x9c2c('0x39')];if(_0x332bde[_0x9c2c('0x3a')][_0x9c2c('0x4e')]){_0x566002['include']=[{'all':!![]}];}_0x566002=_[_0x9c2c('0x4b')]({},_0x566002,_0x332bde[_0x9c2c('0x4c')]);return db[_0x9c2c('0x4d')][_0x9c2c('0x54')](_0x566002)[_0x9c2c('0x1a')](handleEntityNotFound(_0x4284c9,null))[_0x9c2c('0x1a')](respondWithResult(_0x4284c9,null))[_0x9c2c('0x25')](handleError(_0x4284c9,null));};exports[_0x9c2c('0x55')]=function(_0x326efd,_0xf76976){return db[_0x9c2c('0x4d')][_0x9c2c('0x55')](_0x326efd[_0x9c2c('0x56')],{})[_0x9c2c('0x1a')](respondWithResult(_0xf76976,0xc9))['catch'](handleError(_0xf76976,null));};exports[_0x9c2c('0x31')]=function(_0x4d003c,_0xef9d6c){if(_0x4d003c['body']['id']){delete _0x4d003c[_0x9c2c('0x56')]['id'];}return db[_0x9c2c('0x4d')][_0x9c2c('0x54')]({'where':{'id':_0x4d003c[_0x9c2c('0x53')]['id']}})[_0x9c2c('0x1a')](handleEntityNotFound(_0xef9d6c,null))[_0x9c2c('0x1a')](saveUpdates(_0x4d003c[_0x9c2c('0x56')],null))['then'](respondWithResult(_0xef9d6c,null))[_0x9c2c('0x25')](handleError(_0xef9d6c,null));};exports[_0x9c2c('0x32')]=function(_0x1577b7,_0x43d939){return db[_0x9c2c('0x4d')][_0x9c2c('0x54')]({'where':{'id':_0x1577b7[_0x9c2c('0x53')]['id']}})[_0x9c2c('0x1a')](handleEntityNotFound(_0x43d939,null))[_0x9c2c('0x1a')](removeEntity(_0x43d939,null))[_0x9c2c('0x25')](handleError(_0x43d939,null));};exports['getFields']=function(_0xee99b5,_0x4b57fa,_0x4485f4){var _0x83729e={};var _0x1b5b1b={};var _0x4cc2e5;var _0x39e0ce;return db['SugarcrmConfiguration'][_0x9c2c('0x57')]({'where':{'id':_0xee99b5[_0x9c2c('0x53')]['id']}})[_0x9c2c('0x1a')](handleEntityNotFound(_0x4b57fa,null))['then'](function(_0x40a054){if(_0x40a054){_0x4cc2e5=_0x40a054;_0x1b5b1b[_0x9c2c('0x39')]=_[_0x9c2c('0x3b')](db[_0x9c2c('0x58')][_0x9c2c('0x36')]);_0x1b5b1b['query']=_[_0x9c2c('0x3b')](_0xee99b5['query']);_0x1b5b1b['filters']=_[_0x9c2c('0x3d')](_0x1b5b1b[_0x9c2c('0x39')],_0x1b5b1b['query']);_0x83729e[_0x9c2c('0x3e')]=_[_0x9c2c('0x3d')](_0x1b5b1b[_0x9c2c('0x39')],qs[_0x9c2c('0x3f')](_0xee99b5[_0x9c2c('0x3a')][_0x9c2c('0x3f')]));_0x83729e[_0x9c2c('0x3e')]=_0x83729e['attributes']['length']?_0x83729e[_0x9c2c('0x3e')]:_0x1b5b1b['model'];_0x83729e[_0x9c2c('0x43')]=qs[_0x9c2c('0x44')](_0xee99b5[_0x9c2c('0x3a')][_0x9c2c('0x44')]);_0x83729e[_0x9c2c('0x45')]=qs[_0x9c2c('0x3c')](_[_0x9c2c('0x46')](_0xee99b5[_0x9c2c('0x3a')],_0x1b5b1b[_0x9c2c('0x3c')]));if(_0xee99b5[_0x9c2c('0x3a')][_0x9c2c('0x47')]){_0x83729e[_0x9c2c('0x45')]=_[_0x9c2c('0x4b')](_0x83729e[_0x9c2c('0x45')],{'$or':_[_0x9c2c('0x35')](_0x83729e[_0x9c2c('0x3e')],function(_0xc2439b){var _0x2993c7={};_0x2993c7[_0xc2439b]={'$like':'%'+_0xee99b5[_0x9c2c('0x3a')][_0x9c2c('0x47')]+'%'};return _0x2993c7;})});}_0x83729e=_[_0x9c2c('0x4b')]({},_0x83729e,_0xee99b5[_0x9c2c('0x4c')]);return _0x4cc2e5[_0x9c2c('0x59')](_0x83729e);}})[_0x9c2c('0x1a')](function(_0x38a7f3){if(_0x38a7f3){_0x39e0ce=_0x38a7f3['length'];if(!_0xee99b5[_0x9c2c('0x3a')][_0x9c2c('0x41')](_0x9c2c('0x42'))){_0x83729e[_0x9c2c('0x2c')]=qs[_0x9c2c('0x2c')](_0xee99b5[_0x9c2c('0x3a')][_0x9c2c('0x2c')]);_0x83729e[_0x9c2c('0x2b')]=qs[_0x9c2c('0x2b')](_0xee99b5[_0x9c2c('0x3a')][_0x9c2c('0x2b')]);}return _0x4cc2e5['getFields'](_0x83729e);}})[_0x9c2c('0x1a')](function(_0x4e85d3){if(_0x4e85d3){return _0x4e85d3?{'count':_0x39e0ce,'rows':_0x4e85d3}:null;}})['then'](respondWithResult(_0x4b57fa,null))[_0x9c2c('0x25')](handleError(_0x4b57fa,null));};exports['getSubjects']=function(_0x41baeb,_0x33a9bb,_0x2a0590){var _0x580452={};var _0x438679={};var _0x3e3c9f;var _0x153b95;return db['SugarcrmConfiguration'][_0x9c2c('0x57')]({'where':{'id':_0x41baeb[_0x9c2c('0x53')]['id']}})['then'](handleEntityNotFound(_0x33a9bb,null))[_0x9c2c('0x1a')](function(_0x18f2ee){if(_0x18f2ee){_0x3e3c9f=_0x18f2ee;_0x438679[_0x9c2c('0x39')]=_[_0x9c2c('0x3b')](db[_0x9c2c('0x58')][_0x9c2c('0x36')]);_0x438679[_0x9c2c('0x3a')]=_[_0x9c2c('0x3b')](_0x41baeb[_0x9c2c('0x3a')]);_0x438679[_0x9c2c('0x3c')]=_[_0x9c2c('0x3d')](_0x438679[_0x9c2c('0x39')],_0x438679[_0x9c2c('0x3a')]);_0x580452[_0x9c2c('0x3e')]=_[_0x9c2c('0x3d')](_0x438679[_0x9c2c('0x39')],qs[_0x9c2c('0x3f')](_0x41baeb['query'][_0x9c2c('0x3f')]));_0x580452['attributes']=_0x580452[_0x9c2c('0x3e')]['length']?_0x580452[_0x9c2c('0x3e')]:_0x438679['model'];_0x580452['order']=qs[_0x9c2c('0x44')](_0x41baeb[_0x9c2c('0x3a')][_0x9c2c('0x44')]);_0x580452[_0x9c2c('0x45')]=qs[_0x9c2c('0x3c')](_[_0x9c2c('0x46')](_0x41baeb[_0x9c2c('0x3a')],_0x438679['filters']));if(_0x41baeb['query']['filter']){_0x580452[_0x9c2c('0x45')]=_[_0x9c2c('0x4b')](_0x580452[_0x9c2c('0x45')],{'$or':_[_0x9c2c('0x35')](_0x580452['attributes'],function(_0x429932){var _0x32fa39={};_0x32fa39[_0x429932]={'$like':'%'+_0x41baeb[_0x9c2c('0x3a')][_0x9c2c('0x47')]+'%'};return _0x32fa39;})});}_0x580452=_['merge']({},_0x580452,_0x41baeb['options']);return _0x3e3c9f[_0x9c2c('0x5a')](_0x580452);}})[_0x9c2c('0x1a')](function(_0x5a46e9){if(_0x5a46e9){_0x153b95=_0x5a46e9['length'];if(!_0x41baeb['query']['hasOwnProperty'](_0x9c2c('0x42'))){_0x580452[_0x9c2c('0x2c')]=qs[_0x9c2c('0x2c')](_0x41baeb[_0x9c2c('0x3a')][_0x9c2c('0x2c')]);_0x580452[_0x9c2c('0x2b')]=qs[_0x9c2c('0x2b')](_0x41baeb[_0x9c2c('0x3a')]['offset']);}return _0x3e3c9f[_0x9c2c('0x5a')](_0x580452);}})[_0x9c2c('0x1a')](function(_0x59a615){if(_0x59a615){return _0x59a615?{'count':_0x153b95,'rows':_0x59a615}:null;}})[_0x9c2c('0x1a')](respondWithResult(_0x33a9bb,null))[_0x9c2c('0x25')](handleError(_0x33a9bb,null));};exports['getDescriptions']=function(_0x3f9397,_0x4be519,_0x364504){var _0x1553c7={};var _0x38620e={};var _0x3c0668;var _0x3b028a;return db[_0x9c2c('0x4d')]['findOne']({'where':{'id':_0x3f9397[_0x9c2c('0x53')]['id']}})['then'](handleEntityNotFound(_0x4be519,null))[_0x9c2c('0x1a')](function(_0xeda0db){if(_0xeda0db){_0x3c0668=_0xeda0db;_0x38620e[_0x9c2c('0x39')]=_[_0x9c2c('0x3b')](db[_0x9c2c('0x58')]['rawAttributes']);_0x38620e[_0x9c2c('0x3a')]=_['keys'](_0x3f9397['query']);_0x38620e[_0x9c2c('0x3c')]=_[_0x9c2c('0x3d')](_0x38620e['model'],_0x38620e[_0x9c2c('0x3a')]);_0x1553c7[_0x9c2c('0x3e')]=_[_0x9c2c('0x3d')](_0x38620e[_0x9c2c('0x39')],qs['fields'](_0x3f9397['query'][_0x9c2c('0x3f')]));_0x1553c7[_0x9c2c('0x3e')]=_0x1553c7[_0x9c2c('0x3e')]['length']?_0x1553c7[_0x9c2c('0x3e')]:_0x38620e[_0x9c2c('0x39')];_0x1553c7[_0x9c2c('0x43')]=qs['sort'](_0x3f9397['query'][_0x9c2c('0x44')]);_0x1553c7[_0x9c2c('0x45')]=qs[_0x9c2c('0x3c')](_[_0x9c2c('0x46')](_0x3f9397[_0x9c2c('0x3a')],_0x38620e[_0x9c2c('0x3c')]));if(_0x3f9397[_0x9c2c('0x3a')][_0x9c2c('0x47')]){_0x1553c7[_0x9c2c('0x45')]=_[_0x9c2c('0x4b')](_0x1553c7[_0x9c2c('0x45')],{'$or':_[_0x9c2c('0x35')](_0x1553c7[_0x9c2c('0x3e')],function(_0x5b2a64){var _0x380da4={};_0x380da4[_0x5b2a64]={'$like':'%'+_0x3f9397['query'][_0x9c2c('0x47')]+'%'};return _0x380da4;})});}_0x1553c7=_[_0x9c2c('0x4b')]({},_0x1553c7,_0x3f9397[_0x9c2c('0x4c')]);return _0x3c0668[_0x9c2c('0x5b')](_0x1553c7);}})[_0x9c2c('0x1a')](function(_0x1803e5){if(_0x1803e5){_0x3b028a=_0x1803e5[_0x9c2c('0x40')];if(!_0x3f9397[_0x9c2c('0x3a')]['hasOwnProperty']('nolimit')){_0x1553c7['limit']=qs[_0x9c2c('0x2c')](_0x3f9397[_0x9c2c('0x3a')][_0x9c2c('0x2c')]);_0x1553c7[_0x9c2c('0x2b')]=qs[_0x9c2c('0x2b')](_0x3f9397[_0x9c2c('0x3a')][_0x9c2c('0x2b')]);}return _0x3c0668[_0x9c2c('0x5b')](_0x1553c7);}})[_0x9c2c('0x1a')](function(_0x23f4b1){if(_0x23f4b1){return _0x23f4b1?{'count':_0x3b028a,'rows':_0x23f4b1}:null;}})[_0x9c2c('0x1a')](respondWithResult(_0x4be519,null))['catch'](handleError(_0x4be519,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index a29acc6..33b7456 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 _0xcfd3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','int_sugarcrm_configurations','lodash','util'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xcfd3,0x11c));var _0x3cfd=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0xcfd3[_0x51b0dc];return _0x13fa89;};'use strict';var _=require(_0x3cfd('0x0'));var util=require(_0x3cfd('0x1'));var logger=require(_0x3cfd('0x2'))(_0x3cfd('0x3'));var moment=require(_0x3cfd('0x4'));var BPromise=require(_0x3cfd('0x5'));var rp=require(_0x3cfd('0x6'));var fs=require('fs');var path=require(_0x3cfd('0x7'));var rimraf=require(_0x3cfd('0x8'));var config=require(_0x3cfd('0x9'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x57fe5f,_0x3522cf){return _0x57fe5f['define']('SugarcrmConfiguration',attributes,{'tableName':_0x3cfd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x130e=['define','SugarcrmConfiguration','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x506091,_0x12f86f){var _0xdab9ab=function(_0xab63c8){while(--_0xab63c8){_0x506091['push'](_0x506091['shift']());}};_0xdab9ab(++_0x12f86f);}(_0x130e,0xce));var _0xe130=function(_0x5c659c,_0x20b0be){_0x5c659c=_0x5c659c-0x0;var _0x31decf=_0x130e[_0x5c659c];return _0x31decf;};'use strict';var _=require(_0xe130('0x0'));var util=require(_0xe130('0x1'));var logger=require('../../config/logger')(_0xe130('0x2'));var moment=require(_0xe130('0x3'));var BPromise=require(_0xe130('0x4'));var rp=require(_0xe130('0x5'));var fs=require('fs');var path=require(_0xe130('0x6'));var rimraf=require(_0xe130('0x7'));var config=require(_0xe130('0x8'));var attributes=require(_0xe130('0x9'));module['exports']=function(_0x4beb58,_0xe8bd6a){return _0x4beb58[_0xe130('0xa')](_0xe130('0xb'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 877e60b..ce1961e 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 _0x278f=['error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x556634,_0x520958){var _0x4429fd=function(_0x1e7eb9){while(--_0x1e7eb9){_0x556634['push'](_0x556634['shift']());}};_0x4429fd(++_0x520958);}(_0x278f,0x156));var _0xf278=function(_0x4d0109,_0x4d9199){_0x4d0109=_0x4d0109-0x0;var _0x578263=_0x278f[_0x4d0109];return _0x578263;};'use strict';var _=require(_0xf278('0x0'));var util=require(_0xf278('0x1'));var moment=require(_0xf278('0x2'));var BPromise=require(_0xf278('0x3'));var rs=require(_0xf278('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf278('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf278('0x6'))(_0xf278('0x7'));var config=require(_0xf278('0x8'));var jayson=require(_0xf278('0x9'));var client=jayson['client'][_0xf278('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4213ea,_0x52c838,_0xda90f5){return new BPromise(function(_0x23c1e3,_0x17276b){return client[_0xf278('0xb')](_0x4213ea,_0xda90f5)['then'](function(_0x18b9d7){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x52c838,'request\x20sent');logger['debug'](_0xf278('0xc'),_0x52c838,_0xf278('0xd'),JSON[_0xf278('0xe')](_0x18b9d7));if(_0x18b9d7[_0xf278('0xf')]){if(_0x18b9d7[_0xf278('0xf')][_0xf278('0x10')]===0x1f4){logger[_0xf278('0xf')](_0xf278('0x11'),_0x52c838,_0x18b9d7[_0xf278('0xf')][_0xf278('0x12')]);return _0x17276b(_0x18b9d7[_0xf278('0xf')][_0xf278('0x12')]);}logger[_0xf278('0xf')](_0xf278('0x11'),_0x52c838,_0x18b9d7[_0xf278('0xf')]['message']);return _0x23c1e3(_0x18b9d7[_0xf278('0xf')]['message']);}else{logger[_0xf278('0x13')](_0xf278('0x11'),_0x52c838,'request\x20sent');_0x23c1e3(_0x18b9d7[_0xf278('0x14')]['message']);}})['catch'](function(_0x49343b){logger[_0xf278('0xf')](_0xf278('0x11'),_0x52c838,_0x49343b);_0x17276b(_0x49343b);});});} \ No newline at end of file +var _0xf3f1=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf3f1,0x18e));var _0x1f3f=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0xf3f1[_0x43fdf8];return _0x1160c6;};'use strict';var _=require(_0x1f3f('0x0'));var util=require('util');var moment=require(_0x1f3f('0x1'));var BPromise=require(_0x1f3f('0x2'));var rs=require(_0x1f3f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f3f('0x4'))['db'];var utils=require(_0x1f3f('0x5'));var logger=require(_0x1f3f('0x6'))(_0x1f3f('0x7'));var config=require(_0x1f3f('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x167bed,_0x111fc0,_0x3dd457){return new BPromise(function(_0x3d31b6,_0x32c982){return client[_0x1f3f('0x9')](_0x167bed,_0x3dd457)[_0x1f3f('0xa')](function(_0x3cef4d){logger[_0x1f3f('0xb')](_0x1f3f('0xc'),_0x111fc0,_0x1f3f('0xd'));logger[_0x1f3f('0xe')](_0x1f3f('0xf'),_0x111fc0,_0x1f3f('0xd'),JSON[_0x1f3f('0x10')](_0x3cef4d));if(_0x3cef4d[_0x1f3f('0x11')]){if(_0x3cef4d['error']['code']===0x1f4){logger['error'](_0x1f3f('0xc'),_0x111fc0,_0x3cef4d[_0x1f3f('0x11')][_0x1f3f('0x12')]);return _0x32c982(_0x3cef4d['error'][_0x1f3f('0x12')]);}logger[_0x1f3f('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x111fc0,_0x3cef4d[_0x1f3f('0x11')][_0x1f3f('0x12')]);return _0x3d31b6(_0x3cef4d[_0x1f3f('0x11')][_0x1f3f('0x12')]);}else{logger['info'](_0x1f3f('0xc'),_0x111fc0,'request\x20sent');_0x3d31b6(_0x3cef4d[_0x1f3f('0x13')]['message']);}})[_0x1f3f('0x14')](function(_0x32384f){logger[_0x1f3f('0x11')](_0x1f3f('0xc'),_0x111fc0,_0x32384f);_0x32c982(_0x32384f);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 615b293..19ee705 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 _0x23fa=['update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','create','put','/:id'];(function(_0x35b7d4,_0x5a5c43){var _0x4e8cee=function(_0x66859c){while(--_0x66859c){_0x35b7d4['push'](_0x35b7d4['shift']());}};_0x4e8cee(++_0x5a5c43);}(_0x23fa,0x112));var _0xa23f=function(_0x57d8e3,_0x24b0a3){_0x57d8e3=_0x57d8e3-0x0;var _0x5ca801=_0x23fa[_0x57d8e3];return _0x5ca801;};'use strict';var multer=require(_0xa23f('0x0'));var util=require('util');var path=require(_0xa23f('0x1'));var timeout=require('connect-timeout');var express=require(_0xa23f('0x2'));var router=express[_0xa23f('0x3')]();var auth=require(_0xa23f('0x4'));var interaction=require(_0xa23f('0x5'));var config=require(_0xa23f('0x6'));var controller=require(_0xa23f('0x7'));router[_0xa23f('0x8')]('/',auth[_0xa23f('0x9')](),controller[_0xa23f('0xa')]);router[_0xa23f('0x8')]('/:id',auth[_0xa23f('0x9')](),controller['show']);router['post']('/',auth[_0xa23f('0x9')](),controller[_0xa23f('0xb')]);router[_0xa23f('0xc')](_0xa23f('0xd'),auth[_0xa23f('0x9')](),controller[_0xa23f('0xe')]);router[_0xa23f('0xf')](_0xa23f('0xd'),auth['isAuthenticated'](),controller[_0xa23f('0x10')]);module[_0xa23f('0x11')]=router; \ No newline at end of file +var _0x59fb=['get','/:id','isAuthenticated','post','create','update','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x26b525,_0x3594da){var _0x38a0c6=function(_0x28d3c2){while(--_0x28d3c2){_0x26b525['push'](_0x26b525['shift']());}};_0x38a0c6(++_0x3594da);}(_0x59fb,0x1d8));var _0xb59f=function(_0x5c0232,_0x1c449f){_0x5c0232=_0x5c0232-0x0;var _0x589366=_0x59fb[_0x5c0232];return _0x589366;};'use strict';var multer=require(_0xb59f('0x0'));var util=require('util');var path=require(_0xb59f('0x1'));var timeout=require(_0xb59f('0x2'));var express=require(_0xb59f('0x3'));var router=express['Router']();var auth=require(_0xb59f('0x4'));var interaction=require(_0xb59f('0x5'));var config=require(_0xb59f('0x6'));var controller=require(_0xb59f('0x7'));router[_0xb59f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb59f('0x9'),auth[_0xb59f('0xa')](),controller['show']);router[_0xb59f('0xb')]('/',auth['isAuthenticated'](),controller[_0xb59f('0xc')]);router['put'](_0xb59f('0x9'),auth[_0xb59f('0xa')](),controller[_0xb59f('0xd')]);router['delete']('/:id',auth[_0xb59f('0xa')](),controller[_0xb59f('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 78fa295..85d808d 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 _0x3de2=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x58b7b1,_0x355a2f){var _0x3d638e=function(_0x4304b8){while(--_0x4304b8){_0x58b7b1['push'](_0x58b7b1['shift']());}};_0x3d638e(++_0x355a2f);}(_0x3de2,0x79));var _0x23de=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x3de2[_0xd0b415];return _0x2bdf2c;};'use strict';var Sequelize=require(_0x23de('0x0'));module['exports']={'type':{'type':Sequelize[_0x23de('0x1')](_0x23de('0x2'),_0x23de('0x3'),_0x23de('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x23de('0x5')]},'key':{'type':Sequelize[_0x23de('0x5')]},'keyType':{'type':Sequelize[_0x23de('0x1')](_0x23de('0x2'),'variable',_0x23de('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x23de('0x5')]},'nameField':{'type':Sequelize[_0x23de('0x5')]},'customField':{'type':Sequelize[_0x23de('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x23de('0x5')]}}; \ No newline at end of file +var _0xfa2b=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x154430,_0x45c52a){_0x154430=_0x154430-0x0;var _0x3f8599=_0xfa2b[_0x154430];return _0x3f8599;};'use strict';var Sequelize=require(_0xbfa2('0x0'));module[_0xbfa2('0x1')]={'type':{'type':Sequelize[_0xbfa2('0x2')](_0xbfa2('0x3'),_0xbfa2('0x4'),_0xbfa2('0x5'),_0xbfa2('0x6')),'defaultValue':_0xbfa2('0x3')},'content':{'type':Sequelize[_0xbfa2('0x7')]},'key':{'type':Sequelize[_0xbfa2('0x7')]},'keyType':{'type':Sequelize[_0xbfa2('0x2')](_0xbfa2('0x3'),_0xbfa2('0x4'),_0xbfa2('0x5'))},'keyContent':{'type':Sequelize[_0xbfa2('0x7')]},'idField':{'type':Sequelize[_0xbfa2('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xbfa2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 37d32e1..dddf307 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 _0x7528=['params','intersection','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show'];(function(_0x1c136c,_0xbdb5b6){var _0x1b96ba=function(_0xdff56d){while(--_0xdff56d){_0x1c136c['push'](_0x1c136c['shift']());}};_0x1b96ba(++_0xbdb5b6);}(_0x7528,0xdd));var _0x8752=function(_0x404ca5,_0x582097){_0x404ca5=_0x404ca5-0x0;var _0x21f8f0=_0x7528[_0x404ca5];return _0x21f8f0;};'use strict';var pdf=require(_0x8752('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8752('0x1'));var jsonpatch=require(_0x8752('0x2'));var rp=require(_0x8752('0x3'));var moment=require(_0x8752('0x4'));var BPromise=require(_0x8752('0x5'));var Mustache=require(_0x8752('0x6'));var util=require('util');var path=require(_0x8752('0x7'));var sox=require(_0x8752('0x8'));var csv=require(_0x8752('0x9'));var ejs=require(_0x8752('0xa'));var fs=require('fs');var _=require(_0x8752('0xb'));var squel=require(_0x8752('0xc'));var crypto=require(_0x8752('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8752('0x9'));var querystring=require(_0x8752('0xe'));var Papa=require(_0x8752('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8752('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8752('0x11'))(_0x8752('0x12'));var utils=require(_0x8752('0x13'));var config=require(_0x8752('0x14'));var db=require(_0x8752('0x15'))['db'];function respondWithStatusCode(_0x4b5b0b,_0x49c5dc){_0x49c5dc=_0x49c5dc||0xcc;return function(_0x227c1d){if(_0x227c1d){return _0x4b5b0b[_0x8752('0x16')](_0x49c5dc);}return _0x4b5b0b[_0x8752('0x17')](_0x49c5dc)['end']();};}function respondWithResult(_0x42f244,_0x49e728){_0x49e728=_0x49e728||0xc8;return function(_0x581ed6){if(_0x581ed6){return _0x42f244[_0x8752('0x17')](_0x49e728)[_0x8752('0x18')](_0x581ed6);}};}function respondWithFilteredResult(_0x327238,_0x9cff89){return function(_0x486c7f){if(_0x486c7f){var _0x22e2b2=_0x486c7f[_0x8752('0x19')],_0x24aeed=_0x9cff89[_0x8752('0x1a')],_0x3b7037=_0x9cff89[_0x8752('0x1a')]+_0x9cff89[_0x8752('0x1b')],_0x554657;if(_0x3b7037>=_0x22e2b2){_0x3b7037=_0x22e2b2;_0x554657=0xc8;}else{_0x554657=0xce;}_0x327238[_0x8752('0x17')](_0x554657);return _0x327238[_0x8752('0x1c')]('Content-Range',_0x24aeed+'-'+_0x3b7037+'/'+_0x22e2b2)['json'](_0x486c7f);}return null;};}function patchUpdates(_0x2076d0){return function(_0x6c2989){try{jsonpatch[_0x8752('0x1d')](_0x6c2989,_0x2076d0,!![]);}catch(_0x5f36e7){return BPromise[_0x8752('0x1e')](_0x5f36e7);}return _0x6c2989[_0x8752('0x1f')]();};}function saveUpdates(_0x598d85,_0x50ae51){return function(_0x31a3f8){if(_0x31a3f8){return _0x31a3f8[_0x8752('0x20')](_0x598d85)[_0x8752('0x21')](function(_0x2cb4bb){return _0x2cb4bb;});}return null;};}function removeEntity(_0x282bf1,_0x52bfb6){return function(_0xb78135){if(_0xb78135){return _0xb78135[_0x8752('0x22')]()[_0x8752('0x21')](function(){_0x282bf1[_0x8752('0x17')](0xcc)[_0x8752('0x23')]();});}};}function handleEntityNotFound(_0x3fc17a,_0x4d5b8a){return function(_0x89a2a5){if(!_0x89a2a5){_0x3fc17a[_0x8752('0x16')](0x194);}return _0x89a2a5;};}function handleError(_0x2fd5be,_0x15c041){_0x15c041=_0x15c041||0x1f4;return function(_0x1d2961){logger[_0x8752('0x24')](_0x1d2961[_0x8752('0x25')]);if(_0x1d2961[_0x8752('0x26')]){delete _0x1d2961['name'];}_0x2fd5be[_0x8752('0x17')](_0x15c041)['send'](_0x1d2961);};}exports[_0x8752('0x27')]=function(_0x19de61,_0x3766da){var _0x2557bf={},_0x5f4be3={},_0x5880e5={'count':0x0,'rows':[]};var _0x1b6c1f=_[_0x8752('0x28')](db[_0x8752('0x29')][_0x8752('0x2a')],function(_0x14655c){return{'name':_0x14655c[_0x8752('0x2b')],'type':_0x14655c[_0x8752('0x2c')][_0x8752('0x2d')]};});_0x5f4be3[_0x8752('0x2e')]=_[_0x8752('0x28')](_0x1b6c1f,'name');_0x5f4be3[_0x8752('0x2f')]=_[_0x8752('0x30')](_0x19de61[_0x8752('0x2f')]);_0x5f4be3[_0x8752('0x31')]=_['intersection'](_0x5f4be3[_0x8752('0x2e')],_0x5f4be3[_0x8752('0x2f')]);_0x2557bf['attributes']=_['intersection'](_0x5f4be3[_0x8752('0x2e')],qs[_0x8752('0x32')](_0x19de61[_0x8752('0x2f')][_0x8752('0x32')]));_0x2557bf[_0x8752('0x33')]=_0x2557bf[_0x8752('0x33')][_0x8752('0x34')]?_0x2557bf[_0x8752('0x33')]:_0x5f4be3['model'];if(!_0x19de61[_0x8752('0x2f')]['hasOwnProperty'](_0x8752('0x35'))){_0x2557bf[_0x8752('0x1b')]=qs[_0x8752('0x1b')](_0x19de61[_0x8752('0x2f')][_0x8752('0x1b')]);_0x2557bf[_0x8752('0x1a')]=qs[_0x8752('0x1a')](_0x19de61[_0x8752('0x2f')][_0x8752('0x1a')]);}_0x2557bf[_0x8752('0x36')]=qs[_0x8752('0x37')](_0x19de61[_0x8752('0x2f')][_0x8752('0x37')]);_0x2557bf[_0x8752('0x38')]=qs[_0x8752('0x31')](_[_0x8752('0x39')](_0x19de61[_0x8752('0x2f')],_0x5f4be3[_0x8752('0x31')]));if(_0x19de61[_0x8752('0x2f')]['filter']){_0x2557bf[_0x8752('0x38')]=_[_0x8752('0x3a')](_0x2557bf['where'],{'$or':_['map'](_0x1b6c1f,function(_0x506104){if(_0x506104[_0x8752('0x2c')]!==_0x8752('0x3b')){var _0x141b68={};_0x141b68[_0x506104[_0x8752('0x26')]]={'$like':'%'+_0x19de61[_0x8752('0x2f')][_0x8752('0x3c')]+'%'};return _0x141b68;}})});}_0x2557bf=_[_0x8752('0x3a')]({},_0x2557bf,_0x19de61[_0x8752('0x3d')]);var _0xb50a60={'where':_0x2557bf[_0x8752('0x38')]};return db['SugarcrmField'][_0x8752('0x19')](_0xb50a60)[_0x8752('0x21')](function(_0x4c20de){_0x5880e5[_0x8752('0x19')]=_0x4c20de;if(_0x19de61[_0x8752('0x2f')][_0x8752('0x3e')]){_0x2557bf[_0x8752('0x3f')]=[{'all':!![]}];}return db[_0x8752('0x29')][_0x8752('0x40')](_0x2557bf);})[_0x8752('0x21')](function(_0x7f6bdc){_0x5880e5['rows']=_0x7f6bdc;return _0x5880e5;})['then'](respondWithFilteredResult(_0x3766da,_0x2557bf))[_0x8752('0x41')](handleError(_0x3766da,null));};exports[_0x8752('0x42')]=function(_0x292138,_0xadd218){var _0xaebff1={'raw':!![],'where':{'id':_0x292138[_0x8752('0x43')]['id']}},_0x4c32bd={};_0x4c32bd[_0x8752('0x2e')]=_[_0x8752('0x30')](db[_0x8752('0x29')][_0x8752('0x2a')]);_0x4c32bd['query']=_[_0x8752('0x30')](_0x292138[_0x8752('0x2f')]);_0x4c32bd[_0x8752('0x31')]=_[_0x8752('0x44')](_0x4c32bd[_0x8752('0x2e')],_0x4c32bd[_0x8752('0x2f')]);_0xaebff1[_0x8752('0x33')]=_[_0x8752('0x44')](_0x4c32bd[_0x8752('0x2e')],qs[_0x8752('0x32')](_0x292138['query']['fields']));_0xaebff1['attributes']=_0xaebff1[_0x8752('0x33')][_0x8752('0x34')]?_0xaebff1[_0x8752('0x33')]:_0x4c32bd[_0x8752('0x2e')];if(_0x292138[_0x8752('0x2f')][_0x8752('0x3e')]){_0xaebff1[_0x8752('0x3f')]=[{'all':!![]}];}_0xaebff1=_[_0x8752('0x3a')]({},_0xaebff1,_0x292138['options']);return db['SugarcrmField'][_0x8752('0x45')](_0xaebff1)['then'](handleEntityNotFound(_0xadd218,null))[_0x8752('0x21')](respondWithResult(_0xadd218,null))[_0x8752('0x41')](handleError(_0xadd218,null));};exports[_0x8752('0x46')]=function(_0x5b862c,_0x4079b5){return db[_0x8752('0x29')][_0x8752('0x46')](_0x5b862c[_0x8752('0x47')],{})[_0x8752('0x21')](respondWithResult(_0x4079b5,0xc9))[_0x8752('0x41')](handleError(_0x4079b5,null));};exports[_0x8752('0x20')]=function(_0x4769cc,_0x2a9b17){if(_0x4769cc[_0x8752('0x47')]['id']){delete _0x4769cc[_0x8752('0x47')]['id'];}return db['SugarcrmField'][_0x8752('0x45')]({'where':{'id':_0x4769cc[_0x8752('0x43')]['id']}})[_0x8752('0x21')](handleEntityNotFound(_0x2a9b17,null))[_0x8752('0x21')](saveUpdates(_0x4769cc[_0x8752('0x47')],null))['then'](respondWithResult(_0x2a9b17,null))[_0x8752('0x41')](handleError(_0x2a9b17,null));};exports[_0x8752('0x22')]=function(_0x558ec2,_0x5c0a94){return db[_0x8752('0x29')]['find']({'where':{'id':_0x558ec2[_0x8752('0x43')]['id']}})[_0x8752('0x21')](handleEntityNotFound(_0x5c0a94,null))[_0x8752('0x21')](removeEntity(_0x5c0a94,null))[_0x8752('0x41')](handleError(_0x5c0a94,null));}; \ No newline at end of file +var _0x92af=['hasOwnProperty','sort','where','pick','merge','VIRTUAL','SugarcrmField','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','map','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x92af,0xd5));var _0xf92a=function(_0x36b770,_0x36dc27){_0x36b770=_0x36b770-0x0;var _0x47d3c2=_0x92af[_0x36b770];return _0x47d3c2;};'use strict';var pdf=require(_0xf92a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf92a('0x1'));var zipdir=require(_0xf92a('0x2'));var jsonpatch=require(_0xf92a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf92a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf92a('0x5'));var sox=require('sox');var csv=require(_0xf92a('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf92a('0x7'));var squel=require('squel');var crypto=require(_0xf92a('0x8'));var jsforce=require(_0xf92a('0x9'));var deskjs=require(_0xf92a('0xa'));var toCsv=require(_0xf92a('0x6'));var querystring=require(_0xf92a('0xb'));var Papa=require('papaparse');var Redis=require(_0xf92a('0xc'));var authService=require(_0xf92a('0xd'));var qs=require(_0xf92a('0xe'));var as=require(_0xf92a('0xf'));var hardwareService=require(_0xf92a('0x10'));var logger=require(_0xf92a('0x11'))(_0xf92a('0x12'));var utils=require(_0xf92a('0x13'));var config=require(_0xf92a('0x14'));var db=require(_0xf92a('0x15'))['db'];function respondWithStatusCode(_0x10b947,_0x3b0b8b){_0x3b0b8b=_0x3b0b8b||0xcc;return function(_0x34de48){if(_0x34de48){return _0x10b947[_0xf92a('0x16')](_0x3b0b8b);}return _0x10b947[_0xf92a('0x17')](_0x3b0b8b)['end']();};}function respondWithResult(_0x427dda,_0x200ed4){_0x200ed4=_0x200ed4||0xc8;return function(_0x24f1a6){if(_0x24f1a6){return _0x427dda[_0xf92a('0x17')](_0x200ed4)['json'](_0x24f1a6);}};}function respondWithFilteredResult(_0x211f34,_0x56809e){return function(_0x5a3ac3){if(_0x5a3ac3){var _0x4d7e22=_0x5a3ac3[_0xf92a('0x18')],_0x2b66b3=_0x56809e[_0xf92a('0x19')],_0x284489=_0x56809e[_0xf92a('0x19')]+_0x56809e[_0xf92a('0x1a')],_0x1a52e7;if(_0x284489>=_0x4d7e22){_0x284489=_0x4d7e22;_0x1a52e7=0xc8;}else{_0x1a52e7=0xce;}_0x211f34[_0xf92a('0x17')](_0x1a52e7);return _0x211f34[_0xf92a('0x1b')](_0xf92a('0x1c'),_0x2b66b3+'-'+_0x284489+'/'+_0x4d7e22)['json'](_0x5a3ac3);}return null;};}function patchUpdates(_0x5c9973){return function(_0x2d00f3){try{jsonpatch[_0xf92a('0x1d')](_0x2d00f3,_0x5c9973,!![]);}catch(_0x587fae){return BPromise[_0xf92a('0x1e')](_0x587fae);}return _0x2d00f3[_0xf92a('0x1f')]();};}function saveUpdates(_0x1c1b02,_0x1a035a){return function(_0x3607d1){if(_0x3607d1){return _0x3607d1[_0xf92a('0x20')](_0x1c1b02)['then'](function(_0xf9061b){return _0xf9061b;});}return null;};}function removeEntity(_0x1e7bed,_0x583758){return function(_0x2fa37e){if(_0x2fa37e){return _0x2fa37e[_0xf92a('0x21')]()[_0xf92a('0x22')](function(){_0x1e7bed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x584c55,_0xe1dfdc){return function(_0xc6d819){if(!_0xc6d819){_0x584c55[_0xf92a('0x16')](0x194);}return _0xc6d819;};}function handleError(_0x729fb4,_0x1824a1){_0x1824a1=_0x1824a1||0x1f4;return function(_0x26f443){logger['error'](_0x26f443[_0xf92a('0x23')]);if(_0x26f443[_0xf92a('0x24')]){delete _0x26f443[_0xf92a('0x24')];}_0x729fb4[_0xf92a('0x17')](_0x1824a1)[_0xf92a('0x25')](_0x26f443);};}exports['index']=function(_0x52e03e,_0x3707e4){var _0xa8787e={},_0x142017={},_0x59239a={'count':0x0,'rows':[]};var _0x408067=_[_0xf92a('0x26')](db['SugarcrmField']['rawAttributes'],function(_0x3a11fb){return{'name':_0x3a11fb['fieldName'],'type':_0x3a11fb['type']['key']};});_0x142017['model']=_[_0xf92a('0x26')](_0x408067,_0xf92a('0x24'));_0x142017[_0xf92a('0x27')]=_[_0xf92a('0x28')](_0x52e03e[_0xf92a('0x27')]);_0x142017[_0xf92a('0x29')]=_[_0xf92a('0x2a')](_0x142017[_0xf92a('0x2b')],_0x142017[_0xf92a('0x27')]);_0xa8787e[_0xf92a('0x2c')]=_[_0xf92a('0x2a')](_0x142017[_0xf92a('0x2b')],qs['fields'](_0x52e03e[_0xf92a('0x27')][_0xf92a('0x2d')]));_0xa8787e['attributes']=_0xa8787e['attributes'][_0xf92a('0x2e')]?_0xa8787e['attributes']:_0x142017[_0xf92a('0x2b')];if(!_0x52e03e[_0xf92a('0x27')][_0xf92a('0x2f')]('nolimit')){_0xa8787e['limit']=qs['limit'](_0x52e03e[_0xf92a('0x27')][_0xf92a('0x1a')]);_0xa8787e['offset']=qs['offset'](_0x52e03e[_0xf92a('0x27')][_0xf92a('0x19')]);}_0xa8787e['order']=qs[_0xf92a('0x30')](_0x52e03e[_0xf92a('0x27')][_0xf92a('0x30')]);_0xa8787e[_0xf92a('0x31')]=qs[_0xf92a('0x29')](_[_0xf92a('0x32')](_0x52e03e['query'],_0x142017['filters']));if(_0x52e03e['query']['filter']){_0xa8787e[_0xf92a('0x31')]=_[_0xf92a('0x33')](_0xa8787e[_0xf92a('0x31')],{'$or':_[_0xf92a('0x26')](_0x408067,function(_0x397b53){if(_0x397b53['type']!==_0xf92a('0x34')){var _0x3d1aa0={};_0x3d1aa0[_0x397b53[_0xf92a('0x24')]]={'$like':'%'+_0x52e03e[_0xf92a('0x27')]['filter']+'%'};return _0x3d1aa0;}})});}_0xa8787e=_[_0xf92a('0x33')]({},_0xa8787e,_0x52e03e['options']);var _0x12b5e9={'where':_0xa8787e[_0xf92a('0x31')]};return db[_0xf92a('0x35')][_0xf92a('0x18')](_0x12b5e9)[_0xf92a('0x22')](function(_0x53578a){_0x59239a[_0xf92a('0x18')]=_0x53578a;if(_0x52e03e[_0xf92a('0x27')][_0xf92a('0x36')]){_0xa8787e[_0xf92a('0x37')]=[{'all':!![]}];}return db[_0xf92a('0x35')][_0xf92a('0x38')](_0xa8787e);})[_0xf92a('0x22')](function(_0x145e1d){_0x59239a[_0xf92a('0x39')]=_0x145e1d;return _0x59239a;})[_0xf92a('0x22')](respondWithFilteredResult(_0x3707e4,_0xa8787e))[_0xf92a('0x3a')](handleError(_0x3707e4,null));};exports[_0xf92a('0x3b')]=function(_0x32a90f,_0x577f98){var _0x17de3f={'raw':!![],'where':{'id':_0x32a90f[_0xf92a('0x3c')]['id']}},_0x3c60f4={};_0x3c60f4[_0xf92a('0x2b')]=_['keys'](db[_0xf92a('0x35')]['rawAttributes']);_0x3c60f4[_0xf92a('0x27')]=_['keys'](_0x32a90f[_0xf92a('0x27')]);_0x3c60f4[_0xf92a('0x29')]=_[_0xf92a('0x2a')](_0x3c60f4[_0xf92a('0x2b')],_0x3c60f4[_0xf92a('0x27')]);_0x17de3f[_0xf92a('0x2c')]=_[_0xf92a('0x2a')](_0x3c60f4['model'],qs['fields'](_0x32a90f['query'][_0xf92a('0x2d')]));_0x17de3f[_0xf92a('0x2c')]=_0x17de3f[_0xf92a('0x2c')][_0xf92a('0x2e')]?_0x17de3f[_0xf92a('0x2c')]:_0x3c60f4[_0xf92a('0x2b')];if(_0x32a90f[_0xf92a('0x27')][_0xf92a('0x36')]){_0x17de3f[_0xf92a('0x37')]=[{'all':!![]}];}_0x17de3f=_[_0xf92a('0x33')]({},_0x17de3f,_0x32a90f[_0xf92a('0x3d')]);return db['SugarcrmField'][_0xf92a('0x3e')](_0x17de3f)[_0xf92a('0x22')](handleEntityNotFound(_0x577f98,null))[_0xf92a('0x22')](respondWithResult(_0x577f98,null))[_0xf92a('0x3a')](handleError(_0x577f98,null));};exports[_0xf92a('0x3f')]=function(_0x350ade,_0x290889){return db[_0xf92a('0x35')]['create'](_0x350ade[_0xf92a('0x40')],{})[_0xf92a('0x22')](respondWithResult(_0x290889,0xc9))[_0xf92a('0x3a')](handleError(_0x290889,null));};exports['update']=function(_0x416d7a,_0xe2dffd){if(_0x416d7a[_0xf92a('0x40')]['id']){delete _0x416d7a[_0xf92a('0x40')]['id'];}return db[_0xf92a('0x35')]['find']({'where':{'id':_0x416d7a[_0xf92a('0x3c')]['id']}})[_0xf92a('0x22')](handleEntityNotFound(_0xe2dffd,null))['then'](saveUpdates(_0x416d7a[_0xf92a('0x40')],null))[_0xf92a('0x22')](respondWithResult(_0xe2dffd,null))['catch'](handleError(_0xe2dffd,null));};exports[_0xf92a('0x21')]=function(_0x446424,_0x4b88ee){return db[_0xf92a('0x35')][_0xf92a('0x3e')]({'where':{'id':_0x446424[_0xf92a('0x3c')]['id']}})[_0xf92a('0x22')](handleEntityNotFound(_0x4b88ee,null))[_0xf92a('0x22')](removeEntity(_0x4b88ee,null))['catch'](handleError(_0x4b88ee,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index f9f29d3..a866185 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 _0x3cee=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3cee,0xf5));var _0xe3ce=function(_0x998f3c,_0x3fd83b){_0x998f3c=_0x998f3c-0x0;var _0x317d75=_0x3cee[_0x998f3c];return _0x317d75;};'use strict';var _=require(_0xe3ce('0x0'));var util=require(_0xe3ce('0x1'));var logger=require(_0xe3ce('0x2'))(_0xe3ce('0x3'));var moment=require(_0xe3ce('0x4'));var BPromise=require(_0xe3ce('0x5'));var rp=require(_0xe3ce('0x6'));var fs=require('fs');var path=require(_0xe3ce('0x7'));var rimraf=require('rimraf');var config=require(_0xe3ce('0x8'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x5e3ea0,_0x544c47){return _0x5e3ea0[_0xe3ce('0x9')]('SugarcrmField',attributes,{'tableName':_0xe3ce('0xa'),'paranoid':![],'indexes':[{'name':_0xe3ce('0xb'),'fields':[_0xe3ce('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfdaf=['../../config/environment','exports','SugarcrmField','int_sugarcrm_fields','idField','FieldId','util','../../config/logger','bluebird','request-promise','path'];(function(_0x4eda2c,_0x588fdd){var _0x2b8411=function(_0x25b482){while(--_0x25b482){_0x4eda2c['push'](_0x4eda2c['shift']());}};_0x2b8411(++_0x588fdd);}(_0xfdaf,0xa0));var _0xffda=function(_0x3489fb,_0x22edde){_0x3489fb=_0x3489fb-0x0;var _0x3f191e=_0xfdaf[_0x3489fb];return _0x3f191e;};'use strict';var _=require('lodash');var util=require(_0xffda('0x0'));var logger=require(_0xffda('0x1'))('api');var moment=require('moment');var BPromise=require(_0xffda('0x2'));var rp=require(_0xffda('0x3'));var fs=require('fs');var path=require(_0xffda('0x4'));var rimraf=require('rimraf');var config=require(_0xffda('0x5'));var attributes=require('./intSugarcrmField.attributes');module[_0xffda('0x6')]=function(_0x2ca994,_0x3bbd3b){return _0x2ca994['define'](_0xffda('0x7'),attributes,{'tableName':_0xffda('0x8'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xffda('0x9'),_0xffda('0xa')],'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 7a2709a..aa54cad 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.rpc.js +++ b/server/api/intSugarcrmField/intSugarcrmField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x35e787,_0x50bc0a){var _0x34e865=function(_0x1fd6b7){while(--_0x1fd6b7){_0x35e787['push'](_0x35e787['shift']());}};_0x34e865(++_0x50bc0a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x56ffb6,_0x27eab6){_0x56ffb6=_0x56ffb6-0x0;var _0x40b63=_0x5f2f[_0x56ffb6];return _0x40b63;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x4aec7f,_0x4086bb){var _0x183bb1=function(_0x3f6865){while(--_0x3f6865){_0x4aec7f['push'](_0x4aec7f['shift']());}};_0x183bb1(++_0x4086bb);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'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')]('SugarcrmField,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index d34b5c4..74d727b 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 _0xd257=['create','post','addConfiguration','put','update','delete','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0xbd7925,_0x2d046b){var _0x213b72=function(_0x2c9784){while(--_0x2c9784){_0xbd7925['push'](_0xbd7925['shift']());}};_0x213b72(++_0x2d046b);}(_0xd257,0x118));var _0x7d25=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0xd257[_0x18d631];return _0x50d708;};'use strict';var multer=require(_0x7d25('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7d25('0x1'));var express=require(_0x7d25('0x2'));var router=express['Router']();var auth=require(_0x7d25('0x3'));var interaction=require(_0x7d25('0x4'));var config=require(_0x7d25('0x5'));var controller=require(_0x7d25('0x6'));router[_0x7d25('0x7')]('/',auth[_0x7d25('0x8')](),controller['index']);router[_0x7d25('0x7')](_0x7d25('0x9'),auth[_0x7d25('0x8')](),controller['show']);router[_0x7d25('0x7')](_0x7d25('0xa'),auth[_0x7d25('0x8')](),controller[_0x7d25('0xb')]);router[_0x7d25('0x7')](_0x7d25('0xc'),auth[_0x7d25('0x8')](),controller[_0x7d25('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7d25('0xe')]);router[_0x7d25('0xf')](_0x7d25('0xa'),auth[_0x7d25('0x8')](),controller[_0x7d25('0x10')]);router[_0x7d25('0x11')](_0x7d25('0x9'),auth['isAuthenticated'](),controller[_0x7d25('0x12')]);router[_0x7d25('0x13')](_0x7d25('0x9'),auth[_0x7d25('0x8')](),controller['destroy']);module[_0x7d25('0x14')]=router; \ No newline at end of file +var _0xad96=['get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','/:id','update','delete','exports','multer','util','path','../../config/environment','./intVtigerAccount.controller'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0xad96,0x113));var _0x6ad9=function(_0x5b4e88,_0x3c7d1b){_0x5b4e88=_0x5b4e88-0x0;var _0x472526=_0xad96[_0x5b4e88];return _0x472526;};'use strict';var multer=require(_0x6ad9('0x0'));var util=require(_0x6ad9('0x1'));var path=require(_0x6ad9('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(_0x6ad9('0x3'));var controller=require(_0x6ad9('0x4'));router[_0x6ad9('0x5')]('/',auth[_0x6ad9('0x6')](),controller[_0x6ad9('0x7')]);router[_0x6ad9('0x5')]('/:id',auth[_0x6ad9('0x6')](),controller[_0x6ad9('0x8')]);router['get']('/:id/configurations',auth[_0x6ad9('0x6')](),controller[_0x6ad9('0x9')]);router['get'](_0x6ad9('0xa'),auth[_0x6ad9('0x6')](),controller[_0x6ad9('0xb')]);router[_0x6ad9('0xc')]('/',auth[_0x6ad9('0x6')](),controller['create']);router[_0x6ad9('0xc')](_0x6ad9('0xd'),auth[_0x6ad9('0x6')](),controller[_0x6ad9('0xe')]);router[_0x6ad9('0xf')](_0x6ad9('0x10'),auth['isAuthenticated'](),controller[_0x6ad9('0x11')]);router[_0x6ad9('0x12')](_0x6ad9('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x6ad9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index ec45df2..773e1b2 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 _0x43dc=['HelpDesk','sequelize','exports','STRING'];(function(_0x127c7e,_0x470192){var _0x45f955=function(_0x26dcea){while(--_0x26dcea){_0x127c7e['push'](_0x127c7e['shift']());}};_0x45f955(++_0x470192);}(_0x43dc,0x89));var _0xc43d=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x43dc[_0x38537f];return _0x141e23;};'use strict';var Sequelize=require(_0xc43d('0x0'));module[_0xc43d('0x1')]={'name':{'type':Sequelize[_0xc43d('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc43d('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc43d('0x2')],'allowNull':![],'defaultValue':_0xc43d('0x3')},'remoteUri':{'type':Sequelize[_0xc43d('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xc43d('0x2')]},'accessKey':{'type':Sequelize[_0xc43d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4f9f=['exports','STRING','sequelize'];(function(_0x5af97c,_0x24a49f){var _0x3472ae=function(_0x54cdc3){while(--_0x54cdc3){_0x5af97c['push'](_0x5af97c['shift']());}};_0x3472ae(++_0x24a49f);}(_0x4f9f,0xc5));var _0xf4f9=function(_0x482816,_0x35e716){_0x482816=_0x482816-0x0;var _0xb89169=_0x4f9f[_0x482816];return _0xb89169;};'use strict';var Sequelize=require(_0xf4f9('0x0'));module[_0xf4f9('0x1')]={'name':{'type':Sequelize[_0xf4f9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf4f9('0x2')]},'username':{'type':Sequelize[_0xf4f9('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf4f9('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf4f9('0x2')]},'accessKey':{'type':Sequelize[_0xf4f9('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index fb76478..2944f02 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 _0xd1d4=['statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','rimraf','zip-dir','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/environment','../../mysqldb','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','info','result','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','sendStatus','name','send','index','map','VtigerAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','rows','params','include','find','catch','create','body','findOne','VtigerConfiguration','getConfigurations','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','username','description','remoteUri','accessKey','moduleName','slice','substring','lastIndexOf','format','GET','getchallenge','success','login','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','value','log','vTiger\x20error:\x20'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0xd1d4,0x104));var _0x4d1d=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xd1d4[_0x1477ef];return _0x164acd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4d1d('0x0'));var zipdir=require(_0x4d1d('0x1'));var jsonpatch=require(_0x4d1d('0x2'));var rp=require(_0x4d1d('0x3'));var moment=require('moment');var BPromise=require(_0x4d1d('0x4'));var Mustache=require(_0x4d1d('0x5'));var util=require(_0x4d1d('0x6'));var path=require(_0x4d1d('0x7'));var sox=require(_0x4d1d('0x8'));var csv=require(_0x4d1d('0x9'));var ejs=require(_0x4d1d('0xa'));var fs=require('fs');var _=require(_0x4d1d('0xb'));var squel=require(_0x4d1d('0xc'));var crypto=require('crypto');var jsforce=require(_0x4d1d('0xd'));var deskjs=require(_0x4d1d('0xe'));var toCsv=require(_0x4d1d('0x9'));var querystring=require(_0x4d1d('0xf'));var Papa=require(_0x4d1d('0x10'));var Redis=require(_0x4d1d('0x11'));var authService=require(_0x4d1d('0x12'));var qs=require(_0x4d1d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4d1d('0x14'));var db=require(_0x4d1d('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x4d1d('0x16'));var client=jayson[_0x4d1d('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0xab7b01,_0x52aa74,_0x4a9a3b){if(_0x4a9a3b){var _0x275d38=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x275d38[_0x4d1d('0x18')](_0x52aa74)){return _0xab7b01;}else{throw new db['Sequelize'][(_0x4d1d('0x19'))](_0x4d1d('0x1a'));}}else{return _0xab7b01;}}function respondWithRpcPromise(_0x22020a,_0x211c8b,_0x16fb5b,_0x9b361){return new BPromise(function(_0x46ef10,_0x43cd79){var _0x17d2c2=_0x9b361||client;return _0x17d2c2[_0x4d1d('0x1b')](_0x22020a,_0x16fb5b)[_0x4d1d('0x1c')](function(_0x2b7cf1){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x211c8b,_0x4d1d('0x1d'));logger[_0x4d1d('0x1e')](_0x4d1d('0x1f'),_0x211c8b,'request\x20sent',JSON[_0x4d1d('0x20')](_0x2b7cf1));if(_0x2b7cf1['error']){if(_0x2b7cf1[_0x4d1d('0x21')][_0x4d1d('0x22')]===0x1f4){logger['error'](_0x4d1d('0x23'),_0x211c8b,_0x2b7cf1[_0x4d1d('0x21')][_0x4d1d('0x24')]);return _0x43cd79(_0x2b7cf1[_0x4d1d('0x21')][_0x4d1d('0x24')]);}logger[_0x4d1d('0x21')](_0x4d1d('0x23'),_0x211c8b,_0x2b7cf1['error'][_0x4d1d('0x24')]);return _0x46ef10(_0x2b7cf1[_0x4d1d('0x21')]['message']);}else{logger[_0x4d1d('0x25')](_0x4d1d('0x23'),_0x211c8b,_0x4d1d('0x1d'));_0x46ef10(_0x2b7cf1[_0x4d1d('0x26')]['message']);}})['catch'](function(_0x479dd2){logger[_0x4d1d('0x21')](_0x4d1d('0x23'),_0x211c8b,_0x479dd2);_0x43cd79(_0x479dd2);});});}function respondWithStatusCode(_0x1032ca,_0x1f8eb1){_0x1f8eb1=_0x1f8eb1||0xcc;return function(_0x406503){if(_0x406503){return _0x1032ca['sendStatus'](_0x1f8eb1);}return _0x1032ca[_0x4d1d('0x27')](_0x1f8eb1)[_0x4d1d('0x28')]();};}function respondWithResult(_0x362273,_0x8e0ed8){_0x8e0ed8=_0x8e0ed8||0xc8;return function(_0x196d8b){if(_0x196d8b){return _0x362273[_0x4d1d('0x27')](_0x8e0ed8)[_0x4d1d('0x29')](_0x196d8b);}};}function respondWithFilteredResult(_0x7ce5dc,_0x16720e){return function(_0x5be9fd){if(_0x5be9fd){var _0x35253f=_0x5be9fd[_0x4d1d('0x2a')],_0x367fac=_0x16720e['offset'],_0x45f3ce=_0x16720e['offset']+_0x16720e[_0x4d1d('0x2b')],_0x8a69f;if(_0x45f3ce>=_0x35253f){_0x45f3ce=_0x35253f;_0x8a69f=0xc8;}else{_0x8a69f=0xce;}_0x7ce5dc[_0x4d1d('0x27')](_0x8a69f);return _0x7ce5dc[_0x4d1d('0x2c')](_0x4d1d('0x2d'),_0x367fac+'-'+_0x45f3ce+'/'+_0x35253f)[_0x4d1d('0x29')](_0x5be9fd);}return null;};}function patchUpdates(_0x3a139a){return function(_0x3049cf){try{jsonpatch[_0x4d1d('0x2e')](_0x3049cf,_0x3a139a,!![]);}catch(_0x9b4f5b){return BPromise[_0x4d1d('0x2f')](_0x9b4f5b);}return _0x3049cf[_0x4d1d('0x30')]();};}function saveUpdates(_0x2aef7e,_0x6ac390){return function(_0xa2b52f){if(_0xa2b52f){return _0xa2b52f[_0x4d1d('0x31')](_0x2aef7e)['then'](function(_0x2e9714){return _0x2e9714;});}return null;};}function removeEntity(_0x13be29,_0x747d9c){return function(_0x2bd277){if(_0x2bd277){return _0x2bd277['destroy']()[_0x4d1d('0x1c')](function(){_0x13be29[_0x4d1d('0x27')](0xcc)[_0x4d1d('0x28')]();});}};}function handleEntityNotFound(_0x230d2f,_0x4eb2ba){return function(_0x1cb9f3){if(!_0x1cb9f3){_0x230d2f[_0x4d1d('0x32')](0x194);}return _0x1cb9f3;};}function handleError(_0x1ebadc,_0x280762){_0x280762=_0x280762||0x1f4;return function(_0x5e277b){logger[_0x4d1d('0x21')](_0x5e277b['stack']);if(_0x5e277b[_0x4d1d('0x33')]){delete _0x5e277b['name'];}_0x1ebadc['status'](_0x280762)[_0x4d1d('0x34')](_0x5e277b);};}exports[_0x4d1d('0x35')]=function(_0x3cb1e2,_0x17b414){var _0x55ddda={},_0x1a054a={},_0x2c23b1={'count':0x0,'rows':[]};var _0x330eca=_[_0x4d1d('0x36')](db[_0x4d1d('0x37')][_0x4d1d('0x38')],function(_0x4bb20a){return{'name':_0x4bb20a[_0x4d1d('0x39')],'type':_0x4bb20a['type'][_0x4d1d('0x3a')]};});_0x1a054a['model']=_['map'](_0x330eca,_0x4d1d('0x33'));_0x1a054a[_0x4d1d('0x3b')]=_[_0x4d1d('0x3c')](_0x3cb1e2[_0x4d1d('0x3b')]);_0x1a054a[_0x4d1d('0x3d')]=_[_0x4d1d('0x3e')](_0x1a054a[_0x4d1d('0x3f')],_0x1a054a[_0x4d1d('0x3b')]);_0x55ddda[_0x4d1d('0x40')]=_[_0x4d1d('0x3e')](_0x1a054a[_0x4d1d('0x3f')],qs[_0x4d1d('0x41')](_0x3cb1e2['query'][_0x4d1d('0x41')]));_0x55ddda[_0x4d1d('0x40')]=_0x55ddda[_0x4d1d('0x40')][_0x4d1d('0x42')]?_0x55ddda['attributes']:_0x1a054a['model'];if(!_0x3cb1e2[_0x4d1d('0x3b')][_0x4d1d('0x43')](_0x4d1d('0x44'))){_0x55ddda[_0x4d1d('0x2b')]=qs['limit'](_0x3cb1e2[_0x4d1d('0x3b')]['limit']);_0x55ddda[_0x4d1d('0x45')]=qs[_0x4d1d('0x45')](_0x3cb1e2['query'][_0x4d1d('0x45')]);}_0x55ddda[_0x4d1d('0x46')]=qs[_0x4d1d('0x47')](_0x3cb1e2[_0x4d1d('0x3b')]['sort']);_0x55ddda['where']=qs['filters'](_[_0x4d1d('0x48')](_0x3cb1e2[_0x4d1d('0x3b')],_0x1a054a[_0x4d1d('0x3d')]));if(_0x3cb1e2[_0x4d1d('0x3b')]['filter']){_0x55ddda[_0x4d1d('0x49')]=_[_0x4d1d('0x4a')](_0x55ddda[_0x4d1d('0x49')],{'$or':_[_0x4d1d('0x36')](_0x330eca,function(_0x213a38){if(_0x213a38[_0x4d1d('0x4b')]!==_0x4d1d('0x4c')){var _0x321a7c={};_0x321a7c[_0x213a38[_0x4d1d('0x33')]]={'$like':'%'+_0x3cb1e2['query'][_0x4d1d('0x4d')]+'%'};return _0x321a7c;}})});}_0x55ddda=_[_0x4d1d('0x4a')]({},_0x55ddda,_0x3cb1e2[_0x4d1d('0x4e')]);var _0x609aa={'where':_0x55ddda['where']};return db[_0x4d1d('0x37')][_0x4d1d('0x2a')](_0x609aa)['then'](function(_0x4edeaa){_0x2c23b1[_0x4d1d('0x2a')]=_0x4edeaa;if(_0x3cb1e2['query'][_0x4d1d('0x4f')]){_0x55ddda['include']=[{'all':!![]}];}return db[_0x4d1d('0x37')]['findAll'](_0x55ddda);})[_0x4d1d('0x1c')](function(_0x3bda18){_0x2c23b1[_0x4d1d('0x50')]=_0x3bda18;return _0x2c23b1;})[_0x4d1d('0x1c')](respondWithFilteredResult(_0x17b414,_0x55ddda))['catch'](handleError(_0x17b414,null));};exports['show']=function(_0x1c71e7,_0x4106a8){var _0x3ab979={'raw':![],'where':{'id':_0x1c71e7[_0x4d1d('0x51')]['id']}},_0x3602eb={};_0x3602eb[_0x4d1d('0x3f')]=_[_0x4d1d('0x3c')](db[_0x4d1d('0x37')]['rawAttributes']);_0x3602eb[_0x4d1d('0x3b')]=_[_0x4d1d('0x3c')](_0x1c71e7[_0x4d1d('0x3b')]);_0x3602eb['filters']=_[_0x4d1d('0x3e')](_0x3602eb['model'],_0x3602eb[_0x4d1d('0x3b')]);_0x3ab979[_0x4d1d('0x40')]=_[_0x4d1d('0x3e')](_0x3602eb['model'],qs[_0x4d1d('0x41')](_0x1c71e7[_0x4d1d('0x3b')][_0x4d1d('0x41')]));_0x3ab979[_0x4d1d('0x40')]=_0x3ab979[_0x4d1d('0x40')]['length']?_0x3ab979['attributes']:_0x3602eb[_0x4d1d('0x3f')];if(_0x1c71e7[_0x4d1d('0x3b')][_0x4d1d('0x4f')]){_0x3ab979[_0x4d1d('0x52')]=[{'all':!![]}];}_0x3ab979=_['merge']({},_0x3ab979,_0x1c71e7[_0x4d1d('0x4e')]);return db[_0x4d1d('0x37')][_0x4d1d('0x53')](_0x3ab979)[_0x4d1d('0x1c')](handleEntityNotFound(_0x4106a8,null))[_0x4d1d('0x1c')](respondWithResult(_0x4106a8,null))[_0x4d1d('0x54')](handleError(_0x4106a8,null));};exports[_0x4d1d('0x55')]=function(_0x58ae07,_0x472617){return db['VtigerAccount']['create'](_0x58ae07[_0x4d1d('0x56')],{})[_0x4d1d('0x1c')](respondWithResult(_0x472617,0xc9))['catch'](handleError(_0x472617,null));};exports[_0x4d1d('0x31')]=function(_0x3fec86,_0x300f6e){if(_0x3fec86[_0x4d1d('0x56')]['id']){delete _0x3fec86['body']['id'];}return db[_0x4d1d('0x37')][_0x4d1d('0x53')]({'where':{'id':_0x3fec86['params']['id']}})[_0x4d1d('0x1c')](handleEntityNotFound(_0x300f6e,null))[_0x4d1d('0x1c')](saveUpdates(_0x3fec86[_0x4d1d('0x56')],null))[_0x4d1d('0x1c')](respondWithResult(_0x300f6e,null))['catch'](handleError(_0x300f6e,null));};exports['destroy']=function(_0x4f2f2d,_0x180b02){return db[_0x4d1d('0x37')][_0x4d1d('0x53')]({'where':{'id':_0x4f2f2d['params']['id']}})['then'](handleEntityNotFound(_0x180b02,null))[_0x4d1d('0x1c')](removeEntity(_0x180b02,null))[_0x4d1d('0x54')](handleError(_0x180b02,null));};exports['getConfigurations']=function(_0x179995,_0x3712d4,_0xe176f5){var _0x409924={};var _0x432a2f={};var _0x251135;var _0x708976;return db[_0x4d1d('0x37')][_0x4d1d('0x57')]({'where':{'id':_0x179995[_0x4d1d('0x51')]['id']}})['then'](handleEntityNotFound(_0x3712d4,null))['then'](function(_0x2e7c7b){if(_0x2e7c7b){_0x251135=_0x2e7c7b;_0x432a2f[_0x4d1d('0x3f')]=_[_0x4d1d('0x3c')](db[_0x4d1d('0x58')][_0x4d1d('0x38')]);_0x432a2f[_0x4d1d('0x3b')]=_['keys'](_0x179995[_0x4d1d('0x3b')]);_0x432a2f[_0x4d1d('0x3d')]=_['intersection'](_0x432a2f['model'],_0x432a2f[_0x4d1d('0x3b')]);_0x409924[_0x4d1d('0x40')]=_['intersection'](_0x432a2f['model'],qs[_0x4d1d('0x41')](_0x179995['query'][_0x4d1d('0x41')]));_0x409924[_0x4d1d('0x40')]=_0x409924[_0x4d1d('0x40')][_0x4d1d('0x42')]?_0x409924[_0x4d1d('0x40')]:_0x432a2f[_0x4d1d('0x3f')];_0x409924[_0x4d1d('0x46')]=qs[_0x4d1d('0x47')](_0x179995[_0x4d1d('0x3b')][_0x4d1d('0x47')]);_0x409924['where']=qs[_0x4d1d('0x3d')](_[_0x4d1d('0x48')](_0x179995[_0x4d1d('0x3b')],_0x432a2f[_0x4d1d('0x3d')]));if(_0x179995[_0x4d1d('0x3b')]['filter']){_0x409924[_0x4d1d('0x49')]=_['merge'](_0x409924[_0x4d1d('0x49')],{'$or':_[_0x4d1d('0x36')](_0x409924[_0x4d1d('0x40')],function(_0x285cc8){var _0x5e8f11={};_0x5e8f11[_0x285cc8]={'$like':'%'+_0x179995[_0x4d1d('0x3b')][_0x4d1d('0x4d')]+'%'};return _0x5e8f11;})});}_0x409924=_[_0x4d1d('0x4a')]({},_0x409924,_0x179995[_0x4d1d('0x4e')]);return _0x251135[_0x4d1d('0x59')](_0x409924);}})[_0x4d1d('0x1c')](function(_0x4ed188){if(_0x4ed188){_0x708976=_0x4ed188[_0x4d1d('0x42')];if(!_0x179995[_0x4d1d('0x3b')]['hasOwnProperty'](_0x4d1d('0x44'))){_0x409924[_0x4d1d('0x2b')]=qs[_0x4d1d('0x2b')](_0x179995[_0x4d1d('0x3b')][_0x4d1d('0x2b')]);_0x409924[_0x4d1d('0x45')]=qs[_0x4d1d('0x45')](_0x179995[_0x4d1d('0x3b')][_0x4d1d('0x45')]);}return _0x251135['getConfigurations'](_0x409924);}})[_0x4d1d('0x1c')](function(_0x39f7c9){if(_0x39f7c9){return _0x39f7c9?{'count':_0x708976,'rows':_0x39f7c9}:null;}})[_0x4d1d('0x1c')](respondWithResult(_0x3712d4,null))[_0x4d1d('0x54')](handleError(_0x3712d4,null));};exports['addConfiguration']=function(_0xe8f012,_0x47f2ba,_0x231ecc){if(_0xe8f012[_0x4d1d('0x56')]['id']){delete _0xe8f012[_0x4d1d('0x56')]['id'];}return db[_0x4d1d('0x37')]['findOne']({'where':{'id':_0xe8f012[_0x4d1d('0x51')]['id']}})[_0x4d1d('0x1c')](handleEntityNotFound(_0x47f2ba,null))[_0x4d1d('0x1c')](function(_0x240c39){if(_0x240c39){_0xe8f012[_0x4d1d('0x56')]['AccountId']=_0x240c39['id'];_0xe8f012[_0x4d1d('0x56')][_0x4d1d('0x5a')]=integrations[_0x4d1d('0x5b')](_0xe8f012[_0x4d1d('0x56')][_0x4d1d('0x5c')],_0xe8f012[_0x4d1d('0x56')][_0x4d1d('0x4b')]);_0xe8f012[_0x4d1d('0x56')][_0x4d1d('0x5d')]=integrations[_0x4d1d('0x5e')](_0xe8f012['body']['channel'],_0xe8f012[_0x4d1d('0x56')][_0x4d1d('0x4b')]);return db[_0x4d1d('0x58')][_0x4d1d('0x55')](_0xe8f012[_0x4d1d('0x56')],{'include':[{'model':db[_0x4d1d('0x5f')],'as':_0x4d1d('0x5a')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x47f2ba,null))[_0x4d1d('0x54')](handleError(_0x47f2ba,null));};var md5=require(_0x4d1d('0x60'));exports['getFields']=function(_0x3f448f,_0x4ce0a1,_0x9106f7){var _0x59ef4c=null;var _0x590597=null;var _0x33f2be=null;var _0x48571f=null;var _0x3c9f47='';return db[_0x4d1d('0x37')]['findOne']({'where':{'id':_0x3f448f[_0x4d1d('0x51')]['id']},'attributes':['id',_0x4d1d('0x33'),_0x4d1d('0x61'),_0x4d1d('0x62'),'moduleName',_0x4d1d('0x63'),'serverUrl',_0x4d1d('0x64')]})[_0x4d1d('0x1c')](handleEntityNotFound(_0x4ce0a1,null))[_0x4d1d('0x1c')](function(_0x23bd6d){if(_0x23bd6d){_0x59ef4c=_0x23bd6d[_0x4d1d('0x61')];_0x590597=_0x23bd6d[_0x4d1d('0x64')];_0x33f2be=_0x23bd6d[_0x4d1d('0x65')];_0x3c9f47=_0x23bd6d[_0x4d1d('0x63')];var _0x28b553=_0x3c9f47[_0x4d1d('0x66')](-0x1);if(_0x28b553==='/'){_0x3c9f47=_0x3c9f47[_0x4d1d('0x67')](0x0,_0x3c9f47[_0x4d1d('0x68')](_0x28b553));}_0x48571f=util[_0x4d1d('0x69')]('%s/webservice.php',_0x3c9f47);var _0x29d276={'method':_0x4d1d('0x6a'),'uri':_0x48571f,'qs':{'operation':_0x4d1d('0x6b'),'username':_0x23bd6d['username']},'json':!![]};return rp(_0x29d276);}})[_0x4d1d('0x1c')](function(_0x3635a9){if(_0x3635a9[_0x4d1d('0x6c')]){var _0x478f45={'method':'POST','uri':_0x48571f,'form':{'operation':_0x4d1d('0x6d'),'username':_0x59ef4c,'accessKey':md5(_0x3635a9[_0x4d1d('0x26')]['token']+_0x590597)},'json':!![]};return rp(_0x478f45);}})[_0x4d1d('0x1c')](function(_0x5899c6){if(_0x5899c6[_0x4d1d('0x6c')]){var _0x5f4c79={'method':_0x4d1d('0x6a'),'uri':_0x48571f,'qs':{'operation':'describe','username':_0x59ef4c,'sessionName':_0x5899c6[_0x4d1d('0x26')]['sessionName'],'elementType':_0x33f2be},'json':!![]};return rp(_0x5f4c79);}})['then'](function(_0x241812){if(_0x241812[_0x4d1d('0x6c')]){var _0xf17967=[_0x4d1d('0x6e'),_0x4d1d('0x6f'),_0x4d1d('0x70')];_[_0x4d1d('0x71')](_0x241812[_0x4d1d('0x26')][_0x4d1d('0x41')],function(_0x4292c9){return _0xf17967[_0x4d1d('0x72')](_0x4292c9[_0x4d1d('0x4b')]['name']);});_[_0x4d1d('0x71')](_0x241812[_0x4d1d('0x26')][_0x4d1d('0x41')],function(_0x24a29c){return _0x24a29c[_0x4d1d('0x73')]===_0x4d1d('0x74');});return{'count':_0x241812[_0x4d1d('0x26')][_0x4d1d('0x41')][_0x4d1d('0x42')],'rows':_['map'](_0x241812[_0x4d1d('0x26')][_0x4d1d('0x41')],function(_0x5daa2d){return{'id':_0x5daa2d[_0x4d1d('0x33')],'name':_0x5daa2d[_0x4d1d('0x75')],'custom':_[_0x4d1d('0x76')](_0x5daa2d['name'],_0x4d1d('0x77'))?!![]:![],'options':_0x5daa2d[_0x4d1d('0x4b')]['name']===_0x4d1d('0x78')&&_0x5daa2d[_0x4d1d('0x4b')]['picklistValues'][_0x4d1d('0x42')]>0x0?_[_0x4d1d('0x36')](_0x5daa2d['type']['picklistValues'],function(_0x30742a){return{'name':_0x30742a[_0x4d1d('0x75')],'value':_0x30742a[_0x4d1d('0x79')]};}):[]};})};}})['then'](respondWithResult(_0x4ce0a1,null))['catch'](function(_0x37c073){console[_0x4d1d('0x7a')](_0x4d1d('0x7b')+_0x37c073);var _0x3abdad=_0x3f448f[_0x4d1d('0x3b')][_0x4d1d('0x18')]?0x1f4:_0x37c073[_0x4d1d('0x7c')]||0x1f4;logger[_0x4d1d('0x21')](_0x4d1d('0x7d'),_0x4d1d('0x7e'),_0x3abdad,JSON[_0x4d1d('0x20')](_0x37c073));delete _0x37c073['name'];if(_0x3abdad===0x191){_0x3abdad=0x190;}_0x4ce0a1['status'](_0x3abdad)['send'](_0x3f448f['query']['test']?{'message':_0x4d1d('0x7f'),'statusCode':_0x37c073[_0x4d1d('0x7c')]}:_0x37c073);});}; \ No newline at end of file +var _0xd236=['sendStatus','status','count','offset','limit','set','json','apply','reject','save','update','destroy','end','stack','name','send','index','map','VtigerAccount','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','show','params','rawAttributes','intersection','options','find','create','body','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','username','description','moduleName','serverUrl','accessKey','slice','substring','lastIndexOf','%s/webservice.php','GET','POST','login','token','describe','success','owner','includes','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xd236,0x1e5));var _0x6d23=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xd236[_0x2112d4];return _0x434972;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6d23('0x0'));var rimraf=require(_0x6d23('0x1'));var zipdir=require(_0x6d23('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d23('0x3'));var moment=require(_0x6d23('0x4'));var BPromise=require(_0x6d23('0x5'));var Mustache=require('mustache');var util=require(_0x6d23('0x6'));var path=require(_0x6d23('0x7'));var sox=require(_0x6d23('0x8'));var csv=require('to-csv');var ejs=require(_0x6d23('0x9'));var fs=require('fs');var _=require(_0x6d23('0xa'));var squel=require('squel');var crypto=require(_0x6d23('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6d23('0xc'));var toCsv=require(_0x6d23('0xd'));var querystring=require(_0x6d23('0xe'));var Papa=require(_0x6d23('0xf'));var Redis=require(_0x6d23('0x10'));var authService=require(_0x6d23('0x11'));var qs=require(_0x6d23('0x12'));var as=require(_0x6d23('0x13'));var hardwareService=require(_0x6d23('0x14'));var logger=require(_0x6d23('0x15'))(_0x6d23('0x16'));var utils=require('../../config/utils');var config=require(_0x6d23('0x17'));var db=require(_0x6d23('0x18'))['db'];var integrations=require(_0x6d23('0x19'));var jayson=require(_0x6d23('0x1a'));var client=jayson[_0x6d23('0x1b')][_0x6d23('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3c9e3f,_0x3b689c,_0xfcae0d){if(_0xfcae0d){var _0x240c26=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x240c26[_0x6d23('0x1d')](_0x3b689c)){return _0x3c9e3f;}else{throw new db[(_0x6d23('0x1e'))][(_0x6d23('0x1f'))](_0x6d23('0x20'));}}else{return _0x3c9e3f;}}function respondWithRpcPromise(_0x5d7328,_0x5bc337,_0x66f1d9,_0x25e785){return new BPromise(function(_0x157fc9,_0x22d43b){var _0x40a640=_0x25e785||client;return _0x40a640['request'](_0x5d7328,_0x66f1d9)[_0x6d23('0x21')](function(_0x115ec0){logger[_0x6d23('0x22')](_0x6d23('0x23'),_0x5bc337,_0x6d23('0x24'));logger[_0x6d23('0x25')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x5bc337,'request\x20sent',JSON['stringify'](_0x115ec0));if(_0x115ec0[_0x6d23('0x26')]){if(_0x115ec0[_0x6d23('0x26')][_0x6d23('0x27')]===0x1f4){logger[_0x6d23('0x26')](_0x6d23('0x23'),_0x5bc337,_0x115ec0[_0x6d23('0x26')]['message']);return _0x22d43b(_0x115ec0[_0x6d23('0x26')][_0x6d23('0x28')]);}logger['error'](_0x6d23('0x23'),_0x5bc337,_0x115ec0['error'][_0x6d23('0x28')]);return _0x157fc9(_0x115ec0[_0x6d23('0x26')][_0x6d23('0x28')]);}else{logger['info'](_0x6d23('0x23'),_0x5bc337,_0x6d23('0x24'));_0x157fc9(_0x115ec0[_0x6d23('0x29')][_0x6d23('0x28')]);}})[_0x6d23('0x2a')](function(_0x5633b0){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x5bc337,_0x5633b0);_0x22d43b(_0x5633b0);});});}function respondWithStatusCode(_0x123f31,_0x591fb6){_0x591fb6=_0x591fb6||0xcc;return function(_0x24af46){if(_0x24af46){return _0x123f31[_0x6d23('0x2b')](_0x591fb6);}return _0x123f31['status'](_0x591fb6)['end']();};}function respondWithResult(_0x496dbc,_0x249695){_0x249695=_0x249695||0xc8;return function(_0x102375){if(_0x102375){return _0x496dbc[_0x6d23('0x2c')](_0x249695)['json'](_0x102375);}};}function respondWithFilteredResult(_0xbd18da,_0x2ca0ce){return function(_0xb046ef){if(_0xb046ef){var _0x5358ef=_0xb046ef[_0x6d23('0x2d')],_0x5b0d63=_0x2ca0ce[_0x6d23('0x2e')],_0x2ee190=_0x2ca0ce[_0x6d23('0x2e')]+_0x2ca0ce[_0x6d23('0x2f')],_0x15b509;if(_0x2ee190>=_0x5358ef){_0x2ee190=_0x5358ef;_0x15b509=0xc8;}else{_0x15b509=0xce;}_0xbd18da[_0x6d23('0x2c')](_0x15b509);return _0xbd18da[_0x6d23('0x30')]('Content-Range',_0x5b0d63+'-'+_0x2ee190+'/'+_0x5358ef)[_0x6d23('0x31')](_0xb046ef);}return null;};}function patchUpdates(_0x578323){return function(_0x36ee4b){try{jsonpatch[_0x6d23('0x32')](_0x36ee4b,_0x578323,!![]);}catch(_0xb1e602){return BPromise[_0x6d23('0x33')](_0xb1e602);}return _0x36ee4b[_0x6d23('0x34')]();};}function saveUpdates(_0x21a744,_0x14b6e8){return function(_0x42403e){if(_0x42403e){return _0x42403e[_0x6d23('0x35')](_0x21a744)[_0x6d23('0x21')](function(_0x6b8661){return _0x6b8661;});}return null;};}function removeEntity(_0x333d3d,_0x1edc5f){return function(_0x58b111){if(_0x58b111){return _0x58b111[_0x6d23('0x36')]()[_0x6d23('0x21')](function(){_0x333d3d[_0x6d23('0x2c')](0xcc)[_0x6d23('0x37')]();});}};}function handleEntityNotFound(_0x3a18ed,_0x5dfce1){return function(_0x20b9a4){if(!_0x20b9a4){_0x3a18ed['sendStatus'](0x194);}return _0x20b9a4;};}function handleError(_0x5cbfca,_0x48c353){_0x48c353=_0x48c353||0x1f4;return function(_0x24fad5){logger[_0x6d23('0x26')](_0x24fad5[_0x6d23('0x38')]);if(_0x24fad5[_0x6d23('0x39')]){delete _0x24fad5[_0x6d23('0x39')];}_0x5cbfca[_0x6d23('0x2c')](_0x48c353)[_0x6d23('0x3a')](_0x24fad5);};}exports[_0x6d23('0x3b')]=function(_0x10bce1,_0x170202){var _0x4c356a={},_0x340dac={},_0x14166f={'count':0x0,'rows':[]};var _0xccf5d8=_[_0x6d23('0x3c')](db[_0x6d23('0x3d')]['rawAttributes'],function(_0x32ef5e){return{'name':_0x32ef5e[_0x6d23('0x3e')],'type':_0x32ef5e[_0x6d23('0x3f')][_0x6d23('0x40')]};});_0x340dac[_0x6d23('0x41')]=_['map'](_0xccf5d8,_0x6d23('0x39'));_0x340dac[_0x6d23('0x42')]=_[_0x6d23('0x43')](_0x10bce1[_0x6d23('0x42')]);_0x340dac['filters']=_['intersection'](_0x340dac[_0x6d23('0x41')],_0x340dac[_0x6d23('0x42')]);_0x4c356a[_0x6d23('0x44')]=_['intersection'](_0x340dac[_0x6d23('0x41')],qs[_0x6d23('0x45')](_0x10bce1['query'][_0x6d23('0x45')]));_0x4c356a[_0x6d23('0x44')]=_0x4c356a[_0x6d23('0x44')][_0x6d23('0x46')]?_0x4c356a[_0x6d23('0x44')]:_0x340dac['model'];if(!_0x10bce1[_0x6d23('0x42')][_0x6d23('0x47')](_0x6d23('0x48'))){_0x4c356a[_0x6d23('0x2f')]=qs[_0x6d23('0x2f')](_0x10bce1['query'][_0x6d23('0x2f')]);_0x4c356a[_0x6d23('0x2e')]=qs[_0x6d23('0x2e')](_0x10bce1[_0x6d23('0x42')][_0x6d23('0x2e')]);}_0x4c356a[_0x6d23('0x49')]=qs[_0x6d23('0x4a')](_0x10bce1[_0x6d23('0x42')][_0x6d23('0x4a')]);_0x4c356a[_0x6d23('0x4b')]=qs[_0x6d23('0x4c')](_[_0x6d23('0x4d')](_0x10bce1['query'],_0x340dac[_0x6d23('0x4c')]));if(_0x10bce1[_0x6d23('0x42')][_0x6d23('0x4e')]){_0x4c356a[_0x6d23('0x4b')]=_[_0x6d23('0x4f')](_0x4c356a['where'],{'$or':_[_0x6d23('0x3c')](_0xccf5d8,function(_0x1dac55){if(_0x1dac55['type']!==_0x6d23('0x50')){var _0x32d153={};_0x32d153[_0x1dac55[_0x6d23('0x39')]]={'$like':'%'+_0x10bce1['query'][_0x6d23('0x4e')]+'%'};return _0x32d153;}})});}_0x4c356a=_[_0x6d23('0x4f')]({},_0x4c356a,_0x10bce1['options']);var _0x290274={'where':_0x4c356a[_0x6d23('0x4b')]};return db['VtigerAccount'][_0x6d23('0x2d')](_0x290274)[_0x6d23('0x21')](function(_0x2fc2cd){_0x14166f[_0x6d23('0x2d')]=_0x2fc2cd;if(_0x10bce1[_0x6d23('0x42')][_0x6d23('0x51')]){_0x4c356a['include']=[{'all':!![]}];}return db[_0x6d23('0x3d')][_0x6d23('0x52')](_0x4c356a);})['then'](function(_0x1fa3b4){_0x14166f['rows']=_0x1fa3b4;return _0x14166f;})[_0x6d23('0x21')](respondWithFilteredResult(_0x170202,_0x4c356a))['catch'](handleError(_0x170202,null));};exports[_0x6d23('0x53')]=function(_0x1dd0ea,_0x1b3eb8){var _0x1a53d5={'raw':![],'where':{'id':_0x1dd0ea[_0x6d23('0x54')]['id']}},_0x10898f={};_0x10898f[_0x6d23('0x41')]=_[_0x6d23('0x43')](db['VtigerAccount'][_0x6d23('0x55')]);_0x10898f[_0x6d23('0x42')]=_['keys'](_0x1dd0ea[_0x6d23('0x42')]);_0x10898f[_0x6d23('0x4c')]=_[_0x6d23('0x56')](_0x10898f['model'],_0x10898f[_0x6d23('0x42')]);_0x1a53d5['attributes']=_[_0x6d23('0x56')](_0x10898f['model'],qs[_0x6d23('0x45')](_0x1dd0ea['query'][_0x6d23('0x45')]));_0x1a53d5['attributes']=_0x1a53d5[_0x6d23('0x44')][_0x6d23('0x46')]?_0x1a53d5['attributes']:_0x10898f[_0x6d23('0x41')];if(_0x1dd0ea['query']['includeAll']){_0x1a53d5['include']=[{'all':!![]}];}_0x1a53d5=_[_0x6d23('0x4f')]({},_0x1a53d5,_0x1dd0ea[_0x6d23('0x57')]);return db[_0x6d23('0x3d')][_0x6d23('0x58')](_0x1a53d5)[_0x6d23('0x21')](handleEntityNotFound(_0x1b3eb8,null))[_0x6d23('0x21')](respondWithResult(_0x1b3eb8,null))['catch'](handleError(_0x1b3eb8,null));};exports[_0x6d23('0x59')]=function(_0x2ee17d,_0x4ca196){return db[_0x6d23('0x3d')][_0x6d23('0x59')](_0x2ee17d['body'],{})[_0x6d23('0x21')](respondWithResult(_0x4ca196,0xc9))[_0x6d23('0x2a')](handleError(_0x4ca196,null));};exports[_0x6d23('0x35')]=function(_0x18e943,_0x4a9bf7){if(_0x18e943[_0x6d23('0x5a')]['id']){delete _0x18e943[_0x6d23('0x5a')]['id'];}return db[_0x6d23('0x3d')][_0x6d23('0x58')]({'where':{'id':_0x18e943[_0x6d23('0x54')]['id']}})[_0x6d23('0x21')](handleEntityNotFound(_0x4a9bf7,null))[_0x6d23('0x21')](saveUpdates(_0x18e943[_0x6d23('0x5a')],null))[_0x6d23('0x21')](respondWithResult(_0x4a9bf7,null))[_0x6d23('0x2a')](handleError(_0x4a9bf7,null));};exports[_0x6d23('0x36')]=function(_0x57c8bf,_0x2e32fa){return db[_0x6d23('0x3d')][_0x6d23('0x58')]({'where':{'id':_0x57c8bf[_0x6d23('0x54')]['id']}})[_0x6d23('0x21')](handleEntityNotFound(_0x2e32fa,null))[_0x6d23('0x21')](removeEntity(_0x2e32fa,null))['catch'](handleError(_0x2e32fa,null));};exports['getConfigurations']=function(_0x1a7f53,_0x570d11,_0x17911f){var _0x1e6dc2={};var _0x3245b8={};var _0x324f4e;var _0x4b360d;return db[_0x6d23('0x3d')][_0x6d23('0x5b')]({'where':{'id':_0x1a7f53['params']['id']}})[_0x6d23('0x21')](handleEntityNotFound(_0x570d11,null))[_0x6d23('0x21')](function(_0xda566a){if(_0xda566a){_0x324f4e=_0xda566a;_0x3245b8[_0x6d23('0x41')]=_[_0x6d23('0x43')](db[_0x6d23('0x5c')][_0x6d23('0x55')]);_0x3245b8['query']=_['keys'](_0x1a7f53['query']);_0x3245b8['filters']=_['intersection'](_0x3245b8[_0x6d23('0x41')],_0x3245b8['query']);_0x1e6dc2[_0x6d23('0x44')]=_[_0x6d23('0x56')](_0x3245b8[_0x6d23('0x41')],qs[_0x6d23('0x45')](_0x1a7f53[_0x6d23('0x42')][_0x6d23('0x45')]));_0x1e6dc2[_0x6d23('0x44')]=_0x1e6dc2[_0x6d23('0x44')]['length']?_0x1e6dc2[_0x6d23('0x44')]:_0x3245b8[_0x6d23('0x41')];_0x1e6dc2[_0x6d23('0x49')]=qs[_0x6d23('0x4a')](_0x1a7f53[_0x6d23('0x42')][_0x6d23('0x4a')]);_0x1e6dc2[_0x6d23('0x4b')]=qs['filters'](_[_0x6d23('0x4d')](_0x1a7f53['query'],_0x3245b8[_0x6d23('0x4c')]));if(_0x1a7f53[_0x6d23('0x42')][_0x6d23('0x4e')]){_0x1e6dc2[_0x6d23('0x4b')]=_[_0x6d23('0x4f')](_0x1e6dc2[_0x6d23('0x4b')],{'$or':_[_0x6d23('0x3c')](_0x1e6dc2[_0x6d23('0x44')],function(_0x3bcf79){var _0x276b22={};_0x276b22[_0x3bcf79]={'$like':'%'+_0x1a7f53[_0x6d23('0x42')][_0x6d23('0x4e')]+'%'};return _0x276b22;})});}_0x1e6dc2=_[_0x6d23('0x4f')]({},_0x1e6dc2,_0x1a7f53[_0x6d23('0x57')]);return _0x324f4e[_0x6d23('0x5d')](_0x1e6dc2);}})[_0x6d23('0x21')](function(_0x1cae71){if(_0x1cae71){_0x4b360d=_0x1cae71[_0x6d23('0x46')];if(!_0x1a7f53[_0x6d23('0x42')][_0x6d23('0x47')](_0x6d23('0x48'))){_0x1e6dc2[_0x6d23('0x2f')]=qs[_0x6d23('0x2f')](_0x1a7f53[_0x6d23('0x42')][_0x6d23('0x2f')]);_0x1e6dc2[_0x6d23('0x2e')]=qs['offset'](_0x1a7f53[_0x6d23('0x42')][_0x6d23('0x2e')]);}return _0x324f4e[_0x6d23('0x5d')](_0x1e6dc2);}})[_0x6d23('0x21')](function(_0x5bc5be){if(_0x5bc5be){return _0x5bc5be?{'count':_0x4b360d,'rows':_0x5bc5be}:null;}})[_0x6d23('0x21')](respondWithResult(_0x570d11,null))['catch'](handleError(_0x570d11,null));};exports[_0x6d23('0x5e')]=function(_0x35abac,_0x3fa76a,_0x5d88d5){if(_0x35abac[_0x6d23('0x5a')]['id']){delete _0x35abac[_0x6d23('0x5a')]['id'];}return db[_0x6d23('0x3d')]['findOne']({'where':{'id':_0x35abac[_0x6d23('0x54')]['id']}})[_0x6d23('0x21')](handleEntityNotFound(_0x3fa76a,null))[_0x6d23('0x21')](function(_0x266150){if(_0x266150){_0x35abac[_0x6d23('0x5a')][_0x6d23('0x5f')]=_0x266150['id'];_0x35abac['body'][_0x6d23('0x60')]=integrations[_0x6d23('0x61')](_0x35abac[_0x6d23('0x5a')][_0x6d23('0x62')],_0x35abac[_0x6d23('0x5a')][_0x6d23('0x3f')]);_0x35abac[_0x6d23('0x5a')][_0x6d23('0x63')]=integrations['getDescriptions'](_0x35abac['body']['channel'],_0x35abac[_0x6d23('0x5a')][_0x6d23('0x3f')]);return db[_0x6d23('0x5c')][_0x6d23('0x59')](_0x35abac[_0x6d23('0x5a')],{'include':[{'model':db[_0x6d23('0x64')],'as':_0x6d23('0x60')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x6d23('0x21')](respondWithResult(_0x3fa76a,null))[_0x6d23('0x2a')](handleError(_0x3fa76a,null));};var md5=require(_0x6d23('0x65'));exports['getFields']=function(_0xcb05b3,_0x27a197,_0x15d3ea){var _0x764739=null;var _0x55f2fc=null;var _0x429157=null;var _0x46d0f4=null;var _0x1ce39b='';return db[_0x6d23('0x3d')][_0x6d23('0x5b')]({'where':{'id':_0xcb05b3['params']['id']},'attributes':['id',_0x6d23('0x39'),_0x6d23('0x66'),_0x6d23('0x67'),_0x6d23('0x68'),'remoteUri',_0x6d23('0x69'),_0x6d23('0x6a')]})[_0x6d23('0x21')](handleEntityNotFound(_0x27a197,null))[_0x6d23('0x21')](function(_0x453a43){if(_0x453a43){_0x764739=_0x453a43[_0x6d23('0x66')];_0x55f2fc=_0x453a43[_0x6d23('0x6a')];_0x429157=_0x453a43[_0x6d23('0x68')];_0x1ce39b=_0x453a43['remoteUri'];var _0x29c306=_0x1ce39b[_0x6d23('0x6b')](-0x1);if(_0x29c306==='/'){_0x1ce39b=_0x1ce39b[_0x6d23('0x6c')](0x0,_0x1ce39b[_0x6d23('0x6d')](_0x29c306));}_0x46d0f4=util['format'](_0x6d23('0x6e'),_0x1ce39b);var _0x3b9402={'method':_0x6d23('0x6f'),'uri':_0x46d0f4,'qs':{'operation':'getchallenge','username':_0x453a43[_0x6d23('0x66')]},'json':!![]};return rp(_0x3b9402);}})[_0x6d23('0x21')](function(_0x26aa8f){if(_0x26aa8f['success']){var _0x190b9e={'method':_0x6d23('0x70'),'uri':_0x46d0f4,'form':{'operation':_0x6d23('0x71'),'username':_0x764739,'accessKey':md5(_0x26aa8f[_0x6d23('0x29')][_0x6d23('0x72')]+_0x55f2fc)},'json':!![]};return rp(_0x190b9e);}})[_0x6d23('0x21')](function(_0xe00862){if(_0xe00862['success']){var _0x148bb7={'method':'GET','uri':_0x46d0f4,'qs':{'operation':_0x6d23('0x73'),'username':_0x764739,'sessionName':_0xe00862[_0x6d23('0x29')]['sessionName'],'elementType':_0x429157},'json':!![]};return rp(_0x148bb7);}})[_0x6d23('0x21')](function(_0x19a6b8){if(_0x19a6b8[_0x6d23('0x74')]){var _0x1fc2a0=['autogenerated','reference',_0x6d23('0x75')];_['remove'](_0x19a6b8[_0x6d23('0x29')][_0x6d23('0x45')],function(_0x529c16){return _0x1fc2a0[_0x6d23('0x76')](_0x529c16[_0x6d23('0x3f')][_0x6d23('0x39')]);});_[_0x6d23('0x77')](_0x19a6b8[_0x6d23('0x29')][_0x6d23('0x45')],function(_0x43a21c){return _0x43a21c[_0x6d23('0x78')]===_0x6d23('0x79');});return{'count':_0x19a6b8['result'][_0x6d23('0x45')][_0x6d23('0x46')],'rows':_['map'](_0x19a6b8[_0x6d23('0x29')][_0x6d23('0x45')],function(_0x172c84){return{'id':_0x172c84[_0x6d23('0x39')],'name':_0x172c84[_0x6d23('0x7a')],'custom':_[_0x6d23('0x7b')](_0x172c84['name'],_0x6d23('0x7c'))?!![]:![],'options':_0x172c84['type'][_0x6d23('0x39')]===_0x6d23('0x7d')&&_0x172c84[_0x6d23('0x3f')]['picklistValues'][_0x6d23('0x46')]>0x0?_[_0x6d23('0x3c')](_0x172c84[_0x6d23('0x3f')][_0x6d23('0x7e')],function(_0x14c8ae){return{'name':_0x14c8ae[_0x6d23('0x7a')],'value':_0x14c8ae[_0x6d23('0x7f')]};}):[]};})};}})[_0x6d23('0x21')](respondWithResult(_0x27a197,null))[_0x6d23('0x2a')](function(_0x53da78){console['log']('vTiger\x20error:\x20'+_0x53da78);var _0x39ae3a=_0xcb05b3[_0x6d23('0x42')][_0x6d23('0x1d')]?0x1f4:_0x53da78['statusCode']||0x1f4;logger[_0x6d23('0x26')](_0x6d23('0x80'),'getFields',_0x39ae3a,JSON[_0x6d23('0x81')](_0x53da78));delete _0x53da78[_0x6d23('0x39')];if(_0x39ae3a===0x191){_0x39ae3a=0x190;}_0x27a197[_0x6d23('0x2c')](_0x39ae3a)[_0x6d23('0x3a')](_0xcb05b3[_0x6d23('0x42')]['test']?{'message':_0x6d23('0x82'),'statusCode':_0x53da78[_0x6d23('0x83')]}:_0x53da78);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index eb3d15d..dc630fa 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 _0x58bb=['request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','VtigerAccount','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x14fc46,_0x5f5b36){var _0x1dc44d=function(_0x278bd2){while(--_0x278bd2){_0x14fc46['push'](_0x14fc46['shift']());}};_0x1dc44d(++_0x5f5b36);}(_0x58bb,0xbd));var _0xb58b=function(_0x5eb313,_0x392ef1){_0x5eb313=_0x5eb313-0x0;var _0x55cb87=_0x58bb[_0x5eb313];return _0x55cb87;};'use strict';var _=require(_0xb58b('0x0'));var util=require(_0xb58b('0x1'));var logger=require(_0xb58b('0x2'))(_0xb58b('0x3'));var moment=require(_0xb58b('0x4'));var BPromise=require(_0xb58b('0x5'));var rp=require(_0xb58b('0x6'));var fs=require('fs');var path=require(_0xb58b('0x7'));var rimraf=require(_0xb58b('0x8'));var config=require(_0xb58b('0x9'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xb58b('0xa'));module['exports']=function(_0x45a1b9,_0x3055da){return _0x45a1b9[_0xb58b('0xb')](_0xb58b('0xc'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f95=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash'];(function(_0x4bf9aa,_0x1d71fa){var _0x377a4d=function(_0x16ab26){while(--_0x16ab26){_0x4bf9aa['push'](_0x4bf9aa['shift']());}};_0x377a4d(++_0x1d71fa);}(_0x5f95,0xef));var _0x55f9=function(_0x54046c,_0x7b3372){_0x54046c=_0x54046c-0x0;var _0x3e12ee=_0x5f95[_0x54046c];return _0x3e12ee;};'use strict';var _=require(_0x55f9('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x55f9('0x1'));var BPromise=require(_0x55f9('0x2'));var rp=require(_0x55f9('0x3'));var fs=require('fs');var path=require(_0x55f9('0x4'));var rimraf=require(_0x55f9('0x5'));var config=require(_0x55f9('0x6'));var attributes=require(_0x55f9('0x7'));var integrations=require(_0x55f9('0x8'));module[_0x55f9('0x9')]=function(_0x2fc1d7,_0x4ed851){return _0x2fc1d7[_0x55f9('0xa')]('VtigerAccount',attributes,{'tableName':_0x55f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index fd95992..4c0af46 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 _0x7c47=['VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','then','ShowVtigerAccount','where','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVtigerAccount'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x7c47,0x161));var _0x77c4=function(_0x296223,_0x3f0cf0){_0x296223=_0x296223-0x0;var _0x22950c=_0x7c47[_0x296223];return _0x22950c;};'use strict';var _=require('lodash');var util=require(_0x77c4('0x0'));var moment=require('moment');var BPromise=require(_0x77c4('0x1'));var rs=require(_0x77c4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77c4('0x3'))['db'];var utils=require(_0x77c4('0x4'));var logger=require(_0x77c4('0x5'))('rpc');var config=require(_0x77c4('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x77c4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x20e170,_0x2aaa13,_0x14a666){return new BPromise(function(_0x4245f2,_0x44ee2a){return client[_0x77c4('0x8')](_0x20e170,_0x14a666)['then'](function(_0xd96867){logger[_0x77c4('0x9')](_0x77c4('0xa'),_0x2aaa13,_0x77c4('0xb'));logger[_0x77c4('0xc')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x2aaa13,'request\x20sent',JSON[_0x77c4('0xd')](_0xd96867));if(_0xd96867[_0x77c4('0xe')]){if(_0xd96867[_0x77c4('0xe')]['code']===0x1f4){logger[_0x77c4('0xe')](_0x77c4('0xa'),_0x2aaa13,_0xd96867[_0x77c4('0xe')]['message']);return _0x44ee2a(_0xd96867[_0x77c4('0xe')][_0x77c4('0xf')]);}logger['error'](_0x77c4('0xa'),_0x2aaa13,_0xd96867[_0x77c4('0xe')][_0x77c4('0xf')]);return _0x4245f2(_0xd96867[_0x77c4('0xe')]['message']);}else{logger[_0x77c4('0x9')](_0x77c4('0xa'),_0x2aaa13,_0x77c4('0xb'));_0x4245f2(_0xd96867[_0x77c4('0x10')][_0x77c4('0xf')]);}})[_0x77c4('0x11')](function(_0x1868d7){logger[_0x77c4('0xe')](_0x77c4('0xa'),_0x2aaa13,_0x1868d7);_0x44ee2a(_0x1868d7);});});}exports[_0x77c4('0x12')]=function(_0x5ae8e7){var _0x408823=this;return new Promise(function(_0x1e22b0,_0x74e2e2){return db[_0x77c4('0x13')][_0x77c4('0x14')]({'raw':_0x5ae8e7[_0x77c4('0x15')]?_0x5ae8e7[_0x77c4('0x15')][_0x77c4('0x16')]===undefined?!![]:![]:!![],'where':_0x5ae8e7[_0x77c4('0x15')]?_0x5ae8e7[_0x77c4('0x15')]['where']||null:null,'attributes':_0x5ae8e7['options']?_0x5ae8e7['options'][_0x77c4('0x17')]||null:null,'limit':_0x5ae8e7['options']?_0x5ae8e7[_0x77c4('0x15')][_0x77c4('0x18')]||null:null,'include':_0x5ae8e7['options']?_0x5ae8e7[_0x77c4('0x15')][_0x77c4('0x19')]?_[_0x77c4('0x1a')](_0x5ae8e7[_0x77c4('0x15')][_0x77c4('0x19')],function(_0x31cc4e){return{'model':db[_0x31cc4e[_0x77c4('0x1b')]],'as':_0x31cc4e['as'],'attributes':_0x31cc4e[_0x77c4('0x17')],'include':_0x31cc4e[_0x77c4('0x19')]?_[_0x77c4('0x1a')](_0x31cc4e[_0x77c4('0x19')],function(_0x4c4e14){return{'model':db[_0x4c4e14[_0x77c4('0x1b')]],'as':_0x4c4e14['as'],'attributes':_0x4c4e14[_0x77c4('0x17')],'include':_0x4c4e14['include']?_[_0x77c4('0x1a')](_0x4c4e14[_0x77c4('0x19')],function(_0xdc8e46){return{'model':db[_0xdc8e46[_0x77c4('0x1b')]],'as':_0xdc8e46['as'],'attributes':_0xdc8e46['attributes']};}):[]};}):[]};}):[]:[]})[_0x77c4('0x1c')](function(_0x120730){logger[_0x77c4('0x9')](_0x77c4('0x12'),_0x5ae8e7);logger[_0x77c4('0xc')]('GetVtigerAccount',_0x5ae8e7,JSON['stringify'](_0x120730));_0x1e22b0(_0x120730);})[_0x77c4('0x11')](function(_0x3fd43b){logger[_0x77c4('0xe')](_0x77c4('0x12'),_0x3fd43b['message'],_0x5ae8e7);_0x74e2e2(_0x408823[_0x77c4('0xe')](0x1f4,_0x3fd43b[_0x77c4('0xf')]));});});};exports[_0x77c4('0x1d')]=function(_0x136c76){var _0xcfb897=this;return new Promise(function(_0x516075,_0x2faf53){return db[_0x77c4('0x13')]['find']({'raw':_0x136c76['options']?_0x136c76[_0x77c4('0x15')][_0x77c4('0x16')]===undefined?!![]:![]:!![],'where':_0x136c76[_0x77c4('0x15')]?_0x136c76[_0x77c4('0x15')][_0x77c4('0x1e')]||null:null,'attributes':_0x136c76['options']?_0x136c76[_0x77c4('0x15')][_0x77c4('0x17')]||null:null,'include':_0x136c76['options']?_0x136c76[_0x77c4('0x15')][_0x77c4('0x19')]?_[_0x77c4('0x1a')](_0x136c76[_0x77c4('0x15')][_0x77c4('0x19')],function(_0x1e0485){return{'model':db[_0x1e0485[_0x77c4('0x1b')]],'as':_0x1e0485['as'],'attributes':_0x1e0485['attributes'],'include':_0x1e0485[_0x77c4('0x19')]?_['map'](_0x1e0485[_0x77c4('0x19')],function(_0x596192){return{'model':db[_0x596192[_0x77c4('0x1b')]],'as':_0x596192['as'],'attributes':_0x596192[_0x77c4('0x17')],'include':_0x596192[_0x77c4('0x19')]?_[_0x77c4('0x1a')](_0x596192[_0x77c4('0x19')],function(_0x533577){return{'model':db[_0x533577[_0x77c4('0x1b')]],'as':_0x533577['as'],'attributes':_0x533577[_0x77c4('0x17')]};}):[]};}):[]};}):[]:[]})[_0x77c4('0x1c')](function(_0xbe33c0){logger[_0x77c4('0x9')](_0x77c4('0x1d'),_0x136c76);logger[_0x77c4('0xc')](_0x77c4('0x1d'),_0x136c76,JSON[_0x77c4('0xd')](_0xbe33c0));_0x516075(_0xbe33c0);})['catch'](function(_0x469205){logger[_0x77c4('0xe')]('ShowVtigerAccount',_0x469205[_0x77c4('0xf')],_0x136c76);_0x2faf53(_0xcfb897[_0x77c4('0xe')](0x1f4,_0x469205[_0x77c4('0xf')]));});});}; \ No newline at end of file +var _0x2661=['stringify','error','code','message','result','catch','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetVtigerAccount','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x2661,0x7e));var _0x1266=function(_0x4e7c1b,_0x490e98){_0x4e7c1b=_0x4e7c1b-0x0;var _0x21c6ad=_0x2661[_0x4e7c1b];return _0x21c6ad;};'use strict';var _=require(_0x1266('0x0'));var util=require(_0x1266('0x1'));var moment=require(_0x1266('0x2'));var BPromise=require(_0x1266('0x3'));var rs=require(_0x1266('0x4'));var fs=require('fs');var Redis=require(_0x1266('0x5'));var db=require(_0x1266('0x6'))['db'];var utils=require(_0x1266('0x7'));var logger=require('../../config/logger')(_0x1266('0x8'));var config=require(_0x1266('0x9'));var jayson=require(_0x1266('0xa'));var client=jayson['client'][_0x1266('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c5855,_0x3fc76e,_0x23ebd1){return new BPromise(function(_0x16bfa6,_0x52fe54){return client['request'](_0x3c5855,_0x23ebd1)[_0x1266('0xc')](function(_0x1d57e6){logger[_0x1266('0xd')](_0x1266('0xe'),_0x3fc76e,_0x1266('0xf'));logger[_0x1266('0x10')](_0x1266('0x11'),_0x3fc76e,_0x1266('0xf'),JSON[_0x1266('0x12')](_0x1d57e6));if(_0x1d57e6[_0x1266('0x13')]){if(_0x1d57e6[_0x1266('0x13')][_0x1266('0x14')]===0x1f4){logger[_0x1266('0x13')](_0x1266('0xe'),_0x3fc76e,_0x1d57e6['error']['message']);return _0x52fe54(_0x1d57e6[_0x1266('0x13')]['message']);}logger['error'](_0x1266('0xe'),_0x3fc76e,_0x1d57e6['error']['message']);return _0x16bfa6(_0x1d57e6['error'][_0x1266('0x15')]);}else{logger[_0x1266('0xd')](_0x1266('0xe'),_0x3fc76e,_0x1266('0xf'));_0x16bfa6(_0x1d57e6[_0x1266('0x16')]['message']);}})[_0x1266('0x17')](function(_0x22f65f){logger[_0x1266('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x3fc76e,_0x22f65f);_0x52fe54(_0x22f65f);});});}exports['GetVtigerAccount']=function(_0x5d4c89){var _0xf6dabd=this;return new Promise(function(_0x23dd87,_0x2b50e4){return db[_0x1266('0x18')][_0x1266('0x19')]({'raw':_0x5d4c89['options']?_0x5d4c89[_0x1266('0x1a')][_0x1266('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d4c89[_0x1266('0x1a')]?_0x5d4c89[_0x1266('0x1a')][_0x1266('0x1c')]||null:null,'attributes':_0x5d4c89['options']?_0x5d4c89[_0x1266('0x1a')][_0x1266('0x1d')]||null:null,'limit':_0x5d4c89[_0x1266('0x1a')]?_0x5d4c89[_0x1266('0x1a')][_0x1266('0x1e')]||null:null,'include':_0x5d4c89[_0x1266('0x1a')]?_0x5d4c89[_0x1266('0x1a')][_0x1266('0x1f')]?_[_0x1266('0x20')](_0x5d4c89[_0x1266('0x1a')][_0x1266('0x1f')],function(_0x128147){return{'model':db[_0x128147[_0x1266('0x21')]],'as':_0x128147['as'],'attributes':_0x128147[_0x1266('0x1d')],'include':_0x128147[_0x1266('0x1f')]?_[_0x1266('0x20')](_0x128147[_0x1266('0x1f')],function(_0x5a5556){return{'model':db[_0x5a5556['model']],'as':_0x5a5556['as'],'attributes':_0x5a5556[_0x1266('0x1d')],'include':_0x5a5556[_0x1266('0x1f')]?_[_0x1266('0x20')](_0x5a5556['include'],function(_0x354398){return{'model':db[_0x354398[_0x1266('0x21')]],'as':_0x354398['as'],'attributes':_0x354398[_0x1266('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1266('0xc')](function(_0x22bca4){logger[_0x1266('0xd')](_0x1266('0x22'),_0x5d4c89);logger['debug'](_0x1266('0x22'),_0x5d4c89,JSON[_0x1266('0x12')](_0x22bca4));_0x23dd87(_0x22bca4);})[_0x1266('0x17')](function(_0x5d56b9){logger[_0x1266('0x13')](_0x1266('0x22'),_0x5d56b9[_0x1266('0x15')],_0x5d4c89);_0x2b50e4(_0xf6dabd[_0x1266('0x13')](0x1f4,_0x5d56b9[_0x1266('0x15')]));});});};exports[_0x1266('0x23')]=function(_0x1b5b7f){var _0x58f101=this;return new Promise(function(_0x8f1b19,_0x370a8f){return db[_0x1266('0x18')]['find']({'raw':_0x1b5b7f['options']?_0x1b5b7f[_0x1266('0x1a')][_0x1266('0x1b')]===undefined?!![]:![]:!![],'where':_0x1b5b7f[_0x1266('0x1a')]?_0x1b5b7f[_0x1266('0x1a')][_0x1266('0x1c')]||null:null,'attributes':_0x1b5b7f[_0x1266('0x1a')]?_0x1b5b7f['options'][_0x1266('0x1d')]||null:null,'include':_0x1b5b7f[_0x1266('0x1a')]?_0x1b5b7f[_0x1266('0x1a')]['include']?_[_0x1266('0x20')](_0x1b5b7f['options'][_0x1266('0x1f')],function(_0x2d1dd7){return{'model':db[_0x2d1dd7[_0x1266('0x21')]],'as':_0x2d1dd7['as'],'attributes':_0x2d1dd7['attributes'],'include':_0x2d1dd7[_0x1266('0x1f')]?_['map'](_0x2d1dd7[_0x1266('0x1f')],function(_0x37f910){return{'model':db[_0x37f910[_0x1266('0x21')]],'as':_0x37f910['as'],'attributes':_0x37f910[_0x1266('0x1d')],'include':_0x37f910[_0x1266('0x1f')]?_[_0x1266('0x20')](_0x37f910[_0x1266('0x1f')],function(_0x376e18){return{'model':db[_0x376e18[_0x1266('0x21')]],'as':_0x376e18['as'],'attributes':_0x376e18[_0x1266('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1266('0xc')](function(_0x533b68){logger[_0x1266('0xd')]('ShowVtigerAccount',_0x1b5b7f);logger[_0x1266('0x10')](_0x1266('0x23'),_0x1b5b7f,JSON[_0x1266('0x12')](_0x533b68));_0x8f1b19(_0x533b68);})[_0x1266('0x17')](function(_0x190db3){logger[_0x1266('0x13')](_0x1266('0x23'),_0x190db3['message'],_0x1b5b7f);_0x370a8f(_0x58f101[_0x1266('0x13')](0x1f4,_0x190db3[_0x1266('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 592bc92..745a188 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x3006ea,_0xe91fd1){var _0x583ece=function(_0x52ca67){while(--_0x52ca67){_0x3006ea['push'](_0x3006ea['shift']());}};_0x583ece(++_0xe91fd1);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ff8ae,_0x459670){_0x2ff8ae=_0x2ff8ae-0x0;var _0x52d112=_0xb10b[_0x2ff8ae];return _0x52d112;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x436e98,_0x51c936){var _0x490963=function(_0x2b3a08){while(--_0x2b3a08){_0x436e98['push'](_0x436e98['shift']());}};_0x490963(++_0x51c936);}(_0xb10b,0x12a));var _0xbb10=function(_0x148aa9,_0x421ae3){_0x148aa9=_0x148aa9-0x0;var _0x530a22=_0xb10b[_0x148aa9];return _0x530a22;};'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 072f17d..9069562 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 _0xf6eb=['STRING','exports'];(function(_0x49bad2,_0x48f974){var _0x2426a3=function(_0x177e60){while(--_0x177e60){_0x49bad2['push'](_0x49bad2['shift']());}};_0x2426a3(++_0x48f974);}(_0xf6eb,0xa3));var _0xbf6e=function(_0x2def7d,_0x43ec43){_0x2def7d=_0x2def7d-0x0;var _0x2966a0=_0xf6eb[_0x2def7d];return _0x2966a0;};'use strict';var Sequelize=require('sequelize');module[_0xbf6e('0x0')]={'name':{'type':Sequelize[_0xbf6e('0x1')]},'description':{'type':Sequelize[_0xbf6e('0x1')]}}; \ No newline at end of file +var _0x8fcb=['sequelize','exports','STRING'];(function(_0x57b40c,_0x54e3d7){var _0x397e87=function(_0x3c918c){while(--_0x3c918c){_0x57b40c['push'](_0x57b40c['shift']());}};_0x397e87(++_0x54e3d7);}(_0x8fcb,0x117));var _0xb8fc=function(_0x18685e,_0x373ebb){_0x18685e=_0x18685e-0x0;var _0x32025f=_0x8fcb[_0x18685e];return _0x32025f;};'use strict';var Sequelize=require(_0xb8fc('0x0'));module[_0xb8fc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb8fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 0b71c03..e4331b1 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 _0x6ac2=['sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','end','status','offset','limit','set','json','reject','update','sendStatus','name','send','VtigerConfiguration','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','find','create','body','params','destroy','getFields','findOne','VtigerField','filter','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','path'];(function(_0x50f76a,_0x4d8898){var _0x1f8b75=function(_0x32a223){while(--_0x32a223){_0x50f76a['push'](_0x50f76a['shift']());}};_0x1f8b75(++_0x4d8898);}(_0x6ac2,0xf5));var _0x26ac=function(_0x2c020d,_0x3419c5){_0x2c020d=_0x2c020d-0x0;var _0x159335=_0x6ac2[_0x2c020d];return _0x159335;};'use strict';var pdf=require(_0x26ac('0x0'));var emlformat=require(_0x26ac('0x1'));var rimraf=require(_0x26ac('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x26ac('0x3'));var moment=require('moment');var BPromise=require(_0x26ac('0x4'));var Mustache=require(_0x26ac('0x5'));var util=require('util');var path=require(_0x26ac('0x6'));var sox=require(_0x26ac('0x7'));var csv=require('to-csv');var ejs=require(_0x26ac('0x8'));var fs=require('fs');var _=require(_0x26ac('0x9'));var squel=require(_0x26ac('0xa'));var crypto=require(_0x26ac('0xb'));var jsforce=require(_0x26ac('0xc'));var deskjs=require(_0x26ac('0xd'));var toCsv=require(_0x26ac('0xe'));var querystring=require(_0x26ac('0xf'));var Papa=require(_0x26ac('0x10'));var Redis=require(_0x26ac('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x26ac('0x12'));var as=require(_0x26ac('0x13'));var hardwareService=require(_0x26ac('0x14'));var logger=require(_0x26ac('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x26ac('0x16'));var db=require(_0x26ac('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x26ac('0x18')][_0x26ac('0x19')]({'port':0x232a});function checkPasswordPattern(_0x71da30,_0x478883,_0x486b6d){if(_0x486b6d){var _0x5bc732=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5bc732['test'](_0x478883)){return _0x71da30;}else{throw new db['Sequelize']['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x71da30;}}function respondWithRpcPromise(_0x13dee1,_0x295d10,_0x53b54f,_0x40767c){return new BPromise(function(_0x2a8746,_0x3f738d){var _0x599c75=_0x40767c||client;return _0x599c75['request'](_0x13dee1,_0x53b54f)[_0x26ac('0x1a')](function(_0x113bfa){logger[_0x26ac('0x1b')](_0x26ac('0x1c'),_0x295d10,_0x26ac('0x1d'));logger['debug'](_0x26ac('0x1e'),_0x295d10,'request\x20sent',JSON['stringify'](_0x113bfa));if(_0x113bfa[_0x26ac('0x1f')]){if(_0x113bfa['error']['code']===0x1f4){logger[_0x26ac('0x1f')](_0x26ac('0x1c'),_0x295d10,_0x113bfa['error'][_0x26ac('0x20')]);return _0x3f738d(_0x113bfa['error'][_0x26ac('0x20')]);}logger[_0x26ac('0x1f')]('VtigerConfiguration,\x20%s,\x20%s',_0x295d10,_0x113bfa[_0x26ac('0x1f')][_0x26ac('0x20')]);return _0x2a8746(_0x113bfa[_0x26ac('0x1f')][_0x26ac('0x20')]);}else{logger[_0x26ac('0x1b')](_0x26ac('0x1c'),_0x295d10,_0x26ac('0x1d'));_0x2a8746(_0x113bfa[_0x26ac('0x21')][_0x26ac('0x20')]);}})[_0x26ac('0x22')](function(_0x3970ce){logger[_0x26ac('0x1f')](_0x26ac('0x1c'),_0x295d10,_0x3970ce);_0x3f738d(_0x3970ce);});});}function respondWithStatusCode(_0xbc5591,_0x11cad3){_0x11cad3=_0x11cad3||0xcc;return function(_0x4c4c69){if(_0x4c4c69){return _0xbc5591['sendStatus'](_0x11cad3);}return _0xbc5591['status'](_0x11cad3)[_0x26ac('0x23')]();};}function respondWithResult(_0x6cf471,_0x3b1784){_0x3b1784=_0x3b1784||0xc8;return function(_0x456bf1){if(_0x456bf1){return _0x6cf471[_0x26ac('0x24')](_0x3b1784)['json'](_0x456bf1);}};}function respondWithFilteredResult(_0x38975f,_0x4a3c5e){return function(_0x2f4345){if(_0x2f4345){var _0x295e7e=_0x2f4345['count'],_0x27f460=_0x4a3c5e[_0x26ac('0x25')],_0x328843=_0x4a3c5e[_0x26ac('0x25')]+_0x4a3c5e[_0x26ac('0x26')],_0x1d2912;if(_0x328843>=_0x295e7e){_0x328843=_0x295e7e;_0x1d2912=0xc8;}else{_0x1d2912=0xce;}_0x38975f['status'](_0x1d2912);return _0x38975f[_0x26ac('0x27')]('Content-Range',_0x27f460+'-'+_0x328843+'/'+_0x295e7e)[_0x26ac('0x28')](_0x2f4345);}return null;};}function patchUpdates(_0x2b3241){return function(_0xf5c22a){try{jsonpatch['apply'](_0xf5c22a,_0x2b3241,!![]);}catch(_0x5e1d83){return BPromise[_0x26ac('0x29')](_0x5e1d83);}return _0xf5c22a['save']();};}function saveUpdates(_0x343b70,_0x4edfc0){return function(_0x2d0d32){if(_0x2d0d32){return _0x2d0d32[_0x26ac('0x2a')](_0x343b70)['then'](function(_0x44af6a){return _0x44af6a;});}return null;};}function removeEntity(_0x115990,_0x1ddf50){return function(_0x54f97e){if(_0x54f97e){return _0x54f97e['destroy']()[_0x26ac('0x1a')](function(){_0x115990['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x128ff3,_0x1f188a){return function(_0x2b9f1b){if(!_0x2b9f1b){_0x128ff3[_0x26ac('0x2b')](0x194);}return _0x2b9f1b;};}function handleError(_0x275ff9,_0x392192){_0x392192=_0x392192||0x1f4;return function(_0x49d054){logger[_0x26ac('0x1f')](_0x49d054['stack']);if(_0x49d054[_0x26ac('0x2c')]){delete _0x49d054[_0x26ac('0x2c')];}_0x275ff9[_0x26ac('0x24')](_0x392192)[_0x26ac('0x2d')](_0x49d054);};}exports['index']=function(_0x2a2207,_0x526cbc){var _0x288cc6={},_0x3b700d={},_0x22b22f={'count':0x0,'rows':[]};var _0x55b316=_['map'](db[_0x26ac('0x2e')][_0x26ac('0x2f')],function(_0x5b2004){return{'name':_0x5b2004[_0x26ac('0x30')],'type':_0x5b2004['type'][_0x26ac('0x31')]};});_0x3b700d['model']=_[_0x26ac('0x32')](_0x55b316,_0x26ac('0x2c'));_0x3b700d[_0x26ac('0x33')]=_[_0x26ac('0x34')](_0x2a2207[_0x26ac('0x33')]);_0x3b700d[_0x26ac('0x35')]=_[_0x26ac('0x36')](_0x3b700d['model'],_0x3b700d['query']);_0x288cc6[_0x26ac('0x37')]=_[_0x26ac('0x36')](_0x3b700d['model'],qs['fields'](_0x2a2207[_0x26ac('0x33')][_0x26ac('0x38')]));_0x288cc6[_0x26ac('0x37')]=_0x288cc6[_0x26ac('0x37')][_0x26ac('0x39')]?_0x288cc6[_0x26ac('0x37')]:_0x3b700d[_0x26ac('0x3a')];if(!_0x2a2207['query'][_0x26ac('0x3b')](_0x26ac('0x3c'))){_0x288cc6[_0x26ac('0x26')]=qs[_0x26ac('0x26')](_0x2a2207[_0x26ac('0x33')]['limit']);_0x288cc6[_0x26ac('0x25')]=qs['offset'](_0x2a2207['query']['offset']);}_0x288cc6[_0x26ac('0x3d')]=qs[_0x26ac('0x3e')](_0x2a2207[_0x26ac('0x33')][_0x26ac('0x3e')]);_0x288cc6['where']=qs[_0x26ac('0x35')](_[_0x26ac('0x3f')](_0x2a2207[_0x26ac('0x33')],_0x3b700d[_0x26ac('0x35')]));if(_0x2a2207[_0x26ac('0x33')]['filter']){_0x288cc6['where']=_[_0x26ac('0x40')](_0x288cc6[_0x26ac('0x41')],{'$or':_['map'](_0x55b316,function(_0x3710ae){if(_0x3710ae['type']!==_0x26ac('0x42')){var _0x3e35d4={};_0x3e35d4[_0x3710ae[_0x26ac('0x2c')]]={'$like':'%'+_0x2a2207['query']['filter']+'%'};return _0x3e35d4;}})});}_0x288cc6=_[_0x26ac('0x40')]({},_0x288cc6,_0x2a2207[_0x26ac('0x43')]);var _0x5be486={'where':_0x288cc6[_0x26ac('0x41')]};return db[_0x26ac('0x2e')][_0x26ac('0x44')](_0x5be486)['then'](function(_0x30e8fa){_0x22b22f[_0x26ac('0x44')]=_0x30e8fa;if(_0x2a2207['query'][_0x26ac('0x45')]){_0x288cc6[_0x26ac('0x46')]=[{'all':!![]}];}return db[_0x26ac('0x2e')][_0x26ac('0x47')](_0x288cc6);})[_0x26ac('0x1a')](function(_0x5b1c4d){_0x22b22f[_0x26ac('0x48')]=_0x5b1c4d;return _0x22b22f;})[_0x26ac('0x1a')](respondWithFilteredResult(_0x526cbc,_0x288cc6))['catch'](handleError(_0x526cbc,null));};exports['show']=function(_0x2fc87e,_0xc99d64){var _0x19d647={'raw':![],'where':{'id':_0x2fc87e['params']['id']}},_0x45e877={};_0x45e877[_0x26ac('0x3a')]=_['keys'](db[_0x26ac('0x2e')][_0x26ac('0x2f')]);_0x45e877[_0x26ac('0x33')]=_[_0x26ac('0x34')](_0x2fc87e[_0x26ac('0x33')]);_0x45e877[_0x26ac('0x35')]=_[_0x26ac('0x36')](_0x45e877['model'],_0x45e877[_0x26ac('0x33')]);_0x19d647[_0x26ac('0x37')]=_['intersection'](_0x45e877['model'],qs[_0x26ac('0x38')](_0x2fc87e['query']['fields']));_0x19d647[_0x26ac('0x37')]=_0x19d647[_0x26ac('0x37')][_0x26ac('0x39')]?_0x19d647[_0x26ac('0x37')]:_0x45e877[_0x26ac('0x3a')];if(_0x2fc87e[_0x26ac('0x33')][_0x26ac('0x45')]){_0x19d647[_0x26ac('0x46')]=[{'all':!![]}];}_0x19d647=_[_0x26ac('0x40')]({},_0x19d647,_0x2fc87e['options']);return db[_0x26ac('0x2e')][_0x26ac('0x49')](_0x19d647)[_0x26ac('0x1a')](handleEntityNotFound(_0xc99d64,null))['then'](respondWithResult(_0xc99d64,null))[_0x26ac('0x22')](handleError(_0xc99d64,null));};exports[_0x26ac('0x4a')]=function(_0x6d86d3,_0x4ce8c9){return db[_0x26ac('0x2e')]['create'](_0x6d86d3[_0x26ac('0x4b')],{})[_0x26ac('0x1a')](respondWithResult(_0x4ce8c9,0xc9))['catch'](handleError(_0x4ce8c9,null));};exports[_0x26ac('0x2a')]=function(_0x584713,_0x866f50){if(_0x584713[_0x26ac('0x4b')]['id']){delete _0x584713[_0x26ac('0x4b')]['id'];}return db[_0x26ac('0x2e')][_0x26ac('0x49')]({'where':{'id':_0x584713[_0x26ac('0x4c')]['id']}})[_0x26ac('0x1a')](handleEntityNotFound(_0x866f50,null))[_0x26ac('0x1a')](saveUpdates(_0x584713[_0x26ac('0x4b')],null))[_0x26ac('0x1a')](respondWithResult(_0x866f50,null))[_0x26ac('0x22')](handleError(_0x866f50,null));};exports[_0x26ac('0x4d')]=function(_0x55e861,_0x59e363){return db['VtigerConfiguration'][_0x26ac('0x49')]({'where':{'id':_0x55e861[_0x26ac('0x4c')]['id']}})[_0x26ac('0x1a')](handleEntityNotFound(_0x59e363,null))['then'](removeEntity(_0x59e363,null))[_0x26ac('0x22')](handleError(_0x59e363,null));};exports[_0x26ac('0x4e')]=function(_0x572d6e,_0x32c28c,_0x4877b5){var _0x54c12f={};var _0xd2b5cf={};var _0x4f7a4f;var _0x42a7a9;return db['VtigerConfiguration'][_0x26ac('0x4f')]({'where':{'id':_0x572d6e['params']['id']}})['then'](handleEntityNotFound(_0x32c28c,null))[_0x26ac('0x1a')](function(_0x1ca6d8){if(_0x1ca6d8){_0x4f7a4f=_0x1ca6d8;_0xd2b5cf[_0x26ac('0x3a')]=_[_0x26ac('0x34')](db[_0x26ac('0x50')][_0x26ac('0x2f')]);_0xd2b5cf[_0x26ac('0x33')]=_[_0x26ac('0x34')](_0x572d6e[_0x26ac('0x33')]);_0xd2b5cf[_0x26ac('0x35')]=_[_0x26ac('0x36')](_0xd2b5cf[_0x26ac('0x3a')],_0xd2b5cf[_0x26ac('0x33')]);_0x54c12f[_0x26ac('0x37')]=_[_0x26ac('0x36')](_0xd2b5cf['model'],qs['fields'](_0x572d6e[_0x26ac('0x33')][_0x26ac('0x38')]));_0x54c12f['attributes']=_0x54c12f['attributes'][_0x26ac('0x39')]?_0x54c12f[_0x26ac('0x37')]:_0xd2b5cf['model'];_0x54c12f[_0x26ac('0x3d')]=qs['sort'](_0x572d6e[_0x26ac('0x33')][_0x26ac('0x3e')]);_0x54c12f[_0x26ac('0x41')]=qs['filters'](_[_0x26ac('0x3f')](_0x572d6e[_0x26ac('0x33')],_0xd2b5cf['filters']));if(_0x572d6e[_0x26ac('0x33')][_0x26ac('0x51')]){_0x54c12f[_0x26ac('0x41')]=_[_0x26ac('0x40')](_0x54c12f[_0x26ac('0x41')],{'$or':_[_0x26ac('0x32')](_0x54c12f[_0x26ac('0x37')],function(_0x21f5da){var _0x3236c7={};_0x3236c7[_0x21f5da]={'$like':'%'+_0x572d6e[_0x26ac('0x33')][_0x26ac('0x51')]+'%'};return _0x3236c7;})});}_0x54c12f=_[_0x26ac('0x40')]({},_0x54c12f,_0x572d6e[_0x26ac('0x43')]);return _0x4f7a4f[_0x26ac('0x4e')](_0x54c12f);}})[_0x26ac('0x1a')](function(_0x5bb2c6){if(_0x5bb2c6){_0x42a7a9=_0x5bb2c6[_0x26ac('0x39')];if(!_0x572d6e[_0x26ac('0x33')][_0x26ac('0x3b')](_0x26ac('0x3c'))){_0x54c12f['limit']=qs[_0x26ac('0x26')](_0x572d6e['query'][_0x26ac('0x26')]);_0x54c12f[_0x26ac('0x25')]=qs['offset'](_0x572d6e[_0x26ac('0x33')][_0x26ac('0x25')]);}return _0x4f7a4f['getFields'](_0x54c12f);}})[_0x26ac('0x1a')](function(_0x27ade0){if(_0x27ade0){return _0x27ade0?{'count':_0x42a7a9,'rows':_0x27ade0}:null;}})['then'](respondWithResult(_0x32c28c,null))[_0x26ac('0x22')](handleError(_0x32c28c,null));};exports[_0x26ac('0x52')]=function(_0x5e9f24,_0x32b659,_0x5010bb){var _0x4c0013={};var _0x529afe={};var _0x45b728;var _0x2f1d07;return db['VtigerConfiguration'][_0x26ac('0x4f')]({'where':{'id':_0x5e9f24['params']['id']}})[_0x26ac('0x1a')](handleEntityNotFound(_0x32b659,null))[_0x26ac('0x1a')](function(_0x35bf35){if(_0x35bf35){_0x45b728=_0x35bf35;_0x529afe[_0x26ac('0x3a')]=_[_0x26ac('0x34')](db[_0x26ac('0x50')]['rawAttributes']);_0x529afe[_0x26ac('0x33')]=_[_0x26ac('0x34')](_0x5e9f24[_0x26ac('0x33')]);_0x529afe[_0x26ac('0x35')]=_[_0x26ac('0x36')](_0x529afe[_0x26ac('0x3a')],_0x529afe['query']);_0x4c0013['attributes']=_['intersection'](_0x529afe['model'],qs['fields'](_0x5e9f24[_0x26ac('0x33')]['fields']));_0x4c0013['attributes']=_0x4c0013[_0x26ac('0x37')][_0x26ac('0x39')]?_0x4c0013['attributes']:_0x529afe['model'];_0x4c0013[_0x26ac('0x3d')]=qs['sort'](_0x5e9f24[_0x26ac('0x33')][_0x26ac('0x3e')]);_0x4c0013['where']=qs[_0x26ac('0x35')](_['pick'](_0x5e9f24[_0x26ac('0x33')],_0x529afe[_0x26ac('0x35')]));if(_0x5e9f24['query'][_0x26ac('0x51')]){_0x4c0013[_0x26ac('0x41')]=_[_0x26ac('0x40')](_0x4c0013[_0x26ac('0x41')],{'$or':_['map'](_0x4c0013['attributes'],function(_0x1bdfd2){var _0xf4fd1e={};_0xf4fd1e[_0x1bdfd2]={'$like':'%'+_0x5e9f24['query'][_0x26ac('0x51')]+'%'};return _0xf4fd1e;})});}_0x4c0013=_[_0x26ac('0x40')]({},_0x4c0013,_0x5e9f24[_0x26ac('0x43')]);return _0x45b728[_0x26ac('0x52')](_0x4c0013);}})[_0x26ac('0x1a')](function(_0x4d5af2){if(_0x4d5af2){_0x2f1d07=_0x4d5af2[_0x26ac('0x39')];if(!_0x5e9f24[_0x26ac('0x33')]['hasOwnProperty'](_0x26ac('0x3c'))){_0x4c0013[_0x26ac('0x26')]=qs[_0x26ac('0x26')](_0x5e9f24[_0x26ac('0x33')][_0x26ac('0x26')]);_0x4c0013[_0x26ac('0x25')]=qs[_0x26ac('0x25')](_0x5e9f24['query'][_0x26ac('0x25')]);}return _0x45b728[_0x26ac('0x52')](_0x4c0013);}})['then'](function(_0x41fb55){if(_0x41fb55){return _0x41fb55?{'count':_0x2f1d07,'rows':_0x41fb55}:null;}})[_0x26ac('0x1a')](respondWithResult(_0x32b659,null))['catch'](handleError(_0x32b659,null));};exports[_0x26ac('0x53')]=function(_0x548ffe,_0x477595,_0x2eab3f){var _0x333756={};var _0x4ab75d={};var _0x3a5407;var _0xdd16a1;return db[_0x26ac('0x2e')][_0x26ac('0x4f')]({'where':{'id':_0x548ffe[_0x26ac('0x4c')]['id']}})[_0x26ac('0x1a')](handleEntityNotFound(_0x477595,null))[_0x26ac('0x1a')](function(_0x2395e5){if(_0x2395e5){_0x3a5407=_0x2395e5;_0x4ab75d[_0x26ac('0x3a')]=_[_0x26ac('0x34')](db[_0x26ac('0x50')]['rawAttributes']);_0x4ab75d[_0x26ac('0x33')]=_[_0x26ac('0x34')](_0x548ffe[_0x26ac('0x33')]);_0x4ab75d[_0x26ac('0x35')]=_['intersection'](_0x4ab75d['model'],_0x4ab75d[_0x26ac('0x33')]);_0x333756[_0x26ac('0x37')]=_[_0x26ac('0x36')](_0x4ab75d[_0x26ac('0x3a')],qs[_0x26ac('0x38')](_0x548ffe[_0x26ac('0x33')]['fields']));_0x333756['attributes']=_0x333756['attributes'][_0x26ac('0x39')]?_0x333756['attributes']:_0x4ab75d[_0x26ac('0x3a')];_0x333756[_0x26ac('0x3d')]=qs[_0x26ac('0x3e')](_0x548ffe[_0x26ac('0x33')][_0x26ac('0x3e')]);_0x333756[_0x26ac('0x41')]=qs[_0x26ac('0x35')](_['pick'](_0x548ffe[_0x26ac('0x33')],_0x4ab75d[_0x26ac('0x35')]));if(_0x548ffe[_0x26ac('0x33')][_0x26ac('0x51')]){_0x333756['where']=_[_0x26ac('0x40')](_0x333756[_0x26ac('0x41')],{'$or':_['map'](_0x333756[_0x26ac('0x37')],function(_0x46f6ea){var _0x2d9d81={};_0x2d9d81[_0x46f6ea]={'$like':'%'+_0x548ffe[_0x26ac('0x33')][_0x26ac('0x51')]+'%'};return _0x2d9d81;})});}_0x333756=_[_0x26ac('0x40')]({},_0x333756,_0x548ffe[_0x26ac('0x43')]);return _0x3a5407[_0x26ac('0x53')](_0x333756);}})[_0x26ac('0x1a')](function(_0x8303c6){if(_0x8303c6){_0xdd16a1=_0x8303c6['length'];if(!_0x548ffe[_0x26ac('0x33')][_0x26ac('0x3b')](_0x26ac('0x3c'))){_0x333756[_0x26ac('0x26')]=qs[_0x26ac('0x26')](_0x548ffe['query'][_0x26ac('0x26')]);_0x333756[_0x26ac('0x25')]=qs[_0x26ac('0x25')](_0x548ffe[_0x26ac('0x33')][_0x26ac('0x25')]);}return _0x3a5407[_0x26ac('0x53')](_0x333756);}})[_0x26ac('0x1a')](function(_0x349f69){if(_0x349f69){return _0x349f69?{'count':_0xdd16a1,'rows':_0x349f69}:null;}})[_0x26ac('0x1a')](respondWithResult(_0x477595,null))[_0x26ac('0x22')](handleError(_0x477595,null));}; \ No newline at end of file +var _0x5108=['name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VtigerConfiguration','count','includeAll','include','then','rows','length','find','create','body','params','destroy','getFields','findOne','VtigerField','getSubjects','pick','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','map','rawAttributes','fieldName','type','key','model'];(function(_0x14b09b,_0x37268d){var _0x191e9a=function(_0x5ac202){while(--_0x5ac202){_0x14b09b['push'](_0x14b09b['shift']());}};_0x191e9a(++_0x37268d);}(_0x5108,0x1e9));var _0x8510=function(_0x157b81,_0x431b33){_0x157b81=_0x157b81-0x0;var _0x3ad594=_0x5108[_0x157b81];return _0x3ad594;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8510('0x0'));var zipdir=require(_0x8510('0x1'));var jsonpatch=require(_0x8510('0x2'));var rp=require(_0x8510('0x3'));var moment=require(_0x8510('0x4'));var BPromise=require(_0x8510('0x5'));var Mustache=require(_0x8510('0x6'));var util=require(_0x8510('0x7'));var path=require(_0x8510('0x8'));var sox=require(_0x8510('0x9'));var csv=require(_0x8510('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8510('0xb'));var crypto=require(_0x8510('0xc'));var jsforce=require(_0x8510('0xd'));var deskjs=require(_0x8510('0xe'));var toCsv=require(_0x8510('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8510('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8510('0x10'));var as=require(_0x8510('0x11'));var hardwareService=require(_0x8510('0x12'));var logger=require(_0x8510('0x13'))(_0x8510('0x14'));var utils=require(_0x8510('0x15'));var config=require(_0x8510('0x16'));var db=require(_0x8510('0x17'))['db'];var jayson=require(_0x8510('0x18'));var client=jayson[_0x8510('0x19')][_0x8510('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x164bc3,_0x43cd1e,_0x249d3d){if(_0x249d3d){var _0x560a9f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x560a9f[_0x8510('0x1b')](_0x43cd1e)){return _0x164bc3;}else{throw new db[(_0x8510('0x1c'))]['ValidationError'](_0x8510('0x1d'));}}else{return _0x164bc3;}}function respondWithRpcPromise(_0x4c93ba,_0x2fb91a,_0xfef6b5,_0x1ad324){return new BPromise(function(_0x422c6d,_0x49b6e1){var _0x227d28=_0x1ad324||client;return _0x227d28[_0x8510('0x1e')](_0x4c93ba,_0xfef6b5)['then'](function(_0x21a0e5){logger[_0x8510('0x1f')](_0x8510('0x20'),_0x2fb91a,_0x8510('0x21'));logger[_0x8510('0x22')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x2fb91a,_0x8510('0x21'),JSON['stringify'](_0x21a0e5));if(_0x21a0e5[_0x8510('0x23')]){if(_0x21a0e5[_0x8510('0x23')][_0x8510('0x24')]===0x1f4){logger['error'](_0x8510('0x20'),_0x2fb91a,_0x21a0e5[_0x8510('0x23')]['message']);return _0x49b6e1(_0x21a0e5[_0x8510('0x23')][_0x8510('0x25')]);}logger[_0x8510('0x23')](_0x8510('0x20'),_0x2fb91a,_0x21a0e5['error']['message']);return _0x422c6d(_0x21a0e5[_0x8510('0x23')][_0x8510('0x25')]);}else{logger[_0x8510('0x1f')](_0x8510('0x20'),_0x2fb91a,'request\x20sent');_0x422c6d(_0x21a0e5[_0x8510('0x26')][_0x8510('0x25')]);}})[_0x8510('0x27')](function(_0x4e5631){logger[_0x8510('0x23')](_0x8510('0x20'),_0x2fb91a,_0x4e5631);_0x49b6e1(_0x4e5631);});});}function respondWithStatusCode(_0x193f6b,_0x5e755d){_0x5e755d=_0x5e755d||0xcc;return function(_0x14a8ef){if(_0x14a8ef){return _0x193f6b[_0x8510('0x28')](_0x5e755d);}return _0x193f6b[_0x8510('0x29')](_0x5e755d)[_0x8510('0x2a')]();};}function respondWithResult(_0x5bbf00,_0x4819ab){_0x4819ab=_0x4819ab||0xc8;return function(_0x338a7b){if(_0x338a7b){return _0x5bbf00['status'](_0x4819ab)[_0x8510('0x2b')](_0x338a7b);}};}function respondWithFilteredResult(_0x4623d5,_0x29dea3){return function(_0x583bb1){if(_0x583bb1){var _0x11c257=_0x583bb1['count'],_0x4c4868=_0x29dea3[_0x8510('0x2c')],_0x4f6608=_0x29dea3['offset']+_0x29dea3[_0x8510('0x2d')],_0x378d96;if(_0x4f6608>=_0x11c257){_0x4f6608=_0x11c257;_0x378d96=0xc8;}else{_0x378d96=0xce;}_0x4623d5[_0x8510('0x29')](_0x378d96);return _0x4623d5[_0x8510('0x2e')](_0x8510('0x2f'),_0x4c4868+'-'+_0x4f6608+'/'+_0x11c257)[_0x8510('0x2b')](_0x583bb1);}return null;};}function patchUpdates(_0x3c4363){return function(_0x4d98de){try{jsonpatch[_0x8510('0x30')](_0x4d98de,_0x3c4363,!![]);}catch(_0x453f07){return BPromise['reject'](_0x453f07);}return _0x4d98de[_0x8510('0x31')]();};}function saveUpdates(_0x14a69b,_0x224344){return function(_0x15ffc8){if(_0x15ffc8){return _0x15ffc8[_0x8510('0x32')](_0x14a69b)['then'](function(_0x5ecf21){return _0x5ecf21;});}return null;};}function removeEntity(_0x1c2ed8,_0x53a307){return function(_0x1e82fa){if(_0x1e82fa){return _0x1e82fa['destroy']()['then'](function(){_0x1c2ed8['status'](0xcc)[_0x8510('0x2a')]();});}};}function handleEntityNotFound(_0x2e2edd,_0x556956){return function(_0x4e41e6){if(!_0x4e41e6){_0x2e2edd['sendStatus'](0x194);}return _0x4e41e6;};}function handleError(_0x57417d,_0x3058d9){_0x3058d9=_0x3058d9||0x1f4;return function(_0x4a1e49){logger[_0x8510('0x23')](_0x4a1e49['stack']);if(_0x4a1e49['name']){delete _0x4a1e49['name'];}_0x57417d['status'](_0x3058d9)['send'](_0x4a1e49);};}exports['index']=function(_0x42db62,_0x5cf8ac){var _0x291f0d={},_0x4a45ec={},_0x23cc95={'count':0x0,'rows':[]};var _0xf652d9=_[_0x8510('0x33')](db['VtigerConfiguration'][_0x8510('0x34')],function(_0x38d28b){return{'name':_0x38d28b[_0x8510('0x35')],'type':_0x38d28b[_0x8510('0x36')][_0x8510('0x37')]};});_0x4a45ec[_0x8510('0x38')]=_[_0x8510('0x33')](_0xf652d9,_0x8510('0x39'));_0x4a45ec[_0x8510('0x3a')]=_[_0x8510('0x3b')](_0x42db62[_0x8510('0x3a')]);_0x4a45ec[_0x8510('0x3c')]=_['intersection'](_0x4a45ec[_0x8510('0x38')],_0x4a45ec[_0x8510('0x3a')]);_0x291f0d[_0x8510('0x3d')]=_[_0x8510('0x3e')](_0x4a45ec[_0x8510('0x38')],qs[_0x8510('0x3f')](_0x42db62[_0x8510('0x3a')][_0x8510('0x3f')]));_0x291f0d['attributes']=_0x291f0d['attributes']['length']?_0x291f0d[_0x8510('0x3d')]:_0x4a45ec[_0x8510('0x38')];if(!_0x42db62['query'][_0x8510('0x40')](_0x8510('0x41'))){_0x291f0d[_0x8510('0x2d')]=qs[_0x8510('0x2d')](_0x42db62[_0x8510('0x3a')][_0x8510('0x2d')]);_0x291f0d[_0x8510('0x2c')]=qs[_0x8510('0x2c')](_0x42db62[_0x8510('0x3a')][_0x8510('0x2c')]);}_0x291f0d[_0x8510('0x42')]=qs[_0x8510('0x43')](_0x42db62[_0x8510('0x3a')]['sort']);_0x291f0d[_0x8510('0x44')]=qs[_0x8510('0x3c')](_['pick'](_0x42db62['query'],_0x4a45ec[_0x8510('0x3c')]));if(_0x42db62['query'][_0x8510('0x45')]){_0x291f0d[_0x8510('0x44')]=_[_0x8510('0x46')](_0x291f0d['where'],{'$or':_[_0x8510('0x33')](_0xf652d9,function(_0x26c3e0){if(_0x26c3e0[_0x8510('0x36')]!==_0x8510('0x47')){var _0x2aa3f2={};_0x2aa3f2[_0x26c3e0['name']]={'$like':'%'+_0x42db62[_0x8510('0x3a')][_0x8510('0x45')]+'%'};return _0x2aa3f2;}})});}_0x291f0d=_[_0x8510('0x46')]({},_0x291f0d,_0x42db62[_0x8510('0x48')]);var _0x157759={'where':_0x291f0d[_0x8510('0x44')]};return db[_0x8510('0x49')]['count'](_0x157759)['then'](function(_0x533ad4){_0x23cc95[_0x8510('0x4a')]=_0x533ad4;if(_0x42db62[_0x8510('0x3a')][_0x8510('0x4b')]){_0x291f0d[_0x8510('0x4c')]=[{'all':!![]}];}return db[_0x8510('0x49')]['findAll'](_0x291f0d);})[_0x8510('0x4d')](function(_0x15065e){_0x23cc95[_0x8510('0x4e')]=_0x15065e;return _0x23cc95;})[_0x8510('0x4d')](respondWithFilteredResult(_0x5cf8ac,_0x291f0d))[_0x8510('0x27')](handleError(_0x5cf8ac,null));};exports['show']=function(_0x2f4e24,_0x1312ee){var _0x27f9d8={'raw':![],'where':{'id':_0x2f4e24['params']['id']}},_0x5c2ca6={};_0x5c2ca6[_0x8510('0x38')]=_[_0x8510('0x3b')](db[_0x8510('0x49')]['rawAttributes']);_0x5c2ca6['query']=_['keys'](_0x2f4e24['query']);_0x5c2ca6[_0x8510('0x3c')]=_[_0x8510('0x3e')](_0x5c2ca6[_0x8510('0x38')],_0x5c2ca6[_0x8510('0x3a')]);_0x27f9d8['attributes']=_[_0x8510('0x3e')](_0x5c2ca6['model'],qs[_0x8510('0x3f')](_0x2f4e24[_0x8510('0x3a')][_0x8510('0x3f')]));_0x27f9d8['attributes']=_0x27f9d8[_0x8510('0x3d')][_0x8510('0x4f')]?_0x27f9d8[_0x8510('0x3d')]:_0x5c2ca6[_0x8510('0x38')];if(_0x2f4e24[_0x8510('0x3a')]['includeAll']){_0x27f9d8[_0x8510('0x4c')]=[{'all':!![]}];}_0x27f9d8=_[_0x8510('0x46')]({},_0x27f9d8,_0x2f4e24[_0x8510('0x48')]);return db[_0x8510('0x49')][_0x8510('0x50')](_0x27f9d8)[_0x8510('0x4d')](handleEntityNotFound(_0x1312ee,null))[_0x8510('0x4d')](respondWithResult(_0x1312ee,null))[_0x8510('0x27')](handleError(_0x1312ee,null));};exports['create']=function(_0x4b82c1,_0x4dba2b){return db[_0x8510('0x49')][_0x8510('0x51')](_0x4b82c1[_0x8510('0x52')],{})[_0x8510('0x4d')](respondWithResult(_0x4dba2b,0xc9))[_0x8510('0x27')](handleError(_0x4dba2b,null));};exports[_0x8510('0x32')]=function(_0x5aafad,_0x3be008){if(_0x5aafad[_0x8510('0x52')]['id']){delete _0x5aafad[_0x8510('0x52')]['id'];}return db[_0x8510('0x49')][_0x8510('0x50')]({'where':{'id':_0x5aafad[_0x8510('0x53')]['id']}})['then'](handleEntityNotFound(_0x3be008,null))[_0x8510('0x4d')](saveUpdates(_0x5aafad[_0x8510('0x52')],null))[_0x8510('0x4d')](respondWithResult(_0x3be008,null))[_0x8510('0x27')](handleError(_0x3be008,null));};exports[_0x8510('0x54')]=function(_0x298d12,_0x535b56){return db['VtigerConfiguration'][_0x8510('0x50')]({'where':{'id':_0x298d12[_0x8510('0x53')]['id']}})[_0x8510('0x4d')](handleEntityNotFound(_0x535b56,null))[_0x8510('0x4d')](removeEntity(_0x535b56,null))[_0x8510('0x27')](handleError(_0x535b56,null));};exports[_0x8510('0x55')]=function(_0x22820d,_0x379111,_0x5d85fa){var _0x18af41={};var _0x133913={};var _0x36048d;var _0x9714a6;return db[_0x8510('0x49')][_0x8510('0x56')]({'where':{'id':_0x22820d[_0x8510('0x53')]['id']}})[_0x8510('0x4d')](handleEntityNotFound(_0x379111,null))['then'](function(_0x3966b8){if(_0x3966b8){_0x36048d=_0x3966b8;_0x133913[_0x8510('0x38')]=_[_0x8510('0x3b')](db[_0x8510('0x57')][_0x8510('0x34')]);_0x133913[_0x8510('0x3a')]=_[_0x8510('0x3b')](_0x22820d[_0x8510('0x3a')]);_0x133913[_0x8510('0x3c')]=_['intersection'](_0x133913['model'],_0x133913['query']);_0x18af41[_0x8510('0x3d')]=_['intersection'](_0x133913['model'],qs['fields'](_0x22820d['query'][_0x8510('0x3f')]));_0x18af41[_0x8510('0x3d')]=_0x18af41[_0x8510('0x3d')][_0x8510('0x4f')]?_0x18af41[_0x8510('0x3d')]:_0x133913[_0x8510('0x38')];_0x18af41['order']=qs[_0x8510('0x43')](_0x22820d[_0x8510('0x3a')]['sort']);_0x18af41[_0x8510('0x44')]=qs[_0x8510('0x3c')](_['pick'](_0x22820d[_0x8510('0x3a')],_0x133913[_0x8510('0x3c')]));if(_0x22820d['query'][_0x8510('0x45')]){_0x18af41[_0x8510('0x44')]=_['merge'](_0x18af41[_0x8510('0x44')],{'$or':_['map'](_0x18af41[_0x8510('0x3d')],function(_0x3c0701){var _0xa83dcd={};_0xa83dcd[_0x3c0701]={'$like':'%'+_0x22820d[_0x8510('0x3a')][_0x8510('0x45')]+'%'};return _0xa83dcd;})});}_0x18af41=_[_0x8510('0x46')]({},_0x18af41,_0x22820d[_0x8510('0x48')]);return _0x36048d[_0x8510('0x55')](_0x18af41);}})[_0x8510('0x4d')](function(_0x92afd7){if(_0x92afd7){_0x9714a6=_0x92afd7['length'];if(!_0x22820d['query'][_0x8510('0x40')]('nolimit')){_0x18af41[_0x8510('0x2d')]=qs[_0x8510('0x2d')](_0x22820d['query'][_0x8510('0x2d')]);_0x18af41['offset']=qs['offset'](_0x22820d[_0x8510('0x3a')][_0x8510('0x2c')]);}return _0x36048d['getFields'](_0x18af41);}})['then'](function(_0x2a5601){if(_0x2a5601){return _0x2a5601?{'count':_0x9714a6,'rows':_0x2a5601}:null;}})['then'](respondWithResult(_0x379111,null))[_0x8510('0x27')](handleError(_0x379111,null));};exports[_0x8510('0x58')]=function(_0x257948,_0x192a83,_0x2df5b8){var _0x87abdf={};var _0x3da692={};var _0x1e53e2;var _0x2551ac;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x257948[_0x8510('0x53')]['id']}})[_0x8510('0x4d')](handleEntityNotFound(_0x192a83,null))[_0x8510('0x4d')](function(_0x38c127){if(_0x38c127){_0x1e53e2=_0x38c127;_0x3da692['model']=_[_0x8510('0x3b')](db[_0x8510('0x57')][_0x8510('0x34')]);_0x3da692[_0x8510('0x3a')]=_[_0x8510('0x3b')](_0x257948['query']);_0x3da692[_0x8510('0x3c')]=_[_0x8510('0x3e')](_0x3da692[_0x8510('0x38')],_0x3da692[_0x8510('0x3a')]);_0x87abdf[_0x8510('0x3d')]=_[_0x8510('0x3e')](_0x3da692[_0x8510('0x38')],qs[_0x8510('0x3f')](_0x257948[_0x8510('0x3a')][_0x8510('0x3f')]));_0x87abdf[_0x8510('0x3d')]=_0x87abdf[_0x8510('0x3d')][_0x8510('0x4f')]?_0x87abdf[_0x8510('0x3d')]:_0x3da692[_0x8510('0x38')];_0x87abdf['order']=qs[_0x8510('0x43')](_0x257948[_0x8510('0x3a')]['sort']);_0x87abdf[_0x8510('0x44')]=qs[_0x8510('0x3c')](_[_0x8510('0x59')](_0x257948['query'],_0x3da692['filters']));if(_0x257948[_0x8510('0x3a')][_0x8510('0x45')]){_0x87abdf[_0x8510('0x44')]=_[_0x8510('0x46')](_0x87abdf[_0x8510('0x44')],{'$or':_[_0x8510('0x33')](_0x87abdf['attributes'],function(_0x2f90fd){var _0x17ee51={};_0x17ee51[_0x2f90fd]={'$like':'%'+_0x257948[_0x8510('0x3a')][_0x8510('0x45')]+'%'};return _0x17ee51;})});}_0x87abdf=_[_0x8510('0x46')]({},_0x87abdf,_0x257948['options']);return _0x1e53e2[_0x8510('0x58')](_0x87abdf);}})[_0x8510('0x4d')](function(_0x422ae3){if(_0x422ae3){_0x2551ac=_0x422ae3['length'];if(!_0x257948[_0x8510('0x3a')]['hasOwnProperty']('nolimit')){_0x87abdf['limit']=qs[_0x8510('0x2d')](_0x257948[_0x8510('0x3a')][_0x8510('0x2d')]);_0x87abdf[_0x8510('0x2c')]=qs[_0x8510('0x2c')](_0x257948[_0x8510('0x3a')][_0x8510('0x2c')]);}return _0x1e53e2[_0x8510('0x58')](_0x87abdf);}})[_0x8510('0x4d')](function(_0x42f123){if(_0x42f123){return _0x42f123?{'count':_0x2551ac,'rows':_0x42f123}:null;}})[_0x8510('0x4d')](respondWithResult(_0x192a83,null))['catch'](handleError(_0x192a83,null));};exports[_0x8510('0x5a')]=function(_0x248975,_0xcfa68d,_0x5a22ed){var _0x4ba436={};var _0x278b68={};var _0x10a9b3;var _0x137182;return db[_0x8510('0x49')][_0x8510('0x56')]({'where':{'id':_0x248975[_0x8510('0x53')]['id']}})['then'](handleEntityNotFound(_0xcfa68d,null))['then'](function(_0x5bab5d){if(_0x5bab5d){_0x10a9b3=_0x5bab5d;_0x278b68[_0x8510('0x38')]=_[_0x8510('0x3b')](db[_0x8510('0x57')][_0x8510('0x34')]);_0x278b68[_0x8510('0x3a')]=_['keys'](_0x248975[_0x8510('0x3a')]);_0x278b68[_0x8510('0x3c')]=_[_0x8510('0x3e')](_0x278b68[_0x8510('0x38')],_0x278b68['query']);_0x4ba436['attributes']=_[_0x8510('0x3e')](_0x278b68['model'],qs['fields'](_0x248975[_0x8510('0x3a')]['fields']));_0x4ba436[_0x8510('0x3d')]=_0x4ba436[_0x8510('0x3d')][_0x8510('0x4f')]?_0x4ba436['attributes']:_0x278b68[_0x8510('0x38')];_0x4ba436[_0x8510('0x42')]=qs[_0x8510('0x43')](_0x248975[_0x8510('0x3a')][_0x8510('0x43')]);_0x4ba436[_0x8510('0x44')]=qs[_0x8510('0x3c')](_[_0x8510('0x59')](_0x248975[_0x8510('0x3a')],_0x278b68[_0x8510('0x3c')]));if(_0x248975['query'][_0x8510('0x45')]){_0x4ba436[_0x8510('0x44')]=_[_0x8510('0x46')](_0x4ba436[_0x8510('0x44')],{'$or':_[_0x8510('0x33')](_0x4ba436[_0x8510('0x3d')],function(_0x4e82e6){var _0x5001f7={};_0x5001f7[_0x4e82e6]={'$like':'%'+_0x248975[_0x8510('0x3a')]['filter']+'%'};return _0x5001f7;})});}_0x4ba436=_[_0x8510('0x46')]({},_0x4ba436,_0x248975['options']);return _0x10a9b3[_0x8510('0x5a')](_0x4ba436);}})[_0x8510('0x4d')](function(_0x1d17ba){if(_0x1d17ba){_0x137182=_0x1d17ba[_0x8510('0x4f')];if(!_0x248975[_0x8510('0x3a')][_0x8510('0x40')](_0x8510('0x41'))){_0x4ba436[_0x8510('0x2d')]=qs[_0x8510('0x2d')](_0x248975[_0x8510('0x3a')][_0x8510('0x2d')]);_0x4ba436[_0x8510('0x2c')]=qs[_0x8510('0x2c')](_0x248975[_0x8510('0x3a')][_0x8510('0x2c')]);}return _0x10a9b3[_0x8510('0x5a')](_0x4ba436);}})[_0x8510('0x4d')](function(_0x22b289){if(_0x22b289){return _0x22b289?{'count':_0x137182,'rows':_0x22b289}:null;}})[_0x8510('0x4d')](respondWithResult(_0xcfa68d,null))[_0x8510('0x27')](handleError(_0xcfa68d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index a0235ea..48e708d 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 _0x3f91=['./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util','bluebird','path','rimraf','../../config/environment'];(function(_0x336bbe,_0x27da18){var _0x3eb536=function(_0x1c3a93){while(--_0x1c3a93){_0x336bbe['push'](_0x336bbe['shift']());}};_0x3eb536(++_0x27da18);}(_0x3f91,0x1db));var _0x13f9=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x3f91[_0x342baa];return _0x1208f3;};'use strict';var _=require('lodash');var util=require(_0x13f9('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x13f9('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x13f9('0x2'));var rimraf=require(_0x13f9('0x3'));var config=require(_0x13f9('0x4'));var attributes=require(_0x13f9('0x5'));module[_0x13f9('0x6')]=function(_0x1bf71a,_0x231e3d){return _0x1bf71a[_0x13f9('0x7')](_0x13f9('0x8'),attributes,{'tableName':_0x13f9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc400=['path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','util','../../config/logger','api','bluebird','request-promise'];(function(_0x305625,_0x2db747){var _0x580318=function(_0x4a724e){while(--_0x4a724e){_0x305625['push'](_0x305625['shift']());}};_0x580318(++_0x2db747);}(_0xc400,0xd7));var _0x0c40=function(_0x1f2840,_0x1282aa){_0x1f2840=_0x1f2840-0x0;var _0x1cc727=_0xc400[_0x1f2840];return _0x1cc727;};'use strict';var _=require('lodash');var util=require(_0x0c40('0x0'));var logger=require(_0x0c40('0x1'))(_0x0c40('0x2'));var moment=require('moment');var BPromise=require(_0x0c40('0x3'));var rp=require(_0x0c40('0x4'));var fs=require('fs');var path=require(_0x0c40('0x5'));var rimraf=require('rimraf');var config=require(_0x0c40('0x6'));var attributes=require(_0x0c40('0x7'));module[_0x0c40('0x8')]=function(_0x2ff058,_0x239652){return _0x2ff058[_0x0c40('0x9')](_0x0c40('0xa'),attributes,{'tableName':'int_vtiger_configurations','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 9d07e3b..1d26171 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 _0xe8a1=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x304bf7,_0x4fcafc){var _0x5036cd=function(_0x39e810){while(--_0x39e810){_0x304bf7['push'](_0x304bf7['shift']());}};_0x5036cd(++_0x4fcafc);}(_0xe8a1,0x17c));var _0x1e8a=function(_0x4ca6cb,_0xca0269){_0x4ca6cb=_0x4ca6cb-0x0;var _0x17e653=_0xe8a1[_0x4ca6cb];return _0x17e653;};'use strict';var _=require(_0x1e8a('0x0'));var util=require('util');var moment=require(_0x1e8a('0x1'));var BPromise=require(_0x1e8a('0x2'));var rs=require(_0x1e8a('0x3'));var fs=require('fs');var Redis=require(_0x1e8a('0x4'));var db=require(_0x1e8a('0x5'))['db'];var utils=require(_0x1e8a('0x6'));var logger=require('../../config/logger')(_0x1e8a('0x7'));var config=require(_0x1e8a('0x8'));var jayson=require(_0x1e8a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x200a41,_0x1794d6,_0x3c0307){return new BPromise(function(_0x508ec8,_0x4a6a47){return client[_0x1e8a('0xa')](_0x200a41,_0x3c0307)[_0x1e8a('0xb')](function(_0x4e7825){logger[_0x1e8a('0xc')](_0x1e8a('0xd'),_0x1794d6,_0x1e8a('0xe'));logger['debug'](_0x1e8a('0xf'),_0x1794d6,_0x1e8a('0xe'),JSON['stringify'](_0x4e7825));if(_0x4e7825[_0x1e8a('0x10')]){if(_0x4e7825[_0x1e8a('0x10')][_0x1e8a('0x11')]===0x1f4){logger[_0x1e8a('0x10')](_0x1e8a('0xd'),_0x1794d6,_0x4e7825[_0x1e8a('0x10')][_0x1e8a('0x12')]);return _0x4a6a47(_0x4e7825['error'][_0x1e8a('0x12')]);}logger[_0x1e8a('0x10')](_0x1e8a('0xd'),_0x1794d6,_0x4e7825['error'][_0x1e8a('0x12')]);return _0x508ec8(_0x4e7825[_0x1e8a('0x10')][_0x1e8a('0x12')]);}else{logger['info'](_0x1e8a('0xd'),_0x1794d6,_0x1e8a('0xe'));_0x508ec8(_0x4e7825[_0x1e8a('0x13')][_0x1e8a('0x12')]);}})[_0x1e8a('0x14')](function(_0x5d2b51){logger[_0x1e8a('0x10')](_0x1e8a('0xd'),_0x1794d6,_0x5d2b51);_0x4a6a47(_0x5d2b51);});});} \ No newline at end of file +var _0xa465=['then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','code','message','error','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0xc1d691,_0x166b6e){var _0x16ac7=function(_0x134adc){while(--_0x134adc){_0xc1d691['push'](_0xc1d691['shift']());}};_0x16ac7(++_0x166b6e);}(_0xa465,0x159));var _0x5a46=function(_0x423e4b,_0x1bb75b){_0x423e4b=_0x423e4b-0x0;var _0x626fd4=_0xa465[_0x423e4b];return _0x626fd4;};'use strict';var _=require(_0x5a46('0x0'));var util=require(_0x5a46('0x1'));var moment=require('moment');var BPromise=require(_0x5a46('0x2'));var rs=require(_0x5a46('0x3'));var fs=require('fs');var Redis=require(_0x5a46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a46('0x5'));var logger=require(_0x5a46('0x6'))(_0x5a46('0x7'));var config=require(_0x5a46('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5a46('0x9')][_0x5a46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bc823,_0xbd55ad,_0x3f1371){return new BPromise(function(_0x358903,_0x57d86b){return client[_0x5a46('0xb')](_0x1bc823,_0x3f1371)[_0x5a46('0xc')](function(_0x14d43){logger[_0x5a46('0xd')](_0x5a46('0xe'),_0xbd55ad,'request\x20sent');logger[_0x5a46('0xf')](_0x5a46('0x10'),_0xbd55ad,_0x5a46('0x11'),JSON['stringify'](_0x14d43));if(_0x14d43['error']){if(_0x14d43['error'][_0x5a46('0x12')]===0x1f4){logger['error'](_0x5a46('0xe'),_0xbd55ad,_0x14d43['error'][_0x5a46('0x13')]);return _0x57d86b(_0x14d43[_0x5a46('0x14')][_0x5a46('0x13')]);}logger[_0x5a46('0x14')](_0x5a46('0xe'),_0xbd55ad,_0x14d43[_0x5a46('0x14')][_0x5a46('0x13')]);return _0x358903(_0x14d43['error']['message']);}else{logger[_0x5a46('0xd')](_0x5a46('0xe'),_0xbd55ad,_0x5a46('0x11'));_0x358903(_0x14d43['result'][_0x5a46('0x13')]);}})['catch'](function(_0x462728){logger[_0x5a46('0x14')](_0x5a46('0xe'),_0xbd55ad,_0x462728);_0x57d86b(_0x462728);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 20d61bb..cb203cc 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 _0x1876=['isAuthenticated','show','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get'];(function(_0x46745a,_0x381bcb){var _0x48dc70=function(_0x288ac8){while(--_0x288ac8){_0x46745a['push'](_0x46745a['shift']());}};_0x48dc70(++_0x381bcb);}(_0x1876,0xd4));var _0x6187=function(_0x2b0d1c,_0x2307d2){_0x2b0d1c=_0x2b0d1c-0x0;var _0x4e368e=_0x1876[_0x2b0d1c];return _0x4e368e;};'use strict';var multer=require(_0x6187('0x0'));var util=require('util');var path=require(_0x6187('0x1'));var timeout=require(_0x6187('0x2'));var express=require(_0x6187('0x3'));var router=express['Router']();var auth=require(_0x6187('0x4'));var interaction=require(_0x6187('0x5'));var config=require(_0x6187('0x6'));var controller=require(_0x6187('0x7'));router[_0x6187('0x8')]('/',auth[_0x6187('0x9')](),controller['index']);router[_0x6187('0x8')]('/:id',auth[_0x6187('0x9')](),controller[_0x6187('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6187('0xb')]);router[_0x6187('0xc')](_0x6187('0xd'),auth[_0x6187('0x9')](),controller[_0x6187('0xe')]);router[_0x6187('0xf')](_0x6187('0xd'),auth['isAuthenticated'](),controller[_0x6187('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1dd9=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','update','delete','destroy','exports','multer','util','path'];(function(_0x4dd479,_0x26d87a){var _0x1b6807=function(_0x2bec19){while(--_0x2bec19){_0x4dd479['push'](_0x4dd479['shift']());}};_0x1b6807(++_0x26d87a);}(_0x1dd9,0x165));var _0x91dd=function(_0x2ce5e8,_0x1ce40c){_0x2ce5e8=_0x2ce5e8-0x0;var _0x37cf34=_0x1dd9[_0x2ce5e8];return _0x37cf34;};'use strict';var multer=require(_0x91dd('0x0'));var util=require(_0x91dd('0x1'));var path=require(_0x91dd('0x2'));var timeout=require(_0x91dd('0x3'));var express=require(_0x91dd('0x4'));var router=express[_0x91dd('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x91dd('0x6'));var config=require(_0x91dd('0x7'));var controller=require(_0x91dd('0x8'));router['get']('/',auth[_0x91dd('0x9')](),controller[_0x91dd('0xa')]);router[_0x91dd('0xb')](_0x91dd('0xc'),auth[_0x91dd('0x9')](),controller[_0x91dd('0xd')]);router['post']('/',auth[_0x91dd('0x9')](),controller['create']);router['put'](_0x91dd('0xc'),auth[_0x91dd('0x9')](),controller[_0x91dd('0xe')]);router[_0x91dd('0xf')]('/:id',auth[_0x91dd('0x9')](),controller[_0x91dd('0x10')]);module[_0x91dd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 97be665..1f919e0 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 _0x691a=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x13e827,_0x361cf1){var _0x5b5256=function(_0x532bb0){while(--_0x532bb0){_0x13e827['push'](_0x13e827['shift']());}};_0x5b5256(++_0x361cf1);}(_0x691a,0x1df));var _0xa691=function(_0x2b7d27,_0x369974){_0x2b7d27=_0x2b7d27-0x0;var _0x32a3dc=_0x691a[_0x2b7d27];return _0x32a3dc;};'use strict';var Sequelize=require(_0xa691('0x0'));module[_0xa691('0x1')]={'type':{'type':Sequelize[_0xa691('0x2')](_0xa691('0x3'),_0xa691('0x4'),_0xa691('0x5'),_0xa691('0x6')),'defaultValue':_0xa691('0x3')},'content':{'type':Sequelize[_0xa691('0x7')]},'key':{'type':Sequelize[_0xa691('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xa691('0x3'),_0xa691('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xa691('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa691('0x7')]},'customField':{'type':Sequelize[_0xa691('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa691('0x7')]}}; \ No newline at end of file +var _0xd3c6=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x926d42,_0x40a01d){var _0x479904=function(_0x485fde){while(--_0x485fde){_0x926d42['push'](_0x926d42['shift']());}};_0x479904(++_0x40a01d);}(_0xd3c6,0x121));var _0x6d3c=function(_0x3cea15,_0xfdfe1d){_0x3cea15=_0x3cea15-0x0;var _0x1f3c59=_0xd3c6[_0x3cea15];return _0x1f3c59;};'use strict';var Sequelize=require(_0x6d3c('0x0'));module[_0x6d3c('0x1')]={'type':{'type':Sequelize[_0x6d3c('0x2')](_0x6d3c('0x3'),_0x6d3c('0x4'),_0x6d3c('0x5'),_0x6d3c('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6d3c('0x7')]},'key':{'type':Sequelize[_0x6d3c('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x6d3c('0x3'),_0x6d3c('0x4'),_0x6d3c('0x5'))},'keyContent':{'type':Sequelize[_0x6d3c('0x7')]},'idField':{'type':Sequelize[_0x6d3c('0x7')]},'nameField':{'type':Sequelize[_0x6d3c('0x7')]},'customField':{'type':Sequelize[_0x6d3c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6d3c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index c47fb0b..b15ccf2 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 _0x9cb5=['save','update','then','error','stack','name','index','map','VtigerField','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','params','keys','include','options','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x21be91,_0x4c003b){var _0x407f0e=function(_0x46c44c){while(--_0x46c44c){_0x21be91['push'](_0x21be91['shift']());}};_0x407f0e(++_0x4c003b);}(_0x9cb5,0xb6));var _0x59cb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9cb5[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x59cb('0x0'));var emlformat=require(_0x59cb('0x1'));var rimraf=require(_0x59cb('0x2'));var zipdir=require(_0x59cb('0x3'));var jsonpatch=require(_0x59cb('0x4'));var rp=require('request-promise');var moment=require(_0x59cb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x59cb('0x6'));var util=require('util');var path=require(_0x59cb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x59cb('0x8'));var squel=require(_0x59cb('0x9'));var crypto=require(_0x59cb('0xa'));var jsforce=require(_0x59cb('0xb'));var deskjs=require(_0x59cb('0xc'));var toCsv=require(_0x59cb('0xd'));var querystring=require(_0x59cb('0xe'));var Papa=require(_0x59cb('0xf'));var Redis=require(_0x59cb('0x10'));var authService=require(_0x59cb('0x11'));var qs=require(_0x59cb('0x12'));var as=require(_0x59cb('0x13'));var hardwareService=require(_0x59cb('0x14'));var logger=require('../../config/logger')(_0x59cb('0x15'));var utils=require('../../config/utils');var config=require(_0x59cb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e899a,_0x2c768e){_0x2c768e=_0x2c768e||0xcc;return function(_0x274929){if(_0x274929){return _0x5e899a[_0x59cb('0x17')](_0x2c768e);}return _0x5e899a[_0x59cb('0x18')](_0x2c768e)[_0x59cb('0x19')]();};}function respondWithResult(_0x51e90c,_0x3596bc){_0x3596bc=_0x3596bc||0xc8;return function(_0x44589a){if(_0x44589a){return _0x51e90c[_0x59cb('0x18')](_0x3596bc)[_0x59cb('0x1a')](_0x44589a);}};}function respondWithFilteredResult(_0x33ea5d,_0x2ae459){return function(_0x2d9cce){if(_0x2d9cce){var _0x5d3252=_0x2d9cce[_0x59cb('0x1b')],_0x2262fe=_0x2ae459[_0x59cb('0x1c')],_0x159dfa=_0x2ae459[_0x59cb('0x1c')]+_0x2ae459[_0x59cb('0x1d')],_0x406b3a;if(_0x159dfa>=_0x5d3252){_0x159dfa=_0x5d3252;_0x406b3a=0xc8;}else{_0x406b3a=0xce;}_0x33ea5d['status'](_0x406b3a);return _0x33ea5d[_0x59cb('0x1e')](_0x59cb('0x1f'),_0x2262fe+'-'+_0x159dfa+'/'+_0x5d3252)[_0x59cb('0x1a')](_0x2d9cce);}return null;};}function patchUpdates(_0x1d5db7){return function(_0x4f989c){try{jsonpatch[_0x59cb('0x20')](_0x4f989c,_0x1d5db7,!![]);}catch(_0x53d61c){return BPromise[_0x59cb('0x21')](_0x53d61c);}return _0x4f989c[_0x59cb('0x22')]();};}function saveUpdates(_0x2179f6,_0x27f36d){return function(_0x36c39e){if(_0x36c39e){return _0x36c39e[_0x59cb('0x23')](_0x2179f6)[_0x59cb('0x24')](function(_0x2b04ae){return _0x2b04ae;});}return null;};}function removeEntity(_0x5aba0c,_0xdc4539){return function(_0x4e8d0f){if(_0x4e8d0f){return _0x4e8d0f['destroy']()[_0x59cb('0x24')](function(){_0x5aba0c[_0x59cb('0x18')](0xcc)[_0x59cb('0x19')]();});}};}function handleEntityNotFound(_0x542d30,_0x2cebd7){return function(_0x4754ae){if(!_0x4754ae){_0x542d30[_0x59cb('0x17')](0x194);}return _0x4754ae;};}function handleError(_0x5407c4,_0xdc9ffc){_0xdc9ffc=_0xdc9ffc||0x1f4;return function(_0x41f865){logger[_0x59cb('0x25')](_0x41f865[_0x59cb('0x26')]);if(_0x41f865[_0x59cb('0x27')]){delete _0x41f865[_0x59cb('0x27')];}_0x5407c4[_0x59cb('0x18')](_0xdc9ffc)['send'](_0x41f865);};}exports[_0x59cb('0x28')]=function(_0x14a1f4,_0x1cf665){var _0x2d817e={},_0x4cf88b={},_0x18eca8={'count':0x0,'rows':[]};var _0x110e2a=_[_0x59cb('0x29')](db[_0x59cb('0x2a')]['rawAttributes'],function(_0xf6bcae){return{'name':_0xf6bcae[_0x59cb('0x2b')],'type':_0xf6bcae[_0x59cb('0x2c')][_0x59cb('0x2d')]};});_0x4cf88b[_0x59cb('0x2e')]=_[_0x59cb('0x29')](_0x110e2a,_0x59cb('0x27'));_0x4cf88b[_0x59cb('0x2f')]=_['keys'](_0x14a1f4[_0x59cb('0x2f')]);_0x4cf88b[_0x59cb('0x30')]=_[_0x59cb('0x31')](_0x4cf88b['model'],_0x4cf88b[_0x59cb('0x2f')]);_0x2d817e[_0x59cb('0x32')]=_['intersection'](_0x4cf88b[_0x59cb('0x2e')],qs[_0x59cb('0x33')](_0x14a1f4[_0x59cb('0x2f')][_0x59cb('0x33')]));_0x2d817e[_0x59cb('0x32')]=_0x2d817e[_0x59cb('0x32')]['length']?_0x2d817e[_0x59cb('0x32')]:_0x4cf88b[_0x59cb('0x2e')];if(!_0x14a1f4[_0x59cb('0x2f')][_0x59cb('0x34')](_0x59cb('0x35'))){_0x2d817e[_0x59cb('0x1d')]=qs[_0x59cb('0x1d')](_0x14a1f4[_0x59cb('0x2f')][_0x59cb('0x1d')]);_0x2d817e['offset']=qs[_0x59cb('0x1c')](_0x14a1f4[_0x59cb('0x2f')][_0x59cb('0x1c')]);}_0x2d817e[_0x59cb('0x36')]=qs['sort'](_0x14a1f4['query']['sort']);_0x2d817e[_0x59cb('0x37')]=qs['filters'](_[_0x59cb('0x38')](_0x14a1f4['query'],_0x4cf88b[_0x59cb('0x30')]));if(_0x14a1f4['query'][_0x59cb('0x39')]){_0x2d817e[_0x59cb('0x37')]=_[_0x59cb('0x3a')](_0x2d817e[_0x59cb('0x37')],{'$or':_['map'](_0x110e2a,function(_0x2eb338){if(_0x2eb338['type']!==_0x59cb('0x3b')){var _0x594de9={};_0x594de9[_0x2eb338[_0x59cb('0x27')]]={'$like':'%'+_0x14a1f4['query'][_0x59cb('0x39')]+'%'};return _0x594de9;}})});}_0x2d817e=_[_0x59cb('0x3a')]({},_0x2d817e,_0x14a1f4['options']);var _0x5df459={'where':_0x2d817e['where']};return db['VtigerField']['count'](_0x5df459)[_0x59cb('0x24')](function(_0x5b9b67){_0x18eca8['count']=_0x5b9b67;if(_0x14a1f4['query']['includeAll']){_0x2d817e['include']=[{'all':!![]}];}return db['VtigerField'][_0x59cb('0x3c')](_0x2d817e);})['then'](function(_0x2a41a5){_0x18eca8[_0x59cb('0x3d')]=_0x2a41a5;return _0x18eca8;})[_0x59cb('0x24')](respondWithFilteredResult(_0x1cf665,_0x2d817e))[_0x59cb('0x3e')](handleError(_0x1cf665,null));};exports[_0x59cb('0x3f')]=function(_0x594937,_0x1c86df){var _0x61c20={'raw':!![],'where':{'id':_0x594937[_0x59cb('0x40')]['id']}},_0x14dece={};_0x14dece[_0x59cb('0x2e')]=_[_0x59cb('0x41')](db[_0x59cb('0x2a')]['rawAttributes']);_0x14dece[_0x59cb('0x2f')]=_[_0x59cb('0x41')](_0x594937['query']);_0x14dece['filters']=_[_0x59cb('0x31')](_0x14dece[_0x59cb('0x2e')],_0x14dece[_0x59cb('0x2f')]);_0x61c20[_0x59cb('0x32')]=_[_0x59cb('0x31')](_0x14dece[_0x59cb('0x2e')],qs['fields'](_0x594937[_0x59cb('0x2f')][_0x59cb('0x33')]));_0x61c20[_0x59cb('0x32')]=_0x61c20[_0x59cb('0x32')]['length']?_0x61c20[_0x59cb('0x32')]:_0x14dece[_0x59cb('0x2e')];if(_0x594937[_0x59cb('0x2f')]['includeAll']){_0x61c20[_0x59cb('0x42')]=[{'all':!![]}];}_0x61c20=_[_0x59cb('0x3a')]({},_0x61c20,_0x594937[_0x59cb('0x43')]);return db[_0x59cb('0x2a')][_0x59cb('0x44')](_0x61c20)['then'](handleEntityNotFound(_0x1c86df,null))[_0x59cb('0x24')](respondWithResult(_0x1c86df,null))[_0x59cb('0x3e')](handleError(_0x1c86df,null));};exports[_0x59cb('0x45')]=function(_0x48a402,_0x2520a0){return db[_0x59cb('0x2a')][_0x59cb('0x45')](_0x48a402[_0x59cb('0x46')],{})[_0x59cb('0x24')](respondWithResult(_0x2520a0,0xc9))[_0x59cb('0x3e')](handleError(_0x2520a0,null));};exports[_0x59cb('0x23')]=function(_0x6edb71,_0x142b52){if(_0x6edb71[_0x59cb('0x46')]['id']){delete _0x6edb71[_0x59cb('0x46')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x6edb71[_0x59cb('0x40')]['id']}})[_0x59cb('0x24')](handleEntityNotFound(_0x142b52,null))[_0x59cb('0x24')](saveUpdates(_0x6edb71['body'],null))['then'](respondWithResult(_0x142b52,null))[_0x59cb('0x3e')](handleError(_0x142b52,null));};exports[_0x59cb('0x47')]=function(_0x514f88,_0xa90dd6){return db['VtigerField'][_0x59cb('0x44')]({'where':{'id':_0x514f88[_0x59cb('0x40')]['id']}})[_0x59cb('0x24')](handleEntityNotFound(_0xa90dd6,null))[_0x59cb('0x24')](removeEntity(_0xa90dd6,null))[_0x59cb('0x3e')](handleError(_0xa90dd6,null));}; \ No newline at end of file +var _0xc7e8=['limit','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','VtigerField','includeAll','findAll','rows','show','keys','filters','include','find','create','body','catch','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x50fe9e,_0x196514){var _0x2d5230=function(_0x2ecbcb){while(--_0x2ecbcb){_0x50fe9e['push'](_0x50fe9e['shift']());}};_0x2d5230(++_0x196514);}(_0xc7e8,0x1a3));var _0x8c7e=function(_0x5e8d3e,_0x18ed2e){_0x5e8d3e=_0x5e8d3e-0x0;var _0x1348c0=_0xc7e8[_0x5e8d3e];return _0x1348c0;};'use strict';var pdf=require(_0x8c7e('0x0'));var emlformat=require(_0x8c7e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8c7e('0x2'));var jsonpatch=require(_0x8c7e('0x3'));var rp=require(_0x8c7e('0x4'));var moment=require(_0x8c7e('0x5'));var BPromise=require(_0x8c7e('0x6'));var Mustache=require(_0x8c7e('0x7'));var util=require(_0x8c7e('0x8'));var path=require('path');var sox=require(_0x8c7e('0x9'));var csv=require(_0x8c7e('0xa'));var ejs=require(_0x8c7e('0xb'));var fs=require('fs');var _=require(_0x8c7e('0xc'));var squel=require(_0x8c7e('0xd'));var crypto=require(_0x8c7e('0xe'));var jsforce=require(_0x8c7e('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8c7e('0x10'));var Redis=require(_0x8c7e('0x11'));var authService=require(_0x8c7e('0x12'));var qs=require(_0x8c7e('0x13'));var as=require(_0x8c7e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c7e('0x15'))(_0x8c7e('0x16'));var utils=require('../../config/utils');var config=require(_0x8c7e('0x17'));var db=require(_0x8c7e('0x18'))['db'];function respondWithStatusCode(_0x207082,_0x1a16f1){_0x1a16f1=_0x1a16f1||0xcc;return function(_0xdf2833){if(_0xdf2833){return _0x207082[_0x8c7e('0x19')](_0x1a16f1);}return _0x207082[_0x8c7e('0x1a')](_0x1a16f1)[_0x8c7e('0x1b')]();};}function respondWithResult(_0x37862f,_0x513a8e){_0x513a8e=_0x513a8e||0xc8;return function(_0xdd4755){if(_0xdd4755){return _0x37862f[_0x8c7e('0x1a')](_0x513a8e)[_0x8c7e('0x1c')](_0xdd4755);}};}function respondWithFilteredResult(_0x4598ac,_0x1cce1a){return function(_0x349acf){if(_0x349acf){var _0x1c8c4f=_0x349acf[_0x8c7e('0x1d')],_0x50f118=_0x1cce1a[_0x8c7e('0x1e')],_0x1d9ff8=_0x1cce1a[_0x8c7e('0x1e')]+_0x1cce1a[_0x8c7e('0x1f')],_0x514da7;if(_0x1d9ff8>=_0x1c8c4f){_0x1d9ff8=_0x1c8c4f;_0x514da7=0xc8;}else{_0x514da7=0xce;}_0x4598ac['status'](_0x514da7);return _0x4598ac['set'](_0x8c7e('0x20'),_0x50f118+'-'+_0x1d9ff8+'/'+_0x1c8c4f)[_0x8c7e('0x1c')](_0x349acf);}return null;};}function patchUpdates(_0x42ad18){return function(_0x46f3bd){try{jsonpatch[_0x8c7e('0x21')](_0x46f3bd,_0x42ad18,!![]);}catch(_0x4cbf6a){return BPromise['reject'](_0x4cbf6a);}return _0x46f3bd[_0x8c7e('0x22')]();};}function saveUpdates(_0x450cfc,_0x4b056b){return function(_0x43cb7b){if(_0x43cb7b){return _0x43cb7b[_0x8c7e('0x23')](_0x450cfc)[_0x8c7e('0x24')](function(_0x425408){return _0x425408;});}return null;};}function removeEntity(_0x1b1231,_0x2cdae7){return function(_0x4cd28f){if(_0x4cd28f){return _0x4cd28f[_0x8c7e('0x25')]()['then'](function(){_0x1b1231[_0x8c7e('0x1a')](0xcc)[_0x8c7e('0x1b')]();});}};}function handleEntityNotFound(_0x140962,_0x2d70e8){return function(_0x3fc521){if(!_0x3fc521){_0x140962['sendStatus'](0x194);}return _0x3fc521;};}function handleError(_0x272ffb,_0x45b95a){_0x45b95a=_0x45b95a||0x1f4;return function(_0xb147cd){logger[_0x8c7e('0x26')](_0xb147cd[_0x8c7e('0x27')]);if(_0xb147cd['name']){delete _0xb147cd[_0x8c7e('0x28')];}_0x272ffb[_0x8c7e('0x1a')](_0x45b95a)[_0x8c7e('0x29')](_0xb147cd);};}exports[_0x8c7e('0x2a')]=function(_0x2b6bd4,_0x4cd177){var _0xda3ccc={},_0x25314d={},_0x39612f={'count':0x0,'rows':[]};var _0x422db6=_[_0x8c7e('0x2b')](db['VtigerField'][_0x8c7e('0x2c')],function(_0x3a01b8){return{'name':_0x3a01b8['fieldName'],'type':_0x3a01b8[_0x8c7e('0x2d')][_0x8c7e('0x2e')]};});_0x25314d[_0x8c7e('0x2f')]=_[_0x8c7e('0x2b')](_0x422db6,'name');_0x25314d[_0x8c7e('0x30')]=_['keys'](_0x2b6bd4[_0x8c7e('0x30')]);_0x25314d['filters']=_[_0x8c7e('0x31')](_0x25314d[_0x8c7e('0x2f')],_0x25314d[_0x8c7e('0x30')]);_0xda3ccc[_0x8c7e('0x32')]=_['intersection'](_0x25314d[_0x8c7e('0x2f')],qs[_0x8c7e('0x33')](_0x2b6bd4['query']['fields']));_0xda3ccc['attributes']=_0xda3ccc[_0x8c7e('0x32')][_0x8c7e('0x34')]?_0xda3ccc['attributes']:_0x25314d['model'];if(!_0x2b6bd4['query'][_0x8c7e('0x35')](_0x8c7e('0x36'))){_0xda3ccc['limit']=qs[_0x8c7e('0x1f')](_0x2b6bd4[_0x8c7e('0x30')][_0x8c7e('0x1f')]);_0xda3ccc['offset']=qs[_0x8c7e('0x1e')](_0x2b6bd4[_0x8c7e('0x30')]['offset']);}_0xda3ccc['order']=qs[_0x8c7e('0x37')](_0x2b6bd4[_0x8c7e('0x30')]['sort']);_0xda3ccc['where']=qs['filters'](_[_0x8c7e('0x38')](_0x2b6bd4[_0x8c7e('0x30')],_0x25314d['filters']));if(_0x2b6bd4['query'][_0x8c7e('0x39')]){_0xda3ccc['where']=_[_0x8c7e('0x3a')](_0xda3ccc[_0x8c7e('0x3b')],{'$or':_[_0x8c7e('0x2b')](_0x422db6,function(_0x4e1d1a){if(_0x4e1d1a[_0x8c7e('0x2d')]!==_0x8c7e('0x3c')){var _0x5ce2af={};_0x5ce2af[_0x4e1d1a[_0x8c7e('0x28')]]={'$like':'%'+_0x2b6bd4[_0x8c7e('0x30')][_0x8c7e('0x39')]+'%'};return _0x5ce2af;}})});}_0xda3ccc=_[_0x8c7e('0x3a')]({},_0xda3ccc,_0x2b6bd4[_0x8c7e('0x3d')]);var _0x277185={'where':_0xda3ccc['where']};return db[_0x8c7e('0x3e')]['count'](_0x277185)[_0x8c7e('0x24')](function(_0x1b694a){_0x39612f[_0x8c7e('0x1d')]=_0x1b694a;if(_0x2b6bd4['query'][_0x8c7e('0x3f')]){_0xda3ccc['include']=[{'all':!![]}];}return db['VtigerField'][_0x8c7e('0x40')](_0xda3ccc);})[_0x8c7e('0x24')](function(_0x4e96ac){_0x39612f[_0x8c7e('0x41')]=_0x4e96ac;return _0x39612f;})[_0x8c7e('0x24')](respondWithFilteredResult(_0x4cd177,_0xda3ccc))['catch'](handleError(_0x4cd177,null));};exports[_0x8c7e('0x42')]=function(_0x442703,_0x185f47){var _0x87a9e9={'raw':!![],'where':{'id':_0x442703['params']['id']}},_0x5dacf7={};_0x5dacf7['model']=_[_0x8c7e('0x43')](db[_0x8c7e('0x3e')][_0x8c7e('0x2c')]);_0x5dacf7['query']=_['keys'](_0x442703['query']);_0x5dacf7[_0x8c7e('0x44')]=_[_0x8c7e('0x31')](_0x5dacf7[_0x8c7e('0x2f')],_0x5dacf7[_0x8c7e('0x30')]);_0x87a9e9['attributes']=_[_0x8c7e('0x31')](_0x5dacf7['model'],qs[_0x8c7e('0x33')](_0x442703[_0x8c7e('0x30')][_0x8c7e('0x33')]));_0x87a9e9[_0x8c7e('0x32')]=_0x87a9e9[_0x8c7e('0x32')][_0x8c7e('0x34')]?_0x87a9e9[_0x8c7e('0x32')]:_0x5dacf7['model'];if(_0x442703[_0x8c7e('0x30')][_0x8c7e('0x3f')]){_0x87a9e9[_0x8c7e('0x45')]=[{'all':!![]}];}_0x87a9e9=_[_0x8c7e('0x3a')]({},_0x87a9e9,_0x442703[_0x8c7e('0x3d')]);return db[_0x8c7e('0x3e')][_0x8c7e('0x46')](_0x87a9e9)[_0x8c7e('0x24')](handleEntityNotFound(_0x185f47,null))[_0x8c7e('0x24')](respondWithResult(_0x185f47,null))['catch'](handleError(_0x185f47,null));};exports[_0x8c7e('0x47')]=function(_0x1b478e,_0x977c3){return db[_0x8c7e('0x3e')][_0x8c7e('0x47')](_0x1b478e[_0x8c7e('0x48')],{})['then'](respondWithResult(_0x977c3,0xc9))[_0x8c7e('0x49')](handleError(_0x977c3,null));};exports[_0x8c7e('0x23')]=function(_0x4966ac,_0x250bec){if(_0x4966ac[_0x8c7e('0x48')]['id']){delete _0x4966ac[_0x8c7e('0x48')]['id'];}return db[_0x8c7e('0x3e')][_0x8c7e('0x46')]({'where':{'id':_0x4966ac[_0x8c7e('0x4a')]['id']}})[_0x8c7e('0x24')](handleEntityNotFound(_0x250bec,null))[_0x8c7e('0x24')](saveUpdates(_0x4966ac[_0x8c7e('0x48')],null))[_0x8c7e('0x24')](respondWithResult(_0x250bec,null))[_0x8c7e('0x49')](handleError(_0x250bec,null));};exports[_0x8c7e('0x25')]=function(_0x1bd890,_0x558fd){return db['VtigerField'][_0x8c7e('0x46')]({'where':{'id':_0x1bd890[_0x8c7e('0x4a')]['id']}})[_0x8c7e('0x24')](handleEntityNotFound(_0x558fd,null))[_0x8c7e('0x24')](removeEntity(_0x558fd,null))[_0x8c7e('0x49')](handleError(_0x558fd,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index e6ad0f9..2435af0 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(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 596898d..c8a06d8 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 _0xd5fc=['info','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','VtigerField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x5a2f70,_0x3825d9){var _0x4c932b=function(_0x317608){while(--_0x317608){_0x5a2f70['push'](_0x5a2f70['shift']());}};_0x4c932b(++_0x3825d9);}(_0xd5fc,0xae));var _0xcd5f=function(_0xd37e66,_0x54f7c7){_0xd37e66=_0xd37e66-0x0;var _0x471520=_0xd5fc[_0xd37e66];return _0x471520;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd5f('0x1'));var fs=require('fs');var Redis=require(_0xcd5f('0x2'));var db=require(_0xcd5f('0x3'))['db'];var utils=require(_0xcd5f('0x4'));var logger=require(_0xcd5f('0x5'))(_0xcd5f('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd5f('0x7'));var client=jayson['client'][_0xcd5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x159b3f,_0x5af696,_0x58d65d){return new BPromise(function(_0x4e668e,_0x102ce9){return client['request'](_0x159b3f,_0x58d65d)[_0xcd5f('0x9')](function(_0x3e63d4){logger['info'](_0xcd5f('0xa'),_0x5af696,'request\x20sent');logger[_0xcd5f('0xb')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x5af696,_0xcd5f('0xc'),JSON[_0xcd5f('0xd')](_0x3e63d4));if(_0x3e63d4[_0xcd5f('0xe')]){if(_0x3e63d4[_0xcd5f('0xe')]['code']===0x1f4){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x102ce9(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x4e668e(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}else{logger[_0xcd5f('0x10')](_0xcd5f('0xa'),_0x5af696,_0xcd5f('0xc'));_0x4e668e(_0x3e63d4[_0xcd5f('0x11')]['message']);}})[_0xcd5f('0x12')](function(_0x33ab1a){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x33ab1a);_0x102ce9(_0x33ab1a);});});} \ No newline at end of file +var _0xab23=['stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xab23,0x1bc));var _0x3ab2=function(_0x556087,_0x2ee99c){_0x556087=_0x556087-0x0;var _0x304c2a=_0xab23[_0x556087];return _0x304c2a;};'use strict';var _=require(_0x3ab2('0x0'));var util=require(_0x3ab2('0x1'));var moment=require(_0x3ab2('0x2'));var BPromise=require(_0x3ab2('0x3'));var rs=require(_0x3ab2('0x4'));var fs=require('fs');var Redis=require(_0x3ab2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ab2('0x6'));var logger=require(_0x3ab2('0x7'))(_0x3ab2('0x8'));var config=require(_0x3ab2('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3ab2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e8d92,_0x5c861e,_0x36eee5){return new BPromise(function(_0x46d253,_0x20cfe1){return client[_0x3ab2('0xb')](_0x4e8d92,_0x36eee5)[_0x3ab2('0xc')](function(_0x120021){logger[_0x3ab2('0xd')](_0x3ab2('0xe'),_0x5c861e,_0x3ab2('0xf'));logger[_0x3ab2('0x10')](_0x3ab2('0x11'),_0x5c861e,'request\x20sent',JSON[_0x3ab2('0x12')](_0x120021));if(_0x120021[_0x3ab2('0x13')]){if(_0x120021[_0x3ab2('0x13')]['code']===0x1f4){logger['error'](_0x3ab2('0xe'),_0x5c861e,_0x120021[_0x3ab2('0x13')][_0x3ab2('0x14')]);return _0x20cfe1(_0x120021[_0x3ab2('0x13')][_0x3ab2('0x14')]);}logger[_0x3ab2('0x13')](_0x3ab2('0xe'),_0x5c861e,_0x120021[_0x3ab2('0x13')][_0x3ab2('0x14')]);return _0x46d253(_0x120021['error'][_0x3ab2('0x14')]);}else{logger['info'](_0x3ab2('0xe'),_0x5c861e,_0x3ab2('0xf'));_0x46d253(_0x120021['result']['message']);}})[_0x3ab2('0x15')](function(_0x43336e){logger[_0x3ab2('0x13')](_0x3ab2('0xe'),_0x5c861e,_0x43336e);_0x20cfe1(_0x43336e);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index f3d25f0..df15a9c 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 _0xe48a=['../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x19d707,_0x17ca70){var _0x4475b1=function(_0x4b0964){while(--_0x4b0964){_0x19d707['push'](_0x19d707['shift']());}};_0x4475b1(++_0x17ca70);}(_0xe48a,0xc1));var _0xae48=function(_0x3d1244,_0x156028){_0x3d1244=_0x3d1244-0x0;var _0x5d6372=_0xe48a[_0x3d1244];return _0x5d6372;};'use strict';var multer=require(_0xae48('0x0'));var util=require(_0xae48('0x1'));var path=require(_0xae48('0x2'));var timeout=require(_0xae48('0x3'));var express=require(_0xae48('0x4'));var router=express[_0xae48('0x5')]();var auth=require(_0xae48('0x6'));var interaction=require(_0xae48('0x7'));var config=require(_0xae48('0x8'));var controller=require(_0xae48('0x9'));router[_0xae48('0xa')]('/',auth['isAuthenticated'](),controller[_0xae48('0xb')]);router[_0xae48('0xa')](_0xae48('0xc'),auth[_0xae48('0xd')](),controller[_0xae48('0xe')]);router[_0xae48('0xa')](_0xae48('0xf'),auth[_0xae48('0xd')](),controller[_0xae48('0x10')]);router[_0xae48('0xa')](_0xae48('0x11'),auth['isAuthenticated'](),controller[_0xae48('0x12')]);router[_0xae48('0x13')]('/',auth[_0xae48('0xd')](),controller[_0xae48('0x14')]);router['post'](_0xae48('0xf'),auth['isAuthenticated'](),controller[_0xae48('0x15')]);router['put'](_0xae48('0xc'),auth['isAuthenticated'](),controller[_0xae48('0x16')]);router['delete']('/:id',auth[_0xae48('0xd')](),controller[_0xae48('0x17')]);module[_0xae48('0x18')]=router; \ No newline at end of file +var _0xf3ab=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','index','get','/:id','isAuthenticated','getConfigurations','create','/:id/configurations','addConfiguration','update','delete'];(function(_0x141cbd,_0xfca227){var _0x6e2418=function(_0x3b667d){while(--_0x3b667d){_0x141cbd['push'](_0x141cbd['shift']());}};_0x6e2418(++_0xfca227);}(_0xf3ab,0x18f));var _0xbf3a=function(_0x4c2f30,_0xa91340){_0x4c2f30=_0x4c2f30-0x0;var _0xb8854d=_0xf3ab[_0x4c2f30];return _0xb8854d;};'use strict';var multer=require('multer');var util=require(_0xbf3a('0x0'));var path=require(_0xbf3a('0x1'));var timeout=require(_0xbf3a('0x2'));var express=require(_0xbf3a('0x3'));var router=express[_0xbf3a('0x4')]();var auth=require(_0xbf3a('0x5'));var interaction=require(_0xbf3a('0x6'));var config=require(_0xbf3a('0x7'));var controller=require(_0xbf3a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbf3a('0x9')]);router[_0xbf3a('0xa')](_0xbf3a('0xb'),auth[_0xbf3a('0xc')](),controller['show']);router[_0xbf3a('0xa')]('/:id/configurations',auth[_0xbf3a('0xc')](),controller[_0xbf3a('0xd')]);router['get']('/:id/fields',auth[_0xbf3a('0xc')](),controller['getFields']);router['post']('/',auth[_0xbf3a('0xc')](),controller[_0xbf3a('0xe')]);router['post'](_0xbf3a('0xf'),auth[_0xbf3a('0xc')](),controller[_0xbf3a('0x10')]);router['put']('/:id',auth[_0xbf3a('0xc')](),controller[_0xbf3a('0x11')]);router[_0xbf3a('0x12')]('/:id',auth[_0xbf3a('0xc')](),controller['destroy']);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 8d8dc88..f1a7d60 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 _0xd74a=['STRING','username','remoteUri','password','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x3061fd,_0x12ce39){var _0x44892b=function(_0x4c95f9){while(--_0x4c95f9){_0x3061fd['push'](_0x3061fd['shift']());}};_0x44892b(++_0x12ce39);}(_0xd74a,0x139));var _0xad74=function(_0x4d3b0d,_0x2aca7d){_0x4d3b0d=_0x4d3b0d-0x0;var _0x1d6b00=_0xd74a[_0x4d3b0d];return _0x1d6b00;};'use strict';var Sequelize=require(_0xad74('0x0'));module[_0xad74('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xad74('0x2')]},'username':{'type':Sequelize[_0xad74('0x2')],'unique':_0xad74('0x3')},'password':{'type':Sequelize[_0xad74('0x2')]},'token':{'type':Sequelize[_0xad74('0x2')]},'remoteUri':{'type':Sequelize[_0xad74('0x2')],'unique':_0xad74('0x4')},'authType':{'type':Sequelize['ENUM'](_0xad74('0x5'),'token'),'defaultValue':_0xad74('0x5')},'serverUrl':{'type':Sequelize[_0xad74('0x2')]},'type':{'type':Sequelize[_0xad74('0x6')](_0xad74('0x7'),_0xad74('0x8')),'defaultValue':_0xad74('0x7')}}; \ No newline at end of file +var _0xe423=['sequelize','exports','STRING','username','remoteUri','ENUM','password','token','integrationTab','newTab'];(function(_0x4dbeaa,_0x3fb85d){var _0x889e79=function(_0x737998){while(--_0x737998){_0x4dbeaa['push'](_0x4dbeaa['shift']());}};_0x889e79(++_0x3fb85d);}(_0xe423,0x140));var _0x3e42=function(_0x597d36,_0x331c44){_0x597d36=_0x597d36-0x0;var _0x2cb902=_0xe423[_0x597d36];return _0x2cb902;};'use strict';var Sequelize=require(_0x3e42('0x0'));module[_0x3e42('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3e42('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x3e42('0x3')},'password':{'type':Sequelize[_0x3e42('0x2')]},'token':{'type':Sequelize[_0x3e42('0x2')]},'remoteUri':{'type':Sequelize[_0x3e42('0x2')],'unique':_0x3e42('0x4')},'authType':{'type':Sequelize[_0x3e42('0x5')](_0x3e42('0x6'),_0x3e42('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x3e42('0x2')]},'type':{'type':Sequelize[_0x3e42('0x5')](_0x3e42('0x8'),_0x3e42('0x9')),'defaultValue':_0x3e42('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 9592d9e..ba13e67 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 _0xcc39=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','then','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','ZendeskAccount,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','ZendeskAccount','includeAll','include','findAll','params','keys','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','username','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','statusCode','stringify','send','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x3df31d,_0x5081ff){var _0x352dbc=function(_0x2ede7c){while(--_0x2ede7c){_0x3df31d['push'](_0x3df31d['shift']());}};_0x352dbc(++_0x5081ff);}(_0xcc39,0x1ea));var _0x9cc3=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0xcc39[_0x9b2bb0];return _0x2cdb3b;};'use strict';var pdf=require(_0x9cc3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9cc3('0x1'));var zipdir=require(_0x9cc3('0x2'));var jsonpatch=require(_0x9cc3('0x3'));var rp=require(_0x9cc3('0x4'));var moment=require(_0x9cc3('0x5'));var BPromise=require(_0x9cc3('0x6'));var Mustache=require(_0x9cc3('0x7'));var util=require(_0x9cc3('0x8'));var path=require(_0x9cc3('0x9'));var sox=require('sox');var csv=require(_0x9cc3('0xa'));var ejs=require(_0x9cc3('0xb'));var fs=require('fs');var _=require(_0x9cc3('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9cc3('0xd'));var deskjs=require(_0x9cc3('0xe'));var toCsv=require(_0x9cc3('0xa'));var querystring=require('querystring');var Papa=require(_0x9cc3('0xf'));var Redis=require(_0x9cc3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9cc3('0x11'));var as=require(_0x9cc3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cc3('0x13'))(_0x9cc3('0x14'));var utils=require(_0x9cc3('0x15'));var config=require(_0x9cc3('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9cc3('0x17'));var jayson=require(_0x9cc3('0x18'));var client=jayson[_0x9cc3('0x19')][_0x9cc3('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3c2839,_0x3e23b5,_0xb6b904){if(_0xb6b904){var _0xb8d58=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xb8d58[_0x9cc3('0x1b')](_0x3e23b5)){return _0x3c2839;}else{throw new db[(_0x9cc3('0x1c'))][(_0x9cc3('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3c2839;}}function respondWithRpcPromise(_0x348f44,_0x2a9d1d,_0x1e1328,_0x1ebb08){return new BPromise(function(_0x21bc5f,_0x454d96){var _0x143c5f=_0x1ebb08||client;return _0x143c5f['request'](_0x348f44,_0x1e1328)[_0x9cc3('0x1e')](function(_0x3389f7){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x2a9d1d,_0x9cc3('0x1f'));logger[_0x9cc3('0x20')](_0x9cc3('0x21'),_0x2a9d1d,_0x9cc3('0x1f'),JSON['stringify'](_0x3389f7));if(_0x3389f7[_0x9cc3('0x22')]){if(_0x3389f7['error'][_0x9cc3('0x23')]===0x1f4){logger[_0x9cc3('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x2a9d1d,_0x3389f7[_0x9cc3('0x22')][_0x9cc3('0x24')]);return _0x454d96(_0x3389f7[_0x9cc3('0x22')][_0x9cc3('0x24')]);}logger[_0x9cc3('0x22')](_0x9cc3('0x25'),_0x2a9d1d,_0x3389f7[_0x9cc3('0x22')][_0x9cc3('0x24')]);return _0x21bc5f(_0x3389f7[_0x9cc3('0x22')]['message']);}else{logger[_0x9cc3('0x26')](_0x9cc3('0x25'),_0x2a9d1d,'request\x20sent');_0x21bc5f(_0x3389f7[_0x9cc3('0x27')][_0x9cc3('0x24')]);}})[_0x9cc3('0x28')](function(_0x24fae0){logger[_0x9cc3('0x22')](_0x9cc3('0x25'),_0x2a9d1d,_0x24fae0);_0x454d96(_0x24fae0);});});}function respondWithStatusCode(_0x11f0d1,_0x1ab1de){_0x1ab1de=_0x1ab1de||0xcc;return function(_0x24c377){if(_0x24c377){return _0x11f0d1[_0x9cc3('0x29')](_0x1ab1de);}return _0x11f0d1[_0x9cc3('0x2a')](_0x1ab1de)[_0x9cc3('0x2b')]();};}function respondWithResult(_0x1b7954,_0x1e9d31){_0x1e9d31=_0x1e9d31||0xc8;return function(_0x3032fe){if(_0x3032fe){return _0x1b7954[_0x9cc3('0x2a')](_0x1e9d31)[_0x9cc3('0x2c')](_0x3032fe);}};}function respondWithFilteredResult(_0xbd4d99,_0x33899a){return function(_0x3f59e7){if(_0x3f59e7){var _0x1af5aa=_0x3f59e7[_0x9cc3('0x2d')],_0x33f4ae=_0x33899a['offset'],_0x464eaa=_0x33899a[_0x9cc3('0x2e')]+_0x33899a[_0x9cc3('0x2f')],_0x3d7a72;if(_0x464eaa>=_0x1af5aa){_0x464eaa=_0x1af5aa;_0x3d7a72=0xc8;}else{_0x3d7a72=0xce;}_0xbd4d99[_0x9cc3('0x2a')](_0x3d7a72);return _0xbd4d99[_0x9cc3('0x30')](_0x9cc3('0x31'),_0x33f4ae+'-'+_0x464eaa+'/'+_0x1af5aa)[_0x9cc3('0x2c')](_0x3f59e7);}return null;};}function patchUpdates(_0x5568bc){return function(_0x28ab6d){try{jsonpatch[_0x9cc3('0x32')](_0x28ab6d,_0x5568bc,!![]);}catch(_0x11d003){return BPromise[_0x9cc3('0x33')](_0x11d003);}return _0x28ab6d[_0x9cc3('0x34')]();};}function saveUpdates(_0x38465f,_0x11b9a0){return function(_0x12217d){if(_0x12217d){return _0x12217d[_0x9cc3('0x35')](_0x38465f)['then'](function(_0x2b8c83){return _0x2b8c83;});}return null;};}function removeEntity(_0x1baa41,_0x45f12a){return function(_0x59cfea){if(_0x59cfea){return _0x59cfea[_0x9cc3('0x36')]()[_0x9cc3('0x1e')](function(){_0x1baa41[_0x9cc3('0x2a')](0xcc)[_0x9cc3('0x2b')]();});}};}function handleEntityNotFound(_0x22e7d0,_0x1f5ec3){return function(_0x4da845){if(!_0x4da845){_0x22e7d0[_0x9cc3('0x29')](0x194);}return _0x4da845;};}function handleError(_0x37ee5d,_0x1ca732){_0x1ca732=_0x1ca732||0x1f4;return function(_0x5a3487){logger[_0x9cc3('0x22')](_0x5a3487[_0x9cc3('0x37')]);if(_0x5a3487[_0x9cc3('0x38')]){delete _0x5a3487[_0x9cc3('0x38')];}_0x37ee5d[_0x9cc3('0x2a')](_0x1ca732)['send'](_0x5a3487);};}exports[_0x9cc3('0x39')]=function(_0x42a647,_0x5059cc){var _0x2ac559={},_0xb0f42b={},_0x100863={'count':0x0,'rows':[]};var _0xfb7ada=_['map'](db['ZendeskAccount'][_0x9cc3('0x3a')],function(_0x587536){return{'name':_0x587536['fieldName'],'type':_0x587536[_0x9cc3('0x3b')][_0x9cc3('0x3c')]};});_0xb0f42b[_0x9cc3('0x3d')]=_[_0x9cc3('0x3e')](_0xfb7ada,_0x9cc3('0x38'));_0xb0f42b[_0x9cc3('0x3f')]=_['keys'](_0x42a647[_0x9cc3('0x3f')]);_0xb0f42b[_0x9cc3('0x40')]=_[_0x9cc3('0x41')](_0xb0f42b[_0x9cc3('0x3d')],_0xb0f42b[_0x9cc3('0x3f')]);_0x2ac559['attributes']=_[_0x9cc3('0x41')](_0xb0f42b['model'],qs[_0x9cc3('0x42')](_0x42a647['query'][_0x9cc3('0x42')]));_0x2ac559[_0x9cc3('0x43')]=_0x2ac559[_0x9cc3('0x43')][_0x9cc3('0x44')]?_0x2ac559['attributes']:_0xb0f42b[_0x9cc3('0x3d')];if(!_0x42a647[_0x9cc3('0x3f')][_0x9cc3('0x45')]('nolimit')){_0x2ac559['limit']=qs[_0x9cc3('0x2f')](_0x42a647[_0x9cc3('0x3f')][_0x9cc3('0x2f')]);_0x2ac559[_0x9cc3('0x2e')]=qs[_0x9cc3('0x2e')](_0x42a647[_0x9cc3('0x3f')][_0x9cc3('0x2e')]);}_0x2ac559['order']=qs[_0x9cc3('0x46')](_0x42a647[_0x9cc3('0x3f')]['sort']);_0x2ac559['where']=qs[_0x9cc3('0x40')](_[_0x9cc3('0x47')](_0x42a647[_0x9cc3('0x3f')],_0xb0f42b[_0x9cc3('0x40')]));if(_0x42a647[_0x9cc3('0x3f')][_0x9cc3('0x48')]){_0x2ac559[_0x9cc3('0x49')]=_[_0x9cc3('0x4a')](_0x2ac559[_0x9cc3('0x49')],{'$or':_[_0x9cc3('0x3e')](_0xfb7ada,function(_0x1f550c){if(_0x1f550c['type']!==_0x9cc3('0x4b')){var _0x5435b8={};_0x5435b8[_0x1f550c[_0x9cc3('0x38')]]={'$like':'%'+_0x42a647[_0x9cc3('0x3f')]['filter']+'%'};return _0x5435b8;}})});}_0x2ac559=_[_0x9cc3('0x4a')]({},_0x2ac559,_0x42a647['options']);var _0x32eabd={'where':_0x2ac559[_0x9cc3('0x49')]};return db[_0x9cc3('0x4c')][_0x9cc3('0x2d')](_0x32eabd)['then'](function(_0x1edbc6){_0x100863[_0x9cc3('0x2d')]=_0x1edbc6;if(_0x42a647[_0x9cc3('0x3f')][_0x9cc3('0x4d')]){_0x2ac559[_0x9cc3('0x4e')]=[{'all':!![]}];}return db[_0x9cc3('0x4c')][_0x9cc3('0x4f')](_0x2ac559);})[_0x9cc3('0x1e')](function(_0x409c25){_0x100863['rows']=_0x409c25;return _0x100863;})[_0x9cc3('0x1e')](respondWithFilteredResult(_0x5059cc,_0x2ac559))[_0x9cc3('0x28')](handleError(_0x5059cc,null));};exports['show']=function(_0x2275b0,_0x4b60a3){var _0xdc0a28={'raw':![],'where':{'id':_0x2275b0[_0x9cc3('0x50')]['id']}},_0x48ea77={};_0x48ea77['model']=_['keys'](db[_0x9cc3('0x4c')][_0x9cc3('0x3a')]);_0x48ea77[_0x9cc3('0x3f')]=_[_0x9cc3('0x51')](_0x2275b0[_0x9cc3('0x3f')]);_0x48ea77[_0x9cc3('0x40')]=_['intersection'](_0x48ea77['model'],_0x48ea77[_0x9cc3('0x3f')]);_0xdc0a28[_0x9cc3('0x43')]=_['intersection'](_0x48ea77[_0x9cc3('0x3d')],qs[_0x9cc3('0x42')](_0x2275b0[_0x9cc3('0x3f')]['fields']));_0xdc0a28['attributes']=_0xdc0a28[_0x9cc3('0x43')][_0x9cc3('0x44')]?_0xdc0a28[_0x9cc3('0x43')]:_0x48ea77['model'];if(_0x2275b0[_0x9cc3('0x3f')]['includeAll']){_0xdc0a28['include']=[{'all':!![]}];}_0xdc0a28=_[_0x9cc3('0x4a')]({},_0xdc0a28,_0x2275b0[_0x9cc3('0x52')]);return db[_0x9cc3('0x4c')][_0x9cc3('0x53')](_0xdc0a28)[_0x9cc3('0x1e')](handleEntityNotFound(_0x4b60a3,null))['then'](respondWithResult(_0x4b60a3,null))[_0x9cc3('0x28')](handleError(_0x4b60a3,null));};exports[_0x9cc3('0x54')]=function(_0x2b26f8,_0x3a2aa9){return db[_0x9cc3('0x4c')][_0x9cc3('0x54')](_0x2b26f8[_0x9cc3('0x55')],{})[_0x9cc3('0x1e')](respondWithResult(_0x3a2aa9,0xc9))[_0x9cc3('0x28')](handleError(_0x3a2aa9,null));};exports[_0x9cc3('0x35')]=function(_0x315fba,_0x2f021c){if(_0x315fba[_0x9cc3('0x55')]['id']){delete _0x315fba[_0x9cc3('0x55')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x315fba[_0x9cc3('0x50')]['id']}})[_0x9cc3('0x1e')](handleEntityNotFound(_0x2f021c,null))['then'](saveUpdates(_0x315fba['body'],null))[_0x9cc3('0x1e')](respondWithResult(_0x2f021c,null))[_0x9cc3('0x28')](handleError(_0x2f021c,null));};exports[_0x9cc3('0x36')]=function(_0x265337,_0x5700f2){return db[_0x9cc3('0x4c')][_0x9cc3('0x53')]({'where':{'id':_0x265337['params']['id']}})[_0x9cc3('0x1e')](handleEntityNotFound(_0x5700f2,null))[_0x9cc3('0x1e')](removeEntity(_0x5700f2,null))[_0x9cc3('0x28')](handleError(_0x5700f2,null));};exports[_0x9cc3('0x56')]=function(_0x1d0fcd,_0x10c1f5,_0xf634b3){var _0x492187={};var _0x35cde9={};var _0x5b2fcf;var _0xcec2a2;return db[_0x9cc3('0x4c')][_0x9cc3('0x57')]({'where':{'id':_0x1d0fcd[_0x9cc3('0x50')]['id']}})[_0x9cc3('0x1e')](handleEntityNotFound(_0x10c1f5,null))[_0x9cc3('0x1e')](function(_0x2312b4){if(_0x2312b4){_0x5b2fcf=_0x2312b4;_0x35cde9[_0x9cc3('0x3d')]=_[_0x9cc3('0x51')](db[_0x9cc3('0x58')]['rawAttributes']);_0x35cde9[_0x9cc3('0x3f')]=_[_0x9cc3('0x51')](_0x1d0fcd[_0x9cc3('0x3f')]);_0x35cde9['filters']=_['intersection'](_0x35cde9['model'],_0x35cde9[_0x9cc3('0x3f')]);_0x492187[_0x9cc3('0x43')]=_[_0x9cc3('0x41')](_0x35cde9[_0x9cc3('0x3d')],qs[_0x9cc3('0x42')](_0x1d0fcd[_0x9cc3('0x3f')]['fields']));_0x492187[_0x9cc3('0x43')]=_0x492187[_0x9cc3('0x43')]['length']?_0x492187['attributes']:_0x35cde9[_0x9cc3('0x3d')];_0x492187['order']=qs[_0x9cc3('0x46')](_0x1d0fcd[_0x9cc3('0x3f')][_0x9cc3('0x46')]);_0x492187[_0x9cc3('0x49')]=qs[_0x9cc3('0x40')](_[_0x9cc3('0x47')](_0x1d0fcd[_0x9cc3('0x3f')],_0x35cde9[_0x9cc3('0x40')]));if(_0x1d0fcd[_0x9cc3('0x3f')]['filter']){_0x492187['where']=_[_0x9cc3('0x4a')](_0x492187[_0x9cc3('0x49')],{'$or':_[_0x9cc3('0x3e')](_0x492187[_0x9cc3('0x43')],function(_0x5bcc62){var _0x406974={};_0x406974[_0x5bcc62]={'$like':'%'+_0x1d0fcd[_0x9cc3('0x3f')][_0x9cc3('0x48')]+'%'};return _0x406974;})});}_0x492187=_[_0x9cc3('0x4a')]({},_0x492187,_0x1d0fcd[_0x9cc3('0x52')]);return _0x5b2fcf[_0x9cc3('0x56')](_0x492187);}})[_0x9cc3('0x1e')](function(_0x591d53){if(_0x591d53){_0xcec2a2=_0x591d53[_0x9cc3('0x44')];if(!_0x1d0fcd[_0x9cc3('0x3f')][_0x9cc3('0x45')](_0x9cc3('0x59'))){_0x492187['limit']=qs[_0x9cc3('0x2f')](_0x1d0fcd['query']['limit']);_0x492187['offset']=qs[_0x9cc3('0x2e')](_0x1d0fcd[_0x9cc3('0x3f')]['offset']);}return _0x5b2fcf[_0x9cc3('0x56')](_0x492187);}})['then'](function(_0x17d953){if(_0x17d953){return _0x17d953?{'count':_0xcec2a2,'rows':_0x17d953}:null;}})[_0x9cc3('0x1e')](respondWithResult(_0x10c1f5,null))[_0x9cc3('0x28')](handleError(_0x10c1f5,null));};exports[_0x9cc3('0x5a')]=function(_0x4b173f,_0x8f27f7,_0x42dc0d){if(_0x4b173f[_0x9cc3('0x55')]['id']){delete _0x4b173f['body']['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x4b173f[_0x9cc3('0x50')]['id']}})['then'](handleEntityNotFound(_0x8f27f7,null))[_0x9cc3('0x1e')](function(_0x4c2aa3){if(_0x4c2aa3){_0x4b173f['body']['AccountId']=_0x4c2aa3['id'];_0x4b173f['body'][_0x9cc3('0x5b')]=integrations[_0x9cc3('0x5c')](_0x4b173f[_0x9cc3('0x55')][_0x9cc3('0x5d')],_0x4b173f[_0x9cc3('0x55')]['type']);_0x4b173f[_0x9cc3('0x55')]['Descriptions']=integrations[_0x9cc3('0x5e')](_0x4b173f['body'][_0x9cc3('0x5d')],_0x4b173f[_0x9cc3('0x55')][_0x9cc3('0x3b')]);return db[_0x9cc3('0x58')][_0x9cc3('0x54')](_0x4b173f['body'],{'include':[{'model':db[_0x9cc3('0x5f')],'as':'Subjects'},{'model':db[_0x9cc3('0x5f')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x8f27f7,null))['catch'](handleError(_0x8f27f7,null));};exports[_0x9cc3('0x60')]=function(_0x4277ee,_0x4b730e,_0x577653){var _0x438481='';return db[_0x9cc3('0x4c')][_0x9cc3('0x57')]({'where':{'id':_0x4277ee['params']['id']},'attributes':['id','username',_0x9cc3('0x61'),_0x9cc3('0x62'),_0x9cc3('0x63'),_0x9cc3('0x64')]})['then'](handleEntityNotFound(_0x4b730e,null))[_0x9cc3('0x1e')](function(_0x345a8d){if(_0x345a8d){_0x438481=_0x345a8d['remoteUri'];var _0x19cfde=_0x438481[_0x9cc3('0x65')](-0x1);if(_0x19cfde==='/'){_0x438481=_0x438481['substring'](0x0,_0x438481[_0x9cc3('0x66')](_0x19cfde));}var _0xbc9ca6={'method':_0x9cc3('0x67'),'uri':util[_0x9cc3('0x68')]('%s/%s',_0x438481,'ticket_fields'),'json':!![]};switch(_0x345a8d[_0x9cc3('0x63')]){case _0x9cc3('0x61'):_0xbc9ca6[_0x9cc3('0x69')]={'Authorization':util[_0x9cc3('0x68')](_0x9cc3('0x6a'),new Buffer(util[_0x9cc3('0x68')](_0x9cc3('0x6b'),_0x345a8d['username'],_0x345a8d[_0x9cc3('0x61')]))[_0x9cc3('0x6c')](_0x9cc3('0x6d')))};break;case'token':_0xbc9ca6[_0x9cc3('0x69')]={'Authorization':util[_0x9cc3('0x68')]('Basic\x20%s',new Buffer(util['format'](_0x9cc3('0x6e'),_0x345a8d[_0x9cc3('0x6f')],_0x345a8d[_0x9cc3('0x62')]))[_0x9cc3('0x6c')](_0x9cc3('0x6d')))};break;default:throw new db[(_0x9cc3('0x1c'))][(_0x9cc3('0x1d'))](_0x9cc3('0x70'));}return rp(_0xbc9ca6);}})['then'](function(_0x4783b3){if(_0x4783b3){var _0x204022=[_0x9cc3('0x71'),_0x9cc3('0x72'),_0x9cc3('0x73'),_0x9cc3('0x74')];_[_0x9cc3('0x75')](_0x4783b3[_0x9cc3('0x76')],function(_0x1ff298){return _0x204022[_0x9cc3('0x77')](_0x1ff298[_0x9cc3('0x3b')]);});return{'count':_0x4783b3[_0x9cc3('0x76')]['length'],'rows':_[_0x9cc3('0x3e')](_0x4783b3['ticket_fields'],function(_0x4efcb6){return{'id':_0x4efcb6['id'],'name':_0x4efcb6['position']>0x7?_0x4efcb6['title']:_0x4efcb6['type'],'custom':_0x4efcb6[_0x9cc3('0x78')]>0x7?!![]:![],'options':_0x4efcb6[_0x9cc3('0x79')]?_0x4efcb6[_0x9cc3('0x79')]:_0x4efcb6['custom_field_options']?_0x4efcb6[_0x9cc3('0x7a')]:[]};})};}})[_0x9cc3('0x1e')](respondWithResult(_0x4b730e,null))['catch'](function(_0x35319e){var _0x178d12=_0x4277ee[_0x9cc3('0x3f')][_0x9cc3('0x1b')]?0x1f4:_0x35319e[_0x9cc3('0x7b')]||0x1f4;logger[_0x9cc3('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x9cc3('0x60'),_0x178d12,JSON[_0x9cc3('0x7c')](_0x35319e));delete _0x35319e[_0x9cc3('0x38')];if(_0x178d12===0x191){_0x178d12=0x190;}_0x4b730e['status'](_0x178d12)[_0x9cc3('0x7d')](_0x4277ee[_0x9cc3('0x3f')][_0x9cc3('0x1b')]?{'message':_0x9cc3('0x7e'),'statusCode':_0x35319e[_0x9cc3('0x7b')]}:_0x35319e);});}; \ No newline at end of file +var _0xc50e=['info','result','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','index','map','ZendeskAccount','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','length','nolimit','sort','where','pick','type','VIRTUAL','filter','includeAll','include','findAll','catch','params','keys','fields','merge','options','find','create','body','destroy','getConfigurations','findOne','ZendeskConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','getFields','username','password','token','slice','lastIndexOf','format','%s/%s','ticket_fields','authType','Basic\x20%s','%s:%s','toString','base64','headers','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','request','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message'];(function(_0x50ebb6,_0x7ee0a5){var _0x3a0a3c=function(_0x7876c7){while(--_0x7876c7){_0x50ebb6['push'](_0x50ebb6['shift']());}};_0x3a0a3c(++_0x7ee0a5);}(_0xc50e,0xd9));var _0xec50=function(_0x48ce4d,_0x57d011){_0x48ce4d=_0x48ce4d-0x0;var _0xc93080=_0xc50e[_0x48ce4d];return _0xc93080;};'use strict';var pdf=require(_0xec50('0x0'));var emlformat=require(_0xec50('0x1'));var rimraf=require(_0xec50('0x2'));var zipdir=require(_0xec50('0x3'));var jsonpatch=require(_0xec50('0x4'));var rp=require(_0xec50('0x5'));var moment=require(_0xec50('0x6'));var BPromise=require(_0xec50('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xec50('0x8'));var sox=require(_0xec50('0x9'));var csv=require(_0xec50('0xa'));var ejs=require(_0xec50('0xb'));var fs=require('fs');var _=require(_0xec50('0xc'));var squel=require(_0xec50('0xd'));var crypto=require(_0xec50('0xe'));var jsforce=require(_0xec50('0xf'));var deskjs=require(_0xec50('0x10'));var toCsv=require(_0xec50('0xa'));var querystring=require('querystring');var Papa=require(_0xec50('0x11'));var Redis=require(_0xec50('0x12'));var authService=require(_0xec50('0x13'));var qs=require(_0xec50('0x14'));var as=require(_0xec50('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xec50('0x16'))(_0xec50('0x17'));var utils=require(_0xec50('0x18'));var config=require(_0xec50('0x19'));var db=require(_0xec50('0x1a'))['db'];var integrations=require(_0xec50('0x1b'));var jayson=require(_0xec50('0x1c'));var client=jayson[_0xec50('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x588b7f,_0x858374,_0x324884){if(_0x324884){var _0x4f011f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4f011f[_0xec50('0x1e')](_0x858374)){return _0x588b7f;}else{throw new db[(_0xec50('0x1f'))][(_0xec50('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x588b7f;}}function respondWithRpcPromise(_0x13766a,_0x2eb423,_0x21837c,_0x3a1a0a){return new BPromise(function(_0x1aeba6,_0x59936d){var _0x2c3b3c=_0x3a1a0a||client;return _0x2c3b3c[_0xec50('0x21')](_0x13766a,_0x21837c)['then'](function(_0x28df90){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x2eb423,_0xec50('0x22'));logger['debug'](_0xec50('0x23'),_0x2eb423,'request\x20sent',JSON[_0xec50('0x24')](_0x28df90));if(_0x28df90[_0xec50('0x25')]){if(_0x28df90[_0xec50('0x25')][_0xec50('0x26')]===0x1f4){logger[_0xec50('0x25')](_0xec50('0x27'),_0x2eb423,_0x28df90[_0xec50('0x25')]['message']);return _0x59936d(_0x28df90[_0xec50('0x25')][_0xec50('0x28')]);}logger[_0xec50('0x25')](_0xec50('0x27'),_0x2eb423,_0x28df90[_0xec50('0x25')]['message']);return _0x1aeba6(_0x28df90[_0xec50('0x25')][_0xec50('0x28')]);}else{logger[_0xec50('0x29')](_0xec50('0x27'),_0x2eb423,'request\x20sent');_0x1aeba6(_0x28df90[_0xec50('0x2a')][_0xec50('0x28')]);}})['catch'](function(_0x34ef54){logger[_0xec50('0x25')]('ZendeskAccount,\x20%s,\x20%s',_0x2eb423,_0x34ef54);_0x59936d(_0x34ef54);});});}function respondWithStatusCode(_0x4ddad7,_0x26722a){_0x26722a=_0x26722a||0xcc;return function(_0xe13b3f){if(_0xe13b3f){return _0x4ddad7['sendStatus'](_0x26722a);}return _0x4ddad7[_0xec50('0x2b')](_0x26722a)[_0xec50('0x2c')]();};}function respondWithResult(_0x214f6a,_0x245626){_0x245626=_0x245626||0xc8;return function(_0x31641d){if(_0x31641d){return _0x214f6a[_0xec50('0x2b')](_0x245626)['json'](_0x31641d);}};}function respondWithFilteredResult(_0x4ab028,_0x330d7c){return function(_0x8543a1){if(_0x8543a1){var _0x478556=_0x8543a1[_0xec50('0x2d')],_0xaaeff4=_0x330d7c[_0xec50('0x2e')],_0x4246fb=_0x330d7c[_0xec50('0x2e')]+_0x330d7c[_0xec50('0x2f')],_0x3992ab;if(_0x4246fb>=_0x478556){_0x4246fb=_0x478556;_0x3992ab=0xc8;}else{_0x3992ab=0xce;}_0x4ab028['status'](_0x3992ab);return _0x4ab028['set'](_0xec50('0x30'),_0xaaeff4+'-'+_0x4246fb+'/'+_0x478556)[_0xec50('0x31')](_0x8543a1);}return null;};}function patchUpdates(_0x1d1add){return function(_0x5c87d6){try{jsonpatch[_0xec50('0x32')](_0x5c87d6,_0x1d1add,!![]);}catch(_0x5f39cc){return BPromise[_0xec50('0x33')](_0x5f39cc);}return _0x5c87d6[_0xec50('0x34')]();};}function saveUpdates(_0x44aa7b,_0x1b1c93){return function(_0xf65882){if(_0xf65882){return _0xf65882[_0xec50('0x35')](_0x44aa7b)['then'](function(_0x597eca){return _0x597eca;});}return null;};}function removeEntity(_0x1b894e,_0xe662ee){return function(_0x438427){if(_0x438427){return _0x438427['destroy']()[_0xec50('0x36')](function(){_0x1b894e[_0xec50('0x2b')](0xcc)[_0xec50('0x2c')]();});}};}function handleEntityNotFound(_0x3899bc,_0x2c1442){return function(_0x8eadb3){if(!_0x8eadb3){_0x3899bc['sendStatus'](0x194);}return _0x8eadb3;};}function handleError(_0x2d726c,_0x80772c){_0x80772c=_0x80772c||0x1f4;return function(_0xa31664){logger[_0xec50('0x25')](_0xa31664['stack']);if(_0xa31664['name']){delete _0xa31664['name'];}_0x2d726c[_0xec50('0x2b')](_0x80772c)['send'](_0xa31664);};}exports[_0xec50('0x37')]=function(_0x5341e2,_0x1992ba){var _0x4b2e37={},_0x528082={},_0x17795f={'count':0x0,'rows':[]};var _0x7c0e0f=_[_0xec50('0x38')](db[_0xec50('0x39')][_0xec50('0x3a')],function(_0x43f3bf){return{'name':_0x43f3bf[_0xec50('0x3b')],'type':_0x43f3bf['type'][_0xec50('0x3c')]};});_0x528082[_0xec50('0x3d')]=_[_0xec50('0x38')](_0x7c0e0f,_0xec50('0x3e'));_0x528082[_0xec50('0x3f')]=_['keys'](_0x5341e2[_0xec50('0x3f')]);_0x528082[_0xec50('0x40')]=_[_0xec50('0x41')](_0x528082[_0xec50('0x3d')],_0x528082[_0xec50('0x3f')]);_0x4b2e37[_0xec50('0x42')]=_[_0xec50('0x41')](_0x528082[_0xec50('0x3d')],qs['fields'](_0x5341e2[_0xec50('0x3f')]['fields']));_0x4b2e37['attributes']=_0x4b2e37[_0xec50('0x42')][_0xec50('0x43')]?_0x4b2e37[_0xec50('0x42')]:_0x528082['model'];if(!_0x5341e2['query']['hasOwnProperty'](_0xec50('0x44'))){_0x4b2e37[_0xec50('0x2f')]=qs[_0xec50('0x2f')](_0x5341e2[_0xec50('0x3f')]['limit']);_0x4b2e37[_0xec50('0x2e')]=qs['offset'](_0x5341e2[_0xec50('0x3f')]['offset']);}_0x4b2e37['order']=qs[_0xec50('0x45')](_0x5341e2[_0xec50('0x3f')]['sort']);_0x4b2e37[_0xec50('0x46')]=qs['filters'](_[_0xec50('0x47')](_0x5341e2[_0xec50('0x3f')],_0x528082[_0xec50('0x40')]));if(_0x5341e2[_0xec50('0x3f')]['filter']){_0x4b2e37[_0xec50('0x46')]=_['merge'](_0x4b2e37[_0xec50('0x46')],{'$or':_[_0xec50('0x38')](_0x7c0e0f,function(_0x14fd27){if(_0x14fd27[_0xec50('0x48')]!==_0xec50('0x49')){var _0x4b7942={};_0x4b7942[_0x14fd27['name']]={'$like':'%'+_0x5341e2[_0xec50('0x3f')][_0xec50('0x4a')]+'%'};return _0x4b7942;}})});}_0x4b2e37=_['merge']({},_0x4b2e37,_0x5341e2['options']);var _0x4a3784={'where':_0x4b2e37[_0xec50('0x46')]};return db['ZendeskAccount'][_0xec50('0x2d')](_0x4a3784)[_0xec50('0x36')](function(_0x30a3e5){_0x17795f['count']=_0x30a3e5;if(_0x5341e2[_0xec50('0x3f')][_0xec50('0x4b')]){_0x4b2e37[_0xec50('0x4c')]=[{'all':!![]}];}return db[_0xec50('0x39')][_0xec50('0x4d')](_0x4b2e37);})[_0xec50('0x36')](function(_0x267d48){_0x17795f['rows']=_0x267d48;return _0x17795f;})[_0xec50('0x36')](respondWithFilteredResult(_0x1992ba,_0x4b2e37))[_0xec50('0x4e')](handleError(_0x1992ba,null));};exports['show']=function(_0x49e9d7,_0x53f622){var _0xdd278e={'raw':![],'where':{'id':_0x49e9d7[_0xec50('0x4f')]['id']}},_0x3af309={};_0x3af309[_0xec50('0x3d')]=_['keys'](db['ZendeskAccount'][_0xec50('0x3a')]);_0x3af309[_0xec50('0x3f')]=_[_0xec50('0x50')](_0x49e9d7[_0xec50('0x3f')]);_0x3af309[_0xec50('0x40')]=_['intersection'](_0x3af309[_0xec50('0x3d')],_0x3af309['query']);_0xdd278e[_0xec50('0x42')]=_['intersection'](_0x3af309['model'],qs['fields'](_0x49e9d7['query'][_0xec50('0x51')]));_0xdd278e['attributes']=_0xdd278e['attributes']['length']?_0xdd278e['attributes']:_0x3af309['model'];if(_0x49e9d7[_0xec50('0x3f')][_0xec50('0x4b')]){_0xdd278e[_0xec50('0x4c')]=[{'all':!![]}];}_0xdd278e=_[_0xec50('0x52')]({},_0xdd278e,_0x49e9d7[_0xec50('0x53')]);return db[_0xec50('0x39')][_0xec50('0x54')](_0xdd278e)['then'](handleEntityNotFound(_0x53f622,null))[_0xec50('0x36')](respondWithResult(_0x53f622,null))[_0xec50('0x4e')](handleError(_0x53f622,null));};exports[_0xec50('0x55')]=function(_0x207488,_0x14f530){return db['ZendeskAccount'][_0xec50('0x55')](_0x207488[_0xec50('0x56')],{})[_0xec50('0x36')](respondWithResult(_0x14f530,0xc9))[_0xec50('0x4e')](handleError(_0x14f530,null));};exports['update']=function(_0x54d3c5,_0xcbb5ad){if(_0x54d3c5[_0xec50('0x56')]['id']){delete _0x54d3c5[_0xec50('0x56')]['id'];}return db[_0xec50('0x39')][_0xec50('0x54')]({'where':{'id':_0x54d3c5['params']['id']}})['then'](handleEntityNotFound(_0xcbb5ad,null))[_0xec50('0x36')](saveUpdates(_0x54d3c5[_0xec50('0x56')],null))[_0xec50('0x36')](respondWithResult(_0xcbb5ad,null))[_0xec50('0x4e')](handleError(_0xcbb5ad,null));};exports[_0xec50('0x57')]=function(_0x208ad3,_0xbd767f){return db['ZendeskAccount'][_0xec50('0x54')]({'where':{'id':_0x208ad3[_0xec50('0x4f')]['id']}})['then'](handleEntityNotFound(_0xbd767f,null))[_0xec50('0x36')](removeEntity(_0xbd767f,null))[_0xec50('0x4e')](handleError(_0xbd767f,null));};exports[_0xec50('0x58')]=function(_0x559a75,_0x2a2143,_0x2f707e){var _0x5eef0c={};var _0x3d11a6={};var _0x2cb3e5;var _0x5b8f0d;return db[_0xec50('0x39')][_0xec50('0x59')]({'where':{'id':_0x559a75[_0xec50('0x4f')]['id']}})[_0xec50('0x36')](handleEntityNotFound(_0x2a2143,null))[_0xec50('0x36')](function(_0x512201){if(_0x512201){_0x2cb3e5=_0x512201;_0x3d11a6[_0xec50('0x3d')]=_[_0xec50('0x50')](db[_0xec50('0x5a')][_0xec50('0x3a')]);_0x3d11a6[_0xec50('0x3f')]=_[_0xec50('0x50')](_0x559a75[_0xec50('0x3f')]);_0x3d11a6[_0xec50('0x40')]=_[_0xec50('0x41')](_0x3d11a6[_0xec50('0x3d')],_0x3d11a6[_0xec50('0x3f')]);_0x5eef0c[_0xec50('0x42')]=_['intersection'](_0x3d11a6[_0xec50('0x3d')],qs['fields'](_0x559a75['query'][_0xec50('0x51')]));_0x5eef0c['attributes']=_0x5eef0c[_0xec50('0x42')][_0xec50('0x43')]?_0x5eef0c['attributes']:_0x3d11a6[_0xec50('0x3d')];_0x5eef0c[_0xec50('0x5b')]=qs[_0xec50('0x45')](_0x559a75[_0xec50('0x3f')]['sort']);_0x5eef0c['where']=qs[_0xec50('0x40')](_['pick'](_0x559a75['query'],_0x3d11a6[_0xec50('0x40')]));if(_0x559a75['query'][_0xec50('0x4a')]){_0x5eef0c[_0xec50('0x46')]=_[_0xec50('0x52')](_0x5eef0c['where'],{'$or':_['map'](_0x5eef0c[_0xec50('0x42')],function(_0x2327ab){var _0x199f43={};_0x199f43[_0x2327ab]={'$like':'%'+_0x559a75['query'][_0xec50('0x4a')]+'%'};return _0x199f43;})});}_0x5eef0c=_[_0xec50('0x52')]({},_0x5eef0c,_0x559a75['options']);return _0x2cb3e5[_0xec50('0x58')](_0x5eef0c);}})[_0xec50('0x36')](function(_0x3de393){if(_0x3de393){_0x5b8f0d=_0x3de393[_0xec50('0x43')];if(!_0x559a75[_0xec50('0x3f')][_0xec50('0x5c')](_0xec50('0x44'))){_0x5eef0c[_0xec50('0x2f')]=qs['limit'](_0x559a75[_0xec50('0x3f')][_0xec50('0x2f')]);_0x5eef0c['offset']=qs[_0xec50('0x2e')](_0x559a75[_0xec50('0x3f')][_0xec50('0x2e')]);}return _0x2cb3e5['getConfigurations'](_0x5eef0c);}})['then'](function(_0x18f690){if(_0x18f690){return _0x18f690?{'count':_0x5b8f0d,'rows':_0x18f690}:null;}})[_0xec50('0x36')](respondWithResult(_0x2a2143,null))[_0xec50('0x4e')](handleError(_0x2a2143,null));};exports[_0xec50('0x5d')]=function(_0x403f74,_0x2a7bd5,_0x41224f){if(_0x403f74['body']['id']){delete _0x403f74[_0xec50('0x56')]['id'];}return db[_0xec50('0x39')][_0xec50('0x59')]({'where':{'id':_0x403f74[_0xec50('0x4f')]['id']}})[_0xec50('0x36')](handleEntityNotFound(_0x2a7bd5,null))[_0xec50('0x36')](function(_0x1ca461){if(_0x1ca461){_0x403f74[_0xec50('0x56')][_0xec50('0x5e')]=_0x1ca461['id'];_0x403f74[_0xec50('0x56')][_0xec50('0x5f')]=integrations[_0xec50('0x60')](_0x403f74['body']['channel'],_0x403f74[_0xec50('0x56')]['type']);_0x403f74[_0xec50('0x56')][_0xec50('0x61')]=integrations['getDescriptions'](_0x403f74[_0xec50('0x56')][_0xec50('0x62')],_0x403f74['body']['type']);return db[_0xec50('0x5a')][_0xec50('0x55')](_0x403f74[_0xec50('0x56')],{'include':[{'model':db['ZendeskField'],'as':_0xec50('0x5f')},{'model':db['ZendeskField'],'as':_0xec50('0x61')}]});}return null;})[_0xec50('0x36')](respondWithResult(_0x2a7bd5,null))[_0xec50('0x4e')](handleError(_0x2a7bd5,null));};exports[_0xec50('0x63')]=function(_0x152612,_0x447c3b,_0x464c59){var _0x461e84='';return db[_0xec50('0x39')]['findOne']({'where':{'id':_0x152612[_0xec50('0x4f')]['id']},'attributes':['id',_0xec50('0x64'),_0xec50('0x65'),_0xec50('0x66'),'authType','remoteUri']})[_0xec50('0x36')](handleEntityNotFound(_0x447c3b,null))['then'](function(_0x241594){if(_0x241594){_0x461e84=_0x241594['remoteUri'];var _0x5b47f6=_0x461e84[_0xec50('0x67')](-0x1);if(_0x5b47f6==='/'){_0x461e84=_0x461e84['substring'](0x0,_0x461e84[_0xec50('0x68')](_0x5b47f6));}var _0x3399ea={'method':'GET','uri':util[_0xec50('0x69')](_0xec50('0x6a'),_0x461e84,_0xec50('0x6b')),'json':!![]};switch(_0x241594[_0xec50('0x6c')]){case _0xec50('0x65'):_0x3399ea['headers']={'Authorization':util[_0xec50('0x69')](_0xec50('0x6d'),new Buffer(util[_0xec50('0x69')](_0xec50('0x6e'),_0x241594['username'],_0x241594[_0xec50('0x65')]))[_0xec50('0x6f')](_0xec50('0x70')))};break;case _0xec50('0x66'):_0x3399ea[_0xec50('0x71')]={'Authorization':util['format'](_0xec50('0x6d'),new Buffer(util[_0xec50('0x69')](_0xec50('0x72'),_0x241594[_0xec50('0x64')],_0x241594[_0xec50('0x66')]))[_0xec50('0x6f')](_0xec50('0x70')))};break;default:throw new db['Sequelize'][(_0xec50('0x20'))](_0xec50('0x73'));}return rp(_0x3399ea);}})[_0xec50('0x36')](function(_0x1ba120){if(_0x1ba120){var _0xf16d9a=[_0xec50('0x74'),_0xec50('0x75'),_0xec50('0x76'),_0xec50('0x77')];_[_0xec50('0x78')](_0x1ba120[_0xec50('0x6b')],function(_0x3077d5){return _0xf16d9a[_0xec50('0x79')](_0x3077d5[_0xec50('0x48')]);});return{'count':_0x1ba120[_0xec50('0x6b')][_0xec50('0x43')],'rows':_[_0xec50('0x38')](_0x1ba120[_0xec50('0x6b')],function(_0x302609){return{'id':_0x302609['id'],'name':_0x302609[_0xec50('0x7a')]>0x7?_0x302609[_0xec50('0x7b')]:_0x302609[_0xec50('0x48')],'custom':_0x302609[_0xec50('0x7a')]>0x7?!![]:![],'options':_0x302609[_0xec50('0x7c')]?_0x302609[_0xec50('0x7c')]:_0x302609[_0xec50('0x7d')]?_0x302609[_0xec50('0x7d')]:[]};})};}})[_0xec50('0x36')](respondWithResult(_0x447c3b,null))[_0xec50('0x4e')](function(_0x3bb261){var _0xaa857b=_0x152612['query'][_0xec50('0x1e')]?0x1f4:_0x3bb261[_0xec50('0x7e')]||0x1f4;logger[_0xec50('0x25')](_0xec50('0x7f'),_0xec50('0x63'),_0xaa857b,JSON[_0xec50('0x24')](_0x3bb261));delete _0x3bb261[_0xec50('0x3e')];if(_0xaa857b===0x191){_0xaa857b=0x190;}_0x447c3b[_0xec50('0x2b')](_0xaa857b)[_0xec50('0x80')](_0x152612[_0xec50('0x3f')][_0xec50('0x1e')]?{'message':'Wrong\x20credentials','statusCode':_0x3bb261['statusCode']}:_0x3bb261);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 69ec869..541f172 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 _0x9b68=['api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','util'];(function(_0x353378,_0x282f2c){var _0x5ca4ac=function(_0x1b4234){while(--_0x1b4234){_0x353378['push'](_0x353378['shift']());}};_0x5ca4ac(++_0x282f2c);}(_0x9b68,0x136));var _0x89b6=function(_0x208505,_0x241a77){_0x208505=_0x208505-0x0;var _0x1a985f=_0x9b68[_0x208505];return _0x1a985f;};'use strict';var _=require(_0x89b6('0x0'));var util=require(_0x89b6('0x1'));var logger=require('../../config/logger')(_0x89b6('0x2'));var moment=require('moment');var BPromise=require(_0x89b6('0x3'));var rp=require(_0x89b6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89b6('0x5'));var config=require(_0x89b6('0x6'));var attributes=require(_0x89b6('0x7'));var integrations=require(_0x89b6('0x8'));module[_0x89b6('0x9')]=function(_0x5f280a,_0x3e9033){return _0x5f280a[_0x89b6('0xa')](_0x89b6('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4b7=['define','ZendeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x27891e,_0x1f8cfe){var _0x549276=function(_0x5c38d2){while(--_0x5c38d2){_0x27891e['push'](_0x27891e['shift']());}};_0x549276(++_0x1f8cfe);}(_0xa4b7,0x13a));var _0x7a4b=function(_0x295eb2,_0x20c602){_0x295eb2=_0x295eb2-0x0;var _0x58731e=_0xa4b7[_0x295eb2];return _0x58731e;};'use strict';var _=require(_0x7a4b('0x0'));var util=require(_0x7a4b('0x1'));var logger=require(_0x7a4b('0x2'))(_0x7a4b('0x3'));var moment=require(_0x7a4b('0x4'));var BPromise=require(_0x7a4b('0x5'));var rp=require(_0x7a4b('0x6'));var fs=require('fs');var path=require(_0x7a4b('0x7'));var rimraf=require(_0x7a4b('0x8'));var config=require(_0x7a4b('0x9'));var attributes=require(_0x7a4b('0xa'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3ab717,_0x4398d7){return _0x3ab717[_0x7a4b('0xb')](_0x7a4b('0xc'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index b1419b5..2a5bd75 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 _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(_0x1d6fae,_0x297e27){var _0x27e850=function(_0x6699eb){while(--_0x6699eb){_0x1d6fae['push'](_0x1d6fae['shift']());}};_0x27e850(++_0x297e27);}(_0xb7e7,0x121));var _0x7b7e=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xb7e7[_0x468b0f];return _0x3e74d9;};'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 +var _0xd8b0=['raw','where','include','map','model','attributes','ShowZendeskAccount','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','options'];(function(_0x1e11c2,_0x1bcbca){var _0x4faa44=function(_0x4c3bf3){while(--_0x4c3bf3){_0x1e11c2['push'](_0x1e11c2['shift']());}};_0x4faa44(++_0x1bcbca);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['findAll']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'limit':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['limit']||null:null,'include':_0x5fecbd['options']?_0x5fecbd['options'][_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x221071){return{'model':db[_0x221071[_0x0d8b('0x1d')]],'as':_0x221071['as'],'attributes':_0x221071[_0x0d8b('0x1e')],'include':_0x221071[_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x221071['include'],function(_0xe8bbee){return{'model':db[_0xe8bbee[_0x0d8b('0x1d')]],'as':_0xe8bbee['as'],'attributes':_0xe8bbee['attributes'],'include':_0xe8bbee[_0x0d8b('0x1b')]?_['map'](_0xe8bbee[_0x0d8b('0x1b')],function(_0x234bdd){return{'model':db[_0x234bdd[_0x0d8b('0x1d')]],'as':_0x234bdd['as'],'attributes':_0x234bdd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28f639){logger[_0x0d8b('0xb')]('GetZendeskAccount',_0x5fecbd);logger[_0x0d8b('0xe')]('GetZendeskAccount',_0x5fecbd,JSON[_0x0d8b('0x10')](_0x28f639));_0x18dd2d(_0x28f639);})['catch'](function(_0x97050a){logger['error'](_0x0d8b('0x16'),_0x97050a['message'],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x97050a['message']));});});};exports[_0x0d8b('0x1f')]=function(_0x106e4c){var _0x2c058d=this;return new Promise(function(_0x56120a,_0x4c80a2){return db['ZendeskAccount'][_0x0d8b('0x20')]({'raw':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1e')]||null:null,'include':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')]?_['map'](_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x4b3ea0){return{'model':db[_0x4b3ea0[_0x0d8b('0x1d')]],'as':_0x4b3ea0['as'],'attributes':_0x4b3ea0[_0x0d8b('0x1e')],'include':_0x4b3ea0[_0x0d8b('0x1b')]?_['map'](_0x4b3ea0[_0x0d8b('0x1b')],function(_0x2c507e){return{'model':db[_0x2c507e[_0x0d8b('0x1d')]],'as':_0x2c507e['as'],'attributes':_0x2c507e[_0x0d8b('0x1e')],'include':_0x2c507e[_0x0d8b('0x1b')]?_['map'](_0x2c507e[_0x0d8b('0x1b')],function(_0x1649fc){return{'model':db[_0x1649fc['model']],'as':_0x1649fc['as'],'attributes':_0x1649fc[_0x0d8b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0x188af2){logger[_0x0d8b('0xb')](_0x0d8b('0x1f'),_0x106e4c);logger['debug']('ShowZendeskAccount',_0x106e4c,JSON[_0x0d8b('0x10')](_0x188af2));_0x56120a(_0x188af2);})['catch'](function(_0x531c55){logger[_0x0d8b('0x11')](_0x0d8b('0x1f'),_0x531c55[_0x0d8b('0x13')],_0x106e4c);_0x4c80a2(_0x2c058d[_0x0d8b('0x11')](0x1f4,_0x531c55[_0x0d8b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index d08f142..5645976 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 _0x433b=['getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','isAuthenticated','/:id','show','/:id/fields','getFields','get','/:id/subjects','getSubjects'];(function(_0x4e20dd,_0x5a1f0c){var _0x2e199b=function(_0x195ffc){while(--_0x195ffc){_0x4e20dd['push'](_0x4e20dd['shift']());}};_0x2e199b(++_0x5a1f0c);}(_0x433b,0x176));var _0xb433=function(_0x12ff2c,_0x4cab86){_0x12ff2c=_0x12ff2c-0x0;var _0x2467a3=_0x433b[_0x12ff2c];return _0x2467a3;};'use strict';var multer=require(_0xb433('0x0'));var util=require(_0xb433('0x1'));var path=require(_0xb433('0x2'));var timeout=require(_0xb433('0x3'));var express=require('express');var router=express[_0xb433('0x4')]();var auth=require(_0xb433('0x5'));var interaction=require(_0xb433('0x6'));var config=require('../../config/environment');var controller=require(_0xb433('0x7'));router['get']('/',auth[_0xb433('0x8')](),controller['index']);router['get'](_0xb433('0x9'),auth[_0xb433('0x8')](),controller[_0xb433('0xa')]);router['get'](_0xb433('0xb'),auth[_0xb433('0x8')](),controller[_0xb433('0xc')]);router[_0xb433('0xd')](_0xb433('0xe'),auth[_0xb433('0x8')](),controller[_0xb433('0xf')]);router[_0xb433('0xd')]('/:id/descriptions',auth[_0xb433('0x8')](),controller[_0xb433('0x10')]);router[_0xb433('0xd')](_0xb433('0x11'),auth[_0xb433('0x8')](),controller[_0xb433('0x12')]);router[_0xb433('0x13')]('/',auth['isAuthenticated'](),controller[_0xb433('0x14')]);router[_0xb433('0x13')](_0xb433('0x11'),auth[_0xb433('0x8')](),controller[_0xb433('0x15')]);router[_0xb433('0x16')](_0xb433('0x9'),auth[_0xb433('0x8')](),controller[_0xb433('0x17')]);router[_0xb433('0x18')](_0xb433('0x9'),auth[_0xb433('0x8')](),controller['destroy']);module[_0xb433('0x19')]=router; \ No newline at end of file +var _0xfa30=['express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','/:id/tags','getTags','post','create','update','destroy','exports','path','connect-timeout'];(function(_0x26d3d9,_0x2bd62a){var _0x5ec476=function(_0xec2998){while(--_0xec2998){_0x26d3d9['push'](_0x26d3d9['shift']());}};_0x5ec476(++_0x2bd62a);}(_0xfa30,0x1de));var _0x0fa3=function(_0x205889,_0xeee91a){_0x205889=_0x205889-0x0;var _0x5155bd=_0xfa30[_0x205889];return _0x5155bd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0fa3('0x0'));var timeout=require(_0x0fa3('0x1'));var express=require(_0x0fa3('0x2'));var router=express['Router']();var auth=require(_0x0fa3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0fa3('0x4'));var controller=require('./intZendeskConfiguration.controller');router[_0x0fa3('0x5')]('/',auth[_0x0fa3('0x6')](),controller[_0x0fa3('0x7')]);router['get'](_0x0fa3('0x8'),auth[_0x0fa3('0x6')](),controller[_0x0fa3('0x9')]);router[_0x0fa3('0x5')](_0x0fa3('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x0fa3('0x5')](_0x0fa3('0xb'),auth[_0x0fa3('0x6')](),controller['getSubjects']);router[_0x0fa3('0x5')](_0x0fa3('0xc'),auth[_0x0fa3('0x6')](),controller['getDescriptions']);router[_0x0fa3('0x5')](_0x0fa3('0xd'),auth[_0x0fa3('0x6')](),controller[_0x0fa3('0xe')]);router[_0x0fa3('0xf')]('/',auth[_0x0fa3('0x6')](),controller[_0x0fa3('0x10')]);router[_0x0fa3('0xf')](_0x0fa3('0xd'),auth[_0x0fa3('0x6')](),controller['setTags']);router['put'](_0x0fa3('0x8'),auth['isAuthenticated'](),controller[_0x0fa3('0x11')]);router['delete'](_0x0fa3('0x8'),auth[_0x0fa3('0x6')](),controller[_0x0fa3('0x12')]);module[_0x0fa3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index d384278..4d748fc 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 _0xfc75=['STRING'];(function(_0x59faab,_0x421663){var _0x55407b=function(_0x58fa26){while(--_0x58fa26){_0x59faab['push'](_0x59faab['shift']());}};_0x55407b(++_0x421663);}(_0xfc75,0xf8));var _0x5fc7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfc75[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5fc7('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x41fd=['exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41fd,0x1d8));var _0xd41f=function(_0x2f25e1,_0x252a80){_0x2f25e1=_0x2f25e1-0x0;var _0x4c9903=_0x41fd[_0x2f25e1];return _0x4c9903;};'use strict';var Sequelize=require('sequelize');module[_0xd41f('0x0')]={'name':{'type':Sequelize[_0xd41f('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 33b057b..9df32e0 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 _0x7217=['rawAttributes','keys','intersection','include','options','find','create','body','params','getFields','ZendeskField','getSubjects','hasOwnProperty','getDescriptions','findOne','Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','then','stack','name','index','map','type','key','model','query','filters','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','ZendeskConfiguration','includeAll','rows','show'];(function(_0x12877b,_0x8650cf){var _0x3549ff=function(_0x4f96b7){while(--_0x4f96b7){_0x12877b['push'](_0x12877b['shift']());}};_0x3549ff(++_0x8650cf);}(_0x7217,0x19e));var _0x7721=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x7217[_0x47b58b];return _0x46bebe;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var db=require(_0x7721('0x1a'))['db'];var jayson=require(_0x7721('0x1b'));var client=jayson['client'][_0x7721('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x199930,_0x57ff6d,_0x109900){if(_0x109900){var _0x30da54=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30da54[_0x7721('0x1d')](_0x57ff6d)){return _0x199930;}else{throw new db[(_0x7721('0x1e'))]['ValidationError'](_0x7721('0x1f'));}}else{return _0x199930;}}function respondWithRpcPromise(_0x25b1c0,_0x534f1b,_0x4e199a,_0x4b183e){return new BPromise(function(_0x5ed54,_0x25a628){var _0x3cc909=_0x4b183e||client;return _0x3cc909[_0x7721('0x20')](_0x25b1c0,_0x4e199a)['then'](function(_0x20f669){logger['info'](_0x7721('0x21'),_0x534f1b,'request\x20sent');logger[_0x7721('0x22')](_0x7721('0x23'),_0x534f1b,_0x7721('0x24'),JSON[_0x7721('0x25')](_0x20f669));if(_0x20f669[_0x7721('0x26')]){if(_0x20f669[_0x7721('0x26')][_0x7721('0x27')]===0x1f4){logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x20f669[_0x7721('0x26')]['message']);return _0x25a628(_0x20f669[_0x7721('0x26')][_0x7721('0x28')]);}logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x20f669['error'][_0x7721('0x28')]);return _0x5ed54(_0x20f669['error'][_0x7721('0x28')]);}else{logger[_0x7721('0x29')](_0x7721('0x21'),_0x534f1b,_0x7721('0x24'));_0x5ed54(_0x20f669[_0x7721('0x2a')][_0x7721('0x28')]);}})[_0x7721('0x2b')](function(_0x5b4d74){logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x5b4d74);_0x25a628(_0x5b4d74);});});}function respondWithStatusCode(_0x125564,_0x1f67c7){_0x1f67c7=_0x1f67c7||0xcc;return function(_0x40d550){if(_0x40d550){return _0x125564[_0x7721('0x2c')](_0x1f67c7);}return _0x125564[_0x7721('0x2d')](_0x1f67c7)[_0x7721('0x2e')]();};}function respondWithResult(_0x40f367,_0x52316e){_0x52316e=_0x52316e||0xc8;return function(_0x258ddf){if(_0x258ddf){return _0x40f367['status'](_0x52316e)['json'](_0x258ddf);}};}function respondWithFilteredResult(_0x315202,_0x343c19){return function(_0x53c904){if(_0x53c904){var _0x158d98=_0x53c904[_0x7721('0x2f')],_0x1ea4d=_0x343c19['offset'],_0x37b9f0=_0x343c19[_0x7721('0x30')]+_0x343c19[_0x7721('0x31')],_0xd7d703;if(_0x37b9f0>=_0x158d98){_0x37b9f0=_0x158d98;_0xd7d703=0xc8;}else{_0xd7d703=0xce;}_0x315202['status'](_0xd7d703);return _0x315202['set'](_0x7721('0x32'),_0x1ea4d+'-'+_0x37b9f0+'/'+_0x158d98)[_0x7721('0x33')](_0x53c904);}return null;};}function patchUpdates(_0x48f329){return function(_0x46f772){try{jsonpatch[_0x7721('0x34')](_0x46f772,_0x48f329,!![]);}catch(_0x382821){return BPromise['reject'](_0x382821);}return _0x46f772[_0x7721('0x35')]();};}function saveUpdates(_0x1ff31b,_0x1492d4){return function(_0x3f15e2){if(_0x3f15e2){return _0x3f15e2[_0x7721('0x36')](_0x1ff31b)['then'](function(_0x195ffb){return _0x195ffb;});}return null;};}function removeEntity(_0x3e4e56,_0xb2386d){return function(_0x5c5b33){if(_0x5c5b33){return _0x5c5b33[_0x7721('0x37')]()[_0x7721('0x38')](function(){_0x3e4e56['status'](0xcc)[_0x7721('0x2e')]();});}};}function handleEntityNotFound(_0x5ce026,_0x2d6ba0){return function(_0x326c50){if(!_0x326c50){_0x5ce026[_0x7721('0x2c')](0x194);}return _0x326c50;};}function handleError(_0x1d894b,_0x1c84c0){_0x1c84c0=_0x1c84c0||0x1f4;return function(_0x13c635){logger[_0x7721('0x26')](_0x13c635[_0x7721('0x39')]);if(_0x13c635[_0x7721('0x3a')]){delete _0x13c635[_0x7721('0x3a')];}_0x1d894b[_0x7721('0x2d')](_0x1c84c0)['send'](_0x13c635);};}exports[_0x7721('0x3b')]=function(_0x5e6663,_0x212384){var _0x35614c={},_0x7942f7={},_0x1d03de={'count':0x0,'rows':[]};var _0x3968f3=_[_0x7721('0x3c')](db['ZendeskConfiguration']['rawAttributes'],function(_0x4cadef){return{'name':_0x4cadef['fieldName'],'type':_0x4cadef[_0x7721('0x3d')][_0x7721('0x3e')]};});_0x7942f7[_0x7721('0x3f')]=_[_0x7721('0x3c')](_0x3968f3,'name');_0x7942f7[_0x7721('0x40')]=_['keys'](_0x5e6663[_0x7721('0x40')]);_0x7942f7[_0x7721('0x41')]=_['intersection'](_0x7942f7[_0x7721('0x3f')],_0x7942f7[_0x7721('0x40')]);_0x35614c['attributes']=_['intersection'](_0x7942f7[_0x7721('0x3f')],qs[_0x7721('0x42')](_0x5e6663[_0x7721('0x40')][_0x7721('0x42')]));_0x35614c['attributes']=_0x35614c[_0x7721('0x43')][_0x7721('0x44')]?_0x35614c[_0x7721('0x43')]:_0x7942f7[_0x7721('0x3f')];if(!_0x5e6663[_0x7721('0x40')]['hasOwnProperty'](_0x7721('0x45'))){_0x35614c['limit']=qs[_0x7721('0x31')](_0x5e6663['query'][_0x7721('0x31')]);_0x35614c[_0x7721('0x30')]=qs[_0x7721('0x30')](_0x5e6663['query'][_0x7721('0x30')]);}_0x35614c[_0x7721('0x46')]=qs[_0x7721('0x47')](_0x5e6663['query'][_0x7721('0x47')]);_0x35614c[_0x7721('0x48')]=qs[_0x7721('0x41')](_[_0x7721('0x49')](_0x5e6663[_0x7721('0x40')],_0x7942f7[_0x7721('0x41')]));if(_0x5e6663[_0x7721('0x40')]['filter']){_0x35614c['where']=_[_0x7721('0x4a')](_0x35614c[_0x7721('0x48')],{'$or':_[_0x7721('0x3c')](_0x3968f3,function(_0x39a3ad){if(_0x39a3ad[_0x7721('0x3d')]!==_0x7721('0x4b')){var _0x1d2ea5={};_0x1d2ea5[_0x39a3ad[_0x7721('0x3a')]]={'$like':'%'+_0x5e6663[_0x7721('0x40')][_0x7721('0x4c')]+'%'};return _0x1d2ea5;}})});}_0x35614c=_['merge']({},_0x35614c,_0x5e6663['options']);var _0x5ed70d={'where':_0x35614c[_0x7721('0x48')]};return db[_0x7721('0x4d')][_0x7721('0x2f')](_0x5ed70d)['then'](function(_0x30107e){_0x1d03de[_0x7721('0x2f')]=_0x30107e;if(_0x5e6663['query'][_0x7721('0x4e')]){_0x35614c['include']=[{'all':!![]}];}return db[_0x7721('0x4d')]['findAll'](_0x35614c);})[_0x7721('0x38')](function(_0x196be4){_0x1d03de[_0x7721('0x4f')]=_0x196be4;return _0x1d03de;})['then'](respondWithFilteredResult(_0x212384,_0x35614c))[_0x7721('0x2b')](handleError(_0x212384,null));};exports[_0x7721('0x50')]=function(_0x499381,_0x223d93){var _0x1196c2={'raw':![],'where':{'id':_0x499381['params']['id']}},_0xf88e8c={};_0xf88e8c[_0x7721('0x3f')]=_['keys'](db[_0x7721('0x4d')][_0x7721('0x51')]);_0xf88e8c[_0x7721('0x40')]=_[_0x7721('0x52')](_0x499381[_0x7721('0x40')]);_0xf88e8c[_0x7721('0x41')]=_[_0x7721('0x53')](_0xf88e8c[_0x7721('0x3f')],_0xf88e8c[_0x7721('0x40')]);_0x1196c2[_0x7721('0x43')]=_[_0x7721('0x53')](_0xf88e8c[_0x7721('0x3f')],qs[_0x7721('0x42')](_0x499381[_0x7721('0x40')][_0x7721('0x42')]));_0x1196c2['attributes']=_0x1196c2[_0x7721('0x43')][_0x7721('0x44')]?_0x1196c2[_0x7721('0x43')]:_0xf88e8c[_0x7721('0x3f')];if(_0x499381[_0x7721('0x40')][_0x7721('0x4e')]){_0x1196c2[_0x7721('0x54')]=[{'all':!![]}];}_0x1196c2=_['merge']({},_0x1196c2,_0x499381[_0x7721('0x55')]);return db[_0x7721('0x4d')][_0x7721('0x56')](_0x1196c2)[_0x7721('0x38')](handleEntityNotFound(_0x223d93,null))[_0x7721('0x38')](respondWithResult(_0x223d93,null))[_0x7721('0x2b')](handleError(_0x223d93,null));};exports[_0x7721('0x57')]=function(_0x33287d,_0x11b300){return db[_0x7721('0x4d')][_0x7721('0x57')](_0x33287d['body'],{})[_0x7721('0x38')](respondWithResult(_0x11b300,0xc9))[_0x7721('0x2b')](handleError(_0x11b300,null));};exports[_0x7721('0x36')]=function(_0x2ee3c0,_0x15ed3b){if(_0x2ee3c0[_0x7721('0x58')]['id']){delete _0x2ee3c0[_0x7721('0x58')]['id'];}return db[_0x7721('0x4d')][_0x7721('0x56')]({'where':{'id':_0x2ee3c0[_0x7721('0x59')]['id']}})[_0x7721('0x38')](handleEntityNotFound(_0x15ed3b,null))[_0x7721('0x38')](saveUpdates(_0x2ee3c0[_0x7721('0x58')],null))[_0x7721('0x38')](respondWithResult(_0x15ed3b,null))[_0x7721('0x2b')](handleError(_0x15ed3b,null));};exports['destroy']=function(_0x50e9e9,_0x4e112e){return db[_0x7721('0x4d')]['find']({'where':{'id':_0x50e9e9['params']['id']}})['then'](handleEntityNotFound(_0x4e112e,null))['then'](removeEntity(_0x4e112e,null))[_0x7721('0x2b')](handleError(_0x4e112e,null));};exports[_0x7721('0x5a')]=function(_0x13f254,_0x5343a1,_0x5181d7){var _0x5925b7={};var _0x51a3a2={};var _0x484b8e;var _0x24d1dc;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x13f254['params']['id']}})[_0x7721('0x38')](handleEntityNotFound(_0x5343a1,null))[_0x7721('0x38')](function(_0x1ff090){if(_0x1ff090){_0x484b8e=_0x1ff090;_0x51a3a2['model']=_[_0x7721('0x52')](db[_0x7721('0x5b')][_0x7721('0x51')]);_0x51a3a2[_0x7721('0x40')]=_[_0x7721('0x52')](_0x13f254[_0x7721('0x40')]);_0x51a3a2[_0x7721('0x41')]=_[_0x7721('0x53')](_0x51a3a2[_0x7721('0x3f')],_0x51a3a2[_0x7721('0x40')]);_0x5925b7[_0x7721('0x43')]=_[_0x7721('0x53')](_0x51a3a2[_0x7721('0x3f')],qs[_0x7721('0x42')](_0x13f254[_0x7721('0x40')]['fields']));_0x5925b7[_0x7721('0x43')]=_0x5925b7[_0x7721('0x43')][_0x7721('0x44')]?_0x5925b7[_0x7721('0x43')]:_0x51a3a2['model'];_0x5925b7[_0x7721('0x46')]=qs[_0x7721('0x47')](_0x13f254['query'][_0x7721('0x47')]);_0x5925b7['where']=qs[_0x7721('0x41')](_[_0x7721('0x49')](_0x13f254[_0x7721('0x40')],_0x51a3a2[_0x7721('0x41')]));if(_0x13f254[_0x7721('0x40')][_0x7721('0x4c')]){_0x5925b7[_0x7721('0x48')]=_[_0x7721('0x4a')](_0x5925b7[_0x7721('0x48')],{'$or':_['map'](_0x5925b7[_0x7721('0x43')],function(_0x24444f){var _0x112033={};_0x112033[_0x24444f]={'$like':'%'+_0x13f254[_0x7721('0x40')][_0x7721('0x4c')]+'%'};return _0x112033;})});}_0x5925b7=_[_0x7721('0x4a')]({},_0x5925b7,_0x13f254[_0x7721('0x55')]);return _0x484b8e['getFields'](_0x5925b7);}})[_0x7721('0x38')](function(_0xb19b84){if(_0xb19b84){_0x24d1dc=_0xb19b84['length'];if(!_0x13f254[_0x7721('0x40')]['hasOwnProperty'](_0x7721('0x45'))){_0x5925b7[_0x7721('0x31')]=qs[_0x7721('0x31')](_0x13f254[_0x7721('0x40')][_0x7721('0x31')]);_0x5925b7[_0x7721('0x30')]=qs[_0x7721('0x30')](_0x13f254['query'][_0x7721('0x30')]);}return _0x484b8e[_0x7721('0x5a')](_0x5925b7);}})[_0x7721('0x38')](function(_0x5f08cc){if(_0x5f08cc){return _0x5f08cc?{'count':_0x24d1dc,'rows':_0x5f08cc}:null;}})['then'](respondWithResult(_0x5343a1,null))['catch'](handleError(_0x5343a1,null));};exports['getSubjects']=function(_0x5e966f,_0x1fc5f7,_0x2645dd){var _0x580473={};var _0x2d4b3a={};var _0x42f6e9;var _0xbbc86f;return db[_0x7721('0x4d')]['findOne']({'where':{'id':_0x5e966f[_0x7721('0x59')]['id']}})[_0x7721('0x38')](handleEntityNotFound(_0x1fc5f7,null))[_0x7721('0x38')](function(_0x1bea13){if(_0x1bea13){_0x42f6e9=_0x1bea13;_0x2d4b3a[_0x7721('0x3f')]=_['keys'](db[_0x7721('0x5b')][_0x7721('0x51')]);_0x2d4b3a[_0x7721('0x40')]=_['keys'](_0x5e966f['query']);_0x2d4b3a[_0x7721('0x41')]=_[_0x7721('0x53')](_0x2d4b3a[_0x7721('0x3f')],_0x2d4b3a[_0x7721('0x40')]);_0x580473[_0x7721('0x43')]=_['intersection'](_0x2d4b3a['model'],qs[_0x7721('0x42')](_0x5e966f[_0x7721('0x40')][_0x7721('0x42')]));_0x580473[_0x7721('0x43')]=_0x580473[_0x7721('0x43')][_0x7721('0x44')]?_0x580473[_0x7721('0x43')]:_0x2d4b3a['model'];_0x580473[_0x7721('0x46')]=qs[_0x7721('0x47')](_0x5e966f[_0x7721('0x40')]['sort']);_0x580473[_0x7721('0x48')]=qs[_0x7721('0x41')](_[_0x7721('0x49')](_0x5e966f[_0x7721('0x40')],_0x2d4b3a['filters']));if(_0x5e966f['query'][_0x7721('0x4c')]){_0x580473[_0x7721('0x48')]=_[_0x7721('0x4a')](_0x580473[_0x7721('0x48')],{'$or':_[_0x7721('0x3c')](_0x580473[_0x7721('0x43')],function(_0x59e80c){var _0x3855d5={};_0x3855d5[_0x59e80c]={'$like':'%'+_0x5e966f[_0x7721('0x40')][_0x7721('0x4c')]+'%'};return _0x3855d5;})});}_0x580473=_['merge']({},_0x580473,_0x5e966f[_0x7721('0x55')]);return _0x42f6e9[_0x7721('0x5c')](_0x580473);}})[_0x7721('0x38')](function(_0xc20188){if(_0xc20188){_0xbbc86f=_0xc20188[_0x7721('0x44')];if(!_0x5e966f['query'][_0x7721('0x5d')]('nolimit')){_0x580473[_0x7721('0x31')]=qs[_0x7721('0x31')](_0x5e966f[_0x7721('0x40')][_0x7721('0x31')]);_0x580473[_0x7721('0x30')]=qs[_0x7721('0x30')](_0x5e966f[_0x7721('0x40')][_0x7721('0x30')]);}return _0x42f6e9[_0x7721('0x5c')](_0x580473);}})[_0x7721('0x38')](function(_0x2c74d8){if(_0x2c74d8){return _0x2c74d8?{'count':_0xbbc86f,'rows':_0x2c74d8}:null;}})['then'](respondWithResult(_0x1fc5f7,null))[_0x7721('0x2b')](handleError(_0x1fc5f7,null));};exports[_0x7721('0x5e')]=function(_0x39194e,_0x5eec29,_0x94af20){var _0x26b2cc={};var _0x139517={};var _0xc9761e;var _0xcd9f0d;return db['ZendeskConfiguration'][_0x7721('0x5f')]({'where':{'id':_0x39194e[_0x7721('0x59')]['id']}})[_0x7721('0x38')](handleEntityNotFound(_0x5eec29,null))[_0x7721('0x38')](function(_0x30326d){if(_0x30326d){_0xc9761e=_0x30326d;_0x139517[_0x7721('0x3f')]=_['keys'](db[_0x7721('0x5b')][_0x7721('0x51')]);_0x139517['query']=_[_0x7721('0x52')](_0x39194e['query']);_0x139517[_0x7721('0x41')]=_[_0x7721('0x53')](_0x139517['model'],_0x139517[_0x7721('0x40')]);_0x26b2cc['attributes']=_['intersection'](_0x139517['model'],qs[_0x7721('0x42')](_0x39194e[_0x7721('0x40')][_0x7721('0x42')]));_0x26b2cc['attributes']=_0x26b2cc['attributes']['length']?_0x26b2cc[_0x7721('0x43')]:_0x139517[_0x7721('0x3f')];_0x26b2cc[_0x7721('0x46')]=qs[_0x7721('0x47')](_0x39194e[_0x7721('0x40')][_0x7721('0x47')]);_0x26b2cc['where']=qs[_0x7721('0x41')](_[_0x7721('0x49')](_0x39194e[_0x7721('0x40')],_0x139517[_0x7721('0x41')]));if(_0x39194e[_0x7721('0x40')][_0x7721('0x4c')]){_0x26b2cc[_0x7721('0x48')]=_[_0x7721('0x4a')](_0x26b2cc[_0x7721('0x48')],{'$or':_[_0x7721('0x3c')](_0x26b2cc[_0x7721('0x43')],function(_0x368dbb){var _0x58429d={};_0x58429d[_0x368dbb]={'$like':'%'+_0x39194e['query'][_0x7721('0x4c')]+'%'};return _0x58429d;})});}_0x26b2cc=_[_0x7721('0x4a')]({},_0x26b2cc,_0x39194e['options']);return _0xc9761e[_0x7721('0x5e')](_0x26b2cc);}})['then'](function(_0x4e3c93){if(_0x4e3c93){_0xcd9f0d=_0x4e3c93[_0x7721('0x44')];if(!_0x39194e['query']['hasOwnProperty'](_0x7721('0x45'))){_0x26b2cc[_0x7721('0x31')]=qs[_0x7721('0x31')](_0x39194e[_0x7721('0x40')][_0x7721('0x31')]);_0x26b2cc['offset']=qs[_0x7721('0x30')](_0x39194e[_0x7721('0x40')][_0x7721('0x30')]);}return _0xc9761e[_0x7721('0x5e')](_0x26b2cc);}})['then'](function(_0x52fcc1){if(_0x52fcc1){return _0x52fcc1?{'count':_0xcd9f0d,'rows':_0x52fcc1}:null;}})[_0x7721('0x38')](respondWithResult(_0x5eec29,null))[_0x7721('0x2b')](handleError(_0x5eec29,null));};exports['getTags']=function(_0x2005d1,_0x13dc8a,_0x58f7b1){var _0x5b76e3={};var _0x2dbb6d={};var _0x1b68a7;var _0x606b4b;return db[_0x7721('0x4d')][_0x7721('0x5f')]({'where':{'id':_0x2005d1[_0x7721('0x59')]['id']}})[_0x7721('0x38')](handleEntityNotFound(_0x13dc8a,null))[_0x7721('0x38')](function(_0x59de30){if(_0x59de30){_0x1b68a7=_0x59de30;_0x2dbb6d[_0x7721('0x3f')]=_[_0x7721('0x52')](db[_0x7721('0x60')][_0x7721('0x51')]);_0x2dbb6d[_0x7721('0x40')]=_[_0x7721('0x52')](_0x2005d1[_0x7721('0x40')]);_0x2dbb6d['filters']=_[_0x7721('0x53')](_0x2dbb6d[_0x7721('0x3f')],_0x2dbb6d['query']);_0x5b76e3[_0x7721('0x43')]=_[_0x7721('0x53')](_0x2dbb6d[_0x7721('0x3f')],qs[_0x7721('0x42')](_0x2005d1[_0x7721('0x40')][_0x7721('0x42')]));_0x5b76e3[_0x7721('0x43')]=_0x5b76e3[_0x7721('0x43')][_0x7721('0x44')]?_0x5b76e3[_0x7721('0x43')]:_0x2dbb6d['model'];_0x5b76e3[_0x7721('0x46')]=qs[_0x7721('0x47')](_0x2005d1[_0x7721('0x40')][_0x7721('0x47')]);_0x5b76e3[_0x7721('0x48')]=qs[_0x7721('0x41')](_[_0x7721('0x49')](_0x2005d1[_0x7721('0x40')],_0x2dbb6d[_0x7721('0x41')]));if(_0x2005d1[_0x7721('0x40')][_0x7721('0x4c')]){_0x5b76e3[_0x7721('0x48')]=_[_0x7721('0x4a')](_0x5b76e3[_0x7721('0x48')],{'$or':_[_0x7721('0x3c')](_0x5b76e3[_0x7721('0x43')],function(_0xea9824){var _0x1fb651={};_0x1fb651[_0xea9824]={'$like':'%'+_0x2005d1[_0x7721('0x40')][_0x7721('0x4c')]+'%'};return _0x1fb651;})});}_0x5b76e3=_['merge']({},_0x5b76e3,_0x2005d1[_0x7721('0x55')]);return _0x1b68a7['getTags'](_0x5b76e3);}})[_0x7721('0x38')](function(_0x2af5f5){if(_0x2af5f5){_0x606b4b=_0x2af5f5[_0x7721('0x44')];if(!_0x2005d1[_0x7721('0x40')][_0x7721('0x5d')]('nolimit')){_0x5b76e3['limit']=qs['limit'](_0x2005d1['query'][_0x7721('0x31')]);_0x5b76e3[_0x7721('0x30')]=qs[_0x7721('0x30')](_0x2005d1[_0x7721('0x40')][_0x7721('0x30')]);}return _0x1b68a7['getTags'](_0x5b76e3);}})[_0x7721('0x38')](function(_0x501a11){if(_0x501a11){return _0x501a11?{'count':_0x606b4b,'rows':_0x501a11}:null;}})[_0x7721('0x38')](respondWithResult(_0x13dc8a,null))[_0x7721('0x2b')](handleError(_0x13dc8a,null));};exports[_0x7721('0x61')]=function(_0x11d5a7,_0xf061eb,_0x2b0c22){if(_0x11d5a7['body']['id']){delete _0x11d5a7[_0x7721('0x58')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x11d5a7[_0x7721('0x59')]['id']}})[_0x7721('0x38')](handleEntityNotFound(_0xf061eb,null))[_0x7721('0x38')](function(_0x357b78){if(_0x357b78){return _0x357b78[_0x7721('0x61')](_0x11d5a7['body'][_0x7721('0x62')]||[]);}return null;})[_0x7721('0x38')](respondWithResult(_0xf061eb,null))[_0x7721('0x2b')](handleError(_0xf061eb,null));}; \ No newline at end of file +var _0x5fc3=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','http','test','Sequelize','request','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','ZendeskConfiguration','includeAll','findAll','params','include','find','create','body','getFields','findOne','rawAttributes','pick','getSubjects','ZendeskField','getDescriptions','Tag','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x26668a,_0x3f175c){var _0x5846f6=function(_0x2c5372){while(--_0x2c5372){_0x26668a['push'](_0x26668a['shift']());}};_0x5846f6(++_0x3f175c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0x5fc3[_0x256e32];return _0x464070;};'use strict';var pdf=require(_0x35fc('0x0'));var emlformat=require(_0x35fc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35fc('0x2'));var jsonpatch=require(_0x35fc('0x3'));var rp=require(_0x35fc('0x4'));var moment=require(_0x35fc('0x5'));var BPromise=require(_0x35fc('0x6'));var Mustache=require('mustache');var util=require(_0x35fc('0x7'));var path=require(_0x35fc('0x8'));var sox=require(_0x35fc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0xe'));var querystring=require(_0x35fc('0xf'));var Papa=require(_0x35fc('0x10'));var Redis=require(_0x35fc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x12'));var as=require(_0x35fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x14'))(_0x35fc('0x15'));var utils=require('../../config/utils');var config=require(_0x35fc('0x16'));var db=require(_0x35fc('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x35fc('0x18')]({'port':0x232a});function checkPasswordPattern(_0x5d462a,_0x397738,_0x22055e){if(_0x22055e){var _0x2a6ad2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a6ad2[_0x35fc('0x19')](_0x397738)){return _0x5d462a;}else{throw new db[(_0x35fc('0x1a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5d462a;}}function respondWithRpcPromise(_0x5eac0f,_0x558364,_0x398b67,_0x229d56){return new BPromise(function(_0x53b898,_0x154958){var _0x227a49=_0x229d56||client;return _0x227a49[_0x35fc('0x1b')](_0x5eac0f,_0x398b67)['then'](function(_0x26ba54){logger[_0x35fc('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s',_0x558364,_0x35fc('0x1d'));logger[_0x35fc('0x1e')](_0x35fc('0x1f'),_0x558364,'request\x20sent',JSON[_0x35fc('0x20')](_0x26ba54));if(_0x26ba54[_0x35fc('0x21')]){if(_0x26ba54[_0x35fc('0x21')]['code']===0x1f4){logger[_0x35fc('0x21')](_0x35fc('0x22'),_0x558364,_0x26ba54[_0x35fc('0x21')][_0x35fc('0x23')]);return _0x154958(_0x26ba54[_0x35fc('0x21')][_0x35fc('0x23')]);}logger[_0x35fc('0x21')](_0x35fc('0x22'),_0x558364,_0x26ba54[_0x35fc('0x21')][_0x35fc('0x23')]);return _0x53b898(_0x26ba54['error'][_0x35fc('0x23')]);}else{logger[_0x35fc('0x1c')](_0x35fc('0x22'),_0x558364,_0x35fc('0x1d'));_0x53b898(_0x26ba54[_0x35fc('0x24')]['message']);}})[_0x35fc('0x25')](function(_0x4c587a){logger['error'](_0x35fc('0x22'),_0x558364,_0x4c587a);_0x154958(_0x4c587a);});});}function respondWithStatusCode(_0x5a93df,_0x3d4a98){_0x3d4a98=_0x3d4a98||0xcc;return function(_0x51cfec){if(_0x51cfec){return _0x5a93df[_0x35fc('0x26')](_0x3d4a98);}return _0x5a93df['status'](_0x3d4a98)[_0x35fc('0x27')]();};}function respondWithResult(_0xdfab9f,_0x5cb986){_0x5cb986=_0x5cb986||0xc8;return function(_0x519264){if(_0x519264){return _0xdfab9f[_0x35fc('0x28')](_0x5cb986)['json'](_0x519264);}};}function respondWithFilteredResult(_0x274208,_0x1a5d92){return function(_0x57001c){if(_0x57001c){var _0x26b7cb=_0x57001c[_0x35fc('0x29')],_0x645eac=_0x1a5d92[_0x35fc('0x2a')],_0x383837=_0x1a5d92[_0x35fc('0x2a')]+_0x1a5d92[_0x35fc('0x2b')],_0x9f3c8a;if(_0x383837>=_0x26b7cb){_0x383837=_0x26b7cb;_0x9f3c8a=0xc8;}else{_0x9f3c8a=0xce;}_0x274208['status'](_0x9f3c8a);return _0x274208[_0x35fc('0x2c')](_0x35fc('0x2d'),_0x645eac+'-'+_0x383837+'/'+_0x26b7cb)[_0x35fc('0x2e')](_0x57001c);}return null;};}function patchUpdates(_0x52acc5){return function(_0xe79f52){try{jsonpatch[_0x35fc('0x2f')](_0xe79f52,_0x52acc5,!![]);}catch(_0x3822a8){return BPromise[_0x35fc('0x30')](_0x3822a8);}return _0xe79f52[_0x35fc('0x31')]();};}function saveUpdates(_0x103181,_0x222ddb){return function(_0x37b435){if(_0x37b435){return _0x37b435[_0x35fc('0x32')](_0x103181)[_0x35fc('0x33')](function(_0x57072d){return _0x57072d;});}return null;};}function removeEntity(_0x5e0313,_0x114bc1){return function(_0x4af5fe){if(_0x4af5fe){return _0x4af5fe[_0x35fc('0x34')]()[_0x35fc('0x33')](function(){_0x5e0313[_0x35fc('0x28')](0xcc)[_0x35fc('0x27')]();});}};}function handleEntityNotFound(_0x271ba9,_0x12e78f){return function(_0x4e43b4){if(!_0x4e43b4){_0x271ba9[_0x35fc('0x26')](0x194);}return _0x4e43b4;};}function handleError(_0x330a14,_0x46b9ef){_0x46b9ef=_0x46b9ef||0x1f4;return function(_0x4441d8){logger[_0x35fc('0x21')](_0x4441d8[_0x35fc('0x35')]);if(_0x4441d8['name']){delete _0x4441d8[_0x35fc('0x36')];}_0x330a14[_0x35fc('0x28')](_0x46b9ef)[_0x35fc('0x37')](_0x4441d8);};}exports['index']=function(_0x2c657d,_0x48d223){var _0x2ecb2e={},_0x33a377={},_0x266a11={'count':0x0,'rows':[]};var _0x2e00e3=_['map'](db['ZendeskConfiguration']['rawAttributes'],function(_0x20f5fe){return{'name':_0x20f5fe['fieldName'],'type':_0x20f5fe[_0x35fc('0x38')]['key']};});_0x33a377[_0x35fc('0x39')]=_[_0x35fc('0x3a')](_0x2e00e3,_0x35fc('0x36'));_0x33a377[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x2c657d[_0x35fc('0x3b')]);_0x33a377[_0x35fc('0x3d')]=_['intersection'](_0x33a377[_0x35fc('0x39')],_0x33a377[_0x35fc('0x3b')]);_0x2ecb2e['attributes']=_[_0x35fc('0x3e')](_0x33a377[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x2c657d[_0x35fc('0x3b')][_0x35fc('0x3f')]));_0x2ecb2e[_0x35fc('0x40')]=_0x2ecb2e['attributes'][_0x35fc('0x41')]?_0x2ecb2e[_0x35fc('0x40')]:_0x33a377[_0x35fc('0x39')];if(!_0x2c657d['query'][_0x35fc('0x42')](_0x35fc('0x43'))){_0x2ecb2e['limit']=qs[_0x35fc('0x2b')](_0x2c657d[_0x35fc('0x3b')][_0x35fc('0x2b')]);_0x2ecb2e[_0x35fc('0x2a')]=qs[_0x35fc('0x2a')](_0x2c657d[_0x35fc('0x3b')][_0x35fc('0x2a')]);}_0x2ecb2e[_0x35fc('0x44')]=qs['sort'](_0x2c657d['query'][_0x35fc('0x45')]);_0x2ecb2e[_0x35fc('0x46')]=qs['filters'](_['pick'](_0x2c657d['query'],_0x33a377[_0x35fc('0x3d')]));if(_0x2c657d[_0x35fc('0x3b')]['filter']){_0x2ecb2e[_0x35fc('0x46')]=_[_0x35fc('0x47')](_0x2ecb2e[_0x35fc('0x46')],{'$or':_[_0x35fc('0x3a')](_0x2e00e3,function(_0x5c52be){if(_0x5c52be['type']!=='VIRTUAL'){var _0x539157={};_0x539157[_0x5c52be['name']]={'$like':'%'+_0x2c657d[_0x35fc('0x3b')][_0x35fc('0x48')]+'%'};return _0x539157;}})});}_0x2ecb2e=_['merge']({},_0x2ecb2e,_0x2c657d[_0x35fc('0x49')]);var _0x56cf1f={'where':_0x2ecb2e[_0x35fc('0x46')]};return db[_0x35fc('0x4a')][_0x35fc('0x29')](_0x56cf1f)[_0x35fc('0x33')](function(_0x16f7c8){_0x266a11['count']=_0x16f7c8;if(_0x2c657d[_0x35fc('0x3b')][_0x35fc('0x4b')]){_0x2ecb2e['include']=[{'all':!![]}];}return db[_0x35fc('0x4a')][_0x35fc('0x4c')](_0x2ecb2e);})[_0x35fc('0x33')](function(_0x211746){_0x266a11['rows']=_0x211746;return _0x266a11;})[_0x35fc('0x33')](respondWithFilteredResult(_0x48d223,_0x2ecb2e))['catch'](handleError(_0x48d223,null));};exports['show']=function(_0x1b6160,_0x9db7e8){var _0x18dc78={'raw':![],'where':{'id':_0x1b6160[_0x35fc('0x4d')]['id']}},_0xca8aef={};_0xca8aef[_0x35fc('0x39')]=_[_0x35fc('0x3c')](db[_0x35fc('0x4a')]['rawAttributes']);_0xca8aef[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x1b6160[_0x35fc('0x3b')]);_0xca8aef[_0x35fc('0x3d')]=_[_0x35fc('0x3e')](_0xca8aef[_0x35fc('0x39')],_0xca8aef[_0x35fc('0x3b')]);_0x18dc78[_0x35fc('0x40')]=_[_0x35fc('0x3e')](_0xca8aef[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x1b6160[_0x35fc('0x3b')][_0x35fc('0x3f')]));_0x18dc78[_0x35fc('0x40')]=_0x18dc78['attributes']['length']?_0x18dc78[_0x35fc('0x40')]:_0xca8aef[_0x35fc('0x39')];if(_0x1b6160[_0x35fc('0x3b')][_0x35fc('0x4b')]){_0x18dc78[_0x35fc('0x4e')]=[{'all':!![]}];}_0x18dc78=_[_0x35fc('0x47')]({},_0x18dc78,_0x1b6160['options']);return db['ZendeskConfiguration'][_0x35fc('0x4f')](_0x18dc78)[_0x35fc('0x33')](handleEntityNotFound(_0x9db7e8,null))[_0x35fc('0x33')](respondWithResult(_0x9db7e8,null))[_0x35fc('0x25')](handleError(_0x9db7e8,null));};exports['create']=function(_0x467980,_0x13281f){return db['ZendeskConfiguration'][_0x35fc('0x50')](_0x467980[_0x35fc('0x51')],{})['then'](respondWithResult(_0x13281f,0xc9))[_0x35fc('0x25')](handleError(_0x13281f,null));};exports[_0x35fc('0x32')]=function(_0x26118e,_0x18f18b){if(_0x26118e['body']['id']){delete _0x26118e['body']['id'];}return db['ZendeskConfiguration'][_0x35fc('0x4f')]({'where':{'id':_0x26118e[_0x35fc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x18f18b,null))[_0x35fc('0x33')](saveUpdates(_0x26118e[_0x35fc('0x51')],null))[_0x35fc('0x33')](respondWithResult(_0x18f18b,null))[_0x35fc('0x25')](handleError(_0x18f18b,null));};exports[_0x35fc('0x34')]=function(_0x538be0,_0x2d9d45){return db[_0x35fc('0x4a')][_0x35fc('0x4f')]({'where':{'id':_0x538be0['params']['id']}})[_0x35fc('0x33')](handleEntityNotFound(_0x2d9d45,null))[_0x35fc('0x33')](removeEntity(_0x2d9d45,null))['catch'](handleError(_0x2d9d45,null));};exports[_0x35fc('0x52')]=function(_0x164c7b,_0x1c46b1,_0x1c4c33){var _0x314666={};var _0x41453b={};var _0x8501d1;var _0x998fd9;return db['ZendeskConfiguration'][_0x35fc('0x53')]({'where':{'id':_0x164c7b[_0x35fc('0x4d')]['id']}})[_0x35fc('0x33')](handleEntityNotFound(_0x1c46b1,null))['then'](function(_0x243871){if(_0x243871){_0x8501d1=_0x243871;_0x41453b['model']=_['keys'](db['ZendeskField'][_0x35fc('0x54')]);_0x41453b[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x164c7b[_0x35fc('0x3b')]);_0x41453b[_0x35fc('0x3d')]=_['intersection'](_0x41453b['model'],_0x41453b['query']);_0x314666['attributes']=_['intersection'](_0x41453b[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x164c7b[_0x35fc('0x3b')][_0x35fc('0x3f')]));_0x314666['attributes']=_0x314666[_0x35fc('0x40')][_0x35fc('0x41')]?_0x314666[_0x35fc('0x40')]:_0x41453b[_0x35fc('0x39')];_0x314666[_0x35fc('0x44')]=qs[_0x35fc('0x45')](_0x164c7b[_0x35fc('0x3b')][_0x35fc('0x45')]);_0x314666[_0x35fc('0x46')]=qs['filters'](_[_0x35fc('0x55')](_0x164c7b['query'],_0x41453b[_0x35fc('0x3d')]));if(_0x164c7b[_0x35fc('0x3b')][_0x35fc('0x48')]){_0x314666[_0x35fc('0x46')]=_['merge'](_0x314666[_0x35fc('0x46')],{'$or':_['map'](_0x314666['attributes'],function(_0x5f1d4a){var _0x10dd1a={};_0x10dd1a[_0x5f1d4a]={'$like':'%'+_0x164c7b['query'][_0x35fc('0x48')]+'%'};return _0x10dd1a;})});}_0x314666=_['merge']({},_0x314666,_0x164c7b[_0x35fc('0x49')]);return _0x8501d1['getFields'](_0x314666);}})[_0x35fc('0x33')](function(_0x455b84){if(_0x455b84){_0x998fd9=_0x455b84[_0x35fc('0x41')];if(!_0x164c7b[_0x35fc('0x3b')]['hasOwnProperty'](_0x35fc('0x43'))){_0x314666[_0x35fc('0x2b')]=qs[_0x35fc('0x2b')](_0x164c7b['query'][_0x35fc('0x2b')]);_0x314666[_0x35fc('0x2a')]=qs[_0x35fc('0x2a')](_0x164c7b[_0x35fc('0x3b')][_0x35fc('0x2a')]);}return _0x8501d1[_0x35fc('0x52')](_0x314666);}})[_0x35fc('0x33')](function(_0x4464d5){if(_0x4464d5){return _0x4464d5?{'count':_0x998fd9,'rows':_0x4464d5}:null;}})['then'](respondWithResult(_0x1c46b1,null))[_0x35fc('0x25')](handleError(_0x1c46b1,null));};exports[_0x35fc('0x56')]=function(_0x2600d2,_0x4a926d,_0x1c88d8){var _0x1b76f0={};var _0x586729={};var _0x4d09d4;var _0x3969d3;return db['ZendeskConfiguration'][_0x35fc('0x53')]({'where':{'id':_0x2600d2[_0x35fc('0x4d')]['id']}})[_0x35fc('0x33')](handleEntityNotFound(_0x4a926d,null))[_0x35fc('0x33')](function(_0x1932c9){if(_0x1932c9){_0x4d09d4=_0x1932c9;_0x586729[_0x35fc('0x39')]=_[_0x35fc('0x3c')](db[_0x35fc('0x57')][_0x35fc('0x54')]);_0x586729[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x2600d2[_0x35fc('0x3b')]);_0x586729[_0x35fc('0x3d')]=_[_0x35fc('0x3e')](_0x586729[_0x35fc('0x39')],_0x586729[_0x35fc('0x3b')]);_0x1b76f0[_0x35fc('0x40')]=_[_0x35fc('0x3e')](_0x586729[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x2600d2['query'][_0x35fc('0x3f')]));_0x1b76f0['attributes']=_0x1b76f0[_0x35fc('0x40')][_0x35fc('0x41')]?_0x1b76f0[_0x35fc('0x40')]:_0x586729[_0x35fc('0x39')];_0x1b76f0[_0x35fc('0x44')]=qs[_0x35fc('0x45')](_0x2600d2[_0x35fc('0x3b')][_0x35fc('0x45')]);_0x1b76f0[_0x35fc('0x46')]=qs[_0x35fc('0x3d')](_[_0x35fc('0x55')](_0x2600d2['query'],_0x586729[_0x35fc('0x3d')]));if(_0x2600d2[_0x35fc('0x3b')][_0x35fc('0x48')]){_0x1b76f0[_0x35fc('0x46')]=_[_0x35fc('0x47')](_0x1b76f0[_0x35fc('0x46')],{'$or':_['map'](_0x1b76f0[_0x35fc('0x40')],function(_0x3353e0){var _0x277514={};_0x277514[_0x3353e0]={'$like':'%'+_0x2600d2[_0x35fc('0x3b')][_0x35fc('0x48')]+'%'};return _0x277514;})});}_0x1b76f0=_[_0x35fc('0x47')]({},_0x1b76f0,_0x2600d2[_0x35fc('0x49')]);return _0x4d09d4[_0x35fc('0x56')](_0x1b76f0);}})[_0x35fc('0x33')](function(_0x5f23d8){if(_0x5f23d8){_0x3969d3=_0x5f23d8[_0x35fc('0x41')];if(!_0x2600d2['query'][_0x35fc('0x42')](_0x35fc('0x43'))){_0x1b76f0['limit']=qs[_0x35fc('0x2b')](_0x2600d2[_0x35fc('0x3b')][_0x35fc('0x2b')]);_0x1b76f0[_0x35fc('0x2a')]=qs[_0x35fc('0x2a')](_0x2600d2[_0x35fc('0x3b')][_0x35fc('0x2a')]);}return _0x4d09d4[_0x35fc('0x56')](_0x1b76f0);}})[_0x35fc('0x33')](function(_0x5806bf){if(_0x5806bf){return _0x5806bf?{'count':_0x3969d3,'rows':_0x5806bf}:null;}})['then'](respondWithResult(_0x4a926d,null))['catch'](handleError(_0x4a926d,null));};exports['getDescriptions']=function(_0x160a6f,_0x23cf84,_0x8fc410){var _0x1f5cbc={};var _0x35ef53={};var _0x4f535a;var _0x226fdf;return db[_0x35fc('0x4a')][_0x35fc('0x53')]({'where':{'id':_0x160a6f[_0x35fc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x23cf84,null))[_0x35fc('0x33')](function(_0x3ddd21){if(_0x3ddd21){_0x4f535a=_0x3ddd21;_0x35ef53[_0x35fc('0x39')]=_['keys'](db[_0x35fc('0x57')][_0x35fc('0x54')]);_0x35ef53[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x160a6f[_0x35fc('0x3b')]);_0x35ef53[_0x35fc('0x3d')]=_[_0x35fc('0x3e')](_0x35ef53[_0x35fc('0x39')],_0x35ef53['query']);_0x1f5cbc[_0x35fc('0x40')]=_[_0x35fc('0x3e')](_0x35ef53[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x160a6f[_0x35fc('0x3b')][_0x35fc('0x3f')]));_0x1f5cbc['attributes']=_0x1f5cbc[_0x35fc('0x40')]['length']?_0x1f5cbc['attributes']:_0x35ef53[_0x35fc('0x39')];_0x1f5cbc['order']=qs[_0x35fc('0x45')](_0x160a6f[_0x35fc('0x3b')][_0x35fc('0x45')]);_0x1f5cbc['where']=qs[_0x35fc('0x3d')](_[_0x35fc('0x55')](_0x160a6f[_0x35fc('0x3b')],_0x35ef53[_0x35fc('0x3d')]));if(_0x160a6f[_0x35fc('0x3b')]['filter']){_0x1f5cbc['where']=_['merge'](_0x1f5cbc[_0x35fc('0x46')],{'$or':_['map'](_0x1f5cbc[_0x35fc('0x40')],function(_0x1824c2){var _0x391321={};_0x391321[_0x1824c2]={'$like':'%'+_0x160a6f[_0x35fc('0x3b')]['filter']+'%'};return _0x391321;})});}_0x1f5cbc=_[_0x35fc('0x47')]({},_0x1f5cbc,_0x160a6f[_0x35fc('0x49')]);return _0x4f535a[_0x35fc('0x58')](_0x1f5cbc);}})['then'](function(_0x128286){if(_0x128286){_0x226fdf=_0x128286[_0x35fc('0x41')];if(!_0x160a6f[_0x35fc('0x3b')]['hasOwnProperty']('nolimit')){_0x1f5cbc['limit']=qs[_0x35fc('0x2b')](_0x160a6f[_0x35fc('0x3b')][_0x35fc('0x2b')]);_0x1f5cbc[_0x35fc('0x2a')]=qs['offset'](_0x160a6f[_0x35fc('0x3b')][_0x35fc('0x2a')]);}return _0x4f535a['getDescriptions'](_0x1f5cbc);}})['then'](function(_0x143c94){if(_0x143c94){return _0x143c94?{'count':_0x226fdf,'rows':_0x143c94}:null;}})[_0x35fc('0x33')](respondWithResult(_0x23cf84,null))[_0x35fc('0x25')](handleError(_0x23cf84,null));};exports['getTags']=function(_0x4dd05f,_0x134e60,_0x432ba4){var _0x4d5204={};var _0x3439de={};var _0x163edb;var _0x1d96c9;return db['ZendeskConfiguration'][_0x35fc('0x53')]({'where':{'id':_0x4dd05f[_0x35fc('0x4d')]['id']}})[_0x35fc('0x33')](handleEntityNotFound(_0x134e60,null))[_0x35fc('0x33')](function(_0x4fd676){if(_0x4fd676){_0x163edb=_0x4fd676;_0x3439de[_0x35fc('0x39')]=_[_0x35fc('0x3c')](db[_0x35fc('0x59')]['rawAttributes']);_0x3439de[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x4dd05f[_0x35fc('0x3b')]);_0x3439de['filters']=_[_0x35fc('0x3e')](_0x3439de[_0x35fc('0x39')],_0x3439de['query']);_0x4d5204[_0x35fc('0x40')]=_[_0x35fc('0x3e')](_0x3439de[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x3f')]));_0x4d5204[_0x35fc('0x40')]=_0x4d5204[_0x35fc('0x40')][_0x35fc('0x41')]?_0x4d5204['attributes']:_0x3439de[_0x35fc('0x39')];_0x4d5204[_0x35fc('0x44')]=qs[_0x35fc('0x45')](_0x4dd05f[_0x35fc('0x3b')]['sort']);_0x4d5204[_0x35fc('0x46')]=qs[_0x35fc('0x3d')](_[_0x35fc('0x55')](_0x4dd05f[_0x35fc('0x3b')],_0x3439de[_0x35fc('0x3d')]));if(_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x48')]){_0x4d5204[_0x35fc('0x46')]=_['merge'](_0x4d5204['where'],{'$or':_[_0x35fc('0x3a')](_0x4d5204[_0x35fc('0x40')],function(_0x961ee9){var _0x4ebf4a={};_0x4ebf4a[_0x961ee9]={'$like':'%'+_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x48')]+'%'};return _0x4ebf4a;})});}_0x4d5204=_[_0x35fc('0x47')]({},_0x4d5204,_0x4dd05f[_0x35fc('0x49')]);return _0x163edb['getTags'](_0x4d5204);}})['then'](function(_0x379650){if(_0x379650){_0x1d96c9=_0x379650['length'];if(!_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x42')]('nolimit')){_0x4d5204['limit']=qs[_0x35fc('0x2b')](_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x2b')]);_0x4d5204['offset']=qs[_0x35fc('0x2a')](_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x2a')]);}return _0x163edb['getTags'](_0x4d5204);}})[_0x35fc('0x33')](function(_0x32cbd){if(_0x32cbd){return _0x32cbd?{'count':_0x1d96c9,'rows':_0x32cbd}:null;}})[_0x35fc('0x33')](respondWithResult(_0x134e60,null))[_0x35fc('0x25')](handleError(_0x134e60,null));};exports['setTags']=function(_0x451cb8,_0x347e06,_0x6f8054){if(_0x451cb8[_0x35fc('0x51')]['id']){delete _0x451cb8[_0x35fc('0x51')]['id'];}return db[_0x35fc('0x4a')]['findOne']({'where':{'id':_0x451cb8[_0x35fc('0x4d')]['id']}})[_0x35fc('0x33')](handleEntityNotFound(_0x347e06,null))['then'](function(_0x4c3253){if(_0x4c3253){return _0x4c3253[_0x35fc('0x5a')](_0x451cb8['body'][_0x35fc('0x5b')]||[]);}return null;})[_0x35fc('0x33')](respondWithResult(_0x347e06,null))[_0x35fc('0x25')](handleError(_0x347e06,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 6c55d2a..1a059b6 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 _0x94e8=['ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','exports','define'];(function(_0x6173fc,_0x32aadf){var _0x965fbe=function(_0x50d5b3){while(--_0x50d5b3){_0x6173fc['push'](_0x6173fc['shift']());}};_0x965fbe(++_0x32aadf);}(_0x94e8,0x1e2));var _0x894e=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0x94e8[_0x255ac0];return _0x437bf1;};'use strict';var _=require('lodash');var util=require(_0x894e('0x0'));var logger=require(_0x894e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x894e('0x2'));var rp=require(_0x894e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x894e('0x4'));var attributes=require(_0x894e('0x5'));module[_0x894e('0x6')]=function(_0xc0050e,_0x36f28b){return _0xc0050e[_0x894e('0x7')](_0x894e('0x8'),attributes,{'tableName':_0x894e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4ae=['api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger'];(function(_0x1526a9,_0x48fb64){var _0x9f4049=function(_0x13271a){while(--_0x13271a){_0x1526a9['push'](_0x1526a9['shift']());}};_0x9f4049(++_0x48fb64);}(_0xd4ae,0x8e));var _0xed4a=function(_0x87dd0e,_0x390eec){_0x87dd0e=_0x87dd0e-0x0;var _0x3f6891=_0xd4ae[_0x87dd0e];return _0x3f6891;};'use strict';var _=require(_0xed4a('0x0'));var util=require('util');var logger=require(_0xed4a('0x1'))(_0xed4a('0x2'));var moment=require(_0xed4a('0x3'));var BPromise=require('bluebird');var rp=require(_0xed4a('0x4'));var fs=require('fs');var path=require(_0xed4a('0x5'));var rimraf=require(_0xed4a('0x6'));var config=require(_0xed4a('0x7'));var attributes=require(_0xed4a('0x8'));module['exports']=function(_0x49647d,_0x1148f8){return _0x49647d[_0xed4a('0x9')](_0xed4a('0xa'),attributes,{'tableName':_0xed4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 79021e5..c1ecff4 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 _0x7a31=['moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util'];(function(_0xfa1429,_0x37a7f3){var _0x8e3c16=function(_0x572de7){while(--_0x572de7){_0xfa1429['push'](_0xfa1429['shift']());}};_0x8e3c16(++_0x37a7f3);}(_0x7a31,0xd7));var _0x17a3=function(_0x5db7a6,_0x55ec8e){_0x5db7a6=_0x5db7a6-0x0;var _0x50a87d=_0x7a31[_0x5db7a6];return _0x50a87d;};'use strict';var _=require('lodash');var util=require(_0x17a3('0x0'));var moment=require(_0x17a3('0x1'));var BPromise=require('bluebird');var rs=require(_0x17a3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x17a3('0x3'));var logger=require(_0x17a3('0x4'))(_0x17a3('0x5'));var config=require(_0x17a3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x17a3('0x7')][_0x17a3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfb6bd1,_0x289e20,_0x335925){return new BPromise(function(_0x472c12,_0x415920){return client['request'](_0xfb6bd1,_0x335925)[_0x17a3('0x9')](function(_0x22ac2f){logger[_0x17a3('0xa')](_0x17a3('0xb'),_0x289e20,_0x17a3('0xc'));logger[_0x17a3('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x289e20,_0x17a3('0xc'),JSON[_0x17a3('0xe')](_0x22ac2f));if(_0x22ac2f[_0x17a3('0xf')]){if(_0x22ac2f[_0x17a3('0xf')]['code']===0x1f4){logger['error'](_0x17a3('0xb'),_0x289e20,_0x22ac2f['error']['message']);return _0x415920(_0x22ac2f['error']['message']);}logger[_0x17a3('0xf')](_0x17a3('0xb'),_0x289e20,_0x22ac2f[_0x17a3('0xf')]['message']);return _0x472c12(_0x22ac2f[_0x17a3('0xf')][_0x17a3('0x10')]);}else{logger[_0x17a3('0xa')](_0x17a3('0xb'),_0x289e20,_0x17a3('0xc'));_0x472c12(_0x22ac2f['result'][_0x17a3('0x10')]);}})[_0x17a3('0x11')](function(_0x528a7a){logger[_0x17a3('0xf')](_0x17a3('0xb'),_0x289e20,_0x528a7a);_0x415920(_0x528a7a);});});} \ No newline at end of file +var _0x7e12=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x3cf1ad,_0x5a153d){var _0x481ca3=function(_0x4db9e8){while(--_0x4db9e8){_0x3cf1ad['push'](_0x3cf1ad['shift']());}};_0x481ca3(++_0x5a153d);}(_0x7e12,0x8c));var _0x27e1=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0x7e12[_0x6dd5c];return _0x5a87fa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x27e1('0x0'));var BPromise=require(_0x27e1('0x1'));var rs=require(_0x27e1('0x2'));var fs=require('fs');var Redis=require(_0x27e1('0x3'));var db=require(_0x27e1('0x4'))['db'];var utils=require(_0x27e1('0x5'));var logger=require(_0x27e1('0x6'))(_0x27e1('0x7'));var config=require(_0x27e1('0x8'));var jayson=require(_0x27e1('0x9'));var client=jayson[_0x27e1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45f5d4,_0x5e65b1,_0x5b32e4){return new BPromise(function(_0x343dca,_0x2e88b4){return client[_0x27e1('0xb')](_0x45f5d4,_0x5b32e4)[_0x27e1('0xc')](function(_0x3deebe){logger['info'](_0x27e1('0xd'),_0x5e65b1,_0x27e1('0xe'));logger[_0x27e1('0xf')](_0x27e1('0x10'),_0x5e65b1,_0x27e1('0xe'),JSON[_0x27e1('0x11')](_0x3deebe));if(_0x3deebe[_0x27e1('0x12')]){if(_0x3deebe[_0x27e1('0x12')][_0x27e1('0x13')]===0x1f4){logger['error'](_0x27e1('0xd'),_0x5e65b1,_0x3deebe[_0x27e1('0x12')]['message']);return _0x2e88b4(_0x3deebe[_0x27e1('0x12')]['message']);}logger[_0x27e1('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5e65b1,_0x3deebe[_0x27e1('0x12')][_0x27e1('0x14')]);return _0x343dca(_0x3deebe[_0x27e1('0x12')]['message']);}else{logger[_0x27e1('0x15')](_0x27e1('0xd'),_0x5e65b1,'request\x20sent');_0x343dca(_0x3deebe[_0x27e1('0x16')][_0x27e1('0x14')]);}})[_0x27e1('0x17')](function(_0xb21452){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x5e65b1,_0xb21452);_0x2e88b4(_0xb21452);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 476d769..17acd07 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 _0x2052=['delete','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','post','put','update'];(function(_0x4b5964,_0x33b6e1){var _0x2b1225=function(_0x7292b0){while(--_0x7292b0){_0x4b5964['push'](_0x4b5964['shift']());}};_0x2b1225(++_0x33b6e1);}(_0x2052,0x7a));var _0x2205=function(_0x1ef488,_0x1eb243){_0x1ef488=_0x1ef488-0x0;var _0x5d792c=_0x2052[_0x1ef488];return _0x5d792c;};'use strict';var multer=require('multer');var util=require(_0x2205('0x0'));var path=require('path');var timeout=require(_0x2205('0x1'));var express=require(_0x2205('0x2'));var router=express['Router']();var auth=require(_0x2205('0x3'));var interaction=require(_0x2205('0x4'));var config=require(_0x2205('0x5'));var controller=require(_0x2205('0x6'));router[_0x2205('0x7')]('/',auth[_0x2205('0x8')](),controller[_0x2205('0x9')]);router[_0x2205('0x7')](_0x2205('0xa'),auth[_0x2205('0x8')](),controller['show']);router[_0x2205('0xb')]('/',auth[_0x2205('0x8')](),controller['create']);router[_0x2205('0xc')](_0x2205('0xa'),auth[_0x2205('0x8')](),controller[_0x2205('0xd')]);router[_0x2205('0xe')](_0x2205('0xa'),auth[_0x2205('0x8')](),controller[_0x2205('0xf')]);module[_0x2205('0x10')]=router; \ No newline at end of file +var _0x1dbb=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','isAuthenticated','index','get','/:id','post','create'];(function(_0x101ef9,_0x555296){var _0x5a17a4=function(_0x2414cc){while(--_0x2414cc){_0x101ef9['push'](_0x101ef9['shift']());}};_0x5a17a4(++_0x555296);}(_0x1dbb,0x16a));var _0xb1db=function(_0x14b15d,_0x3a61ac){_0x14b15d=_0x14b15d-0x0;var _0x398c19=_0x1dbb[_0x14b15d];return _0x398c19;};'use strict';var multer=require(_0xb1db('0x0'));var util=require(_0xb1db('0x1'));var path=require(_0xb1db('0x2'));var timeout=require(_0xb1db('0x3'));var express=require(_0xb1db('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb1db('0x5'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0xb1db('0x6')](),controller[_0xb1db('0x7')]);router[_0xb1db('0x8')](_0xb1db('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xb1db('0xa')]('/',auth[_0xb1db('0x6')](),controller[_0xb1db('0xb')]);router[_0xb1db('0xc')](_0xb1db('0x9'),auth['isAuthenticated'](),controller[_0xb1db('0xd')]);router[_0xb1db('0xe')](_0xb1db('0x9'),auth[_0xb1db('0x6')](),controller[_0xb1db('0xf')]);module[_0xb1db('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 2440db6..31c2efe 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 _0x8828=['customVariable','keyValue','string','STRING','ENUM','BOOLEAN','sequelize','exports','variable'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8828,0x1d1));var _0x8882=function(_0x2b1586,_0xd0bcd9){_0x2b1586=_0x2b1586-0x0;var _0xdc89a9=_0x8828[_0x2b1586];return _0xdc89a9;};'use strict';var Sequelize=require(_0x8882('0x0'));module[_0x8882('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x8882('0x2'),_0x8882('0x3'),_0x8882('0x4')),'defaultValue':_0x8882('0x5')},'content':{'type':Sequelize[_0x8882('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8882('0x7')](_0x8882('0x5'),'variable',_0x8882('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8882('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8882('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1d01=['exports','ENUM','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0x57c75f,_0xe7f71c){var _0x3199fe=function(_0x323a00){while(--_0x323a00){_0x57c75f['push'](_0x57c75f['shift']());}};_0x3199fe(++_0xe7f71c);}(_0x1d01,0xb7));var _0x11d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d01[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x11d0('0x0'));module[_0x11d0('0x1')]={'type':{'type':Sequelize[_0x11d0('0x2')](_0x11d0('0x3'),_0x11d0('0x4'),_0x11d0('0x5'),_0x11d0('0x6')),'defaultValue':_0x11d0('0x3')},'content':{'type':Sequelize[_0x11d0('0x7')]},'key':{'type':Sequelize[_0x11d0('0x7')]},'keyType':{'type':Sequelize[_0x11d0('0x2')](_0x11d0('0x3'),_0x11d0('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index dcfbecf..96cdcba 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 _0x3037=['catch','show','params','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x3037,0x1b1));var _0x7303=function(_0x4fa753,_0xc03383){_0x4fa753=_0x4fa753-0x0;var _0x393b79=_0x3037[_0x4fa753];return _0x393b79;};'use strict';var pdf=require(_0x7303('0x0'));var emlformat=require(_0x7303('0x1'));var rimraf=require(_0x7303('0x2'));var zipdir=require(_0x7303('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7303('0x4'));var moment=require(_0x7303('0x5'));var BPromise=require(_0x7303('0x6'));var Mustache=require(_0x7303('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7303('0x8'));var csv=require(_0x7303('0x9'));var ejs=require(_0x7303('0xa'));var fs=require('fs');var _=require(_0x7303('0xb'));var squel=require(_0x7303('0xc'));var crypto=require('crypto');var jsforce=require(_0x7303('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7303('0x9'));var querystring=require(_0x7303('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7303('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7303('0x10'));var hardwareService=require(_0x7303('0x11'));var logger=require(_0x7303('0x12'))(_0x7303('0x13'));var utils=require(_0x7303('0x14'));var config=require('../../config/environment');var db=require(_0x7303('0x15'))['db'];function respondWithStatusCode(_0x2344cb,_0x1f4e90){_0x1f4e90=_0x1f4e90||0xcc;return function(_0x397d9d){if(_0x397d9d){return _0x2344cb[_0x7303('0x16')](_0x1f4e90);}return _0x2344cb[_0x7303('0x17')](_0x1f4e90)[_0x7303('0x18')]();};}function respondWithResult(_0x212e34,_0x2ca6f5){_0x2ca6f5=_0x2ca6f5||0xc8;return function(_0x5a0042){if(_0x5a0042){return _0x212e34[_0x7303('0x17')](_0x2ca6f5)['json'](_0x5a0042);}};}function respondWithFilteredResult(_0xad602e,_0x40d3a1){return function(_0x35aeb9){if(_0x35aeb9){var _0x54391d=_0x35aeb9[_0x7303('0x19')],_0x533dd9=_0x40d3a1[_0x7303('0x1a')],_0x314876=_0x40d3a1[_0x7303('0x1a')]+_0x40d3a1['limit'],_0x118048;if(_0x314876>=_0x54391d){_0x314876=_0x54391d;_0x118048=0xc8;}else{_0x118048=0xce;}_0xad602e[_0x7303('0x17')](_0x118048);return _0xad602e[_0x7303('0x1b')]('Content-Range',_0x533dd9+'-'+_0x314876+'/'+_0x54391d)[_0x7303('0x1c')](_0x35aeb9);}return null;};}function patchUpdates(_0x224e59){return function(_0xfcd1a1){try{jsonpatch[_0x7303('0x1d')](_0xfcd1a1,_0x224e59,!![]);}catch(_0xef99f){return BPromise[_0x7303('0x1e')](_0xef99f);}return _0xfcd1a1[_0x7303('0x1f')]();};}function saveUpdates(_0xc5c832,_0x522ab8){return function(_0x59dc7a){if(_0x59dc7a){return _0x59dc7a[_0x7303('0x20')](_0xc5c832)[_0x7303('0x21')](function(_0x1a2705){return _0x1a2705;});}return null;};}function removeEntity(_0x5d8a04,_0x21c321){return function(_0x26276b){if(_0x26276b){return _0x26276b[_0x7303('0x22')]()['then'](function(){_0x5d8a04[_0x7303('0x17')](0xcc)[_0x7303('0x18')]();});}};}function handleEntityNotFound(_0x424db5,_0x57fc3a){return function(_0x33dceb){if(!_0x33dceb){_0x424db5[_0x7303('0x16')](0x194);}return _0x33dceb;};}function handleError(_0x43bae1,_0x41d704){_0x41d704=_0x41d704||0x1f4;return function(_0x1a129f){logger[_0x7303('0x23')](_0x1a129f[_0x7303('0x24')]);if(_0x1a129f['name']){delete _0x1a129f[_0x7303('0x25')];}_0x43bae1[_0x7303('0x17')](_0x41d704)[_0x7303('0x26')](_0x1a129f);};}exports[_0x7303('0x27')]=function(_0x4be7d0,_0x5c8f64){var _0x448fe8={},_0x140324={},_0x48804f={'count':0x0,'rows':[]};var _0x54dffa=_[_0x7303('0x28')](db[_0x7303('0x29')][_0x7303('0x2a')],function(_0x453930){return{'name':_0x453930['fieldName'],'type':_0x453930[_0x7303('0x2b')][_0x7303('0x2c')]};});_0x140324[_0x7303('0x2d')]=_['map'](_0x54dffa,'name');_0x140324[_0x7303('0x2e')]=_[_0x7303('0x2f')](_0x4be7d0['query']);_0x140324[_0x7303('0x30')]=_['intersection'](_0x140324[_0x7303('0x2d')],_0x140324[_0x7303('0x2e')]);_0x448fe8[_0x7303('0x31')]=_[_0x7303('0x32')](_0x140324[_0x7303('0x2d')],qs[_0x7303('0x33')](_0x4be7d0[_0x7303('0x2e')]['fields']));_0x448fe8[_0x7303('0x31')]=_0x448fe8['attributes']['length']?_0x448fe8['attributes']:_0x140324[_0x7303('0x2d')];if(!_0x4be7d0[_0x7303('0x2e')]['hasOwnProperty'](_0x7303('0x34'))){_0x448fe8[_0x7303('0x35')]=qs[_0x7303('0x35')](_0x4be7d0[_0x7303('0x2e')][_0x7303('0x35')]);_0x448fe8[_0x7303('0x1a')]=qs[_0x7303('0x1a')](_0x4be7d0[_0x7303('0x2e')][_0x7303('0x1a')]);}_0x448fe8[_0x7303('0x36')]=qs['sort'](_0x4be7d0[_0x7303('0x2e')][_0x7303('0x37')]);_0x448fe8[_0x7303('0x38')]=qs[_0x7303('0x30')](_[_0x7303('0x39')](_0x4be7d0[_0x7303('0x2e')],_0x140324[_0x7303('0x30')]));if(_0x4be7d0[_0x7303('0x2e')][_0x7303('0x3a')]){_0x448fe8['where']=_['merge'](_0x448fe8[_0x7303('0x38')],{'$or':_[_0x7303('0x28')](_0x54dffa,function(_0x906a68){if(_0x906a68[_0x7303('0x2b')]!==_0x7303('0x3b')){var _0x202ad5={};_0x202ad5[_0x906a68['name']]={'$like':'%'+_0x4be7d0['query'][_0x7303('0x3a')]+'%'};return _0x202ad5;}})});}_0x448fe8=_[_0x7303('0x3c')]({},_0x448fe8,_0x4be7d0[_0x7303('0x3d')]);var _0x4fe3c5={'where':_0x448fe8[_0x7303('0x38')]};return db[_0x7303('0x29')][_0x7303('0x19')](_0x4fe3c5)[_0x7303('0x21')](function(_0x37aa33){_0x48804f[_0x7303('0x19')]=_0x37aa33;if(_0x4be7d0[_0x7303('0x2e')]['includeAll']){_0x448fe8[_0x7303('0x3e')]=[{'all':!![]}];}return db[_0x7303('0x29')][_0x7303('0x3f')](_0x448fe8);})['then'](function(_0x115eb2){_0x48804f['rows']=_0x115eb2;return _0x48804f;})[_0x7303('0x21')](respondWithFilteredResult(_0x5c8f64,_0x448fe8))[_0x7303('0x40')](handleError(_0x5c8f64,null));};exports[_0x7303('0x41')]=function(_0x4f9121,_0x1ef9df){var _0x2f1893={'raw':!![],'where':{'id':_0x4f9121[_0x7303('0x42')]['id']}},_0x464c49={};_0x464c49[_0x7303('0x2d')]=_['keys'](db[_0x7303('0x29')][_0x7303('0x2a')]);_0x464c49[_0x7303('0x2e')]=_['keys'](_0x4f9121[_0x7303('0x2e')]);_0x464c49[_0x7303('0x30')]=_[_0x7303('0x32')](_0x464c49[_0x7303('0x2d')],_0x464c49[_0x7303('0x2e')]);_0x2f1893[_0x7303('0x31')]=_[_0x7303('0x32')](_0x464c49['model'],qs['fields'](_0x4f9121[_0x7303('0x2e')][_0x7303('0x33')]));_0x2f1893[_0x7303('0x31')]=_0x2f1893[_0x7303('0x31')][_0x7303('0x43')]?_0x2f1893[_0x7303('0x31')]:_0x464c49[_0x7303('0x2d')];if(_0x4f9121[_0x7303('0x2e')]['includeAll']){_0x2f1893[_0x7303('0x3e')]=[{'all':!![]}];}_0x2f1893=_[_0x7303('0x3c')]({},_0x2f1893,_0x4f9121['options']);return db[_0x7303('0x29')][_0x7303('0x44')](_0x2f1893)[_0x7303('0x21')](handleEntityNotFound(_0x1ef9df,null))['then'](respondWithResult(_0x1ef9df,null))['catch'](handleError(_0x1ef9df,null));};exports[_0x7303('0x45')]=function(_0x13f7e7,_0x1710c5){return db[_0x7303('0x29')]['create'](_0x13f7e7[_0x7303('0x46')],{})[_0x7303('0x21')](respondWithResult(_0x1710c5,0xc9))[_0x7303('0x40')](handleError(_0x1710c5,null));};exports[_0x7303('0x20')]=function(_0x669f03,_0x56c8a7){if(_0x669f03['body']['id']){delete _0x669f03[_0x7303('0x46')]['id'];}return db[_0x7303('0x29')][_0x7303('0x44')]({'where':{'id':_0x669f03[_0x7303('0x42')]['id']}})[_0x7303('0x21')](handleEntityNotFound(_0x56c8a7,null))[_0x7303('0x21')](saveUpdates(_0x669f03['body'],null))[_0x7303('0x21')](respondWithResult(_0x56c8a7,null))['catch'](handleError(_0x56c8a7,null));};exports[_0x7303('0x22')]=function(_0x20eac6,_0x501161){return db[_0x7303('0x29')]['find']({'where':{'id':_0x20eac6[_0x7303('0x42')]['id']}})['then'](handleEntityNotFound(_0x501161,null))['then'](removeEntity(_0x501161,null))[_0x7303('0x40')](handleError(_0x501161,null));}; \ No newline at end of file +var _0x71ef=['intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','options','count','includeAll','rows','catch','show','params','include','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x105d62,_0xeecdb5){var _0x310c07=function(_0x47646e){while(--_0x47646e){_0x105d62['push'](_0x105d62['shift']());}};_0x310c07(++_0xeecdb5);}(_0x71ef,0xad));var _0xf71e=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0x71ef[_0x28edda];return _0x21f4a4;};'use strict';var pdf=require(_0xf71e('0x0'));var emlformat=require(_0xf71e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf71e('0x2'));var jsonpatch=require(_0xf71e('0x3'));var rp=require(_0xf71e('0x4'));var moment=require(_0xf71e('0x5'));var BPromise=require(_0xf71e('0x6'));var Mustache=require(_0xf71e('0x7'));var util=require(_0xf71e('0x8'));var path=require(_0xf71e('0x9'));var sox=require(_0xf71e('0xa'));var csv=require(_0xf71e('0xb'));var ejs=require(_0xf71e('0xc'));var fs=require('fs');var _=require(_0xf71e('0xd'));var squel=require('squel');var crypto=require(_0xf71e('0xe'));var jsforce=require(_0xf71e('0xf'));var deskjs=require(_0xf71e('0x10'));var toCsv=require(_0xf71e('0xb'));var querystring=require(_0xf71e('0x11'));var Papa=require(_0xf71e('0x12'));var Redis=require(_0xf71e('0x13'));var authService=require(_0xf71e('0x14'));var qs=require(_0xf71e('0x15'));var as=require(_0xf71e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf71e('0x17'));var utils=require('../../config/utils');var config=require(_0xf71e('0x18'));var db=require(_0xf71e('0x19'))['db'];function respondWithStatusCode(_0x1c9658,_0x33e108){_0x33e108=_0x33e108||0xcc;return function(_0x4aa7ae){if(_0x4aa7ae){return _0x1c9658[_0xf71e('0x1a')](_0x33e108);}return _0x1c9658[_0xf71e('0x1b')](_0x33e108)[_0xf71e('0x1c')]();};}function respondWithResult(_0x1a9614,_0xe21acd){_0xe21acd=_0xe21acd||0xc8;return function(_0x21048b){if(_0x21048b){return _0x1a9614[_0xf71e('0x1b')](_0xe21acd)[_0xf71e('0x1d')](_0x21048b);}};}function respondWithFilteredResult(_0x5523bc,_0x367acc){return function(_0x31d0a1){if(_0x31d0a1){var _0x247982=_0x31d0a1['count'],_0x25bd06=_0x367acc[_0xf71e('0x1e')],_0x139fe2=_0x367acc['offset']+_0x367acc[_0xf71e('0x1f')],_0x2c963e;if(_0x139fe2>=_0x247982){_0x139fe2=_0x247982;_0x2c963e=0xc8;}else{_0x2c963e=0xce;}_0x5523bc[_0xf71e('0x1b')](_0x2c963e);return _0x5523bc[_0xf71e('0x20')](_0xf71e('0x21'),_0x25bd06+'-'+_0x139fe2+'/'+_0x247982)[_0xf71e('0x1d')](_0x31d0a1);}return null;};}function patchUpdates(_0x16c6b7){return function(_0x3b00a1){try{jsonpatch[_0xf71e('0x22')](_0x3b00a1,_0x16c6b7,!![]);}catch(_0x33fafa){return BPromise[_0xf71e('0x23')](_0x33fafa);}return _0x3b00a1[_0xf71e('0x24')]();};}function saveUpdates(_0x58c0ec,_0x239f69){return function(_0x2a6809){if(_0x2a6809){return _0x2a6809[_0xf71e('0x25')](_0x58c0ec)[_0xf71e('0x26')](function(_0x24e9a2){return _0x24e9a2;});}return null;};}function removeEntity(_0x15dae6,_0x343fe2){return function(_0x558756){if(_0x558756){return _0x558756[_0xf71e('0x27')]()[_0xf71e('0x26')](function(){_0x15dae6[_0xf71e('0x1b')](0xcc)[_0xf71e('0x1c')]();});}};}function handleEntityNotFound(_0x52d850,_0x379b23){return function(_0x4c383e){if(!_0x4c383e){_0x52d850[_0xf71e('0x1a')](0x194);}return _0x4c383e;};}function handleError(_0x4df831,_0x287f31){_0x287f31=_0x287f31||0x1f4;return function(_0x319fc3){logger[_0xf71e('0x28')](_0x319fc3[_0xf71e('0x29')]);if(_0x319fc3['name']){delete _0x319fc3[_0xf71e('0x2a')];}_0x4df831[_0xf71e('0x1b')](_0x287f31)['send'](_0x319fc3);};}exports['index']=function(_0x2097a7,_0x33206e){var _0x49f910={},_0x2f1c36={},_0x1efefc={'count':0x0,'rows':[]};var _0x162cbd=_[_0xf71e('0x2b')](db[_0xf71e('0x2c')][_0xf71e('0x2d')],function(_0x36427c){return{'name':_0x36427c[_0xf71e('0x2e')],'type':_0x36427c[_0xf71e('0x2f')][_0xf71e('0x30')]};});_0x2f1c36[_0xf71e('0x31')]=_[_0xf71e('0x2b')](_0x162cbd,_0xf71e('0x2a'));_0x2f1c36[_0xf71e('0x32')]=_[_0xf71e('0x33')](_0x2097a7[_0xf71e('0x32')]);_0x2f1c36['filters']=_[_0xf71e('0x34')](_0x2f1c36[_0xf71e('0x31')],_0x2f1c36[_0xf71e('0x32')]);_0x49f910['attributes']=_['intersection'](_0x2f1c36[_0xf71e('0x31')],qs[_0xf71e('0x35')](_0x2097a7[_0xf71e('0x32')][_0xf71e('0x35')]));_0x49f910['attributes']=_0x49f910[_0xf71e('0x36')][_0xf71e('0x37')]?_0x49f910[_0xf71e('0x36')]:_0x2f1c36[_0xf71e('0x31')];if(!_0x2097a7[_0xf71e('0x32')][_0xf71e('0x38')](_0xf71e('0x39'))){_0x49f910['limit']=qs[_0xf71e('0x1f')](_0x2097a7[_0xf71e('0x32')][_0xf71e('0x1f')]);_0x49f910[_0xf71e('0x1e')]=qs[_0xf71e('0x1e')](_0x2097a7['query']['offset']);}_0x49f910['order']=qs['sort'](_0x2097a7['query'][_0xf71e('0x3a')]);_0x49f910['where']=qs[_0xf71e('0x3b')](_[_0xf71e('0x3c')](_0x2097a7['query'],_0x2f1c36[_0xf71e('0x3b')]));if(_0x2097a7[_0xf71e('0x32')][_0xf71e('0x3d')]){_0x49f910[_0xf71e('0x3e')]=_[_0xf71e('0x3f')](_0x49f910[_0xf71e('0x3e')],{'$or':_[_0xf71e('0x2b')](_0x162cbd,function(_0x2a8a49){if(_0x2a8a49['type']!=='VIRTUAL'){var _0x3eb49a={};_0x3eb49a[_0x2a8a49['name']]={'$like':'%'+_0x2097a7[_0xf71e('0x32')][_0xf71e('0x3d')]+'%'};return _0x3eb49a;}})});}_0x49f910=_[_0xf71e('0x3f')]({},_0x49f910,_0x2097a7[_0xf71e('0x40')]);var _0x443352={'where':_0x49f910[_0xf71e('0x3e')]};return db['ZendeskField'][_0xf71e('0x41')](_0x443352)[_0xf71e('0x26')](function(_0x2df427){_0x1efefc[_0xf71e('0x41')]=_0x2df427;if(_0x2097a7[_0xf71e('0x32')][_0xf71e('0x42')]){_0x49f910['include']=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x49f910);})[_0xf71e('0x26')](function(_0x15e871){_0x1efefc[_0xf71e('0x43')]=_0x15e871;return _0x1efefc;})[_0xf71e('0x26')](respondWithFilteredResult(_0x33206e,_0x49f910))[_0xf71e('0x44')](handleError(_0x33206e,null));};exports[_0xf71e('0x45')]=function(_0x4a48f6,_0x72fe9a){var _0x29539c={'raw':!![],'where':{'id':_0x4a48f6[_0xf71e('0x46')]['id']}},_0x11a100={};_0x11a100[_0xf71e('0x31')]=_[_0xf71e('0x33')](db['ZendeskField'][_0xf71e('0x2d')]);_0x11a100[_0xf71e('0x32')]=_['keys'](_0x4a48f6['query']);_0x11a100[_0xf71e('0x3b')]=_[_0xf71e('0x34')](_0x11a100[_0xf71e('0x31')],_0x11a100[_0xf71e('0x32')]);_0x29539c[_0xf71e('0x36')]=_['intersection'](_0x11a100[_0xf71e('0x31')],qs[_0xf71e('0x35')](_0x4a48f6[_0xf71e('0x32')][_0xf71e('0x35')]));_0x29539c[_0xf71e('0x36')]=_0x29539c[_0xf71e('0x36')][_0xf71e('0x37')]?_0x29539c[_0xf71e('0x36')]:_0x11a100[_0xf71e('0x31')];if(_0x4a48f6['query'][_0xf71e('0x42')]){_0x29539c[_0xf71e('0x47')]=[{'all':!![]}];}_0x29539c=_[_0xf71e('0x3f')]({},_0x29539c,_0x4a48f6[_0xf71e('0x40')]);return db[_0xf71e('0x2c')]['find'](_0x29539c)[_0xf71e('0x26')](handleEntityNotFound(_0x72fe9a,null))[_0xf71e('0x26')](respondWithResult(_0x72fe9a,null))['catch'](handleError(_0x72fe9a,null));};exports[_0xf71e('0x48')]=function(_0xb2804,_0x4785f5){return db[_0xf71e('0x2c')][_0xf71e('0x48')](_0xb2804[_0xf71e('0x49')],{})[_0xf71e('0x26')](respondWithResult(_0x4785f5,0xc9))['catch'](handleError(_0x4785f5,null));};exports['update']=function(_0x1182a5,_0xc873e4){if(_0x1182a5[_0xf71e('0x49')]['id']){delete _0x1182a5[_0xf71e('0x49')]['id'];}return db['ZendeskField'][_0xf71e('0x4a')]({'where':{'id':_0x1182a5[_0xf71e('0x46')]['id']}})[_0xf71e('0x26')](handleEntityNotFound(_0xc873e4,null))['then'](saveUpdates(_0x1182a5[_0xf71e('0x49')],null))[_0xf71e('0x26')](respondWithResult(_0xc873e4,null))[_0xf71e('0x44')](handleError(_0xc873e4,null));};exports[_0xf71e('0x27')]=function(_0x300db2,_0x459ccf){return db[_0xf71e('0x2c')][_0xf71e('0x4a')]({'where':{'id':_0x300db2[_0xf71e('0x46')]['id']}})['then'](handleEntityNotFound(_0x459ccf,null))[_0xf71e('0x26')](removeEntity(_0x459ccf,null))[_0xf71e('0x44')](handleError(_0x459ccf,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d62abd6..b76dd36 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 _0x765e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0x765e,0x131));var _0xe765=function(_0x4c5d4f,_0x11438b){_0x4c5d4f=_0x4c5d4f-0x0;var _0x1d9122=_0x765e[_0x4c5d4f];return _0x1d9122;};'use strict';var _=require(_0xe765('0x0'));var util=require(_0xe765('0x1'));var logger=require(_0xe765('0x2'))(_0xe765('0x3'));var moment=require(_0xe765('0x4'));var BPromise=require(_0xe765('0x5'));var rp=require(_0xe765('0x6'));var fs=require('fs');var path=require(_0xe765('0x7'));var rimraf=require(_0xe765('0x8'));var config=require(_0xe765('0x9'));var attributes=require(_0xe765('0xa'));module[_0xe765('0xb')]=function(_0x40ac5e,_0xdcac86){return _0x40ac5e[_0xe765('0xc')]('ZendeskField',attributes,{'tableName':_0xe765('0xd'),'paranoid':![],'indexes':[{'name':_0xe765('0xe'),'fields':[_0xe765('0xf'),_0xe765('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1339=['path','rimraf','./intZendeskField.attributes','exports','define','zendesk_unique_index','FieldId','lodash','util','api','moment'];(function(_0x5206a7,_0x3c7975){var _0x4cd7ee=function(_0x4ce1a5){while(--_0x4ce1a5){_0x5206a7['push'](_0x5206a7['shift']());}};_0x4cd7ee(++_0x3c7975);}(_0x1339,0x1bf));var _0x9133=function(_0x3ea29f,_0x1f7630){_0x3ea29f=_0x3ea29f-0x0;var _0x1d7a43=_0x1339[_0x3ea29f];return _0x1d7a43;};'use strict';var _=require(_0x9133('0x0'));var util=require(_0x9133('0x1'));var logger=require('../../config/logger')(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9133('0x4'));var rimraf=require(_0x9133('0x5'));var config=require('../../config/environment');var attributes=require(_0x9133('0x6'));module[_0x9133('0x7')]=function(_0x410765,_0x1534e4){return _0x410765[_0x9133('0x8')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x9133('0x9'),'fields':['idField',_0x9133('0xa')],'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 85cf900..e4d5caf 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 _0x1869=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x5991d7,_0x3ca7f8){var _0x5b299d=function(_0x358ddf){while(--_0x358ddf){_0x5991d7['push'](_0x5991d7['shift']());}};_0x5b299d(++_0x3ca7f8);}(_0x1869,0xe4));var _0x9186=function(_0x34362,_0x1e9392){_0x34362=_0x34362-0x0;var _0x4613b0=_0x1869[_0x34362];return _0x4613b0;};'use strict';var _=require(_0x9186('0x0'));var util=require(_0x9186('0x1'));var moment=require(_0x9186('0x2'));var BPromise=require('bluebird');var rs=require(_0x9186('0x3'));var fs=require('fs');var Redis=require(_0x9186('0x4'));var db=require(_0x9186('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9186('0x6'))(_0x9186('0x7'));var config=require(_0x9186('0x8'));var jayson=require(_0x9186('0x9'));var client=jayson[_0x9186('0xa')][_0x9186('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22a6d9,_0x46774d,_0x21edf5){return new BPromise(function(_0x533f9e,_0x5190c5){return client[_0x9186('0xc')](_0x22a6d9,_0x21edf5)['then'](function(_0x494a9){logger[_0x9186('0xd')](_0x9186('0xe'),_0x46774d,_0x9186('0xf'));logger[_0x9186('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x46774d,_0x9186('0xf'),JSON[_0x9186('0x11')](_0x494a9));if(_0x494a9[_0x9186('0x12')]){if(_0x494a9['error'][_0x9186('0x13')]===0x1f4){logger[_0x9186('0x12')](_0x9186('0xe'),_0x46774d,_0x494a9[_0x9186('0x12')][_0x9186('0x14')]);return _0x5190c5(_0x494a9[_0x9186('0x12')]['message']);}logger['error'](_0x9186('0xe'),_0x46774d,_0x494a9[_0x9186('0x12')][_0x9186('0x14')]);return _0x533f9e(_0x494a9[_0x9186('0x12')]['message']);}else{logger[_0x9186('0xd')](_0x9186('0xe'),_0x46774d,'request\x20sent');_0x533f9e(_0x494a9[_0x9186('0x15')][_0x9186('0x14')]);}})['catch'](function(_0x4c3852){logger[_0x9186('0x12')](_0x9186('0xe'),_0x46774d,_0x4c3852);_0x5190c5(_0x4c3852);});});} \ No newline at end of file +var _0x38dc=['message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x38dc,0x192));var _0xc38d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x38dc[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xc38d('0x0'));var util=require('util');var moment=require(_0xc38d('0x1'));var BPromise=require('bluebird');var rs=require(_0xc38d('0x2'));var fs=require('fs');var Redis=require(_0xc38d('0x3'));var db=require(_0xc38d('0x4'))['db'];var utils=require(_0xc38d('0x5'));var logger=require('../../config/logger')(_0xc38d('0x6'));var config=require(_0xc38d('0x7'));var jayson=require(_0xc38d('0x8'));var client=jayson[_0xc38d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7d3f81,_0x396097,_0x56ee0d){return new BPromise(function(_0x139a1e,_0x5c72d9){return client['request'](_0x7d3f81,_0x56ee0d)[_0xc38d('0xa')](function(_0x4ea368){logger[_0xc38d('0xb')](_0xc38d('0xc'),_0x396097,'request\x20sent');logger[_0xc38d('0xd')](_0xc38d('0xe'),_0x396097,_0xc38d('0xf'),JSON['stringify'](_0x4ea368));if(_0x4ea368['error']){if(_0x4ea368[_0xc38d('0x10')][_0xc38d('0x11')]===0x1f4){logger[_0xc38d('0x10')]('ZendeskField,\x20%s,\x20%s',_0x396097,_0x4ea368['error'][_0xc38d('0x12')]);return _0x5c72d9(_0x4ea368['error']['message']);}logger[_0xc38d('0x10')](_0xc38d('0xc'),_0x396097,_0x4ea368[_0xc38d('0x10')][_0xc38d('0x12')]);return _0x139a1e(_0x4ea368[_0xc38d('0x10')][_0xc38d('0x12')]);}else{logger[_0xc38d('0xb')](_0xc38d('0xc'),_0x396097,'request\x20sent');_0x139a1e(_0x4ea368[_0xc38d('0x13')][_0xc38d('0x12')]);}})[_0xc38d('0x14')](function(_0x23eb16){logger['error'](_0xc38d('0xc'),_0x396097,_0x23eb16);_0x5c72d9(_0x23eb16);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 4c05178..83a5e1e 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 _0x0d58=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','/:id','update','delete','destroy','exports'];(function(_0x4e1d7d,_0x5a7761){var _0x53f086=function(_0x3bd510){while(--_0x3bd510){_0x4e1d7d['push'](_0x4e1d7d['shift']());}};_0x53f086(++_0x5a7761);}(_0x0d58,0x90));var _0x80d5=function(_0x4e55a9,_0x241b22){_0x4e55a9=_0x4e55a9-0x0;var _0x4a9b67=_0x0d58[_0x4e55a9];return _0x4a9b67;};'use strict';var multer=require(_0x80d5('0x0'));var util=require(_0x80d5('0x1'));var path=require('path');var timeout=require(_0x80d5('0x2'));var express=require(_0x80d5('0x3'));var router=express[_0x80d5('0x4')]();var auth=require(_0x80d5('0x5'));var interaction=require(_0x80d5('0x6'));var config=require(_0x80d5('0x7'));var controller=require(_0x80d5('0x8'));router[_0x80d5('0x9')]('/',auth['isAuthenticated'](),controller[_0x80d5('0xa')]);router[_0x80d5('0x9')]('/:id',auth[_0x80d5('0xb')](),controller[_0x80d5('0xc')]);router[_0x80d5('0x9')](_0x80d5('0xd'),auth[_0x80d5('0xb')](),controller[_0x80d5('0xe')]);router[_0x80d5('0x9')]('/:id/fields',auth[_0x80d5('0xb')](),controller[_0x80d5('0xf')]);router[_0x80d5('0x10')]('/',auth[_0x80d5('0xb')](),controller['create']);router[_0x80d5('0x10')](_0x80d5('0xd'),auth[_0x80d5('0xb')](),controller[_0x80d5('0x11')]);router[_0x80d5('0x12')](_0x80d5('0x13'),auth[_0x80d5('0xb')](),controller[_0x80d5('0x14')]);router[_0x80d5('0x15')](_0x80d5('0x13'),auth[_0x80d5('0xb')](),controller[_0x80d5('0x16')]);module[_0x80d5('0x17')]=router; \ No newline at end of file +var _0x2aaf=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x18a8f1,_0x2594c3){var _0x588be2=function(_0x4f34f8){while(--_0x4f34f8){_0x18a8f1['push'](_0x18a8f1['shift']());}};_0x588be2(++_0x2594c3);}(_0x2aaf,0xd4));var _0xf2aa=function(_0x4d00bc,_0x21ffed){_0x4d00bc=_0x4d00bc-0x0;var _0x3efaed=_0x2aaf[_0x4d00bc];return _0x3efaed;};'use strict';var multer=require(_0xf2aa('0x0'));var util=require(_0xf2aa('0x1'));var path=require(_0xf2aa('0x2'));var timeout=require('connect-timeout');var express=require(_0xf2aa('0x3'));var router=express[_0xf2aa('0x4')]();var auth=require(_0xf2aa('0x5'));var interaction=require(_0xf2aa('0x6'));var config=require(_0xf2aa('0x7'));var controller=require(_0xf2aa('0x8'));router[_0xf2aa('0x9')]('/',auth[_0xf2aa('0xa')](),controller[_0xf2aa('0xb')]);router[_0xf2aa('0x9')](_0xf2aa('0xc'),auth[_0xf2aa('0xa')](),controller[_0xf2aa('0xd')]);router[_0xf2aa('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xf2aa('0xe')]);router[_0xf2aa('0x9')]('/:id/fields',auth[_0xf2aa('0xa')](),controller[_0xf2aa('0xf')]);router[_0xf2aa('0x10')]('/',auth['isAuthenticated'](),controller[_0xf2aa('0x11')]);router['post']('/:id/configurations',auth[_0xf2aa('0xa')](),controller[_0xf2aa('0x12')]);router[_0xf2aa('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xf2aa('0x14')]);router[_0xf2aa('0x15')]('/:id',auth[_0xf2aa('0xa')](),controller[_0xf2aa('0x16')]);module[_0xf2aa('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 8e4ff65..fe8c47f 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 _0xd21f=['STRING'];(function(_0x1411d4,_0x3a100c){var _0x4ea38d=function(_0x220ba7){while(--_0x220ba7){_0x1411d4['push'](_0x1411d4['shift']());}};_0x4ea38d(++_0x3a100c);}(_0xd21f,0x1bb));var _0xfd21=function(_0x208d75,_0x92d742){_0x208d75=_0x208d75-0x0;var _0x382d27=_0xd21f[_0x208d75];return _0x382d27;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfd21('0x0')]},'description':{'type':Sequelize[_0xfd21('0x0')]},'host':{'type':Sequelize[_0xfd21('0x0')]},'zone':{'type':Sequelize[_0xfd21('0x0')]},'clientId':{'type':Sequelize[_0xfd21('0x0')]},'clientSecret':{'type':Sequelize[_0xfd21('0x0')]},'serverUrl':{'type':Sequelize[_0xfd21('0x0')]},'code':{'type':Sequelize[_0xfd21('0x0')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbdd8=['STRING','sequelize'];(function(_0x3a853e,_0x39ddf1){var _0x5f3323=function(_0x2a33e3){while(--_0x2a33e3){_0x3a853e['push'](_0x3a853e['shift']());}};_0x5f3323(++_0x39ddf1);}(_0xbdd8,0xbd));var _0x8bdd=function(_0x51a658,_0x4098dd){_0x51a658=_0x51a658-0x0;var _0x401ac7=_0xbdd8[_0x51a658];return _0x401ac7;};'use strict';var Sequelize=require(_0x8bdd('0x0'));module['exports']={'name':{'type':Sequelize[_0x8bdd('0x1')]},'description':{'type':Sequelize[_0x8bdd('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8bdd('0x1')]},'clientId':{'type':Sequelize[_0x8bdd('0x1')]},'clientSecret':{'type':Sequelize[_0x8bdd('0x1')]},'serverUrl':{'type':Sequelize[_0x8bdd('0x1')]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x8bdd('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 05b1f06..a357548 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 _0xe685=['ValidationError','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','count','offset','limit','apply','reject','save','destroy','stack','name','fieldName','map','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','params','ZohoAccount','rawAttributes','length','find','create','body','update','getConfigurations','addConfiguration','findOne','getSubjects','Descriptions','ZohoConfiguration','ZohoField','Subjects','zone','https://accounts.zoho.com','/oauth/v2/token','clientId','clientSecret','access_token','host','refreshToken','com','serverUrl','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','pick_list_values','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize'];(function(_0x218432,_0x405b73){var _0x60279=function(_0x34b8eb){while(--_0x34b8eb){_0x218432['push'](_0x218432['shift']());}};_0x60279(++_0x405b73);}(_0xe685,0xe0));var _0x5e68=function(_0x3c7042,_0x42882e){_0x3c7042=_0x3c7042-0x0;var _0x2409d2=_0xe685[_0x3c7042];return _0x2409d2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5e68('0x0'));var rimraf=require(_0x5e68('0x1'));var zipdir=require(_0x5e68('0x2'));var jsonpatch=require(_0x5e68('0x3'));var rp=require(_0x5e68('0x4'));var moment=require(_0x5e68('0x5'));var BPromise=require(_0x5e68('0x6'));var Mustache=require(_0x5e68('0x7'));var util=require(_0x5e68('0x8'));var path=require('path');var sox=require(_0x5e68('0x9'));var csv=require(_0x5e68('0xa'));var ejs=require(_0x5e68('0xb'));var fs=require('fs');var _=require(_0x5e68('0xc'));var squel=require('squel');var crypto=require(_0x5e68('0xd'));var jsforce=require(_0x5e68('0xe'));var deskjs=require(_0x5e68('0xf'));var toCsv=require(_0x5e68('0xa'));var querystring=require(_0x5e68('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5e68('0x11'));var qs=require(_0x5e68('0x12'));var as=require(_0x5e68('0x13'));var hardwareService=require(_0x5e68('0x14'));var logger=require(_0x5e68('0x15'))('api');var utils=require(_0x5e68('0x16'));var config=require(_0x5e68('0x17'));var db=require(_0x5e68('0x18'))['db'];var integrations=require(_0x5e68('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x5e68('0x1a')][_0x5e68('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x218091,_0x391344,_0x266198){if(_0x266198){var _0x2e603a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e603a[_0x5e68('0x1c')](_0x391344)){return _0x218091;}else{throw new db[(_0x5e68('0x1d'))][(_0x5e68('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x218091;}}function respondWithRpcPromise(_0x45726,_0x3160f0,_0x48e198,_0x38d86c){return new BPromise(function(_0x53134e,_0x40d72a){var _0xd82104=_0x38d86c||client;return _0xd82104[_0x5e68('0x1f')](_0x45726,_0x48e198)[_0x5e68('0x20')](function(_0x3c29a8){logger[_0x5e68('0x21')]('ZohoAccount,\x20%s,\x20%s',_0x3160f0,_0x5e68('0x22'));logger[_0x5e68('0x23')](_0x5e68('0x24'),_0x3160f0,_0x5e68('0x22'),JSON['stringify'](_0x3c29a8));if(_0x3c29a8[_0x5e68('0x25')]){if(_0x3c29a8['error'][_0x5e68('0x26')]===0x1f4){logger[_0x5e68('0x25')](_0x5e68('0x27'),_0x3160f0,_0x3c29a8[_0x5e68('0x25')][_0x5e68('0x28')]);return _0x40d72a(_0x3c29a8[_0x5e68('0x25')][_0x5e68('0x28')]);}logger[_0x5e68('0x25')]('ZohoAccount,\x20%s,\x20%s',_0x3160f0,_0x3c29a8[_0x5e68('0x25')]['message']);return _0x53134e(_0x3c29a8[_0x5e68('0x25')][_0x5e68('0x28')]);}else{logger[_0x5e68('0x21')](_0x5e68('0x27'),_0x3160f0,_0x5e68('0x22'));_0x53134e(_0x3c29a8['result'][_0x5e68('0x28')]);}})[_0x5e68('0x29')](function(_0x31ac63){logger['error'](_0x5e68('0x27'),_0x3160f0,_0x31ac63);_0x40d72a(_0x31ac63);});});}function respondWithStatusCode(_0x508be8,_0x33e0f0){_0x33e0f0=_0x33e0f0||0xcc;return function(_0x3f7bd0){if(_0x3f7bd0){return _0x508be8[_0x5e68('0x2a')](_0x33e0f0);}return _0x508be8['status'](_0x33e0f0)[_0x5e68('0x2b')]();};}function respondWithResult(_0x3a0f13,_0x3f4f08){_0x3f4f08=_0x3f4f08||0xc8;return function(_0x1ccb3e){if(_0x1ccb3e){return _0x3a0f13[_0x5e68('0x2c')](_0x3f4f08)[_0x5e68('0x2d')](_0x1ccb3e);}};}function respondWithFilteredResult(_0x5ba1aa,_0x34f1ee){return function(_0x7456f1){if(_0x7456f1){var _0x1de093=_0x7456f1[_0x5e68('0x2e')],_0x1c39b2=_0x34f1ee['offset'],_0x5dc30d=_0x34f1ee[_0x5e68('0x2f')]+_0x34f1ee[_0x5e68('0x30')],_0x3b47ec;if(_0x5dc30d>=_0x1de093){_0x5dc30d=_0x1de093;_0x3b47ec=0xc8;}else{_0x3b47ec=0xce;}_0x5ba1aa['status'](_0x3b47ec);return _0x5ba1aa['set']('Content-Range',_0x1c39b2+'-'+_0x5dc30d+'/'+_0x1de093)[_0x5e68('0x2d')](_0x7456f1);}return null;};}function patchUpdates(_0x22671d){return function(_0x265273){try{jsonpatch[_0x5e68('0x31')](_0x265273,_0x22671d,!![]);}catch(_0x10a548){return BPromise[_0x5e68('0x32')](_0x10a548);}return _0x265273[_0x5e68('0x33')]();};}function saveUpdates(_0x335018,_0x2eada6){return function(_0x119918){if(_0x119918){return _0x119918['update'](_0x335018)[_0x5e68('0x20')](function(_0xffe46c){return _0xffe46c;});}return null;};}function removeEntity(_0x34362f,_0x4fe757){return function(_0xd86e8b){if(_0xd86e8b){return _0xd86e8b[_0x5e68('0x34')]()[_0x5e68('0x20')](function(){_0x34362f[_0x5e68('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11884b,_0x17eb6b){return function(_0x194109){if(!_0x194109){_0x11884b[_0x5e68('0x2a')](0x194);}return _0x194109;};}function handleError(_0x1e1e3d,_0x51d6ec){_0x51d6ec=_0x51d6ec||0x1f4;return function(_0x18d08b){logger[_0x5e68('0x25')](_0x18d08b[_0x5e68('0x35')]);if(_0x18d08b[_0x5e68('0x36')]){delete _0x18d08b[_0x5e68('0x36')];}_0x1e1e3d[_0x5e68('0x2c')](_0x51d6ec)['send'](_0x18d08b);};}exports['index']=function(_0xb78470,_0x5a2116){var _0x21169d={},_0x3a4926={},_0x3c26d4={'count':0x0,'rows':[]};var _0x4e95b6=_['map'](db['ZohoAccount']['rawAttributes'],function(_0x1e979e){return{'name':_0x1e979e[_0x5e68('0x37')],'type':_0x1e979e['type']['key']};});_0x3a4926['model']=_[_0x5e68('0x38')](_0x4e95b6,_0x5e68('0x36'));_0x3a4926[_0x5e68('0x39')]=_[_0x5e68('0x3a')](_0xb78470['query']);_0x3a4926[_0x5e68('0x3b')]=_[_0x5e68('0x3c')](_0x3a4926['model'],_0x3a4926[_0x5e68('0x39')]);_0x21169d[_0x5e68('0x3d')]=_[_0x5e68('0x3c')](_0x3a4926['model'],qs['fields'](_0xb78470[_0x5e68('0x39')][_0x5e68('0x3e')]));_0x21169d['attributes']=_0x21169d[_0x5e68('0x3d')]['length']?_0x21169d[_0x5e68('0x3d')]:_0x3a4926[_0x5e68('0x3f')];if(!_0xb78470['query'][_0x5e68('0x40')](_0x5e68('0x41'))){_0x21169d[_0x5e68('0x30')]=qs[_0x5e68('0x30')](_0xb78470[_0x5e68('0x39')]['limit']);_0x21169d[_0x5e68('0x2f')]=qs['offset'](_0xb78470['query'][_0x5e68('0x2f')]);}_0x21169d[_0x5e68('0x42')]=qs[_0x5e68('0x43')](_0xb78470[_0x5e68('0x39')][_0x5e68('0x43')]);_0x21169d['where']=qs[_0x5e68('0x3b')](_[_0x5e68('0x44')](_0xb78470[_0x5e68('0x39')],_0x3a4926[_0x5e68('0x3b')]));if(_0xb78470[_0x5e68('0x39')]['filter']){_0x21169d[_0x5e68('0x45')]=_[_0x5e68('0x46')](_0x21169d[_0x5e68('0x45')],{'$or':_[_0x5e68('0x38')](_0x4e95b6,function(_0x29ec79){if(_0x29ec79[_0x5e68('0x47')]!==_0x5e68('0x48')){var _0x4acd00={};_0x4acd00[_0x29ec79[_0x5e68('0x36')]]={'$like':'%'+_0xb78470['query'][_0x5e68('0x49')]+'%'};return _0x4acd00;}})});}_0x21169d=_[_0x5e68('0x46')]({},_0x21169d,_0xb78470[_0x5e68('0x4a')]);var _0x57e02a={'where':_0x21169d['where']};return db['ZohoAccount'][_0x5e68('0x2e')](_0x57e02a)[_0x5e68('0x20')](function(_0xb4d4fa){_0x3c26d4['count']=_0xb4d4fa;if(_0xb78470[_0x5e68('0x39')]['includeAll']){_0x21169d[_0x5e68('0x4b')]=[{'all':!![]}];}return db['ZohoAccount'][_0x5e68('0x4c')](_0x21169d);})[_0x5e68('0x20')](function(_0x4f1886){_0x3c26d4[_0x5e68('0x4d')]=_0x4f1886;return _0x3c26d4;})[_0x5e68('0x20')](respondWithFilteredResult(_0x5a2116,_0x21169d))[_0x5e68('0x29')](handleError(_0x5a2116,null));};exports['show']=function(_0x29fb32,_0x606bd0){var _0x2bd96b={'raw':![],'where':{'id':_0x29fb32[_0x5e68('0x4e')]['id']}},_0xd62171={};_0xd62171[_0x5e68('0x3f')]=_['keys'](db[_0x5e68('0x4f')][_0x5e68('0x50')]);_0xd62171['query']=_[_0x5e68('0x3a')](_0x29fb32['query']);_0xd62171['filters']=_[_0x5e68('0x3c')](_0xd62171[_0x5e68('0x3f')],_0xd62171[_0x5e68('0x39')]);_0x2bd96b['attributes']=_[_0x5e68('0x3c')](_0xd62171[_0x5e68('0x3f')],qs[_0x5e68('0x3e')](_0x29fb32[_0x5e68('0x39')][_0x5e68('0x3e')]));_0x2bd96b['attributes']=_0x2bd96b['attributes'][_0x5e68('0x51')]?_0x2bd96b[_0x5e68('0x3d')]:_0xd62171[_0x5e68('0x3f')];if(_0x29fb32['query']['includeAll']){_0x2bd96b['include']=[{'all':!![]}];}_0x2bd96b=_['merge']({},_0x2bd96b,_0x29fb32[_0x5e68('0x4a')]);return db[_0x5e68('0x4f')][_0x5e68('0x52')](_0x2bd96b)[_0x5e68('0x20')](handleEntityNotFound(_0x606bd0,null))[_0x5e68('0x20')](respondWithResult(_0x606bd0,null))[_0x5e68('0x29')](handleError(_0x606bd0,null));};exports[_0x5e68('0x53')]=function(_0x2d801e,_0x54eeca){return db[_0x5e68('0x4f')][_0x5e68('0x53')](_0x2d801e[_0x5e68('0x54')],{})[_0x5e68('0x20')](respondWithResult(_0x54eeca,0xc9))[_0x5e68('0x29')](handleError(_0x54eeca,null));};exports[_0x5e68('0x55')]=function(_0x425724,_0x541530){if(_0x425724['body']['id']){delete _0x425724[_0x5e68('0x54')]['id'];}return db[_0x5e68('0x4f')][_0x5e68('0x52')]({'where':{'id':_0x425724[_0x5e68('0x4e')]['id']}})['then'](handleEntityNotFound(_0x541530,null))['then'](saveUpdates(_0x425724['body'],null))[_0x5e68('0x20')](respondWithResult(_0x541530,null))[_0x5e68('0x29')](handleError(_0x541530,null));};exports[_0x5e68('0x34')]=function(_0x35cafa,_0x2649d6){return db['ZohoAccount'][_0x5e68('0x52')]({'where':{'id':_0x35cafa[_0x5e68('0x4e')]['id']}})[_0x5e68('0x20')](handleEntityNotFound(_0x2649d6,null))[_0x5e68('0x20')](removeEntity(_0x2649d6,null))[_0x5e68('0x29')](handleError(_0x2649d6,null));};exports[_0x5e68('0x56')]=function(_0xd71dc8,_0x330741,_0x178507){var _0x4c5554={};var _0x149483={};var _0x5ca837;var _0x4031fc;return db[_0x5e68('0x4f')]['findOne']({'where':{'id':_0xd71dc8[_0x5e68('0x4e')]['id']}})[_0x5e68('0x20')](handleEntityNotFound(_0x330741,null))['then'](function(_0x2680fb){if(_0x2680fb){_0x5ca837=_0x2680fb;_0x149483[_0x5e68('0x3f')]=_[_0x5e68('0x3a')](db['ZohoConfiguration'][_0x5e68('0x50')]);_0x149483[_0x5e68('0x39')]=_['keys'](_0xd71dc8[_0x5e68('0x39')]);_0x149483['filters']=_[_0x5e68('0x3c')](_0x149483[_0x5e68('0x3f')],_0x149483[_0x5e68('0x39')]);_0x4c5554[_0x5e68('0x3d')]=_[_0x5e68('0x3c')](_0x149483[_0x5e68('0x3f')],qs[_0x5e68('0x3e')](_0xd71dc8[_0x5e68('0x39')][_0x5e68('0x3e')]));_0x4c5554['attributes']=_0x4c5554[_0x5e68('0x3d')][_0x5e68('0x51')]?_0x4c5554[_0x5e68('0x3d')]:_0x149483[_0x5e68('0x3f')];_0x4c5554['order']=qs[_0x5e68('0x43')](_0xd71dc8[_0x5e68('0x39')][_0x5e68('0x43')]);_0x4c5554[_0x5e68('0x45')]=qs[_0x5e68('0x3b')](_[_0x5e68('0x44')](_0xd71dc8[_0x5e68('0x39')],_0x149483[_0x5e68('0x3b')]));if(_0xd71dc8['query'][_0x5e68('0x49')]){_0x4c5554[_0x5e68('0x45')]=_['merge'](_0x4c5554[_0x5e68('0x45')],{'$or':_[_0x5e68('0x38')](_0x4c5554[_0x5e68('0x3d')],function(_0x456707){var _0x1ad911={};_0x1ad911[_0x456707]={'$like':'%'+_0xd71dc8[_0x5e68('0x39')][_0x5e68('0x49')]+'%'};return _0x1ad911;})});}_0x4c5554=_['merge']({},_0x4c5554,_0xd71dc8['options']);return _0x5ca837['getConfigurations'](_0x4c5554);}})[_0x5e68('0x20')](function(_0x2b9dc7){if(_0x2b9dc7){_0x4031fc=_0x2b9dc7[_0x5e68('0x51')];if(!_0xd71dc8[_0x5e68('0x39')][_0x5e68('0x40')](_0x5e68('0x41'))){_0x4c5554['limit']=qs[_0x5e68('0x30')](_0xd71dc8['query']['limit']);_0x4c5554[_0x5e68('0x2f')]=qs[_0x5e68('0x2f')](_0xd71dc8[_0x5e68('0x39')][_0x5e68('0x2f')]);}return _0x5ca837[_0x5e68('0x56')](_0x4c5554);}})[_0x5e68('0x20')](function(_0x541d54){if(_0x541d54){return _0x541d54?{'count':_0x4031fc,'rows':_0x541d54}:null;}})['then'](respondWithResult(_0x330741,null))[_0x5e68('0x29')](handleError(_0x330741,null));};exports[_0x5e68('0x57')]=function(_0x459fd0,_0x2f0989,_0x166ee7){if(_0x459fd0[_0x5e68('0x54')]['id']){delete _0x459fd0['body']['id'];}return db['ZohoAccount'][_0x5e68('0x58')]({'where':{'id':_0x459fd0[_0x5e68('0x4e')]['id']}})[_0x5e68('0x20')](handleEntityNotFound(_0x2f0989,null))[_0x5e68('0x20')](function(_0xe16b9a){if(_0xe16b9a){_0x459fd0[_0x5e68('0x54')]['AccountId']=_0xe16b9a['id'];_0x459fd0['body']['Subjects']=integrations[_0x5e68('0x59')](_0x459fd0[_0x5e68('0x54')]['channel'],_0x459fd0[_0x5e68('0x54')][_0x5e68('0x47')]);_0x459fd0[_0x5e68('0x54')][_0x5e68('0x5a')]=integrations['getDescriptions'](_0x459fd0[_0x5e68('0x54')]['channel'],_0x459fd0[_0x5e68('0x54')][_0x5e68('0x47')]);return db[_0x5e68('0x5b')][_0x5e68('0x53')](_0x459fd0[_0x5e68('0x54')],{'include':[{'model':db[_0x5e68('0x5c')],'as':_0x5e68('0x5d')},{'model':db[_0x5e68('0x5c')],'as':_0x5e68('0x5a')}]});}return null;})['then'](respondWithResult(_0x2f0989,null))['catch'](handleError(_0x2f0989,null));};function getAccessToken(_0x319d60){return new Promise(function(_0x4cd2bc,_0x535e52){var _0x4dc366;switch(_0x319d60[_0x5e68('0x5e')]){case'US':_0x4dc366=_0x5e68('0x5f');break;case'AU':_0x4dc366='https://accounts.zoho.com.au';break;case'EU':_0x4dc366='https://accounts.zoho.eu';break;case'IN':_0x4dc366='https://accounts.zoho.in';break;case'CN':_0x4dc366='https://accounts.zoho.com.cn';break;default:_0x4dc366='https://accounts.zoho.eu';break;}var _0x153e2d={'method':'POST','uri':_0x4dc366+_0x5e68('0x60'),'qs':{'refresh_token':_0x319d60['refreshToken'],'client_id':_0x319d60[_0x5e68('0x61')],'client_secret':_0x319d60[_0x5e68('0x62')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x153e2d)[_0x5e68('0x20')](function(_0x4ac8e3){if(_0x4ac8e3[_0x5e68('0x63')]){_0x4cd2bc(_0x4ac8e3['access_token']);}else{_0x535e52('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x4ea36c){_0x535e52(_0x4ea36c);});});}exports['getFields']=function(_0x264676,_0x59a71b,_0x3cf15e){var _0x5f6b49,_0x4d081e,_0x6b1647,_0x6b7f65,_0x433b1d;return db[_0x5e68('0x4f')][_0x5e68('0x58')]({'where':{'id':_0x264676[_0x5e68('0x4e')]['id']},'attributes':['id',_0x5e68('0x64'),_0x5e68('0x5e'),_0x5e68('0x61'),_0x5e68('0x62'),'serverUrl',_0x5e68('0x26'),_0x5e68('0x65')]})[_0x5e68('0x20')](handleEntityNotFound(_0x59a71b,null))[_0x5e68('0x20')](function(_0x349df3){_0x433b1d=_0x349df3;_0x5f6b49=_0x433b1d[_0x5e68('0x64')];_0x4d081e=_0x5f6b49==='zoho.eu'?'eu':_0x5e68('0x66');_0x6b1647=_0x433b1d[_0x5e68('0x67')];var _0x425b8e=_0x6b1647['slice'](-0x1);if(_0x425b8e==='/'||_0x425b8e==='\x5c'||_0x425b8e===':'){_0x6b1647=_0x6b1647[_0x5e68('0x68')](0x0,_0x6b1647[_0x5e68('0x69')](_0x425b8e));}if(!_0x433b1d[_0x5e68('0x65')]){throw new Error(_0x5e68('0x6a'));}return getAccessToken(_0x433b1d);})[_0x5e68('0x20')](function(_0x128931){if(_0x128931){return rp({'method':_0x5e68('0x6b'),'uri':util[_0x5e68('0x6c')](_0x5e68('0x6d'),_0x4d081e),'qs':{'module':_0x5e68('0x6e')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x128931},'json':!![]});}})[_0x5e68('0x20')](function(_0x513b60){if(_0x513b60){if(_0x513b60['response']&&_0x513b60[_0x5e68('0x6f')][_0x5e68('0x25')]){throw new Error(_0x513b60[_0x5e68('0x6f')][_0x5e68('0x25')][_0x5e68('0x28')]);}var _0x11b7eb=[];var _0x5266a6=[];var _0xcbc124=[_0x5e68('0x70'),_0x5e68('0x71'),'Description','WhoId','Call_Duration',_0x5e68('0x72'),_0x5e68('0x73'),_0x5e68('0x74')];_0x5266a6=_['remove'](_0x513b60[_0x5e68('0x3e')],function(_0x3c6fd5){return _0xcbc124[_0x5e68('0x75')](_0x3c6fd5[_0x5e68('0x76')]);});for(var _0x16aeb1=0x0;_0x16aeb1<_0x5266a6[_0x5e68('0x51')];_0x16aeb1++){if(_0x5266a6[_0x16aeb1][_0x5e68('0x77')]===![]){_0x11b7eb[_0x5e68('0x78')]({'id':_0x5266a6[_0x16aeb1]['id'],'name':_0x5266a6[_0x16aeb1][_0x5e68('0x79')],'custom':_0x5266a6[_0x16aeb1][_0x5e68('0x7a')],'options':_0x5266a6[_0x16aeb1]['data_type']==='picklist'&&_0x5266a6[_0x16aeb1]['pick_list_values'][_0x5e68('0x51')]>-0x1?_[_0x5e68('0x38')](_0x5266a6[_0x16aeb1][_0x5e68('0x7b')],function(_0x2bcfc4){return{'name':_0x2bcfc4,'value':_0x2bcfc4};}):[]});}}return{'count':_0x11b7eb[_0x5e68('0x51')],'rows':_0x11b7eb};}else{return{'count':0x0,'rows':[]};}})[_0x5e68('0x20')](respondWithResult(_0x59a71b,null))[_0x5e68('0x29')](function(_0x23c47d){var _0x332c21=_0x264676[_0x5e68('0x39')][_0x5e68('0x1c')]?0x1f4:_0x23c47d[_0x5e68('0x7c')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x332c21,JSON[_0x5e68('0x7d')](_0x23c47d));delete _0x23c47d[_0x5e68('0x36')];if(_0x332c21===0x191){_0x332c21=0x190;}_0x59a71b[_0x5e68('0x2c')](_0x332c21)['send'](_0x264676[_0x5e68('0x39')][_0x5e68('0x1c')]?{'message':_0x5e68('0x7e'),'statusCode':_0x23c47d[_0x5e68('0x7c')]}:_0x23c47d);});}; \ No newline at end of file +var _0xc3ce=['key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','rows','params','keys','ZohoAccount','create','body','catch','find','getConfigurations','findOne','ZohoConfiguration','rawAttributes','length','addConfiguration','AccountId','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','refreshToken','zoho.eu','com','serverUrl','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','response','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','display_label','data_type','picklist','pick_list_values','statusCode','Wrong\x20credentials','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','sendStatus','stack','name','send','index','fieldName','type'];(function(_0x9e5584,_0x3cd9da){var _0x28c2c1=function(_0x28f56f){while(--_0x28f56f){_0x9e5584['push'](_0x9e5584['shift']());}};_0x28c2c1(++_0x3cd9da);}(_0xc3ce,0x1e6));var _0xec3c=function(_0x4b5990,_0x3c1183){_0x4b5990=_0x4b5990-0x0;var _0x18b4d1=_0xc3ce[_0x4b5990];return _0x18b4d1;};'use strict';var pdf=require(_0xec3c('0x0'));var emlformat=require(_0xec3c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xec3c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xec3c('0x3'));var BPromise=require(_0xec3c('0x4'));var Mustache=require(_0xec3c('0x5'));var util=require(_0xec3c('0x6'));var path=require(_0xec3c('0x7'));var sox=require(_0xec3c('0x8'));var csv=require(_0xec3c('0x9'));var ejs=require(_0xec3c('0xa'));var fs=require('fs');var _=require(_0xec3c('0xb'));var squel=require('squel');var crypto=require(_0xec3c('0xc'));var jsforce=require(_0xec3c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xec3c('0x9'));var querystring=require(_0xec3c('0xe'));var Papa=require(_0xec3c('0xf'));var Redis=require('ioredis');var authService=require(_0xec3c('0x10'));var qs=require(_0xec3c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec3c('0x12'));var logger=require(_0xec3c('0x13'))(_0xec3c('0x14'));var utils=require(_0xec3c('0x15'));var config=require('../../config/environment');var db=require(_0xec3c('0x16'))['db'];var integrations=require(_0xec3c('0x17'));var jayson=require(_0xec3c('0x18'));var client=jayson[_0xec3c('0x19')][_0xec3c('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x53cd61,_0x2bf0f7,_0x474713){if(_0x474713){var _0x1407dd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1407dd[_0xec3c('0x1b')](_0x2bf0f7)){return _0x53cd61;}else{throw new db[(_0xec3c('0x1c'))][(_0xec3c('0x1d'))](_0xec3c('0x1e'));}}else{return _0x53cd61;}}function respondWithRpcPromise(_0x274182,_0x3b5b72,_0x113f85,_0x4896aa){return new BPromise(function(_0x29cb1a,_0x1c9695){var _0x484b7e=_0x4896aa||client;return _0x484b7e['request'](_0x274182,_0x113f85)[_0xec3c('0x1f')](function(_0x13990c){logger[_0xec3c('0x20')](_0xec3c('0x21'),_0x3b5b72,_0xec3c('0x22'));logger['debug'](_0xec3c('0x23'),_0x3b5b72,'request\x20sent',JSON[_0xec3c('0x24')](_0x13990c));if(_0x13990c['error']){if(_0x13990c[_0xec3c('0x25')][_0xec3c('0x26')]===0x1f4){logger[_0xec3c('0x25')](_0xec3c('0x21'),_0x3b5b72,_0x13990c[_0xec3c('0x25')]['message']);return _0x1c9695(_0x13990c['error'][_0xec3c('0x27')]);}logger['error'](_0xec3c('0x21'),_0x3b5b72,_0x13990c['error'][_0xec3c('0x27')]);return _0x29cb1a(_0x13990c[_0xec3c('0x25')][_0xec3c('0x27')]);}else{logger[_0xec3c('0x20')](_0xec3c('0x21'),_0x3b5b72,_0xec3c('0x22'));_0x29cb1a(_0x13990c['result'][_0xec3c('0x27')]);}})['catch'](function(_0x2bde1a){logger[_0xec3c('0x25')]('ZohoAccount,\x20%s,\x20%s',_0x3b5b72,_0x2bde1a);_0x1c9695(_0x2bde1a);});});}function respondWithStatusCode(_0x304b9d,_0x11e968){_0x11e968=_0x11e968||0xcc;return function(_0x23eaca){if(_0x23eaca){return _0x304b9d['sendStatus'](_0x11e968);}return _0x304b9d[_0xec3c('0x28')](_0x11e968)[_0xec3c('0x29')]();};}function respondWithResult(_0x192174,_0x36387e){_0x36387e=_0x36387e||0xc8;return function(_0x3ab1b9){if(_0x3ab1b9){return _0x192174['status'](_0x36387e)[_0xec3c('0x2a')](_0x3ab1b9);}};}function respondWithFilteredResult(_0x59e40d,_0x47b686){return function(_0x3a174f){if(_0x3a174f){var _0x330735=_0x3a174f[_0xec3c('0x2b')],_0x1783e6=_0x47b686[_0xec3c('0x2c')],_0x3c24bd=_0x47b686[_0xec3c('0x2c')]+_0x47b686[_0xec3c('0x2d')],_0x1c2179;if(_0x3c24bd>=_0x330735){_0x3c24bd=_0x330735;_0x1c2179=0xc8;}else{_0x1c2179=0xce;}_0x59e40d[_0xec3c('0x28')](_0x1c2179);return _0x59e40d[_0xec3c('0x2e')](_0xec3c('0x2f'),_0x1783e6+'-'+_0x3c24bd+'/'+_0x330735)[_0xec3c('0x2a')](_0x3a174f);}return null;};}function patchUpdates(_0x4b58b7){return function(_0x45c919){try{jsonpatch['apply'](_0x45c919,_0x4b58b7,!![]);}catch(_0x5b90d0){return BPromise[_0xec3c('0x30')](_0x5b90d0);}return _0x45c919[_0xec3c('0x31')]();};}function saveUpdates(_0x16e21a,_0x508972){return function(_0x510d1c){if(_0x510d1c){return _0x510d1c[_0xec3c('0x32')](_0x16e21a)[_0xec3c('0x1f')](function(_0x566d16){return _0x566d16;});}return null;};}function removeEntity(_0x372432,_0x263d2a){return function(_0x4de175){if(_0x4de175){return _0x4de175['destroy']()['then'](function(){_0x372432[_0xec3c('0x28')](0xcc)[_0xec3c('0x29')]();});}};}function handleEntityNotFound(_0x24edb3,_0x4e8e64){return function(_0x49ae1a){if(!_0x49ae1a){_0x24edb3[_0xec3c('0x33')](0x194);}return _0x49ae1a;};}function handleError(_0x589884,_0x5085c0){_0x5085c0=_0x5085c0||0x1f4;return function(_0x4576e2){logger['error'](_0x4576e2[_0xec3c('0x34')]);if(_0x4576e2[_0xec3c('0x35')]){delete _0x4576e2['name'];}_0x589884[_0xec3c('0x28')](_0x5085c0)[_0xec3c('0x36')](_0x4576e2);};}exports[_0xec3c('0x37')]=function(_0x3a1d5b,_0x78e89){var _0x192d06={},_0x48ca40={},_0x27f0ed={'count':0x0,'rows':[]};var _0x596751=_['map'](db['ZohoAccount']['rawAttributes'],function(_0x552b61){return{'name':_0x552b61[_0xec3c('0x38')],'type':_0x552b61[_0xec3c('0x39')][_0xec3c('0x3a')]};});_0x48ca40[_0xec3c('0x3b')]=_[_0xec3c('0x3c')](_0x596751,_0xec3c('0x35'));_0x48ca40[_0xec3c('0x3d')]=_['keys'](_0x3a1d5b[_0xec3c('0x3d')]);_0x48ca40[_0xec3c('0x3e')]=_['intersection'](_0x48ca40[_0xec3c('0x3b')],_0x48ca40['query']);_0x192d06[_0xec3c('0x3f')]=_[_0xec3c('0x40')](_0x48ca40[_0xec3c('0x3b')],qs[_0xec3c('0x41')](_0x3a1d5b[_0xec3c('0x3d')][_0xec3c('0x41')]));_0x192d06[_0xec3c('0x3f')]=_0x192d06[_0xec3c('0x3f')]['length']?_0x192d06[_0xec3c('0x3f')]:_0x48ca40['model'];if(!_0x3a1d5b[_0xec3c('0x3d')][_0xec3c('0x42')](_0xec3c('0x43'))){_0x192d06[_0xec3c('0x2d')]=qs[_0xec3c('0x2d')](_0x3a1d5b[_0xec3c('0x3d')][_0xec3c('0x2d')]);_0x192d06[_0xec3c('0x2c')]=qs[_0xec3c('0x2c')](_0x3a1d5b[_0xec3c('0x3d')][_0xec3c('0x2c')]);}_0x192d06['order']=qs[_0xec3c('0x44')](_0x3a1d5b['query']['sort']);_0x192d06['where']=qs['filters'](_[_0xec3c('0x45')](_0x3a1d5b[_0xec3c('0x3d')],_0x48ca40[_0xec3c('0x3e')]));if(_0x3a1d5b['query']['filter']){_0x192d06['where']=_[_0xec3c('0x46')](_0x192d06[_0xec3c('0x47')],{'$or':_[_0xec3c('0x3c')](_0x596751,function(_0xc78d53){if(_0xc78d53['type']!==_0xec3c('0x48')){var _0x4c96b9={};_0x4c96b9[_0xc78d53[_0xec3c('0x35')]]={'$like':'%'+_0x3a1d5b[_0xec3c('0x3d')][_0xec3c('0x49')]+'%'};return _0x4c96b9;}})});}_0x192d06=_[_0xec3c('0x46')]({},_0x192d06,_0x3a1d5b[_0xec3c('0x4a')]);var _0x27ce05={'where':_0x192d06[_0xec3c('0x47')]};return db['ZohoAccount'][_0xec3c('0x2b')](_0x27ce05)[_0xec3c('0x1f')](function(_0x13a2f1){_0x27f0ed[_0xec3c('0x2b')]=_0x13a2f1;if(_0x3a1d5b[_0xec3c('0x3d')][_0xec3c('0x4b')]){_0x192d06[_0xec3c('0x4c')]=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x192d06);})[_0xec3c('0x1f')](function(_0x413224){_0x27f0ed[_0xec3c('0x4d')]=_0x413224;return _0x27f0ed;})['then'](respondWithFilteredResult(_0x78e89,_0x192d06))['catch'](handleError(_0x78e89,null));};exports['show']=function(_0x5447b3,_0x352282){var _0x1b80d3={'raw':![],'where':{'id':_0x5447b3[_0xec3c('0x4e')]['id']}},_0x254dec={};_0x254dec['model']=_['keys'](db['ZohoAccount']['rawAttributes']);_0x254dec[_0xec3c('0x3d')]=_[_0xec3c('0x4f')](_0x5447b3['query']);_0x254dec[_0xec3c('0x3e')]=_['intersection'](_0x254dec[_0xec3c('0x3b')],_0x254dec[_0xec3c('0x3d')]);_0x1b80d3['attributes']=_[_0xec3c('0x40')](_0x254dec['model'],qs[_0xec3c('0x41')](_0x5447b3[_0xec3c('0x3d')][_0xec3c('0x41')]));_0x1b80d3[_0xec3c('0x3f')]=_0x1b80d3[_0xec3c('0x3f')]['length']?_0x1b80d3[_0xec3c('0x3f')]:_0x254dec[_0xec3c('0x3b')];if(_0x5447b3['query'][_0xec3c('0x4b')]){_0x1b80d3[_0xec3c('0x4c')]=[{'all':!![]}];}_0x1b80d3=_[_0xec3c('0x46')]({},_0x1b80d3,_0x5447b3[_0xec3c('0x4a')]);return db[_0xec3c('0x50')]['find'](_0x1b80d3)[_0xec3c('0x1f')](handleEntityNotFound(_0x352282,null))[_0xec3c('0x1f')](respondWithResult(_0x352282,null))['catch'](handleError(_0x352282,null));};exports[_0xec3c('0x51')]=function(_0x156e03,_0x140d15){return db[_0xec3c('0x50')][_0xec3c('0x51')](_0x156e03[_0xec3c('0x52')],{})['then'](respondWithResult(_0x140d15,0xc9))[_0xec3c('0x53')](handleError(_0x140d15,null));};exports['update']=function(_0x271670,_0x41a627){if(_0x271670[_0xec3c('0x52')]['id']){delete _0x271670[_0xec3c('0x52')]['id'];}return db[_0xec3c('0x50')][_0xec3c('0x54')]({'where':{'id':_0x271670[_0xec3c('0x4e')]['id']}})[_0xec3c('0x1f')](handleEntityNotFound(_0x41a627,null))[_0xec3c('0x1f')](saveUpdates(_0x271670[_0xec3c('0x52')],null))[_0xec3c('0x1f')](respondWithResult(_0x41a627,null))[_0xec3c('0x53')](handleError(_0x41a627,null));};exports['destroy']=function(_0x414d38,_0x334c4f){return db[_0xec3c('0x50')]['find']({'where':{'id':_0x414d38[_0xec3c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x334c4f,null))['then'](removeEntity(_0x334c4f,null))['catch'](handleError(_0x334c4f,null));};exports[_0xec3c('0x55')]=function(_0x18e466,_0x259c7c,_0x55e1f4){var _0x533484={};var _0x2d9967={};var _0x35999d;var _0x4f0ee4;return db[_0xec3c('0x50')][_0xec3c('0x56')]({'where':{'id':_0x18e466[_0xec3c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x259c7c,null))['then'](function(_0x206215){if(_0x206215){_0x35999d=_0x206215;_0x2d9967[_0xec3c('0x3b')]=_[_0xec3c('0x4f')](db[_0xec3c('0x57')][_0xec3c('0x58')]);_0x2d9967['query']=_[_0xec3c('0x4f')](_0x18e466[_0xec3c('0x3d')]);_0x2d9967[_0xec3c('0x3e')]=_[_0xec3c('0x40')](_0x2d9967[_0xec3c('0x3b')],_0x2d9967[_0xec3c('0x3d')]);_0x533484[_0xec3c('0x3f')]=_[_0xec3c('0x40')](_0x2d9967[_0xec3c('0x3b')],qs[_0xec3c('0x41')](_0x18e466['query'][_0xec3c('0x41')]));_0x533484[_0xec3c('0x3f')]=_0x533484[_0xec3c('0x3f')]['length']?_0x533484[_0xec3c('0x3f')]:_0x2d9967[_0xec3c('0x3b')];_0x533484['order']=qs[_0xec3c('0x44')](_0x18e466[_0xec3c('0x3d')][_0xec3c('0x44')]);_0x533484[_0xec3c('0x47')]=qs[_0xec3c('0x3e')](_[_0xec3c('0x45')](_0x18e466[_0xec3c('0x3d')],_0x2d9967[_0xec3c('0x3e')]));if(_0x18e466[_0xec3c('0x3d')]['filter']){_0x533484[_0xec3c('0x47')]=_[_0xec3c('0x46')](_0x533484[_0xec3c('0x47')],{'$or':_[_0xec3c('0x3c')](_0x533484['attributes'],function(_0x57bd14){var _0x1214e6={};_0x1214e6[_0x57bd14]={'$like':'%'+_0x18e466[_0xec3c('0x3d')][_0xec3c('0x49')]+'%'};return _0x1214e6;})});}_0x533484=_['merge']({},_0x533484,_0x18e466[_0xec3c('0x4a')]);return _0x35999d['getConfigurations'](_0x533484);}})['then'](function(_0x59caed){if(_0x59caed){_0x4f0ee4=_0x59caed[_0xec3c('0x59')];if(!_0x18e466[_0xec3c('0x3d')][_0xec3c('0x42')]('nolimit')){_0x533484[_0xec3c('0x2d')]=qs['limit'](_0x18e466['query'][_0xec3c('0x2d')]);_0x533484[_0xec3c('0x2c')]=qs[_0xec3c('0x2c')](_0x18e466[_0xec3c('0x3d')][_0xec3c('0x2c')]);}return _0x35999d['getConfigurations'](_0x533484);}})[_0xec3c('0x1f')](function(_0x132538){if(_0x132538){return _0x132538?{'count':_0x4f0ee4,'rows':_0x132538}:null;}})[_0xec3c('0x1f')](respondWithResult(_0x259c7c,null))[_0xec3c('0x53')](handleError(_0x259c7c,null));};exports[_0xec3c('0x5a')]=function(_0x32cbff,_0x41ffa0,_0x33ac44){if(_0x32cbff[_0xec3c('0x52')]['id']){delete _0x32cbff['body']['id'];}return db[_0xec3c('0x50')]['findOne']({'where':{'id':_0x32cbff['params']['id']}})[_0xec3c('0x1f')](handleEntityNotFound(_0x41ffa0,null))['then'](function(_0x339e90){if(_0x339e90){_0x32cbff[_0xec3c('0x52')][_0xec3c('0x5b')]=_0x339e90['id'];_0x32cbff['body']['Subjects']=integrations[_0xec3c('0x5c')](_0x32cbff['body'][_0xec3c('0x5d')],_0x32cbff[_0xec3c('0x52')][_0xec3c('0x39')]);_0x32cbff['body'][_0xec3c('0x5e')]=integrations['getDescriptions'](_0x32cbff[_0xec3c('0x52')][_0xec3c('0x5d')],_0x32cbff['body']['type']);return db[_0xec3c('0x57')]['create'](_0x32cbff[_0xec3c('0x52')],{'include':[{'model':db[_0xec3c('0x5f')],'as':'Subjects'},{'model':db[_0xec3c('0x5f')],'as':_0xec3c('0x5e')}]});}return null;})[_0xec3c('0x1f')](respondWithResult(_0x41ffa0,null))[_0xec3c('0x53')](handleError(_0x41ffa0,null));};function getAccessToken(_0x398648){return new Promise(function(_0x29af7a,_0x36a75d){var _0x19870a;switch(_0x398648[_0xec3c('0x60')]){case'US':_0x19870a=_0xec3c('0x61');break;case'AU':_0x19870a=_0xec3c('0x62');break;case'EU':_0x19870a=_0xec3c('0x63');break;case'IN':_0x19870a=_0xec3c('0x64');break;case'CN':_0x19870a=_0xec3c('0x65');break;default:_0x19870a='https://accounts.zoho.eu';break;}var _0x37513e={'method':_0xec3c('0x66'),'uri':_0x19870a+_0xec3c('0x67'),'qs':{'refresh_token':_0x398648['refreshToken'],'client_id':_0x398648['clientId'],'client_secret':_0x398648['clientSecret'],'grant_type':_0xec3c('0x68')},'json':!![]};return rp(_0x37513e)[_0xec3c('0x1f')](function(_0x5e9c38){if(_0x5e9c38['access_token']){_0x29af7a(_0x5e9c38['access_token']);}else{_0x36a75d(_0xec3c('0x69'));}})[_0xec3c('0x53')](function(_0x3c4def){_0x36a75d(_0x3c4def);});});}exports[_0xec3c('0x6a')]=function(_0x2ce7d8,_0x2b3d7a,_0x20a68d){var _0x43c2b1,_0x222ffc,_0x10a910,_0x395539,_0x539e5c;return db[_0xec3c('0x50')][_0xec3c('0x56')]({'where':{'id':_0x2ce7d8['params']['id']},'attributes':['id',_0xec3c('0x6b'),'zone',_0xec3c('0x6c'),'clientSecret','serverUrl','code',_0xec3c('0x6d')]})['then'](handleEntityNotFound(_0x2b3d7a,null))[_0xec3c('0x1f')](function(_0x48162e){_0x539e5c=_0x48162e;_0x43c2b1=_0x539e5c[_0xec3c('0x6b')];_0x222ffc=_0x43c2b1===_0xec3c('0x6e')?'eu':_0xec3c('0x6f');_0x10a910=_0x539e5c[_0xec3c('0x70')];var _0x3fb310=_0x10a910['slice'](-0x1);if(_0x3fb310==='/'||_0x3fb310==='\x5c'||_0x3fb310===':'){_0x10a910=_0x10a910[_0xec3c('0x71')](0x0,_0x10a910[_0xec3c('0x72')](_0x3fb310));}if(!_0x539e5c[_0xec3c('0x6d')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x539e5c);})[_0xec3c('0x1f')](function(_0x22c9fc){if(_0x22c9fc){return rp({'method':_0xec3c('0x73'),'uri':util[_0xec3c('0x74')](_0xec3c('0x75'),_0x222ffc),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x22c9fc},'json':!![]});}})[_0xec3c('0x1f')](function(_0x28e648){if(_0x28e648){if(_0x28e648[_0xec3c('0x76')]&&_0x28e648['response'][_0xec3c('0x25')]){throw new Error(_0x28e648[_0xec3c('0x76')]['error'][_0xec3c('0x27')]);}var _0x3bd022=[];var _0x3e31f4=[];var _0x10df29=[_0xec3c('0x77'),_0xec3c('0x78'),'Description',_0xec3c('0x79'),_0xec3c('0x7a'),_0xec3c('0x7b'),_0xec3c('0x7c'),_0xec3c('0x7d')];_0x3e31f4=_[_0xec3c('0x7e')](_0x28e648[_0xec3c('0x41')],function(_0x53a958){return _0x10df29[_0xec3c('0x7f')](_0x53a958[_0xec3c('0x80')]);});for(var _0x2e26c1=0x0;_0x2e26c1<_0x3e31f4['length'];_0x2e26c1++){if(_0x3e31f4[_0x2e26c1][_0xec3c('0x81')]===![]){_0x3bd022['push']({'id':_0x3e31f4[_0x2e26c1]['id'],'name':_0x3e31f4[_0x2e26c1][_0xec3c('0x82')],'custom':_0x3e31f4[_0x2e26c1]['custom_field'],'options':_0x3e31f4[_0x2e26c1][_0xec3c('0x83')]===_0xec3c('0x84')&&_0x3e31f4[_0x2e26c1][_0xec3c('0x85')][_0xec3c('0x59')]>-0x1?_[_0xec3c('0x3c')](_0x3e31f4[_0x2e26c1][_0xec3c('0x85')],function(_0x4c2b13){return{'name':_0x4c2b13,'value':_0x4c2b13};}):[]});}}return{'count':_0x3bd022[_0xec3c('0x59')],'rows':_0x3bd022};}else{return{'count':0x0,'rows':[]};}})[_0xec3c('0x1f')](respondWithResult(_0x2b3d7a,null))[_0xec3c('0x53')](function(_0x50aaed){var _0x39986f=_0x2ce7d8[_0xec3c('0x3d')][_0xec3c('0x1b')]?0x1f4:_0x50aaed[_0xec3c('0x86')]||0x1f4;logger[_0xec3c('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x39986f,JSON[_0xec3c('0x24')](_0x50aaed));delete _0x50aaed[_0xec3c('0x35')];if(_0x39986f===0x191){_0x39986f=0x190;}_0x2b3d7a[_0xec3c('0x28')](_0x39986f)['send'](_0x2ce7d8[_0xec3c('0x3d')][_0xec3c('0x1b')]?{'message':_0xec3c('0x87'),'statusCode':_0x50aaed[_0xec3c('0x86')]}:_0x50aaed);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 7bf97f3..21a32e0 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 _0x7c60=['slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','clientSecret','then','parse','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','https://accounts.zoho.com','POST','/oauth/v2/token','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','code','host'];(function(_0x1b29a8,_0x4310db){var _0x12acc8=function(_0x203cb2){while(--_0x203cb2){_0x1b29a8['push'](_0x1b29a8['shift']());}};_0x12acc8(++_0x4310db);}(_0x7c60,0x10c));var _0x07c6=function(_0x35178e,_0x5dd7ff){_0x35178e=_0x35178e-0x0;var _0x52bda2=_0x7c60[_0x35178e];return _0x52bda2;};'use strict';var _=require(_0x07c6('0x0'));var util=require(_0x07c6('0x1'));var logger=require('../../config/logger')(_0x07c6('0x2'));var moment=require(_0x07c6('0x3'));var BPromise=require(_0x07c6('0x4'));var rp=require(_0x07c6('0x5'));var fs=require('fs');var path=require(_0x07c6('0x6'));var rimraf=require(_0x07c6('0x7'));var config=require('../../config/environment');var attributes=require(_0x07c6('0x8'));var integrations=require(_0x07c6('0x9'));module[_0x07c6('0xa')]=function(_0x4bed91,_0x351892){return _0x4bed91[_0x07c6('0xb')]('ZohoAccount',attributes,{'tableName':_0x07c6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x34d0b1,_0x43b763,_0x38a38c){if(_0x34d0b1[_0x07c6('0xd')](_0x07c6('0xe'))||_0x34d0b1['changed'](_0x07c6('0xf'))||_0x34d0b1['changed'](_0x07c6('0x10'))||_0x34d0b1[_0x07c6('0xd')]('clientSecret')||_0x34d0b1[_0x07c6('0xd')](_0x07c6('0x11'))||_0x34d0b1[_0x07c6('0xd')](_0x07c6('0x12'))){var _0x24bc50,_0x1e6f82;_0x24bc50=_0x34d0b1[_0x07c6('0xf')];var _0x31893f=_0x24bc50[_0x07c6('0x13')](-0x1);if(_0x31893f==='/'||_0x31893f==='\x5c'||_0x31893f===':'){_0x24bc50=_0x24bc50[_0x07c6('0x14')](0x0,_0x24bc50[_0x07c6('0x15')](_0x31893f));}switch(_0x34d0b1[_0x07c6('0xe')]){case'US':_0x1e6f82='https://accounts.zoho.com';break;case'AU':_0x1e6f82=_0x07c6('0x16');break;case'IN':_0x1e6f82=_0x07c6('0x17');break;case'CN':_0x1e6f82=_0x07c6('0x18');break;default:_0x1e6f82=_0x07c6('0x19');break;}var _0x513e05={'method':'POST','uri':_0x1e6f82+'/oauth/v2/token','form':{'grant_type':_0x07c6('0x1a'),'client_id':_0x34d0b1[_0x07c6('0x10')],'client_secret':_0x34d0b1[_0x07c6('0x1b')],'redirect_uri':_0x34d0b1[_0x07c6('0xf')],'code':_0x34d0b1[_0x07c6('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x513e05)[_0x07c6('0x1c')](function(_0x4aad6d){var _0x93bf3e=JSON[_0x07c6('0x1d')](_0x4aad6d);if(_0x93bf3e[_0x07c6('0x1e')]){_0x34d0b1['refreshToken']=_0x93bf3e[_0x07c6('0x1e')];logger[_0x07c6('0x1f')](util['format'](_0x07c6('0x20'),_0x34d0b1[_0x07c6('0x21')],_0x34d0b1['id']));}else{logger[_0x07c6('0x22')](util[_0x07c6('0x23')](_0x07c6('0x24'),_0x34d0b1[_0x07c6('0x21')],_0x34d0b1['id']),util['inspect'](_0x93bf3e,{'showHidden':![],'depth':null}));}return _0x38a38c(null,_0x43b763);})['catch'](function(_0xcafe4){logger['error'](util[_0x07c6('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x34d0b1['name'],_0x34d0b1['id']),util[_0x07c6('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x38a38c(_0xcafe4);});}else{return _0x38a38c(null,_0x43b763);}},'beforeUpdate':function(_0x20dbad,_0x2b58a2,_0x1781aa){if(_0x20dbad[_0x07c6('0xd')]('zone')||_0x20dbad[_0x07c6('0xd')]('serverUrl')||_0x20dbad['changed'](_0x07c6('0x10'))||_0x20dbad[_0x07c6('0xd')](_0x07c6('0x1b'))||_0x20dbad[_0x07c6('0xd')](_0x07c6('0x11'))||_0x20dbad['changed'](_0x07c6('0x12'))){var _0x961a3e,_0x465bfa;_0x961a3e=_0x20dbad[_0x07c6('0xf')];var _0x216704=_0x961a3e['slice'](-0x1);if(_0x216704==='/'||_0x216704==='\x5c'||_0x216704===':'){_0x961a3e=_0x961a3e[_0x07c6('0x14')](0x0,_0x961a3e['lastIndexOf'](_0x216704));}switch(_0x20dbad[_0x07c6('0xe')]){case'US':_0x465bfa=_0x07c6('0x26');break;case'AU':_0x465bfa=_0x07c6('0x16');break;case'IN':_0x465bfa=_0x07c6('0x17');break;case'CN':_0x465bfa=_0x07c6('0x18');break;default:_0x465bfa=_0x07c6('0x19');break;}var _0x48c812={'method':_0x07c6('0x27'),'uri':_0x465bfa+_0x07c6('0x28'),'form':{'grant_type':'authorization_code','client_id':_0x20dbad[_0x07c6('0x10')],'client_secret':_0x20dbad['clientSecret'],'redirect_uri':_0x20dbad[_0x07c6('0xf')],'code':_0x20dbad[_0x07c6('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x48c812)[_0x07c6('0x1c')](function(_0x16a78c){var _0x2b56f8=JSON['parse'](_0x16a78c);if(_0x2b56f8[_0x07c6('0x1e')]){_0x20dbad['refreshToken']=_0x2b56f8[_0x07c6('0x1e')];logger[_0x07c6('0x1f')](util[_0x07c6('0x23')](_0x07c6('0x20'),_0x20dbad[_0x07c6('0x21')],_0x20dbad['id']));}else{logger[_0x07c6('0x22')](util['format'](_0x07c6('0x24'),_0x20dbad[_0x07c6('0x21')],_0x20dbad['id']),util[_0x07c6('0x25')](_0x2b56f8,{'showHidden':![],'depth':null}));}return _0x1781aa(null,_0x2b58a2);})['catch'](function(_0x43c3a4){logger['error'](util[_0x07c6('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x20dbad[_0x07c6('0x21')],_0x20dbad['id']),util[_0x07c6('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x1781aa(_0x43c3a4);});}else{return _0x1781aa(null,_0x2b58a2);}}}});}; \ No newline at end of file +var _0xdf84=['error','name','https://accounts.zoho.in','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','ZohoAccount','zone','serverUrl','clientId','changed','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','then','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch'];(function(_0x24902c,_0x424ef4){var _0x503a24=function(_0x4ac668){while(--_0x4ac668){_0x24902c['push'](_0x24902c['shift']());}};_0x503a24(++_0x424ef4);}(_0xdf84,0x114));var _0x4df8=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0xdf84[_0x3cf4d3];return _0x4e547b;};'use strict';var _=require(_0x4df8('0x0'));var util=require(_0x4df8('0x1'));var logger=require(_0x4df8('0x2'))('api');var moment=require(_0x4df8('0x3'));var BPromise=require(_0x4df8('0x4'));var rp=require(_0x4df8('0x5'));var fs=require('fs');var path=require(_0x4df8('0x6'));var rimraf=require(_0x4df8('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x4df8('0x8')]=function(_0x1bfe74,_0x478fc7){return _0x1bfe74[_0x4df8('0x9')](_0x4df8('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x10fd11,_0x454a94,_0x41f7c5){if(_0x10fd11['changed'](_0x4df8('0xb'))||_0x10fd11['changed'](_0x4df8('0xc'))||_0x10fd11['changed'](_0x4df8('0xd'))||_0x10fd11[_0x4df8('0xe')](_0x4df8('0xf'))||_0x10fd11[_0x4df8('0xe')](_0x4df8('0x10'))||_0x10fd11['changed'](_0x4df8('0x11'))){var _0xfd7cc0,_0x2b1e5a;_0xfd7cc0=_0x10fd11[_0x4df8('0xc')];var _0x5ed4d6=_0xfd7cc0[_0x4df8('0x12')](-0x1);if(_0x5ed4d6==='/'||_0x5ed4d6==='\x5c'||_0x5ed4d6===':'){_0xfd7cc0=_0xfd7cc0[_0x4df8('0x13')](0x0,_0xfd7cc0[_0x4df8('0x14')](_0x5ed4d6));}switch(_0x10fd11[_0x4df8('0xb')]){case'US':_0x2b1e5a=_0x4df8('0x15');break;case'AU':_0x2b1e5a=_0x4df8('0x16');break;case'IN':_0x2b1e5a='https://accounts.zoho.in';break;case'CN':_0x2b1e5a=_0x4df8('0x17');break;default:_0x2b1e5a=_0x4df8('0x18');break;}var _0x55332b={'method':_0x4df8('0x19'),'uri':_0x2b1e5a+_0x4df8('0x1a'),'form':{'grant_type':_0x4df8('0x1b'),'client_id':_0x10fd11[_0x4df8('0xd')],'client_secret':_0x10fd11[_0x4df8('0xf')],'redirect_uri':_0x10fd11[_0x4df8('0xc')],'code':_0x10fd11[_0x4df8('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x55332b)[_0x4df8('0x1c')](function(_0x523604){var _0x50974c=JSON['parse'](_0x523604);if(_0x50974c[_0x4df8('0x1d')]){_0x10fd11[_0x4df8('0x1e')]=_0x50974c[_0x4df8('0x1d')];logger['info'](util[_0x4df8('0x1f')](_0x4df8('0x20'),_0x10fd11['name'],_0x10fd11['id']));}else{logger['error'](util[_0x4df8('0x1f')](_0x4df8('0x21'),_0x10fd11['name'],_0x10fd11['id']),util[_0x4df8('0x22')](_0x50974c,{'showHidden':![],'depth':null}));}return _0x41f7c5(null,_0x454a94);})[_0x4df8('0x23')](function(_0x166b81){logger[_0x4df8('0x24')](util[_0x4df8('0x1f')](_0x4df8('0x21'),_0x10fd11[_0x4df8('0x25')],_0x10fd11['id']),util[_0x4df8('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x41f7c5(_0x166b81);});}else{return _0x41f7c5(null,_0x454a94);}},'beforeUpdate':function(_0x38e007,_0x2ccd78,_0x79e11a){if(_0x38e007[_0x4df8('0xe')](_0x4df8('0xb'))||_0x38e007['changed'](_0x4df8('0xc'))||_0x38e007[_0x4df8('0xe')](_0x4df8('0xd'))||_0x38e007['changed'](_0x4df8('0xf'))||_0x38e007[_0x4df8('0xe')](_0x4df8('0x10'))||_0x38e007[_0x4df8('0xe')](_0x4df8('0x11'))){var _0x49d5ab,_0x5d5398;_0x49d5ab=_0x38e007[_0x4df8('0xc')];var _0x38c691=_0x49d5ab[_0x4df8('0x12')](-0x1);if(_0x38c691==='/'||_0x38c691==='\x5c'||_0x38c691===':'){_0x49d5ab=_0x49d5ab[_0x4df8('0x13')](0x0,_0x49d5ab[_0x4df8('0x14')](_0x38c691));}switch(_0x38e007['zone']){case'US':_0x5d5398='https://accounts.zoho.com';break;case'AU':_0x5d5398='https://accounts.zoho.com.au';break;case'IN':_0x5d5398=_0x4df8('0x26');break;case'CN':_0x5d5398=_0x4df8('0x17');break;default:_0x5d5398=_0x4df8('0x18');break;}var _0x2cdbe5={'method':_0x4df8('0x19'),'uri':_0x5d5398+_0x4df8('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x38e007['clientId'],'client_secret':_0x38e007[_0x4df8('0xf')],'redirect_uri':_0x38e007['serverUrl'],'code':_0x38e007[_0x4df8('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2cdbe5)[_0x4df8('0x1c')](function(_0x2e8881){var _0x1ea1d7=JSON['parse'](_0x2e8881);if(_0x1ea1d7['refresh_token']){_0x38e007[_0x4df8('0x1e')]=_0x1ea1d7[_0x4df8('0x1d')];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x38e007[_0x4df8('0x25')],_0x38e007['id']));}else{logger[_0x4df8('0x24')](util[_0x4df8('0x1f')](_0x4df8('0x21'),_0x38e007['name'],_0x38e007['id']),util[_0x4df8('0x22')](_0x1ea1d7,{'showHidden':![],'depth':null}));}return _0x79e11a(null,_0x2ccd78);})[_0x4df8('0x23')](function(_0x520a86){logger[_0x4df8('0x24')](util[_0x4df8('0x1f')](_0x4df8('0x21'),_0x38e007[_0x4df8('0x25')],_0x38e007['id']),util[_0x4df8('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x79e11a(_0x520a86);});}else{return _0x79e11a(null,_0x2ccd78);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index e063cc9..d08049d 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 _0x765a=['stringify','error','code','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','ZohoAccount,\x20%s,\x20%s','debug'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0x765a,0xbe));var _0xa765=function(_0x4052c0,_0x4271ab){_0x4052c0=_0x4052c0-0x0;var _0x296f04=_0x765a[_0x4052c0];return _0x296f04;};'use strict';var _=require(_0xa765('0x0'));var util=require('util');var moment=require(_0xa765('0x1'));var BPromise=require(_0xa765('0x2'));var rs=require(_0xa765('0x3'));var fs=require('fs');var Redis=require(_0xa765('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa765('0x5'));var logger=require('../../config/logger')(_0xa765('0x6'));var config=require(_0xa765('0x7'));var jayson=require(_0xa765('0x8'));var client=jayson[_0xa765('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17f6bb,_0x15b5ed,_0x2761a7){return new BPromise(function(_0x381aaf,_0x59feb6){return client[_0xa765('0xa')](_0x17f6bb,_0x2761a7)[_0xa765('0xb')](function(_0xae1f6d){logger['info'](_0xa765('0xc'),_0x15b5ed,'request\x20sent');logger[_0xa765('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x15b5ed,'request\x20sent',JSON[_0xa765('0xe')](_0xae1f6d));if(_0xae1f6d['error']){if(_0xae1f6d[_0xa765('0xf')][_0xa765('0x10')]===0x1f4){logger[_0xa765('0xf')](_0xa765('0xc'),_0x15b5ed,_0xae1f6d['error'][_0xa765('0x11')]);return _0x59feb6(_0xae1f6d['error']['message']);}logger[_0xa765('0xf')](_0xa765('0xc'),_0x15b5ed,_0xae1f6d['error'][_0xa765('0x11')]);return _0x381aaf(_0xae1f6d['error']['message']);}else{logger[_0xa765('0x12')](_0xa765('0xc'),_0x15b5ed,'request\x20sent');_0x381aaf(_0xae1f6d[_0xa765('0x13')][_0xa765('0x11')]);}})[_0xa765('0x14')](function(_0x42b44c){logger[_0xa765('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x15b5ed,_0x42b44c);_0x59feb6(_0x42b44c);});});}exports[_0xa765('0x15')]=function(_0x453980){var _0x333c1b=this;return new Promise(function(_0x5db821,_0x22d118){return db[_0xa765('0x16')][_0xa765('0x17')]({'raw':_0x453980['options']?_0x453980[_0xa765('0x18')][_0xa765('0x19')]===undefined?!![]:![]:!![],'where':_0x453980[_0xa765('0x18')]?_0x453980[_0xa765('0x18')][_0xa765('0x1a')]||null:null,'attributes':_0x453980['options']?_0x453980[_0xa765('0x18')][_0xa765('0x1b')]||null:null,'limit':_0x453980['options']?_0x453980['options'][_0xa765('0x1c')]||null:null,'include':_0x453980[_0xa765('0x18')]?_0x453980[_0xa765('0x18')][_0xa765('0x1d')]?_[_0xa765('0x1e')](_0x453980[_0xa765('0x18')][_0xa765('0x1d')],function(_0x48decf){return{'model':db[_0x48decf[_0xa765('0x1f')]],'as':_0x48decf['as'],'attributes':_0x48decf[_0xa765('0x1b')],'include':_0x48decf[_0xa765('0x1d')]?_[_0xa765('0x1e')](_0x48decf[_0xa765('0x1d')],function(_0x49667c){return{'model':db[_0x49667c['model']],'as':_0x49667c['as'],'attributes':_0x49667c['attributes'],'include':_0x49667c[_0xa765('0x1d')]?_[_0xa765('0x1e')](_0x49667c[_0xa765('0x1d')],function(_0x4fa2b6){return{'model':db[_0x4fa2b6[_0xa765('0x1f')]],'as':_0x4fa2b6['as'],'attributes':_0x4fa2b6[_0xa765('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa765('0xb')](function(_0x45b483){logger[_0xa765('0x12')](_0xa765('0x15'),_0x453980);logger[_0xa765('0xd')]('GetZohoAccount',_0x453980,JSON[_0xa765('0xe')](_0x45b483));_0x5db821(_0x45b483);})[_0xa765('0x14')](function(_0x71ea60){logger[_0xa765('0xf')](_0xa765('0x15'),_0x71ea60[_0xa765('0x11')],_0x453980);_0x22d118(_0x333c1b[_0xa765('0xf')](0x1f4,_0x71ea60[_0xa765('0x11')]));});});};exports[_0xa765('0x20')]=function(_0x358d61){var _0xee3f56=this;return new Promise(function(_0x310ba8,_0x3ee45e){return db['ZohoAccount'][_0xa765('0x21')]({'raw':_0x358d61['options']?_0x358d61[_0xa765('0x18')][_0xa765('0x19')]===undefined?!![]:![]:!![],'where':_0x358d61['options']?_0x358d61['options'][_0xa765('0x1a')]||null:null,'attributes':_0x358d61[_0xa765('0x18')]?_0x358d61['options']['attributes']||null:null,'include':_0x358d61[_0xa765('0x18')]?_0x358d61[_0xa765('0x18')]['include']?_[_0xa765('0x1e')](_0x358d61[_0xa765('0x18')][_0xa765('0x1d')],function(_0x5904cb){return{'model':db[_0x5904cb[_0xa765('0x1f')]],'as':_0x5904cb['as'],'attributes':_0x5904cb['attributes'],'include':_0x5904cb[_0xa765('0x1d')]?_['map'](_0x5904cb[_0xa765('0x1d')],function(_0x76c93a){return{'model':db[_0x76c93a[_0xa765('0x1f')]],'as':_0x76c93a['as'],'attributes':_0x76c93a[_0xa765('0x1b')],'include':_0x76c93a[_0xa765('0x1d')]?_[_0xa765('0x1e')](_0x76c93a[_0xa765('0x1d')],function(_0x991df9){return{'model':db[_0x991df9[_0xa765('0x1f')]],'as':_0x991df9['as'],'attributes':_0x991df9[_0xa765('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa765('0xb')](function(_0x514a5a){logger[_0xa765('0x12')]('ShowZohoAccount',_0x358d61);logger[_0xa765('0xd')](_0xa765('0x20'),_0x358d61,JSON[_0xa765('0xe')](_0x514a5a));_0x310ba8(_0x514a5a);})[_0xa765('0x14')](function(_0x3babe3){logger[_0xa765('0xf')]('ShowZohoAccount',_0x3babe3[_0xa765('0x11')],_0x358d61);_0x3ee45e(_0xee3f56[_0xa765('0xf')](0x1f4,_0x3babe3[_0xa765('0x11')]));});});}; \ No newline at end of file +var _0xa969=['lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','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','GetZohoAccount','ZohoAccount','options','raw','attributes','include','map','model','ShowZohoAccount','find','where'];(function(_0x23cc7d,_0x553e85){var _0x41abb3=function(_0x3cbbde){while(--_0x3cbbde){_0x23cc7d['push'](_0x23cc7d['shift']());}};_0x41abb3(++_0x553e85);}(_0xa969,0x16b));var _0x9a96=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa969[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x9a96('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9a96('0x1'));var fs=require('fs');var Redis=require(_0x9a96('0x2'));var db=require(_0x9a96('0x3'))['db'];var utils=require(_0x9a96('0x4'));var logger=require('../../config/logger')(_0x9a96('0x5'));var config=require('../../config/environment');var jayson=require(_0x9a96('0x6'));var client=jayson[_0x9a96('0x7')][_0x9a96('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19aa01,_0x4d1c30,_0xbe500){return new BPromise(function(_0x1a417d,_0x3b1a80){return client[_0x9a96('0x9')](_0x19aa01,_0xbe500)[_0x9a96('0xa')](function(_0x510e4c){logger[_0x9a96('0xb')](_0x9a96('0xc'),_0x4d1c30,_0x9a96('0xd'));logger[_0x9a96('0xe')](_0x9a96('0xf'),_0x4d1c30,_0x9a96('0xd'),JSON[_0x9a96('0x10')](_0x510e4c));if(_0x510e4c[_0x9a96('0x11')]){if(_0x510e4c['error'][_0x9a96('0x12')]===0x1f4){logger['error'](_0x9a96('0xc'),_0x4d1c30,_0x510e4c[_0x9a96('0x11')]['message']);return _0x3b1a80(_0x510e4c[_0x9a96('0x11')][_0x9a96('0x13')]);}logger[_0x9a96('0x11')](_0x9a96('0xc'),_0x4d1c30,_0x510e4c['error'][_0x9a96('0x13')]);return _0x1a417d(_0x510e4c[_0x9a96('0x11')][_0x9a96('0x13')]);}else{logger[_0x9a96('0xb')](_0x9a96('0xc'),_0x4d1c30,_0x9a96('0xd'));_0x1a417d(_0x510e4c[_0x9a96('0x14')][_0x9a96('0x13')]);}})[_0x9a96('0x15')](function(_0x368dfc){logger[_0x9a96('0x11')](_0x9a96('0xc'),_0x4d1c30,_0x368dfc);_0x3b1a80(_0x368dfc);});});}exports[_0x9a96('0x16')]=function(_0x20731b){var _0x5ef1ea=this;return new Promise(function(_0x4b9abc,_0x4f40bc){return db[_0x9a96('0x17')]['findAll']({'raw':_0x20731b[_0x9a96('0x18')]?_0x20731b[_0x9a96('0x18')][_0x9a96('0x19')]===undefined?!![]:![]:!![],'where':_0x20731b[_0x9a96('0x18')]?_0x20731b[_0x9a96('0x18')]['where']||null:null,'attributes':_0x20731b[_0x9a96('0x18')]?_0x20731b[_0x9a96('0x18')][_0x9a96('0x1a')]||null:null,'limit':_0x20731b[_0x9a96('0x18')]?_0x20731b[_0x9a96('0x18')]['limit']||null:null,'include':_0x20731b[_0x9a96('0x18')]?_0x20731b[_0x9a96('0x18')][_0x9a96('0x1b')]?_[_0x9a96('0x1c')](_0x20731b[_0x9a96('0x18')]['include'],function(_0x4e5e82){return{'model':db[_0x4e5e82['model']],'as':_0x4e5e82['as'],'attributes':_0x4e5e82[_0x9a96('0x1a')],'include':_0x4e5e82[_0x9a96('0x1b')]?_[_0x9a96('0x1c')](_0x4e5e82[_0x9a96('0x1b')],function(_0x377bac){return{'model':db[_0x377bac[_0x9a96('0x1d')]],'as':_0x377bac['as'],'attributes':_0x377bac['attributes'],'include':_0x377bac[_0x9a96('0x1b')]?_[_0x9a96('0x1c')](_0x377bac[_0x9a96('0x1b')],function(_0x23eb24){return{'model':db[_0x23eb24[_0x9a96('0x1d')]],'as':_0x23eb24['as'],'attributes':_0x23eb24[_0x9a96('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9a96('0xa')](function(_0x530d2f){logger[_0x9a96('0xb')]('GetZohoAccount',_0x20731b);logger[_0x9a96('0xe')]('GetZohoAccount',_0x20731b,JSON['stringify'](_0x530d2f));_0x4b9abc(_0x530d2f);})[_0x9a96('0x15')](function(_0x1a37ce){logger['error'](_0x9a96('0x16'),_0x1a37ce[_0x9a96('0x13')],_0x20731b);_0x4f40bc(_0x5ef1ea[_0x9a96('0x11')](0x1f4,_0x1a37ce[_0x9a96('0x13')]));});});};exports[_0x9a96('0x1e')]=function(_0x4149f1){var _0x21f174=this;return new Promise(function(_0x1ec736,_0x389db6){return db[_0x9a96('0x17')][_0x9a96('0x1f')]({'raw':_0x4149f1[_0x9a96('0x18')]?_0x4149f1[_0x9a96('0x18')][_0x9a96('0x19')]===undefined?!![]:![]:!![],'where':_0x4149f1[_0x9a96('0x18')]?_0x4149f1[_0x9a96('0x18')][_0x9a96('0x20')]||null:null,'attributes':_0x4149f1[_0x9a96('0x18')]?_0x4149f1[_0x9a96('0x18')][_0x9a96('0x1a')]||null:null,'include':_0x4149f1[_0x9a96('0x18')]?_0x4149f1[_0x9a96('0x18')][_0x9a96('0x1b')]?_['map'](_0x4149f1['options']['include'],function(_0x167bf1){return{'model':db[_0x167bf1[_0x9a96('0x1d')]],'as':_0x167bf1['as'],'attributes':_0x167bf1[_0x9a96('0x1a')],'include':_0x167bf1['include']?_['map'](_0x167bf1[_0x9a96('0x1b')],function(_0x59d57c){return{'model':db[_0x59d57c[_0x9a96('0x1d')]],'as':_0x59d57c['as'],'attributes':_0x59d57c[_0x9a96('0x1a')],'include':_0x59d57c['include']?_[_0x9a96('0x1c')](_0x59d57c[_0x9a96('0x1b')],function(_0x20a965){return{'model':db[_0x20a965['model']],'as':_0x20a965['as'],'attributes':_0x20a965[_0x9a96('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e0bac){logger[_0x9a96('0xb')](_0x9a96('0x1e'),_0x4149f1);logger[_0x9a96('0xe')]('ShowZohoAccount',_0x4149f1,JSON[_0x9a96('0x10')](_0x3e0bac));_0x1ec736(_0x3e0bac);})['catch'](function(_0x5ad738){logger['error'](_0x9a96('0x1e'),_0x5ad738[_0x9a96('0x13')],_0x4149f1);_0x389db6(_0x21f174[_0x9a96('0x11')](0x1f4,_0x5ad738[_0x9a96('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index b903b22..007f203 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 _0x8482=['put','/:id','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x22cc20,_0x122806){var _0x27f765=function(_0x5ba215){while(--_0x5ba215){_0x22cc20['push'](_0x22cc20['shift']());}};_0x27f765(++_0x122806);}(_0x8482,0x14e));var _0x2848=function(_0x3b7e5c,_0x441031){_0x3b7e5c=_0x3b7e5c-0x0;var _0x388900=_0x8482[_0x3b7e5c];return _0x388900;};'use strict';var multer=require('multer');var util=require(_0x2848('0x0'));var path=require(_0x2848('0x1'));var timeout=require(_0x2848('0x2'));var express=require(_0x2848('0x3'));var router=express[_0x2848('0x4')]();var auth=require(_0x2848('0x5'));var interaction=require(_0x2848('0x6'));var config=require(_0x2848('0x7'));var controller=require(_0x2848('0x8'));router[_0x2848('0x9')]('/',auth['isAuthenticated'](),controller[_0x2848('0xa')]);router[_0x2848('0x9')]('/:id',auth[_0x2848('0xb')](),controller['show']);router['get'](_0x2848('0xc'),auth['isAuthenticated'](),controller[_0x2848('0xd')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x2848('0xe')]);router[_0x2848('0x9')](_0x2848('0xf'),auth[_0x2848('0xb')](),controller[_0x2848('0x10')]);router[_0x2848('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2848('0x12')](_0x2848('0x13'),auth[_0x2848('0xb')](),controller['update']);router[_0x2848('0x14')](_0x2848('0x13'),auth[_0x2848('0xb')](),controller['destroy']);module[_0x2848('0x15')]=router; \ No newline at end of file +var _0xf996=['/:id/descriptions','getDescriptions','update','delete','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0xf996,0x74));var _0x6f99=function(_0x1549bb,_0xfbc05){_0x1549bb=_0x1549bb-0x0;var _0x3b6c57=_0xf996[_0x1549bb];return _0x3b6c57;};'use strict';var multer=require(_0x6f99('0x0'));var util=require(_0x6f99('0x1'));var path=require(_0x6f99('0x2'));var timeout=require('connect-timeout');var express=require(_0x6f99('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6f99('0x4'));var config=require(_0x6f99('0x5'));var controller=require(_0x6f99('0x6'));router[_0x6f99('0x7')]('/',auth[_0x6f99('0x8')](),controller[_0x6f99('0x9')]);router[_0x6f99('0x7')](_0x6f99('0xa'),auth[_0x6f99('0x8')](),controller[_0x6f99('0xb')]);router['get'](_0x6f99('0xc'),auth['isAuthenticated'](),controller[_0x6f99('0xd')]);router[_0x6f99('0x7')](_0x6f99('0xe'),auth[_0x6f99('0x8')](),controller[_0x6f99('0xf')]);router[_0x6f99('0x7')](_0x6f99('0x10'),auth[_0x6f99('0x8')](),controller[_0x6f99('0x11')]);router['post']('/',auth[_0x6f99('0x8')](),controller['create']);router['put']('/:id',auth[_0x6f99('0x8')](),controller[_0x6f99('0x12')]);router[_0x6f99('0x13')](_0x6f99('0xa'),auth[_0x6f99('0x8')](),controller[_0x6f99('0x14')]);module[_0x6f99('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 8808b9e..ed9963a 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 _0x5b93=['STRING','ENUM','lead','contact_lead','sequelize','exports'];(function(_0x1133cb,_0x161c58){var _0x28d47c=function(_0x70d676){while(--_0x70d676){_0x1133cb['push'](_0x1133cb['shift']());}};_0x28d47c(++_0x161c58);}(_0x5b93,0x14e));var _0x35b9=function(_0x15ef2b,_0x51cd04){_0x15ef2b=_0x15ef2b-0x0;var _0x36d793=_0x5b93[_0x15ef2b];return _0x36d793;};'use strict';var Sequelize=require(_0x35b9('0x0'));module[_0x35b9('0x1')]={'name':{'type':Sequelize[_0x35b9('0x2')]},'moduleCreate':{'type':Sequelize[_0x35b9('0x3')](_0x35b9('0x4'),'contact','nothing'),'defaultValue':_0x35b9('0x4')},'moduleSearch':{'type':Sequelize[_0x35b9('0x3')](_0x35b9('0x5'),'contact',_0x35b9('0x4')),'defaultValue':_0x35b9('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6210=['ENUM','nothing','lead','contact_lead','contact','STRING','sequelize','exports'];(function(_0x8249ea,_0x47ee50){var _0x5609da=function(_0x431f32){while(--_0x431f32){_0x8249ea['push'](_0x8249ea['shift']());}};_0x5609da(++_0x47ee50);}(_0x6210,0xe6));var _0x0621=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x6210[_0x119d5a];return _0x15bff4;};'use strict';var Sequelize=require(_0x0621('0x0'));module[_0x0621('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x0621('0x2')]('lead','contact',_0x0621('0x3')),'defaultValue':_0x0621('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x0621('0x5'),_0x0621('0x6'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x0621('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 491ea7d..2f14939 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 _0x008c=['save','update','stack','name','send','index','ZohoConfiguration','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','merge','options','includeAll','include','findAll','rows','params','create','body','find','getFields','findOne','ZohoField','pick','filter','map','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','ZohoConfiguration,\x20%s,\x20%s','error','message','info','request\x20sent','catch','sendStatus','status','end','count','offset','limit','apply','reject'];(function(_0x2b95d4,_0x4f23e5){var _0x53b29f=function(_0xc3ae3f){while(--_0xc3ae3f){_0x2b95d4['push'](_0x2b95d4['shift']());}};_0x53b29f(++_0x4f23e5);}(_0x008c,0x188));var _0xc008=function(_0x176308,_0x5b4d58){_0x176308=_0x176308-0x0;var _0x545160=_0x008c[_0x176308];return _0x545160;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];var jayson=require(_0xc008('0x17'));var client=jayson[_0xc008('0x18')][_0xc008('0x19')]({'port':0x232a});function checkPasswordPattern(_0x69726e,_0x593f7a,_0x560e28){if(_0x560e28){var _0x33f44c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33f44c['test'](_0x593f7a)){return _0x69726e;}else{throw new db[(_0xc008('0x1a'))][(_0xc008('0x1b'))](_0xc008('0x1c'));}}else{return _0x69726e;}}function respondWithRpcPromise(_0x339ffc,_0x3f0ecf,_0x5ee00b,_0x5e894e){return new BPromise(function(_0x4bd0f4,_0x11ef38){var _0x15a6ad=_0x5e894e||client;return _0x15a6ad[_0xc008('0x1d')](_0x339ffc,_0x5ee00b)[_0xc008('0x1e')](function(_0x4fe771){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x3f0ecf,'request\x20sent');logger[_0xc008('0x1f')](_0xc008('0x20'),_0x3f0ecf,'request\x20sent',JSON[_0xc008('0x21')](_0x4fe771));if(_0x4fe771['error']){if(_0x4fe771['error']['code']===0x1f4){logger['error'](_0xc008('0x22'),_0x3f0ecf,_0x4fe771['error']['message']);return _0x11ef38(_0x4fe771['error']['message']);}logger['error'](_0xc008('0x22'),_0x3f0ecf,_0x4fe771[_0xc008('0x23')][_0xc008('0x24')]);return _0x4bd0f4(_0x4fe771[_0xc008('0x23')][_0xc008('0x24')]);}else{logger[_0xc008('0x25')]('ZohoConfiguration,\x20%s,\x20%s',_0x3f0ecf,_0xc008('0x26'));_0x4bd0f4(_0x4fe771['result']['message']);}})[_0xc008('0x27')](function(_0x36f358){logger[_0xc008('0x23')](_0xc008('0x22'),_0x3f0ecf,_0x36f358);_0x11ef38(_0x36f358);});});}function respondWithStatusCode(_0x5410f5,_0x48582b){_0x48582b=_0x48582b||0xcc;return function(_0x5de1e9){if(_0x5de1e9){return _0x5410f5[_0xc008('0x28')](_0x48582b);}return _0x5410f5[_0xc008('0x29')](_0x48582b)[_0xc008('0x2a')]();};}function respondWithResult(_0x2e31c2,_0x5bebd9){_0x5bebd9=_0x5bebd9||0xc8;return function(_0x5e2aca){if(_0x5e2aca){return _0x2e31c2['status'](_0x5bebd9)['json'](_0x5e2aca);}};}function respondWithFilteredResult(_0x4caaf4,_0x3865c0){return function(_0x29ba43){if(_0x29ba43){var _0x25eae4=_0x29ba43[_0xc008('0x2b')],_0x529961=_0x3865c0[_0xc008('0x2c')],_0x24c14c=_0x3865c0['offset']+_0x3865c0[_0xc008('0x2d')],_0x32390d;if(_0x24c14c>=_0x25eae4){_0x24c14c=_0x25eae4;_0x32390d=0xc8;}else{_0x32390d=0xce;}_0x4caaf4[_0xc008('0x29')](_0x32390d);return _0x4caaf4['set']('Content-Range',_0x529961+'-'+_0x24c14c+'/'+_0x25eae4)['json'](_0x29ba43);}return null;};}function patchUpdates(_0x1032b2){return function(_0x267abd){try{jsonpatch[_0xc008('0x2e')](_0x267abd,_0x1032b2,!![]);}catch(_0x10889f){return BPromise[_0xc008('0x2f')](_0x10889f);}return _0x267abd[_0xc008('0x30')]();};}function saveUpdates(_0x294f97,_0x22d8e8){return function(_0x1fe1e1){if(_0x1fe1e1){return _0x1fe1e1[_0xc008('0x31')](_0x294f97)[_0xc008('0x1e')](function(_0x1ac7c8){return _0x1ac7c8;});}return null;};}function removeEntity(_0x596ee8,_0x334a09){return function(_0x4b7fd4){if(_0x4b7fd4){return _0x4b7fd4['destroy']()[_0xc008('0x1e')](function(){_0x596ee8[_0xc008('0x29')](0xcc)[_0xc008('0x2a')]();});}};}function handleEntityNotFound(_0xca0520,_0xd0e05a){return function(_0x3cd878){if(!_0x3cd878){_0xca0520[_0xc008('0x28')](0x194);}return _0x3cd878;};}function handleError(_0x470e79,_0x29d4b3){_0x29d4b3=_0x29d4b3||0x1f4;return function(_0x4f14d2){logger[_0xc008('0x23')](_0x4f14d2[_0xc008('0x32')]);if(_0x4f14d2[_0xc008('0x33')]){delete _0x4f14d2[_0xc008('0x33')];}_0x470e79[_0xc008('0x29')](_0x29d4b3)[_0xc008('0x34')](_0x4f14d2);};}exports[_0xc008('0x35')]=function(_0x5d0e06,_0x35f360){var _0x21763f={},_0x50e1d4={},_0x399b64={'count':0x0,'rows':[]};var _0x15453c=_['map'](db[_0xc008('0x36')][_0xc008('0x37')],function(_0x280e9b){return{'name':_0x280e9b['fieldName'],'type':_0x280e9b['type']['key']};});_0x50e1d4[_0xc008('0x38')]=_['map'](_0x15453c,_0xc008('0x33'));_0x50e1d4[_0xc008('0x39')]=_[_0xc008('0x3a')](_0x5d0e06[_0xc008('0x39')]);_0x50e1d4[_0xc008('0x3b')]=_[_0xc008('0x3c')](_0x50e1d4[_0xc008('0x38')],_0x50e1d4[_0xc008('0x39')]);_0x21763f[_0xc008('0x3d')]=_[_0xc008('0x3c')](_0x50e1d4[_0xc008('0x38')],qs[_0xc008('0x3e')](_0x5d0e06[_0xc008('0x39')][_0xc008('0x3e')]));_0x21763f['attributes']=_0x21763f[_0xc008('0x3d')][_0xc008('0x3f')]?_0x21763f[_0xc008('0x3d')]:_0x50e1d4[_0xc008('0x38')];if(!_0x5d0e06['query'][_0xc008('0x40')](_0xc008('0x41'))){_0x21763f[_0xc008('0x2d')]=qs[_0xc008('0x2d')](_0x5d0e06[_0xc008('0x39')]['limit']);_0x21763f[_0xc008('0x2c')]=qs[_0xc008('0x2c')](_0x5d0e06[_0xc008('0x39')][_0xc008('0x2c')]);}_0x21763f[_0xc008('0x42')]=qs['sort'](_0x5d0e06[_0xc008('0x39')][_0xc008('0x43')]);_0x21763f[_0xc008('0x44')]=qs[_0xc008('0x3b')](_['pick'](_0x5d0e06[_0xc008('0x39')],_0x50e1d4[_0xc008('0x3b')]));if(_0x5d0e06[_0xc008('0x39')]['filter']){_0x21763f[_0xc008('0x44')]=_['merge'](_0x21763f[_0xc008('0x44')],{'$or':_['map'](_0x15453c,function(_0x46fa8f){if(_0x46fa8f[_0xc008('0x45')]!=='VIRTUAL'){var _0x31007c={};_0x31007c[_0x46fa8f[_0xc008('0x33')]]={'$like':'%'+_0x5d0e06[_0xc008('0x39')]['filter']+'%'};return _0x31007c;}})});}_0x21763f=_[_0xc008('0x46')]({},_0x21763f,_0x5d0e06[_0xc008('0x47')]);var _0x200469={'where':_0x21763f[_0xc008('0x44')]};return db[_0xc008('0x36')][_0xc008('0x2b')](_0x200469)['then'](function(_0x47cafa){_0x399b64['count']=_0x47cafa;if(_0x5d0e06[_0xc008('0x39')][_0xc008('0x48')]){_0x21763f[_0xc008('0x49')]=[{'all':!![]}];}return db[_0xc008('0x36')][_0xc008('0x4a')](_0x21763f);})[_0xc008('0x1e')](function(_0x2cf641){_0x399b64[_0xc008('0x4b')]=_0x2cf641;return _0x399b64;})['then'](respondWithFilteredResult(_0x35f360,_0x21763f))['catch'](handleError(_0x35f360,null));};exports['show']=function(_0x2d5a49,_0x2651cf){var _0x158eae={'raw':![],'where':{'id':_0x2d5a49[_0xc008('0x4c')]['id']}},_0x511383={};_0x511383[_0xc008('0x38')]=_[_0xc008('0x3a')](db[_0xc008('0x36')][_0xc008('0x37')]);_0x511383[_0xc008('0x39')]=_[_0xc008('0x3a')](_0x2d5a49[_0xc008('0x39')]);_0x511383[_0xc008('0x3b')]=_[_0xc008('0x3c')](_0x511383['model'],_0x511383['query']);_0x158eae[_0xc008('0x3d')]=_['intersection'](_0x511383[_0xc008('0x38')],qs[_0xc008('0x3e')](_0x2d5a49[_0xc008('0x39')]['fields']));_0x158eae[_0xc008('0x3d')]=_0x158eae[_0xc008('0x3d')][_0xc008('0x3f')]?_0x158eae[_0xc008('0x3d')]:_0x511383[_0xc008('0x38')];if(_0x2d5a49['query'][_0xc008('0x48')]){_0x158eae[_0xc008('0x49')]=[{'all':!![]}];}_0x158eae=_['merge']({},_0x158eae,_0x2d5a49[_0xc008('0x47')]);return db[_0xc008('0x36')]['find'](_0x158eae)['then'](handleEntityNotFound(_0x2651cf,null))[_0xc008('0x1e')](respondWithResult(_0x2651cf,null))[_0xc008('0x27')](handleError(_0x2651cf,null));};exports[_0xc008('0x4d')]=function(_0x30d0aa,_0x14b6a0){return db['ZohoConfiguration']['create'](_0x30d0aa[_0xc008('0x4e')],{})['then'](respondWithResult(_0x14b6a0,0xc9))[_0xc008('0x27')](handleError(_0x14b6a0,null));};exports[_0xc008('0x31')]=function(_0xf94fcb,_0x2f1105){if(_0xf94fcb[_0xc008('0x4e')]['id']){delete _0xf94fcb[_0xc008('0x4e')]['id'];}return db['ZohoConfiguration'][_0xc008('0x4f')]({'where':{'id':_0xf94fcb[_0xc008('0x4c')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x2f1105,null))[_0xc008('0x1e')](saveUpdates(_0xf94fcb[_0xc008('0x4e')],null))['then'](respondWithResult(_0x2f1105,null))[_0xc008('0x27')](handleError(_0x2f1105,null));};exports['destroy']=function(_0x535e6e,_0x5dbfca){return db[_0xc008('0x36')][_0xc008('0x4f')]({'where':{'id':_0x535e6e[_0xc008('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5dbfca,null))[_0xc008('0x1e')](removeEntity(_0x5dbfca,null))[_0xc008('0x27')](handleError(_0x5dbfca,null));};exports[_0xc008('0x50')]=function(_0x47a58b,_0x3587c3,_0x1092cb){var _0x12ba3f={};var _0x1b5a22={};var _0x5baff1;var _0x4022dd;return db['ZohoConfiguration'][_0xc008('0x51')]({'where':{'id':_0x47a58b[_0xc008('0x4c')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x3587c3,null))[_0xc008('0x1e')](function(_0x192c87){if(_0x192c87){_0x5baff1=_0x192c87;_0x1b5a22[_0xc008('0x38')]=_['keys'](db[_0xc008('0x52')]['rawAttributes']);_0x1b5a22['query']=_[_0xc008('0x3a')](_0x47a58b[_0xc008('0x39')]);_0x1b5a22['filters']=_[_0xc008('0x3c')](_0x1b5a22[_0xc008('0x38')],_0x1b5a22[_0xc008('0x39')]);_0x12ba3f[_0xc008('0x3d')]=_[_0xc008('0x3c')](_0x1b5a22[_0xc008('0x38')],qs[_0xc008('0x3e')](_0x47a58b['query'][_0xc008('0x3e')]));_0x12ba3f[_0xc008('0x3d')]=_0x12ba3f[_0xc008('0x3d')][_0xc008('0x3f')]?_0x12ba3f[_0xc008('0x3d')]:_0x1b5a22[_0xc008('0x38')];_0x12ba3f[_0xc008('0x42')]=qs[_0xc008('0x43')](_0x47a58b[_0xc008('0x39')][_0xc008('0x43')]);_0x12ba3f[_0xc008('0x44')]=qs[_0xc008('0x3b')](_[_0xc008('0x53')](_0x47a58b[_0xc008('0x39')],_0x1b5a22['filters']));if(_0x47a58b[_0xc008('0x39')][_0xc008('0x54')]){_0x12ba3f[_0xc008('0x44')]=_['merge'](_0x12ba3f[_0xc008('0x44')],{'$or':_[_0xc008('0x55')](_0x12ba3f['attributes'],function(_0x53765c){var _0x1a03fd={};_0x1a03fd[_0x53765c]={'$like':'%'+_0x47a58b[_0xc008('0x39')][_0xc008('0x54')]+'%'};return _0x1a03fd;})});}_0x12ba3f=_[_0xc008('0x46')]({},_0x12ba3f,_0x47a58b[_0xc008('0x47')]);return _0x5baff1[_0xc008('0x50')](_0x12ba3f);}})[_0xc008('0x1e')](function(_0x38191e){if(_0x38191e){_0x4022dd=_0x38191e[_0xc008('0x3f')];if(!_0x47a58b[_0xc008('0x39')][_0xc008('0x40')]('nolimit')){_0x12ba3f[_0xc008('0x2d')]=qs[_0xc008('0x2d')](_0x47a58b[_0xc008('0x39')][_0xc008('0x2d')]);_0x12ba3f['offset']=qs[_0xc008('0x2c')](_0x47a58b['query'][_0xc008('0x2c')]);}return _0x5baff1[_0xc008('0x50')](_0x12ba3f);}})[_0xc008('0x1e')](function(_0x4ccffe){if(_0x4ccffe){return _0x4ccffe?{'count':_0x4022dd,'rows':_0x4ccffe}:null;}})[_0xc008('0x1e')](respondWithResult(_0x3587c3,null))[_0xc008('0x27')](handleError(_0x3587c3,null));};exports[_0xc008('0x56')]=function(_0x553f5c,_0x35b28a,_0x539fc8){var _0x50ee03={};var _0xee7a85={};var _0x23012c;var _0x6fe732;return db[_0xc008('0x36')]['findOne']({'where':{'id':_0x553f5c[_0xc008('0x4c')]['id']}})[_0xc008('0x1e')](handleEntityNotFound(_0x35b28a,null))['then'](function(_0x3efb77){if(_0x3efb77){_0x23012c=_0x3efb77;_0xee7a85['model']=_[_0xc008('0x3a')](db['ZohoField'][_0xc008('0x37')]);_0xee7a85['query']=_[_0xc008('0x3a')](_0x553f5c[_0xc008('0x39')]);_0xee7a85[_0xc008('0x3b')]=_[_0xc008('0x3c')](_0xee7a85['model'],_0xee7a85[_0xc008('0x39')]);_0x50ee03[_0xc008('0x3d')]=_[_0xc008('0x3c')](_0xee7a85[_0xc008('0x38')],qs[_0xc008('0x3e')](_0x553f5c[_0xc008('0x39')][_0xc008('0x3e')]));_0x50ee03[_0xc008('0x3d')]=_0x50ee03['attributes'][_0xc008('0x3f')]?_0x50ee03['attributes']:_0xee7a85['model'];_0x50ee03['order']=qs[_0xc008('0x43')](_0x553f5c[_0xc008('0x39')][_0xc008('0x43')]);_0x50ee03[_0xc008('0x44')]=qs[_0xc008('0x3b')](_[_0xc008('0x53')](_0x553f5c[_0xc008('0x39')],_0xee7a85[_0xc008('0x3b')]));if(_0x553f5c[_0xc008('0x39')]['filter']){_0x50ee03[_0xc008('0x44')]=_[_0xc008('0x46')](_0x50ee03[_0xc008('0x44')],{'$or':_[_0xc008('0x55')](_0x50ee03[_0xc008('0x3d')],function(_0x3b2669){var _0x23d4ff={};_0x23d4ff[_0x3b2669]={'$like':'%'+_0x553f5c[_0xc008('0x39')][_0xc008('0x54')]+'%'};return _0x23d4ff;})});}_0x50ee03=_[_0xc008('0x46')]({},_0x50ee03,_0x553f5c[_0xc008('0x47')]);return _0x23012c[_0xc008('0x56')](_0x50ee03);}})['then'](function(_0x4e7af3){if(_0x4e7af3){_0x6fe732=_0x4e7af3[_0xc008('0x3f')];if(!_0x553f5c[_0xc008('0x39')][_0xc008('0x40')]('nolimit')){_0x50ee03[_0xc008('0x2d')]=qs[_0xc008('0x2d')](_0x553f5c['query']['limit']);_0x50ee03['offset']=qs[_0xc008('0x2c')](_0x553f5c[_0xc008('0x39')][_0xc008('0x2c')]);}return _0x23012c[_0xc008('0x56')](_0x50ee03);}})[_0xc008('0x1e')](function(_0x44f515){if(_0x44f515){return _0x44f515?{'count':_0x6fe732,'rows':_0x44f515}:null;}})[_0xc008('0x1e')](respondWithResult(_0x35b28a,null))[_0xc008('0x27')](handleError(_0x35b28a,null));};exports[_0xc008('0x57')]=function(_0x1e7a11,_0x52091b,_0x57b8ad){var _0xc644fe={};var _0x31ebde={};var _0x3f3dcf;var _0x3f1e41;return db[_0xc008('0x36')][_0xc008('0x51')]({'where':{'id':_0x1e7a11['params']['id']}})['then'](handleEntityNotFound(_0x52091b,null))[_0xc008('0x1e')](function(_0x391425){if(_0x391425){_0x3f3dcf=_0x391425;_0x31ebde[_0xc008('0x38')]=_['keys'](db['ZohoField']['rawAttributes']);_0x31ebde['query']=_['keys'](_0x1e7a11['query']);_0x31ebde[_0xc008('0x3b')]=_['intersection'](_0x31ebde[_0xc008('0x38')],_0x31ebde['query']);_0xc644fe[_0xc008('0x3d')]=_[_0xc008('0x3c')](_0x31ebde[_0xc008('0x38')],qs['fields'](_0x1e7a11['query'][_0xc008('0x3e')]));_0xc644fe['attributes']=_0xc644fe[_0xc008('0x3d')][_0xc008('0x3f')]?_0xc644fe['attributes']:_0x31ebde[_0xc008('0x38')];_0xc644fe['order']=qs['sort'](_0x1e7a11[_0xc008('0x39')][_0xc008('0x43')]);_0xc644fe['where']=qs[_0xc008('0x3b')](_[_0xc008('0x53')](_0x1e7a11[_0xc008('0x39')],_0x31ebde['filters']));if(_0x1e7a11[_0xc008('0x39')][_0xc008('0x54')]){_0xc644fe[_0xc008('0x44')]=_[_0xc008('0x46')](_0xc644fe[_0xc008('0x44')],{'$or':_[_0xc008('0x55')](_0xc644fe['attributes'],function(_0x6dfd99){var _0xdaff5b={};_0xdaff5b[_0x6dfd99]={'$like':'%'+_0x1e7a11[_0xc008('0x39')]['filter']+'%'};return _0xdaff5b;})});}_0xc644fe=_[_0xc008('0x46')]({},_0xc644fe,_0x1e7a11[_0xc008('0x47')]);return _0x3f3dcf[_0xc008('0x57')](_0xc644fe);}})['then'](function(_0x48c38b){if(_0x48c38b){_0x3f1e41=_0x48c38b['length'];if(!_0x1e7a11[_0xc008('0x39')][_0xc008('0x40')](_0xc008('0x41'))){_0xc644fe[_0xc008('0x2d')]=qs[_0xc008('0x2d')](_0x1e7a11[_0xc008('0x39')][_0xc008('0x2d')]);_0xc644fe[_0xc008('0x2c')]=qs['offset'](_0x1e7a11[_0xc008('0x39')][_0xc008('0x2c')]);}return _0x3f3dcf['getDescriptions'](_0xc644fe);}})['then'](function(_0x2257b0){if(_0x2257b0){return _0x2257b0?{'count':_0x3f1e41,'rows':_0x2257b0}:null;}})[_0xc008('0x1e')](respondWithResult(_0x52091b,null))[_0xc008('0x27')](handleError(_0x52091b,null));}; \ No newline at end of file +var _0x55ca=['attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','findAll','rows','catch','params','keys','length','include','options','find','create','body','getFields','findOne','ZohoField','pick','getSubjects','getDescriptions','html-pdf','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','stack','name','index','ZohoConfiguration','rawAttributes','type','key','map','query','intersection','model','fields'];(function(_0x24e5e3,_0x5e0bc4){var _0x50d767=function(_0x5d1444){while(--_0x5d1444){_0x24e5e3['push'](_0x24e5e3['shift']());}};_0x50d767(++_0x5e0bc4);}(_0x55ca,0x126));var _0xa55c=function(_0x56eb70,_0x2bd75c){_0x56eb70=_0x56eb70-0x0;var _0x47f1fe=_0x55ca[_0x56eb70];return _0x47f1fe;};'use strict';var pdf=require(_0xa55c('0x0'));var emlformat=require(_0xa55c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa55c('0x2'));var moment=require(_0xa55c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa55c('0x4'));var util=require(_0xa55c('0x5'));var path=require(_0xa55c('0x6'));var sox=require(_0xa55c('0x7'));var csv=require(_0xa55c('0x8'));var ejs=require(_0xa55c('0x9'));var fs=require('fs');var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x8'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var db=require(_0xa55c('0x16'))['db'];var jayson=require(_0xa55c('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2a35be,_0x576044,_0x5a3672){if(_0x5a3672){var _0x59ea8d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x59ea8d[_0xa55c('0x18')](_0x576044)){return _0x2a35be;}else{throw new db[(_0xa55c('0x19'))][(_0xa55c('0x1a'))](_0xa55c('0x1b'));}}else{return _0x2a35be;}}function respondWithRpcPromise(_0x458480,_0x247e77,_0x4e0b2f,_0x3ccf65){return new BPromise(function(_0x3dcf4f,_0x25934f){var _0x31e10d=_0x3ccf65||client;return _0x31e10d[_0xa55c('0x1c')](_0x458480,_0x4e0b2f)[_0xa55c('0x1d')](function(_0x51590e){logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x247e77,'request\x20sent');logger[_0xa55c('0x20')](_0xa55c('0x21'),_0x247e77,_0xa55c('0x22'),JSON[_0xa55c('0x23')](_0x51590e));if(_0x51590e[_0xa55c('0x24')]){if(_0x51590e[_0xa55c('0x24')]['code']===0x1f4){logger['error'](_0xa55c('0x1f'),_0x247e77,_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);return _0x25934f(_0x51590e['error'][_0xa55c('0x25')]);}logger[_0xa55c('0x24')]('ZohoConfiguration,\x20%s,\x20%s',_0x247e77,_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);return _0x3dcf4f(_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);}else{logger[_0xa55c('0x1e')]('ZohoConfiguration,\x20%s,\x20%s',_0x247e77,_0xa55c('0x22'));_0x3dcf4f(_0x51590e['result']['message']);}})['catch'](function(_0x19ae88){logger['error'](_0xa55c('0x1f'),_0x247e77,_0x19ae88);_0x25934f(_0x19ae88);});});}function respondWithStatusCode(_0x190757,_0x3f64de){_0x3f64de=_0x3f64de||0xcc;return function(_0xf0e574){if(_0xf0e574){return _0x190757[_0xa55c('0x26')](_0x3f64de);}return _0x190757[_0xa55c('0x27')](_0x3f64de)[_0xa55c('0x28')]();};}function respondWithResult(_0x11e7f7,_0x192df2){_0x192df2=_0x192df2||0xc8;return function(_0x3cd152){if(_0x3cd152){return _0x11e7f7[_0xa55c('0x27')](_0x192df2)['json'](_0x3cd152);}};}function respondWithFilteredResult(_0x430d55,_0x28814f){return function(_0x1c9f6b){if(_0x1c9f6b){var _0x906caa=_0x1c9f6b[_0xa55c('0x29')],_0x5d940d=_0x28814f[_0xa55c('0x2a')],_0x1377b0=_0x28814f[_0xa55c('0x2a')]+_0x28814f[_0xa55c('0x2b')],_0x22f6b6;if(_0x1377b0>=_0x906caa){_0x1377b0=_0x906caa;_0x22f6b6=0xc8;}else{_0x22f6b6=0xce;}_0x430d55['status'](_0x22f6b6);return _0x430d55[_0xa55c('0x2c')]('Content-Range',_0x5d940d+'-'+_0x1377b0+'/'+_0x906caa)[_0xa55c('0x2d')](_0x1c9f6b);}return null;};}function patchUpdates(_0x1d730b){return function(_0x1cc53e){try{jsonpatch[_0xa55c('0x2e')](_0x1cc53e,_0x1d730b,!![]);}catch(_0x4d8416){return BPromise[_0xa55c('0x2f')](_0x4d8416);}return _0x1cc53e[_0xa55c('0x30')]();};}function saveUpdates(_0x331e58,_0x20da31){return function(_0x10f4b7){if(_0x10f4b7){return _0x10f4b7[_0xa55c('0x31')](_0x331e58)[_0xa55c('0x1d')](function(_0x24d44d){return _0x24d44d;});}return null;};}function removeEntity(_0x2808e9,_0xcbaf2e){return function(_0x197099){if(_0x197099){return _0x197099['destroy']()['then'](function(){_0x2808e9[_0xa55c('0x27')](0xcc)[_0xa55c('0x28')]();});}};}function handleEntityNotFound(_0x4932d0,_0x30fadd){return function(_0x2f0110){if(!_0x2f0110){_0x4932d0[_0xa55c('0x26')](0x194);}return _0x2f0110;};}function handleError(_0x1839ac,_0x30d4f8){_0x30d4f8=_0x30d4f8||0x1f4;return function(_0x38ff96){logger[_0xa55c('0x24')](_0x38ff96[_0xa55c('0x32')]);if(_0x38ff96[_0xa55c('0x33')]){delete _0x38ff96['name'];}_0x1839ac['status'](_0x30d4f8)['send'](_0x38ff96);};}exports[_0xa55c('0x34')]=function(_0x18e00e,_0x2bb4f0){var _0x5802e4={},_0x768408={},_0x547930={'count':0x0,'rows':[]};var _0x119220=_['map'](db[_0xa55c('0x35')][_0xa55c('0x36')],function(_0x3c0ec1){return{'name':_0x3c0ec1['fieldName'],'type':_0x3c0ec1[_0xa55c('0x37')][_0xa55c('0x38')]};});_0x768408['model']=_[_0xa55c('0x39')](_0x119220,_0xa55c('0x33'));_0x768408['query']=_['keys'](_0x18e00e[_0xa55c('0x3a')]);_0x768408['filters']=_[_0xa55c('0x3b')](_0x768408[_0xa55c('0x3c')],_0x768408['query']);_0x5802e4['attributes']=_['intersection'](_0x768408['model'],qs[_0xa55c('0x3d')](_0x18e00e[_0xa55c('0x3a')][_0xa55c('0x3d')]));_0x5802e4[_0xa55c('0x3e')]=_0x5802e4[_0xa55c('0x3e')]['length']?_0x5802e4[_0xa55c('0x3e')]:_0x768408[_0xa55c('0x3c')];if(!_0x18e00e[_0xa55c('0x3a')][_0xa55c('0x3f')](_0xa55c('0x40'))){_0x5802e4[_0xa55c('0x2b')]=qs['limit'](_0x18e00e[_0xa55c('0x3a')]['limit']);_0x5802e4['offset']=qs[_0xa55c('0x2a')](_0x18e00e[_0xa55c('0x3a')]['offset']);}_0x5802e4[_0xa55c('0x41')]=qs['sort'](_0x18e00e['query'][_0xa55c('0x42')]);_0x5802e4[_0xa55c('0x43')]=qs[_0xa55c('0x44')](_['pick'](_0x18e00e[_0xa55c('0x3a')],_0x768408[_0xa55c('0x44')]));if(_0x18e00e['query'][_0xa55c('0x45')]){_0x5802e4['where']=_[_0xa55c('0x46')](_0x5802e4[_0xa55c('0x43')],{'$or':_['map'](_0x119220,function(_0x66d1de){if(_0x66d1de[_0xa55c('0x37')]!=='VIRTUAL'){var _0x40c352={};_0x40c352[_0x66d1de[_0xa55c('0x33')]]={'$like':'%'+_0x18e00e[_0xa55c('0x3a')]['filter']+'%'};return _0x40c352;}})});}_0x5802e4=_[_0xa55c('0x46')]({},_0x5802e4,_0x18e00e['options']);var _0x2f9717={'where':_0x5802e4[_0xa55c('0x43')]};return db[_0xa55c('0x35')]['count'](_0x2f9717)[_0xa55c('0x1d')](function(_0x106adb){_0x547930['count']=_0x106adb;if(_0x18e00e[_0xa55c('0x3a')][_0xa55c('0x47')]){_0x5802e4['include']=[{'all':!![]}];}return db[_0xa55c('0x35')][_0xa55c('0x48')](_0x5802e4);})['then'](function(_0x46f839){_0x547930[_0xa55c('0x49')]=_0x46f839;return _0x547930;})[_0xa55c('0x1d')](respondWithFilteredResult(_0x2bb4f0,_0x5802e4))[_0xa55c('0x4a')](handleError(_0x2bb4f0,null));};exports['show']=function(_0x143989,_0x58a7ea){var _0x2157d6={'raw':![],'where':{'id':_0x143989[_0xa55c('0x4b')]['id']}},_0x213100={};_0x213100['model']=_[_0xa55c('0x4c')](db[_0xa55c('0x35')]['rawAttributes']);_0x213100[_0xa55c('0x3a')]=_[_0xa55c('0x4c')](_0x143989[_0xa55c('0x3a')]);_0x213100[_0xa55c('0x44')]=_[_0xa55c('0x3b')](_0x213100[_0xa55c('0x3c')],_0x213100[_0xa55c('0x3a')]);_0x2157d6[_0xa55c('0x3e')]=_[_0xa55c('0x3b')](_0x213100[_0xa55c('0x3c')],qs['fields'](_0x143989[_0xa55c('0x3a')][_0xa55c('0x3d')]));_0x2157d6[_0xa55c('0x3e')]=_0x2157d6['attributes'][_0xa55c('0x4d')]?_0x2157d6[_0xa55c('0x3e')]:_0x213100['model'];if(_0x143989[_0xa55c('0x3a')]['includeAll']){_0x2157d6[_0xa55c('0x4e')]=[{'all':!![]}];}_0x2157d6=_[_0xa55c('0x46')]({},_0x2157d6,_0x143989[_0xa55c('0x4f')]);return db[_0xa55c('0x35')][_0xa55c('0x50')](_0x2157d6)['then'](handleEntityNotFound(_0x58a7ea,null))[_0xa55c('0x1d')](respondWithResult(_0x58a7ea,null))[_0xa55c('0x4a')](handleError(_0x58a7ea,null));};exports['create']=function(_0x3929a6,_0x2291e0){return db[_0xa55c('0x35')][_0xa55c('0x51')](_0x3929a6['body'],{})['then'](respondWithResult(_0x2291e0,0xc9))[_0xa55c('0x4a')](handleError(_0x2291e0,null));};exports[_0xa55c('0x31')]=function(_0x3ca5b8,_0x44ac57){if(_0x3ca5b8['body']['id']){delete _0x3ca5b8[_0xa55c('0x52')]['id'];}return db['ZohoConfiguration'][_0xa55c('0x50')]({'where':{'id':_0x3ca5b8[_0xa55c('0x4b')]['id']}})[_0xa55c('0x1d')](handleEntityNotFound(_0x44ac57,null))[_0xa55c('0x1d')](saveUpdates(_0x3ca5b8[_0xa55c('0x52')],null))['then'](respondWithResult(_0x44ac57,null))[_0xa55c('0x4a')](handleError(_0x44ac57,null));};exports['destroy']=function(_0x23f67f,_0x157afe){return db[_0xa55c('0x35')][_0xa55c('0x50')]({'where':{'id':_0x23f67f[_0xa55c('0x4b')]['id']}})[_0xa55c('0x1d')](handleEntityNotFound(_0x157afe,null))[_0xa55c('0x1d')](removeEntity(_0x157afe,null))['catch'](handleError(_0x157afe,null));};exports[_0xa55c('0x53')]=function(_0x449e00,_0x2f2d21,_0x23a30e){var _0x3fa00f={};var _0x5ba2b0={};var _0xa72718;var _0x3cd40d;return db[_0xa55c('0x35')][_0xa55c('0x54')]({'where':{'id':_0x449e00[_0xa55c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2f2d21,null))[_0xa55c('0x1d')](function(_0x21725b){if(_0x21725b){_0xa72718=_0x21725b;_0x5ba2b0[_0xa55c('0x3c')]=_[_0xa55c('0x4c')](db[_0xa55c('0x55')]['rawAttributes']);_0x5ba2b0[_0xa55c('0x3a')]=_['keys'](_0x449e00[_0xa55c('0x3a')]);_0x5ba2b0['filters']=_[_0xa55c('0x3b')](_0x5ba2b0['model'],_0x5ba2b0[_0xa55c('0x3a')]);_0x3fa00f[_0xa55c('0x3e')]=_[_0xa55c('0x3b')](_0x5ba2b0[_0xa55c('0x3c')],qs[_0xa55c('0x3d')](_0x449e00[_0xa55c('0x3a')][_0xa55c('0x3d')]));_0x3fa00f[_0xa55c('0x3e')]=_0x3fa00f[_0xa55c('0x3e')][_0xa55c('0x4d')]?_0x3fa00f['attributes']:_0x5ba2b0[_0xa55c('0x3c')];_0x3fa00f[_0xa55c('0x41')]=qs['sort'](_0x449e00[_0xa55c('0x3a')][_0xa55c('0x42')]);_0x3fa00f[_0xa55c('0x43')]=qs[_0xa55c('0x44')](_[_0xa55c('0x56')](_0x449e00[_0xa55c('0x3a')],_0x5ba2b0[_0xa55c('0x44')]));if(_0x449e00[_0xa55c('0x3a')]['filter']){_0x3fa00f[_0xa55c('0x43')]=_[_0xa55c('0x46')](_0x3fa00f[_0xa55c('0x43')],{'$or':_[_0xa55c('0x39')](_0x3fa00f[_0xa55c('0x3e')],function(_0x1bcb40){var _0x2f1237={};_0x2f1237[_0x1bcb40]={'$like':'%'+_0x449e00[_0xa55c('0x3a')][_0xa55c('0x45')]+'%'};return _0x2f1237;})});}_0x3fa00f=_['merge']({},_0x3fa00f,_0x449e00[_0xa55c('0x4f')]);return _0xa72718[_0xa55c('0x53')](_0x3fa00f);}})[_0xa55c('0x1d')](function(_0x26606c){if(_0x26606c){_0x3cd40d=_0x26606c[_0xa55c('0x4d')];if(!_0x449e00[_0xa55c('0x3a')][_0xa55c('0x3f')](_0xa55c('0x40'))){_0x3fa00f[_0xa55c('0x2b')]=qs[_0xa55c('0x2b')](_0x449e00[_0xa55c('0x3a')]['limit']);_0x3fa00f[_0xa55c('0x2a')]=qs['offset'](_0x449e00[_0xa55c('0x3a')][_0xa55c('0x2a')]);}return _0xa72718[_0xa55c('0x53')](_0x3fa00f);}})['then'](function(_0x4d9722){if(_0x4d9722){return _0x4d9722?{'count':_0x3cd40d,'rows':_0x4d9722}:null;}})[_0xa55c('0x1d')](respondWithResult(_0x2f2d21,null))[_0xa55c('0x4a')](handleError(_0x2f2d21,null));};exports[_0xa55c('0x57')]=function(_0x42529f,_0x4c7ee1,_0x149cb9){var _0xd02251={};var _0x8ea1c6={};var _0x3a9910;var _0x21fc9b;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x42529f[_0xa55c('0x4b')]['id']}})[_0xa55c('0x1d')](handleEntityNotFound(_0x4c7ee1,null))[_0xa55c('0x1d')](function(_0x36ee32){if(_0x36ee32){_0x3a9910=_0x36ee32;_0x8ea1c6[_0xa55c('0x3c')]=_['keys'](db[_0xa55c('0x55')][_0xa55c('0x36')]);_0x8ea1c6['query']=_[_0xa55c('0x4c')](_0x42529f[_0xa55c('0x3a')]);_0x8ea1c6[_0xa55c('0x44')]=_['intersection'](_0x8ea1c6[_0xa55c('0x3c')],_0x8ea1c6[_0xa55c('0x3a')]);_0xd02251[_0xa55c('0x3e')]=_[_0xa55c('0x3b')](_0x8ea1c6[_0xa55c('0x3c')],qs['fields'](_0x42529f[_0xa55c('0x3a')][_0xa55c('0x3d')]));_0xd02251['attributes']=_0xd02251['attributes'][_0xa55c('0x4d')]?_0xd02251['attributes']:_0x8ea1c6[_0xa55c('0x3c')];_0xd02251[_0xa55c('0x41')]=qs[_0xa55c('0x42')](_0x42529f[_0xa55c('0x3a')][_0xa55c('0x42')]);_0xd02251[_0xa55c('0x43')]=qs[_0xa55c('0x44')](_[_0xa55c('0x56')](_0x42529f[_0xa55c('0x3a')],_0x8ea1c6['filters']));if(_0x42529f[_0xa55c('0x3a')][_0xa55c('0x45')]){_0xd02251[_0xa55c('0x43')]=_[_0xa55c('0x46')](_0xd02251['where'],{'$or':_[_0xa55c('0x39')](_0xd02251[_0xa55c('0x3e')],function(_0x1baa8b){var _0x2298ac={};_0x2298ac[_0x1baa8b]={'$like':'%'+_0x42529f['query']['filter']+'%'};return _0x2298ac;})});}_0xd02251=_[_0xa55c('0x46')]({},_0xd02251,_0x42529f[_0xa55c('0x4f')]);return _0x3a9910[_0xa55c('0x57')](_0xd02251);}})[_0xa55c('0x1d')](function(_0x5e87cb){if(_0x5e87cb){_0x21fc9b=_0x5e87cb['length'];if(!_0x42529f[_0xa55c('0x3a')][_0xa55c('0x3f')](_0xa55c('0x40'))){_0xd02251[_0xa55c('0x2b')]=qs[_0xa55c('0x2b')](_0x42529f[_0xa55c('0x3a')][_0xa55c('0x2b')]);_0xd02251['offset']=qs[_0xa55c('0x2a')](_0x42529f['query'][_0xa55c('0x2a')]);}return _0x3a9910['getSubjects'](_0xd02251);}})[_0xa55c('0x1d')](function(_0x313cdc){if(_0x313cdc){return _0x313cdc?{'count':_0x21fc9b,'rows':_0x313cdc}:null;}})[_0xa55c('0x1d')](respondWithResult(_0x4c7ee1,null))[_0xa55c('0x4a')](handleError(_0x4c7ee1,null));};exports[_0xa55c('0x58')]=function(_0x402f02,_0x1ea5b6,_0x2c71ca){var _0x576a1b={};var _0x59414d={};var _0x14cb74;var _0x2948b1;return db[_0xa55c('0x35')][_0xa55c('0x54')]({'where':{'id':_0x402f02[_0xa55c('0x4b')]['id']}})[_0xa55c('0x1d')](handleEntityNotFound(_0x1ea5b6,null))['then'](function(_0x889869){if(_0x889869){_0x14cb74=_0x889869;_0x59414d[_0xa55c('0x3c')]=_[_0xa55c('0x4c')](db[_0xa55c('0x55')][_0xa55c('0x36')]);_0x59414d[_0xa55c('0x3a')]=_[_0xa55c('0x4c')](_0x402f02[_0xa55c('0x3a')]);_0x59414d['filters']=_[_0xa55c('0x3b')](_0x59414d[_0xa55c('0x3c')],_0x59414d[_0xa55c('0x3a')]);_0x576a1b[_0xa55c('0x3e')]=_[_0xa55c('0x3b')](_0x59414d['model'],qs[_0xa55c('0x3d')](_0x402f02[_0xa55c('0x3a')]['fields']));_0x576a1b['attributes']=_0x576a1b[_0xa55c('0x3e')][_0xa55c('0x4d')]?_0x576a1b['attributes']:_0x59414d['model'];_0x576a1b['order']=qs['sort'](_0x402f02[_0xa55c('0x3a')][_0xa55c('0x42')]);_0x576a1b[_0xa55c('0x43')]=qs[_0xa55c('0x44')](_[_0xa55c('0x56')](_0x402f02[_0xa55c('0x3a')],_0x59414d['filters']));if(_0x402f02[_0xa55c('0x3a')][_0xa55c('0x45')]){_0x576a1b[_0xa55c('0x43')]=_[_0xa55c('0x46')](_0x576a1b['where'],{'$or':_[_0xa55c('0x39')](_0x576a1b[_0xa55c('0x3e')],function(_0x36824c){var _0x4cc104={};_0x4cc104[_0x36824c]={'$like':'%'+_0x402f02[_0xa55c('0x3a')]['filter']+'%'};return _0x4cc104;})});}_0x576a1b=_['merge']({},_0x576a1b,_0x402f02[_0xa55c('0x4f')]);return _0x14cb74[_0xa55c('0x58')](_0x576a1b);}})[_0xa55c('0x1d')](function(_0x249b0c){if(_0x249b0c){_0x2948b1=_0x249b0c[_0xa55c('0x4d')];if(!_0x402f02[_0xa55c('0x3a')][_0xa55c('0x3f')]('nolimit')){_0x576a1b['limit']=qs[_0xa55c('0x2b')](_0x402f02[_0xa55c('0x3a')][_0xa55c('0x2b')]);_0x576a1b[_0xa55c('0x2a')]=qs[_0xa55c('0x2a')](_0x402f02[_0xa55c('0x3a')][_0xa55c('0x2a')]);}return _0x14cb74[_0xa55c('0x58')](_0x576a1b);}})[_0xa55c('0x1d')](function(_0x115fc4){if(_0x115fc4){return _0x115fc4?{'count':_0x2948b1,'rows':_0x115fc4}:null;}})['then'](respondWithResult(_0x1ea5b6,null))[_0xa55c('0x4a')](handleError(_0x1ea5b6,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index aa95bd8..b3147b9 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 _0xe5f7=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash'];(function(_0x5dbb84,_0x1bbce9){var _0x1d6eae=function(_0xd93967){while(--_0xd93967){_0x5dbb84['push'](_0x5dbb84['shift']());}};_0x1d6eae(++_0x1bbce9);}(_0xe5f7,0x1bb));var _0x7e5f=function(_0x729065,_0x1e2437){_0x729065=_0x729065-0x0;var _0x179523=_0xe5f7[_0x729065];return _0x179523;};'use strict';var _=require(_0x7e5f('0x0'));var util=require(_0x7e5f('0x1'));var logger=require(_0x7e5f('0x2'))(_0x7e5f('0x3'));var moment=require(_0x7e5f('0x4'));var BPromise=require(_0x7e5f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e5f('0x6'));var config=require(_0x7e5f('0x7'));var attributes=require(_0x7e5f('0x8'));module[_0x7e5f('0x9')]=function(_0x559691,_0x9dc2d5){return _0x559691[_0x7e5f('0xa')]('ZohoConfiguration',attributes,{'tableName':_0x7e5f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f6f=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','int_zoho_configurations','lodash'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x3f6f,0x8b));var _0xf3f6=function(_0x23ac3a,_0x160858){_0x23ac3a=_0x23ac3a-0x0;var _0xe0e6e3=_0x3f6f[_0x23ac3a];return _0xe0e6e3;};'use strict';var _=require(_0xf3f6('0x0'));var util=require('util');var logger=require(_0xf3f6('0x1'))(_0xf3f6('0x2'));var moment=require(_0xf3f6('0x3'));var BPromise=require(_0xf3f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf3f6('0x5'));var config=require(_0xf3f6('0x6'));var attributes=require(_0xf3f6('0x7'));module[_0xf3f6('0x8')]=function(_0x3a9228,_0x247235){return _0x3a9228['define']('ZohoConfiguration',attributes,{'tableName':_0xf3f6('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 b84da04..b10b0cd 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 _0x3515=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','code','error','ZohoConfiguration,\x20%s,\x20%s','message','request\x20sent','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','debug'];(function(_0x1a7968,_0x2a030c){var _0x10439c=function(_0x4c6978){while(--_0x4c6978){_0x1a7968['push'](_0x1a7968['shift']());}};_0x10439c(++_0x2a030c);}(_0x3515,0x170));var _0x5351=function(_0x98821e,_0xef82ea){_0x98821e=_0x98821e-0x0;var _0x3f3852=_0x3515[_0x98821e];return _0x3f3852;};'use strict';var _=require(_0x5351('0x0'));var util=require('util');var moment=require(_0x5351('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5351('0x2'));var db=require(_0x5351('0x3'))['db'];var utils=require(_0x5351('0x4'));var logger=require(_0x5351('0x5'))(_0x5351('0x6'));var config=require(_0x5351('0x7'));var jayson=require(_0x5351('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x347cd2,_0x3cda8d,_0x32edbc){return new BPromise(function(_0x4dca53,_0x14c66d){return client[_0x5351('0x9')](_0x347cd2,_0x32edbc)['then'](function(_0x19f774){logger[_0x5351('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x3cda8d,'request\x20sent');logger[_0x5351('0xb')](_0x5351('0xc'),_0x3cda8d,'request\x20sent',JSON['stringify'](_0x19f774));if(_0x19f774['error']){if(_0x19f774['error'][_0x5351('0xd')]===0x1f4){logger[_0x5351('0xe')](_0x5351('0xf'),_0x3cda8d,_0x19f774[_0x5351('0xe')][_0x5351('0x10')]);return _0x14c66d(_0x19f774[_0x5351('0xe')][_0x5351('0x10')]);}logger[_0x5351('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x3cda8d,_0x19f774['error']['message']);return _0x4dca53(_0x19f774[_0x5351('0xe')][_0x5351('0x10')]);}else{logger[_0x5351('0xa')](_0x5351('0xf'),_0x3cda8d,_0x5351('0x11'));_0x4dca53(_0x19f774['result'][_0x5351('0x10')]);}})[_0x5351('0x12')](function(_0x237647){logger[_0x5351('0xe')](_0x5351('0xf'),_0x3cda8d,_0x237647);_0x14c66d(_0x237647);});});} \ No newline at end of file +var _0xef57=['rpc','client','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xef57,0xa0));var _0x7ef5=function(_0x54b89a,_0x4d962c){_0x54b89a=_0x54b89a-0x0;var _0x3df460=_0xef57[_0x54b89a];return _0x3df460;};'use strict';var _=require(_0x7ef5('0x0'));var util=require(_0x7ef5('0x1'));var moment=require(_0x7ef5('0x2'));var BPromise=require(_0x7ef5('0x3'));var rs=require(_0x7ef5('0x4'));var fs=require('fs');var Redis=require(_0x7ef5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ef5('0x6'));var logger=require(_0x7ef5('0x7'))(_0x7ef5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7ef5('0x9')][_0x7ef5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3762e3,_0x51d71b,_0x352c01){return new BPromise(function(_0x1bb047,_0x340c11){return client[_0x7ef5('0xb')](_0x3762e3,_0x352c01)[_0x7ef5('0xc')](function(_0x541b23){logger[_0x7ef5('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x51d71b,_0x7ef5('0xe'));logger[_0x7ef5('0xf')](_0x7ef5('0x10'),_0x51d71b,_0x7ef5('0xe'),JSON[_0x7ef5('0x11')](_0x541b23));if(_0x541b23[_0x7ef5('0x12')]){if(_0x541b23[_0x7ef5('0x12')][_0x7ef5('0x13')]===0x1f4){logger[_0x7ef5('0x12')](_0x7ef5('0x14'),_0x51d71b,_0x541b23[_0x7ef5('0x12')][_0x7ef5('0x15')]);return _0x340c11(_0x541b23[_0x7ef5('0x12')][_0x7ef5('0x15')]);}logger[_0x7ef5('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x51d71b,_0x541b23[_0x7ef5('0x12')][_0x7ef5('0x15')]);return _0x1bb047(_0x541b23[_0x7ef5('0x12')][_0x7ef5('0x15')]);}else{logger[_0x7ef5('0xd')](_0x7ef5('0x14'),_0x51d71b,_0x7ef5('0xe'));_0x1bb047(_0x541b23[_0x7ef5('0x16')][_0x7ef5('0x15')]);}})[_0x7ef5('0x17')](function(_0x313e81){logger[_0x7ef5('0x12')](_0x7ef5('0x14'),_0x51d71b,_0x313e81);_0x340c11(_0x313e81);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 746bdfe..d7d0097 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 _0x2032=['get','isAuthenticated','index','/:id','show','post','update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intZohoField.controller'];(function(_0x4e7bcd,_0x436ac7){var _0x1881ed=function(_0xaabf8e){while(--_0xaabf8e){_0x4e7bcd['push'](_0x4e7bcd['shift']());}};_0x1881ed(++_0x436ac7);}(_0x2032,0xd9));var _0x2203=function(_0x23ef8c,_0x44d500){_0x23ef8c=_0x23ef8c-0x0;var _0x364fc0=_0x2032[_0x23ef8c];return _0x364fc0;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var auth=require(_0x2203('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2203('0x5'));var controller=require(_0x2203('0x6'));router[_0x2203('0x7')]('/',auth[_0x2203('0x8')](),controller[_0x2203('0x9')]);router[_0x2203('0x7')](_0x2203('0xa'),auth[_0x2203('0x8')](),controller[_0x2203('0xb')]);router[_0x2203('0xc')]('/',auth[_0x2203('0x8')](),controller['create']);router['put'](_0x2203('0xa'),auth['isAuthenticated'](),controller[_0x2203('0xd')]);router[_0x2203('0xe')](_0x2203('0xa'),auth['isAuthenticated'](),controller[_0x2203('0xf')]);module['exports']=router; \ No newline at end of file +var _0x4bd3=['isAuthenticated','index','/:id','post','create','put','delete','destroy','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4bd3,0x174));var _0x34bd=function(_0x1562c4,_0x1d7c00){_0x1562c4=_0x1562c4-0x0;var _0x3811b8=_0x4bd3[_0x1562c4];return _0x3811b8;};'use strict';var multer=require(_0x34bd('0x0'));var util=require('util');var path=require(_0x34bd('0x1'));var timeout=require(_0x34bd('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x34bd('0x3'));var config=require(_0x34bd('0x4'));var controller=require(_0x34bd('0x5'));router['get']('/',auth[_0x34bd('0x6')](),controller[_0x34bd('0x7')]);router['get'](_0x34bd('0x8'),auth[_0x34bd('0x6')](),controller['show']);router[_0x34bd('0x9')]('/',auth[_0x34bd('0x6')](),controller[_0x34bd('0xa')]);router[_0x34bd('0xb')](_0x34bd('0x8'),auth[_0x34bd('0x6')](),controller['update']);router[_0x34bd('0xc')](_0x34bd('0x8'),auth[_0x34bd('0x6')](),controller[_0x34bd('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index c3b180a..8887f2c 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 _0xbeff=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x17dd51,_0x2d09c6){var _0x462eb0=function(_0x3b9f21){while(--_0x3b9f21){_0x17dd51['push'](_0x17dd51['shift']());}};_0x462eb0(++_0x2d09c6);}(_0xbeff,0x8e));var _0xfbef=function(_0x218b5c,_0x2a99ba){_0x218b5c=_0x218b5c-0x0;var _0x2e9577=_0xbeff[_0x218b5c];return _0x2e9577;};'use strict';var Sequelize=require('sequelize');module[_0xfbef('0x0')]={'type':{'type':Sequelize[_0xfbef('0x1')](_0xfbef('0x2'),_0xfbef('0x3'),_0xfbef('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xfbef('0x5')]},'key':{'type':Sequelize[_0xfbef('0x5')]},'keyType':{'type':Sequelize[_0xfbef('0x1')](_0xfbef('0x2'),'variable',_0xfbef('0x4'))},'keyContent':{'type':Sequelize[_0xfbef('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfbef('0x5')]},'customField':{'type':Sequelize[_0xfbef('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x406e=['keyValue','STRING','BOOLEAN','sequelize','string','variable','customVariable'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x406e,0xab));var _0xe406=function(_0x2daa45,_0x14f40b){_0x2daa45=_0x2daa45-0x0;var _0x1dce8e=_0x406e[_0x2daa45];return _0x1dce8e;};'use strict';var Sequelize=require(_0xe406('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xe406('0x1'),_0xe406('0x2'),_0xe406('0x3'),_0xe406('0x4')),'defaultValue':_0xe406('0x1')},'content':{'type':Sequelize[_0xe406('0x5')]},'key':{'type':Sequelize[_0xe406('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xe406('0x2'),_0xe406('0x3'))},'keyContent':{'type':Sequelize[_0xe406('0x5')]},'idField':{'type':Sequelize[_0xe406('0x5')]},'nameField':{'type':Sequelize[_0xe406('0x5')]},'customField':{'type':Sequelize[_0xe406('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe406('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index b4f797b..0f7620b 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 _0xab92=['keys','attributes','intersection','fields','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','ZohoField','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','map','fieldName','type','model','query'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xab92,0x1be));var _0x2ab9=function(_0x486bcf,_0x7c328e){_0x486bcf=_0x486bcf-0x0;var _0x1ded0a=_0xab92[_0x486bcf];return _0x1ded0a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2ab9('0x0'));var rimraf=require(_0x2ab9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2ab9('0x2'));var moment=require('moment');var BPromise=require(_0x2ab9('0x3'));var Mustache=require(_0x2ab9('0x4'));var util=require(_0x2ab9('0x5'));var path=require(_0x2ab9('0x6'));var sox=require(_0x2ab9('0x7'));var csv=require('to-csv');var ejs=require(_0x2ab9('0x8'));var fs=require('fs');var _=require(_0x2ab9('0x9'));var squel=require(_0x2ab9('0xa'));var crypto=require(_0x2ab9('0xb'));var jsforce=require(_0x2ab9('0xc'));var deskjs=require(_0x2ab9('0xd'));var toCsv=require(_0x2ab9('0xe'));var querystring=require('querystring');var Papa=require(_0x2ab9('0xf'));var Redis=require('ioredis');var authService=require(_0x2ab9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2ab9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ab9('0x12'))(_0x2ab9('0x13'));var utils=require(_0x2ab9('0x14'));var config=require(_0x2ab9('0x15'));var db=require(_0x2ab9('0x16'))['db'];function respondWithStatusCode(_0x2ca82f,_0x78b131){_0x78b131=_0x78b131||0xcc;return function(_0x1e78d1){if(_0x1e78d1){return _0x2ca82f[_0x2ab9('0x17')](_0x78b131);}return _0x2ca82f[_0x2ab9('0x18')](_0x78b131)[_0x2ab9('0x19')]();};}function respondWithResult(_0x3ab453,_0x2e0cb7){_0x2e0cb7=_0x2e0cb7||0xc8;return function(_0x2d50bb){if(_0x2d50bb){return _0x3ab453[_0x2ab9('0x18')](_0x2e0cb7)['json'](_0x2d50bb);}};}function respondWithFilteredResult(_0x206b74,_0x10ef4d){return function(_0x4b9090){if(_0x4b9090){var _0x112afe=_0x4b9090[_0x2ab9('0x1a')],_0x2358b4=_0x10ef4d[_0x2ab9('0x1b')],_0x2cc231=_0x10ef4d[_0x2ab9('0x1b')]+_0x10ef4d[_0x2ab9('0x1c')],_0x24fa59;if(_0x2cc231>=_0x112afe){_0x2cc231=_0x112afe;_0x24fa59=0xc8;}else{_0x24fa59=0xce;}_0x206b74[_0x2ab9('0x18')](_0x24fa59);return _0x206b74[_0x2ab9('0x1d')](_0x2ab9('0x1e'),_0x2358b4+'-'+_0x2cc231+'/'+_0x112afe)['json'](_0x4b9090);}return null;};}function patchUpdates(_0x4a8965){return function(_0x1385e7){try{jsonpatch[_0x2ab9('0x1f')](_0x1385e7,_0x4a8965,!![]);}catch(_0x1199a4){return BPromise['reject'](_0x1199a4);}return _0x1385e7[_0x2ab9('0x20')]();};}function saveUpdates(_0x32bc64,_0x802830){return function(_0x4b3ef7){if(_0x4b3ef7){return _0x4b3ef7[_0x2ab9('0x21')](_0x32bc64)[_0x2ab9('0x22')](function(_0x1e556e){return _0x1e556e;});}return null;};}function removeEntity(_0x500c87,_0x3f6aa2){return function(_0x2e31a8){if(_0x2e31a8){return _0x2e31a8[_0x2ab9('0x23')]()['then'](function(){_0x500c87[_0x2ab9('0x18')](0xcc)[_0x2ab9('0x19')]();});}};}function handleEntityNotFound(_0x4e5124,_0x14fbad){return function(_0x1b472b){if(!_0x1b472b){_0x4e5124[_0x2ab9('0x17')](0x194);}return _0x1b472b;};}function handleError(_0x1b1309,_0x521b6f){_0x521b6f=_0x521b6f||0x1f4;return function(_0x25693b){logger[_0x2ab9('0x24')](_0x25693b['stack']);if(_0x25693b[_0x2ab9('0x25')]){delete _0x25693b[_0x2ab9('0x25')];}_0x1b1309[_0x2ab9('0x18')](_0x521b6f)[_0x2ab9('0x26')](_0x25693b);};}exports['index']=function(_0x4346cf,_0x2a87ea){var _0x242ffd={},_0xcb5645={},_0x2e7376={'count':0x0,'rows':[]};var _0x5e8f41=_[_0x2ab9('0x27')](db['ZohoField']['rawAttributes'],function(_0x18c530){return{'name':_0x18c530[_0x2ab9('0x28')],'type':_0x18c530[_0x2ab9('0x29')]['key']};});_0xcb5645[_0x2ab9('0x2a')]=_['map'](_0x5e8f41,'name');_0xcb5645[_0x2ab9('0x2b')]=_[_0x2ab9('0x2c')](_0x4346cf[_0x2ab9('0x2b')]);_0xcb5645['filters']=_['intersection'](_0xcb5645[_0x2ab9('0x2a')],_0xcb5645['query']);_0x242ffd[_0x2ab9('0x2d')]=_[_0x2ab9('0x2e')](_0xcb5645[_0x2ab9('0x2a')],qs[_0x2ab9('0x2f')](_0x4346cf[_0x2ab9('0x2b')][_0x2ab9('0x2f')]));_0x242ffd[_0x2ab9('0x2d')]=_0x242ffd[_0x2ab9('0x2d')]['length']?_0x242ffd['attributes']:_0xcb5645['model'];if(!_0x4346cf[_0x2ab9('0x2b')]['hasOwnProperty'](_0x2ab9('0x30'))){_0x242ffd['limit']=qs[_0x2ab9('0x1c')](_0x4346cf[_0x2ab9('0x2b')][_0x2ab9('0x1c')]);_0x242ffd[_0x2ab9('0x1b')]=qs[_0x2ab9('0x1b')](_0x4346cf[_0x2ab9('0x2b')][_0x2ab9('0x1b')]);}_0x242ffd[_0x2ab9('0x31')]=qs['sort'](_0x4346cf[_0x2ab9('0x2b')][_0x2ab9('0x32')]);_0x242ffd['where']=qs[_0x2ab9('0x33')](_[_0x2ab9('0x34')](_0x4346cf[_0x2ab9('0x2b')],_0xcb5645['filters']));if(_0x4346cf[_0x2ab9('0x2b')][_0x2ab9('0x35')]){_0x242ffd[_0x2ab9('0x36')]=_[_0x2ab9('0x37')](_0x242ffd[_0x2ab9('0x36')],{'$or':_[_0x2ab9('0x27')](_0x5e8f41,function(_0xd2238c){if(_0xd2238c[_0x2ab9('0x29')]!==_0x2ab9('0x38')){var _0x44782b={};_0x44782b[_0xd2238c['name']]={'$like':'%'+_0x4346cf['query'][_0x2ab9('0x35')]+'%'};return _0x44782b;}})});}_0x242ffd=_[_0x2ab9('0x37')]({},_0x242ffd,_0x4346cf['options']);var _0x5ec158={'where':_0x242ffd[_0x2ab9('0x36')]};return db[_0x2ab9('0x39')]['count'](_0x5ec158)[_0x2ab9('0x22')](function(_0x37e409){_0x2e7376[_0x2ab9('0x1a')]=_0x37e409;if(_0x4346cf['query'][_0x2ab9('0x3a')]){_0x242ffd[_0x2ab9('0x3b')]=[{'all':!![]}];}return db[_0x2ab9('0x39')][_0x2ab9('0x3c')](_0x242ffd);})[_0x2ab9('0x22')](function(_0x3ac581){_0x2e7376[_0x2ab9('0x3d')]=_0x3ac581;return _0x2e7376;})[_0x2ab9('0x22')](respondWithFilteredResult(_0x2a87ea,_0x242ffd))[_0x2ab9('0x3e')](handleError(_0x2a87ea,null));};exports[_0x2ab9('0x3f')]=function(_0x34093a,_0x209055){var _0x1642e0={'raw':!![],'where':{'id':_0x34093a[_0x2ab9('0x40')]['id']}},_0x3832f4={};_0x3832f4[_0x2ab9('0x2a')]=_[_0x2ab9('0x2c')](db[_0x2ab9('0x39')][_0x2ab9('0x41')]);_0x3832f4[_0x2ab9('0x2b')]=_[_0x2ab9('0x2c')](_0x34093a[_0x2ab9('0x2b')]);_0x3832f4[_0x2ab9('0x33')]=_[_0x2ab9('0x2e')](_0x3832f4[_0x2ab9('0x2a')],_0x3832f4[_0x2ab9('0x2b')]);_0x1642e0[_0x2ab9('0x2d')]=_['intersection'](_0x3832f4[_0x2ab9('0x2a')],qs['fields'](_0x34093a['query'][_0x2ab9('0x2f')]));_0x1642e0[_0x2ab9('0x2d')]=_0x1642e0[_0x2ab9('0x2d')]['length']?_0x1642e0['attributes']:_0x3832f4[_0x2ab9('0x2a')];if(_0x34093a[_0x2ab9('0x2b')]['includeAll']){_0x1642e0[_0x2ab9('0x3b')]=[{'all':!![]}];}_0x1642e0=_[_0x2ab9('0x37')]({},_0x1642e0,_0x34093a[_0x2ab9('0x42')]);return db[_0x2ab9('0x39')][_0x2ab9('0x43')](_0x1642e0)[_0x2ab9('0x22')](handleEntityNotFound(_0x209055,null))[_0x2ab9('0x22')](respondWithResult(_0x209055,null))[_0x2ab9('0x3e')](handleError(_0x209055,null));};exports['create']=function(_0xc6a50f,_0x215c6b){return db[_0x2ab9('0x39')][_0x2ab9('0x44')](_0xc6a50f[_0x2ab9('0x45')],{})[_0x2ab9('0x22')](respondWithResult(_0x215c6b,0xc9))[_0x2ab9('0x3e')](handleError(_0x215c6b,null));};exports[_0x2ab9('0x21')]=function(_0x13f7fa,_0x13266d){if(_0x13f7fa[_0x2ab9('0x45')]['id']){delete _0x13f7fa[_0x2ab9('0x45')]['id'];}return db[_0x2ab9('0x39')]['find']({'where':{'id':_0x13f7fa['params']['id']}})[_0x2ab9('0x22')](handleEntityNotFound(_0x13266d,null))['then'](saveUpdates(_0x13f7fa['body'],null))['then'](respondWithResult(_0x13266d,null))[_0x2ab9('0x3e')](handleError(_0x13266d,null));};exports['destroy']=function(_0x128c68,_0x264d8d){return db[_0x2ab9('0x39')][_0x2ab9('0x43')]({'where':{'id':_0x128c68[_0x2ab9('0x40')]['id']}})[_0x2ab9('0x22')](handleEntityNotFound(_0x264d8d,null))[_0x2ab9('0x22')](removeEntity(_0x264d8d,null))[_0x2ab9('0x3e')](handleError(_0x264d8d,null));}; \ No newline at end of file +var _0xd261=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','Content-Range','reject','save','update','then','destroy','end','name','send','index','map','ZohoField','fieldName','type','key','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','params','model','rawAttributes','find','create','body','rimraf','fast-json-patch','moment','bluebird','util','path'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0xd261,0x82));var _0x1d26=function(_0x207bd8,_0x4c36ca){_0x207bd8=_0x207bd8-0x0;var _0x2d7a72=_0xd261[_0x207bd8];return _0x2d7a72;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1d26('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1d26('0x1'));var rp=require('request-promise');var moment=require(_0x1d26('0x2'));var BPromise=require(_0x1d26('0x3'));var Mustache=require('mustache');var util=require(_0x1d26('0x4'));var path=require(_0x1d26('0x5'));var sox=require(_0x1d26('0x6'));var csv=require(_0x1d26('0x7'));var ejs=require(_0x1d26('0x8'));var fs=require('fs');var _=require(_0x1d26('0x9'));var squel=require(_0x1d26('0xa'));var crypto=require(_0x1d26('0xb'));var jsforce=require(_0x1d26('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1d26('0x7'));var querystring=require(_0x1d26('0xd'));var Papa=require(_0x1d26('0xe'));var Redis=require(_0x1d26('0xf'));var authService=require(_0x1d26('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d26('0x11'));var logger=require('../../config/logger')(_0x1d26('0x12'));var utils=require(_0x1d26('0x13'));var config=require(_0x1d26('0x14'));var db=require(_0x1d26('0x15'))['db'];function respondWithStatusCode(_0xf33e4b,_0x1362ca){_0x1362ca=_0x1362ca||0xcc;return function(_0x596539){if(_0x596539){return _0xf33e4b['sendStatus'](_0x1362ca);}return _0xf33e4b[_0x1d26('0x16')](_0x1362ca)['end']();};}function respondWithResult(_0xd1f56e,_0x55b43a){_0x55b43a=_0x55b43a||0xc8;return function(_0x576b82){if(_0x576b82){return _0xd1f56e[_0x1d26('0x16')](_0x55b43a)[_0x1d26('0x17')](_0x576b82);}};}function respondWithFilteredResult(_0x2cc811,_0x5df725){return function(_0x35d734){if(_0x35d734){var _0xd54ad5=_0x35d734['count'],_0x53a979=_0x5df725[_0x1d26('0x18')],_0x42e234=_0x5df725['offset']+_0x5df725[_0x1d26('0x19')],_0x708581;if(_0x42e234>=_0xd54ad5){_0x42e234=_0xd54ad5;_0x708581=0xc8;}else{_0x708581=0xce;}_0x2cc811['status'](_0x708581);return _0x2cc811['set'](_0x1d26('0x1a'),_0x53a979+'-'+_0x42e234+'/'+_0xd54ad5)[_0x1d26('0x17')](_0x35d734);}return null;};}function patchUpdates(_0x31211a){return function(_0x1708db){try{jsonpatch['apply'](_0x1708db,_0x31211a,!![]);}catch(_0x423500){return BPromise[_0x1d26('0x1b')](_0x423500);}return _0x1708db[_0x1d26('0x1c')]();};}function saveUpdates(_0xb23d9,_0x27403a){return function(_0x28e887){if(_0x28e887){return _0x28e887[_0x1d26('0x1d')](_0xb23d9)[_0x1d26('0x1e')](function(_0x5a11ca){return _0x5a11ca;});}return null;};}function removeEntity(_0x5dbf06,_0x34cfcb){return function(_0x14eb70){if(_0x14eb70){return _0x14eb70[_0x1d26('0x1f')]()[_0x1d26('0x1e')](function(){_0x5dbf06[_0x1d26('0x16')](0xcc)[_0x1d26('0x20')]();});}};}function handleEntityNotFound(_0x53190a,_0x4dbcea){return function(_0x3c08ec){if(!_0x3c08ec){_0x53190a['sendStatus'](0x194);}return _0x3c08ec;};}function handleError(_0x2ae03c,_0x4efc22){_0x4efc22=_0x4efc22||0x1f4;return function(_0x11f647){logger['error'](_0x11f647['stack']);if(_0x11f647[_0x1d26('0x21')]){delete _0x11f647[_0x1d26('0x21')];}_0x2ae03c[_0x1d26('0x16')](_0x4efc22)[_0x1d26('0x22')](_0x11f647);};}exports[_0x1d26('0x23')]=function(_0x5788b7,_0x3d5809){var _0xf32bf1={},_0x52afba={},_0x46f5bf={'count':0x0,'rows':[]};var _0x55ce45=_[_0x1d26('0x24')](db[_0x1d26('0x25')]['rawAttributes'],function(_0x3d3b64){return{'name':_0x3d3b64[_0x1d26('0x26')],'type':_0x3d3b64[_0x1d26('0x27')][_0x1d26('0x28')]};});_0x52afba['model']=_[_0x1d26('0x24')](_0x55ce45,'name');_0x52afba[_0x1d26('0x29')]=_[_0x1d26('0x2a')](_0x5788b7[_0x1d26('0x29')]);_0x52afba['filters']=_[_0x1d26('0x2b')](_0x52afba['model'],_0x52afba['query']);_0xf32bf1[_0x1d26('0x2c')]=_[_0x1d26('0x2b')](_0x52afba['model'],qs[_0x1d26('0x2d')](_0x5788b7[_0x1d26('0x29')][_0x1d26('0x2d')]));_0xf32bf1[_0x1d26('0x2c')]=_0xf32bf1[_0x1d26('0x2c')][_0x1d26('0x2e')]?_0xf32bf1[_0x1d26('0x2c')]:_0x52afba['model'];if(!_0x5788b7[_0x1d26('0x29')][_0x1d26('0x2f')]('nolimit')){_0xf32bf1[_0x1d26('0x19')]=qs[_0x1d26('0x19')](_0x5788b7[_0x1d26('0x29')][_0x1d26('0x19')]);_0xf32bf1[_0x1d26('0x18')]=qs['offset'](_0x5788b7['query']['offset']);}_0xf32bf1[_0x1d26('0x30')]=qs[_0x1d26('0x31')](_0x5788b7['query']['sort']);_0xf32bf1[_0x1d26('0x32')]=qs[_0x1d26('0x33')](_[_0x1d26('0x34')](_0x5788b7[_0x1d26('0x29')],_0x52afba['filters']));if(_0x5788b7[_0x1d26('0x29')][_0x1d26('0x35')]){_0xf32bf1[_0x1d26('0x32')]=_[_0x1d26('0x36')](_0xf32bf1[_0x1d26('0x32')],{'$or':_['map'](_0x55ce45,function(_0x49b033){if(_0x49b033[_0x1d26('0x27')]!==_0x1d26('0x37')){var _0x4c64ec={};_0x4c64ec[_0x49b033[_0x1d26('0x21')]]={'$like':'%'+_0x5788b7[_0x1d26('0x29')][_0x1d26('0x35')]+'%'};return _0x4c64ec;}})});}_0xf32bf1=_[_0x1d26('0x36')]({},_0xf32bf1,_0x5788b7[_0x1d26('0x38')]);var _0x286b8a={'where':_0xf32bf1[_0x1d26('0x32')]};return db[_0x1d26('0x25')][_0x1d26('0x39')](_0x286b8a)[_0x1d26('0x1e')](function(_0x367456){_0x46f5bf[_0x1d26('0x39')]=_0x367456;if(_0x5788b7['query'][_0x1d26('0x3a')]){_0xf32bf1[_0x1d26('0x3b')]=[{'all':!![]}];}return db[_0x1d26('0x25')][_0x1d26('0x3c')](_0xf32bf1);})[_0x1d26('0x1e')](function(_0x2e4b17){_0x46f5bf['rows']=_0x2e4b17;return _0x46f5bf;})['then'](respondWithFilteredResult(_0x3d5809,_0xf32bf1))[_0x1d26('0x3d')](handleError(_0x3d5809,null));};exports['show']=function(_0x1f89c4,_0xf9735a){var _0x33bcaa={'raw':!![],'where':{'id':_0x1f89c4[_0x1d26('0x3e')]['id']}},_0x432e41={};_0x432e41[_0x1d26('0x3f')]=_[_0x1d26('0x2a')](db['ZohoField'][_0x1d26('0x40')]);_0x432e41[_0x1d26('0x29')]=_[_0x1d26('0x2a')](_0x1f89c4['query']);_0x432e41['filters']=_[_0x1d26('0x2b')](_0x432e41[_0x1d26('0x3f')],_0x432e41['query']);_0x33bcaa['attributes']=_[_0x1d26('0x2b')](_0x432e41[_0x1d26('0x3f')],qs['fields'](_0x1f89c4[_0x1d26('0x29')][_0x1d26('0x2d')]));_0x33bcaa[_0x1d26('0x2c')]=_0x33bcaa[_0x1d26('0x2c')][_0x1d26('0x2e')]?_0x33bcaa[_0x1d26('0x2c')]:_0x432e41[_0x1d26('0x3f')];if(_0x1f89c4[_0x1d26('0x29')][_0x1d26('0x3a')]){_0x33bcaa[_0x1d26('0x3b')]=[{'all':!![]}];}_0x33bcaa=_['merge']({},_0x33bcaa,_0x1f89c4[_0x1d26('0x38')]);return db['ZohoField'][_0x1d26('0x41')](_0x33bcaa)[_0x1d26('0x1e')](handleEntityNotFound(_0xf9735a,null))['then'](respondWithResult(_0xf9735a,null))[_0x1d26('0x3d')](handleError(_0xf9735a,null));};exports[_0x1d26('0x42')]=function(_0x12be7e,_0x288a6d){return db[_0x1d26('0x25')][_0x1d26('0x42')](_0x12be7e[_0x1d26('0x43')],{})['then'](respondWithResult(_0x288a6d,0xc9))[_0x1d26('0x3d')](handleError(_0x288a6d,null));};exports['update']=function(_0x5caf9c,_0x19ba07){if(_0x5caf9c[_0x1d26('0x43')]['id']){delete _0x5caf9c[_0x1d26('0x43')]['id'];}return db[_0x1d26('0x25')][_0x1d26('0x41')]({'where':{'id':_0x5caf9c['params']['id']}})[_0x1d26('0x1e')](handleEntityNotFound(_0x19ba07,null))['then'](saveUpdates(_0x5caf9c[_0x1d26('0x43')],null))[_0x1d26('0x1e')](respondWithResult(_0x19ba07,null))[_0x1d26('0x3d')](handleError(_0x19ba07,null));};exports[_0x1d26('0x1f')]=function(_0x394fd8,_0x22d04d){return db[_0x1d26('0x25')]['find']({'where':{'id':_0x394fd8[_0x1d26('0x3e')]['id']}})[_0x1d26('0x1e')](handleEntityNotFound(_0x22d04d,null))[_0x1d26('0x1e')](removeEntity(_0x22d04d,null))[_0x1d26('0x3d')](handleError(_0x22d04d,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1b017dd..f903eb2 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 _0x1f93=['idField','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','int_zoho_fields','zoho_unique_index'];(function(_0x441740,_0x54b0ff){var _0x1e4284=function(_0x35f7ae){while(--_0x35f7ae){_0x441740['push'](_0x441740['shift']());}};_0x1e4284(++_0x54b0ff);}(_0x1f93,0x17a));var _0x31f9=function(_0x43ff74,_0xcb9093){_0x43ff74=_0x43ff74-0x0;var _0x21b61c=_0x1f93[_0x43ff74];return _0x21b61c;};'use strict';var _=require(_0x31f9('0x0'));var util=require(_0x31f9('0x1'));var logger=require(_0x31f9('0x2'))('api');var moment=require(_0x31f9('0x3'));var BPromise=require('bluebird');var rp=require(_0x31f9('0x4'));var fs=require('fs');var path=require(_0x31f9('0x5'));var rimraf=require(_0x31f9('0x6'));var config=require(_0x31f9('0x7'));var attributes=require('./intZohoField.attributes');module[_0x31f9('0x8')]=function(_0x1cf199,_0x40b6bf){return _0x1cf199[_0x31f9('0x9')]('ZohoField',attributes,{'tableName':_0x31f9('0xa'),'paranoid':![],'indexes':[{'name':_0x31f9('0xb'),'fields':[_0x31f9('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x309a=['util','api','moment','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId'];(function(_0x473e77,_0x52482a){var _0x13b8bc=function(_0x4cbda1){while(--_0x4cbda1){_0x473e77['push'](_0x473e77['shift']());}};_0x13b8bc(++_0x52482a);}(_0x309a,0x1dc));var _0xa309=function(_0x5e74d5,_0x434427){_0x5e74d5=_0x5e74d5-0x0;var _0x6d00bb=_0x309a[_0x5e74d5];return _0x6d00bb;};'use strict';var _=require('lodash');var util=require(_0xa309('0x0'));var logger=require('../../config/logger')(_0xa309('0x1'));var moment=require(_0xa309('0x2'));var BPromise=require('bluebird');var rp=require(_0xa309('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa309('0x4'));var config=require(_0xa309('0x5'));var attributes=require(_0xa309('0x6'));module[_0xa309('0x7')]=function(_0x5776e6,_0x20575a){return _0x5776e6[_0xa309('0x8')](_0xa309('0x9'),attributes,{'tableName':_0xa309('0xa'),'paranoid':![],'indexes':[{'name':_0xa309('0xb'),'fields':[_0xa309('0xc'),_0xa309('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 0e5bce2..092d40b 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 _0x5075=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5075,0x73));var _0x5507=function(_0x38de33,_0x4361bb){_0x38de33=_0x38de33-0x0;var _0x40f16d=_0x5075[_0x38de33];return _0x40f16d;};'use strict';var _=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var moment=require(_0x5507('0x2'));var BPromise=require(_0x5507('0x3'));var rs=require(_0x5507('0x4'));var fs=require('fs');var Redis=require(_0x5507('0x5'));var db=require(_0x5507('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5507('0x7'))(_0x5507('0x8'));var config=require(_0x5507('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5507('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x773559,_0x4c2d6d,_0x42c232){return new BPromise(function(_0x7cc84c,_0xbf4b50){return client['request'](_0x773559,_0x42c232)['then'](function(_0xe8c49){logger[_0x5507('0xb')](_0x5507('0xc'),_0x4c2d6d,_0x5507('0xd'));logger['debug'](_0x5507('0xe'),_0x4c2d6d,_0x5507('0xd'),JSON['stringify'](_0xe8c49));if(_0xe8c49[_0x5507('0xf')]){if(_0xe8c49[_0x5507('0xf')]['code']===0x1f4){logger[_0x5507('0xf')](_0x5507('0xc'),_0x4c2d6d,_0xe8c49[_0x5507('0xf')][_0x5507('0x10')]);return _0xbf4b50(_0xe8c49[_0x5507('0xf')][_0x5507('0x10')]);}logger['error'](_0x5507('0xc'),_0x4c2d6d,_0xe8c49[_0x5507('0xf')][_0x5507('0x10')]);return _0x7cc84c(_0xe8c49[_0x5507('0xf')]['message']);}else{logger[_0x5507('0xb')](_0x5507('0xc'),_0x4c2d6d,_0x5507('0xd'));_0x7cc84c(_0xe8c49[_0x5507('0x11')][_0x5507('0x10')]);}})[_0x5507('0x12')](function(_0x241932){logger[_0x5507('0xf')](_0x5507('0xc'),_0x4c2d6d,_0x241932);_0xbf4b50(_0x241932);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x49bb31,_0x70c6bd){var _0xbebf43=function(_0x43db09){while(--_0x43db09){_0x49bb31['push'](_0x49bb31['shift']());}};_0xbebf43(++_0x70c6bd);}(_0xe14b,0x93));var _0xbe14=function(_0x49078b,_0x643569){_0x49078b=_0x49078b-0x0;var _0x4accff=_0xe14b[_0x49078b];return _0x4accff;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 071cdbb..e1e7ac1 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 _0x7668=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0x7668,0x110));var _0x8766=function(_0x1bad26,_0xf6f79f){_0x1bad26=_0x1bad26-0x0;var _0x23b581=_0x7668[_0x1bad26];return _0x23b581;};'use strict';var multer=require('multer');var util=require(_0x8766('0x0'));var path=require(_0x8766('0x1'));var timeout=require('connect-timeout');var express=require(_0x8766('0x2'));var router=express['Router']();var auth=require(_0x8766('0x3'));var interaction=require(_0x8766('0x4'));var config=require(_0x8766('0x5'));module[_0x8766('0x6')]=router; \ No newline at end of file +var _0x6893=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path'];(function(_0x97a009,_0x1c8008){var _0xc97c18=function(_0x22e99d){while(--_0x22e99d){_0x97a009['push'](_0x97a009['shift']());}};_0xc97c18(++_0x1c8008);}(_0x6893,0x6d));var _0x3689=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x6893[_0x39e84d];return _0x1991bc;};'use strict';var multer=require(_0x3689('0x0'));var util=require(_0x3689('0x1'));var path=require(_0x3689('0x2'));var timeout=require(_0x3689('0x3'));var express=require('express');var router=express[_0x3689('0x4')]();var auth=require(_0x3689('0x5'));var interaction=require(_0x3689('0x6'));var config=require(_0x3689('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 82df806..ea0b3cd 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 _0x0f13=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x55c125,_0x410aec){var _0x36fab5=function(_0x2a3d61){while(--_0x2a3d61){_0x55c125['push'](_0x55c125['shift']());}};_0x36fab5(++_0x410aec);}(_0x0f13,0x1e0));var _0x30f1=function(_0x4f3995,_0x512438){_0x4f3995=_0x4f3995-0x0;var _0x43036a=_0x0f13[_0x4f3995];return _0x43036a;};'use strict';var Sequelize=require(_0x30f1('0x0'));module[_0x30f1('0x1')]={'name':{'type':Sequelize[_0x30f1('0x2')],'allowNull':![],'unique':_0x30f1('0x3')},'version':{'type':Sequelize[_0x30f1('0x2')],'allowNull':![],'unique':_0x30f1('0x3')},'main':{'type':Sequelize[_0x30f1('0x2')],'defaultValue':_0x30f1('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x30f1('0x2')]},'type':{'type':Sequelize[_0x30f1('0x2')]},'size':{'type':Sequelize[_0x30f1('0x5')]},'active':{'type':Sequelize[_0x30f1('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x30f1('0x2')]},'logo':{'type':Sequelize[_0x30f1('0x2')]},'state':{'type':Sequelize[_0x30f1('0x2')],'unique':_0x30f1('0x7')},'description':{'type':Sequelize[_0x30f1('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x30f1('0x2')]},'link':{'type':Sequelize[_0x30f1('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x8be4=['STRING','app.js','state','exports','unique_name_and_version'];(function(_0x3c3261,_0x57f7cb){var _0x47e89a=function(_0x5e97eb){while(--_0x5e97eb){_0x3c3261['push'](_0x3c3261['shift']());}};_0x47e89a(++_0x57f7cb);}(_0x8be4,0xb2));var _0x48be=function(_0xf3c843,_0x8ff24e){_0xf3c843=_0xf3c843-0x0;var _0x3191c6=_0x8be4[_0xf3c843];return _0x3191c6;};'use strict';var Sequelize=require('sequelize');module[_0x48be('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x48be('0x1')},'version':{'type':Sequelize[_0x48be('0x2')],'allowNull':![],'unique':_0x48be('0x1')},'main':{'type':Sequelize[_0x48be('0x2')],'defaultValue':_0x48be('0x3')},'filename':{'type':Sequelize[_0x48be('0x2')]},'path':{'type':Sequelize[_0x48be('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x48be('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0x48be('0x4')},'description':{'type':Sequelize[_0x48be('0x2')]},'title':{'type':Sequelize[_0x48be('0x2')]},'remoteUri':{'type':Sequelize[_0x48be('0x2')]},'link':{'type':Sequelize[_0x48be('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 11a4195..ed41eb0 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 _0x3394=['../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','Integration','count','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3da896,_0x113304){var _0x1cbf30=function(_0x4d6441){while(--_0x4d6441){_0x3da896['push'](_0x3da896['shift']());}};_0x1cbf30(++_0x113304);}(_0x3394,0x10f));var _0x4339=function(_0x3dd9aa,_0x55347f){_0x3dd9aa=_0x3dd9aa-0x0;var _0x58fb88=_0x3394[_0x3dd9aa];return _0x58fb88;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4339('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4339('0x1'));var rp=require('request-promise');var moment=require(_0x4339('0x2'));var BPromise=require(_0x4339('0x3'));var Mustache=require('mustache');var util=require(_0x4339('0x4'));var path=require(_0x4339('0x5'));var sox=require(_0x4339('0x6'));var csv=require(_0x4339('0x7'));var ejs=require(_0x4339('0x8'));var fs=require('fs');var _=require(_0x4339('0x9'));var squel=require(_0x4339('0xa'));var crypto=require(_0x4339('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4339('0xc'));var toCsv=require(_0x4339('0x7'));var querystring=require(_0x4339('0xd'));var Papa=require(_0x4339('0xe'));var Redis=require(_0x4339('0xf'));var authService=require(_0x4339('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4339('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4339('0x12'))('api');var utils=require(_0x4339('0x13'));var config=require('../../config/environment');var db=require(_0x4339('0x14'))['db'];function respondWithStatusCode(_0x1596e1,_0x272d40){_0x272d40=_0x272d40||0xcc;return function(_0x584fb6){if(_0x584fb6){return _0x1596e1[_0x4339('0x15')](_0x272d40);}return _0x1596e1[_0x4339('0x16')](_0x272d40)[_0x4339('0x17')]();};}function respondWithResult(_0xeb38ea,_0x4d45b0){_0x4d45b0=_0x4d45b0||0xc8;return function(_0x378237){if(_0x378237){return _0xeb38ea[_0x4339('0x16')](_0x4d45b0)[_0x4339('0x18')](_0x378237);}};}function respondWithFilteredResult(_0x422605,_0x5120d5){return function(_0x2eb712){if(_0x2eb712){var _0x4688a7=_0x2eb712['count'],_0x1ac317=_0x5120d5['offset'],_0x243657=_0x5120d5[_0x4339('0x19')]+_0x5120d5[_0x4339('0x1a')],_0x4c2125;if(_0x243657>=_0x4688a7){_0x243657=_0x4688a7;_0x4c2125=0xc8;}else{_0x4c2125=0xce;}_0x422605[_0x4339('0x16')](_0x4c2125);return _0x422605[_0x4339('0x1b')](_0x4339('0x1c'),_0x1ac317+'-'+_0x243657+'/'+_0x4688a7)[_0x4339('0x18')](_0x2eb712);}return null;};}function patchUpdates(_0x4ec309){return function(_0x11309b){try{jsonpatch[_0x4339('0x1d')](_0x11309b,_0x4ec309,!![]);}catch(_0x313eca){return BPromise[_0x4339('0x1e')](_0x313eca);}return _0x11309b[_0x4339('0x1f')]();};}function saveUpdates(_0x43e378,_0x581fc6){return function(_0x55772f){if(_0x55772f){return _0x55772f[_0x4339('0x20')](_0x43e378)[_0x4339('0x21')](function(_0x19364b){return _0x19364b;});}return null;};}function removeEntity(_0x3730eb,_0x4ee15c){return function(_0x2b5599){if(_0x2b5599){return _0x2b5599[_0x4339('0x22')]()['then'](function(){_0x3730eb['status'](0xcc)[_0x4339('0x17')]();});}};}function handleEntityNotFound(_0x4fb299,_0x5db8a3){return function(_0x4b23e3){if(!_0x4b23e3){_0x4fb299['sendStatus'](0x194);}return _0x4b23e3;};}function handleError(_0x50aedd,_0x5131ef){_0x5131ef=_0x5131ef||0x1f4;return function(_0x3b7c2c){logger[_0x4339('0x23')](_0x3b7c2c[_0x4339('0x24')]);if(_0x3b7c2c['name']){delete _0x3b7c2c[_0x4339('0x25')];}_0x50aedd['status'](_0x5131ef)[_0x4339('0x26')](_0x3b7c2c);};}exports[_0x4339('0x27')]=function(_0x82db96,_0x588466){var _0x3ae2f5={},_0x4258fd={},_0x216e82={'count':0x0,'rows':[]};var _0x5e5d99=_['map'](db['Integration']['rawAttributes'],function(_0x302a5e){return{'name':_0x302a5e[_0x4339('0x28')],'type':_0x302a5e[_0x4339('0x29')][_0x4339('0x2a')]};});_0x4258fd[_0x4339('0x2b')]=_[_0x4339('0x2c')](_0x5e5d99,_0x4339('0x25'));_0x4258fd[_0x4339('0x2d')]=_[_0x4339('0x2e')](_0x82db96[_0x4339('0x2d')]);_0x4258fd[_0x4339('0x2f')]=_[_0x4339('0x30')](_0x4258fd[_0x4339('0x2b')],_0x4258fd[_0x4339('0x2d')]);_0x3ae2f5[_0x4339('0x31')]=_[_0x4339('0x30')](_0x4258fd[_0x4339('0x2b')],qs[_0x4339('0x32')](_0x82db96[_0x4339('0x2d')][_0x4339('0x32')]));_0x3ae2f5[_0x4339('0x31')]=_0x3ae2f5[_0x4339('0x31')]['length']?_0x3ae2f5[_0x4339('0x31')]:_0x4258fd[_0x4339('0x2b')];if(!_0x82db96[_0x4339('0x2d')][_0x4339('0x33')](_0x4339('0x34'))){_0x3ae2f5[_0x4339('0x1a')]=qs['limit'](_0x82db96[_0x4339('0x2d')][_0x4339('0x1a')]);_0x3ae2f5[_0x4339('0x19')]=qs['offset'](_0x82db96[_0x4339('0x2d')]['offset']);}_0x3ae2f5['order']=qs[_0x4339('0x35')](_0x82db96[_0x4339('0x2d')][_0x4339('0x35')]);_0x3ae2f5['where']=qs[_0x4339('0x2f')](_[_0x4339('0x36')](_0x82db96['query'],_0x4258fd[_0x4339('0x2f')]));if(_0x82db96[_0x4339('0x2d')]['filter']){_0x3ae2f5['where']=_[_0x4339('0x37')](_0x3ae2f5[_0x4339('0x38')],{'$or':_[_0x4339('0x2c')](_0x5e5d99,function(_0x863655){if(_0x863655[_0x4339('0x29')]!==_0x4339('0x39')){var _0x552a88={};_0x552a88[_0x863655[_0x4339('0x25')]]={'$like':'%'+_0x82db96[_0x4339('0x2d')][_0x4339('0x3a')]+'%'};return _0x552a88;}})});}_0x3ae2f5=_[_0x4339('0x37')]({},_0x3ae2f5,_0x82db96['options']);var _0x3c7eaf={'where':_0x3ae2f5[_0x4339('0x38')]};return db[_0x4339('0x3b')][_0x4339('0x3c')](_0x3c7eaf)[_0x4339('0x21')](function(_0x28c110){_0x216e82[_0x4339('0x3c')]=_0x28c110;if(_0x82db96[_0x4339('0x2d')][_0x4339('0x3d')]){_0x3ae2f5[_0x4339('0x3e')]=[{'all':!![]}];}return db[_0x4339('0x3b')]['findAll'](_0x3ae2f5);})['then'](function(_0x239177){_0x216e82[_0x4339('0x3f')]=_0x239177;return _0x216e82;})[_0x4339('0x21')](respondWithFilteredResult(_0x588466,_0x3ae2f5))[_0x4339('0x40')](handleError(_0x588466,null));};exports[_0x4339('0x41')]=function(_0x511b7b,_0x3acaae){var _0x542832={'raw':![],'where':{'id':_0x511b7b[_0x4339('0x42')]['id']}},_0xe18590={};_0xe18590[_0x4339('0x2b')]=_['keys'](db[_0x4339('0x3b')][_0x4339('0x43')]);_0xe18590[_0x4339('0x2d')]=_[_0x4339('0x2e')](_0x511b7b['query']);_0xe18590[_0x4339('0x2f')]=_[_0x4339('0x30')](_0xe18590[_0x4339('0x2b')],_0xe18590[_0x4339('0x2d')]);_0x542832[_0x4339('0x31')]=_[_0x4339('0x30')](_0xe18590['model'],qs['fields'](_0x511b7b[_0x4339('0x2d')][_0x4339('0x32')]));_0x542832[_0x4339('0x31')]=_0x542832[_0x4339('0x31')][_0x4339('0x44')]?_0x542832[_0x4339('0x31')]:_0xe18590[_0x4339('0x2b')];if(_0x511b7b[_0x4339('0x2d')]['includeAll']){_0x542832[_0x4339('0x3e')]=[{'all':!![]}];}_0x542832=_[_0x4339('0x37')]({},_0x542832,_0x511b7b['options']);return db[_0x4339('0x3b')][_0x4339('0x45')](_0x542832)[_0x4339('0x21')](handleEntityNotFound(_0x3acaae,null))[_0x4339('0x21')](respondWithResult(_0x3acaae,null))['catch'](handleError(_0x3acaae,null));};exports[_0x4339('0x46')]=function(_0xb22f96,_0x106198){return db[_0x4339('0x3b')][_0x4339('0x46')](_0xb22f96[_0x4339('0x47')],{})[_0x4339('0x21')](respondWithResult(_0x106198,0xc9))[_0x4339('0x40')](handleError(_0x106198,null));};exports[_0x4339('0x20')]=function(_0x23d40b,_0xbc79c){if(_0x23d40b[_0x4339('0x47')]['id']){delete _0x23d40b[_0x4339('0x47')]['id'];}return db[_0x4339('0x3b')]['find']({'where':{'id':_0x23d40b['params']['id']}})[_0x4339('0x21')](handleEntityNotFound(_0xbc79c,null))['then'](saveUpdates(_0x23d40b[_0x4339('0x47')],null))['then'](respondWithResult(_0xbc79c,null))[_0x4339('0x40')](handleError(_0xbc79c,null));};exports[_0x4339('0x22')]=function(_0x336217,_0x5e8fbe){return db[_0x4339('0x3b')][_0x4339('0x45')]({'where':{'id':_0x336217[_0x4339('0x42')]['id']}})[_0x4339('0x21')](handleEntityNotFound(_0x5e8fbe,null))['then'](removeEntity(_0x5e8fbe,null))[_0x4339('0x40')](handleError(_0x5e8fbe,null));}; \ No newline at end of file +var _0x5fbb=['then','destroy','sendStatus','error','name','index','map','Integration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','length','find','catch','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','set','apply','reject','save'];(function(_0x5129b3,_0x34d5a8){var _0x1f7d11=function(_0x8075f9){while(--_0x8075f9){_0x5129b3['push'](_0x5129b3['shift']());}};_0x1f7d11(++_0x34d5a8);}(_0x5fbb,0x6e));var _0xb5fb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5fbb[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0xb5fb('0x0'));var emlformat=require(_0xb5fb('0x1'));var rimraf=require(_0xb5fb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fb('0x3'));var rp=require(_0xb5fb('0x4'));var moment=require(_0xb5fb('0x5'));var BPromise=require(_0xb5fb('0x6'));var Mustache=require(_0xb5fb('0x7'));var util=require(_0xb5fb('0x8'));var path=require(_0xb5fb('0x9'));var sox=require(_0xb5fb('0xa'));var csv=require(_0xb5fb('0xb'));var ejs=require(_0xb5fb('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb5fb('0xd'));var jsforce=require(_0xb5fb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fb('0xb'));var querystring=require(_0xb5fb('0xf'));var Papa=require(_0xb5fb('0x10'));var Redis=require(_0xb5fb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb5fb('0x12'));var as=require(_0xb5fb('0x13'));var hardwareService=require(_0xb5fb('0x14'));var logger=require(_0xb5fb('0x15'))(_0xb5fb('0x16'));var utils=require(_0xb5fb('0x17'));var config=require('../../config/environment');var db=require(_0xb5fb('0x18'))['db'];function respondWithStatusCode(_0x5a9292,_0x3422a3){_0x3422a3=_0x3422a3||0xcc;return function(_0x3b1e35){if(_0x3b1e35){return _0x5a9292['sendStatus'](_0x3422a3);}return _0x5a9292[_0xb5fb('0x19')](_0x3422a3)[_0xb5fb('0x1a')]();};}function respondWithResult(_0x3255a4,_0x3d3872){_0x3d3872=_0x3d3872||0xc8;return function(_0x502b42){if(_0x502b42){return _0x3255a4[_0xb5fb('0x19')](_0x3d3872)[_0xb5fb('0x1b')](_0x502b42);}};}function respondWithFilteredResult(_0xbdd6ec,_0x1c2568){return function(_0x95ce7d){if(_0x95ce7d){var _0x4ae846=_0x95ce7d[_0xb5fb('0x1c')],_0x1ef122=_0x1c2568[_0xb5fb('0x1d')],_0x50a0ec=_0x1c2568[_0xb5fb('0x1d')]+_0x1c2568['limit'],_0x3db4a2;if(_0x50a0ec>=_0x4ae846){_0x50a0ec=_0x4ae846;_0x3db4a2=0xc8;}else{_0x3db4a2=0xce;}_0xbdd6ec[_0xb5fb('0x19')](_0x3db4a2);return _0xbdd6ec[_0xb5fb('0x1e')]('Content-Range',_0x1ef122+'-'+_0x50a0ec+'/'+_0x4ae846)[_0xb5fb('0x1b')](_0x95ce7d);}return null;};}function patchUpdates(_0x1a7e53){return function(_0x18f2ab){try{jsonpatch[_0xb5fb('0x1f')](_0x18f2ab,_0x1a7e53,!![]);}catch(_0x15e8f2){return BPromise[_0xb5fb('0x20')](_0x15e8f2);}return _0x18f2ab[_0xb5fb('0x21')]();};}function saveUpdates(_0x1e0a16,_0x5b703c){return function(_0x451bd9){if(_0x451bd9){return _0x451bd9['update'](_0x1e0a16)[_0xb5fb('0x22')](function(_0xa7c343){return _0xa7c343;});}return null;};}function removeEntity(_0xd60d7,_0x24915c){return function(_0x5ccd50){if(_0x5ccd50){return _0x5ccd50[_0xb5fb('0x23')]()['then'](function(){_0xd60d7[_0xb5fb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3204a2,_0x3a451c){return function(_0x1cdaaa){if(!_0x1cdaaa){_0x3204a2[_0xb5fb('0x24')](0x194);}return _0x1cdaaa;};}function handleError(_0x37f306,_0x3cb37c){_0x3cb37c=_0x3cb37c||0x1f4;return function(_0x2bfb3d){logger[_0xb5fb('0x25')](_0x2bfb3d['stack']);if(_0x2bfb3d[_0xb5fb('0x26')]){delete _0x2bfb3d[_0xb5fb('0x26')];}_0x37f306[_0xb5fb('0x19')](_0x3cb37c)['send'](_0x2bfb3d);};}exports[_0xb5fb('0x27')]=function(_0x459583,_0x2cdbf1){var _0x4114ef={},_0x5490b2={},_0x58175d={'count':0x0,'rows':[]};var _0x2455f4=_[_0xb5fb('0x28')](db[_0xb5fb('0x29')][_0xb5fb('0x2a')],function(_0x2fac95){return{'name':_0x2fac95['fieldName'],'type':_0x2fac95[_0xb5fb('0x2b')][_0xb5fb('0x2c')]};});_0x5490b2[_0xb5fb('0x2d')]=_[_0xb5fb('0x28')](_0x2455f4,_0xb5fb('0x26'));_0x5490b2[_0xb5fb('0x2e')]=_[_0xb5fb('0x2f')](_0x459583[_0xb5fb('0x2e')]);_0x5490b2[_0xb5fb('0x30')]=_[_0xb5fb('0x31')](_0x5490b2[_0xb5fb('0x2d')],_0x5490b2[_0xb5fb('0x2e')]);_0x4114ef[_0xb5fb('0x32')]=_[_0xb5fb('0x31')](_0x5490b2[_0xb5fb('0x2d')],qs[_0xb5fb('0x33')](_0x459583[_0xb5fb('0x2e')][_0xb5fb('0x33')]));_0x4114ef['attributes']=_0x4114ef[_0xb5fb('0x32')]['length']?_0x4114ef[_0xb5fb('0x32')]:_0x5490b2[_0xb5fb('0x2d')];if(!_0x459583[_0xb5fb('0x2e')][_0xb5fb('0x34')](_0xb5fb('0x35'))){_0x4114ef[_0xb5fb('0x36')]=qs[_0xb5fb('0x36')](_0x459583[_0xb5fb('0x2e')][_0xb5fb('0x36')]);_0x4114ef[_0xb5fb('0x1d')]=qs[_0xb5fb('0x1d')](_0x459583[_0xb5fb('0x2e')]['offset']);}_0x4114ef[_0xb5fb('0x37')]=qs['sort'](_0x459583[_0xb5fb('0x2e')]['sort']);_0x4114ef[_0xb5fb('0x38')]=qs[_0xb5fb('0x30')](_[_0xb5fb('0x39')](_0x459583['query'],_0x5490b2[_0xb5fb('0x30')]));if(_0x459583[_0xb5fb('0x2e')][_0xb5fb('0x3a')]){_0x4114ef[_0xb5fb('0x38')]=_[_0xb5fb('0x3b')](_0x4114ef[_0xb5fb('0x38')],{'$or':_['map'](_0x2455f4,function(_0x57fe1a){if(_0x57fe1a[_0xb5fb('0x2b')]!==_0xb5fb('0x3c')){var _0x175ee6={};_0x175ee6[_0x57fe1a[_0xb5fb('0x26')]]={'$like':'%'+_0x459583[_0xb5fb('0x2e')]['filter']+'%'};return _0x175ee6;}})});}_0x4114ef=_[_0xb5fb('0x3b')]({},_0x4114ef,_0x459583[_0xb5fb('0x3d')]);var _0x6c75b0={'where':_0x4114ef[_0xb5fb('0x38')]};return db[_0xb5fb('0x29')][_0xb5fb('0x1c')](_0x6c75b0)[_0xb5fb('0x22')](function(_0x3d2a5e){_0x58175d[_0xb5fb('0x1c')]=_0x3d2a5e;if(_0x459583[_0xb5fb('0x2e')][_0xb5fb('0x3e')]){_0x4114ef[_0xb5fb('0x3f')]=[{'all':!![]}];}return db[_0xb5fb('0x29')]['findAll'](_0x4114ef);})[_0xb5fb('0x22')](function(_0x7572b4){_0x58175d[_0xb5fb('0x40')]=_0x7572b4;return _0x58175d;})[_0xb5fb('0x22')](respondWithFilteredResult(_0x2cdbf1,_0x4114ef))['catch'](handleError(_0x2cdbf1,null));};exports[_0xb5fb('0x41')]=function(_0x1c0014,_0x38704e){var _0x1ffa69={'raw':![],'where':{'id':_0x1c0014[_0xb5fb('0x42')]['id']}},_0x11addd={};_0x11addd[_0xb5fb('0x2d')]=_[_0xb5fb('0x2f')](db[_0xb5fb('0x29')]['rawAttributes']);_0x11addd[_0xb5fb('0x2e')]=_['keys'](_0x1c0014[_0xb5fb('0x2e')]);_0x11addd[_0xb5fb('0x30')]=_[_0xb5fb('0x31')](_0x11addd['model'],_0x11addd[_0xb5fb('0x2e')]);_0x1ffa69[_0xb5fb('0x32')]=_['intersection'](_0x11addd['model'],qs[_0xb5fb('0x33')](_0x1c0014[_0xb5fb('0x2e')][_0xb5fb('0x33')]));_0x1ffa69['attributes']=_0x1ffa69['attributes'][_0xb5fb('0x43')]?_0x1ffa69[_0xb5fb('0x32')]:_0x11addd[_0xb5fb('0x2d')];if(_0x1c0014[_0xb5fb('0x2e')][_0xb5fb('0x3e')]){_0x1ffa69[_0xb5fb('0x3f')]=[{'all':!![]}];}_0x1ffa69=_[_0xb5fb('0x3b')]({},_0x1ffa69,_0x1c0014[_0xb5fb('0x3d')]);return db[_0xb5fb('0x29')][_0xb5fb('0x44')](_0x1ffa69)[_0xb5fb('0x22')](handleEntityNotFound(_0x38704e,null))[_0xb5fb('0x22')](respondWithResult(_0x38704e,null))[_0xb5fb('0x45')](handleError(_0x38704e,null));};exports[_0xb5fb('0x46')]=function(_0x5b89e7,_0x1bef65){return db[_0xb5fb('0x29')]['create'](_0x5b89e7['body'],{})['then'](respondWithResult(_0x1bef65,0xc9))[_0xb5fb('0x45')](handleError(_0x1bef65,null));};exports['update']=function(_0x14d410,_0x5ab1c4){if(_0x14d410[_0xb5fb('0x47')]['id']){delete _0x14d410['body']['id'];}return db[_0xb5fb('0x29')][_0xb5fb('0x44')]({'where':{'id':_0x14d410[_0xb5fb('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ab1c4,null))[_0xb5fb('0x22')](saveUpdates(_0x14d410[_0xb5fb('0x47')],null))[_0xb5fb('0x22')](respondWithResult(_0x5ab1c4,null))[_0xb5fb('0x45')](handleError(_0x5ab1c4,null));};exports['destroy']=function(_0x38b26f,_0x4d59f3){return db[_0xb5fb('0x29')][_0xb5fb('0x44')]({'where':{'id':_0x38b26f[_0xb5fb('0x42')]['id']}})['then'](handleEntityNotFound(_0x4d59f3,null))[_0xb5fb('0x22')](removeEntity(_0x4d59f3,null))['catch'](handleError(_0x4d59f3,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 5c9ad9b..3908f04 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 _0x79f8=['path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','util','api','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x79f8,0x158));var _0x879f=function(_0x4da4cb,_0x4aaa7f){_0x4da4cb=_0x4da4cb-0x0;var _0x2a4de8=_0x79f8[_0x4da4cb];return _0x2a4de8;};'use strict';var _=require('lodash');var util=require(_0x879f('0x0'));var logger=require('../../config/logger')(_0x879f('0x1'));var moment=require(_0x879f('0x2'));var BPromise=require(_0x879f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x879f('0x4'));var rimraf=require(_0x879f('0x5'));var config=require(_0x879f('0x6'));var attributes=require(_0x879f('0x7'));module[_0x879f('0x8')]=function(_0xbff09,_0x45af88){return _0xbff09[_0x879f('0x9')](_0x879f('0xa'),attributes,{'tableName':_0x879f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7457=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','lodash'];(function(_0x3a8845,_0x53dacc){var _0x5f2159=function(_0x403b60){while(--_0x403b60){_0x3a8845['push'](_0x3a8845['shift']());}};_0x5f2159(++_0x53dacc);}(_0x7457,0x1a3));var _0x7745=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x7457[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x7745('0x0'));var util=require(_0x7745('0x1'));var logger=require(_0x7745('0x2'))(_0x7745('0x3'));var moment=require(_0x7745('0x4'));var BPromise=require(_0x7745('0x5'));var rp=require(_0x7745('0x6'));var fs=require('fs');var path=require(_0x7745('0x7'));var rimraf=require(_0x7745('0x8'));var config=require(_0x7745('0x9'));var attributes=require(_0x7745('0xa'));module[_0x7745('0xb')]=function(_0x4e141e,_0x5cc395){return _0x4e141e[_0x7745('0xc')](_0x7745('0xd'),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 2a9f42e..085ae5d 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 _0x808a=['moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','Integration,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x5262f4,_0x162a1d){var _0x40ff6b=function(_0x39d749){while(--_0x39d749){_0x5262f4['push'](_0x5262f4['shift']());}};_0x40ff6b(++_0x162a1d);}(_0x808a,0x1b7));var _0xa808=function(_0x496a49,_0x5430cd){_0x496a49=_0x496a49-0x0;var _0x3f7705=_0x808a[_0x496a49];return _0x3f7705;};'use strict';var _=require(_0xa808('0x0'));var util=require(_0xa808('0x1'));var moment=require(_0xa808('0x2'));var BPromise=require(_0xa808('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(_0xa808('0x4'))(_0xa808('0x5'));var config=require(_0xa808('0x6'));var jayson=require(_0xa808('0x7'));var client=jayson['client'][_0xa808('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c4886,_0x40d543,_0x533152){return new BPromise(function(_0x553162,_0xd83fb7){return client[_0xa808('0x9')](_0x2c4886,_0x533152)['then'](function(_0xcd91e8){logger['info']('Integration,\x20%s,\x20%s',_0x40d543,_0xa808('0xa'));logger[_0xa808('0xb')](_0xa808('0xc'),_0x40d543,_0xa808('0xa'),JSON[_0xa808('0xd')](_0xcd91e8));if(_0xcd91e8[_0xa808('0xe')]){if(_0xcd91e8[_0xa808('0xe')][_0xa808('0xf')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x40d543,_0xcd91e8[_0xa808('0xe')][_0xa808('0x10')]);return _0xd83fb7(_0xcd91e8[_0xa808('0xe')][_0xa808('0x10')]);}logger[_0xa808('0xe')]('Integration,\x20%s,\x20%s',_0x40d543,_0xcd91e8[_0xa808('0xe')][_0xa808('0x10')]);return _0x553162(_0xcd91e8['error'][_0xa808('0x10')]);}else{logger[_0xa808('0x11')](_0xa808('0x12'),_0x40d543,'request\x20sent');_0x553162(_0xcd91e8[_0xa808('0x13')][_0xa808('0x10')]);}})[_0xa808('0x14')](function(_0x139e77){logger[_0xa808('0xe')]('Integration,\x20%s,\x20%s',_0x40d543,_0x139e77);_0xd83fb7(_0x139e77);});});} \ No newline at end of file +var _0x7c1f=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c1913,_0x1d1b59){var _0x3b352a=function(_0x1f97d0){while(--_0x1f97d0){_0x1c1913['push'](_0x1c1913['shift']());}};_0x3b352a(++_0x1d1b59);}(_0x7c1f,0x194));var _0xf7c1=function(_0x4f1e44,_0x38efcd){_0x4f1e44=_0x4f1e44-0x0;var _0x185baa=_0x7c1f[_0x4f1e44];return _0x185baa;};'use strict';var _=require(_0xf7c1('0x0'));var util=require(_0xf7c1('0x1'));var moment=require(_0xf7c1('0x2'));var BPromise=require(_0xf7c1('0x3'));var rs=require(_0xf7c1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7c1('0x5'))['db'];var utils=require(_0xf7c1('0x6'));var logger=require(_0xf7c1('0x7'))('rpc');var config=require(_0xf7c1('0x8'));var jayson=require(_0xf7c1('0x9'));var client=jayson[_0xf7c1('0xa')][_0xf7c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5423bf,_0x1ad808,_0x1a342b){return new BPromise(function(_0x329050,_0x418f9a){return client[_0xf7c1('0xc')](_0x5423bf,_0x1a342b)[_0xf7c1('0xd')](function(_0x4279ea){logger[_0xf7c1('0xe')](_0xf7c1('0xf'),_0x1ad808,_0xf7c1('0x10'));logger[_0xf7c1('0x11')](_0xf7c1('0x12'),_0x1ad808,'request\x20sent',JSON[_0xf7c1('0x13')](_0x4279ea));if(_0x4279ea[_0xf7c1('0x14')]){if(_0x4279ea[_0xf7c1('0x14')][_0xf7c1('0x15')]===0x1f4){logger[_0xf7c1('0x14')](_0xf7c1('0xf'),_0x1ad808,_0x4279ea['error']['message']);return _0x418f9a(_0x4279ea[_0xf7c1('0x14')]['message']);}logger[_0xf7c1('0x14')](_0xf7c1('0xf'),_0x1ad808,_0x4279ea['error'][_0xf7c1('0x16')]);return _0x329050(_0x4279ea['error'][_0xf7c1('0x16')]);}else{logger[_0xf7c1('0xe')](_0xf7c1('0xf'),_0x1ad808,_0xf7c1('0x10'));_0x329050(_0x4279ea[_0xf7c1('0x17')]['message']);}})[_0xf7c1('0x18')](function(_0x5b5786){logger[_0xf7c1('0x14')]('Integration,\x20%s,\x20%s',_0x1ad808,_0x5b5786);_0x418f9a(_0x5b5786);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 45404a6..4223d80 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 _0x2955=['../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','exports','multer','path','express','Router'];(function(_0x270019,_0xb1f014){var _0x5571b2=function(_0x53ab8a){while(--_0x53ab8a){_0x270019['push'](_0x270019['shift']());}};_0x5571b2(++_0xb1f014);}(_0x2955,0x106));var _0x5295=function(_0xeb7e57,_0x195d80){_0xeb7e57=_0xeb7e57-0x0;var _0xcf3c00=_0x2955[_0xeb7e57];return _0xcf3c00;};'use strict';var multer=require(_0x5295('0x0'));var util=require('util');var path=require(_0x5295('0x1'));var timeout=require('connect-timeout');var express=require(_0x5295('0x2'));var router=express[_0x5295('0x3')]();var auth=require(_0x5295('0x4'));var interaction=require(_0x5295('0x5'));var config=require('../../config/environment');var controller=require(_0x5295('0x6'));router[_0x5295('0x7')]('/',auth['isAuthenticated'](),controller[_0x5295('0x8')]);router['get'](_0x5295('0x9'),auth[_0x5295('0xa')](),controller[_0x5295('0xb')]);router[_0x5295('0x7')](_0x5295('0xc'),auth[_0x5295('0xa')](),controller[_0x5295('0xd')]);router[_0x5295('0xe')]('/',auth['isAuthenticated'](),controller[_0x5295('0xf')]);router[_0x5295('0x10')]('/:id',auth[_0x5295('0xa')](),controller[_0x5295('0x11')]);router['delete'](_0x5295('0xc'),auth[_0x5295('0xa')](),controller['destroy']);module[_0x5295('0x12')]=router; \ No newline at end of file +var _0x518c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x41905b,_0x31e9f0){var _0x2b3af1=function(_0x37058a){while(--_0x37058a){_0x41905b['push'](_0x41905b['shift']());}};_0x2b3af1(++_0x31e9f0);}(_0x518c,0x150));var _0xc518=function(_0x5d3e79,_0x5ae88e){_0x5d3e79=_0x5d3e79-0x0;var _0x2f1e18=_0x518c[_0x5d3e79];return _0x2f1e18;};'use strict';var multer=require(_0xc518('0x0'));var util=require(_0xc518('0x1'));var path=require('path');var timeout=require(_0xc518('0x2'));var express=require('express');var router=express[_0xc518('0x3')]();var auth=require(_0xc518('0x4'));var interaction=require(_0xc518('0x5'));var config=require(_0xc518('0x6'));var controller=require(_0xc518('0x7'));router[_0xc518('0x8')]('/',auth[_0xc518('0x9')](),controller['index']);router[_0xc518('0x8')](_0xc518('0xa'),auth[_0xc518('0x9')](),controller[_0xc518('0xb')]);router[_0xc518('0x8')](_0xc518('0xc'),auth[_0xc518('0x9')](),controller[_0xc518('0xd')]);router[_0xc518('0xe')]('/',auth[_0xc518('0x9')](),controller['create']);router[_0xc518('0xf')](_0xc518('0xc'),auth[_0xc518('0x9')](),controller[_0xc518('0x10')]);router[_0xc518('0x11')]('/:id',auth[_0xc518('0x9')](),controller[_0xc518('0x12')]);module[_0xc518('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 8ea377b..7bcfbe1 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 _0x5ee5=['BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x5ee5,0x19f));var _0x55ee=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0x5ee5[_0x19babd];return _0x314eaf;};'use strict';var Sequelize=require(_0x55ee('0x0'));module[_0x55ee('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x55ee('0x2')]},'integrationId':{'type':Sequelize[_0x55ee('0x3')]},'contacts':{'type':Sequelize[_0x55ee('0x2')]},'uniqueid':{'type':Sequelize[_0x55ee('0x2')]},'calleridnum':{'type':Sequelize[_0x55ee('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x55ee('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x55ee('0x4')]},'agentconnectAt':{'type':Sequelize[_0x55ee('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x55ee('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x55ee('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x55ee('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x55ee('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x55ee('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x55ee('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x55ee('0x2')]},'connectedlinenum':{'type':Sequelize[_0x55ee('0x2')]},'connectedlinename':{'type':Sequelize[_0x55ee('0x2')]},'language':{'type':Sequelize[_0x55ee('0x2')]},'accountcode':{'type':Sequelize[_0x55ee('0x2')]},'context':{'type':Sequelize[_0x55ee('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x55ee('0x2')]},'destchannel':{'type':Sequelize[_0x55ee('0x2')]},'destchannelstate':{'type':Sequelize[_0x55ee('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x55ee('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x55ee('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x55ee('0x2')]},'destlanguage':{'type':Sequelize[_0x55ee('0x2')]},'destaccountcode':{'type':Sequelize[_0x55ee('0x2')]},'destcontext':{'type':Sequelize[_0x55ee('0x2')]},'destexten':{'type':Sequelize[_0x55ee('0x2')]},'destpriority':{'type':Sequelize[_0x55ee('0x2')]},'destuniqueid':{'type':Sequelize[_0x55ee('0x2')]},'messageId':{'type':Sequelize[_0x55ee('0x2')]},'inReplyTo':{'type':Sequelize[_0x55ee('0x2')]},'subject':{'type':Sequelize[_0x55ee('0x2')]},'from':{'type':Sequelize[_0x55ee('0x2')]},'to':{'type':Sequelize[_0x55ee('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x55ee('0x6')]},'status':{'type':Sequelize[_0x55ee('0x7')](_0x55ee('0x8'),_0x55ee('0x9'),_0x55ee('0xa'),_0x55ee('0xb'))},'url':{'type':Sequelize[_0x55ee('0x2')]},'app':{'type':Sequelize[_0x55ee('0x2')]},'appdata':{'type':Sequelize[_0x55ee('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0246=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0x0246,0x1e4));var _0x6024=function(_0x1bd19b,_0x50092b){_0x1bd19b=_0x1bd19b-0x0;var _0x15a2c6=_0x0246[_0x1bd19b];return _0x15a2c6;};'use strict';var Sequelize=require(_0x6024('0x0'));module[_0x6024('0x1')]={'integration':{'type':Sequelize[_0x6024('0x2')]},'eventChannel':{'type':Sequelize[_0x6024('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x6024('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6024('0x2')]},'queue':{'type':Sequelize[_0x6024('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6024('0x2')]},'agentcalledAt':{'type':Sequelize[_0x6024('0x3')]},'agentconnectAt':{'type':Sequelize[_0x6024('0x3')]},'holdtime':{'type':Sequelize[_0x6024('0x4')]},'agentcomplete':{'type':Sequelize[_0x6024('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x6024('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6024('0x4')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x6024('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x6024('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x6024('0x3')]},'lastevent':{'type':Sequelize[_0x6024('0x2')]},'channel':{'type':Sequelize[_0x6024('0x2')]},'channelstate':{'type':Sequelize[_0x6024('0x4')]},'channelstatedesc':{'type':Sequelize[_0x6024('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6024('0x2')]},'connectedlinename':{'type':Sequelize[_0x6024('0x2')]},'language':{'type':Sequelize[_0x6024('0x2')]},'accountcode':{'type':Sequelize[_0x6024('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x6024('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x6024('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6024('0x2')]},'destcalleridname':{'type':Sequelize[_0x6024('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x6024('0x2')]},'destlanguage':{'type':Sequelize[_0x6024('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x6024('0x2')]},'destpriority':{'type':Sequelize[_0x6024('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x6024('0x2')]},'subject':{'type':Sequelize[_0x6024('0x2')]},'from':{'type':Sequelize[_0x6024('0x2')]},'to':{'type':Sequelize[_0x6024('0x2')]},'cc':{'type':Sequelize[_0x6024('0x2')]},'attachment':{'type':Sequelize[_0x6024('0x6')]},'html':{'type':Sequelize[_0x6024('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x6024('0x7')]('SENT',_0x6024('0x8'),_0x6024('0x9'),_0x6024('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x6024('0x2')]},'appdata':{'type':Sequelize[_0x6024('0x2')]},'projectId':{'type':Sequelize[_0x6024('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 976c968..c667f6d 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 _0x6901=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','save','update','then','destroy','stack','name','index','IntegrationReport','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','rows','rawAttributes','find','catch','create','body','params','html-pdf','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6901,0x100));var _0x1690=function(_0x3aa61b,_0x2386b9){_0x3aa61b=_0x3aa61b-0x0;var _0x4283da=_0x6901[_0x3aa61b];return _0x4283da;};'use strict';var pdf=require(_0x1690('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1690('0x1'));var zipdir=require(_0x1690('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1690('0x3'));var BPromise=require(_0x1690('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1690('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1690('0x6'));var fs=require('fs');var _=require(_0x1690('0x7'));var squel=require(_0x1690('0x8'));var crypto=require(_0x1690('0x9'));var jsforce=require(_0x1690('0xa'));var deskjs=require(_0x1690('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1690('0xc'));var Papa=require(_0x1690('0xd'));var Redis=require(_0x1690('0xe'));var authService=require(_0x1690('0xf'));var qs=require(_0x1690('0x10'));var as=require(_0x1690('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1690('0x12'))(_0x1690('0x13'));var utils=require('../../config/utils');var config=require(_0x1690('0x14'));var db=require(_0x1690('0x15'))['db'];function respondWithStatusCode(_0x34f797,_0x37114f){_0x37114f=_0x37114f||0xcc;return function(_0x462286){if(_0x462286){return _0x34f797[_0x1690('0x16')](_0x37114f);}return _0x34f797[_0x1690('0x17')](_0x37114f)[_0x1690('0x18')]();};}function respondWithResult(_0x2811fc,_0x26b807){_0x26b807=_0x26b807||0xc8;return function(_0x5ac15d){if(_0x5ac15d){return _0x2811fc[_0x1690('0x17')](_0x26b807)[_0x1690('0x19')](_0x5ac15d);}};}function respondWithFilteredResult(_0x11e9bf,_0x5e0d7f){return function(_0x5ebc4c){if(_0x5ebc4c){var _0x2d5617=_0x5ebc4c['count'],_0x575010=_0x5e0d7f[_0x1690('0x1a')],_0x1e2061=_0x5e0d7f['offset']+_0x5e0d7f[_0x1690('0x1b')],_0x5295b6;if(_0x1e2061>=_0x2d5617){_0x1e2061=_0x2d5617;_0x5295b6=0xc8;}else{_0x5295b6=0xce;}_0x11e9bf[_0x1690('0x17')](_0x5295b6);return _0x11e9bf['set'](_0x1690('0x1c'),_0x575010+'-'+_0x1e2061+'/'+_0x2d5617)[_0x1690('0x19')](_0x5ebc4c);}return null;};}function patchUpdates(_0x284f77){return function(_0x65414){try{jsonpatch['apply'](_0x65414,_0x284f77,!![]);}catch(_0xcd6b2e){return BPromise['reject'](_0xcd6b2e);}return _0x65414[_0x1690('0x1d')]();};}function saveUpdates(_0x2be44b,_0x391581){return function(_0x126586){if(_0x126586){return _0x126586[_0x1690('0x1e')](_0x2be44b)[_0x1690('0x1f')](function(_0x3a6189){return _0x3a6189;});}return null;};}function removeEntity(_0x3d1617,_0x1a050b){return function(_0xa7d053){if(_0xa7d053){return _0xa7d053[_0x1690('0x20')]()[_0x1690('0x1f')](function(){_0x3d1617[_0x1690('0x17')](0xcc)[_0x1690('0x18')]();});}};}function handleEntityNotFound(_0x24be52,_0x4033c1){return function(_0x395d81){if(!_0x395d81){_0x24be52[_0x1690('0x16')](0x194);}return _0x395d81;};}function handleError(_0x592104,_0x1a81a4){_0x1a81a4=_0x1a81a4||0x1f4;return function(_0x272209){logger['error'](_0x272209[_0x1690('0x21')]);if(_0x272209[_0x1690('0x22')]){delete _0x272209[_0x1690('0x22')];}_0x592104[_0x1690('0x17')](_0x1a81a4)['send'](_0x272209);};}exports[_0x1690('0x23')]=function(_0x325867,_0x32dd95){var _0x1d7ae2={},_0x214679={},_0x2d04d1={'count':0x0,'rows':[]};var _0x4fb78c=_['map'](db[_0x1690('0x24')]['rawAttributes'],function(_0x486ec9){return{'name':_0x486ec9['fieldName'],'type':_0x486ec9[_0x1690('0x25')][_0x1690('0x26')]};});_0x214679[_0x1690('0x27')]=_[_0x1690('0x28')](_0x4fb78c,_0x1690('0x22'));_0x214679[_0x1690('0x29')]=_[_0x1690('0x2a')](_0x325867['query']);_0x214679[_0x1690('0x2b')]=_[_0x1690('0x2c')](_0x214679[_0x1690('0x27')],_0x214679[_0x1690('0x29')]);_0x1d7ae2[_0x1690('0x2d')]=_[_0x1690('0x2c')](_0x214679[_0x1690('0x27')],qs['fields'](_0x325867[_0x1690('0x29')][_0x1690('0x2e')]));_0x1d7ae2['attributes']=_0x1d7ae2[_0x1690('0x2d')][_0x1690('0x2f')]?_0x1d7ae2[_0x1690('0x2d')]:_0x214679[_0x1690('0x27')];if(!_0x325867[_0x1690('0x29')][_0x1690('0x30')](_0x1690('0x31'))){_0x1d7ae2[_0x1690('0x1b')]=qs['limit'](_0x325867[_0x1690('0x29')][_0x1690('0x1b')]);_0x1d7ae2[_0x1690('0x1a')]=qs[_0x1690('0x1a')](_0x325867['query']['offset']);}_0x1d7ae2[_0x1690('0x32')]=qs[_0x1690('0x33')](_0x325867[_0x1690('0x29')][_0x1690('0x33')]);_0x1d7ae2[_0x1690('0x34')]=qs[_0x1690('0x2b')](_['pick'](_0x325867[_0x1690('0x29')],_0x214679[_0x1690('0x2b')]));if(_0x325867['query'][_0x1690('0x35')]){_0x1d7ae2['where']=_['merge'](_0x1d7ae2[_0x1690('0x34')],{'$or':_[_0x1690('0x28')](_0x4fb78c,function(_0x486448){if(_0x486448['type']!==_0x1690('0x36')){var _0x3c05c8={};_0x3c05c8[_0x486448[_0x1690('0x22')]]={'$like':'%'+_0x325867[_0x1690('0x29')][_0x1690('0x35')]+'%'};return _0x3c05c8;}})});}_0x1d7ae2=_[_0x1690('0x37')]({},_0x1d7ae2,_0x325867[_0x1690('0x38')]);var _0x1f5ccb={'where':_0x1d7ae2['where']};return db[_0x1690('0x24')]['count'](_0x1f5ccb)[_0x1690('0x1f')](function(_0x30170c){_0x2d04d1[_0x1690('0x39')]=_0x30170c;if(_0x325867['query'][_0x1690('0x3a')]){_0x1d7ae2[_0x1690('0x3b')]=[{'all':!![]}];}return db[_0x1690('0x24')]['findAll'](_0x1d7ae2);})[_0x1690('0x1f')](function(_0xe6e306){_0x2d04d1[_0x1690('0x3c')]=_0xe6e306;return _0x2d04d1;})[_0x1690('0x1f')](respondWithFilteredResult(_0x32dd95,_0x1d7ae2))['catch'](handleError(_0x32dd95,null));};exports['show']=function(_0x171493,_0x34fd2a){var _0x2a39c2={'raw':![],'where':{'id':_0x171493['params']['id']}},_0xd2acd1={};_0xd2acd1[_0x1690('0x27')]=_[_0x1690('0x2a')](db[_0x1690('0x24')][_0x1690('0x3d')]);_0xd2acd1['query']=_['keys'](_0x171493['query']);_0xd2acd1[_0x1690('0x2b')]=_[_0x1690('0x2c')](_0xd2acd1[_0x1690('0x27')],_0xd2acd1['query']);_0x2a39c2[_0x1690('0x2d')]=_[_0x1690('0x2c')](_0xd2acd1['model'],qs[_0x1690('0x2e')](_0x171493[_0x1690('0x29')]['fields']));_0x2a39c2[_0x1690('0x2d')]=_0x2a39c2['attributes'][_0x1690('0x2f')]?_0x2a39c2[_0x1690('0x2d')]:_0xd2acd1[_0x1690('0x27')];if(_0x171493[_0x1690('0x29')][_0x1690('0x3a')]){_0x2a39c2[_0x1690('0x3b')]=[{'all':!![]}];}_0x2a39c2=_[_0x1690('0x37')]({},_0x2a39c2,_0x171493[_0x1690('0x38')]);return db[_0x1690('0x24')][_0x1690('0x3e')](_0x2a39c2)[_0x1690('0x1f')](handleEntityNotFound(_0x34fd2a,null))[_0x1690('0x1f')](respondWithResult(_0x34fd2a,null))[_0x1690('0x3f')](handleError(_0x34fd2a,null));};exports[_0x1690('0x40')]=function(_0x4c30ed,_0x5f464c){return db[_0x1690('0x24')]['create'](_0x4c30ed[_0x1690('0x41')],{})[_0x1690('0x1f')](respondWithResult(_0x5f464c,0xc9))[_0x1690('0x3f')](handleError(_0x5f464c,null));};exports[_0x1690('0x1e')]=function(_0x4d73ef,_0x454ba3){if(_0x4d73ef[_0x1690('0x41')]['id']){delete _0x4d73ef[_0x1690('0x41')]['id'];}return db[_0x1690('0x24')]['find']({'where':{'id':_0x4d73ef[_0x1690('0x42')]['id']}})['then'](handleEntityNotFound(_0x454ba3,null))[_0x1690('0x1f')](saveUpdates(_0x4d73ef['body'],null))['then'](respondWithResult(_0x454ba3,null))[_0x1690('0x3f')](handleError(_0x454ba3,null));};exports['destroy']=function(_0x181382,_0x44b40b){return db[_0x1690('0x24')][_0x1690('0x3e')]({'where':{'id':_0x181382[_0x1690('0x42')]['id']}})[_0x1690('0x1f')](handleEntityNotFound(_0x44b40b,null))[_0x1690('0x1f')](removeEntity(_0x44b40b,null))[_0x1690('0x3f')](handleError(_0x44b40b,null));};exports['describe']=function(_0x530a96,_0x326a97){return db['IntegrationReport']['describe']()[_0x1690('0x1f')](respondWithResult(_0x326a97,null))[_0x1690('0x3f')](handleError(_0x326a97,null));}; \ No newline at end of file +var _0x7fea=['index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send'];(function(_0xd1d65a,_0x1ab321){var _0x26ff1a=function(_0x56d9c1){while(--_0x56d9c1){_0xd1d65a['push'](_0xd1d65a['shift']());}};_0x26ff1a(++_0x1ab321);}(_0x7fea,0x149));var _0xa7fe=function(_0x9294cc,_0x18ce30){_0x9294cc=_0x9294cc-0x0;var _0x187195=_0x7fea[_0x9294cc];return _0x187195;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa7fe('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa7fe('0x1'));var rp=require(_0xa7fe('0x2'));var moment=require(_0xa7fe('0x3'));var BPromise=require(_0xa7fe('0x4'));var Mustache=require(_0xa7fe('0x5'));var util=require(_0xa7fe('0x6'));var path=require('path');var sox=require(_0xa7fe('0x7'));var csv=require(_0xa7fe('0x8'));var ejs=require(_0xa7fe('0x9'));var fs=require('fs');var _=require(_0xa7fe('0xa'));var squel=require(_0xa7fe('0xb'));var crypto=require(_0xa7fe('0xc'));var jsforce=require(_0xa7fe('0xd'));var deskjs=require(_0xa7fe('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa7fe('0xf'));var Redis=require(_0xa7fe('0x10'));var authService=require(_0xa7fe('0x11'));var qs=require(_0xa7fe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7fe('0x13'));var logger=require(_0xa7fe('0x14'))('api');var utils=require(_0xa7fe('0x15'));var config=require('../../config/environment');var db=require(_0xa7fe('0x16'))['db'];function respondWithStatusCode(_0x5956e1,_0x50a806){_0x50a806=_0x50a806||0xcc;return function(_0x3005d3){if(_0x3005d3){return _0x5956e1[_0xa7fe('0x17')](_0x50a806);}return _0x5956e1[_0xa7fe('0x18')](_0x50a806)[_0xa7fe('0x19')]();};}function respondWithResult(_0x47766e,_0x5a4975){_0x5a4975=_0x5a4975||0xc8;return function(_0x49e7cb){if(_0x49e7cb){return _0x47766e[_0xa7fe('0x18')](_0x5a4975)[_0xa7fe('0x1a')](_0x49e7cb);}};}function respondWithFilteredResult(_0x400886,_0x43ae73){return function(_0x34490e){if(_0x34490e){var _0x5df0e3=_0x34490e[_0xa7fe('0x1b')],_0x137dc9=_0x43ae73[_0xa7fe('0x1c')],_0x292ad1=_0x43ae73['offset']+_0x43ae73[_0xa7fe('0x1d')],_0x132586;if(_0x292ad1>=_0x5df0e3){_0x292ad1=_0x5df0e3;_0x132586=0xc8;}else{_0x132586=0xce;}_0x400886[_0xa7fe('0x18')](_0x132586);return _0x400886[_0xa7fe('0x1e')](_0xa7fe('0x1f'),_0x137dc9+'-'+_0x292ad1+'/'+_0x5df0e3)[_0xa7fe('0x1a')](_0x34490e);}return null;};}function patchUpdates(_0x18261c){return function(_0x4f1951){try{jsonpatch['apply'](_0x4f1951,_0x18261c,!![]);}catch(_0x5409fe){return BPromise[_0xa7fe('0x20')](_0x5409fe);}return _0x4f1951[_0xa7fe('0x21')]();};}function saveUpdates(_0x473612,_0x529990){return function(_0x1d33d2){if(_0x1d33d2){return _0x1d33d2[_0xa7fe('0x22')](_0x473612)[_0xa7fe('0x23')](function(_0x5381c8){return _0x5381c8;});}return null;};}function removeEntity(_0x29649c,_0x19b408){return function(_0x1619c1){if(_0x1619c1){return _0x1619c1[_0xa7fe('0x24')]()[_0xa7fe('0x23')](function(){_0x29649c[_0xa7fe('0x18')](0xcc)[_0xa7fe('0x19')]();});}};}function handleEntityNotFound(_0x1043bf,_0x4ac7e0){return function(_0x3415b8){if(!_0x3415b8){_0x1043bf['sendStatus'](0x194);}return _0x3415b8;};}function handleError(_0x4ce2e7,_0x37c8fa){_0x37c8fa=_0x37c8fa||0x1f4;return function(_0xf06c82){logger[_0xa7fe('0x25')](_0xf06c82[_0xa7fe('0x26')]);if(_0xf06c82[_0xa7fe('0x27')]){delete _0xf06c82['name'];}_0x4ce2e7[_0xa7fe('0x18')](_0x37c8fa)[_0xa7fe('0x28')](_0xf06c82);};}exports[_0xa7fe('0x29')]=function(_0x3e9b74,_0x26e5a4){var _0x146a74={},_0x11aff3={},_0x4038c6={'count':0x0,'rows':[]};var _0x9d5272=_[_0xa7fe('0x2a')](db[_0xa7fe('0x2b')][_0xa7fe('0x2c')],function(_0x1ada44){return{'name':_0x1ada44[_0xa7fe('0x2d')],'type':_0x1ada44[_0xa7fe('0x2e')][_0xa7fe('0x2f')]};});_0x11aff3[_0xa7fe('0x30')]=_[_0xa7fe('0x2a')](_0x9d5272,_0xa7fe('0x27'));_0x11aff3[_0xa7fe('0x31')]=_['keys'](_0x3e9b74[_0xa7fe('0x31')]);_0x11aff3[_0xa7fe('0x32')]=_['intersection'](_0x11aff3['model'],_0x11aff3['query']);_0x146a74[_0xa7fe('0x33')]=_[_0xa7fe('0x34')](_0x11aff3['model'],qs[_0xa7fe('0x35')](_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x35')]));_0x146a74[_0xa7fe('0x33')]=_0x146a74[_0xa7fe('0x33')][_0xa7fe('0x36')]?_0x146a74[_0xa7fe('0x33')]:_0x11aff3[_0xa7fe('0x30')];if(!_0x3e9b74[_0xa7fe('0x31')]['hasOwnProperty'](_0xa7fe('0x37'))){_0x146a74['limit']=qs[_0xa7fe('0x1d')](_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x1d')]);_0x146a74['offset']=qs[_0xa7fe('0x1c')](_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x1c')]);}_0x146a74[_0xa7fe('0x38')]=qs['sort'](_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x39')]);_0x146a74['where']=qs[_0xa7fe('0x32')](_[_0xa7fe('0x3a')](_0x3e9b74[_0xa7fe('0x31')],_0x11aff3[_0xa7fe('0x32')]));if(_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x3b')]){_0x146a74[_0xa7fe('0x3c')]=_[_0xa7fe('0x3d')](_0x146a74[_0xa7fe('0x3c')],{'$or':_[_0xa7fe('0x2a')](_0x9d5272,function(_0x42d5d6){if(_0x42d5d6[_0xa7fe('0x2e')]!==_0xa7fe('0x3e')){var _0xdb8885={};_0xdb8885[_0x42d5d6[_0xa7fe('0x27')]]={'$like':'%'+_0x3e9b74[_0xa7fe('0x31')]['filter']+'%'};return _0xdb8885;}})});}_0x146a74=_['merge']({},_0x146a74,_0x3e9b74[_0xa7fe('0x3f')]);var _0x4e5116={'where':_0x146a74['where']};return db[_0xa7fe('0x2b')][_0xa7fe('0x1b')](_0x4e5116)['then'](function(_0x25a5b2){_0x4038c6[_0xa7fe('0x1b')]=_0x25a5b2;if(_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x40')]){_0x146a74[_0xa7fe('0x41')]=[{'all':!![]}];}return db[_0xa7fe('0x2b')][_0xa7fe('0x42')](_0x146a74);})['then'](function(_0x279e79){_0x4038c6[_0xa7fe('0x43')]=_0x279e79;return _0x4038c6;})[_0xa7fe('0x23')](respondWithFilteredResult(_0x26e5a4,_0x146a74))[_0xa7fe('0x44')](handleError(_0x26e5a4,null));};exports['show']=function(_0x207e1d,_0x2ae075){var _0x66671={'raw':![],'where':{'id':_0x207e1d[_0xa7fe('0x45')]['id']}},_0x309404={};_0x309404[_0xa7fe('0x30')]=_[_0xa7fe('0x46')](db[_0xa7fe('0x2b')][_0xa7fe('0x2c')]);_0x309404[_0xa7fe('0x31')]=_[_0xa7fe('0x46')](_0x207e1d[_0xa7fe('0x31')]);_0x309404[_0xa7fe('0x32')]=_[_0xa7fe('0x34')](_0x309404['model'],_0x309404['query']);_0x66671['attributes']=_['intersection'](_0x309404[_0xa7fe('0x30')],qs[_0xa7fe('0x35')](_0x207e1d[_0xa7fe('0x31')][_0xa7fe('0x35')]));_0x66671[_0xa7fe('0x33')]=_0x66671[_0xa7fe('0x33')][_0xa7fe('0x36')]?_0x66671[_0xa7fe('0x33')]:_0x309404['model'];if(_0x207e1d[_0xa7fe('0x31')][_0xa7fe('0x40')]){_0x66671[_0xa7fe('0x41')]=[{'all':!![]}];}_0x66671=_['merge']({},_0x66671,_0x207e1d[_0xa7fe('0x3f')]);return db[_0xa7fe('0x2b')]['find'](_0x66671)[_0xa7fe('0x23')](handleEntityNotFound(_0x2ae075,null))[_0xa7fe('0x23')](respondWithResult(_0x2ae075,null))[_0xa7fe('0x44')](handleError(_0x2ae075,null));};exports[_0xa7fe('0x47')]=function(_0x5f272a,_0x4508e5){return db[_0xa7fe('0x2b')]['create'](_0x5f272a[_0xa7fe('0x48')],{})['then'](respondWithResult(_0x4508e5,0xc9))[_0xa7fe('0x44')](handleError(_0x4508e5,null));};exports[_0xa7fe('0x22')]=function(_0x45e237,_0x5f2a0e){if(_0x45e237[_0xa7fe('0x48')]['id']){delete _0x45e237[_0xa7fe('0x48')]['id'];}return db['IntegrationReport'][_0xa7fe('0x49')]({'where':{'id':_0x45e237['params']['id']}})[_0xa7fe('0x23')](handleEntityNotFound(_0x5f2a0e,null))['then'](saveUpdates(_0x45e237[_0xa7fe('0x48')],null))[_0xa7fe('0x23')](respondWithResult(_0x5f2a0e,null))[_0xa7fe('0x44')](handleError(_0x5f2a0e,null));};exports[_0xa7fe('0x24')]=function(_0x41124a,_0x5ecc9a){return db['IntegrationReport'][_0xa7fe('0x49')]({'where':{'id':_0x41124a[_0xa7fe('0x45')]['id']}})[_0xa7fe('0x23')](handleEntityNotFound(_0x5ecc9a,null))[_0xa7fe('0x23')](removeEntity(_0x5ecc9a,null))[_0xa7fe('0x44')](handleError(_0x5ecc9a,null));};exports['describe']=function(_0x4e2918,_0xa46f64){return db[_0xa7fe('0x2b')]['describe']()[_0xa7fe('0x23')](respondWithResult(_0xa46f64,null))['catch'](handleError(_0xa46f64,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 3d20c54..e0d0b29 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 _0x9115=['path','rimraf','../../config/environment','exports','IntegrationReport','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xb68772,_0x5253ac){var _0x4189bb=function(_0x1b0cf3){while(--_0x1b0cf3){_0xb68772['push'](_0xb68772['shift']());}};_0x4189bb(++_0x5253ac);}(_0x9115,0x68));var _0x5911=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0x9115[_0x174a72];return _0x32cecd;};'use strict';var _=require(_0x5911('0x0'));var util=require('util');var logger=require(_0x5911('0x1'))(_0x5911('0x2'));var moment=require(_0x5911('0x3'));var BPromise=require(_0x5911('0x4'));var rp=require(_0x5911('0x5'));var fs=require('fs');var path=require(_0x5911('0x6'));var rimraf=require(_0x5911('0x7'));var config=require(_0x5911('0x8'));var attributes=require('./integrationReport.attributes');module[_0x5911('0x9')]=function(_0x3189a7,_0x57627c){return _0x3189a7['define'](_0x5911('0xa'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60f8=['../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5eca70,_0x3aca34){var _0x27aaad=function(_0x585f57){while(--_0x585f57){_0x5eca70['push'](_0x5eca70['shift']());}};_0x27aaad(++_0x3aca34);}(_0x60f8,0x12b));var _0x860f=function(_0x4529f4,_0xbb66ee){_0x4529f4=_0x4529f4-0x0;var _0x3c9799=_0x60f8[_0x4529f4];return _0x3c9799;};'use strict';var _=require(_0x860f('0x0'));var util=require(_0x860f('0x1'));var logger=require(_0x860f('0x2'))(_0x860f('0x3'));var moment=require(_0x860f('0x4'));var BPromise=require(_0x860f('0x5'));var rp=require(_0x860f('0x6'));var fs=require('fs');var path=require(_0x860f('0x7'));var rimraf=require(_0x860f('0x8'));var config=require(_0x860f('0x9'));var attributes=require(_0x860f('0xa'));module['exports']=function(_0x2b5301,_0x2eaf10){return _0x2b5301[_0x860f('0xb')](_0x860f('0xc'),attributes,{'tableName':_0x860f('0xd'),'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 fd632b4..be09e89 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2f7a90,_0x4daac5){var _0x39571a=function(_0x2e6138){while(--_0x2e6138){_0x2f7a90['push'](_0x2f7a90['shift']());}};_0x39571a(++_0x4daac5);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0x5eb8[_0x3a8dc1];return _0x4b3595;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1f80b9,_0x7c3577){var _0x38015b=function(_0x2ff34c){while(--_0x2ff34c){_0x1f80b9['push'](_0x1f80b9['shift']());}};_0x38015b(++_0x7c3577);}(_0xb10b,0x12a));var _0xbb10=function(_0x5efb4a,_0x39b1ec){_0x5efb4a=_0x5efb4a-0x0;var _0x5f31a2=_0xb10b[_0x5efb4a];return _0x5f31a2;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index be13f92..8829f50 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(_0x41d1d5,_0x1d53ef){var _0x3300ac=function(_0x2e2c5b){while(--_0x2e2c5b){_0x41d1d5['push'](_0x41d1d5['shift']());}};_0x3300ac(++_0x1d53ef);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'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 _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(_0x4af632,_0x49753d){var _0x19a8fd=function(_0x16e857){while(--_0x16e857){_0x4af632['push'](_0x4af632['shift']());}};_0x19a8fd(++_0x49753d);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'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 diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index c9c82bb..1fbb17f 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 _0xb0b2=['sequelize','exports','STRING'];(function(_0x4bb52c,_0x169f77){var _0x20b2db=function(_0x362ca4){while(--_0x362ca4){_0x4bb52c['push'](_0x4bb52c['shift']());}};_0x20b2db(++_0x169f77);}(_0xb0b2,0x144));var _0x2b0b=function(_0x1151bc,_0x515c44){_0x1151bc=_0x1151bc-0x0;var _0x5676d6=_0xb0b2[_0x1151bc];return _0x5676d6;};'use strict';var Sequelize=require(_0x2b0b('0x0'));module[_0x2b0b('0x1')]={'name':{'type':Sequelize[_0x2b0b('0x2')]},'description':{'type':Sequelize[_0x2b0b('0x2')]},'interval':{'type':Sequelize[_0x2b0b('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x2e38=['STRING','sequelize','exports'];(function(_0x445b7e,_0x3ea85f){var _0x17d997=function(_0x805f31){while(--_0x805f31){_0x445b7e['push'](_0x445b7e['shift']());}};_0x17d997(++_0x3ea85f);}(_0x2e38,0x82));var _0x82e3=function(_0x39be64,_0x538b0d){_0x39be64=_0x39be64-0x0;var _0x56bc68=_0x2e38[_0x39be64];return _0x56bc68;};'use strict';var Sequelize=require(_0x82e3('0x0'));module[_0x82e3('0x1')]={'name':{'type':Sequelize[_0x82e3('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x82e3('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 71e9ad3..1388f1c 100644 --- a/server/api/interval/interval.controller.js +++ b/server/api/interval/interval.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['sequelize','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','limit','set','save','update','then','get','Intervals','destroy','end','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','userProfileId','UserProfileResource','error','getIntervals','addIntervals'];(function(_0x5ec4e1,_0x5913a5){var _0x36711d=function(_0x43393e){while(--_0x43393e){_0x5ec4e1['push'](_0x5ec4e1['shift']());}};_0x36711d(++_0x5913a5);}(_0xedd9,0xfc));var _0x9edd=function(_0x1b68a4,_0x36aaf0){_0x1b68a4=_0x1b68a4-0x0;var _0x2162da=_0xedd9[_0x1b68a4];return _0x2162da;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];var extensions=require(_0x9edd('0x17'));function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=_0x75a4ab['count'],_0x5f5bf4=_0x1042aa[_0x9edd('0x1b')],_0x448996=_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1c')],_0x449cee;if(_0x448996>=_0x4ea60f){_0x448996=_0x4ea60f;_0x449cee=0xc8;}else{_0x449cee=0xce;}_0x338f3c['status'](_0x449cee);return _0x338f3c[_0x9edd('0x1d')]('Content-Range',_0x5f5bf4+'-'+_0x448996+'/'+_0x4ea60f)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x1083e4){return function(_0x4bdb88){try{jsonpatch['apply'](_0x4bdb88,_0x1083e4,!![]);}catch(_0x45c3ab){return BPromise['reject'](_0x45c3ab);}return _0x4bdb88[_0x9edd('0x1e')]();};}function saveUpdates(_0x54a03f,_0x535f37){return function(_0x356751){if(_0x356751){return _0x356751[_0x9edd('0x1f')](_0x54a03f)['then'](function(_0x5823bc){return _0x5823bc;});}return null;};}function removeEntity(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['destroy']()[_0x9edd('0x20')](function(){var _0x1dca43=_0x477878[_0x9edd('0x21')]({'plain':!![]});var _0x2ca65f=_0x9edd('0x22');return db['UserProfileResource'][_0x9edd('0x23')]({'where':{'type':_0x2ca65f,'resourceId':_0x1dca43['id']}})[_0x9edd('0x20')](function(){return _0x477878;});})[_0x9edd('0x20')](function(){_0x341d67[_0x9edd('0x19')](0xcc)[_0x9edd('0x24')]();});}};}function handleEntityNotFound(_0x4d507f,_0x4b3d1b){return function(_0x3276ee){if(!_0x3276ee){_0x4d507f[_0x9edd('0x18')](0x194);}return _0x3276ee;};}function handleError(_0x8d67aa,_0x25e135){_0x25e135=_0x25e135||0x1f4;return function(_0x3c2227){logger['error'](_0x3c2227['stack']);if(_0x3c2227[_0x9edd('0x25')]){delete _0x3c2227[_0x9edd('0x25')];}_0x8d67aa[_0x9edd('0x19')](_0x25e135)['send'](_0x3c2227);};}exports[_0x9edd('0x26')]=function(_0x28cfae,_0x2ae8dd){var _0x41af53={},_0x5eccfb={},_0x2155a1={'count':0x0,'rows':[]};var _0x3fb556=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x42e664){return{'name':_0x42e664[_0x9edd('0x2a')],'type':_0x42e664[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x5eccfb[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x3fb556,_0x9edd('0x25'));_0x5eccfb[_0x9edd('0x2e')]=_[_0x9edd('0x2f')](_0x28cfae[_0x9edd('0x2e')]);_0x5eccfb['filters']=_[_0x9edd('0x30')](_0x5eccfb[_0x9edd('0x2d')],_0x5eccfb[_0x9edd('0x2e')]);_0x41af53['attributes']=_[_0x9edd('0x30')](_0x5eccfb[_0x9edd('0x2d')],qs[_0x9edd('0x31')](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x31')]));_0x41af53[_0x9edd('0x32')]=_0x41af53[_0x9edd('0x32')][_0x9edd('0x33')]?_0x41af53[_0x9edd('0x32')]:_0x5eccfb[_0x9edd('0x2d')];if(!_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x34')](_0x9edd('0x35'))){_0x41af53[_0x9edd('0x1c')]=qs['limit'](_0x28cfae[_0x9edd('0x2e')]['limit']);_0x41af53[_0x9edd('0x1b')]=qs[_0x9edd('0x1b')](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x1b')]);}_0x41af53[_0x9edd('0x36')]=qs['sort'](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x37')]);_0x41af53[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_[_0x9edd('0x3a')](_0x28cfae[_0x9edd('0x2e')],_0x5eccfb[_0x9edd('0x39')]));if(_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x3b')]){_0x41af53[_0x9edd('0x38')]=_['merge'](_0x41af53[_0x9edd('0x38')],{'$or':_['map'](_0x3fb556,function(_0x3ef1d5){if(_0x3ef1d5['type']!==_0x9edd('0x3c')){var _0x2858b5={};_0x2858b5[_0x3ef1d5[_0x9edd('0x25')]]={'$like':'%'+_0x28cfae['query'][_0x9edd('0x3b')]+'%'};return _0x2858b5;}})});}_0x41af53=_[_0x9edd('0x3d')]({},_0x41af53,_0x28cfae[_0x9edd('0x3e')]);var _0x48958a={'where':_0x41af53[_0x9edd('0x38')]};return db['Interval'][_0x9edd('0x3f')](_0x48958a)[_0x9edd('0x20')](function(_0x50be2c){_0x2155a1[_0x9edd('0x3f')]=_0x50be2c;if(_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x40')]){_0x41af53[_0x9edd('0x41')]=[{'all':!![]}];}return db['Interval'][_0x9edd('0x42')](_0x41af53);})['then'](function(_0x2bdb3f){_0x2155a1[_0x9edd('0x43')]=_0x2bdb3f;return _0x2155a1;})['then'](respondWithFilteredResult(_0x2ae8dd,_0x41af53))[_0x9edd('0x44')](handleError(_0x2ae8dd,null));};exports['show']=function(_0x548299,_0x369b69){var _0x9cab86={'raw':!![],'where':{'id':_0x548299[_0x9edd('0x45')]['id']}},_0x1f276b={};_0x1f276b[_0x9edd('0x2d')]=_[_0x9edd('0x2f')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x1f276b[_0x9edd('0x2e')]=_[_0x9edd('0x2f')](_0x548299[_0x9edd('0x2e')]);_0x1f276b[_0x9edd('0x39')]=_[_0x9edd('0x30')](_0x1f276b[_0x9edd('0x2d')],_0x1f276b[_0x9edd('0x2e')]);_0x9cab86['attributes']=_[_0x9edd('0x30')](_0x1f276b[_0x9edd('0x2d')],qs[_0x9edd('0x31')](_0x548299[_0x9edd('0x2e')][_0x9edd('0x31')]));_0x9cab86[_0x9edd('0x32')]=_0x9cab86[_0x9edd('0x32')]['length']?_0x9cab86['attributes']:_0x1f276b['model'];if(_0x548299[_0x9edd('0x2e')]['includeAll']){_0x9cab86[_0x9edd('0x41')]=[{'all':!![]}];}_0x9cab86=_[_0x9edd('0x3d')]({},_0x9cab86,_0x548299[_0x9edd('0x3e')]);return db[_0x9edd('0x28')][_0x9edd('0x46')](_0x9cab86)['then'](handleEntityNotFound(_0x369b69,null))[_0x9edd('0x20')](respondWithResult(_0x369b69,null))[_0x9edd('0x44')](handleError(_0x369b69,null));};exports[_0x9edd('0x47')]=function(_0x4a89ae,_0x3626bc){return db[_0x9edd('0x28')][_0x9edd('0x47')](_0x4a89ae[_0x9edd('0x48')],{})[_0x9edd('0x20')](function(_0x35bdec){var _0x4d4f33=_0x4a89ae[_0x9edd('0x49')][_0x9edd('0x21')]({'plain':!![]});if(!_0x4d4f33)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d4f33[_0x9edd('0x4a')]===_0x9edd('0x49')){var _0x4bb324=_0x35bdec[_0x9edd('0x21')]({'plain':!![]});var _0x8134cd=_0x9edd('0x22');return db['UserProfileSection'][_0x9edd('0x46')]({'where':{'name':_0x8134cd,'userProfileId':_0x4d4f33[_0x9edd('0x4b')]},'raw':!![]})[_0x9edd('0x20')](function(_0x28c7bd){if(_0x28c7bd&&_0x28c7bd['autoAssociation']===0x0){return db[_0x9edd('0x4c')][_0x9edd('0x47')]({'name':_0x4bb324[_0x9edd('0x25')],'resourceId':_0x4bb324['id'],'type':_0x28c7bd['name'],'sectionId':_0x28c7bd['id']},{})[_0x9edd('0x20')](function(){return _0x35bdec;});}else{return _0x35bdec;}})[_0x9edd('0x44')](function(_0x57db43){logger[_0x9edd('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57db43);throw _0x57db43;});}return _0x35bdec;})[_0x9edd('0x20')](respondWithResult(_0x3626bc,0xc9))[_0x9edd('0x44')](handleError(_0x3626bc,null));};exports[_0x9edd('0x1f')]=function(_0x3fcdf5,_0x1e3c19){if(_0x3fcdf5[_0x9edd('0x48')]['id']){delete _0x3fcdf5[_0x9edd('0x48')]['id'];}return db[_0x9edd('0x28')][_0x9edd('0x46')]({'where':{'id':_0x3fcdf5[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x1e3c19,null))['then'](saveUpdates(_0x3fcdf5[_0x9edd('0x48')],null))[_0x9edd('0x20')](respondWithResult(_0x1e3c19,null))[_0x9edd('0x44')](handleError(_0x1e3c19,null));};exports['destroy']=function(_0xe96d6a,_0x54a704){return db['Interval']['find']({'where':{'id':_0xe96d6a[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x54a704,null))[_0x9edd('0x20')](removeEntity(_0x54a704,null))[_0x9edd('0x44')](handleError(_0x54a704,null));};exports['addInterval']=function(_0x56b38b,_0x4e3c3e,_0x71820f){if(_0x56b38b[_0x9edd('0x48')]['id']){delete _0x56b38b[_0x9edd('0x48')]['id'];}return db[_0x9edd('0x28')][_0x9edd('0x46')]({'where':{'id':_0x56b38b[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x4e3c3e,null))[_0x9edd('0x20')](function(_0x4eb780){if(_0x4eb780){_0x56b38b[_0x9edd('0x48')]['IntervalId']=_0x4eb780['id'];return db[_0x9edd('0x28')][_0x9edd('0x47')](_0x56b38b['body']);}})[_0x9edd('0x20')](respondWithResult(_0x4e3c3e,null))[_0x9edd('0x44')](handleError(_0x4e3c3e,null));};exports[_0x9edd('0x4e')]=function(_0x5ec9af,_0xc648c4,_0x2e1ce3){var _0x430eb4={};var _0x15ebfa={};var _0x1720b1;var _0x2c3173;return db['Interval']['findOne']({'where':{'id':_0x5ec9af[_0x9edd('0x45')]['id']}})['then'](handleEntityNotFound(_0xc648c4,null))[_0x9edd('0x20')](function(_0x3e9a3e){if(_0x3e9a3e){_0x1720b1=_0x3e9a3e;_0x15ebfa[_0x9edd('0x2d')]=_[_0x9edd('0x2f')](db['Interval'][_0x9edd('0x29')]);_0x15ebfa['query']=_[_0x9edd('0x2f')](_0x5ec9af[_0x9edd('0x2e')]);_0x15ebfa[_0x9edd('0x39')]=_['intersection'](_0x15ebfa[_0x9edd('0x2d')],_0x15ebfa['query']);_0x430eb4[_0x9edd('0x32')]=_[_0x9edd('0x30')](_0x15ebfa['model'],qs[_0x9edd('0x31')](_0x5ec9af['query'][_0x9edd('0x31')]));_0x430eb4[_0x9edd('0x32')]=_0x430eb4[_0x9edd('0x32')]['length']?_0x430eb4[_0x9edd('0x32')]:_0x15ebfa[_0x9edd('0x2d')];_0x430eb4[_0x9edd('0x36')]=qs[_0x9edd('0x37')](_0x5ec9af[_0x9edd('0x2e')]['sort']);_0x430eb4['where']=qs[_0x9edd('0x39')](_[_0x9edd('0x3a')](_0x5ec9af['query'],_0x15ebfa['filters']));if(_0x5ec9af['query'][_0x9edd('0x3b')]){_0x430eb4['where']=_['merge'](_0x430eb4[_0x9edd('0x38')],{'$or':_[_0x9edd('0x27')](_0x430eb4['attributes'],function(_0xb9ebeb){var _0x11e082={};_0x11e082[_0xb9ebeb]={'$like':'%'+_0x5ec9af[_0x9edd('0x2e')]['filter']+'%'};return _0x11e082;})});}_0x430eb4=_[_0x9edd('0x3d')]({},_0x430eb4,_0x5ec9af['options']);return _0x1720b1[_0x9edd('0x4e')](_0x430eb4);}})[_0x9edd('0x20')](function(_0x4c8d06){if(_0x4c8d06){_0x2c3173=_0x4c8d06[_0x9edd('0x33')];if(!_0x5ec9af[_0x9edd('0x2e')]['hasOwnProperty'](_0x9edd('0x35'))){_0x430eb4[_0x9edd('0x1c')]=qs[_0x9edd('0x1c')](_0x5ec9af[_0x9edd('0x2e')]['limit']);_0x430eb4[_0x9edd('0x1b')]=qs['offset'](_0x5ec9af[_0x9edd('0x2e')][_0x9edd('0x1b')]);}return _0x1720b1[_0x9edd('0x4e')](_0x430eb4);}})['then'](function(_0x106a67){if(_0x106a67){return _0x106a67?{'count':_0x2c3173,'rows':_0x106a67}:null;}})[_0x9edd('0x20')](respondWithResult(_0xc648c4,null))[_0x9edd('0x44')](handleError(_0xc648c4,null));};exports[_0x9edd('0x4f')]=function(_0x25626a,_0x14e2e5,_0x3fa4a9){return db['Interval']['findOne']({'where':{'id':_0x25626a[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x14e2e5,null))[_0x9edd('0x20')](function(_0x171403){if(_0x171403){return db[_0x9edd('0x50')]['transaction'](function(_0x2e40c8){return db[_0x9edd('0x28')][_0x9edd('0x23')]({'where':{'IntervalId':_0x25626a['params']['id']},'transaction':_0x2e40c8})[_0x9edd('0x20')](function(_0x29d70d){var _0x4b1c12=_[_0x9edd('0x27')](_0x25626a[_0x9edd('0x48')],function(_0x58c839){delete _0x58c839['id'];_0x58c839[_0x9edd('0x51')]=_0x25626a[_0x9edd('0x45')]['id'];return _0x58c839;});return db['Interval'][_0x9edd('0x52')](_0x4b1c12,{'transaction':_0x2e40c8});});})['then'](function(){return db['Interval'][_0x9edd('0x42')]({'where':{'IntervalId':_0x25626a[_0x9edd('0x45')]['id']}});});}})[_0x9edd('0x20')](respondWithResult(_0x14e2e5,null))['catch'](handleError(_0x14e2e5,null));}; \ No newline at end of file +var _0x008c=['query','keys','filters','intersection','attributes','fields','length','nolimit','limit','offset','order','sort','pick','where','VIRTUAL','filter','merge','options','Interval','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addInterval','getIntervals','findOne','hasOwnProperty','sequelize','IntervalId','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','end','status','json','count','set','Content-Range','save','destroy','then','get','UserProfileResource','sendStatus','name','send','map','fieldName','type','key','model'];(function(_0x56ea6f,_0x15535a){var _0x43ac31=function(_0x1b6d99){while(--_0x1b6d99){_0x56ea6f['push'](_0x56ea6f['shift']());}};_0x43ac31(++_0x15535a);}(_0x008c,0x188));var _0xc008=function(_0x2526e3,_0x5f22f8){_0x2526e3=_0x2526e3-0x0;var _0xcf6f48=_0x008c[_0x2526e3];return _0xcf6f48;};'use strict';var pdf=require(_0xc008('0x0'));var emlformat=require(_0xc008('0x1'));var rimraf=require(_0xc008('0x2'));var zipdir=require(_0xc008('0x3'));var jsonpatch=require(_0xc008('0x4'));var rp=require('request-promise');var moment=require(_0xc008('0x5'));var BPromise=require(_0xc008('0x6'));var Mustache=require(_0xc008('0x7'));var util=require(_0xc008('0x8'));var path=require(_0xc008('0x9'));var sox=require(_0xc008('0xa'));var csv=require(_0xc008('0xb'));var ejs=require(_0xc008('0xc'));var fs=require('fs');var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var db=require(_0xc008('0x16'))['db'];var extensions=require(_0xc008('0x17'));function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=_0x5e894e[_0xc008('0x1b')],_0x11ef38=_0x5ee00b['offset'],_0x15a6ad=_0x5ee00b['offset']+_0x5ee00b['limit'],_0x3cafe3;if(_0x15a6ad>=_0x4bd0f4){_0x15a6ad=_0x4bd0f4;_0x3cafe3=0xc8;}else{_0x3cafe3=0xce;}_0x3f0ecf['status'](_0x3cafe3);return _0x3f0ecf[_0xc008('0x1c')](_0xc008('0x1d'),_0x11ef38+'-'+_0x15a6ad+'/'+_0x4bd0f4)['json'](_0x5e894e);}return null;};}function patchUpdates(_0x813397){return function(_0x5906e6){try{jsonpatch['apply'](_0x5906e6,_0x813397,!![]);}catch(_0x543e5d){return BPromise['reject'](_0x543e5d);}return _0x5906e6[_0xc008('0x1e')]();};}function saveUpdates(_0x4b9726,_0x5560b1){return function(_0x590a71){if(_0x590a71){return _0x590a71['update'](_0x4b9726)['then'](function(_0x13a263){return _0x13a263;});}return null;};}function removeEntity(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x1f')]()[_0xc008('0x20')](function(){var _0x4f43e2=_0x415af3[_0xc008('0x21')]({'plain':!![]});var _0x5c85f2='Intervals';return db[_0xc008('0x22')][_0xc008('0x1f')]({'where':{'type':_0x5c85f2,'resourceId':_0x4f43e2['id']}})[_0xc008('0x20')](function(){return _0x415af3;});})[_0xc008('0x20')](function(){_0x4777a6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5de1e9,_0x3f7b07){return function(_0x15dade){if(!_0x15dade){_0x5de1e9[_0xc008('0x23')](0x194);}return _0x15dade;};}function handleError(_0x2e31c2,_0x5bebd9){_0x5bebd9=_0x5bebd9||0x1f4;return function(_0x5e2aca){logger['error'](_0x5e2aca['stack']);if(_0x5e2aca['name']){delete _0x5e2aca[_0xc008('0x24')];}_0x2e31c2[_0xc008('0x19')](_0x5bebd9)[_0xc008('0x25')](_0x5e2aca);};}exports['index']=function(_0x24c14c,_0x32390d){var _0x209591={},_0x2a7d4f={},_0x4c5dec={'count':0x0,'rows':[]};var _0xcdb32b=_[_0xc008('0x26')](db['Interval']['rawAttributes'],function(_0x539766){return{'name':_0x539766[_0xc008('0x27')],'type':_0x539766[_0xc008('0x28')][_0xc008('0x29')]};});_0x2a7d4f[_0xc008('0x2a')]=_[_0xc008('0x26')](_0xcdb32b,_0xc008('0x24'));_0x2a7d4f[_0xc008('0x2b')]=_[_0xc008('0x2c')](_0x24c14c[_0xc008('0x2b')]);_0x2a7d4f[_0xc008('0x2d')]=_[_0xc008('0x2e')](_0x2a7d4f[_0xc008('0x2a')],_0x2a7d4f['query']);_0x209591[_0xc008('0x2f')]=_[_0xc008('0x2e')](_0x2a7d4f['model'],qs[_0xc008('0x30')](_0x24c14c[_0xc008('0x2b')][_0xc008('0x30')]));_0x209591[_0xc008('0x2f')]=_0x209591[_0xc008('0x2f')][_0xc008('0x31')]?_0x209591[_0xc008('0x2f')]:_0x2a7d4f[_0xc008('0x2a')];if(!_0x24c14c[_0xc008('0x2b')]['hasOwnProperty'](_0xc008('0x32'))){_0x209591[_0xc008('0x33')]=qs[_0xc008('0x33')](_0x24c14c[_0xc008('0x2b')][_0xc008('0x33')]);_0x209591[_0xc008('0x34')]=qs[_0xc008('0x34')](_0x24c14c['query'][_0xc008('0x34')]);}_0x209591[_0xc008('0x35')]=qs['sort'](_0x24c14c[_0xc008('0x2b')][_0xc008('0x36')]);_0x209591['where']=qs[_0xc008('0x2d')](_[_0xc008('0x37')](_0x24c14c[_0xc008('0x2b')],_0x2a7d4f['filters']));if(_0x24c14c['query']['filter']){_0x209591[_0xc008('0x38')]=_['merge'](_0x209591[_0xc008('0x38')],{'$or':_[_0xc008('0x26')](_0xcdb32b,function(_0x6a4ccb){if(_0x6a4ccb[_0xc008('0x28')]!==_0xc008('0x39')){var _0xa381d1={};_0xa381d1[_0x6a4ccb[_0xc008('0x24')]]={'$like':'%'+_0x24c14c[_0xc008('0x2b')][_0xc008('0x3a')]+'%'};return _0xa381d1;}})});}_0x209591=_[_0xc008('0x3b')]({},_0x209591,_0x24c14c[_0xc008('0x3c')]);var _0xdfca2e={'where':_0x209591[_0xc008('0x38')]};return db[_0xc008('0x3d')]['count'](_0xdfca2e)[_0xc008('0x20')](function(_0x23c4db){_0x4c5dec[_0xc008('0x1b')]=_0x23c4db;if(_0x24c14c[_0xc008('0x2b')]['includeAll']){_0x209591[_0xc008('0x3e')]=[{'all':!![]}];}return db[_0xc008('0x3d')][_0xc008('0x3f')](_0x209591);})[_0xc008('0x20')](function(_0x2d142d){_0x4c5dec['rows']=_0x2d142d;return _0x4c5dec;})[_0xc008('0x20')](respondWithFilteredResult(_0x32390d,_0x209591))[_0xc008('0x40')](handleError(_0x32390d,null));};exports[_0xc008('0x41')]=function(_0x3e9a99,_0x7279e8){var _0x4f93a4={'raw':!![],'where':{'id':_0x3e9a99[_0xc008('0x42')]['id']}},_0xf4cc4b={};_0xf4cc4b[_0xc008('0x2a')]=_[_0xc008('0x2c')](db['Interval'][_0xc008('0x43')]);_0xf4cc4b[_0xc008('0x2b')]=_[_0xc008('0x2c')](_0x3e9a99['query']);_0xf4cc4b[_0xc008('0x2d')]=_['intersection'](_0xf4cc4b[_0xc008('0x2a')],_0xf4cc4b['query']);_0x4f93a4[_0xc008('0x2f')]=_[_0xc008('0x2e')](_0xf4cc4b['model'],qs[_0xc008('0x30')](_0x3e9a99[_0xc008('0x2b')][_0xc008('0x30')]));_0x4f93a4['attributes']=_0x4f93a4[_0xc008('0x2f')][_0xc008('0x31')]?_0x4f93a4[_0xc008('0x2f')]:_0xf4cc4b[_0xc008('0x2a')];if(_0x3e9a99[_0xc008('0x2b')][_0xc008('0x44')]){_0x4f93a4['include']=[{'all':!![]}];}_0x4f93a4=_['merge']({},_0x4f93a4,_0x3e9a99['options']);return db[_0xc008('0x3d')][_0xc008('0x45')](_0x4f93a4)[_0xc008('0x20')](handleEntityNotFound(_0x7279e8,null))[_0xc008('0x20')](respondWithResult(_0x7279e8,null))[_0xc008('0x40')](handleError(_0x7279e8,null));};exports[_0xc008('0x46')]=function(_0x2cf641,_0x33be4f){return db['Interval']['create'](_0x2cf641['body'],{})[_0xc008('0x20')](function(_0x2651cf){var _0x158eae=_0x2cf641['user'][_0xc008('0x21')]({'plain':!![]});if(!_0x158eae)throw new Error(_0xc008('0x47'));if(_0x158eae[_0xc008('0x48')]===_0xc008('0x49')){var _0x4981b4=_0x2651cf[_0xc008('0x21')]({'plain':!![]});var _0x17ec90=_0xc008('0x4a');return db[_0xc008('0x4b')][_0xc008('0x45')]({'where':{'name':_0x17ec90,'userProfileId':_0x158eae['userProfileId']},'raw':!![]})['then'](function(_0x223056){if(_0x223056&&_0x223056['autoAssociation']===0x0){return db[_0xc008('0x22')][_0xc008('0x46')]({'name':_0x4981b4[_0xc008('0x24')],'resourceId':_0x4981b4['id'],'type':_0x223056['name'],'sectionId':_0x223056['id']},{})[_0xc008('0x20')](function(){return _0x2651cf;});}else{return _0x2651cf;}})[_0xc008('0x40')](function(_0xee64){logger[_0xc008('0x4c')](_0xc008('0x4d'),_0xee64);throw _0xee64;});}return _0x2651cf;})['then'](respondWithResult(_0x33be4f,0xc9))[_0xc008('0x40')](handleError(_0x33be4f,null));};exports[_0xc008('0x4e')]=function(_0x4b4c6d,_0x24f775){if(_0x4b4c6d[_0xc008('0x4f')]['id']){delete _0x4b4c6d['body']['id'];}return db['Interval'][_0xc008('0x45')]({'where':{'id':_0x4b4c6d[_0xc008('0x42')]['id']}})[_0xc008('0x20')](handleEntityNotFound(_0x24f775,null))[_0xc008('0x20')](saveUpdates(_0x4b4c6d[_0xc008('0x4f')],null))['then'](respondWithResult(_0x24f775,null))['catch'](handleError(_0x24f775,null));};exports[_0xc008('0x1f')]=function(_0x5d815d,_0x3d7cce){return db[_0xc008('0x3d')][_0xc008('0x45')]({'where':{'id':_0x5d815d[_0xc008('0x42')]['id']}})[_0xc008('0x20')](handleEntityNotFound(_0x3d7cce,null))[_0xc008('0x20')](removeEntity(_0x3d7cce,null))['catch'](handleError(_0x3d7cce,null));};exports[_0xc008('0x50')]=function(_0xbd7422,_0x9a7abc,_0x2b350c){if(_0xbd7422[_0xc008('0x4f')]['id']){delete _0xbd7422['body']['id'];}return db[_0xc008('0x3d')]['find']({'where':{'id':_0xbd7422['params']['id']}})['then'](handleEntityNotFound(_0x9a7abc,null))[_0xc008('0x20')](function(_0x1bcbb1){if(_0x1bcbb1){_0xbd7422[_0xc008('0x4f')]['IntervalId']=_0x1bcbb1['id'];return db[_0xc008('0x3d')][_0xc008('0x46')](_0xbd7422[_0xc008('0x4f')]);}})['then'](respondWithResult(_0x9a7abc,null))[_0xc008('0x40')](handleError(_0x9a7abc,null));};exports[_0xc008('0x51')]=function(_0x12ba3f,_0x1b5a22,_0x5baff1){var _0x4022dd={};var _0x4eaa6d={};var _0x23ef33;var _0x422e1f;return db[_0xc008('0x3d')][_0xc008('0x52')]({'where':{'id':_0x12ba3f[_0xc008('0x42')]['id']}})[_0xc008('0x20')](handleEntityNotFound(_0x1b5a22,null))['then'](function(_0x375e71){if(_0x375e71){_0x23ef33=_0x375e71;_0x4eaa6d['model']=_['keys'](db[_0xc008('0x3d')][_0xc008('0x43')]);_0x4eaa6d['query']=_[_0xc008('0x2c')](_0x12ba3f[_0xc008('0x2b')]);_0x4eaa6d[_0xc008('0x2d')]=_[_0xc008('0x2e')](_0x4eaa6d[_0xc008('0x2a')],_0x4eaa6d[_0xc008('0x2b')]);_0x4022dd[_0xc008('0x2f')]=_['intersection'](_0x4eaa6d[_0xc008('0x2a')],qs[_0xc008('0x30')](_0x12ba3f[_0xc008('0x2b')][_0xc008('0x30')]));_0x4022dd[_0xc008('0x2f')]=_0x4022dd[_0xc008('0x2f')][_0xc008('0x31')]?_0x4022dd[_0xc008('0x2f')]:_0x4eaa6d[_0xc008('0x2a')];_0x4022dd[_0xc008('0x35')]=qs[_0xc008('0x36')](_0x12ba3f[_0xc008('0x2b')][_0xc008('0x36')]);_0x4022dd[_0xc008('0x38')]=qs['filters'](_[_0xc008('0x37')](_0x12ba3f[_0xc008('0x2b')],_0x4eaa6d[_0xc008('0x2d')]));if(_0x12ba3f['query'][_0xc008('0x3a')]){_0x4022dd[_0xc008('0x38')]=_['merge'](_0x4022dd['where'],{'$or':_[_0xc008('0x26')](_0x4022dd[_0xc008('0x2f')],function(_0x7bad14){var _0x39083c={};_0x39083c[_0x7bad14]={'$like':'%'+_0x12ba3f[_0xc008('0x2b')][_0xc008('0x3a')]+'%'};return _0x39083c;})});}_0x4022dd=_[_0xc008('0x3b')]({},_0x4022dd,_0x12ba3f[_0xc008('0x3c')]);return _0x23ef33[_0xc008('0x51')](_0x4022dd);}})[_0xc008('0x20')](function(_0x383325){if(_0x383325){_0x422e1f=_0x383325['length'];if(!_0x12ba3f[_0xc008('0x2b')][_0xc008('0x53')](_0xc008('0x32'))){_0x4022dd[_0xc008('0x33')]=qs['limit'](_0x12ba3f[_0xc008('0x2b')]['limit']);_0x4022dd[_0xc008('0x34')]=qs[_0xc008('0x34')](_0x12ba3f[_0xc008('0x2b')]['offset']);}return _0x23ef33[_0xc008('0x51')](_0x4022dd);}})[_0xc008('0x20')](function(_0xa80000){if(_0xa80000){return _0xa80000?{'count':_0x422e1f,'rows':_0xa80000}:null;}})['then'](respondWithResult(_0x1b5a22,null))[_0xc008('0x40')](handleError(_0x1b5a22,null));};exports['addIntervals']=function(_0x50ee03,_0xee7a85,_0x23012c){return db[_0xc008('0x3d')][_0xc008('0x52')]({'where':{'id':_0x50ee03['params']['id']}})[_0xc008('0x20')](handleEntityNotFound(_0xee7a85,null))[_0xc008('0x20')](function(_0x49493b){if(_0x49493b){return db[_0xc008('0x54')]['transaction'](function(_0x278cbe){return db['Interval'][_0xc008('0x1f')]({'where':{'IntervalId':_0x50ee03['params']['id']},'transaction':_0x278cbe})[_0xc008('0x20')](function(_0x103d75){var _0x33d8e4=_[_0xc008('0x26')](_0x50ee03['body'],function(_0x57752c){delete _0x57752c['id'];_0x57752c[_0xc008('0x55')]=_0x50ee03[_0xc008('0x42')]['id'];return _0x57752c;});return db[_0xc008('0x3d')][_0xc008('0x56')](_0x33d8e4,{'transaction':_0x278cbe});});})[_0xc008('0x20')](function(){return db[_0xc008('0x3d')][_0xc008('0x3f')]({'where':{'IntervalId':_0x50ee03['params']['id']}});});}})[_0xc008('0x20')](respondWithResult(_0xee7a85,null))['catch'](handleError(_0xee7a85,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index ee3f34b..01f217a 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 _0xbefe=['request-promise','path','rimraf','../../config/environment','./interval.attributes','exports','Interval','tools_intervals','rewrite','util','api','moment','bluebird'];(function(_0x407752,_0x21acee){var _0x13e348=function(_0x4c2df4){while(--_0x4c2df4){_0x407752['push'](_0x407752['shift']());}};_0x13e348(++_0x21acee);}(_0xbefe,0x168));var _0xebef=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0xbefe[_0xabfec4];return _0x7bafa2;};'use strict';var _=require('lodash');var util=require(_0xebef('0x0'));var logger=require('../../config/logger')(_0xebef('0x1'));var moment=require(_0xebef('0x2'));var BPromise=require(_0xebef('0x3'));var rp=require(_0xebef('0x4'));var fs=require('fs');var path=require(_0xebef('0x5'));var rimraf=require(_0xebef('0x6'));var config=require(_0xebef('0x7'));var attributes=require(_0xebef('0x8'));var extensions=require('../../components/extensions/rewrite');module[_0xebef('0x9')]=function(_0x39de80,_0x3e89ca){return _0x39de80['define'](_0xebef('0xa'),attributes,{'tableName':_0xebef('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x598d6d,_0x4d28bb){extensions[_0xebef('0xc')](_0x39de80,_0x598d6d);},'afterBulkCreate':function(_0xa0a8ef,_0x187f3b,_0x12f30c){_0x12f30c();extensions[_0xebef('0xc')](_0x39de80,_0xa0a8ef[0x0]);},'afterUpdate':function(_0x2b08a1,_0x37143a){extensions[_0xebef('0xc')](_0x39de80,_0x2b08a1);},'afterDestroy':function(_0x56dcce,_0x6fe645){extensions[_0xebef('0xc')](_0x39de80,_0x56dcce);}}});}; \ No newline at end of file +var _0x2d4d=['../../components/extensions/rewrite','exports','define','tools_intervals','rewrite','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes'];(function(_0x363b81,_0x81e6ca){var _0x1d92fb=function(_0x129644){while(--_0x129644){_0x363b81['push'](_0x363b81['shift']());}};_0x1d92fb(++_0x81e6ca);}(_0x2d4d,0x94));var _0xd2d4=function(_0x398d0e,_0x12a774){_0x398d0e=_0x398d0e-0x0;var _0xbdd0a7=_0x2d4d[_0x398d0e];return _0xbdd0a7;};'use strict';var _=require(_0xd2d4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd2d4('0x1'));var BPromise=require(_0xd2d4('0x2'));var rp=require(_0xd2d4('0x3'));var fs=require('fs');var path=require(_0xd2d4('0x4'));var rimraf=require(_0xd2d4('0x5'));var config=require(_0xd2d4('0x6'));var attributes=require(_0xd2d4('0x7'));var extensions=require(_0xd2d4('0x8'));module[_0xd2d4('0x9')]=function(_0x471003,_0x56d1e3){return _0x471003[_0xd2d4('0xa')]('Interval',attributes,{'tableName':_0xd2d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x89452c,_0x2641f1){extensions[_0xd2d4('0xc')](_0x471003,_0x89452c);},'afterBulkCreate':function(_0x2db655,_0x2f5e64,_0x1952fd){_0x1952fd();extensions[_0xd2d4('0xc')](_0x471003,_0x2db655[0x0]);},'afterUpdate':function(_0x2c5b3c,_0x2705d8){extensions[_0xd2d4('0xc')](_0x471003,_0x2c5b3c);},'afterDestroy':function(_0x1504b9,_0x444ac2){extensions[_0xd2d4('0xc')](_0x471003,_0x1504b9);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 73af0a1..fbe7a02 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 _0x084d=['http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','map','include','model','GetInterval','debug','stringify','ShowInterval','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client'];(function(_0x2ad632,_0x134994){var _0x418653=function(_0x1066bd){while(--_0x1066bd){_0x2ad632['push'](_0x2ad632['shift']());}};_0x418653(++_0x134994);}(_0x084d,0x10f));var _0xd084=function(_0x53f4ae,_0x4ba18d){_0x53f4ae=_0x53f4ae-0x0;var _0x351bfb=_0x084d[_0x53f4ae];return _0x351bfb;};'use strict';var _=require(_0xd084('0x0'));var util=require(_0xd084('0x1'));var moment=require(_0xd084('0x2'));var BPromise=require(_0xd084('0x3'));var rs=require(_0xd084('0x4'));var fs=require('fs');var Redis=require(_0xd084('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd084('0x6'));var logger=require(_0xd084('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd084('0x8')][_0xd084('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ef7ff,_0x561315,_0x69f401){return new BPromise(function(_0xb0308,_0x7213ab){return client[_0xd084('0xa')](_0x5ef7ff,_0x69f401)[_0xd084('0xb')](function(_0x292ea3){logger[_0xd084('0xc')](_0xd084('0xd'),_0x561315,_0xd084('0xe'));logger['debug'](_0xd084('0xf'),_0x561315,_0xd084('0xe'),JSON['stringify'](_0x292ea3));if(_0x292ea3[_0xd084('0x10')]){if(_0x292ea3[_0xd084('0x10')][_0xd084('0x11')]===0x1f4){logger[_0xd084('0x10')](_0xd084('0xd'),_0x561315,_0x292ea3[_0xd084('0x10')]['message']);return _0x7213ab(_0x292ea3[_0xd084('0x10')][_0xd084('0x12')]);}logger[_0xd084('0x10')]('Interval,\x20%s,\x20%s',_0x561315,_0x292ea3[_0xd084('0x10')][_0xd084('0x12')]);return _0xb0308(_0x292ea3[_0xd084('0x10')][_0xd084('0x12')]);}else{logger[_0xd084('0xc')](_0xd084('0xd'),_0x561315,_0xd084('0xe'));_0xb0308(_0x292ea3[_0xd084('0x13')]['message']);}})[_0xd084('0x14')](function(_0x527673){logger['error'](_0xd084('0xd'),_0x561315,_0x527673);_0x7213ab(_0x527673);});});}exports['GetInterval']=function(_0x2589a5){var _0x4f1ee3=this;return new Promise(function(_0x28f6ee,_0x89dc59){return db['Interval'][_0xd084('0x15')]({'raw':_0x2589a5['options']?_0x2589a5[_0xd084('0x16')][_0xd084('0x17')]===undefined?!![]:![]:!![],'where':_0x2589a5[_0xd084('0x16')]?_0x2589a5['options'][_0xd084('0x18')]||null:null,'attributes':_0x2589a5['options']?_0x2589a5[_0xd084('0x16')][_0xd084('0x19')]||null:null,'limit':_0x2589a5[_0xd084('0x16')]?_0x2589a5[_0xd084('0x16')][_0xd084('0x1a')]||null:null,'include':_0x2589a5[_0xd084('0x16')]?_0x2589a5[_0xd084('0x16')]['include']?_[_0xd084('0x1b')](_0x2589a5[_0xd084('0x16')][_0xd084('0x1c')],function(_0xadb3bc){return{'model':db[_0xadb3bc[_0xd084('0x1d')]],'as':_0xadb3bc['as'],'attributes':_0xadb3bc[_0xd084('0x19')],'include':_0xadb3bc[_0xd084('0x1c')]?_[_0xd084('0x1b')](_0xadb3bc[_0xd084('0x1c')],function(_0x30a6c8){return{'model':db[_0x30a6c8[_0xd084('0x1d')]],'as':_0x30a6c8['as'],'attributes':_0x30a6c8[_0xd084('0x19')],'include':_0x30a6c8['include']?_['map'](_0x30a6c8['include'],function(_0xece7a3){return{'model':db[_0xece7a3['model']],'as':_0xece7a3['as'],'attributes':_0xece7a3[_0xd084('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd084('0xb')](function(_0x556b1f){logger[_0xd084('0xc')](_0xd084('0x1e'),_0x2589a5);logger[_0xd084('0x1f')](_0xd084('0x1e'),_0x2589a5,JSON[_0xd084('0x20')](_0x556b1f));_0x28f6ee(_0x556b1f);})['catch'](function(_0x25f972){logger[_0xd084('0x10')](_0xd084('0x1e'),_0x25f972[_0xd084('0x12')],_0x2589a5);_0x89dc59(_0x4f1ee3[_0xd084('0x10')](0x1f4,_0x25f972[_0xd084('0x12')]));});});};exports[_0xd084('0x21')]=function(_0x2b62e2){var _0xb88c9e=this;return new Promise(function(_0x472daa,_0x533b59){return db['Interval'][_0xd084('0x22')]({'raw':_0x2b62e2[_0xd084('0x16')]?_0x2b62e2[_0xd084('0x16')][_0xd084('0x17')]===undefined?!![]:![]:!![],'where':_0x2b62e2[_0xd084('0x16')]?_0x2b62e2[_0xd084('0x16')][_0xd084('0x18')]||null:null,'attributes':_0x2b62e2[_0xd084('0x16')]?_0x2b62e2[_0xd084('0x16')]['attributes']||null:null,'include':_0x2b62e2[_0xd084('0x16')]?_0x2b62e2['options']['include']?_[_0xd084('0x1b')](_0x2b62e2[_0xd084('0x16')]['include'],function(_0x36becd){return{'model':db[_0x36becd[_0xd084('0x1d')]],'as':_0x36becd['as'],'attributes':_0x36becd[_0xd084('0x19')],'include':_0x36becd[_0xd084('0x1c')]?_[_0xd084('0x1b')](_0x36becd[_0xd084('0x1c')],function(_0x4b3975){return{'model':db[_0x4b3975[_0xd084('0x1d')]],'as':_0x4b3975['as'],'attributes':_0x4b3975[_0xd084('0x19')],'include':_0x4b3975[_0xd084('0x1c')]?_[_0xd084('0x1b')](_0x4b3975[_0xd084('0x1c')],function(_0x520614){return{'model':db[_0x520614[_0xd084('0x1d')]],'as':_0x520614['as'],'attributes':_0x520614[_0xd084('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd084('0xb')](function(_0x25339f){logger['info'](_0xd084('0x21'),_0x2b62e2);logger[_0xd084('0x1f')](_0xd084('0x21'),_0x2b62e2,JSON[_0xd084('0x20')](_0x25339f));_0x472daa(_0x25339f);})[_0xd084('0x14')](function(_0x2251e0){logger[_0xd084('0x10')]('ShowInterval',_0x2251e0['message'],_0x2b62e2);_0x533b59(_0xb88c9e['error'](0x1f4,_0x2251e0[_0xd084('0x12')]));});});}; \ No newline at end of file +var _0x39c2=['debug','stringify','error','code','Interval,\x20%s,\x20%s','message','result','catch','GetInterval','options','attributes','limit','include','map','model','ShowInterval','Interval','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x514aa2,_0x15af41){var _0xd374e6=function(_0x597ea5){while(--_0x597ea5){_0x514aa2['push'](_0x514aa2['shift']());}};_0xd374e6(++_0x15af41);}(_0x39c2,0xbc));var _0x239c=function(_0x27368d,_0x12405e){_0x27368d=_0x27368d-0x0;var _0x1cf6e3=_0x39c2[_0x27368d];return _0x1cf6e3;};'use strict';var _=require(_0x239c('0x0'));var util=require(_0x239c('0x1'));var moment=require(_0x239c('0x2'));var BPromise=require(_0x239c('0x3'));var rs=require(_0x239c('0x4'));var fs=require('fs');var Redis=require(_0x239c('0x5'));var db=require(_0x239c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x239c('0x7'))(_0x239c('0x8'));var config=require(_0x239c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x239c('0xa')][_0x239c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53c309,_0xf9f9ae,_0x4c853c){return new BPromise(function(_0x23a71e,_0x44986b){return client[_0x239c('0xc')](_0x53c309,_0x4c853c)[_0x239c('0xd')](function(_0x331b99){logger[_0x239c('0xe')]('Interval,\x20%s,\x20%s',_0xf9f9ae,_0x239c('0xf'));logger[_0x239c('0x10')]('Interval,\x20%s,\x20%s,\x20%s',_0xf9f9ae,_0x239c('0xf'),JSON[_0x239c('0x11')](_0x331b99));if(_0x331b99['error']){if(_0x331b99[_0x239c('0x12')][_0x239c('0x13')]===0x1f4){logger['error'](_0x239c('0x14'),_0xf9f9ae,_0x331b99[_0x239c('0x12')][_0x239c('0x15')]);return _0x44986b(_0x331b99[_0x239c('0x12')][_0x239c('0x15')]);}logger[_0x239c('0x12')](_0x239c('0x14'),_0xf9f9ae,_0x331b99['error']['message']);return _0x23a71e(_0x331b99[_0x239c('0x12')][_0x239c('0x15')]);}else{logger[_0x239c('0xe')]('Interval,\x20%s,\x20%s',_0xf9f9ae,_0x239c('0xf'));_0x23a71e(_0x331b99[_0x239c('0x16')][_0x239c('0x15')]);}})[_0x239c('0x17')](function(_0x1eb22c){logger['error'](_0x239c('0x14'),_0xf9f9ae,_0x1eb22c);_0x44986b(_0x1eb22c);});});}exports[_0x239c('0x18')]=function(_0x522f99){var _0x5af2b9=this;return new Promise(function(_0x2544f3,_0x38e3a7){return db['Interval']['findAll']({'raw':_0x522f99['options']?_0x522f99['options']['raw']===undefined?!![]:![]:!![],'where':_0x522f99[_0x239c('0x19')]?_0x522f99[_0x239c('0x19')]['where']||null:null,'attributes':_0x522f99[_0x239c('0x19')]?_0x522f99[_0x239c('0x19')][_0x239c('0x1a')]||null:null,'limit':_0x522f99[_0x239c('0x19')]?_0x522f99[_0x239c('0x19')][_0x239c('0x1b')]||null:null,'include':_0x522f99[_0x239c('0x19')]?_0x522f99[_0x239c('0x19')][_0x239c('0x1c')]?_[_0x239c('0x1d')](_0x522f99[_0x239c('0x19')][_0x239c('0x1c')],function(_0x228c9a){return{'model':db[_0x228c9a[_0x239c('0x1e')]],'as':_0x228c9a['as'],'attributes':_0x228c9a[_0x239c('0x1a')],'include':_0x228c9a[_0x239c('0x1c')]?_[_0x239c('0x1d')](_0x228c9a['include'],function(_0x421ba3){return{'model':db[_0x421ba3['model']],'as':_0x421ba3['as'],'attributes':_0x421ba3[_0x239c('0x1a')],'include':_0x421ba3[_0x239c('0x1c')]?_['map'](_0x421ba3['include'],function(_0x590a35){return{'model':db[_0x590a35['model']],'as':_0x590a35['as'],'attributes':_0x590a35[_0x239c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x239c('0xd')](function(_0x3af1ef){logger[_0x239c('0xe')](_0x239c('0x18'),_0x522f99);logger[_0x239c('0x10')]('GetInterval',_0x522f99,JSON[_0x239c('0x11')](_0x3af1ef));_0x2544f3(_0x3af1ef);})[_0x239c('0x17')](function(_0x2f161b){logger[_0x239c('0x12')](_0x239c('0x18'),_0x2f161b[_0x239c('0x15')],_0x522f99);_0x38e3a7(_0x5af2b9[_0x239c('0x12')](0x1f4,_0x2f161b[_0x239c('0x15')]));});});};exports[_0x239c('0x1f')]=function(_0x2f6f1d){var _0x373d01=this;return new Promise(function(_0x5a0679,_0x336f4f){return db[_0x239c('0x20')]['find']({'raw':_0x2f6f1d[_0x239c('0x19')]?_0x2f6f1d['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f6f1d['options']?_0x2f6f1d[_0x239c('0x19')][_0x239c('0x21')]||null:null,'attributes':_0x2f6f1d[_0x239c('0x19')]?_0x2f6f1d['options'][_0x239c('0x1a')]||null:null,'include':_0x2f6f1d[_0x239c('0x19')]?_0x2f6f1d[_0x239c('0x19')]['include']?_[_0x239c('0x1d')](_0x2f6f1d['options'][_0x239c('0x1c')],function(_0x4eb587){return{'model':db[_0x4eb587[_0x239c('0x1e')]],'as':_0x4eb587['as'],'attributes':_0x4eb587[_0x239c('0x1a')],'include':_0x4eb587[_0x239c('0x1c')]?_[_0x239c('0x1d')](_0x4eb587[_0x239c('0x1c')],function(_0x4010c6){return{'model':db[_0x4010c6[_0x239c('0x1e')]],'as':_0x4010c6['as'],'attributes':_0x4010c6[_0x239c('0x1a')],'include':_0x4010c6[_0x239c('0x1c')]?_[_0x239c('0x1d')](_0x4010c6[_0x239c('0x1c')],function(_0x3620c3){return{'model':db[_0x3620c3[_0x239c('0x1e')]],'as':_0x3620c3['as'],'attributes':_0x3620c3[_0x239c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x239c('0xd')](function(_0x4a8156){logger['info'](_0x239c('0x1f'),_0x2f6f1d);logger['debug'](_0x239c('0x1f'),_0x2f6f1d,JSON[_0x239c('0x11')](_0x4a8156));_0x5a0679(_0x4a8156);})[_0x239c('0x17')](function(_0x3cd98b){logger[_0x239c('0x12')]('ShowInterval',_0x3cd98b[_0x239c('0x15')],_0x2f6f1d);_0x336f4f(_0x373d01[_0x239c('0x12')](0x1f4,_0x3cd98b[_0x239c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index d6bf13d..d05682c 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 _0x5232=['./jira.controller','post','isAuthenticated','send','exports','express','Router'];(function(_0x5f28e3,_0x27a373){var _0x1529af=function(_0x4473df){while(--_0x4473df){_0x5f28e3['push'](_0x5f28e3['shift']());}};_0x1529af(++_0x27a373);}(_0x5232,0x75));var _0x2523=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0x5232[_0x282a1f];return _0x296ea7;};'use strict';var express=require(_0x2523('0x0'));var router=express[_0x2523('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x2523('0x2'));router[_0x2523('0x3')]('/',auth[_0x2523('0x4')](),controller[_0x2523('0x5')]);module[_0x2523('0x6')]=router; \ No newline at end of file +var _0x44ed=['post','isAuthenticated','send','express','Router','./jira.controller'];(function(_0x14a003,_0x1ececd){var _0x417daf=function(_0x3e8504){while(--_0x3e8504){_0x14a003['push'](_0x14a003['shift']());}};_0x417daf(++_0x1ececd);}(_0x44ed,0x183));var _0xd44e=function(_0x4bc4d1,_0x3cfc27){_0x4bc4d1=_0x4bc4d1-0x0;var _0x4dc5a8=_0x44ed[_0x4bc4d1];return _0x4dc5a8;};'use strict';var express=require(_0xd44e('0x0'));var router=express[_0xd44e('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xd44e('0x2'));router[_0xd44e('0x3')]('/',auth[_0xd44e('0x4')](),controller[_0xd44e('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 698c599..9e80617 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 _0x966f=['socket','bluebird','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','x-forwarded-for','connection','remoteAddress'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x966f,0x82));var _0xf966=function(_0x39c38b,_0x18cb9c){_0x39c38b=_0x39c38b-0x0;var _0x1135fe=_0x966f[_0x39c38b];return _0x1135fe;};'use strict';var BPromise=require(_0xf966('0x0'));var https=require('https');var logger=require(_0xf966('0x1'))(_0xf966('0x2'));var USERNAME='support';var PASSWORD=_0xf966('0x3');function openIssue(_0x24ca8b,_0x8a02e2){var _0x574c6e={'fields':{'project':{'key':_0x24ca8b[_0xf966('0x4')]||_0xf966('0x5')},'summary':(_0x24ca8b['summary']||_0xf966('0x6'))+_0xf966('0x7')+_0x24ca8b['ip'],'description':_0x24ca8b[_0xf966('0x8')]||JSON['stringify'](_0x24ca8b),'issuetype':{'name':_0x24ca8b[_0xf966('0x9')]||_0xf966('0xa')}}};_0x574c6e[_0xf966('0xb')][_0xf966('0xc')]=_0x24ca8b[_0xf966('0xd')];_0x574c6e[_0xf966('0xb')][_0xf966('0xe')]=_0x24ca8b['oldToken'];_0x574c6e[_0xf966('0xb')][_0xf966('0xf')]=_0x24ca8b[_0xf966('0x10')];_0x574c6e[_0xf966('0xb')][_0xf966('0x11')]=_0x24ca8b[_0xf966('0x12')];_0x574c6e['fields']['customfield_11504']=_0x24ca8b['reason'];_0x574c6e['fields'][_0xf966('0x13')]=_0x24ca8b['ip'];var _0x390c79={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xf966('0x14'),'method':_0xf966('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0xf966('0x16'),'Authorization':_0xf966('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xf966('0x18')](_0xf966('0x19'))}};var _0x3693ad=JSON['stringify'](_0x574c6e);var _0x15bf85=https[_0xf966('0x1a')](_0x390c79,function(_0x5d13ca){_0x5d13ca[_0xf966('0x1b')](_0xf966('0x1c'));var _0x2affe5='';_0x5d13ca['on'](_0xf966('0x1d'),function(_0x5ce140){_0x2affe5+=_0x5ce140;});_0x5d13ca['on'](_0xf966('0x1e'),function(){if(_0x8a02e2){return _0x8a02e2[_0xf966('0x1f')](_0x5d13ca['statusCode'])[_0xf966('0x20')](JSON[_0xf966('0x21')](_0x2affe5));}});});_0x15bf85['on'](_0xf966('0x22'),function(_0x589f44){if(_0x8a02e2){return _0x8a02e2[_0xf966('0x1f')](0x1f4)[_0xf966('0x20')]({'errors':[{'message':_0xf966('0x23'),'type':_0xf966('0x24')}]});}});_0x15bf85[_0xf966('0x25')](_0x3693ad);_0x15bf85[_0xf966('0x1e')]();}exports[_0xf966('0x26')]=openIssue;exports['send']=function(_0x538b71,_0xe74f9d){_0x538b71['body']['ip']=_0x538b71['headers'][_0xf966('0x27')]||_0x538b71[_0xf966('0x28')][_0xf966('0x29')]||_0x538b71[_0xf966('0x2a')][_0xf966('0x29')]||_0x538b71[_0xf966('0x28')][_0xf966('0x2a')][_0xf966('0x29')];return openIssue(_0x538b71['body'],_0xe74f9d);}; \ No newline at end of file +var _0xc42a=['application/json','Basic\x20','toString','base64','stringify','request','setEncoding','data','end','status','statusCode','json','api.jira','send','body','x-forwarded-for','connection','socket','remoteAddress','https','../../config/logger','api','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST'];(function(_0x18d071,_0x239fab){var _0x39d4e7=function(_0x3d6e36){while(--_0x3d6e36){_0x18d071['push'](_0x18d071['shift']());}};_0x39d4e7(++_0x239fab);}(_0xc42a,0x16b));var _0xac42=function(_0x5e6515,_0x2954b1){_0x5e6515=_0x5e6515-0x0;var _0xd33ce2=_0xc42a[_0x5e6515];return _0xd33ce2;};'use strict';var BPromise=require('bluebird');var https=require(_0xac42('0x0'));var logger=require(_0xac42('0x1'))(_0xac42('0x2'));var USERNAME='support';var PASSWORD=_0xac42('0x3');function openIssue(_0x366fd7,_0x885109){var _0x34df1c={'fields':{'project':{'key':_0x366fd7[_0xac42('0x4')]||'MOTGUI'},'summary':(_0x366fd7[_0xac42('0x5')]||_0xac42('0x6'))+_0xac42('0x7')+_0x366fd7['ip'],'description':_0x366fd7[_0xac42('0x8')]||JSON['stringify'](_0x366fd7),'issuetype':{'name':_0x366fd7[_0xac42('0x9')]||_0xac42('0xa')}}};_0x34df1c[_0xac42('0xb')][_0xac42('0xc')]=_0x366fd7[_0xac42('0xd')];_0x34df1c[_0xac42('0xb')][_0xac42('0xe')]=_0x366fd7['oldToken'];_0x34df1c[_0xac42('0xb')][_0xac42('0xf')]=_0x366fd7['newToken'];_0x34df1c[_0xac42('0xb')][_0xac42('0x10')]=_0x366fd7[_0xac42('0x11')];_0x34df1c[_0xac42('0xb')][_0xac42('0x12')]=_0x366fd7[_0xac42('0x13')];_0x34df1c['fields'][_0xac42('0x14')]=_0x366fd7['ip'];var _0x47fad0={'host':_0xac42('0x15'),'port':0x1bb,'path':_0xac42('0x16'),'method':_0xac42('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xac42('0x18'),'Authorization':_0xac42('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0xac42('0x1a')](_0xac42('0x1b'))}};var _0xbae5e5=JSON[_0xac42('0x1c')](_0x34df1c);var _0x2a911b=https[_0xac42('0x1d')](_0x47fad0,function(_0x2f6eb6){_0x2f6eb6[_0xac42('0x1e')]('utf8');var _0xc4c8ad='';_0x2f6eb6['on'](_0xac42('0x1f'),function(_0x5a7851){_0xc4c8ad+=_0x5a7851;});_0x2f6eb6['on'](_0xac42('0x20'),function(){if(_0x885109){return _0x885109[_0xac42('0x21')](_0x2f6eb6[_0xac42('0x22')])[_0xac42('0x23')](JSON['parse'](_0xc4c8ad));}});});_0x2a911b['on']('error',function(_0x1201d5){if(_0x885109){return _0x885109[_0xac42('0x21')](0x1f4)[_0xac42('0x23')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xac42('0x24')}]});}});_0x2a911b['write'](_0xbae5e5);_0x2a911b[_0xac42('0x20')]();}exports['openIssue']=openIssue;exports[_0xac42('0x25')]=function(_0x12ef7f,_0x5ce3ce){_0x12ef7f[_0xac42('0x26')]['ip']=_0x12ef7f['headers'][_0xac42('0x27')]||_0x12ef7f[_0xac42('0x28')]['remoteAddress']||_0x12ef7f[_0xac42('0x29')][_0xac42('0x2a')]||_0x12ef7f[_0xac42('0x28')][_0xac42('0x29')][_0xac42('0x2a')];return openIssue(_0x12ef7f[_0xac42('0x26')],_0x5ce3ce);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 1e23cf3..5f937d9 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 _0x3bb2=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','update','exports','multer','util','path','connect-timeout','Router'];(function(_0x32d17b,_0xbb7c3f){var _0x4aa86e=function(_0xa97156){while(--_0xa97156){_0x32d17b['push'](_0x32d17b['shift']());}};_0x4aa86e(++_0xbb7c3f);}(_0x3bb2,0x1cf));var _0x23bb=function(_0x56c8dd,_0x2dac80){_0x56c8dd=_0x56c8dd-0x0;var _0x5cbb1d=_0x3bb2[_0x56c8dd];return _0x5cbb1d;};'use strict';var multer=require(_0x23bb('0x0'));var util=require(_0x23bb('0x1'));var path=require(_0x23bb('0x2'));var timeout=require(_0x23bb('0x3'));var express=require('express');var router=express[_0x23bb('0x4')]();var auth=require(_0x23bb('0x5'));var interaction=require(_0x23bb('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router[_0x23bb('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x23bb('0x7')]('/describe',auth[_0x23bb('0x8')](),controller['describe']);router[_0x23bb('0x7')](_0x23bb('0x9'),auth[_0x23bb('0x8')](),controller['show']);router['post']('/',auth[_0x23bb('0x8')](),controller['create']);router['put'](_0x23bb('0x9'),auth[_0x23bb('0x8')](),controller[_0x23bb('0xa')]);router['delete']('/:id',auth[_0x23bb('0x8')](),controller['destroy']);module[_0x23bb('0xb')]=router; \ No newline at end of file +var _0x30cc=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x30cc,0x1a8));var _0xc30c=function(_0x5ad220,_0x27407e){_0x5ad220=_0x5ad220-0x0;var _0xdec77d=_0x30cc[_0x5ad220];return _0xdec77d;};'use strict';var multer=require(_0xc30c('0x0'));var util=require('util');var path=require(_0xc30c('0x1'));var timeout=require(_0xc30c('0x2'));var express=require(_0xc30c('0x3'));var router=express[_0xc30c('0x4')]();var auth=require(_0xc30c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc30c('0x6'));var controller=require(_0xc30c('0x7'));router[_0xc30c('0x8')]('/',auth[_0xc30c('0x9')](),controller['index']);router[_0xc30c('0x8')](_0xc30c('0xa'),auth[_0xc30c('0x9')](),controller[_0xc30c('0xb')]);router[_0xc30c('0x8')](_0xc30c('0xc'),auth['isAuthenticated'](),controller[_0xc30c('0xd')]);router[_0xc30c('0xe')]('/',auth[_0xc30c('0x9')](),controller[_0xc30c('0xf')]);router[_0xc30c('0x10')](_0xc30c('0xc'),auth[_0xc30c('0x9')](),controller[_0xc30c('0x11')]);router[_0xc30c('0x12')]('/:id',auth[_0xc30c('0x9')](),controller[_0xc30c('0x13')]);module[_0xc30c('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 977823a..d1fbb84 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 _0x03e0=['TEXT','STRING'];(function(_0x4b586c,_0x5e0bfc){var _0x2090b5=function(_0x59eaf8){while(--_0x59eaf8){_0x4b586c['push'](_0x4b586c['shift']());}};_0x2090b5(++_0x5e0bfc);}(_0x03e0,0x18a));var _0x003e=function(_0x2f7725,_0x47a0bd){_0x2f7725=_0x2f7725-0x0;var _0x23f49c=_0x03e0[_0x2f7725];return _0x23f49c;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x003e('0x0')]('long')},'membername':{'type':Sequelize[_0x003e('0x1')]},'projectname':{'type':Sequelize[_0x003e('0x1')]},'queue':{'type':Sequelize[_0x003e('0x1')]},'uniqueid':{'type':Sequelize[_0x003e('0x1')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x003e('0x1')]},'questionId':{'type':Sequelize[_0x003e('0x1')]}}; \ No newline at end of file +var _0x329b=['sequelize','exports','long','STRING'];(function(_0x58a559,_0x532a86){var _0x4c29cc=function(_0x264be4){while(--_0x264be4){_0x58a559['push'](_0x58a559['shift']());}};_0x4c29cc(++_0x532a86);}(_0x329b,0xbc));var _0xb329=function(_0x19ef2b,_0x354f66){_0x19ef2b=_0x19ef2b-0x0;var _0x4df537=_0x329b[_0x19ef2b];return _0x4df537;};'use strict';var Sequelize=require(_0xb329('0x0'));module[_0xb329('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize['TEXT'](_0xb329('0x2'))},'membername':{'type':Sequelize[_0xb329('0x3')]},'projectname':{'type':Sequelize[_0xb329('0x3')]},'queue':{'type':Sequelize[_0xb329('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb329('0x3')]},'calleridnum':{'type':Sequelize[_0xb329('0x3')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index f1083a8..e833736 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 _0x68a1=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','status','json','count','offset','limit','set','Content-Range','reject','save','update','end','sendStatus','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','params','keys','find','create','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','squel','jsforce','to-csv','papaparse'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x68a1,0x17f));var _0x168a=function(_0x5ae1f3,_0x24e3f5){_0x5ae1f3=_0x5ae1f3-0x0;var _0x16d84c=_0x68a1[_0x5ae1f3];return _0x16d84c;};'use strict';var pdf=require(_0x168a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x168a('0x1'));var zipdir=require(_0x168a('0x2'));var jsonpatch=require(_0x168a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x168a('0x4'));var Mustache=require(_0x168a('0x5'));var util=require(_0x168a('0x6'));var path=require(_0x168a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x168a('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x168a('0x9'));var crypto=require('crypto');var jsforce=require(_0x168a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x168a('0xb'));var querystring=require('querystring');var Papa=require(_0x168a('0xc'));var Redis=require(_0x168a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x168a('0xe'));var as=require(_0x168a('0xf'));var hardwareService=require(_0x168a('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29253e,_0x20d1f5){_0x20d1f5=_0x20d1f5||0xcc;return function(_0x4c0b99){if(_0x4c0b99){return _0x29253e['sendStatus'](_0x20d1f5);}return _0x29253e[_0x168a('0x11')](_0x20d1f5)['end']();};}function respondWithResult(_0x18b206,_0x5e1f82){_0x5e1f82=_0x5e1f82||0xc8;return function(_0x32772e){if(_0x32772e){return _0x18b206[_0x168a('0x11')](_0x5e1f82)[_0x168a('0x12')](_0x32772e);}};}function respondWithFilteredResult(_0x22e133,_0x23769b){return function(_0xe6edc0){if(_0xe6edc0){var _0x4c399a=_0xe6edc0[_0x168a('0x13')],_0x356ed0=_0x23769b['offset'],_0x5bfe87=_0x23769b[_0x168a('0x14')]+_0x23769b[_0x168a('0x15')],_0x4e8a24;if(_0x5bfe87>=_0x4c399a){_0x5bfe87=_0x4c399a;_0x4e8a24=0xc8;}else{_0x4e8a24=0xce;}_0x22e133[_0x168a('0x11')](_0x4e8a24);return _0x22e133[_0x168a('0x16')](_0x168a('0x17'),_0x356ed0+'-'+_0x5bfe87+'/'+_0x4c399a)[_0x168a('0x12')](_0xe6edc0);}return null;};}function patchUpdates(_0x3ca06f){return function(_0x2e3754){try{jsonpatch['apply'](_0x2e3754,_0x3ca06f,!![]);}catch(_0x2dcc4b){return BPromise[_0x168a('0x18')](_0x2dcc4b);}return _0x2e3754[_0x168a('0x19')]();};}function saveUpdates(_0x44af87,_0x249f72){return function(_0x171b60){if(_0x171b60){return _0x171b60[_0x168a('0x1a')](_0x44af87)['then'](function(_0x4f32c6){return _0x4f32c6;});}return null;};}function removeEntity(_0x38a200,_0x49431c){return function(_0x5217d3){if(_0x5217d3){return _0x5217d3['destroy']()['then'](function(){_0x38a200[_0x168a('0x11')](0xcc)[_0x168a('0x1b')]();});}};}function handleEntityNotFound(_0xb84396,_0x320f70){return function(_0x532f72){if(!_0x532f72){_0xb84396[_0x168a('0x1c')](0x194);}return _0x532f72;};}function handleError(_0x3789ef,_0x12ad13){_0x12ad13=_0x12ad13||0x1f4;return function(_0xad3b5c){logger['error'](_0xad3b5c[_0x168a('0x1d')]);if(_0xad3b5c[_0x168a('0x1e')]){delete _0xad3b5c[_0x168a('0x1e')];}_0x3789ef[_0x168a('0x11')](_0x12ad13)['send'](_0xad3b5c);};}exports[_0x168a('0x1f')]=function(_0x3876a6,_0x870f74){var _0x358572={},_0x166ce9={},_0x531d6b={'count':0x0,'rows':[]};var _0x1a0dc1=_[_0x168a('0x20')](db[_0x168a('0x21')][_0x168a('0x22')],function(_0x3c0397){return{'name':_0x3c0397[_0x168a('0x23')],'type':_0x3c0397[_0x168a('0x24')][_0x168a('0x25')]};});_0x166ce9[_0x168a('0x26')]=_[_0x168a('0x20')](_0x1a0dc1,_0x168a('0x1e'));_0x166ce9['query']=_['keys'](_0x3876a6[_0x168a('0x27')]);_0x166ce9[_0x168a('0x28')]=_[_0x168a('0x29')](_0x166ce9[_0x168a('0x26')],_0x166ce9['query']);_0x358572[_0x168a('0x2a')]=_[_0x168a('0x29')](_0x166ce9[_0x168a('0x26')],qs['fields'](_0x3876a6[_0x168a('0x27')][_0x168a('0x2b')]));_0x358572[_0x168a('0x2a')]=_0x358572[_0x168a('0x2a')][_0x168a('0x2c')]?_0x358572[_0x168a('0x2a')]:_0x166ce9[_0x168a('0x26')];if(!_0x3876a6[_0x168a('0x27')][_0x168a('0x2d')](_0x168a('0x2e'))){_0x358572['limit']=qs['limit'](_0x3876a6[_0x168a('0x27')]['limit']);_0x358572[_0x168a('0x14')]=qs['offset'](_0x3876a6['query'][_0x168a('0x14')]);}_0x358572[_0x168a('0x2f')]=qs['sort'](_0x3876a6[_0x168a('0x27')]['sort']);_0x358572[_0x168a('0x30')]=qs[_0x168a('0x28')](_[_0x168a('0x31')](_0x3876a6[_0x168a('0x27')],_0x166ce9[_0x168a('0x28')]));if(_0x3876a6[_0x168a('0x27')][_0x168a('0x32')]){_0x358572[_0x168a('0x30')]=_[_0x168a('0x33')](_0x358572[_0x168a('0x30')],{'$or':_[_0x168a('0x20')](_0x1a0dc1,function(_0x2af758){if(_0x2af758[_0x168a('0x24')]!==_0x168a('0x34')){var _0x3adb31={};_0x3adb31[_0x2af758[_0x168a('0x1e')]]={'$like':'%'+_0x3876a6[_0x168a('0x27')][_0x168a('0x32')]+'%'};return _0x3adb31;}})});}_0x358572=_[_0x168a('0x33')]({},_0x358572,_0x3876a6[_0x168a('0x35')]);var _0x4e2c93={'where':_0x358572['where']};return db[_0x168a('0x21')][_0x168a('0x13')](_0x4e2c93)[_0x168a('0x36')](function(_0x1cdd31){_0x531d6b[_0x168a('0x13')]=_0x1cdd31;if(_0x3876a6[_0x168a('0x27')][_0x168a('0x37')]){_0x358572[_0x168a('0x38')]=[{'all':!![]}];}return db[_0x168a('0x21')][_0x168a('0x39')](_0x358572);})[_0x168a('0x36')](function(_0x506280){_0x531d6b['rows']=_0x506280;return _0x531d6b;})['then'](respondWithFilteredResult(_0x870f74,_0x358572))[_0x168a('0x3a')](handleError(_0x870f74,null));};exports['show']=function(_0x274b8c,_0x4bfc79){var _0x5d2856={'raw':!![],'where':{'id':_0x274b8c[_0x168a('0x3b')]['id']}},_0x3e7608={};_0x3e7608[_0x168a('0x26')]=_[_0x168a('0x3c')](db['JscriptyAnswerReport'][_0x168a('0x22')]);_0x3e7608['query']=_[_0x168a('0x3c')](_0x274b8c[_0x168a('0x27')]);_0x3e7608[_0x168a('0x28')]=_['intersection'](_0x3e7608['model'],_0x3e7608[_0x168a('0x27')]);_0x5d2856[_0x168a('0x2a')]=_[_0x168a('0x29')](_0x3e7608['model'],qs[_0x168a('0x2b')](_0x274b8c['query'][_0x168a('0x2b')]));_0x5d2856[_0x168a('0x2a')]=_0x5d2856[_0x168a('0x2a')][_0x168a('0x2c')]?_0x5d2856[_0x168a('0x2a')]:_0x3e7608[_0x168a('0x26')];if(_0x274b8c[_0x168a('0x27')][_0x168a('0x37')]){_0x5d2856[_0x168a('0x38')]=[{'all':!![]}];}_0x5d2856=_['merge']({},_0x5d2856,_0x274b8c[_0x168a('0x35')]);return db[_0x168a('0x21')][_0x168a('0x3d')](_0x5d2856)['then'](handleEntityNotFound(_0x4bfc79,null))[_0x168a('0x36')](respondWithResult(_0x4bfc79,null))[_0x168a('0x3a')](handleError(_0x4bfc79,null));};exports[_0x168a('0x3e')]=function(_0x2c3893,_0x19fbbd){return db[_0x168a('0x21')][_0x168a('0x3e')](_0x2c3893[_0x168a('0x3f')],{})['then'](respondWithResult(_0x19fbbd,0xc9))[_0x168a('0x3a')](handleError(_0x19fbbd,null));};exports[_0x168a('0x1a')]=function(_0x5ddd96,_0x276156){if(_0x5ddd96[_0x168a('0x3f')]['id']){delete _0x5ddd96['body']['id'];}return db[_0x168a('0x21')][_0x168a('0x3d')]({'where':{'id':_0x5ddd96['params']['id']}})['then'](handleEntityNotFound(_0x276156,null))['then'](saveUpdates(_0x5ddd96[_0x168a('0x3f')],null))[_0x168a('0x36')](respondWithResult(_0x276156,null))['catch'](handleError(_0x276156,null));};exports[_0x168a('0x40')]=function(_0x1fc85d,_0x1f9bca){return db['JscriptyAnswerReport'][_0x168a('0x3d')]({'where':{'id':_0x1fc85d[_0x168a('0x3b')]['id']}})[_0x168a('0x36')](handleEntityNotFound(_0x1f9bca,null))[_0x168a('0x36')](removeEntity(_0x1f9bca,null))['catch'](handleError(_0x1f9bca,null));};exports[_0x168a('0x41')]=function(_0x45b659,_0x4ad5e6){return db['JscriptyAnswerReport']['describe']()[_0x168a('0x36')](respondWithResult(_0x4ad5e6,null))[_0x168a('0x3a')](handleError(_0x4ad5e6,null));}; \ No newline at end of file +var _0xc5df=['jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','update','error','stack','name','send','map','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','JscriptyAnswerReport','then','rows','catch','show','params','include','find','create','body','describe','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto'];(function(_0x4dc308,_0x312abe){var _0x613b29=function(_0x1293fb){while(--_0x1293fb){_0x4dc308['push'](_0x4dc308['shift']());}};_0x613b29(++_0x312abe);}(_0xc5df,0x80));var _0xfc5d=function(_0x5db65f,_0x297030){_0x5db65f=_0x5db65f-0x0;var _0x4beb79=_0xc5df[_0x5db65f];return _0x4beb79;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xfc5d('0x0'));var zipdir=require(_0xfc5d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfc5d('0x2'));var BPromise=require(_0xfc5d('0x3'));var Mustache=require(_0xfc5d('0x4'));var util=require(_0xfc5d('0x5'));var path=require(_0xfc5d('0x6'));var sox=require('sox');var csv=require(_0xfc5d('0x7'));var ejs=require(_0xfc5d('0x8'));var fs=require('fs');var _=require(_0xfc5d('0x9'));var squel=require(_0xfc5d('0xa'));var crypto=require(_0xfc5d('0xb'));var jsforce=require(_0xfc5d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfc5d('0x7'));var querystring=require(_0xfc5d('0xd'));var Papa=require('papaparse');var Redis=require(_0xfc5d('0xe'));var authService=require(_0xfc5d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfc5d('0x10'));var hardwareService=require(_0xfc5d('0x11'));var logger=require(_0xfc5d('0x12'))(_0xfc5d('0x13'));var utils=require('../../config/utils');var config=require(_0xfc5d('0x14'));var db=require(_0xfc5d('0x15'))['db'];function respondWithStatusCode(_0xa2421d,_0x4f364c){_0x4f364c=_0x4f364c||0xcc;return function(_0x37eadc){if(_0x37eadc){return _0xa2421d[_0xfc5d('0x16')](_0x4f364c);}return _0xa2421d['status'](_0x4f364c)[_0xfc5d('0x17')]();};}function respondWithResult(_0x57581b,_0xddf605){_0xddf605=_0xddf605||0xc8;return function(_0x514fc1){if(_0x514fc1){return _0x57581b[_0xfc5d('0x18')](_0xddf605)[_0xfc5d('0x19')](_0x514fc1);}};}function respondWithFilteredResult(_0x1606ee,_0x105bea){return function(_0x1271c1){if(_0x1271c1){var _0x561131=_0x1271c1[_0xfc5d('0x1a')],_0x44d245=_0x105bea['offset'],_0x1d496e=_0x105bea[_0xfc5d('0x1b')]+_0x105bea['limit'],_0x4db0cd;if(_0x1d496e>=_0x561131){_0x1d496e=_0x561131;_0x4db0cd=0xc8;}else{_0x4db0cd=0xce;}_0x1606ee[_0xfc5d('0x18')](_0x4db0cd);return _0x1606ee[_0xfc5d('0x1c')](_0xfc5d('0x1d'),_0x44d245+'-'+_0x1d496e+'/'+_0x561131)[_0xfc5d('0x19')](_0x1271c1);}return null;};}function patchUpdates(_0x396de4){return function(_0x4e6aa6){try{jsonpatch['apply'](_0x4e6aa6,_0x396de4,!![]);}catch(_0x4580d7){return BPromise['reject'](_0x4580d7);}return _0x4e6aa6['save']();};}function saveUpdates(_0x54ca7b,_0x2fe92b){return function(_0x59254c){if(_0x59254c){return _0x59254c[_0xfc5d('0x1e')](_0x54ca7b)['then'](function(_0x1e997c){return _0x1e997c;});}return null;};}function removeEntity(_0x252474,_0x43e7f2){return function(_0x269cc2){if(_0x269cc2){return _0x269cc2['destroy']()['then'](function(){_0x252474['status'](0xcc)[_0xfc5d('0x17')]();});}};}function handleEntityNotFound(_0x8c2b1b,_0x3c0ec4){return function(_0x4ce3dd){if(!_0x4ce3dd){_0x8c2b1b[_0xfc5d('0x16')](0x194);}return _0x4ce3dd;};}function handleError(_0x22eb5a,_0x37f692){_0x37f692=_0x37f692||0x1f4;return function(_0x250532){logger[_0xfc5d('0x1f')](_0x250532[_0xfc5d('0x20')]);if(_0x250532[_0xfc5d('0x21')]){delete _0x250532['name'];}_0x22eb5a['status'](_0x37f692)[_0xfc5d('0x22')](_0x250532);};}exports['index']=function(_0x581519,_0x1ecb16){var _0x5d4470={},_0x1c9fd7={},_0x29d36c={'count':0x0,'rows':[]};var _0x4e5b48=_[_0xfc5d('0x23')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x4714f0){return{'name':_0x4714f0[_0xfc5d('0x24')],'type':_0x4714f0[_0xfc5d('0x25')][_0xfc5d('0x26')]};});_0x1c9fd7[_0xfc5d('0x27')]=_[_0xfc5d('0x23')](_0x4e5b48,_0xfc5d('0x21'));_0x1c9fd7['query']=_[_0xfc5d('0x28')](_0x581519['query']);_0x1c9fd7[_0xfc5d('0x29')]=_[_0xfc5d('0x2a')](_0x1c9fd7['model'],_0x1c9fd7[_0xfc5d('0x2b')]);_0x5d4470[_0xfc5d('0x2c')]=_[_0xfc5d('0x2a')](_0x1c9fd7['model'],qs[_0xfc5d('0x2d')](_0x581519[_0xfc5d('0x2b')]['fields']));_0x5d4470[_0xfc5d('0x2c')]=_0x5d4470['attributes'][_0xfc5d('0x2e')]?_0x5d4470[_0xfc5d('0x2c')]:_0x1c9fd7[_0xfc5d('0x27')];if(!_0x581519[_0xfc5d('0x2b')][_0xfc5d('0x2f')](_0xfc5d('0x30'))){_0x5d4470[_0xfc5d('0x31')]=qs['limit'](_0x581519['query']['limit']);_0x5d4470['offset']=qs[_0xfc5d('0x1b')](_0x581519[_0xfc5d('0x2b')][_0xfc5d('0x1b')]);}_0x5d4470[_0xfc5d('0x32')]=qs['sort'](_0x581519['query'][_0xfc5d('0x33')]);_0x5d4470[_0xfc5d('0x34')]=qs[_0xfc5d('0x29')](_[_0xfc5d('0x35')](_0x581519['query'],_0x1c9fd7['filters']));if(_0x581519[_0xfc5d('0x2b')][_0xfc5d('0x36')]){_0x5d4470[_0xfc5d('0x34')]=_[_0xfc5d('0x37')](_0x5d4470[_0xfc5d('0x34')],{'$or':_[_0xfc5d('0x23')](_0x4e5b48,function(_0x215d53){if(_0x215d53[_0xfc5d('0x25')]!==_0xfc5d('0x38')){var _0x53438b={};_0x53438b[_0x215d53[_0xfc5d('0x21')]]={'$like':'%'+_0x581519[_0xfc5d('0x2b')]['filter']+'%'};return _0x53438b;}})});}_0x5d4470=_[_0xfc5d('0x37')]({},_0x5d4470,_0x581519[_0xfc5d('0x39')]);var _0x4db127={'where':_0x5d4470['where']};return db['JscriptyAnswerReport']['count'](_0x4db127)['then'](function(_0x158c7f){_0x29d36c['count']=_0x158c7f;if(_0x581519[_0xfc5d('0x2b')][_0xfc5d('0x3a')]){_0x5d4470['include']=[{'all':!![]}];}return db[_0xfc5d('0x3b')]['findAll'](_0x5d4470);})[_0xfc5d('0x3c')](function(_0x5c34b0){_0x29d36c[_0xfc5d('0x3d')]=_0x5c34b0;return _0x29d36c;})[_0xfc5d('0x3c')](respondWithFilteredResult(_0x1ecb16,_0x5d4470))[_0xfc5d('0x3e')](handleError(_0x1ecb16,null));};exports[_0xfc5d('0x3f')]=function(_0x493229,_0x607565){var _0x1f35fe={'raw':!![],'where':{'id':_0x493229[_0xfc5d('0x40')]['id']}},_0x192760={};_0x192760[_0xfc5d('0x27')]=_[_0xfc5d('0x28')](db['JscriptyAnswerReport']['rawAttributes']);_0x192760[_0xfc5d('0x2b')]=_[_0xfc5d('0x28')](_0x493229['query']);_0x192760[_0xfc5d('0x29')]=_[_0xfc5d('0x2a')](_0x192760[_0xfc5d('0x27')],_0x192760['query']);_0x1f35fe[_0xfc5d('0x2c')]=_[_0xfc5d('0x2a')](_0x192760[_0xfc5d('0x27')],qs[_0xfc5d('0x2d')](_0x493229[_0xfc5d('0x2b')][_0xfc5d('0x2d')]));_0x1f35fe[_0xfc5d('0x2c')]=_0x1f35fe[_0xfc5d('0x2c')][_0xfc5d('0x2e')]?_0x1f35fe['attributes']:_0x192760[_0xfc5d('0x27')];if(_0x493229['query']['includeAll']){_0x1f35fe[_0xfc5d('0x41')]=[{'all':!![]}];}_0x1f35fe=_[_0xfc5d('0x37')]({},_0x1f35fe,_0x493229[_0xfc5d('0x39')]);return db[_0xfc5d('0x3b')][_0xfc5d('0x42')](_0x1f35fe)[_0xfc5d('0x3c')](handleEntityNotFound(_0x607565,null))['then'](respondWithResult(_0x607565,null))[_0xfc5d('0x3e')](handleError(_0x607565,null));};exports[_0xfc5d('0x43')]=function(_0x3bc690,_0x501244){return db['JscriptyAnswerReport'][_0xfc5d('0x43')](_0x3bc690[_0xfc5d('0x44')],{})[_0xfc5d('0x3c')](respondWithResult(_0x501244,0xc9))[_0xfc5d('0x3e')](handleError(_0x501244,null));};exports[_0xfc5d('0x1e')]=function(_0xbd64f,_0x52dd8b){if(_0xbd64f[_0xfc5d('0x44')]['id']){delete _0xbd64f[_0xfc5d('0x44')]['id'];}return db[_0xfc5d('0x3b')][_0xfc5d('0x42')]({'where':{'id':_0xbd64f[_0xfc5d('0x40')]['id']}})['then'](handleEntityNotFound(_0x52dd8b,null))[_0xfc5d('0x3c')](saveUpdates(_0xbd64f[_0xfc5d('0x44')],null))[_0xfc5d('0x3c')](respondWithResult(_0x52dd8b,null))[_0xfc5d('0x3e')](handleError(_0x52dd8b,null));};exports['destroy']=function(_0x4a80bd,_0x39fdee){return db[_0xfc5d('0x3b')]['find']({'where':{'id':_0x4a80bd['params']['id']}})[_0xfc5d('0x3c')](handleEntityNotFound(_0x39fdee,null))[_0xfc5d('0x3c')](removeEntity(_0x39fdee,null))['catch'](handleError(_0x39fdee,null));};exports[_0xfc5d('0x45')]=function(_0x4a73dd,_0x522d0c){return db[_0xfc5d('0x3b')][_0xfc5d('0x45')]()[_0xfc5d('0x3c')](respondWithResult(_0x522d0c,null))['catch'](handleError(_0x522d0c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 9c1b26d..e82fcb8 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 _0x3faf=['api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0x3faf,0x1e7));var _0xf3fa=function(_0x5af034,_0x7f9293){_0x5af034=_0x5af034-0x0;var _0x508a11=_0x3faf[_0x5af034];return _0x508a11;};'use strict';var _=require(_0xf3fa('0x0'));var util=require(_0xf3fa('0x1'));var logger=require(_0xf3fa('0x2'))(_0xf3fa('0x3'));var moment=require('moment');var BPromise=require(_0xf3fa('0x4'));var rp=require(_0xf3fa('0x5'));var fs=require('fs');var path=require(_0xf3fa('0x6'));var rimraf=require(_0xf3fa('0x7'));var config=require(_0xf3fa('0x8'));var attributes=require(_0xf3fa('0x9'));module[_0xf3fa('0xa')]=function(_0x26f69a,_0x3cd0a2){return _0x26f69a[_0xf3fa('0xb')](_0xf3fa('0xc'),attributes,{'tableName':_0xf3fa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70df=['request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x70df,0xe5));var _0xf70d=function(_0x33694f,_0x2f2e93){_0x33694f=_0x33694f-0x0;var _0x1d05d1=_0x70df[_0x33694f];return _0x1d05d1;};'use strict';var _=require('lodash');var util=require(_0xf70d('0x0'));var logger=require(_0xf70d('0x1'))(_0xf70d('0x2'));var moment=require(_0xf70d('0x3'));var BPromise=require(_0xf70d('0x4'));var rp=require(_0xf70d('0x5'));var fs=require('fs');var path=require(_0xf70d('0x6'));var rimraf=require('rimraf');var config=require(_0xf70d('0x7'));var attributes=require(_0xf70d('0x8'));module[_0xf70d('0x9')]=function(_0x4cd1e0,_0x592e7e){return _0x4cd1e0[_0xf70d('0xa')](_0xf70d('0xb'),attributes,{'tableName':_0xf70d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 2dcc6ce..7eb9c6f 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 _0x2db6=['info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0xea6c20,_0x5a0de8){var _0x458655=function(_0x4afe96){while(--_0x4afe96){_0xea6c20['push'](_0xea6c20['shift']());}};_0x458655(++_0x5a0de8);}(_0x2db6,0x1cf));var _0x62db=function(_0x3a805c,_0x4660fe){_0x3a805c=_0x3a805c-0x0;var _0x7ea10e=_0x2db6[_0x3a805c];return _0x7ea10e;};'use strict';var _=require(_0x62db('0x0'));var util=require(_0x62db('0x1'));var moment=require(_0x62db('0x2'));var BPromise=require(_0x62db('0x3'));var rs=require(_0x62db('0x4'));var fs=require('fs');var Redis=require(_0x62db('0x5'));var db=require(_0x62db('0x6'))['db'];var utils=require(_0x62db('0x7'));var logger=require(_0x62db('0x8'))(_0x62db('0x9'));var config=require(_0x62db('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x62db('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf91e2f,_0x1d9ec,_0x5f02e4){return new BPromise(function(_0x1314f8,_0x33a06f){return client['request'](_0xf91e2f,_0x5f02e4)['then'](function(_0x280ebb){logger[_0x62db('0xc')](_0x62db('0xd'),_0x1d9ec,_0x62db('0xe'));logger[_0x62db('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x1d9ec,_0x62db('0xe'),JSON['stringify'](_0x280ebb));if(_0x280ebb[_0x62db('0x10')]){if(_0x280ebb[_0x62db('0x10')]['code']===0x1f4){logger[_0x62db('0x10')](_0x62db('0xd'),_0x1d9ec,_0x280ebb[_0x62db('0x10')][_0x62db('0x11')]);return _0x33a06f(_0x280ebb[_0x62db('0x10')]['message']);}logger[_0x62db('0x10')](_0x62db('0xd'),_0x1d9ec,_0x280ebb[_0x62db('0x10')]['message']);return _0x1314f8(_0x280ebb[_0x62db('0x10')][_0x62db('0x11')]);}else{logger[_0x62db('0xc')](_0x62db('0xd'),_0x1d9ec,_0x62db('0xe'));_0x1314f8(_0x280ebb['result'][_0x62db('0x11')]);}})[_0x62db('0x12')](function(_0x24b994){logger[_0x62db('0x10')](_0x62db('0xd'),_0x1d9ec,_0x24b994);_0x33a06f(_0x24b994);});});} \ No newline at end of file +var _0x7fea=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0x7fea,0x189));var _0xa7fe=function(_0x2dd023,_0x876f39){_0x2dd023=_0x2dd023-0x0;var _0x5d703b=_0x7fea[_0x2dd023];return _0x5d703b;};'use strict';var _=require(_0xa7fe('0x0'));var util=require(_0xa7fe('0x1'));var moment=require(_0xa7fe('0x2'));var BPromise=require('bluebird');var rs=require(_0xa7fe('0x3'));var fs=require('fs');var Redis=require(_0xa7fe('0x4'));var db=require(_0xa7fe('0x5'))['db'];var utils=require(_0xa7fe('0x6'));var logger=require('../../config/logger')(_0xa7fe('0x7'));var config=require(_0xa7fe('0x8'));var jayson=require(_0xa7fe('0x9'));var client=jayson[_0xa7fe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x250b4e,_0x1d5236,_0x508798){return new BPromise(function(_0x43824c,_0x136834){return client[_0xa7fe('0xb')](_0x250b4e,_0x508798)['then'](function(_0x452037){logger[_0xa7fe('0xc')](_0xa7fe('0xd'),_0x1d5236,_0xa7fe('0xe'));logger[_0xa7fe('0xf')](_0xa7fe('0x10'),_0x1d5236,_0xa7fe('0xe'),JSON[_0xa7fe('0x11')](_0x452037));if(_0x452037[_0xa7fe('0x12')]){if(_0x452037['error'][_0xa7fe('0x13')]===0x1f4){logger[_0xa7fe('0x12')](_0xa7fe('0xd'),_0x1d5236,_0x452037[_0xa7fe('0x12')][_0xa7fe('0x14')]);return _0x136834(_0x452037[_0xa7fe('0x12')][_0xa7fe('0x14')]);}logger[_0xa7fe('0x12')](_0xa7fe('0xd'),_0x1d5236,_0x452037['error'][_0xa7fe('0x14')]);return _0x43824c(_0x452037['error'][_0xa7fe('0x14')]);}else{logger[_0xa7fe('0xc')](_0xa7fe('0xd'),_0x1d5236,_0xa7fe('0xe'));_0x43824c(_0x452037['result'][_0xa7fe('0x14')]);}})[_0xa7fe('0x15')](function(_0x3d1f79){logger[_0xa7fe('0x12')](_0xa7fe('0xd'),_0x1d5236,_0x3d1f79);_0x136834(_0x3d1f79);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 76793c8..7d92abd 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 _0x9684=['../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','show','getSessions','/:id/answers','getAnswers','30s','create','post','clone','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x51380e,_0x55b897){var _0x2ed390=function(_0x217cfe){while(--_0x217cfe){_0x51380e['push'](_0x51380e['shift']());}};_0x2ed390(++_0x55b897);}(_0x9684,0x1bb));var _0x4968=function(_0x563d97,_0x2bdf70){_0x563d97=_0x563d97-0x0;var _0x569363=_0x9684[_0x563d97];return _0x569363;};'use strict';var multer=require(_0x4968('0x0'));var util=require(_0x4968('0x1'));var path=require(_0x4968('0x2'));var timeout=require(_0x4968('0x3'));var express=require(_0x4968('0x4'));var router=express[_0x4968('0x5')]();var auth=require(_0x4968('0x6'));var interaction=require(_0x4968('0x7'));var config=require(_0x4968('0x8'));var controller=require(_0x4968('0x9'));router['get']('/',auth[_0x4968('0xa')](),controller[_0x4968('0xb')]);router[_0x4968('0xc')]('/:id',auth[_0x4968('0xa')](),controller[_0x4968('0xd')]);router[_0x4968('0xc')]('/:id/sessions',auth[_0x4968('0xa')](),controller[_0x4968('0xe')]);router['get'](_0x4968('0xf'),auth['isAuthenticated'](),controller[_0x4968('0x10')]);router['get']('/:id/summary',auth['isAuthenticated'](),timeout(_0x4968('0x11')),controller['getSummary']);router['post']('/',auth[_0x4968('0xa')](),controller[_0x4968('0x12')]);router[_0x4968('0x13')]('/:id/clone',auth[_0x4968('0xa')](),controller[_0x4968('0x14')]);router['put']('/:id',auth[_0x4968('0xa')](),controller[_0x4968('0x15')]);router['delete'](_0x4968('0x16'),auth[_0x4968('0xa')](),controller[_0x4968('0x17')]);module[_0x4968('0x18')]=router; \ No newline at end of file +var _0x4d15=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','index','/:id','isAuthenticated','getSessions','/:id/answers','getAnswers','/:id/summary','30s','create','post','/:id/clone','clone','update','delete','destroy','exports','multer'];(function(_0x288417,_0x48f76d){var _0x5cb215=function(_0x15dc75){while(--_0x15dc75){_0x288417['push'](_0x288417['shift']());}};_0x5cb215(++_0x48f76d);}(_0x4d15,0x137));var _0x54d1=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4d15[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x54d1('0x0'));var util=require(_0x54d1('0x1'));var path=require(_0x54d1('0x2'));var timeout=require(_0x54d1('0x3'));var express=require(_0x54d1('0x4'));var router=express[_0x54d1('0x5')]();var auth=require(_0x54d1('0x6'));var interaction=require(_0x54d1('0x7'));var config=require('../../config/environment');var controller=require(_0x54d1('0x8'));router[_0x54d1('0x9')]('/',auth['isAuthenticated'](),controller[_0x54d1('0xa')]);router[_0x54d1('0x9')](_0x54d1('0xb'),auth[_0x54d1('0xc')](),controller['show']);router[_0x54d1('0x9')]('/:id/sessions',auth[_0x54d1('0xc')](),controller[_0x54d1('0xd')]);router[_0x54d1('0x9')](_0x54d1('0xe'),auth[_0x54d1('0xc')](),controller[_0x54d1('0xf')]);router['get'](_0x54d1('0x10'),auth['isAuthenticated'](),timeout(_0x54d1('0x11')),controller['getSummary']);router['post']('/',auth[_0x54d1('0xc')](),controller[_0x54d1('0x12')]);router[_0x54d1('0x13')](_0x54d1('0x14'),auth[_0x54d1('0xc')](),controller[_0x54d1('0x15')]);router['put'](_0x54d1('0xb'),auth['isAuthenticated'](),controller[_0x54d1('0x16')]);router[_0x54d1('0x17')](_0x54d1('0xb'),auth['isAuthenticated'](),controller[_0x54d1('0x18')]);module[_0x54d1('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index dfeb7ce..4432473 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 _0xf0f4=['isString','setDataValue','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','util','exports','STRING','name','TEXT','long','formData','stringify'];(function(_0x41dd01,_0x3287fe){var _0x1b2a58=function(_0x399d16){while(--_0x399d16){_0x41dd01['push'](_0x41dd01['shift']());}};_0x1b2a58(++_0x3287fe);}(_0xf0f4,0x139));var _0x4f0f=function(_0x13bdc8,_0x200640){_0x13bdc8=_0x13bdc8-0x0;var _0x8ab364=_0xf0f4[_0x13bdc8];return _0x8ab364;};'use strict';var Sequelize=require(_0x4f0f('0x0'));var _=require('lodash');var util=require(_0x4f0f('0x1'));module[_0x4f0f('0x2')]={'name':{'type':Sequelize[_0x4f0f('0x3')],'unique':_0x4f0f('0x4')},'description':{'type':Sequelize[_0x4f0f('0x3')]},'formData':{'type':Sequelize[_0x4f0f('0x5')](_0x4f0f('0x6')),'set':function(_0x2e378f){if(_['isObjectLike'](_0x2e378f)){this['setDataValue'](_0x4f0f('0x7'),JSON[_0x4f0f('0x8')](_0x2e378f));}else if(_[_0x4f0f('0x9')](_0x2e378f)){this[_0x4f0f('0xa')](_0x4f0f('0x7'),_0x2e378f);}else{this['setDataValue'](_0x4f0f('0x7'),util['format'](_0x4f0f('0xb'),this[_0x4f0f('0xc')](_0x4f0f('0x4'))||'',this[_0x4f0f('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4f0f('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x4f0f('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x3100=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','exports','STRING','name','long','isObjectLike','setDataValue','formData','stringify'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x3100,0x1ef));var _0x0310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3100[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var _=require(_0x0310('0x0'));var util=require('util');module[_0x0310('0x1')]={'name':{'type':Sequelize[_0x0310('0x2')],'unique':_0x0310('0x3')},'description':{'type':Sequelize[_0x0310('0x2')]},'formData':{'type':Sequelize['TEXT'](_0x0310('0x4')),'set':function(_0x128de7){if(_[_0x0310('0x5')](_0x128de7)){this[_0x0310('0x6')](_0x0310('0x7'),JSON[_0x0310('0x8')](_0x128de7));}else if(_['isString'](_0x128de7)){this['setDataValue'](_0x0310('0x7'),_0x128de7);}else{this['setDataValue']('formData',util[_0x0310('0x9')](_0x0310('0xa'),this['getDataValue'](_0x0310('0x3'))||'',this[_0x0310('0xb')](_0x0310('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x0310('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x0310('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 2c5a89e..fe09739 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 _0x6f3e=['keys','query','filters','intersection','attributes','fields','nolimit','limit','sort','filter','merge','type','VIRTUAL','name','where','count','include','findAll','params','rawAttributes','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Projects','UserProfileSection','find','userProfileId','clone','length','includeAll','createdAt','updatedAt','omit','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','findOne','order','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','hasOwnProperty','pick','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','stack','send','index','map','JscriptyProject','fieldName','key','model'];(function(_0x263cb4,_0x53ce57){var _0x32a04b=function(_0x31e87b){while(--_0x31e87b){_0x263cb4['push'](_0x263cb4['shift']());}};_0x32a04b(++_0x53ce57);}(_0x6f3e,0xbb));var _0xe6f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6f3e[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe6f3('0x0'));var rimraf=require(_0xe6f3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe6f3('0x2'));var moment=require(_0xe6f3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe6f3('0x4'));var util=require(_0xe6f3('0x5'));var path=require(_0xe6f3('0x6'));var sox=require(_0xe6f3('0x7'));var csv=require('to-csv');var ejs=require(_0xe6f3('0x8'));var fs=require('fs');var _=require(_0xe6f3('0x9'));var squel=require(_0xe6f3('0xa'));var crypto=require(_0xe6f3('0xb'));var jsforce=require(_0xe6f3('0xc'));var deskjs=require(_0xe6f3('0xd'));var toCsv=require(_0xe6f3('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe6f3('0xf'));var authService=require(_0xe6f3('0x10'));var qs=require(_0xe6f3('0x11'));var as=require(_0xe6f3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe6f3('0x13'))(_0xe6f3('0x14'));var utils=require(_0xe6f3('0x15'));var config=require(_0xe6f3('0x16'));var db=require(_0xe6f3('0x17'))['db'];function respondWithStatusCode(_0x280f5e,_0x90234d){_0x90234d=_0x90234d||0xcc;return function(_0x2533b7){if(_0x2533b7){return _0x280f5e['sendStatus'](_0x90234d);}return _0x280f5e[_0xe6f3('0x18')](_0x90234d)[_0xe6f3('0x19')]();};}function respondWithResult(_0x20cf7f,_0x512116){_0x512116=_0x512116||0xc8;return function(_0x2282d9){if(_0x2282d9){return _0x20cf7f['status'](_0x512116)[_0xe6f3('0x1a')](_0x2282d9);}};}function respondWithFilteredResult(_0xe9dd49,_0x11ca67){return function(_0x5f14b4){if(_0x5f14b4){var _0x4dd7ed=_0x5f14b4['count'],_0x383440=_0x11ca67[_0xe6f3('0x1b')],_0x4462fc=_0x11ca67[_0xe6f3('0x1b')]+_0x11ca67['limit'],_0x5ef1df;if(_0x4462fc>=_0x4dd7ed){_0x4462fc=_0x4dd7ed;_0x5ef1df=0xc8;}else{_0x5ef1df=0xce;}_0xe9dd49[_0xe6f3('0x18')](_0x5ef1df);return _0xe9dd49['set'](_0xe6f3('0x1c'),_0x383440+'-'+_0x4462fc+'/'+_0x4dd7ed)['json'](_0x5f14b4);}return null;};}function patchUpdates(_0x5e1218){return function(_0xb0d43e){try{jsonpatch[_0xe6f3('0x1d')](_0xb0d43e,_0x5e1218,!![]);}catch(_0x20fb02){return BPromise[_0xe6f3('0x1e')](_0x20fb02);}return _0xb0d43e[_0xe6f3('0x1f')]();};}function saveUpdates(_0x507507,_0x43566e){return function(_0x36e48f){if(_0x36e48f){return _0x36e48f['update'](_0x507507)[_0xe6f3('0x20')](function(_0x560c55){return _0x560c55;});}return null;};}function removeEntity(_0x5492ce,_0x10bc26){return function(_0x51d400){if(_0x51d400){return _0x51d400[_0xe6f3('0x21')]()[_0xe6f3('0x20')](function(){var _0x4653b5=_0x51d400[_0xe6f3('0x22')]({'plain':!![]});var _0x31cf01='Projects';return db[_0xe6f3('0x23')][_0xe6f3('0x21')]({'where':{'type':_0x31cf01,'resourceId':_0x4653b5['id']}})[_0xe6f3('0x20')](function(){return _0x51d400;});})[_0xe6f3('0x20')](function(){_0x5492ce['status'](0xcc)[_0xe6f3('0x19')]();});}};}function handleEntityNotFound(_0x357d19,_0x295831){return function(_0x5a9ad9){if(!_0x5a9ad9){_0x357d19[_0xe6f3('0x24')](0x194);}return _0x5a9ad9;};}function handleError(_0x588829,_0x40fc83){_0x40fc83=_0x40fc83||0x1f4;return function(_0x41ec6e){logger['error'](_0x41ec6e[_0xe6f3('0x25')]);if(_0x41ec6e['name']){delete _0x41ec6e['name'];}_0x588829[_0xe6f3('0x18')](_0x40fc83)[_0xe6f3('0x26')](_0x41ec6e);};}exports[_0xe6f3('0x27')]=function(_0x562c54,_0x503c32){var _0x394675={},_0x4460d2={},_0x362173={'count':0x0,'rows':[]};var _0x152ea9=_[_0xe6f3('0x28')](db[_0xe6f3('0x29')]['rawAttributes'],function(_0x484ce2){return{'name':_0x484ce2[_0xe6f3('0x2a')],'type':_0x484ce2['type'][_0xe6f3('0x2b')]};});_0x4460d2[_0xe6f3('0x2c')]=_[_0xe6f3('0x28')](_0x152ea9,'name');_0x4460d2['query']=_[_0xe6f3('0x2d')](_0x562c54[_0xe6f3('0x2e')]);_0x4460d2[_0xe6f3('0x2f')]=_[_0xe6f3('0x30')](_0x4460d2[_0xe6f3('0x2c')],_0x4460d2[_0xe6f3('0x2e')]);_0x394675[_0xe6f3('0x31')]=_[_0xe6f3('0x30')](_0x4460d2[_0xe6f3('0x2c')],qs['fields'](_0x562c54[_0xe6f3('0x2e')][_0xe6f3('0x32')]));_0x394675[_0xe6f3('0x31')]=_0x394675[_0xe6f3('0x31')]['length']?_0x394675['attributes']:_0x4460d2[_0xe6f3('0x2c')];if(!_0x562c54[_0xe6f3('0x2e')]['hasOwnProperty'](_0xe6f3('0x33'))){_0x394675[_0xe6f3('0x34')]=qs[_0xe6f3('0x34')](_0x562c54['query'][_0xe6f3('0x34')]);_0x394675[_0xe6f3('0x1b')]=qs['offset'](_0x562c54[_0xe6f3('0x2e')][_0xe6f3('0x1b')]);}_0x394675['order']=qs['sort'](_0x562c54['query'][_0xe6f3('0x35')]);_0x394675['where']=qs[_0xe6f3('0x2f')](_['pick'](_0x562c54[_0xe6f3('0x2e')],_0x4460d2[_0xe6f3('0x2f')]));if(_0x562c54['query'][_0xe6f3('0x36')]){_0x394675['where']=_[_0xe6f3('0x37')](_0x394675['where'],{'$or':_['map'](_0x152ea9,function(_0x4fd55c){if(_0x4fd55c[_0xe6f3('0x38')]!==_0xe6f3('0x39')){var _0x20db47={};_0x20db47[_0x4fd55c[_0xe6f3('0x3a')]]={'$like':'%'+_0x562c54[_0xe6f3('0x2e')]['filter']+'%'};return _0x20db47;}})});}_0x394675=_[_0xe6f3('0x37')]({},_0x394675,_0x562c54['options']);var _0x488509={'where':_0x394675[_0xe6f3('0x3b')]};return db['JscriptyProject'][_0xe6f3('0x3c')](_0x488509)[_0xe6f3('0x20')](function(_0x4ad9c0){_0x362173[_0xe6f3('0x3c')]=_0x4ad9c0;if(_0x562c54[_0xe6f3('0x2e')]['includeAll']){_0x394675[_0xe6f3('0x3d')]=[{'all':!![]}];}return db[_0xe6f3('0x29')][_0xe6f3('0x3e')](_0x394675);})['then'](function(_0x120001){_0x362173['rows']=_0x120001;return _0x362173;})[_0xe6f3('0x20')](respondWithFilteredResult(_0x503c32,_0x394675))['catch'](handleError(_0x503c32,null));};exports['show']=function(_0x22c605,_0x51fde5){var _0x47093d={'raw':![],'where':{'id':_0x22c605[_0xe6f3('0x3f')]['id']}},_0x10a337={};_0x10a337['model']=_[_0xe6f3('0x2d')](db[_0xe6f3('0x29')][_0xe6f3('0x40')]);_0x10a337[_0xe6f3('0x2e')]=_[_0xe6f3('0x2d')](_0x22c605[_0xe6f3('0x2e')]);_0x10a337['filters']=_[_0xe6f3('0x30')](_0x10a337['model'],_0x10a337['query']);_0x47093d[_0xe6f3('0x31')]=_['intersection'](_0x10a337[_0xe6f3('0x2c')],qs['fields'](_0x22c605[_0xe6f3('0x2e')][_0xe6f3('0x32')]));_0x47093d[_0xe6f3('0x31')]=_0x47093d[_0xe6f3('0x31')]['length']?_0x47093d[_0xe6f3('0x31')]:_0x10a337[_0xe6f3('0x2c')];if(_0x22c605[_0xe6f3('0x2e')]['includeAll']){_0x47093d[_0xe6f3('0x3d')]=[{'all':!![]}];}_0x47093d=_[_0xe6f3('0x37')]({},_0x47093d,_0x22c605[_0xe6f3('0x41')]);return db[_0xe6f3('0x29')]['find'](_0x47093d)[_0xe6f3('0x20')](handleEntityNotFound(_0x51fde5,null))[_0xe6f3('0x20')](respondWithResult(_0x51fde5,null))[_0xe6f3('0x42')](handleError(_0x51fde5,null));};exports['create']=function(_0xc31607,_0x550c3c){return db[_0xe6f3('0x29')][_0xe6f3('0x43')](_0xc31607[_0xe6f3('0x44')],{})['then'](function(_0x523af3){var _0x4111cb=_0xc31607['user'][_0xe6f3('0x22')]({'plain':!![]});if(!_0x4111cb)throw new Error(_0xe6f3('0x45'));if(_0x4111cb[_0xe6f3('0x46')]===_0xe6f3('0x47')){var _0x3f6ba8=_0x523af3[_0xe6f3('0x22')]({'plain':!![]});var _0x37f878=_0xe6f3('0x48');return db[_0xe6f3('0x49')][_0xe6f3('0x4a')]({'where':{'name':_0x37f878,'userProfileId':_0x4111cb[_0xe6f3('0x4b')]},'raw':!![]})[_0xe6f3('0x20')](function(_0x4a215d){if(_0x4a215d&&_0x4a215d['autoAssociation']===0x0){return db[_0xe6f3('0x23')][_0xe6f3('0x43')]({'name':_0x3f6ba8[_0xe6f3('0x3a')],'resourceId':_0x3f6ba8['id'],'type':_0x4a215d[_0xe6f3('0x3a')],'sectionId':_0x4a215d['id']},{})[_0xe6f3('0x20')](function(){return _0x523af3;});}else{return _0x523af3;}})[_0xe6f3('0x42')](function(_0x2de3c7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2de3c7);throw _0x2de3c7;});}return _0x523af3;})['then'](respondWithResult(_0x550c3c,0xc9))[_0xe6f3('0x42')](handleError(_0x550c3c,null));};exports[_0xe6f3('0x4c')]=function(_0xe7eb3a,_0x23b71e){var _0x32ce2c={'where':{'id':_0xe7eb3a[_0xe6f3('0x3f')]['id']}},_0x788bd={};_0x788bd['model']=_[_0xe6f3('0x2d')](db[_0xe6f3('0x29')][_0xe6f3('0x40')]);_0x32ce2c[_0xe6f3('0x31')]=_[_0xe6f3('0x30')](_0x788bd[_0xe6f3('0x2c')],qs['fields'](_0xe7eb3a['query'][_0xe6f3('0x32')]));_0x32ce2c[_0xe6f3('0x31')]=_0x32ce2c['attributes'][_0xe6f3('0x4d')]?_0x32ce2c[_0xe6f3('0x31')]:_0x788bd[_0xe6f3('0x2c')];if(_0xe7eb3a['query'][_0xe6f3('0x4e')]){_0x32ce2c[_0xe6f3('0x3d')]=[{'all':!![]}];}_0x32ce2c=_[_0xe6f3('0x37')]({},_0x32ce2c,_0xe7eb3a[_0xe6f3('0x41')]);return db['JscriptyProject'][_0xe6f3('0x4a')](_0x32ce2c)['then'](handleEntityNotFound(_0x23b71e,null))[_0xe6f3('0x20')](function(_0x445515){if(_0x445515){var _0x32ac32=_0x445515['get']({'plain':!![]});_0x32ac32=qs['omit'](_0x32ac32,['id',_0xe6f3('0x4f'),_0xe6f3('0x50')]);_0xe7eb3a['body']=_[_0xe6f3('0x51')](_0xe7eb3a[_0xe6f3('0x44')],['id','createdAt',_0xe6f3('0x50')]);return db[_0xe6f3('0x29')][_0xe6f3('0x43')](_[_0xe6f3('0x37')](_0x32ac32,_0xe7eb3a['body']),{'include':_0xe7eb3a[_0xe6f3('0x2e')][_0xe6f3('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x40554a){var _0x3d042c=_0xe7eb3a[_0xe6f3('0x47')][_0xe6f3('0x22')]({'plain':!![]});if(!_0x3d042c)throw new Error(_0xe6f3('0x45'));if(_0x3d042c[_0xe6f3('0x46')]==='user'){var _0x3ea3c1=_0x40554a['get']({'plain':!![]});var _0x4571e2=_0xe6f3('0x48');return db[_0xe6f3('0x49')]['find']({'where':{'name':_0x4571e2,'userProfileId':_0x3d042c['userProfileId']},'raw':!![]})[_0xe6f3('0x20')](function(_0x15ba85){if(_0x15ba85&&_0x15ba85['autoAssociation']===0x0){return db[_0xe6f3('0x23')][_0xe6f3('0x43')]({'name':_0x3ea3c1[_0xe6f3('0x3a')],'resourceId':_0x3ea3c1['id'],'type':_0x15ba85[_0xe6f3('0x3a')],'sectionId':_0x15ba85['id']},{})['then'](function(){return _0x40554a;});}else{return _0x40554a;}})[_0xe6f3('0x42')](function(_0xfb1985){logger['error'](_0xe6f3('0x52'),_0xfb1985);throw _0xfb1985;});}return _0x40554a;});}})['then'](respondWithResult(_0x23b71e,0xc9))[_0xe6f3('0x42')](handleError(_0x23b71e,null));};exports[_0xe6f3('0x53')]=function(_0x16ba74,_0x4f28e5){if(_0x16ba74[_0xe6f3('0x44')]['id']){delete _0x16ba74[_0xe6f3('0x44')]['id'];}return db[_0xe6f3('0x29')][_0xe6f3('0x4a')]({'where':{'id':_0x16ba74['params']['id']}})[_0xe6f3('0x20')](handleEntityNotFound(_0x4f28e5,null))[_0xe6f3('0x20')](saveUpdates(_0x16ba74['body'],null))[_0xe6f3('0x20')](respondWithResult(_0x4f28e5,null))[_0xe6f3('0x42')](handleError(_0x4f28e5,null));};exports['destroy']=function(_0x4faf2f,_0x273782){return db[_0xe6f3('0x29')][_0xe6f3('0x4a')]({'where':{'id':_0x4faf2f[_0xe6f3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x273782,null))[_0xe6f3('0x20')](removeEntity(_0x273782,null))[_0xe6f3('0x42')](handleError(_0x273782,null));};exports[_0xe6f3('0x54')]=function(_0xf9a692,_0x222446,_0x59c300){var _0x2b7dba={'raw':!![],'where':{}};var _0xdf08db={};var _0x4af7c3={'count':0x0,'rows':[]};return db[_0xe6f3('0x29')][_0xe6f3('0x55')]({'where':{'id':_0xf9a692['params']['id']}})[_0xe6f3('0x20')](handleEntityNotFound(_0x222446,null))[_0xe6f3('0x20')](function(_0x2ff43d){if(_0x2ff43d){_0xdf08db['model']=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0xdf08db[_0xe6f3('0x2e')]=_[_0xe6f3('0x2d')](_0xf9a692[_0xe6f3('0x2e')]);_0xdf08db['filters']=_[_0xe6f3('0x30')](_0xdf08db[_0xe6f3('0x2c')],_0xdf08db[_0xe6f3('0x2e')]);_0x2b7dba[_0xe6f3('0x31')]=_[_0xe6f3('0x30')](_0xdf08db[_0xe6f3('0x2c')],qs['fields'](_0xf9a692['query'][_0xe6f3('0x32')]));_0x2b7dba[_0xe6f3('0x31')]=_0x2b7dba[_0xe6f3('0x31')][_0xe6f3('0x4d')]?_0x2b7dba[_0xe6f3('0x31')]:_0xdf08db[_0xe6f3('0x2c')];if(!_0xf9a692[_0xe6f3('0x2e')]['hasOwnProperty'](_0xe6f3('0x33'))){_0x2b7dba[_0xe6f3('0x34')]=qs[_0xe6f3('0x34')](_0xf9a692['query']['limit']);_0x2b7dba[_0xe6f3('0x1b')]=qs[_0xe6f3('0x1b')](_0xf9a692[_0xe6f3('0x2e')]['offset']);}_0x2b7dba[_0xe6f3('0x56')]=qs[_0xe6f3('0x35')](_0xf9a692[_0xe6f3('0x2e')][_0xe6f3('0x35')]);_0x2b7dba['where']=qs[_0xe6f3('0x2f')](_['pick'](_0xf9a692['query'],_0xdf08db['filters']));_0x2b7dba[_0xe6f3('0x3b')][_0xe6f3('0x57')]=_0x2ff43d['id'];if(_0xf9a692[_0xe6f3('0x2e')][_0xe6f3('0x36')]){_0x2b7dba[_0xe6f3('0x3b')]=_[_0xe6f3('0x37')](_0x2b7dba[_0xe6f3('0x3b')],{'$or':_[_0xe6f3('0x28')](_0x2b7dba[_0xe6f3('0x31')],function(_0x289bdc){var _0x227011={};_0x227011[_0x289bdc]={'$like':'%'+_0xf9a692[_0xe6f3('0x2e')]['filter']+'%'};return _0x227011;})});}_0x2b7dba=_[_0xe6f3('0x37')]({},_0x2b7dba,_0xf9a692['options']);return db[_0xe6f3('0x58')][_0xe6f3('0x3c')]({'where':_0x2b7dba[_0xe6f3('0x3b')]})[_0xe6f3('0x20')](function(_0xf982dc){_0x4af7c3[_0xe6f3('0x3c')]=_0xf982dc;if(_0xf9a692['query'][_0xe6f3('0x4e')]){_0x2b7dba['include']=[{'all':!![]}];}return db[_0xe6f3('0x58')][_0xe6f3('0x3e')](_0x2b7dba);})[_0xe6f3('0x20')](function(_0x538c25){_0x4af7c3['rows']=_0x538c25;return _0x4af7c3;});}})['then'](respondWithFilteredResult(_0x222446,_0x2b7dba))[_0xe6f3('0x42')](handleError(_0x222446,null));};exports[_0xe6f3('0x59')]=function(_0x2440bb,_0x3a390b,_0x3cb73b){var _0x556f3c={'raw':!![],'where':{}};var _0x103727={};var _0x1ab189={'count':0x0,'rows':[]};return db[_0xe6f3('0x29')][_0xe6f3('0x55')]({'where':{'id':_0x2440bb[_0xe6f3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3a390b,null))['then'](function(_0x4a5434){if(_0x4a5434){_0x103727[_0xe6f3('0x2c')]=_[_0xe6f3('0x2d')](db[_0xe6f3('0x5a')][_0xe6f3('0x40')]);_0x103727[_0xe6f3('0x2e')]=_[_0xe6f3('0x2d')](_0x2440bb[_0xe6f3('0x2e')]);_0x103727[_0xe6f3('0x2f')]=_[_0xe6f3('0x30')](_0x103727[_0xe6f3('0x2c')],_0x103727[_0xe6f3('0x2e')]);_0x556f3c[_0xe6f3('0x31')]=_[_0xe6f3('0x30')](_0x103727['model'],qs[_0xe6f3('0x32')](_0x2440bb[_0xe6f3('0x2e')][_0xe6f3('0x32')]));_0x556f3c[_0xe6f3('0x31')]=_0x556f3c[_0xe6f3('0x31')][_0xe6f3('0x4d')]?_0x556f3c['attributes']:_0x103727[_0xe6f3('0x2c')];if(!_0x2440bb[_0xe6f3('0x2e')][_0xe6f3('0x5b')](_0xe6f3('0x33'))){_0x556f3c[_0xe6f3('0x34')]=qs[_0xe6f3('0x34')](_0x2440bb['query'][_0xe6f3('0x34')]);_0x556f3c[_0xe6f3('0x1b')]=qs['offset'](_0x2440bb[_0xe6f3('0x2e')]['offset']);}_0x556f3c[_0xe6f3('0x56')]=qs['sort'](_0x2440bb[_0xe6f3('0x2e')][_0xe6f3('0x35')]);_0x556f3c[_0xe6f3('0x3b')]=qs['filters'](_[_0xe6f3('0x5c')](_0x2440bb[_0xe6f3('0x2e')],_0x103727[_0xe6f3('0x2f')]));_0x556f3c[_0xe6f3('0x3b')][_0xe6f3('0x57')]=_0x4a5434['id'];if(_0x2440bb[_0xe6f3('0x2e')]['filter']){_0x556f3c[_0xe6f3('0x3b')]=_[_0xe6f3('0x37')](_0x556f3c[_0xe6f3('0x3b')],{'$or':_['map'](_0x556f3c[_0xe6f3('0x31')],function(_0x53484f){var _0x54debf={};_0x54debf[_0x53484f]={'$like':'%'+_0x2440bb['query'][_0xe6f3('0x36')]+'%'};return _0x54debf;})});}_0x556f3c=_[_0xe6f3('0x37')]({},_0x556f3c,_0x2440bb['options']);return db['JscriptyAnswerReport'][_0xe6f3('0x3c')]({'where':_0x556f3c[_0xe6f3('0x3b')]})[_0xe6f3('0x20')](function(_0x49413c){_0x1ab189['count']=_0x49413c;if(_0x2440bb['query'][_0xe6f3('0x4e')]){_0x556f3c['include']=[{'all':!![]}];}return db[_0xe6f3('0x5a')][_0xe6f3('0x3e')](_0x556f3c);})[_0xe6f3('0x20')](function(_0x446518){_0x1ab189['rows']=_0x446518;return _0x1ab189;});}})[_0xe6f3('0x20')](respondWithFilteredResult(_0x3a390b,_0x556f3c))[_0xe6f3('0x42')](handleError(_0x3a390b,null));};function char(_0x236de7){return _0xe6f3('0x5d')===typeof _0x236de7?String[_0xe6f3('0x5e')][_0xe6f3('0x1d')](null,arguments):_0x236de7;}function needsEncapsulation(_0x5343ea){return!!_0x5343ea&&(_0x5343ea['toString']()[_0xe6f3('0x5f')](char(0xd))>=0x0||_0x5343ea['toString']()[_0xe6f3('0x5f')](char(0xa))>=0x0||_0x5343ea[_0xe6f3('0x60')]()[_0xe6f3('0x5f')](char(0x2c))>=0x0||_0x5343ea['toString']()[_0xe6f3('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x3264b1){var _0x1d22ba=char(0x22),_0x11a790='\x5c'+char(0x22),_0x4db040=_0x3264b1[_0xe6f3('0x60')]()[_0xe6f3('0x61')](new RegExp(_0x1d22ba,'g'),_0x11a790);return _0x1d22ba+_0x4db040+_0x1d22ba;}exports[_0xe6f3('0x62')]=function(_0x47e662,_0x4db7ec,_0x334877){var _0x1bf8be,_0x22e2ac;var _0x2ebf0d={'where':{'ProjectId':_0x47e662[_0xe6f3('0x3f')]['id']}};if(_0x47e662[_0xe6f3('0x2e')][_0xe6f3('0x63')]){_0x2ebf0d[_0xe6f3('0x3b')][_0xe6f3('0x64')]=JSON['parse'](_0x47e662[_0xe6f3('0x2e')][_0xe6f3('0x63')]);}return db[_0xe6f3('0x58')][_0xe6f3('0x3e')](_0x2ebf0d)['then'](handleEntityNotFound(_0x4db7ec,null))['then'](function(_0x2ebe59){if(_0x2ebe59){_0x1bf8be=_0x2ebe59;return db['JscriptyQuestionReport'][_0xe6f3('0x3e')]({'where':{'SessionId':{'$in':_['map'](_0x1bf8be,'id')},'ProjectId':_0x47e662[_0xe6f3('0x3f')]['id']},'order':_0xe6f3('0x65')});}})[_0xe6f3('0x20')](handleEntityNotFound(_0x4db7ec,null))[_0xe6f3('0x20')](function(_0x44e128){if(_0x44e128){_0x22e2ac=_0x44e128;var _0x16e60e={};for(var _0xb7543=0x0,_0x1b7bbf=_0x22e2ac[_0xe6f3('0x4d')];_0xb7543<_0x1b7bbf;_0xb7543++){if(!_0x16e60e[_0xe6f3('0x5b')](_0x22e2ac[_0xb7543]['questionId'])){_0x16e60e[_0x22e2ac[_0xb7543][_0xe6f3('0x66')]]=needsEncapsulation(_0x22e2ac[_0xb7543][_0xe6f3('0x67')])?encapsulate(_0x22e2ac[_0xb7543][_0xe6f3('0x67')]):_0x22e2ac[_0xb7543][_0xe6f3('0x67')];}}var _0x42768b=[],_0x468840={};for(var _0x390186=0x0,_0x118cae=_0x1bf8be[_0xe6f3('0x4d')];_0x390186<_0x118cae;_0x390186++){_0x468840={'ProjectId':_0x47e662[_0xe6f3('0x3f')]['id'],'SessionId':_0x1bf8be[_0x390186]['id'],'StartTime':moment(_0x1bf8be[_0x390186]['starttime'])['format'](_0xe6f3('0x68'))};for(var _0x15c092=0x0,_0xd9952f=_0x22e2ac[_0xe6f3('0x4d')];_0x15c092<_0xd9952f;_0x15c092++){if(_0x22e2ac[_0x15c092]['SessionId']==_0x1bf8be[_0x390186]['id']&&_0x16e60e[_0xe6f3('0x5b')](_0x22e2ac[_0x15c092][_0xe6f3('0x66')])){_0x468840[_0x16e60e[_0x22e2ac[_0x15c092][_0xe6f3('0x66')]]]=_0x22e2ac[_0x15c092]['answer'];}}for(var _0x5d8549 in _0x16e60e){if(!_0x468840[_0xe6f3('0x5b')](_0x16e60e[_0x5d8549])){_0x468840[_0x16e60e[_0x5d8549]]=null;}}_0x42768b[_0xe6f3('0x69')](_0x468840);}return _0x42768b;}})[_0xe6f3('0x20')](function(_0x4a74b5){if(!_[_0xe6f3('0x6a')](_0x4a74b5)){var _0x546e4c=toCsv(_0x4a74b5);var _0x562a7e=Date['now']();fs[_0xe6f3('0x6b')](util[_0xe6f3('0x6c')](_0xe6f3('0x6d'),_0x47e662[_0xe6f3('0x3f')]['id'],_0x562a7e),_0x546e4c);_0x4db7ec[_0xe6f3('0x6e')](_0xe6f3('0x6f'),_0xe6f3('0x70')+util['format'](_0xe6f3('0x71'),_0x47e662[_0xe6f3('0x3f')]['id'],_0x562a7e));_0x4db7ec['setHeader'](_0xe6f3('0x72'),'text/csv');return _0x4db7ec[_0xe6f3('0x73')](util[_0xe6f3('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x47e662[_0xe6f3('0x3f')]['id'],_0x562a7e));}else{return _0x4db7ec[_0xe6f3('0x24')](0xcc);}})[_0xe6f3('0x42')](handleError(_0x4db7ec,null));}; \ No newline at end of file +var _0x686d=['toString','indexOf','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','html-pdf','eml-format','request-promise','moment','util','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','get','Projects','UserProfileResource','destroy','error','name','send','index','map','JscriptyProject','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','keys','find','catch','create','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','body','getSessions','JscriptySessionReport','pick','getAnswers','findOne','JscriptyAnswerReport','ProjectId','number','fromCharCode'];(function(_0xbeb48f,_0x209f51){var _0x155f78=function(_0x4e5965){while(--_0x4e5965){_0xbeb48f['push'](_0xbeb48f['shift']());}};_0x155f78(++_0x209f51);}(_0x686d,0x172));var _0xd686=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0x686d[_0x4a5494];return _0x57cbb5;};'use strict';var pdf=require(_0xd686('0x0'));var emlformat=require(_0xd686('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd686('0x2'));var moment=require(_0xd686('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd686('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xd686('0x5'));var ejs=require(_0xd686('0x6'));var fs=require('fs');var _=require(_0xd686('0x7'));var squel=require(_0xd686('0x8'));var crypto=require('crypto');var jsforce=require(_0xd686('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xd686('0x5'));var querystring=require(_0xd686('0xa'));var Papa=require(_0xd686('0xb'));var Redis=require(_0xd686('0xc'));var authService=require(_0xd686('0xd'));var qs=require(_0xd686('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd686('0xf'));var logger=require(_0xd686('0x10'))(_0xd686('0x11'));var utils=require(_0xd686('0x12'));var config=require('../../config/environment');var db=require(_0xd686('0x13'))['db'];function respondWithStatusCode(_0x1589c1,_0x4f12f7){_0x4f12f7=_0x4f12f7||0xcc;return function(_0x2b840b){if(_0x2b840b){return _0x1589c1[_0xd686('0x14')](_0x4f12f7);}return _0x1589c1[_0xd686('0x15')](_0x4f12f7)[_0xd686('0x16')]();};}function respondWithResult(_0x1c6505,_0x192213){_0x192213=_0x192213||0xc8;return function(_0x491d87){if(_0x491d87){return _0x1c6505[_0xd686('0x15')](_0x192213)[_0xd686('0x17')](_0x491d87);}};}function respondWithFilteredResult(_0x298096,_0x115c4a){return function(_0x535e3c){if(_0x535e3c){var _0x11aa5a=_0x535e3c[_0xd686('0x18')],_0x4fc999=_0x115c4a[_0xd686('0x19')],_0x4a0126=_0x115c4a[_0xd686('0x19')]+_0x115c4a[_0xd686('0x1a')],_0x4a3b67;if(_0x4a0126>=_0x11aa5a){_0x4a0126=_0x11aa5a;_0x4a3b67=0xc8;}else{_0x4a3b67=0xce;}_0x298096[_0xd686('0x15')](_0x4a3b67);return _0x298096['set'](_0xd686('0x1b'),_0x4fc999+'-'+_0x4a0126+'/'+_0x11aa5a)[_0xd686('0x17')](_0x535e3c);}return null;};}function patchUpdates(_0x32553e){return function(_0x527589){try{jsonpatch[_0xd686('0x1c')](_0x527589,_0x32553e,!![]);}catch(_0xd83ed){return BPromise[_0xd686('0x1d')](_0xd83ed);}return _0x527589[_0xd686('0x1e')]();};}function saveUpdates(_0x5a4a2f,_0x201e80){return function(_0x5dad15){if(_0x5dad15){return _0x5dad15[_0xd686('0x1f')](_0x5a4a2f)[_0xd686('0x20')](function(_0x52f9f8){return _0x52f9f8;});}return null;};}function removeEntity(_0x316dd8,_0x585695){return function(_0x4d3f72){if(_0x4d3f72){return _0x4d3f72['destroy']()['then'](function(){var _0x37409a=_0x4d3f72[_0xd686('0x21')]({'plain':!![]});var _0x5eff04=_0xd686('0x22');return db[_0xd686('0x23')][_0xd686('0x24')]({'where':{'type':_0x5eff04,'resourceId':_0x37409a['id']}})[_0xd686('0x20')](function(){return _0x4d3f72;});})[_0xd686('0x20')](function(){_0x316dd8[_0xd686('0x15')](0xcc)[_0xd686('0x16')]();});}};}function handleEntityNotFound(_0xb70315,_0xd08629){return function(_0x2c208f){if(!_0x2c208f){_0xb70315[_0xd686('0x14')](0x194);}return _0x2c208f;};}function handleError(_0x35008f,_0x1fe205){_0x1fe205=_0x1fe205||0x1f4;return function(_0x548737){logger[_0xd686('0x25')](_0x548737['stack']);if(_0x548737[_0xd686('0x26')]){delete _0x548737['name'];}_0x35008f['status'](_0x1fe205)[_0xd686('0x27')](_0x548737);};}exports[_0xd686('0x28')]=function(_0x476d69,_0x5495ca){var _0x2f90fb={},_0x17ff8f={},_0x1035db={'count':0x0,'rows':[]};var _0x1ffca3=_[_0xd686('0x29')](db[_0xd686('0x2a')]['rawAttributes'],function(_0x5419df){return{'name':_0x5419df[_0xd686('0x2b')],'type':_0x5419df[_0xd686('0x2c')][_0xd686('0x2d')]};});_0x17ff8f[_0xd686('0x2e')]=_[_0xd686('0x29')](_0x1ffca3,_0xd686('0x26'));_0x17ff8f[_0xd686('0x2f')]=_['keys'](_0x476d69[_0xd686('0x2f')]);_0x17ff8f[_0xd686('0x30')]=_[_0xd686('0x31')](_0x17ff8f['model'],_0x17ff8f['query']);_0x2f90fb[_0xd686('0x32')]=_['intersection'](_0x17ff8f[_0xd686('0x2e')],qs[_0xd686('0x33')](_0x476d69[_0xd686('0x2f')]['fields']));_0x2f90fb[_0xd686('0x32')]=_0x2f90fb['attributes'][_0xd686('0x34')]?_0x2f90fb[_0xd686('0x32')]:_0x17ff8f[_0xd686('0x2e')];if(!_0x476d69[_0xd686('0x2f')][_0xd686('0x35')](_0xd686('0x36'))){_0x2f90fb[_0xd686('0x1a')]=qs[_0xd686('0x1a')](_0x476d69['query'][_0xd686('0x1a')]);_0x2f90fb[_0xd686('0x19')]=qs[_0xd686('0x19')](_0x476d69[_0xd686('0x2f')][_0xd686('0x19')]);}_0x2f90fb[_0xd686('0x37')]=qs[_0xd686('0x38')](_0x476d69[_0xd686('0x2f')][_0xd686('0x38')]);_0x2f90fb[_0xd686('0x39')]=qs['filters'](_['pick'](_0x476d69[_0xd686('0x2f')],_0x17ff8f[_0xd686('0x30')]));if(_0x476d69['query']['filter']){_0x2f90fb['where']=_[_0xd686('0x3a')](_0x2f90fb[_0xd686('0x39')],{'$or':_[_0xd686('0x29')](_0x1ffca3,function(_0x2f7b79){if(_0x2f7b79['type']!==_0xd686('0x3b')){var _0x51b5fd={};_0x51b5fd[_0x2f7b79[_0xd686('0x26')]]={'$like':'%'+_0x476d69['query'][_0xd686('0x3c')]+'%'};return _0x51b5fd;}})});}_0x2f90fb=_[_0xd686('0x3a')]({},_0x2f90fb,_0x476d69[_0xd686('0x3d')]);var _0x62db2f={'where':_0x2f90fb[_0xd686('0x39')]};return db[_0xd686('0x2a')][_0xd686('0x18')](_0x62db2f)[_0xd686('0x20')](function(_0x408f59){_0x1035db['count']=_0x408f59;if(_0x476d69[_0xd686('0x2f')][_0xd686('0x3e')]){_0x2f90fb[_0xd686('0x3f')]=[{'all':!![]}];}return db[_0xd686('0x2a')][_0xd686('0x40')](_0x2f90fb);})[_0xd686('0x20')](function(_0x5b236d){_0x1035db[_0xd686('0x41')]=_0x5b236d;return _0x1035db;})[_0xd686('0x20')](respondWithFilteredResult(_0x5495ca,_0x2f90fb))['catch'](handleError(_0x5495ca,null));};exports[_0xd686('0x42')]=function(_0x2a68cb,_0x3e981b){var _0x14d4e8={'raw':![],'where':{'id':_0x2a68cb[_0xd686('0x43')]['id']}},_0x36e2c6={};_0x36e2c6['model']=_['keys'](db['JscriptyProject'][_0xd686('0x44')]);_0x36e2c6[_0xd686('0x2f')]=_[_0xd686('0x45')](_0x2a68cb[_0xd686('0x2f')]);_0x36e2c6['filters']=_[_0xd686('0x31')](_0x36e2c6[_0xd686('0x2e')],_0x36e2c6[_0xd686('0x2f')]);_0x14d4e8[_0xd686('0x32')]=_[_0xd686('0x31')](_0x36e2c6[_0xd686('0x2e')],qs[_0xd686('0x33')](_0x2a68cb[_0xd686('0x2f')]['fields']));_0x14d4e8[_0xd686('0x32')]=_0x14d4e8[_0xd686('0x32')]['length']?_0x14d4e8['attributes']:_0x36e2c6['model'];if(_0x2a68cb[_0xd686('0x2f')][_0xd686('0x3e')]){_0x14d4e8[_0xd686('0x3f')]=[{'all':!![]}];}_0x14d4e8=_[_0xd686('0x3a')]({},_0x14d4e8,_0x2a68cb[_0xd686('0x3d')]);return db[_0xd686('0x2a')][_0xd686('0x46')](_0x14d4e8)['then'](handleEntityNotFound(_0x3e981b,null))[_0xd686('0x20')](respondWithResult(_0x3e981b,null))[_0xd686('0x47')](handleError(_0x3e981b,null));};exports[_0xd686('0x48')]=function(_0x21aad4,_0x27778c){return db[_0xd686('0x2a')][_0xd686('0x48')](_0x21aad4['body'],{})[_0xd686('0x20')](function(_0x488e8a){var _0x24c5af=_0x21aad4[_0xd686('0x49')][_0xd686('0x21')]({'plain':!![]});if(!_0x24c5af)throw new Error(_0xd686('0x4a'));if(_0x24c5af[_0xd686('0x4b')]==='user'){var _0xb2b114=_0x488e8a['get']({'plain':!![]});var _0x38624f=_0xd686('0x22');return db[_0xd686('0x4c')][_0xd686('0x46')]({'where':{'name':_0x38624f,'userProfileId':_0x24c5af[_0xd686('0x4d')]},'raw':!![]})[_0xd686('0x20')](function(_0x2f2e63){if(_0x2f2e63&&_0x2f2e63[_0xd686('0x4e')]===0x0){return db[_0xd686('0x23')][_0xd686('0x48')]({'name':_0xb2b114['name'],'resourceId':_0xb2b114['id'],'type':_0x2f2e63[_0xd686('0x26')],'sectionId':_0x2f2e63['id']},{})[_0xd686('0x20')](function(){return _0x488e8a;});}else{return _0x488e8a;}})[_0xd686('0x47')](function(_0x23f852){logger[_0xd686('0x25')](_0xd686('0x4f'),_0x23f852);throw _0x23f852;});}return _0x488e8a;})[_0xd686('0x20')](respondWithResult(_0x27778c,0xc9))[_0xd686('0x47')](handleError(_0x27778c,null));};exports[_0xd686('0x50')]=function(_0x3188b9,_0x3e9b1e){var _0x24fdf2={'where':{'id':_0x3188b9[_0xd686('0x43')]['id']}},_0x1887f8={};_0x1887f8[_0xd686('0x2e')]=_[_0xd686('0x45')](db['JscriptyProject']['rawAttributes']);_0x24fdf2[_0xd686('0x32')]=_['intersection'](_0x1887f8[_0xd686('0x2e')],qs[_0xd686('0x33')](_0x3188b9[_0xd686('0x2f')][_0xd686('0x33')]));_0x24fdf2[_0xd686('0x32')]=_0x24fdf2[_0xd686('0x32')][_0xd686('0x34')]?_0x24fdf2[_0xd686('0x32')]:_0x1887f8[_0xd686('0x2e')];if(_0x3188b9[_0xd686('0x2f')][_0xd686('0x3e')]){_0x24fdf2[_0xd686('0x3f')]=[{'all':!![]}];}_0x24fdf2=_['merge']({},_0x24fdf2,_0x3188b9['options']);return db['JscriptyProject'][_0xd686('0x46')](_0x24fdf2)[_0xd686('0x20')](handleEntityNotFound(_0x3e9b1e,null))[_0xd686('0x20')](function(_0x28c2b2){if(_0x28c2b2){var _0x3b2d3b=_0x28c2b2['get']({'plain':!![]});_0x3b2d3b=qs['omit'](_0x3b2d3b,['id',_0xd686('0x51'),_0xd686('0x52')]);_0x3188b9['body']=_[_0xd686('0x53')](_0x3188b9[_0xd686('0x54')],['id',_0xd686('0x51'),_0xd686('0x52')]);return db[_0xd686('0x2a')][_0xd686('0x48')](_[_0xd686('0x3a')](_0x3b2d3b,_0x3188b9[_0xd686('0x54')]),{'include':_0x3188b9['query'][_0xd686('0x3e')]?[{'all':!![]}]:undefined})[_0xd686('0x20')](function(_0x85edb8){var _0x4fee5b=_0x3188b9[_0xd686('0x49')]['get']({'plain':!![]});if(!_0x4fee5b)throw new Error(_0xd686('0x4a'));if(_0x4fee5b[_0xd686('0x4b')]===_0xd686('0x49')){var _0x18ed75=_0x85edb8[_0xd686('0x21')]({'plain':!![]});var _0xcc3ad8='Projects';return db['UserProfileSection'][_0xd686('0x46')]({'where':{'name':_0xcc3ad8,'userProfileId':_0x4fee5b[_0xd686('0x4d')]},'raw':!![]})[_0xd686('0x20')](function(_0x43ae6c){if(_0x43ae6c&&_0x43ae6c[_0xd686('0x4e')]===0x0){return db[_0xd686('0x23')][_0xd686('0x48')]({'name':_0x18ed75[_0xd686('0x26')],'resourceId':_0x18ed75['id'],'type':_0x43ae6c[_0xd686('0x26')],'sectionId':_0x43ae6c['id']},{})['then'](function(){return _0x85edb8;});}else{return _0x85edb8;}})[_0xd686('0x47')](function(_0x594b38){logger[_0xd686('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x594b38);throw _0x594b38;});}return _0x85edb8;});}})['then'](respondWithResult(_0x3e9b1e,0xc9))[_0xd686('0x47')](handleError(_0x3e9b1e,null));};exports[_0xd686('0x1f')]=function(_0x3410a2,_0x12f7f1){if(_0x3410a2[_0xd686('0x54')]['id']){delete _0x3410a2[_0xd686('0x54')]['id'];}return db['JscriptyProject'][_0xd686('0x46')]({'where':{'id':_0x3410a2[_0xd686('0x43')]['id']}})[_0xd686('0x20')](handleEntityNotFound(_0x12f7f1,null))[_0xd686('0x20')](saveUpdates(_0x3410a2['body'],null))[_0xd686('0x20')](respondWithResult(_0x12f7f1,null))[_0xd686('0x47')](handleError(_0x12f7f1,null));};exports['destroy']=function(_0x9c06f7,_0x525e13){return db[_0xd686('0x2a')][_0xd686('0x46')]({'where':{'id':_0x9c06f7['params']['id']}})[_0xd686('0x20')](handleEntityNotFound(_0x525e13,null))[_0xd686('0x20')](removeEntity(_0x525e13,null))['catch'](handleError(_0x525e13,null));};exports[_0xd686('0x55')]=function(_0x186cfd,_0x14d536,_0x1fc4b9){var _0x2312de={'raw':!![],'where':{}};var _0x27dd1f={};var _0x21a5b8={'count':0x0,'rows':[]};return db[_0xd686('0x2a')]['findOne']({'where':{'id':_0x186cfd['params']['id']}})[_0xd686('0x20')](handleEntityNotFound(_0x14d536,null))[_0xd686('0x20')](function(_0x3687a0){if(_0x3687a0){_0x27dd1f[_0xd686('0x2e')]=_[_0xd686('0x45')](db[_0xd686('0x56')][_0xd686('0x44')]);_0x27dd1f[_0xd686('0x2f')]=_[_0xd686('0x45')](_0x186cfd[_0xd686('0x2f')]);_0x27dd1f['filters']=_[_0xd686('0x31')](_0x27dd1f[_0xd686('0x2e')],_0x27dd1f[_0xd686('0x2f')]);_0x2312de[_0xd686('0x32')]=_[_0xd686('0x31')](_0x27dd1f[_0xd686('0x2e')],qs[_0xd686('0x33')](_0x186cfd[_0xd686('0x2f')][_0xd686('0x33')]));_0x2312de[_0xd686('0x32')]=_0x2312de[_0xd686('0x32')][_0xd686('0x34')]?_0x2312de[_0xd686('0x32')]:_0x27dd1f['model'];if(!_0x186cfd['query'][_0xd686('0x35')](_0xd686('0x36'))){_0x2312de['limit']=qs[_0xd686('0x1a')](_0x186cfd[_0xd686('0x2f')][_0xd686('0x1a')]);_0x2312de[_0xd686('0x19')]=qs[_0xd686('0x19')](_0x186cfd[_0xd686('0x2f')][_0xd686('0x19')]);}_0x2312de[_0xd686('0x37')]=qs[_0xd686('0x38')](_0x186cfd[_0xd686('0x2f')][_0xd686('0x38')]);_0x2312de[_0xd686('0x39')]=qs[_0xd686('0x30')](_[_0xd686('0x57')](_0x186cfd[_0xd686('0x2f')],_0x27dd1f[_0xd686('0x30')]));_0x2312de[_0xd686('0x39')]['ProjectId']=_0x3687a0['id'];if(_0x186cfd[_0xd686('0x2f')][_0xd686('0x3c')]){_0x2312de[_0xd686('0x39')]=_[_0xd686('0x3a')](_0x2312de['where'],{'$or':_['map'](_0x2312de['attributes'],function(_0xfc5a32){var _0x63ce1e={};_0x63ce1e[_0xfc5a32]={'$like':'%'+_0x186cfd[_0xd686('0x2f')][_0xd686('0x3c')]+'%'};return _0x63ce1e;})});}_0x2312de=_['merge']({},_0x2312de,_0x186cfd[_0xd686('0x3d')]);return db[_0xd686('0x56')][_0xd686('0x18')]({'where':_0x2312de[_0xd686('0x39')]})[_0xd686('0x20')](function(_0xb0025a){_0x21a5b8['count']=_0xb0025a;if(_0x186cfd[_0xd686('0x2f')][_0xd686('0x3e')]){_0x2312de['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0xd686('0x40')](_0x2312de);})[_0xd686('0x20')](function(_0xeeaf92){_0x21a5b8[_0xd686('0x41')]=_0xeeaf92;return _0x21a5b8;});}})[_0xd686('0x20')](respondWithFilteredResult(_0x14d536,_0x2312de))[_0xd686('0x47')](handleError(_0x14d536,null));};exports[_0xd686('0x58')]=function(_0x543a13,_0x1151bd,_0x222e4a){var _0x2f81a7={'raw':!![],'where':{}};var _0x4c984b={};var _0x846c65={'count':0x0,'rows':[]};return db[_0xd686('0x2a')][_0xd686('0x59')]({'where':{'id':_0x543a13['params']['id']}})['then'](handleEntityNotFound(_0x1151bd,null))[_0xd686('0x20')](function(_0x5262bf){if(_0x5262bf){_0x4c984b[_0xd686('0x2e')]=_[_0xd686('0x45')](db[_0xd686('0x5a')][_0xd686('0x44')]);_0x4c984b[_0xd686('0x2f')]=_[_0xd686('0x45')](_0x543a13['query']);_0x4c984b[_0xd686('0x30')]=_[_0xd686('0x31')](_0x4c984b[_0xd686('0x2e')],_0x4c984b[_0xd686('0x2f')]);_0x2f81a7[_0xd686('0x32')]=_[_0xd686('0x31')](_0x4c984b['model'],qs[_0xd686('0x33')](_0x543a13[_0xd686('0x2f')][_0xd686('0x33')]));_0x2f81a7[_0xd686('0x32')]=_0x2f81a7[_0xd686('0x32')][_0xd686('0x34')]?_0x2f81a7[_0xd686('0x32')]:_0x4c984b['model'];if(!_0x543a13['query'][_0xd686('0x35')](_0xd686('0x36'))){_0x2f81a7[_0xd686('0x1a')]=qs['limit'](_0x543a13[_0xd686('0x2f')][_0xd686('0x1a')]);_0x2f81a7[_0xd686('0x19')]=qs[_0xd686('0x19')](_0x543a13['query'][_0xd686('0x19')]);}_0x2f81a7['order']=qs[_0xd686('0x38')](_0x543a13[_0xd686('0x2f')][_0xd686('0x38')]);_0x2f81a7[_0xd686('0x39')]=qs[_0xd686('0x30')](_[_0xd686('0x57')](_0x543a13[_0xd686('0x2f')],_0x4c984b[_0xd686('0x30')]));_0x2f81a7['where'][_0xd686('0x5b')]=_0x5262bf['id'];if(_0x543a13['query'][_0xd686('0x3c')]){_0x2f81a7[_0xd686('0x39')]=_['merge'](_0x2f81a7['where'],{'$or':_[_0xd686('0x29')](_0x2f81a7[_0xd686('0x32')],function(_0x304f55){var _0x53189d={};_0x53189d[_0x304f55]={'$like':'%'+_0x543a13['query']['filter']+'%'};return _0x53189d;})});}_0x2f81a7=_['merge']({},_0x2f81a7,_0x543a13['options']);return db[_0xd686('0x5a')][_0xd686('0x18')]({'where':_0x2f81a7['where']})[_0xd686('0x20')](function(_0x493ffc){_0x846c65[_0xd686('0x18')]=_0x493ffc;if(_0x543a13[_0xd686('0x2f')][_0xd686('0x3e')]){_0x2f81a7['include']=[{'all':!![]}];}return db[_0xd686('0x5a')][_0xd686('0x40')](_0x2f81a7);})[_0xd686('0x20')](function(_0x29c85f){_0x846c65[_0xd686('0x41')]=_0x29c85f;return _0x846c65;});}})['then'](respondWithFilteredResult(_0x1151bd,_0x2f81a7))[_0xd686('0x47')](handleError(_0x1151bd,null));};function char(_0xd90eab){return _0xd686('0x5c')===typeof _0xd90eab?String[_0xd686('0x5d')][_0xd686('0x1c')](null,arguments):_0xd90eab;}function needsEncapsulation(_0x294844){return!!_0x294844&&(_0x294844[_0xd686('0x5e')]()[_0xd686('0x5f')](char(0xd))>=0x0||_0x294844[_0xd686('0x5e')]()[_0xd686('0x5f')](char(0xa))>=0x0||_0x294844[_0xd686('0x5e')]()[_0xd686('0x5f')](char(0x2c))>=0x0||_0x294844[_0xd686('0x5e')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x59d750){var _0x407f3e=char(0x22),_0x193128='\x5c'+char(0x22),_0x1fcc40=_0x59d750['toString']()['replace'](new RegExp(_0x407f3e,'g'),_0x193128);return _0x407f3e+_0x1fcc40+_0x407f3e;}exports[_0xd686('0x60')]=function(_0x32d295,_0x44cd07,_0x55be00){var _0x1e9cc2,_0x49d0c6;var _0x3d273b={'where':{'ProjectId':_0x32d295['params']['id']}};if(_0x32d295['query'][_0xd686('0x61')]){_0x3d273b[_0xd686('0x39')]['starttime']=JSON[_0xd686('0x62')](_0x32d295[_0xd686('0x2f')][_0xd686('0x61')]);}return db[_0xd686('0x56')]['findAll'](_0x3d273b)['then'](handleEntityNotFound(_0x44cd07,null))[_0xd686('0x20')](function(_0x4cb37b){if(_0x4cb37b){_0x1e9cc2=_0x4cb37b;return db[_0xd686('0x63')][_0xd686('0x40')]({'where':{'SessionId':{'$in':_[_0xd686('0x29')](_0x1e9cc2,'id')},'ProjectId':_0x32d295[_0xd686('0x43')]['id']},'order':_0xd686('0x64')});}})[_0xd686('0x20')](handleEntityNotFound(_0x44cd07,null))[_0xd686('0x20')](function(_0x2c8051){if(_0x2c8051){_0x49d0c6=_0x2c8051;var _0x37a171={};for(var _0x3acc00=0x0,_0x8ba6cd=_0x49d0c6[_0xd686('0x34')];_0x3acc00<_0x8ba6cd;_0x3acc00++){if(!_0x37a171[_0xd686('0x35')](_0x49d0c6[_0x3acc00][_0xd686('0x65')])){_0x37a171[_0x49d0c6[_0x3acc00]['questionId']]=needsEncapsulation(_0x49d0c6[_0x3acc00][_0xd686('0x66')])?encapsulate(_0x49d0c6[_0x3acc00]['question']):_0x49d0c6[_0x3acc00][_0xd686('0x66')];}}var _0x1d1dc8=[],_0x34a79c={};for(var _0x77dc78=0x0,_0x4b75e8=_0x1e9cc2[_0xd686('0x34')];_0x77dc78<_0x4b75e8;_0x77dc78++){_0x34a79c={'ProjectId':_0x32d295[_0xd686('0x43')]['id'],'SessionId':_0x1e9cc2[_0x77dc78]['id'],'StartTime':moment(_0x1e9cc2[_0x77dc78][_0xd686('0x67')])[_0xd686('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x47476e=0x0,_0x60d946=_0x49d0c6[_0xd686('0x34')];_0x47476e<_0x60d946;_0x47476e++){if(_0x49d0c6[_0x47476e][_0xd686('0x69')]==_0x1e9cc2[_0x77dc78]['id']&&_0x37a171[_0xd686('0x35')](_0x49d0c6[_0x47476e]['questionId'])){_0x34a79c[_0x37a171[_0x49d0c6[_0x47476e][_0xd686('0x65')]]]=_0x49d0c6[_0x47476e][_0xd686('0x6a')];}}for(var _0x14aaa5 in _0x37a171){if(!_0x34a79c[_0xd686('0x35')](_0x37a171[_0x14aaa5])){_0x34a79c[_0x37a171[_0x14aaa5]]=null;}}_0x1d1dc8['push'](_0x34a79c);}return _0x1d1dc8;}})[_0xd686('0x20')](function(_0x52f49d){if(!_[_0xd686('0x6b')](_0x52f49d)){var _0x135cb5=toCsv(_0x52f49d);var _0x56d2ac=Date[_0xd686('0x6c')]();fs[_0xd686('0x6d')](util['format'](_0xd686('0x6e'),_0x32d295[_0xd686('0x43')]['id'],_0x56d2ac),_0x135cb5);_0x44cd07[_0xd686('0x6f')]('Content-disposition',_0xd686('0x70')+util[_0xd686('0x68')](_0xd686('0x71'),_0x32d295[_0xd686('0x43')]['id'],_0x56d2ac));_0x44cd07[_0xd686('0x6f')]('Content-type',_0xd686('0x72'));return _0x44cd07[_0xd686('0x73')](util[_0xd686('0x68')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x32d295[_0xd686('0x43')]['id'],_0x56d2ac));}else{return _0x44cd07[_0xd686('0x14')](0xcc);}})[_0xd686('0x47')](handleError(_0x44cd07,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 2a3d75b..e953b03 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 _0xf243=['../../config/logger','api','moment','bluebird','path','rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','util'];(function(_0x291ec3,_0x2f19a7){var _0x423b99=function(_0x345ddd){while(--_0x345ddd){_0x291ec3['push'](_0x291ec3['shift']());}};_0x423b99(++_0x2f19a7);}(_0xf243,0x1d2));var _0x3f24=function(_0x1613d9,_0x2f583e){_0x1613d9=_0x1613d9-0x0;var _0x1ab5e0=_0xf243[_0x1613d9];return _0x1ab5e0;};'use strict';var _=require(_0x3f24('0x0'));var util=require(_0x3f24('0x1'));var logger=require(_0x3f24('0x2'))(_0x3f24('0x3'));var moment=require(_0x3f24('0x4'));var BPromise=require(_0x3f24('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f24('0x6'));var rimraf=require(_0x3f24('0x7'));var config=require('../../config/environment');var attributes=require(_0x3f24('0x8'));module[_0x3f24('0x9')]=function(_0x542744,_0x35c6b2){return _0x542744[_0x3f24('0xa')](_0x3f24('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x233b=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define','JscriptyProject','jscripty_projects'];(function(_0x3d8ba1,_0x5ba1fd){var _0x87804e=function(_0x5bf2a7){while(--_0x5bf2a7){_0x3d8ba1['push'](_0x3d8ba1['shift']());}};_0x87804e(++_0x5ba1fd);}(_0x233b,0x197));var _0xb233=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x233b[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xb233('0x0'));var util=require(_0xb233('0x1'));var logger=require(_0xb233('0x2'))('api');var moment=require(_0xb233('0x3'));var BPromise=require(_0xb233('0x4'));var rp=require(_0xb233('0x5'));var fs=require('fs');var path=require(_0xb233('0x6'));var rimraf=require('rimraf');var config=require(_0xb233('0x7'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x628602,_0x360913){return _0x628602[_0xb233('0x8')](_0xb233('0x9'),attributes,{'tableName':_0xb233('0xa'),'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 b4e4632..4ea8b42 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 _0xc546=['../../config/environment','jayson/promise','client','http','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x57950a,_0x45b595){var _0x2b8463=function(_0x1994e6){while(--_0x1994e6){_0x57950a['push'](_0x57950a['shift']());}};_0x2b8463(++_0x45b595);}(_0xc546,0x177));var _0x6c54=function(_0x6ae722,_0x574dba){_0x6ae722=_0x6ae722-0x0;var _0x114aff=_0xc546[_0x6ae722];return _0x114aff;};'use strict';var _=require(_0x6c54('0x0'));var util=require(_0x6c54('0x1'));var moment=require(_0x6c54('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c54('0x3'));var db=require(_0x6c54('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6c54('0x5'));var jayson=require(_0x6c54('0x6'));var client=jayson[_0x6c54('0x7')][_0x6c54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xae7fef,_0x143992,_0x18eb54){return new BPromise(function(_0x2d791f,_0x6592fe){return client['request'](_0xae7fef,_0x18eb54)[_0x6c54('0x9')](function(_0x615b91){logger[_0x6c54('0xa')](_0x6c54('0xb'),_0x143992,_0x6c54('0xc'));logger['debug'](_0x6c54('0xd'),_0x143992,'request\x20sent',JSON[_0x6c54('0xe')](_0x615b91));if(_0x615b91['error']){if(_0x615b91[_0x6c54('0xf')][_0x6c54('0x10')]===0x1f4){logger[_0x6c54('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x143992,_0x615b91[_0x6c54('0xf')][_0x6c54('0x11')]);return _0x6592fe(_0x615b91['error']['message']);}logger['error'](_0x6c54('0xb'),_0x143992,_0x615b91[_0x6c54('0xf')][_0x6c54('0x11')]);return _0x2d791f(_0x615b91[_0x6c54('0xf')][_0x6c54('0x11')]);}else{logger[_0x6c54('0xa')](_0x6c54('0xb'),_0x143992,_0x6c54('0xc'));_0x2d791f(_0x615b91[_0x6c54('0x12')][_0x6c54('0x11')]);}})[_0x6c54('0x13')](function(_0x4f0482){logger[_0x6c54('0xf')](_0x6c54('0xb'),_0x143992,_0x4f0482);_0x6592fe(_0x4f0482);});});} \ No newline at end of file +var _0x0dee=['JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x47a8e2,_0xb2aecb){var _0x1084ef=function(_0x2666eb){while(--_0x2666eb){_0x47a8e2['push'](_0x47a8e2['shift']());}};_0x1084ef(++_0xb2aecb);}(_0x0dee,0xd6));var _0xe0de=function(_0x2f1aae,_0x20ebef){_0x2f1aae=_0x2f1aae-0x0;var _0x4790d7=_0x0dee[_0x2f1aae];return _0x4790d7;};'use strict';var _=require('lodash');var util=require(_0xe0de('0x0'));var moment=require(_0xe0de('0x1'));var BPromise=require(_0xe0de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0de('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe0de('0x4'));var logger=require(_0xe0de('0x5'))(_0xe0de('0x6'));var config=require(_0xe0de('0x7'));var jayson=require(_0xe0de('0x8'));var client=jayson['client'][_0xe0de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x75db38,_0x27547f,_0x51a32c){return new BPromise(function(_0x556aa2,_0x4010bc){return client[_0xe0de('0xa')](_0x75db38,_0x51a32c)[_0xe0de('0xb')](function(_0x3e9bf5){logger[_0xe0de('0xc')](_0xe0de('0xd'),_0x27547f,_0xe0de('0xe'));logger[_0xe0de('0xf')](_0xe0de('0x10'),_0x27547f,_0xe0de('0xe'),JSON[_0xe0de('0x11')](_0x3e9bf5));if(_0x3e9bf5[_0xe0de('0x12')]){if(_0x3e9bf5[_0xe0de('0x12')][_0xe0de('0x13')]===0x1f4){logger[_0xe0de('0x12')](_0xe0de('0xd'),_0x27547f,_0x3e9bf5['error'][_0xe0de('0x14')]);return _0x4010bc(_0x3e9bf5[_0xe0de('0x12')][_0xe0de('0x14')]);}logger['error'](_0xe0de('0xd'),_0x27547f,_0x3e9bf5[_0xe0de('0x12')][_0xe0de('0x14')]);return _0x556aa2(_0x3e9bf5[_0xe0de('0x12')]['message']);}else{logger[_0xe0de('0xc')](_0xe0de('0xd'),_0x27547f,_0xe0de('0xe'));_0x556aa2(_0x3e9bf5[_0xe0de('0x15')][_0xe0de('0x14')]);}})[_0xe0de('0x16')](function(_0xca145d){logger[_0xe0de('0x12')](_0xe0de('0xd'),_0x27547f,_0xca145d);_0x4010bc(_0xca145d);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 210a138..0238086 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 _0xab5c=['Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','path','connect-timeout'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xab5c,0x108));var _0xcab5=function(_0x369325,_0x4abe12){_0x369325=_0x369325-0x0;var _0xd5de1a=_0xab5c[_0x369325];return _0xd5de1a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcab5('0x0'));var timeout=require(_0xcab5('0x1'));var express=require('express');var router=express[_0xcab5('0x2')]();var auth=require(_0xcab5('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcab5('0x4'));var controller=require(_0xcab5('0x5'));router[_0xcab5('0x6')]('/',auth[_0xcab5('0x7')](),controller[_0xcab5('0x8')]);router[_0xcab5('0x6')](_0xcab5('0x9'),auth[_0xcab5('0x7')](),controller[_0xcab5('0xa')]);router['get'](_0xcab5('0xb'),auth[_0xcab5('0x7')](),controller[_0xcab5('0xc')]);router[_0xcab5('0xd')]('/',auth[_0xcab5('0x7')](),controller[_0xcab5('0xe')]);router[_0xcab5('0xf')]('/:id',auth[_0xcab5('0x7')](),controller[_0xcab5('0x10')]);router['delete'](_0xcab5('0xb'),auth[_0xcab5('0x7')](),controller[_0xcab5('0x11')]);module[_0xcab5('0x12')]=router; \ No newline at end of file +var _0x3863=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put'];(function(_0x4551f6,_0x48151b){var _0x581dc2=function(_0x1842af){while(--_0x1842af){_0x4551f6['push'](_0x4551f6['shift']());}};_0x581dc2(++_0x48151b);}(_0x3863,0x14e));var _0x3386=function(_0xd8190e,_0x2f53ed){_0xd8190e=_0xd8190e-0x0;var _0x3eae31=_0x3863[_0xd8190e];return _0x3eae31;};'use strict';var multer=require(_0x3386('0x0'));var util=require(_0x3386('0x1'));var path=require(_0x3386('0x2'));var timeout=require(_0x3386('0x3'));var express=require(_0x3386('0x4'));var router=express[_0x3386('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x3386('0x6'));var config=require(_0x3386('0x7'));var controller=require(_0x3386('0x8'));router['get']('/',auth[_0x3386('0x9')](),controller[_0x3386('0xa')]);router[_0x3386('0xb')](_0x3386('0xc'),auth['isAuthenticated'](),controller[_0x3386('0xd')]);router['get'](_0x3386('0xe'),auth[_0x3386('0x9')](),controller['show']);router[_0x3386('0xf')]('/',auth[_0x3386('0x9')](),controller[_0x3386('0x10')]);router[_0x3386('0x11')](_0x3386('0xe'),auth[_0x3386('0x9')](),controller[_0x3386('0x12')]);router[_0x3386('0x13')](_0x3386('0xe'),auth[_0x3386('0x9')](),controller[_0x3386('0x14')]);module[_0x3386('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 518ee1f..7de46f8 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 _0x0086=['TEXT','long','STRING','sequelize','exports'];(function(_0x2aad57,_0x3a2bd0){var _0x5949dc=function(_0x4cc961){while(--_0x4cc961){_0x2aad57['push'](_0x2aad57['shift']());}};_0x5949dc(++_0x3a2bd0);}(_0x0086,0x1ac));var _0x6008=function(_0x120772,_0x5c793f){_0x120772=_0x120772-0x0;var _0x10db31=_0x0086[_0x120772];return _0x10db31;};'use strict';var Sequelize=require(_0x6008('0x0'));module[_0x6008('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x6008('0x2')](_0x6008('0x3'))},'membername':{'type':Sequelize[_0x6008('0x4')]},'projectname':{'type':Sequelize[_0x6008('0x4')]},'queue':{'type':Sequelize[_0x6008('0x4')]},'uniqueid':{'type':Sequelize[_0x6008('0x4')]},'calleridname':{'type':Sequelize[_0x6008('0x4')]},'calleridnum':{'type':Sequelize[_0x6008('0x4')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x624f=['long','sequelize','STRING','TEXT'];(function(_0x2f5daf,_0x8a2193){var _0xd1193f=function(_0x3e53e7){while(--_0x3e53e7){_0x2f5daf['push'](_0x2f5daf['shift']());}};_0xd1193f(++_0x8a2193);}(_0x624f,0xa9));var _0xf624=function(_0x372f80,_0x17bc12){_0x372f80=_0x372f80-0x0;var _0xa1fa5f=_0x624f[_0x372f80];return _0xa1fa5f;};'use strict';var Sequelize=require(_0xf624('0x0'));module['exports']={'question':{'type':Sequelize[_0xf624('0x1')]},'answer':{'type':Sequelize[_0xf624('0x2')](_0xf624('0x3'))},'membername':{'type':Sequelize[_0xf624('0x1')]},'projectname':{'type':Sequelize[_0xf624('0x1')]},'queue':{'type':Sequelize[_0xf624('0x1')]},'uniqueid':{'type':Sequelize[_0xf624('0x1')]},'calleridname':{'type':Sequelize[_0xf624('0x1')]},'calleridnum':{'type':Sequelize[_0xf624('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 02a04a7..2f96783 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 _0xb979=['params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','status','json','count','offset','limit','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','name','send','JscriptyQuestionReport','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb979,0x160));var _0x9b97=function(_0x27a119,_0x3f97a5){_0x27a119=_0x27a119-0x0;var _0x210285=_0xb979[_0x27a119];return _0x210285;};'use strict';var pdf=require(_0x9b97('0x0'));var emlformat=require(_0x9b97('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9b97('0x2'));var jsonpatch=require(_0x9b97('0x3'));var rp=require('request-promise');var moment=require(_0x9b97('0x4'));var BPromise=require(_0x9b97('0x5'));var Mustache=require('mustache');var util=require(_0x9b97('0x6'));var path=require(_0x9b97('0x7'));var sox=require(_0x9b97('0x8'));var csv=require(_0x9b97('0x9'));var ejs=require(_0x9b97('0xa'));var fs=require('fs');var _=require(_0x9b97('0xb'));var squel=require(_0x9b97('0xc'));var crypto=require(_0x9b97('0xd'));var jsforce=require(_0x9b97('0xe'));var deskjs=require(_0x9b97('0xf'));var toCsv=require(_0x9b97('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9b97('0x10'));var authService=require(_0x9b97('0x11'));var qs=require(_0x9b97('0x12'));var as=require(_0x9b97('0x13'));var hardwareService=require(_0x9b97('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9b97('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5502b3,_0x4ebf4c){_0x4ebf4c=_0x4ebf4c||0xcc;return function(_0x292245){if(_0x292245){return _0x5502b3['sendStatus'](_0x4ebf4c);}return _0x5502b3[_0x9b97('0x16')](_0x4ebf4c)['end']();};}function respondWithResult(_0x4733e4,_0x3b415f){_0x3b415f=_0x3b415f||0xc8;return function(_0x22a04e){if(_0x22a04e){return _0x4733e4[_0x9b97('0x16')](_0x3b415f)[_0x9b97('0x17')](_0x22a04e);}};}function respondWithFilteredResult(_0x10465b,_0x4b2541){return function(_0x3eb520){if(_0x3eb520){var _0x50a08f=_0x3eb520[_0x9b97('0x18')],_0xcfa963=_0x4b2541[_0x9b97('0x19')],_0x4cdfe0=_0x4b2541[_0x9b97('0x19')]+_0x4b2541[_0x9b97('0x1a')],_0x1a0c63;if(_0x4cdfe0>=_0x50a08f){_0x4cdfe0=_0x50a08f;_0x1a0c63=0xc8;}else{_0x1a0c63=0xce;}_0x10465b[_0x9b97('0x16')](_0x1a0c63);return _0x10465b[_0x9b97('0x1b')](_0x9b97('0x1c'),_0xcfa963+'-'+_0x4cdfe0+'/'+_0x50a08f)['json'](_0x3eb520);}return null;};}function patchUpdates(_0x4aec32){return function(_0x4470d2){try{jsonpatch['apply'](_0x4470d2,_0x4aec32,!![]);}catch(_0x3b73ca){return BPromise['reject'](_0x3b73ca);}return _0x4470d2[_0x9b97('0x1d')]();};}function saveUpdates(_0x502fd9,_0x18c797){return function(_0x17fe90){if(_0x17fe90){return _0x17fe90[_0x9b97('0x1e')](_0x502fd9)['then'](function(_0x5be1a5){return _0x5be1a5;});}return null;};}function removeEntity(_0x5a3a37,_0x536b16){return function(_0x3cdf40){if(_0x3cdf40){return _0x3cdf40[_0x9b97('0x1f')]()[_0x9b97('0x20')](function(){_0x5a3a37[_0x9b97('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e65b1,_0x3d973a){return function(_0x435d65){if(!_0x435d65){_0x4e65b1[_0x9b97('0x21')](0x194);}return _0x435d65;};}function handleError(_0x169911,_0x41b862){_0x41b862=_0x41b862||0x1f4;return function(_0x1e1a50){logger[_0x9b97('0x22')](_0x1e1a50[_0x9b97('0x23')]);if(_0x1e1a50[_0x9b97('0x24')]){delete _0x1e1a50[_0x9b97('0x24')];}_0x169911[_0x9b97('0x16')](_0x41b862)[_0x9b97('0x25')](_0x1e1a50);};}exports['index']=function(_0x4c199e,_0x1eaaff){var _0x1a7a4e={},_0x1f379a={},_0x406531={'count':0x0,'rows':[]};var _0x1a4bb3=_['map'](db[_0x9b97('0x26')][_0x9b97('0x27')],function(_0x31172e){return{'name':_0x31172e[_0x9b97('0x28')],'type':_0x31172e['type'][_0x9b97('0x29')]};});_0x1f379a[_0x9b97('0x2a')]=_[_0x9b97('0x2b')](_0x1a4bb3,_0x9b97('0x24'));_0x1f379a['query']=_[_0x9b97('0x2c')](_0x4c199e[_0x9b97('0x2d')]);_0x1f379a[_0x9b97('0x2e')]=_[_0x9b97('0x2f')](_0x1f379a[_0x9b97('0x2a')],_0x1f379a[_0x9b97('0x2d')]);_0x1a7a4e[_0x9b97('0x30')]=_[_0x9b97('0x2f')](_0x1f379a[_0x9b97('0x2a')],qs[_0x9b97('0x31')](_0x4c199e[_0x9b97('0x2d')][_0x9b97('0x31')]));_0x1a7a4e[_0x9b97('0x30')]=_0x1a7a4e[_0x9b97('0x30')][_0x9b97('0x32')]?_0x1a7a4e['attributes']:_0x1f379a[_0x9b97('0x2a')];if(!_0x4c199e['query']['hasOwnProperty'](_0x9b97('0x33'))){_0x1a7a4e[_0x9b97('0x1a')]=qs[_0x9b97('0x1a')](_0x4c199e[_0x9b97('0x2d')][_0x9b97('0x1a')]);_0x1a7a4e[_0x9b97('0x19')]=qs['offset'](_0x4c199e[_0x9b97('0x2d')][_0x9b97('0x19')]);}_0x1a7a4e['order']=qs[_0x9b97('0x34')](_0x4c199e[_0x9b97('0x2d')][_0x9b97('0x34')]);_0x1a7a4e['where']=qs[_0x9b97('0x2e')](_[_0x9b97('0x35')](_0x4c199e[_0x9b97('0x2d')],_0x1f379a[_0x9b97('0x2e')]));if(_0x4c199e[_0x9b97('0x2d')][_0x9b97('0x36')]){_0x1a7a4e[_0x9b97('0x37')]=_[_0x9b97('0x38')](_0x1a7a4e[_0x9b97('0x37')],{'$or':_[_0x9b97('0x2b')](_0x1a4bb3,function(_0x45f74b){if(_0x45f74b[_0x9b97('0x39')]!==_0x9b97('0x3a')){var _0xdd671e={};_0xdd671e[_0x45f74b[_0x9b97('0x24')]]={'$like':'%'+_0x4c199e[_0x9b97('0x2d')][_0x9b97('0x36')]+'%'};return _0xdd671e;}})});}_0x1a7a4e=_[_0x9b97('0x38')]({},_0x1a7a4e,_0x4c199e[_0x9b97('0x3b')]);var _0x5b167f={'where':_0x1a7a4e[_0x9b97('0x37')]};return db[_0x9b97('0x26')][_0x9b97('0x18')](_0x5b167f)[_0x9b97('0x20')](function(_0x1d896d){_0x406531['count']=_0x1d896d;if(_0x4c199e[_0x9b97('0x2d')][_0x9b97('0x3c')]){_0x1a7a4e[_0x9b97('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x9b97('0x3e')](_0x1a7a4e);})[_0x9b97('0x20')](function(_0xf2b597){_0x406531[_0x9b97('0x3f')]=_0xf2b597;return _0x406531;})[_0x9b97('0x20')](respondWithFilteredResult(_0x1eaaff,_0x1a7a4e))[_0x9b97('0x40')](handleError(_0x1eaaff,null));};exports['show']=function(_0x363d4c,_0x1ec926){var _0x266212={'raw':!![],'where':{'id':_0x363d4c['params']['id']}},_0x16be82={};_0x16be82[_0x9b97('0x2a')]=_[_0x9b97('0x2c')](db[_0x9b97('0x26')][_0x9b97('0x27')]);_0x16be82[_0x9b97('0x2d')]=_[_0x9b97('0x2c')](_0x363d4c['query']);_0x16be82['filters']=_[_0x9b97('0x2f')](_0x16be82[_0x9b97('0x2a')],_0x16be82[_0x9b97('0x2d')]);_0x266212[_0x9b97('0x30')]=_[_0x9b97('0x2f')](_0x16be82[_0x9b97('0x2a')],qs[_0x9b97('0x31')](_0x363d4c['query'][_0x9b97('0x31')]));_0x266212[_0x9b97('0x30')]=_0x266212[_0x9b97('0x30')]['length']?_0x266212[_0x9b97('0x30')]:_0x16be82[_0x9b97('0x2a')];if(_0x363d4c[_0x9b97('0x2d')][_0x9b97('0x3c')]){_0x266212['include']=[{'all':!![]}];}_0x266212=_['merge']({},_0x266212,_0x363d4c['options']);return db[_0x9b97('0x26')][_0x9b97('0x41')](_0x266212)[_0x9b97('0x20')](handleEntityNotFound(_0x1ec926,null))[_0x9b97('0x20')](respondWithResult(_0x1ec926,null))['catch'](handleError(_0x1ec926,null));};exports[_0x9b97('0x42')]=function(_0x48075b,_0x22c665){return db['JscriptyQuestionReport'][_0x9b97('0x42')](_0x48075b[_0x9b97('0x43')],{})['then'](respondWithResult(_0x22c665,0xc9))['catch'](handleError(_0x22c665,null));};exports[_0x9b97('0x1e')]=function(_0x4846f1,_0x516bdb){if(_0x4846f1[_0x9b97('0x43')]['id']){delete _0x4846f1[_0x9b97('0x43')]['id'];}return db[_0x9b97('0x26')]['find']({'where':{'id':_0x4846f1[_0x9b97('0x44')]['id']}})[_0x9b97('0x20')](handleEntityNotFound(_0x516bdb,null))[_0x9b97('0x20')](saveUpdates(_0x4846f1[_0x9b97('0x43')],null))[_0x9b97('0x20')](respondWithResult(_0x516bdb,null))[_0x9b97('0x40')](handleError(_0x516bdb,null));};exports[_0x9b97('0x1f')]=function(_0x3d1ad2,_0x527dde){return db[_0x9b97('0x26')][_0x9b97('0x41')]({'where':{'id':_0x3d1ad2[_0x9b97('0x44')]['id']}})['then'](handleEntityNotFound(_0x527dde,null))['then'](removeEntity(_0x527dde,null))[_0x9b97('0x40')](handleError(_0x527dde,null));};exports['describe']=function(_0x1908a5,_0x25c540){return db['JscriptyQuestionReport'][_0x9b97('0x45')]()[_0x9b97('0x20')](respondWithResult(_0x25c540,null))[_0x9b97('0x40')](handleError(_0x25c540,null));}; \ No newline at end of file +var _0x61ca=['error','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','intersection','find','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end'];(function(_0x3613e5,_0x2621ce){var _0x1d0ba8=function(_0x2b733d){while(--_0x2b733d){_0x3613e5['push'](_0x3613e5['shift']());}};_0x1d0ba8(++_0x2621ce);}(_0x61ca,0x144));var _0xa61c=function(_0x192bb4,_0x1752d5){_0x192bb4=_0x192bb4-0x0;var _0x27383a=_0x61ca[_0x192bb4];return _0x27383a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa61c('0x0'));var rimraf=require(_0xa61c('0x1'));var zipdir=require(_0xa61c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa61c('0x3'));var moment=require(_0xa61c('0x4'));var BPromise=require(_0xa61c('0x5'));var Mustache=require(_0xa61c('0x6'));var util=require('util');var path=require(_0xa61c('0x7'));var sox=require(_0xa61c('0x8'));var csv=require('to-csv');var ejs=require(_0xa61c('0x9'));var fs=require('fs');var _=require(_0xa61c('0xa'));var squel=require(_0xa61c('0xb'));var crypto=require(_0xa61c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa61c('0xd'));var toCsv=require(_0xa61c('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa61c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa61c('0x10'));var as=require(_0xa61c('0x11'));var hardwareService=require(_0xa61c('0x12'));var logger=require(_0xa61c('0x13'))(_0xa61c('0x14'));var utils=require('../../config/utils');var config=require(_0xa61c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a490a,_0x1e08cc){_0x1e08cc=_0x1e08cc||0xcc;return function(_0x28e07a){if(_0x28e07a){return _0x4a490a[_0xa61c('0x16')](_0x1e08cc);}return _0x4a490a[_0xa61c('0x17')](_0x1e08cc)['end']();};}function respondWithResult(_0x557ea4,_0x3dde4e){_0x3dde4e=_0x3dde4e||0xc8;return function(_0x4ed1c5){if(_0x4ed1c5){return _0x557ea4[_0xa61c('0x17')](_0x3dde4e)[_0xa61c('0x18')](_0x4ed1c5);}};}function respondWithFilteredResult(_0x4b70d7,_0x314819){return function(_0xb9c7e9){if(_0xb9c7e9){var _0xbde982=_0xb9c7e9[_0xa61c('0x19')],_0x1cbce3=_0x314819['offset'],_0x446f5b=_0x314819[_0xa61c('0x1a')]+_0x314819[_0xa61c('0x1b')],_0x4af403;if(_0x446f5b>=_0xbde982){_0x446f5b=_0xbde982;_0x4af403=0xc8;}else{_0x4af403=0xce;}_0x4b70d7['status'](_0x4af403);return _0x4b70d7[_0xa61c('0x1c')]('Content-Range',_0x1cbce3+'-'+_0x446f5b+'/'+_0xbde982)[_0xa61c('0x18')](_0xb9c7e9);}return null;};}function patchUpdates(_0x161a13){return function(_0x4d07d7){try{jsonpatch[_0xa61c('0x1d')](_0x4d07d7,_0x161a13,!![]);}catch(_0x4c78f8){return BPromise[_0xa61c('0x1e')](_0x4c78f8);}return _0x4d07d7[_0xa61c('0x1f')]();};}function saveUpdates(_0x4af58d,_0xbde757){return function(_0x1c9281){if(_0x1c9281){return _0x1c9281[_0xa61c('0x20')](_0x4af58d)[_0xa61c('0x21')](function(_0x2098e4){return _0x2098e4;});}return null;};}function removeEntity(_0x56a93a,_0x3c7450){return function(_0x388441){if(_0x388441){return _0x388441[_0xa61c('0x22')]()['then'](function(){_0x56a93a[_0xa61c('0x17')](0xcc)[_0xa61c('0x23')]();});}};}function handleEntityNotFound(_0x30edff,_0x2175da){return function(_0x17aad8){if(!_0x17aad8){_0x30edff[_0xa61c('0x16')](0x194);}return _0x17aad8;};}function handleError(_0x321055,_0x1ec9a1){_0x1ec9a1=_0x1ec9a1||0x1f4;return function(_0x57a7f8){logger[_0xa61c('0x24')](_0x57a7f8['stack']);if(_0x57a7f8[_0xa61c('0x25')]){delete _0x57a7f8[_0xa61c('0x25')];}_0x321055[_0xa61c('0x17')](_0x1ec9a1)[_0xa61c('0x26')](_0x57a7f8);};}exports[_0xa61c('0x27')]=function(_0x56b63e,_0x178d73){var _0x556fed={},_0x5a113f={},_0x439d27={'count':0x0,'rows':[]};var _0x5afedb=_[_0xa61c('0x28')](db[_0xa61c('0x29')][_0xa61c('0x2a')],function(_0x271574){return{'name':_0x271574[_0xa61c('0x2b')],'type':_0x271574[_0xa61c('0x2c')][_0xa61c('0x2d')]};});_0x5a113f['model']=_[_0xa61c('0x28')](_0x5afedb,'name');_0x5a113f[_0xa61c('0x2e')]=_[_0xa61c('0x2f')](_0x56b63e[_0xa61c('0x2e')]);_0x5a113f[_0xa61c('0x30')]=_['intersection'](_0x5a113f[_0xa61c('0x31')],_0x5a113f[_0xa61c('0x2e')]);_0x556fed[_0xa61c('0x32')]=_['intersection'](_0x5a113f[_0xa61c('0x31')],qs[_0xa61c('0x33')](_0x56b63e[_0xa61c('0x2e')][_0xa61c('0x33')]));_0x556fed[_0xa61c('0x32')]=_0x556fed[_0xa61c('0x32')][_0xa61c('0x34')]?_0x556fed[_0xa61c('0x32')]:_0x5a113f[_0xa61c('0x31')];if(!_0x56b63e[_0xa61c('0x2e')][_0xa61c('0x35')](_0xa61c('0x36'))){_0x556fed[_0xa61c('0x1b')]=qs[_0xa61c('0x1b')](_0x56b63e[_0xa61c('0x2e')][_0xa61c('0x1b')]);_0x556fed['offset']=qs[_0xa61c('0x1a')](_0x56b63e[_0xa61c('0x2e')][_0xa61c('0x1a')]);}_0x556fed[_0xa61c('0x37')]=qs[_0xa61c('0x38')](_0x56b63e[_0xa61c('0x2e')]['sort']);_0x556fed[_0xa61c('0x39')]=qs[_0xa61c('0x30')](_[_0xa61c('0x3a')](_0x56b63e['query'],_0x5a113f[_0xa61c('0x30')]));if(_0x56b63e[_0xa61c('0x2e')][_0xa61c('0x3b')]){_0x556fed[_0xa61c('0x39')]=_[_0xa61c('0x3c')](_0x556fed[_0xa61c('0x39')],{'$or':_[_0xa61c('0x28')](_0x5afedb,function(_0x3526be){if(_0x3526be[_0xa61c('0x2c')]!=='VIRTUAL'){var _0x1aa2d5={};_0x1aa2d5[_0x3526be['name']]={'$like':'%'+_0x56b63e[_0xa61c('0x2e')][_0xa61c('0x3b')]+'%'};return _0x1aa2d5;}})});}_0x556fed=_['merge']({},_0x556fed,_0x56b63e[_0xa61c('0x3d')]);var _0x67d534={'where':_0x556fed[_0xa61c('0x39')]};return db[_0xa61c('0x29')][_0xa61c('0x19')](_0x67d534)[_0xa61c('0x21')](function(_0x3e1a4b){_0x439d27[_0xa61c('0x19')]=_0x3e1a4b;if(_0x56b63e[_0xa61c('0x2e')][_0xa61c('0x3e')]){_0x556fed[_0xa61c('0x3f')]=[{'all':!![]}];}return db[_0xa61c('0x29')]['findAll'](_0x556fed);})[_0xa61c('0x21')](function(_0xfa752d){_0x439d27[_0xa61c('0x40')]=_0xfa752d;return _0x439d27;})[_0xa61c('0x21')](respondWithFilteredResult(_0x178d73,_0x556fed))[_0xa61c('0x41')](handleError(_0x178d73,null));};exports[_0xa61c('0x42')]=function(_0x49f79e,_0x55e718){var _0x243d84={'raw':!![],'where':{'id':_0x49f79e[_0xa61c('0x43')]['id']}},_0x3a29a4={};_0x3a29a4[_0xa61c('0x31')]=_[_0xa61c('0x2f')](db[_0xa61c('0x29')]['rawAttributes']);_0x3a29a4[_0xa61c('0x2e')]=_[_0xa61c('0x2f')](_0x49f79e['query']);_0x3a29a4['filters']=_[_0xa61c('0x44')](_0x3a29a4[_0xa61c('0x31')],_0x3a29a4[_0xa61c('0x2e')]);_0x243d84[_0xa61c('0x32')]=_[_0xa61c('0x44')](_0x3a29a4['model'],qs[_0xa61c('0x33')](_0x49f79e[_0xa61c('0x2e')]['fields']));_0x243d84[_0xa61c('0x32')]=_0x243d84[_0xa61c('0x32')][_0xa61c('0x34')]?_0x243d84[_0xa61c('0x32')]:_0x3a29a4[_0xa61c('0x31')];if(_0x49f79e[_0xa61c('0x2e')]['includeAll']){_0x243d84[_0xa61c('0x3f')]=[{'all':!![]}];}_0x243d84=_[_0xa61c('0x3c')]({},_0x243d84,_0x49f79e[_0xa61c('0x3d')]);return db[_0xa61c('0x29')][_0xa61c('0x45')](_0x243d84)['then'](handleEntityNotFound(_0x55e718,null))[_0xa61c('0x21')](respondWithResult(_0x55e718,null))[_0xa61c('0x41')](handleError(_0x55e718,null));};exports['create']=function(_0x536f86,_0x369b53){return db[_0xa61c('0x29')]['create'](_0x536f86[_0xa61c('0x46')],{})[_0xa61c('0x21')](respondWithResult(_0x369b53,0xc9))[_0xa61c('0x41')](handleError(_0x369b53,null));};exports['update']=function(_0x21b43f,_0x186590){if(_0x21b43f[_0xa61c('0x46')]['id']){delete _0x21b43f[_0xa61c('0x46')]['id'];}return db[_0xa61c('0x29')][_0xa61c('0x45')]({'where':{'id':_0x21b43f['params']['id']}})[_0xa61c('0x21')](handleEntityNotFound(_0x186590,null))[_0xa61c('0x21')](saveUpdates(_0x21b43f[_0xa61c('0x46')],null))[_0xa61c('0x21')](respondWithResult(_0x186590,null))[_0xa61c('0x41')](handleError(_0x186590,null));};exports[_0xa61c('0x22')]=function(_0x4a701,_0x5e9e75){return db[_0xa61c('0x29')]['find']({'where':{'id':_0x4a701[_0xa61c('0x43')]['id']}})[_0xa61c('0x21')](handleEntityNotFound(_0x5e9e75,null))[_0xa61c('0x21')](removeEntity(_0x5e9e75,null))[_0xa61c('0x41')](handleError(_0x5e9e75,null));};exports['describe']=function(_0x427451,_0x1384fa){return db[_0xa61c('0x29')][_0xa61c('0x47')]()[_0xa61c('0x21')](respondWithResult(_0x1384fa,null))[_0xa61c('0x41')](handleError(_0x1384fa,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index a691811..7499d93 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 _0xdac5=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x3e78e0,_0x2c47a9){var _0x55a7d7=function(_0x12f58b){while(--_0x12f58b){_0x3e78e0['push'](_0x3e78e0['shift']());}};_0x55a7d7(++_0x2c47a9);}(_0xdac5,0x14f));var _0x5dac=function(_0x43066c,_0x206ed1){_0x43066c=_0x43066c-0x0;var _0x18f75a=_0xdac5[_0x43066c];return _0x18f75a;};'use strict';var _=require(_0x5dac('0x0'));var util=require(_0x5dac('0x1'));var logger=require(_0x5dac('0x2'))('api');var moment=require(_0x5dac('0x3'));var BPromise=require('bluebird');var rp=require(_0x5dac('0x4'));var fs=require('fs');var path=require(_0x5dac('0x5'));var rimraf=require(_0x5dac('0x6'));var config=require(_0x5dac('0x7'));var attributes=require(_0x5dac('0x8'));module[_0x5dac('0x9')]=function(_0x3315f8,_0x5983e4){return _0x3315f8['define'](_0x5dac('0xa'),attributes,{'tableName':_0x5dac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e9e=['rimraf','../../config/environment','exports','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3c4d45,_0x266496){var _0x197082=function(_0x57a746){while(--_0x57a746){_0x3c4d45['push'](_0x3c4d45['shift']());}};_0x197082(++_0x266496);}(_0x1e9e,0x149));var _0xe1e9=function(_0x371d96,_0x41c3ba){_0x371d96=_0x371d96-0x0;var _0x48857e=_0x1e9e[_0x371d96];return _0x48857e;};'use strict';var _=require('lodash');var util=require(_0xe1e9('0x0'));var logger=require(_0xe1e9('0x1'))(_0xe1e9('0x2'));var moment=require(_0xe1e9('0x3'));var BPromise=require(_0xe1e9('0x4'));var rp=require(_0xe1e9('0x5'));var fs=require('fs');var path=require(_0xe1e9('0x6'));var rimraf=require(_0xe1e9('0x7'));var config=require(_0xe1e9('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xe1e9('0x9')]=function(_0x95ba1b,_0x536d12){return _0x95ba1b['define'](_0xe1e9('0xa'),attributes,{'tableName':_0xe1e9('0xb'),'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 b3d4f02..59b3487 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 _0x9fdf=['client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x412a0f,_0x3d3990){var _0x4750e4=function(_0x5ab2a8){while(--_0x5ab2a8){_0x412a0f['push'](_0x412a0f['shift']());}};_0x4750e4(++_0x3d3990);}(_0x9fdf,0xb7));var _0xf9fd=function(_0x6398b5,_0x2df8a7){_0x6398b5=_0x6398b5-0x0;var _0x4a735f=_0x9fdf[_0x6398b5];return _0x4a735f;};'use strict';var _=require(_0xf9fd('0x0'));var util=require('util');var moment=require(_0xf9fd('0x1'));var BPromise=require(_0xf9fd('0x2'));var rs=require(_0xf9fd('0x3'));var fs=require('fs');var Redis=require(_0xf9fd('0x4'));var db=require(_0xf9fd('0x5'))['db'];var utils=require(_0xf9fd('0x6'));var logger=require('../../config/logger')(_0xf9fd('0x7'));var config=require(_0xf9fd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf9fd('0x9')][_0xf9fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d261a,_0xded663,_0x453d9c){return new BPromise(function(_0x22fde1,_0xd6ecf5){return client[_0xf9fd('0xb')](_0x5d261a,_0x453d9c)[_0xf9fd('0xc')](function(_0xeb4bec){logger[_0xf9fd('0xd')](_0xf9fd('0xe'),_0xded663,_0xf9fd('0xf'));logger[_0xf9fd('0x10')](_0xf9fd('0x11'),_0xded663,_0xf9fd('0xf'),JSON[_0xf9fd('0x12')](_0xeb4bec));if(_0xeb4bec[_0xf9fd('0x13')]){if(_0xeb4bec['error'][_0xf9fd('0x14')]===0x1f4){logger[_0xf9fd('0x13')](_0xf9fd('0xe'),_0xded663,_0xeb4bec['error'][_0xf9fd('0x15')]);return _0xd6ecf5(_0xeb4bec[_0xf9fd('0x13')]['message']);}logger[_0xf9fd('0x13')](_0xf9fd('0xe'),_0xded663,_0xeb4bec['error'][_0xf9fd('0x15')]);return _0x22fde1(_0xeb4bec['error'][_0xf9fd('0x15')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0xded663,_0xf9fd('0xf'));_0x22fde1(_0xeb4bec[_0xf9fd('0x16')][_0xf9fd('0x15')]);}})[_0xf9fd('0x17')](function(_0x465a6f){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0xded663,_0x465a6f);_0xd6ecf5(_0x465a6f);});});} \ No newline at end of file +var _0x930b=['result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5dbe23,_0x12d1cf){var _0x1831f3=function(_0x84d829){while(--_0x84d829){_0x5dbe23['push'](_0x5dbe23['shift']());}};_0x1831f3(++_0x12d1cf);}(_0x930b,0x1e6));var _0xb930=function(_0x338e4f,_0x279759){_0x338e4f=_0x338e4f-0x0;var _0x253426=_0x930b[_0x338e4f];return _0x253426;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb930('0x0'));var BPromise=require(_0xb930('0x1'));var rs=require(_0xb930('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb930('0x3'))['db'];var utils=require(_0xb930('0x4'));var logger=require(_0xb930('0x5'))(_0xb930('0x6'));var config=require(_0xb930('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb930('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xad8e64,_0x507b95,_0x3a62df){return new BPromise(function(_0x162c44,_0x2c8262){return client[_0xb930('0x9')](_0xad8e64,_0x3a62df)[_0xb930('0xa')](function(_0x58178b){logger[_0xb930('0xb')](_0xb930('0xc'),_0x507b95,_0xb930('0xd'));logger[_0xb930('0xe')](_0xb930('0xf'),_0x507b95,_0xb930('0xd'),JSON[_0xb930('0x10')](_0x58178b));if(_0x58178b[_0xb930('0x11')]){if(_0x58178b['error'][_0xb930('0x12')]===0x1f4){logger[_0xb930('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x507b95,_0x58178b[_0xb930('0x11')][_0xb930('0x13')]);return _0x2c8262(_0x58178b[_0xb930('0x11')][_0xb930('0x13')]);}logger[_0xb930('0x11')](_0xb930('0xc'),_0x507b95,_0x58178b[_0xb930('0x11')]['message']);return _0x162c44(_0x58178b[_0xb930('0x11')][_0xb930('0x13')]);}else{logger[_0xb930('0xb')](_0xb930('0xc'),_0x507b95,'request\x20sent');_0x162c44(_0x58178b[_0xb930('0x14')][_0xb930('0x13')]);}})[_0xb930('0x15')](function(_0xf6d500){logger[_0xb930('0x11')](_0xb930('0xc'),_0x507b95,_0xf6d500);_0x2c8262(_0xf6d500);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 7abb3c7..69d769a 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 _0x46fc=['/:id','show','/:id/questions','getQuestions','create','put','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x1873fa,_0x38add2){var _0x159108=function(_0x34afda){while(--_0x34afda){_0x1873fa['push'](_0x1873fa['shift']());}};_0x159108(++_0x38add2);}(_0x46fc,0x103));var _0xc46f=function(_0x59e86d,_0x220320){_0x59e86d=_0x59e86d-0x0;var _0xa22e60=_0x46fc[_0x59e86d];return _0xa22e60;};'use strict';var multer=require(_0xc46f('0x0'));var util=require(_0xc46f('0x1'));var path=require(_0xc46f('0x2'));var timeout=require(_0xc46f('0x3'));var express=require(_0xc46f('0x4'));var router=express[_0xc46f('0x5')]();var auth=require(_0xc46f('0x6'));var interaction=require(_0xc46f('0x7'));var config=require(_0xc46f('0x8'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0xc46f('0x9')](),controller[_0xc46f('0xa')]);router[_0xc46f('0xb')](_0xc46f('0xc'),auth[_0xc46f('0x9')](),controller[_0xc46f('0xd')]);router[_0xc46f('0xb')](_0xc46f('0xe'),auth[_0xc46f('0x9')](),controller[_0xc46f('0xf')]);router[_0xc46f('0xb')](_0xc46f('0x10'),auth[_0xc46f('0x9')](),controller[_0xc46f('0x11')]);router['post']('/',auth[_0xc46f('0x9')](),controller[_0xc46f('0x12')]);router[_0xc46f('0x13')](_0xc46f('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc46f('0xe'),auth[_0xc46f('0x9')](),controller['destroy']);module[_0xc46f('0x14')]=router; \ No newline at end of file +var _0xc5c7=['../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','show','getQuestions','put','update','/:id','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x2bdcb4,_0xf9cd0){var _0x5f04d9=function(_0x2a5a53){while(--_0x2a5a53){_0x2bdcb4['push'](_0x2bdcb4['shift']());}};_0x5f04d9(++_0xf9cd0);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x168be6,_0x331bd0){_0x168be6=_0x168be6-0x0;var _0x343ab4=_0xc5c7[_0x168be6];return _0x343ab4;};'use strict';var multer=require('multer');var util=require(_0x7c5c('0x0'));var path=require(_0x7c5c('0x1'));var timeout=require(_0x7c5c('0x2'));var express=require(_0x7c5c('0x3'));var router=express[_0x7c5c('0x4')]();var auth=require(_0x7c5c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7c5c('0x6'));var controller=require(_0x7c5c('0x7'));router[_0x7c5c('0x8')]('/',auth[_0x7c5c('0x9')](),controller[_0x7c5c('0xa')]);router['get']('/describe',auth[_0x7c5c('0x9')](),controller['describe']);router[_0x7c5c('0x8')]('/:id',auth[_0x7c5c('0x9')](),controller[_0x7c5c('0xb')]);router['get']('/:id/questions',auth[_0x7c5c('0x9')](),controller[_0x7c5c('0xc')]);router['post']('/',auth[_0x7c5c('0x9')](),controller['create']);router[_0x7c5c('0xd')]('/:id',auth[_0x7c5c('0x9')](),controller[_0x7c5c('0xe')]);router['delete'](_0x7c5c('0xf'),auth[_0x7c5c('0x9')](),controller[_0x7c5c('0x10')]);module[_0x7c5c('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index da1f8d3..9532bac 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 _0x6c48=['setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','DATE'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x6c48,0x12e));var _0x86c4=function(_0x402b1f,_0x3df329){_0x402b1f=_0x402b1f-0x0;var _0x5d22f2=_0x6c48[_0x402b1f];return _0x5d22f2;};'use strict';var moment=require(_0x86c4('0x0'));var Sequelize=require(_0x86c4('0x1'));module[_0x86c4('0x2')]={'starttime':{'type':Sequelize[_0x86c4('0x3')],'set':function(_0x178c3f){this['setDataValue']('starttime',_0x178c3f);this[_0x86c4('0x4')](_0x86c4('0x5'),moment()[_0x86c4('0x6')](_0x86c4('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x86c4('0x8')]},'uniqueid':{'type':Sequelize[_0x86c4('0x8')]},'calleridname':{'type':Sequelize[_0x86c4('0x8')]},'calleridnum':{'type':Sequelize[_0x86c4('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc1b7=['STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x25ab44,_0x507a53){var _0x4a21d7=function(_0x7cb25d){while(--_0x7cb25d){_0x25ab44['push'](_0x25ab44['shift']());}};_0x4a21d7(++_0x507a53);}(_0xc1b7,0xa4));var _0x7c1b=function(_0x261a4a,_0x389a4f){_0x261a4a=_0x261a4a-0x0;var _0xc8d5b4=_0xc1b7[_0x261a4a];return _0xc8d5b4;};'use strict';var moment=require(_0x7c1b('0x0'));var Sequelize=require(_0x7c1b('0x1'));module[_0x7c1b('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x20d3e1){this[_0x7c1b('0x3')](_0x7c1b('0x4'),_0x20d3e1);this[_0x7c1b('0x3')](_0x7c1b('0x5'),moment()['format'](_0x7c1b('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x7c1b('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7c1b('0x7')]},'uniqueid':{'type':Sequelize[_0x7c1b('0x7')]},'calleridname':{'type':Sequelize[_0x7c1b('0x7')]},'calleridnum':{'type':Sequelize[_0x7c1b('0x7')]},'completed':{'type':Sequelize[_0x7c1b('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 6b57bd9..027f2cf 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 _0x1d8d=['util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','end','status','json','offset','limit','set','Content-Range','save','then','destroy','sendStatus','error','send','index','map','JscriptySessionReport','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','count','includeAll','include','rows','catch','show','params','options','find','create','body','update','describe','findOne','JscriptyQuestionReport','sort','SessionId','findAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x1d8d,0x1c6));var _0xd1d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d8d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd1d8('0x0'));var emlformat=require(_0xd1d8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd1d8('0x2'));var jsonpatch=require(_0xd1d8('0x3'));var rp=require(_0xd1d8('0x4'));var moment=require(_0xd1d8('0x5'));var BPromise=require(_0xd1d8('0x6'));var Mustache=require(_0xd1d8('0x7'));var util=require(_0xd1d8('0x8'));var path=require(_0xd1d8('0x9'));var sox=require(_0xd1d8('0xa'));var csv=require(_0xd1d8('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd1d8('0xc'));var squel=require(_0xd1d8('0xd'));var crypto=require(_0xd1d8('0xe'));var jsforce=require(_0xd1d8('0xf'));var deskjs=require(_0xd1d8('0x10'));var toCsv=require(_0xd1d8('0xb'));var querystring=require(_0xd1d8('0x11'));var Papa=require(_0xd1d8('0x12'));var Redis=require(_0xd1d8('0x13'));var authService=require(_0xd1d8('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd1d8('0x15'));var hardwareService=require(_0xd1d8('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd1d8('0x17'))['db'];function respondWithStatusCode(_0x18de22,_0x1ebda5){_0x1ebda5=_0x1ebda5||0xcc;return function(_0x408bc4){if(_0x408bc4){return _0x18de22['sendStatus'](_0x1ebda5);}return _0x18de22['status'](_0x1ebda5)[_0xd1d8('0x18')]();};}function respondWithResult(_0x12f055,_0x27d375){_0x27d375=_0x27d375||0xc8;return function(_0x1891d2){if(_0x1891d2){return _0x12f055[_0xd1d8('0x19')](_0x27d375)[_0xd1d8('0x1a')](_0x1891d2);}};}function respondWithFilteredResult(_0x30d8b0,_0x2aa578){return function(_0x292e49){if(_0x292e49){var _0x2fec21=_0x292e49['count'],_0x2d551b=_0x2aa578[_0xd1d8('0x1b')],_0x5b6327=_0x2aa578[_0xd1d8('0x1b')]+_0x2aa578[_0xd1d8('0x1c')],_0x2c7fb4;if(_0x5b6327>=_0x2fec21){_0x5b6327=_0x2fec21;_0x2c7fb4=0xc8;}else{_0x2c7fb4=0xce;}_0x30d8b0[_0xd1d8('0x19')](_0x2c7fb4);return _0x30d8b0[_0xd1d8('0x1d')](_0xd1d8('0x1e'),_0x2d551b+'-'+_0x5b6327+'/'+_0x2fec21)[_0xd1d8('0x1a')](_0x292e49);}return null;};}function patchUpdates(_0x133d04){return function(_0x5e0836){try{jsonpatch['apply'](_0x5e0836,_0x133d04,!![]);}catch(_0xa8a302){return BPromise['reject'](_0xa8a302);}return _0x5e0836[_0xd1d8('0x1f')]();};}function saveUpdates(_0x441697,_0x11eeff){return function(_0x3d2d20){if(_0x3d2d20){return _0x3d2d20['update'](_0x441697)[_0xd1d8('0x20')](function(_0x37f5bd){return _0x37f5bd;});}return null;};}function removeEntity(_0x344679,_0x3b8101){return function(_0x5872e2){if(_0x5872e2){return _0x5872e2[_0xd1d8('0x21')]()['then'](function(){_0x344679[_0xd1d8('0x19')](0xcc)[_0xd1d8('0x18')]();});}};}function handleEntityNotFound(_0x489df8,_0x4c4257){return function(_0x347c1f){if(!_0x347c1f){_0x489df8[_0xd1d8('0x22')](0x194);}return _0x347c1f;};}function handleError(_0x51baeb,_0x57a4f8){_0x57a4f8=_0x57a4f8||0x1f4;return function(_0x4c245a){logger[_0xd1d8('0x23')](_0x4c245a['stack']);if(_0x4c245a['name']){delete _0x4c245a['name'];}_0x51baeb['status'](_0x57a4f8)[_0xd1d8('0x24')](_0x4c245a);};}exports[_0xd1d8('0x25')]=function(_0x205167,_0x175c2f){var _0x5643af={},_0x396784={},_0xe07285={'count':0x0,'rows':[]};var _0xbe208d=_[_0xd1d8('0x26')](db[_0xd1d8('0x27')][_0xd1d8('0x28')],function(_0x55f95d){return{'name':_0x55f95d['fieldName'],'type':_0x55f95d[_0xd1d8('0x29')][_0xd1d8('0x2a')]};});_0x396784[_0xd1d8('0x2b')]=_[_0xd1d8('0x26')](_0xbe208d,_0xd1d8('0x2c'));_0x396784[_0xd1d8('0x2d')]=_[_0xd1d8('0x2e')](_0x205167[_0xd1d8('0x2d')]);_0x396784[_0xd1d8('0x2f')]=_[_0xd1d8('0x30')](_0x396784['model'],_0x396784[_0xd1d8('0x2d')]);_0x5643af[_0xd1d8('0x31')]=_['intersection'](_0x396784[_0xd1d8('0x2b')],qs[_0xd1d8('0x32')](_0x205167[_0xd1d8('0x2d')][_0xd1d8('0x32')]));_0x5643af[_0xd1d8('0x31')]=_0x5643af[_0xd1d8('0x31')][_0xd1d8('0x33')]?_0x5643af[_0xd1d8('0x31')]:_0x396784[_0xd1d8('0x2b')];if(!_0x205167[_0xd1d8('0x2d')][_0xd1d8('0x34')](_0xd1d8('0x35'))){_0x5643af['limit']=qs[_0xd1d8('0x1c')](_0x205167[_0xd1d8('0x2d')][_0xd1d8('0x1c')]);_0x5643af[_0xd1d8('0x1b')]=qs['offset'](_0x205167[_0xd1d8('0x2d')][_0xd1d8('0x1b')]);}_0x5643af[_0xd1d8('0x36')]=qs['sort'](_0x205167[_0xd1d8('0x2d')]['sort']);_0x5643af[_0xd1d8('0x37')]=qs['filters'](_[_0xd1d8('0x38')](_0x205167[_0xd1d8('0x2d')],_0x396784[_0xd1d8('0x2f')]));if(_0x205167[_0xd1d8('0x2d')][_0xd1d8('0x39')]){_0x5643af[_0xd1d8('0x37')]=_[_0xd1d8('0x3a')](_0x5643af[_0xd1d8('0x37')],{'$or':_[_0xd1d8('0x26')](_0xbe208d,function(_0x1c371c){if(_0x1c371c['type']!=='VIRTUAL'){var _0x3ccfba={};_0x3ccfba[_0x1c371c[_0xd1d8('0x2c')]]={'$like':'%'+_0x205167[_0xd1d8('0x2d')][_0xd1d8('0x39')]+'%'};return _0x3ccfba;}})});}_0x5643af=_[_0xd1d8('0x3a')]({},_0x5643af,_0x205167['options']);var _0x2e9017={'where':_0x5643af[_0xd1d8('0x37')]};return db[_0xd1d8('0x27')][_0xd1d8('0x3b')](_0x2e9017)[_0xd1d8('0x20')](function(_0x969bc4){_0xe07285[_0xd1d8('0x3b')]=_0x969bc4;if(_0x205167['query'][_0xd1d8('0x3c')]){_0x5643af[_0xd1d8('0x3d')]=[{'all':!![]}];}return db[_0xd1d8('0x27')]['findAll'](_0x5643af);})['then'](function(_0x43f851){_0xe07285[_0xd1d8('0x3e')]=_0x43f851;return _0xe07285;})['then'](respondWithFilteredResult(_0x175c2f,_0x5643af))[_0xd1d8('0x3f')](handleError(_0x175c2f,null));};exports[_0xd1d8('0x40')]=function(_0x580950,_0xf0841e){var _0x3bdbf7={'raw':!![],'where':{'id':_0x580950[_0xd1d8('0x41')]['id']}},_0x389a3c={};_0x389a3c[_0xd1d8('0x2b')]=_['keys'](db[_0xd1d8('0x27')]['rawAttributes']);_0x389a3c['query']=_[_0xd1d8('0x2e')](_0x580950[_0xd1d8('0x2d')]);_0x389a3c[_0xd1d8('0x2f')]=_['intersection'](_0x389a3c[_0xd1d8('0x2b')],_0x389a3c[_0xd1d8('0x2d')]);_0x3bdbf7[_0xd1d8('0x31')]=_[_0xd1d8('0x30')](_0x389a3c['model'],qs[_0xd1d8('0x32')](_0x580950[_0xd1d8('0x2d')][_0xd1d8('0x32')]));_0x3bdbf7[_0xd1d8('0x31')]=_0x3bdbf7[_0xd1d8('0x31')]['length']?_0x3bdbf7[_0xd1d8('0x31')]:_0x389a3c[_0xd1d8('0x2b')];if(_0x580950[_0xd1d8('0x2d')]['includeAll']){_0x3bdbf7['include']=[{'all':!![]}];}_0x3bdbf7=_[_0xd1d8('0x3a')]({},_0x3bdbf7,_0x580950[_0xd1d8('0x42')]);return db[_0xd1d8('0x27')][_0xd1d8('0x43')](_0x3bdbf7)['then'](handleEntityNotFound(_0xf0841e,null))[_0xd1d8('0x20')](respondWithResult(_0xf0841e,null))[_0xd1d8('0x3f')](handleError(_0xf0841e,null));};exports[_0xd1d8('0x44')]=function(_0x2c9de5,_0x326a86){return db[_0xd1d8('0x27')]['create'](_0x2c9de5[_0xd1d8('0x45')],{})[_0xd1d8('0x20')](respondWithResult(_0x326a86,0xc9))[_0xd1d8('0x3f')](handleError(_0x326a86,null));};exports[_0xd1d8('0x46')]=function(_0x4ce6c8,_0xae9a7c){if(_0x4ce6c8[_0xd1d8('0x45')]['id']){delete _0x4ce6c8[_0xd1d8('0x45')]['id'];}return db['JscriptySessionReport'][_0xd1d8('0x43')]({'where':{'id':_0x4ce6c8[_0xd1d8('0x41')]['id']}})[_0xd1d8('0x20')](handleEntityNotFound(_0xae9a7c,null))[_0xd1d8('0x20')](saveUpdates(_0x4ce6c8[_0xd1d8('0x45')],null))['then'](respondWithResult(_0xae9a7c,null))['catch'](handleError(_0xae9a7c,null));};exports['destroy']=function(_0x20d53f,_0x3bbaab){return db[_0xd1d8('0x27')][_0xd1d8('0x43')]({'where':{'id':_0x20d53f['params']['id']}})['then'](handleEntityNotFound(_0x3bbaab,null))[_0xd1d8('0x20')](removeEntity(_0x3bbaab,null))[_0xd1d8('0x3f')](handleError(_0x3bbaab,null));};exports[_0xd1d8('0x47')]=function(_0x507b29,_0x4498d1){return db[_0xd1d8('0x27')][_0xd1d8('0x47')]()['then'](respondWithResult(_0x4498d1,null))['catch'](handleError(_0x4498d1,null));};exports['getQuestions']=function(_0x3125bd,_0x1d5422,_0x58efb1){var _0x1d48c2={'raw':!![],'where':{}};var _0x15be98={};var _0x5c18aa={'count':0x0,'rows':[]};return db[_0xd1d8('0x27')][_0xd1d8('0x48')]({'where':{'id':_0x3125bd[_0xd1d8('0x41')]['id']}})['then'](handleEntityNotFound(_0x1d5422,null))[_0xd1d8('0x20')](function(_0x1733f6){if(_0x1733f6){_0x15be98[_0xd1d8('0x2b')]=_['keys'](db[_0xd1d8('0x49')]['rawAttributes']);_0x15be98[_0xd1d8('0x2d')]=_[_0xd1d8('0x2e')](_0x3125bd[_0xd1d8('0x2d')]);_0x15be98[_0xd1d8('0x2f')]=_[_0xd1d8('0x30')](_0x15be98[_0xd1d8('0x2b')],_0x15be98[_0xd1d8('0x2d')]);_0x1d48c2[_0xd1d8('0x31')]=_[_0xd1d8('0x30')](_0x15be98[_0xd1d8('0x2b')],qs[_0xd1d8('0x32')](_0x3125bd[_0xd1d8('0x2d')]['fields']));_0x1d48c2[_0xd1d8('0x31')]=_0x1d48c2[_0xd1d8('0x31')][_0xd1d8('0x33')]?_0x1d48c2[_0xd1d8('0x31')]:_0x15be98['model'];if(!_0x3125bd[_0xd1d8('0x2d')][_0xd1d8('0x34')](_0xd1d8('0x35'))){_0x1d48c2[_0xd1d8('0x1c')]=qs['limit'](_0x3125bd[_0xd1d8('0x2d')][_0xd1d8('0x1c')]);_0x1d48c2[_0xd1d8('0x1b')]=qs[_0xd1d8('0x1b')](_0x3125bd[_0xd1d8('0x2d')][_0xd1d8('0x1b')]);}_0x1d48c2[_0xd1d8('0x36')]=qs[_0xd1d8('0x4a')](_0x3125bd['query']['sort']);_0x1d48c2[_0xd1d8('0x37')]=qs['filters'](_[_0xd1d8('0x38')](_0x3125bd[_0xd1d8('0x2d')],_0x15be98[_0xd1d8('0x2f')]));_0x1d48c2[_0xd1d8('0x37')][_0xd1d8('0x4b')]=_0x1733f6['id'];if(_0x3125bd[_0xd1d8('0x2d')][_0xd1d8('0x39')]){_0x1d48c2[_0xd1d8('0x37')]=_['merge'](_0x1d48c2['where'],{'$or':_['map'](_0x1d48c2[_0xd1d8('0x31')],function(_0x14c27){var _0x25e845={};_0x25e845[_0x14c27]={'$like':'%'+_0x3125bd[_0xd1d8('0x2d')][_0xd1d8('0x39')]+'%'};return _0x25e845;})});}_0x1d48c2=_[_0xd1d8('0x3a')]({},_0x1d48c2,_0x3125bd[_0xd1d8('0x42')]);return db[_0xd1d8('0x49')][_0xd1d8('0x3b')]({'where':_0x1d48c2[_0xd1d8('0x37')]})[_0xd1d8('0x20')](function(_0x30ec7d){_0x5c18aa[_0xd1d8('0x3b')]=_0x30ec7d;if(_0x3125bd[_0xd1d8('0x2d')][_0xd1d8('0x3c')]){_0x1d48c2[_0xd1d8('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xd1d8('0x4c')](_0x1d48c2);})[_0xd1d8('0x20')](function(_0x14d6db){_0x5c18aa[_0xd1d8('0x3e')]=_0x14d6db;return _0x5c18aa;});}})[_0xd1d8('0x20')](respondWithFilteredResult(_0x1d5422,_0x1d48c2))['catch'](handleError(_0x1d5422,null));}; \ No newline at end of file +var _0xd1d8=['fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','length','find','body','params','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','options','rows','html-pdf','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd1d8,0x16f));var _0x8d1d=function(_0xf1bf12,_0x4558e4){_0xf1bf12=_0xf1bf12-0x0;var _0x340ce8=_0xd1d8[_0xf1bf12];return _0x340ce8;};'use strict';var pdf=require(_0x8d1d('0x0'));var emlformat=require(_0x8d1d('0x1'));var rimraf=require(_0x8d1d('0x2'));var zipdir=require(_0x8d1d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d1d('0x4'));var moment=require(_0x8d1d('0x5'));var BPromise=require(_0x8d1d('0x6'));var Mustache=require('mustache');var util=require(_0x8d1d('0x7'));var path=require(_0x8d1d('0x8'));var sox=require(_0x8d1d('0x9'));var csv=require(_0x8d1d('0xa'));var ejs=require(_0x8d1d('0xb'));var fs=require('fs');var _=require(_0x8d1d('0xc'));var squel=require(_0x8d1d('0xd'));var crypto=require(_0x8d1d('0xe'));var jsforce=require(_0x8d1d('0xf'));var deskjs=require(_0x8d1d('0x10'));var toCsv=require(_0x8d1d('0xa'));var querystring=require(_0x8d1d('0x11'));var Papa=require(_0x8d1d('0x12'));var Redis=require(_0x8d1d('0x13'));var authService=require(_0x8d1d('0x14'));var qs=require(_0x8d1d('0x15'));var as=require(_0x8d1d('0x16'));var hardwareService=require(_0x8d1d('0x17'));var logger=require(_0x8d1d('0x18'))(_0x8d1d('0x19'));var utils=require(_0x8d1d('0x1a'));var config=require(_0x8d1d('0x1b'));var db=require(_0x8d1d('0x1c'))['db'];function respondWithStatusCode(_0x484e0d,_0x13d979){_0x13d979=_0x13d979||0xcc;return function(_0x404af7){if(_0x404af7){return _0x484e0d[_0x8d1d('0x1d')](_0x13d979);}return _0x484e0d[_0x8d1d('0x1e')](_0x13d979)['end']();};}function respondWithResult(_0x2a4aef,_0x54a3ad){_0x54a3ad=_0x54a3ad||0xc8;return function(_0x1d50d8){if(_0x1d50d8){return _0x2a4aef[_0x8d1d('0x1e')](_0x54a3ad)[_0x8d1d('0x1f')](_0x1d50d8);}};}function respondWithFilteredResult(_0x35b118,_0x18e2e0){return function(_0x3d8f2b){if(_0x3d8f2b){var _0x38b85a=_0x3d8f2b['count'],_0x4cee02=_0x18e2e0['offset'],_0x116df0=_0x18e2e0[_0x8d1d('0x20')]+_0x18e2e0[_0x8d1d('0x21')],_0x2195ca;if(_0x116df0>=_0x38b85a){_0x116df0=_0x38b85a;_0x2195ca=0xc8;}else{_0x2195ca=0xce;}_0x35b118[_0x8d1d('0x1e')](_0x2195ca);return _0x35b118['set'](_0x8d1d('0x22'),_0x4cee02+'-'+_0x116df0+'/'+_0x38b85a)[_0x8d1d('0x1f')](_0x3d8f2b);}return null;};}function patchUpdates(_0x535be0){return function(_0x3611b7){try{jsonpatch[_0x8d1d('0x23')](_0x3611b7,_0x535be0,!![]);}catch(_0xe0fab5){return BPromise['reject'](_0xe0fab5);}return _0x3611b7[_0x8d1d('0x24')]();};}function saveUpdates(_0x1bc07f,_0xb2642f){return function(_0x1759ef){if(_0x1759ef){return _0x1759ef[_0x8d1d('0x25')](_0x1bc07f)[_0x8d1d('0x26')](function(_0x520afe){return _0x520afe;});}return null;};}function removeEntity(_0x1f3b79,_0x3c2266){return function(_0x154ad2){if(_0x154ad2){return _0x154ad2['destroy']()[_0x8d1d('0x26')](function(){_0x1f3b79[_0x8d1d('0x1e')](0xcc)[_0x8d1d('0x27')]();});}};}function handleEntityNotFound(_0x5d163c,_0x1f1058){return function(_0x4c17f0){if(!_0x4c17f0){_0x5d163c[_0x8d1d('0x1d')](0x194);}return _0x4c17f0;};}function handleError(_0x58ab10,_0xa824a5){_0xa824a5=_0xa824a5||0x1f4;return function(_0x4b383){logger[_0x8d1d('0x28')](_0x4b383[_0x8d1d('0x29')]);if(_0x4b383[_0x8d1d('0x2a')]){delete _0x4b383[_0x8d1d('0x2a')];}_0x58ab10['status'](_0xa824a5)[_0x8d1d('0x2b')](_0x4b383);};}exports[_0x8d1d('0x2c')]=function(_0x220ffd,_0x48bbcb){var _0x2c5d63={},_0x37d22c={},_0x179403={'count':0x0,'rows':[]};var _0x224e5c=_[_0x8d1d('0x2d')](db[_0x8d1d('0x2e')][_0x8d1d('0x2f')],function(_0x54355e){return{'name':_0x54355e[_0x8d1d('0x30')],'type':_0x54355e[_0x8d1d('0x31')][_0x8d1d('0x32')]};});_0x37d22c[_0x8d1d('0x33')]=_[_0x8d1d('0x2d')](_0x224e5c,_0x8d1d('0x2a'));_0x37d22c[_0x8d1d('0x34')]=_[_0x8d1d('0x35')](_0x220ffd[_0x8d1d('0x34')]);_0x37d22c['filters']=_[_0x8d1d('0x36')](_0x37d22c[_0x8d1d('0x33')],_0x37d22c[_0x8d1d('0x34')]);_0x2c5d63['attributes']=_[_0x8d1d('0x36')](_0x37d22c[_0x8d1d('0x33')],qs['fields'](_0x220ffd[_0x8d1d('0x34')][_0x8d1d('0x37')]));_0x2c5d63[_0x8d1d('0x38')]=_0x2c5d63[_0x8d1d('0x38')]['length']?_0x2c5d63[_0x8d1d('0x38')]:_0x37d22c[_0x8d1d('0x33')];if(!_0x220ffd[_0x8d1d('0x34')][_0x8d1d('0x39')]('nolimit')){_0x2c5d63[_0x8d1d('0x21')]=qs[_0x8d1d('0x21')](_0x220ffd['query'][_0x8d1d('0x21')]);_0x2c5d63['offset']=qs[_0x8d1d('0x20')](_0x220ffd[_0x8d1d('0x34')][_0x8d1d('0x20')]);}_0x2c5d63[_0x8d1d('0x3a')]=qs['sort'](_0x220ffd[_0x8d1d('0x34')][_0x8d1d('0x3b')]);_0x2c5d63[_0x8d1d('0x3c')]=qs['filters'](_[_0x8d1d('0x3d')](_0x220ffd['query'],_0x37d22c[_0x8d1d('0x3e')]));if(_0x220ffd[_0x8d1d('0x34')][_0x8d1d('0x3f')]){_0x2c5d63[_0x8d1d('0x3c')]=_[_0x8d1d('0x40')](_0x2c5d63[_0x8d1d('0x3c')],{'$or':_['map'](_0x224e5c,function(_0x270cc4){if(_0x270cc4[_0x8d1d('0x31')]!==_0x8d1d('0x41')){var _0x346238={};_0x346238[_0x270cc4[_0x8d1d('0x2a')]]={'$like':'%'+_0x220ffd['query'][_0x8d1d('0x3f')]+'%'};return _0x346238;}})});}_0x2c5d63=_[_0x8d1d('0x40')]({},_0x2c5d63,_0x220ffd['options']);var _0xa46a7d={'where':_0x2c5d63[_0x8d1d('0x3c')]};return db[_0x8d1d('0x2e')][_0x8d1d('0x42')](_0xa46a7d)[_0x8d1d('0x26')](function(_0x347e8c){_0x179403[_0x8d1d('0x42')]=_0x347e8c;if(_0x220ffd[_0x8d1d('0x34')][_0x8d1d('0x43')]){_0x2c5d63[_0x8d1d('0x44')]=[{'all':!![]}];}return db[_0x8d1d('0x2e')][_0x8d1d('0x45')](_0x2c5d63);})[_0x8d1d('0x26')](function(_0x23ffea){_0x179403['rows']=_0x23ffea;return _0x179403;})[_0x8d1d('0x26')](respondWithFilteredResult(_0x48bbcb,_0x2c5d63))[_0x8d1d('0x46')](handleError(_0x48bbcb,null));};exports[_0x8d1d('0x47')]=function(_0x1bf239,_0x442e9f){var _0x57a573={'raw':!![],'where':{'id':_0x1bf239['params']['id']}},_0x3a21ea={};_0x3a21ea[_0x8d1d('0x33')]=_[_0x8d1d('0x35')](db['JscriptySessionReport']['rawAttributes']);_0x3a21ea[_0x8d1d('0x34')]=_[_0x8d1d('0x35')](_0x1bf239[_0x8d1d('0x34')]);_0x3a21ea[_0x8d1d('0x3e')]=_[_0x8d1d('0x36')](_0x3a21ea[_0x8d1d('0x33')],_0x3a21ea[_0x8d1d('0x34')]);_0x57a573[_0x8d1d('0x38')]=_[_0x8d1d('0x36')](_0x3a21ea[_0x8d1d('0x33')],qs[_0x8d1d('0x37')](_0x1bf239[_0x8d1d('0x34')]['fields']));_0x57a573[_0x8d1d('0x38')]=_0x57a573[_0x8d1d('0x38')][_0x8d1d('0x48')]?_0x57a573[_0x8d1d('0x38')]:_0x3a21ea[_0x8d1d('0x33')];if(_0x1bf239[_0x8d1d('0x34')][_0x8d1d('0x43')]){_0x57a573[_0x8d1d('0x44')]=[{'all':!![]}];}_0x57a573=_[_0x8d1d('0x40')]({},_0x57a573,_0x1bf239['options']);return db[_0x8d1d('0x2e')][_0x8d1d('0x49')](_0x57a573)[_0x8d1d('0x26')](handleEntityNotFound(_0x442e9f,null))[_0x8d1d('0x26')](respondWithResult(_0x442e9f,null))[_0x8d1d('0x46')](handleError(_0x442e9f,null));};exports['create']=function(_0x213de5,_0xe766c0){return db[_0x8d1d('0x2e')]['create'](_0x213de5[_0x8d1d('0x4a')],{})[_0x8d1d('0x26')](respondWithResult(_0xe766c0,0xc9))['catch'](handleError(_0xe766c0,null));};exports[_0x8d1d('0x25')]=function(_0x377bd0,_0xf7a9c0){if(_0x377bd0[_0x8d1d('0x4a')]['id']){delete _0x377bd0[_0x8d1d('0x4a')]['id'];}return db[_0x8d1d('0x2e')][_0x8d1d('0x49')]({'where':{'id':_0x377bd0[_0x8d1d('0x4b')]['id']}})[_0x8d1d('0x26')](handleEntityNotFound(_0xf7a9c0,null))[_0x8d1d('0x26')](saveUpdates(_0x377bd0['body'],null))[_0x8d1d('0x26')](respondWithResult(_0xf7a9c0,null))[_0x8d1d('0x46')](handleError(_0xf7a9c0,null));};exports[_0x8d1d('0x4c')]=function(_0x5443ff,_0xd9d59d){return db[_0x8d1d('0x2e')][_0x8d1d('0x49')]({'where':{'id':_0x5443ff[_0x8d1d('0x4b')]['id']}})[_0x8d1d('0x26')](handleEntityNotFound(_0xd9d59d,null))[_0x8d1d('0x26')](removeEntity(_0xd9d59d,null))[_0x8d1d('0x46')](handleError(_0xd9d59d,null));};exports[_0x8d1d('0x4d')]=function(_0x2793c7,_0x3b0736){return db[_0x8d1d('0x2e')][_0x8d1d('0x4d')]()[_0x8d1d('0x26')](respondWithResult(_0x3b0736,null))[_0x8d1d('0x46')](handleError(_0x3b0736,null));};exports[_0x8d1d('0x4e')]=function(_0x116f0b,_0x2db976,_0x18c16b){var _0x5ccdb1={'raw':!![],'where':{}};var _0x156a28={};var _0x469ceb={'count':0x0,'rows':[]};return db[_0x8d1d('0x2e')][_0x8d1d('0x4f')]({'where':{'id':_0x116f0b[_0x8d1d('0x4b')]['id']}})[_0x8d1d('0x26')](handleEntityNotFound(_0x2db976,null))[_0x8d1d('0x26')](function(_0x1aab55){if(_0x1aab55){_0x156a28['model']=_[_0x8d1d('0x35')](db[_0x8d1d('0x50')][_0x8d1d('0x2f')]);_0x156a28[_0x8d1d('0x34')]=_[_0x8d1d('0x35')](_0x116f0b[_0x8d1d('0x34')]);_0x156a28[_0x8d1d('0x3e')]=_[_0x8d1d('0x36')](_0x156a28['model'],_0x156a28[_0x8d1d('0x34')]);_0x5ccdb1[_0x8d1d('0x38')]=_[_0x8d1d('0x36')](_0x156a28[_0x8d1d('0x33')],qs[_0x8d1d('0x37')](_0x116f0b[_0x8d1d('0x34')][_0x8d1d('0x37')]));_0x5ccdb1[_0x8d1d('0x38')]=_0x5ccdb1['attributes']['length']?_0x5ccdb1['attributes']:_0x156a28[_0x8d1d('0x33')];if(!_0x116f0b[_0x8d1d('0x34')][_0x8d1d('0x39')]('nolimit')){_0x5ccdb1[_0x8d1d('0x21')]=qs[_0x8d1d('0x21')](_0x116f0b['query'][_0x8d1d('0x21')]);_0x5ccdb1[_0x8d1d('0x20')]=qs[_0x8d1d('0x20')](_0x116f0b['query'][_0x8d1d('0x20')]);}_0x5ccdb1[_0x8d1d('0x3a')]=qs[_0x8d1d('0x3b')](_0x116f0b[_0x8d1d('0x34')][_0x8d1d('0x3b')]);_0x5ccdb1[_0x8d1d('0x3c')]=qs[_0x8d1d('0x3e')](_[_0x8d1d('0x3d')](_0x116f0b['query'],_0x156a28[_0x8d1d('0x3e')]));_0x5ccdb1[_0x8d1d('0x3c')]['SessionId']=_0x1aab55['id'];if(_0x116f0b[_0x8d1d('0x34')][_0x8d1d('0x3f')]){_0x5ccdb1[_0x8d1d('0x3c')]=_[_0x8d1d('0x40')](_0x5ccdb1[_0x8d1d('0x3c')],{'$or':_[_0x8d1d('0x2d')](_0x5ccdb1[_0x8d1d('0x38')],function(_0x3ab960){var _0x3345b4={};_0x3345b4[_0x3ab960]={'$like':'%'+_0x116f0b[_0x8d1d('0x34')][_0x8d1d('0x3f')]+'%'};return _0x3345b4;})});}_0x5ccdb1=_[_0x8d1d('0x40')]({},_0x5ccdb1,_0x116f0b[_0x8d1d('0x51')]);return db['JscriptyQuestionReport'][_0x8d1d('0x42')]({'where':_0x5ccdb1['where']})['then'](function(_0x8d29c6){_0x469ceb['count']=_0x8d29c6;if(_0x116f0b[_0x8d1d('0x34')][_0x8d1d('0x43')]){_0x5ccdb1[_0x8d1d('0x44')]=[{'all':!![]}];}return db[_0x8d1d('0x50')][_0x8d1d('0x45')](_0x5ccdb1);})[_0x8d1d('0x26')](function(_0x4988c3){_0x469ceb[_0x8d1d('0x52')]=_0x4988c3;return _0x469ceb;});}})[_0x8d1d('0x26')](respondWithFilteredResult(_0x2db976,_0x5ccdb1))[_0x8d1d('0x46')](handleError(_0x2db976,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index cff3e99..c28dbb5 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 _0xd7a3=['exports','define','report_jscripty_sessions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x4c9349,_0x5475bd){var _0x59d400=function(_0x21333a){while(--_0x21333a){_0x4c9349['push'](_0x4c9349['shift']());}};_0x59d400(++_0x5475bd);}(_0xd7a3,0x1d7));var _0x3d7a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xd7a3[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require('lodash');var util=require(_0x3d7a('0x0'));var logger=require(_0x3d7a('0x1'))(_0x3d7a('0x2'));var moment=require(_0x3d7a('0x3'));var BPromise=require(_0x3d7a('0x4'));var rp=require(_0x3d7a('0x5'));var fs=require('fs');var path=require(_0x3d7a('0x6'));var rimraf=require(_0x3d7a('0x7'));var config=require(_0x3d7a('0x8'));var attributes=require(_0x3d7a('0x9'));module[_0x3d7a('0xa')]=function(_0x383638,_0x1fe16c){return _0x383638[_0x3d7a('0xb')]('JscriptySessionReport',attributes,{'tableName':_0x3d7a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x643d=['rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger','bluebird','request-promise','path'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x643d,0x1df));var _0xd643=function(_0x798ff3,_0x48ccf4){_0x798ff3=_0x798ff3-0x0;var _0x3d51cc=_0x643d[_0x798ff3];return _0x3d51cc;};'use strict';var _=require('lodash');var util=require(_0xd643('0x0'));var logger=require(_0xd643('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd643('0x2'));var rp=require(_0xd643('0x3'));var fs=require('fs');var path=require(_0xd643('0x4'));var rimraf=require(_0xd643('0x5'));var config=require('../../config/environment');var attributes=require(_0xd643('0x6'));module[_0xd643('0x7')]=function(_0x283575,_0x4b1f5b){return _0x283575[_0xd643('0x8')](_0xd643('0x9'),attributes,{'tableName':_0xd643('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index e4d1bbd..1489861 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 _0xda04=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x17328c,_0x33d83b){var _0x209b47=function(_0x552e25){while(--_0x552e25){_0x17328c['push'](_0x17328c['shift']());}};_0x209b47(++_0x33d83b);}(_0xda04,0x161));var _0x4da0=function(_0x5d2817,_0x18d475){_0x5d2817=_0x5d2817-0x0;var _0x30103b=_0xda04[_0x5d2817];return _0x30103b;};'use strict';var _=require(_0x4da0('0x0'));var util=require(_0x4da0('0x1'));var moment=require(_0x4da0('0x2'));var BPromise=require(_0x4da0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4da0('0x4'))['db'];var utils=require(_0x4da0('0x5'));var logger=require(_0x4da0('0x6'))(_0x4da0('0x7'));var config=require(_0x4da0('0x8'));var jayson=require(_0x4da0('0x9'));var client=jayson[_0x4da0('0xa')][_0x4da0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2708b6,_0x3685d5,_0x105aff){return new BPromise(function(_0x378913,_0x138fbb){return client['request'](_0x2708b6,_0x105aff)[_0x4da0('0xc')](function(_0x4dc472){logger[_0x4da0('0xd')](_0x4da0('0xe'),_0x3685d5,_0x4da0('0xf'));logger[_0x4da0('0x10')](_0x4da0('0x11'),_0x3685d5,_0x4da0('0xf'),JSON[_0x4da0('0x12')](_0x4dc472));if(_0x4dc472[_0x4da0('0x13')]){if(_0x4dc472['error'][_0x4da0('0x14')]===0x1f4){logger['error'](_0x4da0('0xe'),_0x3685d5,_0x4dc472[_0x4da0('0x13')][_0x4da0('0x15')]);return _0x138fbb(_0x4dc472[_0x4da0('0x13')][_0x4da0('0x15')]);}logger[_0x4da0('0x13')](_0x4da0('0xe'),_0x3685d5,_0x4dc472[_0x4da0('0x13')][_0x4da0('0x15')]);return _0x378913(_0x4dc472[_0x4da0('0x13')][_0x4da0('0x15')]);}else{logger['info'](_0x4da0('0xe'),_0x3685d5,'request\x20sent');_0x378913(_0x4dc472['result']['message']);}})[_0x4da0('0x16')](function(_0x50af8a){logger['error'](_0x4da0('0xe'),_0x3685d5,_0x50af8a);_0x138fbb(_0x50af8a);});});} \ No newline at end of file +var _0xd2f5=['result','catch','lodash','util','moment','ioredis','rpc','../../config/environment','jayson/promise','client','then','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x509cfe,_0x57f4af){var _0x151ec0=function(_0x31a8f9){while(--_0x31a8f9){_0x509cfe['push'](_0x509cfe['shift']());}};_0x151ec0(++_0x57f4af);}(_0xd2f5,0x1f0));var _0x5d2f=function(_0x2a85d2,_0x2a34b9){_0x2a85d2=_0x2a85d2-0x0;var _0x1c4343=_0xd2f5[_0x2a85d2];return _0x1c4343;};'use strict';var _=require(_0x5d2f('0x0'));var util=require(_0x5d2f('0x1'));var moment=require(_0x5d2f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d2f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5d2f('0x4'));var config=require(_0x5d2f('0x5'));var jayson=require(_0x5d2f('0x6'));var client=jayson[_0x5d2f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fbca6,_0x16c636,_0x54b628){return new BPromise(function(_0x5894c1,_0x3fc447){return client['request'](_0x2fbca6,_0x54b628)[_0x5d2f('0x8')](function(_0x32a115){logger['info'](_0x5d2f('0x9'),_0x16c636,'request\x20sent');logger[_0x5d2f('0xa')](_0x5d2f('0xb'),_0x16c636,_0x5d2f('0xc'),JSON[_0x5d2f('0xd')](_0x32a115));if(_0x32a115[_0x5d2f('0xe')]){if(_0x32a115[_0x5d2f('0xe')][_0x5d2f('0xf')]===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x16c636,_0x32a115['error'][_0x5d2f('0x10')]);return _0x3fc447(_0x32a115[_0x5d2f('0xe')][_0x5d2f('0x10')]);}logger[_0x5d2f('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x16c636,_0x32a115[_0x5d2f('0xe')][_0x5d2f('0x10')]);return _0x5894c1(_0x32a115[_0x5d2f('0xe')]['message']);}else{logger['info'](_0x5d2f('0x9'),_0x16c636,_0x5d2f('0xc'));_0x5894c1(_0x32a115[_0x5d2f('0x11')][_0x5d2f('0x10')]);}})[_0x5d2f('0x12')](function(_0x243b72){logger[_0x5d2f('0xe')](_0x5d2f('0x9'),_0x16c636,_0x243b72);_0x3fc447(_0x243b72);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index e9c6af4..2a4ef48 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 _0x724c=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','exports','multer','util','connect-timeout'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x724c,0x165));var _0xc724=function(_0x255bfe,_0x4b0396){_0x255bfe=_0x255bfe-0x0;var _0x439ad7=_0x724c[_0x255bfe];return _0x439ad7;};'use strict';var multer=require(_0xc724('0x0'));var util=require(_0xc724('0x1'));var path=require('path');var timeout=require(_0xc724('0x2'));var express=require(_0xc724('0x3'));var router=express[_0xc724('0x4')]();var auth=require(_0xc724('0x5'));var interaction=require(_0xc724('0x6'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0xc724('0x7')]('/',controller[_0xc724('0x8')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);module[_0xc724('0x9')]=router; \ No newline at end of file +var _0x15c7=['./license.controller','index','isAuthenticated','update','exports','multer','path','Router','../../components/interaction/service','../../config/environment'];(function(_0x409c8b,_0x4892d4){var _0x430500=function(_0x386132){while(--_0x386132){_0x409c8b['push'](_0x409c8b['shift']());}};_0x430500(++_0x4892d4);}(_0x15c7,0x1bd));var _0x715c=function(_0x4e36c0,_0xe98130){_0x4e36c0=_0x4e36c0-0x0;var _0x4e5d96=_0x15c7[_0x4e36c0];return _0x4e5d96;};'use strict';var multer=require(_0x715c('0x0'));var util=require('util');var path=require(_0x715c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x715c('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x715c('0x3'));var config=require(_0x715c('0x4'));var controller=require(_0x715c('0x5'));router['get']('/',controller[_0x715c('0x6')]);router['put']('/:id',auth[_0x715c('0x7')](),controller[_0x715c('0x8')]);module[_0x715c('0x9')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 3abd3e0..c3a7b7a 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 _0x2ef3=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x491673,_0x197228){var _0x4ad86b=function(_0x1f82f1){while(--_0x1f82f1){_0x491673['push'](_0x491673['shift']());}};_0x4ad86b(++_0x197228);}(_0x2ef3,0xba));var _0x32ef=function(_0x422b78,_0x328a02){_0x422b78=_0x422b78-0x0;var _0x1eeca9=_0x2ef3[_0x422b78];return _0x1eeca9;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'license':{'type':Sequelize[_0x32ef('0x2')]},'data1':{'type':Sequelize[_0x32ef('0x3')]},'data2':{'type':Sequelize[_0x32ef('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x32ef('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x524e=['STRING','INTEGER','TEXT'];(function(_0xd050c6,_0x58ffb4){var _0x7278a=function(_0x16d03e){while(--_0x16d03e){_0xd050c6['push'](_0xd050c6['shift']());}};_0x7278a(++_0x58ffb4);}(_0x524e,0x15e));var _0xe524=function(_0x33caf3,_0x2d649a){_0x33caf3=_0x33caf3-0x0;var _0x1dd36a=_0x524e[_0x33caf3];return _0x1dd36a;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0xe524('0x0')]},'data1':{'type':Sequelize[_0xe524('0x1')]},'data2':{'type':Sequelize[_0xe524('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0xe524('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index ee16e3d..1bec05a 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 _0xbb38=['offset','limit','set','Content-Range','reject','save','update','then','destroy','name','send','../../config/license/util','index','model','query','keys','filters','attributes','intersection','fields','length','options','getLicense','catch','body','params','get','checkLicense','key','demo','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x266544,_0x14a567){var _0x12641e=function(_0x13e6f4){while(--_0x13e6f4){_0x266544['push'](_0x266544['shift']());}};_0x12641e(++_0x14a567);}(_0xbb38,0x1de));var _0x8bb3=function(_0x515d8d,_0x5a7b53){_0x515d8d=_0x515d8d-0x0;var _0x296990=_0xbb38[_0x515d8d];return _0x296990;};'use strict';var pdf=require(_0x8bb3('0x0'));var emlformat=require(_0x8bb3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8bb3('0x2'));var jsonpatch=require(_0x8bb3('0x3'));var rp=require('request-promise');var moment=require(_0x8bb3('0x4'));var BPromise=require(_0x8bb3('0x5'));var Mustache=require(_0x8bb3('0x6'));var util=require(_0x8bb3('0x7'));var path=require(_0x8bb3('0x8'));var sox=require('sox');var csv=require(_0x8bb3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8bb3('0xa'));var crypto=require('crypto');var jsforce=require(_0x8bb3('0xb'));var deskjs=require(_0x8bb3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8bb3('0xd'));var Redis=require(_0x8bb3('0xe'));var authService=require(_0x8bb3('0xf'));var qs=require(_0x8bb3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8bb3('0x11'));var logger=require(_0x8bb3('0x12'))('api');var utils=require(_0x8bb3('0x13'));var config=require('../../config/environment');var db=require(_0x8bb3('0x14'))['db'];function respondWithStatusCode(_0x357fe9,_0xceb571){_0xceb571=_0xceb571||0xcc;return function(_0x105c82){if(_0x105c82){return _0x357fe9[_0x8bb3('0x15')](_0xceb571);}return _0x357fe9[_0x8bb3('0x16')](_0xceb571)[_0x8bb3('0x17')]();};}function respondWithResult(_0x13658a,_0x5ccd63){_0x5ccd63=_0x5ccd63||0xc8;return function(_0x44031e){if(_0x44031e){return _0x13658a[_0x8bb3('0x16')](_0x5ccd63)[_0x8bb3('0x18')](_0x44031e);}};}function respondWithFilteredResult(_0x5bbf7d,_0x3af86d){return function(_0x40ac5a){if(_0x40ac5a){var _0x1dfd69=_0x40ac5a[_0x8bb3('0x19')],_0x40a34c=_0x3af86d[_0x8bb3('0x1a')],_0x3a9b77=_0x3af86d['offset']+_0x3af86d[_0x8bb3('0x1b')],_0x457878;if(_0x3a9b77>=_0x1dfd69){_0x3a9b77=_0x1dfd69;_0x457878=0xc8;}else{_0x457878=0xce;}_0x5bbf7d[_0x8bb3('0x16')](_0x457878);return _0x5bbf7d[_0x8bb3('0x1c')](_0x8bb3('0x1d'),_0x40a34c+'-'+_0x3a9b77+'/'+_0x1dfd69)['json'](_0x40ac5a);}return null;};}function patchUpdates(_0x44cdbc){return function(_0xfb9132){try{jsonpatch['apply'](_0xfb9132,_0x44cdbc,!![]);}catch(_0x1dc03e){return BPromise[_0x8bb3('0x1e')](_0x1dc03e);}return _0xfb9132[_0x8bb3('0x1f')]();};}function saveUpdates(_0x462e3f,_0x1b54ae){return function(_0x172f82){if(_0x172f82){return _0x172f82[_0x8bb3('0x20')](_0x462e3f)[_0x8bb3('0x21')](function(_0x5ebafe){return _0x5ebafe;});}return null;};}function removeEntity(_0x4005be,_0x1379ef){return function(_0x1520ff){if(_0x1520ff){return _0x1520ff[_0x8bb3('0x22')]()[_0x8bb3('0x21')](function(){_0x4005be[_0x8bb3('0x16')](0xcc)[_0x8bb3('0x17')]();});}};}function handleEntityNotFound(_0x447b38,_0x762b06){return function(_0x290626){if(!_0x290626){_0x447b38[_0x8bb3('0x15')](0x194);}return _0x290626;};}function handleError(_0x87939b,_0x55a301){_0x55a301=_0x55a301||0x1f4;return function(_0x5882d7){logger['error'](_0x5882d7['stack']);if(_0x5882d7[_0x8bb3('0x23')]){delete _0x5882d7[_0x8bb3('0x23')];}_0x87939b[_0x8bb3('0x16')](_0x55a301)[_0x8bb3('0x24')](_0x5882d7);};}var utilLicense=require(_0x8bb3('0x25'));exports[_0x8bb3('0x26')]=function(_0x5eabac,_0x2f3449){var _0x23ce2f={'raw':!![],'where':{'id':0x1}},_0x4170fa={};_0x4170fa[_0x8bb3('0x27')]=_['keys'](db['License']['rawAttributes']);_0x4170fa[_0x8bb3('0x28')]=_[_0x8bb3('0x29')](_0x5eabac[_0x8bb3('0x28')]);_0x4170fa[_0x8bb3('0x2a')]=_['intersection'](_0x4170fa[_0x8bb3('0x27')],_0x4170fa[_0x8bb3('0x28')]);_0x23ce2f[_0x8bb3('0x2b')]=_[_0x8bb3('0x2c')](_0x4170fa['model'],qs[_0x8bb3('0x2d')](_0x5eabac[_0x8bb3('0x28')][_0x8bb3('0x2d')]));_0x23ce2f['attributes']=_0x23ce2f[_0x8bb3('0x2b')][_0x8bb3('0x2e')]?_0x23ce2f[_0x8bb3('0x2b')]:_0x4170fa[_0x8bb3('0x27')];_0x23ce2f=_['merge']({},_0x23ce2f,_0x5eabac[_0x8bb3('0x2f')]);return utilLicense[_0x8bb3('0x30')](_0x23ce2f)[_0x8bb3('0x21')](respondWithResult(_0x2f3449,null))[_0x8bb3('0x31')](handleError(_0x2f3449,null));};exports[_0x8bb3('0x20')]=function(_0x4c2a9a,_0x31dcd9){if(_0x4c2a9a[_0x8bb3('0x32')]['id']){delete _0x4c2a9a['body']['id'];}return db['License']['find']({'where':{'id':_0x4c2a9a[_0x8bb3('0x33')]['id']}})[_0x8bb3('0x21')](handleEntityNotFound(_0x31dcd9,null))[_0x8bb3('0x21')](function(_0x412d33){var _0x4f784d=_0x412d33[_0x8bb3('0x34')]({'plain':!![]});return utilLicense[_0x8bb3('0x35')](_0x4f784d,_0x4c2a9a['body'][_0x8bb3('0x36')]);})[_0x8bb3('0x21')](function(_0x3148ec){if(!_0x3148ec[_0x8bb3('0x37')]){return saveUpdates(_0x4c2a9a[_0x8bb3('0x32')],null);}return _0x3148ec;})[_0x8bb3('0x21')](respondWithResult(_0x31dcd9,null))['catch'](handleError(_0x31dcd9,null));}; \ No newline at end of file +var _0x44cc=['get','checkLicense','key','demo','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','json','count','offset','limit','status','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','../../config/license/util','index','keys','License','rawAttributes','query','filters','model','fields','attributes','length','getLicense','catch','body','find','params'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0x44cc,0xe8));var _0xc44c=function(_0x51e512,_0x289960){_0x51e512=_0x51e512-0x0;var _0x1e93df=_0x44cc[_0x51e512];return _0x1e93df;};'use strict';var pdf=require(_0xc44c('0x0'));var emlformat=require(_0xc44c('0x1'));var rimraf=require(_0xc44c('0x2'));var zipdir=require(_0xc44c('0x3'));var jsonpatch=require(_0xc44c('0x4'));var rp=require(_0xc44c('0x5'));var moment=require('moment');var BPromise=require(_0xc44c('0x6'));var Mustache=require(_0xc44c('0x7'));var util=require(_0xc44c('0x8'));var path=require(_0xc44c('0x9'));var sox=require(_0xc44c('0xa'));var csv=require(_0xc44c('0xb'));var ejs=require(_0xc44c('0xc'));var fs=require('fs');var _=require(_0xc44c('0xd'));var squel=require('squel');var crypto=require(_0xc44c('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc44c('0xb'));var querystring=require('querystring');var Papa=require(_0xc44c('0xf'));var Redis=require(_0xc44c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc44c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc44c('0x12'));var logger=require(_0xc44c('0x13'))('api');var utils=require(_0xc44c('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x115cdf,_0x2ddb03){_0x2ddb03=_0x2ddb03||0xcc;return function(_0x36e034){if(_0x36e034){return _0x115cdf[_0xc44c('0x15')](_0x2ddb03);}return _0x115cdf['status'](_0x2ddb03)['end']();};}function respondWithResult(_0x136ca3,_0x39fdda){_0x39fdda=_0x39fdda||0xc8;return function(_0x2c0948){if(_0x2c0948){return _0x136ca3['status'](_0x39fdda)[_0xc44c('0x16')](_0x2c0948);}};}function respondWithFilteredResult(_0x45d61e,_0xf0b348){return function(_0x1ad95c){if(_0x1ad95c){var _0x407b52=_0x1ad95c[_0xc44c('0x17')],_0x2dff73=_0xf0b348['offset'],_0x5c3e3c=_0xf0b348[_0xc44c('0x18')]+_0xf0b348[_0xc44c('0x19')],_0x538482;if(_0x5c3e3c>=_0x407b52){_0x5c3e3c=_0x407b52;_0x538482=0xc8;}else{_0x538482=0xce;}_0x45d61e[_0xc44c('0x1a')](_0x538482);return _0x45d61e['set'](_0xc44c('0x1b'),_0x2dff73+'-'+_0x5c3e3c+'/'+_0x407b52)[_0xc44c('0x16')](_0x1ad95c);}return null;};}function patchUpdates(_0x24ead1){return function(_0x1eee3b){try{jsonpatch[_0xc44c('0x1c')](_0x1eee3b,_0x24ead1,!![]);}catch(_0x5a2274){return BPromise[_0xc44c('0x1d')](_0x5a2274);}return _0x1eee3b['save']();};}function saveUpdates(_0x2d4751,_0x34774f){return function(_0x35e805){if(_0x35e805){return _0x35e805[_0xc44c('0x1e')](_0x2d4751)['then'](function(_0x1ad5a5){return _0x1ad5a5;});}return null;};}function removeEntity(_0x392371,_0x2f5330){return function(_0xc5be6b){if(_0xc5be6b){return _0xc5be6b[_0xc44c('0x1f')]()[_0xc44c('0x20')](function(){_0x392371[_0xc44c('0x1a')](0xcc)[_0xc44c('0x21')]();});}};}function handleEntityNotFound(_0x61431c,_0xa2885){return function(_0x31987d){if(!_0x31987d){_0x61431c[_0xc44c('0x15')](0x194);}return _0x31987d;};}function handleError(_0x4295f6,_0x5ce181){_0x5ce181=_0x5ce181||0x1f4;return function(_0x505205){logger[_0xc44c('0x22')](_0x505205[_0xc44c('0x23')]);if(_0x505205['name']){delete _0x505205[_0xc44c('0x24')];}_0x4295f6[_0xc44c('0x1a')](_0x5ce181)['send'](_0x505205);};}var utilLicense=require(_0xc44c('0x25'));exports[_0xc44c('0x26')]=function(_0x137068,_0x1e790b){var _0x18fcef={'raw':!![],'where':{'id':0x1}},_0x1977f1={};_0x1977f1['model']=_[_0xc44c('0x27')](db[_0xc44c('0x28')][_0xc44c('0x29')]);_0x1977f1[_0xc44c('0x2a')]=_['keys'](_0x137068[_0xc44c('0x2a')]);_0x1977f1[_0xc44c('0x2b')]=_['intersection'](_0x1977f1[_0xc44c('0x2c')],_0x1977f1['query']);_0x18fcef['attributes']=_['intersection'](_0x1977f1[_0xc44c('0x2c')],qs[_0xc44c('0x2d')](_0x137068[_0xc44c('0x2a')][_0xc44c('0x2d')]));_0x18fcef[_0xc44c('0x2e')]=_0x18fcef[_0xc44c('0x2e')][_0xc44c('0x2f')]?_0x18fcef[_0xc44c('0x2e')]:_0x1977f1[_0xc44c('0x2c')];_0x18fcef=_['merge']({},_0x18fcef,_0x137068['options']);return utilLicense[_0xc44c('0x30')](_0x18fcef)['then'](respondWithResult(_0x1e790b,null))[_0xc44c('0x31')](handleError(_0x1e790b,null));};exports[_0xc44c('0x1e')]=function(_0x53e85b,_0x1bd188){if(_0x53e85b[_0xc44c('0x32')]['id']){delete _0x53e85b['body']['id'];}return db['License'][_0xc44c('0x33')]({'where':{'id':_0x53e85b[_0xc44c('0x34')]['id']}})[_0xc44c('0x20')](handleEntityNotFound(_0x1bd188,null))[_0xc44c('0x20')](function(_0x44addb){var _0x314ae9=_0x44addb[_0xc44c('0x35')]({'plain':!![]});return utilLicense[_0xc44c('0x36')](_0x314ae9,_0x53e85b[_0xc44c('0x32')][_0xc44c('0x37')]);})['then'](function(_0x4a84e1){if(!_0x4a84e1[_0xc44c('0x38')]){return saveUpdates(_0x53e85b[_0xc44c('0x32')],null);}return _0x4a84e1;})[_0xc44c('0x20')](respondWithResult(_0x1bd188,null))[_0xc44c('0x31')](handleError(_0x1bd188,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index dc5d1ef..2b9ee2b 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 _0x88fa=['api','moment','request-promise','path','../../config/environment','exports','License','license','lodash','util','../../config/logger'];(function(_0x396e37,_0x80842b){var _0xb43eda=function(_0x1e3361){while(--_0x1e3361){_0x396e37['push'](_0x396e37['shift']());}};_0xb43eda(++_0x80842b);}(_0x88fa,0x19f));var _0xa88f=function(_0x504b86,_0x20f9a3){_0x504b86=_0x504b86-0x0;var _0xa15c0f=_0x88fa[_0x504b86];return _0xa15c0f;};'use strict';var _=require(_0xa88f('0x0'));var util=require(_0xa88f('0x1'));var logger=require(_0xa88f('0x2'))(_0xa88f('0x3'));var moment=require(_0xa88f('0x4'));var BPromise=require('bluebird');var rp=require(_0xa88f('0x5'));var fs=require('fs');var path=require(_0xa88f('0x6'));var rimraf=require('rimraf');var config=require(_0xa88f('0x7'));var attributes=require('./license.attributes');module[_0xa88f('0x8')]=function(_0x259f67,_0x253405){return _0x259f67['define'](_0xa88f('0x9'),attributes,{'tableName':_0xa88f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd67e=['util','api','moment','rimraf','../../config/environment','./license.attributes','define','License','license','lodash'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0xd67e,0xb3));var _0xed67=function(_0x7792e2,_0x39b280){_0x7792e2=_0x7792e2-0x0;var _0x2278fd=_0xd67e[_0x7792e2];return _0x2278fd;};'use strict';var _=require(_0xed67('0x0'));var util=require(_0xed67('0x1'));var logger=require('../../config/logger')(_0xed67('0x2'));var moment=require(_0xed67('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xed67('0x4'));var config=require(_0xed67('0x5'));var attributes=require(_0xed67('0x6'));module['exports']=function(_0x17f74b,_0x2ee471){return _0x17f74b[_0xed67('0x7')](_0xed67('0x8'),attributes,{'tableName':_0xed67('0x9'),'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 f147d94..1c704db 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 _0xc7ea=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0xc7ea,0x171));var _0xac7e=function(_0x137236,_0x18e769){_0x137236=_0x137236-0x0;var _0x6ca3f8=_0xc7ea[_0x137236];return _0x6ca3f8;};'use strict';var _=require(_0xac7e('0x0'));var util=require(_0xac7e('0x1'));var moment=require('moment');var BPromise=require(_0xac7e('0x2'));var rs=require(_0xac7e('0x3'));var fs=require('fs');var Redis=require(_0xac7e('0x4'));var db=require(_0xac7e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac7e('0x6'))(_0xac7e('0x7'));var config=require(_0xac7e('0x8'));var jayson=require(_0xac7e('0x9'));var client=jayson[_0xac7e('0xa')][_0xac7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x447bfe,_0x1aca29,_0x1612f3){return new BPromise(function(_0x1cb874,_0x4d83fb){return client[_0xac7e('0xc')](_0x447bfe,_0x1612f3)[_0xac7e('0xd')](function(_0x2efbf4){logger[_0xac7e('0xe')](_0xac7e('0xf'),_0x1aca29,_0xac7e('0x10'));logger[_0xac7e('0x11')](_0xac7e('0x12'),_0x1aca29,_0xac7e('0x10'),JSON[_0xac7e('0x13')](_0x2efbf4));if(_0x2efbf4[_0xac7e('0x14')]){if(_0x2efbf4[_0xac7e('0x14')]['code']===0x1f4){logger[_0xac7e('0x14')](_0xac7e('0xf'),_0x1aca29,_0x2efbf4['error'][_0xac7e('0x15')]);return _0x4d83fb(_0x2efbf4[_0xac7e('0x14')][_0xac7e('0x15')]);}logger[_0xac7e('0x14')](_0xac7e('0xf'),_0x1aca29,_0x2efbf4['error'][_0xac7e('0x15')]);return _0x1cb874(_0x2efbf4[_0xac7e('0x14')][_0xac7e('0x15')]);}else{logger[_0xac7e('0xe')](_0xac7e('0xf'),_0x1aca29,_0xac7e('0x10'));_0x1cb874(_0x2efbf4[_0xac7e('0x16')][_0xac7e('0x15')]);}})['catch'](function(_0x3f4869){logger[_0xac7e('0x14')](_0xac7e('0xf'),_0x1aca29,_0x3f4869);_0x4d83fb(_0x3f4869);});});} \ No newline at end of file +var _0xee53=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3220c7,_0x55ce52){var _0x545926=function(_0x15c839){while(--_0x15c839){_0x3220c7['push'](_0x3220c7['shift']());}};_0x545926(++_0x55ce52);}(_0xee53,0xa8));var _0x3ee5=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xee53[_0x1deb03];return _0x189fe7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ee5('0x0'));var BPromise=require(_0x3ee5('0x1'));var rs=require(_0x3ee5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ee5('0x3'))['db'];var utils=require(_0x3ee5('0x4'));var logger=require(_0x3ee5('0x5'))(_0x3ee5('0x6'));var config=require(_0x3ee5('0x7'));var jayson=require(_0x3ee5('0x8'));var client=jayson[_0x3ee5('0x9')][_0x3ee5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6ff422,_0x2657de,_0x34ebf4){return new BPromise(function(_0x40b821,_0x14d96d){return client['request'](_0x6ff422,_0x34ebf4)[_0x3ee5('0xb')](function(_0xc344f){logger[_0x3ee5('0xc')](_0x3ee5('0xd'),_0x2657de,'request\x20sent');logger[_0x3ee5('0xe')](_0x3ee5('0xf'),_0x2657de,_0x3ee5('0x10'),JSON[_0x3ee5('0x11')](_0xc344f));if(_0xc344f['error']){if(_0xc344f[_0x3ee5('0x12')][_0x3ee5('0x13')]===0x1f4){logger['error'](_0x3ee5('0xd'),_0x2657de,_0xc344f['error'][_0x3ee5('0x14')]);return _0x14d96d(_0xc344f['error']['message']);}logger[_0x3ee5('0x12')](_0x3ee5('0xd'),_0x2657de,_0xc344f[_0x3ee5('0x12')][_0x3ee5('0x14')]);return _0x40b821(_0xc344f[_0x3ee5('0x12')][_0x3ee5('0x14')]);}else{logger[_0x3ee5('0xc')](_0x3ee5('0xd'),_0x2657de,_0x3ee5('0x10'));_0x40b821(_0xc344f['result'][_0x3ee5('0x14')]);}})['catch'](function(_0xab5013){logger[_0x3ee5('0x12')](_0x3ee5('0xd'),_0x2657de,_0xab5013);_0x14d96d(_0xab5013);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 9dd2e65..a95337a 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 _0xdd4b=['addDisposition','addAnswer','create','addImap','addSmtp','/:id/send','send','addAgents','put','update','delete','removeAnswers','removeImap','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getApplications','/:id/messages','getMessages','verifySmtp','getAgents','post'];(function(_0x541d92,_0x533f0b){var _0x39a9de=function(_0x41caf9){while(--_0x41caf9){_0x541d92['push'](_0x541d92['shift']());}};_0x39a9de(++_0x533f0b);}(_0xdd4b,0x15f));var _0xbdd4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xdd4b[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbdd4('0x0'));var timeout=require(_0xbdd4('0x1'));var express=require(_0xbdd4('0x2'));var router=express[_0xbdd4('0x3')]();var auth=require(_0xbdd4('0x4'));var interaction=require(_0xbdd4('0x5'));var config=require('../../config/environment');var controller=require(_0xbdd4('0x6'));router[_0xbdd4('0x7')]('/',auth[_0xbdd4('0x8')](),controller[_0xbdd4('0x9')]);router[_0xbdd4('0x7')](_0xbdd4('0xa'),auth[_0xbdd4('0x8')](),controller['describe']);router['get'](_0xbdd4('0xb'),auth[_0xbdd4('0x8')](),controller[_0xbdd4('0xc')]);router[_0xbdd4('0x7')](_0xbdd4('0xd'),auth[_0xbdd4('0x8')](),controller['getDispositions']);router[_0xbdd4('0x7')](_0xbdd4('0xe'),auth[_0xbdd4('0x8')](),controller[_0xbdd4('0xf')]);router[_0xbdd4('0x7')](_0xbdd4('0x10'),auth[_0xbdd4('0x8')](),controller[_0xbdd4('0x11')]);router[_0xbdd4('0x7')](_0xbdd4('0x12'),auth['isAuthenticated'](),controller[_0xbdd4('0x13')]);router[_0xbdd4('0x7')](_0xbdd4('0x14'),auth[_0xbdd4('0x8')](),controller['getInteractions']);router[_0xbdd4('0x7')]('/:id/applications',auth['isAuthenticated'](),controller[_0xbdd4('0x15')]);router[_0xbdd4('0x7')](_0xbdd4('0x16'),auth[_0xbdd4('0x8')](),controller[_0xbdd4('0x17')]);router[_0xbdd4('0x7')]('/:id/verify',auth[_0xbdd4('0x8')](),controller[_0xbdd4('0x18')]);router[_0xbdd4('0x7')]('/:id/users',auth[_0xbdd4('0x8')](),controller[_0xbdd4('0x19')]);router[_0xbdd4('0x1a')](_0xbdd4('0xd'),auth[_0xbdd4('0x8')](),controller[_0xbdd4('0x1b')]);router['post']('/:id/canned_answers',auth[_0xbdd4('0x8')](),controller[_0xbdd4('0x1c')]);router['post']('/',auth[_0xbdd4('0x8')](),controller[_0xbdd4('0x1d')]);router[_0xbdd4('0x1a')](_0xbdd4('0x10'),auth[_0xbdd4('0x8')](),controller[_0xbdd4('0x1e')]);router[_0xbdd4('0x1a')](_0xbdd4('0x12'),auth[_0xbdd4('0x8')](),controller[_0xbdd4('0x1f')]);router[_0xbdd4('0x1a')](_0xbdd4('0x14'),auth[_0xbdd4('0x8')](),controller['addInteraction']);router[_0xbdd4('0x1a')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0xbdd4('0x1a')](_0xbdd4('0x20'),auth[_0xbdd4('0x8')](),controller[_0xbdd4('0x21')]);router[_0xbdd4('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0xbdd4('0x22')]);router[_0xbdd4('0x23')](_0xbdd4('0xb'),auth[_0xbdd4('0x8')](),controller[_0xbdd4('0x24')]);router[_0xbdd4('0x25')](_0xbdd4('0xd'),auth[_0xbdd4('0x8')](),controller['removeDispositions']);router['delete'](_0xbdd4('0xe'),auth[_0xbdd4('0x8')](),controller[_0xbdd4('0x26')]);router[_0xbdd4('0x25')](_0xbdd4('0x10'),auth['isAuthenticated'](),controller[_0xbdd4('0x27')]);router['delete'](_0xbdd4('0x12'),auth[_0xbdd4('0x8')](),controller['removeSmtp']);router[_0xbdd4('0x25')](_0xbdd4('0xb'),auth[_0xbdd4('0x8')](),controller[_0xbdd4('0x28')]);router[_0xbdd4('0x25')]('/:id/users',auth[_0xbdd4('0x8')](),controller['removeAgents']);module[_0xbdd4('0x29')]=router; \ No newline at end of file +var _0x9984=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','addInteraction','addApplications','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller'];(function(_0x1e902a,_0x152da7){var _0x5754a9=function(_0x4ad81a){while(--_0x4ad81a){_0x1e902a['push'](_0x1e902a['shift']());}};_0x5754a9(++_0x152da7);}(_0x9984,0x187));var _0x4998=function(_0x3dcbd0,_0x1508cc){_0x3dcbd0=_0x3dcbd0-0x0;var _0x510b50=_0x9984[_0x3dcbd0];return _0x510b50;};'use strict';var multer=require(_0x4998('0x0'));var util=require('util');var path=require(_0x4998('0x1'));var timeout=require(_0x4998('0x2'));var express=require(_0x4998('0x3'));var router=express[_0x4998('0x4')]();var auth=require(_0x4998('0x5'));var interaction=require(_0x4998('0x6'));var config=require(_0x4998('0x7'));var controller=require(_0x4998('0x8'));router[_0x4998('0x9')]('/',auth[_0x4998('0xa')](),controller[_0x4998('0xb')]);router[_0x4998('0x9')](_0x4998('0xc'),auth[_0x4998('0xa')](),controller[_0x4998('0xd')]);router[_0x4998('0x9')](_0x4998('0xe'),auth['isAuthenticated'](),controller[_0x4998('0xf')]);router[_0x4998('0x9')](_0x4998('0x10'),auth[_0x4998('0xa')](),controller[_0x4998('0x11')]);router[_0x4998('0x9')](_0x4998('0x12'),auth['isAuthenticated'](),controller[_0x4998('0x13')]);router['get'](_0x4998('0x14'),auth[_0x4998('0xa')](),controller[_0x4998('0x15')]);router[_0x4998('0x9')](_0x4998('0x16'),auth[_0x4998('0xa')](),controller[_0x4998('0x17')]);router[_0x4998('0x9')](_0x4998('0x18'),auth[_0x4998('0xa')](),controller[_0x4998('0x19')]);router[_0x4998('0x9')](_0x4998('0x1a'),auth['isAuthenticated'](),controller[_0x4998('0x1b')]);router['get'](_0x4998('0x1c'),auth['isAuthenticated'](),controller[_0x4998('0x1d')]);router[_0x4998('0x9')](_0x4998('0x1e'),auth[_0x4998('0xa')](),controller[_0x4998('0x1f')]);router[_0x4998('0x9')](_0x4998('0x20'),auth[_0x4998('0xa')](),controller[_0x4998('0x21')]);router[_0x4998('0x22')](_0x4998('0x10'),auth[_0x4998('0xa')](),controller[_0x4998('0x23')]);router[_0x4998('0x22')](_0x4998('0x12'),auth[_0x4998('0xa')](),controller[_0x4998('0x24')]);router[_0x4998('0x22')]('/',auth[_0x4998('0xa')](),controller['create']);router['post'](_0x4998('0x14'),auth[_0x4998('0xa')](),controller[_0x4998('0x25')]);router[_0x4998('0x22')]('/:id/out_servers',auth[_0x4998('0xa')](),controller['addSmtp']);router['post'](_0x4998('0x18'),auth[_0x4998('0xa')](),controller[_0x4998('0x26')]);router[_0x4998('0x22')]('/:id/applications',auth[_0x4998('0xa')](),controller[_0x4998('0x27')]);router[_0x4998('0x22')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x4998('0x22')](_0x4998('0x20'),auth['isAuthenticated'](),controller[_0x4998('0x28')]);router[_0x4998('0x29')](_0x4998('0xe'),auth[_0x4998('0xa')](),controller[_0x4998('0x2a')]);router[_0x4998('0x2b')](_0x4998('0x10'),auth['isAuthenticated'](),controller[_0x4998('0x2c')]);router[_0x4998('0x2b')](_0x4998('0x12'),auth[_0x4998('0xa')](),controller[_0x4998('0x2d')]);router[_0x4998('0x2b')](_0x4998('0x14'),auth[_0x4998('0xa')](),controller[_0x4998('0x2e')]);router[_0x4998('0x2b')](_0x4998('0x16'),auth[_0x4998('0xa')](),controller[_0x4998('0x2f')]);router[_0x4998('0x2b')](_0x4998('0xe'),auth[_0x4998('0xa')](),controller[_0x4998('0x30')]);router[_0x4998('0x2b')](_0x4998('0x20'),auth['isAuthenticated'](),controller[_0x4998('0x31')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 74e4eef..f8bbb5d 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 _0x32a0=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','BOOLEAN','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(_0x5632c2,_0x5e912a){var _0x250382=function(_0x48c15a){while(--_0x48c15a){_0x5632c2['push'](_0x5632c2['shift']());}};_0x250382(++_0x5e912a);}(_0x32a0,0x193));var _0x032a=function(_0x11e03f,_0x20b967){_0x11e03f=_0x11e03f-0x0;var _0x5666fe=_0x32a0[_0x11e03f];return _0x5666fe;};'use strict';var Sequelize=require(_0x032a('0x0'));module['exports']={'description':{'type':Sequelize[_0x032a('0x1')]},'name':{'type':Sequelize[_0x032a('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x032a('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x032a('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x032a('0x1')],'allowNull':![],'defaultValue':_0x032a('0x3')},'fontSize':{'type':Sequelize[_0x032a('0x4')](0x2)[_0x032a('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x032a('0x6');}},'notificationSound':{'type':Sequelize[_0x032a('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x032a('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x032a('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x032a('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x032a('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x032a('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x032a('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x032a('0x7'),'set':function(_0x54429b){if(!_0x54429b)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x032a('0x8')](_0x032a('0x9'),_0x54429b);}}}; \ No newline at end of file +var _0x38cc=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','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}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x38cc,0xab));var _0xc38c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x38cc[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xc38c('0x0'));module[_0xc38c('0x1')]={'description':{'type':Sequelize[_0xc38c('0x2')]},'name':{'type':Sequelize[_0xc38c('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xc38c('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xc38c('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xc38c('0x4')]},'markAsUnread':{'type':Sequelize[_0xc38c('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xc38c('0x2')],'allowNull':![],'defaultValue':_0xc38c('0x5')},'fontSize':{'type':Sequelize[_0xc38c('0x6')](0x2)[_0xc38c('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc38c('0x8');}},'notificationSound':{'type':Sequelize[_0xc38c('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc38c('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc38c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc38c('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc38c('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc38c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc38c('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc38c('0x3')],'defaultValue':![],'comment':_0xc38c('0x9'),'set':function(_0x5ab21e){if(!_0x5ab21e)this[_0xc38c('0xa')](_0xc38c('0xb'),null);this[_0xc38c('0xa')](_0xc38c('0xc'),_0x5ab21e);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index bee11ce..5cdebbc 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 _0x6f49=['email','attachments','join','root','server/files/attachments','basename','auth','secure','sendMail','List\x20not\x20found','messageId','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','status','end','json','offset','limit','set','Content-Range','apply','update','destroy','get','MailAccounts','UserProfileResource','name','send','index','MailServerIn','Imap','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','rows','Pause','length','find','catch','body','params','MailServerOut','describe','create','findOne','Disposition','MailAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','ListId','isNil','active','description','cauthentication','user','pass','cpassword','authentication','port','host','service','cservice','cuser','password','UserProfileSection','userProfileId','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','MailApplication','priority','getApplications','MailMessage','$gte','format','split','CmList','List','Contacts','DESC','from','%s\x20<%s>'];(function(_0x24fa14,_0x5eed85){var _0x50a5c4=function(_0x2cb75b){while(--_0x2cb75b){_0x24fa14['push'](_0x24fa14['shift']());}};_0x50a5c4(++_0x5eed85);}(_0x6f49,0x196));var _0x96f4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f49[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x96f4('0x0'));var emlformat=require(_0x96f4('0x1'));var rimraf=require(_0x96f4('0x2'));var zipdir=require(_0x96f4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x96f4('0x4'));var moment=require(_0x96f4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x96f4('0x6'));var util=require(_0x96f4('0x7'));var path=require('path');var sox=require(_0x96f4('0x8'));var csv=require(_0x96f4('0x9'));var ejs=require(_0x96f4('0xa'));var fs=require('fs');var _=require(_0x96f4('0xb'));var squel=require('squel');var crypto=require(_0x96f4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x96f4('0xd'));var toCsv=require(_0x96f4('0x9'));var querystring=require(_0x96f4('0xe'));var Papa=require(_0x96f4('0xf'));var Redis=require(_0x96f4('0x10'));var authService=require(_0x96f4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96f4('0x12'));var logger=require(_0x96f4('0x13'))(_0x96f4('0x14'));var utils=require(_0x96f4('0x15'));var config=require(_0x96f4('0x16'));var db=require(_0x96f4('0x17'))['db'];config[_0x96f4('0x18')]=_[_0x96f4('0x19')](config['redis'],{'host':_0x96f4('0x1a'),'port':0x18eb});var socket=require(_0x96f4('0x1b'))(new Redis(config[_0x96f4('0x18')]));require(_0x96f4('0x1c'))[_0x96f4('0x1d')](socket);var jayson=require(_0x96f4('0x1e'));var client=jayson[_0x96f4('0x1f')]['http']({'port':0x232b});function checkPasswordPattern(_0x2e13ca,_0x450456,_0x246837){if(_0x246837){var _0x240ac=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x240ac[_0x96f4('0x20')](_0x450456)){return _0x2e13ca;}else{throw new db[(_0x96f4('0x21'))][(_0x96f4('0x22'))](_0x96f4('0x23'));}}else{return _0x2e13ca;}}function respondWithRpcPromise(_0x1cfc90,_0x49f81d,_0x1afa4b,_0x7c5c9b){return new BPromise(function(_0xa59555,_0x446e6e){var _0x461760=_0x7c5c9b||client;return _0x461760[_0x96f4('0x24')](_0x1cfc90,_0x1afa4b)[_0x96f4('0x25')](function(_0x5e5a5f){logger[_0x96f4('0x26')](_0x96f4('0x27'),_0x49f81d,'request\x20sent');logger[_0x96f4('0x28')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x49f81d,_0x96f4('0x29'),JSON[_0x96f4('0x2a')](_0x5e5a5f));if(_0x5e5a5f['error']){if(_0x5e5a5f[_0x96f4('0x2b')][_0x96f4('0x2c')]===0x1f4){logger['error'](_0x96f4('0x27'),_0x49f81d,_0x5e5a5f[_0x96f4('0x2b')][_0x96f4('0x2d')]);return _0x446e6e(_0x5e5a5f['error'][_0x96f4('0x2d')]);}logger[_0x96f4('0x2b')](_0x96f4('0x27'),_0x49f81d,_0x5e5a5f[_0x96f4('0x2b')][_0x96f4('0x2d')]);return _0xa59555(_0x5e5a5f[_0x96f4('0x2b')]['message']);}else{logger[_0x96f4('0x26')](_0x96f4('0x27'),_0x49f81d,_0x96f4('0x29'));_0xa59555(_0x5e5a5f[_0x96f4('0x2e')][_0x96f4('0x2d')]);}})['catch'](function(_0x25b190){logger['error']('MailAccount,\x20%s,\x20%s',_0x49f81d,_0x25b190);_0x446e6e(_0x25b190);});});}function respondWithStatusCode(_0x367aef,_0x21e22f){_0x21e22f=_0x21e22f||0xcc;return function(_0x5d5252){if(_0x5d5252){return _0x367aef['sendStatus'](_0x21e22f);}return _0x367aef[_0x96f4('0x2f')](_0x21e22f)[_0x96f4('0x30')]();};}function respondWithResult(_0x2d3831,_0x2c22b2){_0x2c22b2=_0x2c22b2||0xc8;return function(_0x117115){if(_0x117115){return _0x2d3831['status'](_0x2c22b2)[_0x96f4('0x31')](_0x117115);}};}function respondWithFilteredResult(_0x9d021d,_0x456df9){return function(_0x54184d){if(_0x54184d){var _0x33b6d2=_0x54184d['count'],_0x446215=_0x456df9[_0x96f4('0x32')],_0x388cce=_0x456df9['offset']+_0x456df9[_0x96f4('0x33')],_0x262e2f;if(_0x388cce>=_0x33b6d2){_0x388cce=_0x33b6d2;_0x262e2f=0xc8;}else{_0x262e2f=0xce;}_0x9d021d['status'](_0x262e2f);return _0x9d021d[_0x96f4('0x34')](_0x96f4('0x35'),_0x446215+'-'+_0x388cce+'/'+_0x33b6d2)[_0x96f4('0x31')](_0x54184d);}return null;};}function patchUpdates(_0x3de3cf){return function(_0x2d14b7){try{jsonpatch[_0x96f4('0x36')](_0x2d14b7,_0x3de3cf,!![]);}catch(_0x39edac){return BPromise['reject'](_0x39edac);}return _0x2d14b7['save']();};}function saveUpdates(_0x443a05,_0x4b9c69){return function(_0x27cbf6){if(_0x27cbf6){return _0x27cbf6[_0x96f4('0x37')](_0x443a05)[_0x96f4('0x25')](function(_0x4306b7){return _0x4306b7;});}return null;};}function removeEntity(_0x133f79,_0x39cd9e){return function(_0x1c8fa4){if(_0x1c8fa4){return _0x1c8fa4[_0x96f4('0x38')]()[_0x96f4('0x25')](function(){var _0x44efe4=_0x1c8fa4[_0x96f4('0x39')]({'plain':!![]});var _0x3af146=_0x96f4('0x3a');return db[_0x96f4('0x3b')][_0x96f4('0x38')]({'where':{'type':_0x3af146,'resourceId':_0x44efe4['id']}})['then'](function(){return _0x1c8fa4;});})[_0x96f4('0x25')](function(){_0x133f79[_0x96f4('0x2f')](0xcc)[_0x96f4('0x30')]();});}};}function handleEntityNotFound(_0x2772a1,_0xacbc64){return function(_0x29371a){if(!_0x29371a){_0x2772a1['sendStatus'](0x194);}return _0x29371a;};}function handleError(_0x35aeb3,_0x37c3a8){_0x37c3a8=_0x37c3a8||0x1f4;return function(_0x3f535e){logger['error'](_0x3f535e['stack']);if(_0x3f535e[_0x96f4('0x3c')]){delete _0x3f535e['name'];}_0x35aeb3[_0x96f4('0x2f')](_0x37c3a8)[_0x96f4('0x3d')](_0x3f535e);};}exports[_0x96f4('0x3e')]=function(_0x5b8860,_0x57f0d3){var _0x345f14={'include':[{'model':db[_0x96f4('0x3f')],'as':_0x96f4('0x40')},{'model':db['MailServerOut'],'as':_0x96f4('0x41')},{'model':db['Pause'],'as':_0x96f4('0x42')}]},_0x552d24={},_0x131c43={'count':0x0,'rows':[]};var _0x245c05=_[_0x96f4('0x43')](db[_0x96f4('0x44')][_0x96f4('0x45')],function(_0x1d0fa9){return{'name':_0x1d0fa9[_0x96f4('0x46')],'type':_0x1d0fa9[_0x96f4('0x47')][_0x96f4('0x48')]};});_0x552d24[_0x96f4('0x49')]=_[_0x96f4('0x43')](_0x245c05,_0x96f4('0x3c'));_0x552d24['query']=_[_0x96f4('0x4a')](_0x5b8860['query']);_0x552d24['filters']=_[_0x96f4('0x4b')](_0x552d24['model'],_0x552d24[_0x96f4('0x4c')]);_0x345f14[_0x96f4('0x4d')]=_[_0x96f4('0x4b')](_0x552d24[_0x96f4('0x49')],qs[_0x96f4('0x4e')](_0x5b8860[_0x96f4('0x4c')]['fields']));_0x345f14['attributes']=_0x345f14['attributes']['length']?_0x345f14[_0x96f4('0x4d')]:_0x552d24['model'];if(!_0x5b8860[_0x96f4('0x4c')][_0x96f4('0x4f')](_0x96f4('0x50'))){_0x345f14[_0x96f4('0x33')]=qs[_0x96f4('0x33')](_0x5b8860[_0x96f4('0x4c')][_0x96f4('0x33')]);_0x345f14[_0x96f4('0x32')]=qs[_0x96f4('0x32')](_0x5b8860[_0x96f4('0x4c')][_0x96f4('0x32')]);}_0x345f14[_0x96f4('0x51')]=qs[_0x96f4('0x52')](_0x5b8860[_0x96f4('0x4c')]['sort']);_0x345f14[_0x96f4('0x53')]=qs[_0x96f4('0x54')](_[_0x96f4('0x55')](_0x5b8860[_0x96f4('0x4c')],_0x552d24[_0x96f4('0x54')]));if(_0x5b8860[_0x96f4('0x4c')][_0x96f4('0x56')]){_0x345f14[_0x96f4('0x53')]=_[_0x96f4('0x57')](_0x345f14[_0x96f4('0x53')],{'$or':_[_0x96f4('0x43')](_0x245c05,function(_0x374320){if(_0x374320['type']!=='VIRTUAL'){var _0x52b79a={};_0x52b79a[_0x374320[_0x96f4('0x3c')]]={'$like':'%'+_0x5b8860['query'][_0x96f4('0x56')]+'%'};return _0x52b79a;}})});}_0x345f14=_[_0x96f4('0x57')]({},_0x345f14,_0x5b8860[_0x96f4('0x58')]);var _0x59de1c={'where':_0x345f14['where']};return db['MailAccount'][_0x96f4('0x59')](_0x59de1c)[_0x96f4('0x25')](function(_0x32d21b){_0x131c43[_0x96f4('0x59')]=_0x32d21b;if(_0x5b8860[_0x96f4('0x4c')][_0x96f4('0x5a')]){_0x345f14[_0x96f4('0x5b')]=[{'all':!![]}];}return db[_0x96f4('0x44')][_0x96f4('0x5c')](_0x345f14);})['then'](function(_0xb7683d){_0x131c43[_0x96f4('0x5d')]=_0xb7683d;return _0x131c43;})[_0x96f4('0x25')](respondWithFilteredResult(_0x57f0d3,_0x345f14))['catch'](handleError(_0x57f0d3,null));};exports['show']=function(_0x4fe46a,_0xa0159){var _0x297beb={'raw':![],'where':{'id':_0x4fe46a['params']['id']},'include':[{'model':db[_0x96f4('0x3f')],'as':_0x96f4('0x40')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x96f4('0x5e')],'as':_0x96f4('0x42')}]},_0x49f717={};_0x49f717[_0x96f4('0x49')]=_[_0x96f4('0x4a')](db[_0x96f4('0x44')]['rawAttributes']);_0x49f717[_0x96f4('0x4c')]=_[_0x96f4('0x4a')](_0x4fe46a[_0x96f4('0x4c')]);_0x49f717[_0x96f4('0x54')]=_[_0x96f4('0x4b')](_0x49f717[_0x96f4('0x49')],_0x49f717[_0x96f4('0x4c')]);_0x297beb[_0x96f4('0x4d')]=_[_0x96f4('0x4b')](_0x49f717[_0x96f4('0x49')],qs[_0x96f4('0x4e')](_0x4fe46a[_0x96f4('0x4c')][_0x96f4('0x4e')]));_0x297beb[_0x96f4('0x4d')]=_0x297beb['attributes'][_0x96f4('0x5f')]?_0x297beb['attributes']:_0x49f717[_0x96f4('0x49')];if(_0x4fe46a[_0x96f4('0x4c')][_0x96f4('0x5a')]){_0x297beb[_0x96f4('0x5b')]=[{'all':!![]}];}_0x297beb=_[_0x96f4('0x57')]({},_0x297beb,_0x4fe46a[_0x96f4('0x58')]);return db[_0x96f4('0x44')][_0x96f4('0x60')](_0x297beb)[_0x96f4('0x25')](handleEntityNotFound(_0xa0159,null))[_0x96f4('0x25')](respondWithResult(_0xa0159,null))[_0x96f4('0x61')](handleError(_0xa0159,null));};exports[_0x96f4('0x37')]=function(_0x3a496b,_0x4fd30d){if(_0x3a496b['body']['id']){delete _0x3a496b[_0x96f4('0x62')]['id'];}return db[_0x96f4('0x44')][_0x96f4('0x60')]({'where':{'id':_0x3a496b[_0x96f4('0x63')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x96f4('0x40')},{'model':db['MailServerOut'],'as':_0x96f4('0x41')},{'model':db[_0x96f4('0x5e')],'as':_0x96f4('0x42')}]})[_0x96f4('0x25')](handleEntityNotFound(_0x4fd30d,null))[_0x96f4('0x25')](saveUpdates(_0x3a496b['body'],null))[_0x96f4('0x25')](function(_0x275f94){if(_0x275f94&&_0x3a496b[_0x96f4('0x62')][_0x96f4('0x40')]){return db[_0x96f4('0x3f')][_0x96f4('0x37')](_0x3a496b[_0x96f4('0x62')][_0x96f4('0x40')],{'where':{'MailAccountId':_0x275f94['id']}})[_0x96f4('0x25')](function(){return _0x275f94;});}return _0x275f94;})['then'](function(_0x5bc86b){if(_0x5bc86b&&_0x3a496b['body'][_0x96f4('0x41')]){return db[_0x96f4('0x64')][_0x96f4('0x37')](_0x3a496b[_0x96f4('0x62')][_0x96f4('0x41')],{'where':{'MailAccountId':_0x5bc86b['id']}})['then'](function(){return _0x5bc86b;});}return _0x5bc86b;})[_0x96f4('0x25')](respondWithResult(_0x4fd30d,null))[_0x96f4('0x61')](handleError(_0x4fd30d,null));};exports[_0x96f4('0x65')]=function(_0xc40791,_0x1b76f5){return db[_0x96f4('0x44')][_0x96f4('0x65')]()['then'](respondWithResult(_0x1b76f5,null))[_0x96f4('0x61')](handleError(_0x1b76f5,null));};exports['addDisposition']=function(_0x433a0e,_0x5644c0,_0x1b5446){if(_0x433a0e[_0x96f4('0x62')]['id']){delete _0x433a0e[_0x96f4('0x62')]['id'];}return db[_0x96f4('0x44')][_0x96f4('0x60')]({'where':{'id':_0x433a0e['params']['id']}})[_0x96f4('0x25')](handleEntityNotFound(_0x5644c0,null))[_0x96f4('0x25')](function(_0x26b73d){if(_0x26b73d){_0x433a0e[_0x96f4('0x62')]['MailAccountId']=_0x26b73d['id'];return db['Disposition'][_0x96f4('0x66')](_0x433a0e[_0x96f4('0x62')]);}})['then'](respondWithResult(_0x5644c0,null))[_0x96f4('0x61')](handleError(_0x5644c0,null));};exports['getDispositions']=function(_0x207755,_0x1689d3,_0x4ed3b4){var _0x3a5a6c={'raw':![],'where':{}};var _0x3ff9b7={};var _0x4397bb={'count':0x0,'rows':[]};return db[_0x96f4('0x44')][_0x96f4('0x67')]({'where':{'id':_0x207755[_0x96f4('0x63')]['id']}})[_0x96f4('0x25')](handleEntityNotFound(_0x1689d3,null))[_0x96f4('0x25')](function(_0x3ff8de){if(_0x3ff8de){_0x3ff9b7['model']=_[_0x96f4('0x4a')](db[_0x96f4('0x68')][_0x96f4('0x45')]);_0x3ff9b7[_0x96f4('0x4c')]=_[_0x96f4('0x4a')](_0x207755[_0x96f4('0x4c')]);_0x3ff9b7[_0x96f4('0x54')]=_['intersection'](_0x3ff9b7[_0x96f4('0x49')],_0x3ff9b7[_0x96f4('0x4c')]);_0x3a5a6c[_0x96f4('0x4d')]=_['intersection'](_0x3ff9b7[_0x96f4('0x49')],qs[_0x96f4('0x4e')](_0x207755[_0x96f4('0x4c')][_0x96f4('0x4e')]));_0x3a5a6c[_0x96f4('0x4d')]=_0x3a5a6c[_0x96f4('0x4d')]['length']?_0x3a5a6c['attributes']:_0x3ff9b7['model'];if(!_0x207755[_0x96f4('0x4c')][_0x96f4('0x4f')](_0x96f4('0x50'))){_0x3a5a6c['limit']=qs['limit'](_0x207755[_0x96f4('0x4c')][_0x96f4('0x33')]);_0x3a5a6c[_0x96f4('0x32')]=qs['offset'](_0x207755[_0x96f4('0x4c')]['offset']);}_0x3a5a6c[_0x96f4('0x51')]=qs[_0x96f4('0x52')](_0x207755[_0x96f4('0x4c')][_0x96f4('0x52')]);_0x3a5a6c[_0x96f4('0x53')]=qs[_0x96f4('0x54')](_['pick'](_0x207755['query'],_0x3ff9b7[_0x96f4('0x54')]));_0x3a5a6c[_0x96f4('0x53')][_0x96f4('0x69')]=_0x3ff8de['id'];if(_0x207755['query'][_0x96f4('0x56')]){_0x3a5a6c['where']=_[_0x96f4('0x57')](_0x3a5a6c[_0x96f4('0x53')],{'$or':_['map'](_0x3a5a6c[_0x96f4('0x4d')],function(_0x5c4b11){var _0x9b05dc={};_0x9b05dc[_0x5c4b11]={'$like':'%'+_0x207755[_0x96f4('0x4c')][_0x96f4('0x56')]+'%'};return _0x9b05dc;})});}_0x3a5a6c=_[_0x96f4('0x57')]({},_0x3a5a6c,_0x207755[_0x96f4('0x58')]);return db[_0x96f4('0x68')]['count']({'where':_0x3a5a6c[_0x96f4('0x53')]})[_0x96f4('0x25')](function(_0x200ea7){_0x4397bb['count']=_0x200ea7;if(_0x207755[_0x96f4('0x4c')][_0x96f4('0x5a')]){_0x3a5a6c['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3a5a6c);})['then'](function(_0x32bd87){_0x4397bb[_0x96f4('0x5d')]=_0x32bd87;return _0x4397bb;});}})['then'](respondWithFilteredResult(_0x1689d3,_0x3a5a6c))[_0x96f4('0x61')](handleError(_0x1689d3,null));};exports[_0x96f4('0x6a')]=function(_0x341f1c,_0x4a4108,_0x1db945){return db[_0x96f4('0x44')]['find']({'where':{'id':_0x341f1c[_0x96f4('0x63')]['id']}})[_0x96f4('0x25')](handleEntityNotFound(_0x4a4108,null))['then'](function(_0x2e65a4){if(_0x2e65a4){return _0x2e65a4['removeDispositions'](_0x341f1c[_0x96f4('0x4c')]['ids']);}})[_0x96f4('0x25')](respondWithStatusCode(_0x4a4108,null))[_0x96f4('0x61')](handleError(_0x4a4108,null));};exports[_0x96f4('0x6b')]=function(_0x275ac1,_0x33178e,_0x1e69bc){if(_0x275ac1[_0x96f4('0x62')]['id']){delete _0x275ac1[_0x96f4('0x62')]['id'];}return db[_0x96f4('0x44')][_0x96f4('0x60')]({'where':{'id':_0x275ac1['params']['id']}})['then'](handleEntityNotFound(_0x33178e,null))[_0x96f4('0x25')](function(_0x3ee0a2){if(_0x3ee0a2){_0x275ac1[_0x96f4('0x62')][_0x96f4('0x69')]=_0x3ee0a2['id'];return db[_0x96f4('0x6c')]['create'](_0x275ac1[_0x96f4('0x62')]);}})[_0x96f4('0x25')](respondWithResult(_0x33178e,null))[_0x96f4('0x61')](handleError(_0x33178e,null));};exports[_0x96f4('0x6d')]=function(_0x2af043,_0x513da2,_0x184150){var _0x5c1bae={'raw':![],'where':{}};var _0x42ef30={};var _0x585446={'count':0x0,'rows':[]};return db['MailAccount'][_0x96f4('0x67')]({'where':{'id':_0x2af043[_0x96f4('0x63')]['id']}})[_0x96f4('0x25')](handleEntityNotFound(_0x513da2,null))['then'](function(_0x1a19cd){if(_0x1a19cd){_0x42ef30[_0x96f4('0x49')]=_['keys'](db[_0x96f4('0x6c')][_0x96f4('0x45')]);_0x42ef30['query']=_[_0x96f4('0x4a')](_0x2af043[_0x96f4('0x4c')]);_0x42ef30['filters']=_[_0x96f4('0x4b')](_0x42ef30[_0x96f4('0x49')],_0x42ef30['query']);_0x5c1bae['attributes']=_[_0x96f4('0x4b')](_0x42ef30[_0x96f4('0x49')],qs[_0x96f4('0x4e')](_0x2af043['query'][_0x96f4('0x4e')]));_0x5c1bae['attributes']=_0x5c1bae['attributes']['length']?_0x5c1bae[_0x96f4('0x4d')]:_0x42ef30[_0x96f4('0x49')];if(!_0x2af043[_0x96f4('0x4c')][_0x96f4('0x4f')](_0x96f4('0x50'))){_0x5c1bae[_0x96f4('0x33')]=qs[_0x96f4('0x33')](_0x2af043[_0x96f4('0x4c')]['limit']);_0x5c1bae[_0x96f4('0x32')]=qs[_0x96f4('0x32')](_0x2af043[_0x96f4('0x4c')][_0x96f4('0x32')]);}_0x5c1bae[_0x96f4('0x51')]=qs[_0x96f4('0x52')](_0x2af043[_0x96f4('0x4c')][_0x96f4('0x52')]);_0x5c1bae[_0x96f4('0x53')]=qs[_0x96f4('0x54')](_[_0x96f4('0x55')](_0x2af043[_0x96f4('0x4c')],_0x42ef30[_0x96f4('0x54')]));_0x5c1bae['where'][_0x96f4('0x69')]=_0x1a19cd['id'];if(_0x2af043[_0x96f4('0x4c')][_0x96f4('0x56')]){_0x5c1bae[_0x96f4('0x53')]=_[_0x96f4('0x57')](_0x5c1bae[_0x96f4('0x53')],{'$or':_[_0x96f4('0x43')](_0x5c1bae['attributes'],function(_0x2cb4b1){var _0x3c6436={};_0x3c6436[_0x2cb4b1]={'$like':'%'+_0x2af043[_0x96f4('0x4c')][_0x96f4('0x56')]+'%'};return _0x3c6436;})});}_0x5c1bae=_[_0x96f4('0x57')]({},_0x5c1bae,_0x2af043[_0x96f4('0x58')]);return db[_0x96f4('0x6c')]['count']({'where':_0x5c1bae[_0x96f4('0x53')]})['then'](function(_0x4f410f){_0x585446[_0x96f4('0x59')]=_0x4f410f;if(_0x2af043['query']['includeAll']){_0x5c1bae[_0x96f4('0x5b')]=[{'all':!![]}];}return db[_0x96f4('0x6c')][_0x96f4('0x5c')](_0x5c1bae);})[_0x96f4('0x25')](function(_0x830029){_0x585446[_0x96f4('0x5d')]=_0x830029;return _0x585446;});}})[_0x96f4('0x25')](respondWithFilteredResult(_0x513da2,_0x5c1bae))[_0x96f4('0x61')](handleError(_0x513da2,null));};exports['removeAnswers']=function(_0x756fa5,_0x358e95,_0x5d804f){return db['MailAccount'][_0x96f4('0x60')]({'where':{'id':_0x756fa5[_0x96f4('0x63')]['id']}})['then'](handleEntityNotFound(_0x358e95,null))[_0x96f4('0x25')](function(_0x537270){if(_0x537270){return _0x537270[_0x96f4('0x6e')](_0x756fa5[_0x96f4('0x4c')][_0x96f4('0x6f')]);}})[_0x96f4('0x25')](respondWithStatusCode(_0x358e95,null))['catch'](handleError(_0x358e95,null));};exports['create']=function(_0x231e56,_0xe24aa1){var _0x1d1042={'name':_0x231e56[_0x96f4('0x62')][_0x96f4('0x3c')],'key':_0x231e56[_0x96f4('0x62')]['key'],'email':_0x231e56[_0x96f4('0x62')]['email'],'ListId':_0x231e56[_0x96f4('0x62')][_0x96f4('0x70')],'active':!_[_0x96f4('0x71')](_0x231e56['body'][_0x96f4('0x72')])?_0x231e56[_0x96f4('0x62')][_0x96f4('0x72')]:!![],'description':_0x231e56['body'][_0x96f4('0x73')]||null,'Imap':{},'Smtp':{}};if(_[_0x96f4('0x71')](_0x231e56[_0x96f4('0x62')]['cservice'])){if(_0x231e56[_0x96f4('0x62')][_0x96f4('0x74')]){_0x1d1042[_0x96f4('0x40')][_0x96f4('0x75')]=_0x1d1042[_0x96f4('0x41')]['user']=_0x231e56[_0x96f4('0x62')]['cuser'];_0x1d1042['Imap']['password']=_0x1d1042[_0x96f4('0x41')][_0x96f4('0x76')]=_0x231e56[_0x96f4('0x62')][_0x96f4('0x77')];}else{_0x1d1042[_0x96f4('0x40')]['authentication']=_0x1d1042[_0x96f4('0x41')][_0x96f4('0x78')]=![];}_0x1d1042[_0x96f4('0x40')]['host']=_0x231e56[_0x96f4('0x62')][_0x96f4('0x40')]['host'];_0x1d1042[_0x96f4('0x40')][_0x96f4('0x79')]=_0x231e56[_0x96f4('0x62')][_0x96f4('0x40')]['port'];_0x1d1042[_0x96f4('0x41')][_0x96f4('0x7a')]=_0x231e56[_0x96f4('0x62')][_0x96f4('0x41')]['host'];_0x1d1042['Smtp']['port']=_0x231e56[_0x96f4('0x62')][_0x96f4('0x41')][_0x96f4('0x79')];}else{_0x1d1042[_0x96f4('0x40')][_0x96f4('0x7b')]=_0x1d1042[_0x96f4('0x41')][_0x96f4('0x7b')]=_0x231e56[_0x96f4('0x62')][_0x96f4('0x7c')];_0x1d1042['Imap']['user']=_0x1d1042['Smtp'][_0x96f4('0x75')]=_0x231e56[_0x96f4('0x62')][_0x96f4('0x7d')];_0x1d1042[_0x96f4('0x40')][_0x96f4('0x7e')]=_0x1d1042[_0x96f4('0x41')][_0x96f4('0x76')]=_0x231e56[_0x96f4('0x62')][_0x96f4('0x77')];}return db[_0x96f4('0x44')][_0x96f4('0x66')](_0x1d1042,{'include':[{'model':db[_0x96f4('0x64')],'as':_0x96f4('0x41')},{'model':db[_0x96f4('0x3f')],'as':_0x96f4('0x40')}]})[_0x96f4('0x25')](function(_0x28825a){var _0x25296e=_0x231e56[_0x96f4('0x75')][_0x96f4('0x39')]({'plain':!![]});if(!_0x25296e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25296e['role']===_0x96f4('0x75')){var _0x9b2592=_0x28825a['get']({'plain':!![]});return db[_0x96f4('0x7f')][_0x96f4('0x60')]({'where':{'name':_0x96f4('0x3a'),'userProfileId':_0x25296e[_0x96f4('0x80')]},'raw':!![]})[_0x96f4('0x25')](function(_0x437ac3){if(_0x437ac3&&_0x437ac3['autoAssociation']===0x0){return db['UserProfileResource'][_0x96f4('0x66')]({'name':_0x9b2592[_0x96f4('0x3c')],'resourceId':_0x9b2592['id'],'type':_0x437ac3[_0x96f4('0x3c')],'sectionId':_0x437ac3['id']},{})[_0x96f4('0x25')](function(){return _0x28825a;});}else{return _0x28825a;}})[_0x96f4('0x61')](function(_0x16349d){logger[_0x96f4('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16349d);throw _0x16349d;});}return _0x28825a;})[_0x96f4('0x25')](respondWithResult(_0xe24aa1,0xc9))['catch'](handleError(_0xe24aa1,null));};exports[_0x96f4('0x81')]=function(_0x4249cc,_0x17b1bf,_0x1b5d33){return db[_0x96f4('0x44')]['findOne']({'where':{'id':_0x4249cc['params']['id']}})[_0x96f4('0x25')](handleEntityNotFound(_0x17b1bf,null))[_0x96f4('0x25')](function(_0x48def2){if(_0x48def2){return _0x48def2[_0x96f4('0x81')]();}return null;})['then'](respondWithResult(_0x17b1bf,null))[_0x96f4('0x61')](handleError(_0x17b1bf,null));};exports[_0x96f4('0x82')]=function(_0x59c4cc,_0x134cbd,_0x3ce000){if(_0x59c4cc[_0x96f4('0x62')]['id']){delete _0x59c4cc[_0x96f4('0x62')]['id'];}return db[_0x96f4('0x44')][_0x96f4('0x60')]({'where':{'id':_0x59c4cc[_0x96f4('0x63')]['id']}})[_0x96f4('0x25')](handleEntityNotFound(_0x134cbd,null))['then'](function(_0x46fceb){if(_0x46fceb){_0x59c4cc[_0x96f4('0x62')]['MailAccountId']=_0x46fceb['id'];return db[_0x96f4('0x3f')][_0x96f4('0x66')](_0x59c4cc[_0x96f4('0x62')]);}})[_0x96f4('0x25')](respondWithResult(_0x134cbd,null))['catch'](handleError(_0x134cbd,null));};exports[_0x96f4('0x83')]=function(_0x31554c,_0x46bc44,_0x27eb4a){return db[_0x96f4('0x44')]['findOne']({'where':{'id':_0x31554c[_0x96f4('0x63')]['id']}})[_0x96f4('0x25')](handleEntityNotFound(_0x46bc44,null))[_0x96f4('0x25')](function(_0xc55a0f){if(_0xc55a0f){return _0xc55a0f['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x46bc44,null))[_0x96f4('0x61')](handleError(_0x46bc44,null));};exports['getSmtp']=function(_0x275c02,_0x44554e,_0x3faf0c){return db[_0x96f4('0x44')]['findOne']({'where':{'id':_0x275c02['params']['id']}})['then'](handleEntityNotFound(_0x44554e,null))['then'](function(_0x34bc25){if(_0x34bc25){return _0x34bc25[_0x96f4('0x84')]();}return null;})[_0x96f4('0x25')](respondWithResult(_0x44554e,null))[_0x96f4('0x61')](handleError(_0x44554e,null));};exports[_0x96f4('0x85')]=function(_0x3b72f0,_0x2a62bd,_0xdafe18){if(_0x3b72f0['body']['id']){delete _0x3b72f0[_0x96f4('0x62')]['id'];}return db[_0x96f4('0x44')][_0x96f4('0x60')]({'where':{'id':_0x3b72f0[_0x96f4('0x63')]['id']}})[_0x96f4('0x25')](handleEntityNotFound(_0x2a62bd,null))[_0x96f4('0x25')](function(_0x2ebe32){if(_0x2ebe32){_0x3b72f0[_0x96f4('0x62')][_0x96f4('0x69')]=_0x2ebe32['id'];return db[_0x96f4('0x64')][_0x96f4('0x66')](_0x3b72f0[_0x96f4('0x62')]);}})[_0x96f4('0x25')](respondWithResult(_0x2a62bd,null))[_0x96f4('0x61')](handleError(_0x2a62bd,null));};exports[_0x96f4('0x86')]=function(_0x38c2d1,_0x32ee61,_0x57cacb){return db[_0x96f4('0x44')][_0x96f4('0x67')]({'where':{'id':_0x38c2d1['params']['id']}})['then'](handleEntityNotFound(_0x32ee61,null))['then'](function(_0x310cdc){if(_0x310cdc){return _0x310cdc[_0x96f4('0x87')](null);}return null;})[_0x96f4('0x25')](respondWithStatusCode(_0x32ee61,null))[_0x96f4('0x61')](handleError(_0x32ee61,null));};exports['addInteraction']=function(_0x34f505,_0x48c3fa,_0x361ec6){return db[_0x96f4('0x88')][_0x96f4('0x60')]({'where':{'id':_0x34f505[_0x96f4('0x63')]['id']}})['then'](handleEntityNotFound(_0x48c3fa,null))[_0x96f4('0x25')](function(_0x3360f4){if(_0x3360f4){return _0x3360f4[_0x96f4('0x89')](_0x34f505[_0x96f4('0x62')][_0x96f4('0x6f')],_[_0x96f4('0x8a')](_0x34f505['body'],[_0x96f4('0x6f'),'id'])||{});}})[_0x96f4('0x25')](respondWithResult(_0x48c3fa,null))[_0x96f4('0x61')](handleError(_0x48c3fa,null));};exports[_0x96f4('0x8b')]=function(_0x4fb803,_0x54f101,_0x4a6f65){var _0x4b2a18={'raw':![],'where':{}};var _0x4461e7={};var _0xdce2f9={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x4fb803[_0x96f4('0x63')]['id']}})[_0x96f4('0x25')](handleEntityNotFound(_0x54f101,null))['then'](function(_0x49a9fd){if(_0x49a9fd){_0x4461e7[_0x96f4('0x49')]=_[_0x96f4('0x4a')](db[_0x96f4('0x88')]['rawAttributes']);_0x4461e7[_0x96f4('0x4c')]=_[_0x96f4('0x4a')](_0x4fb803['query']);_0x4461e7[_0x96f4('0x54')]=_['intersection'](_0x4461e7[_0x96f4('0x49')],_0x4461e7[_0x96f4('0x4c')]);_0x4b2a18[_0x96f4('0x4d')]=_[_0x96f4('0x4b')](_0x4461e7[_0x96f4('0x49')],qs['fields'](_0x4fb803[_0x96f4('0x4c')][_0x96f4('0x4e')]));_0x4b2a18[_0x96f4('0x4d')]=_0x4b2a18[_0x96f4('0x4d')]['length']?_0x4b2a18[_0x96f4('0x4d')]:_0x4461e7[_0x96f4('0x49')];if(!_0x4fb803[_0x96f4('0x4c')][_0x96f4('0x4f')]('nolimit')){_0x4b2a18[_0x96f4('0x33')]=qs[_0x96f4('0x33')](_0x4fb803[_0x96f4('0x4c')]['limit']);_0x4b2a18[_0x96f4('0x32')]=qs[_0x96f4('0x32')](_0x4fb803[_0x96f4('0x4c')][_0x96f4('0x32')]);}_0x4b2a18['order']=qs[_0x96f4('0x52')](_0x4fb803['query'][_0x96f4('0x52')]);_0x4b2a18[_0x96f4('0x53')]=qs[_0x96f4('0x54')](_['pick'](_0x4fb803[_0x96f4('0x4c')],_0x4461e7[_0x96f4('0x54')]));_0x4b2a18[_0x96f4('0x53')][_0x96f4('0x69')]=_0x49a9fd['id'];if(_0x4fb803[_0x96f4('0x4c')][_0x96f4('0x56')]){_0x4b2a18[_0x96f4('0x53')]=_[_0x96f4('0x57')](_0x4b2a18[_0x96f4('0x53')],{'$or':_[_0x96f4('0x43')](_0x4b2a18[_0x96f4('0x4d')],function(_0x5b83bd){var _0x35fe93={};_0x35fe93[_0x5b83bd]={'$like':'%'+_0x4fb803[_0x96f4('0x4c')]['filter']+'%'};return _0x35fe93;})});}_0x4b2a18=_[_0x96f4('0x57')]({},_0x4b2a18,_0x4fb803['options']);return db[_0x96f4('0x88')][_0x96f4('0x59')]({'where':_0x4b2a18[_0x96f4('0x53')]})[_0x96f4('0x25')](function(_0x2e2938){_0xdce2f9[_0x96f4('0x59')]=_0x2e2938;if(_0x4fb803[_0x96f4('0x4c')][_0x96f4('0x5a')]){_0x4b2a18[_0x96f4('0x5b')]=[{'model':db[_0x96f4('0x8c')],'as':_0x96f4('0x8d'),'required':![]},{'model':db['User'],'as':_0x96f4('0x8e'),'attributes':[_0x96f4('0x3c'),_0x96f4('0x8f'),_0x96f4('0x90')],'required':![]},{'model':db[_0x96f4('0x91')],'as':_0x96f4('0x92'),'attributes':['id',_0x96f4('0x3c'),_0x96f4('0x93')],'where':_0x4fb803[_0x96f4('0x4c')][_0x96f4('0x94')]?{'id':_0x4fb803[_0x96f4('0x4c')][_0x96f4('0x94')]}:undefined,'required':_0x4fb803[_0x96f4('0x4c')][_0x96f4('0x94')]?!![]:![]}];}return db[_0x96f4('0x88')][_0x96f4('0x5c')](_0x4b2a18);})[_0x96f4('0x25')](function(_0x5dba55){_0xdce2f9[_0x96f4('0x5d')]=_0x5dba55;return _0xdce2f9;});}})['then'](respondWithFilteredResult(_0x54f101,_0x4b2a18))[_0x96f4('0x61')](handleError(_0x54f101,null));};exports['addApplications']=function(_0x546990,_0x27f981,_0x3300b5){return db[_0x96f4('0x44')][_0x96f4('0x67')]({'where':{'id':_0x546990[_0x96f4('0x63')]['id']}})[_0x96f4('0x25')](handleEntityNotFound(_0x27f981,null))[_0x96f4('0x25')](function(_0x122578){if(_0x122578){return db[_0x96f4('0x95')][_0x96f4('0x96')](function(_0x1b36c5){return db[_0x96f4('0x97')]['destroy']({'where':{'MailAccountId':_0x546990[_0x96f4('0x63')]['id']},'transaction':_0x1b36c5})[_0x96f4('0x25')](function(_0x4e6ab6){var _0x396e5f=_[_0x96f4('0x43')](_0x546990[_0x96f4('0x62')],function(_0x3bc96a){_0x3bc96a[_0x96f4('0x69')]=_0x546990[_0x96f4('0x63')]['id'];return _0x3bc96a;});return db[_0x96f4('0x97')]['bulkCreate'](_0x396e5f,{'transaction':_0x1b36c5});});})[_0x96f4('0x25')](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x546990[_0x96f4('0x63')]['id']},'order':_0x96f4('0x98')});});}})[_0x96f4('0x25')](respondWithResult(_0x27f981,null))['catch'](handleError(_0x27f981,null));};exports[_0x96f4('0x99')]=function(_0x672c3c,_0x57ef07,_0x38b1b4){var _0x300c2c={};var _0x5bddde={};var _0x1f5d93;var _0x2437b4;return db['MailAccount'][_0x96f4('0x67')]({'where':{'id':_0x672c3c[_0x96f4('0x63')]['id']}})[_0x96f4('0x25')](handleEntityNotFound(_0x57ef07,null))['then'](function(_0x4588cb){if(_0x4588cb){_0x1f5d93=_0x4588cb;_0x5bddde[_0x96f4('0x49')]=_['keys'](db[_0x96f4('0x97')]['rawAttributes']);_0x5bddde[_0x96f4('0x4c')]=_[_0x96f4('0x4a')](_0x672c3c['query']);_0x5bddde[_0x96f4('0x54')]=_[_0x96f4('0x4b')](_0x5bddde['model'],_0x5bddde[_0x96f4('0x4c')]);_0x300c2c['attributes']=_[_0x96f4('0x4b')](_0x5bddde[_0x96f4('0x49')],qs[_0x96f4('0x4e')](_0x672c3c[_0x96f4('0x4c')][_0x96f4('0x4e')]));_0x300c2c['attributes']=_0x300c2c[_0x96f4('0x4d')]['length']?_0x300c2c[_0x96f4('0x4d')]:_0x5bddde['model'];_0x300c2c[_0x96f4('0x51')]=qs[_0x96f4('0x52')](_0x672c3c[_0x96f4('0x4c')][_0x96f4('0x52')]);_0x300c2c[_0x96f4('0x53')]=qs[_0x96f4('0x54')](_[_0x96f4('0x55')](_0x672c3c[_0x96f4('0x4c')],_0x5bddde[_0x96f4('0x54')]));if(_0x672c3c['query'][_0x96f4('0x56')]){_0x300c2c['where']=_[_0x96f4('0x57')](_0x300c2c[_0x96f4('0x53')],{'$or':_[_0x96f4('0x43')](_0x300c2c[_0x96f4('0x4d')],function(_0x33c7cb){var _0x3fd150={};_0x3fd150[_0x33c7cb]={'$like':'%'+_0x672c3c[_0x96f4('0x4c')][_0x96f4('0x56')]+'%'};return _0x3fd150;})});}_0x300c2c=_['merge']({},_0x300c2c,_0x672c3c[_0x96f4('0x58')]);return _0x1f5d93['getApplications'](_0x300c2c);}})[_0x96f4('0x25')](function(_0x3d0ff1){if(_0x3d0ff1){_0x2437b4=_0x3d0ff1['length'];if(!_0x672c3c[_0x96f4('0x4c')][_0x96f4('0x4f')](_0x96f4('0x50'))){_0x300c2c['limit']=qs[_0x96f4('0x33')](_0x672c3c[_0x96f4('0x4c')][_0x96f4('0x33')]);_0x300c2c['offset']=qs[_0x96f4('0x32')](_0x672c3c['query'][_0x96f4('0x32')]);}return _0x1f5d93[_0x96f4('0x99')](_0x300c2c);}})[_0x96f4('0x25')](function(_0x3b3435){if(_0x3b3435){return _0x3b3435?{'count':_0x2437b4,'rows':_0x3b3435}:null;}})[_0x96f4('0x25')](respondWithResult(_0x57ef07,null))[_0x96f4('0x61')](handleError(_0x57ef07,null));};exports['getMessages']=function(_0x1ac632,_0x732ef0,_0x3ac3a5){var _0x1c4ad3={'raw':!![],'where':{}};var _0x4c8d20={};var _0x526ff5={'count':0x0,'rows':[]};return db[_0x96f4('0x44')][_0x96f4('0x67')]({'where':{'id':_0x1ac632[_0x96f4('0x63')]['id']}})['then'](handleEntityNotFound(_0x732ef0,null))[_0x96f4('0x25')](function(_0x3d1109){if(_0x3d1109){_0x4c8d20[_0x96f4('0x49')]=_[_0x96f4('0x4a')](db[_0x96f4('0x9a')][_0x96f4('0x45')]);_0x4c8d20['query']=_[_0x96f4('0x4a')](_0x1ac632[_0x96f4('0x4c')]);_0x4c8d20[_0x96f4('0x54')]=_[_0x96f4('0x4b')](_0x4c8d20[_0x96f4('0x49')],_0x4c8d20[_0x96f4('0x4c')]);_0x1c4ad3[_0x96f4('0x4d')]=_[_0x96f4('0x4b')](_0x4c8d20[_0x96f4('0x49')],qs['fields'](_0x1ac632[_0x96f4('0x4c')][_0x96f4('0x4e')]));_0x1c4ad3[_0x96f4('0x4d')]=_0x1c4ad3[_0x96f4('0x4d')][_0x96f4('0x5f')]?_0x1c4ad3[_0x96f4('0x4d')]:_0x4c8d20[_0x96f4('0x49')];if(!_0x1ac632[_0x96f4('0x4c')]['hasOwnProperty'](_0x96f4('0x50'))){_0x1c4ad3[_0x96f4('0x33')]=qs['limit'](_0x1ac632[_0x96f4('0x4c')]['limit']);_0x1c4ad3[_0x96f4('0x32')]=qs[_0x96f4('0x32')](_0x1ac632[_0x96f4('0x4c')][_0x96f4('0x32')]);}_0x1c4ad3[_0x96f4('0x51')]=qs['sort'](_0x1ac632['query'][_0x96f4('0x52')]);_0x1c4ad3['where']=qs[_0x96f4('0x54')](_[_0x96f4('0x55')](_0x1ac632[_0x96f4('0x4c')],_0x4c8d20[_0x96f4('0x54')]));_0x1c4ad3[_0x96f4('0x53')][_0x96f4('0x69')]=_0x3d1109['id'];if(_0x1ac632[_0x96f4('0x4c')]['filter']){_0x1c4ad3[_0x96f4('0x53')]=_[_0x96f4('0x57')](_0x1c4ad3['where'],{'$or':_[_0x96f4('0x43')](_0x1c4ad3[_0x96f4('0x4d')],function(_0x25fb4e){var _0x1bbfda={};_0x1bbfda[_0x25fb4e]={'$like':'%'+_0x1ac632[_0x96f4('0x4c')]['filter']+'%'};return _0x1bbfda;})});}if(_0x1ac632['query'][_0x96f4('0x9b')]){var _0x1d55ef=_0x1ac632[_0x96f4('0x4c')][_0x96f4('0x9b')]['split'](',');var _0x5b95ef={};_0x5b95ef[_0x1d55ef[0x0]]={'$gte':moment(_0x1d55ef[0x1])[_0x96f4('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1c4ad3[_0x96f4('0x53')]=_[_0x96f4('0x57')](_0x1c4ad3[_0x96f4('0x53')],_0x5b95ef);}_0x1c4ad3=_[_0x96f4('0x57')]({},_0x1c4ad3,_0x1ac632['options']);return db['MailMessage'][_0x96f4('0x59')]({'where':_0x1c4ad3['where']})[_0x96f4('0x25')](function(_0x1beb5a){_0x526ff5[_0x96f4('0x59')]=_0x1beb5a;if(_0x1ac632[_0x96f4('0x4c')][_0x96f4('0x5a')]){_0x1c4ad3['include']=[{'all':!![]}];}return db['MailMessage'][_0x96f4('0x5c')](_0x1c4ad3);})['then'](function(_0x57512b){_0x526ff5[_0x96f4('0x5d')]=_0x57512b;return _0x526ff5;});}})[_0x96f4('0x25')](respondWithFilteredResult(_0x732ef0,_0x1c4ad3))[_0x96f4('0x61')](handleError(_0x732ef0,null));};exports[_0x96f4('0x3d')]=function(_0x502323,_0x224d3b,_0x404854){var _0x1f09d7,_0x277297={},_0x4238f1;if(_0x502323[_0x96f4('0x62')]['to']){_0x4238f1=_0x502323[_0x96f4('0x62')]['to'][_0x96f4('0x9d')](',')[0x0];}return db[_0x96f4('0x44')]['find']({'where':{'id':_0x502323[_0x96f4('0x63')]['id']},'include':[{'model':db[_0x96f4('0x9e')],'as':_0x96f4('0x9f'),'include':[{'model':db['CmContact'],'as':_0x96f4('0xa0'),'where':{'email':_0x4238f1},'limit':0x1,'order':[['updatedAt',_0x96f4('0xa1')]]}]},{'model':db[_0x96f4('0x64')],'as':_0x96f4('0x41'),'raw':!![]}]})[_0x96f4('0x25')](handleEntityNotFound(_0x224d3b,null))[_0x96f4('0x25')](function(_0x5a1615){if(_0x5a1615){_0x1f09d7=_0x5a1615;if(_0x5a1615[_0x96f4('0x41')]){if(_['isNil'](_0x502323[_0x96f4('0x62')][_0x96f4('0xa2')])){_0x502323[_0x96f4('0x62')][_0x96f4('0xa2')]=util[_0x96f4('0x9c')](_0x96f4('0xa3'),_0x5a1615[_0x96f4('0x3c')],_0x5a1615[_0x96f4('0xa4')]||_0x5a1615['Smtp'][_0x96f4('0x75')]);}if(_0x502323[_0x96f4('0x62')]['attachments']&&_0x502323[_0x96f4('0x62')]['attachments'][_0x96f4('0x5f')]){for(var _0x10be5e=0x0;_0x10be5e<_0x502323[_0x96f4('0x62')][_0x96f4('0xa5')][_0x96f4('0x5f')];_0x10be5e+=0x1){_0x502323[_0x96f4('0x62')][_0x96f4('0xa5')][_0x10be5e]={'filename':_0x502323[_0x96f4('0x62')][_0x96f4('0xa5')][_0x10be5e][_0x96f4('0x3c')],'path':path[_0x96f4('0xa6')](config[_0x96f4('0xa7')],_0x96f4('0xa8'),_0x502323[_0x96f4('0x62')]['attachments'][_0x10be5e][_0x96f4('0xa9')])};}}var _0x1d43c0={'tls':{'rejectUnauthorized':![]}};if(_[_0x96f4('0x71')](_0x5a1615['Smtp']['service'])){if(_0x5a1615['Smtp'][_0x96f4('0x78')]){_0x1d43c0[_0x96f4('0xaa')]={'user':_0x5a1615[_0x96f4('0x41')]['user'],'pass':_0x5a1615['Smtp'][_0x96f4('0x76')]};}_0x1d43c0[_0x96f4('0x7a')]=_0x5a1615[_0x96f4('0x41')][_0x96f4('0x7a')];_0x1d43c0[_0x96f4('0x79')]=_0x5a1615[_0x96f4('0x41')][_0x96f4('0x79')];_0x1d43c0[_0x96f4('0xab')]=_0x5a1615[_0x96f4('0x41')][_0x96f4('0xab')];}else{_0x1d43c0['service']=_0x5a1615['Smtp']['service'];_0x1d43c0['auth']={'user':_0x5a1615[_0x96f4('0x41')][_0x96f4('0x75')],'pass':_0x5a1615[_0x96f4('0x41')][_0x96f4('0x76')]};}return respondWithRpcPromise('SendMail',_0x96f4('0xac'),{'account':_0x1d43c0,'message':_0x502323[_0x96f4('0x62')]});}else{throw new Error(_0x96f4('0xad'));}}})[_0x96f4('0x25')](function(_0x2d884c){if(_0x2d884c){_0x277297=_0x2d884c;if(_0x1f09d7[_0x96f4('0x9f')]){if(_0x1f09d7[_0x96f4('0x9f')][_0x96f4('0xa0')][_0x96f4('0x5f')]){return _0x1f09d7['List'][_0x96f4('0xa0')][0x0];}else{return db['CmContact']['create'](_[_0x96f4('0x19')](_0x502323['body'],{'firstName':_0x502323['body']['to'],'email':_0x502323[_0x96f4('0x62')]['to'],'phone':_0x502323['body']['to'],'ListId':_0x1f09d7['ListId']}));}}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x11b6ec){if(_0x11b6ec){var _0x20c623={'UserId':_0x502323[_0x96f4('0x75')]['id'],'ContactId':_0x11b6ec['id'],'MailAccountId':_0x1f09d7['id'],'inReplyTo':_0x277297[_0x96f4('0xae')],'to':_0x502323['body'][_0x96f4('0xa2')],'cc':_0x502323[_0x96f4('0x62')]['cc'],'subject':_0x502323[_0x96f4('0x62')]['subject'],'attach':_0x502323['body']['attach'],'firstMsgDirection':_0x96f4('0xaf'),'lastMsgAt':moment()[_0x96f4('0x9c')](_0x96f4('0xb0')),'lastMsgDirection':_0x96f4('0xaf'),'lastMsgBody':_0x502323[_0x96f4('0x62')]['body'],'Messages':[_[_0x96f4('0x57')](_0x502323[_0x96f4('0x62')],{'messageId':_0x277297['messageId'],'sentAt':moment()[_0x96f4('0x9c')](_0x96f4('0xb0')),'read':!![],'MailAccountId':_0x1f09d7['id'],'UserId':_0x502323[_0x96f4('0x75')]['id'],'ContactId':_0x11b6ec['id']})]};if(_0x502323[_0x96f4('0x62')]['Interaction']){_0x20c623=_[_0x96f4('0x57')](_0x20c623,_0x502323[_0x96f4('0x62')][_0x96f4('0xb1')]);}return db[_0x96f4('0x88')][_0x96f4('0x66')](_0x20c623,{'include':[{'model':db[_0x96f4('0x9a')],'as':_0x96f4('0xb2')}]});}})[_0x96f4('0x25')](respondWithResult(_0x224d3b,null))[_0x96f4('0x61')](handleError(_0x224d3b,null));};exports[_0x96f4('0xb3')]=function(_0x2cb3f0,_0xa57a43,_0x22d8a8){return db['MailAccount'][_0x96f4('0x60')]({'where':{'id':_0x2cb3f0['params']['id']},'include':[{'model':db[_0x96f4('0x64')],'as':_0x96f4('0x41'),'raw':!![]}]})['then'](handleEntityNotFound(_0xa57a43,null))['then'](function(_0x1f1d33){if(_0x1f1d33&&_0x1f1d33['Smtp']){var _0x1d6b22={'id':_0x1f1d33['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1f1d33[_0x96f4('0x41')]['service']){_0x1d6b22[_0x96f4('0x7b')]=_0x1f1d33[_0x96f4('0x41')]['service'];}else{_0x1d6b22['host']=_0x1f1d33[_0x96f4('0x41')][_0x96f4('0x7a')];_0x1d6b22[_0x96f4('0x79')]=_0x1f1d33[_0x96f4('0x41')][_0x96f4('0x79')];_0x1d6b22[_0x96f4('0xab')]=_0x1f1d33['Smtp'][_0x96f4('0xab')];}if(_0x1f1d33[_0x96f4('0x41')]['authentication']){_0x1d6b22['auth']={'user':_0x1f1d33[_0x96f4('0x41')][_0x96f4('0x75')],'pass':_0x1f1d33[_0x96f4('0x41')][_0x96f4('0x76')]};}return respondWithRpcPromise(_0x96f4('0xb4'),'verifySmtp',{'account':_0x1d6b22});}})[_0x96f4('0x25')](respondWithResult(_0xa57a43,null))['catch'](handleError(_0xa57a43,null));};exports[_0x96f4('0x38')]=function(_0x19df39,_0x25145b){return db[_0x96f4('0x44')][_0x96f4('0x60')]({'where':{'id':_0x19df39[_0x96f4('0x63')]['id']}})[_0x96f4('0x25')](handleEntityNotFound(_0x25145b,null))[_0x96f4('0x25')](function(_0x3e20ee){if(_0x3e20ee&&_0x3e20ee[_0x96f4('0x7b')]){throw new db[(_0x96f4('0x21'))][(_0x96f4('0x22'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x3e20ee;})['then'](removeEntity(_0x25145b,null))[_0x96f4('0x61')](handleError(_0x25145b,null));};exports['addAgents']=function(_0x8f0404,_0x51d400,_0x5991f1){return db[_0x96f4('0x44')][_0x96f4('0x60')]({'where':{'id':_0x8f0404[_0x96f4('0x63')]['id']}})['then'](handleEntityNotFound(_0x51d400,null))[_0x96f4('0x25')](function(_0x2fc581){if(_0x2fc581){return _0x2fc581[_0x96f4('0xb5')](_0x8f0404[_0x96f4('0x62')][_0x96f4('0x6f')],_[_0x96f4('0x8a')](_0x8f0404[_0x96f4('0x62')],[_0x96f4('0x6f'),'id'])||{})[_0x96f4('0xb6')](function(_0x27b9fa){for(var _0x3025c2=0x0;_0x3025c2<_0x8f0404['body'][_0x96f4('0x6f')][_0x96f4('0x5f')];_0x3025c2+=0x1){socket[_0x96f4('0xb7')](_0x96f4('0xb8'),{'UserId':_0x8f0404[_0x96f4('0x62')][_0x96f4('0x6f')][_0x3025c2],'MailAccountId':_0x8f0404['params']['id']});}return _0x27b9fa;});}})['then'](respondWithResult(_0x51d400,null))[_0x96f4('0x61')](handleError(_0x51d400,null));};exports[_0x96f4('0xb9')]=function(_0x1bf1f8,_0x1a427b,_0x2d5920){return db[_0x96f4('0x44')][_0x96f4('0x60')]({'where':{'id':_0x1bf1f8[_0x96f4('0x63')]['id']}})[_0x96f4('0x25')](handleEntityNotFound(_0x1a427b,null))[_0x96f4('0x25')](function(_0x37d4a8){if(_0x37d4a8){return _0x37d4a8[_0x96f4('0xb9')](_0x1bf1f8[_0x96f4('0x4c')][_0x96f4('0x6f')])['then'](function(){if(_[_0x96f4('0xba')](_0x1bf1f8['query'][_0x96f4('0x6f')])){for(var _0x508637=0x0;_0x508637<_0x1bf1f8[_0x96f4('0x4c')][_0x96f4('0x6f')][_0x96f4('0x5f')];_0x508637+=0x1){socket['emit'](_0x96f4('0xbb'),{'UserId':Number(_0x1bf1f8['query'][_0x96f4('0x6f')][_0x508637]),'MailAccountId':Number(_0x1bf1f8['params']['id'])});}}else{socket[_0x96f4('0xb7')](_0x96f4('0xbb'),{'UserId':Number(_0x1bf1f8['query'][_0x96f4('0x6f')]),'MailAccountId':Number(_0x1bf1f8[_0x96f4('0x63')]['id'])});}});}})[_0x96f4('0x25')](respondWithStatusCode(_0x1a427b,null))[_0x96f4('0x61')](handleError(_0x1a427b,null));};exports[_0x96f4('0xbc')]=function(_0x5586cd,_0x45eabc,_0x921194){var _0x4a2def={};var _0x1dc3f4={};var _0xfe903d;var _0xb867dd;return db['MailAccount']['findOne']({'where':{'id':_0x5586cd[_0x96f4('0x63')]['id']}})[_0x96f4('0x25')](handleEntityNotFound(_0x45eabc,null))[_0x96f4('0x25')](function(_0x1eedd4){if(_0x1eedd4){_0xfe903d=_0x1eedd4;_0x1dc3f4[_0x96f4('0x49')]=_[_0x96f4('0x4a')](db[_0x96f4('0xbd')][_0x96f4('0x45')]);_0x1dc3f4[_0x96f4('0x4c')]=_['keys'](_0x5586cd[_0x96f4('0x4c')]);_0x1dc3f4['filters']=_[_0x96f4('0x4b')](_0x1dc3f4['model'],_0x1dc3f4[_0x96f4('0x4c')]);_0x4a2def['attributes']=_['intersection'](_0x1dc3f4[_0x96f4('0x49')],qs['fields'](_0x5586cd[_0x96f4('0x4c')][_0x96f4('0x4e')]));_0x4a2def[_0x96f4('0x4d')]=_0x4a2def[_0x96f4('0x4d')][_0x96f4('0x5f')]?_0x4a2def['attributes']:_0x1dc3f4[_0x96f4('0x49')];_0x4a2def[_0x96f4('0x51')]=qs['sort'](_0x5586cd[_0x96f4('0x4c')][_0x96f4('0x52')]);_0x4a2def['where']=qs[_0x96f4('0x54')](_['pick'](_0x5586cd[_0x96f4('0x4c')],_0x1dc3f4[_0x96f4('0x54')]));if(_0x5586cd[_0x96f4('0x4c')][_0x96f4('0x56')]){_0x4a2def[_0x96f4('0x53')]=_[_0x96f4('0x57')](_0x4a2def['where'],{'$or':_['map'](_0x4a2def[_0x96f4('0x4d')],function(_0x209d2b){var _0x1eaaef={};_0x1eaaef[_0x209d2b]={'$like':'%'+_0x5586cd[_0x96f4('0x4c')]['filter']+'%'};return _0x1eaaef;})});}_0x4a2def=_['merge']({},_0x4a2def,_0x5586cd['options']);return _0xfe903d[_0x96f4('0xbc')](_0x4a2def);}})['then'](function(_0x32ed5b){if(_0x32ed5b){_0xb867dd=_0x32ed5b['length'];if(!_0x5586cd[_0x96f4('0x4c')][_0x96f4('0x4f')](_0x96f4('0x50'))){_0x4a2def[_0x96f4('0x33')]=qs[_0x96f4('0x33')](_0x5586cd[_0x96f4('0x4c')]['limit']);_0x4a2def[_0x96f4('0x32')]=qs['offset'](_0x5586cd[_0x96f4('0x4c')]['offset']);}return _0xfe903d[_0x96f4('0xbc')](_0x4a2def);}})['then'](function(_0x1028a1){if(_0x1028a1){return _0x1028a1?{'count':_0xb867dd,'rows':_0x1028a1}:null;}})[_0x96f4('0x25')](respondWithResult(_0x45eabc,null))[_0x96f4('0x61')](handleError(_0x45eabc,null));}; \ No newline at end of file +var _0x9380=['$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','root','server/files/attachments','auth','secure','sendMail','ListId','List\x20not\x20found','out','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','destroy','get','MailAccounts','stack','name','send','index','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','MailServerIn','Smtp','merge','find','body','params','describe','addDisposition','Disposition','create','getDispositions','findOne','MailAccountId','filter','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','email','isNil','active','cauthentication','user','cuser','pass','cpassword','authentication','host','port','service','password','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','pick','CmContact','Contact','User','Owner','fullname','internal','Tags','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage'];(function(_0x3998ff,_0x58f511){var _0xfd997d=function(_0x114dc6){while(--_0x114dc6){_0x3998ff['push'](_0x3998ff['shift']());}};_0xfd997d(++_0x58f511);}(_0x9380,0x1aa));var _0x0938=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x9380[_0x4a53d];return _0x27410e;};'use strict';var pdf=require(_0x0938('0x0'));var emlformat=require(_0x0938('0x1'));var rimraf=require(_0x0938('0x2'));var zipdir=require(_0x0938('0x3'));var jsonpatch=require(_0x0938('0x4'));var rp=require(_0x0938('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0938('0x6'));var util=require(_0x0938('0x7'));var path=require(_0x0938('0x8'));var sox=require(_0x0938('0x9'));var csv=require(_0x0938('0xa'));var ejs=require(_0x0938('0xb'));var fs=require('fs');var _=require(_0x0938('0xc'));var squel=require(_0x0938('0xd'));var crypto=require(_0x0938('0xe'));var jsforce=require(_0x0938('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0938('0xa'));var querystring=require('querystring');var Papa=require(_0x0938('0x10'));var Redis=require(_0x0938('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0938('0x12'));var as=require(_0x0938('0x13'));var hardwareService=require(_0x0938('0x14'));var logger=require('../../config/logger')(_0x0938('0x15'));var utils=require(_0x0938('0x16'));var config=require(_0x0938('0x17'));var db=require(_0x0938('0x18'))['db'];config[_0x0938('0x19')]=_['defaults'](config[_0x0938('0x19')],{'host':_0x0938('0x1a'),'port':0x18eb});var socket=require(_0x0938('0x1b'))(new Redis(config[_0x0938('0x19')]));require('./mailAccount.socket')[_0x0938('0x1c')](socket);var jayson=require(_0x0938('0x1d'));var client=jayson[_0x0938('0x1e')][_0x0938('0x1f')]({'port':0x232b});function checkPasswordPattern(_0x287574,_0x427193,_0x36fc33){if(_0x36fc33){var _0x452927=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x452927[_0x0938('0x20')](_0x427193)){return _0x287574;}else{throw new db[(_0x0938('0x21'))][(_0x0938('0x22'))](_0x0938('0x23'));}}else{return _0x287574;}}function respondWithRpcPromise(_0x5e49f8,_0xb48a1b,_0x537a5d,_0x5ed720){return new BPromise(function(_0x4ece48,_0x2c3538){var _0x17eb3a=_0x5ed720||client;return _0x17eb3a[_0x0938('0x24')](_0x5e49f8,_0x537a5d)[_0x0938('0x25')](function(_0x1749de){logger[_0x0938('0x26')](_0x0938('0x27'),_0xb48a1b,_0x0938('0x28'));logger[_0x0938('0x29')](_0x0938('0x2a'),_0xb48a1b,_0x0938('0x28'),JSON[_0x0938('0x2b')](_0x1749de));if(_0x1749de[_0x0938('0x2c')]){if(_0x1749de[_0x0938('0x2c')][_0x0938('0x2d')]===0x1f4){logger[_0x0938('0x2c')](_0x0938('0x27'),_0xb48a1b,_0x1749de['error'][_0x0938('0x2e')]);return _0x2c3538(_0x1749de[_0x0938('0x2c')]['message']);}logger['error']('MailAccount,\x20%s,\x20%s',_0xb48a1b,_0x1749de[_0x0938('0x2c')][_0x0938('0x2e')]);return _0x4ece48(_0x1749de[_0x0938('0x2c')][_0x0938('0x2e')]);}else{logger[_0x0938('0x26')]('MailAccount,\x20%s,\x20%s',_0xb48a1b,'request\x20sent');_0x4ece48(_0x1749de[_0x0938('0x2f')]['message']);}})['catch'](function(_0x2695a4){logger[_0x0938('0x2c')](_0x0938('0x27'),_0xb48a1b,_0x2695a4);_0x2c3538(_0x2695a4);});});}function respondWithStatusCode(_0x1e2639,_0x3d15b1){_0x3d15b1=_0x3d15b1||0xcc;return function(_0x33fa57){if(_0x33fa57){return _0x1e2639[_0x0938('0x30')](_0x3d15b1);}return _0x1e2639['status'](_0x3d15b1)['end']();};}function respondWithResult(_0x581d84,_0x4880d){_0x4880d=_0x4880d||0xc8;return function(_0x294de7){if(_0x294de7){return _0x581d84[_0x0938('0x31')](_0x4880d)[_0x0938('0x32')](_0x294de7);}};}function respondWithFilteredResult(_0x5c5d70,_0x34f0ff){return function(_0xa6a2a5){if(_0xa6a2a5){var _0x2235a7=_0xa6a2a5[_0x0938('0x33')],_0x519015=_0x34f0ff[_0x0938('0x34')],_0x2b53df=_0x34f0ff[_0x0938('0x34')]+_0x34f0ff[_0x0938('0x35')],_0x714b72;if(_0x2b53df>=_0x2235a7){_0x2b53df=_0x2235a7;_0x714b72=0xc8;}else{_0x714b72=0xce;}_0x5c5d70[_0x0938('0x31')](_0x714b72);return _0x5c5d70['set'](_0x0938('0x36'),_0x519015+'-'+_0x2b53df+'/'+_0x2235a7)[_0x0938('0x32')](_0xa6a2a5);}return null;};}function patchUpdates(_0x4e3452){return function(_0x45e11c){try{jsonpatch[_0x0938('0x37')](_0x45e11c,_0x4e3452,!![]);}catch(_0x2e3e02){return BPromise['reject'](_0x2e3e02);}return _0x45e11c[_0x0938('0x38')]();};}function saveUpdates(_0x309b02,_0x46da99){return function(_0x48b733){if(_0x48b733){return _0x48b733[_0x0938('0x39')](_0x309b02)[_0x0938('0x25')](function(_0x328e6f){return _0x328e6f;});}return null;};}function removeEntity(_0x16bd69,_0xa77d4e){return function(_0x53494c){if(_0x53494c){return _0x53494c[_0x0938('0x3a')]()[_0x0938('0x25')](function(){var _0x47a5c2=_0x53494c[_0x0938('0x3b')]({'plain':!![]});var _0x105c5e=_0x0938('0x3c');return db['UserProfileResource']['destroy']({'where':{'type':_0x105c5e,'resourceId':_0x47a5c2['id']}})[_0x0938('0x25')](function(){return _0x53494c;});})[_0x0938('0x25')](function(){_0x16bd69[_0x0938('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c28a0,_0x191892){return function(_0x1b5587){if(!_0x1b5587){_0x1c28a0[_0x0938('0x30')](0x194);}return _0x1b5587;};}function handleError(_0x254e8f,_0x5d8c8e){_0x5d8c8e=_0x5d8c8e||0x1f4;return function(_0x5ec4f1){logger[_0x0938('0x2c')](_0x5ec4f1[_0x0938('0x3d')]);if(_0x5ec4f1[_0x0938('0x3e')]){delete _0x5ec4f1[_0x0938('0x3e')];}_0x254e8f['status'](_0x5d8c8e)[_0x0938('0x3f')](_0x5ec4f1);};}exports[_0x0938('0x40')]=function(_0x292097,_0x2177c6){var _0x33772c={'include':[{'model':db['MailServerIn'],'as':_0x0938('0x41')},{'model':db[_0x0938('0x42')],'as':'Smtp'},{'model':db[_0x0938('0x43')],'as':_0x0938('0x44')}]},_0x20f76f={},_0x2a519d={'count':0x0,'rows':[]};var _0x27e501=_[_0x0938('0x45')](db[_0x0938('0x46')][_0x0938('0x47')],function(_0x15a7aa){return{'name':_0x15a7aa[_0x0938('0x48')],'type':_0x15a7aa[_0x0938('0x49')][_0x0938('0x4a')]};});_0x20f76f[_0x0938('0x4b')]=_[_0x0938('0x45')](_0x27e501,_0x0938('0x3e'));_0x20f76f['query']=_[_0x0938('0x4c')](_0x292097[_0x0938('0x4d')]);_0x20f76f[_0x0938('0x4e')]=_[_0x0938('0x4f')](_0x20f76f[_0x0938('0x4b')],_0x20f76f[_0x0938('0x4d')]);_0x33772c[_0x0938('0x50')]=_['intersection'](_0x20f76f[_0x0938('0x4b')],qs['fields'](_0x292097[_0x0938('0x4d')][_0x0938('0x51')]));_0x33772c[_0x0938('0x50')]=_0x33772c[_0x0938('0x50')][_0x0938('0x52')]?_0x33772c[_0x0938('0x50')]:_0x20f76f[_0x0938('0x4b')];if(!_0x292097[_0x0938('0x4d')][_0x0938('0x53')](_0x0938('0x54'))){_0x33772c[_0x0938('0x35')]=qs[_0x0938('0x35')](_0x292097[_0x0938('0x4d')][_0x0938('0x35')]);_0x33772c[_0x0938('0x34')]=qs['offset'](_0x292097[_0x0938('0x4d')][_0x0938('0x34')]);}_0x33772c[_0x0938('0x55')]=qs[_0x0938('0x56')](_0x292097[_0x0938('0x4d')][_0x0938('0x56')]);_0x33772c[_0x0938('0x57')]=qs[_0x0938('0x4e')](_['pick'](_0x292097[_0x0938('0x4d')],_0x20f76f[_0x0938('0x4e')]));if(_0x292097['query']['filter']){_0x33772c[_0x0938('0x57')]=_['merge'](_0x33772c[_0x0938('0x57')],{'$or':_['map'](_0x27e501,function(_0x35c395){if(_0x35c395[_0x0938('0x49')]!==_0x0938('0x58')){var _0x5b9f89={};_0x5b9f89[_0x35c395[_0x0938('0x3e')]]={'$like':'%'+_0x292097[_0x0938('0x4d')]['filter']+'%'};return _0x5b9f89;}})});}_0x33772c=_['merge']({},_0x33772c,_0x292097[_0x0938('0x59')]);var _0x5d1265={'where':_0x33772c[_0x0938('0x57')]};return db[_0x0938('0x46')]['count'](_0x5d1265)[_0x0938('0x25')](function(_0x2d3db9){_0x2a519d[_0x0938('0x33')]=_0x2d3db9;if(_0x292097[_0x0938('0x4d')][_0x0938('0x5a')]){_0x33772c[_0x0938('0x5b')]=[{'all':!![]}];}return db[_0x0938('0x46')][_0x0938('0x5c')](_0x33772c);})[_0x0938('0x25')](function(_0x2c925c){_0x2a519d[_0x0938('0x5d')]=_0x2c925c;return _0x2a519d;})[_0x0938('0x25')](respondWithFilteredResult(_0x2177c6,_0x33772c))[_0x0938('0x5e')](handleError(_0x2177c6,null));};exports[_0x0938('0x5f')]=function(_0x3dd76d,_0x3634fa){var _0x4141bd={'raw':![],'where':{'id':_0x3dd76d['params']['id']},'include':[{'model':db[_0x0938('0x60')],'as':_0x0938('0x41')},{'model':db[_0x0938('0x42')],'as':_0x0938('0x61')},{'model':db[_0x0938('0x43')],'as':_0x0938('0x44')}]},_0x37e2b0={};_0x37e2b0['model']=_[_0x0938('0x4c')](db['MailAccount']['rawAttributes']);_0x37e2b0[_0x0938('0x4d')]=_[_0x0938('0x4c')](_0x3dd76d[_0x0938('0x4d')]);_0x37e2b0[_0x0938('0x4e')]=_[_0x0938('0x4f')](_0x37e2b0['model'],_0x37e2b0[_0x0938('0x4d')]);_0x4141bd[_0x0938('0x50')]=_[_0x0938('0x4f')](_0x37e2b0[_0x0938('0x4b')],qs[_0x0938('0x51')](_0x3dd76d[_0x0938('0x4d')][_0x0938('0x51')]));_0x4141bd[_0x0938('0x50')]=_0x4141bd[_0x0938('0x50')][_0x0938('0x52')]?_0x4141bd[_0x0938('0x50')]:_0x37e2b0['model'];if(_0x3dd76d[_0x0938('0x4d')]['includeAll']){_0x4141bd[_0x0938('0x5b')]=[{'all':!![]}];}_0x4141bd=_[_0x0938('0x62')]({},_0x4141bd,_0x3dd76d[_0x0938('0x59')]);return db['MailAccount'][_0x0938('0x63')](_0x4141bd)[_0x0938('0x25')](handleEntityNotFound(_0x3634fa,null))[_0x0938('0x25')](respondWithResult(_0x3634fa,null))['catch'](handleError(_0x3634fa,null));};exports[_0x0938('0x39')]=function(_0x1e0c87,_0xa2965c){if(_0x1e0c87['body']['id']){delete _0x1e0c87[_0x0938('0x64')]['id'];}return db[_0x0938('0x46')][_0x0938('0x63')]({'where':{'id':_0x1e0c87[_0x0938('0x65')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x0938('0x42')],'as':_0x0938('0x61')},{'model':db[_0x0938('0x43')],'as':_0x0938('0x44')}]})[_0x0938('0x25')](handleEntityNotFound(_0xa2965c,null))['then'](saveUpdates(_0x1e0c87[_0x0938('0x64')],null))['then'](function(_0x51a7c7){if(_0x51a7c7&&_0x1e0c87[_0x0938('0x64')]['Imap']){return db[_0x0938('0x60')][_0x0938('0x39')](_0x1e0c87[_0x0938('0x64')][_0x0938('0x41')],{'where':{'MailAccountId':_0x51a7c7['id']}})[_0x0938('0x25')](function(){return _0x51a7c7;});}return _0x51a7c7;})[_0x0938('0x25')](function(_0x1b390a){if(_0x1b390a&&_0x1e0c87['body'][_0x0938('0x61')]){return db[_0x0938('0x42')]['update'](_0x1e0c87[_0x0938('0x64')][_0x0938('0x61')],{'where':{'MailAccountId':_0x1b390a['id']}})[_0x0938('0x25')](function(){return _0x1b390a;});}return _0x1b390a;})[_0x0938('0x25')](respondWithResult(_0xa2965c,null))[_0x0938('0x5e')](handleError(_0xa2965c,null));};exports[_0x0938('0x66')]=function(_0xdca52,_0xb6aa6f){return db[_0x0938('0x46')][_0x0938('0x66')]()['then'](respondWithResult(_0xb6aa6f,null))[_0x0938('0x5e')](handleError(_0xb6aa6f,null));};exports[_0x0938('0x67')]=function(_0x46d1e3,_0x2dc62e,_0x2ed446){if(_0x46d1e3[_0x0938('0x64')]['id']){delete _0x46d1e3[_0x0938('0x64')]['id'];}return db['MailAccount'][_0x0938('0x63')]({'where':{'id':_0x46d1e3[_0x0938('0x65')]['id']}})[_0x0938('0x25')](handleEntityNotFound(_0x2dc62e,null))[_0x0938('0x25')](function(_0x1d4f97){if(_0x1d4f97){_0x46d1e3[_0x0938('0x64')]['MailAccountId']=_0x1d4f97['id'];return db[_0x0938('0x68')][_0x0938('0x69')](_0x46d1e3[_0x0938('0x64')]);}})[_0x0938('0x25')](respondWithResult(_0x2dc62e,null))[_0x0938('0x5e')](handleError(_0x2dc62e,null));};exports[_0x0938('0x6a')]=function(_0x14d7c3,_0x530ed6,_0x84c782){var _0x4cae12={'raw':![],'where':{}};var _0xf07b62={};var _0x5d26b6={'count':0x0,'rows':[]};return db[_0x0938('0x46')][_0x0938('0x6b')]({'where':{'id':_0x14d7c3[_0x0938('0x65')]['id']}})[_0x0938('0x25')](handleEntityNotFound(_0x530ed6,null))[_0x0938('0x25')](function(_0x3b9f55){if(_0x3b9f55){_0xf07b62[_0x0938('0x4b')]=_[_0x0938('0x4c')](db[_0x0938('0x68')]['rawAttributes']);_0xf07b62['query']=_[_0x0938('0x4c')](_0x14d7c3[_0x0938('0x4d')]);_0xf07b62['filters']=_[_0x0938('0x4f')](_0xf07b62[_0x0938('0x4b')],_0xf07b62[_0x0938('0x4d')]);_0x4cae12[_0x0938('0x50')]=_['intersection'](_0xf07b62[_0x0938('0x4b')],qs['fields'](_0x14d7c3[_0x0938('0x4d')]['fields']));_0x4cae12[_0x0938('0x50')]=_0x4cae12[_0x0938('0x50')][_0x0938('0x52')]?_0x4cae12[_0x0938('0x50')]:_0xf07b62[_0x0938('0x4b')];if(!_0x14d7c3[_0x0938('0x4d')][_0x0938('0x53')]('nolimit')){_0x4cae12[_0x0938('0x35')]=qs[_0x0938('0x35')](_0x14d7c3['query']['limit']);_0x4cae12[_0x0938('0x34')]=qs[_0x0938('0x34')](_0x14d7c3[_0x0938('0x4d')][_0x0938('0x34')]);}_0x4cae12[_0x0938('0x55')]=qs[_0x0938('0x56')](_0x14d7c3['query']['sort']);_0x4cae12[_0x0938('0x57')]=qs[_0x0938('0x4e')](_['pick'](_0x14d7c3[_0x0938('0x4d')],_0xf07b62[_0x0938('0x4e')]));_0x4cae12[_0x0938('0x57')][_0x0938('0x6c')]=_0x3b9f55['id'];if(_0x14d7c3[_0x0938('0x4d')][_0x0938('0x6d')]){_0x4cae12[_0x0938('0x57')]=_[_0x0938('0x62')](_0x4cae12[_0x0938('0x57')],{'$or':_[_0x0938('0x45')](_0x4cae12['attributes'],function(_0x58c9a7){var _0x5e0136={};_0x5e0136[_0x58c9a7]={'$like':'%'+_0x14d7c3[_0x0938('0x4d')]['filter']+'%'};return _0x5e0136;})});}_0x4cae12=_['merge']({},_0x4cae12,_0x14d7c3[_0x0938('0x59')]);return db['Disposition'][_0x0938('0x33')]({'where':_0x4cae12[_0x0938('0x57')]})[_0x0938('0x25')](function(_0x3d487e){_0x5d26b6[_0x0938('0x33')]=_0x3d487e;if(_0x14d7c3[_0x0938('0x4d')]['includeAll']){_0x4cae12[_0x0938('0x5b')]=[{'all':!![]}];}return db['Disposition'][_0x0938('0x5c')](_0x4cae12);})['then'](function(_0x379db2){_0x5d26b6[_0x0938('0x5d')]=_0x379db2;return _0x5d26b6;});}})[_0x0938('0x25')](respondWithFilteredResult(_0x530ed6,_0x4cae12))['catch'](handleError(_0x530ed6,null));};exports[_0x0938('0x6e')]=function(_0x3f0afb,_0x5bfa1c,_0x124a3a){return db[_0x0938('0x46')][_0x0938('0x63')]({'where':{'id':_0x3f0afb[_0x0938('0x65')]['id']}})[_0x0938('0x25')](handleEntityNotFound(_0x5bfa1c,null))[_0x0938('0x25')](function(_0x5edaee){if(_0x5edaee){return _0x5edaee[_0x0938('0x6e')](_0x3f0afb[_0x0938('0x4d')][_0x0938('0x6f')]);}})[_0x0938('0x25')](respondWithStatusCode(_0x5bfa1c,null))[_0x0938('0x5e')](handleError(_0x5bfa1c,null));};exports[_0x0938('0x70')]=function(_0x2cdbed,_0x528a84,_0x133f6e){if(_0x2cdbed['body']['id']){delete _0x2cdbed[_0x0938('0x64')]['id'];}return db[_0x0938('0x46')][_0x0938('0x63')]({'where':{'id':_0x2cdbed['params']['id']}})[_0x0938('0x25')](handleEntityNotFound(_0x528a84,null))[_0x0938('0x25')](function(_0x58a649){if(_0x58a649){_0x2cdbed[_0x0938('0x64')][_0x0938('0x6c')]=_0x58a649['id'];return db['CannedAnswer'][_0x0938('0x69')](_0x2cdbed[_0x0938('0x64')]);}})[_0x0938('0x25')](respondWithResult(_0x528a84,null))[_0x0938('0x5e')](handleError(_0x528a84,null));};exports[_0x0938('0x71')]=function(_0x36b507,_0x3f23ac,_0x275f45){var _0x3c126e={'raw':![],'where':{}};var _0xabb18={};var _0x5c83b={'count':0x0,'rows':[]};return db[_0x0938('0x46')][_0x0938('0x6b')]({'where':{'id':_0x36b507[_0x0938('0x65')]['id']}})[_0x0938('0x25')](handleEntityNotFound(_0x3f23ac,null))[_0x0938('0x25')](function(_0x12de38){if(_0x12de38){_0xabb18[_0x0938('0x4b')]=_[_0x0938('0x4c')](db[_0x0938('0x72')][_0x0938('0x47')]);_0xabb18['query']=_[_0x0938('0x4c')](_0x36b507[_0x0938('0x4d')]);_0xabb18[_0x0938('0x4e')]=_[_0x0938('0x4f')](_0xabb18[_0x0938('0x4b')],_0xabb18[_0x0938('0x4d')]);_0x3c126e[_0x0938('0x50')]=_[_0x0938('0x4f')](_0xabb18[_0x0938('0x4b')],qs['fields'](_0x36b507['query']['fields']));_0x3c126e[_0x0938('0x50')]=_0x3c126e[_0x0938('0x50')]['length']?_0x3c126e[_0x0938('0x50')]:_0xabb18[_0x0938('0x4b')];if(!_0x36b507[_0x0938('0x4d')][_0x0938('0x53')](_0x0938('0x54'))){_0x3c126e[_0x0938('0x35')]=qs[_0x0938('0x35')](_0x36b507[_0x0938('0x4d')]['limit']);_0x3c126e[_0x0938('0x34')]=qs[_0x0938('0x34')](_0x36b507['query'][_0x0938('0x34')]);}_0x3c126e[_0x0938('0x55')]=qs[_0x0938('0x56')](_0x36b507[_0x0938('0x4d')][_0x0938('0x56')]);_0x3c126e[_0x0938('0x57')]=qs['filters'](_['pick'](_0x36b507[_0x0938('0x4d')],_0xabb18[_0x0938('0x4e')]));_0x3c126e[_0x0938('0x57')][_0x0938('0x6c')]=_0x12de38['id'];if(_0x36b507[_0x0938('0x4d')]['filter']){_0x3c126e['where']=_[_0x0938('0x62')](_0x3c126e[_0x0938('0x57')],{'$or':_['map'](_0x3c126e[_0x0938('0x50')],function(_0x40dc4f){var _0x215e2b={};_0x215e2b[_0x40dc4f]={'$like':'%'+_0x36b507[_0x0938('0x4d')][_0x0938('0x6d')]+'%'};return _0x215e2b;})});}_0x3c126e=_['merge']({},_0x3c126e,_0x36b507[_0x0938('0x59')]);return db[_0x0938('0x72')]['count']({'where':_0x3c126e[_0x0938('0x57')]})['then'](function(_0x25f536){_0x5c83b[_0x0938('0x33')]=_0x25f536;if(_0x36b507[_0x0938('0x4d')][_0x0938('0x5a')]){_0x3c126e[_0x0938('0x5b')]=[{'all':!![]}];}return db[_0x0938('0x72')]['findAll'](_0x3c126e);})[_0x0938('0x25')](function(_0x5b3d02){_0x5c83b[_0x0938('0x5d')]=_0x5b3d02;return _0x5c83b;});}})[_0x0938('0x25')](respondWithFilteredResult(_0x3f23ac,_0x3c126e))[_0x0938('0x5e')](handleError(_0x3f23ac,null));};exports[_0x0938('0x73')]=function(_0x2e056b,_0xe7567c,_0x2bb7dd){return db[_0x0938('0x46')][_0x0938('0x63')]({'where':{'id':_0x2e056b[_0x0938('0x65')]['id']}})[_0x0938('0x25')](handleEntityNotFound(_0xe7567c,null))['then'](function(_0x9d8353){if(_0x9d8353){return _0x9d8353[_0x0938('0x73')](_0x2e056b[_0x0938('0x4d')][_0x0938('0x6f')]);}})[_0x0938('0x25')](respondWithStatusCode(_0xe7567c,null))[_0x0938('0x5e')](handleError(_0xe7567c,null));};exports[_0x0938('0x69')]=function(_0x2d7815,_0x31dc70){var _0x19cc16={'name':_0x2d7815[_0x0938('0x64')][_0x0938('0x3e')],'key':_0x2d7815['body'][_0x0938('0x4a')],'email':_0x2d7815[_0x0938('0x64')][_0x0938('0x74')],'ListId':_0x2d7815[_0x0938('0x64')]['ListId'],'active':!_[_0x0938('0x75')](_0x2d7815['body'][_0x0938('0x76')])?_0x2d7815['body'][_0x0938('0x76')]:!![],'description':_0x2d7815[_0x0938('0x64')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x0938('0x75')](_0x2d7815['body']['cservice'])){if(_0x2d7815[_0x0938('0x64')][_0x0938('0x77')]){_0x19cc16[_0x0938('0x41')]['user']=_0x19cc16[_0x0938('0x61')][_0x0938('0x78')]=_0x2d7815['body'][_0x0938('0x79')];_0x19cc16[_0x0938('0x41')]['password']=_0x19cc16['Smtp'][_0x0938('0x7a')]=_0x2d7815[_0x0938('0x64')][_0x0938('0x7b')];}else{_0x19cc16[_0x0938('0x41')][_0x0938('0x7c')]=_0x19cc16[_0x0938('0x61')][_0x0938('0x7c')]=![];}_0x19cc16[_0x0938('0x41')][_0x0938('0x7d')]=_0x2d7815[_0x0938('0x64')][_0x0938('0x41')]['host'];_0x19cc16['Imap'][_0x0938('0x7e')]=_0x2d7815['body'][_0x0938('0x41')][_0x0938('0x7e')];_0x19cc16[_0x0938('0x61')][_0x0938('0x7d')]=_0x2d7815['body'][_0x0938('0x61')][_0x0938('0x7d')];_0x19cc16['Smtp']['port']=_0x2d7815[_0x0938('0x64')]['Smtp'][_0x0938('0x7e')];}else{_0x19cc16[_0x0938('0x41')][_0x0938('0x7f')]=_0x19cc16['Smtp'][_0x0938('0x7f')]=_0x2d7815['body']['cservice'];_0x19cc16[_0x0938('0x41')]['user']=_0x19cc16[_0x0938('0x61')][_0x0938('0x78')]=_0x2d7815['body'][_0x0938('0x79')];_0x19cc16[_0x0938('0x41')][_0x0938('0x80')]=_0x19cc16['Smtp'][_0x0938('0x7a')]=_0x2d7815[_0x0938('0x64')][_0x0938('0x7b')];}return db[_0x0938('0x46')][_0x0938('0x69')](_0x19cc16,{'include':[{'model':db[_0x0938('0x42')],'as':_0x0938('0x61')},{'model':db['MailServerIn'],'as':_0x0938('0x41')}]})[_0x0938('0x25')](function(_0x419ed0){var _0x3bd3c6=_0x2d7815['user'][_0x0938('0x3b')]({'plain':!![]});if(!_0x3bd3c6)throw new Error(_0x0938('0x81'));if(_0x3bd3c6['role']===_0x0938('0x78')){var _0x3c327d=_0x419ed0[_0x0938('0x3b')]({'plain':!![]});return db[_0x0938('0x82')][_0x0938('0x63')]({'where':{'name':_0x0938('0x3c'),'userProfileId':_0x3bd3c6[_0x0938('0x83')]},'raw':!![]})['then'](function(_0x3e3714){if(_0x3e3714&&_0x3e3714[_0x0938('0x84')]===0x0){return db['UserProfileResource'][_0x0938('0x69')]({'name':_0x3c327d[_0x0938('0x3e')],'resourceId':_0x3c327d['id'],'type':_0x3e3714[_0x0938('0x3e')],'sectionId':_0x3e3714['id']},{})[_0x0938('0x25')](function(){return _0x419ed0;});}else{return _0x419ed0;}})[_0x0938('0x5e')](function(_0x4ace80){logger[_0x0938('0x2c')](_0x0938('0x85'),_0x4ace80);throw _0x4ace80;});}return _0x419ed0;})[_0x0938('0x25')](respondWithResult(_0x31dc70,0xc9))[_0x0938('0x5e')](handleError(_0x31dc70,null));};exports['getImap']=function(_0x1a6822,_0x2845be,_0xcf425){return db[_0x0938('0x46')]['findOne']({'where':{'id':_0x1a6822[_0x0938('0x65')]['id']}})[_0x0938('0x25')](handleEntityNotFound(_0x2845be,null))['then'](function(_0x2a6a3f){if(_0x2a6a3f){return _0x2a6a3f[_0x0938('0x86')]();}return null;})[_0x0938('0x25')](respondWithResult(_0x2845be,null))[_0x0938('0x5e')](handleError(_0x2845be,null));};exports[_0x0938('0x87')]=function(_0x2d1acc,_0x3c30ee,_0x5c1496){if(_0x2d1acc[_0x0938('0x64')]['id']){delete _0x2d1acc[_0x0938('0x64')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x2d1acc[_0x0938('0x65')]['id']}})[_0x0938('0x25')](handleEntityNotFound(_0x3c30ee,null))[_0x0938('0x25')](function(_0x4d19e5){if(_0x4d19e5){_0x2d1acc[_0x0938('0x64')][_0x0938('0x6c')]=_0x4d19e5['id'];return db[_0x0938('0x60')][_0x0938('0x69')](_0x2d1acc[_0x0938('0x64')]);}})[_0x0938('0x25')](respondWithResult(_0x3c30ee,null))[_0x0938('0x5e')](handleError(_0x3c30ee,null));};exports[_0x0938('0x88')]=function(_0x344648,_0xd5029d,_0x28f1d7){return db['MailAccount'][_0x0938('0x6b')]({'where':{'id':_0x344648['params']['id']}})[_0x0938('0x25')](handleEntityNotFound(_0xd5029d,null))[_0x0938('0x25')](function(_0x4fc6e9){if(_0x4fc6e9){return _0x4fc6e9[_0x0938('0x89')](null);}return null;})[_0x0938('0x25')](respondWithStatusCode(_0xd5029d,null))[_0x0938('0x5e')](handleError(_0xd5029d,null));};exports[_0x0938('0x8a')]=function(_0x22626f,_0x2b1176,_0x547c4e){return db[_0x0938('0x46')]['findOne']({'where':{'id':_0x22626f['params']['id']}})['then'](handleEntityNotFound(_0x2b1176,null))[_0x0938('0x25')](function(_0x4372a6){if(_0x4372a6){return _0x4372a6[_0x0938('0x8a')]();}return null;})[_0x0938('0x25')](respondWithResult(_0x2b1176,null))[_0x0938('0x5e')](handleError(_0x2b1176,null));};exports[_0x0938('0x8b')]=function(_0x5b9d0f,_0x3087b6,_0x2cd41c){if(_0x5b9d0f[_0x0938('0x64')]['id']){delete _0x5b9d0f[_0x0938('0x64')]['id'];}return db[_0x0938('0x46')][_0x0938('0x63')]({'where':{'id':_0x5b9d0f[_0x0938('0x65')]['id']}})[_0x0938('0x25')](handleEntityNotFound(_0x3087b6,null))['then'](function(_0x2045d2){if(_0x2045d2){_0x5b9d0f[_0x0938('0x64')][_0x0938('0x6c')]=_0x2045d2['id'];return db[_0x0938('0x42')][_0x0938('0x69')](_0x5b9d0f[_0x0938('0x64')]);}})[_0x0938('0x25')](respondWithResult(_0x3087b6,null))[_0x0938('0x5e')](handleError(_0x3087b6,null));};exports[_0x0938('0x8c')]=function(_0x4c33c7,_0xeec046,_0x350d3b){return db[_0x0938('0x46')]['findOne']({'where':{'id':_0x4c33c7['params']['id']}})['then'](handleEntityNotFound(_0xeec046,null))['then'](function(_0x16ac54){if(_0x16ac54){return _0x16ac54[_0x0938('0x8d')](null);}return null;})[_0x0938('0x25')](respondWithStatusCode(_0xeec046,null))['catch'](handleError(_0xeec046,null));};exports[_0x0938('0x8e')]=function(_0x1d93cc,_0xb45850,_0xa2003d){return db[_0x0938('0x8f')][_0x0938('0x63')]({'where':{'id':_0x1d93cc['params']['id']}})[_0x0938('0x25')](handleEntityNotFound(_0xb45850,null))[_0x0938('0x25')](function(_0x6beece){if(_0x6beece){return _0x6beece[_0x0938('0x8e')](_0x1d93cc[_0x0938('0x64')]['ids'],_[_0x0938('0x90')](_0x1d93cc[_0x0938('0x64')],[_0x0938('0x6f'),'id'])||{});}})[_0x0938('0x25')](respondWithResult(_0xb45850,null))[_0x0938('0x5e')](handleError(_0xb45850,null));};exports[_0x0938('0x91')]=function(_0x437ac4,_0x479f50,_0xb6d14f){var _0x35436b={'raw':![],'where':{}};var _0x49757d={};var _0x22a5fe={'count':0x0,'rows':[]};return db[_0x0938('0x46')][_0x0938('0x6b')]({'where':{'id':_0x437ac4[_0x0938('0x65')]['id']}})[_0x0938('0x25')](handleEntityNotFound(_0x479f50,null))['then'](function(_0x42b405){if(_0x42b405){_0x49757d[_0x0938('0x4b')]=_[_0x0938('0x4c')](db['MailInteraction']['rawAttributes']);_0x49757d['query']=_['keys'](_0x437ac4[_0x0938('0x4d')]);_0x49757d['filters']=_[_0x0938('0x4f')](_0x49757d[_0x0938('0x4b')],_0x49757d[_0x0938('0x4d')]);_0x35436b[_0x0938('0x50')]=_[_0x0938('0x4f')](_0x49757d[_0x0938('0x4b')],qs[_0x0938('0x51')](_0x437ac4['query'][_0x0938('0x51')]));_0x35436b[_0x0938('0x50')]=_0x35436b[_0x0938('0x50')][_0x0938('0x52')]?_0x35436b[_0x0938('0x50')]:_0x49757d['model'];if(!_0x437ac4[_0x0938('0x4d')]['hasOwnProperty'](_0x0938('0x54'))){_0x35436b[_0x0938('0x35')]=qs[_0x0938('0x35')](_0x437ac4['query']['limit']);_0x35436b[_0x0938('0x34')]=qs[_0x0938('0x34')](_0x437ac4[_0x0938('0x4d')][_0x0938('0x34')]);}_0x35436b[_0x0938('0x55')]=qs[_0x0938('0x56')](_0x437ac4[_0x0938('0x4d')]['sort']);_0x35436b[_0x0938('0x57')]=qs[_0x0938('0x4e')](_[_0x0938('0x92')](_0x437ac4[_0x0938('0x4d')],_0x49757d[_0x0938('0x4e')]));_0x35436b[_0x0938('0x57')][_0x0938('0x6c')]=_0x42b405['id'];if(_0x437ac4[_0x0938('0x4d')]['filter']){_0x35436b[_0x0938('0x57')]=_[_0x0938('0x62')](_0x35436b[_0x0938('0x57')],{'$or':_[_0x0938('0x45')](_0x35436b[_0x0938('0x50')],function(_0x21af8e){var _0x3af6f9={};_0x3af6f9[_0x21af8e]={'$like':'%'+_0x437ac4[_0x0938('0x4d')][_0x0938('0x6d')]+'%'};return _0x3af6f9;})});}_0x35436b=_['merge']({},_0x35436b,_0x437ac4[_0x0938('0x59')]);return db[_0x0938('0x8f')][_0x0938('0x33')]({'where':_0x35436b[_0x0938('0x57')]})['then'](function(_0x58df42){_0x22a5fe[_0x0938('0x33')]=_0x58df42;if(_0x437ac4[_0x0938('0x4d')][_0x0938('0x5a')]){_0x35436b[_0x0938('0x5b')]=[{'model':db[_0x0938('0x93')],'as':_0x0938('0x94'),'required':![]},{'model':db[_0x0938('0x95')],'as':_0x0938('0x96'),'attributes':['name',_0x0938('0x97'),_0x0938('0x98')],'required':![]},{'model':db['Tag'],'as':_0x0938('0x99'),'attributes':['id',_0x0938('0x3e'),'color'],'where':_0x437ac4[_0x0938('0x4d')][_0x0938('0x9a')]?{'id':_0x437ac4['query'][_0x0938('0x9a')]}:undefined,'required':_0x437ac4[_0x0938('0x4d')][_0x0938('0x9a')]?!![]:![]}];}return db['MailInteraction'][_0x0938('0x5c')](_0x35436b);})[_0x0938('0x25')](function(_0x2cc263){_0x22a5fe[_0x0938('0x5d')]=_0x2cc263;return _0x22a5fe;});}})['then'](respondWithFilteredResult(_0x479f50,_0x35436b))[_0x0938('0x5e')](handleError(_0x479f50,null));};exports[_0x0938('0x9b')]=function(_0xe14863,_0x170519,_0x5c7eda){return db['MailAccount']['findOne']({'where':{'id':_0xe14863['params']['id']}})[_0x0938('0x25')](handleEntityNotFound(_0x170519,null))[_0x0938('0x25')](function(_0x155b1f){if(_0x155b1f){return db[_0x0938('0x9c')][_0x0938('0x9d')](function(_0x6f2ec9){return db[_0x0938('0x9e')][_0x0938('0x3a')]({'where':{'MailAccountId':_0xe14863[_0x0938('0x65')]['id']},'transaction':_0x6f2ec9})[_0x0938('0x25')](function(_0x198720){var _0xb0c7af=_[_0x0938('0x45')](_0xe14863[_0x0938('0x64')],function(_0x411cde){_0x411cde['MailAccountId']=_0xe14863[_0x0938('0x65')]['id'];return _0x411cde;});return db[_0x0938('0x9e')][_0x0938('0x9f')](_0xb0c7af,{'transaction':_0x6f2ec9});});})[_0x0938('0x25')](function(){return db[_0x0938('0x9e')][_0x0938('0xa0')]({'where':{'MailAccountId':_0xe14863[_0x0938('0x65')]['id']},'order':_0x0938('0xa1')});});}})[_0x0938('0x25')](respondWithResult(_0x170519,null))['catch'](handleError(_0x170519,null));};exports[_0x0938('0xa2')]=function(_0x340619,_0x44a423,_0x191e89){var _0x24687a={};var _0x1a0366={};var _0x24307f;var _0x1c997a;return db[_0x0938('0x46')][_0x0938('0x6b')]({'where':{'id':_0x340619[_0x0938('0x65')]['id']}})[_0x0938('0x25')](handleEntityNotFound(_0x44a423,null))[_0x0938('0x25')](function(_0x13d100){if(_0x13d100){_0x24307f=_0x13d100;_0x1a0366[_0x0938('0x4b')]=_[_0x0938('0x4c')](db['MailApplication'][_0x0938('0x47')]);_0x1a0366['query']=_[_0x0938('0x4c')](_0x340619[_0x0938('0x4d')]);_0x1a0366[_0x0938('0x4e')]=_[_0x0938('0x4f')](_0x1a0366[_0x0938('0x4b')],_0x1a0366[_0x0938('0x4d')]);_0x24687a[_0x0938('0x50')]=_[_0x0938('0x4f')](_0x1a0366[_0x0938('0x4b')],qs['fields'](_0x340619[_0x0938('0x4d')][_0x0938('0x51')]));_0x24687a[_0x0938('0x50')]=_0x24687a[_0x0938('0x50')][_0x0938('0x52')]?_0x24687a[_0x0938('0x50')]:_0x1a0366[_0x0938('0x4b')];_0x24687a[_0x0938('0x55')]=qs[_0x0938('0x56')](_0x340619['query']['sort']);_0x24687a[_0x0938('0x57')]=qs[_0x0938('0x4e')](_[_0x0938('0x92')](_0x340619[_0x0938('0x4d')],_0x1a0366['filters']));if(_0x340619['query'][_0x0938('0x6d')]){_0x24687a[_0x0938('0x57')]=_[_0x0938('0x62')](_0x24687a[_0x0938('0x57')],{'$or':_[_0x0938('0x45')](_0x24687a[_0x0938('0x50')],function(_0xd966e5){var _0x138b72={};_0x138b72[_0xd966e5]={'$like':'%'+_0x340619[_0x0938('0x4d')][_0x0938('0x6d')]+'%'};return _0x138b72;})});}_0x24687a=_[_0x0938('0x62')]({},_0x24687a,_0x340619[_0x0938('0x59')]);return _0x24307f['getApplications'](_0x24687a);}})['then'](function(_0x3776be){if(_0x3776be){_0x1c997a=_0x3776be[_0x0938('0x52')];if(!_0x340619[_0x0938('0x4d')][_0x0938('0x53')]('nolimit')){_0x24687a[_0x0938('0x35')]=qs[_0x0938('0x35')](_0x340619[_0x0938('0x4d')][_0x0938('0x35')]);_0x24687a[_0x0938('0x34')]=qs[_0x0938('0x34')](_0x340619[_0x0938('0x4d')][_0x0938('0x34')]);}return _0x24307f['getApplications'](_0x24687a);}})['then'](function(_0x322208){if(_0x322208){return _0x322208?{'count':_0x1c997a,'rows':_0x322208}:null;}})['then'](respondWithResult(_0x44a423,null))[_0x0938('0x5e')](handleError(_0x44a423,null));};exports[_0x0938('0xa3')]=function(_0x55013b,_0x106719,_0x25617e){var _0x38beb4={'raw':!![],'where':{}};var _0xb2e812={};var _0x147931={'count':0x0,'rows':[]};return db[_0x0938('0x46')][_0x0938('0x6b')]({'where':{'id':_0x55013b['params']['id']}})[_0x0938('0x25')](handleEntityNotFound(_0x106719,null))[_0x0938('0x25')](function(_0x55e6b2){if(_0x55e6b2){_0xb2e812['model']=_[_0x0938('0x4c')](db[_0x0938('0xa4')][_0x0938('0x47')]);_0xb2e812['query']=_[_0x0938('0x4c')](_0x55013b['query']);_0xb2e812[_0x0938('0x4e')]=_[_0x0938('0x4f')](_0xb2e812['model'],_0xb2e812[_0x0938('0x4d')]);_0x38beb4[_0x0938('0x50')]=_[_0x0938('0x4f')](_0xb2e812[_0x0938('0x4b')],qs['fields'](_0x55013b[_0x0938('0x4d')][_0x0938('0x51')]));_0x38beb4[_0x0938('0x50')]=_0x38beb4[_0x0938('0x50')][_0x0938('0x52')]?_0x38beb4['attributes']:_0xb2e812[_0x0938('0x4b')];if(!_0x55013b[_0x0938('0x4d')][_0x0938('0x53')](_0x0938('0x54'))){_0x38beb4[_0x0938('0x35')]=qs[_0x0938('0x35')](_0x55013b['query'][_0x0938('0x35')]);_0x38beb4[_0x0938('0x34')]=qs[_0x0938('0x34')](_0x55013b[_0x0938('0x4d')][_0x0938('0x34')]);}_0x38beb4['order']=qs[_0x0938('0x56')](_0x55013b[_0x0938('0x4d')]['sort']);_0x38beb4[_0x0938('0x57')]=qs[_0x0938('0x4e')](_[_0x0938('0x92')](_0x55013b[_0x0938('0x4d')],_0xb2e812[_0x0938('0x4e')]));_0x38beb4[_0x0938('0x57')][_0x0938('0x6c')]=_0x55e6b2['id'];if(_0x55013b[_0x0938('0x4d')]['filter']){_0x38beb4[_0x0938('0x57')]=_[_0x0938('0x62')](_0x38beb4['where'],{'$or':_[_0x0938('0x45')](_0x38beb4[_0x0938('0x50')],function(_0x225763){var _0x3dc085={};_0x3dc085[_0x225763]={'$like':'%'+_0x55013b[_0x0938('0x4d')]['filter']+'%'};return _0x3dc085;})});}if(_0x55013b[_0x0938('0x4d')][_0x0938('0xa5')]){var _0x25bfe1=_0x55013b[_0x0938('0x4d')][_0x0938('0xa5')][_0x0938('0xa6')](',');var _0x50e750={};_0x50e750[_0x25bfe1[0x0]]={'$gte':moment(_0x25bfe1[0x1])[_0x0938('0xa7')](_0x0938('0xa8'))};_0x38beb4[_0x0938('0x57')]=_[_0x0938('0x62')](_0x38beb4[_0x0938('0x57')],_0x50e750);}_0x38beb4=_['merge']({},_0x38beb4,_0x55013b[_0x0938('0x59')]);return db['MailMessage'][_0x0938('0x33')]({'where':_0x38beb4[_0x0938('0x57')]})[_0x0938('0x25')](function(_0x5483bd){_0x147931[_0x0938('0x33')]=_0x5483bd;if(_0x55013b['query'][_0x0938('0x5a')]){_0x38beb4[_0x0938('0x5b')]=[{'all':!![]}];}return db[_0x0938('0xa4')]['findAll'](_0x38beb4);})[_0x0938('0x25')](function(_0x247803){_0x147931[_0x0938('0x5d')]=_0x247803;return _0x147931;});}})[_0x0938('0x25')](respondWithFilteredResult(_0x106719,_0x38beb4))[_0x0938('0x5e')](handleError(_0x106719,null));};exports[_0x0938('0x3f')]=function(_0x1d6920,_0x2ecb97,_0x586aee){var _0x5284d1,_0x3640e0={},_0x8b4905;if(_0x1d6920['body']['to']){_0x8b4905=_0x1d6920[_0x0938('0x64')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x0938('0x63')]({'where':{'id':_0x1d6920[_0x0938('0x65')]['id']},'include':[{'model':db['CmList'],'as':_0x0938('0xa9'),'include':[{'model':db['CmContact'],'as':_0x0938('0xaa'),'where':{'email':_0x8b4905},'limit':0x1,'order':[[_0x0938('0xab'),_0x0938('0xac')]]}]},{'model':db[_0x0938('0x42')],'as':_0x0938('0x61'),'raw':!![]}]})[_0x0938('0x25')](handleEntityNotFound(_0x2ecb97,null))[_0x0938('0x25')](function(_0x3b09fb){if(_0x3b09fb){_0x5284d1=_0x3b09fb;if(_0x3b09fb[_0x0938('0x61')]){if(_[_0x0938('0x75')](_0x1d6920['body'][_0x0938('0xad')])){_0x1d6920[_0x0938('0x64')]['from']=util[_0x0938('0xa7')](_0x0938('0xae'),_0x3b09fb[_0x0938('0x3e')],_0x3b09fb['email']||_0x3b09fb[_0x0938('0x61')][_0x0938('0x78')]);}if(_0x1d6920[_0x0938('0x64')]['attachments']&&_0x1d6920[_0x0938('0x64')][_0x0938('0xaf')][_0x0938('0x52')]){for(var _0x2ce9bc=0x0;_0x2ce9bc<_0x1d6920[_0x0938('0x64')][_0x0938('0xaf')][_0x0938('0x52')];_0x2ce9bc+=0x1){_0x1d6920[_0x0938('0x64')][_0x0938('0xaf')][_0x2ce9bc]={'filename':_0x1d6920[_0x0938('0x64')][_0x0938('0xaf')][_0x2ce9bc][_0x0938('0x3e')],'path':path['join'](config[_0x0938('0xb0')],_0x0938('0xb1'),_0x1d6920['body'][_0x0938('0xaf')][_0x2ce9bc]['basename'])};}}var _0x9f01d2={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x3b09fb[_0x0938('0x61')][_0x0938('0x7f')])){if(_0x3b09fb[_0x0938('0x61')][_0x0938('0x7c')]){_0x9f01d2[_0x0938('0xb2')]={'user':_0x3b09fb[_0x0938('0x61')][_0x0938('0x78')],'pass':_0x3b09fb[_0x0938('0x61')]['pass']};}_0x9f01d2[_0x0938('0x7d')]=_0x3b09fb[_0x0938('0x61')]['host'];_0x9f01d2[_0x0938('0x7e')]=_0x3b09fb[_0x0938('0x61')]['port'];_0x9f01d2[_0x0938('0xb3')]=_0x3b09fb['Smtp'][_0x0938('0xb3')];}else{_0x9f01d2[_0x0938('0x7f')]=_0x3b09fb[_0x0938('0x61')][_0x0938('0x7f')];_0x9f01d2['auth']={'user':_0x3b09fb[_0x0938('0x61')][_0x0938('0x78')],'pass':_0x3b09fb[_0x0938('0x61')][_0x0938('0x7a')]};}return respondWithRpcPromise('SendMail',_0x0938('0xb4'),{'account':_0x9f01d2,'message':_0x1d6920[_0x0938('0x64')]});}else{throw new Error('List\x20not\x20found');}}})[_0x0938('0x25')](function(_0x284122){if(_0x284122){_0x3640e0=_0x284122;if(_0x5284d1[_0x0938('0xa9')]){if(_0x5284d1[_0x0938('0xa9')][_0x0938('0xaa')][_0x0938('0x52')]){return _0x5284d1[_0x0938('0xa9')][_0x0938('0xaa')][0x0];}else{return db[_0x0938('0x93')][_0x0938('0x69')](_['defaults'](_0x1d6920[_0x0938('0x64')],{'firstName':_0x1d6920[_0x0938('0x64')]['to'],'email':_0x1d6920[_0x0938('0x64')]['to'],'phone':_0x1d6920[_0x0938('0x64')]['to'],'ListId':_0x5284d1[_0x0938('0xb5')]}));}}else{throw new Error(_0x0938('0xb6'));}}})[_0x0938('0x25')](function(_0x275a7b){if(_0x275a7b){var _0x61213f={'UserId':_0x1d6920[_0x0938('0x78')]['id'],'ContactId':_0x275a7b['id'],'MailAccountId':_0x5284d1['id'],'inReplyTo':_0x3640e0['messageId'],'to':_0x1d6920[_0x0938('0x64')][_0x0938('0xad')],'cc':_0x1d6920['body']['cc'],'subject':_0x1d6920['body']['subject'],'attach':_0x1d6920[_0x0938('0x64')]['attach'],'firstMsgDirection':_0x0938('0xb7'),'lastMsgAt':moment()[_0x0938('0xa7')](_0x0938('0xa8')),'lastMsgDirection':'out','lastMsgBody':_0x1d6920[_0x0938('0x64')][_0x0938('0x64')],'Messages':[_[_0x0938('0x62')](_0x1d6920[_0x0938('0x64')],{'messageId':_0x3640e0['messageId'],'sentAt':moment()[_0x0938('0xa7')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x5284d1['id'],'UserId':_0x1d6920[_0x0938('0x78')]['id'],'ContactId':_0x275a7b['id']})]};if(_0x1d6920[_0x0938('0x64')][_0x0938('0xb8')]){_0x61213f=_[_0x0938('0x62')](_0x61213f,_0x1d6920[_0x0938('0x64')]['Interaction']);}return db['MailInteraction'][_0x0938('0x69')](_0x61213f,{'include':[{'model':db[_0x0938('0xa4')],'as':_0x0938('0xb9')}]});}})[_0x0938('0x25')](respondWithResult(_0x2ecb97,null))['catch'](handleError(_0x2ecb97,null));};exports[_0x0938('0xba')]=function(_0x1fa88c,_0x2a6352,_0x3c6a67){return db[_0x0938('0x46')]['find']({'where':{'id':_0x1fa88c[_0x0938('0x65')]['id']},'include':[{'model':db[_0x0938('0x42')],'as':'Smtp','raw':!![]}]})[_0x0938('0x25')](handleEntityNotFound(_0x2a6352,null))[_0x0938('0x25')](function(_0x5b4b1f){if(_0x5b4b1f&&_0x5b4b1f[_0x0938('0x61')]){var _0x2a4bbc={'id':_0x5b4b1f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5b4b1f[_0x0938('0x61')][_0x0938('0x7f')]){_0x2a4bbc['service']=_0x5b4b1f[_0x0938('0x61')][_0x0938('0x7f')];}else{_0x2a4bbc[_0x0938('0x7d')]=_0x5b4b1f[_0x0938('0x61')][_0x0938('0x7d')];_0x2a4bbc[_0x0938('0x7e')]=_0x5b4b1f[_0x0938('0x61')][_0x0938('0x7e')];_0x2a4bbc[_0x0938('0xb3')]=_0x5b4b1f[_0x0938('0x61')][_0x0938('0xb3')];}if(_0x5b4b1f[_0x0938('0x61')][_0x0938('0x7c')]){_0x2a4bbc[_0x0938('0xb2')]={'user':_0x5b4b1f[_0x0938('0x61')]['user'],'pass':_0x5b4b1f[_0x0938('0x61')]['pass']};}return respondWithRpcPromise(_0x0938('0xbb'),_0x0938('0xba'),{'account':_0x2a4bbc});}})['then'](respondWithResult(_0x2a6352,null))[_0x0938('0x5e')](handleError(_0x2a6352,null));};exports[_0x0938('0x3a')]=function(_0x544f71,_0xb5d502){return db['MailAccount'][_0x0938('0x63')]({'where':{'id':_0x544f71[_0x0938('0x65')]['id']}})[_0x0938('0x25')](handleEntityNotFound(_0xb5d502,null))[_0x0938('0x25')](function(_0x368374){if(_0x368374&&_0x368374[_0x0938('0x7f')]){throw new db[(_0x0938('0x21'))][(_0x0938('0x22'))](_0x0938('0xbc'));}return _0x368374;})[_0x0938('0x25')](removeEntity(_0xb5d502,null))[_0x0938('0x5e')](handleError(_0xb5d502,null));};exports[_0x0938('0xbd')]=function(_0xe6bf27,_0x1ddcd2,_0x157605){return db[_0x0938('0x46')][_0x0938('0x63')]({'where':{'id':_0xe6bf27['params']['id']}})[_0x0938('0x25')](handleEntityNotFound(_0x1ddcd2,null))[_0x0938('0x25')](function(_0x2ec190){if(_0x2ec190){return _0x2ec190[_0x0938('0xbd')](_0xe6bf27['body']['ids'],_['omit'](_0xe6bf27[_0x0938('0x64')],[_0x0938('0x6f'),'id'])||{})[_0x0938('0xbe')](function(_0x53636c){for(var _0x39817e=0x0;_0x39817e<_0xe6bf27[_0x0938('0x64')][_0x0938('0x6f')][_0x0938('0x52')];_0x39817e+=0x1){socket[_0x0938('0xbf')](_0x0938('0xc0'),{'UserId':_0xe6bf27[_0x0938('0x64')][_0x0938('0x6f')][_0x39817e],'MailAccountId':_0xe6bf27[_0x0938('0x65')]['id']});}return _0x53636c;});}})[_0x0938('0x25')](respondWithResult(_0x1ddcd2,null))['catch'](handleError(_0x1ddcd2,null));};exports[_0x0938('0xc1')]=function(_0x541a35,_0x48c311,_0x2ef0bb){return db[_0x0938('0x46')][_0x0938('0x63')]({'where':{'id':_0x541a35[_0x0938('0x65')]['id']}})[_0x0938('0x25')](handleEntityNotFound(_0x48c311,null))['then'](function(_0x136a45){if(_0x136a45){return _0x136a45[_0x0938('0xc1')](_0x541a35[_0x0938('0x4d')][_0x0938('0x6f')])[_0x0938('0x25')](function(){if(_[_0x0938('0xc2')](_0x541a35['query']['ids'])){for(var _0x2aefd2=0x0;_0x2aefd2<_0x541a35[_0x0938('0x4d')][_0x0938('0x6f')][_0x0938('0x52')];_0x2aefd2+=0x1){socket[_0x0938('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x541a35[_0x0938('0x4d')][_0x0938('0x6f')][_0x2aefd2]),'MailAccountId':Number(_0x541a35[_0x0938('0x65')]['id'])});}}else{socket[_0x0938('0xbf')](_0x0938('0xc3'),{'UserId':Number(_0x541a35[_0x0938('0x4d')][_0x0938('0x6f')]),'MailAccountId':Number(_0x541a35[_0x0938('0x65')]['id'])});}});}})[_0x0938('0x25')](respondWithStatusCode(_0x48c311,null))[_0x0938('0x5e')](handleError(_0x48c311,null));};exports['getAgents']=function(_0x1e03ec,_0x3c7065,_0x2d8c97){var _0x4c276f={};var _0x54bb67={};var _0x23d08e;var _0x38c7c3;return db[_0x0938('0x46')][_0x0938('0x6b')]({'where':{'id':_0x1e03ec['params']['id']}})['then'](handleEntityNotFound(_0x3c7065,null))[_0x0938('0x25')](function(_0x4986d7){if(_0x4986d7){_0x23d08e=_0x4986d7;_0x54bb67['model']=_[_0x0938('0x4c')](db[_0x0938('0x95')]['rawAttributes']);_0x54bb67[_0x0938('0x4d')]=_[_0x0938('0x4c')](_0x1e03ec['query']);_0x54bb67[_0x0938('0x4e')]=_[_0x0938('0x4f')](_0x54bb67[_0x0938('0x4b')],_0x54bb67['query']);_0x4c276f[_0x0938('0x50')]=_[_0x0938('0x4f')](_0x54bb67[_0x0938('0x4b')],qs[_0x0938('0x51')](_0x1e03ec[_0x0938('0x4d')][_0x0938('0x51')]));_0x4c276f[_0x0938('0x50')]=_0x4c276f['attributes'][_0x0938('0x52')]?_0x4c276f[_0x0938('0x50')]:_0x54bb67[_0x0938('0x4b')];_0x4c276f[_0x0938('0x55')]=qs[_0x0938('0x56')](_0x1e03ec[_0x0938('0x4d')][_0x0938('0x56')]);_0x4c276f[_0x0938('0x57')]=qs['filters'](_['pick'](_0x1e03ec[_0x0938('0x4d')],_0x54bb67['filters']));if(_0x1e03ec['query'][_0x0938('0x6d')]){_0x4c276f[_0x0938('0x57')]=_[_0x0938('0x62')](_0x4c276f['where'],{'$or':_[_0x0938('0x45')](_0x4c276f['attributes'],function(_0x193f04){var _0x1e899d={};_0x1e899d[_0x193f04]={'$like':'%'+_0x1e03ec[_0x0938('0x4d')][_0x0938('0x6d')]+'%'};return _0x1e899d;})});}_0x4c276f=_[_0x0938('0x62')]({},_0x4c276f,_0x1e03ec[_0x0938('0x59')]);return _0x23d08e[_0x0938('0xc4')](_0x4c276f);}})[_0x0938('0x25')](function(_0x5bf497){if(_0x5bf497){_0x38c7c3=_0x5bf497[_0x0938('0x52')];if(!_0x1e03ec[_0x0938('0x4d')][_0x0938('0x53')]('nolimit')){_0x4c276f['limit']=qs[_0x0938('0x35')](_0x1e03ec[_0x0938('0x4d')][_0x0938('0x35')]);_0x4c276f[_0x0938('0x34')]=qs[_0x0938('0x34')](_0x1e03ec[_0x0938('0x4d')][_0x0938('0x34')]);}return _0x23d08e['getAgents'](_0x4c276f);}})['then'](function(_0x3fd1bd){if(_0x3fd1bd){return _0x3fd1bd?{'count':_0x38c7c3,'rows':_0x3fd1bd}:null;}})[_0x0938('0x25')](respondWithResult(_0x3c7065,null))['catch'](handleError(_0x3c7065,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 205c1f8..66a3a20 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 _0xf273=['emit','hasOwnProperty','hook','events','MailAccount','remove'];(function(_0x4ae10a,_0x55be85){var _0x3673a4=function(_0x226e83){while(--_0x226e83){_0x4ae10a['push'](_0x4ae10a['shift']());}};_0x3673a4(++_0x55be85);}(_0xf273,0x75));var _0x3f27=function(_0x352825,_0x5be162){_0x352825=_0x352825-0x0;var _0x57cac1=_0xf273[_0x352825];return _0x57cac1;};'use strict';var EventEmitter=require(_0x3f27('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x3f27('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3f27('0x2')};function emitEvent(_0x5cf344){return function(_0x4e2acc,_0x5bb9d6,_0xf1d53e){MailAccountEvents[_0x3f27('0x3')](_0x5cf344+':'+_0x4e2acc['id'],_0x4e2acc);MailAccountEvents[_0x3f27('0x3')](_0x5cf344,_0x4e2acc);_0xf1d53e(null);};}for(var e in events){if(events[_0x3f27('0x4')](e)){var event=events[e];MailAccount[_0x3f27('0x5')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x04a1=['MailAccount','setMaxListeners','update','remove','emit','hook','events','../../mysqldb'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0x04a1,0x18e));var _0x104a=function(_0x40204e,_0x4d44fb){_0x40204e=_0x40204e-0x0;var _0x2fbe82=_0x04a1[_0x40204e];return _0x2fbe82;};'use strict';var EventEmitter=require(_0x104a('0x0'));var MailAccount=require(_0x104a('0x1'))['db'][_0x104a('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x104a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x104a('0x4'),'afterDestroy':_0x104a('0x5')};function emitEvent(_0x3a5807){return function(_0x2a2f5f,_0x10cca3,_0x3e355e){MailAccountEvents[_0x104a('0x6')](_0x3a5807+':'+_0x2a2f5f['id'],_0x2a2f5f);MailAccountEvents['emit'](_0x3a5807,_0x2a2f5f);_0x3e355e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x104a('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 2feaf8b..0523a7d 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 _0x9018=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','util'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x9018,0xc2));var _0x8901=function(_0x100066,_0x72dbf5){_0x100066=_0x100066-0x0;var _0x1c76c9=_0x9018[_0x100066];return _0x1c76c9;};'use strict';var _=require(_0x8901('0x0'));var util=require(_0x8901('0x1'));var logger=require(_0x8901('0x2'))(_0x8901('0x3'));var moment=require(_0x8901('0x4'));var BPromise=require('bluebird');var rp=require(_0x8901('0x5'));var fs=require('fs');var path=require(_0x8901('0x6'));var rimraf=require(_0x8901('0x7'));var config=require(_0x8901('0x8'));var attributes=require(_0x8901('0x9'));module[_0x8901('0xa')]=function(_0x389b54,_0x49c4b9){return _0x389b54[_0x8901('0xb')](_0x8901('0xc'),attributes,{'tableName':_0x8901('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e0d=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','define','MailAccount','mail_accounts'];(function(_0x11b4fb,_0x10c784){var _0x56cbb5=function(_0x56d812){while(--_0x56d812){_0x11b4fb['push'](_0x11b4fb['shift']());}};_0x56cbb5(++_0x10c784);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x318afb,_0x3a3213){_0x318afb=_0x318afb-0x0;var _0x1eb818=_0x9e0d[_0x318afb];return _0x1eb818;};'use strict';var _=require(_0xd9e0('0x0'));var util=require(_0xd9e0('0x1'));var logger=require(_0xd9e0('0x2'))(_0xd9e0('0x3'));var moment=require('moment');var BPromise=require(_0xd9e0('0x4'));var rp=require(_0xd9e0('0x5'));var fs=require('fs');var path=require(_0xd9e0('0x6'));var rimraf=require(_0xd9e0('0x7'));var config=require(_0xd9e0('0x8'));var attributes=require(_0xd9e0('0x9'));module['exports']=function(_0x570a07,_0x22e726){return _0x570a07[_0xd9e0('0xa')](_0xd9e0('0xb'),attributes,{'tableName':_0xd9e0('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 f648e55..4dbce2c 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 _0x2242=['MailApplication','Applications','Smtp','get','omit','applications','list','orderBy','asc','push','length','close','autoclose','*,*,*,*','Contacts','ListId','create','List\x20not\x20found','contact','messageId','generate','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','update','format','interaction','created','MailMessage','subject','originTo','originCc','Attachment','Attachments','User','name','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailAccount','MailAccount','findAll','raw','options','where','attributes','limit','map','model','include','ShowMailAccount','find','NotifyMailAccount','keys','CmContact','createdAt','updatedAt','CompanyId','body','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','DESC'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0x2242,0x1a3));var _0x2224=function(_0xa42699,_0x29beff){_0xa42699=_0xa42699-0x0;var _0x43d95d=_0x2242[_0xa42699];return _0x43d95d;};'use strict';var _=require(_0x2224('0x0'));var util=require(_0x2224('0x1'));var moment=require(_0x2224('0x2'));var BPromise=require('bluebird');var rs=require(_0x2224('0x3'));var fs=require('fs');var Redis=require(_0x2224('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2224('0x5'));var logger=require(_0x2224('0x6'))('rpc');var config=require(_0x2224('0x7'));var jayson=require(_0x2224('0x8'));var client=jayson[_0x2224('0x9')]['http']({'port':0x232c});config[_0x2224('0xa')]=_[_0x2224('0xb')](config[_0x2224('0xa')],{'host':_0x2224('0xc'),'port':0x18eb});var socket=require(_0x2224('0xd'))(new Redis(config[_0x2224('0xa')]));require(_0x2224('0xe'))[_0x2224('0xf')](socket);function respondWithRpcPromise(_0x359fe8,_0x3a674f,_0x106dbd){return new BPromise(function(_0x4c93e4,_0x41e783){return client[_0x2224('0x10')](_0x359fe8,_0x106dbd)[_0x2224('0x11')](function(_0x595e5a){logger['info'](_0x2224('0x12'),_0x3a674f,_0x2224('0x13'));logger[_0x2224('0x14')](_0x2224('0x15'),_0x3a674f,'request\x20sent',JSON[_0x2224('0x16')](_0x595e5a));if(_0x595e5a[_0x2224('0x17')]){if(_0x595e5a['error']['code']===0x1f4){logger[_0x2224('0x17')](_0x2224('0x12'),_0x3a674f,_0x595e5a['error']['message']);return _0x41e783(_0x595e5a[_0x2224('0x17')][_0x2224('0x18')]);}logger[_0x2224('0x17')](_0x2224('0x12'),_0x3a674f,_0x595e5a[_0x2224('0x17')][_0x2224('0x18')]);return _0x4c93e4(_0x595e5a[_0x2224('0x17')][_0x2224('0x18')]);}else{logger['info'](_0x2224('0x12'),_0x3a674f,_0x2224('0x13'));_0x4c93e4(_0x595e5a[_0x2224('0x19')][_0x2224('0x18')]);}})[_0x2224('0x1a')](function(_0xd4ab1c){logger[_0x2224('0x17')](_0x2224('0x12'),_0x3a674f,_0xd4ab1c);_0x41e783(_0xd4ab1c);});});}exports[_0x2224('0x1b')]=function(_0x32b016){var _0x3cfc69=this;return new Promise(function(_0x25792d,_0x30defb){return db[_0x2224('0x1c')][_0x2224('0x1d')]({'raw':_0x32b016['options']?_0x32b016['options'][_0x2224('0x1e')]===undefined?!![]:![]:!![],'where':_0x32b016[_0x2224('0x1f')]?_0x32b016[_0x2224('0x1f')][_0x2224('0x20')]||null:null,'attributes':_0x32b016[_0x2224('0x1f')]?_0x32b016[_0x2224('0x1f')][_0x2224('0x21')]||null:null,'limit':_0x32b016[_0x2224('0x1f')]?_0x32b016[_0x2224('0x1f')][_0x2224('0x22')]||null:null,'include':_0x32b016[_0x2224('0x1f')]?_0x32b016[_0x2224('0x1f')]['include']?_[_0x2224('0x23')](_0x32b016['options']['include'],function(_0x3e0a84){return{'model':db[_0x3e0a84[_0x2224('0x24')]],'as':_0x3e0a84['as'],'attributes':_0x3e0a84['attributes'],'include':_0x3e0a84['include']?_[_0x2224('0x23')](_0x3e0a84[_0x2224('0x25')],function(_0x58b6a0){return{'model':db[_0x58b6a0[_0x2224('0x24')]],'as':_0x58b6a0['as'],'attributes':_0x58b6a0['attributes'],'include':_0x58b6a0[_0x2224('0x25')]?_[_0x2224('0x23')](_0x58b6a0[_0x2224('0x25')],function(_0x1159bf){return{'model':db[_0x1159bf[_0x2224('0x24')]],'as':_0x1159bf['as'],'attributes':_0x1159bf['attributes']};}):[]};}):[]};}):[]:[]})[_0x2224('0x11')](function(_0x5bb00f){logger['info'](_0x2224('0x1b'),_0x32b016);logger['debug'](_0x2224('0x1b'),_0x32b016,JSON['stringify'](_0x5bb00f));_0x25792d(_0x5bb00f);})['catch'](function(_0x5b77bb){logger[_0x2224('0x17')](_0x2224('0x1b'),_0x5b77bb[_0x2224('0x18')],_0x32b016);_0x30defb(_0x3cfc69[_0x2224('0x17')](0x1f4,_0x5b77bb['message']));});});};exports[_0x2224('0x26')]=function(_0x4e7cc5){var _0x2152e5=this;return new Promise(function(_0x182ca4,_0x4506f4){return db['MailAccount'][_0x2224('0x27')]({'raw':_0x4e7cc5[_0x2224('0x1f')]?_0x4e7cc5[_0x2224('0x1f')][_0x2224('0x1e')]===undefined?!![]:![]:!![],'where':_0x4e7cc5[_0x2224('0x1f')]?_0x4e7cc5[_0x2224('0x1f')]['where']||null:null,'attributes':_0x4e7cc5[_0x2224('0x1f')]?_0x4e7cc5[_0x2224('0x1f')]['attributes']||null:null,'include':_0x4e7cc5[_0x2224('0x1f')]?_0x4e7cc5[_0x2224('0x1f')][_0x2224('0x25')]?_[_0x2224('0x23')](_0x4e7cc5[_0x2224('0x1f')][_0x2224('0x25')],function(_0x191c9d){return{'model':db[_0x191c9d['model']],'as':_0x191c9d['as'],'attributes':_0x191c9d[_0x2224('0x21')],'include':_0x191c9d['include']?_[_0x2224('0x23')](_0x191c9d['include'],function(_0x304f0a){return{'model':db[_0x304f0a[_0x2224('0x24')]],'as':_0x304f0a['as'],'attributes':_0x304f0a['attributes'],'include':_0x304f0a[_0x2224('0x25')]?_[_0x2224('0x23')](_0x304f0a['include'],function(_0x1111e5){return{'model':db[_0x1111e5[_0x2224('0x24')]],'as':_0x1111e5['as'],'attributes':_0x1111e5['attributes']};}):[]};}):[]};}):[]:[]})[_0x2224('0x11')](function(_0x18bf8a){logger['info'](_0x2224('0x26'),_0x4e7cc5);logger['debug'](_0x2224('0x26'),_0x4e7cc5,JSON[_0x2224('0x16')](_0x18bf8a));_0x182ca4(_0x18bf8a);})[_0x2224('0x1a')](function(_0x519631){logger[_0x2224('0x17')]('ShowMailAccount',_0x519631[_0x2224('0x18')],_0x4e7cc5);_0x4506f4(_0x2152e5[_0x2224('0x17')](0x1f4,_0x519631[_0x2224('0x18')]));});});};exports[_0x2224('0x28')]=function(_0x49656c){var _0x4272d1=this;return new Promise(function(_0x4f0f8a,_0x2a1425){var _0x20b681={'body':_0x49656c['body'],'channel':'mail'};var _0x3b147b=_['difference'](_[_0x2224('0x29')](db[_0x2224('0x2a')]['rawAttributes']),[_0x2224('0x2b'),_0x2224('0x2c'),_0x2224('0x2d'),'ListId']);var _0x1175c5=![];if(_0x49656c[_0x2224('0x2e')]['id']){delete _0x49656c[_0x2224('0x2e')]['id'];}if(_[_0x2224('0x2f')](_0x49656c['body'][_0x2224('0x30')])){return _0x2a1425(_0x4272d1[_0x2224('0x17')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x49656c['body']['body'])||_0x49656c[_0x2224('0x2e')]['body']===''){return _0x2a1425(_0x4272d1[_0x2224('0x17')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x2224('0x2f')](_0x49656c['body'][_0x2224('0x31')])){return _0x2a1425(_0x4272d1['error'](0x1f4,_0x2224('0x32')+_0x3b147b));}if(!_[_0x2224('0x33')](_0x3b147b,_0x49656c[_0x2224('0x2e')][_0x2224('0x31')])){return _0x2a1425(_0x4272d1['error'](0x1f4,_0x2224('0x34')+_0x3b147b));}var _0xeac507={};_0xeac507[_0x49656c['body'][_0x2224('0x31')]]=_0x49656c[_0x2224('0x2e')][_0x2224('0x30')];return db[_0x2224('0x1c')]['find']({'where':{'id':_0x49656c[_0x2224('0x35')]['id']},'include':[{'model':db['CmList'],'as':_0x2224('0x36'),'include':[{'model':db[_0x2224('0x2a')],'as':'Contacts','where':_0xeac507,'limit':0x1,'order':[[_0x2224('0x2c'),_0x2224('0x37')]]}]},{'model':db[_0x2224('0x38')],'as':_0x2224('0x39')},{'model':db['MailServerOut'],'as':_0x2224('0x3a')}]})[_0x2224('0x11')](function(_0x20496c){if(_0x20496c&&_0x20496c[_0x2224('0x36')]){var _0x125c37=_0x20496c[_0x2224('0x3b')]({'plain':!![]});_0x20b681['account']=_[_0x2224('0x3c')](_0x125c37,[_0x2224('0x39'),_0x2224('0x36')]);_0x20b681[_0x2224('0x3d')]=_0x125c37[_0x2224('0x39')];_0x20b681[_0x2224('0x3e')]=_0x125c37['List'];_0x20b681[_0x2224('0x3d')]=_[_0x2224('0x3f')](_0x20b681[_0x2224('0x3d')],['priority'],[_0x2224('0x40')]);if(_0x20b681[_0x2224('0x35')]&&_0x20b681[_0x2224('0x35')]['autoclose']){_0x20b681[_0x2224('0x3d')][_0x2224('0x41')]({'id':0x0,'priority':_0x20b681[_0x2224('0x3d')][_0x2224('0x42')]+0x1,'app':_0x2224('0x43'),'appdata':_0x2224('0x44'),'interval':_0x2224('0x45')});}if(_0x20b681[_0x2224('0x35')][_0x2224('0x39')]){delete _0x20b681[_0x2224('0x35')][_0x2224('0x39')];}if(_0x20b681['account'][_0x2224('0x36')]){delete _0x20b681[_0x2224('0x35')][_0x2224('0x36')];}if(_0x125c37[_0x2224('0x36')][_0x2224('0x46')][_0x2224('0x42')]){return _0x125c37[_0x2224('0x36')]['Contacts'][0x0];}var _0x2fa0d5=_[_0x2224('0xb')](_0x49656c[_0x2224('0x2e')],{'firstName':_0x49656c[_0x2224('0x2e')][_0x2224('0x30')],'ListId':_0x125c37[_0x2224('0x47')]});_0x2fa0d5[_0x49656c[_0x2224('0x2e')][_0x2224('0x31')]]=_0x49656c[_0x2224('0x2e')][_0x2224('0x30')];return db['CmContact'][_0x2224('0x48')](_0x2fa0d5);}else{throw new Error(_0x2224('0x49'));}})[_0x2224('0x11')](function(_0x570cef){_0x20b681[_0x2224('0x4a')]=_0x570cef;if(_0x570cef){if(!_0x49656c[_0x2224('0x2e')][_0x2224('0x18')][_0x2224('0x4b')]){_0x49656c[_0x2224('0x2e')][_0x2224('0x18')][_0x2224('0x4b')]=rs[_0x2224('0x4c')]()+'\x20'+_0x49656c[_0x2224('0x2e')][_0x2224('0x18')]['from'];}var _0x53258b={'ContactId':_0x570cef['id'],'MailAccountId':_0x49656c[_0x2224('0x35')]['id'],'inReplyTo':_0x49656c[_0x2224('0x2e')][_0x2224('0x18')][_0x2224('0x4b')],'to':_0x49656c[_0x2224('0x2e')][_0x2224('0x18')][_0x2224('0x30')],'cc':_0x49656c[_0x2224('0x2e')][_0x2224('0x18')]['cc'],'subject':_0x49656c[_0x2224('0x2e')][_0x2224('0x18')]['subject'],'attach':_0x49656c[_0x2224('0x2e')][_0x2224('0x18')][_0x2224('0x4d')],'lastMsgAt':moment()['format'](_0x2224('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x49656c[_0x2224('0x2e')][_0x2224('0x2e')]};return db[_0x2224('0x4f')][_0x2224('0x27')]({'where':{'closed':![],'MailAccountId':_0x49656c[_0x2224('0x35')]['id']},'include':[{'model':db['MailMessage'],'as':_0x2224('0x50'),'attributes':[_0x2224('0x4b')],'where':{'messageId':_0x49656c[_0x2224('0x2e')]['message']['inReplyTo']}}]})[_0x2224('0x11')](function(_0x4e5a2b){if(_0x4e5a2b){return[_0x4e5a2b,![]];}return db[_0x2224('0x4f')]['create'](_0x53258b)[_0x2224('0x11')](function(_0x37ab43){return[_0x37ab43,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x4c41d9,_0x910053){if(_0x4c41d9){_0x1175c5=_0x910053;if(!_0x910053){return _0x4c41d9[_0x2224('0x51')]({'inReplyTo':_0x49656c['body'][_0x2224('0x18')][_0x2224('0x4b')],'to':_0x49656c[_0x2224('0x2e')][_0x2224('0x18')][_0x2224('0x30')],'cc':_0x49656c['body'][_0x2224('0x18')]['cc'],'subject':_0x49656c['body'][_0x2224('0x18')]['subject'],'attach':_0x4c41d9[_0x2224('0x4d')]?_0x4c41d9['attach']:_0x49656c[_0x2224('0x2e')][_0x2224('0x18')][_0x2224('0x4d')],'substatus':null,'substatusAt':moment()[_0x2224('0x52')](_0x2224('0x4e')),'lastMsgAt':moment()[_0x2224('0x52')](_0x2224('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x49656c[_0x2224('0x2e')][_0x2224('0x2e')]});}else{return _0x4c41d9;}}})[_0x2224('0x11')](function(_0x2f1a02){_0x20b681[_0x2224('0x53')]=_0x2f1a02['get']({'plain':!![]});_0x20b681[_0x2224('0x53')][_0x2224('0x54')]=_0x1175c5;return db[_0x2224('0x55')]['create']({'body':_0x49656c[_0x2224('0x2e')][_0x2224('0x2e')],'MailAccountId':_0x49656c[_0x2224('0x35')]['id'],'MailInteractionId':_0x2f1a02['id'],'direction':'in','ContactId':_0x20b681[_0x2224('0x4a')]['id'],'messageId':_0x49656c[_0x2224('0x2e')]['message'][_0x2224('0x4b')],'from':_0x49656c[_0x2224('0x2e')]['message'][_0x2224('0x30')],'to':_0x49656c[_0x2224('0x2e')][_0x2224('0x18')]['to'],'cc':_0x49656c['body'][_0x2224('0x18')]['cc'],'subject':_0x49656c['body'][_0x2224('0x18')][_0x2224('0x56')],'attach':_0x49656c[_0x2224('0x2e')][_0x2224('0x18')][_0x2224('0x4d')],'Attachments':_0x49656c[_0x2224('0x2e')][_0x2224('0x18')]['attachments'],'originTo':_0x49656c[_0x2224('0x2e')]['message'][_0x2224('0x57')],'originCc':_0x49656c['body'][_0x2224('0x18')][_0x2224('0x58')],'bcc':_0x49656c[_0x2224('0x2e')]['message']['bcc']},{'include':[{'model':db[_0x2224('0x59')],'as':_0x2224('0x5a')}]});})['then'](function(_0x5a0087){_0x20b681[_0x2224('0x18')]=_0x5a0087;if(_0x20b681[_0x2224('0x53')]['UserId']){return db[_0x2224('0x5b')][_0x2224('0x27')]({'attributes':['id',_0x2224('0x5c')],'where':{'id':_0x20b681[_0x2224('0x53')]['UserId']}})[_0x2224('0x11')](function(_0x153e3b){if(_0x153e3b){_0x20b681[_0x2224('0x3d')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x153e3b[_0x2224('0x5c')]+','+(_0x20b681[_0x2224('0x35')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x2224('0x5d'),'startRouting',_0x20b681);});}return respondWithRpcPromise(_0x2224('0x5d'),_0x2224('0x5e'),_0x20b681);})['then'](function(_0x34006e){_0x4f0f8a(_0x34006e);})['catch'](function(_0x295fb2){_0x2a1425(_0x4272d1[_0x2224('0x17')](0x1f4,_0x295fb2[_0x2224('0x18')]));});});}; \ No newline at end of file +var _0x2be0=['catch','GetMailAccount','MailAccount','findAll','options','raw','where','limit','include','attributes','map','model','stringify','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Applications','MailServerOut','Smtp','account','applications','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','get','created','attachments','originTo','originCc','bcc','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x5b76b3,_0x50b295){var _0x136956=function(_0x4c44aa){while(--_0x4c44aa){_0x5b76b3['push'](_0x5b76b3['shift']());}};_0x136956(++_0x50b295);}(_0x2be0,0x128));var _0x02be=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x2be0[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x02be('0x0'));var util=require(_0x02be('0x1'));var moment=require(_0x02be('0x2'));var BPromise=require(_0x02be('0x3'));var rs=require(_0x02be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02be('0x5'))['db'];var utils=require(_0x02be('0x6'));var logger=require(_0x02be('0x7'))('rpc');var config=require(_0x02be('0x8'));var jayson=require(_0x02be('0x9'));var client=jayson[_0x02be('0xa')][_0x02be('0xb')]({'port':0x232c});config['redis']=_[_0x02be('0xc')](config[_0x02be('0xd')],{'host':_0x02be('0xe'),'port':0x18eb});var socket=require(_0x02be('0xf'))(new Redis(config[_0x02be('0xd')]));require(_0x02be('0x10'))[_0x02be('0x11')](socket);function respondWithRpcPromise(_0x2a0e38,_0x1c0678,_0x39247d){return new BPromise(function(_0x27c9a6,_0xaf1c85){return client[_0x02be('0x12')](_0x2a0e38,_0x39247d)[_0x02be('0x13')](function(_0x526f57){logger[_0x02be('0x14')](_0x02be('0x15'),_0x1c0678,_0x02be('0x16'));logger[_0x02be('0x17')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x1c0678,_0x02be('0x16'),JSON['stringify'](_0x526f57));if(_0x526f57[_0x02be('0x18')]){if(_0x526f57[_0x02be('0x18')][_0x02be('0x19')]===0x1f4){logger[_0x02be('0x18')](_0x02be('0x15'),_0x1c0678,_0x526f57[_0x02be('0x18')][_0x02be('0x1a')]);return _0xaf1c85(_0x526f57[_0x02be('0x18')]['message']);}logger[_0x02be('0x18')](_0x02be('0x15'),_0x1c0678,_0x526f57['error']['message']);return _0x27c9a6(_0x526f57[_0x02be('0x18')]['message']);}else{logger['info'](_0x02be('0x15'),_0x1c0678,'request\x20sent');_0x27c9a6(_0x526f57[_0x02be('0x1b')][_0x02be('0x1a')]);}})[_0x02be('0x1c')](function(_0x3a836b){logger[_0x02be('0x18')](_0x02be('0x15'),_0x1c0678,_0x3a836b);_0xaf1c85(_0x3a836b);});});}exports[_0x02be('0x1d')]=function(_0x4963c2){var _0x28102a=this;return new Promise(function(_0x86ec87,_0x7cbdae){return db[_0x02be('0x1e')][_0x02be('0x1f')]({'raw':_0x4963c2[_0x02be('0x20')]?_0x4963c2[_0x02be('0x20')][_0x02be('0x21')]===undefined?!![]:![]:!![],'where':_0x4963c2[_0x02be('0x20')]?_0x4963c2[_0x02be('0x20')][_0x02be('0x22')]||null:null,'attributes':_0x4963c2['options']?_0x4963c2[_0x02be('0x20')]['attributes']||null:null,'limit':_0x4963c2[_0x02be('0x20')]?_0x4963c2[_0x02be('0x20')][_0x02be('0x23')]||null:null,'include':_0x4963c2[_0x02be('0x20')]?_0x4963c2[_0x02be('0x20')][_0x02be('0x24')]?_['map'](_0x4963c2[_0x02be('0x20')][_0x02be('0x24')],function(_0x4c2ed7){return{'model':db[_0x4c2ed7['model']],'as':_0x4c2ed7['as'],'attributes':_0x4c2ed7[_0x02be('0x25')],'include':_0x4c2ed7[_0x02be('0x24')]?_[_0x02be('0x26')](_0x4c2ed7[_0x02be('0x24')],function(_0xbf4a8c){return{'model':db[_0xbf4a8c['model']],'as':_0xbf4a8c['as'],'attributes':_0xbf4a8c[_0x02be('0x25')],'include':_0xbf4a8c[_0x02be('0x24')]?_[_0x02be('0x26')](_0xbf4a8c[_0x02be('0x24')],function(_0x3a59e0){return{'model':db[_0x3a59e0[_0x02be('0x27')]],'as':_0x3a59e0['as'],'attributes':_0x3a59e0[_0x02be('0x25')]};}):[]};}):[]};}):[]:[]})[_0x02be('0x13')](function(_0x3a7e53){logger['info'](_0x02be('0x1d'),_0x4963c2);logger[_0x02be('0x17')]('GetMailAccount',_0x4963c2,JSON[_0x02be('0x28')](_0x3a7e53));_0x86ec87(_0x3a7e53);})['catch'](function(_0x10c891){logger['error']('GetMailAccount',_0x10c891[_0x02be('0x1a')],_0x4963c2);_0x7cbdae(_0x28102a['error'](0x1f4,_0x10c891['message']));});});};exports[_0x02be('0x29')]=function(_0x19c215){var _0xdc61ed=this;return new Promise(function(_0x212397,_0xfd7a51){return db[_0x02be('0x1e')][_0x02be('0x2a')]({'raw':_0x19c215['options']?_0x19c215[_0x02be('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x19c215[_0x02be('0x20')]?_0x19c215[_0x02be('0x20')][_0x02be('0x22')]||null:null,'attributes':_0x19c215[_0x02be('0x20')]?_0x19c215['options'][_0x02be('0x25')]||null:null,'include':_0x19c215[_0x02be('0x20')]?_0x19c215[_0x02be('0x20')]['include']?_[_0x02be('0x26')](_0x19c215[_0x02be('0x20')]['include'],function(_0x3cc92e){return{'model':db[_0x3cc92e[_0x02be('0x27')]],'as':_0x3cc92e['as'],'attributes':_0x3cc92e[_0x02be('0x25')],'include':_0x3cc92e[_0x02be('0x24')]?_[_0x02be('0x26')](_0x3cc92e[_0x02be('0x24')],function(_0x3c2328){return{'model':db[_0x3c2328[_0x02be('0x27')]],'as':_0x3c2328['as'],'attributes':_0x3c2328[_0x02be('0x25')],'include':_0x3c2328[_0x02be('0x24')]?_[_0x02be('0x26')](_0x3c2328['include'],function(_0xae6ef0){return{'model':db[_0xae6ef0[_0x02be('0x27')]],'as':_0xae6ef0['as'],'attributes':_0xae6ef0['attributes']};}):[]};}):[]};}):[]:[]})[_0x02be('0x13')](function(_0x9f54eb){logger[_0x02be('0x14')](_0x02be('0x29'),_0x19c215);logger[_0x02be('0x17')](_0x02be('0x29'),_0x19c215,JSON['stringify'](_0x9f54eb));_0x212397(_0x9f54eb);})[_0x02be('0x1c')](function(_0x53bf33){logger[_0x02be('0x18')]('ShowMailAccount',_0x53bf33[_0x02be('0x1a')],_0x19c215);_0xfd7a51(_0xdc61ed['error'](0x1f4,_0x53bf33[_0x02be('0x1a')]));});});};exports[_0x02be('0x2b')]=function(_0x14b9e0){var _0x1a45db=this;return new Promise(function(_0x3bf39b,_0x28eebc){var _0x45bb85={'body':_0x14b9e0[_0x02be('0x2c')],'channel':_0x02be('0x2d')};var _0x5564fd=_[_0x02be('0x2e')](_[_0x02be('0x2f')](db[_0x02be('0x30')]['rawAttributes']),[_0x02be('0x31'),_0x02be('0x32'),_0x02be('0x33'),_0x02be('0x34')]);var _0x468471=![];if(_0x14b9e0['body']['id']){delete _0x14b9e0[_0x02be('0x2c')]['id'];}if(_['isNil'](_0x14b9e0['body'][_0x02be('0x35')])){return _0x28eebc(_0x1a45db[_0x02be('0x18')](0x1f4,_0x02be('0x36')));}if(_[_0x02be('0x37')](_0x14b9e0[_0x02be('0x2c')][_0x02be('0x2c')])||_0x14b9e0['body'][_0x02be('0x2c')]===''){return _0x28eebc(_0x1a45db[_0x02be('0x18')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x14b9e0[_0x02be('0x2c')][_0x02be('0x38')])){return _0x28eebc(_0x1a45db[_0x02be('0x18')](0x1f4,_0x02be('0x39')+_0x5564fd));}if(!_[_0x02be('0x3a')](_0x5564fd,_0x14b9e0[_0x02be('0x2c')][_0x02be('0x38')])){return _0x28eebc(_0x1a45db[_0x02be('0x18')](0x1f4,_0x02be('0x3b')+_0x5564fd));}var _0x393cf2={};_0x393cf2[_0x14b9e0['body'][_0x02be('0x38')]]=_0x14b9e0[_0x02be('0x2c')][_0x02be('0x35')];return db[_0x02be('0x1e')]['find']({'where':{'id':_0x14b9e0['account']['id']},'include':[{'model':db['CmList'],'as':_0x02be('0x3c'),'include':[{'model':db[_0x02be('0x30')],'as':'Contacts','where':_0x393cf2,'limit':0x1,'order':[[_0x02be('0x32'),'DESC']]}]},{'model':db['MailApplication'],'as':_0x02be('0x3d')},{'model':db[_0x02be('0x3e')],'as':_0x02be('0x3f')}]})[_0x02be('0x13')](function(_0x486500){if(_0x486500&&_0x486500[_0x02be('0x3c')]){var _0xabf4d=_0x486500['get']({'plain':!![]});_0x45bb85[_0x02be('0x40')]=_['omit'](_0xabf4d,[_0x02be('0x3d'),_0x02be('0x3c')]);_0x45bb85['applications']=_0xabf4d[_0x02be('0x3d')];_0x45bb85['list']=_0xabf4d['List'];_0x45bb85[_0x02be('0x41')]=_[_0x02be('0x42')](_0x45bb85[_0x02be('0x41')],[_0x02be('0x43')],[_0x02be('0x44')]);if(_0x45bb85['account']&&_0x45bb85['account'][_0x02be('0x45')]){_0x45bb85['applications'][_0x02be('0x46')]({'id':0x0,'priority':_0x45bb85['applications'][_0x02be('0x47')]+0x1,'app':_0x02be('0x48'),'appdata':_0x02be('0x45'),'interval':_0x02be('0x49')});}if(_0x45bb85[_0x02be('0x40')][_0x02be('0x3d')]){delete _0x45bb85['account']['Applications'];}if(_0x45bb85['account'][_0x02be('0x3c')]){delete _0x45bb85[_0x02be('0x40')]['List'];}if(_0xabf4d[_0x02be('0x3c')][_0x02be('0x4a')][_0x02be('0x47')]){return _0xabf4d[_0x02be('0x3c')][_0x02be('0x4a')][0x0];}var _0x169148=_[_0x02be('0xc')](_0x14b9e0[_0x02be('0x2c')],{'firstName':_0x14b9e0[_0x02be('0x2c')][_0x02be('0x35')],'ListId':_0xabf4d[_0x02be('0x34')]});_0x169148[_0x14b9e0[_0x02be('0x2c')][_0x02be('0x38')]]=_0x14b9e0['body'][_0x02be('0x35')];return db['CmContact'][_0x02be('0x4b')](_0x169148);}else{throw new Error(_0x02be('0x4c'));}})['then'](function(_0x27938b){_0x45bb85[_0x02be('0x4d')]=_0x27938b;if(_0x27938b){if(!_0x14b9e0[_0x02be('0x2c')][_0x02be('0x1a')]['messageId']){_0x14b9e0['body'][_0x02be('0x1a')][_0x02be('0x4e')]=rs[_0x02be('0x4f')]()+'\x20'+_0x14b9e0[_0x02be('0x2c')]['message'][_0x02be('0x35')];}var _0x7df52={'ContactId':_0x27938b['id'],'MailAccountId':_0x14b9e0[_0x02be('0x40')]['id'],'inReplyTo':_0x14b9e0[_0x02be('0x2c')]['message']['messageId'],'to':_0x14b9e0[_0x02be('0x2c')]['message'][_0x02be('0x35')],'cc':_0x14b9e0['body'][_0x02be('0x1a')]['cc'],'subject':_0x14b9e0['body'][_0x02be('0x1a')][_0x02be('0x50')],'attach':_0x14b9e0[_0x02be('0x2c')]['message'][_0x02be('0x51')],'lastMsgAt':moment()[_0x02be('0x52')](_0x02be('0x53')),'lastMsgDirection':'in','lastMsgBody':_0x14b9e0[_0x02be('0x2c')][_0x02be('0x2c')]};return db[_0x02be('0x54')]['find']({'where':{'closed':![],'MailAccountId':_0x14b9e0['account']['id']},'include':[{'model':db[_0x02be('0x55')],'as':_0x02be('0x56'),'attributes':[_0x02be('0x4e')],'where':{'messageId':_0x14b9e0[_0x02be('0x2c')][_0x02be('0x1a')][_0x02be('0x57')]}}]})[_0x02be('0x13')](function(_0x4e0e5f){if(_0x4e0e5f){return[_0x4e0e5f,![]];}return db[_0x02be('0x54')][_0x02be('0x4b')](_0x7df52)[_0x02be('0x13')](function(_0x125121){return[_0x125121,!![]];});});}else{throw new Error(_0x02be('0x58'));}})[_0x02be('0x59')](function(_0x2431a3,_0x553ab3){if(_0x2431a3){_0x468471=_0x553ab3;if(!_0x553ab3){return _0x2431a3[_0x02be('0x5a')]({'inReplyTo':_0x14b9e0[_0x02be('0x2c')][_0x02be('0x1a')][_0x02be('0x4e')],'to':_0x14b9e0[_0x02be('0x2c')]['message'][_0x02be('0x35')],'cc':_0x14b9e0['body'][_0x02be('0x1a')]['cc'],'subject':_0x14b9e0[_0x02be('0x2c')][_0x02be('0x1a')][_0x02be('0x50')],'attach':_0x2431a3[_0x02be('0x51')]?_0x2431a3[_0x02be('0x51')]:_0x14b9e0[_0x02be('0x2c')][_0x02be('0x1a')][_0x02be('0x51')],'substatus':null,'substatusAt':moment()[_0x02be('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x02be('0x52')](_0x02be('0x53')),'lastMsgDirection':'in','lastMsgBody':_0x14b9e0[_0x02be('0x2c')][_0x02be('0x2c')]});}else{return _0x2431a3;}}})['then'](function(_0x13d795){_0x45bb85[_0x02be('0x5b')]=_0x13d795[_0x02be('0x5c')]({'plain':!![]});_0x45bb85[_0x02be('0x5b')][_0x02be('0x5d')]=_0x468471;return db[_0x02be('0x55')][_0x02be('0x4b')]({'body':_0x14b9e0[_0x02be('0x2c')][_0x02be('0x2c')],'MailAccountId':_0x14b9e0[_0x02be('0x40')]['id'],'MailInteractionId':_0x13d795['id'],'direction':'in','ContactId':_0x45bb85[_0x02be('0x4d')]['id'],'messageId':_0x14b9e0[_0x02be('0x2c')]['message'][_0x02be('0x4e')],'from':_0x14b9e0[_0x02be('0x2c')][_0x02be('0x1a')][_0x02be('0x35')],'to':_0x14b9e0[_0x02be('0x2c')][_0x02be('0x1a')]['to'],'cc':_0x14b9e0[_0x02be('0x2c')]['message']['cc'],'subject':_0x14b9e0[_0x02be('0x2c')]['message'][_0x02be('0x50')],'attach':_0x14b9e0[_0x02be('0x2c')][_0x02be('0x1a')][_0x02be('0x51')],'Attachments':_0x14b9e0[_0x02be('0x2c')][_0x02be('0x1a')][_0x02be('0x5e')],'originTo':_0x14b9e0[_0x02be('0x2c')][_0x02be('0x1a')][_0x02be('0x5f')],'originCc':_0x14b9e0['body'][_0x02be('0x1a')][_0x02be('0x60')],'bcc':_0x14b9e0[_0x02be('0x2c')]['message'][_0x02be('0x61')]},{'include':[{'model':db[_0x02be('0x62')],'as':_0x02be('0x63')}]});})[_0x02be('0x13')](function(_0x4ad0cc){_0x45bb85[_0x02be('0x1a')]=_0x4ad0cc;if(_0x45bb85[_0x02be('0x5b')][_0x02be('0x64')]){return db[_0x02be('0x65')][_0x02be('0x2a')]({'attributes':['id',_0x02be('0x66')],'where':{'id':_0x45bb85['interaction'][_0x02be('0x64')]}})['then'](function(_0x43ee4c){if(_0x43ee4c){_0x45bb85[_0x02be('0x41')][_0x02be('0x67')]({'id':0x0,'priority':0x0,'app':_0x02be('0x68'),'appdata':_0x43ee4c[_0x02be('0x66')]+','+(_0x45bb85[_0x02be('0x40')][_0x02be('0x69')]||0xa),'interval':_0x02be('0x49')});}return respondWithRpcPromise(_0x02be('0x6a'),'startRouting',_0x45bb85);});}return respondWithRpcPromise(_0x02be('0x6a'),_0x02be('0x6b'),_0x45bb85);})[_0x02be('0x13')](function(_0x33e5bd){_0x3bf39b(_0x33e5bd);})[_0x02be('0x1c')](function(_0x392535){_0x28eebc(_0x1a45db[_0x02be('0x18')](0x1f4,_0x392535[_0x02be('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 056c3b4..be2c2ed 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 _0xc9b9=['remove','update','length'];(function(_0x56ee15,_0x1effd1){var _0x94991f=function(_0x5018fa){while(--_0x5018fa){_0x56ee15['push'](_0x56ee15['shift']());}};_0x94991f(++_0x1effd1);}(_0xc9b9,0x18f));var _0x9c9b=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0xc9b9[_0x5d4f12];return _0x4eb577;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0x9c9b('0x0'),_0x9c9b('0x1')];function createListener(_0x3418ab,_0x4e2e8d){return function(_0x5ee8f8){_0x4e2e8d['emit'](_0x3418ab,_0x5ee8f8);};}function removeListener(_0x497d53,_0x38a64b){return function(){MailAccountEvents['removeListener'](_0x497d53,_0x38a64b);};}exports['register']=function(_0x51abae){for(var _0x1f29f3=0x0,_0x15d94b=events[_0x9c9b('0x2')];_0x1f29f3<_0x15d94b;_0x1f29f3++){var _0x193305=events[_0x1f29f3];var _0xbbd998=createListener('mailAccount:'+_0x193305,_0x51abae);MailAccountEvents['on'](_0x193305,_0xbbd998);}}; \ No newline at end of file +var _0xfd6e=['./mailAccount.events','remove','length'];(function(_0x5126aa,_0x5b3911){var _0x1cbbdc=function(_0xe04760){while(--_0xe04760){_0x5126aa['push'](_0x5126aa['shift']());}};_0x1cbbdc(++_0x5b3911);}(_0xfd6e,0x16e));var _0xefd6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd6e[_0x2641f9];return _0x585741;};'use strict';var MailAccountEvents=require(_0xefd6('0x0'));var events=['save',_0xefd6('0x1'),'update'];function createListener(_0x229dfe,_0x41b7d0){return function(_0x54e608){_0x41b7d0['emit'](_0x229dfe,_0x54e608);};}function removeListener(_0x5f4c49,_0x27d881){return function(){MailAccountEvents['removeListener'](_0x5f4c49,_0x27d881);};}exports['register']=function(_0x24af45){for(var _0x23f8c3=0x0,_0x26e108=events[_0xefd6('0x2')];_0x23f8c3<_0x26e108;_0x23f8c3++){var _0x340765=events[_0x23f8c3];var _0x5da399=createListener('mailAccount:'+_0x340765,_0x24af45);MailAccountEvents['on'](_0x340765,_0x5da399);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 51da7f5..ffc50c7 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 _0xb62e=['/:id','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','show','put','update','delete'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xb62e,0x1de));var _0xeb62=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb62e[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var auth=require(_0xeb62('0x5'));var interaction=require(_0xeb62('0x6'));var config=require(_0xeb62('0x7'));var controller=require(_0xeb62('0x8'));router[_0xeb62('0x9')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xe')](_0xeb62('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xeb62('0x10')]=router; \ No newline at end of file +var _0xe511=['/:id','show','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailApplication.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe511,0x16f));var _0x1e51=function(_0x3ea92b,_0x480631){_0x3ea92b=_0x3ea92b-0x0;var _0x371fc2=_0xe511[_0x3ea92b];return _0x371fc2;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var auth=require(_0x1e51('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1e51('0x5'));var controller=require(_0x1e51('0x6'));router[_0x1e51('0x7')](_0x1e51('0x8'),auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xd')]);module[_0x1e51('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index bbac671..fda8cf7 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 _0x0823=['INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x377df8,_0x42c66d){var _0x29508d=function(_0x2ea871){while(--_0x2ea871){_0x377df8['push'](_0x377df8['shift']());}};_0x29508d(++_0x42c66d);}(_0x0823,0x87));var _0x3082=function(_0x27fedb,_0x31c693){_0x27fedb=_0x27fedb-0x0;var _0x58ab78=_0x0823[_0x27fedb];return _0x58ab78;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x3082('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x3082('0x1')],'allowNull':![],'defaultValue':_0x3082('0x2')},'appdata':{'type':Sequelize[_0x3082('0x3')]()},'description':{'type':Sequelize[_0x3082('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x3082('0x4')}}; \ No newline at end of file +var _0x0468=['TEXT','*,*,*,*','INTEGER','STRING','noop'];(function(_0x39637b,_0x512d81){var _0x1c7905=function(_0x31fe56){while(--_0x31fe56){_0x39637b['push'](_0x39637b['shift']());}};_0x1c7905(++_0x512d81);}(_0x0468,0x174));var _0x8046=function(_0x3ad9ac,_0xa82e62){_0x3ad9ac=_0x3ad9ac-0x0;var _0x3c77bb=_0x0468[_0x3ad9ac];return _0x3c77bb;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x8046('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x8046('0x1')],'allowNull':![],'defaultValue':_0x8046('0x2')},'appdata':{'type':Sequelize[_0x8046('0x3')]()},'description':{'type':Sequelize[_0x8046('0x1')]},'interval':{'type':Sequelize[_0x8046('0x1')],'defaultValue':_0x8046('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 8b5c2d3..411644b 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 _0x3c34=['offset','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','show','params','MailApplication','rawAttributes','query','intersection','model','attributes','length','includeAll','merge','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','json','count'];(function(_0x414655,_0x79d916){var _0x237884=function(_0x2737d9){while(--_0x2737d9){_0x414655['push'](_0x414655['shift']());}};_0x237884(++_0x79d916);}(_0x3c34,0xf7));var _0x43c3=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0x3c34[_0x3c51d4];return _0x53c45f;};'use strict';var pdf=require(_0x43c3('0x0'));var emlformat=require(_0x43c3('0x1'));var rimraf=require(_0x43c3('0x2'));var zipdir=require(_0x43c3('0x3'));var jsonpatch=require(_0x43c3('0x4'));var rp=require(_0x43c3('0x5'));var moment=require(_0x43c3('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x43c3('0x7'));var util=require(_0x43c3('0x8'));var path=require(_0x43c3('0x9'));var sox=require(_0x43c3('0xa'));var csv=require(_0x43c3('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x43c3('0xc'));var squel=require('squel');var crypto=require(_0x43c3('0xd'));var jsforce=require(_0x43c3('0xe'));var deskjs=require(_0x43c3('0xf'));var toCsv=require(_0x43c3('0xb'));var querystring=require(_0x43c3('0x10'));var Papa=require(_0x43c3('0x11'));var Redis=require('ioredis');var authService=require(_0x43c3('0x12'));var qs=require(_0x43c3('0x13'));var as=require(_0x43c3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x43c3('0x15'));var utils=require('../../config/utils');var config=require(_0x43c3('0x16'));var db=require(_0x43c3('0x17'))['db'];function respondWithStatusCode(_0xfcb49c,_0x4e5261){_0x4e5261=_0x4e5261||0xcc;return function(_0x1a017f){if(_0x1a017f){return _0xfcb49c['sendStatus'](_0x4e5261);}return _0xfcb49c[_0x43c3('0x18')](_0x4e5261)[_0x43c3('0x19')]();};}function respondWithResult(_0x4a1d59,_0x343131){_0x343131=_0x343131||0xc8;return function(_0x148d5b){if(_0x148d5b){return _0x4a1d59[_0x43c3('0x18')](_0x343131)[_0x43c3('0x1a')](_0x148d5b);}};}function respondWithFilteredResult(_0x3a4daf,_0x5a08e1){return function(_0x44b7ce){if(_0x44b7ce){var _0x11ca52=_0x44b7ce[_0x43c3('0x1b')],_0x1ec854=_0x5a08e1[_0x43c3('0x1c')],_0x572a5b=_0x5a08e1[_0x43c3('0x1c')]+_0x5a08e1[_0x43c3('0x1d')],_0x49b9a0;if(_0x572a5b>=_0x11ca52){_0x572a5b=_0x11ca52;_0x49b9a0=0xc8;}else{_0x49b9a0=0xce;}_0x3a4daf['status'](_0x49b9a0);return _0x3a4daf[_0x43c3('0x1e')](_0x43c3('0x1f'),_0x1ec854+'-'+_0x572a5b+'/'+_0x11ca52)['json'](_0x44b7ce);}return null;};}function patchUpdates(_0x2e92a7){return function(_0x165546){try{jsonpatch['apply'](_0x165546,_0x2e92a7,!![]);}catch(_0x20ccf8){return BPromise['reject'](_0x20ccf8);}return _0x165546[_0x43c3('0x20')]();};}function saveUpdates(_0x5337a1,_0x2771e9){return function(_0x2fe113){if(_0x2fe113){return _0x2fe113[_0x43c3('0x21')](_0x5337a1)[_0x43c3('0x22')](function(_0xda2300){return _0xda2300;});}return null;};}function removeEntity(_0x25314a,_0x5a7a18){return function(_0xb950a8){if(_0xb950a8){return _0xb950a8[_0x43c3('0x23')]()['then'](function(){_0x25314a[_0x43c3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d6529,_0x3d6276){return function(_0x4dc1ce){if(!_0x4dc1ce){_0x2d6529[_0x43c3('0x24')](0x194);}return _0x4dc1ce;};}function handleError(_0x4a9160,_0x2497d3){_0x2497d3=_0x2497d3||0x1f4;return function(_0x2a4551){logger[_0x43c3('0x25')](_0x2a4551[_0x43c3('0x26')]);if(_0x2a4551[_0x43c3('0x27')]){delete _0x2a4551[_0x43c3('0x27')];}_0x4a9160[_0x43c3('0x18')](_0x2497d3)[_0x43c3('0x28')](_0x2a4551);};}exports[_0x43c3('0x29')]=function(_0x5c013f,_0x514dfa){var _0x21e32e={'raw':!![],'where':{'id':_0x5c013f[_0x43c3('0x2a')]['id']}},_0x8af52c={};_0x8af52c['model']=_['keys'](db[_0x43c3('0x2b')][_0x43c3('0x2c')]);_0x8af52c[_0x43c3('0x2d')]=_['keys'](_0x5c013f[_0x43c3('0x2d')]);_0x8af52c['filters']=_[_0x43c3('0x2e')](_0x8af52c[_0x43c3('0x2f')],_0x8af52c[_0x43c3('0x2d')]);_0x21e32e[_0x43c3('0x30')]=_[_0x43c3('0x2e')](_0x8af52c[_0x43c3('0x2f')],qs['fields'](_0x5c013f[_0x43c3('0x2d')]['fields']));_0x21e32e[_0x43c3('0x30')]=_0x21e32e[_0x43c3('0x30')][_0x43c3('0x31')]?_0x21e32e[_0x43c3('0x30')]:_0x8af52c[_0x43c3('0x2f')];if(_0x5c013f[_0x43c3('0x2d')][_0x43c3('0x32')]){_0x21e32e['include']=[{'all':!![]}];}_0x21e32e=_[_0x43c3('0x33')]({},_0x21e32e,_0x5c013f['options']);return db[_0x43c3('0x2b')][_0x43c3('0x34')](_0x21e32e)['then'](handleEntityNotFound(_0x514dfa,null))[_0x43c3('0x22')](respondWithResult(_0x514dfa,null))[_0x43c3('0x35')](handleError(_0x514dfa,null));};exports[_0x43c3('0x21')]=function(_0x5eb1b2,_0x5f5083){if(_0x5eb1b2[_0x43c3('0x36')]['id']){delete _0x5eb1b2[_0x43c3('0x36')]['id'];}return db[_0x43c3('0x2b')][_0x43c3('0x34')]({'where':{'id':_0x5eb1b2[_0x43c3('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5f5083,null))[_0x43c3('0x22')](saveUpdates(_0x5eb1b2[_0x43c3('0x36')],null))[_0x43c3('0x22')](respondWithResult(_0x5f5083,null))['catch'](handleError(_0x5f5083,null));};exports['destroy']=function(_0x3bf0b4,_0x1fe5bf){return db[_0x43c3('0x2b')][_0x43c3('0x34')]({'where':{'id':_0x3bf0b4['params']['id']}})[_0x43c3('0x22')](handleEntityNotFound(_0x1fe5bf,null))[_0x43c3('0x22')](removeEntity(_0x1fe5bf,null))['catch'](handleError(_0x1fe5bf,null));}; \ No newline at end of file +var _0x5729=['keys','filters','intersection','fields','attributes','includeAll','include','merge','options','find','catch','body','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','params','model','MailApplication','rawAttributes','query'];(function(_0x18fb2e,_0x35a823){var _0x1383a6=function(_0x5cf0f1){while(--_0x5cf0f1){_0x18fb2e['push'](_0x18fb2e['shift']());}};_0x1383a6(++_0x35a823);}(_0x5729,0xe8));var _0x9572=function(_0x27c021,_0x190f72){_0x27c021=_0x27c021-0x0;var _0x1d0700=_0x5729[_0x27c021];return _0x1d0700;};'use strict';var pdf=require(_0x9572('0x0'));var emlformat=require(_0x9572('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9572('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9572('0x3'));var moment=require(_0x9572('0x4'));var BPromise=require(_0x9572('0x5'));var Mustache=require('mustache');var util=require(_0x9572('0x6'));var path=require(_0x9572('0x7'));var sox=require(_0x9572('0x8'));var csv=require('to-csv');var ejs=require(_0x9572('0x9'));var fs=require('fs');var _=require(_0x9572('0xa'));var squel=require(_0x9572('0xb'));var crypto=require('crypto');var jsforce=require(_0x9572('0xc'));var deskjs=require(_0x9572('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9572('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9572('0xf'));var qs=require(_0x9572('0x10'));var as=require(_0x9572('0x11'));var hardwareService=require(_0x9572('0x12'));var logger=require('../../config/logger')(_0x9572('0x13'));var utils=require(_0x9572('0x14'));var config=require(_0x9572('0x15'));var db=require(_0x9572('0x16'))['db'];function respondWithStatusCode(_0x3d2678,_0x46a910){_0x46a910=_0x46a910||0xcc;return function(_0x5ca45f){if(_0x5ca45f){return _0x3d2678[_0x9572('0x17')](_0x46a910);}return _0x3d2678[_0x9572('0x18')](_0x46a910)['end']();};}function respondWithResult(_0x1a55bd,_0x4585f4){_0x4585f4=_0x4585f4||0xc8;return function(_0x55a686){if(_0x55a686){return _0x1a55bd[_0x9572('0x18')](_0x4585f4)[_0x9572('0x19')](_0x55a686);}};}function respondWithFilteredResult(_0xc65a43,_0x42d22f){return function(_0x52f7f3){if(_0x52f7f3){var _0x12ad97=_0x52f7f3['count'],_0x5291d0=_0x42d22f['offset'],_0x1f5465=_0x42d22f[_0x9572('0x1a')]+_0x42d22f[_0x9572('0x1b')],_0x4a9cc8;if(_0x1f5465>=_0x12ad97){_0x1f5465=_0x12ad97;_0x4a9cc8=0xc8;}else{_0x4a9cc8=0xce;}_0xc65a43['status'](_0x4a9cc8);return _0xc65a43['set'](_0x9572('0x1c'),_0x5291d0+'-'+_0x1f5465+'/'+_0x12ad97)[_0x9572('0x19')](_0x52f7f3);}return null;};}function patchUpdates(_0x31f63a){return function(_0x541fb9){try{jsonpatch[_0x9572('0x1d')](_0x541fb9,_0x31f63a,!![]);}catch(_0x538159){return BPromise[_0x9572('0x1e')](_0x538159);}return _0x541fb9['save']();};}function saveUpdates(_0x2c2d1d,_0x2edc03){return function(_0x489e57){if(_0x489e57){return _0x489e57[_0x9572('0x1f')](_0x2c2d1d)[_0x9572('0x20')](function(_0xcf9c7b){return _0xcf9c7b;});}return null;};}function removeEntity(_0x4ecf5d,_0x3433b1){return function(_0x19a14d){if(_0x19a14d){return _0x19a14d[_0x9572('0x21')]()['then'](function(){_0x4ecf5d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16d176,_0x5e7b9c){return function(_0x2db62b){if(!_0x2db62b){_0x16d176[_0x9572('0x17')](0x194);}return _0x2db62b;};}function handleError(_0x2e5b33,_0xefb798){_0xefb798=_0xefb798||0x1f4;return function(_0x19d998){logger[_0x9572('0x22')](_0x19d998[_0x9572('0x23')]);if(_0x19d998[_0x9572('0x24')]){delete _0x19d998[_0x9572('0x24')];}_0x2e5b33[_0x9572('0x18')](_0xefb798)[_0x9572('0x25')](_0x19d998);};}exports['show']=function(_0x90ae07,_0x2df97c){var _0x3d737d={'raw':!![],'where':{'id':_0x90ae07[_0x9572('0x26')]['id']}},_0x1c14ba={};_0x1c14ba[_0x9572('0x27')]=_['keys'](db[_0x9572('0x28')][_0x9572('0x29')]);_0x1c14ba[_0x9572('0x2a')]=_[_0x9572('0x2b')](_0x90ae07['query']);_0x1c14ba[_0x9572('0x2c')]=_[_0x9572('0x2d')](_0x1c14ba[_0x9572('0x27')],_0x1c14ba[_0x9572('0x2a')]);_0x3d737d['attributes']=_[_0x9572('0x2d')](_0x1c14ba['model'],qs[_0x9572('0x2e')](_0x90ae07[_0x9572('0x2a')][_0x9572('0x2e')]));_0x3d737d[_0x9572('0x2f')]=_0x3d737d[_0x9572('0x2f')]['length']?_0x3d737d['attributes']:_0x1c14ba['model'];if(_0x90ae07[_0x9572('0x2a')][_0x9572('0x30')]){_0x3d737d[_0x9572('0x31')]=[{'all':!![]}];}_0x3d737d=_[_0x9572('0x32')]({},_0x3d737d,_0x90ae07[_0x9572('0x33')]);return db[_0x9572('0x28')][_0x9572('0x34')](_0x3d737d)['then'](handleEntityNotFound(_0x2df97c,null))[_0x9572('0x20')](respondWithResult(_0x2df97c,null))[_0x9572('0x35')](handleError(_0x2df97c,null));};exports[_0x9572('0x1f')]=function(_0x31258,_0x1ee53c){if(_0x31258[_0x9572('0x36')]['id']){delete _0x31258[_0x9572('0x36')]['id'];}return db[_0x9572('0x28')]['find']({'where':{'id':_0x31258[_0x9572('0x26')]['id']}})[_0x9572('0x20')](handleEntityNotFound(_0x1ee53c,null))[_0x9572('0x20')](saveUpdates(_0x31258[_0x9572('0x36')],null))[_0x9572('0x20')](respondWithResult(_0x1ee53c,null))[_0x9572('0x35')](handleError(_0x1ee53c,null));};exports['destroy']=function(_0x37a688,_0x3a676d){return db[_0x9572('0x28')][_0x9572('0x34')]({'where':{'id':_0x37a688[_0x9572('0x26')]['id']}})[_0x9572('0x20')](handleEntityNotFound(_0x3a676d,null))[_0x9572('0x20')](removeEntity(_0x3a676d,null))['catch'](handleError(_0x3a676d,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index b5f57f4..cc53133 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 _0xd945=['./mailApplication.attributes','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xd6db21,_0x1d08f3){var _0x3b96a0=function(_0x157017){while(--_0x157017){_0xd6db21['push'](_0xd6db21['shift']());}};_0x3b96a0(++_0x1d08f3);}(_0xd945,0x84));var _0x5d94=function(_0x5ebfa6,_0x3c1551){_0x5ebfa6=_0x5ebfa6-0x0;var _0x3ae5cd=_0xd945[_0x5ebfa6];return _0x3ae5cd;};'use strict';var _=require(_0x5d94('0x0'));var util=require(_0x5d94('0x1'));var logger=require(_0x5d94('0x2'))('api');var moment=require(_0x5d94('0x3'));var BPromise=require(_0x5d94('0x4'));var rp=require(_0x5d94('0x5'));var fs=require('fs');var path=require(_0x5d94('0x6'));var rimraf=require(_0x5d94('0x7'));var config=require('../../config/environment');var attributes=require(_0x5d94('0x8'));module[_0x5d94('0x9')]=function(_0x30b667,_0x3056d3){return _0x30b667[_0x5d94('0xa')]('MailApplication',attributes,{'tableName':_0x5d94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5d94('0xc'),'collate':_0x5d94('0xd')});}; \ No newline at end of file +var _0xde46=['../../config/logger','api','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4','lodash','util'];(function(_0x17d5c6,_0x44b613){var _0x219a1e=function(_0x640a2){while(--_0x640a2){_0x17d5c6['push'](_0x17d5c6['shift']());}};_0x219a1e(++_0x44b613);}(_0xde46,0x14e));var _0x6de4=function(_0x5f1076,_0x22b761){_0x5f1076=_0x5f1076-0x0;var _0x473922=_0xde46[_0x5f1076];return _0x473922;};'use strict';var _=require(_0x6de4('0x0'));var util=require(_0x6de4('0x1'));var logger=require(_0x6de4('0x2'))(_0x6de4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6de4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6de4('0x5'));var config=require(_0x6de4('0x6'));var attributes=require(_0x6de4('0x7'));module[_0x6de4('0x8')]=function(_0x525dcc,_0x47eb32){return _0x525dcc[_0x6de4('0x9')]('MailApplication',attributes,{'tableName':_0x6de4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6de4('0xb'),'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 f6782cd..49be760 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 _0x7809=['MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailApplication','update','body','options','raw','where','attributes','limit','debug','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x124c75,_0x1b3a4){var _0x474b15=function(_0x418347){while(--_0x418347){_0x124c75['push'](_0x124c75['shift']());}};_0x474b15(++_0x1b3a4);}(_0x7809,0x1d4));var _0x9780=function(_0x682a4c,_0x154823){_0x682a4c=_0x682a4c-0x0;var _0x4d70e0=_0x7809[_0x682a4c];return _0x4d70e0;};'use strict';var _=require('lodash');var util=require(_0x9780('0x0'));var moment=require(_0x9780('0x1'));var BPromise=require(_0x9780('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9780('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9780('0x4'));var logger=require(_0x9780('0x5'))(_0x9780('0x6'));var config=require(_0x9780('0x7'));var jayson=require(_0x9780('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19ad3e,_0x16e742,_0x3c3022){return new BPromise(function(_0x16b328,_0x3b99ec){return client[_0x9780('0x9')](_0x19ad3e,_0x3c3022)[_0x9780('0xa')](function(_0x38c2fd){logger[_0x9780('0xb')](_0x9780('0xc'),_0x16e742,_0x9780('0xd'));logger['debug'](_0x9780('0xe'),_0x16e742,'request\x20sent',JSON[_0x9780('0xf')](_0x38c2fd));if(_0x38c2fd[_0x9780('0x10')]){if(_0x38c2fd[_0x9780('0x10')][_0x9780('0x11')]===0x1f4){logger[_0x9780('0x10')](_0x9780('0xc'),_0x16e742,_0x38c2fd[_0x9780('0x10')][_0x9780('0x12')]);return _0x3b99ec(_0x38c2fd[_0x9780('0x10')]['message']);}logger['error'](_0x9780('0xc'),_0x16e742,_0x38c2fd[_0x9780('0x10')][_0x9780('0x12')]);return _0x16b328(_0x38c2fd[_0x9780('0x10')]['message']);}else{logger[_0x9780('0xb')](_0x9780('0xc'),_0x16e742,_0x9780('0xd'));_0x16b328(_0x38c2fd[_0x9780('0x13')][_0x9780('0x12')]);}})['catch'](function(_0x5a79e6){logger[_0x9780('0x10')](_0x9780('0xc'),_0x16e742,_0x5a79e6);_0x3b99ec(_0x5a79e6);});});}exports[_0x9780('0x14')]=function(_0xc40d3c){var _0xa92555=this;return new Promise(function(_0x4ce11e,_0x22b0d0){return db['MailApplication'][_0x9780('0x15')](_0xc40d3c[_0x9780('0x16')],{'raw':_0xc40d3c[_0x9780('0x17')]?_0xc40d3c['options'][_0x9780('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc40d3c[_0x9780('0x17')]?_0xc40d3c[_0x9780('0x17')][_0x9780('0x19')]||null:null,'attributes':_0xc40d3c[_0x9780('0x17')]?_0xc40d3c[_0x9780('0x17')][_0x9780('0x1a')]||null:null,'limit':_0xc40d3c[_0x9780('0x17')]?_0xc40d3c[_0x9780('0x17')][_0x9780('0x1b')]||null:null})[_0x9780('0xa')](function(_0x376588){logger[_0x9780('0xb')]('UpdateMailApplication',_0xc40d3c);logger[_0x9780('0x1c')](_0x9780('0x14'),_0xc40d3c,JSON[_0x9780('0xf')](_0x376588));_0x4ce11e(_0x376588);})[_0x9780('0x1d')](function(_0x5be06a){logger[_0x9780('0x10')](_0x9780('0x14'),_0x5be06a['message'],_0xc40d3c);_0x22b0d0(_0xa92555[_0x9780('0x10')](0x1f4,_0x5be06a[_0x9780('0x12')]));});});}; \ No newline at end of file +var _0x7db2=['attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','UpdateMailApplication','body','options'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0x7db2,0x16a));var _0x27db=function(_0x16f856,_0xd09bc3){_0x16f856=_0x16f856-0x0;var _0x30e6a7=_0x7db2[_0x16f856];return _0x30e6a7;};'use strict';var _=require(_0x27db('0x0'));var util=require(_0x27db('0x1'));var moment=require(_0x27db('0x2'));var BPromise=require(_0x27db('0x3'));var rs=require(_0x27db('0x4'));var fs=require('fs');var Redis=require(_0x27db('0x5'));var db=require(_0x27db('0x6'))['db'];var utils=require(_0x27db('0x7'));var logger=require(_0x27db('0x8'))(_0x27db('0x9'));var config=require(_0x27db('0xa'));var jayson=require(_0x27db('0xb'));var client=jayson[_0x27db('0xc')][_0x27db('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x313e9c,_0x562b1d,_0x65c70e){return new BPromise(function(_0x227adf,_0x25e56f){return client[_0x27db('0xe')](_0x313e9c,_0x65c70e)[_0x27db('0xf')](function(_0x12d72b){logger['info'](_0x27db('0x10'),_0x562b1d,'request\x20sent');logger[_0x27db('0x11')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x562b1d,'request\x20sent',JSON[_0x27db('0x12')](_0x12d72b));if(_0x12d72b[_0x27db('0x13')]){if(_0x12d72b[_0x27db('0x13')][_0x27db('0x14')]===0x1f4){logger[_0x27db('0x13')]('MailApplication,\x20%s,\x20%s',_0x562b1d,_0x12d72b[_0x27db('0x13')][_0x27db('0x15')]);return _0x25e56f(_0x12d72b[_0x27db('0x13')]['message']);}logger[_0x27db('0x13')](_0x27db('0x10'),_0x562b1d,_0x12d72b['error'][_0x27db('0x15')]);return _0x227adf(_0x12d72b[_0x27db('0x13')][_0x27db('0x15')]);}else{logger[_0x27db('0x16')](_0x27db('0x10'),_0x562b1d,_0x27db('0x17'));_0x227adf(_0x12d72b[_0x27db('0x18')][_0x27db('0x15')]);}})['catch'](function(_0x17ba8e){logger[_0x27db('0x13')](_0x27db('0x10'),_0x562b1d,_0x17ba8e);_0x25e56f(_0x17ba8e);});});}exports[_0x27db('0x19')]=function(_0x1d390c){var _0x2c439e=this;return new Promise(function(_0x1c2b3d,_0x3af8aa){return db['MailApplication']['update'](_0x1d390c[_0x27db('0x1a')],{'raw':_0x1d390c[_0x27db('0x1b')]?_0x1d390c[_0x27db('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d390c[_0x27db('0x1b')]?_0x1d390c[_0x27db('0x1b')]['where']||null:null,'attributes':_0x1d390c[_0x27db('0x1b')]?_0x1d390c[_0x27db('0x1b')][_0x27db('0x1c')]||null:null,'limit':_0x1d390c['options']?_0x1d390c[_0x27db('0x1b')]['limit']||null:null})['then'](function(_0x2515de){logger[_0x27db('0x16')](_0x27db('0x19'),_0x1d390c);logger['debug'](_0x27db('0x19'),_0x1d390c,JSON[_0x27db('0x12')](_0x2515de));_0x1c2b3d(_0x2515de);})[_0x27db('0x1d')](function(_0x584fb9){logger[_0x27db('0x13')](_0x27db('0x19'),_0x584fb9[_0x27db('0x15')],_0x1d390c);_0x3af8aa(_0x2c439e[_0x27db('0x13')](0x1f4,_0x584fb9[_0x27db('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index b7729b1..3158180 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 _0x7768=['tracked','mail','mailinteraction:addtags','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags'];(function(_0x5e1e25,_0xdc1421){var _0x548e5f=function(_0x576360){while(--_0x576360){_0x5e1e25['push'](_0x5e1e25['shift']());}};_0x548e5f(++_0xdc1421);}(_0x7768,0x1ea));var _0x8776=function(_0x53343c,_0x4e7f71){_0x53343c=_0x53343c-0x0;var _0x16bbb8=_0x7768[_0x53343c];return _0x16bbb8;};'use strict';var multer=require(_0x8776('0x0'));var util=require(_0x8776('0x1'));var path=require(_0x8776('0x2'));var timeout=require(_0x8776('0x3'));var express=require(_0x8776('0x4'));var router=express[_0x8776('0x5')]();var auth=require(_0x8776('0x6'));var interaction=require(_0x8776('0x7'));var config=require('../../config/environment');var controller=require(_0x8776('0x8'));router[_0x8776('0x9')]('/',auth[_0x8776('0xa')](),controller[_0x8776('0xb')]);router['get'](_0x8776('0xc'),auth[_0x8776('0xa')](),controller[_0x8776('0xd')]);router[_0x8776('0x9')](_0x8776('0xe'),auth[_0x8776('0xa')](),controller[_0x8776('0xf')]);router[_0x8776('0x9')](_0x8776('0x10'),auth[_0x8776('0xa')](),controller[_0x8776('0x11')]);router['get'](_0x8776('0x12'),auth[_0x8776('0xa')](),controller['download']);router[_0x8776('0x13')]('/',auth[_0x8776('0xa')](),controller['create']);router[_0x8776('0x13')](_0x8776('0x10'),auth['isAuthenticated'](),controller[_0x8776('0x14')]);router[_0x8776('0x13')](_0x8776('0x15'),auth['isAuthenticated'](),interaction[_0x8776('0x16')](_0x8776('0x17'),_0x8776('0x18')),controller['addTags']);router['put']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x8776('0x17'),_0x8776('0x19')),controller[_0x8776('0x1a')]);router[_0x8776('0x1b')](_0x8776('0xe'),auth[_0x8776('0xa')](),interaction['tracked'](_0x8776('0x17'),_0x8776('0x1c')),controller[_0x8776('0x1d')]);router[_0x8776('0x1b')](_0x8776('0x15'),auth[_0x8776('0xa')](),controller[_0x8776('0x1e')]);module[_0x8776('0x1f')]=router; \ No newline at end of file +var _0x415a=['path','connect-timeout','express','Router','../../config/environment','./mailInteraction.controller','get','index','/describe','describe','show','/:id/messages','isAuthenticated','getMessages','/:id/download','download','post','create','/:id/tags','mailinteraction:addtags','put','/:id','tracked','update','delete','mail','mailinteraction:destroy','destroy','exports','util'];(function(_0x2ca200,_0x5d3742){var _0x577389=function(_0x2aea6a){while(--_0x2aea6a){_0x2ca200['push'](_0x2ca200['shift']());}};_0x577389(++_0x5d3742);}(_0x415a,0x1df));var _0xa415=function(_0x2ca37a,_0x392cff){_0x2ca37a=_0x2ca37a-0x0;var _0xb1047f=_0x415a[_0x2ca37a];return _0xb1047f;};'use strict';var multer=require('multer');var util=require(_0xa415('0x0'));var path=require(_0xa415('0x1'));var timeout=require(_0xa415('0x2'));var express=require(_0xa415('0x3'));var router=express[_0xa415('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa415('0x5'));var controller=require(_0xa415('0x6'));router[_0xa415('0x7')]('/',auth['isAuthenticated'](),controller[_0xa415('0x8')]);router[_0xa415('0x7')](_0xa415('0x9'),auth['isAuthenticated'](),controller[_0xa415('0xa')]);router[_0xa415('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xa415('0xb')]);router[_0xa415('0x7')](_0xa415('0xc'),auth[_0xa415('0xd')](),controller[_0xa415('0xe')]);router['get'](_0xa415('0xf'),auth[_0xa415('0xd')](),controller[_0xa415('0x10')]);router[_0xa415('0x11')]('/',auth['isAuthenticated'](),controller[_0xa415('0x12')]);router['post'](_0xa415('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0xa415('0x11')](_0xa415('0x13'),auth[_0xa415('0xd')](),interaction['tracked']('mail',_0xa415('0x14')),controller['addTags']);router[_0xa415('0x15')](_0xa415('0x16'),auth['isAuthenticated'](),interaction[_0xa415('0x17')]('mail','mailinteraction:update'),controller[_0xa415('0x18')]);router[_0xa415('0x19')](_0xa415('0x16'),auth[_0xa415('0xd')](),interaction[_0xa415('0x17')](_0xa415('0x1a'),_0xa415('0x1b')),controller[_0xa415('0x1c')]);router[_0xa415('0x19')](_0xa415('0x13'),auth[_0xa415('0xd')](),controller['removeTags']);module[_0xa415('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 40dcb86..b98c232 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 _0xdb8b=['DATE','STRING','TEXT','ENUM','long','sequelize','iconv','BOOLEAN'];(function(_0x2514ef,_0x27674a){var _0x13751c=function(_0x29036c){while(--_0x29036c){_0x2514ef['push'](_0x2514ef['shift']());}};_0x13751c(++_0x27674a);}(_0xdb8b,0x145));var _0xbdb8=function(_0x3eeccb,_0x92073a){_0x3eeccb=_0x3eeccb-0x0;var _0x556764=_0xdb8b[_0x3eeccb];return _0x556764;};'use strict';var Sequelize=require(_0xbdb8('0x0'));var iconv=require(_0xbdb8('0x1'));module['exports']={'closed':{'type':Sequelize[_0xbdb8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbdb8('0x3')]},'disposition':{'type':Sequelize[_0xbdb8('0x4')]},'note':{'type':Sequelize[_0xbdb8('0x4')]},'inReplyTo':{'type':Sequelize[_0xbdb8('0x4')](0x1fe)},'to':{'type':Sequelize[_0xbdb8('0x4')]},'cc':{'type':Sequelize[_0xbdb8('0x5')]('long')},'subject':{'type':Sequelize[_0xbdb8('0x5')]()},'attach':{'type':Sequelize[_0xbdb8('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xbdb8('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xbdb8('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbdb8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xbdb8('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xbdb8('0x5')]('long')},'lastMsgText':{'type':Sequelize['TEXT'](_0xbdb8('0x7'))}}; \ No newline at end of file +var _0xac43=['TEXT','long','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING'];(function(_0x50709f,_0x471e8a){var _0x8cfd9=function(_0x2b3557){while(--_0x2b3557){_0x50709f['push'](_0x50709f['shift']());}};_0x8cfd9(++_0x471e8a);}(_0xac43,0xfe));var _0x3ac4=function(_0x4d6b3d,_0x1097d5){_0x4d6b3d=_0x4d6b3d-0x0;var _0x42037f=_0xac43[_0x4d6b3d];return _0x42037f;};'use strict';var Sequelize=require(_0x3ac4('0x0'));var iconv=require(_0x3ac4('0x1'));module[_0x3ac4('0x2')]={'closed':{'type':Sequelize[_0x3ac4('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3ac4('0x4')]},'disposition':{'type':Sequelize[_0x3ac4('0x5')]},'note':{'type':Sequelize[_0x3ac4('0x5')]},'inReplyTo':{'type':Sequelize[_0x3ac4('0x5')](0x1fe)},'to':{'type':Sequelize[_0x3ac4('0x5')]},'cc':{'type':Sequelize[_0x3ac4('0x6')](_0x3ac4('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x3ac4('0x4')]},'substatus':{'type':Sequelize[_0x3ac4('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x3ac4('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3ac4('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3ac4('0x8')]('in',_0x3ac4('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x3ac4('0x6')](_0x3ac4('0x7'))},'lastMsgText':{'type':Sequelize[_0x3ac4('0x6')](_0x3ac4('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 924c600..caf59f6 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 _0x3f59=['Setting','findOne','enableEmailPreview','all','rows','catch','show','params','intersection','include','merge','options','create','body','update','describe','addMessage','MailMessage','omit','ids','getMessages','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','spread','mailInteractionTags:save','removeTags','download','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','Attachments','Messages','bcc','subject','mkdirSync','headers','Bcc','existsSync','build','log','unlinkSync','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','map','fullname','TagIds','Tags','forEach','push','lastMsgBody','lastMsgText','fromString','index','rawAttributes','fieldName','key','keys','query','filters','model','attributes','fields','length','nolimit','sort','pick','select','field','color','from','tools_tags','u.id','ui.MailInteractionId','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','left_join','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','split','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','start','compact','where','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','clone','order','DESC','isEmpty','t.id\x20IN\x20?','resolve','MailAccountId','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','toString','sequelize','keyBy','MailInteraction','a.key','Account.key','i.createdAt','i.updatedAt','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId'];(function(_0x4a5996,_0x1c74f2){var _0xb58811=function(_0x3c8ad9){while(--_0x3c8ad9){_0x4a5996['push'](_0x4a5996['shift']());}};_0xb58811(++_0x1c74f2);}(_0x3f59,0x118));var _0x93f5=function(_0x4c2b56,_0x565c1f){_0x4c2b56=_0x4c2b56-0x0;var _0x4cfc1b=_0x3f59[_0x4c2b56];return _0x4cfc1b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x93f5('0x0'));var zipdir=require(_0x93f5('0x1'));var jsonpatch=require(_0x93f5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x93f5('0x3'));var Mustache=require(_0x93f5('0x4'));var util=require(_0x93f5('0x5'));var path=require('path');var sox=require(_0x93f5('0x6'));var csv=require(_0x93f5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x93f5('0x8'));var squel=require('squel');var crypto=require(_0x93f5('0x9'));var jsforce=require(_0x93f5('0xa'));var deskjs=require(_0x93f5('0xb'));var toCsv=require('to-csv');var querystring=require(_0x93f5('0xc'));var Papa=require(_0x93f5('0xd'));var htmlToText=require(_0x93f5('0xe'));var Redis=require(_0x93f5('0xf'));var authService=require(_0x93f5('0x10'));var qs=require(_0x93f5('0x11'));var as=require(_0x93f5('0x12'));var hardwareService=require(_0x93f5('0x13'));var logger=require(_0x93f5('0x14'))(_0x93f5('0x15'));var utils=require(_0x93f5('0x16'));var config=require(_0x93f5('0x17'));var db=require(_0x93f5('0x18'))['db'];config['redis']=_[_0x93f5('0x19')](config[_0x93f5('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x93f5('0x1b'))(new Redis(config[_0x93f5('0x1a')]));require(_0x93f5('0x1c'))[_0x93f5('0x1d')](socket);function respondWithStatusCode(_0x327b52,_0x456ce3){_0x456ce3=_0x456ce3||0xcc;return function(_0x18b2f4){if(_0x18b2f4){return _0x327b52[_0x93f5('0x1e')](_0x456ce3);}return _0x327b52['status'](_0x456ce3)[_0x93f5('0x1f')]();};}function respondWithResult(_0x3ca9c7,_0x395953){_0x395953=_0x395953||0xc8;return function(_0x10d164){if(_0x10d164){return _0x3ca9c7[_0x93f5('0x20')](_0x395953)[_0x93f5('0x21')](_0x10d164);}};}function respondWithFilteredResult(_0x1c7e09,_0x46ef24){return function(_0x120da6){if(_0x120da6){var _0x51ea3c=_0x120da6[_0x93f5('0x22')],_0x28234a=_0x46ef24[_0x93f5('0x23')],_0x11ea26=_0x46ef24['offset']+_0x46ef24[_0x93f5('0x24')],_0x21e249;if(_0x11ea26>=_0x51ea3c){_0x11ea26=_0x51ea3c;_0x21e249=0xc8;}else{_0x21e249=0xce;}_0x1c7e09[_0x93f5('0x20')](_0x21e249);return _0x1c7e09[_0x93f5('0x25')](_0x93f5('0x26'),_0x28234a+'-'+_0x11ea26+'/'+_0x51ea3c)[_0x93f5('0x21')](_0x120da6);}return null;};}function patchUpdates(_0x5d1ab5){return function(_0x3da960){try{jsonpatch['apply'](_0x3da960,_0x5d1ab5,!![]);}catch(_0x4cafd9){return BPromise[_0x93f5('0x27')](_0x4cafd9);}return _0x3da960[_0x93f5('0x28')]();};}function saveUpdates(_0x2e86fa,_0x909c05){return function(_0xee79fb){if(_0xee79fb){return _0xee79fb['update'](_0x2e86fa)[_0x93f5('0x29')](function(_0x2616c9){return _0x2616c9;});}return null;};}function removeEntity(_0x2ab6bb,_0x4fcf9e){return function(_0x4367e3){if(_0x4367e3){return _0x4367e3[_0x93f5('0x2a')]()[_0x93f5('0x29')](function(){_0x2ab6bb[_0x93f5('0x20')](0xcc)[_0x93f5('0x1f')]();});}};}function handleEntityNotFound(_0x55ce49,_0xc7599f){return function(_0x2f7601){if(!_0x2f7601){_0x55ce49[_0x93f5('0x1e')](0x194);}return _0x2f7601;};}function handleError(_0x314a40,_0xa0047){_0xa0047=_0xa0047||0x1f4;return function(_0x35d209){logger[_0x93f5('0x2b')](_0x35d209['stack']);if(_0x35d209[_0x93f5('0x2c')]){delete _0x35d209[_0x93f5('0x2c')];}_0x314a40[_0x93f5('0x20')](_0xa0047)[_0x93f5('0x2d')](_0x35d209);};}function getInteractionUsers(_0xab2e3d,_0x1f4558){return new BPromise(function(_0x65b3df,_0x1bfbb0){try{if(_0x1f4558[_0xab2e3d['id']]){_0xab2e3d['Users']=_[_0x93f5('0x2e')](_0x1f4558[_0xab2e3d['id']],function(_0x499fa7){return{'id':_0x499fa7['id'],'fullname':_0x499fa7[_0x93f5('0x2f')]};});}}catch(_0xec35d2){_0x1bfbb0(_0xec35d2);}_0x65b3df(_0xab2e3d);});}function getInteractionTags(_0x1f4e5d,_0x4e02d3){return new BPromise(function(_0x2a78d7,_0x271916){try{if(_0x1f4e5d[_0x93f5('0x30')]){_0x1f4e5d[_0x93f5('0x31')]=[];_0x1f4e5d[_0x93f5('0x30')]['split'](',')[_0x93f5('0x32')](function(_0x5077c1){_0x1f4e5d[_0x93f5('0x31')][_0x93f5('0x33')](_0x4e02d3[_0x5077c1]);});}delete _0x1f4e5d[_0x93f5('0x30')];}catch(_0x138fbb){_0x271916(_0x138fbb);}_0x2a78d7(_0x1f4e5d);});}function getLastMessageText(_0x4f9330){return new BPromise(function(_0x402d69,_0x591b38){return db['MailInteraction']['findOne']({'where':{'id':_0x4f9330['id']},'attributes':[_0x93f5('0x34'),_0x93f5('0x35')],'raw':!![]})[_0x93f5('0x29')](function(_0xa8391a){if(!_0xa8391a[_0x93f5('0x35')]){_0x4f9330[_0x93f5('0x35')]=_['trimStart'](htmlToText[_0x93f5('0x36')](_0xa8391a[_0x93f5('0x34')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x4f9330['lastMsgText']=_0xa8391a['lastMsgText'];}_0x402d69(_0x4f9330);})['catch'](function(_0x187b1f){_0x591b38(_0x187b1f);});});}function updateMailInteraction(_0x4742f2,_0x524481,_0x384e23,_0xe7cfd){return new BPromise(function(_0x392dd7,_0x3954c4){return getInteractionUsers(_0x4742f2,_0x384e23)[_0x93f5('0x29')](function(_0xcdbac9){return getInteractionTags(_0xcdbac9,_0x524481);})[_0x93f5('0x29')](function(_0x1afa78){if(_0xe7cfd){_0x392dd7(getLastMessageText(_0x1afa78));}else{_0x392dd7(_0x1afa78);}})['catch'](function(_0x3b438f){_0x3954c4(_0x3b438f);});});}exports[_0x93f5('0x37')]=function(_0x129fa,_0x56e706){var _0x50a73a={},_0x56867c={},_0x6c8dd5={'count':0x0,'rows':[]};var _0x1ea1bc=_[_0x93f5('0x2e')](db['MailInteraction'][_0x93f5('0x38')],function(_0x3ad55f){return{'name':_0x3ad55f[_0x93f5('0x39')],'type':_0x3ad55f['type'][_0x93f5('0x3a')]};});_0x56867c['model']=_[_0x93f5('0x2e')](_0x1ea1bc,_0x93f5('0x2c'));_0x56867c['query']=_[_0x93f5('0x3b')](_0x129fa[_0x93f5('0x3c')]);_0x56867c[_0x93f5('0x3d')]=_['intersection'](_0x56867c[_0x93f5('0x3e')],_0x56867c[_0x93f5('0x3c')]);_0x50a73a[_0x93f5('0x3f')]=_['intersection'](_0x56867c['model'],qs['fields'](_0x129fa[_0x93f5('0x3c')][_0x93f5('0x40')]));_0x50a73a[_0x93f5('0x3f')]=_0x50a73a[_0x93f5('0x3f')][_0x93f5('0x41')]?_0x50a73a[_0x93f5('0x3f')]:_0x56867c[_0x93f5('0x3e')];if(!_0x129fa['query']['hasOwnProperty'](_0x93f5('0x42'))){_0x50a73a['limit']=qs['limit'](_0x129fa[_0x93f5('0x3c')]['limit']);_0x50a73a[_0x93f5('0x23')]=qs[_0x93f5('0x23')](_0x129fa[_0x93f5('0x3c')][_0x93f5('0x23')]);}_0x50a73a['order']=qs[_0x93f5('0x43')](_0x129fa[_0x93f5('0x3c')]['sort']);_0x50a73a['where']=qs[_0x93f5('0x3d')](_[_0x93f5('0x44')](_0x129fa[_0x93f5('0x3c')],_0x56867c[_0x93f5('0x3d')]));var _0x3e7ee5=[];var _0x17a532=squel[_0x93f5('0x45')]()[_0x93f5('0x46')]('id')['field'](_0x93f5('0x2c'))[_0x93f5('0x46')](_0x93f5('0x47'))[_0x93f5('0x48')](_0x93f5('0x49'));var _0x958f86=squel[_0x93f5('0x45')]()[_0x93f5('0x46')](_0x93f5('0x4a'))[_0x93f5('0x46')]('u.fullname')[_0x93f5('0x46')](_0x93f5('0x4b'))[_0x93f5('0x48')]('user_has_mail_interactions','ui')['left_join'](_0x93f5('0x4c'),'u',_0x93f5('0x4d'));var _0x565620=squel['select']()[_0x93f5('0x48')](_0x93f5('0x4e'),'i')['left_join'](_0x93f5('0x4f'),'c',_0x93f5('0x50'))['left_join'](_0x93f5('0x4c'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x93f5('0x51'),'a',_0x93f5('0x52'))[_0x93f5('0x53')](_0x93f5('0x54'),'me',_0x93f5('0x55'))[_0x93f5('0x53')](_0x93f5('0x56'),'it','it.MailInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0x93f5('0x57'));var _0x488a3e=squel[_0x93f5('0x58')]();var _0x13d516=[];var _0xc738e3=squel[_0x93f5('0x58')]();var _0x1db953;if(_0x129fa[_0x93f5('0x3c')][_0x93f5('0x59')]){_0x1db953=as[_0x93f5('0x5a')](_0x129fa['query']['search']);var _0x4590ef=_0x1db953[_0x93f5('0x5b')];for(var _0x346366=0x0;_0x346366<_0x1db953['conditions'][_0x93f5('0x41')];_0x346366++){var _0x44a287=_0x1db953[_0x93f5('0x5c')][_0x346366];var _0x5b6c35='i';var _0xee0348=_[_0x93f5('0x5d')](_0x1ea1bc,[_0x93f5('0x2c'),_0x44a287[_0x93f5('0x46')]]);if(!_0xee0348){switch(_0x44a287['field']){case _0x93f5('0x5e'):if(_0x44a287[_0x93f5('0x5f')]==0x1){_0x565620[_0x93f5('0x60')]('`'+_0x44a287[_0x93f5('0x46')]+_0x93f5('0x61'));}else{_0x565620[_0x93f5('0x60')]('`'+_0x44a287[_0x93f5('0x46')]+_0x93f5('0x62'));}break;case'Contact':if(_0x44a287[_0x93f5('0x63')]==='$substring'){if(_0x44a287[_0x93f5('0x5f')][_0x93f5('0x64')]('\x20')['length']>0x1){_0x488a3e[_0x4590ef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x44a287['value']),null);}else{var _0x523e73='%'+_0x44a287[_0x93f5('0x5f')]+'%';_0x488a3e[_0x4590ef]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x523e73,_0x523e73,_0x523e73);}}else{_0xee0348=_[_0x93f5('0x5d')](_0x1ea1bc,[_0x93f5('0x2c'),_0x93f5('0x65')]);_0x44a287[_0x93f5('0x46')]='ContactId';_0x1052a7=as[_0x93f5('0x66')](_0x5b6c35,_0xee0348['type'],_0x44a287);_0x488a3e[_0x4590ef](_0x1052a7[_0x93f5('0x67')],_0x1052a7[_0x93f5('0x5f')]['start'],_0x1052a7[_0x93f5('0x5f')][_0x93f5('0x1f')]);}break;case _0x93f5('0x68'):var _0x56a304=_0x44a287[_0x93f5('0x5f')][_0x93f5('0x64')](',')[_0x93f5('0x2e')](function(_0x9c5c4d){return Number(_0x9c5c4d);});_0x56a304['forEach'](function(_0x43d423){_0xc738e3['or'](_0x93f5('0x69'),'%,'+_0x43d423+',%');});_0x13d516=_['union'](_0x13d516,_0x56a304);break;case _0x93f5('0x6a'):if(_0x44a287[_0x93f5('0x63')]==='$substring'){_0x488a3e[_0x4590ef](_0x93f5('0x6b'),'%'+_0x44a287['value']+'%',null);}else{_0xee0348=_[_0x93f5('0x5d')](_0x1ea1bc,[_0x93f5('0x2c'),_0x93f5('0x6c')]);_0x44a287[_0x93f5('0x46')]=_0x93f5('0x6c');_0x1052a7=as[_0x93f5('0x66')](_0x5b6c35,_0xee0348[_0x93f5('0x6d')],_0x44a287);_0x488a3e[_0x4590ef](_0x1052a7['text'],_0x1052a7[_0x93f5('0x5f')][_0x93f5('0x6e')],_0x1052a7[_0x93f5('0x5f')]['end']);}break;case'plainBody':_0x1052a7=as[_0x93f5('0x66')]('me',null,_0x44a287);_0x488a3e[_0x4590ef](_0x1052a7[_0x93f5('0x67')],_0x1052a7[_0x93f5('0x5f')][_0x93f5('0x6e')],_0x1052a7[_0x93f5('0x5f')][_0x93f5('0x1f')]);break;}}else{var _0x1052a7=as[_0x93f5('0x66')](_0x5b6c35,_0xee0348[_0x93f5('0x6d')],_0x44a287);_0x488a3e[_0x4590ef](_0x1052a7[_0x93f5('0x67')],_0x1052a7['value'][_0x93f5('0x6e')],_0x1052a7[_0x93f5('0x5f')][_0x93f5('0x1f')]);}}}else{var _0xfabef5=_(_0x129fa[_0x93f5('0x3c')])[_0x93f5('0x3b')]()[_0x93f5('0x2e')](function(_0x258fb3){return _['some'](_0x1ea1bc,['name',_0x258fb3])?_0x258fb3:undefined;})[_0x93f5('0x6f')]()[_0x93f5('0x5f')]();if(!_['isEmpty'](_0xfabef5)){_0xfabef5[_0x93f5('0x32')](function(_0x27a904){if(_0x27a904==='MailAccountId'){_0x565620[_0x93f5('0x70')]('i.MailAccountId\x20IN\x20?',[][_0x93f5('0x71')](_0x129fa[_0x93f5('0x3c')][_0x27a904]));}else if(_0x27a904===_0x93f5('0x72')){var _0x124385=JSON[_0x93f5('0x73')](_0x129fa['query'][_0x27a904])[_0x93f5('0x74')];var _0x1133da=JSON[_0x93f5('0x73')](_0x129fa[_0x93f5('0x3c')][_0x27a904])[_0x93f5('0x75')];_0x565620['where'](_0x93f5('0x76'),_0x124385,_0x1133da);}else{if(_0x129fa['query'][_0x27a904]===_0x93f5('0x77')){_0x565620[_0x93f5('0x70')]('i.'+_0x27a904+_0x93f5('0x78'));}else{_0x565620[_0x93f5('0x70')]('i.'+_0x27a904+_0x93f5('0x79'),_0x129fa[_0x93f5('0x3c')][_0x27a904]);}}});}if(_0x129fa[_0x93f5('0x3c')][_0x93f5('0x7a')]){if(_0x129fa['query'][_0x93f5('0x7a')]==0x1){_0x565620['having'](_0x93f5('0x7b'));}else{_0x565620[_0x93f5('0x60')](_0x93f5('0x7c'));}}if(_0x129fa['query']['tag']){_0x13d516=_['isArray'](_0x129fa[_0x93f5('0x3c')][_0x93f5('0x7d')])?_0x129fa['query'][_0x93f5('0x7d')]:new Array(_0x129fa[_0x93f5('0x3c')]['tag']);_0x13d516['forEach'](function(_0x3658ed){_0xc738e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3658ed+',%');});}if(_0x129fa[_0x93f5('0x3c')][_0x93f5('0x7e')]){var _0x1ed623=_0x129fa[_0x93f5('0x3c')][_0x93f5('0x7e')][_0x93f5('0x7f')]('\x5c','\x5c\x5c')[_0x93f5('0x7f')]('\x27\x27',_0x93f5('0x80'));if(qs['isNumeric'](_0x1ed623)){_0x488a3e['or'](_0x93f5('0x81'),_0x1ed623+'%');}else if(qs[_0x93f5('0x82')](_0x1ed623)){_0x488a3e['or'](_0x93f5('0x83'),_0x1ed623+'%');}else{_0x488a3e['or'](_0x93f5('0x84'),qs[_0x93f5('0x85')](_0x1ed623))['or'](_0x93f5('0x86'),qs[_0x93f5('0x85')](_0x1ed623));}}}_0x565620[_0x93f5('0x70')](_0x488a3e);_0x565620['group'](_0x93f5('0x87'));var _0x277cff={'type':db[_0x93f5('0x88')][_0x93f5('0x89')]['SELECT'],'raw':!![]};var _0x343d25=_0x565620[_0x93f5('0x8a')]();_0x343d25['field'](_0x93f5('0x87'));_0x343d25['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x93f5('0x5e'));if(_0x50a73a[_0x93f5('0x8b')]){_0x50a73a[_0x93f5('0x8b')][_0x93f5('0x32')](function(_0x12a25c){_0x565620[_0x93f5('0x8b')]('i.'+_0x12a25c[0x0],_0x12a25c[0x1]===_0x93f5('0x8c')?![]:!![]);});}if(!_[_0x93f5('0x8d')](_0x13d516)){_0x565620[_0x93f5('0x60')](_0xc738e3);_0x343d25[_0x93f5('0x70')](_0x93f5('0x8e'),_0x13d516);}BPromise[_0x93f5('0x8f')]()[_0x93f5('0x29')](function(){if(!_0x1db953){if(_0x129fa[_0x93f5('0x3c')][_0x93f5('0x90')]||_0x129fa['query'][_0x93f5('0x91')])return;_0x343d25['where'](_0x93f5('0x92'));_0x565620[_0x93f5('0x70')](_0x93f5('0x92'));return;}return _0x129fa[_0x93f5('0x93')][_0x93f5('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3c85d9){if(_[_0x93f5('0x8d')](_0x3c85d9)){_0x343d25['where'](_0x93f5('0x95'));_0x565620['where'](_0x93f5('0x95'));}else{_0x343d25[_0x93f5('0x70')](_0x93f5('0x96'),_[_0x93f5('0x2e')](_0x3c85d9,'id'));_0x565620[_0x93f5('0x70')](_0x93f5('0x96'),_[_0x93f5('0x2e')](_0x3c85d9,'id'));}});})[_0x93f5('0x29')](function(){db['sequelize'][_0x93f5('0x3c')](_0x343d25[_0x93f5('0x97')](),_0x277cff)[_0x93f5('0x29')](function(_0x5ca255){_0x6c8dd5['count']=_0x5ca255[_0x93f5('0x41')];if(_0x6c8dd5[_0x93f5('0x22')]===0x0)return[];return db[_0x93f5('0x98')]['query'](_0x17a532[_0x93f5('0x97')](),_0x277cff)[_0x93f5('0x29')](function(_0x32e00a){_0x3e7ee5=_[_0x93f5('0x99')](_0x32e00a,'id');_0x277cff=_['merge'](_0x277cff,{'model':db[_0x93f5('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x129fa[_0x93f5('0x3c')][_0x93f5('0x40')]){_0x50a73a[_0x93f5('0x3f')][_0x93f5('0x32')](function(_0xa534f7){_0x565620['field']('i.'+_0xa534f7);});}else{_0x565620['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x93f5('0x5e'));_0x565620[_0x93f5('0x46')](_0x93f5('0x9b'),_0x93f5('0x9c'));_0x565620[_0x93f5('0x46')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x565620[_0x93f5('0x46')](_0x93f5('0x87'));_0x565620[_0x93f5('0x46')](_0x93f5('0x9d'));_0x565620[_0x93f5('0x46')](_0x93f5('0x9e'));_0x565620['field']('i.closed');_0x565620['field'](_0x93f5('0x9f'));_0x565620[_0x93f5('0x46')]('i.attach');_0x565620[_0x93f5('0x46')](_0x93f5('0xa0'));_0x565620[_0x93f5('0x46')](_0x93f5('0xa1'));_0x565620['field'](_0x93f5('0xa2'));_0x565620[_0x93f5('0x46')](_0x93f5('0xa3'));_0x565620[_0x93f5('0x46')]('i.substatus');_0x565620['field'](_0x93f5('0xa4'));_0x565620[_0x93f5('0x46')](_0x93f5('0xa5'));_0x565620['field'](_0x93f5('0xa6'));_0x565620[_0x93f5('0x46')](_0x93f5('0xa7'));_0x565620[_0x93f5('0x46')](_0x93f5('0xa8'),_0x93f5('0xa9'));_0x565620['field'](_0x93f5('0xaa'),_0x93f5('0xab'));_0x565620[_0x93f5('0x46')](_0x93f5('0xac'),'Contact.email');_0x565620[_0x93f5('0x46')]('c.phone','Contact.phone');_0x565620['field']('c.mobile',_0x93f5('0xad'));_0x565620['field']('c.fax',_0x93f5('0xae'));_0x565620['field'](_0x93f5('0xaf'),_0x93f5('0xb0'));_0x565620['field'](_0x93f5('0xb1'),_0x93f5('0xb2'));_0x565620[_0x93f5('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x93f5('0x30'));}_0x565620['limit'](_0x50a73a['limit']);_0x565620[_0x93f5('0x23')](_0x50a73a[_0x93f5('0x23')]);return db['sequelize']['query'](_0x565620[_0x93f5('0x97')](),_0x277cff);})[_0x93f5('0x29')](function(_0x324d82){_0x958f86[_0x93f5('0x70')](_0x93f5('0xb3'),_[_0x93f5('0x2e')](_0x324d82,'id'));return db[_0x93f5('0x98')][_0x93f5('0x3c')](_0x958f86['toString'](),_0x277cff)[_0x93f5('0x29')](function(_0x16f288){var _0x51fd8c=_[_0x93f5('0xb4')](_0x16f288,_0x93f5('0xb5'));var _0x56f20d=[];return db[_0x93f5('0xb6')][_0x93f5('0xb7')]({'attributes':[_0x93f5('0xb8')],'raw':!![]})[_0x93f5('0x29')](function(_0x2c97e3){var _0x7d273e=_0x2c97e3['enableEmailPreview'];_0x324d82['forEach'](function(_0x36d402){_0x56f20d[_0x93f5('0x33')](updateMailInteraction(_0x36d402,_0x3e7ee5,_0x51fd8c,_0x7d273e));});return BPromise[_0x93f5('0xb9')](_0x56f20d);});});});})[_0x93f5('0x29')](function(_0x404af3){_0x6c8dd5[_0x93f5('0xba')]=_0x404af3;return _0x6c8dd5;})['then'](respondWithFilteredResult(_0x56e706,_0x50a73a));})[_0x93f5('0xbb')](handleError(_0x56e706,null));};exports[_0x93f5('0xbc')]=function(_0x273f1c,_0x3d3c73){var _0x2f3457={'raw':![],'where':{'id':_0x273f1c[_0x93f5('0xbd')]['id']}},_0x103206={};_0x103206[_0x93f5('0x3e')]=_[_0x93f5('0x3b')](db['MailInteraction']['rawAttributes']);_0x103206[_0x93f5('0x3c')]=_['keys'](_0x273f1c[_0x93f5('0x3c')]);_0x103206[_0x93f5('0x3d')]=_[_0x93f5('0xbe')](_0x103206[_0x93f5('0x3e')],_0x103206[_0x93f5('0x3c')]);_0x2f3457['attributes']=_['intersection'](_0x103206[_0x93f5('0x3e')],qs[_0x93f5('0x40')](_0x273f1c[_0x93f5('0x3c')][_0x93f5('0x40')]));_0x2f3457['attributes']=_0x2f3457[_0x93f5('0x3f')][_0x93f5('0x41')]?_0x2f3457[_0x93f5('0x3f')]:_0x103206[_0x93f5('0x3e')];if(_0x273f1c[_0x93f5('0x3c')]['includeAll']){_0x2f3457[_0x93f5('0xbf')]=[{'all':!![]}];}_0x2f3457=_[_0x93f5('0xc0')]({},_0x2f3457,_0x273f1c[_0x93f5('0xc1')]);return db['MailInteraction'][_0x93f5('0x5d')](_0x2f3457)[_0x93f5('0x29')](handleEntityNotFound(_0x3d3c73,null))[_0x93f5('0x29')](respondWithResult(_0x3d3c73,null))[_0x93f5('0xbb')](handleError(_0x3d3c73,null));};exports[_0x93f5('0xc2')]=function(_0x4e0ce6,_0x2b211f){return db[_0x93f5('0x9a')][_0x93f5('0xc2')](_0x4e0ce6[_0x93f5('0xc3')],{})[_0x93f5('0x29')](respondWithResult(_0x2b211f,0xc9))[_0x93f5('0xbb')](handleError(_0x2b211f,null));};exports[_0x93f5('0xc4')]=function(_0x50a0ea,_0x5d16a5){if(_0x50a0ea['body']['id']){delete _0x50a0ea[_0x93f5('0xc3')]['id'];}return db[_0x93f5('0x9a')][_0x93f5('0x5d')]({'where':{'id':_0x50a0ea[_0x93f5('0xbd')]['id']}})['then'](handleEntityNotFound(_0x5d16a5,null))[_0x93f5('0x29')](saveUpdates(_0x50a0ea[_0x93f5('0xc3')],null))['then'](respondWithResult(_0x5d16a5,null))[_0x93f5('0xbb')](handleError(_0x5d16a5,null));};exports[_0x93f5('0x2a')]=function(_0x22f812,_0x10e216){return db[_0x93f5('0x9a')][_0x93f5('0x5d')]({'where':{'id':_0x22f812[_0x93f5('0xbd')]['id']}})[_0x93f5('0x29')](handleEntityNotFound(_0x10e216,null))[_0x93f5('0x29')](removeEntity(_0x10e216,null))[_0x93f5('0xbb')](handleError(_0x10e216,null));};exports[_0x93f5('0xc5')]=function(_0x13a55d,_0x50881f){return db[_0x93f5('0x9a')][_0x93f5('0xc5')]()[_0x93f5('0x29')](respondWithResult(_0x50881f,null))[_0x93f5('0xbb')](handleError(_0x50881f,null));};exports[_0x93f5('0xc6')]=function(_0x47bf5a,_0xf5b1f2,_0x733120){return db[_0x93f5('0xc7')][_0x93f5('0x5d')]({'where':{'id':_0x47bf5a[_0x93f5('0xbd')]['id']}})[_0x93f5('0x29')](handleEntityNotFound(_0xf5b1f2,null))[_0x93f5('0x29')](function(_0x414967){if(_0x414967){return _0x414967[_0x93f5('0xc6')](_0x47bf5a['body']['ids'],_[_0x93f5('0xc8')](_0x47bf5a[_0x93f5('0xc3')],[_0x93f5('0xc9'),'id'])||{});}})[_0x93f5('0x29')](respondWithResult(_0xf5b1f2,null))[_0x93f5('0xbb')](handleError(_0xf5b1f2,null));};exports[_0x93f5('0xca')]=function(_0x9305d3,_0x3007d2,_0x5ab249){var _0x575d23={'raw':![],'where':{}};var _0x3eff62={};var _0x43d5ce={'count':0x0,'rows':[]};return db[_0x93f5('0x9a')][_0x93f5('0xb7')]({'where':{'id':_0x9305d3['params']['id']}})[_0x93f5('0x29')](handleEntityNotFound(_0x3007d2,null))[_0x93f5('0x29')](function(_0x8a4bf9){if(_0x8a4bf9){_0x3eff62['model']=_[_0x93f5('0x3b')](db['MailMessage'][_0x93f5('0x38')]);_0x3eff62['query']=_[_0x93f5('0x3b')](_0x9305d3[_0x93f5('0x3c')]);_0x3eff62[_0x93f5('0x3d')]=_['intersection'](_0x3eff62[_0x93f5('0x3e')],_0x3eff62[_0x93f5('0x3c')]);_0x575d23[_0x93f5('0x3f')]=_[_0x93f5('0xbe')](_0x3eff62[_0x93f5('0x3e')],qs['fields'](_0x9305d3[_0x93f5('0x3c')][_0x93f5('0x40')]));_0x575d23[_0x93f5('0x3f')]=_0x575d23[_0x93f5('0x3f')][_0x93f5('0x41')]?_0x575d23[_0x93f5('0x3f')]:_0x3eff62[_0x93f5('0x3e')];if(!_0x9305d3[_0x93f5('0x3c')][_0x93f5('0xcb')](_0x93f5('0x42'))){_0x575d23[_0x93f5('0x24')]=qs[_0x93f5('0x24')](_0x9305d3['query']['limit']);_0x575d23['offset']=qs['offset'](_0x9305d3[_0x93f5('0x3c')]['offset']);}_0x575d23[_0x93f5('0x8b')]=qs[_0x93f5('0x43')](_0x9305d3[_0x93f5('0x3c')][_0x93f5('0x43')]);_0x575d23[_0x93f5('0x70')]=qs[_0x93f5('0x3d')](_['pick'](_0x9305d3[_0x93f5('0x3c')],_0x3eff62[_0x93f5('0x3d')]));_0x575d23['where'][_0x93f5('0xb5')]=_0x8a4bf9['id'];if(_0x9305d3['query'][_0x93f5('0x7e')]){_0x575d23[_0x93f5('0x70')]=_[_0x93f5('0xc0')](_0x575d23['where'],{'$or':_['map'](_0x575d23[_0x93f5('0x3f')],function(_0x1a4e1b){var _0x66d439={};_0x66d439[_0x1a4e1b]={'$like':'%'+_0x9305d3['query'][_0x93f5('0x7e')]+'%'};return _0x66d439;})});}if(_0x9305d3['query'][_0x93f5('0x74')]){var _0x3def11=_0x9305d3[_0x93f5('0x3c')]['$gte'][_0x93f5('0x64')](',');var _0x25d8a2={};_0x25d8a2[_0x3def11[0x0]]={'$gte':moment(_0x3def11[0x1])[_0x93f5('0xcc')](_0x93f5('0xcd'))};_0x575d23['where']=_[_0x93f5('0xc0')](_0x575d23[_0x93f5('0x70')],_0x25d8a2);}_0x575d23=_[_0x93f5('0xc0')]({},_0x575d23,_0x9305d3['options']);return db[_0x93f5('0xc7')][_0x93f5('0x22')]({'where':_0x575d23[_0x93f5('0x70')]})[_0x93f5('0x29')](function(_0x237ba5){_0x43d5ce[_0x93f5('0x22')]=_0x237ba5;if(_0x9305d3[_0x93f5('0x3c')][_0x93f5('0xce')]){_0x575d23[_0x93f5('0xbf')]=[{'all':!![]}];}return db[_0x93f5('0xc7')][_0x93f5('0xcf')](_0x575d23);})[_0x93f5('0x29')](function(_0x5b7165){_0x43d5ce[_0x93f5('0xba')]=_0x5b7165;return _0x43d5ce;});}})['then'](respondWithFilteredResult(_0x3007d2,_0x575d23))[_0x93f5('0xbb')](handleError(_0x3007d2,null));};exports[_0x93f5('0xd0')]=function(_0x1030e4,_0x15769c,_0x39488c){return db[_0x93f5('0x9a')][_0x93f5('0x5d')]({'where':{'id':_0x1030e4['params']['id']}})['then'](handleEntityNotFound(_0x15769c,null))[_0x93f5('0x29')](function(_0x12f3e5){if(_0x12f3e5){return _0x12f3e5['setTags'](_0x1030e4[_0x93f5('0xc3')][_0x93f5('0xc9')],_['omit'](_0x1030e4[_0x93f5('0xc3')],[_0x93f5('0xc9'),'id'])||{})[_0x93f5('0xd1')](function(){return db[_0x93f5('0x68')]['findAll']({'attributes':['id',_0x93f5('0x2c'),_0x93f5('0x47')],'where':{'id':_0x1030e4[_0x93f5('0xc3')][_0x93f5('0xc9')]}});})['then'](function(_0x1f8f5a){socket['emit'](_0x93f5('0xd2'),{'id':Number(_0x1030e4[_0x93f5('0xbd')]['id']),'tags':_0x1f8f5a||[]});return{'id':Number(_0x1030e4['params']['id']),'tags':_0x1f8f5a||[]};});}})[_0x93f5('0x29')](respondWithResult(_0x15769c,null))[_0x93f5('0xbb')](handleError(_0x15769c,null));};exports[_0x93f5('0xd3')]=function(_0x366e0d,_0x89b26d,_0x3d7480){return db['MailInteraction'][_0x93f5('0x5d')]({'where':{'id':_0x366e0d[_0x93f5('0xbd')]['id']}})[_0x93f5('0x29')](handleEntityNotFound(_0x89b26d,null))[_0x93f5('0x29')](function(_0x137ef9){if(_0x137ef9){return _0x137ef9[_0x93f5('0xd3')](_0x366e0d[_0x93f5('0x3c')]['ids']);}})['then'](respondWithStatusCode(_0x89b26d,null))[_0x93f5('0xbb')](handleError(_0x89b26d,null));};exports[_0x93f5('0xd4')]=function(_0x2c5ff4,_0x34e4cf){var _0x39e30a=moment()['unix']()[_0x93f5('0x97')]();var _0x234b63=path[_0x93f5('0xd5')](config[_0x93f5('0xd6')],_0x93f5('0xd7'),_0x93f5('0xd8'),_0x93f5('0xd9'));var _0x36e0f4=path[_0x93f5('0xd5')](config['root'],'server',_0x93f5('0xd8'),'attachments');var _0x3cc8f8=path['join'](_0x234b63,_0x39e30a);var _0x41c5ce=util[_0x93f5('0xcc')](_0x93f5('0xda'),_0x2c5ff4[_0x93f5('0xbd')]['id'],_0x39e30a);var _0xd13674=path[_0x93f5('0xd5')](_0x234b63,_0x41c5ce);var _0x1a21b1=[];if(_0x2c5ff4[_0x93f5('0x3c')][_0x93f5('0xdb')]){_0x1a21b1[_0x93f5('0x33')]({'model':db['Attachment'],'as':_0x93f5('0xdc'),'raw':!![]});}var _0x2b6620=[{'model':db['MailMessage'],'as':_0x93f5('0xdd'),'attributes':['id',_0x93f5('0xc3'),_0x93f5('0x48'),'to','cc',_0x93f5('0xde'),_0x93f5('0xdf'),_0x93f5('0x72')],'where':{'secret':![]},'order':qs[_0x93f5('0x43')]('id'),'include':_0x1a21b1}];return db[_0x93f5('0x9a')][_0x93f5('0x5d')]({'where':{'id':_0x2c5ff4['params']['id']},'include':_0x2b6620})['then'](handleEntityNotFound(_0x34e4cf,null))[_0x93f5('0x29')](function(_0x5edb84){if(_0x5edb84&&_0x5edb84['Messages']){var _0x436ade=_0x5edb84['get']({'plain':!![]});fs[_0x93f5('0xe0')](_0x3cc8f8);return BPromise['each'](_0x436ade[_0x93f5('0xdd')],function(_0x2a6023,_0x138a00){var _0x5d6678={'from':_0x2a6023['from'],'to':_0x2a6023['to'],'subject':_0x2a6023[_0x93f5('0xdf')],'html':_0x2a6023[_0x93f5('0xc3')],'headers':{'Date':moment(_0x2a6023[_0x93f5('0x72')])[_0x93f5('0xcc')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x2a6023['cc']){_0x5d6678[_0x93f5('0xe1')]['Cc']=_0x2a6023['cc'];}if(_0x2a6023['bcc']){_0x5d6678[_0x93f5('0xe1')][_0x93f5('0xe2')]=_0x2a6023[_0x93f5('0xde')];}return new BPromise(function(_0x59c8f3,_0x2326fa){if(_0x2a6023[_0x93f5('0xdc')]){for(var _0x266179=0x0;_0x266179<_0x2a6023[_0x93f5('0xdc')][_0x93f5('0x41')];_0x266179++){var _0x2b56a2=_0x2a6023[_0x93f5('0xdc')][_0x266179];var _0x1646ed=path[_0x93f5('0xd5')](_0x36e0f4,_0x2b56a2['basename']);if(fs[_0x93f5('0xe3')](_0x1646ed)){_0x5d6678[_0x93f5('0xdb')][_0x93f5('0x33')]({'name':_0x2b56a2[_0x93f5('0x2c')],'contentType':_0x2b56a2[_0x93f5('0x6d')],'data':fs['readFileSync'](_0x1646ed)});}}}emlformat[_0x93f5('0xe4')](_0x5d6678,function(_0x2978e2,_0x14569b){if(_0x2978e2)return _0x2326fa(_0x2978e2);fs['writeFileSync'](path['join'](_0x3cc8f8,util[_0x93f5('0xcc')]('message%d.eml',_0x138a00)),_0x14569b);return _0x59c8f3(_0x14569b);});});})[_0x93f5('0x29')](function(){return new BPromise(function(_0x37ecf4,_0x2eb175){zipdir(_0x3cc8f8,{'saveTo':_0xd13674},function(_0x1e7332,_0x525875){if(_0x1e7332)return _0x2eb175(_0x1e7332);return _0x37ecf4(_0x525875);});})[_0x93f5('0x29')](function(){return new BPromise(function(_0x8cd4a3,_0x3f0e1c){rimraf(_0x3cc8f8,function(_0x7c5b9a){if(_0x7c5b9a)_0x3f0e1c(_0x7c5b9a);return _0x8cd4a3();});});})[_0x93f5('0x29')](function(){return _0x34e4cf['download'](_0xd13674,_0x41c5ce,function(_0x103541){if(_0x103541){console[_0x93f5('0xe5')]('err',_0x103541);}else{fs[_0x93f5('0xe6')](_0xd13674);}});});});}else{return _0x34e4cf[_0x93f5('0x1e')](0xc8);}})[_0x93f5('0xbb')](handleError(_0x34e4cf,null));}; \ No newline at end of file +var _0x64ea=['DESC','resolve','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.ContactId','i.UserId','c.firstName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','MailInteractionId','enableEmailPreview','push','rows','show','params','includeAll','include','options','body','describe','addMessage','MailMessage','ids','omit','nolimit','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','spread','removeTags','download','join','root','server','files','attachments','format','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','writeFileSync','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','catch','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','color','u.id','u.fullname','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','operator','value','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?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','plainBody','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)'];(function(_0x46c1d5,_0x5ca335){var _0x40fe7b=function(_0x34cb99){while(--_0x34cb99){_0x46c1d5['push'](_0x46c1d5['shift']());}};_0x40fe7b(++_0x5ca335);}(_0x64ea,0x127));var _0xa64e=function(_0x45cd35,_0x41147c){_0x45cd35=_0x45cd35-0x0;var _0x16db84=_0x64ea[_0x45cd35];return _0x16db84;};'use strict';var pdf=require(_0xa64e('0x0'));var emlformat=require(_0xa64e('0x1'));var rimraf=require(_0xa64e('0x2'));var zipdir=require(_0xa64e('0x3'));var jsonpatch=require(_0xa64e('0x4'));var rp=require('request-promise');var moment=require(_0xa64e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa64e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa64e('0x7'));var ejs=require(_0xa64e('0x8'));var fs=require('fs');var _=require(_0xa64e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa64e('0xa'));var deskjs=require(_0xa64e('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa64e('0xc'));var Papa=require(_0xa64e('0xd'));var htmlToText=require(_0xa64e('0xe'));var Redis=require(_0xa64e('0xf'));var authService=require(_0xa64e('0x10'));var qs=require(_0xa64e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa64e('0x12'));var logger=require(_0xa64e('0x13'))('api');var utils=require(_0xa64e('0x14'));var config=require(_0xa64e('0x15'));var db=require(_0xa64e('0x16'))['db'];config[_0xa64e('0x17')]=_[_0xa64e('0x18')](config[_0xa64e('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xa64e('0x19'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x5a3806,_0x440da6){_0x440da6=_0x440da6||0xcc;return function(_0x25fa40){if(_0x25fa40){return _0x5a3806[_0xa64e('0x1a')](_0x440da6);}return _0x5a3806[_0xa64e('0x1b')](_0x440da6)[_0xa64e('0x1c')]();};}function respondWithResult(_0x3ebae8,_0x46f08d){_0x46f08d=_0x46f08d||0xc8;return function(_0x27e01d){if(_0x27e01d){return _0x3ebae8['status'](_0x46f08d)['json'](_0x27e01d);}};}function respondWithFilteredResult(_0x5e90e4,_0x266a58){return function(_0x51c312){if(_0x51c312){var _0x45e2b2=_0x51c312[_0xa64e('0x1d')],_0x4a8ff7=_0x266a58['offset'],_0x45a771=_0x266a58[_0xa64e('0x1e')]+_0x266a58[_0xa64e('0x1f')],_0x4d3103;if(_0x45a771>=_0x45e2b2){_0x45a771=_0x45e2b2;_0x4d3103=0xc8;}else{_0x4d3103=0xce;}_0x5e90e4[_0xa64e('0x1b')](_0x4d3103);return _0x5e90e4[_0xa64e('0x20')](_0xa64e('0x21'),_0x4a8ff7+'-'+_0x45a771+'/'+_0x45e2b2)[_0xa64e('0x22')](_0x51c312);}return null;};}function patchUpdates(_0x2b4457){return function(_0x20f334){try{jsonpatch['apply'](_0x20f334,_0x2b4457,!![]);}catch(_0x3d5cef){return BPromise[_0xa64e('0x23')](_0x3d5cef);}return _0x20f334['save']();};}function saveUpdates(_0x2d3049,_0x474b15){return function(_0x3ee6bc){if(_0x3ee6bc){return _0x3ee6bc['update'](_0x2d3049)[_0xa64e('0x24')](function(_0x2e8380){return _0x2e8380;});}return null;};}function removeEntity(_0x252b80,_0xb88e77){return function(_0x51d729){if(_0x51d729){return _0x51d729[_0xa64e('0x25')]()['then'](function(){_0x252b80[_0xa64e('0x1b')](0xcc)[_0xa64e('0x1c')]();});}};}function handleEntityNotFound(_0x2e39db,_0x1c4ae9){return function(_0xf119d3){if(!_0xf119d3){_0x2e39db['sendStatus'](0x194);}return _0xf119d3;};}function handleError(_0xd711c4,_0x368e34){_0x368e34=_0x368e34||0x1f4;return function(_0x3659fb){logger[_0xa64e('0x26')](_0x3659fb[_0xa64e('0x27')]);if(_0x3659fb[_0xa64e('0x28')]){delete _0x3659fb[_0xa64e('0x28')];}_0xd711c4[_0xa64e('0x1b')](_0x368e34)[_0xa64e('0x29')](_0x3659fb);};}function getInteractionUsers(_0x17598e,_0x393800){return new BPromise(function(_0x504720,_0x1610e3){try{if(_0x393800[_0x17598e['id']]){_0x17598e[_0xa64e('0x2a')]=_[_0xa64e('0x2b')](_0x393800[_0x17598e['id']],function(_0x5a544e){return{'id':_0x5a544e['id'],'fullname':_0x5a544e[_0xa64e('0x2c')]};});}}catch(_0x23ca54){_0x1610e3(_0x23ca54);}_0x504720(_0x17598e);});}function getInteractionTags(_0x54de33,_0x2a95f0){return new BPromise(function(_0x3cf2f2,_0x1fb1ae){try{if(_0x54de33[_0xa64e('0x2d')]){_0x54de33['Tags']=[];_0x54de33['TagIds'][_0xa64e('0x2e')](',')[_0xa64e('0x2f')](function(_0x4c218a){_0x54de33['Tags']['push'](_0x2a95f0[_0x4c218a]);});}delete _0x54de33[_0xa64e('0x2d')];}catch(_0xec335c){_0x1fb1ae(_0xec335c);}_0x3cf2f2(_0x54de33);});}function getLastMessageText(_0x150e38){return new BPromise(function(_0x56cac0,_0x395726){return db[_0xa64e('0x30')][_0xa64e('0x31')]({'where':{'id':_0x150e38['id']},'attributes':[_0xa64e('0x32'),_0xa64e('0x33')],'raw':!![]})[_0xa64e('0x24')](function(_0x2cb3f9){if(!_0x2cb3f9[_0xa64e('0x33')]){_0x150e38[_0xa64e('0x33')]=_[_0xa64e('0x34')](htmlToText['fromString'](_0x2cb3f9[_0xa64e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x150e38[_0xa64e('0x33')]=_0x2cb3f9[_0xa64e('0x33')];}_0x56cac0(_0x150e38);})[_0xa64e('0x35')](function(_0x55ce0c){_0x395726(_0x55ce0c);});});}function updateMailInteraction(_0x2de2be,_0x589fcb,_0x186f1c,_0x4e1d87){return new BPromise(function(_0x5cb96a,_0x358d05){return getInteractionUsers(_0x2de2be,_0x186f1c)[_0xa64e('0x24')](function(_0x294703){return getInteractionTags(_0x294703,_0x589fcb);})[_0xa64e('0x24')](function(_0x2baced){if(_0x4e1d87){_0x5cb96a(getLastMessageText(_0x2baced));}else{_0x5cb96a(_0x2baced);}})[_0xa64e('0x35')](function(_0x4651d4){_0x358d05(_0x4651d4);});});}exports[_0xa64e('0x36')]=function(_0x54e9d6,_0x4ce8f8){var _0x479a36={},_0x3a0050={},_0x230528={'count':0x0,'rows':[]};var _0x249cac=_[_0xa64e('0x2b')](db[_0xa64e('0x30')][_0xa64e('0x37')],function(_0x25371d){return{'name':_0x25371d[_0xa64e('0x38')],'type':_0x25371d[_0xa64e('0x39')][_0xa64e('0x3a')]};});_0x3a0050[_0xa64e('0x3b')]=_[_0xa64e('0x2b')](_0x249cac,'name');_0x3a0050[_0xa64e('0x3c')]=_[_0xa64e('0x3d')](_0x54e9d6[_0xa64e('0x3c')]);_0x3a0050[_0xa64e('0x3e')]=_[_0xa64e('0x3f')](_0x3a0050['model'],_0x3a0050[_0xa64e('0x3c')]);_0x479a36[_0xa64e('0x40')]=_[_0xa64e('0x3f')](_0x3a0050[_0xa64e('0x3b')],qs[_0xa64e('0x41')](_0x54e9d6['query'][_0xa64e('0x41')]));_0x479a36[_0xa64e('0x40')]=_0x479a36['attributes'][_0xa64e('0x42')]?_0x479a36[_0xa64e('0x40')]:_0x3a0050[_0xa64e('0x3b')];if(!_0x54e9d6[_0xa64e('0x3c')][_0xa64e('0x43')]('nolimit')){_0x479a36['limit']=qs['limit'](_0x54e9d6[_0xa64e('0x3c')][_0xa64e('0x1f')]);_0x479a36[_0xa64e('0x1e')]=qs[_0xa64e('0x1e')](_0x54e9d6[_0xa64e('0x3c')][_0xa64e('0x1e')]);}_0x479a36[_0xa64e('0x44')]=qs[_0xa64e('0x45')](_0x54e9d6[_0xa64e('0x3c')][_0xa64e('0x45')]);_0x479a36[_0xa64e('0x46')]=qs['filters'](_[_0xa64e('0x47')](_0x54e9d6['query'],_0x3a0050[_0xa64e('0x3e')]));var _0x18b016=[];var _0x581bf5=squel[_0xa64e('0x48')]()['field']('id')['field']('name')[_0xa64e('0x49')](_0xa64e('0x4a'))['from']('tools_tags');var _0x41cf35=squel['select']()[_0xa64e('0x49')](_0xa64e('0x4b'))['field'](_0xa64e('0x4c'))[_0xa64e('0x49')](_0xa64e('0x4d'))[_0xa64e('0x4e')](_0xa64e('0x4f'),'ui')[_0xa64e('0x50')](_0xa64e('0x51'),'u',_0xa64e('0x52'));var _0x3d609d=squel[_0xa64e('0x48')]()[_0xa64e('0x4e')]('mail_interactions','i')['left_join'](_0xa64e('0x53'),'c',_0xa64e('0x54'))[_0xa64e('0x50')](_0xa64e('0x51'),'o',_0xa64e('0x55'))[_0xa64e('0x50')](_0xa64e('0x56'),'a',_0xa64e('0x57'))[_0xa64e('0x50')](_0xa64e('0x58'),'me',_0xa64e('0x59'))['left_join']('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x5312d4=squel[_0xa64e('0x5a')]();var _0xf092b8=[];var _0xb7a45a=squel[_0xa64e('0x5a')]();var _0x3bb34a;if(_0x54e9d6[_0xa64e('0x3c')][_0xa64e('0x5b')]){_0x3bb34a=as[_0xa64e('0x5c')](_0x54e9d6[_0xa64e('0x3c')]['search']);var _0x6ac6dc=_0x3bb34a[_0xa64e('0x5d')];for(var _0x33ee4a=0x0;_0x33ee4a<_0x3bb34a[_0xa64e('0x5e')][_0xa64e('0x42')];_0x33ee4a++){var _0x5d9477=_0x3bb34a[_0xa64e('0x5e')][_0x33ee4a];var _0xe60bd4='i';var _0x1c7738=_[_0xa64e('0x5f')](_0x249cac,[_0xa64e('0x28'),_0x5d9477[_0xa64e('0x49')]]);if(!_0x1c7738){switch(_0x5d9477[_0xa64e('0x49')]){case _0xa64e('0x60'):if(_0x5d9477['value']==0x1){_0x3d609d[_0xa64e('0x61')]('`'+_0x5d9477['field']+_0xa64e('0x62'));}else{_0x3d609d['having']('`'+_0x5d9477[_0xa64e('0x49')]+_0xa64e('0x63'));}break;case'Contact':if(_0x5d9477[_0xa64e('0x64')]==='$substring'){if(_0x5d9477[_0xa64e('0x65')]['split']('\x20')[_0xa64e('0x42')]>0x1){_0x5312d4[_0x6ac6dc]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5d9477[_0xa64e('0x65')]),null);}else{var _0x4990b4='%'+_0x5d9477[_0xa64e('0x65')]+'%';_0x5312d4[_0x6ac6dc](_0xa64e('0x66'),_0x4990b4,_0x4990b4,_0x4990b4);}}else{_0x1c7738=_[_0xa64e('0x5f')](_0x249cac,['name',_0xa64e('0x67')]);_0x5d9477[_0xa64e('0x49')]='ContactId';_0x14c2b4=as[_0xa64e('0x68')](_0xe60bd4,_0x1c7738[_0xa64e('0x39')],_0x5d9477);_0x5312d4[_0x6ac6dc](_0x14c2b4[_0xa64e('0x69')],_0x14c2b4[_0xa64e('0x65')]['start'],_0x14c2b4[_0xa64e('0x65')]['end']);}break;case _0xa64e('0x6a'):var _0x109955=_0x5d9477['value'][_0xa64e('0x2e')](',')[_0xa64e('0x2b')](function(_0x4ef59a){return Number(_0x4ef59a);});_0x109955[_0xa64e('0x2f')](function(_0x10209b){_0xb7a45a['or'](_0xa64e('0x6b'),'%,'+_0x10209b+',%');});_0xf092b8=_['union'](_0xf092b8,_0x109955);break;case _0xa64e('0x6c'):if(_0x5d9477['operator']===_0xa64e('0x6d')){_0x5312d4[_0x6ac6dc](_0xa64e('0x6e'),'%'+_0x5d9477['value']+'%',null);}else{_0x1c7738=_['find'](_0x249cac,[_0xa64e('0x28'),'UserId']);_0x5d9477[_0xa64e('0x49')]=_0xa64e('0x6f');_0x14c2b4=as[_0xa64e('0x68')](_0xe60bd4,_0x1c7738['type'],_0x5d9477);_0x5312d4[_0x6ac6dc](_0x14c2b4[_0xa64e('0x69')],_0x14c2b4[_0xa64e('0x65')][_0xa64e('0x70')],_0x14c2b4[_0xa64e('0x65')][_0xa64e('0x1c')]);}break;case _0xa64e('0x71'):_0x14c2b4=as[_0xa64e('0x68')]('me',null,_0x5d9477);_0x5312d4[_0x6ac6dc](_0x14c2b4[_0xa64e('0x69')],_0x14c2b4[_0xa64e('0x65')]['start'],_0x14c2b4[_0xa64e('0x65')][_0xa64e('0x1c')]);break;}}else{var _0x14c2b4=as[_0xa64e('0x68')](_0xe60bd4,_0x1c7738[_0xa64e('0x39')],_0x5d9477);_0x5312d4[_0x6ac6dc](_0x14c2b4['text'],_0x14c2b4['value'][_0xa64e('0x70')],_0x14c2b4[_0xa64e('0x65')][_0xa64e('0x1c')]);}}}else{var _0x584f85=_(_0x54e9d6[_0xa64e('0x3c')])[_0xa64e('0x3d')]()['map'](function(_0xb84059){return _['some'](_0x249cac,['name',_0xb84059])?_0xb84059:undefined;})[_0xa64e('0x72')]()[_0xa64e('0x65')]();if(!_[_0xa64e('0x73')](_0x584f85)){_0x584f85[_0xa64e('0x2f')](function(_0x5c7d5f){if(_0x5c7d5f===_0xa64e('0x74')){_0x3d609d[_0xa64e('0x46')](_0xa64e('0x75'),[][_0xa64e('0x76')](_0x54e9d6['query'][_0x5c7d5f]));}else if(_0x5c7d5f===_0xa64e('0x77')){var _0x38b297=JSON[_0xa64e('0x78')](_0x54e9d6[_0xa64e('0x3c')][_0x5c7d5f])['$gte'];var _0x256951=JSON['parse'](_0x54e9d6[_0xa64e('0x3c')][_0x5c7d5f])[_0xa64e('0x79')];_0x3d609d['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x38b297,_0x256951);}else{if(_0x54e9d6['query'][_0x5c7d5f]===_0xa64e('0x7a')){_0x3d609d[_0xa64e('0x46')]('i.'+_0x5c7d5f+'\x20IS\x20NULL');}else{_0x3d609d[_0xa64e('0x46')]('i.'+_0x5c7d5f+_0xa64e('0x7b'),_0x54e9d6['query'][_0x5c7d5f]);}}});}if(_0x54e9d6[_0xa64e('0x3c')][_0xa64e('0x7c')]){if(_0x54e9d6[_0xa64e('0x3c')][_0xa64e('0x7c')]==0x1){_0x3d609d[_0xa64e('0x61')](_0xa64e('0x7d'));}else{_0x3d609d[_0xa64e('0x61')](_0xa64e('0x7e'));}}if(_0x54e9d6[_0xa64e('0x3c')][_0xa64e('0x7f')]){_0xf092b8=_[_0xa64e('0x80')](_0x54e9d6[_0xa64e('0x3c')][_0xa64e('0x7f')])?_0x54e9d6[_0xa64e('0x3c')][_0xa64e('0x7f')]:new Array(_0x54e9d6[_0xa64e('0x3c')]['tag']);_0xf092b8[_0xa64e('0x2f')](function(_0x545bf4){_0xb7a45a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x545bf4+',%');});}if(_0x54e9d6[_0xa64e('0x3c')]['filter']){var _0x577265=_0x54e9d6['query'][_0xa64e('0x81')][_0xa64e('0x82')]('\x5c','\x5c\x5c')[_0xa64e('0x82')]('\x27\x27',_0xa64e('0x83'));if(qs[_0xa64e('0x84')](_0x577265)){_0x5312d4['or']('i.id\x20LIKE\x20?',_0x577265+'%');}else if(qs[_0xa64e('0x85')](_0x577265)){_0x5312d4['or'](_0xa64e('0x86'),_0x577265+'%');}else{_0x5312d4['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa64e('0x87')](_0x577265))['or'](_0xa64e('0x88'),qs[_0xa64e('0x87')](_0x577265));}}}_0x3d609d[_0xa64e('0x46')](_0x5312d4);_0x3d609d[_0xa64e('0x89')](_0xa64e('0x8a'));var _0x35e422={'type':db[_0xa64e('0x8b')][_0xa64e('0x8c')][_0xa64e('0x8d')],'raw':!![]};var _0x55e901=_0x3d609d['clone']();_0x55e901[_0xa64e('0x49')](_0xa64e('0x8a'));_0x55e901['field'](_0xa64e('0x8e'),'unreadMessages');if(_0x479a36['order']){_0x479a36[_0xa64e('0x44')][_0xa64e('0x2f')](function(_0x3c1fdb){_0x3d609d['order']('i.'+_0x3c1fdb[0x0],_0x3c1fdb[0x1]===_0xa64e('0x8f')?![]:!![]);});}if(!_[_0xa64e('0x73')](_0xf092b8)){_0x3d609d[_0xa64e('0x61')](_0xb7a45a);_0x55e901['where']('t.id\x20IN\x20?',_0xf092b8);}BPromise[_0xa64e('0x90')]()[_0xa64e('0x24')](function(){if(!_0x3bb34a){if(_0x54e9d6[_0xa64e('0x3c')][_0xa64e('0x74')]||_0x54e9d6[_0xa64e('0x3c')][_0xa64e('0x91')])return;_0x55e901[_0xa64e('0x46')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x3d609d[_0xa64e('0x46')](_0xa64e('0x92'));return;}return _0x54e9d6['user'][_0xa64e('0x93')]({'attributes':['id'],'raw':!![]})[_0xa64e('0x24')](function(_0x48590f){if(_['isEmpty'](_0x48590f)){_0x55e901[_0xa64e('0x46')](_0xa64e('0x94'));_0x3d609d[_0xa64e('0x46')](_0xa64e('0x94'));}else{_0x55e901['where'](_0xa64e('0x75'),_[_0xa64e('0x2b')](_0x48590f,'id'));_0x3d609d[_0xa64e('0x46')](_0xa64e('0x75'),_[_0xa64e('0x2b')](_0x48590f,'id'));}});})[_0xa64e('0x24')](function(){db[_0xa64e('0x95')]['query'](_0x55e901['toString'](),_0x35e422)[_0xa64e('0x24')](function(_0x4e6028){_0x230528[_0xa64e('0x1d')]=_0x4e6028[_0xa64e('0x42')];if(_0x230528[_0xa64e('0x1d')]===0x0)return[];return db[_0xa64e('0x95')][_0xa64e('0x3c')](_0x581bf5[_0xa64e('0x96')](),_0x35e422)[_0xa64e('0x24')](function(_0x296a51){_0x18b016=_[_0xa64e('0x97')](_0x296a51,'id');_0x35e422=_[_0xa64e('0x98')](_0x35e422,{'model':db[_0xa64e('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x54e9d6[_0xa64e('0x3c')][_0xa64e('0x41')]){_0x479a36[_0xa64e('0x40')]['forEach'](function(_0xbb9a5){_0x3d609d['field']('i.'+_0xbb9a5);});}else{_0x3d609d[_0xa64e('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa64e('0x60'));_0x3d609d[_0xa64e('0x49')]('a.key',_0xa64e('0x99'));_0x3d609d[_0xa64e('0x49')]('a.mandatoryDisposition',_0xa64e('0x9a'));_0x3d609d['field']('i.id');_0x3d609d[_0xa64e('0x49')](_0xa64e('0x9b'));_0x3d609d[_0xa64e('0x49')](_0xa64e('0x9c'));_0x3d609d[_0xa64e('0x49')]('i.closed');_0x3d609d[_0xa64e('0x49')](_0xa64e('0x9d'));_0x3d609d[_0xa64e('0x49')](_0xa64e('0x9e'));_0x3d609d[_0xa64e('0x49')](_0xa64e('0x9f'));_0x3d609d[_0xa64e('0x49')](_0xa64e('0xa0'));_0x3d609d[_0xa64e('0x49')]('i.subject');_0x3d609d[_0xa64e('0x49')](_0xa64e('0xa1'));_0x3d609d['field']('i.substatus');_0x3d609d['field']('i.to');_0x3d609d[_0xa64e('0x49')](_0xa64e('0xa2'));_0x3d609d[_0xa64e('0x49')]('i.MailAccountId');_0x3d609d[_0xa64e('0x49')](_0xa64e('0xa3'));_0x3d609d[_0xa64e('0x49')](_0xa64e('0xa4'),'Contact.firstName');_0x3d609d['field']('c.lastName',_0xa64e('0xa5'));_0x3d609d['field']('c.email',_0xa64e('0xa6'));_0x3d609d[_0xa64e('0x49')](_0xa64e('0xa7'),'Contact.phone');_0x3d609d[_0xa64e('0x49')](_0xa64e('0xa8'),_0xa64e('0xa9'));_0x3d609d[_0xa64e('0x49')](_0xa64e('0xaa'),_0xa64e('0xab'));_0x3d609d[_0xa64e('0x49')]('o.fullname','Owner.fullname');_0x3d609d[_0xa64e('0x49')](_0xa64e('0xac'),_0xa64e('0xad'));_0x3d609d[_0xa64e('0x49')](_0xa64e('0xae'),_0xa64e('0x2d'));}_0x3d609d[_0xa64e('0x1f')](_0x479a36[_0xa64e('0x1f')]);_0x3d609d['offset'](_0x479a36[_0xa64e('0x1e')]);return db[_0xa64e('0x95')][_0xa64e('0x3c')](_0x3d609d[_0xa64e('0x96')](),_0x35e422);})['then'](function(_0x58082e){_0x41cf35[_0xa64e('0x46')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x58082e,'id'));return db[_0xa64e('0x95')]['query'](_0x41cf35[_0xa64e('0x96')](),_0x35e422)['then'](function(_0x51c104){var _0x1d8c8e=_['groupBy'](_0x51c104,_0xa64e('0xaf'));var _0x55219=[];return db['Setting'][_0xa64e('0x31')]({'attributes':[_0xa64e('0xb0')],'raw':!![]})[_0xa64e('0x24')](function(_0x14e0f8){var _0x21d2d3=_0x14e0f8['enableEmailPreview'];_0x58082e['forEach'](function(_0x303166){_0x55219[_0xa64e('0xb1')](updateMailInteraction(_0x303166,_0x18b016,_0x1d8c8e,_0x21d2d3));});return BPromise['all'](_0x55219);});});});})[_0xa64e('0x24')](function(_0x5e1b2e){_0x230528[_0xa64e('0xb2')]=_0x5e1b2e;return _0x230528;})['then'](respondWithFilteredResult(_0x4ce8f8,_0x479a36));})[_0xa64e('0x35')](handleError(_0x4ce8f8,null));};exports[_0xa64e('0xb3')]=function(_0x3c5d9f,_0x3ca478){var _0x968145={'raw':![],'where':{'id':_0x3c5d9f[_0xa64e('0xb4')]['id']}},_0x3cfba9={};_0x3cfba9[_0xa64e('0x3b')]=_[_0xa64e('0x3d')](db[_0xa64e('0x30')][_0xa64e('0x37')]);_0x3cfba9['query']=_[_0xa64e('0x3d')](_0x3c5d9f[_0xa64e('0x3c')]);_0x3cfba9[_0xa64e('0x3e')]=_['intersection'](_0x3cfba9[_0xa64e('0x3b')],_0x3cfba9['query']);_0x968145[_0xa64e('0x40')]=_[_0xa64e('0x3f')](_0x3cfba9[_0xa64e('0x3b')],qs['fields'](_0x3c5d9f[_0xa64e('0x3c')][_0xa64e('0x41')]));_0x968145[_0xa64e('0x40')]=_0x968145[_0xa64e('0x40')][_0xa64e('0x42')]?_0x968145[_0xa64e('0x40')]:_0x3cfba9[_0xa64e('0x3b')];if(_0x3c5d9f[_0xa64e('0x3c')][_0xa64e('0xb5')]){_0x968145[_0xa64e('0xb6')]=[{'all':!![]}];}_0x968145=_[_0xa64e('0x98')]({},_0x968145,_0x3c5d9f[_0xa64e('0xb7')]);return db['MailInteraction'][_0xa64e('0x5f')](_0x968145)[_0xa64e('0x24')](handleEntityNotFound(_0x3ca478,null))[_0xa64e('0x24')](respondWithResult(_0x3ca478,null))[_0xa64e('0x35')](handleError(_0x3ca478,null));};exports['create']=function(_0x3c6c1f,_0x18981b){return db[_0xa64e('0x30')]['create'](_0x3c6c1f['body'],{})[_0xa64e('0x24')](respondWithResult(_0x18981b,0xc9))[_0xa64e('0x35')](handleError(_0x18981b,null));};exports['update']=function(_0x5dc928,_0x117cd7){if(_0x5dc928[_0xa64e('0xb8')]['id']){delete _0x5dc928[_0xa64e('0xb8')]['id'];}return db['MailInteraction'][_0xa64e('0x5f')]({'where':{'id':_0x5dc928['params']['id']}})['then'](handleEntityNotFound(_0x117cd7,null))['then'](saveUpdates(_0x5dc928[_0xa64e('0xb8')],null))[_0xa64e('0x24')](respondWithResult(_0x117cd7,null))['catch'](handleError(_0x117cd7,null));};exports[_0xa64e('0x25')]=function(_0x1c3560,_0x477931){return db[_0xa64e('0x30')][_0xa64e('0x5f')]({'where':{'id':_0x1c3560[_0xa64e('0xb4')]['id']}})[_0xa64e('0x24')](handleEntityNotFound(_0x477931,null))[_0xa64e('0x24')](removeEntity(_0x477931,null))[_0xa64e('0x35')](handleError(_0x477931,null));};exports['describe']=function(_0x382ca9,_0x3a8f25){return db[_0xa64e('0x30')][_0xa64e('0xb9')]()['then'](respondWithResult(_0x3a8f25,null))[_0xa64e('0x35')](handleError(_0x3a8f25,null));};exports[_0xa64e('0xba')]=function(_0x1fe1c9,_0x54d78c,_0x500e6e){return db[_0xa64e('0xbb')]['find']({'where':{'id':_0x1fe1c9[_0xa64e('0xb4')]['id']}})[_0xa64e('0x24')](handleEntityNotFound(_0x54d78c,null))[_0xa64e('0x24')](function(_0x6384b2){if(_0x6384b2){return _0x6384b2['addMessage'](_0x1fe1c9[_0xa64e('0xb8')][_0xa64e('0xbc')],_[_0xa64e('0xbd')](_0x1fe1c9[_0xa64e('0xb8')],[_0xa64e('0xbc'),'id'])||{});}})[_0xa64e('0x24')](respondWithResult(_0x54d78c,null))[_0xa64e('0x35')](handleError(_0x54d78c,null));};exports['getMessages']=function(_0x2035aa,_0xb7dcde,_0x156be1){var _0x65696={'raw':![],'where':{}};var _0x224a12={};var _0x200b10={'count':0x0,'rows':[]};return db['MailInteraction'][_0xa64e('0x31')]({'where':{'id':_0x2035aa[_0xa64e('0xb4')]['id']}})['then'](handleEntityNotFound(_0xb7dcde,null))['then'](function(_0x44c0d8){if(_0x44c0d8){_0x224a12['model']=_[_0xa64e('0x3d')](db['MailMessage'][_0xa64e('0x37')]);_0x224a12['query']=_[_0xa64e('0x3d')](_0x2035aa[_0xa64e('0x3c')]);_0x224a12[_0xa64e('0x3e')]=_[_0xa64e('0x3f')](_0x224a12[_0xa64e('0x3b')],_0x224a12[_0xa64e('0x3c')]);_0x65696[_0xa64e('0x40')]=_['intersection'](_0x224a12[_0xa64e('0x3b')],qs[_0xa64e('0x41')](_0x2035aa['query']['fields']));_0x65696[_0xa64e('0x40')]=_0x65696[_0xa64e('0x40')][_0xa64e('0x42')]?_0x65696[_0xa64e('0x40')]:_0x224a12[_0xa64e('0x3b')];if(!_0x2035aa[_0xa64e('0x3c')][_0xa64e('0x43')](_0xa64e('0xbe'))){_0x65696[_0xa64e('0x1f')]=qs[_0xa64e('0x1f')](_0x2035aa[_0xa64e('0x3c')][_0xa64e('0x1f')]);_0x65696[_0xa64e('0x1e')]=qs[_0xa64e('0x1e')](_0x2035aa[_0xa64e('0x3c')][_0xa64e('0x1e')]);}_0x65696['order']=qs[_0xa64e('0x45')](_0x2035aa['query']['sort']);_0x65696[_0xa64e('0x46')]=qs['filters'](_[_0xa64e('0x47')](_0x2035aa[_0xa64e('0x3c')],_0x224a12[_0xa64e('0x3e')]));_0x65696[_0xa64e('0x46')][_0xa64e('0xaf')]=_0x44c0d8['id'];if(_0x2035aa[_0xa64e('0x3c')][_0xa64e('0x81')]){_0x65696[_0xa64e('0x46')]=_['merge'](_0x65696[_0xa64e('0x46')],{'$or':_['map'](_0x65696[_0xa64e('0x40')],function(_0x3c2f0f){var _0x42fcf4={};_0x42fcf4[_0x3c2f0f]={'$like':'%'+_0x2035aa[_0xa64e('0x3c')][_0xa64e('0x81')]+'%'};return _0x42fcf4;})});}if(_0x2035aa[_0xa64e('0x3c')][_0xa64e('0xbf')]){var _0x489b3=_0x2035aa[_0xa64e('0x3c')][_0xa64e('0xbf')][_0xa64e('0x2e')](',');var _0x37f8c9={};_0x37f8c9[_0x489b3[0x0]]={'$gte':moment(_0x489b3[0x1])['format'](_0xa64e('0xc0'))};_0x65696[_0xa64e('0x46')]=_[_0xa64e('0x98')](_0x65696[_0xa64e('0x46')],_0x37f8c9);}_0x65696=_['merge']({},_0x65696,_0x2035aa['options']);return db[_0xa64e('0xbb')][_0xa64e('0x1d')]({'where':_0x65696[_0xa64e('0x46')]})['then'](function(_0x54a855){_0x200b10['count']=_0x54a855;if(_0x2035aa[_0xa64e('0x3c')][_0xa64e('0xb5')]){_0x65696[_0xa64e('0xb6')]=[{'all':!![]}];}return db['MailMessage'][_0xa64e('0xc1')](_0x65696);})[_0xa64e('0x24')](function(_0x748290){_0x200b10[_0xa64e('0xb2')]=_0x748290;return _0x200b10;});}})[_0xa64e('0x24')](respondWithFilteredResult(_0xb7dcde,_0x65696))[_0xa64e('0x35')](handleError(_0xb7dcde,null));};exports['addTags']=function(_0x384d60,_0x486f10,_0x17f2c5){return db[_0xa64e('0x30')][_0xa64e('0x5f')]({'where':{'id':_0x384d60['params']['id']}})[_0xa64e('0x24')](handleEntityNotFound(_0x486f10,null))[_0xa64e('0x24')](function(_0x39683e){if(_0x39683e){return _0x39683e['setTags'](_0x384d60['body'][_0xa64e('0xbc')],_[_0xa64e('0xbd')](_0x384d60[_0xa64e('0xb8')],['ids','id'])||{})[_0xa64e('0xc2')](function(){return db[_0xa64e('0x6a')][_0xa64e('0xc1')]({'attributes':['id',_0xa64e('0x28'),_0xa64e('0x4a')],'where':{'id':_0x384d60[_0xa64e('0xb8')][_0xa64e('0xbc')]}});})[_0xa64e('0x24')](function(_0x40542c){socket['emit']('mailInteractionTags:save',{'id':Number(_0x384d60[_0xa64e('0xb4')]['id']),'tags':_0x40542c||[]});return{'id':Number(_0x384d60[_0xa64e('0xb4')]['id']),'tags':_0x40542c||[]};});}})[_0xa64e('0x24')](respondWithResult(_0x486f10,null))[_0xa64e('0x35')](handleError(_0x486f10,null));};exports[_0xa64e('0xc3')]=function(_0x2cf639,_0x5593c4,_0x1f14c0){return db[_0xa64e('0x30')]['find']({'where':{'id':_0x2cf639['params']['id']}})['then'](handleEntityNotFound(_0x5593c4,null))['then'](function(_0x3056d6){if(_0x3056d6){return _0x3056d6[_0xa64e('0xc3')](_0x2cf639[_0xa64e('0x3c')][_0xa64e('0xbc')]);}})['then'](respondWithStatusCode(_0x5593c4,null))['catch'](handleError(_0x5593c4,null));};exports[_0xa64e('0xc4')]=function(_0x4ca98b,_0x373158){var _0x57ad6a=moment()['unix']()['toString']();var _0x3e9dfe=path[_0xa64e('0xc5')](config[_0xa64e('0xc6')],_0xa64e('0xc7'),'files','tmp');var _0x5a62e6=path[_0xa64e('0xc5')](config['root'],_0xa64e('0xc7'),_0xa64e('0xc8'),_0xa64e('0xc9'));var _0x3b2beb=path[_0xa64e('0xc5')](_0x3e9dfe,_0x57ad6a);var _0xc72afc=util[_0xa64e('0xca')](_0xa64e('0xcb'),_0x4ca98b[_0xa64e('0xb4')]['id'],_0x57ad6a);var _0x330a1f=path[_0xa64e('0xc5')](_0x3e9dfe,_0xc72afc);var _0x27b4d4=[];if(_0x4ca98b[_0xa64e('0x3c')][_0xa64e('0xc9')]){_0x27b4d4[_0xa64e('0xb1')]({'model':db[_0xa64e('0xcc')],'as':_0xa64e('0xcd'),'raw':!![]});}var _0x2c5e78=[{'model':db[_0xa64e('0xbb')],'as':_0xa64e('0xce'),'attributes':['id',_0xa64e('0xb8'),_0xa64e('0x4e'),'to','cc',_0xa64e('0xcf'),_0xa64e('0xd0'),_0xa64e('0x77')],'where':{'secret':![]},'order':qs[_0xa64e('0x45')]('id'),'include':_0x27b4d4}];return db[_0xa64e('0x30')][_0xa64e('0x5f')]({'where':{'id':_0x4ca98b['params']['id']},'include':_0x2c5e78})['then'](handleEntityNotFound(_0x373158,null))[_0xa64e('0x24')](function(_0x2921b0){if(_0x2921b0&&_0x2921b0[_0xa64e('0xce')]){var _0x49cea9=_0x2921b0[_0xa64e('0xd1')]({'plain':!![]});fs[_0xa64e('0xd2')](_0x3b2beb);return BPromise[_0xa64e('0xd3')](_0x49cea9[_0xa64e('0xce')],function(_0x15120f,_0x394aff){var _0x94449c={'from':_0x15120f[_0xa64e('0x4e')],'to':_0x15120f['to'],'subject':_0x15120f[_0xa64e('0xd0')],'html':_0x15120f[_0xa64e('0xb8')],'headers':{'Date':moment(_0x15120f[_0xa64e('0x77')])[_0xa64e('0xca')](_0xa64e('0xd4'))},'attachments':[]};if(_0x15120f['cc']){_0x94449c[_0xa64e('0xd5')]['Cc']=_0x15120f['cc'];}if(_0x15120f[_0xa64e('0xcf')]){_0x94449c['headers'][_0xa64e('0xd6')]=_0x15120f[_0xa64e('0xcf')];}return new BPromise(function(_0x240390,_0x47840f){if(_0x15120f[_0xa64e('0xcd')]){for(var _0x2e68c6=0x0;_0x2e68c6<_0x15120f[_0xa64e('0xcd')][_0xa64e('0x42')];_0x2e68c6++){var _0x3e9cc3=_0x15120f['Attachments'][_0x2e68c6];var _0x3ee830=path['join'](_0x5a62e6,_0x3e9cc3['basename']);if(fs[_0xa64e('0xd7')](_0x3ee830)){_0x94449c[_0xa64e('0xc9')][_0xa64e('0xb1')]({'name':_0x3e9cc3[_0xa64e('0x28')],'contentType':_0x3e9cc3['type'],'data':fs['readFileSync'](_0x3ee830)});}}}emlformat['build'](_0x94449c,function(_0x2a2745,_0x12088c){if(_0x2a2745)return _0x47840f(_0x2a2745);fs[_0xa64e('0xd8')](path[_0xa64e('0xc5')](_0x3b2beb,util[_0xa64e('0xca')]('message%d.eml',_0x394aff)),_0x12088c);return _0x240390(_0x12088c);});});})[_0xa64e('0x24')](function(){return new BPromise(function(_0x5661d2,_0x1f3862){zipdir(_0x3b2beb,{'saveTo':_0x330a1f},function(_0x3b9420,_0x427898){if(_0x3b9420)return _0x1f3862(_0x3b9420);return _0x5661d2(_0x427898);});})[_0xa64e('0x24')](function(){return new BPromise(function(_0x57a0bf,_0x194b77){rimraf(_0x3b2beb,function(_0xaff565){if(_0xaff565)_0x194b77(_0xaff565);return _0x57a0bf();});});})[_0xa64e('0x24')](function(){return _0x373158[_0xa64e('0xc4')](_0x330a1f,_0xc72afc,function(_0x2a0bb2){if(_0x2a0bb2){console[_0xa64e('0xd9')]('err',_0x2a0bb2);}else{fs[_0xa64e('0xda')](_0x330a1f);}});});});}else{return _0x373158[_0xa64e('0x1a')](0xc8);}})[_0xa64e('0x35')](handleError(_0x373158,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 1a4296a..2ee148e 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 _0x854f=['length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','MailInteraction','MailMessage','getUsers','then','setDataValue','findAll'];(function(_0x1b8bb9,_0xd7482){var _0x23a1fc=function(_0x3b1cc4){while(--_0x3b1cc4){_0x1b8bb9['push'](_0x1b8bb9['shift']());}};_0x23a1fc(++_0xd7482);}(_0x854f,0x14a));var _0xf854=function(_0x4df973,_0x47b5eb){_0x4df973=_0x4df973-0x0;var _0x4e0a06=_0x854f[_0x4df973];return _0x4e0a06;};'use strict';var EventEmitter=require(_0xf854('0x0'));var MailInteraction=require(_0xf854('0x1'))['db'][_0xf854('0x2')];var MailMessage=require(_0xf854('0x1'))['db'][_0xf854('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4dc1e3){return function(_0x1a6d72,_0x27560b,_0xb9845e){_0x1a6d72[_0xf854('0x4')]({'attributes':['id'],'raw':!![]})[_0xf854('0x5')](function(_0x21e756){_0x1a6d72[_0xf854('0x6')]('Users',_0x21e756['map'](function(_0x520da4){return{'id':_0x520da4['id']};}));return MailMessage[_0xf854('0x7')]({'where':{'MailInteractionId':_0x1a6d72['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf854('0x5')](function(_0x39afc0){_0x1a6d72[_0xf854('0x6')]('unreadMessages',_0x39afc0[_0xf854('0x8')]);MailInteractionEvents[_0xf854('0x9')](_0x4dc1e3+':'+_0x1a6d72['id'],_0x1a6d72);MailInteractionEvents[_0xf854('0x9')](_0x4dc1e3,_0x1a6d72);_0xb9845e(null);})[_0xf854('0xa')](_0xb9845e(null));};}for(var e in events){if(events[_0xf854('0xb')](e)){var event=events[e];MailInteraction[_0xf854('0xc')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x6e55=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','MailInteraction','MailMessage','setMaxListeners','remove','getUsers','then','setDataValue','Users','map'];(function(_0x3461ce,_0x47bbe7){var _0x44cb21=function(_0x299579){while(--_0x299579){_0x3461ce['push'](_0x3461ce['shift']());}};_0x44cb21(++_0x47bbe7);}(_0x6e55,0x1d2));var _0x56e5=function(_0x1b28d1,_0x364595){_0x1b28d1=_0x1b28d1-0x0;var _0x19bfd0=_0x6e55[_0x1b28d1];return _0x19bfd0;};'use strict';var EventEmitter=require(_0x56e5('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x56e5('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x56e5('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x56e5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x56e5('0x4')};function emitEvent(_0x23ac3c){return function(_0x31016f,_0x32942b,_0x4ce096){_0x31016f[_0x56e5('0x5')]({'attributes':['id'],'raw':!![]})[_0x56e5('0x6')](function(_0x21a517){_0x31016f[_0x56e5('0x7')](_0x56e5('0x8'),_0x21a517[_0x56e5('0x9')](function(_0x3e83a8){return{'id':_0x3e83a8['id']};}));return MailMessage[_0x56e5('0xa')]({'where':{'MailInteractionId':_0x31016f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x56e5('0x6')](function(_0xe5e8aa){_0x31016f['setDataValue'](_0x56e5('0xb'),_0xe5e8aa[_0x56e5('0xc')]);MailInteractionEvents['emit'](_0x23ac3c+':'+_0x31016f['id'],_0x31016f);MailInteractionEvents[_0x56e5('0xd')](_0x23ac3c,_0x31016f);_0x4ce096(null);})[_0x56e5('0xe')](_0x4ce096(null));};}for(var e in events){if(events[_0x56e5('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x56e5('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 28b068f..c851a9b 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 _0xb49a=['util','../../config/logger','api','moment','request-promise','path','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','substatusAt','models','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x59cfcb,_0x1c96d2){var _0x1efad9=function(_0x2a3b16){while(--_0x2a3b16){_0x59cfcb['push'](_0x59cfcb['shift']());}};_0x1efad9(++_0x1c96d2);}(_0xb49a,0xfb));var _0xab49=function(_0x2e8802,_0x59ad8c){_0x2e8802=_0x2e8802-0x0;var _0x4617aa=_0xb49a[_0x2e8802];return _0x4617aa;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var logger=require(_0xab49('0x2'))(_0xab49('0x3'));var moment=require(_0xab49('0x4'));var BPromise=require('bluebird');var rp=require(_0xab49('0x5'));var fs=require('fs');var path=require(_0xab49('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xab49('0x7'));module[_0xab49('0x8')]=function(_0x1cae1d,_0x3703cb){return _0x1cae1d[_0xab49('0x9')](_0xab49('0xa'),attributes,{'tableName':_0xab49('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xab49('0xc'),'to'],'type':_0xab49('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xf12653,_0x79f764,_0x69cb46){if(_0xf12653['substatus']){_0xf12653['substatusAt']=moment()[_0xab49('0xe')](_0xab49('0xf'));}if(_0xf12653[_0xab49('0x10')]){_0xf12653[_0xab49('0x11')]=moment()[_0xab49('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x69cb46(null,_0x79f764);},'beforeUpdate':function(_0x1515d7,_0xdd380a,_0x34af0d){if(_0x1515d7[_0xab49('0x12')](_0xab49('0x13'))){_0x1515d7[_0xab49('0x14')]=_0x1515d7[_0xab49('0x13')]?moment()[_0xab49('0xe')](_0xab49('0xf')):null;}if(_0x1515d7[_0xab49('0x12')](_0xab49('0x10'))){_0x1515d7['closedAt']=moment()[_0xab49('0xe')](_0xab49('0xf'));_0x1515d7[_0xab49('0x13')]=null;_0x1515d7[_0xab49('0x14')]=null;}_0x34af0d(null,_0x1515d7);},'afterUpdate':function(_0x14d8b8,_0x589dc4,_0x44a3a9){var _0x2cbcff=_0x1cae1d[_0xab49('0x15')];var _0xcaa6ca=_0x14d8b8[_0xab49('0x16')]({'plain':!![]});if(_0xcaa6ca['closed']){return _0x2cbcff[_0xab49('0x17')][_0xab49('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0xcaa6ca['id']}})[_0xab49('0x19')](function(){_0x44a3a9();})['catch'](function(_0x4c22cd){_0x44a3a9(_0x4c22cd);});}else{_0x44a3a9();}}},'charset':_0xab49('0x1a'),'collate':_0xab49('0x1b')});}; \ No newline at end of file +var _0xb441=['substatusAt','YYYY-MM-DD\x20HH:mm:ss','format','changed','closed','models','MailMessage','catch','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus'];(function(_0x5269c2,_0x47b8e0){var _0x326589=function(_0x144a99){while(--_0x144a99){_0x5269c2['push'](_0x5269c2['shift']());}};_0x326589(++_0x47b8e0);}(_0xb441,0xa5));var _0x1b44=function(_0x35dbda,_0x14cd90){_0x35dbda=_0x35dbda-0x0;var _0x64c649=_0xb441[_0x35dbda];return _0x64c649;};'use strict';var _=require(_0x1b44('0x0'));var util=require('util');var logger=require(_0x1b44('0x1'))('api');var moment=require(_0x1b44('0x2'));var BPromise=require(_0x1b44('0x3'));var rp=require(_0x1b44('0x4'));var fs=require('fs');var path=require(_0x1b44('0x5'));var rimraf=require(_0x1b44('0x6'));var config=require(_0x1b44('0x7'));var attributes=require(_0x1b44('0x8'));module[_0x1b44('0x9')]=function(_0x264f3c,_0x47b04c){return _0x264f3c[_0x1b44('0xa')](_0x1b44('0xb'),attributes,{'tableName':_0x1b44('0xc'),'paranoid':![],'indexes':[{'name':_0x1b44('0xd'),'fields':[_0x1b44('0xe'),'to'],'type':_0x1b44('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x295e1a,_0x22dff3,_0x5caa5f){if(_0x295e1a[_0x1b44('0x10')]){_0x295e1a[_0x1b44('0x11')]=moment()['format'](_0x1b44('0x12'));}if(_0x295e1a['closed']){_0x295e1a['closedAt']=moment()[_0x1b44('0x13')](_0x1b44('0x12'));}_0x5caa5f(null,_0x22dff3);},'beforeUpdate':function(_0x383fc2,_0x44db95,_0x4de83b){if(_0x383fc2[_0x1b44('0x14')](_0x1b44('0x10'))){_0x383fc2[_0x1b44('0x11')]=_0x383fc2['substatus']?moment()['format'](_0x1b44('0x12')):null;}if(_0x383fc2[_0x1b44('0x14')](_0x1b44('0x15'))){_0x383fc2['closedAt']=moment()[_0x1b44('0x13')](_0x1b44('0x12'));_0x383fc2[_0x1b44('0x10')]=null;_0x383fc2[_0x1b44('0x11')]=null;}_0x4de83b(null,_0x383fc2);},'afterUpdate':function(_0x435c52,_0x3f2198,_0x1466cc){var _0x5d1cf0=_0x264f3c[_0x1b44('0x16')];var _0x57f9dc=_0x435c52['get']({'plain':!![]});if(_0x57f9dc[_0x1b44('0x15')]){return _0x5d1cf0[_0x1b44('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x57f9dc['id']}})['then'](function(){_0x1466cc();})[_0x1b44('0x18')](function(_0xe4c7f5){_0x1466cc(_0xe4c7f5);});}else{_0x1466cc();}}},'charset':'utf8mb4','collate':_0x1b44('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index cde3798..576851c 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 _0x3b59=['defaults','socket.io-emitter','./mailInteraction.socket','register','request','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','where','attributes','limit','AddTagsToMailInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x3b59,0x9c));var _0x93b5=function(_0x45f88d,_0x1e0650){_0x45f88d=_0x45f88d-0x0;var _0x464d5e=_0x3b59[_0x45f88d];return _0x464d5e;};'use strict';var _=require(_0x93b5('0x0'));var util=require(_0x93b5('0x1'));var moment=require(_0x93b5('0x2'));var BPromise=require(_0x93b5('0x3'));var rs=require(_0x93b5('0x4'));var fs=require('fs');var Redis=require(_0x93b5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x93b5('0x6'));var logger=require('../../config/logger')(_0x93b5('0x7'));var config=require(_0x93b5('0x8'));var jayson=require(_0x93b5('0x9'));var client=jayson[_0x93b5('0xa')]['http']({'port':0x232a});config[_0x93b5('0xb')]=_[_0x93b5('0xc')](config[_0x93b5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x93b5('0xd'))(new Redis(config[_0x93b5('0xb')]));require(_0x93b5('0xe'))[_0x93b5('0xf')](socket);function respondWithRpcPromise(_0x2a49bb,_0x490b0d,_0x576916){return new BPromise(function(_0x13ebc9,_0x7787e5){return client[_0x93b5('0x10')](_0x2a49bb,_0x576916)[_0x93b5('0x11')](function(_0x47c236){logger[_0x93b5('0x12')](_0x93b5('0x13'),_0x490b0d,'request\x20sent');logger[_0x93b5('0x14')](_0x93b5('0x15'),_0x490b0d,_0x93b5('0x16'),JSON[_0x93b5('0x17')](_0x47c236));if(_0x47c236[_0x93b5('0x18')]){if(_0x47c236['error'][_0x93b5('0x19')]===0x1f4){logger[_0x93b5('0x18')]('MailInteraction,\x20%s,\x20%s',_0x490b0d,_0x47c236[_0x93b5('0x18')][_0x93b5('0x1a')]);return _0x7787e5(_0x47c236[_0x93b5('0x18')]['message']);}logger[_0x93b5('0x18')]('MailInteraction,\x20%s,\x20%s',_0x490b0d,_0x47c236['error'][_0x93b5('0x1a')]);return _0x13ebc9(_0x47c236['error'][_0x93b5('0x1a')]);}else{logger[_0x93b5('0x12')](_0x93b5('0x13'),_0x490b0d,'request\x20sent');_0x13ebc9(_0x47c236['result']['message']);}})[_0x93b5('0x1b')](function(_0x28f5cc){logger[_0x93b5('0x18')](_0x93b5('0x13'),_0x490b0d,_0x28f5cc);_0x7787e5(_0x28f5cc);});});}exports[_0x93b5('0x1c')]=function(_0x1f0196){var _0x2dd622=this;return new Promise(function(_0x2bd21b,_0x352cbe){return db[_0x93b5('0x1d')]['update'](_0x1f0196['body'],{'raw':_0x1f0196[_0x93b5('0x1e')]?_0x1f0196[_0x93b5('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f0196[_0x93b5('0x1e')]?_0x1f0196[_0x93b5('0x1e')][_0x93b5('0x1f')]||null:null,'attributes':_0x1f0196[_0x93b5('0x1e')]?_0x1f0196[_0x93b5('0x1e')][_0x93b5('0x20')]||null:null,'limit':_0x1f0196[_0x93b5('0x1e')]?_0x1f0196[_0x93b5('0x1e')][_0x93b5('0x21')]||null:null})[_0x93b5('0x11')](function(_0xf7b6fc){logger[_0x93b5('0x12')](_0x93b5('0x1c'),_0x1f0196);logger[_0x93b5('0x14')](_0x93b5('0x1c'),_0x1f0196,JSON[_0x93b5('0x17')](_0xf7b6fc));_0x2bd21b(_0xf7b6fc);})[_0x93b5('0x1b')](function(_0x11add6){logger['error'](_0x93b5('0x1c'),_0x11add6[_0x93b5('0x1a')],_0x1f0196);_0x352cbe(_0x2dd622[_0x93b5('0x18')](0x1f4,_0x11add6[_0x93b5('0x1a')]));});});};exports[_0x93b5('0x22')]=function(_0x3d3ace){return new Promise(function(_0x2dad64,_0x2905a8){return db['MailInteraction'][_0x93b5('0x23')]({'where':_0x3d3ace[_0x93b5('0x1e')]?_0x3d3ace['options'][_0x93b5('0x1f')]||null:null})['then'](function(_0x393b6b){if(_0x393b6b){return _0x393b6b[_0x93b5('0x24')](_0x3d3ace[_0x93b5('0x25')][_0x93b5('0x26')],_[_0x93b5('0x27')](_0x3d3ace[_0x93b5('0x25')],[_0x93b5('0x26'),'id'])||{});}})[_0x93b5('0x28')](function(_0x8504b8){logger[_0x93b5('0x12')]('AddTags',_0x3d3ace);logger[_0x93b5('0x14')]('AddTags',_0x3d3ace,JSON['stringify'](_0x8504b8));_0x2dad64(_0x8504b8);})['catch'](function(_0x5af234){logger[_0x93b5('0x18')](_0x93b5('0x29'),_0x5af234[_0x93b5('0x1a')],_0x3d3ace);_0x2905a8(_this[_0x93b5('0x18')](0x1f4,_0x5af234[_0x93b5('0x1a')]));});});}; \ No newline at end of file +var _0x342b=['attributes','UpdateMailInteraction','debug','stringify','AddTagsToMailInteraction','ids','omit','AddTags','lodash','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailInteraction','update','body','options','where'];(function(_0x2a1c7,_0x54230e){var _0x4ec951=function(_0xcf7eed){while(--_0xcf7eed){_0x2a1c7['push'](_0x2a1c7['shift']());}};_0x4ec951(++_0x54230e);}(_0x342b,0xbc));var _0xb342=function(_0x295bf9,_0x24cc4f){_0x295bf9=_0x295bf9-0x0;var _0x3123b8=_0x342b[_0x295bf9];return _0x3123b8;};'use strict';var _=require(_0xb342('0x0'));var util=require('util');var moment=require(_0xb342('0x1'));var BPromise=require(_0xb342('0x2'));var rs=require(_0xb342('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb342('0x4'));var config=require(_0xb342('0x5'));var jayson=require(_0xb342('0x6'));var client=jayson[_0xb342('0x7')][_0xb342('0x8')]({'port':0x232a});config[_0xb342('0x9')]=_[_0xb342('0xa')](config[_0xb342('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb342('0x9')]));require(_0xb342('0xb'))['register'](socket);function respondWithRpcPromise(_0x578e36,_0x3fc499,_0x385ef1){return new BPromise(function(_0xdf3923,_0x15512d){return client[_0xb342('0xc')](_0x578e36,_0x385ef1)[_0xb342('0xd')](function(_0x6c54f3){logger[_0xb342('0xe')](_0xb342('0xf'),_0x3fc499,_0xb342('0x10'));logger['debug'](_0xb342('0x11'),_0x3fc499,'request\x20sent',JSON['stringify'](_0x6c54f3));if(_0x6c54f3['error']){if(_0x6c54f3[_0xb342('0x12')][_0xb342('0x13')]===0x1f4){logger[_0xb342('0x12')](_0xb342('0xf'),_0x3fc499,_0x6c54f3[_0xb342('0x12')][_0xb342('0x14')]);return _0x15512d(_0x6c54f3[_0xb342('0x12')][_0xb342('0x14')]);}logger['error'](_0xb342('0xf'),_0x3fc499,_0x6c54f3[_0xb342('0x12')]['message']);return _0xdf3923(_0x6c54f3['error']['message']);}else{logger[_0xb342('0xe')](_0xb342('0xf'),_0x3fc499,'request\x20sent');_0xdf3923(_0x6c54f3[_0xb342('0x15')][_0xb342('0x14')]);}})[_0xb342('0x16')](function(_0x95c8d7){logger[_0xb342('0x12')]('MailInteraction,\x20%s,\x20%s',_0x3fc499,_0x95c8d7);_0x15512d(_0x95c8d7);});});}exports['UpdateMailInteraction']=function(_0x177557){var _0x529ac8=this;return new Promise(function(_0x341a3c,_0x362af8){return db[_0xb342('0x17')][_0xb342('0x18')](_0x177557[_0xb342('0x19')],{'raw':_0x177557['options']?_0x177557[_0xb342('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x177557[_0xb342('0x1a')]?_0x177557['options'][_0xb342('0x1b')]||null:null,'attributes':_0x177557[_0xb342('0x1a')]?_0x177557[_0xb342('0x1a')][_0xb342('0x1c')]||null:null,'limit':_0x177557['options']?_0x177557[_0xb342('0x1a')]['limit']||null:null})['then'](function(_0x2b1a8e){logger['info'](_0xb342('0x1d'),_0x177557);logger[_0xb342('0x1e')](_0xb342('0x1d'),_0x177557,JSON[_0xb342('0x1f')](_0x2b1a8e));_0x341a3c(_0x2b1a8e);})['catch'](function(_0x120892){logger[_0xb342('0x12')](_0xb342('0x1d'),_0x120892[_0xb342('0x14')],_0x177557);_0x362af8(_0x529ac8[_0xb342('0x12')](0x1f4,_0x120892[_0xb342('0x14')]));});});};exports[_0xb342('0x20')]=function(_0x59f5b4){return new Promise(function(_0xda954f,_0x168d1b){return db[_0xb342('0x17')]['find']({'where':_0x59f5b4['options']?_0x59f5b4['options'][_0xb342('0x1b')]||null:null})['then'](function(_0x9c8a7e){if(_0x9c8a7e){return _0x9c8a7e['addTags'](_0x59f5b4[_0xb342('0x19')][_0xb342('0x21')],_[_0xb342('0x22')](_0x59f5b4[_0xb342('0x19')],[_0xb342('0x21'),'id'])||{});}})['spread'](function(_0x49a3bc){logger[_0xb342('0xe')](_0xb342('0x23'),_0x59f5b4);logger['debug'](_0xb342('0x23'),_0x59f5b4,JSON['stringify'](_0x49a3bc));_0xda954f(_0x49a3bc);})[_0xb342('0x16')](function(_0x670911){logger[_0xb342('0x12')](_0xb342('0x23'),_0x670911[_0xb342('0x14')],_0x59f5b4);_0x168d1b(_this[_0xb342('0x12')](0x1f4,_0x670911[_0xb342('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index b8dff36..cef4912 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 _0xff11=['removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove','update'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xff11,0xac));var _0x1ff1=function(_0x24eb6f,_0x91aa4b){_0x24eb6f=_0x24eb6f-0x0;var _0x512aab=_0xff11[_0x24eb6f];return _0x512aab;};'use strict';var MailInteractionEvents=require(_0x1ff1('0x0'));var events=[_0x1ff1('0x1'),_0x1ff1('0x2'),_0x1ff1('0x3')];function createListener(_0x14c1eb,_0x15733b){return function(_0x325b35){_0x15733b['emit'](_0x14c1eb,_0x325b35);};}function removeListener(_0x39a1d1,_0x55f0ab){return function(){MailInteractionEvents[_0x1ff1('0x4')](_0x39a1d1,_0x55f0ab);};}exports[_0x1ff1('0x5')]=function(_0x498de5){for(var _0xd3f185=0x0,_0x17d20f=events[_0x1ff1('0x6')];_0xd3f185<_0x17d20f;_0xd3f185++){var _0x42b1cf=events[_0xd3f185];var _0x61c1fb=createListener(_0x1ff1('0x7')+_0x42b1cf,_0x498de5);MailInteractionEvents['on'](_0x42b1cf,_0x61c1fb);}}; \ No newline at end of file +var _0xc8c2=['mailInteraction:','./mailInteraction.events','remove','update','length'];(function(_0x2f6755,_0x964cad){var _0x241b6f=function(_0x42d5e3){while(--_0x42d5e3){_0x2f6755['push'](_0x2f6755['shift']());}};_0x241b6f(++_0x964cad);}(_0xc8c2,0x146));var _0x2c8c=function(_0x3ffb80,_0x209661){_0x3ffb80=_0x3ffb80-0x0;var _0x3a8a4c=_0xc8c2[_0x3ffb80];return _0x3a8a4c;};'use strict';var MailInteractionEvents=require(_0x2c8c('0x0'));var events=['save',_0x2c8c('0x1'),_0x2c8c('0x2')];function createListener(_0x470bd9,_0x4f678d){return function(_0x540963){_0x4f678d['emit'](_0x470bd9,_0x540963);};}function removeListener(_0x387654,_0x6c3c57){return function(){MailInteractionEvents['removeListener'](_0x387654,_0x6c3c57);};}exports['register']=function(_0x2dbf86){for(var _0x307a91=0x0,_0x5e6c3c=events[_0x2c8c('0x3')];_0x307a91<_0x5e6c3c;_0x307a91++){var _0x2a483b=events[_0x307a91];var _0x20ee76=createListener(_0x2c8c('0x4')+_0x2a483b,_0x2dbf86);MailInteractionEvents['on'](_0x2a483b,_0x20ee76);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index fe8ef32..6aa27e1 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 _0xe5b3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','mail','create','put','update','/:id/accept','accept','reject','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x3d6053,_0x1e9516){var _0x380385=function(_0x4c9db5){while(--_0x4c9db5){_0x3d6053['push'](_0x3d6053['shift']());}};_0x380385(++_0x1e9516);}(_0xe5b3,0x133));var _0x3e5b=function(_0x50829b,_0x57e56a){_0x50829b=_0x50829b-0x0;var _0x2ef4db=_0xe5b3[_0x50829b];return _0x2ef4db;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var auth=require(_0x3e5b('0x5'));var interaction=require(_0x3e5b('0x6'));var config=require(_0x3e5b('0x7'));var controller=require(_0x3e5b('0x8'));router[_0x3e5b('0x9')]('/',auth[_0x3e5b('0xa')](),controller['index']);router[_0x3e5b('0x9')](_0x3e5b('0xb'),auth['isAuthenticated'](),controller[_0x3e5b('0xc')]);router[_0x3e5b('0x9')](_0x3e5b('0xd'),auth[_0x3e5b('0xa')](),controller['show']);router['get'](_0x3e5b('0xe'),auth[_0x3e5b('0xa')](),controller[_0x3e5b('0xf')]);router[_0x3e5b('0x10')]('/',auth[_0x3e5b('0xa')](),interaction['tracked'](_0x3e5b('0x11'),'mailmessage:create'),controller[_0x3e5b('0x12')]);router[_0x3e5b('0x13')](_0x3e5b('0xd'),auth[_0x3e5b('0xa')](),controller[_0x3e5b('0x14')]);router[_0x3e5b('0x13')](_0x3e5b('0x15'),auth['isAuthenticated'](),controller[_0x3e5b('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x3e5b('0x17')]);router[_0x3e5b('0x18')](_0x3e5b('0xd'),auth['isAuthenticated'](),controller[_0x3e5b('0x19')]);module['exports']=router; \ No newline at end of file +var _0x98a8=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','mail','create','update','accept','put','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x98a8,0x12c));var _0x898a=function(_0x5bc419,_0x8ca530){_0x5bc419=_0x5bc419-0x0;var _0xd7a844=_0x98a8[_0x5bc419];return _0xd7a844;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['get'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0xf')]);router[_0x898a('0x9')](_0x898a('0x10'),auth[_0x898a('0xa')](),controller[_0x898a('0x11')]);router[_0x898a('0x12')]('/',auth[_0x898a('0xa')](),interaction['tracked'](_0x898a('0x13'),'mailmessage:create'),controller[_0x898a('0x14')]);router['put'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0x15')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x898a('0x16')]);router[_0x898a('0x17')](_0x898a('0x18'),auth[_0x898a('0xa')](),controller[_0x898a('0x19')]);router[_0x898a('0x1a')]('/:id',auth[_0x898a('0xa')](),controller['destroy']);module[_0x898a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 4ee23bc..29c6f2b 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 _0x32f4=['long','DATE','INTEGER','BOOLEAN','sequelize','lodash','exports','TEXT','medium','ENUM','out','STRING'];(function(_0x5f0979,_0xfcf1eb){var _0x4e3366=function(_0x4f3ec1){while(--_0x4f3ec1){_0x5f0979['push'](_0x5f0979['shift']());}};_0x4e3366(++_0xfcf1eb);}(_0x32f4,0x154));var _0x432f=function(_0x11b359,_0x1ac5f9){_0x11b359=_0x11b359-0x0;var _0x2bd1e2=_0x32f4[_0x11b359];return _0x2bd1e2;};'use strict';var Sequelize=require(_0x432f('0x0'));var _=require(_0x432f('0x1'));module[_0x432f('0x2')]={'body':{'type':Sequelize[_0x432f('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x432f('0x3')](_0x432f('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x432f('0x5')]('in',_0x432f('0x6')),'defaultValue':_0x432f('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x432f('0x7')](0x1fe)},'from':{'type':Sequelize[_0x432f('0x7')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x432f('0x3')](_0x432f('0x8'))},'bcc':{'type':Sequelize['TEXT'](_0x432f('0x8'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x432f('0x9')]},'attach':{'type':Sequelize[_0x432f('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x432f('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x432f('0x9')]},'originTo':{'type':Sequelize[_0x432f('0x3')]('long')},'originCc':{'type':Sequelize[_0x432f('0x3')]('long')}}; \ No newline at end of file +var _0x8aad=['BOOLEAN','DATE','sequelize','lodash','TEXT','medium','out','STRING','long'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8aad,0x146));var _0xd8aa=function(_0x453d64,_0x22cd7b){_0x453d64=_0x453d64-0x0;var _0x1c3fea=_0x8aad[_0x453d64];return _0x1c3fea;};'use strict';var Sequelize=require(_0xd8aa('0x0'));var _=require(_0xd8aa('0x1'));module['exports']={'body':{'type':Sequelize[_0xd8aa('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xd8aa('0x2')](_0xd8aa('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd8aa('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xd8aa('0x5')]},'to':{'type':Sequelize[_0xd8aa('0x2')](_0xd8aa('0x6'))},'cc':{'type':Sequelize['TEXT'](_0xd8aa('0x6'))},'bcc':{'type':Sequelize[_0xd8aa('0x2')](_0xd8aa('0x6'))},'subject':{'type':Sequelize[_0xd8aa('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xd8aa('0x7')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xd8aa('0x8')]},'originTo':{'type':Sequelize[_0xd8aa('0x2')](_0xd8aa('0x6'))},'originCc':{'type':Sequelize[_0xd8aa('0x2')]('long')}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index d304a66..4c7f31b 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 _0x0462=['update','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','offset','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','MailMessage','findAll','rows','show','params','keys','length','find','body','describe','create','direction','out','secret','split','MailAccountId','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','pass','user','attachments','join','root','defaults','ListId','List\x20not\x20found','sendMail','messageId','mail-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','MailInteraction','MailInteractionId','format','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','event','reject','rejectmessage','download','toString','server','files','message-%s.eml','from','bcc','subject','Attachment','Attachments','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','count','limit','set','json','save'];(function(_0x340c0f,_0x3f434a){var _0x4e5d8f=function(_0x4e00ea){while(--_0x4e00ea){_0x340c0f['push'](_0x340c0f['shift']());}};_0x4e5d8f(++_0x3f434a);}(_0x0462,0x77));var _0x2046=function(_0x56face,_0x2c9228){_0x56face=_0x56face-0x0;var _0x16b75a=_0x0462[_0x56face];return _0x16b75a;};'use strict';var pdf=require(_0x2046('0x0'));var emlformat=require(_0x2046('0x1'));var rimraf=require(_0x2046('0x2'));var zipdir=require(_0x2046('0x3'));var jsonpatch=require(_0x2046('0x4'));var rp=require(_0x2046('0x5'));var moment=require(_0x2046('0x6'));var BPromise=require(_0x2046('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2046('0x8'));var sox=require(_0x2046('0x9'));var csv=require('to-csv');var ejs=require(_0x2046('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2046('0xb'));var crypto=require('crypto');var jsforce=require(_0x2046('0xc'));var deskjs=require(_0x2046('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2046('0xe'));var authService=require(_0x2046('0xf'));var qs=require(_0x2046('0x10'));var as=require(_0x2046('0x11'));var hardwareService=require(_0x2046('0x12'));var logger=require(_0x2046('0x13'))(_0x2046('0x14'));var utils=require('../../config/utils');var config=require(_0x2046('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x2046('0x16')],{'host':_0x2046('0x17'),'port':0x18eb});var socket=require(_0x2046('0x18'))(new Redis(config[_0x2046('0x16')]));require(_0x2046('0x19'))[_0x2046('0x1a')](socket);var jayson=require(_0x2046('0x1b'));var client=jayson[_0x2046('0x1c')][_0x2046('0x1d')]({'port':0x232c});var client9003=jayson[_0x2046('0x1c')]['http']({'port':0x232b});var client9002=jayson[_0x2046('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x227524,_0x16e09b,_0x4948f4){if(_0x4948f4){var _0x1a0888=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a0888[_0x2046('0x1e')](_0x16e09b)){return _0x227524;}else{throw new db[(_0x2046('0x1f'))][(_0x2046('0x20'))](_0x2046('0x21'));}}else{return _0x227524;}}function respondWithRpcPromise(_0x289115,_0xe36164,_0x3cfd80,_0x3113a3){return new BPromise(function(_0x3a73ab,_0x4f6517){var _0x46786f=_0x3113a3||client;return _0x46786f[_0x2046('0x22')](_0x289115,_0x3cfd80)[_0x2046('0x23')](function(_0x149b83){logger[_0x2046('0x24')](_0x2046('0x25'),_0xe36164,_0x2046('0x26'));logger[_0x2046('0x27')](_0x2046('0x28'),_0xe36164,'request\x20sent',JSON[_0x2046('0x29')](_0x149b83));if(_0x149b83[_0x2046('0x2a')]){if(_0x149b83[_0x2046('0x2a')][_0x2046('0x2b')]===0x1f4){logger['error'](_0x2046('0x25'),_0xe36164,_0x149b83[_0x2046('0x2a')][_0x2046('0x2c')]);return _0x4f6517(_0x149b83[_0x2046('0x2a')][_0x2046('0x2c')]);}logger[_0x2046('0x2a')](_0x2046('0x25'),_0xe36164,_0x149b83['error'][_0x2046('0x2c')]);return _0x3a73ab(_0x149b83[_0x2046('0x2a')]['message']);}else{logger[_0x2046('0x24')](_0x2046('0x25'),_0xe36164,'request\x20sent');_0x3a73ab(_0x149b83[_0x2046('0x2d')][_0x2046('0x2c')]);}})[_0x2046('0x2e')](function(_0x2ab274){logger[_0x2046('0x2a')]('MailMessage,\x20%s,\x20%s',_0xe36164,_0x2ab274);_0x4f6517(_0x2ab274);});});}function respondWithStatusCode(_0x14d3a6,_0x5557d0){_0x5557d0=_0x5557d0||0xcc;return function(_0x307c55){if(_0x307c55){return _0x14d3a6['sendStatus'](_0x5557d0);}return _0x14d3a6[_0x2046('0x2f')](_0x5557d0)[_0x2046('0x30')]();};}function respondWithResult(_0x1ada00,_0x327f43){_0x327f43=_0x327f43||0xc8;return function(_0x281efc){if(_0x281efc){return _0x1ada00[_0x2046('0x2f')](_0x327f43)['json'](_0x281efc);}};}function respondWithFilteredResult(_0x1c13e6,_0x11a666){return function(_0x3002e8){if(_0x3002e8){var _0x588ff6=_0x3002e8[_0x2046('0x31')],_0x3bff7c=_0x11a666['offset'],_0x5c5796=_0x11a666['offset']+_0x11a666[_0x2046('0x32')],_0x4b9650;if(_0x5c5796>=_0x588ff6){_0x5c5796=_0x588ff6;_0x4b9650=0xc8;}else{_0x4b9650=0xce;}_0x1c13e6['status'](_0x4b9650);return _0x1c13e6[_0x2046('0x33')]('Content-Range',_0x3bff7c+'-'+_0x5c5796+'/'+_0x588ff6)[_0x2046('0x34')](_0x3002e8);}return null;};}function patchUpdates(_0x474ac3){return function(_0x2a1d87){try{jsonpatch['apply'](_0x2a1d87,_0x474ac3,!![]);}catch(_0x255ee9){return BPromise['reject'](_0x255ee9);}return _0x2a1d87[_0x2046('0x35')]();};}function saveUpdates(_0x47ad2d,_0x312dd8){return function(_0x19272a){if(_0x19272a){return _0x19272a[_0x2046('0x36')](_0x47ad2d)[_0x2046('0x23')](function(_0x162dbb){return _0x162dbb;});}return null;};}function removeEntity(_0x368c33,_0x4c01fd){return function(_0x54a06e){if(_0x54a06e){return _0x54a06e[_0x2046('0x37')]()['then'](function(){_0x368c33[_0x2046('0x2f')](0xcc)[_0x2046('0x30')]();});}};}function handleEntityNotFound(_0x33e2f8,_0x43bb02){return function(_0x4a4cc5){if(!_0x4a4cc5){_0x33e2f8[_0x2046('0x38')](0x194);}return _0x4a4cc5;};}function handleError(_0x361c99,_0x35079e){_0x35079e=_0x35079e||0x1f4;return function(_0x58afb7){logger[_0x2046('0x2a')](_0x58afb7[_0x2046('0x39')]);if(_0x58afb7['name']){delete _0x58afb7[_0x2046('0x3a')];}_0x361c99[_0x2046('0x2f')](_0x35079e)['send'](_0x58afb7);};}exports[_0x2046('0x3b')]=function(_0x1f420a,_0x21cee2){var _0x6ddcc0={},_0xd47520={},_0x29ad35={'count':0x0,'rows':[]};var _0x5675a6=_[_0x2046('0x3c')](db['MailMessage'][_0x2046('0x3d')],function(_0x36c1d2){return{'name':_0x36c1d2[_0x2046('0x3e')],'type':_0x36c1d2[_0x2046('0x3f')][_0x2046('0x40')]};});_0xd47520[_0x2046('0x41')]=_[_0x2046('0x3c')](_0x5675a6,'name');_0xd47520[_0x2046('0x42')]=_['keys'](_0x1f420a['query']);_0xd47520[_0x2046('0x43')]=_[_0x2046('0x44')](_0xd47520[_0x2046('0x41')],_0xd47520[_0x2046('0x42')]);_0x6ddcc0[_0x2046('0x45')]=_[_0x2046('0x44')](_0xd47520[_0x2046('0x41')],qs[_0x2046('0x46')](_0x1f420a[_0x2046('0x42')][_0x2046('0x46')]));_0x6ddcc0[_0x2046('0x45')]=_0x6ddcc0[_0x2046('0x45')]['length']?_0x6ddcc0[_0x2046('0x45')]:_0xd47520[_0x2046('0x41')];if(!_0x1f420a['query']['hasOwnProperty'](_0x2046('0x47'))){_0x6ddcc0[_0x2046('0x32')]=qs['limit'](_0x1f420a[_0x2046('0x42')][_0x2046('0x32')]);_0x6ddcc0[_0x2046('0x48')]=qs[_0x2046('0x48')](_0x1f420a[_0x2046('0x42')][_0x2046('0x48')]);}_0x6ddcc0[_0x2046('0x49')]=qs['sort'](_0x1f420a['query'][_0x2046('0x4a')]);_0x6ddcc0['where']=qs[_0x2046('0x43')](_[_0x2046('0x4b')](_0x1f420a['query'],_0xd47520[_0x2046('0x43')]));if(_0x1f420a[_0x2046('0x42')][_0x2046('0x4c')]){_0x6ddcc0[_0x2046('0x4d')]=_['merge'](_0x6ddcc0['where'],{'$or':_[_0x2046('0x3c')](_0x5675a6,function(_0xda225e){if(_0xda225e[_0x2046('0x3f')]!==_0x2046('0x4e')){var _0x2efb77={};_0x2efb77[_0xda225e['name']]={'$like':'%'+_0x1f420a['query'][_0x2046('0x4c')]+'%'};return _0x2efb77;}})});}_0x6ddcc0=_[_0x2046('0x4f')]({},_0x6ddcc0,_0x1f420a[_0x2046('0x50')]);var _0x49d9ae={'where':_0x6ddcc0[_0x2046('0x4d')]};return db['MailMessage'][_0x2046('0x31')](_0x49d9ae)['then'](function(_0x8f4233){_0x29ad35['count']=_0x8f4233;if(_0x1f420a[_0x2046('0x42')][_0x2046('0x51')]){_0x6ddcc0[_0x2046('0x52')]=[{'all':!![]}];}return db[_0x2046('0x53')][_0x2046('0x54')](_0x6ddcc0);})[_0x2046('0x23')](function(_0x3a030f){_0x29ad35[_0x2046('0x55')]=_0x3a030f;return _0x29ad35;})['then'](respondWithFilteredResult(_0x21cee2,_0x6ddcc0))[_0x2046('0x2e')](handleError(_0x21cee2,null));};exports[_0x2046('0x56')]=function(_0x1e6b94,_0x56959e){var _0x5d9454={'raw':!![],'where':{'id':_0x1e6b94[_0x2046('0x57')]['id']}},_0x583df9={};_0x583df9[_0x2046('0x41')]=_[_0x2046('0x58')](db[_0x2046('0x53')]['rawAttributes']);_0x583df9[_0x2046('0x42')]=_['keys'](_0x1e6b94[_0x2046('0x42')]);_0x583df9[_0x2046('0x43')]=_[_0x2046('0x44')](_0x583df9[_0x2046('0x41')],_0x583df9[_0x2046('0x42')]);_0x5d9454['attributes']=_[_0x2046('0x44')](_0x583df9[_0x2046('0x41')],qs['fields'](_0x1e6b94[_0x2046('0x42')][_0x2046('0x46')]));_0x5d9454[_0x2046('0x45')]=_0x5d9454[_0x2046('0x45')][_0x2046('0x59')]?_0x5d9454[_0x2046('0x45')]:_0x583df9[_0x2046('0x41')];if(_0x1e6b94[_0x2046('0x42')][_0x2046('0x51')]){_0x5d9454[_0x2046('0x52')]=[{'all':!![]}];}_0x5d9454=_[_0x2046('0x4f')]({},_0x5d9454,_0x1e6b94[_0x2046('0x50')]);return db[_0x2046('0x53')][_0x2046('0x5a')](_0x5d9454)[_0x2046('0x23')](handleEntityNotFound(_0x56959e,null))['then'](respondWithResult(_0x56959e,null))[_0x2046('0x2e')](handleError(_0x56959e,null));};exports[_0x2046('0x36')]=function(_0x42a0e7,_0x2ddeef){if(_0x42a0e7[_0x2046('0x5b')]['id']){delete _0x42a0e7[_0x2046('0x5b')]['id'];}return db[_0x2046('0x53')][_0x2046('0x5a')]({'where':{'id':_0x42a0e7[_0x2046('0x57')]['id']}})[_0x2046('0x23')](handleEntityNotFound(_0x2ddeef,null))[_0x2046('0x23')](saveUpdates(_0x42a0e7[_0x2046('0x5b')],null))[_0x2046('0x23')](respondWithResult(_0x2ddeef,null))[_0x2046('0x2e')](handleError(_0x2ddeef,null));};exports[_0x2046('0x37')]=function(_0x13fa53,_0x4100ee){return db['MailMessage'][_0x2046('0x5a')]({'where':{'id':_0x13fa53[_0x2046('0x57')]['id']}})[_0x2046('0x23')](handleEntityNotFound(_0x4100ee,null))[_0x2046('0x23')](removeEntity(_0x4100ee,null))[_0x2046('0x2e')](handleError(_0x4100ee,null));};exports[_0x2046('0x5c')]=function(_0x2e7cf2,_0x16ff49){return db['MailMessage']['describe']()[_0x2046('0x23')](respondWithResult(_0x16ff49,null))[_0x2046('0x2e')](handleError(_0x16ff49,null));};exports[_0x2046('0x5d')]=function(_0x29c6c3,_0x42cd67){return db[_0x2046('0x53')][_0x2046('0x5d')](_0x29c6c3[_0x2046('0x5b')])[_0x2046('0x23')](function(_0x29188c){if(_0x29188c){if(_0x29188c[_0x2046('0x5e')]===_0x2046('0x5f')&&!_0x29188c[_0x2046('0x60')]){var _0x94793c,_0x60e883,_0x31bcbb;if(_0x29c6c3[_0x2046('0x5b')]['to']){_0x60e883=_0x29c6c3['body']['to'][_0x2046('0x61')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x29188c[_0x2046('0x62')]},'include':[{'model':db[_0x2046('0x63')],'as':_0x2046('0x64'),'include':[{'model':db[_0x2046('0x65')],'as':_0x2046('0x66'),'where':{'email':_0x60e883},'limit':0x1,'order':[['updatedAt',_0x2046('0x67')]]}]},{'model':db[_0x2046('0x68')],'as':_0x2046('0x69'),'raw':!![]}]})[_0x2046('0x23')](function(_0x157aa3){_0x94793c=_0x157aa3;if(_0x94793c&&_0x94793c[_0x2046('0x69')]){var _0x3526e6={'tls':{'rejectUnauthorized':![]}};if(_[_0x2046('0x6a')](_0x94793c[_0x2046('0x69')][_0x2046('0x6b')])){_0x3526e6[_0x2046('0x6c')]=_0x94793c[_0x2046('0x69')][_0x2046('0x6c')];_0x3526e6[_0x2046('0x6d')]=_0x94793c['Smtp'][_0x2046('0x6d')];_0x3526e6[_0x2046('0x6e')]=_0x94793c[_0x2046('0x69')][_0x2046('0x6e')];if(_0x94793c[_0x2046('0x69')][_0x2046('0x6f')]){_0x3526e6[_0x2046('0x70')]={'user':_0x94793c[_0x2046('0x69')]['user'],'pass':_0x94793c[_0x2046('0x69')][_0x2046('0x71')]};}}else{_0x3526e6['service']=_0x94793c['Smtp']['service'];_0x3526e6[_0x2046('0x70')]={'user':_0x94793c[_0x2046('0x69')][_0x2046('0x72')],'pass':_0x94793c[_0x2046('0x69')][_0x2046('0x71')]};_0x3526e6[_0x2046('0x6e')]=_0x94793c[_0x2046('0x69')][_0x2046('0x6e')];}if(_0x29c6c3[_0x2046('0x5b')][_0x2046('0x73')]&&_0x29c6c3[_0x2046('0x5b')][_0x2046('0x73')][_0x2046('0x59')]){for(var _0x33bbd3=0x0;_0x33bbd3<_0x29c6c3['body']['attachments'][_0x2046('0x59')];_0x33bbd3+=0x1){_0x29c6c3['body']['attachments'][_0x33bbd3]={'filename':_0x29c6c3[_0x2046('0x5b')][_0x2046('0x73')][_0x33bbd3]['name'],'path':path[_0x2046('0x74')](config[_0x2046('0x75')],'server/files/attachments',_0x29c6c3['body'][_0x2046('0x73')][_0x33bbd3]['basename'])};}}_0x31bcbb={'account':_0x3526e6,'message':_0x29c6c3['body']};return;}})[_0x2046('0x23')](function(){if(_0x94793c[_0x2046('0x64')]){if(_0x94793c[_0x2046('0x64')]['Contacts'][_0x2046('0x59')]){return _0x94793c[_0x2046('0x64')]['Contacts'][0x0];}else{return db[_0x2046('0x65')]['create'](_[_0x2046('0x76')](_0x29c6c3[_0x2046('0x5b')],{'firstName':_0x29c6c3[_0x2046('0x5b')]['to'],'email':_0x29c6c3[_0x2046('0x5b')]['to'],'phone':_0x29c6c3[_0x2046('0x5b')]['to'],'ListId':_0x94793c[_0x2046('0x77')]}));}}else{throw new Error(_0x2046('0x78'));}})[_0x2046('0x23')](function(){if(_0x31bcbb){return respondWithRpcPromise('SendMail',_0x2046('0x79'),_0x31bcbb,client9003)['then'](function(_0x2e5d7e){return _0x29188c[_0x2046('0x36')]({'read':!![],'messageId':_0x2e5d7e[_0x2046('0x7a')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x2046('0x2e')](function(_0x4630ef){logger[_0x2046('0x2a')]('%s',JSON[_0x2046('0x29')](_0x4630ef));return _0x29188c;});}return _0x29188c;});}return _0x29188c;}})['then'](respondWithResult(_0x42cd67,0xc9))[_0x2046('0x2e')](handleError(_0x42cd67,null));};var interaction_log=require(_0x2046('0x13'))(_0x2046('0x7b'));exports[_0x2046('0x7c')]=function(_0x2b7790,_0x2eaa6a,_0x241376){var _0x4747d0={'channel':'mail'};if(_0x2b7790['body']['id']){delete _0x2b7790[_0x2046('0x5b')]['id'];}_0x2b7790['body'][_0x2046('0x7d')]=!![];_0x2b7790['body'][_0x2046('0x7e')]=moment()['format'](_0x2046('0x7f'));_0x2b7790['body'][_0x2046('0x80')]=_0x2b7790['body'][_0x2046('0x80')]||_0x2b7790[_0x2046('0x72')]['id'];return db[_0x2046('0x53')][_0x2046('0x5a')]({'where':{'id':_0x2b7790[_0x2046('0x57')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x2046('0x23')](handleEntityNotFound(_0x2eaa6a,null))[_0x2046('0x23')](saveUpdates(_0x2b7790[_0x2046('0x5b')],null))['then'](function(_0x33e6ad){if(_0x33e6ad){_0x4747d0[_0x2046('0x2c')]=_0x33e6ad[_0x2046('0x81')]({'plain':!![]});return db[_0x2046('0x82')][_0x2046('0x5a')]({'where':{'id':_0x33e6ad[_0x2046('0x83')]}});}return null;})[_0x2046('0x23')](handleEntityNotFound(_0x2eaa6a,null))['then'](function(_0x3624aa){if(_0x3624aa){return _0x3624aa[_0x2046('0x36')]({'UserId':_0x2b7790[_0x2046('0x5b')][_0x2046('0x80')],'read1stAt':_['isNil'](_0x3624aa['read1stAt'])?moment()[_0x2046('0x84')](_0x2046('0x7f')):undefined});}return null;})['then'](function(_0xc7fbb2){if(_0xc7fbb2){_0x4747d0[_0x2046('0x85')]=_0xc7fbb2[_0x2046('0x81')]({'plain':!![]});interaction_log[_0x2046('0x24')](_0x2046('0x86'),_0x2b7790[_0x2046('0x72')]['id'],_0x2b7790[_0x2046('0x72')][_0x2046('0x3a')],_0x2b7790['user']['role'],_0x4747d0['interaction']['id'],_0x2b7790[_0x2046('0x5b')]?JSON['stringify'](_0x2b7790['body']):_0x2046('0x87'));return respondWithRpcPromise(_0x2046('0x88'),_0x2046('0x89'),_0x4747d0);}return null;})[_0x2046('0x23')](function(_0xb42537){if(_0xb42537){if(_0x2b7790['body'][_0x2046('0x8a')]){_0x4747d0['message'][_0x2046('0x8b')]=util[_0x2046('0x84')](_0x2046('0x8c'),_0x2b7790[_0x2046('0x72')]['name']);_0x4747d0[_0x2046('0x2c')][_0x2046('0x8d')]=_0x4747d0[_0x2046('0x8d')];_0x4747d0[_0x2046('0x2c')]['event']=_0x2046('0x7c');return respondWithRpcPromise('EventManager',_0x2046('0x8e'),{'event':_0x2046('0x8f'),'message':_0x4747d0['message']},client9002)['then'](function(){return _0x4747d0;});}return _0x4747d0;}return null;})[_0x2046('0x23')](respondWithResult(_0x2eaa6a,null))[_0x2046('0x2e')](handleError(_0x2eaa6a,null));};var interaction_log=require(_0x2046('0x13'))(_0x2046('0x7b'));exports['reject']=function(_0x5075cd,_0x33843d,_0x5163dc){var _0x12e1a4={'agent':{},'channel':'mail'};if(_0x5075cd[_0x2046('0x5b')]['id']){delete _0x5075cd['body']['id'];}_0x5075cd[_0x2046('0x5b')][_0x2046('0x80')]=_0x5075cd['body']['UserId']||_0x5075cd[_0x2046('0x72')]['id'];_0x12e1a4[_0x2046('0x90')]['id']=_0x5075cd[_0x2046('0x5b')][_0x2046('0x80')];return db['MailMessage'][_0x2046('0x5a')]({'where':{'id':_0x5075cd[_0x2046('0x57')]['id'],'UserId':null}})[_0x2046('0x23')](handleEntityNotFound(_0x33843d,null))[_0x2046('0x23')](function(_0x4f0461){if(_0x4f0461){_0x12e1a4['message']=_0x4f0461[_0x2046('0x81')]({'plain':!![]});return db[_0x2046('0x82')][_0x2046('0x5a')]({'where':{'id':_0x4f0461[_0x2046('0x83')]}});}return null;})[_0x2046('0x23')](handleEntityNotFound(_0x33843d,null))[_0x2046('0x23')](function(_0x351be5){if(_0x351be5){_0x12e1a4['interaction']=_0x351be5[_0x2046('0x81')]({'plain':!![]});interaction_log['info'](_0x2046('0x91'),_0x5075cd[_0x2046('0x72')]['id'],_0x5075cd[_0x2046('0x72')][_0x2046('0x3a')],_0x5075cd[_0x2046('0x72')][_0x2046('0x92')],_0x12e1a4[_0x2046('0x85')]['id'],_0x5075cd[_0x2046('0x5b')]?JSON['stringify'](_0x5075cd[_0x2046('0x5b')]):_0x2046('0x87'));return respondWithRpcPromise(_0x2046('0x93'),_0x2046('0x94'),_0x12e1a4);}return null;})['then'](function(_0x1235d5){if(_0x1235d5){_0x1235d5['message'][_0x2046('0x8b')]=util[_0x2046('0x84')](_0x2046('0x8c'),_0x5075cd['user'][_0x2046('0x3a')]);_0x1235d5['message'][_0x2046('0x8d')]=_0x12e1a4[_0x2046('0x8d')];_0x1235d5[_0x2046('0x2c')][_0x2046('0x95')]=_0x2046('0x96');respondWithRpcPromise('EventManager',_0x2046('0x8e'),{'event':_0x2046('0x97'),'message':_0x1235d5[_0x2046('0x2c')]},client9002);return _0x12e1a4;}return null;})[_0x2046('0x23')](respondWithResult(_0x33843d,null))[_0x2046('0x2e')](handleError(_0x33843d,null));};exports[_0x2046('0x98')]=function(_0x48f592,_0x283bbe){var _0x59e9f=moment()['unix']()[_0x2046('0x99')]();var _0x361531=path[_0x2046('0x74')](config[_0x2046('0x75')],_0x2046('0x9a'),'files','tmp');var _0x579008=path['join'](config[_0x2046('0x75')],_0x2046('0x9a'),_0x2046('0x9b'),_0x2046('0x73'));var _0x5c2714=util['format'](_0x2046('0x9c'),_0x59e9f);return db[_0x2046('0x53')]['find']({'where':{'id':_0x48f592[_0x2046('0x57')]['id']},'attributes':['id',_0x2046('0x5b'),_0x2046('0x9d'),'to','cc',_0x2046('0x9e'),_0x2046('0x9f'),'createdAt'],'include':_0x48f592[_0x2046('0x42')][_0x2046('0x73')]?[{'model':db[_0x2046('0xa0')],'as':_0x2046('0xa1')}]:undefined})[_0x2046('0x23')](handleEntityNotFound(_0x283bbe,null))[_0x2046('0x23')](function(_0x53c20d){if(_0x53c20d){var _0x58efbe=_0x53c20d;var _0x3c7d9a={'from':_0x58efbe[_0x2046('0x9d')],'to':_0x58efbe['to'],'subject':_0x58efbe[_0x2046('0x9f')],'html':_0x58efbe[_0x2046('0x5b')],'headers':{'Date':moment(_0x58efbe[_0x2046('0xa2')])[_0x2046('0x84')](_0x2046('0xa3'))},'attachments':[]};if(_0x53c20d['cc']){_0x3c7d9a[_0x2046('0xa4')]['Cc']=_0x53c20d['cc'];}if(_0x53c20d['bcc']){_0x3c7d9a[_0x2046('0xa4')][_0x2046('0xa5')]=_0x53c20d[_0x2046('0x9e')];}return new BPromise(function(_0x497d16,_0x948ad6){if(_0x53c20d['Attachments']){for(var _0x108ffe=0x0;_0x108ffe<_0x53c20d[_0x2046('0xa1')][_0x2046('0x59')];_0x108ffe++){var _0x63a85b=_0x53c20d['Attachments'][_0x108ffe];var _0x3c87d4=path[_0x2046('0x74')](_0x579008,_0x63a85b['basename']);if(fs['existsSync'](_0x3c87d4)){_0x3c7d9a['attachments'][_0x2046('0xa6')]({'name':_0x63a85b['name'],'contentType':_0x63a85b['type'],'data':fs[_0x2046('0xa7')](_0x3c87d4)});}}}emlformat[_0x2046('0xa8')](_0x3c7d9a,function(_0x395040,_0x4a08a8){if(_0x395040)return _0x948ad6(_0x395040);fs[_0x2046('0xa9')](path[_0x2046('0x74')](_0x361531,_0x5c2714),_0x4a08a8);return _0x497d16(_0x4a08a8);});});}})['then'](function(_0x3ce8b6){if(_0x3ce8b6){return _0x283bbe['download'](path[_0x2046('0x74')](_0x361531,_0x5c2714),_0x5c2714,function(_0x24e1b6){if(_0x24e1b6){console[_0x2046('0xaa')](_0x2046('0xab'),_0x24e1b6);}else{fs[_0x2046('0xac')](path[_0x2046('0x74')](_0x361531,_0x5c2714));}});}})['catch'](handleError(_0x283bbe,null));}; \ No newline at end of file +var _0xc4a9=['request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','MailMessage','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','findAll','show','keys','include','update','body','find','params','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','Contacts','updatedAt','DESC','Smtp','isNil','service','host','port','secure','authentication','auth','pass','attachments','root','server/files/attachments','basename','List','defaults','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','readAt','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','RejectMessage','rejectMessage','rejectmessage','download','join','server','tmp','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','headers','Bcc','existsSync','push','build','writeFileSync','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.'];(function(_0x45b84a,_0x2d412c){var _0x20ab92=function(_0x3607c7){while(--_0x3607c7){_0x45b84a['push'](_0x45b84a['shift']());}};_0x20ab92(++_0x2d412c);}(_0xc4a9,0x1eb));var _0x9c4a=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xc4a9[_0x164eca];return _0x2ce562;};'use strict';var pdf=require(_0x9c4a('0x0'));var emlformat=require(_0x9c4a('0x1'));var rimraf=require(_0x9c4a('0x2'));var zipdir=require(_0x9c4a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c4a('0x4'));var moment=require(_0x9c4a('0x5'));var BPromise=require(_0x9c4a('0x6'));var Mustache=require(_0x9c4a('0x7'));var util=require(_0x9c4a('0x8'));var path=require('path');var sox=require(_0x9c4a('0x9'));var csv=require(_0x9c4a('0xa'));var ejs=require(_0x9c4a('0xb'));var fs=require('fs');var _=require(_0x9c4a('0xc'));var squel=require(_0x9c4a('0xd'));var crypto=require(_0x9c4a('0xe'));var jsforce=require(_0x9c4a('0xf'));var deskjs=require(_0x9c4a('0x10'));var toCsv=require(_0x9c4a('0xa'));var querystring=require(_0x9c4a('0x11'));var Papa=require(_0x9c4a('0x12'));var Redis=require(_0x9c4a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9c4a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c4a('0x15'));var logger=require(_0x9c4a('0x16'))('api');var utils=require(_0x9c4a('0x17'));var config=require(_0x9c4a('0x18'));var db=require(_0x9c4a('0x19'))['db'];config[_0x9c4a('0x1a')]=_['defaults'](config[_0x9c4a('0x1a')],{'host':_0x9c4a('0x1b'),'port':0x18eb});var socket=require(_0x9c4a('0x1c'))(new Redis(config[_0x9c4a('0x1a')]));require(_0x9c4a('0x1d'))[_0x9c4a('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9c4a('0x1f')][_0x9c4a('0x20')]({'port':0x232c});var client9003=jayson[_0x9c4a('0x1f')]['http']({'port':0x232b});var client9002=jayson[_0x9c4a('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x4893c5,_0x164582,_0x43fc05){if(_0x43fc05){var _0xfdb4a9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xfdb4a9[_0x9c4a('0x21')](_0x164582)){return _0x4893c5;}else{throw new db[(_0x9c4a('0x22'))][(_0x9c4a('0x23'))](_0x9c4a('0x24'));}}else{return _0x4893c5;}}function respondWithRpcPromise(_0x117008,_0x122bb6,_0x546e25,_0x160a16){return new BPromise(function(_0x422aa1,_0x44ff13){var _0x4a6e08=_0x160a16||client;return _0x4a6e08[_0x9c4a('0x25')](_0x117008,_0x546e25)[_0x9c4a('0x26')](function(_0x506e00){logger[_0x9c4a('0x27')](_0x9c4a('0x28'),_0x122bb6,_0x9c4a('0x29'));logger[_0x9c4a('0x2a')](_0x9c4a('0x2b'),_0x122bb6,_0x9c4a('0x29'),JSON['stringify'](_0x506e00));if(_0x506e00['error']){if(_0x506e00[_0x9c4a('0x2c')][_0x9c4a('0x2d')]===0x1f4){logger[_0x9c4a('0x2c')](_0x9c4a('0x28'),_0x122bb6,_0x506e00['error']['message']);return _0x44ff13(_0x506e00[_0x9c4a('0x2c')][_0x9c4a('0x2e')]);}logger[_0x9c4a('0x2c')](_0x9c4a('0x28'),_0x122bb6,_0x506e00[_0x9c4a('0x2c')]['message']);return _0x422aa1(_0x506e00[_0x9c4a('0x2c')]['message']);}else{logger[_0x9c4a('0x27')](_0x9c4a('0x28'),_0x122bb6,_0x9c4a('0x29'));_0x422aa1(_0x506e00['result'][_0x9c4a('0x2e')]);}})[_0x9c4a('0x2f')](function(_0x5418c1){logger[_0x9c4a('0x2c')](_0x9c4a('0x28'),_0x122bb6,_0x5418c1);_0x44ff13(_0x5418c1);});});}function respondWithStatusCode(_0x581769,_0x175232){_0x175232=_0x175232||0xcc;return function(_0xb9465c){if(_0xb9465c){return _0x581769['sendStatus'](_0x175232);}return _0x581769[_0x9c4a('0x30')](_0x175232)[_0x9c4a('0x31')]();};}function respondWithResult(_0x3371ba,_0x23c59e){_0x23c59e=_0x23c59e||0xc8;return function(_0x24d137){if(_0x24d137){return _0x3371ba[_0x9c4a('0x30')](_0x23c59e)[_0x9c4a('0x32')](_0x24d137);}};}function respondWithFilteredResult(_0x15dc5a,_0x376b09){return function(_0x399926){if(_0x399926){var _0x40f634=_0x399926[_0x9c4a('0x33')],_0x187fa3=_0x376b09[_0x9c4a('0x34')],_0x196c60=_0x376b09[_0x9c4a('0x34')]+_0x376b09[_0x9c4a('0x35')],_0x10edea;if(_0x196c60>=_0x40f634){_0x196c60=_0x40f634;_0x10edea=0xc8;}else{_0x10edea=0xce;}_0x15dc5a[_0x9c4a('0x30')](_0x10edea);return _0x15dc5a[_0x9c4a('0x36')](_0x9c4a('0x37'),_0x187fa3+'-'+_0x196c60+'/'+_0x40f634)[_0x9c4a('0x32')](_0x399926);}return null;};}function patchUpdates(_0x7e21ca){return function(_0x1eed3b){try{jsonpatch[_0x9c4a('0x38')](_0x1eed3b,_0x7e21ca,!![]);}catch(_0x43c703){return BPromise[_0x9c4a('0x39')](_0x43c703);}return _0x1eed3b[_0x9c4a('0x3a')]();};}function saveUpdates(_0x3e58b8,_0x42fbaa){return function(_0x6c0c3e){if(_0x6c0c3e){return _0x6c0c3e['update'](_0x3e58b8)[_0x9c4a('0x26')](function(_0x4d0d3e){return _0x4d0d3e;});}return null;};}function removeEntity(_0x2967dd,_0x3a1523){return function(_0x24d246){if(_0x24d246){return _0x24d246[_0x9c4a('0x3b')]()[_0x9c4a('0x26')](function(){_0x2967dd[_0x9c4a('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x508194,_0x18a751){return function(_0xdb78f6){if(!_0xdb78f6){_0x508194['sendStatus'](0x194);}return _0xdb78f6;};}function handleError(_0x5628f5,_0x11a7c7){_0x11a7c7=_0x11a7c7||0x1f4;return function(_0x44a306){logger[_0x9c4a('0x2c')](_0x44a306[_0x9c4a('0x3c')]);if(_0x44a306[_0x9c4a('0x3d')]){delete _0x44a306[_0x9c4a('0x3d')];}_0x5628f5['status'](_0x11a7c7)[_0x9c4a('0x3e')](_0x44a306);};}exports[_0x9c4a('0x3f')]=function(_0x2a485d,_0x4c07){var _0x3361da={},_0x155f7e={},_0x51226d={'count':0x0,'rows':[]};var _0x24d691=_[_0x9c4a('0x40')](db[_0x9c4a('0x41')][_0x9c4a('0x42')],function(_0x4963e3){return{'name':_0x4963e3['fieldName'],'type':_0x4963e3['type'][_0x9c4a('0x43')]};});_0x155f7e[_0x9c4a('0x44')]=_['map'](_0x24d691,_0x9c4a('0x3d'));_0x155f7e[_0x9c4a('0x45')]=_['keys'](_0x2a485d[_0x9c4a('0x45')]);_0x155f7e['filters']=_[_0x9c4a('0x46')](_0x155f7e[_0x9c4a('0x44')],_0x155f7e['query']);_0x3361da[_0x9c4a('0x47')]=_[_0x9c4a('0x46')](_0x155f7e[_0x9c4a('0x44')],qs[_0x9c4a('0x48')](_0x2a485d['query'][_0x9c4a('0x48')]));_0x3361da['attributes']=_0x3361da[_0x9c4a('0x47')][_0x9c4a('0x49')]?_0x3361da[_0x9c4a('0x47')]:_0x155f7e['model'];if(!_0x2a485d[_0x9c4a('0x45')][_0x9c4a('0x4a')](_0x9c4a('0x4b'))){_0x3361da['limit']=qs[_0x9c4a('0x35')](_0x2a485d[_0x9c4a('0x45')][_0x9c4a('0x35')]);_0x3361da[_0x9c4a('0x34')]=qs['offset'](_0x2a485d[_0x9c4a('0x45')][_0x9c4a('0x34')]);}_0x3361da[_0x9c4a('0x4c')]=qs[_0x9c4a('0x4d')](_0x2a485d['query'][_0x9c4a('0x4d')]);_0x3361da[_0x9c4a('0x4e')]=qs[_0x9c4a('0x4f')](_[_0x9c4a('0x50')](_0x2a485d['query'],_0x155f7e[_0x9c4a('0x4f')]));if(_0x2a485d[_0x9c4a('0x45')][_0x9c4a('0x51')]){_0x3361da[_0x9c4a('0x4e')]=_[_0x9c4a('0x52')](_0x3361da[_0x9c4a('0x4e')],{'$or':_['map'](_0x24d691,function(_0x1d8c25){if(_0x1d8c25[_0x9c4a('0x53')]!=='VIRTUAL'){var _0x133277={};_0x133277[_0x1d8c25[_0x9c4a('0x3d')]]={'$like':'%'+_0x2a485d[_0x9c4a('0x45')][_0x9c4a('0x51')]+'%'};return _0x133277;}})});}_0x3361da=_[_0x9c4a('0x52')]({},_0x3361da,_0x2a485d[_0x9c4a('0x54')]);var _0x5103f0={'where':_0x3361da[_0x9c4a('0x4e')]};return db[_0x9c4a('0x41')][_0x9c4a('0x33')](_0x5103f0)['then'](function(_0x44d743){_0x51226d[_0x9c4a('0x33')]=_0x44d743;if(_0x2a485d[_0x9c4a('0x45')][_0x9c4a('0x55')]){_0x3361da['include']=[{'all':!![]}];}return db[_0x9c4a('0x41')][_0x9c4a('0x56')](_0x3361da);})[_0x9c4a('0x26')](function(_0x1bea76){_0x51226d['rows']=_0x1bea76;return _0x51226d;})[_0x9c4a('0x26')](respondWithFilteredResult(_0x4c07,_0x3361da))[_0x9c4a('0x2f')](handleError(_0x4c07,null));};exports[_0x9c4a('0x57')]=function(_0x3892c8,_0x265418){var _0x4b4860={'raw':!![],'where':{'id':_0x3892c8['params']['id']}},_0x28fb6e={};_0x28fb6e[_0x9c4a('0x44')]=_[_0x9c4a('0x58')](db[_0x9c4a('0x41')][_0x9c4a('0x42')]);_0x28fb6e[_0x9c4a('0x45')]=_[_0x9c4a('0x58')](_0x3892c8['query']);_0x28fb6e[_0x9c4a('0x4f')]=_[_0x9c4a('0x46')](_0x28fb6e[_0x9c4a('0x44')],_0x28fb6e[_0x9c4a('0x45')]);_0x4b4860[_0x9c4a('0x47')]=_['intersection'](_0x28fb6e[_0x9c4a('0x44')],qs[_0x9c4a('0x48')](_0x3892c8[_0x9c4a('0x45')]['fields']));_0x4b4860[_0x9c4a('0x47')]=_0x4b4860[_0x9c4a('0x47')][_0x9c4a('0x49')]?_0x4b4860[_0x9c4a('0x47')]:_0x28fb6e['model'];if(_0x3892c8[_0x9c4a('0x45')][_0x9c4a('0x55')]){_0x4b4860[_0x9c4a('0x59')]=[{'all':!![]}];}_0x4b4860=_['merge']({},_0x4b4860,_0x3892c8['options']);return db['MailMessage']['find'](_0x4b4860)['then'](handleEntityNotFound(_0x265418,null))[_0x9c4a('0x26')](respondWithResult(_0x265418,null))[_0x9c4a('0x2f')](handleError(_0x265418,null));};exports[_0x9c4a('0x5a')]=function(_0x718cf9,_0x29257e){if(_0x718cf9[_0x9c4a('0x5b')]['id']){delete _0x718cf9[_0x9c4a('0x5b')]['id'];}return db[_0x9c4a('0x41')][_0x9c4a('0x5c')]({'where':{'id':_0x718cf9[_0x9c4a('0x5d')]['id']}})[_0x9c4a('0x26')](handleEntityNotFound(_0x29257e,null))[_0x9c4a('0x26')](saveUpdates(_0x718cf9['body'],null))['then'](respondWithResult(_0x29257e,null))['catch'](handleError(_0x29257e,null));};exports[_0x9c4a('0x3b')]=function(_0x589df6,_0x1dd19a){return db[_0x9c4a('0x41')][_0x9c4a('0x5c')]({'where':{'id':_0x589df6[_0x9c4a('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1dd19a,null))[_0x9c4a('0x26')](removeEntity(_0x1dd19a,null))['catch'](handleError(_0x1dd19a,null));};exports['describe']=function(_0xda57b7,_0x5e5829){return db[_0x9c4a('0x41')][_0x9c4a('0x5e')]()[_0x9c4a('0x26')](respondWithResult(_0x5e5829,null))['catch'](handleError(_0x5e5829,null));};exports[_0x9c4a('0x5f')]=function(_0x5c379a,_0x342993){return db[_0x9c4a('0x41')][_0x9c4a('0x5f')](_0x5c379a[_0x9c4a('0x5b')])[_0x9c4a('0x26')](function(_0x4ac152){if(_0x4ac152){if(_0x4ac152['direction']===_0x9c4a('0x60')&&!_0x4ac152[_0x9c4a('0x61')]){var _0x6746bd,_0x3549ef,_0x209a9c;if(_0x5c379a[_0x9c4a('0x5b')]['to']){_0x3549ef=_0x5c379a[_0x9c4a('0x5b')]['to'][_0x9c4a('0x62')](',')[0x0];}return db[_0x9c4a('0x63')][_0x9c4a('0x64')]({'where':{'id':_0x4ac152[_0x9c4a('0x65')]},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x9c4a('0x66'),'where':{'email':_0x3549ef},'limit':0x1,'order':[[_0x9c4a('0x67'),_0x9c4a('0x68')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x9c4a('0x26')](function(_0x4f24a1){_0x6746bd=_0x4f24a1;if(_0x6746bd&&_0x6746bd[_0x9c4a('0x69')]){var _0x5b0e9e={'tls':{'rejectUnauthorized':![]}};if(_[_0x9c4a('0x6a')](_0x6746bd['Smtp'][_0x9c4a('0x6b')])){_0x5b0e9e[_0x9c4a('0x6c')]=_0x6746bd[_0x9c4a('0x69')][_0x9c4a('0x6c')];_0x5b0e9e['port']=_0x6746bd[_0x9c4a('0x69')][_0x9c4a('0x6d')];_0x5b0e9e['secure']=_0x6746bd[_0x9c4a('0x69')][_0x9c4a('0x6e')];if(_0x6746bd['Smtp'][_0x9c4a('0x6f')]){_0x5b0e9e[_0x9c4a('0x70')]={'user':_0x6746bd[_0x9c4a('0x69')]['user'],'pass':_0x6746bd[_0x9c4a('0x69')]['pass']};}}else{_0x5b0e9e[_0x9c4a('0x6b')]=_0x6746bd[_0x9c4a('0x69')][_0x9c4a('0x6b')];_0x5b0e9e[_0x9c4a('0x70')]={'user':_0x6746bd[_0x9c4a('0x69')]['user'],'pass':_0x6746bd[_0x9c4a('0x69')][_0x9c4a('0x71')]};_0x5b0e9e[_0x9c4a('0x6e')]=_0x6746bd[_0x9c4a('0x69')][_0x9c4a('0x6e')];}if(_0x5c379a['body'][_0x9c4a('0x72')]&&_0x5c379a[_0x9c4a('0x5b')][_0x9c4a('0x72')]['length']){for(var _0x2f8aa8=0x0;_0x2f8aa8<_0x5c379a[_0x9c4a('0x5b')][_0x9c4a('0x72')][_0x9c4a('0x49')];_0x2f8aa8+=0x1){_0x5c379a[_0x9c4a('0x5b')][_0x9c4a('0x72')][_0x2f8aa8]={'filename':_0x5c379a[_0x9c4a('0x5b')][_0x9c4a('0x72')][_0x2f8aa8][_0x9c4a('0x3d')],'path':path['join'](config[_0x9c4a('0x73')],_0x9c4a('0x74'),_0x5c379a['body']['attachments'][_0x2f8aa8][_0x9c4a('0x75')])};}}_0x209a9c={'account':_0x5b0e9e,'message':_0x5c379a[_0x9c4a('0x5b')]};return;}})['then'](function(){if(_0x6746bd[_0x9c4a('0x76')]){if(_0x6746bd[_0x9c4a('0x76')][_0x9c4a('0x66')]['length']){return _0x6746bd['List'][_0x9c4a('0x66')][0x0];}else{return db['CmContact'][_0x9c4a('0x5f')](_[_0x9c4a('0x77')](_0x5c379a[_0x9c4a('0x5b')],{'firstName':_0x5c379a[_0x9c4a('0x5b')]['to'],'email':_0x5c379a[_0x9c4a('0x5b')]['to'],'phone':_0x5c379a['body']['to'],'ListId':_0x6746bd[_0x9c4a('0x78')]}));}}else{throw new Error(_0x9c4a('0x79'));}})[_0x9c4a('0x26')](function(){if(_0x209a9c){return respondWithRpcPromise(_0x9c4a('0x7a'),_0x9c4a('0x7b'),_0x209a9c,client9003)['then'](function(_0x275bad){return _0x4ac152[_0x9c4a('0x5a')]({'read':!![],'messageId':_0x275bad[_0x9c4a('0x7c')],'sentAt':moment()[_0x9c4a('0x7d')](_0x9c4a('0x7e'))});})[_0x9c4a('0x2f')](function(_0x150f08){logger['error']('%s',JSON['stringify'](_0x150f08));return _0x4ac152;});}return _0x4ac152;});}return _0x4ac152;}})[_0x9c4a('0x26')](respondWithResult(_0x342993,0xc9))['catch'](handleError(_0x342993,null));};var interaction_log=require(_0x9c4a('0x16'))(_0x9c4a('0x7f'));exports[_0x9c4a('0x80')]=function(_0x5a0898,_0xf6accc,_0x249bca){var _0x4eb783={'channel':_0x9c4a('0x81')};if(_0x5a0898[_0x9c4a('0x5b')]['id']){delete _0x5a0898[_0x9c4a('0x5b')]['id'];}_0x5a0898['body'][_0x9c4a('0x82')]=!![];_0x5a0898[_0x9c4a('0x5b')][_0x9c4a('0x83')]=moment()[_0x9c4a('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');_0x5a0898[_0x9c4a('0x5b')][_0x9c4a('0x84')]=_0x5a0898['body'][_0x9c4a('0x84')]||_0x5a0898['user']['id'];return db[_0x9c4a('0x41')][_0x9c4a('0x5c')]({'where':{'id':_0x5a0898[_0x9c4a('0x5d')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x9c4a('0x85')}]})[_0x9c4a('0x26')](handleEntityNotFound(_0xf6accc,null))[_0x9c4a('0x26')](saveUpdates(_0x5a0898[_0x9c4a('0x5b')],null))[_0x9c4a('0x26')](function(_0xa15c2d){if(_0xa15c2d){_0x4eb783[_0x9c4a('0x2e')]=_0xa15c2d[_0x9c4a('0x86')]({'plain':!![]});return db[_0x9c4a('0x87')]['find']({'where':{'id':_0xa15c2d[_0x9c4a('0x88')]}});}return null;})['then'](handleEntityNotFound(_0xf6accc,null))[_0x9c4a('0x26')](function(_0x2e7afa){if(_0x2e7afa){return _0x2e7afa[_0x9c4a('0x5a')]({'UserId':_0x5a0898[_0x9c4a('0x5b')]['UserId'],'read1stAt':_[_0x9c4a('0x6a')](_0x2e7afa[_0x9c4a('0x89')])?moment()['format'](_0x9c4a('0x7e')):undefined});}return null;})[_0x9c4a('0x26')](function(_0x128751){if(_0x128751){_0x4eb783[_0x9c4a('0x8a')]=_0x128751[_0x9c4a('0x86')]({'plain':!![]});interaction_log[_0x9c4a('0x27')](_0x9c4a('0x8b'),_0x5a0898[_0x9c4a('0x8c')]['id'],_0x5a0898[_0x9c4a('0x8c')][_0x9c4a('0x3d')],_0x5a0898[_0x9c4a('0x8c')][_0x9c4a('0x8d')],_0x4eb783[_0x9c4a('0x8a')]['id'],_0x5a0898[_0x9c4a('0x5b')]?JSON['stringify'](_0x5a0898[_0x9c4a('0x5b')]):'null');return respondWithRpcPromise(_0x9c4a('0x8e'),_0x9c4a('0x8f'),_0x4eb783);}return null;})['then'](function(_0x2eff57){if(_0x2eff57){if(_0x5a0898[_0x9c4a('0x5b')][_0x9c4a('0x90')]){_0x4eb783[_0x9c4a('0x2e')][_0x9c4a('0x91')]=util['format'](_0x9c4a('0x92'),_0x5a0898[_0x9c4a('0x8c')]['name']);_0x4eb783[_0x9c4a('0x2e')][_0x9c4a('0x93')]=_0x4eb783[_0x9c4a('0x93')];_0x4eb783[_0x9c4a('0x2e')][_0x9c4a('0x94')]=_0x9c4a('0x80');return respondWithRpcPromise(_0x9c4a('0x95'),_0x9c4a('0x95'),{'event':_0x9c4a('0x96'),'message':_0x4eb783['message']},client9002)[_0x9c4a('0x26')](function(){return _0x4eb783;});}return _0x4eb783;}return null;})['then'](respondWithResult(_0xf6accc,null))[_0x9c4a('0x2f')](handleError(_0xf6accc,null));};var interaction_log=require('../../config/logger')(_0x9c4a('0x7f'));exports[_0x9c4a('0x39')]=function(_0x581d80,_0x4fad44,_0xfa1029){var _0x43e99c={'agent':{},'channel':_0x9c4a('0x81')};if(_0x581d80['body']['id']){delete _0x581d80[_0x9c4a('0x5b')]['id'];}_0x581d80[_0x9c4a('0x5b')]['UserId']=_0x581d80['body'][_0x9c4a('0x84')]||_0x581d80[_0x9c4a('0x8c')]['id'];_0x43e99c['agent']['id']=_0x581d80[_0x9c4a('0x5b')][_0x9c4a('0x84')];return db['MailMessage']['find']({'where':{'id':_0x581d80[_0x9c4a('0x5d')]['id'],'UserId':null}})[_0x9c4a('0x26')](handleEntityNotFound(_0x4fad44,null))['then'](function(_0x104888){if(_0x104888){_0x43e99c[_0x9c4a('0x2e')]=_0x104888[_0x9c4a('0x86')]({'plain':!![]});return db['MailInteraction'][_0x9c4a('0x5c')]({'where':{'id':_0x104888[_0x9c4a('0x88')]}});}return null;})[_0x9c4a('0x26')](handleEntityNotFound(_0x4fad44,null))[_0x9c4a('0x26')](function(_0x49bd50){if(_0x49bd50){_0x43e99c[_0x9c4a('0x8a')]=_0x49bd50['get']({'plain':!![]});interaction_log[_0x9c4a('0x27')](_0x9c4a('0x97'),_0x581d80[_0x9c4a('0x8c')]['id'],_0x581d80[_0x9c4a('0x8c')]['name'],_0x581d80[_0x9c4a('0x8c')]['role'],_0x43e99c[_0x9c4a('0x8a')]['id'],_0x581d80[_0x9c4a('0x5b')]?JSON[_0x9c4a('0x98')](_0x581d80[_0x9c4a('0x5b')]):_0x9c4a('0x99'));return respondWithRpcPromise(_0x9c4a('0x9a'),_0x9c4a('0x9b'),_0x43e99c);}return null;})[_0x9c4a('0x26')](function(_0x297747){if(_0x297747){_0x297747[_0x9c4a('0x2e')][_0x9c4a('0x91')]=util[_0x9c4a('0x7d')](_0x9c4a('0x92'),_0x581d80[_0x9c4a('0x8c')][_0x9c4a('0x3d')]);_0x297747['message']['channel']=_0x43e99c[_0x9c4a('0x93')];_0x297747[_0x9c4a('0x2e')][_0x9c4a('0x94')]=_0x9c4a('0x39');respondWithRpcPromise(_0x9c4a('0x95'),_0x9c4a('0x95'),{'event':_0x9c4a('0x9c'),'message':_0x297747[_0x9c4a('0x2e')]},client9002);return _0x43e99c;}return null;})[_0x9c4a('0x26')](respondWithResult(_0x4fad44,null))[_0x9c4a('0x2f')](handleError(_0x4fad44,null));};exports[_0x9c4a('0x9d')]=function(_0x186a54,_0x4dd832){var _0x11ad32=moment()['unix']()['toString']();var _0x60b393=path[_0x9c4a('0x9e')](config['root'],_0x9c4a('0x9f'),'files',_0x9c4a('0xa0'));var _0x22ad50=path[_0x9c4a('0x9e')](config[_0x9c4a('0x73')],_0x9c4a('0x9f'),'files',_0x9c4a('0x72'));var _0x24f1bb=util[_0x9c4a('0x7d')](_0x9c4a('0xa1'),_0x11ad32);return db[_0x9c4a('0x41')]['find']({'where':{'id':_0x186a54['params']['id']},'attributes':['id','body',_0x9c4a('0xa2'),'to','cc',_0x9c4a('0xa3'),'subject',_0x9c4a('0xa4')],'include':_0x186a54['query'][_0x9c4a('0x72')]?[{'model':db[_0x9c4a('0xa5')],'as':_0x9c4a('0xa6')}]:undefined})['then'](handleEntityNotFound(_0x4dd832,null))['then'](function(_0xaffeda){if(_0xaffeda){var _0x6cf3a7=_0xaffeda;var _0x40bea6={'from':_0x6cf3a7[_0x9c4a('0xa2')],'to':_0x6cf3a7['to'],'subject':_0x6cf3a7[_0x9c4a('0xa7')],'html':_0x6cf3a7[_0x9c4a('0x5b')],'headers':{'Date':moment(_0x6cf3a7[_0x9c4a('0xa4')])[_0x9c4a('0x7d')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xaffeda['cc']){_0x40bea6[_0x9c4a('0xa8')]['Cc']=_0xaffeda['cc'];}if(_0xaffeda['bcc']){_0x40bea6[_0x9c4a('0xa8')][_0x9c4a('0xa9')]=_0xaffeda[_0x9c4a('0xa3')];}return new BPromise(function(_0x4c7487,_0x40c76b){if(_0xaffeda['Attachments']){for(var _0x1d90ac=0x0;_0x1d90ac<_0xaffeda['Attachments'][_0x9c4a('0x49')];_0x1d90ac++){var _0x198485=_0xaffeda[_0x9c4a('0xa6')][_0x1d90ac];var _0x4e9581=path[_0x9c4a('0x9e')](_0x22ad50,_0x198485[_0x9c4a('0x75')]);if(fs[_0x9c4a('0xaa')](_0x4e9581)){_0x40bea6[_0x9c4a('0x72')][_0x9c4a('0xab')]({'name':_0x198485[_0x9c4a('0x3d')],'contentType':_0x198485[_0x9c4a('0x53')],'data':fs['readFileSync'](_0x4e9581)});}}}emlformat[_0x9c4a('0xac')](_0x40bea6,function(_0x1cbe18,_0x4879a8){if(_0x1cbe18)return _0x40c76b(_0x1cbe18);fs[_0x9c4a('0xad')](path['join'](_0x60b393,_0x24f1bb),_0x4879a8);return _0x4c7487(_0x4879a8);});});}})[_0x9c4a('0x26')](function(_0x2404b3){if(_0x2404b3){return _0x4dd832['download'](path['join'](_0x60b393,_0x24f1bb),_0x24f1bb,function(_0x1cb1d5){if(_0x1cb1d5){console['log'](_0x9c4a('0xae'),_0x1cb1d5);}else{fs[_0x9c4a('0xaf')](path[_0x9c4a('0x9e')](_0x60b393,_0x24f1bb));}});}})[_0x9c4a('0x2f')](handleError(_0x4dd832,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index e6aa4dc..7f39642 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 _0xf64e=['events','../../mysqldb','MailMessage','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x478e81,_0x95acfe){var _0x4212e5=function(_0x8f04ce){while(--_0x8f04ce){_0x478e81['push'](_0x478e81['shift']());}};_0x4212e5(++_0x95acfe);}(_0xf64e,0xab));var _0xef64=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xf64e[_0x5d6456];return _0x4d66c1;};'use strict';var EventEmitter=require(_0xef64('0x0'));var MailMessage=require(_0xef64('0x1'))['db'][_0xef64('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xef64('0x3'),'afterUpdate':_0xef64('0x4'),'afterDestroy':'remove'};function emitEvent(_0x23e112){return function(_0x132266,_0x4924cb,_0x32071b){MailMessageEvents[_0xef64('0x5')](_0x23e112+':'+_0x132266['id'],_0x132266);MailMessageEvents[_0xef64('0x5')](_0x23e112,_0x132266);_0x32071b(null);};}for(var e in events){if(events[_0xef64('0x6')](e)){var event=events[e];MailMessage[_0xef64('0x7')](e,emitEvent(event));}}module[_0xef64('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x4431=['hasOwnProperty','hook','exports','events','MailMessage','remove','emit'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0x4431,0x18b));var _0x1443=function(_0x3f510c,_0x3f9b29){_0x3f510c=_0x3f510c-0x0;var _0x4163b4=_0x4431[_0x3f510c];return _0x4163b4;};'use strict';var EventEmitter=require(_0x1443('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x1443('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1443('0x2')};function emitEvent(_0x3a25b9){return function(_0x2963e5,_0x4758a9,_0x5883fb){MailMessageEvents[_0x1443('0x3')](_0x3a25b9+':'+_0x2963e5['id'],_0x2963e5);MailMessageEvents[_0x1443('0x3')](_0x3a25b9,_0x2963e5);_0x5883fb(null);};}for(var e in events){if(events[_0x1443('0x4')](e)){var event=events[e];MailMessage[_0x1443('0x5')](e,emitEvent(event));}}module[_0x1443('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index e8bb773..cf6cc85 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 _0xdfd7=['out','isNil','UserId','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','html-to-text','path','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','body','fromString','models','get','toLowerCase','direction'];(function(_0x77544d,_0x2484bd){var _0x264466=function(_0x5956cf){while(--_0x5956cf){_0x77544d['push'](_0x77544d['shift']());}};_0x264466(++_0x2484bd);}(_0xdfd7,0x140));var _0x7dfd=function(_0x2a4d32,_0x677c79){_0x2a4d32=_0x2a4d32-0x0;var _0x2f0062=_0xdfd7[_0x2a4d32];return _0x2f0062;};'use strict';var _=require(_0x7dfd('0x0'));var util=require(_0x7dfd('0x1'));var logger=require(_0x7dfd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7dfd('0x3'));var rp=require(_0x7dfd('0x4'));var htmlToText=require(_0x7dfd('0x5'));var fs=require('fs');var path=require(_0x7dfd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7dfd('0x7'));module[_0x7dfd('0x8')]=function(_0x399627,_0x527f32){return _0x399627[_0x7dfd('0x9')](_0x7dfd('0xa'),attributes,{'tableName':_0x7dfd('0xb'),'paranoid':![],'indexes':[{'name':_0x7dfd('0xc'),'fields':[_0x7dfd('0xc')]},{'name':_0x7dfd('0xd'),'fields':[_0x7dfd('0xe'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x46c8d3,_0x937330,_0x3ab67c){if(_0x46c8d3[_0x7dfd('0xf')]){_0x46c8d3[_0x7dfd('0xe')]=htmlToText[_0x7dfd('0x10')](_0x46c8d3[_0x7dfd('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3ab67c(null,_0x937330);},'afterCreate':function(_0x4f04f2,_0x3fefbe,_0xf46d5b){var _0x1d3ebc=_0x399627[_0x7dfd('0x11')];var _0x3b1f74=_0x4f04f2[_0x7dfd('0x12')]({'plain':!![]});if(_0x3b1f74['direction'][_0x7dfd('0x13')]()==='in'||_0x3b1f74[_0x7dfd('0x14')]['toLowerCase']()===_0x7dfd('0x15')&&!_0x3b1f74['secret']&&!_[_0x7dfd('0x16')](_0x3b1f74[_0x7dfd('0x17')])){_0x1d3ebc['MailInteraction']['findOne']({'where':{'id':_0x3b1f74[_0x7dfd('0x18')]}})[_0x7dfd('0x19')](function(_0x5150b4){if(_0x5150b4){_0x5150b4[_0x7dfd('0x1a')]({'lastMsgAt':_0x3b1f74[_0x7dfd('0x1b')],'lastMsgDirection':_0x3b1f74['direction'][_0x7dfd('0x13')](),'lastMsgBody':_0x3b1f74[_0x7dfd('0xf')]});}})[_0x7dfd('0x1c')](function(_0x5be661){console[_0x7dfd('0x1d')](_0x5be661);});}_0xf46d5b();}},'charset':'utf8mb4','collate':_0x7dfd('0x1e')});}; \ No newline at end of file +var _0x2107=['moment','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','subject','body','plainBody','fromString','models','get','direction','toLowerCase','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x2238ba,_0xfeb953){var _0x33032f=function(_0x337e44){while(--_0x337e44){_0x2238ba['push'](_0x2238ba['shift']());}};_0x33032f(++_0xfeb953);}(_0x2107,0xe3));var _0x7210=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x2107[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x7210('0x0'));var util=require(_0x7210('0x1'));var logger=require(_0x7210('0x2'))(_0x7210('0x3'));var moment=require(_0x7210('0x4'));var BPromise=require('bluebird');var rp=require(_0x7210('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x7210('0x6'));var rimraf=require(_0x7210('0x7'));var config=require(_0x7210('0x8'));var attributes=require(_0x7210('0x9'));module[_0x7210('0xa')]=function(_0x73561b,_0x52e92f){return _0x73561b[_0x7210('0xb')]('MailMessage',attributes,{'tableName':_0x7210('0xc'),'paranoid':![],'indexes':[{'name':_0x7210('0xd'),'fields':['messageId']},{'name':_0x7210('0xe'),'fields':['plainBody',_0x7210('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x28cef3,_0x5afdf7,_0x1affe8){if(_0x28cef3[_0x7210('0x10')]){_0x28cef3[_0x7210('0x11')]=htmlToText[_0x7210('0x12')](_0x28cef3[_0x7210('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1affe8(null,_0x5afdf7);},'afterCreate':function(_0x3ca7fa,_0x369e12,_0x1c1408){var _0x48935a=_0x73561b[_0x7210('0x13')];var _0x575cb4=_0x3ca7fa[_0x7210('0x14')]({'plain':!![]});if(_0x575cb4[_0x7210('0x15')][_0x7210('0x16')]()==='in'||_0x575cb4[_0x7210('0x15')][_0x7210('0x16')]()==='out'&&!_0x575cb4['secret']&&!_[_0x7210('0x17')](_0x575cb4[_0x7210('0x18')])){_0x48935a[_0x7210('0x19')][_0x7210('0x1a')]({'where':{'id':_0x575cb4[_0x7210('0x1b')]}})[_0x7210('0x1c')](function(_0x114703){if(_0x114703){_0x114703['update']({'lastMsgAt':_0x575cb4[_0x7210('0x1d')],'lastMsgDirection':_0x575cb4['direction'][_0x7210('0x16')](),'lastMsgBody':_0x575cb4[_0x7210('0x10')]});}})[_0x7210('0x1e')](function(_0x5bd480){console[_0x7210('0x1f')](_0x5bd480);});}_0x1c1408();}},'charset':_0x7210('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index f2ce339..aeeaac9 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 _0x4819=['result','CreateMailMessage','MailMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3f54c9,_0x1e4d12){var _0x585fd8=function(_0xbfc04c){while(--_0xbfc04c){_0x3f54c9['push'](_0x3f54c9['shift']());}};_0x585fd8(++_0x1e4d12);}(_0x4819,0xcd));var _0x9481=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0x4819[_0x3e182f];return _0x23edc9;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});config['redis']=_[_0x9481('0xb')](config[_0x9481('0xc')],{'host':_0x9481('0xd'),'port':0x18eb});var socket=require(_0x9481('0xe'))(new Redis(config[_0x9481('0xc')]));require('./mailMessage.socket')[_0x9481('0xf')](socket);function respondWithRpcPromise(_0x521d18,_0x2fabf1,_0x564d5b){return new BPromise(function(_0x411d24,_0x2d5d0f){return client[_0x9481('0x10')](_0x521d18,_0x564d5b)[_0x9481('0x11')](function(_0xe84f77){logger[_0x9481('0x12')](_0x9481('0x13'),_0x2fabf1,_0x9481('0x14'));logger[_0x9481('0x15')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x2fabf1,'request\x20sent',JSON[_0x9481('0x16')](_0xe84f77));if(_0xe84f77[_0x9481('0x17')]){if(_0xe84f77[_0x9481('0x17')][_0x9481('0x18')]===0x1f4){logger[_0x9481('0x17')](_0x9481('0x13'),_0x2fabf1,_0xe84f77[_0x9481('0x17')]['message']);return _0x2d5d0f(_0xe84f77[_0x9481('0x17')][_0x9481('0x19')]);}logger['error'](_0x9481('0x13'),_0x2fabf1,_0xe84f77['error'][_0x9481('0x19')]);return _0x411d24(_0xe84f77[_0x9481('0x17')][_0x9481('0x19')]);}else{logger[_0x9481('0x12')]('MailMessage,\x20%s,\x20%s',_0x2fabf1,'request\x20sent');_0x411d24(_0xe84f77[_0x9481('0x1a')]['message']);}})['catch'](function(_0x26671c){logger[_0x9481('0x17')](_0x9481('0x13'),_0x2fabf1,_0x26671c);_0x2d5d0f(_0x26671c);});});}exports[_0x9481('0x1b')]=function(_0x7000e7){var _0x3dc33f=this;return new Promise(function(_0x55a1bd,_0x2cf1aa){return db[_0x9481('0x1c')][_0x9481('0x1d')](_0x7000e7[_0x9481('0x1e')],{'raw':_0x7000e7[_0x9481('0x1f')]?_0x7000e7['options'][_0x9481('0x20')]===undefined?!![]:![]:!![]})[_0x9481('0x11')](function(_0x572599){logger[_0x9481('0x12')](_0x9481('0x1b'),_0x7000e7);logger[_0x9481('0x15')](_0x9481('0x1b'),_0x7000e7,JSON[_0x9481('0x16')](_0x572599));_0x55a1bd(_0x572599);})['catch'](function(_0x91e3d9){logger[_0x9481('0x17')]('CreateMailMessage',_0x91e3d9['message'],_0x7000e7);_0x2cf1aa(_0x3dc33f[_0x9481('0x17')](0x1f4,_0x91e3d9[_0x9481('0x19')]));});});}; \ No newline at end of file +var _0x9fc5=['result','catch','CreateMailMessage','create','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9fc5,0xb6));var _0x59fc=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x9fc5[_0x2bf141];return _0x48277b;};'use strict';var _=require('lodash');var util=require(_0x59fc('0x0'));var moment=require(_0x59fc('0x1'));var BPromise=require('bluebird');var rs=require(_0x59fc('0x2'));var fs=require('fs');var Redis=require(_0x59fc('0x3'));var db=require(_0x59fc('0x4'))['db'];var utils=require(_0x59fc('0x5'));var logger=require(_0x59fc('0x6'))(_0x59fc('0x7'));var config=require(_0x59fc('0x8'));var jayson=require(_0x59fc('0x9'));var client=jayson['client'][_0x59fc('0xa')]({'port':0x232a});config[_0x59fc('0xb')]=_[_0x59fc('0xc')](config['redis'],{'host':_0x59fc('0xd'),'port':0x18eb});var socket=require(_0x59fc('0xe'))(new Redis(config[_0x59fc('0xb')]));require(_0x59fc('0xf'))[_0x59fc('0x10')](socket);function respondWithRpcPromise(_0x212ec8,_0x2556f8,_0x4afc93){return new BPromise(function(_0x2de019,_0x33364e){return client[_0x59fc('0x11')](_0x212ec8,_0x4afc93)[_0x59fc('0x12')](function(_0x29e599){logger[_0x59fc('0x13')](_0x59fc('0x14'),_0x2556f8,'request\x20sent');logger[_0x59fc('0x15')](_0x59fc('0x16'),_0x2556f8,_0x59fc('0x17'),JSON[_0x59fc('0x18')](_0x29e599));if(_0x29e599[_0x59fc('0x19')]){if(_0x29e599[_0x59fc('0x19')][_0x59fc('0x1a')]===0x1f4){logger[_0x59fc('0x19')](_0x59fc('0x14'),_0x2556f8,_0x29e599[_0x59fc('0x19')][_0x59fc('0x1b')]);return _0x33364e(_0x29e599['error'][_0x59fc('0x1b')]);}logger[_0x59fc('0x19')]('MailMessage,\x20%s,\x20%s',_0x2556f8,_0x29e599[_0x59fc('0x19')][_0x59fc('0x1b')]);return _0x2de019(_0x29e599[_0x59fc('0x19')][_0x59fc('0x1b')]);}else{logger[_0x59fc('0x13')]('MailMessage,\x20%s,\x20%s',_0x2556f8,_0x59fc('0x17'));_0x2de019(_0x29e599[_0x59fc('0x1c')][_0x59fc('0x1b')]);}})[_0x59fc('0x1d')](function(_0x395ede){logger[_0x59fc('0x19')](_0x59fc('0x14'),_0x2556f8,_0x395ede);_0x33364e(_0x395ede);});});}exports[_0x59fc('0x1e')]=function(_0x58a0bb){var _0x153c58=this;return new Promise(function(_0x530c11,_0xdcfddb){return db['MailMessage'][_0x59fc('0x1f')](_0x58a0bb[_0x59fc('0x20')],{'raw':_0x58a0bb[_0x59fc('0x21')]?_0x58a0bb[_0x59fc('0x21')][_0x59fc('0x22')]===undefined?!![]:![]:!![]})[_0x59fc('0x12')](function(_0x4913ff){logger[_0x59fc('0x13')](_0x59fc('0x1e'),_0x58a0bb);logger['debug']('CreateMailMessage',_0x58a0bb,JSON[_0x59fc('0x18')](_0x4913ff));_0x530c11(_0x4913ff);})[_0x59fc('0x1d')](function(_0x39d3a0){logger[_0x59fc('0x19')](_0x59fc('0x1e'),_0x39d3a0[_0x59fc('0x1b')],_0x58a0bb);_0xdcfddb(_0x153c58[_0x59fc('0x19')](0x1f4,_0x39d3a0[_0x59fc('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 234b60e..540306b 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 _0x2544=['update','emit','removeListener','register','length','mailMessage:','./mailMessage.events'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0x2544,0x8b));var _0x4254=function(_0x24a7bf,_0x13e3e9){_0x24a7bf=_0x24a7bf-0x0;var _0x503452=_0x2544[_0x24a7bf];return _0x503452;};'use strict';var MailMessageEvents=require(_0x4254('0x0'));var events=['save','remove',_0x4254('0x1')];function createListener(_0x24a815,_0xfdb60c){return function(_0x3dc9d2){_0xfdb60c[_0x4254('0x2')](_0x24a815,_0x3dc9d2);};}function removeListener(_0x3dcc6f,_0x58f27f){return function(){MailMessageEvents[_0x4254('0x3')](_0x3dcc6f,_0x58f27f);};}exports[_0x4254('0x4')]=function(_0x4e6123){for(var _0x22a688=0x0,_0x34a4b4=events[_0x4254('0x5')];_0x22a688<_0x34a4b4;_0x22a688++){var _0x5e6b7b=events[_0x22a688];var _0x5b1b2e=createListener(_0x4254('0x6')+_0x5e6b7b,_0x4e6123);MailMessageEvents['on'](_0x5e6b7b,_0x5b1b2e);}}; \ No newline at end of file +var _0xdbf7=['mailMessage:','./mailMessage.events','save','remove','update','emit','length'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xdbf7,0x8d));var _0x7dbf=function(_0x314464,_0x32e9db){_0x314464=_0x314464-0x0;var _0x54f901=_0xdbf7[_0x314464];return _0x54f901;};'use strict';var MailMessageEvents=require(_0x7dbf('0x0'));var events=[_0x7dbf('0x1'),_0x7dbf('0x2'),_0x7dbf('0x3')];function createListener(_0x14de15,_0x2719ff){return function(_0x3097c0){_0x2719ff[_0x7dbf('0x4')](_0x14de15,_0x3097c0);};}function removeListener(_0x4e243e,_0x11294f){return function(){MailMessageEvents['removeListener'](_0x4e243e,_0x11294f);};}exports['register']=function(_0x7972ee){for(var _0x47730f=0x0,_0x601b60=events[_0x7dbf('0x5')];_0x47730f<_0x601b60;_0x47730f++){var _0x29f02b=events[_0x47730f];var _0x3e7a9c=createListener(_0x7dbf('0x6')+_0x29f02b,_0x7972ee);MailMessageEvents['on'](_0x29f02b,_0x3e7a9c);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 6185387..6e0d08b 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 _0x06cc=['put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','get','isAuthenticated','index','describe','/:id','show','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x06cc,0x1e9));var _0xc06c=function(_0x5443fe,_0x5ed471){_0x5443fe=_0x5443fe-0x0;var _0x323496=_0x06cc[_0x5443fe];return _0x323496;};'use strict';var multer=require(_0xc06c('0x0'));var util=require(_0xc06c('0x1'));var path=require(_0xc06c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc06c('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0xc06c('0x4')]('/',auth[_0xc06c('0x5')](),controller[_0xc06c('0x6')]);router[_0xc06c('0x4')]('/describe',auth['isAuthenticated'](),controller[_0xc06c('0x7')]);router['get'](_0xc06c('0x8'),auth[_0xc06c('0x5')](),controller[_0xc06c('0x9')]);router[_0xc06c('0x4')]('/:id/members',auth[_0xc06c('0x5')](),controller['getMembers']);router['get'](_0xc06c('0xa'),auth[_0xc06c('0x5')](),controller[_0xc06c('0xb')]);router[_0xc06c('0x4')](_0xc06c('0xc'),auth[_0xc06c('0x5')](),controller['getAgents']);router[_0xc06c('0xd')]('/',auth[_0xc06c('0x5')](),controller[_0xc06c('0xe')]);router[_0xc06c('0xd')]('/:id/teams',auth[_0xc06c('0x5')](),controller[_0xc06c('0xf')]);router['post'](_0xc06c('0xc'),auth[_0xc06c('0x5')](),controller[_0xc06c('0x10')]);router[_0xc06c('0x11')](_0xc06c('0x8'),auth[_0xc06c('0x5')](),controller[_0xc06c('0x12')]);router[_0xc06c('0x13')]('/:id',auth[_0xc06c('0x5')](),controller[_0xc06c('0x14')]);router[_0xc06c('0x13')](_0xc06c('0xa'),auth[_0xc06c('0x5')](),controller['removeTeams']);router[_0xc06c('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xc06c('0x15')]);module[_0xc06c('0x16')]=router; \ No newline at end of file +var _0x59d5=['delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','index','get','/describe','describe','/:id','isAuthenticated','/:id/members','/:id/teams','/:id/users','getAgents','create','addTeams','post','addAgents','put'];(function(_0x359d06,_0x2620c1){var _0x3421f8=function(_0x4bb62c){while(--_0x4bb62c){_0x359d06['push'](_0x359d06['shift']());}};_0x3421f8(++_0x2620c1);}(_0x59d5,0x1a9));var _0x559d=function(_0x50fa85,_0x26cc67){_0x50fa85=_0x50fa85-0x0;var _0x4d40b4=_0x59d5[_0x50fa85];return _0x4d40b4;};'use strict';var multer=require(_0x559d('0x0'));var util=require(_0x559d('0x1'));var path=require('path');var timeout=require(_0x559d('0x2'));var express=require(_0x559d('0x3'));var router=express['Router']();var auth=require(_0x559d('0x4'));var interaction=require(_0x559d('0x5'));var config=require(_0x559d('0x6'));var controller=require(_0x559d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x559d('0x8')]);router[_0x559d('0x9')](_0x559d('0xa'),auth['isAuthenticated'](),controller[_0x559d('0xb')]);router[_0x559d('0x9')](_0x559d('0xc'),auth[_0x559d('0xd')](),controller['show']);router[_0x559d('0x9')](_0x559d('0xe'),auth[_0x559d('0xd')](),controller['getMembers']);router[_0x559d('0x9')](_0x559d('0xf'),auth[_0x559d('0xd')](),controller['getTeams']);router[_0x559d('0x9')](_0x559d('0x10'),auth[_0x559d('0xd')](),controller[_0x559d('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x559d('0x12')]);router['post'](_0x559d('0xf'),auth[_0x559d('0xd')](),controller[_0x559d('0x13')]);router[_0x559d('0x14')]('/:id/users',auth[_0x559d('0xd')](),controller[_0x559d('0x15')]);router[_0x559d('0x16')](_0x559d('0xc'),auth[_0x559d('0xd')](),controller['update']);router[_0x559d('0x17')]('/:id',auth[_0x559d('0xd')](),controller[_0x559d('0x18')]);router[_0x559d('0x17')](_0x559d('0xf'),auth[_0x559d('0xd')](),controller[_0x559d('0x19')]);router[_0x559d('0x17')](_0x559d('0x10'),auth[_0x559d('0xd')](),controller[_0x559d('0x1a')]);module[_0x559d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 5de8fbb..483cdb1 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 _0x8254=['STRING','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x1b49f8,_0x169a66){var _0x5f2442=function(_0x4f2622){while(--_0x4f2622){_0x1b49f8['push'](_0x1b49f8['shift']());}};_0x5f2442(++_0x169a66);}(_0x8254,0x95));var _0x4825=function(_0x3f4511,_0xbc1656){_0x3f4511=_0x3f4511-0x0;var _0x5b527b=_0x8254[_0x3f4511];return _0x5b527b;};'use strict';var Sequelize=require(_0x4825('0x0'));module['exports']={'name':{'type':Sequelize[_0x4825('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4825('0x1')]},'timeout':{'type':Sequelize[_0x4825('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4825('0x3')]('rrmemory',_0x4825('0x4'),_0x4825('0x5'))}}; \ No newline at end of file +var _0x90b1=['rrmemory','beepall','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x47130a,_0xe8ca2a){var _0x3a001f=function(_0xd563c6){while(--_0xd563c6){_0x47130a['push'](_0x47130a['shift']());}};_0x3a001f(++_0xe8ca2a);}(_0x90b1,0x1bb));var _0x190b=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0x90b1[_0x1ee351];return _0x245aaf;};'use strict';var Sequelize=require(_0x190b('0x0'));module[_0x190b('0x1')]={'name':{'type':Sequelize[_0x190b('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x190b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x190b('0x4')](_0x190b('0x5'),_0x190b('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 9330fbe..e6cdaef 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 _0xf9fc=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','end','status','json','limit','set','apply','reject','save','update','then','destroy','get','MailQueues','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','merge','filter','options','MailQueue','count','includeAll','include','findAll','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','UserMailQueue','hasOwnProperty','MailQueueId','User','findAndCountAll','agent','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','each','emit','userMailQueue:save','select','field','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x579cce,_0x31b8d4){var _0x2ea60a=function(_0x1561a9){while(--_0x1561a9){_0x579cce['push'](_0x579cce['shift']());}};_0x2ea60a(++_0x31b8d4);}(_0xf9fc,0x199));var _0xcf9f=function(_0x29e1a5,_0x56f5a3){_0x29e1a5=_0x29e1a5-0x0;var _0x49aa0b=_0xf9fc[_0x29e1a5];return _0x49aa0b;};'use strict';var pdf=require(_0xcf9f('0x0'));var emlformat=require(_0xcf9f('0x1'));var rimraf=require(_0xcf9f('0x2'));var zipdir=require(_0xcf9f('0x3'));var jsonpatch=require(_0xcf9f('0x4'));var rp=require(_0xcf9f('0x5'));var moment=require('moment');var BPromise=require(_0xcf9f('0x6'));var Mustache=require(_0xcf9f('0x7'));var util=require(_0xcf9f('0x8'));var path=require(_0xcf9f('0x9'));var sox=require(_0xcf9f('0xa'));var csv=require(_0xcf9f('0xb'));var ejs=require(_0xcf9f('0xc'));var fs=require('fs');var _=require(_0xcf9f('0xd'));var squel=require(_0xcf9f('0xe'));var crypto=require(_0xcf9f('0xf'));var jsforce=require(_0xcf9f('0x10'));var deskjs=require(_0xcf9f('0x11'));var toCsv=require(_0xcf9f('0xb'));var querystring=require('querystring');var Papa=require(_0xcf9f('0x12'));var Redis=require(_0xcf9f('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcf9f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf9f('0x15'))('api');var utils=require(_0xcf9f('0x16'));var config=require(_0xcf9f('0x17'));var db=require(_0xcf9f('0x18'))['db'];config[_0xcf9f('0x19')]=_[_0xcf9f('0x1a')](config[_0xcf9f('0x19')],{'host':_0xcf9f('0x1b'),'port':0x18eb});var socket=require(_0xcf9f('0x1c'))(new Redis(config['redis']));require(_0xcf9f('0x1d'))[_0xcf9f('0x1e')](socket);function respondWithStatusCode(_0x4f5b09,_0x3cebc8){_0x3cebc8=_0x3cebc8||0xcc;return function(_0x512e2d){if(_0x512e2d){return _0x4f5b09['sendStatus'](_0x3cebc8);}return _0x4f5b09['status'](_0x3cebc8)[_0xcf9f('0x1f')]();};}function respondWithResult(_0x21e27d,_0x1bf4e6){_0x1bf4e6=_0x1bf4e6||0xc8;return function(_0x9aec68){if(_0x9aec68){return _0x21e27d[_0xcf9f('0x20')](_0x1bf4e6)[_0xcf9f('0x21')](_0x9aec68);}};}function respondWithFilteredResult(_0x5475d8,_0x2afbbe){return function(_0x2ee71d){if(_0x2ee71d){var _0x39b3f7=_0x2ee71d['count'],_0x5d3e0f=_0x2afbbe['offset'],_0x7a0fee=_0x2afbbe['offset']+_0x2afbbe[_0xcf9f('0x22')],_0x55d751;if(_0x7a0fee>=_0x39b3f7){_0x7a0fee=_0x39b3f7;_0x55d751=0xc8;}else{_0x55d751=0xce;}_0x5475d8[_0xcf9f('0x20')](_0x55d751);return _0x5475d8[_0xcf9f('0x23')]('Content-Range',_0x5d3e0f+'-'+_0x7a0fee+'/'+_0x39b3f7)[_0xcf9f('0x21')](_0x2ee71d);}return null;};}function patchUpdates(_0x2b7199){return function(_0x4bbbf5){try{jsonpatch[_0xcf9f('0x24')](_0x4bbbf5,_0x2b7199,!![]);}catch(_0xec3d80){return BPromise[_0xcf9f('0x25')](_0xec3d80);}return _0x4bbbf5[_0xcf9f('0x26')]();};}function saveUpdates(_0x8f1d3f,_0x21ab2a){return function(_0x569461){if(_0x569461){return _0x569461[_0xcf9f('0x27')](_0x8f1d3f)[_0xcf9f('0x28')](function(_0x33de14){return _0x33de14;});}return null;};}function removeEntity(_0x3f15e0,_0x50363f){return function(_0x29ece6){if(_0x29ece6){return _0x29ece6[_0xcf9f('0x29')]()[_0xcf9f('0x28')](function(){var _0x45b238=_0x29ece6[_0xcf9f('0x2a')]({'plain':!![]});var _0x3c9e0d=_0xcf9f('0x2b');return db['UserProfileResource'][_0xcf9f('0x29')]({'where':{'type':_0x3c9e0d,'resourceId':_0x45b238['id']}})['then'](function(){return _0x29ece6;});})['then'](function(){_0x3f15e0['status'](0xcc)[_0xcf9f('0x1f')]();});}};}function handleEntityNotFound(_0x468f43,_0x1c0899){return function(_0x23949d){if(!_0x23949d){_0x468f43['sendStatus'](0x194);}return _0x23949d;};}function handleError(_0x2c5e73,_0x5274be){_0x5274be=_0x5274be||0x1f4;return function(_0x415545){logger['error'](_0x415545[_0xcf9f('0x2c')]);if(_0x415545[_0xcf9f('0x2d')]){delete _0x415545[_0xcf9f('0x2d')];}_0x2c5e73[_0xcf9f('0x20')](_0x5274be)[_0xcf9f('0x2e')](_0x415545);};}exports['index']=function(_0x2c1045,_0x2ea8aa){var _0xa69161={},_0x3c41f0={},_0x4bc8d7={'count':0x0,'rows':[]};var _0x384cc8=_[_0xcf9f('0x2f')](db['MailQueue'][_0xcf9f('0x30')],function(_0x2d97ca){return{'name':_0x2d97ca['fieldName'],'type':_0x2d97ca[_0xcf9f('0x31')][_0xcf9f('0x32')]};});_0x3c41f0[_0xcf9f('0x33')]=_['map'](_0x384cc8,'name');_0x3c41f0[_0xcf9f('0x34')]=_[_0xcf9f('0x35')](_0x2c1045[_0xcf9f('0x34')]);_0x3c41f0[_0xcf9f('0x36')]=_[_0xcf9f('0x37')](_0x3c41f0[_0xcf9f('0x33')],_0x3c41f0[_0xcf9f('0x34')]);_0xa69161[_0xcf9f('0x38')]=_[_0xcf9f('0x37')](_0x3c41f0['model'],qs[_0xcf9f('0x39')](_0x2c1045['query']['fields']));_0xa69161[_0xcf9f('0x38')]=_0xa69161[_0xcf9f('0x38')][_0xcf9f('0x3a')]?_0xa69161[_0xcf9f('0x38')]:_0x3c41f0[_0xcf9f('0x33')];if(!_0x2c1045[_0xcf9f('0x34')]['hasOwnProperty'](_0xcf9f('0x3b'))){_0xa69161[_0xcf9f('0x22')]=qs[_0xcf9f('0x22')](_0x2c1045['query'][_0xcf9f('0x22')]);_0xa69161['offset']=qs['offset'](_0x2c1045['query'][_0xcf9f('0x3c')]);}_0xa69161[_0xcf9f('0x3d')]=qs[_0xcf9f('0x3e')](_0x2c1045['query'][_0xcf9f('0x3e')]);_0xa69161[_0xcf9f('0x3f')]=qs[_0xcf9f('0x36')](_[_0xcf9f('0x40')](_0x2c1045[_0xcf9f('0x34')],_0x3c41f0[_0xcf9f('0x36')]));if(_0x2c1045['query']['filter']){_0xa69161[_0xcf9f('0x3f')]=_[_0xcf9f('0x41')](_0xa69161['where'],{'$or':_[_0xcf9f('0x2f')](_0x384cc8,function(_0x3550df){if(_0x3550df[_0xcf9f('0x31')]!=='VIRTUAL'){var _0x36dd12={};_0x36dd12[_0x3550df['name']]={'$like':'%'+_0x2c1045[_0xcf9f('0x34')][_0xcf9f('0x42')]+'%'};return _0x36dd12;}})});}_0xa69161=_[_0xcf9f('0x41')]({},_0xa69161,_0x2c1045[_0xcf9f('0x43')]);var _0x51eafb={'where':_0xa69161[_0xcf9f('0x3f')]};return db[_0xcf9f('0x44')]['count'](_0x51eafb)[_0xcf9f('0x28')](function(_0x4f4bf1){_0x4bc8d7[_0xcf9f('0x45')]=_0x4f4bf1;if(_0x2c1045[_0xcf9f('0x34')][_0xcf9f('0x46')]){_0xa69161[_0xcf9f('0x47')]=[{'all':!![]}];}return db[_0xcf9f('0x44')][_0xcf9f('0x48')](_0xa69161);})[_0xcf9f('0x28')](function(_0x55ebbd){_0x4bc8d7[_0xcf9f('0x49')]=_0x55ebbd;return _0x4bc8d7;})[_0xcf9f('0x28')](respondWithFilteredResult(_0x2ea8aa,_0xa69161))[_0xcf9f('0x4a')](handleError(_0x2ea8aa,null));};exports[_0xcf9f('0x4b')]=function(_0x1d64d9,_0x416e05){var _0x4ad30c={'raw':!![],'where':{'id':_0x1d64d9[_0xcf9f('0x4c')]['id']}},_0x4ee38e={};_0x4ee38e[_0xcf9f('0x33')]=_['keys'](db['MailQueue'][_0xcf9f('0x30')]);_0x4ee38e[_0xcf9f('0x34')]=_['keys'](_0x1d64d9['query']);_0x4ee38e['filters']=_['intersection'](_0x4ee38e[_0xcf9f('0x33')],_0x4ee38e[_0xcf9f('0x34')]);_0x4ad30c[_0xcf9f('0x38')]=_[_0xcf9f('0x37')](_0x4ee38e[_0xcf9f('0x33')],qs[_0xcf9f('0x39')](_0x1d64d9[_0xcf9f('0x34')]['fields']));_0x4ad30c[_0xcf9f('0x38')]=_0x4ad30c[_0xcf9f('0x38')][_0xcf9f('0x3a')]?_0x4ad30c[_0xcf9f('0x38')]:_0x4ee38e[_0xcf9f('0x33')];if(_0x1d64d9[_0xcf9f('0x34')][_0xcf9f('0x46')]){_0x4ad30c[_0xcf9f('0x47')]=[{'all':!![]}];}_0x4ad30c=_[_0xcf9f('0x41')]({},_0x4ad30c,_0x1d64d9['options']);return db[_0xcf9f('0x44')]['find'](_0x4ad30c)['then'](handleEntityNotFound(_0x416e05,null))['then'](respondWithResult(_0x416e05,null))['catch'](handleError(_0x416e05,null));};exports[_0xcf9f('0x4d')]=function(_0x4872a7,_0x402fe1){return db[_0xcf9f('0x44')]['create'](_0x4872a7[_0xcf9f('0x4e')],{})['then'](function(_0x4b267d){var _0x4e3e7b=_0x4872a7['user'][_0xcf9f('0x2a')]({'plain':!![]});if(!_0x4e3e7b)throw new Error(_0xcf9f('0x4f'));if(_0x4e3e7b[_0xcf9f('0x50')]==='user'){var _0x22da2d=_0x4b267d[_0xcf9f('0x2a')]({'plain':!![]});var _0x48801d=_0xcf9f('0x2b');return db[_0xcf9f('0x51')][_0xcf9f('0x52')]({'where':{'name':_0x48801d,'userProfileId':_0x4e3e7b['userProfileId']},'raw':!![]})[_0xcf9f('0x28')](function(_0x2ee472){if(_0x2ee472&&_0x2ee472[_0xcf9f('0x53')]===0x0){return db[_0xcf9f('0x54')]['create']({'name':_0x22da2d[_0xcf9f('0x2d')],'resourceId':_0x22da2d['id'],'type':_0x2ee472[_0xcf9f('0x2d')],'sectionId':_0x2ee472['id']},{})['then'](function(){return _0x4b267d;});}else{return _0x4b267d;}})[_0xcf9f('0x4a')](function(_0x53c552){logger[_0xcf9f('0x55')](_0xcf9f('0x56'),_0x53c552);throw _0x53c552;});}return _0x4b267d;})['then'](respondWithResult(_0x402fe1,0xc9))['catch'](handleError(_0x402fe1,null));};exports[_0xcf9f('0x27')]=function(_0x544c98,_0x5452bb){if(_0x544c98[_0xcf9f('0x4e')]['id']){delete _0x544c98[_0xcf9f('0x4e')]['id'];}return db[_0xcf9f('0x44')][_0xcf9f('0x52')]({'where':{'id':_0x544c98[_0xcf9f('0x4c')]['id']}})[_0xcf9f('0x28')](handleEntityNotFound(_0x5452bb,null))[_0xcf9f('0x28')](saveUpdates(_0x544c98[_0xcf9f('0x4e')],null))[_0xcf9f('0x28')](respondWithResult(_0x5452bb,null))[_0xcf9f('0x4a')](handleError(_0x5452bb,null));};exports['destroy']=function(_0x3e9650,_0x2fd70c){return db[_0xcf9f('0x44')]['find']({'where':{'id':_0x3e9650[_0xcf9f('0x4c')]['id']}})[_0xcf9f('0x28')](handleEntityNotFound(_0x2fd70c,null))['then'](removeEntity(_0x2fd70c,null))[_0xcf9f('0x4a')](handleError(_0x2fd70c,null));};exports['describe']=function(_0x4c7924,_0x12eda1){return db[_0xcf9f('0x44')]['describe']()[_0xcf9f('0x28')](respondWithResult(_0x12eda1,null))[_0xcf9f('0x4a')](handleError(_0x12eda1,null));};exports['getMembers']=function(_0x4436e4,_0x323188,_0x3a5121){var _0x3f57fb={'raw':!![],'where':{}},_0x247fdc={},_0x18727d;return db[_0xcf9f('0x44')][_0xcf9f('0x57')]({'where':{'id':_0x4436e4['params']['id']}})[_0xcf9f('0x28')](handleEntityNotFound(_0x323188,null))[_0xcf9f('0x28')](function(_0x3b4e2c){if(_0x3b4e2c){_0x18727d=_0x3b4e2c[_0xcf9f('0x2a')]({'plain':!![]});_0x247fdc[_0xcf9f('0x33')]=_[_0xcf9f('0x35')](db[_0xcf9f('0x58')][_0xcf9f('0x30')]);_0x247fdc['query']=_[_0xcf9f('0x35')](_0x4436e4['query']);_0x247fdc['filters']=_['intersection'](_0x247fdc['model'],_0x247fdc[_0xcf9f('0x34')]);_0x3f57fb[_0xcf9f('0x38')]=_['intersection'](_0x247fdc['model'],qs['fields'](_0x4436e4[_0xcf9f('0x34')]['fields']));_0x3f57fb[_0xcf9f('0x38')]=_0x3f57fb[_0xcf9f('0x38')][_0xcf9f('0x3a')]?_0x3f57fb[_0xcf9f('0x38')]:_0x247fdc[_0xcf9f('0x33')];if(!_0x4436e4[_0xcf9f('0x34')][_0xcf9f('0x59')](_0xcf9f('0x3b'))){_0x3f57fb[_0xcf9f('0x22')]=qs['limit'](_0x4436e4[_0xcf9f('0x34')][_0xcf9f('0x22')]);_0x3f57fb['offset']=qs[_0xcf9f('0x3c')](_0x4436e4[_0xcf9f('0x34')][_0xcf9f('0x3c')]);}_0x3f57fb['order']=qs[_0xcf9f('0x3e')](_0x4436e4[_0xcf9f('0x34')][_0xcf9f('0x3e')]);_0x3f57fb[_0xcf9f('0x3f')]=qs[_0xcf9f('0x36')](_['pick'](_0x4436e4[_0xcf9f('0x34')],_0x247fdc[_0xcf9f('0x36')]));_0x3f57fb[_0xcf9f('0x3f')][_0xcf9f('0x5a')]=_0x3b4e2c['id'];if(_0x4436e4[_0xcf9f('0x34')][_0xcf9f('0x42')]){_0x3f57fb[_0xcf9f('0x3f')]=_[_0xcf9f('0x41')](_0x3f57fb['where'],{'$or':_[_0xcf9f('0x2f')](_0x3f57fb[_0xcf9f('0x38')],function(_0x162ae4){var _0x26835f={};_0x26835f[_0x162ae4]={'$like':'%'+_0x4436e4[_0xcf9f('0x34')][_0xcf9f('0x42')]+'%'};return _0x26835f;})});}_0x3f57fb=_['merge']({},_0x3f57fb,_0x4436e4[_0xcf9f('0x43')]);return db['UserMailQueue']['findAll'](_0x3f57fb);}})[_0xcf9f('0x28')](function(_0xdc45a4){if(_0xdc45a4){return db[_0xcf9f('0x5b')][_0xcf9f('0x5c')]({'where':{'id':_[_0xcf9f('0x2f')](_0xdc45a4,'UserId'),'role':_0xcf9f('0x5d')},'attributes':['id','name',_0xcf9f('0x5e'),'updatedAt',_0xcf9f('0x5f')]});}})['then'](function(_0x2296ee){if(_0x2296ee){return{'count':_0x2296ee['count'],'rows':_['map'](_0x2296ee[_0xcf9f('0x49')],function(_0x5f5c5f){return{'membername':_0x5f5c5f[_0xcf9f('0x2d')],'UserId':_0x5f5c5f['id'],'queue_name':_0x18727d['name'],'MailQueueId':_0x18727d['id'],'interface':util[_0xcf9f('0x60')](_0xcf9f('0x61'),_0xcf9f('0x62'),_0x5f5c5f[_0xcf9f('0x2d')]),'penalty':0x0,'paused':_0x5f5c5f['mailPause'],'createdAt':_0x5f5c5f[_0xcf9f('0x5f')],'updatedAt':_0x5f5c5f[_0xcf9f('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x323188,_0x3f57fb))[_0xcf9f('0x4a')](handleError(_0x323188,null));};exports[_0xcf9f('0x64')]=function(_0x527356,_0x25c898,_0x5a7952){var _0x356167={};var _0x14309a={};var _0x510f77;var _0x16245d;return db['MailQueue']['findOne']({'where':{'id':_0x527356[_0xcf9f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x25c898,null))['then'](function(_0x15e5f8){if(_0x15e5f8){_0x510f77=_0x15e5f8;_0x14309a[_0xcf9f('0x33')]=_[_0xcf9f('0x35')](db['Team'][_0xcf9f('0x30')]);_0x14309a[_0xcf9f('0x34')]=_[_0xcf9f('0x35')](_0x527356[_0xcf9f('0x34')]);_0x14309a[_0xcf9f('0x36')]=_['intersection'](_0x14309a[_0xcf9f('0x33')],_0x14309a[_0xcf9f('0x34')]);_0x356167['attributes']=_[_0xcf9f('0x37')](_0x14309a['model'],qs[_0xcf9f('0x39')](_0x527356[_0xcf9f('0x34')][_0xcf9f('0x39')]));_0x356167[_0xcf9f('0x38')]=_0x356167[_0xcf9f('0x38')][_0xcf9f('0x3a')]?_0x356167[_0xcf9f('0x38')]:_0x14309a[_0xcf9f('0x33')];_0x356167[_0xcf9f('0x3d')]=qs[_0xcf9f('0x3e')](_0x527356[_0xcf9f('0x34')][_0xcf9f('0x3e')]);_0x356167[_0xcf9f('0x3f')]=qs[_0xcf9f('0x36')](_['pick'](_0x527356['query'],_0x14309a['filters']));if(_0x527356['query'][_0xcf9f('0x42')]){_0x356167[_0xcf9f('0x3f')]=_[_0xcf9f('0x41')](_0x356167[_0xcf9f('0x3f')],{'$or':_[_0xcf9f('0x2f')](_0x356167[_0xcf9f('0x38')],function(_0x289f75){var _0x1f6459={};_0x1f6459[_0x289f75]={'$like':'%'+_0x527356[_0xcf9f('0x34')][_0xcf9f('0x42')]+'%'};return _0x1f6459;})});}_0x356167=_[_0xcf9f('0x41')]({},_0x356167,_0x527356[_0xcf9f('0x43')]);return _0x510f77[_0xcf9f('0x64')](_0x356167);}})[_0xcf9f('0x28')](function(_0x428c24){if(_0x428c24){_0x16245d=_0x428c24[_0xcf9f('0x3a')];if(!_0x527356[_0xcf9f('0x34')][_0xcf9f('0x59')](_0xcf9f('0x3b'))){_0x356167[_0xcf9f('0x22')]=qs[_0xcf9f('0x22')](_0x527356[_0xcf9f('0x34')]['limit']);_0x356167[_0xcf9f('0x3c')]=qs['offset'](_0x527356[_0xcf9f('0x34')][_0xcf9f('0x3c')]);}return _0x510f77[_0xcf9f('0x64')](_0x356167);}})[_0xcf9f('0x28')](function(_0x1a7e1a){if(_0x1a7e1a){return _0x1a7e1a?{'count':_0x16245d,'rows':_0x1a7e1a}:null;}})['then'](respondWithResult(_0x25c898,null))[_0xcf9f('0x4a')](handleError(_0x25c898,null));};exports[_0xcf9f('0x65')]=function(_0x42f03a,_0x50016d,_0x336150){var _0x4d68d3=_0x42f03a['body'][_0xcf9f('0x66')];return db[_0xcf9f('0x67')][_0xcf9f('0x48')]({'where':{'id':_0x4d68d3},'attributes':['id'],'include':[{'model':db[_0xcf9f('0x5b')],'as':_0xcf9f('0x68'),'attributes':['id',_0xcf9f('0x2d'),_0xcf9f('0x69'),_0xcf9f('0x6a'),_0xcf9f('0x6b')],'raw':!![]}]})[_0xcf9f('0x28')](function(_0x4f45df){if(_0x4f45df){var _0x3c3320=_[_0xcf9f('0x6c')](_0x4f45df,function(_0x13c676){var _0x5b5205=_0x13c676[_0xcf9f('0x2a')]({'plain':!![]});return _0x5b5205[_0xcf9f('0x68')];});return db[_0xcf9f('0x44')][_0xcf9f('0x52')]({'where':{'id':_0x42f03a['params']['id']}})[_0xcf9f('0x28')](function(_0x43767f){return db['sequelize']['transaction'](function(_0x4525fe){return _0x43767f[_0xcf9f('0x65')](_0x4d68d3,{'transaction':_0x4525fe})['then'](function(){return BPromise[_0xcf9f('0x6d')](_0x3c3320,function(_0x57f5df){return db[_0xcf9f('0x58')]['findOrCreate']({'where':{'UserId':_0x57f5df['id'],'MailQueueId':_0x42f03a['params']['id']},'transaction':_0x4525fe});});})[_0xcf9f('0x28')](function(){_0x3c3320['forEach'](function(_0x54d4fd){socket[_0xcf9f('0x6e')](_0xcf9f('0x6f'),{'UserId':_0x54d4fd['id'],'MailQueueId':_0x43767f['id']});});});});});}})['then'](respondWithStatusCode(_0x50016d,null))['catch'](handleError(_0x50016d,null));};exports['removeTeams']=function(_0x2e7b63,_0x1c50ca,_0xbdd94f){return db[_0xcf9f('0x67')][_0xcf9f('0x48')]({'where':{'id':_0x2e7b63['query'][_0xcf9f('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xcf9f('0x28')](handleEntityNotFound(_0x1c50ca,null))[_0xcf9f('0x28')](function(_0x2826a7){var _0x13d608=_['map'](_0x2826a7,'id');var _0x5500f1=[];var _0x1fd384=[];var _0x46ba81=squel[_0xcf9f('0x70')]();_0x46ba81[_0xcf9f('0x71')]('tq.TeamId')[_0xcf9f('0x72')](_0xcf9f('0x73'),'tq')[_0xcf9f('0x74')]('user_has_teams','ut',_0xcf9f('0x75'))[_0xcf9f('0x3f')](_0xcf9f('0x76'),_0x2e7b63[_0xcf9f('0x4c')]['id']);for(var _0x248b1d=0x0;_0x248b1d<_0x2826a7[_0xcf9f('0x3a')];_0x248b1d+=0x1){let _0x506056=_0x2826a7[_0x248b1d];for(var _0x15025d=0x0;_0x15025d<_0x506056[_0xcf9f('0x68')][_0xcf9f('0x3a')];_0x15025d+=0x1){let _0x5cd143=_0x506056[_0xcf9f('0x68')][_0x15025d];var _0x20d8bf=_0x46ba81['clone']();_0x20d8bf[_0xcf9f('0x3f')]('ut.UserId\x20=\x20?',_0x5cd143['id']);_0x1fd384[_0xcf9f('0x77')](db[_0xcf9f('0x78')][_0xcf9f('0x34')](_0x20d8bf[_0xcf9f('0x79')](),{'type':db[_0xcf9f('0x78')][_0xcf9f('0x7a')][_0xcf9f('0x7b')]})[_0xcf9f('0x28')](function(_0x393f58){if(_0x393f58[_0xcf9f('0x3a')]===0x1){return _0x5cd143['id'];}else{var _0x3ed004=_[_0xcf9f('0x7c')](_[_0xcf9f('0x2f')](_0x393f58,'TeamId'),function(_0x5d7ef9){return _[_0xcf9f('0x7d')](_0x13d608,_0x5d7ef9);});if(_0x3ed004){return _0x5cd143['id'];}}}));}}return BPromise[_0xcf9f('0x7e')](_0x1fd384)[_0xcf9f('0x28')](function(_0x2cb036){_0x5500f1=_(_0x5500f1)[_0xcf9f('0x7f')](_0x2cb036)[_0xcf9f('0x80')]()[_0xcf9f('0x81')]();return db[_0xcf9f('0x44')][_0xcf9f('0x52')]({'where':{'id':_0x2e7b63[_0xcf9f('0x4c')]['id']}})[_0xcf9f('0x28')](function(_0x4d67ff){return db[_0xcf9f('0x78')]['transaction'](function(_0x44506b){return _0x4d67ff[_0xcf9f('0x82')](_0x2e7b63[_0xcf9f('0x34')][_0xcf9f('0x66')],{'transaction':_0x44506b})['then'](function(){if(!_[_0xcf9f('0x83')](_0x5500f1)){return _0x4d67ff[_0xcf9f('0x84')](_0x5500f1,{'transaction':_0x44506b});}})[_0xcf9f('0x28')](function(){_0x5500f1[_0xcf9f('0x85')](function(_0x25653e){socket[_0xcf9f('0x6e')](_0xcf9f('0x86'),{'UserId':_0x25653e,'MailQueueId':_0x4d67ff['id']});});});});});});})[_0xcf9f('0x28')](respondWithStatusCode(_0x1c50ca,null))[_0xcf9f('0x4a')](handleError(_0x1c50ca,null));};exports['addAgents']=function(_0x22848d,_0x4cc9f4,_0x58c5f0){return db[_0xcf9f('0x44')][_0xcf9f('0x52')]({'where':{'id':_0x22848d[_0xcf9f('0x4c')]['id']}})[_0xcf9f('0x28')](handleEntityNotFound(_0x4cc9f4,null))[_0xcf9f('0x28')](function(_0x4bcddc){if(_0x4bcddc){return _0x4bcddc[_0xcf9f('0x87')](_0x22848d['body']['ids'],_[_0xcf9f('0x88')](_0x22848d['body'],[_0xcf9f('0x66'),'id'])||{})[_0xcf9f('0x89')](function(_0x1da908){for(var _0x1bb784=0x0;_0x1bb784<_0x22848d[_0xcf9f('0x4e')][_0xcf9f('0x66')][_0xcf9f('0x3a')];_0x1bb784+=0x1){socket['emit']('userMailQueue:save',{'UserId':_0x22848d[_0xcf9f('0x4e')][_0xcf9f('0x66')][_0x1bb784],'MailQueueId':_0x22848d[_0xcf9f('0x4c')]['id']});}return _0x1da908;});}})[_0xcf9f('0x28')](respondWithResult(_0x4cc9f4,null))[_0xcf9f('0x4a')](handleError(_0x4cc9f4,null));};exports[_0xcf9f('0x84')]=function(_0x345cea,_0x225a4d,_0x2be9bc){return db[_0xcf9f('0x44')][_0xcf9f('0x52')]({'where':{'id':_0x345cea[_0xcf9f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x225a4d,null))['then'](function(_0x2c4eed){if(_0x2c4eed){return _0x2c4eed[_0xcf9f('0x84')](_0x345cea[_0xcf9f('0x34')][_0xcf9f('0x66')])[_0xcf9f('0x28')](function(){if(_[_0xcf9f('0x8a')](_0x345cea[_0xcf9f('0x34')][_0xcf9f('0x66')])){for(var _0x489df4=0x0;_0x489df4<_0x345cea[_0xcf9f('0x34')]['ids']['length'];_0x489df4+=0x1){socket['emit'](_0xcf9f('0x86'),{'UserId':Number(_0x345cea[_0xcf9f('0x34')][_0xcf9f('0x66')][_0x489df4]),'MailQueueId':Number(_0x345cea[_0xcf9f('0x4c')]['id'])});}}else{socket[_0xcf9f('0x6e')](_0xcf9f('0x86'),{'UserId':Number(_0x345cea[_0xcf9f('0x34')][_0xcf9f('0x66')]),'MailQueueId':Number(_0x345cea[_0xcf9f('0x4c')]['id'])});}});}})[_0xcf9f('0x28')](respondWithStatusCode(_0x225a4d,null))[_0xcf9f('0x4a')](handleError(_0x225a4d,null));};exports['getAgents']=function(_0x183564,_0x469043,_0x1c0659){var _0x3738c6={};var _0x3aedd7={};var _0x5a4b16;var _0x8109f3;return db['MailQueue'][_0xcf9f('0x57')]({'where':{'id':_0x183564[_0xcf9f('0x4c')]['id']}})[_0xcf9f('0x28')](handleEntityNotFound(_0x469043,null))[_0xcf9f('0x28')](function(_0x2ed1bb){if(_0x2ed1bb){_0x5a4b16=_0x2ed1bb;_0x3aedd7['model']=_[_0xcf9f('0x35')](db['User']['rawAttributes']);_0x3aedd7[_0xcf9f('0x34')]=_[_0xcf9f('0x35')](_0x183564[_0xcf9f('0x34')]);_0x3aedd7[_0xcf9f('0x36')]=_[_0xcf9f('0x37')](_0x3aedd7[_0xcf9f('0x33')],_0x3aedd7[_0xcf9f('0x34')]);_0x3738c6[_0xcf9f('0x38')]=_[_0xcf9f('0x37')](_0x3aedd7[_0xcf9f('0x33')],qs['fields'](_0x183564[_0xcf9f('0x34')][_0xcf9f('0x39')]));_0x3738c6[_0xcf9f('0x38')]=_0x3738c6[_0xcf9f('0x38')][_0xcf9f('0x3a')]?_0x3738c6[_0xcf9f('0x38')]:_0x3aedd7[_0xcf9f('0x33')];_0x3738c6['order']=qs[_0xcf9f('0x3e')](_0x183564[_0xcf9f('0x34')][_0xcf9f('0x3e')]);_0x3738c6['where']=qs['filters'](_[_0xcf9f('0x40')](_0x183564['query'],_0x3aedd7[_0xcf9f('0x36')]));if(_0x183564[_0xcf9f('0x34')]['filter']){_0x3738c6[_0xcf9f('0x3f')]=_[_0xcf9f('0x41')](_0x3738c6[_0xcf9f('0x3f')],{'$or':_[_0xcf9f('0x2f')](_0x3738c6[_0xcf9f('0x38')],function(_0x1b157f){var _0x22dfaa={};_0x22dfaa[_0x1b157f]={'$like':'%'+_0x183564[_0xcf9f('0x34')][_0xcf9f('0x42')]+'%'};return _0x22dfaa;})});}_0x3738c6=_[_0xcf9f('0x41')]({},_0x3738c6,_0x183564[_0xcf9f('0x43')]);return _0x5a4b16[_0xcf9f('0x8b')](_0x3738c6);}})[_0xcf9f('0x28')](function(_0x42dd58){if(_0x42dd58){_0x8109f3=_0x42dd58['length'];if(!_0x183564['query']['hasOwnProperty'](_0xcf9f('0x3b'))){_0x3738c6['limit']=qs['limit'](_0x183564[_0xcf9f('0x34')][_0xcf9f('0x22')]);_0x3738c6['offset']=qs['offset'](_0x183564['query'][_0xcf9f('0x3c')]);}return _0x5a4b16['getAgents'](_0x3738c6);}})[_0xcf9f('0x28')](function(_0x542a36){if(_0x542a36){return _0x542a36?{'count':_0x8109f3,'rows':_0x542a36}:null;}})[_0xcf9f('0x28')](respondWithResult(_0x469043,null))[_0xcf9f('0x4a')](handleError(_0x469043,null));}; \ No newline at end of file +var _0xebae=['rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','defaults','redis','localhost','./mailQueue.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','end','error','index','MailQueue','fieldName','key','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','params','rawAttributes','includeAll','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','getMembers','findOne','UserMailQueue','order','MailQueueId','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','%s/%s','getTeams','addTeams','ids','Team','Agents','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','User','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','value','removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format'];(function(_0x8330cd,_0x3bf6fe){var _0xfff0ed=function(_0x355c90){while(--_0x355c90){_0x8330cd['push'](_0x8330cd['shift']());}};_0xfff0ed(++_0x3bf6fe);}(_0xebae,0x19f));var _0xeeba=function(_0x3f5210,_0x32f195){_0x3f5210=_0x3f5210-0x0;var _0x53c3ab=_0xebae[_0x3f5210];return _0x53c3ab;};'use strict';var pdf=require(_0xeeba('0x0'));var emlformat=require(_0xeeba('0x1'));var rimraf=require(_0xeeba('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeeba('0x3'));var moment=require(_0xeeba('0x4'));var BPromise=require(_0xeeba('0x5'));var Mustache=require(_0xeeba('0x6'));var util=require(_0xeeba('0x7'));var path=require(_0xeeba('0x8'));var sox=require(_0xeeba('0x9'));var csv=require(_0xeeba('0xa'));var ejs=require(_0xeeba('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xeeba('0xc'));var deskjs=require(_0xeeba('0xd'));var toCsv=require('to-csv');var querystring=require(_0xeeba('0xe'));var Papa=require(_0xeeba('0xf'));var Redis=require(_0xeeba('0x10'));var authService=require(_0xeeba('0x11'));var qs=require(_0xeeba('0x12'));var as=require(_0xeeba('0x13'));var hardwareService=require(_0xeeba('0x14'));var logger=require(_0xeeba('0x15'))(_0xeeba('0x16'));var utils=require(_0xeeba('0x17'));var config=require(_0xeeba('0x18'));var db=require(_0xeeba('0x19'))['db'];config['redis']=_[_0xeeba('0x1a')](config[_0xeeba('0x1b')],{'host':_0xeeba('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeeba('0x1b')]));require(_0xeeba('0x1d'))[_0xeeba('0x1e')](socket);function respondWithStatusCode(_0x89efde,_0x42701b){_0x42701b=_0x42701b||0xcc;return function(_0x5c1aae){if(_0x5c1aae){return _0x89efde[_0xeeba('0x1f')](_0x42701b);}return _0x89efde[_0xeeba('0x20')](_0x42701b)['end']();};}function respondWithResult(_0x4fd245,_0x1bfad4){_0x1bfad4=_0x1bfad4||0xc8;return function(_0x12da8a){if(_0x12da8a){return _0x4fd245[_0xeeba('0x20')](_0x1bfad4)['json'](_0x12da8a);}};}function respondWithFilteredResult(_0x10f3fb,_0x1d818f){return function(_0x2e8a48){if(_0x2e8a48){var _0xcf182f=_0x2e8a48[_0xeeba('0x21')],_0x3e277d=_0x1d818f['offset'],_0x471823=_0x1d818f[_0xeeba('0x22')]+_0x1d818f[_0xeeba('0x23')],_0x3e0380;if(_0x471823>=_0xcf182f){_0x471823=_0xcf182f;_0x3e0380=0xc8;}else{_0x3e0380=0xce;}_0x10f3fb[_0xeeba('0x20')](_0x3e0380);return _0x10f3fb[_0xeeba('0x24')](_0xeeba('0x25'),_0x3e277d+'-'+_0x471823+'/'+_0xcf182f)[_0xeeba('0x26')](_0x2e8a48);}return null;};}function patchUpdates(_0xddcf5b){return function(_0x596752){try{jsonpatch['apply'](_0x596752,_0xddcf5b,!![]);}catch(_0x479235){return BPromise[_0xeeba('0x27')](_0x479235);}return _0x596752[_0xeeba('0x28')]();};}function saveUpdates(_0x344e05,_0x5bd42d){return function(_0x20f22e){if(_0x20f22e){return _0x20f22e[_0xeeba('0x29')](_0x344e05)[_0xeeba('0x2a')](function(_0x3adab3){return _0x3adab3;});}return null;};}function removeEntity(_0x4efa67,_0x320e67){return function(_0x29de76){if(_0x29de76){return _0x29de76[_0xeeba('0x2b')]()[_0xeeba('0x2a')](function(){var _0x30572c=_0x29de76[_0xeeba('0x2c')]({'plain':!![]});var _0x25c4e2=_0xeeba('0x2d');return db[_0xeeba('0x2e')][_0xeeba('0x2b')]({'where':{'type':_0x25c4e2,'resourceId':_0x30572c['id']}})['then'](function(){return _0x29de76;});})['then'](function(){_0x4efa67[_0xeeba('0x20')](0xcc)[_0xeeba('0x2f')]();});}};}function handleEntityNotFound(_0x11f589,_0x5612d5){return function(_0x1055bf){if(!_0x1055bf){_0x11f589[_0xeeba('0x1f')](0x194);}return _0x1055bf;};}function handleError(_0xa6b3d5,_0x21a94d){_0x21a94d=_0x21a94d||0x1f4;return function(_0x460028){logger[_0xeeba('0x30')](_0x460028['stack']);if(_0x460028['name']){delete _0x460028['name'];}_0xa6b3d5[_0xeeba('0x20')](_0x21a94d)['send'](_0x460028);};}exports[_0xeeba('0x31')]=function(_0x582e6c,_0x3e061c){var _0x4e83b8={},_0x34332f={},_0xd989b3={'count':0x0,'rows':[]};var _0x3bb1f2=_['map'](db[_0xeeba('0x32')]['rawAttributes'],function(_0x50b33e){return{'name':_0x50b33e[_0xeeba('0x33')],'type':_0x50b33e['type'][_0xeeba('0x34')]};});_0x34332f['model']=_['map'](_0x3bb1f2,_0xeeba('0x35'));_0x34332f[_0xeeba('0x36')]=_[_0xeeba('0x37')](_0x582e6c[_0xeeba('0x36')]);_0x34332f[_0xeeba('0x38')]=_[_0xeeba('0x39')](_0x34332f[_0xeeba('0x3a')],_0x34332f[_0xeeba('0x36')]);_0x4e83b8['attributes']=_['intersection'](_0x34332f[_0xeeba('0x3a')],qs[_0xeeba('0x3b')](_0x582e6c['query'][_0xeeba('0x3b')]));_0x4e83b8[_0xeeba('0x3c')]=_0x4e83b8[_0xeeba('0x3c')][_0xeeba('0x3d')]?_0x4e83b8[_0xeeba('0x3c')]:_0x34332f[_0xeeba('0x3a')];if(!_0x582e6c[_0xeeba('0x36')][_0xeeba('0x3e')](_0xeeba('0x3f'))){_0x4e83b8[_0xeeba('0x23')]=qs[_0xeeba('0x23')](_0x582e6c[_0xeeba('0x36')][_0xeeba('0x23')]);_0x4e83b8[_0xeeba('0x22')]=qs[_0xeeba('0x22')](_0x582e6c[_0xeeba('0x36')][_0xeeba('0x22')]);}_0x4e83b8['order']=qs[_0xeeba('0x40')](_0x582e6c[_0xeeba('0x36')][_0xeeba('0x40')]);_0x4e83b8[_0xeeba('0x41')]=qs[_0xeeba('0x38')](_[_0xeeba('0x42')](_0x582e6c[_0xeeba('0x36')],_0x34332f['filters']));if(_0x582e6c[_0xeeba('0x36')][_0xeeba('0x43')]){_0x4e83b8[_0xeeba('0x41')]=_[_0xeeba('0x44')](_0x4e83b8[_0xeeba('0x41')],{'$or':_[_0xeeba('0x45')](_0x3bb1f2,function(_0x2350c7){if(_0x2350c7['type']!==_0xeeba('0x46')){var _0x1620ad={};_0x1620ad[_0x2350c7[_0xeeba('0x35')]]={'$like':'%'+_0x582e6c[_0xeeba('0x36')][_0xeeba('0x43')]+'%'};return _0x1620ad;}})});}_0x4e83b8=_[_0xeeba('0x44')]({},_0x4e83b8,_0x582e6c[_0xeeba('0x47')]);var _0x3cc22f={'where':_0x4e83b8['where']};return db[_0xeeba('0x32')][_0xeeba('0x21')](_0x3cc22f)[_0xeeba('0x2a')](function(_0x1770d6){_0xd989b3[_0xeeba('0x21')]=_0x1770d6;if(_0x582e6c[_0xeeba('0x36')]['includeAll']){_0x4e83b8[_0xeeba('0x48')]=[{'all':!![]}];}return db[_0xeeba('0x32')][_0xeeba('0x49')](_0x4e83b8);})[_0xeeba('0x2a')](function(_0x45b559){_0xd989b3[_0xeeba('0x4a')]=_0x45b559;return _0xd989b3;})['then'](respondWithFilteredResult(_0x3e061c,_0x4e83b8))['catch'](handleError(_0x3e061c,null));};exports['show']=function(_0x353bc9,_0x4a5517){var _0x12aad8={'raw':!![],'where':{'id':_0x353bc9[_0xeeba('0x4b')]['id']}},_0x3f107f={};_0x3f107f[_0xeeba('0x3a')]=_[_0xeeba('0x37')](db[_0xeeba('0x32')][_0xeeba('0x4c')]);_0x3f107f[_0xeeba('0x36')]=_[_0xeeba('0x37')](_0x353bc9['query']);_0x3f107f[_0xeeba('0x38')]=_[_0xeeba('0x39')](_0x3f107f[_0xeeba('0x3a')],_0x3f107f[_0xeeba('0x36')]);_0x12aad8[_0xeeba('0x3c')]=_[_0xeeba('0x39')](_0x3f107f[_0xeeba('0x3a')],qs['fields'](_0x353bc9[_0xeeba('0x36')][_0xeeba('0x3b')]));_0x12aad8[_0xeeba('0x3c')]=_0x12aad8['attributes'][_0xeeba('0x3d')]?_0x12aad8[_0xeeba('0x3c')]:_0x3f107f['model'];if(_0x353bc9[_0xeeba('0x36')][_0xeeba('0x4d')]){_0x12aad8[_0xeeba('0x48')]=[{'all':!![]}];}_0x12aad8=_['merge']({},_0x12aad8,_0x353bc9[_0xeeba('0x47')]);return db[_0xeeba('0x32')][_0xeeba('0x4e')](_0x12aad8)[_0xeeba('0x2a')](handleEntityNotFound(_0x4a5517,null))[_0xeeba('0x2a')](respondWithResult(_0x4a5517,null))['catch'](handleError(_0x4a5517,null));};exports[_0xeeba('0x4f')]=function(_0x1aea37,_0x41c6ee){return db[_0xeeba('0x32')][_0xeeba('0x4f')](_0x1aea37[_0xeeba('0x50')],{})[_0xeeba('0x2a')](function(_0x129589){var _0x252cd4=_0x1aea37['user'][_0xeeba('0x2c')]({'plain':!![]});if(!_0x252cd4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x252cd4[_0xeeba('0x51')]===_0xeeba('0x52')){var _0x4dce73=_0x129589[_0xeeba('0x2c')]({'plain':!![]});var _0x45cf86=_0xeeba('0x2d');return db[_0xeeba('0x53')][_0xeeba('0x4e')]({'where':{'name':_0x45cf86,'userProfileId':_0x252cd4[_0xeeba('0x54')]},'raw':!![]})[_0xeeba('0x2a')](function(_0x3fc924){if(_0x3fc924&&_0x3fc924[_0xeeba('0x55')]===0x0){return db[_0xeeba('0x2e')][_0xeeba('0x4f')]({'name':_0x4dce73[_0xeeba('0x35')],'resourceId':_0x4dce73['id'],'type':_0x3fc924[_0xeeba('0x35')],'sectionId':_0x3fc924['id']},{})['then'](function(){return _0x129589;});}else{return _0x129589;}})['catch'](function(_0x5dc713){logger[_0xeeba('0x30')](_0xeeba('0x56'),_0x5dc713);throw _0x5dc713;});}return _0x129589;})[_0xeeba('0x2a')](respondWithResult(_0x41c6ee,0xc9))[_0xeeba('0x57')](handleError(_0x41c6ee,null));};exports[_0xeeba('0x29')]=function(_0x40eec4,_0x496683){if(_0x40eec4[_0xeeba('0x50')]['id']){delete _0x40eec4[_0xeeba('0x50')]['id'];}return db[_0xeeba('0x32')][_0xeeba('0x4e')]({'where':{'id':_0x40eec4[_0xeeba('0x4b')]['id']}})['then'](handleEntityNotFound(_0x496683,null))[_0xeeba('0x2a')](saveUpdates(_0x40eec4['body'],null))[_0xeeba('0x2a')](respondWithResult(_0x496683,null))[_0xeeba('0x57')](handleError(_0x496683,null));};exports[_0xeeba('0x2b')]=function(_0x4eea02,_0x1053ed){return db['MailQueue'][_0xeeba('0x4e')]({'where':{'id':_0x4eea02[_0xeeba('0x4b')]['id']}})[_0xeeba('0x2a')](handleEntityNotFound(_0x1053ed,null))['then'](removeEntity(_0x1053ed,null))[_0xeeba('0x57')](handleError(_0x1053ed,null));};exports[_0xeeba('0x58')]=function(_0x28b00b,_0x2616d0){return db[_0xeeba('0x32')][_0xeeba('0x58')]()[_0xeeba('0x2a')](respondWithResult(_0x2616d0,null))['catch'](handleError(_0x2616d0,null));};exports[_0xeeba('0x59')]=function(_0x2711fe,_0x2003b,_0x2d1d2d){var _0x1abbca={'raw':!![],'where':{}},_0x5c5105={},_0x3aea55;return db[_0xeeba('0x32')][_0xeeba('0x5a')]({'where':{'id':_0x2711fe[_0xeeba('0x4b')]['id']}})[_0xeeba('0x2a')](handleEntityNotFound(_0x2003b,null))[_0xeeba('0x2a')](function(_0xa14edd){if(_0xa14edd){_0x3aea55=_0xa14edd['get']({'plain':!![]});_0x5c5105[_0xeeba('0x3a')]=_[_0xeeba('0x37')](db[_0xeeba('0x5b')][_0xeeba('0x4c')]);_0x5c5105[_0xeeba('0x36')]=_['keys'](_0x2711fe['query']);_0x5c5105[_0xeeba('0x38')]=_[_0xeeba('0x39')](_0x5c5105[_0xeeba('0x3a')],_0x5c5105[_0xeeba('0x36')]);_0x1abbca['attributes']=_['intersection'](_0x5c5105[_0xeeba('0x3a')],qs['fields'](_0x2711fe[_0xeeba('0x36')]['fields']));_0x1abbca[_0xeeba('0x3c')]=_0x1abbca[_0xeeba('0x3c')]['length']?_0x1abbca[_0xeeba('0x3c')]:_0x5c5105[_0xeeba('0x3a')];if(!_0x2711fe['query'][_0xeeba('0x3e')]('nolimit')){_0x1abbca[_0xeeba('0x23')]=qs[_0xeeba('0x23')](_0x2711fe['query']['limit']);_0x1abbca['offset']=qs['offset'](_0x2711fe['query'][_0xeeba('0x22')]);}_0x1abbca[_0xeeba('0x5c')]=qs[_0xeeba('0x40')](_0x2711fe[_0xeeba('0x36')][_0xeeba('0x40')]);_0x1abbca[_0xeeba('0x41')]=qs['filters'](_[_0xeeba('0x42')](_0x2711fe[_0xeeba('0x36')],_0x5c5105[_0xeeba('0x38')]));_0x1abbca['where'][_0xeeba('0x5d')]=_0xa14edd['id'];if(_0x2711fe[_0xeeba('0x36')][_0xeeba('0x43')]){_0x1abbca['where']=_[_0xeeba('0x44')](_0x1abbca[_0xeeba('0x41')],{'$or':_[_0xeeba('0x45')](_0x1abbca[_0xeeba('0x3c')],function(_0x244bab){var _0x333068={};_0x333068[_0x244bab]={'$like':'%'+_0x2711fe['query'][_0xeeba('0x43')]+'%'};return _0x333068;})});}_0x1abbca=_[_0xeeba('0x44')]({},_0x1abbca,_0x2711fe[_0xeeba('0x47')]);return db['UserMailQueue']['findAll'](_0x1abbca);}})['then'](function(_0x1af8b0){if(_0x1af8b0){return db['User'][_0xeeba('0x5e')]({'where':{'id':_[_0xeeba('0x45')](_0x1af8b0,_0xeeba('0x5f')),'role':_0xeeba('0x60')},'attributes':['id','name',_0xeeba('0x61'),_0xeeba('0x62'),_0xeeba('0x63')]});}})[_0xeeba('0x2a')](function(_0x591c96){if(_0x591c96){return{'count':_0x591c96[_0xeeba('0x21')],'rows':_[_0xeeba('0x45')](_0x591c96['rows'],function(_0x58b273){return{'membername':_0x58b273['name'],'UserId':_0x58b273['id'],'queue_name':_0x3aea55[_0xeeba('0x35')],'MailQueueId':_0x3aea55['id'],'interface':util['format'](_0xeeba('0x64'),'SIP',_0x58b273['name']),'penalty':0x0,'paused':_0x58b273[_0xeeba('0x61')],'createdAt':_0x58b273[_0xeeba('0x63')],'updatedAt':_0x58b273['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xeeba('0x2a')](respondWithFilteredResult(_0x2003b,_0x1abbca))[_0xeeba('0x57')](handleError(_0x2003b,null));};exports[_0xeeba('0x65')]=function(_0x54d092,_0x55bfc9,_0x3bfa3f){var _0x447adc={};var _0x23cba2={};var _0x559a04;var _0x50e774;return db[_0xeeba('0x32')][_0xeeba('0x5a')]({'where':{'id':_0x54d092[_0xeeba('0x4b')]['id']}})[_0xeeba('0x2a')](handleEntityNotFound(_0x55bfc9,null))[_0xeeba('0x2a')](function(_0x253d72){if(_0x253d72){_0x559a04=_0x253d72;_0x23cba2[_0xeeba('0x3a')]=_['keys'](db['Team'][_0xeeba('0x4c')]);_0x23cba2[_0xeeba('0x36')]=_['keys'](_0x54d092[_0xeeba('0x36')]);_0x23cba2[_0xeeba('0x38')]=_['intersection'](_0x23cba2[_0xeeba('0x3a')],_0x23cba2[_0xeeba('0x36')]);_0x447adc['attributes']=_[_0xeeba('0x39')](_0x23cba2['model'],qs[_0xeeba('0x3b')](_0x54d092[_0xeeba('0x36')][_0xeeba('0x3b')]));_0x447adc['attributes']=_0x447adc['attributes']['length']?_0x447adc['attributes']:_0x23cba2[_0xeeba('0x3a')];_0x447adc[_0xeeba('0x5c')]=qs[_0xeeba('0x40')](_0x54d092[_0xeeba('0x36')]['sort']);_0x447adc[_0xeeba('0x41')]=qs['filters'](_[_0xeeba('0x42')](_0x54d092['query'],_0x23cba2[_0xeeba('0x38')]));if(_0x54d092[_0xeeba('0x36')][_0xeeba('0x43')]){_0x447adc['where']=_[_0xeeba('0x44')](_0x447adc[_0xeeba('0x41')],{'$or':_['map'](_0x447adc[_0xeeba('0x3c')],function(_0x1a2dc0){var _0x5e65d1={};_0x5e65d1[_0x1a2dc0]={'$like':'%'+_0x54d092['query'][_0xeeba('0x43')]+'%'};return _0x5e65d1;})});}_0x447adc=_[_0xeeba('0x44')]({},_0x447adc,_0x54d092[_0xeeba('0x47')]);return _0x559a04[_0xeeba('0x65')](_0x447adc);}})[_0xeeba('0x2a')](function(_0x34b85f){if(_0x34b85f){_0x50e774=_0x34b85f[_0xeeba('0x3d')];if(!_0x54d092[_0xeeba('0x36')]['hasOwnProperty'](_0xeeba('0x3f'))){_0x447adc[_0xeeba('0x23')]=qs[_0xeeba('0x23')](_0x54d092[_0xeeba('0x36')][_0xeeba('0x23')]);_0x447adc[_0xeeba('0x22')]=qs[_0xeeba('0x22')](_0x54d092[_0xeeba('0x36')][_0xeeba('0x22')]);}return _0x559a04[_0xeeba('0x65')](_0x447adc);}})[_0xeeba('0x2a')](function(_0x1ff13a){if(_0x1ff13a){return _0x1ff13a?{'count':_0x50e774,'rows':_0x1ff13a}:null;}})[_0xeeba('0x2a')](respondWithResult(_0x55bfc9,null))['catch'](handleError(_0x55bfc9,null));};exports[_0xeeba('0x66')]=function(_0x2c64ca,_0x4bc81b,_0x2ca291){var _0x2b697e=_0x2c64ca[_0xeeba('0x50')][_0xeeba('0x67')];return db[_0xeeba('0x68')][_0xeeba('0x49')]({'where':{'id':_0x2b697e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeeba('0x69'),'attributes':['id',_0xeeba('0x35'),'online','voicePause',_0xeeba('0x6a')],'raw':!![]}]})[_0xeeba('0x2a')](function(_0x52c92f){if(_0x52c92f){var _0x4d3c15=_[_0xeeba('0x6b')](_0x52c92f,function(_0x233944){var _0x45f403=_0x233944[_0xeeba('0x2c')]({'plain':!![]});return _0x45f403[_0xeeba('0x69')];});return db[_0xeeba('0x32')][_0xeeba('0x4e')]({'where':{'id':_0x2c64ca[_0xeeba('0x4b')]['id']}})[_0xeeba('0x2a')](function(_0x41677b){return db[_0xeeba('0x6c')][_0xeeba('0x6d')](function(_0x504a96){return _0x41677b[_0xeeba('0x66')](_0x2b697e,{'transaction':_0x504a96})[_0xeeba('0x2a')](function(){return BPromise[_0xeeba('0x6e')](_0x4d3c15,function(_0x1e09af){return db[_0xeeba('0x5b')][_0xeeba('0x6f')]({'where':{'UserId':_0x1e09af['id'],'MailQueueId':_0x2c64ca[_0xeeba('0x4b')]['id']},'transaction':_0x504a96});});})[_0xeeba('0x2a')](function(){_0x4d3c15[_0xeeba('0x70')](function(_0x56e2ba){socket[_0xeeba('0x71')](_0xeeba('0x72'),{'UserId':_0x56e2ba['id'],'MailQueueId':_0x41677b['id']});});});});});}})[_0xeeba('0x2a')](respondWithStatusCode(_0x4bc81b,null))[_0xeeba('0x57')](handleError(_0x4bc81b,null));};exports[_0xeeba('0x73')]=function(_0x3957a2,_0x19ac8a,_0x481044){return db['Team'][_0xeeba('0x49')]({'where':{'id':_0x3957a2[_0xeeba('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xeeba('0x74')],'as':_0xeeba('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x19ac8a,null))['then'](function(_0x7e6d2b){var _0x13dc8a=_[_0xeeba('0x45')](_0x7e6d2b,'id');var _0x281fae=[];var _0x402a76=[];var _0x9a1985=squel[_0xeeba('0x75')]();_0x9a1985['field'](_0xeeba('0x76'))[_0xeeba('0x77')]('team_has_mail_queues','tq')[_0xeeba('0x78')](_0xeeba('0x79'),'ut',_0xeeba('0x7a'))[_0xeeba('0x41')](_0xeeba('0x7b'),_0x3957a2['params']['id']);for(var _0x1d985e=0x0;_0x1d985e<_0x7e6d2b[_0xeeba('0x3d')];_0x1d985e+=0x1){let _0xf9802a=_0x7e6d2b[_0x1d985e];for(var _0x3db227=0x0;_0x3db227<_0xf9802a[_0xeeba('0x69')][_0xeeba('0x3d')];_0x3db227+=0x1){let _0x11d31c=_0xf9802a['Agents'][_0x3db227];var _0x42cf04=_0x9a1985[_0xeeba('0x7c')]();_0x42cf04[_0xeeba('0x41')]('ut.UserId\x20=\x20?',_0x11d31c['id']);_0x402a76[_0xeeba('0x7d')](db[_0xeeba('0x6c')][_0xeeba('0x36')](_0x42cf04[_0xeeba('0x7e')](),{'type':db[_0xeeba('0x6c')][_0xeeba('0x7f')][_0xeeba('0x80')]})['then'](function(_0x2f43ce){if(_0x2f43ce[_0xeeba('0x3d')]===0x1){return _0x11d31c['id'];}else{var _0x505e83=_[_0xeeba('0x81')](_[_0xeeba('0x45')](_0x2f43ce,_0xeeba('0x82')),function(_0xeb0647){return _['includes'](_0x13dc8a,_0xeb0647);});if(_0x505e83){return _0x11d31c['id'];}}}));}}return BPromise[_0xeeba('0x83')](_0x402a76)[_0xeeba('0x2a')](function(_0xd29ae4){_0x281fae=_(_0x281fae)['union'](_0xd29ae4)['compact']()[_0xeeba('0x84')]();return db[_0xeeba('0x32')][_0xeeba('0x4e')]({'where':{'id':_0x3957a2[_0xeeba('0x4b')]['id']}})['then'](function(_0x1b674c){return db[_0xeeba('0x6c')][_0xeeba('0x6d')](function(_0x36f2fa){return _0x1b674c[_0xeeba('0x73')](_0x3957a2['query'][_0xeeba('0x67')],{'transaction':_0x36f2fa})[_0xeeba('0x2a')](function(){if(!_['isEmpty'](_0x281fae)){return _0x1b674c[_0xeeba('0x85')](_0x281fae,{'transaction':_0x36f2fa});}})[_0xeeba('0x2a')](function(){_0x281fae[_0xeeba('0x70')](function(_0x3cedfb){socket[_0xeeba('0x71')](_0xeeba('0x86'),{'UserId':_0x3cedfb,'MailQueueId':_0x1b674c['id']});});});});});});})[_0xeeba('0x2a')](respondWithStatusCode(_0x19ac8a,null))[_0xeeba('0x57')](handleError(_0x19ac8a,null));};exports[_0xeeba('0x87')]=function(_0x2362c2,_0x51481d,_0xd4433d){return db[_0xeeba('0x32')][_0xeeba('0x4e')]({'where':{'id':_0x2362c2[_0xeeba('0x4b')]['id']}})[_0xeeba('0x2a')](handleEntityNotFound(_0x51481d,null))[_0xeeba('0x2a')](function(_0x45599e){if(_0x45599e){return _0x45599e[_0xeeba('0x87')](_0x2362c2[_0xeeba('0x50')][_0xeeba('0x67')],_[_0xeeba('0x88')](_0x2362c2[_0xeeba('0x50')],[_0xeeba('0x67'),'id'])||{})[_0xeeba('0x89')](function(_0x11bfcf){for(var _0x4b052a=0x0;_0x4b052a<_0x2362c2[_0xeeba('0x50')][_0xeeba('0x67')]['length'];_0x4b052a+=0x1){socket[_0xeeba('0x71')](_0xeeba('0x72'),{'UserId':_0x2362c2[_0xeeba('0x50')][_0xeeba('0x67')][_0x4b052a],'MailQueueId':_0x2362c2['params']['id']});}return _0x11bfcf;});}})[_0xeeba('0x2a')](respondWithResult(_0x51481d,null))[_0xeeba('0x57')](handleError(_0x51481d,null));};exports[_0xeeba('0x85')]=function(_0x19eb41,_0x3123c1,_0x4b6ca8){return db[_0xeeba('0x32')][_0xeeba('0x4e')]({'where':{'id':_0x19eb41['params']['id']}})['then'](handleEntityNotFound(_0x3123c1,null))[_0xeeba('0x2a')](function(_0x5e08bd){if(_0x5e08bd){return _0x5e08bd[_0xeeba('0x85')](_0x19eb41[_0xeeba('0x36')][_0xeeba('0x67')])[_0xeeba('0x2a')](function(){if(_['isArray'](_0x19eb41[_0xeeba('0x36')][_0xeeba('0x67')])){for(var _0x58a41a=0x0;_0x58a41a<_0x19eb41[_0xeeba('0x36')][_0xeeba('0x67')][_0xeeba('0x3d')];_0x58a41a+=0x1){socket['emit'](_0xeeba('0x86'),{'UserId':Number(_0x19eb41[_0xeeba('0x36')][_0xeeba('0x67')][_0x58a41a]),'MailQueueId':Number(_0x19eb41[_0xeeba('0x4b')]['id'])});}}else{socket[_0xeeba('0x71')](_0xeeba('0x86'),{'UserId':Number(_0x19eb41['query'][_0xeeba('0x67')]),'MailQueueId':Number(_0x19eb41[_0xeeba('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x3123c1,null))[_0xeeba('0x57')](handleError(_0x3123c1,null));};exports[_0xeeba('0x8a')]=function(_0xe68ea8,_0x56ceda,_0x123a1d){var _0x1c3f0f={};var _0x186345={};var _0x538de3;var _0x2bbba4;return db[_0xeeba('0x32')][_0xeeba('0x5a')]({'where':{'id':_0xe68ea8[_0xeeba('0x4b')]['id']}})[_0xeeba('0x2a')](handleEntityNotFound(_0x56ceda,null))[_0xeeba('0x2a')](function(_0x151dc9){if(_0x151dc9){_0x538de3=_0x151dc9;_0x186345['model']=_[_0xeeba('0x37')](db['User'][_0xeeba('0x4c')]);_0x186345['query']=_[_0xeeba('0x37')](_0xe68ea8['query']);_0x186345[_0xeeba('0x38')]=_['intersection'](_0x186345['model'],_0x186345['query']);_0x1c3f0f[_0xeeba('0x3c')]=_[_0xeeba('0x39')](_0x186345[_0xeeba('0x3a')],qs[_0xeeba('0x3b')](_0xe68ea8[_0xeeba('0x36')]['fields']));_0x1c3f0f[_0xeeba('0x3c')]=_0x1c3f0f[_0xeeba('0x3c')][_0xeeba('0x3d')]?_0x1c3f0f[_0xeeba('0x3c')]:_0x186345[_0xeeba('0x3a')];_0x1c3f0f[_0xeeba('0x5c')]=qs[_0xeeba('0x40')](_0xe68ea8['query'][_0xeeba('0x40')]);_0x1c3f0f['where']=qs[_0xeeba('0x38')](_[_0xeeba('0x42')](_0xe68ea8[_0xeeba('0x36')],_0x186345['filters']));if(_0xe68ea8['query']['filter']){_0x1c3f0f[_0xeeba('0x41')]=_[_0xeeba('0x44')](_0x1c3f0f[_0xeeba('0x41')],{'$or':_[_0xeeba('0x45')](_0x1c3f0f['attributes'],function(_0xe1dd7f){var _0x24f621={};_0x24f621[_0xe1dd7f]={'$like':'%'+_0xe68ea8[_0xeeba('0x36')][_0xeeba('0x43')]+'%'};return _0x24f621;})});}_0x1c3f0f=_[_0xeeba('0x44')]({},_0x1c3f0f,_0xe68ea8[_0xeeba('0x47')]);return _0x538de3[_0xeeba('0x8a')](_0x1c3f0f);}})[_0xeeba('0x2a')](function(_0x16185f){if(_0x16185f){_0x2bbba4=_0x16185f[_0xeeba('0x3d')];if(!_0xe68ea8[_0xeeba('0x36')][_0xeeba('0x3e')](_0xeeba('0x3f'))){_0x1c3f0f['limit']=qs['limit'](_0xe68ea8[_0xeeba('0x36')][_0xeeba('0x23')]);_0x1c3f0f['offset']=qs[_0xeeba('0x22')](_0xe68ea8[_0xeeba('0x36')][_0xeeba('0x22')]);}return _0x538de3['getAgents'](_0x1c3f0f);}})['then'](function(_0x505cda){if(_0x505cda){return _0x505cda?{'count':_0x2bbba4,'rows':_0x505cda}:null;}})[_0xeeba('0x2a')](respondWithResult(_0x56ceda,null))['catch'](handleError(_0x56ceda,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 3c8b95f..9beca67 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 _0xae84=['MailQueue','save','remove','emit','hook','exports','../../mysqldb'];(function(_0x1a64f3,_0x4b2b6b){var _0x37d68f=function(_0x386b3f){while(--_0x386b3f){_0x1a64f3['push'](_0x1a64f3['shift']());}};_0x37d68f(++_0x4b2b6b);}(_0xae84,0xca));var _0x4ae8=function(_0x3bf39b,_0x1ed906){_0x3bf39b=_0x3bf39b-0x0;var _0x138019=_0xae84[_0x3bf39b];return _0x138019;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x4ae8('0x0'))['db'][_0x4ae8('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4ae8('0x2'),'afterUpdate':'update','afterDestroy':_0x4ae8('0x3')};function emitEvent(_0x55d49d){return function(_0x206296,_0x3d5f1a,_0x3b1d77){MailQueueEvents[_0x4ae8('0x4')](_0x55d49d+':'+_0x206296['id'],_0x206296);MailQueueEvents[_0x4ae8('0x4')](_0x55d49d,_0x206296);_0x3b1d77(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x4ae8('0x5')](e,emitEvent(event));}}module[_0x4ae8('0x6')]=MailQueueEvents; \ No newline at end of file +var _0xc942=['save','remove','emit','hook','exports','events','../../mysqldb','MailQueue'];(function(_0x91120b,_0x12ea29){var _0x40e280=function(_0x1f8d28){while(--_0x1f8d28){_0x91120b['push'](_0x91120b['shift']());}};_0x40e280(++_0x12ea29);}(_0xc942,0x115));var _0x2c94=function(_0x4ae555,_0x30bfb2){_0x4ae555=_0x4ae555-0x0;var _0x1166fb=_0xc942[_0x4ae555];return _0x1166fb;};'use strict';var EventEmitter=require(_0x2c94('0x0'));var MailQueue=require(_0x2c94('0x1'))['db'][_0x2c94('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2c94('0x3'),'afterUpdate':'update','afterDestroy':_0x2c94('0x4')};function emitEvent(_0x11a55f){return function(_0x37558b,_0x41d0b1,_0x4e91cc){MailQueueEvents['emit'](_0x11a55f+':'+_0x37558b['id'],_0x37558b);MailQueueEvents[_0x2c94('0x5')](_0x11a55f,_0x37558b);_0x4e91cc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x2c94('0x6')](e,emitEvent(event));}}module[_0x2c94('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 1023aa4..061b8fa 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 _0xc7a7=['moment','path','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','lodash','util','../../config/logger'];(function(_0x1d44ff,_0x2affd6){var _0x5a1eaf=function(_0x3017a3){while(--_0x3017a3){_0x1d44ff['push'](_0x1d44ff['shift']());}};_0x5a1eaf(++_0x2affd6);}(_0xc7a7,0x165));var _0x7c7a=function(_0x135920,_0x5df22a){_0x135920=_0x135920-0x0;var _0x2cd730=_0xc7a7[_0x135920];return _0x2cd730;};'use strict';var _=require(_0x7c7a('0x0'));var util=require(_0x7c7a('0x1'));var logger=require(_0x7c7a('0x2'))('api');var moment=require(_0x7c7a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c7a('0x4'));var rimraf=require('rimraf');var config=require(_0x7c7a('0x5'));var attributes=require(_0x7c7a('0x6'));module[_0x7c7a('0x7')]=function(_0x49ff48,_0x29f5c8){return _0x49ff48[_0x7c7a('0x8')](_0x7c7a('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74eb=['exports','define','MailQueue','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0xea1a04,_0x29da26){var _0x45f817=function(_0x38c87e){while(--_0x38c87e){_0xea1a04['push'](_0xea1a04['shift']());}};_0x45f817(++_0x29da26);}(_0x74eb,0x14d));var _0xb74e=function(_0x3897a1,_0xc5d4aa){_0x3897a1=_0x3897a1-0x0;var _0x11a80b=_0x74eb[_0x3897a1];return _0x11a80b;};'use strict';var _=require(_0xb74e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb74e('0x1'));var moment=require(_0xb74e('0x2'));var BPromise=require('bluebird');var rp=require(_0xb74e('0x3'));var fs=require('fs');var path=require(_0xb74e('0x4'));var rimraf=require(_0xb74e('0x5'));var config=require(_0xb74e('0x6'));var attributes=require(_0xb74e('0x7'));module[_0xb74e('0x8')]=function(_0x508034,_0x5106f9){return _0x508034[_0xb74e('0x9')](_0xb74e('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index d051083..450f3b6 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 _0x4217=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','MailQueue','findAll','options','raw','attributes','limit','include','map','model','GetMailQueue','catch','ShowMailQueue','find','where','debug','lodash','util','moment','randomstring','ioredis'];(function(_0x2f255f,_0xefc5c3){var _0x1db9f2=function(_0x3dd44f){while(--_0x3dd44f){_0x2f255f['push'](_0x2f255f['shift']());}};_0x1db9f2(++_0xefc5c3);}(_0x4217,0xb9));var _0x7421=function(_0x18ed14,_0x2552f4){_0x18ed14=_0x18ed14-0x0;var _0x401031=_0x4217[_0x18ed14];return _0x401031;};'use strict';var _=require(_0x7421('0x0'));var util=require(_0x7421('0x1'));var moment=require(_0x7421('0x2'));var BPromise=require('bluebird');var rs=require(_0x7421('0x3'));var fs=require('fs');var Redis=require(_0x7421('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7421('0x5'));var logger=require(_0x7421('0x6'))('rpc');var config=require(_0x7421('0x7'));var jayson=require(_0x7421('0x8'));var client=jayson[_0x7421('0x9')][_0x7421('0xa')]({'port':0x232a});config[_0x7421('0xb')]=_['defaults'](config[_0x7421('0xb')],{'host':_0x7421('0xc'),'port':0x18eb});var socket=require(_0x7421('0xd'))(new Redis(config['redis']));require(_0x7421('0xe'))['register'](socket);function respondWithRpcPromise(_0x916434,_0x447a63,_0x2be56c){return new BPromise(function(_0x73eb69,_0x199f14){return client[_0x7421('0xf')](_0x916434,_0x2be56c)[_0x7421('0x10')](function(_0x44a76b){logger[_0x7421('0x11')](_0x7421('0x12'),_0x447a63,_0x7421('0x13'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x447a63,_0x7421('0x13'),JSON[_0x7421('0x14')](_0x44a76b));if(_0x44a76b[_0x7421('0x15')]){if(_0x44a76b['error']['code']===0x1f4){logger[_0x7421('0x15')](_0x7421('0x12'),_0x447a63,_0x44a76b[_0x7421('0x15')][_0x7421('0x16')]);return _0x199f14(_0x44a76b[_0x7421('0x15')][_0x7421('0x16')]);}logger[_0x7421('0x15')](_0x7421('0x12'),_0x447a63,_0x44a76b[_0x7421('0x15')]['message']);return _0x73eb69(_0x44a76b['error'][_0x7421('0x16')]);}else{logger[_0x7421('0x11')]('MailQueue,\x20%s,\x20%s',_0x447a63,'request\x20sent');_0x73eb69(_0x44a76b['result'][_0x7421('0x16')]);}})['catch'](function(_0xe35837){logger[_0x7421('0x15')](_0x7421('0x12'),_0x447a63,_0xe35837);_0x199f14(_0xe35837);});});}exports['GetMailQueue']=function(_0x225f4f){var _0x461184=this;return new Promise(function(_0x57b436,_0x3b78f3){return db[_0x7421('0x17')][_0x7421('0x18')]({'raw':_0x225f4f[_0x7421('0x19')]?_0x225f4f[_0x7421('0x19')][_0x7421('0x1a')]===undefined?!![]:![]:!![],'where':_0x225f4f[_0x7421('0x19')]?_0x225f4f[_0x7421('0x19')]['where']||null:null,'attributes':_0x225f4f[_0x7421('0x19')]?_0x225f4f[_0x7421('0x19')][_0x7421('0x1b')]||null:null,'limit':_0x225f4f[_0x7421('0x19')]?_0x225f4f[_0x7421('0x19')][_0x7421('0x1c')]||null:null,'include':_0x225f4f[_0x7421('0x19')]?_0x225f4f[_0x7421('0x19')][_0x7421('0x1d')]?_[_0x7421('0x1e')](_0x225f4f[_0x7421('0x19')][_0x7421('0x1d')],function(_0x11dd11){return{'model':db[_0x11dd11[_0x7421('0x1f')]],'as':_0x11dd11['as'],'attributes':_0x11dd11[_0x7421('0x1b')],'include':_0x11dd11['include']?_[_0x7421('0x1e')](_0x11dd11[_0x7421('0x1d')],function(_0x9610d6){return{'model':db[_0x9610d6[_0x7421('0x1f')]],'as':_0x9610d6['as'],'attributes':_0x9610d6[_0x7421('0x1b')],'include':_0x9610d6[_0x7421('0x1d')]?_[_0x7421('0x1e')](_0x9610d6[_0x7421('0x1d')],function(_0x245e38){return{'model':db[_0x245e38['model']],'as':_0x245e38['as'],'attributes':_0x245e38['attributes']};}):[]};}):[]};}):[]:[]})[_0x7421('0x10')](function(_0x483830){logger[_0x7421('0x11')]('GetMailQueue',_0x225f4f);logger['debug'](_0x7421('0x20'),_0x225f4f,JSON[_0x7421('0x14')](_0x483830));_0x57b436(_0x483830);})[_0x7421('0x21')](function(_0x38f839){logger['error'](_0x7421('0x20'),_0x38f839['message'],_0x225f4f);_0x3b78f3(_0x461184['error'](0x1f4,_0x38f839['message']));});});};exports[_0x7421('0x22')]=function(_0x1db1ee){var _0x422bb1=this;return new Promise(function(_0x52cf9d,_0x2fdd16){return db['MailQueue'][_0x7421('0x23')]({'raw':_0x1db1ee[_0x7421('0x19')]?_0x1db1ee[_0x7421('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1db1ee['options']?_0x1db1ee[_0x7421('0x19')][_0x7421('0x24')]||null:null,'attributes':_0x1db1ee['options']?_0x1db1ee['options'][_0x7421('0x1b')]||null:null,'include':_0x1db1ee['options']?_0x1db1ee['options']['include']?_['map'](_0x1db1ee['options'][_0x7421('0x1d')],function(_0x4dcfbe){return{'model':db[_0x4dcfbe[_0x7421('0x1f')]],'as':_0x4dcfbe['as'],'attributes':_0x4dcfbe[_0x7421('0x1b')],'include':_0x4dcfbe[_0x7421('0x1d')]?_[_0x7421('0x1e')](_0x4dcfbe['include'],function(_0x178d98){return{'model':db[_0x178d98[_0x7421('0x1f')]],'as':_0x178d98['as'],'attributes':_0x178d98[_0x7421('0x1b')],'include':_0x178d98[_0x7421('0x1d')]?_[_0x7421('0x1e')](_0x178d98[_0x7421('0x1d')],function(_0x20f55c){return{'model':db[_0x20f55c[_0x7421('0x1f')]],'as':_0x20f55c['as'],'attributes':_0x20f55c[_0x7421('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7421('0x10')](function(_0x145501){logger['info'](_0x7421('0x22'),_0x1db1ee);logger[_0x7421('0x25')](_0x7421('0x22'),_0x1db1ee,JSON[_0x7421('0x14')](_0x145501));_0x52cf9d(_0x145501);})[_0x7421('0x21')](function(_0x3442e2){logger[_0x7421('0x15')]('ShowMailQueue',_0x3442e2[_0x7421('0x16')],_0x1db1ee);_0x2fdd16(_0x422bb1['error'](0x1f4,_0x3442e2[_0x7421('0x16')]));});});}; \ No newline at end of file +var _0xb247=['options','raw','where','attributes','limit','include','map','model','then','find','ShowMailQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xb247,0x107));var _0x7b24=function(_0x2a9490,_0x43cb5f){_0x2a9490=_0x2a9490-0x0;var _0x5bf90e=_0xb247[_0x2a9490];return _0x5bf90e;};'use strict';var _=require(_0x7b24('0x0'));var util=require(_0x7b24('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7b24('0x2'));var fs=require('fs');var Redis=require(_0x7b24('0x3'));var db=require(_0x7b24('0x4'))['db'];var utils=require(_0x7b24('0x5'));var logger=require(_0x7b24('0x6'))(_0x7b24('0x7'));var config=require(_0x7b24('0x8'));var jayson=require(_0x7b24('0x9'));var client=jayson[_0x7b24('0xa')][_0x7b24('0xb')]({'port':0x232a});config['redis']=_[_0x7b24('0xc')](config[_0x7b24('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b24('0xe'))(new Redis(config['redis']));require(_0x7b24('0xf'))[_0x7b24('0x10')](socket);function respondWithRpcPromise(_0x391f31,_0x414d80,_0xb5f07){return new BPromise(function(_0x240855,_0x2dd035){return client[_0x7b24('0x11')](_0x391f31,_0xb5f07)['then'](function(_0x437d0b){logger[_0x7b24('0x12')](_0x7b24('0x13'),_0x414d80,'request\x20sent');logger[_0x7b24('0x14')](_0x7b24('0x15'),_0x414d80,_0x7b24('0x16'),JSON[_0x7b24('0x17')](_0x437d0b));if(_0x437d0b[_0x7b24('0x18')]){if(_0x437d0b[_0x7b24('0x18')][_0x7b24('0x19')]===0x1f4){logger['error'](_0x7b24('0x13'),_0x414d80,_0x437d0b[_0x7b24('0x18')][_0x7b24('0x1a')]);return _0x2dd035(_0x437d0b[_0x7b24('0x18')][_0x7b24('0x1a')]);}logger[_0x7b24('0x18')](_0x7b24('0x13'),_0x414d80,_0x437d0b[_0x7b24('0x18')][_0x7b24('0x1a')]);return _0x240855(_0x437d0b[_0x7b24('0x18')]['message']);}else{logger[_0x7b24('0x12')](_0x7b24('0x13'),_0x414d80,'request\x20sent');_0x240855(_0x437d0b['result'][_0x7b24('0x1a')]);}})[_0x7b24('0x1b')](function(_0x53e7d8){logger[_0x7b24('0x18')](_0x7b24('0x13'),_0x414d80,_0x53e7d8);_0x2dd035(_0x53e7d8);});});}exports[_0x7b24('0x1c')]=function(_0x1a2504){var _0x140e4d=this;return new Promise(function(_0x5feb9b,_0x1927a5){return db[_0x7b24('0x1d')][_0x7b24('0x1e')]({'raw':_0x1a2504['options']?_0x1a2504[_0x7b24('0x1f')][_0x7b24('0x20')]===undefined?!![]:![]:!![],'where':_0x1a2504['options']?_0x1a2504[_0x7b24('0x1f')][_0x7b24('0x21')]||null:null,'attributes':_0x1a2504[_0x7b24('0x1f')]?_0x1a2504[_0x7b24('0x1f')][_0x7b24('0x22')]||null:null,'limit':_0x1a2504['options']?_0x1a2504['options'][_0x7b24('0x23')]||null:null,'include':_0x1a2504[_0x7b24('0x1f')]?_0x1a2504[_0x7b24('0x1f')][_0x7b24('0x24')]?_[_0x7b24('0x25')](_0x1a2504['options'][_0x7b24('0x24')],function(_0x5497f3){return{'model':db[_0x5497f3['model']],'as':_0x5497f3['as'],'attributes':_0x5497f3['attributes'],'include':_0x5497f3[_0x7b24('0x24')]?_[_0x7b24('0x25')](_0x5497f3[_0x7b24('0x24')],function(_0x4f5c46){return{'model':db[_0x4f5c46[_0x7b24('0x26')]],'as':_0x4f5c46['as'],'attributes':_0x4f5c46['attributes'],'include':_0x4f5c46[_0x7b24('0x24')]?_['map'](_0x4f5c46[_0x7b24('0x24')],function(_0x5ea158){return{'model':db[_0x5ea158[_0x7b24('0x26')]],'as':_0x5ea158['as'],'attributes':_0x5ea158[_0x7b24('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7b24('0x27')](function(_0x43657a){logger[_0x7b24('0x12')](_0x7b24('0x1c'),_0x1a2504);logger[_0x7b24('0x14')]('GetMailQueue',_0x1a2504,JSON['stringify'](_0x43657a));_0x5feb9b(_0x43657a);})[_0x7b24('0x1b')](function(_0x3800ae){logger[_0x7b24('0x18')](_0x7b24('0x1c'),_0x3800ae[_0x7b24('0x1a')],_0x1a2504);_0x1927a5(_0x140e4d[_0x7b24('0x18')](0x1f4,_0x3800ae[_0x7b24('0x1a')]));});});};exports['ShowMailQueue']=function(_0xed8eef){var _0x34db4e=this;return new Promise(function(_0x46820e,_0x1da3db){return db[_0x7b24('0x1d')][_0x7b24('0x28')]({'raw':_0xed8eef[_0x7b24('0x1f')]?_0xed8eef[_0x7b24('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0xed8eef[_0x7b24('0x1f')]?_0xed8eef[_0x7b24('0x1f')][_0x7b24('0x21')]||null:null,'attributes':_0xed8eef[_0x7b24('0x1f')]?_0xed8eef[_0x7b24('0x1f')][_0x7b24('0x22')]||null:null,'include':_0xed8eef[_0x7b24('0x1f')]?_0xed8eef[_0x7b24('0x1f')]['include']?_[_0x7b24('0x25')](_0xed8eef[_0x7b24('0x1f')][_0x7b24('0x24')],function(_0x525ced){return{'model':db[_0x525ced[_0x7b24('0x26')]],'as':_0x525ced['as'],'attributes':_0x525ced[_0x7b24('0x22')],'include':_0x525ced['include']?_['map'](_0x525ced['include'],function(_0x551dd3){return{'model':db[_0x551dd3[_0x7b24('0x26')]],'as':_0x551dd3['as'],'attributes':_0x551dd3[_0x7b24('0x22')],'include':_0x551dd3[_0x7b24('0x24')]?_['map'](_0x551dd3[_0x7b24('0x24')],function(_0x167691){return{'model':db[_0x167691[_0x7b24('0x26')]],'as':_0x167691['as'],'attributes':_0x167691[_0x7b24('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7b24('0x27')](function(_0x2e4a77){logger[_0x7b24('0x12')]('ShowMailQueue',_0xed8eef);logger[_0x7b24('0x14')](_0x7b24('0x29'),_0xed8eef,JSON['stringify'](_0x2e4a77));_0x46820e(_0x2e4a77);})[_0x7b24('0x1b')](function(_0x24096e){logger[_0x7b24('0x18')]('ShowMailQueue',_0x24096e['message'],_0xed8eef);_0x1da3db(_0x34db4e[_0x7b24('0x18')](0x1f4,_0x24096e[_0x7b24('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 0028388..4d017c3 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 _0x4f00=['length','mailQueue:','remove','emit','removeListener','register'];(function(_0xbf09ab,_0x251a19){var _0x2a9aef=function(_0x22d793){while(--_0x22d793){_0xbf09ab['push'](_0xbf09ab['shift']());}};_0x2a9aef(++_0x251a19);}(_0x4f00,0x12e));var _0x04f0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4f00[_0x2dafbe];return _0x58a45a;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0x04f0('0x0'),'update'];function createListener(_0x24d78e,_0x54ddc9){return function(_0x490fe0){_0x54ddc9[_0x04f0('0x1')](_0x24d78e,_0x490fe0);};}function removeListener(_0x11535d,_0x1e23d4){return function(){MailQueueEvents[_0x04f0('0x2')](_0x11535d,_0x1e23d4);};}exports[_0x04f0('0x3')]=function(_0x548204){for(var _0xde5e3c=0x0,_0x515353=events[_0x04f0('0x4')];_0xde5e3c<_0x515353;_0xde5e3c++){var _0x488cfb=events[_0xde5e3c];var _0xa3e118=createListener(_0x04f0('0x5')+_0x488cfb,_0x548204);MailQueueEvents['on'](_0x488cfb,_0xa3e118);}}; \ No newline at end of file +var _0x8037=['length','mailQueue:','save','remove','update','emit','removeListener','register'];(function(_0x5ea5a3,_0x349419){var _0x4fdc68=function(_0x209a06){while(--_0x209a06){_0x5ea5a3['push'](_0x5ea5a3['shift']());}};_0x4fdc68(++_0x349419);}(_0x8037,0xba));var _0x7803=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8037[_0x57b54c];return _0x59cc19;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x7803('0x0'),_0x7803('0x1'),_0x7803('0x2')];function createListener(_0x3dc7a9,_0x36126f){return function(_0x392e87){_0x36126f[_0x7803('0x3')](_0x3dc7a9,_0x392e87);};}function removeListener(_0x14ba6a,_0x35065f){return function(){MailQueueEvents[_0x7803('0x4')](_0x14ba6a,_0x35065f);};}exports[_0x7803('0x5')]=function(_0x53258b){for(var _0xdbcb73=0x0,_0x30addf=events[_0x7803('0x6')];_0xdbcb73<_0x30addf;_0xdbcb73++){var _0x3f681d=events[_0xdbcb73];var _0x59efe2=createListener(_0x7803('0x7')+_0x3f681d,_0x53258b);MailQueueEvents['on'](_0x3f681d,_0x59efe2);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 1fa81b5..5e4d169 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 _0x67ce=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','/describe','isAuthenticated','describe','create','update','delete','/:id','destroy','exports','multer'];(function(_0x40fc61,_0xc23cd7){var _0xd99b48=function(_0x3802a6){while(--_0x3802a6){_0x40fc61['push'](_0x40fc61['shift']());}};_0xd99b48(++_0xc23cd7);}(_0x67ce,0x8b));var _0xe67c=function(_0x4cbc97,_0x3b6f99){_0x4cbc97=_0x4cbc97-0x0;var _0x15fcd4=_0x67ce[_0x4cbc97];return _0x15fcd4;};'use strict';var multer=require(_0xe67c('0x0'));var util=require(_0xe67c('0x1'));var path=require('path');var timeout=require(_0xe67c('0x2'));var express=require(_0xe67c('0x3'));var router=express[_0xe67c('0x4')]();var auth=require(_0xe67c('0x5'));var interaction=require(_0xe67c('0x6'));var config=require(_0xe67c('0x7'));var controller=require(_0xe67c('0x8'));router[_0xe67c('0x9')]('/',auth['isAuthenticated'](),controller[_0xe67c('0xa')]);router[_0xe67c('0x9')](_0xe67c('0xb'),auth[_0xe67c('0xc')](),controller[_0xe67c('0xd')]);router['get']('/:id',auth[_0xe67c('0xc')](),controller['show']);router['post']('/',auth[_0xe67c('0xc')](),controller[_0xe67c('0xe')]);router['put']('/:id',auth[_0xe67c('0xc')](),controller[_0xe67c('0xf')]);router[_0xe67c('0x10')](_0xe67c('0x11'),auth[_0xe67c('0xc')](),controller[_0xe67c('0x12')]);module[_0xe67c('0x13')]=router; \ No newline at end of file +var _0x8dcb=['../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x288fc9,_0x31ff3e){var _0x50df46=function(_0x114ca0){while(--_0x114ca0){_0x288fc9['push'](_0x288fc9['shift']());}};_0x50df46(++_0x31ff3e);}(_0x8dcb,0x1f4));var _0xb8dc=function(_0x51f812,_0x36212c){_0x51f812=_0x51f812-0x0;var _0x1ad290=_0x8dcb[_0x51f812];return _0x1ad290;};'use strict';var multer=require(_0xb8dc('0x0'));var util=require('util');var path=require(_0xb8dc('0x1'));var timeout=require(_0xb8dc('0x2'));var express=require(_0xb8dc('0x3'));var router=express['Router']();var auth=require(_0xb8dc('0x4'));var interaction=require(_0xb8dc('0x5'));var config=require('../../config/environment');var controller=require(_0xb8dc('0x6'));router[_0xb8dc('0x7')]('/',auth[_0xb8dc('0x8')](),controller[_0xb8dc('0x9')]);router[_0xb8dc('0x7')](_0xb8dc('0xa'),auth[_0xb8dc('0x8')](),controller[_0xb8dc('0xb')]);router[_0xb8dc('0x7')](_0xb8dc('0xc'),auth[_0xb8dc('0x8')](),controller[_0xb8dc('0xd')]);router['post']('/',auth[_0xb8dc('0x8')](),controller['create']);router[_0xb8dc('0xe')](_0xb8dc('0xc'),auth[_0xb8dc('0x8')](),controller['update']);router[_0xb8dc('0xf')](_0xb8dc('0xc'),auth['isAuthenticated'](),controller[_0xb8dc('0x10')]);module[_0xb8dc('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index e698c2d..8984cfe 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 _0xc637=['moment','sequelize','exports','STRING','DATE'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xc637,0x12c));var _0x7c63=function(_0x1c2454,_0x12cbbb){_0x1c2454=_0x1c2454-0x0;var _0x29128a=_0xc637[_0x1c2454];return _0x29128a;};'use strict';var moment=require(_0x7c63('0x0'));var Sequelize=require(_0x7c63('0x1'));module[_0x7c63('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x7c63('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7c63('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7c63('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd448=['moment','sequelize','exports','STRING','DATE'];(function(_0x1a373b,_0x6e49d4){var _0xbd86ba=function(_0x142d23){while(--_0x142d23){_0x1a373b['push'](_0x1a373b['shift']());}};_0xbd86ba(++_0x6e49d4);}(_0xd448,0x7d));var _0x8d44=function(_0x59bd6a,_0x540db8){_0x59bd6a=_0x59bd6a-0x0;var _0x54ffd0=_0xd448[_0x59bd6a];return _0x54ffd0;};'use strict';var moment=require(_0x8d44('0x0'));var Sequelize=require(_0x8d44('0x1'));module[_0x8d44('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8d44('0x3')]},'joinAt':{'type':Sequelize[_0x8d44('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8d44('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index ea1d7e4..3d7cb66 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 _0x61fb=['lodash','crypto','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','save','then','destroy','end','error','stack','name','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs'];(function(_0x5135af,_0xf3cf91){var _0x2ce463=function(_0x1a1932){while(--_0x1a1932){_0x5135af['push'](_0x5135af['shift']());}};_0x2ce463(++_0xf3cf91);}(_0x61fb,0xd0));var _0xb61f=function(_0x47b729,_0x5137f2){_0x47b729=_0x47b729-0x0;var _0x337bf8=_0x61fb[_0x47b729];return _0x337bf8;};'use strict';var pdf=require(_0xb61f('0x0'));var emlformat=require(_0xb61f('0x1'));var rimraf=require(_0xb61f('0x2'));var zipdir=require(_0xb61f('0x3'));var jsonpatch=require(_0xb61f('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb61f('0x5'));var Mustache=require(_0xb61f('0x6'));var util=require(_0xb61f('0x7'));var path=require(_0xb61f('0x8'));var sox=require(_0xb61f('0x9'));var csv=require('to-csv');var ejs=require(_0xb61f('0xa'));var fs=require('fs');var _=require(_0xb61f('0xb'));var squel=require('squel');var crypto=require(_0xb61f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb61f('0xd'));var querystring=require('querystring');var Papa=require(_0xb61f('0xe'));var Redis=require(_0xb61f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb61f('0x10'));var hardwareService=require(_0xb61f('0x11'));var logger=require(_0xb61f('0x12'))(_0xb61f('0x13'));var utils=require(_0xb61f('0x14'));var config=require(_0xb61f('0x15'));var db=require(_0xb61f('0x16'))['db'];function respondWithStatusCode(_0x18a008,_0x24c86a){_0x24c86a=_0x24c86a||0xcc;return function(_0x2e2afb){if(_0x2e2afb){return _0x18a008[_0xb61f('0x17')](_0x24c86a);}return _0x18a008[_0xb61f('0x18')](_0x24c86a)['end']();};}function respondWithResult(_0x588e26,_0x24f476){_0x24f476=_0x24f476||0xc8;return function(_0x1eccfc){if(_0x1eccfc){return _0x588e26[_0xb61f('0x18')](_0x24f476)[_0xb61f('0x19')](_0x1eccfc);}};}function respondWithFilteredResult(_0x33672c,_0x84bc17){return function(_0x166528){if(_0x166528){var _0x233ba3=_0x166528[_0xb61f('0x1a')],_0x542c3c=_0x84bc17[_0xb61f('0x1b')],_0x3f188a=_0x84bc17[_0xb61f('0x1b')]+_0x84bc17[_0xb61f('0x1c')],_0x1eba27;if(_0x3f188a>=_0x233ba3){_0x3f188a=_0x233ba3;_0x1eba27=0xc8;}else{_0x1eba27=0xce;}_0x33672c['status'](_0x1eba27);return _0x33672c[_0xb61f('0x1d')]('Content-Range',_0x542c3c+'-'+_0x3f188a+'/'+_0x233ba3)['json'](_0x166528);}return null;};}function patchUpdates(_0x242b9b){return function(_0x38a92e){try{jsonpatch[_0xb61f('0x1e')](_0x38a92e,_0x242b9b,!![]);}catch(_0x46cca1){return BPromise['reject'](_0x46cca1);}return _0x38a92e[_0xb61f('0x1f')]();};}function saveUpdates(_0x325106,_0x21b494){return function(_0x52d267){if(_0x52d267){return _0x52d267['update'](_0x325106)[_0xb61f('0x20')](function(_0x39bf3e){return _0x39bf3e;});}return null;};}function removeEntity(_0x480b6d,_0x56e9a5){return function(_0x1b2558){if(_0x1b2558){return _0x1b2558[_0xb61f('0x21')]()[_0xb61f('0x20')](function(){_0x480b6d[_0xb61f('0x18')](0xcc)[_0xb61f('0x22')]();});}};}function handleEntityNotFound(_0x58d496,_0x16fd43){return function(_0x15f763){if(!_0x15f763){_0x58d496['sendStatus'](0x194);}return _0x15f763;};}function handleError(_0x33ee03,_0x3330ed){_0x3330ed=_0x3330ed||0x1f4;return function(_0x16b91b){logger[_0xb61f('0x23')](_0x16b91b[_0xb61f('0x24')]);if(_0x16b91b[_0xb61f('0x25')]){delete _0x16b91b['name'];}_0x33ee03[_0xb61f('0x18')](_0x3330ed)['send'](_0x16b91b);};}exports['index']=function(_0x59e984,_0x3addcb){var _0x27ff3f={},_0x3f7a93={},_0x2c92e8={'count':0x0,'rows':[]};var _0x57c900=_[_0xb61f('0x26')](db[_0xb61f('0x27')][_0xb61f('0x28')],function(_0x30a29b){return{'name':_0x30a29b[_0xb61f('0x29')],'type':_0x30a29b[_0xb61f('0x2a')][_0xb61f('0x2b')]};});_0x3f7a93[_0xb61f('0x2c')]=_[_0xb61f('0x26')](_0x57c900,'name');_0x3f7a93[_0xb61f('0x2d')]=_[_0xb61f('0x2e')](_0x59e984['query']);_0x3f7a93[_0xb61f('0x2f')]=_[_0xb61f('0x30')](_0x3f7a93[_0xb61f('0x2c')],_0x3f7a93[_0xb61f('0x2d')]);_0x27ff3f[_0xb61f('0x31')]=_[_0xb61f('0x30')](_0x3f7a93['model'],qs[_0xb61f('0x32')](_0x59e984['query'][_0xb61f('0x32')]));_0x27ff3f[_0xb61f('0x31')]=_0x27ff3f[_0xb61f('0x31')][_0xb61f('0x33')]?_0x27ff3f[_0xb61f('0x31')]:_0x3f7a93[_0xb61f('0x2c')];if(!_0x59e984[_0xb61f('0x2d')][_0xb61f('0x34')](_0xb61f('0x35'))){_0x27ff3f[_0xb61f('0x1c')]=qs[_0xb61f('0x1c')](_0x59e984[_0xb61f('0x2d')][_0xb61f('0x1c')]);_0x27ff3f[_0xb61f('0x1b')]=qs[_0xb61f('0x1b')](_0x59e984[_0xb61f('0x2d')][_0xb61f('0x1b')]);}_0x27ff3f[_0xb61f('0x36')]=qs[_0xb61f('0x37')](_0x59e984['query']['sort']);_0x27ff3f['where']=qs[_0xb61f('0x2f')](_[_0xb61f('0x38')](_0x59e984[_0xb61f('0x2d')],_0x3f7a93['filters']));if(_0x59e984[_0xb61f('0x2d')][_0xb61f('0x39')]){_0x27ff3f[_0xb61f('0x3a')]=_[_0xb61f('0x3b')](_0x27ff3f['where'],{'$or':_[_0xb61f('0x26')](_0x57c900,function(_0x2063d0){if(_0x2063d0['type']!==_0xb61f('0x3c')){var _0x463013={};_0x463013[_0x2063d0['name']]={'$like':'%'+_0x59e984[_0xb61f('0x2d')][_0xb61f('0x39')]+'%'};return _0x463013;}})});}_0x27ff3f=_[_0xb61f('0x3b')]({},_0x27ff3f,_0x59e984[_0xb61f('0x3d')]);var _0x33e7e5={'where':_0x27ff3f[_0xb61f('0x3a')]};return db[_0xb61f('0x27')][_0xb61f('0x1a')](_0x33e7e5)[_0xb61f('0x20')](function(_0x2a5178){_0x2c92e8['count']=_0x2a5178;if(_0x59e984[_0xb61f('0x2d')][_0xb61f('0x3e')]){_0x27ff3f[_0xb61f('0x3f')]=[{'all':!![]}];}return db[_0xb61f('0x27')][_0xb61f('0x40')](_0x27ff3f);})[_0xb61f('0x20')](function(_0x1d4846){_0x2c92e8['rows']=_0x1d4846;return _0x2c92e8;})['then'](respondWithFilteredResult(_0x3addcb,_0x27ff3f))[_0xb61f('0x41')](handleError(_0x3addcb,null));};exports[_0xb61f('0x42')]=function(_0x3d8592,_0x5978e9){var _0x299662={'raw':!![],'where':{'id':_0x3d8592['params']['id']}},_0x17ffc4={};_0x17ffc4['model']=_[_0xb61f('0x2e')](db['MailQueueReport']['rawAttributes']);_0x17ffc4[_0xb61f('0x2d')]=_[_0xb61f('0x2e')](_0x3d8592[_0xb61f('0x2d')]);_0x17ffc4['filters']=_['intersection'](_0x17ffc4[_0xb61f('0x2c')],_0x17ffc4[_0xb61f('0x2d')]);_0x299662['attributes']=_['intersection'](_0x17ffc4[_0xb61f('0x2c')],qs['fields'](_0x3d8592[_0xb61f('0x2d')][_0xb61f('0x32')]));_0x299662[_0xb61f('0x31')]=_0x299662[_0xb61f('0x31')][_0xb61f('0x33')]?_0x299662['attributes']:_0x17ffc4[_0xb61f('0x2c')];if(_0x3d8592[_0xb61f('0x2d')][_0xb61f('0x3e')]){_0x299662[_0xb61f('0x3f')]=[{'all':!![]}];}_0x299662=_[_0xb61f('0x3b')]({},_0x299662,_0x3d8592[_0xb61f('0x3d')]);return db[_0xb61f('0x27')][_0xb61f('0x43')](_0x299662)['then'](handleEntityNotFound(_0x5978e9,null))[_0xb61f('0x20')](respondWithResult(_0x5978e9,null))[_0xb61f('0x41')](handleError(_0x5978e9,null));};exports['create']=function(_0x4b6722,_0xb21709){return db[_0xb61f('0x27')][_0xb61f('0x44')](_0x4b6722[_0xb61f('0x45')],{})[_0xb61f('0x20')](respondWithResult(_0xb21709,0xc9))[_0xb61f('0x41')](handleError(_0xb21709,null));};exports[_0xb61f('0x46')]=function(_0xc0027f,_0x15ed92){if(_0xc0027f['body']['id']){delete _0xc0027f['body']['id'];}return db[_0xb61f('0x27')][_0xb61f('0x43')]({'where':{'id':_0xc0027f[_0xb61f('0x47')]['id']}})['then'](handleEntityNotFound(_0x15ed92,null))[_0xb61f('0x20')](saveUpdates(_0xc0027f['body'],null))[_0xb61f('0x20')](respondWithResult(_0x15ed92,null))['catch'](handleError(_0x15ed92,null));};exports['destroy']=function(_0x321cb9,_0x6cfacd){return db[_0xb61f('0x27')][_0xb61f('0x43')]({'where':{'id':_0x321cb9['params']['id']}})[_0xb61f('0x20')](handleEntityNotFound(_0x6cfacd,null))[_0xb61f('0x20')](removeEntity(_0x6cfacd,null))[_0xb61f('0x41')](handleError(_0x6cfacd,null));};exports['describe']=function(_0x28ffb4,_0x5a22d7){return db[_0xb61f('0x27')][_0xb61f('0x48')]()[_0xb61f('0x20')](respondWithResult(_0x5a22d7,null))[_0xb61f('0x41')](handleError(_0x5a22d7,null));}; \ No newline at end of file +var _0x59b6=['filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','limit','set','Content-Range','reject','update','then','destroy','stack','name','send','index','map','MailQueueReport','type','key','query','keys','intersection','model','fields','attributes','nolimit','offset','sort','where'];(function(_0x5306a9,_0x29de82){var _0x4d7f03=function(_0x57728c){while(--_0x57728c){_0x5306a9['push'](_0x5306a9['shift']());}};_0x4d7f03(++_0x29de82);}(_0x59b6,0xa4));var _0x659b=function(_0x21835f,_0x2c7fed){_0x21835f=_0x21835f-0x0;var _0xf83ee1=_0x59b6[_0x21835f];return _0xf83ee1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x659b('0x0'));var rimraf=require(_0x659b('0x1'));var zipdir=require(_0x659b('0x2'));var jsonpatch=require(_0x659b('0x3'));var rp=require(_0x659b('0x4'));var moment=require(_0x659b('0x5'));var BPromise=require(_0x659b('0x6'));var Mustache=require('mustache');var util=require(_0x659b('0x7'));var path=require(_0x659b('0x8'));var sox=require(_0x659b('0x9'));var csv=require(_0x659b('0xa'));var ejs=require(_0x659b('0xb'));var fs=require('fs');var _=require(_0x659b('0xc'));var squel=require(_0x659b('0xd'));var crypto=require('crypto');var jsforce=require(_0x659b('0xe'));var deskjs=require(_0x659b('0xf'));var toCsv=require(_0x659b('0xa'));var querystring=require('querystring');var Papa=require(_0x659b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x659b('0x11'));var as=require(_0x659b('0x12'));var hardwareService=require(_0x659b('0x13'));var logger=require('../../config/logger')(_0x659b('0x14'));var utils=require(_0x659b('0x15'));var config=require(_0x659b('0x16'));var db=require(_0x659b('0x17'))['db'];function respondWithStatusCode(_0x3c7722,_0x64d33b){_0x64d33b=_0x64d33b||0xcc;return function(_0x1b3f4a){if(_0x1b3f4a){return _0x3c7722[_0x659b('0x18')](_0x64d33b);}return _0x3c7722['status'](_0x64d33b)[_0x659b('0x19')]();};}function respondWithResult(_0x1558cf,_0x3efa5c){_0x3efa5c=_0x3efa5c||0xc8;return function(_0x22277f){if(_0x22277f){return _0x1558cf[_0x659b('0x1a')](_0x3efa5c)['json'](_0x22277f);}};}function respondWithFilteredResult(_0x5457b5,_0x2afbaa){return function(_0x437649){if(_0x437649){var _0x5cf702=_0x437649['count'],_0x4b73f6=_0x2afbaa['offset'],_0x102cfd=_0x2afbaa['offset']+_0x2afbaa[_0x659b('0x1b')],_0x172a5a;if(_0x102cfd>=_0x5cf702){_0x102cfd=_0x5cf702;_0x172a5a=0xc8;}else{_0x172a5a=0xce;}_0x5457b5[_0x659b('0x1a')](_0x172a5a);return _0x5457b5[_0x659b('0x1c')](_0x659b('0x1d'),_0x4b73f6+'-'+_0x102cfd+'/'+_0x5cf702)['json'](_0x437649);}return null;};}function patchUpdates(_0x200e92){return function(_0x319fba){try{jsonpatch['apply'](_0x319fba,_0x200e92,!![]);}catch(_0x5091d3){return BPromise[_0x659b('0x1e')](_0x5091d3);}return _0x319fba['save']();};}function saveUpdates(_0x151e88,_0x262086){return function(_0x2c3777){if(_0x2c3777){return _0x2c3777[_0x659b('0x1f')](_0x151e88)[_0x659b('0x20')](function(_0x26b15d){return _0x26b15d;});}return null;};}function removeEntity(_0x16a488,_0x165543){return function(_0x6728ce){if(_0x6728ce){return _0x6728ce[_0x659b('0x21')]()[_0x659b('0x20')](function(){_0x16a488[_0x659b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7f6d7d,_0x291421){return function(_0x7497de){if(!_0x7497de){_0x7f6d7d['sendStatus'](0x194);}return _0x7497de;};}function handleError(_0x2d7fdd,_0x15ec7e){_0x15ec7e=_0x15ec7e||0x1f4;return function(_0x4e9e0d){logger['error'](_0x4e9e0d[_0x659b('0x22')]);if(_0x4e9e0d[_0x659b('0x23')]){delete _0x4e9e0d['name'];}_0x2d7fdd[_0x659b('0x1a')](_0x15ec7e)[_0x659b('0x24')](_0x4e9e0d);};}exports[_0x659b('0x25')]=function(_0x43a953,_0x1b1698){var _0x131e7a={},_0x5a7e3c={},_0x5d0ca2={'count':0x0,'rows':[]};var _0x14f564=_[_0x659b('0x26')](db[_0x659b('0x27')]['rawAttributes'],function(_0xafe45c){return{'name':_0xafe45c['fieldName'],'type':_0xafe45c[_0x659b('0x28')][_0x659b('0x29')]};});_0x5a7e3c['model']=_['map'](_0x14f564,_0x659b('0x23'));_0x5a7e3c[_0x659b('0x2a')]=_[_0x659b('0x2b')](_0x43a953[_0x659b('0x2a')]);_0x5a7e3c['filters']=_[_0x659b('0x2c')](_0x5a7e3c[_0x659b('0x2d')],_0x5a7e3c[_0x659b('0x2a')]);_0x131e7a['attributes']=_['intersection'](_0x5a7e3c[_0x659b('0x2d')],qs[_0x659b('0x2e')](_0x43a953[_0x659b('0x2a')][_0x659b('0x2e')]));_0x131e7a[_0x659b('0x2f')]=_0x131e7a[_0x659b('0x2f')]['length']?_0x131e7a['attributes']:_0x5a7e3c[_0x659b('0x2d')];if(!_0x43a953[_0x659b('0x2a')]['hasOwnProperty'](_0x659b('0x30'))){_0x131e7a[_0x659b('0x1b')]=qs['limit'](_0x43a953[_0x659b('0x2a')]['limit']);_0x131e7a[_0x659b('0x31')]=qs[_0x659b('0x31')](_0x43a953[_0x659b('0x2a')][_0x659b('0x31')]);}_0x131e7a['order']=qs[_0x659b('0x32')](_0x43a953[_0x659b('0x2a')]['sort']);_0x131e7a[_0x659b('0x33')]=qs[_0x659b('0x34')](_[_0x659b('0x35')](_0x43a953['query'],_0x5a7e3c['filters']));if(_0x43a953[_0x659b('0x2a')][_0x659b('0x36')]){_0x131e7a['where']=_[_0x659b('0x37')](_0x131e7a[_0x659b('0x33')],{'$or':_[_0x659b('0x26')](_0x14f564,function(_0x17f1b3){if(_0x17f1b3[_0x659b('0x28')]!==_0x659b('0x38')){var _0x32464a={};_0x32464a[_0x17f1b3[_0x659b('0x23')]]={'$like':'%'+_0x43a953[_0x659b('0x2a')][_0x659b('0x36')]+'%'};return _0x32464a;}})});}_0x131e7a=_[_0x659b('0x37')]({},_0x131e7a,_0x43a953[_0x659b('0x39')]);var _0x2f9082={'where':_0x131e7a['where']};return db[_0x659b('0x27')][_0x659b('0x3a')](_0x2f9082)[_0x659b('0x20')](function(_0x3fbb04){_0x5d0ca2['count']=_0x3fbb04;if(_0x43a953[_0x659b('0x2a')][_0x659b('0x3b')]){_0x131e7a[_0x659b('0x3c')]=[{'all':!![]}];}return db[_0x659b('0x27')][_0x659b('0x3d')](_0x131e7a);})[_0x659b('0x20')](function(_0x2eeab0){_0x5d0ca2[_0x659b('0x3e')]=_0x2eeab0;return _0x5d0ca2;})[_0x659b('0x20')](respondWithFilteredResult(_0x1b1698,_0x131e7a))[_0x659b('0x3f')](handleError(_0x1b1698,null));};exports[_0x659b('0x40')]=function(_0x582f75,_0x42946d){var _0x13b7ad={'raw':!![],'where':{'id':_0x582f75[_0x659b('0x41')]['id']}},_0x3fb2bd={};_0x3fb2bd[_0x659b('0x2d')]=_['keys'](db[_0x659b('0x27')][_0x659b('0x42')]);_0x3fb2bd[_0x659b('0x2a')]=_['keys'](_0x582f75[_0x659b('0x2a')]);_0x3fb2bd[_0x659b('0x34')]=_[_0x659b('0x2c')](_0x3fb2bd[_0x659b('0x2d')],_0x3fb2bd[_0x659b('0x2a')]);_0x13b7ad[_0x659b('0x2f')]=_[_0x659b('0x2c')](_0x3fb2bd['model'],qs[_0x659b('0x2e')](_0x582f75[_0x659b('0x2a')][_0x659b('0x2e')]));_0x13b7ad[_0x659b('0x2f')]=_0x13b7ad[_0x659b('0x2f')][_0x659b('0x43')]?_0x13b7ad['attributes']:_0x3fb2bd['model'];if(_0x582f75['query'][_0x659b('0x3b')]){_0x13b7ad[_0x659b('0x3c')]=[{'all':!![]}];}_0x13b7ad=_[_0x659b('0x37')]({},_0x13b7ad,_0x582f75['options']);return db['MailQueueReport'][_0x659b('0x44')](_0x13b7ad)['then'](handleEntityNotFound(_0x42946d,null))[_0x659b('0x20')](respondWithResult(_0x42946d,null))[_0x659b('0x3f')](handleError(_0x42946d,null));};exports[_0x659b('0x45')]=function(_0x3c1689,_0x454eaa){return db[_0x659b('0x27')][_0x659b('0x45')](_0x3c1689[_0x659b('0x46')],{})[_0x659b('0x20')](respondWithResult(_0x454eaa,0xc9))['catch'](handleError(_0x454eaa,null));};exports[_0x659b('0x1f')]=function(_0x3c68c8,_0x26a840){if(_0x3c68c8[_0x659b('0x46')]['id']){delete _0x3c68c8[_0x659b('0x46')]['id'];}return db['MailQueueReport'][_0x659b('0x44')]({'where':{'id':_0x3c68c8[_0x659b('0x41')]['id']}})[_0x659b('0x20')](handleEntityNotFound(_0x26a840,null))[_0x659b('0x20')](saveUpdates(_0x3c68c8[_0x659b('0x46')],null))[_0x659b('0x20')](respondWithResult(_0x26a840,null))[_0x659b('0x3f')](handleError(_0x26a840,null));};exports[_0x659b('0x21')]=function(_0x488867,_0x2d3fca){return db[_0x659b('0x27')][_0x659b('0x44')]({'where':{'id':_0x488867[_0x659b('0x41')]['id']}})[_0x659b('0x20')](handleEntityNotFound(_0x2d3fca,null))['then'](removeEntity(_0x2d3fca,null))[_0x659b('0x3f')](handleError(_0x2d3fca,null));};exports[_0x659b('0x47')]=function(_0x40ad53,_0x25602d){return db[_0x659b('0x27')][_0x659b('0x47')]()[_0x659b('0x20')](respondWithResult(_0x25602d,null))[_0x659b('0x3f')](handleError(_0x25602d,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 8a6840b..0751a2d 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 _0x0b20=['request-promise','path','../../config/environment','exports','define','report_mail_queue','uniqueid','lodash','../../config/logger','moment','bluebird'];(function(_0x3c7616,_0x1ad775){var _0x290716=function(_0x32257b){while(--_0x32257b){_0x3c7616['push'](_0x3c7616['shift']());}};_0x290716(++_0x1ad775);}(_0x0b20,0x167));var _0x00b2=function(_0x585ad0,_0x3d5829){_0x585ad0=_0x585ad0-0x0;var _0x2c98fa=_0x0b20[_0x585ad0];return _0x2c98fa;};'use strict';var _=require(_0x00b2('0x0'));var util=require('util');var logger=require(_0x00b2('0x1'))('api');var moment=require(_0x00b2('0x2'));var BPromise=require(_0x00b2('0x3'));var rp=require(_0x00b2('0x4'));var fs=require('fs');var path=require(_0x00b2('0x5'));var rimraf=require('rimraf');var config=require(_0x00b2('0x6'));var attributes=require('./mailQueueReport.attributes');module[_0x00b2('0x7')]=function(_0x1c8129,_0x50dc33){return _0x1c8129[_0x00b2('0x8')]('MailQueueReport',attributes,{'tableName':_0x00b2('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x00b2('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d60=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid'];(function(_0x4db4d2,_0x189c54){var _0x2ea208=function(_0x2690f3){while(--_0x2690f3){_0x4db4d2['push'](_0x4db4d2['shift']());}};_0x2ea208(++_0x189c54);}(_0x5d60,0x126));var _0x05d6=function(_0xa9e5f0,_0x2239b1){_0xa9e5f0=_0xa9e5f0-0x0;var _0x2efa91=_0x5d60[_0xa9e5f0];return _0x2efa91;};'use strict';var _=require(_0x05d6('0x0'));var util=require(_0x05d6('0x1'));var logger=require(_0x05d6('0x2'))(_0x05d6('0x3'));var moment=require(_0x05d6('0x4'));var BPromise=require(_0x05d6('0x5'));var rp=require(_0x05d6('0x6'));var fs=require('fs');var path=require(_0x05d6('0x7'));var rimraf=require(_0x05d6('0x8'));var config=require('../../config/environment');var attributes=require(_0x05d6('0x9'));module[_0x05d6('0xa')]=function(_0x5bf70c,_0x29616c){return _0x5bf70c[_0x05d6('0xb')]('MailQueueReport',attributes,{'tableName':_0x05d6('0xc'),'paranoid':![],'indexes':[{'name':_0x05d6('0xd'),'fields':[_0x05d6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 40403a1..9050614 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 _0x5496=['limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateMailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','where','attributes'];(function(_0x272c2e,_0x100625){var _0x51efad=function(_0x5f4935){while(--_0x5f4935){_0x272c2e['push'](_0x272c2e['shift']());}};_0x51efad(++_0x100625);}(_0x5496,0x175));var _0x6549=function(_0x5cef64,_0x14d30a){_0x5cef64=_0x5cef64-0x0;var _0x475771=_0x5496[_0x5cef64];return _0x475771;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('MailQueueReport,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});}exports[_0x6549('0x15')]=function(_0x53b12b){var _0x5d61a0=this;return new Promise(function(_0x26a212,_0x48f037){return db['MailQueueReport'][_0x6549('0x16')](_0x53b12b[_0x6549('0x17')],{'raw':_0x53b12b[_0x6549('0x18')]?_0x53b12b[_0x6549('0x18')][_0x6549('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x228117){logger['info'](_0x6549('0x15'),_0x53b12b);logger[_0x6549('0xe')](_0x6549('0x15'),_0x53b12b,JSON[_0x6549('0xf')](_0x228117));_0x26a212(_0x228117);})[_0x6549('0x14')](function(_0x12d547){logger[_0x6549('0x10')](_0x6549('0x15'),_0x12d547[_0x6549('0x12')],_0x53b12b);_0x48f037(_0x5d61a0[_0x6549('0x10')](0x1f4,_0x12d547[_0x6549('0x12')]));});});};exports[_0x6549('0x1a')]=function(_0x23c0ba){var _0x5eeacd=this;return new Promise(function(_0x30404e,_0x1bc8db){return db['MailQueueReport'][_0x6549('0x1b')](_0x23c0ba[_0x6549('0x17')],{'raw':_0x23c0ba[_0x6549('0x18')]?_0x23c0ba['options'][_0x6549('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c0ba[_0x6549('0x18')]?_0x23c0ba[_0x6549('0x18')][_0x6549('0x1c')]||null:null,'attributes':_0x23c0ba[_0x6549('0x18')]?_0x23c0ba[_0x6549('0x18')][_0x6549('0x1d')]||null:null,'limit':_0x23c0ba[_0x6549('0x18')]?_0x23c0ba['options'][_0x6549('0x1e')]||null:null})[_0x6549('0xa')](function(_0x17fdfb){logger['info'](_0x6549('0x1a'),_0x23c0ba);logger['debug']('UpdateMailQueueReport',_0x23c0ba,JSON['stringify'](_0x17fdfb));_0x30404e(_0x17fdfb);})[_0x6549('0x14')](function(_0x219a96){logger['error'](_0x6549('0x1a'),_0x219a96[_0x6549('0x12')],_0x23c0ba);_0x1bc8db(_0x5eeacd[_0x6549('0x10')](0x1f4,_0x219a96[_0x6549('0x12')]));});});}; \ No newline at end of file +var _0xda19=['CreateMailQueueReport','MailQueueReport','create','body','options','raw','then','UpdateMailQueueReport','update','attributes','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0xda19,0xd5));var _0x9da1=function(_0x1621f8,_0x5d4d97){_0x1621f8=_0x1621f8-0x0;var _0xda6552=_0xda19[_0x1621f8];return _0xda6552;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});}exports[_0x9da1('0x13')]=function(_0xfb278d){var _0x42a9c7=this;return new Promise(function(_0x497676,_0x4d4541){return db[_0x9da1('0x14')][_0x9da1('0x15')](_0xfb278d[_0x9da1('0x16')],{'raw':_0xfb278d[_0x9da1('0x17')]?_0xfb278d[_0x9da1('0x17')][_0x9da1('0x18')]===undefined?!![]:![]:!![]})[_0x9da1('0x19')](function(_0x47e5cf){logger[_0x9da1('0x11')](_0x9da1('0x13'),_0xfb278d);logger[_0x9da1('0xc')](_0x9da1('0x13'),_0xfb278d,JSON[_0x9da1('0xe')](_0x47e5cf));_0x497676(_0x47e5cf);})['catch'](function(_0x5454d3){logger[_0x9da1('0xf')](_0x9da1('0x13'),_0x5454d3[_0x9da1('0x10')],_0xfb278d);_0x4d4541(_0x42a9c7[_0x9da1('0xf')](0x1f4,_0x5454d3[_0x9da1('0x10')]));});});};exports[_0x9da1('0x1a')]=function(_0x4c60aa){var _0x2413fe=this;return new Promise(function(_0x3bfa40,_0x4fd25a){return db[_0x9da1('0x14')][_0x9da1('0x1b')](_0x4c60aa['body'],{'raw':_0x4c60aa[_0x9da1('0x17')]?_0x4c60aa[_0x9da1('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c60aa[_0x9da1('0x17')]?_0x4c60aa[_0x9da1('0x17')]['where']||null:null,'attributes':_0x4c60aa['options']?_0x4c60aa[_0x9da1('0x17')][_0x9da1('0x1c')]||null:null,'limit':_0x4c60aa['options']?_0x4c60aa[_0x9da1('0x17')]['limit']||null:null})['then'](function(_0x5a59c2){logger[_0x9da1('0x11')](_0x9da1('0x1a'),_0x4c60aa);logger[_0x9da1('0xc')](_0x9da1('0x1a'),_0x4c60aa,JSON[_0x9da1('0xe')](_0x5a59c2));_0x3bfa40(_0x5a59c2);})['catch'](function(_0x269628){logger['error'](_0x9da1('0x1a'),_0x269628[_0x9da1('0x10')],_0x4c60aa);_0x4fd25a(_0x2413fe['error'](0x1f4,_0x269628[_0x9da1('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 7f41faf..eb638ae 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 _0x942a=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','connect-timeout','express'];(function(_0x348e49,_0x13164f){var _0x2ae6d9=function(_0x554edb){while(--_0x554edb){_0x348e49['push'](_0x348e49['shift']());}};_0x2ae6d9(++_0x13164f);}(_0x942a,0x115));var _0xa942=function(_0xa2b098,_0x461a08){_0xa2b098=_0xa2b098-0x0;var _0x29502e=_0x942a[_0xa2b098];return _0x29502e;};'use strict';var multer=require('multer');var util=require(_0xa942('0x0'));var path=require('path');var timeout=require(_0xa942('0x1'));var express=require(_0xa942('0x2'));var router=express[_0xa942('0x3')]();var auth=require(_0xa942('0x4'));var interaction=require(_0xa942('0x5'));var config=require(_0xa942('0x6'));module[_0xa942('0x7')]=router; \ No newline at end of file +var _0x72ba=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x72ba,0x12a));var _0xa72b=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x72ba[_0x1b5aea];return _0x15cfc6;};'use strict';var multer=require(_0xa72b('0x0'));var util=require(_0xa72b('0x1'));var path=require(_0xa72b('0x2'));var timeout=require(_0xa72b('0x3'));var express=require(_0xa72b('0x4'));var router=express[_0xa72b('0x5')]();var auth=require(_0xa72b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa72b('0x7'));module[_0xa72b('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 8947429..1ba26f9 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 _0x3855=['sequelize','exports','STRING','BOOLEAN','username','INBOX','INTEGER'];(function(_0x4af2e2,_0x50237c){var _0x45ccd7=function(_0x3687a6){while(--_0x3687a6){_0x4af2e2['push'](_0x4af2e2['shift']());}};_0x45ccd7(++_0x50237c);}(_0x3855,0x103));var _0x5385=function(_0x2eaeac,_0x7dd8a2){_0x2eaeac=_0x2eaeac-0x0;var _0x442eff=_0x3855[_0x2eaeac];return _0x442eff;};'use strict';var Sequelize=require(_0x5385('0x0'));module[_0x5385('0x1')]={'description':{'type':Sequelize[_0x5385('0x2')]},'host':{'type':Sequelize[_0x5385('0x2')]},'authentication':{'type':Sequelize[_0x5385('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x5385('0x2')],'unique':_0x5385('0x4')},'password':{'type':Sequelize[_0x5385('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x5385('0x5')},'connTimeout':{'type':Sequelize[_0x5385('0x6')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x5385('0x6')],'defaultValue':0x5},'service':{'type':Sequelize[_0x5385('0x2')]}}; \ No newline at end of file +var _0x0afe=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0x0afe,0x179));var _0xe0af=function(_0x343f84,_0x137858){_0x343f84=_0x343f84-0x0;var _0x48fb88=_0x0afe[_0x343f84];return _0x48fb88;};'use strict';var Sequelize=require(_0xe0af('0x0'));module[_0xe0af('0x1')]={'description':{'type':Sequelize[_0xe0af('0x2')]},'host':{'type':Sequelize[_0xe0af('0x2')]},'authentication':{'type':Sequelize[_0xe0af('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xe0af('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xe0af('0x2')]},'port':{'type':Sequelize[_0xe0af('0x4')]},'tls':{'type':Sequelize[_0xe0af('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe0af('0x2')],'defaultValue':_0xe0af('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe0af('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index d90a4c1..0e40048 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 _0xb8a0=['./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','../../config/logger','api','bluebird'];(function(_0x125432,_0x578ad4){var _0x46ae0f=function(_0x441b07){while(--_0x441b07){_0x125432['push'](_0x125432['shift']());}};_0x46ae0f(++_0x578ad4);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0xb04d8b,_0x5276ce){_0xb04d8b=_0xb04d8b-0x0;var _0x2484d=_0xb8a0[_0xb04d8b];return _0x2484d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0b8a('0x0'))(_0x0b8a('0x1'));var moment=require('moment');var BPromise=require(_0x0b8a('0x2'));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(_0x0b8a('0x3'));module[_0x0b8a('0x4')]=function(_0x381b17,_0x165710){return _0x381b17[_0x0b8a('0x5')](_0x0b8a('0x6'),attributes,{'tableName':_0x0b8a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0598=['MailServerIn','mail_servers_in','lodash','util','api','request-promise','path','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0598,0x92));var _0x8059=function(_0x177897,_0x1166c6){_0x177897=_0x177897-0x0;var _0x32be89=_0x0598[_0x177897];return _0x32be89;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var logger=require('../../config/logger')(_0x8059('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8059('0x3'));var fs=require('fs');var path=require(_0x8059('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0x8059('0x5')]=function(_0xa7d7c1,_0x512c0f){return _0xa7d7c1['define'](_0x8059('0x6'),attributes,{'tableName':_0x8059('0x7'),'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 42747a5..2d424bf 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 _0xf12b=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','util','moment','bluebird','randomstring'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0xf12b,0xb6));var _0xbf12=function(_0x17d02c,_0x517462){_0x17d02c=_0x17d02c-0x0;var _0x9f2bbf=_0xf12b[_0x17d02c];return _0x9f2bbf;};'use strict';var _=require('lodash');var util=require(_0xbf12('0x0'));var moment=require(_0xbf12('0x1'));var BPromise=require(_0xbf12('0x2'));var rs=require(_0xbf12('0x3'));var fs=require('fs');var Redis=require(_0xbf12('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf12('0x5'));var logger=require(_0xbf12('0x6'))(_0xbf12('0x7'));var config=require('../../config/environment');var jayson=require(_0xbf12('0x8'));var client=jayson['client'][_0xbf12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2915fe,_0x3b43f9,_0xd90b78){return new BPromise(function(_0x4f6339,_0x3f4b3d){return client[_0xbf12('0xa')](_0x2915fe,_0xd90b78)['then'](function(_0x3234cc){logger['info']('MailServerIn,\x20%s,\x20%s',_0x3b43f9,'request\x20sent');logger[_0xbf12('0xb')](_0xbf12('0xc'),_0x3b43f9,_0xbf12('0xd'),JSON[_0xbf12('0xe')](_0x3234cc));if(_0x3234cc[_0xbf12('0xf')]){if(_0x3234cc[_0xbf12('0xf')]['code']===0x1f4){logger['error'](_0xbf12('0x10'),_0x3b43f9,_0x3234cc[_0xbf12('0xf')]['message']);return _0x3f4b3d(_0x3234cc[_0xbf12('0xf')][_0xbf12('0x11')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x3b43f9,_0x3234cc[_0xbf12('0xf')][_0xbf12('0x11')]);return _0x4f6339(_0x3234cc[_0xbf12('0xf')][_0xbf12('0x11')]);}else{logger['info'](_0xbf12('0x10'),_0x3b43f9,_0xbf12('0xd'));_0x4f6339(_0x3234cc[_0xbf12('0x12')][_0xbf12('0x11')]);}})[_0xbf12('0x13')](function(_0xe5259b){logger['error'](_0xbf12('0x10'),_0x3b43f9,_0xe5259b);_0x3f4b3d(_0xe5259b);});});}exports[_0xbf12('0x14')]=function(_0x802e7d){var _0x4140ea=this;return new Promise(function(_0x9c775e,_0x11c7ac){return db[_0xbf12('0x15')][_0xbf12('0x16')]({'raw':_0x802e7d['options']?_0x802e7d[_0xbf12('0x17')][_0xbf12('0x18')]===undefined?!![]:![]:!![],'where':_0x802e7d['options']?_0x802e7d[_0xbf12('0x17')][_0xbf12('0x19')]||null:null,'attributes':_0x802e7d[_0xbf12('0x17')]?_0x802e7d[_0xbf12('0x17')][_0xbf12('0x1a')]||null:null,'limit':_0x802e7d[_0xbf12('0x17')]?_0x802e7d[_0xbf12('0x17')][_0xbf12('0x1b')]||null:null,'include':_0x802e7d['options']?_0x802e7d[_0xbf12('0x17')][_0xbf12('0x1c')]?_[_0xbf12('0x1d')](_0x802e7d['options'][_0xbf12('0x1c')],function(_0xd5a367){return{'model':db[_0xd5a367[_0xbf12('0x1e')]],'as':_0xd5a367['as'],'attributes':_0xd5a367[_0xbf12('0x1a')],'include':_0xd5a367['include']?_[_0xbf12('0x1d')](_0xd5a367[_0xbf12('0x1c')],function(_0x26ac3f){return{'model':db[_0x26ac3f['model']],'as':_0x26ac3f['as'],'attributes':_0x26ac3f[_0xbf12('0x1a')],'include':_0x26ac3f[_0xbf12('0x1c')]?_[_0xbf12('0x1d')](_0x26ac3f[_0xbf12('0x1c')],function(_0x182159){return{'model':db[_0x182159['model']],'as':_0x182159['as'],'attributes':_0x182159['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x44dba2){logger['info'](_0xbf12('0x14'),_0x802e7d);logger[_0xbf12('0xb')]('GetMailServerIn',_0x802e7d,JSON[_0xbf12('0xe')](_0x44dba2));_0x9c775e(_0x44dba2);})[_0xbf12('0x13')](function(_0x26ec14){logger[_0xbf12('0xf')](_0xbf12('0x14'),_0x26ec14[_0xbf12('0x11')],_0x802e7d);_0x11c7ac(_0x4140ea[_0xbf12('0xf')](0x1f4,_0x26ec14[_0xbf12('0x11')]));});});}; \ No newline at end of file +var _0x3d49=['stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include','model','map'];(function(_0x521d02,_0x55aba2){var _0x264558=function(_0x3d7d0c){while(--_0x3d7d0c){_0x521d02['push'](_0x521d02['shift']());}};_0x264558(++_0x55aba2);}(_0x3d49,0x14b));var _0x93d4=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x3d49[_0x433a86];return _0x23000c;};'use strict';var _=require('lodash');var util=require(_0x93d4('0x0'));var moment=require(_0x93d4('0x1'));var BPromise=require(_0x93d4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93d4('0x3'));var db=require(_0x93d4('0x4'))['db'];var utils=require(_0x93d4('0x5'));var logger=require(_0x93d4('0x6'))('rpc');var config=require(_0x93d4('0x7'));var jayson=require(_0x93d4('0x8'));var client=jayson[_0x93d4('0x9')][_0x93d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b9bb6,_0x3baf87,_0x2eaf9e){return new BPromise(function(_0x1017e5,_0x321733){return client[_0x93d4('0xb')](_0x2b9bb6,_0x2eaf9e)[_0x93d4('0xc')](function(_0x2a7d5f){logger[_0x93d4('0xd')](_0x93d4('0xe'),_0x3baf87,'request\x20sent');logger[_0x93d4('0xf')](_0x93d4('0x10'),_0x3baf87,'request\x20sent',JSON['stringify'](_0x2a7d5f));if(_0x2a7d5f[_0x93d4('0x11')]){if(_0x2a7d5f[_0x93d4('0x11')]['code']===0x1f4){logger[_0x93d4('0x11')](_0x93d4('0xe'),_0x3baf87,_0x2a7d5f[_0x93d4('0x11')]['message']);return _0x321733(_0x2a7d5f[_0x93d4('0x11')][_0x93d4('0x12')]);}logger[_0x93d4('0x11')](_0x93d4('0xe'),_0x3baf87,_0x2a7d5f[_0x93d4('0x11')][_0x93d4('0x12')]);return _0x1017e5(_0x2a7d5f[_0x93d4('0x11')][_0x93d4('0x12')]);}else{logger['info'](_0x93d4('0xe'),_0x3baf87,_0x93d4('0x13'));_0x1017e5(_0x2a7d5f[_0x93d4('0x14')]['message']);}})[_0x93d4('0x15')](function(_0x3e8d90){logger[_0x93d4('0x11')](_0x93d4('0xe'),_0x3baf87,_0x3e8d90);_0x321733(_0x3e8d90);});});}exports[_0x93d4('0x16')]=function(_0x3bcccc){var _0x5dc7c4=this;return new Promise(function(_0x2a52df,_0x35210a){return db[_0x93d4('0x17')][_0x93d4('0x18')]({'raw':_0x3bcccc[_0x93d4('0x19')]?_0x3bcccc[_0x93d4('0x19')][_0x93d4('0x1a')]===undefined?!![]:![]:!![],'where':_0x3bcccc['options']?_0x3bcccc[_0x93d4('0x19')][_0x93d4('0x1b')]||null:null,'attributes':_0x3bcccc[_0x93d4('0x19')]?_0x3bcccc[_0x93d4('0x19')][_0x93d4('0x1c')]||null:null,'limit':_0x3bcccc[_0x93d4('0x19')]?_0x3bcccc[_0x93d4('0x19')]['limit']||null:null,'include':_0x3bcccc[_0x93d4('0x19')]?_0x3bcccc[_0x93d4('0x19')]['include']?_['map'](_0x3bcccc[_0x93d4('0x19')][_0x93d4('0x1d')],function(_0x17051a){return{'model':db[_0x17051a[_0x93d4('0x1e')]],'as':_0x17051a['as'],'attributes':_0x17051a[_0x93d4('0x1c')],'include':_0x17051a['include']?_[_0x93d4('0x1f')](_0x17051a['include'],function(_0x450583){return{'model':db[_0x450583[_0x93d4('0x1e')]],'as':_0x450583['as'],'attributes':_0x450583[_0x93d4('0x1c')],'include':_0x450583[_0x93d4('0x1d')]?_[_0x93d4('0x1f')](_0x450583[_0x93d4('0x1d')],function(_0x5aff67){return{'model':db[_0x5aff67[_0x93d4('0x1e')]],'as':_0x5aff67['as'],'attributes':_0x5aff67[_0x93d4('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32cf06){logger['info'](_0x93d4('0x16'),_0x3bcccc);logger[_0x93d4('0xf')](_0x93d4('0x16'),_0x3bcccc,JSON[_0x93d4('0x20')](_0x32cf06));_0x2a52df(_0x32cf06);})[_0x93d4('0x15')](function(_0x5a598b){logger[_0x93d4('0x11')](_0x93d4('0x16'),_0x5a598b[_0x93d4('0x12')],_0x3bcccc);_0x35210a(_0x5dc7c4[_0x93d4('0x11')](0x1f4,_0x5a598b[_0x93d4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index c44dfe0..f65132f 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 _0x2ff9=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','path'];(function(_0x1e9d62,_0x25bb8e){var _0x56c490=function(_0x19f4e7){while(--_0x19f4e7){_0x1e9d62['push'](_0x1e9d62['shift']());}};_0x56c490(++_0x25bb8e);}(_0x2ff9,0xe9));var _0x92ff=function(_0xf8cf7,_0x118170){_0xf8cf7=_0xf8cf7-0x0;var _0xea73e6=_0x2ff9[_0xf8cf7];return _0xea73e6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x92ff('0x0'));var timeout=require(_0x92ff('0x1'));var express=require('express');var router=express[_0x92ff('0x2')]();var auth=require(_0x92ff('0x3'));var interaction=require(_0x92ff('0x4'));var config=require(_0x92ff('0x5'));var controller=require(_0x92ff('0x6'));router[_0x92ff('0x7')]('/',auth['isAuthenticated'](),controller[_0x92ff('0x8')]);router[_0x92ff('0x7')](_0x92ff('0x9'),auth[_0x92ff('0xa')](),controller[_0x92ff('0xb')]);router[_0x92ff('0xc')]('/',auth[_0x92ff('0xa')](),controller[_0x92ff('0xd')]);router[_0x92ff('0xe')](_0x92ff('0x9'),auth[_0x92ff('0xa')](),controller[_0x92ff('0xf')]);router[_0x92ff('0x10')](_0x92ff('0x9'),auth['isAuthenticated'](),controller[_0x92ff('0x11')]);module['exports']=router; \ No newline at end of file +var _0x17cc=['path','connect-timeout','express','Router','../../components/auth/service','./mailServerOut.controller','get','index','/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','multer'];(function(_0xad57ee,_0x2823a6){var _0x3eaea9=function(_0x185650){while(--_0x185650){_0xad57ee['push'](_0xad57ee['shift']());}};_0x3eaea9(++_0x2823a6);}(_0x17cc,0x19d));var _0xc17c=function(_0x316926,_0x32b9e7){_0x316926=_0x316926-0x0;var _0x124977=_0x17cc[_0x316926];return _0x124977;};'use strict';var multer=require(_0xc17c('0x0'));var util=require('util');var path=require(_0xc17c('0x1'));var timeout=require(_0xc17c('0x2'));var express=require(_0xc17c('0x3'));var router=express[_0xc17c('0x4')]();var auth=require(_0xc17c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc17c('0x6'));router[_0xc17c('0x7')]('/',auth['isAuthenticated'](),controller[_0xc17c('0x8')]);router[_0xc17c('0x7')](_0xc17c('0x9'),auth['isAuthenticated'](),controller[_0xc17c('0xa')]);router[_0xc17c('0xb')]('/',auth[_0xc17c('0xc')](),controller[_0xc17c('0xd')]);router[_0xc17c('0xe')](_0xc17c('0x9'),auth[_0xc17c('0xc')](),controller['update']);router[_0xc17c('0xf')](_0xc17c('0x9'),auth[_0xc17c('0xc')](),controller[_0xc17c('0x10')]);module[_0xc17c('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index e9f3a43..cd53920 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 _0x7f27=['STRING','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f27,0x12e));var _0x77f2=function(_0x136c99,_0x5512ff){_0x136c99=_0x136c99-0x0;var _0x565168=_0x7f27[_0x136c99];return _0x565168;};'use strict';var Sequelize=require(_0x77f2('0x0'));module[_0x77f2('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x77f2('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x77f2('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x77f2('0x2')]},'authentication':{'type':Sequelize[_0x77f2('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9a5a=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x9a5a,0x194));var _0xa9a5=function(_0x5c291c,_0x487dcc){_0x5c291c=_0x5c291c-0x0;var _0x379ab6=_0x9a5a[_0x5c291c];return _0x379ab6;};'use strict';var Sequelize=require(_0xa9a5('0x0'));module[_0xa9a5('0x1')]={'description':{'type':Sequelize[_0xa9a5('0x2')]},'host':{'type':Sequelize[_0xa9a5('0x2')]},'user':{'type':Sequelize[_0xa9a5('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xa9a5('0x3')]},'secure':{'type':Sequelize[_0xa9a5('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xa9a5('0x2')]},'authentication':{'type':Sequelize[_0xa9a5('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index e9b24b3..b2a5f03 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 _0x2add=['offset','status','set','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','MailServerOut','show','catch','create','body','find','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x2add,0x1bc));var _0xd2ad=function(_0x3e3577,_0x2bd5e8){_0x3e3577=_0x3e3577-0x0;var _0x4b30c7=_0x2add[_0x3e3577];return _0x4b30c7;};'use strict';var pdf=require(_0xd2ad('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd2ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd2ad('0x2'));var moment=require(_0xd2ad('0x3'));var BPromise=require(_0xd2ad('0x4'));var Mustache=require(_0xd2ad('0x5'));var util=require(_0xd2ad('0x6'));var path=require(_0xd2ad('0x7'));var sox=require('sox');var csv=require(_0xd2ad('0x8'));var ejs=require(_0xd2ad('0x9'));var fs=require('fs');var _=require(_0xd2ad('0xa'));var squel=require('squel');var crypto=require(_0xd2ad('0xb'));var jsforce=require(_0xd2ad('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd2ad('0xd'));var Redis=require('ioredis');var authService=require(_0xd2ad('0xe'));var qs=require(_0xd2ad('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd2ad('0x10'));var logger=require(_0xd2ad('0x11'))(_0xd2ad('0x12'));var utils=require(_0xd2ad('0x13'));var config=require(_0xd2ad('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d05e4,_0x49a6aa){_0x49a6aa=_0x49a6aa||0xcc;return function(_0x4f8da8){if(_0x4f8da8){return _0x4d05e4[_0xd2ad('0x15')](_0x49a6aa);}return _0x4d05e4['status'](_0x49a6aa)[_0xd2ad('0x16')]();};}function respondWithResult(_0x11b5bb,_0x10cbbb){_0x10cbbb=_0x10cbbb||0xc8;return function(_0x3c6952){if(_0x3c6952){return _0x11b5bb['status'](_0x10cbbb)[_0xd2ad('0x17')](_0x3c6952);}};}function respondWithFilteredResult(_0x5cc8ba,_0x37a0f8){return function(_0x38145e){if(_0x38145e){var _0x2e213f=_0x38145e[_0xd2ad('0x18')],_0x1dc6aa=_0x37a0f8['offset'],_0x465375=_0x37a0f8[_0xd2ad('0x19')]+_0x37a0f8['limit'],_0xf8aa18;if(_0x465375>=_0x2e213f){_0x465375=_0x2e213f;_0xf8aa18=0xc8;}else{_0xf8aa18=0xce;}_0x5cc8ba[_0xd2ad('0x1a')](_0xf8aa18);return _0x5cc8ba[_0xd2ad('0x1b')]('Content-Range',_0x1dc6aa+'-'+_0x465375+'/'+_0x2e213f)[_0xd2ad('0x17')](_0x38145e);}return null;};}function patchUpdates(_0x4964b9){return function(_0x5c25cb){try{jsonpatch[_0xd2ad('0x1c')](_0x5c25cb,_0x4964b9,!![]);}catch(_0x2dd2f2){return BPromise[_0xd2ad('0x1d')](_0x2dd2f2);}return _0x5c25cb[_0xd2ad('0x1e')]();};}function saveUpdates(_0x2e91b4,_0xb708c7){return function(_0x452bcc){if(_0x452bcc){return _0x452bcc[_0xd2ad('0x1f')](_0x2e91b4)[_0xd2ad('0x20')](function(_0x2f17cb){return _0x2f17cb;});}return null;};}function removeEntity(_0x2bc6eb,_0x5efeef){return function(_0x51082a){if(_0x51082a){return _0x51082a[_0xd2ad('0x21')]()[_0xd2ad('0x20')](function(){_0x2bc6eb[_0xd2ad('0x1a')](0xcc)[_0xd2ad('0x16')]();});}};}function handleEntityNotFound(_0x26de5b,_0x4ccd0a){return function(_0x881046){if(!_0x881046){_0x26de5b[_0xd2ad('0x15')](0x194);}return _0x881046;};}function handleError(_0x36aa08,_0x4b85ba){_0x4b85ba=_0x4b85ba||0x1f4;return function(_0x3db1af){logger['error'](_0x3db1af[_0xd2ad('0x22')]);if(_0x3db1af[_0xd2ad('0x23')]){delete _0x3db1af[_0xd2ad('0x23')];}_0x36aa08[_0xd2ad('0x1a')](_0x4b85ba)[_0xd2ad('0x24')](_0x3db1af);};}exports[_0xd2ad('0x25')]=function(_0x2547e4,_0x27ee33){var _0x40ecef={},_0x16c7a8={},_0x351229={'count':0x0,'rows':[]};var _0x351361=_['map'](db['MailServerOut'][_0xd2ad('0x26')],function(_0x185f5b){return{'name':_0x185f5b['fieldName'],'type':_0x185f5b[_0xd2ad('0x27')][_0xd2ad('0x28')]};});_0x16c7a8[_0xd2ad('0x29')]=_[_0xd2ad('0x2a')](_0x351361,_0xd2ad('0x23'));_0x16c7a8['query']=_[_0xd2ad('0x2b')](_0x2547e4[_0xd2ad('0x2c')]);_0x16c7a8[_0xd2ad('0x2d')]=_['intersection'](_0x16c7a8['model'],_0x16c7a8['query']);_0x40ecef[_0xd2ad('0x2e')]=_[_0xd2ad('0x2f')](_0x16c7a8['model'],qs['fields'](_0x2547e4[_0xd2ad('0x2c')][_0xd2ad('0x30')]));_0x40ecef[_0xd2ad('0x2e')]=_0x40ecef[_0xd2ad('0x2e')][_0xd2ad('0x31')]?_0x40ecef['attributes']:_0x16c7a8[_0xd2ad('0x29')];if(!_0x2547e4['query'][_0xd2ad('0x32')]('nolimit')){_0x40ecef[_0xd2ad('0x33')]=qs[_0xd2ad('0x33')](_0x2547e4['query']['limit']);_0x40ecef['offset']=qs['offset'](_0x2547e4[_0xd2ad('0x2c')][_0xd2ad('0x19')]);}_0x40ecef[_0xd2ad('0x34')]=qs[_0xd2ad('0x35')](_0x2547e4[_0xd2ad('0x2c')][_0xd2ad('0x35')]);_0x40ecef[_0xd2ad('0x36')]=qs[_0xd2ad('0x2d')](_[_0xd2ad('0x37')](_0x2547e4[_0xd2ad('0x2c')],_0x16c7a8[_0xd2ad('0x2d')]));if(_0x2547e4[_0xd2ad('0x2c')]['filter']){_0x40ecef[_0xd2ad('0x36')]=_['merge'](_0x40ecef['where'],{'$or':_[_0xd2ad('0x2a')](_0x351361,function(_0x212d55){if(_0x212d55['type']!==_0xd2ad('0x38')){var _0x52cb6a={};_0x52cb6a[_0x212d55[_0xd2ad('0x23')]]={'$like':'%'+_0x2547e4[_0xd2ad('0x2c')]['filter']+'%'};return _0x52cb6a;}})});}_0x40ecef=_[_0xd2ad('0x39')]({},_0x40ecef,_0x2547e4[_0xd2ad('0x3a')]);var _0x15ef28={'where':_0x40ecef[_0xd2ad('0x36')]};return db['MailServerOut'][_0xd2ad('0x18')](_0x15ef28)['then'](function(_0xdb1043){_0x351229[_0xd2ad('0x18')]=_0xdb1043;if(_0x2547e4['query'][_0xd2ad('0x3b')]){_0x40ecef[_0xd2ad('0x3c')]=[{'all':!![]}];}return db[_0xd2ad('0x3d')]['findAll'](_0x40ecef);})['then'](function(_0x10ccaa){_0x351229['rows']=_0x10ccaa;return _0x351229;})[_0xd2ad('0x20')](respondWithFilteredResult(_0x27ee33,_0x40ecef))['catch'](handleError(_0x27ee33,null));};exports[_0xd2ad('0x3e')]=function(_0x1c415a,_0x2841b7){var _0x2f359c={'raw':!![],'where':{'id':_0x1c415a['params']['id']}},_0x2fcb2c={};_0x2fcb2c[_0xd2ad('0x29')]=_[_0xd2ad('0x2b')](db[_0xd2ad('0x3d')]['rawAttributes']);_0x2fcb2c[_0xd2ad('0x2c')]=_[_0xd2ad('0x2b')](_0x1c415a[_0xd2ad('0x2c')]);_0x2fcb2c['filters']=_['intersection'](_0x2fcb2c[_0xd2ad('0x29')],_0x2fcb2c[_0xd2ad('0x2c')]);_0x2f359c[_0xd2ad('0x2e')]=_[_0xd2ad('0x2f')](_0x2fcb2c['model'],qs['fields'](_0x1c415a[_0xd2ad('0x2c')]['fields']));_0x2f359c[_0xd2ad('0x2e')]=_0x2f359c[_0xd2ad('0x2e')][_0xd2ad('0x31')]?_0x2f359c[_0xd2ad('0x2e')]:_0x2fcb2c[_0xd2ad('0x29')];if(_0x1c415a[_0xd2ad('0x2c')][_0xd2ad('0x3b')]){_0x2f359c['include']=[{'all':!![]}];}_0x2f359c=_[_0xd2ad('0x39')]({},_0x2f359c,_0x1c415a[_0xd2ad('0x3a')]);return db[_0xd2ad('0x3d')]['find'](_0x2f359c)[_0xd2ad('0x20')](handleEntityNotFound(_0x2841b7,null))['then'](respondWithResult(_0x2841b7,null))[_0xd2ad('0x3f')](handleError(_0x2841b7,null));};exports[_0xd2ad('0x40')]=function(_0x1d7e16,_0x2199c3){return db[_0xd2ad('0x3d')]['create'](_0x1d7e16[_0xd2ad('0x41')],{})['then'](respondWithResult(_0x2199c3,0xc9))[_0xd2ad('0x3f')](handleError(_0x2199c3,null));};exports[_0xd2ad('0x1f')]=function(_0x11d1a8,_0x2a6161){if(_0x11d1a8[_0xd2ad('0x41')]['id']){delete _0x11d1a8[_0xd2ad('0x41')]['id'];}return db[_0xd2ad('0x3d')]['find']({'where':{'id':_0x11d1a8['params']['id']}})['then'](handleEntityNotFound(_0x2a6161,null))[_0xd2ad('0x20')](saveUpdates(_0x11d1a8[_0xd2ad('0x41')],null))[_0xd2ad('0x20')](respondWithResult(_0x2a6161,null))[_0xd2ad('0x3f')](handleError(_0x2a6161,null));};exports['destroy']=function(_0x39365e,_0x39099a){return db['MailServerOut'][_0xd2ad('0x42')]({'where':{'id':_0x39365e['params']['id']}})['then'](handleEntityNotFound(_0x39099a,null))[_0xd2ad('0x20')](removeEntity(_0x39099a,null))['catch'](handleError(_0x39099a,null));}; \ No newline at end of file +var _0x6969=['length','limit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','keys','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','type','key','model','query','filters','intersection','fields','attributes'];(function(_0x9aad68,_0x45377){var _0x281340=function(_0x494ac1){while(--_0x494ac1){_0x9aad68['push'](_0x9aad68['shift']());}};_0x281340(++_0x45377);}(_0x6969,0xa1));var _0x9696=function(_0x975a5e,_0x5e53ef){_0x975a5e=_0x975a5e-0x0;var _0x43ee00=_0x6969[_0x975a5e];return _0x43ee00;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9696('0x0'));var rimraf=require(_0x9696('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9696('0x2'));var rp=require(_0x9696('0x3'));var moment=require(_0x9696('0x4'));var BPromise=require(_0x9696('0x5'));var Mustache=require(_0x9696('0x6'));var util=require('util');var path=require(_0x9696('0x7'));var sox=require(_0x9696('0x8'));var csv=require(_0x9696('0x9'));var ejs=require(_0x9696('0xa'));var fs=require('fs');var _=require(_0x9696('0xb'));var squel=require(_0x9696('0xc'));var crypto=require(_0x9696('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9696('0x9'));var querystring=require(_0x9696('0xe'));var Papa=require(_0x9696('0xf'));var Redis=require(_0x9696('0x10'));var authService=require(_0x9696('0x11'));var qs=require(_0x9696('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9696('0x13'));var logger=require(_0x9696('0x14'))(_0x9696('0x15'));var utils=require(_0x9696('0x16'));var config=require('../../config/environment');var db=require(_0x9696('0x17'))['db'];function respondWithStatusCode(_0x167b23,_0x5871c4){_0x5871c4=_0x5871c4||0xcc;return function(_0x560550){if(_0x560550){return _0x167b23[_0x9696('0x18')](_0x5871c4);}return _0x167b23[_0x9696('0x19')](_0x5871c4)[_0x9696('0x1a')]();};}function respondWithResult(_0x31c7ea,_0x5dcaa7){_0x5dcaa7=_0x5dcaa7||0xc8;return function(_0x357838){if(_0x357838){return _0x31c7ea[_0x9696('0x19')](_0x5dcaa7)['json'](_0x357838);}};}function respondWithFilteredResult(_0x5e4d50,_0x4936ab){return function(_0x1eef7e){if(_0x1eef7e){var _0x17873c=_0x1eef7e['count'],_0x1b3b70=_0x4936ab[_0x9696('0x1b')],_0x40b91a=_0x4936ab[_0x9696('0x1b')]+_0x4936ab['limit'],_0x3b97f4;if(_0x40b91a>=_0x17873c){_0x40b91a=_0x17873c;_0x3b97f4=0xc8;}else{_0x3b97f4=0xce;}_0x5e4d50['status'](_0x3b97f4);return _0x5e4d50[_0x9696('0x1c')](_0x9696('0x1d'),_0x1b3b70+'-'+_0x40b91a+'/'+_0x17873c)['json'](_0x1eef7e);}return null;};}function patchUpdates(_0x2bbe13){return function(_0x3ecf00){try{jsonpatch[_0x9696('0x1e')](_0x3ecf00,_0x2bbe13,!![]);}catch(_0x17186f){return BPromise[_0x9696('0x1f')](_0x17186f);}return _0x3ecf00[_0x9696('0x20')]();};}function saveUpdates(_0x3e3465,_0x2d89e8){return function(_0x3b058c){if(_0x3b058c){return _0x3b058c[_0x9696('0x21')](_0x3e3465)[_0x9696('0x22')](function(_0x592489){return _0x592489;});}return null;};}function removeEntity(_0x1dc865,_0xecd907){return function(_0x55a1af){if(_0x55a1af){return _0x55a1af[_0x9696('0x23')]()[_0x9696('0x22')](function(){_0x1dc865[_0x9696('0x19')](0xcc)[_0x9696('0x1a')]();});}};}function handleEntityNotFound(_0x3c6ff8,_0x322223){return function(_0x21e6f3){if(!_0x21e6f3){_0x3c6ff8[_0x9696('0x18')](0x194);}return _0x21e6f3;};}function handleError(_0x40a67c,_0x5c5130){_0x5c5130=_0x5c5130||0x1f4;return function(_0x433664){logger[_0x9696('0x24')](_0x433664[_0x9696('0x25')]);if(_0x433664['name']){delete _0x433664[_0x9696('0x26')];}_0x40a67c[_0x9696('0x19')](_0x5c5130)[_0x9696('0x27')](_0x433664);};}exports[_0x9696('0x28')]=function(_0x232a6a,_0x309b36){var _0x1385d3={},_0x2423d7={},_0x37e253={'count':0x0,'rows':[]};var _0x1132e2=_[_0x9696('0x29')](db[_0x9696('0x2a')][_0x9696('0x2b')],function(_0x2ee9a3){return{'name':_0x2ee9a3['fieldName'],'type':_0x2ee9a3[_0x9696('0x2c')][_0x9696('0x2d')]};});_0x2423d7[_0x9696('0x2e')]=_[_0x9696('0x29')](_0x1132e2,'name');_0x2423d7[_0x9696('0x2f')]=_['keys'](_0x232a6a[_0x9696('0x2f')]);_0x2423d7[_0x9696('0x30')]=_[_0x9696('0x31')](_0x2423d7[_0x9696('0x2e')],_0x2423d7[_0x9696('0x2f')]);_0x1385d3['attributes']=_[_0x9696('0x31')](_0x2423d7[_0x9696('0x2e')],qs['fields'](_0x232a6a[_0x9696('0x2f')][_0x9696('0x32')]));_0x1385d3[_0x9696('0x33')]=_0x1385d3['attributes'][_0x9696('0x34')]?_0x1385d3[_0x9696('0x33')]:_0x2423d7['model'];if(!_0x232a6a[_0x9696('0x2f')]['hasOwnProperty']('nolimit')){_0x1385d3['limit']=qs[_0x9696('0x35')](_0x232a6a[_0x9696('0x2f')][_0x9696('0x35')]);_0x1385d3[_0x9696('0x1b')]=qs[_0x9696('0x1b')](_0x232a6a[_0x9696('0x2f')][_0x9696('0x1b')]);}_0x1385d3['order']=qs[_0x9696('0x36')](_0x232a6a[_0x9696('0x2f')][_0x9696('0x36')]);_0x1385d3[_0x9696('0x37')]=qs[_0x9696('0x30')](_['pick'](_0x232a6a['query'],_0x2423d7[_0x9696('0x30')]));if(_0x232a6a[_0x9696('0x2f')][_0x9696('0x38')]){_0x1385d3[_0x9696('0x37')]=_[_0x9696('0x39')](_0x1385d3['where'],{'$or':_[_0x9696('0x29')](_0x1132e2,function(_0xb31bed){if(_0xb31bed['type']!==_0x9696('0x3a')){var _0x339703={};_0x339703[_0xb31bed['name']]={'$like':'%'+_0x232a6a['query']['filter']+'%'};return _0x339703;}})});}_0x1385d3=_[_0x9696('0x39')]({},_0x1385d3,_0x232a6a[_0x9696('0x3b')]);var _0x30b666={'where':_0x1385d3[_0x9696('0x37')]};return db['MailServerOut'][_0x9696('0x3c')](_0x30b666)[_0x9696('0x22')](function(_0x235eab){_0x37e253['count']=_0x235eab;if(_0x232a6a[_0x9696('0x2f')][_0x9696('0x3d')]){_0x1385d3[_0x9696('0x3e')]=[{'all':!![]}];}return db[_0x9696('0x2a')][_0x9696('0x3f')](_0x1385d3);})[_0x9696('0x22')](function(_0x54ef2a){_0x37e253['rows']=_0x54ef2a;return _0x37e253;})['then'](respondWithFilteredResult(_0x309b36,_0x1385d3))[_0x9696('0x40')](handleError(_0x309b36,null));};exports[_0x9696('0x41')]=function(_0x2af2ee,_0x338045){var _0x862755={'raw':!![],'where':{'id':_0x2af2ee['params']['id']}},_0x1f2127={};_0x1f2127['model']=_[_0x9696('0x42')](db[_0x9696('0x2a')][_0x9696('0x2b')]);_0x1f2127[_0x9696('0x2f')]=_[_0x9696('0x42')](_0x2af2ee[_0x9696('0x2f')]);_0x1f2127[_0x9696('0x30')]=_[_0x9696('0x31')](_0x1f2127[_0x9696('0x2e')],_0x1f2127[_0x9696('0x2f')]);_0x862755[_0x9696('0x33')]=_[_0x9696('0x31')](_0x1f2127[_0x9696('0x2e')],qs['fields'](_0x2af2ee[_0x9696('0x2f')]['fields']));_0x862755[_0x9696('0x33')]=_0x862755[_0x9696('0x33')][_0x9696('0x34')]?_0x862755[_0x9696('0x33')]:_0x1f2127[_0x9696('0x2e')];if(_0x2af2ee[_0x9696('0x2f')]['includeAll']){_0x862755[_0x9696('0x3e')]=[{'all':!![]}];}_0x862755=_[_0x9696('0x39')]({},_0x862755,_0x2af2ee[_0x9696('0x3b')]);return db['MailServerOut']['find'](_0x862755)[_0x9696('0x22')](handleEntityNotFound(_0x338045,null))[_0x9696('0x22')](respondWithResult(_0x338045,null))['catch'](handleError(_0x338045,null));};exports[_0x9696('0x43')]=function(_0x72a3ea,_0x5e34e2){return db[_0x9696('0x2a')][_0x9696('0x43')](_0x72a3ea[_0x9696('0x44')],{})['then'](respondWithResult(_0x5e34e2,0xc9))[_0x9696('0x40')](handleError(_0x5e34e2,null));};exports[_0x9696('0x21')]=function(_0x3637fb,_0x4544d1){if(_0x3637fb['body']['id']){delete _0x3637fb[_0x9696('0x44')]['id'];}return db[_0x9696('0x2a')][_0x9696('0x45')]({'where':{'id':_0x3637fb[_0x9696('0x46')]['id']}})['then'](handleEntityNotFound(_0x4544d1,null))[_0x9696('0x22')](saveUpdates(_0x3637fb[_0x9696('0x44')],null))[_0x9696('0x22')](respondWithResult(_0x4544d1,null))['catch'](handleError(_0x4544d1,null));};exports[_0x9696('0x23')]=function(_0x123ace,_0xded826){return db[_0x9696('0x2a')][_0x9696('0x45')]({'where':{'id':_0x123ace[_0x9696('0x46')]['id']}})[_0x9696('0x22')](handleEntityNotFound(_0xded826,null))[_0x9696('0x22')](removeEntity(_0xded826,null))[_0x9696('0x40')](handleError(_0xded826,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 32cb2f8..0bd4f67 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 _0x7da7=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','mail_servers_out','lodash'];(function(_0x4606a5,_0x3d280c){var _0x2a4bac=function(_0x550651){while(--_0x550651){_0x4606a5['push'](_0x4606a5['shift']());}};_0x2a4bac(++_0x3d280c);}(_0x7da7,0x10d));var _0x77da=function(_0x11b58d,_0x555c55){_0x11b58d=_0x11b58d-0x0;var _0xc2811b=_0x7da7[_0x11b58d];return _0xc2811b;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77da('0x3'));var rp=require(_0x77da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var attributes=require('./mailServerOut.attributes');module[_0x77da('0x7')]=function(_0xc54a12,_0x47da81){return _0xc54a12[_0x77da('0x8')]('MailServerOut',attributes,{'tableName':_0x77da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['mail_servers_out','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x18fadf,_0x126b46){var _0x190f82=function(_0x4e95a5){while(--_0x4e95a5){_0x18fadf['push'](_0x18fadf['shift']());}};_0x190f82(++_0x126b46);}(_0x326f,0xd1));var _0xf326=function(_0x73cf0a,_0x12eab2){_0x73cf0a=_0x73cf0a-0x0;var _0x582e70=_0x326f[_0x73cf0a];return _0x582e70;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 5e0a99c..88b4c8d 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 _0x59ab=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailServerOut,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x27716a,_0x2d13ec){var _0x32e4eb=function(_0x5ddaf7){while(--_0x5ddaf7){_0x27716a['push'](_0x27716a['shift']());}};_0x32e4eb(++_0x2d13ec);}(_0x59ab,0x137));var _0xb59a=function(_0x11f12d,_0x4a2fe5){_0x11f12d=_0x11f12d-0x0;var _0x3c720b=_0x59ab[_0x11f12d];return _0x3c720b;};'use strict';var _=require(_0xb59a('0x0'));var util=require(_0xb59a('0x1'));var moment=require(_0xb59a('0x2'));var BPromise=require(_0xb59a('0x3'));var rs=require(_0xb59a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb59a('0x5'))['db'];var utils=require(_0xb59a('0x6'));var logger=require(_0xb59a('0x7'))(_0xb59a('0x8'));var config=require(_0xb59a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb59a('0xa')][_0xb59a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2312cf,_0x27c351,_0x5263e4){return new BPromise(function(_0x22951b,_0x4f0c94){return client[_0xb59a('0xc')](_0x2312cf,_0x5263e4)[_0xb59a('0xd')](function(_0xc6b835){logger[_0xb59a('0xe')]('MailServerOut,\x20%s,\x20%s',_0x27c351,'request\x20sent');logger['debug'](_0xb59a('0xf'),_0x27c351,_0xb59a('0x10'),JSON[_0xb59a('0x11')](_0xc6b835));if(_0xc6b835['error']){if(_0xc6b835[_0xb59a('0x12')][_0xb59a('0x13')]===0x1f4){logger[_0xb59a('0x12')](_0xb59a('0x14'),_0x27c351,_0xc6b835[_0xb59a('0x12')]['message']);return _0x4f0c94(_0xc6b835['error'][_0xb59a('0x15')]);}logger[_0xb59a('0x12')](_0xb59a('0x14'),_0x27c351,_0xc6b835[_0xb59a('0x12')]['message']);return _0x22951b(_0xc6b835[_0xb59a('0x12')][_0xb59a('0x15')]);}else{logger[_0xb59a('0xe')]('MailServerOut,\x20%s,\x20%s',_0x27c351,_0xb59a('0x10'));_0x22951b(_0xc6b835[_0xb59a('0x16')][_0xb59a('0x15')]);}})[_0xb59a('0x17')](function(_0x3e8ef4){logger[_0xb59a('0x12')](_0xb59a('0x14'),_0x27c351,_0x3e8ef4);_0x4f0c94(_0x3e8ef4);});});} \ No newline at end of file +var _0x16de=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerOut,\x20%s,\x20%s','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x16de,0x7a));var _0xe16d=function(_0x2d07fd,_0xdcf44b){_0x2d07fd=_0x2d07fd-0x0;var _0x3f7fe3=_0x16de[_0x2d07fd];return _0x3f7fe3;};'use strict';var _=require(_0xe16d('0x0'));var util=require(_0xe16d('0x1'));var moment=require(_0xe16d('0x2'));var BPromise=require(_0xe16d('0x3'));var rs=require(_0xe16d('0x4'));var fs=require('fs');var Redis=require(_0xe16d('0x5'));var db=require(_0xe16d('0x6'))['db'];var utils=require(_0xe16d('0x7'));var logger=require('../../config/logger')(_0xe16d('0x8'));var config=require(_0xe16d('0x9'));var jayson=require(_0xe16d('0xa'));var client=jayson['client'][_0xe16d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x522028,_0x727220,_0x31bc2c){return new BPromise(function(_0x48c89b,_0x379ce4){return client[_0xe16d('0xc')](_0x522028,_0x31bc2c)['then'](function(_0x51e186){logger[_0xe16d('0xd')]('MailServerOut,\x20%s,\x20%s',_0x727220,_0xe16d('0xe'));logger[_0xe16d('0xf')](_0xe16d('0x10'),_0x727220,_0xe16d('0xe'),JSON[_0xe16d('0x11')](_0x51e186));if(_0x51e186[_0xe16d('0x12')]){if(_0x51e186[_0xe16d('0x12')][_0xe16d('0x13')]===0x1f4){logger[_0xe16d('0x12')](_0xe16d('0x14'),_0x727220,_0x51e186['error'][_0xe16d('0x15')]);return _0x379ce4(_0x51e186[_0xe16d('0x12')][_0xe16d('0x15')]);}logger[_0xe16d('0x12')](_0xe16d('0x14'),_0x727220,_0x51e186[_0xe16d('0x12')][_0xe16d('0x15')]);return _0x48c89b(_0x51e186[_0xe16d('0x12')][_0xe16d('0x15')]);}else{logger[_0xe16d('0xd')](_0xe16d('0x14'),_0x727220,_0xe16d('0xe'));_0x48c89b(_0x51e186[_0xe16d('0x16')][_0xe16d('0x15')]);}})[_0xe16d('0x17')](function(_0x3903e4){logger[_0xe16d('0x12')](_0xe16d('0x14'),_0x727220,_0x3903e4);_0x379ce4(_0x3903e4);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 6e201fd..2100e8d 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 _0xcebd=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','index','/describe','isAuthenticated','/:id','show','post'];(function(_0x2fa167,_0x5a76e9){var _0x759825=function(_0x5432ad){while(--_0x5432ad){_0x2fa167['push'](_0x2fa167['shift']());}};_0x759825(++_0x5a76e9);}(_0xcebd,0xc3));var _0xdceb=function(_0x56dad2,_0x1e1050){_0x56dad2=_0x56dad2-0x0;var _0xe649d2=_0xcebd[_0x56dad2];return _0xe649d2;};'use strict';var multer=require(_0xdceb('0x0'));var util=require(_0xdceb('0x1'));var path=require(_0xdceb('0x2'));var timeout=require(_0xdceb('0x3'));var express=require('express');var router=express[_0xdceb('0x4')]();var auth=require(_0xdceb('0x5'));var interaction=require(_0xdceb('0x6'));var config=require('../../config/environment');var controller=require(_0xdceb('0x7'));router[_0xdceb('0x8')]('/',auth['isAuthenticated'](),controller[_0xdceb('0x9')]);router[_0xdceb('0x8')](_0xdceb('0xa'),auth[_0xdceb('0xb')](),controller['describe']);router['get'](_0xdceb('0xc'),auth[_0xdceb('0xb')](),controller[_0xdceb('0xd')]);router[_0xdceb('0xe')]('/',auth[_0xdceb('0xb')](),controller[_0xdceb('0xf')]);router[_0xdceb('0x10')](_0xdceb('0xc'),auth[_0xdceb('0xb')](),controller[_0xdceb('0x11')]);router[_0xdceb('0x12')](_0xdceb('0xc'),auth[_0xdceb('0xb')](),controller[_0xdceb('0x13')]);module[_0xdceb('0x14')]=router; \ No newline at end of file +var _0x287e=['./mailSubstatus.controller','isAuthenticated','index','get','/describe','describe','post','create','put','/:id','update','delete','util','path','express','../../components/auth/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x287e,0x1d7));var _0xe287=function(_0x38e923,_0x5cd84a){_0x38e923=_0x38e923-0x0;var _0x1381cf=_0x287e[_0x38e923];return _0x1381cf;};'use strict';var multer=require('multer');var util=require(_0xe287('0x0'));var path=require(_0xe287('0x1'));var timeout=require('connect-timeout');var express=require(_0xe287('0x2'));var router=express['Router']();var auth=require(_0xe287('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe287('0x4'));var controller=require(_0xe287('0x5'));router['get']('/',auth[_0xe287('0x6')](),controller[_0xe287('0x7')]);router[_0xe287('0x8')](_0xe287('0x9'),auth['isAuthenticated'](),controller[_0xe287('0xa')]);router[_0xe287('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe287('0xb')]('/',auth[_0xe287('0x6')](),controller[_0xe287('0xc')]);router[_0xe287('0xd')](_0xe287('0xe'),auth[_0xe287('0x6')](),controller[_0xe287('0xf')]);router[_0xe287('0x10')](_0xe287('0xe'),auth[_0xe287('0x6')](),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 a24ade4..98fc6bc 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 _0xa5c9=['exports','STRING','name','sequelize'];(function(_0xe33eca,_0x332ee5){var _0x2184d6=function(_0x49d39a){while(--_0x49d39a){_0xe33eca['push'](_0xe33eca['shift']());}};_0x2184d6(++_0x332ee5);}(_0xa5c9,0x143));var _0x9a5c=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0xa5c9[_0x2bcb75];return _0x175345;};'use strict';var Sequelize=require(_0x9a5c('0x0'));module[_0x9a5c('0x1')]={'name':{'type':Sequelize[_0x9a5c('0x2')],'unique':_0x9a5c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x32f4=['sequelize','exports','STRING','name'];(function(_0x1a8ff0,_0x20788d){var _0x3588bf=function(_0x3b5499){while(--_0x3b5499){_0x1a8ff0['push'](_0x1a8ff0['shift']());}};_0x3588bf(++_0x20788d);}(_0x32f4,0x154));var _0x432f=function(_0x592a80,_0x537c3e){_0x592a80=_0x592a80-0x0;var _0x4f56fe=_0x32f4[_0x592a80];return _0x4f56fe;};'use strict';var Sequelize=require(_0x432f('0x0'));module[_0x432f('0x1')]={'name':{'type':Sequelize[_0x432f('0x2')],'unique':_0x432f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 22b4d21..dfd486a 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 _0x4975=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','MailSubstatus','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x55361f,_0x31f4d1){var _0x4417f7=function(_0x525427){while(--_0x525427){_0x55361f['push'](_0x55361f['shift']());}};_0x4417f7(++_0x31f4d1);}(_0x4975,0x86));var _0x5497=function(_0x2bbfe9,_0x2d3703){_0x2bbfe9=_0x2bbfe9-0x0;var _0x6cb365=_0x4975[_0x2bbfe9];return _0x6cb365;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc250bb,_0x1b23df){_0x1b23df=_0x1b23df||0xcc;return function(_0x1bb794){if(_0x1bb794){return _0xc250bb[_0x5497('0x18')](_0x1b23df);}return _0xc250bb[_0x5497('0x19')](_0x1b23df)[_0x5497('0x1a')]();};}function respondWithResult(_0x1f7169,_0xaca97d){_0xaca97d=_0xaca97d||0xc8;return function(_0x363a5b){if(_0x363a5b){return _0x1f7169[_0x5497('0x19')](_0xaca97d)['json'](_0x363a5b);}};}function respondWithFilteredResult(_0x11b0a9,_0x4fb8e9){return function(_0x4237a9){if(_0x4237a9){var _0x2bfd8a=_0x4237a9[_0x5497('0x1b')],_0x19e5f3=_0x4fb8e9[_0x5497('0x1c')],_0x3ce50b=_0x4fb8e9['offset']+_0x4fb8e9['limit'],_0x37c18e;if(_0x3ce50b>=_0x2bfd8a){_0x3ce50b=_0x2bfd8a;_0x37c18e=0xc8;}else{_0x37c18e=0xce;}_0x11b0a9[_0x5497('0x19')](_0x37c18e);return _0x11b0a9[_0x5497('0x1d')](_0x5497('0x1e'),_0x19e5f3+'-'+_0x3ce50b+'/'+_0x2bfd8a)['json'](_0x4237a9);}return null;};}function patchUpdates(_0xbf1ba7){return function(_0xcbd71d){try{jsonpatch[_0x5497('0x1f')](_0xcbd71d,_0xbf1ba7,!![]);}catch(_0x43da2c){return BPromise[_0x5497('0x20')](_0x43da2c);}return _0xcbd71d[_0x5497('0x21')]();};}function saveUpdates(_0x16d378,_0x10226f){return function(_0x2e3960){if(_0x2e3960){return _0x2e3960[_0x5497('0x22')](_0x16d378)[_0x5497('0x23')](function(_0x52c049){return _0x52c049;});}return null;};}function removeEntity(_0x720767,_0x4d1b27){return function(_0x19200a){if(_0x19200a){return _0x19200a[_0x5497('0x24')]()[_0x5497('0x23')](function(){_0x720767[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(!_0x54043a){_0x3b2fbc[_0x5497('0x18')](0x194);}return _0x54043a;};}function handleError(_0x34b97f,_0x24482a){_0x24482a=_0x24482a||0x1f4;return function(_0x281155){logger['error'](_0x281155[_0x5497('0x25')]);if(_0x281155['name']){delete _0x281155[_0x5497('0x26')];}_0x34b97f[_0x5497('0x19')](_0x24482a)[_0x5497('0x27')](_0x281155);};}exports[_0x5497('0x28')]=function(_0x163a30,_0x31cd01){var _0x48b835={},_0x4af5f4={},_0x5406e2={'count':0x0,'rows':[]};var _0x583d06=_['map'](db[_0x5497('0x29')]['rawAttributes'],function(_0x5e9356){return{'name':_0x5e9356[_0x5497('0x2a')],'type':_0x5e9356[_0x5497('0x2b')][_0x5497('0x2c')]};});_0x4af5f4['model']=_['map'](_0x583d06,'name');_0x4af5f4[_0x5497('0x2d')]=_[_0x5497('0x2e')](_0x163a30[_0x5497('0x2d')]);_0x4af5f4['filters']=_['intersection'](_0x4af5f4['model'],_0x4af5f4[_0x5497('0x2d')]);_0x48b835['attributes']=_[_0x5497('0x2f')](_0x4af5f4[_0x5497('0x30')],qs[_0x5497('0x31')](_0x163a30['query'][_0x5497('0x31')]));_0x48b835[_0x5497('0x32')]=_0x48b835['attributes'][_0x5497('0x33')]?_0x48b835[_0x5497('0x32')]:_0x4af5f4[_0x5497('0x30')];if(!_0x163a30['query'][_0x5497('0x34')](_0x5497('0x35'))){_0x48b835[_0x5497('0x36')]=qs[_0x5497('0x36')](_0x163a30[_0x5497('0x2d')]['limit']);_0x48b835[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x163a30['query'][_0x5497('0x1c')]);}_0x48b835[_0x5497('0x37')]=qs[_0x5497('0x38')](_0x163a30[_0x5497('0x2d')][_0x5497('0x38')]);_0x48b835[_0x5497('0x39')]=qs['filters'](_[_0x5497('0x3a')](_0x163a30['query'],_0x4af5f4[_0x5497('0x3b')]));if(_0x163a30[_0x5497('0x2d')][_0x5497('0x3c')]){_0x48b835['where']=_['merge'](_0x48b835[_0x5497('0x39')],{'$or':_[_0x5497('0x3d')](_0x583d06,function(_0x326d48){if(_0x326d48[_0x5497('0x2b')]!==_0x5497('0x3e')){var _0xc8a689={};_0xc8a689[_0x326d48['name']]={'$like':'%'+_0x163a30[_0x5497('0x2d')][_0x5497('0x3c')]+'%'};return _0xc8a689;}})});}_0x48b835=_[_0x5497('0x3f')]({},_0x48b835,_0x163a30[_0x5497('0x40')]);var _0x275aa7={'where':_0x48b835[_0x5497('0x39')]};return db[_0x5497('0x29')][_0x5497('0x1b')](_0x275aa7)[_0x5497('0x23')](function(_0x544065){_0x5406e2[_0x5497('0x1b')]=_0x544065;if(_0x163a30[_0x5497('0x2d')][_0x5497('0x41')]){_0x48b835[_0x5497('0x42')]=[{'all':!![]}];}return db[_0x5497('0x29')][_0x5497('0x43')](_0x48b835);})[_0x5497('0x23')](function(_0x59ed13){_0x5406e2[_0x5497('0x44')]=_0x59ed13;return _0x5406e2;})[_0x5497('0x23')](respondWithFilteredResult(_0x31cd01,_0x48b835))[_0x5497('0x45')](handleError(_0x31cd01,null));};exports[_0x5497('0x46')]=function(_0x1b251b,_0x125526){var _0x114471={'raw':!![],'where':{'id':_0x1b251b[_0x5497('0x47')]['id']}},_0x547437={};_0x547437[_0x5497('0x30')]=_[_0x5497('0x2e')](db[_0x5497('0x29')][_0x5497('0x48')]);_0x547437[_0x5497('0x2d')]=_[_0x5497('0x2e')](_0x1b251b[_0x5497('0x2d')]);_0x547437[_0x5497('0x3b')]=_[_0x5497('0x2f')](_0x547437['model'],_0x547437[_0x5497('0x2d')]);_0x114471['attributes']=_[_0x5497('0x2f')](_0x547437[_0x5497('0x30')],qs[_0x5497('0x31')](_0x1b251b[_0x5497('0x2d')][_0x5497('0x31')]));_0x114471['attributes']=_0x114471[_0x5497('0x32')][_0x5497('0x33')]?_0x114471['attributes']:_0x547437[_0x5497('0x30')];if(_0x1b251b['query'][_0x5497('0x41')]){_0x114471['include']=[{'all':!![]}];}_0x114471=_[_0x5497('0x3f')]({},_0x114471,_0x1b251b[_0x5497('0x40')]);return db[_0x5497('0x29')][_0x5497('0x49')](_0x114471)[_0x5497('0x23')](handleEntityNotFound(_0x125526,null))['then'](respondWithResult(_0x125526,null))['catch'](handleError(_0x125526,null));};exports['create']=function(_0x55f654,_0x3cbe4b){return db[_0x5497('0x29')][_0x5497('0x4a')](_0x55f654[_0x5497('0x4b')],{})[_0x5497('0x23')](respondWithResult(_0x3cbe4b,0xc9))[_0x5497('0x45')](handleError(_0x3cbe4b,null));};exports[_0x5497('0x22')]=function(_0x466287,_0x2626bf){if(_0x466287['body']['id']){delete _0x466287[_0x5497('0x4b')]['id'];}return db[_0x5497('0x29')][_0x5497('0x49')]({'where':{'id':_0x466287['params']['id']}})[_0x5497('0x23')](handleEntityNotFound(_0x2626bf,null))['then'](saveUpdates(_0x466287[_0x5497('0x4b')],null))[_0x5497('0x23')](respondWithResult(_0x2626bf,null))[_0x5497('0x45')](handleError(_0x2626bf,null));};exports['destroy']=function(_0x43bebe,_0x356d61){return db['MailSubstatus'][_0x5497('0x49')]({'where':{'id':_0x43bebe['params']['id']}})[_0x5497('0x23')](handleEntityNotFound(_0x356d61,null))['then'](removeEntity(_0x356d61,null))[_0x5497('0x45')](handleError(_0x356d61,null));};exports[_0x5497('0x4c')]=function(_0x26fd9f,_0xf07541){return db[_0x5497('0x29')][_0x5497('0x4c')]()[_0x5497('0x23')](respondWithResult(_0xf07541,null))[_0x5497('0x45')](handleError(_0xf07541,null));}; \ No newline at end of file +var _0x9c5a=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','create','body','find','describe','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','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','MailSubstatus','rawAttributes','fieldName','type','model','query'];(function(_0x168466,_0x5f37e5){var _0xcf8a4=function(_0x48cf99){while(--_0x48cf99){_0x168466['push'](_0x168466['shift']());}};_0xcf8a4(++_0x5f37e5);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x2b7490,_0x2ac8a0){_0x2b7490=_0x2b7490-0x0;var _0x20de17=_0x9c5a[_0x2b7490];return _0x20de17;};'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 db=require(_0xa9c5('0x15'))['db'];function respondWithStatusCode(_0x4492a4,_0x51c8d){_0x51c8d=_0x51c8d||0xcc;return function(_0x42d5cf){if(_0x42d5cf){return _0x4492a4[_0xa9c5('0x16')](_0x51c8d);}return _0x4492a4[_0xa9c5('0x17')](_0x51c8d)['end']();};}function respondWithResult(_0x390ca2,_0x1276d2){_0x1276d2=_0x1276d2||0xc8;return function(_0x7df76d){if(_0x7df76d){return _0x390ca2[_0xa9c5('0x17')](_0x1276d2)[_0xa9c5('0x18')](_0x7df76d);}};}function respondWithFilteredResult(_0x1dad66,_0x251099){return function(_0x40b001){if(_0x40b001){var _0x19a43e=_0x40b001[_0xa9c5('0x19')],_0xcf13f2=_0x251099[_0xa9c5('0x1a')],_0x4bb57e=_0x251099['offset']+_0x251099[_0xa9c5('0x1b')],_0x2b0d73;if(_0x4bb57e>=_0x19a43e){_0x4bb57e=_0x19a43e;_0x2b0d73=0xc8;}else{_0x2b0d73=0xce;}_0x1dad66[_0xa9c5('0x17')](_0x2b0d73);return _0x1dad66[_0xa9c5('0x1c')](_0xa9c5('0x1d'),_0xcf13f2+'-'+_0x4bb57e+'/'+_0x19a43e)[_0xa9c5('0x18')](_0x40b001);}return null;};}function patchUpdates(_0x349f27){return function(_0x3b8d4d){try{jsonpatch[_0xa9c5('0x1e')](_0x3b8d4d,_0x349f27,!![]);}catch(_0x2c7cd5){return BPromise[_0xa9c5('0x1f')](_0x2c7cd5);}return _0x3b8d4d[_0xa9c5('0x20')]();};}function saveUpdates(_0x2d95f8,_0x54f8b9){return function(_0x1115ad){if(_0x1115ad){return _0x1115ad[_0xa9c5('0x21')](_0x2d95f8)['then'](function(_0x5d2115){return _0x5d2115;});}return null;};}function removeEntity(_0xce9af6,_0x366f5c){return function(_0x10b208){if(_0x10b208){return _0x10b208[_0xa9c5('0x22')]()[_0xa9c5('0x23')](function(){_0xce9af6[_0xa9c5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(!_0x11d395){_0x4fa280['sendStatus'](0x194);}return _0x11d395;};}function handleError(_0x6819b3,_0x424b4c){_0x424b4c=_0x424b4c||0x1f4;return function(_0x306c9b){logger[_0xa9c5('0x24')](_0x306c9b[_0xa9c5('0x25')]);if(_0x306c9b[_0xa9c5('0x26')]){delete _0x306c9b[_0xa9c5('0x26')];}_0x6819b3['status'](_0x424b4c)['send'](_0x306c9b);};}exports[_0xa9c5('0x27')]=function(_0x4cd5e6,_0x1762ac){var _0x830bad={},_0x4caefa={},_0x11a723={'count':0x0,'rows':[]};var _0x320dc0=_['map'](db[_0xa9c5('0x28')][_0xa9c5('0x29')],function(_0x198cdf){return{'name':_0x198cdf[_0xa9c5('0x2a')],'type':_0x198cdf[_0xa9c5('0x2b')]['key']};});_0x4caefa[_0xa9c5('0x2c')]=_['map'](_0x320dc0,_0xa9c5('0x26'));_0x4caefa[_0xa9c5('0x2d')]=_[_0xa9c5('0x2e')](_0x4cd5e6['query']);_0x4caefa[_0xa9c5('0x2f')]=_[_0xa9c5('0x30')](_0x4caefa['model'],_0x4caefa[_0xa9c5('0x2d')]);_0x830bad[_0xa9c5('0x31')]=_[_0xa9c5('0x30')](_0x4caefa[_0xa9c5('0x2c')],qs[_0xa9c5('0x32')](_0x4cd5e6[_0xa9c5('0x2d')][_0xa9c5('0x32')]));_0x830bad['attributes']=_0x830bad[_0xa9c5('0x31')][_0xa9c5('0x33')]?_0x830bad[_0xa9c5('0x31')]:_0x4caefa[_0xa9c5('0x2c')];if(!_0x4cd5e6[_0xa9c5('0x2d')][_0xa9c5('0x34')](_0xa9c5('0x35'))){_0x830bad[_0xa9c5('0x1b')]=qs['limit'](_0x4cd5e6['query'][_0xa9c5('0x1b')]);_0x830bad[_0xa9c5('0x1a')]=qs[_0xa9c5('0x1a')](_0x4cd5e6[_0xa9c5('0x2d')][_0xa9c5('0x1a')]);}_0x830bad[_0xa9c5('0x36')]=qs['sort'](_0x4cd5e6['query']['sort']);_0x830bad[_0xa9c5('0x37')]=qs[_0xa9c5('0x2f')](_['pick'](_0x4cd5e6[_0xa9c5('0x2d')],_0x4caefa['filters']));if(_0x4cd5e6[_0xa9c5('0x2d')][_0xa9c5('0x38')]){_0x830bad[_0xa9c5('0x37')]=_[_0xa9c5('0x39')](_0x830bad['where'],{'$or':_[_0xa9c5('0x3a')](_0x320dc0,function(_0x2cd721){if(_0x2cd721[_0xa9c5('0x2b')]!==_0xa9c5('0x3b')){var _0x814c1a={};_0x814c1a[_0x2cd721[_0xa9c5('0x26')]]={'$like':'%'+_0x4cd5e6[_0xa9c5('0x2d')][_0xa9c5('0x38')]+'%'};return _0x814c1a;}})});}_0x830bad=_['merge']({},_0x830bad,_0x4cd5e6[_0xa9c5('0x3c')]);var _0x46e5d2={'where':_0x830bad[_0xa9c5('0x37')]};return db[_0xa9c5('0x28')][_0xa9c5('0x19')](_0x46e5d2)[_0xa9c5('0x23')](function(_0x493b20){_0x11a723[_0xa9c5('0x19')]=_0x493b20;if(_0x4cd5e6['query'][_0xa9c5('0x3d')]){_0x830bad['include']=[{'all':!![]}];}return db[_0xa9c5('0x28')][_0xa9c5('0x3e')](_0x830bad);})[_0xa9c5('0x23')](function(_0x5d09c5){_0x11a723[_0xa9c5('0x3f')]=_0x5d09c5;return _0x11a723;})[_0xa9c5('0x23')](respondWithFilteredResult(_0x1762ac,_0x830bad))[_0xa9c5('0x40')](handleError(_0x1762ac,null));};exports[_0xa9c5('0x41')]=function(_0x5914d2,_0x2dbb48){var _0x97803f={'raw':!![],'where':{'id':_0x5914d2[_0xa9c5('0x42')]['id']}},_0x3db918={};_0x3db918[_0xa9c5('0x2c')]=_['keys'](db[_0xa9c5('0x28')]['rawAttributes']);_0x3db918[_0xa9c5('0x2d')]=_[_0xa9c5('0x2e')](_0x5914d2[_0xa9c5('0x2d')]);_0x3db918[_0xa9c5('0x2f')]=_[_0xa9c5('0x30')](_0x3db918[_0xa9c5('0x2c')],_0x3db918[_0xa9c5('0x2d')]);_0x97803f[_0xa9c5('0x31')]=_[_0xa9c5('0x30')](_0x3db918[_0xa9c5('0x2c')],qs['fields'](_0x5914d2[_0xa9c5('0x2d')][_0xa9c5('0x32')]));_0x97803f[_0xa9c5('0x31')]=_0x97803f[_0xa9c5('0x31')][_0xa9c5('0x33')]?_0x97803f[_0xa9c5('0x31')]:_0x3db918['model'];if(_0x5914d2[_0xa9c5('0x2d')][_0xa9c5('0x3d')]){_0x97803f['include']=[{'all':!![]}];}_0x97803f=_['merge']({},_0x97803f,_0x5914d2['options']);return db['MailSubstatus']['find'](_0x97803f)[_0xa9c5('0x23')](handleEntityNotFound(_0x2dbb48,null))[_0xa9c5('0x23')](respondWithResult(_0x2dbb48,null))[_0xa9c5('0x40')](handleError(_0x2dbb48,null));};exports[_0xa9c5('0x43')]=function(_0x255402,_0x240c40){return db[_0xa9c5('0x28')][_0xa9c5('0x43')](_0x255402[_0xa9c5('0x44')],{})[_0xa9c5('0x23')](respondWithResult(_0x240c40,0xc9))[_0xa9c5('0x40')](handleError(_0x240c40,null));};exports[_0xa9c5('0x21')]=function(_0x1c2ccf,_0x4bf8b4){if(_0x1c2ccf[_0xa9c5('0x44')]['id']){delete _0x1c2ccf['body']['id'];}return db[_0xa9c5('0x28')][_0xa9c5('0x45')]({'where':{'id':_0x1c2ccf['params']['id']}})['then'](handleEntityNotFound(_0x4bf8b4,null))[_0xa9c5('0x23')](saveUpdates(_0x1c2ccf[_0xa9c5('0x44')],null))[_0xa9c5('0x23')](respondWithResult(_0x4bf8b4,null))['catch'](handleError(_0x4bf8b4,null));};exports['destroy']=function(_0x2333c4,_0xd03cec){return db['MailSubstatus'][_0xa9c5('0x45')]({'where':{'id':_0x2333c4[_0xa9c5('0x42')]['id']}})[_0xa9c5('0x23')](handleEntityNotFound(_0xd03cec,null))[_0xa9c5('0x23')](removeEntity(_0xd03cec,null))[_0xa9c5('0x40')](handleError(_0xd03cec,null));};exports[_0xa9c5('0x46')]=function(_0x4b6fc9,_0x4cd8e4){return db['MailSubstatus'][_0xa9c5('0x46')]()[_0xa9c5('0x23')](respondWithResult(_0x4cd8e4,null))[_0xa9c5('0x40')](handleError(_0x4cd8e4,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 772e6e7..ce44c9a 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 _0x4639=['bluebird','request-promise','path','rimraf','../../config/environment','exports','MailSubstatus','lodash','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4639,0x115));var _0x9463=function(_0xd3bdab,_0x5d784a){_0xd3bdab=_0xd3bdab-0x0;var _0x1c3178=_0x4639[_0xd3bdab];return _0x1c3178;};'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('./mailSubstatus.attributes');module[_0x9463('0x8')]=function(_0x10d647,_0x493fdc){return _0x10d647['define'](_0x9463('0x9'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabad=['lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabad,0x150));var _0xdaba=function(_0x54deb9,_0x53e74b){_0x54deb9=_0x54deb9-0x0;var _0x5da9aa=_0xabad[_0x54deb9];return _0x5da9aa;};'use strict';var _=require(_0xdaba('0x0'));var util=require('util');var logger=require(_0xdaba('0x1'))(_0xdaba('0x2'));var moment=require(_0xdaba('0x3'));var BPromise=require('bluebird');var rp=require(_0xdaba('0x4'));var fs=require('fs');var path=require(_0xdaba('0x5'));var rimraf=require('rimraf');var config=require(_0xdaba('0x6'));var attributes=require(_0xdaba('0x7'));module[_0xdaba('0x8')]=function(_0x387d02,_0x20fd9f){return _0x387d02[_0xdaba('0x9')](_0xdaba('0xa'),attributes,{'tableName':_0xdaba('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 49469e6..6edae76 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 _0x3c81=['MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4b5ce2,_0x189c6b){var _0x75eeb3=function(_0x114342){while(--_0x114342){_0x4b5ce2['push'](_0x4b5ce2['shift']());}};_0x75eeb3(++_0x189c6b);}(_0x3c81,0x102));var _0x13c8=function(_0x239c41,_0x95b58e){_0x239c41=_0x239c41-0x0;var _0x3a725f=_0x3c81[_0x239c41];return _0x3a725f;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0bd2,_0x445b69,_0x4f7bcc){return new BPromise(function(_0x17c228,_0x4905c3){return client[_0x13c8('0x9')](_0x3f0bd2,_0x4f7bcc)[_0x13c8('0xa')](function(_0x189ce6){logger[_0x13c8('0xb')](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));logger[_0x13c8('0xe')](_0x13c8('0xf'),_0x445b69,_0x13c8('0xd'),JSON[_0x13c8('0x10')](_0x189ce6));if(_0x189ce6[_0x13c8('0x11')]){if(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x12')]===0x1f4){logger[_0x13c8('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x445b69,_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);return _0x4905c3(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);}logger['error'](_0x13c8('0xc'),_0x445b69,_0x189ce6['error']['message']);return _0x17c228(_0x189ce6['error'][_0x13c8('0x13')]);}else{logger['info'](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));_0x17c228(_0x189ce6[_0x13c8('0x14')][_0x13c8('0x13')]);}})['catch'](function(_0x13a9e1){logger[_0x13c8('0x11')](_0x13c8('0xc'),_0x445b69,_0x13a9e1);_0x4905c3(_0x13a9e1);});});} \ No newline at end of file +var _0x878f=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1e672d,_0x5ee796){var _0x5a23f3=function(_0x5a2335){while(--_0x5a2335){_0x1e672d['push'](_0x1e672d['shift']());}};_0x5a23f3(++_0x5ee796);}(_0x878f,0x173));var _0xf878=function(_0xf9b1d5,_0x42f2bf){_0xf9b1d5=_0xf9b1d5-0x0;var _0x1bc5f8=_0x878f[_0xf9b1d5];return _0x1bc5f8;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var BPromise=require(_0xf878('0x2'));var rs=require(_0xf878('0x3'));var fs=require('fs');var Redis=require(_0xf878('0x4'));var db=require(_0xf878('0x5'))['db'];var utils=require(_0xf878('0x6'));var logger=require(_0xf878('0x7'))(_0xf878('0x8'));var config=require(_0xf878('0x9'));var jayson=require(_0xf878('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5f5c,_0x62b420,_0x59e564){return new BPromise(function(_0x52851e,_0x530767){return client[_0xf878('0xb')](_0x3c5f5c,_0x59e564)['then'](function(_0x4a9d79){logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));logger['debug'](_0xf878('0xf'),_0x62b420,_0xf878('0xe'),JSON['stringify'](_0x4a9d79));if(_0x4a9d79[_0xf878('0x10')]){if(_0x4a9d79['error'][_0xf878('0x11')]===0x1f4){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x4a9d79['error'][_0xf878('0x12')]);return _0x530767(_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);}logger['error'](_0xf878('0xd'),_0x62b420,_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);return _0x52851e(_0x4a9d79['error']['message']);}else{logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));_0x52851e(_0x4a9d79[_0xf878('0x13')][_0xf878('0x12')]);}})[_0xf878('0x14')](function(_0x415056){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x415056);_0x530767(_0x415056);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 7ac570f..bada0aa 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 _0x56e0=['update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','describe','show','post','create','/:id'];(function(_0x180474,_0x3489e9){var _0x21069c=function(_0x369697){while(--_0x369697){_0x180474['push'](_0x180474['shift']());}};_0x21069c(++_0x3489e9);}(_0x56e0,0xd3));var _0x056e=function(_0x2f251e,_0x3f785e){_0x2f251e=_0x2f251e-0x0;var _0x26709b=_0x56e0[_0x2f251e];return _0x26709b;};'use strict';var multer=require(_0x056e('0x0'));var util=require(_0x056e('0x1'));var path=require(_0x056e('0x2'));var timeout=require(_0x056e('0x3'));var express=require(_0x056e('0x4'));var router=express[_0x056e('0x5')]();var auth=require(_0x056e('0x6'));var interaction=require(_0x056e('0x7'));var config=require(_0x056e('0x8'));var controller=require(_0x056e('0x9'));router[_0x056e('0xa')]('/',auth[_0x056e('0xb')](),controller['index']);router['get']('/describe',auth[_0x056e('0xb')](),controller[_0x056e('0xc')]);router[_0x056e('0xa')]('/:id',auth[_0x056e('0xb')](),controller[_0x056e('0xd')]);router[_0x056e('0xe')]('/',auth[_0x056e('0xb')](),controller[_0x056e('0xf')]);router['put'](_0x056e('0x10'),auth[_0x056e('0xb')](),controller[_0x056e('0x11')]);router['delete']('/:id',auth[_0x056e('0xb')](),controller[_0x056e('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc03d=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x413032,_0x4f1a47){var _0x548b60=function(_0x55fbcd){while(--_0x55fbcd){_0x413032['push'](_0x413032['shift']());}};_0x548b60(++_0x4f1a47);}(_0xc03d,0x1b0));var _0xdc03=function(_0x186436,_0xe0a0ee){_0x186436=_0x186436-0x0;var _0x4d40eb=_0xc03d[_0x186436];return _0x4d40eb;};'use strict';var multer=require('multer');var util=require(_0xdc03('0x0'));var path=require(_0xdc03('0x1'));var timeout=require(_0xdc03('0x2'));var express=require(_0xdc03('0x3'));var router=express['Router']();var auth=require(_0xdc03('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdc03('0x5'));var controller=require('./mailTransferReport.controller');router[_0xdc03('0x6')]('/',auth[_0xdc03('0x7')](),controller[_0xdc03('0x8')]);router['get'](_0xdc03('0x9'),auth['isAuthenticated'](),controller[_0xdc03('0xa')]);router[_0xdc03('0x6')](_0xdc03('0xb'),auth['isAuthenticated'](),controller[_0xdc03('0xc')]);router['post']('/',auth[_0xdc03('0x7')](),controller[_0xdc03('0xd')]);router[_0xdc03('0xe')](_0xdc03('0xb'),auth[_0xdc03('0x7')](),controller[_0xdc03('0xf')]);router[_0xdc03('0x10')]('/:id',auth[_0xdc03('0x7')](),controller[_0xdc03('0x11')]);module[_0xdc03('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 41e462a..da225d0 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 _0x13f9=['moment','sequelize','exports','STRING','ENUM','DATE','NOW'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0x13f9,0xcb));var _0x913f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x13f9[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0x913f('0x0'));var Sequelize=require(_0x913f('0x1'));module[_0x913f('0x2')]={'uniqueid':{'type':Sequelize[_0x913f('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x913f('0x4')]('account','agent','queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x913f('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x913f('0x6')]}}; \ No newline at end of file +var _0x588c=['agent','queue','DATE','NOW','moment','sequelize','exports','account'];(function(_0x2bb8a9,_0x3f2ad1){var _0x4e7b0d=function(_0x34903a){while(--_0x34903a){_0x2bb8a9['push'](_0x2bb8a9['shift']());}};_0x4e7b0d(++_0x3f2ad1);}(_0x588c,0x1a4));var _0xc588=function(_0x25d0e2,_0x27d961){_0x25d0e2=_0x25d0e2-0x0;var _0x50629f=_0x588c[_0x25d0e2];return _0x50629f;};'use strict';var moment=require(_0xc588('0x0'));var Sequelize=require(_0xc588('0x1'));module[_0xc588('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc588('0x3'),_0xc588('0x4'),'queue'),'allowNull':![],'defaultValue':_0xc588('0x5')},'transferredAt':{'type':Sequelize[_0xc588('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xc588('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index bb9ad91..b120dc1 100644 --- a/server/api/mailTransferReport/mailTransferReport.controller.js +++ b/server/api/mailTransferReport/mailTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set'];(function(_0x5055a9,_0x3a878b){var _0x2917f7=function(_0x1525e1){while(--_0x1525e1){_0x5055a9['push'](_0x5055a9['shift']());}};_0x2917f7(++_0x3a878b);}(_0x7a54,0x106));var _0x47a5=function(_0x3088c8,_0x3358bd){_0x3088c8=_0x3088c8-0x0;var _0x1b8cc6=_0x7a54[_0x3088c8];return _0x1b8cc6;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];function respondWithStatusCode(_0xd612dd,_0xd308b8){_0xd308b8=_0xd308b8||0xcc;return function(_0x1eae59){if(_0x1eae59){return _0xd612dd['sendStatus'](_0xd308b8);}return _0xd612dd[_0x47a5('0x15')](_0xd308b8)[_0x47a5('0x16')]();};}function respondWithResult(_0x1cf309,_0x711793){_0x711793=_0x711793||0xc8;return function(_0x139f25){if(_0x139f25){return _0x1cf309[_0x47a5('0x15')](_0x711793)[_0x47a5('0x17')](_0x139f25);}};}function respondWithFilteredResult(_0x190faa,_0x4e99a8){return function(_0x362359){if(_0x362359){var _0x11faf5=_0x362359['count'],_0x3b001e=_0x4e99a8['offset'],_0x2a2cbb=_0x4e99a8[_0x47a5('0x18')]+_0x4e99a8['limit'],_0x1ef44c;if(_0x2a2cbb>=_0x11faf5){_0x2a2cbb=_0x11faf5;_0x1ef44c=0xc8;}else{_0x1ef44c=0xce;}_0x190faa['status'](_0x1ef44c);return _0x190faa[_0x47a5('0x19')](_0x47a5('0x1a'),_0x3b001e+'-'+_0x2a2cbb+'/'+_0x11faf5)[_0x47a5('0x17')](_0x362359);}return null;};}function patchUpdates(_0x1ef371){return function(_0x477b1d){try{jsonpatch[_0x47a5('0x1b')](_0x477b1d,_0x1ef371,!![]);}catch(_0x2763d6){return BPromise[_0x47a5('0x1c')](_0x2763d6);}return _0x477b1d[_0x47a5('0x1d')]();};}function saveUpdates(_0x4a9fcb,_0x1570bc){return function(_0xf160ba){if(_0xf160ba){return _0xf160ba['update'](_0x4a9fcb)[_0x47a5('0x1e')](function(_0x1f03f7){return _0x1f03f7;});}return null;};}function removeEntity(_0x36874d,_0x4c5910){return function(_0xb8ae6c){if(_0xb8ae6c){return _0xb8ae6c[_0x47a5('0x1f')]()[_0x47a5('0x1e')](function(){_0x36874d[_0x47a5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2dea9,_0x385687){return function(_0x513981){if(!_0x513981){_0xe2dea9[_0x47a5('0x20')](0x194);}return _0x513981;};}function handleError(_0xc4cd63,_0x4437f1){_0x4437f1=_0x4437f1||0x1f4;return function(_0x129ce5){logger[_0x47a5('0x21')](_0x129ce5['stack']);if(_0x129ce5['name']){delete _0x129ce5[_0x47a5('0x22')];}_0xc4cd63['status'](_0x4437f1)[_0x47a5('0x23')](_0x129ce5);};}exports['index']=function(_0x23cb77,_0x378208){var _0x36ad34={},_0x1dac65={},_0x21f296={'count':0x0,'rows':[]};var _0x3ba0b7=_[_0x47a5('0x24')](db[_0x47a5('0x25')][_0x47a5('0x26')],function(_0x361bfa){return{'name':_0x361bfa[_0x47a5('0x27')],'type':_0x361bfa[_0x47a5('0x28')][_0x47a5('0x29')]};});_0x1dac65['model']=_[_0x47a5('0x24')](_0x3ba0b7,'name');_0x1dac65[_0x47a5('0x2a')]=_[_0x47a5('0x2b')](_0x23cb77[_0x47a5('0x2a')]);_0x1dac65['filters']=_[_0x47a5('0x2c')](_0x1dac65[_0x47a5('0x2d')],_0x1dac65[_0x47a5('0x2a')]);_0x36ad34[_0x47a5('0x2e')]=_['intersection'](_0x1dac65['model'],qs[_0x47a5('0x2f')](_0x23cb77[_0x47a5('0x2a')]['fields']));_0x36ad34['attributes']=_0x36ad34[_0x47a5('0x2e')][_0x47a5('0x30')]?_0x36ad34['attributes']:_0x1dac65[_0x47a5('0x2d')];if(!_0x23cb77['query'][_0x47a5('0x31')](_0x47a5('0x32'))){_0x36ad34['limit']=qs['limit'](_0x23cb77[_0x47a5('0x2a')]['limit']);_0x36ad34[_0x47a5('0x18')]=qs[_0x47a5('0x18')](_0x23cb77[_0x47a5('0x2a')]['offset']);}_0x36ad34[_0x47a5('0x33')]=qs['sort'](_0x23cb77['query'][_0x47a5('0x34')]);_0x36ad34['where']=qs[_0x47a5('0x35')](_['pick'](_0x23cb77[_0x47a5('0x2a')],_0x1dac65[_0x47a5('0x35')]));if(_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]){_0x36ad34[_0x47a5('0x37')]=_[_0x47a5('0x38')](_0x36ad34[_0x47a5('0x37')],{'$or':_[_0x47a5('0x24')](_0x3ba0b7,function(_0x1a0d23){if(_0x1a0d23['type']!==_0x47a5('0x39')){var _0x10f136={};_0x10f136[_0x1a0d23['name']]={'$like':'%'+_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]+'%'};return _0x10f136;}})});}_0x36ad34=_[_0x47a5('0x38')]({},_0x36ad34,_0x23cb77['options']);var _0x101f70={'where':_0x36ad34[_0x47a5('0x37')]};return db['MailTransferReport'][_0x47a5('0x3a')](_0x101f70)[_0x47a5('0x1e')](function(_0x54ae35){_0x21f296['count']=_0x54ae35;if(_0x23cb77['query'][_0x47a5('0x3b')]){_0x36ad34['include']=[{'all':!![]}];}return db[_0x47a5('0x25')][_0x47a5('0x3c')](_0x36ad34);})[_0x47a5('0x1e')](function(_0x111f0d){_0x21f296[_0x47a5('0x3d')]=_0x111f0d;return _0x21f296;})[_0x47a5('0x1e')](respondWithFilteredResult(_0x378208,_0x36ad34))[_0x47a5('0x3e')](handleError(_0x378208,null));};exports[_0x47a5('0x3f')]=function(_0x3fa2a8,_0x36a24e){var _0x280500={'raw':!![],'where':{'id':_0x3fa2a8[_0x47a5('0x40')]['id']}},_0x1658e8={};_0x1658e8['model']=_[_0x47a5('0x2b')](db[_0x47a5('0x25')][_0x47a5('0x26')]);_0x1658e8[_0x47a5('0x2a')]=_['keys'](_0x3fa2a8[_0x47a5('0x2a')]);_0x1658e8['filters']=_['intersection'](_0x1658e8['model'],_0x1658e8['query']);_0x280500[_0x47a5('0x2e')]=_['intersection'](_0x1658e8[_0x47a5('0x2d')],qs[_0x47a5('0x2f')](_0x3fa2a8[_0x47a5('0x2a')]['fields']));_0x280500[_0x47a5('0x2e')]=_0x280500[_0x47a5('0x2e')]['length']?_0x280500['attributes']:_0x1658e8[_0x47a5('0x2d')];if(_0x3fa2a8['query'][_0x47a5('0x3b')]){_0x280500[_0x47a5('0x41')]=[{'all':!![]}];}_0x280500=_[_0x47a5('0x38')]({},_0x280500,_0x3fa2a8[_0x47a5('0x42')]);return db[_0x47a5('0x25')][_0x47a5('0x43')](_0x280500)[_0x47a5('0x1e')](handleEntityNotFound(_0x36a24e,null))[_0x47a5('0x1e')](respondWithResult(_0x36a24e,null))[_0x47a5('0x3e')](handleError(_0x36a24e,null));};exports[_0x47a5('0x44')]=function(_0x24ecb1,_0x3c3ebf){return db[_0x47a5('0x25')][_0x47a5('0x44')](_0x24ecb1[_0x47a5('0x45')],{})[_0x47a5('0x1e')](respondWithResult(_0x3c3ebf,0xc9))['catch'](handleError(_0x3c3ebf,null));};exports[_0x47a5('0x46')]=function(_0x23bb04,_0x49eab1){if(_0x23bb04['body']['id']){delete _0x23bb04[_0x47a5('0x45')]['id'];}return db['MailTransferReport'][_0x47a5('0x43')]({'where':{'id':_0x23bb04[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x49eab1,null))['then'](saveUpdates(_0x23bb04[_0x47a5('0x45')],null))['then'](respondWithResult(_0x49eab1,null))[_0x47a5('0x3e')](handleError(_0x49eab1,null));};exports[_0x47a5('0x1f')]=function(_0x3548bc,_0x3e12a7){return db[_0x47a5('0x25')][_0x47a5('0x43')]({'where':{'id':_0x3548bc[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x3e12a7,null))['then'](removeEntity(_0x3e12a7,null))[_0x47a5('0x3e')](handleError(_0x3e12a7,null));};exports[_0x47a5('0x47')]=function(_0x1163e3,_0x9ea93e){return db[_0x47a5('0x25')][_0x47a5('0x47')]()[_0x47a5('0x1e')](respondWithResult(_0x9ea93e,null))['catch'](handleError(_0x9ea93e,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','pick','filter','where','merge','VIRTUAL','options','MailTransferReport','count','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','describe','html-pdf'];(function(_0x34643f,_0x3ff34b){var _0x177f20=function(_0x4b4da8){while(--_0x4b4da8){_0x34643f['push'](_0x34643f['shift']());}};_0x177f20(++_0x3ff34b);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){_0x350fd9[_0x7995('0x1b')](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x204507,_0x285437){return function(_0x563799){if(!_0x563799){_0x204507[_0x7995('0x1a')](0x194);}return _0x563799;};}function handleError(_0x475351,_0x472195){_0x472195=_0x472195||0x1f4;return function(_0x59405a){logger[_0x7995('0x26')](_0x59405a[_0x7995('0x27')]);if(_0x59405a[_0x7995('0x28')]){delete _0x59405a[_0x7995('0x28')];}_0x475351[_0x7995('0x1b')](_0x472195)[_0x7995('0x29')](_0x59405a);};}exports['index']=function(_0x47625f,_0x5911c3){var _0x229742={},_0x49bc7e={},_0xf16cc2={'count':0x0,'rows':[]};var _0x132a42=_[_0x7995('0x2a')](db['MailTransferReport'][_0x7995('0x2b')],function(_0x514445){return{'name':_0x514445[_0x7995('0x2c')],'type':_0x514445[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x49bc7e['model']=_['map'](_0x132a42,'name');_0x49bc7e[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x47625f[_0x7995('0x2f')]);_0x49bc7e[_0x7995('0x31')]=_[_0x7995('0x32')](_0x49bc7e[_0x7995('0x33')],_0x49bc7e['query']);_0x229742['attributes']=_[_0x7995('0x32')](_0x49bc7e['model'],qs[_0x7995('0x34')](_0x47625f[_0x7995('0x2f')][_0x7995('0x34')]));_0x229742[_0x7995('0x35')]=_0x229742[_0x7995('0x35')]['length']?_0x229742[_0x7995('0x35')]:_0x49bc7e[_0x7995('0x33')];if(!_0x47625f['query']['hasOwnProperty']('nolimit')){_0x229742[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x47625f['query'][_0x7995('0x1f')]);_0x229742['offset']=qs[_0x7995('0x1e')](_0x47625f[_0x7995('0x2f')][_0x7995('0x1e')]);}_0x229742['order']=qs['sort'](_0x47625f[_0x7995('0x2f')]['sort']);_0x229742['where']=qs[_0x7995('0x31')](_[_0x7995('0x36')](_0x47625f['query'],_0x49bc7e[_0x7995('0x31')]));if(_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]){_0x229742[_0x7995('0x38')]=_[_0x7995('0x39')](_0x229742['where'],{'$or':_[_0x7995('0x2a')](_0x132a42,function(_0x242713){if(_0x242713[_0x7995('0x2d')]!==_0x7995('0x3a')){var _0x4b1541={};_0x4b1541[_0x242713[_0x7995('0x28')]]={'$like':'%'+_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]+'%'};return _0x4b1541;}})});}_0x229742=_[_0x7995('0x39')]({},_0x229742,_0x47625f[_0x7995('0x3b')]);var _0x1035dc={'where':_0x229742['where']};return db[_0x7995('0x3c')][_0x7995('0x3d')](_0x1035dc)[_0x7995('0x24')](function(_0x2ea47f){_0xf16cc2[_0x7995('0x3d')]=_0x2ea47f;if(_0x47625f[_0x7995('0x2f')][_0x7995('0x3e')]){_0x229742[_0x7995('0x3f')]=[{'all':!![]}];}return db[_0x7995('0x3c')][_0x7995('0x40')](_0x229742);})[_0x7995('0x24')](function(_0x270d52){_0xf16cc2[_0x7995('0x41')]=_0x270d52;return _0xf16cc2;})['then'](respondWithFilteredResult(_0x5911c3,_0x229742))['catch'](handleError(_0x5911c3,null));};exports[_0x7995('0x42')]=function(_0x7325e8,_0x58523e){var _0x4b0855={'raw':!![],'where':{'id':_0x7325e8['params']['id']}},_0x3f8522={};_0x3f8522['model']=_[_0x7995('0x30')](db[_0x7995('0x3c')][_0x7995('0x2b')]);_0x3f8522['query']=_[_0x7995('0x30')](_0x7325e8['query']);_0x3f8522[_0x7995('0x31')]=_['intersection'](_0x3f8522['model'],_0x3f8522[_0x7995('0x2f')]);_0x4b0855[_0x7995('0x35')]=_[_0x7995('0x32')](_0x3f8522[_0x7995('0x33')],qs['fields'](_0x7325e8[_0x7995('0x2f')][_0x7995('0x34')]));_0x4b0855[_0x7995('0x35')]=_0x4b0855[_0x7995('0x35')]['length']?_0x4b0855['attributes']:_0x3f8522[_0x7995('0x33')];if(_0x7325e8['query'][_0x7995('0x3e')]){_0x4b0855['include']=[{'all':!![]}];}_0x4b0855=_[_0x7995('0x39')]({},_0x4b0855,_0x7325e8['options']);return db[_0x7995('0x3c')][_0x7995('0x43')](_0x4b0855)['then'](handleEntityNotFound(_0x58523e,null))[_0x7995('0x24')](respondWithResult(_0x58523e,null))[_0x7995('0x44')](handleError(_0x58523e,null));};exports[_0x7995('0x45')]=function(_0xb70a51,_0x4c6837){return db[_0x7995('0x3c')][_0x7995('0x45')](_0xb70a51[_0x7995('0x46')],{})['then'](respondWithResult(_0x4c6837,0xc9))[_0x7995('0x44')](handleError(_0x4c6837,null));};exports[_0x7995('0x47')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x46')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3c')][_0x7995('0x43')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x46')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x44')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3c')]['find']({'where':{'id':_0xddf537[_0x7995('0x48')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x49')]=function(_0x1fe77e,_0x12d4b8){return db['MailTransferReport']['describe']()['then'](respondWithResult(_0x12d4b8,null))[_0x7995('0x44')](handleError(_0x12d4b8,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 83f560e..170206f 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 _0xec1a=['path','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','util','api','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec1a,0x130));var _0xaec1=function(_0x18a7c6,_0x4bf5ed){_0x18a7c6=_0x18a7c6-0x0;var _0x316139=_0xec1a[_0x18a7c6];return _0x316139;};'use strict';var _=require('lodash');var util=require(_0xaec1('0x0'));var logger=require('../../config/logger')(_0xaec1('0x1'));var moment=require(_0xaec1('0x2'));var BPromise=require('bluebird');var rp=require(_0xaec1('0x3'));var fs=require('fs');var path=require(_0xaec1('0x4'));var rimraf=require('rimraf');var config=require(_0xaec1('0x5'));var attributes=require(_0xaec1('0x6'));module[_0xaec1('0x7')]=function(_0x2f1078,_0x237393){return _0x2f1078[_0xaec1('0x8')]('MailTransferReport',attributes,{'tableName':_0xaec1('0x9'),'paranoid':![],'indexes':[{'name':_0xaec1('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ad5=['lodash','util','../../config/logger','api','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid'];(function(_0x18ed36,_0x40cfaf){var _0x174738=function(_0x5882e7){while(--_0x5882e7){_0x18ed36['push'](_0x18ed36['shift']());}};_0x174738(++_0x40cfaf);}(_0x0ad5,0x1a2));var _0x50ad=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0ad5[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x50ad('0x0'));var util=require(_0x50ad('0x1'));var logger=require(_0x50ad('0x2'))(_0x50ad('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x50ad('0x4'));var config=require(_0x50ad('0x5'));var attributes=require(_0x50ad('0x6'));module[_0x50ad('0x7')]=function(_0x51dae4,_0x412323){return _0x51dae4[_0x50ad('0x8')]('MailTransferReport',attributes,{'tableName':_0x50ad('0x9'),'paranoid':![],'indexes':[{'name':_0x50ad('0xa'),'fields':[_0x50ad('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 2eb3bb6..822b838 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 _0x075d=['rpc','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x37c07d,_0xdbdb5f){var _0x10dadc=function(_0x2bafb7){while(--_0x2bafb7){_0x37c07d['push'](_0x37c07d['shift']());}};_0x10dadc(++_0xdbdb5f);}(_0x075d,0xa9));var _0xd075=function(_0x56355a,_0x138baf){_0x56355a=_0x56355a-0x0;var _0x573afa=_0x075d[_0x56355a];return _0x573afa;};'use strict';var _=require(_0xd075('0x0'));var util=require('util');var moment=require(_0xd075('0x1'));var BPromise=require(_0xd075('0x2'));var rs=require(_0xd075('0x3'));var fs=require('fs');var Redis=require(_0xd075('0x4'));var db=require(_0xd075('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd075('0x6'))(_0xd075('0x7'));var config=require('../../config/environment');var jayson=require(_0xd075('0x8'));var client=jayson[_0xd075('0x9')][_0xd075('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ab70c,_0x3b5e6d,_0x46ba07){return new BPromise(function(_0x284bf4,_0x51cd89){return client[_0xd075('0xb')](_0x3ab70c,_0x46ba07)[_0xd075('0xc')](function(_0x5928f0){logger[_0xd075('0xd')](_0xd075('0xe'),_0x3b5e6d,'request\x20sent');logger[_0xd075('0xf')](_0xd075('0x10'),_0x3b5e6d,_0xd075('0x11'),JSON['stringify'](_0x5928f0));if(_0x5928f0[_0xd075('0x12')]){if(_0x5928f0[_0xd075('0x12')][_0xd075('0x13')]===0x1f4){logger[_0xd075('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x3b5e6d,_0x5928f0[_0xd075('0x12')][_0xd075('0x14')]);return _0x51cd89(_0x5928f0['error']['message']);}logger['error'](_0xd075('0xe'),_0x3b5e6d,_0x5928f0['error'][_0xd075('0x14')]);return _0x284bf4(_0x5928f0[_0xd075('0x12')][_0xd075('0x14')]);}else{logger[_0xd075('0xd')](_0xd075('0xe'),_0x3b5e6d,_0xd075('0x11'));_0x284bf4(_0x5928f0[_0xd075('0x15')][_0xd075('0x14')]);}})['catch'](function(_0x5e6d31){logger[_0xd075('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x3b5e6d,_0x5e6d31);_0x51cd89(_0x5e6d31);});});} \ No newline at end of file +var _0xf9b0=['../../config/environment','client','http','then','info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x5bfd24,_0x553ba3){var _0x3b28f1=function(_0x211e28){while(--_0x211e28){_0x5bfd24['push'](_0x5bfd24['shift']());}};_0x3b28f1(++_0x553ba3);}(_0xf9b0,0x110));var _0x0f9b=function(_0x892ed1,_0x42b84a){_0x892ed1=_0x892ed1-0x0;var _0x4d39f3=_0xf9b0[_0x892ed1];return _0x4d39f3;};'use strict';var _=require(_0x0f9b('0x0'));var util=require(_0x0f9b('0x1'));var moment=require(_0x0f9b('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f9b('0x3'));var fs=require('fs');var Redis=require(_0x0f9b('0x4'));var db=require(_0x0f9b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f9b('0x6'))(_0x0f9b('0x7'));var config=require(_0x0f9b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0f9b('0x9')][_0x0f9b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d399d,_0x31ee1b,_0x3783cd){return new BPromise(function(_0x3ae63e,_0x197f77){return client['request'](_0x4d399d,_0x3783cd)[_0x0f9b('0xb')](function(_0x2e9c44){logger[_0x0f9b('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x31ee1b,_0x0f9b('0xd'));logger['debug'](_0x0f9b('0xe'),_0x31ee1b,_0x0f9b('0xd'),JSON[_0x0f9b('0xf')](_0x2e9c44));if(_0x2e9c44[_0x0f9b('0x10')]){if(_0x2e9c44[_0x0f9b('0x10')][_0x0f9b('0x11')]===0x1f4){logger[_0x0f9b('0x10')](_0x0f9b('0x12'),_0x31ee1b,_0x2e9c44[_0x0f9b('0x10')][_0x0f9b('0x13')]);return _0x197f77(_0x2e9c44[_0x0f9b('0x10')]['message']);}logger[_0x0f9b('0x10')](_0x0f9b('0x12'),_0x31ee1b,_0x2e9c44['error'][_0x0f9b('0x13')]);return _0x3ae63e(_0x2e9c44[_0x0f9b('0x10')][_0x0f9b('0x13')]);}else{logger[_0x0f9b('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x31ee1b,_0x0f9b('0xd'));_0x3ae63e(_0x2e9c44['result'][_0x0f9b('0x13')]);}})['catch'](function(_0x3c1883){logger[_0x0f9b('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x31ee1b,_0x3c1883);_0x197f77(_0x3c1883);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index d2864b7..513d5df 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 _0xcfc1=['create','put','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','/:id','post'];(function(_0x14e837,_0x4c7292){var _0x217ddc=function(_0x1e937d){while(--_0x1e937d){_0x14e837['push'](_0x14e837['shift']());}};_0x217ddc(++_0x4c7292);}(_0xcfc1,0x1ba));var _0x1cfc=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xcfc1[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x1cfc('0x0'));var util=require(_0x1cfc('0x1'));var path=require(_0x1cfc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1cfc('0x3')]();var auth=require(_0x1cfc('0x4'));var interaction=require(_0x1cfc('0x5'));var config=require(_0x1cfc('0x6'));var controller=require(_0x1cfc('0x7'));router[_0x1cfc('0x8')]('/',auth[_0x1cfc('0x9')](),controller[_0x1cfc('0xa')]);router[_0x1cfc('0x8')](_0x1cfc('0xb'),auth[_0x1cfc('0x9')](),controller['describe']);router[_0x1cfc('0x8')](_0x1cfc('0xc'),auth[_0x1cfc('0x9')](),controller['show']);router[_0x1cfc('0xd')]('/',auth[_0x1cfc('0x9')](),controller[_0x1cfc('0xe')]);router[_0x1cfc('0xf')](_0x1cfc('0xc'),auth['isAuthenticated'](),controller[_0x1cfc('0x10')]);router[_0x1cfc('0x11')](_0x1cfc('0xc'),auth['isAuthenticated'](),controller[_0x1cfc('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf604=['/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./memberReport.controller','index','/describe','isAuthenticated','describe','get','show','post','create','put'];(function(_0x466795,_0x3f8b31){var _0x50b6ae=function(_0xf7e063){while(--_0xf7e063){_0x466795['push'](_0x466795['shift']());}};_0x50b6ae(++_0x3f8b31);}(_0xf604,0xb5));var _0x4f60=function(_0x5a306a,_0x3bdfdf){_0x5a306a=_0x5a306a-0x0;var _0x5ec858=_0xf604[_0x5a306a];return _0x5ec858;};'use strict';var multer=require('multer');var util=require(_0x4f60('0x0'));var path=require(_0x4f60('0x1'));var timeout=require(_0x4f60('0x2'));var express=require(_0x4f60('0x3'));var router=express[_0x4f60('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4f60('0x5'));var config=require(_0x4f60('0x6'));var controller=require(_0x4f60('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4f60('0x8')]);router['get'](_0x4f60('0x9'),auth[_0x4f60('0xa')](),controller[_0x4f60('0xb')]);router[_0x4f60('0xc')]('/:id',auth[_0x4f60('0xa')](),controller[_0x4f60('0xd')]);router[_0x4f60('0xe')]('/',auth[_0x4f60('0xa')](),controller[_0x4f60('0xf')]);router[_0x4f60('0x10')](_0x4f60('0x11'),auth['isAuthenticated'](),controller[_0x4f60('0x12')]);router[_0x4f60('0x13')](_0x4f60('0x11'),auth[_0x4f60('0xa')](),controller[_0x4f60('0x14')]);module[_0x4f60('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index c835d8c..6cb2b32 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 _0x53a5=['diff','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','enterAt'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x53a5,0x18b));var _0x553a=function(_0xf3f444,_0x4683a2){_0xf3f444=_0xf3f444-0x0;var _0x4c243f=_0x53a5[_0xf3f444];return _0x4c243f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x553a('0x0')]={'channel':{'type':Sequelize[_0x553a('0x1')]},'membername':{'type':Sequelize[_0x553a('0x1')]},'interface':{'type':Sequelize[_0x553a('0x1')]},'type':{'type':Sequelize[_0x553a('0x1')],'defaultValue':_0x553a('0x2'),'comment':_0x553a('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x2cb474){var _0x7aeaf4=moment(_0x2cb474);var _0x3916c5=moment(this['getDataValue'](_0x553a('0x4')));var _0x29829d=_0x7aeaf4[_0x553a('0x5')](_0x3916c5,_0x553a('0x6'));this['setDataValue'](_0x553a('0x7'),_0x2cb474);this[_0x553a('0x8')](_0x553a('0x9'),_0x29829d||null);}},'data1':{'type':Sequelize[_0x553a('0x1')],'comment':_0x553a('0xa')},'data2':{'type':Sequelize['STRING'],'comment':_0x553a('0xb')},'data3':{'type':Sequelize[_0x553a('0x1')],'comment':_0x553a('0xc')},'data4':{'type':Sequelize[_0x553a('0x1')],'comment':_0x553a('0xd')},'data5':{'type':Sequelize[_0x553a('0x1')],'comment':_0x553a('0xe')},'role':{'type':Sequelize[_0x553a('0x1')]},'internal':{'type':Sequelize[_0x553a('0xf')]},'uniqueid':{'type':Sequelize[_0x553a('0x1')]}}; \ No newline at end of file +var _0x4aa0=['DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0x3ac588,_0x205c79){var _0x9fcc3c=function(_0x4d4ffa){while(--_0x4d4ffa){_0x3ac588['push'](_0x3ac588['shift']());}};_0x9fcc3c(++_0x205c79);}(_0x4aa0,0x8d));var _0x04aa=function(_0x21b302,_0x11ef12){_0x21b302=_0x21b302-0x0;var _0x27712e=_0x4aa0[_0x21b302];return _0x27712e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x04aa('0x0')]={'channel':{'type':Sequelize[_0x04aa('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x04aa('0x1')]},'type':{'type':Sequelize[_0x04aa('0x1')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x04aa('0x2')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x04aa('0x3')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x41381d){var _0x5097b1=moment(_0x41381d);var _0x50d907=moment(this[_0x04aa('0x4')](_0x04aa('0x5')));var _0x2c9be9=_0x5097b1[_0x04aa('0x6')](_0x50d907,_0x04aa('0x7'));this[_0x04aa('0x8')](_0x04aa('0x9'),_0x41381d);this[_0x04aa('0x8')]('duration',_0x2c9be9||null);}},'data1':{'type':Sequelize[_0x04aa('0x1')],'comment':_0x04aa('0xa')},'data2':{'type':Sequelize[_0x04aa('0x1')],'comment':_0x04aa('0xb')},'data3':{'type':Sequelize[_0x04aa('0x1')],'comment':_0x04aa('0xc')},'data4':{'type':Sequelize[_0x04aa('0x1')],'comment':_0x04aa('0xd')},'data5':{'type':Sequelize['STRING'],'comment':_0x04aa('0xe')},'role':{'type':Sequelize[_0x04aa('0x1')]},'internal':{'type':Sequelize[_0x04aa('0xf')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 1dffafa..3445309 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 _0xb371=['status','end','json','count','offset','limit','apply','save','destroy','then','error','stack','name','send','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','catch','create','body','update','find','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus'];(function(_0x51ae6f,_0x14cc9f){var _0x4c580f=function(_0x5223dd){while(--_0x5223dd){_0x51ae6f['push'](_0x51ae6f['shift']());}};_0x4c580f(++_0x14cc9f);}(_0xb371,0xbc));var _0x1b37=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xb371[_0x1a9204];return _0x17ca68;};'use strict';var pdf=require(_0x1b37('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1b37('0x1'));var jsonpatch=require(_0x1b37('0x2'));var rp=require(_0x1b37('0x3'));var moment=require(_0x1b37('0x4'));var BPromise=require(_0x1b37('0x5'));var Mustache=require(_0x1b37('0x6'));var util=require(_0x1b37('0x7'));var path=require(_0x1b37('0x8'));var sox=require(_0x1b37('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x1b37('0xa'));var crypto=require('crypto');var jsforce=require(_0x1b37('0xb'));var deskjs=require(_0x1b37('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1b37('0xd'));var Redis=require(_0x1b37('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1b37('0xf'));var as=require(_0x1b37('0x10'));var hardwareService=require(_0x1b37('0x11'));var logger=require(_0x1b37('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x1b37('0x13'));var db=require(_0x1b37('0x14'))['db'];function respondWithStatusCode(_0x28091c,_0x16a824){_0x16a824=_0x16a824||0xcc;return function(_0x2d50dd){if(_0x2d50dd){return _0x28091c[_0x1b37('0x15')](_0x16a824);}return _0x28091c[_0x1b37('0x16')](_0x16a824)[_0x1b37('0x17')]();};}function respondWithResult(_0x46ea00,_0x10b0a6){_0x10b0a6=_0x10b0a6||0xc8;return function(_0x48e359){if(_0x48e359){return _0x46ea00[_0x1b37('0x16')](_0x10b0a6)[_0x1b37('0x18')](_0x48e359);}};}function respondWithFilteredResult(_0x358c28,_0x21a2fa){return function(_0x22d81f){if(_0x22d81f){var _0x4fc25f=_0x22d81f[_0x1b37('0x19')],_0x286750=_0x21a2fa[_0x1b37('0x1a')],_0x1d9862=_0x21a2fa[_0x1b37('0x1a')]+_0x21a2fa[_0x1b37('0x1b')],_0x340039;if(_0x1d9862>=_0x4fc25f){_0x1d9862=_0x4fc25f;_0x340039=0xc8;}else{_0x340039=0xce;}_0x358c28['status'](_0x340039);return _0x358c28['set']('Content-Range',_0x286750+'-'+_0x1d9862+'/'+_0x4fc25f)['json'](_0x22d81f);}return null;};}function patchUpdates(_0x3b1436){return function(_0x1c51d1){try{jsonpatch[_0x1b37('0x1c')](_0x1c51d1,_0x3b1436,!![]);}catch(_0x49928b){return BPromise['reject'](_0x49928b);}return _0x1c51d1[_0x1b37('0x1d')]();};}function saveUpdates(_0x1ed4c1,_0x34b9c8){return function(_0xe48fb0){if(_0xe48fb0){return _0xe48fb0['update'](_0x1ed4c1)['then'](function(_0x37973f){return _0x37973f;});}return null;};}function removeEntity(_0x238a0c,_0x23d1d6){return function(_0x32baf7){if(_0x32baf7){return _0x32baf7[_0x1b37('0x1e')]()[_0x1b37('0x1f')](function(){_0x238a0c[_0x1b37('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c0128,_0x3c4f58){return function(_0x5757c6){if(!_0x5757c6){_0x2c0128[_0x1b37('0x15')](0x194);}return _0x5757c6;};}function handleError(_0x4c686f,_0x12e313){_0x12e313=_0x12e313||0x1f4;return function(_0x1968e0){logger[_0x1b37('0x20')](_0x1968e0[_0x1b37('0x21')]);if(_0x1968e0[_0x1b37('0x22')]){delete _0x1968e0[_0x1b37('0x22')];}_0x4c686f[_0x1b37('0x16')](_0x12e313)[_0x1b37('0x23')](_0x1968e0);};}exports['index']=function(_0x11d577,_0x3e1092){var _0x6e036e={},_0x5c517d={},_0x2921ec={'count':0x0,'rows':[]};var _0x2a6cbc=_[_0x1b37('0x24')](db[_0x1b37('0x25')][_0x1b37('0x26')],function(_0xf9101f){return{'name':_0xf9101f[_0x1b37('0x27')],'type':_0xf9101f[_0x1b37('0x28')][_0x1b37('0x29')]};});_0x5c517d[_0x1b37('0x2a')]=_[_0x1b37('0x24')](_0x2a6cbc,_0x1b37('0x22'));_0x5c517d[_0x1b37('0x2b')]=_['keys'](_0x11d577[_0x1b37('0x2b')]);_0x5c517d[_0x1b37('0x2c')]=_[_0x1b37('0x2d')](_0x5c517d[_0x1b37('0x2a')],_0x5c517d['query']);_0x6e036e[_0x1b37('0x2e')]=_['intersection'](_0x5c517d[_0x1b37('0x2a')],qs[_0x1b37('0x2f')](_0x11d577[_0x1b37('0x2b')]['fields']));_0x6e036e['attributes']=_0x6e036e[_0x1b37('0x2e')][_0x1b37('0x30')]?_0x6e036e[_0x1b37('0x2e')]:_0x5c517d[_0x1b37('0x2a')];if(!_0x11d577[_0x1b37('0x2b')][_0x1b37('0x31')](_0x1b37('0x32'))){_0x6e036e[_0x1b37('0x1b')]=qs[_0x1b37('0x1b')](_0x11d577[_0x1b37('0x2b')][_0x1b37('0x1b')]);_0x6e036e[_0x1b37('0x1a')]=qs[_0x1b37('0x1a')](_0x11d577[_0x1b37('0x2b')][_0x1b37('0x1a')]);}_0x6e036e['order']=qs[_0x1b37('0x33')](_0x11d577[_0x1b37('0x2b')][_0x1b37('0x33')]);_0x6e036e[_0x1b37('0x34')]=qs[_0x1b37('0x2c')](_[_0x1b37('0x35')](_0x11d577['query'],_0x5c517d[_0x1b37('0x2c')]));if(_0x11d577[_0x1b37('0x2b')]['filter']){_0x6e036e[_0x1b37('0x34')]=_[_0x1b37('0x36')](_0x6e036e[_0x1b37('0x34')],{'$or':_[_0x1b37('0x24')](_0x2a6cbc,function(_0x246978){if(_0x246978['type']!==_0x1b37('0x37')){var _0x3de83f={};_0x3de83f[_0x246978[_0x1b37('0x22')]]={'$like':'%'+_0x11d577[_0x1b37('0x2b')][_0x1b37('0x38')]+'%'};return _0x3de83f;}})});}_0x6e036e=_[_0x1b37('0x36')]({},_0x6e036e,_0x11d577[_0x1b37('0x39')]);var _0x4eee45={'where':_0x6e036e[_0x1b37('0x34')]};return db[_0x1b37('0x25')][_0x1b37('0x19')](_0x4eee45)[_0x1b37('0x1f')](function(_0x39bfac){_0x2921ec[_0x1b37('0x19')]=_0x39bfac;if(_0x11d577[_0x1b37('0x2b')]['includeAll']){_0x6e036e[_0x1b37('0x3a')]=[{'all':!![]}];}return db[_0x1b37('0x25')][_0x1b37('0x3b')](_0x6e036e);})['then'](function(_0x3fead6){_0x2921ec[_0x1b37('0x3c')]=_0x3fead6;return _0x2921ec;})[_0x1b37('0x1f')](respondWithFilteredResult(_0x3e1092,_0x6e036e))['catch'](handleError(_0x3e1092,null));};exports[_0x1b37('0x3d')]=function(_0x23f35b,_0x3199d1){var _0x4ad4c3={'raw':!![],'where':{'id':_0x23f35b[_0x1b37('0x3e')]['id']}},_0x5762d9={};_0x5762d9[_0x1b37('0x2a')]=_['keys'](db[_0x1b37('0x25')]['rawAttributes']);_0x5762d9[_0x1b37('0x2b')]=_[_0x1b37('0x3f')](_0x23f35b[_0x1b37('0x2b')]);_0x5762d9[_0x1b37('0x2c')]=_['intersection'](_0x5762d9[_0x1b37('0x2a')],_0x5762d9[_0x1b37('0x2b')]);_0x4ad4c3[_0x1b37('0x2e')]=_['intersection'](_0x5762d9[_0x1b37('0x2a')],qs[_0x1b37('0x2f')](_0x23f35b['query'][_0x1b37('0x2f')]));_0x4ad4c3[_0x1b37('0x2e')]=_0x4ad4c3[_0x1b37('0x2e')][_0x1b37('0x30')]?_0x4ad4c3['attributes']:_0x5762d9[_0x1b37('0x2a')];if(_0x23f35b[_0x1b37('0x2b')]['includeAll']){_0x4ad4c3[_0x1b37('0x3a')]=[{'all':!![]}];}_0x4ad4c3=_['merge']({},_0x4ad4c3,_0x23f35b[_0x1b37('0x39')]);return db['MemberReport']['find'](_0x4ad4c3)[_0x1b37('0x1f')](handleEntityNotFound(_0x3199d1,null))['then'](respondWithResult(_0x3199d1,null))[_0x1b37('0x40')](handleError(_0x3199d1,null));};exports[_0x1b37('0x41')]=function(_0xba82a4,_0x411293){return db[_0x1b37('0x25')][_0x1b37('0x41')](_0xba82a4[_0x1b37('0x42')],{})['then'](respondWithResult(_0x411293,0xc9))[_0x1b37('0x40')](handleError(_0x411293,null));};exports[_0x1b37('0x43')]=function(_0x1c3a64,_0x54394f){if(_0x1c3a64['body']['id']){delete _0x1c3a64[_0x1b37('0x42')]['id'];}return db[_0x1b37('0x25')]['find']({'where':{'id':_0x1c3a64['params']['id']}})[_0x1b37('0x1f')](handleEntityNotFound(_0x54394f,null))[_0x1b37('0x1f')](saveUpdates(_0x1c3a64['body'],null))['then'](respondWithResult(_0x54394f,null))['catch'](handleError(_0x54394f,null));};exports[_0x1b37('0x1e')]=function(_0x3e6bcc,_0x28a16d){return db[_0x1b37('0x25')][_0x1b37('0x44')]({'where':{'id':_0x3e6bcc['params']['id']}})[_0x1b37('0x1f')](handleEntityNotFound(_0x28a16d,null))[_0x1b37('0x1f')](removeEntity(_0x28a16d,null))[_0x1b37('0x40')](handleError(_0x28a16d,null));};exports[_0x1b37('0x45')]=function(_0x2a89fe,_0x79734c){return db['MemberReport'][_0x1b37('0x45')]()['then'](respondWithResult(_0x79734c,null))['catch'](handleError(_0x79734c,null));}; \ No newline at end of file +var _0x54b6=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','destroy','end','error','name','send','index','map','MemberReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','merge','VIRTUAL','options','then','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','update','body','describe','eml-format'];(function(_0x50d8da,_0xe56e5b){var _0x1b55bb=function(_0x5c15eb){while(--_0x5c15eb){_0x50d8da['push'](_0x50d8da['shift']());}};_0x1b55bb(++_0xe56e5b);}(_0x54b6,0xd1));var _0x654b=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x54b6[_0x386c3e];return _0x4b8e13;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x654b('0x0'));var rimraf=require(_0x654b('0x1'));var zipdir=require(_0x654b('0x2'));var jsonpatch=require(_0x654b('0x3'));var rp=require(_0x654b('0x4'));var moment=require(_0x654b('0x5'));var BPromise=require(_0x654b('0x6'));var Mustache=require('mustache');var util=require(_0x654b('0x7'));var path=require(_0x654b('0x8'));var sox=require(_0x654b('0x9'));var csv=require(_0x654b('0xa'));var ejs=require(_0x654b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x654b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x654b('0xd'));var toCsv=require(_0x654b('0xa'));var querystring=require('querystring');var Papa=require(_0x654b('0xe'));var Redis=require(_0x654b('0xf'));var authService=require(_0x654b('0x10'));var qs=require(_0x654b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x654b('0x12'));var logger=require(_0x654b('0x13'))(_0x654b('0x14'));var utils=require('../../config/utils');var config=require(_0x654b('0x15'));var db=require(_0x654b('0x16'))['db'];function respondWithStatusCode(_0x5e8591,_0x206069){_0x206069=_0x206069||0xcc;return function(_0x530f53){if(_0x530f53){return _0x5e8591[_0x654b('0x17')](_0x206069);}return _0x5e8591[_0x654b('0x18')](_0x206069)['end']();};}function respondWithResult(_0x13f2cd,_0x41b7ac){_0x41b7ac=_0x41b7ac||0xc8;return function(_0x2ef78e){if(_0x2ef78e){return _0x13f2cd[_0x654b('0x18')](_0x41b7ac)[_0x654b('0x19')](_0x2ef78e);}};}function respondWithFilteredResult(_0x57c037,_0x590699){return function(_0x5a05aa){if(_0x5a05aa){var _0x442d5c=_0x5a05aa[_0x654b('0x1a')],_0x5a2940=_0x590699[_0x654b('0x1b')],_0x17c280=_0x590699[_0x654b('0x1b')]+_0x590699['limit'],_0x121c77;if(_0x17c280>=_0x442d5c){_0x17c280=_0x442d5c;_0x121c77=0xc8;}else{_0x121c77=0xce;}_0x57c037[_0x654b('0x18')](_0x121c77);return _0x57c037[_0x654b('0x1c')](_0x654b('0x1d'),_0x5a2940+'-'+_0x17c280+'/'+_0x442d5c)[_0x654b('0x19')](_0x5a05aa);}return null;};}function patchUpdates(_0x32b17b){return function(_0x51e5b7){try{jsonpatch[_0x654b('0x1e')](_0x51e5b7,_0x32b17b,!![]);}catch(_0x201eb5){return BPromise['reject'](_0x201eb5);}return _0x51e5b7['save']();};}function saveUpdates(_0xb32b02,_0x53357e){return function(_0xe45542){if(_0xe45542){return _0xe45542['update'](_0xb32b02)['then'](function(_0x2849ca){return _0x2849ca;});}return null;};}function removeEntity(_0x3e94a6,_0x27e531){return function(_0x37bd70){if(_0x37bd70){return _0x37bd70[_0x654b('0x1f')]()['then'](function(){_0x3e94a6[_0x654b('0x18')](0xcc)[_0x654b('0x20')]();});}};}function handleEntityNotFound(_0x3808ff,_0x3ac0a1){return function(_0x451550){if(!_0x451550){_0x3808ff[_0x654b('0x17')](0x194);}return _0x451550;};}function handleError(_0x80986a,_0x173a09){_0x173a09=_0x173a09||0x1f4;return function(_0xe63d34){logger[_0x654b('0x21')](_0xe63d34['stack']);if(_0xe63d34[_0x654b('0x22')]){delete _0xe63d34['name'];}_0x80986a[_0x654b('0x18')](_0x173a09)[_0x654b('0x23')](_0xe63d34);};}exports[_0x654b('0x24')]=function(_0xe3dc57,_0x549baa){var _0x35a17b={},_0x2241d2={},_0x201a34={'count':0x0,'rows':[]};var _0x775fe3=_[_0x654b('0x25')](db[_0x654b('0x26')]['rawAttributes'],function(_0xbaa097){return{'name':_0xbaa097[_0x654b('0x27')],'type':_0xbaa097[_0x654b('0x28')][_0x654b('0x29')]};});_0x2241d2[_0x654b('0x2a')]=_[_0x654b('0x25')](_0x775fe3,_0x654b('0x22'));_0x2241d2[_0x654b('0x2b')]=_[_0x654b('0x2c')](_0xe3dc57[_0x654b('0x2b')]);_0x2241d2[_0x654b('0x2d')]=_[_0x654b('0x2e')](_0x2241d2[_0x654b('0x2a')],_0x2241d2[_0x654b('0x2b')]);_0x35a17b[_0x654b('0x2f')]=_[_0x654b('0x2e')](_0x2241d2[_0x654b('0x2a')],qs[_0x654b('0x30')](_0xe3dc57['query']['fields']));_0x35a17b['attributes']=_0x35a17b[_0x654b('0x2f')]['length']?_0x35a17b['attributes']:_0x2241d2[_0x654b('0x2a')];if(!_0xe3dc57['query']['hasOwnProperty'](_0x654b('0x31'))){_0x35a17b['limit']=qs['limit'](_0xe3dc57[_0x654b('0x2b')][_0x654b('0x32')]);_0x35a17b[_0x654b('0x1b')]=qs[_0x654b('0x1b')](_0xe3dc57[_0x654b('0x2b')][_0x654b('0x1b')]);}_0x35a17b['order']=qs[_0x654b('0x33')](_0xe3dc57[_0x654b('0x2b')][_0x654b('0x33')]);_0x35a17b[_0x654b('0x34')]=qs[_0x654b('0x2d')](_[_0x654b('0x35')](_0xe3dc57[_0x654b('0x2b')],_0x2241d2['filters']));if(_0xe3dc57[_0x654b('0x2b')]['filter']){_0x35a17b['where']=_[_0x654b('0x36')](_0x35a17b[_0x654b('0x34')],{'$or':_[_0x654b('0x25')](_0x775fe3,function(_0x4cb32d){if(_0x4cb32d['type']!==_0x654b('0x37')){var _0x8e4212={};_0x8e4212[_0x4cb32d[_0x654b('0x22')]]={'$like':'%'+_0xe3dc57[_0x654b('0x2b')]['filter']+'%'};return _0x8e4212;}})});}_0x35a17b=_['merge']({},_0x35a17b,_0xe3dc57[_0x654b('0x38')]);var _0x37ffa2={'where':_0x35a17b['where']};return db[_0x654b('0x26')]['count'](_0x37ffa2)[_0x654b('0x39')](function(_0x228654){_0x201a34[_0x654b('0x1a')]=_0x228654;if(_0xe3dc57[_0x654b('0x2b')]['includeAll']){_0x35a17b[_0x654b('0x3a')]=[{'all':!![]}];}return db[_0x654b('0x26')][_0x654b('0x3b')](_0x35a17b);})[_0x654b('0x39')](function(_0x1a85a6){_0x201a34[_0x654b('0x3c')]=_0x1a85a6;return _0x201a34;})[_0x654b('0x39')](respondWithFilteredResult(_0x549baa,_0x35a17b))[_0x654b('0x3d')](handleError(_0x549baa,null));};exports['show']=function(_0x55ae7c,_0x62ab57){var _0x53c836={'raw':!![],'where':{'id':_0x55ae7c[_0x654b('0x3e')]['id']}},_0x43d9f6={};_0x43d9f6[_0x654b('0x2a')]=_[_0x654b('0x2c')](db['MemberReport'][_0x654b('0x3f')]);_0x43d9f6['query']=_[_0x654b('0x2c')](_0x55ae7c['query']);_0x43d9f6[_0x654b('0x2d')]=_[_0x654b('0x2e')](_0x43d9f6[_0x654b('0x2a')],_0x43d9f6[_0x654b('0x2b')]);_0x53c836[_0x654b('0x2f')]=_['intersection'](_0x43d9f6['model'],qs[_0x654b('0x30')](_0x55ae7c['query'][_0x654b('0x30')]));_0x53c836[_0x654b('0x2f')]=_0x53c836['attributes']['length']?_0x53c836['attributes']:_0x43d9f6['model'];if(_0x55ae7c[_0x654b('0x2b')][_0x654b('0x40')]){_0x53c836[_0x654b('0x3a')]=[{'all':!![]}];}_0x53c836=_[_0x654b('0x36')]({},_0x53c836,_0x55ae7c[_0x654b('0x38')]);return db[_0x654b('0x26')][_0x654b('0x41')](_0x53c836)['then'](handleEntityNotFound(_0x62ab57,null))[_0x654b('0x39')](respondWithResult(_0x62ab57,null))[_0x654b('0x3d')](handleError(_0x62ab57,null));};exports['create']=function(_0x4f8e68,_0x4705d4){return db[_0x654b('0x26')][_0x654b('0x42')](_0x4f8e68['body'],{})[_0x654b('0x39')](respondWithResult(_0x4705d4,0xc9))[_0x654b('0x3d')](handleError(_0x4705d4,null));};exports[_0x654b('0x43')]=function(_0x119426,_0xe398c5){if(_0x119426[_0x654b('0x44')]['id']){delete _0x119426[_0x654b('0x44')]['id'];}return db[_0x654b('0x26')]['find']({'where':{'id':_0x119426[_0x654b('0x3e')]['id']}})[_0x654b('0x39')](handleEntityNotFound(_0xe398c5,null))[_0x654b('0x39')](saveUpdates(_0x119426[_0x654b('0x44')],null))[_0x654b('0x39')](respondWithResult(_0xe398c5,null))[_0x654b('0x3d')](handleError(_0xe398c5,null));};exports['destroy']=function(_0x5b85c8,_0xe4369){return db[_0x654b('0x26')][_0x654b('0x41')]({'where':{'id':_0x5b85c8[_0x654b('0x3e')]['id']}})['then'](handleEntityNotFound(_0xe4369,null))[_0x654b('0x39')](removeEntity(_0xe4369,null))['catch'](handleError(_0xe4369,null));};exports[_0x654b('0x45')]=function(_0x3f7ac2,_0x742844){return db[_0x654b('0x26')]['describe']()[_0x654b('0x39')](respondWithResult(_0x742844,null))[_0x654b('0x3d')](handleError(_0x742844,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index f6b719e..b91621a 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 _0x54b6=['lodash','util','api','moment','bluebird','rimraf','../../config/environment','./memberReport.attributes','exports','define','membername_interface','interface'];(function(_0x222969,_0x207715){var _0x278947=function(_0x27d670){while(--_0x27d670){_0x222969['push'](_0x222969['shift']());}};_0x278947(++_0x207715);}(_0x54b6,0x198));var _0x654b=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x54b6[_0x2ff238];return _0x204a56;};'use strict';var _=require(_0x654b('0x0'));var util=require(_0x654b('0x1'));var logger=require('../../config/logger')(_0x654b('0x2'));var moment=require(_0x654b('0x3'));var BPromise=require(_0x654b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x654b('0x5'));var config=require(_0x654b('0x6'));var attributes=require(_0x654b('0x7'));module[_0x654b('0x8')]=function(_0x353c19,_0x47b2d9){return _0x353c19[_0x654b('0x9')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x654b('0xa'),'fields':['membername',_0x654b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f22=['../../config/logger','moment','request-promise','path','rimraf','./memberReport.attributes','exports','define','MemberReport','report_member','membername','lodash','util'];(function(_0x53ce56,_0x122efe){var _0xcf31f=function(_0xc84390){while(--_0xc84390){_0x53ce56['push'](_0x53ce56['shift']());}};_0xcf31f(++_0x122efe);}(_0x4f22,0x1ab));var _0x24f2=function(_0x68dccd,_0x5dcb71){_0x68dccd=_0x68dccd-0x0;var _0x2c86b6=_0x4f22[_0x68dccd];return _0x2c86b6;};'use strict';var _=require(_0x24f2('0x0'));var util=require(_0x24f2('0x1'));var logger=require(_0x24f2('0x2'))('api');var moment=require(_0x24f2('0x3'));var BPromise=require('bluebird');var rp=require(_0x24f2('0x4'));var fs=require('fs');var path=require(_0x24f2('0x5'));var rimraf=require(_0x24f2('0x6'));var config=require('../../config/environment');var attributes=require(_0x24f2('0x7'));module[_0x24f2('0x8')]=function(_0x5917ae,_0x636902){return _0x5917ae[_0x24f2('0x9')](_0x24f2('0xa'),attributes,{'tableName':_0x24f2('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x24f2('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 91879f6..bad13d0 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 _0x0ee1=['where','include','map','attributes','model','debug','GetMemberReport','CreateMemberReport','create','then','UpdateMemberReport','update','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','MemberReport','findAll','options','raw'];(function(_0x3e17d7,_0x3f94c9){var _0x5a49de=function(_0x535243){while(--_0x535243){_0x3e17d7['push'](_0x3e17d7['shift']());}};_0x5a49de(++_0x3f94c9);}(_0x0ee1,0x1d4));var _0x10ee=function(_0x2a863f,_0x3e7a74){_0x2a863f=_0x2a863f-0x0;var _0x525dac=_0x0ee1[_0x2a863f];return _0x525dac;};'use strict';var _=require(_0x10ee('0x0'));var util=require(_0x10ee('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x10ee('0x2'));var fs=require('fs');var Redis=require(_0x10ee('0x3'));var db=require(_0x10ee('0x4'))['db'];var utils=require(_0x10ee('0x5'));var logger=require('../../config/logger')(_0x10ee('0x6'));var config=require(_0x10ee('0x7'));var jayson=require(_0x10ee('0x8'));var client=jayson[_0x10ee('0x9')][_0x10ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1636d5,_0x2dd7fa,_0x191d29){return new BPromise(function(_0x1565da,_0x5eb524){return client[_0x10ee('0xb')](_0x1636d5,_0x191d29)['then'](function(_0x3b0593){logger['info'](_0x10ee('0xc'),_0x2dd7fa,_0x10ee('0xd'));logger['debug'](_0x10ee('0xe'),_0x2dd7fa,_0x10ee('0xd'),JSON[_0x10ee('0xf')](_0x3b0593));if(_0x3b0593[_0x10ee('0x10')]){if(_0x3b0593[_0x10ee('0x10')][_0x10ee('0x11')]===0x1f4){logger[_0x10ee('0x10')](_0x10ee('0xc'),_0x2dd7fa,_0x3b0593[_0x10ee('0x10')][_0x10ee('0x12')]);return _0x5eb524(_0x3b0593[_0x10ee('0x10')][_0x10ee('0x12')]);}logger[_0x10ee('0x10')](_0x10ee('0xc'),_0x2dd7fa,_0x3b0593[_0x10ee('0x10')]['message']);return _0x1565da(_0x3b0593[_0x10ee('0x10')][_0x10ee('0x12')]);}else{logger[_0x10ee('0x13')](_0x10ee('0xc'),_0x2dd7fa,_0x10ee('0xd'));_0x1565da(_0x3b0593[_0x10ee('0x14')][_0x10ee('0x12')]);}})[_0x10ee('0x15')](function(_0x125bf0){logger['error']('MemberReport,\x20%s,\x20%s',_0x2dd7fa,_0x125bf0);_0x5eb524(_0x125bf0);});});}exports['GetMemberReport']=function(_0x3c7a){var _0x12ef03=this;return new Promise(function(_0xa86e90,_0x4f2614){return db[_0x10ee('0x16')][_0x10ee('0x17')]({'raw':_0x3c7a[_0x10ee('0x18')]?_0x3c7a['options'][_0x10ee('0x19')]===undefined?!![]:![]:!![],'where':_0x3c7a[_0x10ee('0x18')]?_0x3c7a[_0x10ee('0x18')][_0x10ee('0x1a')]||null:null,'attributes':_0x3c7a[_0x10ee('0x18')]?_0x3c7a[_0x10ee('0x18')]['attributes']||null:null,'limit':_0x3c7a[_0x10ee('0x18')]?_0x3c7a['options']['limit']||null:null,'include':_0x3c7a[_0x10ee('0x18')]?_0x3c7a['options'][_0x10ee('0x1b')]?_[_0x10ee('0x1c')](_0x3c7a['options'][_0x10ee('0x1b')],function(_0x4938ae){return{'model':db[_0x4938ae['model']],'as':_0x4938ae['as'],'attributes':_0x4938ae[_0x10ee('0x1d')],'include':_0x4938ae['include']?_[_0x10ee('0x1c')](_0x4938ae[_0x10ee('0x1b')],function(_0x3ac48d){return{'model':db[_0x3ac48d[_0x10ee('0x1e')]],'as':_0x3ac48d['as'],'attributes':_0x3ac48d[_0x10ee('0x1d')],'include':_0x3ac48d[_0x10ee('0x1b')]?_[_0x10ee('0x1c')](_0x3ac48d[_0x10ee('0x1b')],function(_0x58b341){return{'model':db[_0x58b341[_0x10ee('0x1e')]],'as':_0x58b341['as'],'attributes':_0x58b341[_0x10ee('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f40bb){logger[_0x10ee('0x13')]('GetMemberReport',_0x3c7a);logger[_0x10ee('0x1f')](_0x10ee('0x20'),_0x3c7a,JSON[_0x10ee('0xf')](_0x1f40bb));_0xa86e90(_0x1f40bb);})[_0x10ee('0x15')](function(_0x1cbaad){logger[_0x10ee('0x10')](_0x10ee('0x20'),_0x1cbaad[_0x10ee('0x12')],_0x3c7a);_0x4f2614(_0x12ef03[_0x10ee('0x10')](0x1f4,_0x1cbaad['message']));});});};exports[_0x10ee('0x21')]=function(_0x2485ee){var _0x1ecae1=this;return new Promise(function(_0x494906,_0xbac8b){return db[_0x10ee('0x16')][_0x10ee('0x22')](_0x2485ee['body'],{'raw':_0x2485ee[_0x10ee('0x18')]?_0x2485ee[_0x10ee('0x18')][_0x10ee('0x19')]===undefined?!![]:![]:!![]})[_0x10ee('0x23')](function(_0x336ca7){logger[_0x10ee('0x13')]('CreateMemberReport',_0x2485ee);logger['debug'](_0x10ee('0x21'),_0x2485ee,JSON[_0x10ee('0xf')](_0x336ca7));_0x494906(_0x336ca7);})[_0x10ee('0x15')](function(_0x4585d1){logger[_0x10ee('0x10')]('CreateMemberReport',_0x4585d1['message'],_0x2485ee);_0xbac8b(_0x1ecae1[_0x10ee('0x10')](0x1f4,_0x4585d1['message']));});});};exports[_0x10ee('0x24')]=function(_0xb659a9){var _0x12f9b3=this;return new Promise(function(_0x303e3b,_0x5156e2){return db[_0x10ee('0x16')][_0x10ee('0x25')](_0xb659a9['body'],{'raw':_0xb659a9[_0x10ee('0x18')]?_0xb659a9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb659a9[_0x10ee('0x18')]?_0xb659a9['options']['where']||null:null,'attributes':_0xb659a9[_0x10ee('0x18')]?_0xb659a9['options'][_0x10ee('0x1d')]||null:null,'limit':_0xb659a9[_0x10ee('0x18')]?_0xb659a9[_0x10ee('0x18')]['limit']||null:null})[_0x10ee('0x23')](function(_0x2bd8e9){logger[_0x10ee('0x13')]('UpdateMemberReport',_0xb659a9);logger['debug'](_0x10ee('0x24'),_0xb659a9,JSON['stringify'](_0x2bd8e9));_0x303e3b(_0x2bd8e9);})[_0x10ee('0x15')](function(_0x40b9a9){logger[_0x10ee('0x10')](_0x10ee('0x24'),_0x40b9a9[_0x10ee('0x12')],_0xb659a9);_0x5156e2(_0x12f9b3[_0x10ee('0x10')](0x1f4,_0x40b9a9[_0x10ee('0x12')]));});});}; \ No newline at end of file +var _0xe17a=['CreateMemberReport','create','body','UpdateMemberReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetMemberReport','MemberReport','findAll','raw','options','where','attributes','limit','map','include','model','stringify'];(function(_0x2f312a,_0xc7d0c2){var _0x26d1b7=function(_0x38d369){while(--_0x38d369){_0x2f312a['push'](_0x2f312a['shift']());}};_0x26d1b7(++_0xc7d0c2);}(_0xe17a,0x73));var _0xae17=function(_0x52bcde,_0xc011c2){_0x52bcde=_0x52bcde-0x0;var _0x55811e=_0xe17a[_0x52bcde];return _0x55811e;};'use strict';var _=require(_0xae17('0x0'));var util=require(_0xae17('0x1'));var moment=require(_0xae17('0x2'));var BPromise=require(_0xae17('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae17('0x4'));var db=require(_0xae17('0x5'))['db'];var utils=require(_0xae17('0x6'));var logger=require('../../config/logger')(_0xae17('0x7'));var config=require(_0xae17('0x8'));var jayson=require(_0xae17('0x9'));var client=jayson['client'][_0xae17('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d66ee,_0xa08b1f,_0x490265){return new BPromise(function(_0x57ff57,_0x12db69){return client[_0xae17('0xb')](_0x1d66ee,_0x490265)[_0xae17('0xc')](function(_0xe48cae){logger[_0xae17('0xd')](_0xae17('0xe'),_0xa08b1f,_0xae17('0xf'));logger[_0xae17('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0xa08b1f,_0xae17('0xf'),JSON['stringify'](_0xe48cae));if(_0xe48cae[_0xae17('0x11')]){if(_0xe48cae[_0xae17('0x11')][_0xae17('0x12')]===0x1f4){logger[_0xae17('0x11')]('MemberReport,\x20%s,\x20%s',_0xa08b1f,_0xe48cae[_0xae17('0x11')][_0xae17('0x13')]);return _0x12db69(_0xe48cae['error'][_0xae17('0x13')]);}logger[_0xae17('0x11')](_0xae17('0xe'),_0xa08b1f,_0xe48cae[_0xae17('0x11')][_0xae17('0x13')]);return _0x57ff57(_0xe48cae[_0xae17('0x11')][_0xae17('0x13')]);}else{logger[_0xae17('0xd')](_0xae17('0xe'),_0xa08b1f,'request\x20sent');_0x57ff57(_0xe48cae['result'][_0xae17('0x13')]);}})[_0xae17('0x14')](function(_0xff2bce){logger[_0xae17('0x11')]('MemberReport,\x20%s,\x20%s',_0xa08b1f,_0xff2bce);_0x12db69(_0xff2bce);});});}exports[_0xae17('0x15')]=function(_0x30fa66){var _0x504893=this;return new Promise(function(_0x4f9ff7,_0x5e1f34){return db[_0xae17('0x16')][_0xae17('0x17')]({'raw':_0x30fa66['options']?_0x30fa66['options'][_0xae17('0x18')]===undefined?!![]:![]:!![],'where':_0x30fa66[_0xae17('0x19')]?_0x30fa66['options'][_0xae17('0x1a')]||null:null,'attributes':_0x30fa66[_0xae17('0x19')]?_0x30fa66[_0xae17('0x19')][_0xae17('0x1b')]||null:null,'limit':_0x30fa66['options']?_0x30fa66['options'][_0xae17('0x1c')]||null:null,'include':_0x30fa66['options']?_0x30fa66[_0xae17('0x19')]['include']?_[_0xae17('0x1d')](_0x30fa66[_0xae17('0x19')][_0xae17('0x1e')],function(_0x359727){return{'model':db[_0x359727[_0xae17('0x1f')]],'as':_0x359727['as'],'attributes':_0x359727[_0xae17('0x1b')],'include':_0x359727[_0xae17('0x1e')]?_['map'](_0x359727[_0xae17('0x1e')],function(_0x25faee){return{'model':db[_0x25faee[_0xae17('0x1f')]],'as':_0x25faee['as'],'attributes':_0x25faee[_0xae17('0x1b')],'include':_0x25faee['include']?_[_0xae17('0x1d')](_0x25faee[_0xae17('0x1e')],function(_0x378dbd){return{'model':db[_0x378dbd[_0xae17('0x1f')]],'as':_0x378dbd['as'],'attributes':_0x378dbd[_0xae17('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xae17('0xc')](function(_0xa6d4ae){logger[_0xae17('0xd')](_0xae17('0x15'),_0x30fa66);logger['debug'](_0xae17('0x15'),_0x30fa66,JSON[_0xae17('0x20')](_0xa6d4ae));_0x4f9ff7(_0xa6d4ae);})[_0xae17('0x14')](function(_0x5990e8){logger[_0xae17('0x11')](_0xae17('0x15'),_0x5990e8[_0xae17('0x13')],_0x30fa66);_0x5e1f34(_0x504893[_0xae17('0x11')](0x1f4,_0x5990e8[_0xae17('0x13')]));});});};exports[_0xae17('0x21')]=function(_0x514caa){var _0x3f6000=this;return new Promise(function(_0x5529d9,_0x5ea7c5){return db[_0xae17('0x16')][_0xae17('0x22')](_0x514caa[_0xae17('0x23')],{'raw':_0x514caa[_0xae17('0x19')]?_0x514caa[_0xae17('0x19')][_0xae17('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4f5a33){logger[_0xae17('0xd')]('CreateMemberReport',_0x514caa);logger['debug'](_0xae17('0x21'),_0x514caa,JSON[_0xae17('0x20')](_0x4f5a33));_0x5529d9(_0x4f5a33);})[_0xae17('0x14')](function(_0x3a1a0d){logger['error'](_0xae17('0x21'),_0x3a1a0d[_0xae17('0x13')],_0x514caa);_0x5ea7c5(_0x3f6000[_0xae17('0x11')](0x1f4,_0x3a1a0d[_0xae17('0x13')]));});});};exports['UpdateMemberReport']=function(_0x2320b3){var _0x1dd457=this;return new Promise(function(_0x25d658,_0x343919){return db[_0xae17('0x16')]['update'](_0x2320b3[_0xae17('0x23')],{'raw':_0x2320b3[_0xae17('0x19')]?_0x2320b3[_0xae17('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2320b3[_0xae17('0x19')]?_0x2320b3[_0xae17('0x19')]['where']||null:null,'attributes':_0x2320b3[_0xae17('0x19')]?_0x2320b3['options'][_0xae17('0x1b')]||null:null,'limit':_0x2320b3[_0xae17('0x19')]?_0x2320b3[_0xae17('0x19')][_0xae17('0x1c')]||null:null})[_0xae17('0xc')](function(_0x4338f9){logger[_0xae17('0xd')](_0xae17('0x24'),_0x2320b3);logger[_0xae17('0x10')](_0xae17('0x24'),_0x2320b3,JSON[_0xae17('0x20')](_0x4338f9));_0x25d658(_0x4338f9);})['catch'](function(_0x23e51f){logger[_0xae17('0x11')](_0xae17('0x24'),_0x23e51f[_0xae17('0x13')],_0x2320b3);_0x343919(_0x1dd457['error'](0x1f4,_0x23e51f[_0xae17('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 014dac1..7943d82 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 _0x6b20=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','multer'];(function(_0x16438a,_0x3544be){var _0x9d2e74=function(_0x3399e5){while(--_0x3399e5){_0x16438a['push'](_0x16438a['shift']());}};_0x9d2e74(++_0x3544be);}(_0x6b20,0xd1));var _0x06b2=function(_0x444551,_0x398840){_0x444551=_0x444551-0x0;var _0x57e843=_0x6b20[_0x444551];return _0x57e843;};'use strict';var multer=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var path=require('path');var timeout=require(_0x06b2('0x2'));var express=require('express');var router=express[_0x06b2('0x3')]();var auth=require(_0x06b2('0x4'));var interaction=require(_0x06b2('0x5'));var config=require('../../config/environment');var controller=require(_0x06b2('0x6'));router[_0x06b2('0x7')]('/',controller[_0x06b2('0x8')]);module[_0x06b2('0x9')]=router; \ No newline at end of file +var _0xab40=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','exports','multer','util','Router'];(function(_0x4ab887,_0x51d6b0){var _0xf32a65=function(_0x21f969){while(--_0x21f969){_0x4ab887['push'](_0x4ab887['shift']());}};_0xf32a65(++_0x51d6b0);}(_0xab40,0xcd));var _0x0ab4=function(_0x480710,_0x5a3957){_0x480710=_0x480710-0x0;var _0x5bb16c=_0xab40[_0x480710];return _0x5bb16c;};'use strict';var multer=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0ab4('0x2')]();var auth=require(_0x0ab4('0x3'));var interaction=require(_0x0ab4('0x4'));var config=require(_0x0ab4('0x5'));var controller=require(_0x0ab4('0x6'));router['get']('/',controller['index']);module[_0x0ab4('0x7')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 73cd903..0eb0b8e 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 _0x9718=['STRING','sequelize','exports'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0x9718,0x130));var _0x8971=function(_0xbb24be,_0x3d8fd1){_0xbb24be=_0xbb24be-0x0;var _0x1e1446=_0x9718[_0xbb24be];return _0x1e1446;};'use strict';var Sequelize=require(_0x8971('0x0'));module[_0x8971('0x1')]={'version':{'type':Sequelize[_0x8971('0x2')],'unique':'version'}}; \ No newline at end of file +var _0xdfc4=['STRING','version','exports'];(function(_0x49d19d,_0x245cf5){var _0x4ebef1=function(_0xf0a4e6){while(--_0xf0a4e6){_0x49d19d['push'](_0x49d19d['shift']());}};_0x4ebef1(++_0x245cf5);}(_0xdfc4,0x161));var _0x4dfc=function(_0x14e8ea,_0x345ea1){_0x14e8ea=_0x14e8ea-0x0;var _0x40e001=_0xdfc4[_0x14e8ea];return _0x40e001;};'use strict';var Sequelize=require('sequelize');module[_0x4dfc('0x0')]={'version':{'type':Sequelize[_0x4dfc('0x1')],'unique':_0x4dfc('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index c113cdf..4384805 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 _0x7a54=['filters','filter','where','merge','VIRTUAL','count','includeAll','findAll','rows','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','map','Migration','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3aa215,_0x1f1f73){var _0x30d409=function(_0x3e5d4d){while(--_0x3e5d4d){_0x3aa215['push'](_0x3aa215['shift']());}};_0x30d409(++_0x1f1f73);}(_0x7a54,0x106));var _0x47a5=function(_0x18ce80,_0x1ef7b5){_0x18ce80=_0x18ce80-0x0;var _0x43dec0=_0x7a54[_0x18ce80];return _0x43dec0;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];function respondWithStatusCode(_0xd612dd,_0xd308b8){_0xd308b8=_0xd308b8||0xcc;return function(_0x1eae59){if(_0x1eae59){return _0xd612dd['sendStatus'](_0xd308b8);}return _0xd612dd[_0x47a5('0x15')](_0xd308b8)[_0x47a5('0x16')]();};}function respondWithResult(_0x1cf309,_0x711793){_0x711793=_0x711793||0xc8;return function(_0x139f25){if(_0x139f25){return _0x1cf309[_0x47a5('0x15')](_0x711793)[_0x47a5('0x17')](_0x139f25);}};}function respondWithFilteredResult(_0x190faa,_0x4e99a8){return function(_0x362359){if(_0x362359){var _0x11faf5=_0x362359['count'],_0x3b001e=_0x4e99a8['offset'],_0x2a2cbb=_0x4e99a8[_0x47a5('0x18')]+_0x4e99a8['limit'],_0x1ef44c;if(_0x2a2cbb>=_0x11faf5){_0x2a2cbb=_0x11faf5;_0x1ef44c=0xc8;}else{_0x1ef44c=0xce;}_0x190faa['status'](_0x1ef44c);return _0x190faa[_0x47a5('0x19')](_0x47a5('0x1a'),_0x3b001e+'-'+_0x2a2cbb+'/'+_0x11faf5)[_0x47a5('0x17')](_0x362359);}return null;};}function patchUpdates(_0x1ef371){return function(_0x477b1d){try{jsonpatch[_0x47a5('0x1b')](_0x477b1d,_0x1ef371,!![]);}catch(_0x2763d6){return BPromise[_0x47a5('0x1c')](_0x2763d6);}return _0x477b1d[_0x47a5('0x1d')]();};}function saveUpdates(_0x4a9fcb,_0x1570bc){return function(_0xf160ba){if(_0xf160ba){return _0xf160ba['update'](_0x4a9fcb)[_0x47a5('0x1e')](function(_0x1f03f7){return _0x1f03f7;});}return null;};}function removeEntity(_0x36874d,_0x4c5910){return function(_0xb8ae6c){if(_0xb8ae6c){return _0xb8ae6c[_0x47a5('0x1f')]()[_0x47a5('0x1e')](function(){_0x36874d[_0x47a5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2dea9,_0x385687){return function(_0x513981){if(!_0x513981){_0xe2dea9[_0x47a5('0x20')](0x194);}return _0x513981;};}function handleError(_0xc4cd63,_0x4437f1){_0x4437f1=_0x4437f1||0x1f4;return function(_0x129ce5){logger[_0x47a5('0x21')](_0x129ce5['stack']);if(_0x129ce5['name']){delete _0x129ce5[_0x47a5('0x22')];}_0xc4cd63['status'](_0x4437f1)[_0x47a5('0x23')](_0x129ce5);};}exports['index']=function(_0x23cb77,_0x378208){var _0x36ad34={},_0x1dac65={},_0x21f296={'count':0x0,'rows':[]};var _0x3ba0b7=_[_0x47a5('0x24')](db[_0x47a5('0x25')][_0x47a5('0x26')],function(_0x361bfa){return{'name':_0x361bfa[_0x47a5('0x27')],'type':_0x361bfa[_0x47a5('0x28')][_0x47a5('0x29')]};});_0x1dac65['model']=_[_0x47a5('0x24')](_0x3ba0b7,'name');_0x1dac65[_0x47a5('0x2a')]=_[_0x47a5('0x2b')](_0x23cb77[_0x47a5('0x2a')]);_0x1dac65['filters']=_[_0x47a5('0x2c')](_0x1dac65[_0x47a5('0x2d')],_0x1dac65[_0x47a5('0x2a')]);_0x36ad34[_0x47a5('0x2e')]=_['intersection'](_0x1dac65['model'],qs[_0x47a5('0x2f')](_0x23cb77[_0x47a5('0x2a')]['fields']));_0x36ad34['attributes']=_0x36ad34[_0x47a5('0x2e')][_0x47a5('0x30')]?_0x36ad34['attributes']:_0x1dac65[_0x47a5('0x2d')];if(!_0x23cb77['query'][_0x47a5('0x31')](_0x47a5('0x32'))){_0x36ad34['limit']=qs['limit'](_0x23cb77[_0x47a5('0x2a')]['limit']);_0x36ad34[_0x47a5('0x18')]=qs[_0x47a5('0x18')](_0x23cb77[_0x47a5('0x2a')]['offset']);}_0x36ad34[_0x47a5('0x33')]=qs['sort'](_0x23cb77['query'][_0x47a5('0x34')]);_0x36ad34['where']=qs[_0x47a5('0x35')](_['pick'](_0x23cb77[_0x47a5('0x2a')],_0x1dac65[_0x47a5('0x35')]));if(_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]){_0x36ad34[_0x47a5('0x37')]=_[_0x47a5('0x38')](_0x36ad34[_0x47a5('0x37')],{'$or':_[_0x47a5('0x24')](_0x3ba0b7,function(_0x1a0d23){if(_0x1a0d23['type']!==_0x47a5('0x39')){var _0x10f136={};_0x10f136[_0x1a0d23['name']]={'$like':'%'+_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]+'%'};return _0x10f136;}})});}_0x36ad34=_[_0x47a5('0x38')]({},_0x36ad34,_0x23cb77['options']);var _0x101f70={'where':_0x36ad34[_0x47a5('0x37')]};return db['Migration'][_0x47a5('0x3a')](_0x101f70)[_0x47a5('0x1e')](function(_0x54ae35){_0x21f296['count']=_0x54ae35;if(_0x23cb77['query'][_0x47a5('0x3b')]){_0x36ad34['include']=[{'all':!![]}];}return db[_0x47a5('0x25')][_0x47a5('0x3c')](_0x36ad34);})[_0x47a5('0x1e')](function(_0x111f0d){_0x21f296[_0x47a5('0x3d')]=_0x111f0d;return _0x21f296;})[_0x47a5('0x1e')](respondWithFilteredResult(_0x378208,_0x36ad34))[_0x47a5('0x3e')](handleError(_0x378208,null));}; \ No newline at end of file +var _0xb10b=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','Migration','include','rows','catch','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x345b24,_0x2af988){var _0x38f47c=function(_0x12be01){while(--_0x12be01){_0x345b24['push'](_0x345b24['shift']());}};_0x38f47c(++_0x2af988);}(_0xb10b,0x12a));var _0xbb10=function(_0x3937b6,_0xd53d2b){_0x3937b6=_0x3937b6-0x0;var _0x1ba356=_0xb10b[_0x3937b6];return _0x1ba356;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['Migration'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]));if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 16a6772..21c8dc6 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 _0x5800=['lodash','util','api','bluebird','request-promise','../../config/environment','./migration.attributes','exports','define','Migration'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0x5800,0x104));var _0x0580=function(_0x21e216,_0x26e57b){_0x21e216=_0x21e216-0x0;var _0x29ca22=_0x5800[_0x21e216];return _0x29ca22;};'use strict';var _=require(_0x0580('0x0'));var util=require(_0x0580('0x1'));var logger=require('../../config/logger')(_0x0580('0x2'));var moment=require('moment');var BPromise=require(_0x0580('0x3'));var rp=require(_0x0580('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0580('0x5'));var attributes=require(_0x0580('0x6'));module[_0x0580('0x7')]=function(_0x38cae9,_0x408346){return _0x38cae9[_0x0580('0x8')](_0x0580('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdbd=['path','rimraf','./migration.attributes','Migration','lodash','api','moment','bluebird','request-promise'];(function(_0x57414c,_0x4a0848){var _0x322dae=function(_0x3b5e7d){while(--_0x3b5e7d){_0x57414c['push'](_0x57414c['shift']());}};_0x322dae(++_0x4a0848);}(_0xbdbd,0x109));var _0xdbdb=function(_0x3ebb7e,_0x8aaa41){_0x3ebb7e=_0x3ebb7e-0x0;var _0x3e0b43=_0xbdbd[_0x3ebb7e];return _0x3e0b43;};'use strict';var _=require(_0xdbdb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdbdb('0x1'));var moment=require(_0xdbdb('0x2'));var BPromise=require(_0xdbdb('0x3'));var rp=require(_0xdbdb('0x4'));var fs=require('fs');var path=require(_0xdbdb('0x5'));var rimraf=require(_0xdbdb('0x6'));var config=require('../../config/environment');var attributes=require(_0xdbdb('0x7'));module['exports']=function(_0x56c4a8,_0x5be0a7){return _0x56c4a8['define'](_0xdbdb('0x8'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index e980cce..26a675f 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 _0xcd30=['Migration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x263b35,_0x421508){var _0x48168e=function(_0x3bb3a6){while(--_0x3bb3a6){_0x263b35['push'](_0x263b35['shift']());}};_0x48168e(++_0x421508);}(_0xcd30,0x1e8));var _0x0cd3=function(_0x1f0d91,_0x24b032){_0x1f0d91=_0x1f0d91-0x0;var _0xafee7a=_0xcd30[_0x1f0d91];return _0xafee7a;};'use strict';var _=require(_0x0cd3('0x0'));var util=require(_0x0cd3('0x1'));var moment=require(_0x0cd3('0x2'));var BPromise=require(_0x0cd3('0x3'));var rs=require(_0x0cd3('0x4'));var fs=require('fs');var Redis=require(_0x0cd3('0x5'));var db=require(_0x0cd3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cd3('0x7'))(_0x0cd3('0x8'));var config=require(_0x0cd3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0cd3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe1ece5,_0x5442ec,_0x15ff66){return new BPromise(function(_0x18d6f3,_0x111edb){return client[_0x0cd3('0xb')](_0xe1ece5,_0x15ff66)['then'](function(_0x1716b1){logger[_0x0cd3('0xc')]('Migration,\x20%s,\x20%s',_0x5442ec,_0x0cd3('0xd'));logger['debug'](_0x0cd3('0xe'),_0x5442ec,_0x0cd3('0xd'),JSON[_0x0cd3('0xf')](_0x1716b1));if(_0x1716b1[_0x0cd3('0x10')]){if(_0x1716b1[_0x0cd3('0x10')][_0x0cd3('0x11')]===0x1f4){logger[_0x0cd3('0x10')](_0x0cd3('0x12'),_0x5442ec,_0x1716b1[_0x0cd3('0x10')][_0x0cd3('0x13')]);return _0x111edb(_0x1716b1[_0x0cd3('0x10')][_0x0cd3('0x13')]);}logger[_0x0cd3('0x10')](_0x0cd3('0x12'),_0x5442ec,_0x1716b1[_0x0cd3('0x10')][_0x0cd3('0x13')]);return _0x18d6f3(_0x1716b1['error'][_0x0cd3('0x13')]);}else{logger[_0x0cd3('0xc')]('Migration,\x20%s,\x20%s',_0x5442ec,_0x0cd3('0xd'));_0x18d6f3(_0x1716b1[_0x0cd3('0x14')][_0x0cd3('0x13')]);}})[_0x0cd3('0x15')](function(_0x2e6f84){logger[_0x0cd3('0x10')](_0x0cd3('0x12'),_0x5442ec,_0x2e6f84);_0x111edb(_0x2e6f84);});});} \ No newline at end of file +var _0x717b=['jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4ba3ae,_0x919ee9){var _0x5f4f1b=function(_0x430db7){while(--_0x430db7){_0x4ba3ae['push'](_0x4ba3ae['shift']());}};_0x5f4f1b(++_0x919ee9);}(_0x717b,0x111));var _0xb717=function(_0x1b8327,_0xb5bbbc){_0x1b8327=_0x1b8327-0x0;var _0x151dff=_0x717b[_0x1b8327];return _0x151dff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb717('0x0'));var BPromise=require('bluebird');var rs=require(_0xb717('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb717('0x2'))['db'];var utils=require(_0xb717('0x3'));var logger=require(_0xb717('0x4'))(_0xb717('0x5'));var config=require(_0xb717('0x6'));var jayson=require(_0xb717('0x7'));var client=jayson['client'][_0xb717('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x549e24,_0x54916d,_0x1c4784){return new BPromise(function(_0x267491,_0x514550){return client[_0xb717('0x9')](_0x549e24,_0x1c4784)[_0xb717('0xa')](function(_0x2906f7){logger[_0xb717('0xb')](_0xb717('0xc'),_0x54916d,_0xb717('0xd'));logger[_0xb717('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x54916d,'request\x20sent',JSON[_0xb717('0xf')](_0x2906f7));if(_0x2906f7[_0xb717('0x10')]){if(_0x2906f7[_0xb717('0x10')]['code']===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x54916d,_0x2906f7[_0xb717('0x10')]['message']);return _0x514550(_0x2906f7['error'][_0xb717('0x11')]);}logger[_0xb717('0x10')](_0xb717('0xc'),_0x54916d,_0x2906f7[_0xb717('0x10')][_0xb717('0x11')]);return _0x267491(_0x2906f7['error'][_0xb717('0x11')]);}else{logger[_0xb717('0xb')](_0xb717('0xc'),_0x54916d,_0xb717('0xd'));_0x267491(_0x2906f7[_0xb717('0x12')][_0xb717('0x11')]);}})[_0xb717('0x13')](function(_0x4f26c4){logger[_0xb717('0x10')]('Migration,\x20%s,\x20%s',_0x54916d,_0x4f26c4);_0x514550(_0x4f26c4);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 16db883..74e4d0c 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 _0xd634=['../../components/auth/service','./network.controller','get','isAuthenticated','index','/:id','show','update','delete','destroy','util','path','Router'];(function(_0x2dcec9,_0x1552b8){var _0x476fc9=function(_0x31e4a0){while(--_0x31e4a0){_0x2dcec9['push'](_0x2dcec9['shift']());}};_0x476fc9(++_0x1552b8);}(_0xd634,0xf4));var _0x4d63=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0xd634[_0xa79977];return _0x109f10;};'use strict';var multer=require('multer');var util=require(_0x4d63('0x0'));var path=require(_0x4d63('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4d63('0x2')]();var auth=require(_0x4d63('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4d63('0x4'));router[_0x4d63('0x5')]('/',auth[_0x4d63('0x6')](),controller[_0x4d63('0x7')]);router[_0x4d63('0x5')](_0x4d63('0x8'),auth[_0x4d63('0x6')](),controller[_0x4d63('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x4d63('0x6')](),controller[_0x4d63('0xa')]);router[_0x4d63('0xb')]('/:id',auth[_0x4d63('0x6')](),controller[_0x4d63('0xc')]);module['exports']=router; \ No newline at end of file +var _0x22a1=['show','post','create','put','delete','exports','multer','util','path','express','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x75a6e1,_0x1292a9){var _0x27a6b2=function(_0x2ba702){while(--_0x2ba702){_0x75a6e1['push'](_0x75a6e1['shift']());}};_0x27a6b2(++_0x1292a9);}(_0x22a1,0x19b));var _0x122a=function(_0x4075ff,_0x400de8){_0x4075ff=_0x4075ff-0x0;var _0x5a79f1=_0x22a1[_0x4075ff];return _0x5a79f1;};'use strict';var multer=require(_0x122a('0x0'));var util=require(_0x122a('0x1'));var path=require(_0x122a('0x2'));var timeout=require('connect-timeout');var express=require(_0x122a('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x122a('0x4'));var controller=require('./network.controller');router[_0x122a('0x5')]('/',auth[_0x122a('0x6')](),controller[_0x122a('0x7')]);router[_0x122a('0x5')](_0x122a('0x8'),auth['isAuthenticated'](),controller[_0x122a('0x9')]);router[_0x122a('0xa')]('/',auth[_0x122a('0x6')](),controller[_0x122a('0xb')]);router[_0x122a('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x122a('0xd')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x122a('0xe')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index d8f1bd1..7965e4d 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(_0x3d3661,_0x48e32a){var _0x3f048a=function(_0x28f2b0){while(--_0x28f2b0){_0x3d3661['push'](_0x3d3661['shift']());}};_0x3f048a(++_0x48e32a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x288e68,_0x3d3b95){var _0x124eb1=function(_0x33b582){while(--_0x33b582){_0x288e68['push'](_0x288e68['shift']());}};_0x124eb1(++_0x3d3b95);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 6e27bdc..ccc37ed 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 _0xa834=['length','includeAll','include','create','sequelize','body','toUpperCase','STUN','readFileSync','join','root','utf8','render','writeFileSync','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','transaction','params','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','update','server/files/templates/network.ejs','chan_sip.so','find','rimraf','zip-dir','request-promise','moment','path','lodash','squel','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','offset','set','Content-Range','reject','destroy','end','stack','name','send','map','Network','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filter','where','VIRTUAL','merge','options','count','findAll','rows'];(function(_0x4a26d6,_0x28e669){var _0xaeab06=function(_0x2589cc){while(--_0x2589cc){_0x4a26d6['push'](_0x4a26d6['shift']());}};_0xaeab06(++_0x28e669);}(_0xa834,0x153));var _0x4a83=function(_0x44687e,_0x567cf1){_0x44687e=_0x44687e-0x0;var _0x1134a6=_0xa834[_0x44687e];return _0x1134a6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4a83('0x0'));var zipdir=require(_0x4a83('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4a83('0x2'));var moment=require(_0x4a83('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4a83('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4a83('0x5'));var squel=require(_0x4a83('0x6'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4a83('0x7'));var querystring=require(_0x4a83('0x8'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4a83('0x9'));var qs=require(_0x4a83('0xa'));var as=require(_0x4a83('0xb'));var hardwareService=require(_0x4a83('0xc'));var logger=require(_0x4a83('0xd'))(_0x4a83('0xe'));var utils=require(_0x4a83('0xf'));var config=require(_0x4a83('0x10'));var db=require(_0x4a83('0x11'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4a83('0x12')][_0x4a83('0x13')]({'port':0x232a});function checkPasswordPattern(_0x1dd4aa,_0x3d29b5,_0x1dc0ed){if(_0x1dc0ed){var _0x2c80f8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c80f8[_0x4a83('0x14')](_0x3d29b5)){return _0x1dd4aa;}else{throw new db[(_0x4a83('0x15'))][(_0x4a83('0x16'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1dd4aa;}}function respondWithRpcPromise(_0x1d0afb,_0x93005f,_0x57e774,_0x31729e){return new BPromise(function(_0x302668,_0x1adde4){var _0x1e84ba=_0x31729e||client;return _0x1e84ba[_0x4a83('0x17')](_0x1d0afb,_0x57e774)[_0x4a83('0x18')](function(_0x3fd474){logger[_0x4a83('0x19')](_0x4a83('0x1a'),_0x93005f,_0x4a83('0x1b'));logger[_0x4a83('0x1c')](_0x4a83('0x1d'),_0x93005f,'request\x20sent',JSON[_0x4a83('0x1e')](_0x3fd474));if(_0x3fd474[_0x4a83('0x1f')]){if(_0x3fd474[_0x4a83('0x1f')][_0x4a83('0x20')]===0x1f4){logger[_0x4a83('0x1f')](_0x4a83('0x1a'),_0x93005f,_0x3fd474[_0x4a83('0x1f')]['message']);return _0x1adde4(_0x3fd474[_0x4a83('0x1f')][_0x4a83('0x21')]);}logger['error'](_0x4a83('0x1a'),_0x93005f,_0x3fd474[_0x4a83('0x1f')][_0x4a83('0x21')]);return _0x302668(_0x3fd474[_0x4a83('0x1f')][_0x4a83('0x21')]);}else{logger[_0x4a83('0x19')](_0x4a83('0x1a'),_0x93005f,_0x4a83('0x1b'));_0x302668(_0x3fd474['result'][_0x4a83('0x21')]);}})[_0x4a83('0x22')](function(_0x1183f1){logger[_0x4a83('0x1f')](_0x4a83('0x1a'),_0x93005f,_0x1183f1);_0x1adde4(_0x1183f1);});});}function respondWithStatusCode(_0x5ac141,_0x20debc){_0x20debc=_0x20debc||0xcc;return function(_0x41c50f){if(_0x41c50f){return _0x5ac141[_0x4a83('0x23')](_0x20debc);}return _0x5ac141[_0x4a83('0x24')](_0x20debc)['end']();};}function respondWithResult(_0x349864,_0x5af3b6){_0x5af3b6=_0x5af3b6||0xc8;return function(_0x351ff0){if(_0x351ff0){return _0x349864[_0x4a83('0x24')](_0x5af3b6)[_0x4a83('0x25')](_0x351ff0);}};}function respondWithFilteredResult(_0x447c7b,_0x1b2051){return function(_0x1a4663){if(_0x1a4663){var _0x201914=_0x1a4663['count'],_0x1d38c9=_0x1b2051['offset'],_0x21cd74=_0x1b2051[_0x4a83('0x26')]+_0x1b2051['limit'],_0xa1788e;if(_0x21cd74>=_0x201914){_0x21cd74=_0x201914;_0xa1788e=0xc8;}else{_0xa1788e=0xce;}_0x447c7b[_0x4a83('0x24')](_0xa1788e);return _0x447c7b[_0x4a83('0x27')](_0x4a83('0x28'),_0x1d38c9+'-'+_0x21cd74+'/'+_0x201914)[_0x4a83('0x25')](_0x1a4663);}return null;};}function patchUpdates(_0x539515){return function(_0x4b05b2){try{jsonpatch['apply'](_0x4b05b2,_0x539515,!![]);}catch(_0x2ac565){return BPromise[_0x4a83('0x29')](_0x2ac565);}return _0x4b05b2['save']();};}function saveUpdates(_0x20e219,_0x4433d4){return function(_0x579e65){if(_0x579e65){return _0x579e65['update'](_0x20e219)[_0x4a83('0x18')](function(_0x354efc){return _0x354efc;});}return null;};}function removeEntity(_0x4ca04b,_0x1bccb1){return function(_0x4369c7){if(_0x4369c7){return _0x4369c7[_0x4a83('0x2a')]()[_0x4a83('0x18')](function(){_0x4ca04b[_0x4a83('0x24')](0xcc)[_0x4a83('0x2b')]();});}};}function handleEntityNotFound(_0x1e2fad,_0x4f549c){return function(_0x30bb81){if(!_0x30bb81){_0x1e2fad[_0x4a83('0x23')](0x194);}return _0x30bb81;};}function handleError(_0x1a4a6e,_0x546db2){_0x546db2=_0x546db2||0x1f4;return function(_0x29f0eb){logger['error'](_0x29f0eb[_0x4a83('0x2c')]);if(_0x29f0eb[_0x4a83('0x2d')]){delete _0x29f0eb['name'];}_0x1a4a6e['status'](_0x546db2)[_0x4a83('0x2e')](_0x29f0eb);};}exports['index']=function(_0x57e0fd,_0x2d42e1){var _0x11a52b={},_0x5d47c7={},_0x1c226b={'count':0x0,'rows':[]};var _0x2e45fc=_[_0x4a83('0x2f')](db[_0x4a83('0x30')][_0x4a83('0x31')],function(_0x459a84){return{'name':_0x459a84[_0x4a83('0x32')],'type':_0x459a84[_0x4a83('0x33')][_0x4a83('0x34')]};});_0x5d47c7['model']=_[_0x4a83('0x2f')](_0x2e45fc,_0x4a83('0x2d'));_0x5d47c7['query']=_[_0x4a83('0x35')](_0x57e0fd[_0x4a83('0x36')]);_0x5d47c7[_0x4a83('0x37')]=_[_0x4a83('0x38')](_0x5d47c7[_0x4a83('0x39')],_0x5d47c7['query']);_0x11a52b[_0x4a83('0x3a')]=_[_0x4a83('0x38')](_0x5d47c7[_0x4a83('0x39')],qs['fields'](_0x57e0fd['query'][_0x4a83('0x3b')]));_0x11a52b[_0x4a83('0x3a')]=_0x11a52b[_0x4a83('0x3a')]['length']?_0x11a52b['attributes']:_0x5d47c7['model'];if(!_0x57e0fd[_0x4a83('0x36')][_0x4a83('0x3c')](_0x4a83('0x3d'))){_0x11a52b[_0x4a83('0x3e')]=qs[_0x4a83('0x3e')](_0x57e0fd[_0x4a83('0x36')][_0x4a83('0x3e')]);_0x11a52b['offset']=qs[_0x4a83('0x26')](_0x57e0fd[_0x4a83('0x36')][_0x4a83('0x26')]);}_0x11a52b[_0x4a83('0x3f')]=qs[_0x4a83('0x40')](_0x57e0fd[_0x4a83('0x36')][_0x4a83('0x40')]);_0x11a52b['where']=qs[_0x4a83('0x37')](_['pick'](_0x57e0fd['query'],_0x5d47c7['filters']));if(_0x57e0fd['query'][_0x4a83('0x41')]){_0x11a52b[_0x4a83('0x42')]=_['merge'](_0x11a52b[_0x4a83('0x42')],{'$or':_['map'](_0x2e45fc,function(_0x330775){if(_0x330775['type']!==_0x4a83('0x43')){var _0xa665bc={};_0xa665bc[_0x330775[_0x4a83('0x2d')]]={'$like':'%'+_0x57e0fd[_0x4a83('0x36')][_0x4a83('0x41')]+'%'};return _0xa665bc;}})});}_0x11a52b=_[_0x4a83('0x44')]({},_0x11a52b,_0x57e0fd[_0x4a83('0x45')]);var _0x478b05={'where':_0x11a52b[_0x4a83('0x42')]};return db['Network'][_0x4a83('0x46')](_0x478b05)['then'](function(_0x4e2106){_0x1c226b['count']=_0x4e2106;if(_0x57e0fd[_0x4a83('0x36')]['includeAll']){_0x11a52b['include']=[{'all':!![]}];}return db['Network'][_0x4a83('0x47')](_0x11a52b);})[_0x4a83('0x18')](function(_0x2b61d3){_0x1c226b[_0x4a83('0x48')]=_0x2b61d3;return _0x1c226b;})[_0x4a83('0x18')](respondWithFilteredResult(_0x2d42e1,_0x11a52b))[_0x4a83('0x22')](handleError(_0x2d42e1,null));};exports['show']=function(_0x1ca2a0,_0x316430){var _0x466551={'raw':!![],'where':{'id':_0x1ca2a0['params']['id']}},_0x1424f0={};_0x1424f0[_0x4a83('0x39')]=_['keys'](db['Network']['rawAttributes']);_0x1424f0['query']=_[_0x4a83('0x35')](_0x1ca2a0['query']);_0x1424f0[_0x4a83('0x37')]=_['intersection'](_0x1424f0[_0x4a83('0x39')],_0x1424f0[_0x4a83('0x36')]);_0x466551[_0x4a83('0x3a')]=_[_0x4a83('0x38')](_0x1424f0['model'],qs['fields'](_0x1ca2a0[_0x4a83('0x36')]['fields']));_0x466551[_0x4a83('0x3a')]=_0x466551[_0x4a83('0x3a')][_0x4a83('0x49')]?_0x466551['attributes']:_0x1424f0[_0x4a83('0x39')];if(_0x1ca2a0['query'][_0x4a83('0x4a')]){_0x466551[_0x4a83('0x4b')]=[{'all':!![]}];}_0x466551=_['merge']({},_0x466551,_0x1ca2a0[_0x4a83('0x45')]);return db['Network']['find'](_0x466551)[_0x4a83('0x18')](handleEntityNotFound(_0x316430,null))[_0x4a83('0x18')](respondWithResult(_0x316430,null))['catch'](handleError(_0x316430,null));};exports[_0x4a83('0x4c')]=function(_0x4d9c15,_0x3c304c,_0x471f52){var _0x3db182;return db[_0x4a83('0x4d')]['transaction'](function(_0x1047f5){return db[_0x4a83('0x30')][_0x4a83('0x4c')](_0x4d9c15[_0x4a83('0x4e')],{'raw':!![]})[_0x4a83('0x18')](function(_0xa746ef){_0x3db182=_0xa746ef;return db[_0x4a83('0x30')][_0x4a83('0x47')]({'where':{'type':_0x4d9c15['body'][_0x4a83('0x33')]},'raw':!![]});})[_0x4a83('0x18')](function(_0x424841){if(_0x3db182[_0x4a83('0x33')][_0x4a83('0x4f')]()==_0x4a83('0x50')){var _0x286785=fs[_0x4a83('0x51')](path[_0x4a83('0x52')](config[_0x4a83('0x53')],'server/files/templates/stun_multiple.ejs'),_0x4a83('0x54'));var _0x20609e=ejs[_0x4a83('0x55')](_0x286785,{'networks':_0x424841||[]});fs[_0x4a83('0x56')]('/etc/asterisk/stun_xcally.conf',_0x20609e);return respondWithRpcPromise(_0x4a83('0x57'),'create',{'module':_0x4a83('0x58')});}else if(_0x3db182[_0x4a83('0x33')][_0x4a83('0x4f')]()==_0x4a83('0x59')){var _0x1bf7e6=fs[_0x4a83('0x51')](path['join'](config[_0x4a83('0x53')],_0x4a83('0x5a')),_0x4a83('0x54'));var _0x2a85b5=ejs[_0x4a83('0x55')](_0x1bf7e6,{'networks':_0x424841||[]});fs[_0x4a83('0x56')](_0x4a83('0x5b'),_0x2a85b5);return respondWithRpcPromise(_0x4a83('0x57'),_0x4a83('0x4c'),{'module':_0x4a83('0x58')});}else{var _0x4c6c8f=fs[_0x4a83('0x51')](path[_0x4a83('0x52')](config['root'],'server/files/templates/network.ejs'),_0x4a83('0x54'));var _0x49d249=ejs[_0x4a83('0x55')](_0x4c6c8f,{'networks':_0x424841||[]});fs[_0x4a83('0x56')](util[_0x4a83('0x5c')](_0x4a83('0x5d'),_0x4d9c15[_0x4a83('0x4e')][_0x4a83('0x33')][_0x4a83('0x5e')]()),_0x49d249);return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x3db182;});})[_0x4a83('0x18')](respondWithResult(_0x3c304c,0xc9))['catch'](handleError(_0x3c304c,null));};exports['update']=function(_0x709869,_0x3d25cc,_0xd6ce20){var _0xaf5ef5;return db[_0x4a83('0x4d')][_0x4a83('0x5f')](function(_0xc8c45a){return db[_0x4a83('0x30')]['find']({'where':{'id':_0x709869[_0x4a83('0x60')]['id']}})[_0x4a83('0x18')](handleEntityNotFound(_0x3d25cc,null))[_0x4a83('0x18')](saveUpdates(_0x709869[_0x4a83('0x4e')],null))[_0x4a83('0x18')](function(_0x36e844){if(_0x36e844){_0xaf5ef5=_0x36e844;return db['Network']['findAll']({'where':{'type':_0xaf5ef5[_0x4a83('0x33')]},'raw':!![]});}return null;})[_0x4a83('0x18')](function(_0x198354){if(_0xaf5ef5[_0x4a83('0x33')][_0x4a83('0x4f')]()==_0x4a83('0x50')){var _0x569509=fs[_0x4a83('0x51')](path['join'](config[_0x4a83('0x53')],_0x4a83('0x61')),_0x4a83('0x54'));var _0x3b5827=ejs[_0x4a83('0x55')](_0x569509,{'networks':_0x198354||[]});fs[_0x4a83('0x56')](_0x4a83('0x62'),_0x3b5827);return respondWithRpcPromise('Reload','update',{'module':_0x4a83('0x58')});}else if(_0xaf5ef5[_0x4a83('0x33')]['toUpperCase']()=='TURN'){var _0x3ea8f3=fs[_0x4a83('0x51')](path[_0x4a83('0x52')](config[_0x4a83('0x53')],_0x4a83('0x5a')),_0x4a83('0x54'));var _0x35536d=ejs[_0x4a83('0x55')](_0x3ea8f3,{'networks':_0x198354||[]});fs[_0x4a83('0x56')](_0x4a83('0x5b'),_0x35536d);return respondWithRpcPromise(_0x4a83('0x57'),_0x4a83('0x63'),{'module':_0x4a83('0x58')});}else{var _0x1e28b9=fs[_0x4a83('0x51')](path[_0x4a83('0x52')](config[_0x4a83('0x53')],_0x4a83('0x64')),_0x4a83('0x54'));var _0x29a2d6=ejs[_0x4a83('0x55')](_0x1e28b9,{'networks':_0x198354||[]});fs[_0x4a83('0x56')](util['format'](_0x4a83('0x5d'),_0x709869[_0x4a83('0x4e')][_0x4a83('0x33')][_0x4a83('0x5e')]()),_0x29a2d6);return respondWithRpcPromise('Reload',_0x4a83('0x63'),{'module':_0x4a83('0x65')});}return null;})['then'](function(_0x14d482){if(_0x14d482){return _0xaf5ef5;}return null;});})['then'](respondWithResult(_0x3d25cc,null))[_0x4a83('0x22')](handleError(_0x3d25cc,null));};exports[_0x4a83('0x2a')]=function(_0x500f5d,_0x428b48,_0x1d8710){var _0x3862b6;return db[_0x4a83('0x30')][_0x4a83('0x66')]({'where':{'id':_0x500f5d[_0x4a83('0x60')]['id']}})[_0x4a83('0x18')](function(_0x9246fc){_0x3862b6=_0x9246fc;return _0x9246fc;})[_0x4a83('0x18')](handleEntityNotFound(_0x428b48,null))[_0x4a83('0x18')](removeEntity(_0x428b48,null))[_0x4a83('0x18')](function(){if(_0x3862b6){return db[_0x4a83('0x30')][_0x4a83('0x47')]({'where':{'type':_0x3862b6[_0x4a83('0x33')]},'raw':!![]});}})[_0x4a83('0x18')](function(_0x379267){if(_0x3862b6[_0x4a83('0x33')][_0x4a83('0x4f')]()==_0x4a83('0x50')){var _0x10e54b=fs[_0x4a83('0x51')](path[_0x4a83('0x52')](config['root'],_0x4a83('0x61')),'utf8');var _0x54b811=ejs['render'](_0x10e54b,{'networks':_0x379267||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x54b811);return respondWithRpcPromise(_0x4a83('0x57'),_0x4a83('0x2a'),{'module':_0x4a83('0x58')});}else if(_0x3862b6[_0x4a83('0x33')][_0x4a83('0x4f')]()==_0x4a83('0x59')){var _0x3e1e6a=fs['readFileSync'](path[_0x4a83('0x52')](config[_0x4a83('0x53')],'server/files/templates/turn_multiple.ejs'),_0x4a83('0x54'));var _0x38e5ae=ejs['render'](_0x3e1e6a,{'networks':_0x379267||[]});fs[_0x4a83('0x56')](_0x4a83('0x5b'),_0x38e5ae);return respondWithRpcPromise(_0x4a83('0x57'),'destroy',{'module':_0x4a83('0x58')});}else{var _0x570a70=fs[_0x4a83('0x51')](path[_0x4a83('0x52')](config[_0x4a83('0x53')],_0x4a83('0x64')),_0x4a83('0x54'));var _0x251ac7=ejs[_0x4a83('0x55')](_0x570a70,{'networks':_0x379267||[]});fs[_0x4a83('0x56')](util[_0x4a83('0x5c')](_0x4a83('0x5d'),_0x500f5d[_0x4a83('0x4e')]['type']['toLowerCase']()),_0x251ac7);return respondWithRpcPromise(_0x4a83('0x57'),_0x4a83('0x2a'),{'module':_0x4a83('0x65')});}return null;})[_0x4a83('0x22')](handleError(_0x428b48,null));}; \ No newline at end of file +var _0x4429=['include','sequelize','transaction','create','body','toUpperCase','STUN','readFileSync','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','join','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','root','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','find','utf8','server/files/templates/turn_multiple.ejs','format','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','status','json','count','offset','limit','set','Content-Range','save','destroy','stack','name','index','map','Network','rawAttributes','type','model','query','keys','intersection','attributes','fields','nolimit','order','where','filters','filter','merge','options','findAll','rows','show','params','length','includeAll'];(function(_0x5b60b8,_0xcbf20a){var _0x2d1048=function(_0x3f6731){while(--_0x3f6731){_0x5b60b8['push'](_0x5b60b8['shift']());}};_0x2d1048(++_0xcbf20a);}(_0x4429,0x1bf));var _0x9442=function(_0x2fbcc0,_0x46ddb8){_0x2fbcc0=_0x2fbcc0-0x0;var _0x1a766e=_0x4429[_0x2fbcc0];return _0x1a766e;};'use strict';var pdf=require(_0x9442('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9442('0x1'));var jsonpatch=require(_0x9442('0x2'));var rp=require(_0x9442('0x3'));var moment=require(_0x9442('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9442('0x5'));var util=require(_0x9442('0x6'));var path=require(_0x9442('0x7'));var sox=require('sox');var csv=require(_0x9442('0x8'));var ejs=require(_0x9442('0x9'));var fs=require('fs');var _=require(_0x9442('0xa'));var squel=require(_0x9442('0xb'));var crypto=require(_0x9442('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9442('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9442('0xe'));var Papa=require('papaparse');var Redis=require(_0x9442('0xf'));var authService=require(_0x9442('0x10'));var qs=require(_0x9442('0x11'));var as=require(_0x9442('0x12'));var hardwareService=require(_0x9442('0x13'));var logger=require(_0x9442('0x14'))(_0x9442('0x15'));var utils=require(_0x9442('0x16'));var config=require(_0x9442('0x17'));var db=require(_0x9442('0x18'))['db'];var jayson=require(_0x9442('0x19'));var client=jayson[_0x9442('0x1a')][_0x9442('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x5db759,_0x2446e2,_0x503a90){if(_0x503a90){var _0x3fb784=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3fb784[_0x9442('0x1c')](_0x2446e2)){return _0x5db759;}else{throw new db[(_0x9442('0x1d'))]['ValidationError'](_0x9442('0x1e'));}}else{return _0x5db759;}}function respondWithRpcPromise(_0x1c3602,_0x445554,_0x5315a4,_0x27bdfa){return new BPromise(function(_0x16c5b3,_0x55ef99){var _0x3e726f=_0x27bdfa||client;return _0x3e726f[_0x9442('0x1f')](_0x1c3602,_0x5315a4)[_0x9442('0x20')](function(_0x57fcbe){logger['info']('Network,\x20%s,\x20%s',_0x445554,_0x9442('0x21'));logger[_0x9442('0x22')](_0x9442('0x23'),_0x445554,'request\x20sent',JSON[_0x9442('0x24')](_0x57fcbe));if(_0x57fcbe[_0x9442('0x25')]){if(_0x57fcbe[_0x9442('0x25')][_0x9442('0x26')]===0x1f4){logger[_0x9442('0x25')](_0x9442('0x27'),_0x445554,_0x57fcbe[_0x9442('0x25')]['message']);return _0x55ef99(_0x57fcbe[_0x9442('0x25')][_0x9442('0x28')]);}logger[_0x9442('0x25')](_0x9442('0x27'),_0x445554,_0x57fcbe[_0x9442('0x25')][_0x9442('0x28')]);return _0x16c5b3(_0x57fcbe[_0x9442('0x25')][_0x9442('0x28')]);}else{logger['info'](_0x9442('0x27'),_0x445554,_0x9442('0x21'));_0x16c5b3(_0x57fcbe[_0x9442('0x29')][_0x9442('0x28')]);}})[_0x9442('0x2a')](function(_0x207789){logger[_0x9442('0x25')](_0x9442('0x27'),_0x445554,_0x207789);_0x55ef99(_0x207789);});});}function respondWithStatusCode(_0x3bf7e6,_0x48b0f8){_0x48b0f8=_0x48b0f8||0xcc;return function(_0x1ffa91){if(_0x1ffa91){return _0x3bf7e6['sendStatus'](_0x48b0f8);}return _0x3bf7e6[_0x9442('0x2b')](_0x48b0f8)['end']();};}function respondWithResult(_0x3e30ad,_0x16a393){_0x16a393=_0x16a393||0xc8;return function(_0x5f0d3b){if(_0x5f0d3b){return _0x3e30ad[_0x9442('0x2b')](_0x16a393)[_0x9442('0x2c')](_0x5f0d3b);}};}function respondWithFilteredResult(_0xf175ef,_0x3cf760){return function(_0xf542a7){if(_0xf542a7){var _0x546fbb=_0xf542a7[_0x9442('0x2d')],_0x1e2b20=_0x3cf760[_0x9442('0x2e')],_0x4f5517=_0x3cf760['offset']+_0x3cf760[_0x9442('0x2f')],_0x124d54;if(_0x4f5517>=_0x546fbb){_0x4f5517=_0x546fbb;_0x124d54=0xc8;}else{_0x124d54=0xce;}_0xf175ef['status'](_0x124d54);return _0xf175ef[_0x9442('0x30')](_0x9442('0x31'),_0x1e2b20+'-'+_0x4f5517+'/'+_0x546fbb)['json'](_0xf542a7);}return null;};}function patchUpdates(_0x2cc6b5){return function(_0x4e19bf){try{jsonpatch['apply'](_0x4e19bf,_0x2cc6b5,!![]);}catch(_0x38f36a){return BPromise['reject'](_0x38f36a);}return _0x4e19bf[_0x9442('0x32')]();};}function saveUpdates(_0x3685cf,_0x482afb){return function(_0x25d88c){if(_0x25d88c){return _0x25d88c['update'](_0x3685cf)[_0x9442('0x20')](function(_0x4d800f){return _0x4d800f;});}return null;};}function removeEntity(_0x5e7332,_0x9b0776){return function(_0x346509){if(_0x346509){return _0x346509[_0x9442('0x33')]()[_0x9442('0x20')](function(){_0x5e7332[_0x9442('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56df7d,_0x5c9fd6){return function(_0x10497c){if(!_0x10497c){_0x56df7d['sendStatus'](0x194);}return _0x10497c;};}function handleError(_0x304e23,_0x3a069a){_0x3a069a=_0x3a069a||0x1f4;return function(_0x492639){logger[_0x9442('0x25')](_0x492639[_0x9442('0x34')]);if(_0x492639[_0x9442('0x35')]){delete _0x492639[_0x9442('0x35')];}_0x304e23['status'](_0x3a069a)['send'](_0x492639);};}exports[_0x9442('0x36')]=function(_0x13d03d,_0x347475){var _0x4c7f75={},_0x40d9c7={},_0x3d7138={'count':0x0,'rows':[]};var _0x49ebd1=_[_0x9442('0x37')](db[_0x9442('0x38')][_0x9442('0x39')],function(_0x24c996){return{'name':_0x24c996['fieldName'],'type':_0x24c996[_0x9442('0x3a')]['key']};});_0x40d9c7[_0x9442('0x3b')]=_[_0x9442('0x37')](_0x49ebd1,_0x9442('0x35'));_0x40d9c7[_0x9442('0x3c')]=_[_0x9442('0x3d')](_0x13d03d[_0x9442('0x3c')]);_0x40d9c7['filters']=_[_0x9442('0x3e')](_0x40d9c7['model'],_0x40d9c7[_0x9442('0x3c')]);_0x4c7f75[_0x9442('0x3f')]=_['intersection'](_0x40d9c7[_0x9442('0x3b')],qs[_0x9442('0x40')](_0x13d03d[_0x9442('0x3c')][_0x9442('0x40')]));_0x4c7f75['attributes']=_0x4c7f75['attributes']['length']?_0x4c7f75[_0x9442('0x3f')]:_0x40d9c7[_0x9442('0x3b')];if(!_0x13d03d[_0x9442('0x3c')]['hasOwnProperty'](_0x9442('0x41'))){_0x4c7f75['limit']=qs[_0x9442('0x2f')](_0x13d03d['query'][_0x9442('0x2f')]);_0x4c7f75[_0x9442('0x2e')]=qs[_0x9442('0x2e')](_0x13d03d[_0x9442('0x3c')]['offset']);}_0x4c7f75[_0x9442('0x42')]=qs['sort'](_0x13d03d[_0x9442('0x3c')]['sort']);_0x4c7f75[_0x9442('0x43')]=qs[_0x9442('0x44')](_['pick'](_0x13d03d[_0x9442('0x3c')],_0x40d9c7[_0x9442('0x44')]));if(_0x13d03d[_0x9442('0x3c')][_0x9442('0x45')]){_0x4c7f75[_0x9442('0x43')]=_['merge'](_0x4c7f75[_0x9442('0x43')],{'$or':_[_0x9442('0x37')](_0x49ebd1,function(_0x5175f8){if(_0x5175f8[_0x9442('0x3a')]!=='VIRTUAL'){var _0x498084={};_0x498084[_0x5175f8[_0x9442('0x35')]]={'$like':'%'+_0x13d03d[_0x9442('0x3c')]['filter']+'%'};return _0x498084;}})});}_0x4c7f75=_[_0x9442('0x46')]({},_0x4c7f75,_0x13d03d[_0x9442('0x47')]);var _0x3b5cb3={'where':_0x4c7f75[_0x9442('0x43')]};return db[_0x9442('0x38')]['count'](_0x3b5cb3)[_0x9442('0x20')](function(_0x45e8c4){_0x3d7138[_0x9442('0x2d')]=_0x45e8c4;if(_0x13d03d[_0x9442('0x3c')]['includeAll']){_0x4c7f75['include']=[{'all':!![]}];}return db[_0x9442('0x38')][_0x9442('0x48')](_0x4c7f75);})[_0x9442('0x20')](function(_0x1198d0){_0x3d7138[_0x9442('0x49')]=_0x1198d0;return _0x3d7138;})[_0x9442('0x20')](respondWithFilteredResult(_0x347475,_0x4c7f75))[_0x9442('0x2a')](handleError(_0x347475,null));};exports[_0x9442('0x4a')]=function(_0x23b21f,_0x1b98fc){var _0x5c4016={'raw':!![],'where':{'id':_0x23b21f[_0x9442('0x4b')]['id']}},_0x4ff407={};_0x4ff407['model']=_['keys'](db[_0x9442('0x38')][_0x9442('0x39')]);_0x4ff407[_0x9442('0x3c')]=_[_0x9442('0x3d')](_0x23b21f['query']);_0x4ff407[_0x9442('0x44')]=_[_0x9442('0x3e')](_0x4ff407['model'],_0x4ff407[_0x9442('0x3c')]);_0x5c4016[_0x9442('0x3f')]=_['intersection'](_0x4ff407[_0x9442('0x3b')],qs[_0x9442('0x40')](_0x23b21f[_0x9442('0x3c')][_0x9442('0x40')]));_0x5c4016[_0x9442('0x3f')]=_0x5c4016[_0x9442('0x3f')][_0x9442('0x4c')]?_0x5c4016['attributes']:_0x4ff407[_0x9442('0x3b')];if(_0x23b21f[_0x9442('0x3c')][_0x9442('0x4d')]){_0x5c4016[_0x9442('0x4e')]=[{'all':!![]}];}_0x5c4016=_[_0x9442('0x46')]({},_0x5c4016,_0x23b21f[_0x9442('0x47')]);return db[_0x9442('0x38')]['find'](_0x5c4016)[_0x9442('0x20')](handleEntityNotFound(_0x1b98fc,null))[_0x9442('0x20')](respondWithResult(_0x1b98fc,null))['catch'](handleError(_0x1b98fc,null));};exports['create']=function(_0x1ef33e,_0x4f76b0,_0x497264){var _0x474d94;return db[_0x9442('0x4f')][_0x9442('0x50')](function(_0x23d548){return db[_0x9442('0x38')][_0x9442('0x51')](_0x1ef33e['body'],{'raw':!![]})[_0x9442('0x20')](function(_0xb90bd3){_0x474d94=_0xb90bd3;return db[_0x9442('0x38')][_0x9442('0x48')]({'where':{'type':_0x1ef33e[_0x9442('0x52')][_0x9442('0x3a')]},'raw':!![]});})['then'](function(_0x318711){if(_0x474d94[_0x9442('0x3a')][_0x9442('0x53')]()==_0x9442('0x54')){var _0x1921a3=fs[_0x9442('0x55')](path['join'](config['root'],_0x9442('0x56')),'utf8');var _0x326558=ejs[_0x9442('0x57')](_0x1921a3,{'networks':_0x318711||[]});fs[_0x9442('0x58')](_0x9442('0x59'),_0x326558);return respondWithRpcPromise(_0x9442('0x5a'),'create',{'module':'res_stun_monitor.so'});}else if(_0x474d94[_0x9442('0x3a')]['toUpperCase']()==_0x9442('0x5b')){var _0x3da097=fs[_0x9442('0x55')](path[_0x9442('0x5c')](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x3a9e61=ejs[_0x9442('0x57')](_0x3da097,{'networks':_0x318711||[]});fs[_0x9442('0x58')](_0x9442('0x5d'),_0x3a9e61);return respondWithRpcPromise(_0x9442('0x5a'),'create',{'module':_0x9442('0x5e')});}else{var _0x27793f=fs['readFileSync'](path[_0x9442('0x5c')](config[_0x9442('0x5f')],_0x9442('0x60')),'utf8');var _0x3e559f=ejs['render'](_0x27793f,{'networks':_0x318711||[]});fs[_0x9442('0x58')](util['format'](_0x9442('0x61'),_0x1ef33e[_0x9442('0x52')][_0x9442('0x3a')][_0x9442('0x62')]()),_0x3e559f);return respondWithRpcPromise(_0x9442('0x5a'),_0x9442('0x51'),{'module':_0x9442('0x63')});}return null;})[_0x9442('0x20')](function(){return _0x474d94;});})[_0x9442('0x20')](respondWithResult(_0x4f76b0,0xc9))[_0x9442('0x2a')](handleError(_0x4f76b0,null));};exports[_0x9442('0x64')]=function(_0x49aca5,_0x4b1ca1,_0x115e4d){var _0x4c0e6a;return db[_0x9442('0x4f')]['transaction'](function(_0x5dbb2e){return db[_0x9442('0x38')][_0x9442('0x65')]({'where':{'id':_0x49aca5['params']['id']}})[_0x9442('0x20')](handleEntityNotFound(_0x4b1ca1,null))[_0x9442('0x20')](saveUpdates(_0x49aca5[_0x9442('0x52')],null))[_0x9442('0x20')](function(_0xdebeea){if(_0xdebeea){_0x4c0e6a=_0xdebeea;return db[_0x9442('0x38')][_0x9442('0x48')]({'where':{'type':_0x4c0e6a['type']},'raw':!![]});}return null;})['then'](function(_0x3bdc79){if(_0x4c0e6a[_0x9442('0x3a')][_0x9442('0x53')]()=='STUN'){var _0x1fef57=fs['readFileSync'](path[_0x9442('0x5c')](config['root'],_0x9442('0x56')),_0x9442('0x66'));var _0x41d85d=ejs[_0x9442('0x57')](_0x1fef57,{'networks':_0x3bdc79||[]});fs[_0x9442('0x58')]('/etc/asterisk/stun_xcally.conf',_0x41d85d);return respondWithRpcPromise(_0x9442('0x5a'),'update',{'module':_0x9442('0x5e')});}else if(_0x4c0e6a[_0x9442('0x3a')][_0x9442('0x53')]()=='TURN'){var _0x1e6308=fs['readFileSync'](path[_0x9442('0x5c')](config[_0x9442('0x5f')],_0x9442('0x67')),_0x9442('0x66'));var _0xa9cc8d=ejs['render'](_0x1e6308,{'networks':_0x3bdc79||[]});fs[_0x9442('0x58')](_0x9442('0x5d'),_0xa9cc8d);return respondWithRpcPromise(_0x9442('0x5a'),_0x9442('0x64'),{'module':_0x9442('0x5e')});}else{var _0x2075d4=fs[_0x9442('0x55')](path[_0x9442('0x5c')](config['root'],_0x9442('0x60')),_0x9442('0x66'));var _0x58017c=ejs[_0x9442('0x57')](_0x2075d4,{'networks':_0x3bdc79||[]});fs[_0x9442('0x58')](util['format'](_0x9442('0x61'),_0x49aca5[_0x9442('0x52')][_0x9442('0x3a')][_0x9442('0x62')]()),_0x58017c);return respondWithRpcPromise(_0x9442('0x5a'),_0x9442('0x64'),{'module':_0x9442('0x63')});}return null;})['then'](function(_0xc026e){if(_0xc026e){return _0x4c0e6a;}return null;});})[_0x9442('0x20')](respondWithResult(_0x4b1ca1,null))['catch'](handleError(_0x4b1ca1,null));};exports['destroy']=function(_0x1ff2db,_0x297f65,_0x2f6cb9){var _0x1acb35;return db[_0x9442('0x38')][_0x9442('0x65')]({'where':{'id':_0x1ff2db[_0x9442('0x4b')]['id']}})[_0x9442('0x20')](function(_0x341783){_0x1acb35=_0x341783;return _0x341783;})['then'](handleEntityNotFound(_0x297f65,null))[_0x9442('0x20')](removeEntity(_0x297f65,null))[_0x9442('0x20')](function(){if(_0x1acb35){return db['Network']['findAll']({'where':{'type':_0x1acb35['type']},'raw':!![]});}})[_0x9442('0x20')](function(_0x2f7906){if(_0x1acb35['type']['toUpperCase']()==_0x9442('0x54')){var _0x36a649=fs['readFileSync'](path['join'](config[_0x9442('0x5f')],_0x9442('0x56')),_0x9442('0x66'));var _0x23111e=ejs[_0x9442('0x57')](_0x36a649,{'networks':_0x2f7906||[]});fs[_0x9442('0x58')](_0x9442('0x59'),_0x23111e);return respondWithRpcPromise('Reload','destroy',{'module':_0x9442('0x5e')});}else if(_0x1acb35['type'][_0x9442('0x53')]()==_0x9442('0x5b')){var _0x29fd02=fs[_0x9442('0x55')](path['join'](config['root'],_0x9442('0x67')),'utf8');var _0x1292f5=ejs[_0x9442('0x57')](_0x29fd02,{'networks':_0x2f7906||[]});fs['writeFileSync'](_0x9442('0x5d'),_0x1292f5);return respondWithRpcPromise(_0x9442('0x5a'),_0x9442('0x33'),{'module':_0x9442('0x5e')});}else{var _0x4cd55e=fs[_0x9442('0x55')](path[_0x9442('0x5c')](config[_0x9442('0x5f')],_0x9442('0x60')),_0x9442('0x66'));var _0x2ed82b=ejs[_0x9442('0x57')](_0x4cd55e,{'networks':_0x2f7906||[]});fs['writeFileSync'](util[_0x9442('0x68')](_0x9442('0x61'),_0x1ff2db[_0x9442('0x52')]['type'][_0x9442('0x62')]()),_0x2ed82b);return respondWithRpcPromise(_0x9442('0x5a'),_0x9442('0x33'),{'module':_0x9442('0x63')});}return null;})[_0x9442('0x2a')](handleError(_0x297f65,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index e734e24..be15036 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 _0xe424=['exports','define','Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./network.attributes'];(function(_0x9ea249,_0x4478c9){var _0x2eab06=function(_0x9f9f79){while(--_0x9f9f79){_0x9ea249['push'](_0x9ea249['shift']());}};_0x2eab06(++_0x4478c9);}(_0xe424,0x1a8));var _0x4e42=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0xe424[_0x286726];return _0xcd4fe9;};'use strict';var _=require(_0x4e42('0x0'));var util=require(_0x4e42('0x1'));var logger=require(_0x4e42('0x2'))(_0x4e42('0x3'));var moment=require(_0x4e42('0x4'));var BPromise=require(_0x4e42('0x5'));var rp=require(_0x4e42('0x6'));var fs=require('fs');var path=require(_0x4e42('0x7'));var rimraf=require('rimraf');var config=require(_0x4e42('0x8'));var attributes=require(_0x4e42('0x9'));module[_0x4e42('0xa')]=function(_0x351376,_0x300881){return _0x351376[_0x4e42('0xb')](_0x4e42('0xc'),attributes,{'tableName':_0x4e42('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5490=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util'];(function(_0x44ea61,_0x468f1b){var _0x19900b=function(_0x2f500d){while(--_0x2f500d){_0x44ea61['push'](_0x44ea61['shift']());}};_0x19900b(++_0x468f1b);}(_0x5490,0x1ed));var _0x0549=function(_0x4571bb,_0x27facc){_0x4571bb=_0x4571bb-0x0;var _0x481ae9=_0x5490[_0x4571bb];return _0x481ae9;};'use strict';var _=require(_0x0549('0x0'));var util=require(_0x0549('0x1'));var logger=require(_0x0549('0x2'))(_0x0549('0x3'));var moment=require(_0x0549('0x4'));var BPromise=require('bluebird');var rp=require(_0x0549('0x5'));var fs=require('fs');var path=require(_0x0549('0x6'));var rimraf=require(_0x0549('0x7'));var config=require(_0x0549('0x8'));var attributes=require('./network.attributes');module[_0x0549('0x9')]=function(_0x2b35b2,_0x3c4974){return _0x2b35b2[_0x0549('0xa')]('Network',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 5427319..ed5fb47 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 _0x2f9d=['request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s'];(function(_0x3c77f9,_0x2abb07){var _0x41790a=function(_0x363994){while(--_0x363994){_0x3c77f9['push'](_0x3c77f9['shift']());}};_0x41790a(++_0x2abb07);}(_0x2f9d,0x192));var _0xd2f9=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x2f9d[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0xd2f9('0x0'));var util=require(_0xd2f9('0x1'));var moment=require(_0xd2f9('0x2'));var BPromise=require('bluebird');var rs=require(_0xd2f9('0x3'));var fs=require('fs');var Redis=require(_0xd2f9('0x4'));var db=require(_0xd2f9('0x5'))['db'];var utils=require(_0xd2f9('0x6'));var logger=require('../../config/logger')(_0xd2f9('0x7'));var config=require(_0xd2f9('0x8'));var jayson=require(_0xd2f9('0x9'));var client=jayson['client'][_0xd2f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12ce7a,_0x78ada0,_0xcd482b){return new BPromise(function(_0x9bf42e,_0x88fcff){return client[_0xd2f9('0xb')](_0x12ce7a,_0xcd482b)[_0xd2f9('0xc')](function(_0x4e0826){logger[_0xd2f9('0xd')](_0xd2f9('0xe'),_0x78ada0,'request\x20sent');logger['debug'](_0xd2f9('0xf'),_0x78ada0,_0xd2f9('0x10'),JSON['stringify'](_0x4e0826));if(_0x4e0826[_0xd2f9('0x11')]){if(_0x4e0826['error'][_0xd2f9('0x12')]===0x1f4){logger[_0xd2f9('0x11')](_0xd2f9('0xe'),_0x78ada0,_0x4e0826[_0xd2f9('0x11')][_0xd2f9('0x13')]);return _0x88fcff(_0x4e0826[_0xd2f9('0x11')][_0xd2f9('0x13')]);}logger['error']('Network,\x20%s,\x20%s',_0x78ada0,_0x4e0826[_0xd2f9('0x11')][_0xd2f9('0x13')]);return _0x9bf42e(_0x4e0826[_0xd2f9('0x11')][_0xd2f9('0x13')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x78ada0,_0xd2f9('0x10'));_0x9bf42e(_0x4e0826[_0xd2f9('0x14')][_0xd2f9('0x13')]);}})[_0xd2f9('0x15')](function(_0x53e013){logger[_0xd2f9('0x11')]('Network,\x20%s,\x20%s',_0x78ada0,_0x53e013);_0x88fcff(_0x53e013);});});} \ No newline at end of file +var _0x2c5c=['../../config/logger','rpc','../../config/environment','then','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','randomstring','../../config/utils'];(function(_0x48084f,_0x2d1e50){var _0x215480=function(_0x3662ef){while(--_0x3662ef){_0x48084f['push'](_0x48084f['shift']());}};_0x215480(++_0x2d1e50);}(_0x2c5c,0x150));var _0xc2c5=function(_0x66d410,_0x134083){_0x66d410=_0x66d410-0x0;var _0x16d924=_0x2c5c[_0x66d410];return _0x16d924;};'use strict';var _=require(_0xc2c5('0x0'));var util=require(_0xc2c5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc2c5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc2c5('0x3'));var logger=require(_0xc2c5('0x4'))(_0xc2c5('0x5'));var config=require(_0xc2c5('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16e69f,_0x3bf597,_0x249998){return new BPromise(function(_0x2be289,_0x50b0a6){return client['request'](_0x16e69f,_0x249998)[_0xc2c5('0x7')](function(_0x330460){logger['info'](_0xc2c5('0x8'),_0x3bf597,'request\x20sent');logger['debug'](_0xc2c5('0x9'),_0x3bf597,_0xc2c5('0xa'),JSON[_0xc2c5('0xb')](_0x330460));if(_0x330460[_0xc2c5('0xc')]){if(_0x330460['error'][_0xc2c5('0xd')]===0x1f4){logger['error'](_0xc2c5('0x8'),_0x3bf597,_0x330460[_0xc2c5('0xc')][_0xc2c5('0xe')]);return _0x50b0a6(_0x330460[_0xc2c5('0xc')]['message']);}logger[_0xc2c5('0xc')](_0xc2c5('0x8'),_0x3bf597,_0x330460['error'][_0xc2c5('0xe')]);return _0x2be289(_0x330460[_0xc2c5('0xc')][_0xc2c5('0xe')]);}else{logger[_0xc2c5('0xf')](_0xc2c5('0x8'),_0x3bf597,_0xc2c5('0xa'));_0x2be289(_0x330460['result'][_0xc2c5('0xe')]);}})[_0xc2c5('0x10')](function(_0x59921f){logger[_0xc2c5('0xc')]('Network,\x20%s,\x20%s',_0x3bf597,_0x59921f);_0x50b0a6(_0x59921f);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index f2007d1..0cb5acf 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 _0x6f51=['./notification.controller','post','sendNotification','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x6f51,0xe8));var _0x16f5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f51[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x16f5('0x0'));var util=require(_0x16f5('0x1'));var path=require(_0x16f5('0x2'));var timeout=require(_0x16f5('0x3'));var express=require(_0x16f5('0x4'));var router=express[_0x16f5('0x5')]();var auth=require(_0x16f5('0x6'));var interaction=require(_0x16f5('0x7'));var config=require('../../config/environment');var controller=require(_0x16f5('0x8'));router[_0x16f5('0x9')]('/',auth['isAuthenticated'](),controller[_0x16f5('0xa')]);module[_0x16f5('0xb')]=router; \ No newline at end of file +var _0xc11f=['util','../../components/interaction/service','post','sendNotification','exports','multer'];(function(_0x110366,_0x30f483){var _0x71a3f=function(_0x14333a){while(--_0x14333a){_0x110366['push'](_0x110366['shift']());}};_0x71a3f(++_0x30f483);}(_0xc11f,0x14f));var _0xfc11=function(_0x14c438,_0x4da231){_0x14c438=_0x14c438-0x0;var _0x3c8a25=_0xc11f[_0x14c438];return _0x3c8a25;};'use strict';var multer=require(_0xfc11('0x0'));var util=require(_0xfc11('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfc11('0x2'));var config=require('../../config/environment');var controller=require('./notification.controller');router[_0xfc11('0x3')]('/',auth['isAuthenticated'](),controller[_0xfc11('0x4')]);module[_0xfc11('0x5')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 8b15b2c..a395041 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 _0xf245=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x241ee8,_0x3488c6){var _0x4850ea=function(_0x2550b2){while(--_0x2550b2){_0x241ee8['push'](_0x241ee8['shift']());}};_0x4850ea(++_0x3488c6);}(_0xf245,0x126));var _0x5f24=function(_0x26721d,_0x448ba5){_0x26721d=_0x26721d-0x0;var _0x1035c5=_0xf245[_0x26721d];return _0x1035c5;};'use strict';var Sequelize=require(_0x5f24('0x0'));module[_0x5f24('0x1')]={'body':{'type':Sequelize[_0x5f24('0x2')]},'senderName':{'type':Sequelize[_0x5f24('0x3')]},'recipientsId':{'type':Sequelize[_0x5f24('0x2')]},'recipientsDescription':{'type':Sequelize[_0x5f24('0x3')]},'beep':{'type':Sequelize[_0x5f24('0x4')]}}; \ No newline at end of file +var _0x7c0e=['BOOLEAN','exports','TEXT','STRING'];(function(_0x1ba0d7,_0x195199){var _0x5c6385=function(_0x32e4c5){while(--_0x32e4c5){_0x1ba0d7['push'](_0x1ba0d7['shift']());}};_0x5c6385(++_0x195199);}(_0x7c0e,0x1e9));var _0xe7c0=function(_0x35a0ce,_0x177c8a){_0x35a0ce=_0x35a0ce-0x0;var _0x1fa2b2=_0x7c0e[_0x35a0ce];return _0x1fa2b2;};'use strict';var Sequelize=require('sequelize');module[_0xe7c0('0x0')]={'body':{'type':Sequelize[_0xe7c0('0x1')]},'senderName':{'type':Sequelize[_0xe7c0('0x2')]},'recipientsId':{'type':Sequelize[_0xe7c0('0x1')]},'recipientsDescription':{'type':Sequelize[_0xe7c0('0x2')]},'beep':{'type':Sequelize[_0xe7c0('0x3')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index b18b31c..ad4a763 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 _0x06e6=['User','union','ids','queue','replace','Queue','push','flatten','getAgents','map','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','stack','name','send','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','error','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','create','forEach','recipient','emit','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x06e6,0xcc));var _0x606e=function(_0x14437f,_0xc14167){_0x14437f=_0x14437f-0x0;var _0x4d0175=_0x06e6[_0x14437f];return _0x4d0175;};'use strict';var pdf=require(_0x606e('0x0'));var emlformat=require(_0x606e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x606e('0x2'));var jsonpatch=require(_0x606e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x606e('0x4'));var util=require(_0x606e('0x5'));var path=require('path');var sox=require(_0x606e('0x6'));var csv=require(_0x606e('0x7'));var ejs=require(_0x606e('0x8'));var fs=require('fs');var _=require(_0x606e('0x9'));var squel=require(_0x606e('0xa'));var crypto=require(_0x606e('0xb'));var jsforce=require(_0x606e('0xc'));var deskjs=require(_0x606e('0xd'));var toCsv=require(_0x606e('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x606e('0xe'));var authService=require(_0x606e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x606e('0x10'));var hardwareService=require(_0x606e('0x11'));var logger=require('../../config/logger')(_0x606e('0x12'));var utils=require(_0x606e('0x13'));var config=require(_0x606e('0x14'));var db=require(_0x606e('0x15'))['db'];config[_0x606e('0x16')]=_[_0x606e('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x606e('0x18'))(new Redis(config[_0x606e('0x16')]));require('./notification.socket')[_0x606e('0x19')](socket);function respondWithStatusCode(_0x31ac8e,_0x120aec){_0x120aec=_0x120aec||0xcc;return function(_0x3b7dce){if(_0x3b7dce){return _0x31ac8e['sendStatus'](_0x120aec);}return _0x31ac8e[_0x606e('0x1a')](_0x120aec)[_0x606e('0x1b')]();};}function respondWithResult(_0x444682,_0x873bdd){_0x873bdd=_0x873bdd||0xc8;return function(_0x47b83e){if(_0x47b83e){return _0x444682[_0x606e('0x1a')](_0x873bdd)[_0x606e('0x1c')](_0x47b83e);}};}function respondWithFilteredResult(_0x44db62,_0x18d5a0){return function(_0x5c9a60){if(_0x5c9a60){var _0x1aa020=_0x5c9a60[_0x606e('0x1d')],_0x9cb3a5=_0x18d5a0['offset'],_0x27c058=_0x18d5a0[_0x606e('0x1e')]+_0x18d5a0[_0x606e('0x1f')],_0x590500;if(_0x27c058>=_0x1aa020){_0x27c058=_0x1aa020;_0x590500=0xc8;}else{_0x590500=0xce;}_0x44db62['status'](_0x590500);return _0x44db62[_0x606e('0x20')](_0x606e('0x21'),_0x9cb3a5+'-'+_0x27c058+'/'+_0x1aa020)[_0x606e('0x1c')](_0x5c9a60);}return null;};}function patchUpdates(_0x47e3eb){return function(_0x26b956){try{jsonpatch[_0x606e('0x22')](_0x26b956,_0x47e3eb,!![]);}catch(_0x4d933c){return BPromise['reject'](_0x4d933c);}return _0x26b956[_0x606e('0x23')]();};}function saveUpdates(_0x927a21,_0x214126){return function(_0x5227f5){if(_0x5227f5){return _0x5227f5['update'](_0x927a21)[_0x606e('0x24')](function(_0x597669){return _0x597669;});}return null;};}function removeEntity(_0x2f4c5a,_0x33fbda){return function(_0x54d6fb){if(_0x54d6fb){return _0x54d6fb[_0x606e('0x25')]()[_0x606e('0x24')](function(){_0x2f4c5a[_0x606e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24c42c,_0x370a4d){return function(_0x18acff){if(!_0x18acff){_0x24c42c['sendStatus'](0x194);}return _0x18acff;};}function handleError(_0x24acae,_0x34092c){_0x34092c=_0x34092c||0x1f4;return function(_0x905e07){logger['error'](_0x905e07[_0x606e('0x26')]);if(_0x905e07[_0x606e('0x27')]){delete _0x905e07[_0x606e('0x27')];}_0x24acae[_0x606e('0x1a')](_0x34092c)[_0x606e('0x28')](_0x905e07);};}exports[_0x606e('0x29')]=function(_0x2a6c71,_0x4e8749,_0x112e1a){if(!_0x2a6c71[_0x606e('0x2a')][_0x606e('0x2b')](_0x606e('0x2c'))&&!_0x2a6c71[_0x606e('0x2a')][_0x606e('0x2b')](_0x606e('0x2d'))){throw new db[(_0x606e('0x2e'))][(_0x606e('0x2f'))](_0x606e('0x30'));}else{if(_0x2a6c71[_0x606e('0x2a')]['hasOwnProperty'](_0x606e('0x2d'))&&!_0x2a6c71[_0x606e('0x2a')]['hasOwnProperty'](_0x606e('0x31'))){throw new db['Sequelize'][(_0x606e('0x2f'))](_0x606e('0x32'));}if(!_0x2a6c71[_0x606e('0x2a')][_0x606e('0x2b')](_0x606e('0x33'))){throw new db[(_0x606e('0x2e'))][(_0x606e('0x2f'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x2564da=JSON[_0x606e('0x34')](_0x2a6c71[_0x606e('0x2a')][_0x606e('0x33')]);}catch(_0x409307){logger[_0x606e('0x35')](_0x409307);throw new db[(_0x606e('0x2e'))][(_0x606e('0x2f'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x183040=[_0x606e('0x36'),_0x606e('0x37'),_0x606e('0x38'),_0x606e('0x39'),_0x606e('0x3a'),_0x606e('0x3b'),_0x606e('0x3c'),_0x606e('0x3d'),'user'];if(_[_0x606e('0x3e')](_0x2564da,function(_0x5be3b4){return!_[_0x606e('0x3f')](_0x183040,_0x5be3b4[_0x606e('0x40')][_0x606e('0x41')]());})){throw new db['Sequelize'][(_0x606e('0x2f'))](_0x606e('0x42'));}}}var _0x11666c={};_0x11666c[_0x606e('0x43')]=_0x2a6c71[_0x606e('0x2a')][_0x606e('0x2b')](_0x606e('0x43'))?_0x2a6c71['body'][_0x606e('0x43')]:_0x2a6c71['user'][_0x606e('0x44')];_0x11666c[_0x606e('0x45')]=_[_0x606e('0x46')](_0x2a6c71[_0x606e('0x2a')][_0x606e('0x45')])?null:_0x2a6c71[_0x606e('0x2a')][_0x606e('0x45')];_0x11666c['beep']=_0x2a6c71['body'][_0x606e('0x47')]||![];_0x11666c[_0x606e('0x48')]=_0x2a6c71['user']['id'];return getContent(_0x2a6c71[_0x606e('0x2a')])[_0x606e('0x24')](function(_0x1741b9){_0x11666c[_0x606e('0x2a')]=_0x1741b9;return getRecipients(_0x2564da);})[_0x606e('0x24')](function(_0x22b028){_0x11666c[_0x606e('0x49')]=_[_0x606e('0x4a')](_0x22b028)[_0x606e('0x4b')](',');return db[_0x606e('0x4c')]['transaction'](function(_0x54f7ef){return db['Notification'][_0x606e('0x4d')](_0x11666c,{'raw':!![],'transaction':_0x54f7ef})[_0x606e('0x24')](function(_0x4d9d7){var _0x4b84c6={'sender':_0x11666c[_0x606e('0x43')],'description':_0x11666c[_0x606e('0x45')],'content':_0x11666c['body'],'beep':_0x11666c[_0x606e('0x47')]};_0x22b028[_0x606e('0x4e')](function(_0x404d70){_0x4b84c6[_0x606e('0x4f')]=_0x404d70;socket[_0x606e('0x50')]('notification:send',_0x4b84c6);});return _0x4d9d7;});});})['then'](respondWithResult(_0x4e8749,0xc9))[_0x606e('0x51')](handleError(_0x4e8749,null));};function getContent(_0x1b74c5){return new BPromise(function(_0x3050cf,_0x50ed43){if(_0x1b74c5[_0x606e('0x2c')]){_0x3050cf(_0x1b74c5[_0x606e('0x2c')]);return;}return db[_0x606e('0x52')][_0x606e('0x53')]({'attributes':[_0x606e('0x54')],'where':{'id':_0x1b74c5['TemplateId']},'raw':!![]})[_0x606e('0x24')](function(_0x3aced){if(!_0x3aced)throw new db[(_0x606e('0x2e'))][(_0x606e('0x2f'))](_0x606e('0x55'));var _0x2a39e9=Mustache['render'](_0x3aced[_0x606e('0x54')],_0x1b74c5[_0x606e('0x31')]);_0x3050cf(_0x2a39e9);})[_0x606e('0x51')](function(_0x4498e8){_0x50ed43(_0x4498e8);});});}function getRecipients(_0x4f11bd){return new BPromise(function(_0x401ad6,_0x25f53e){var _0x1fdecf=[];var _0x20ff2f=[];_0x4f11bd[_0x606e('0x4e')](function(_0x59c4e1){var _0x2487bd=_[_0x606e('0x56')](_0x59c4e1[_0x606e('0x40')][_0x606e('0x41')]());if(_0x2487bd===_0x606e('0x57')){_0x1fdecf=_[_0x606e('0x58')](_0x1fdecf,_0x59c4e1[_0x606e('0x59')]);}else{if(_['includes'](_0x2487bd,_0x606e('0x5a')))_0x2487bd=_0x2487bd[_0x606e('0x5b')](_0x606e('0x5a'),_0x606e('0x5c'));_0x59c4e1[_0x606e('0x59')][_0x606e('0x4e')](function(_0x4484ff){_0x20ff2f[_0x606e('0x5d')](getAgents(_0x2487bd,_0x4484ff));});}});return BPromise['all'](_0x20ff2f)[_0x606e('0x24')](function(_0x52c247){_0x1fdecf=_['union'](_0x1fdecf,_[_0x606e('0x5e')](_0x52c247));_0x401ad6(_0x1fdecf);})[_0x606e('0x51')](function(_0x466af0){_0x25f53e(_0x466af0);});});}function getAgents(_0x114fae,_0x1af88d){return new BPromise(function(_0x45f42c,_0xca417f){return db[_0x114fae][_0x606e('0x53')]({'where':{'id':_0x1af88d}})[_0x606e('0x24')](function(_0x4764d7){return _0x4764d7[_0x606e('0x5f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x49a22c){var _0x594dc4=_[_0x606e('0x60')](_0x49a22c,'id');_0x45f42c(_0x594dc4);});})[_0x606e('0x51')](function(_0xce009f){_0xca417f(_0xce009f);});});} \ No newline at end of file +var _0x1c1d=['destroy','end','name','send','hasOwnProperty','text','body','Sequelize','ValidationError','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','transaction','Notification','create','forEach','recipient','emit','notification:send','catch','Template','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','union','ids','queue','Queue','push','all','flatten','findOne','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','./notification.socket','register','sendStatus','status','json','count','offset','Content-Range','apply','save','update','then'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x1c1d,0x9f));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd1c1('0x0'));var emlformat=require(_0xd1c1('0x1'));var rimraf=require(_0xd1c1('0x2'));var zipdir=require(_0xd1c1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd1c1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd1c1('0x5'));var util=require(_0xd1c1('0x6'));var path=require(_0xd1c1('0x7'));var sox=require(_0xd1c1('0x8'));var csv=require(_0xd1c1('0x9'));var ejs=require(_0xd1c1('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd1c1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd1c1('0xc'));var toCsv=require(_0xd1c1('0x9'));var querystring=require('querystring');var Papa=require(_0xd1c1('0xd'));var Redis=require(_0xd1c1('0xe'));var authService=require(_0xd1c1('0xf'));var qs=require(_0xd1c1('0x10'));var as=require(_0xd1c1('0x11'));var hardwareService=require(_0xd1c1('0x12'));var logger=require(_0xd1c1('0x13'))(_0xd1c1('0x14'));var utils=require(_0xd1c1('0x15'));var config=require(_0xd1c1('0x16'));var db=require('../../mysqldb')['db'];config[_0xd1c1('0x17')]=_[_0xd1c1('0x18')](config[_0xd1c1('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd1c1('0x19'))[_0xd1c1('0x1a')](socket);function respondWithStatusCode(_0x1ad3db,_0x93f239){_0x93f239=_0x93f239||0xcc;return function(_0xdbaad6){if(_0xdbaad6){return _0x1ad3db[_0xd1c1('0x1b')](_0x93f239);}return _0x1ad3db[_0xd1c1('0x1c')](_0x93f239)['end']();};}function respondWithResult(_0x4ba3a5,_0x274bb3){_0x274bb3=_0x274bb3||0xc8;return function(_0x9b278f){if(_0x9b278f){return _0x4ba3a5[_0xd1c1('0x1c')](_0x274bb3)[_0xd1c1('0x1d')](_0x9b278f);}};}function respondWithFilteredResult(_0x174576,_0x587490){return function(_0x7fd179){if(_0x7fd179){var _0x25b5db=_0x7fd179[_0xd1c1('0x1e')],_0x3eeb5f=_0x587490['offset'],_0x494e23=_0x587490[_0xd1c1('0x1f')]+_0x587490['limit'],_0x3b409e;if(_0x494e23>=_0x25b5db){_0x494e23=_0x25b5db;_0x3b409e=0xc8;}else{_0x3b409e=0xce;}_0x174576[_0xd1c1('0x1c')](_0x3b409e);return _0x174576['set'](_0xd1c1('0x20'),_0x3eeb5f+'-'+_0x494e23+'/'+_0x25b5db)[_0xd1c1('0x1d')](_0x7fd179);}return null;};}function patchUpdates(_0x55bec9){return function(_0x6f39f9){try{jsonpatch[_0xd1c1('0x21')](_0x6f39f9,_0x55bec9,!![]);}catch(_0xffc5a4){return BPromise['reject'](_0xffc5a4);}return _0x6f39f9[_0xd1c1('0x22')]();};}function saveUpdates(_0x5e602c,_0x483d03){return function(_0x30d677){if(_0x30d677){return _0x30d677[_0xd1c1('0x23')](_0x5e602c)[_0xd1c1('0x24')](function(_0x50d83b){return _0x50d83b;});}return null;};}function removeEntity(_0xf64df2,_0xda81d9){return function(_0x4e6b4c){if(_0x4e6b4c){return _0x4e6b4c[_0xd1c1('0x25')]()[_0xd1c1('0x24')](function(){_0xf64df2[_0xd1c1('0x1c')](0xcc)[_0xd1c1('0x26')]();});}};}function handleEntityNotFound(_0x40b0e1,_0x345822){return function(_0xac1b2b){if(!_0xac1b2b){_0x40b0e1[_0xd1c1('0x1b')](0x194);}return _0xac1b2b;};}function handleError(_0xc6f193,_0x452b37){_0x452b37=_0x452b37||0x1f4;return function(_0xc9082a){logger['error'](_0xc9082a['stack']);if(_0xc9082a[_0xd1c1('0x27')]){delete _0xc9082a[_0xd1c1('0x27')];}_0xc6f193[_0xd1c1('0x1c')](_0x452b37)[_0xd1c1('0x28')](_0xc9082a);};}exports['sendNotification']=function(_0x59ca45,_0x3c9626,_0x1fd81d){if(!_0x59ca45['body'][_0xd1c1('0x29')](_0xd1c1('0x2a'))&&!_0x59ca45[_0xd1c1('0x2b')][_0xd1c1('0x29')]('TemplateId')){throw new db[(_0xd1c1('0x2c'))][(_0xd1c1('0x2d'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x59ca45['body'][_0xd1c1('0x29')](_0xd1c1('0x2e'))&&!_0x59ca45[_0xd1c1('0x2b')][_0xd1c1('0x29')](_0xd1c1('0x2f'))){throw new db[(_0xd1c1('0x2c'))][(_0xd1c1('0x2d'))](_0xd1c1('0x30'));}if(!_0x59ca45['body']['hasOwnProperty'](_0xd1c1('0x31'))){throw new db['Sequelize'][(_0xd1c1('0x2d'))](_0xd1c1('0x32'));}else{try{var _0xd7a1c9=JSON[_0xd1c1('0x33')](_0x59ca45[_0xd1c1('0x2b')][_0xd1c1('0x31')]);}catch(_0x342258){logger[_0xd1c1('0x34')](_0x342258);throw new db[(_0xd1c1('0x2c'))][(_0xd1c1('0x2d'))](_0xd1c1('0x35'));}var _0x4602f9=[_0xd1c1('0x36'),_0xd1c1('0x37'),_0xd1c1('0x38'),'openchannelqueue',_0xd1c1('0x39'),_0xd1c1('0x3a'),_0xd1c1('0x3b'),_0xd1c1('0x3c'),_0xd1c1('0x3d')];if(_[_0xd1c1('0x3e')](_0xd7a1c9,function(_0x3d7830){return!_[_0xd1c1('0x3f')](_0x4602f9,_0x3d7830[_0xd1c1('0x40')][_0xd1c1('0x41')]());})){throw new db[(_0xd1c1('0x2c'))][(_0xd1c1('0x2d'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x5a8139={};_0x5a8139['senderName']=_0x59ca45[_0xd1c1('0x2b')]['hasOwnProperty']('senderName')?_0x59ca45[_0xd1c1('0x2b')][_0xd1c1('0x42')]:_0x59ca45[_0xd1c1('0x3d')][_0xd1c1('0x43')];_0x5a8139[_0xd1c1('0x44')]=_[_0xd1c1('0x45')](_0x59ca45[_0xd1c1('0x2b')][_0xd1c1('0x44')])?null:_0x59ca45[_0xd1c1('0x2b')][_0xd1c1('0x44')];_0x5a8139[_0xd1c1('0x46')]=_0x59ca45[_0xd1c1('0x2b')][_0xd1c1('0x46')]||![];_0x5a8139[_0xd1c1('0x47')]=_0x59ca45[_0xd1c1('0x3d')]['id'];return getContent(_0x59ca45['body'])[_0xd1c1('0x24')](function(_0xac3948){_0x5a8139['body']=_0xac3948;return getRecipients(_0xd7a1c9);})[_0xd1c1('0x24')](function(_0x472d80){_0x5a8139[_0xd1c1('0x48')]=_[_0xd1c1('0x49')](_0x472d80)['join'](',');return db[_0xd1c1('0x4a')][_0xd1c1('0x4b')](function(_0x4517e4){return db[_0xd1c1('0x4c')][_0xd1c1('0x4d')](_0x5a8139,{'raw':!![],'transaction':_0x4517e4})['then'](function(_0xb4c5f9){var _0x563dad={'sender':_0x5a8139['senderName'],'description':_0x5a8139[_0xd1c1('0x44')],'content':_0x5a8139['body'],'beep':_0x5a8139[_0xd1c1('0x46')]};_0x472d80[_0xd1c1('0x4e')](function(_0x238e3a){_0x563dad[_0xd1c1('0x4f')]=_0x238e3a;socket[_0xd1c1('0x50')](_0xd1c1('0x51'),_0x563dad);});return _0xb4c5f9;});});})[_0xd1c1('0x24')](respondWithResult(_0x3c9626,0xc9))[_0xd1c1('0x52')](handleError(_0x3c9626,null));};function getContent(_0x5e3182){return new BPromise(function(_0x3919c2,_0x2f7460){if(_0x5e3182[_0xd1c1('0x2a')]){_0x3919c2(_0x5e3182[_0xd1c1('0x2a')]);return;}return db[_0xd1c1('0x53')]['findOne']({'attributes':['html'],'where':{'id':_0x5e3182[_0xd1c1('0x2e')]},'raw':!![]})['then'](function(_0x4ad89d){if(!_0x4ad89d)throw new db['Sequelize'][(_0xd1c1('0x2d'))](_0xd1c1('0x54'));var _0x592124=Mustache[_0xd1c1('0x55')](_0x4ad89d[_0xd1c1('0x56')],_0x5e3182[_0xd1c1('0x2f')]);_0x3919c2(_0x592124);})[_0xd1c1('0x52')](function(_0x3d0043){_0x2f7460(_0x3d0043);});});}function getRecipients(_0x3fee82){return new BPromise(function(_0x5139e7,_0x23a2f7){var _0x270b96=[];var _0x214163=[];_0x3fee82[_0xd1c1('0x4e')](function(_0x4c7098){var _0x1ecc9c=_[_0xd1c1('0x57')](_0x4c7098[_0xd1c1('0x40')][_0xd1c1('0x41')]());if(_0x1ecc9c==='User'){_0x270b96=_[_0xd1c1('0x58')](_0x270b96,_0x4c7098[_0xd1c1('0x59')]);}else{if(_[_0xd1c1('0x3f')](_0x1ecc9c,_0xd1c1('0x5a')))_0x1ecc9c=_0x1ecc9c['replace'](_0xd1c1('0x5a'),_0xd1c1('0x5b'));_0x4c7098[_0xd1c1('0x59')][_0xd1c1('0x4e')](function(_0x41eb0b){_0x214163[_0xd1c1('0x5c')](getAgents(_0x1ecc9c,_0x41eb0b));});}});return BPromise[_0xd1c1('0x5d')](_0x214163)[_0xd1c1('0x24')](function(_0xe813a5){_0x270b96=_['union'](_0x270b96,_[_0xd1c1('0x5e')](_0xe813a5));_0x5139e7(_0x270b96);})[_0xd1c1('0x52')](function(_0x3a0ca3){_0x23a2f7(_0x3a0ca3);});});}function getAgents(_0x201242,_0x23409c){return new BPromise(function(_0xb3fac7,_0x116d4e){return db[_0x201242][_0xd1c1('0x5f')]({'where':{'id':_0x23409c}})[_0xd1c1('0x24')](function(_0x2ff72a){return _0x2ff72a[_0xd1c1('0x60')]({'attributes':['id'],'raw':!![]})[_0xd1c1('0x24')](function(_0x140a29){var _0x361ccb=_[_0xd1c1('0x61')](_0x140a29,'id');_0xb3fac7(_0x361ccb);});})[_0xd1c1('0x52')](function(_0x294dd1){_0x116d4e(_0x294dd1);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 2a45b10..8d5df60 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x1a985e,_0x444c50){var _0x533b4c=function(_0xd44197){while(--_0xd44197){_0x1a985e['push'](_0x1a985e['shift']());}};_0x533b4c(++_0x444c50);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Notification','setMaxListeners','save','update'];(function(_0x2f345a,_0x134791){var _0x435acb=function(_0x5cd851){while(--_0x5cd851){_0x2f345a['push'](_0x2f345a['shift']());}};_0x435acb(++_0x134791);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a4e4b,_0x3c9e2e){_0x5a4e4b=_0x5a4e4b-0x0;var _0x293b47=_0x5f2f[_0x5a4e4b];return _0x293b47;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var Notification=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){NotificationEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);NotificationEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];Notification[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index f01b31f..398e1b2 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 _0xca61=['bluebird','request-promise','path','../../config/environment','./notification.attributes','define','Notification','notifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x3e6f53,_0x4073c2){var _0x26d3ed=function(_0x54d6b3){while(--_0x54d6b3){_0x3e6f53['push'](_0x3e6f53['shift']());}};_0x26d3ed(++_0x4073c2);}(_0xca61,0x1f4));var _0x1ca6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xca61[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1ca6('0x0'));var util=require(_0x1ca6('0x1'));var logger=require('../../config/logger')(_0x1ca6('0x2'));var moment=require(_0x1ca6('0x3'));var BPromise=require(_0x1ca6('0x4'));var rp=require(_0x1ca6('0x5'));var fs=require('fs');var path=require(_0x1ca6('0x6'));var rimraf=require('rimraf');var config=require(_0x1ca6('0x7'));var attributes=require(_0x1ca6('0x8'));module['exports']=function(_0x535963,_0x2ca733){return _0x535963[_0x1ca6('0x9')](_0x1ca6('0xa'),attributes,{'tableName':_0x1ca6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1ca6('0xc'),'collate':_0x1ca6('0xd')});}; \ No newline at end of file +var _0xc80f=['../../config/environment','exports','define','Notification','notifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x32c7a0,_0x109a0e){var _0x38fdb5=function(_0x540f5d){while(--_0x540f5d){_0x32c7a0['push'](_0x32c7a0['shift']());}};_0x38fdb5(++_0x109a0e);}(_0xc80f,0x1c9));var _0xfc80=function(_0x1c855c,_0x162267){_0x1c855c=_0x1c855c-0x0;var _0x3005f3=_0xc80f[_0x1c855c];return _0x3005f3;};'use strict';var _=require(_0xfc80('0x0'));var util=require(_0xfc80('0x1'));var logger=require(_0xfc80('0x2'))('api');var moment=require(_0xfc80('0x3'));var BPromise=require(_0xfc80('0x4'));var rp=require(_0xfc80('0x5'));var fs=require('fs');var path=require(_0xfc80('0x6'));var rimraf=require(_0xfc80('0x7'));var config=require(_0xfc80('0x8'));var attributes=require('./notification.attributes');module[_0xfc80('0x9')]=function(_0x5b22bd,_0x303c41){return _0x5b22bd[_0xfc80('0xa')](_0xfc80('0xb'),attributes,{'tableName':_0xfc80('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfc80('0xd'),'collate':_0xfc80('0xe')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index b4f38fb..0bc520b 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 _0x73c7=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','request','then','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0x73c7,0x8c));var _0x773c=function(_0x158a67,_0x3f4270){_0x158a67=_0x158a67-0x0;var _0x1ede3c=_0x73c7[_0x158a67];return _0x1ede3c;};'use strict';var _=require(_0x773c('0x0'));var util=require(_0x773c('0x1'));var moment=require(_0x773c('0x2'));var BPromise=require(_0x773c('0x3'));var rs=require(_0x773c('0x4'));var fs=require('fs');var Redis=require(_0x773c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x773c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x773c('0x7'));var jayson=require(_0x773c('0x8'));var client=jayson[_0x773c('0x9')]['http']({'port':0x232a});config[_0x773c('0xa')]=_[_0x773c('0xb')](config[_0x773c('0xa')],{'host':_0x773c('0xc'),'port':0x18eb});var socket=require(_0x773c('0xd'))(new Redis(config[_0x773c('0xa')]));require(_0x773c('0xe'))[_0x773c('0xf')](socket);function respondWithRpcPromise(_0x4c8aa1,_0x227bfa,_0x45d0e3){return new BPromise(function(_0x478b35,_0x5ec213){return client[_0x773c('0x10')](_0x4c8aa1,_0x45d0e3)[_0x773c('0x11')](function(_0xec60ba){logger['info'](_0x773c('0x12'),_0x227bfa,'request\x20sent');logger[_0x773c('0x13')](_0x773c('0x14'),_0x227bfa,_0x773c('0x15'),JSON[_0x773c('0x16')](_0xec60ba));if(_0xec60ba[_0x773c('0x17')]){if(_0xec60ba[_0x773c('0x17')][_0x773c('0x18')]===0x1f4){logger[_0x773c('0x17')](_0x773c('0x12'),_0x227bfa,_0xec60ba['error']['message']);return _0x5ec213(_0xec60ba[_0x773c('0x17')][_0x773c('0x19')]);}logger[_0x773c('0x17')]('Notification,\x20%s,\x20%s',_0x227bfa,_0xec60ba[_0x773c('0x17')][_0x773c('0x19')]);return _0x478b35(_0xec60ba[_0x773c('0x17')]['message']);}else{logger['info'](_0x773c('0x12'),_0x227bfa,_0x773c('0x15'));_0x478b35(_0xec60ba['result'][_0x773c('0x19')]);}})[_0x773c('0x1a')](function(_0xd40744){logger[_0x773c('0x17')]('Notification,\x20%s,\x20%s',_0x227bfa,_0xd40744);_0x5ec213(_0xd40744);});});} \ No newline at end of file +var _0x39c4=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./notification.socket','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment'];(function(_0x526931,_0x48941c){var _0x33cfd8=function(_0x33a9b2){while(--_0x33a9b2){_0x526931['push'](_0x526931['shift']());}};_0x33cfd8(++_0x48941c);}(_0x39c4,0xa7));var _0x439c=function(_0x4599ba,_0x4e4603){_0x4599ba=_0x4599ba-0x0;var _0x268308=_0x39c4[_0x4599ba];return _0x268308;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x439c('0x0'));var BPromise=require(_0x439c('0x1'));var rs=require(_0x439c('0x2'));var fs=require('fs');var Redis=require(_0x439c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x439c('0x4'));var logger=require(_0x439c('0x5'))('rpc');var config=require(_0x439c('0x6'));var jayson=require(_0x439c('0x7'));var client=jayson[_0x439c('0x8')][_0x439c('0x9')]({'port':0x232a});config[_0x439c('0xa')]=_[_0x439c('0xb')](config[_0x439c('0xa')],{'host':_0x439c('0xc'),'port':0x18eb});var socket=require(_0x439c('0xd'))(new Redis(config[_0x439c('0xa')]));require(_0x439c('0xe'))['register'](socket);function respondWithRpcPromise(_0x27adb6,_0xe18189,_0xe029f7){return new BPromise(function(_0x16885a,_0x121920){return client[_0x439c('0xf')](_0x27adb6,_0xe029f7)[_0x439c('0x10')](function(_0x24452c){logger[_0x439c('0x11')](_0x439c('0x12'),_0xe18189,_0x439c('0x13'));logger[_0x439c('0x14')](_0x439c('0x15'),_0xe18189,'request\x20sent',JSON[_0x439c('0x16')](_0x24452c));if(_0x24452c[_0x439c('0x17')]){if(_0x24452c[_0x439c('0x17')][_0x439c('0x18')]===0x1f4){logger[_0x439c('0x17')](_0x439c('0x12'),_0xe18189,_0x24452c[_0x439c('0x17')][_0x439c('0x19')]);return _0x121920(_0x24452c['error'][_0x439c('0x19')]);}logger[_0x439c('0x17')](_0x439c('0x12'),_0xe18189,_0x24452c['error'][_0x439c('0x19')]);return _0x16885a(_0x24452c[_0x439c('0x17')][_0x439c('0x19')]);}else{logger['info'](_0x439c('0x12'),_0xe18189,_0x439c('0x13'));_0x16885a(_0x24452c[_0x439c('0x1a')][_0x439c('0x19')]);}})[_0x439c('0x1b')](function(_0x47139d){logger[_0x439c('0x17')](_0x439c('0x12'),_0xe18189,_0x47139d);_0x121920(_0x47139d);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index ccc1c42..08095c7 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 _0xf6f3=['update','removeListener','length','notification:','./notification.events','save'];(function(_0x438c45,_0x13c67e){var _0x66612f=function(_0x3ddab4){while(--_0x3ddab4){_0x438c45['push'](_0x438c45['shift']());}};_0x66612f(++_0x13c67e);}(_0xf6f3,0x130));var _0x3f6f=function(_0xe2206b,_0x158dbd){_0xe2206b=_0xe2206b-0x0;var _0x3ebe97=_0xf6f3[_0xe2206b];return _0x3ebe97;};'use strict';var NotificationEvents=require(_0x3f6f('0x0'));var events=[_0x3f6f('0x1'),'remove',_0x3f6f('0x2')];function createListener(_0x4c3c15,_0x4df7ad){return function(_0x582451){_0x4df7ad['emit'](_0x4c3c15,_0x582451);};}function removeListener(_0x29492b,_0x35fc16){return function(){NotificationEvents[_0x3f6f('0x3')](_0x29492b,_0x35fc16);};}exports['register']=function(_0x107b43){for(var _0x4d19b4=0x0,_0x6108e2=events[_0x3f6f('0x4')];_0x4d19b4<_0x6108e2;_0x4d19b4++){var _0x28fd39=events[_0x4d19b4];var _0x2d6d55=createListener(_0x3f6f('0x5')+_0x28fd39,_0x107b43);NotificationEvents['on'](_0x28fd39,_0x2d6d55);}}; \ No newline at end of file +var _0xb7e2=['notification:','./notification.events','save','update','emit','removeListener','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7e2,0xda));var _0x2b7e=function(_0x13e211,_0x9b584e){_0x13e211=_0x13e211-0x0;var _0xd1357e=_0xb7e2[_0x13e211];return _0xd1357e;};'use strict';var NotificationEvents=require(_0x2b7e('0x0'));var events=[_0x2b7e('0x1'),'remove',_0x2b7e('0x2')];function createListener(_0x44925f,_0x1c2b1c){return function(_0x18d141){_0x1c2b1c[_0x2b7e('0x3')](_0x44925f,_0x18d141);};}function removeListener(_0x1f9d44,_0x6759a5){return function(){NotificationEvents[_0x2b7e('0x4')](_0x1f9d44,_0x6759a5);};}exports['register']=function(_0x2aa0ad){for(var _0x4f1fc3=0x0,_0x198178=events[_0x2b7e('0x5')];_0x4f1fc3<_0x198178;_0x4f1fc3++){var _0x3a1c63=events[_0x4f1fc3];var _0x45a1a0=createListener(_0x2b7e('0x6')+_0x3a1c63,_0x2aa0ad);NotificationEvents['on'](_0x3a1c63,_0x45a1a0);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 832606c..b85d8bb 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 _0x3a06=['getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addAnswer','notify','addAgents','/:id/send','send','put','/:id','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions'];(function(_0x35213d,_0x5a5f7b){var _0x4559eb=function(_0x3d6aa7){while(--_0x3d6aa7){_0x35213d['push'](_0x35213d['shift']());}};_0x4559eb(++_0x5a5f7b);}(_0x3a06,0x1b9));var _0x63a0=function(_0x45bc22,_0x20a320){_0x45bc22=_0x45bc22-0x0;var _0x3e76cb=_0x3a06[_0x45bc22];return _0x3e76cb;};'use strict';var multer=require(_0x63a0('0x0'));var util=require(_0x63a0('0x1'));var path=require(_0x63a0('0x2'));var timeout=require(_0x63a0('0x3'));var express=require('express');var router=express[_0x63a0('0x4')]();var auth=require(_0x63a0('0x5'));var interaction=require(_0x63a0('0x6'));var config=require(_0x63a0('0x7'));var controller=require(_0x63a0('0x8'));router[_0x63a0('0x9')]('/',auth[_0x63a0('0xa')](),controller[_0x63a0('0xb')]);router['get']('/describe',auth[_0x63a0('0xa')](),controller[_0x63a0('0xc')]);router[_0x63a0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x63a0('0xd')]);router['get'](_0x63a0('0xe'),auth[_0x63a0('0xa')](),controller[_0x63a0('0xf')]);router[_0x63a0('0x9')](_0x63a0('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x63a0('0x9')](_0x63a0('0x11'),auth[_0x63a0('0xa')](),controller[_0x63a0('0x12')]);router[_0x63a0('0x9')](_0x63a0('0x13'),auth['isAuthenticated'](),controller[_0x63a0('0x14')]);router[_0x63a0('0x9')](_0x63a0('0x15'),auth[_0x63a0('0xa')](),controller[_0x63a0('0x16')]);router[_0x63a0('0x17')]('/',auth[_0x63a0('0xa')](),controller[_0x63a0('0x18')]);router[_0x63a0('0x17')](_0x63a0('0xe'),auth[_0x63a0('0xa')](),controller['addDisposition']);router[_0x63a0('0x17')](_0x63a0('0x10'),auth['isAuthenticated'](),controller[_0x63a0('0x19')]);router[_0x63a0('0x17')]('/:id/notify',controller[_0x63a0('0x1a')]);router[_0x63a0('0x17')](_0x63a0('0x11'),auth['isAuthenticated'](),controller['addApplications']);router[_0x63a0('0x17')](_0x63a0('0x15'),auth[_0x63a0('0xa')](),controller[_0x63a0('0x1b')]);router[_0x63a0('0x17')](_0x63a0('0x1c'),auth[_0x63a0('0xa')](),controller[_0x63a0('0x1d')]);router[_0x63a0('0x1e')](_0x63a0('0x1f'),auth[_0x63a0('0xa')](),controller[_0x63a0('0x20')]);router[_0x63a0('0x21')]('/:id',auth[_0x63a0('0xa')](),controller[_0x63a0('0x22')]);router[_0x63a0('0x21')](_0x63a0('0xe'),auth[_0x63a0('0xa')](),controller['removeDispositions']);router['delete'](_0x63a0('0x10'),auth[_0x63a0('0xa')](),controller[_0x63a0('0x23')]);router['delete']('/:id/users',auth[_0x63a0('0xa')](),controller[_0x63a0('0x24')]);module[_0x63a0('0x25')]=router; \ No newline at end of file +var _0xc864=['isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/notify','notify','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xc864,0x128));var _0x4c86=function(_0x19d682,_0x297a32){_0x19d682=_0x19d682-0x0;var _0x1996ac=_0xc864[_0x19d682];return _0x1996ac;};'use strict';var multer=require('multer');var util=require(_0x4c86('0x0'));var path=require('path');var timeout=require(_0x4c86('0x1'));var express=require(_0x4c86('0x2'));var router=express[_0x4c86('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4c86('0x4'));var config=require(_0x4c86('0x5'));var controller=require(_0x4c86('0x6'));router[_0x4c86('0x7')]('/',auth[_0x4c86('0x8')](),controller[_0x4c86('0x9')]);router['get']('/describe',auth[_0x4c86('0x8')](),controller['describe']);router[_0x4c86('0x7')](_0x4c86('0xa'),auth[_0x4c86('0x8')](),controller[_0x4c86('0xb')]);router[_0x4c86('0x7')](_0x4c86('0xc'),auth[_0x4c86('0x8')](),controller[_0x4c86('0xd')]);router['get'](_0x4c86('0xe'),auth[_0x4c86('0x8')](),controller[_0x4c86('0xf')]);router[_0x4c86('0x7')](_0x4c86('0x10'),auth[_0x4c86('0x8')](),controller[_0x4c86('0x11')]);router[_0x4c86('0x7')](_0x4c86('0x12'),auth[_0x4c86('0x8')](),controller[_0x4c86('0x13')]);router[_0x4c86('0x7')](_0x4c86('0x14'),auth['isAuthenticated'](),controller[_0x4c86('0x15')]);router[_0x4c86('0x16')]('/',auth[_0x4c86('0x8')](),controller[_0x4c86('0x17')]);router[_0x4c86('0x16')](_0x4c86('0xc'),auth[_0x4c86('0x8')](),controller['addDisposition']);router[_0x4c86('0x16')](_0x4c86('0xe'),auth[_0x4c86('0x8')](),controller[_0x4c86('0x18')]);router[_0x4c86('0x16')](_0x4c86('0x19'),controller[_0x4c86('0x1a')]);router['post'](_0x4c86('0x10'),auth['isAuthenticated'](),controller['addApplications']);router[_0x4c86('0x16')](_0x4c86('0x14'),auth[_0x4c86('0x8')](),controller[_0x4c86('0x1b')]);router[_0x4c86('0x16')](_0x4c86('0x1c'),auth[_0x4c86('0x8')](),controller[_0x4c86('0x1d')]);router[_0x4c86('0x1e')](_0x4c86('0xa'),auth[_0x4c86('0x8')](),controller[_0x4c86('0x1f')]);router[_0x4c86('0x20')](_0x4c86('0xa'),auth[_0x4c86('0x8')](),controller[_0x4c86('0x21')]);router[_0x4c86('0x20')](_0x4c86('0xc'),auth['isAuthenticated'](),controller[_0x4c86('0x22')]);router[_0x4c86('0x20')](_0x4c86('0xe'),auth[_0x4c86('0x8')](),controller[_0x4c86('0x23')]);router[_0x4c86('0x20')](_0x4c86('0x14'),auth['isAuthenticated'](),controller[_0x4c86('0x24')]);module[_0x4c86('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 73b652f..161da94 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 _0xdf16=['STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','name'];(function(_0x4b8947,_0xdf9c4c){var _0x1332ec=function(_0x48f7bd){while(--_0x48f7bd){_0x4b8947['push'](_0x4b8947['shift']());}};_0x1332ec(++_0xdf9c4c);}(_0xdf16,0x141));var _0x6df1=function(_0x272a88,_0x57e586){_0x272a88=_0x272a88-0x0;var _0x5c71c4=_0xdf16[_0x272a88];return _0x5c71c4;};'use strict';var Sequelize=require(_0x6df1('0x0'));var rs=require('randomstring');module[_0x6df1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6df1('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x6df1('0x3')]},'token':{'type':Sequelize[_0x6df1('0x3')],'defaultValue':function(){return rs[_0x6df1('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6df1('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6df1('0x5')],'defaultValue':function(){return _0x6df1('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6df1('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6df1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6df1('0x3')]},'queueTransfer':{'type':Sequelize[_0x6df1('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6df1('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6df1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6df1('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6df1('0x9'),'set':function(_0x42f4a3){if(!_0x42f4a3)this[_0x6df1('0xa')](_0x6df1('0xb'),null);this[_0x6df1('0xa')]('mandatoryDisposition',_0x42f4a3);}}}; \ No newline at end of file +var _0x9505=['exports','name','STRING','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0x4ab60b,_0x49e637){var _0x2497c7=function(_0x329eb6){while(--_0x329eb6){_0x4ab60b['push'](_0x4ab60b['shift']());}};_0x2497c7(++_0x49e637);}(_0x9505,0x174));var _0x5950=function(_0x275609,_0x83274f){_0x275609=_0x275609-0x0;var _0x5bc9a5=_0x9505[_0x275609];return _0x5bc9a5;};'use strict';var Sequelize=require(_0x5950('0x0'));var rs=require(_0x5950('0x1'));module[_0x5950('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x5950('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5950('0x4')]},'token':{'type':Sequelize[_0x5950('0x4')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x5950('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5950('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5950('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5950('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x5950('0x4')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5950('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5950('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x5950('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xb29d7f){if(!_0xb29d7f)this[_0x5950('0x8')](_0x5950('0x9'),null);this[_0x5950('0x8')](_0x5950('0xa'),_0xb29d7f);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f636e18..aa9dd9d 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 _0xe53d=['messageId','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','interaction','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','getApplications','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','redis','defaults','localhost','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','OpenchannelAccounts','UserProfileResource','destroy','end','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','params','Pause','include','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','describe','OpnechannelAccountId','Disposition','getDispositions','order','OpenchannelAccountId','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','rows','removeAnswers','notify','openchannel','CmContact','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','from','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','firstName'];(function(_0x20e5c2,_0x1cf87b){var _0x40f827=function(_0x102853){while(--_0x102853){_0x20e5c2['push'](_0x20e5c2['shift']());}};_0x40f827(++_0x1cf87b);}(_0xe53d,0xe1));var _0xde53=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xe53d[_0x44946b];return _0x249bc4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xde53('0x0'));var rimraf=require(_0xde53('0x1'));var zipdir=require(_0xde53('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xde53('0x3'));var BPromise=require(_0xde53('0x4'));var Mustache=require('mustache');var util=require(_0xde53('0x5'));var path=require(_0xde53('0x6'));var sox=require(_0xde53('0x7'));var csv=require('to-csv');var ejs=require(_0xde53('0x8'));var fs=require('fs');var _=require(_0xde53('0x9'));var squel=require(_0xde53('0xa'));var crypto=require(_0xde53('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xde53('0xc'));var toCsv=require(_0xde53('0xd'));var querystring=require('querystring');var Papa=require(_0xde53('0xe'));var Redis=require(_0xde53('0xf'));var authService=require(_0xde53('0x10'));var qs=require(_0xde53('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde53('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xde53('0x13'));var config=require(_0xde53('0x14'));var db=require('../../mysqldb')['db'];config[_0xde53('0x15')]=_[_0xde53('0x16')](config[_0xde53('0x15')],{'host':_0xde53('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xde53('0x15')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xde53('0x18'));var client=jayson[_0xde53('0x19')][_0xde53('0x1a')]({'port':0x232c});var client9002=jayson[_0xde53('0x19')][_0xde53('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x9e8662,_0x16f4ef,_0x4edd6f){if(_0x4edd6f){var _0x51d437=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x51d437[_0xde53('0x1b')](_0x16f4ef)){return _0x9e8662;}else{throw new db[(_0xde53('0x1c'))][(_0xde53('0x1d'))](_0xde53('0x1e'));}}else{return _0x9e8662;}}function respondWithRpcPromise(_0x50c89c,_0x4bc7e6,_0x761492,_0x37c985){return new BPromise(function(_0x515ddb,_0x17260a){var _0x3b2893=_0x37c985||client;return _0x3b2893[_0xde53('0x1f')](_0x50c89c,_0x761492)[_0xde53('0x20')](function(_0x35a6fb){logger[_0xde53('0x21')](_0xde53('0x22'),_0x4bc7e6,_0xde53('0x23'));logger[_0xde53('0x24')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4bc7e6,'request\x20sent',JSON[_0xde53('0x25')](_0x35a6fb));if(_0x35a6fb[_0xde53('0x26')]){if(_0x35a6fb[_0xde53('0x26')][_0xde53('0x27')]===0x1f4){logger[_0xde53('0x26')](_0xde53('0x22'),_0x4bc7e6,_0x35a6fb[_0xde53('0x26')][_0xde53('0x28')]);return _0x17260a(_0x35a6fb[_0xde53('0x26')][_0xde53('0x28')]);}logger[_0xde53('0x26')](_0xde53('0x22'),_0x4bc7e6,_0x35a6fb[_0xde53('0x26')][_0xde53('0x28')]);return _0x515ddb(_0x35a6fb[_0xde53('0x26')][_0xde53('0x28')]);}else{logger['info'](_0xde53('0x22'),_0x4bc7e6,_0xde53('0x23'));_0x515ddb(_0x35a6fb['result'][_0xde53('0x28')]);}})['catch'](function(_0x310cfb){logger[_0xde53('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x4bc7e6,_0x310cfb);_0x17260a(_0x310cfb);});});}function respondWithStatusCode(_0x22963b,_0x312a10){_0x312a10=_0x312a10||0xcc;return function(_0x22838e){if(_0x22838e){return _0x22963b[_0xde53('0x29')](_0x312a10);}return _0x22963b['status'](_0x312a10)['end']();};}function respondWithResult(_0x1de8e8,_0x35f905){_0x35f905=_0x35f905||0xc8;return function(_0x2d9efe){if(_0x2d9efe){return _0x1de8e8['status'](_0x35f905)[_0xde53('0x2a')](_0x2d9efe);}};}function respondWithFilteredResult(_0x30bc17,_0x3ce8d9){return function(_0x497c83){if(_0x497c83){var _0x39c11d=_0x497c83[_0xde53('0x2b')],_0x54413a=_0x3ce8d9[_0xde53('0x2c')],_0x319855=_0x3ce8d9['offset']+_0x3ce8d9[_0xde53('0x2d')],_0x1d12df;if(_0x319855>=_0x39c11d){_0x319855=_0x39c11d;_0x1d12df=0xc8;}else{_0x1d12df=0xce;}_0x30bc17[_0xde53('0x2e')](_0x1d12df);return _0x30bc17[_0xde53('0x2f')](_0xde53('0x30'),_0x54413a+'-'+_0x319855+'/'+_0x39c11d)[_0xde53('0x2a')](_0x497c83);}return null;};}function patchUpdates(_0x5d00e7){return function(_0x56d816){try{jsonpatch[_0xde53('0x31')](_0x56d816,_0x5d00e7,!![]);}catch(_0xd5499d){return BPromise[_0xde53('0x32')](_0xd5499d);}return _0x56d816[_0xde53('0x33')]();};}function saveUpdates(_0x3a19ad,_0x4a23de){return function(_0x11fc38){if(_0x11fc38){return _0x11fc38[_0xde53('0x34')](_0x3a19ad)['then'](function(_0x2dd1e2){return _0x2dd1e2;});}return null;};}function removeEntity(_0x5a0d54,_0x21166e){return function(_0x2f354){if(_0x2f354){return _0x2f354['destroy']()[_0xde53('0x20')](function(){var _0x3ec746=_0x2f354['get']({'plain':!![]});var _0xb72aab=_0xde53('0x35');return db[_0xde53('0x36')][_0xde53('0x37')]({'where':{'type':_0xb72aab,'resourceId':_0x3ec746['id']}})[_0xde53('0x20')](function(){return _0x2f354;});})[_0xde53('0x20')](function(){_0x5a0d54[_0xde53('0x2e')](0xcc)[_0xde53('0x38')]();});}};}function handleEntityNotFound(_0x3b1328,_0xb949f3){return function(_0x1f22f7){if(!_0x1f22f7){_0x3b1328['sendStatus'](0x194);}return _0x1f22f7;};}function handleError(_0x134a56,_0x1b367b){_0x1b367b=_0x1b367b||0x1f4;return function(_0x4f14c1){logger[_0xde53('0x26')](_0x4f14c1[_0xde53('0x39')]);if(_0x4f14c1[_0xde53('0x3a')]){delete _0x4f14c1[_0xde53('0x3a')];}_0x134a56['status'](_0x1b367b)[_0xde53('0x3b')](_0x4f14c1);};}exports[_0xde53('0x3c')]=function(_0x40314a,_0x2288d0){var _0x244ee1={'include':[{'model':db['Pause'],'as':_0xde53('0x3d')}]},_0x1fbe54={},_0x33b8e6={'count':0x0,'rows':[]};var _0x382eac=_[_0xde53('0x3e')](db[_0xde53('0x3f')][_0xde53('0x40')],function(_0x1e4d01){return{'name':_0x1e4d01[_0xde53('0x41')],'type':_0x1e4d01[_0xde53('0x42')]['key']};});_0x1fbe54[_0xde53('0x43')]=_[_0xde53('0x3e')](_0x382eac,_0xde53('0x3a'));_0x1fbe54[_0xde53('0x44')]=_[_0xde53('0x45')](_0x40314a[_0xde53('0x44')]);_0x1fbe54[_0xde53('0x46')]=_[_0xde53('0x47')](_0x1fbe54[_0xde53('0x43')],_0x1fbe54[_0xde53('0x44')]);_0x244ee1[_0xde53('0x48')]=_['intersection'](_0x1fbe54[_0xde53('0x43')],qs[_0xde53('0x49')](_0x40314a[_0xde53('0x44')][_0xde53('0x49')]));_0x244ee1[_0xde53('0x48')]=_0x244ee1['attributes'][_0xde53('0x4a')]?_0x244ee1[_0xde53('0x48')]:_0x1fbe54[_0xde53('0x43')];if(!_0x40314a[_0xde53('0x44')][_0xde53('0x4b')](_0xde53('0x4c'))){_0x244ee1[_0xde53('0x2d')]=qs[_0xde53('0x2d')](_0x40314a[_0xde53('0x44')][_0xde53('0x2d')]);_0x244ee1[_0xde53('0x2c')]=qs[_0xde53('0x2c')](_0x40314a[_0xde53('0x44')][_0xde53('0x2c')]);}_0x244ee1['order']=qs[_0xde53('0x4d')](_0x40314a['query']['sort']);_0x244ee1['where']=qs[_0xde53('0x46')](_[_0xde53('0x4e')](_0x40314a[_0xde53('0x44')],_0x1fbe54['filters']));if(_0x40314a[_0xde53('0x44')][_0xde53('0x4f')]){_0x244ee1[_0xde53('0x50')]=_['merge'](_0x244ee1['where'],{'$or':_['map'](_0x382eac,function(_0x5e3c11){if(_0x5e3c11[_0xde53('0x42')]!==_0xde53('0x51')){var _0x498413={};_0x498413[_0x5e3c11[_0xde53('0x3a')]]={'$like':'%'+_0x40314a[_0xde53('0x44')][_0xde53('0x4f')]+'%'};return _0x498413;}})});}_0x244ee1=_[_0xde53('0x52')]({},_0x244ee1,_0x40314a['options']);var _0x5aee7d={'where':_0x244ee1['where']};return db[_0xde53('0x3f')][_0xde53('0x2b')](_0x5aee7d)[_0xde53('0x20')](function(_0x19a975){_0x33b8e6[_0xde53('0x2b')]=_0x19a975;if(_0x40314a['query'][_0xde53('0x53')]){_0x244ee1['include']=[{'all':!![]}];}return db[_0xde53('0x3f')][_0xde53('0x54')](_0x244ee1);})['then'](function(_0xdf3fe2){_0x33b8e6['rows']=_0xdf3fe2;return _0x33b8e6;})['then'](respondWithFilteredResult(_0x2288d0,_0x244ee1))['catch'](handleError(_0x2288d0,null));};exports['show']=function(_0x3f86e4,_0x5086cb){var _0x338ae7={'raw':![],'where':{'id':_0x3f86e4[_0xde53('0x55')]['id']},'include':[{'model':db[_0xde53('0x56')],'as':_0xde53('0x3d')}]},_0x249f64={};_0x249f64[_0xde53('0x43')]=_['keys'](db[_0xde53('0x3f')][_0xde53('0x40')]);_0x249f64[_0xde53('0x44')]=_[_0xde53('0x45')](_0x3f86e4['query']);_0x249f64['filters']=_[_0xde53('0x47')](_0x249f64[_0xde53('0x43')],_0x249f64['query']);_0x338ae7[_0xde53('0x48')]=_[_0xde53('0x47')](_0x249f64[_0xde53('0x43')],qs['fields'](_0x3f86e4[_0xde53('0x44')][_0xde53('0x49')]));_0x338ae7[_0xde53('0x48')]=_0x338ae7[_0xde53('0x48')][_0xde53('0x4a')]?_0x338ae7[_0xde53('0x48')]:_0x249f64[_0xde53('0x43')];if(_0x3f86e4[_0xde53('0x44')][_0xde53('0x53')]){_0x338ae7[_0xde53('0x57')]=[{'all':!![]}];}_0x338ae7=_[_0xde53('0x52')]({},_0x338ae7,_0x3f86e4['options']);return db['OpenchannelAccount'][_0xde53('0x58')](_0x338ae7)[_0xde53('0x20')](handleEntityNotFound(_0x5086cb,null))[_0xde53('0x20')](respondWithResult(_0x5086cb,null))[_0xde53('0x59')](handleError(_0x5086cb,null));};exports['create']=function(_0x2d556c,_0x50235a){return db[_0xde53('0x3f')][_0xde53('0x5a')](_0x2d556c['body'],{})[_0xde53('0x20')](function(_0x215c67){var _0x48d91e=_0x2d556c[_0xde53('0x5b')][_0xde53('0x5c')]({'plain':!![]});if(!_0x48d91e)throw new Error(_0xde53('0x5d'));if(_0x48d91e[_0xde53('0x5e')]===_0xde53('0x5b')){var _0x1ba8e2=_0x215c67[_0xde53('0x5c')]({'plain':!![]});var _0x253a88=_0xde53('0x35');return db[_0xde53('0x5f')][_0xde53('0x58')]({'where':{'name':_0x253a88,'userProfileId':_0x48d91e[_0xde53('0x60')]},'raw':!![]})[_0xde53('0x20')](function(_0x53e243){if(_0x53e243&&_0x53e243['autoAssociation']===0x0){return db[_0xde53('0x36')][_0xde53('0x5a')]({'name':_0x1ba8e2['name'],'resourceId':_0x1ba8e2['id'],'type':_0x53e243[_0xde53('0x3a')],'sectionId':_0x53e243['id']},{})[_0xde53('0x20')](function(){return _0x215c67;});}else{return _0x215c67;}})[_0xde53('0x59')](function(_0x1ac1e2){logger[_0xde53('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ac1e2);throw _0x1ac1e2;});}return _0x215c67;})[_0xde53('0x20')](respondWithResult(_0x50235a,0xc9))['catch'](handleError(_0x50235a,null));};exports['update']=function(_0x19f383,_0x2f018c){if(_0x19f383[_0xde53('0x61')]['id']){delete _0x19f383[_0xde53('0x61')]['id'];}return db[_0xde53('0x3f')][_0xde53('0x58')]({'where':{'id':_0x19f383[_0xde53('0x55')]['id']},'include':[{'model':db[_0xde53('0x56')],'as':_0xde53('0x3d')}]})[_0xde53('0x20')](handleEntityNotFound(_0x2f018c,null))[_0xde53('0x20')](saveUpdates(_0x19f383[_0xde53('0x61')],null))['then'](respondWithResult(_0x2f018c,null))['catch'](handleError(_0x2f018c,null));};exports[_0xde53('0x37')]=function(_0x57a42e,_0x275e54){return db[_0xde53('0x3f')][_0xde53('0x58')]({'where':{'id':_0x57a42e[_0xde53('0x55')]['id']}})[_0xde53('0x20')](handleEntityNotFound(_0x275e54,null))[_0xde53('0x20')](removeEntity(_0x275e54,null))[_0xde53('0x59')](handleError(_0x275e54,null));};exports[_0xde53('0x62')]=function(_0x5b805a,_0xbf7b6){return db[_0xde53('0x3f')][_0xde53('0x62')]()[_0xde53('0x20')](respondWithResult(_0xbf7b6,null))[_0xde53('0x59')](handleError(_0xbf7b6,null));};exports['addDisposition']=function(_0x45d5d2,_0x4fc195,_0x28a94d){if(_0x45d5d2[_0xde53('0x61')]['id']){delete _0x45d5d2[_0xde53('0x61')]['id'];}return db['OpenchannelAccount'][_0xde53('0x58')]({'where':{'id':_0x45d5d2[_0xde53('0x55')]['id']}})['then'](handleEntityNotFound(_0x4fc195,null))[_0xde53('0x20')](function(_0x55700b){if(_0x55700b){_0x45d5d2['body'][_0xde53('0x63')]=_0x55700b['id'];return db[_0xde53('0x64')][_0xde53('0x5a')](_0x45d5d2[_0xde53('0x61')]);}})[_0xde53('0x20')](respondWithResult(_0x4fc195,null))[_0xde53('0x59')](handleError(_0x4fc195,null));};exports[_0xde53('0x65')]=function(_0x1b6c64,_0x49abc3,_0x3b08e8){var _0x54a555={'raw':![],'where':{}};var _0x2738f6={};var _0x305645={'count':0x0,'rows':[]};return db[_0xde53('0x3f')]['findOne']({'where':{'id':_0x1b6c64[_0xde53('0x55')]['id']}})[_0xde53('0x20')](handleEntityNotFound(_0x49abc3,null))['then'](function(_0x258a8f){if(_0x258a8f){_0x2738f6[_0xde53('0x43')]=_[_0xde53('0x45')](db['Disposition'][_0xde53('0x40')]);_0x2738f6['query']=_['keys'](_0x1b6c64[_0xde53('0x44')]);_0x2738f6[_0xde53('0x46')]=_[_0xde53('0x47')](_0x2738f6[_0xde53('0x43')],_0x2738f6[_0xde53('0x44')]);_0x54a555[_0xde53('0x48')]=_[_0xde53('0x47')](_0x2738f6[_0xde53('0x43')],qs[_0xde53('0x49')](_0x1b6c64[_0xde53('0x44')][_0xde53('0x49')]));_0x54a555[_0xde53('0x48')]=_0x54a555[_0xde53('0x48')][_0xde53('0x4a')]?_0x54a555[_0xde53('0x48')]:_0x2738f6[_0xde53('0x43')];if(!_0x1b6c64[_0xde53('0x44')][_0xde53('0x4b')](_0xde53('0x4c'))){_0x54a555[_0xde53('0x2d')]=qs[_0xde53('0x2d')](_0x1b6c64['query'][_0xde53('0x2d')]);_0x54a555['offset']=qs[_0xde53('0x2c')](_0x1b6c64['query'][_0xde53('0x2c')]);}_0x54a555[_0xde53('0x66')]=qs[_0xde53('0x4d')](_0x1b6c64['query'][_0xde53('0x4d')]);_0x54a555[_0xde53('0x50')]=qs[_0xde53('0x46')](_[_0xde53('0x4e')](_0x1b6c64[_0xde53('0x44')],_0x2738f6[_0xde53('0x46')]));_0x54a555['where'][_0xde53('0x67')]=_0x258a8f['id'];if(_0x1b6c64['query'][_0xde53('0x4f')]){_0x54a555[_0xde53('0x50')]=_[_0xde53('0x52')](_0x54a555[_0xde53('0x50')],{'$or':_['map'](_0x54a555[_0xde53('0x48')],function(_0x56e603){var _0x1a2976={};_0x1a2976[_0x56e603]={'$like':'%'+_0x1b6c64['query'][_0xde53('0x4f')]+'%'};return _0x1a2976;})});}_0x54a555=_[_0xde53('0x52')]({},_0x54a555,_0x1b6c64[_0xde53('0x68')]);return db['Disposition'][_0xde53('0x2b')]({'where':_0x54a555['where']})[_0xde53('0x20')](function(_0x99bc47){_0x305645[_0xde53('0x2b')]=_0x99bc47;if(_0x1b6c64[_0xde53('0x44')][_0xde53('0x53')]){_0x54a555[_0xde53('0x57')]=[{'all':!![]}];}return db[_0xde53('0x64')][_0xde53('0x54')](_0x54a555);})[_0xde53('0x20')](function(_0x3f09e7){_0x305645['rows']=_0x3f09e7;return _0x305645;});}})['then'](respondWithFilteredResult(_0x49abc3,_0x54a555))[_0xde53('0x59')](handleError(_0x49abc3,null));};exports['removeDispositions']=function(_0x2762ce,_0x35a172,_0x4ea953){return db['OpenchannelAccount'][_0xde53('0x58')]({'where':{'id':_0x2762ce[_0xde53('0x55')]['id']}})['then'](handleEntityNotFound(_0x35a172,null))[_0xde53('0x20')](function(_0x31fb92){if(_0x31fb92){return _0x31fb92[_0xde53('0x69')](_0x2762ce['query'][_0xde53('0x6a')]);}})['then'](respondWithStatusCode(_0x35a172,null))[_0xde53('0x59')](handleError(_0x35a172,null));};exports[_0xde53('0x6b')]=function(_0x16c3c9,_0x199df7,_0x2f0b80){if(_0x16c3c9[_0xde53('0x61')]['id']){delete _0x16c3c9['body']['id'];}return db['OpenchannelAccount'][_0xde53('0x58')]({'where':{'id':_0x16c3c9['params']['id']}})['then'](handleEntityNotFound(_0x199df7,null))[_0xde53('0x20')](function(_0x265285){if(_0x265285){_0x16c3c9[_0xde53('0x61')][_0xde53('0x67')]=_0x265285['id'];return db[_0xde53('0x6c')][_0xde53('0x5a')](_0x16c3c9['body']);}})[_0xde53('0x20')](respondWithResult(_0x199df7,null))[_0xde53('0x59')](handleError(_0x199df7,null));};exports[_0xde53('0x6d')]=function(_0x466f7f,_0x5d912a,_0x3eeb7c){var _0xba50f={'raw':![],'where':{}};var _0x394451={};var _0x396747={'count':0x0,'rows':[]};return db[_0xde53('0x3f')][_0xde53('0x6e')]({'where':{'id':_0x466f7f['params']['id']}})[_0xde53('0x20')](handleEntityNotFound(_0x5d912a,null))[_0xde53('0x20')](function(_0x46e5ac){if(_0x46e5ac){_0x394451[_0xde53('0x43')]=_[_0xde53('0x45')](db['CannedAnswer']['rawAttributes']);_0x394451[_0xde53('0x44')]=_['keys'](_0x466f7f[_0xde53('0x44')]);_0x394451[_0xde53('0x46')]=_['intersection'](_0x394451[_0xde53('0x43')],_0x394451[_0xde53('0x44')]);_0xba50f[_0xde53('0x48')]=_[_0xde53('0x47')](_0x394451[_0xde53('0x43')],qs[_0xde53('0x49')](_0x466f7f[_0xde53('0x44')][_0xde53('0x49')]));_0xba50f[_0xde53('0x48')]=_0xba50f['attributes'][_0xde53('0x4a')]?_0xba50f[_0xde53('0x48')]:_0x394451[_0xde53('0x43')];if(!_0x466f7f[_0xde53('0x44')]['hasOwnProperty']('nolimit')){_0xba50f[_0xde53('0x2d')]=qs['limit'](_0x466f7f['query'][_0xde53('0x2d')]);_0xba50f[_0xde53('0x2c')]=qs[_0xde53('0x2c')](_0x466f7f[_0xde53('0x44')][_0xde53('0x2c')]);}_0xba50f['order']=qs[_0xde53('0x4d')](_0x466f7f[_0xde53('0x44')][_0xde53('0x4d')]);_0xba50f[_0xde53('0x50')]=qs[_0xde53('0x46')](_[_0xde53('0x4e')](_0x466f7f[_0xde53('0x44')],_0x394451[_0xde53('0x46')]));_0xba50f[_0xde53('0x50')]['OpenchannelAccountId']=_0x46e5ac['id'];if(_0x466f7f[_0xde53('0x44')][_0xde53('0x4f')]){_0xba50f[_0xde53('0x50')]=_[_0xde53('0x52')](_0xba50f[_0xde53('0x50')],{'$or':_[_0xde53('0x3e')](_0xba50f[_0xde53('0x48')],function(_0x4412b3){var _0x2fcdbc={};_0x2fcdbc[_0x4412b3]={'$like':'%'+_0x466f7f[_0xde53('0x44')][_0xde53('0x4f')]+'%'};return _0x2fcdbc;})});}_0xba50f=_[_0xde53('0x52')]({},_0xba50f,_0x466f7f[_0xde53('0x68')]);return db[_0xde53('0x6c')]['count']({'where':_0xba50f[_0xde53('0x50')]})[_0xde53('0x20')](function(_0xef8049){_0x396747[_0xde53('0x2b')]=_0xef8049;if(_0x466f7f[_0xde53('0x44')][_0xde53('0x53')]){_0xba50f[_0xde53('0x57')]=[{'all':!![]}];}return db[_0xde53('0x6c')][_0xde53('0x54')](_0xba50f);})[_0xde53('0x20')](function(_0x5e1603){_0x396747[_0xde53('0x6f')]=_0x5e1603;return _0x396747;});}})[_0xde53('0x20')](respondWithFilteredResult(_0x5d912a,_0xba50f))['catch'](handleError(_0x5d912a,null));};exports[_0xde53('0x70')]=function(_0xcd273a,_0x3e07f3,_0x57bbc1){return db[_0xde53('0x3f')][_0xde53('0x58')]({'where':{'id':_0xcd273a[_0xde53('0x55')]['id']}})[_0xde53('0x20')](handleEntityNotFound(_0x3e07f3,null))[_0xde53('0x20')](function(_0x5b082a){if(_0x5b082a){return _0x5b082a[_0xde53('0x70')](_0xcd273a[_0xde53('0x44')][_0xde53('0x6a')]);}})[_0xde53('0x20')](respondWithStatusCode(_0x3e07f3,null))['catch'](handleError(_0x3e07f3,null));};exports[_0xde53('0x71')]=function(_0xeea76,_0x41e2f6,_0x5cbacd){var _0x23d761={'body':_0xeea76[_0xde53('0x61')],'channel':_0xde53('0x72')};var _0x236243=[];var _0x166322=[];var _0x2d586a={};var _0x4e632b=![];return db[_0xde53('0x73')][_0xde53('0x62')]()[_0xde53('0x20')](function(_0x59c6d4){if(!_0x59c6d4){throw new db[(_0xde53('0x1c'))][(_0xde53('0x1d'))](_0xde53('0x74'));}_0x236243=_['difference'](_[_0xde53('0x45')](_0x59c6d4),[_0xde53('0x75'),_0xde53('0x76')]);_0x166322=_[_0xde53('0x77')](_['keys'](_0x59c6d4),[_0xde53('0x75'),_0xde53('0x76'),_0xde53('0x78'),_0xde53('0x79')]);if(_0xeea76[_0xde53('0x61')]['id']){delete _0xeea76[_0xde53('0x61')]['id'];}if(_[_0xde53('0x7a')](_0xeea76[_0xde53('0x61')]['from'])){throw new db[(_0xde53('0x1c'))][(_0xde53('0x1d'))](_0xde53('0x7b'));}if(_[_0xde53('0x7a')](_0xeea76[_0xde53('0x61')][_0xde53('0x61')])||_0xeea76[_0xde53('0x61')][_0xde53('0x61')]===''){throw new db['Sequelize'][(_0xde53('0x1d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xeea76[_0xde53('0x61')]['mapKey'])){throw new db[(_0xde53('0x1c'))][(_0xde53('0x1d'))](_0xde53('0x7c')+_0x166322);}if(!_[_0xde53('0x7d')](_0x166322,_0xeea76[_0xde53('0x61')][_0xde53('0x7e')])){throw new db['Sequelize']['ValidationError'](_0xde53('0x7f')+_0x166322);}_0x2d586a[_0xeea76[_0xde53('0x61')][_0xde53('0x7e')]]=_0xeea76['body']['from'];})[_0xde53('0x20')](function(){return db[_0xde53('0x3f')][_0xde53('0x58')]({'where':{'id':_0xeea76[_0xde53('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0xde53('0x80'),'include':[{'model':db[_0xde53('0x73')],'as':_0xde53('0x81'),'where':_0x2d586a,'limit':0x1,'order':[[_0xde53('0x76'),_0xde53('0x82')]]}]},{'model':db[_0xde53('0x83')],'as':_0xde53('0x84')}]});})[_0xde53('0x20')](handleEntityNotFound(_0x41e2f6,null))[_0xde53('0x20')](function(_0x35e8a5){if(_0x35e8a5&&_0x35e8a5[_0xde53('0x80')]){_0x23d761[_0xde53('0x85')]=_0x35e8a5;_0x23d761[_0xde53('0x86')]=_0x35e8a5[_0xde53('0x84')];_0x23d761[_0xde53('0x87')]=_0x35e8a5[_0xde53('0x80')];_0x23d761[_0xde53('0x86')]=_[_0xde53('0x88')](_0x23d761[_0xde53('0x86')],[_0xde53('0x89')],['asc']);if(_0x23d761['account'][_0xde53('0x84')]){delete _0x23d761[_0xde53('0x85')][_0xde53('0x84')];}if(_0x23d761[_0xde53('0x85')][_0xde53('0x80')]&&_0x23d761['account'][_0xde53('0x80')]['Contacts'][_0xde53('0x4a')]){return _0x23d761[_0xde53('0x85')]['List'][_0xde53('0x81')][0x0];}var _0x31c8d2=_[_0xde53('0x16')](_0xeea76[_0xde53('0x61')],{'firstName':_0xeea76[_0xde53('0x61')][_0xde53('0x8a')],'ListId':_0x35e8a5[_0xde53('0x79')]});_0x31c8d2[_0xeea76[_0xde53('0x61')][_0xde53('0x7e')]]=_0xeea76[_0xde53('0x61')][_0xde53('0x8a')];return db[_0xde53('0x73')][_0xde53('0x5a')](_0x31c8d2,{'fields':_0x236243,'raw':!![]});}})[_0xde53('0x20')](handleEntityNotFound(_0x41e2f6,null))[_0xde53('0x20')](function(_0x2c95a9){_0x23d761['contact']=_0x2c95a9;if(_0x2c95a9){var _0xcc54b7={'ContactId':_0x2c95a9['id'],'OpenchannelAccountId':_0xeea76[_0xde53('0x55')]['id'],'from':(_0x2c95a9['firstName']||'')+'\x20'+(_0x2c95a9[_0xde53('0x8b')]||'')};var _0x3e3353={'OpenchannelAccountId':_0xeea76[_0xde53('0x55')]['id'],'closed':![]};if(_0xeea76[_0xde53('0x61')][_0xde53('0x8c')]){_0x3e3353[_0xde53('0x8c')]=_0xeea76[_0xde53('0x61')]['threadId'];return db[_0xde53('0x8d')][_0xde53('0x58')]({'where':_0x3e3353})['then'](function(_0x338195){if(_0x338195){return[_0x338195,![]];}_0xcc54b7[_0xde53('0x8c')]=_0xeea76['body'][_0xde53('0x8c')];_0xcc54b7[_0xde53('0x8e')]=_0xeea76[_0xde53('0x61')][_0xde53('0x8e')];return db[_0xde53('0x8d')][_0xde53('0x5a')](_0xcc54b7)[_0xde53('0x20')](function(_0x12b54c){return[_0x12b54c,!![]];});});}else{_0x3e3353['threadId']=null;}_0x3e3353[_0xde53('0x8f')]=_0x2c95a9['id'];return db[_0xde53('0x8d')][_0xde53('0x58')]({'where':_0x3e3353})['then'](function(_0x577382){if(_0x577382){return[_0x577382,![]];}return db[_0xde53('0x8d')][_0xde53('0x5a')](_0xcc54b7)[_0xde53('0x20')](function(_0x1967ce){return[_0x1967ce,!![]];});});}})[_0xde53('0x90')](function(_0x41804a,_0x4469fe){if(_0x41804a){_0x4e632b=_0x4469fe;if(!_0x4469fe){var _0x1b7e05={'from':(_0x23d761[_0xde53('0x91')][_0xde53('0x92')]||'')+'\x20'+(_0x23d761[_0xde53('0x91')][_0xde53('0x8b')]||'')};if(_0xeea76[_0xde53('0x61')]['threadId']&&_0xeea76[_0xde53('0x61')]['messageId']&&_0xeea76['body']['threadId']!=_0xeea76[_0xde53('0x61')][_0xde53('0x93')]){_0x1b7e05['threadId']=_0xeea76['body'][_0xde53('0x93')];}return _0x41804a[_0xde53('0x34')](_0x1b7e05);}else{return _0x41804a;}}})[_0xde53('0x20')](function(_0x7c5240){_0x23d761['interaction']=_0x7c5240[_0xde53('0x5c')]({'plain':!![]});_0x23d761['interaction'][_0xde53('0x94')]=_0x4e632b;if(_0x23d761['interaction'][_0xde53('0x94')]){if(_0x23d761[_0xde53('0x85')][_0xde53('0x95')]){_0x23d761[_0xde53('0x86')][_0xde53('0x96')]({'id':0x0,'priority':_0x23d761[_0xde53('0x86')][_0xde53('0x4a')]+0x1,'app':_0xde53('0x97'),'appdata':_0xde53('0x98'),'interval':_0xde53('0x99')});}}return db[_0xde53('0x9a')][_0xde53('0x5a')]({'body':_0xeea76[_0xde53('0x61')]['body'],'OpenchannelAccountId':_0xeea76[_0xde53('0x55')]['id'],'OpenchannelInteractionId':_0x7c5240['id'],'direction':'in','ContactId':_0x23d761[_0xde53('0x91')]['id'],'AttachmentId':_0xeea76[_0xde53('0x61')]['AttachmentId']});})[_0xde53('0x20')](function(_0x1a450e){_0x23d761[_0xde53('0x28')]=_0x1a450e;if(_0x23d761[_0xde53('0x9b')][_0xde53('0x9c')]){return db[_0xde53('0x9d')]['find']({'attributes':['id',_0xde53('0x3a')],'where':{'id':_0x23d761['interaction'][_0xde53('0x9c')]}})[_0xde53('0x20')](function(_0x1d8627){if(_0x1d8627){_0x23d761['applications'][_0xde53('0x9e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1d8627['name']+','+(_0x23d761[_0xde53('0x85')][_0xde53('0x9f')]||0xa),'interval':_0xde53('0x99')});_0x23d761[_0xde53('0xa0')]=![];}return respondWithRpcPromise(_0xde53('0xa1'),_0xde53('0xa2'),_0x23d761);});}return respondWithRpcPromise('Start',_0xde53('0xa2'),_0x23d761);})[_0xde53('0x20')](function(_0x29d05c){respondWithRpcPromise(_0xde53('0xa3'),_0xde53('0xa3'),{'event':_0xde53('0x71'),'message':_0x29d05c},client9002);return _0x29d05c;})[_0xde53('0x20')](respondWithResult(_0x41e2f6,null))[_0xde53('0x59')](handleError(_0x41e2f6,null));};exports[_0xde53('0xa4')]=function(_0x1bc2ad,_0x1b34fc,_0x1913ba){return db[_0xde53('0x3f')][_0xde53('0x6e')]({'where':{'id':_0x1bc2ad['params']['id']}})[_0xde53('0x20')](handleEntityNotFound(_0x1b34fc,null))['then'](function(_0x53f4a6){if(_0x53f4a6){return db[_0xde53('0xa5')][_0xde53('0xa6')](function(_0x2d0fcb){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x1bc2ad[_0xde53('0x55')]['id']},'transaction':_0x2d0fcb})[_0xde53('0x20')](function(_0x37cbb5){var _0x2a3c47=_[_0xde53('0x3e')](_0x1bc2ad[_0xde53('0x61')],function(_0x44c7fe){_0x44c7fe[_0xde53('0x67')]=_0x1bc2ad[_0xde53('0x55')]['id'];return _0x44c7fe;});return db[_0xde53('0x83')][_0xde53('0xa7')](_0x2a3c47,{'transaction':_0x2d0fcb});});})[_0xde53('0x20')](function(){return db[_0xde53('0x83')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x1bc2ad['params']['id']},'order':_0xde53('0x89')});});}})[_0xde53('0x20')](respondWithResult(_0x1b34fc,null))[_0xde53('0x59')](handleError(_0x1b34fc,null));};exports[_0xde53('0xa8')]=function(_0x2004f8,_0x1db9ab,_0x487c8f){var _0x306d98={};var _0x225a4d={};var _0x13f205;var _0x3c6f29;return db[_0xde53('0x3f')]['findOne']({'where':{'id':_0x2004f8[_0xde53('0x55')]['id']}})[_0xde53('0x20')](handleEntityNotFound(_0x1db9ab,null))[_0xde53('0x20')](function(_0x24d50c){if(_0x24d50c){_0x13f205=_0x24d50c;_0x225a4d['model']=_[_0xde53('0x45')](db[_0xde53('0x83')][_0xde53('0x40')]);_0x225a4d[_0xde53('0x44')]=_[_0xde53('0x45')](_0x2004f8[_0xde53('0x44')]);_0x225a4d[_0xde53('0x46')]=_['intersection'](_0x225a4d[_0xde53('0x43')],_0x225a4d['query']);_0x306d98[_0xde53('0x48')]=_[_0xde53('0x47')](_0x225a4d[_0xde53('0x43')],qs[_0xde53('0x49')](_0x2004f8['query']['fields']));_0x306d98[_0xde53('0x48')]=_0x306d98[_0xde53('0x48')][_0xde53('0x4a')]?_0x306d98[_0xde53('0x48')]:_0x225a4d[_0xde53('0x43')];_0x306d98[_0xde53('0x66')]=qs[_0xde53('0x4d')](_0x2004f8[_0xde53('0x44')][_0xde53('0x4d')]);_0x306d98['where']=qs['filters'](_[_0xde53('0x4e')](_0x2004f8['query'],_0x225a4d[_0xde53('0x46')]));if(_0x2004f8[_0xde53('0x44')][_0xde53('0x4f')]){_0x306d98['where']=_['merge'](_0x306d98['where'],{'$or':_[_0xde53('0x3e')](_0x306d98['attributes'],function(_0x27d2a9){var _0x1942f5={};_0x1942f5[_0x27d2a9]={'$like':'%'+_0x2004f8['query']['filter']+'%'};return _0x1942f5;})});}_0x306d98=_[_0xde53('0x52')]({},_0x306d98,_0x2004f8[_0xde53('0x68')]);return _0x13f205['getApplications'](_0x306d98);}})[_0xde53('0x20')](function(_0x1ccb74){if(_0x1ccb74){_0x3c6f29=_0x1ccb74[_0xde53('0x4a')];if(!_0x2004f8[_0xde53('0x44')][_0xde53('0x4b')](_0xde53('0x4c'))){_0x306d98[_0xde53('0x2d')]=qs[_0xde53('0x2d')](_0x2004f8[_0xde53('0x44')][_0xde53('0x2d')]);_0x306d98[_0xde53('0x2c')]=qs['offset'](_0x2004f8[_0xde53('0x44')][_0xde53('0x2c')]);}return _0x13f205[_0xde53('0xa8')](_0x306d98);}})['then'](function(_0x23c0fd){if(_0x23c0fd){return _0x23c0fd?{'count':_0x3c6f29,'rows':_0x23c0fd}:null;}})[_0xde53('0x20')](respondWithResult(_0x1db9ab,null))[_0xde53('0x59')](handleError(_0x1db9ab,null));};exports['getInteractions']=function(_0x2b372a,_0x33c466,_0x48caab){var _0x4844a8={'raw':![],'where':{}};var _0x17d1c8={};var _0x2c2fd8={'count':0x0,'rows':[]};return db[_0xde53('0x3f')][_0xde53('0x6e')]({'where':{'id':_0x2b372a[_0xde53('0x55')]['id']}})[_0xde53('0x20')](handleEntityNotFound(_0x33c466,null))[_0xde53('0x20')](function(_0x51acb3){if(_0x51acb3){_0x17d1c8[_0xde53('0x43')]=_[_0xde53('0x45')](db[_0xde53('0x8d')]['rawAttributes']);_0x17d1c8['query']=_[_0xde53('0x45')](_0x2b372a[_0xde53('0x44')]);_0x17d1c8['filters']=_['intersection'](_0x17d1c8[_0xde53('0x43')],_0x17d1c8[_0xde53('0x44')]);_0x4844a8[_0xde53('0x48')]=_['intersection'](_0x17d1c8['model'],qs[_0xde53('0x49')](_0x2b372a['query']['fields']));_0x4844a8[_0xde53('0x48')]=_0x4844a8[_0xde53('0x48')][_0xde53('0x4a')]?_0x4844a8['attributes']:_0x17d1c8['model'];if(!_0x2b372a[_0xde53('0x44')][_0xde53('0x4b')](_0xde53('0x4c'))){_0x4844a8[_0xde53('0x2d')]=qs[_0xde53('0x2d')](_0x2b372a[_0xde53('0x44')][_0xde53('0x2d')]);_0x4844a8['offset']=qs[_0xde53('0x2c')](_0x2b372a[_0xde53('0x44')][_0xde53('0x2c')]);}_0x4844a8[_0xde53('0x66')]=qs[_0xde53('0x4d')](_0x2b372a[_0xde53('0x44')][_0xde53('0x4d')]);_0x4844a8[_0xde53('0x50')]=qs[_0xde53('0x46')](_[_0xde53('0x4e')](_0x2b372a[_0xde53('0x44')],_0x17d1c8[_0xde53('0x46')]));_0x4844a8[_0xde53('0x50')][_0xde53('0x67')]=_0x51acb3['id'];if(_0x2b372a[_0xde53('0x44')][_0xde53('0x4f')]){_0x4844a8[_0xde53('0x50')]=_[_0xde53('0x52')](_0x4844a8['where'],{'$or':_[_0xde53('0x3e')](_0x4844a8[_0xde53('0x48')],function(_0x4fe731){var _0x5807b2={};_0x5807b2[_0x4fe731]={'$like':'%'+_0x2b372a['query'][_0xde53('0x4f')]+'%'};return _0x5807b2;})});}_0x4844a8=_[_0xde53('0x52')]({},_0x4844a8,_0x2b372a['options']);return db[_0xde53('0x8d')][_0xde53('0x2b')]({'where':_0x4844a8[_0xde53('0x50')]})['then'](function(_0x1adebe){_0x2c2fd8[_0xde53('0x2b')]=_0x1adebe;if(_0x2b372a['query']['includeAll']){_0x4844a8[_0xde53('0x57')]=[{'model':db['CmContact'],'as':_0xde53('0xa9'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xde53('0x3a'),_0xde53('0xaa'),_0xde53('0xab')],'required':![]},{'model':db[_0xde53('0xac')],'as':_0xde53('0xad'),'attributes':['id',_0xde53('0x3a'),_0xde53('0xae')],'where':_0x2b372a[_0xde53('0x44')][_0xde53('0xaf')]?{'id':_0x2b372a[_0xde53('0x44')][_0xde53('0xaf')]}:undefined,'required':_0x2b372a[_0xde53('0x44')][_0xde53('0xaf')]?!![]:![]}];}return db[_0xde53('0x8d')][_0xde53('0x54')](_0x4844a8);})['then'](function(_0x375777){_0x2c2fd8['rows']=_0x375777;return _0x2c2fd8;});}})[_0xde53('0x20')](respondWithFilteredResult(_0x33c466,_0x4844a8))[_0xde53('0x59')](handleError(_0x33c466,null));};exports[_0xde53('0xb0')]=function(_0x370e67,_0x176c91,_0x2958ae){return db[_0xde53('0x3f')][_0xde53('0x58')]({'where':{'id':_0x370e67['params']['id']}})[_0xde53('0x20')](handleEntityNotFound(_0x176c91,null))[_0xde53('0x20')](function(_0x49644d){if(_0x49644d){return _0x49644d[_0xde53('0xb0')](_0x370e67[_0xde53('0x61')][_0xde53('0x6a')],_[_0xde53('0xb1')](_0x370e67[_0xde53('0x61')],[_0xde53('0x6a'),'id'])||{})[_0xde53('0x90')](function(_0x5b64dd){for(var _0x557560=0x0;_0x557560<_0x370e67[_0xde53('0x61')][_0xde53('0x6a')][_0xde53('0x4a')];_0x557560+=0x1){socket[_0xde53('0xb2')]('userOpenchannelAccount:save',{'UserId':_0x370e67[_0xde53('0x61')][_0xde53('0x6a')][_0x557560],'OpenchannelAccountId':_0x370e67[_0xde53('0x55')]['id']});}return _0x5b64dd;});}})['then'](respondWithResult(_0x176c91,null))[_0xde53('0x59')](handleError(_0x176c91,null));};exports['removeAgents']=function(_0x5a04c7,_0x2b590a,_0x127cdf){return db[_0xde53('0x3f')][_0xde53('0x58')]({'where':{'id':_0x5a04c7['params']['id']}})[_0xde53('0x20')](handleEntityNotFound(_0x2b590a,null))['then'](function(_0x3f7cbd){if(_0x3f7cbd){return _0x3f7cbd[_0xde53('0xb3')](_0x5a04c7[_0xde53('0x44')][_0xde53('0x6a')])[_0xde53('0x20')](function(){if(_['isArray'](_0x5a04c7['query']['ids'])){for(var _0x102248=0x0;_0x102248<_0x5a04c7['query'][_0xde53('0x6a')]['length'];_0x102248+=0x1){socket[_0xde53('0xb2')](_0xde53('0xb4'),{'UserId':Number(_0x5a04c7['query'][_0xde53('0x6a')][_0x102248]),'OpenchannelAccountId':Number(_0x5a04c7[_0xde53('0x55')]['id'])});}}else{socket[_0xde53('0xb2')](_0xde53('0xb4'),{'UserId':Number(_0x5a04c7[_0xde53('0x44')][_0xde53('0x6a')]),'OpenchannelAccountId':Number(_0x5a04c7[_0xde53('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x2b590a,null))[_0xde53('0x59')](handleError(_0x2b590a,null));};exports[_0xde53('0xb5')]=function(_0x36b85b,_0x182831,_0x5e357d){var _0x14d65e={};var _0x2756db={};var _0x59926d;var _0x153529;return db[_0xde53('0x3f')]['findOne']({'where':{'id':_0x36b85b['params']['id']}})[_0xde53('0x20')](handleEntityNotFound(_0x182831,null))['then'](function(_0x896d2c){if(_0x896d2c){_0x59926d=_0x896d2c;_0x2756db['model']=_[_0xde53('0x45')](db['User'][_0xde53('0x40')]);_0x2756db[_0xde53('0x44')]=_[_0xde53('0x45')](_0x36b85b[_0xde53('0x44')]);_0x2756db['filters']=_['intersection'](_0x2756db['model'],_0x2756db['query']);_0x14d65e[_0xde53('0x48')]=_[_0xde53('0x47')](_0x2756db[_0xde53('0x43')],qs['fields'](_0x36b85b[_0xde53('0x44')]['fields']));_0x14d65e[_0xde53('0x48')]=_0x14d65e[_0xde53('0x48')][_0xde53('0x4a')]?_0x14d65e[_0xde53('0x48')]:_0x2756db[_0xde53('0x43')];_0x14d65e[_0xde53('0x66')]=qs[_0xde53('0x4d')](_0x36b85b[_0xde53('0x44')]['sort']);_0x14d65e[_0xde53('0x50')]=qs[_0xde53('0x46')](_[_0xde53('0x4e')](_0x36b85b['query'],_0x2756db[_0xde53('0x46')]));if(_0x36b85b[_0xde53('0x44')][_0xde53('0x4f')]){_0x14d65e['where']=_[_0xde53('0x52')](_0x14d65e[_0xde53('0x50')],{'$or':_[_0xde53('0x3e')](_0x14d65e[_0xde53('0x48')],function(_0x1c4e3b){var _0x3a573a={};_0x3a573a[_0x1c4e3b]={'$like':'%'+_0x36b85b[_0xde53('0x44')][_0xde53('0x4f')]+'%'};return _0x3a573a;})});}_0x14d65e=_['merge']({},_0x14d65e,_0x36b85b[_0xde53('0x68')]);return _0x59926d[_0xde53('0xb5')](_0x14d65e);}})['then'](function(_0x5375f3){if(_0x5375f3){_0x153529=_0x5375f3[_0xde53('0x4a')];if(!_0x36b85b[_0xde53('0x44')][_0xde53('0x4b')](_0xde53('0x4c'))){_0x14d65e['limit']=qs[_0xde53('0x2d')](_0x36b85b[_0xde53('0x44')]['limit']);_0x14d65e['offset']=qs['offset'](_0x36b85b[_0xde53('0x44')]['offset']);}return _0x59926d[_0xde53('0xb5')](_0x14d65e);}})['then'](function(_0x528039){if(_0x528039){return _0x528039?{'count':_0x153529,'rows':_0x528039}:null;}})['then'](respondWithResult(_0x182831,null))[_0xde53('0x59')](handleError(_0x182831,null));};exports[_0xde53('0x3b')]=function(_0x5b3e18,_0x498038,_0x7e0bb9){var _0x20104b,_0x49bb45,_0x7fd0a1;if(_[_0xde53('0x7a')](_0x5b3e18[_0xde53('0x61')][_0xde53('0x61')])||_0x5b3e18['body']['body']===''){throw new db[(_0xde53('0x1c'))][(_0xde53('0x1d'))](_0xde53('0xb6'));}if(_[_0xde53('0x7a')](_0x5b3e18[_0xde53('0x61')]['to'])){}_0x20104b=_0x5b3e18['body']['to'];return db[_0xde53('0x3f')][_0xde53('0x6e')]({'where':{'id':_0x5b3e18[_0xde53('0x55')]['id']}})[_0xde53('0x20')](handleEntityNotFound(_0x498038,null))['then'](function(_0x20214b){if(_0x20214b){return db['OpenchannelAccount'][_0xde53('0x58')]({'where':{'id':_0x20214b['id']},'include':[{'model':db['CmList'],'as':_0xde53('0x80'),'include':[{'model':db[_0xde53('0x73')],'as':'Contacts','where':{[_0x20214b[_0xde53('0x7e')]]:_0x20104b},'limit':0x1,'order':[[_0xde53('0x76'),'DESC']]}]}]})[_0xde53('0x20')](handleEntityNotFound(_0x498038,null))['then'](function(_0x238c44){if(_0x238c44&&_0x238c44[_0xde53('0x80')]){_0x49bb45=_0x238c44[_0xde53('0x5c')]({'plain':!![]});if(_0x49bb45[_0xde53('0x80')]&&_0x49bb45['List']['Contacts']['length']){return _0x49bb45[_0xde53('0x80')][_0xde53('0x81')][0x0];}return db[_0xde53('0x73')][_0xde53('0x5a')](_[_0xde53('0x16')](_0x5b3e18[_0xde53('0x61')],{'firstName':_0x20104b,[_0x238c44[_0xde53('0x7e')]]:_0x20104b,'phone':_0x20104b,'ListId':_0x49bb45[_0xde53('0x79')]}));}})[_0xde53('0x20')](handleEntityNotFound(_0x498038,null))['then'](function(_0x4f3526){if(_0x4f3526){_0x7fd0a1=_0x4f3526;return db[_0xde53('0x8d')][_0xde53('0x58')]({'where':{'ContactId':_0x7fd0a1['id'],'closed':![],'OpenchannelAccountId':_0x49bb45['id']}})[_0xde53('0x20')](function(_0x51595f){if(_0x51595f){return[_0x51595f,![]];}return db[_0xde53('0x8d')]['create']({'UserId':_0x5b3e18[_0xde53('0x5b')]['id'],'ContactId':_0x7fd0a1['id'],'OpenchannelAccountId':_0x49bb45['id'],'lastMsgDirection':_0xde53('0xb7'),'Messages':[_[_0xde53('0x52')](_0x5b3e18[_0xde53('0x61')],{'read':![],'body':_0x5b3e18[_0xde53('0x61')][_0xde53('0x61')],'OpenchannelAccountId':_0x49bb45['id'],'UserId':_0x5b3e18[_0xde53('0x5b')]['id'],'ContactId':_0x7fd0a1['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xde53('0xb8')}]})[_0xde53('0x20')](function(_0x5ed7a5){return[_0x5ed7a5,!![]];});});}})['spread'](function(_0x4c2ff5,_0x264392){if(_0x264392){return _0x4c2ff5;}return db[_0xde53('0x9a')]['create'](_['merge'](_0x5b3e18[_0xde53('0x61')],{'read':![],'body':_0x5b3e18[_0xde53('0x61')][_0xde53('0x61')],'OpenchannelAccountId':_0x49bb45['id'],'OpenchannelInteractionId':_0x4c2ff5['id'],'UserId':_0x5b3e18[_0xde53('0x5b')]['id'],'ContactId':_0x7fd0a1['id']}))[_0xde53('0x20')](function(_0x109427){_0x4c2ff5[_0xde53('0xb9')][_0xde53('0xb8')]=[];_0x4c2ff5[_0xde53('0xb9')][_0xde53('0xb8')][_0xde53('0x96')](_0x109427[_0xde53('0xb9')]);return _0x4c2ff5;});});}})[_0xde53('0x20')](respondWithResult(_0x498038,null))['catch'](handleError(_0x498038,null));}; \ No newline at end of file +var _0xc483=['account','Contacts','contact','firstName','threadId','OpenchannelInteraction','externalUrl','spread','lastName','messageId','interaction','created','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','Start','startRouting','EventManager','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./openchannelAccount.socket','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','destroy','get','OpenchannelAccounts','UserProfileResource','end','stack','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','params','fields','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','pick','OpenchannelAccountId','removeDispositions','CannedAnswer','hasOwnProperty','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','OpenchannelApplication','applications','Applications','list','orderBy','priority','asc'];(function(_0x11d6fd,_0x5d376a){var _0x202951=function(_0x232b12){while(--_0x232b12){_0x11d6fd['push'](_0x11d6fd['shift']());}};_0x202951(++_0x5d376a);}(_0xc483,0x1a6));var _0x3c48=function(_0x44d748,_0x5b226c){_0x44d748=_0x44d748-0x0;var _0x41b818=_0xc483[_0x44d748];return _0x41b818;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3c48('0x0'));var rimraf=require(_0x3c48('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c48('0x2'));var rp=require(_0x3c48('0x3'));var moment=require(_0x3c48('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3c48('0x5'));var util=require(_0x3c48('0x6'));var path=require('path');var sox=require(_0x3c48('0x7'));var csv=require('to-csv');var ejs=require(_0x3c48('0x8'));var fs=require('fs');var _=require(_0x3c48('0x9'));var squel=require(_0x3c48('0xa'));var crypto=require('crypto');var jsforce=require(_0x3c48('0xb'));var deskjs=require(_0x3c48('0xc'));var toCsv=require(_0x3c48('0xd'));var querystring=require(_0x3c48('0xe'));var Papa=require(_0x3c48('0xf'));var Redis=require(_0x3c48('0x10'));var authService=require(_0x3c48('0x11'));var qs=require(_0x3c48('0x12'));var as=require(_0x3c48('0x13'));var hardwareService=require(_0x3c48('0x14'));var logger=require(_0x3c48('0x15'))(_0x3c48('0x16'));var utils=require(_0x3c48('0x17'));var config=require(_0x3c48('0x18'));var db=require(_0x3c48('0x19'))['db'];config[_0x3c48('0x1a')]=_[_0x3c48('0x1b')](config[_0x3c48('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c48('0x1a')]));require(_0x3c48('0x1c'))['register'](socket);var jayson=require(_0x3c48('0x1d'));var client=jayson[_0x3c48('0x1e')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x334bc6,_0x12b728,_0x4ffd5f){if(_0x4ffd5f){var _0x157e94=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x157e94[_0x3c48('0x1f')](_0x12b728)){return _0x334bc6;}else{throw new db['Sequelize'][(_0x3c48('0x20'))](_0x3c48('0x21'));}}else{return _0x334bc6;}}function respondWithRpcPromise(_0x19303c,_0x19a8ee,_0x5dd394,_0x23c60c){return new BPromise(function(_0x3b92cc,_0xf702d6){var _0x355269=_0x23c60c||client;return _0x355269['request'](_0x19303c,_0x5dd394)[_0x3c48('0x22')](function(_0x421bce){logger[_0x3c48('0x23')](_0x3c48('0x24'),_0x19a8ee,_0x3c48('0x25'));logger[_0x3c48('0x26')](_0x3c48('0x27'),_0x19a8ee,'request\x20sent',JSON['stringify'](_0x421bce));if(_0x421bce[_0x3c48('0x28')]){if(_0x421bce['error'][_0x3c48('0x29')]===0x1f4){logger[_0x3c48('0x28')](_0x3c48('0x24'),_0x19a8ee,_0x421bce['error'][_0x3c48('0x2a')]);return _0xf702d6(_0x421bce['error'][_0x3c48('0x2a')]);}logger[_0x3c48('0x28')](_0x3c48('0x24'),_0x19a8ee,_0x421bce[_0x3c48('0x28')]['message']);return _0x3b92cc(_0x421bce[_0x3c48('0x28')][_0x3c48('0x2a')]);}else{logger[_0x3c48('0x23')](_0x3c48('0x24'),_0x19a8ee,_0x3c48('0x25'));_0x3b92cc(_0x421bce['result']['message']);}})[_0x3c48('0x2b')](function(_0x36201a){logger[_0x3c48('0x28')](_0x3c48('0x24'),_0x19a8ee,_0x36201a);_0xf702d6(_0x36201a);});});}function respondWithStatusCode(_0x3b3612,_0x1ef7f2){_0x1ef7f2=_0x1ef7f2||0xcc;return function(_0x43ec1a){if(_0x43ec1a){return _0x3b3612[_0x3c48('0x2c')](_0x1ef7f2);}return _0x3b3612['status'](_0x1ef7f2)['end']();};}function respondWithResult(_0x309543,_0x2a5bad){_0x2a5bad=_0x2a5bad||0xc8;return function(_0x5aa430){if(_0x5aa430){return _0x309543[_0x3c48('0x2d')](_0x2a5bad)[_0x3c48('0x2e')](_0x5aa430);}};}function respondWithFilteredResult(_0x3f2ef0,_0xba3f8b){return function(_0x4c5c2a){if(_0x4c5c2a){var _0x1806c3=_0x4c5c2a[_0x3c48('0x2f')],_0x101925=_0xba3f8b['offset'],_0x2fb42e=_0xba3f8b[_0x3c48('0x30')]+_0xba3f8b[_0x3c48('0x31')],_0x4730cc;if(_0x2fb42e>=_0x1806c3){_0x2fb42e=_0x1806c3;_0x4730cc=0xc8;}else{_0x4730cc=0xce;}_0x3f2ef0[_0x3c48('0x2d')](_0x4730cc);return _0x3f2ef0[_0x3c48('0x32')]('Content-Range',_0x101925+'-'+_0x2fb42e+'/'+_0x1806c3)[_0x3c48('0x2e')](_0x4c5c2a);}return null;};}function patchUpdates(_0x327ddb){return function(_0x35c989){try{jsonpatch[_0x3c48('0x33')](_0x35c989,_0x327ddb,!![]);}catch(_0x4915fd){return BPromise[_0x3c48('0x34')](_0x4915fd);}return _0x35c989[_0x3c48('0x35')]();};}function saveUpdates(_0x3e3393,_0x431b6a){return function(_0x1257c2){if(_0x1257c2){return _0x1257c2['update'](_0x3e3393)[_0x3c48('0x22')](function(_0x86364b){return _0x86364b;});}return null;};}function removeEntity(_0x5f4d95,_0x12bf78){return function(_0x23bdf4){if(_0x23bdf4){return _0x23bdf4[_0x3c48('0x36')]()['then'](function(){var _0x5a5580=_0x23bdf4[_0x3c48('0x37')]({'plain':!![]});var _0x224ceb=_0x3c48('0x38');return db[_0x3c48('0x39')][_0x3c48('0x36')]({'where':{'type':_0x224ceb,'resourceId':_0x5a5580['id']}})[_0x3c48('0x22')](function(){return _0x23bdf4;});})[_0x3c48('0x22')](function(){_0x5f4d95[_0x3c48('0x2d')](0xcc)[_0x3c48('0x3a')]();});}};}function handleEntityNotFound(_0x965d21,_0x1fe8d2){return function(_0x32d067){if(!_0x32d067){_0x965d21[_0x3c48('0x2c')](0x194);}return _0x32d067;};}function handleError(_0x60dae,_0x3f463a){_0x3f463a=_0x3f463a||0x1f4;return function(_0x1e200b){logger[_0x3c48('0x28')](_0x1e200b[_0x3c48('0x3b')]);if(_0x1e200b[_0x3c48('0x3c')]){delete _0x1e200b[_0x3c48('0x3c')];}_0x60dae[_0x3c48('0x2d')](_0x3f463a)[_0x3c48('0x3d')](_0x1e200b);};}exports['index']=function(_0xe7fe02,_0x407227){var _0x3995cc={'include':[{'model':db[_0x3c48('0x3e')],'as':_0x3c48('0x3f')}]},_0x60d509={},_0x5eb9a4={'count':0x0,'rows':[]};var _0x50f0b3=_['map'](db[_0x3c48('0x40')][_0x3c48('0x41')],function(_0x2a9ee8){return{'name':_0x2a9ee8[_0x3c48('0x42')],'type':_0x2a9ee8['type'][_0x3c48('0x43')]};});_0x60d509[_0x3c48('0x44')]=_[_0x3c48('0x45')](_0x50f0b3,'name');_0x60d509[_0x3c48('0x46')]=_[_0x3c48('0x47')](_0xe7fe02[_0x3c48('0x46')]);_0x60d509[_0x3c48('0x48')]=_['intersection'](_0x60d509[_0x3c48('0x44')],_0x60d509[_0x3c48('0x46')]);_0x3995cc[_0x3c48('0x49')]=_[_0x3c48('0x4a')](_0x60d509[_0x3c48('0x44')],qs['fields'](_0xe7fe02['query']['fields']));_0x3995cc[_0x3c48('0x49')]=_0x3995cc['attributes'][_0x3c48('0x4b')]?_0x3995cc['attributes']:_0x60d509[_0x3c48('0x44')];if(!_0xe7fe02['query']['hasOwnProperty'](_0x3c48('0x4c'))){_0x3995cc[_0x3c48('0x31')]=qs[_0x3c48('0x31')](_0xe7fe02[_0x3c48('0x46')][_0x3c48('0x31')]);_0x3995cc[_0x3c48('0x30')]=qs[_0x3c48('0x30')](_0xe7fe02[_0x3c48('0x46')][_0x3c48('0x30')]);}_0x3995cc[_0x3c48('0x4d')]=qs[_0x3c48('0x4e')](_0xe7fe02[_0x3c48('0x46')]['sort']);_0x3995cc['where']=qs[_0x3c48('0x48')](_['pick'](_0xe7fe02[_0x3c48('0x46')],_0x60d509[_0x3c48('0x48')]));if(_0xe7fe02[_0x3c48('0x46')]['filter']){_0x3995cc[_0x3c48('0x4f')]=_[_0x3c48('0x50')](_0x3995cc[_0x3c48('0x4f')],{'$or':_[_0x3c48('0x45')](_0x50f0b3,function(_0x24287e){if(_0x24287e[_0x3c48('0x51')]!==_0x3c48('0x52')){var _0x538dba={};_0x538dba[_0x24287e[_0x3c48('0x3c')]]={'$like':'%'+_0xe7fe02[_0x3c48('0x46')][_0x3c48('0x53')]+'%'};return _0x538dba;}})});}_0x3995cc=_[_0x3c48('0x50')]({},_0x3995cc,_0xe7fe02[_0x3c48('0x54')]);var _0x1623c8={'where':_0x3995cc[_0x3c48('0x4f')]};return db['OpenchannelAccount'][_0x3c48('0x2f')](_0x1623c8)['then'](function(_0x94aa62){_0x5eb9a4[_0x3c48('0x2f')]=_0x94aa62;if(_0xe7fe02['query']['includeAll']){_0x3995cc[_0x3c48('0x55')]=[{'all':!![]}];}return db[_0x3c48('0x40')][_0x3c48('0x56')](_0x3995cc);})[_0x3c48('0x22')](function(_0x2f2da9){_0x5eb9a4[_0x3c48('0x57')]=_0x2f2da9;return _0x5eb9a4;})[_0x3c48('0x22')](respondWithFilteredResult(_0x407227,_0x3995cc))['catch'](handleError(_0x407227,null));};exports[_0x3c48('0x58')]=function(_0x4d39a1,_0x5d9614){var _0x28ca57={'raw':![],'where':{'id':_0x4d39a1[_0x3c48('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x3c48('0x3f')}]},_0x1be503={};_0x1be503[_0x3c48('0x44')]=_[_0x3c48('0x47')](db[_0x3c48('0x40')][_0x3c48('0x41')]);_0x1be503['query']=_[_0x3c48('0x47')](_0x4d39a1[_0x3c48('0x46')]);_0x1be503[_0x3c48('0x48')]=_['intersection'](_0x1be503[_0x3c48('0x44')],_0x1be503[_0x3c48('0x46')]);_0x28ca57[_0x3c48('0x49')]=_[_0x3c48('0x4a')](_0x1be503[_0x3c48('0x44')],qs[_0x3c48('0x5a')](_0x4d39a1[_0x3c48('0x46')][_0x3c48('0x5a')]));_0x28ca57[_0x3c48('0x49')]=_0x28ca57[_0x3c48('0x49')]['length']?_0x28ca57[_0x3c48('0x49')]:_0x1be503[_0x3c48('0x44')];if(_0x4d39a1[_0x3c48('0x46')][_0x3c48('0x5b')]){_0x28ca57[_0x3c48('0x55')]=[{'all':!![]}];}_0x28ca57=_[_0x3c48('0x50')]({},_0x28ca57,_0x4d39a1[_0x3c48('0x54')]);return db[_0x3c48('0x40')][_0x3c48('0x5c')](_0x28ca57)['then'](handleEntityNotFound(_0x5d9614,null))[_0x3c48('0x22')](respondWithResult(_0x5d9614,null))[_0x3c48('0x2b')](handleError(_0x5d9614,null));};exports[_0x3c48('0x5d')]=function(_0xef700c,_0x384eef){return db['OpenchannelAccount'][_0x3c48('0x5d')](_0xef700c[_0x3c48('0x5e')],{})[_0x3c48('0x22')](function(_0x4ba749){var _0x40840c=_0xef700c[_0x3c48('0x5f')][_0x3c48('0x37')]({'plain':!![]});if(!_0x40840c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40840c[_0x3c48('0x60')]===_0x3c48('0x5f')){var _0x4f2b5e=_0x4ba749[_0x3c48('0x37')]({'plain':!![]});var _0x10b8ea=_0x3c48('0x38');return db[_0x3c48('0x61')][_0x3c48('0x5c')]({'where':{'name':_0x10b8ea,'userProfileId':_0x40840c[_0x3c48('0x62')]},'raw':!![]})[_0x3c48('0x22')](function(_0xe1ddf0){if(_0xe1ddf0&&_0xe1ddf0['autoAssociation']===0x0){return db[_0x3c48('0x39')][_0x3c48('0x5d')]({'name':_0x4f2b5e['name'],'resourceId':_0x4f2b5e['id'],'type':_0xe1ddf0[_0x3c48('0x3c')],'sectionId':_0xe1ddf0['id']},{})[_0x3c48('0x22')](function(){return _0x4ba749;});}else{return _0x4ba749;}})[_0x3c48('0x2b')](function(_0x14c7c1){logger['error'](_0x3c48('0x63'),_0x14c7c1);throw _0x14c7c1;});}return _0x4ba749;})[_0x3c48('0x22')](respondWithResult(_0x384eef,0xc9))['catch'](handleError(_0x384eef,null));};exports[_0x3c48('0x64')]=function(_0x1c51c0,_0x4f2a7f){if(_0x1c51c0[_0x3c48('0x5e')]['id']){delete _0x1c51c0[_0x3c48('0x5e')]['id'];}return db[_0x3c48('0x40')][_0x3c48('0x5c')]({'where':{'id':_0x1c51c0[_0x3c48('0x59')]['id']},'include':[{'model':db[_0x3c48('0x3e')],'as':_0x3c48('0x3f')}]})[_0x3c48('0x22')](handleEntityNotFound(_0x4f2a7f,null))[_0x3c48('0x22')](saveUpdates(_0x1c51c0[_0x3c48('0x5e')],null))[_0x3c48('0x22')](respondWithResult(_0x4f2a7f,null))['catch'](handleError(_0x4f2a7f,null));};exports['destroy']=function(_0x50bdb9,_0x520463){return db[_0x3c48('0x40')][_0x3c48('0x5c')]({'where':{'id':_0x50bdb9['params']['id']}})['then'](handleEntityNotFound(_0x520463,null))[_0x3c48('0x22')](removeEntity(_0x520463,null))[_0x3c48('0x2b')](handleError(_0x520463,null));};exports[_0x3c48('0x65')]=function(_0x3d2b6a,_0x4cc221){return db[_0x3c48('0x40')][_0x3c48('0x65')]()['then'](respondWithResult(_0x4cc221,null))[_0x3c48('0x2b')](handleError(_0x4cc221,null));};exports[_0x3c48('0x66')]=function(_0x4b3a15,_0x28095f,_0x4ddd7c){if(_0x4b3a15[_0x3c48('0x5e')]['id']){delete _0x4b3a15[_0x3c48('0x5e')]['id'];}return db[_0x3c48('0x40')][_0x3c48('0x5c')]({'where':{'id':_0x4b3a15[_0x3c48('0x59')]['id']}})[_0x3c48('0x22')](handleEntityNotFound(_0x28095f,null))[_0x3c48('0x22')](function(_0x4c9af2){if(_0x4c9af2){_0x4b3a15['body'][_0x3c48('0x67')]=_0x4c9af2['id'];return db[_0x3c48('0x68')]['create'](_0x4b3a15[_0x3c48('0x5e')]);}})[_0x3c48('0x22')](respondWithResult(_0x28095f,null))[_0x3c48('0x2b')](handleError(_0x28095f,null));};exports[_0x3c48('0x69')]=function(_0x443259,_0x3f22ec,_0x527d57){var _0x378273={'raw':![],'where':{}};var _0x5a3208={};var _0x5f1233={'count':0x0,'rows':[]};return db[_0x3c48('0x40')][_0x3c48('0x6a')]({'where':{'id':_0x443259[_0x3c48('0x59')]['id']}})[_0x3c48('0x22')](handleEntityNotFound(_0x3f22ec,null))[_0x3c48('0x22')](function(_0x8e50c5){if(_0x8e50c5){_0x5a3208['model']=_['keys'](db[_0x3c48('0x68')][_0x3c48('0x41')]);_0x5a3208[_0x3c48('0x46')]=_[_0x3c48('0x47')](_0x443259['query']);_0x5a3208[_0x3c48('0x48')]=_['intersection'](_0x5a3208['model'],_0x5a3208['query']);_0x378273[_0x3c48('0x49')]=_[_0x3c48('0x4a')](_0x5a3208[_0x3c48('0x44')],qs[_0x3c48('0x5a')](_0x443259[_0x3c48('0x46')][_0x3c48('0x5a')]));_0x378273[_0x3c48('0x49')]=_0x378273['attributes'][_0x3c48('0x4b')]?_0x378273['attributes']:_0x5a3208[_0x3c48('0x44')];if(!_0x443259[_0x3c48('0x46')]['hasOwnProperty'](_0x3c48('0x4c'))){_0x378273[_0x3c48('0x31')]=qs[_0x3c48('0x31')](_0x443259['query']['limit']);_0x378273[_0x3c48('0x30')]=qs[_0x3c48('0x30')](_0x443259[_0x3c48('0x46')][_0x3c48('0x30')]);}_0x378273[_0x3c48('0x4d')]=qs[_0x3c48('0x4e')](_0x443259[_0x3c48('0x46')][_0x3c48('0x4e')]);_0x378273[_0x3c48('0x4f')]=qs['filters'](_[_0x3c48('0x6b')](_0x443259[_0x3c48('0x46')],_0x5a3208[_0x3c48('0x48')]));_0x378273['where'][_0x3c48('0x6c')]=_0x8e50c5['id'];if(_0x443259['query'][_0x3c48('0x53')]){_0x378273[_0x3c48('0x4f')]=_['merge'](_0x378273[_0x3c48('0x4f')],{'$or':_[_0x3c48('0x45')](_0x378273[_0x3c48('0x49')],function(_0x11e967){var _0x299803={};_0x299803[_0x11e967]={'$like':'%'+_0x443259['query'][_0x3c48('0x53')]+'%'};return _0x299803;})});}_0x378273=_[_0x3c48('0x50')]({},_0x378273,_0x443259['options']);return db[_0x3c48('0x68')][_0x3c48('0x2f')]({'where':_0x378273['where']})[_0x3c48('0x22')](function(_0x19ab48){_0x5f1233[_0x3c48('0x2f')]=_0x19ab48;if(_0x443259[_0x3c48('0x46')][_0x3c48('0x5b')]){_0x378273['include']=[{'all':!![]}];}return db[_0x3c48('0x68')][_0x3c48('0x56')](_0x378273);})[_0x3c48('0x22')](function(_0x232ac4){_0x5f1233[_0x3c48('0x57')]=_0x232ac4;return _0x5f1233;});}})[_0x3c48('0x22')](respondWithFilteredResult(_0x3f22ec,_0x378273))['catch'](handleError(_0x3f22ec,null));};exports[_0x3c48('0x6d')]=function(_0x4828d2,_0x44774c,_0x598053){return db[_0x3c48('0x40')][_0x3c48('0x5c')]({'where':{'id':_0x4828d2[_0x3c48('0x59')]['id']}})['then'](handleEntityNotFound(_0x44774c,null))['then'](function(_0x4d0259){if(_0x4d0259){return _0x4d0259['removeDispositions'](_0x4828d2[_0x3c48('0x46')]['ids']);}})[_0x3c48('0x22')](respondWithStatusCode(_0x44774c,null))['catch'](handleError(_0x44774c,null));};exports['addAnswer']=function(_0x57e809,_0x112ed7,_0xf556a1){if(_0x57e809['body']['id']){delete _0x57e809[_0x3c48('0x5e')]['id'];}return db[_0x3c48('0x40')][_0x3c48('0x5c')]({'where':{'id':_0x57e809[_0x3c48('0x59')]['id']}})['then'](handleEntityNotFound(_0x112ed7,null))['then'](function(_0x3ad81c){if(_0x3ad81c){_0x57e809[_0x3c48('0x5e')][_0x3c48('0x6c')]=_0x3ad81c['id'];return db[_0x3c48('0x6e')][_0x3c48('0x5d')](_0x57e809[_0x3c48('0x5e')]);}})[_0x3c48('0x22')](respondWithResult(_0x112ed7,null))[_0x3c48('0x2b')](handleError(_0x112ed7,null));};exports['getAnswers']=function(_0x28bac6,_0x40bb1d,_0x380b90){var _0x50f977={'raw':![],'where':{}};var _0x505d2b={};var _0xa0ddcc={'count':0x0,'rows':[]};return db[_0x3c48('0x40')][_0x3c48('0x6a')]({'where':{'id':_0x28bac6['params']['id']}})[_0x3c48('0x22')](handleEntityNotFound(_0x40bb1d,null))[_0x3c48('0x22')](function(_0x5bf087){if(_0x5bf087){_0x505d2b['model']=_[_0x3c48('0x47')](db[_0x3c48('0x6e')][_0x3c48('0x41')]);_0x505d2b[_0x3c48('0x46')]=_[_0x3c48('0x47')](_0x28bac6['query']);_0x505d2b[_0x3c48('0x48')]=_[_0x3c48('0x4a')](_0x505d2b[_0x3c48('0x44')],_0x505d2b[_0x3c48('0x46')]);_0x50f977['attributes']=_[_0x3c48('0x4a')](_0x505d2b[_0x3c48('0x44')],qs[_0x3c48('0x5a')](_0x28bac6[_0x3c48('0x46')][_0x3c48('0x5a')]));_0x50f977[_0x3c48('0x49')]=_0x50f977[_0x3c48('0x49')]['length']?_0x50f977[_0x3c48('0x49')]:_0x505d2b['model'];if(!_0x28bac6[_0x3c48('0x46')][_0x3c48('0x6f')](_0x3c48('0x4c'))){_0x50f977['limit']=qs[_0x3c48('0x31')](_0x28bac6[_0x3c48('0x46')][_0x3c48('0x31')]);_0x50f977['offset']=qs[_0x3c48('0x30')](_0x28bac6[_0x3c48('0x46')]['offset']);}_0x50f977[_0x3c48('0x4d')]=qs[_0x3c48('0x4e')](_0x28bac6[_0x3c48('0x46')][_0x3c48('0x4e')]);_0x50f977[_0x3c48('0x4f')]=qs['filters'](_[_0x3c48('0x6b')](_0x28bac6[_0x3c48('0x46')],_0x505d2b[_0x3c48('0x48')]));_0x50f977['where']['OpenchannelAccountId']=_0x5bf087['id'];if(_0x28bac6[_0x3c48('0x46')][_0x3c48('0x53')]){_0x50f977[_0x3c48('0x4f')]=_[_0x3c48('0x50')](_0x50f977[_0x3c48('0x4f')],{'$or':_[_0x3c48('0x45')](_0x50f977['attributes'],function(_0x37ef6a){var _0x1d1ce6={};_0x1d1ce6[_0x37ef6a]={'$like':'%'+_0x28bac6['query']['filter']+'%'};return _0x1d1ce6;})});}_0x50f977=_[_0x3c48('0x50')]({},_0x50f977,_0x28bac6['options']);return db[_0x3c48('0x6e')][_0x3c48('0x2f')]({'where':_0x50f977[_0x3c48('0x4f')]})[_0x3c48('0x22')](function(_0x50505e){_0xa0ddcc[_0x3c48('0x2f')]=_0x50505e;if(_0x28bac6[_0x3c48('0x46')][_0x3c48('0x5b')]){_0x50f977['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x3c48('0x56')](_0x50f977);})['then'](function(_0x5c0fa7){_0xa0ddcc[_0x3c48('0x57')]=_0x5c0fa7;return _0xa0ddcc;});}})[_0x3c48('0x22')](respondWithFilteredResult(_0x40bb1d,_0x50f977))['catch'](handleError(_0x40bb1d,null));};exports[_0x3c48('0x70')]=function(_0x238e45,_0x4c0179,_0x1d5bd9){return db[_0x3c48('0x40')][_0x3c48('0x5c')]({'where':{'id':_0x238e45['params']['id']}})['then'](handleEntityNotFound(_0x4c0179,null))['then'](function(_0x1b292c){if(_0x1b292c){return _0x1b292c[_0x3c48('0x70')](_0x238e45['query'][_0x3c48('0x71')]);}})['then'](respondWithStatusCode(_0x4c0179,null))[_0x3c48('0x2b')](handleError(_0x4c0179,null));};exports[_0x3c48('0x72')]=function(_0x3cd3dc,_0x17fdee,_0x48a917){var _0x21386b={'body':_0x3cd3dc[_0x3c48('0x5e')],'channel':_0x3c48('0x73')};var _0x377892=[];var _0x1027d1=[];var _0x4ee7b6={};var _0x53a852=![];return db[_0x3c48('0x74')][_0x3c48('0x65')]()[_0x3c48('0x22')](function(_0x552a0b){if(!_0x552a0b){throw new db[(_0x3c48('0x75'))]['ValidationError'](_0x3c48('0x76'));}_0x377892=_['difference'](_[_0x3c48('0x47')](_0x552a0b),[_0x3c48('0x77'),_0x3c48('0x78')]);_0x1027d1=_['difference'](_[_0x3c48('0x47')](_0x552a0b),[_0x3c48('0x77'),_0x3c48('0x78'),'CompanyId',_0x3c48('0x79')]);if(_0x3cd3dc[_0x3c48('0x5e')]['id']){delete _0x3cd3dc[_0x3c48('0x5e')]['id'];}if(_[_0x3c48('0x7a')](_0x3cd3dc[_0x3c48('0x5e')][_0x3c48('0x7b')])){throw new db[(_0x3c48('0x75'))][(_0x3c48('0x20'))](_0x3c48('0x7c'));}if(_['isNil'](_0x3cd3dc['body'][_0x3c48('0x5e')])||_0x3cd3dc['body'][_0x3c48('0x5e')]===''){throw new db['Sequelize']['ValidationError'](_0x3c48('0x7d'));}if(_[_0x3c48('0x7a')](_0x3cd3dc['body'][_0x3c48('0x7e')])){throw new db[(_0x3c48('0x75'))][(_0x3c48('0x20'))](_0x3c48('0x7f')+_0x1027d1);}if(!_[_0x3c48('0x80')](_0x1027d1,_0x3cd3dc[_0x3c48('0x5e')][_0x3c48('0x7e')])){throw new db[(_0x3c48('0x75'))][(_0x3c48('0x20'))](_0x3c48('0x81')+_0x1027d1);}_0x4ee7b6[_0x3cd3dc[_0x3c48('0x5e')][_0x3c48('0x7e')]]=_0x3cd3dc[_0x3c48('0x5e')]['from'];})['then'](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x3cd3dc[_0x3c48('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x3c48('0x82'),'include':[{'model':db[_0x3c48('0x74')],'as':'Contacts','where':_0x4ee7b6,'limit':0x1,'order':[[_0x3c48('0x78'),_0x3c48('0x83')]]}]},{'model':db[_0x3c48('0x84')],'as':'Applications'}]});})[_0x3c48('0x22')](handleEntityNotFound(_0x17fdee,null))[_0x3c48('0x22')](function(_0x30f373){if(_0x30f373&&_0x30f373[_0x3c48('0x82')]){_0x21386b['account']=_0x30f373;_0x21386b[_0x3c48('0x85')]=_0x30f373[_0x3c48('0x86')];_0x21386b[_0x3c48('0x87')]=_0x30f373[_0x3c48('0x82')];_0x21386b['applications']=_[_0x3c48('0x88')](_0x21386b['applications'],[_0x3c48('0x89')],[_0x3c48('0x8a')]);if(_0x21386b[_0x3c48('0x8b')][_0x3c48('0x86')]){delete _0x21386b['account']['Applications'];}if(_0x21386b['account'][_0x3c48('0x82')]&&_0x21386b[_0x3c48('0x8b')][_0x3c48('0x82')]['Contacts'][_0x3c48('0x4b')]){return _0x21386b[_0x3c48('0x8b')]['List'][_0x3c48('0x8c')][0x0];}var _0x32be17=_[_0x3c48('0x1b')](_0x3cd3dc[_0x3c48('0x5e')],{'firstName':_0x3cd3dc['body'][_0x3c48('0x7b')],'ListId':_0x30f373[_0x3c48('0x79')]});_0x32be17[_0x3cd3dc[_0x3c48('0x5e')]['mapKey']]=_0x3cd3dc['body'][_0x3c48('0x7b')];return db[_0x3c48('0x74')][_0x3c48('0x5d')](_0x32be17,{'fields':_0x377892,'raw':!![]});}})[_0x3c48('0x22')](handleEntityNotFound(_0x17fdee,null))[_0x3c48('0x22')](function(_0x23a79b){_0x21386b[_0x3c48('0x8d')]=_0x23a79b;if(_0x23a79b){var _0x2e173f={'ContactId':_0x23a79b['id'],'OpenchannelAccountId':_0x3cd3dc[_0x3c48('0x59')]['id'],'from':(_0x23a79b[_0x3c48('0x8e')]||'')+'\x20'+(_0x23a79b['lastName']||'')};var _0x446c99={'OpenchannelAccountId':_0x3cd3dc[_0x3c48('0x59')]['id'],'closed':![]};if(_0x3cd3dc[_0x3c48('0x5e')][_0x3c48('0x8f')]){_0x446c99[_0x3c48('0x8f')]=_0x3cd3dc[_0x3c48('0x5e')][_0x3c48('0x8f')];return db[_0x3c48('0x90')][_0x3c48('0x5c')]({'where':_0x446c99})[_0x3c48('0x22')](function(_0x2a7c27){if(_0x2a7c27){return[_0x2a7c27,![]];}_0x2e173f[_0x3c48('0x8f')]=_0x3cd3dc[_0x3c48('0x5e')]['threadId'];_0x2e173f[_0x3c48('0x91')]=_0x3cd3dc[_0x3c48('0x5e')][_0x3c48('0x91')];return db[_0x3c48('0x90')]['create'](_0x2e173f)[_0x3c48('0x22')](function(_0x1324bf){return[_0x1324bf,!![]];});});}else{_0x446c99[_0x3c48('0x8f')]=null;}_0x446c99['ContactId']=_0x23a79b['id'];return db['OpenchannelInteraction'][_0x3c48('0x5c')]({'where':_0x446c99})[_0x3c48('0x22')](function(_0x43a48e){if(_0x43a48e){return[_0x43a48e,![]];}return db[_0x3c48('0x90')][_0x3c48('0x5d')](_0x2e173f)[_0x3c48('0x22')](function(_0x271788){return[_0x271788,!![]];});});}})[_0x3c48('0x92')](function(_0xb4af5,_0x2fa5eb){if(_0xb4af5){_0x53a852=_0x2fa5eb;if(!_0x2fa5eb){var _0x49ca07={'from':(_0x21386b[_0x3c48('0x8d')][_0x3c48('0x8e')]||'')+'\x20'+(_0x21386b['contact'][_0x3c48('0x93')]||'')};if(_0x3cd3dc[_0x3c48('0x5e')][_0x3c48('0x8f')]&&_0x3cd3dc[_0x3c48('0x5e')]['messageId']&&_0x3cd3dc[_0x3c48('0x5e')][_0x3c48('0x8f')]!=_0x3cd3dc['body'][_0x3c48('0x94')]){_0x49ca07[_0x3c48('0x8f')]=_0x3cd3dc[_0x3c48('0x5e')]['messageId'];}return _0xb4af5['update'](_0x49ca07);}else{return _0xb4af5;}}})['then'](function(_0x7f8668){_0x21386b[_0x3c48('0x95')]=_0x7f8668[_0x3c48('0x37')]({'plain':!![]});_0x21386b[_0x3c48('0x95')][_0x3c48('0x96')]=_0x53a852;if(_0x21386b['interaction']['created']){if(_0x21386b[_0x3c48('0x8b')]['autoclose']){_0x21386b[_0x3c48('0x85')][_0x3c48('0x97')]({'id':0x0,'priority':_0x21386b[_0x3c48('0x85')][_0x3c48('0x4b')]+0x1,'app':_0x3c48('0x98'),'appdata':_0x3c48('0x99'),'interval':'*,*,*,*'});}}return db[_0x3c48('0x9a')][_0x3c48('0x5d')]({'body':_0x3cd3dc['body'][_0x3c48('0x5e')],'OpenchannelAccountId':_0x3cd3dc[_0x3c48('0x59')]['id'],'OpenchannelInteractionId':_0x7f8668['id'],'direction':'in','ContactId':_0x21386b[_0x3c48('0x8d')]['id'],'AttachmentId':_0x3cd3dc[_0x3c48('0x5e')][_0x3c48('0x9b')]});})[_0x3c48('0x22')](function(_0x561a18){_0x21386b['message']=_0x561a18;if(_0x21386b['interaction'][_0x3c48('0x9c')]){return db[_0x3c48('0x9d')][_0x3c48('0x5c')]({'attributes':['id','name'],'where':{'id':_0x21386b['interaction'][_0x3c48('0x9c')]}})[_0x3c48('0x22')](function(_0x117949){if(_0x117949){_0x21386b[_0x3c48('0x85')][_0x3c48('0x9e')]({'id':0x0,'priority':0x0,'app':_0x3c48('0x9f'),'appdata':_0x117949[_0x3c48('0x3c')]+','+(_0x21386b[_0x3c48('0x8b')]['waitForTheAssignedAgent']||0xa),'interval':_0x3c48('0xa0')});_0x21386b['forcedOwnership']=![];}return respondWithRpcPromise(_0x3c48('0xa1'),_0x3c48('0xa2'),_0x21386b);});}return respondWithRpcPromise(_0x3c48('0xa1'),_0x3c48('0xa2'),_0x21386b);})[_0x3c48('0x22')](function(_0x26e236){respondWithRpcPromise(_0x3c48('0xa3'),_0x3c48('0xa3'),{'event':_0x3c48('0x72'),'message':_0x26e236},client9002);return _0x26e236;})[_0x3c48('0x22')](respondWithResult(_0x17fdee,null))[_0x3c48('0x2b')](handleError(_0x17fdee,null));};exports['addApplications']=function(_0x4d9709,_0x18125e,_0x5ddf85){return db[_0x3c48('0x40')][_0x3c48('0x6a')]({'where':{'id':_0x4d9709[_0x3c48('0x59')]['id']}})[_0x3c48('0x22')](handleEntityNotFound(_0x18125e,null))[_0x3c48('0x22')](function(_0xb46bb3){if(_0xb46bb3){return db[_0x3c48('0xa4')][_0x3c48('0xa5')](function(_0x3dcec6){return db[_0x3c48('0x84')][_0x3c48('0x36')]({'where':{'OpenchannelAccountId':_0x4d9709['params']['id']},'transaction':_0x3dcec6})['then'](function(_0xeee3cd){var _0x3c4fdf=_[_0x3c48('0x45')](_0x4d9709['body'],function(_0x31e975){_0x31e975['OpenchannelAccountId']=_0x4d9709[_0x3c48('0x59')]['id'];return _0x31e975;});return db[_0x3c48('0x84')][_0x3c48('0xa6')](_0x3c4fdf,{'transaction':_0x3dcec6});});})[_0x3c48('0x22')](function(){return db[_0x3c48('0x84')][_0x3c48('0xa7')]({'where':{'OpenchannelAccountId':_0x4d9709['params']['id']},'order':_0x3c48('0x89')});});}})['then'](respondWithResult(_0x18125e,null))[_0x3c48('0x2b')](handleError(_0x18125e,null));};exports[_0x3c48('0xa8')]=function(_0x91ed55,_0x4e132d,_0x305130){var _0x11a48e={};var _0x3f8606={};var _0x1b406a;var _0x21a2c4;return db[_0x3c48('0x40')]['findOne']({'where':{'id':_0x91ed55[_0x3c48('0x59')]['id']}})[_0x3c48('0x22')](handleEntityNotFound(_0x4e132d,null))['then'](function(_0x2c3d07){if(_0x2c3d07){_0x1b406a=_0x2c3d07;_0x3f8606['model']=_[_0x3c48('0x47')](db[_0x3c48('0x84')][_0x3c48('0x41')]);_0x3f8606['query']=_[_0x3c48('0x47')](_0x91ed55[_0x3c48('0x46')]);_0x3f8606['filters']=_[_0x3c48('0x4a')](_0x3f8606['model'],_0x3f8606['query']);_0x11a48e[_0x3c48('0x49')]=_[_0x3c48('0x4a')](_0x3f8606[_0x3c48('0x44')],qs[_0x3c48('0x5a')](_0x91ed55[_0x3c48('0x46')]['fields']));_0x11a48e[_0x3c48('0x49')]=_0x11a48e['attributes'][_0x3c48('0x4b')]?_0x11a48e[_0x3c48('0x49')]:_0x3f8606[_0x3c48('0x44')];_0x11a48e[_0x3c48('0x4d')]=qs[_0x3c48('0x4e')](_0x91ed55[_0x3c48('0x46')]['sort']);_0x11a48e['where']=qs[_0x3c48('0x48')](_[_0x3c48('0x6b')](_0x91ed55[_0x3c48('0x46')],_0x3f8606[_0x3c48('0x48')]));if(_0x91ed55[_0x3c48('0x46')]['filter']){_0x11a48e[_0x3c48('0x4f')]=_[_0x3c48('0x50')](_0x11a48e[_0x3c48('0x4f')],{'$or':_['map'](_0x11a48e[_0x3c48('0x49')],function(_0x5f2a3f){var _0x1d20d6={};_0x1d20d6[_0x5f2a3f]={'$like':'%'+_0x91ed55[_0x3c48('0x46')][_0x3c48('0x53')]+'%'};return _0x1d20d6;})});}_0x11a48e=_[_0x3c48('0x50')]({},_0x11a48e,_0x91ed55[_0x3c48('0x54')]);return _0x1b406a['getApplications'](_0x11a48e);}})[_0x3c48('0x22')](function(_0x1795f1){if(_0x1795f1){_0x21a2c4=_0x1795f1[_0x3c48('0x4b')];if(!_0x91ed55[_0x3c48('0x46')][_0x3c48('0x6f')]('nolimit')){_0x11a48e[_0x3c48('0x31')]=qs[_0x3c48('0x31')](_0x91ed55[_0x3c48('0x46')][_0x3c48('0x31')]);_0x11a48e[_0x3c48('0x30')]=qs['offset'](_0x91ed55[_0x3c48('0x46')][_0x3c48('0x30')]);}return _0x1b406a['getApplications'](_0x11a48e);}})['then'](function(_0xa3ec6a){if(_0xa3ec6a){return _0xa3ec6a?{'count':_0x21a2c4,'rows':_0xa3ec6a}:null;}})[_0x3c48('0x22')](respondWithResult(_0x4e132d,null))['catch'](handleError(_0x4e132d,null));};exports['getInteractions']=function(_0x291310,_0x22604c,_0x5a8a22){var _0x479379={'raw':![],'where':{}};var _0x37692d={};var _0x1753ab={'count':0x0,'rows':[]};return db[_0x3c48('0x40')][_0x3c48('0x6a')]({'where':{'id':_0x291310[_0x3c48('0x59')]['id']}})['then'](handleEntityNotFound(_0x22604c,null))['then'](function(_0xe1360f){if(_0xe1360f){_0x37692d[_0x3c48('0x44')]=_[_0x3c48('0x47')](db[_0x3c48('0x90')]['rawAttributes']);_0x37692d[_0x3c48('0x46')]=_['keys'](_0x291310['query']);_0x37692d['filters']=_[_0x3c48('0x4a')](_0x37692d['model'],_0x37692d[_0x3c48('0x46')]);_0x479379['attributes']=_['intersection'](_0x37692d[_0x3c48('0x44')],qs[_0x3c48('0x5a')](_0x291310['query'][_0x3c48('0x5a')]));_0x479379['attributes']=_0x479379[_0x3c48('0x49')][_0x3c48('0x4b')]?_0x479379[_0x3c48('0x49')]:_0x37692d[_0x3c48('0x44')];if(!_0x291310['query'][_0x3c48('0x6f')](_0x3c48('0x4c'))){_0x479379[_0x3c48('0x31')]=qs[_0x3c48('0x31')](_0x291310['query'][_0x3c48('0x31')]);_0x479379[_0x3c48('0x30')]=qs[_0x3c48('0x30')](_0x291310[_0x3c48('0x46')]['offset']);}_0x479379['order']=qs[_0x3c48('0x4e')](_0x291310['query']['sort']);_0x479379[_0x3c48('0x4f')]=qs[_0x3c48('0x48')](_[_0x3c48('0x6b')](_0x291310[_0x3c48('0x46')],_0x37692d[_0x3c48('0x48')]));_0x479379['where'][_0x3c48('0x6c')]=_0xe1360f['id'];if(_0x291310[_0x3c48('0x46')][_0x3c48('0x53')]){_0x479379[_0x3c48('0x4f')]=_[_0x3c48('0x50')](_0x479379[_0x3c48('0x4f')],{'$or':_['map'](_0x479379[_0x3c48('0x49')],function(_0x28a1e7){var _0x19fda0={};_0x19fda0[_0x28a1e7]={'$like':'%'+_0x291310['query'][_0x3c48('0x53')]+'%'};return _0x19fda0;})});}_0x479379=_[_0x3c48('0x50')]({},_0x479379,_0x291310[_0x3c48('0x54')]);return db[_0x3c48('0x90')][_0x3c48('0x2f')]({'where':_0x479379[_0x3c48('0x4f')]})[_0x3c48('0x22')](function(_0x5b7d6e){_0x1753ab[_0x3c48('0x2f')]=_0x5b7d6e;if(_0x291310[_0x3c48('0x46')][_0x3c48('0x5b')]){_0x479379[_0x3c48('0x55')]=[{'model':db[_0x3c48('0x74')],'as':_0x3c48('0xa9'),'required':![]},{'model':db[_0x3c48('0x9d')],'as':'Owner','attributes':['name',_0x3c48('0xaa'),_0x3c48('0xab')],'required':![]},{'model':db[_0x3c48('0xac')],'as':_0x3c48('0xad'),'attributes':['id','name',_0x3c48('0xae')],'where':_0x291310[_0x3c48('0x46')]['tag']?{'id':_0x291310[_0x3c48('0x46')]['tag']}:undefined,'required':_0x291310[_0x3c48('0x46')][_0x3c48('0xaf')]?!![]:![]}];}return db[_0x3c48('0x90')]['findAll'](_0x479379);})[_0x3c48('0x22')](function(_0x5a479f){_0x1753ab[_0x3c48('0x57')]=_0x5a479f;return _0x1753ab;});}})[_0x3c48('0x22')](respondWithFilteredResult(_0x22604c,_0x479379))[_0x3c48('0x2b')](handleError(_0x22604c,null));};exports[_0x3c48('0xb0')]=function(_0x508efd,_0x575ce4,_0x9d69a4){return db[_0x3c48('0x40')][_0x3c48('0x5c')]({'where':{'id':_0x508efd[_0x3c48('0x59')]['id']}})[_0x3c48('0x22')](handleEntityNotFound(_0x575ce4,null))['then'](function(_0x253923){if(_0x253923){return _0x253923[_0x3c48('0xb0')](_0x508efd[_0x3c48('0x5e')][_0x3c48('0x71')],_[_0x3c48('0xb1')](_0x508efd[_0x3c48('0x5e')],['ids','id'])||{})[_0x3c48('0x92')](function(_0x361ec0){for(var _0x5a7ae2=0x0;_0x5a7ae2<_0x508efd[_0x3c48('0x5e')][_0x3c48('0x71')][_0x3c48('0x4b')];_0x5a7ae2+=0x1){socket[_0x3c48('0xb2')]('userOpenchannelAccount:save',{'UserId':_0x508efd['body'][_0x3c48('0x71')][_0x5a7ae2],'OpenchannelAccountId':_0x508efd[_0x3c48('0x59')]['id']});}return _0x361ec0;});}})[_0x3c48('0x22')](respondWithResult(_0x575ce4,null))['catch'](handleError(_0x575ce4,null));};exports[_0x3c48('0xb3')]=function(_0x5adff5,_0x317e84,_0x385874){return db[_0x3c48('0x40')][_0x3c48('0x5c')]({'where':{'id':_0x5adff5[_0x3c48('0x59')]['id']}})['then'](handleEntityNotFound(_0x317e84,null))[_0x3c48('0x22')](function(_0x262429){if(_0x262429){return _0x262429[_0x3c48('0xb3')](_0x5adff5[_0x3c48('0x46')]['ids'])['then'](function(){if(_[_0x3c48('0xb4')](_0x5adff5['query'][_0x3c48('0x71')])){for(var _0x49bb76=0x0;_0x49bb76<_0x5adff5[_0x3c48('0x46')][_0x3c48('0x71')][_0x3c48('0x4b')];_0x49bb76+=0x1){socket[_0x3c48('0xb2')](_0x3c48('0xb5'),{'UserId':Number(_0x5adff5[_0x3c48('0x46')]['ids'][_0x49bb76]),'OpenchannelAccountId':Number(_0x5adff5[_0x3c48('0x59')]['id'])});}}else{socket[_0x3c48('0xb2')]('userOpenchannelAccount:remove',{'UserId':Number(_0x5adff5[_0x3c48('0x46')][_0x3c48('0x71')]),'OpenchannelAccountId':Number(_0x5adff5[_0x3c48('0x59')]['id'])});}});}})[_0x3c48('0x22')](respondWithStatusCode(_0x317e84,null))[_0x3c48('0x2b')](handleError(_0x317e84,null));};exports['getAgents']=function(_0x3b0b9b,_0x3d873b,_0x557a8b){var _0xd6263e={};var _0x15dd4f={};var _0x55c0f9;var _0x42ece3;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3b0b9b[_0x3c48('0x59')]['id']}})[_0x3c48('0x22')](handleEntityNotFound(_0x3d873b,null))[_0x3c48('0x22')](function(_0x5a0a1a){if(_0x5a0a1a){_0x55c0f9=_0x5a0a1a;_0x15dd4f[_0x3c48('0x44')]=_['keys'](db[_0x3c48('0x9d')][_0x3c48('0x41')]);_0x15dd4f[_0x3c48('0x46')]=_[_0x3c48('0x47')](_0x3b0b9b['query']);_0x15dd4f[_0x3c48('0x48')]=_['intersection'](_0x15dd4f[_0x3c48('0x44')],_0x15dd4f[_0x3c48('0x46')]);_0xd6263e['attributes']=_[_0x3c48('0x4a')](_0x15dd4f[_0x3c48('0x44')],qs[_0x3c48('0x5a')](_0x3b0b9b['query'][_0x3c48('0x5a')]));_0xd6263e[_0x3c48('0x49')]=_0xd6263e[_0x3c48('0x49')][_0x3c48('0x4b')]?_0xd6263e[_0x3c48('0x49')]:_0x15dd4f[_0x3c48('0x44')];_0xd6263e[_0x3c48('0x4d')]=qs['sort'](_0x3b0b9b['query']['sort']);_0xd6263e[_0x3c48('0x4f')]=qs[_0x3c48('0x48')](_[_0x3c48('0x6b')](_0x3b0b9b[_0x3c48('0x46')],_0x15dd4f['filters']));if(_0x3b0b9b[_0x3c48('0x46')]['filter']){_0xd6263e[_0x3c48('0x4f')]=_[_0x3c48('0x50')](_0xd6263e[_0x3c48('0x4f')],{'$or':_[_0x3c48('0x45')](_0xd6263e[_0x3c48('0x49')],function(_0x3c973d){var _0x37ca83={};_0x37ca83[_0x3c973d]={'$like':'%'+_0x3b0b9b[_0x3c48('0x46')][_0x3c48('0x53')]+'%'};return _0x37ca83;})});}_0xd6263e=_[_0x3c48('0x50')]({},_0xd6263e,_0x3b0b9b[_0x3c48('0x54')]);return _0x55c0f9['getAgents'](_0xd6263e);}})[_0x3c48('0x22')](function(_0x5cdd11){if(_0x5cdd11){_0x42ece3=_0x5cdd11[_0x3c48('0x4b')];if(!_0x3b0b9b['query'][_0x3c48('0x6f')](_0x3c48('0x4c'))){_0xd6263e['limit']=qs[_0x3c48('0x31')](_0x3b0b9b[_0x3c48('0x46')][_0x3c48('0x31')]);_0xd6263e[_0x3c48('0x30')]=qs[_0x3c48('0x30')](_0x3b0b9b['query'][_0x3c48('0x30')]);}return _0x55c0f9[_0x3c48('0xb6')](_0xd6263e);}})[_0x3c48('0x22')](function(_0x10ec0d){if(_0x10ec0d){return _0x10ec0d?{'count':_0x42ece3,'rows':_0x10ec0d}:null;}})['then'](respondWithResult(_0x3d873b,null))[_0x3c48('0x2b')](handleError(_0x3d873b,null));};exports[_0x3c48('0x3d')]=function(_0x46c5a5,_0x3b7210,_0x5c35dd){var _0x1d5b41,_0x47a60f,_0x9b7af2;if(_[_0x3c48('0x7a')](_0x46c5a5[_0x3c48('0x5e')]['body'])||_0x46c5a5[_0x3c48('0x5e')][_0x3c48('0x5e')]===''){throw new db[(_0x3c48('0x75'))][(_0x3c48('0x20'))](_0x3c48('0x7d'));}if(_[_0x3c48('0x7a')](_0x46c5a5[_0x3c48('0x5e')]['to'])){}_0x1d5b41=_0x46c5a5[_0x3c48('0x5e')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x46c5a5['params']['id']}})[_0x3c48('0x22')](handleEntityNotFound(_0x3b7210,null))['then'](function(_0x37cccd){if(_0x37cccd){return db[_0x3c48('0x40')]['find']({'where':{'id':_0x37cccd['id']},'include':[{'model':db[_0x3c48('0xb7')],'as':_0x3c48('0x82'),'include':[{'model':db[_0x3c48('0x74')],'as':'Contacts','where':{[_0x37cccd['mapKey']]:_0x1d5b41},'limit':0x1,'order':[['updatedAt',_0x3c48('0x83')]]}]}]})[_0x3c48('0x22')](handleEntityNotFound(_0x3b7210,null))[_0x3c48('0x22')](function(_0x998fb9){if(_0x998fb9&&_0x998fb9[_0x3c48('0x82')]){_0x47a60f=_0x998fb9['get']({'plain':!![]});if(_0x47a60f['List']&&_0x47a60f[_0x3c48('0x82')][_0x3c48('0x8c')][_0x3c48('0x4b')]){return _0x47a60f[_0x3c48('0x82')][_0x3c48('0x8c')][0x0];}return db[_0x3c48('0x74')][_0x3c48('0x5d')](_[_0x3c48('0x1b')](_0x46c5a5[_0x3c48('0x5e')],{'firstName':_0x1d5b41,[_0x998fb9[_0x3c48('0x7e')]]:_0x1d5b41,'phone':_0x1d5b41,'ListId':_0x47a60f['ListId']}));}})[_0x3c48('0x22')](handleEntityNotFound(_0x3b7210,null))[_0x3c48('0x22')](function(_0x46bf87){if(_0x46bf87){_0x9b7af2=_0x46bf87;return db['OpenchannelInteraction'][_0x3c48('0x5c')]({'where':{'ContactId':_0x9b7af2['id'],'closed':![],'OpenchannelAccountId':_0x47a60f['id']}})[_0x3c48('0x22')](function(_0x5b5ba9){if(_0x5b5ba9){return[_0x5b5ba9,![]];}return db[_0x3c48('0x90')][_0x3c48('0x5d')]({'UserId':_0x46c5a5['user']['id'],'ContactId':_0x9b7af2['id'],'OpenchannelAccountId':_0x47a60f['id'],'lastMsgDirection':_0x3c48('0xb8'),'Messages':[_['merge'](_0x46c5a5[_0x3c48('0x5e')],{'read':![],'body':_0x46c5a5['body']['body'],'OpenchannelAccountId':_0x47a60f['id'],'UserId':_0x46c5a5['user']['id'],'ContactId':_0x9b7af2['id']})]},{'include':[{'model':db[_0x3c48('0x9a')],'as':_0x3c48('0xb9')}]})[_0x3c48('0x22')](function(_0x2fddea){return[_0x2fddea,!![]];});});}})[_0x3c48('0x92')](function(_0x46b1d7,_0x38b8df){if(_0x38b8df){return _0x46b1d7;}return db[_0x3c48('0x9a')][_0x3c48('0x5d')](_[_0x3c48('0x50')](_0x46c5a5[_0x3c48('0x5e')],{'read':![],'body':_0x46c5a5['body']['body'],'OpenchannelAccountId':_0x47a60f['id'],'OpenchannelInteractionId':_0x46b1d7['id'],'UserId':_0x46c5a5[_0x3c48('0x5f')]['id'],'ContactId':_0x9b7af2['id']}))['then'](function(_0x5bd6d4){_0x46b1d7['dataValues']['Messages']=[];_0x46b1d7[_0x3c48('0xba')]['Messages'][_0x3c48('0x97')](_0x5bd6d4['dataValues']);return _0x46b1d7;});});}})[_0x3c48('0x22')](respondWithResult(_0x3b7210,null))[_0x3c48('0x2b')](handleError(_0x3b7210,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index a6f7f87..408538e 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 _0x22f4=['emit','hasOwnProperty','exports','events','setMaxListeners','remove'];(function(_0x1cdb2d,_0x8f1f76){var _0x4dafe3=function(_0xec694e){while(--_0xec694e){_0x1cdb2d['push'](_0x1cdb2d['shift']());}};_0x4dafe3(++_0x8f1f76);}(_0x22f4,0xb1));var _0x422f=function(_0x128bef,_0xc7a0af){_0x128bef=_0x128bef-0x0;var _0x1ba862=_0x22f4[_0x128bef];return _0x1ba862;};'use strict';var EventEmitter=require(_0x422f('0x0'));var OpenchannelAccount=require('../../mysqldb')['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x422f('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x422f('0x2')};function emitEvent(_0x2aca34){return function(_0x33a101,_0x2c9aef,_0x204beb){OpenchannelAccountEvents[_0x422f('0x3')](_0x2aca34+':'+_0x33a101['id'],_0x33a101);OpenchannelAccountEvents[_0x422f('0x3')](_0x2aca34,_0x33a101);_0x204beb(null);};}for(var e in events){if(events[_0x422f('0x4')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x422f('0x5')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xcf59=['update','remove','emit','hasOwnProperty','hook','events','OpenchannelAccount','setMaxListeners'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xcf59,0xe5));var _0x9cf5=function(_0x45f2e1,_0x48b816){_0x45f2e1=_0x45f2e1-0x0;var _0x461542=_0xcf59[_0x45f2e1];return _0x461542;};'use strict';var EventEmitter=require(_0x9cf5('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x9cf5('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9cf5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9cf5('0x3'),'afterDestroy':_0x9cf5('0x4')};function emitEvent(_0x5a4e7d){return function(_0x538f72,_0x3720b9,_0x102aea){OpenchannelAccountEvents[_0x9cf5('0x5')](_0x5a4e7d+':'+_0x538f72['id'],_0x538f72);OpenchannelAccountEvents[_0x9cf5('0x5')](_0x5a4e7d,_0x538f72);_0x102aea(null);};}for(var e in events){if(events[_0x9cf5('0x6')](e)){var event=events[e];OpenchannelAccount[_0x9cf5('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 33e991b..4d6589e 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 _0x37ce=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','OpenchannelAccount','lodash','util'];(function(_0x416a3c,_0x481c83){var _0x2a055d=function(_0x1095d4){while(--_0x1095d4){_0x416a3c['push'](_0x416a3c['shift']());}};_0x2a055d(++_0x481c83);}(_0x37ce,0x15a));var _0xe37c=function(_0x546ed2,_0xb24142){_0x546ed2=_0x546ed2-0x0;var _0x2e32fe=_0x37ce[_0x546ed2];return _0x2e32fe;};'use strict';var _=require(_0xe37c('0x0'));var util=require(_0xe37c('0x1'));var logger=require(_0xe37c('0x2'))(_0xe37c('0x3'));var moment=require(_0xe37c('0x4'));var BPromise=require(_0xe37c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe37c('0x6'));var rimraf=require(_0xe37c('0x7'));var config=require(_0xe37c('0x8'));var attributes=require(_0xe37c('0x9'));module[_0xe37c('0xa')]=function(_0x169ed5,_0x376735){return _0x169ed5['define'](_0xe37c('0xb'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelAccount.attributes','exports','OpenchannelAccount','util'];(function(_0x1b566f,_0x26df8e){var _0x3e0ae0=function(_0x472cff){while(--_0x472cff){_0x1b566f['push'](_0x1b566f['shift']());}};_0x3e0ae0(++_0x26df8e);}(_0xedd9,0xfc));var _0x9edd=function(_0x30db6e,_0x4f0793){_0x30db6e=_0x30db6e-0x0;var _0x5bedf3=_0xedd9[_0x30db6e];return _0x5bedf3;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'openchannel_accounts','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 df1a904..fb44e26 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 _0x494f=['request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelAccount.socket'];(function(_0x2fdce0,_0x496242){var _0x36f07e=function(_0x44c8c6){while(--_0x44c8c6){_0x2fdce0['push'](_0x2fdce0['shift']());}};_0x36f07e(++_0x496242);}(_0x494f,0x1f0));var _0xf494=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0x494f[_0x1d7037];return _0x4d6568;};'use strict';var _=require(_0xf494('0x0'));var util=require(_0xf494('0x1'));var moment=require(_0xf494('0x2'));var BPromise=require(_0xf494('0x3'));var rs=require(_0xf494('0x4'));var fs=require('fs');var Redis=require(_0xf494('0x5'));var db=require(_0xf494('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf494('0x7'))(_0xf494('0x8'));var config=require(_0xf494('0x9'));var jayson=require(_0xf494('0xa'));var client=jayson[_0xf494('0xb')][_0xf494('0xc')]({'port':0x232a});config[_0xf494('0xd')]=_[_0xf494('0xe')](config[_0xf494('0xd')],{'host':_0xf494('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf494('0xd')]));require(_0xf494('0x10'))['register'](socket);function respondWithRpcPromise(_0x506656,_0x20dd01,_0x2d1b58){return new BPromise(function(_0x193bff,_0x354d49){return client[_0xf494('0x11')](_0x506656,_0x2d1b58)['then'](function(_0x64ecf){logger['info'](_0xf494('0x12'),_0x20dd01,_0xf494('0x13'));logger[_0xf494('0x14')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x20dd01,_0xf494('0x13'),JSON['stringify'](_0x64ecf));if(_0x64ecf[_0xf494('0x15')]){if(_0x64ecf[_0xf494('0x15')][_0xf494('0x16')]===0x1f4){logger['error'](_0xf494('0x12'),_0x20dd01,_0x64ecf[_0xf494('0x15')][_0xf494('0x17')]);return _0x354d49(_0x64ecf['error'][_0xf494('0x17')]);}logger[_0xf494('0x15')](_0xf494('0x12'),_0x20dd01,_0x64ecf[_0xf494('0x15')][_0xf494('0x17')]);return _0x193bff(_0x64ecf[_0xf494('0x15')]['message']);}else{logger[_0xf494('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x20dd01,_0xf494('0x13'));_0x193bff(_0x64ecf[_0xf494('0x19')][_0xf494('0x17')]);}})[_0xf494('0x1a')](function(_0x124985){logger[_0xf494('0x15')](_0xf494('0x12'),_0x20dd01,_0x124985);_0x354d49(_0x124985);});});} \ No newline at end of file +var _0xf555=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./openchannelAccount.socket','request','then','request\x20sent','stringify','code','error','message','OpenchannelAccount,\x20%s,\x20%s','catch','lodash'];(function(_0x2fff83,_0x29d5fe){var _0xa2a722=function(_0x18b6b0){while(--_0x18b6b0){_0x2fff83['push'](_0x2fff83['shift']());}};_0xa2a722(++_0x29d5fe);}(_0xf555,0x16f));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5f55('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5f55('0x1'));var rs=require(_0x5f55('0x2'));var fs=require('fs');var Redis=require(_0x5f55('0x3'));var db=require(_0x5f55('0x4'))['db'];var utils=require(_0x5f55('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5f55('0x6'));var jayson=require(_0x5f55('0x7'));var client=jayson[_0x5f55('0x8')][_0x5f55('0x9')]({'port':0x232a});config['redis']=_[_0x5f55('0xa')](config[_0x5f55('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f55('0xc'))(new Redis(config[_0x5f55('0xb')]));require(_0x5f55('0xd'))['register'](socket);function respondWithRpcPromise(_0x1a72c8,_0x2af0c4,_0xeb7e24){return new BPromise(function(_0x5b0c49,_0x49ec41){return client[_0x5f55('0xe')](_0x1a72c8,_0xeb7e24)[_0x5f55('0xf')](function(_0x4067bb){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2af0c4,_0x5f55('0x10'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2af0c4,'request\x20sent',JSON[_0x5f55('0x11')](_0x4067bb));if(_0x4067bb['error']){if(_0x4067bb['error'][_0x5f55('0x12')]===0x1f4){logger[_0x5f55('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x2af0c4,_0x4067bb[_0x5f55('0x13')]['message']);return _0x49ec41(_0x4067bb[_0x5f55('0x13')][_0x5f55('0x14')]);}logger[_0x5f55('0x13')](_0x5f55('0x15'),_0x2af0c4,_0x4067bb['error']['message']);return _0x5b0c49(_0x4067bb[_0x5f55('0x13')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2af0c4,_0x5f55('0x10'));_0x5b0c49(_0x4067bb['result'][_0x5f55('0x14')]);}})[_0x5f55('0x16')](function(_0x20d834){logger[_0x5f55('0x13')](_0x5f55('0x15'),_0x2af0c4,_0x20d834);_0x49ec41(_0x20d834);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 59befbd..6512fea 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 _0x13e6=['update','emit','removeListener','openchannelAccount:','./openchannelAccount.events','save','remove'];(function(_0x3ed70e,_0x4b57f2){var _0x417ced=function(_0x45fe4f){while(--_0x45fe4f){_0x3ed70e['push'](_0x3ed70e['shift']());}};_0x417ced(++_0x4b57f2);}(_0x13e6,0x100));var _0x613e=function(_0x20450b,_0x544f63){_0x20450b=_0x20450b-0x0;var _0x521034=_0x13e6[_0x20450b];return _0x521034;};'use strict';var OpenchannelAccountEvents=require(_0x613e('0x0'));var events=[_0x613e('0x1'),_0x613e('0x2'),_0x613e('0x3')];function createListener(_0x2ba70,_0x5a4424){return function(_0x28bdc4){_0x5a4424[_0x613e('0x4')](_0x2ba70,_0x28bdc4);};}function removeListener(_0x3399b8,_0x38ede0){return function(){OpenchannelAccountEvents[_0x613e('0x5')](_0x3399b8,_0x38ede0);};}exports['register']=function(_0x68a583){for(var _0x54185e=0x0,_0x1a1e60=events['length'];_0x54185e<_0x1a1e60;_0x54185e++){var _0x182cd4=events[_0x54185e];var _0x3162ab=createListener(_0x613e('0x6')+_0x182cd4,_0x68a583);OpenchannelAccountEvents['on'](_0x182cd4,_0x3162ab);}}; \ No newline at end of file +var _0xa4f5=['remove','update','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xa4f5,0x8e));var _0x5a4f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa4f5[_0x21a9d9];return _0x46adce;};'use strict';var OpenchannelAccountEvents=require(_0x5a4f('0x0'));var events=[_0x5a4f('0x1'),_0x5a4f('0x2'),_0x5a4f('0x3')];function createListener(_0x5284c0,_0x1985d4){return function(_0x2739a5){_0x1985d4['emit'](_0x5284c0,_0x2739a5);};}function removeListener(_0x3dba88,_0x3bba04){return function(){OpenchannelAccountEvents['removeListener'](_0x3dba88,_0x3bba04);};}exports['register']=function(_0x527bb8){for(var _0x4bdbc6=0x0,_0x41b10d=events[_0x5a4f('0x4')];_0x4bdbc6<_0x41b10d;_0x4bdbc6++){var _0x35b8e9=events[_0x4bdbc6];var _0x5a4194=createListener(_0x5a4f('0x5')+_0x35b8e9,_0x527bb8);OpenchannelAccountEvents['on'](_0x35b8e9,_0x5a4194);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 28d9b17..bf43615 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 _0xcdf9=['../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x45d51e,_0x21f0e9){var _0x1e3fe6=function(_0x43182c){while(--_0x43182c){_0x45d51e['push'](_0x45d51e['shift']());}};_0x1e3fe6(++_0x21f0e9);}(_0xcdf9,0x9c));var _0x9cdf=function(_0x4b4638,_0xe99cda){_0x4b4638=_0x4b4638-0x0;var _0x59e92b=_0xcdf9[_0x4b4638];return _0x59e92b;};'use strict';var multer=require(_0x9cdf('0x0'));var util=require(_0x9cdf('0x1'));var path=require(_0x9cdf('0x2'));var timeout=require(_0x9cdf('0x3'));var express=require(_0x9cdf('0x4'));var router=express[_0x9cdf('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9cdf('0x6'));var config=require(_0x9cdf('0x7'));var controller=require(_0x9cdf('0x8'));router['get']('/',auth[_0x9cdf('0x9')](),controller[_0x9cdf('0xa')]);router['get'](_0x9cdf('0xb'),auth['isAuthenticated'](),controller[_0x9cdf('0xc')]);router['post']('/',auth[_0x9cdf('0x9')](),controller['create']);router[_0x9cdf('0xd')](_0x9cdf('0xb'),auth[_0x9cdf('0x9')](),controller[_0x9cdf('0xe')]);router[_0x9cdf('0xf')]('/:id',auth[_0x9cdf('0x9')](),controller[_0x9cdf('0x10')]);module[_0x9cdf('0x11')]=router; \ No newline at end of file +var _0x5eec=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','multer','util'];(function(_0x256d70,_0x1fe83c){var _0x9fdf4b=function(_0x201a3e){while(--_0x201a3e){_0x256d70['push'](_0x256d70['shift']());}};_0x9fdf4b(++_0x1fe83c);}(_0x5eec,0x12e));var _0xc5ee=function(_0x406adb,_0x29092c){_0x406adb=_0x406adb-0x0;var _0x35bc3a=_0x5eec[_0x406adb];return _0x35bc3a;};'use strict';var multer=require(_0xc5ee('0x0'));var util=require(_0xc5ee('0x1'));var path=require(_0xc5ee('0x2'));var timeout=require(_0xc5ee('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xc5ee('0x4'));var interaction=require(_0xc5ee('0x5'));var config=require('../../config/environment');var controller=require(_0xc5ee('0x6'));router[_0xc5ee('0x7')]('/',auth[_0xc5ee('0x8')](),controller['index']);router[_0xc5ee('0x7')](_0xc5ee('0x9'),auth[_0xc5ee('0x8')](),controller[_0xc5ee('0xa')]);router[_0xc5ee('0xb')]('/',auth[_0xc5ee('0x8')](),controller['create']);router[_0xc5ee('0xc')](_0xc5ee('0x9'),auth['isAuthenticated'](),controller[_0xc5ee('0xd')]);router[_0xc5ee('0xe')]('/:id',auth[_0xc5ee('0x8')](),controller[_0xc5ee('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 652c80e..d8aeb0d 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 _0xa947=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x157acc,_0x435b6b){var _0x52f459=function(_0x48f8ac){while(--_0x48f8ac){_0x157acc['push'](_0x157acc['shift']());}};_0x52f459(++_0x435b6b);}(_0xa947,0x96));var _0x7a94=function(_0xe8c0b9,_0xa39ba){_0xe8c0b9=_0xe8c0b9-0x0;var _0x43c805=_0xa947[_0xe8c0b9];return _0x43c805;};'use strict';var Sequelize=require(_0x7a94('0x0'));module[_0x7a94('0x1')]={'priority':{'type':Sequelize[_0x7a94('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7a94('0x3')],'allowNull':![],'defaultValue':_0x7a94('0x4')},'appdata':{'type':Sequelize[_0x7a94('0x5')]()},'description':{'type':Sequelize[_0x7a94('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7a94('0x6')}}; \ No newline at end of file +var _0xe3b6=['STRING','*,*,*,*','exports','INTEGER','noop','TEXT'];(function(_0x33adfe,_0x3a610f){var _0x1887ca=function(_0x2462ae){while(--_0x2462ae){_0x33adfe['push'](_0x33adfe['shift']());}};_0x1887ca(++_0x3a610f);}(_0xe3b6,0xce));var _0x6e3b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe3b6[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x6e3b('0x0')]={'priority':{'type':Sequelize[_0x6e3b('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6e3b('0x2')},'appdata':{'type':Sequelize[_0x6e3b('0x3')]()},'description':{'type':Sequelize[_0x6e3b('0x4')]},'interval':{'type':Sequelize[_0x6e3b('0x4')],'defaultValue':_0x6e3b('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index af46c91..26ac696 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 _0x8c6a=['json','offset','set','Content-Range','apply','save','update','then','end','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','count','includeAll','include','findAll','rows','params','merge','options','catch','create','body','find','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x5a10cd,_0x265001){var _0x362a50=function(_0x5819a9){while(--_0x5819a9){_0x5a10cd['push'](_0x5a10cd['shift']());}};_0x362a50(++_0x265001);}(_0x8c6a,0x1b1));var _0xa8c6=function(_0x522ae8,_0x3b637e){_0x522ae8=_0x522ae8-0x0;var _0x3189b9=_0x8c6a[_0x522ae8];return _0x3189b9;};'use strict';var pdf=require(_0xa8c6('0x0'));var emlformat=require(_0xa8c6('0x1'));var rimraf=require(_0xa8c6('0x2'));var zipdir=require(_0xa8c6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa8c6('0x4'));var moment=require('moment');var BPromise=require(_0xa8c6('0x5'));var Mustache=require(_0xa8c6('0x6'));var util=require(_0xa8c6('0x7'));var path=require(_0xa8c6('0x8'));var sox=require(_0xa8c6('0x9'));var csv=require(_0xa8c6('0xa'));var ejs=require(_0xa8c6('0xb'));var fs=require('fs');var _=require(_0xa8c6('0xc'));var squel=require(_0xa8c6('0xd'));var crypto=require(_0xa8c6('0xe'));var jsforce=require(_0xa8c6('0xf'));var deskjs=require(_0xa8c6('0x10'));var toCsv=require(_0xa8c6('0xa'));var querystring=require('querystring');var Papa=require(_0xa8c6('0x11'));var Redis=require(_0xa8c6('0x12'));var authService=require(_0xa8c6('0x13'));var qs=require(_0xa8c6('0x14'));var as=require(_0xa8c6('0x15'));var hardwareService=require(_0xa8c6('0x16'));var logger=require(_0xa8c6('0x17'))(_0xa8c6('0x18'));var utils=require(_0xa8c6('0x19'));var config=require(_0xa8c6('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7eece2,_0x1f937b){_0x1f937b=_0x1f937b||0xcc;return function(_0x336ffc){if(_0x336ffc){return _0x7eece2[_0xa8c6('0x1b')](_0x1f937b);}return _0x7eece2[_0xa8c6('0x1c')](_0x1f937b)['end']();};}function respondWithResult(_0x587436,_0x2afc7f){_0x2afc7f=_0x2afc7f||0xc8;return function(_0x431b2c){if(_0x431b2c){return _0x587436['status'](_0x2afc7f)[_0xa8c6('0x1d')](_0x431b2c);}};}function respondWithFilteredResult(_0x4a3286,_0x380db0){return function(_0xf5c68e){if(_0xf5c68e){var _0x141fba=_0xf5c68e['count'],_0x4c1ec2=_0x380db0[_0xa8c6('0x1e')],_0x1fb917=_0x380db0['offset']+_0x380db0['limit'],_0x181838;if(_0x1fb917>=_0x141fba){_0x1fb917=_0x141fba;_0x181838=0xc8;}else{_0x181838=0xce;}_0x4a3286[_0xa8c6('0x1c')](_0x181838);return _0x4a3286[_0xa8c6('0x1f')](_0xa8c6('0x20'),_0x4c1ec2+'-'+_0x1fb917+'/'+_0x141fba)[_0xa8c6('0x1d')](_0xf5c68e);}return null;};}function patchUpdates(_0x1555fb){return function(_0x4e9e72){try{jsonpatch[_0xa8c6('0x21')](_0x4e9e72,_0x1555fb,!![]);}catch(_0x32b2ad){return BPromise['reject'](_0x32b2ad);}return _0x4e9e72[_0xa8c6('0x22')]();};}function saveUpdates(_0xbbe0fd,_0x16964e){return function(_0xef3915){if(_0xef3915){return _0xef3915[_0xa8c6('0x23')](_0xbbe0fd)[_0xa8c6('0x24')](function(_0x43c87a){return _0x43c87a;});}return null;};}function removeEntity(_0x561f42,_0x53aeeb){return function(_0x30085d){if(_0x30085d){return _0x30085d['destroy']()[_0xa8c6('0x24')](function(){_0x561f42[_0xa8c6('0x1c')](0xcc)[_0xa8c6('0x25')]();});}};}function handleEntityNotFound(_0x2bae5c,_0x349e81){return function(_0x5bbf63){if(!_0x5bbf63){_0x2bae5c[_0xa8c6('0x1b')](0x194);}return _0x5bbf63;};}function handleError(_0x4145d0,_0x37e085){_0x37e085=_0x37e085||0x1f4;return function(_0x4cdb5c){logger['error'](_0x4cdb5c[_0xa8c6('0x26')]);if(_0x4cdb5c[_0xa8c6('0x27')]){delete _0x4cdb5c[_0xa8c6('0x27')];}_0x4145d0[_0xa8c6('0x1c')](_0x37e085)['send'](_0x4cdb5c);};}exports[_0xa8c6('0x28')]=function(_0x2a845b,_0x31005d){var _0x283176={},_0x552e13={},_0x516243={'count':0x0,'rows':[]};var _0xb0d7d6=_[_0xa8c6('0x29')](db[_0xa8c6('0x2a')][_0xa8c6('0x2b')],function(_0x51eb97){return{'name':_0x51eb97[_0xa8c6('0x2c')],'type':_0x51eb97['type'][_0xa8c6('0x2d')]};});_0x552e13[_0xa8c6('0x2e')]=_[_0xa8c6('0x29')](_0xb0d7d6,_0xa8c6('0x27'));_0x552e13[_0xa8c6('0x2f')]=_[_0xa8c6('0x30')](_0x2a845b[_0xa8c6('0x2f')]);_0x552e13[_0xa8c6('0x31')]=_[_0xa8c6('0x32')](_0x552e13[_0xa8c6('0x2e')],_0x552e13[_0xa8c6('0x2f')]);_0x283176[_0xa8c6('0x33')]=_[_0xa8c6('0x32')](_0x552e13['model'],qs[_0xa8c6('0x34')](_0x2a845b[_0xa8c6('0x2f')][_0xa8c6('0x34')]));_0x283176[_0xa8c6('0x33')]=_0x283176[_0xa8c6('0x33')][_0xa8c6('0x35')]?_0x283176[_0xa8c6('0x33')]:_0x552e13[_0xa8c6('0x2e')];if(!_0x2a845b[_0xa8c6('0x2f')][_0xa8c6('0x36')](_0xa8c6('0x37'))){_0x283176[_0xa8c6('0x38')]=qs['limit'](_0x2a845b[_0xa8c6('0x2f')][_0xa8c6('0x38')]);_0x283176[_0xa8c6('0x1e')]=qs[_0xa8c6('0x1e')](_0x2a845b[_0xa8c6('0x2f')]['offset']);}_0x283176[_0xa8c6('0x39')]=qs[_0xa8c6('0x3a')](_0x2a845b[_0xa8c6('0x2f')]['sort']);_0x283176[_0xa8c6('0x3b')]=qs[_0xa8c6('0x31')](_[_0xa8c6('0x3c')](_0x2a845b[_0xa8c6('0x2f')],_0x552e13['filters']));if(_0x2a845b[_0xa8c6('0x2f')][_0xa8c6('0x3d')]){_0x283176[_0xa8c6('0x3b')]=_['merge'](_0x283176[_0xa8c6('0x3b')],{'$or':_[_0xa8c6('0x29')](_0xb0d7d6,function(_0x31d824){if(_0x31d824[_0xa8c6('0x3e')]!==_0xa8c6('0x3f')){var _0x1b42f9={};_0x1b42f9[_0x31d824[_0xa8c6('0x27')]]={'$like':'%'+_0x2a845b[_0xa8c6('0x2f')][_0xa8c6('0x3d')]+'%'};return _0x1b42f9;}})});}_0x283176=_['merge']({},_0x283176,_0x2a845b['options']);var _0x257069={'where':_0x283176['where']};return db[_0xa8c6('0x2a')][_0xa8c6('0x40')](_0x257069)['then'](function(_0x4a2a42){_0x516243['count']=_0x4a2a42;if(_0x2a845b[_0xa8c6('0x2f')][_0xa8c6('0x41')]){_0x283176[_0xa8c6('0x42')]=[{'all':!![]}];}return db[_0xa8c6('0x2a')][_0xa8c6('0x43')](_0x283176);})[_0xa8c6('0x24')](function(_0xd95a58){_0x516243[_0xa8c6('0x44')]=_0xd95a58;return _0x516243;})[_0xa8c6('0x24')](respondWithFilteredResult(_0x31005d,_0x283176))['catch'](handleError(_0x31005d,null));};exports['show']=function(_0x4e864b,_0x48238f){var _0x4e794c={'raw':!![],'where':{'id':_0x4e864b[_0xa8c6('0x45')]['id']}},_0x4e2783={};_0x4e2783[_0xa8c6('0x2e')]=_[_0xa8c6('0x30')](db[_0xa8c6('0x2a')][_0xa8c6('0x2b')]);_0x4e2783[_0xa8c6('0x2f')]=_[_0xa8c6('0x30')](_0x4e864b[_0xa8c6('0x2f')]);_0x4e2783[_0xa8c6('0x31')]=_[_0xa8c6('0x32')](_0x4e2783[_0xa8c6('0x2e')],_0x4e2783[_0xa8c6('0x2f')]);_0x4e794c[_0xa8c6('0x33')]=_[_0xa8c6('0x32')](_0x4e2783[_0xa8c6('0x2e')],qs['fields'](_0x4e864b[_0xa8c6('0x2f')][_0xa8c6('0x34')]));_0x4e794c[_0xa8c6('0x33')]=_0x4e794c[_0xa8c6('0x33')]['length']?_0x4e794c[_0xa8c6('0x33')]:_0x4e2783[_0xa8c6('0x2e')];if(_0x4e864b[_0xa8c6('0x2f')][_0xa8c6('0x41')]){_0x4e794c[_0xa8c6('0x42')]=[{'all':!![]}];}_0x4e794c=_[_0xa8c6('0x46')]({},_0x4e794c,_0x4e864b[_0xa8c6('0x47')]);return db[_0xa8c6('0x2a')]['find'](_0x4e794c)[_0xa8c6('0x24')](handleEntityNotFound(_0x48238f,null))[_0xa8c6('0x24')](respondWithResult(_0x48238f,null))[_0xa8c6('0x48')](handleError(_0x48238f,null));};exports[_0xa8c6('0x49')]=function(_0x1d101a,_0x3a1a21){return db[_0xa8c6('0x2a')][_0xa8c6('0x49')](_0x1d101a[_0xa8c6('0x4a')],{})['then'](respondWithResult(_0x3a1a21,0xc9))[_0xa8c6('0x48')](handleError(_0x3a1a21,null));};exports[_0xa8c6('0x23')]=function(_0xe45de,_0xbc54d9){if(_0xe45de[_0xa8c6('0x4a')]['id']){delete _0xe45de[_0xa8c6('0x4a')]['id'];}return db[_0xa8c6('0x2a')][_0xa8c6('0x4b')]({'where':{'id':_0xe45de[_0xa8c6('0x45')]['id']}})[_0xa8c6('0x24')](handleEntityNotFound(_0xbc54d9,null))['then'](saveUpdates(_0xe45de[_0xa8c6('0x4a')],null))[_0xa8c6('0x24')](respondWithResult(_0xbc54d9,null))['catch'](handleError(_0xbc54d9,null));};exports[_0xa8c6('0x4c')]=function(_0x3d30e8,_0x49088f){return db['OpenchannelApplication'][_0xa8c6('0x4b')]({'where':{'id':_0x3d30e8[_0xa8c6('0x45')]['id']}})[_0xa8c6('0x24')](handleEntityNotFound(_0x49088f,null))[_0xa8c6('0x24')](removeEntity(_0x49088f,null))[_0xa8c6('0x48')](handleError(_0x49088f,null));}; \ No newline at end of file +var _0xf127=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','limit','set','reject','update','then','destroy','error','name','send','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','count','include','show','params','fields','includeAll','options','catch','create','body','find','html-pdf'];(function(_0x1e5d72,_0x4a0ab0){var _0x272bbe=function(_0xf78c1e){while(--_0xf78c1e){_0x1e5d72['push'](_0x1e5d72['shift']());}};_0x272bbe(++_0x4a0ab0);}(_0xf127,0x13a));var _0x7f12=function(_0x501abe,_0x395dc7){_0x501abe=_0x501abe-0x0;var _0x58462f=_0xf127[_0x501abe];return _0x58462f;};'use strict';var pdf=require(_0x7f12('0x0'));var emlformat=require(_0x7f12('0x1'));var rimraf=require(_0x7f12('0x2'));var zipdir=require(_0x7f12('0x3'));var jsonpatch=require(_0x7f12('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7f12('0x5'));var Mustache=require('mustache');var util=require(_0x7f12('0x6'));var path=require(_0x7f12('0x7'));var sox=require(_0x7f12('0x8'));var csv=require(_0x7f12('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7f12('0xa'));var squel=require('squel');var crypto=require(_0x7f12('0xb'));var jsforce=require(_0x7f12('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f12('0xd'));var Redis=require(_0x7f12('0xe'));var authService=require(_0x7f12('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7f12('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f12('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x7f12('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59b2ba,_0x858a3c){_0x858a3c=_0x858a3c||0xcc;return function(_0x45172c){if(_0x45172c){return _0x59b2ba[_0x7f12('0x13')](_0x858a3c);}return _0x59b2ba[_0x7f12('0x14')](_0x858a3c)[_0x7f12('0x15')]();};}function respondWithResult(_0x47d5ef,_0x438021){_0x438021=_0x438021||0xc8;return function(_0x37d91d){if(_0x37d91d){return _0x47d5ef[_0x7f12('0x14')](_0x438021)[_0x7f12('0x16')](_0x37d91d);}};}function respondWithFilteredResult(_0xab578f,_0x41a8c3){return function(_0x51d039){if(_0x51d039){var _0x4fbf36=_0x51d039['count'],_0x309c0a=_0x41a8c3[_0x7f12('0x17')],_0x57cdea=_0x41a8c3['offset']+_0x41a8c3[_0x7f12('0x18')],_0x1c4c21;if(_0x57cdea>=_0x4fbf36){_0x57cdea=_0x4fbf36;_0x1c4c21=0xc8;}else{_0x1c4c21=0xce;}_0xab578f['status'](_0x1c4c21);return _0xab578f[_0x7f12('0x19')]('Content-Range',_0x309c0a+'-'+_0x57cdea+'/'+_0x4fbf36)[_0x7f12('0x16')](_0x51d039);}return null;};}function patchUpdates(_0x4cf62e){return function(_0x54a4e2){try{jsonpatch['apply'](_0x54a4e2,_0x4cf62e,!![]);}catch(_0x55b680){return BPromise[_0x7f12('0x1a')](_0x55b680);}return _0x54a4e2['save']();};}function saveUpdates(_0x4f4cd0,_0x1bdc4c){return function(_0x418e63){if(_0x418e63){return _0x418e63[_0x7f12('0x1b')](_0x4f4cd0)[_0x7f12('0x1c')](function(_0x4751e0){return _0x4751e0;});}return null;};}function removeEntity(_0xfd0297,_0x94a074){return function(_0x3cafb8){if(_0x3cafb8){return _0x3cafb8[_0x7f12('0x1d')]()[_0x7f12('0x1c')](function(){_0xfd0297[_0x7f12('0x14')](0xcc)[_0x7f12('0x15')]();});}};}function handleEntityNotFound(_0x7f342,_0x55d622){return function(_0x24868a){if(!_0x24868a){_0x7f342[_0x7f12('0x13')](0x194);}return _0x24868a;};}function handleError(_0x50e2c1,_0x59f761){_0x59f761=_0x59f761||0x1f4;return function(_0x59b4eb){logger[_0x7f12('0x1e')](_0x59b4eb['stack']);if(_0x59b4eb['name']){delete _0x59b4eb[_0x7f12('0x1f')];}_0x50e2c1[_0x7f12('0x14')](_0x59f761)[_0x7f12('0x20')](_0x59b4eb);};}exports['index']=function(_0x2d160f,_0xf7c10c){var _0x2a5c20={},_0x29228a={},_0x513455={'count':0x0,'rows':[]};var _0x54fd9b=_['map'](db[_0x7f12('0x21')][_0x7f12('0x22')],function(_0x5905c8){return{'name':_0x5905c8[_0x7f12('0x23')],'type':_0x5905c8[_0x7f12('0x24')][_0x7f12('0x25')]};});_0x29228a[_0x7f12('0x26')]=_[_0x7f12('0x27')](_0x54fd9b,'name');_0x29228a['query']=_[_0x7f12('0x28')](_0x2d160f[_0x7f12('0x29')]);_0x29228a[_0x7f12('0x2a')]=_[_0x7f12('0x2b')](_0x29228a[_0x7f12('0x26')],_0x29228a[_0x7f12('0x29')]);_0x2a5c20[_0x7f12('0x2c')]=_[_0x7f12('0x2b')](_0x29228a[_0x7f12('0x26')],qs['fields'](_0x2d160f[_0x7f12('0x29')]['fields']));_0x2a5c20[_0x7f12('0x2c')]=_0x2a5c20[_0x7f12('0x2c')]['length']?_0x2a5c20[_0x7f12('0x2c')]:_0x29228a[_0x7f12('0x26')];if(!_0x2d160f[_0x7f12('0x29')][_0x7f12('0x2d')]('nolimit')){_0x2a5c20[_0x7f12('0x18')]=qs[_0x7f12('0x18')](_0x2d160f[_0x7f12('0x29')][_0x7f12('0x18')]);_0x2a5c20[_0x7f12('0x17')]=qs[_0x7f12('0x17')](_0x2d160f[_0x7f12('0x29')][_0x7f12('0x17')]);}_0x2a5c20[_0x7f12('0x2e')]=qs[_0x7f12('0x2f')](_0x2d160f['query']['sort']);_0x2a5c20[_0x7f12('0x30')]=qs[_0x7f12('0x2a')](_['pick'](_0x2d160f[_0x7f12('0x29')],_0x29228a[_0x7f12('0x2a')]));if(_0x2d160f[_0x7f12('0x29')][_0x7f12('0x31')]){_0x2a5c20[_0x7f12('0x30')]=_[_0x7f12('0x32')](_0x2a5c20['where'],{'$or':_[_0x7f12('0x27')](_0x54fd9b,function(_0x399c74){if(_0x399c74['type']!==_0x7f12('0x33')){var _0x561576={};_0x561576[_0x399c74[_0x7f12('0x1f')]]={'$like':'%'+_0x2d160f[_0x7f12('0x29')]['filter']+'%'};return _0x561576;}})});}_0x2a5c20=_[_0x7f12('0x32')]({},_0x2a5c20,_0x2d160f['options']);var _0x2c3a2e={'where':_0x2a5c20['where']};return db['OpenchannelApplication']['count'](_0x2c3a2e)[_0x7f12('0x1c')](function(_0x2f1405){_0x513455[_0x7f12('0x34')]=_0x2f1405;if(_0x2d160f[_0x7f12('0x29')]['includeAll']){_0x2a5c20[_0x7f12('0x35')]=[{'all':!![]}];}return db[_0x7f12('0x21')]['findAll'](_0x2a5c20);})[_0x7f12('0x1c')](function(_0x3d1a6f){_0x513455['rows']=_0x3d1a6f;return _0x513455;})[_0x7f12('0x1c')](respondWithFilteredResult(_0xf7c10c,_0x2a5c20))['catch'](handleError(_0xf7c10c,null));};exports[_0x7f12('0x36')]=function(_0xeec276,_0x48838c){var _0x58ad18={'raw':!![],'where':{'id':_0xeec276[_0x7f12('0x37')]['id']}},_0x3bfaad={};_0x3bfaad[_0x7f12('0x26')]=_[_0x7f12('0x28')](db[_0x7f12('0x21')]['rawAttributes']);_0x3bfaad['query']=_['keys'](_0xeec276['query']);_0x3bfaad[_0x7f12('0x2a')]=_['intersection'](_0x3bfaad[_0x7f12('0x26')],_0x3bfaad[_0x7f12('0x29')]);_0x58ad18[_0x7f12('0x2c')]=_['intersection'](_0x3bfaad[_0x7f12('0x26')],qs[_0x7f12('0x38')](_0xeec276[_0x7f12('0x29')][_0x7f12('0x38')]));_0x58ad18['attributes']=_0x58ad18['attributes']['length']?_0x58ad18[_0x7f12('0x2c')]:_0x3bfaad[_0x7f12('0x26')];if(_0xeec276[_0x7f12('0x29')][_0x7f12('0x39')]){_0x58ad18['include']=[{'all':!![]}];}_0x58ad18=_[_0x7f12('0x32')]({},_0x58ad18,_0xeec276[_0x7f12('0x3a')]);return db[_0x7f12('0x21')]['find'](_0x58ad18)[_0x7f12('0x1c')](handleEntityNotFound(_0x48838c,null))[_0x7f12('0x1c')](respondWithResult(_0x48838c,null))[_0x7f12('0x3b')](handleError(_0x48838c,null));};exports[_0x7f12('0x3c')]=function(_0x43d20c,_0x5ea0d6){return db[_0x7f12('0x21')][_0x7f12('0x3c')](_0x43d20c[_0x7f12('0x3d')],{})[_0x7f12('0x1c')](respondWithResult(_0x5ea0d6,0xc9))[_0x7f12('0x3b')](handleError(_0x5ea0d6,null));};exports['update']=function(_0x3540e8,_0x3841a4){if(_0x3540e8[_0x7f12('0x3d')]['id']){delete _0x3540e8['body']['id'];}return db[_0x7f12('0x21')]['find']({'where':{'id':_0x3540e8[_0x7f12('0x37')]['id']}})[_0x7f12('0x1c')](handleEntityNotFound(_0x3841a4,null))[_0x7f12('0x1c')](saveUpdates(_0x3540e8[_0x7f12('0x3d')],null))[_0x7f12('0x1c')](respondWithResult(_0x3841a4,null))['catch'](handleError(_0x3841a4,null));};exports[_0x7f12('0x1d')]=function(_0xc99564,_0x1ac14b){return db[_0x7f12('0x21')][_0x7f12('0x3e')]({'where':{'id':_0xc99564[_0x7f12('0x37')]['id']}})[_0x7f12('0x1c')](handleEntityNotFound(_0x1ac14b,null))[_0x7f12('0x1c')](removeEntity(_0x1ac14b,null))[_0x7f12('0x3b')](handleError(_0x1ac14b,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 116e858..c69564d 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 _0xb095=['path','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb095,0x8b));var _0x5b09=function(_0x298777,_0x4ce807){_0x298777=_0x298777-0x0;var _0x5253fd=_0xb095[_0x298777];return _0x5253fd;};'use strict';var _=require(_0x5b09('0x0'));var util=require('util');var logger=require(_0x5b09('0x1'))('api');var moment=require(_0x5b09('0x2'));var BPromise=require(_0x5b09('0x3'));var rp=require(_0x5b09('0x4'));var fs=require('fs');var path=require(_0x5b09('0x5'));var rimraf=require('rimraf');var config=require(_0x5b09('0x6'));var attributes=require(_0x5b09('0x7'));module[_0x5b09('0x8')]=function(_0x4b7355,_0x5e387e){return _0x4b7355[_0x5b09('0x9')]('OpenchannelApplication',attributes,{'tableName':_0x5b09('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5b09('0xb')});}; \ No newline at end of file +var _0x0c90=['request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird'];(function(_0x505d04,_0x454240){var _0x2bd88c=function(_0x2207bd){while(--_0x2207bd){_0x505d04['push'](_0x505d04['shift']());}};_0x2bd88c(++_0x454240);}(_0x0c90,0x168));var _0x00c9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0c90[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x00c9('0x0'));var util=require(_0x00c9('0x1'));var logger=require(_0x00c9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x00c9('0x3'));var rp=require(_0x00c9('0x4'));var fs=require('fs');var path=require(_0x00c9('0x5'));var rimraf=require(_0x00c9('0x6'));var config=require(_0x00c9('0x7'));var attributes=require(_0x00c9('0x8'));module['exports']=function(_0xe83e16,_0x3491e7){return _0xe83e16['define'](_0x00c9('0x9'),attributes,{'tableName':_0x00c9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x00c9('0xb'),'collate':_0x00c9('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index a1021cd..948e20d 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(_0x31e308,_0x58b8d4){var _0x16f24a=function(_0xc6f817){while(--_0xc6f817){_0x31e308['push'](_0x31e308['shift']());}};_0x16f24a(++_0x58b8d4);}(_0xb10b,0x12a));var _0xbb10=function(_0x1e5f91,_0xa38bd9){_0x1e5f91=_0x1e5f91-0x0;var _0x5bb46b=_0xb10b[_0x1e5f91];return _0x5bb46b;};'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(_0x3f502a,_0x3e42c4){var _0x545a8f=function(_0x3087cc){while(--_0x3087cc){_0x3f502a['push'](_0x3f502a['shift']());}};_0x545a8f(++_0x3e42c4);}(_0xb10b,0x12a));var _0xbb10=function(_0x172e0a,_0x15d22a){_0x172e0a=_0x172e0a-0x0;var _0x4baf16=_0xb10b[_0x172e0a];return _0x4baf16;};'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 fcfcc30..fea3373 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 _0x4149=['index','get','/describe','/:id/messages','/:id/download','download','post','create','addMessage','tracked','/:id','openchannelinteraction:update','update','delete','openchannel','openchannelinteraction:destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x4149,0x146));var _0x9414=function(_0x58bb2d,_0x3196db){_0x58bb2d=_0x58bb2d-0x0;var _0x4994f7=_0x4149[_0x58bb2d];return _0x4994f7;};'use strict';var multer=require('multer');var util=require(_0x9414('0x0'));var path=require(_0x9414('0x1'));var timeout=require(_0x9414('0x2'));var express=require(_0x9414('0x3'));var router=express[_0x9414('0x4')]();var auth=require(_0x9414('0x5'));var interaction=require(_0x9414('0x6'));var config=require(_0x9414('0x7'));var controller=require(_0x9414('0x8'));router['get']('/',auth[_0x9414('0x9')](),controller[_0x9414('0xa')]);router[_0x9414('0xb')](_0x9414('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x9414('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9414('0xb')](_0x9414('0xd'),auth[_0x9414('0x9')](),controller['getMessages']);router[_0x9414('0xb')](_0x9414('0xe'),auth[_0x9414('0x9')](),controller[_0x9414('0xf')]);router[_0x9414('0x10')]('/',auth[_0x9414('0x9')](),controller[_0x9414('0x11')]);router[_0x9414('0x10')](_0x9414('0xd'),auth['isAuthenticated'](),controller[_0x9414('0x12')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x9414('0x13')]('openchannel','openchannelinteraction:addtags'),controller['addTags']);router['put'](_0x9414('0x14'),auth['isAuthenticated'](),interaction[_0x9414('0x13')]('openchannel',_0x9414('0x15')),controller[_0x9414('0x16')]);router[_0x9414('0x17')]('/:id',auth[_0x9414('0x9')](),interaction['tracked'](_0x9414('0x18'),_0x9414('0x19')),controller['destroy']);router[_0x9414('0x17')]('/:id/tags',auth[_0x9414('0x9')](),controller[_0x9414('0x1a')]);module[_0x9414('0x1b')]=router; \ No newline at end of file +var _0xd374=['/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','index','isAuthenticated','describe','get','/:id','show','/:id/messages','getMessages','download','create','post','addMessage'];(function(_0x236906,_0x1c2803){var _0x21199e=function(_0x5eb347){while(--_0x5eb347){_0x236906['push'](_0x236906['shift']());}};_0x21199e(++_0x1c2803);}(_0xd374,0x19f));var _0x4d37=function(_0x2fce38,_0x46600b){_0x2fce38=_0x2fce38-0x0;var _0x5f40c0=_0xd374[_0x2fce38];return _0x5f40c0;};'use strict';var multer=require(_0x4d37('0x0'));var util=require(_0x4d37('0x1'));var path=require(_0x4d37('0x2'));var timeout=require(_0x4d37('0x3'));var express=require(_0x4d37('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4d37('0x5'));var config=require(_0x4d37('0x6'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4d37('0x7')]);router['get']('/describe',auth[_0x4d37('0x8')](),controller[_0x4d37('0x9')]);router[_0x4d37('0xa')](_0x4d37('0xb'),auth['isAuthenticated'](),controller[_0x4d37('0xc')]);router[_0x4d37('0xa')](_0x4d37('0xd'),auth['isAuthenticated'](),controller[_0x4d37('0xe')]);router['get']('/:id/download',auth[_0x4d37('0x8')](),controller[_0x4d37('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4d37('0x10')]);router[_0x4d37('0x11')](_0x4d37('0xd'),auth[_0x4d37('0x8')](),controller[_0x4d37('0x12')]);router[_0x4d37('0x11')](_0x4d37('0x13'),auth[_0x4d37('0x8')](),interaction[_0x4d37('0x14')]('openchannel',_0x4d37('0x15')),controller[_0x4d37('0x16')]);router[_0x4d37('0x17')](_0x4d37('0xb'),auth[_0x4d37('0x8')](),interaction[_0x4d37('0x14')](_0x4d37('0x18'),_0x4d37('0x19')),controller[_0x4d37('0x1a')]);router[_0x4d37('0x1b')](_0x4d37('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x4d37('0x18'),'openchannelinteraction:destroy'),controller[_0x4d37('0x1c')]);router[_0x4d37('0x1b')](_0x4d37('0x13'),auth[_0x4d37('0x8')](),controller[_0x4d37('0x1d')]);module[_0x4d37('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index cdd822f..c5d0843 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 _0x4d8e=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x4d8e,0x9b));var _0xe4d8=function(_0x36edcb,_0x1f64df){_0x36edcb=_0x36edcb-0x0;var _0x44c0d9=_0x4d8e[_0x36edcb];return _0x44c0d9;};'use strict';var Sequelize=require(_0xe4d8('0x0'));module['exports']={'closed':{'type':Sequelize[_0xe4d8('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe4d8('0x2')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe4d8('0x3')]},'read1stAt':{'type':Sequelize[_0xe4d8('0x2')]},'threadId':{'type':Sequelize[_0xe4d8('0x3')]},'externalUrl':{'type':Sequelize[_0xe4d8('0x3')]},'lastMsgAt':{'type':Sequelize[_0xe4d8('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xe4d8('0x4')]('in',_0xe4d8('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe4d8('0x3')]}}; \ No newline at end of file +var _0xf5b0=['ENUM','sequelize','BOOLEAN','DATE','STRING'];(function(_0x54daa2,_0x48ca14){var _0x4a43d0=function(_0x24a1ed){while(--_0x24a1ed){_0x54daa2['push'](_0x54daa2['shift']());}};_0x4a43d0(++_0x48ca14);}(_0xf5b0,0x1e1));var _0x0f5b=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xf5b0[_0x565c49];return _0x20ca34;};'use strict';var Sequelize=require(_0x0f5b('0x0'));module['exports']={'closed':{'type':Sequelize[_0x0f5b('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0f5b('0x2')]},'disposition':{'type':Sequelize[_0x0f5b('0x3')]},'note':{'type':Sequelize[_0x0f5b('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x0f5b('0x3')]},'externalUrl':{'type':Sequelize[_0x0f5b('0x3')]},'lastMsgAt':{'type':Sequelize[_0x0f5b('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x0f5b('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0f5b('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 2faeaa3..1d268c1 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 _0x0b57=['jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name','send','map','fullname','split','Tags','push','catch','index','OpenchannelInteraction','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','select','field','from','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','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','isEmpty','forEach','OpenchannelAccountId','concat','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.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','show','params','keys','rawAttributes','includeAll','include','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','pick','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','color','emit','openchannelInteractionTags:save','removeTags','download','root','server','tmp','files','attachments','join','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','direction','OpenchannelAccount','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','Account','Owner','createdAt','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','createWriteStream','out','System','secret','renderFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x0b57,0xdb));var _0x70b5=function(_0x54062d,_0x37dd2c){_0x54062d=_0x54062d-0x0;var _0x2e96c8=_0x0b57[_0x54062d];return _0x2e96c8;};'use strict';var pdf=require(_0x70b5('0x0'));var emlformat=require(_0x70b5('0x1'));var rimraf=require(_0x70b5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x70b5('0x3'));var rp=require('request-promise');var moment=require(_0x70b5('0x4'));var BPromise=require(_0x70b5('0x5'));var Mustache=require(_0x70b5('0x6'));var util=require(_0x70b5('0x7'));var path=require(_0x70b5('0x8'));var sox=require(_0x70b5('0x9'));var csv=require(_0x70b5('0xa'));var ejs=require(_0x70b5('0xb'));var fs=require('fs');var _=require(_0x70b5('0xc'));var squel=require(_0x70b5('0xd'));var crypto=require(_0x70b5('0xe'));var jsforce=require(_0x70b5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x70b5('0xa'));var querystring=require('querystring');var Papa=require(_0x70b5('0x10'));var Redis=require(_0x70b5('0x11'));var authService=require(_0x70b5('0x12'));var qs=require(_0x70b5('0x13'));var as=require(_0x70b5('0x14'));var hardwareService=require(_0x70b5('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x70b5('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x70b5('0x17')]=_['defaults'](config[_0x70b5('0x17')],{'host':_0x70b5('0x18'),'port':0x18eb});var socket=require(_0x70b5('0x19'))(new Redis(config[_0x70b5('0x17')]));require(_0x70b5('0x1a'))[_0x70b5('0x1b')](socket);function respondWithStatusCode(_0x15ccbf,_0x333396){_0x333396=_0x333396||0xcc;return function(_0x203e54){if(_0x203e54){return _0x15ccbf[_0x70b5('0x1c')](_0x333396);}return _0x15ccbf['status'](_0x333396)[_0x70b5('0x1d')]();};}function respondWithResult(_0x209323,_0x5c0519){_0x5c0519=_0x5c0519||0xc8;return function(_0x4b59c8){if(_0x4b59c8){return _0x209323[_0x70b5('0x1e')](_0x5c0519)[_0x70b5('0x1f')](_0x4b59c8);}};}function respondWithFilteredResult(_0x5e0eaa,_0x21c501){return function(_0x5aa488){if(_0x5aa488){var _0x2c7474=_0x5aa488[_0x70b5('0x20')],_0x4b36d4=_0x21c501[_0x70b5('0x21')],_0x9d932c=_0x21c501[_0x70b5('0x21')]+_0x21c501[_0x70b5('0x22')],_0x2016eb;if(_0x9d932c>=_0x2c7474){_0x9d932c=_0x2c7474;_0x2016eb=0xc8;}else{_0x2016eb=0xce;}_0x5e0eaa[_0x70b5('0x1e')](_0x2016eb);return _0x5e0eaa[_0x70b5('0x23')]('Content-Range',_0x4b36d4+'-'+_0x9d932c+'/'+_0x2c7474)['json'](_0x5aa488);}return null;};}function patchUpdates(_0x439bbd){return function(_0x5d3244){try{jsonpatch['apply'](_0x5d3244,_0x439bbd,!![]);}catch(_0x3f8b53){return BPromise[_0x70b5('0x24')](_0x3f8b53);}return _0x5d3244[_0x70b5('0x25')]();};}function saveUpdates(_0xfe8b4f,_0x53905a){return function(_0x165a4c){if(_0x165a4c){return _0x165a4c[_0x70b5('0x26')](_0xfe8b4f)[_0x70b5('0x27')](function(_0x3c82c6){return _0x3c82c6;});}return null;};}function removeEntity(_0x319e38,_0x5a14b8){return function(_0x436c22){if(_0x436c22){return _0x436c22[_0x70b5('0x28')]()['then'](function(){_0x319e38[_0x70b5('0x1e')](0xcc)[_0x70b5('0x1d')]();});}};}function handleEntityNotFound(_0x34b10d,_0x2d5023){return function(_0x1fc0c7){if(!_0x1fc0c7){_0x34b10d[_0x70b5('0x1c')](0x194);}return _0x1fc0c7;};}function handleError(_0x351d2f,_0x3e4428){_0x3e4428=_0x3e4428||0x1f4;return function(_0x5c8e7c){logger[_0x70b5('0x29')](_0x5c8e7c[_0x70b5('0x2a')]);if(_0x5c8e7c[_0x70b5('0x2b')]){delete _0x5c8e7c[_0x70b5('0x2b')];}_0x351d2f['status'](_0x3e4428)[_0x70b5('0x2c')](_0x5c8e7c);};}function getInteractionUsers(_0x4862d4,_0x325a68){return new BPromise(function(_0x440583,_0x28c6a7){try{if(_0x325a68[_0x4862d4['id']]){_0x4862d4['Users']=_[_0x70b5('0x2d')](_0x325a68[_0x4862d4['id']],function(_0x4bc6eb){return{'id':_0x4bc6eb['id'],'fullname':_0x4bc6eb[_0x70b5('0x2e')]};});}}catch(_0x45b69e){_0x28c6a7(_0x45b69e);}_0x440583(_0x4862d4);});}function getInteractionTags(_0x4bba74,_0x239b18){return new BPromise(function(_0x199af7,_0x1882c6){try{if(_0x4bba74['TagIds']){_0x4bba74['Tags']=[];_0x4bba74['TagIds'][_0x70b5('0x2f')](',')['forEach'](function(_0x53f3d8){_0x4bba74[_0x70b5('0x30')][_0x70b5('0x31')](_0x239b18[_0x53f3d8]);});}delete _0x4bba74['TagIds'];}catch(_0xc8c306){_0x1882c6(_0xc8c306);}_0x199af7(_0x4bba74);});}function updateOpenchannelInteraction(_0x4c6a98,_0x10113b,_0x56292a){return new BPromise(function(_0x10e946,_0x548c1f){return getInteractionUsers(_0x4c6a98,_0x56292a)[_0x70b5('0x27')](function(_0x1a927d){return getInteractionTags(_0x1a927d,_0x10113b);})[_0x70b5('0x27')](function(_0x2e790d){_0x10e946(_0x2e790d);})[_0x70b5('0x32')](function(_0x2ba954){_0x548c1f(_0x2ba954);});});}exports[_0x70b5('0x33')]=function(_0x2ab7ef,_0x4ccfc4){var _0x4fda78={},_0x35530b={},_0x2ab08e={'count':0x0,'rows':[]};var _0x4c09c4=_['map'](db[_0x70b5('0x34')]['rawAttributes'],function(_0x19d62b){return{'name':_0x19d62b[_0x70b5('0x35')],'type':_0x19d62b[_0x70b5('0x36')][_0x70b5('0x37')]};});_0x35530b[_0x70b5('0x38')]=_[_0x70b5('0x2d')](_0x4c09c4,'name');_0x35530b[_0x70b5('0x39')]=_['keys'](_0x2ab7ef['query']);_0x35530b[_0x70b5('0x3a')]=_[_0x70b5('0x3b')](_0x35530b[_0x70b5('0x38')],_0x35530b['query']);_0x4fda78[_0x70b5('0x3c')]=_[_0x70b5('0x3b')](_0x35530b[_0x70b5('0x38')],qs[_0x70b5('0x3d')](_0x2ab7ef[_0x70b5('0x39')][_0x70b5('0x3d')]));_0x4fda78[_0x70b5('0x3c')]=_0x4fda78[_0x70b5('0x3c')][_0x70b5('0x3e')]?_0x4fda78[_0x70b5('0x3c')]:_0x35530b[_0x70b5('0x38')];if(!_0x2ab7ef[_0x70b5('0x39')][_0x70b5('0x3f')](_0x70b5('0x40'))){_0x4fda78[_0x70b5('0x22')]=qs[_0x70b5('0x22')](_0x2ab7ef['query'][_0x70b5('0x22')]);_0x4fda78[_0x70b5('0x21')]=qs['offset'](_0x2ab7ef[_0x70b5('0x39')][_0x70b5('0x21')]);}_0x4fda78[_0x70b5('0x41')]=qs[_0x70b5('0x42')](_0x2ab7ef[_0x70b5('0x39')][_0x70b5('0x42')]);_0x4fda78[_0x70b5('0x43')]=qs[_0x70b5('0x3a')](_['pick'](_0x2ab7ef['query'],_0x35530b[_0x70b5('0x3a')]));var _0x3eb693=[];var _0x548b14=squel[_0x70b5('0x44')]()[_0x70b5('0x45')]('id')[_0x70b5('0x45')](_0x70b5('0x2b'))[_0x70b5('0x45')]('color')[_0x70b5('0x46')]('tools_tags');var _0x40b109=squel[_0x70b5('0x44')]()['field']('u.id')[_0x70b5('0x45')]('u.fullname')[_0x70b5('0x45')](_0x70b5('0x47'))['from'](_0x70b5('0x48'),'ui')['left_join'](_0x70b5('0x49'),'u',_0x70b5('0x4a'));var _0x2a9ac0=squel[_0x70b5('0x44')]()[_0x70b5('0x46')](_0x70b5('0x4b'),'i')[_0x70b5('0x4c')](_0x70b5('0x4d'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x70b5('0x4c')](_0x70b5('0x49'),'o',_0x70b5('0x4e'))['left_join'](_0x70b5('0x4f'),'a',_0x70b5('0x50'))[_0x70b5('0x4c')]('openchannel_messages','me',_0x70b5('0x51'))['left_join'](_0x70b5('0x52'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0x70b5('0x53'),'t',_0x70b5('0x54'));var _0x1fb7e1=squel[_0x70b5('0x55')]();var _0x25f2f3=[];var _0x477585=squel['expr']();var _0xab95bb;if(_0x2ab7ef[_0x70b5('0x39')][_0x70b5('0x56')]){_0xab95bb=as[_0x70b5('0x57')](_0x2ab7ef[_0x70b5('0x39')][_0x70b5('0x56')]);var _0x49539a=_0xab95bb[_0x70b5('0x58')];for(var _0x204310=0x0;_0x204310<_0xab95bb['conditions'][_0x70b5('0x3e')];_0x204310++){var _0x59240b=_0xab95bb[_0x70b5('0x59')][_0x204310];var _0x13e834='i';var _0x29fd65=_[_0x70b5('0x5a')](_0x4c09c4,['name',_0x59240b['field']]);if(!_0x29fd65){switch(_0x59240b[_0x70b5('0x45')]){case _0x70b5('0x5b'):if(_0x59240b[_0x70b5('0x5c')]==0x1){_0x2a9ac0[_0x70b5('0x5d')]('`'+_0x59240b[_0x70b5('0x45')]+_0x70b5('0x5e'));}else{_0x2a9ac0['having']('`'+_0x59240b[_0x70b5('0x45')]+'`\x20>\x200');}break;case _0x70b5('0x5f'):if(_0x59240b[_0x70b5('0x60')]===_0x70b5('0x61')){if(_0x59240b['value'][_0x70b5('0x2f')]('\x20')[_0x70b5('0x3e')]>0x1){_0x1fb7e1[_0x49539a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x70b5('0x62')](_0x59240b['value']),null);}else{var _0xfab180='%'+_0x59240b['value']+'%';_0x1fb7e1[_0x49539a](_0x70b5('0x63'),_0xfab180,_0xfab180,_0xfab180);}}else{_0x29fd65=_[_0x70b5('0x5a')](_0x4c09c4,['name',_0x70b5('0x64')]);_0x59240b[_0x70b5('0x45')]=_0x70b5('0x64');_0x33bda6=as[_0x70b5('0x65')](_0x13e834,_0x29fd65[_0x70b5('0x36')],_0x59240b);_0x1fb7e1[_0x49539a](_0x33bda6[_0x70b5('0x66')],_0x33bda6[_0x70b5('0x5c')][_0x70b5('0x67')],_0x33bda6[_0x70b5('0x5c')][_0x70b5('0x1d')]);}break;case _0x70b5('0x68'):var _0x16622e=_0x59240b[_0x70b5('0x5c')][_0x70b5('0x2f')](',')[_0x70b5('0x2d')](function(_0x50eff5){return Number(_0x50eff5);});_0x16622e['forEach'](function(_0x20134f){_0x477585['or'](_0x70b5('0x69'),'%,'+_0x20134f+',%');});_0x25f2f3=_[_0x70b5('0x6a')](_0x25f2f3,_0x16622e);break;case _0x70b5('0x6b'):if(_0x59240b[_0x70b5('0x60')]===_0x70b5('0x61')){_0x1fb7e1[_0x49539a](_0x70b5('0x6c'),'%'+_0x59240b[_0x70b5('0x5c')]+'%',null);}else{_0x29fd65=_[_0x70b5('0x5a')](_0x4c09c4,[_0x70b5('0x2b'),_0x70b5('0x6d')]);_0x59240b[_0x70b5('0x45')]=_0x70b5('0x6d');_0x33bda6=as['buildExpression'](_0x13e834,_0x29fd65['type'],_0x59240b);_0x1fb7e1[_0x49539a](_0x33bda6[_0x70b5('0x66')],_0x33bda6[_0x70b5('0x5c')][_0x70b5('0x67')],_0x33bda6[_0x70b5('0x5c')][_0x70b5('0x1d')]);}break;case _0x70b5('0x6e'):_0x33bda6=as[_0x70b5('0x65')]('me',null,_0x59240b);_0x1fb7e1[_0x49539a](_0x33bda6['text'],_0x33bda6[_0x70b5('0x5c')][_0x70b5('0x67')],_0x33bda6[_0x70b5('0x5c')][_0x70b5('0x1d')]);break;}}else{var _0x33bda6=as['buildExpression'](_0x13e834,_0x29fd65['type'],_0x59240b);_0x1fb7e1[_0x49539a](_0x33bda6[_0x70b5('0x66')],_0x33bda6['value'][_0x70b5('0x67')],_0x33bda6[_0x70b5('0x5c')][_0x70b5('0x1d')]);}}}else{var _0x21f22c=_(_0x2ab7ef['query'])['keys']()[_0x70b5('0x2d')](function(_0x534296){return _['some'](_0x4c09c4,[_0x70b5('0x2b'),_0x534296])?_0x534296:undefined;})['compact']()['value']();if(!_[_0x70b5('0x6f')](_0x21f22c)){_0x21f22c[_0x70b5('0x70')](function(_0x39c097){if(_0x39c097===_0x70b5('0x71')){_0x2a9ac0['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0x70b5('0x72')](_0x2ab7ef[_0x70b5('0x39')][_0x39c097]));}else if(_0x39c097==='createdAt'){var _0x78b262=JSON[_0x70b5('0x73')](_0x2ab7ef[_0x70b5('0x39')][_0x39c097])[_0x70b5('0x74')];var _0x3c492d=JSON[_0x70b5('0x73')](_0x2ab7ef[_0x70b5('0x39')][_0x39c097])[_0x70b5('0x75')];_0x2a9ac0[_0x70b5('0x43')](_0x70b5('0x76'),_0x78b262,_0x3c492d);}else{if(_0x2ab7ef[_0x70b5('0x39')][_0x39c097]===_0x70b5('0x77')){_0x2a9ac0[_0x70b5('0x43')]('i.'+_0x39c097+'\x20IS\x20NULL');}else{_0x2a9ac0[_0x70b5('0x43')]('i.'+_0x39c097+'\x20=\x20?',_0x2ab7ef[_0x70b5('0x39')][_0x39c097]);}}});}if(_0x2ab7ef['query']['read']){if(_0x2ab7ef[_0x70b5('0x39')][_0x70b5('0x78')]==0x1){_0x2a9ac0[_0x70b5('0x5d')](_0x70b5('0x79'));}else{_0x2a9ac0[_0x70b5('0x5d')](_0x70b5('0x7a'));}}if(_0x2ab7ef[_0x70b5('0x39')][_0x70b5('0x7b')]){_0x25f2f3=_['isArray'](_0x2ab7ef['query'][_0x70b5('0x7b')])?_0x2ab7ef[_0x70b5('0x39')][_0x70b5('0x7b')]:new Array(_0x2ab7ef[_0x70b5('0x39')][_0x70b5('0x7b')]);_0x25f2f3[_0x70b5('0x70')](function(_0x38d095){_0x477585['or'](_0x70b5('0x69'),'%,'+_0x38d095+',%');});}if(_0x2ab7ef['query'][_0x70b5('0x7c')]){var _0x149906=_0x2ab7ef['query'][_0x70b5('0x7c')][_0x70b5('0x7d')]('\x5c','\x5c\x5c')[_0x70b5('0x7d')]('\x27\x27',_0x70b5('0x7e'));if(qs['isNumeric'](_0x149906)){_0x1fb7e1['or']('i.id\x20LIKE\x20?',_0x149906+'%');}else{_0x1fb7e1['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x70b5('0x62')](_0x149906))['or'](_0x70b5('0x7f'),_0x149906+'%')['or'](_0x70b5('0x80'),_0x149906+'%');}}}_0x2a9ac0[_0x70b5('0x43')](_0x1fb7e1);_0x2a9ac0['group'](_0x70b5('0x81'));var _0x2f8190={'type':db[_0x70b5('0x82')]['QueryTypes'][_0x70b5('0x83')],'raw':!![]};var _0x10b31=_0x2a9ac0[_0x70b5('0x84')]();_0x10b31[_0x70b5('0x45')](_0x70b5('0x81'));_0x10b31[_0x70b5('0x45')](_0x70b5('0x85'),_0x70b5('0x5b'));if(_0x4fda78[_0x70b5('0x41')]){_0x4fda78[_0x70b5('0x41')][_0x70b5('0x70')](function(_0x4e2292){_0x2a9ac0[_0x70b5('0x41')]('i.'+_0x4e2292[0x0],_0x4e2292[0x1]===_0x70b5('0x86')?![]:!![]);});}if(!_[_0x70b5('0x6f')](_0x25f2f3)){_0x2a9ac0[_0x70b5('0x5d')](_0x477585);_0x10b31[_0x70b5('0x43')](_0x70b5('0x87'),_0x25f2f3);}BPromise['resolve']()['then'](function(){if(!_0xab95bb){if(_0x2ab7ef[_0x70b5('0x39')][_0x70b5('0x71')]||_0x2ab7ef[_0x70b5('0x39')]['journey'])return;_0x10b31[_0x70b5('0x43')](_0x70b5('0x88'));_0x2a9ac0['where'](_0x70b5('0x88'));return;}return _0x2ab7ef[_0x70b5('0x89')][_0x70b5('0x8a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5e351e){if(_[_0x70b5('0x6f')](_0x5e351e)){_0x10b31[_0x70b5('0x43')](_0x70b5('0x8b'));_0x2a9ac0[_0x70b5('0x43')](_0x70b5('0x8b'));}else{_0x10b31[_0x70b5('0x43')](_0x70b5('0x8c'),_['map'](_0x5e351e,'id'));_0x2a9ac0[_0x70b5('0x43')](_0x70b5('0x8c'),_[_0x70b5('0x2d')](_0x5e351e,'id'));}});})['then'](function(){db[_0x70b5('0x8d')][_0x70b5('0x39')](_0x10b31['toString'](),_0x2f8190)[_0x70b5('0x27')](function(_0x2c8095){_0x2ab08e[_0x70b5('0x20')]=_0x2c8095[_0x70b5('0x3e')];if(_0x2ab08e[_0x70b5('0x20')]===0x0)return[];return db[_0x70b5('0x8d')][_0x70b5('0x39')](_0x548b14[_0x70b5('0x8e')](),_0x2f8190)['then'](function(_0xdae4a5){_0x3eb693=_[_0x70b5('0x8f')](_0xdae4a5,'id');_0x2f8190=_[_0x70b5('0x90')](_0x2f8190,{'model':db[_0x70b5('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ab7ef[_0x70b5('0x39')][_0x70b5('0x3d')]){_0x4fda78[_0x70b5('0x3c')][_0x70b5('0x70')](function(_0x2473a5){_0x2a9ac0['field']('i.'+_0x2473a5);});}else{_0x2a9ac0[_0x70b5('0x45')](_0x70b5('0x85'),_0x70b5('0x5b'));_0x2a9ac0[_0x70b5('0x45')]('a.key',_0x70b5('0x91'));_0x2a9ac0[_0x70b5('0x45')](_0x70b5('0x92'),'Account.mandatoryDisposition');_0x2a9ac0[_0x70b5('0x45')](_0x70b5('0x93'));_0x2a9ac0[_0x70b5('0x45')]('c.firstName',_0x70b5('0x94'));_0x2a9ac0[_0x70b5('0x45')](_0x70b5('0x95'),_0x70b5('0x96'));_0x2a9ac0[_0x70b5('0x45')]('c.email','Contact.email');_0x2a9ac0[_0x70b5('0x45')](_0x70b5('0x97'),_0x70b5('0x98'));_0x2a9ac0['field'](_0x70b5('0x99'),'Contact.mobile');_0x2a9ac0[_0x70b5('0x45')](_0x70b5('0x9a'),_0x70b5('0x9b'));_0x2a9ac0['field'](_0x70b5('0x9c'),_0x70b5('0x9d'));_0x2a9ac0[_0x70b5('0x45')]('o.internal',_0x70b5('0x9e'));_0x2a9ac0[_0x70b5('0x45')](_0x70b5('0x9f'),_0x70b5('0xa0'));}_0x2a9ac0[_0x70b5('0x22')](_0x4fda78['limit']);_0x2a9ac0[_0x70b5('0x21')](_0x4fda78[_0x70b5('0x21')]);return db['sequelize'][_0x70b5('0x39')](_0x2a9ac0[_0x70b5('0x8e')](),_0x2f8190);})[_0x70b5('0x27')](function(_0x49d2b6){_0x40b109[_0x70b5('0x43')](_0x70b5('0xa1'),_['map'](_0x49d2b6,'id'));return db[_0x70b5('0x8d')]['query'](_0x40b109[_0x70b5('0x8e')](),_0x2f8190)[_0x70b5('0x27')](function(_0x97018e){var _0x15a120=_[_0x70b5('0xa2')](_0x97018e,_0x70b5('0xa3'));var _0x2940bf=[];_0x49d2b6[_0x70b5('0x70')](function(_0x474f5a){_0x2940bf['push'](updateOpenchannelInteraction(_0x474f5a,_0x3eb693,_0x15a120));});return BPromise['all'](_0x2940bf);});});})['then'](function(_0x3565b6){_0x2ab08e[_0x70b5('0xa4')]=_0x3565b6;return _0x2ab08e;})[_0x70b5('0x27')](respondWithFilteredResult(_0x4ccfc4,_0x4fda78));})[_0x70b5('0x32')](handleError(_0x4ccfc4,null));};exports[_0x70b5('0xa5')]=function(_0x50fab2,_0x4cc2a3){var _0x34817a={'raw':![],'where':{'id':_0x50fab2[_0x70b5('0xa6')]['id']}},_0x96ee63={};_0x96ee63[_0x70b5('0x38')]=_[_0x70b5('0xa7')](db['OpenchannelInteraction'][_0x70b5('0xa8')]);_0x96ee63[_0x70b5('0x39')]=_[_0x70b5('0xa7')](_0x50fab2['query']);_0x96ee63['filters']=_[_0x70b5('0x3b')](_0x96ee63[_0x70b5('0x38')],_0x96ee63[_0x70b5('0x39')]);_0x34817a[_0x70b5('0x3c')]=_[_0x70b5('0x3b')](_0x96ee63['model'],qs[_0x70b5('0x3d')](_0x50fab2[_0x70b5('0x39')][_0x70b5('0x3d')]));_0x34817a[_0x70b5('0x3c')]=_0x34817a[_0x70b5('0x3c')][_0x70b5('0x3e')]?_0x34817a[_0x70b5('0x3c')]:_0x96ee63[_0x70b5('0x38')];if(_0x50fab2[_0x70b5('0x39')][_0x70b5('0xa9')]){_0x34817a[_0x70b5('0xaa')]=[{'all':!![]}];}_0x34817a=_[_0x70b5('0x90')]({},_0x34817a,_0x50fab2['options']);return db[_0x70b5('0x34')]['find'](_0x34817a)[_0x70b5('0x27')](handleEntityNotFound(_0x4cc2a3,null))[_0x70b5('0x27')](respondWithResult(_0x4cc2a3,null))[_0x70b5('0x32')](handleError(_0x4cc2a3,null));};exports[_0x70b5('0xab')]=function(_0x885451,_0x40ebaf){return db[_0x70b5('0x34')][_0x70b5('0xab')](_0x885451[_0x70b5('0x6e')],{})[_0x70b5('0x27')](respondWithResult(_0x40ebaf,0xc9))['catch'](handleError(_0x40ebaf,null));};exports[_0x70b5('0x26')]=function(_0x358136,_0x381af4){if(_0x358136['body']['id']){delete _0x358136['body']['id'];}return db[_0x70b5('0x34')][_0x70b5('0x5a')]({'where':{'id':_0x358136[_0x70b5('0xa6')]['id']}})[_0x70b5('0x27')](handleEntityNotFound(_0x381af4,null))[_0x70b5('0x27')](saveUpdates(_0x358136[_0x70b5('0x6e')],null))['then'](respondWithResult(_0x381af4,null))[_0x70b5('0x32')](handleError(_0x381af4,null));};exports[_0x70b5('0x28')]=function(_0x22db81,_0x49e22b){return db['OpenchannelInteraction'][_0x70b5('0x5a')]({'where':{'id':_0x22db81['params']['id']}})['then'](handleEntityNotFound(_0x49e22b,null))[_0x70b5('0x27')](removeEntity(_0x49e22b,null))[_0x70b5('0x32')](handleError(_0x49e22b,null));};exports[_0x70b5('0xac')]=function(_0x4c8936,_0x496db0){return db['OpenchannelInteraction'][_0x70b5('0xac')]()[_0x70b5('0x27')](respondWithResult(_0x496db0,null))[_0x70b5('0x32')](handleError(_0x496db0,null));};exports[_0x70b5('0xad')]=function(_0x335239,_0x3a2f94,_0x163d5f){return db[_0x70b5('0xae')]['find']({'where':{'id':_0x335239[_0x70b5('0xa6')]['id']}})[_0x70b5('0x27')](handleEntityNotFound(_0x3a2f94,null))[_0x70b5('0x27')](function(_0x319c98){if(_0x319c98){return _0x319c98[_0x70b5('0xad')](_0x335239['body'][_0x70b5('0xaf')],_[_0x70b5('0xb0')](_0x335239['body'],[_0x70b5('0xaf'),'id'])||{});}})[_0x70b5('0x27')](respondWithResult(_0x3a2f94,null))[_0x70b5('0x32')](handleError(_0x3a2f94,null));};exports[_0x70b5('0xb1')]=function(_0xf84525,_0x158fdf,_0x2ef971){var _0x35ee9a={'raw':![],'where':{}};var _0x1ed91f={};var _0x5d8d07={'count':0x0,'rows':[]};return db[_0x70b5('0x34')]['findOne']({'where':{'id':_0xf84525[_0x70b5('0xa6')]['id']}})[_0x70b5('0x27')](handleEntityNotFound(_0x158fdf,null))[_0x70b5('0x27')](function(_0x14b010){if(_0x14b010){_0x1ed91f[_0x70b5('0x38')]=_[_0x70b5('0xa7')](db['OpenchannelMessage'][_0x70b5('0xa8')]);_0x1ed91f[_0x70b5('0x39')]=_[_0x70b5('0xa7')](_0xf84525['query']);_0x1ed91f[_0x70b5('0x3a')]=_['intersection'](_0x1ed91f[_0x70b5('0x38')],_0x1ed91f[_0x70b5('0x39')]);_0x35ee9a[_0x70b5('0x3c')]=_['intersection'](_0x1ed91f['model'],qs[_0x70b5('0x3d')](_0xf84525['query'][_0x70b5('0x3d')]));_0x35ee9a[_0x70b5('0x3c')]=_0x35ee9a[_0x70b5('0x3c')]['length']?_0x35ee9a['attributes']:_0x1ed91f[_0x70b5('0x38')];if(!_0xf84525['query'][_0x70b5('0x3f')]('nolimit')){_0x35ee9a[_0x70b5('0x22')]=qs['limit'](_0xf84525[_0x70b5('0x39')]['limit']);_0x35ee9a[_0x70b5('0x21')]=qs[_0x70b5('0x21')](_0xf84525[_0x70b5('0x39')][_0x70b5('0x21')]);}_0x35ee9a[_0x70b5('0x41')]=qs[_0x70b5('0x42')](_0xf84525['query'][_0x70b5('0x42')]);_0x35ee9a[_0x70b5('0x43')]=qs[_0x70b5('0x3a')](_[_0x70b5('0xb2')](_0xf84525[_0x70b5('0x39')],_0x1ed91f[_0x70b5('0x3a')]));_0x35ee9a['where'][_0x70b5('0xa3')]=_0x14b010['id'];if(_0xf84525[_0x70b5('0x39')][_0x70b5('0x7c')]){_0x35ee9a[_0x70b5('0x43')]=_[_0x70b5('0x90')](_0x35ee9a['where'],{'$or':_[_0x70b5('0x2d')](_0x35ee9a['attributes'],function(_0x5c5ee3){var _0xc047c1={};_0xc047c1[_0x5c5ee3]={'$like':'%'+_0xf84525[_0x70b5('0x39')][_0x70b5('0x7c')]+'%'};return _0xc047c1;})});}if(_0xf84525[_0x70b5('0x39')]['$gte']){var _0x552e6b=_0xf84525['query']['$gte'][_0x70b5('0x2f')](',');var _0x2621d2={};_0x2621d2[_0x552e6b[0x0]]={'$gte':moment(_0x552e6b[0x1])[_0x70b5('0xb3')](_0x70b5('0xb4'))};_0x35ee9a[_0x70b5('0x43')]=_[_0x70b5('0x90')](_0x35ee9a[_0x70b5('0x43')],_0x2621d2);}_0x35ee9a=_[_0x70b5('0x90')]({},_0x35ee9a,_0xf84525[_0x70b5('0xb5')]);return db['OpenchannelMessage'][_0x70b5('0x20')]({'where':_0x35ee9a[_0x70b5('0x43')]})[_0x70b5('0x27')](function(_0x1c081e){_0x5d8d07[_0x70b5('0x20')]=_0x1c081e;if(_0xf84525['query'][_0x70b5('0xa9')]){_0x35ee9a[_0x70b5('0xaa')]=[{'all':!![]}];}return db[_0x70b5('0xae')][_0x70b5('0xb6')](_0x35ee9a);})[_0x70b5('0x27')](function(_0x3fe574){_0x5d8d07['rows']=_0x3fe574;return _0x5d8d07;});}})[_0x70b5('0x27')](respondWithFilteredResult(_0x158fdf,_0x35ee9a))[_0x70b5('0x32')](handleError(_0x158fdf,null));};exports[_0x70b5('0xb7')]=function(_0x46dd2b,_0x2d6a7e,_0xbd29ca){return db[_0x70b5('0x34')]['find']({'where':{'id':_0x46dd2b[_0x70b5('0xa6')]['id']}})[_0x70b5('0x27')](handleEntityNotFound(_0x2d6a7e,null))[_0x70b5('0x27')](function(_0x4c7290){if(_0x4c7290){return _0x4c7290[_0x70b5('0xb8')](_0x46dd2b[_0x70b5('0x6e')]['ids'],_[_0x70b5('0xb0')](_0x46dd2b['body'],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x70b5('0xb6')]({'attributes':['id',_0x70b5('0x2b'),_0x70b5('0xb9')],'where':{'id':_0x46dd2b['body'][_0x70b5('0xaf')]}});})[_0x70b5('0x27')](function(_0x1494bb){socket[_0x70b5('0xba')](_0x70b5('0xbb'),{'id':Number(_0x46dd2b[_0x70b5('0xa6')]['id']),'tags':_0x1494bb||[]});return{'id':Number(_0x46dd2b[_0x70b5('0xa6')]['id']),'tags':_0x1494bb||[]};});}})[_0x70b5('0x27')](respondWithResult(_0x2d6a7e,null))['catch'](handleError(_0x2d6a7e,null));};exports['removeTags']=function(_0x26183e,_0x3a0989,_0x53a8f7){return db[_0x70b5('0x34')][_0x70b5('0x5a')]({'where':{'id':_0x26183e['params']['id']}})[_0x70b5('0x27')](handleEntityNotFound(_0x3a0989,null))[_0x70b5('0x27')](function(_0x5df801){if(_0x5df801){return _0x5df801[_0x70b5('0xbc')](_0x26183e[_0x70b5('0x39')][_0x70b5('0xaf')]);}})[_0x70b5('0x27')](respondWithStatusCode(_0x3a0989,null))[_0x70b5('0x32')](handleError(_0x3a0989,null));};exports[_0x70b5('0xbd')]=function(_0x348dbd,_0x199d31){var _0x32aa6d=moment()['unix']()[_0x70b5('0x8e')]();var _0x29ece7=path['join'](config[_0x70b5('0xbe')],_0x70b5('0xbf'),'files',_0x70b5('0xc0'));var _0x36ef74=path['join'](config[_0x70b5('0xbe')],_0x70b5('0xbf'),_0x70b5('0xc1'),_0x70b5('0xc2'));var _0x5accf5=path[_0x70b5('0xc3')](_0x29ece7,_0x32aa6d);var _0x2582d0=util[_0x70b5('0xb3')](_0x70b5('0xc4'),_0x348dbd[_0x70b5('0xa6')]['id'],_0x32aa6d);var _0x26ecb7=path['join'](_0x29ece7,_0x2582d0);var _0x364228=[];_0x364228[_0x70b5('0x31')]({'model':db[_0x70b5('0x6b')],'as':_0x70b5('0x6b'),'attributes':['id',_0x70b5('0x2e')],'raw':!![]});_0x364228[_0x70b5('0x31')]({'model':db['CmContact'],'as':_0x70b5('0x5f'),'attributes':['id',_0x70b5('0xc5'),_0x70b5('0xc6')],'raw':!![]});if(_0x348dbd[_0x70b5('0x39')][_0x70b5('0xc2')]){_0x364228[_0x70b5('0x31')]({'model':db[_0x70b5('0xc7')],'as':'Attachment','raw':!![]});}var _0x249141=[{'model':db[_0x70b5('0xae')],'as':_0x70b5('0xc8'),'attributes':['id',_0x70b5('0x6e'),'createdAt',_0x70b5('0xc9'),'secret','read'],'include':_0x364228}];_0x249141[_0x70b5('0x31')]({'model':db[_0x70b5('0xca')],'as':'Account','attributes':['id',_0x70b5('0x2b')]});_0x249141['push']({'model':db[_0x70b5('0x6b')],'as':'Owner','attributes':['id',_0x70b5('0x2e')]});return db['OpenchannelInteraction'][_0x70b5('0x5a')]({'where':{'id':_0x348dbd[_0x70b5('0xa6')]['id']},'include':_0x249141})[_0x70b5('0x27')](handleEntityNotFound(_0x199d31,null))[_0x70b5('0x27')](function(_0x4823a7){if(_0x4823a7){var _0x19055d=_0x4823a7[_0x70b5('0xcb')]({'plain':!![]});fs[_0x70b5('0xcc')](_0x5accf5);var _0x42fb83={'format':'A4','border':_0x70b5('0xcd'),'header':{'height':_0x70b5('0xce'),'contents':{'first':_0x70b5('0xcf')}},'footer':{'height':_0x70b5('0xd0'),'contents':{'default':util['format'](_0x70b5('0xd1'),util[_0x70b5('0xb3')](_0x70b5('0xd2'),_0x70b5('0xd3'),_0x19055d['id']),moment()[_0x70b5('0xb3')](_0x70b5('0xd4'))[_0x70b5('0x8e')]())}}};var _0x1300be={'channel':_0x70b5('0xd3'),'account':_0x19055d[_0x70b5('0xd5')][_0x70b5('0x2b')],'agent':_0x19055d[_0x70b5('0xd6')]?_0x19055d['Owner'][_0x70b5('0x2e')]:'N.A.','createdAt':moment(_0x19055d[_0x70b5('0xd7')])['format'](_0x70b5('0xb4'))['toString'](),'closedAt':_0x19055d[_0x70b5('0xd8')]?moment(_0x19055d[_0x70b5('0xd9')])[_0x70b5('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x70b5('0x8e')]():'','disposition':_0x19055d[_0x70b5('0xda')],'visibility':_0x19055d[_0x70b5('0xdb')]?_0x70b5('0xdc'):_0x70b5('0xdd'),'messages':_(_0x19055d[_0x70b5('0xc8')])['filter']({'secret':![]})[_0x70b5('0x2d')](function(_0x110cb4){if(_0x110cb4[_0x70b5('0xc7')]){var _0x772f93=path[_0x70b5('0xc3')](_0x36ef74,_0x110cb4[_0x70b5('0xc7')][_0x70b5('0xde')]);if(fs[_0x70b5('0xdf')](_0x772f93)){fs[_0x70b5('0xe0')](_0x772f93)['pipe'](fs[_0x70b5('0xe1')](path[_0x70b5('0xc3')](_0x5accf5,_0x110cb4['Attachment'][_0x70b5('0xde')])));}}return{'date':moment(_0x110cb4[_0x70b5('0xd7')])[_0x70b5('0xb3')](_0x70b5('0xb4'))[_0x70b5('0x8e')](),'sender':_0x110cb4[_0x70b5('0xc9')]===_0x70b5('0xe2')?_0x110cb4[_0x70b5('0x6b')]?_0x110cb4['User'][_0x70b5('0x2e')]:_0x70b5('0xe3'):_0x110cb4['Contact'][_0x70b5('0xc5')]+(_0x110cb4['Contact']['lastName']?'\x20'+_0x110cb4['Contact']['lastName']:''),'body':_0x110cb4[_0x70b5('0xc7')]?_0x110cb4[_0x70b5('0xc7')][_0x70b5('0xde')]:_0x110cb4['body'],'direction':_0x110cb4[_0x70b5('0xc9')]===_0x70b5('0xe2')?'A':'C','secret':_0x110cb4[_0x70b5('0xe4')],'read':_0x110cb4[_0x70b5('0x78')],'attachment':_0x110cb4['Attachment']};})[_0x70b5('0x5c')]()};return ejs[_0x70b5('0xe5')](path[_0x70b5('0xc3')](config[_0x70b5('0xbe')],_0x70b5('0xbf'),'views','downloadInteraction.html'),{'interaction':_0x1300be})[_0x70b5('0x27')](function(_0x39c060){return new BPromise(function(_0x112ff6,_0x36f6f9){pdf[_0x70b5('0xab')](_0x39c060,_0x42fb83)['toFile'](path[_0x70b5('0xc3')](_0x5accf5,_0x70b5('0xe6')+_0x19055d['id']+'-'+_0x32aa6d+_0x70b5('0xe7')),function(_0x461f24,_0x440317){if(_0x461f24)return _0x36f6f9(_0x461f24);_0x112ff6(_0x440317);});});})['then'](function(){return new BPromise(function(_0x468323,_0x2d5c9d){zipdir(_0x5accf5,{'saveTo':_0x26ecb7},function(_0x371aa1,_0xbdb9b9){if(_0x371aa1)return _0x2d5c9d(_0x371aa1);return _0x468323(_0xbdb9b9);});})['then'](function(){return new BPromise(function(_0x565510,_0x4da4cb){rimraf(_0x5accf5,function(_0x26d938){if(_0x26d938)_0x4da4cb(_0x26d938);return _0x565510();});});})[_0x70b5('0x27')](function(){return _0x199d31[_0x70b5('0xbd')](_0x26ecb7,_0x2582d0,function(_0x19fc53){if(_0x19fc53){console['log'](_0x70b5('0xe8'),_0x19fc53);}else{fs[_0x70b5('0xe9')](_0x26ecb7);}});});});}else{return _0x199d31[_0x70b5('0x1c')](0xc8);}})[_0x70b5('0x32')](handleError(_0x199d31,null));}; \ No newline at end of file +var _0x941d=['compact','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','QueryTypes','clone','DESC','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','OpenchannelInteractionId','all','show','include','options','create','update','params','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','addTags','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','push','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','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','Openchannel','N.A.','closed','closedAt','disposition','threadId','Private','pipe','basename','out','System','renderFile','transcript-','.pdf','err','unlinkSync','sendStatus','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','status','json','count','offset','limit','set','apply','then','destroy','end','error','name','send','Users','map','fullname','Tags','TagIds','split','forEach','catch','index','OpenchannelInteraction','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','field','color','from','tools_tags','select','u.id','u.fullname','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','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','length','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','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x941d,0x15a));var _0xd941=function(_0x3e0fab,_0x285e29){_0x3e0fab=_0x3e0fab-0x0;var _0x36cde8=_0x941d[_0x3e0fab];return _0x36cde8;};'use strict';var pdf=require(_0xd941('0x0'));var emlformat=require(_0xd941('0x1'));var rimraf=require(_0xd941('0x2'));var zipdir=require(_0xd941('0x3'));var jsonpatch=require(_0xd941('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd941('0x5'));var Mustache=require('mustache');var util=require(_0xd941('0x6'));var path=require(_0xd941('0x7'));var sox=require(_0xd941('0x8'));var csv=require(_0xd941('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd941('0xa'));var squel=require(_0xd941('0xb'));var crypto=require(_0xd941('0xc'));var jsforce=require(_0xd941('0xd'));var deskjs=require(_0xd941('0xe'));var toCsv=require(_0xd941('0x9'));var querystring=require(_0xd941('0xf'));var Papa=require('papaparse');var Redis=require(_0xd941('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd941('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd941('0x12'));var logger=require(_0xd941('0x13'))(_0xd941('0x14'));var utils=require('../../config/utils');var config=require(_0xd941('0x15'));var db=require(_0xd941('0x16'))['db'];config[_0xd941('0x17')]=_[_0xd941('0x18')](config[_0xd941('0x17')],{'host':_0xd941('0x19'),'port':0x18eb});var socket=require(_0xd941('0x1a'))(new Redis(config[_0xd941('0x17')]));require(_0xd941('0x1b'))['register'](socket);function respondWithStatusCode(_0x1ca564,_0x6672f7){_0x6672f7=_0x6672f7||0xcc;return function(_0x410a8e){if(_0x410a8e){return _0x1ca564['sendStatus'](_0x6672f7);}return _0x1ca564[_0xd941('0x1c')](_0x6672f7)['end']();};}function respondWithResult(_0x9e5a29,_0x505d71){_0x505d71=_0x505d71||0xc8;return function(_0x254d48){if(_0x254d48){return _0x9e5a29[_0xd941('0x1c')](_0x505d71)[_0xd941('0x1d')](_0x254d48);}};}function respondWithFilteredResult(_0x1f8066,_0x258296){return function(_0x349426){if(_0x349426){var _0x2a8a5c=_0x349426[_0xd941('0x1e')],_0x2dba34=_0x258296['offset'],_0x4082ac=_0x258296[_0xd941('0x1f')]+_0x258296[_0xd941('0x20')],_0x554ea8;if(_0x4082ac>=_0x2a8a5c){_0x4082ac=_0x2a8a5c;_0x554ea8=0xc8;}else{_0x554ea8=0xce;}_0x1f8066[_0xd941('0x1c')](_0x554ea8);return _0x1f8066[_0xd941('0x21')]('Content-Range',_0x2dba34+'-'+_0x4082ac+'/'+_0x2a8a5c)[_0xd941('0x1d')](_0x349426);}return null;};}function patchUpdates(_0x5aa289){return function(_0x4c3d0e){try{jsonpatch[_0xd941('0x22')](_0x4c3d0e,_0x5aa289,!![]);}catch(_0x5910f1){return BPromise['reject'](_0x5910f1);}return _0x4c3d0e['save']();};}function saveUpdates(_0x1898eb,_0x59521e){return function(_0x16dd1d){if(_0x16dd1d){return _0x16dd1d['update'](_0x1898eb)[_0xd941('0x23')](function(_0x2a8997){return _0x2a8997;});}return null;};}function removeEntity(_0x3dbbd3,_0x30d092){return function(_0x41ee65){if(_0x41ee65){return _0x41ee65[_0xd941('0x24')]()[_0xd941('0x23')](function(){_0x3dbbd3['status'](0xcc)[_0xd941('0x25')]();});}};}function handleEntityNotFound(_0x49b955,_0xa557cf){return function(_0x1dbf98){if(!_0x1dbf98){_0x49b955['sendStatus'](0x194);}return _0x1dbf98;};}function handleError(_0x5dbebb,_0x21df8e){_0x21df8e=_0x21df8e||0x1f4;return function(_0x21993c){logger[_0xd941('0x26')](_0x21993c['stack']);if(_0x21993c[_0xd941('0x27')]){delete _0x21993c['name'];}_0x5dbebb['status'](_0x21df8e)[_0xd941('0x28')](_0x21993c);};}function getInteractionUsers(_0x4b5b73,_0x310433){return new BPromise(function(_0x24e2a6,_0x574915){try{if(_0x310433[_0x4b5b73['id']]){_0x4b5b73[_0xd941('0x29')]=_[_0xd941('0x2a')](_0x310433[_0x4b5b73['id']],function(_0x167e9f){return{'id':_0x167e9f['id'],'fullname':_0x167e9f[_0xd941('0x2b')]};});}}catch(_0x329122){_0x574915(_0x329122);}_0x24e2a6(_0x4b5b73);});}function getInteractionTags(_0x26b00d,_0x7f3232){return new BPromise(function(_0x5403f0,_0x52c2d9){try{if(_0x26b00d['TagIds']){_0x26b00d[_0xd941('0x2c')]=[];_0x26b00d[_0xd941('0x2d')][_0xd941('0x2e')](',')[_0xd941('0x2f')](function(_0x15ff40){_0x26b00d[_0xd941('0x2c')]['push'](_0x7f3232[_0x15ff40]);});}delete _0x26b00d['TagIds'];}catch(_0x3c9263){_0x52c2d9(_0x3c9263);}_0x5403f0(_0x26b00d);});}function updateOpenchannelInteraction(_0x3ea8df,_0x44d1ca,_0xdf825){return new BPromise(function(_0x16f528,_0x4eb3f8){return getInteractionUsers(_0x3ea8df,_0xdf825)[_0xd941('0x23')](function(_0x37be92){return getInteractionTags(_0x37be92,_0x44d1ca);})[_0xd941('0x23')](function(_0x4a5de9){_0x16f528(_0x4a5de9);})[_0xd941('0x30')](function(_0x5ab7e9){_0x4eb3f8(_0x5ab7e9);});});}exports[_0xd941('0x31')]=function(_0x57b6b4,_0x4f0ed2){var _0x1b129a={},_0x4532a0={},_0x645e70={'count':0x0,'rows':[]};var _0x1dc578=_['map'](db[_0xd941('0x32')][_0xd941('0x33')],function(_0x4b2bfc){return{'name':_0x4b2bfc['fieldName'],'type':_0x4b2bfc['type'][_0xd941('0x34')]};});_0x4532a0['model']=_[_0xd941('0x2a')](_0x1dc578,_0xd941('0x27'));_0x4532a0[_0xd941('0x35')]=_[_0xd941('0x36')](_0x57b6b4['query']);_0x4532a0[_0xd941('0x37')]=_[_0xd941('0x38')](_0x4532a0[_0xd941('0x39')],_0x4532a0[_0xd941('0x35')]);_0x1b129a[_0xd941('0x3a')]=_[_0xd941('0x38')](_0x4532a0[_0xd941('0x39')],qs[_0xd941('0x3b')](_0x57b6b4['query']['fields']));_0x1b129a['attributes']=_0x1b129a[_0xd941('0x3a')]['length']?_0x1b129a[_0xd941('0x3a')]:_0x4532a0[_0xd941('0x39')];if(!_0x57b6b4[_0xd941('0x35')][_0xd941('0x3c')](_0xd941('0x3d'))){_0x1b129a['limit']=qs['limit'](_0x57b6b4['query'][_0xd941('0x20')]);_0x1b129a['offset']=qs['offset'](_0x57b6b4[_0xd941('0x35')][_0xd941('0x1f')]);}_0x1b129a[_0xd941('0x3e')]=qs[_0xd941('0x3f')](_0x57b6b4[_0xd941('0x35')][_0xd941('0x3f')]);_0x1b129a[_0xd941('0x40')]=qs['filters'](_['pick'](_0x57b6b4['query'],_0x4532a0[_0xd941('0x37')]));var _0x4ba1bc=[];var _0x389238=squel['select']()['field']('id')[_0xd941('0x41')](_0xd941('0x27'))[_0xd941('0x41')](_0xd941('0x42'))[_0xd941('0x43')](_0xd941('0x44'));var _0x1ccc50=squel[_0xd941('0x45')]()[_0xd941('0x41')](_0xd941('0x46'))[_0xd941('0x41')](_0xd941('0x47'))['field']('ui.OpenchannelInteractionId')[_0xd941('0x43')](_0xd941('0x48'),'ui')[_0xd941('0x49')](_0xd941('0x4a'),'u',_0xd941('0x4b'));var _0x454246=squel[_0xd941('0x45')]()[_0xd941('0x43')](_0xd941('0x4c'),'i')[_0xd941('0x49')](_0xd941('0x4d'),'c',_0xd941('0x4e'))['left_join'](_0xd941('0x4a'),'o',_0xd941('0x4f'))[_0xd941('0x49')](_0xd941('0x50'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xd941('0x49')](_0xd941('0x51'),'me','me.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0xd941('0x52'),'it',_0xd941('0x53'))[_0xd941('0x49')](_0xd941('0x44'),'t','t.id\x20=\x20it.TagId');var _0x5f5c43=squel[_0xd941('0x54')]();var _0x49a573=[];var _0x4990c4=squel[_0xd941('0x54')]();var _0x561894;if(_0x57b6b4[_0xd941('0x35')][_0xd941('0x55')]){_0x561894=as[_0xd941('0x56')](_0x57b6b4[_0xd941('0x35')][_0xd941('0x55')]);var _0x30bad7=_0x561894[_0xd941('0x57')];for(var _0x542852=0x0;_0x542852<_0x561894[_0xd941('0x58')][_0xd941('0x59')];_0x542852++){var _0x41b8a4=_0x561894['conditions'][_0x542852];var _0x64afd6='i';var _0x38304b=_[_0xd941('0x5a')](_0x1dc578,[_0xd941('0x27'),_0x41b8a4[_0xd941('0x41')]]);if(!_0x38304b){switch(_0x41b8a4[_0xd941('0x41')]){case _0xd941('0x5b'):if(_0x41b8a4[_0xd941('0x5c')]==0x1){_0x454246[_0xd941('0x5d')]('`'+_0x41b8a4[_0xd941('0x41')]+_0xd941('0x5e'));}else{_0x454246[_0xd941('0x5d')]('`'+_0x41b8a4[_0xd941('0x41')]+_0xd941('0x5f'));}break;case _0xd941('0x60'):if(_0x41b8a4['operator']===_0xd941('0x61')){if(_0x41b8a4['value'][_0xd941('0x2e')]('\x20')[_0xd941('0x59')]>0x1){_0x5f5c43[_0x30bad7](_0xd941('0x62'),qs[_0xd941('0x63')](_0x41b8a4[_0xd941('0x5c')]),null);}else{var _0x138215='%'+_0x41b8a4['value']+'%';_0x5f5c43[_0x30bad7](_0xd941('0x64'),_0x138215,_0x138215,_0x138215);}}else{_0x38304b=_['find'](_0x1dc578,[_0xd941('0x27'),'ContactId']);_0x41b8a4[_0xd941('0x41')]=_0xd941('0x65');_0x11cdfe=as[_0xd941('0x66')](_0x64afd6,_0x38304b[_0xd941('0x67')],_0x41b8a4);_0x5f5c43[_0x30bad7](_0x11cdfe[_0xd941('0x68')],_0x11cdfe['value'][_0xd941('0x69')],_0x11cdfe[_0xd941('0x5c')][_0xd941('0x25')]);}break;case _0xd941('0x6a'):var _0x166576=_0x41b8a4[_0xd941('0x5c')][_0xd941('0x2e')](',')[_0xd941('0x2a')](function(_0x16de8c){return Number(_0x16de8c);});_0x166576[_0xd941('0x2f')](function(_0x4e194d){_0x4990c4['or'](_0xd941('0x6b'),'%,'+_0x4e194d+',%');});_0x49a573=_[_0xd941('0x6c')](_0x49a573,_0x166576);break;case _0xd941('0x6d'):if(_0x41b8a4[_0xd941('0x6e')]===_0xd941('0x61')){_0x5f5c43[_0x30bad7](_0xd941('0x6f'),'%'+_0x41b8a4[_0xd941('0x5c')]+'%',null);}else{_0x38304b=_[_0xd941('0x5a')](_0x1dc578,[_0xd941('0x27'),_0xd941('0x70')]);_0x41b8a4[_0xd941('0x41')]=_0xd941('0x70');_0x11cdfe=as[_0xd941('0x66')](_0x64afd6,_0x38304b[_0xd941('0x67')],_0x41b8a4);_0x5f5c43[_0x30bad7](_0x11cdfe[_0xd941('0x68')],_0x11cdfe['value'][_0xd941('0x69')],_0x11cdfe['value'][_0xd941('0x25')]);}break;case _0xd941('0x71'):_0x11cdfe=as[_0xd941('0x66')]('me',null,_0x41b8a4);_0x5f5c43[_0x30bad7](_0x11cdfe[_0xd941('0x68')],_0x11cdfe[_0xd941('0x5c')]['start'],_0x11cdfe[_0xd941('0x5c')][_0xd941('0x25')]);break;}}else{var _0x11cdfe=as[_0xd941('0x66')](_0x64afd6,_0x38304b[_0xd941('0x67')],_0x41b8a4);_0x5f5c43[_0x30bad7](_0x11cdfe['text'],_0x11cdfe['value'][_0xd941('0x69')],_0x11cdfe[_0xd941('0x5c')][_0xd941('0x25')]);}}}else{var _0x33371b=_(_0x57b6b4['query'])['keys']()[_0xd941('0x2a')](function(_0x2978d7){return _['some'](_0x1dc578,[_0xd941('0x27'),_0x2978d7])?_0x2978d7:undefined;})[_0xd941('0x72')]()[_0xd941('0x5c')]();if(!_[_0xd941('0x73')](_0x33371b)){_0x33371b[_0xd941('0x2f')](function(_0x1e76ed){if(_0x1e76ed===_0xd941('0x74')){_0x454246['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0xd941('0x75')](_0x57b6b4['query'][_0x1e76ed]));}else if(_0x1e76ed===_0xd941('0x76')){var _0x24be97=JSON[_0xd941('0x77')](_0x57b6b4[_0xd941('0x35')][_0x1e76ed])['$gte'];var _0x45e58b=JSON['parse'](_0x57b6b4[_0xd941('0x35')][_0x1e76ed])[_0xd941('0x78')];_0x454246[_0xd941('0x40')](_0xd941('0x79'),_0x24be97,_0x45e58b);}else{if(_0x57b6b4[_0xd941('0x35')][_0x1e76ed]===_0xd941('0x7a')){_0x454246['where']('i.'+_0x1e76ed+_0xd941('0x7b'));}else{_0x454246['where']('i.'+_0x1e76ed+'\x20=\x20?',_0x57b6b4['query'][_0x1e76ed]);}}});}if(_0x57b6b4['query']['read']){if(_0x57b6b4['query'][_0xd941('0x7c')]==0x1){_0x454246[_0xd941('0x5d')](_0xd941('0x7d'));}else{_0x454246[_0xd941('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x57b6b4[_0xd941('0x35')][_0xd941('0x7e')]){_0x49a573=_[_0xd941('0x7f')](_0x57b6b4['query']['tag'])?_0x57b6b4[_0xd941('0x35')][_0xd941('0x7e')]:new Array(_0x57b6b4[_0xd941('0x35')]['tag']);_0x49a573[_0xd941('0x2f')](function(_0x6d8078){_0x4990c4['or'](_0xd941('0x6b'),'%,'+_0x6d8078+',%');});}if(_0x57b6b4[_0xd941('0x35')][_0xd941('0x80')]){var _0x13dc6e=_0x57b6b4[_0xd941('0x35')]['filter'][_0xd941('0x81')]('\x5c','\x5c\x5c')[_0xd941('0x81')]('\x27\x27',_0xd941('0x82'));if(qs['isNumeric'](_0x13dc6e)){_0x5f5c43['or']('i.id\x20LIKE\x20?',_0x13dc6e+'%');}else{_0x5f5c43['or'](_0xd941('0x83'),qs[_0xd941('0x63')](_0x13dc6e))['or'](_0xd941('0x84'),_0x13dc6e+'%')['or'](_0xd941('0x85'),_0x13dc6e+'%');}}}_0x454246[_0xd941('0x40')](_0x5f5c43);_0x454246['group']('i.id');var _0x2283e4={'type':db['Sequelize'][_0xd941('0x86')]['SELECT'],'raw':!![]};var _0x610d77=_0x454246[_0xd941('0x87')]();_0x610d77[_0xd941('0x41')]('i.id');_0x610d77['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd941('0x5b'));if(_0x1b129a[_0xd941('0x3e')]){_0x1b129a[_0xd941('0x3e')][_0xd941('0x2f')](function(_0x5a748f){_0x454246['order']('i.'+_0x5a748f[0x0],_0x5a748f[0x1]===_0xd941('0x88')?![]:!![]);});}if(!_[_0xd941('0x73')](_0x49a573)){_0x454246[_0xd941('0x5d')](_0x4990c4);_0x610d77[_0xd941('0x40')](_0xd941('0x89'),_0x49a573);}BPromise[_0xd941('0x8a')]()['then'](function(){if(!_0x561894){if(_0x57b6b4['query']['OpenchannelAccountId']||_0x57b6b4[_0xd941('0x35')][_0xd941('0x8b')])return;_0x610d77[_0xd941('0x40')](_0xd941('0x8c'));_0x454246[_0xd941('0x40')](_0xd941('0x8c'));return;}return _0x57b6b4['user'][_0xd941('0x8d')]({'attributes':['id'],'raw':!![]})[_0xd941('0x23')](function(_0x2bcdd4){if(_[_0xd941('0x73')](_0x2bcdd4)){_0x610d77[_0xd941('0x40')](_0xd941('0x8e'));_0x454246['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x610d77[_0xd941('0x40')](_0xd941('0x8f'),_['map'](_0x2bcdd4,'id'));_0x454246[_0xd941('0x40')](_0xd941('0x8f'),_[_0xd941('0x2a')](_0x2bcdd4,'id'));}});})['then'](function(){db['sequelize'][_0xd941('0x35')](_0x610d77[_0xd941('0x90')](),_0x2283e4)['then'](function(_0x298e3c){_0x645e70[_0xd941('0x1e')]=_0x298e3c[_0xd941('0x59')];if(_0x645e70[_0xd941('0x1e')]===0x0)return[];return db[_0xd941('0x91')][_0xd941('0x35')](_0x389238[_0xd941('0x90')](),_0x2283e4)[_0xd941('0x23')](function(_0x421d69){_0x4ba1bc=_[_0xd941('0x92')](_0x421d69,'id');_0x2283e4=_[_0xd941('0x93')](_0x2283e4,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x57b6b4[_0xd941('0x35')]['fields']){_0x1b129a['attributes'][_0xd941('0x2f')](function(_0x30dd0a){_0x454246['field']('i.'+_0x30dd0a);});}else{_0x454246[_0xd941('0x41')](_0xd941('0x94'),_0xd941('0x5b'));_0x454246[_0xd941('0x41')](_0xd941('0x95'),_0xd941('0x96'));_0x454246['field'](_0xd941('0x97'),_0xd941('0x98'));_0x454246[_0xd941('0x41')](_0xd941('0x99'));_0x454246[_0xd941('0x41')]('c.firstName',_0xd941('0x9a'));_0x454246[_0xd941('0x41')]('c.lastName',_0xd941('0x9b'));_0x454246[_0xd941('0x41')]('c.email','Contact.email');_0x454246[_0xd941('0x41')](_0xd941('0x9c'),_0xd941('0x9d'));_0x454246[_0xd941('0x41')](_0xd941('0x9e'),_0xd941('0x9f'));_0x454246['field']('c.fax',_0xd941('0xa0'));_0x454246[_0xd941('0x41')]('o.fullname',_0xd941('0xa1'));_0x454246[_0xd941('0x41')]('o.internal','Owner.internal');_0x454246['field'](_0xd941('0xa2'),'TagIds');}_0x454246[_0xd941('0x20')](_0x1b129a[_0xd941('0x20')]);_0x454246[_0xd941('0x1f')](_0x1b129a[_0xd941('0x1f')]);return db['sequelize']['query'](_0x454246[_0xd941('0x90')](),_0x2283e4);})[_0xd941('0x23')](function(_0x32f1c7){_0x1ccc50[_0xd941('0x40')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xd941('0x2a')](_0x32f1c7,'id'));return db[_0xd941('0x91')]['query'](_0x1ccc50[_0xd941('0x90')](),_0x2283e4)[_0xd941('0x23')](function(_0x47ed7a){var _0x59b28c=_[_0xd941('0xa3')](_0x47ed7a,_0xd941('0xa4'));var _0x378128=[];_0x32f1c7['forEach'](function(_0x14e34a){_0x378128['push'](updateOpenchannelInteraction(_0x14e34a,_0x4ba1bc,_0x59b28c));});return BPromise[_0xd941('0xa5')](_0x378128);});});})['then'](function(_0x3acd03){_0x645e70['rows']=_0x3acd03;return _0x645e70;})[_0xd941('0x23')](respondWithFilteredResult(_0x4f0ed2,_0x1b129a));})[_0xd941('0x30')](handleError(_0x4f0ed2,null));};exports[_0xd941('0xa6')]=function(_0x1af6b8,_0x494d78){var _0xaeab83={'raw':![],'where':{'id':_0x1af6b8['params']['id']}},_0x1f1b37={};_0x1f1b37[_0xd941('0x39')]=_[_0xd941('0x36')](db[_0xd941('0x32')][_0xd941('0x33')]);_0x1f1b37[_0xd941('0x35')]=_[_0xd941('0x36')](_0x1af6b8[_0xd941('0x35')]);_0x1f1b37[_0xd941('0x37')]=_[_0xd941('0x38')](_0x1f1b37[_0xd941('0x39')],_0x1f1b37[_0xd941('0x35')]);_0xaeab83['attributes']=_[_0xd941('0x38')](_0x1f1b37[_0xd941('0x39')],qs[_0xd941('0x3b')](_0x1af6b8[_0xd941('0x35')][_0xd941('0x3b')]));_0xaeab83['attributes']=_0xaeab83[_0xd941('0x3a')][_0xd941('0x59')]?_0xaeab83[_0xd941('0x3a')]:_0x1f1b37['model'];if(_0x1af6b8['query']['includeAll']){_0xaeab83[_0xd941('0xa7')]=[{'all':!![]}];}_0xaeab83=_[_0xd941('0x93')]({},_0xaeab83,_0x1af6b8[_0xd941('0xa8')]);return db[_0xd941('0x32')][_0xd941('0x5a')](_0xaeab83)[_0xd941('0x23')](handleEntityNotFound(_0x494d78,null))[_0xd941('0x23')](respondWithResult(_0x494d78,null))['catch'](handleError(_0x494d78,null));};exports['create']=function(_0x2fe771,_0x13d237){return db[_0xd941('0x32')][_0xd941('0xa9')](_0x2fe771['body'],{})['then'](respondWithResult(_0x13d237,0xc9))[_0xd941('0x30')](handleError(_0x13d237,null));};exports[_0xd941('0xaa')]=function(_0x472d37,_0x5638bb){if(_0x472d37['body']['id']){delete _0x472d37['body']['id'];}return db[_0xd941('0x32')][_0xd941('0x5a')]({'where':{'id':_0x472d37['params']['id']}})[_0xd941('0x23')](handleEntityNotFound(_0x5638bb,null))[_0xd941('0x23')](saveUpdates(_0x472d37[_0xd941('0x71')],null))[_0xd941('0x23')](respondWithResult(_0x5638bb,null))[_0xd941('0x30')](handleError(_0x5638bb,null));};exports[_0xd941('0x24')]=function(_0x4bf3aa,_0x4c708c){return db[_0xd941('0x32')]['find']({'where':{'id':_0x4bf3aa[_0xd941('0xab')]['id']}})['then'](handleEntityNotFound(_0x4c708c,null))[_0xd941('0x23')](removeEntity(_0x4c708c,null))['catch'](handleError(_0x4c708c,null));};exports[_0xd941('0xac')]=function(_0x28293b,_0x16dada){return db[_0xd941('0x32')]['describe']()['then'](respondWithResult(_0x16dada,null))[_0xd941('0x30')](handleError(_0x16dada,null));};exports['addMessage']=function(_0x32c1a1,_0x432f37,_0x565dff){return db[_0xd941('0xad')][_0xd941('0x5a')]({'where':{'id':_0x32c1a1[_0xd941('0xab')]['id']}})['then'](handleEntityNotFound(_0x432f37,null))[_0xd941('0x23')](function(_0x1b44db){if(_0x1b44db){return _0x1b44db[_0xd941('0xae')](_0x32c1a1[_0xd941('0x71')][_0xd941('0xaf')],_[_0xd941('0xb0')](_0x32c1a1[_0xd941('0x71')],['ids','id'])||{});}})['then'](respondWithResult(_0x432f37,null))[_0xd941('0x30')](handleError(_0x432f37,null));};exports[_0xd941('0xb1')]=function(_0xfac110,_0x25c335,_0x182c14){var _0xbcb2b8={'raw':![],'where':{}};var _0x2c49a3={};var _0x3f8f8e={'count':0x0,'rows':[]};return db[_0xd941('0x32')][_0xd941('0xb2')]({'where':{'id':_0xfac110['params']['id']}})[_0xd941('0x23')](handleEntityNotFound(_0x25c335,null))[_0xd941('0x23')](function(_0x4bb8a4){if(_0x4bb8a4){_0x2c49a3[_0xd941('0x39')]=_['keys'](db[_0xd941('0xad')][_0xd941('0x33')]);_0x2c49a3['query']=_[_0xd941('0x36')](_0xfac110[_0xd941('0x35')]);_0x2c49a3['filters']=_[_0xd941('0x38')](_0x2c49a3[_0xd941('0x39')],_0x2c49a3[_0xd941('0x35')]);_0xbcb2b8['attributes']=_['intersection'](_0x2c49a3[_0xd941('0x39')],qs['fields'](_0xfac110[_0xd941('0x35')][_0xd941('0x3b')]));_0xbcb2b8[_0xd941('0x3a')]=_0xbcb2b8[_0xd941('0x3a')]['length']?_0xbcb2b8[_0xd941('0x3a')]:_0x2c49a3['model'];if(!_0xfac110[_0xd941('0x35')][_0xd941('0x3c')](_0xd941('0x3d'))){_0xbcb2b8['limit']=qs[_0xd941('0x20')](_0xfac110[_0xd941('0x35')]['limit']);_0xbcb2b8[_0xd941('0x1f')]=qs[_0xd941('0x1f')](_0xfac110['query'][_0xd941('0x1f')]);}_0xbcb2b8[_0xd941('0x3e')]=qs[_0xd941('0x3f')](_0xfac110['query']['sort']);_0xbcb2b8[_0xd941('0x40')]=qs['filters'](_['pick'](_0xfac110['query'],_0x2c49a3[_0xd941('0x37')]));_0xbcb2b8[_0xd941('0x40')][_0xd941('0xa4')]=_0x4bb8a4['id'];if(_0xfac110[_0xd941('0x35')][_0xd941('0x80')]){_0xbcb2b8[_0xd941('0x40')]=_[_0xd941('0x93')](_0xbcb2b8[_0xd941('0x40')],{'$or':_[_0xd941('0x2a')](_0xbcb2b8[_0xd941('0x3a')],function(_0x295c4e){var _0xacea7f={};_0xacea7f[_0x295c4e]={'$like':'%'+_0xfac110[_0xd941('0x35')][_0xd941('0x80')]+'%'};return _0xacea7f;})});}if(_0xfac110[_0xd941('0x35')][_0xd941('0xb3')]){var _0x124ab9=_0xfac110[_0xd941('0x35')][_0xd941('0xb3')][_0xd941('0x2e')](',');var _0x5e11c3={};_0x5e11c3[_0x124ab9[0x0]]={'$gte':moment(_0x124ab9[0x1])[_0xd941('0xb4')](_0xd941('0xb5'))};_0xbcb2b8['where']=_['merge'](_0xbcb2b8[_0xd941('0x40')],_0x5e11c3);}_0xbcb2b8=_[_0xd941('0x93')]({},_0xbcb2b8,_0xfac110[_0xd941('0xa8')]);return db[_0xd941('0xad')][_0xd941('0x1e')]({'where':_0xbcb2b8[_0xd941('0x40')]})[_0xd941('0x23')](function(_0x1432da){_0x3f8f8e[_0xd941('0x1e')]=_0x1432da;if(_0xfac110[_0xd941('0x35')][_0xd941('0xb6')]){_0xbcb2b8['include']=[{'all':!![]}];}return db[_0xd941('0xad')][_0xd941('0xb7')](_0xbcb2b8);})[_0xd941('0x23')](function(_0xbd808b){_0x3f8f8e[_0xd941('0xb8')]=_0xbd808b;return _0x3f8f8e;});}})[_0xd941('0x23')](respondWithFilteredResult(_0x25c335,_0xbcb2b8))[_0xd941('0x30')](handleError(_0x25c335,null));};exports[_0xd941('0xb9')]=function(_0x1340c3,_0x5b6f06,_0x4a2256){return db[_0xd941('0x32')][_0xd941('0x5a')]({'where':{'id':_0x1340c3[_0xd941('0xab')]['id']}})[_0xd941('0x23')](handleEntityNotFound(_0x5b6f06,null))['then'](function(_0x8a18a4){if(_0x8a18a4){return _0x8a18a4['setTags'](_0x1340c3['body']['ids'],_[_0xd941('0xb0')](_0x1340c3[_0xd941('0x71')],[_0xd941('0xaf'),'id'])||{})['spread'](function(){return db['Tag'][_0xd941('0xb7')]({'attributes':['id','name',_0xd941('0x42')],'where':{'id':_0x1340c3[_0xd941('0x71')]['ids']}});})[_0xd941('0x23')](function(_0x43ee0a){socket[_0xd941('0xba')](_0xd941('0xbb'),{'id':Number(_0x1340c3[_0xd941('0xab')]['id']),'tags':_0x43ee0a||[]});return{'id':Number(_0x1340c3[_0xd941('0xab')]['id']),'tags':_0x43ee0a||[]};});}})[_0xd941('0x23')](respondWithResult(_0x5b6f06,null))[_0xd941('0x30')](handleError(_0x5b6f06,null));};exports[_0xd941('0xbc')]=function(_0x6bfb67,_0x10cc9d,_0x27d1be){return db[_0xd941('0x32')][_0xd941('0x5a')]({'where':{'id':_0x6bfb67[_0xd941('0xab')]['id']}})['then'](handleEntityNotFound(_0x10cc9d,null))[_0xd941('0x23')](function(_0x8f2c1b){if(_0x8f2c1b){return _0x8f2c1b[_0xd941('0xbc')](_0x6bfb67[_0xd941('0x35')][_0xd941('0xaf')]);}})[_0xd941('0x23')](respondWithStatusCode(_0x10cc9d,null))[_0xd941('0x30')](handleError(_0x10cc9d,null));};exports[_0xd941('0xbd')]=function(_0xca3ebf,_0x1d437e){var _0xdcdf9d=moment()[_0xd941('0xbe')]()['toString']();var _0x4e7763=path['join'](config[_0xd941('0xbf')],_0xd941('0xc0'),'files',_0xd941('0xc1'));var _0x21d465=path[_0xd941('0xc2')](config[_0xd941('0xbf')],_0xd941('0xc0'),_0xd941('0xc3'),_0xd941('0xc4'));var _0x4ec27f=path[_0xd941('0xc2')](_0x4e7763,_0xdcdf9d);var _0x32c253=util['format'](_0xd941('0xc5'),_0xca3ebf['params']['id'],_0xdcdf9d);var _0x17e2d9=path['join'](_0x4e7763,_0x32c253);var _0xcc0f39=[];_0xcc0f39['push']({'model':db[_0xd941('0x6d')],'as':_0xd941('0x6d'),'attributes':['id',_0xd941('0x2b')],'raw':!![]});_0xcc0f39[_0xd941('0xc6')]({'model':db[_0xd941('0xc7')],'as':'Contact','attributes':['id',_0xd941('0xc8'),_0xd941('0xc9')],'raw':!![]});if(_0xca3ebf['query'][_0xd941('0xc4')]){_0xcc0f39[_0xd941('0xc6')]({'model':db['Attachment'],'as':_0xd941('0xca'),'raw':!![]});}var _0x4b8f68=[{'model':db[_0xd941('0xad')],'as':_0xd941('0xcb'),'attributes':['id',_0xd941('0x71'),_0xd941('0x76'),_0xd941('0xcc'),_0xd941('0xcd'),_0xd941('0x7c')],'include':_0xcc0f39}];_0x4b8f68['push']({'model':db[_0xd941('0xce')],'as':_0xd941('0xcf'),'attributes':['id','name']});_0x4b8f68[_0xd941('0xc6')]({'model':db['User'],'as':_0xd941('0xd0'),'attributes':['id',_0xd941('0x2b')]});return db['OpenchannelInteraction'][_0xd941('0x5a')]({'where':{'id':_0xca3ebf['params']['id']},'include':_0x4b8f68})[_0xd941('0x23')](handleEntityNotFound(_0x1d437e,null))[_0xd941('0x23')](function(_0x47ac70){if(_0x47ac70){var _0xa31cd8=_0x47ac70[_0xd941('0xd1')]({'plain':!![]});fs['mkdirSync'](_0x4ec27f);var _0x2c9a45={'format':'A4','border':_0xd941('0xd2'),'header':{'height':_0xd941('0xd3'),'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[_0xd941('0xb4')](_0xd941('0xd4'),util[_0xd941('0xb4')]('%s\x20#%d',_0xd941('0xd5'),_0xa31cd8['id']),moment()[_0xd941('0xb4')]('YYYY-MM-DD')['toString']())}}};var _0x1029eb={'channel':_0xd941('0xd5'),'account':_0xa31cd8[_0xd941('0xcf')][_0xd941('0x27')],'agent':_0xa31cd8['Owner']?_0xa31cd8['Owner']['fullname']:_0xd941('0xd6'),'createdAt':moment(_0xa31cd8['createdAt'])[_0xd941('0xb4')](_0xd941('0xb5'))[_0xd941('0x90')](),'closedAt':_0xa31cd8[_0xd941('0xd7')]?moment(_0xa31cd8[_0xd941('0xd8')])[_0xd941('0xb4')](_0xd941('0xb5'))[_0xd941('0x90')]():'','disposition':_0xa31cd8[_0xd941('0xd9')],'visibility':_0xa31cd8[_0xd941('0xda')]?'Public':_0xd941('0xdb'),'messages':_(_0xa31cd8[_0xd941('0xcb')])[_0xd941('0x80')]({'secret':![]})[_0xd941('0x2a')](function(_0xb00736){if(_0xb00736[_0xd941('0xca')]){var _0x183f10=path['join'](_0x21d465,_0xb00736[_0xd941('0xca')]['basename']);if(fs['existsSync'](_0x183f10)){fs['createReadStream'](_0x183f10)[_0xd941('0xdc')](fs['createWriteStream'](path[_0xd941('0xc2')](_0x4ec27f,_0xb00736[_0xd941('0xca')][_0xd941('0xdd')])));}}return{'date':moment(_0xb00736[_0xd941('0x76')])[_0xd941('0xb4')](_0xd941('0xb5'))[_0xd941('0x90')](),'sender':_0xb00736[_0xd941('0xcc')]===_0xd941('0xde')?_0xb00736['User']?_0xb00736[_0xd941('0x6d')][_0xd941('0x2b')]:_0xd941('0xdf'):_0xb00736[_0xd941('0x60')][_0xd941('0xc8')]+(_0xb00736['Contact']['lastName']?'\x20'+_0xb00736[_0xd941('0x60')][_0xd941('0xc9')]:''),'body':_0xb00736[_0xd941('0xca')]?_0xb00736[_0xd941('0xca')][_0xd941('0xdd')]:_0xb00736[_0xd941('0x71')],'direction':_0xb00736[_0xd941('0xcc')]===_0xd941('0xde')?'A':'C','secret':_0xb00736[_0xd941('0xcd')],'read':_0xb00736[_0xd941('0x7c')],'attachment':_0xb00736[_0xd941('0xca')]};})[_0xd941('0x5c')]()};return ejs[_0xd941('0xe0')](path[_0xd941('0xc2')](config[_0xd941('0xbf')],_0xd941('0xc0'),'views','downloadInteraction.html'),{'interaction':_0x1029eb})['then'](function(_0x18561e){return new BPromise(function(_0x585333,_0x4cfed3){pdf[_0xd941('0xa9')](_0x18561e,_0x2c9a45)['toFile'](path[_0xd941('0xc2')](_0x4ec27f,_0xd941('0xe1')+_0xa31cd8['id']+'-'+_0xdcdf9d+_0xd941('0xe2')),function(_0x2b17d4,_0x509cf3){if(_0x2b17d4)return _0x4cfed3(_0x2b17d4);_0x585333(_0x509cf3);});});})['then'](function(){return new BPromise(function(_0x1f4983,_0x424f16){zipdir(_0x4ec27f,{'saveTo':_0x17e2d9},function(_0xb72e14,_0x2c2f65){if(_0xb72e14)return _0x424f16(_0xb72e14);return _0x1f4983(_0x2c2f65);});})[_0xd941('0x23')](function(){return new BPromise(function(_0x207f1e,_0x5f2e60){rimraf(_0x4ec27f,function(_0x7071f7){if(_0x7071f7)_0x5f2e60(_0x7071f7);return _0x207f1e();});});})['then'](function(){return _0x1d437e[_0xd941('0xbd')](_0x17e2d9,_0x32c253,function(_0x29cb50){if(_0x29cb50){console['log'](_0xd941('0xe3'),_0x29cb50);}else{fs[_0xd941('0xe4')](_0x17e2d9);}});});});}else{return _0x1d437e[_0xd941('0xe5')](0xc8);}})[_0xd941('0x30')](handleError(_0x1d437e,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index c88b2bc..d641efa 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 _0x30f8=['../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x5f363b,_0x57bc1f){var _0x1b04b5=function(_0x122328){while(--_0x122328){_0x5f363b['push'](_0x5f363b['shift']());}};_0x1b04b5(++_0x57bc1f);}(_0x30f8,0x155));var _0x830f=function(_0x31a795,_0x46e5a4){_0x31a795=_0x31a795-0x0;var _0x513de4=_0x30f8[_0x31a795];return _0x513de4;};'use strict';var EventEmitter=require(_0x830f('0x0'));var OpenchannelInteraction=require(_0x830f('0x1'))['db'][_0x830f('0x2')];var OpenchannelMessage=require(_0x830f('0x1'))['db'][_0x830f('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x830f('0x4')](0x0);var events={'afterCreate':_0x830f('0x5'),'afterUpdate':_0x830f('0x6'),'afterDestroy':_0x830f('0x7')};function emitEvent(_0x11aa74){return function(_0x1c052f,_0xa5bca,_0x134249){_0x1c052f['getUsers']({'attributes':['id'],'raw':!![]})[_0x830f('0x8')](function(_0x115e46){_0x1c052f[_0x830f('0x9')](_0x830f('0xa'),_0x115e46[_0x830f('0xb')](function(_0x477188){return{'id':_0x477188['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x1c052f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x830f('0x8')](function(_0x4ce09c){_0x1c052f[_0x830f('0x9')](_0x830f('0xc'),_0x4ce09c[_0x830f('0xd')]);OpenchannelInteractionEvents[_0x830f('0xe')](_0x11aa74+':'+_0x1c052f['id'],_0x1c052f);OpenchannelInteractionEvents['emit'](_0x11aa74,_0x1c052f);_0x134249(null);})[_0x830f('0xf')](_0x134249(null));};}for(var e in events){if(events[_0x830f('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x830f('0x11')](e,emitEvent(event));}}module[_0x830f('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x03d3=['exports','setMaxListeners','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','hook'];(function(_0xc8d5d,_0x395ee3){var _0xbbe866=function(_0x839767){while(--_0x839767){_0xc8d5d['push'](_0xc8d5d['shift']());}};_0xbbe866(++_0x395ee3);}(_0x03d3,0x189));var _0x303d=function(_0x132c77,_0x2cd809){_0x132c77=_0x132c77-0x0;var _0x337935=_0x03d3[_0x132c77];return _0x337935;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x303d('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x303d('0x1'),'afterDestroy':_0x303d('0x2')};function emitEvent(_0x25b3f3){return function(_0x426c0a,_0x71aed2,_0x3ef6c4){_0x426c0a[_0x303d('0x3')]({'attributes':['id'],'raw':!![]})['then'](function(_0x224b32){_0x426c0a[_0x303d('0x4')](_0x303d('0x5'),_0x224b32[_0x303d('0x6')](function(_0x1dda9d){return{'id':_0x1dda9d['id']};}));return OpenchannelMessage[_0x303d('0x7')]({'where':{'OpenchannelInteractionId':_0x426c0a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x303d('0x8')](function(_0x430390){_0x426c0a[_0x303d('0x4')](_0x303d('0x9'),_0x430390[_0x303d('0xa')]);OpenchannelInteractionEvents['emit'](_0x25b3f3+':'+_0x426c0a['id'],_0x426c0a);OpenchannelInteractionEvents[_0x303d('0xb')](_0x25b3f3,_0x426c0a);_0x3ef6c4(null);})['catch'](_0x3ef6c4(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x303d('0xc')](e,emitEvent(event));}}module[_0x303d('0xd')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 3e6aa1e..012d790 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 _0xc03e=['rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','bluebird','path'];(function(_0x12ddd3,_0x175755){var _0x116185=function(_0x49bf2b){while(--_0x49bf2b){_0x12ddd3['push'](_0x12ddd3['shift']());}};_0x116185(++_0x175755);}(_0xc03e,0x15a));var _0xec03=function(_0x48f7cf,_0x4baa04){_0x48f7cf=_0x48f7cf-0x0;var _0xc201c0=_0xc03e[_0x48f7cf];return _0xc201c0;};'use strict';var _=require(_0xec03('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xec03('0x1'));var moment=require('moment');var BPromise=require(_0xec03('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec03('0x3'));var rimraf=require(_0xec03('0x4'));var config=require(_0xec03('0x5'));var attributes=require(_0xec03('0x6'));module[_0xec03('0x7')]=function(_0x1ce78a,_0x31db21){return _0x1ce78a[_0xec03('0x8')](_0xec03('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4205e9,_0xb0638e,_0xde3f78){if(_0x4205e9[_0xec03('0xa')]('closed')){_0x4205e9[_0xec03('0xb')]=moment()[_0xec03('0xc')](_0xec03('0xd'));}_0xde3f78(null,_0x4205e9);}}});}; \ No newline at end of file +var _0xf3be=['lodash','util','../../config/logger','api','bluebird','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x13033f,_0x2045af){var _0x2ed576=function(_0x491a78){while(--_0x491a78){_0x13033f['push'](_0x13033f['shift']());}};_0x2ed576(++_0x2045af);}(_0xf3be,0x1e1));var _0xef3b=function(_0x23ca95,_0x2dafc8){_0x23ca95=_0x23ca95-0x0;var _0x2561f8=_0xf3be[_0x23ca95];return _0x2561f8;};'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':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47069a,_0x3a36db,_0x5af366){if(_0x47069a['changed'](_0xef3b('0xa'))){_0x47069a['closedAt']=moment()[_0xef3b('0xb')](_0xef3b('0xc'));}_0x5af366(null,_0x47069a);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e5962ad..8e11a3c 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 _0x3563=['message','info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','limit','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x357b0b,_0x4359c7){var _0x406a59=function(_0x5c8313){while(--_0x5c8313){_0x357b0b['push'](_0x357b0b['shift']());}};_0x406a59(++_0x4359c7);}(_0x3563,0x159));var _0x3356=function(_0x528ea0,_0x34dafb){_0x528ea0=_0x528ea0-0x0;var _0xa18828=_0x3563[_0x528ea0];return _0xa18828;};'use strict';var _=require(_0x3356('0x0'));var util=require(_0x3356('0x1'));var moment=require(_0x3356('0x2'));var BPromise=require(_0x3356('0x3'));var rs=require(_0x3356('0x4'));var fs=require('fs');var Redis=require(_0x3356('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3356('0x6'));var logger=require(_0x3356('0x7'))(_0x3356('0x8'));var config=require(_0x3356('0x9'));var jayson=require(_0x3356('0xa'));var client=jayson[_0x3356('0xb')]['http']({'port':0x232a});config[_0x3356('0xc')]=_[_0x3356('0xd')](config['redis'],{'host':_0x3356('0xe'),'port':0x18eb});var socket=require(_0x3356('0xf'))(new Redis(config[_0x3356('0xc')]));require(_0x3356('0x10'))['register'](socket);function respondWithRpcPromise(_0x5950c8,_0x1ce952,_0x3c2055){return new BPromise(function(_0x3e2dd2,_0x195b7f){return client['request'](_0x5950c8,_0x3c2055)[_0x3356('0x11')](function(_0x59089d){logger['info'](_0x3356('0x12'),_0x1ce952,_0x3356('0x13'));logger[_0x3356('0x14')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x1ce952,'request\x20sent',JSON[_0x3356('0x15')](_0x59089d));if(_0x59089d[_0x3356('0x16')]){if(_0x59089d[_0x3356('0x16')][_0x3356('0x17')]===0x1f4){logger[_0x3356('0x16')](_0x3356('0x12'),_0x1ce952,_0x59089d[_0x3356('0x16')][_0x3356('0x18')]);return _0x195b7f(_0x59089d[_0x3356('0x16')][_0x3356('0x18')]);}logger[_0x3356('0x16')](_0x3356('0x12'),_0x1ce952,_0x59089d[_0x3356('0x16')][_0x3356('0x18')]);return _0x3e2dd2(_0x59089d[_0x3356('0x16')]['message']);}else{logger[_0x3356('0x19')](_0x3356('0x12'),_0x1ce952,_0x3356('0x13'));_0x3e2dd2(_0x59089d[_0x3356('0x1a')][_0x3356('0x18')]);}})[_0x3356('0x1b')](function(_0x1bdb72){logger[_0x3356('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1ce952,_0x1bdb72);_0x195b7f(_0x1bdb72);});});}exports[_0x3356('0x1c')]=function(_0x48fac){var _0x422c2d=this;return new Promise(function(_0x109bc2,_0x2e34af){return db[_0x3356('0x1d')][_0x3356('0x1e')](_0x48fac[_0x3356('0x1f')],{'raw':_0x48fac[_0x3356('0x20')]?_0x48fac[_0x3356('0x20')][_0x3356('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48fac[_0x3356('0x20')]?_0x48fac[_0x3356('0x20')]['where']||null:null,'attributes':_0x48fac[_0x3356('0x20')]?_0x48fac[_0x3356('0x20')]['attributes']||null:null,'limit':_0x48fac[_0x3356('0x20')]?_0x48fac[_0x3356('0x20')][_0x3356('0x22')]||null:null})[_0x3356('0x11')](function(_0x2c8b44){logger[_0x3356('0x19')](_0x3356('0x1c'),_0x48fac);logger[_0x3356('0x14')]('UpdateOpenchannelInteraction',_0x48fac,JSON[_0x3356('0x15')](_0x2c8b44));_0x109bc2(_0x2c8b44);})['catch'](function(_0x476161){logger[_0x3356('0x16')](_0x3356('0x1c'),_0x476161[_0x3356('0x18')],_0x48fac);_0x2e34af(_0x422c2d[_0x3356('0x16')](0x1f4,_0x476161[_0x3356('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x594911){return new Promise(function(_0x166cf5,_0x2634ff){return db[_0x3356('0x1d')]['find']({'where':_0x594911[_0x3356('0x20')]?_0x594911[_0x3356('0x20')][_0x3356('0x23')]||null:null})[_0x3356('0x11')](function(_0x35f7){if(_0x35f7){return _0x35f7[_0x3356('0x24')](_0x594911['body'][_0x3356('0x25')],_[_0x3356('0x26')](_0x594911[_0x3356('0x1f')],[_0x3356('0x25'),'id'])||{});}})[_0x3356('0x27')](function(_0x59a330){logger[_0x3356('0x19')](_0x3356('0x28'),_0x594911);logger[_0x3356('0x14')](_0x3356('0x28'),_0x594911,JSON['stringify'](_0x59a330));_0x166cf5(_0x59a330);})[_0x3356('0x1b')](function(_0x4bac62){logger[_0x3356('0x16')](_0x3356('0x28'),_0x4bac62[_0x3356('0x18')],_0x594911);_0x2634ff(_this[_0x3356('0x16')](0x1f4,_0x4bac62[_0x3356('0x18')]));});});}; \ No newline at end of file +var _0xa967=['body','options','where','attributes','then','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','OpenchannelInteraction','update'];(function(_0x562058,_0x365a8e){var _0x57507c=function(_0x30d28d){while(--_0x30d28d){_0x562058['push'](_0x562058['shift']());}};_0x57507c(++_0x365a8e);}(_0xa967,0x15d));var _0x7a96=function(_0x55446d,_0x494703){_0x55446d=_0x55446d-0x0;var _0x16ff1a=_0xa967[_0x55446d];return _0x16ff1a;};'use strict';var _=require(_0x7a96('0x0'));var util=require('util');var moment=require(_0x7a96('0x1'));var BPromise=require(_0x7a96('0x2'));var rs=require(_0x7a96('0x3'));var fs=require('fs');var Redis=require(_0x7a96('0x4'));var db=require(_0x7a96('0x5'))['db'];var utils=require(_0x7a96('0x6'));var logger=require(_0x7a96('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7a96('0x8'));var client=jayson['client'][_0x7a96('0x9')]({'port':0x232a});config[_0x7a96('0xa')]=_[_0x7a96('0xb')](config[_0x7a96('0xa')],{'host':_0x7a96('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7a96('0xa')]));require(_0x7a96('0xd'))[_0x7a96('0xe')](socket);function respondWithRpcPromise(_0x394cd4,_0x164a80,_0x139d0f){return new BPromise(function(_0xace071,_0x5a8f41){return client[_0x7a96('0xf')](_0x394cd4,_0x139d0f)['then'](function(_0x28133a){logger[_0x7a96('0x10')](_0x7a96('0x11'),_0x164a80,'request\x20sent');logger[_0x7a96('0x12')](_0x7a96('0x13'),_0x164a80,_0x7a96('0x14'),JSON[_0x7a96('0x15')](_0x28133a));if(_0x28133a[_0x7a96('0x16')]){if(_0x28133a[_0x7a96('0x16')][_0x7a96('0x17')]===0x1f4){logger[_0x7a96('0x16')](_0x7a96('0x11'),_0x164a80,_0x28133a['error']['message']);return _0x5a8f41(_0x28133a[_0x7a96('0x16')]['message']);}logger['error'](_0x7a96('0x11'),_0x164a80,_0x28133a['error'][_0x7a96('0x18')]);return _0xace071(_0x28133a[_0x7a96('0x16')][_0x7a96('0x18')]);}else{logger[_0x7a96('0x10')](_0x7a96('0x11'),_0x164a80,_0x7a96('0x14'));_0xace071(_0x28133a[_0x7a96('0x19')][_0x7a96('0x18')]);}})[_0x7a96('0x1a')](function(_0x2eaa9e){logger[_0x7a96('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x164a80,_0x2eaa9e);_0x5a8f41(_0x2eaa9e);});});}exports['UpdateOpenchannelInteraction']=function(_0x3a43d4){var _0x30beab=this;return new Promise(function(_0x78c0ee,_0x3524ec){return db[_0x7a96('0x1b')][_0x7a96('0x1c')](_0x3a43d4[_0x7a96('0x1d')],{'raw':_0x3a43d4[_0x7a96('0x1e')]?_0x3a43d4[_0x7a96('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a43d4[_0x7a96('0x1e')]?_0x3a43d4[_0x7a96('0x1e')][_0x7a96('0x1f')]||null:null,'attributes':_0x3a43d4[_0x7a96('0x1e')]?_0x3a43d4[_0x7a96('0x1e')][_0x7a96('0x20')]||null:null,'limit':_0x3a43d4[_0x7a96('0x1e')]?_0x3a43d4[_0x7a96('0x1e')]['limit']||null:null})[_0x7a96('0x21')](function(_0x187c2b){logger['info'](_0x7a96('0x22'),_0x3a43d4);logger[_0x7a96('0x12')](_0x7a96('0x22'),_0x3a43d4,JSON[_0x7a96('0x15')](_0x187c2b));_0x78c0ee(_0x187c2b);})[_0x7a96('0x1a')](function(_0x5d931f){logger[_0x7a96('0x16')](_0x7a96('0x22'),_0x5d931f[_0x7a96('0x18')],_0x3a43d4);_0x3524ec(_0x30beab['error'](0x1f4,_0x5d931f[_0x7a96('0x18')]));});});};exports[_0x7a96('0x23')]=function(_0x5e7be9){return new Promise(function(_0x234acd,_0x3da8ce){return db[_0x7a96('0x1b')][_0x7a96('0x24')]({'where':_0x5e7be9[_0x7a96('0x1e')]?_0x5e7be9['options'][_0x7a96('0x1f')]||null:null})[_0x7a96('0x21')](function(_0x361210){if(_0x361210){return _0x361210[_0x7a96('0x25')](_0x5e7be9[_0x7a96('0x1d')][_0x7a96('0x26')],_[_0x7a96('0x27')](_0x5e7be9[_0x7a96('0x1d')],[_0x7a96('0x26'),'id'])||{});}})[_0x7a96('0x28')](function(_0x2b274c){logger[_0x7a96('0x10')](_0x7a96('0x29'),_0x5e7be9);logger['debug'](_0x7a96('0x29'),_0x5e7be9,JSON[_0x7a96('0x15')](_0x2b274c));_0x234acd(_0x2b274c);})[_0x7a96('0x1a')](function(_0x26d73a){logger['error'](_0x7a96('0x29'),_0x26d73a[_0x7a96('0x18')],_0x5e7be9);_0x3da8ce(_this[_0x7a96('0x16')](0x1f4,_0x26d73a[_0x7a96('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 5fd0a8c..5f14ad9 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 _0xfdb2=['./openchannelInteraction.events','save','remove','update','emit','openchannelInteraction:'];(function(_0x5394ae,_0x88e388){var _0x450a67=function(_0x24856c){while(--_0x24856c){_0x5394ae['push'](_0x5394ae['shift']());}};_0x450a67(++_0x88e388);}(_0xfdb2,0x8a));var _0x2fdb=function(_0x4023d8,_0x94cab4){_0x4023d8=_0x4023d8-0x0;var _0x2f4aef=_0xfdb2[_0x4023d8];return _0x2f4aef;};'use strict';var OpenchannelInteractionEvents=require(_0x2fdb('0x0'));var events=[_0x2fdb('0x1'),_0x2fdb('0x2'),_0x2fdb('0x3')];function createListener(_0x39fa4b,_0xd82fd5){return function(_0x5dde61){_0xd82fd5[_0x2fdb('0x4')](_0x39fa4b,_0x5dde61);};}function removeListener(_0xfedec,_0x5bee62){return function(){OpenchannelInteractionEvents['removeListener'](_0xfedec,_0x5bee62);};}exports['register']=function(_0x1200e1){for(var _0x26ceb9=0x0,_0x3d6bf7=events['length'];_0x26ceb9<_0x3d6bf7;_0x26ceb9++){var _0x2c6360=events[_0x26ceb9];var _0x5915f2=createListener(_0x2fdb('0x5')+_0x2c6360,_0x1200e1);OpenchannelInteractionEvents['on'](_0x2c6360,_0x5915f2);}}; \ No newline at end of file +var _0x4c2f=['emit','removeListener','register','length','./openchannelInteraction.events','update'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x4c2f,0x6a));var _0xf4c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c2f[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelInteractionEvents=require(_0xf4c2('0x0'));var events=['save','remove',_0xf4c2('0x1')];function createListener(_0x39823a,_0x37621b){return function(_0xa9c02f){_0x37621b[_0xf4c2('0x2')](_0x39823a,_0xa9c02f);};}function removeListener(_0x585cbc,_0x347e29){return function(){OpenchannelInteractionEvents[_0xf4c2('0x3')](_0x585cbc,_0x347e29);};}exports[_0xf4c2('0x4')]=function(_0x2661a7){for(var _0x1ef10b=0x0,_0x537120=events[_0xf4c2('0x5')];_0x1ef10b<_0x537120;_0x1ef10b++){var _0x32ea6e=events[_0x1ef10b];var _0x28d1ed=createListener('openchannelInteraction:'+_0x32ea6e,_0x2661a7);OpenchannelInteractionEvents['on'](_0x32ea6e,_0x28d1ed);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index d43da50..5a69ff8 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 _0xb88e=['/:id','show','post','tracked','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0x1e934e,_0x4b0b67){var _0x4b0b95=function(_0x4a1298){while(--_0x4a1298){_0x1e934e['push'](_0x1e934e['shift']());}};_0x4b0b95(++_0x4b0b67);}(_0xb88e,0x165));var _0xeb88=function(_0x503511,_0x454c89){_0x503511=_0x503511-0x0;var _0x490877=_0xb88e[_0x503511];return _0x490877;};'use strict';var multer=require(_0xeb88('0x0'));var util=require(_0xeb88('0x1'));var path=require(_0xeb88('0x2'));var timeout=require(_0xeb88('0x3'));var express=require(_0xeb88('0x4'));var router=express[_0xeb88('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xeb88('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0xeb88('0x7')](),controller[_0xeb88('0x8')]);router[_0xeb88('0x9')](_0xeb88('0xa'),auth[_0xeb88('0x7')](),controller['describe']);router[_0xeb88('0x9')](_0xeb88('0xb'),auth[_0xeb88('0x7')](),controller[_0xeb88('0xc')]);router[_0xeb88('0xd')]('/',auth[_0xeb88('0x7')](),interaction[_0xeb88('0xe')]('openchannel',_0xeb88('0xf')),controller['create']);router[_0xeb88('0x10')]('/:id',auth[_0xeb88('0x7')](),controller[_0xeb88('0x11')]);router[_0xeb88('0x10')](_0xeb88('0x12'),auth['isAuthenticated'](),controller[_0xeb88('0x13')]);router[_0xeb88('0x10')](_0xeb88('0x14'),auth[_0xeb88('0x7')](),controller['reject']);router[_0xeb88('0x15')](_0xeb88('0xb'),auth[_0xeb88('0x7')](),controller[_0xeb88('0x16')]);module['exports']=router; \ No newline at end of file +var _0x507b=['index','/describe','isAuthenticated','describe','/:id','show','post','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','reject','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get'];(function(_0x4513fb,_0x400f2b){var _0x18a8c9=function(_0xce95ac){while(--_0xce95ac){_0x4513fb['push'](_0x4513fb['shift']());}};_0x18a8c9(++_0x400f2b);}(_0x507b,0x190));var _0xb507=function(_0x323d06,_0x4add2c){_0x323d06=_0x323d06-0x0;var _0xfe0aa0=_0x507b[_0x323d06];return _0xfe0aa0;};'use strict';var multer=require(_0xb507('0x0'));var util=require(_0xb507('0x1'));var path=require(_0xb507('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb507('0x3')]();var auth=require(_0xb507('0x4'));var interaction=require(_0xb507('0x5'));var config=require('../../config/environment');var controller=require(_0xb507('0x6'));router[_0xb507('0x7')]('/',auth['isAuthenticated'](),controller[_0xb507('0x8')]);router[_0xb507('0x7')](_0xb507('0x9'),auth[_0xb507('0xa')](),controller[_0xb507('0xb')]);router[_0xb507('0x7')](_0xb507('0xc'),auth['isAuthenticated'](),controller[_0xb507('0xd')]);router[_0xb507('0xe')]('/',auth[_0xb507('0xa')](),interaction['tracked'](_0xb507('0xf'),_0xb507('0x10')),controller[_0xb507('0x11')]);router['put'](_0xb507('0xc'),auth[_0xb507('0xa')](),controller[_0xb507('0x12')]);router[_0xb507('0x13')](_0xb507('0x14'),auth[_0xb507('0xa')](),controller[_0xb507('0x15')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xb507('0x16')]);router['delete'](_0xb507('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xb507('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index eb0f649..fe5d206 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 _0x0b33=['BOOLEAN','ENUM','out','DATE','medium'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x0b33,0x6d));var _0x30b3=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x0b33[_0x209ec9];return _0x129b1b;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x30b3('0x0')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x30b3('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x30b3('0x2')]('in',_0x30b3('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x30b3('0x4')]}}; \ No newline at end of file +var _0xce50=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x2a8887,_0x3d5a00){var _0x335c2d=function(_0x455b05){while(--_0x455b05){_0x2a8887['push'](_0x2a8887['shift']());}};_0x335c2d(++_0x3d5a00);}(_0xce50,0x78));var _0x0ce5=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xce50[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0x0ce5('0x0'));module[_0x0ce5('0x1')]={'body':{'type':Sequelize[_0x0ce5('0x2')](_0x0ce5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0ce5('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0ce5('0x5')]('in',_0x0ce5('0x6')),'defaultValue':_0x0ce5('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0ce5('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index f3cec46..3573a51 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 _0x5659=['message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','stack','name','send','map','OpenchannelMessage','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','include','find','create','body','params','destroy','describe','openchannel-interactions','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','null','AcceptMessage','manual','interface','channel','event','accept','EventManager','acceptmessage','reject','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x12a881,_0x92f7e8){var _0x224c7f=function(_0x4aa2fa){while(--_0x4aa2fa){_0x12a881['push'](_0x12a881['shift']());}};_0x224c7f(++_0x92f7e8);}(_0x5659,0x13a));var _0x9565=function(_0x115cdc,_0x2533b9){_0x115cdc=_0x115cdc-0x0;var _0x43259f=_0x5659[_0x115cdc];return _0x43259f;};'use strict';var pdf=require(_0x9565('0x0'));var emlformat=require(_0x9565('0x1'));var rimraf=require(_0x9565('0x2'));var zipdir=require(_0x9565('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9565('0x4'));var moment=require(_0x9565('0x5'));var BPromise=require(_0x9565('0x6'));var Mustache=require(_0x9565('0x7'));var util=require(_0x9565('0x8'));var path=require(_0x9565('0x9'));var sox=require('sox');var csv=require(_0x9565('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9565('0xb'));var squel=require(_0x9565('0xc'));var crypto=require(_0x9565('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9565('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9565('0xf'));var Papa=require('papaparse');var Redis=require(_0x9565('0x10'));var authService=require(_0x9565('0x11'));var qs=require(_0x9565('0x12'));var as=require(_0x9565('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9565('0x14'))(_0x9565('0x15'));var utils=require(_0x9565('0x16'));var config=require(_0x9565('0x17'));var db=require(_0x9565('0x18'))['db'];config[_0x9565('0x19')]=_[_0x9565('0x1a')](config[_0x9565('0x19')],{'host':_0x9565('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9565('0x19')]));require(_0x9565('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9565('0x1d')][_0x9565('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x9565('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x30b32a,_0x57c1ec,_0x37b03c){if(_0x37b03c){var _0xaabc73=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xaabc73['test'](_0x57c1ec)){return _0x30b32a;}else{throw new db['Sequelize']['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x30b32a;}}function respondWithRpcPromise(_0x4b7706,_0x2f3200,_0x18bdf8,_0x2d8d32){return new BPromise(function(_0x163ba9,_0x2c2b85){var _0x4376c8=_0x2d8d32||client;return _0x4376c8[_0x9565('0x1f')](_0x4b7706,_0x18bdf8)['then'](function(_0x395234){logger[_0x9565('0x20')](_0x9565('0x21'),_0x2f3200,_0x9565('0x22'));logger[_0x9565('0x23')](_0x9565('0x24'),_0x2f3200,'request\x20sent',JSON[_0x9565('0x25')](_0x395234));if(_0x395234[_0x9565('0x26')]){if(_0x395234['error'][_0x9565('0x27')]===0x1f4){logger[_0x9565('0x26')](_0x9565('0x21'),_0x2f3200,_0x395234['error'][_0x9565('0x28')]);return _0x2c2b85(_0x395234[_0x9565('0x26')][_0x9565('0x28')]);}logger[_0x9565('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x2f3200,_0x395234[_0x9565('0x26')]['message']);return _0x163ba9(_0x395234['error'][_0x9565('0x28')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2f3200,_0x9565('0x22'));_0x163ba9(_0x395234[_0x9565('0x29')][_0x9565('0x28')]);}})[_0x9565('0x2a')](function(_0x1fbcad){logger[_0x9565('0x26')](_0x9565('0x21'),_0x2f3200,_0x1fbcad);_0x2c2b85(_0x1fbcad);});});}function respondWithStatusCode(_0x9aab9a,_0x4ed869){_0x4ed869=_0x4ed869||0xcc;return function(_0x328782){if(_0x328782){return _0x9aab9a[_0x9565('0x2b')](_0x4ed869);}return _0x9aab9a[_0x9565('0x2c')](_0x4ed869)[_0x9565('0x2d')]();};}function respondWithResult(_0x3ab5e4,_0x44d89d){_0x44d89d=_0x44d89d||0xc8;return function(_0x338fc7){if(_0x338fc7){return _0x3ab5e4[_0x9565('0x2c')](_0x44d89d)[_0x9565('0x2e')](_0x338fc7);}};}function respondWithFilteredResult(_0x4e898c,_0x5cbc7d){return function(_0x1a2ece){if(_0x1a2ece){var _0x42992b=_0x1a2ece[_0x9565('0x2f')],_0x390424=_0x5cbc7d[_0x9565('0x30')],_0x36a34f=_0x5cbc7d[_0x9565('0x30')]+_0x5cbc7d[_0x9565('0x31')],_0x5ad293;if(_0x36a34f>=_0x42992b){_0x36a34f=_0x42992b;_0x5ad293=0xc8;}else{_0x5ad293=0xce;}_0x4e898c[_0x9565('0x2c')](_0x5ad293);return _0x4e898c['set'](_0x9565('0x32'),_0x390424+'-'+_0x36a34f+'/'+_0x42992b)[_0x9565('0x2e')](_0x1a2ece);}return null;};}function patchUpdates(_0x4b40e9){return function(_0x2a9ce6){try{jsonpatch[_0x9565('0x33')](_0x2a9ce6,_0x4b40e9,!![]);}catch(_0x16dd1b){return BPromise['reject'](_0x16dd1b);}return _0x2a9ce6[_0x9565('0x34')]();};}function saveUpdates(_0x46afb4,_0x16ae6e){return function(_0x25255d){if(_0x25255d){return _0x25255d[_0x9565('0x35')](_0x46afb4)['then'](function(_0x2b5158){return _0x2b5158;});}return null;};}function removeEntity(_0x2b58e7,_0x3754aa){return function(_0x2b9c9d){if(_0x2b9c9d){return _0x2b9c9d['destroy']()[_0x9565('0x36')](function(){_0x2b58e7[_0x9565('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1096f3,_0x2a723a){return function(_0x1c2902){if(!_0x1c2902){_0x1096f3[_0x9565('0x2b')](0x194);}return _0x1c2902;};}function handleError(_0x3cee00,_0x1be901){_0x1be901=_0x1be901||0x1f4;return function(_0x4ffc2a){logger[_0x9565('0x26')](_0x4ffc2a[_0x9565('0x37')]);if(_0x4ffc2a[_0x9565('0x38')]){delete _0x4ffc2a['name'];}_0x3cee00[_0x9565('0x2c')](_0x1be901)[_0x9565('0x39')](_0x4ffc2a);};}exports['index']=function(_0x54adcf,_0x5107e4){var _0x23a0e9={},_0x973986={},_0x5b295e={'count':0x0,'rows':[]};var _0x201618=_[_0x9565('0x3a')](db[_0x9565('0x3b')][_0x9565('0x3c')],function(_0x59f926){return{'name':_0x59f926['fieldName'],'type':_0x59f926['type'][_0x9565('0x3d')]};});_0x973986[_0x9565('0x3e')]=_['map'](_0x201618,'name');_0x973986[_0x9565('0x3f')]=_[_0x9565('0x40')](_0x54adcf[_0x9565('0x3f')]);_0x973986['filters']=_[_0x9565('0x41')](_0x973986[_0x9565('0x3e')],_0x973986[_0x9565('0x3f')]);_0x23a0e9[_0x9565('0x42')]=_[_0x9565('0x41')](_0x973986[_0x9565('0x3e')],qs[_0x9565('0x43')](_0x54adcf[_0x9565('0x3f')][_0x9565('0x43')]));_0x23a0e9[_0x9565('0x42')]=_0x23a0e9[_0x9565('0x42')][_0x9565('0x44')]?_0x23a0e9[_0x9565('0x42')]:_0x973986[_0x9565('0x3e')];if(!_0x54adcf['query']['hasOwnProperty'](_0x9565('0x45'))){_0x23a0e9[_0x9565('0x31')]=qs[_0x9565('0x31')](_0x54adcf['query']['limit']);_0x23a0e9[_0x9565('0x30')]=qs[_0x9565('0x30')](_0x54adcf[_0x9565('0x3f')][_0x9565('0x30')]);}_0x23a0e9['order']=qs['sort'](_0x54adcf[_0x9565('0x3f')][_0x9565('0x46')]);_0x23a0e9[_0x9565('0x47')]=qs[_0x9565('0x48')](_[_0x9565('0x49')](_0x54adcf['query'],_0x973986[_0x9565('0x48')]));if(_0x54adcf[_0x9565('0x3f')]['filter']){_0x23a0e9['where']=_[_0x9565('0x4a')](_0x23a0e9[_0x9565('0x47')],{'$or':_['map'](_0x201618,function(_0x4b450f){if(_0x4b450f[_0x9565('0x4b')]!==_0x9565('0x4c')){var _0x59a257={};_0x59a257[_0x4b450f[_0x9565('0x38')]]={'$like':'%'+_0x54adcf[_0x9565('0x3f')][_0x9565('0x4d')]+'%'};return _0x59a257;}})});}_0x23a0e9=_[_0x9565('0x4a')]({},_0x23a0e9,_0x54adcf[_0x9565('0x4e')]);var _0xe1af8={'where':_0x23a0e9['where']};return db[_0x9565('0x3b')][_0x9565('0x2f')](_0xe1af8)[_0x9565('0x36')](function(_0x4501ba){_0x5b295e[_0x9565('0x2f')]=_0x4501ba;if(_0x54adcf[_0x9565('0x3f')][_0x9565('0x4f')]){_0x23a0e9['include']=[{'all':!![]}];}return db[_0x9565('0x3b')][_0x9565('0x50')](_0x23a0e9);})[_0x9565('0x36')](function(_0x50bce0){_0x5b295e[_0x9565('0x51')]=_0x50bce0;return _0x5b295e;})[_0x9565('0x36')](respondWithFilteredResult(_0x5107e4,_0x23a0e9))[_0x9565('0x2a')](handleError(_0x5107e4,null));};exports['show']=function(_0x58f3f1,_0x296bfe){var _0x470a59={'raw':!![],'where':{'id':_0x58f3f1['params']['id']}},_0x36bf34={};_0x36bf34[_0x9565('0x3e')]=_[_0x9565('0x40')](db['OpenchannelMessage'][_0x9565('0x3c')]);_0x36bf34['query']=_['keys'](_0x58f3f1[_0x9565('0x3f')]);_0x36bf34['filters']=_['intersection'](_0x36bf34[_0x9565('0x3e')],_0x36bf34[_0x9565('0x3f')]);_0x470a59[_0x9565('0x42')]=_[_0x9565('0x41')](_0x36bf34[_0x9565('0x3e')],qs[_0x9565('0x43')](_0x58f3f1['query'][_0x9565('0x43')]));_0x470a59[_0x9565('0x42')]=_0x470a59[_0x9565('0x42')][_0x9565('0x44')]?_0x470a59[_0x9565('0x42')]:_0x36bf34[_0x9565('0x3e')];if(_0x58f3f1[_0x9565('0x3f')]['includeAll']){_0x470a59[_0x9565('0x52')]=[{'all':!![]}];}_0x470a59=_[_0x9565('0x4a')]({},_0x470a59,_0x58f3f1['options']);return db['OpenchannelMessage'][_0x9565('0x53')](_0x470a59)['then'](handleEntityNotFound(_0x296bfe,null))['then'](respondWithResult(_0x296bfe,null))[_0x9565('0x2a')](handleError(_0x296bfe,null));};exports['create']=function(_0x5022d8,_0x8db94){return db['OpenchannelMessage'][_0x9565('0x54')](_0x5022d8[_0x9565('0x55')],{})[_0x9565('0x36')](respondWithResult(_0x8db94,0xc9))['catch'](handleError(_0x8db94,null));};exports['update']=function(_0xcd84f5,_0x1907f1){if(_0xcd84f5[_0x9565('0x55')]['id']){delete _0xcd84f5[_0x9565('0x55')]['id'];}return db[_0x9565('0x3b')][_0x9565('0x53')]({'where':{'id':_0xcd84f5[_0x9565('0x56')]['id']}})[_0x9565('0x36')](handleEntityNotFound(_0x1907f1,null))[_0x9565('0x36')](saveUpdates(_0xcd84f5[_0x9565('0x55')],null))[_0x9565('0x36')](respondWithResult(_0x1907f1,null))['catch'](handleError(_0x1907f1,null));};exports[_0x9565('0x57')]=function(_0x5576fd,_0x2bc9eb){return db[_0x9565('0x3b')][_0x9565('0x53')]({'where':{'id':_0x5576fd['params']['id']}})[_0x9565('0x36')](handleEntityNotFound(_0x2bc9eb,null))[_0x9565('0x36')](removeEntity(_0x2bc9eb,null))[_0x9565('0x2a')](handleError(_0x2bc9eb,null));};exports[_0x9565('0x58')]=function(_0x518343,_0x15bf9f){return db['OpenchannelMessage'][_0x9565('0x58')]()['then'](respondWithResult(_0x15bf9f,null))['catch'](handleError(_0x15bf9f,null));};var interaction_log=require('../../config/logger')(_0x9565('0x59'));exports['accept']=function(_0x3a0b87,_0x37abb2,_0x25d605){var _0xde63b0={'channel':_0x9565('0x5a')};if(_0x3a0b87[_0x9565('0x55')]['id']){delete _0x3a0b87[_0x9565('0x55')]['id'];}_0x3a0b87['body'][_0x9565('0x5b')]=!![];_0x3a0b87['body']['readAt']=moment()[_0x9565('0x5c')](_0x9565('0x5d'));_0x3a0b87[_0x9565('0x55')]['UserId']=_0x3a0b87[_0x9565('0x55')][_0x9565('0x5e')]||_0x3a0b87[_0x9565('0x5f')]['id'];return db[_0x9565('0x3b')][_0x9565('0x53')]({'where':{'id':_0x3a0b87[_0x9565('0x56')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x9565('0x36')](handleEntityNotFound(_0x37abb2,null))[_0x9565('0x36')](saveUpdates(_0x3a0b87[_0x9565('0x55')],null))['then'](function(_0x1d543c){if(_0x1d543c){_0xde63b0[_0x9565('0x28')]=_0x1d543c[_0x9565('0x60')]({'plain':!![]});return db[_0x9565('0x61')][_0x9565('0x53')]({'where':{'id':_0x1d543c[_0x9565('0x62')]}});}return null;})[_0x9565('0x36')](handleEntityNotFound(_0x37abb2,null))['then'](function(_0x1e0a8c){if(_0x1e0a8c){return _0x1e0a8c[_0x9565('0x35')]({'UserId':_0x3a0b87['body'][_0x9565('0x5e')],'read1stAt':_[_0x9565('0x63')](_0x1e0a8c[_0x9565('0x64')])?moment()['format'](_0x9565('0x5d')):undefined});}return null;})[_0x9565('0x36')](function(_0x2fa905){if(_0x2fa905){_0xde63b0['interaction']=_0x2fa905[_0x9565('0x60')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3a0b87[_0x9565('0x5f')]['id'],_0x3a0b87[_0x9565('0x5f')]['name'],_0x3a0b87[_0x9565('0x5f')]['role'],_0xde63b0[_0x9565('0x65')]['id'],_0x3a0b87[_0x9565('0x55')]?JSON[_0x9565('0x25')](_0x3a0b87['body']):_0x9565('0x66'));return respondWithRpcPromise(_0x9565('0x67'),'acceptMessage',_0xde63b0);}return null;})[_0x9565('0x36')](function(_0xf85420){if(_0xf85420){if(_0x3a0b87[_0x9565('0x55')][_0x9565('0x68')]){_0xde63b0[_0x9565('0x28')][_0x9565('0x69')]=util['format']('SIP/%s',_0x3a0b87[_0x9565('0x5f')][_0x9565('0x38')]);_0xde63b0[_0x9565('0x28')]['channel']=_0xde63b0[_0x9565('0x6a')];_0xde63b0[_0x9565('0x28')][_0x9565('0x6b')]=_0x9565('0x6c');return respondWithRpcPromise(_0x9565('0x6d'),_0x9565('0x6d'),{'event':_0x9565('0x6e'),'message':_0xde63b0[_0x9565('0x28')]},client9002)[_0x9565('0x36')](function(){return _0xde63b0;});}return _0xde63b0;}return null;})[_0x9565('0x36')](respondWithResult(_0x37abb2,null))['catch'](handleError(_0x37abb2,null));};var interaction_log=require(_0x9565('0x14'))(_0x9565('0x59'));exports[_0x9565('0x6f')]=function(_0x2e6e15,_0x16b808,_0x3d2835){var _0x1805f1={'agent':{},'channel':_0x9565('0x5a')};if(_0x2e6e15[_0x9565('0x55')]['id']){delete _0x2e6e15[_0x9565('0x55')]['id'];}_0x2e6e15[_0x9565('0x55')][_0x9565('0x5e')]=_0x2e6e15[_0x9565('0x55')]['UserId']||_0x2e6e15[_0x9565('0x5f')]['id'];_0x1805f1[_0x9565('0x70')]['id']=_0x2e6e15['body'][_0x9565('0x5e')];return db[_0x9565('0x3b')][_0x9565('0x53')]({'where':{'id':_0x2e6e15[_0x9565('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x16b808,null))[_0x9565('0x36')](function(_0x4af599){if(_0x4af599){_0x1805f1['message']=_0x4af599[_0x9565('0x60')]({'plain':!![]});return db[_0x9565('0x61')][_0x9565('0x53')]({'where':{'id':_0x4af599[_0x9565('0x62')]}});}return null;})[_0x9565('0x36')](handleEntityNotFound(_0x16b808,null))[_0x9565('0x36')](function(_0x544fe7){if(_0x544fe7){_0x1805f1['interaction']=_0x544fe7[_0x9565('0x60')]({'plain':!![]});interaction_log[_0x9565('0x20')](_0x9565('0x71'),_0x2e6e15[_0x9565('0x5f')]['id'],_0x2e6e15['user'][_0x9565('0x38')],_0x2e6e15[_0x9565('0x5f')][_0x9565('0x72')],_0x1805f1[_0x9565('0x65')]['id'],_0x2e6e15[_0x9565('0x55')]?JSON[_0x9565('0x25')](_0x2e6e15[_0x9565('0x55')]):'null');return respondWithRpcPromise(_0x9565('0x73'),_0x9565('0x74'),_0x1805f1);}return null;})['then'](function(_0x53d0d8){if(_0x53d0d8){_0x53d0d8['message'][_0x9565('0x69')]=util[_0x9565('0x5c')]('SIP/%s',_0x2e6e15[_0x9565('0x5f')]['name']);_0x53d0d8[_0x9565('0x28')][_0x9565('0x6a')]=_0x1805f1['channel'];_0x53d0d8[_0x9565('0x28')][_0x9565('0x6b')]=_0x9565('0x6f');respondWithRpcPromise('EventManager',_0x9565('0x6d'),{'event':_0x9565('0x75'),'message':_0x53d0d8['message']},client9002);return _0x1805f1;}return null;})[_0x9565('0x36')](respondWithResult(_0x16b808,null))[_0x9565('0x2a')](handleError(_0x16b808,null));}; \ No newline at end of file +var _0x97ff=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','send','index','map','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','VIRTUAL','filter','where','OpenchannelMessage','count','findAll','show','params','includeAll','include','create','body','find','describe','openchannel-interactions','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','role','null','acceptMessage','manual','interface','SIP/%s','accept','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','channel','EventManager','rejectmessage','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x146d9a,_0x30da08){var _0xdf8edd=function(_0x1d88c6){while(--_0x1d88c6){_0x146d9a['push'](_0x146d9a['shift']());}};_0xdf8edd(++_0x30da08);}(_0x97ff,0x15e));var _0xf97f=function(_0x4b9b62,_0x24e1df){_0x4b9b62=_0x4b9b62-0x0;var _0x3c6bb9=_0x97ff[_0x4b9b62];return _0x3c6bb9;};'use strict';var pdf=require(_0xf97f('0x0'));var emlformat=require(_0xf97f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf97f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf97f('0x3'));var moment=require('moment');var BPromise=require(_0xf97f('0x4'));var Mustache=require(_0xf97f('0x5'));var util=require(_0xf97f('0x6'));var path=require(_0xf97f('0x7'));var sox=require('sox');var csv=require(_0xf97f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf97f('0x9'));var crypto=require(_0xf97f('0xa'));var jsforce=require(_0xf97f('0xb'));var deskjs=require(_0xf97f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf97f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf97f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf97f('0xf'));var hardwareService=require(_0xf97f('0x10'));var logger=require(_0xf97f('0x11'))(_0xf97f('0x12'));var utils=require(_0xf97f('0x13'));var config=require(_0xf97f('0x14'));var db=require('../../mysqldb')['db'];config[_0xf97f('0x15')]=_['defaults'](config[_0xf97f('0x15')],{'host':_0xf97f('0x16'),'port':0x18eb});var socket=require(_0xf97f('0x17'))(new Redis(config['redis']));require(_0xf97f('0x18'))[_0xf97f('0x19')](socket);var jayson=require(_0xf97f('0x1a'));var client=jayson[_0xf97f('0x1b')][_0xf97f('0x1c')]({'port':0x232c});var client9002=jayson[_0xf97f('0x1b')][_0xf97f('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3e3c77,_0x1b93f6,_0x55563c){if(_0x55563c){var _0x2ccc48=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ccc48[_0xf97f('0x1d')](_0x1b93f6)){return _0x3e3c77;}else{throw new db[(_0xf97f('0x1e'))][(_0xf97f('0x1f'))](_0xf97f('0x20'));}}else{return _0x3e3c77;}}function respondWithRpcPromise(_0x5e5c36,_0x257b81,_0x33a4c0,_0x353920){return new BPromise(function(_0x121fe3,_0xe008dc){var _0x3931e0=_0x353920||client;return _0x3931e0['request'](_0x5e5c36,_0x33a4c0)['then'](function(_0x436ffe){logger[_0xf97f('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x257b81,_0xf97f('0x22'));logger[_0xf97f('0x23')](_0xf97f('0x24'),_0x257b81,'request\x20sent',JSON['stringify'](_0x436ffe));if(_0x436ffe[_0xf97f('0x25')]){if(_0x436ffe[_0xf97f('0x25')][_0xf97f('0x26')]===0x1f4){logger[_0xf97f('0x25')](_0xf97f('0x27'),_0x257b81,_0x436ffe[_0xf97f('0x25')][_0xf97f('0x28')]);return _0xe008dc(_0x436ffe[_0xf97f('0x25')][_0xf97f('0x28')]);}logger[_0xf97f('0x25')](_0xf97f('0x27'),_0x257b81,_0x436ffe['error'][_0xf97f('0x28')]);return _0x121fe3(_0x436ffe[_0xf97f('0x25')][_0xf97f('0x28')]);}else{logger[_0xf97f('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x257b81,'request\x20sent');_0x121fe3(_0x436ffe[_0xf97f('0x29')][_0xf97f('0x28')]);}})[_0xf97f('0x2a')](function(_0x52be88){logger['error'](_0xf97f('0x27'),_0x257b81,_0x52be88);_0xe008dc(_0x52be88);});});}function respondWithStatusCode(_0xe21829,_0x548c6d){_0x548c6d=_0x548c6d||0xcc;return function(_0x31db89){if(_0x31db89){return _0xe21829[_0xf97f('0x2b')](_0x548c6d);}return _0xe21829[_0xf97f('0x2c')](_0x548c6d)[_0xf97f('0x2d')]();};}function respondWithResult(_0x26964c,_0x407331){_0x407331=_0x407331||0xc8;return function(_0x404f40){if(_0x404f40){return _0x26964c[_0xf97f('0x2c')](_0x407331)[_0xf97f('0x2e')](_0x404f40);}};}function respondWithFilteredResult(_0x102901,_0xee3daf){return function(_0x74c02a){if(_0x74c02a){var _0x6a4a9b=_0x74c02a['count'],_0x1f6323=_0xee3daf[_0xf97f('0x2f')],_0x9b6c9c=_0xee3daf[_0xf97f('0x2f')]+_0xee3daf[_0xf97f('0x30')],_0x133d71;if(_0x9b6c9c>=_0x6a4a9b){_0x9b6c9c=_0x6a4a9b;_0x133d71=0xc8;}else{_0x133d71=0xce;}_0x102901[_0xf97f('0x2c')](_0x133d71);return _0x102901[_0xf97f('0x31')](_0xf97f('0x32'),_0x1f6323+'-'+_0x9b6c9c+'/'+_0x6a4a9b)[_0xf97f('0x2e')](_0x74c02a);}return null;};}function patchUpdates(_0xce7fa0){return function(_0x55d8b8){try{jsonpatch[_0xf97f('0x33')](_0x55d8b8,_0xce7fa0,!![]);}catch(_0x5f2bcb){return BPromise[_0xf97f('0x34')](_0x5f2bcb);}return _0x55d8b8[_0xf97f('0x35')]();};}function saveUpdates(_0x2a275e,_0x4532bd){return function(_0x34c5ec){if(_0x34c5ec){return _0x34c5ec[_0xf97f('0x36')](_0x2a275e)[_0xf97f('0x37')](function(_0x2f5bfd){return _0x2f5bfd;});}return null;};}function removeEntity(_0x14cc60,_0x1b7e1e){return function(_0x4afa80){if(_0x4afa80){return _0x4afa80[_0xf97f('0x38')]()[_0xf97f('0x37')](function(){_0x14cc60[_0xf97f('0x2c')](0xcc)[_0xf97f('0x2d')]();});}};}function handleEntityNotFound(_0x13ab73,_0x44d50c){return function(_0x59c218){if(!_0x59c218){_0x13ab73['sendStatus'](0x194);}return _0x59c218;};}function handleError(_0x3fcf11,_0x29b575){_0x29b575=_0x29b575||0x1f4;return function(_0x21e0c6){logger[_0xf97f('0x25')](_0x21e0c6['stack']);if(_0x21e0c6['name']){delete _0x21e0c6['name'];}_0x3fcf11[_0xf97f('0x2c')](_0x29b575)[_0xf97f('0x39')](_0x21e0c6);};}exports[_0xf97f('0x3a')]=function(_0xf4d560,_0x5f399e){var _0x480add={},_0x5ef76e={},_0x4946f0={'count':0x0,'rows':[]};var _0x366208=_[_0xf97f('0x3b')](db['OpenchannelMessage'][_0xf97f('0x3c')],function(_0x25c80c){return{'name':_0x25c80c[_0xf97f('0x3d')],'type':_0x25c80c[_0xf97f('0x3e')][_0xf97f('0x3f')]};});_0x5ef76e['model']=_['map'](_0x366208,_0xf97f('0x40'));_0x5ef76e[_0xf97f('0x41')]=_[_0xf97f('0x42')](_0xf4d560[_0xf97f('0x41')]);_0x5ef76e[_0xf97f('0x43')]=_[_0xf97f('0x44')](_0x5ef76e[_0xf97f('0x45')],_0x5ef76e[_0xf97f('0x41')]);_0x480add[_0xf97f('0x46')]=_[_0xf97f('0x44')](_0x5ef76e[_0xf97f('0x45')],qs[_0xf97f('0x47')](_0xf4d560['query'][_0xf97f('0x47')]));_0x480add[_0xf97f('0x46')]=_0x480add['attributes'][_0xf97f('0x48')]?_0x480add[_0xf97f('0x46')]:_0x5ef76e[_0xf97f('0x45')];if(!_0xf4d560['query'][_0xf97f('0x49')]('nolimit')){_0x480add[_0xf97f('0x30')]=qs[_0xf97f('0x30')](_0xf4d560[_0xf97f('0x41')][_0xf97f('0x30')]);_0x480add[_0xf97f('0x2f')]=qs[_0xf97f('0x2f')](_0xf4d560[_0xf97f('0x41')]['offset']);}_0x480add[_0xf97f('0x4a')]=qs[_0xf97f('0x4b')](_0xf4d560[_0xf97f('0x41')][_0xf97f('0x4b')]);_0x480add['where']=qs[_0xf97f('0x43')](_[_0xf97f('0x4c')](_0xf4d560[_0xf97f('0x41')],_0x5ef76e[_0xf97f('0x43')]));if(_0xf4d560[_0xf97f('0x41')]['filter']){_0x480add['where']=_[_0xf97f('0x4d')](_0x480add['where'],{'$or':_[_0xf97f('0x3b')](_0x366208,function(_0x3b599f){if(_0x3b599f[_0xf97f('0x3e')]!==_0xf97f('0x4e')){var _0x531857={};_0x531857[_0x3b599f['name']]={'$like':'%'+_0xf4d560[_0xf97f('0x41')][_0xf97f('0x4f')]+'%'};return _0x531857;}})});}_0x480add=_[_0xf97f('0x4d')]({},_0x480add,_0xf4d560['options']);var _0x4ef472={'where':_0x480add[_0xf97f('0x50')]};return db[_0xf97f('0x51')][_0xf97f('0x52')](_0x4ef472)[_0xf97f('0x37')](function(_0x520e79){_0x4946f0[_0xf97f('0x52')]=_0x520e79;if(_0xf4d560[_0xf97f('0x41')]['includeAll']){_0x480add['include']=[{'all':!![]}];}return db[_0xf97f('0x51')][_0xf97f('0x53')](_0x480add);})[_0xf97f('0x37')](function(_0x19e0c2){_0x4946f0['rows']=_0x19e0c2;return _0x4946f0;})[_0xf97f('0x37')](respondWithFilteredResult(_0x5f399e,_0x480add))[_0xf97f('0x2a')](handleError(_0x5f399e,null));};exports[_0xf97f('0x54')]=function(_0x4bc0e2,_0x1ddb4f){var _0x12b06d={'raw':!![],'where':{'id':_0x4bc0e2[_0xf97f('0x55')]['id']}},_0x88d864={};_0x88d864[_0xf97f('0x45')]=_[_0xf97f('0x42')](db[_0xf97f('0x51')]['rawAttributes']);_0x88d864['query']=_[_0xf97f('0x42')](_0x4bc0e2[_0xf97f('0x41')]);_0x88d864[_0xf97f('0x43')]=_[_0xf97f('0x44')](_0x88d864['model'],_0x88d864[_0xf97f('0x41')]);_0x12b06d[_0xf97f('0x46')]=_[_0xf97f('0x44')](_0x88d864['model'],qs[_0xf97f('0x47')](_0x4bc0e2[_0xf97f('0x41')][_0xf97f('0x47')]));_0x12b06d[_0xf97f('0x46')]=_0x12b06d[_0xf97f('0x46')][_0xf97f('0x48')]?_0x12b06d[_0xf97f('0x46')]:_0x88d864['model'];if(_0x4bc0e2[_0xf97f('0x41')][_0xf97f('0x56')]){_0x12b06d[_0xf97f('0x57')]=[{'all':!![]}];}_0x12b06d=_['merge']({},_0x12b06d,_0x4bc0e2['options']);return db['OpenchannelMessage']['find'](_0x12b06d)[_0xf97f('0x37')](handleEntityNotFound(_0x1ddb4f,null))['then'](respondWithResult(_0x1ddb4f,null))['catch'](handleError(_0x1ddb4f,null));};exports[_0xf97f('0x58')]=function(_0x1195f3,_0x3add44){return db['OpenchannelMessage']['create'](_0x1195f3[_0xf97f('0x59')],{})['then'](respondWithResult(_0x3add44,0xc9))[_0xf97f('0x2a')](handleError(_0x3add44,null));};exports[_0xf97f('0x36')]=function(_0x1d0f2c,_0x4fbbf5){if(_0x1d0f2c[_0xf97f('0x59')]['id']){delete _0x1d0f2c[_0xf97f('0x59')]['id'];}return db[_0xf97f('0x51')][_0xf97f('0x5a')]({'where':{'id':_0x1d0f2c[_0xf97f('0x55')]['id']}})[_0xf97f('0x37')](handleEntityNotFound(_0x4fbbf5,null))[_0xf97f('0x37')](saveUpdates(_0x1d0f2c[_0xf97f('0x59')],null))[_0xf97f('0x37')](respondWithResult(_0x4fbbf5,null))[_0xf97f('0x2a')](handleError(_0x4fbbf5,null));};exports[_0xf97f('0x38')]=function(_0x121bc6,_0x158ee5){return db[_0xf97f('0x51')]['find']({'where':{'id':_0x121bc6[_0xf97f('0x55')]['id']}})['then'](handleEntityNotFound(_0x158ee5,null))['then'](removeEntity(_0x158ee5,null))[_0xf97f('0x2a')](handleError(_0x158ee5,null));};exports[_0xf97f('0x5b')]=function(_0x285a69,_0x4a3a22){return db[_0xf97f('0x51')]['describe']()['then'](respondWithResult(_0x4a3a22,null))[_0xf97f('0x2a')](handleError(_0x4a3a22,null));};var interaction_log=require(_0xf97f('0x11'))(_0xf97f('0x5c'));exports['accept']=function(_0x196cca,_0x12ec07,_0x4812f1){var _0x5107aa={'channel':_0xf97f('0x5d')};if(_0x196cca['body']['id']){delete _0x196cca['body']['id'];}_0x196cca[_0xf97f('0x59')][_0xf97f('0x5e')]=!![];_0x196cca['body']['readAt']=moment()[_0xf97f('0x5f')](_0xf97f('0x60'));_0x196cca[_0xf97f('0x59')][_0xf97f('0x61')]=_0x196cca[_0xf97f('0x59')]['UserId']||_0x196cca[_0xf97f('0x62')]['id'];return db[_0xf97f('0x51')]['find']({'where':{'id':_0x196cca[_0xf97f('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xf97f('0x63')],'as':_0xf97f('0x64')}]})[_0xf97f('0x37')](handleEntityNotFound(_0x12ec07,null))[_0xf97f('0x37')](saveUpdates(_0x196cca[_0xf97f('0x59')],null))[_0xf97f('0x37')](function(_0x548db9){if(_0x548db9){_0x5107aa[_0xf97f('0x28')]=_0x548db9['get']({'plain':!![]});return db[_0xf97f('0x65')][_0xf97f('0x5a')]({'where':{'id':_0x548db9[_0xf97f('0x66')]}});}return null;})[_0xf97f('0x37')](handleEntityNotFound(_0x12ec07,null))['then'](function(_0x1570e5){if(_0x1570e5){return _0x1570e5[_0xf97f('0x36')]({'UserId':_0x196cca[_0xf97f('0x59')][_0xf97f('0x61')],'read1stAt':_[_0xf97f('0x67')](_0x1570e5[_0xf97f('0x68')])?moment()[_0xf97f('0x5f')](_0xf97f('0x60')):undefined});}return null;})['then'](function(_0x2817d7){if(_0x2817d7){_0x5107aa[_0xf97f('0x69')]=_0x2817d7[_0xf97f('0x6a')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x196cca['user']['id'],_0x196cca[_0xf97f('0x62')]['name'],_0x196cca[_0xf97f('0x62')][_0xf97f('0x6b')],_0x5107aa['interaction']['id'],_0x196cca['body']?JSON['stringify'](_0x196cca[_0xf97f('0x59')]):_0xf97f('0x6c'));return respondWithRpcPromise('AcceptMessage',_0xf97f('0x6d'),_0x5107aa);}return null;})['then'](function(_0x58fefc){if(_0x58fefc){if(_0x196cca[_0xf97f('0x59')][_0xf97f('0x6e')]){_0x5107aa[_0xf97f('0x28')][_0xf97f('0x6f')]=util[_0xf97f('0x5f')](_0xf97f('0x70'),_0x196cca['user'][_0xf97f('0x40')]);_0x5107aa[_0xf97f('0x28')]['channel']=_0x5107aa['channel'];_0x5107aa[_0xf97f('0x28')]['event']=_0xf97f('0x71');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xf97f('0x72'),'message':_0x5107aa[_0xf97f('0x28')]},client9002)[_0xf97f('0x37')](function(){return _0x5107aa;});}return _0x5107aa;}return null;})['then'](respondWithResult(_0x12ec07,null))[_0xf97f('0x2a')](handleError(_0x12ec07,null));};var interaction_log=require(_0xf97f('0x11'))(_0xf97f('0x5c'));exports[_0xf97f('0x34')]=function(_0x59fd53,_0x284b82,_0x48325f){var _0x3dc20d={'agent':{},'channel':_0xf97f('0x5d')};if(_0x59fd53[_0xf97f('0x59')]['id']){delete _0x59fd53[_0xf97f('0x59')]['id'];}_0x59fd53[_0xf97f('0x59')][_0xf97f('0x61')]=_0x59fd53[_0xf97f('0x59')][_0xf97f('0x61')]||_0x59fd53[_0xf97f('0x62')]['id'];_0x3dc20d['agent']['id']=_0x59fd53[_0xf97f('0x59')][_0xf97f('0x61')];return db[_0xf97f('0x51')][_0xf97f('0x5a')]({'where':{'id':_0x59fd53[_0xf97f('0x55')]['id'],'UserId':null}})[_0xf97f('0x37')](handleEntityNotFound(_0x284b82,null))[_0xf97f('0x37')](function(_0x5399d4){if(_0x5399d4){_0x3dc20d[_0xf97f('0x28')]=_0x5399d4[_0xf97f('0x6a')]({'plain':!![]});return db[_0xf97f('0x65')][_0xf97f('0x5a')]({'where':{'id':_0x5399d4[_0xf97f('0x66')]}});}return null;})[_0xf97f('0x37')](handleEntityNotFound(_0x284b82,null))[_0xf97f('0x37')](function(_0x59e21b){if(_0x59e21b){_0x3dc20d[_0xf97f('0x69')]=_0x59e21b[_0xf97f('0x6a')]({'plain':!![]});interaction_log[_0xf97f('0x21')](_0xf97f('0x73'),_0x59fd53[_0xf97f('0x62')]['id'],_0x59fd53['user']['name'],_0x59fd53[_0xf97f('0x62')]['role'],_0x3dc20d[_0xf97f('0x69')]['id'],_0x59fd53[_0xf97f('0x59')]?JSON[_0xf97f('0x74')](_0x59fd53['body']):_0xf97f('0x6c'));return respondWithRpcPromise(_0xf97f('0x75'),_0xf97f('0x76'),_0x3dc20d);}return null;})['then'](function(_0x356c1c){if(_0x356c1c){_0x356c1c[_0xf97f('0x28')][_0xf97f('0x6f')]=util[_0xf97f('0x5f')]('SIP/%s',_0x59fd53['user'][_0xf97f('0x40')]);_0x356c1c[_0xf97f('0x28')][_0xf97f('0x77')]=_0x3dc20d[_0xf97f('0x77')];_0x356c1c['message']['event']=_0xf97f('0x34');respondWithRpcPromise(_0xf97f('0x78'),_0xf97f('0x78'),{'event':_0xf97f('0x79'),'message':_0x356c1c[_0xf97f('0x28')]},client9002);return _0x3dc20d;}return null;})[_0xf97f('0x37')](respondWithResult(_0x284b82,null))['catch'](handleError(_0x284b82,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 856cec4..16d5568 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 _0xf9ca=['OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0xf9ca,0x14b));var _0xaf9c=function(_0x5e1f5c,_0x3072d0){_0x5e1f5c=_0x5e1f5c-0x0;var _0x3d0e18=_0xf9ca[_0x5e1f5c];return _0x3d0e18;};'use strict';var EventEmitter=require(_0xaf9c('0x0'));var OpenchannelMessage=require(_0xaf9c('0x1'))['db'][_0xaf9c('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xaf9c('0x3')](0x0);var events={'afterCreate':_0xaf9c('0x4'),'afterUpdate':_0xaf9c('0x5'),'afterDestroy':_0xaf9c('0x6')};function emitEvent(_0x4c5446){return function(_0x4030d6,_0x22d83f,_0x3a5385){OpenchannelMessageEvents[_0xaf9c('0x7')](_0x4c5446+':'+_0x4030d6['id'],_0x4030d6);OpenchannelMessageEvents['emit'](_0x4c5446,_0x4030d6);_0x3a5385(null);};}for(var e in events){if(events[_0xaf9c('0x8')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x79de=['remove','emit','hook','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0x42aba3,_0x4ef48f){var _0x33b03c=function(_0x424739){while(--_0x424739){_0x42aba3['push'](_0x42aba3['shift']());}};_0x33b03c(++_0x4ef48f);}(_0x79de,0xff));var _0xe79d=function(_0x4d5b25,_0x2f4781){_0x4d5b25=_0x4d5b25-0x0;var _0x8363f8=_0x79de[_0x4d5b25];return _0x8363f8;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xe79d('0x0'))['db'][_0xe79d('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xe79d('0x2')](0x0);var events={'afterCreate':_0xe79d('0x3'),'afterUpdate':'update','afterDestroy':_0xe79d('0x4')};function emitEvent(_0x17175d){return function(_0x1c2812,_0x5d7e94,_0x27e7ad){OpenchannelMessageEvents['emit'](_0x17175d+':'+_0x1c2812['id'],_0x1c2812);OpenchannelMessageEvents[_0xe79d('0x5')](_0x17175d,_0x1c2812);_0x27e7ad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xe79d('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 709e26d..da0b710 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 _0xd994=['Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','afterCreate','inspect','finally','utf8mb4','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','GET'];(function(_0x5e24ef,_0x284ac8){var _0x388ddb=function(_0x5c9056){while(--_0x5c9056){_0x5e24ef['push'](_0x5e24ef['shift']());}};_0x388ddb(++_0x284ac8);}(_0xd994,0x1db));var _0x4d99=function(_0x4f2f19,_0x270ea3){_0x4f2f19=_0x4f2f19-0x0;var _0x15b508=_0xd994[_0x4f2f19];return _0x15b508;};'use strict';var _=require(_0x4d99('0x0'));var util=require(_0x4d99('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4d99('0x2'));var rp=require(_0x4d99('0x3'));var fs=require('fs');var path=require(_0x4d99('0x4'));var rimraf=require(_0x4d99('0x5'));var config=require(_0x4d99('0x6'));var attributes=require(_0x4d99('0x7'));module[_0x4d99('0x8')]=function(_0x596f1c,_0x3a4530){return _0x596f1c[_0x4d99('0x9')](_0x4d99('0xa'),attributes,{'tableName':_0x4d99('0xb'),'paranoid':![],'indexes':[{'name':_0x4d99('0xc'),'fields':[_0x4d99('0xd')],'type':_0x4d99('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3bd0cc,_0x59ea07,_0x217f75){var _0x1a61f2=_0x596f1c[_0x4d99('0xf')];var _0x42ba4b=_0x3bd0cc['get']({'plain':!![]});if(_0x42ba4b[_0x4d99('0x10')]['toLowerCase']()==='in'||_0x42ba4b[_0x4d99('0x10')][_0x4d99('0x11')]()===_0x4d99('0x12')&&!_0x42ba4b['secret']&&!_[_0x4d99('0x13')](_0x42ba4b[_0x4d99('0x14')])){_0x1a61f2[_0x4d99('0x15')][_0x4d99('0x16')]({'where':{'id':_0x42ba4b[_0x4d99('0x17')]}})[_0x4d99('0x18')](function(_0x5d7c5f){if(_0x5d7c5f){_0x5d7c5f[_0x4d99('0x19')]({'lastMsgAt':_0x42ba4b['createdAt'],'lastMsgDirection':_0x42ba4b[_0x4d99('0x10')][_0x4d99('0x11')]()});}})['catch'](function(_0x58e745){console[_0x4d99('0x1a')](_0x58e745);});}if(_0x42ba4b[_0x4d99('0x10')]===_0x4d99('0x12')&&!_0x42ba4b[_0x4d99('0x1b')]){var _0x409a3f;_0x1a61f2[_0x4d99('0x1c')][_0x4d99('0x1d')]()[_0x4d99('0x18')](function(_0x52f30b){return _0x1a61f2[_0x4d99('0x1e')][_0x4d99('0x1f')]({'where':{'id':_0x42ba4b[_0x4d99('0x20')]},'include':[{'model':_0x1a61f2['OpenchannelInteraction'],'as':_0x4d99('0x21'),'where':{'id':_0x42ba4b[_0x4d99('0x17')]},'limit':0x1,'include':[{'model':_0x1a61f2[_0x4d99('0x1c')],'as':'Contact','attributes':_[_0x4d99('0x22')](_0x52f30b)}]}]});})[_0x4d99('0x18')](function(_0x236bee){_0x409a3f=_0x236bee[_0x4d99('0x23')]({'plain':!![]});if(_0x409a3f&&_0x409a3f[_0x4d99('0x24')]){logger[_0x4d99('0x25')](_0x4d99('0x26'),'afterCreate',util['format'](_0x4d99('0x27'),_0x42ba4b['id'],_0x409a3f['replyUri']));if(_0x409a3f['Interactions']&&_0x409a3f[_0x4d99('0x21')][_0x4d99('0x28')]){_0x42ba4b[_0x4d99('0x29')]=_[_0x4d99('0x2a')](_0x409a3f[_0x4d99('0x21')][0x0],'Contact');_0x42ba4b['Contact']=_0x409a3f['Interactions'][0x0]['Contact'];}var _0x59ea07={'method':'POST','uri':encodeURI(_0x409a3f[_0x4d99('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x59ea07[_0x4d99('0x2b')]){case _0x4d99('0x2c'):_0x59ea07['qs']=_0x42ba4b;break;case'POST':_0x59ea07['body']=_0x42ba4b;break;}return rp(_0x59ea07)[_0x4d99('0x18')](function(_0x1c6b36){logger[_0x4d99('0x25')](_0x4d99('0x26'),'afterCreate',util['format'](_0x4d99('0x2d'),_0x42ba4b['id'],_0x409a3f[_0x4d99('0x24')]));if(_0x1c6b36['body'][_0x4d99('0x2e')]&&_0x1c6b36['body'][_0x4d99('0x2e')]!=_0x42ba4b[_0x4d99('0x29')][_0x4d99('0x2e')]){return _0x1a61f2[_0x4d99('0x15')][_0x4d99('0x19')]({'threadId':_0x1c6b36[_0x4d99('0xd')][_0x4d99('0x2e')]},{'logging':!![],'where':{'id':_0x42ba4b[_0x4d99('0x29')]['id']}});}else{return;}})['then'](function(){return _0x3bd0cc[_0x4d99('0x19')]({'read':!![]});})[_0x4d99('0x2f')](function(_0x5b21a9){logger[_0x4d99('0x1a')](_0x4d99('0x26'),_0x4d99('0x30'),util[_0x4d99('0x31')](_0x5b21a9,{'showHidden':![],'depth':null}));_0x217f75();});}else{_0x217f75();}})[_0x4d99('0x32')](function(){_0x217f75();});}else{_0x217f75();}}},'charset':_0x4d99('0x33'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa59b=['Message\x20%d\x20forwarded\x20to\x20%s','update','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','get','direction','toLowerCase','out','secret','UserId','findOne','OpenchannelInteractionId','createdAt','catch','error','CmContact','describe','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','then','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','Interaction','omit','POST','GET'];(function(_0x4f5b59,_0x6d52c3){var _0x11ab62=function(_0x463f9b){while(--_0x463f9b){_0x4f5b59['push'](_0x4f5b59['shift']());}};_0x11ab62(++_0x6d52c3);}(_0xa59b,0x127));var _0xba59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa59b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba59('0x0'));var util=require('util');var logger=require(_0xba59('0x1'))(_0xba59('0x2'));var moment=require(_0xba59('0x3'));var BPromise=require(_0xba59('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xba59('0x5'));var config=require(_0xba59('0x6'));var attributes=require(_0xba59('0x7'));module[_0xba59('0x8')]=function(_0x21db57,_0x1e3360){return _0x21db57[_0xba59('0x9')](_0xba59('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xba59('0xb'),'fields':[_0xba59('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2878da,_0x5a3486,_0x3b5b05){var _0x52a27a=_0x21db57['models'];var _0x12a30f=_0x2878da[_0xba59('0xd')]({'plain':!![]});if(_0x12a30f[_0xba59('0xe')]['toLowerCase']()==='in'||_0x12a30f[_0xba59('0xe')][_0xba59('0xf')]()===_0xba59('0x10')&&!_0x12a30f[_0xba59('0x11')]&&!_['isNil'](_0x12a30f[_0xba59('0x12')])){_0x52a27a['OpenchannelInteraction'][_0xba59('0x13')]({'where':{'id':_0x12a30f[_0xba59('0x14')]}})['then'](function(_0x20364c){if(_0x20364c){_0x20364c['update']({'lastMsgAt':_0x12a30f[_0xba59('0x15')],'lastMsgDirection':_0x12a30f[_0xba59('0xe')][_0xba59('0xf')]()});}})[_0xba59('0x16')](function(_0x46646a){console[_0xba59('0x17')](_0x46646a);});}if(_0x12a30f[_0xba59('0xe')]===_0xba59('0x10')&&!_0x12a30f[_0xba59('0x11')]){var _0x430b0c;_0x52a27a[_0xba59('0x18')][_0xba59('0x19')]()['then'](function(_0x465f4e){return _0x52a27a['OpenchannelAccount'][_0xba59('0x1a')]({'where':{'id':_0x12a30f[_0xba59('0x1b')]},'include':[{'model':_0x52a27a[_0xba59('0x1c')],'as':_0xba59('0x1d'),'where':{'id':_0x12a30f[_0xba59('0x14')]},'limit':0x1,'include':[{'model':_0x52a27a[_0xba59('0x18')],'as':_0xba59('0x1e'),'attributes':_[_0xba59('0x1f')](_0x465f4e)}]}]});})[_0xba59('0x20')](function(_0x3b5fbf){_0x430b0c=_0x3b5fbf['get']({'plain':!![]});if(_0x430b0c&&_0x430b0c[_0xba59('0x21')]){logger['info'](_0xba59('0x22'),_0xba59('0x23'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0x12a30f['id'],_0x430b0c['replyUri']));if(_0x430b0c[_0xba59('0x1d')]&&_0x430b0c[_0xba59('0x1d')][_0xba59('0x24')]){_0x12a30f[_0xba59('0x25')]=_[_0xba59('0x26')](_0x430b0c[_0xba59('0x1d')][0x0],_0xba59('0x1e'));_0x12a30f['Contact']=_0x430b0c['Interactions'][0x0][_0xba59('0x1e')];}var _0x5a3486={'method':_0xba59('0x27'),'uri':encodeURI(_0x430b0c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5a3486['method']){case _0xba59('0x28'):_0x5a3486['qs']=_0x12a30f;break;case'POST':_0x5a3486['body']=_0x12a30f;break;}return rp(_0x5a3486)[_0xba59('0x20')](function(_0x1381f4){logger['info'](_0xba59('0x22'),_0xba59('0x23'),util['format'](_0xba59('0x29'),_0x12a30f['id'],_0x430b0c[_0xba59('0x21')]));if(_0x1381f4['body']['threadId']&&_0x1381f4[_0xba59('0xc')]['threadId']!=_0x12a30f[_0xba59('0x25')]['threadId']){return _0x52a27a[_0xba59('0x1c')][_0xba59('0x2a')]({'threadId':_0x1381f4[_0xba59('0xc')][_0xba59('0x2b')]},{'logging':!![],'where':{'id':_0x12a30f[_0xba59('0x25')]['id']}});}else{return;}})[_0xba59('0x20')](function(){return _0x2878da[_0xba59('0x2a')]({'read':!![]});})[_0xba59('0x16')](function(_0x4dce3a){logger[_0xba59('0x17')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xba59('0x2c')](_0x4dce3a,{'showHidden':![],'depth':null}));_0x3b5b05();});}else{_0x3b5b05();}})[_0xba59('0x2d')](function(){_0x3b5b05();});}else{_0x3b5b05();}}},'charset':_0xba59('0x2e'),'collate':_0xba59('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index b3624ee..d7bd5a4 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 _0xf954=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateOpenchannelMessage','create','body','options','raw','stringify','lodash','util'];(function(_0x29b118,_0x595f11){var _0x146882=function(_0x5c994e){while(--_0x5c994e){_0x29b118['push'](_0x29b118['shift']());}};_0x146882(++_0x595f11);}(_0xf954,0x10e));var _0x4f95=function(_0x458441,_0x48e84e){_0x458441=_0x458441-0x0;var _0x274cee=_0xf954[_0x458441];return _0x274cee;};'use strict';var _=require(_0x4f95('0x0'));var util=require(_0x4f95('0x1'));var moment=require(_0x4f95('0x2'));var BPromise=require(_0x4f95('0x3'));var rs=require(_0x4f95('0x4'));var fs=require('fs');var Redis=require(_0x4f95('0x5'));var db=require(_0x4f95('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f95('0x7'));var config=require(_0x4f95('0x8'));var jayson=require(_0x4f95('0x9'));var client=jayson[_0x4f95('0xa')]['http']({'port':0x232a});config[_0x4f95('0xb')]=_[_0x4f95('0xc')](config[_0x4f95('0xb')],{'host':_0x4f95('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4f95('0xe'))[_0x4f95('0xf')](socket);function respondWithRpcPromise(_0x31626f,_0x48f17a,_0x4cf1fd){return new BPromise(function(_0x5079cc,_0x337ebc){return client[_0x4f95('0x10')](_0x31626f,_0x4cf1fd)[_0x4f95('0x11')](function(_0x1e93c6){logger['info'](_0x4f95('0x12'),_0x48f17a,_0x4f95('0x13'));logger[_0x4f95('0x14')](_0x4f95('0x15'),_0x48f17a,_0x4f95('0x13'),JSON['stringify'](_0x1e93c6));if(_0x1e93c6[_0x4f95('0x16')]){if(_0x1e93c6[_0x4f95('0x16')][_0x4f95('0x17')]===0x1f4){logger[_0x4f95('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x48f17a,_0x1e93c6[_0x4f95('0x16')][_0x4f95('0x18')]);return _0x337ebc(_0x1e93c6[_0x4f95('0x16')]['message']);}logger[_0x4f95('0x16')](_0x4f95('0x12'),_0x48f17a,_0x1e93c6[_0x4f95('0x16')][_0x4f95('0x18')]);return _0x5079cc(_0x1e93c6[_0x4f95('0x16')][_0x4f95('0x18')]);}else{logger[_0x4f95('0x19')](_0x4f95('0x12'),_0x48f17a,_0x4f95('0x13'));_0x5079cc(_0x1e93c6[_0x4f95('0x1a')]['message']);}})[_0x4f95('0x1b')](function(_0x219693){logger[_0x4f95('0x16')](_0x4f95('0x12'),_0x48f17a,_0x219693);_0x337ebc(_0x219693);});});}exports[_0x4f95('0x1c')]=function(_0x351427){var _0x255805=this;return new Promise(function(_0x3586c0,_0xc449b4){return db['OpenchannelMessage'][_0x4f95('0x1d')](_0x351427[_0x4f95('0x1e')],{'raw':_0x351427[_0x4f95('0x1f')]?_0x351427[_0x4f95('0x1f')][_0x4f95('0x20')]===undefined?!![]:![]:!![]})[_0x4f95('0x11')](function(_0xe49db2){logger[_0x4f95('0x19')](_0x4f95('0x1c'),_0x351427);logger[_0x4f95('0x14')](_0x4f95('0x1c'),_0x351427,JSON[_0x4f95('0x21')](_0xe49db2));_0x3586c0(_0xe49db2);})[_0x4f95('0x1b')](function(_0x4f9e55){logger[_0x4f95('0x16')](_0x4f95('0x1c'),_0x4f9e55[_0x4f95('0x18')],_0x351427);_0xc449b4(_0x255805[_0x4f95('0x16')](0x1f4,_0x4f9e55[_0x4f95('0x18')]));});});}; \ No newline at end of file +var _0x78f4=['http','defaults','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x78f4,0x1c8));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x478f('0x0'));var moment=require(_0x478f('0x1'));var BPromise=require(_0x478f('0x2'));var rs=require(_0x478f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x478f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x478f('0x5'))(_0x478f('0x6'));var config=require(_0x478f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x478f('0x8')][_0x478f('0x9')]({'port':0x232a});config['redis']=_[_0x478f('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x478f('0xb'))(new Redis(config['redis']));require(_0x478f('0xc'))[_0x478f('0xd')](socket);function respondWithRpcPromise(_0xec2f39,_0x469c69,_0x5a724b){return new BPromise(function(_0x5e6a27,_0x32ea1a){return client[_0x478f('0xe')](_0xec2f39,_0x5a724b)[_0x478f('0xf')](function(_0x45e1dd){logger[_0x478f('0x10')](_0x478f('0x11'),_0x469c69,_0x478f('0x12'));logger[_0x478f('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x469c69,_0x478f('0x12'),JSON[_0x478f('0x14')](_0x45e1dd));if(_0x45e1dd[_0x478f('0x15')]){if(_0x45e1dd[_0x478f('0x15')][_0x478f('0x16')]===0x1f4){logger[_0x478f('0x15')](_0x478f('0x11'),_0x469c69,_0x45e1dd[_0x478f('0x15')]['message']);return _0x32ea1a(_0x45e1dd[_0x478f('0x15')][_0x478f('0x17')]);}logger[_0x478f('0x15')](_0x478f('0x11'),_0x469c69,_0x45e1dd['error'][_0x478f('0x17')]);return _0x5e6a27(_0x45e1dd['error'][_0x478f('0x17')]);}else{logger[_0x478f('0x10')]('OpenchannelMessage,\x20%s,\x20%s',_0x469c69,_0x478f('0x12'));_0x5e6a27(_0x45e1dd['result'][_0x478f('0x17')]);}})[_0x478f('0x18')](function(_0x181d9d){logger[_0x478f('0x15')](_0x478f('0x11'),_0x469c69,_0x181d9d);_0x32ea1a(_0x181d9d);});});}exports[_0x478f('0x19')]=function(_0x3e97d2){var _0x3b1a21=this;return new Promise(function(_0x384dfc,_0x341cd0){return db[_0x478f('0x1a')][_0x478f('0x1b')](_0x3e97d2[_0x478f('0x1c')],{'raw':_0x3e97d2[_0x478f('0x1d')]?_0x3e97d2[_0x478f('0x1d')][_0x478f('0x1e')]===undefined?!![]:![]:!![]})[_0x478f('0xf')](function(_0x3b92f5){logger[_0x478f('0x10')](_0x478f('0x19'),_0x3e97d2);logger['debug']('CreateOpenchannelMessage',_0x3e97d2,JSON[_0x478f('0x14')](_0x3b92f5));_0x384dfc(_0x3b92f5);})['catch'](function(_0xedd0d9){logger[_0x478f('0x15')](_0x478f('0x19'),_0xedd0d9[_0x478f('0x17')],_0x3e97d2);_0x341cd0(_0x3b1a21[_0x478f('0x15')](0x1f4,_0xedd0d9[_0x478f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index b7f027d..969a151 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 _0x0713=['removeListener','register','length','openchannelMessage:','remove','update'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x3071('0x0'),_0x3071('0x1')];function createListener(_0x27405a,_0x305d85){return function(_0x864539){_0x305d85['emit'](_0x27405a,_0x864539);};}function removeListener(_0x2c547f,_0x7b18a4){return function(){OpenchannelMessageEvents[_0x3071('0x2')](_0x2c547f,_0x7b18a4);};}exports[_0x3071('0x3')]=function(_0xabd7b6){for(var _0x41cf76=0x0,_0x1d3dd6=events[_0x3071('0x4')];_0x41cf76<_0x1d3dd6;_0x41cf76++){var _0xbd737f=events[_0x41cf76];var _0x22274c=createListener(_0x3071('0x5')+_0xbd737f,_0xabd7b6);OpenchannelMessageEvents['on'](_0xbd737f,_0x22274c);}}; \ No newline at end of file +var _0xaa88=['save','remove','update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events'];(function(_0xc70305,_0x164311){var _0x2ccbdc=function(_0x2cec36){while(--_0x2cec36){_0xc70305['push'](_0xc70305['shift']());}};_0x2ccbdc(++_0x164311);}(_0xaa88,0x137));var _0x8aa8=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0xaa88[_0x4e4f0e];return _0x1a7219;};'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 697c84d..119a50c 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 _0xfc76=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','put','update','delete','removeTeams','removeAgents','exports','util'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xfc76,0xb5));var _0x6fc7=function(_0xcd224f,_0x57d584){_0xcd224f=_0xcd224f-0x0;var _0x139726=_0xfc76[_0xcd224f];return _0x139726;};'use strict';var multer=require('multer');var util=require(_0x6fc7('0x0'));var path=require(_0x6fc7('0x1'));var timeout=require(_0x6fc7('0x2'));var express=require(_0x6fc7('0x3'));var router=express[_0x6fc7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6fc7('0x5'));var config=require(_0x6fc7('0x6'));var controller=require('./openchannelQueue.controller');router[_0x6fc7('0x7')]('/',auth['isAuthenticated'](),controller[_0x6fc7('0x8')]);router[_0x6fc7('0x7')](_0x6fc7('0x9'),auth['isAuthenticated'](),controller[_0x6fc7('0xa')]);router[_0x6fc7('0x7')](_0x6fc7('0xb'),auth[_0x6fc7('0xc')](),controller[_0x6fc7('0xd')]);router[_0x6fc7('0x7')]('/:id/members',auth[_0x6fc7('0xc')](),controller[_0x6fc7('0xe')]);router[_0x6fc7('0x7')](_0x6fc7('0xf'),auth[_0x6fc7('0xc')](),controller[_0x6fc7('0x10')]);router['get'](_0x6fc7('0x11'),auth[_0x6fc7('0xc')](),controller['getAgents']);router[_0x6fc7('0x12')]('/',auth[_0x6fc7('0xc')](),controller['create']);router[_0x6fc7('0x12')](_0x6fc7('0xf'),auth['isAuthenticated'](),controller[_0x6fc7('0x13')]);router[_0x6fc7('0x12')](_0x6fc7('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0x6fc7('0x14')](_0x6fc7('0xb'),auth['isAuthenticated'](),controller[_0x6fc7('0x15')]);router[_0x6fc7('0x16')](_0x6fc7('0xb'),auth[_0x6fc7('0xc')](),controller['destroy']);router[_0x6fc7('0x16')](_0x6fc7('0xf'),auth[_0x6fc7('0xc')](),controller[_0x6fc7('0x17')]);router[_0x6fc7('0x16')](_0x6fc7('0x11'),auth['isAuthenticated'](),controller[_0x6fc7('0x18')]);module[_0x6fc7('0x19')]=router; \ No newline at end of file +var _0x47a1=['addTeams','/:id/users','addAgents','update','delete','destroy','removeAgents','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getTeams','getAgents','post','create','/:id/teams'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x47a1,0xbd));var _0x147a=function(_0x4d6123,_0x233d69){_0x4d6123=_0x4d6123-0x0;var _0x2ee795=_0x47a1[_0x4d6123];return _0x2ee795;};'use strict';var multer=require(_0x147a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x147a('0x1'));var express=require('express');var router=express[_0x147a('0x2')]();var auth=require(_0x147a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x147a('0x4'));var controller=require(_0x147a('0x5'));router[_0x147a('0x6')]('/',auth[_0x147a('0x7')](),controller[_0x147a('0x8')]);router['get'](_0x147a('0x9'),auth[_0x147a('0x7')](),controller[_0x147a('0xa')]);router[_0x147a('0x6')](_0x147a('0xb'),auth[_0x147a('0x7')](),controller[_0x147a('0xc')]);router['get'](_0x147a('0xd'),auth[_0x147a('0x7')](),controller['getMembers']);router[_0x147a('0x6')]('/:id/teams',auth[_0x147a('0x7')](),controller[_0x147a('0xe')]);router[_0x147a('0x6')]('/:id/users',auth[_0x147a('0x7')](),controller[_0x147a('0xf')]);router[_0x147a('0x10')]('/',auth['isAuthenticated'](),controller[_0x147a('0x11')]);router[_0x147a('0x10')](_0x147a('0x12'),auth[_0x147a('0x7')](),controller[_0x147a('0x13')]);router[_0x147a('0x10')](_0x147a('0x14'),auth[_0x147a('0x7')](),controller[_0x147a('0x15')]);router['put'](_0x147a('0xb'),auth['isAuthenticated'](),controller[_0x147a('0x16')]);router[_0x147a('0x17')](_0x147a('0xb'),auth[_0x147a('0x7')](),controller[_0x147a('0x18')]);router[_0x147a('0x17')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x147a('0x17')](_0x147a('0x14'),auth['isAuthenticated'](),controller[_0x147a('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 133b388..75075da 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 _0x114d=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x2304e5,_0x1697c0){var _0x5ed68d=function(_0x37ac62){while(--_0x37ac62){_0x2304e5['push'](_0x2304e5['shift']());}};_0x5ed68d(++_0x1697c0);}(_0x114d,0x144));var _0xd114=function(_0x868707,_0x2703dc){_0x868707=_0x868707-0x0;var _0x3892da=_0x114d[_0x868707];return _0x3892da;};'use strict';var Sequelize=require(_0xd114('0x0'));module[_0xd114('0x1')]={'name':{'type':Sequelize[_0xd114('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd114('0x2')]},'timeout':{'type':Sequelize[_0xd114('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd114('0x4')](_0xd114('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xa875=['ENUM','rrmemory','beepall','exports','STRING','name','INTEGER'];(function(_0x9f9f59,_0x4599e6){var _0x22d943=function(_0x36218a){while(--_0x36218a){_0x9f9f59['push'](_0x9f9f59['shift']());}};_0x22d943(++_0x4599e6);}(_0xa875,0x176));var _0x5a87=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xa875[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require('sequelize');module[_0x5a87('0x0')]={'name':{'type':Sequelize[_0x5a87('0x1')],'unique':_0x5a87('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5a87('0x1')]},'timeout':{'type':Sequelize[_0x5a87('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5a87('0x4')](_0x5a87('0x5'),_0x5a87('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index bc80c82..d59fe37 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 _0xd192=['ut.UserId\x20=\x20?','push','sequelize','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','update','then','destroy','OpenchannelQueues','UserProfileResource','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','count','includeAll','include','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','OpenchannelQueueId','options','User','UserId','createdAt','rows','%s/%s','openchannelPause','updatedAt','getTeams','findOne','Team','pick','addTeams','ids','findAll','Agents','online','voicePause','interface','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?'];(function(_0x5e08e1,_0x5841f2){var _0x82320e=function(_0x5ea8de){while(--_0x5ea8de){_0x5e08e1['push'](_0x5e08e1['shift']());}};_0x82320e(++_0x5841f2);}(_0xd192,0x1ad));var _0x2d19=function(_0x4282db,_0x5405a5){_0x4282db=_0x4282db-0x0;var _0x340588=_0xd192[_0x4282db];return _0x340588;};'use strict';var pdf=require(_0x2d19('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2d19('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d19('0x2'));var rp=require(_0x2d19('0x3'));var moment=require(_0x2d19('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2d19('0x5'));var util=require(_0x2d19('0x6'));var path=require('path');var sox=require(_0x2d19('0x7'));var csv=require(_0x2d19('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2d19('0x9'));var squel=require('squel');var crypto=require(_0x2d19('0xa'));var jsforce=require(_0x2d19('0xb'));var deskjs=require(_0x2d19('0xc'));var toCsv=require(_0x2d19('0x8'));var querystring=require(_0x2d19('0xd'));var Papa=require('papaparse');var Redis=require(_0x2d19('0xe'));var authService=require(_0x2d19('0xf'));var qs=require(_0x2d19('0x10'));var as=require(_0x2d19('0x11'));var hardwareService=require(_0x2d19('0x12'));var logger=require(_0x2d19('0x13'))(_0x2d19('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2d19('0x15'))['db'];config[_0x2d19('0x16')]=_[_0x2d19('0x17')](config[_0x2d19('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x2d19('0x18'))(new Redis(config[_0x2d19('0x16')]));require(_0x2d19('0x19'))[_0x2d19('0x1a')](socket);function respondWithStatusCode(_0x5cb5a1,_0x3d56a0){_0x3d56a0=_0x3d56a0||0xcc;return function(_0x505026){if(_0x505026){return _0x5cb5a1[_0x2d19('0x1b')](_0x3d56a0);}return _0x5cb5a1['status'](_0x3d56a0)[_0x2d19('0x1c')]();};}function respondWithResult(_0x45c18a,_0x3d254a){_0x3d254a=_0x3d254a||0xc8;return function(_0x2168b2){if(_0x2168b2){return _0x45c18a[_0x2d19('0x1d')](_0x3d254a)[_0x2d19('0x1e')](_0x2168b2);}};}function respondWithFilteredResult(_0x1601ef,_0x1f0dd9){return function(_0x53593a){if(_0x53593a){var _0x2fa9d9=_0x53593a['count'],_0x5dbf37=_0x1f0dd9[_0x2d19('0x1f')],_0x5dfaad=_0x1f0dd9['offset']+_0x1f0dd9[_0x2d19('0x20')],_0x3a2320;if(_0x5dfaad>=_0x2fa9d9){_0x5dfaad=_0x2fa9d9;_0x3a2320=0xc8;}else{_0x3a2320=0xce;}_0x1601ef['status'](_0x3a2320);return _0x1601ef[_0x2d19('0x21')](_0x2d19('0x22'),_0x5dbf37+'-'+_0x5dfaad+'/'+_0x2fa9d9)[_0x2d19('0x1e')](_0x53593a);}return null;};}function patchUpdates(_0x16f0a7){return function(_0x19de3f){try{jsonpatch['apply'](_0x19de3f,_0x16f0a7,!![]);}catch(_0x45c685){return BPromise[_0x2d19('0x23')](_0x45c685);}return _0x19de3f['save']();};}function saveUpdates(_0x4dd8fb,_0x443a17){return function(_0x4ab8f6){if(_0x4ab8f6){return _0x4ab8f6[_0x2d19('0x24')](_0x4dd8fb)[_0x2d19('0x25')](function(_0x4d23f1){return _0x4d23f1;});}return null;};}function removeEntity(_0x184c66,_0x50653d){return function(_0x5a8519){if(_0x5a8519){return _0x5a8519[_0x2d19('0x26')]()['then'](function(){var _0xf0aaff=_0x5a8519['get']({'plain':!![]});var _0x401864=_0x2d19('0x27');return db[_0x2d19('0x28')][_0x2d19('0x26')]({'where':{'type':_0x401864,'resourceId':_0xf0aaff['id']}})[_0x2d19('0x25')](function(){return _0x5a8519;});})[_0x2d19('0x25')](function(){_0x184c66[_0x2d19('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x377cf7,_0x12746b){return function(_0x81be0){if(!_0x81be0){_0x377cf7['sendStatus'](0x194);}return _0x81be0;};}function handleError(_0x2d1ea0,_0x56f494){_0x56f494=_0x56f494||0x1f4;return function(_0x39e4bc){logger['error'](_0x39e4bc[_0x2d19('0x29')]);if(_0x39e4bc[_0x2d19('0x2a')]){delete _0x39e4bc['name'];}_0x2d1ea0[_0x2d19('0x1d')](_0x56f494)[_0x2d19('0x2b')](_0x39e4bc);};}exports[_0x2d19('0x2c')]=function(_0x5ee360,_0x499427){var _0x303892={},_0x2b2777={},_0x546502={'count':0x0,'rows':[]};var _0x22834d=_[_0x2d19('0x2d')](db[_0x2d19('0x2e')][_0x2d19('0x2f')],function(_0x2b473e){return{'name':_0x2b473e[_0x2d19('0x30')],'type':_0x2b473e[_0x2d19('0x31')]['key']};});_0x2b2777['model']=_[_0x2d19('0x2d')](_0x22834d,_0x2d19('0x2a'));_0x2b2777[_0x2d19('0x32')]=_['keys'](_0x5ee360['query']);_0x2b2777[_0x2d19('0x33')]=_[_0x2d19('0x34')](_0x2b2777[_0x2d19('0x35')],_0x2b2777[_0x2d19('0x32')]);_0x303892[_0x2d19('0x36')]=_[_0x2d19('0x34')](_0x2b2777[_0x2d19('0x35')],qs['fields'](_0x5ee360[_0x2d19('0x32')][_0x2d19('0x37')]));_0x303892[_0x2d19('0x36')]=_0x303892['attributes'][_0x2d19('0x38')]?_0x303892[_0x2d19('0x36')]:_0x2b2777[_0x2d19('0x35')];if(!_0x5ee360[_0x2d19('0x32')][_0x2d19('0x39')](_0x2d19('0x3a'))){_0x303892[_0x2d19('0x20')]=qs[_0x2d19('0x20')](_0x5ee360[_0x2d19('0x32')][_0x2d19('0x20')]);_0x303892[_0x2d19('0x1f')]=qs['offset'](_0x5ee360[_0x2d19('0x32')]['offset']);}_0x303892[_0x2d19('0x3b')]=qs[_0x2d19('0x3c')](_0x5ee360[_0x2d19('0x32')]['sort']);_0x303892['where']=qs[_0x2d19('0x33')](_['pick'](_0x5ee360[_0x2d19('0x32')],_0x2b2777[_0x2d19('0x33')]));if(_0x5ee360[_0x2d19('0x32')][_0x2d19('0x3d')]){_0x303892[_0x2d19('0x3e')]=_[_0x2d19('0x3f')](_0x303892[_0x2d19('0x3e')],{'$or':_[_0x2d19('0x2d')](_0x22834d,function(_0x20c6a3){if(_0x20c6a3[_0x2d19('0x31')]!==_0x2d19('0x40')){var _0x927441={};_0x927441[_0x20c6a3[_0x2d19('0x2a')]]={'$like':'%'+_0x5ee360[_0x2d19('0x32')][_0x2d19('0x3d')]+'%'};return _0x927441;}})});}_0x303892=_['merge']({},_0x303892,_0x5ee360['options']);var _0x187724={'where':_0x303892[_0x2d19('0x3e')]};return db['OpenchannelQueue'][_0x2d19('0x41')](_0x187724)['then'](function(_0x25b1a3){_0x546502['count']=_0x25b1a3;if(_0x5ee360[_0x2d19('0x32')][_0x2d19('0x42')]){_0x303892[_0x2d19('0x43')]=[{'all':!![]}];}return db[_0x2d19('0x2e')]['findAll'](_0x303892);})['then'](function(_0x3e1959){_0x546502['rows']=_0x3e1959;return _0x546502;})[_0x2d19('0x25')](respondWithFilteredResult(_0x499427,_0x303892))[_0x2d19('0x44')](handleError(_0x499427,null));};exports[_0x2d19('0x45')]=function(_0x228b47,_0x4673d8){var _0x182734={'raw':!![],'where':{'id':_0x228b47[_0x2d19('0x46')]['id']}},_0x465083={};_0x465083[_0x2d19('0x35')]=_[_0x2d19('0x47')](db[_0x2d19('0x2e')][_0x2d19('0x2f')]);_0x465083[_0x2d19('0x32')]=_[_0x2d19('0x47')](_0x228b47[_0x2d19('0x32')]);_0x465083[_0x2d19('0x33')]=_[_0x2d19('0x34')](_0x465083['model'],_0x465083['query']);_0x182734['attributes']=_[_0x2d19('0x34')](_0x465083[_0x2d19('0x35')],qs['fields'](_0x228b47[_0x2d19('0x32')][_0x2d19('0x37')]));_0x182734[_0x2d19('0x36')]=_0x182734[_0x2d19('0x36')][_0x2d19('0x38')]?_0x182734[_0x2d19('0x36')]:_0x465083[_0x2d19('0x35')];if(_0x228b47[_0x2d19('0x32')][_0x2d19('0x42')]){_0x182734['include']=[{'all':!![]}];}_0x182734=_[_0x2d19('0x3f')]({},_0x182734,_0x228b47['options']);return db[_0x2d19('0x2e')][_0x2d19('0x48')](_0x182734)[_0x2d19('0x25')](handleEntityNotFound(_0x4673d8,null))[_0x2d19('0x25')](respondWithResult(_0x4673d8,null))[_0x2d19('0x44')](handleError(_0x4673d8,null));};exports['create']=function(_0xf0cdfc,_0x47fdc7){return db[_0x2d19('0x2e')][_0x2d19('0x49')](_0xf0cdfc[_0x2d19('0x4a')],{})[_0x2d19('0x25')](function(_0x51aa32){var _0x5bd8ee=_0xf0cdfc[_0x2d19('0x4b')]['get']({'plain':!![]});if(!_0x5bd8ee)throw new Error(_0x2d19('0x4c'));if(_0x5bd8ee['role']===_0x2d19('0x4b')){var _0x428dd2=_0x51aa32[_0x2d19('0x4d')]({'plain':!![]});var _0x33319b='OpenchannelQueues';return db[_0x2d19('0x4e')]['find']({'where':{'name':_0x33319b,'userProfileId':_0x5bd8ee['userProfileId']},'raw':!![]})[_0x2d19('0x25')](function(_0x2963ee){if(_0x2963ee&&_0x2963ee[_0x2d19('0x4f')]===0x0){return db[_0x2d19('0x28')][_0x2d19('0x49')]({'name':_0x428dd2['name'],'resourceId':_0x428dd2['id'],'type':_0x2963ee[_0x2d19('0x2a')],'sectionId':_0x2963ee['id']},{})[_0x2d19('0x25')](function(){return _0x51aa32;});}else{return _0x51aa32;}})[_0x2d19('0x44')](function(_0x2acec9){logger[_0x2d19('0x50')](_0x2d19('0x51'),_0x2acec9);throw _0x2acec9;});}return _0x51aa32;})[_0x2d19('0x25')](respondWithResult(_0x47fdc7,0xc9))[_0x2d19('0x44')](handleError(_0x47fdc7,null));};exports['update']=function(_0x4e8076,_0x3dbb7c){if(_0x4e8076[_0x2d19('0x4a')]['id']){delete _0x4e8076[_0x2d19('0x4a')]['id'];}return db[_0x2d19('0x2e')][_0x2d19('0x48')]({'where':{'id':_0x4e8076[_0x2d19('0x46')]['id']}})[_0x2d19('0x25')](handleEntityNotFound(_0x3dbb7c,null))[_0x2d19('0x25')](saveUpdates(_0x4e8076['body'],null))[_0x2d19('0x25')](respondWithResult(_0x3dbb7c,null))[_0x2d19('0x44')](handleError(_0x3dbb7c,null));};exports[_0x2d19('0x26')]=function(_0x1e78b2,_0x3cb539){return db[_0x2d19('0x2e')][_0x2d19('0x48')]({'where':{'id':_0x1e78b2['params']['id']}})[_0x2d19('0x25')](handleEntityNotFound(_0x3cb539,null))[_0x2d19('0x25')](removeEntity(_0x3cb539,null))[_0x2d19('0x44')](handleError(_0x3cb539,null));};exports[_0x2d19('0x52')]=function(_0x371601,_0x40f0be){return db[_0x2d19('0x2e')][_0x2d19('0x52')]()[_0x2d19('0x25')](respondWithResult(_0x40f0be,null))['catch'](handleError(_0x40f0be,null));};exports[_0x2d19('0x53')]=function(_0x58d2ca,_0x52d768,_0x5210a2){var _0x1ce8b0={'raw':!![],'where':{}},_0x2eabfd={},_0x5c39bf;return db[_0x2d19('0x2e')]['findOne']({'where':{'id':_0x58d2ca['params']['id']}})[_0x2d19('0x25')](handleEntityNotFound(_0x52d768,null))[_0x2d19('0x25')](function(_0x124227){if(_0x124227){_0x5c39bf=_0x124227[_0x2d19('0x4d')]({'plain':!![]});_0x2eabfd[_0x2d19('0x35')]=_[_0x2d19('0x47')](db[_0x2d19('0x54')]['rawAttributes']);_0x2eabfd[_0x2d19('0x32')]=_['keys'](_0x58d2ca[_0x2d19('0x32')]);_0x2eabfd[_0x2d19('0x33')]=_[_0x2d19('0x34')](_0x2eabfd['model'],_0x2eabfd[_0x2d19('0x32')]);_0x1ce8b0[_0x2d19('0x36')]=_[_0x2d19('0x34')](_0x2eabfd['model'],qs[_0x2d19('0x37')](_0x58d2ca['query'][_0x2d19('0x37')]));_0x1ce8b0[_0x2d19('0x36')]=_0x1ce8b0[_0x2d19('0x36')][_0x2d19('0x38')]?_0x1ce8b0[_0x2d19('0x36')]:_0x2eabfd[_0x2d19('0x35')];if(!_0x58d2ca[_0x2d19('0x32')]['hasOwnProperty'](_0x2d19('0x3a'))){_0x1ce8b0[_0x2d19('0x20')]=qs['limit'](_0x58d2ca[_0x2d19('0x32')][_0x2d19('0x20')]);_0x1ce8b0['offset']=qs[_0x2d19('0x1f')](_0x58d2ca[_0x2d19('0x32')][_0x2d19('0x1f')]);}_0x1ce8b0[_0x2d19('0x3b')]=qs[_0x2d19('0x3c')](_0x58d2ca['query'][_0x2d19('0x3c')]);_0x1ce8b0[_0x2d19('0x3e')]=qs[_0x2d19('0x33')](_['pick'](_0x58d2ca[_0x2d19('0x32')],_0x2eabfd['filters']));_0x1ce8b0[_0x2d19('0x3e')][_0x2d19('0x55')]=_0x124227['id'];if(_0x58d2ca[_0x2d19('0x32')][_0x2d19('0x3d')]){_0x1ce8b0[_0x2d19('0x3e')]=_[_0x2d19('0x3f')](_0x1ce8b0[_0x2d19('0x3e')],{'$or':_[_0x2d19('0x2d')](_0x1ce8b0['attributes'],function(_0x1afae8){var _0x3470b3={};_0x3470b3[_0x1afae8]={'$like':'%'+_0x58d2ca[_0x2d19('0x32')][_0x2d19('0x3d')]+'%'};return _0x3470b3;})});}_0x1ce8b0=_[_0x2d19('0x3f')]({},_0x1ce8b0,_0x58d2ca[_0x2d19('0x56')]);return db['UserOpenchannelQueue']['findAll'](_0x1ce8b0);}})['then'](function(_0x1834d0){if(_0x1834d0){return db[_0x2d19('0x57')]['findAndCountAll']({'where':{'id':_[_0x2d19('0x2d')](_0x1834d0,_0x2d19('0x58')),'role':'agent'},'attributes':['id',_0x2d19('0x2a'),'openchannelPause','updatedAt',_0x2d19('0x59')]});}})[_0x2d19('0x25')](function(_0x42fd0f){if(_0x42fd0f){return{'count':_0x42fd0f[_0x2d19('0x41')],'rows':_[_0x2d19('0x2d')](_0x42fd0f[_0x2d19('0x5a')],function(_0x2422f0){return{'membername':_0x2422f0[_0x2d19('0x2a')],'UserId':_0x2422f0['id'],'queue_name':_0x5c39bf[_0x2d19('0x2a')],'OpenchannelQueueId':_0x5c39bf['id'],'interface':util['format'](_0x2d19('0x5b'),'SIP',_0x2422f0[_0x2d19('0x2a')]),'penalty':0x0,'paused':_0x2422f0[_0x2d19('0x5c')],'createdAt':_0x2422f0[_0x2d19('0x59')],'updatedAt':_0x2422f0[_0x2d19('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2d19('0x25')](respondWithFilteredResult(_0x52d768,_0x1ce8b0))[_0x2d19('0x44')](handleError(_0x52d768,null));};exports[_0x2d19('0x5e')]=function(_0x4c82c1,_0x53af02,_0x86f039){var _0x5a69ff={};var _0x417f4f={};var _0x1b80ee;var _0x6b3174;return db[_0x2d19('0x2e')][_0x2d19('0x5f')]({'where':{'id':_0x4c82c1[_0x2d19('0x46')]['id']}})[_0x2d19('0x25')](handleEntityNotFound(_0x53af02,null))['then'](function(_0x53bec8){if(_0x53bec8){_0x1b80ee=_0x53bec8;_0x417f4f[_0x2d19('0x35')]=_[_0x2d19('0x47')](db[_0x2d19('0x60')][_0x2d19('0x2f')]);_0x417f4f[_0x2d19('0x32')]=_['keys'](_0x4c82c1[_0x2d19('0x32')]);_0x417f4f[_0x2d19('0x33')]=_[_0x2d19('0x34')](_0x417f4f[_0x2d19('0x35')],_0x417f4f[_0x2d19('0x32')]);_0x5a69ff[_0x2d19('0x36')]=_['intersection'](_0x417f4f[_0x2d19('0x35')],qs['fields'](_0x4c82c1[_0x2d19('0x32')][_0x2d19('0x37')]));_0x5a69ff[_0x2d19('0x36')]=_0x5a69ff[_0x2d19('0x36')][_0x2d19('0x38')]?_0x5a69ff[_0x2d19('0x36')]:_0x417f4f[_0x2d19('0x35')];_0x5a69ff[_0x2d19('0x3b')]=qs[_0x2d19('0x3c')](_0x4c82c1[_0x2d19('0x32')][_0x2d19('0x3c')]);_0x5a69ff[_0x2d19('0x3e')]=qs['filters'](_[_0x2d19('0x61')](_0x4c82c1[_0x2d19('0x32')],_0x417f4f[_0x2d19('0x33')]));if(_0x4c82c1[_0x2d19('0x32')]['filter']){_0x5a69ff[_0x2d19('0x3e')]=_[_0x2d19('0x3f')](_0x5a69ff['where'],{'$or':_[_0x2d19('0x2d')](_0x5a69ff['attributes'],function(_0x457a37){var _0xae18d2={};_0xae18d2[_0x457a37]={'$like':'%'+_0x4c82c1[_0x2d19('0x32')][_0x2d19('0x3d')]+'%'};return _0xae18d2;})});}_0x5a69ff=_['merge']({},_0x5a69ff,_0x4c82c1[_0x2d19('0x56')]);return _0x1b80ee['getTeams'](_0x5a69ff);}})[_0x2d19('0x25')](function(_0x2ae280){if(_0x2ae280){_0x6b3174=_0x2ae280['length'];if(!_0x4c82c1[_0x2d19('0x32')]['hasOwnProperty'](_0x2d19('0x3a'))){_0x5a69ff[_0x2d19('0x20')]=qs['limit'](_0x4c82c1['query']['limit']);_0x5a69ff[_0x2d19('0x1f')]=qs[_0x2d19('0x1f')](_0x4c82c1[_0x2d19('0x32')][_0x2d19('0x1f')]);}return _0x1b80ee[_0x2d19('0x5e')](_0x5a69ff);}})['then'](function(_0x15aa53){if(_0x15aa53){return _0x15aa53?{'count':_0x6b3174,'rows':_0x15aa53}:null;}})[_0x2d19('0x25')](respondWithResult(_0x53af02,null))[_0x2d19('0x44')](handleError(_0x53af02,null));};exports[_0x2d19('0x62')]=function(_0x35884f,_0x1002d5,_0x317e4a){var _0x3d5aa0=_0x35884f[_0x2d19('0x4a')][_0x2d19('0x63')];return db[_0x2d19('0x60')][_0x2d19('0x64')]({'where':{'id':_0x3d5aa0},'attributes':['id'],'include':[{'model':db[_0x2d19('0x57')],'as':_0x2d19('0x65'),'attributes':['id','name',_0x2d19('0x66'),_0x2d19('0x67'),_0x2d19('0x68')],'raw':!![]}]})[_0x2d19('0x25')](function(_0x50bdf4){if(_0x50bdf4){var _0x3beddc=_['flatMap'](_0x50bdf4,function(_0x10ce58){var _0x505241=_0x10ce58[_0x2d19('0x4d')]({'plain':!![]});return _0x505241[_0x2d19('0x65')];});return db[_0x2d19('0x2e')][_0x2d19('0x48')]({'where':{'id':_0x35884f[_0x2d19('0x46')]['id']}})[_0x2d19('0x25')](function(_0x300895){return db['sequelize'][_0x2d19('0x69')](function(_0x58fa23){return _0x300895[_0x2d19('0x62')](_0x3d5aa0,{'transaction':_0x58fa23})[_0x2d19('0x25')](function(){return BPromise[_0x2d19('0x6a')](_0x3beddc,function(_0x18526c){return db[_0x2d19('0x54')][_0x2d19('0x6b')]({'where':{'UserId':_0x18526c['id'],'OpenchannelQueueId':_0x35884f['params']['id']},'transaction':_0x58fa23});});})['then'](function(){_0x3beddc['forEach'](function(_0x258e00){socket[_0x2d19('0x6c')](_0x2d19('0x6d'),{'UserId':_0x258e00['id'],'OpenchannelQueueId':_0x300895['id']});});});});});}})['then'](respondWithStatusCode(_0x1002d5,null))[_0x2d19('0x44')](handleError(_0x1002d5,null));};exports[_0x2d19('0x6e')]=function(_0x43b36e,_0x3c2fec,_0x3407db){return db[_0x2d19('0x60')]['findAll']({'where':{'id':_0x43b36e[_0x2d19('0x32')][_0x2d19('0x63')]},'attributes':['id'],'include':[{'model':db[_0x2d19('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2d19('0x25')](handleEntityNotFound(_0x3c2fec,null))[_0x2d19('0x25')](function(_0x4a4c72){var _0x40ce02=_[_0x2d19('0x2d')](_0x4a4c72,'id');var _0x52d67c=[];var _0x4d82b2=[];var _0x3e7c41=squel[_0x2d19('0x6f')]();_0x3e7c41[_0x2d19('0x70')](_0x2d19('0x71'))[_0x2d19('0x72')](_0x2d19('0x73'),'tq')['join'](_0x2d19('0x74'),'ut',_0x2d19('0x75'))[_0x2d19('0x3e')](_0x2d19('0x76'),_0x43b36e[_0x2d19('0x46')]['id']);for(var _0xac9b4a=0x0;_0xac9b4a<_0x4a4c72[_0x2d19('0x38')];_0xac9b4a+=0x1){let _0x487f5d=_0x4a4c72[_0xac9b4a];for(var _0x588218=0x0;_0x588218<_0x487f5d[_0x2d19('0x65')]['length'];_0x588218+=0x1){let _0x398149=_0x487f5d[_0x2d19('0x65')][_0x588218];var _0x597fa7=_0x3e7c41['clone']();_0x597fa7['where'](_0x2d19('0x77'),_0x398149['id']);_0x4d82b2[_0x2d19('0x78')](db['sequelize'][_0x2d19('0x32')](_0x597fa7['toString'](),{'type':db[_0x2d19('0x79')][_0x2d19('0x7a')]['SELECT']})[_0x2d19('0x25')](function(_0x24ef8e){if(_0x24ef8e[_0x2d19('0x38')]===0x1){return _0x398149['id'];}else{var _0x42687d=_[_0x2d19('0x7b')](_[_0x2d19('0x2d')](_0x24ef8e,_0x2d19('0x7c')),function(_0x4c9e9f){return _[_0x2d19('0x7d')](_0x40ce02,_0x4c9e9f);});if(_0x42687d){return _0x398149['id'];}}}));}}return BPromise[_0x2d19('0x7e')](_0x4d82b2)[_0x2d19('0x25')](function(_0x55965e){_0x52d67c=_(_0x52d67c)['union'](_0x55965e)[_0x2d19('0x7f')]()[_0x2d19('0x80')]();return db['OpenchannelQueue'][_0x2d19('0x48')]({'where':{'id':_0x43b36e[_0x2d19('0x46')]['id']}})[_0x2d19('0x25')](function(_0x13b9a8){return db[_0x2d19('0x79')][_0x2d19('0x69')](function(_0x3e972a){return _0x13b9a8[_0x2d19('0x6e')](_0x43b36e[_0x2d19('0x32')]['ids'],{'transaction':_0x3e972a})[_0x2d19('0x25')](function(){if(!_[_0x2d19('0x81')](_0x52d67c)){return _0x13b9a8[_0x2d19('0x82')](_0x52d67c,{'transaction':_0x3e972a});}})['then'](function(){_0x52d67c[_0x2d19('0x83')](function(_0x1843b4){socket[_0x2d19('0x6c')](_0x2d19('0x84'),{'UserId':_0x1843b4,'OpenchannelQueueId':_0x13b9a8['id']});});});});});});})['then'](respondWithStatusCode(_0x3c2fec,null))[_0x2d19('0x44')](handleError(_0x3c2fec,null));};exports[_0x2d19('0x85')]=function(_0x38331a,_0x154e8f,_0x2d24d3){return db[_0x2d19('0x2e')][_0x2d19('0x48')]({'where':{'id':_0x38331a[_0x2d19('0x46')]['id']}})[_0x2d19('0x25')](handleEntityNotFound(_0x154e8f,null))[_0x2d19('0x25')](function(_0x2478a6){if(_0x2478a6){return _0x2478a6[_0x2d19('0x85')](_0x38331a['body']['ids'],_[_0x2d19('0x86')](_0x38331a[_0x2d19('0x4a')],[_0x2d19('0x63'),'id'])||{})[_0x2d19('0x87')](function(_0x298ca9){for(var _0xf36c44=0x0;_0xf36c44<_0x38331a['body'][_0x2d19('0x63')][_0x2d19('0x38')];_0xf36c44+=0x1){socket['emit'](_0x2d19('0x6d'),{'UserId':_0x38331a[_0x2d19('0x4a')][_0x2d19('0x63')][_0xf36c44],'OpenchannelQueueId':_0x38331a['params']['id']});}return _0x298ca9;});}})[_0x2d19('0x25')](respondWithResult(_0x154e8f,null))[_0x2d19('0x44')](handleError(_0x154e8f,null));};exports[_0x2d19('0x82')]=function(_0xd2af35,_0x5cc201,_0x3c10e2){return db['OpenchannelQueue'][_0x2d19('0x48')]({'where':{'id':_0xd2af35[_0x2d19('0x46')]['id']}})[_0x2d19('0x25')](handleEntityNotFound(_0x5cc201,null))[_0x2d19('0x25')](function(_0x47b631){if(_0x47b631){return _0x47b631[_0x2d19('0x82')](_0xd2af35[_0x2d19('0x32')][_0x2d19('0x63')])[_0x2d19('0x25')](function(){if(_['isArray'](_0xd2af35[_0x2d19('0x32')][_0x2d19('0x63')])){for(var _0x29a52b=0x0;_0x29a52b<_0xd2af35[_0x2d19('0x32')]['ids'][_0x2d19('0x38')];_0x29a52b+=0x1){socket[_0x2d19('0x6c')]('userOpenchannelQueue:remove',{'UserId':Number(_0xd2af35[_0x2d19('0x32')][_0x2d19('0x63')][_0x29a52b]),'OpenchannelQueueId':Number(_0xd2af35[_0x2d19('0x46')]['id'])});}}else{socket[_0x2d19('0x6c')](_0x2d19('0x84'),{'UserId':Number(_0xd2af35[_0x2d19('0x32')]['ids']),'OpenchannelQueueId':Number(_0xd2af35[_0x2d19('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x5cc201,null))[_0x2d19('0x44')](handleError(_0x5cc201,null));};exports['getAgents']=function(_0x1944aa,_0x2ac0e4,_0x243d66){var _0x35ae08={};var _0x256e9c={};var _0x27ca71;var _0x3ca9c1;return db[_0x2d19('0x2e')]['findOne']({'where':{'id':_0x1944aa[_0x2d19('0x46')]['id']}})[_0x2d19('0x25')](handleEntityNotFound(_0x2ac0e4,null))[_0x2d19('0x25')](function(_0xbac94e){if(_0xbac94e){_0x27ca71=_0xbac94e;_0x256e9c[_0x2d19('0x35')]=_['keys'](db[_0x2d19('0x57')][_0x2d19('0x2f')]);_0x256e9c[_0x2d19('0x32')]=_[_0x2d19('0x47')](_0x1944aa[_0x2d19('0x32')]);_0x256e9c['filters']=_[_0x2d19('0x34')](_0x256e9c[_0x2d19('0x35')],_0x256e9c[_0x2d19('0x32')]);_0x35ae08[_0x2d19('0x36')]=_[_0x2d19('0x34')](_0x256e9c['model'],qs[_0x2d19('0x37')](_0x1944aa[_0x2d19('0x32')][_0x2d19('0x37')]));_0x35ae08[_0x2d19('0x36')]=_0x35ae08[_0x2d19('0x36')]['length']?_0x35ae08[_0x2d19('0x36')]:_0x256e9c[_0x2d19('0x35')];_0x35ae08[_0x2d19('0x3b')]=qs[_0x2d19('0x3c')](_0x1944aa[_0x2d19('0x32')][_0x2d19('0x3c')]);_0x35ae08['where']=qs[_0x2d19('0x33')](_[_0x2d19('0x61')](_0x1944aa[_0x2d19('0x32')],_0x256e9c[_0x2d19('0x33')]));if(_0x1944aa['query'][_0x2d19('0x3d')]){_0x35ae08[_0x2d19('0x3e')]=_['merge'](_0x35ae08[_0x2d19('0x3e')],{'$or':_[_0x2d19('0x2d')](_0x35ae08['attributes'],function(_0x6f13a9){var _0x2bd09e={};_0x2bd09e[_0x6f13a9]={'$like':'%'+_0x1944aa[_0x2d19('0x32')]['filter']+'%'};return _0x2bd09e;})});}_0x35ae08=_[_0x2d19('0x3f')]({},_0x35ae08,_0x1944aa[_0x2d19('0x56')]);return _0x27ca71[_0x2d19('0x88')](_0x35ae08);}})[_0x2d19('0x25')](function(_0x4c2bfe){if(_0x4c2bfe){_0x3ca9c1=_0x4c2bfe[_0x2d19('0x38')];if(!_0x1944aa['query'][_0x2d19('0x39')]('nolimit')){_0x35ae08['limit']=qs[_0x2d19('0x20')](_0x1944aa[_0x2d19('0x32')]['limit']);_0x35ae08['offset']=qs[_0x2d19('0x1f')](_0x1944aa[_0x2d19('0x32')][_0x2d19('0x1f')]);}return _0x27ca71[_0x2d19('0x88')](_0x35ae08);}})[_0x2d19('0x25')](function(_0x39f7a1){if(_0x39f7a1){return _0x39f7a1?{'count':_0x3ca9c1,'rows':_0x39f7a1}:null;}})[_0x2d19('0x25')](respondWithResult(_0x2ac0e4,null))[_0x2d19('0x44')](handleError(_0x2ac0e4,null));}; \ No newline at end of file +var _0x3612=['updatedAt','createdAt','format','SIP','Team','getTeams','Agents','online','voicePause','flatMap','each','findOrCreate','forEach','emit','removeTeams','ids','User','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','includes','union','compact','value','transaction','isEmpty','addAgents','omit','spread','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','get','OpenchannelQueues','UserProfileResource','error','name','index','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','OpenchannelQueue','includeAll','include','findAll','rows','catch','params','keys','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','OpenchannelQueueId','UserOpenchannelQueue','findAndCountAll','UserId','openchannelPause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3612,0x1ca));var _0x2361=function(_0x385c76,_0xb97335){_0x385c76=_0x385c76-0x0;var _0x5c8367=_0x3612[_0x385c76];return _0x5c8367;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2361('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2361('0x1'));var rp=require(_0x2361('0x2'));var moment=require('moment');var BPromise=require(_0x2361('0x3'));var Mustache=require(_0x2361('0x4'));var util=require(_0x2361('0x5'));var path=require(_0x2361('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2361('0x7'));var squel=require(_0x2361('0x8'));var crypto=require(_0x2361('0x9'));var jsforce=require(_0x2361('0xa'));var deskjs=require(_0x2361('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2361('0xc'));var Papa=require(_0x2361('0xd'));var Redis=require(_0x2361('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2361('0xf'));var as=require(_0x2361('0x10'));var hardwareService=require(_0x2361('0x11'));var logger=require('../../config/logger')(_0x2361('0x12'));var utils=require(_0x2361('0x13'));var config=require(_0x2361('0x14'));var db=require(_0x2361('0x15'))['db'];config[_0x2361('0x16')]=_[_0x2361('0x17')](config[_0x2361('0x16')],{'host':_0x2361('0x18'),'port':0x18eb});var socket=require(_0x2361('0x19'))(new Redis(config[_0x2361('0x16')]));require(_0x2361('0x1a'))[_0x2361('0x1b')](socket);function respondWithStatusCode(_0x36d93f,_0x567998){_0x567998=_0x567998||0xcc;return function(_0x13610a){if(_0x13610a){return _0x36d93f[_0x2361('0x1c')](_0x567998);}return _0x36d93f['status'](_0x567998)[_0x2361('0x1d')]();};}function respondWithResult(_0x3aafb5,_0x54feef){_0x54feef=_0x54feef||0xc8;return function(_0x47ddc2){if(_0x47ddc2){return _0x3aafb5[_0x2361('0x1e')](_0x54feef)[_0x2361('0x1f')](_0x47ddc2);}};}function respondWithFilteredResult(_0x475b64,_0x29b927){return function(_0x2079ed){if(_0x2079ed){var _0x334c0b=_0x2079ed[_0x2361('0x20')],_0x133c6b=_0x29b927[_0x2361('0x21')],_0x15a72c=_0x29b927['offset']+_0x29b927[_0x2361('0x22')],_0x295117;if(_0x15a72c>=_0x334c0b){_0x15a72c=_0x334c0b;_0x295117=0xc8;}else{_0x295117=0xce;}_0x475b64[_0x2361('0x1e')](_0x295117);return _0x475b64[_0x2361('0x23')](_0x2361('0x24'),_0x133c6b+'-'+_0x15a72c+'/'+_0x334c0b)[_0x2361('0x1f')](_0x2079ed);}return null;};}function patchUpdates(_0x13b3c8){return function(_0xd9faa0){try{jsonpatch['apply'](_0xd9faa0,_0x13b3c8,!![]);}catch(_0x4c35b0){return BPromise[_0x2361('0x25')](_0x4c35b0);}return _0xd9faa0[_0x2361('0x26')]();};}function saveUpdates(_0x97e9e0,_0x230973){return function(_0x157a2d){if(_0x157a2d){return _0x157a2d[_0x2361('0x27')](_0x97e9e0)['then'](function(_0x38acc4){return _0x38acc4;});}return null;};}function removeEntity(_0x29bb5a,_0x514ce8){return function(_0x4dbd47){if(_0x4dbd47){return _0x4dbd47[_0x2361('0x28')]()[_0x2361('0x29')](function(){var _0x1f8cc7=_0x4dbd47[_0x2361('0x2a')]({'plain':!![]});var _0x2be1c5=_0x2361('0x2b');return db[_0x2361('0x2c')][_0x2361('0x28')]({'where':{'type':_0x2be1c5,'resourceId':_0x1f8cc7['id']}})[_0x2361('0x29')](function(){return _0x4dbd47;});})[_0x2361('0x29')](function(){_0x29bb5a[_0x2361('0x1e')](0xcc)[_0x2361('0x1d')]();});}};}function handleEntityNotFound(_0x32b56e,_0xa71689){return function(_0x4399ca){if(!_0x4399ca){_0x32b56e[_0x2361('0x1c')](0x194);}return _0x4399ca;};}function handleError(_0x3b2d1a,_0x46abcd){_0x46abcd=_0x46abcd||0x1f4;return function(_0xbab54a){logger[_0x2361('0x2d')](_0xbab54a['stack']);if(_0xbab54a['name']){delete _0xbab54a[_0x2361('0x2e')];}_0x3b2d1a[_0x2361('0x1e')](_0x46abcd)['send'](_0xbab54a);};}exports[_0x2361('0x2f')]=function(_0x52b7f9,_0x3806b7){var _0x2bfd32={},_0x451483={},_0x172e10={'count':0x0,'rows':[]};var _0x4a39c0=_['map'](db['OpenchannelQueue'][_0x2361('0x30')],function(_0x201cd4){return{'name':_0x201cd4[_0x2361('0x31')],'type':_0x201cd4['type'][_0x2361('0x32')]};});_0x451483['model']=_[_0x2361('0x33')](_0x4a39c0,_0x2361('0x2e'));_0x451483[_0x2361('0x34')]=_['keys'](_0x52b7f9[_0x2361('0x34')]);_0x451483[_0x2361('0x35')]=_[_0x2361('0x36')](_0x451483[_0x2361('0x37')],_0x451483['query']);_0x2bfd32[_0x2361('0x38')]=_[_0x2361('0x36')](_0x451483[_0x2361('0x37')],qs['fields'](_0x52b7f9[_0x2361('0x34')][_0x2361('0x39')]));_0x2bfd32[_0x2361('0x38')]=_0x2bfd32[_0x2361('0x38')][_0x2361('0x3a')]?_0x2bfd32[_0x2361('0x38')]:_0x451483[_0x2361('0x37')];if(!_0x52b7f9[_0x2361('0x34')][_0x2361('0x3b')](_0x2361('0x3c'))){_0x2bfd32['limit']=qs['limit'](_0x52b7f9[_0x2361('0x34')][_0x2361('0x22')]);_0x2bfd32[_0x2361('0x21')]=qs[_0x2361('0x21')](_0x52b7f9[_0x2361('0x34')]['offset']);}_0x2bfd32[_0x2361('0x3d')]=qs[_0x2361('0x3e')](_0x52b7f9[_0x2361('0x34')][_0x2361('0x3e')]);_0x2bfd32[_0x2361('0x3f')]=qs[_0x2361('0x35')](_[_0x2361('0x40')](_0x52b7f9['query'],_0x451483[_0x2361('0x35')]));if(_0x52b7f9[_0x2361('0x34')][_0x2361('0x41')]){_0x2bfd32[_0x2361('0x3f')]=_[_0x2361('0x42')](_0x2bfd32[_0x2361('0x3f')],{'$or':_[_0x2361('0x33')](_0x4a39c0,function(_0x4b7a55){if(_0x4b7a55[_0x2361('0x43')]!==_0x2361('0x44')){var _0x3eb14d={};_0x3eb14d[_0x4b7a55[_0x2361('0x2e')]]={'$like':'%'+_0x52b7f9['query'][_0x2361('0x41')]+'%'};return _0x3eb14d;}})});}_0x2bfd32=_[_0x2361('0x42')]({},_0x2bfd32,_0x52b7f9[_0x2361('0x45')]);var _0x578d42={'where':_0x2bfd32[_0x2361('0x3f')]};return db[_0x2361('0x46')][_0x2361('0x20')](_0x578d42)[_0x2361('0x29')](function(_0x45ab1c){_0x172e10[_0x2361('0x20')]=_0x45ab1c;if(_0x52b7f9['query'][_0x2361('0x47')]){_0x2bfd32[_0x2361('0x48')]=[{'all':!![]}];}return db[_0x2361('0x46')][_0x2361('0x49')](_0x2bfd32);})['then'](function(_0x1b7d6e){_0x172e10[_0x2361('0x4a')]=_0x1b7d6e;return _0x172e10;})['then'](respondWithFilteredResult(_0x3806b7,_0x2bfd32))[_0x2361('0x4b')](handleError(_0x3806b7,null));};exports['show']=function(_0x4ca461,_0x3b5a25){var _0x53a4b8={'raw':!![],'where':{'id':_0x4ca461[_0x2361('0x4c')]['id']}},_0x45b328={};_0x45b328[_0x2361('0x37')]=_[_0x2361('0x4d')](db[_0x2361('0x46')][_0x2361('0x30')]);_0x45b328[_0x2361('0x34')]=_[_0x2361('0x4d')](_0x4ca461[_0x2361('0x34')]);_0x45b328[_0x2361('0x35')]=_[_0x2361('0x36')](_0x45b328[_0x2361('0x37')],_0x45b328[_0x2361('0x34')]);_0x53a4b8[_0x2361('0x38')]=_['intersection'](_0x45b328[_0x2361('0x37')],qs['fields'](_0x4ca461[_0x2361('0x34')][_0x2361('0x39')]));_0x53a4b8[_0x2361('0x38')]=_0x53a4b8[_0x2361('0x38')][_0x2361('0x3a')]?_0x53a4b8[_0x2361('0x38')]:_0x45b328[_0x2361('0x37')];if(_0x4ca461[_0x2361('0x34')]['includeAll']){_0x53a4b8[_0x2361('0x48')]=[{'all':!![]}];}_0x53a4b8=_[_0x2361('0x42')]({},_0x53a4b8,_0x4ca461['options']);return db[_0x2361('0x46')][_0x2361('0x4e')](_0x53a4b8)[_0x2361('0x29')](handleEntityNotFound(_0x3b5a25,null))['then'](respondWithResult(_0x3b5a25,null))['catch'](handleError(_0x3b5a25,null));};exports['create']=function(_0x18d199,_0x5865f6){return db[_0x2361('0x46')]['create'](_0x18d199[_0x2361('0x4f')],{})[_0x2361('0x29')](function(_0x28e417){var _0x4b954b=_0x18d199['user'][_0x2361('0x2a')]({'plain':!![]});if(!_0x4b954b)throw new Error(_0x2361('0x50'));if(_0x4b954b['role']===_0x2361('0x51')){var _0x431af5=_0x28e417[_0x2361('0x2a')]({'plain':!![]});var _0x3454cf=_0x2361('0x2b');return db[_0x2361('0x52')][_0x2361('0x4e')]({'where':{'name':_0x3454cf,'userProfileId':_0x4b954b[_0x2361('0x53')]},'raw':!![]})[_0x2361('0x29')](function(_0x368060){if(_0x368060&&_0x368060[_0x2361('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x431af5[_0x2361('0x2e')],'resourceId':_0x431af5['id'],'type':_0x368060['name'],'sectionId':_0x368060['id']},{})[_0x2361('0x29')](function(){return _0x28e417;});}else{return _0x28e417;}})[_0x2361('0x4b')](function(_0x2c0594){logger['error'](_0x2361('0x55'),_0x2c0594);throw _0x2c0594;});}return _0x28e417;})[_0x2361('0x29')](respondWithResult(_0x5865f6,0xc9))[_0x2361('0x4b')](handleError(_0x5865f6,null));};exports['update']=function(_0x759b2b,_0x1f386f){if(_0x759b2b[_0x2361('0x4f')]['id']){delete _0x759b2b[_0x2361('0x4f')]['id'];}return db[_0x2361('0x46')][_0x2361('0x4e')]({'where':{'id':_0x759b2b['params']['id']}})[_0x2361('0x29')](handleEntityNotFound(_0x1f386f,null))[_0x2361('0x29')](saveUpdates(_0x759b2b[_0x2361('0x4f')],null))[_0x2361('0x29')](respondWithResult(_0x1f386f,null))[_0x2361('0x4b')](handleError(_0x1f386f,null));};exports['destroy']=function(_0x5f5829,_0x1f1448){return db['OpenchannelQueue']['find']({'where':{'id':_0x5f5829[_0x2361('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f1448,null))[_0x2361('0x29')](removeEntity(_0x1f1448,null))[_0x2361('0x4b')](handleError(_0x1f1448,null));};exports['describe']=function(_0x420e9f,_0x1dc5cc){return db[_0x2361('0x46')][_0x2361('0x56')]()[_0x2361('0x29')](respondWithResult(_0x1dc5cc,null))[_0x2361('0x4b')](handleError(_0x1dc5cc,null));};exports[_0x2361('0x57')]=function(_0xb53833,_0x499bae,_0x5c06cb){var _0x18a0b6={'raw':!![],'where':{}},_0x5aea30={},_0x57f76d;return db[_0x2361('0x46')][_0x2361('0x58')]({'where':{'id':_0xb53833['params']['id']}})['then'](handleEntityNotFound(_0x499bae,null))['then'](function(_0x4a82e8){if(_0x4a82e8){_0x57f76d=_0x4a82e8[_0x2361('0x2a')]({'plain':!![]});_0x5aea30[_0x2361('0x37')]=_[_0x2361('0x4d')](db['UserOpenchannelQueue'][_0x2361('0x30')]);_0x5aea30[_0x2361('0x34')]=_[_0x2361('0x4d')](_0xb53833[_0x2361('0x34')]);_0x5aea30['filters']=_[_0x2361('0x36')](_0x5aea30[_0x2361('0x37')],_0x5aea30[_0x2361('0x34')]);_0x18a0b6[_0x2361('0x38')]=_['intersection'](_0x5aea30[_0x2361('0x37')],qs['fields'](_0xb53833[_0x2361('0x34')][_0x2361('0x39')]));_0x18a0b6[_0x2361('0x38')]=_0x18a0b6[_0x2361('0x38')]['length']?_0x18a0b6[_0x2361('0x38')]:_0x5aea30[_0x2361('0x37')];if(!_0xb53833[_0x2361('0x34')][_0x2361('0x3b')]('nolimit')){_0x18a0b6[_0x2361('0x22')]=qs[_0x2361('0x22')](_0xb53833[_0x2361('0x34')][_0x2361('0x22')]);_0x18a0b6[_0x2361('0x21')]=qs['offset'](_0xb53833[_0x2361('0x34')]['offset']);}_0x18a0b6['order']=qs[_0x2361('0x3e')](_0xb53833[_0x2361('0x34')]['sort']);_0x18a0b6['where']=qs['filters'](_[_0x2361('0x40')](_0xb53833[_0x2361('0x34')],_0x5aea30[_0x2361('0x35')]));_0x18a0b6[_0x2361('0x3f')][_0x2361('0x59')]=_0x4a82e8['id'];if(_0xb53833[_0x2361('0x34')][_0x2361('0x41')]){_0x18a0b6[_0x2361('0x3f')]=_[_0x2361('0x42')](_0x18a0b6[_0x2361('0x3f')],{'$or':_['map'](_0x18a0b6['attributes'],function(_0x4ac0f3){var _0xe5fef4={};_0xe5fef4[_0x4ac0f3]={'$like':'%'+_0xb53833['query']['filter']+'%'};return _0xe5fef4;})});}_0x18a0b6=_['merge']({},_0x18a0b6,_0xb53833[_0x2361('0x45')]);return db[_0x2361('0x5a')][_0x2361('0x49')](_0x18a0b6);}})['then'](function(_0x81f5d5){if(_0x81f5d5){return db['User'][_0x2361('0x5b')]({'where':{'id':_[_0x2361('0x33')](_0x81f5d5,_0x2361('0x5c')),'role':'agent'},'attributes':['id','name',_0x2361('0x5d'),_0x2361('0x5e'),_0x2361('0x5f')]});}})[_0x2361('0x29')](function(_0x2e0280){if(_0x2e0280){return{'count':_0x2e0280['count'],'rows':_[_0x2361('0x33')](_0x2e0280['rows'],function(_0x469cbc){return{'membername':_0x469cbc[_0x2361('0x2e')],'UserId':_0x469cbc['id'],'queue_name':_0x57f76d['name'],'OpenchannelQueueId':_0x57f76d['id'],'interface':util[_0x2361('0x60')]('%s/%s',_0x2361('0x61'),_0x469cbc[_0x2361('0x2e')]),'penalty':0x0,'paused':_0x469cbc[_0x2361('0x5d')],'createdAt':_0x469cbc[_0x2361('0x5f')],'updatedAt':_0x469cbc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2361('0x29')](respondWithFilteredResult(_0x499bae,_0x18a0b6))[_0x2361('0x4b')](handleError(_0x499bae,null));};exports['getTeams']=function(_0x477518,_0x304c09,_0x5d7ee9){var _0x1eed09={};var _0x7529e1={};var _0x1499b9;var _0x4e131f;return db['OpenchannelQueue'][_0x2361('0x58')]({'where':{'id':_0x477518[_0x2361('0x4c')]['id']}})[_0x2361('0x29')](handleEntityNotFound(_0x304c09,null))['then'](function(_0x18cde1){if(_0x18cde1){_0x1499b9=_0x18cde1;_0x7529e1[_0x2361('0x37')]=_['keys'](db[_0x2361('0x62')]['rawAttributes']);_0x7529e1[_0x2361('0x34')]=_[_0x2361('0x4d')](_0x477518[_0x2361('0x34')]);_0x7529e1[_0x2361('0x35')]=_[_0x2361('0x36')](_0x7529e1[_0x2361('0x37')],_0x7529e1[_0x2361('0x34')]);_0x1eed09[_0x2361('0x38')]=_['intersection'](_0x7529e1[_0x2361('0x37')],qs[_0x2361('0x39')](_0x477518[_0x2361('0x34')][_0x2361('0x39')]));_0x1eed09['attributes']=_0x1eed09[_0x2361('0x38')][_0x2361('0x3a')]?_0x1eed09[_0x2361('0x38')]:_0x7529e1[_0x2361('0x37')];_0x1eed09[_0x2361('0x3d')]=qs[_0x2361('0x3e')](_0x477518[_0x2361('0x34')]['sort']);_0x1eed09['where']=qs[_0x2361('0x35')](_[_0x2361('0x40')](_0x477518[_0x2361('0x34')],_0x7529e1[_0x2361('0x35')]));if(_0x477518[_0x2361('0x34')]['filter']){_0x1eed09[_0x2361('0x3f')]=_[_0x2361('0x42')](_0x1eed09['where'],{'$or':_[_0x2361('0x33')](_0x1eed09[_0x2361('0x38')],function(_0x40e4a6){var _0x281859={};_0x281859[_0x40e4a6]={'$like':'%'+_0x477518['query'][_0x2361('0x41')]+'%'};return _0x281859;})});}_0x1eed09=_['merge']({},_0x1eed09,_0x477518[_0x2361('0x45')]);return _0x1499b9[_0x2361('0x63')](_0x1eed09);}})['then'](function(_0x53a1e8){if(_0x53a1e8){_0x4e131f=_0x53a1e8['length'];if(!_0x477518[_0x2361('0x34')][_0x2361('0x3b')]('nolimit')){_0x1eed09['limit']=qs[_0x2361('0x22')](_0x477518[_0x2361('0x34')][_0x2361('0x22')]);_0x1eed09[_0x2361('0x21')]=qs['offset'](_0x477518[_0x2361('0x34')]['offset']);}return _0x1499b9['getTeams'](_0x1eed09);}})[_0x2361('0x29')](function(_0x1fe4bd){if(_0x1fe4bd){return _0x1fe4bd?{'count':_0x4e131f,'rows':_0x1fe4bd}:null;}})['then'](respondWithResult(_0x304c09,null))['catch'](handleError(_0x304c09,null));};exports['addTeams']=function(_0x4eb8b7,_0x41e689,_0x4e12be){var _0x35a7e0=_0x4eb8b7['body']['ids'];return db[_0x2361('0x62')][_0x2361('0x49')]({'where':{'id':_0x35a7e0},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2361('0x64'),'attributes':['id',_0x2361('0x2e'),_0x2361('0x65'),_0x2361('0x66'),'interface'],'raw':!![]}]})[_0x2361('0x29')](function(_0x579a53){if(_0x579a53){var _0x57db09=_[_0x2361('0x67')](_0x579a53,function(_0x2db592){var _0x2758d6=_0x2db592[_0x2361('0x2a')]({'plain':!![]});return _0x2758d6[_0x2361('0x64')];});return db['OpenchannelQueue'][_0x2361('0x4e')]({'where':{'id':_0x4eb8b7[_0x2361('0x4c')]['id']}})['then'](function(_0xbc4adb){return db['sequelize']['transaction'](function(_0x4aaa7f){return _0xbc4adb['addTeams'](_0x35a7e0,{'transaction':_0x4aaa7f})[_0x2361('0x29')](function(){return BPromise[_0x2361('0x68')](_0x57db09,function(_0x255502){return db['UserOpenchannelQueue'][_0x2361('0x69')]({'where':{'UserId':_0x255502['id'],'OpenchannelQueueId':_0x4eb8b7[_0x2361('0x4c')]['id']},'transaction':_0x4aaa7f});});})[_0x2361('0x29')](function(){_0x57db09[_0x2361('0x6a')](function(_0x3772ee){socket[_0x2361('0x6b')]('userOpenchannelQueue:save',{'UserId':_0x3772ee['id'],'OpenchannelQueueId':_0xbc4adb['id']});});});});});}})[_0x2361('0x29')](respondWithStatusCode(_0x41e689,null))[_0x2361('0x4b')](handleError(_0x41e689,null));};exports[_0x2361('0x6c')]=function(_0xe11b69,_0x2b4f1e,_0x109006){return db['Team'][_0x2361('0x49')]({'where':{'id':_0xe11b69[_0x2361('0x34')][_0x2361('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x2361('0x6e')],'as':_0x2361('0x64'),'attributes':['id'],'raw':!![]}]})[_0x2361('0x29')](handleEntityNotFound(_0x2b4f1e,null))[_0x2361('0x29')](function(_0x161618){var _0x274953=_['map'](_0x161618,'id');var _0x5528ac=[];var _0x3a3103=[];var _0x20fc11=squel['select']();_0x20fc11[_0x2361('0x6f')](_0x2361('0x70'))[_0x2361('0x71')](_0x2361('0x72'),'tq')[_0x2361('0x73')](_0x2361('0x74'),'ut',_0x2361('0x75'))['where']('OpenchannelQueueId\x20=\x20?',_0xe11b69[_0x2361('0x4c')]['id']);for(var _0xec2c04=0x0;_0xec2c04<_0x161618[_0x2361('0x3a')];_0xec2c04+=0x1){let _0x39f307=_0x161618[_0xec2c04];for(var _0x14f225=0x0;_0x14f225<_0x39f307[_0x2361('0x64')]['length'];_0x14f225+=0x1){let _0x235e19=_0x39f307[_0x2361('0x64')][_0x14f225];var _0x4b2d9d=_0x20fc11[_0x2361('0x76')]();_0x4b2d9d[_0x2361('0x3f')](_0x2361('0x77'),_0x235e19['id']);_0x3a3103[_0x2361('0x78')](db[_0x2361('0x79')][_0x2361('0x34')](_0x4b2d9d[_0x2361('0x7a')](),{'type':db[_0x2361('0x79')]['QueryTypes'][_0x2361('0x7b')]})['then'](function(_0x4bb76e){if(_0x4bb76e[_0x2361('0x3a')]===0x1){return _0x235e19['id'];}else{var _0x4bd5e1=_[_0x2361('0x7c')](_[_0x2361('0x33')](_0x4bb76e,'TeamId'),function(_0x462b7c){return _[_0x2361('0x7d')](_0x274953,_0x462b7c);});if(_0x4bd5e1){return _0x235e19['id'];}}}));}}return BPromise['all'](_0x3a3103)[_0x2361('0x29')](function(_0x169737){_0x5528ac=_(_0x5528ac)[_0x2361('0x7e')](_0x169737)[_0x2361('0x7f')]()[_0x2361('0x80')]();return db[_0x2361('0x46')][_0x2361('0x4e')]({'where':{'id':_0xe11b69[_0x2361('0x4c')]['id']}})['then'](function(_0x1694fc){return db[_0x2361('0x79')][_0x2361('0x81')](function(_0x37ee46){return _0x1694fc['removeTeams'](_0xe11b69[_0x2361('0x34')][_0x2361('0x6d')],{'transaction':_0x37ee46})[_0x2361('0x29')](function(){if(!_[_0x2361('0x82')](_0x5528ac)){return _0x1694fc['removeAgents'](_0x5528ac,{'transaction':_0x37ee46});}})['then'](function(){_0x5528ac['forEach'](function(_0x1e031c){socket[_0x2361('0x6b')]('userOpenchannelQueue:remove',{'UserId':_0x1e031c,'OpenchannelQueueId':_0x1694fc['id']});});});});});});})[_0x2361('0x29')](respondWithStatusCode(_0x2b4f1e,null))['catch'](handleError(_0x2b4f1e,null));};exports[_0x2361('0x83')]=function(_0x31e103,_0x516dc9,_0x4de4a4){return db['OpenchannelQueue'][_0x2361('0x4e')]({'where':{'id':_0x31e103[_0x2361('0x4c')]['id']}})[_0x2361('0x29')](handleEntityNotFound(_0x516dc9,null))['then'](function(_0x44302e){if(_0x44302e){return _0x44302e['addAgents'](_0x31e103[_0x2361('0x4f')][_0x2361('0x6d')],_[_0x2361('0x84')](_0x31e103['body'],[_0x2361('0x6d'),'id'])||{})[_0x2361('0x85')](function(_0x1f690d){for(var _0x5e3861=0x0;_0x5e3861<_0x31e103['body'][_0x2361('0x6d')][_0x2361('0x3a')];_0x5e3861+=0x1){socket[_0x2361('0x6b')]('userOpenchannelQueue:save',{'UserId':_0x31e103['body'][_0x2361('0x6d')][_0x5e3861],'OpenchannelQueueId':_0x31e103[_0x2361('0x4c')]['id']});}return _0x1f690d;});}})[_0x2361('0x29')](respondWithResult(_0x516dc9,null))[_0x2361('0x4b')](handleError(_0x516dc9,null));};exports[_0x2361('0x86')]=function(_0x5addf0,_0x58665a,_0x373cd5){return db[_0x2361('0x46')][_0x2361('0x4e')]({'where':{'id':_0x5addf0[_0x2361('0x4c')]['id']}})[_0x2361('0x29')](handleEntityNotFound(_0x58665a,null))[_0x2361('0x29')](function(_0x19789a){if(_0x19789a){return _0x19789a[_0x2361('0x86')](_0x5addf0['query'][_0x2361('0x6d')])['then'](function(){if(_[_0x2361('0x87')](_0x5addf0[_0x2361('0x34')][_0x2361('0x6d')])){for(var _0x372e9b=0x0;_0x372e9b<_0x5addf0[_0x2361('0x34')]['ids'][_0x2361('0x3a')];_0x372e9b+=0x1){socket[_0x2361('0x6b')](_0x2361('0x88'),{'UserId':Number(_0x5addf0[_0x2361('0x34')][_0x2361('0x6d')][_0x372e9b]),'OpenchannelQueueId':Number(_0x5addf0[_0x2361('0x4c')]['id'])});}}else{socket['emit'](_0x2361('0x88'),{'UserId':Number(_0x5addf0[_0x2361('0x34')][_0x2361('0x6d')]),'OpenchannelQueueId':Number(_0x5addf0[_0x2361('0x4c')]['id'])});}});}})[_0x2361('0x29')](respondWithStatusCode(_0x58665a,null))[_0x2361('0x4b')](handleError(_0x58665a,null));};exports[_0x2361('0x89')]=function(_0x5ed126,_0x437eb8,_0x52d56e){var _0x3790a0={};var _0x1527b0={};var _0x39b7aa;var _0x4a4c7e;return db['OpenchannelQueue'][_0x2361('0x58')]({'where':{'id':_0x5ed126[_0x2361('0x4c')]['id']}})[_0x2361('0x29')](handleEntityNotFound(_0x437eb8,null))['then'](function(_0x2fb52f){if(_0x2fb52f){_0x39b7aa=_0x2fb52f;_0x1527b0[_0x2361('0x37')]=_['keys'](db[_0x2361('0x6e')]['rawAttributes']);_0x1527b0['query']=_[_0x2361('0x4d')](_0x5ed126['query']);_0x1527b0[_0x2361('0x35')]=_[_0x2361('0x36')](_0x1527b0[_0x2361('0x37')],_0x1527b0[_0x2361('0x34')]);_0x3790a0[_0x2361('0x38')]=_[_0x2361('0x36')](_0x1527b0[_0x2361('0x37')],qs[_0x2361('0x39')](_0x5ed126[_0x2361('0x34')][_0x2361('0x39')]));_0x3790a0['attributes']=_0x3790a0[_0x2361('0x38')][_0x2361('0x3a')]?_0x3790a0['attributes']:_0x1527b0['model'];_0x3790a0['order']=qs[_0x2361('0x3e')](_0x5ed126[_0x2361('0x34')][_0x2361('0x3e')]);_0x3790a0['where']=qs[_0x2361('0x35')](_[_0x2361('0x40')](_0x5ed126[_0x2361('0x34')],_0x1527b0[_0x2361('0x35')]));if(_0x5ed126[_0x2361('0x34')][_0x2361('0x41')]){_0x3790a0[_0x2361('0x3f')]=_['merge'](_0x3790a0['where'],{'$or':_['map'](_0x3790a0[_0x2361('0x38')],function(_0x499cc5){var _0x21e618={};_0x21e618[_0x499cc5]={'$like':'%'+_0x5ed126[_0x2361('0x34')][_0x2361('0x41')]+'%'};return _0x21e618;})});}_0x3790a0=_[_0x2361('0x42')]({},_0x3790a0,_0x5ed126['options']);return _0x39b7aa[_0x2361('0x89')](_0x3790a0);}})[_0x2361('0x29')](function(_0x2af2e4){if(_0x2af2e4){_0x4a4c7e=_0x2af2e4['length'];if(!_0x5ed126[_0x2361('0x34')][_0x2361('0x3b')](_0x2361('0x3c'))){_0x3790a0[_0x2361('0x22')]=qs[_0x2361('0x22')](_0x5ed126[_0x2361('0x34')][_0x2361('0x22')]);_0x3790a0[_0x2361('0x21')]=qs['offset'](_0x5ed126[_0x2361('0x34')]['offset']);}return _0x39b7aa[_0x2361('0x89')](_0x3790a0);}})[_0x2361('0x29')](function(_0x5c2d55){if(_0x5c2d55){return _0x5c2d55?{'count':_0x4a4c7e,'rows':_0x5c2d55}:null;}})[_0x2361('0x29')](respondWithResult(_0x437eb8,null))[_0x2361('0x4b')](handleError(_0x437eb8,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 551648a..f6e732a 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 _0x7bc1=['emit','hasOwnProperty','hook','exports','events','OpenchannelQueue','save','remove'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7bc1,0xfc));var _0x17bc=function(_0x289af9,_0xdf6cf0){_0x289af9=_0x289af9-0x0;var _0x5e0edb=_0x7bc1[_0x289af9];return _0x5e0edb;};'use strict';var EventEmitter=require(_0x17bc('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x17bc('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x17bc('0x2'),'afterUpdate':'update','afterDestroy':_0x17bc('0x3')};function emitEvent(_0x51401f){return function(_0x58a6bb,_0x209ba4,_0xc99b49){OpenchannelQueueEvents[_0x17bc('0x4')](_0x51401f+':'+_0x58a6bb['id'],_0x58a6bb);OpenchannelQueueEvents[_0x17bc('0x4')](_0x51401f,_0x58a6bb);_0xc99b49(null);};}for(var e in events){if(events[_0x17bc('0x5')](e)){var event=events[e];OpenchannelQueue[_0x17bc('0x6')](e,emitEvent(event));}}module[_0x17bc('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x2824=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0x2824,0x13d));var _0x4282=function(_0x1eeb6c,_0x11caf6){_0x1eeb6c=_0x1eeb6c-0x0;var _0x28f73a=_0x2824[_0x1eeb6c];return _0x28f73a;};'use strict';var EventEmitter=require(_0x4282('0x0'));var OpenchannelQueue=require(_0x4282('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x4282('0x2')](0x0);var events={'afterCreate':_0x4282('0x3'),'afterUpdate':_0x4282('0x4'),'afterDestroy':_0x4282('0x5')};function emitEvent(_0x52ae85){return function(_0x42507d,_0x5baef4,_0x3e107a){OpenchannelQueueEvents[_0x4282('0x6')](_0x52ae85+':'+_0x42507d['id'],_0x42507d);OpenchannelQueueEvents[_0x4282('0x6')](_0x52ae85,_0x42507d);_0x3e107a(null);};}for(var e in events){if(events[_0x4282('0x7')](e)){var event=events[e];OpenchannelQueue[_0x4282('0x8')](e,emitEvent(event));}}module[_0x4282('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index f45b4fe..b2c2e58 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 _0xdfc8=['path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash','util','api','moment','bluebird'];(function(_0x3f9b50,_0x5d40fc){var _0x48ffaf=function(_0x4092e3){while(--_0x4092e3){_0x3f9b50['push'](_0x3f9b50['shift']());}};_0x48ffaf(++_0x5d40fc);}(_0xdfc8,0x127));var _0x8dfc=function(_0x4d5a9a,_0x9bfd47){_0x4d5a9a=_0x4d5a9a-0x0;var _0x39330a=_0xdfc8[_0x4d5a9a];return _0x39330a;};'use strict';var _=require(_0x8dfc('0x0'));var util=require(_0x8dfc('0x1'));var logger=require('../../config/logger')(_0x8dfc('0x2'));var moment=require(_0x8dfc('0x3'));var BPromise=require(_0x8dfc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8dfc('0x5'));var rimraf=require(_0x8dfc('0x6'));var config=require(_0x8dfc('0x7'));var attributes=require(_0x8dfc('0x8'));module[_0x8dfc('0x9')]=function(_0x15b128,_0x2f547a){return _0x15b128[_0x8dfc('0xa')](_0x8dfc('0xb'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a89=['api','moment','request-promise','path','../../config/environment','exports','define','openchannel_queues','lodash','util','../../config/logger'];(function(_0x49a49a,_0x16e7f9){var _0x9877ff=function(_0x57bf65){while(--_0x57bf65){_0x49a49a['push'](_0x49a49a['shift']());}};_0x9877ff(++_0x16e7f9);}(_0x9a89,0xce));var _0x99a8=function(_0x1cc852,_0x225858){_0x1cc852=_0x1cc852-0x0;var _0x2b0729=_0x9a89[_0x1cc852];return _0x2b0729;};'use strict';var _=require(_0x99a8('0x0'));var util=require(_0x99a8('0x1'));var logger=require(_0x99a8('0x2'))(_0x99a8('0x3'));var moment=require(_0x99a8('0x4'));var BPromise=require('bluebird');var rp=require(_0x99a8('0x5'));var fs=require('fs');var path=require(_0x99a8('0x6'));var rimraf=require('rimraf');var config=require(_0x99a8('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x99a8('0x8')]=function(_0x36ffcc,_0x289ddd){return _0x36ffcc[_0x99a8('0x9')]('OpenchannelQueue',attributes,{'tableName':_0x99a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 86a1734..c4974a3 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 _0x605f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','lodash','util','moment','bluebird'];(function(_0x47a09d,_0x441c24){var _0x1c8b5a=function(_0x3dcbda){while(--_0x3dcbda){_0x47a09d['push'](_0x47a09d['shift']());}};_0x1c8b5a(++_0x441c24);}(_0x605f,0x1a0));var _0xf605=function(_0x3627be,_0x32063d){_0x3627be=_0x3627be-0x0;var _0x2eed69=_0x605f[_0x3627be];return _0x2eed69;};'use strict';var _=require(_0xf605('0x0'));var util=require(_0xf605('0x1'));var moment=require(_0xf605('0x2'));var BPromise=require(_0xf605('0x3'));var rs=require(_0xf605('0x4'));var fs=require('fs');var Redis=require(_0xf605('0x5'));var db=require(_0xf605('0x6'))['db'];var utils=require(_0xf605('0x7'));var logger=require(_0xf605('0x8'))(_0xf605('0x9'));var config=require(_0xf605('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf605('0xb')][_0xf605('0xc')]({'port':0x232a});config[_0xf605('0xd')]=_['defaults'](config[_0xf605('0xd')],{'host':_0xf605('0xe'),'port':0x18eb});var socket=require(_0xf605('0xf'))(new Redis(config[_0xf605('0xd')]));require(_0xf605('0x10'))[_0xf605('0x11')](socket);function respondWithRpcPromise(_0x23f6a1,_0x589ded,_0x2ea1d4){return new BPromise(function(_0x1ec41f,_0x1f474e){return client[_0xf605('0x12')](_0x23f6a1,_0x2ea1d4)[_0xf605('0x13')](function(_0x37a6fc){logger[_0xf605('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x589ded,_0xf605('0x15'));logger[_0xf605('0x16')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x589ded,_0xf605('0x15'),JSON[_0xf605('0x17')](_0x37a6fc));if(_0x37a6fc[_0xf605('0x18')]){if(_0x37a6fc[_0xf605('0x18')][_0xf605('0x19')]===0x1f4){logger[_0xf605('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x589ded,_0x37a6fc[_0xf605('0x18')][_0xf605('0x1a')]);return _0x1f474e(_0x37a6fc['error'][_0xf605('0x1a')]);}logger[_0xf605('0x18')](_0xf605('0x1b'),_0x589ded,_0x37a6fc[_0xf605('0x18')][_0xf605('0x1a')]);return _0x1ec41f(_0x37a6fc[_0xf605('0x18')]['message']);}else{logger[_0xf605('0x14')](_0xf605('0x1b'),_0x589ded,_0xf605('0x15'));_0x1ec41f(_0x37a6fc[_0xf605('0x1c')][_0xf605('0x1a')]);}})[_0xf605('0x1d')](function(_0x457828){logger[_0xf605('0x18')](_0xf605('0x1b'),_0x589ded,_0x457828);_0x1f474e(_0x457828);});});}exports['GetOpenchannelQueue']=function(_0x40d0aa){var _0x402de7=this;return new Promise(function(_0x15f153,_0x22e09f){return db[_0xf605('0x1e')][_0xf605('0x1f')]({'raw':_0x40d0aa[_0xf605('0x20')]?_0x40d0aa['options'][_0xf605('0x21')]===undefined?!![]:![]:!![],'where':_0x40d0aa[_0xf605('0x20')]?_0x40d0aa[_0xf605('0x20')][_0xf605('0x22')]||null:null,'attributes':_0x40d0aa['options']?_0x40d0aa['options'][_0xf605('0x23')]||null:null,'limit':_0x40d0aa['options']?_0x40d0aa[_0xf605('0x20')][_0xf605('0x24')]||null:null,'include':_0x40d0aa[_0xf605('0x20')]?_0x40d0aa[_0xf605('0x20')][_0xf605('0x25')]?_[_0xf605('0x26')](_0x40d0aa[_0xf605('0x20')][_0xf605('0x25')],function(_0x153e9f){return{'model':db[_0x153e9f[_0xf605('0x27')]],'as':_0x153e9f['as'],'attributes':_0x153e9f['attributes'],'include':_0x153e9f['include']?_[_0xf605('0x26')](_0x153e9f['include'],function(_0x42749){return{'model':db[_0x42749['model']],'as':_0x42749['as'],'attributes':_0x42749[_0xf605('0x23')],'include':_0x42749[_0xf605('0x25')]?_[_0xf605('0x26')](_0x42749[_0xf605('0x25')],function(_0x49a801){return{'model':db[_0x49a801[_0xf605('0x27')]],'as':_0x49a801['as'],'attributes':_0x49a801['attributes']};}):[]};}):[]};}):[]:[]})[_0xf605('0x13')](function(_0x1f5d04){logger[_0xf605('0x14')](_0xf605('0x28'),_0x40d0aa);logger['debug']('GetOpenchannelQueue',_0x40d0aa,JSON[_0xf605('0x17')](_0x1f5d04));_0x15f153(_0x1f5d04);})[_0xf605('0x1d')](function(_0x1ccc4b){logger['error'](_0xf605('0x28'),_0x1ccc4b[_0xf605('0x1a')],_0x40d0aa);_0x22e09f(_0x402de7[_0xf605('0x18')](0x1f4,_0x1ccc4b[_0xf605('0x1a')]));});});};exports[_0xf605('0x29')]=function(_0x442082){var _0x3dcb50=this;return new Promise(function(_0xe4349a,_0x4470bb){return db[_0xf605('0x1e')]['find']({'raw':_0x442082[_0xf605('0x20')]?_0x442082[_0xf605('0x20')][_0xf605('0x21')]===undefined?!![]:![]:!![],'where':_0x442082[_0xf605('0x20')]?_0x442082[_0xf605('0x20')][_0xf605('0x22')]||null:null,'attributes':_0x442082['options']?_0x442082[_0xf605('0x20')][_0xf605('0x23')]||null:null,'include':_0x442082[_0xf605('0x20')]?_0x442082[_0xf605('0x20')][_0xf605('0x25')]?_['map'](_0x442082[_0xf605('0x20')]['include'],function(_0x3dafb4){return{'model':db[_0x3dafb4[_0xf605('0x27')]],'as':_0x3dafb4['as'],'attributes':_0x3dafb4[_0xf605('0x23')],'include':_0x3dafb4[_0xf605('0x25')]?_[_0xf605('0x26')](_0x3dafb4[_0xf605('0x25')],function(_0x1b7bf5){return{'model':db[_0x1b7bf5['model']],'as':_0x1b7bf5['as'],'attributes':_0x1b7bf5[_0xf605('0x23')],'include':_0x1b7bf5[_0xf605('0x25')]?_[_0xf605('0x26')](_0x1b7bf5[_0xf605('0x25')],function(_0x17fa0e){return{'model':db[_0x17fa0e[_0xf605('0x27')]],'as':_0x17fa0e['as'],'attributes':_0x17fa0e[_0xf605('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf605('0x13')](function(_0x3a0fa7){logger[_0xf605('0x14')](_0xf605('0x29'),_0x442082);logger[_0xf605('0x16')](_0xf605('0x29'),_0x442082,JSON[_0xf605('0x17')](_0x3a0fa7));_0xe4349a(_0x3a0fa7);})[_0xf605('0x1d')](function(_0x2a044c){logger['error'](_0xf605('0x29'),_0x2a044c[_0xf605('0x1a')],_0x442082);_0x4470bb(_0x3dcb50['error'](0x1f4,_0x2a044c['message']));});});}; \ No newline at end of file +var _0x173d=['where','include','map','model','attributes','catch','ShowOpenchannelQueue','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options'];(function(_0x45ba1e,_0x26aae3){var _0x4c40ef=function(_0x1f2e7e){while(--_0x1f2e7e){_0x45ba1e['push'](_0x45ba1e['shift']());}};_0x4c40ef(++_0x26aae3);}(_0x173d,0x112));var _0xd173=function(_0x52198d,_0x2f4e85){_0x52198d=_0x52198d-0x0;var _0x21d36d=_0x173d[_0x52198d];return _0x21d36d;};'use strict';var _=require(_0xd173('0x0'));var util=require(_0xd173('0x1'));var moment=require(_0xd173('0x2'));var BPromise=require(_0xd173('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd173('0x4'));var db=require(_0xd173('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd173('0x6'))(_0xd173('0x7'));var config=require(_0xd173('0x8'));var jayson=require(_0xd173('0x9'));var client=jayson[_0xd173('0xa')][_0xd173('0xb')]({'port':0x232a});config[_0xd173('0xc')]=_['defaults'](config['redis'],{'host':_0xd173('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd173('0xc')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x223e15,_0x2bfbe9,_0x2c8e10){return new BPromise(function(_0x4f5367,_0x41ee6b){return client[_0xd173('0xe')](_0x223e15,_0x2c8e10)[_0xd173('0xf')](function(_0x113d85){logger[_0xd173('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x2bfbe9,_0xd173('0x11'));logger[_0xd173('0x12')](_0xd173('0x13'),_0x2bfbe9,_0xd173('0x11'),JSON[_0xd173('0x14')](_0x113d85));if(_0x113d85[_0xd173('0x15')]){if(_0x113d85[_0xd173('0x15')][_0xd173('0x16')]===0x1f4){logger[_0xd173('0x15')](_0xd173('0x17'),_0x2bfbe9,_0x113d85['error'][_0xd173('0x18')]);return _0x41ee6b(_0x113d85[_0xd173('0x15')][_0xd173('0x18')]);}logger[_0xd173('0x15')](_0xd173('0x17'),_0x2bfbe9,_0x113d85[_0xd173('0x15')]['message']);return _0x4f5367(_0x113d85[_0xd173('0x15')][_0xd173('0x18')]);}else{logger[_0xd173('0x10')](_0xd173('0x17'),_0x2bfbe9,'request\x20sent');_0x4f5367(_0x113d85[_0xd173('0x19')][_0xd173('0x18')]);}})['catch'](function(_0xcdce09){logger[_0xd173('0x15')](_0xd173('0x17'),_0x2bfbe9,_0xcdce09);_0x41ee6b(_0xcdce09);});});}exports[_0xd173('0x1a')]=function(_0x29a2bb){var _0xc6bab1=this;return new Promise(function(_0x1172b9,_0x48d4cb){return db[_0xd173('0x1b')][_0xd173('0x1c')]({'raw':_0x29a2bb[_0xd173('0x1d')]?_0x29a2bb[_0xd173('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x29a2bb[_0xd173('0x1d')]?_0x29a2bb['options'][_0xd173('0x1e')]||null:null,'attributes':_0x29a2bb[_0xd173('0x1d')]?_0x29a2bb[_0xd173('0x1d')]['attributes']||null:null,'limit':_0x29a2bb[_0xd173('0x1d')]?_0x29a2bb[_0xd173('0x1d')]['limit']||null:null,'include':_0x29a2bb['options']?_0x29a2bb[_0xd173('0x1d')][_0xd173('0x1f')]?_[_0xd173('0x20')](_0x29a2bb['options'][_0xd173('0x1f')],function(_0x248529){return{'model':db[_0x248529[_0xd173('0x21')]],'as':_0x248529['as'],'attributes':_0x248529[_0xd173('0x22')],'include':_0x248529[_0xd173('0x1f')]?_[_0xd173('0x20')](_0x248529[_0xd173('0x1f')],function(_0xe42ef1){return{'model':db[_0xe42ef1[_0xd173('0x21')]],'as':_0xe42ef1['as'],'attributes':_0xe42ef1[_0xd173('0x22')],'include':_0xe42ef1[_0xd173('0x1f')]?_[_0xd173('0x20')](_0xe42ef1[_0xd173('0x1f')],function(_0x9d1553){return{'model':db[_0x9d1553[_0xd173('0x21')]],'as':_0x9d1553['as'],'attributes':_0x9d1553[_0xd173('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd173('0xf')](function(_0x5c45f1){logger[_0xd173('0x10')]('GetOpenchannelQueue',_0x29a2bb);logger['debug'](_0xd173('0x1a'),_0x29a2bb,JSON['stringify'](_0x5c45f1));_0x1172b9(_0x5c45f1);})[_0xd173('0x23')](function(_0x34b773){logger[_0xd173('0x15')]('GetOpenchannelQueue',_0x34b773[_0xd173('0x18')],_0x29a2bb);_0x48d4cb(_0xc6bab1[_0xd173('0x15')](0x1f4,_0x34b773[_0xd173('0x18')]));});});};exports[_0xd173('0x24')]=function(_0x4219df){var _0x36542a=this;return new Promise(function(_0x4c271e,_0x2db5b6){return db[_0xd173('0x1b')]['find']({'raw':_0x4219df[_0xd173('0x1d')]?_0x4219df[_0xd173('0x1d')][_0xd173('0x25')]===undefined?!![]:![]:!![],'where':_0x4219df[_0xd173('0x1d')]?_0x4219df[_0xd173('0x1d')][_0xd173('0x1e')]||null:null,'attributes':_0x4219df[_0xd173('0x1d')]?_0x4219df[_0xd173('0x1d')][_0xd173('0x22')]||null:null,'include':_0x4219df['options']?_0x4219df['options'][_0xd173('0x1f')]?_[_0xd173('0x20')](_0x4219df['options']['include'],function(_0x2fc9e9){return{'model':db[_0x2fc9e9['model']],'as':_0x2fc9e9['as'],'attributes':_0x2fc9e9[_0xd173('0x22')],'include':_0x2fc9e9['include']?_[_0xd173('0x20')](_0x2fc9e9[_0xd173('0x1f')],function(_0x5d4af5){return{'model':db[_0x5d4af5[_0xd173('0x21')]],'as':_0x5d4af5['as'],'attributes':_0x5d4af5[_0xd173('0x22')],'include':_0x5d4af5[_0xd173('0x1f')]?_[_0xd173('0x20')](_0x5d4af5[_0xd173('0x1f')],function(_0x1f1c59){return{'model':db[_0x1f1c59[_0xd173('0x21')]],'as':_0x1f1c59['as'],'attributes':_0x1f1c59[_0xd173('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6fe4){logger['info'](_0xd173('0x24'),_0x4219df);logger[_0xd173('0x12')](_0xd173('0x24'),_0x4219df,JSON['stringify'](_0x6fe4));_0x4c271e(_0x6fe4);})[_0xd173('0x23')](function(_0x113418){logger['error'](_0xd173('0x24'),_0x113418['message'],_0x4219df);_0x2db5b6(_0x36542a['error'](0x1f4,_0x113418['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index b138217..819e311 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 _0x4ac0=['./openchannelQueue.events','save','update','emit','removeListener','openchannelQueue:'];(function(_0x313e6f,_0x191188){var _0x11c646=function(_0x47446a){while(--_0x47446a){_0x313e6f['push'](_0x313e6f['shift']());}};_0x11c646(++_0x191188);}(_0x4ac0,0xa8));var _0x04ac=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4ac0[_0x501510];return _0x1e6ee5;};'use strict';var OpenchannelQueueEvents=require(_0x04ac('0x0'));var events=[_0x04ac('0x1'),'remove',_0x04ac('0x2')];function createListener(_0x31c554,_0x5b45a1){return function(_0x364243){_0x5b45a1[_0x04ac('0x3')](_0x31c554,_0x364243);};}function removeListener(_0x1e80b4,_0xefa3ca){return function(){OpenchannelQueueEvents[_0x04ac('0x4')](_0x1e80b4,_0xefa3ca);};}exports['register']=function(_0x1ee28e){for(var _0xff12bb=0x0,_0xdfecc2=events['length'];_0xff12bb<_0xdfecc2;_0xff12bb++){var _0x17d6b7=events[_0xff12bb];var _0x4c6544=createListener(_0x04ac('0x5')+_0x17d6b7,_0x1ee28e);OpenchannelQueueEvents['on'](_0x17d6b7,_0x4c6544);}}; \ No newline at end of file +var _0x4ff9=['save','remove','emit','removeListener','register','length'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4ff9,0x17a));var _0x94ff=function(_0x4f8539,_0x14a9dc){_0x4f8539=_0x4f8539-0x0;var _0x3c874d=_0x4ff9[_0x4f8539];return _0x3c874d;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x94ff('0x0'),_0x94ff('0x1'),'update'];function createListener(_0x2728bf,_0x564e0d){return function(_0x54e009){_0x564e0d[_0x94ff('0x2')](_0x2728bf,_0x54e009);};}function removeListener(_0x29e36f,_0x1a697b){return function(){OpenchannelQueueEvents[_0x94ff('0x3')](_0x29e36f,_0x1a697b);};}exports[_0x94ff('0x4')]=function(_0x3179a7){for(var _0x5635a5=0x0,_0x150352=events[_0x94ff('0x5')];_0x5635a5<_0x150352;_0x5635a5++){var _0x77dfc7=events[_0x5635a5];var _0x262caa=createListener('openchannelQueue:'+_0x77dfc7,_0x3179a7);OpenchannelQueueEvents['on'](_0x77dfc7,_0x262caa);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index ddc3651..b9e9e7b 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 _0x4896=['get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller'];(function(_0x3c444a,_0xe44bbf){var _0x5b2ff0=function(_0xde0e8){while(--_0xde0e8){_0x3c444a['push'](_0x3c444a['shift']());}};_0x5b2ff0(++_0xe44bbf);}(_0x4896,0x1ef));var _0x6489=function(_0x50c17c,_0x118ca9){_0x50c17c=_0x50c17c-0x0;var _0x48f9d6=_0x4896[_0x50c17c];return _0x48f9d6;};'use strict';var multer=require(_0x6489('0x0'));var util=require(_0x6489('0x1'));var path=require('path');var timeout=require(_0x6489('0x2'));var express=require(_0x6489('0x3'));var router=express[_0x6489('0x4')]();var auth=require(_0x6489('0x5'));var interaction=require(_0x6489('0x6'));var config=require(_0x6489('0x7'));var controller=require(_0x6489('0x8'));router[_0x6489('0x9')]('/',auth[_0x6489('0xa')](),controller[_0x6489('0xb')]);router[_0x6489('0x9')](_0x6489('0xc'),auth[_0x6489('0xa')](),controller[_0x6489('0xd')]);router['get'](_0x6489('0xe'),auth[_0x6489('0xa')](),controller[_0x6489('0xf')]);router[_0x6489('0x10')]('/',auth[_0x6489('0xa')](),controller['create']);router[_0x6489('0x11')](_0x6489('0xe'),auth[_0x6489('0xa')](),controller[_0x6489('0x12')]);router[_0x6489('0x13')](_0x6489('0xe'),auth[_0x6489('0xa')](),controller['destroy']);module[_0x6489('0x14')]=router; \ No newline at end of file +var _0x8e40=['index','describe','/:id','show','post','create','delete','destroy','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1d4dbc,_0x54227f){var _0x44178a=function(_0x4e2849){while(--_0x4e2849){_0x1d4dbc['push'](_0x1d4dbc['shift']());}};_0x44178a(++_0x54227f);}(_0x8e40,0xd8));var _0x08e4=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x8e40[_0x33032e];return _0x13316b;};'use strict';var multer=require('multer');var util=require(_0x08e4('0x0'));var path=require(_0x08e4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x08e4('0x2')]();var auth=require(_0x08e4('0x3'));var interaction=require(_0x08e4('0x4'));var config=require(_0x08e4('0x5'));var controller=require('./openchannelQueueReport.controller');router[_0x08e4('0x6')]('/',auth[_0x08e4('0x7')](),controller[_0x08e4('0x8')]);router[_0x08e4('0x6')]('/describe',auth[_0x08e4('0x7')](),controller[_0x08e4('0x9')]);router[_0x08e4('0x6')](_0x08e4('0xa'),auth['isAuthenticated'](),controller[_0x08e4('0xb')]);router[_0x08e4('0xc')]('/',auth['isAuthenticated'](),controller[_0x08e4('0xd')]);router['put'](_0x08e4('0xa'),auth[_0x08e4('0x7')](),controller['update']);router[_0x08e4('0xe')](_0x08e4('0xa'),auth[_0x08e4('0x7')](),controller[_0x08e4('0xf')]);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 0cbd209..189db89 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 _0x316f=['DATE','sequelize','exports','STRING'];(function(_0x5c4939,_0xf9008f){var _0x30fb6e=function(_0xdcd62){while(--_0xdcd62){_0x5c4939['push'](_0x5c4939['shift']());}};_0x30fb6e(++_0xf9008f);}(_0x316f,0x115));var _0xf316=function(_0x23abf5,_0x512e8f){_0x23abf5=_0x23abf5-0x0;var _0x44af7f=_0x316f[_0x23abf5];return _0x44af7f;};'use strict';var moment=require('moment');var Sequelize=require(_0xf316('0x0'));module[_0xf316('0x1')]={'uniqueid':{'type':Sequelize[_0xf316('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf316('0x2')]},'joinAt':{'type':Sequelize[_0xf316('0x3')]},'leaveAt':{'type':Sequelize[_0xf316('0x3')]},'acceptAt':{'type':Sequelize[_0xf316('0x3')]},'exitAt':{'type':Sequelize[_0xf316('0x3')]},'reason':{'type':Sequelize[_0xf316('0x2')]}}; \ No newline at end of file +var _0x4e47=['sequelize','STRING','DATE','moment'];(function(_0x3a0e3c,_0x1b540e){var _0x31e786=function(_0x25d245){while(--_0x25d245){_0x3a0e3c['push'](_0x3a0e3c['shift']());}};_0x31e786(++_0x1b540e);}(_0x4e47,0xe7));var _0x74e4=function(_0x2d25d1,_0x23e07c){_0x2d25d1=_0x2d25d1-0x0;var _0x2de337=_0x4e47[_0x2d25d1];return _0x2de337;};'use strict';var moment=require(_0x74e4('0x0'));var Sequelize=require(_0x74e4('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x74e4('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x74e4('0x2')]},'joinAt':{'type':Sequelize[_0x74e4('0x3')]},'leaveAt':{'type':Sequelize[_0x74e4('0x3')]},'acceptAt':{'type':Sequelize[_0x74e4('0x3')]},'exitAt':{'type':Sequelize[_0x74e4('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 f47bc02..99319c7 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 _0xd906=['apply','destroy','then','stack','name','send','index','map','OpenchannelQueueReport','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x56d8a8,_0x3cd611){var _0x167b43=function(_0x1787a6){while(--_0x1787a6){_0x56d8a8['push'](_0x56d8a8['shift']());}};_0x167b43(++_0x3cd611);}(_0xd906,0x6b));var _0x6d90=function(_0x32b122,_0x1ad490){_0x32b122=_0x32b122-0x0;var _0x4ad25a=_0xd906[_0x32b122];return _0x4ad25a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6d90('0x0'));var zipdir=require(_0x6d90('0x1'));var jsonpatch=require(_0x6d90('0x2'));var rp=require(_0x6d90('0x3'));var moment=require(_0x6d90('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6d90('0x5'));var util=require(_0x6d90('0x6'));var path=require(_0x6d90('0x7'));var sox=require(_0x6d90('0x8'));var csv=require('to-csv');var ejs=require(_0x6d90('0x9'));var fs=require('fs');var _=require(_0x6d90('0xa'));var squel=require(_0x6d90('0xb'));var crypto=require(_0x6d90('0xc'));var jsforce=require(_0x6d90('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6d90('0xe'));var Redis=require(_0x6d90('0xf'));var authService=require(_0x6d90('0x10'));var qs=require(_0x6d90('0x11'));var as=require(_0x6d90('0x12'));var hardwareService=require(_0x6d90('0x13'));var logger=require(_0x6d90('0x14'))('api');var utils=require(_0x6d90('0x15'));var config=require('../../config/environment');var db=require(_0x6d90('0x16'))['db'];function respondWithStatusCode(_0x4b1ce0,_0x2e791b){_0x2e791b=_0x2e791b||0xcc;return function(_0x3c5dc9){if(_0x3c5dc9){return _0x4b1ce0[_0x6d90('0x17')](_0x2e791b);}return _0x4b1ce0[_0x6d90('0x18')](_0x2e791b)[_0x6d90('0x19')]();};}function respondWithResult(_0x579908,_0x9c7ac9){_0x9c7ac9=_0x9c7ac9||0xc8;return function(_0x2c2475){if(_0x2c2475){return _0x579908['status'](_0x9c7ac9)[_0x6d90('0x1a')](_0x2c2475);}};}function respondWithFilteredResult(_0x513417,_0x2de602){return function(_0x2c0b05){if(_0x2c0b05){var _0x1f128f=_0x2c0b05[_0x6d90('0x1b')],_0x4dc4e3=_0x2de602['offset'],_0x1e44db=_0x2de602[_0x6d90('0x1c')]+_0x2de602[_0x6d90('0x1d')],_0x49b4ad;if(_0x1e44db>=_0x1f128f){_0x1e44db=_0x1f128f;_0x49b4ad=0xc8;}else{_0x49b4ad=0xce;}_0x513417[_0x6d90('0x18')](_0x49b4ad);return _0x513417[_0x6d90('0x1e')]('Content-Range',_0x4dc4e3+'-'+_0x1e44db+'/'+_0x1f128f)['json'](_0x2c0b05);}return null;};}function patchUpdates(_0x4079c9){return function(_0x54a720){try{jsonpatch[_0x6d90('0x1f')](_0x54a720,_0x4079c9,!![]);}catch(_0x26374e){return BPromise['reject'](_0x26374e);}return _0x54a720['save']();};}function saveUpdates(_0x3f383d,_0x2ca50e){return function(_0x43b6bf){if(_0x43b6bf){return _0x43b6bf['update'](_0x3f383d)['then'](function(_0x48e63c){return _0x48e63c;});}return null;};}function removeEntity(_0x4cac22,_0x2d07f9){return function(_0x5703e6){if(_0x5703e6){return _0x5703e6[_0x6d90('0x20')]()[_0x6d90('0x21')](function(){_0x4cac22[_0x6d90('0x18')](0xcc)[_0x6d90('0x19')]();});}};}function handleEntityNotFound(_0x4378ca,_0x3dcccd){return function(_0x3aef5b){if(!_0x3aef5b){_0x4378ca[_0x6d90('0x17')](0x194);}return _0x3aef5b;};}function handleError(_0x243a32,_0x3b62da){_0x3b62da=_0x3b62da||0x1f4;return function(_0x1cf729){logger['error'](_0x1cf729[_0x6d90('0x22')]);if(_0x1cf729[_0x6d90('0x23')]){delete _0x1cf729[_0x6d90('0x23')];}_0x243a32['status'](_0x3b62da)[_0x6d90('0x24')](_0x1cf729);};}exports[_0x6d90('0x25')]=function(_0x20cbc6,_0x46d76b){var _0x40252c={},_0x41cdfc={},_0x17fada={'count':0x0,'rows':[]};var _0xd4696=_[_0x6d90('0x26')](db[_0x6d90('0x27')]['rawAttributes'],function(_0x5ec50d){return{'name':_0x5ec50d['fieldName'],'type':_0x5ec50d[_0x6d90('0x28')]['key']};});_0x41cdfc[_0x6d90('0x29')]=_[_0x6d90('0x26')](_0xd4696,_0x6d90('0x23'));_0x41cdfc[_0x6d90('0x2a')]=_[_0x6d90('0x2b')](_0x20cbc6[_0x6d90('0x2a')]);_0x41cdfc[_0x6d90('0x2c')]=_[_0x6d90('0x2d')](_0x41cdfc[_0x6d90('0x29')],_0x41cdfc[_0x6d90('0x2a')]);_0x40252c[_0x6d90('0x2e')]=_[_0x6d90('0x2d')](_0x41cdfc[_0x6d90('0x29')],qs['fields'](_0x20cbc6[_0x6d90('0x2a')][_0x6d90('0x2f')]));_0x40252c['attributes']=_0x40252c[_0x6d90('0x2e')][_0x6d90('0x30')]?_0x40252c['attributes']:_0x41cdfc[_0x6d90('0x29')];if(!_0x20cbc6[_0x6d90('0x2a')][_0x6d90('0x31')](_0x6d90('0x32'))){_0x40252c[_0x6d90('0x1d')]=qs[_0x6d90('0x1d')](_0x20cbc6[_0x6d90('0x2a')][_0x6d90('0x1d')]);_0x40252c[_0x6d90('0x1c')]=qs[_0x6d90('0x1c')](_0x20cbc6[_0x6d90('0x2a')][_0x6d90('0x1c')]);}_0x40252c[_0x6d90('0x33')]=qs[_0x6d90('0x34')](_0x20cbc6[_0x6d90('0x2a')][_0x6d90('0x34')]);_0x40252c[_0x6d90('0x35')]=qs[_0x6d90('0x2c')](_['pick'](_0x20cbc6[_0x6d90('0x2a')],_0x41cdfc['filters']));if(_0x20cbc6[_0x6d90('0x2a')][_0x6d90('0x36')]){_0x40252c['where']=_[_0x6d90('0x37')](_0x40252c[_0x6d90('0x35')],{'$or':_['map'](_0xd4696,function(_0x2d8182){if(_0x2d8182[_0x6d90('0x28')]!==_0x6d90('0x38')){var _0xae7292={};_0xae7292[_0x2d8182[_0x6d90('0x23')]]={'$like':'%'+_0x20cbc6['query'][_0x6d90('0x36')]+'%'};return _0xae7292;}})});}_0x40252c=_[_0x6d90('0x37')]({},_0x40252c,_0x20cbc6[_0x6d90('0x39')]);var _0x58f0b9={'where':_0x40252c[_0x6d90('0x35')]};return db['OpenchannelQueueReport'][_0x6d90('0x1b')](_0x58f0b9)['then'](function(_0x5519d7){_0x17fada[_0x6d90('0x1b')]=_0x5519d7;if(_0x20cbc6[_0x6d90('0x2a')][_0x6d90('0x3a')]){_0x40252c[_0x6d90('0x3b')]=[{'all':!![]}];}return db[_0x6d90('0x27')][_0x6d90('0x3c')](_0x40252c);})[_0x6d90('0x21')](function(_0x1b416b){_0x17fada[_0x6d90('0x3d')]=_0x1b416b;return _0x17fada;})[_0x6d90('0x21')](respondWithFilteredResult(_0x46d76b,_0x40252c))['catch'](handleError(_0x46d76b,null));};exports['show']=function(_0x513fe9,_0x561531){var _0x4f424c={'raw':!![],'where':{'id':_0x513fe9[_0x6d90('0x3e')]['id']}},_0x523f1e={};_0x523f1e['model']=_[_0x6d90('0x2b')](db[_0x6d90('0x27')][_0x6d90('0x3f')]);_0x523f1e[_0x6d90('0x2a')]=_['keys'](_0x513fe9[_0x6d90('0x2a')]);_0x523f1e['filters']=_[_0x6d90('0x2d')](_0x523f1e[_0x6d90('0x29')],_0x523f1e[_0x6d90('0x2a')]);_0x4f424c[_0x6d90('0x2e')]=_[_0x6d90('0x2d')](_0x523f1e['model'],qs[_0x6d90('0x2f')](_0x513fe9[_0x6d90('0x2a')][_0x6d90('0x2f')]));_0x4f424c[_0x6d90('0x2e')]=_0x4f424c[_0x6d90('0x2e')]['length']?_0x4f424c[_0x6d90('0x2e')]:_0x523f1e[_0x6d90('0x29')];if(_0x513fe9['query'][_0x6d90('0x3a')]){_0x4f424c[_0x6d90('0x3b')]=[{'all':!![]}];}_0x4f424c=_['merge']({},_0x4f424c,_0x513fe9['options']);return db[_0x6d90('0x27')][_0x6d90('0x40')](_0x4f424c)[_0x6d90('0x21')](handleEntityNotFound(_0x561531,null))[_0x6d90('0x21')](respondWithResult(_0x561531,null))[_0x6d90('0x41')](handleError(_0x561531,null));};exports[_0x6d90('0x42')]=function(_0x3beede,_0x180226){return db[_0x6d90('0x27')][_0x6d90('0x42')](_0x3beede[_0x6d90('0x43')],{})['then'](respondWithResult(_0x180226,0xc9))[_0x6d90('0x41')](handleError(_0x180226,null));};exports['update']=function(_0x5de697,_0x5c46e3){if(_0x5de697[_0x6d90('0x43')]['id']){delete _0x5de697[_0x6d90('0x43')]['id'];}return db[_0x6d90('0x27')][_0x6d90('0x40')]({'where':{'id':_0x5de697[_0x6d90('0x3e')]['id']}})[_0x6d90('0x21')](handleEntityNotFound(_0x5c46e3,null))[_0x6d90('0x21')](saveUpdates(_0x5de697[_0x6d90('0x43')],null))['then'](respondWithResult(_0x5c46e3,null))[_0x6d90('0x41')](handleError(_0x5c46e3,null));};exports[_0x6d90('0x20')]=function(_0x5eba5e,_0x2e2054){return db[_0x6d90('0x27')][_0x6d90('0x40')]({'where':{'id':_0x5eba5e[_0x6d90('0x3e')]['id']}})[_0x6d90('0x21')](handleEntityNotFound(_0x2e2054,null))[_0x6d90('0x21')](removeEntity(_0x2e2054,null))['catch'](handleError(_0x2e2054,null));};exports[_0x6d90('0x44')]=function(_0x16e9cd,_0x5301a8){return db[_0x6d90('0x27')][_0x6d90('0x44')]()[_0x6d90('0x21')](respondWithResult(_0x5301a8,null))['catch'](handleError(_0x5301a8,null));}; \ No newline at end of file +var _0x565e=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','include','then','rows','catch','show','params','includeAll','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4e9047,_0x3b24b3){var _0x403b10=function(_0x4a2e47){while(--_0x4a2e47){_0x4e9047['push'](_0x4e9047['shift']());}};_0x403b10(++_0x3b24b3);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe565('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe565('0x1'));var zipdir=require(_0xe565('0x2'));var jsonpatch=require(_0xe565('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe565('0x4'));var Mustache=require(_0xe565('0x5'));var util=require(_0xe565('0x6'));var path=require(_0xe565('0x7'));var sox=require(_0xe565('0x8'));var csv=require(_0xe565('0x9'));var ejs=require(_0xe565('0xa'));var fs=require('fs');var _=require(_0xe565('0xb'));var squel=require(_0xe565('0xc'));var crypto=require(_0xe565('0xd'));var jsforce=require(_0xe565('0xe'));var deskjs=require(_0xe565('0xf'));var toCsv=require(_0xe565('0x9'));var querystring=require(_0xe565('0x10'));var Papa=require(_0xe565('0x11'));var Redis=require(_0xe565('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe565('0x13'));var as=require(_0xe565('0x14'));var hardwareService=require(_0xe565('0x15'));var logger=require('../../config/logger')(_0xe565('0x16'));var utils=require(_0xe565('0x17'));var config=require(_0xe565('0x18'));var db=require(_0xe565('0x19'))['db'];function respondWithStatusCode(_0x590517,_0x21a0bd){_0x21a0bd=_0x21a0bd||0xcc;return function(_0x4d7cc2){if(_0x4d7cc2){return _0x590517[_0xe565('0x1a')](_0x21a0bd);}return _0x590517['status'](_0x21a0bd)[_0xe565('0x1b')]();};}function respondWithResult(_0x449750,_0x1cc388){_0x1cc388=_0x1cc388||0xc8;return function(_0x4b08c2){if(_0x4b08c2){return _0x449750[_0xe565('0x1c')](_0x1cc388)[_0xe565('0x1d')](_0x4b08c2);}};}function respondWithFilteredResult(_0x127b29,_0x31b6c3){return function(_0x52b772){if(_0x52b772){var _0xcc7bad=_0x52b772[_0xe565('0x1e')],_0x41ebb8=_0x31b6c3[_0xe565('0x1f')],_0x34a674=_0x31b6c3['offset']+_0x31b6c3[_0xe565('0x20')],_0x178195;if(_0x34a674>=_0xcc7bad){_0x34a674=_0xcc7bad;_0x178195=0xc8;}else{_0x178195=0xce;}_0x127b29[_0xe565('0x1c')](_0x178195);return _0x127b29[_0xe565('0x21')](_0xe565('0x22'),_0x41ebb8+'-'+_0x34a674+'/'+_0xcc7bad)['json'](_0x52b772);}return null;};}function patchUpdates(_0x403f94){return function(_0x41c80e){try{jsonpatch['apply'](_0x41c80e,_0x403f94,!![]);}catch(_0x515786){return BPromise[_0xe565('0x23')](_0x515786);}return _0x41c80e[_0xe565('0x24')]();};}function saveUpdates(_0x537734,_0x3efaa1){return function(_0x43e075){if(_0x43e075){return _0x43e075[_0xe565('0x25')](_0x537734)['then'](function(_0x491f8b){return _0x491f8b;});}return null;};}function removeEntity(_0x38898b,_0x5074b9){return function(_0x2c290c){if(_0x2c290c){return _0x2c290c[_0xe565('0x26')]()['then'](function(){_0x38898b[_0xe565('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30b376,_0x885f91){return function(_0xe84b4c){if(!_0xe84b4c){_0x30b376['sendStatus'](0x194);}return _0xe84b4c;};}function handleError(_0x2d31bd,_0x1e13aa){_0x1e13aa=_0x1e13aa||0x1f4;return function(_0x14f04a){logger[_0xe565('0x27')](_0x14f04a['stack']);if(_0x14f04a[_0xe565('0x28')]){delete _0x14f04a['name'];}_0x2d31bd[_0xe565('0x1c')](_0x1e13aa)[_0xe565('0x29')](_0x14f04a);};}exports[_0xe565('0x2a')]=function(_0x4ed3bf,_0x16b0f2){var _0x3775ed={},_0x32bf95={},_0x3eec54={'count':0x0,'rows':[]};var _0x31cfe7=_[_0xe565('0x2b')](db[_0xe565('0x2c')][_0xe565('0x2d')],function(_0x4ffd31){return{'name':_0x4ffd31[_0xe565('0x2e')],'type':_0x4ffd31['type'][_0xe565('0x2f')]};});_0x32bf95['model']=_['map'](_0x31cfe7,_0xe565('0x28'));_0x32bf95['query']=_[_0xe565('0x30')](_0x4ed3bf[_0xe565('0x31')]);_0x32bf95[_0xe565('0x32')]=_[_0xe565('0x33')](_0x32bf95[_0xe565('0x34')],_0x32bf95[_0xe565('0x31')]);_0x3775ed[_0xe565('0x35')]=_['intersection'](_0x32bf95['model'],qs[_0xe565('0x36')](_0x4ed3bf[_0xe565('0x31')][_0xe565('0x36')]));_0x3775ed[_0xe565('0x35')]=_0x3775ed['attributes'][_0xe565('0x37')]?_0x3775ed[_0xe565('0x35')]:_0x32bf95[_0xe565('0x34')];if(!_0x4ed3bf[_0xe565('0x31')][_0xe565('0x38')]('nolimit')){_0x3775ed[_0xe565('0x20')]=qs[_0xe565('0x20')](_0x4ed3bf[_0xe565('0x31')][_0xe565('0x20')]);_0x3775ed['offset']=qs[_0xe565('0x1f')](_0x4ed3bf[_0xe565('0x31')][_0xe565('0x1f')]);}_0x3775ed['order']=qs[_0xe565('0x39')](_0x4ed3bf[_0xe565('0x31')]['sort']);_0x3775ed[_0xe565('0x3a')]=qs[_0xe565('0x32')](_['pick'](_0x4ed3bf[_0xe565('0x31')],_0x32bf95[_0xe565('0x32')]));if(_0x4ed3bf[_0xe565('0x31')][_0xe565('0x3b')]){_0x3775ed[_0xe565('0x3a')]=_[_0xe565('0x3c')](_0x3775ed[_0xe565('0x3a')],{'$or':_[_0xe565('0x2b')](_0x31cfe7,function(_0x269f0d){if(_0x269f0d[_0xe565('0x3d')]!==_0xe565('0x3e')){var _0x22fb8b={};_0x22fb8b[_0x269f0d[_0xe565('0x28')]]={'$like':'%'+_0x4ed3bf['query'][_0xe565('0x3b')]+'%'};return _0x22fb8b;}})});}_0x3775ed=_[_0xe565('0x3c')]({},_0x3775ed,_0x4ed3bf[_0xe565('0x3f')]);var _0x3ce1d4={'where':_0x3775ed['where']};return db['OpenchannelQueueReport'][_0xe565('0x1e')](_0x3ce1d4)['then'](function(_0x4d18a3){_0x3eec54[_0xe565('0x1e')]=_0x4d18a3;if(_0x4ed3bf['query']['includeAll']){_0x3775ed[_0xe565('0x40')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x3775ed);})[_0xe565('0x41')](function(_0x2423c9){_0x3eec54[_0xe565('0x42')]=_0x2423c9;return _0x3eec54;})[_0xe565('0x41')](respondWithFilteredResult(_0x16b0f2,_0x3775ed))[_0xe565('0x43')](handleError(_0x16b0f2,null));};exports[_0xe565('0x44')]=function(_0x1f2fc8,_0x322b23){var _0x33ee91={'raw':!![],'where':{'id':_0x1f2fc8[_0xe565('0x45')]['id']}},_0x5d8be3={};_0x5d8be3[_0xe565('0x34')]=_[_0xe565('0x30')](db[_0xe565('0x2c')][_0xe565('0x2d')]);_0x5d8be3[_0xe565('0x31')]=_[_0xe565('0x30')](_0x1f2fc8[_0xe565('0x31')]);_0x5d8be3['filters']=_[_0xe565('0x33')](_0x5d8be3[_0xe565('0x34')],_0x5d8be3[_0xe565('0x31')]);_0x33ee91[_0xe565('0x35')]=_[_0xe565('0x33')](_0x5d8be3['model'],qs[_0xe565('0x36')](_0x1f2fc8[_0xe565('0x31')][_0xe565('0x36')]));_0x33ee91[_0xe565('0x35')]=_0x33ee91[_0xe565('0x35')][_0xe565('0x37')]?_0x33ee91['attributes']:_0x5d8be3[_0xe565('0x34')];if(_0x1f2fc8['query'][_0xe565('0x46')]){_0x33ee91[_0xe565('0x40')]=[{'all':!![]}];}_0x33ee91=_[_0xe565('0x3c')]({},_0x33ee91,_0x1f2fc8['options']);return db['OpenchannelQueueReport']['find'](_0x33ee91)[_0xe565('0x41')](handleEntityNotFound(_0x322b23,null))[_0xe565('0x41')](respondWithResult(_0x322b23,null))[_0xe565('0x43')](handleError(_0x322b23,null));};exports['create']=function(_0x36664b,_0x575114){return db[_0xe565('0x2c')]['create'](_0x36664b[_0xe565('0x47')],{})[_0xe565('0x41')](respondWithResult(_0x575114,0xc9))['catch'](handleError(_0x575114,null));};exports[_0xe565('0x25')]=function(_0x5387a3,_0x3495d1){if(_0x5387a3[_0xe565('0x47')]['id']){delete _0x5387a3['body']['id'];}return db[_0xe565('0x2c')][_0xe565('0x48')]({'where':{'id':_0x5387a3[_0xe565('0x45')]['id']}})[_0xe565('0x41')](handleEntityNotFound(_0x3495d1,null))[_0xe565('0x41')](saveUpdates(_0x5387a3[_0xe565('0x47')],null))['then'](respondWithResult(_0x3495d1,null))[_0xe565('0x43')](handleError(_0x3495d1,null));};exports[_0xe565('0x26')]=function(_0x4dd9e4,_0xbaed43){return db['OpenchannelQueueReport'][_0xe565('0x48')]({'where':{'id':_0x4dd9e4[_0xe565('0x45')]['id']}})[_0xe565('0x41')](handleEntityNotFound(_0xbaed43,null))[_0xe565('0x41')](removeEntity(_0xbaed43,null))['catch'](handleError(_0xbaed43,null));};exports[_0xe565('0x49')]=function(_0x39e1ab,_0x346f96){return db[_0xe565('0x2c')][_0xe565('0x49')]()[_0xe565('0x41')](respondWithResult(_0x346f96,null))[_0xe565('0x43')](handleError(_0x346f96,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 8767ffb..69a5951 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 _0x6c32=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash','util'];(function(_0x189305,_0x46c43f){var _0xea3406=function(_0x2aa435){while(--_0x2aa435){_0x189305['push'](_0x189305['shift']());}};_0xea3406(++_0x46c43f);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26c3('0x0'));var util=require(_0x26c3('0x1'));var logger=require(_0x26c3('0x2'))(_0x26c3('0x3'));var moment=require(_0x26c3('0x4'));var BPromise=require(_0x26c3('0x5'));var rp=require(_0x26c3('0x6'));var fs=require('fs');var path=require(_0x26c3('0x7'));var rimraf=require(_0x26c3('0x8'));var config=require('../../config/environment');var attributes=require(_0x26c3('0x9'));module[_0x26c3('0xa')]=function(_0x15ac36,_0x57d915){return _0x15ac36[_0x26c3('0xb')]('OpenchannelQueueReport',attributes,{'tableName':_0x26c3('0xc'),'paranoid':![],'indexes':[{'name':_0x26c3('0xd'),'fields':[_0x26c3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e35=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xd4dcea,_0x336759){var _0x1b656c=function(_0x2bc50c){while(--_0x2bc50c){_0xd4dcea['push'](_0xd4dcea['shift']());}};_0x1b656c(++_0x336759);}(_0x2e35,0x101));var _0x52e3=function(_0x2c0cc0,_0x149c6e){_0x2c0cc0=_0x2c0cc0-0x0;var _0x24bfcb=_0x2e35[_0x2c0cc0];return _0x24bfcb;};'use strict';var _=require(_0x52e3('0x0'));var util=require('util');var logger=require(_0x52e3('0x1'))('api');var moment=require(_0x52e3('0x2'));var BPromise=require(_0x52e3('0x3'));var rp=require(_0x52e3('0x4'));var fs=require('fs');var path=require(_0x52e3('0x5'));var rimraf=require('rimraf');var config=require(_0x52e3('0x6'));var attributes=require('./openchannelQueueReport.attributes');module['exports']=function(_0x583d54,_0x8477a3){return _0x583d54[_0x52e3('0x7')](_0x52e3('0x8'),attributes,{'tableName':_0x52e3('0x9'),'paranoid':![],'indexes':[{'name':_0x52e3('0xa'),'fields':[_0x52e3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index d910f1e..733cd3c 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 _0xd991=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','debug','stringify','UpdateOpenchannelQueueReport','update','body','options','raw','where','limit','lodash','util','moment'];(function(_0x12774d,_0x27065c){var _0x2b335a=function(_0x38f0f8){while(--_0x38f0f8){_0x12774d['push'](_0x12774d['shift']());}};_0x2b335a(++_0x27065c);}(_0xd991,0x115));var _0x1d99=function(_0x243168,_0xb9ad43){_0x243168=_0x243168-0x0;var _0x883380=_0xd991[_0x243168];return _0x883380;};'use strict';var _=require(_0x1d99('0x0'));var util=require(_0x1d99('0x1'));var moment=require(_0x1d99('0x2'));var BPromise=require(_0x1d99('0x3'));var rs=require(_0x1d99('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d99('0x5'))['db'];var utils=require(_0x1d99('0x6'));var logger=require(_0x1d99('0x7'))(_0x1d99('0x8'));var config=require(_0x1d99('0x9'));var jayson=require(_0x1d99('0xa'));var client=jayson['client'][_0x1d99('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x440bb4,_0x5100fc,_0x21d746){return new BPromise(function(_0x2f4502,_0x6de8e8){return client[_0x1d99('0xc')](_0x440bb4,_0x21d746)[_0x1d99('0xd')](function(_0x3d55b1){logger[_0x1d99('0xe')](_0x1d99('0xf'),_0x5100fc,_0x1d99('0x10'));logger['debug'](_0x1d99('0x11'),_0x5100fc,_0x1d99('0x10'),JSON['stringify'](_0x3d55b1));if(_0x3d55b1[_0x1d99('0x12')]){if(_0x3d55b1[_0x1d99('0x12')][_0x1d99('0x13')]===0x1f4){logger['error'](_0x1d99('0xf'),_0x5100fc,_0x3d55b1[_0x1d99('0x12')][_0x1d99('0x14')]);return _0x6de8e8(_0x3d55b1[_0x1d99('0x12')][_0x1d99('0x14')]);}logger[_0x1d99('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5100fc,_0x3d55b1[_0x1d99('0x12')]['message']);return _0x2f4502(_0x3d55b1[_0x1d99('0x12')]['message']);}else{logger[_0x1d99('0xe')](_0x1d99('0xf'),_0x5100fc,_0x1d99('0x10'));_0x2f4502(_0x3d55b1[_0x1d99('0x15')][_0x1d99('0x14')]);}})[_0x1d99('0x16')](function(_0x8cf8b8){logger[_0x1d99('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5100fc,_0x8cf8b8);_0x6de8e8(_0x8cf8b8);});});}exports[_0x1d99('0x17')]=function(_0x4da463){var _0x3669d1=this;return new Promise(function(_0x1a51a4,_0xb6555a){return db[_0x1d99('0x18')][_0x1d99('0x19')](_0x4da463['body'],{'raw':_0x4da463['options']?_0x4da463['options']['raw']===undefined?!![]:![]:!![]})[_0x1d99('0xd')](function(_0x20af77){logger[_0x1d99('0xe')](_0x1d99('0x17'),_0x4da463);logger[_0x1d99('0x1a')]('CreateOpenchannelQueueReport',_0x4da463,JSON[_0x1d99('0x1b')](_0x20af77));_0x1a51a4(_0x20af77);})[_0x1d99('0x16')](function(_0x4a72ac){logger[_0x1d99('0x12')](_0x1d99('0x17'),_0x4a72ac[_0x1d99('0x14')],_0x4da463);_0xb6555a(_0x3669d1[_0x1d99('0x12')](0x1f4,_0x4a72ac[_0x1d99('0x14')]));});});};exports[_0x1d99('0x1c')]=function(_0x54a295){var _0x8318c3=this;return new Promise(function(_0x1fb076,_0x489d3f){return db[_0x1d99('0x18')][_0x1d99('0x1d')](_0x54a295[_0x1d99('0x1e')],{'raw':_0x54a295[_0x1d99('0x1f')]?_0x54a295['options'][_0x1d99('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54a295['options']?_0x54a295[_0x1d99('0x1f')][_0x1d99('0x21')]||null:null,'attributes':_0x54a295[_0x1d99('0x1f')]?_0x54a295[_0x1d99('0x1f')]['attributes']||null:null,'limit':_0x54a295[_0x1d99('0x1f')]?_0x54a295[_0x1d99('0x1f')][_0x1d99('0x22')]||null:null})[_0x1d99('0xd')](function(_0x11bff3){logger[_0x1d99('0xe')]('UpdateOpenchannelQueueReport',_0x54a295);logger[_0x1d99('0x1a')](_0x1d99('0x1c'),_0x54a295,JSON[_0x1d99('0x1b')](_0x11bff3));_0x1fb076(_0x11bff3);})[_0x1d99('0x16')](function(_0x34308d){logger['error'](_0x1d99('0x1c'),_0x34308d[_0x1d99('0x14')],_0x54a295);_0x489d3f(_0x8318c3[_0x1d99('0x12')](0x1f4,_0x34308d[_0x1d99('0x14')]));});});}; \ No newline at end of file +var _0x68b3=['error','code','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1d98da,_0x532964){var _0x2a56f2=function(_0x42db4d){while(--_0x42db4d){_0x1d98da['push'](_0x1d98da['shift']());}};_0x2a56f2(++_0x532964);}(_0x68b3,0x1d8));var _0x368b=function(_0x191d6b,_0x212880){_0x191d6b=_0x191d6b-0x0;var _0x410038=_0x68b3[_0x191d6b];return _0x410038;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});}exports[_0x368b('0x18')]=function(_0x540f57){var _0x5d543e=this;return new Promise(function(_0x3e2e9f,_0x27d2a0){return db[_0x368b('0x19')][_0x368b('0x1a')](_0x540f57[_0x368b('0x1b')],{'raw':_0x540f57['options']?_0x540f57[_0x368b('0x1c')][_0x368b('0x1d')]===undefined?!![]:![]:!![]})[_0x368b('0xd')](function(_0x1c927f){logger[_0x368b('0x15')](_0x368b('0x18'),_0x540f57);logger[_0x368b('0x10')](_0x368b('0x18'),_0x540f57,JSON['stringify'](_0x1c927f));_0x3e2e9f(_0x1c927f);})[_0x368b('0x17')](function(_0x2f08d9){logger[_0x368b('0x12')](_0x368b('0x18'),_0x2f08d9[_0x368b('0x14')],_0x540f57);_0x27d2a0(_0x5d543e['error'](0x1f4,_0x2f08d9[_0x368b('0x14')]));});});};exports[_0x368b('0x1e')]=function(_0x3a22bd){var _0xafa856=this;return new Promise(function(_0x77a269,_0x85515f){return db[_0x368b('0x19')][_0x368b('0x1f')](_0x3a22bd[_0x368b('0x1b')],{'raw':_0x3a22bd[_0x368b('0x1c')]?_0x3a22bd[_0x368b('0x1c')][_0x368b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a22bd[_0x368b('0x1c')]?_0x3a22bd[_0x368b('0x1c')][_0x368b('0x20')]||null:null,'attributes':_0x3a22bd[_0x368b('0x1c')]?_0x3a22bd[_0x368b('0x1c')][_0x368b('0x21')]||null:null,'limit':_0x3a22bd[_0x368b('0x1c')]?_0x3a22bd[_0x368b('0x1c')][_0x368b('0x22')]||null:null})[_0x368b('0xd')](function(_0x107d2f){logger[_0x368b('0x15')]('UpdateOpenchannelQueueReport',_0x3a22bd);logger['debug'](_0x368b('0x1e'),_0x3a22bd,JSON[_0x368b('0x11')](_0x107d2f));_0x77a269(_0x107d2f);})[_0x368b('0x17')](function(_0x152048){logger['error'](_0x368b('0x1e'),_0x152048[_0x368b('0x14')],_0x3a22bd);_0x85515f(_0xafa856[_0x368b('0x12')](0x1f4,_0x152048[_0x368b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 805925a..564a092 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(_0x1a8bbc,_0x17a086){var _0x212fc2=function(_0x55c718){while(--_0x55c718){_0x1a8bbc['push'](_0x1a8bbc['shift']());}};_0x212fc2(++_0x17a086);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x5bf420,_0x2d068d){var _0x1c5255=function(_0x4964a2){while(--_0x4964a2){_0x5bf420['push'](_0x5bf420['shift']());}};_0x1c5255(++_0x2d068d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 5bce98c..11e8659 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 _0xaf40=['queue','NOW','moment','exports','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf40,0x1dc));var _0x0af4=function(_0x2d7fdc,_0x23c695){_0x2d7fdc=_0x2d7fdc-0x0;var _0x3b56a6=_0xaf40[_0x2d7fdc];return _0x3b56a6;};'use strict';var moment=require(_0x0af4('0x0'));var Sequelize=require('sequelize');module[_0x0af4('0x1')]={'uniqueid':{'type':Sequelize[_0x0af4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0af4('0x3')]('account','agent',_0x0af4('0x4')),'allowNull':![],'defaultValue':_0x0af4('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x0af4('0x5')]}}; \ No newline at end of file +var _0x9822=['DATE','moment','exports','STRING','ENUM','queue'];(function(_0x36bab3,_0x19ce33){var _0x2d3989=function(_0x2a4f60){while(--_0x2a4f60){_0x36bab3['push'](_0x36bab3['shift']());}};_0x2d3989(++_0x19ce33);}(_0x9822,0x13f));var _0x2982=function(_0x10a637,_0x40c932){_0x10a637=_0x10a637-0x0;var _0x155813=_0x9822[_0x10a637];return _0x155813;};'use strict';var moment=require(_0x2982('0x0'));var Sequelize=require('sequelize');module[_0x2982('0x1')]={'uniqueid':{'type':Sequelize[_0x2982('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2982('0x3')]('account','agent',_0x2982('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x2982('0x5')],'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 3cfb00f..56cb67d 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 _0x022d=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','limit','status','set','apply','save','update','then','destroy','end','error','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','name','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','keys','find','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1eaf5e,_0x333d16){var _0x409fa2=function(_0x57f633){while(--_0x57f633){_0x1eaf5e['push'](_0x1eaf5e['shift']());}};_0x409fa2(++_0x333d16);}(_0x022d,0xc5));var _0xd022=function(_0x380522,_0x32a8a5){_0x380522=_0x380522-0x0;var _0x570fa7=_0x022d[_0x380522];return _0x570fa7;};'use strict';var pdf=require(_0xd022('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd022('0x1'));var zipdir=require(_0xd022('0x2'));var jsonpatch=require(_0xd022('0x3'));var rp=require(_0xd022('0x4'));var moment=require('moment');var BPromise=require(_0xd022('0x5'));var Mustache=require(_0xd022('0x6'));var util=require(_0xd022('0x7'));var path=require(_0xd022('0x8'));var sox=require(_0xd022('0x9'));var csv=require(_0xd022('0xa'));var ejs=require(_0xd022('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd022('0xc'));var crypto=require(_0xd022('0xd'));var jsforce=require(_0xd022('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd022('0xa'));var querystring=require(_0xd022('0xf'));var Papa=require('papaparse');var Redis=require(_0xd022('0x10'));var authService=require(_0xd022('0x11'));var qs=require(_0xd022('0x12'));var as=require(_0xd022('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd022('0x14'))(_0xd022('0x15'));var utils=require(_0xd022('0x16'));var config=require(_0xd022('0x17'));var db=require(_0xd022('0x18'))['db'];function respondWithStatusCode(_0xe4bc2b,_0x1350b9){_0x1350b9=_0x1350b9||0xcc;return function(_0x26ae81){if(_0x26ae81){return _0xe4bc2b[_0xd022('0x19')](_0x1350b9);}return _0xe4bc2b['status'](_0x1350b9)['end']();};}function respondWithResult(_0x1264bf,_0x425177){_0x425177=_0x425177||0xc8;return function(_0xaf228c){if(_0xaf228c){return _0x1264bf['status'](_0x425177)[_0xd022('0x1a')](_0xaf228c);}};}function respondWithFilteredResult(_0x3077ab,_0x12e565){return function(_0x33c433){if(_0x33c433){var _0x4f44e4=_0x33c433[_0xd022('0x1b')],_0x107bb1=_0x12e565[_0xd022('0x1c')],_0x26e4b9=_0x12e565[_0xd022('0x1c')]+_0x12e565[_0xd022('0x1d')],_0x30ccbe;if(_0x26e4b9>=_0x4f44e4){_0x26e4b9=_0x4f44e4;_0x30ccbe=0xc8;}else{_0x30ccbe=0xce;}_0x3077ab[_0xd022('0x1e')](_0x30ccbe);return _0x3077ab[_0xd022('0x1f')]('Content-Range',_0x107bb1+'-'+_0x26e4b9+'/'+_0x4f44e4)[_0xd022('0x1a')](_0x33c433);}return null;};}function patchUpdates(_0x24b8ff){return function(_0x5485bc){try{jsonpatch[_0xd022('0x20')](_0x5485bc,_0x24b8ff,!![]);}catch(_0x462c91){return BPromise['reject'](_0x462c91);}return _0x5485bc[_0xd022('0x21')]();};}function saveUpdates(_0x135c68,_0x503dab){return function(_0x260d24){if(_0x260d24){return _0x260d24[_0xd022('0x22')](_0x135c68)[_0xd022('0x23')](function(_0x332227){return _0x332227;});}return null;};}function removeEntity(_0x62fc48,_0x14cf19){return function(_0x42274d){if(_0x42274d){return _0x42274d[_0xd022('0x24')]()[_0xd022('0x23')](function(){_0x62fc48['status'](0xcc)[_0xd022('0x25')]();});}};}function handleEntityNotFound(_0x348124,_0x183532){return function(_0x637363){if(!_0x637363){_0x348124[_0xd022('0x19')](0x194);}return _0x637363;};}function handleError(_0x3d57d3,_0x52bfdc){_0x52bfdc=_0x52bfdc||0x1f4;return function(_0x3d33a3){logger[_0xd022('0x26')](_0x3d33a3['stack']);if(_0x3d33a3['name']){delete _0x3d33a3['name'];}_0x3d57d3['status'](_0x52bfdc)[_0xd022('0x27')](_0x3d33a3);};}exports[_0xd022('0x28')]=function(_0x408b88,_0x218e94){var _0x1b3ced={},_0x85ad24={},_0x3374de={'count':0x0,'rows':[]};var _0x1a08d4=_[_0xd022('0x29')](db[_0xd022('0x2a')][_0xd022('0x2b')],function(_0x48b2b3){return{'name':_0x48b2b3[_0xd022('0x2c')],'type':_0x48b2b3[_0xd022('0x2d')][_0xd022('0x2e')]};});_0x85ad24[_0xd022('0x2f')]=_['map'](_0x1a08d4,_0xd022('0x30'));_0x85ad24[_0xd022('0x31')]=_['keys'](_0x408b88[_0xd022('0x31')]);_0x85ad24['filters']=_[_0xd022('0x32')](_0x85ad24[_0xd022('0x2f')],_0x85ad24[_0xd022('0x31')]);_0x1b3ced['attributes']=_['intersection'](_0x85ad24[_0xd022('0x2f')],qs[_0xd022('0x33')](_0x408b88[_0xd022('0x31')][_0xd022('0x33')]));_0x1b3ced[_0xd022('0x34')]=_0x1b3ced[_0xd022('0x34')]['length']?_0x1b3ced[_0xd022('0x34')]:_0x85ad24[_0xd022('0x2f')];if(!_0x408b88[_0xd022('0x31')][_0xd022('0x35')]('nolimit')){_0x1b3ced['limit']=qs[_0xd022('0x1d')](_0x408b88[_0xd022('0x31')]['limit']);_0x1b3ced[_0xd022('0x1c')]=qs[_0xd022('0x1c')](_0x408b88[_0xd022('0x31')][_0xd022('0x1c')]);}_0x1b3ced[_0xd022('0x36')]=qs[_0xd022('0x37')](_0x408b88[_0xd022('0x31')][_0xd022('0x37')]);_0x1b3ced[_0xd022('0x38')]=qs[_0xd022('0x39')](_[_0xd022('0x3a')](_0x408b88[_0xd022('0x31')],_0x85ad24['filters']));if(_0x408b88[_0xd022('0x31')][_0xd022('0x3b')]){_0x1b3ced[_0xd022('0x38')]=_[_0xd022('0x3c')](_0x1b3ced[_0xd022('0x38')],{'$or':_[_0xd022('0x29')](_0x1a08d4,function(_0x15f995){if(_0x15f995['type']!=='VIRTUAL'){var _0x5b0964={};_0x5b0964[_0x15f995[_0xd022('0x30')]]={'$like':'%'+_0x408b88['query'][_0xd022('0x3b')]+'%'};return _0x5b0964;}})});}_0x1b3ced=_[_0xd022('0x3c')]({},_0x1b3ced,_0x408b88[_0xd022('0x3d')]);var _0x4ad3bc={'where':_0x1b3ced[_0xd022('0x38')]};return db[_0xd022('0x2a')]['count'](_0x4ad3bc)[_0xd022('0x23')](function(_0x1fd779){_0x3374de[_0xd022('0x1b')]=_0x1fd779;if(_0x408b88['query']['includeAll']){_0x1b3ced[_0xd022('0x3e')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xd022('0x3f')](_0x1b3ced);})[_0xd022('0x23')](function(_0x4384c8){_0x3374de[_0xd022('0x40')]=_0x4384c8;return _0x3374de;})[_0xd022('0x23')](respondWithFilteredResult(_0x218e94,_0x1b3ced))[_0xd022('0x41')](handleError(_0x218e94,null));};exports[_0xd022('0x42')]=function(_0x209953,_0x22ac0f){var _0x3a46f6={'raw':!![],'where':{'id':_0x209953['params']['id']}},_0x397d3e={};_0x397d3e['model']=_['keys'](db[_0xd022('0x2a')][_0xd022('0x2b')]);_0x397d3e[_0xd022('0x31')]=_[_0xd022('0x43')](_0x209953[_0xd022('0x31')]);_0x397d3e[_0xd022('0x39')]=_['intersection'](_0x397d3e['model'],_0x397d3e[_0xd022('0x31')]);_0x3a46f6[_0xd022('0x34')]=_[_0xd022('0x32')](_0x397d3e[_0xd022('0x2f')],qs['fields'](_0x209953[_0xd022('0x31')][_0xd022('0x33')]));_0x3a46f6[_0xd022('0x34')]=_0x3a46f6[_0xd022('0x34')]['length']?_0x3a46f6[_0xd022('0x34')]:_0x397d3e[_0xd022('0x2f')];if(_0x209953['query']['includeAll']){_0x3a46f6['include']=[{'all':!![]}];}_0x3a46f6=_[_0xd022('0x3c')]({},_0x3a46f6,_0x209953[_0xd022('0x3d')]);return db[_0xd022('0x2a')][_0xd022('0x44')](_0x3a46f6)[_0xd022('0x23')](handleEntityNotFound(_0x22ac0f,null))[_0xd022('0x23')](respondWithResult(_0x22ac0f,null))[_0xd022('0x41')](handleError(_0x22ac0f,null));};exports['create']=function(_0x2871d9,_0x562016){return db['OpenchannelTransferReport']['create'](_0x2871d9[_0xd022('0x45')],{})[_0xd022('0x23')](respondWithResult(_0x562016,0xc9))[_0xd022('0x41')](handleError(_0x562016,null));};exports[_0xd022('0x22')]=function(_0x3f8f05,_0x4e97ee){if(_0x3f8f05[_0xd022('0x45')]['id']){delete _0x3f8f05[_0xd022('0x45')]['id'];}return db['OpenchannelTransferReport'][_0xd022('0x44')]({'where':{'id':_0x3f8f05[_0xd022('0x46')]['id']}})[_0xd022('0x23')](handleEntityNotFound(_0x4e97ee,null))[_0xd022('0x23')](saveUpdates(_0x3f8f05[_0xd022('0x45')],null))[_0xd022('0x23')](respondWithResult(_0x4e97ee,null))[_0xd022('0x41')](handleError(_0x4e97ee,null));};exports[_0xd022('0x24')]=function(_0xafe12b,_0x4fedb8){return db['OpenchannelTransferReport'][_0xd022('0x44')]({'where':{'id':_0xafe12b['params']['id']}})['then'](handleEntityNotFound(_0x4fedb8,null))[_0xd022('0x23')](removeEntity(_0x4fedb8,null))['catch'](handleError(_0x4fedb8,null));};exports[_0xd022('0x47')]=function(_0x324563,_0xaa56bb){return db[_0xd022('0x2a')][_0xd022('0x47')]()[_0xd022('0x23')](respondWithResult(_0xaa56bb,null))[_0xd022('0x41')](handleError(_0xaa56bb,null));}; \ No newline at end of file +var _0xfffc=['destroy','error','stack','name','send','OpenchannelTransferReport','fieldName','type','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','sort','filters','merge','where','filter','includeAll','findAll','rows','show','params','keys','rawAttributes','include','options','find','catch','create','body','describe','html-pdf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','limit','Content-Range','json','apply','reject','save','then'];(function(_0x1b3d3e,_0x4c357f){var _0x509c95=function(_0x13ed7f){while(--_0x13ed7f){_0x1b3d3e['push'](_0x1b3d3e['shift']());}};_0x509c95(++_0x4c357f);}(_0xfffc,0x187));var _0xcfff=function(_0x5663ec,_0x3007b6){_0x5663ec=_0x5663ec-0x0;var _0x1977a3=_0xfffc[_0x5663ec];return _0x1977a3;};'use strict';var pdf=require(_0xcfff('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcfff('0x1'));var moment=require('moment');var BPromise=require(_0xcfff('0x2'));var Mustache=require(_0xcfff('0x3'));var util=require(_0xcfff('0x4'));var path=require(_0xcfff('0x5'));var sox=require(_0xcfff('0x6'));var csv=require(_0xcfff('0x7'));var ejs=require(_0xcfff('0x8'));var fs=require('fs');var _=require(_0xcfff('0x9'));var squel=require(_0xcfff('0xa'));var crypto=require('crypto');var jsforce=require(_0xcfff('0xb'));var deskjs=require(_0xcfff('0xc'));var toCsv=require(_0xcfff('0x7'));var querystring=require(_0xcfff('0xd'));var Papa=require(_0xcfff('0xe'));var Redis=require(_0xcfff('0xf'));var authService=require(_0xcfff('0x10'));var qs=require(_0xcfff('0x11'));var as=require(_0xcfff('0x12'));var hardwareService=require(_0xcfff('0x13'));var logger=require('../../config/logger')(_0xcfff('0x14'));var utils=require(_0xcfff('0x15'));var config=require(_0xcfff('0x16'));var db=require(_0xcfff('0x17'))['db'];function respondWithStatusCode(_0x1d0f9a,_0x2e6e98){_0x2e6e98=_0x2e6e98||0xcc;return function(_0x415e96){if(_0x415e96){return _0x1d0f9a[_0xcfff('0x18')](_0x2e6e98);}return _0x1d0f9a['status'](_0x2e6e98)[_0xcfff('0x19')]();};}function respondWithResult(_0xa651e7,_0x2186a5){_0x2186a5=_0x2186a5||0xc8;return function(_0x19c3d1){if(_0x19c3d1){return _0xa651e7[_0xcfff('0x1a')](_0x2186a5)['json'](_0x19c3d1);}};}function respondWithFilteredResult(_0x354dd8,_0x2cb881){return function(_0x45d5b0){if(_0x45d5b0){var _0x4e65d8=_0x45d5b0[_0xcfff('0x1b')],_0x3fb07a=_0x2cb881['offset'],_0x2f9fdb=_0x2cb881['offset']+_0x2cb881[_0xcfff('0x1c')],_0x5b2e7f;if(_0x2f9fdb>=_0x4e65d8){_0x2f9fdb=_0x4e65d8;_0x5b2e7f=0xc8;}else{_0x5b2e7f=0xce;}_0x354dd8[_0xcfff('0x1a')](_0x5b2e7f);return _0x354dd8['set'](_0xcfff('0x1d'),_0x3fb07a+'-'+_0x2f9fdb+'/'+_0x4e65d8)[_0xcfff('0x1e')](_0x45d5b0);}return null;};}function patchUpdates(_0x598046){return function(_0x2266eb){try{jsonpatch[_0xcfff('0x1f')](_0x2266eb,_0x598046,!![]);}catch(_0x2a114f){return BPromise[_0xcfff('0x20')](_0x2a114f);}return _0x2266eb[_0xcfff('0x21')]();};}function saveUpdates(_0x10c174,_0x304a06){return function(_0x32c443){if(_0x32c443){return _0x32c443['update'](_0x10c174)[_0xcfff('0x22')](function(_0x13c465){return _0x13c465;});}return null;};}function removeEntity(_0x3ac7f1,_0x29fbe0){return function(_0x1680fe){if(_0x1680fe){return _0x1680fe[_0xcfff('0x23')]()['then'](function(){_0x3ac7f1[_0xcfff('0x1a')](0xcc)[_0xcfff('0x19')]();});}};}function handleEntityNotFound(_0x4da851,_0x32ad40){return function(_0x59bad7){if(!_0x59bad7){_0x4da851['sendStatus'](0x194);}return _0x59bad7;};}function handleError(_0x58196d,_0x135bd2){_0x135bd2=_0x135bd2||0x1f4;return function(_0x4d5114){logger[_0xcfff('0x24')](_0x4d5114[_0xcfff('0x25')]);if(_0x4d5114[_0xcfff('0x26')]){delete _0x4d5114[_0xcfff('0x26')];}_0x58196d[_0xcfff('0x1a')](_0x135bd2)[_0xcfff('0x27')](_0x4d5114);};}exports['index']=function(_0x1ee44a,_0x4fe31e){var _0x42af75={},_0x5b1785={},_0x132c1a={'count':0x0,'rows':[]};var _0x13056f=_['map'](db[_0xcfff('0x28')]['rawAttributes'],function(_0x462d4d){return{'name':_0x462d4d[_0xcfff('0x29')],'type':_0x462d4d[_0xcfff('0x2a')]['key']};});_0x5b1785['model']=_['map'](_0x13056f,_0xcfff('0x26'));_0x5b1785['query']=_['keys'](_0x1ee44a[_0xcfff('0x2b')]);_0x5b1785['filters']=_[_0xcfff('0x2c')](_0x5b1785['model'],_0x5b1785['query']);_0x42af75[_0xcfff('0x2d')]=_['intersection'](_0x5b1785[_0xcfff('0x2e')],qs['fields'](_0x1ee44a[_0xcfff('0x2b')][_0xcfff('0x2f')]));_0x42af75['attributes']=_0x42af75[_0xcfff('0x2d')][_0xcfff('0x30')]?_0x42af75[_0xcfff('0x2d')]:_0x5b1785[_0xcfff('0x2e')];if(!_0x1ee44a[_0xcfff('0x2b')][_0xcfff('0x31')](_0xcfff('0x32'))){_0x42af75[_0xcfff('0x1c')]=qs['limit'](_0x1ee44a['query'][_0xcfff('0x1c')]);_0x42af75[_0xcfff('0x33')]=qs[_0xcfff('0x33')](_0x1ee44a[_0xcfff('0x2b')]['offset']);}_0x42af75['order']=qs[_0xcfff('0x34')](_0x1ee44a['query'][_0xcfff('0x34')]);_0x42af75['where']=qs[_0xcfff('0x35')](_['pick'](_0x1ee44a[_0xcfff('0x2b')],_0x5b1785[_0xcfff('0x35')]));if(_0x1ee44a['query']['filter']){_0x42af75['where']=_[_0xcfff('0x36')](_0x42af75[_0xcfff('0x37')],{'$or':_['map'](_0x13056f,function(_0x110c3c){if(_0x110c3c['type']!=='VIRTUAL'){var _0x5628d={};_0x5628d[_0x110c3c[_0xcfff('0x26')]]={'$like':'%'+_0x1ee44a[_0xcfff('0x2b')][_0xcfff('0x38')]+'%'};return _0x5628d;}})});}_0x42af75=_[_0xcfff('0x36')]({},_0x42af75,_0x1ee44a['options']);var _0x2720ba={'where':_0x42af75[_0xcfff('0x37')]};return db[_0xcfff('0x28')][_0xcfff('0x1b')](_0x2720ba)[_0xcfff('0x22')](function(_0x47ee5b){_0x132c1a[_0xcfff('0x1b')]=_0x47ee5b;if(_0x1ee44a[_0xcfff('0x2b')][_0xcfff('0x39')]){_0x42af75['include']=[{'all':!![]}];}return db[_0xcfff('0x28')][_0xcfff('0x3a')](_0x42af75);})['then'](function(_0x3e34bf){_0x132c1a[_0xcfff('0x3b')]=_0x3e34bf;return _0x132c1a;})[_0xcfff('0x22')](respondWithFilteredResult(_0x4fe31e,_0x42af75))['catch'](handleError(_0x4fe31e,null));};exports[_0xcfff('0x3c')]=function(_0x2a0386,_0x43b976){var _0x3cf02e={'raw':!![],'where':{'id':_0x2a0386[_0xcfff('0x3d')]['id']}},_0x2bc92c={};_0x2bc92c[_0xcfff('0x2e')]=_[_0xcfff('0x3e')](db[_0xcfff('0x28')][_0xcfff('0x3f')]);_0x2bc92c[_0xcfff('0x2b')]=_[_0xcfff('0x3e')](_0x2a0386[_0xcfff('0x2b')]);_0x2bc92c[_0xcfff('0x35')]=_['intersection'](_0x2bc92c[_0xcfff('0x2e')],_0x2bc92c[_0xcfff('0x2b')]);_0x3cf02e[_0xcfff('0x2d')]=_[_0xcfff('0x2c')](_0x2bc92c[_0xcfff('0x2e')],qs[_0xcfff('0x2f')](_0x2a0386[_0xcfff('0x2b')][_0xcfff('0x2f')]));_0x3cf02e[_0xcfff('0x2d')]=_0x3cf02e[_0xcfff('0x2d')][_0xcfff('0x30')]?_0x3cf02e[_0xcfff('0x2d')]:_0x2bc92c['model'];if(_0x2a0386['query'][_0xcfff('0x39')]){_0x3cf02e[_0xcfff('0x40')]=[{'all':!![]}];}_0x3cf02e=_[_0xcfff('0x36')]({},_0x3cf02e,_0x2a0386[_0xcfff('0x41')]);return db['OpenchannelTransferReport'][_0xcfff('0x42')](_0x3cf02e)['then'](handleEntityNotFound(_0x43b976,null))['then'](respondWithResult(_0x43b976,null))[_0xcfff('0x43')](handleError(_0x43b976,null));};exports[_0xcfff('0x44')]=function(_0x1495e1,_0x67c3b4){return db[_0xcfff('0x28')]['create'](_0x1495e1[_0xcfff('0x45')],{})[_0xcfff('0x22')](respondWithResult(_0x67c3b4,0xc9))[_0xcfff('0x43')](handleError(_0x67c3b4,null));};exports['update']=function(_0x2eb27b,_0xbed0ec){if(_0x2eb27b[_0xcfff('0x45')]['id']){delete _0x2eb27b[_0xcfff('0x45')]['id'];}return db[_0xcfff('0x28')]['find']({'where':{'id':_0x2eb27b[_0xcfff('0x3d')]['id']}})[_0xcfff('0x22')](handleEntityNotFound(_0xbed0ec,null))[_0xcfff('0x22')](saveUpdates(_0x2eb27b[_0xcfff('0x45')],null))[_0xcfff('0x22')](respondWithResult(_0xbed0ec,null))[_0xcfff('0x43')](handleError(_0xbed0ec,null));};exports[_0xcfff('0x23')]=function(_0x17ec14,_0x4b8901){return db[_0xcfff('0x28')][_0xcfff('0x42')]({'where':{'id':_0x17ec14[_0xcfff('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4b8901,null))[_0xcfff('0x22')](removeEntity(_0x4b8901,null))[_0xcfff('0x43')](handleError(_0x4b8901,null));};exports[_0xcfff('0x46')]=function(_0x1a25d3,_0x3dbc5b){return db[_0xcfff('0x28')][_0xcfff('0x46')]()[_0xcfff('0x22')](respondWithResult(_0x3dbc5b,null))[_0xcfff('0x43')](handleError(_0x3dbc5b,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 75892d6..113a448 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 _0x6c93=['exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x6c93,0xfc));var _0x36c9=function(_0x28add8,_0x18d6bd){_0x28add8=_0x28add8-0x0;var _0x2b1f4f=_0x6c93[_0x28add8];return _0x2b1f4f;};'use strict';var _=require(_0x36c9('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x36c9('0x1'));var BPromise=require(_0x36c9('0x2'));var rp=require(_0x36c9('0x3'));var fs=require('fs');var path=require(_0x36c9('0x4'));var rimraf=require(_0x36c9('0x5'));var config=require(_0x36c9('0x6'));var attributes=require(_0x36c9('0x7'));module[_0x36c9('0x8')]=function(_0x37fb09,_0x4841a6){return _0x37fb09[_0x36c9('0x9')](_0x36c9('0xa'),attributes,{'tableName':_0x36c9('0xb'),'paranoid':![],'indexes':[{'name':_0x36c9('0xc'),'fields':[_0x36c9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe5e0=['rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash','../../config/logger','bluebird','request-promise'];(function(_0x2185cd,_0x72c9ce){var _0x4a33d6=function(_0x339587){while(--_0x339587){_0x2185cd['push'](_0x2185cd['shift']());}};_0x4a33d6(++_0x72c9ce);}(_0xe5e0,0x1eb));var _0x0e5e=function(_0x3398ee,_0x30465b){_0x3398ee=_0x3398ee-0x0;var _0x36b074=_0xe5e0[_0x3398ee];return _0x36b074;};'use strict';var _=require(_0x0e5e('0x0'));var util=require('util');var logger=require(_0x0e5e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0e5e('0x2'));var rp=require(_0x0e5e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e5e('0x4'));var config=require(_0x0e5e('0x5'));var attributes=require(_0x0e5e('0x6'));module[_0x0e5e('0x7')]=function(_0xd9ce88,_0x111fd3){return _0xd9ce88[_0x0e5e('0x8')](_0x0e5e('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x0e5e('0xa'),'fields':[_0x0e5e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index a1d128d..7f04bee 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 _0x28ca=['catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','info','request\x20sent','debug','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result'];(function(_0x18d2a6,_0x5ae265){var _0x2dcac4=function(_0x458c5c){while(--_0x458c5c){_0x18d2a6['push'](_0x18d2a6['shift']());}};_0x2dcac4(++_0x5ae265);}(_0x28ca,0x89));var _0xa28c=function(_0xecafad,_0x67899f){_0xecafad=_0xecafad-0x0;var _0x1c578e=_0x28ca[_0xecafad];return _0x1c578e;};'use strict';var _=require('lodash');var util=require(_0xa28c('0x0'));var moment=require('moment');var BPromise=require(_0xa28c('0x1'));var rs=require(_0xa28c('0x2'));var fs=require('fs');var Redis=require(_0xa28c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa28c('0x4'));var logger=require(_0xa28c('0x5'))(_0xa28c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x45bcbc,_0x370890,_0x30b1b1){return new BPromise(function(_0x283ad4,_0x56a615){return client['request'](_0x45bcbc,_0x30b1b1)['then'](function(_0x53343e){logger[_0xa28c('0x7')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x370890,_0xa28c('0x8'));logger[_0xa28c('0x9')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x370890,_0xa28c('0x8'),JSON[_0xa28c('0xa')](_0x53343e));if(_0x53343e[_0xa28c('0xb')]){if(_0x53343e[_0xa28c('0xb')][_0xa28c('0xc')]===0x1f4){logger[_0xa28c('0xb')](_0xa28c('0xd'),_0x370890,_0x53343e[_0xa28c('0xb')]['message']);return _0x56a615(_0x53343e[_0xa28c('0xb')][_0xa28c('0xe')]);}logger['error'](_0xa28c('0xd'),_0x370890,_0x53343e[_0xa28c('0xb')]['message']);return _0x283ad4(_0x53343e['error'][_0xa28c('0xe')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x370890,'request\x20sent');_0x283ad4(_0x53343e[_0xa28c('0xf')][_0xa28c('0xe')]);}})[_0xa28c('0x10')](function(_0x292293){logger[_0xa28c('0xb')](_0xa28c('0xd'),_0x370890,_0x292293);_0x56a615(_0x292293);});});} \ No newline at end of file +var _0x2982=['../../config/logger','rpc','jayson/promise','client','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x2982,0x8d));var _0x2298=function(_0x17edc0,_0xb73f52){_0x17edc0=_0x17edc0-0x0;var _0x50da2a=_0x2982[_0x17edc0];return _0x50da2a;};'use strict';var _=require(_0x2298('0x0'));var util=require('util');var moment=require(_0x2298('0x1'));var BPromise=require(_0x2298('0x2'));var rs=require(_0x2298('0x3'));var fs=require('fs');var Redis=require(_0x2298('0x4'));var db=require(_0x2298('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2298('0x6'))(_0x2298('0x7'));var config=require('../../config/environment');var jayson=require(_0x2298('0x8'));var client=jayson[_0x2298('0x9')][_0x2298('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5111b1,_0x66d722,_0x1a8b71){return new BPromise(function(_0x562df7,_0x5d314e){return client['request'](_0x5111b1,_0x1a8b71)[_0x2298('0xb')](function(_0x5ef7e5){logger[_0x2298('0xc')](_0x2298('0xd'),_0x66d722,_0x2298('0xe'));logger['debug'](_0x2298('0xf'),_0x66d722,_0x2298('0xe'),JSON[_0x2298('0x10')](_0x5ef7e5));if(_0x5ef7e5[_0x2298('0x11')]){if(_0x5ef7e5[_0x2298('0x11')]['code']===0x1f4){logger[_0x2298('0x11')](_0x2298('0xd'),_0x66d722,_0x5ef7e5[_0x2298('0x11')][_0x2298('0x12')]);return _0x5d314e(_0x5ef7e5[_0x2298('0x11')][_0x2298('0x12')]);}logger['error'](_0x2298('0xd'),_0x66d722,_0x5ef7e5['error'][_0x2298('0x12')]);return _0x562df7(_0x5ef7e5[_0x2298('0x11')][_0x2298('0x12')]);}else{logger['info'](_0x2298('0xd'),_0x66d722,_0x2298('0xe'));_0x562df7(_0x5ef7e5[_0x2298('0x13')][_0x2298('0x12')]);}})[_0x2298('0x14')](function(_0xf332b3){logger[_0x2298('0x11')](_0x2298('0xd'),_0x66d722,_0xf332b3);_0x5d314e(_0xf332b3);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index ea2560e..1bf2d28 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 _0xd846=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5783f3,_0x2f0c46){var _0x514cf9=function(_0x1c698b){while(--_0x1c698b){_0x5783f3['push'](_0x5783f3['shift']());}};_0x514cf9(++_0x2f0c46);}(_0xd846,0x165));var _0x6d84=function(_0x55be8c,_0xdfcce2){_0x55be8c=_0x55be8c-0x0;var _0x5d655f=_0xd846[_0x55be8c];return _0x5d655f;};'use strict';var multer=require(_0x6d84('0x0'));var util=require(_0x6d84('0x1'));var path=require(_0x6d84('0x2'));var timeout=require(_0x6d84('0x3'));var express=require(_0x6d84('0x4'));var router=express['Router']();var auth=require(_0x6d84('0x5'));var interaction=require(_0x6d84('0x6'));var config=require(_0x6d84('0x7'));var controller=require('./pause.controller');router[_0x6d84('0x8')]('/',auth[_0x6d84('0x9')](),controller[_0x6d84('0xa')]);router[_0x6d84('0x8')](_0x6d84('0xb'),auth[_0x6d84('0x9')](),controller[_0x6d84('0xc')]);router[_0x6d84('0xd')]('/',auth['isAuthenticated'](),controller[_0x6d84('0xe')]);router[_0x6d84('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6d84('0x10')](_0x6d84('0xb'),auth[_0x6d84('0x9')](),controller[_0x6d84('0x11')]);module[_0x6d84('0x12')]=router; \ No newline at end of file +var _0xf172=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','get','/:id','show','post','put'];(function(_0x1925e1,_0x46452e){var _0x9e346=function(_0x54375a){while(--_0x54375a){_0x1925e1['push'](_0x1925e1['shift']());}};_0x9e346(++_0x46452e);}(_0xf172,0xff));var _0x2f17=function(_0x1ba2d3,_0x429a6e){_0x1ba2d3=_0x1ba2d3-0x0;var _0x12c950=_0xf172[_0x1ba2d3];return _0x12c950;};'use strict';var multer=require(_0x2f17('0x0'));var util=require(_0x2f17('0x1'));var path=require(_0x2f17('0x2'));var timeout=require(_0x2f17('0x3'));var express=require(_0x2f17('0x4'));var router=express['Router']();var auth=require(_0x2f17('0x5'));var interaction=require(_0x2f17('0x6'));var config=require(_0x2f17('0x7'));var controller=require(_0x2f17('0x8'));router['get']('/',auth[_0x2f17('0x9')](),controller['index']);router[_0x2f17('0xa')](_0x2f17('0xb'),auth[_0x2f17('0x9')](),controller[_0x2f17('0xc')]);router[_0x2f17('0xd')]('/',auth[_0x2f17('0x9')](),controller['create']);router[_0x2f17('0xe')](_0x2f17('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x2f17('0xf')](_0x2f17('0xb'),auth['isAuthenticated'](),controller[_0x2f17('0x10')]);module[_0x2f17('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 60e3b50..7bbea86 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 _0x4dff=['sequelize','STRING','name'];(function(_0xce50ab,_0x4c503b){var _0x9432bb=function(_0x4827e7){while(--_0x4827e7){_0xce50ab['push'](_0xce50ab['shift']());}};_0x9432bb(++_0x4c503b);}(_0x4dff,0x1bc));var _0xf4df=function(_0x4e9a61,_0x5d845c){_0x4e9a61=_0x4e9a61-0x0;var _0x211224=_0x4dff[_0x4e9a61];return _0x211224;};'use strict';var Sequelize=require(_0xf4df('0x0'));module['exports']={'name':{'type':Sequelize[_0xf4df('0x1')],'unique':_0xf4df('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xf4df('0x1')]}}; \ No newline at end of file +var _0x2dc0=['exports','name','sequelize'];(function(_0x2be027,_0x15fda0){var _0x5d5faa=function(_0x37c9e8){while(--_0x37c9e8){_0x2be027['push'](_0x2be027['shift']());}};_0x5d5faa(++_0x15fda0);}(_0x2dc0,0xef));var _0x02dc=function(_0x14a0d2,_0x45c49b){_0x14a0d2=_0x14a0d2-0x0;var _0x18e799=_0x2dc0[_0x14a0d2];return _0x18e799;};'use strict';var Sequelize=require(_0x02dc('0x0'));module[_0x02dc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x02dc('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index d66ce29..9217b54 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 _0xb537=['index','map','Pause','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Pauses','UserProfileResource','error','name'];(function(_0x1e9daa,_0x3e9235){var _0x3c32a4=function(_0x2feb63){while(--_0x2feb63){_0x1e9daa['push'](_0x1e9daa['shift']());}};_0x3c32a4(++_0x3e9235);}(_0xb537,0x163));var _0x7b53=function(_0x5bedb9,_0x48ed1f){_0x5bedb9=_0x5bedb9-0x0;var _0x2abda6=_0xb537[_0x5bedb9];return _0x2abda6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7b53('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7b53('0x1'));var rp=require(_0x7b53('0x2'));var moment=require(_0x7b53('0x3'));var BPromise=require(_0x7b53('0x4'));var Mustache=require(_0x7b53('0x5'));var util=require(_0x7b53('0x6'));var path=require('path');var sox=require(_0x7b53('0x7'));var csv=require('to-csv');var ejs=require(_0x7b53('0x8'));var fs=require('fs');var _=require(_0x7b53('0x9'));var squel=require(_0x7b53('0xa'));var crypto=require(_0x7b53('0xb'));var jsforce=require(_0x7b53('0xc'));var deskjs=require(_0x7b53('0xd'));var toCsv=require(_0x7b53('0xe'));var querystring=require(_0x7b53('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b53('0x10'));var qs=require(_0x7b53('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7b53('0x12'));var config=require(_0x7b53('0x13'));var db=require(_0x7b53('0x14'))['db'];function respondWithStatusCode(_0x58fe22,_0xb05788){_0xb05788=_0xb05788||0xcc;return function(_0x4cbde8){if(_0x4cbde8){return _0x58fe22[_0x7b53('0x15')](_0xb05788);}return _0x58fe22[_0x7b53('0x16')](_0xb05788)[_0x7b53('0x17')]();};}function respondWithResult(_0x29db8e,_0xe2bd92){_0xe2bd92=_0xe2bd92||0xc8;return function(_0xa8315a){if(_0xa8315a){return _0x29db8e[_0x7b53('0x16')](_0xe2bd92)[_0x7b53('0x18')](_0xa8315a);}};}function respondWithFilteredResult(_0x37e3e3,_0x2dce19){return function(_0x38f7b5){if(_0x38f7b5){var _0x7419d0=_0x38f7b5[_0x7b53('0x19')],_0xe67f99=_0x2dce19[_0x7b53('0x1a')],_0x3a2e9d=_0x2dce19['offset']+_0x2dce19[_0x7b53('0x1b')],_0x3e0ee0;if(_0x3a2e9d>=_0x7419d0){_0x3a2e9d=_0x7419d0;_0x3e0ee0=0xc8;}else{_0x3e0ee0=0xce;}_0x37e3e3[_0x7b53('0x16')](_0x3e0ee0);return _0x37e3e3[_0x7b53('0x1c')](_0x7b53('0x1d'),_0xe67f99+'-'+_0x3a2e9d+'/'+_0x7419d0)['json'](_0x38f7b5);}return null;};}function patchUpdates(_0xbdca8e){return function(_0xa287d2){try{jsonpatch[_0x7b53('0x1e')](_0xa287d2,_0xbdca8e,!![]);}catch(_0x46c654){return BPromise[_0x7b53('0x1f')](_0x46c654);}return _0xa287d2['save']();};}function saveUpdates(_0x5a4473,_0x4ca85d){return function(_0x18d768){if(_0x18d768){return _0x18d768[_0x7b53('0x20')](_0x5a4473)[_0x7b53('0x21')](function(_0x4f251a){return _0x4f251a;});}return null;};}function removeEntity(_0x1e6168,_0x6b916a){return function(_0x428a74){if(_0x428a74){return _0x428a74[_0x7b53('0x22')]()[_0x7b53('0x21')](function(){var _0x2ef26b=_0x428a74[_0x7b53('0x23')]({'plain':!![]});var _0x4e0bdb=_0x7b53('0x24');return db[_0x7b53('0x25')][_0x7b53('0x22')]({'where':{'type':_0x4e0bdb,'resourceId':_0x2ef26b['id']}})[_0x7b53('0x21')](function(){return _0x428a74;});})['then'](function(){_0x1e6168[_0x7b53('0x16')](0xcc)[_0x7b53('0x17')]();});}};}function handleEntityNotFound(_0x129036,_0x41ac81){return function(_0x25c70c){if(!_0x25c70c){_0x129036[_0x7b53('0x15')](0x194);}return _0x25c70c;};}function handleError(_0x2a2ae8,_0x367963){_0x367963=_0x367963||0x1f4;return function(_0x2ce0f3){logger[_0x7b53('0x26')](_0x2ce0f3['stack']);if(_0x2ce0f3[_0x7b53('0x27')]){delete _0x2ce0f3[_0x7b53('0x27')];}_0x2a2ae8[_0x7b53('0x16')](_0x367963)['send'](_0x2ce0f3);};}exports[_0x7b53('0x28')]=function(_0x48c38f,_0x5851ac){var _0x110bdf={},_0x2989c7={},_0x271a57={'count':0x0,'rows':[]};var _0x55d9c9=_[_0x7b53('0x29')](db[_0x7b53('0x2a')][_0x7b53('0x2b')],function(_0x4c102c){return{'name':_0x4c102c['fieldName'],'type':_0x4c102c[_0x7b53('0x2c')][_0x7b53('0x2d')]};});_0x2989c7['model']=_[_0x7b53('0x29')](_0x55d9c9,_0x7b53('0x27'));_0x2989c7['query']=_[_0x7b53('0x2e')](_0x48c38f[_0x7b53('0x2f')]);_0x2989c7[_0x7b53('0x30')]=_[_0x7b53('0x31')](_0x2989c7[_0x7b53('0x32')],_0x2989c7[_0x7b53('0x2f')]);_0x110bdf[_0x7b53('0x33')]=_[_0x7b53('0x31')](_0x2989c7[_0x7b53('0x32')],qs[_0x7b53('0x34')](_0x48c38f['query']['fields']));_0x110bdf[_0x7b53('0x33')]=_0x110bdf[_0x7b53('0x33')][_0x7b53('0x35')]?_0x110bdf['attributes']:_0x2989c7[_0x7b53('0x32')];if(!_0x48c38f[_0x7b53('0x2f')][_0x7b53('0x36')](_0x7b53('0x37'))){_0x110bdf[_0x7b53('0x1b')]=qs[_0x7b53('0x1b')](_0x48c38f[_0x7b53('0x2f')][_0x7b53('0x1b')]);_0x110bdf[_0x7b53('0x1a')]=qs[_0x7b53('0x1a')](_0x48c38f[_0x7b53('0x2f')][_0x7b53('0x1a')]);}_0x110bdf[_0x7b53('0x38')]=qs[_0x7b53('0x39')](_0x48c38f[_0x7b53('0x2f')][_0x7b53('0x39')]);_0x110bdf['where']=qs[_0x7b53('0x30')](_['pick'](_0x48c38f[_0x7b53('0x2f')],_0x2989c7[_0x7b53('0x30')]));if(_0x48c38f[_0x7b53('0x2f')][_0x7b53('0x3a')]){_0x110bdf[_0x7b53('0x3b')]=_['merge'](_0x110bdf[_0x7b53('0x3b')],{'$or':_[_0x7b53('0x29')](_0x55d9c9,function(_0x1f5690){if(_0x1f5690[_0x7b53('0x2c')]!==_0x7b53('0x3c')){var _0x239898={};_0x239898[_0x1f5690['name']]={'$like':'%'+_0x48c38f['query'][_0x7b53('0x3a')]+'%'};return _0x239898;}})});}_0x110bdf=_[_0x7b53('0x3d')]({},_0x110bdf,_0x48c38f[_0x7b53('0x3e')]);var _0x174b19={'where':_0x110bdf[_0x7b53('0x3b')]};return db[_0x7b53('0x2a')][_0x7b53('0x19')](_0x174b19)[_0x7b53('0x21')](function(_0x12a8e5){_0x271a57[_0x7b53('0x19')]=_0x12a8e5;if(_0x48c38f['query'][_0x7b53('0x3f')]){_0x110bdf['include']=[{'all':!![]}];}return db[_0x7b53('0x2a')][_0x7b53('0x40')](_0x110bdf);})[_0x7b53('0x21')](function(_0x56890b){_0x271a57['rows']=_0x56890b;return _0x271a57;})[_0x7b53('0x21')](respondWithFilteredResult(_0x5851ac,_0x110bdf))[_0x7b53('0x41')](handleError(_0x5851ac,null));};exports[_0x7b53('0x42')]=function(_0x490576,_0x535aa1){var _0x779fa8={'raw':!![],'where':{'id':_0x490576[_0x7b53('0x43')]['id']}},_0x44c2d5={};_0x44c2d5[_0x7b53('0x32')]=_['keys'](db[_0x7b53('0x2a')][_0x7b53('0x2b')]);_0x44c2d5[_0x7b53('0x2f')]=_[_0x7b53('0x2e')](_0x490576[_0x7b53('0x2f')]);_0x44c2d5[_0x7b53('0x30')]=_[_0x7b53('0x31')](_0x44c2d5['model'],_0x44c2d5[_0x7b53('0x2f')]);_0x779fa8[_0x7b53('0x33')]=_[_0x7b53('0x31')](_0x44c2d5[_0x7b53('0x32')],qs[_0x7b53('0x34')](_0x490576[_0x7b53('0x2f')][_0x7b53('0x34')]));_0x779fa8[_0x7b53('0x33')]=_0x779fa8['attributes'][_0x7b53('0x35')]?_0x779fa8[_0x7b53('0x33')]:_0x44c2d5[_0x7b53('0x32')];if(_0x490576['query'][_0x7b53('0x3f')]){_0x779fa8[_0x7b53('0x44')]=[{'all':!![]}];}_0x779fa8=_[_0x7b53('0x3d')]({},_0x779fa8,_0x490576['options']);return db[_0x7b53('0x2a')][_0x7b53('0x45')](_0x779fa8)[_0x7b53('0x21')](handleEntityNotFound(_0x535aa1,null))['then'](respondWithResult(_0x535aa1,null))[_0x7b53('0x41')](handleError(_0x535aa1,null));};exports[_0x7b53('0x46')]=function(_0xff631c,_0x5aee14){return db[_0x7b53('0x2a')][_0x7b53('0x46')](_0xff631c[_0x7b53('0x47')],{})[_0x7b53('0x21')](function(_0x49ffbe){var _0x15e664=_0xff631c['user'][_0x7b53('0x23')]({'plain':!![]});if(!_0x15e664)throw new Error(_0x7b53('0x48'));if(_0x15e664[_0x7b53('0x49')]===_0x7b53('0x4a')){var _0x440a05=_0x49ffbe[_0x7b53('0x23')]({'plain':!![]});var _0x3d4e1f=_0x7b53('0x24');return db[_0x7b53('0x4b')][_0x7b53('0x45')]({'where':{'name':_0x3d4e1f,'userProfileId':_0x15e664[_0x7b53('0x4c')]},'raw':!![]})[_0x7b53('0x21')](function(_0x192459){if(_0x192459&&_0x192459[_0x7b53('0x4d')]===0x0){return db[_0x7b53('0x25')]['create']({'name':_0x440a05['name'],'resourceId':_0x440a05['id'],'type':_0x192459[_0x7b53('0x27')],'sectionId':_0x192459['id']},{})[_0x7b53('0x21')](function(){return _0x49ffbe;});}else{return _0x49ffbe;}})[_0x7b53('0x41')](function(_0x4b57cd){logger[_0x7b53('0x26')](_0x7b53('0x4e'),_0x4b57cd);throw _0x4b57cd;});}return _0x49ffbe;})['then'](respondWithResult(_0x5aee14,0xc9))['catch'](handleError(_0x5aee14,null));};exports[_0x7b53('0x20')]=function(_0x25c3b1,_0x18a6de){if(_0x25c3b1[_0x7b53('0x47')]['id']){delete _0x25c3b1[_0x7b53('0x47')]['id'];}return db[_0x7b53('0x2a')][_0x7b53('0x45')]({'where':{'id':_0x25c3b1['params']['id']}})[_0x7b53('0x21')](handleEntityNotFound(_0x18a6de,null))[_0x7b53('0x21')](saveUpdates(_0x25c3b1[_0x7b53('0x47')],null))[_0x7b53('0x21')](respondWithResult(_0x18a6de,null))[_0x7b53('0x41')](handleError(_0x18a6de,null));};exports[_0x7b53('0x22')]=function(_0x332e26,_0x266e32){return db[_0x7b53('0x2a')][_0x7b53('0x45')]({'where':{'id':_0x332e26[_0x7b53('0x43')]['id']}})[_0x7b53('0x21')](handleEntityNotFound(_0x266e32,null))['then'](removeEntity(_0x266e32,null))['catch'](handleError(_0x266e32,null));}; \ No newline at end of file +var _0xc958=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','catch','show','keys','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','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring'];(function(_0x176259,_0x30e46f){var _0x48dc40=function(_0x3aa524){while(--_0x3aa524){_0x176259['push'](_0x176259['shift']());}};_0x48dc40(++_0x30e46f);}(_0xc958,0x199));var _0x8c95=function(_0x5242d0,_0x36e2b2){_0x5242d0=_0x5242d0-0x0;var _0xdc8f8f=_0xc958[_0x5242d0];return _0xdc8f8f;};'use strict';var pdf=require(_0x8c95('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8c95('0x1'));var zipdir=require(_0x8c95('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c95('0x3'));var moment=require(_0x8c95('0x4'));var BPromise=require(_0x8c95('0x5'));var Mustache=require(_0x8c95('0x6'));var util=require(_0x8c95('0x7'));var path=require(_0x8c95('0x8'));var sox=require(_0x8c95('0x9'));var csv=require(_0x8c95('0xa'));var ejs=require(_0x8c95('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8c95('0xc'));var crypto=require(_0x8c95('0xd'));var jsforce=require(_0x8c95('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8c95('0xa'));var querystring=require(_0x8c95('0xf'));var Papa=require(_0x8c95('0x10'));var Redis=require(_0x8c95('0x11'));var authService=require(_0x8c95('0x12'));var qs=require(_0x8c95('0x13'));var as=require(_0x8c95('0x14'));var hardwareService=require(_0x8c95('0x15'));var logger=require(_0x8c95('0x16'))(_0x8c95('0x17'));var utils=require('../../config/utils');var config=require(_0x8c95('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41c70b,_0x8658d4){_0x8658d4=_0x8658d4||0xcc;return function(_0xed9008){if(_0xed9008){return _0x41c70b[_0x8c95('0x19')](_0x8658d4);}return _0x41c70b[_0x8c95('0x1a')](_0x8658d4)['end']();};}function respondWithResult(_0x183bda,_0x47ed8a){_0x47ed8a=_0x47ed8a||0xc8;return function(_0x2be1c4){if(_0x2be1c4){return _0x183bda['status'](_0x47ed8a)[_0x8c95('0x1b')](_0x2be1c4);}};}function respondWithFilteredResult(_0x23a517,_0x530c1c){return function(_0x620395){if(_0x620395){var _0x37c11c=_0x620395[_0x8c95('0x1c')],_0x1d7070=_0x530c1c[_0x8c95('0x1d')],_0x3c4c07=_0x530c1c[_0x8c95('0x1d')]+_0x530c1c[_0x8c95('0x1e')],_0x569a0a;if(_0x3c4c07>=_0x37c11c){_0x3c4c07=_0x37c11c;_0x569a0a=0xc8;}else{_0x569a0a=0xce;}_0x23a517['status'](_0x569a0a);return _0x23a517[_0x8c95('0x1f')](_0x8c95('0x20'),_0x1d7070+'-'+_0x3c4c07+'/'+_0x37c11c)[_0x8c95('0x1b')](_0x620395);}return null;};}function patchUpdates(_0x970e7a){return function(_0xc2ea5b){try{jsonpatch[_0x8c95('0x21')](_0xc2ea5b,_0x970e7a,!![]);}catch(_0x4a86e8){return BPromise[_0x8c95('0x22')](_0x4a86e8);}return _0xc2ea5b[_0x8c95('0x23')]();};}function saveUpdates(_0x4bb726,_0x28e6a8){return function(_0x2de453){if(_0x2de453){return _0x2de453[_0x8c95('0x24')](_0x4bb726)[_0x8c95('0x25')](function(_0x263e46){return _0x263e46;});}return null;};}function removeEntity(_0x53ee54,_0x4fd671){return function(_0x4165e2){if(_0x4165e2){return _0x4165e2[_0x8c95('0x26')]()[_0x8c95('0x25')](function(){var _0x5d466c=_0x4165e2[_0x8c95('0x27')]({'plain':!![]});var _0x2075ac=_0x8c95('0x28');return db[_0x8c95('0x29')][_0x8c95('0x26')]({'where':{'type':_0x2075ac,'resourceId':_0x5d466c['id']}})[_0x8c95('0x25')](function(){return _0x4165e2;});})[_0x8c95('0x25')](function(){_0x53ee54['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37d56a,_0x7954bf){return function(_0xcc8b86){if(!_0xcc8b86){_0x37d56a[_0x8c95('0x19')](0x194);}return _0xcc8b86;};}function handleError(_0x15a5db,_0x2533c4){_0x2533c4=_0x2533c4||0x1f4;return function(_0xf6350b){logger['error'](_0xf6350b[_0x8c95('0x2a')]);if(_0xf6350b[_0x8c95('0x2b')]){delete _0xf6350b[_0x8c95('0x2b')];}_0x15a5db[_0x8c95('0x1a')](_0x2533c4)[_0x8c95('0x2c')](_0xf6350b);};}exports[_0x8c95('0x2d')]=function(_0x343115,_0xe757b2){var _0x134a50={},_0x1368ee={},_0x4d1de7={'count':0x0,'rows':[]};var _0x178385=_[_0x8c95('0x2e')](db[_0x8c95('0x2f')][_0x8c95('0x30')],function(_0x203b6e){return{'name':_0x203b6e[_0x8c95('0x31')],'type':_0x203b6e[_0x8c95('0x32')][_0x8c95('0x33')]};});_0x1368ee[_0x8c95('0x34')]=_[_0x8c95('0x2e')](_0x178385,_0x8c95('0x2b'));_0x1368ee[_0x8c95('0x35')]=_['keys'](_0x343115[_0x8c95('0x35')]);_0x1368ee[_0x8c95('0x36')]=_[_0x8c95('0x37')](_0x1368ee['model'],_0x1368ee[_0x8c95('0x35')]);_0x134a50['attributes']=_[_0x8c95('0x37')](_0x1368ee['model'],qs[_0x8c95('0x38')](_0x343115[_0x8c95('0x35')][_0x8c95('0x38')]));_0x134a50['attributes']=_0x134a50['attributes'][_0x8c95('0x39')]?_0x134a50[_0x8c95('0x3a')]:_0x1368ee[_0x8c95('0x34')];if(!_0x343115['query'][_0x8c95('0x3b')](_0x8c95('0x3c'))){_0x134a50[_0x8c95('0x1e')]=qs[_0x8c95('0x1e')](_0x343115['query'][_0x8c95('0x1e')]);_0x134a50['offset']=qs[_0x8c95('0x1d')](_0x343115['query']['offset']);}_0x134a50[_0x8c95('0x3d')]=qs['sort'](_0x343115[_0x8c95('0x35')][_0x8c95('0x3e')]);_0x134a50['where']=qs[_0x8c95('0x36')](_['pick'](_0x343115['query'],_0x1368ee['filters']));if(_0x343115[_0x8c95('0x35')][_0x8c95('0x3f')]){_0x134a50[_0x8c95('0x40')]=_[_0x8c95('0x41')](_0x134a50['where'],{'$or':_[_0x8c95('0x2e')](_0x178385,function(_0x374d8c){if(_0x374d8c[_0x8c95('0x32')]!=='VIRTUAL'){var _0x1997bb={};_0x1997bb[_0x374d8c[_0x8c95('0x2b')]]={'$like':'%'+_0x343115[_0x8c95('0x35')][_0x8c95('0x3f')]+'%'};return _0x1997bb;}})});}_0x134a50=_[_0x8c95('0x41')]({},_0x134a50,_0x343115[_0x8c95('0x42')]);var _0x26cea8={'where':_0x134a50[_0x8c95('0x40')]};return db['Pause'][_0x8c95('0x1c')](_0x26cea8)['then'](function(_0x3dd169){_0x4d1de7[_0x8c95('0x1c')]=_0x3dd169;if(_0x343115[_0x8c95('0x35')][_0x8c95('0x43')]){_0x134a50[_0x8c95('0x44')]=[{'all':!![]}];}return db[_0x8c95('0x2f')][_0x8c95('0x45')](_0x134a50);})['then'](function(_0x223d50){_0x4d1de7['rows']=_0x223d50;return _0x4d1de7;})['then'](respondWithFilteredResult(_0xe757b2,_0x134a50))[_0x8c95('0x46')](handleError(_0xe757b2,null));};exports[_0x8c95('0x47')]=function(_0x1c416b,_0x207742){var _0x4ccdd2={'raw':!![],'where':{'id':_0x1c416b['params']['id']}},_0x1292b0={};_0x1292b0['model']=_[_0x8c95('0x48')](db['Pause'][_0x8c95('0x30')]);_0x1292b0['query']=_['keys'](_0x1c416b[_0x8c95('0x35')]);_0x1292b0[_0x8c95('0x36')]=_[_0x8c95('0x37')](_0x1292b0[_0x8c95('0x34')],_0x1292b0[_0x8c95('0x35')]);_0x4ccdd2[_0x8c95('0x3a')]=_[_0x8c95('0x37')](_0x1292b0[_0x8c95('0x34')],qs[_0x8c95('0x38')](_0x1c416b[_0x8c95('0x35')][_0x8c95('0x38')]));_0x4ccdd2[_0x8c95('0x3a')]=_0x4ccdd2['attributes'][_0x8c95('0x39')]?_0x4ccdd2['attributes']:_0x1292b0[_0x8c95('0x34')];if(_0x1c416b[_0x8c95('0x35')][_0x8c95('0x43')]){_0x4ccdd2[_0x8c95('0x44')]=[{'all':!![]}];}_0x4ccdd2=_['merge']({},_0x4ccdd2,_0x1c416b[_0x8c95('0x42')]);return db[_0x8c95('0x2f')]['find'](_0x4ccdd2)[_0x8c95('0x25')](handleEntityNotFound(_0x207742,null))['then'](respondWithResult(_0x207742,null))['catch'](handleError(_0x207742,null));};exports[_0x8c95('0x49')]=function(_0x20a36e,_0x1eeb9e){return db[_0x8c95('0x2f')][_0x8c95('0x49')](_0x20a36e[_0x8c95('0x4a')],{})[_0x8c95('0x25')](function(_0x59d8f4){var _0x3a1dd0=_0x20a36e[_0x8c95('0x4b')][_0x8c95('0x27')]({'plain':!![]});if(!_0x3a1dd0)throw new Error(_0x8c95('0x4c'));if(_0x3a1dd0[_0x8c95('0x4d')]===_0x8c95('0x4b')){var _0x33940e=_0x59d8f4['get']({'plain':!![]});var _0x5e9920=_0x8c95('0x28');return db[_0x8c95('0x4e')][_0x8c95('0x4f')]({'where':{'name':_0x5e9920,'userProfileId':_0x3a1dd0[_0x8c95('0x50')]},'raw':!![]})[_0x8c95('0x25')](function(_0x3d2640){if(_0x3d2640&&_0x3d2640[_0x8c95('0x51')]===0x0){return db[_0x8c95('0x29')][_0x8c95('0x49')]({'name':_0x33940e[_0x8c95('0x2b')],'resourceId':_0x33940e['id'],'type':_0x3d2640['name'],'sectionId':_0x3d2640['id']},{})[_0x8c95('0x25')](function(){return _0x59d8f4;});}else{return _0x59d8f4;}})[_0x8c95('0x46')](function(_0xd93dc0){logger[_0x8c95('0x52')](_0x8c95('0x53'),_0xd93dc0);throw _0xd93dc0;});}return _0x59d8f4;})['then'](respondWithResult(_0x1eeb9e,0xc9))[_0x8c95('0x46')](handleError(_0x1eeb9e,null));};exports[_0x8c95('0x24')]=function(_0xde017a,_0x166fe0){if(_0xde017a['body']['id']){delete _0xde017a[_0x8c95('0x4a')]['id'];}return db[_0x8c95('0x2f')][_0x8c95('0x4f')]({'where':{'id':_0xde017a[_0x8c95('0x54')]['id']}})[_0x8c95('0x25')](handleEntityNotFound(_0x166fe0,null))[_0x8c95('0x25')](saveUpdates(_0xde017a['body'],null))[_0x8c95('0x25')](respondWithResult(_0x166fe0,null))['catch'](handleError(_0x166fe0,null));};exports[_0x8c95('0x26')]=function(_0x5a74ad,_0x210e28){return db[_0x8c95('0x2f')][_0x8c95('0x4f')]({'where':{'id':_0x5a74ad[_0x8c95('0x54')]['id']}})['then'](handleEntityNotFound(_0x210e28,null))[_0x8c95('0x25')](removeEntity(_0x210e28,null))[_0x8c95('0x46')](handleError(_0x210e28,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index dc635c9..c8e06cc 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 _0xa0a3=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','util'];(function(_0x18d631,_0x4376d2){var _0x50d708=function(_0x3b6ab5){while(--_0x3b6ab5){_0x18d631['push'](_0x18d631['shift']());}};_0x50d708(++_0x4376d2);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x49be45,_0x9169e3){_0x49be45=_0x49be45-0x0;var _0x3d7163=_0xa0a3[_0x49be45];return _0x3d7163;};'use strict';var _=require('lodash');var util=require(_0x3a0a('0x0'));var logger=require(_0x3a0a('0x1'))('api');var moment=require(_0x3a0a('0x2'));var BPromise=require(_0x3a0a('0x3'));var rp=require(_0x3a0a('0x4'));var fs=require('fs');var path=require(_0x3a0a('0x5'));var rimraf=require(_0x3a0a('0x6'));var config=require(_0x3a0a('0x7'));var attributes=require(_0x3a0a('0x8'));module[_0x3a0a('0x9')]=function(_0xa047cf,_0x3d7dc7){return _0xa047cf[_0x3a0a('0xa')](_0x3a0a('0xb'),attributes,{'tableName':_0x3a0a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2deb=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x4bd4b9,_0xc3f97e){var _0x5e5419=function(_0x129707){while(--_0x129707){_0x4bd4b9['push'](_0x4bd4b9['shift']());}};_0x5e5419(++_0xc3f97e);}(_0x2deb,0xdb));var _0xb2de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2deb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var logger=require(_0xb2de('0x2'))(_0xb2de('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb2de('0x4'));var fs=require('fs');var path=require(_0xb2de('0x5'));var rimraf=require(_0xb2de('0x6'));var config=require(_0xb2de('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x201fcc,_0x2ed8ec){return _0x201fcc[_0xb2de('0x8')]('Pause',attributes,{'tableName':_0xb2de('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 a018ebb..5137f35 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 _0x26ed=['find','options','raw','attributes','include','map','model','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','ShowPause','Pause'];(function(_0x438874,_0x50bced){var _0x3a51c1=function(_0x92bd43){while(--_0x92bd43){_0x438874['push'](_0x438874['shift']());}};_0x3a51c1(++_0x50bced);}(_0x26ed,0x17c));var _0xd26e=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0x26ed[_0x4991d6];return _0x50faf7;};'use strict';var _=require('lodash');var util=require(_0xd26e('0x0'));var moment=require('moment');var BPromise=require(_0xd26e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd26e('0x2'));var db=require(_0xd26e('0x3'))['db'];var utils=require(_0xd26e('0x4'));var logger=require('../../config/logger')(_0xd26e('0x5'));var config=require(_0xd26e('0x6'));var jayson=require(_0xd26e('0x7'));var client=jayson[_0xd26e('0x8')][_0xd26e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c32df,_0x1f8cff,_0x5b8430){return new BPromise(function(_0x820d88,_0x34a0a7){return client[_0xd26e('0xa')](_0x3c32df,_0x5b8430)[_0xd26e('0xb')](function(_0x57ad26){logger['info'](_0xd26e('0xc'),_0x1f8cff,'request\x20sent');logger[_0xd26e('0xd')](_0xd26e('0xe'),_0x1f8cff,_0xd26e('0xf'),JSON[_0xd26e('0x10')](_0x57ad26));if(_0x57ad26[_0xd26e('0x11')]){if(_0x57ad26[_0xd26e('0x11')][_0xd26e('0x12')]===0x1f4){logger[_0xd26e('0x11')]('Pause,\x20%s,\x20%s',_0x1f8cff,_0x57ad26['error'][_0xd26e('0x13')]);return _0x34a0a7(_0x57ad26['error'][_0xd26e('0x13')]);}logger[_0xd26e('0x11')](_0xd26e('0xc'),_0x1f8cff,_0x57ad26[_0xd26e('0x11')][_0xd26e('0x13')]);return _0x820d88(_0x57ad26[_0xd26e('0x11')]['message']);}else{logger[_0xd26e('0x14')](_0xd26e('0xc'),_0x1f8cff,_0xd26e('0xf'));_0x820d88(_0x57ad26['result'][_0xd26e('0x13')]);}})['catch'](function(_0x155c7b){logger[_0xd26e('0x11')]('Pause,\x20%s,\x20%s',_0x1f8cff,_0x155c7b);_0x34a0a7(_0x155c7b);});});}exports[_0xd26e('0x15')]=function(_0x235557){var _0x1d59a4=this;return new Promise(function(_0x9632eb,_0xd64bc2){return db[_0xd26e('0x16')][_0xd26e('0x17')]({'raw':_0x235557['options']?_0x235557[_0xd26e('0x18')][_0xd26e('0x19')]===undefined?!![]:![]:!![],'where':_0x235557[_0xd26e('0x18')]?_0x235557[_0xd26e('0x18')]['where']||null:null,'attributes':_0x235557[_0xd26e('0x18')]?_0x235557[_0xd26e('0x18')][_0xd26e('0x1a')]||null:null,'include':_0x235557[_0xd26e('0x18')]?_0x235557[_0xd26e('0x18')][_0xd26e('0x1b')]?_[_0xd26e('0x1c')](_0x235557[_0xd26e('0x18')]['include'],function(_0x554148){return{'model':db[_0x554148[_0xd26e('0x1d')]],'as':_0x554148['as'],'attributes':_0x554148['attributes'],'include':_0x554148[_0xd26e('0x1b')]?_[_0xd26e('0x1c')](_0x554148['include'],function(_0x6f8784){return{'model':db[_0x6f8784[_0xd26e('0x1d')]],'as':_0x6f8784['as'],'attributes':_0x6f8784[_0xd26e('0x1a')],'include':_0x6f8784[_0xd26e('0x1b')]?_[_0xd26e('0x1c')](_0x6f8784[_0xd26e('0x1b')],function(_0x345663){return{'model':db[_0x345663[_0xd26e('0x1d')]],'as':_0x345663['as'],'attributes':_0x345663[_0xd26e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd26e('0xb')](function(_0x475f38){logger[_0xd26e('0x14')](_0xd26e('0x15'),_0x235557);logger[_0xd26e('0xd')]('ShowPause',_0x235557,JSON[_0xd26e('0x10')](_0x475f38));_0x9632eb(_0x475f38);})[_0xd26e('0x1e')](function(_0x39859f){logger['error'](_0xd26e('0x15'),_0x39859f['message'],_0x235557);_0xd64bc2(_0x1d59a4['error'](0x1f4,_0x39859f[_0xd26e('0x13')]));});});}; \ No newline at end of file +var _0x4ac0=['Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowPause','Pause','options','raw','where','include','attributes','map','model','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent'];(function(_0x4c3a81,_0x106112){var _0x41e377=function(_0x48d124){while(--_0x48d124){_0x4c3a81['push'](_0x4c3a81['shift']());}};_0x41e377(++_0x106112);}(_0x4ac0,0xa0));var _0x04ac=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x4ac0[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x04ac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x04ac('0x1'));var fs=require('fs');var Redis=require(_0x04ac('0x2'));var db=require(_0x04ac('0x3'))['db'];var utils=require(_0x04ac('0x4'));var logger=require(_0x04ac('0x5'))(_0x04ac('0x6'));var config=require('../../config/environment');var jayson=require(_0x04ac('0x7'));var client=jayson['client'][_0x04ac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5020a2,_0x1b3b2a,_0x229171){return new BPromise(function(_0x51c524,_0x68d656){return client[_0x04ac('0x9')](_0x5020a2,_0x229171)[_0x04ac('0xa')](function(_0xdb1162){logger[_0x04ac('0xb')](_0x04ac('0xc'),_0x1b3b2a,_0x04ac('0xd'));logger['debug'](_0x04ac('0xe'),_0x1b3b2a,'request\x20sent',JSON[_0x04ac('0xf')](_0xdb1162));if(_0xdb1162[_0x04ac('0x10')]){if(_0xdb1162['error'][_0x04ac('0x11')]===0x1f4){logger[_0x04ac('0x10')](_0x04ac('0xc'),_0x1b3b2a,_0xdb1162['error'][_0x04ac('0x12')]);return _0x68d656(_0xdb1162[_0x04ac('0x10')][_0x04ac('0x12')]);}logger[_0x04ac('0x10')]('Pause,\x20%s,\x20%s',_0x1b3b2a,_0xdb1162[_0x04ac('0x10')][_0x04ac('0x12')]);return _0x51c524(_0xdb1162[_0x04ac('0x10')]['message']);}else{logger[_0x04ac('0xb')](_0x04ac('0xc'),_0x1b3b2a,'request\x20sent');_0x51c524(_0xdb1162['result'][_0x04ac('0x12')]);}})['catch'](function(_0x1da147){logger[_0x04ac('0x10')](_0x04ac('0xc'),_0x1b3b2a,_0x1da147);_0x68d656(_0x1da147);});});}exports[_0x04ac('0x13')]=function(_0x30a78b){var _0x58535a=this;return new Promise(function(_0x154e66,_0x1f213d){return db[_0x04ac('0x14')]['find']({'raw':_0x30a78b[_0x04ac('0x15')]?_0x30a78b['options'][_0x04ac('0x16')]===undefined?!![]:![]:!![],'where':_0x30a78b[_0x04ac('0x15')]?_0x30a78b[_0x04ac('0x15')][_0x04ac('0x17')]||null:null,'attributes':_0x30a78b['options']?_0x30a78b[_0x04ac('0x15')]['attributes']||null:null,'include':_0x30a78b[_0x04ac('0x15')]?_0x30a78b[_0x04ac('0x15')][_0x04ac('0x18')]?_['map'](_0x30a78b[_0x04ac('0x15')][_0x04ac('0x18')],function(_0x443ef1){return{'model':db[_0x443ef1['model']],'as':_0x443ef1['as'],'attributes':_0x443ef1[_0x04ac('0x19')],'include':_0x443ef1[_0x04ac('0x18')]?_[_0x04ac('0x1a')](_0x443ef1['include'],function(_0x364525){return{'model':db[_0x364525[_0x04ac('0x1b')]],'as':_0x364525['as'],'attributes':_0x364525[_0x04ac('0x19')],'include':_0x364525[_0x04ac('0x18')]?_['map'](_0x364525['include'],function(_0x1e0e3a){return{'model':db[_0x1e0e3a['model']],'as':_0x1e0e3a['as'],'attributes':_0x1e0e3a[_0x04ac('0x19')]};}):[]};}):[]};}):[]:[]})[_0x04ac('0xa')](function(_0x17c87e){logger[_0x04ac('0xb')](_0x04ac('0x13'),_0x30a78b);logger['debug']('ShowPause',_0x30a78b,JSON['stringify'](_0x17c87e));_0x154e66(_0x17c87e);})[_0x04ac('0x1c')](function(_0x23ae7b){logger[_0x04ac('0x10')](_0x04ac('0x13'),_0x23ae7b['message'],_0x30a78b);_0x1f213d(_0x58535a[_0x04ac('0x10')](0x1f4,_0x23ae7b['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index edf2c25..0791514 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 _0xdf24=['put','update','delete','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','single','file','upload','post','webhookPost'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0xdf24,0xa9));var _0x4df2=function(_0x44be98,_0x22a161){_0x44be98=_0x44be98-0x0;var _0x491db2=_0xdf24[_0x44be98];return _0x491db2;};'use strict';var multer=require('multer');var util=require(_0x4df2('0x0'));var path=require(_0x4df2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4df2('0x2'));var router=express[_0x4df2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4df2('0x4'));var config=require(_0x4df2('0x5'));var controller=require(_0x4df2('0x6'));router[_0x4df2('0x7')]('/',auth[_0x4df2('0x8')](),controller[_0x4df2('0x9')]);router['get'](_0x4df2('0xa'),controller['webhookGet']);router[_0x4df2('0x7')](_0x4df2('0xb'),auth[_0x4df2('0x8')](),controller['show']);router[_0x4df2('0x7')](_0x4df2('0xc'),auth[_0x4df2('0x8')](),controller[_0x4df2('0xd')]);var upload=multer({'storage':multer[_0x4df2('0xe')]({'destination':function(_0x51805b,_0x254ec4,_0x380acd){_0x380acd(null,path[_0x4df2('0xf')](config[_0x4df2('0x10')],_0x4df2('0x11')));},'filename':function(_0x520d8e,_0x2aab0a,_0x3df0e7){_0x2aab0a[_0x4df2('0x12')]=_0x2aab0a['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3df0e7(null,util[_0x4df2('0x13')](_0x4df2('0x14'),path[_0x4df2('0x15')](_0x2aab0a[_0x4df2('0x12')],path[_0x4df2('0x16')](_0x2aab0a[_0x4df2('0x12')])),Date[_0x4df2('0x17')](),path['extname'](_0x2aab0a[_0x4df2('0x12')])));}})});router['post']('/',upload[_0x4df2('0x18')](_0x4df2('0x19')),controller[_0x4df2('0x1a')]);router[_0x4df2('0x1b')](_0x4df2('0xa'),controller[_0x4df2('0x1c')]);router[_0x4df2('0x1d')](_0x4df2('0xb'),auth['isAuthenticated'](),controller[_0x4df2('0x1e')]);router[_0x4df2('0x1f')]('/:id',auth[_0x4df2('0x8')](),controller[_0x4df2('0x1f')]);module[_0x4df2('0x20')]=router; \ No newline at end of file +var _0x300f=['exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','webhookGet','/:id','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','upload','post','/webhook','webhookPost','put','delete'];(function(_0x3cd515,_0x67dd55){var _0x1dc372=function(_0x1251e3){while(--_0x1251e3){_0x3cd515['push'](_0x3cd515['shift']());}};_0x1dc372(++_0x67dd55);}(_0x300f,0xb0));var _0xf300=function(_0x5d7bec,_0x56eeff){_0x5d7bec=_0x5d7bec-0x0;var _0x5a66de=_0x300f[_0x5d7bec];return _0x5a66de;};'use strict';var multer=require('multer');var util=require(_0xf300('0x0'));var path=require(_0xf300('0x1'));var timeout=require(_0xf300('0x2'));var express=require(_0xf300('0x3'));var router=express[_0xf300('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf300('0x5'));var config=require(_0xf300('0x6'));var controller=require(_0xf300('0x7'));router[_0xf300('0x8')]('/',auth[_0xf300('0x9')](),controller[_0xf300('0xa')]);router[_0xf300('0x8')]('/webhook',controller[_0xf300('0xb')]);router['get'](_0xf300('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf300('0x8')](_0xf300('0xd'),auth[_0xf300('0x9')](),controller[_0xf300('0xe')]);var upload=multer({'storage':multer[_0xf300('0xf')]({'destination':function(_0x50d7c2,_0x5d0ede,_0x49e9c4){_0x49e9c4(null,path[_0xf300('0x10')](config[_0xf300('0x11')],_0xf300('0x12')));},'filename':function(_0x838f77,_0x2379aa,_0x3c3c64){_0x2379aa[_0xf300('0x13')]=_0x2379aa[_0xf300('0x13')][_0xf300('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3c3c64(null,util[_0xf300('0x15')](_0xf300('0x16'),path[_0xf300('0x17')](_0x2379aa[_0xf300('0x13')],path[_0xf300('0x18')](_0x2379aa[_0xf300('0x13')])),Date[_0xf300('0x19')](),path[_0xf300('0x18')](_0x2379aa[_0xf300('0x13')])));}})});router['post']('/',upload[_0xf300('0x1a')](_0xf300('0x1b')),controller[_0xf300('0x1c')]);router[_0xf300('0x1d')](_0xf300('0x1e'),controller[_0xf300('0x1f')]);router[_0xf300('0x20')](_0xf300('0xc'),auth[_0xf300('0x9')](),controller['update']);router[_0xf300('0x21')]('/:id',auth[_0xf300('0x9')](),controller['delete']);module[_0xf300('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 0ed7bd5..2dc5cc8 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 _0xf330=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','sequelize','STRING','script','TEXT'];(function(_0x1e1020,_0xd64a27){var _0x464719=function(_0x376ffa){while(--_0x376ffa){_0x1e1020['push'](_0x1e1020['shift']());}};_0x464719(++_0xd64a27);}(_0xf330,0x146));var _0x0f33=function(_0x27a367,_0x205584){_0x27a367=_0x27a367-0x0;var _0x1973eb=_0xf330[_0x27a367];return _0x1973eb;};'use strict';var Sequelize=require(_0x0f33('0x0'));module['exports']={'name':{'type':Sequelize[_0x0f33('0x1')]},'type':{'type':Sequelize['ENUM']('html',_0x0f33('0x2'))},'description':{'type':Sequelize[_0x0f33('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x0f33('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x0f33('0x4')],'defaultValue':0x0,'comment':_0x0f33('0x5')},'sidebar':{'type':Sequelize['ENUM'](_0x0f33('0x6'),_0x0f33('0x7'),_0x0f33('0x8'),_0x0f33('0x9')),'defaultValue':_0x0f33('0x8'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x0f33('0x1')]},'adminUrl':{'type':Sequelize[_0x0f33('0x1')]},'agentUrl':{'type':Sequelize[_0x0f33('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x0f33('0x1')]}}; \ No newline at end of file +var _0xc79f=['sequelize','exports','STRING','ENUM','html','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','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x267a5e,_0x190ec2){var _0x26e751=function(_0x5d90c6){while(--_0x5d90c6){_0x267a5e['push'](_0x267a5e['shift']());}};_0x26e751(++_0x190ec2);}(_0xc79f,0x82));var _0xfc79=function(_0x337a6f,_0x444952){_0x337a6f=_0x337a6f-0x0;var _0x22b207=_0xc79f[_0x337a6f];return _0x22b207;};'use strict';var Sequelize=require(_0xfc79('0x0'));module[_0xfc79('0x1')]={'name':{'type':Sequelize[_0xfc79('0x2')]},'type':{'type':Sequelize[_0xfc79('0x3')](_0xfc79('0x4'),'script')},'description':{'type':Sequelize[_0xfc79('0x5')]},'version':{'type':Sequelize[_0xfc79('0x5')]},'path':{'type':Sequelize[_0xfc79('0x2')],'comment':_0xfc79('0x6')},'active':{'type':Sequelize[_0xfc79('0x7')],'defaultValue':0x0,'comment':_0xfc79('0x8')},'sidebar':{'type':Sequelize[_0xfc79('0x3')](_0xfc79('0x9'),_0xfc79('0xa'),'always',_0xfc79('0xb')),'defaultValue':'always','comment':_0xfc79('0xc')},'icon':{'type':Sequelize[_0xfc79('0x2')]},'adminUrl':{'type':Sequelize[_0xfc79('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xfc79('0x2')]},'scriptPath':{'type':Sequelize[_0xfc79('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 0dc100a..f79b3b9 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 _0xfb6b=['Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','Warning:\x20agent\x20view\x20not\x20specified','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','body','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','\x27PORT\x27\x20parameter\x20not\x20specified','port','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','./plugin.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Plugins','error','stack','name','send','map','Plugin','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','download','root','format','%s.zip','createWriteStream','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','glob','**/*','join','server/files/plugins','dirname','node_modules/**/*','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','isFile','Invalid\x20plugin\x20structure','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing'];(function(_0x50e9e7,_0x2f65a1){var _0x247a22=function(_0x23a8a8){while(--_0x23a8a8){_0x50e9e7['push'](_0x50e9e7['shift']());}};_0x247a22(++_0x2f65a1);}(_0xfb6b,0x179));var _0xbfb6=function(_0x1de43d,_0x48d293){_0x1de43d=_0x1de43d-0x0;var _0x1806f0=_0xfb6b[_0x1de43d];return _0x1806f0;};'use strict';var pdf=require(_0xbfb6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbfb6('0x1'));var zipdir=require(_0xbfb6('0x2'));var jsonpatch=require(_0xbfb6('0x3'));var rp=require('request-promise');var moment=require(_0xbfb6('0x4'));var BPromise=require(_0xbfb6('0x5'));var Mustache=require('mustache');var util=require(_0xbfb6('0x6'));var path=require(_0xbfb6('0x7'));var sox=require('sox');var csv=require(_0xbfb6('0x8'));var ejs=require(_0xbfb6('0x9'));var fs=require('fs');var _=require(_0xbfb6('0xa'));var squel=require(_0xbfb6('0xb'));var crypto=require(_0xbfb6('0xc'));var jsforce=require(_0xbfb6('0xd'));var deskjs=require(_0xbfb6('0xe'));var toCsv=require(_0xbfb6('0x8'));var querystring=require(_0xbfb6('0xf'));var Papa=require('papaparse');var extract=require(_0xbfb6('0x10'));var rimraf=require(_0xbfb6('0x1'));var archiver=require('archiver');var Redis=require(_0xbfb6('0x11'));var authService=require(_0xbfb6('0x12'));var qs=require(_0xbfb6('0x13'));var as=require(_0xbfb6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbfb6('0x15'))(_0xbfb6('0x16'));var utils=require(_0xbfb6('0x17'));var config=require('../../config/environment');var db=require(_0xbfb6('0x18'))['db'];config[_0xbfb6('0x19')]=_[_0xbfb6('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbfb6('0x19')]));require(_0xbfb6('0x1b'))[_0xbfb6('0x1c')](socket);function respondWithStatusCode(_0x251f94,_0x425fb4){_0x425fb4=_0x425fb4||0xcc;return function(_0x358400){if(_0x358400){return _0x251f94[_0xbfb6('0x1d')](_0x425fb4);}return _0x251f94[_0xbfb6('0x1e')](_0x425fb4)[_0xbfb6('0x1f')]();};}function respondWithResult(_0x4ac40d,_0x381ab0){_0x381ab0=_0x381ab0||0xc8;return function(_0x56d238){if(_0x56d238){return _0x4ac40d[_0xbfb6('0x1e')](_0x381ab0)[_0xbfb6('0x20')](_0x56d238);}};}function respondWithFilteredResult(_0x548960,_0x18dd0a){return function(_0xf932a2){if(_0xf932a2){var _0x24d339=_0xf932a2[_0xbfb6('0x21')],_0x586f9c=_0x18dd0a[_0xbfb6('0x22')],_0x2f5a66=_0x18dd0a[_0xbfb6('0x22')]+_0x18dd0a[_0xbfb6('0x23')],_0x39cb56;if(_0x2f5a66>=_0x24d339){_0x2f5a66=_0x24d339;_0x39cb56=0xc8;}else{_0x39cb56=0xce;}_0x548960[_0xbfb6('0x1e')](_0x39cb56);return _0x548960[_0xbfb6('0x24')](_0xbfb6('0x25'),_0x586f9c+'-'+_0x2f5a66+'/'+_0x24d339)[_0xbfb6('0x20')](_0xf932a2);}return null;};}function patchUpdates(_0x580e1b){return function(_0x179dbd){try{jsonpatch[_0xbfb6('0x26')](_0x179dbd,_0x580e1b,!![]);}catch(_0x2b83c7){return BPromise[_0xbfb6('0x27')](_0x2b83c7);}return _0x179dbd[_0xbfb6('0x28')]();};}function saveUpdates(_0x1d0317,_0x462f84){return function(_0x5c616a){if(_0x5c616a){return _0x5c616a[_0xbfb6('0x29')](_0x1d0317)['then'](function(_0x26ff4a){return _0x26ff4a;});}return null;};}function removeEntity(_0x5b56dd,_0x286025){return function(_0x111de0){if(_0x111de0){return _0x111de0[_0xbfb6('0x2a')]()[_0xbfb6('0x2b')](function(){var _0x1e5e73=_0x111de0[_0xbfb6('0x2c')]({'plain':!![]});var _0x46d530=_0xbfb6('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x46d530,'resourceId':_0x1e5e73['id']}})[_0xbfb6('0x2b')](function(){return _0x111de0;});})[_0xbfb6('0x2b')](function(){_0x5b56dd[_0xbfb6('0x1e')](0xcc)[_0xbfb6('0x1f')]();});}};}function handleEntityNotFound(_0x493c1d,_0xdc88a4){return function(_0x41ba14){if(!_0x41ba14){_0x493c1d[_0xbfb6('0x1d')](0x194);}return _0x41ba14;};}function handleError(_0x317868,_0xbfcbba){_0xbfcbba=_0xbfcbba||0x1f4;return function(_0x4ee503){logger[_0xbfb6('0x2e')](_0x4ee503[_0xbfb6('0x2f')]);if(_0x4ee503[_0xbfb6('0x30')]){delete _0x4ee503[_0xbfb6('0x30')];}_0x317868[_0xbfb6('0x1e')](_0xbfcbba)[_0xbfb6('0x31')](_0x4ee503);};}exports['index']=function(_0x12c9c7,_0xbeef6c){var _0x1aa076={},_0x358bb0={},_0x3dc9f8={'count':0x0,'rows':[]};var _0x2dbe24=_[_0xbfb6('0x32')](db[_0xbfb6('0x33')][_0xbfb6('0x34')],function(_0x38618b){return{'name':_0x38618b[_0xbfb6('0x35')],'type':_0x38618b[_0xbfb6('0x36')]['key']};});_0x358bb0[_0xbfb6('0x37')]=_[_0xbfb6('0x32')](_0x2dbe24,_0xbfb6('0x30'));_0x358bb0[_0xbfb6('0x38')]=_[_0xbfb6('0x39')](_0x12c9c7['query']);_0x358bb0[_0xbfb6('0x3a')]=_[_0xbfb6('0x3b')](_0x358bb0[_0xbfb6('0x37')],_0x358bb0['query']);_0x1aa076['attributes']=_[_0xbfb6('0x3b')](_0x358bb0['model'],qs['fields'](_0x12c9c7['query'][_0xbfb6('0x3c')]));_0x1aa076[_0xbfb6('0x3d')]=_0x1aa076[_0xbfb6('0x3d')][_0xbfb6('0x3e')]?_0x1aa076[_0xbfb6('0x3d')]:_0x358bb0['model'];if(!_0x12c9c7[_0xbfb6('0x38')]['hasOwnProperty'](_0xbfb6('0x3f'))){_0x1aa076[_0xbfb6('0x23')]=qs[_0xbfb6('0x23')](_0x12c9c7[_0xbfb6('0x38')]['limit']);_0x1aa076['offset']=qs[_0xbfb6('0x22')](_0x12c9c7[_0xbfb6('0x38')]['offset']);}_0x1aa076[_0xbfb6('0x40')]=qs['sort'](_0x12c9c7[_0xbfb6('0x38')]['sort']);_0x1aa076[_0xbfb6('0x41')]=qs[_0xbfb6('0x3a')](_[_0xbfb6('0x42')](_0x12c9c7[_0xbfb6('0x38')],_0x358bb0['filters']));if(_0x12c9c7[_0xbfb6('0x38')][_0xbfb6('0x43')]){_0x1aa076[_0xbfb6('0x41')]=_['merge'](_0x1aa076[_0xbfb6('0x41')],{'$or':_[_0xbfb6('0x32')](_0x2dbe24,function(_0xa0ff81){if(_0xa0ff81[_0xbfb6('0x36')]!==_0xbfb6('0x44')){var _0x589bef={};_0x589bef[_0xa0ff81[_0xbfb6('0x30')]]={'$like':'%'+_0x12c9c7[_0xbfb6('0x38')]['filter']+'%'};return _0x589bef;}})});}_0x1aa076=_[_0xbfb6('0x45')]({},_0x1aa076,_0x12c9c7[_0xbfb6('0x46')]);var _0x1a017a={'where':_0x1aa076[_0xbfb6('0x41')]};return db[_0xbfb6('0x33')][_0xbfb6('0x21')](_0x1a017a)[_0xbfb6('0x2b')](function(_0xa57eda){_0x3dc9f8['count']=_0xa57eda;if(_0x12c9c7['query'][_0xbfb6('0x47')]){_0x1aa076[_0xbfb6('0x48')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x1aa076);})[_0xbfb6('0x2b')](function(_0x26b666){_0x3dc9f8['rows']=_0x26b666;return _0x3dc9f8;})[_0xbfb6('0x2b')](respondWithFilteredResult(_0xbeef6c,_0x1aa076))[_0xbfb6('0x49')](handleError(_0xbeef6c,null));};exports[_0xbfb6('0x4a')]=function(_0x811fdc,_0x406379){var _0x1f58fc={'raw':!![],'where':{'id':_0x811fdc[_0xbfb6('0x4b')]['id']}},_0x27399d={};_0x27399d[_0xbfb6('0x37')]=_['keys'](db['Plugin'][_0xbfb6('0x34')]);_0x27399d[_0xbfb6('0x38')]=_[_0xbfb6('0x39')](_0x811fdc[_0xbfb6('0x38')]);_0x27399d[_0xbfb6('0x3a')]=_[_0xbfb6('0x3b')](_0x27399d[_0xbfb6('0x37')],_0x27399d[_0xbfb6('0x38')]);_0x1f58fc['attributes']=_[_0xbfb6('0x3b')](_0x27399d['model'],qs[_0xbfb6('0x3c')](_0x811fdc[_0xbfb6('0x38')][_0xbfb6('0x3c')]));_0x1f58fc[_0xbfb6('0x3d')]=_0x1f58fc[_0xbfb6('0x3d')][_0xbfb6('0x3e')]?_0x1f58fc[_0xbfb6('0x3d')]:_0x27399d[_0xbfb6('0x37')];if(_0x811fdc[_0xbfb6('0x38')][_0xbfb6('0x47')]){_0x1f58fc[_0xbfb6('0x48')]=[{'all':!![]}];}_0x1f58fc=_[_0xbfb6('0x45')]({},_0x1f58fc,_0x811fdc[_0xbfb6('0x46')]);return db[_0xbfb6('0x33')][_0xbfb6('0x4c')](_0x1f58fc)[_0xbfb6('0x2b')](handleEntityNotFound(_0x406379,null))[_0xbfb6('0x2b')](respondWithResult(_0x406379,null))[_0xbfb6('0x49')](handleError(_0x406379,null));};exports[_0xbfb6('0x4d')]=function(_0x3ee39b,_0x516b2b,_0x37e7fb){return db[_0xbfb6('0x33')][_0xbfb6('0x4c')]({'where':{'id':_0x3ee39b[_0xbfb6('0x4b')]['id']},'attributes':[_0xbfb6('0x30'),_0xbfb6('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x516b2b,null))[_0xbfb6('0x2b')](function(_0x4b8eed){if(_0x4b8eed){var _0x5aa62f=path['join'](config[_0xbfb6('0x4e')],'server/files/plugins',util[_0xbfb6('0x4f')](_0xbfb6('0x50'),path['basename'](_0x4b8eed[_0xbfb6('0x7')])));var _0x1054e3=fs[_0xbfb6('0x51')](_0x5aa62f);var _0x320e7b=archiver('zip',{'zlib':{'level':0x9}});_0x320e7b['on']('warning',function(_0x573c0e){if(_0x573c0e['code']==='ENOENT'){logger[_0xbfb6('0x2e')](_0x573c0e);}else{throw new db['Sequelize'][(_0xbfb6('0x52'))](_0xbfb6('0x53'));}});_0x320e7b['on']('error',function(_0x3f44ee){throw new db[(_0xbfb6('0x54'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x320e7b['pipe'](_0x1054e3);_0x320e7b[_0xbfb6('0x55')](_0xbfb6('0x56'),{'cwd':path[_0xbfb6('0x57')](config[_0xbfb6('0x4e')],_0xbfb6('0x58'),path[_0xbfb6('0x59')](_0x4b8eed[_0xbfb6('0x7')])),'ignore':[path[_0xbfb6('0x57')](path['basename'](_0x4b8eed[_0xbfb6('0x7')]),_0xbfb6('0x5a')),path['join'](path[_0xbfb6('0x5b')](_0x4b8eed[_0xbfb6('0x7')]),_0xbfb6('0x5c'))],'nodir':!![]})[_0xbfb6('0x5d')]();_0x1054e3['on'](_0xbfb6('0x5e'),function(){if(!fs[_0xbfb6('0x5f')](_0x5aa62f)){throw new db[(_0xbfb6('0x54'))][(_0xbfb6('0x52'))](_0xbfb6('0x60'));}return _0x516b2b[_0xbfb6('0x4d')](_0x5aa62f,util[_0xbfb6('0x4f')]('%s.zip',path[_0xbfb6('0x5b')](_0x4b8eed['path'])),function(_0x13709c){if(_0x13709c){throw new db[(_0xbfb6('0x54'))][(_0xbfb6('0x52'))](_0xbfb6('0x61'));}fs['unlinkSync'](_0x5aa62f);logger[_0xbfb6('0x62')]('Download\x20completed');logger[_0xbfb6('0x62')](_0xbfb6('0x63'));});});}return null;})['catch'](handleError(_0x516b2b,null));};exports['upload']=function(_0x910b68,_0x365836,_0x18c0d9){var _0x356560=path[_0xbfb6('0x5b')](_0x910b68['file'][_0xbfb6('0x64')],path['extname'](_0x910b68['file'][_0xbfb6('0x64')]));var _0x53b8c3=path['join'](config[_0xbfb6('0x4e')],_0xbfb6('0x58'),_0x910b68['file'][_0xbfb6('0x64')]);var _0x4c55e4=path[_0xbfb6('0x57')](config[_0xbfb6('0x4e')],_0xbfb6('0x58'),_0x356560);logger[_0xbfb6('0x62')](_0xbfb6('0x65'),_0x53b8c3);logger['info'](_0xbfb6('0x66'),_0x4c55e4);try{fs[_0xbfb6('0x67')](_0x53b8c3,parseInt(_0xbfb6('0x68'),0x8));extract(_0x53b8c3,{'dir':_0x4c55e4},function(_0x1634fb){if(_0x1634fb){logger[_0xbfb6('0x2e')](_0x1634fb);handleError(_0x1634fb,!![]);};var _0x58d585=fs[_0xbfb6('0x69')](_0x4c55e4);if(_0x58d585[_0xbfb6('0x3e')]>0x1){removeReferences(_0x53b8c3,_0x4c55e4);logger['error']('Invalid\x20plugin\x20structure');return _0x18c0d9(new Error('Invalid\x20plugin\x20structure'));}var _0x5c838e=fs['lstatSync'](path[_0xbfb6('0x57')](_0x4c55e4,_0x58d585[0x0]));if(_0x5c838e[_0xbfb6('0x6a')]()){removeReferences(_0x53b8c3,_0x4c55e4);logger[_0xbfb6('0x2e')](_0xbfb6('0x6b'));return _0x18c0d9(new Error('Invalid\x20plugin\x20structure'));}if(_0x5c838e[_0xbfb6('0x6c')]()){var _0xe2bfd6=fs[_0xbfb6('0x69')](path[_0xbfb6('0x57')](_0x4c55e4,_0x58d585[0x0]));if(_0xe2bfd6[_0xbfb6('0x3e')]===0x0){removeReferences(_0x53b8c3,_0x4c55e4);logger[_0xbfb6('0x2e')](_0xbfb6('0x6b'));return _0x18c0d9(new Error('Invalid\x20plugin\x20structure'));}var _0x5e92bb=_0xe2bfd6[_0xbfb6('0x6d')](function(_0x760b03){return _0x760b03==='manifest.json';});if(!_0x5e92bb){return _0x18c0d9(new Error(_0xbfb6('0x6e')));}var _0x1aa51f=fs[_0xbfb6('0x6f')](path[_0xbfb6('0x57')](_0x4c55e4,_0x58d585[0x0],_0xbfb6('0x70')));var _0x9e9bbf=JSON[_0xbfb6('0x71')](_0x1aa51f);if(_0xbfb6('0x72')==typeof _0x9e9bbf[_0xbfb6('0x30')]){return _0x18c0d9(new Error(_0xbfb6('0x73')));}if(_0xbfb6('0x72')==typeof _0x9e9bbf[_0xbfb6('0x36')]){return _0x18c0d9(new Error(_0xbfb6('0x74')));}if(_0xbfb6('0x72')==typeof _0x9e9bbf['version']){return _0x18c0d9(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xbfb6('0x72')==typeof _0x9e9bbf[_0xbfb6('0x75')]){return _0x18c0d9(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x9e9bbf[_0xbfb6('0x36')]===_0xbfb6('0x76')){if(_0xbfb6('0x72')==typeof _0x9e9bbf[_0xbfb6('0x75')][_0xbfb6('0x77')]){return _0x18c0d9(new Error(_0xbfb6('0x78')));}if(_0xbfb6('0x72')==typeof _0x9e9bbf[_0xbfb6('0x75')]['views'][_0xbfb6('0x79')]&&_0xbfb6('0x72')==typeof _0x9e9bbf[_0xbfb6('0x75')]['views']['agent']){return _0x18c0d9(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x9e9bbf[_0xbfb6('0x36')]===_0xbfb6('0x7a')){if(_0xbfb6('0x72')==typeof _0x9e9bbf[_0xbfb6('0x75')][_0xbfb6('0x7b')]){return _0x18c0d9(new Error(_0xbfb6('0x7c')));}if(_0xbfb6('0x72')==typeof _0x9e9bbf['parameters'][_0xbfb6('0x7d')]){return _0x18c0d9(new Error(_0xbfb6('0x7e')));}}else{return _0x18c0d9(new Error(_0xbfb6('0x7f')));}var _0x11de96=_0x9e9bbf[_0xbfb6('0x30')];var _0x3ba35b=_0x9e9bbf[_0xbfb6('0x80')];var _0xbf5f63=_0x9e9bbf['type'];var _0x4108c1=_0x9e9bbf[_0xbfb6('0x81')]?_0x9e9bbf[_0xbfb6('0x81')]:_0xbfb6('0x82');var _0x4cbacf=_0x9e9bbf[_0xbfb6('0x83')]?_0x9e9bbf[_0xbfb6('0x83')]:_0xbfb6('0x84');var _0x2694a5='';var _0x4aca87='';var _0x55a677='';var _0x16c85c='';var _0x31ee97=_0x9e9bbf[_0xbfb6('0x85')];if(_0xbf5f63===_0xbfb6('0x76')){if(_0xbfb6('0x72')!=typeof _0x9e9bbf[_0xbfb6('0x75')][_0xbfb6('0x77')][_0xbfb6('0x79')]){var _0x3005e9=_0x9e9bbf[_0xbfb6('0x75')][_0xbfb6('0x77')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x3005e9)){_0x2694a5=path[_0xbfb6('0x57')](_0xbfb6('0x86'),_0x356560,_0x58d585[0x0],_0x3005e9);}else{_0x2694a5=_0x3005e9;}}else{logger[_0xbfb6('0x62')](_0xbfb6('0x87'));}if(_0xbfb6('0x72')!=typeof _0x9e9bbf[_0xbfb6('0x75')]['views'][_0xbfb6('0x88')]){var _0x2d3e05=_0x9e9bbf['parameters'][_0xbfb6('0x77')][_0xbfb6('0x88')];if(!/^(f|ht)tps?:\/\//i[_0xbfb6('0x89')](_0x2d3e05)){_0x4aca87=path[_0xbfb6('0x57')]('plugins',_0x356560,_0x58d585[0x0],_0x2d3e05);}else{_0x4aca87=_0x2d3e05;}}else{logger['info'](_0xbfb6('0x8a'));}}else if(_0xbf5f63==='script'){_0x55a677=_0x9e9bbf[_0xbfb6('0x75')][_0xbfb6('0x7b')];_0x16c85c=_0x9e9bbf[_0xbfb6('0x75')][_0xbfb6('0x7d')];if(_0xbfb6('0x72')!=typeof _0x9e9bbf['parameters']['views']){if('undefined'!=typeof _0x9e9bbf[_0xbfb6('0x75')][_0xbfb6('0x77')]['admin']){var _0x3005e9=_0x9e9bbf[_0xbfb6('0x75')][_0xbfb6('0x77')][_0xbfb6('0x79')];if(!/^(f|ht)tps?:\/\//i[_0xbfb6('0x89')](_0x3005e9)){_0x2694a5=path[_0xbfb6('0x57')](_0xbfb6('0x86'),_0x356560,_0x58d585[0x0],_0x3005e9);}else{_0x2694a5=_0x3005e9;}}if('undefined'!=typeof _0x9e9bbf[_0xbfb6('0x75')][_0xbfb6('0x77')][_0xbfb6('0x88')]){var _0x2d3e05=_0x9e9bbf[_0xbfb6('0x75')]['views'][_0xbfb6('0x88')];if(!/^(f|ht)tps?:\/\//i[_0xbfb6('0x89')](_0x2d3e05)){_0x4aca87=path[_0xbfb6('0x57')](_0xbfb6('0x86'),_0x356560,_0x58d585[0x0],_0x2d3e05);}else{_0x4aca87=_0x2d3e05;}}}}var _0x1df3de={'name':_0x11de96,'description':_0x3ba35b,'path':path[_0xbfb6('0x57')](_0x356560,_0x58d585[0x0]),'type':_0xbf5f63,'sidebar':_0x4108c1,'icon':_0x4cbacf,'adminUrl':_0x2694a5,'agentUrl':_0x4aca87,'scriptName':_0x55a677,'scriptPath':_0x16c85c,'version':_0x31ee97};removeReferences(_0x53b8c3,null);return db['Plugin']['create'](_0x1df3de)[_0xbfb6('0x2b')](function(_0x220731){var _0x51304d={'role':_0x910b68['body'][_0xbfb6('0x8b')],'userProfileId':_0x910b68['body'][_0xbfb6('0x8c')]};if(!_0x51304d)throw new Error(_0xbfb6('0x8d'));if(_0x51304d[_0xbfb6('0x8b')]===_0xbfb6('0x8e')){var _0x25e448=_0x220731[_0xbfb6('0x2c')]({'plain':!![]});return db[_0xbfb6('0x8f')][_0xbfb6('0x4c')]({'where':{'name':_0xbfb6('0x2d'),'userProfileId':_0x51304d[_0xbfb6('0x8c')]},'raw':!![]})[_0xbfb6('0x2b')](function(_0x37b417){if(_0x37b417&&_0x37b417[_0xbfb6('0x90')]===0x0){return db[_0xbfb6('0x91')][_0xbfb6('0x92')]({'name':_0x25e448['name'],'resourceId':_0x25e448['id'],'type':_0x37b417[_0xbfb6('0x30')],'sectionId':_0x37b417['id']},{})[_0xbfb6('0x2b')](function(){return _0x220731;});}else{return _0x220731;}})['catch'](function(_0x575f72){logger[_0xbfb6('0x2e')](_0xbfb6('0x93'),_0x575f72);throw _0x575f72;});}return _0x220731;})[_0xbfb6('0x2b')](respondWithResult(_0x365836,null))[_0xbfb6('0x49')](handleError(_0x365836,null));}});}catch(_0x29feed){_0x365836[_0xbfb6('0x1e')](0x1f4)['send'](_0x29feed);}};function removeReferences(_0x2e07a3,_0x51f465){try{if(_0x2e07a3){fs[_0xbfb6('0x94')](_0x2e07a3);logger['info'](_0xbfb6('0x95'));}if(_0x51f465){rimraf(_0x51f465,function(){});logger[_0xbfb6('0x62')](_0xbfb6('0x96'));}}catch(_0x2d2794){logger['error'](_0x2d2794);}}exports[_0xbfb6('0x29')]=function(_0x160a34,_0x19b8b8,_0x12d2ff){return db[_0xbfb6('0x33')][_0xbfb6('0x4c')]({'where':{'id':_0x160a34[_0xbfb6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x19b8b8,null))['then'](saveUpdates(_0x160a34[_0xbfb6('0x97')],null))[_0xbfb6('0x2b')](respondWithResult(_0x19b8b8,null))[_0xbfb6('0x49')](handleError(_0x19b8b8,null));};exports[_0xbfb6('0x98')]=function(_0x322729,_0x3b2ff9,_0x4b3161){return db[_0xbfb6('0x33')][_0xbfb6('0x4c')]({'where':{'id':_0x322729[_0xbfb6('0x4b')]['id']}})[_0xbfb6('0x2b')](function(_0x475b59){if(_0x475b59){return _0x475b59[_0xbfb6('0x2a')]();}})[_0xbfb6('0x2b')](function(_0x5757b6){rimraf(path[_0xbfb6('0x57')](config[_0xbfb6('0x4e')],'server/files/plugins',path[_0xbfb6('0x59')](_0x5757b6['path'])),function(){});return _0x5757b6;})[_0xbfb6('0x2b')](handleEntityNotFound(_0x3b2ff9,null))[_0xbfb6('0x2b')](respondWithStatusCode(_0x3b2ff9,null))[_0xbfb6('0x49')](handleError(_0x3b2ff9,null));};exports[_0xbfb6('0x99')]=function(_0x1d363e,_0x6b9d94,_0x82d490){return BPromise[_0xbfb6('0x9a')]()[_0xbfb6('0x2b')](function(){if(!_0x1d363e[_0xbfb6('0x38')][_0xbfb6('0x7')]){throw new Error(_0xbfb6('0x9b'));}if(!_0x1d363e['query']['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x8c88e6=_0x1d363e[_0xbfb6('0x38')][_0xbfb6('0x9c')]?_0x1d363e[_0xbfb6('0x38')][_0xbfb6('0x9c')]+':'+_0x1d363e['query']['port']:_0xbfb6('0x9d')+_0x1d363e[_0xbfb6('0x38')]['port'];var _0x3ba5d7=_0x1d363e[_0xbfb6('0x38')][_0xbfb6('0x20')]?_0x1d363e[_0xbfb6('0x38')][_0xbfb6('0x20')]:!![];var _0x39f0d1=_0x1d363e['query'][_0xbfb6('0x9e')]?_0x1d363e[_0xbfb6('0x38')][_0xbfb6('0x9e')]:null;var _0x324c04={'method':_0x1d363e[_0xbfb6('0x9f')],'uri':util[_0xbfb6('0x4f')](_0xbfb6('0xa0'),_0x8c88e6,_0x1d363e['query']['path']),'json':_0x3ba5d7,'resolveWithFullResponse':!![],'encoding':_0x39f0d1,'qs':_0x1d363e['query']};if(_0x1d363e[_0xbfb6('0xa1')]){_0x324c04[_0xbfb6('0xa1')]=_0x1d363e[_0xbfb6('0xa1')];if(_0x324c04[_0xbfb6('0xa1')][_0xbfb6('0xa2')]){delete _0x324c04['headers']['content-length'];}}if(_0x324c04[_0xbfb6('0xa1')][_0xbfb6('0xa3')]){delete _0x324c04[_0xbfb6('0xa1')]['content-type'];}return rp(_0x324c04);})[_0xbfb6('0x2b')](function(_0x2b4d88){if(_0x2b4d88){_0x6b9d94[_0xbfb6('0x24')](_0x2b4d88[_0xbfb6('0xa1')]);logger['info'](_0x2b4d88[_0xbfb6('0x97')]);if(_[_0xbfb6('0xa4')](_0x1d363e[_0xbfb6('0x38')][_0xbfb6('0x7')],_0xbfb6('0x4d'))&&_0x2b4d88['statusCode']==0x1f4){return _0x6b9d94['sendStatus'](_0x2b4d88['statusCode']);}else{return _0x6b9d94[_0xbfb6('0x1e')](_0x2b4d88[_0xbfb6('0xa5')])[_0xbfb6('0x31')](_0x2b4d88['body']);}}else{return _0x6b9d94[_0xbfb6('0x1d')](0xc8);}})[_0xbfb6('0x49')](handleError(_0x6b9d94,null));};exports['webhookPost']=function(_0x3dc9f0,_0x57b2a0,_0x49f546){return BPromise[_0xbfb6('0x9a')]()['then'](function(){if(!_0x3dc9f0[_0xbfb6('0x38')][_0xbfb6('0x7')]){throw new Error(_0xbfb6('0x9b'));}if(!_0x3dc9f0['query']['port']){throw new Error(_0xbfb6('0xa6'));}var _0x496552=_0x3dc9f0['query']['hostname']?_0x3dc9f0[_0xbfb6('0x38')][_0xbfb6('0x9c')]+':'+_0x3dc9f0[_0xbfb6('0x38')]['port']:_0xbfb6('0x9d')+_0x3dc9f0[_0xbfb6('0x38')][_0xbfb6('0xa7')];var _0x4e9554=_0x3dc9f0[_0xbfb6('0x38')][_0xbfb6('0x20')]?_0x3dc9f0[_0xbfb6('0x38')][_0xbfb6('0x20')]:!![];var _0x477bdf=_0x3dc9f0[_0xbfb6('0x38')][_0xbfb6('0x9e')]?_0x3dc9f0['query']['encoding']:null;var _0xec6aba={'method':_0x3dc9f0[_0xbfb6('0x9f')],'uri':util[_0xbfb6('0x4f')](_0xbfb6('0xa0'),_0x496552,_0x3dc9f0[_0xbfb6('0x38')][_0xbfb6('0x7')]),'json':_0x4e9554,'resolveWithFullResponse':!![],'encoding':_0x477bdf,'body':_0x3dc9f0['body']};if(_0x3dc9f0['headers']){_0xec6aba['headers']=_0x3dc9f0[_0xbfb6('0xa1')];if(_0xec6aba[_0xbfb6('0xa1')][_0xbfb6('0xa2')]){delete _0xec6aba[_0xbfb6('0xa1')][_0xbfb6('0xa2')];}}if(_0xec6aba[_0xbfb6('0xa1')][_0xbfb6('0xa3')]){delete _0xec6aba['headers'][_0xbfb6('0xa3')];}return rp(_0xec6aba);})[_0xbfb6('0x2b')](function(_0x500c23){if(_0x500c23){_0x57b2a0[_0xbfb6('0x24')](_0x500c23[_0xbfb6('0xa1')]);logger[_0xbfb6('0x62')](_0x500c23['body']);return _0x57b2a0[_0xbfb6('0x1e')](_0x500c23[_0xbfb6('0xa5')])[_0xbfb6('0x31')](_0x500c23['body']);}else{return _0x57b2a0[_0xbfb6('0x1d')](0xc8);}})[_0xbfb6('0x49')](handleError(_0x57b2a0,null));}; \ No newline at end of file +var _0x1688=['rows','catch','length','includeAll','find','download','params','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','glob','dirname','finalize','close','existsSync','Plugin\x20not\x20found','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','undefined','type','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','script','scriptPath','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','method','%s%s','headers','content-length','content-type','statusCode','sendStatus','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./plugin.socket','register','end','status','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','Plugins','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','count','include','findAll'];(function(_0x407374,_0x16a9aa){var _0x4391ba=function(_0x5cd33d){while(--_0x5cd33d){_0x407374['push'](_0x407374['shift']());}};_0x4391ba(++_0x16a9aa);}(_0x1688,0x1bc));var _0x8168=function(_0x95cf02,_0xbcc861){_0x95cf02=_0x95cf02-0x0;var _0x47371c=_0x1688[_0x95cf02];return _0x47371c;};'use strict';var pdf=require(_0x8168('0x0'));var emlformat=require(_0x8168('0x1'));var rimraf=require(_0x8168('0x2'));var zipdir=require(_0x8168('0x3'));var jsonpatch=require(_0x8168('0x4'));var rp=require(_0x8168('0x5'));var moment=require(_0x8168('0x6'));var BPromise=require(_0x8168('0x7'));var Mustache=require('mustache');var util=require(_0x8168('0x8'));var path=require(_0x8168('0x9'));var sox=require(_0x8168('0xa'));var csv=require(_0x8168('0xb'));var ejs=require(_0x8168('0xc'));var fs=require('fs');var _=require(_0x8168('0xd'));var squel=require('squel');var crypto=require(_0x8168('0xe'));var jsforce=require(_0x8168('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8168('0xb'));var querystring=require(_0x8168('0x10'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x8168('0x2'));var archiver=require(_0x8168('0x11'));var Redis=require(_0x8168('0x12'));var authService=require(_0x8168('0x13'));var qs=require(_0x8168('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8168('0x15'))(_0x8168('0x16'));var utils=require(_0x8168('0x17'));var config=require(_0x8168('0x18'));var db=require(_0x8168('0x19'))['db'];config[_0x8168('0x1a')]=_['defaults'](config[_0x8168('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x8168('0x1b'))(new Redis(config['redis']));require(_0x8168('0x1c'))[_0x8168('0x1d')](socket);function respondWithStatusCode(_0x4e47ce,_0x14a77a){_0x14a77a=_0x14a77a||0xcc;return function(_0x1bb2cc){if(_0x1bb2cc){return _0x4e47ce['sendStatus'](_0x14a77a);}return _0x4e47ce['status'](_0x14a77a)[_0x8168('0x1e')]();};}function respondWithResult(_0x26c70c,_0x4479dd){_0x4479dd=_0x4479dd||0xc8;return function(_0x25546c){if(_0x25546c){return _0x26c70c[_0x8168('0x1f')](_0x4479dd)['json'](_0x25546c);}};}function respondWithFilteredResult(_0x5bdf04,_0xe30fec){return function(_0xc7f188){if(_0xc7f188){var _0x2cdb17=_0xc7f188['count'],_0x52daa2=_0xe30fec[_0x8168('0x20')],_0x3816f5=_0xe30fec[_0x8168('0x20')]+_0xe30fec[_0x8168('0x21')],_0x211c2c;if(_0x3816f5>=_0x2cdb17){_0x3816f5=_0x2cdb17;_0x211c2c=0xc8;}else{_0x211c2c=0xce;}_0x5bdf04[_0x8168('0x1f')](_0x211c2c);return _0x5bdf04[_0x8168('0x22')](_0x8168('0x23'),_0x52daa2+'-'+_0x3816f5+'/'+_0x2cdb17)['json'](_0xc7f188);}return null;};}function patchUpdates(_0x599315){return function(_0x1037ae){try{jsonpatch[_0x8168('0x24')](_0x1037ae,_0x599315,!![]);}catch(_0x3aabc8){return BPromise[_0x8168('0x25')](_0x3aabc8);}return _0x1037ae[_0x8168('0x26')]();};}function saveUpdates(_0x1dd4f3,_0x1119ff){return function(_0x44a4d0){if(_0x44a4d0){return _0x44a4d0['update'](_0x1dd4f3)[_0x8168('0x27')](function(_0x2d26fe){return _0x2d26fe;});}return null;};}function removeEntity(_0x3db0e9,_0x349967){return function(_0x17bca9){if(_0x17bca9){return _0x17bca9[_0x8168('0x28')]()[_0x8168('0x27')](function(){var _0x4c219c=_0x17bca9[_0x8168('0x29')]({'plain':!![]});var _0x49e47a=_0x8168('0x2a');return db['UserProfileResource'][_0x8168('0x28')]({'where':{'type':_0x49e47a,'resourceId':_0x4c219c['id']}})[_0x8168('0x27')](function(){return _0x17bca9;});})[_0x8168('0x27')](function(){_0x3db0e9[_0x8168('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e4c1f,_0x5cff31){return function(_0x1ecf54){if(!_0x1ecf54){_0x4e4c1f['sendStatus'](0x194);}return _0x1ecf54;};}function handleError(_0x33faaf,_0x2bb265){_0x2bb265=_0x2bb265||0x1f4;return function(_0x178d10){logger[_0x8168('0x2b')](_0x178d10[_0x8168('0x2c')]);if(_0x178d10[_0x8168('0x2d')]){delete _0x178d10[_0x8168('0x2d')];}_0x33faaf[_0x8168('0x1f')](_0x2bb265)[_0x8168('0x2e')](_0x178d10);};}exports[_0x8168('0x2f')]=function(_0x129b23,_0x9287fb){var _0x35e965={},_0x1f3423={},_0x4bfb9b={'count':0x0,'rows':[]};var _0x305996=_[_0x8168('0x30')](db[_0x8168('0x31')][_0x8168('0x32')],function(_0x8ac6bd){return{'name':_0x8ac6bd[_0x8168('0x33')],'type':_0x8ac6bd['type'][_0x8168('0x34')]};});_0x1f3423[_0x8168('0x35')]=_[_0x8168('0x30')](_0x305996,_0x8168('0x2d'));_0x1f3423[_0x8168('0x36')]=_[_0x8168('0x37')](_0x129b23[_0x8168('0x36')]);_0x1f3423[_0x8168('0x38')]=_[_0x8168('0x39')](_0x1f3423[_0x8168('0x35')],_0x1f3423[_0x8168('0x36')]);_0x35e965['attributes']=_[_0x8168('0x39')](_0x1f3423[_0x8168('0x35')],qs[_0x8168('0x3a')](_0x129b23[_0x8168('0x36')][_0x8168('0x3a')]));_0x35e965[_0x8168('0x3b')]=_0x35e965[_0x8168('0x3b')]['length']?_0x35e965[_0x8168('0x3b')]:_0x1f3423[_0x8168('0x35')];if(!_0x129b23[_0x8168('0x36')][_0x8168('0x3c')](_0x8168('0x3d'))){_0x35e965['limit']=qs[_0x8168('0x21')](_0x129b23['query'][_0x8168('0x21')]);_0x35e965[_0x8168('0x20')]=qs[_0x8168('0x20')](_0x129b23[_0x8168('0x36')][_0x8168('0x20')]);}_0x35e965[_0x8168('0x3e')]=qs[_0x8168('0x3f')](_0x129b23[_0x8168('0x36')][_0x8168('0x3f')]);_0x35e965[_0x8168('0x40')]=qs[_0x8168('0x38')](_[_0x8168('0x41')](_0x129b23[_0x8168('0x36')],_0x1f3423[_0x8168('0x38')]));if(_0x129b23[_0x8168('0x36')]['filter']){_0x35e965[_0x8168('0x40')]=_[_0x8168('0x42')](_0x35e965['where'],{'$or':_[_0x8168('0x30')](_0x305996,function(_0xf3afb9){if(_0xf3afb9['type']!==_0x8168('0x43')){var _0x1a62b7={};_0x1a62b7[_0xf3afb9[_0x8168('0x2d')]]={'$like':'%'+_0x129b23['query'][_0x8168('0x44')]+'%'};return _0x1a62b7;}})});}_0x35e965=_[_0x8168('0x42')]({},_0x35e965,_0x129b23['options']);var _0x3add8f={'where':_0x35e965['where']};return db[_0x8168('0x31')]['count'](_0x3add8f)[_0x8168('0x27')](function(_0x4c729a){_0x4bfb9b[_0x8168('0x45')]=_0x4c729a;if(_0x129b23['query']['includeAll']){_0x35e965[_0x8168('0x46')]=[{'all':!![]}];}return db['Plugin'][_0x8168('0x47')](_0x35e965);})[_0x8168('0x27')](function(_0x2c3d93){_0x4bfb9b[_0x8168('0x48')]=_0x2c3d93;return _0x4bfb9b;})[_0x8168('0x27')](respondWithFilteredResult(_0x9287fb,_0x35e965))[_0x8168('0x49')](handleError(_0x9287fb,null));};exports['show']=function(_0x15812a,_0x4bb3a2){var _0x5d0dc2={'raw':!![],'where':{'id':_0x15812a['params']['id']}},_0x1993b6={};_0x1993b6['model']=_[_0x8168('0x37')](db['Plugin'][_0x8168('0x32')]);_0x1993b6[_0x8168('0x36')]=_[_0x8168('0x37')](_0x15812a[_0x8168('0x36')]);_0x1993b6[_0x8168('0x38')]=_[_0x8168('0x39')](_0x1993b6[_0x8168('0x35')],_0x1993b6[_0x8168('0x36')]);_0x5d0dc2['attributes']=_[_0x8168('0x39')](_0x1993b6['model'],qs[_0x8168('0x3a')](_0x15812a[_0x8168('0x36')][_0x8168('0x3a')]));_0x5d0dc2[_0x8168('0x3b')]=_0x5d0dc2[_0x8168('0x3b')][_0x8168('0x4a')]?_0x5d0dc2[_0x8168('0x3b')]:_0x1993b6['model'];if(_0x15812a[_0x8168('0x36')][_0x8168('0x4b')]){_0x5d0dc2[_0x8168('0x46')]=[{'all':!![]}];}_0x5d0dc2=_[_0x8168('0x42')]({},_0x5d0dc2,_0x15812a['options']);return db['Plugin'][_0x8168('0x4c')](_0x5d0dc2)[_0x8168('0x27')](handleEntityNotFound(_0x4bb3a2,null))[_0x8168('0x27')](respondWithResult(_0x4bb3a2,null))[_0x8168('0x49')](handleError(_0x4bb3a2,null));};exports[_0x8168('0x4d')]=function(_0x325f9e,_0x4ae9bb,_0x207ed1){return db['Plugin'][_0x8168('0x4c')]({'where':{'id':_0x325f9e[_0x8168('0x4e')]['id']},'attributes':['name',_0x8168('0x9')],'raw':!![]})[_0x8168('0x27')](handleEntityNotFound(_0x4ae9bb,null))[_0x8168('0x27')](function(_0x11084e){if(_0x11084e){var _0x188ee4=path[_0x8168('0x4f')](config[_0x8168('0x50')],_0x8168('0x51'),util[_0x8168('0x52')](_0x8168('0x53'),path[_0x8168('0x54')](_0x11084e['path'])));var _0x192544=fs[_0x8168('0x55')](_0x188ee4);var _0x45571d=archiver(_0x8168('0x56'),{'zlib':{'level':0x9}});_0x45571d['on'](_0x8168('0x57'),function(_0x43a92d){if(_0x43a92d['code']===_0x8168('0x58')){logger['error'](_0x43a92d);}else{throw new db['Sequelize'][(_0x8168('0x59'))](_0x8168('0x5a'));}});_0x45571d['on']('error',function(_0x544110){throw new db[(_0x8168('0x5b'))][(_0x8168('0x59'))](_0x8168('0x5a'));});_0x45571d['pipe'](_0x192544);_0x45571d[_0x8168('0x5c')]('**/*',{'cwd':path[_0x8168('0x4f')](config[_0x8168('0x50')],_0x8168('0x51'),path[_0x8168('0x5d')](_0x11084e['path'])),'ignore':[path[_0x8168('0x4f')](path[_0x8168('0x54')](_0x11084e[_0x8168('0x9')]),'node_modules/**/*'),path[_0x8168('0x4f')](path[_0x8168('0x54')](_0x11084e[_0x8168('0x9')]),'attachments/**/*')],'nodir':!![]})[_0x8168('0x5e')]();_0x192544['on'](_0x8168('0x5f'),function(){if(!fs[_0x8168('0x60')](_0x188ee4)){throw new db[(_0x8168('0x5b'))][(_0x8168('0x59'))](_0x8168('0x61'));}return _0x4ae9bb[_0x8168('0x4d')](_0x188ee4,util[_0x8168('0x52')](_0x8168('0x53'),path[_0x8168('0x54')](_0x11084e[_0x8168('0x9')])),function(_0x13e0ba){if(_0x13e0ba){throw new db['Sequelize'][(_0x8168('0x59'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x188ee4);logger[_0x8168('0x62')](_0x8168('0x63'));logger['info'](_0x8168('0x64'));});});}return null;})[_0x8168('0x49')](handleError(_0x4ae9bb,null));};exports[_0x8168('0x65')]=function(_0x39e852,_0x4f8554,_0x1fa445){var _0x558840=path['basename'](_0x39e852[_0x8168('0x66')][_0x8168('0x67')],path[_0x8168('0x68')](_0x39e852[_0x8168('0x66')][_0x8168('0x67')]));var _0x326ed4=path[_0x8168('0x4f')](config[_0x8168('0x50')],_0x8168('0x51'),_0x39e852['file'][_0x8168('0x67')]);var _0x5dec77=path['join'](config[_0x8168('0x50')],_0x8168('0x51'),_0x558840);logger[_0x8168('0x62')](_0x8168('0x69'),_0x326ed4);logger[_0x8168('0x62')]('Plugin\x20upload\x20destination:\x20%s',_0x5dec77);try{fs['chmodSync'](_0x326ed4,parseInt(_0x8168('0x6a'),0x8));extract(_0x326ed4,{'dir':_0x5dec77},function(_0x316270){if(_0x316270){logger[_0x8168('0x2b')](_0x316270);handleError(_0x316270,!![]);};var _0x51d24c=fs[_0x8168('0x6b')](_0x5dec77);if(_0x51d24c['length']>0x1){removeReferences(_0x326ed4,_0x5dec77);logger[_0x8168('0x2b')](_0x8168('0x6c'));return _0x1fa445(new Error('Invalid\x20plugin\x20structure'));}var _0x1ff1c6=fs[_0x8168('0x6d')](path[_0x8168('0x4f')](_0x5dec77,_0x51d24c[0x0]));if(_0x1ff1c6['isFile']()){removeReferences(_0x326ed4,_0x5dec77);logger[_0x8168('0x2b')](_0x8168('0x6c'));return _0x1fa445(new Error(_0x8168('0x6c')));}if(_0x1ff1c6[_0x8168('0x6e')]()){var _0x3ecb72=fs[_0x8168('0x6b')](path[_0x8168('0x4f')](_0x5dec77,_0x51d24c[0x0]));if(_0x3ecb72[_0x8168('0x4a')]===0x0){removeReferences(_0x326ed4,_0x5dec77);logger[_0x8168('0x2b')]('Invalid\x20plugin\x20structure');return _0x1fa445(new Error(_0x8168('0x6c')));}var _0x41bc4e=_0x3ecb72[_0x8168('0x6f')](function(_0x220d28){return _0x220d28===_0x8168('0x70');});if(!_0x41bc4e){return _0x1fa445(new Error(_0x8168('0x71')));}var _0x3131cc=fs[_0x8168('0x72')](path[_0x8168('0x4f')](_0x5dec77,_0x51d24c[0x0],_0x8168('0x70')));var _0x449a22=JSON[_0x8168('0x73')](_0x3131cc);if('undefined'==typeof _0x449a22[_0x8168('0x2d')]){return _0x1fa445(new Error(_0x8168('0x74')));}if(_0x8168('0x75')==typeof _0x449a22[_0x8168('0x76')]){return _0x1fa445(new Error(_0x8168('0x77')));}if(_0x8168('0x75')==typeof _0x449a22[_0x8168('0x78')]){return _0x1fa445(new Error(_0x8168('0x79')));}if(_0x8168('0x75')==typeof _0x449a22[_0x8168('0x7a')]){return _0x1fa445(new Error(_0x8168('0x7b')));}if(_0x449a22[_0x8168('0x76')]===_0x8168('0x7c')){if(_0x8168('0x75')==typeof _0x449a22[_0x8168('0x7a')][_0x8168('0x7d')]){return _0x1fa445(new Error(_0x8168('0x7e')));}if(_0x8168('0x75')==typeof _0x449a22[_0x8168('0x7a')]['views'][_0x8168('0x7f')]&&_0x8168('0x75')==typeof _0x449a22[_0x8168('0x7a')][_0x8168('0x7d')]['agent']){return _0x1fa445(new Error(_0x8168('0x80')));}}else if(_0x449a22[_0x8168('0x76')]==='script'){if(_0x8168('0x75')==typeof _0x449a22[_0x8168('0x7a')][_0x8168('0x81')]){return _0x1fa445(new Error(_0x8168('0x82')));}if(_0x8168('0x75')==typeof _0x449a22[_0x8168('0x7a')]['scriptPath']){return _0x1fa445(new Error(_0x8168('0x83')));}}else{return _0x1fa445(new Error(_0x8168('0x84')));}var _0x546912=_0x449a22['name'];var _0x5137a9=_0x449a22['description'];var _0x613739=_0x449a22[_0x8168('0x76')];var _0x59ece2=_0x449a22[_0x8168('0x85')]?_0x449a22[_0x8168('0x85')]:_0x8168('0x86');var _0x546025=_0x449a22[_0x8168('0x87')]?_0x449a22[_0x8168('0x87')]:_0x8168('0x88');var _0x4ccc89='';var _0x205a55='';var _0x4c8d9b='';var _0x34f61c='';var _0x317a00=_0x449a22['version'];if(_0x613739==='html'){if(_0x8168('0x75')!=typeof _0x449a22[_0x8168('0x7a')]['views'][_0x8168('0x7f')]){var _0x2a10c3=_0x449a22['parameters'][_0x8168('0x7d')][_0x8168('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x8168('0x89')](_0x2a10c3)){_0x4ccc89=path['join'](_0x8168('0x8a'),_0x558840,_0x51d24c[0x0],_0x2a10c3);}else{_0x4ccc89=_0x2a10c3;}}else{logger[_0x8168('0x62')](_0x8168('0x8b'));}if('undefined'!=typeof _0x449a22[_0x8168('0x7a')][_0x8168('0x7d')][_0x8168('0x8c')]){var _0x30f603=_0x449a22[_0x8168('0x7a')][_0x8168('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x8168('0x89')](_0x30f603)){_0x205a55=path[_0x8168('0x4f')](_0x8168('0x8a'),_0x558840,_0x51d24c[0x0],_0x30f603);}else{_0x205a55=_0x30f603;}}else{logger[_0x8168('0x62')](_0x8168('0x8d'));}}else if(_0x613739===_0x8168('0x8e')){_0x4c8d9b=_0x449a22[_0x8168('0x7a')][_0x8168('0x81')];_0x34f61c=_0x449a22[_0x8168('0x7a')][_0x8168('0x8f')];if(_0x8168('0x75')!=typeof _0x449a22[_0x8168('0x7a')][_0x8168('0x7d')]){if(_0x8168('0x75')!=typeof _0x449a22[_0x8168('0x7a')][_0x8168('0x7d')][_0x8168('0x7f')]){var _0x2a10c3=_0x449a22[_0x8168('0x7a')]['views'][_0x8168('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2a10c3)){_0x4ccc89=path['join'](_0x8168('0x8a'),_0x558840,_0x51d24c[0x0],_0x2a10c3);}else{_0x4ccc89=_0x2a10c3;}}if('undefined'!=typeof _0x449a22[_0x8168('0x7a')][_0x8168('0x7d')][_0x8168('0x8c')]){var _0x30f603=_0x449a22[_0x8168('0x7a')]['views'][_0x8168('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x8168('0x89')](_0x30f603)){_0x205a55=path[_0x8168('0x4f')]('plugins',_0x558840,_0x51d24c[0x0],_0x30f603);}else{_0x205a55=_0x30f603;}}}}var _0xeea883={'name':_0x546912,'description':_0x5137a9,'path':path[_0x8168('0x4f')](_0x558840,_0x51d24c[0x0]),'type':_0x613739,'sidebar':_0x59ece2,'icon':_0x546025,'adminUrl':_0x4ccc89,'agentUrl':_0x205a55,'scriptName':_0x4c8d9b,'scriptPath':_0x34f61c,'version':_0x317a00};removeReferences(_0x326ed4,null);return db[_0x8168('0x31')]['create'](_0xeea883)[_0x8168('0x27')](function(_0x818ffa){var _0x21f08f={'role':_0x39e852[_0x8168('0x90')][_0x8168('0x91')],'userProfileId':_0x39e852['body']['userProfileId']};if(!_0x21f08f)throw new Error(_0x8168('0x92'));if(_0x21f08f[_0x8168('0x91')]==='user'){var _0x30a90e=_0x818ffa[_0x8168('0x29')]({'plain':!![]});return db[_0x8168('0x93')][_0x8168('0x4c')]({'where':{'name':'Plugins','userProfileId':_0x21f08f['userProfileId']},'raw':!![]})[_0x8168('0x27')](function(_0x3442bc){if(_0x3442bc&&_0x3442bc[_0x8168('0x94')]===0x0){return db['UserProfileResource'][_0x8168('0x95')]({'name':_0x30a90e[_0x8168('0x2d')],'resourceId':_0x30a90e['id'],'type':_0x3442bc[_0x8168('0x2d')],'sectionId':_0x3442bc['id']},{})[_0x8168('0x27')](function(){return _0x818ffa;});}else{return _0x818ffa;}})[_0x8168('0x49')](function(_0x175812){logger['error'](_0x8168('0x96'),_0x175812);throw _0x175812;});}return _0x818ffa;})['then'](respondWithResult(_0x4f8554,null))['catch'](handleError(_0x4f8554,null));}});}catch(_0x2ed28f){_0x4f8554['status'](0x1f4)[_0x8168('0x2e')](_0x2ed28f);}};function removeReferences(_0x47c736,_0x5c9f5b){try{if(_0x47c736){fs[_0x8168('0x97')](_0x47c736);logger[_0x8168('0x62')](_0x8168('0x98'));}if(_0x5c9f5b){rimraf(_0x5c9f5b,function(){});logger[_0x8168('0x62')](_0x8168('0x99'));}}catch(_0xf03263){logger[_0x8168('0x2b')](_0xf03263);}}exports[_0x8168('0x9a')]=function(_0x57a14d,_0x117dfd,_0x20bbb8){return db[_0x8168('0x31')]['find']({'where':{'id':_0x57a14d[_0x8168('0x4e')]['id']}})[_0x8168('0x27')](handleEntityNotFound(_0x117dfd,null))[_0x8168('0x27')](saveUpdates(_0x57a14d['body'],null))[_0x8168('0x27')](respondWithResult(_0x117dfd,null))['catch'](handleError(_0x117dfd,null));};exports[_0x8168('0x9b')]=function(_0x45e30e,_0x34d80e,_0x1be8fc){return db[_0x8168('0x31')][_0x8168('0x4c')]({'where':{'id':_0x45e30e[_0x8168('0x4e')]['id']}})[_0x8168('0x27')](function(_0x13dcdd){if(_0x13dcdd){return _0x13dcdd['destroy']();}})[_0x8168('0x27')](function(_0x24cd07){rimraf(path[_0x8168('0x4f')](config['root'],_0x8168('0x51'),path[_0x8168('0x5d')](_0x24cd07[_0x8168('0x9')])),function(){});return _0x24cd07;})[_0x8168('0x27')](handleEntityNotFound(_0x34d80e,null))['then'](respondWithStatusCode(_0x34d80e,null))[_0x8168('0x49')](handleError(_0x34d80e,null));};exports[_0x8168('0x9c')]=function(_0x1d2ce5,_0x291d0d,_0x157da8){return BPromise[_0x8168('0x9d')]()[_0x8168('0x27')](function(){if(!_0x1d2ce5['query'][_0x8168('0x9')]){throw new Error(_0x8168('0x9e'));}if(!_0x1d2ce5[_0x8168('0x36')][_0x8168('0x9f')]){throw new Error(_0x8168('0xa0'));}var _0x1911a6=_0x1d2ce5[_0x8168('0x36')][_0x8168('0xa1')]?_0x1d2ce5[_0x8168('0x36')][_0x8168('0xa1')]+':'+_0x1d2ce5[_0x8168('0x36')][_0x8168('0x9f')]:_0x8168('0xa2')+_0x1d2ce5['query'][_0x8168('0x9f')];var _0x2de018=_0x1d2ce5['query'][_0x8168('0xa3')]?_0x1d2ce5[_0x8168('0x36')]['json']:!![];var _0x4b5568=_0x1d2ce5[_0x8168('0x36')][_0x8168('0xa4')]?_0x1d2ce5[_0x8168('0x36')][_0x8168('0xa4')]:null;var _0x2d1854={'method':_0x1d2ce5[_0x8168('0xa5')],'uri':util[_0x8168('0x52')](_0x8168('0xa6'),_0x1911a6,_0x1d2ce5[_0x8168('0x36')]['path']),'json':_0x2de018,'resolveWithFullResponse':!![],'encoding':_0x4b5568,'qs':_0x1d2ce5[_0x8168('0x36')]};if(_0x1d2ce5['headers']){_0x2d1854[_0x8168('0xa7')]=_0x1d2ce5['headers'];if(_0x2d1854['headers'][_0x8168('0xa8')]){delete _0x2d1854[_0x8168('0xa7')]['content-length'];}}if(_0x2d1854[_0x8168('0xa7')][_0x8168('0xa9')]){delete _0x2d1854[_0x8168('0xa7')][_0x8168('0xa9')];}return rp(_0x2d1854);})[_0x8168('0x27')](function(_0x353a13){if(_0x353a13){_0x291d0d[_0x8168('0x22')](_0x353a13[_0x8168('0xa7')]);logger['info'](_0x353a13[_0x8168('0x90')]);if(_['endsWith'](_0x1d2ce5[_0x8168('0x36')]['path'],_0x8168('0x4d'))&&_0x353a13[_0x8168('0xaa')]==0x1f4){return _0x291d0d[_0x8168('0xab')](_0x353a13[_0x8168('0xaa')]);}else{return _0x291d0d[_0x8168('0x1f')](_0x353a13[_0x8168('0xaa')])[_0x8168('0x2e')](_0x353a13[_0x8168('0x90')]);}}else{return _0x291d0d[_0x8168('0xab')](0xc8);}})[_0x8168('0x49')](handleError(_0x291d0d,null));};exports['webhookPost']=function(_0x1552af,_0x20d500,_0x3c25c5){return BPromise[_0x8168('0x9d')]()['then'](function(){if(!_0x1552af[_0x8168('0x36')][_0x8168('0x9')]){throw new Error(_0x8168('0x9e'));}if(!_0x1552af[_0x8168('0x36')][_0x8168('0x9f')]){throw new Error(_0x8168('0xa0'));}var _0x15aa25=_0x1552af['query'][_0x8168('0xa1')]?_0x1552af['query'][_0x8168('0xa1')]+':'+_0x1552af[_0x8168('0x36')][_0x8168('0x9f')]:'http://localhost:'+_0x1552af[_0x8168('0x36')][_0x8168('0x9f')];var _0x5b58cc=_0x1552af[_0x8168('0x36')]['json']?_0x1552af[_0x8168('0x36')]['json']:!![];var _0x388e24=_0x1552af[_0x8168('0x36')]['encoding']?_0x1552af[_0x8168('0x36')][_0x8168('0xa4')]:null;var _0x38a2f2={'method':_0x1552af[_0x8168('0xa5')],'uri':util['format'](_0x8168('0xa6'),_0x15aa25,_0x1552af['query']['path']),'json':_0x5b58cc,'resolveWithFullResponse':!![],'encoding':_0x388e24,'body':_0x1552af[_0x8168('0x90')]};if(_0x1552af[_0x8168('0xa7')]){_0x38a2f2[_0x8168('0xa7')]=_0x1552af[_0x8168('0xa7')];if(_0x38a2f2[_0x8168('0xa7')][_0x8168('0xa8')]){delete _0x38a2f2[_0x8168('0xa7')][_0x8168('0xa8')];}}if(_0x38a2f2[_0x8168('0xa7')]['content-type']){delete _0x38a2f2[_0x8168('0xa7')][_0x8168('0xa9')];}return rp(_0x38a2f2);})[_0x8168('0x27')](function(_0x3e9dd5){if(_0x3e9dd5){_0x20d500[_0x8168('0x22')](_0x3e9dd5['headers']);logger[_0x8168('0x62')](_0x3e9dd5[_0x8168('0x90')]);return _0x20d500[_0x8168('0x1f')](_0x3e9dd5[_0x8168('0xaa')])[_0x8168('0x2e')](_0x3e9dd5[_0x8168('0x90')]);}else{return _0x20d500[_0x8168('0xab')](0xc8);}})[_0x8168('0x49')](handleError(_0x20d500,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index ed57607..64c965f 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 _0xb44a=['Plugin','save','emit','hasOwnProperty','hook','exports'];(function(_0x19d161,_0x2b4fa7){var _0x4c9e13=function(_0x30840e){while(--_0x30840e){_0x19d161['push'](_0x19d161['shift']());}};_0x4c9e13(++_0x2b4fa7);}(_0xb44a,0x1c2));var _0xab44=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0xb44a[_0x46a38b];return _0x346e75;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0xab44('0x0')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xab44('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3aa69c){return function(_0x5c93b4,_0x1b9e05,_0x32396c){PluginEvents[_0xab44('0x2')](_0x3aa69c+':'+_0x5c93b4['id'],_0x5c93b4);PluginEvents[_0xab44('0x2')](_0x3aa69c,_0x5c93b4);_0x32396c(null);};}for(var e in events){if(events[_0xab44('0x3')](e)){var event=events[e];Plugin[_0xab44('0x4')](e,emitEvent(event));}}module[_0xab44('0x5')]=PluginEvents; \ No newline at end of file +var _0x7916=['events','Plugin','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x334b7e,_0x4bd63e){var _0x4e8402=function(_0x414ea0){while(--_0x414ea0){_0x334b7e['push'](_0x334b7e['shift']());}};_0x4e8402(++_0x4bd63e);}(_0x7916,0x128));var _0x6791=function(_0x3c4162,_0x284c9a){_0x3c4162=_0x3c4162-0x0;var _0x2c1da4=_0x7916[_0x3c4162];return _0x2c1da4;};'use strict';var EventEmitter=require(_0x6791('0x0'));var Plugin=require('../../mysqldb')['db'][_0x6791('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x6791('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6791('0x3'),'afterDestroy':_0x6791('0x4')};function emitEvent(_0xfdcbc5){return function(_0x330476,_0x5e6303,_0xe98396){PluginEvents['emit'](_0xfdcbc5+':'+_0x330476['id'],_0x330476);PluginEvents[_0x6791('0x5')](_0xfdcbc5,_0x330476);_0xe98396(null);};}for(var e in events){if(events[_0x6791('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x6791('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index a349b44..4c6d9d2 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 _0xf3cd=['path','rimraf','../../config/environment','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x195594,_0x4ca6bd){var _0x189fb2=function(_0xb676f4){while(--_0xb676f4){_0x195594['push'](_0x195594['shift']());}};_0x189fb2(++_0x4ca6bd);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4024bd,_0x164def){_0x4024bd=_0x4024bd-0x0;var _0x5cbe79=_0xf3cd[_0x4024bd];return _0x5cbe79;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./plugin.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7da7=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','plugins','lodash'];(function(_0x302998,_0x59ff14){var _0x4ed186=function(_0x1098e7){while(--_0x1098e7){_0x302998['push'](_0x302998['shift']());}};_0x4ed186(++_0x59ff14);}(_0x7da7,0x10d));var _0x77da=function(_0x4a095e,_0x381cd5){_0x4a095e=_0x4a095e-0x0;var _0x10ef73=_0x7da7[_0x4a095e];return _0x10ef73;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77da('0x3'));var rp=require(_0x77da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var attributes=require('./plugin.attributes');module[_0x77da('0x7')]=function(_0xc54a12,_0x47da81){return _0xc54a12[_0x77da('0x8')]('Plugin',attributes,{'tableName':_0x77da('0x9'),'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 dd52023..6421c55 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 _0x5695=['request\x20sent','result','Plugin','create','body','options','raw','then','CreatePlugin','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','socket.io-emitter','./plugin.socket','register','info','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message'];(function(_0x1702cf,_0x140c02){var _0x33137e=function(_0x567c82){while(--_0x567c82){_0x1702cf['push'](_0x1702cf['shift']());}};_0x33137e(++_0x140c02);}(_0x5695,0x135));var _0x5569=function(_0x81acc5,_0x4ba174){_0x81acc5=_0x81acc5-0x0;var _0x13a5d9=_0x5695[_0x81acc5];return _0x13a5d9;};'use strict';var _=require(_0x5569('0x0'));var util=require(_0x5569('0x1'));var moment=require('moment');var BPromise=require(_0x5569('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5569('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5569('0x4'));var logger=require(_0x5569('0x5'))(_0x5569('0x6'));var config=require('../../config/environment');var jayson=require(_0x5569('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x5569('0x8')]=_[_0x5569('0x9')](config[_0x5569('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x5569('0xa'))(new Redis(config[_0x5569('0x8')]));require(_0x5569('0xb'))[_0x5569('0xc')](socket);function respondWithRpcPromise(_0x3e9afa,_0x160b41,_0x297095){return new BPromise(function(_0x5b0f2c,_0x352d4d){return client['request'](_0x3e9afa,_0x297095)['then'](function(_0x103711){logger[_0x5569('0xd')]('Plugin,\x20%s,\x20%s',_0x160b41,'request\x20sent');logger[_0x5569('0xe')](_0x5569('0xf'),_0x160b41,'request\x20sent',JSON[_0x5569('0x10')](_0x103711));if(_0x103711[_0x5569('0x11')]){if(_0x103711[_0x5569('0x11')][_0x5569('0x12')]===0x1f4){logger[_0x5569('0x11')](_0x5569('0x13'),_0x160b41,_0x103711['error']['message']);return _0x352d4d(_0x103711[_0x5569('0x11')][_0x5569('0x14')]);}logger[_0x5569('0x11')](_0x5569('0x13'),_0x160b41,_0x103711[_0x5569('0x11')][_0x5569('0x14')]);return _0x5b0f2c(_0x103711[_0x5569('0x11')]['message']);}else{logger[_0x5569('0xd')]('Plugin,\x20%s,\x20%s',_0x160b41,_0x5569('0x15'));_0x5b0f2c(_0x103711[_0x5569('0x16')][_0x5569('0x14')]);}})['catch'](function(_0x1a5714){logger[_0x5569('0x11')](_0x5569('0x13'),_0x160b41,_0x1a5714);_0x352d4d(_0x1a5714);});});}exports['CreatePlugin']=function(_0x22c2ed){var _0x548e99=this;return new Promise(function(_0x34ae7d,_0x4935de){return db[_0x5569('0x17')][_0x5569('0x18')](_0x22c2ed[_0x5569('0x19')],{'raw':_0x22c2ed[_0x5569('0x1a')]?_0x22c2ed[_0x5569('0x1a')][_0x5569('0x1b')]===undefined?!![]:![]:!![]})[_0x5569('0x1c')](function(_0x51150c){logger[_0x5569('0xd')]('CreatePlugin',_0x22c2ed);logger['debug'](_0x5569('0x1d'),_0x22c2ed,JSON[_0x5569('0x10')](_0x51150c));_0x34ae7d(_0x51150c);})['catch'](function(_0x172a68){logger[_0x5569('0x11')](_0x5569('0x1d'),_0x172a68[_0x5569('0x14')],_0x22c2ed);_0x4935de(_0x548e99[_0x5569('0x11')](0x1f4,_0x172a68[_0x5569('0x14')]));});});}; \ No newline at end of file +var _0x627c=['util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','Plugin','create','options','raw','CreatePlugin','lodash'];(function(_0x36d6d5,_0x4d86b9){var _0x2477f3=function(_0x2e777f){while(--_0x2e777f){_0x36d6d5['push'](_0x36d6d5['shift']());}};_0x2477f3(++_0x4d86b9);}(_0x627c,0x1ee));var _0xc627=function(_0x4b0370,_0x821d90){_0x4b0370=_0x4b0370-0x0;var _0x4053be=_0x627c[_0x4b0370];return _0x4053be;};'use strict';var _=require(_0xc627('0x0'));var util=require(_0xc627('0x1'));var moment=require(_0xc627('0x2'));var BPromise=require('bluebird');var rs=require(_0xc627('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc627('0x4'));var logger=require(_0xc627('0x5'))('rpc');var config=require(_0xc627('0x6'));var jayson=require(_0xc627('0x7'));var client=jayson[_0xc627('0x8')][_0xc627('0x9')]({'port':0x232a});config[_0xc627('0xa')]=_[_0xc627('0xb')](config[_0xc627('0xa')],{'host':_0xc627('0xc'),'port':0x18eb});var socket=require(_0xc627('0xd'))(new Redis(config[_0xc627('0xa')]));require(_0xc627('0xe'))[_0xc627('0xf')](socket);function respondWithRpcPromise(_0x1af957,_0x5cacd5,_0x5b555e){return new BPromise(function(_0x34fbe2,_0x1cc2f8){return client[_0xc627('0x10')](_0x1af957,_0x5b555e)[_0xc627('0x11')](function(_0x563bcb){logger[_0xc627('0x12')](_0xc627('0x13'),_0x5cacd5,'request\x20sent');logger[_0xc627('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0x5cacd5,_0xc627('0x15'),JSON[_0xc627('0x16')](_0x563bcb));if(_0x563bcb[_0xc627('0x17')]){if(_0x563bcb[_0xc627('0x17')][_0xc627('0x18')]===0x1f4){logger[_0xc627('0x17')]('Plugin,\x20%s,\x20%s',_0x5cacd5,_0x563bcb[_0xc627('0x17')]['message']);return _0x1cc2f8(_0x563bcb['error']['message']);}logger[_0xc627('0x17')](_0xc627('0x13'),_0x5cacd5,_0x563bcb[_0xc627('0x17')]['message']);return _0x34fbe2(_0x563bcb['error'][_0xc627('0x19')]);}else{logger[_0xc627('0x12')](_0xc627('0x13'),_0x5cacd5,_0xc627('0x15'));_0x34fbe2(_0x563bcb[_0xc627('0x1a')]['message']);}})[_0xc627('0x1b')](function(_0x397df0){logger[_0xc627('0x17')](_0xc627('0x13'),_0x5cacd5,_0x397df0);_0x1cc2f8(_0x397df0);});});}exports['CreatePlugin']=function(_0x3ba461){var _0xbb9b31=this;return new Promise(function(_0x14969d,_0x476a38){return db[_0xc627('0x1c')][_0xc627('0x1d')](_0x3ba461['body'],{'raw':_0x3ba461[_0xc627('0x1e')]?_0x3ba461[_0xc627('0x1e')][_0xc627('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x203ad6){logger[_0xc627('0x12')](_0xc627('0x20'),_0x3ba461);logger[_0xc627('0x14')](_0xc627('0x20'),_0x3ba461,JSON['stringify'](_0x203ad6));_0x14969d(_0x203ad6);})[_0xc627('0x1b')](function(_0x1f0166){logger[_0xc627('0x17')](_0xc627('0x20'),_0x1f0166['message'],_0x3ba461);_0x476a38(_0xbb9b31[_0xc627('0x17')](0x1f4,_0x1f0166['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index dc899f8..0c71d45 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 _0x69e7=['./plugin.events','save','remove','update','emit','removeListener','length','plugin:'];(function(_0x3d4a3b,_0x477f12){var _0x1df021=function(_0x590e70){while(--_0x590e70){_0x3d4a3b['push'](_0x3d4a3b['shift']());}};_0x1df021(++_0x477f12);}(_0x69e7,0x70));var _0x769e=function(_0x291fb0,_0x5e0a20){_0x291fb0=_0x291fb0-0x0;var _0x1aa7fa=_0x69e7[_0x291fb0];return _0x1aa7fa;};'use strict';var PluginEvents=require(_0x769e('0x0'));var events=[_0x769e('0x1'),_0x769e('0x2'),_0x769e('0x3')];function createListener(_0x5096e,_0x571759){return function(_0x35334e){_0x571759[_0x769e('0x4')](_0x5096e,_0x35334e);};}function removeListener(_0x40438b,_0x29ef64){return function(){PluginEvents[_0x769e('0x5')](_0x40438b,_0x29ef64);};}exports['register']=function(_0x621eff){for(var _0x143fff=0x0,_0x3dede5=events[_0x769e('0x6')];_0x143fff<_0x3dede5;_0x143fff++){var _0x4f1566=events[_0x143fff];var _0x5ac36e=createListener(_0x769e('0x7')+_0x4f1566,_0x621eff);PluginEvents['on'](_0x4f1566,_0x5ac36e);}}; \ No newline at end of file +var _0x323a=['save','remove','update','emit','register','plugin:'];(function(_0xae01dd,_0xbd8a3c){var _0x8c26df=function(_0x359827){while(--_0x359827){_0xae01dd['push'](_0xae01dd['shift']());}};_0x8c26df(++_0xbd8a3c);}(_0x323a,0x1b0));var _0xa323=function(_0x3afbdf,_0x9e463b){_0x3afbdf=_0x3afbdf-0x0;var _0x5b6861=_0x323a[_0x3afbdf];return _0x5b6861;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xa323('0x0'),_0xa323('0x1'),_0xa323('0x2')];function createListener(_0x1f3a98,_0x23c259){return function(_0x211f9e){_0x23c259[_0xa323('0x3')](_0x1f3a98,_0x211f9e);};}function removeListener(_0x5b1607,_0x542f45){return function(){PluginEvents['removeListener'](_0x5b1607,_0x542f45);};}exports[_0xa323('0x4')]=function(_0xbad67d){for(var _0x437580=0x0,_0x306124=events['length'];_0x437580<_0x306124;_0x437580++){var _0x1833fd=events[_0x437580];var _0x4a5675=createListener(_0xa323('0x5')+_0x1833fd,_0xbad67d);PluginEvents['on'](_0x1833fd,_0x4a5675);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index d099205..4d274e0 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 _0xb6be=['get','isAuthenticated','index','/:id','show','post','put','update','exports','express','Router','../../components/auth/service'];(function(_0x45e8e4,_0x56c8c1){var _0x4fcfb8=function(_0x26a743){while(--_0x26a743){_0x45e8e4['push'](_0x45e8e4['shift']());}};_0x4fcfb8(++_0x56c8c1);}(_0xb6be,0x1b9));var _0xeb6b=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xb6be[_0x424a9a];return _0xa7831c;};'use strict';var express=require(_0xeb6b('0x0'));var router=express[_0xeb6b('0x1')]();var auth=require(_0xeb6b('0x2'));var controller=require('./pm2.controller');router[_0xeb6b('0x3')]('/',auth[_0xeb6b('0x4')](),controller[_0xeb6b('0x5')]);router[_0xeb6b('0x3')](_0xeb6b('0x6'),auth[_0xeb6b('0x4')](),controller[_0xeb6b('0x7')]);router[_0xeb6b('0x8')]('/',auth[_0xeb6b('0x4')](),controller['create']);router[_0xeb6b('0x9')](_0xeb6b('0x6'),auth['isAuthenticated'](),controller[_0xeb6b('0xa')]);router['delete'](_0xeb6b('0x6'),auth[_0xeb6b('0x4')](),controller['destroy']);module[_0xeb6b('0xb')]=router; \ No newline at end of file +var _0x2c6c=['put','update','delete','exports','express','Router','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0x2c6c,0xee));var _0xc2c6=function(_0x44a058,_0x1df559){_0x44a058=_0x44a058-0x0;var _0xa4ceb1=_0x2c6c[_0x44a058];return _0xa4ceb1;};'use strict';var express=require(_0xc2c6('0x0'));var router=express[_0xc2c6('0x1')]();var auth=require('../../components/auth/service');var controller=require('./pm2.controller');router[_0xc2c6('0x2')]('/',auth[_0xc2c6('0x3')](),controller[_0xc2c6('0x4')]);router[_0xc2c6('0x2')](_0xc2c6('0x5'),auth[_0xc2c6('0x3')](),controller[_0xc2c6('0x6')]);router[_0xc2c6('0x7')]('/',auth[_0xc2c6('0x3')](),controller[_0xc2c6('0x8')]);router[_0xc2c6('0x9')](_0xc2c6('0x5'),auth['isAuthenticated'](),controller[_0xc2c6('0xa')]);router[_0xc2c6('0xb')](_0xc2c6('0x5'),auth[_0xc2c6('0x3')](),controller['destroy']);module[_0xc2c6('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index c3c704a..b4cf32a 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 _0x55c6=['stack','name','send','npm\x20install','info','error','list','reject','express','motion2','length','then','show','describe','params','create','body','script','../../files/plugins','cwd','chdir','start','dump','catch','status','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/logger','api','exec','sendStatus','json'];(function(_0x2c5208,_0x22bb77){var _0x3c981c=function(_0x1c851d){while(--_0x1c851d){_0x2c5208['push'](_0x2c5208['shift']());}};_0x3c981c(++_0x22bb77);}(_0x55c6,0x1e9));var _0x655c=function(_0x5ca5fa,_0x568a46){_0x5ca5fa=_0x5ca5fa-0x0;var _0x3fb794=_0x55c6[_0x5ca5fa];return _0x3fb794;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x655c('0x0'))(_0x655c('0x1'));var path=require('path');var exec=require('child_process')[_0x655c('0x2')];var BPromise=require('bluebird');function handleEntityNotFound(_0x58365a,_0x20b91a){return function(_0x4ef9fe){if(!_0x4ef9fe){_0x58365a[_0x655c('0x3')](0x194);;}return _0x4ef9fe;};}function respondWithResult(_0x5d5332,_0x3af87d){_0x3af87d=_0x3af87d||0xc8;return function(_0x70c660){if(_0x70c660){return _0x5d5332['status'](_0x3af87d)[_0x655c('0x4')](_0x70c660);}return null;};}function handleError(_0x46f70f,_0x304358){_0x304358=_0x304358||0x1f4;return function(_0x86384b){logger['error'](_0x86384b[_0x655c('0x5')]);if(_0x86384b['name']){delete _0x86384b[_0x655c('0x6')];}_0x46f70f['status'](_0x304358)[_0x655c('0x7')](_0x86384b);};}function execChildProcess(){return new BPromise(function(_0x3d684c,_0x39a797){exec(_0x655c('0x8'),function(_0x5f57c3,_0x2925b0,_0x40b38b){logger[_0x655c('0x9')](_0x2925b0);logger['info'](_0x40b38b);if(_0x5f57c3){logger[_0x655c('0xa')](_0x5f57c3);return _0x39a797(_0x5f57c3);}return _0x3d684c(_0x2925b0);});});}exports['index']=function(_0x21e88f,_0x3911f9){return pm2[_0x655c('0xb')]()['then'](function(_0x263ab0){if(_0x263ab0){var _0x3600f=_[_0x655c('0xc')](_0x263ab0,function(_0x2165fd){return _0x2165fd[_0x655c('0x6')]===_0x655c('0xd')||_0x2165fd[_0x655c('0x6')]===_0x655c('0xe');});return{'rows':_0x3600f,'count':_0x3600f[_0x655c('0xf')]};}return null;})[_0x655c('0x10')](respondWithResult(_0x3911f9,null))['catch'](handleError(_0x3911f9,null));};exports[_0x655c('0x11')]=function(_0x17b06e,_0x1bab47){return pm2[_0x655c('0x12')](_0x17b06e[_0x655c('0x13')]['id'])['then'](respondWithResult(_0x1bab47,null))['then'](handleEntityNotFound(_0x1bab47,null))['catch'](handleError(_0x1bab47,null));};exports[_0x655c('0x14')]=function(_0x183109,_0x399a0d){if(_0x183109[_0x655c('0x15')][_0x655c('0x6')]&&_0x183109[_0x655c('0x15')][_0x655c('0x16')]){var _0x1b3d9d=path['join'](__dirname,_0x655c('0x17'),_0x183109[_0x655c('0x15')][_0x655c('0x16')]);var _0x4aa580=process[_0x655c('0x18')]();process[_0x655c('0x19')](path['dirname'](_0x1b3d9d));return execChildProcess()['then'](function(_0x154fe8){process[_0x655c('0x19')](_0x4aa580);return pm2[_0x655c('0x1a')]({'name':_0x183109[_0x655c('0x15')][_0x655c('0x6')],'script':_0x1b3d9d});})[_0x655c('0x10')](function(_0x2b6815){pm2[_0x655c('0x1b')]();return _0x2b6815[0x0];})[_0x655c('0x10')](respondWithResult(_0x399a0d,0xc9))[_0x655c('0x1c')](handleError(_0x399a0d,null));}else{return _0x399a0d[_0x655c('0x1d')](0x1f4)[_0x655c('0x7')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x655c('0x1e')]=function(_0x268d66,_0x4b15cb){if(_0x268d66[_0x655c('0x15')]['id']){delete _0x268d66['body']['id'];}var _0x2ea090={'online':_0x655c('0x1f'),'stopped':_0x655c('0x20')};if(_0x2ea090[_0x655c('0x21')](_0x268d66[_0x655c('0x15')][_0x655c('0x1d')])){return pm2[_0x2ea090[_0x268d66[_0x655c('0x15')][_0x655c('0x1d')]]](_0x268d66[_0x655c('0x13')]['id'])[_0x655c('0x10')](respondWithResult(_0x4b15cb,0xc8))[_0x655c('0x1c')](handleError(_0x4b15cb,null));}else{return _0x4b15cb['status'](0x1f4)[_0x655c('0x7')]({'message':_0x655c('0x22')});}};exports[_0x655c('0x23')]=function(_0x15f99d,_0x4a29e3){if(_0x15f99d[_0x655c('0x15')]['id']){delete _0x15f99d['body']['id'];}if(_0x15f99d[_0x655c('0x13')]['id']){return pm2[_0x655c('0x24')](_0x15f99d[_0x655c('0x13')]['id'])[_0x655c('0x10')](function(_0x2a1a3b){pm2['dump']();return _0x2a1a3b[0x0];})[_0x655c('0x10')](respondWithResult(_0x4a29e3,null))[_0x655c('0x1c')](handleError(_0x4a29e3,null));}else{return _0x4a29e3[_0x655c('0x1d')](0x1f4)['send']({'message':_0x655c('0x25')});}}; \ No newline at end of file +var _0xf402=['update','restart','stop','hasOwnProperty','Unknown\x20status','Unknown\x20id','lodash','../../config/pm2','../../config/logger','child_process','exec','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','list','express','motion2','length','then','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path'];(function(_0xf216b,_0x8f3339){var _0x1c90f8=function(_0x60529d){while(--_0x60529d){_0xf216b['push'](_0xf216b['shift']());}};_0x1c90f8(++_0x8f3339);}(_0xf402,0x1f2));var _0x2f40=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xf402[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x2f40('0x0'));var pm2=require(_0x2f40('0x1'));var logger=require(_0x2f40('0x2'))('api');var path=require('path');var exec=require(_0x2f40('0x3'))[_0x2f40('0x4')];var BPromise=require(_0x2f40('0x5'));function handleEntityNotFound(_0x4fa2d4,_0x4dd887){return function(_0x26155d){if(!_0x26155d){_0x4fa2d4['sendStatus'](0x194);;}return _0x26155d;};}function respondWithResult(_0x23e8fc,_0x36f550){_0x36f550=_0x36f550||0xc8;return function(_0xb1c165){if(_0xb1c165){return _0x23e8fc[_0x2f40('0x6')](_0x36f550)[_0x2f40('0x7')](_0xb1c165);}return null;};}function handleError(_0x3f7fb8,_0x1569f2){_0x1569f2=_0x1569f2||0x1f4;return function(_0x2140ad){logger[_0x2f40('0x8')](_0x2140ad[_0x2f40('0x9')]);if(_0x2140ad[_0x2f40('0xa')]){delete _0x2140ad[_0x2f40('0xa')];}_0x3f7fb8['status'](_0x1569f2)[_0x2f40('0xb')](_0x2140ad);};}function execChildProcess(){return new BPromise(function(_0x542d55,_0x2b9e0a){exec(_0x2f40('0xc'),function(_0x9be606,_0x37929a,_0x2c814b){logger[_0x2f40('0xd')](_0x37929a);logger['info'](_0x2c814b);if(_0x9be606){logger[_0x2f40('0x8')](_0x9be606);return _0x2b9e0a(_0x9be606);}return _0x542d55(_0x37929a);});});}exports[_0x2f40('0xe')]=function(_0x1942a7,_0x37747c){return pm2[_0x2f40('0xf')]()['then'](function(_0x44a191){if(_0x44a191){var _0x3fb683=_['reject'](_0x44a191,function(_0x527a12){return _0x527a12['name']===_0x2f40('0x10')||_0x527a12[_0x2f40('0xa')]===_0x2f40('0x11');});return{'rows':_0x3fb683,'count':_0x3fb683[_0x2f40('0x12')]};}return null;})[_0x2f40('0x13')](respondWithResult(_0x37747c,null))[_0x2f40('0x14')](handleError(_0x37747c,null));};exports[_0x2f40('0x15')]=function(_0x499d13,_0x1c2170){return pm2[_0x2f40('0x16')](_0x499d13[_0x2f40('0x17')]['id'])[_0x2f40('0x13')](respondWithResult(_0x1c2170,null))[_0x2f40('0x13')](handleEntityNotFound(_0x1c2170,null))['catch'](handleError(_0x1c2170,null));};exports[_0x2f40('0x18')]=function(_0x2f9278,_0x41120e){if(_0x2f9278['body'][_0x2f40('0xa')]&&_0x2f9278[_0x2f40('0x19')][_0x2f40('0x1a')]){var _0x56edbf=path[_0x2f40('0x1b')](__dirname,_0x2f40('0x1c'),_0x2f9278['body'][_0x2f40('0x1a')]);var _0x1c3a94=process[_0x2f40('0x1d')]();process[_0x2f40('0x1e')](path[_0x2f40('0x1f')](_0x56edbf));return execChildProcess()['then'](function(_0x803543){process[_0x2f40('0x1e')](_0x1c3a94);return pm2[_0x2f40('0x20')]({'name':_0x2f9278['body'][_0x2f40('0xa')],'script':_0x56edbf});})[_0x2f40('0x13')](function(_0x46d010){pm2[_0x2f40('0x21')]();return _0x46d010[0x0];})[_0x2f40('0x13')](respondWithResult(_0x41120e,0xc9))[_0x2f40('0x14')](handleError(_0x41120e,null));}else{return _0x41120e[_0x2f40('0x6')](0x1f4)[_0x2f40('0xb')]({'message':_0x2f40('0x22')});}};exports[_0x2f40('0x23')]=function(_0x3f0ed4,_0x5bc2f){if(_0x3f0ed4[_0x2f40('0x19')]['id']){delete _0x3f0ed4[_0x2f40('0x19')]['id'];}var _0x580de5={'online':_0x2f40('0x24'),'stopped':_0x2f40('0x25')};if(_0x580de5[_0x2f40('0x26')](_0x3f0ed4[_0x2f40('0x19')][_0x2f40('0x6')])){return pm2[_0x580de5[_0x3f0ed4[_0x2f40('0x19')]['status']]](_0x3f0ed4[_0x2f40('0x17')]['id'])[_0x2f40('0x13')](respondWithResult(_0x5bc2f,0xc8))[_0x2f40('0x14')](handleError(_0x5bc2f,null));}else{return _0x5bc2f[_0x2f40('0x6')](0x1f4)[_0x2f40('0xb')]({'message':_0x2f40('0x27')});}};exports['destroy']=function(_0x2545ee,_0x31b647){if(_0x2545ee[_0x2f40('0x19')]['id']){delete _0x2545ee[_0x2f40('0x19')]['id'];}if(_0x2545ee[_0x2f40('0x17')]['id']){return pm2['delete'](_0x2545ee['params']['id'])[_0x2f40('0x13')](function(_0xfbe558){pm2[_0x2f40('0x21')]();return _0xfbe558[0x0];})['then'](respondWithResult(_0x31b647,null))[_0x2f40('0x14')](handleError(_0x31b647,null));}else{return _0x31b647[_0x2f40('0x6')](0x1f4)[_0x2f40('0xb')]({'message':_0x2f40('0x28')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index c3308bd..ce21220 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 _0x8753=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x2c3bb8,_0x474494){var _0x14b7ad=function(_0x4ae40e){while(--_0x4ae40e){_0x2c3bb8['push'](_0x2c3bb8['shift']());}};_0x14b7ad(++_0x474494);}(_0x8753,0x1d2));var _0x3875=function(_0x5120dd,_0x44ad05){_0x5120dd=_0x5120dd-0x0;var _0x12dd47=_0x8753[_0x5120dd];return _0x12dd47;};'use strict';var multer=require(_0x3875('0x0'));var util=require(_0x3875('0x1'));var path=require(_0x3875('0x2'));var timeout=require(_0x3875('0x3'));var express=require(_0x3875('0x4'));var router=express[_0x3875('0x5')]();var auth=require(_0x3875('0x6'));var interaction=require(_0x3875('0x7'));var config=require(_0x3875('0x8'));module[_0x3875('0x9')]=router; \ No newline at end of file +var _0x223c=['exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x56e1cf,_0x446f2e){var _0x4bf6ba=function(_0x273059){while(--_0x273059){_0x56e1cf['push'](_0x56e1cf['shift']());}};_0x4bf6ba(++_0x446f2e);}(_0x223c,0x1c9));var _0xc223=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x223c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc223('0x0'));var util=require('util');var path=require(_0xc223('0x1'));var timeout=require(_0xc223('0x2'));var express=require(_0xc223('0x3'));var router=express[_0xc223('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc223('0x5'));var config=require(_0xc223('0x6'));module[_0xc223('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index e5c4e03..50f1529 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 _0x6c50=['DATE','sequelize','INTEGER','STRING'];(function(_0x328a64,_0x43fa04){var _0x181e8f=function(_0xa2fce){while(--_0xa2fce){_0x328a64['push'](_0x328a64['shift']());}};_0x181e8f(++_0x43fa04);}(_0x6c50,0x18d));var _0x06c5=function(_0x247011,_0x39a2ab){_0x247011=_0x247011-0x0;var _0x30a3f1=_0x6c50[_0x247011];return _0x30a3f1;};'use strict';var Sequelize=require(_0x06c5('0x0'));module['exports']={'state':{'type':Sequelize[_0x06c5('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x06c5('0x2')]},'scheduledat':{'type':Sequelize[_0x06c5('0x3')]},'uniqueid':{'type':Sequelize[_0x06c5('0x2')]},'starttime':{'type':Sequelize[_0x06c5('0x3')]},'responsetime':{'type':Sequelize[_0x06c5('0x3')]},'ringtime':{'type':Sequelize[_0x06c5('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x06c5('0x2')]},'campaigntype':{'type':Sequelize[_0x06c5('0x2')]},'membername':{'type':Sequelize[_0x06c5('0x2')]}}; \ No newline at end of file +var _0x2b86=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x49d65a,_0x5aaecc){var _0x233dc7=function(_0xcf5e3a){while(--_0xcf5e3a){_0x49d65a['push'](_0x49d65a['shift']());}};_0x233dc7(++_0x5aaecc);}(_0x2b86,0x6b));var _0x62b8=function(_0x53380e,_0x238374){_0x53380e=_0x53380e-0x0;var _0x86ae7b=_0x2b86[_0x53380e];return _0x86ae7b;};'use strict';var Sequelize=require(_0x62b8('0x0'));module[_0x62b8('0x1')]={'state':{'type':Sequelize[_0x62b8('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x62b8('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x62b8('0x3')]},'starttime':{'type':Sequelize[_0x62b8('0x4')]},'responsetime':{'type':Sequelize[_0x62b8('0x4')]},'ringtime':{'type':Sequelize[_0x62b8('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x62b8('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 07d94ca..4e72519 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 _0xa380=['rimraf','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x171713,_0x564d77){var _0x1a1f50=function(_0x4223b1){while(--_0x4223b1){_0x171713['push'](_0x171713['shift']());}};_0x1a1f50(++_0x564d77);}(_0xa380,0x101));var _0x0a38=function(_0x323476,_0x11c014){_0x323476=_0x323476-0x0;var _0x20d648=_0xa380[_0x323476];return _0x20d648;};'use strict';var _=require(_0x0a38('0x0'));var util=require(_0x0a38('0x1'));var logger=require('../../config/logger')(_0x0a38('0x2'));var moment=require(_0x0a38('0x3'));var BPromise=require(_0x0a38('0x4'));var rp=require(_0x0a38('0x5'));var fs=require('fs');var path=require(_0x0a38('0x6'));var rimraf=require(_0x0a38('0x7'));var config=require('../../config/environment');var attributes=require(_0x0a38('0x8'));module['exports']=function(_0x1b5658,_0x33733c){return _0x1b5658[_0x0a38('0x9')](_0x0a38('0xa'),attributes,{'tableName':_0x0a38('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36ef=['path','lodash','util','../../config/logger','api','bluebird'];(function(_0x267ec5,_0x146314){var _0xebda23=function(_0x31344c){while(--_0x31344c){_0x267ec5['push'](_0x267ec5['shift']());}};_0xebda23(++_0x146314);}(_0x36ef,0x139));var _0xf36e=function(_0x1e9d72,_0x39db51){_0x1e9d72=_0x1e9d72-0x0;var _0x19fab1=_0x36ef[_0x1e9d72];return _0x19fab1;};'use strict';var _=require(_0xf36e('0x0'));var util=require(_0xf36e('0x1'));var logger=require(_0xf36e('0x2'))(_0xf36e('0x3'));var moment=require('moment');var BPromise=require(_0xf36e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf36e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x3898ab,_0x20d956){return _0x3898ab['define']('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 349c352..17c08cd 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 _0x615b=['options','CreateReportAgentPreview','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','ReportAgentPreview,\x20%s,\x20%s','message','request\x20sent','result','body'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0x615b,0x9a));var _0xb615=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0x615b[_0x6ca7f4];return _0x494fa6;};'use strict';var _=require(_0xb615('0x0'));var util=require(_0xb615('0x1'));var moment=require(_0xb615('0x2'));var BPromise=require(_0xb615('0x3'));var rs=require(_0xb615('0x4'));var fs=require('fs');var Redis=require(_0xb615('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb615('0x6'));var logger=require(_0xb615('0x7'))('rpc');var config=require(_0xb615('0x8'));var jayson=require(_0xb615('0x9'));var client=jayson[_0xb615('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11711c,_0x192840,_0x2d6226){return new BPromise(function(_0x4e5545,_0x2312e0){return client['request'](_0x11711c,_0x2d6226)['then'](function(_0x4a90f8){logger[_0xb615('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x192840,'request\x20sent');logger[_0xb615('0xc')](_0xb615('0xd'),_0x192840,'request\x20sent',JSON['stringify'](_0x4a90f8));if(_0x4a90f8['error']){if(_0x4a90f8[_0xb615('0xe')][_0xb615('0xf')]===0x1f4){logger[_0xb615('0xe')](_0xb615('0x10'),_0x192840,_0x4a90f8[_0xb615('0xe')]['message']);return _0x2312e0(_0x4a90f8[_0xb615('0xe')][_0xb615('0x11')]);}logger['error'](_0xb615('0x10'),_0x192840,_0x4a90f8['error'][_0xb615('0x11')]);return _0x4e5545(_0x4a90f8[_0xb615('0xe')][_0xb615('0x11')]);}else{logger[_0xb615('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x192840,_0xb615('0x12'));_0x4e5545(_0x4a90f8[_0xb615('0x13')][_0xb615('0x11')]);}})['catch'](function(_0x1b280c){logger['error'](_0xb615('0x10'),_0x192840,_0x1b280c);_0x2312e0(_0x1b280c);});});}exports['CreateReportAgentPreview']=function(_0x98589a){var _0x4eb56f=this;return new Promise(function(_0x4e8c9f,_0x180814){return db['ReportAgentPreview']['create'](_0x98589a[_0xb615('0x14')],{'raw':_0x98589a[_0xb615('0x15')]?_0x98589a[_0xb615('0x15')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xd4ea1f){logger[_0xb615('0xb')](_0xb615('0x16'),_0x98589a);logger[_0xb615('0xc')]('CreateReportAgentPreview',_0x98589a,JSON[_0xb615('0x17')](_0xd4ea1f));_0x4e8c9f(_0xd4ea1f);})[_0xb615('0x18')](function(_0x102d88){logger[_0xb615('0xe')](_0xb615('0x16'),_0x102d88['message'],_0x98589a);_0x180814(_0x4eb56f['error'](0x1f4,_0x102d88[_0xb615('0x11')]));});});}; \ No newline at end of file +var _0x60a8=['CreateReportAgentPreview','create','body','options','raw','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x886288,_0x819e74){var _0xf8013a=function(_0x5bf19d){while(--_0x5bf19d){_0x886288['push'](_0x886288['shift']());}};_0xf8013a(++_0x819e74);}(_0x60a8,0x12e));var _0x860a=function(_0x56987f,_0x4e947a){_0x56987f=_0x56987f-0x0;var _0x406143=_0x60a8[_0x56987f];return _0x406143;};'use strict';var _=require(_0x860a('0x0'));var util=require('util');var moment=require(_0x860a('0x1'));var BPromise=require('bluebird');var rs=require(_0x860a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x860a('0x3'))['db'];var utils=require(_0x860a('0x4'));var logger=require(_0x860a('0x5'))(_0x860a('0x6'));var config=require('../../config/environment');var jayson=require(_0x860a('0x7'));var client=jayson['client'][_0x860a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42e48d,_0x453b22,_0x16a151){return new BPromise(function(_0x1c8a16,_0x507667){return client[_0x860a('0x9')](_0x42e48d,_0x16a151)[_0x860a('0xa')](function(_0x35b40d){logger['info'](_0x860a('0xb'),_0x453b22,'request\x20sent');logger[_0x860a('0xc')](_0x860a('0xd'),_0x453b22,_0x860a('0xe'),JSON[_0x860a('0xf')](_0x35b40d));if(_0x35b40d[_0x860a('0x10')]){if(_0x35b40d['error'][_0x860a('0x11')]===0x1f4){logger[_0x860a('0x10')](_0x860a('0xb'),_0x453b22,_0x35b40d[_0x860a('0x10')][_0x860a('0x12')]);return _0x507667(_0x35b40d[_0x860a('0x10')][_0x860a('0x12')]);}logger['error'](_0x860a('0xb'),_0x453b22,_0x35b40d['error'][_0x860a('0x12')]);return _0x1c8a16(_0x35b40d[_0x860a('0x10')]['message']);}else{logger[_0x860a('0x13')](_0x860a('0xb'),_0x453b22,_0x860a('0xe'));_0x1c8a16(_0x35b40d[_0x860a('0x14')]['message']);}})[_0x860a('0x15')](function(_0xe52446){logger[_0x860a('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x453b22,_0xe52446);_0x507667(_0xe52446);});});}exports[_0x860a('0x16')]=function(_0x4bbf26){var _0x4cd705=this;return new Promise(function(_0x31184c,_0x41021a){return db['ReportAgentPreview'][_0x860a('0x17')](_0x4bbf26[_0x860a('0x18')],{'raw':_0x4bbf26[_0x860a('0x19')]?_0x4bbf26[_0x860a('0x19')][_0x860a('0x1a')]===undefined?!![]:![]:!![]})[_0x860a('0xa')](function(_0x5b2aaa){logger[_0x860a('0x13')]('CreateReportAgentPreview',_0x4bbf26);logger[_0x860a('0xc')](_0x860a('0x16'),_0x4bbf26,JSON[_0x860a('0xf')](_0x5b2aaa));_0x31184c(_0x5b2aaa);})[_0x860a('0x15')](function(_0x5e77af){logger['error'](_0x860a('0x16'),_0x5e77af[_0x860a('0x12')],_0x4bbf26);_0x41021a(_0x4cd705['error'](0x1f4,_0x5e77af[_0x860a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 48f5d96..01eb4fb 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 _0xb63d=['voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','/agents','agents','put','agentCapacity','trunks','campaigns','/fax/accounts','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','post','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','agentNotify','exports','multer','path','express','Router','../../components/auth/service','./rpc.controller','isAuthenticated','get','/voice/channels/:uniqueid/mixmonitor'];(function(_0x1595b3,_0x58a1b4){var _0x3d20dd=function(_0x263cb3){while(--_0x263cb3){_0x1595b3['push'](_0x1595b3['shift']());}};_0x3d20dd(++_0x58a1b4);}(_0xb63d,0x83));var _0xdb63=function(_0x2df8fb,_0x4301a3){_0x2df8fb=_0x2df8fb-0x0;var _0x31380a=_0xb63d[_0x2df8fb];return _0x31380a;};'use strict';var multer=require(_0xdb63('0x0'));var util=require('util');var path=require(_0xdb63('0x1'));var express=require(_0xdb63('0x2'));var router=express[_0xdb63('0x3')]();var auth=require(_0xdb63('0x4'));var controller=require(_0xdb63('0x5'));router['get']('/voice/channels',auth[_0xdb63('0x6')](),controller['voiceChannels']);router[_0xdb63('0x7')](_0xdb63('0x8'),auth[_0xdb63('0x6')](),controller[_0xdb63('0x9')]);router[_0xdb63('0x7')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xdb63('0x6')](),controller[_0xdb63('0xa')]);router[_0xdb63('0x7')](_0xdb63('0xb'),auth['isAuthenticated'](),controller[_0xdb63('0xc')]);router[_0xdb63('0x7')](_0xdb63('0xd'),auth[_0xdb63('0x6')](),controller[_0xdb63('0xe')]);router[_0xdb63('0x7')](_0xdb63('0xf'),auth['isAuthenticated'](),controller['mailQueues']);router[_0xdb63('0x7')](_0xdb63('0x10'),auth[_0xdb63('0x6')](),controller[_0xdb63('0x11')]);router['get'](_0xdb63('0x12'),auth['isAuthenticated'](),controller['openchannelQueues']);router['get'](_0xdb63('0x13'),auth[_0xdb63('0x6')](),controller[_0xdb63('0x14')]);router[_0xdb63('0x7')](_0xdb63('0x15'),auth[_0xdb63('0x6')](),controller[_0xdb63('0x16')]);router[_0xdb63('0x7')](_0xdb63('0x17'),auth[_0xdb63('0x6')](),controller['voiceQueuesPreview']);router[_0xdb63('0x7')](_0xdb63('0x18'),auth[_0xdb63('0x6')](),controller[_0xdb63('0x19')]);router['get']('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0xdb63('0x1a')]);router[_0xdb63('0x7')](_0xdb63('0x1b'),auth[_0xdb63('0x6')](),controller['voiceQueuesChannelHangup']);router[_0xdb63('0x7')](_0xdb63('0x1c'),auth['isAuthenticated'](),controller[_0xdb63('0x1d')]);router[_0xdb63('0x7')](_0xdb63('0x1e'),auth['isAuthenticated'](),controller[_0xdb63('0x1f')]);router[_0xdb63('0x7')](_0xdb63('0x20'),auth[_0xdb63('0x6')](),controller[_0xdb63('0x21')]);router[_0xdb63('0x7')](_0xdb63('0x22'),auth[_0xdb63('0x6')](),controller['outboundChannels']);router[_0xdb63('0x7')](_0xdb63('0x23'),auth[_0xdb63('0x6')](),controller[_0xdb63('0x24')]);router[_0xdb63('0x25')]('/agents/:id/capacity',auth[_0xdb63('0x6')](),controller[_0xdb63('0x26')]);router[_0xdb63('0x7')]('/telephones',auth[_0xdb63('0x6')](),controller['telephones']);router['get']('/trunks',auth[_0xdb63('0x6')](),controller[_0xdb63('0x27')]);router['get']('/campaigns',auth[_0xdb63('0x6')](),controller[_0xdb63('0x28')]);router['get'](_0xdb63('0x29'),auth[_0xdb63('0x6')](),controller['faxAccounts']);router[_0xdb63('0x7')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0xdb63('0x7')](_0xdb63('0x2a'),auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0xdb63('0x7')](_0xdb63('0x2b'),auth['isAuthenticated'](),controller[_0xdb63('0x2c')]);router['get'](_0xdb63('0x2d'),auth[_0xdb63('0x6')](),controller[_0xdb63('0x2e')]);router['get'](_0xdb63('0x2f'),auth[_0xdb63('0x6')](),controller[_0xdb63('0x30')]);router['post'](_0xdb63('0x31'),auth[_0xdb63('0x6')](),controller[_0xdb63('0x32')](_0xdb63('0x33')));router['get'](_0xdb63('0x34'),auth['isAuthenticated'](),controller[_0xdb63('0x35')]);router['post'](_0xdb63('0x36'),auth['isAuthenticated'](),controller['queueNotify'](_0xdb63('0x37')));router[_0xdb63('0x7')](_0xdb63('0x38'),auth['isAuthenticated'](),controller[_0xdb63('0x39')]);router[_0xdb63('0x3a')]('/fax/queues/:id/notify',auth[_0xdb63('0x6')](),controller[_0xdb63('0x32')](_0xdb63('0x3b')));router[_0xdb63('0x7')](_0xdb63('0x3c'),auth[_0xdb63('0x6')](),controller[_0xdb63('0x3d')]);router['post']('/openchannel/queues/:id/notify',auth[_0xdb63('0x6')](),controller[_0xdb63('0x32')]('openchannel'));router['get'](_0xdb63('0x3e'),auth[_0xdb63('0x6')](),controller[_0xdb63('0x3f')]);router['post'](_0xdb63('0x40'),auth[_0xdb63('0x6')](),controller[_0xdb63('0x32')](_0xdb63('0x41')));router[_0xdb63('0x7')](_0xdb63('0x42'),auth[_0xdb63('0x6')](),controller[_0xdb63('0x43')]);router['post']('/agents/:id/notify',auth[_0xdb63('0x6')](),controller[_0xdb63('0x44')]);module[_0xdb63('0x45')]=router; \ No newline at end of file +var _0xd48e=['fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/sms/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones','trunks','campaigns','/fax/accounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xd48e,0x93));var _0xed48=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xd48e[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require('multer');var util=require(_0xed48('0x0'));var path=require(_0xed48('0x1'));var express=require(_0xed48('0x2'));var router=express[_0xed48('0x3')]();var auth=require(_0xed48('0x4'));var controller=require('./rpc.controller');router[_0xed48('0x5')](_0xed48('0x6'),auth[_0xed48('0x7')](),controller['voiceChannels']);router[_0xed48('0x5')](_0xed48('0x8'),auth[_0xed48('0x7')](),controller['voiceChannelMixMonitor']);router[_0xed48('0x5')](_0xed48('0x9'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router['get'](_0xed48('0xa'),auth[_0xed48('0x7')](),controller[_0xed48('0xb')]);router['get']('/chat/queues',auth[_0xed48('0x7')](),controller[_0xed48('0xc')]);router[_0xed48('0x5')]('/mail/queues',auth[_0xed48('0x7')](),controller[_0xed48('0xd')]);router[_0xed48('0x5')](_0xed48('0xe'),auth[_0xed48('0x7')](),controller[_0xed48('0xf')]);router[_0xed48('0x5')](_0xed48('0x10'),auth[_0xed48('0x7')](),controller[_0xed48('0x11')]);router[_0xed48('0x5')](_0xed48('0x12'),auth[_0xed48('0x7')](),controller['smsQueues']);router[_0xed48('0x5')]('/fax/queues',auth[_0xed48('0x7')](),controller['faxQueues']);router['get'](_0xed48('0x13'),auth[_0xed48('0x7')](),controller[_0xed48('0x14')]);router[_0xed48('0x5')](_0xed48('0x15'),auth['isAuthenticated'](),controller[_0xed48('0x16')]);router['get'](_0xed48('0x17'),auth['isAuthenticated'](),controller[_0xed48('0x18')]);router[_0xed48('0x5')](_0xed48('0x19'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0xed48('0x5')](_0xed48('0x1a'),auth[_0xed48('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0xed48('0x5')](_0xed48('0x1b'),auth[_0xed48('0x7')](),controller['showVoiceQueues']);router[_0xed48('0x5')](_0xed48('0x1c'),auth[_0xed48('0x7')](),controller[_0xed48('0x1d')]);router[_0xed48('0x5')](_0xed48('0x1e'),auth['isAuthenticated'](),controller[_0xed48('0x1f')]);router['get'](_0xed48('0x20'),auth[_0xed48('0x7')](),controller[_0xed48('0x21')]);router['put']('/agents/:id/capacity',auth[_0xed48('0x7')](),controller[_0xed48('0x22')]);router[_0xed48('0x5')](_0xed48('0x23'),auth[_0xed48('0x7')](),controller[_0xed48('0x24')]);router[_0xed48('0x5')]('/trunks',auth[_0xed48('0x7')](),controller[_0xed48('0x25')]);router[_0xed48('0x5')]('/campaigns',auth[_0xed48('0x7')](),controller[_0xed48('0x26')]);router['get'](_0xed48('0x27'),auth['isAuthenticated'](),controller['faxAccounts']);router[_0xed48('0x5')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xed48('0x28')]);router[_0xed48('0x5')](_0xed48('0x29'),auth['isAuthenticated'](),controller[_0xed48('0x2a')]);router[_0xed48('0x5')](_0xed48('0x2b'),auth[_0xed48('0x7')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0xed48('0x2c'),auth['isAuthenticated'](),controller[_0xed48('0x2d')]);router[_0xed48('0x5')](_0xed48('0x2e'),auth[_0xed48('0x7')](),controller['faxQueuesWaitingInteractions']);router['post'](_0xed48('0x2f'),auth[_0xed48('0x7')](),controller[_0xed48('0x30')](_0xed48('0x31')));router[_0xed48('0x5')](_0xed48('0x32'),auth[_0xed48('0x7')](),controller[_0xed48('0x33')]);router[_0xed48('0x34')](_0xed48('0x35'),auth[_0xed48('0x7')](),controller[_0xed48('0x30')]('chat'));router[_0xed48('0x5')](_0xed48('0x36'),auth[_0xed48('0x7')](),controller[_0xed48('0x37')]);router[_0xed48('0x34')](_0xed48('0x38'),auth[_0xed48('0x7')](),controller[_0xed48('0x30')](_0xed48('0x39')));router[_0xed48('0x5')]('/fax/queues/:id',auth[_0xed48('0x7')](),controller[_0xed48('0x3a')]);router[_0xed48('0x34')](_0xed48('0x3b'),auth['isAuthenticated'](),controller[_0xed48('0x30')](_0xed48('0x3c')));router['get'](_0xed48('0x3d'),auth[_0xed48('0x7')](),controller[_0xed48('0x3e')]);router['post']('/sms/queues/:id/notify',auth[_0xed48('0x7')](),controller['queueNotify'](_0xed48('0x3f')));router[_0xed48('0x5')](_0xed48('0x40'),auth[_0xed48('0x7')](),controller[_0xed48('0x41')]);router[_0xed48('0x34')](_0xed48('0x42'),auth[_0xed48('0x7')](),controller[_0xed48('0x43')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index eea20fa..b9d9942 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 _0x67a7=['showSmsQueues','SmsQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','QueueId','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','chat','User','Agent\x20not\x20found','From','TransferReport','create','agentTransferTimeout','moment','util','../../config/logger','jayson/promise','client','http','request','then','error','message','result','status','json','stack','name','send','isNil','rows','find','VoiceChannels','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','query','voiceQueues','VoiceQueues','catch','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues'];(function(_0x275951,_0x24de53){var _0x24f26e=function(_0x1b093c){while(--_0x1b093c){_0x275951['push'](_0x275951['shift']());}};_0x24f26e(++_0x24de53);}(_0x67a7,0x174));var _0x767a=function(_0x5ed039,_0x113272){_0x5ed039=_0x5ed039-0x0;var _0x225404=_0x67a7[_0x5ed039];return _0x225404;};'use strict';var BPromise=require('bluebird');var moment=require(_0x767a('0x0'));var _=require('lodash');var util=require(_0x767a('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x767a('0x2'))('api');var jayson=require(_0x767a('0x3'));var amiClient=jayson[_0x767a('0x4')][_0x767a('0x5')]({'port':0x232a});var mailClient=jayson[_0x767a('0x4')][_0x767a('0x5')]({'port':0x232b});var routingClient=jayson['client'][_0x767a('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x34aea2,_0x2cebd9,_0x2f365b){return new BPromise(function(_0x1bd4af,_0x87e8a1){var _0x24566a=_0x2f365b?_0x2f365b:amiClient;return _0x24566a[_0x767a('0x6')](_0x34aea2,_0x2cebd9)[_0x767a('0x7')](function(_0x1391ee){if(_0x1391ee[_0x767a('0x8')]){if(_0x1391ee[_0x767a('0x8')]['code']===0x1f4){return _0x87e8a1(_0x1391ee['error'][_0x767a('0x9')]);}return _0x1bd4af(_0x1391ee[_0x767a('0x8')]['message']);}else{_0x1bd4af(_0x1391ee[_0x767a('0xa')]);}})['catch'](function(_0x27cca9){_0x87e8a1(_0x27cca9);});});}function respondWithResult(_0x3aa69f,_0x4eaa06){_0x4eaa06=_0x4eaa06||0xc8;return function(_0x52ab8c){if(_0x52ab8c){return _0x3aa69f[_0x767a('0xb')](_0x4eaa06)[_0x767a('0xc')](_0x52ab8c);}return _0x3aa69f['sendStatus'](0x194);};}function handleError(_0x312ad5,_0x1e7f49){_0x1e7f49=_0x1e7f49||0x1f4;return function(_0x5b9237){logger[_0x767a('0x8')](_0x5b9237[_0x767a('0xd')]);if(_0x5b9237[_0x767a('0xe')]){delete _0x5b9237[_0x767a('0xe')];}_0x312ad5['status'](_0x1e7f49)[_0x767a('0xf')](_0x5b9237);};}function findById(_0x43c9e6){return function(_0x57d317){if(!_[_0x767a('0x10')](_0x43c9e6)&&!_[_0x767a('0x10')](_0x57d317)&&!_[_0x767a('0x10')](_0x57d317[_0x767a('0x11')])){return _[_0x767a('0x12')](_0x57d317[_0x767a('0x11')],function(_0x2ebfd3){return _0x2ebfd3['id']==_0x43c9e6;});}return null;};}exports['voiceChannels']=function(_0x56e990,_0x4052fa){return respondWithRpcPromise(_0x767a('0x13'),_0x56e990['query'])[_0x767a('0x7')](respondWithResult(_0x4052fa,null))['catch'](handleError(_0x4052fa,null));};exports['voiceChannelMixMonitor']=function(_0x2140aa,_0x560788){return respondWithRpcPromise(_0x767a('0x14'),_[_0x767a('0x15')](_0x2140aa['query'],_0x2140aa[_0x767a('0x16')]))[_0x767a('0x7')](respondWithResult(_0x560788,null))['catch'](handleError(_0x560788,null));};exports[_0x767a('0x17')]=function(_0x5871e5,_0x1edf2e){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x767a('0x15')](_0x5871e5[_0x767a('0x18')],_0x5871e5[_0x767a('0x16')]))[_0x767a('0x7')](respondWithResult(_0x1edf2e,null))['catch'](handleError(_0x1edf2e,null));};exports[_0x767a('0x19')]=function(_0x23ff53,_0x16d6cc){return respondWithRpcPromise(_0x767a('0x1a'),_0x23ff53[_0x767a('0x18')])[_0x767a('0x7')](respondWithResult(_0x16d6cc,null))['catch'](handleError(_0x16d6cc,null));};exports['showVoiceQueues']=function(_0x5382a0,_0x4faffb){return respondWithRpcPromise(_0x767a('0x1a'),_0x5382a0['query'])[_0x767a('0x7')](findById(_0x5382a0['params']['id']))[_0x767a('0x7')](respondWithResult(_0x4faffb,null))[_0x767a('0x1b')](handleError(_0x4faffb,null));};exports[_0x767a('0x1c')]=function(_0x5c8b5f,_0x1e0ccb){return respondWithRpcPromise(_0x767a('0x1d'),_[_0x767a('0x15')](_0x5c8b5f['query'],_0x5c8b5f[_0x767a('0x16')]))[_0x767a('0x7')](respondWithResult(_0x1e0ccb,null))[_0x767a('0x1b')](handleError(_0x1e0ccb,null));};exports[_0x767a('0x1e')]=function(_0x24478c,_0x15e81f){return respondWithRpcPromise(_0x767a('0x1f'),_0x24478c[_0x767a('0x18')])[_0x767a('0x7')](respondWithResult(_0x15e81f,null))['catch'](handleError(_0x15e81f,null));};exports['voiceQueuesChannel']=function(_0x59b5c4,_0x1b2fb4){return respondWithRpcPromise(_0x767a('0x20'),_[_0x767a('0x15')](_0x59b5c4[_0x767a('0x18')],_0x59b5c4[_0x767a('0x16')]))[_0x767a('0x7')](respondWithResult(_0x1b2fb4,null))[_0x767a('0x1b')](handleError(_0x1b2fb4,null));};exports['voiceQueuesChannelHangup']=function(_0x5dbf5f,_0x22ecfe){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x5dbf5f['query'],_0x5dbf5f['params']))[_0x767a('0x7')](respondWithResult(_0x22ecfe,null))[_0x767a('0x1b')](handleError(_0x22ecfe,null));};exports['voiceQueuesChannelRedirect']=function(_0x4b09c0,_0x315e2e){return respondWithRpcPromise(_0x767a('0x21'),_[_0x767a('0x15')](_0x4b09c0[_0x767a('0x18')],_0x4b09c0[_0x767a('0x16')]))[_0x767a('0x7')](respondWithResult(_0x315e2e,null))[_0x767a('0x1b')](handleError(_0x315e2e,null));};exports['outbound']=function(_0x51f8df,_0xcc0032){return respondWithRpcPromise(_0x767a('0x22'),_0x51f8df[_0x767a('0x18')])[_0x767a('0x7')](respondWithResult(_0xcc0032,null))[_0x767a('0x1b')](handleError(_0xcc0032,null));};exports[_0x767a('0x23')]=function(_0x465fa0,_0x1c409c){return respondWithRpcPromise(_0x767a('0x24'),_0x465fa0[_0x767a('0x18')])['then'](respondWithResult(_0x1c409c,null))['catch'](handleError(_0x1c409c,null));};exports['agents']=function(_0x5ea116,_0x4e0530){var _0x586061;return respondWithRpcPromise(_0x767a('0x25'),_0x5ea116['query'])[_0x767a('0x7')](function(_0x58c818){_0x586061=_0x58c818;return respondWithRpcPromise('Agents',_0x5ea116['query'],routingClient);})[_0x767a('0x7')](function(_0x116b3e){return _[_0x767a('0x15')]({},_0x116b3e,_0x586061);})['then'](respondWithResult(_0x4e0530,null))[_0x767a('0x1b')](handleError(_0x4e0530,null));};exports[_0x767a('0x26')]=function(_0x3aca9b,_0x1b006c){if(_0x3aca9b[_0x767a('0x27')]&&_0x3aca9b[_0x767a('0x27')][_0x767a('0x28')]&&_0x3aca9b['user']&&_0x3aca9b[_0x767a('0x29')][_0x767a('0xe')]){for(var _0x523a45 in _0x3aca9b['body'][_0x767a('0x28')]){if(_0x3aca9b[_0x767a('0x27')][_0x767a('0x28')][_0x767a('0x2a')](_0x523a45)){db['MemberReport'][_0x767a('0x2b')]({'where':{'channel':_0x523a45,'membername':_0x3aca9b[_0x767a('0x29')]['name'],'type':_0x767a('0x2c'),'exitAt':null,'uniqueid':_0x3aca9b['body'][_0x767a('0x28')][_0x523a45]&&_0x3aca9b[_0x767a('0x27')][_0x767a('0x28')][_0x523a45][_0x767a('0x2d')]?{'$notIn':_0x3aca9b[_0x767a('0x27')][_0x767a('0x28')][_0x523a45]}:{'$ne':null}}})[_0x767a('0x7')](function(_0x251167){var _0xa6cb57=moment()[_0x767a('0x2e')](_0x767a('0x2f'));for(var _0x2419e8=0x0,_0x283a86=_0x251167[_0x767a('0x2d')];_0x2419e8<_0x283a86;_0x2419e8+=0x1){_0x251167[_0x2419e8][_0x767a('0x30')]({'exitAt':_0xa6cb57});}});for(var _0x56bedf=0x0;_0x56bedf<_0x3aca9b['body'][_0x767a('0x28')][_0x523a45]['length'];_0x56bedf+=0x1){db[_0x767a('0x31')]['findOrCreate']({'where':{'channel':_0x523a45,'membername':_0x3aca9b[_0x767a('0x29')][_0x767a('0xe')],'type':_0x767a('0x2c'),'uniqueid':_0x3aca9b[_0x767a('0x27')][_0x767a('0x28')][_0x523a45][_0x56bedf],'exitAt':null},'defaults':{'channel':_0x523a45,'membername':_0x3aca9b['user'][_0x767a('0xe')],'interface':_['isNil'](_0x3aca9b[_0x767a('0x29')]['interface'])?util[_0x767a('0x2e')]('SIP/%s',_0x3aca9b[_0x767a('0x29')][_0x767a('0xe')]):_0x3aca9b['user'][_0x767a('0x32')],'type':_0x767a('0x2c'),'enterAt':moment()[_0x767a('0x2e')](_0x767a('0x2f')),'role':_0x767a('0x33'),'internal':_0x3aca9b[_0x767a('0x29')][_0x767a('0x34')],'uniqueid':_0x3aca9b[_0x767a('0x27')][_0x767a('0x28')][_0x523a45][_0x56bedf]}});}}}}return respondWithRpcPromise(_0x767a('0x35'),{'id':_0x3aca9b[_0x767a('0x16')]['id'],'capacity':_0x3aca9b[_0x767a('0x27')][_0x767a('0x36')]},routingClient)[_0x767a('0x7')](respondWithResult(_0x1b006c,null))['catch'](handleError(_0x1b006c,null));};exports[_0x767a('0x37')]=function(_0x2b936b,_0x1f8df5){return respondWithRpcPromise(_0x767a('0x38'),_0x2b936b[_0x767a('0x18')])[_0x767a('0x7')](respondWithResult(_0x1f8df5,null))['catch'](handleError(_0x1f8df5,null));};exports[_0x767a('0x39')]=function(_0x449e84,_0x3c482c){return respondWithRpcPromise('Trunks',_0x449e84[_0x767a('0x18')])[_0x767a('0x7')](respondWithResult(_0x3c482c,null))[_0x767a('0x1b')](handleError(_0x3c482c,null));};exports[_0x767a('0x3a')]=function(_0x1c598b,_0x3f6c00){return respondWithRpcPromise(_0x767a('0x3b'),_0x1c598b[_0x767a('0x18')])[_0x767a('0x7')](respondWithResult(_0x3f6c00,null))['catch'](handleError(_0x3f6c00,null));};exports[_0x767a('0x3c')]=function(_0x46fe44,_0x2a1a3f){return respondWithRpcPromise(_0x767a('0x3d'),_0x46fe44[_0x767a('0x18')],routingClient)[_0x767a('0x7')](respondWithResult(_0x2a1a3f,null))['catch'](handleError(_0x2a1a3f,null));};exports['showChatQueues']=function(_0x34252b,_0x123d9e){return respondWithRpcPromise(_0x767a('0x3d'),_0x34252b[_0x767a('0x18')],routingClient)[_0x767a('0x7')](findById(_0x34252b[_0x767a('0x16')]['id']))['then'](respondWithResult(_0x123d9e,null))['catch'](handleError(_0x123d9e,null));};exports['mailQueues']=function(_0x100324,_0x3c6397){return respondWithRpcPromise(_0x767a('0x3e'),_0x100324[_0x767a('0x18')],routingClient)['then'](respondWithResult(_0x3c6397,null))[_0x767a('0x1b')](handleError(_0x3c6397,null));};exports[_0x767a('0x3f')]=function(_0x5bb98f,_0x4435dd){return respondWithRpcPromise('MailQueues',_0x5bb98f[_0x767a('0x18')],routingClient)[_0x767a('0x7')](findById(_0x5bb98f[_0x767a('0x16')]['id']))['then'](respondWithResult(_0x4435dd,null))['catch'](handleError(_0x4435dd,null));};exports[_0x767a('0x40')]=function(_0x469124,_0x371238){return respondWithRpcPromise(_0x767a('0x41'),_0x469124[_0x767a('0x18')],mailClient)['then'](respondWithResult(_0x371238,null))['catch'](handleError(_0x371238,null));};exports['openchannelQueues']=function(_0x9fb758,_0x2fd5b0){return respondWithRpcPromise(_0x767a('0x42'),_0x9fb758['query'],routingClient)[_0x767a('0x7')](respondWithResult(_0x2fd5b0,null))[_0x767a('0x1b')](handleError(_0x2fd5b0,null));};exports[_0x767a('0x43')]=function(_0x26ea13,_0x31fd18){return respondWithRpcPromise(_0x767a('0x42'),_0x26ea13[_0x767a('0x18')],routingClient)[_0x767a('0x7')](findById(_0x26ea13['params']['id']))[_0x767a('0x7')](respondWithResult(_0x31fd18,null))[_0x767a('0x1b')](handleError(_0x31fd18,null));};exports['smsQueues']=function(_0x5db5f8,_0x204619){return respondWithRpcPromise('SmsQueues',_0x5db5f8[_0x767a('0x18')],routingClient)[_0x767a('0x7')](respondWithResult(_0x204619,null))[_0x767a('0x1b')](handleError(_0x204619,null));};exports[_0x767a('0x44')]=function(_0x5e268c,_0x2a1ea0){return respondWithRpcPromise(_0x767a('0x45'),_0x5e268c[_0x767a('0x18')],routingClient)[_0x767a('0x7')](findById(_0x5e268c[_0x767a('0x16')]['id']))[_0x767a('0x7')](respondWithResult(_0x2a1ea0,null))['catch'](handleError(_0x2a1ea0,null));};exports[_0x767a('0x46')]=function(_0x1b676a,_0x223cf8){return respondWithRpcPromise(_0x767a('0x47'),_0x1b676a[_0x767a('0x18')],routingClient)[_0x767a('0x7')](respondWithResult(_0x223cf8,null))[_0x767a('0x1b')](handleError(_0x223cf8,null));};exports[_0x767a('0x48')]=function(_0x4b197b,_0x2661ea){return respondWithRpcPromise(_0x767a('0x47'),_0x4b197b[_0x767a('0x18')],routingClient)[_0x767a('0x7')](findById(_0x4b197b[_0x767a('0x16')]['id']))[_0x767a('0x7')](respondWithResult(_0x2661ea,null))[_0x767a('0x1b')](handleError(_0x2661ea,null));};exports[_0x767a('0x49')]=function(_0x2d1d28,_0x7c9a62){return respondWithRpcPromise('FaxAccounts',_0x2d1d28[_0x767a('0x18')])[_0x767a('0x7')](respondWithResult(_0x7c9a62,null))['catch'](handleError(_0x7c9a62,null));};exports[_0x767a('0x4a')]=function(_0x32fb34,_0x42c224){return respondWithRpcPromise(_0x767a('0x4b'),_0x32fb34[_0x767a('0x18')],routingClient)['then'](respondWithResult(_0x42c224,null))[_0x767a('0x1b')](handleError(_0x42c224,null));};exports[_0x767a('0x4c')]=function(_0x3709fb,_0x36b616){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x3709fb['query'],routingClient)[_0x767a('0x7')](respondWithResult(_0x36b616,null))['catch'](handleError(_0x36b616,null));};exports[_0x767a('0x4d')]=function(_0x3abefe,_0x1a5f76){return respondWithRpcPromise(_0x767a('0x4e'),_0x3abefe['query'],routingClient)[_0x767a('0x7')](respondWithResult(_0x1a5f76,null))[_0x767a('0x1b')](handleError(_0x1a5f76,null));};exports[_0x767a('0x4f')]=function(_0x24bb64,_0x9660b6){return respondWithRpcPromise(_0x767a('0x50'),_0x24bb64[_0x767a('0x18')],routingClient)[_0x767a('0x7')](respondWithResult(_0x9660b6,null))[_0x767a('0x1b')](handleError(_0x9660b6,null));};exports[_0x767a('0x51')]=function(_0x370210,_0xed649e){return respondWithRpcPromise(_0x767a('0x52'),_0x370210[_0x767a('0x18')],routingClient)[_0x767a('0x7')](respondWithResult(_0xed649e,null))[_0x767a('0x1b')](handleError(_0xed649e,null));};exports[_0x767a('0x53')]=function(_0x5d43f4){return function(_0x1e0f42,_0x97c2a5){var _0x1d617c,_0xe17db;var _0x85a60c=_[_0x767a('0x54')](_0x5d43f4);var _0x48e5c1=_0x5d43f4==='chat'?_0x767a('0x55'):_0x767a('0x56');return db[_0x85a60c+_0x767a('0x57')][_0x767a('0x58')]({'raw':!![],'where':{'id':_0x1e0f42['params']['id']}})[_0x767a('0x7')](function(_0x18066f){if(_[_0x767a('0x10')](_0x18066f)){throw new Error(_0x85a60c+_0x767a('0x59'));}_0x1d617c=_0x18066f;return db[_0x85a60c+_0x767a('0x5a')][_0x767a('0x58')]({'where':{'id':_0x1e0f42[_0x767a('0x27')][_0x767a('0x5b')]},'include':[{'model':db[_0x85a60c+_0x767a('0x5c')],'as':_0x767a('0x5c')},{'model':db[_0x85a60c+_0x48e5c1],'as':_0x767a('0x56')}]});})[_0x767a('0x7')](function(_0x452661){if(_[_0x767a('0x10')](_0x452661)){throw new Error(_0x85a60c+_0x767a('0x5d'));}_0xe17db=_0x452661;return _0x452661['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x767a('0x7')](function(){var _0xa004a5={'uniqueid':_0x5d43f4+'.'+_0xe17db['id']+'.'+_0xe17db[_0x767a('0x5c')]['id'],'FromUserId':_0x1e0f42['user']['id'],'type':_0x767a('0x5e')};_0xa004a5[_0x85a60c+_0x767a('0x5f')]=_0xe17db['id'];_0xa004a5[_0x85a60c+_0x767a('0x60')]=_0xe17db[_0x767a('0x5c')]['id'];_0xa004a5['From'+_0x85a60c+_0x48e5c1+'Id']=_0xe17db[_0x767a('0x56')]['id'];_0xa004a5['To'+_0x85a60c+_0x767a('0x61')]=_0x1d617c['id'];return db[_0x85a60c+'TransferReport']['create'](_0xa004a5);})[_0x767a('0x7')](function(){return respondWithRpcPromise(_0x767a('0x62'),{'channel':_0x5d43f4,'interaction':_0xe17db[_0x767a('0x5c')],'message':_0xe17db,'account':_0xe17db[_0x767a('0x56')],'applications':[{'id':0x0,'priority':0x1,'app':_0x767a('0x5e'),'appdata':_0x1d617c[_0x767a('0xe')]+','+(_0xe17db[_0x767a('0x56')][_0x767a('0x63')]||0x12c),'interval':_0x767a('0x64')}]},routingClient);})[_0x767a('0x7')](respondWithResult(_0x97c2a5,null))['catch'](handleError(_0x97c2a5,null));};};exports[_0x767a('0x65')]=function(_0xfa490a,_0x553286){var _0x339855,_0xbfd885;if(_[_0x767a('0x10')](_0xfa490a[_0x767a('0x27')][_0x767a('0x66')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x3d70d7=_0xfa490a[_0x767a('0x27')][_0x767a('0x66')];var _0x508905=_[_0x767a('0x54')](_0x3d70d7);var _0x2974da=_0x3d70d7===_0x767a('0x67')?_0x767a('0x55'):_0x767a('0x56');return db[_0x767a('0x68')][_0x767a('0x58')]({'raw':!![],'where':{'id':_0xfa490a[_0x767a('0x16')]['id'],'role':_0x767a('0x33')}})[_0x767a('0x7')](function(_0x540586){if(_[_0x767a('0x10')](_0x540586)){throw new Error(_0x767a('0x69'));}_0x339855=_0x540586;return db[_0x508905+_0x767a('0x5a')][_0x767a('0x58')]({'where':{'id':_0xfa490a[_0x767a('0x27')][_0x767a('0x5b')]},'include':[{'model':db[_0x508905+'Interaction'],'as':'Interaction'},{'model':db[_0x508905+_0x2974da],'as':_0x767a('0x56')}]});})['then'](function(_0x19b1fb){if(_['isNil'](_0x19b1fb)){throw new Error(_0x508905+_0x767a('0x5d'));}_0xbfd885=_0x19b1fb;return _0x19b1fb['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x767a('0x7')](function(){var _0x3beb03={'uniqueid':_0x3d70d7+'.'+_0xbfd885['id']+'.'+_0xbfd885[_0x767a('0x5c')]['id'],'FromUserId':_0xfa490a[_0x767a('0x29')]['id'],'type':'queue','ToUserId':_0x339855['id']};_0x3beb03[_0x508905+_0x767a('0x5f')]=_0xbfd885['id'];_0x3beb03[_0x508905+_0x767a('0x60')]=_0xbfd885[_0x767a('0x5c')]['id'];_0x3beb03[_0x767a('0x6a')+_0x508905+_0x2974da+'Id']=_0xbfd885[_0x767a('0x56')]['id'];return db[_0x508905+_0x767a('0x6b')][_0x767a('0x6c')](_0x3beb03);})[_0x767a('0x7')](function(){return respondWithRpcPromise(_0x767a('0x62'),{'channel':_0x3d70d7,'interaction':_0xbfd885[_0x767a('0x5c')],'message':_0xbfd885,'account':_0xbfd885[_0x767a('0x56')],'applications':[{'id':0x0,'priority':0x1,'app':_0x767a('0x33'),'appdata':_0x339855[_0x767a('0xe')]+','+(_0xbfd885[_0x767a('0x56')][_0x767a('0x6d')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x767a('0x7')](respondWithResult(_0x553286,null))[_0x767a('0x1b')](handleError(_0x553286,null));}; \ No newline at end of file +var _0xda28=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','Website','Queue','findOne','isNil','\x20Queue\x20not\x20found','Message','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','agentTransferTimeout','bluebird','moment','lodash','util','api','client','http','request','error','code','message','result','status','json','sendStatus','stack','name','send','rows','VoiceChannels','query','then','VoiceChannelMixMonitor','merge','params','catch','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions'];(function(_0x46ce2f,_0x34945f){var _0x118996=function(_0x384918){while(--_0x384918){_0x46ce2f['push'](_0x46ce2f['shift']());}};_0x118996(++_0x34945f);}(_0xda28,0x1db));var _0x8da2=function(_0x1d6f48,_0x5055ec){_0x1d6f48=_0x1d6f48-0x0;var _0x116d88=_0xda28[_0x1d6f48];return _0x116d88;};'use strict';var BPromise=require(_0x8da2('0x0'));var moment=require(_0x8da2('0x1'));var _=require(_0x8da2('0x2'));var util=require(_0x8da2('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x8da2('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x8da2('0x5')][_0x8da2('0x6')]({'port':0x232a});var mailClient=jayson[_0x8da2('0x5')][_0x8da2('0x6')]({'port':0x232b});var routingClient=jayson[_0x8da2('0x5')][_0x8da2('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x413952,_0x196a69,_0x410f76){return new BPromise(function(_0x3f0f19,_0x38b4c1){var _0x4f182a=_0x410f76?_0x410f76:amiClient;return _0x4f182a[_0x8da2('0x7')](_0x413952,_0x196a69)['then'](function(_0x572595){if(_0x572595[_0x8da2('0x8')]){if(_0x572595[_0x8da2('0x8')][_0x8da2('0x9')]===0x1f4){return _0x38b4c1(_0x572595[_0x8da2('0x8')][_0x8da2('0xa')]);}return _0x3f0f19(_0x572595[_0x8da2('0x8')][_0x8da2('0xa')]);}else{_0x3f0f19(_0x572595[_0x8da2('0xb')]);}})['catch'](function(_0x2bfdee){_0x38b4c1(_0x2bfdee);});});}function respondWithResult(_0x1c0f2e,_0x50be40){_0x50be40=_0x50be40||0xc8;return function(_0x38259e){if(_0x38259e){return _0x1c0f2e[_0x8da2('0xc')](_0x50be40)[_0x8da2('0xd')](_0x38259e);}return _0x1c0f2e[_0x8da2('0xe')](0x194);};}function handleError(_0x4692e9,_0x32abb6){_0x32abb6=_0x32abb6||0x1f4;return function(_0x112893){logger[_0x8da2('0x8')](_0x112893[_0x8da2('0xf')]);if(_0x112893[_0x8da2('0x10')]){delete _0x112893[_0x8da2('0x10')];}_0x4692e9[_0x8da2('0xc')](_0x32abb6)[_0x8da2('0x11')](_0x112893);};}function findById(_0x530327){return function(_0x70bc39){if(!_['isNil'](_0x530327)&&!_['isNil'](_0x70bc39)&&!_['isNil'](_0x70bc39[_0x8da2('0x12')])){return _['find'](_0x70bc39[_0x8da2('0x12')],function(_0xf94d20){return _0xf94d20['id']==_0x530327;});}return null;};}exports['voiceChannels']=function(_0x526010,_0x2ac221){return respondWithRpcPromise(_0x8da2('0x13'),_0x526010[_0x8da2('0x14')])[_0x8da2('0x15')](respondWithResult(_0x2ac221,null))['catch'](handleError(_0x2ac221,null));};exports['voiceChannelMixMonitor']=function(_0x5745f6,_0xf92733){return respondWithRpcPromise(_0x8da2('0x16'),_[_0x8da2('0x17')](_0x5745f6['query'],_0x5745f6[_0x8da2('0x18')]))[_0x8da2('0x15')](respondWithResult(_0xf92733,null))[_0x8da2('0x19')](handleError(_0xf92733,null));};exports['voiceChannelStopMixMonitor']=function(_0x1554f4,_0x468f81){return respondWithRpcPromise(_0x8da2('0x1a'),_[_0x8da2('0x17')](_0x1554f4['query'],_0x1554f4[_0x8da2('0x18')]))['then'](respondWithResult(_0x468f81,null))['catch'](handleError(_0x468f81,null));};exports[_0x8da2('0x1b')]=function(_0x1988a8,_0x14b1c0){return respondWithRpcPromise('VoiceQueues',_0x1988a8[_0x8da2('0x14')])['then'](respondWithResult(_0x14b1c0,null))[_0x8da2('0x19')](handleError(_0x14b1c0,null));};exports[_0x8da2('0x1c')]=function(_0x329cfd,_0x54618a){return respondWithRpcPromise(_0x8da2('0x1d'),_0x329cfd[_0x8da2('0x14')])[_0x8da2('0x15')](findById(_0x329cfd['params']['id']))['then'](respondWithResult(_0x54618a,null))[_0x8da2('0x19')](handleError(_0x54618a,null));};exports[_0x8da2('0x1e')]=function(_0x47060f,_0x4b2c5e){return respondWithRpcPromise(_0x8da2('0x1f'),_[_0x8da2('0x17')](_0x47060f[_0x8da2('0x14')],_0x47060f[_0x8da2('0x18')]))[_0x8da2('0x15')](respondWithResult(_0x4b2c5e,null))[_0x8da2('0x19')](handleError(_0x4b2c5e,null));};exports[_0x8da2('0x20')]=function(_0x4d38cf,_0x28f116){return respondWithRpcPromise(_0x8da2('0x21'),_0x4d38cf['query'])[_0x8da2('0x15')](respondWithResult(_0x28f116,null))[_0x8da2('0x19')](handleError(_0x28f116,null));};exports['voiceQueuesChannel']=function(_0x49baf9,_0x2cbe1a){return respondWithRpcPromise(_0x8da2('0x22'),_[_0x8da2('0x17')](_0x49baf9[_0x8da2('0x14')],_0x49baf9[_0x8da2('0x18')]))[_0x8da2('0x15')](respondWithResult(_0x2cbe1a,null))[_0x8da2('0x19')](handleError(_0x2cbe1a,null));};exports[_0x8da2('0x23')]=function(_0x4c07de,_0x301c8f){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x8da2('0x17')](_0x4c07de[_0x8da2('0x14')],_0x4c07de[_0x8da2('0x18')]))[_0x8da2('0x15')](respondWithResult(_0x301c8f,null))['catch'](handleError(_0x301c8f,null));};exports['voiceQueuesChannelRedirect']=function(_0x3ae9fb,_0x174045){return respondWithRpcPromise(_0x8da2('0x24'),_[_0x8da2('0x17')](_0x3ae9fb[_0x8da2('0x14')],_0x3ae9fb['params']))[_0x8da2('0x15')](respondWithResult(_0x174045,null))[_0x8da2('0x19')](handleError(_0x174045,null));};exports[_0x8da2('0x25')]=function(_0x2cc1a2,_0x51aba4){return respondWithRpcPromise(_0x8da2('0x26'),_0x2cc1a2[_0x8da2('0x14')])['then'](respondWithResult(_0x51aba4,null))[_0x8da2('0x19')](handleError(_0x51aba4,null));};exports[_0x8da2('0x27')]=function(_0x3e83ca,_0x4f887c){return respondWithRpcPromise(_0x8da2('0x28'),_0x3e83ca['query'])['then'](respondWithResult(_0x4f887c,null))[_0x8da2('0x19')](handleError(_0x4f887c,null));};exports['agents']=function(_0xec1530,_0x13135a){var _0x21ca5f;return respondWithRpcPromise('Agents',_0xec1530['query'])[_0x8da2('0x15')](function(_0x940627){_0x21ca5f=_0x940627;return respondWithRpcPromise('Agents',_0xec1530[_0x8da2('0x14')],routingClient);})['then'](function(_0x3698c1){return _['merge']({},_0x3698c1,_0x21ca5f);})[_0x8da2('0x15')](respondWithResult(_0x13135a,null))[_0x8da2('0x19')](handleError(_0x13135a,null));};exports[_0x8da2('0x29')]=function(_0x3e5e82,_0x1f99fe){if(_0x3e5e82[_0x8da2('0x2a')]&&_0x3e5e82[_0x8da2('0x2a')][_0x8da2('0x2b')]&&_0x3e5e82[_0x8da2('0x2c')]&&_0x3e5e82['user']['name']){for(var _0xa4bc10 in _0x3e5e82[_0x8da2('0x2a')][_0x8da2('0x2b')]){if(_0x3e5e82['body'][_0x8da2('0x2b')][_0x8da2('0x2d')](_0xa4bc10)){db[_0x8da2('0x2e')][_0x8da2('0x2f')]({'where':{'channel':_0xa4bc10,'membername':_0x3e5e82[_0x8da2('0x2c')]['name'],'type':_0x8da2('0x30'),'exitAt':null,'uniqueid':_0x3e5e82['body']['interaction'][_0xa4bc10]&&_0x3e5e82[_0x8da2('0x2a')][_0x8da2('0x2b')][_0xa4bc10][_0x8da2('0x31')]?{'$notIn':_0x3e5e82['body']['interaction'][_0xa4bc10]}:{'$ne':null}}})['then'](function(_0x542d61){var _0x45f58d=moment()[_0x8da2('0x32')](_0x8da2('0x33'));for(var _0x63db4=0x0,_0x28f087=_0x542d61[_0x8da2('0x31')];_0x63db4<_0x28f087;_0x63db4+=0x1){_0x542d61[_0x63db4][_0x8da2('0x34')]({'exitAt':_0x45f58d});}});for(var _0x1edcac=0x0;_0x1edcac<_0x3e5e82[_0x8da2('0x2a')]['interaction'][_0xa4bc10]['length'];_0x1edcac+=0x1){db[_0x8da2('0x2e')][_0x8da2('0x35')]({'where':{'channel':_0xa4bc10,'membername':_0x3e5e82[_0x8da2('0x2c')][_0x8da2('0x10')],'type':'INTERACTION','uniqueid':_0x3e5e82[_0x8da2('0x2a')][_0x8da2('0x2b')][_0xa4bc10][_0x1edcac],'exitAt':null},'defaults':{'channel':_0xa4bc10,'membername':_0x3e5e82[_0x8da2('0x2c')][_0x8da2('0x10')],'interface':_['isNil'](_0x3e5e82[_0x8da2('0x2c')][_0x8da2('0x36')])?util[_0x8da2('0x32')](_0x8da2('0x37'),_0x3e5e82[_0x8da2('0x2c')][_0x8da2('0x10')]):_0x3e5e82[_0x8da2('0x2c')][_0x8da2('0x36')],'type':_0x8da2('0x30'),'enterAt':moment()['format'](_0x8da2('0x33')),'role':_0x8da2('0x38'),'internal':_0x3e5e82[_0x8da2('0x2c')][_0x8da2('0x39')],'uniqueid':_0x3e5e82[_0x8da2('0x2a')][_0x8da2('0x2b')][_0xa4bc10][_0x1edcac]}});}}}}return respondWithRpcPromise(_0x8da2('0x3a'),{'id':_0x3e5e82['params']['id'],'capacity':_0x3e5e82['body'][_0x8da2('0x3b')]},routingClient)[_0x8da2('0x15')](respondWithResult(_0x1f99fe,null))[_0x8da2('0x19')](handleError(_0x1f99fe,null));};exports[_0x8da2('0x3c')]=function(_0x26a6f1,_0x58a96d){return respondWithRpcPromise(_0x8da2('0x3d'),_0x26a6f1[_0x8da2('0x14')])[_0x8da2('0x15')](respondWithResult(_0x58a96d,null))[_0x8da2('0x19')](handleError(_0x58a96d,null));};exports[_0x8da2('0x3e')]=function(_0x281302,_0x3d5071){return respondWithRpcPromise('Trunks',_0x281302['query'])[_0x8da2('0x15')](respondWithResult(_0x3d5071,null))[_0x8da2('0x19')](handleError(_0x3d5071,null));};exports['campaigns']=function(_0x15fef2,_0x4c8aca){return respondWithRpcPromise(_0x8da2('0x3f'),_0x15fef2['query'])['then'](respondWithResult(_0x4c8aca,null))[_0x8da2('0x19')](handleError(_0x4c8aca,null));};exports[_0x8da2('0x40')]=function(_0x210a2e,_0x31732e){return respondWithRpcPromise(_0x8da2('0x41'),_0x210a2e[_0x8da2('0x14')],routingClient)[_0x8da2('0x15')](respondWithResult(_0x31732e,null))[_0x8da2('0x19')](handleError(_0x31732e,null));};exports[_0x8da2('0x42')]=function(_0x5e76c5,_0x107251){return respondWithRpcPromise(_0x8da2('0x41'),_0x5e76c5[_0x8da2('0x14')],routingClient)[_0x8da2('0x15')](findById(_0x5e76c5[_0x8da2('0x18')]['id']))[_0x8da2('0x15')](respondWithResult(_0x107251,null))[_0x8da2('0x19')](handleError(_0x107251,null));};exports[_0x8da2('0x43')]=function(_0x33ff30,_0x52858c){return respondWithRpcPromise(_0x8da2('0x44'),_0x33ff30[_0x8da2('0x14')],routingClient)[_0x8da2('0x15')](respondWithResult(_0x52858c,null))[_0x8da2('0x19')](handleError(_0x52858c,null));};exports[_0x8da2('0x45')]=function(_0x2453b4,_0x1efbc0){return respondWithRpcPromise(_0x8da2('0x44'),_0x2453b4[_0x8da2('0x14')],routingClient)[_0x8da2('0x15')](findById(_0x2453b4[_0x8da2('0x18')]['id']))[_0x8da2('0x15')](respondWithResult(_0x1efbc0,null))[_0x8da2('0x19')](handleError(_0x1efbc0,null));};exports[_0x8da2('0x46')]=function(_0x279535,_0x4ef966){return respondWithRpcPromise(_0x8da2('0x47'),_0x279535[_0x8da2('0x14')],mailClient)[_0x8da2('0x15')](respondWithResult(_0x4ef966,null))[_0x8da2('0x19')](handleError(_0x4ef966,null));};exports['openchannelQueues']=function(_0x380a3f,_0x42f7e0){return respondWithRpcPromise(_0x8da2('0x48'),_0x380a3f[_0x8da2('0x14')],routingClient)[_0x8da2('0x15')](respondWithResult(_0x42f7e0,null))[_0x8da2('0x19')](handleError(_0x42f7e0,null));};exports[_0x8da2('0x49')]=function(_0x724caa,_0x46f061){return respondWithRpcPromise(_0x8da2('0x48'),_0x724caa[_0x8da2('0x14')],routingClient)[_0x8da2('0x15')](findById(_0x724caa['params']['id']))['then'](respondWithResult(_0x46f061,null))[_0x8da2('0x19')](handleError(_0x46f061,null));};exports['smsQueues']=function(_0x4f9aa7,_0x2f3be1){return respondWithRpcPromise(_0x8da2('0x4a'),_0x4f9aa7[_0x8da2('0x14')],routingClient)[_0x8da2('0x15')](respondWithResult(_0x2f3be1,null))[_0x8da2('0x19')](handleError(_0x2f3be1,null));};exports[_0x8da2('0x4b')]=function(_0x350c0e,_0x367b73){return respondWithRpcPromise(_0x8da2('0x4a'),_0x350c0e[_0x8da2('0x14')],routingClient)[_0x8da2('0x15')](findById(_0x350c0e['params']['id']))[_0x8da2('0x15')](respondWithResult(_0x367b73,null))[_0x8da2('0x19')](handleError(_0x367b73,null));};exports['faxQueues']=function(_0x8ccc9d,_0xf26329){return respondWithRpcPromise(_0x8da2('0x4c'),_0x8ccc9d[_0x8da2('0x14')],routingClient)['then'](respondWithResult(_0xf26329,null))[_0x8da2('0x19')](handleError(_0xf26329,null));};exports[_0x8da2('0x4d')]=function(_0xb64ee4,_0x1284ba){return respondWithRpcPromise('FaxQueues',_0xb64ee4[_0x8da2('0x14')],routingClient)['then'](findById(_0xb64ee4[_0x8da2('0x18')]['id']))[_0x8da2('0x15')](respondWithResult(_0x1284ba,null))['catch'](handleError(_0x1284ba,null));};exports[_0x8da2('0x4e')]=function(_0x201928,_0x496ae1){return respondWithRpcPromise('FaxAccounts',_0x201928[_0x8da2('0x14')])[_0x8da2('0x15')](respondWithResult(_0x496ae1,null))[_0x8da2('0x19')](handleError(_0x496ae1,null));};exports[_0x8da2('0x4f')]=function(_0x4d9e62,_0x1baf1f){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4d9e62[_0x8da2('0x14')],routingClient)[_0x8da2('0x15')](respondWithResult(_0x1baf1f,null))[_0x8da2('0x19')](handleError(_0x1baf1f,null));};exports[_0x8da2('0x50')]=function(_0x3da844,_0x1630b7){return respondWithRpcPromise(_0x8da2('0x51'),_0x3da844[_0x8da2('0x14')],routingClient)[_0x8da2('0x15')](respondWithResult(_0x1630b7,null))[_0x8da2('0x19')](handleError(_0x1630b7,null));};exports[_0x8da2('0x52')]=function(_0x134d1d,_0x3656fa){return respondWithRpcPromise(_0x8da2('0x53'),_0x134d1d[_0x8da2('0x14')],routingClient)[_0x8da2('0x15')](respondWithResult(_0x3656fa,null))['catch'](handleError(_0x3656fa,null));};exports[_0x8da2('0x54')]=function(_0x1df6f8,_0x4421fa){return respondWithRpcPromise(_0x8da2('0x55'),_0x1df6f8['query'],routingClient)['then'](respondWithResult(_0x4421fa,null))[_0x8da2('0x19')](handleError(_0x4421fa,null));};exports[_0x8da2('0x56')]=function(_0x3b7600,_0xe258ce){return respondWithRpcPromise(_0x8da2('0x57'),_0x3b7600[_0x8da2('0x14')],routingClient)[_0x8da2('0x15')](respondWithResult(_0xe258ce,null))[_0x8da2('0x19')](handleError(_0xe258ce,null));};exports['queueNotify']=function(_0xd6ced8){return function(_0x24e4c6,_0x10d79b){var _0x274020,_0x13c2cb;var _0xbf82e=_['capitalize'](_0xd6ced8);var _0xa33f44=_0xd6ced8==='chat'?_0x8da2('0x58'):'Account';return db[_0xbf82e+_0x8da2('0x59')][_0x8da2('0x5a')]({'raw':!![],'where':{'id':_0x24e4c6[_0x8da2('0x18')]['id']}})['then'](function(_0x12674d){if(_[_0x8da2('0x5b')](_0x12674d)){throw new Error(_0xbf82e+_0x8da2('0x5c'));}_0x274020=_0x12674d;return db[_0xbf82e+_0x8da2('0x5d')][_0x8da2('0x5a')]({'where':{'id':_0x24e4c6[_0x8da2('0x2a')]['messageId']},'include':[{'model':db[_0xbf82e+'Interaction'],'as':_0x8da2('0x5e')},{'model':db[_0xbf82e+_0xa33f44],'as':_0x8da2('0x5f')}]});})[_0x8da2('0x15')](function(_0x1f8212){if(_[_0x8da2('0x5b')](_0x1f8212)){throw new Error(_0xbf82e+_0x8da2('0x60'));}_0x13c2cb=_0x1f8212;return _0x1f8212[_0x8da2('0x61')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8da2('0x15')](function(){var _0xe7089f={'uniqueid':_0xd6ced8+'.'+_0x13c2cb['id']+'.'+_0x13c2cb[_0x8da2('0x5e')]['id'],'FromUserId':_0x24e4c6[_0x8da2('0x2c')]['id'],'type':_0x8da2('0x62')};_0xe7089f[_0xbf82e+_0x8da2('0x63')]=_0x13c2cb['id'];_0xe7089f[_0xbf82e+_0x8da2('0x64')]=_0x13c2cb[_0x8da2('0x5e')]['id'];_0xe7089f[_0x8da2('0x65')+_0xbf82e+_0xa33f44+'Id']=_0x13c2cb[_0x8da2('0x5f')]['id'];_0xe7089f['To'+_0xbf82e+_0x8da2('0x66')]=_0x274020['id'];return db[_0xbf82e+'TransferReport']['create'](_0xe7089f);})[_0x8da2('0x15')](function(){return respondWithRpcPromise(_0x8da2('0x67'),{'channel':_0xd6ced8,'interaction':_0x13c2cb[_0x8da2('0x5e')],'message':_0x13c2cb,'account':_0x13c2cb[_0x8da2('0x5f')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x274020['name']+','+(_0x13c2cb[_0x8da2('0x5f')][_0x8da2('0x68')]||0x12c),'interval':_0x8da2('0x69')}]},routingClient);})['then'](respondWithResult(_0x10d79b,null))[_0x8da2('0x19')](handleError(_0x10d79b,null));};};exports[_0x8da2('0x6a')]=function(_0x5bfa52,_0x568866){var _0xa82ee,_0x14ee84;if(_[_0x8da2('0x5b')](_0x5bfa52[_0x8da2('0x2a')][_0x8da2('0x6b')])){throw new Error(_0x8da2('0x6c'));}var _0x524db0=_0x5bfa52[_0x8da2('0x2a')][_0x8da2('0x6b')];var _0x565d47=_['capitalize'](_0x524db0);var _0x476507=_0x524db0===_0x8da2('0x6d')?_0x8da2('0x58'):_0x8da2('0x5f');return db['User'][_0x8da2('0x5a')]({'raw':!![],'where':{'id':_0x5bfa52[_0x8da2('0x18')]['id'],'role':_0x8da2('0x38')}})[_0x8da2('0x15')](function(_0x474cba){if(_['isNil'](_0x474cba)){throw new Error('Agent\x20not\x20found');}_0xa82ee=_0x474cba;return db[_0x565d47+_0x8da2('0x5d')][_0x8da2('0x5a')]({'where':{'id':_0x5bfa52[_0x8da2('0x2a')]['messageId']},'include':[{'model':db[_0x565d47+_0x8da2('0x5e')],'as':_0x8da2('0x5e')},{'model':db[_0x565d47+_0x476507],'as':_0x8da2('0x5f')}]});})['then'](function(_0x6b6b1d){if(_['isNil'](_0x6b6b1d)){throw new Error(_0x565d47+_0x8da2('0x60'));}_0x14ee84=_0x6b6b1d;return _0x6b6b1d[_0x8da2('0x61')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x17c411={'uniqueid':_0x524db0+'.'+_0x14ee84['id']+'.'+_0x14ee84[_0x8da2('0x5e')]['id'],'FromUserId':_0x5bfa52['user']['id'],'type':'queue','ToUserId':_0xa82ee['id']};_0x17c411[_0x565d47+_0x8da2('0x63')]=_0x14ee84['id'];_0x17c411[_0x565d47+_0x8da2('0x64')]=_0x14ee84[_0x8da2('0x5e')]['id'];_0x17c411['From'+_0x565d47+_0x476507+'Id']=_0x14ee84['Account']['id'];return db[_0x565d47+'TransferReport']['create'](_0x17c411);})[_0x8da2('0x15')](function(){return respondWithRpcPromise('Start',{'channel':_0x524db0,'interaction':_0x14ee84[_0x8da2('0x5e')],'message':_0x14ee84,'account':_0x14ee84['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0xa82ee[_0x8da2('0x10')]+','+(_0x14ee84[_0x8da2('0x5f')][_0x8da2('0x6e')]||0x12c),'interval':_0x8da2('0x69')}]},routingClient);})[_0x8da2('0x15')](respondWithResult(_0x568866,null))[_0x8da2('0x19')](handleError(_0x568866,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 87395b4..aedf0c4 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 _0x3b87=['isAuthenticated','index','get','/:id','/:id/run','run','post','create','put','update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0x3b87,0x84));var _0x73b8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3b87[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x73b8('0x0'));var timeout=require(_0x73b8('0x1'));var express=require(_0x73b8('0x2'));var router=express[_0x73b8('0x3')]();var auth=require(_0x73b8('0x4'));var interaction=require(_0x73b8('0x5'));var config=require(_0x73b8('0x6'));var controller=require(_0x73b8('0x7'));router['get']('/',auth[_0x73b8('0x8')](),controller[_0x73b8('0x9')]);router[_0x73b8('0xa')](_0x73b8('0xb'),auth[_0x73b8('0x8')](),controller['show']);router[_0x73b8('0xa')](_0x73b8('0xc'),auth[_0x73b8('0x8')](),controller[_0x73b8('0xd')]);router[_0x73b8('0xe')]('/',auth[_0x73b8('0x8')](),controller[_0x73b8('0xf')]);router[_0x73b8('0x10')](_0x73b8('0xb'),auth['isAuthenticated'](),controller[_0x73b8('0x11')]);router['delete'](_0x73b8('0xb'),auth[_0x73b8('0x8')](),controller[_0x73b8('0x12')]);module[_0x73b8('0x13')]=router; \ No newline at end of file +var _0x24b8=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id','show','/:id/run','run','post','create','put'];(function(_0x5377d0,_0x39026e){var _0xce0824=function(_0x58bb79){while(--_0x58bb79){_0x5377d0['push'](_0x5377d0['shift']());}};_0xce0824(++_0x39026e);}(_0x24b8,0x164));var _0x824b=function(_0x36c431,_0x538aa7){_0x36c431=_0x36c431-0x0;var _0x465592=_0x24b8[_0x36c431];return _0x465592;};'use strict';var multer=require(_0x824b('0x0'));var util=require(_0x824b('0x1'));var path=require(_0x824b('0x2'));var timeout=require(_0x824b('0x3'));var express=require(_0x824b('0x4'));var router=express[_0x824b('0x5')]();var auth=require(_0x824b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x824b('0x7'));var controller=require(_0x824b('0x8'));router[_0x824b('0x9')]('/',auth[_0x824b('0xa')](),controller['index']);router[_0x824b('0x9')](_0x824b('0xb'),auth[_0x824b('0xa')](),controller[_0x824b('0xc')]);router[_0x824b('0x9')](_0x824b('0xd'),auth[_0x824b('0xa')](),controller[_0x824b('0xe')]);router[_0x824b('0xf')]('/',auth[_0x824b('0xa')](),controller[_0x824b('0x10')]);router[_0x824b('0x11')](_0x824b('0xb'),auth[_0x824b('0xa')](),controller[_0x824b('0x12')]);router[_0x824b('0x13')](_0x824b('0xb'),auth['isAuthenticated'](),controller[_0x824b('0x14')]);module[_0x824b('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index e8d61ea..d85a6dd 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 _0x1db9=['exports','STRING','BOOLEAN','DATE','years','weeks','days','hours','minutes','csv','xlsx','ENUM','default','TEXT','sequelize'];(function(_0x16c467,_0x53d6fa){var _0x22db4f=function(_0x498d3f){while(--_0x498d3f){_0x16c467['push'](_0x16c467['shift']());}};_0x22db4f(++_0x53d6fa);}(_0x1db9,0x176));var _0x91db=function(_0xf5a41d,_0x2e0f58){_0xf5a41d=_0xf5a41d-0x0;var _0x2a84bc=_0x1db9[_0xf5a41d];return _0x2a84bc;};'use strict';var Sequelize=require(_0x91db('0x0'));module[_0x91db('0x1')]={'name':{'type':Sequelize[_0x91db('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x91db('0x2')]},'active':{'type':Sequelize[_0x91db('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x91db('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x91db('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x91db('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x91db('0x5'),'quarters','months',_0x91db('0x6'),_0x91db('0x7'),_0x91db('0x8'),_0x91db('0x9')),'allowNull':![],'defaultValue':_0x91db('0x7')},'output':{'type':Sequelize['ENUM'](_0x91db('0xa'),'pdf',_0x91db('0xb')),'allowNull':![],'defaultValue':_0x91db('0xa')},'type':{'type':Sequelize[_0x91db('0xc')]('custom',_0x91db('0xd')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x91db('0xe')]},'bcc':{'type':Sequelize[_0x91db('0xe')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xcd59=['days','hours','csv','pdf','xlsx','custom','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','weeks'];(function(_0x45e064,_0x411c6a){var _0x1c1ee4=function(_0x5b7c75){while(--_0x5b7c75){_0x45e064['push'](_0x45e064['shift']());}};_0x1c1ee4(++_0x411c6a);}(_0xcd59,0x14b));var _0x9cd5=function(_0x35f15b,_0x387db3){_0x35f15b=_0x35f15b-0x0;var _0x262619=_0xcd59[_0x35f15b];return _0x262619;};'use strict';var Sequelize=require(_0x9cd5('0x0'));module[_0x9cd5('0x1')]={'name':{'type':Sequelize[_0x9cd5('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9cd5('0x2')]},'active':{'type':Sequelize[_0x9cd5('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x9cd5('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x9cd5('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x9cd5('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x9cd5('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x9cd5('0x6')](_0x9cd5('0x7'),_0x9cd5('0x8'),_0x9cd5('0x9'),_0x9cd5('0xa'),_0x9cd5('0xb'),_0x9cd5('0xc'),'minutes'),'allowNull':![],'defaultValue':_0x9cd5('0xb')},'output':{'type':Sequelize[_0x9cd5('0x6')](_0x9cd5('0xd'),_0x9cd5('0xe'),_0x9cd5('0xf')),'allowNull':![],'defaultValue':_0x9cd5('0xd')},'type':{'type':Sequelize[_0x9cd5('0x6')](_0x9cd5('0x10'),'default'),'allowNull':![],'defaultValue':_0x9cd5('0x10')},'sendMail':{'type':Sequelize[_0x9cd5('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x9cd5('0x2')]},'cc':{'type':Sequelize[_0x9cd5('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 1898f8e..c080a1c 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 _0xf257=['order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','run','../../config/schedule','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','then','destroy','Scheduler','end','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf257,0x173));var _0x7f25=function(_0x156d5f,_0x58fd47){_0x156d5f=_0x156d5f-0x0;var _0x487260=_0xf257[_0x156d5f];return _0x487260;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7f25('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7f25('0x1'));var moment=require(_0x7f25('0x2'));var BPromise=require(_0x7f25('0x3'));var Mustache=require(_0x7f25('0x4'));var util=require(_0x7f25('0x5'));var path=require(_0x7f25('0x6'));var sox=require(_0x7f25('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7f25('0x8'));var squel=require(_0x7f25('0x9'));var crypto=require(_0x7f25('0xa'));var jsforce=require(_0x7f25('0xb'));var deskjs=require(_0x7f25('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7f25('0xd'));var Papa=require(_0x7f25('0xe'));var Redis=require(_0x7f25('0xf'));var authService=require(_0x7f25('0x10'));var qs=require(_0x7f25('0x11'));var as=require(_0x7f25('0x12'));var hardwareService=require(_0x7f25('0x13'));var logger=require(_0x7f25('0x14'))(_0x7f25('0x15'));var utils=require(_0x7f25('0x16'));var config=require(_0x7f25('0x17'));var db=require(_0x7f25('0x18'))['db'];function respondWithStatusCode(_0x4b0f6c,_0x38aafb){_0x38aafb=_0x38aafb||0xcc;return function(_0x341b52){if(_0x341b52){return _0x4b0f6c[_0x7f25('0x19')](_0x38aafb);}return _0x4b0f6c[_0x7f25('0x1a')](_0x38aafb)['end']();};}function respondWithResult(_0x4c80a5,_0x44757a){_0x44757a=_0x44757a||0xc8;return function(_0x4ad8b4){if(_0x4ad8b4){return _0x4c80a5['status'](_0x44757a)[_0x7f25('0x1b')](_0x4ad8b4);}};}function respondWithFilteredResult(_0x1eb0de,_0x947d4f){return function(_0x1196ed){if(_0x1196ed){var _0x37995b=_0x1196ed[_0x7f25('0x1c')],_0x2f4047=_0x947d4f[_0x7f25('0x1d')],_0x3c22ee=_0x947d4f['offset']+_0x947d4f['limit'],_0x427ae0;if(_0x3c22ee>=_0x37995b){_0x3c22ee=_0x37995b;_0x427ae0=0xc8;}else{_0x427ae0=0xce;}_0x1eb0de[_0x7f25('0x1a')](_0x427ae0);return _0x1eb0de[_0x7f25('0x1e')](_0x7f25('0x1f'),_0x2f4047+'-'+_0x3c22ee+'/'+_0x37995b)['json'](_0x1196ed);}return null;};}function patchUpdates(_0x2ea36c){return function(_0x295671){try{jsonpatch[_0x7f25('0x20')](_0x295671,_0x2ea36c,!![]);}catch(_0x57fb71){return BPromise['reject'](_0x57fb71);}return _0x295671[_0x7f25('0x21')]();};}function saveUpdates(_0xb7794,_0x1b84f1){return function(_0x4d24ac){if(_0x4d24ac){return _0x4d24ac['update'](_0xb7794)[_0x7f25('0x22')](function(_0x3c25ef){return _0x3c25ef;});}return null;};}function removeEntity(_0x44713a,_0x2bdb8a){return function(_0x48f178){if(_0x48f178){return _0x48f178[_0x7f25('0x23')]()[_0x7f25('0x22')](function(){var _0x232fe6=_0x48f178['get']({'plain':!![]});var _0xad81dc=_0x7f25('0x24');return db['UserProfileResource'][_0x7f25('0x23')]({'where':{'type':_0xad81dc,'resourceId':_0x232fe6['id']}})['then'](function(){return _0x48f178;});})[_0x7f25('0x22')](function(){_0x44713a['status'](0xcc)[_0x7f25('0x25')]();});}};}function handleEntityNotFound(_0x5018ee,_0x1fc79d){return function(_0x64ea50){if(!_0x64ea50){_0x5018ee[_0x7f25('0x19')](0x194);}return _0x64ea50;};}function handleError(_0x3cb619,_0x1eed46){_0x1eed46=_0x1eed46||0x1f4;return function(_0x187717){logger[_0x7f25('0x26')](_0x187717[_0x7f25('0x27')]);if(_0x187717[_0x7f25('0x28')]){delete _0x187717[_0x7f25('0x28')];}_0x3cb619[_0x7f25('0x1a')](_0x1eed46)[_0x7f25('0x29')](_0x187717);};}exports[_0x7f25('0x2a')]=function(_0xfd712f,_0x26009c){var _0x58c04c={},_0x25bcb6={},_0x5d96b2={'count':0x0,'rows':[]};var _0x59da35=_[_0x7f25('0x2b')](db[_0x7f25('0x2c')][_0x7f25('0x2d')],function(_0x44c20f){return{'name':_0x44c20f[_0x7f25('0x2e')],'type':_0x44c20f[_0x7f25('0x2f')][_0x7f25('0x30')]};});_0x25bcb6[_0x7f25('0x31')]=_[_0x7f25('0x2b')](_0x59da35,_0x7f25('0x28'));_0x25bcb6[_0x7f25('0x32')]=_[_0x7f25('0x33')](_0xfd712f[_0x7f25('0x32')]);_0x25bcb6[_0x7f25('0x34')]=_[_0x7f25('0x35')](_0x25bcb6[_0x7f25('0x31')],_0x25bcb6[_0x7f25('0x32')]);_0x58c04c['attributes']=_[_0x7f25('0x35')](_0x25bcb6[_0x7f25('0x31')],qs[_0x7f25('0x36')](_0xfd712f[_0x7f25('0x32')][_0x7f25('0x36')]));_0x58c04c[_0x7f25('0x37')]=_0x58c04c[_0x7f25('0x37')][_0x7f25('0x38')]?_0x58c04c[_0x7f25('0x37')]:_0x25bcb6['model'];if(!_0xfd712f[_0x7f25('0x32')][_0x7f25('0x39')]('nolimit')){_0x58c04c[_0x7f25('0x3a')]=qs['limit'](_0xfd712f[_0x7f25('0x32')][_0x7f25('0x3a')]);_0x58c04c[_0x7f25('0x1d')]=qs['offset'](_0xfd712f[_0x7f25('0x32')][_0x7f25('0x1d')]);}_0x58c04c[_0x7f25('0x3b')]=qs[_0x7f25('0x3c')](_0xfd712f[_0x7f25('0x32')]['sort']);_0x58c04c[_0x7f25('0x3d')]=qs[_0x7f25('0x34')](_[_0x7f25('0x3e')](_0xfd712f[_0x7f25('0x32')],_0x25bcb6[_0x7f25('0x34')]));if(_0xfd712f[_0x7f25('0x32')]['filter']){_0x58c04c['where']=_[_0x7f25('0x3f')](_0x58c04c[_0x7f25('0x3d')],{'$or':_[_0x7f25('0x2b')](_0x59da35,function(_0x50f322){if(_0x50f322[_0x7f25('0x2f')]!==_0x7f25('0x40')){var _0x32dd0b={};_0x32dd0b[_0x50f322[_0x7f25('0x28')]]={'$like':'%'+_0xfd712f[_0x7f25('0x32')][_0x7f25('0x41')]+'%'};return _0x32dd0b;}})});}_0x58c04c=_['merge']({},_0x58c04c,_0xfd712f[_0x7f25('0x42')]);var _0x30c6e7={'where':_0x58c04c[_0x7f25('0x3d')]};return db[_0x7f25('0x2c')][_0x7f25('0x1c')](_0x30c6e7)[_0x7f25('0x22')](function(_0x4bfdeb){_0x5d96b2['count']=_0x4bfdeb;if(_0xfd712f[_0x7f25('0x32')][_0x7f25('0x43')]){_0x58c04c[_0x7f25('0x44')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x58c04c);})[_0x7f25('0x22')](function(_0x4055bd){_0x5d96b2[_0x7f25('0x45')]=_0x4055bd;return _0x5d96b2;})[_0x7f25('0x22')](respondWithFilteredResult(_0x26009c,_0x58c04c))[_0x7f25('0x46')](handleError(_0x26009c,null));};exports[_0x7f25('0x47')]=function(_0x2857b5,_0x7373d6){var _0xb59c65={'raw':![],'where':{'id':_0x2857b5[_0x7f25('0x48')]['id']}},_0x65bb53={};_0x65bb53[_0x7f25('0x31')]=_[_0x7f25('0x33')](db[_0x7f25('0x2c')][_0x7f25('0x2d')]);_0x65bb53[_0x7f25('0x32')]=_['keys'](_0x2857b5[_0x7f25('0x32')]);_0x65bb53[_0x7f25('0x34')]=_['intersection'](_0x65bb53[_0x7f25('0x31')],_0x65bb53[_0x7f25('0x32')]);_0xb59c65[_0x7f25('0x37')]=_['intersection'](_0x65bb53['model'],qs[_0x7f25('0x36')](_0x2857b5[_0x7f25('0x32')][_0x7f25('0x36')]));_0xb59c65[_0x7f25('0x37')]=_0xb59c65[_0x7f25('0x37')][_0x7f25('0x38')]?_0xb59c65[_0x7f25('0x37')]:_0x65bb53['model'];if(_0x2857b5[_0x7f25('0x32')]['includeAll']){_0xb59c65[_0x7f25('0x44')]=[{'all':!![]}];}_0xb59c65=_[_0x7f25('0x3f')]({},_0xb59c65,_0x2857b5[_0x7f25('0x42')]);return db[_0x7f25('0x2c')][_0x7f25('0x49')](_0xb59c65)['then'](handleEntityNotFound(_0x7373d6,null))[_0x7f25('0x22')](respondWithResult(_0x7373d6,null))[_0x7f25('0x46')](handleError(_0x7373d6,null));};exports[_0x7f25('0x4a')]=function(_0x4ad982,_0x54e55b){return db['Schedule']['create'](_0x4ad982['body'],{})['then'](function(_0x1ddbdc){var _0x33fcbf=_0x4ad982[_0x7f25('0x4b')][_0x7f25('0x4c')]({'plain':!![]});if(!_0x33fcbf)throw new Error(_0x7f25('0x4d'));if(_0x33fcbf[_0x7f25('0x4e')]===_0x7f25('0x4b')){var _0x2fac9b=_0x1ddbdc[_0x7f25('0x4c')]({'plain':!![]});var _0x4c1901=_0x7f25('0x24');return db[_0x7f25('0x4f')]['find']({'where':{'name':_0x4c1901,'userProfileId':_0x33fcbf['userProfileId']},'raw':!![]})[_0x7f25('0x22')](function(_0x2bace7){if(_0x2bace7&&_0x2bace7[_0x7f25('0x50')]===0x0){return db['UserProfileResource'][_0x7f25('0x4a')]({'name':_0x2fac9b['name'],'resourceId':_0x2fac9b['id'],'type':_0x2bace7[_0x7f25('0x28')],'sectionId':_0x2bace7['id']},{})[_0x7f25('0x22')](function(){return _0x1ddbdc;});}else{return _0x1ddbdc;}})[_0x7f25('0x46')](function(_0xaea1d9){logger[_0x7f25('0x26')](_0x7f25('0x51'),_0xaea1d9);throw _0xaea1d9;});}return _0x1ddbdc;})[_0x7f25('0x22')](respondWithResult(_0x54e55b,0xc9))[_0x7f25('0x46')](handleError(_0x54e55b,null));};exports[_0x7f25('0x52')]=function(_0x4de122,_0x49c15c){if(_0x4de122[_0x7f25('0x53')]['id']){delete _0x4de122[_0x7f25('0x53')]['id'];}return db[_0x7f25('0x2c')]['find']({'where':{'id':_0x4de122['params']['id']}})[_0x7f25('0x22')](handleEntityNotFound(_0x49c15c,null))[_0x7f25('0x22')](saveUpdates(_0x4de122[_0x7f25('0x53')],null))[_0x7f25('0x22')](respondWithResult(_0x49c15c,null))[_0x7f25('0x46')](handleError(_0x49c15c,null));};exports[_0x7f25('0x23')]=function(_0x20eca9,_0x31e4e0){return db[_0x7f25('0x2c')][_0x7f25('0x49')]({'where':{'id':_0x20eca9[_0x7f25('0x48')]['id']}})[_0x7f25('0x22')](handleEntityNotFound(_0x31e4e0,null))[_0x7f25('0x22')](removeEntity(_0x31e4e0,null))[_0x7f25('0x46')](handleError(_0x31e4e0,null));};exports[_0x7f25('0x54')]=function(_0x1687ed,_0x4c7794,_0x523157){var _0x4bdabd=require(_0x7f25('0x55'));return db[_0x7f25('0x2c')]['find']({'where':{'id':_0x1687ed[_0x7f25('0x48')]['id']},'raw':!![]})[_0x7f25('0x22')](handleEntityNotFound(_0x4c7794,null))['then'](function(){_0x4bdabd['run'](_0x1687ed['params']['id']);})[_0x7f25('0x22')](respondWithStatusCode(_0x4c7794,null))[_0x7f25('0x46')](handleError(_0x4c7794,null));}; \ No newline at end of file +var _0xedd1=['set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','map','Schedule','rawAttributes','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filter','merge','type','options','include','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xedd1,0x127));var _0x1edd=function(_0xce4c29,_0x4029e5){_0xce4c29=_0xce4c29-0x0;var _0x3e7922=_0xedd1[_0xce4c29];return _0x3e7922;};'use strict';var pdf=require(_0x1edd('0x0'));var emlformat=require(_0x1edd('0x1'));var rimraf=require(_0x1edd('0x2'));var zipdir=require(_0x1edd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1edd('0x4'));var moment=require(_0x1edd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1edd('0x6'));var util=require('util');var path=require(_0x1edd('0x7'));var sox=require(_0x1edd('0x8'));var csv=require(_0x1edd('0x9'));var ejs=require(_0x1edd('0xa'));var fs=require('fs');var _=require(_0x1edd('0xb'));var squel=require(_0x1edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x1edd('0xd'));var deskjs=require(_0x1edd('0xe'));var toCsv=require(_0x1edd('0x9'));var querystring=require(_0x1edd('0xf'));var Papa=require(_0x1edd('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1edd('0x11'));var as=require(_0x1edd('0x12'));var hardwareService=require(_0x1edd('0x13'));var logger=require(_0x1edd('0x14'))('api');var utils=require(_0x1edd('0x15'));var config=require(_0x1edd('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f6420,_0x53bc17){_0x53bc17=_0x53bc17||0xcc;return function(_0x3d8f68){if(_0x3d8f68){return _0x1f6420[_0x1edd('0x17')](_0x53bc17);}return _0x1f6420['status'](_0x53bc17)[_0x1edd('0x18')]();};}function respondWithResult(_0x5be2df,_0x49c6af){_0x49c6af=_0x49c6af||0xc8;return function(_0x561d14){if(_0x561d14){return _0x5be2df[_0x1edd('0x19')](_0x49c6af)[_0x1edd('0x1a')](_0x561d14);}};}function respondWithFilteredResult(_0x398cd9,_0x23d227){return function(_0xc8d3c5){if(_0xc8d3c5){var _0x50ca04=_0xc8d3c5[_0x1edd('0x1b')],_0x2a7a3a=_0x23d227['offset'],_0x57e899=_0x23d227[_0x1edd('0x1c')]+_0x23d227['limit'],_0x361a9b;if(_0x57e899>=_0x50ca04){_0x57e899=_0x50ca04;_0x361a9b=0xc8;}else{_0x361a9b=0xce;}_0x398cd9['status'](_0x361a9b);return _0x398cd9[_0x1edd('0x1d')](_0x1edd('0x1e'),_0x2a7a3a+'-'+_0x57e899+'/'+_0x50ca04)['json'](_0xc8d3c5);}return null;};}function patchUpdates(_0x5176de){return function(_0xda1c77){try{jsonpatch[_0x1edd('0x1f')](_0xda1c77,_0x5176de,!![]);}catch(_0x16afbd){return BPromise[_0x1edd('0x20')](_0x16afbd);}return _0xda1c77[_0x1edd('0x21')]();};}function saveUpdates(_0x1a3076,_0x53e9f6){return function(_0x5796d0){if(_0x5796d0){return _0x5796d0[_0x1edd('0x22')](_0x1a3076)[_0x1edd('0x23')](function(_0x2d8567){return _0x2d8567;});}return null;};}function removeEntity(_0x5b3de9,_0x87b457){return function(_0x1ca277){if(_0x1ca277){return _0x1ca277[_0x1edd('0x24')]()['then'](function(){var _0xb3def6=_0x1ca277[_0x1edd('0x25')]({'plain':!![]});var _0x3b8c01=_0x1edd('0x26');return db[_0x1edd('0x27')][_0x1edd('0x24')]({'where':{'type':_0x3b8c01,'resourceId':_0xb3def6['id']}})[_0x1edd('0x23')](function(){return _0x1ca277;});})[_0x1edd('0x23')](function(){_0x5b3de9['status'](0xcc)[_0x1edd('0x18')]();});}};}function handleEntityNotFound(_0x5d0e37,_0x4ce721){return function(_0xb26b16){if(!_0xb26b16){_0x5d0e37['sendStatus'](0x194);}return _0xb26b16;};}function handleError(_0x53bd9e,_0x59ae8e){_0x59ae8e=_0x59ae8e||0x1f4;return function(_0x351460){logger[_0x1edd('0x28')](_0x351460[_0x1edd('0x29')]);if(_0x351460['name']){delete _0x351460[_0x1edd('0x2a')];}_0x53bd9e['status'](_0x59ae8e)[_0x1edd('0x2b')](_0x351460);};}exports['index']=function(_0x33980d,_0x428e15){var _0x1b9c92={},_0x36087a={},_0x321fb2={'count':0x0,'rows':[]};var _0x1ca904=_[_0x1edd('0x2c')](db[_0x1edd('0x2d')][_0x1edd('0x2e')],function(_0xe64e72){return{'name':_0xe64e72['fieldName'],'type':_0xe64e72['type'][_0x1edd('0x2f')]};});_0x36087a['model']=_[_0x1edd('0x2c')](_0x1ca904,_0x1edd('0x2a'));_0x36087a['query']=_[_0x1edd('0x30')](_0x33980d['query']);_0x36087a[_0x1edd('0x31')]=_[_0x1edd('0x32')](_0x36087a[_0x1edd('0x33')],_0x36087a[_0x1edd('0x34')]);_0x1b9c92[_0x1edd('0x35')]=_[_0x1edd('0x32')](_0x36087a[_0x1edd('0x33')],qs[_0x1edd('0x36')](_0x33980d[_0x1edd('0x34')][_0x1edd('0x36')]));_0x1b9c92[_0x1edd('0x35')]=_0x1b9c92['attributes']['length']?_0x1b9c92['attributes']:_0x36087a[_0x1edd('0x33')];if(!_0x33980d[_0x1edd('0x34')][_0x1edd('0x37')](_0x1edd('0x38'))){_0x1b9c92[_0x1edd('0x39')]=qs['limit'](_0x33980d[_0x1edd('0x34')][_0x1edd('0x39')]);_0x1b9c92[_0x1edd('0x1c')]=qs[_0x1edd('0x1c')](_0x33980d[_0x1edd('0x34')]['offset']);}_0x1b9c92['order']=qs[_0x1edd('0x3a')](_0x33980d['query']['sort']);_0x1b9c92[_0x1edd('0x3b')]=qs[_0x1edd('0x31')](_['pick'](_0x33980d[_0x1edd('0x34')],_0x36087a['filters']));if(_0x33980d[_0x1edd('0x34')][_0x1edd('0x3c')]){_0x1b9c92[_0x1edd('0x3b')]=_[_0x1edd('0x3d')](_0x1b9c92[_0x1edd('0x3b')],{'$or':_[_0x1edd('0x2c')](_0x1ca904,function(_0x504e9d){if(_0x504e9d[_0x1edd('0x3e')]!=='VIRTUAL'){var _0xb4a9a4={};_0xb4a9a4[_0x504e9d[_0x1edd('0x2a')]]={'$like':'%'+_0x33980d['query'][_0x1edd('0x3c')]+'%'};return _0xb4a9a4;}})});}_0x1b9c92=_[_0x1edd('0x3d')]({},_0x1b9c92,_0x33980d[_0x1edd('0x3f')]);var _0x448b2d={'where':_0x1b9c92[_0x1edd('0x3b')]};return db[_0x1edd('0x2d')][_0x1edd('0x1b')](_0x448b2d)[_0x1edd('0x23')](function(_0x1212f6){_0x321fb2[_0x1edd('0x1b')]=_0x1212f6;if(_0x33980d['query']['includeAll']){_0x1b9c92[_0x1edd('0x40')]=[{'all':!![]}];}return db[_0x1edd('0x2d')][_0x1edd('0x41')](_0x1b9c92);})[_0x1edd('0x23')](function(_0x4019b0){_0x321fb2[_0x1edd('0x42')]=_0x4019b0;return _0x321fb2;})[_0x1edd('0x23')](respondWithFilteredResult(_0x428e15,_0x1b9c92))[_0x1edd('0x43')](handleError(_0x428e15,null));};exports['show']=function(_0x219a16,_0x34b4fc){var _0x1e32fd={'raw':![],'where':{'id':_0x219a16[_0x1edd('0x44')]['id']}},_0x4106b6={};_0x4106b6[_0x1edd('0x33')]=_[_0x1edd('0x30')](db[_0x1edd('0x2d')][_0x1edd('0x2e')]);_0x4106b6[_0x1edd('0x34')]=_[_0x1edd('0x30')](_0x219a16['query']);_0x4106b6['filters']=_['intersection'](_0x4106b6['model'],_0x4106b6[_0x1edd('0x34')]);_0x1e32fd['attributes']=_[_0x1edd('0x32')](_0x4106b6[_0x1edd('0x33')],qs[_0x1edd('0x36')](_0x219a16[_0x1edd('0x34')][_0x1edd('0x36')]));_0x1e32fd[_0x1edd('0x35')]=_0x1e32fd[_0x1edd('0x35')][_0x1edd('0x45')]?_0x1e32fd[_0x1edd('0x35')]:_0x4106b6[_0x1edd('0x33')];if(_0x219a16[_0x1edd('0x34')]['includeAll']){_0x1e32fd['include']=[{'all':!![]}];}_0x1e32fd=_[_0x1edd('0x3d')]({},_0x1e32fd,_0x219a16[_0x1edd('0x3f')]);return db[_0x1edd('0x2d')][_0x1edd('0x46')](_0x1e32fd)[_0x1edd('0x23')](handleEntityNotFound(_0x34b4fc,null))[_0x1edd('0x23')](respondWithResult(_0x34b4fc,null))[_0x1edd('0x43')](handleError(_0x34b4fc,null));};exports['create']=function(_0x8c511,_0x3fcc8c){return db['Schedule'][_0x1edd('0x47')](_0x8c511[_0x1edd('0x48')],{})['then'](function(_0x2c7d50){var _0x412270=_0x8c511[_0x1edd('0x49')][_0x1edd('0x25')]({'plain':!![]});if(!_0x412270)throw new Error(_0x1edd('0x4a'));if(_0x412270[_0x1edd('0x4b')]===_0x1edd('0x49')){var _0x52fa22=_0x2c7d50[_0x1edd('0x25')]({'plain':!![]});var _0xbc8b98='Scheduler';return db[_0x1edd('0x4c')]['find']({'where':{'name':_0xbc8b98,'userProfileId':_0x412270[_0x1edd('0x4d')]},'raw':!![]})[_0x1edd('0x23')](function(_0x19fdd4){if(_0x19fdd4&&_0x19fdd4[_0x1edd('0x4e')]===0x0){return db[_0x1edd('0x27')][_0x1edd('0x47')]({'name':_0x52fa22[_0x1edd('0x2a')],'resourceId':_0x52fa22['id'],'type':_0x19fdd4['name'],'sectionId':_0x19fdd4['id']},{})['then'](function(){return _0x2c7d50;});}else{return _0x2c7d50;}})['catch'](function(_0x3019ba){logger[_0x1edd('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3019ba);throw _0x3019ba;});}return _0x2c7d50;})[_0x1edd('0x23')](respondWithResult(_0x3fcc8c,0xc9))[_0x1edd('0x43')](handleError(_0x3fcc8c,null));};exports[_0x1edd('0x22')]=function(_0x506a59,_0x166677){if(_0x506a59[_0x1edd('0x48')]['id']){delete _0x506a59[_0x1edd('0x48')]['id'];}return db['Schedule'][_0x1edd('0x46')]({'where':{'id':_0x506a59[_0x1edd('0x44')]['id']}})[_0x1edd('0x23')](handleEntityNotFound(_0x166677,null))[_0x1edd('0x23')](saveUpdates(_0x506a59['body'],null))[_0x1edd('0x23')](respondWithResult(_0x166677,null))['catch'](handleError(_0x166677,null));};exports['destroy']=function(_0x570b13,_0x126c18){return db[_0x1edd('0x2d')][_0x1edd('0x46')]({'where':{'id':_0x570b13[_0x1edd('0x44')]['id']}})[_0x1edd('0x23')](handleEntityNotFound(_0x126c18,null))['then'](removeEntity(_0x126c18,null))[_0x1edd('0x43')](handleError(_0x126c18,null));};exports[_0x1edd('0x4f')]=function(_0x1978b1,_0x2b0ca5,_0x5a4e4a){var _0xad03f=require(_0x1edd('0x50'));return db[_0x1edd('0x2d')][_0x1edd('0x46')]({'where':{'id':_0x1978b1['params']['id']},'raw':!![]})[_0x1edd('0x23')](handleEntityNotFound(_0x2b0ca5,null))[_0x1edd('0x23')](function(){_0xad03f[_0x1edd('0x4f')](_0x1978b1[_0x1edd('0x44')]['id']);})[_0x1edd('0x23')](respondWithStatusCode(_0x2b0ca5,null))[_0x1edd('0x43')](handleError(_0x2b0ca5,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index f7214ed..0c8aff6 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 _0x3a76=['request-promise','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x15497f,_0x15ecb3){var _0x3dff4e=function(_0x539f9c){while(--_0x539f9c){_0x15497f['push'](_0x15497f['shift']());}};_0x3dff4e(++_0x15ecb3);}(_0x3a76,0x1db));var _0x63a7=function(_0x262255,_0x5a34ca){_0x262255=_0x262255-0x0;var _0xecc922=_0x3a76[_0x262255];return _0xecc922;};'use strict';var _=require(_0x63a7('0x0'));var util=require(_0x63a7('0x1'));var logger=require(_0x63a7('0x2'))(_0x63a7('0x3'));var moment=require(_0x63a7('0x4'));var BPromise=require(_0x63a7('0x5'));var rp=require(_0x63a7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x63a7('0x7'));var config=require(_0x63a7('0x8'));var attributes=require(_0x63a7('0x9'));module[_0x63a7('0xa')]=function(_0x59e4a6,_0x26d273){return _0x59e4a6[_0x63a7('0xb')](_0x63a7('0xc'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cc8=['./schedule.attributes','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0x4cc8,0xad));var _0x84cc=function(_0x4a6ccf,_0x10207a){_0x4a6ccf=_0x4a6ccf-0x0;var _0xb86376=_0x4cc8[_0x4a6ccf];return _0xb86376;};'use strict';var _=require(_0x84cc('0x0'));var util=require(_0x84cc('0x1'));var logger=require(_0x84cc('0x2'))(_0x84cc('0x3'));var moment=require(_0x84cc('0x4'));var BPromise=require(_0x84cc('0x5'));var rp=require(_0x84cc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84cc('0x7'));var config=require(_0x84cc('0x8'));var attributes=require(_0x84cc('0x9'));module['exports']=function(_0x4c8d7a,_0x1fe534){return _0x4c8d7a[_0x84cc('0xa')](_0x84cc('0xb'),attributes,{'tableName':_0x84cc('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 c39a219..e1ca0f1 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 _0x0da5=['debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent'];(function(_0x8bca3f,_0x158cf8){var _0x448ab5=function(_0x5b5537){while(--_0x5b5537){_0x8bca3f['push'](_0x8bca3f['shift']());}};_0x448ab5(++_0x158cf8);}(_0x0da5,0xd6));var _0x50da=function(_0xf698c5,_0x50e4b0){_0xf698c5=_0xf698c5-0x0;var _0x5845fa=_0x0da5[_0xf698c5];return _0x5845fa;};'use strict';var _=require(_0x50da('0x0'));var util=require(_0x50da('0x1'));var moment=require(_0x50da('0x2'));var BPromise=require(_0x50da('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x50da('0x4'));var db=require(_0x50da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x50da('0x6'))(_0x50da('0x7'));var config=require(_0x50da('0x8'));var jayson=require(_0x50da('0x9'));var client=jayson[_0x50da('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45f74e,_0x41e445,_0x37be4c){return new BPromise(function(_0x407dc0,_0x2afb5e){return client[_0x50da('0xb')](_0x45f74e,_0x37be4c)[_0x50da('0xc')](function(_0x21f8f3){logger[_0x50da('0xd')](_0x50da('0xe'),_0x41e445,_0x50da('0xf'));logger[_0x50da('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x41e445,_0x50da('0xf'),JSON[_0x50da('0x11')](_0x21f8f3));if(_0x21f8f3[_0x50da('0x12')]){if(_0x21f8f3['error'][_0x50da('0x13')]===0x1f4){logger[_0x50da('0x12')](_0x50da('0xe'),_0x41e445,_0x21f8f3['error'][_0x50da('0x14')]);return _0x2afb5e(_0x21f8f3[_0x50da('0x12')][_0x50da('0x14')]);}logger[_0x50da('0x12')](_0x50da('0xe'),_0x41e445,_0x21f8f3[_0x50da('0x12')][_0x50da('0x14')]);return _0x407dc0(_0x21f8f3[_0x50da('0x12')]['message']);}else{logger[_0x50da('0xd')](_0x50da('0xe'),_0x41e445,_0x50da('0xf'));_0x407dc0(_0x21f8f3[_0x50da('0x15')][_0x50da('0x14')]);}})[_0x50da('0x16')](function(_0x3736a2){logger[_0x50da('0x12')](_0x50da('0xe'),_0x41e445,_0x3736a2);_0x2afb5e(_0x3736a2);});});} \ No newline at end of file +var _0x6c28=['jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x42b31f,_0x404c73){var _0x473be7=function(_0x1ca5c3){while(--_0x1ca5c3){_0x42b31f['push'](_0x42b31f['shift']());}};_0x473be7(++_0x404c73);}(_0x6c28,0x124));var _0x86c2=function(_0x5b93d3,_0x58cc35){_0x5b93d3=_0x5b93d3-0x0;var _0x21857c=_0x6c28[_0x5b93d3];return _0x21857c;};'use strict';var _=require('lodash');var util=require(_0x86c2('0x0'));var moment=require(_0x86c2('0x1'));var BPromise=require(_0x86c2('0x2'));var rs=require(_0x86c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86c2('0x4'))['db'];var utils=require(_0x86c2('0x5'));var logger=require(_0x86c2('0x6'))(_0x86c2('0x7'));var config=require('../../config/environment');var jayson=require(_0x86c2('0x8'));var client=jayson[_0x86c2('0x9')][_0x86c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b7691,_0x9ba273,_0x27c52d){return new BPromise(function(_0x1d8535,_0xfbd339){return client[_0x86c2('0xb')](_0x1b7691,_0x27c52d)[_0x86c2('0xc')](function(_0x44fb99){logger['info'](_0x86c2('0xd'),_0x9ba273,'request\x20sent');logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x9ba273,_0x86c2('0xe'),JSON['stringify'](_0x44fb99));if(_0x44fb99['error']){if(_0x44fb99[_0x86c2('0xf')]['code']===0x1f4){logger[_0x86c2('0xf')]('Schedule,\x20%s,\x20%s',_0x9ba273,_0x44fb99['error']['message']);return _0xfbd339(_0x44fb99[_0x86c2('0xf')]['message']);}logger[_0x86c2('0xf')]('Schedule,\x20%s,\x20%s',_0x9ba273,_0x44fb99[_0x86c2('0xf')]['message']);return _0x1d8535(_0x44fb99['error'][_0x86c2('0x10')]);}else{logger[_0x86c2('0x11')](_0x86c2('0xd'),_0x9ba273,'request\x20sent');_0x1d8535(_0x44fb99[_0x86c2('0x12')][_0x86c2('0x10')]);}})[_0x86c2('0x13')](function(_0x266a86){logger[_0x86c2('0xf')](_0x86c2('0xd'),_0x9ba273,_0x266a86);_0xfbd339(_0x266a86);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 976328d..1113e8d 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 _0x1910=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','download','post','create'];(function(_0x1024c2,_0x2b19fe){var _0x54ae4a=function(_0xdcce58){while(--_0xdcce58){_0x1024c2['push'](_0x1024c2['shift']());}};_0x54ae4a(++_0x2b19fe);}(_0x1910,0x1a8));var _0x0191=function(_0x424e2c,_0x5bf253){_0x424e2c=_0x424e2c-0x0;var _0x5cea9f=_0x1910[_0x424e2c];return _0x5cea9f;};'use strict';var multer=require(_0x0191('0x0'));var util=require(_0x0191('0x1'));var path=require(_0x0191('0x2'));var timeout=require(_0x0191('0x3'));var express=require('express');var router=express[_0x0191('0x4')]();var auth=require(_0x0191('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0191('0x6'));var controller=require(_0x0191('0x7'));router[_0x0191('0x8')]('/',auth[_0x0191('0x9')](),controller[_0x0191('0xa')]);router[_0x0191('0x8')](_0x0191('0xb'),auth['isAuthenticated'](),controller[_0x0191('0xc')]);router[_0x0191('0x8')]('/:id',auth[_0x0191('0x9')](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x0191('0xd')]);router[_0x0191('0xe')]('/',auth['isAuthenticated'](),controller[_0x0191('0xf')]);router[_0x0191('0x10')](_0x0191('0x11'),auth[_0x0191('0x9')](),controller[_0x0191('0x12')]);router[_0x0191('0x13')](_0x0191('0x11'),auth[_0x0191('0x9')](),controller[_0x0191('0x14')]);module[_0x0191('0x15')]=router; \ No newline at end of file +var _0x3bbe=['get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller'];(function(_0x20fb86,_0x5cc07f){var _0x4cce41=function(_0x3034be){while(--_0x3034be){_0x20fb86['push'](_0x20fb86['shift']());}};_0x4cce41(++_0x5cc07f);}(_0x3bbe,0x166));var _0xe3bb=function(_0x5a2358,_0x16bfff){_0x5a2358=_0x5a2358-0x0;var _0x2be9f1=_0x3bbe[_0x5a2358];return _0x2be9f1;};'use strict';var multer=require(_0xe3bb('0x0'));var util=require(_0xe3bb('0x1'));var path=require(_0xe3bb('0x2'));var timeout=require(_0xe3bb('0x3'));var express=require(_0xe3bb('0x4'));var router=express[_0xe3bb('0x5')]();var auth=require(_0xe3bb('0x6'));var interaction=require(_0xe3bb('0x7'));var config=require(_0xe3bb('0x8'));var controller=require(_0xe3bb('0x9'));router[_0xe3bb('0xa')]('/',auth[_0xe3bb('0xb')](),controller[_0xe3bb('0xc')]);router[_0xe3bb('0xa')]('/describe',auth[_0xe3bb('0xb')](),controller['describe']);router[_0xe3bb('0xa')](_0xe3bb('0xd'),auth[_0xe3bb('0xb')](),controller[_0xe3bb('0xe')]);router[_0xe3bb('0xa')](_0xe3bb('0xf'),auth[_0xe3bb('0xb')](),controller[_0xe3bb('0x10')]);router[_0xe3bb('0x11')]('/',auth['isAuthenticated'](),controller[_0xe3bb('0x12')]);router['put'](_0xe3bb('0xd'),auth[_0xe3bb('0xb')](),controller[_0xe3bb('0x13')]);router[_0xe3bb('0x14')](_0xe3bb('0xd'),auth[_0xe3bb('0xb')](),controller[_0xe3bb('0x15')]);module[_0xe3bb('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 664b43d..c5381ab 100644 --- a/server/api/screenRecording/screenRecording.attributes.js +++ b/server/api/screenRecording/screenRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8958=['INTEGER','setDataValue','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','moment','getDataValue','extname','value','STRING','replace'];(function(_0x4c3070,_0xc2fb4c){var _0x536a44=function(_0x1412a5){while(--_0x1412a5){_0x4c3070['push'](_0x4c3070['shift']());}};_0x536a44(++_0xc2fb4c);}(_0x8958,0x93));var _0x8895=function(_0xf0b519,_0x39731e){_0xf0b519=_0xf0b519-0x0;var _0x249fd4=_0x8958[_0xf0b519];return _0x249fd4;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8895('0x0'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8895('0x1')]('value')?path[_0x8895('0x2')](this[_0x8895('0x1')](_0x8895('0x3'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8895('0x4')]},'value':{'type':Sequelize[_0x8895('0x4')],'set':function(_0x124e1e){var _0x40cec6=_0x124e1e[_0x8895('0x5')](/\\/g,'/');this['setDataValue'](_0x8895('0x3'),_0x40cec6);}},'rating':{'type':Sequelize[_0x8895('0x6')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8895('0x6')],'set':function(_0x24fe49){this[_0x8895('0x7')](_0x8895('0x8'),moment()[_0x8895('0x9')](_0x24fe49,'ms'));this[_0x8895('0x7')](_0x8895('0xa'),moment());this[_0x8895('0x7')]('duration',_0x24fe49);}},'startedAt':{'type':Sequelize[_0x8895('0xb')],'get':function(){return moment(this[_0x8895('0x1')](_0x8895('0x8')))[_0x8895('0xc')](_0x8895('0xd'))[_0x8895('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8895('0x1')](_0x8895('0xa')))[_0x8895('0xc')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x8895('0xb')],'get':function(){return moment(this['getDataValue'](_0x8895('0xf')))[_0x8895('0xc')](_0x8895('0xd'))[_0x8895('0xe')]();}},'updatedAt':{'type':Sequelize[_0x8895('0xb')],'get':function(){return moment(this['getDataValue'](_0x8895('0x10')))[_0x8895('0xc')](_0x8895('0xd'))[_0x8895('0xe')]();}}}; \ No newline at end of file +var _0xa41a=['toString','updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','MM-DD-YYYY\x20HH:mm','format','createdAt'];(function(_0x1720eb,_0x49d2fb){var _0x191137=function(_0x26ead5){while(--_0x26ead5){_0x1720eb['push'](_0x1720eb['shift']());}};_0x191137(++_0x49d2fb);}(_0xa41a,0x6b));var _0xaa41=function(_0x34d5b3,_0x4b8633){_0x34d5b3=_0x34d5b3-0x0;var _0xa388a4=_0xa41a[_0x34d5b3];return _0xa388a4;};'use strict';var Sequelize=require(_0xaa41('0x0'));var moment=require(_0xaa41('0x1'));var path=require('path');var config=require(_0xaa41('0x2'));module[_0xaa41('0x3')]={'format':{'type':Sequelize[_0xaa41('0x4')],'get':function(){return this[_0xaa41('0x5')](_0xaa41('0x6'))?path[_0xaa41('0x7')](this[_0xaa41('0x5')](_0xaa41('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaa41('0x8')]},'value':{'type':Sequelize[_0xaa41('0x8')],'set':function(_0x54bc5a){var _0x5b1fff=_0x54bc5a[_0xaa41('0x9')](/\\/g,'/');this[_0xaa41('0xa')]('value',_0x5b1fff);}},'rating':{'type':Sequelize[_0xaa41('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xaa41('0xb')],'set':function(_0x409dab){this[_0xaa41('0xa')](_0xaa41('0xc'),moment()[_0xaa41('0xd')](_0x409dab,'ms'));this[_0xaa41('0xa')](_0xaa41('0xe'),moment());this[_0xaa41('0xa')]('duration',_0x409dab);}},'startedAt':{'type':Sequelize[_0xaa41('0xf')],'get':function(){return moment(this[_0xaa41('0x5')]('startedAt'))['format'](_0xaa41('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0xaa41('0xf')],'get':function(){return moment(this[_0xaa41('0x5')](_0xaa41('0xe')))[_0xaa41('0x11')](_0xaa41('0x10'))['toString']();}},'createdAt':{'type':Sequelize[_0xaa41('0xf')],'get':function(){return moment(this[_0xaa41('0x5')](_0xaa41('0x12')))[_0xaa41('0x11')](_0xaa41('0x10'))[_0xaa41('0x13')]();}},'updatedAt':{'type':Sequelize[_0xaa41('0xf')],'get':function(){return moment(this['getDataValue'](_0xaa41('0x14')))[_0xaa41('0x11')](_0xaa41('0x10'))[_0xaa41('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 3d3cfa6..6edd3d2 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 _0xfeb8=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','offset','limit','status','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','Not\x20found','Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','html-pdf','fast-json-patch','moment','bluebird','mustache','util','sox','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x2b18ba,_0x5bbe72){var _0x5db9a2=function(_0x59f702){while(--_0x59f702){_0x2b18ba['push'](_0x2b18ba['shift']());}};_0x5db9a2(++_0x5bbe72);}(_0xfeb8,0xab));var _0x8feb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfeb8[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x8feb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8feb('0x1'));var rp=require('request-promise');var moment=require(_0x8feb('0x2'));var BPromise=require(_0x8feb('0x3'));var Mustache=require(_0x8feb('0x4'));var util=require(_0x8feb('0x5'));var path=require('path');var sox=require(_0x8feb('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8feb('0x7'));var squel=require(_0x8feb('0x8'));var crypto=require('crypto');var jsforce=require(_0x8feb('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x8feb('0xa'));var querystring=require('querystring');var Papa=require(_0x8feb('0xb'));var Redis=require(_0x8feb('0xc'));var authService=require(_0x8feb('0xd'));var qs=require(_0x8feb('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8feb('0xf'));var logger=require(_0x8feb('0x10'))(_0x8feb('0x11'));var utils=require(_0x8feb('0x12'));var config=require('../../config/environment');var db=require(_0x8feb('0x13'))['db'];function respondWithStatusCode(_0x4d3bf7,_0x16b527){_0x16b527=_0x16b527||0xcc;return function(_0x3e42cb){if(_0x3e42cb){return _0x4d3bf7['sendStatus'](_0x16b527);}return _0x4d3bf7['status'](_0x16b527)['end']();};}function respondWithResult(_0x3a8992,_0x44b377){_0x44b377=_0x44b377||0xc8;return function(_0x1d124e){if(_0x1d124e){return _0x3a8992['status'](_0x44b377)['json'](_0x1d124e);}};}function respondWithFilteredResult(_0x2f9fd5,_0x1e378b){return function(_0x33ba9a){if(_0x33ba9a){var _0x2d0c48=_0x33ba9a['count'],_0x352ea9=_0x1e378b['offset'],_0x250318=_0x1e378b[_0x8feb('0x14')]+_0x1e378b[_0x8feb('0x15')],_0x5a2571;if(_0x250318>=_0x2d0c48){_0x250318=_0x2d0c48;_0x5a2571=0xc8;}else{_0x5a2571=0xce;}_0x2f9fd5[_0x8feb('0x16')](_0x5a2571);return _0x2f9fd5['set']('Content-Range',_0x352ea9+'-'+_0x250318+'/'+_0x2d0c48)['json'](_0x33ba9a);}return null;};}function patchUpdates(_0x326a97){return function(_0x212d79){try{jsonpatch[_0x8feb('0x17')](_0x212d79,_0x326a97,!![]);}catch(_0x446d96){return BPromise[_0x8feb('0x18')](_0x446d96);}return _0x212d79['save']();};}function saveUpdates(_0xd75e92,_0x316c0c){return function(_0x2fbeb2){if(_0x2fbeb2){return _0x2fbeb2[_0x8feb('0x19')](_0xd75e92)[_0x8feb('0x1a')](function(_0x220a08){return _0x220a08;});}return null;};}function removeEntity(_0x239ecc,_0x369a56){return function(_0x4aea68){if(_0x4aea68){return _0x4aea68[_0x8feb('0x1b')]()[_0x8feb('0x1a')](function(){_0x239ecc[_0x8feb('0x16')](0xcc)[_0x8feb('0x1c')]();});}};}function handleEntityNotFound(_0x5b00d4,_0x36c536){return function(_0x1c81e2){if(!_0x1c81e2){_0x5b00d4[_0x8feb('0x1d')](0x194);}return _0x1c81e2;};}function handleError(_0x123b0d,_0x2a6acc){_0x2a6acc=_0x2a6acc||0x1f4;return function(_0x4d1209){logger[_0x8feb('0x1e')](_0x4d1209[_0x8feb('0x1f')]);if(_0x4d1209[_0x8feb('0x20')]){delete _0x4d1209[_0x8feb('0x20')];}_0x123b0d['status'](_0x2a6acc)[_0x8feb('0x21')](_0x4d1209);};}exports[_0x8feb('0x22')]=function(_0x3e080c,_0x1bbbb6){var _0x2f0ffa={},_0x48bf5e={},_0x28edce={'count':0x0,'rows':[]};var _0x32ac80=_[_0x8feb('0x23')](db[_0x8feb('0x24')][_0x8feb('0x25')],function(_0x38e171){return{'name':_0x38e171[_0x8feb('0x26')],'type':_0x38e171[_0x8feb('0x27')][_0x8feb('0x28')]};});_0x48bf5e[_0x8feb('0x29')]=_['differenceBy'](_[_0x8feb('0x23')](_0x32ac80,_0x8feb('0x20')),[_0x8feb('0x2a')]);_0x48bf5e['query']=_[_0x8feb('0x2b')](_0x3e080c[_0x8feb('0x2c')]);_0x48bf5e[_0x8feb('0x2d')]=_['intersection'](_0x48bf5e[_0x8feb('0x29')],_0x48bf5e[_0x8feb('0x2c')]);_0x2f0ffa[_0x8feb('0x2e')]=_[_0x8feb('0x2f')](_0x48bf5e[_0x8feb('0x29')],qs[_0x8feb('0x30')](_0x3e080c[_0x8feb('0x2c')][_0x8feb('0x30')]));_0x2f0ffa[_0x8feb('0x2e')]=_0x2f0ffa[_0x8feb('0x2e')][_0x8feb('0x31')]?_0x2f0ffa[_0x8feb('0x2e')]:_0x48bf5e[_0x8feb('0x29')];if(!_0x3e080c['query']['hasOwnProperty'](_0x8feb('0x32'))){_0x2f0ffa[_0x8feb('0x15')]=qs[_0x8feb('0x15')](_0x3e080c[_0x8feb('0x2c')][_0x8feb('0x15')]);_0x2f0ffa[_0x8feb('0x14')]=qs[_0x8feb('0x14')](_0x3e080c[_0x8feb('0x2c')][_0x8feb('0x14')]);}_0x2f0ffa['order']=qs['sort'](_0x3e080c['query'][_0x8feb('0x33')]);_0x2f0ffa[_0x8feb('0x34')]=qs[_0x8feb('0x2d')](_['pick'](_0x3e080c[_0x8feb('0x2c')],_0x48bf5e['filters']));if(_0x3e080c['query'][_0x8feb('0x35')]){_0x2f0ffa[_0x8feb('0x34')]=_[_0x8feb('0x36')](_0x2f0ffa[_0x8feb('0x34')],{'$or':_[_0x8feb('0x23')](_0x32ac80,function(_0x7ffd11){if(_0x7ffd11[_0x8feb('0x27')]!==_0x8feb('0x37')){var _0x87560a={};_0x87560a[_0x7ffd11[_0x8feb('0x20')]]={'$like':'%'+_0x3e080c[_0x8feb('0x2c')][_0x8feb('0x35')]+'%'};return _0x87560a;}})});}_0x2f0ffa=_['merge']({},_0x2f0ffa,_0x3e080c[_0x8feb('0x38')]);var _0x350823={'where':_0x2f0ffa[_0x8feb('0x34')]};return db['ScreenRecording'][_0x8feb('0x39')](_0x350823)[_0x8feb('0x1a')](function(_0x5e0931){_0x28edce[_0x8feb('0x39')]=_0x5e0931;if(_0x3e080c[_0x8feb('0x2c')][_0x8feb('0x3a')]){_0x2f0ffa[_0x8feb('0x3b')]=[{'all':!![]}];}return db[_0x8feb('0x24')][_0x8feb('0x3c')](_0x2f0ffa);})['then'](function(_0x2f0e88){_0x28edce[_0x8feb('0x3d')]=_0x2f0e88;return _0x28edce;})[_0x8feb('0x1a')](respondWithFilteredResult(_0x1bbbb6,_0x2f0ffa))[_0x8feb('0x3e')](handleError(_0x1bbbb6,null));};exports[_0x8feb('0x3f')]=function(_0x4307c7,_0x3e8697){var _0x21ccdc={'raw':![],'where':{'id':_0x4307c7[_0x8feb('0x40')]['id']}},_0x5c2731={};_0x5c2731['model']=_[_0x8feb('0x2b')](db[_0x8feb('0x24')][_0x8feb('0x25')]);_0x5c2731[_0x8feb('0x2c')]=_[_0x8feb('0x2b')](_0x4307c7[_0x8feb('0x2c')]);_0x5c2731['filters']=_['intersection'](_0x5c2731[_0x8feb('0x29')],_0x5c2731['query']);_0x21ccdc[_0x8feb('0x2e')]=_['intersection'](_0x5c2731[_0x8feb('0x29')],qs[_0x8feb('0x30')](_0x4307c7[_0x8feb('0x2c')][_0x8feb('0x30')]));_0x21ccdc[_0x8feb('0x2e')]=_0x21ccdc[_0x8feb('0x2e')][_0x8feb('0x31')]?_0x21ccdc[_0x8feb('0x2e')]:_0x5c2731['model'];if(_0x4307c7[_0x8feb('0x2c')][_0x8feb('0x3a')]){_0x21ccdc[_0x8feb('0x3b')]=[{'all':!![]}];}_0x21ccdc=_[_0x8feb('0x36')]({},_0x21ccdc,_0x4307c7[_0x8feb('0x38')]);return db[_0x8feb('0x24')][_0x8feb('0x41')](_0x21ccdc)[_0x8feb('0x1a')](handleEntityNotFound(_0x3e8697,null))[_0x8feb('0x1a')](respondWithResult(_0x3e8697,null))[_0x8feb('0x3e')](handleError(_0x3e8697,null));};exports['create']=function(_0x2ed71e,_0x4275b4){return db[_0x8feb('0x24')][_0x8feb('0x42')](_0x2ed71e[_0x8feb('0x43')],{})[_0x8feb('0x1a')](respondWithResult(_0x4275b4,0xc9))[_0x8feb('0x3e')](handleError(_0x4275b4,null));};exports[_0x8feb('0x19')]=function(_0x411e32,_0x571adf){if(_0x411e32['body']['id']){delete _0x411e32[_0x8feb('0x43')]['id'];}delete _0x411e32['body'][_0x8feb('0x44')];delete _0x411e32[_0x8feb('0x43')][_0x8feb('0x45')];delete _0x411e32[_0x8feb('0x43')][_0x8feb('0x46')];delete _0x411e32[_0x8feb('0x43')][_0x8feb('0x47')];return db['ScreenRecording'][_0x8feb('0x41')]({'where':{'id':_0x411e32[_0x8feb('0x40')]['id']}})[_0x8feb('0x1a')](handleEntityNotFound(_0x571adf,null))[_0x8feb('0x1a')](saveUpdates(_0x411e32['body'],null))[_0x8feb('0x1a')](respondWithResult(_0x571adf,null))[_0x8feb('0x3e')](handleError(_0x571adf,null));};exports[_0x8feb('0x48')]=function(_0x21918b,_0x4922af){return db[_0x8feb('0x24')][_0x8feb('0x48')]()[_0x8feb('0x1a')](respondWithResult(_0x4922af,null))[_0x8feb('0x3e')](handleError(_0x4922af,null));};exports[_0x8feb('0x49')]=function(_0x1372a7,_0x1d2ca6,_0x363429){var _0x7c224b=require(_0x8feb('0x4a'));var _0x3a8097=![];var _0x513656={};if(_0x1372a7[_0x8feb('0x2c')][_0x8feb('0x27')]&&_0x1372a7[_0x8feb('0x2c')]['type']==='uniqueid'){_0x513656[_0x8feb('0x4b')]=_0x1372a7[_0x8feb('0x40')]['id'];}else{_0x513656['id']=_0x1372a7[_0x8feb('0x40')]['id'];}return db[_0x8feb('0x24')]['find']({'where':_0x513656,'attributes':['id',_0x8feb('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x1d2ca6,null))[_0x8feb('0x1a')](function(_0x5687d8){if(_0x5687d8){var _0x52dda8=path[_0x8feb('0x4c')](config[_0x8feb('0x4d')],_0x8feb('0x4e'),_0x5687d8['value']);var _0x215378=util[_0x8feb('0x2a')]('%s.cypher',_0x52dda8);if(fs[_0x8feb('0x4f')](_0x215378)){_0x3a8097=!![];return _0x7c224b['decryptFile'](_0x215378,_0x52dda8,config['secrets']['recording'])[_0x8feb('0x1a')](function(){return _0x5687d8;});}return _0x5687d8;}})[_0x8feb('0x1a')](function(_0x161b2a){if(_0x161b2a){var _0x593b5f=path[_0x8feb('0x4c')](config['root'],_0x8feb('0x4e'),_0x161b2a['value']);if(!fs[_0x8feb('0x4f')](_0x593b5f)){throw new db['Sequelize'][(_0x8feb('0x50'))](_0x8feb('0x51'));}if(_0x161b2a[_0x8feb('0x52')]){return _0x1d2ca6[_0x8feb('0x49')](_0x593b5f,_0x161b2a['filename']+path[_0x8feb('0x53')](_0x593b5f),function(){if(_0x3a8097){fs['unlink'](_0x593b5f);}});}else{return _0x1d2ca6[_0x8feb('0x49')](_0x593b5f,function(_0x3b1405){if(_0x3a8097){fs[_0x8feb('0x54')](_0x593b5f);}});}}})[_0x8feb('0x3e')](function(_0x27f711){if(_0x27f711['message']===_0x8feb('0x51')){_0x1d2ca6[_0x8feb('0x16')](0x194)[_0x8feb('0x21')](_0x8feb('0x55'));}else{return handleError(_0x1d2ca6,null);}});};exports[_0x8feb('0x1b')]=function(_0x5e1a7d,_0x24bf2f){return db[_0x8feb('0x24')]['find']({'where':{'id':_0x5e1a7d['params']['id']}})[_0x8feb('0x1a')](function(_0x1def6e){if(!_0x1def6e)throw new ReferenceError(_0x8feb('0x56'));return _0x1def6e;})[_0x8feb('0x1a')](function(_0x39de51){var _0x5185ae=path[_0x8feb('0x4c')](config[_0x8feb('0x4d')],_0x8feb('0x4e'),_0x39de51[_0x8feb('0x47')]);logger[_0x8feb('0x57')]('cancellazione\x20fisica\x20documento\x20%s',_0x5185ae);if(!_[_0x8feb('0x58')](_0x39de51[_0x8feb('0x47')])&&fs[_0x8feb('0x4f')](_0x5185ae)){logger['info']('File:\x20\x22'+_0x5185ae+_0x8feb('0x59'));fs[_0x8feb('0x5a')](_0x5185ae);}_0x5185ae=_0x5185ae+_0x8feb('0x5b');if(!_[_0x8feb('0x58')](_0x39de51[_0x8feb('0x47')])&&fs[_0x8feb('0x4f')](_0x5185ae)){logger['info'](_0x8feb('0x5c')+_0x5185ae+_0x8feb('0x59'));fs['unlinkSync'](_0x5185ae);}return _0x39de51;})[_0x8feb('0x1a')](function(_0x31244a){if(!_0x31244a)throw new InternalError();return _0x31244a[_0x8feb('0x1b')]();})['then'](function(){_0x24bf2f[_0x8feb('0x16')](0xcc)[_0x8feb('0x1c')]();})['catch'](handleError(_0x24bf2f,null));}; \ No newline at end of file +var _0x031a=['bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','send','index','map','rawAttributes','type','key','differenceBy','name','format','query','keys','filters','intersection','attributes','length','model','nolimit','sort','where','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','findAll','rows','show','params','fields','include','find','catch','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','root','server/files/screen_recordings','existsSync','decryptFile','join','Sequelize','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x56c834,_0x19fd90){var _0x13213d=function(_0x497008){while(--_0x497008){_0x56c834['push'](_0x56c834['shift']());}};_0x13213d(++_0x19fd90);}(_0x031a,0x1ea));var _0xa031=function(_0x50e4b1,_0x6c35e5){_0x50e4b1=_0x50e4b1-0x0;var _0x5cecae=_0x031a[_0x50e4b1];return _0x5cecae;};'use strict';var pdf=require(_0xa031('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa031('0x1'));var zipdir=require(_0xa031('0x2'));var jsonpatch=require(_0xa031('0x3'));var rp=require('request-promise');var moment=require(_0xa031('0x4'));var BPromise=require(_0xa031('0x5'));var Mustache=require(_0xa031('0x6'));var util=require(_0xa031('0x7'));var path=require(_0xa031('0x8'));var sox=require('sox');var csv=require(_0xa031('0x9'));var ejs=require(_0xa031('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa031('0xb'));var crypto=require(_0xa031('0xc'));var jsforce=require(_0xa031('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa031('0xe'));var Papa=require('papaparse');var Redis=require(_0xa031('0xf'));var authService=require(_0xa031('0x10'));var qs=require(_0xa031('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa031('0x12'))('api');var utils=require(_0xa031('0x13'));var config=require('../../config/environment');var db=require(_0xa031('0x14'))['db'];function respondWithStatusCode(_0x476de0,_0x40c597){_0x40c597=_0x40c597||0xcc;return function(_0x42d391){if(_0x42d391){return _0x476de0[_0xa031('0x15')](_0x40c597);}return _0x476de0[_0xa031('0x16')](_0x40c597)['end']();};}function respondWithResult(_0x3b94b1,_0x20270d){_0x20270d=_0x20270d||0xc8;return function(_0x46fa2f){if(_0x46fa2f){return _0x3b94b1['status'](_0x20270d)[_0xa031('0x17')](_0x46fa2f);}};}function respondWithFilteredResult(_0x3ab5c4,_0x256ccc){return function(_0x3501f8){if(_0x3501f8){var _0x1e9ca1=_0x3501f8[_0xa031('0x18')],_0x51d702=_0x256ccc[_0xa031('0x19')],_0x29e6a6=_0x256ccc[_0xa031('0x19')]+_0x256ccc[_0xa031('0x1a')],_0x55be2c;if(_0x29e6a6>=_0x1e9ca1){_0x29e6a6=_0x1e9ca1;_0x55be2c=0xc8;}else{_0x55be2c=0xce;}_0x3ab5c4[_0xa031('0x16')](_0x55be2c);return _0x3ab5c4[_0xa031('0x1b')](_0xa031('0x1c'),_0x51d702+'-'+_0x29e6a6+'/'+_0x1e9ca1)['json'](_0x3501f8);}return null;};}function patchUpdates(_0x3d301a){return function(_0x34563d){try{jsonpatch[_0xa031('0x1d')](_0x34563d,_0x3d301a,!![]);}catch(_0x124756){return BPromise[_0xa031('0x1e')](_0x124756);}return _0x34563d[_0xa031('0x1f')]();};}function saveUpdates(_0x1b74aa,_0x59e8d8){return function(_0x238b5f){if(_0x238b5f){return _0x238b5f[_0xa031('0x20')](_0x1b74aa)[_0xa031('0x21')](function(_0x17844e){return _0x17844e;});}return null;};}function removeEntity(_0x13e6c2,_0x171de0){return function(_0x4edc3f){if(_0x4edc3f){return _0x4edc3f[_0xa031('0x22')]()[_0xa031('0x21')](function(){_0x13e6c2[_0xa031('0x16')](0xcc)[_0xa031('0x23')]();});}};}function handleEntityNotFound(_0x532719,_0x341fe7){return function(_0x10a052){if(!_0x10a052){_0x532719[_0xa031('0x15')](0x194);}return _0x10a052;};}function handleError(_0x3d719c,_0x18546d){_0x18546d=_0x18546d||0x1f4;return function(_0x40f578){logger['error'](_0x40f578[_0xa031('0x24')]);if(_0x40f578['name']){delete _0x40f578['name'];}_0x3d719c['status'](_0x18546d)[_0xa031('0x25')](_0x40f578);};}exports[_0xa031('0x26')]=function(_0x2d49ea,_0x24807e){var _0x2c567c={},_0x52f133={},_0x12d9c4={'count':0x0,'rows':[]};var _0x5ec109=_[_0xa031('0x27')](db['ScreenRecording'][_0xa031('0x28')],function(_0x4d3994){return{'name':_0x4d3994['fieldName'],'type':_0x4d3994[_0xa031('0x29')][_0xa031('0x2a')]};});_0x52f133['model']=_[_0xa031('0x2b')](_[_0xa031('0x27')](_0x5ec109,_0xa031('0x2c')),[_0xa031('0x2d')]);_0x52f133[_0xa031('0x2e')]=_[_0xa031('0x2f')](_0x2d49ea[_0xa031('0x2e')]);_0x52f133[_0xa031('0x30')]=_[_0xa031('0x31')](_0x52f133['model'],_0x52f133[_0xa031('0x2e')]);_0x2c567c['attributes']=_[_0xa031('0x31')](_0x52f133['model'],qs['fields'](_0x2d49ea[_0xa031('0x2e')]['fields']));_0x2c567c[_0xa031('0x32')]=_0x2c567c[_0xa031('0x32')][_0xa031('0x33')]?_0x2c567c[_0xa031('0x32')]:_0x52f133[_0xa031('0x34')];if(!_0x2d49ea[_0xa031('0x2e')]['hasOwnProperty'](_0xa031('0x35'))){_0x2c567c[_0xa031('0x1a')]=qs[_0xa031('0x1a')](_0x2d49ea[_0xa031('0x2e')][_0xa031('0x1a')]);_0x2c567c[_0xa031('0x19')]=qs[_0xa031('0x19')](_0x2d49ea['query']['offset']);}_0x2c567c['order']=qs[_0xa031('0x36')](_0x2d49ea[_0xa031('0x2e')][_0xa031('0x36')]);_0x2c567c[_0xa031('0x37')]=qs['filters'](_['pick'](_0x2d49ea[_0xa031('0x2e')],_0x52f133[_0xa031('0x30')]));if(_0x2d49ea[_0xa031('0x2e')][_0xa031('0x38')]){_0x2c567c['where']=_[_0xa031('0x39')](_0x2c567c['where'],{'$or':_[_0xa031('0x27')](_0x5ec109,function(_0xebffa1){if(_0xebffa1[_0xa031('0x29')]!==_0xa031('0x3a')){var _0x51c791={};_0x51c791[_0xebffa1[_0xa031('0x2c')]]={'$like':'%'+_0x2d49ea[_0xa031('0x2e')][_0xa031('0x38')]+'%'};return _0x51c791;}})});}_0x2c567c=_[_0xa031('0x39')]({},_0x2c567c,_0x2d49ea[_0xa031('0x3b')]);var _0x4f4ed7={'where':_0x2c567c['where']};return db[_0xa031('0x3c')][_0xa031('0x18')](_0x4f4ed7)[_0xa031('0x21')](function(_0x100617){_0x12d9c4[_0xa031('0x18')]=_0x100617;if(_0x2d49ea[_0xa031('0x2e')][_0xa031('0x3d')]){_0x2c567c['include']=[{'all':!![]}];}return db[_0xa031('0x3c')][_0xa031('0x3e')](_0x2c567c);})[_0xa031('0x21')](function(_0x3ebfef){_0x12d9c4[_0xa031('0x3f')]=_0x3ebfef;return _0x12d9c4;})[_0xa031('0x21')](respondWithFilteredResult(_0x24807e,_0x2c567c))['catch'](handleError(_0x24807e,null));};exports[_0xa031('0x40')]=function(_0x332942,_0x546d5a){var _0x12d235={'raw':![],'where':{'id':_0x332942[_0xa031('0x41')]['id']}},_0x1fab73={};_0x1fab73[_0xa031('0x34')]=_[_0xa031('0x2f')](db[_0xa031('0x3c')][_0xa031('0x28')]);_0x1fab73[_0xa031('0x2e')]=_[_0xa031('0x2f')](_0x332942['query']);_0x1fab73[_0xa031('0x30')]=_[_0xa031('0x31')](_0x1fab73[_0xa031('0x34')],_0x1fab73['query']);_0x12d235[_0xa031('0x32')]=_[_0xa031('0x31')](_0x1fab73[_0xa031('0x34')],qs[_0xa031('0x42')](_0x332942[_0xa031('0x2e')]['fields']));_0x12d235[_0xa031('0x32')]=_0x12d235['attributes'][_0xa031('0x33')]?_0x12d235[_0xa031('0x32')]:_0x1fab73['model'];if(_0x332942['query'][_0xa031('0x3d')]){_0x12d235[_0xa031('0x43')]=[{'all':!![]}];}_0x12d235=_[_0xa031('0x39')]({},_0x12d235,_0x332942['options']);return db[_0xa031('0x3c')][_0xa031('0x44')](_0x12d235)[_0xa031('0x21')](handleEntityNotFound(_0x546d5a,null))[_0xa031('0x21')](respondWithResult(_0x546d5a,null))[_0xa031('0x45')](handleError(_0x546d5a,null));};exports[_0xa031('0x46')]=function(_0x186780,_0x23f4ca){return db[_0xa031('0x3c')][_0xa031('0x46')](_0x186780['body'],{})[_0xa031('0x21')](respondWithResult(_0x23f4ca,0xc9))[_0xa031('0x45')](handleError(_0x23f4ca,null));};exports[_0xa031('0x20')]=function(_0x4a43db,_0x394f0c){if(_0x4a43db[_0xa031('0x47')]['id']){delete _0x4a43db[_0xa031('0x47')]['id'];}delete _0x4a43db[_0xa031('0x47')][_0xa031('0x48')];delete _0x4a43db[_0xa031('0x47')][_0xa031('0x49')];delete _0x4a43db['body'][_0xa031('0x4a')];delete _0x4a43db[_0xa031('0x47')][_0xa031('0x4b')];return db[_0xa031('0x3c')]['find']({'where':{'id':_0x4a43db['params']['id']}})['then'](handleEntityNotFound(_0x394f0c,null))['then'](saveUpdates(_0x4a43db[_0xa031('0x47')],null))[_0xa031('0x21')](respondWithResult(_0x394f0c,null))['catch'](handleError(_0x394f0c,null));};exports[_0xa031('0x4c')]=function(_0x1f7644,_0x46e4f2){return db[_0xa031('0x3c')][_0xa031('0x4c')]()[_0xa031('0x21')](respondWithResult(_0x46e4f2,null))[_0xa031('0x45')](handleError(_0x46e4f2,null));};exports[_0xa031('0x4d')]=function(_0x391e0e,_0x28a6ac,_0x22e806){var _0x6e5fc2=require(_0xa031('0x4e'));var _0x2add80=![];var _0x8c70c9={};if(_0x391e0e[_0xa031('0x2e')][_0xa031('0x29')]&&_0x391e0e[_0xa031('0x2e')][_0xa031('0x29')]===_0xa031('0x4f')){_0x8c70c9['uniqueid']=_0x391e0e['params']['id'];}else{_0x8c70c9['id']=_0x391e0e[_0xa031('0x41')]['id'];}return db[_0xa031('0x3c')][_0xa031('0x44')]({'where':_0x8c70c9,'attributes':['id',_0xa031('0x4b')],'raw':!![]})[_0xa031('0x21')](handleEntityNotFound(_0x28a6ac,null))['then'](function(_0x302708){if(_0x302708){var _0xa60c9=path['join'](config[_0xa031('0x50')],_0xa031('0x51'),_0x302708['value']);var _0xba7e21=util[_0xa031('0x2d')]('%s.cypher',_0xa60c9);if(fs[_0xa031('0x52')](_0xba7e21)){_0x2add80=!![];return _0x6e5fc2[_0xa031('0x53')](_0xba7e21,_0xa60c9,config['secrets']['recording'])[_0xa031('0x21')](function(){return _0x302708;});}return _0x302708;}})[_0xa031('0x21')](function(_0x51eaf0){if(_0x51eaf0){var _0x37a44f=path[_0xa031('0x54')](config[_0xa031('0x50')],_0xa031('0x51'),_0x51eaf0[_0xa031('0x4b')]);if(!fs['existsSync'](_0x37a44f)){throw new db[(_0xa031('0x55'))][(_0xa031('0x56'))]('ScreenRecording\x20not\x20found');}if(_0x51eaf0[_0xa031('0x57')]){return _0x28a6ac['download'](_0x37a44f,_0x51eaf0[_0xa031('0x57')]+path[_0xa031('0x58')](_0x37a44f),function(){if(_0x2add80){fs[_0xa031('0x59')](_0x37a44f);}});}else{return _0x28a6ac[_0xa031('0x4d')](_0x37a44f,function(_0x1da56f){if(_0x2add80){fs[_0xa031('0x59')](_0x37a44f);}});}}})[_0xa031('0x45')](function(_0x41bd5d){if(_0x41bd5d[_0xa031('0x5a')]===_0xa031('0x5b')){_0x28a6ac['status'](0x194)[_0xa031('0x25')](_0xa031('0x5c'));}else{return handleError(_0x28a6ac,null);}});};exports[_0xa031('0x22')]=function(_0x429a66,_0x5ec661){return db[_0xa031('0x3c')][_0xa031('0x44')]({'where':{'id':_0x429a66[_0xa031('0x41')]['id']}})[_0xa031('0x21')](function(_0x26875d){if(!_0x26875d)throw new ReferenceError(_0xa031('0x5d'));return _0x26875d;})[_0xa031('0x21')](function(_0x10f9a2){var _0x54b31b=path[_0xa031('0x54')](config[_0xa031('0x50')],'server/files/screen_recordings',_0x10f9a2['value']);logger[_0xa031('0x5e')](_0xa031('0x5f'),_0x54b31b);if(!_[_0xa031('0x60')](_0x10f9a2[_0xa031('0x4b')])&&fs[_0xa031('0x52')](_0x54b31b)){logger[_0xa031('0x5e')](_0xa031('0x61')+_0x54b31b+_0xa031('0x62'));fs['unlinkSync'](_0x54b31b);}_0x54b31b=_0x54b31b+'.cypher';if(!_[_0xa031('0x60')](_0x10f9a2[_0xa031('0x4b')])&&fs[_0xa031('0x52')](_0x54b31b)){logger[_0xa031('0x5e')](_0xa031('0x61')+_0x54b31b+_0xa031('0x62'));fs['unlinkSync'](_0x54b31b);}return _0x10f9a2;})[_0xa031('0x21')](function(_0x3b6143){if(!_0x3b6143)throw new InternalError();return _0x3b6143['destroy']();})[_0xa031('0x21')](function(){_0x5ec661[_0xa031('0x16')](0xcc)[_0xa031('0x23')]();})[_0xa031('0x45')](handleError(_0x5ec661,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 2c965dd..5412713 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 _0x0ae8=['define','ScreenRecording','screen_recordings','interactionid','lodash','util','api','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports'];(function(_0x4d89fd,_0x411fe1){var _0x3262a6=function(_0x2c7505){while(--_0x2c7505){_0x4d89fd['push'](_0x4d89fd['shift']());}};_0x3262a6(++_0x411fe1);}(_0x0ae8,0x108));var _0x80ae=function(_0x499c20,_0x2d001d){_0x499c20=_0x499c20-0x0;var _0x467022=_0x0ae8[_0x499c20];return _0x467022;};'use strict';var _=require(_0x80ae('0x0'));var util=require(_0x80ae('0x1'));var logger=require('../../config/logger')(_0x80ae('0x2'));var moment=require('moment');var BPromise=require(_0x80ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80ae('0x4'));var rimraf=require(_0x80ae('0x5'));var config=require(_0x80ae('0x6'));var attributes=require(_0x80ae('0x7'));module[_0x80ae('0x8')]=function(_0x560684,_0x3f3986){return _0x560684[_0x80ae('0x9')](_0x80ae('0xa'),attributes,{'tableName':_0x80ae('0xb'),'paranoid':![],'indexes':[{'name':_0x80ae('0xc'),'fields':[_0x80ae('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0910=['ScreenRecording','screen_recordings','interactionid','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes'];(function(_0x3cbb14,_0x3c95a7){var _0x2bfb35=function(_0x384c4d){while(--_0x384c4d){_0x3cbb14['push'](_0x3cbb14['shift']());}};_0x2bfb35(++_0x3c95a7);}(_0x0910,0x137));var _0x0091=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0910[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x0091('0x0'));var logger=require(_0x0091('0x1'))('api');var moment=require(_0x0091('0x2'));var BPromise=require(_0x0091('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0091('0x4'));var rimraf=require(_0x0091('0x5'));var config=require(_0x0091('0x6'));var attributes=require(_0x0091('0x7'));module['exports']=function(_0x4f912c,_0x1a22d3){return _0x4f912c['define'](_0x0091('0x8'),attributes,{'tableName':_0x0091('0x9'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x0091('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index dbeebba..b1d3554 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(_0x568dd2,_0x5f56eb){var _0x2dd8e2=function(_0x1e62f0){while(--_0x1e62f0){_0x568dd2['push'](_0x568dd2['shift']());}};_0x2dd8e2(++_0x5f56eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x524ecf,_0xa4d359){var _0x5a5ef1=function(_0x53c1ec){while(--_0x53c1ec){_0x524ecf['push'](_0x524ecf['shift']());}};_0x5a5ef1(++_0xa4d359);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 ed61487..dcb1d6e 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 _0x0c6c=['originalname','single','file','addLogo','diskStorage','server/files/images/logos/','%s%s','extname','/:id/logo_login','addLogoLogin','format','preferred','favicon','post','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./setting.controller','get','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','join','root'];(function(_0x1fe3a1,_0x27ba1c){var _0x4cb413=function(_0x481710){while(--_0x481710){_0x1fe3a1['push'](_0x1fe3a1['shift']());}};_0x4cb413(++_0x27ba1c);}(_0x0c6c,0x1a2));var _0xc0c6=function(_0x16eb61,_0x43dfa2){_0x16eb61=_0x16eb61-0x0;var _0x46905c=_0x0c6c[_0x16eb61];return _0x46905c;};'use strict';var multer=require(_0xc0c6('0x0'));var util=require(_0xc0c6('0x1'));var path=require(_0xc0c6('0x2'));var timeout=require(_0xc0c6('0x3'));var express=require(_0xc0c6('0x4'));var router=express[_0xc0c6('0x5')]();var auth=require(_0xc0c6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc0c6('0x7'));var controller=require(_0xc0c6('0x8'));router[_0xc0c6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc0c6('0x9')](_0xc0c6('0xa'),controller[_0xc0c6('0xb')]);router['get'](_0xc0c6('0xc'),controller[_0xc0c6('0xd')]);router[_0xc0c6('0x9')]('/:id/logo_login',controller[_0xc0c6('0xe')]);router['get'](_0xc0c6('0xf'),controller[_0xc0c6('0x10')]);router[_0xc0c6('0x9')](_0xc0c6('0x11'),controller[_0xc0c6('0x12')]);router['get']('/:id/favicon',controller[_0xc0c6('0x13')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xc2fa3f,_0x15c1aa,_0x57c694){_0x57c694(null,path[_0xc0c6('0x14')](config[_0xc0c6('0x15')],'server/files/images/logos/'));},'filename':function(_0x526a9a,_0x52a05a,_0x5dffbe){_0x5dffbe(null,util['format']('%s%s','logo',path['extname'](_0x52a05a[_0xc0c6('0x16')])));}})});router['post'](_0xc0c6('0xc'),upload[_0xc0c6('0x17')](_0xc0c6('0x18')),controller[_0xc0c6('0x19')]);var upload=multer({'storage':multer[_0xc0c6('0x1a')]({'destination':function(_0x584157,_0x30f8f4,_0x467ea2){_0x467ea2(null,path['join'](config[_0xc0c6('0x15')],_0xc0c6('0x1b')));},'filename':function(_0x43df9b,_0x458551,_0xeeb8c9){_0xeeb8c9(null,util['format'](_0xc0c6('0x1c'),'logologin',path[_0xc0c6('0x1d')](_0x458551[_0xc0c6('0x16')])));}})});router['post'](_0xc0c6('0x1e'),upload[_0xc0c6('0x17')]('file'),controller[_0xc0c6('0x1f')]);var upload=multer({'storage':multer[_0xc0c6('0x1a')]({'destination':function(_0x442353,_0x3b6b17,_0x20cfa6){_0x20cfa6(null,path['join'](config[_0xc0c6('0x15')],'server/files/images/logos/'));},'filename':function(_0x267b61,_0x14644f,_0x589b25){_0x589b25(null,util[_0xc0c6('0x20')](_0xc0c6('0x1c'),_0xc0c6('0x21'),path['extname'](_0x14644f[_0xc0c6('0x16')])));}})});router['post'](_0xc0c6('0x11'),upload[_0xc0c6('0x17')](_0xc0c6('0x18')),controller['addPreferred']);var upload=multer({'storage':multer[_0xc0c6('0x1a')]({'destination':function(_0x2115c3,_0x1c0be0,_0x35fbe0){_0x35fbe0(null,path[_0xc0c6('0x14')](config[_0xc0c6('0x15')],_0xc0c6('0x1b')));},'filename':function(_0x59832e,_0x3ddd8b,_0xa0e0ca){_0xa0e0ca(null,util['format'](_0xc0c6('0x1c'),_0xc0c6('0x22'),path[_0xc0c6('0x1d')](_0x3ddd8b[_0xc0c6('0x16')])));}})});router[_0xc0c6('0x23')]('/:id/favicon',upload[_0xc0c6('0x17')](_0xc0c6('0x18')),controller[_0xc0c6('0x24')]);router[_0xc0c6('0x25')](_0xc0c6('0xa'),auth['isAuthenticated'](),controller[_0xc0c6('0x26')]);module[_0xc0c6('0x27')]=router; \ No newline at end of file +var _0xee3f=['addPreferred','favicon','addFavicon','update','util','express','Router','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','join','root','%s%s','logo','extname','originalname','post','single','file','addLogo','diskStorage','server/files/images/logos/','format'];(function(_0x8fcab0,_0x291e83){var _0xe37e53=function(_0xa04a23){while(--_0xa04a23){_0x8fcab0['push'](_0x8fcab0['shift']());}};_0xe37e53(++_0x291e83);}(_0xee3f,0x124));var _0xfee3=function(_0x1dfada,_0x10b089){_0x1dfada=_0x1dfada-0x0;var _0x2baf01=_0xee3f[_0x1dfada];return _0x2baf01;};'use strict';var multer=require('multer');var util=require(_0xfee3('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfee3('0x1'));var router=express[_0xfee3('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xfee3('0x3'));var config=require(_0xfee3('0x4'));var controller=require(_0xfee3('0x5'));router[_0xfee3('0x6')]('/',auth[_0xfee3('0x7')](),controller['index']);router[_0xfee3('0x6')](_0xfee3('0x8'),controller[_0xfee3('0x9')]);router[_0xfee3('0x6')](_0xfee3('0xa'),controller[_0xfee3('0xb')]);router[_0xfee3('0x6')](_0xfee3('0xc'),controller[_0xfee3('0xd')]);router[_0xfee3('0x6')](_0xfee3('0xe'),controller[_0xfee3('0xf')]);router[_0xfee3('0x6')](_0xfee3('0x10'),controller['getPreferred']);router[_0xfee3('0x6')](_0xfee3('0x11'),controller[_0xfee3('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x399fd7,_0x4016ed,_0x57aa0c){_0x57aa0c(null,path[_0xfee3('0x13')](config[_0xfee3('0x14')],'server/files/images/logos/'));},'filename':function(_0x567401,_0x141455,_0x50456f){_0x50456f(null,util['format'](_0xfee3('0x15'),_0xfee3('0x16'),path[_0xfee3('0x17')](_0x141455[_0xfee3('0x18')])));}})});router[_0xfee3('0x19')](_0xfee3('0xa'),upload[_0xfee3('0x1a')](_0xfee3('0x1b')),controller[_0xfee3('0x1c')]);var upload=multer({'storage':multer[_0xfee3('0x1d')]({'destination':function(_0x3cf768,_0x2ee911,_0x283696){_0x283696(null,path[_0xfee3('0x13')](config[_0xfee3('0x14')],_0xfee3('0x1e')));},'filename':function(_0x5531b1,_0x4e1274,_0x4172ad){_0x4172ad(null,util[_0xfee3('0x1f')](_0xfee3('0x15'),'logologin',path[_0xfee3('0x17')](_0x4e1274[_0xfee3('0x18')])));}})});router[_0xfee3('0x19')](_0xfee3('0xc'),upload[_0xfee3('0x1a')](_0xfee3('0x1b')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xfee3('0x1d')]({'destination':function(_0x2dd07a,_0x218665,_0x23cd8f){_0x23cd8f(null,path[_0xfee3('0x13')](config[_0xfee3('0x14')],_0xfee3('0x1e')));},'filename':function(_0x4689c9,_0x4680d3,_0x3d0784){_0x3d0784(null,util[_0xfee3('0x1f')]('%s%s','preferred',path['extname'](_0x4680d3['originalname'])));}})});router[_0xfee3('0x19')](_0xfee3('0x10'),upload[_0xfee3('0x1a')](_0xfee3('0x1b')),controller[_0xfee3('0x20')]);var upload=multer({'storage':multer[_0xfee3('0x1d')]({'destination':function(_0x9cf24,_0x53d397,_0x198a63){_0x198a63(null,path['join'](config['root'],_0xfee3('0x1e')));},'filename':function(_0xa4cf9d,_0x30c5b6,_0x331376){_0x331376(null,util['format']('%s%s',_0xfee3('0x21'),path[_0xfee3('0x17')](_0x30c5b6[_0xfee3('0x18')])));}})});router[_0xfee3('0x19')](_0xfee3('0x11'),upload['single'](_0xfee3('0x1b')),controller[_0xfee3('0x22')]);router['put'](_0xfee3('0x8'),auth[_0xfee3('0x7')](),controller[_0xfee3('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 0ce135e..5e31d2d 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 _0xe32d=['INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml'];(function(_0xbddae7,_0x2273d5){var _0x59b6cc=function(_0xbd0f3b){while(--_0xbd0f3b){_0xbddae7['push'](_0xbddae7['shift']());}};_0x59b6cc(++_0x2273d5);}(_0xe32d,0xe7));var _0xde32=function(_0x48078b,_0x182bee){_0x48078b=_0x48078b-0x0;var _0x3fcdc2=_0xe32d[_0x48078b];return _0x3fcdc2;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0xde32('0x0')](0xb),'unique':_0xde32('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xde32('0x0')](0xb),'unique':_0xde32('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xde32('0x3')],'defaultValue':_0xde32('0x4')},'logo':{'type':Sequelize[_0xde32('0x3')]},'defaultLogo':{'type':Sequelize[_0xde32('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xde32('0x3')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xde32('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xde32('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xde32('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xde32('0x3')]},'turnusername':{'type':Sequelize[_0xde32('0x3')]},'turnpassword':{'type':Sequelize[_0xde32('0x3')]},'pageTitle':{'type':Sequelize[_0xde32('0x3')]},'defaultPageTitle':{'type':Sequelize[_0xde32('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xde32('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xde32('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xde32('0x3')],'defaultValue':_0xde32('0x6')},'enableEmailPreview':{'type':Sequelize[_0xde32('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xde32('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xde32('0x0')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xde32('0x0')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xde32('0x3')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0xde32('0x0')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xde32('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xde32('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xde32('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xde32('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0xde32('0x0')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xde32('0x0')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xde32('0x0')],'defaultValue':0xa,'validate':{'min':0xa}},'googleSsoEnabled':{'type':Sequelize[_0xde32('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x9824=['STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','sequelize','exports','INTEGER','min_internal','min_mailbox'];(function(_0x21106b,_0x326baf){var _0xc95f60=function(_0x2e8175){while(--_0x2e8175){_0x21106b['push'](_0x21106b['shift']());}};_0xc95f60(++_0x326baf);}(_0x9824,0x109));var _0x4982=function(_0x578539,_0x37c2d7){_0x578539=_0x578539-0x0;var _0x5f844a=_0x9824[_0x578539];return _0x5f844a;};'use strict';var Sequelize=require(_0x4982('0x0'));module[_0x4982('0x1')]={'min_internal':{'type':Sequelize[_0x4982('0x2')](0xb),'unique':_0x4982('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x4982('0x2')](0xb),'unique':_0x4982('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x4982('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x4982('0x5')],'defaultValue':_0x4982('0x6')},'logo':{'type':Sequelize[_0x4982('0x5')]},'defaultLogo':{'type':Sequelize[_0x4982('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x4982('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x4982('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x4982('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x4982('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x4982('0x5')]},'turnaddr':{'type':Sequelize[_0x4982('0x5')]},'turnusername':{'type':Sequelize[_0x4982('0x5')]},'turnpassword':{'type':Sequelize[_0x4982('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x4982('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x4982('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x4982('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x4982('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x4982('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x4982('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x4982('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x4982('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x4982('0x5')],'defaultValue':_0x4982('0x8')},'chatTimeout':{'type':Sequelize[_0x4982('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x4982('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x4982('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x4982('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x4982('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'googleSsoEnabled':{'type':Sequelize[_0x4982('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 1e06920..fe97ff2 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 _0xf5b6=['save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Setting','includeAll','rows','show','keys','intersection','include','options','find','body','addLogo','file','logo','filename','addLogoLogin','loginLogo','params','../../config/license/util','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','join','root','toLower','default_logo.png','upperFirst','existsSync','\x20not\x20found','download','getLogoLogin','server/files/images/logos','getLicense','defaultFavicon','custom','default_loginLogo.png','gdpr','securePassword','addPreferred','getPreferred','favicon','default','default_preferred.png','ValidationError','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','end','status','count','offset','limit','set','Content-Range','json','apply','reject'];(function(_0xb7cb72,_0x19d391){var _0x4b7570=function(_0x5a4a93){while(--_0x5a4a93){_0xb7cb72['push'](_0xb7cb72['shift']());}};_0x4b7570(++_0x19d391);}(_0xf5b6,0xc3));var _0x6f5b=function(_0x1e5ba7,_0x198bf9){_0x1e5ba7=_0x1e5ba7-0x0;var _0x43f41d=_0xf5b6[_0x1e5ba7];return _0x43f41d;};'use strict';var pdf=require(_0x6f5b('0x0'));var emlformat=require(_0x6f5b('0x1'));var rimraf=require(_0x6f5b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f5b('0x3'));var rp=require(_0x6f5b('0x4'));var moment=require(_0x6f5b('0x5'));var BPromise=require(_0x6f5b('0x6'));var Mustache=require(_0x6f5b('0x7'));var util=require(_0x6f5b('0x8'));var path=require('path');var sox=require(_0x6f5b('0x9'));var csv=require(_0x6f5b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6f5b('0xb'));var crypto=require('crypto');var jsforce=require(_0x6f5b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6f5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6f5b('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6f5b('0xe'));var hardwareService=require(_0x6f5b('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x6f5b('0x10'));var config=require(_0x6f5b('0x11'));var db=require(_0x6f5b('0x12'))['db'];var jayson=require(_0x6f5b('0x13'));var client=jayson[_0x6f5b('0x14')][_0x6f5b('0x15')]({'port':0x232a});function checkPasswordPattern(_0x38f785,_0x1632eb,_0x48d1a0){if(_0x48d1a0){var _0x36fb32=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x36fb32[_0x6f5b('0x16')](_0x1632eb)){return _0x38f785;}else{throw new db[(_0x6f5b('0x17'))]['ValidationError'](_0x6f5b('0x18'));}}else{return _0x38f785;}}function respondWithRpcPromise(_0x387875,_0x489cd7,_0x10e90b,_0x2779c1){return new BPromise(function(_0x59ea4f,_0x4515b3){var _0x3f23ff=_0x2779c1||client;return _0x3f23ff[_0x6f5b('0x19')](_0x387875,_0x10e90b)[_0x6f5b('0x1a')](function(_0x561618){logger['info'](_0x6f5b('0x1b'),_0x489cd7,_0x6f5b('0x1c'));logger['debug'](_0x6f5b('0x1d'),_0x489cd7,_0x6f5b('0x1c'),JSON[_0x6f5b('0x1e')](_0x561618));if(_0x561618[_0x6f5b('0x1f')]){if(_0x561618[_0x6f5b('0x1f')][_0x6f5b('0x20')]===0x1f4){logger[_0x6f5b('0x1f')]('Setting,\x20%s,\x20%s',_0x489cd7,_0x561618[_0x6f5b('0x1f')]['message']);return _0x4515b3(_0x561618[_0x6f5b('0x1f')][_0x6f5b('0x21')]);}logger['error'](_0x6f5b('0x1b'),_0x489cd7,_0x561618[_0x6f5b('0x1f')][_0x6f5b('0x21')]);return _0x59ea4f(_0x561618[_0x6f5b('0x1f')][_0x6f5b('0x21')]);}else{logger[_0x6f5b('0x22')](_0x6f5b('0x1b'),_0x489cd7,_0x6f5b('0x1c'));_0x59ea4f(_0x561618[_0x6f5b('0x23')][_0x6f5b('0x21')]);}})[_0x6f5b('0x24')](function(_0x41453c){logger[_0x6f5b('0x1f')](_0x6f5b('0x1b'),_0x489cd7,_0x41453c);_0x4515b3(_0x41453c);});});}function respondWithStatusCode(_0x56b114,_0x4bb912){_0x4bb912=_0x4bb912||0xcc;return function(_0x5a712b){if(_0x5a712b){return _0x56b114['sendStatus'](_0x4bb912);}return _0x56b114['status'](_0x4bb912)[_0x6f5b('0x25')]();};}function respondWithResult(_0x165df1,_0x21e1eb){_0x21e1eb=_0x21e1eb||0xc8;return function(_0x538797){if(_0x538797){return _0x165df1[_0x6f5b('0x26')](_0x21e1eb)['json'](_0x538797);}};}function respondWithFilteredResult(_0x132873,_0x4d7fa2){return function(_0xce2e2c){if(_0xce2e2c){var _0x21f6ea=_0xce2e2c[_0x6f5b('0x27')],_0xaad148=_0x4d7fa2[_0x6f5b('0x28')],_0x2ed8f8=_0x4d7fa2['offset']+_0x4d7fa2[_0x6f5b('0x29')],_0x4dfedb;if(_0x2ed8f8>=_0x21f6ea){_0x2ed8f8=_0x21f6ea;_0x4dfedb=0xc8;}else{_0x4dfedb=0xce;}_0x132873[_0x6f5b('0x26')](_0x4dfedb);return _0x132873[_0x6f5b('0x2a')](_0x6f5b('0x2b'),_0xaad148+'-'+_0x2ed8f8+'/'+_0x21f6ea)[_0x6f5b('0x2c')](_0xce2e2c);}return null;};}function patchUpdates(_0xbcd92b){return function(_0x68937a){try{jsonpatch[_0x6f5b('0x2d')](_0x68937a,_0xbcd92b,!![]);}catch(_0x542b97){return BPromise[_0x6f5b('0x2e')](_0x542b97);}return _0x68937a[_0x6f5b('0x2f')]();};}function saveUpdates(_0x203550,_0x2c630c){return function(_0x13ae54){if(_0x13ae54){return _0x13ae54[_0x6f5b('0x30')](_0x203550)['then'](function(_0x346906){return _0x346906;});}return null;};}function removeEntity(_0x31f415,_0x5c805d){return function(_0x5aa6ad){if(_0x5aa6ad){return _0x5aa6ad[_0x6f5b('0x31')]()['then'](function(){_0x31f415[_0x6f5b('0x26')](0xcc)[_0x6f5b('0x25')]();});}};}function handleEntityNotFound(_0xa2547e,_0x3df224){return function(_0x4c9700){if(!_0x4c9700){_0xa2547e['sendStatus'](0x194);}return _0x4c9700;};}function handleError(_0x3c8746,_0x198a29){_0x198a29=_0x198a29||0x1f4;return function(_0x1c0d24){logger['error'](_0x1c0d24[_0x6f5b('0x32')]);if(_0x1c0d24[_0x6f5b('0x33')]){delete _0x1c0d24[_0x6f5b('0x33')];}_0x3c8746[_0x6f5b('0x26')](_0x198a29)[_0x6f5b('0x34')](_0x1c0d24);};}exports[_0x6f5b('0x35')]=function(_0x31b616,_0x40308){var _0x217451={},_0x39a5b5={},_0x2bf617={'count':0x0,'rows':[]};var _0x250054=_[_0x6f5b('0x36')](db['Setting'][_0x6f5b('0x37')],function(_0x50c5d2){return{'name':_0x50c5d2[_0x6f5b('0x38')],'type':_0x50c5d2[_0x6f5b('0x39')][_0x6f5b('0x3a')]};});_0x39a5b5[_0x6f5b('0x3b')]=_['map'](_0x250054,_0x6f5b('0x33'));_0x39a5b5[_0x6f5b('0x3c')]=_['keys'](_0x31b616['query']);_0x39a5b5[_0x6f5b('0x3d')]=_['intersection'](_0x39a5b5[_0x6f5b('0x3b')],_0x39a5b5[_0x6f5b('0x3c')]);_0x217451[_0x6f5b('0x3e')]=_['intersection'](_0x39a5b5[_0x6f5b('0x3b')],qs['fields'](_0x31b616['query'][_0x6f5b('0x3f')]));_0x217451[_0x6f5b('0x3e')]=_0x217451[_0x6f5b('0x3e')][_0x6f5b('0x40')]?_0x217451['attributes']:_0x39a5b5[_0x6f5b('0x3b')];if(!_0x31b616[_0x6f5b('0x3c')][_0x6f5b('0x41')](_0x6f5b('0x42'))){_0x217451[_0x6f5b('0x29')]=qs[_0x6f5b('0x29')](_0x31b616[_0x6f5b('0x3c')][_0x6f5b('0x29')]);_0x217451['offset']=qs[_0x6f5b('0x28')](_0x31b616[_0x6f5b('0x3c')][_0x6f5b('0x28')]);}_0x217451[_0x6f5b('0x43')]=qs[_0x6f5b('0x44')](_0x31b616[_0x6f5b('0x3c')][_0x6f5b('0x44')]);_0x217451[_0x6f5b('0x45')]=qs[_0x6f5b('0x3d')](_[_0x6f5b('0x46')](_0x31b616[_0x6f5b('0x3c')],_0x39a5b5['filters']));if(_0x31b616[_0x6f5b('0x3c')][_0x6f5b('0x47')]){_0x217451['where']=_[_0x6f5b('0x48')](_0x217451['where'],{'$or':_[_0x6f5b('0x36')](_0x250054,function(_0xa2c488){if(_0xa2c488[_0x6f5b('0x39')]!==_0x6f5b('0x49')){var _0x57fc60={};_0x57fc60[_0xa2c488['name']]={'$like':'%'+_0x31b616[_0x6f5b('0x3c')][_0x6f5b('0x47')]+'%'};return _0x57fc60;}})});}_0x217451=_['merge']({},_0x217451,_0x31b616['options']);var _0xdf3564={'where':_0x217451[_0x6f5b('0x45')]};return db[_0x6f5b('0x4a')][_0x6f5b('0x27')](_0xdf3564)[_0x6f5b('0x1a')](function(_0x47d2b4){_0x2bf617[_0x6f5b('0x27')]=_0x47d2b4;if(_0x31b616[_0x6f5b('0x3c')][_0x6f5b('0x4b')]){_0x217451['include']=[{'all':!![]}];}return db['Setting']['findAll'](_0x217451);})[_0x6f5b('0x1a')](function(_0x5708f8){_0x2bf617[_0x6f5b('0x4c')]=_0x5708f8;return _0x2bf617;})[_0x6f5b('0x1a')](respondWithFilteredResult(_0x40308,_0x217451))['catch'](handleError(_0x40308,null));};exports[_0x6f5b('0x4d')]=function(_0x1ecf07,_0x12ca0b){var _0x23deab={'raw':![],'where':{'id':_0x1ecf07['params']['id']}},_0xd235a1={};_0xd235a1[_0x6f5b('0x3b')]=_[_0x6f5b('0x4e')](db['Setting'][_0x6f5b('0x37')]);_0xd235a1['query']=_[_0x6f5b('0x4e')](_0x1ecf07[_0x6f5b('0x3c')]);_0xd235a1[_0x6f5b('0x3d')]=_[_0x6f5b('0x4f')](_0xd235a1[_0x6f5b('0x3b')],_0xd235a1[_0x6f5b('0x3c')]);_0x23deab[_0x6f5b('0x3e')]=_[_0x6f5b('0x4f')](_0xd235a1[_0x6f5b('0x3b')],qs['fields'](_0x1ecf07[_0x6f5b('0x3c')][_0x6f5b('0x3f')]));_0x23deab['attributes']=_0x23deab['attributes'][_0x6f5b('0x40')]?_0x23deab['attributes']:_0xd235a1['model'];if(_0x1ecf07[_0x6f5b('0x3c')]['includeAll']){_0x23deab[_0x6f5b('0x50')]=[{'all':!![]}];}_0x23deab=_[_0x6f5b('0x48')]({},_0x23deab,_0x1ecf07[_0x6f5b('0x51')]);return db['Setting'][_0x6f5b('0x52')](_0x23deab)[_0x6f5b('0x1a')](handleEntityNotFound(_0x12ca0b,null))[_0x6f5b('0x1a')](respondWithResult(_0x12ca0b,null))[_0x6f5b('0x24')](handleError(_0x12ca0b,null));};exports[_0x6f5b('0x30')]=function(_0x36c08a,_0x18ccc0){if(_0x36c08a[_0x6f5b('0x53')]['id']){delete _0x36c08a[_0x6f5b('0x53')]['id'];}return db[_0x6f5b('0x4a')][_0x6f5b('0x52')]({'where':{'id':_0x36c08a['params']['id']}})[_0x6f5b('0x1a')](handleEntityNotFound(_0x18ccc0,null))[_0x6f5b('0x1a')](saveUpdates(_0x36c08a[_0x6f5b('0x53')],null))[_0x6f5b('0x1a')](respondWithResult(_0x18ccc0,null))[_0x6f5b('0x24')](handleError(_0x18ccc0,null));};exports[_0x6f5b('0x54')]=function(_0x59b1fc,_0x22c932,_0x1e320b){if(_0x59b1fc['file']&&_0x59b1fc[_0x6f5b('0x55')]['filename']){_0x59b1fc[_0x6f5b('0x53')][_0x6f5b('0x56')]=_0x59b1fc[_0x6f5b('0x55')][_0x6f5b('0x57')];}return db[_0x6f5b('0x4a')][_0x6f5b('0x52')]({'where':{'id':_0x59b1fc['params']['id']}})[_0x6f5b('0x1a')](handleEntityNotFound(_0x22c932,null))['then'](saveUpdates(_0x59b1fc[_0x6f5b('0x53')],null))[_0x6f5b('0x1a')](respondWithResult(_0x22c932,null))['catch'](handleError(_0x22c932,null));};exports[_0x6f5b('0x58')]=function(_0x10e8f1,_0x155300,_0x450db6){if(_0x10e8f1['file']&&_0x10e8f1[_0x6f5b('0x55')]['filename']){_0x10e8f1['body'][_0x6f5b('0x59')]=_0x10e8f1[_0x6f5b('0x55')][_0x6f5b('0x57')];}return db['Setting']['find']({'where':{'id':_0x10e8f1[_0x6f5b('0x5a')]['id']}})[_0x6f5b('0x1a')](handleEntityNotFound(_0x155300,null))[_0x6f5b('0x1a')](saveUpdates(_0x10e8f1[_0x6f5b('0x53')],null))['then'](respondWithResult(_0x155300,null))[_0x6f5b('0x24')](handleError(_0x155300,null));};var utilLicense=require(_0x6f5b('0x5b'));exports['getLogo']=function(_0x38d00c,_0x5d0b66,_0x26114b){var _0x533b39='server/files/images/logos';var _0x5cd266={'custom':![]};return utilLicense['getLicense']()[_0x6f5b('0x1a')](function(_0x1e5319){if(_0x1e5319){_0x5cd266=_0x1e5319;}return db['Setting']['find']({'where':{'id':_0x38d00c[_0x6f5b('0x5a')]['id']},'attributes':['logo',_0x6f5b('0x59'),_0x6f5b('0x5c'),'favicon',_0x6f5b('0x5d'),_0x6f5b('0x5e'),_0x6f5b('0x5f'),'defaultFavicon'],'raw':!![]});})[_0x6f5b('0x1a')](handleEntityNotFound(_0x5d0b66,null))[_0x6f5b('0x1a')](function(_0xcdbe89){if(_0xcdbe89){var _0x4b5550=_0xcdbe89['logo']&&fs['existsSync'](path[_0x6f5b('0x60')](config[_0x6f5b('0x61')],_0x533b39,_[_0x6f5b('0x62')](_0xcdbe89[_0x6f5b('0x56')])))?path[_0x6f5b('0x60')](config[_0x6f5b('0x61')],_0x533b39,_[_0x6f5b('0x62')](_0xcdbe89['logo'])):path['join'](config[_0x6f5b('0x61')],_0x533b39,_[_0x6f5b('0x62')](_0x6f5b('0x63')));var _0x1e666c='default'+_[_0x6f5b('0x64')](_0x6f5b('0x56'));if(_0xcdbe89[_0x1e666c]||!_0x5cd266['custom']){_0x4b5550=path[_0x6f5b('0x60')](config['root'],_0x533b39,_[_0x6f5b('0x62')](_0x6f5b('0x63')));}if(!fs[_0x6f5b('0x65')](_0x4b5550)){throw new db[(_0x6f5b('0x17'))]['ValidationError'](_[_0x6f5b('0x64')]('logo')+_0x6f5b('0x66'));}return _0x5d0b66[_0x6f5b('0x67')](_0x4b5550);}})['catch'](handleError(_0x5d0b66,null));};var utilLicense=require(_0x6f5b('0x5b'));exports[_0x6f5b('0x68')]=function(_0x228ffc,_0x51044d,_0x1cf419){var _0x1c5497=_0x6f5b('0x69');var _0x216a3d={'custom':![]};return utilLicense[_0x6f5b('0x6a')]()[_0x6f5b('0x1a')](function(_0xf801e8){if(_0xf801e8){_0x216a3d=_0xf801e8;}return db[_0x6f5b('0x4a')][_0x6f5b('0x52')]({'where':{'id':_0x228ffc[_0x6f5b('0x5a')]['id']},'attributes':[_0x6f5b('0x56'),_0x6f5b('0x59'),'preferred','favicon','defaultLogo','defaultLoginLogo',_0x6f5b('0x5f'),_0x6f5b('0x6b')],'raw':!![]});})[_0x6f5b('0x1a')](handleEntityNotFound(_0x51044d,null))[_0x6f5b('0x1a')](function(_0x3a3c36){if(_0x3a3c36){var _0x2d004c=_0x3a3c36['loginLogo']&&fs['existsSync'](path['join'](config['root'],_0x1c5497,_[_0x6f5b('0x62')](_0x3a3c36[_0x6f5b('0x59')])))?path[_0x6f5b('0x60')](config[_0x6f5b('0x61')],_0x1c5497,_['toLower'](_0x3a3c36[_0x6f5b('0x59')])):path['join'](config[_0x6f5b('0x61')],_0x1c5497,_[_0x6f5b('0x62')]('default_loginLogo.png'));var _0x540e65='default'+_[_0x6f5b('0x64')](_0x6f5b('0x59'));if(_0x3a3c36[_0x540e65]||!_0x216a3d[_0x6f5b('0x6c')]){_0x2d004c=path[_0x6f5b('0x60')](config[_0x6f5b('0x61')],_0x1c5497,_[_0x6f5b('0x62')](_0x6f5b('0x6d')));}if(!fs[_0x6f5b('0x65')](_0x2d004c)){throw new db[(_0x6f5b('0x17'))]['ValidationError'](_[_0x6f5b('0x64')](_0x6f5b('0x59'))+'\x20not\x20found');}return _0x51044d[_0x6f5b('0x67')](_0x2d004c);}})[_0x6f5b('0x24')](handleError(_0x51044d,null));};exports[_0x6f5b('0x6e')]=function(_0x5c606e,_0x4008af){return db[_0x6f5b('0x4a')]['find']({'where':{'id':_0x5c606e[_0x6f5b('0x5a')]['id']},'attributes':[_0x6f5b('0x6f')]})[_0x6f5b('0x1a')](respondWithResult(_0x4008af,null))[_0x6f5b('0x24')](handleError(_0x4008af,null));};exports[_0x6f5b('0x70')]=function(_0x34ad50,_0x2b17f8,_0x31c25f){if(_0x34ad50[_0x6f5b('0x55')]&&_0x34ad50[_0x6f5b('0x55')][_0x6f5b('0x57')]){_0x34ad50[_0x6f5b('0x53')][_0x6f5b('0x5c')]=_0x34ad50[_0x6f5b('0x55')]['filename'];}return db['Setting'][_0x6f5b('0x52')]({'where':{'id':_0x34ad50[_0x6f5b('0x5a')]['id']}})[_0x6f5b('0x1a')](handleEntityNotFound(_0x2b17f8,null))[_0x6f5b('0x1a')](saveUpdates(_0x34ad50['body'],null))[_0x6f5b('0x1a')](respondWithResult(_0x2b17f8,null))['catch'](handleError(_0x2b17f8,null));};var utilLicense=require(_0x6f5b('0x5b'));exports[_0x6f5b('0x71')]=function(_0x2b62d1,_0x7a25dd,_0x17e20d){var _0x293524=_0x6f5b('0x69');var _0x2a86ee={'custom':![]};return utilLicense[_0x6f5b('0x6a')]()[_0x6f5b('0x1a')](function(_0x1b3461){if(_0x1b3461){_0x2a86ee=_0x1b3461;}return db[_0x6f5b('0x4a')][_0x6f5b('0x52')]({'where':{'id':_0x2b62d1[_0x6f5b('0x5a')]['id']},'attributes':['logo',_0x6f5b('0x59'),_0x6f5b('0x5c'),_0x6f5b('0x72'),_0x6f5b('0x5d'),_0x6f5b('0x5e'),_0x6f5b('0x5f'),_0x6f5b('0x6b')],'raw':!![]});})[_0x6f5b('0x1a')](handleEntityNotFound(_0x7a25dd,null))[_0x6f5b('0x1a')](function(_0x7b82e1){if(_0x7b82e1){var _0x1d392f=_0x7b82e1[_0x6f5b('0x5c')]&&fs[_0x6f5b('0x65')](path[_0x6f5b('0x60')](config['root'],_0x293524,_[_0x6f5b('0x62')](_0x7b82e1[_0x6f5b('0x5c')])))?path[_0x6f5b('0x60')](config['root'],_0x293524,_[_0x6f5b('0x62')](_0x7b82e1[_0x6f5b('0x5c')])):path[_0x6f5b('0x60')](config[_0x6f5b('0x61')],_0x293524,_['toLower']('default_preferred.png'));var _0x1fc0ae=_0x6f5b('0x73')+_[_0x6f5b('0x64')](_0x6f5b('0x5c'));if(_0x7b82e1[_0x1fc0ae]||!_0x2a86ee[_0x6f5b('0x6c')]||!_0x2a86ee['preferred']){_0x1d392f=path['join'](config[_0x6f5b('0x61')],_0x293524,_[_0x6f5b('0x62')](_0x6f5b('0x74')));}if(!fs['existsSync'](_0x1d392f)){throw new db[(_0x6f5b('0x17'))][(_0x6f5b('0x75'))](_[_0x6f5b('0x64')]('preferred')+_0x6f5b('0x66'));}return _0x7a25dd[_0x6f5b('0x67')](_0x1d392f);}})[_0x6f5b('0x24')](handleError(_0x7a25dd,null));};exports[_0x6f5b('0x76')]=function(_0x11fad2,_0x777cec,_0x122b8b){if(_0x11fad2[_0x6f5b('0x55')]&&_0x11fad2[_0x6f5b('0x55')][_0x6f5b('0x57')]){_0x11fad2['body'][_0x6f5b('0x72')]=_0x11fad2[_0x6f5b('0x55')][_0x6f5b('0x57')];}return db[_0x6f5b('0x4a')][_0x6f5b('0x52')]({'where':{'id':_0x11fad2[_0x6f5b('0x5a')]['id']}})[_0x6f5b('0x1a')](handleEntityNotFound(_0x777cec,null))[_0x6f5b('0x1a')](saveUpdates(_0x11fad2[_0x6f5b('0x53')],null))[_0x6f5b('0x1a')](respondWithResult(_0x777cec,null))[_0x6f5b('0x24')](handleError(_0x777cec,null));};var utilLicense=require(_0x6f5b('0x5b'));exports[_0x6f5b('0x77')]=function(_0x4c88b5,_0x351bcf,_0x27ebb8){var _0xe8b91f='server/files/images/logos';var _0x5e0f74={'custom':![]};return utilLicense[_0x6f5b('0x6a')]()[_0x6f5b('0x1a')](function(_0x392059){if(_0x392059){_0x5e0f74=_0x392059;}return db[_0x6f5b('0x4a')]['find']({'where':{'id':_0x4c88b5[_0x6f5b('0x5a')]['id']},'attributes':[_0x6f5b('0x56'),_0x6f5b('0x59'),_0x6f5b('0x5c'),_0x6f5b('0x72'),_0x6f5b('0x5d'),'defaultLoginLogo',_0x6f5b('0x5f'),_0x6f5b('0x6b')],'raw':!![]});})[_0x6f5b('0x1a')](handleEntityNotFound(_0x351bcf,null))['then'](function(_0x353f7f){if(_0x353f7f){var _0x5804c3=_0x353f7f[_0x6f5b('0x72')]&&fs['existsSync'](path[_0x6f5b('0x60')](config[_0x6f5b('0x61')],_0xe8b91f,_[_0x6f5b('0x62')](_0x353f7f[_0x6f5b('0x72')])))?path['join'](config['root'],_0xe8b91f,_[_0x6f5b('0x62')](_0x353f7f[_0x6f5b('0x72')])):path['join'](config[_0x6f5b('0x61')],_0xe8b91f,_[_0x6f5b('0x62')](_0x6f5b('0x78')));var _0xdca4fa=_0x6f5b('0x73')+_['upperFirst']('favicon');if(_0x353f7f[_0xdca4fa]||!_0x5e0f74[_0x6f5b('0x6c')]){_0x5804c3=path['join'](config[_0x6f5b('0x61')],_0xe8b91f,_[_0x6f5b('0x62')]('default_favicon.ico'));}if(!fs['existsSync'](_0x5804c3)){throw new db[(_0x6f5b('0x17'))]['ValidationError'](_[_0x6f5b('0x64')](_0x6f5b('0x72'))+_0x6f5b('0x66'));}return _0x351bcf[_0x6f5b('0x67')](_0x5804c3);}})[_0x6f5b('0x24')](handleError(_0x351bcf,null));}; \ No newline at end of file +var _0xde80=['../../config/utils','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','status','json','count','limit','set','Content-Range','reject','update','end','name','index','Setting','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','offset','sort','where','filters','pick','filter','merge','map','VIRTUAL','include','findAll','rows','show','params','length','includeAll','find','catch','body','filename','file','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.png','default','upperFirst','custom','download','getLogoLogin','defaultLoginLogo','default_loginLogo.png','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xde80,0x141));var _0x0de8=function(_0x3372eb,_0x57520b){_0x3372eb=_0x3372eb-0x0;var _0x4b252e=_0xde80[_0x3372eb];return _0x4b252e;};'use strict';var pdf=require(_0x0de8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0de8('0x1'));var zipdir=require(_0x0de8('0x2'));var jsonpatch=require(_0x0de8('0x3'));var rp=require(_0x0de8('0x4'));var moment=require(_0x0de8('0x5'));var BPromise=require(_0x0de8('0x6'));var Mustache=require(_0x0de8('0x7'));var util=require('util');var path=require(_0x0de8('0x8'));var sox=require('sox');var csv=require(_0x0de8('0x9'));var ejs=require(_0x0de8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0de8('0xb'));var crypto=require('crypto');var jsforce=require(_0x0de8('0xc'));var deskjs=require(_0x0de8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0de8('0xe'));var Papa=require(_0x0de8('0xf'));var Redis=require(_0x0de8('0x10'));var authService=require(_0x0de8('0x11'));var qs=require(_0x0de8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0de8('0x13'))(_0x0de8('0x14'));var utils=require(_0x0de8('0x15'));var config=require('../../config/environment');var db=require(_0x0de8('0x16'))['db'];var jayson=require(_0x0de8('0x17'));var client=jayson[_0x0de8('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x5e92c3,_0x209334,_0x2ab227){if(_0x2ab227){var _0xc6e0cd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc6e0cd[_0x0de8('0x19')](_0x209334)){return _0x5e92c3;}else{throw new db[(_0x0de8('0x1a'))][(_0x0de8('0x1b'))](_0x0de8('0x1c'));}}else{return _0x5e92c3;}}function respondWithRpcPromise(_0xefd260,_0x3aed9d,_0x53fd97,_0x1ba512){return new BPromise(function(_0x4cd781,_0x28186e){var _0xf2878b=_0x1ba512||client;return _0xf2878b['request'](_0xefd260,_0x53fd97)[_0x0de8('0x1d')](function(_0x3c3663){logger['info'](_0x0de8('0x1e'),_0x3aed9d,_0x0de8('0x1f'));logger[_0x0de8('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x3aed9d,_0x0de8('0x1f'),JSON[_0x0de8('0x21')](_0x3c3663));if(_0x3c3663[_0x0de8('0x22')]){if(_0x3c3663[_0x0de8('0x22')]['code']===0x1f4){logger[_0x0de8('0x22')](_0x0de8('0x1e'),_0x3aed9d,_0x3c3663['error'][_0x0de8('0x23')]);return _0x28186e(_0x3c3663['error'][_0x0de8('0x23')]);}logger[_0x0de8('0x22')](_0x0de8('0x1e'),_0x3aed9d,_0x3c3663[_0x0de8('0x22')][_0x0de8('0x23')]);return _0x4cd781(_0x3c3663['error'][_0x0de8('0x23')]);}else{logger[_0x0de8('0x24')]('Setting,\x20%s,\x20%s',_0x3aed9d,_0x0de8('0x1f'));_0x4cd781(_0x3c3663[_0x0de8('0x25')][_0x0de8('0x23')]);}})['catch'](function(_0x320732){logger['error'](_0x0de8('0x1e'),_0x3aed9d,_0x320732);_0x28186e(_0x320732);});});}function respondWithStatusCode(_0x493288,_0x5c0c46){_0x5c0c46=_0x5c0c46||0xcc;return function(_0x5354f7){if(_0x5354f7){return _0x493288['sendStatus'](_0x5c0c46);}return _0x493288[_0x0de8('0x26')](_0x5c0c46)['end']();};}function respondWithResult(_0xb893a8,_0x58f4a4){_0x58f4a4=_0x58f4a4||0xc8;return function(_0x175dfe){if(_0x175dfe){return _0xb893a8['status'](_0x58f4a4)[_0x0de8('0x27')](_0x175dfe);}};}function respondWithFilteredResult(_0x85d117,_0x53ac91){return function(_0x32e6f0){if(_0x32e6f0){var _0x581804=_0x32e6f0[_0x0de8('0x28')],_0xf2ff2=_0x53ac91['offset'],_0x547441=_0x53ac91['offset']+_0x53ac91[_0x0de8('0x29')],_0x3bbf55;if(_0x547441>=_0x581804){_0x547441=_0x581804;_0x3bbf55=0xc8;}else{_0x3bbf55=0xce;}_0x85d117[_0x0de8('0x26')](_0x3bbf55);return _0x85d117[_0x0de8('0x2a')](_0x0de8('0x2b'),_0xf2ff2+'-'+_0x547441+'/'+_0x581804)[_0x0de8('0x27')](_0x32e6f0);}return null;};}function patchUpdates(_0x52530f){return function(_0x38c82e){try{jsonpatch['apply'](_0x38c82e,_0x52530f,!![]);}catch(_0x8305fd){return BPromise[_0x0de8('0x2c')](_0x8305fd);}return _0x38c82e['save']();};}function saveUpdates(_0x25258e,_0x379a18){return function(_0x3c319c){if(_0x3c319c){return _0x3c319c[_0x0de8('0x2d')](_0x25258e)[_0x0de8('0x1d')](function(_0x348fb5){return _0x348fb5;});}return null;};}function removeEntity(_0x2bf1cc,_0x3919b1){return function(_0x252fdc){if(_0x252fdc){return _0x252fdc['destroy']()[_0x0de8('0x1d')](function(){_0x2bf1cc['status'](0xcc)[_0x0de8('0x2e')]();});}};}function handleEntityNotFound(_0xc0eb8a,_0x154972){return function(_0x197af5){if(!_0x197af5){_0xc0eb8a['sendStatus'](0x194);}return _0x197af5;};}function handleError(_0x3bad2a,_0x1c091c){_0x1c091c=_0x1c091c||0x1f4;return function(_0x163a54){logger[_0x0de8('0x22')](_0x163a54['stack']);if(_0x163a54['name']){delete _0x163a54[_0x0de8('0x2f')];}_0x3bad2a[_0x0de8('0x26')](_0x1c091c)['send'](_0x163a54);};}exports[_0x0de8('0x30')]=function(_0x3b8e91,_0x19ba3f){var _0x41e8b0={},_0x2226b0={},_0x1b1f1c={'count':0x0,'rows':[]};var _0x39e061=_['map'](db[_0x0de8('0x31')][_0x0de8('0x32')],function(_0x50fb1b){return{'name':_0x50fb1b[_0x0de8('0x33')],'type':_0x50fb1b[_0x0de8('0x34')][_0x0de8('0x35')]};});_0x2226b0[_0x0de8('0x36')]=_['map'](_0x39e061,_0x0de8('0x2f'));_0x2226b0[_0x0de8('0x37')]=_[_0x0de8('0x38')](_0x3b8e91[_0x0de8('0x37')]);_0x2226b0['filters']=_[_0x0de8('0x39')](_0x2226b0[_0x0de8('0x36')],_0x2226b0[_0x0de8('0x37')]);_0x41e8b0[_0x0de8('0x3a')]=_[_0x0de8('0x39')](_0x2226b0[_0x0de8('0x36')],qs['fields'](_0x3b8e91[_0x0de8('0x37')][_0x0de8('0x3b')]));_0x41e8b0[_0x0de8('0x3a')]=_0x41e8b0['attributes']['length']?_0x41e8b0['attributes']:_0x2226b0[_0x0de8('0x36')];if(!_0x3b8e91[_0x0de8('0x37')]['hasOwnProperty'](_0x0de8('0x3c'))){_0x41e8b0[_0x0de8('0x29')]=qs[_0x0de8('0x29')](_0x3b8e91[_0x0de8('0x37')][_0x0de8('0x29')]);_0x41e8b0[_0x0de8('0x3d')]=qs[_0x0de8('0x3d')](_0x3b8e91[_0x0de8('0x37')][_0x0de8('0x3d')]);}_0x41e8b0['order']=qs[_0x0de8('0x3e')](_0x3b8e91[_0x0de8('0x37')][_0x0de8('0x3e')]);_0x41e8b0[_0x0de8('0x3f')]=qs[_0x0de8('0x40')](_[_0x0de8('0x41')](_0x3b8e91[_0x0de8('0x37')],_0x2226b0[_0x0de8('0x40')]));if(_0x3b8e91['query'][_0x0de8('0x42')]){_0x41e8b0[_0x0de8('0x3f')]=_[_0x0de8('0x43')](_0x41e8b0['where'],{'$or':_[_0x0de8('0x44')](_0x39e061,function(_0x2f2420){if(_0x2f2420[_0x0de8('0x34')]!==_0x0de8('0x45')){var _0x148762={};_0x148762[_0x2f2420[_0x0de8('0x2f')]]={'$like':'%'+_0x3b8e91[_0x0de8('0x37')][_0x0de8('0x42')]+'%'};return _0x148762;}})});}_0x41e8b0=_[_0x0de8('0x43')]({},_0x41e8b0,_0x3b8e91['options']);var _0x1c3385={'where':_0x41e8b0['where']};return db['Setting'][_0x0de8('0x28')](_0x1c3385)[_0x0de8('0x1d')](function(_0x287e88){_0x1b1f1c['count']=_0x287e88;if(_0x3b8e91[_0x0de8('0x37')]['includeAll']){_0x41e8b0[_0x0de8('0x46')]=[{'all':!![]}];}return db[_0x0de8('0x31')][_0x0de8('0x47')](_0x41e8b0);})[_0x0de8('0x1d')](function(_0x33ab4f){_0x1b1f1c[_0x0de8('0x48')]=_0x33ab4f;return _0x1b1f1c;})['then'](respondWithFilteredResult(_0x19ba3f,_0x41e8b0))['catch'](handleError(_0x19ba3f,null));};exports[_0x0de8('0x49')]=function(_0x3c2776,_0x36e9d1){var _0x416117={'raw':![],'where':{'id':_0x3c2776[_0x0de8('0x4a')]['id']}},_0x4f5f85={};_0x4f5f85[_0x0de8('0x36')]=_['keys'](db[_0x0de8('0x31')][_0x0de8('0x32')]);_0x4f5f85[_0x0de8('0x37')]=_[_0x0de8('0x38')](_0x3c2776[_0x0de8('0x37')]);_0x4f5f85[_0x0de8('0x40')]=_[_0x0de8('0x39')](_0x4f5f85[_0x0de8('0x36')],_0x4f5f85[_0x0de8('0x37')]);_0x416117[_0x0de8('0x3a')]=_[_0x0de8('0x39')](_0x4f5f85[_0x0de8('0x36')],qs[_0x0de8('0x3b')](_0x3c2776[_0x0de8('0x37')][_0x0de8('0x3b')]));_0x416117[_0x0de8('0x3a')]=_0x416117[_0x0de8('0x3a')][_0x0de8('0x4b')]?_0x416117[_0x0de8('0x3a')]:_0x4f5f85[_0x0de8('0x36')];if(_0x3c2776[_0x0de8('0x37')][_0x0de8('0x4c')]){_0x416117[_0x0de8('0x46')]=[{'all':!![]}];}_0x416117=_[_0x0de8('0x43')]({},_0x416117,_0x3c2776['options']);return db['Setting'][_0x0de8('0x4d')](_0x416117)[_0x0de8('0x1d')](handleEntityNotFound(_0x36e9d1,null))['then'](respondWithResult(_0x36e9d1,null))[_0x0de8('0x4e')](handleError(_0x36e9d1,null));};exports[_0x0de8('0x2d')]=function(_0x53364b,_0x4873ee){if(_0x53364b[_0x0de8('0x4f')]['id']){delete _0x53364b[_0x0de8('0x4f')]['id'];}return db[_0x0de8('0x31')][_0x0de8('0x4d')]({'where':{'id':_0x53364b[_0x0de8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4873ee,null))[_0x0de8('0x1d')](saveUpdates(_0x53364b[_0x0de8('0x4f')],null))[_0x0de8('0x1d')](respondWithResult(_0x4873ee,null))['catch'](handleError(_0x4873ee,null));};exports['addLogo']=function(_0x39d36f,_0x34e3d2,_0x4b8339){if(_0x39d36f['file']&&_0x39d36f['file'][_0x0de8('0x50')]){_0x39d36f[_0x0de8('0x4f')]['logo']=_0x39d36f[_0x0de8('0x51')][_0x0de8('0x50')];}return db['Setting']['find']({'where':{'id':_0x39d36f[_0x0de8('0x4a')]['id']}})[_0x0de8('0x1d')](handleEntityNotFound(_0x34e3d2,null))[_0x0de8('0x1d')](saveUpdates(_0x39d36f[_0x0de8('0x4f')],null))['then'](respondWithResult(_0x34e3d2,null))[_0x0de8('0x4e')](handleError(_0x34e3d2,null));};exports[_0x0de8('0x52')]=function(_0x2427d6,_0x309ef2,_0x20b652){if(_0x2427d6['file']&&_0x2427d6['file'][_0x0de8('0x50')]){_0x2427d6[_0x0de8('0x4f')][_0x0de8('0x53')]=_0x2427d6[_0x0de8('0x51')]['filename'];}return db[_0x0de8('0x31')][_0x0de8('0x4d')]({'where':{'id':_0x2427d6['params']['id']}})[_0x0de8('0x1d')](handleEntityNotFound(_0x309ef2,null))[_0x0de8('0x1d')](saveUpdates(_0x2427d6['body'],null))[_0x0de8('0x1d')](respondWithResult(_0x309ef2,null))[_0x0de8('0x4e')](handleError(_0x309ef2,null));};var utilLicense=require(_0x0de8('0x54'));exports[_0x0de8('0x55')]=function(_0xff0c2c,_0xa01776,_0x5648d4){var _0x4da2ac=_0x0de8('0x56');var _0x543ef9={'custom':![]};return utilLicense[_0x0de8('0x57')]()['then'](function(_0x3b4143){if(_0x3b4143){_0x543ef9=_0x3b4143;}return db['Setting'][_0x0de8('0x4d')]({'where':{'id':_0xff0c2c[_0x0de8('0x4a')]['id']},'attributes':[_0x0de8('0x58'),_0x0de8('0x53'),_0x0de8('0x59'),_0x0de8('0x5a'),_0x0de8('0x5b'),'defaultLoginLogo',_0x0de8('0x5c'),_0x0de8('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0xa01776,null))[_0x0de8('0x1d')](function(_0x5f52e5){if(_0x5f52e5){var _0xe79c46=_0x5f52e5[_0x0de8('0x58')]&&fs[_0x0de8('0x5e')](path[_0x0de8('0x5f')](config[_0x0de8('0x60')],_0x4da2ac,_['toLower'](_0x5f52e5[_0x0de8('0x58')])))?path[_0x0de8('0x5f')](config[_0x0de8('0x60')],_0x4da2ac,_[_0x0de8('0x61')](_0x5f52e5[_0x0de8('0x58')])):path['join'](config[_0x0de8('0x60')],_0x4da2ac,_[_0x0de8('0x61')](_0x0de8('0x62')));var _0x287b3d=_0x0de8('0x63')+_[_0x0de8('0x64')](_0x0de8('0x58'));if(_0x5f52e5[_0x287b3d]||!_0x543ef9[_0x0de8('0x65')]){_0xe79c46=path[_0x0de8('0x5f')](config[_0x0de8('0x60')],_0x4da2ac,_['toLower'](_0x0de8('0x62')));}if(!fs[_0x0de8('0x5e')](_0xe79c46)){throw new db[(_0x0de8('0x1a'))]['ValidationError'](_['upperFirst'](_0x0de8('0x58'))+'\x20not\x20found');}return _0xa01776[_0x0de8('0x66')](_0xe79c46);}})[_0x0de8('0x4e')](handleError(_0xa01776,null));};var utilLicense=require('../../config/license/util');exports[_0x0de8('0x67')]=function(_0x5d21e2,_0x313c3d,_0x281b6f){var _0x4f7bf0=_0x0de8('0x56');var _0x5950e3={'custom':![]};return utilLicense[_0x0de8('0x57')]()[_0x0de8('0x1d')](function(_0x51bbe6){if(_0x51bbe6){_0x5950e3=_0x51bbe6;}return db[_0x0de8('0x31')][_0x0de8('0x4d')]({'where':{'id':_0x5d21e2[_0x0de8('0x4a')]['id']},'attributes':['logo',_0x0de8('0x53'),_0x0de8('0x59'),'favicon',_0x0de8('0x5b'),_0x0de8('0x68'),_0x0de8('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x0de8('0x1d')](handleEntityNotFound(_0x313c3d,null))['then'](function(_0x16c365){if(_0x16c365){var _0x342704=_0x16c365['loginLogo']&&fs[_0x0de8('0x5e')](path['join'](config[_0x0de8('0x60')],_0x4f7bf0,_[_0x0de8('0x61')](_0x16c365['loginLogo'])))?path[_0x0de8('0x5f')](config[_0x0de8('0x60')],_0x4f7bf0,_[_0x0de8('0x61')](_0x16c365[_0x0de8('0x53')])):path[_0x0de8('0x5f')](config[_0x0de8('0x60')],_0x4f7bf0,_['toLower']('default_loginLogo.png'));var _0x27e053='default'+_[_0x0de8('0x64')](_0x0de8('0x53'));if(_0x16c365[_0x27e053]||!_0x5950e3[_0x0de8('0x65')]){_0x342704=path[_0x0de8('0x5f')](config[_0x0de8('0x60')],_0x4f7bf0,_['toLower'](_0x0de8('0x69')));}if(!fs['existsSync'](_0x342704)){throw new db[(_0x0de8('0x1a'))][(_0x0de8('0x1b'))](_[_0x0de8('0x64')]('loginLogo')+_0x0de8('0x6a'));}return _0x313c3d[_0x0de8('0x66')](_0x342704);}})[_0x0de8('0x4e')](handleError(_0x313c3d,null));};exports[_0x0de8('0x6b')]=function(_0x2ce1a1,_0xea0a39){return db[_0x0de8('0x31')][_0x0de8('0x4d')]({'where':{'id':_0x2ce1a1[_0x0de8('0x4a')]['id']},'attributes':[_0x0de8('0x6c')]})[_0x0de8('0x1d')](respondWithResult(_0xea0a39,null))[_0x0de8('0x4e')](handleError(_0xea0a39,null));};exports[_0x0de8('0x6d')]=function(_0x27a9cd,_0x1fa5ea,_0x54a1b4){if(_0x27a9cd[_0x0de8('0x51')]&&_0x27a9cd['file'][_0x0de8('0x50')]){_0x27a9cd[_0x0de8('0x4f')]['preferred']=_0x27a9cd[_0x0de8('0x51')][_0x0de8('0x50')];}return db['Setting'][_0x0de8('0x4d')]({'where':{'id':_0x27a9cd[_0x0de8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1fa5ea,null))[_0x0de8('0x1d')](saveUpdates(_0x27a9cd[_0x0de8('0x4f')],null))['then'](respondWithResult(_0x1fa5ea,null))[_0x0de8('0x4e')](handleError(_0x1fa5ea,null));};var utilLicense=require(_0x0de8('0x54'));exports[_0x0de8('0x6e')]=function(_0x95fba2,_0x32840c,_0x5e9262){var _0x23e9c8='server/files/images/logos';var _0x4ee927={'custom':![]};return utilLicense[_0x0de8('0x57')]()['then'](function(_0x52678c){if(_0x52678c){_0x4ee927=_0x52678c;}return db[_0x0de8('0x31')][_0x0de8('0x4d')]({'where':{'id':_0x95fba2['params']['id']},'attributes':['logo',_0x0de8('0x53'),'preferred',_0x0de8('0x5a'),_0x0de8('0x5b'),_0x0de8('0x68'),_0x0de8('0x5c'),_0x0de8('0x5d')],'raw':!![]});})[_0x0de8('0x1d')](handleEntityNotFound(_0x32840c,null))[_0x0de8('0x1d')](function(_0x5936f1){if(_0x5936f1){var _0x4b7f84=_0x5936f1[_0x0de8('0x59')]&&fs[_0x0de8('0x5e')](path['join'](config[_0x0de8('0x60')],_0x23e9c8,_['toLower'](_0x5936f1['preferred'])))?path[_0x0de8('0x5f')](config[_0x0de8('0x60')],_0x23e9c8,_[_0x0de8('0x61')](_0x5936f1[_0x0de8('0x59')])):path[_0x0de8('0x5f')](config[_0x0de8('0x60')],_0x23e9c8,_['toLower'](_0x0de8('0x6f')));var _0x59398=_0x0de8('0x63')+_['upperFirst'](_0x0de8('0x59'));if(_0x5936f1[_0x59398]||!_0x4ee927[_0x0de8('0x65')]||!_0x4ee927['preferred']){_0x4b7f84=path[_0x0de8('0x5f')](config[_0x0de8('0x60')],_0x23e9c8,_[_0x0de8('0x61')](_0x0de8('0x6f')));}if(!fs[_0x0de8('0x5e')](_0x4b7f84)){throw new db[(_0x0de8('0x1a'))]['ValidationError'](_[_0x0de8('0x64')]('preferred')+_0x0de8('0x6a'));}return _0x32840c[_0x0de8('0x66')](_0x4b7f84);}})['catch'](handleError(_0x32840c,null));};exports[_0x0de8('0x70')]=function(_0x3009f6,_0x1a79e5,_0x371d90){if(_0x3009f6[_0x0de8('0x51')]&&_0x3009f6[_0x0de8('0x51')][_0x0de8('0x50')]){_0x3009f6[_0x0de8('0x4f')][_0x0de8('0x5a')]=_0x3009f6[_0x0de8('0x51')][_0x0de8('0x50')];}return db[_0x0de8('0x31')][_0x0de8('0x4d')]({'where':{'id':_0x3009f6['params']['id']}})[_0x0de8('0x1d')](handleEntityNotFound(_0x1a79e5,null))[_0x0de8('0x1d')](saveUpdates(_0x3009f6[_0x0de8('0x4f')],null))['then'](respondWithResult(_0x1a79e5,null))[_0x0de8('0x4e')](handleError(_0x1a79e5,null));};var utilLicense=require(_0x0de8('0x54'));exports['getFavicon']=function(_0x4c1d2a,_0x2bd522,_0x4a7667){var _0x6349ff=_0x0de8('0x56');var _0x249153={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2653c1){if(_0x2653c1){_0x249153=_0x2653c1;}return db[_0x0de8('0x31')][_0x0de8('0x4d')]({'where':{'id':_0x4c1d2a[_0x0de8('0x4a')]['id']},'attributes':[_0x0de8('0x58'),_0x0de8('0x53'),_0x0de8('0x59'),_0x0de8('0x5a'),_0x0de8('0x5b'),_0x0de8('0x68'),'defaultPreferred',_0x0de8('0x5d')],'raw':!![]});})[_0x0de8('0x1d')](handleEntityNotFound(_0x2bd522,null))[_0x0de8('0x1d')](function(_0x5b6485){if(_0x5b6485){var _0x2cbed2=_0x5b6485[_0x0de8('0x5a')]&&fs[_0x0de8('0x5e')](path['join'](config[_0x0de8('0x60')],_0x6349ff,_[_0x0de8('0x61')](_0x5b6485[_0x0de8('0x5a')])))?path[_0x0de8('0x5f')](config[_0x0de8('0x60')],_0x6349ff,_[_0x0de8('0x61')](_0x5b6485[_0x0de8('0x5a')])):path[_0x0de8('0x5f')](config[_0x0de8('0x60')],_0x6349ff,_[_0x0de8('0x61')]('default_favicon.ico'));var _0x292c61=_0x0de8('0x63')+_[_0x0de8('0x64')](_0x0de8('0x5a'));if(_0x5b6485[_0x292c61]||!_0x249153[_0x0de8('0x65')]){_0x2cbed2=path[_0x0de8('0x5f')](config[_0x0de8('0x60')],_0x6349ff,_[_0x0de8('0x61')](_0x0de8('0x71')));}if(!fs[_0x0de8('0x5e')](_0x2cbed2)){throw new db['Sequelize'][(_0x0de8('0x1b'))](_[_0x0de8('0x64')]('favicon')+'\x20not\x20found');}return _0x2bd522[_0x0de8('0x66')](_0x2cbed2);}})[_0x0de8('0x4e')](handleError(_0x2bd522,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index faccb48..67456c2 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 _0xd2c7=['exports','define','Setting','settings','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0xd2c7,0xeb));var _0x7d2c=function(_0x5296a7,_0x2b590b){_0x5296a7=_0x5296a7-0x0;var _0x5b608c=_0xd2c7[_0x5296a7];return _0x5b608c;};'use strict';var _=require('lodash');var util=require(_0x7d2c('0x0'));var logger=require(_0x7d2c('0x1'))(_0x7d2c('0x2'));var moment=require('moment');var BPromise=require(_0x7d2c('0x3'));var rp=require(_0x7d2c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d2c('0x5'));var config=require(_0x7d2c('0x6'));var attributes=require('./setting.attributes');module[_0x7d2c('0x7')]=function(_0x18767f,_0x39ea54){return _0x18767f[_0x7d2c('0x8')](_0x7d2c('0x9'),attributes,{'tableName':_0x7d2c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97a1=['path','rimraf','./setting.attributes','exports','define','settings','lodash','../../config/logger','moment','bluebird'];(function(_0x3f1895,_0x53b875){var _0x2df63f=function(_0x131bcc){while(--_0x131bcc){_0x3f1895['push'](_0x3f1895['shift']());}};_0x2df63f(++_0x53b875);}(_0x97a1,0x18c));var _0x197a=function(_0x594ffd,_0xf86373){_0x594ffd=_0x594ffd-0x0;var _0x538cbd=_0x97a1[_0x594ffd];return _0x538cbd;};'use strict';var _=require(_0x197a('0x0'));var util=require('util');var logger=require(_0x197a('0x1'))('api');var moment=require(_0x197a('0x2'));var BPromise=require(_0x197a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x197a('0x4'));var rimraf=require(_0x197a('0x5'));var config=require('../../config/environment');var attributes=require(_0x197a('0x6'));module[_0x197a('0x7')]=function(_0x2c980a,_0x2f615a){return _0x2c980a[_0x197a('0x8')]('Setting',attributes,{'tableName':_0x197a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index e8c5a06..831c91f 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 _0xb49e=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x320064,_0x16bc9e){var _0xe0b3d6=function(_0xf60c84){while(--_0xf60c84){_0x320064['push'](_0x320064['shift']());}};_0xe0b3d6(++_0x16bc9e);}(_0xb49e,0xb1));var _0xeb49=function(_0x26ec1d,_0x516a20){_0x26ec1d=_0x26ec1d-0x0;var _0x37da25=_0xb49e[_0x26ec1d];return _0x37da25;};'use strict';var _=require('lodash');var util=require(_0xeb49('0x0'));var moment=require(_0xeb49('0x1'));var BPromise=require(_0xeb49('0x2'));var rs=require(_0xeb49('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb49('0x4'))['db'];var utils=require(_0xeb49('0x5'));var logger=require(_0xeb49('0x6'))('rpc');var config=require(_0xeb49('0x7'));var jayson=require(_0xeb49('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x107e83,_0x161b5e,_0x5b27d3){return new BPromise(function(_0xef5788,_0x4fbe6c){return client[_0xeb49('0x9')](_0x107e83,_0x5b27d3)[_0xeb49('0xa')](function(_0x55b8d5){logger[_0xeb49('0xb')](_0xeb49('0xc'),_0x161b5e,_0xeb49('0xd'));logger[_0xeb49('0xe')](_0xeb49('0xf'),_0x161b5e,_0xeb49('0xd'),JSON[_0xeb49('0x10')](_0x55b8d5));if(_0x55b8d5['error']){if(_0x55b8d5[_0xeb49('0x11')][_0xeb49('0x12')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x161b5e,_0x55b8d5[_0xeb49('0x11')]['message']);return _0x4fbe6c(_0x55b8d5[_0xeb49('0x11')]['message']);}logger[_0xeb49('0x11')](_0xeb49('0xc'),_0x161b5e,_0x55b8d5[_0xeb49('0x11')]['message']);return _0xef5788(_0x55b8d5['error'][_0xeb49('0x13')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x161b5e,_0xeb49('0xd'));_0xef5788(_0x55b8d5[_0xeb49('0x14')][_0xeb49('0x13')]);}})[_0xeb49('0x15')](function(_0x37aeda){logger[_0xeb49('0x11')](_0xeb49('0xc'),_0x161b5e,_0x37aeda);_0x4fbe6c(_0x37aeda);});});} \ No newline at end of file +var _0xe850=['stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x58354a,_0x117350){var _0x5d2529=function(_0x287aec){while(--_0x287aec){_0x58354a['push'](_0x58354a['shift']());}};_0x5d2529(++_0x117350);}(_0xe850,0x65));var _0x0e85=function(_0x37212e,_0x1bf85d){_0x37212e=_0x37212e-0x0;var _0x14f5da=_0xe850[_0x37212e];return _0x14f5da;};'use strict';var _=require(_0x0e85('0x0'));var util=require('util');var moment=require(_0x0e85('0x1'));var BPromise=require(_0x0e85('0x2'));var rs=require(_0x0e85('0x3'));var fs=require('fs');var Redis=require(_0x0e85('0x4'));var db=require(_0x0e85('0x5'))['db'];var utils=require(_0x0e85('0x6'));var logger=require(_0x0e85('0x7'))(_0x0e85('0x8'));var config=require(_0x0e85('0x9'));var jayson=require(_0x0e85('0xa'));var client=jayson[_0x0e85('0xb')][_0x0e85('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x44a031,_0x2bec91,_0x42290f){return new BPromise(function(_0x5f2286,_0x2814f3){return client[_0x0e85('0xd')](_0x44a031,_0x42290f)['then'](function(_0x5d987d){logger[_0x0e85('0xe')](_0x0e85('0xf'),_0x2bec91,_0x0e85('0x10'));logger[_0x0e85('0x11')](_0x0e85('0x12'),_0x2bec91,_0x0e85('0x10'),JSON[_0x0e85('0x13')](_0x5d987d));if(_0x5d987d[_0x0e85('0x14')]){if(_0x5d987d[_0x0e85('0x14')][_0x0e85('0x15')]===0x1f4){logger[_0x0e85('0x14')]('Setting,\x20%s,\x20%s',_0x2bec91,_0x5d987d[_0x0e85('0x14')][_0x0e85('0x16')]);return _0x2814f3(_0x5d987d[_0x0e85('0x14')][_0x0e85('0x16')]);}logger[_0x0e85('0x14')](_0x0e85('0xf'),_0x2bec91,_0x5d987d['error']['message']);return _0x5f2286(_0x5d987d[_0x0e85('0x14')]['message']);}else{logger[_0x0e85('0xe')](_0x0e85('0xf'),_0x2bec91,_0x0e85('0x10'));_0x5f2286(_0x5d987d[_0x0e85('0x17')][_0x0e85('0x16')]);}})['catch'](function(_0x4edeaa){logger[_0x0e85('0x14')]('Setting,\x20%s,\x20%s',_0x2bec91,_0x4edeaa);_0x2814f3(_0x4edeaa);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d9ba50b..53b294a 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 _0x19a8=['delete','destroy','removeDispositions','removeAnswers','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','/:id/interactions','getInteractions','/:id/users','create','post','addDisposition','/:id/notify','notify','addApplications','/:id/send','send','status','addAgents','put','update'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x19a8,0xef));var _0x819a=function(_0x4a9de8,_0x4ebd5b){_0x4a9de8=_0x4a9de8-0x0;var _0x5c5794=_0x19a8[_0x4a9de8];return _0x5c5794;};'use strict';var multer=require('multer');var util=require(_0x819a('0x0'));var path=require(_0x819a('0x1'));var timeout=require(_0x819a('0x2'));var express=require('express');var router=express[_0x819a('0x3')]();var auth=require(_0x819a('0x4'));var interaction=require(_0x819a('0x5'));var config=require(_0x819a('0x6'));var controller=require(_0x819a('0x7'));router['get']('/',auth[_0x819a('0x8')](),controller[_0x819a('0x9')]);router[_0x819a('0xa')](_0x819a('0xb'),auth[_0x819a('0x8')](),controller[_0x819a('0xc')]);router['get'](_0x819a('0xd'),auth['isAuthenticated'](),controller[_0x819a('0xe')]);router[_0x819a('0xa')](_0x819a('0xf'),auth[_0x819a('0x8')](),controller[_0x819a('0x10')]);router[_0x819a('0xa')](_0x819a('0x11'),auth[_0x819a('0x8')](),controller['getAnswers']);router[_0x819a('0xa')](_0x819a('0x12'),auth[_0x819a('0x8')](),controller['getApplications']);router[_0x819a('0xa')](_0x819a('0x13'),auth[_0x819a('0x8')](),controller[_0x819a('0x14')]);router[_0x819a('0xa')]('/:id/status',controller['statusGet']);router[_0x819a('0xa')](_0x819a('0x15'),auth[_0x819a('0x8')](),controller['getAgents']);router['post']('/',auth[_0x819a('0x8')](),controller[_0x819a('0x16')]);router[_0x819a('0x17')]('/:id/dispositions',auth[_0x819a('0x8')](),controller[_0x819a('0x18')]);router[_0x819a('0x17')](_0x819a('0x11'),auth[_0x819a('0x8')](),controller['addAnswer']);router[_0x819a('0x17')](_0x819a('0x19'),controller[_0x819a('0x1a')]);router[_0x819a('0x17')](_0x819a('0x12'),auth[_0x819a('0x8')](),controller[_0x819a('0x1b')]);router['post'](_0x819a('0x1c'),auth[_0x819a('0x8')](),controller[_0x819a('0x1d')]);router['post']('/:id/status',controller[_0x819a('0x1e')]);router[_0x819a('0x17')](_0x819a('0x15'),auth[_0x819a('0x8')](),controller[_0x819a('0x1f')]);router[_0x819a('0x20')](_0x819a('0xd'),auth[_0x819a('0x8')](),controller[_0x819a('0x21')]);router[_0x819a('0x22')](_0x819a('0xd'),auth[_0x819a('0x8')](),controller[_0x819a('0x23')]);router[_0x819a('0x22')](_0x819a('0xf'),auth[_0x819a('0x8')](),controller[_0x819a('0x24')]);router[_0x819a('0x22')]('/:id/canned_answers',auth[_0x819a('0x8')](),controller[_0x819a('0x25')]);router[_0x819a('0x22')](_0x819a('0x15'),auth[_0x819a('0x8')](),controller['removeAgents']);module[_0x819a('0x26')]=router; \ No newline at end of file +var _0xf36f=['getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','addAnswer','notify','addApplications','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications'];(function(_0x2e967b,_0x11dc59){var _0x34f0a2=function(_0x4c7a89){while(--_0x4c7a89){_0x2e967b['push'](_0x2e967b['shift']());}};_0x34f0a2(++_0x11dc59);}(_0xf36f,0x155));var _0xff36=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf36f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xff36('0x0'));var util=require(_0xff36('0x1'));var path=require(_0xff36('0x2'));var timeout=require(_0xff36('0x3'));var express=require('express');var router=express[_0xff36('0x4')]();var auth=require(_0xff36('0x5'));var interaction=require(_0xff36('0x6'));var config=require(_0xff36('0x7'));var controller=require('./smsAccount.controller');router[_0xff36('0x8')]('/',auth[_0xff36('0x9')](),controller[_0xff36('0xa')]);router['get'](_0xff36('0xb'),auth[_0xff36('0x9')](),controller['describe']);router['get'](_0xff36('0xc'),auth[_0xff36('0x9')](),controller[_0xff36('0xd')]);router['get'](_0xff36('0xe'),auth[_0xff36('0x9')](),controller[_0xff36('0xf')]);router['get'](_0xff36('0x10'),auth[_0xff36('0x9')](),controller[_0xff36('0x11')]);router['get'](_0xff36('0x12'),auth[_0xff36('0x9')](),controller[_0xff36('0x13')]);router[_0xff36('0x8')](_0xff36('0x14'),auth[_0xff36('0x9')](),controller[_0xff36('0x15')]);router[_0xff36('0x8')]('/:id/status',controller['statusGet']);router[_0xff36('0x8')](_0xff36('0x16'),auth[_0xff36('0x9')](),controller['getAgents']);router[_0xff36('0x17')]('/',auth[_0xff36('0x9')](),controller[_0xff36('0x18')]);router[_0xff36('0x17')](_0xff36('0xe'),auth['isAuthenticated'](),controller[_0xff36('0x19')]);router[_0xff36('0x17')]('/:id/canned_answers',auth[_0xff36('0x9')](),controller[_0xff36('0x1a')]);router[_0xff36('0x17')]('/:id/notify',controller[_0xff36('0x1b')]);router[_0xff36('0x17')](_0xff36('0x12'),auth[_0xff36('0x9')](),controller[_0xff36('0x1c')]);router['post']('/:id/send',auth[_0xff36('0x9')](),controller[_0xff36('0x1d')]);router[_0xff36('0x17')]('/:id/status',controller[_0xff36('0x1e')]);router['post']('/:id/users',auth[_0xff36('0x9')](),controller[_0xff36('0x1f')]);router[_0xff36('0x20')](_0xff36('0xc'),auth[_0xff36('0x9')](),controller[_0xff36('0x21')]);router[_0xff36('0x22')](_0xff36('0xc'),auth['isAuthenticated'](),controller[_0xff36('0x23')]);router['delete'](_0xff36('0xe'),auth[_0xff36('0x9')](),controller[_0xff36('0x24')]);router['delete'](_0xff36('0x10'),auth['isAuthenticated'](),controller[_0xff36('0x25')]);router['delete'](_0xff36('0x16'),auth[_0xff36('0x9')](),controller[_0xff36('0x26')]);module[_0xff36('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 4462490..ecd9fb7 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 _0x0457=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x5e8be7,_0x36dbcb){var _0x4976ad=function(_0x3bfda5){while(--_0x3bfda5){_0x5e8be7['push'](_0x5e8be7['shift']());}};_0x4976ad(++_0x36dbcb);}(_0x0457,0x1ba));var _0x7045=function(_0x4e05d8,_0xab2ee9){_0x4e05d8=_0x4e05d8-0x0;var _0x356a48=_0x0457[_0x4e05d8];return _0x356a48;};'use strict';var Sequelize=require(_0x7045('0x0'));var rs=require('randomstring');module[_0x7045('0x1')]={'name':{'type':Sequelize[_0x7045('0x2')],'unique':_0x7045('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x7045('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x7045('0x2')],'defaultValue':function(){return rs[_0x7045('0x4')]();}},'phone':{'type':Sequelize[_0x7045('0x2')]},'type':{'type':Sequelize[_0x7045('0x5')](_0x7045('0x6'),_0x7045('0x7'),_0x7045('0x8'),_0x7045('0x9'),_0x7045('0xa'),_0x7045('0xb'),'csc',_0x7045('0xc'),_0x7045('0xd'))},'accountSid':{'type':Sequelize[_0x7045('0x2')]},'authId':{'type':Sequelize[_0x7045('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x7045('0x2')]},'password':{'type':Sequelize[_0x7045('0x2')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x7045('0x2')]},'deliveryReport':{'type':Sequelize[_0x7045('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x7045('0x2')]},'notificationTemplate':{'type':Sequelize[_0x7045('0xf')],'defaultValue':function(){return _0x7045('0x10');}},'notificationSound':{'type':Sequelize[_0x7045('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7045('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7045('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7045('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7045('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7045('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x7045('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7045('0x11')],'comment':_0x7045('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x7045('0xe')],'defaultValue':![],'comment':_0x7045('0x13'),'set':function(_0x3e34ae){if(!_0x3e34ae)this[_0x7045('0x14')](_0x7045('0x15'),null);this[_0x7045('0x14')](_0x7045('0x16'),_0x3e34ae);}}}; \ No newline at end of file +var _0x0beb=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','twilio','skebby','connectel','clicksend','clickatell','infobip','intelepeer','ENUM','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0xc371ba,_0x4bc1f0){var _0x4d864d=function(_0xd606ea){while(--_0xd606ea){_0xc371ba['push'](_0xc371ba['shift']());}};_0x4d864d(++_0x4bc1f0);}(_0x0beb,0xc2));var _0xb0be=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x0beb[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xb0be('0x0'));var rs=require('randomstring');module[_0xb0be('0x1')]={'name':{'type':Sequelize[_0xb0be('0x2')],'unique':_0xb0be('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xb0be('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xb0be('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xb0be('0x4')]();}},'phone':{'type':Sequelize[_0xb0be('0x2')]},'type':{'type':Sequelize['ENUM'](_0xb0be('0x5'),_0xb0be('0x6'),_0xb0be('0x7'),_0xb0be('0x8'),'plivo',_0xb0be('0x9'),'csc',_0xb0be('0xa'),_0xb0be('0xb'))},'accountSid':{'type':Sequelize[_0xb0be('0x2')]},'authId':{'type':Sequelize[_0xb0be('0x2')]},'authToken':{'type':Sequelize[_0xb0be('0x2')]},'smsMethod':{'type':Sequelize[_0xb0be('0xc')]('SI','TI','GP')},'username':{'type':Sequelize[_0xb0be('0x2')]},'password':{'type':Sequelize[_0xb0be('0x2')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xb0be('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xb0be('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb0be('0xd');}},'notificationSound':{'type':Sequelize[_0xb0be('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb0be('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb0be('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb0be('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb0be('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xb0be('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb0be('0xf')],'comment':_0xb0be('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xb0be('0xe')],'defaultValue':![],'comment':_0xb0be('0x11'),'set':function(_0x3994f4){if(!_0x3994f4)this[_0xb0be('0x12')](_0xb0be('0x13'),null);this[_0xb0be('0x12')](_0xb0be('0x14'),_0x3994f4);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index ea975cb..62b0716 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 _0x8a5c=['Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','applications','push','close','unmanaged','*,*,*,*','ContactId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','DELIVERED','redif','error_code','infobip','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','csc','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','SmsAccounts','stack','name','send','Pause','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','params','mandatoryDispositionPause','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','Applications','account','orderBy','priority','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','Body','messageId','MessageSid','skebby','sender','text','connectel','from','clicksend','message_id','From','Text','MessageUUID','results','originatingAddress','clickatell','fromNumber','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact'];(function(_0x4b48a7,_0x17f3d5){var _0x439f2d=function(_0x4bef7c){while(--_0x4bef7c){_0x4b48a7['push'](_0x4b48a7['shift']());}};_0x439f2d(++_0x17f3d5);}(_0x8a5c,0x136));var _0xc8a5=function(_0x42b6ca,_0x58c085){_0x42b6ca=_0x42b6ca-0x0;var _0x272849=_0x8a5c[_0x42b6ca];return _0x272849;};'use strict';var pdf=require(_0xc8a5('0x0'));var emlformat=require(_0xc8a5('0x1'));var rimraf=require(_0xc8a5('0x2'));var zipdir=require(_0xc8a5('0x3'));var jsonpatch=require(_0xc8a5('0x4'));var rp=require(_0xc8a5('0x5'));var moment=require(_0xc8a5('0x6'));var BPromise=require(_0xc8a5('0x7'));var Mustache=require(_0xc8a5('0x8'));var util=require('util');var path=require(_0xc8a5('0x9'));var sox=require(_0xc8a5('0xa'));var csv=require('to-csv');var ejs=require(_0xc8a5('0xb'));var fs=require('fs');var _=require(_0xc8a5('0xc'));var squel=require(_0xc8a5('0xd'));var crypto=require(_0xc8a5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc8a5('0xf'));var toCsv=require(_0xc8a5('0x10'));var querystring=require(_0xc8a5('0x11'));var Papa=require(_0xc8a5('0x12'));var Redis=require(_0xc8a5('0x13'));var authService=require(_0xc8a5('0x14'));var qs=require(_0xc8a5('0x15'));var as=require(_0xc8a5('0x16'));var hardwareService=require(_0xc8a5('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xc8a5('0x18'));var config=require('../../config/environment');var db=require(_0xc8a5('0x19'))['db'];config[_0xc8a5('0x1a')]=_[_0xc8a5('0x1b')](config[_0xc8a5('0x1a')],{'host':_0xc8a5('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc8a5('0x1a')]));require(_0xc8a5('0x1d'))['register'](socket);var jayson=require(_0xc8a5('0x1e'));var client=jayson[_0xc8a5('0x1f')][_0xc8a5('0x20')]({'port':0x232c});function checkPasswordPattern(_0x2090d0,_0xb1a230,_0x391cb9){if(_0x391cb9){var _0x5bb20e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5bb20e[_0xc8a5('0x21')](_0xb1a230)){return _0x2090d0;}else{throw new db[(_0xc8a5('0x22'))]['ValidationError'](_0xc8a5('0x23'));}}else{return _0x2090d0;}}function respondWithRpcPromise(_0x44179e,_0x5d1c16,_0x2b7bc4,_0x3ef8d3){return new BPromise(function(_0x12a441,_0x1326e2){var _0x1ea105=_0x3ef8d3||client;return _0x1ea105['request'](_0x44179e,_0x2b7bc4)[_0xc8a5('0x24')](function(_0x523ddf){logger[_0xc8a5('0x25')](_0xc8a5('0x26'),_0x5d1c16,'request\x20sent');logger['debug'](_0xc8a5('0x27'),_0x5d1c16,_0xc8a5('0x28'),JSON[_0xc8a5('0x29')](_0x523ddf));if(_0x523ddf[_0xc8a5('0x2a')]){if(_0x523ddf[_0xc8a5('0x2a')]['code']===0x1f4){logger['error'](_0xc8a5('0x26'),_0x5d1c16,_0x523ddf[_0xc8a5('0x2a')][_0xc8a5('0x2b')]);return _0x1326e2(_0x523ddf[_0xc8a5('0x2a')][_0xc8a5('0x2b')]);}logger[_0xc8a5('0x2a')]('SmsAccount,\x20%s,\x20%s',_0x5d1c16,_0x523ddf[_0xc8a5('0x2a')][_0xc8a5('0x2b')]);return _0x12a441(_0x523ddf[_0xc8a5('0x2a')][_0xc8a5('0x2b')]);}else{logger[_0xc8a5('0x25')](_0xc8a5('0x26'),_0x5d1c16,_0xc8a5('0x28'));_0x12a441(_0x523ddf[_0xc8a5('0x2c')][_0xc8a5('0x2b')]);}})['catch'](function(_0x11e162){logger[_0xc8a5('0x2a')](_0xc8a5('0x26'),_0x5d1c16,_0x11e162);_0x1326e2(_0x11e162);});});}function respondWithStatusCode(_0x3539fd,_0x3d391f){_0x3d391f=_0x3d391f||0xcc;return function(_0x453f5e){if(_0x453f5e){return _0x3539fd[_0xc8a5('0x2d')](_0x3d391f);}return _0x3539fd['status'](_0x3d391f)['end']();};}function respondWithResult(_0x9886,_0x4e0a4b){_0x4e0a4b=_0x4e0a4b||0xc8;return function(_0x4ef3d7){if(_0x4ef3d7){return _0x9886[_0xc8a5('0x2e')](_0x4e0a4b)[_0xc8a5('0x2f')](_0x4ef3d7);}};}function respondWithFilteredResult(_0x14422f,_0x1715f5){return function(_0x16fa00){if(_0x16fa00){var _0x31c416=_0x16fa00[_0xc8a5('0x30')],_0x48f58a=_0x1715f5[_0xc8a5('0x31')],_0x240e07=_0x1715f5[_0xc8a5('0x31')]+_0x1715f5[_0xc8a5('0x32')],_0x432800;if(_0x240e07>=_0x31c416){_0x240e07=_0x31c416;_0x432800=0xc8;}else{_0x432800=0xce;}_0x14422f['status'](_0x432800);return _0x14422f[_0xc8a5('0x33')](_0xc8a5('0x34'),_0x48f58a+'-'+_0x240e07+'/'+_0x31c416)[_0xc8a5('0x2f')](_0x16fa00);}return null;};}function patchUpdates(_0x25db3f){return function(_0x4bc893){try{jsonpatch['apply'](_0x4bc893,_0x25db3f,!![]);}catch(_0x402a5c){return BPromise[_0xc8a5('0x35')](_0x402a5c);}return _0x4bc893[_0xc8a5('0x36')]();};}function saveUpdates(_0x127ea2,_0x3824bf){return function(_0x5e8602){if(_0x5e8602){return _0x5e8602[_0xc8a5('0x37')](_0x127ea2)['then'](function(_0x1c016c){return _0x1c016c;});}return null;};}function removeEntity(_0x365052,_0x1474fa){return function(_0x5a2941){if(_0x5a2941){return _0x5a2941[_0xc8a5('0x38')]()[_0xc8a5('0x24')](function(){var _0x3c4eb7=_0x5a2941['get']({'plain':!![]});var _0xe5ec=_0xc8a5('0x39');return db['UserProfileResource'][_0xc8a5('0x38')]({'where':{'type':_0xe5ec,'resourceId':_0x3c4eb7['id']}})['then'](function(){return _0x5a2941;});})['then'](function(){_0x365052['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e5255,_0x397595){return function(_0x57905b){if(!_0x57905b){_0x5e5255[_0xc8a5('0x2d')](0x194);}return _0x57905b;};}function handleError(_0x3b7653,_0x2b9274){_0x2b9274=_0x2b9274||0x1f4;return function(_0x3de555){logger[_0xc8a5('0x2a')](_0x3de555[_0xc8a5('0x3a')]);if(_0x3de555[_0xc8a5('0x3b')]){delete _0x3de555['name'];}_0x3b7653[_0xc8a5('0x2e')](_0x2b9274)[_0xc8a5('0x3c')](_0x3de555);};}exports['index']=function(_0x369097,_0x49f349){var _0x59bc48={'include':[{'model':db[_0xc8a5('0x3d')],'as':'mandatoryDispositionPause'}]},_0x4020ec={},_0x3ca060={'count':0x0,'rows':[]};var _0x4e925c=_[_0xc8a5('0x3e')](db[_0xc8a5('0x3f')][_0xc8a5('0x40')],function(_0x3eb4e0){return{'name':_0x3eb4e0['fieldName'],'type':_0x3eb4e0[_0xc8a5('0x41')][_0xc8a5('0x42')]};});_0x4020ec[_0xc8a5('0x43')]=_['map'](_0x4e925c,'name');_0x4020ec[_0xc8a5('0x44')]=_[_0xc8a5('0x45')](_0x369097[_0xc8a5('0x44')]);_0x4020ec[_0xc8a5('0x46')]=_[_0xc8a5('0x47')](_0x4020ec['model'],_0x4020ec[_0xc8a5('0x44')]);_0x59bc48['attributes']=_['intersection'](_0x4020ec['model'],qs[_0xc8a5('0x48')](_0x369097[_0xc8a5('0x44')][_0xc8a5('0x48')]));_0x59bc48[_0xc8a5('0x49')]=_0x59bc48[_0xc8a5('0x49')][_0xc8a5('0x4a')]?_0x59bc48[_0xc8a5('0x49')]:_0x4020ec[_0xc8a5('0x43')];if(!_0x369097[_0xc8a5('0x44')][_0xc8a5('0x4b')](_0xc8a5('0x4c'))){_0x59bc48[_0xc8a5('0x32')]=qs[_0xc8a5('0x32')](_0x369097[_0xc8a5('0x44')]['limit']);_0x59bc48[_0xc8a5('0x31')]=qs[_0xc8a5('0x31')](_0x369097[_0xc8a5('0x44')][_0xc8a5('0x31')]);}_0x59bc48[_0xc8a5('0x4d')]=qs[_0xc8a5('0x4e')](_0x369097[_0xc8a5('0x44')][_0xc8a5('0x4e')]);_0x59bc48['where']=qs['filters'](_[_0xc8a5('0x4f')](_0x369097[_0xc8a5('0x44')],_0x4020ec[_0xc8a5('0x46')]));if(_0x369097['query'][_0xc8a5('0x50')]){_0x59bc48[_0xc8a5('0x51')]=_['merge'](_0x59bc48[_0xc8a5('0x51')],{'$or':_[_0xc8a5('0x3e')](_0x4e925c,function(_0x3e112f){if(_0x3e112f[_0xc8a5('0x41')]!=='VIRTUAL'){var _0x41b2a9={};_0x41b2a9[_0x3e112f[_0xc8a5('0x3b')]]={'$like':'%'+_0x369097[_0xc8a5('0x44')][_0xc8a5('0x50')]+'%'};return _0x41b2a9;}})});}_0x59bc48=_[_0xc8a5('0x52')]({},_0x59bc48,_0x369097[_0xc8a5('0x53')]);var _0x5d2435={'where':_0x59bc48[_0xc8a5('0x51')]};return db[_0xc8a5('0x3f')][_0xc8a5('0x30')](_0x5d2435)[_0xc8a5('0x24')](function(_0x3d39f4){_0x3ca060[_0xc8a5('0x30')]=_0x3d39f4;if(_0x369097[_0xc8a5('0x44')][_0xc8a5('0x54')]){_0x59bc48[_0xc8a5('0x55')]=[{'all':!![]}];}return db[_0xc8a5('0x3f')][_0xc8a5('0x56')](_0x59bc48);})[_0xc8a5('0x24')](function(_0xda9beb){_0x3ca060['rows']=_0xda9beb;return _0x3ca060;})[_0xc8a5('0x24')](respondWithFilteredResult(_0x49f349,_0x59bc48))['catch'](handleError(_0x49f349,null));};exports['show']=function(_0x55c67a,_0x4f6725){var _0x4f9c1e={'raw':![],'where':{'id':_0x55c67a[_0xc8a5('0x57')]['id']},'include':[{'model':db[_0xc8a5('0x3d')],'as':_0xc8a5('0x58')}]},_0x1d1305={};_0x1d1305[_0xc8a5('0x43')]=_[_0xc8a5('0x45')](db[_0xc8a5('0x3f')][_0xc8a5('0x40')]);_0x1d1305[_0xc8a5('0x44')]=_['keys'](_0x55c67a[_0xc8a5('0x44')]);_0x1d1305[_0xc8a5('0x46')]=_[_0xc8a5('0x47')](_0x1d1305[_0xc8a5('0x43')],_0x1d1305[_0xc8a5('0x44')]);_0x4f9c1e['attributes']=_[_0xc8a5('0x47')](_0x1d1305[_0xc8a5('0x43')],qs[_0xc8a5('0x48')](_0x55c67a[_0xc8a5('0x44')][_0xc8a5('0x48')]));_0x4f9c1e['attributes']=_0x4f9c1e[_0xc8a5('0x49')]['length']?_0x4f9c1e[_0xc8a5('0x49')]:_0x1d1305[_0xc8a5('0x43')];if(_0x55c67a['query'][_0xc8a5('0x54')]){_0x4f9c1e['include']=[{'all':!![]}];}_0x4f9c1e=_[_0xc8a5('0x52')]({},_0x4f9c1e,_0x55c67a[_0xc8a5('0x53')]);return db[_0xc8a5('0x3f')][_0xc8a5('0x59')](_0x4f9c1e)[_0xc8a5('0x24')](handleEntityNotFound(_0x4f6725,null))[_0xc8a5('0x24')](respondWithResult(_0x4f6725,null))[_0xc8a5('0x5a')](handleError(_0x4f6725,null));};exports[_0xc8a5('0x5b')]=function(_0x527895,_0x3c5ece){return db[_0xc8a5('0x3f')][_0xc8a5('0x5b')](_0x527895[_0xc8a5('0x5c')],{})['then'](function(_0x11a937){var _0x26d980=_0x527895[_0xc8a5('0x5d')][_0xc8a5('0x5e')]({'plain':!![]});if(!_0x26d980)throw new Error(_0xc8a5('0x5f'));if(_0x26d980[_0xc8a5('0x60')]===_0xc8a5('0x5d')){var _0x63f943=_0x11a937['get']({'plain':!![]});var _0x8c7224='SmsAccounts';return db[_0xc8a5('0x61')]['find']({'where':{'name':_0x8c7224,'userProfileId':_0x26d980[_0xc8a5('0x62')]},'raw':!![]})[_0xc8a5('0x24')](function(_0x54ceb4){if(_0x54ceb4&&_0x54ceb4[_0xc8a5('0x63')]===0x0){return db[_0xc8a5('0x64')][_0xc8a5('0x5b')]({'name':_0x63f943[_0xc8a5('0x3b')],'resourceId':_0x63f943['id'],'type':_0x54ceb4[_0xc8a5('0x3b')],'sectionId':_0x54ceb4['id']},{})[_0xc8a5('0x24')](function(){return _0x11a937;});}else{return _0x11a937;}})[_0xc8a5('0x5a')](function(_0x1e52c2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e52c2);throw _0x1e52c2;});}return _0x11a937;})[_0xc8a5('0x24')](respondWithResult(_0x3c5ece,0xc9))[_0xc8a5('0x5a')](handleError(_0x3c5ece,null));};exports[_0xc8a5('0x37')]=function(_0x515441,_0x109bf8){if(_0x515441[_0xc8a5('0x5c')]['id']){delete _0x515441['body']['id'];}return db['SmsAccount'][_0xc8a5('0x59')]({'where':{'id':_0x515441[_0xc8a5('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xc8a5('0x24')](handleEntityNotFound(_0x109bf8,null))[_0xc8a5('0x24')](saveUpdates(_0x515441[_0xc8a5('0x5c')],null))[_0xc8a5('0x24')](respondWithResult(_0x109bf8,null))[_0xc8a5('0x5a')](handleError(_0x109bf8,null));};exports[_0xc8a5('0x38')]=function(_0x5d0434,_0x5c3ed4){return db[_0xc8a5('0x3f')][_0xc8a5('0x59')]({'where':{'id':_0x5d0434[_0xc8a5('0x57')]['id']}})[_0xc8a5('0x24')](handleEntityNotFound(_0x5c3ed4,null))[_0xc8a5('0x24')](removeEntity(_0x5c3ed4,null))[_0xc8a5('0x5a')](handleError(_0x5c3ed4,null));};exports[_0xc8a5('0x65')]=function(_0x3a3132,_0x586e4b){return db[_0xc8a5('0x3f')][_0xc8a5('0x65')]()[_0xc8a5('0x24')](respondWithResult(_0x586e4b,null))['catch'](handleError(_0x586e4b,null));};exports[_0xc8a5('0x66')]=function(_0x591acf,_0x5a6bcd,_0x54127c){if(_0x591acf[_0xc8a5('0x5c')]['id']){delete _0x591acf['body']['id'];}return db[_0xc8a5('0x3f')]['find']({'where':{'id':_0x591acf[_0xc8a5('0x57')]['id']}})['then'](handleEntityNotFound(_0x5a6bcd,null))[_0xc8a5('0x24')](function(_0x53645c){if(_0x53645c){_0x591acf['body'][_0xc8a5('0x67')]=_0x53645c['id'];return db[_0xc8a5('0x68')][_0xc8a5('0x5b')](_0x591acf[_0xc8a5('0x5c')]);}})[_0xc8a5('0x24')](respondWithResult(_0x5a6bcd,null))[_0xc8a5('0x5a')](handleError(_0x5a6bcd,null));};exports[_0xc8a5('0x69')]=function(_0x509886,_0x280668,_0x23f2cc){var _0x208ae1={'raw':![],'where':{}};var _0x24aed1={};var _0x3f2cce={'count':0x0,'rows':[]};return db['SmsAccount'][_0xc8a5('0x6a')]({'where':{'id':_0x509886[_0xc8a5('0x57')]['id']}})['then'](handleEntityNotFound(_0x280668,null))[_0xc8a5('0x24')](function(_0x98b938){if(_0x98b938){_0x24aed1[_0xc8a5('0x43')]=_[_0xc8a5('0x45')](db[_0xc8a5('0x68')][_0xc8a5('0x40')]);_0x24aed1['query']=_[_0xc8a5('0x45')](_0x509886[_0xc8a5('0x44')]);_0x24aed1[_0xc8a5('0x46')]=_['intersection'](_0x24aed1[_0xc8a5('0x43')],_0x24aed1['query']);_0x208ae1[_0xc8a5('0x49')]=_[_0xc8a5('0x47')](_0x24aed1[_0xc8a5('0x43')],qs[_0xc8a5('0x48')](_0x509886['query'][_0xc8a5('0x48')]));_0x208ae1[_0xc8a5('0x49')]=_0x208ae1[_0xc8a5('0x49')][_0xc8a5('0x4a')]?_0x208ae1[_0xc8a5('0x49')]:_0x24aed1[_0xc8a5('0x43')];if(!_0x509886[_0xc8a5('0x44')][_0xc8a5('0x4b')](_0xc8a5('0x4c'))){_0x208ae1[_0xc8a5('0x32')]=qs[_0xc8a5('0x32')](_0x509886[_0xc8a5('0x44')][_0xc8a5('0x32')]);_0x208ae1[_0xc8a5('0x31')]=qs[_0xc8a5('0x31')](_0x509886['query'][_0xc8a5('0x31')]);}_0x208ae1[_0xc8a5('0x4d')]=qs[_0xc8a5('0x4e')](_0x509886[_0xc8a5('0x44')]['sort']);_0x208ae1['where']=qs[_0xc8a5('0x46')](_['pick'](_0x509886['query'],_0x24aed1['filters']));_0x208ae1['where'][_0xc8a5('0x67')]=_0x98b938['id'];if(_0x509886['query'][_0xc8a5('0x50')]){_0x208ae1[_0xc8a5('0x51')]=_[_0xc8a5('0x52')](_0x208ae1['where'],{'$or':_[_0xc8a5('0x3e')](_0x208ae1[_0xc8a5('0x49')],function(_0x51e069){var _0x305ad3={};_0x305ad3[_0x51e069]={'$like':'%'+_0x509886[_0xc8a5('0x44')][_0xc8a5('0x50')]+'%'};return _0x305ad3;})});}_0x208ae1=_[_0xc8a5('0x52')]({},_0x208ae1,_0x509886[_0xc8a5('0x53')]);return db[_0xc8a5('0x68')]['count']({'where':_0x208ae1['where']})[_0xc8a5('0x24')](function(_0x349b81){_0x3f2cce[_0xc8a5('0x30')]=_0x349b81;if(_0x509886[_0xc8a5('0x44')][_0xc8a5('0x54')]){_0x208ae1[_0xc8a5('0x55')]=[{'all':!![]}];}return db[_0xc8a5('0x68')]['findAll'](_0x208ae1);})['then'](function(_0x19c80d){_0x3f2cce[_0xc8a5('0x6b')]=_0x19c80d;return _0x3f2cce;});}})[_0xc8a5('0x24')](respondWithFilteredResult(_0x280668,_0x208ae1))[_0xc8a5('0x5a')](handleError(_0x280668,null));};exports[_0xc8a5('0x6c')]=function(_0x30aeb1,_0x56b356,_0x342206){return db[_0xc8a5('0x3f')][_0xc8a5('0x59')]({'where':{'id':_0x30aeb1[_0xc8a5('0x57')]['id']}})[_0xc8a5('0x24')](handleEntityNotFound(_0x56b356,null))[_0xc8a5('0x24')](function(_0x325948){if(_0x325948){return _0x325948['removeDispositions'](_0x30aeb1['query'][_0xc8a5('0x6d')]);}})['then'](respondWithStatusCode(_0x56b356,null))[_0xc8a5('0x5a')](handleError(_0x56b356,null));};exports[_0xc8a5('0x6e')]=function(_0x2c9948,_0x545c95,_0x5b738e){if(_0x2c9948[_0xc8a5('0x5c')]['id']){delete _0x2c9948[_0xc8a5('0x5c')]['id'];}return db[_0xc8a5('0x3f')][_0xc8a5('0x59')]({'where':{'id':_0x2c9948[_0xc8a5('0x57')]['id']}})[_0xc8a5('0x24')](handleEntityNotFound(_0x545c95,null))[_0xc8a5('0x24')](function(_0x174bb9){if(_0x174bb9){_0x2c9948['body'][_0xc8a5('0x67')]=_0x174bb9['id'];return db[_0xc8a5('0x6f')]['create'](_0x2c9948['body']);}})['then'](respondWithResult(_0x545c95,null))['catch'](handleError(_0x545c95,null));};exports[_0xc8a5('0x70')]=function(_0x5a480c,_0x1ab8aa,_0x4449aa){var _0x376991={'raw':![],'where':{}};var _0x224c56={};var _0x562798={'count':0x0,'rows':[]};return db[_0xc8a5('0x3f')][_0xc8a5('0x6a')]({'where':{'id':_0x5a480c[_0xc8a5('0x57')]['id']}})[_0xc8a5('0x24')](handleEntityNotFound(_0x1ab8aa,null))[_0xc8a5('0x24')](function(_0x47c92f){if(_0x47c92f){_0x224c56[_0xc8a5('0x43')]=_['keys'](db['CannedAnswer'][_0xc8a5('0x40')]);_0x224c56['query']=_['keys'](_0x5a480c[_0xc8a5('0x44')]);_0x224c56['filters']=_[_0xc8a5('0x47')](_0x224c56['model'],_0x224c56[_0xc8a5('0x44')]);_0x376991[_0xc8a5('0x49')]=_[_0xc8a5('0x47')](_0x224c56['model'],qs['fields'](_0x5a480c[_0xc8a5('0x44')][_0xc8a5('0x48')]));_0x376991[_0xc8a5('0x49')]=_0x376991[_0xc8a5('0x49')]['length']?_0x376991[_0xc8a5('0x49')]:_0x224c56[_0xc8a5('0x43')];if(!_0x5a480c[_0xc8a5('0x44')][_0xc8a5('0x4b')](_0xc8a5('0x4c'))){_0x376991[_0xc8a5('0x32')]=qs[_0xc8a5('0x32')](_0x5a480c[_0xc8a5('0x44')][_0xc8a5('0x32')]);_0x376991[_0xc8a5('0x31')]=qs[_0xc8a5('0x31')](_0x5a480c[_0xc8a5('0x44')][_0xc8a5('0x31')]);}_0x376991[_0xc8a5('0x4d')]=qs[_0xc8a5('0x4e')](_0x5a480c['query'][_0xc8a5('0x4e')]);_0x376991['where']=qs[_0xc8a5('0x46')](_[_0xc8a5('0x4f')](_0x5a480c[_0xc8a5('0x44')],_0x224c56[_0xc8a5('0x46')]));_0x376991[_0xc8a5('0x51')]['SmsAccountId']=_0x47c92f['id'];if(_0x5a480c['query'][_0xc8a5('0x50')]){_0x376991[_0xc8a5('0x51')]=_[_0xc8a5('0x52')](_0x376991[_0xc8a5('0x51')],{'$or':_[_0xc8a5('0x3e')](_0x376991[_0xc8a5('0x49')],function(_0x42d298){var _0x2618d6={};_0x2618d6[_0x42d298]={'$like':'%'+_0x5a480c[_0xc8a5('0x44')]['filter']+'%'};return _0x2618d6;})});}_0x376991=_[_0xc8a5('0x52')]({},_0x376991,_0x5a480c[_0xc8a5('0x53')]);return db[_0xc8a5('0x6f')][_0xc8a5('0x30')]({'where':_0x376991[_0xc8a5('0x51')]})[_0xc8a5('0x24')](function(_0x5a29ad){_0x562798[_0xc8a5('0x30')]=_0x5a29ad;if(_0x5a480c[_0xc8a5('0x44')]['includeAll']){_0x376991[_0xc8a5('0x55')]=[{'all':!![]}];}return db[_0xc8a5('0x6f')][_0xc8a5('0x56')](_0x376991);})[_0xc8a5('0x24')](function(_0x3257d4){_0x562798['rows']=_0x3257d4;return _0x562798;});}})[_0xc8a5('0x24')](respondWithFilteredResult(_0x1ab8aa,_0x376991))['catch'](handleError(_0x1ab8aa,null));};exports['removeAnswers']=function(_0x2d7f4c,_0x3345f0,_0xa9050a){return db['SmsAccount']['find']({'where':{'id':_0x2d7f4c['params']['id']}})[_0xc8a5('0x24')](handleEntityNotFound(_0x3345f0,null))['then'](function(_0x20e5e4){if(_0x20e5e4){return _0x20e5e4[_0xc8a5('0x71')](_0x2d7f4c['query'][_0xc8a5('0x6d')]);}})[_0xc8a5('0x24')](respondWithStatusCode(_0x3345f0,null))[_0xc8a5('0x5a')](handleError(_0x3345f0,null));};exports[_0xc8a5('0x72')]=function(_0x25e621,_0x43a82b,_0xd7c7b3){var _0x2023c8={'channel':_0xc8a5('0x73')};var _0x1ef417=[];var _0x4b0e90=[];var _0xd1cac8={};return db[_0xc8a5('0x3f')][_0xc8a5('0x59')]({'where':{'id':_0x25e621[_0xc8a5('0x57')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xc8a5('0x74')}]})[_0xc8a5('0x24')](handleEntityNotFound(_0x43a82b,null))['then'](function(_0x3a50a2){_0x2023c8[_0xc8a5('0x75')]=_0x3a50a2;_0x2023c8['applications']=_[_0xc8a5('0x76')](_0x3a50a2['Applications'],[_0xc8a5('0x77')],['asc']);if(_0x2023c8['account'][_0xc8a5('0x74')]){delete _0x2023c8['account'][_0xc8a5('0x74')];}return db['CmContact'][_0xc8a5('0x65')]();})['then'](function(_0x26e746){if(!_0x26e746){throw new db[(_0xc8a5('0x22'))][(_0xc8a5('0x78'))](_0xc8a5('0x79'));}_0x1ef417=_[_0xc8a5('0x7a')](_[_0xc8a5('0x45')](_0x26e746),[_0xc8a5('0x7b'),_0xc8a5('0x7c')]);_0x4b0e90=_[_0xc8a5('0x7a')](_['keys'](_0x26e746),[_0xc8a5('0x7b'),_0xc8a5('0x7c'),_0xc8a5('0x7d'),_0xc8a5('0x7e')]);_0x2023c8[_0xc8a5('0x5c')]={'mapKey':_0xc8a5('0x7f')};if(_0x2023c8[_0xc8a5('0x75')][_0xc8a5('0x41')]){switch(_0x2023c8[_0xc8a5('0x75')][_0xc8a5('0x41')]){case _0xc8a5('0x80'):_0x2023c8[_0xc8a5('0x5c')]['from']=_0x25e621['body']['From'];_0x2023c8[_0xc8a5('0x5c')]['body']=_0x25e621[_0xc8a5('0x5c')][_0xc8a5('0x81')];_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x82')]=_0x25e621[_0xc8a5('0x5c')][_0xc8a5('0x83')];break;case _0xc8a5('0x84'):_0x2023c8[_0xc8a5('0x5c')]['from']='+'+_0x25e621[_0xc8a5('0x5c')][_0xc8a5('0x85')];_0x2023c8['body'][_0xc8a5('0x5c')]=_0x25e621[_0xc8a5('0x5c')][_0xc8a5('0x86')];break;case _0xc8a5('0x87'):_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x88')]=_0x25e621[_0xc8a5('0x5c')][_0xc8a5('0x88')];_0x2023c8['body']['body']=_0x25e621[_0xc8a5('0x5c')][_0xc8a5('0x2b')];break;case _0xc8a5('0x89'):_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x88')]=_0x25e621['body']['from'];_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x5c')]=_0x25e621[_0xc8a5('0x5c')][_0xc8a5('0x5c')];_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x82')]=_0x25e621['body'][_0xc8a5('0x8a')];break;case'plivo':_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x88')]=_0x25e621[_0xc8a5('0x5c')][_0xc8a5('0x8b')];_0x2023c8[_0xc8a5('0x5c')]['body']=_0x25e621['body'][_0xc8a5('0x8c')];_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x82')]=_0x25e621[_0xc8a5('0x5c')][_0xc8a5('0x8d')];break;case'infobip':_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x88')]='+'+_0x25e621[_0xc8a5('0x5c')][_0xc8a5('0x8e')][0x0][_0xc8a5('0x88')];_0x2023c8[_0xc8a5('0x5c')]['body']=_0x25e621[_0xc8a5('0x5c')][_0xc8a5('0x8e')][0x0][_0xc8a5('0x86')];_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x82')]=_0x25e621[_0xc8a5('0x5c')][_0xc8a5('0x8e')][0x0]['messageId'];break;case'csc':_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x88')]=_0x25e621['body'][_0xc8a5('0x8f')];_0x2023c8['body']['body']=_0x25e621[_0xc8a5('0x5c')]['segmentedMessage'][_0xc8a5('0x2b')];break;case _0xc8a5('0x90'):_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x88')]=_0x25e621['body'][_0xc8a5('0x91')];_0x2023c8['body'][_0xc8a5('0x5c')]=_0x25e621['body']['text'];_0x2023c8['body'][_0xc8a5('0x82')]=_0x25e621[_0xc8a5('0x5c')][_0xc8a5('0x92')];break;case _0xc8a5('0x93'):_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x88')]=_0x25e621[_0xc8a5('0x5c')]['from'];_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x5c')]=_0x25e621['body'][_0xc8a5('0x2b')];_0x2023c8['body']['messageId']=_0x25e621[_0xc8a5('0x5c')]['refid'];break;}}if(_0x2023c8['body']['id']){delete _0x2023c8[_0xc8a5('0x5c')]['id'];}if(_[_0xc8a5('0x94')](_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x88')])){throw new db[(_0xc8a5('0x22'))][(_0xc8a5('0x78'))]('from\x20is\x20mandatory');}if(_[_0xc8a5('0x94')](_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x5c')])||_0x2023c8['body'][_0xc8a5('0x5c')]===''){throw new db[(_0xc8a5('0x22'))]['ValidationError'](_0xc8a5('0x95'));}if(_[_0xc8a5('0x94')](_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x96')])){throw new db[(_0xc8a5('0x22'))][(_0xc8a5('0x78'))](_0xc8a5('0x97')+_0x4b0e90);}if(!_[_0xc8a5('0x98')](_0x4b0e90,_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x96')])){throw new db['Sequelize'][(_0xc8a5('0x78'))](_0xc8a5('0x99')+_0x4b0e90);}_0xd1cac8[_0x2023c8['body']['mapKey']]=_0x2023c8['body']['from'];return db[_0xc8a5('0x9a')][_0xc8a5('0x59')]({'where':{'id':_0x2023c8[_0xc8a5('0x75')][_0xc8a5('0x7e')]},'include':[{'model':db[_0xc8a5('0x9b')],'as':_0xc8a5('0x9c'),'where':_0xd1cac8,'limit':0x1,'order':[[_0xc8a5('0x7c'),_0xc8a5('0x9d')]]}]});})[_0xc8a5('0x24')](handleEntityNotFound(_0x43a82b,null))[_0xc8a5('0x24')](function(_0x326459){if(_0x326459){_0x2023c8[_0xc8a5('0x9e')]=_[_0xc8a5('0x9f')](_0x326459,[_0xc8a5('0x9c')]);if(_0x326459['Contacts']['length']){return _0x326459[_0xc8a5('0x9c')][0x0];}var _0x5d8887=_['defaults'](_0x2023c8[_0xc8a5('0x5c')],{'firstName':_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x88')],'ListId':_0x326459['id']});_0x5d8887[_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x96')]]=_0x2023c8[_0xc8a5('0x5c')]['from'];return db[_0xc8a5('0x9b')][_0xc8a5('0x5b')](_0x5d8887,{'fields':_0x1ef417,'raw':!![]});}})[_0xc8a5('0x24')](handleEntityNotFound(_0x43a82b,null))[_0xc8a5('0x24')](function(_0x55eac1){if(_0x55eac1){_0x2023c8[_0xc8a5('0xa0')]=_0x55eac1;var _0x4537ef={'ContactId':_0x55eac1['id'],'phone':_0x2023c8['body']['from'],'SmsAccountId':_0x25e621['params']['id']};var _0x4a3f49={'ContactId':_0x55eac1['id'],'SmsAccountId':_0x25e621[_0xc8a5('0x57')]['id'],'closed':![]};return db['SmsInteraction'][_0xc8a5('0x59')]({'where':_0x4a3f49})[_0xc8a5('0x24')](function(_0x2478b3){if(_0x2478b3){return[_0x2478b3,![]];}return db[_0xc8a5('0xa1')][_0xc8a5('0x5b')](_0x4537ef)['then'](function(_0x38f2b4){return[_0x38f2b4,!![]];});});}})[_0xc8a5('0xa2')](function(_0x3c6668,_0x448aa8){_0x2023c8['interaction']=_0x3c6668[_0xc8a5('0x5e')]({'plain':!![]});_0x2023c8[_0xc8a5('0xa3')][_0xc8a5('0xa4')]=![];if(_0x448aa8){if(_0x2023c8['account']['autoclose']){_0x2023c8[_0xc8a5('0xa5')][_0xc8a5('0xa6')]({'id':0x0,'priority':_0x2023c8[_0xc8a5('0xa5')][_0xc8a5('0x4a')]+0x1,'app':_0xc8a5('0xa7'),'appdata':_0xc8a5('0xa8'),'interval':_0xc8a5('0xa9')});}_0x2023c8[_0xc8a5('0xa3')][_0xc8a5('0xa4')]=!![];}return db['SmsMessage']['create']({'phone':_0x2023c8['body'][_0xc8a5('0x88')],'messageId':_0x2023c8['body'][_0xc8a5('0x82')],'body':_0x2023c8[_0xc8a5('0x5c')][_0xc8a5('0x5c')],'SmsAccountId':_0x25e621[_0xc8a5('0x57')]['id'],'SmsInteractionId':_0x3c6668['id'],'direction':'in','ContactId':_0x3c6668[_0xc8a5('0xaa')],'AttachmentId':_0x2023c8[_0xc8a5('0x5c')]['AttachmentId']});})['then'](function(_0x15a64d){_0x2023c8[_0xc8a5('0x2b')]=_0x15a64d;if(_0x2023c8['interaction']['UserId']){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x2023c8['interaction'][_0xc8a5('0xab')]}})['then'](function(_0x1a792e){if(_0x1a792e){_0x2023c8['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xc8a5('0xac'),'appdata':_0x1a792e[_0xc8a5('0x3b')]+','+(_0x2023c8['account'][_0xc8a5('0xad')]||0xa),'interval':_0xc8a5('0xa9')});}return respondWithRpcPromise(_0xc8a5('0xae'),_0xc8a5('0xaf'),_0x2023c8);});}return respondWithRpcPromise(_0xc8a5('0xae'),'startRouting',_0x2023c8);})[_0xc8a5('0x24')](function(_0x57469f){if(_0x57469f){var _0x4868fc=0xc8;var _0x12befa=_0xc8a5('0xb0');logger[_0xc8a5('0x25')](_0xc8a5('0x27'),_0x12befa,_0x4868fc,_0xc8a5('0xb1'));logger[_0xc8a5('0xb2')](_0xc8a5('0xb3'),_0x12befa,_0x4868fc,'entity\x20found',JSON[_0xc8a5('0x29')](_0x57469f));if(_0x2023c8[_0xc8a5('0x75')][_0xc8a5('0x41')]==='twilio'){return _0x43a82b['status'](_0x4868fc)[_0xc8a5('0x33')](_0xc8a5('0xb4'),_0xc8a5('0xb5'))[_0xc8a5('0x3c')](_0xc8a5('0xb6'));}else{return _0x43a82b[_0xc8a5('0x2e')](_0x4868fc)[_0xc8a5('0x2f')](_0x57469f);}}})[_0xc8a5('0x5a')](handleError(_0x43a82b,null));};exports[_0xc8a5('0xb7')]=function(_0x217ede,_0xfc6e88,_0x901a33){return db[_0xc8a5('0x3f')]['findOne']({'where':{'id':_0x217ede[_0xc8a5('0x57')]['id']}})[_0xc8a5('0x24')](handleEntityNotFound(_0xfc6e88,null))[_0xc8a5('0x24')](function(_0x4856d1){if(_0x4856d1){return db[_0xc8a5('0xb8')][_0xc8a5('0xb9')](function(_0xbb5433){return db[_0xc8a5('0xba')][_0xc8a5('0x38')]({'where':{'SmsAccountId':_0x217ede['params']['id']},'transaction':_0xbb5433})[_0xc8a5('0x24')](function(_0x53af8a){var _0x478167=_[_0xc8a5('0x3e')](_0x217ede[_0xc8a5('0x5c')],function(_0x19210d){_0x19210d[_0xc8a5('0x67')]=_0x217ede[_0xc8a5('0x57')]['id'];return _0x19210d;});return db['SmsApplication'][_0xc8a5('0xbb')](_0x478167,{'transaction':_0xbb5433});});})[_0xc8a5('0x24')](function(){return db[_0xc8a5('0xba')][_0xc8a5('0xbc')]({'where':{'SmsAccountId':_0x217ede[_0xc8a5('0x57')]['id']},'order':'priority'});});}})[_0xc8a5('0x24')](respondWithResult(_0xfc6e88,null))[_0xc8a5('0x5a')](handleError(_0xfc6e88,null));};exports['getApplications']=function(_0x3004d6,_0x805655,_0x40d21b){var _0x244e4b={};var _0x441262={};var _0x21ab9e;var _0x1354b8;return db[_0xc8a5('0x3f')][_0xc8a5('0x6a')]({'where':{'id':_0x3004d6[_0xc8a5('0x57')]['id']}})['then'](handleEntityNotFound(_0x805655,null))[_0xc8a5('0x24')](function(_0xa39099){if(_0xa39099){_0x21ab9e=_0xa39099;_0x441262[_0xc8a5('0x43')]=_[_0xc8a5('0x45')](db[_0xc8a5('0xba')][_0xc8a5('0x40')]);_0x441262[_0xc8a5('0x44')]=_[_0xc8a5('0x45')](_0x3004d6['query']);_0x441262[_0xc8a5('0x46')]=_[_0xc8a5('0x47')](_0x441262[_0xc8a5('0x43')],_0x441262[_0xc8a5('0x44')]);_0x244e4b[_0xc8a5('0x49')]=_['intersection'](_0x441262[_0xc8a5('0x43')],qs[_0xc8a5('0x48')](_0x3004d6[_0xc8a5('0x44')][_0xc8a5('0x48')]));_0x244e4b[_0xc8a5('0x49')]=_0x244e4b['attributes'][_0xc8a5('0x4a')]?_0x244e4b['attributes']:_0x441262[_0xc8a5('0x43')];_0x244e4b[_0xc8a5('0x4d')]=qs['sort'](_0x3004d6[_0xc8a5('0x44')][_0xc8a5('0x4e')]);_0x244e4b['where']=qs[_0xc8a5('0x46')](_[_0xc8a5('0x4f')](_0x3004d6[_0xc8a5('0x44')],_0x441262[_0xc8a5('0x46')]));if(_0x3004d6[_0xc8a5('0x44')][_0xc8a5('0x50')]){_0x244e4b[_0xc8a5('0x51')]=_[_0xc8a5('0x52')](_0x244e4b['where'],{'$or':_['map'](_0x244e4b['attributes'],function(_0x275711){var _0x3cf043={};_0x3cf043[_0x275711]={'$like':'%'+_0x3004d6[_0xc8a5('0x44')][_0xc8a5('0x50')]+'%'};return _0x3cf043;})});}_0x244e4b=_[_0xc8a5('0x52')]({},_0x244e4b,_0x3004d6[_0xc8a5('0x53')]);return _0x21ab9e[_0xc8a5('0xbd')](_0x244e4b);}})[_0xc8a5('0x24')](function(_0x23e905){if(_0x23e905){_0x1354b8=_0x23e905[_0xc8a5('0x4a')];if(!_0x3004d6['query'][_0xc8a5('0x4b')](_0xc8a5('0x4c'))){_0x244e4b[_0xc8a5('0x32')]=qs[_0xc8a5('0x32')](_0x3004d6[_0xc8a5('0x44')]['limit']);_0x244e4b[_0xc8a5('0x31')]=qs[_0xc8a5('0x31')](_0x3004d6['query'][_0xc8a5('0x31')]);}return _0x21ab9e[_0xc8a5('0xbd')](_0x244e4b);}})[_0xc8a5('0x24')](function(_0x4d1d6f){if(_0x4d1d6f){return _0x4d1d6f?{'count':_0x1354b8,'rows':_0x4d1d6f}:null;}})['then'](respondWithResult(_0x805655,null))[_0xc8a5('0x5a')](handleError(_0x805655,null));};exports[_0xc8a5('0xbe')]=function(_0x16b62c,_0x191f9f,_0x4c0e2a){var _0x131caa={'raw':![],'where':{}};var _0x479191={};var _0x1272c1={'count':0x0,'rows':[]};return db[_0xc8a5('0x3f')][_0xc8a5('0x6a')]({'where':{'id':_0x16b62c[_0xc8a5('0x57')]['id']}})[_0xc8a5('0x24')](handleEntityNotFound(_0x191f9f,null))[_0xc8a5('0x24')](function(_0x44ed6c){if(_0x44ed6c){_0x479191['model']=_[_0xc8a5('0x45')](db['SmsInteraction'][_0xc8a5('0x40')]);_0x479191[_0xc8a5('0x44')]=_['keys'](_0x16b62c['query']);_0x479191[_0xc8a5('0x46')]=_[_0xc8a5('0x47')](_0x479191[_0xc8a5('0x43')],_0x479191[_0xc8a5('0x44')]);_0x131caa[_0xc8a5('0x49')]=_[_0xc8a5('0x47')](_0x479191[_0xc8a5('0x43')],qs['fields'](_0x16b62c[_0xc8a5('0x44')]['fields']));_0x131caa[_0xc8a5('0x49')]=_0x131caa[_0xc8a5('0x49')][_0xc8a5('0x4a')]?_0x131caa[_0xc8a5('0x49')]:_0x479191[_0xc8a5('0x43')];if(!_0x16b62c[_0xc8a5('0x44')][_0xc8a5('0x4b')]('nolimit')){_0x131caa['limit']=qs[_0xc8a5('0x32')](_0x16b62c[_0xc8a5('0x44')]['limit']);_0x131caa[_0xc8a5('0x31')]=qs[_0xc8a5('0x31')](_0x16b62c[_0xc8a5('0x44')][_0xc8a5('0x31')]);}_0x131caa['order']=qs[_0xc8a5('0x4e')](_0x16b62c['query']['sort']);_0x131caa[_0xc8a5('0x51')]=qs[_0xc8a5('0x46')](_[_0xc8a5('0x4f')](_0x16b62c['query'],_0x479191[_0xc8a5('0x46')]));_0x131caa[_0xc8a5('0x51')][_0xc8a5('0x67')]=_0x44ed6c['id'];if(_0x16b62c['query'][_0xc8a5('0x50')]){_0x131caa[_0xc8a5('0x51')]=_[_0xc8a5('0x52')](_0x131caa[_0xc8a5('0x51')],{'$or':_[_0xc8a5('0x3e')](_0x131caa[_0xc8a5('0x49')],function(_0x1761f1){var _0xfc6735={};_0xfc6735[_0x1761f1]={'$like':'%'+_0x16b62c['query'][_0xc8a5('0x50')]+'%'};return _0xfc6735;})});}_0x131caa=_[_0xc8a5('0x52')]({},_0x131caa,_0x16b62c['options']);return db[_0xc8a5('0xa1')][_0xc8a5('0x30')]({'where':_0x131caa['where']})[_0xc8a5('0x24')](function(_0x4e8e66){_0x1272c1[_0xc8a5('0x30')]=_0x4e8e66;if(_0x16b62c[_0xc8a5('0x44')][_0xc8a5('0x54')]){_0x131caa[_0xc8a5('0x55')]=[{'model':db[_0xc8a5('0x9b')],'as':_0xc8a5('0xbf'),'required':![]},{'model':db[_0xc8a5('0xc0')],'as':_0xc8a5('0xc1'),'attributes':[_0xc8a5('0x3b'),_0xc8a5('0xc2'),_0xc8a5('0xc3')],'required':![]},{'model':db[_0xc8a5('0xc4')],'as':'Tags','attributes':['id',_0xc8a5('0x3b'),_0xc8a5('0xc5')],'where':_0x16b62c[_0xc8a5('0x44')][_0xc8a5('0xc6')]?{'id':_0x16b62c[_0xc8a5('0x44')][_0xc8a5('0xc6')]}:undefined,'required':_0x16b62c[_0xc8a5('0x44')][_0xc8a5('0xc6')]?!![]:![]}];}return db[_0xc8a5('0xa1')][_0xc8a5('0x56')](_0x131caa);})[_0xc8a5('0x24')](function(_0x1094a9){_0x1272c1[_0xc8a5('0x6b')]=_0x1094a9;return _0x1272c1;});}})[_0xc8a5('0x24')](respondWithFilteredResult(_0x191f9f,_0x131caa))[_0xc8a5('0x5a')](handleError(_0x191f9f,null));};exports[_0xc8a5('0x3c')]=function(_0x67e0de,_0x41d711,_0x1a3dfc){var _0x328638,_0x47ed0e,_0x1e5e70;if(_[_0xc8a5('0x94')](_0x67e0de[_0xc8a5('0x5c')]['body'])||_0x67e0de[_0xc8a5('0x5c')][_0xc8a5('0x5c')]===''){throw new db[(_0xc8a5('0x22'))][(_0xc8a5('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc8a5('0x94')](_0x67e0de[_0xc8a5('0x5c')]['to'])){throw new db[(_0xc8a5('0x22'))]['ValidationError'](_0xc8a5('0xc7'));}_0x328638=_0x67e0de[_0xc8a5('0x5c')]['to'];return db[_0xc8a5('0x3f')][_0xc8a5('0x59')]({'where':{'id':_0x67e0de[_0xc8a5('0x57')]['id']},'include':[{'model':db[_0xc8a5('0x9a')],'as':'List','include':[{'model':db['CmContact'],'as':_0xc8a5('0x9c'),'where':{'mobile':_0x328638},'limit':0x1,'order':[[_0xc8a5('0x7c'),'DESC']]}]}]})[_0xc8a5('0x24')](handleEntityNotFound(_0x41d711,null))[_0xc8a5('0x24')](function(_0x3e5f8c){if(_0x3e5f8c&&_0x3e5f8c[_0xc8a5('0xc8')]){_0x47ed0e=_0x3e5f8c[_0xc8a5('0x5e')]({'plain':!![]});if(_0x47ed0e['List']&&_0x47ed0e[_0xc8a5('0xc8')][_0xc8a5('0x9c')][_0xc8a5('0x4a')]){return _0x47ed0e['List'][_0xc8a5('0x9c')][0x0];}return db['CmContact'][_0xc8a5('0x5b')](_[_0xc8a5('0x1b')](_0x67e0de['body'],{'firstName':_0x328638,'mobile':_0x328638,'phone':_0x328638,'ListId':_0x47ed0e[_0xc8a5('0x7e')]}));}})[_0xc8a5('0x24')](handleEntityNotFound(_0x41d711,null))[_0xc8a5('0x24')](function(_0x5c7cf0){if(_0x5c7cf0){_0x1e5e70=_0x5c7cf0;return db[_0xc8a5('0xa1')][_0xc8a5('0x59')]({'where':{'ContactId':_0x1e5e70['id'],'closed':![],'SmsAccountId':_0x47ed0e['id']}})[_0xc8a5('0x24')](function(_0x1d9068){if(_0x1d9068){return[_0x1d9068,![]];}return db[_0xc8a5('0xa1')][_0xc8a5('0x5b')]({'UserId':_0x67e0de[_0xc8a5('0x5d')]['id'],'ContactId':_0x1e5e70['id'],'SmsAccountId':_0x47ed0e['id'],'phone':_0x328638,'firstMsgDirection':_0xc8a5('0xc9'),'Messages':[_[_0xc8a5('0x52')](_0x67e0de['body'],{'read':![],'body':_0x67e0de[_0xc8a5('0x5c')][_0xc8a5('0x5c')],'phone':_0x328638,'SmsAccountId':_0x47ed0e['id'],'UserId':_0x67e0de[_0xc8a5('0x5d')]['id'],'ContactId':_0x1e5e70['id']})]},{'include':[{'model':db[_0xc8a5('0xca')],'as':_0xc8a5('0xcb')}]})[_0xc8a5('0x24')](function(_0x5b8ea1){return[_0x5b8ea1,!![]];});});}})[_0xc8a5('0xa2')](function(_0x2bf155,_0xfa6dd6){if(_0xfa6dd6){return _0x2bf155;}return db['SmsMessage']['create'](_[_0xc8a5('0x52')](_0x67e0de[_0xc8a5('0x5c')],{'read':![],'body':_0x67e0de[_0xc8a5('0x5c')][_0xc8a5('0x5c')],'phone':_0x328638,'SmsAccountId':_0x47ed0e['id'],'SmsInteractionId':_0x2bf155['id'],'UserId':_0x67e0de[_0xc8a5('0x5d')]['id'],'ContactId':_0x1e5e70['id']}))[_0xc8a5('0x24')](function(_0x7f4775){_0x2bf155[_0xc8a5('0xcc')][_0xc8a5('0xcb')]=[];_0x2bf155[_0xc8a5('0xcc')]['Messages'][_0xc8a5('0xa6')](_0x7f4775[_0xc8a5('0xcc')]);return _0x2bf155;});})['then'](respondWithResult(_0x41d711,null))[_0xc8a5('0x5a')](handleError(_0x41d711,null));};exports[_0xc8a5('0x2e')]=function(_0x557d7a,_0xb97bf9,_0x3c1f03){if(_0x557d7a['body']['id']){delete _0x557d7a[_0xc8a5('0x5c')]['id'];}console[_0xc8a5('0xcd')](_0xc8a5('0xce'),_0x557d7a[_0xc8a5('0x5c')]);var _0x322251,_0xb51287,_0x26f09f;return db['SmsAccount'][_0xc8a5('0x59')]({'where':{'id':_0x557d7a['params']['id']}})[_0xc8a5('0x24')](handleEntityNotFound(_0xb97bf9,null))[_0xc8a5('0x24')](function(_0x5c27ac){if(_0x5c27ac){_0x26f09f=_0x5c27ac;logger[_0xc8a5('0xb2')](_0xc8a5('0x27'),'status','received\x20delivery\x20report\x20from',_0x5c27ac[_0xc8a5('0x41')],util[_0xc8a5('0xcf')](_0x557d7a[_0xc8a5('0x5c')],{'showHidden':![],'depth':null}));switch(_0x5c27ac[_0xc8a5('0x41')]){case _0xc8a5('0x84'):if(_0x557d7a[_0xc8a5('0x5c')]['skebby_dispatch_id']&&_0x557d7a[_0xc8a5('0x5c')]['status']){_0xb51287=_0x557d7a['body']['status'];return db[_0xc8a5('0xca')][_0xc8a5('0x59')]({'where':{'messageId':_0x557d7a[_0xc8a5('0x5c')][_0xc8a5('0xd0')]}});}break;case _0xc8a5('0x87'):if(_0x557d7a[_0xc8a5('0x5c')]['requestid']&&_0x557d7a['body'][_0xc8a5('0xd1')]){_0xb51287=_0x557d7a[_0xc8a5('0x5c')][_0xc8a5('0xd1')];return db['SmsMessage']['find']({'where':{'messageId':_0x557d7a[_0xc8a5('0x5c')][_0xc8a5('0xd2')]}});}break;case _0xc8a5('0x89'):if(_0x557d7a['body'][_0xc8a5('0x8a')]&&_0x557d7a[_0xc8a5('0x5c')][_0xc8a5('0xd3')]){_0xb51287=_0x557d7a[_0xc8a5('0x5c')][_0xc8a5('0xd3')];return db[_0xc8a5('0xca')]['find']({'where':{'messageId':_0x557d7a['body'][_0xc8a5('0x8a')]}});}break;case'infobip':var _0xd9055c=_0x557d7a[_0xc8a5('0x5c')][_0xc8a5('0x8e')][0x0];if(_0xd9055c[_0xc8a5('0x82')]&&_0xd9055c['status'][_0xc8a5('0xd4')]===_0xc8a5('0xd5')){_0xb51287=_0xd9055c[_0xc8a5('0x2e')]['groupName'];return db[_0xc8a5('0xca')]['find']({'where':{'messageId':_0xd9055c[_0xc8a5('0x82')]}});}break;case _0xc8a5('0x90'):if(_0x557d7a[_0xc8a5('0x5c')]['messageId']&&_0x557d7a[_0xc8a5('0x5c')][_0xc8a5('0x2e')]){_0xb51287=_0x557d7a[_0xc8a5('0x5c')][_0xc8a5('0x2e')];return db[_0xc8a5('0xca')][_0xc8a5('0x59')]({'where':{'messageId':_0x557d7a[_0xc8a5('0x5c')]['messageId']}});}break;case _0xc8a5('0x93'):if(_0x557d7a[_0xc8a5('0x5c')][_0xc8a5('0xd6')]&&_0x557d7a[_0xc8a5('0x5c')][_0xc8a5('0x2e')]){_0xb51287=_0x557d7a['body'][_0xc8a5('0x2e')];return db[_0xc8a5('0xca')][_0xc8a5('0x59')]({'where':{'messageId':_0x557d7a[_0xc8a5('0x5c')][_0xc8a5('0xd6')]}});}break;}}})[_0xc8a5('0x24')](handleEntityNotFound(_0xb97bf9,null))[_0xc8a5('0x24')](function(_0x49087b){if(_0x49087b){_0x322251=_0x49087b;switch(_0x26f09f[_0xc8a5('0x41')]){case _0xc8a5('0x84'):if(_0xb51287==='DELIVERED'){return _0x322251['update']({'read':!![]});}else{logger[_0xc8a5('0x2a')](_0xc8a5('0x27'),'status','skebby',util[_0xc8a5('0xcf')](_0x557d7a[_0xc8a5('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xc8a5('0x87'):if(_0xb51287==='1'){return _0x322251[_0xc8a5('0x37')]({'read':!![]});}else{logger['error'](_0xc8a5('0x27'),_0xc8a5('0x2e'),_0xc8a5('0x84'),util['inspect'](_0x557d7a['body'],{'showHidden':![],'depth':null}));}break;case _0xc8a5('0x89'):if(!_0x557d7a[_0xc8a5('0x5c')][_0xc8a5('0xd7')]&&_0xb51287>=0xc8&&_0xb51287<=0xce){return _0x322251['update']({'read':!![]});}else{logger[_0xc8a5('0x2a')](_0xc8a5('0x27'),_0xc8a5('0x2e'),_0xc8a5('0x89'),util[_0xc8a5('0xcf')](_0x557d7a[_0xc8a5('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xc8a5('0xd8'):var _0x167456=_0x557d7a[_0xc8a5('0x5c')][_0xc8a5('0x8e')][0x0];if(_0x167456[_0xc8a5('0x2e')]['groupName']==='DELIVERED'){return _0x322251[_0xc8a5('0x37')]({'read':!![]});}else{logger['error'](_0xc8a5('0x27'),'status','infobip',util[_0xc8a5('0xcf')](_0x557d7a[_0xc8a5('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xc8a5('0x90'):if(_0xb51287==_0xc8a5('0xd9')||_0xb51287==_0xc8a5('0xda')){return _0x322251[_0xc8a5('0x37')]({'read':!![]});}else{logger[_0xc8a5('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc8a5('0x2e'),_0xc8a5('0x90'),util[_0xc8a5('0xcf')](_0x557d7a[_0xc8a5('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xc8a5('0x93'):if(_0xb51287===_0xc8a5('0xdb')||_0xb51287===_0xc8a5('0xdc')){return _0x322251['update']({'read':!![]});}else{logger[_0xc8a5('0x2a')](_0xc8a5('0x27'),_0xc8a5('0x2e'),_0xc8a5('0x93'),util[_0xc8a5('0xcf')](_0x557d7a[_0xc8a5('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x322251;}})[_0xc8a5('0x24')](respondWithResult(_0xb97bf9,null))[_0xc8a5('0x5a')](handleError(_0xb97bf9,null));};exports[_0xc8a5('0xdd')]=function(_0x559cc9,_0x6bfa1,_0x367b35){var _0x4f5d68,_0x3faaf9,_0x435cba;return db[_0xc8a5('0x3f')][_0xc8a5('0x59')]({'where':{'id':_0x559cc9[_0xc8a5('0x57')]['id']}})[_0xc8a5('0x24')](handleEntityNotFound(_0x6bfa1,null))['then'](function(_0x4b9260){if(_0x4b9260){_0x435cba=_0x4b9260;logger[_0xc8a5('0xb2')](_0xc8a5('0x27'),_0xc8a5('0x2e'),_0xc8a5('0xde'),_0x4b9260[_0xc8a5('0x41')],util['inspect'](_0x559cc9[_0xc8a5('0x44')],{'showHidden':![],'depth':null}));switch(_0x4b9260[_0xc8a5('0x41')]){case _0xc8a5('0xdf'):if(_0x559cc9[_0xc8a5('0x44')][_0xc8a5('0xe0')]&&_0x559cc9[_0xc8a5('0x44')]['state']){_0x3faaf9=_0x559cc9[_0xc8a5('0x44')][_0xc8a5('0xe1')];return db[_0xc8a5('0xca')][_0xc8a5('0x59')]({'where':{'messageId':_0x559cc9['query'][_0xc8a5('0xe0')]}});}break;}}})[_0xc8a5('0x24')](handleEntityNotFound(_0x6bfa1,null))[_0xc8a5('0x24')](function(_0x439447){if(_0x439447){_0x4f5d68=_0x439447;switch(_0x435cba['type']){case _0xc8a5('0xdf'):if(_0x3faaf9==='2'||_0x3faaf9==='6'){return _0x4f5d68[_0xc8a5('0x37')]({'read':!![]});}else{logger['error'](_0xc8a5('0x27'),'status',_0xc8a5('0xdf'),util['inspect'](_0x559cc9[_0xc8a5('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x4f5d68;}})[_0xc8a5('0x24')](respondWithResult(_0x6bfa1,null))[_0xc8a5('0x5a')](handleError(_0x6bfa1,null));};exports['addAgents']=function(_0x3ebee9,_0x5e2e90,_0x61793a){return db[_0xc8a5('0x3f')]['find']({'where':{'id':_0x3ebee9[_0xc8a5('0x57')]['id']}})[_0xc8a5('0x24')](handleEntityNotFound(_0x5e2e90,null))[_0xc8a5('0x24')](function(_0x59a97b){if(_0x59a97b){return _0x59a97b[_0xc8a5('0xe2')](_0x3ebee9[_0xc8a5('0x5c')][_0xc8a5('0x6d')],_[_0xc8a5('0x9f')](_0x3ebee9[_0xc8a5('0x5c')],[_0xc8a5('0x6d'),'id'])||{})[_0xc8a5('0xa2')](function(_0x59df6a){for(var _0x547c01=0x0;_0x547c01<_0x3ebee9[_0xc8a5('0x5c')]['ids'][_0xc8a5('0x4a')];_0x547c01+=0x1){socket['emit'](_0xc8a5('0xe3'),{'UserId':_0x3ebee9[_0xc8a5('0x5c')][_0xc8a5('0x6d')][_0x547c01],'SmsAccountId':_0x3ebee9['params']['id']});}return _0x59df6a;});}})[_0xc8a5('0x24')](respondWithResult(_0x5e2e90,null))['catch'](handleError(_0x5e2e90,null));};exports[_0xc8a5('0xe4')]=function(_0x27f4b6,_0x299f9a,_0x3cc294){return db[_0xc8a5('0x3f')][_0xc8a5('0x59')]({'where':{'id':_0x27f4b6[_0xc8a5('0x57')]['id']}})['then'](handleEntityNotFound(_0x299f9a,null))[_0xc8a5('0x24')](function(_0x211b0f){if(_0x211b0f){return _0x211b0f[_0xc8a5('0xe4')](_0x27f4b6['query'][_0xc8a5('0x6d')])[_0xc8a5('0x24')](function(){if(_[_0xc8a5('0xe5')](_0x27f4b6[_0xc8a5('0x44')]['ids'])){for(var _0xf9fe72=0x0;_0xf9fe72<_0x27f4b6[_0xc8a5('0x44')][_0xc8a5('0x6d')][_0xc8a5('0x4a')];_0xf9fe72+=0x1){socket[_0xc8a5('0xe6')]('userSmsAccount:remove',{'UserId':Number(_0x27f4b6[_0xc8a5('0x44')][_0xc8a5('0x6d')][_0xf9fe72]),'SmsAccountId':Number(_0x27f4b6['params']['id'])});}}else{socket[_0xc8a5('0xe6')](_0xc8a5('0xe7'),{'UserId':Number(_0x27f4b6[_0xc8a5('0x44')]['ids']),'SmsAccountId':Number(_0x27f4b6[_0xc8a5('0x57')]['id'])});}});}})[_0xc8a5('0x24')](respondWithStatusCode(_0x299f9a,null))[_0xc8a5('0x5a')](handleError(_0x299f9a,null));};exports[_0xc8a5('0xe8')]=function(_0xf0e0c9,_0x24bee1,_0x55bc6e){var _0x3ca48c={};var _0x5a19f9={};var _0x296e88;var _0x34cb8b;return db['SmsAccount'][_0xc8a5('0x6a')]({'where':{'id':_0xf0e0c9[_0xc8a5('0x57')]['id']}})[_0xc8a5('0x24')](handleEntityNotFound(_0x24bee1,null))[_0xc8a5('0x24')](function(_0x4625e8){if(_0x4625e8){_0x296e88=_0x4625e8;_0x5a19f9['model']=_['keys'](db['User'][_0xc8a5('0x40')]);_0x5a19f9['query']=_['keys'](_0xf0e0c9[_0xc8a5('0x44')]);_0x5a19f9[_0xc8a5('0x46')]=_[_0xc8a5('0x47')](_0x5a19f9[_0xc8a5('0x43')],_0x5a19f9[_0xc8a5('0x44')]);_0x3ca48c[_0xc8a5('0x49')]=_['intersection'](_0x5a19f9[_0xc8a5('0x43')],qs[_0xc8a5('0x48')](_0xf0e0c9['query'][_0xc8a5('0x48')]));_0x3ca48c[_0xc8a5('0x49')]=_0x3ca48c[_0xc8a5('0x49')][_0xc8a5('0x4a')]?_0x3ca48c[_0xc8a5('0x49')]:_0x5a19f9[_0xc8a5('0x43')];_0x3ca48c[_0xc8a5('0x4d')]=qs['sort'](_0xf0e0c9[_0xc8a5('0x44')]['sort']);_0x3ca48c[_0xc8a5('0x51')]=qs[_0xc8a5('0x46')](_['pick'](_0xf0e0c9['query'],_0x5a19f9['filters']));if(_0xf0e0c9['query'][_0xc8a5('0x50')]){_0x3ca48c[_0xc8a5('0x51')]=_[_0xc8a5('0x52')](_0x3ca48c[_0xc8a5('0x51')],{'$or':_['map'](_0x3ca48c[_0xc8a5('0x49')],function(_0x50f1f6){var _0x2903bd={};_0x2903bd[_0x50f1f6]={'$like':'%'+_0xf0e0c9[_0xc8a5('0x44')][_0xc8a5('0x50')]+'%'};return _0x2903bd;})});}_0x3ca48c=_[_0xc8a5('0x52')]({},_0x3ca48c,_0xf0e0c9[_0xc8a5('0x53')]);return _0x296e88[_0xc8a5('0xe8')](_0x3ca48c);}})[_0xc8a5('0x24')](function(_0xbfb46b){if(_0xbfb46b){_0x34cb8b=_0xbfb46b[_0xc8a5('0x4a')];if(!_0xf0e0c9[_0xc8a5('0x44')][_0xc8a5('0x4b')]('nolimit')){_0x3ca48c['limit']=qs['limit'](_0xf0e0c9['query']['limit']);_0x3ca48c[_0xc8a5('0x31')]=qs['offset'](_0xf0e0c9[_0xc8a5('0x44')]['offset']);}return _0x296e88[_0xc8a5('0xe8')](_0x3ca48c);}})[_0xc8a5('0x24')](function(_0x315bb2){if(_0x315bb2){return _0x315bb2?{'count':_0x34cb8b,'rows':_0x315bb2}:null;}})[_0xc8a5('0x24')](respondWithResult(_0x24bee1,null))[_0xc8a5('0x5a')](handleError(_0x24bee1,null));}; \ No newline at end of file +var _0x38b8=['userProfileId','autoAssociation','body','params','describe','addDisposition','Disposition','getDispositions','SmsAccountId','filter','options','removeDispositions','ids','CannedAnswer','findOne','removeAnswers','notify','sms','SmsApplication','Applications','applications','priority','asc','account','CmContact','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','Body','MessageSid','sender','text','connectel','messageId','plivo','From','Text','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','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','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','startRouting','Start','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','addApplications','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','tag','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','redif','DELIVERED','clicksend','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','html-pdf','rimraf','zip-dir','request-promise','mustache','util','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','where','VIRTUAL','merge','includeAll','findAll','rows','catch','show','keys','rawAttributes','length','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection'];(function(_0x4e4635,_0x221689){var _0x20d23b=function(_0x25762d){while(--_0x25762d){_0x4e4635['push'](_0x4e4635['shift']());}};_0x20d23b(++_0x221689);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x838b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x838b('0x1'));var zipdir=require(_0x838b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x838b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x838b('0x4'));var util=require(_0x838b('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x838b('0x6'));var ejs=require(_0x838b('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x838b('0x8'));var crypto=require(_0x838b('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x838b('0x6'));var querystring=require(_0x838b('0xa'));var Papa=require(_0x838b('0xb'));var Redis=require('ioredis');var authService=require(_0x838b('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x838b('0xd'));var hardwareService=require(_0x838b('0xe'));var logger=require(_0x838b('0xf'))(_0x838b('0x10'));var utils=require(_0x838b('0x11'));var config=require(_0x838b('0x12'));var db=require('../../mysqldb')['db'];config[_0x838b('0x13')]=_[_0x838b('0x14')](config[_0x838b('0x13')],{'host':_0x838b('0x15'),'port':0x18eb});var socket=require(_0x838b('0x16'))(new Redis(config[_0x838b('0x13')]));require(_0x838b('0x17'))[_0x838b('0x18')](socket);var jayson=require(_0x838b('0x19'));var client=jayson['client'][_0x838b('0x1a')]({'port':0x232c});function checkPasswordPattern(_0x5497fd,_0x4e1085,_0x584b04){if(_0x584b04){var _0x450b9b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x450b9b[_0x838b('0x1b')](_0x4e1085)){return _0x5497fd;}else{throw new db[(_0x838b('0x1c'))][(_0x838b('0x1d'))](_0x838b('0x1e'));}}else{return _0x5497fd;}}function respondWithRpcPromise(_0x4a729e,_0x21aa1a,_0x3f1132,_0x44a62c){return new BPromise(function(_0x1e4f5f,_0x48c4ab){var _0x1163ff=_0x44a62c||client;return _0x1163ff[_0x838b('0x1f')](_0x4a729e,_0x3f1132)['then'](function(_0x4c1251){logger[_0x838b('0x20')]('SmsAccount,\x20%s,\x20%s',_0x21aa1a,_0x838b('0x21'));logger[_0x838b('0x22')](_0x838b('0x23'),_0x21aa1a,'request\x20sent',JSON[_0x838b('0x24')](_0x4c1251));if(_0x4c1251[_0x838b('0x25')]){if(_0x4c1251[_0x838b('0x25')][_0x838b('0x26')]===0x1f4){logger[_0x838b('0x25')](_0x838b('0x27'),_0x21aa1a,_0x4c1251[_0x838b('0x25')][_0x838b('0x28')]);return _0x48c4ab(_0x4c1251[_0x838b('0x25')][_0x838b('0x28')]);}logger[_0x838b('0x25')](_0x838b('0x27'),_0x21aa1a,_0x4c1251[_0x838b('0x25')][_0x838b('0x28')]);return _0x1e4f5f(_0x4c1251['error'][_0x838b('0x28')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x21aa1a,_0x838b('0x21'));_0x1e4f5f(_0x4c1251[_0x838b('0x29')][_0x838b('0x28')]);}})['catch'](function(_0x302445){logger[_0x838b('0x25')]('SmsAccount,\x20%s,\x20%s',_0x21aa1a,_0x302445);_0x48c4ab(_0x302445);});});}function respondWithStatusCode(_0x19fc7b,_0x322e3f){_0x322e3f=_0x322e3f||0xcc;return function(_0x59fa16){if(_0x59fa16){return _0x19fc7b['sendStatus'](_0x322e3f);}return _0x19fc7b['status'](_0x322e3f)['end']();};}function respondWithResult(_0x4f6179,_0x4b46bc){_0x4b46bc=_0x4b46bc||0xc8;return function(_0x1e74a6){if(_0x1e74a6){return _0x4f6179[_0x838b('0x2a')](_0x4b46bc)['json'](_0x1e74a6);}};}function respondWithFilteredResult(_0x5aeeca,_0xc9ebfd){return function(_0x4081b1){if(_0x4081b1){var _0x1fff30=_0x4081b1[_0x838b('0x2b')],_0x29e161=_0xc9ebfd[_0x838b('0x2c')],_0x16c081=_0xc9ebfd[_0x838b('0x2c')]+_0xc9ebfd['limit'],_0x3c6c08;if(_0x16c081>=_0x1fff30){_0x16c081=_0x1fff30;_0x3c6c08=0xc8;}else{_0x3c6c08=0xce;}_0x5aeeca[_0x838b('0x2a')](_0x3c6c08);return _0x5aeeca[_0x838b('0x2d')](_0x838b('0x2e'),_0x29e161+'-'+_0x16c081+'/'+_0x1fff30)[_0x838b('0x2f')](_0x4081b1);}return null;};}function patchUpdates(_0x55f36a){return function(_0x25064c){try{jsonpatch[_0x838b('0x30')](_0x25064c,_0x55f36a,!![]);}catch(_0x43c2b0){return BPromise[_0x838b('0x31')](_0x43c2b0);}return _0x25064c[_0x838b('0x32')]();};}function saveUpdates(_0x4fd48b,_0x43ca2f){return function(_0x453e0d){if(_0x453e0d){return _0x453e0d[_0x838b('0x33')](_0x4fd48b)[_0x838b('0x34')](function(_0x489637){return _0x489637;});}return null;};}function removeEntity(_0x2e9af8,_0xca9dcb){return function(_0x47b315){if(_0x47b315){return _0x47b315[_0x838b('0x35')]()[_0x838b('0x34')](function(){var _0x277bb0=_0x47b315[_0x838b('0x36')]({'plain':!![]});var _0x3008fa='SmsAccounts';return db[_0x838b('0x37')][_0x838b('0x35')]({'where':{'type':_0x3008fa,'resourceId':_0x277bb0['id']}})['then'](function(){return _0x47b315;});})[_0x838b('0x34')](function(){_0x2e9af8['status'](0xcc)[_0x838b('0x38')]();});}};}function handleEntityNotFound(_0x57931c,_0x26e428){return function(_0x47f9d1){if(!_0x47f9d1){_0x57931c[_0x838b('0x39')](0x194);}return _0x47f9d1;};}function handleError(_0x23fd49,_0x4320c9){_0x4320c9=_0x4320c9||0x1f4;return function(_0x47460d){logger[_0x838b('0x25')](_0x47460d[_0x838b('0x3a')]);if(_0x47460d[_0x838b('0x3b')]){delete _0x47460d[_0x838b('0x3b')];}_0x23fd49[_0x838b('0x2a')](_0x4320c9)[_0x838b('0x3c')](_0x47460d);};}exports['index']=function(_0x2ef1fa,_0x5e71d5){var _0x24958f={'include':[{'model':db[_0x838b('0x3d')],'as':_0x838b('0x3e')}]},_0x16b580={},_0x33a9db={'count':0x0,'rows':[]};var _0x3934b7=_[_0x838b('0x3f')](db[_0x838b('0x40')]['rawAttributes'],function(_0x2d6291){return{'name':_0x2d6291[_0x838b('0x41')],'type':_0x2d6291[_0x838b('0x42')][_0x838b('0x43')]};});_0x16b580[_0x838b('0x44')]=_[_0x838b('0x3f')](_0x3934b7,'name');_0x16b580[_0x838b('0x45')]=_['keys'](_0x2ef1fa[_0x838b('0x45')]);_0x16b580[_0x838b('0x46')]=_['intersection'](_0x16b580[_0x838b('0x44')],_0x16b580[_0x838b('0x45')]);_0x24958f[_0x838b('0x47')]=_[_0x838b('0x48')](_0x16b580['model'],qs['fields'](_0x2ef1fa[_0x838b('0x45')][_0x838b('0x49')]));_0x24958f['attributes']=_0x24958f[_0x838b('0x47')]['length']?_0x24958f[_0x838b('0x47')]:_0x16b580[_0x838b('0x44')];if(!_0x2ef1fa[_0x838b('0x45')][_0x838b('0x4a')](_0x838b('0x4b'))){_0x24958f['limit']=qs[_0x838b('0x4c')](_0x2ef1fa['query'][_0x838b('0x4c')]);_0x24958f['offset']=qs[_0x838b('0x2c')](_0x2ef1fa[_0x838b('0x45')]['offset']);}_0x24958f[_0x838b('0x4d')]=qs[_0x838b('0x4e')](_0x2ef1fa['query'][_0x838b('0x4e')]);_0x24958f['where']=qs[_0x838b('0x46')](_[_0x838b('0x4f')](_0x2ef1fa['query'],_0x16b580[_0x838b('0x46')]));if(_0x2ef1fa['query']['filter']){_0x24958f['where']=_['merge'](_0x24958f[_0x838b('0x50')],{'$or':_[_0x838b('0x3f')](_0x3934b7,function(_0x176560){if(_0x176560[_0x838b('0x42')]!==_0x838b('0x51')){var _0x1aaeb2={};_0x1aaeb2[_0x176560['name']]={'$like':'%'+_0x2ef1fa[_0x838b('0x45')]['filter']+'%'};return _0x1aaeb2;}})});}_0x24958f=_[_0x838b('0x52')]({},_0x24958f,_0x2ef1fa['options']);var _0x12e4b4={'where':_0x24958f[_0x838b('0x50')]};return db[_0x838b('0x40')][_0x838b('0x2b')](_0x12e4b4)[_0x838b('0x34')](function(_0x59d537){_0x33a9db['count']=_0x59d537;if(_0x2ef1fa[_0x838b('0x45')][_0x838b('0x53')]){_0x24958f['include']=[{'all':!![]}];}return db['SmsAccount'][_0x838b('0x54')](_0x24958f);})[_0x838b('0x34')](function(_0x452eec){_0x33a9db[_0x838b('0x55')]=_0x452eec;return _0x33a9db;})[_0x838b('0x34')](respondWithFilteredResult(_0x5e71d5,_0x24958f))[_0x838b('0x56')](handleError(_0x5e71d5,null));};exports[_0x838b('0x57')]=function(_0x6d826d,_0x1a6f93){var _0xc3c4f={'raw':![],'where':{'id':_0x6d826d['params']['id']},'include':[{'model':db['Pause'],'as':_0x838b('0x3e')}]},_0x57584d={};_0x57584d[_0x838b('0x44')]=_[_0x838b('0x58')](db[_0x838b('0x40')][_0x838b('0x59')]);_0x57584d['query']=_[_0x838b('0x58')](_0x6d826d['query']);_0x57584d['filters']=_[_0x838b('0x48')](_0x57584d[_0x838b('0x44')],_0x57584d[_0x838b('0x45')]);_0xc3c4f['attributes']=_[_0x838b('0x48')](_0x57584d[_0x838b('0x44')],qs[_0x838b('0x49')](_0x6d826d[_0x838b('0x45')][_0x838b('0x49')]));_0xc3c4f[_0x838b('0x47')]=_0xc3c4f['attributes'][_0x838b('0x5a')]?_0xc3c4f[_0x838b('0x47')]:_0x57584d[_0x838b('0x44')];if(_0x6d826d[_0x838b('0x45')][_0x838b('0x53')]){_0xc3c4f[_0x838b('0x5b')]=[{'all':!![]}];}_0xc3c4f=_[_0x838b('0x52')]({},_0xc3c4f,_0x6d826d['options']);return db[_0x838b('0x40')][_0x838b('0x5c')](_0xc3c4f)[_0x838b('0x34')](handleEntityNotFound(_0x1a6f93,null))[_0x838b('0x34')](respondWithResult(_0x1a6f93,null))[_0x838b('0x56')](handleError(_0x1a6f93,null));};exports[_0x838b('0x5d')]=function(_0x3574c8,_0x3188c8){return db[_0x838b('0x40')][_0x838b('0x5d')](_0x3574c8['body'],{})[_0x838b('0x34')](function(_0x5025c2){var _0x3c501c=_0x3574c8[_0x838b('0x5e')][_0x838b('0x36')]({'plain':!![]});if(!_0x3c501c)throw new Error(_0x838b('0x5f'));if(_0x3c501c[_0x838b('0x60')]===_0x838b('0x5e')){var _0x4c4cdb=_0x5025c2[_0x838b('0x36')]({'plain':!![]});var _0x392bc8=_0x838b('0x61');return db[_0x838b('0x62')][_0x838b('0x5c')]({'where':{'name':_0x392bc8,'userProfileId':_0x3c501c[_0x838b('0x63')]},'raw':!![]})[_0x838b('0x34')](function(_0xbcf0b1){if(_0xbcf0b1&&_0xbcf0b1[_0x838b('0x64')]===0x0){return db[_0x838b('0x37')][_0x838b('0x5d')]({'name':_0x4c4cdb[_0x838b('0x3b')],'resourceId':_0x4c4cdb['id'],'type':_0xbcf0b1[_0x838b('0x3b')],'sectionId':_0xbcf0b1['id']},{})[_0x838b('0x34')](function(){return _0x5025c2;});}else{return _0x5025c2;}})['catch'](function(_0x197865){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x197865);throw _0x197865;});}return _0x5025c2;})[_0x838b('0x34')](respondWithResult(_0x3188c8,0xc9))['catch'](handleError(_0x3188c8,null));};exports[_0x838b('0x33')]=function(_0x1eefef,_0xf779f9){if(_0x1eefef[_0x838b('0x65')]['id']){delete _0x1eefef[_0x838b('0x65')]['id'];}return db[_0x838b('0x40')]['find']({'where':{'id':_0x1eefef['params']['id']},'include':[{'model':db[_0x838b('0x3d')],'as':_0x838b('0x3e')}]})[_0x838b('0x34')](handleEntityNotFound(_0xf779f9,null))[_0x838b('0x34')](saveUpdates(_0x1eefef['body'],null))['then'](respondWithResult(_0xf779f9,null))['catch'](handleError(_0xf779f9,null));};exports[_0x838b('0x35')]=function(_0x3a904b,_0x4e0e82){return db[_0x838b('0x40')]['find']({'where':{'id':_0x3a904b[_0x838b('0x66')]['id']}})['then'](handleEntityNotFound(_0x4e0e82,null))['then'](removeEntity(_0x4e0e82,null))['catch'](handleError(_0x4e0e82,null));};exports['describe']=function(_0x11f8d5,_0x3b5d3b){return db['SmsAccount'][_0x838b('0x67')]()['then'](respondWithResult(_0x3b5d3b,null))[_0x838b('0x56')](handleError(_0x3b5d3b,null));};exports[_0x838b('0x68')]=function(_0x3a33c1,_0x402d0f,_0x24c95c){if(_0x3a33c1[_0x838b('0x65')]['id']){delete _0x3a33c1[_0x838b('0x65')]['id'];}return db[_0x838b('0x40')]['find']({'where':{'id':_0x3a33c1[_0x838b('0x66')]['id']}})[_0x838b('0x34')](handleEntityNotFound(_0x402d0f,null))[_0x838b('0x34')](function(_0x3c32a5){if(_0x3c32a5){_0x3a33c1['body']['SmsAccountId']=_0x3c32a5['id'];return db[_0x838b('0x69')]['create'](_0x3a33c1[_0x838b('0x65')]);}})[_0x838b('0x34')](respondWithResult(_0x402d0f,null))[_0x838b('0x56')](handleError(_0x402d0f,null));};exports[_0x838b('0x6a')]=function(_0x4710ce,_0x24f76f,_0x18bd1a){var _0x414a49={'raw':![],'where':{}};var _0x227777={};var _0x1bb838={'count':0x0,'rows':[]};return db[_0x838b('0x40')]['findOne']({'where':{'id':_0x4710ce[_0x838b('0x66')]['id']}})['then'](handleEntityNotFound(_0x24f76f,null))['then'](function(_0x3414db){if(_0x3414db){_0x227777[_0x838b('0x44')]=_[_0x838b('0x58')](db[_0x838b('0x69')]['rawAttributes']);_0x227777[_0x838b('0x45')]=_[_0x838b('0x58')](_0x4710ce['query']);_0x227777['filters']=_[_0x838b('0x48')](_0x227777[_0x838b('0x44')],_0x227777['query']);_0x414a49[_0x838b('0x47')]=_[_0x838b('0x48')](_0x227777['model'],qs['fields'](_0x4710ce['query'][_0x838b('0x49')]));_0x414a49['attributes']=_0x414a49[_0x838b('0x47')]['length']?_0x414a49[_0x838b('0x47')]:_0x227777[_0x838b('0x44')];if(!_0x4710ce[_0x838b('0x45')][_0x838b('0x4a')](_0x838b('0x4b'))){_0x414a49[_0x838b('0x4c')]=qs[_0x838b('0x4c')](_0x4710ce[_0x838b('0x45')][_0x838b('0x4c')]);_0x414a49['offset']=qs['offset'](_0x4710ce[_0x838b('0x45')][_0x838b('0x2c')]);}_0x414a49[_0x838b('0x4d')]=qs[_0x838b('0x4e')](_0x4710ce[_0x838b('0x45')]['sort']);_0x414a49[_0x838b('0x50')]=qs[_0x838b('0x46')](_['pick'](_0x4710ce['query'],_0x227777[_0x838b('0x46')]));_0x414a49[_0x838b('0x50')][_0x838b('0x6b')]=_0x3414db['id'];if(_0x4710ce[_0x838b('0x45')]['filter']){_0x414a49[_0x838b('0x50')]=_[_0x838b('0x52')](_0x414a49[_0x838b('0x50')],{'$or':_[_0x838b('0x3f')](_0x414a49[_0x838b('0x47')],function(_0x44a251){var _0xa3f233={};_0xa3f233[_0x44a251]={'$like':'%'+_0x4710ce[_0x838b('0x45')][_0x838b('0x6c')]+'%'};return _0xa3f233;})});}_0x414a49=_[_0x838b('0x52')]({},_0x414a49,_0x4710ce[_0x838b('0x6d')]);return db[_0x838b('0x69')][_0x838b('0x2b')]({'where':_0x414a49['where']})['then'](function(_0x2882b2){_0x1bb838['count']=_0x2882b2;if(_0x4710ce[_0x838b('0x45')][_0x838b('0x53')]){_0x414a49[_0x838b('0x5b')]=[{'all':!![]}];}return db['Disposition'][_0x838b('0x54')](_0x414a49);})[_0x838b('0x34')](function(_0x368469){_0x1bb838[_0x838b('0x55')]=_0x368469;return _0x1bb838;});}})[_0x838b('0x34')](respondWithFilteredResult(_0x24f76f,_0x414a49))['catch'](handleError(_0x24f76f,null));};exports[_0x838b('0x6e')]=function(_0x281819,_0xf5e2c5,_0x8aeeb1){return db[_0x838b('0x40')]['find']({'where':{'id':_0x281819[_0x838b('0x66')]['id']}})[_0x838b('0x34')](handleEntityNotFound(_0xf5e2c5,null))[_0x838b('0x34')](function(_0x215938){if(_0x215938){return _0x215938[_0x838b('0x6e')](_0x281819[_0x838b('0x45')][_0x838b('0x6f')]);}})[_0x838b('0x34')](respondWithStatusCode(_0xf5e2c5,null))[_0x838b('0x56')](handleError(_0xf5e2c5,null));};exports['addAnswer']=function(_0x86d362,_0x3d5ef4,_0xfcdb0e){if(_0x86d362[_0x838b('0x65')]['id']){delete _0x86d362['body']['id'];}return db[_0x838b('0x40')][_0x838b('0x5c')]({'where':{'id':_0x86d362[_0x838b('0x66')]['id']}})[_0x838b('0x34')](handleEntityNotFound(_0x3d5ef4,null))['then'](function(_0xe0455e){if(_0xe0455e){_0x86d362[_0x838b('0x65')][_0x838b('0x6b')]=_0xe0455e['id'];return db[_0x838b('0x70')][_0x838b('0x5d')](_0x86d362[_0x838b('0x65')]);}})['then'](respondWithResult(_0x3d5ef4,null))[_0x838b('0x56')](handleError(_0x3d5ef4,null));};exports['getAnswers']=function(_0x501cbf,_0x29c148,_0x46d306){var _0x332b4a={'raw':![],'where':{}};var _0x2034b8={};var _0x39f865={'count':0x0,'rows':[]};return db[_0x838b('0x40')][_0x838b('0x71')]({'where':{'id':_0x501cbf[_0x838b('0x66')]['id']}})[_0x838b('0x34')](handleEntityNotFound(_0x29c148,null))['then'](function(_0x222eda){if(_0x222eda){_0x2034b8[_0x838b('0x44')]=_['keys'](db[_0x838b('0x70')]['rawAttributes']);_0x2034b8['query']=_[_0x838b('0x58')](_0x501cbf['query']);_0x2034b8[_0x838b('0x46')]=_[_0x838b('0x48')](_0x2034b8[_0x838b('0x44')],_0x2034b8[_0x838b('0x45')]);_0x332b4a[_0x838b('0x47')]=_[_0x838b('0x48')](_0x2034b8[_0x838b('0x44')],qs[_0x838b('0x49')](_0x501cbf[_0x838b('0x45')][_0x838b('0x49')]));_0x332b4a[_0x838b('0x47')]=_0x332b4a[_0x838b('0x47')][_0x838b('0x5a')]?_0x332b4a[_0x838b('0x47')]:_0x2034b8[_0x838b('0x44')];if(!_0x501cbf[_0x838b('0x45')]['hasOwnProperty'](_0x838b('0x4b'))){_0x332b4a['limit']=qs[_0x838b('0x4c')](_0x501cbf['query'][_0x838b('0x4c')]);_0x332b4a[_0x838b('0x2c')]=qs[_0x838b('0x2c')](_0x501cbf[_0x838b('0x45')][_0x838b('0x2c')]);}_0x332b4a[_0x838b('0x4d')]=qs['sort'](_0x501cbf[_0x838b('0x45')]['sort']);_0x332b4a[_0x838b('0x50')]=qs[_0x838b('0x46')](_[_0x838b('0x4f')](_0x501cbf[_0x838b('0x45')],_0x2034b8[_0x838b('0x46')]));_0x332b4a[_0x838b('0x50')]['SmsAccountId']=_0x222eda['id'];if(_0x501cbf[_0x838b('0x45')][_0x838b('0x6c')]){_0x332b4a[_0x838b('0x50')]=_[_0x838b('0x52')](_0x332b4a['where'],{'$or':_[_0x838b('0x3f')](_0x332b4a['attributes'],function(_0x5e9292){var _0x75cb92={};_0x75cb92[_0x5e9292]={'$like':'%'+_0x501cbf[_0x838b('0x45')][_0x838b('0x6c')]+'%'};return _0x75cb92;})});}_0x332b4a=_[_0x838b('0x52')]({},_0x332b4a,_0x501cbf['options']);return db[_0x838b('0x70')]['count']({'where':_0x332b4a[_0x838b('0x50')]})[_0x838b('0x34')](function(_0x74e4d){_0x39f865[_0x838b('0x2b')]=_0x74e4d;if(_0x501cbf['query'][_0x838b('0x53')]){_0x332b4a[_0x838b('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x838b('0x54')](_0x332b4a);})['then'](function(_0x45ef8e){_0x39f865[_0x838b('0x55')]=_0x45ef8e;return _0x39f865;});}})[_0x838b('0x34')](respondWithFilteredResult(_0x29c148,_0x332b4a))[_0x838b('0x56')](handleError(_0x29c148,null));};exports['removeAnswers']=function(_0x378e01,_0xe023d3,_0x4912d7){return db[_0x838b('0x40')][_0x838b('0x5c')]({'where':{'id':_0x378e01[_0x838b('0x66')]['id']}})[_0x838b('0x34')](handleEntityNotFound(_0xe023d3,null))['then'](function(_0x33e4d0){if(_0x33e4d0){return _0x33e4d0[_0x838b('0x72')](_0x378e01[_0x838b('0x45')][_0x838b('0x6f')]);}})[_0x838b('0x34')](respondWithStatusCode(_0xe023d3,null))[_0x838b('0x56')](handleError(_0xe023d3,null));};exports[_0x838b('0x73')]=function(_0x14c437,_0x1f12b9,_0xb275fc){var _0x2c1e89={'channel':_0x838b('0x74')};var _0x5d2254=[];var _0x2c4362=[];var _0x1e417b={};return db[_0x838b('0x40')][_0x838b('0x5c')]({'where':{'id':_0x14c437[_0x838b('0x66')]['id']},'include':[{'model':db[_0x838b('0x75')],'as':_0x838b('0x76')}]})[_0x838b('0x34')](handleEntityNotFound(_0x1f12b9,null))[_0x838b('0x34')](function(_0x2038cb){_0x2c1e89['account']=_0x2038cb;_0x2c1e89[_0x838b('0x77')]=_['orderBy'](_0x2038cb[_0x838b('0x76')],[_0x838b('0x78')],[_0x838b('0x79')]);if(_0x2c1e89['account'][_0x838b('0x76')]){delete _0x2c1e89[_0x838b('0x7a')][_0x838b('0x76')];}return db[_0x838b('0x7b')][_0x838b('0x67')]();})[_0x838b('0x34')](function(_0xc1b7de){if(!_0xc1b7de){throw new db[(_0x838b('0x1c'))][(_0x838b('0x1d'))](_0x838b('0x7c'));}_0x5d2254=_['difference'](_[_0x838b('0x58')](_0xc1b7de),[_0x838b('0x7d'),_0x838b('0x7e')]);_0x2c4362=_[_0x838b('0x7f')](_['keys'](_0xc1b7de),[_0x838b('0x7d'),'updatedAt',_0x838b('0x80'),_0x838b('0x81')]);_0x2c1e89['body']={'mapKey':_0x838b('0x82')};if(_0x2c1e89['account']['type']){switch(_0x2c1e89[_0x838b('0x7a')]['type']){case _0x838b('0x83'):_0x2c1e89['body'][_0x838b('0x84')]=_0x14c437['body']['From'];_0x2c1e89[_0x838b('0x65')]['body']=_0x14c437[_0x838b('0x65')][_0x838b('0x85')];_0x2c1e89['body']['messageId']=_0x14c437[_0x838b('0x65')][_0x838b('0x86')];break;case'skebby':_0x2c1e89[_0x838b('0x65')][_0x838b('0x84')]='+'+_0x14c437[_0x838b('0x65')][_0x838b('0x87')];_0x2c1e89['body'][_0x838b('0x65')]=_0x14c437[_0x838b('0x65')][_0x838b('0x88')];break;case _0x838b('0x89'):_0x2c1e89['body'][_0x838b('0x84')]=_0x14c437[_0x838b('0x65')][_0x838b('0x84')];_0x2c1e89[_0x838b('0x65')][_0x838b('0x65')]=_0x14c437[_0x838b('0x65')][_0x838b('0x28')];break;case'clicksend':_0x2c1e89[_0x838b('0x65')]['from']=_0x14c437['body'][_0x838b('0x84')];_0x2c1e89[_0x838b('0x65')]['body']=_0x14c437[_0x838b('0x65')][_0x838b('0x65')];_0x2c1e89[_0x838b('0x65')][_0x838b('0x8a')]=_0x14c437[_0x838b('0x65')]['message_id'];break;case _0x838b('0x8b'):_0x2c1e89[_0x838b('0x65')][_0x838b('0x84')]=_0x14c437[_0x838b('0x65')][_0x838b('0x8c')];_0x2c1e89['body'][_0x838b('0x65')]=_0x14c437[_0x838b('0x65')][_0x838b('0x8d')];_0x2c1e89['body'][_0x838b('0x8a')]=_0x14c437[_0x838b('0x65')]['MessageUUID'];break;case _0x838b('0x8e'):_0x2c1e89['body'][_0x838b('0x84')]='+'+_0x14c437[_0x838b('0x65')]['results'][0x0][_0x838b('0x84')];_0x2c1e89[_0x838b('0x65')][_0x838b('0x65')]=_0x14c437[_0x838b('0x65')][_0x838b('0x8f')][0x0][_0x838b('0x88')];_0x2c1e89['body'][_0x838b('0x8a')]=_0x14c437[_0x838b('0x65')]['results'][0x0][_0x838b('0x8a')];break;case _0x838b('0x90'):_0x2c1e89[_0x838b('0x65')][_0x838b('0x84')]=_0x14c437[_0x838b('0x65')][_0x838b('0x91')];_0x2c1e89[_0x838b('0x65')][_0x838b('0x65')]=_0x14c437[_0x838b('0x65')][_0x838b('0x92')]['message'];break;case _0x838b('0x93'):_0x2c1e89['body'][_0x838b('0x84')]=_0x14c437[_0x838b('0x65')][_0x838b('0x94')];_0x2c1e89[_0x838b('0x65')][_0x838b('0x65')]=_0x14c437[_0x838b('0x65')][_0x838b('0x88')];_0x2c1e89[_0x838b('0x65')]['messageId']=_0x14c437[_0x838b('0x65')][_0x838b('0x95')];break;case _0x838b('0x96'):_0x2c1e89[_0x838b('0x65')][_0x838b('0x84')]=_0x14c437['body'][_0x838b('0x84')];_0x2c1e89['body'][_0x838b('0x65')]=_0x14c437['body'][_0x838b('0x28')];_0x2c1e89[_0x838b('0x65')][_0x838b('0x8a')]=_0x14c437[_0x838b('0x65')]['refid'];break;}}if(_0x2c1e89['body']['id']){delete _0x2c1e89[_0x838b('0x65')]['id'];}if(_[_0x838b('0x97')](_0x2c1e89[_0x838b('0x65')][_0x838b('0x84')])){throw new db[(_0x838b('0x1c'))][(_0x838b('0x1d'))](_0x838b('0x98'));}if(_[_0x838b('0x97')](_0x2c1e89[_0x838b('0x65')][_0x838b('0x65')])||_0x2c1e89[_0x838b('0x65')]['body']===''){throw new db['Sequelize'][(_0x838b('0x1d'))](_0x838b('0x99'));}if(_[_0x838b('0x97')](_0x2c1e89[_0x838b('0x65')][_0x838b('0x9a')])){throw new db[(_0x838b('0x1c'))]['ValidationError'](_0x838b('0x9b')+_0x2c4362);}if(!_[_0x838b('0x9c')](_0x2c4362,_0x2c1e89[_0x838b('0x65')]['mapKey'])){throw new db[(_0x838b('0x1c'))][(_0x838b('0x1d'))](_0x838b('0x9d')+_0x2c4362);}_0x1e417b[_0x2c1e89[_0x838b('0x65')][_0x838b('0x9a')]]=_0x2c1e89['body'][_0x838b('0x84')];return db['CmList']['find']({'where':{'id':_0x2c1e89[_0x838b('0x7a')][_0x838b('0x81')]},'include':[{'model':db[_0x838b('0x7b')],'as':_0x838b('0x9e'),'where':_0x1e417b,'limit':0x1,'order':[['updatedAt',_0x838b('0x9f')]]}]});})['then'](handleEntityNotFound(_0x1f12b9,null))[_0x838b('0x34')](function(_0x5be8dd){if(_0x5be8dd){_0x2c1e89[_0x838b('0xa0')]=_[_0x838b('0xa1')](_0x5be8dd,['Contacts']);if(_0x5be8dd['Contacts'][_0x838b('0x5a')]){return _0x5be8dd[_0x838b('0x9e')][0x0];}var _0x1d1a5e=_[_0x838b('0x14')](_0x2c1e89['body'],{'firstName':_0x2c1e89[_0x838b('0x65')][_0x838b('0x84')],'ListId':_0x5be8dd['id']});_0x1d1a5e[_0x2c1e89[_0x838b('0x65')][_0x838b('0x9a')]]=_0x2c1e89[_0x838b('0x65')]['from'];return db[_0x838b('0x7b')][_0x838b('0x5d')](_0x1d1a5e,{'fields':_0x5d2254,'raw':!![]});}})[_0x838b('0x34')](handleEntityNotFound(_0x1f12b9,null))[_0x838b('0x34')](function(_0x53a5e4){if(_0x53a5e4){_0x2c1e89[_0x838b('0xa2')]=_0x53a5e4;var _0x543869={'ContactId':_0x53a5e4['id'],'phone':_0x2c1e89[_0x838b('0x65')][_0x838b('0x84')],'SmsAccountId':_0x14c437[_0x838b('0x66')]['id']};var _0x2079b5={'ContactId':_0x53a5e4['id'],'SmsAccountId':_0x14c437[_0x838b('0x66')]['id'],'closed':![]};return db[_0x838b('0xa3')]['find']({'where':_0x2079b5})[_0x838b('0x34')](function(_0x44da50){if(_0x44da50){return[_0x44da50,![]];}return db[_0x838b('0xa3')][_0x838b('0x5d')](_0x543869)[_0x838b('0x34')](function(_0x258aea){return[_0x258aea,!![]];});});}})[_0x838b('0xa4')](function(_0x3e66a2,_0x497214){_0x2c1e89[_0x838b('0xa5')]=_0x3e66a2[_0x838b('0x36')]({'plain':!![]});_0x2c1e89[_0x838b('0xa5')][_0x838b('0xa6')]=![];if(_0x497214){if(_0x2c1e89[_0x838b('0x7a')][_0x838b('0xa7')]){_0x2c1e89['applications'][_0x838b('0xa8')]({'id':0x0,'priority':_0x2c1e89[_0x838b('0x77')][_0x838b('0x5a')]+0x1,'app':_0x838b('0xa9'),'appdata':_0x838b('0xaa'),'interval':_0x838b('0xab')});}_0x2c1e89['interaction'][_0x838b('0xa6')]=!![];}return db[_0x838b('0xac')][_0x838b('0x5d')]({'phone':_0x2c1e89[_0x838b('0x65')]['from'],'messageId':_0x2c1e89['body'][_0x838b('0x8a')],'body':_0x2c1e89[_0x838b('0x65')][_0x838b('0x65')],'SmsAccountId':_0x14c437['params']['id'],'SmsInteractionId':_0x3e66a2['id'],'direction':'in','ContactId':_0x3e66a2[_0x838b('0xad')],'AttachmentId':_0x2c1e89[_0x838b('0x65')][_0x838b('0xae')]});})['then'](function(_0x1bb5d4){_0x2c1e89['message']=_0x1bb5d4;if(_0x2c1e89[_0x838b('0xa5')]['UserId']){return db[_0x838b('0xaf')][_0x838b('0x5c')]({'attributes':['id',_0x838b('0x3b')],'where':{'id':_0x2c1e89['interaction'][_0x838b('0xb0')]}})[_0x838b('0x34')](function(_0x231a51){if(_0x231a51){_0x2c1e89['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x838b('0xb1'),'appdata':_0x231a51[_0x838b('0x3b')]+','+(_0x2c1e89[_0x838b('0x7a')][_0x838b('0xb2')]||0xa),'interval':_0x838b('0xab')});}return respondWithRpcPromise('Start',_0x838b('0xb3'),_0x2c1e89);});}return respondWithRpcPromise(_0x838b('0xb4'),_0x838b('0xb3'),_0x2c1e89);})[_0x838b('0x34')](function(_0x4e9b80){if(_0x4e9b80){var _0x20c93e=0xc8;var _0x3cfa82='receiveMessage';logger[_0x838b('0x20')](_0x838b('0x23'),_0x3cfa82,_0x20c93e,_0x838b('0xb5'));logger['debug'](_0x838b('0xb6'),_0x3cfa82,_0x20c93e,_0x838b('0xb5'),JSON[_0x838b('0x24')](_0x4e9b80));if(_0x2c1e89['account'][_0x838b('0x42')]==='twilio'){return _0x1f12b9[_0x838b('0x2a')](_0x20c93e)['set'](_0x838b('0xb7'),'text/xml')[_0x838b('0x3c')](_0x838b('0xb8'));}else{return _0x1f12b9[_0x838b('0x2a')](_0x20c93e)[_0x838b('0x2f')](_0x4e9b80);}}})[_0x838b('0x56')](handleError(_0x1f12b9,null));};exports[_0x838b('0xb9')]=function(_0xb76b3,_0x381cd4,_0x14e9bf){return db[_0x838b('0x40')][_0x838b('0x71')]({'where':{'id':_0xb76b3[_0x838b('0x66')]['id']}})[_0x838b('0x34')](handleEntityNotFound(_0x381cd4,null))['then'](function(_0xe890a2){if(_0xe890a2){return db['sequelize']['transaction'](function(_0x37971a){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0xb76b3[_0x838b('0x66')]['id']},'transaction':_0x37971a})[_0x838b('0x34')](function(_0x4b51e5){var _0x4115ce=_[_0x838b('0x3f')](_0xb76b3[_0x838b('0x65')],function(_0x15c0b3){_0x15c0b3['SmsAccountId']=_0xb76b3[_0x838b('0x66')]['id'];return _0x15c0b3;});return db[_0x838b('0x75')][_0x838b('0xba')](_0x4115ce,{'transaction':_0x37971a});});})[_0x838b('0x34')](function(){return db[_0x838b('0x75')][_0x838b('0xbb')]({'where':{'SmsAccountId':_0xb76b3[_0x838b('0x66')]['id']},'order':_0x838b('0x78')});});}})[_0x838b('0x34')](respondWithResult(_0x381cd4,null))[_0x838b('0x56')](handleError(_0x381cd4,null));};exports[_0x838b('0xbc')]=function(_0x3c72cc,_0x278269,_0x53abc1){var _0x5ccd4c={};var _0x2df375={};var _0xf2932e;var _0x8bf47b;return db[_0x838b('0x40')][_0x838b('0x71')]({'where':{'id':_0x3c72cc['params']['id']}})[_0x838b('0x34')](handleEntityNotFound(_0x278269,null))[_0x838b('0x34')](function(_0x226765){if(_0x226765){_0xf2932e=_0x226765;_0x2df375[_0x838b('0x44')]=_[_0x838b('0x58')](db[_0x838b('0x75')][_0x838b('0x59')]);_0x2df375[_0x838b('0x45')]=_[_0x838b('0x58')](_0x3c72cc[_0x838b('0x45')]);_0x2df375[_0x838b('0x46')]=_[_0x838b('0x48')](_0x2df375[_0x838b('0x44')],_0x2df375[_0x838b('0x45')]);_0x5ccd4c[_0x838b('0x47')]=_[_0x838b('0x48')](_0x2df375[_0x838b('0x44')],qs['fields'](_0x3c72cc[_0x838b('0x45')][_0x838b('0x49')]));_0x5ccd4c['attributes']=_0x5ccd4c[_0x838b('0x47')][_0x838b('0x5a')]?_0x5ccd4c[_0x838b('0x47')]:_0x2df375[_0x838b('0x44')];_0x5ccd4c[_0x838b('0x4d')]=qs['sort'](_0x3c72cc['query'][_0x838b('0x4e')]);_0x5ccd4c['where']=qs['filters'](_[_0x838b('0x4f')](_0x3c72cc[_0x838b('0x45')],_0x2df375[_0x838b('0x46')]));if(_0x3c72cc['query'][_0x838b('0x6c')]){_0x5ccd4c[_0x838b('0x50')]=_['merge'](_0x5ccd4c[_0x838b('0x50')],{'$or':_[_0x838b('0x3f')](_0x5ccd4c[_0x838b('0x47')],function(_0x90b3){var _0x7cae91={};_0x7cae91[_0x90b3]={'$like':'%'+_0x3c72cc[_0x838b('0x45')][_0x838b('0x6c')]+'%'};return _0x7cae91;})});}_0x5ccd4c=_[_0x838b('0x52')]({},_0x5ccd4c,_0x3c72cc['options']);return _0xf2932e[_0x838b('0xbc')](_0x5ccd4c);}})[_0x838b('0x34')](function(_0x5b951d){if(_0x5b951d){_0x8bf47b=_0x5b951d['length'];if(!_0x3c72cc['query'][_0x838b('0x4a')](_0x838b('0x4b'))){_0x5ccd4c[_0x838b('0x4c')]=qs[_0x838b('0x4c')](_0x3c72cc[_0x838b('0x45')]['limit']);_0x5ccd4c[_0x838b('0x2c')]=qs[_0x838b('0x2c')](_0x3c72cc[_0x838b('0x45')]['offset']);}return _0xf2932e[_0x838b('0xbc')](_0x5ccd4c);}})[_0x838b('0x34')](function(_0x33f8cb){if(_0x33f8cb){return _0x33f8cb?{'count':_0x8bf47b,'rows':_0x33f8cb}:null;}})[_0x838b('0x34')](respondWithResult(_0x278269,null))[_0x838b('0x56')](handleError(_0x278269,null));};exports['getInteractions']=function(_0x5aa085,_0x179ae2,_0x1f96d2){var _0x2307a4={'raw':![],'where':{}};var _0x3bcc41={};var _0x28d1bd={'count':0x0,'rows':[]};return db[_0x838b('0x40')][_0x838b('0x71')]({'where':{'id':_0x5aa085[_0x838b('0x66')]['id']}})[_0x838b('0x34')](handleEntityNotFound(_0x179ae2,null))['then'](function(_0x420de4){if(_0x420de4){_0x3bcc41[_0x838b('0x44')]=_[_0x838b('0x58')](db[_0x838b('0xa3')][_0x838b('0x59')]);_0x3bcc41[_0x838b('0x45')]=_['keys'](_0x5aa085[_0x838b('0x45')]);_0x3bcc41[_0x838b('0x46')]=_['intersection'](_0x3bcc41[_0x838b('0x44')],_0x3bcc41['query']);_0x2307a4[_0x838b('0x47')]=_[_0x838b('0x48')](_0x3bcc41[_0x838b('0x44')],qs[_0x838b('0x49')](_0x5aa085['query'][_0x838b('0x49')]));_0x2307a4[_0x838b('0x47')]=_0x2307a4['attributes'][_0x838b('0x5a')]?_0x2307a4['attributes']:_0x3bcc41['model'];if(!_0x5aa085[_0x838b('0x45')][_0x838b('0x4a')](_0x838b('0x4b'))){_0x2307a4['limit']=qs[_0x838b('0x4c')](_0x5aa085['query'][_0x838b('0x4c')]);_0x2307a4['offset']=qs[_0x838b('0x2c')](_0x5aa085[_0x838b('0x45')][_0x838b('0x2c')]);}_0x2307a4[_0x838b('0x4d')]=qs[_0x838b('0x4e')](_0x5aa085['query']['sort']);_0x2307a4[_0x838b('0x50')]=qs[_0x838b('0x46')](_[_0x838b('0x4f')](_0x5aa085[_0x838b('0x45')],_0x3bcc41[_0x838b('0x46')]));_0x2307a4[_0x838b('0x50')]['SmsAccountId']=_0x420de4['id'];if(_0x5aa085[_0x838b('0x45')][_0x838b('0x6c')]){_0x2307a4[_0x838b('0x50')]=_[_0x838b('0x52')](_0x2307a4['where'],{'$or':_[_0x838b('0x3f')](_0x2307a4['attributes'],function(_0xd8b8a){var _0x436d14={};_0x436d14[_0xd8b8a]={'$like':'%'+_0x5aa085[_0x838b('0x45')]['filter']+'%'};return _0x436d14;})});}_0x2307a4=_['merge']({},_0x2307a4,_0x5aa085[_0x838b('0x6d')]);return db[_0x838b('0xa3')][_0x838b('0x2b')]({'where':_0x2307a4[_0x838b('0x50')]})[_0x838b('0x34')](function(_0x4211b5){_0x28d1bd[_0x838b('0x2b')]=_0x4211b5;if(_0x5aa085[_0x838b('0x45')]['includeAll']){_0x2307a4[_0x838b('0x5b')]=[{'model':db[_0x838b('0x7b')],'as':_0x838b('0xbd'),'required':![]},{'model':db[_0x838b('0xaf')],'as':_0x838b('0xbe'),'attributes':[_0x838b('0x3b'),_0x838b('0xbf'),_0x838b('0xc0')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x838b('0x3b'),'color'],'where':_0x5aa085[_0x838b('0x45')][_0x838b('0xc1')]?{'id':_0x5aa085[_0x838b('0x45')]['tag']}:undefined,'required':_0x5aa085[_0x838b('0x45')][_0x838b('0xc1')]?!![]:![]}];}return db['SmsInteraction'][_0x838b('0x54')](_0x2307a4);})[_0x838b('0x34')](function(_0x3974a1){_0x28d1bd[_0x838b('0x55')]=_0x3974a1;return _0x28d1bd;});}})['then'](respondWithFilteredResult(_0x179ae2,_0x2307a4))[_0x838b('0x56')](handleError(_0x179ae2,null));};exports['send']=function(_0x17a1e,_0x117672,_0x1d5c33){var _0xb0ff90,_0x46c3dd,_0x19b4b6;if(_[_0x838b('0x97')](_0x17a1e[_0x838b('0x65')][_0x838b('0x65')])||_0x17a1e[_0x838b('0x65')][_0x838b('0x65')]===''){throw new db[(_0x838b('0x1c'))][(_0x838b('0x1d'))](_0x838b('0x99'));}if(_[_0x838b('0x97')](_0x17a1e[_0x838b('0x65')]['to'])){throw new db['Sequelize'][(_0x838b('0x1d'))](_0x838b('0xc2'));}_0xb0ff90=_0x17a1e['body']['to'];return db[_0x838b('0x40')][_0x838b('0x5c')]({'where':{'id':_0x17a1e['params']['id']},'include':[{'model':db[_0x838b('0xc3')],'as':_0x838b('0xc4'),'include':[{'model':db[_0x838b('0x7b')],'as':_0x838b('0x9e'),'where':{'mobile':_0xb0ff90},'limit':0x1,'order':[[_0x838b('0x7e'),'DESC']]}]}]})[_0x838b('0x34')](handleEntityNotFound(_0x117672,null))[_0x838b('0x34')](function(_0x2fa175){if(_0x2fa175&&_0x2fa175[_0x838b('0xc4')]){_0x46c3dd=_0x2fa175[_0x838b('0x36')]({'plain':!![]});if(_0x46c3dd['List']&&_0x46c3dd[_0x838b('0xc4')][_0x838b('0x9e')][_0x838b('0x5a')]){return _0x46c3dd[_0x838b('0xc4')][_0x838b('0x9e')][0x0];}return db[_0x838b('0x7b')][_0x838b('0x5d')](_[_0x838b('0x14')](_0x17a1e[_0x838b('0x65')],{'firstName':_0xb0ff90,'mobile':_0xb0ff90,'phone':_0xb0ff90,'ListId':_0x46c3dd[_0x838b('0x81')]}));}})[_0x838b('0x34')](handleEntityNotFound(_0x117672,null))['then'](function(_0x2978c0){if(_0x2978c0){_0x19b4b6=_0x2978c0;return db[_0x838b('0xa3')][_0x838b('0x5c')]({'where':{'ContactId':_0x19b4b6['id'],'closed':![],'SmsAccountId':_0x46c3dd['id']}})[_0x838b('0x34')](function(_0x3df705){if(_0x3df705){return[_0x3df705,![]];}return db[_0x838b('0xa3')]['create']({'UserId':_0x17a1e[_0x838b('0x5e')]['id'],'ContactId':_0x19b4b6['id'],'SmsAccountId':_0x46c3dd['id'],'phone':_0xb0ff90,'firstMsgDirection':_0x838b('0xc5'),'Messages':[_[_0x838b('0x52')](_0x17a1e[_0x838b('0x65')],{'read':![],'body':_0x17a1e[_0x838b('0x65')][_0x838b('0x65')],'phone':_0xb0ff90,'SmsAccountId':_0x46c3dd['id'],'UserId':_0x17a1e['user']['id'],'ContactId':_0x19b4b6['id']})]},{'include':[{'model':db[_0x838b('0xac')],'as':_0x838b('0xc6')}]})['then'](function(_0x227e0a){return[_0x227e0a,!![]];});});}})[_0x838b('0xa4')](function(_0x196b4d,_0x3fa677){if(_0x3fa677){return _0x196b4d;}return db[_0x838b('0xac')]['create'](_['merge'](_0x17a1e[_0x838b('0x65')],{'read':![],'body':_0x17a1e[_0x838b('0x65')][_0x838b('0x65')],'phone':_0xb0ff90,'SmsAccountId':_0x46c3dd['id'],'SmsInteractionId':_0x196b4d['id'],'UserId':_0x17a1e[_0x838b('0x5e')]['id'],'ContactId':_0x19b4b6['id']}))[_0x838b('0x34')](function(_0x533b05){_0x196b4d[_0x838b('0xc7')]['Messages']=[];_0x196b4d[_0x838b('0xc7')][_0x838b('0xc6')][_0x838b('0xa8')](_0x533b05['dataValues']);return _0x196b4d;});})[_0x838b('0x34')](respondWithResult(_0x117672,null))['catch'](handleError(_0x117672,null));};exports[_0x838b('0x2a')]=function(_0x3cfcc8,_0x3a18ea,_0x3e54e0){if(_0x3cfcc8['body']['id']){delete _0x3cfcc8['body']['id'];}console[_0x838b('0xc8')](_0x838b('0xc9'),_0x3cfcc8[_0x838b('0x65')]);var _0x59c72b,_0x1bdba6,_0x2955ac;return db[_0x838b('0x40')][_0x838b('0x5c')]({'where':{'id':_0x3cfcc8[_0x838b('0x66')]['id']}})[_0x838b('0x34')](handleEntityNotFound(_0x3a18ea,null))['then'](function(_0x925a77){if(_0x925a77){_0x2955ac=_0x925a77;logger[_0x838b('0x22')](_0x838b('0x23'),_0x838b('0x2a'),_0x838b('0xca'),_0x925a77[_0x838b('0x42')],util[_0x838b('0xcb')](_0x3cfcc8[_0x838b('0x65')],{'showHidden':![],'depth':null}));switch(_0x925a77[_0x838b('0x42')]){case _0x838b('0xcc'):if(_0x3cfcc8[_0x838b('0x65')]['skebby_dispatch_id']&&_0x3cfcc8['body'][_0x838b('0x2a')]){_0x1bdba6=_0x3cfcc8[_0x838b('0x65')][_0x838b('0x2a')];return db['SmsMessage'][_0x838b('0x5c')]({'where':{'messageId':_0x3cfcc8[_0x838b('0x65')][_0x838b('0xcd')]}});}break;case'connectel':if(_0x3cfcc8[_0x838b('0x65')][_0x838b('0xce')]&&_0x3cfcc8[_0x838b('0x65')]['statusInt']){_0x1bdba6=_0x3cfcc8['body'][_0x838b('0xcf')];return db[_0x838b('0xac')][_0x838b('0x5c')]({'where':{'messageId':_0x3cfcc8['body'][_0x838b('0xce')]}});}break;case'clicksend':if(_0x3cfcc8['body'][_0x838b('0xd0')]&&_0x3cfcc8[_0x838b('0x65')][_0x838b('0xd1')]){_0x1bdba6=_0x3cfcc8[_0x838b('0x65')][_0x838b('0xd1')];return db[_0x838b('0xac')][_0x838b('0x5c')]({'where':{'messageId':_0x3cfcc8[_0x838b('0x65')][_0x838b('0xd0')]}});}break;case _0x838b('0x8e'):var _0x3c7ce8=_0x3cfcc8[_0x838b('0x65')]['results'][0x0];if(_0x3c7ce8[_0x838b('0x8a')]&&_0x3c7ce8['status']['groupName']==='DELIVERED'){_0x1bdba6=_0x3c7ce8[_0x838b('0x2a')][_0x838b('0xd2')];return db[_0x838b('0xac')][_0x838b('0x5c')]({'where':{'messageId':_0x3c7ce8[_0x838b('0x8a')]}});}break;case'clickatell':if(_0x3cfcc8[_0x838b('0x65')][_0x838b('0x8a')]&&_0x3cfcc8[_0x838b('0x65')][_0x838b('0x2a')]){_0x1bdba6=_0x3cfcc8[_0x838b('0x65')]['status'];return db[_0x838b('0xac')][_0x838b('0x5c')]({'where':{'messageId':_0x3cfcc8[_0x838b('0x65')][_0x838b('0x8a')]}});}break;case _0x838b('0x96'):if(_0x3cfcc8[_0x838b('0x65')]['redif']&&_0x3cfcc8[_0x838b('0x65')][_0x838b('0x2a')]){_0x1bdba6=_0x3cfcc8[_0x838b('0x65')][_0x838b('0x2a')];return db[_0x838b('0xac')][_0x838b('0x5c')]({'where':{'messageId':_0x3cfcc8[_0x838b('0x65')][_0x838b('0xd3')]}});}break;}}})[_0x838b('0x34')](handleEntityNotFound(_0x3a18ea,null))[_0x838b('0x34')](function(_0xa0338a){if(_0xa0338a){_0x59c72b=_0xa0338a;switch(_0x2955ac['type']){case _0x838b('0xcc'):if(_0x1bdba6===_0x838b('0xd4')){return _0x59c72b['update']({'read':!![]});}else{logger[_0x838b('0x25')](_0x838b('0x23'),_0x838b('0x2a'),_0x838b('0xcc'),util[_0x838b('0xcb')](_0x3cfcc8[_0x838b('0x65')],{'showHidden':![],'depth':null}));}break;case _0x838b('0x89'):if(_0x1bdba6==='1'){return _0x59c72b[_0x838b('0x33')]({'read':!![]});}else{logger[_0x838b('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x838b('0x2a'),_0x838b('0xcc'),util['inspect'](_0x3cfcc8[_0x838b('0x65')],{'showHidden':![],'depth':null}));}break;case _0x838b('0xd5'):if(!_0x3cfcc8[_0x838b('0x65')]['error_code']&&_0x1bdba6>=0xc8&&_0x1bdba6<=0xce){return _0x59c72b['update']({'read':!![]});}else{logger[_0x838b('0x25')](_0x838b('0x23'),_0x838b('0x2a'),'clicksend',util['inspect'](_0x3cfcc8['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x54a81e=_0x3cfcc8[_0x838b('0x65')][_0x838b('0x8f')][0x0];if(_0x54a81e[_0x838b('0x2a')][_0x838b('0xd2')]===_0x838b('0xd4')){return _0x59c72b[_0x838b('0x33')]({'read':!![]});}else{logger[_0x838b('0x25')](_0x838b('0x23'),_0x838b('0x2a'),_0x838b('0x8e'),util[_0x838b('0xcb')](_0x3cfcc8[_0x838b('0x65')],{'showHidden':![],'depth':null}));}break;case _0x838b('0x93'):if(_0x1bdba6==_0x838b('0xd6')||_0x1bdba6==_0x838b('0xd7')){return _0x59c72b[_0x838b('0x33')]({'read':!![]});}else{logger[_0x838b('0x25')](_0x838b('0x23'),_0x838b('0x2a'),_0x838b('0x93'),util[_0x838b('0xcb')](_0x3cfcc8['body'],{'showHidden':![],'depth':null}));}break;case _0x838b('0x96'):if(_0x1bdba6===_0x838b('0xd8')||_0x1bdba6===_0x838b('0xd9')){return _0x59c72b[_0x838b('0x33')]({'read':!![]});}else{logger['error'](_0x838b('0x23'),'status',_0x838b('0x96'),util[_0x838b('0xcb')](_0x3cfcc8[_0x838b('0x65')],{'showHidden':![],'depth':null}));}break;}return _0x59c72b;}})[_0x838b('0x34')](respondWithResult(_0x3a18ea,null))['catch'](handleError(_0x3a18ea,null));};exports['statusGet']=function(_0x54f998,_0xdba49f,_0x4a59c9){var _0x16e2cc,_0x18d582,_0x8456b8;return db[_0x838b('0x40')][_0x838b('0x5c')]({'where':{'id':_0x54f998['params']['id']}})['then'](handleEntityNotFound(_0xdba49f,null))[_0x838b('0x34')](function(_0x4d35c7){if(_0x4d35c7){_0x8456b8=_0x4d35c7;logger[_0x838b('0x22')](_0x838b('0x23'),'status','received\x20delivery\x20report\x20from',_0x4d35c7['type'],util[_0x838b('0xcb')](_0x54f998['query'],{'showHidden':![],'depth':null}));switch(_0x4d35c7[_0x838b('0x42')]){case _0x838b('0x90'):if(_0x54f998['query'][_0x838b('0xda')]&&_0x54f998[_0x838b('0x45')]['state']){_0x18d582=_0x54f998[_0x838b('0x45')]['state'];return db[_0x838b('0xac')][_0x838b('0x5c')]({'where':{'messageId':_0x54f998[_0x838b('0x45')]['message-id']}});}break;}}})[_0x838b('0x34')](handleEntityNotFound(_0xdba49f,null))['then'](function(_0x346009){if(_0x346009){_0x16e2cc=_0x346009;switch(_0x8456b8[_0x838b('0x42')]){case _0x838b('0x90'):if(_0x18d582==='2'||_0x18d582==='6'){return _0x16e2cc['update']({'read':!![]});}else{logger[_0x838b('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x838b('0x90'),util['inspect'](_0x54f998[_0x838b('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x16e2cc;}})['then'](respondWithResult(_0xdba49f,null))[_0x838b('0x56')](handleError(_0xdba49f,null));};exports['addAgents']=function(_0x72b23b,_0x4c99c0,_0x57c1bc){return db[_0x838b('0x40')][_0x838b('0x5c')]({'where':{'id':_0x72b23b[_0x838b('0x66')]['id']}})[_0x838b('0x34')](handleEntityNotFound(_0x4c99c0,null))[_0x838b('0x34')](function(_0x40d9ec){if(_0x40d9ec){return _0x40d9ec[_0x838b('0xdb')](_0x72b23b['body'][_0x838b('0x6f')],_[_0x838b('0xa1')](_0x72b23b[_0x838b('0x65')],[_0x838b('0x6f'),'id'])||{})[_0x838b('0xa4')](function(_0x762056){for(var _0x411252=0x0;_0x411252<_0x72b23b[_0x838b('0x65')][_0x838b('0x6f')][_0x838b('0x5a')];_0x411252+=0x1){socket['emit'](_0x838b('0xdc'),{'UserId':_0x72b23b[_0x838b('0x65')][_0x838b('0x6f')][_0x411252],'SmsAccountId':_0x72b23b[_0x838b('0x66')]['id']});}return _0x762056;});}})[_0x838b('0x34')](respondWithResult(_0x4c99c0,null))[_0x838b('0x56')](handleError(_0x4c99c0,null));};exports[_0x838b('0xdd')]=function(_0x4eb212,_0x54708a,_0xf50dda){return db[_0x838b('0x40')][_0x838b('0x5c')]({'where':{'id':_0x4eb212[_0x838b('0x66')]['id']}})[_0x838b('0x34')](handleEntityNotFound(_0x54708a,null))['then'](function(_0x519bf3){if(_0x519bf3){return _0x519bf3['removeAgents'](_0x4eb212[_0x838b('0x45')][_0x838b('0x6f')])[_0x838b('0x34')](function(){if(_[_0x838b('0xde')](_0x4eb212['query'][_0x838b('0x6f')])){for(var _0x1b1297=0x0;_0x1b1297<_0x4eb212[_0x838b('0x45')][_0x838b('0x6f')][_0x838b('0x5a')];_0x1b1297+=0x1){socket[_0x838b('0xdf')]('userSmsAccount:remove',{'UserId':Number(_0x4eb212[_0x838b('0x45')]['ids'][_0x1b1297]),'SmsAccountId':Number(_0x4eb212[_0x838b('0x66')]['id'])});}}else{socket[_0x838b('0xdf')](_0x838b('0xe0'),{'UserId':Number(_0x4eb212['query'][_0x838b('0x6f')]),'SmsAccountId':Number(_0x4eb212[_0x838b('0x66')]['id'])});}});}})[_0x838b('0x34')](respondWithStatusCode(_0x54708a,null))[_0x838b('0x56')](handleError(_0x54708a,null));};exports[_0x838b('0xe1')]=function(_0x360145,_0x521b00,_0x40d116){var _0x441223={};var _0x22da47={};var _0x2e4be2;var _0x2d6393;return db['SmsAccount'][_0x838b('0x71')]({'where':{'id':_0x360145['params']['id']}})[_0x838b('0x34')](handleEntityNotFound(_0x521b00,null))[_0x838b('0x34')](function(_0x222212){if(_0x222212){_0x2e4be2=_0x222212;_0x22da47[_0x838b('0x44')]=_[_0x838b('0x58')](db[_0x838b('0xaf')][_0x838b('0x59')]);_0x22da47[_0x838b('0x45')]=_['keys'](_0x360145[_0x838b('0x45')]);_0x22da47['filters']=_[_0x838b('0x48')](_0x22da47[_0x838b('0x44')],_0x22da47['query']);_0x441223[_0x838b('0x47')]=_['intersection'](_0x22da47['model'],qs[_0x838b('0x49')](_0x360145[_0x838b('0x45')][_0x838b('0x49')]));_0x441223[_0x838b('0x47')]=_0x441223[_0x838b('0x47')]['length']?_0x441223[_0x838b('0x47')]:_0x22da47[_0x838b('0x44')];_0x441223[_0x838b('0x4d')]=qs[_0x838b('0x4e')](_0x360145[_0x838b('0x45')]['sort']);_0x441223[_0x838b('0x50')]=qs[_0x838b('0x46')](_[_0x838b('0x4f')](_0x360145['query'],_0x22da47[_0x838b('0x46')]));if(_0x360145[_0x838b('0x45')][_0x838b('0x6c')]){_0x441223['where']=_[_0x838b('0x52')](_0x441223['where'],{'$or':_['map'](_0x441223[_0x838b('0x47')],function(_0x5877b1){var _0x35621c={};_0x35621c[_0x5877b1]={'$like':'%'+_0x360145[_0x838b('0x45')]['filter']+'%'};return _0x35621c;})});}_0x441223=_[_0x838b('0x52')]({},_0x441223,_0x360145[_0x838b('0x6d')]);return _0x2e4be2['getAgents'](_0x441223);}})['then'](function(_0x20a534){if(_0x20a534){_0x2d6393=_0x20a534[_0x838b('0x5a')];if(!_0x360145['query']['hasOwnProperty'](_0x838b('0x4b'))){_0x441223[_0x838b('0x4c')]=qs['limit'](_0x360145[_0x838b('0x45')][_0x838b('0x4c')]);_0x441223[_0x838b('0x2c')]=qs[_0x838b('0x2c')](_0x360145[_0x838b('0x45')][_0x838b('0x2c')]);}return _0x2e4be2[_0x838b('0xe1')](_0x441223);}})[_0x838b('0x34')](function(_0x509be3){if(_0x509be3){return _0x509be3?{'count':_0x2d6393,'rows':_0x509be3}:null;}})[_0x838b('0x34')](respondWithResult(_0x521b00,null))[_0x838b('0x56')](handleError(_0x521b00,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 52222d9..196086e 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 _0xbfe7=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x2c1ee7,_0x3443b8){var _0x2f9e25=function(_0xee88bf){while(--_0xee88bf){_0x2c1ee7['push'](_0x2c1ee7['shift']());}};_0x2f9e25(++_0x3443b8);}(_0xbfe7,0x83));var _0x7bfe=function(_0x17ddd8,_0xccfd06){_0x17ddd8=_0x17ddd8-0x0;var _0x3bf337=_0xbfe7[_0x17ddd8];return _0x3bf337;};'use strict';var EventEmitter=require(_0x7bfe('0x0'));var SmsAccount=require(_0x7bfe('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7bfe('0x2')](0x0);var events={'afterCreate':_0x7bfe('0x3'),'afterUpdate':'update','afterDestroy':_0x7bfe('0x4')};function emitEvent(_0xa5be9a){return function(_0x3bd874,_0x51c1bb,_0x2293f3){SmsAccountEvents[_0x7bfe('0x5')](_0xa5be9a+':'+_0x3bd874['id'],_0x3bd874);SmsAccountEvents['emit'](_0xa5be9a,_0x3bd874);_0x2293f3(null);};}for(var e in events){if(events[_0x7bfe('0x6')](e)){var event=events[e];SmsAccount[_0x7bfe('0x7')](e,emitEvent(event));}}module[_0x7bfe('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x3511=['../../mysqldb','SmsAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3511,0x6d));var _0x1351=function(_0x47b7c9,_0x3848b2){_0x47b7c9=_0x47b7c9-0x0;var _0x435aaf=_0x3511[_0x47b7c9];return _0x435aaf;};'use strict';var EventEmitter=require(_0x1351('0x0'));var SmsAccount=require(_0x1351('0x1'))['db'][_0x1351('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x1351('0x3')](0x0);var events={'afterCreate':_0x1351('0x4'),'afterUpdate':_0x1351('0x5'),'afterDestroy':'remove'};function emitEvent(_0x247f6c){return function(_0x1b4851,_0x3a47f6,_0x54a910){SmsAccountEvents[_0x1351('0x6')](_0x247f6c+':'+_0x1b4851['id'],_0x1b4851);SmsAccountEvents[_0x1351('0x6')](_0x247f6c,_0x1b4851);_0x54a910(null);};}for(var e in events){if(events[_0x1351('0x7')](e)){var event=events[e];SmsAccount[_0x1351('0x8')](e,emitEvent(event));}}module[_0x1351('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index a888fe2..5882b81 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 _0xc164=['define','sms_accounts','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc164,0x14c));var _0x4c16=function(_0x2cab58,_0x5a04b2){_0x2cab58=_0x2cab58-0x0;var _0x883f98=_0xc164[_0x2cab58];return _0x883f98;};'use strict';var _=require('lodash');var util=require(_0x4c16('0x0'));var logger=require(_0x4c16('0x1'))(_0x4c16('0x2'));var moment=require('moment');var BPromise=require(_0x4c16('0x3'));var rp=require(_0x4c16('0x4'));var fs=require('fs');var path=require(_0x4c16('0x5'));var rimraf=require('rimraf');var config=require(_0x4c16('0x6'));var attributes=require(_0x4c16('0x7'));module['exports']=function(_0xded8cb,_0x3371f7){return _0xded8cb[_0x4c16('0x8')]('SmsAccount',attributes,{'tableName':_0x4c16('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e21=['request-promise','path','rimraf','../../config/environment','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x8768ce,_0x24bed4){var _0x2ab297=function(_0x3107a4){while(--_0x3107a4){_0x8768ce['push'](_0x8768ce['shift']());}};_0x2ab297(++_0x24bed4);}(_0x1e21,0x13e));var _0x11e2=function(_0x574ea1,_0x5e4f51){_0x574ea1=_0x574ea1-0x0;var _0x36179a=_0x1e21[_0x574ea1];return _0x36179a;};'use strict';var _=require(_0x11e2('0x0'));var util=require(_0x11e2('0x1'));var logger=require(_0x11e2('0x2'))(_0x11e2('0x3'));var moment=require(_0x11e2('0x4'));var BPromise=require(_0x11e2('0x5'));var rp=require(_0x11e2('0x6'));var fs=require('fs');var path=require(_0x11e2('0x7'));var rimraf=require(_0x11e2('0x8'));var config=require(_0x11e2('0x9'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x15868e,_0x4a9301){return _0x15868e['define'](_0x11e2('0xa'),attributes,{'tableName':_0x11e2('0xb'),'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 157e3f8..d8ded1a 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 _0xe0aa=['redis','defaults','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','ShowSmsAccount','find','raw','options','attributes','include','model','map','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x40ed53,_0x426d3c){var _0x52d028=function(_0x1f70f7){while(--_0x1f70f7){_0x40ed53['push'](_0x40ed53['shift']());}};_0x52d028(++_0x426d3c);}(_0xe0aa,0xd6));var _0xae0a=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0xe0aa[_0x2053ea];return _0x2232c4;};'use strict';var _=require(_0xae0a('0x0'));var util=require(_0xae0a('0x1'));var moment=require(_0xae0a('0x2'));var BPromise=require(_0xae0a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae0a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xae0a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xae0a('0x6'));var jayson=require(_0xae0a('0x7'));var client=jayson[_0xae0a('0x8')][_0xae0a('0x9')]({'port':0x232a});config[_0xae0a('0xa')]=_[_0xae0a('0xb')](config[_0xae0a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xae0a('0xc'))(new Redis(config[_0xae0a('0xa')]));require('./smsAccount.socket')[_0xae0a('0xd')](socket);function respondWithRpcPromise(_0x3d8b7f,_0xe8327,_0x1f3ee1){return new BPromise(function(_0x13586b,_0x16e26c){return client[_0xae0a('0xe')](_0x3d8b7f,_0x1f3ee1)[_0xae0a('0xf')](function(_0x42ceb9){logger[_0xae0a('0x10')](_0xae0a('0x11'),_0xe8327,_0xae0a('0x12'));logger[_0xae0a('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe8327,_0xae0a('0x12'),JSON['stringify'](_0x42ceb9));if(_0x42ceb9[_0xae0a('0x14')]){if(_0x42ceb9['error'][_0xae0a('0x15')]===0x1f4){logger['error'](_0xae0a('0x11'),_0xe8327,_0x42ceb9['error']['message']);return _0x16e26c(_0x42ceb9[_0xae0a('0x14')][_0xae0a('0x16')]);}logger[_0xae0a('0x14')](_0xae0a('0x11'),_0xe8327,_0x42ceb9[_0xae0a('0x14')][_0xae0a('0x16')]);return _0x13586b(_0x42ceb9['error']['message']);}else{logger['info'](_0xae0a('0x11'),_0xe8327,_0xae0a('0x12'));_0x13586b(_0x42ceb9[_0xae0a('0x17')][_0xae0a('0x16')]);}})['catch'](function(_0xae5b79){logger[_0xae0a('0x14')](_0xae0a('0x11'),_0xe8327,_0xae5b79);_0x16e26c(_0xae5b79);});});}exports[_0xae0a('0x18')]=function(_0x8db1fb){var _0xbfdfa1=this;return new Promise(function(_0x251c0a,_0x126dd6){return db['SmsAccount'][_0xae0a('0x19')]({'raw':_0x8db1fb['options']?_0x8db1fb['options'][_0xae0a('0x1a')]===undefined?!![]:![]:!![],'where':_0x8db1fb[_0xae0a('0x1b')]?_0x8db1fb['options']['where']||null:null,'attributes':_0x8db1fb[_0xae0a('0x1b')]?_0x8db1fb['options'][_0xae0a('0x1c')]||null:null,'include':_0x8db1fb[_0xae0a('0x1b')]?_0x8db1fb[_0xae0a('0x1b')][_0xae0a('0x1d')]?_['map'](_0x8db1fb[_0xae0a('0x1b')][_0xae0a('0x1d')],function(_0x1b3b5e){return{'model':db[_0x1b3b5e[_0xae0a('0x1e')]],'as':_0x1b3b5e['as'],'attributes':_0x1b3b5e[_0xae0a('0x1c')],'include':_0x1b3b5e[_0xae0a('0x1d')]?_[_0xae0a('0x1f')](_0x1b3b5e['include'],function(_0x10c760){return{'model':db[_0x10c760['model']],'as':_0x10c760['as'],'attributes':_0x10c760[_0xae0a('0x1c')],'include':_0x10c760[_0xae0a('0x1d')]?_[_0xae0a('0x1f')](_0x10c760[_0xae0a('0x1d')],function(_0x43e92c){return{'model':db[_0x43e92c[_0xae0a('0x1e')]],'as':_0x43e92c['as'],'attributes':_0x43e92c[_0xae0a('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22a58f){logger['info'](_0xae0a('0x18'),_0x8db1fb);logger[_0xae0a('0x13')](_0xae0a('0x18'),_0x8db1fb,JSON['stringify'](_0x22a58f));_0x251c0a(_0x22a58f);})['catch'](function(_0x9a5416){logger[_0xae0a('0x14')](_0xae0a('0x18'),_0x9a5416[_0xae0a('0x16')],_0x8db1fb);_0x126dd6(_0xbfdfa1[_0xae0a('0x14')](0x1f4,_0x9a5416['message']));});});}; \ No newline at end of file +var _0xb63b=['socket.io-emitter','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsAccount','find','options','raw','where','attributes','include','map','model','then','ShowSmsAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb63b,0x1bc));var _0xbb63=function(_0x479165,_0x21b9c){_0x479165=_0x479165-0x0;var _0x5238a9=_0xb63b[_0x479165];return _0x5238a9;};'use strict';var _=require(_0xbb63('0x0'));var util=require(_0xbb63('0x1'));var moment=require(_0xbb63('0x2'));var BPromise=require('bluebird');var rs=require(_0xbb63('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb63('0x4'))['db'];var utils=require(_0xbb63('0x5'));var logger=require('../../config/logger')(_0xbb63('0x6'));var config=require(_0xbb63('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbb63('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xbb63('0x9')],{'host':_0xbb63('0xa'),'port':0x18eb});var socket=require(_0xbb63('0xb'))(new Redis(config[_0xbb63('0x9')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x311f40,_0x7d3c05,_0x4d24cb){return new BPromise(function(_0x1afb90,_0x5a59db){return client[_0xbb63('0xc')](_0x311f40,_0x4d24cb)['then'](function(_0xa3cf29){logger[_0xbb63('0xd')](_0xbb63('0xe'),_0x7d3c05,_0xbb63('0xf'));logger[_0xbb63('0x10')](_0xbb63('0x11'),_0x7d3c05,_0xbb63('0xf'),JSON[_0xbb63('0x12')](_0xa3cf29));if(_0xa3cf29[_0xbb63('0x13')]){if(_0xa3cf29[_0xbb63('0x13')][_0xbb63('0x14')]===0x1f4){logger[_0xbb63('0x13')](_0xbb63('0xe'),_0x7d3c05,_0xa3cf29[_0xbb63('0x13')][_0xbb63('0x15')]);return _0x5a59db(_0xa3cf29[_0xbb63('0x13')][_0xbb63('0x15')]);}logger[_0xbb63('0x13')](_0xbb63('0xe'),_0x7d3c05,_0xa3cf29['error'][_0xbb63('0x15')]);return _0x1afb90(_0xa3cf29[_0xbb63('0x13')][_0xbb63('0x15')]);}else{logger[_0xbb63('0xd')](_0xbb63('0xe'),_0x7d3c05,_0xbb63('0xf'));_0x1afb90(_0xa3cf29[_0xbb63('0x16')][_0xbb63('0x15')]);}})[_0xbb63('0x17')](function(_0x562e95){logger[_0xbb63('0x13')]('SmsAccount,\x20%s,\x20%s',_0x7d3c05,_0x562e95);_0x5a59db(_0x562e95);});});}exports['ShowSmsAccount']=function(_0x4e6f03){var _0x46b567=this;return new Promise(function(_0x12ee67,_0x1a6ee5){return db[_0xbb63('0x18')][_0xbb63('0x19')]({'raw':_0x4e6f03[_0xbb63('0x1a')]?_0x4e6f03[_0xbb63('0x1a')][_0xbb63('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e6f03[_0xbb63('0x1a')]?_0x4e6f03['options'][_0xbb63('0x1c')]||null:null,'attributes':_0x4e6f03[_0xbb63('0x1a')]?_0x4e6f03['options'][_0xbb63('0x1d')]||null:null,'include':_0x4e6f03[_0xbb63('0x1a')]?_0x4e6f03['options'][_0xbb63('0x1e')]?_[_0xbb63('0x1f')](_0x4e6f03[_0xbb63('0x1a')][_0xbb63('0x1e')],function(_0x3c268b){return{'model':db[_0x3c268b[_0xbb63('0x20')]],'as':_0x3c268b['as'],'attributes':_0x3c268b[_0xbb63('0x1d')],'include':_0x3c268b[_0xbb63('0x1e')]?_[_0xbb63('0x1f')](_0x3c268b[_0xbb63('0x1e')],function(_0x559b27){return{'model':db[_0x559b27[_0xbb63('0x20')]],'as':_0x559b27['as'],'attributes':_0x559b27[_0xbb63('0x1d')],'include':_0x559b27[_0xbb63('0x1e')]?_[_0xbb63('0x1f')](_0x559b27[_0xbb63('0x1e')],function(_0x137ee5){return{'model':db[_0x137ee5[_0xbb63('0x20')]],'as':_0x137ee5['as'],'attributes':_0x137ee5[_0xbb63('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbb63('0x21')](function(_0x595cbc){logger[_0xbb63('0xd')](_0xbb63('0x22'),_0x4e6f03);logger[_0xbb63('0x10')](_0xbb63('0x22'),_0x4e6f03,JSON['stringify'](_0x595cbc));_0x12ee67(_0x595cbc);})['catch'](function(_0x6824a6){logger[_0xbb63('0x13')](_0xbb63('0x22'),_0x6824a6[_0xbb63('0x15')],_0x4e6f03);_0x1a6ee5(_0x46b567[_0xbb63('0x13')](0x1f4,_0x6824a6['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 3526073..0681890 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 _0x9782=['smsAccount:','./smsAccount.events','save','update','emit','removeListener','register'];(function(_0x57c82d,_0x2144f5){var _0x46915c=function(_0x26dda1){while(--_0x26dda1){_0x57c82d['push'](_0x57c82d['shift']());}};_0x46915c(++_0x2144f5);}(_0x9782,0xf6));var _0x2978=function(_0x35d116,_0x529031){_0x35d116=_0x35d116-0x0;var _0x48e353=_0x9782[_0x35d116];return _0x48e353;};'use strict';var SmsAccountEvents=require(_0x2978('0x0'));var events=[_0x2978('0x1'),'remove',_0x2978('0x2')];function createListener(_0x4a6900,_0x4c7c1e){return function(_0x30e46f){_0x4c7c1e[_0x2978('0x3')](_0x4a6900,_0x30e46f);};}function removeListener(_0x104f79,_0x452f52){return function(){SmsAccountEvents[_0x2978('0x4')](_0x104f79,_0x452f52);};}exports[_0x2978('0x5')]=function(_0x3626db){for(var _0x4a486c=0x0,_0x2dc1fc=events['length'];_0x4a486c<_0x2dc1fc;_0x4a486c++){var _0x27b70c=events[_0x4a486c];var _0x42d536=createListener(_0x2978('0x6')+_0x27b70c,_0x3626db);SmsAccountEvents['on'](_0x27b70c,_0x42d536);}}; \ No newline at end of file +var _0x2fcb=['length','smsAccount:','remove','removeListener','register'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2fcb,0x98));var _0xb2fc=function(_0x55108b,_0xa54a51){_0x55108b=_0x55108b-0x0;var _0x1d5382=_0x2fcb[_0x55108b];return _0x1d5382;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=['save',_0xb2fc('0x0'),'update'];function createListener(_0x595a58,_0x2f8dab){return function(_0x3d775f){_0x2f8dab['emit'](_0x595a58,_0x3d775f);};}function removeListener(_0x4086da,_0x537208){return function(){SmsAccountEvents[_0xb2fc('0x1')](_0x4086da,_0x537208);};}exports[_0xb2fc('0x2')]=function(_0x475c56){for(var _0x26db8a=0x0,_0x36e952=events[_0xb2fc('0x3')];_0x26db8a<_0x36e952;_0x26db8a++){var _0x11aeb6=events[_0x26db8a];var _0x20280f=createListener(_0xb2fc('0x4')+_0x11aeb6,_0x475c56);SmsAccountEvents['on'](_0x11aeb6,_0x20280f);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 9aaefc3..afbe2c8 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 _0x273d=['exports','multer','util','path','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','update','delete','destroy'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x273d,0xb1));var _0xd273=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x273d[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0xd273('0x0'));var util=require(_0xd273('0x1'));var path=require(_0xd273('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd273('0x3')]();var auth=require(_0xd273('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd273('0x5'));var controller=require('./smsApplication.controller');router[_0xd273('0x6')]('/',auth[_0xd273('0x7')](),controller[_0xd273('0x8')]);router[_0xd273('0x6')](_0xd273('0x9'),auth[_0xd273('0x7')](),controller[_0xd273('0xa')]);router['post']('/',auth[_0xd273('0x7')](),controller['create']);router[_0xd273('0xb')](_0xd273('0x9'),auth[_0xd273('0x7')](),controller[_0xd273('0xc')]);router[_0xd273('0xd')](_0xd273('0x9'),auth[_0xd273('0x7')](),controller[_0xd273('0xe')]);module[_0xd273('0xf')]=router; \ No newline at end of file +var _0xc490=['util','path','../../components/auth/service','../../config/environment','./smsApplication.controller','isAuthenticated','index','/:id','create','put','delete','destroy','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc490,0x117));var _0x0c49=function(_0x39d90c,_0x31f68a){_0x39d90c=_0x39d90c-0x0;var _0x3e8d62=_0xc490[_0x39d90c];return _0x3e8d62;};'use strict';var multer=require(_0x0c49('0x0'));var util=require(_0x0c49('0x1'));var path=require(_0x0c49('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x0c49('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0c49('0x4'));var controller=require(_0x0c49('0x5'));router['get']('/',auth[_0x0c49('0x6')](),controller[_0x0c49('0x7')]);router['get'](_0x0c49('0x8'),auth[_0x0c49('0x6')](),controller['show']);router['post']('/',auth[_0x0c49('0x6')](),controller[_0x0c49('0x9')]);router[_0x0c49('0xa')](_0x0c49('0x8'),auth[_0x0c49('0x6')](),controller['update']);router[_0x0c49('0xb')](_0x0c49('0x8'),auth[_0x0c49('0x6')](),controller[_0x0c49('0xc')]);module[_0x0c49('0xd')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index cca5087..2b95a86 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 _0xe23a=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x3ebad5,_0x39f7c7){var _0x122bd5=function(_0x21214c){while(--_0x21214c){_0x3ebad5['push'](_0x3ebad5['shift']());}};_0x122bd5(++_0x39f7c7);}(_0xe23a,0x168));var _0xae23=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xe23a[_0x15bc81];return _0x59440e;};'use strict';var Sequelize=require(_0xae23('0x0'));module[_0xae23('0x1')]={'priority':{'type':Sequelize[_0xae23('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xae23('0x3')],'allowNull':![],'defaultValue':_0xae23('0x4')},'appdata':{'type':Sequelize[_0xae23('0x5')]()},'description':{'type':Sequelize[_0xae23('0x3')]},'interval':{'type':Sequelize[_0xae23('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd630=['STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x2307f4,_0xb84a6){var _0x20e046=function(_0x8c07f6){while(--_0x8c07f6){_0x2307f4['push'](_0x2307f4['shift']());}};_0x20e046(++_0xb84a6);}(_0xd630,0x157));var _0x0d63=function(_0x5b541f,_0x200bdc){_0x5b541f=_0x5b541f-0x0;var _0x2059e4=_0xd630[_0x5b541f];return _0x2059e4;};'use strict';var Sequelize=require(_0x0d63('0x0'));module[_0x0d63('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0d63('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0d63('0x3')]()},'description':{'type':Sequelize[_0x0d63('0x2')]},'interval':{'type':Sequelize[_0x0d63('0x2')],'defaultValue':_0x0d63('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index bf57b51..ef15550 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 _0x358b=['show','params','rawAttributes','create','body','find','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','stack','name','index','map','SmsApplication','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch'];(function(_0x25086a,_0x2f77cd){var _0x5f4c86=function(_0xa6a136){while(--_0xa6a136){_0x25086a['push'](_0x25086a['shift']());}};_0x5f4c86(++_0x2f77cd);}(_0x358b,0x9c));var _0xb358=function(_0x599428,_0x5878db){_0x599428=_0x599428-0x0;var _0x1c1523=_0x358b[_0x599428];return _0x1c1523;};'use strict';var pdf=require(_0xb358('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb358('0x1'));var zipdir=require(_0xb358('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb358('0x3'));var moment=require(_0xb358('0x4'));var BPromise=require(_0xb358('0x5'));var Mustache=require(_0xb358('0x6'));var util=require(_0xb358('0x7'));var path=require(_0xb358('0x8'));var sox=require(_0xb358('0x9'));var csv=require(_0xb358('0xa'));var ejs=require(_0xb358('0xb'));var fs=require('fs');var _=require(_0xb358('0xc'));var squel=require('squel');var crypto=require(_0xb358('0xd'));var jsforce=require(_0xb358('0xe'));var deskjs=require(_0xb358('0xf'));var toCsv=require(_0xb358('0xa'));var querystring=require(_0xb358('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb358('0x11'));var qs=require(_0xb358('0x12'));var as=require(_0xb358('0x13'));var hardwareService=require(_0xb358('0x14'));var logger=require(_0xb358('0x15'))(_0xb358('0x16'));var utils=require(_0xb358('0x17'));var config=require(_0xb358('0x18'));var db=require(_0xb358('0x19'))['db'];function respondWithStatusCode(_0x18dc76,_0x19c04b){_0x19c04b=_0x19c04b||0xcc;return function(_0x44a9b2){if(_0x44a9b2){return _0x18dc76[_0xb358('0x1a')](_0x19c04b);}return _0x18dc76[_0xb358('0x1b')](_0x19c04b)['end']();};}function respondWithResult(_0x3b18d3,_0x38fa8f){_0x38fa8f=_0x38fa8f||0xc8;return function(_0x349fc8){if(_0x349fc8){return _0x3b18d3[_0xb358('0x1b')](_0x38fa8f)[_0xb358('0x1c')](_0x349fc8);}};}function respondWithFilteredResult(_0x3bb68d,_0x2334b0){return function(_0x55122f){if(_0x55122f){var _0xe5a4a1=_0x55122f[_0xb358('0x1d')],_0x1dae1c=_0x2334b0[_0xb358('0x1e')],_0x3aa756=_0x2334b0['offset']+_0x2334b0[_0xb358('0x1f')],_0x46ffb8;if(_0x3aa756>=_0xe5a4a1){_0x3aa756=_0xe5a4a1;_0x46ffb8=0xc8;}else{_0x46ffb8=0xce;}_0x3bb68d[_0xb358('0x1b')](_0x46ffb8);return _0x3bb68d[_0xb358('0x20')]('Content-Range',_0x1dae1c+'-'+_0x3aa756+'/'+_0xe5a4a1)[_0xb358('0x1c')](_0x55122f);}return null;};}function patchUpdates(_0x10f34b){return function(_0x3bf155){try{jsonpatch[_0xb358('0x21')](_0x3bf155,_0x10f34b,!![]);}catch(_0x4e786f){return BPromise[_0xb358('0x22')](_0x4e786f);}return _0x3bf155[_0xb358('0x23')]();};}function saveUpdates(_0x18175f,_0x3c0c2c){return function(_0x288de1){if(_0x288de1){return _0x288de1[_0xb358('0x24')](_0x18175f)[_0xb358('0x25')](function(_0x1269bd){return _0x1269bd;});}return null;};}function removeEntity(_0x36612f,_0x4a211c){return function(_0x35f331){if(_0x35f331){return _0x35f331[_0xb358('0x26')]()['then'](function(){_0x36612f['status'](0xcc)[_0xb358('0x27')]();});}};}function handleEntityNotFound(_0x65619d,_0x4f2137){return function(_0x1afd6e){if(!_0x1afd6e){_0x65619d[_0xb358('0x1a')](0x194);}return _0x1afd6e;};}function handleError(_0x35dd3c,_0x908427){_0x908427=_0x908427||0x1f4;return function(_0x4d6566){logger['error'](_0x4d6566[_0xb358('0x28')]);if(_0x4d6566[_0xb358('0x29')]){delete _0x4d6566[_0xb358('0x29')];}_0x35dd3c[_0xb358('0x1b')](_0x908427)['send'](_0x4d6566);};}exports[_0xb358('0x2a')]=function(_0x4e9cb6,_0x4b976a){var _0x424bd5={},_0x266bf9={},_0x433d6d={'count':0x0,'rows':[]};var _0x423cc2=_[_0xb358('0x2b')](db[_0xb358('0x2c')]['rawAttributes'],function(_0xebaad6){return{'name':_0xebaad6['fieldName'],'type':_0xebaad6[_0xb358('0x2d')][_0xb358('0x2e')]};});_0x266bf9['model']=_[_0xb358('0x2b')](_0x423cc2,_0xb358('0x29'));_0x266bf9[_0xb358('0x2f')]=_[_0xb358('0x30')](_0x4e9cb6['query']);_0x266bf9[_0xb358('0x31')]=_['intersection'](_0x266bf9[_0xb358('0x32')],_0x266bf9[_0xb358('0x2f')]);_0x424bd5[_0xb358('0x33')]=_[_0xb358('0x34')](_0x266bf9[_0xb358('0x32')],qs[_0xb358('0x35')](_0x4e9cb6[_0xb358('0x2f')][_0xb358('0x35')]));_0x424bd5[_0xb358('0x33')]=_0x424bd5[_0xb358('0x33')][_0xb358('0x36')]?_0x424bd5[_0xb358('0x33')]:_0x266bf9[_0xb358('0x32')];if(!_0x4e9cb6[_0xb358('0x2f')][_0xb358('0x37')](_0xb358('0x38'))){_0x424bd5[_0xb358('0x1f')]=qs[_0xb358('0x1f')](_0x4e9cb6[_0xb358('0x2f')]['limit']);_0x424bd5[_0xb358('0x1e')]=qs['offset'](_0x4e9cb6[_0xb358('0x2f')][_0xb358('0x1e')]);}_0x424bd5['order']=qs[_0xb358('0x39')](_0x4e9cb6[_0xb358('0x2f')][_0xb358('0x39')]);_0x424bd5[_0xb358('0x3a')]=qs[_0xb358('0x31')](_[_0xb358('0x3b')](_0x4e9cb6[_0xb358('0x2f')],_0x266bf9[_0xb358('0x31')]));if(_0x4e9cb6[_0xb358('0x2f')]['filter']){_0x424bd5[_0xb358('0x3a')]=_[_0xb358('0x3c')](_0x424bd5[_0xb358('0x3a')],{'$or':_['map'](_0x423cc2,function(_0x3bd958){if(_0x3bd958[_0xb358('0x2d')]!==_0xb358('0x3d')){var _0x1c294f={};_0x1c294f[_0x3bd958['name']]={'$like':'%'+_0x4e9cb6[_0xb358('0x2f')][_0xb358('0x3e')]+'%'};return _0x1c294f;}})});}_0x424bd5=_[_0xb358('0x3c')]({},_0x424bd5,_0x4e9cb6[_0xb358('0x3f')]);var _0x533837={'where':_0x424bd5[_0xb358('0x3a')]};return db[_0xb358('0x2c')]['count'](_0x533837)['then'](function(_0xfda463){_0x433d6d[_0xb358('0x1d')]=_0xfda463;if(_0x4e9cb6[_0xb358('0x2f')][_0xb358('0x40')]){_0x424bd5[_0xb358('0x41')]=[{'all':!![]}];}return db['SmsApplication'][_0xb358('0x42')](_0x424bd5);})[_0xb358('0x25')](function(_0x137cc7){_0x433d6d[_0xb358('0x43')]=_0x137cc7;return _0x433d6d;})[_0xb358('0x25')](respondWithFilteredResult(_0x4b976a,_0x424bd5))[_0xb358('0x44')](handleError(_0x4b976a,null));};exports[_0xb358('0x45')]=function(_0x5adbfb,_0x512331){var _0x5134d7={'raw':!![],'where':{'id':_0x5adbfb[_0xb358('0x46')]['id']}},_0x674380={};_0x674380[_0xb358('0x32')]=_[_0xb358('0x30')](db['SmsApplication'][_0xb358('0x47')]);_0x674380['query']=_[_0xb358('0x30')](_0x5adbfb[_0xb358('0x2f')]);_0x674380['filters']=_[_0xb358('0x34')](_0x674380[_0xb358('0x32')],_0x674380[_0xb358('0x2f')]);_0x5134d7[_0xb358('0x33')]=_[_0xb358('0x34')](_0x674380[_0xb358('0x32')],qs[_0xb358('0x35')](_0x5adbfb[_0xb358('0x2f')][_0xb358('0x35')]));_0x5134d7['attributes']=_0x5134d7[_0xb358('0x33')][_0xb358('0x36')]?_0x5134d7['attributes']:_0x674380[_0xb358('0x32')];if(_0x5adbfb['query'][_0xb358('0x40')]){_0x5134d7[_0xb358('0x41')]=[{'all':!![]}];}_0x5134d7=_['merge']({},_0x5134d7,_0x5adbfb[_0xb358('0x3f')]);return db['SmsApplication']['find'](_0x5134d7)['then'](handleEntityNotFound(_0x512331,null))[_0xb358('0x25')](respondWithResult(_0x512331,null))['catch'](handleError(_0x512331,null));};exports[_0xb358('0x48')]=function(_0x4905c7,_0x31e948){return db['SmsApplication']['create'](_0x4905c7['body'],{})[_0xb358('0x25')](respondWithResult(_0x31e948,0xc9))[_0xb358('0x44')](handleError(_0x31e948,null));};exports[_0xb358('0x24')]=function(_0x37f763,_0x2f4e52){if(_0x37f763[_0xb358('0x49')]['id']){delete _0x37f763[_0xb358('0x49')]['id'];}return db['SmsApplication'][_0xb358('0x4a')]({'where':{'id':_0x37f763['params']['id']}})[_0xb358('0x25')](handleEntityNotFound(_0x2f4e52,null))[_0xb358('0x25')](saveUpdates(_0x37f763[_0xb358('0x49')],null))[_0xb358('0x25')](respondWithResult(_0x2f4e52,null))[_0xb358('0x44')](handleError(_0x2f4e52,null));};exports[_0xb358('0x26')]=function(_0x3827f6,_0x18fdd0){return db[_0xb358('0x2c')]['find']({'where':{'id':_0x3827f6[_0xb358('0x46')]['id']}})[_0xb358('0x25')](handleEntityNotFound(_0x18fdd0,null))[_0xb358('0x25')](removeEntity(_0x18fdd0,null))[_0xb358('0x44')](handleError(_0x18fdd0,null));}; \ No newline at end of file +var _0xa6fa=['merge','type','VIRTUAL','options','SmsApplication','includeAll','include','findAll','rows','catch','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x45aa73,_0xaed92){var _0x38d922=function(_0x29f718){while(--_0x29f718){_0x45aa73['push'](_0x45aa73['shift']());}};_0x38d922(++_0xaed92);}(_0xa6fa,0xe4));var _0xaa6f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa6fa[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaa6f('0x0'));var rimraf=require(_0xaa6f('0x1'));var zipdir=require(_0xaa6f('0x2'));var jsonpatch=require(_0xaa6f('0x3'));var rp=require(_0xaa6f('0x4'));var moment=require('moment');var BPromise=require(_0xaa6f('0x5'));var Mustache=require(_0xaa6f('0x6'));var util=require(_0xaa6f('0x7'));var path=require('path');var sox=require(_0xaa6f('0x8'));var csv=require('to-csv');var ejs=require(_0xaa6f('0x9'));var fs=require('fs');var _=require(_0xaa6f('0xa'));var squel=require('squel');var crypto=require(_0xaa6f('0xb'));var jsforce=require(_0xaa6f('0xc'));var deskjs=require(_0xaa6f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xaa6f('0xe'));var Papa=require(_0xaa6f('0xf'));var Redis=require(_0xaa6f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xaa6f('0x11'));var as=require(_0xaa6f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa6f('0x13'));var utils=require('../../config/utils');var config=require(_0xaa6f('0x14'));var db=require(_0xaa6f('0x15'))['db'];function respondWithStatusCode(_0xcc9943,_0xdfbd33){_0xdfbd33=_0xdfbd33||0xcc;return function(_0x34d309){if(_0x34d309){return _0xcc9943[_0xaa6f('0x16')](_0xdfbd33);}return _0xcc9943[_0xaa6f('0x17')](_0xdfbd33)[_0xaa6f('0x18')]();};}function respondWithResult(_0x5c099f,_0x397de6){_0x397de6=_0x397de6||0xc8;return function(_0x5b65b9){if(_0x5b65b9){return _0x5c099f[_0xaa6f('0x17')](_0x397de6)[_0xaa6f('0x19')](_0x5b65b9);}};}function respondWithFilteredResult(_0x544323,_0x44bcd4){return function(_0x30889a){if(_0x30889a){var _0x501711=_0x30889a[_0xaa6f('0x1a')],_0x2f5fdd=_0x44bcd4[_0xaa6f('0x1b')],_0x38a53c=_0x44bcd4[_0xaa6f('0x1b')]+_0x44bcd4[_0xaa6f('0x1c')],_0x5ce85a;if(_0x38a53c>=_0x501711){_0x38a53c=_0x501711;_0x5ce85a=0xc8;}else{_0x5ce85a=0xce;}_0x544323['status'](_0x5ce85a);return _0x544323['set'](_0xaa6f('0x1d'),_0x2f5fdd+'-'+_0x38a53c+'/'+_0x501711)['json'](_0x30889a);}return null;};}function patchUpdates(_0x10a42a){return function(_0x133bd8){try{jsonpatch['apply'](_0x133bd8,_0x10a42a,!![]);}catch(_0x30edc6){return BPromise[_0xaa6f('0x1e')](_0x30edc6);}return _0x133bd8['save']();};}function saveUpdates(_0x55c34f,_0x119135){return function(_0x4fad11){if(_0x4fad11){return _0x4fad11[_0xaa6f('0x1f')](_0x55c34f)['then'](function(_0x1b65be){return _0x1b65be;});}return null;};}function removeEntity(_0x122942,_0x3f4c53){return function(_0x2b370d){if(_0x2b370d){return _0x2b370d[_0xaa6f('0x20')]()[_0xaa6f('0x21')](function(){_0x122942['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb062bc,_0x47a85f){return function(_0x17bcd1){if(!_0x17bcd1){_0xb062bc[_0xaa6f('0x16')](0x194);}return _0x17bcd1;};}function handleError(_0x10c5e3,_0x3eb3c9){_0x3eb3c9=_0x3eb3c9||0x1f4;return function(_0x1b45f7){logger[_0xaa6f('0x22')](_0x1b45f7['stack']);if(_0x1b45f7[_0xaa6f('0x23')]){delete _0x1b45f7[_0xaa6f('0x23')];}_0x10c5e3[_0xaa6f('0x17')](_0x3eb3c9)[_0xaa6f('0x24')](_0x1b45f7);};}exports[_0xaa6f('0x25')]=function(_0x36914c,_0x3ad5de){var _0x3c4e9a={},_0x2354e5={},_0x295dc0={'count':0x0,'rows':[]};var _0x38d5d9=_[_0xaa6f('0x26')](db['SmsApplication'][_0xaa6f('0x27')],function(_0x545b6e){return{'name':_0x545b6e[_0xaa6f('0x28')],'type':_0x545b6e['type'][_0xaa6f('0x29')]};});_0x2354e5[_0xaa6f('0x2a')]=_[_0xaa6f('0x26')](_0x38d5d9,'name');_0x2354e5[_0xaa6f('0x2b')]=_['keys'](_0x36914c[_0xaa6f('0x2b')]);_0x2354e5[_0xaa6f('0x2c')]=_[_0xaa6f('0x2d')](_0x2354e5[_0xaa6f('0x2a')],_0x2354e5[_0xaa6f('0x2b')]);_0x3c4e9a['attributes']=_[_0xaa6f('0x2d')](_0x2354e5[_0xaa6f('0x2a')],qs[_0xaa6f('0x2e')](_0x36914c[_0xaa6f('0x2b')][_0xaa6f('0x2e')]));_0x3c4e9a[_0xaa6f('0x2f')]=_0x3c4e9a[_0xaa6f('0x2f')][_0xaa6f('0x30')]?_0x3c4e9a[_0xaa6f('0x2f')]:_0x2354e5[_0xaa6f('0x2a')];if(!_0x36914c[_0xaa6f('0x2b')][_0xaa6f('0x31')](_0xaa6f('0x32'))){_0x3c4e9a[_0xaa6f('0x1c')]=qs[_0xaa6f('0x1c')](_0x36914c['query'][_0xaa6f('0x1c')]);_0x3c4e9a['offset']=qs[_0xaa6f('0x1b')](_0x36914c[_0xaa6f('0x2b')]['offset']);}_0x3c4e9a[_0xaa6f('0x33')]=qs[_0xaa6f('0x34')](_0x36914c[_0xaa6f('0x2b')][_0xaa6f('0x34')]);_0x3c4e9a[_0xaa6f('0x35')]=qs[_0xaa6f('0x2c')](_[_0xaa6f('0x36')](_0x36914c[_0xaa6f('0x2b')],_0x2354e5['filters']));if(_0x36914c[_0xaa6f('0x2b')][_0xaa6f('0x37')]){_0x3c4e9a['where']=_[_0xaa6f('0x38')](_0x3c4e9a[_0xaa6f('0x35')],{'$or':_['map'](_0x38d5d9,function(_0xa34996){if(_0xa34996[_0xaa6f('0x39')]!==_0xaa6f('0x3a')){var _0x2dbb4c={};_0x2dbb4c[_0xa34996[_0xaa6f('0x23')]]={'$like':'%'+_0x36914c[_0xaa6f('0x2b')]['filter']+'%'};return _0x2dbb4c;}})});}_0x3c4e9a=_['merge']({},_0x3c4e9a,_0x36914c[_0xaa6f('0x3b')]);var _0x41b387={'where':_0x3c4e9a[_0xaa6f('0x35')]};return db[_0xaa6f('0x3c')][_0xaa6f('0x1a')](_0x41b387)['then'](function(_0x5327b3){_0x295dc0['count']=_0x5327b3;if(_0x36914c[_0xaa6f('0x2b')][_0xaa6f('0x3d')]){_0x3c4e9a[_0xaa6f('0x3e')]=[{'all':!![]}];}return db[_0xaa6f('0x3c')][_0xaa6f('0x3f')](_0x3c4e9a);})['then'](function(_0x12d759){_0x295dc0[_0xaa6f('0x40')]=_0x12d759;return _0x295dc0;})[_0xaa6f('0x21')](respondWithFilteredResult(_0x3ad5de,_0x3c4e9a))[_0xaa6f('0x41')](handleError(_0x3ad5de,null));};exports['show']=function(_0x38b6ba,_0x45c83){var _0xc08232={'raw':!![],'where':{'id':_0x38b6ba[_0xaa6f('0x42')]['id']}},_0x49fabe={};_0x49fabe[_0xaa6f('0x2a')]=_[_0xaa6f('0x43')](db['SmsApplication'][_0xaa6f('0x27')]);_0x49fabe[_0xaa6f('0x2b')]=_[_0xaa6f('0x43')](_0x38b6ba[_0xaa6f('0x2b')]);_0x49fabe[_0xaa6f('0x2c')]=_[_0xaa6f('0x2d')](_0x49fabe[_0xaa6f('0x2a')],_0x49fabe[_0xaa6f('0x2b')]);_0xc08232[_0xaa6f('0x2f')]=_[_0xaa6f('0x2d')](_0x49fabe[_0xaa6f('0x2a')],qs[_0xaa6f('0x2e')](_0x38b6ba[_0xaa6f('0x2b')][_0xaa6f('0x2e')]));_0xc08232[_0xaa6f('0x2f')]=_0xc08232[_0xaa6f('0x2f')][_0xaa6f('0x30')]?_0xc08232['attributes']:_0x49fabe['model'];if(_0x38b6ba[_0xaa6f('0x2b')][_0xaa6f('0x3d')]){_0xc08232[_0xaa6f('0x3e')]=[{'all':!![]}];}_0xc08232=_[_0xaa6f('0x38')]({},_0xc08232,_0x38b6ba[_0xaa6f('0x3b')]);return db[_0xaa6f('0x3c')][_0xaa6f('0x44')](_0xc08232)[_0xaa6f('0x21')](handleEntityNotFound(_0x45c83,null))[_0xaa6f('0x21')](respondWithResult(_0x45c83,null))[_0xaa6f('0x41')](handleError(_0x45c83,null));};exports[_0xaa6f('0x45')]=function(_0x50d474,_0x2d9044){return db[_0xaa6f('0x3c')]['create'](_0x50d474['body'],{})[_0xaa6f('0x21')](respondWithResult(_0x2d9044,0xc9))[_0xaa6f('0x41')](handleError(_0x2d9044,null));};exports[_0xaa6f('0x1f')]=function(_0x166d10,_0x3c94a7){if(_0x166d10[_0xaa6f('0x46')]['id']){delete _0x166d10['body']['id'];}return db[_0xaa6f('0x3c')][_0xaa6f('0x44')]({'where':{'id':_0x166d10['params']['id']}})[_0xaa6f('0x21')](handleEntityNotFound(_0x3c94a7,null))[_0xaa6f('0x21')](saveUpdates(_0x166d10['body'],null))[_0xaa6f('0x21')](respondWithResult(_0x3c94a7,null))[_0xaa6f('0x41')](handleError(_0x3c94a7,null));};exports[_0xaa6f('0x20')]=function(_0x2e750e,_0x619d4d){return db['SmsApplication'][_0xaa6f('0x44')]({'where':{'id':_0x2e750e[_0xaa6f('0x42')]['id']}})[_0xaa6f('0x21')](handleEntityNotFound(_0x619d4d,null))[_0xaa6f('0x21')](removeEntity(_0x619d4d,null))[_0xaa6f('0x41')](handleError(_0x619d4d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 609cbc0..2ef393a 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 _0x3b31=['lodash','util','../../config/logger','api','moment','path','../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x3b31,0x1d4));var _0x13b3=function(_0x4212c0,_0x2e5159){_0x4212c0=_0x4212c0-0x0;var _0x5c0634=_0x3b31[_0x4212c0];return _0x5c0634;};'use strict';var _=require(_0x13b3('0x0'));var util=require(_0x13b3('0x1'));var logger=require(_0x13b3('0x2'))(_0x13b3('0x3'));var moment=require(_0x13b3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x13b3('0x5'));var rimraf=require('rimraf');var config=require(_0x13b3('0x6'));var attributes=require(_0x13b3('0x7'));module[_0x13b3('0x8')]=function(_0x55c6e3,_0xe65e26){return _0x55c6e3['define'](_0x13b3('0x9'),attributes,{'tableName':_0x13b3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x13b3('0xb'),'collate':_0x13b3('0xc')});}; \ No newline at end of file +var _0x4822=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','utf8mb4','lodash','util'];(function(_0x542419,_0x48b74f){var _0x2cd5df=function(_0x212b55){while(--_0x212b55){_0x542419['push'](_0x542419['shift']());}};_0x2cd5df(++_0x48b74f);}(_0x4822,0x15c));var _0x2482=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x4822[_0x1d50f2];return _0x3769b8;};'use strict';var _=require(_0x2482('0x0'));var util=require(_0x2482('0x1'));var logger=require(_0x2482('0x2'))(_0x2482('0x3'));var moment=require(_0x2482('0x4'));var BPromise=require(_0x2482('0x5'));var rp=require(_0x2482('0x6'));var fs=require('fs');var path=require(_0x2482('0x7'));var rimraf=require(_0x2482('0x8'));var config=require(_0x2482('0x9'));var attributes=require(_0x2482('0xa'));module['exports']=function(_0x30617a,_0x22e558){return _0x30617a[_0x2482('0xb')](_0x2482('0xc'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2482('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 3cf33fc..1c9fe65 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 _0x2070=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird'];(function(_0x88fc4c,_0x1b7ad0){var _0x208f78=function(_0x2247bf){while(--_0x2247bf){_0x88fc4c['push'](_0x88fc4c['shift']());}};_0x208f78(++_0x1b7ad0);}(_0x2070,0x1a2));var _0x0207=function(_0x9be17d,_0x5e1e8e){_0x9be17d=_0x9be17d-0x0;var _0x2b6b3c=_0x2070[_0x9be17d];return _0x2b6b3c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0207('0x0'));var BPromise=require(_0x0207('0x1'));var rs=require(_0x0207('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0207('0x3'))['db'];var utils=require(_0x0207('0x4'));var logger=require('../../config/logger')(_0x0207('0x5'));var config=require(_0x0207('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0207('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e7607,_0x412b15,_0x198c8e){return new BPromise(function(_0x4b88d0,_0x471bd7){return client[_0x0207('0x8')](_0x5e7607,_0x198c8e)['then'](function(_0x29fd26){logger[_0x0207('0x9')](_0x0207('0xa'),_0x412b15,_0x0207('0xb'));logger[_0x0207('0xc')](_0x0207('0xd'),_0x412b15,_0x0207('0xb'),JSON[_0x0207('0xe')](_0x29fd26));if(_0x29fd26[_0x0207('0xf')]){if(_0x29fd26[_0x0207('0xf')][_0x0207('0x10')]===0x1f4){logger[_0x0207('0xf')](_0x0207('0xa'),_0x412b15,_0x29fd26[_0x0207('0xf')]['message']);return _0x471bd7(_0x29fd26[_0x0207('0xf')]['message']);}logger[_0x0207('0xf')](_0x0207('0xa'),_0x412b15,_0x29fd26[_0x0207('0xf')][_0x0207('0x11')]);return _0x4b88d0(_0x29fd26[_0x0207('0xf')]['message']);}else{logger[_0x0207('0x9')](_0x0207('0xa'),_0x412b15,'request\x20sent');_0x4b88d0(_0x29fd26[_0x0207('0x12')][_0x0207('0x11')]);}})[_0x0207('0x13')](function(_0x325eb1){logger['error'](_0x0207('0xa'),_0x412b15,_0x325eb1);_0x471bd7(_0x325eb1);});});} \ No newline at end of file +var _0x0c42=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x41f2f5,_0x14f33c){var _0x3d49f1=function(_0x300207){while(--_0x300207){_0x41f2f5['push'](_0x41f2f5['shift']());}};_0x3d49f1(++_0x14f33c);}(_0x0c42,0x191));var _0x20c4=function(_0x43a41e,_0x1cc3a0){_0x43a41e=_0x43a41e-0x0;var _0x53b7b7=_0x0c42[_0x43a41e];return _0x53b7b7;};'use strict';var _=require(_0x20c4('0x0'));var util=require(_0x20c4('0x1'));var moment=require(_0x20c4('0x2'));var BPromise=require(_0x20c4('0x3'));var rs=require(_0x20c4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x20c4('0x5'));var logger=require(_0x20c4('0x6'))(_0x20c4('0x7'));var config=require(_0x20c4('0x8'));var jayson=require(_0x20c4('0x9'));var client=jayson['client'][_0x20c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c4f94,_0x283d12,_0x5d2014){return new BPromise(function(_0xc29a61,_0x2296a3){return client[_0x20c4('0xb')](_0x4c4f94,_0x5d2014)['then'](function(_0x58ddef){logger[_0x20c4('0xc')](_0x20c4('0xd'),_0x283d12,_0x20c4('0xe'));logger[_0x20c4('0xf')](_0x20c4('0x10'),_0x283d12,_0x20c4('0xe'),JSON[_0x20c4('0x11')](_0x58ddef));if(_0x58ddef[_0x20c4('0x12')]){if(_0x58ddef[_0x20c4('0x12')][_0x20c4('0x13')]===0x1f4){logger[_0x20c4('0x12')](_0x20c4('0xd'),_0x283d12,_0x58ddef['error'][_0x20c4('0x14')]);return _0x2296a3(_0x58ddef['error'][_0x20c4('0x14')]);}logger[_0x20c4('0x12')]('SmsApplication,\x20%s,\x20%s',_0x283d12,_0x58ddef[_0x20c4('0x12')]['message']);return _0xc29a61(_0x58ddef[_0x20c4('0x12')][_0x20c4('0x14')]);}else{logger[_0x20c4('0xc')]('SmsApplication,\x20%s,\x20%s',_0x283d12,_0x20c4('0xe'));_0xc29a61(_0x58ddef[_0x20c4('0x15')][_0x20c4('0x14')]);}})[_0x20c4('0x16')](function(_0x6385ad){logger[_0x20c4('0x12')](_0x20c4('0xd'),_0x283d12,_0x6385ad);_0x2296a3(_0x6385ad);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index fef577b..61ccb6e 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 _0xa8f3=['isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','addTags','put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get'];(function(_0x22257c,_0x58afcd){var _0x59e790=function(_0x313a7e){while(--_0x313a7e){_0x22257c['push'](_0x22257c['shift']());}};_0x59e790(++_0x58afcd);}(_0xa8f3,0xc1));var _0x3a8f=function(_0x3bd1cf,_0xadc76a){_0x3bd1cf=_0x3bd1cf-0x0;var _0x3380b1=_0xa8f3[_0x3bd1cf];return _0x3380b1;};'use strict';var multer=require(_0x3a8f('0x0'));var util=require(_0x3a8f('0x1'));var path=require(_0x3a8f('0x2'));var timeout=require(_0x3a8f('0x3'));var express=require(_0x3a8f('0x4'));var router=express[_0x3a8f('0x5')]();var auth=require(_0x3a8f('0x6'));var interaction=require(_0x3a8f('0x7'));var config=require(_0x3a8f('0x8'));var controller=require(_0x3a8f('0x9'));router[_0x3a8f('0xa')]('/',auth[_0x3a8f('0xb')](),controller[_0x3a8f('0xc')]);router[_0x3a8f('0xa')](_0x3a8f('0xd'),auth[_0x3a8f('0xb')](),controller['describe']);router[_0x3a8f('0xa')](_0x3a8f('0xe'),auth[_0x3a8f('0xb')](),controller[_0x3a8f('0xf')]);router[_0x3a8f('0xa')](_0x3a8f('0x10'),auth[_0x3a8f('0xb')](),controller[_0x3a8f('0x11')]);router[_0x3a8f('0xa')](_0x3a8f('0x12'),auth['isAuthenticated'](),controller[_0x3a8f('0x13')]);router['post']('/',auth[_0x3a8f('0xb')](),controller['create']);router[_0x3a8f('0x14')](_0x3a8f('0x10'),auth[_0x3a8f('0xb')](),controller[_0x3a8f('0x15')]);router['post'](_0x3a8f('0x16'),auth[_0x3a8f('0xb')](),interaction[_0x3a8f('0x17')]('sms','smsinteraction:addtags'),controller[_0x3a8f('0x18')]);router[_0x3a8f('0x19')](_0x3a8f('0xe'),auth[_0x3a8f('0xb')](),interaction[_0x3a8f('0x17')](_0x3a8f('0x1a'),_0x3a8f('0x1b')),controller[_0x3a8f('0x1c')]);router[_0x3a8f('0x1d')](_0x3a8f('0xe'),auth[_0x3a8f('0xb')](),interaction[_0x3a8f('0x17')](_0x3a8f('0x1a'),_0x3a8f('0x1e')),controller[_0x3a8f('0x1f')]);router[_0x3a8f('0x1d')](_0x3a8f('0x16'),auth[_0x3a8f('0xb')](),controller[_0x3a8f('0x20')]);module[_0x3a8f('0x21')]=router; \ No newline at end of file +var _0x52a1=['destroy','delete','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','getMessages','download','post','create','addMessage','tracked','smsinteraction:addtags','put','/:id','sms','smsinteraction:update','update','smsinteraction:destroy'];(function(_0x46ce21,_0x254327){var _0x4901ba=function(_0x528f1c){while(--_0x528f1c){_0x46ce21['push'](_0x46ce21['shift']());}};_0x4901ba(++_0x254327);}(_0x52a1,0x1b7));var _0x152a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x52a1[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x152a('0x0'));var util=require(_0x152a('0x1'));var path=require(_0x152a('0x2'));var timeout=require(_0x152a('0x3'));var express=require(_0x152a('0x4'));var router=express[_0x152a('0x5')]();var auth=require(_0x152a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x152a('0x7'));var controller=require('./smsInteraction.controller');router[_0x152a('0x8')]('/',auth[_0x152a('0x9')](),controller[_0x152a('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x152a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x152a('0xb')]);router[_0x152a('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0x152a('0xc')]);router[_0x152a('0x8')]('/:id/download',auth[_0x152a('0x9')](),controller[_0x152a('0xd')]);router[_0x152a('0xe')]('/',auth[_0x152a('0x9')](),controller[_0x152a('0xf')]);router[_0x152a('0xe')]('/:id/messages',auth[_0x152a('0x9')](),controller[_0x152a('0x10')]);router[_0x152a('0xe')]('/:id/tags',auth[_0x152a('0x9')](),interaction[_0x152a('0x11')]('sms',_0x152a('0x12')),controller['addTags']);router[_0x152a('0x13')](_0x152a('0x14'),auth[_0x152a('0x9')](),interaction[_0x152a('0x11')](_0x152a('0x15'),_0x152a('0x16')),controller[_0x152a('0x17')]);router['delete'](_0x152a('0x14'),auth[_0x152a('0x9')](),interaction['tracked'](_0x152a('0x15'),_0x152a('0x18')),controller[_0x152a('0x19')]);router[_0x152a('0x1a')](_0x152a('0x1b'),auth[_0x152a('0x9')](),controller[_0x152a('0x1c')]);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 93675f8..f58aa9d 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['moment','exports','STRING','DATE','ENUM','out'];(function(_0x20b9fc,_0x5dab92){var _0x511a2b=function(_0x292cbd){while(--_0x292cbd){_0x20b9fc['push'](_0x20b9fc['shift']());}};_0x511a2b(++_0x5dab92);}(_0x757a,0xde));var _0xa757=function(_0x547c52,_0x37c1a4){_0x547c52=_0x547c52-0x0;var _0xb44928=_0x757a[_0x547c52];return _0xb44928;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa757('0x0'));module[_0xa757('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa757('0x2')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'read1stAt':{'type':Sequelize[_0xa757('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa757('0x4')]('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa757('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xd8b0=['moment','STRING','DATE','ENUM','out','sequelize'];(function(_0x111d14,_0x314768){var _0x1f451d=function(_0x3db9e5){while(--_0x3db9e5){_0x111d14['push'](_0x111d14['shift']());}};_0x1f451d(++_0x314768);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'note':{'type':Sequelize[_0x0d8b('0x2')]},'phone':{'type':Sequelize[_0x0d8b('0x2')]},'read1stAt':{'type':Sequelize[_0x0d8b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in',_0x0d8b('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 35f2f05..a1e6a75 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 _0xa30a=['../../mysqldb','defaults','redis','localhost','./smsInteraction.socket','register','sendStatus','status','end','offset','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','SmsInteraction','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','field','color','from','tools_tags','select','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','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','search','parseSearch','conditions','length','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','$substring','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','type','start','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','$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','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','count','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','push','all','rows','catch','show','params','create','update','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','addTags','spread','emit','removeTags','unix','join','root','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','createdAt','direction','SmsAccount','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','Account','Owner','N.A.','closed','closedAt','out','secret','renderFile','server','downloadInteraction.html','toFile','transcript-','download','log','err','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xaa30('0x0'));var emlformat=require(_0xaa30('0x1'));var rimraf=require(_0xaa30('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa30('0x3'));var rp=require(_0xaa30('0x4'));var moment=require(_0xaa30('0x5'));var BPromise=require(_0xaa30('0x6'));var Mustache=require(_0xaa30('0x7'));var util=require(_0xaa30('0x8'));var path=require(_0xaa30('0x9'));var sox=require('sox');var csv=require(_0xaa30('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xa'));var querystring=require(_0xaa30('0xf'));var Papa=require(_0xaa30('0x10'));var Redis=require(_0xaa30('0x11'));var authService=require(_0xaa30('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x13'));var logger=require('../../config/logger')(_0xaa30('0x14'));var utils=require(_0xaa30('0x15'));var config=require(_0xaa30('0x16'));var db=require(_0xaa30('0x17'))['db'];config['redis']=_[_0xaa30('0x18')](config[_0xaa30('0x19')],{'host':_0xaa30('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa30('0x19')]));require(_0xaa30('0x1b'))[_0xaa30('0x1c')](socket);function respondWithStatusCode(_0x14de74,_0x41f1d9){_0x41f1d9=_0x41f1d9||0xcc;return function(_0x31aa0b){if(_0x31aa0b){return _0x14de74[_0xaa30('0x1d')](_0x41f1d9);}return _0x14de74[_0xaa30('0x1e')](_0x41f1d9)[_0xaa30('0x1f')]();};}function respondWithResult(_0xfae724,_0x519518){_0x519518=_0x519518||0xc8;return function(_0x91839d){if(_0x91839d){return _0xfae724['status'](_0x519518)['json'](_0x91839d);}};}function respondWithFilteredResult(_0x3247ea,_0x153939){return function(_0x130606){if(_0x130606){var _0x540e36=_0x130606['count'],_0x54fa49=_0x153939[_0xaa30('0x20')],_0x53f9fd=_0x153939[_0xaa30('0x20')]+_0x153939['limit'],_0x23ad3b;if(_0x53f9fd>=_0x540e36){_0x53f9fd=_0x540e36;_0x23ad3b=0xc8;}else{_0x23ad3b=0xce;}_0x3247ea['status'](_0x23ad3b);return _0x3247ea['set'](_0xaa30('0x21'),_0x54fa49+'-'+_0x53f9fd+'/'+_0x540e36)[_0xaa30('0x22')](_0x130606);}return null;};}function patchUpdates(_0x61b85){return function(_0x35ec07){try{jsonpatch[_0xaa30('0x23')](_0x35ec07,_0x61b85,!![]);}catch(_0x4aacfd){return BPromise[_0xaa30('0x24')](_0x4aacfd);}return _0x35ec07[_0xaa30('0x25')]();};}function saveUpdates(_0x2e16e7,_0x2d9e35){return function(_0x1ff442){if(_0x1ff442){return _0x1ff442['update'](_0x2e16e7)[_0xaa30('0x26')](function(_0x13128a){return _0x13128a;});}return null;};}function removeEntity(_0x2fecdd,_0x326f84){return function(_0x57d1ca){if(_0x57d1ca){return _0x57d1ca[_0xaa30('0x27')]()[_0xaa30('0x26')](function(){_0x2fecdd[_0xaa30('0x1e')](0xcc)[_0xaa30('0x1f')]();});}};}function handleEntityNotFound(_0x97b038,_0x2a59ce){return function(_0x55cccb){if(!_0x55cccb){_0x97b038[_0xaa30('0x1d')](0x194);}return _0x55cccb;};}function handleError(_0x465701,_0x5d4da8){_0x5d4da8=_0x5d4da8||0x1f4;return function(_0xb043e4){logger['error'](_0xb043e4[_0xaa30('0x28')]);if(_0xb043e4[_0xaa30('0x29')]){delete _0xb043e4[_0xaa30('0x29')];}_0x465701[_0xaa30('0x1e')](_0x5d4da8)[_0xaa30('0x2a')](_0xb043e4);};}function getInteractionUsers(_0xc10b8f,_0x6ff09a){return new BPromise(function(_0x39f708,_0x1f288c){try{if(_0x6ff09a[_0xc10b8f['id']]){_0xc10b8f[_0xaa30('0x2b')]=_[_0xaa30('0x2c')](_0x6ff09a[_0xc10b8f['id']],function(_0x43003f){return{'id':_0x43003f['id'],'fullname':_0x43003f[_0xaa30('0x2d')]};});}}catch(_0x46abb9){_0x1f288c(_0x46abb9);}_0x39f708(_0xc10b8f);});}function getInteractionTags(_0x40e4ee,_0x1a3f64){return new BPromise(function(_0x230d56,_0x1fa8d4){try{if(_0x40e4ee['TagIds']){_0x40e4ee[_0xaa30('0x2e')]=[];_0x40e4ee[_0xaa30('0x2f')][_0xaa30('0x30')](',')[_0xaa30('0x31')](function(_0x2276e0){_0x40e4ee[_0xaa30('0x2e')]['push'](_0x1a3f64[_0x2276e0]);});}delete _0x40e4ee['TagIds'];}catch(_0x5b99ca){_0x1fa8d4(_0x5b99ca);}_0x230d56(_0x40e4ee);});}function updateSmsInteraction(_0x30909a,_0x407090,_0xb48ef3){return new BPromise(function(_0x198595,_0x1d6d83){return getInteractionUsers(_0x30909a,_0xb48ef3)['then'](function(_0x499af0){return getInteractionTags(_0x499af0,_0x407090);})[_0xaa30('0x26')](function(_0x2d26fb){_0x198595(_0x2d26fb);})['catch'](function(_0xc81d7e){_0x1d6d83(_0xc81d7e);});});}exports['index']=function(_0x3ca2b5,_0x5241d2){var _0x2ae4ed={},_0x18e702={},_0x59bda6={'count':0x0,'rows':[]};var _0x167a66=_[_0xaa30('0x2c')](db[_0xaa30('0x32')][_0xaa30('0x33')],function(_0x285b68){return{'name':_0x285b68[_0xaa30('0x34')],'type':_0x285b68['type'][_0xaa30('0x35')]};});_0x18e702[_0xaa30('0x36')]=_['map'](_0x167a66,_0xaa30('0x29'));_0x18e702[_0xaa30('0x37')]=_[_0xaa30('0x38')](_0x3ca2b5['query']);_0x18e702['filters']=_[_0xaa30('0x39')](_0x18e702[_0xaa30('0x36')],_0x18e702[_0xaa30('0x37')]);_0x2ae4ed[_0xaa30('0x3a')]=_[_0xaa30('0x39')](_0x18e702[_0xaa30('0x36')],qs['fields'](_0x3ca2b5['query'][_0xaa30('0x3b')]));_0x2ae4ed[_0xaa30('0x3a')]=_0x2ae4ed[_0xaa30('0x3a')]['length']?_0x2ae4ed[_0xaa30('0x3a')]:_0x18e702[_0xaa30('0x36')];if(!_0x3ca2b5[_0xaa30('0x37')][_0xaa30('0x3c')]('nolimit')){_0x2ae4ed[_0xaa30('0x3d')]=qs[_0xaa30('0x3d')](_0x3ca2b5[_0xaa30('0x37')][_0xaa30('0x3d')]);_0x2ae4ed[_0xaa30('0x20')]=qs['offset'](_0x3ca2b5[_0xaa30('0x37')][_0xaa30('0x20')]);}_0x2ae4ed[_0xaa30('0x3e')]=qs[_0xaa30('0x3f')](_0x3ca2b5[_0xaa30('0x37')][_0xaa30('0x3f')]);_0x2ae4ed[_0xaa30('0x40')]=qs[_0xaa30('0x41')](_['pick'](_0x3ca2b5['query'],_0x18e702[_0xaa30('0x41')]));var _0x4a170a=[];var _0x5208f8=squel['select']()[_0xaa30('0x42')]('id')['field'](_0xaa30('0x29'))['field'](_0xaa30('0x43'))[_0xaa30('0x44')](_0xaa30('0x45'));var _0x30c5a3=squel[_0xaa30('0x46')]()[_0xaa30('0x42')](_0xaa30('0x47'))[_0xaa30('0x42')](_0xaa30('0x48'))[_0xaa30('0x42')](_0xaa30('0x49'))['from'](_0xaa30('0x4a'),'ui')[_0xaa30('0x4b')](_0xaa30('0x4c'),'u',_0xaa30('0x4d'));var _0x193084=squel['select']()['from'](_0xaa30('0x4e'),'i')['left_join'](_0xaa30('0x4f'),'c',_0xaa30('0x50'))[_0xaa30('0x4b')](_0xaa30('0x4c'),'o',_0xaa30('0x51'))[_0xaa30('0x4b')](_0xaa30('0x52'),'a','a.id\x20=\x20i.SmsAccountId')[_0xaa30('0x4b')](_0xaa30('0x53'),'me',_0xaa30('0x54'))['left_join'](_0xaa30('0x55'),'it',_0xaa30('0x56'))['left_join'](_0xaa30('0x45'),'t','t.id\x20=\x20it.TagId');var _0x25d227=squel['expr']();var _0x4b68d5=[];var _0x18bb68=squel['expr']();var _0x56389c;if(_0x3ca2b5[_0xaa30('0x37')][_0xaa30('0x57')]){_0x56389c=as[_0xaa30('0x58')](_0x3ca2b5[_0xaa30('0x37')][_0xaa30('0x57')]);var _0x31131d=_0x56389c['sqlOperator'];for(var _0x17d75d=0x0;_0x17d75d<_0x56389c[_0xaa30('0x59')][_0xaa30('0x5a')];_0x17d75d++){var _0x57a5fa=_0x56389c['conditions'][_0x17d75d];var _0x4e3fde='i';var _0x57d7ad=_[_0xaa30('0x5b')](_0x167a66,[_0xaa30('0x29'),_0x57a5fa[_0xaa30('0x42')]]);if(!_0x57d7ad){switch(_0x57a5fa[_0xaa30('0x42')]){case _0xaa30('0x5c'):if(_0x57a5fa[_0xaa30('0x5d')]==0x1){_0x193084['having']('`'+_0x57a5fa[_0xaa30('0x42')]+_0xaa30('0x5e'));}else{_0x193084[_0xaa30('0x5f')]('`'+_0x57a5fa[_0xaa30('0x42')]+'`\x20>\x200');}break;case _0xaa30('0x60'):if(_0x57a5fa[_0xaa30('0x61')]===_0xaa30('0x62')){if(_0x57a5fa[_0xaa30('0x5d')][_0xaa30('0x30')]('\x20')['length']>0x1){_0x25d227[_0x31131d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xaa30('0x63')](_0x57a5fa[_0xaa30('0x5d')]),null);}else{var _0x3c4f07='%'+_0x57a5fa['value']+'%';_0x25d227[_0x31131d](_0xaa30('0x64'),_0x3c4f07,_0x3c4f07,_0x3c4f07);}}else{_0x57d7ad=_['find'](_0x167a66,[_0xaa30('0x29'),_0xaa30('0x65')]);_0x57a5fa['field']=_0xaa30('0x65');_0x2cbea3=as[_0xaa30('0x66')](_0x4e3fde,_0x57d7ad['type'],_0x57a5fa);_0x25d227[_0x31131d](_0x2cbea3[_0xaa30('0x67')],_0x2cbea3['value']['start'],_0x2cbea3[_0xaa30('0x5d')][_0xaa30('0x1f')]);}break;case _0xaa30('0x68'):var _0x5a85aa=_0x57a5fa[_0xaa30('0x5d')][_0xaa30('0x30')](',')[_0xaa30('0x2c')](function(_0x949d84){return Number(_0x949d84);});_0x5a85aa[_0xaa30('0x31')](function(_0x25686d){_0x18bb68['or'](_0xaa30('0x69'),'%,'+_0x25686d+',%');});_0x4b68d5=_[_0xaa30('0x6a')](_0x4b68d5,_0x5a85aa);break;case _0xaa30('0x6b'):if(_0x57a5fa[_0xaa30('0x61')]===_0xaa30('0x62')){_0x25d227[_0x31131d](_0xaa30('0x6c'),'%'+_0x57a5fa[_0xaa30('0x5d')]+'%',null);}else{_0x57d7ad=_['find'](_0x167a66,[_0xaa30('0x29'),_0xaa30('0x6d')]);_0x57a5fa[_0xaa30('0x42')]='UserId';_0x2cbea3=as[_0xaa30('0x66')](_0x4e3fde,_0x57d7ad[_0xaa30('0x6e')],_0x57a5fa);_0x25d227[_0x31131d](_0x2cbea3[_0xaa30('0x67')],_0x2cbea3[_0xaa30('0x5d')][_0xaa30('0x6f')],_0x2cbea3[_0xaa30('0x5d')]['end']);}break;case _0xaa30('0x70'):_0x2cbea3=as['buildExpression']('me',null,_0x57a5fa);_0x25d227[_0x31131d](_0x2cbea3[_0xaa30('0x67')],_0x2cbea3[_0xaa30('0x5d')][_0xaa30('0x6f')],_0x2cbea3[_0xaa30('0x5d')]['end']);break;}}else{var _0x2cbea3=as[_0xaa30('0x66')](_0x4e3fde,_0x57d7ad['type'],_0x57a5fa);_0x25d227[_0x31131d](_0x2cbea3[_0xaa30('0x67')],_0x2cbea3[_0xaa30('0x5d')][_0xaa30('0x6f')],_0x2cbea3[_0xaa30('0x5d')][_0xaa30('0x1f')]);}}}else{var _0x13ee8f=_(_0x3ca2b5['query'])[_0xaa30('0x38')]()[_0xaa30('0x2c')](function(_0x3a8bdc){return _[_0xaa30('0x71')](_0x167a66,[_0xaa30('0x29'),_0x3a8bdc])?_0x3a8bdc:undefined;})[_0xaa30('0x72')]()[_0xaa30('0x5d')]();if(!_[_0xaa30('0x73')](_0x13ee8f)){_0x13ee8f[_0xaa30('0x31')](function(_0x6c968e){if(_0x6c968e===_0xaa30('0x74')){_0x193084[_0xaa30('0x40')](_0xaa30('0x75'),[]['concat'](_0x3ca2b5[_0xaa30('0x37')][_0x6c968e]));}else if(_0x6c968e==='createdAt'){var _0x1c1249=JSON['parse'](_0x3ca2b5[_0xaa30('0x37')][_0x6c968e])[_0xaa30('0x76')];var _0x211a83=JSON['parse'](_0x3ca2b5[_0xaa30('0x37')][_0x6c968e])[_0xaa30('0x77')];_0x193084['where'](_0xaa30('0x78'),_0x1c1249,_0x211a83);}else{if(_0x3ca2b5['query'][_0x6c968e]===_0xaa30('0x79')){_0x193084['where']('i.'+_0x6c968e+'\x20IS\x20NULL');}else{_0x193084[_0xaa30('0x40')]('i.'+_0x6c968e+_0xaa30('0x7a'),_0x3ca2b5[_0xaa30('0x37')][_0x6c968e]);}}});}if(_0x3ca2b5[_0xaa30('0x37')][_0xaa30('0x7b')]){if(_0x3ca2b5[_0xaa30('0x37')][_0xaa30('0x7b')]==0x1){_0x193084['having'](_0xaa30('0x7c'));}else{_0x193084[_0xaa30('0x5f')](_0xaa30('0x7d'));}}if(_0x3ca2b5['query'][_0xaa30('0x7e')]){_0x4b68d5=_[_0xaa30('0x7f')](_0x3ca2b5[_0xaa30('0x37')]['tag'])?_0x3ca2b5[_0xaa30('0x37')]['tag']:new Array(_0x3ca2b5[_0xaa30('0x37')]['tag']);_0x4b68d5['forEach'](function(_0x30f9bc){_0x18bb68['or'](_0xaa30('0x69'),'%,'+_0x30f9bc+',%');});}if(_0x3ca2b5['query'][_0xaa30('0x80')]){var _0x3d822e=_0x3ca2b5[_0xaa30('0x37')]['filter'][_0xaa30('0x81')]('\x5c','\x5c\x5c')[_0xaa30('0x81')]('\x27\x27',_0xaa30('0x82'));if(qs[_0xaa30('0x83')](_0x3d822e)){_0x25d227['or'](_0xaa30('0x84'),_0x3d822e+'%')['or'](_0xaa30('0x85'),_0x3d822e+'%');}else{_0x25d227['or'](_0xaa30('0x86'),qs['getFullTextValue'](_0x3d822e))['or'](_0xaa30('0x87'),_0x3d822e+'%');}}}_0x193084[_0xaa30('0x40')](_0x25d227);_0x193084[_0xaa30('0x88')](_0xaa30('0x89'));var _0x5895d4={'type':db[_0xaa30('0x8a')][_0xaa30('0x8b')]['SELECT'],'raw':!![]};var _0x3286d9=_0x193084[_0xaa30('0x8c')]();_0x3286d9[_0xaa30('0x42')](_0xaa30('0x89'));_0x3286d9[_0xaa30('0x42')](_0xaa30('0x8d'),'unreadMessages');if(_0x2ae4ed[_0xaa30('0x3e')]){_0x2ae4ed[_0xaa30('0x3e')]['forEach'](function(_0x2aa0ce){_0x193084[_0xaa30('0x3e')]('i.'+_0x2aa0ce[0x0],_0x2aa0ce[0x1]===_0xaa30('0x8e')?![]:!![]);});}if(!_[_0xaa30('0x73')](_0x4b68d5)){_0x193084[_0xaa30('0x5f')](_0x18bb68);_0x3286d9['where'](_0xaa30('0x8f'),_0x4b68d5);}BPromise[_0xaa30('0x90')]()[_0xaa30('0x26')](function(){if(!_0x56389c){if(_0x3ca2b5[_0xaa30('0x37')][_0xaa30('0x74')]||_0x3ca2b5[_0xaa30('0x37')]['journey'])return;_0x3286d9[_0xaa30('0x40')](_0xaa30('0x91'));_0x193084['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3ca2b5[_0xaa30('0x92')][_0xaa30('0x93')]({'attributes':['id'],'raw':!![]})[_0xaa30('0x26')](function(_0x100f18){if(_[_0xaa30('0x73')](_0x100f18)){_0x3286d9[_0xaa30('0x40')](_0xaa30('0x94'));_0x193084['where']('i.SmsAccountId\x20IS\x20NULL');}else{_0x3286d9['where'](_0xaa30('0x75'),_[_0xaa30('0x2c')](_0x100f18,'id'));_0x193084[_0xaa30('0x40')](_0xaa30('0x75'),_[_0xaa30('0x2c')](_0x100f18,'id'));}});})['then'](function(){db[_0xaa30('0x95')][_0xaa30('0x37')](_0x3286d9[_0xaa30('0x96')](),_0x5895d4)[_0xaa30('0x26')](function(_0x37af47){_0x59bda6[_0xaa30('0x97')]=_0x37af47[_0xaa30('0x5a')];if(_0x59bda6[_0xaa30('0x97')]===0x0)return[];return db['sequelize']['query'](_0x5208f8['toString'](),_0x5895d4)[_0xaa30('0x26')](function(_0x408362){_0x4a170a=_['keyBy'](_0x408362,'id');_0x5895d4=_[_0xaa30('0x98')](_0x5895d4,{'model':db[_0xaa30('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3ca2b5[_0xaa30('0x37')][_0xaa30('0x3b')]){_0x2ae4ed[_0xaa30('0x3a')]['forEach'](function(_0x3b8877){_0x193084[_0xaa30('0x42')]('i.'+_0x3b8877);});}else{_0x193084[_0xaa30('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xaa30('0x5c'));_0x193084[_0xaa30('0x42')](_0xaa30('0x99'),_0xaa30('0x9a'));_0x193084[_0xaa30('0x42')](_0xaa30('0x9b'),_0xaa30('0x9c'));_0x193084['field'](_0xaa30('0x9d'));_0x193084[_0xaa30('0x42')](_0xaa30('0x9e'),_0xaa30('0x9f'));_0x193084[_0xaa30('0x42')](_0xaa30('0xa0'),_0xaa30('0xa1'));_0x193084[_0xaa30('0x42')](_0xaa30('0xa2'),_0xaa30('0xa3'));_0x193084[_0xaa30('0x42')](_0xaa30('0xa4'),_0xaa30('0xa5'));_0x193084['field'](_0xaa30('0xa6'),'Contact.mobile');_0x193084[_0xaa30('0x42')](_0xaa30('0xa7'),_0xaa30('0xa8'));_0x193084[_0xaa30('0x42')](_0xaa30('0xa9'),_0xaa30('0xaa'));_0x193084[_0xaa30('0x42')](_0xaa30('0xab'),_0xaa30('0xac'));_0x193084[_0xaa30('0x42')](_0xaa30('0xad'),_0xaa30('0x2f'));}_0x193084[_0xaa30('0x3d')](_0x2ae4ed[_0xaa30('0x3d')]);_0x193084[_0xaa30('0x20')](_0x2ae4ed[_0xaa30('0x20')]);return db[_0xaa30('0x95')][_0xaa30('0x37')](_0x193084[_0xaa30('0x96')](),_0x5895d4);})['then'](function(_0x42987d){_0x30c5a3[_0xaa30('0x40')](_0xaa30('0xae'),_[_0xaa30('0x2c')](_0x42987d,'id'));return db[_0xaa30('0x95')][_0xaa30('0x37')](_0x30c5a3[_0xaa30('0x96')](),_0x5895d4)['then'](function(_0x60869b){var _0xee37e5=_['groupBy'](_0x60869b,_0xaa30('0xaf'));var _0x73408e=[];_0x42987d['forEach'](function(_0xfd5bf1){_0x73408e[_0xaa30('0xb0')](updateSmsInteraction(_0xfd5bf1,_0x4a170a,_0xee37e5));});return BPromise[_0xaa30('0xb1')](_0x73408e);});});})[_0xaa30('0x26')](function(_0x5eb209){_0x59bda6[_0xaa30('0xb2')]=_0x5eb209;return _0x59bda6;})['then'](respondWithFilteredResult(_0x5241d2,_0x2ae4ed));})[_0xaa30('0xb3')](handleError(_0x5241d2,null));};exports[_0xaa30('0xb4')]=function(_0x24f60f,_0x3fb561){var _0x24a3af={'raw':![],'where':{'id':_0x24f60f[_0xaa30('0xb5')]['id']}},_0x4412d4={};_0x4412d4[_0xaa30('0x36')]=_[_0xaa30('0x38')](db['SmsInteraction'][_0xaa30('0x33')]);_0x4412d4[_0xaa30('0x37')]=_['keys'](_0x24f60f[_0xaa30('0x37')]);_0x4412d4[_0xaa30('0x41')]=_['intersection'](_0x4412d4[_0xaa30('0x36')],_0x4412d4[_0xaa30('0x37')]);_0x24a3af['attributes']=_[_0xaa30('0x39')](_0x4412d4['model'],qs['fields'](_0x24f60f[_0xaa30('0x37')][_0xaa30('0x3b')]));_0x24a3af['attributes']=_0x24a3af['attributes'][_0xaa30('0x5a')]?_0x24a3af[_0xaa30('0x3a')]:_0x4412d4['model'];if(_0x24f60f[_0xaa30('0x37')]['includeAll']){_0x24a3af['include']=[{'all':!![]}];}_0x24a3af=_[_0xaa30('0x98')]({},_0x24a3af,_0x24f60f['options']);return db[_0xaa30('0x32')]['find'](_0x24a3af)[_0xaa30('0x26')](handleEntityNotFound(_0x3fb561,null))[_0xaa30('0x26')](respondWithResult(_0x3fb561,null))[_0xaa30('0xb3')](handleError(_0x3fb561,null));};exports[_0xaa30('0xb6')]=function(_0x541d21,_0x243b78){return db[_0xaa30('0x32')][_0xaa30('0xb6')](_0x541d21[_0xaa30('0x70')],{})['then'](respondWithResult(_0x243b78,0xc9))['catch'](handleError(_0x243b78,null));};exports[_0xaa30('0xb7')]=function(_0x2362ad,_0x269098){if(_0x2362ad['body']['id']){delete _0x2362ad['body']['id'];}return db[_0xaa30('0x32')]['find']({'where':{'id':_0x2362ad[_0xaa30('0xb5')]['id']}})[_0xaa30('0x26')](handleEntityNotFound(_0x269098,null))[_0xaa30('0x26')](saveUpdates(_0x2362ad[_0xaa30('0x70')],null))['then'](respondWithResult(_0x269098,null))[_0xaa30('0xb3')](handleError(_0x269098,null));};exports[_0xaa30('0x27')]=function(_0x2354e7,_0x137050){return db[_0xaa30('0x32')][_0xaa30('0x5b')]({'where':{'id':_0x2354e7['params']['id']}})[_0xaa30('0x26')](handleEntityNotFound(_0x137050,null))[_0xaa30('0x26')](removeEntity(_0x137050,null))['catch'](handleError(_0x137050,null));};exports[_0xaa30('0xb8')]=function(_0x4c1a67,_0x353233){return db['SmsInteraction'][_0xaa30('0xb8')]()[_0xaa30('0x26')](respondWithResult(_0x353233,null))[_0xaa30('0xb3')](handleError(_0x353233,null));};exports[_0xaa30('0xb9')]=function(_0x193ee9,_0x1cade7,_0x2f90db){return db[_0xaa30('0xba')][_0xaa30('0x5b')]({'where':{'id':_0x193ee9['params']['id']}})[_0xaa30('0x26')](handleEntityNotFound(_0x1cade7,null))[_0xaa30('0x26')](function(_0x21e8c7){if(_0x21e8c7){return _0x21e8c7['addMessage'](_0x193ee9[_0xaa30('0x70')][_0xaa30('0xbb')],_[_0xaa30('0xbc')](_0x193ee9[_0xaa30('0x70')],[_0xaa30('0xbb'),'id'])||{});}})[_0xaa30('0x26')](respondWithResult(_0x1cade7,null))[_0xaa30('0xb3')](handleError(_0x1cade7,null));};exports[_0xaa30('0xbd')]=function(_0x16e95c,_0x4dc93c,_0x27e335){var _0x25dca3={'raw':![],'where':{}};var _0x13521a={};var _0x4adfcd={'count':0x0,'rows':[]};return db[_0xaa30('0x32')][_0xaa30('0xbe')]({'where':{'id':_0x16e95c['params']['id']}})[_0xaa30('0x26')](handleEntityNotFound(_0x4dc93c,null))['then'](function(_0x51a37a){if(_0x51a37a){_0x13521a[_0xaa30('0x36')]=_[_0xaa30('0x38')](db[_0xaa30('0xba')][_0xaa30('0x33')]);_0x13521a['query']=_['keys'](_0x16e95c[_0xaa30('0x37')]);_0x13521a[_0xaa30('0x41')]=_[_0xaa30('0x39')](_0x13521a[_0xaa30('0x36')],_0x13521a[_0xaa30('0x37')]);_0x25dca3['attributes']=_[_0xaa30('0x39')](_0x13521a['model'],qs[_0xaa30('0x3b')](_0x16e95c[_0xaa30('0x37')][_0xaa30('0x3b')]));_0x25dca3['attributes']=_0x25dca3[_0xaa30('0x3a')][_0xaa30('0x5a')]?_0x25dca3[_0xaa30('0x3a')]:_0x13521a[_0xaa30('0x36')];if(!_0x16e95c[_0xaa30('0x37')][_0xaa30('0x3c')]('nolimit')){_0x25dca3[_0xaa30('0x3d')]=qs[_0xaa30('0x3d')](_0x16e95c['query']['limit']);_0x25dca3[_0xaa30('0x20')]=qs[_0xaa30('0x20')](_0x16e95c[_0xaa30('0x37')][_0xaa30('0x20')]);}_0x25dca3[_0xaa30('0x3e')]=qs[_0xaa30('0x3f')](_0x16e95c[_0xaa30('0x37')][_0xaa30('0x3f')]);_0x25dca3[_0xaa30('0x40')]=qs[_0xaa30('0x41')](_['pick'](_0x16e95c[_0xaa30('0x37')],_0x13521a['filters']));_0x25dca3['where'][_0xaa30('0xaf')]=_0x51a37a['id'];if(_0x16e95c[_0xaa30('0x37')][_0xaa30('0x80')]){_0x25dca3['where']=_[_0xaa30('0x98')](_0x25dca3[_0xaa30('0x40')],{'$or':_['map'](_0x25dca3[_0xaa30('0x3a')],function(_0x1689dc){var _0x2ebaa0={};_0x2ebaa0[_0x1689dc]={'$like':'%'+_0x16e95c[_0xaa30('0x37')][_0xaa30('0x80')]+'%'};return _0x2ebaa0;})});}if(_0x16e95c[_0xaa30('0x37')]['$gte']){var _0x3faced=_0x16e95c[_0xaa30('0x37')][_0xaa30('0x76')][_0xaa30('0x30')](',');var _0x348be7={};_0x348be7[_0x3faced[0x0]]={'$gte':moment(_0x3faced[0x1])[_0xaa30('0xbf')](_0xaa30('0xc0'))};_0x25dca3['where']=_['merge'](_0x25dca3[_0xaa30('0x40')],_0x348be7);}_0x25dca3=_[_0xaa30('0x98')]({},_0x25dca3,_0x16e95c[_0xaa30('0xc1')]);return db[_0xaa30('0xba')][_0xaa30('0x97')]({'where':_0x25dca3[_0xaa30('0x40')]})[_0xaa30('0x26')](function(_0x1a26ce){_0x4adfcd[_0xaa30('0x97')]=_0x1a26ce;if(_0x16e95c[_0xaa30('0x37')][_0xaa30('0xc2')]){_0x25dca3['include']=[{'all':!![]}];}return db[_0xaa30('0xba')][_0xaa30('0xc3')](_0x25dca3);})[_0xaa30('0x26')](function(_0x23d2ce){_0x4adfcd[_0xaa30('0xb2')]=_0x23d2ce;return _0x4adfcd;});}})[_0xaa30('0x26')](respondWithFilteredResult(_0x4dc93c,_0x25dca3))[_0xaa30('0xb3')](handleError(_0x4dc93c,null));};exports[_0xaa30('0xc4')]=function(_0x3174f6,_0x2d83b8,_0x2f2f6e){return db[_0xaa30('0x32')]['find']({'where':{'id':_0x3174f6[_0xaa30('0xb5')]['id']}})[_0xaa30('0x26')](handleEntityNotFound(_0x2d83b8,null))[_0xaa30('0x26')](function(_0x53676a){if(_0x53676a){return _0x53676a['setTags'](_0x3174f6[_0xaa30('0x70')]['ids'],_[_0xaa30('0xbc')](_0x3174f6['body'],[_0xaa30('0xbb'),'id'])||{})[_0xaa30('0xc5')](function(){return db[_0xaa30('0x68')][_0xaa30('0xc3')]({'attributes':['id','name',_0xaa30('0x43')],'where':{'id':_0x3174f6[_0xaa30('0x70')][_0xaa30('0xbb')]}});})[_0xaa30('0x26')](function(_0x51695e){socket[_0xaa30('0xc6')]('smsInteractionTags:save',{'id':Number(_0x3174f6[_0xaa30('0xb5')]['id']),'tags':_0x51695e||[]});return{'id':Number(_0x3174f6['params']['id']),'tags':_0x51695e||[]};});}})[_0xaa30('0x26')](respondWithResult(_0x2d83b8,null))[_0xaa30('0xb3')](handleError(_0x2d83b8,null));};exports[_0xaa30('0xc7')]=function(_0x536eae,_0x2d8b6d,_0xd5d498){return db[_0xaa30('0x32')]['find']({'where':{'id':_0x536eae[_0xaa30('0xb5')]['id']}})['then'](handleEntityNotFound(_0x2d8b6d,null))[_0xaa30('0x26')](function(_0x1b5042){if(_0x1b5042){return _0x1b5042['removeTags'](_0x536eae[_0xaa30('0x37')]['ids']);}})[_0xaa30('0x26')](respondWithStatusCode(_0x2d8b6d,null))[_0xaa30('0xb3')](handleError(_0x2d8b6d,null));};exports['download']=function(_0x33dad5,_0x2fe340){var _0x1dd2a9=moment()[_0xaa30('0xc8')]()[_0xaa30('0x96')]();var _0x1af8ef=path[_0xaa30('0xc9')](config[_0xaa30('0xca')],'server',_0xaa30('0xcb'),'tmp');var _0x3b5da9=path['join'](config[_0xaa30('0xca')],'server','files',_0xaa30('0xcc'));var _0x22093c=path[_0xaa30('0xc9')](_0x1af8ef,_0x1dd2a9);var _0x2dab91=util['format'](_0xaa30('0xcd'),_0x33dad5['params']['id'],_0x1dd2a9);var _0x403a9d=path[_0xaa30('0xc9')](_0x1af8ef,_0x2dab91);var _0x3a52a2=[];_0x3a52a2[_0xaa30('0xb0')]({'model':db[_0xaa30('0x6b')],'as':_0xaa30('0x6b'),'attributes':['id',_0xaa30('0x2d')],'raw':!![]});_0x3a52a2['push']({'model':db[_0xaa30('0xce')],'as':_0xaa30('0x60'),'attributes':['id',_0xaa30('0xcf'),_0xaa30('0xd0')],'raw':!![]});var _0xa300fa=[{'model':db[_0xaa30('0xba')],'as':_0xaa30('0xd1'),'attributes':['id',_0xaa30('0x70'),_0xaa30('0xd2'),_0xaa30('0xd3'),'secret',_0xaa30('0x7b')],'include':_0x3a52a2}];_0xa300fa[_0xaa30('0xb0')]({'model':db[_0xaa30('0xd4')],'as':'Account','attributes':['id',_0xaa30('0x29')]});_0xa300fa['push']({'model':db[_0xaa30('0x6b')],'as':'Owner','attributes':['id','fullname']});return db['SmsInteraction'][_0xaa30('0x5b')]({'where':{'id':_0x33dad5['params']['id']},'include':_0xa300fa})[_0xaa30('0x26')](handleEntityNotFound(_0x2fe340,null))['then'](function(_0x85ef9e){if(_0x85ef9e){var _0x470a2e=_0x85ef9e[_0xaa30('0xd5')]({'plain':!![]});fs[_0xaa30('0xd6')](_0x22093c);var _0x38353c={'format':'A4','border':_0xaa30('0xd7'),'header':{'height':_0xaa30('0xd8'),'contents':{'first':_0xaa30('0xd9')}},'footer':{'height':_0xaa30('0xda'),'contents':{'default':util['format'](_0xaa30('0xdb'),util[_0xaa30('0xbf')](_0xaa30('0xdc'),_0xaa30('0xdd'),_0x470a2e['id']),moment()[_0xaa30('0xbf')](_0xaa30('0xde'))['toString']())}}};var _0x35eda6={'channel':_0xaa30('0xdd'),'account':_0x470a2e[_0xaa30('0xdf')][_0xaa30('0x29')],'agent':_0x470a2e[_0xaa30('0xe0')]?_0x470a2e[_0xaa30('0xe0')][_0xaa30('0x2d')]:_0xaa30('0xe1'),'createdAt':moment(_0x470a2e['createdAt'])[_0xaa30('0xbf')](_0xaa30('0xc0'))[_0xaa30('0x96')](),'closedAt':_0x470a2e[_0xaa30('0xe2')]?moment(_0x470a2e[_0xaa30('0xe3')])[_0xaa30('0xbf')](_0xaa30('0xc0'))[_0xaa30('0x96')]():'','disposition':_0x470a2e['disposition'],'messages':_(_0x470a2e[_0xaa30('0xd1')])[_0xaa30('0x80')]({'secret':![]})['map'](function(_0x5b8a93){return{'date':moment(_0x5b8a93[_0xaa30('0xd2')])['format'](_0xaa30('0xc0'))['toString'](),'sender':_0x5b8a93['direction']===_0xaa30('0xe4')?_0x5b8a93['User']?_0x5b8a93[_0xaa30('0x6b')][_0xaa30('0x2d')]:'System':_0x5b8a93['Contact'][_0xaa30('0xcf')]+(_0x5b8a93['Contact'][_0xaa30('0xd0')]?'\x20'+_0x5b8a93[_0xaa30('0x60')]['lastName']:''),'body':_0x5b8a93['body'],'direction':_0x5b8a93[_0xaa30('0xd3')]===_0xaa30('0xe4')?'A':'C','secret':_0x5b8a93[_0xaa30('0xe5')],'read':_0x5b8a93[_0xaa30('0x7b')]};})[_0xaa30('0x5d')]()};return ejs[_0xaa30('0xe6')](path[_0xaa30('0xc9')](config[_0xaa30('0xca')],_0xaa30('0xe7'),'views',_0xaa30('0xe8')),{'interaction':_0x35eda6})['then'](function(_0x576b29){return new BPromise(function(_0x1d66f8,_0xd69c50){pdf[_0xaa30('0xb6')](_0x576b29,_0x38353c)[_0xaa30('0xe9')](path[_0xaa30('0xc9')](_0x22093c,_0xaa30('0xea')+_0x470a2e['id']+'-'+_0x1dd2a9+'.pdf'),function(_0x5d2255,_0x70ad41){if(_0x5d2255)return _0xd69c50(_0x5d2255);_0x1d66f8(_0x70ad41);});});})[_0xaa30('0x26')](function(){return new BPromise(function(_0xd2d083,_0x5aacdd){zipdir(_0x22093c,{'saveTo':_0x403a9d},function(_0x2d2b3f,_0x4672a4){if(_0x2d2b3f)return _0x5aacdd(_0x2d2b3f);return _0xd2d083(_0x4672a4);});})[_0xaa30('0x26')](function(){return new BPromise(function(_0x48da79,_0x8bd436){rimraf(_0x22093c,function(_0x1a87ad){if(_0x1a87ad)_0x8bd436(_0x1a87ad);return _0x48da79();});});})[_0xaa30('0x26')](function(){return _0x2fe340[_0xaa30('0xeb')](_0x403a9d,_0x2dab91,function(_0x52fa8f){if(_0x52fa8f){console[_0xaa30('0xec')](_0xaa30('0xed'),_0x52fa8f);}else{fs['unlinkSync'](_0x403a9d);}});});});}else{return _0x2fe340[_0xaa30('0x1d')](0xc8);}})[_0xaa30('0xb3')](handleError(_0x2fe340,null));}; \ No newline at end of file +var _0xf61e=['select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','Contact','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','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','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','getSmsAccounts','sequelize','toString','count','length','keyBy','SmsInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','show','params','includeAll','include','options','create','update','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','nolimit','merge','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','findAll','color','smsInteractionTags:save','removeTags','download','unix','server','files','tmp','join','root','transcript-%d-%s.zip','CmContact','firstName','direction','secret','SmsAccount','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','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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','Sms','N.A.','closed','disposition','Messages','lastName','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','offset','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','rawAttributes','fieldName','query','filters','intersection','model','fields','attributes','hasOwnProperty','limit','order','where','pick','field','from','tools_tags'];(function(_0x2e232e,_0x6090e2){var _0x1be6bc=function(_0x3c49be){while(--_0x3c49be){_0x2e232e['push'](_0x2e232e['shift']());}};_0x1be6bc(++_0x6090e2);}(_0xf61e,0x191));var _0xef61=function(_0x25166b,_0x22981a){_0x25166b=_0x25166b-0x0;var _0x3b526f=_0xf61e[_0x25166b];return _0x3b526f;};'use strict';var pdf=require(_0xef61('0x0'));var emlformat=require(_0xef61('0x1'));var rimraf=require(_0xef61('0x2'));var zipdir=require(_0xef61('0x3'));var jsonpatch=require(_0xef61('0x4'));var rp=require(_0xef61('0x5'));var moment=require(_0xef61('0x6'));var BPromise=require(_0xef61('0x7'));var Mustache=require(_0xef61('0x8'));var util=require(_0xef61('0x9'));var path=require(_0xef61('0xa'));var sox=require(_0xef61('0xb'));var csv=require('to-csv');var ejs=require(_0xef61('0xc'));var fs=require('fs');var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var db=require(_0xef61('0x1b'))['db'];config[_0xef61('0x1c')]=_[_0xef61('0x1d')](config[_0xef61('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xef61('0x1e'))(new Redis(config['redis']));require(_0xef61('0x1f'))[_0xef61('0x20')](socket);function respondWithStatusCode(_0x370ee0,_0x76ef9b){_0x76ef9b=_0x76ef9b||0xcc;return function(_0x4c64b5){if(_0x4c64b5){return _0x370ee0[_0xef61('0x21')](_0x76ef9b);}return _0x370ee0[_0xef61('0x22')](_0x76ef9b)[_0xef61('0x23')]();};}function respondWithResult(_0x78ff22,_0x588a61){_0x588a61=_0x588a61||0xc8;return function(_0x66fa62){if(_0x66fa62){return _0x78ff22[_0xef61('0x22')](_0x588a61)['json'](_0x66fa62);}};}function respondWithFilteredResult(_0x8b2810,_0x408541){return function(_0x36f558){if(_0x36f558){var _0x22dc1b=_0x36f558['count'],_0xfc36d6=_0x408541[_0xef61('0x24')],_0x28315a=_0x408541[_0xef61('0x24')]+_0x408541['limit'],_0xdd5e38;if(_0x28315a>=_0x22dc1b){_0x28315a=_0x22dc1b;_0xdd5e38=0xc8;}else{_0xdd5e38=0xce;}_0x8b2810[_0xef61('0x22')](_0xdd5e38);return _0x8b2810[_0xef61('0x25')](_0xef61('0x26'),_0xfc36d6+'-'+_0x28315a+'/'+_0x22dc1b)[_0xef61('0x27')](_0x36f558);}return null;};}function patchUpdates(_0xb0d7a4){return function(_0x2ed61e){try{jsonpatch[_0xef61('0x28')](_0x2ed61e,_0xb0d7a4,!![]);}catch(_0x51f9ca){return BPromise['reject'](_0x51f9ca);}return _0x2ed61e[_0xef61('0x29')]();};}function saveUpdates(_0x58bd7d,_0x389d6d){return function(_0x5ae7a2){if(_0x5ae7a2){return _0x5ae7a2['update'](_0x58bd7d)[_0xef61('0x2a')](function(_0x5ce99d){return _0x5ce99d;});}return null;};}function removeEntity(_0x53181b,_0xfbee94){return function(_0x3782c6){if(_0x3782c6){return _0x3782c6[_0xef61('0x2b')]()[_0xef61('0x2a')](function(){_0x53181b['status'](0xcc)[_0xef61('0x23')]();});}};}function handleEntityNotFound(_0x4e738f,_0x2a6832){return function(_0xb00f83){if(!_0xb00f83){_0x4e738f[_0xef61('0x21')](0x194);}return _0xb00f83;};}function handleError(_0xf4c7c9,_0x2155f1){_0x2155f1=_0x2155f1||0x1f4;return function(_0x45ece2){logger[_0xef61('0x2c')](_0x45ece2[_0xef61('0x2d')]);if(_0x45ece2[_0xef61('0x2e')]){delete _0x45ece2[_0xef61('0x2e')];}_0xf4c7c9[_0xef61('0x22')](_0x2155f1)[_0xef61('0x2f')](_0x45ece2);};}function getInteractionUsers(_0xeb9a62,_0x63edd4){return new BPromise(function(_0x1f3572,_0x85978){try{if(_0x63edd4[_0xeb9a62['id']]){_0xeb9a62[_0xef61('0x30')]=_[_0xef61('0x31')](_0x63edd4[_0xeb9a62['id']],function(_0x587e26){return{'id':_0x587e26['id'],'fullname':_0x587e26[_0xef61('0x32')]};});}}catch(_0x43bc47){_0x85978(_0x43bc47);}_0x1f3572(_0xeb9a62);});}function getInteractionTags(_0x53fa3b,_0x4f35ad){return new BPromise(function(_0x51d5d1,_0x38b522){try{if(_0x53fa3b[_0xef61('0x33')]){_0x53fa3b[_0xef61('0x34')]=[];_0x53fa3b['TagIds'][_0xef61('0x35')](',')[_0xef61('0x36')](function(_0x4eceec){_0x53fa3b[_0xef61('0x34')]['push'](_0x4f35ad[_0x4eceec]);});}delete _0x53fa3b['TagIds'];}catch(_0x307b70){_0x38b522(_0x307b70);}_0x51d5d1(_0x53fa3b);});}function updateSmsInteraction(_0x48b6db,_0x8ed629,_0x5ee9e4){return new BPromise(function(_0x41d9e9,_0x4155a0){return getInteractionUsers(_0x48b6db,_0x5ee9e4)[_0xef61('0x2a')](function(_0x14c05c){return getInteractionTags(_0x14c05c,_0x8ed629);})[_0xef61('0x2a')](function(_0x1bdcb9){_0x41d9e9(_0x1bdcb9);})[_0xef61('0x37')](function(_0x232cd8){_0x4155a0(_0x232cd8);});});}exports[_0xef61('0x38')]=function(_0xb9d080,_0x5f15ef){var _0x569db6={},_0x4ce644={},_0x3dd5a2={'count':0x0,'rows':[]};var _0x1c1760=_[_0xef61('0x31')](db['SmsInteraction'][_0xef61('0x39')],function(_0x3b7373){return{'name':_0x3b7373[_0xef61('0x3a')],'type':_0x3b7373['type']['key']};});_0x4ce644['model']=_[_0xef61('0x31')](_0x1c1760,'name');_0x4ce644['query']=_['keys'](_0xb9d080[_0xef61('0x3b')]);_0x4ce644[_0xef61('0x3c')]=_[_0xef61('0x3d')](_0x4ce644['model'],_0x4ce644['query']);_0x569db6['attributes']=_[_0xef61('0x3d')](_0x4ce644[_0xef61('0x3e')],qs['fields'](_0xb9d080[_0xef61('0x3b')][_0xef61('0x3f')]));_0x569db6[_0xef61('0x40')]=_0x569db6[_0xef61('0x40')]['length']?_0x569db6[_0xef61('0x40')]:_0x4ce644[_0xef61('0x3e')];if(!_0xb9d080[_0xef61('0x3b')][_0xef61('0x41')]('nolimit')){_0x569db6['limit']=qs[_0xef61('0x42')](_0xb9d080[_0xef61('0x3b')][_0xef61('0x42')]);_0x569db6['offset']=qs[_0xef61('0x24')](_0xb9d080[_0xef61('0x3b')][_0xef61('0x24')]);}_0x569db6[_0xef61('0x43')]=qs['sort'](_0xb9d080['query']['sort']);_0x569db6[_0xef61('0x44')]=qs[_0xef61('0x3c')](_[_0xef61('0x45')](_0xb9d080[_0xef61('0x3b')],_0x4ce644[_0xef61('0x3c')]));var _0x272143=[];var _0xc9b467=squel['select']()[_0xef61('0x46')]('id')[_0xef61('0x46')](_0xef61('0x2e'))[_0xef61('0x46')]('color')[_0xef61('0x47')](_0xef61('0x48'));var _0x368f10=squel[_0xef61('0x49')]()[_0xef61('0x46')](_0xef61('0x4a'))['field'](_0xef61('0x4b'))[_0xef61('0x46')](_0xef61('0x4c'))['from'](_0xef61('0x4d'),'ui')[_0xef61('0x4e')](_0xef61('0x4f'),'u',_0xef61('0x50'));var _0x216916=squel[_0xef61('0x49')]()['from'](_0xef61('0x51'),'i')[_0xef61('0x4e')]('cm_contacts','c',_0xef61('0x52'))[_0xef61('0x4e')](_0xef61('0x4f'),'o',_0xef61('0x53'))['left_join'](_0xef61('0x54'),'a',_0xef61('0x55'))[_0xef61('0x4e')]('sms_messages','me',_0xef61('0x56'))[_0xef61('0x4e')]('sms_interaction_has_tags','it',_0xef61('0x57'))[_0xef61('0x4e')](_0xef61('0x48'),'t',_0xef61('0x58'));var _0x13bb20=squel[_0xef61('0x59')]();var _0x2cff33=[];var _0x57849d=squel[_0xef61('0x59')]();var _0x505631;if(_0xb9d080[_0xef61('0x3b')][_0xef61('0x5a')]){_0x505631=as[_0xef61('0x5b')](_0xb9d080[_0xef61('0x3b')][_0xef61('0x5a')]);var _0x1fba7c=_0x505631[_0xef61('0x5c')];for(var _0x1565c7=0x0;_0x1565c7<_0x505631[_0xef61('0x5d')]['length'];_0x1565c7++){var _0x1cdcc9=_0x505631[_0xef61('0x5d')][_0x1565c7];var _0x5ef0c3='i';var _0x5316ac=_[_0xef61('0x5e')](_0x1c1760,[_0xef61('0x2e'),_0x1cdcc9['field']]);if(!_0x5316ac){switch(_0x1cdcc9[_0xef61('0x46')]){case'unreadMessages':if(_0x1cdcc9[_0xef61('0x5f')]==0x1){_0x216916[_0xef61('0x60')]('`'+_0x1cdcc9[_0xef61('0x46')]+_0xef61('0x61'));}else{_0x216916[_0xef61('0x60')]('`'+_0x1cdcc9[_0xef61('0x46')]+'`\x20>\x200');}break;case _0xef61('0x62'):if(_0x1cdcc9[_0xef61('0x63')]==='$substring'){if(_0x1cdcc9[_0xef61('0x5f')][_0xef61('0x35')]('\x20')['length']>0x1){_0x13bb20[_0x1fba7c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xef61('0x64')](_0x1cdcc9['value']),null);}else{var _0x5dcbbe='%'+_0x1cdcc9['value']+'%';_0x13bb20[_0x1fba7c](_0xef61('0x65'),_0x5dcbbe,_0x5dcbbe,_0x5dcbbe);}}else{_0x5316ac=_[_0xef61('0x5e')](_0x1c1760,['name',_0xef61('0x66')]);_0x1cdcc9[_0xef61('0x46')]=_0xef61('0x66');_0x4c7a9a=as[_0xef61('0x67')](_0x5ef0c3,_0x5316ac[_0xef61('0x68')],_0x1cdcc9);_0x13bb20[_0x1fba7c](_0x4c7a9a[_0xef61('0x69')],_0x4c7a9a[_0xef61('0x5f')][_0xef61('0x6a')],_0x4c7a9a['value']['end']);}break;case _0xef61('0x6b'):var _0x1a2e7e=_0x1cdcc9[_0xef61('0x5f')][_0xef61('0x35')](',')[_0xef61('0x31')](function(_0x5a6d4b){return Number(_0x5a6d4b);});_0x1a2e7e[_0xef61('0x36')](function(_0x572d5f){_0x57849d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x572d5f+',%');});_0x2cff33=_[_0xef61('0x6c')](_0x2cff33,_0x1a2e7e);break;case _0xef61('0x6d'):if(_0x1cdcc9[_0xef61('0x63')]==='$substring'){_0x13bb20[_0x1fba7c](_0xef61('0x6e'),'%'+_0x1cdcc9[_0xef61('0x5f')]+'%',null);}else{_0x5316ac=_[_0xef61('0x5e')](_0x1c1760,[_0xef61('0x2e'),_0xef61('0x6f')]);_0x1cdcc9[_0xef61('0x46')]=_0xef61('0x6f');_0x4c7a9a=as[_0xef61('0x67')](_0x5ef0c3,_0x5316ac[_0xef61('0x68')],_0x1cdcc9);_0x13bb20[_0x1fba7c](_0x4c7a9a[_0xef61('0x69')],_0x4c7a9a['value'][_0xef61('0x6a')],_0x4c7a9a['value']['end']);}break;case _0xef61('0x70'):_0x4c7a9a=as[_0xef61('0x67')]('me',null,_0x1cdcc9);_0x13bb20[_0x1fba7c](_0x4c7a9a[_0xef61('0x69')],_0x4c7a9a[_0xef61('0x5f')][_0xef61('0x6a')],_0x4c7a9a[_0xef61('0x5f')]['end']);break;}}else{var _0x4c7a9a=as[_0xef61('0x67')](_0x5ef0c3,_0x5316ac[_0xef61('0x68')],_0x1cdcc9);_0x13bb20[_0x1fba7c](_0x4c7a9a[_0xef61('0x69')],_0x4c7a9a[_0xef61('0x5f')][_0xef61('0x6a')],_0x4c7a9a[_0xef61('0x5f')][_0xef61('0x23')]);}}}else{var _0x33f585=_(_0xb9d080[_0xef61('0x3b')])[_0xef61('0x71')]()[_0xef61('0x31')](function(_0x4914ed){return _[_0xef61('0x72')](_0x1c1760,[_0xef61('0x2e'),_0x4914ed])?_0x4914ed:undefined;})['compact']()[_0xef61('0x5f')]();if(!_[_0xef61('0x73')](_0x33f585)){_0x33f585[_0xef61('0x36')](function(_0xaeaee6){if(_0xaeaee6===_0xef61('0x74')){_0x216916[_0xef61('0x44')](_0xef61('0x75'),[][_0xef61('0x76')](_0xb9d080['query'][_0xaeaee6]));}else if(_0xaeaee6===_0xef61('0x77')){var _0x59b02b=JSON['parse'](_0xb9d080['query'][_0xaeaee6])[_0xef61('0x78')];var _0x205f80=JSON[_0xef61('0x79')](_0xb9d080['query'][_0xaeaee6])[_0xef61('0x7a')];_0x216916[_0xef61('0x44')](_0xef61('0x7b'),_0x59b02b,_0x205f80);}else{if(_0xb9d080[_0xef61('0x3b')][_0xaeaee6]===_0xef61('0x7c')){_0x216916[_0xef61('0x44')]('i.'+_0xaeaee6+_0xef61('0x7d'));}else{_0x216916[_0xef61('0x44')]('i.'+_0xaeaee6+_0xef61('0x7e'),_0xb9d080[_0xef61('0x3b')][_0xaeaee6]);}}});}if(_0xb9d080[_0xef61('0x3b')][_0xef61('0x7f')]){if(_0xb9d080[_0xef61('0x3b')][_0xef61('0x7f')]==0x1){_0x216916[_0xef61('0x60')](_0xef61('0x80'));}else{_0x216916[_0xef61('0x60')](_0xef61('0x81'));}}if(_0xb9d080['query'][_0xef61('0x82')]){_0x2cff33=_[_0xef61('0x83')](_0xb9d080[_0xef61('0x3b')][_0xef61('0x82')])?_0xb9d080[_0xef61('0x3b')][_0xef61('0x82')]:new Array(_0xb9d080['query'][_0xef61('0x82')]);_0x2cff33[_0xef61('0x36')](function(_0x582492){_0x57849d['or'](_0xef61('0x84'),'%,'+_0x582492+',%');});}if(_0xb9d080['query'][_0xef61('0x85')]){var _0x381336=_0xb9d080['query'][_0xef61('0x85')]['replace']('\x5c','\x5c\x5c')[_0xef61('0x86')]('\x27\x27',_0xef61('0x87'));if(qs['isNumeric'](_0x381336)){_0x13bb20['or']('i.id\x20LIKE\x20?',_0x381336+'%')['or'](_0xef61('0x88'),_0x381336+'%');}else{_0x13bb20['or'](_0xef61('0x89'),qs[_0xef61('0x64')](_0x381336))['or'](_0xef61('0x8a'),_0x381336+'%');}}}_0x216916[_0xef61('0x44')](_0x13bb20);_0x216916['group'](_0xef61('0x8b'));var _0x2db1d1={'type':db[_0xef61('0x8c')][_0xef61('0x8d')][_0xef61('0x8e')],'raw':!![]};var _0x1aa9c3=_0x216916['clone']();_0x1aa9c3[_0xef61('0x46')]('i.id');_0x1aa9c3[_0xef61('0x46')](_0xef61('0x8f'),_0xef61('0x90'));if(_0x569db6[_0xef61('0x43')]){_0x569db6[_0xef61('0x43')][_0xef61('0x36')](function(_0x1eef77){_0x216916[_0xef61('0x43')]('i.'+_0x1eef77[0x0],_0x1eef77[0x1]===_0xef61('0x91')?![]:!![]);});}if(!_[_0xef61('0x73')](_0x2cff33)){_0x216916[_0xef61('0x60')](_0x57849d);_0x1aa9c3[_0xef61('0x44')](_0xef61('0x92'),_0x2cff33);}BPromise['resolve']()[_0xef61('0x2a')](function(){if(!_0x505631){if(_0xb9d080[_0xef61('0x3b')][_0xef61('0x74')]||_0xb9d080[_0xef61('0x3b')]['journey'])return;_0x1aa9c3[_0xef61('0x44')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x216916['where'](_0xef61('0x93'));return;}return _0xb9d080['user'][_0xef61('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5a9478){if(_[_0xef61('0x73')](_0x5a9478)){_0x1aa9c3[_0xef61('0x44')]('i.SmsAccountId\x20IS\x20NULL');_0x216916[_0xef61('0x44')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x1aa9c3[_0xef61('0x44')](_0xef61('0x75'),_[_0xef61('0x31')](_0x5a9478,'id'));_0x216916[_0xef61('0x44')]('i.SmsAccountId\x20IN\x20?',_[_0xef61('0x31')](_0x5a9478,'id'));}});})['then'](function(){db[_0xef61('0x95')][_0xef61('0x3b')](_0x1aa9c3[_0xef61('0x96')](),_0x2db1d1)[_0xef61('0x2a')](function(_0x129e4f){_0x3dd5a2[_0xef61('0x97')]=_0x129e4f[_0xef61('0x98')];if(_0x3dd5a2[_0xef61('0x97')]===0x0)return[];return db[_0xef61('0x95')]['query'](_0xc9b467[_0xef61('0x96')](),_0x2db1d1)['then'](function(_0x222239){_0x272143=_[_0xef61('0x99')](_0x222239,'id');_0x2db1d1=_['merge'](_0x2db1d1,{'model':db[_0xef61('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xb9d080['query']['fields']){_0x569db6[_0xef61('0x40')][_0xef61('0x36')](function(_0x4cdabf){_0x216916[_0xef61('0x46')]('i.'+_0x4cdabf);});}else{_0x216916[_0xef61('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xef61('0x90'));_0x216916[_0xef61('0x46')]('a.key',_0xef61('0x9b'));_0x216916['field'](_0xef61('0x9c'),_0xef61('0x9d'));_0x216916[_0xef61('0x46')](_0xef61('0x9e'));_0x216916['field'](_0xef61('0x9f'),_0xef61('0xa0'));_0x216916[_0xef61('0x46')]('c.lastName',_0xef61('0xa1'));_0x216916[_0xef61('0x46')]('c.email','Contact.email');_0x216916[_0xef61('0x46')](_0xef61('0xa2'),_0xef61('0xa3'));_0x216916[_0xef61('0x46')](_0xef61('0xa4'),_0xef61('0xa5'));_0x216916[_0xef61('0x46')](_0xef61('0xa6'),_0xef61('0xa7'));_0x216916[_0xef61('0x46')](_0xef61('0xa8'),_0xef61('0xa9'));_0x216916[_0xef61('0x46')](_0xef61('0xaa'),_0xef61('0xab'));_0x216916[_0xef61('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xef61('0x33'));}_0x216916[_0xef61('0x42')](_0x569db6[_0xef61('0x42')]);_0x216916[_0xef61('0x24')](_0x569db6[_0xef61('0x24')]);return db[_0xef61('0x95')][_0xef61('0x3b')](_0x216916[_0xef61('0x96')](),_0x2db1d1);})[_0xef61('0x2a')](function(_0x371dd3){_0x368f10[_0xef61('0x44')](_0xef61('0xac'),_['map'](_0x371dd3,'id'));return db[_0xef61('0x95')][_0xef61('0x3b')](_0x368f10['toString'](),_0x2db1d1)[_0xef61('0x2a')](function(_0x3607f9){var _0x4629bf=_[_0xef61('0xad')](_0x3607f9,_0xef61('0xae'));var _0x51a988=[];_0x371dd3[_0xef61('0x36')](function(_0x4d7e97){_0x51a988[_0xef61('0xaf')](updateSmsInteraction(_0x4d7e97,_0x272143,_0x4629bf));});return BPromise[_0xef61('0xb0')](_0x51a988);});});})[_0xef61('0x2a')](function(_0x19b1a0){_0x3dd5a2[_0xef61('0xb1')]=_0x19b1a0;return _0x3dd5a2;})[_0xef61('0x2a')](respondWithFilteredResult(_0x5f15ef,_0x569db6));})[_0xef61('0x37')](handleError(_0x5f15ef,null));};exports[_0xef61('0xb2')]=function(_0x5627b6,_0x3f68db){var _0x5a251e={'raw':![],'where':{'id':_0x5627b6[_0xef61('0xb3')]['id']}},_0x28f142={};_0x28f142[_0xef61('0x3e')]=_[_0xef61('0x71')](db[_0xef61('0x9a')][_0xef61('0x39')]);_0x28f142[_0xef61('0x3b')]=_['keys'](_0x5627b6[_0xef61('0x3b')]);_0x28f142[_0xef61('0x3c')]=_[_0xef61('0x3d')](_0x28f142[_0xef61('0x3e')],_0x28f142['query']);_0x5a251e['attributes']=_[_0xef61('0x3d')](_0x28f142[_0xef61('0x3e')],qs[_0xef61('0x3f')](_0x5627b6[_0xef61('0x3b')][_0xef61('0x3f')]));_0x5a251e[_0xef61('0x40')]=_0x5a251e[_0xef61('0x40')]['length']?_0x5a251e[_0xef61('0x40')]:_0x28f142[_0xef61('0x3e')];if(_0x5627b6[_0xef61('0x3b')][_0xef61('0xb4')]){_0x5a251e[_0xef61('0xb5')]=[{'all':!![]}];}_0x5a251e=_['merge']({},_0x5a251e,_0x5627b6[_0xef61('0xb6')]);return db['SmsInteraction'][_0xef61('0x5e')](_0x5a251e)[_0xef61('0x2a')](handleEntityNotFound(_0x3f68db,null))[_0xef61('0x2a')](respondWithResult(_0x3f68db,null))[_0xef61('0x37')](handleError(_0x3f68db,null));};exports[_0xef61('0xb7')]=function(_0xa23aa9,_0x4fb8be){return db[_0xef61('0x9a')][_0xef61('0xb7')](_0xa23aa9[_0xef61('0x70')],{})[_0xef61('0x2a')](respondWithResult(_0x4fb8be,0xc9))[_0xef61('0x37')](handleError(_0x4fb8be,null));};exports[_0xef61('0xb8')]=function(_0x174dc6,_0x49d5e4){if(_0x174dc6[_0xef61('0x70')]['id']){delete _0x174dc6[_0xef61('0x70')]['id'];}return db[_0xef61('0x9a')]['find']({'where':{'id':_0x174dc6['params']['id']}})[_0xef61('0x2a')](handleEntityNotFound(_0x49d5e4,null))[_0xef61('0x2a')](saveUpdates(_0x174dc6['body'],null))[_0xef61('0x2a')](respondWithResult(_0x49d5e4,null))[_0xef61('0x37')](handleError(_0x49d5e4,null));};exports[_0xef61('0x2b')]=function(_0x42f95f,_0x34a3a5){return db[_0xef61('0x9a')][_0xef61('0x5e')]({'where':{'id':_0x42f95f[_0xef61('0xb3')]['id']}})['then'](handleEntityNotFound(_0x34a3a5,null))[_0xef61('0x2a')](removeEntity(_0x34a3a5,null))[_0xef61('0x37')](handleError(_0x34a3a5,null));};exports[_0xef61('0xb9')]=function(_0x7839c0,_0x3b4f1b){return db['SmsInteraction'][_0xef61('0xb9')]()['then'](respondWithResult(_0x3b4f1b,null))[_0xef61('0x37')](handleError(_0x3b4f1b,null));};exports[_0xef61('0xba')]=function(_0x12be3c,_0x4a30f8,_0x4d9fe0){return db[_0xef61('0xbb')][_0xef61('0x5e')]({'where':{'id':_0x12be3c['params']['id']}})['then'](handleEntityNotFound(_0x4a30f8,null))[_0xef61('0x2a')](function(_0x38cd72){if(_0x38cd72){return _0x38cd72[_0xef61('0xba')](_0x12be3c[_0xef61('0x70')][_0xef61('0xbc')],_[_0xef61('0xbd')](_0x12be3c[_0xef61('0x70')],[_0xef61('0xbc'),'id'])||{});}})[_0xef61('0x2a')](respondWithResult(_0x4a30f8,null))[_0xef61('0x37')](handleError(_0x4a30f8,null));};exports[_0xef61('0xbe')]=function(_0x49f528,_0x1e9123,_0x3d1201){var _0x49b415={'raw':![],'where':{}};var _0x477368={};var _0x3b5e2b={'count':0x0,'rows':[]};return db[_0xef61('0x9a')][_0xef61('0xbf')]({'where':{'id':_0x49f528[_0xef61('0xb3')]['id']}})[_0xef61('0x2a')](handleEntityNotFound(_0x1e9123,null))['then'](function(_0x2ef48f){if(_0x2ef48f){_0x477368[_0xef61('0x3e')]=_[_0xef61('0x71')](db[_0xef61('0xbb')][_0xef61('0x39')]);_0x477368[_0xef61('0x3b')]=_['keys'](_0x49f528['query']);_0x477368[_0xef61('0x3c')]=_[_0xef61('0x3d')](_0x477368[_0xef61('0x3e')],_0x477368[_0xef61('0x3b')]);_0x49b415[_0xef61('0x40')]=_[_0xef61('0x3d')](_0x477368[_0xef61('0x3e')],qs['fields'](_0x49f528['query'][_0xef61('0x3f')]));_0x49b415[_0xef61('0x40')]=_0x49b415[_0xef61('0x40')][_0xef61('0x98')]?_0x49b415[_0xef61('0x40')]:_0x477368['model'];if(!_0x49f528[_0xef61('0x3b')]['hasOwnProperty'](_0xef61('0xc0'))){_0x49b415['limit']=qs[_0xef61('0x42')](_0x49f528['query']['limit']);_0x49b415[_0xef61('0x24')]=qs[_0xef61('0x24')](_0x49f528[_0xef61('0x3b')][_0xef61('0x24')]);}_0x49b415[_0xef61('0x43')]=qs['sort'](_0x49f528['query']['sort']);_0x49b415[_0xef61('0x44')]=qs['filters'](_[_0xef61('0x45')](_0x49f528[_0xef61('0x3b')],_0x477368[_0xef61('0x3c')]));_0x49b415[_0xef61('0x44')][_0xef61('0xae')]=_0x2ef48f['id'];if(_0x49f528[_0xef61('0x3b')][_0xef61('0x85')]){_0x49b415['where']=_[_0xef61('0xc1')](_0x49b415['where'],{'$or':_[_0xef61('0x31')](_0x49b415[_0xef61('0x40')],function(_0xf2be0b){var _0x3d87cd={};_0x3d87cd[_0xf2be0b]={'$like':'%'+_0x49f528['query'][_0xef61('0x85')]+'%'};return _0x3d87cd;})});}if(_0x49f528[_0xef61('0x3b')][_0xef61('0x78')]){var _0x5d1ef6=_0x49f528['query'][_0xef61('0x78')][_0xef61('0x35')](',');var _0x564ee8={};_0x564ee8[_0x5d1ef6[0x0]]={'$gte':moment(_0x5d1ef6[0x1])[_0xef61('0xc2')](_0xef61('0xc3'))};_0x49b415['where']=_['merge'](_0x49b415[_0xef61('0x44')],_0x564ee8);}_0x49b415=_[_0xef61('0xc1')]({},_0x49b415,_0x49f528['options']);return db[_0xef61('0xbb')]['count']({'where':_0x49b415[_0xef61('0x44')]})['then'](function(_0x3fa325){_0x3b5e2b['count']=_0x3fa325;if(_0x49f528[_0xef61('0x3b')]['includeAll']){_0x49b415[_0xef61('0xb5')]=[{'all':!![]}];}return db[_0xef61('0xbb')]['findAll'](_0x49b415);})[_0xef61('0x2a')](function(_0x1bef37){_0x3b5e2b[_0xef61('0xb1')]=_0x1bef37;return _0x3b5e2b;});}})['then'](respondWithFilteredResult(_0x1e9123,_0x49b415))['catch'](handleError(_0x1e9123,null));};exports[_0xef61('0xc4')]=function(_0x3b98cf,_0x5b802d,_0x4c0c40){return db[_0xef61('0x9a')][_0xef61('0x5e')]({'where':{'id':_0x3b98cf['params']['id']}})[_0xef61('0x2a')](handleEntityNotFound(_0x5b802d,null))['then'](function(_0x3dc1f2){if(_0x3dc1f2){return _0x3dc1f2[_0xef61('0xc5')](_0x3b98cf[_0xef61('0x70')][_0xef61('0xbc')],_[_0xef61('0xbd')](_0x3b98cf[_0xef61('0x70')],['ids','id'])||{})['spread'](function(){return db[_0xef61('0x6b')][_0xef61('0xc6')]({'attributes':['id',_0xef61('0x2e'),_0xef61('0xc7')],'where':{'id':_0x3b98cf[_0xef61('0x70')][_0xef61('0xbc')]}});})[_0xef61('0x2a')](function(_0x202a9f){socket['emit'](_0xef61('0xc8'),{'id':Number(_0x3b98cf[_0xef61('0xb3')]['id']),'tags':_0x202a9f||[]});return{'id':Number(_0x3b98cf[_0xef61('0xb3')]['id']),'tags':_0x202a9f||[]};});}})[_0xef61('0x2a')](respondWithResult(_0x5b802d,null))[_0xef61('0x37')](handleError(_0x5b802d,null));};exports[_0xef61('0xc9')]=function(_0x6b01f9,_0x5430bf,_0x68c83c){return db[_0xef61('0x9a')][_0xef61('0x5e')]({'where':{'id':_0x6b01f9[_0xef61('0xb3')]['id']}})[_0xef61('0x2a')](handleEntityNotFound(_0x5430bf,null))[_0xef61('0x2a')](function(_0x4216f8){if(_0x4216f8){return _0x4216f8['removeTags'](_0x6b01f9[_0xef61('0x3b')][_0xef61('0xbc')]);}})[_0xef61('0x2a')](respondWithStatusCode(_0x5430bf,null))[_0xef61('0x37')](handleError(_0x5430bf,null));};exports[_0xef61('0xca')]=function(_0x33c648,_0x3ef5fd){var _0x4a7509=moment()[_0xef61('0xcb')]()[_0xef61('0x96')]();var _0x50d8a4=path['join'](config['root'],_0xef61('0xcc'),_0xef61('0xcd'),_0xef61('0xce'));var _0x47b36b=path[_0xef61('0xcf')](config[_0xef61('0xd0')],_0xef61('0xcc'),_0xef61('0xcd'),'attachments');var _0x432dc8=path[_0xef61('0xcf')](_0x50d8a4,_0x4a7509);var _0x23a826=util[_0xef61('0xc2')](_0xef61('0xd1'),_0x33c648['params']['id'],_0x4a7509);var _0x471206=path[_0xef61('0xcf')](_0x50d8a4,_0x23a826);var _0x3b7b49=[];_0x3b7b49[_0xef61('0xaf')]({'model':db[_0xef61('0x6d')],'as':_0xef61('0x6d'),'attributes':['id',_0xef61('0x32')],'raw':!![]});_0x3b7b49[_0xef61('0xaf')]({'model':db[_0xef61('0xd2')],'as':_0xef61('0x62'),'attributes':['id',_0xef61('0xd3'),'lastName'],'raw':!![]});var _0x13d81c=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id','body','createdAt',_0xef61('0xd4'),_0xef61('0xd5'),_0xef61('0x7f')],'include':_0x3b7b49}];_0x13d81c[_0xef61('0xaf')]({'model':db[_0xef61('0xd6')],'as':'Account','attributes':['id','name']});_0x13d81c[_0xef61('0xaf')]({'model':db['User'],'as':_0xef61('0xd7'),'attributes':['id',_0xef61('0x32')]});return db[_0xef61('0x9a')]['find']({'where':{'id':_0x33c648[_0xef61('0xb3')]['id']},'include':_0x13d81c})[_0xef61('0x2a')](handleEntityNotFound(_0x3ef5fd,null))[_0xef61('0x2a')](function(_0xebc935){if(_0xebc935){var _0x43ec95=_0xebc935[_0xef61('0xd8')]({'plain':!![]});fs['mkdirSync'](_0x432dc8);var _0x1804ad={'format':'A4','border':_0xef61('0xd9'),'header':{'height':_0xef61('0xda'),'contents':{'first':_0xef61('0xdb')}},'footer':{'height':'30px','contents':{'default':util['format'](_0xef61('0xdc'),util[_0xef61('0xc2')](_0xef61('0xdd'),'Sms',_0x43ec95['id']),moment()[_0xef61('0xc2')](_0xef61('0xde'))['toString']())}}};var _0x3a40e9={'channel':_0xef61('0xdf'),'account':_0x43ec95['Account'][_0xef61('0x2e')],'agent':_0x43ec95[_0xef61('0xd7')]?_0x43ec95[_0xef61('0xd7')][_0xef61('0x32')]:_0xef61('0xe0'),'createdAt':moment(_0x43ec95[_0xef61('0x77')])[_0xef61('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xef61('0x96')](),'closedAt':_0x43ec95[_0xef61('0xe1')]?moment(_0x43ec95['closedAt'])[_0xef61('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xef61('0x96')]():'','disposition':_0x43ec95[_0xef61('0xe2')],'messages':_(_0x43ec95[_0xef61('0xe3')])[_0xef61('0x85')]({'secret':![]})[_0xef61('0x31')](function(_0x200a67){return{'date':moment(_0x200a67[_0xef61('0x77')])[_0xef61('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xef61('0x96')](),'sender':_0x200a67[_0xef61('0xd4')]==='out'?_0x200a67[_0xef61('0x6d')]?_0x200a67[_0xef61('0x6d')][_0xef61('0x32')]:'System':_0x200a67[_0xef61('0x62')][_0xef61('0xd3')]+(_0x200a67['Contact'][_0xef61('0xe4')]?'\x20'+_0x200a67['Contact']['lastName']:''),'body':_0x200a67[_0xef61('0x70')],'direction':_0x200a67['direction']===_0xef61('0xe5')?'A':'C','secret':_0x200a67[_0xef61('0xd5')],'read':_0x200a67[_0xef61('0x7f')]};})[_0xef61('0x5f')]()};return ejs[_0xef61('0xe6')](path[_0xef61('0xcf')](config[_0xef61('0xd0')],_0xef61('0xcc'),_0xef61('0xe7'),_0xef61('0xe8')),{'interaction':_0x3a40e9})[_0xef61('0x2a')](function(_0x57fa3e){return new BPromise(function(_0x2c2e93,_0x3ba93a){pdf[_0xef61('0xb7')](_0x57fa3e,_0x1804ad)[_0xef61('0xe9')](path[_0xef61('0xcf')](_0x432dc8,_0xef61('0xea')+_0x43ec95['id']+'-'+_0x4a7509+_0xef61('0xeb')),function(_0x42f6a2,_0x2c2a64){if(_0x42f6a2)return _0x3ba93a(_0x42f6a2);_0x2c2e93(_0x2c2a64);});});})['then'](function(){return new BPromise(function(_0x2e2c6b,_0x33ca82){zipdir(_0x432dc8,{'saveTo':_0x471206},function(_0x371178,_0x286345){if(_0x371178)return _0x33ca82(_0x371178);return _0x2e2c6b(_0x286345);});})[_0xef61('0x2a')](function(){return new BPromise(function(_0x8f12d5,_0x4088b3){rimraf(_0x432dc8,function(_0x1e4347){if(_0x1e4347)_0x4088b3(_0x1e4347);return _0x8f12d5();});});})[_0xef61('0x2a')](function(){return _0x3ef5fd[_0xef61('0xca')](_0x471206,_0x23a826,function(_0x4ae78e){if(_0x4ae78e){console['log']('err',_0x4ae78e);}else{fs[_0xef61('0xec')](_0x471206);}});});});}else{return _0x3ef5fd[_0xef61('0x21')](0xc8);}})[_0xef61('0x37')](handleError(_0x3ef5fd,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 190e8c1..25e1d70 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 _0x7a59=['SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','unreadMessages','length','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x4a4fc9,_0x4acc29){var _0x322e30=function(_0x2dc64c){while(--_0x2dc64c){_0x4a4fc9['push'](_0x4a4fc9['shift']());}};_0x322e30(++_0x4acc29);}(_0x7a59,0x16e));var _0x97a5=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x7a59[_0x4b7895];return _0x264180;};'use strict';var EventEmitter=require(_0x97a5('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require(_0x97a5('0x1'))['db'][_0x97a5('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x97a5('0x3')](0x0);var events={'afterCreate':_0x97a5('0x4'),'afterUpdate':_0x97a5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3ba155){return function(_0x459c3b,_0x3e1524,_0x48201b){_0x459c3b[_0x97a5('0x6')]({'attributes':['id'],'raw':!![]})[_0x97a5('0x7')](function(_0x2663b9){_0x459c3b[_0x97a5('0x8')](_0x97a5('0x9'),_0x2663b9[_0x97a5('0xa')](function(_0x260690){return{'id':_0x260690['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x459c3b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x97a5('0x7')](function(_0x101c3f){_0x459c3b[_0x97a5('0x8')](_0x97a5('0xb'),_0x101c3f[_0x97a5('0xc')]);SmsInteractionEvents['emit'](_0x3ba155+':'+_0x459c3b['id'],_0x459c3b);SmsInteractionEvents['emit'](_0x3ba155,_0x459c3b);_0x48201b(null);})[_0x97a5('0xd')](_0x48201b(null));};}for(var e in events){if(events[_0x97a5('0xe')](e)){var event=events[e];SmsInteraction[_0x97a5('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x57d4=['exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','findAll','then','length','emit','catch','hasOwnProperty','hook'];(function(_0x5a12e3,_0x487216){var _0x394e7c=function(_0x1df72a){while(--_0x1df72a){_0x5a12e3['push'](_0x5a12e3['shift']());}};_0x394e7c(++_0x487216);}(_0x57d4,0x78));var _0x457d=function(_0x50e600,_0x209469){_0x50e600=_0x50e600-0x0;var _0x16d532=_0x57d4[_0x50e600];return _0x16d532;};'use strict';var EventEmitter=require(_0x457d('0x0'));var SmsInteraction=require(_0x457d('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x457d('0x1'))['db'][_0x457d('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x457d('0x3')](0x0);var events={'afterCreate':_0x457d('0x4'),'afterUpdate':_0x457d('0x5'),'afterDestroy':_0x457d('0x6')};function emitEvent(_0x3e2239){return function(_0x1f5b4e,_0x4745ed,_0x247ec7){_0x1f5b4e[_0x457d('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1fc199){_0x1f5b4e[_0x457d('0x8')]('Users',_0x1fc199['map'](function(_0x24d8ff){return{'id':_0x24d8ff['id']};}));return SmsMessage[_0x457d('0x9')]({'where':{'SmsInteractionId':_0x1f5b4e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x457d('0xa')](function(_0x559024){_0x1f5b4e['setDataValue']('unreadMessages',_0x559024[_0x457d('0xb')]);SmsInteractionEvents[_0x457d('0xc')](_0x3e2239+':'+_0x1f5b4e['id'],_0x1f5b4e);SmsInteractionEvents[_0x457d('0xc')](_0x3e2239,_0x1f5b4e);_0x247ec7(null);})[_0x457d('0xd')](_0x247ec7(null));};}for(var e in events){if(events[_0x457d('0xe')](e)){var event=events[e];SmsInteraction[_0x457d('0xf')](e,emitEvent(event));}}module[_0x457d('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index cdfebea..5ea52d1 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 _0xab44=['closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./smsInteraction.attributes','exports','define','SmsInteraction'];(function(_0x2039ab,_0x2c2608){var _0x49a312=function(_0x3b1f7b){while(--_0x3b1f7b){_0x2039ab['push'](_0x2039ab['shift']());}};_0x49a312(++_0x2c2608);}(_0xab44,0xe2));var _0x4ab4=function(_0x468a62,_0x32674f){_0x468a62=_0x468a62-0x0;var _0x73fdcb=_0xab44[_0x468a62];return _0x73fdcb;};'use strict';var _=require(_0x4ab4('0x0'));var util=require(_0x4ab4('0x1'));var logger=require(_0x4ab4('0x2'))(_0x4ab4('0x3'));var moment=require(_0x4ab4('0x4'));var BPromise=require(_0x4ab4('0x5'));var rp=require(_0x4ab4('0x6'));var fs=require('fs');var path=require(_0x4ab4('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4ab4('0x8'));module[_0x4ab4('0x9')]=function(_0x2629b9,_0x498e85){return _0x2629b9[_0x4ab4('0xa')](_0x4ab4('0xb'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d411f,_0xfdba5f,_0x51c355){if(_0x3d411f['changed']('closed')){_0x3d411f[_0x4ab4('0xc')]=moment()[_0x4ab4('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x51c355(null,_0x3d411f);}}});}; \ No newline at end of file +var _0xe4bd=['lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x502830,_0x2bd982){var _0x48ddda=function(_0x498657){while(--_0x498657){_0x502830['push'](_0x502830['shift']());}};_0x48ddda(++_0x2bd982);}(_0xe4bd,0xa0));var _0xde4b=function(_0x365597,_0x5008b0){_0x365597=_0x365597-0x0;var _0x3fed19=_0xe4bd[_0x365597];return _0x3fed19;};'use strict';var _=require(_0xde4b('0x0'));var util=require('util');var logger=require(_0xde4b('0x1'))('api');var moment=require(_0xde4b('0x2'));var BPromise=require(_0xde4b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde4b('0x4'));var rimraf=require(_0xde4b('0x5'));var config=require(_0xde4b('0x6'));var attributes=require(_0xde4b('0x7'));module[_0xde4b('0x8')]=function(_0x4d63f3,_0x58b805){return _0x4d63f3[_0xde4b('0x9')](_0xde4b('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a7685,_0x4c6a0d,_0x285b9b){if(_0x1a7685[_0xde4b('0xb')](_0xde4b('0xc'))){_0x1a7685[_0xde4b('0xd')]=moment()[_0xde4b('0xe')](_0xde4b('0xf'));}_0x285b9b(null,_0x1a7685);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 3a3f802..d5dc7e3 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 _0x8706=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','ids','omit','spread','AddTags','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x496f06,_0x3f5090){var _0xc42ff5=function(_0x5cb770){while(--_0x5cb770){_0x496f06['push'](_0x496f06['shift']());}};_0xc42ff5(++_0x3f5090);}(_0x8706,0x19e));var _0x6870=function(_0x819b1,_0x25ca36){_0x819b1=_0x819b1-0x0;var _0x15aa26=_0x8706[_0x819b1];return _0x15aa26;};'use strict';var _=require(_0x6870('0x0'));var util=require(_0x6870('0x1'));var moment=require('moment');var BPromise=require(_0x6870('0x2'));var rs=require(_0x6870('0x3'));var fs=require('fs');var Redis=require(_0x6870('0x4'));var db=require(_0x6870('0x5'))['db'];var utils=require(_0x6870('0x6'));var logger=require(_0x6870('0x7'))('rpc');var config=require(_0x6870('0x8'));var jayson=require(_0x6870('0x9'));var client=jayson['client'][_0x6870('0xa')]({'port':0x232a});config[_0x6870('0xb')]=_[_0x6870('0xc')](config[_0x6870('0xb')],{'host':_0x6870('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6870('0xb')]));require('./smsInteraction.socket')[_0x6870('0xe')](socket);function respondWithRpcPromise(_0x7b61dc,_0x12c9c4,_0xadb234){return new BPromise(function(_0x3a46c2,_0x179d61){return client['request'](_0x7b61dc,_0xadb234)[_0x6870('0xf')](function(_0x22de9e){logger[_0x6870('0x10')](_0x6870('0x11'),_0x12c9c4,_0x6870('0x12'));logger['debug'](_0x6870('0x13'),_0x12c9c4,_0x6870('0x12'),JSON[_0x6870('0x14')](_0x22de9e));if(_0x22de9e[_0x6870('0x15')]){if(_0x22de9e[_0x6870('0x15')][_0x6870('0x16')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x12c9c4,_0x22de9e['error'][_0x6870('0x17')]);return _0x179d61(_0x22de9e[_0x6870('0x15')][_0x6870('0x17')]);}logger[_0x6870('0x15')](_0x6870('0x11'),_0x12c9c4,_0x22de9e[_0x6870('0x15')][_0x6870('0x17')]);return _0x3a46c2(_0x22de9e[_0x6870('0x15')][_0x6870('0x17')]);}else{logger['info'](_0x6870('0x11'),_0x12c9c4,'request\x20sent');_0x3a46c2(_0x22de9e[_0x6870('0x18')][_0x6870('0x17')]);}})['catch'](function(_0xfe76b6){logger[_0x6870('0x15')](_0x6870('0x11'),_0x12c9c4,_0xfe76b6);_0x179d61(_0xfe76b6);});});}exports[_0x6870('0x19')]=function(_0x751f4){var _0xfac29b=this;return new Promise(function(_0x1c63b6,_0x517a62){return db[_0x6870('0x1a')][_0x6870('0x1b')](_0x751f4[_0x6870('0x1c')],{'raw':_0x751f4[_0x6870('0x1d')]?_0x751f4[_0x6870('0x1d')][_0x6870('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x751f4[_0x6870('0x1d')]?_0x751f4[_0x6870('0x1d')][_0x6870('0x1f')]||null:null,'attributes':_0x751f4[_0x6870('0x1d')]?_0x751f4[_0x6870('0x1d')][_0x6870('0x20')]||null:null,'limit':_0x751f4[_0x6870('0x1d')]?_0x751f4['options'][_0x6870('0x21')]||null:null})['then'](function(_0x287321){logger['info'](_0x6870('0x19'),_0x751f4);logger['debug'](_0x6870('0x19'),_0x751f4,JSON[_0x6870('0x14')](_0x287321));_0x1c63b6(_0x287321);})['catch'](function(_0x226639){logger['error'](_0x6870('0x19'),_0x226639[_0x6870('0x17')],_0x751f4);_0x517a62(_0xfac29b['error'](0x1f4,_0x226639['message']));});});};exports[_0x6870('0x22')]=function(_0x390296){return new Promise(function(_0x7b1582,_0x59169e){return db['SmsInteraction'][_0x6870('0x23')]({'where':_0x390296['options']?_0x390296[_0x6870('0x1d')][_0x6870('0x1f')]||null:null})['then'](function(_0x421a9a){if(_0x421a9a){return _0x421a9a['addTags'](_0x390296['body'][_0x6870('0x24')],_[_0x6870('0x25')](_0x390296[_0x6870('0x1c')],[_0x6870('0x24'),'id'])||{});}})[_0x6870('0x26')](function(_0x497f84){logger['info'](_0x6870('0x27'),_0x390296);logger[_0x6870('0x28')](_0x6870('0x27'),_0x390296,JSON['stringify'](_0x497f84));_0x7b1582(_0x497f84);})[_0x6870('0x29')](function(_0x2281da){logger[_0x6870('0x15')]('AddTags',_0x2281da['message'],_0x390296);_0x59169e(_this['error'](0x1f4,_0x2281da[_0x6870('0x17')]));});});}; \ No newline at end of file +var _0x8d9e=['socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','ids','body','spread','AddTags','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x8d9e,0x76));var _0xe8d9=function(_0x51d6d9,_0x14be4d){_0x51d6d9=_0x51d6d9-0x0;var _0x5c4525=_0x8d9e[_0x51d6d9];return _0x5c4525;};'use strict';var _=require(_0xe8d9('0x0'));var util=require(_0xe8d9('0x1'));var moment=require('moment');var BPromise=require(_0xe8d9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe8d9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe8d9('0x4'));var logger=require(_0xe8d9('0x5'))(_0xe8d9('0x6'));var config=require(_0xe8d9('0x7'));var jayson=require(_0xe8d9('0x8'));var client=jayson[_0xe8d9('0x9')][_0xe8d9('0xa')]({'port':0x232a});config[_0xe8d9('0xb')]=_[_0xe8d9('0xc')](config[_0xe8d9('0xb')],{'host':_0xe8d9('0xd'),'port':0x18eb});var socket=require(_0xe8d9('0xe'))(new Redis(config[_0xe8d9('0xb')]));require(_0xe8d9('0xf'))[_0xe8d9('0x10')](socket);function respondWithRpcPromise(_0x32c820,_0x386efa,_0xe2f0d7){return new BPromise(function(_0x4c7dbc,_0x3befe7){return client[_0xe8d9('0x11')](_0x32c820,_0xe2f0d7)[_0xe8d9('0x12')](function(_0x440525){logger[_0xe8d9('0x13')](_0xe8d9('0x14'),_0x386efa,_0xe8d9('0x15'));logger[_0xe8d9('0x16')](_0xe8d9('0x17'),_0x386efa,'request\x20sent',JSON[_0xe8d9('0x18')](_0x440525));if(_0x440525[_0xe8d9('0x19')]){if(_0x440525[_0xe8d9('0x19')][_0xe8d9('0x1a')]===0x1f4){logger[_0xe8d9('0x19')](_0xe8d9('0x14'),_0x386efa,_0x440525['error'][_0xe8d9('0x1b')]);return _0x3befe7(_0x440525['error'][_0xe8d9('0x1b')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x386efa,_0x440525[_0xe8d9('0x19')][_0xe8d9('0x1b')]);return _0x4c7dbc(_0x440525[_0xe8d9('0x19')][_0xe8d9('0x1b')]);}else{logger[_0xe8d9('0x13')](_0xe8d9('0x14'),_0x386efa,'request\x20sent');_0x4c7dbc(_0x440525[_0xe8d9('0x1c')]['message']);}})[_0xe8d9('0x1d')](function(_0x5e65a3){logger['error'](_0xe8d9('0x14'),_0x386efa,_0x5e65a3);_0x3befe7(_0x5e65a3);});});}exports[_0xe8d9('0x1e')]=function(_0x131113){var _0x4894df=this;return new Promise(function(_0x568dad,_0x1149aa){return db[_0xe8d9('0x1f')][_0xe8d9('0x20')](_0x131113['body'],{'raw':_0x131113[_0xe8d9('0x21')]?_0x131113[_0xe8d9('0x21')][_0xe8d9('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x131113[_0xe8d9('0x21')]?_0x131113[_0xe8d9('0x21')][_0xe8d9('0x23')]||null:null,'attributes':_0x131113[_0xe8d9('0x21')]?_0x131113[_0xe8d9('0x21')][_0xe8d9('0x24')]||null:null,'limit':_0x131113[_0xe8d9('0x21')]?_0x131113['options'][_0xe8d9('0x25')]||null:null})[_0xe8d9('0x12')](function(_0xa85006){logger[_0xe8d9('0x13')](_0xe8d9('0x1e'),_0x131113);logger[_0xe8d9('0x16')]('UpdateSmsInteraction',_0x131113,JSON[_0xe8d9('0x18')](_0xa85006));_0x568dad(_0xa85006);})[_0xe8d9('0x1d')](function(_0x9dd945){logger[_0xe8d9('0x19')](_0xe8d9('0x1e'),_0x9dd945[_0xe8d9('0x1b')],_0x131113);_0x1149aa(_0x4894df[_0xe8d9('0x19')](0x1f4,_0x9dd945[_0xe8d9('0x1b')]));});});};exports[_0xe8d9('0x26')]=function(_0x153e6a){return new Promise(function(_0x197dd3,_0x441988){return db[_0xe8d9('0x1f')][_0xe8d9('0x27')]({'where':_0x153e6a['options']?_0x153e6a[_0xe8d9('0x21')][_0xe8d9('0x23')]||null:null})[_0xe8d9('0x12')](function(_0x170ca4){if(_0x170ca4){return _0x170ca4['addTags'](_0x153e6a['body'][_0xe8d9('0x28')],_['omit'](_0x153e6a[_0xe8d9('0x29')],['ids','id'])||{});}})[_0xe8d9('0x2a')](function(_0x1da920){logger[_0xe8d9('0x13')](_0xe8d9('0x2b'),_0x153e6a);logger['debug']('AddTags',_0x153e6a,JSON[_0xe8d9('0x18')](_0x1da920));_0x197dd3(_0x1da920);})[_0xe8d9('0x1d')](function(_0x1be1e2){logger[_0xe8d9('0x19')]('AddTags',_0x1be1e2['message'],_0x153e6a);_0x441988(_this[_0xe8d9('0x19')](0x1f4,_0x1be1e2[_0xe8d9('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index f0d681d..b329e21 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 _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x3cc05d,_0x4b8f88){var _0x28b736=function(_0x369b0e){while(--_0x369b0e){_0x3cc05d['push'](_0x3cc05d['shift']());}};_0x28b736(++_0x4b8f88);}(_0x2032,0xd9));var _0x2203=function(_0x1e5985,_0x4076ba){_0x1e5985=_0x1e5985-0x0;var _0x5ce7b8=_0x2032[_0x1e5985];return _0x5ce7b8;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file +var _0xbaf0=['removeListener','register','length','smsInteraction:','save','remove','update'];(function(_0xfa0cfe,_0xbcbeac){var _0x2b34f7=function(_0x59f10a){while(--_0x59f10a){_0xfa0cfe['push'](_0xfa0cfe['shift']());}};_0x2b34f7(++_0xbcbeac);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){SmsInteractionEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);SmsInteractionEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 9b75f7f..87c2478 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 _0xf682=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','post','tracked','sms','/:id/status','status','put','/:id/accept','/:id/reject','delete','destroy'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf682,0x153));var _0x2f68=function(_0x8d45fe,_0x570f19){_0x8d45fe=_0x8d45fe-0x0;var _0x797d6a=_0xf682[_0x8d45fe];return _0x797d6a;};'use strict';var multer=require(_0x2f68('0x0'));var util=require('util');var path=require(_0x2f68('0x1'));var timeout=require(_0x2f68('0x2'));var express=require(_0x2f68('0x3'));var router=express[_0x2f68('0x4')]();var auth=require(_0x2f68('0x5'));var interaction=require(_0x2f68('0x6'));var config=require(_0x2f68('0x7'));var controller=require(_0x2f68('0x8'));router['get']('/',auth[_0x2f68('0x9')](),controller[_0x2f68('0xa')]);router[_0x2f68('0xb')](_0x2f68('0xc'),auth[_0x2f68('0x9')](),controller[_0x2f68('0xd')]);router[_0x2f68('0xb')](_0x2f68('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x2f68('0xf')]('/',auth[_0x2f68('0x9')](),interaction[_0x2f68('0x10')](_0x2f68('0x11'),'smsmessage:create'),controller['create']);router[_0x2f68('0xf')](_0x2f68('0x12'),controller[_0x2f68('0x13')]);router[_0x2f68('0x14')](_0x2f68('0xe'),auth[_0x2f68('0x9')](),controller['update']);router['put'](_0x2f68('0x15'),auth[_0x2f68('0x9')](),controller['accept']);router[_0x2f68('0x14')](_0x2f68('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0x2f68('0x17')](_0x2f68('0xe'),auth[_0x2f68('0x9')](),controller[_0x2f68('0x18')]);module[_0x2f68('0x19')]=router; \ No newline at end of file +var _0x1fbc=['reject','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','show','post','tracked','sms','create','/:id/status','status','put','/:id','update','/:id/accept','accept','/:id/reject'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x1fbc,0x197));var _0xc1fb=function(_0x167ace,_0x2e576c){_0x167ace=_0x167ace-0x0;var _0x5a1737=_0x1fbc[_0x167ace];return _0x5a1737;};'use strict';var multer=require(_0xc1fb('0x0'));var util=require(_0xc1fb('0x1'));var path=require(_0xc1fb('0x2'));var timeout=require(_0xc1fb('0x3'));var express=require(_0xc1fb('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc1fb('0x5'));var config=require(_0xc1fb('0x6'));var controller=require(_0xc1fb('0x7'));router[_0xc1fb('0x8')]('/',auth[_0xc1fb('0x9')](),controller[_0xc1fb('0xa')]);router[_0xc1fb('0x8')](_0xc1fb('0xb'),auth[_0xc1fb('0x9')](),controller['describe']);router[_0xc1fb('0x8')]('/:id',auth[_0xc1fb('0x9')](),controller[_0xc1fb('0xc')]);router[_0xc1fb('0xd')]('/',auth[_0xc1fb('0x9')](),interaction[_0xc1fb('0xe')](_0xc1fb('0xf'),'smsmessage:create'),controller[_0xc1fb('0x10')]);router[_0xc1fb('0xd')](_0xc1fb('0x11'),controller[_0xc1fb('0x12')]);router[_0xc1fb('0x13')](_0xc1fb('0x14'),auth[_0xc1fb('0x9')](),controller[_0xc1fb('0x15')]);router['put'](_0xc1fb('0x16'),auth['isAuthenticated'](),controller[_0xc1fb('0x17')]);router[_0xc1fb('0x13')](_0xc1fb('0x18'),auth[_0xc1fb('0x9')](),controller[_0xc1fb('0x19')]);router['delete']('/:id',auth[_0xc1fb('0x9')](),controller[_0xc1fb('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 2de22fd..6059180 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 _0x283d=['medium','BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0x2cff4b,_0x1cd2a0){var _0x240cf5=function(_0x3673e3){while(--_0x3673e3){_0x2cff4b['push'](_0x2cff4b['shift']());}};_0x240cf5(++_0x1cd2a0);}(_0x283d,0x9f));var _0xd283=function(_0x460dae,_0x3a907f){_0x460dae=_0x460dae-0x0;var _0x36e6d0=_0x283d[_0x460dae];return _0x36e6d0;};'use strict';var Sequelize=require(_0xd283('0x0'));module[_0xd283('0x1')]={'body':{'type':Sequelize['TEXT'](_0xd283('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd283('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd283('0x4')]('in',_0xd283('0x5')),'defaultValue':_0xd283('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd283('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3bff=['medium','ENUM','out','STRING','DATE','sequelize','TEXT'];(function(_0x160dec,_0x16b986){var _0x306210=function(_0x4f8bca){while(--_0x4f8bca){_0x160dec['push'](_0x160dec['shift']());}};_0x306210(++_0x16b986);}(_0x3bff,0xd0));var _0xf3bf=function(_0x3dd60f,_0x4566bd){_0x3dd60f=_0x3dd60f-0x0;var _0x2cb70e=_0x3bff[_0x3dd60f];return _0x2cb70e;};'use strict';var Sequelize=require(_0xf3bf('0x0'));module['exports']={'body':{'type':Sequelize[_0xf3bf('0x1')](_0xf3bf('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf3bf('0x3')]('in',_0xf3bf('0x4')),'defaultValue':_0xf3bf('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf3bf('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xf3bf('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 0da8cb4..08d81a0 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 _0xd566=['results','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','request\x20sent','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','send','map','SmsMessage','type','key','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','name','includeAll','include','rows','show','params','rawAttributes','length','options','find','create','body','describe','../../config/logger','sms-interactions','accept','read','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','user','role','stringify','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','sms','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','messageId','indexOf','Status','plivio','infobip'];(function(_0x31c6bd,_0x1171f6){var _0x338c22=function(_0x5c25f5){while(--_0x5c25f5){_0x31c6bd['push'](_0x31c6bd['shift']());}};_0x338c22(++_0x1171f6);}(_0xd566,0x8e));var _0x6d56=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd566[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0x6d56('0x0'));var emlformat=require(_0x6d56('0x1'));var rimraf=require(_0x6d56('0x2'));var zipdir=require(_0x6d56('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d56('0x4'));var moment=require(_0x6d56('0x5'));var BPromise=require(_0x6d56('0x6'));var Mustache=require(_0x6d56('0x7'));var util=require(_0x6d56('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6d56('0x9'));var ejs=require(_0x6d56('0xa'));var fs=require('fs');var _=require(_0x6d56('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6d56('0xc'));var toCsv=require(_0x6d56('0x9'));var querystring=require(_0x6d56('0xd'));var Papa=require(_0x6d56('0xe'));var Redis=require(_0x6d56('0xf'));var authService=require(_0x6d56('0x10'));var qs=require(_0x6d56('0x11'));var as=require(_0x6d56('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6d56('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6d56('0x14'))['db'];config[_0x6d56('0x15')]=_[_0x6d56('0x16')](config[_0x6d56('0x15')],{'host':_0x6d56('0x17'),'port':0x18eb});var socket=require(_0x6d56('0x18'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x6d56('0x19')](socket);var jayson=require(_0x6d56('0x1a'));var client=jayson['client'][_0x6d56('0x1b')]({'port':0x232c});var client9002=jayson[_0x6d56('0x1c')][_0x6d56('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x33013a,_0x2aa29b,_0x4fcc84){if(_0x4fcc84){var _0x520f16=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x520f16[_0x6d56('0x1d')](_0x2aa29b)){return _0x33013a;}else{throw new db[(_0x6d56('0x1e'))][(_0x6d56('0x1f'))](_0x6d56('0x20'));}}else{return _0x33013a;}}function respondWithRpcPromise(_0x368b2e,_0x3a4b37,_0x3ffee7,_0x365de9){return new BPromise(function(_0x661b89,_0x4c60ef){var _0x30ba82=_0x365de9||client;return _0x30ba82[_0x6d56('0x21')](_0x368b2e,_0x3ffee7)[_0x6d56('0x22')](function(_0x4bd7b6){logger[_0x6d56('0x23')]('SmsMessage,\x20%s,\x20%s',_0x3a4b37,'request\x20sent');logger[_0x6d56('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3a4b37,_0x6d56('0x25'),JSON['stringify'](_0x4bd7b6));if(_0x4bd7b6[_0x6d56('0x26')]){if(_0x4bd7b6[_0x6d56('0x26')][_0x6d56('0x27')]===0x1f4){logger[_0x6d56('0x26')](_0x6d56('0x28'),_0x3a4b37,_0x4bd7b6[_0x6d56('0x26')][_0x6d56('0x29')]);return _0x4c60ef(_0x4bd7b6['error'][_0x6d56('0x29')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x3a4b37,_0x4bd7b6[_0x6d56('0x26')]['message']);return _0x661b89(_0x4bd7b6[_0x6d56('0x26')][_0x6d56('0x29')]);}else{logger['info'](_0x6d56('0x28'),_0x3a4b37,_0x6d56('0x25'));_0x661b89(_0x4bd7b6[_0x6d56('0x2a')][_0x6d56('0x29')]);}})[_0x6d56('0x2b')](function(_0x54b8f2){logger[_0x6d56('0x26')](_0x6d56('0x28'),_0x3a4b37,_0x54b8f2);_0x4c60ef(_0x54b8f2);});});}function respondWithStatusCode(_0x4dffee,_0x582299){_0x582299=_0x582299||0xcc;return function(_0x31e68e){if(_0x31e68e){return _0x4dffee[_0x6d56('0x2c')](_0x582299);}return _0x4dffee[_0x6d56('0x2d')](_0x582299)[_0x6d56('0x2e')]();};}function respondWithResult(_0x52d45b,_0x4e5e46){_0x4e5e46=_0x4e5e46||0xc8;return function(_0xfa466d){if(_0xfa466d){return _0x52d45b[_0x6d56('0x2d')](_0x4e5e46)[_0x6d56('0x2f')](_0xfa466d);}};}function respondWithFilteredResult(_0x1ddbb3,_0x4cd1d9){return function(_0x555f44){if(_0x555f44){var _0x1b3685=_0x555f44[_0x6d56('0x30')],_0x864e77=_0x4cd1d9[_0x6d56('0x31')],_0x1b5a6a=_0x4cd1d9['offset']+_0x4cd1d9[_0x6d56('0x32')],_0x1074e6;if(_0x1b5a6a>=_0x1b3685){_0x1b5a6a=_0x1b3685;_0x1074e6=0xc8;}else{_0x1074e6=0xce;}_0x1ddbb3[_0x6d56('0x2d')](_0x1074e6);return _0x1ddbb3[_0x6d56('0x33')](_0x6d56('0x34'),_0x864e77+'-'+_0x1b5a6a+'/'+_0x1b3685)[_0x6d56('0x2f')](_0x555f44);}return null;};}function patchUpdates(_0x5c2c0d){return function(_0x263d91){try{jsonpatch[_0x6d56('0x35')](_0x263d91,_0x5c2c0d,!![]);}catch(_0x1742ab){return BPromise[_0x6d56('0x36')](_0x1742ab);}return _0x263d91[_0x6d56('0x37')]();};}function saveUpdates(_0x17788f,_0x5438c2){return function(_0x5a89b6){if(_0x5a89b6){return _0x5a89b6[_0x6d56('0x38')](_0x17788f)[_0x6d56('0x22')](function(_0x378946){return _0x378946;});}return null;};}function removeEntity(_0x4314f8,_0x50409a){return function(_0x1d217e){if(_0x1d217e){return _0x1d217e[_0x6d56('0x39')]()[_0x6d56('0x22')](function(){_0x4314f8[_0x6d56('0x2d')](0xcc)[_0x6d56('0x2e')]();});}};}function handleEntityNotFound(_0x11636b,_0x5a04a1){return function(_0xc721fa){if(!_0xc721fa){_0x11636b[_0x6d56('0x2c')](0x194);}return _0xc721fa;};}function handleError(_0x2d3beb,_0x5df822){_0x5df822=_0x5df822||0x1f4;return function(_0x33a055){logger[_0x6d56('0x26')](_0x33a055[_0x6d56('0x3a')]);if(_0x33a055['name']){delete _0x33a055['name'];}_0x2d3beb[_0x6d56('0x2d')](_0x5df822)[_0x6d56('0x3b')](_0x33a055);};}exports['index']=function(_0xf2d870,_0x58d5c6){var _0x35652c={},_0x3f594b={},_0x51330a={'count':0x0,'rows':[]};var _0x41b9b7=_[_0x6d56('0x3c')](db[_0x6d56('0x3d')]['rawAttributes'],function(_0x1f91ba){return{'name':_0x1f91ba['fieldName'],'type':_0x1f91ba[_0x6d56('0x3e')][_0x6d56('0x3f')]};});_0x3f594b['model']=_['map'](_0x41b9b7,'name');_0x3f594b[_0x6d56('0x40')]=_['keys'](_0xf2d870[_0x6d56('0x40')]);_0x3f594b['filters']=_[_0x6d56('0x41')](_0x3f594b[_0x6d56('0x42')],_0x3f594b['query']);_0x35652c[_0x6d56('0x43')]=_[_0x6d56('0x41')](_0x3f594b[_0x6d56('0x42')],qs[_0x6d56('0x44')](_0xf2d870[_0x6d56('0x40')]['fields']));_0x35652c[_0x6d56('0x43')]=_0x35652c[_0x6d56('0x43')]['length']?_0x35652c[_0x6d56('0x43')]:_0x3f594b[_0x6d56('0x42')];if(!_0xf2d870['query'][_0x6d56('0x45')]('nolimit')){_0x35652c[_0x6d56('0x32')]=qs[_0x6d56('0x32')](_0xf2d870[_0x6d56('0x40')][_0x6d56('0x32')]);_0x35652c['offset']=qs[_0x6d56('0x31')](_0xf2d870[_0x6d56('0x40')][_0x6d56('0x31')]);}_0x35652c[_0x6d56('0x46')]=qs['sort'](_0xf2d870[_0x6d56('0x40')][_0x6d56('0x47')]);_0x35652c[_0x6d56('0x48')]=qs[_0x6d56('0x49')](_['pick'](_0xf2d870[_0x6d56('0x40')],_0x3f594b['filters']));if(_0xf2d870[_0x6d56('0x40')][_0x6d56('0x4a')]){_0x35652c['where']=_[_0x6d56('0x4b')](_0x35652c[_0x6d56('0x48')],{'$or':_[_0x6d56('0x3c')](_0x41b9b7,function(_0x4ab231){if(_0x4ab231[_0x6d56('0x3e')]!==_0x6d56('0x4c')){var _0xf42425={};_0xf42425[_0x4ab231[_0x6d56('0x4d')]]={'$like':'%'+_0xf2d870['query'][_0x6d56('0x4a')]+'%'};return _0xf42425;}})});}_0x35652c=_[_0x6d56('0x4b')]({},_0x35652c,_0xf2d870['options']);var _0x17f801={'where':_0x35652c[_0x6d56('0x48')]};return db[_0x6d56('0x3d')][_0x6d56('0x30')](_0x17f801)['then'](function(_0x451c7e){_0x51330a[_0x6d56('0x30')]=_0x451c7e;if(_0xf2d870[_0x6d56('0x40')][_0x6d56('0x4e')]){_0x35652c[_0x6d56('0x4f')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x35652c);})[_0x6d56('0x22')](function(_0x38cc7a){_0x51330a[_0x6d56('0x50')]=_0x38cc7a;return _0x51330a;})[_0x6d56('0x22')](respondWithFilteredResult(_0x58d5c6,_0x35652c))['catch'](handleError(_0x58d5c6,null));};exports[_0x6d56('0x51')]=function(_0x31085d,_0x110a25){var _0x2ac50a={'raw':!![],'where':{'id':_0x31085d[_0x6d56('0x52')]['id']}},_0x19f977={};_0x19f977[_0x6d56('0x42')]=_['keys'](db['SmsMessage'][_0x6d56('0x53')]);_0x19f977[_0x6d56('0x40')]=_['keys'](_0x31085d['query']);_0x19f977[_0x6d56('0x49')]=_['intersection'](_0x19f977[_0x6d56('0x42')],_0x19f977[_0x6d56('0x40')]);_0x2ac50a[_0x6d56('0x43')]=_[_0x6d56('0x41')](_0x19f977[_0x6d56('0x42')],qs[_0x6d56('0x44')](_0x31085d[_0x6d56('0x40')][_0x6d56('0x44')]));_0x2ac50a[_0x6d56('0x43')]=_0x2ac50a[_0x6d56('0x43')][_0x6d56('0x54')]?_0x2ac50a[_0x6d56('0x43')]:_0x19f977[_0x6d56('0x42')];if(_0x31085d[_0x6d56('0x40')][_0x6d56('0x4e')]){_0x2ac50a[_0x6d56('0x4f')]=[{'all':!![]}];}_0x2ac50a=_[_0x6d56('0x4b')]({},_0x2ac50a,_0x31085d[_0x6d56('0x55')]);return db[_0x6d56('0x3d')][_0x6d56('0x56')](_0x2ac50a)[_0x6d56('0x22')](handleEntityNotFound(_0x110a25,null))['then'](respondWithResult(_0x110a25,null))[_0x6d56('0x2b')](handleError(_0x110a25,null));};exports[_0x6d56('0x57')]=function(_0x2ccf4e,_0x5b4256){return db['SmsMessage'][_0x6d56('0x57')](_0x2ccf4e[_0x6d56('0x58')],{})[_0x6d56('0x22')](respondWithResult(_0x5b4256,0xc9))[_0x6d56('0x2b')](handleError(_0x5b4256,null));};exports['update']=function(_0x592ea7,_0x4e932c){if(_0x592ea7[_0x6d56('0x58')]['id']){delete _0x592ea7['body']['id'];}return db[_0x6d56('0x3d')][_0x6d56('0x56')]({'where':{'id':_0x592ea7['params']['id']}})[_0x6d56('0x22')](handleEntityNotFound(_0x4e932c,null))[_0x6d56('0x22')](saveUpdates(_0x592ea7[_0x6d56('0x58')],null))[_0x6d56('0x22')](respondWithResult(_0x4e932c,null))[_0x6d56('0x2b')](handleError(_0x4e932c,null));};exports[_0x6d56('0x39')]=function(_0x422885,_0x2ba644){return db[_0x6d56('0x3d')][_0x6d56('0x56')]({'where':{'id':_0x422885[_0x6d56('0x52')]['id']}})[_0x6d56('0x22')](handleEntityNotFound(_0x2ba644,null))[_0x6d56('0x22')](removeEntity(_0x2ba644,null))[_0x6d56('0x2b')](handleError(_0x2ba644,null));};exports[_0x6d56('0x59')]=function(_0x2f78b0,_0x369122){return db[_0x6d56('0x3d')]['describe']()[_0x6d56('0x22')](respondWithResult(_0x369122,null))[_0x6d56('0x2b')](handleError(_0x369122,null));};var interaction_log=require(_0x6d56('0x5a'))(_0x6d56('0x5b'));exports[_0x6d56('0x5c')]=function(_0x230e8a,_0x2b0d67,_0x111ee0){var _0x4b9f4e={'channel':'sms'};if(_0x230e8a[_0x6d56('0x58')]['id']){delete _0x230e8a[_0x6d56('0x58')]['id'];}_0x230e8a[_0x6d56('0x58')][_0x6d56('0x5d')]=!![];_0x230e8a[_0x6d56('0x58')]['readAt']=moment()['format'](_0x6d56('0x5e'));_0x230e8a['body'][_0x6d56('0x5f')]=_0x230e8a[_0x6d56('0x58')][_0x6d56('0x5f')]||_0x230e8a['user']['id'];return db[_0x6d56('0x3d')][_0x6d56('0x56')]({'where':{'id':_0x230e8a[_0x6d56('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x6d56('0x60')],'as':_0x6d56('0x61')}]})[_0x6d56('0x22')](handleEntityNotFound(_0x2b0d67,null))[_0x6d56('0x22')](saveUpdates(_0x230e8a[_0x6d56('0x58')],null))['then'](function(_0x408991){if(_0x408991){_0x4b9f4e[_0x6d56('0x29')]=_0x408991[_0x6d56('0x62')]({'plain':!![]});return db[_0x6d56('0x63')]['find']({'where':{'id':_0x408991[_0x6d56('0x64')]}});}return null;})[_0x6d56('0x22')](handleEntityNotFound(_0x2b0d67,null))[_0x6d56('0x22')](function(_0x427d5a){if(_0x427d5a){return _0x427d5a[_0x6d56('0x38')]({'UserId':_0x230e8a[_0x6d56('0x58')]['UserId'],'read1stAt':_[_0x6d56('0x65')](_0x427d5a[_0x6d56('0x66')])?moment()[_0x6d56('0x67')](_0x6d56('0x5e')):undefined});}return null;})[_0x6d56('0x22')](function(_0x718ae7){if(_0x718ae7){_0x4b9f4e[_0x6d56('0x68')]=_0x718ae7[_0x6d56('0x62')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x230e8a[_0x6d56('0x69')]['id'],_0x230e8a[_0x6d56('0x69')][_0x6d56('0x4d')],_0x230e8a[_0x6d56('0x69')][_0x6d56('0x6a')],_0x4b9f4e[_0x6d56('0x68')]['id'],_0x230e8a[_0x6d56('0x58')]?JSON[_0x6d56('0x6b')](_0x230e8a[_0x6d56('0x58')]):_0x6d56('0x6c'));return respondWithRpcPromise(_0x6d56('0x6d'),_0x6d56('0x6e'),_0x4b9f4e);}return null;})[_0x6d56('0x22')](function(_0x47832d){if(_0x47832d){if(_0x230e8a[_0x6d56('0x58')][_0x6d56('0x6f')]){_0x4b9f4e[_0x6d56('0x29')]['interface']=util['format'](_0x6d56('0x70'),_0x230e8a[_0x6d56('0x69')][_0x6d56('0x4d')]);_0x4b9f4e[_0x6d56('0x29')][_0x6d56('0x71')]=_0x4b9f4e[_0x6d56('0x71')];_0x4b9f4e['message'][_0x6d56('0x72')]=_0x6d56('0x5c');return respondWithRpcPromise(_0x6d56('0x73'),_0x6d56('0x73'),{'event':_0x6d56('0x74'),'message':_0x4b9f4e[_0x6d56('0x29')]},client9002)[_0x6d56('0x22')](function(){return _0x4b9f4e;});}return _0x4b9f4e;}return null;})[_0x6d56('0x22')](respondWithResult(_0x2b0d67,null))['catch'](handleError(_0x2b0d67,null));};var interaction_log=require(_0x6d56('0x5a'))(_0x6d56('0x5b'));exports[_0x6d56('0x36')]=function(_0xf57e6c,_0x4080ea,_0x51f77b){var _0x5cc1c5={'agent':{},'channel':_0x6d56('0x75')};if(_0xf57e6c['body']['id']){delete _0xf57e6c[_0x6d56('0x58')]['id'];}_0xf57e6c[_0x6d56('0x58')][_0x6d56('0x5f')]=_0xf57e6c[_0x6d56('0x58')][_0x6d56('0x5f')]||_0xf57e6c[_0x6d56('0x69')]['id'];_0x5cc1c5[_0x6d56('0x76')]['id']=_0xf57e6c[_0x6d56('0x58')]['UserId'];return db['SmsMessage'][_0x6d56('0x56')]({'where':{'id':_0xf57e6c[_0x6d56('0x52')]['id'],'UserId':null}})[_0x6d56('0x22')](handleEntityNotFound(_0x4080ea,null))[_0x6d56('0x22')](function(_0x5c1f43){if(_0x5c1f43){_0x5cc1c5[_0x6d56('0x29')]=_0x5c1f43['get']({'plain':!![]});return db[_0x6d56('0x63')][_0x6d56('0x56')]({'where':{'id':_0x5c1f43['SmsInteractionId']}});}return null;})[_0x6d56('0x22')](handleEntityNotFound(_0x4080ea,null))[_0x6d56('0x22')](function(_0x4565b7){if(_0x4565b7){_0x5cc1c5[_0x6d56('0x68')]=_0x4565b7[_0x6d56('0x62')]({'plain':!![]});interaction_log[_0x6d56('0x23')](_0x6d56('0x77'),_0xf57e6c[_0x6d56('0x69')]['id'],_0xf57e6c[_0x6d56('0x69')][_0x6d56('0x4d')],_0xf57e6c[_0x6d56('0x69')][_0x6d56('0x6a')],_0x5cc1c5[_0x6d56('0x68')]['id'],_0xf57e6c['body']?JSON[_0x6d56('0x6b')](_0xf57e6c[_0x6d56('0x58')]):_0x6d56('0x6c'));return respondWithRpcPromise(_0x6d56('0x78'),_0x6d56('0x79'),_0x5cc1c5);}return null;})[_0x6d56('0x22')](function(_0x3c8fd1){if(_0x3c8fd1){_0x3c8fd1['message'][_0x6d56('0x7a')]=util[_0x6d56('0x67')](_0x6d56('0x70'),_0xf57e6c['user'][_0x6d56('0x4d')]);_0x3c8fd1[_0x6d56('0x29')]['channel']=_0x5cc1c5['channel'];_0x3c8fd1['message']['event']=_0x6d56('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':_0x6d56('0x7b'),'message':_0x3c8fd1[_0x6d56('0x29')]},client9002);return _0x5cc1c5;}return null;})[_0x6d56('0x22')](respondWithResult(_0x4080ea,null))[_0x6d56('0x2b')](handleError(_0x4080ea,null));};exports['status']=function(_0x101a16,_0x263f96,_0x598329){if(_0x101a16['body']['id']){delete _0x101a16['body']['id'];}var _0x5bc874;return db[_0x6d56('0x3d')][_0x6d56('0x56')]({'where':{'id':_0x101a16[_0x6d56('0x52')]['id']}})[_0x6d56('0x22')](handleEntityNotFound(_0x263f96,null))[_0x6d56('0x22')](function(_0x5d42f2){if(_0x5d42f2){_0x5bc874=_0x5d42f2;return db[_0x6d56('0x7c')][_0x6d56('0x56')]({'where':{'id':_0x5d42f2['SmsAccountId']}});}})[_0x6d56('0x22')](handleEntityNotFound(_0x263f96,null))['then'](function(_0x41fae3){if(_0x41fae3){logger[_0x6d56('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6d56('0x2d'),_0x6d56('0x7d'),_0x41fae3[_0x6d56('0x3e')],util[_0x6d56('0x7e')](_0x101a16[_0x6d56('0x58')],{'showHidden':![],'depth':null}));switch(_0x41fae3[_0x6d56('0x3e')]){case _0x6d56('0x7f'):if(_0x101a16[_0x6d56('0x58')][_0x6d56('0x80')]&&_0x101a16[_0x6d56('0x58')][_0x6d56('0x80')]===_0x5bc874['messageId']){return _0x5bc874[_0x6d56('0x38')]({'read':!![]});}else{logger[_0x6d56('0x26')](_0x6d56('0x81'),_0x6d56('0x2d'),_0x6d56('0x7f'),util[_0x6d56('0x7e')](_0x101a16[_0x6d56('0x58')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x101a16['body'][_0x6d56('0x82')]&&_0x101a16[_0x6d56('0x58')]['MessageUUID']===_0x5bc874[_0x6d56('0x83')]&&_[_0x6d56('0x84')](['sent','delivered'],_0x101a16[_0x6d56('0x58')][_0x6d56('0x85')])>=0x0){return _0x5bc874[_0x6d56('0x38')]({'read':!![]});}else{logger[_0x6d56('0x26')](_0x6d56('0x81'),_0x6d56('0x2d'),_0x6d56('0x86'),util[_0x6d56('0x7e')](_0x101a16[_0x6d56('0x58')],{'showHidden':![],'depth':null}));}break;case _0x6d56('0x87'):var _0x5cbc78=_0x101a16[_0x6d56('0x58')][_0x6d56('0x88')][0x0];if(_0x5cbc78[_0x6d56('0x2d')][_0x6d56('0x89')]===_0x6d56('0x8a')){return _0x5bc874['update']({'read':!![]});}else{logger[_0x6d56('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6d56('0x2d'),'infobip',util[_0x6d56('0x7e')](_0x101a16['body'],{'showHidden':![],'depth':null}));}break;}return _0x5bc874;}})[_0x6d56('0x22')](respondWithResult(_0x263f96,null))[_0x6d56('0x2b')](handleError(_0x263f96,null));}; \ No newline at end of file +var _0xda72=['[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SIP/%s','channel','event','EventManager','acceptmessage','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','reject','save','update','destroy','sendStatus','stack','name','map','rawAttributes','fieldName','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','SmsMessage','includeAll','findAll','rows','params','include','merge','create','body','find','describe','../../config/logger','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','interaction'];(function(_0xd22c5e,_0x327519){var _0x44b9f5=function(_0x3ad9fe){while(--_0x3ad9fe){_0xd22c5e['push'](_0xd22c5e['shift']());}};_0x44b9f5(++_0x327519);}(_0xda72,0x135));var _0x2da7=function(_0x261b63,_0x6b7ddf){_0x261b63=_0x261b63-0x0;var _0x202084=_0xda72[_0x261b63];return _0x202084;};'use strict';var pdf=require(_0x2da7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2da7('0x1'));var zipdir=require(_0x2da7('0x2'));var jsonpatch=require(_0x2da7('0x3'));var rp=require(_0x2da7('0x4'));var moment=require(_0x2da7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2da7('0x6'));var util=require(_0x2da7('0x7'));var path=require(_0x2da7('0x8'));var sox=require('sox');var csv=require(_0x2da7('0x9'));var ejs=require(_0x2da7('0xa'));var fs=require('fs');var _=require(_0x2da7('0xb'));var squel=require(_0x2da7('0xc'));var crypto=require('crypto');var jsforce=require(_0x2da7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2da7('0x9'));var querystring=require(_0x2da7('0xe'));var Papa=require(_0x2da7('0xf'));var Redis=require(_0x2da7('0x10'));var authService=require(_0x2da7('0x11'));var qs=require(_0x2da7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2da7('0x13'));var logger=require('../../config/logger')(_0x2da7('0x14'));var utils=require(_0x2da7('0x15'));var config=require(_0x2da7('0x16'));var db=require('../../mysqldb')['db'];config[_0x2da7('0x17')]=_['defaults'](config['redis'],{'host':_0x2da7('0x18'),'port':0x18eb});var socket=require(_0x2da7('0x19'))(new Redis(config[_0x2da7('0x17')]));require(_0x2da7('0x1a'))[_0x2da7('0x1b')](socket);var jayson=require(_0x2da7('0x1c'));var client=jayson[_0x2da7('0x1d')][_0x2da7('0x1e')]({'port':0x232c});var client9002=jayson[_0x2da7('0x1d')][_0x2da7('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x528d66,_0x3948d9,_0x4d39ee){if(_0x4d39ee){var _0x326c41=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x326c41[_0x2da7('0x1f')](_0x3948d9)){return _0x528d66;}else{throw new db[(_0x2da7('0x20'))][(_0x2da7('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x528d66;}}function respondWithRpcPromise(_0x7e9e42,_0x3ca519,_0x34fdbc,_0x16d4ff){return new BPromise(function(_0x4e3af6,_0x2e113e){var _0x51a41a=_0x16d4ff||client;return _0x51a41a[_0x2da7('0x22')](_0x7e9e42,_0x34fdbc)[_0x2da7('0x23')](function(_0x4167b4){logger[_0x2da7('0x24')](_0x2da7('0x25'),_0x3ca519,_0x2da7('0x26'));logger[_0x2da7('0x27')](_0x2da7('0x28'),_0x3ca519,'request\x20sent',JSON[_0x2da7('0x29')](_0x4167b4));if(_0x4167b4[_0x2da7('0x2a')]){if(_0x4167b4['error'][_0x2da7('0x2b')]===0x1f4){logger[_0x2da7('0x2a')](_0x2da7('0x25'),_0x3ca519,_0x4167b4[_0x2da7('0x2a')]['message']);return _0x2e113e(_0x4167b4[_0x2da7('0x2a')][_0x2da7('0x2c')]);}logger[_0x2da7('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x3ca519,_0x4167b4[_0x2da7('0x2a')][_0x2da7('0x2c')]);return _0x4e3af6(_0x4167b4['error'][_0x2da7('0x2c')]);}else{logger[_0x2da7('0x24')]('SmsMessage,\x20%s,\x20%s',_0x3ca519,_0x2da7('0x26'));_0x4e3af6(_0x4167b4['result'][_0x2da7('0x2c')]);}})[_0x2da7('0x2d')](function(_0x411a76){logger[_0x2da7('0x2a')](_0x2da7('0x25'),_0x3ca519,_0x411a76);_0x2e113e(_0x411a76);});});}function respondWithStatusCode(_0xecc28f,_0x50fb5d){_0x50fb5d=_0x50fb5d||0xcc;return function(_0xbf7e6a){if(_0xbf7e6a){return _0xecc28f['sendStatus'](_0x50fb5d);}return _0xecc28f[_0x2da7('0x2e')](_0x50fb5d)[_0x2da7('0x2f')]();};}function respondWithResult(_0x8ac33a,_0x166046){_0x166046=_0x166046||0xc8;return function(_0x798b4a){if(_0x798b4a){return _0x8ac33a[_0x2da7('0x2e')](_0x166046)[_0x2da7('0x30')](_0x798b4a);}};}function respondWithFilteredResult(_0x4339ce,_0xf4dd0f){return function(_0x539815){if(_0x539815){var _0x179e79=_0x539815[_0x2da7('0x31')],_0x6ca34d=_0xf4dd0f[_0x2da7('0x32')],_0x2d6432=_0xf4dd0f[_0x2da7('0x32')]+_0xf4dd0f[_0x2da7('0x33')],_0x17ab5a;if(_0x2d6432>=_0x179e79){_0x2d6432=_0x179e79;_0x17ab5a=0xc8;}else{_0x17ab5a=0xce;}_0x4339ce[_0x2da7('0x2e')](_0x17ab5a);return _0x4339ce[_0x2da7('0x34')]('Content-Range',_0x6ca34d+'-'+_0x2d6432+'/'+_0x179e79)[_0x2da7('0x30')](_0x539815);}return null;};}function patchUpdates(_0x382d54){return function(_0x31c3bf){try{jsonpatch['apply'](_0x31c3bf,_0x382d54,!![]);}catch(_0x37198e){return BPromise[_0x2da7('0x35')](_0x37198e);}return _0x31c3bf[_0x2da7('0x36')]();};}function saveUpdates(_0x5f571b,_0xdc71d8){return function(_0x4819b2){if(_0x4819b2){return _0x4819b2[_0x2da7('0x37')](_0x5f571b)['then'](function(_0x2d5e07){return _0x2d5e07;});}return null;};}function removeEntity(_0x1404b3,_0x5ef1e6){return function(_0x102e67){if(_0x102e67){return _0x102e67[_0x2da7('0x38')]()[_0x2da7('0x23')](function(){_0x1404b3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e8150,_0x1846cc){return function(_0x206f5b){if(!_0x206f5b){_0x1e8150[_0x2da7('0x39')](0x194);}return _0x206f5b;};}function handleError(_0x555283,_0x229772){_0x229772=_0x229772||0x1f4;return function(_0x37eae7){logger[_0x2da7('0x2a')](_0x37eae7[_0x2da7('0x3a')]);if(_0x37eae7[_0x2da7('0x3b')]){delete _0x37eae7[_0x2da7('0x3b')];}_0x555283[_0x2da7('0x2e')](_0x229772)['send'](_0x37eae7);};}exports['index']=function(_0x161621,_0x587e2a){var _0x1665f2={},_0x952383={},_0x2072da={'count':0x0,'rows':[]};var _0x34e87d=_[_0x2da7('0x3c')](db['SmsMessage'][_0x2da7('0x3d')],function(_0x1c6101){return{'name':_0x1c6101[_0x2da7('0x3e')],'type':_0x1c6101['type']['key']};});_0x952383[_0x2da7('0x3f')]=_[_0x2da7('0x3c')](_0x34e87d,'name');_0x952383['query']=_[_0x2da7('0x40')](_0x161621[_0x2da7('0x41')]);_0x952383[_0x2da7('0x42')]=_['intersection'](_0x952383['model'],_0x952383[_0x2da7('0x41')]);_0x1665f2[_0x2da7('0x43')]=_[_0x2da7('0x44')](_0x952383[_0x2da7('0x3f')],qs[_0x2da7('0x45')](_0x161621[_0x2da7('0x41')][_0x2da7('0x45')]));_0x1665f2[_0x2da7('0x43')]=_0x1665f2['attributes'][_0x2da7('0x46')]?_0x1665f2['attributes']:_0x952383['model'];if(!_0x161621['query'][_0x2da7('0x47')](_0x2da7('0x48'))){_0x1665f2[_0x2da7('0x33')]=qs[_0x2da7('0x33')](_0x161621['query'][_0x2da7('0x33')]);_0x1665f2[_0x2da7('0x32')]=qs['offset'](_0x161621[_0x2da7('0x41')]['offset']);}_0x1665f2['order']=qs[_0x2da7('0x49')](_0x161621[_0x2da7('0x41')][_0x2da7('0x49')]);_0x1665f2[_0x2da7('0x4a')]=qs[_0x2da7('0x42')](_[_0x2da7('0x4b')](_0x161621[_0x2da7('0x41')],_0x952383[_0x2da7('0x42')]));if(_0x161621['query']['filter']){_0x1665f2[_0x2da7('0x4a')]=_['merge'](_0x1665f2['where'],{'$or':_['map'](_0x34e87d,function(_0x5dad25){if(_0x5dad25['type']!==_0x2da7('0x4c')){var _0x295890={};_0x295890[_0x5dad25[_0x2da7('0x3b')]]={'$like':'%'+_0x161621[_0x2da7('0x41')][_0x2da7('0x4d')]+'%'};return _0x295890;}})});}_0x1665f2=_['merge']({},_0x1665f2,_0x161621[_0x2da7('0x4e')]);var _0x5801ce={'where':_0x1665f2[_0x2da7('0x4a')]};return db[_0x2da7('0x4f')]['count'](_0x5801ce)[_0x2da7('0x23')](function(_0x310383){_0x2072da[_0x2da7('0x31')]=_0x310383;if(_0x161621[_0x2da7('0x41')][_0x2da7('0x50')]){_0x1665f2['include']=[{'all':!![]}];}return db['SmsMessage'][_0x2da7('0x51')](_0x1665f2);})[_0x2da7('0x23')](function(_0x5df08c){_0x2072da[_0x2da7('0x52')]=_0x5df08c;return _0x2072da;})[_0x2da7('0x23')](respondWithFilteredResult(_0x587e2a,_0x1665f2))[_0x2da7('0x2d')](handleError(_0x587e2a,null));};exports['show']=function(_0x45b04f,_0x325cc2){var _0x5ecaab={'raw':!![],'where':{'id':_0x45b04f[_0x2da7('0x53')]['id']}},_0x2e3022={};_0x2e3022['model']=_[_0x2da7('0x40')](db['SmsMessage']['rawAttributes']);_0x2e3022[_0x2da7('0x41')]=_['keys'](_0x45b04f[_0x2da7('0x41')]);_0x2e3022[_0x2da7('0x42')]=_[_0x2da7('0x44')](_0x2e3022[_0x2da7('0x3f')],_0x2e3022[_0x2da7('0x41')]);_0x5ecaab['attributes']=_[_0x2da7('0x44')](_0x2e3022[_0x2da7('0x3f')],qs[_0x2da7('0x45')](_0x45b04f[_0x2da7('0x41')][_0x2da7('0x45')]));_0x5ecaab[_0x2da7('0x43')]=_0x5ecaab[_0x2da7('0x43')][_0x2da7('0x46')]?_0x5ecaab[_0x2da7('0x43')]:_0x2e3022[_0x2da7('0x3f')];if(_0x45b04f[_0x2da7('0x41')]['includeAll']){_0x5ecaab[_0x2da7('0x54')]=[{'all':!![]}];}_0x5ecaab=_[_0x2da7('0x55')]({},_0x5ecaab,_0x45b04f[_0x2da7('0x4e')]);return db[_0x2da7('0x4f')]['find'](_0x5ecaab)['then'](handleEntityNotFound(_0x325cc2,null))['then'](respondWithResult(_0x325cc2,null))[_0x2da7('0x2d')](handleError(_0x325cc2,null));};exports['create']=function(_0x3cf245,_0x24f507){return db['SmsMessage'][_0x2da7('0x56')](_0x3cf245[_0x2da7('0x57')],{})[_0x2da7('0x23')](respondWithResult(_0x24f507,0xc9))[_0x2da7('0x2d')](handleError(_0x24f507,null));};exports[_0x2da7('0x37')]=function(_0x2630f6,_0x44bab1){if(_0x2630f6[_0x2da7('0x57')]['id']){delete _0x2630f6['body']['id'];}return db[_0x2da7('0x4f')][_0x2da7('0x58')]({'where':{'id':_0x2630f6[_0x2da7('0x53')]['id']}})[_0x2da7('0x23')](handleEntityNotFound(_0x44bab1,null))[_0x2da7('0x23')](saveUpdates(_0x2630f6['body'],null))[_0x2da7('0x23')](respondWithResult(_0x44bab1,null))['catch'](handleError(_0x44bab1,null));};exports['destroy']=function(_0x59c051,_0x102dec){return db[_0x2da7('0x4f')][_0x2da7('0x58')]({'where':{'id':_0x59c051[_0x2da7('0x53')]['id']}})['then'](handleEntityNotFound(_0x102dec,null))[_0x2da7('0x23')](removeEntity(_0x102dec,null))['catch'](handleError(_0x102dec,null));};exports[_0x2da7('0x59')]=function(_0x386d63,_0xf64c16){return db['SmsMessage']['describe']()[_0x2da7('0x23')](respondWithResult(_0xf64c16,null))[_0x2da7('0x2d')](handleError(_0xf64c16,null));};var interaction_log=require(_0x2da7('0x5a'))('sms-interactions');exports[_0x2da7('0x5b')]=function(_0xd46620,_0x11ddbe,_0x3075a7){var _0x38753e={'channel':_0x2da7('0x5c')};if(_0xd46620[_0x2da7('0x57')]['id']){delete _0xd46620[_0x2da7('0x57')]['id'];}_0xd46620['body']['read']=!![];_0xd46620[_0x2da7('0x57')][_0x2da7('0x5d')]=moment()[_0x2da7('0x5e')](_0x2da7('0x5f'));_0xd46620[_0x2da7('0x57')][_0x2da7('0x60')]=_0xd46620[_0x2da7('0x57')]['UserId']||_0xd46620[_0x2da7('0x61')]['id'];return db['SmsMessage'][_0x2da7('0x58')]({'where':{'id':_0xd46620['params']['id'],'UserId':null},'include':[{'model':db[_0x2da7('0x62')],'as':_0x2da7('0x63')}]})[_0x2da7('0x23')](handleEntityNotFound(_0x11ddbe,null))['then'](saveUpdates(_0xd46620[_0x2da7('0x57')],null))['then'](function(_0x23a626){if(_0x23a626){_0x38753e[_0x2da7('0x2c')]=_0x23a626[_0x2da7('0x64')]({'plain':!![]});return db[_0x2da7('0x65')][_0x2da7('0x58')]({'where':{'id':_0x23a626[_0x2da7('0x66')]}});}return null;})[_0x2da7('0x23')](handleEntityNotFound(_0x11ddbe,null))[_0x2da7('0x23')](function(_0x27e982){if(_0x27e982){return _0x27e982['update']({'UserId':_0xd46620[_0x2da7('0x57')][_0x2da7('0x60')],'read1stAt':_[_0x2da7('0x67')](_0x27e982['read1stAt'])?moment()[_0x2da7('0x5e')](_0x2da7('0x5f')):undefined});}return null;})[_0x2da7('0x23')](function(_0x22da70){if(_0x22da70){_0x38753e[_0x2da7('0x68')]=_0x22da70['get']({'plain':!![]});interaction_log[_0x2da7('0x24')](_0x2da7('0x69'),_0xd46620['user']['id'],_0xd46620[_0x2da7('0x61')][_0x2da7('0x3b')],_0xd46620[_0x2da7('0x61')][_0x2da7('0x6a')],_0x38753e[_0x2da7('0x68')]['id'],_0xd46620['body']?JSON[_0x2da7('0x29')](_0xd46620['body']):_0x2da7('0x6b'));return respondWithRpcPromise(_0x2da7('0x6c'),'acceptMessage',_0x38753e);}return null;})[_0x2da7('0x23')](function(_0x36f7db){if(_0x36f7db){if(_0xd46620[_0x2da7('0x57')]['manual']){_0x38753e[_0x2da7('0x2c')]['interface']=util['format'](_0x2da7('0x6d'),_0xd46620[_0x2da7('0x61')][_0x2da7('0x3b')]);_0x38753e[_0x2da7('0x2c')][_0x2da7('0x6e')]=_0x38753e[_0x2da7('0x6e')];_0x38753e['message'][_0x2da7('0x6f')]=_0x2da7('0x5b');return respondWithRpcPromise(_0x2da7('0x70'),_0x2da7('0x70'),{'event':_0x2da7('0x71'),'message':_0x38753e[_0x2da7('0x2c')]},client9002)[_0x2da7('0x23')](function(){return _0x38753e;});}return _0x38753e;}return null;})[_0x2da7('0x23')](respondWithResult(_0x11ddbe,null))[_0x2da7('0x2d')](handleError(_0x11ddbe,null));};var interaction_log=require(_0x2da7('0x5a'))('sms-interactions');exports[_0x2da7('0x35')]=function(_0x109898,_0x26043d,_0x5d3976){var _0x2ef0dd={'agent':{},'channel':_0x2da7('0x5c')};if(_0x109898['body']['id']){delete _0x109898[_0x2da7('0x57')]['id'];}_0x109898[_0x2da7('0x57')][_0x2da7('0x60')]=_0x109898['body'][_0x2da7('0x60')]||_0x109898[_0x2da7('0x61')]['id'];_0x2ef0dd[_0x2da7('0x72')]['id']=_0x109898['body'][_0x2da7('0x60')];return db[_0x2da7('0x4f')][_0x2da7('0x58')]({'where':{'id':_0x109898['params']['id'],'UserId':null}})[_0x2da7('0x23')](handleEntityNotFound(_0x26043d,null))[_0x2da7('0x23')](function(_0x33133f){if(_0x33133f){_0x2ef0dd[_0x2da7('0x2c')]=_0x33133f[_0x2da7('0x64')]({'plain':!![]});return db[_0x2da7('0x65')][_0x2da7('0x58')]({'where':{'id':_0x33133f[_0x2da7('0x66')]}});}return null;})[_0x2da7('0x23')](handleEntityNotFound(_0x26043d,null))['then'](function(_0x336c91){if(_0x336c91){_0x2ef0dd[_0x2da7('0x68')]=_0x336c91['get']({'plain':!![]});interaction_log['info'](_0x2da7('0x73'),_0x109898[_0x2da7('0x61')]['id'],_0x109898[_0x2da7('0x61')][_0x2da7('0x3b')],_0x109898['user'][_0x2da7('0x6a')],_0x2ef0dd[_0x2da7('0x68')]['id'],_0x109898[_0x2da7('0x57')]?JSON[_0x2da7('0x29')](_0x109898[_0x2da7('0x57')]):'null');return respondWithRpcPromise(_0x2da7('0x74'),'rejectMessage',_0x2ef0dd);}return null;})[_0x2da7('0x23')](function(_0x422b47){if(_0x422b47){_0x422b47[_0x2da7('0x2c')][_0x2da7('0x75')]=util[_0x2da7('0x5e')](_0x2da7('0x6d'),_0x109898[_0x2da7('0x61')][_0x2da7('0x3b')]);_0x422b47['message'][_0x2da7('0x6e')]=_0x2ef0dd[_0x2da7('0x6e')];_0x422b47[_0x2da7('0x2c')][_0x2da7('0x6f')]=_0x2da7('0x35');respondWithRpcPromise(_0x2da7('0x70'),_0x2da7('0x70'),{'event':_0x2da7('0x76'),'message':_0x422b47[_0x2da7('0x2c')]},client9002);return _0x2ef0dd;}return null;})[_0x2da7('0x23')](respondWithResult(_0x26043d,null))[_0x2da7('0x2d')](handleError(_0x26043d,null));};exports[_0x2da7('0x2e')]=function(_0xc872f7,_0x155749,_0x357511){if(_0xc872f7[_0x2da7('0x57')]['id']){delete _0xc872f7['body']['id'];}var _0x2f3454;return db[_0x2da7('0x4f')][_0x2da7('0x58')]({'where':{'id':_0xc872f7[_0x2da7('0x53')]['id']}})[_0x2da7('0x23')](handleEntityNotFound(_0x155749,null))[_0x2da7('0x23')](function(_0x409476){if(_0x409476){_0x2f3454=_0x409476;return db[_0x2da7('0x77')][_0x2da7('0x58')]({'where':{'id':_0x409476[_0x2da7('0x78')]}});}})[_0x2da7('0x23')](handleEntityNotFound(_0x155749,null))[_0x2da7('0x23')](function(_0x565092){if(_0x565092){logger[_0x2da7('0x27')](_0x2da7('0x28'),'status',_0x2da7('0x79'),_0x565092['type'],util['inspect'](_0xc872f7['body'],{'showHidden':![],'depth':null}));switch(_0x565092['type']){case _0x2da7('0x7a'):if(_0xc872f7['body'][_0x2da7('0x7b')]&&_0xc872f7['body']['MessageSid']===_0x2f3454[_0x2da7('0x7c')]){return _0x2f3454[_0x2da7('0x37')]({'read':!![]});}else{logger[_0x2da7('0x2a')](_0x2da7('0x7d'),_0x2da7('0x2e'),'twilio',util[_0x2da7('0x7e')](_0xc872f7[_0x2da7('0x57')],{'showHidden':![],'depth':null}));}break;case _0x2da7('0x7f'):if(_0xc872f7[_0x2da7('0x57')][_0x2da7('0x80')]&&_0xc872f7[_0x2da7('0x57')][_0x2da7('0x80')]===_0x2f3454['messageId']&&_[_0x2da7('0x81')]([_0x2da7('0x82'),_0x2da7('0x83')],_0xc872f7[_0x2da7('0x57')][_0x2da7('0x84')])>=0x0){return _0x2f3454[_0x2da7('0x37')]({'read':!![]});}else{logger['error'](_0x2da7('0x7d'),'status',_0x2da7('0x85'),util['inspect'](_0xc872f7[_0x2da7('0x57')],{'showHidden':![],'depth':null}));}break;case _0x2da7('0x86'):var _0x421c1c=_0xc872f7[_0x2da7('0x57')][_0x2da7('0x87')][0x0];if(_0x421c1c[_0x2da7('0x2e')][_0x2da7('0x88')]===_0x2da7('0x89')){return _0x2f3454[_0x2da7('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x2da7('0x86'),util[_0x2da7('0x7e')](_0xc872f7[_0x2da7('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x2f3454;}})[_0x2da7('0x23')](respondWithResult(_0x155749,null))[_0x2da7('0x2d')](handleError(_0x155749,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 16759f9..fe7e00e 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 _0x231e=['hasOwnProperty','hook','exports','events','../../mysqldb','update','emit'];(function(_0x2232ac,_0x4be178){var _0x4a4e4a=function(_0xb8db85){while(--_0xb8db85){_0x2232ac['push'](_0x2232ac['shift']());}};_0x4a4e4a(++_0x4be178);}(_0x231e,0x168));var _0xe231=function(_0x1522db,_0x7efece){_0x1522db=_0x1522db-0x0;var _0x165585=_0x231e[_0x1522db];return _0x165585;};'use strict';var EventEmitter=require(_0xe231('0x0'));var SmsMessage=require(_0xe231('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe231('0x2'),'afterDestroy':'remove'};function emitEvent(_0x566619){return function(_0x524e07,_0x252e15,_0x50963b){SmsMessageEvents[_0xe231('0x3')](_0x566619+':'+_0x524e07['id'],_0x524e07);SmsMessageEvents[_0xe231('0x3')](_0x566619,_0x524e07);_0x50963b(null);};}for(var e in events){if(events[_0xe231('0x4')](e)){var event=events[e];SmsMessage[_0xe231('0x5')](e,emitEvent(event));}}module[_0xe231('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0xaccd=['emit','hook','events','../../mysqldb','SmsMessage','setMaxListeners','update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xaccd,0x1a6));var _0xdacc=function(_0x2f14af,_0x31c5cf){_0x2f14af=_0x2f14af-0x0;var _0x137879=_0xaccd[_0x2f14af];return _0x137879;};'use strict';var EventEmitter=require(_0xdacc('0x0'));var SmsMessage=require(_0xdacc('0x1'))['db'][_0xdacc('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xdacc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdacc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x56e1b9){return function(_0x1a8d5e,_0x1eb274,_0x3fc5d3){SmsMessageEvents[_0xdacc('0x5')](_0x56e1b9+':'+_0x1a8d5e['id'],_0x1a8d5e);SmsMessageEvents[_0xdacc('0x5')](_0x56e1b9,_0x1a8d5e);_0x3fc5d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xdacc('0x6')](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 df59e40..9bab387 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 _0x9cbe=['type','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','then','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','username','password','smsMethod','sender','login?username=','&password=','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/send/','requestid','read','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','head','message_id','clickSend','%s:%s','authId','toString','message_uuid','plivo','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','csc','crypto','apiKey','login','text','timestamp','keys','length','createHash','md5','hex','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','intelepeer','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','status','refid','Token\x20not\x20received','finally','utf8mb4','util','moment','request-promise','path','rimraf','../../config/environment','exports','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','UserId','SmsInteraction','findOne','SmsInteractionId','update','catch','error','out','secret','SmsAccount','find','SmsAccountId'];(function(_0x34145e,_0x689e31){var _0x27ed04=function(_0x297fc7){while(--_0x297fc7){_0x34145e['push'](_0x34145e['shift']());}};_0x27ed04(++_0x689e31);}(_0x9cbe,0x137));var _0xe9cb=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x9cbe[_0x2f45ea];return _0x485a84;};'use strict';var _=require('lodash');var util=require(_0xe9cb('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe9cb('0x1'));var BPromise=require('bluebird');var rp=require(_0xe9cb('0x2'));var fs=require('fs');var path=require(_0xe9cb('0x3'));var rimraf=require(_0xe9cb('0x4'));var config=require(_0xe9cb('0x5'));var attributes=require('./smsMessage.attributes');module[_0xe9cb('0x6')]=function(_0x31c85b,_0x19580d){return _0x31c85b['define'](_0xe9cb('0x7'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xe9cb('0x8')]},{'name':_0xe9cb('0x9'),'fields':[_0xe9cb('0xa')],'type':_0xe9cb('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4dac05,_0x38dc8b,_0x11231c){var _0x3d99d0=_0x31c85b[_0xe9cb('0xc')];var _0x2b341d=_0x4dac05[_0xe9cb('0xd')]({'plain':!![]});if(_0x2b341d[_0xe9cb('0xe')][_0xe9cb('0xf')]()==='in'||_0x2b341d[_0xe9cb('0xe')]['toLowerCase']()==='out'&&!_0x2b341d['secret']&&!_['isNil'](_0x2b341d[_0xe9cb('0x10')])){_0x3d99d0[_0xe9cb('0x11')][_0xe9cb('0x12')]({'where':{'id':_0x2b341d[_0xe9cb('0x13')]}})['then'](function(_0x51ccde){if(_0x51ccde){_0x51ccde[_0xe9cb('0x14')]({'lastMsgAt':_0x2b341d['createdAt'],'lastMsgDirection':_0x2b341d[_0xe9cb('0xe')]['toLowerCase']()});}})[_0xe9cb('0x15')](function(_0x5624e7){console[_0xe9cb('0x16')](_0x5624e7);});}if(_0x2b341d['direction']===_0xe9cb('0x17')&&!_0x2b341d[_0xe9cb('0x18')]){var _0x31e6b3;_0x3d99d0[_0xe9cb('0x19')][_0xe9cb('0x1a')]({'where':{'id':_0x2b341d[_0xe9cb('0x1b')]},'raw':!![]})['then'](function(_0x2416b7){_0x31e6b3=_0x2416b7;if(_0x31e6b3&&_0x31e6b3[_0xe9cb('0x1c')]){switch(_0x31e6b3[_0xe9cb('0x1c')]){case'twilio':var _0x1077a1=require('twilio');if(_0x31e6b3[_0xe9cb('0x1d')]&&_0x31e6b3[_0xe9cb('0x1e')]&&_0x31e6b3[_0xe9cb('0x1f')]){var _0x3c45a1=new _0x1077a1(_0x31e6b3['accountSid'],_0x31e6b3[_0xe9cb('0x1e')]);_0x3c45a1[_0xe9cb('0x20')][_0xe9cb('0x21')]({'body':_0x2b341d[_0xe9cb('0xa')],'to':_0x2b341d['phone'],'from':_0x31e6b3[_0xe9cb('0x1f')],'statusCallback':_0x31e6b3[_0xe9cb('0x22')]+_0xe9cb('0x23')+_0x2b341d['id']+_0xe9cb('0x24')+_0x31e6b3[_0xe9cb('0x25')]})[_0xe9cb('0x26')](function(_0x26ddd7){if(_0x26ddd7['sid']){return _0x4dac05[_0xe9cb('0x14')]({'messageId':_0x26ddd7['sid']});}})['catch'](function(_0x45506e){logger['error'](_0xe9cb('0x27'),_0xe9cb('0x28'),'twilio',util[_0xe9cb('0x29')](_0x45506e,{'showHidden':![],'depth':null}));});}else{logger[_0xe9cb('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9cb('0x28'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xe9cb('0x2a'):var _0x12f6c8='https://api.skebby.it/API/v1.0/REST/';if(_0x31e6b3[_0xe9cb('0x2b')]&&_0x31e6b3[_0xe9cb('0x2c')]){var _0x52a014={'recipient':[_0x2b341d[_0xe9cb('0x1f')]],'message':_0x2b341d[_0xe9cb('0xa')],'message_type':_0x31e6b3['smsMethod']};if(_0x31e6b3['smsMethod']&&_0x31e6b3[_0xe9cb('0x2d')]!=='SI'){_0x52a014[_0xe9cb('0x2e')]=_0x31e6b3[_0xe9cb('0x1f')];}var _0x261a21={'url':_0x12f6c8+_0xe9cb('0x2f')+_0x31e6b3[_0xe9cb('0x2b')]+_0xe9cb('0x30')+_0x31e6b3[_0xe9cb('0x2c')],'method':'GET'};rp(_0x261a21)[_0xe9cb('0x26')](function(_0x2bedbc){var _0xa3eb35=_0x2bedbc[_0xe9cb('0x31')](';');var _0x40a9a6={'user_key':_0xa3eb35[0x0],'session_key':_0xa3eb35[0x1]};_0x261a21={'url':_0x12f6c8+_0xe9cb('0x32'),'method':_0xe9cb('0x33'),'headers':{'user_key':_0x40a9a6[_0xe9cb('0x34')],'Session_key':_0x40a9a6[_0xe9cb('0x35')]},'json':!![],'body':_0x52a014};return rp(_0x261a21);})[_0xe9cb('0x26')](function(_0x511fca){if(_0x511fca[_0xe9cb('0x36')]>=0x1){var _0x5d643d={'messageId':_0x511fca[_0xe9cb('0x37')]};if(_0x31e6b3['smsMethod']!=='GP'||!_0x31e6b3[_0xe9cb('0x38')]){_0x5d643d['read']=!![];}return _0x4dac05['update'](_0x5d643d);}else{return logger['error'](_0xe9cb('0x27'),_0xe9cb('0x28'),_0xe9cb('0x2a'),util[_0xe9cb('0x29')](_0x511fca,{'showHidden':![],'depth':null}));}})[_0xe9cb('0x15')](function(_0x24f2e8){return logger[_0xe9cb('0x16')](_0xe9cb('0x27'),_0xe9cb('0x28'),_0xe9cb('0x2a'),util[_0xe9cb('0x29')](_0x24f2e8,{'showHidden':![],'depth':null}));});}else{logger[_0xe9cb('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9cb('0x28'),_0xe9cb('0x2a'),_0xe9cb('0x39'));}break;case _0xe9cb('0x3a'):if(_0x31e6b3['authToken']){var _0x223586={'recipient':_0x2b341d[_0xe9cb('0x1f')],'message':_0x2b341d[_0xe9cb('0xa')],'sender':_0x31e6b3[_0xe9cb('0x3b')]||_0x31e6b3[_0xe9cb('0x1f')],'authorization':_0x31e6b3[_0xe9cb('0x1e')]};var _0x38dc8b={'method':_0xe9cb('0x33'),'uri':_0xe9cb('0x3c'),'body':_0x223586,'json':!![]};rp(_0x38dc8b)[_0xe9cb('0x26')](function(_0x2e4750){var _0x46cc48={'messageId':_0x2e4750[_0xe9cb('0x3d')]};if(!_0x31e6b3[_0xe9cb('0x38')]){_0x46cc48[_0xe9cb('0x3e')]=!![];}return _0x4dac05[_0xe9cb('0x14')](_0x46cc48);})[_0xe9cb('0x15')](function(_0x51ea61){logger[_0xe9cb('0x16')](_0xe9cb('0x27'),_0xe9cb('0x28'),_0xe9cb('0x3a'),util[_0xe9cb('0x29')](_0x51ea61,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe9cb('0x27'),_0xe9cb('0x28'),_0xe9cb('0x3a'),_0xe9cb('0x3f'));}break;case'clicksend':if(_0x31e6b3['username']&&_0x31e6b3[_0xe9cb('0x2c')]){var _0x223586={'messages':[{'source':_0xe9cb('0x40'),'to':_0x2b341d[_0xe9cb('0x1f')],'body':_0x2b341d['body'],'from':_0x31e6b3['senderString']||_0x31e6b3['phone']}]};var _0x54e64b=util[_0xe9cb('0x41')]('%s:%s',_0x31e6b3[_0xe9cb('0x2b')],_0x31e6b3['password']);var _0x38dc8b={'method':'POST','uri':_0xe9cb('0x42'),'body':_0x223586,'headers':{'Authorization':util[_0xe9cb('0x41')](_0xe9cb('0x43'),new Buffer(_0x54e64b)['toString'](_0xe9cb('0x44')))},'json':!![]};rp(_0x38dc8b)[_0xe9cb('0x26')](function(_0x533d1a){if(_0x533d1a['http_code']>=0xc8&&_0x533d1a[_0xe9cb('0x45')]<=0xce){if(_0x533d1a['data']&&_0x533d1a[_0xe9cb('0x46')]['queued_count']>0x0){var _0x53c3a2=_[_0xe9cb('0x47')](_0x533d1a[_0xe9cb('0x46')][_0xe9cb('0x20')]);var _0x360901={'messageId':_0x53c3a2[_0xe9cb('0x48')]};if(!_0x31e6b3['deliveryReport']){_0x360901[_0xe9cb('0x3e')]=!![];}return _0x4dac05[_0xe9cb('0x14')](_0x360901);}else{logger[_0xe9cb('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9cb('0x28'),_0xe9cb('0x49'),util[_0xe9cb('0x29')](_0x533d1a,{'showHidden':![],'depth':null}));}}else{logger[_0xe9cb('0x16')](_0xe9cb('0x27'),'afterCreate',_0xe9cb('0x49'),util[_0xe9cb('0x29')](_0x533d1a,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3c5169){logger[_0xe9cb('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9cb('0x28'),_0xe9cb('0x49'),util[_0xe9cb('0x29')](_0x3c5169,{'showHidden':![],'depth':null}));});}else{logger[_0xe9cb('0x16')](_0xe9cb('0x27'),_0xe9cb('0x28'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x31e6b3['authId']&&_0x31e6b3[_0xe9cb('0x1e')]){var _0x223586={'dst':_0x2b341d[_0xe9cb('0x1f')],'text':_0x2b341d[_0xe9cb('0xa')],'src':_0x31e6b3['senderString']||_0x31e6b3['phone'],'url':_0x31e6b3[_0xe9cb('0x22')]+_0xe9cb('0x23')+_0x2b341d['id']+_0xe9cb('0x24')+_0x31e6b3[_0xe9cb('0x25')]};var _0x54e64b=util[_0xe9cb('0x41')](_0xe9cb('0x4a'),_0x31e6b3[_0xe9cb('0x4b')],_0x31e6b3[_0xe9cb('0x1e')]);var _0x38dc8b={'method':_0xe9cb('0x33'),'uri':util[_0xe9cb('0x41')]('https://api.plivo.com/v1/Account/%s/Message/',_0x31e6b3[_0xe9cb('0x4b')]),'body':_0x223586,'headers':{'Authorization':util[_0xe9cb('0x41')](_0xe9cb('0x43'),new Buffer(_0x54e64b)[_0xe9cb('0x4c')](_0xe9cb('0x44')))},'json':!![]};rp(_0x38dc8b)[_0xe9cb('0x26')](function(_0x207014){var _0x5afa51={'messageId':_0x207014[_0xe9cb('0x4d')][0x0]};return _0x4dac05['update'](_0x5afa51);})[_0xe9cb('0x15')](function(_0x44e105){logger[_0xe9cb('0x16')](_0xe9cb('0x27'),_0xe9cb('0x28'),_0xe9cb('0x4e'),util[_0xe9cb('0x29')](_0x44e105,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe9cb('0x27'),_0xe9cb('0x28'),_0xe9cb('0x4e'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xe9cb('0x4f'):if(_0x31e6b3[_0xe9cb('0x2b')]&&_0x31e6b3[_0xe9cb('0x2c')]){if(_0x31e6b3['baseUrl']){var _0x34dc02={'method':_0xe9cb('0x33'),'uri':_0x31e6b3[_0xe9cb('0x50')]+_0xe9cb('0x51'),'body':{'username':_0x31e6b3[_0xe9cb('0x2b')],'password':_0x31e6b3[_0xe9cb('0x2c')]},'json':!![]};return rp(_0x34dc02)[_0xe9cb('0x26')](function(_0xdb8d){var _0x20b902={'method':_0xe9cb('0x33'),'uri':_0x31e6b3[_0xe9cb('0x50')]+_0xe9cb('0x52'),'body':{'messages':[{'from':_0x31e6b3['phone'],'destinations':[{'to':_0x2b341d[_0xe9cb('0x1f')]}],'text':_0x2b341d[_0xe9cb('0xa')],'notifyUrl':_0x31e6b3[_0xe9cb('0x22')]+_0xe9cb('0x23')+_0x2b341d['id']+_0xe9cb('0x24')+_0x31e6b3[_0xe9cb('0x25')],'notifyContentType':_0xe9cb('0x53'),'callbackData':_0x31e6b3[_0xe9cb('0x1f')]+';'+_0x2b341d[_0xe9cb('0xa')]}]},'headers':{'Authorization':'IBSSO\x20'+_0xdb8d[_0xe9cb('0x25')]},'json':!![]};return rp(_0x20b902)[_0xe9cb('0x26')](function(_0x4a52ee){if(_0x4a52ee[_0xe9cb('0x20')]){var _0x896085={'messageId':_0x4a52ee[_0xe9cb('0x20')][0x0][_0xe9cb('0x8')]};if(!_0x31e6b3[_0xe9cb('0x38')]){_0x896085[_0xe9cb('0x3e')]=!![];}return _0x4dac05['update'](_0x896085);}else{return logger[_0xe9cb('0x16')](_0xe9cb('0x27'),_0xe9cb('0x28'),_0xe9cb('0x4f'),util['inspect'](_0x4a52ee,{'showHidden':![],'depth':null}));}});})[_0xe9cb('0x15')](function(_0x732ed){return logger[_0xe9cb('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9cb('0x28'),_0xe9cb('0x4f'),util[_0xe9cb('0x29')](_0x732ed,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe9cb('0x27'),'afterCreate',_0xe9cb('0x4f'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xe9cb('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9cb('0x28'),_0xe9cb('0x4f'),_0xe9cb('0x39'));}break;case _0xe9cb('0x54'):var _0x1d8c38=require(_0xe9cb('0x55'));if(_0x31e6b3[_0xe9cb('0x56')]){var _0x5d53da={};_0x5d53da[_0xe9cb('0x57')]=_0x31e6b3[_0xe9cb('0x2b')];_0x5d53da['phone']=_0x2b341d[_0xe9cb('0x1f')];_0x5d53da[_0xe9cb('0x2e')]=_0x31e6b3[_0xe9cb('0x1f')];_0x5d53da[_0xe9cb('0x58')]=_0x2b341d[_0xe9cb('0xa')];_0x5d53da[_0xe9cb('0x59')]=+new Date();var _0x15a16e='';var _0x18bf6e='';var _0x1745ea=Object[_0xe9cb('0x5a')](_0x5d53da);_0x1745ea['sort']();for(var _0x87b05d=0x0;_0x87b05d<_0x1745ea[_0xe9cb('0x5b')];_0x87b05d++){if(_0x15a16e!=''){_0x15a16e+='&';}_0x15a16e+=_0x1745ea[_0x87b05d]+'='+encodeURIComponent(_0x5d53da[_0x1745ea[_0x87b05d]]);_0x18bf6e+=_0x5d53da[_0x1745ea[_0x87b05d]];}_0x18bf6e+=_0x31e6b3[_0xe9cb('0x56')];_0x18bf6e=_0x1d8c38[_0xe9cb('0x5c')](_0xe9cb('0x5d'))[_0xe9cb('0x14')](_0x18bf6e)['digest'](_0xe9cb('0x5e'));if(_0x15a16e!==''){_0x15a16e+='&';}_0x15a16e+='signature='+_0x18bf6e;var _0x261a21={'method':_0xe9cb('0x5f'),'uri':_0x31e6b3[_0xe9cb('0x50')]+_0xe9cb('0x60')+_0x15a16e,'json':!![]};return rp(_0x261a21)[_0xe9cb('0x26')](function(_0x3c31c5){var _0x1cb5e9=Object[_0xe9cb('0x5a')](_0x3c31c5);if(_0x3c31c5[_0x1cb5e9[0x0]]['error']&&parseInt(_0x3c31c5[_0x1cb5e9[0x0]][_0xe9cb('0x16')])===0x0){var _0xd2a7b3={'messageId':_0x3c31c5[_0x1cb5e9[0x0]][_0xe9cb('0x61')]};if(!_0x31e6b3[_0xe9cb('0x38')]){_0xd2a7b3[_0xe9cb('0x3e')]=!![];}return _0x4dac05[_0xe9cb('0x14')](_0xd2a7b3);}else{return logger[_0xe9cb('0x16')](_0xe9cb('0x27'),'afterCreate',_0xe9cb('0x54'),util[_0xe9cb('0x29')](_0x3c31c5[_0xe9cb('0x16')],{'showHidden':![],'depth':null}));}})[_0xe9cb('0x15')](function(_0x8fc52e){return logger[_0xe9cb('0x16')](_0xe9cb('0x27'),_0xe9cb('0x28'),_0xe9cb('0x54'),util[_0xe9cb('0x29')](_0x8fc52e,{'showHidden':![],'depth':null}));});}else{logger[_0xe9cb('0x16')](_0xe9cb('0x27'),_0xe9cb('0x28'),_0xe9cb('0x54'),_0xe9cb('0x62'));}break;case'clickatell':if(_0x31e6b3[_0xe9cb('0x56')]){var _0x314cd1={'method':_0xe9cb('0x33'),'uri':_0xe9cb('0x63'),'headers':{'Authorization':_0x31e6b3[_0xe9cb('0x56')]},'body':{'content':_0x2b341d[_0xe9cb('0xa')],'to':[_0x2b341d[_0xe9cb('0x1f')]],'from':_0x31e6b3[_0xe9cb('0x1f')],'binary':![],'clientMessageId':_0xe9cb('0x64'),'charset':_0xe9cb('0x65')},'json':!![]};rp(_0x314cd1)[_0xe9cb('0x26')](function(_0x108af9){if(!_0x108af9['error']){var _0x47f7dc={'messageId':_0x108af9[_0xe9cb('0x20')][0x0][_0xe9cb('0x66')]};if(!_0x31e6b3[_0xe9cb('0x38')]){_0x47f7dc[_0xe9cb('0x3e')]=!![];}return _0x4dac05[_0xe9cb('0x14')](_0x47f7dc);}else{return logger[_0xe9cb('0x16')](_0xe9cb('0x27'),'afterCreate',_0xe9cb('0x67'),util[_0xe9cb('0x29')](_0x108af9['error'],{'showHidden':![],'depth':null}));}})[_0xe9cb('0x15')](function(_0x2d3a59){return logger['error'](_0xe9cb('0x27'),'afterCreate',_0xe9cb('0x67'),util[_0xe9cb('0x29')](_0x2d3a59,{'showHidden':![],'depth':null}));});}else{logger[_0xe9cb('0x16')](_0xe9cb('0x27'),'afterCreate',_0xe9cb('0x67'),_0xe9cb('0x62'));}break;case _0xe9cb('0x68'):if(_0x31e6b3['apiKey']){var _0x22c0bd={};var _0x261a21={'method':_0xe9cb('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x31e6b3[_0xe9cb('0x56')],'Content-Type':_0xe9cb('0x53')},'body':{'from':_0x31e6b3[_0xe9cb('0x1f')],'to':_0x2b341d[_0xe9cb('0x1f')],'text':_0x2b341d['body']},'json':!![]};return rp(_0x261a21)[_0xe9cb('0x26')](function(_0x2a052c){if(_0x2a052c['code']==0xca){_0x22c0bd[_0xe9cb('0x69')]=_0x2a052c;var _0x416a3b={'method':_0xe9cb('0x33'),'uri':_0xe9cb('0x6a'),'headers':{'Authorization':_0xe9cb('0x6b')+_0x31e6b3[_0xe9cb('0x56')],'Content-Type':_0xe9cb('0x53')},'body':{'refid':_0x22c0bd[_0xe9cb('0x69')]['refid']},'json':!![]};return rp(_0x416a3b)['then'](function(_0x2f0d59){_0x22c0bd[_0xe9cb('0x6c')]=_0x2f0d59;var _0x237592={'messageId':_0x22c0bd[_0xe9cb('0x69')][_0xe9cb('0x6d')],'read':!![]};return _0x4dac05[_0xe9cb('0x14')](_0x237592);});}else{return logger[_0xe9cb('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9cb('0x28'),'intelepeer',util[_0xe9cb('0x29')](_0x2a052c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x40336e){return logger[_0xe9cb('0x16')](_0xe9cb('0x27'),_0xe9cb('0x28'),_0xe9cb('0x68'),util[_0xe9cb('0x29')](_0x40336e,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xe9cb('0x27'),_0xe9cb('0x28'),_0xe9cb('0x68'),_0xe9cb('0x6e'));}break;}}})[_0xe9cb('0x6f')](function(){_0x11231c();});}else{_0x11231c();}}},'charset':_0xe9cb('0x70'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x72e0=['sort','length','md5','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','catch','out','SmsAccount','SmsAccountId','type','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','login?username=','username','&password=','password','GET','POST','user_key','session_key','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','timestamp','keys'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x72e0,0x100));var _0x072e=function(_0x26b5f5,_0x45cde4){_0x26b5f5=_0x26b5f5-0x0;var _0x181b79=_0x72e0[_0x26b5f5];return _0x181b79;};'use strict';var _=require('lodash');var util=require(_0x072e('0x0'));var logger=require(_0x072e('0x1'))(_0x072e('0x2'));var moment=require(_0x072e('0x3'));var BPromise=require(_0x072e('0x4'));var rp=require(_0x072e('0x5'));var fs=require('fs');var path=require(_0x072e('0x6'));var rimraf=require(_0x072e('0x7'));var config=require(_0x072e('0x8'));var attributes=require(_0x072e('0x9'));module[_0x072e('0xa')]=function(_0x2e849b,_0x3fdc78){return _0x2e849b['define'](_0x072e('0xb'),attributes,{'tableName':_0x072e('0xc'),'paranoid':![],'indexes':[{'name':_0x072e('0xd'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0x072e('0xe')],'type':_0x072e('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x571a68,_0x55a1b9,_0x53222e){var _0x4314b2=_0x2e849b[_0x072e('0x10')];var _0x17a7d9=_0x571a68[_0x072e('0x11')]({'plain':!![]});if(_0x17a7d9[_0x072e('0x12')][_0x072e('0x13')]()==='in'||_0x17a7d9[_0x072e('0x12')]['toLowerCase']()==='out'&&!_0x17a7d9[_0x072e('0x14')]&&!_[_0x072e('0x15')](_0x17a7d9[_0x072e('0x16')])){_0x4314b2[_0x072e('0x17')][_0x072e('0x18')]({'where':{'id':_0x17a7d9[_0x072e('0x19')]}})[_0x072e('0x1a')](function(_0x246638){if(_0x246638){_0x246638[_0x072e('0x1b')]({'lastMsgAt':_0x17a7d9['createdAt'],'lastMsgDirection':_0x17a7d9[_0x072e('0x12')]['toLowerCase']()});}})[_0x072e('0x1c')](function(_0x1b9e56){console['error'](_0x1b9e56);});}if(_0x17a7d9['direction']===_0x072e('0x1d')&&!_0x17a7d9[_0x072e('0x14')]){var _0x203947;_0x4314b2[_0x072e('0x1e')]['find']({'where':{'id':_0x17a7d9[_0x072e('0x1f')]},'raw':!![]})[_0x072e('0x1a')](function(_0x143dbd){_0x203947=_0x143dbd;if(_0x203947&&_0x203947[_0x072e('0x20')]){switch(_0x203947[_0x072e('0x20')]){case'twilio':var _0x1c85f9=require('twilio');if(_0x203947[_0x072e('0x21')]&&_0x203947[_0x072e('0x22')]&&_0x203947[_0x072e('0x23')]){var _0x27705d=new _0x1c85f9(_0x203947['accountSid'],_0x203947[_0x072e('0x22')]);_0x27705d[_0x072e('0x24')]['create']({'body':_0x17a7d9[_0x072e('0xe')],'to':_0x17a7d9['phone'],'from':_0x203947[_0x072e('0x23')],'statusCallback':_0x203947[_0x072e('0x25')]+_0x072e('0x26')+_0x17a7d9['id']+_0x072e('0x27')+_0x203947[_0x072e('0x28')]})['then'](function(_0x3af650){if(_0x3af650[_0x072e('0x29')]){return _0x571a68[_0x072e('0x1b')]({'messageId':_0x3af650[_0x072e('0x29')]});}})[_0x072e('0x1c')](function(_0x14618d){logger[_0x072e('0x2a')](_0x072e('0x2b'),_0x072e('0x2c'),_0x072e('0x2d'),util[_0x072e('0x2e')](_0x14618d,{'showHidden':![],'depth':null}));});}else{logger[_0x072e('0x2a')](_0x072e('0x2b'),_0x072e('0x2c'),_0x072e('0x2d'),_0x072e('0x2f'));}break;case _0x072e('0x30'):var _0x34f50a=_0x072e('0x31');if(_0x203947['username']&&_0x203947['password']){var _0x3cada4={'recipient':[_0x17a7d9[_0x072e('0x23')]],'message':_0x17a7d9[_0x072e('0xe')],'message_type':_0x203947[_0x072e('0x32')]};if(_0x203947[_0x072e('0x32')]&&_0x203947[_0x072e('0x32')]!=='SI'){_0x3cada4[_0x072e('0x33')]=_0x203947[_0x072e('0x23')];}var _0x231c52={'url':_0x34f50a+_0x072e('0x34')+_0x203947[_0x072e('0x35')]+_0x072e('0x36')+_0x203947[_0x072e('0x37')],'method':_0x072e('0x38')};rp(_0x231c52)[_0x072e('0x1a')](function(_0x44307c){var _0x1b44f7=_0x44307c['split'](';');var _0x4e7b7b={'user_key':_0x1b44f7[0x0],'session_key':_0x1b44f7[0x1]};_0x231c52={'url':_0x34f50a+'sms','method':_0x072e('0x39'),'headers':{'user_key':_0x4e7b7b[_0x072e('0x3a')],'Session_key':_0x4e7b7b[_0x072e('0x3b')]},'json':!![],'body':_0x3cada4};return rp(_0x231c52);})['then'](function(_0x57bff8){if(_0x57bff8['total_sent']>=0x1){var _0x229a03={'messageId':_0x57bff8[_0x072e('0x3c')]};if(_0x203947['smsMethod']!=='GP'||!_0x203947[_0x072e('0x3d')]){_0x229a03[_0x072e('0x3e')]=!![];}return _0x571a68['update'](_0x229a03);}else{return logger['error'](_0x072e('0x2b'),_0x072e('0x2c'),_0x072e('0x30'),util['inspect'](_0x57bff8,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4173a0){return logger['error'](_0x072e('0x2b'),_0x072e('0x2c'),_0x072e('0x30'),util[_0x072e('0x2e')](_0x4173a0,{'showHidden':![],'depth':null}));});}else{logger[_0x072e('0x2a')](_0x072e('0x2b'),'afterCreate',_0x072e('0x30'),_0x072e('0x3f'));}break;case _0x072e('0x40'):if(_0x203947[_0x072e('0x22')]){var _0x54964c={'recipient':_0x17a7d9['phone'],'message':_0x17a7d9['body'],'sender':_0x203947[_0x072e('0x41')]||_0x203947[_0x072e('0x23')],'authorization':_0x203947[_0x072e('0x22')]};var _0x55a1b9={'method':_0x072e('0x39'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x54964c,'json':!![]};rp(_0x55a1b9)[_0x072e('0x1a')](function(_0x59a287){var _0x1fe4ef={'messageId':_0x59a287[_0x072e('0x42')]};if(!_0x203947[_0x072e('0x3d')]){_0x1fe4ef['read']=!![];}return _0x571a68['update'](_0x1fe4ef);})[_0x072e('0x1c')](function(_0x2b89f8){logger[_0x072e('0x2a')](_0x072e('0x2b'),'afterCreate',_0x072e('0x40'),util[_0x072e('0x2e')](_0x2b89f8,{'showHidden':![],'depth':null}));});}else{logger[_0x072e('0x2a')](_0x072e('0x2b'),_0x072e('0x2c'),_0x072e('0x40'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x203947[_0x072e('0x35')]&&_0x203947[_0x072e('0x37')]){var _0x54964c={'messages':[{'source':_0x072e('0x43'),'to':_0x17a7d9[_0x072e('0x23')],'body':_0x17a7d9[_0x072e('0xe')],'from':_0x203947['senderString']||_0x203947[_0x072e('0x23')]}]};var _0x21f202=util[_0x072e('0x44')]('%s:%s',_0x203947['username'],_0x203947[_0x072e('0x37')]);var _0x55a1b9={'method':'POST','uri':_0x072e('0x45'),'body':_0x54964c,'headers':{'Authorization':util['format'](_0x072e('0x46'),new Buffer(_0x21f202)['toString'](_0x072e('0x47')))},'json':!![]};rp(_0x55a1b9)[_0x072e('0x1a')](function(_0x596066){if(_0x596066[_0x072e('0x48')]>=0xc8&&_0x596066['http_code']<=0xce){if(_0x596066[_0x072e('0x49')]&&_0x596066[_0x072e('0x49')][_0x072e('0x4a')]>0x0){var _0x4ef150=_[_0x072e('0x4b')](_0x596066[_0x072e('0x49')][_0x072e('0x24')]);var _0x3dd211={'messageId':_0x4ef150[_0x072e('0x4c')]};if(!_0x203947[_0x072e('0x3d')]){_0x3dd211[_0x072e('0x3e')]=!![];}return _0x571a68[_0x072e('0x1b')](_0x3dd211);}else{logger[_0x072e('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x072e('0x4d'),util[_0x072e('0x2e')](_0x596066,{'showHidden':![],'depth':null}));}}else{logger[_0x072e('0x2a')](_0x072e('0x2b'),'afterCreate',_0x072e('0x4d'),util[_0x072e('0x2e')](_0x596066,{'showHidden':![],'depth':null}));}})[_0x072e('0x1c')](function(_0x4d2c78){logger[_0x072e('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x072e('0x4d'),util[_0x072e('0x2e')](_0x4d2c78,{'showHidden':![],'depth':null}));});}else{logger[_0x072e('0x2a')](_0x072e('0x2b'),_0x072e('0x2c'),_0x072e('0x4d'),_0x072e('0x3f'));}break;case _0x072e('0x4e'):if(_0x203947[_0x072e('0x4f')]&&_0x203947[_0x072e('0x22')]){var _0x54964c={'dst':_0x17a7d9[_0x072e('0x23')],'text':_0x17a7d9[_0x072e('0xe')],'src':_0x203947[_0x072e('0x41')]||_0x203947['phone'],'url':_0x203947['remote']+_0x072e('0x26')+_0x17a7d9['id']+_0x072e('0x27')+_0x203947[_0x072e('0x28')]};var _0x21f202=util[_0x072e('0x44')](_0x072e('0x50'),_0x203947[_0x072e('0x4f')],_0x203947[_0x072e('0x22')]);var _0x55a1b9={'method':'POST','uri':util[_0x072e('0x44')](_0x072e('0x51'),_0x203947['authId']),'body':_0x54964c,'headers':{'Authorization':util['format'](_0x072e('0x46'),new Buffer(_0x21f202)['toString'](_0x072e('0x47')))},'json':!![]};rp(_0x55a1b9)['then'](function(_0xc4c515){var _0x3a1f68={'messageId':_0xc4c515[_0x072e('0x52')][0x0]};return _0x571a68[_0x072e('0x1b')](_0x3a1f68);})['catch'](function(_0x1c0618){logger[_0x072e('0x2a')](_0x072e('0x2b'),_0x072e('0x2c'),_0x072e('0x4e'),util[_0x072e('0x2e')](_0x1c0618,{'showHidden':![],'depth':null}));});}else{logger[_0x072e('0x2a')](_0x072e('0x2b'),_0x072e('0x2c'),_0x072e('0x4e'),_0x072e('0x53'));}break;case _0x072e('0x54'):if(_0x203947[_0x072e('0x35')]&&_0x203947[_0x072e('0x37')]){if(_0x203947['baseUrl']){var _0x3148c5={'method':_0x072e('0x39'),'uri':_0x203947[_0x072e('0x55')]+'/auth/1/session','body':{'username':_0x203947[_0x072e('0x35')],'password':_0x203947['password']},'json':!![]};return rp(_0x3148c5)[_0x072e('0x1a')](function(_0x297333){var _0x5ecbe3={'method':'POST','uri':_0x203947['baseUrl']+_0x072e('0x56'),'body':{'messages':[{'from':_0x203947[_0x072e('0x23')],'destinations':[{'to':_0x17a7d9[_0x072e('0x23')]}],'text':_0x17a7d9['body'],'notifyUrl':_0x203947[_0x072e('0x25')]+_0x072e('0x26')+_0x17a7d9['id']+_0x072e('0x27')+_0x203947[_0x072e('0x28')],'notifyContentType':'application/json','callbackData':_0x203947['phone']+';'+_0x17a7d9[_0x072e('0xe')]}]},'headers':{'Authorization':_0x072e('0x57')+_0x297333[_0x072e('0x28')]},'json':!![]};return rp(_0x5ecbe3)[_0x072e('0x1a')](function(_0x3661fc){if(_0x3661fc['messages']){var _0x5c2e9c={'messageId':_0x3661fc['messages'][0x0]['messageId']};if(!_0x203947[_0x072e('0x3d')]){_0x5c2e9c[_0x072e('0x3e')]=!![];}return _0x571a68[_0x072e('0x1b')](_0x5c2e9c);}else{return logger[_0x072e('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x072e('0x54'),util[_0x072e('0x2e')](_0x3661fc,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x19bde1){return logger[_0x072e('0x2a')](_0x072e('0x2b'),_0x072e('0x2c'),_0x072e('0x54'),util[_0x072e('0x2e')](_0x19bde1,{'showHidden':![],'depth':null}));});}else{logger[_0x072e('0x2a')](_0x072e('0x2b'),_0x072e('0x2c'),'infobip',_0x072e('0x58'));}}else{logger[_0x072e('0x2a')](_0x072e('0x2b'),'afterCreate',_0x072e('0x54'),_0x072e('0x3f'));}break;case _0x072e('0x59'):var _0x1bb56e=require(_0x072e('0x5a'));if(_0x203947[_0x072e('0x5b')]){var _0x17ca30={};_0x17ca30['login']=_0x203947[_0x072e('0x35')];_0x17ca30[_0x072e('0x23')]=_0x17a7d9[_0x072e('0x23')];_0x17ca30['sender']=_0x203947[_0x072e('0x23')];_0x17ca30[_0x072e('0x5c')]=_0x17a7d9['body'];_0x17ca30[_0x072e('0x5d')]=+new Date();var _0x3a0b7e='';var _0x113f34='';var _0x36415a=Object[_0x072e('0x5e')](_0x17ca30);_0x36415a[_0x072e('0x5f')]();for(var _0x3509f3=0x0;_0x3509f3<_0x36415a[_0x072e('0x60')];_0x3509f3++){if(_0x3a0b7e!=''){_0x3a0b7e+='&';}_0x3a0b7e+=_0x36415a[_0x3509f3]+'='+encodeURIComponent(_0x17ca30[_0x36415a[_0x3509f3]]);_0x113f34+=_0x17ca30[_0x36415a[_0x3509f3]];}_0x113f34+=_0x203947[_0x072e('0x5b')];_0x113f34=_0x1bb56e['createHash'](_0x072e('0x61'))['update'](_0x113f34)['digest'](_0x072e('0x62'));if(_0x3a0b7e!==''){_0x3a0b7e+='&';}_0x3a0b7e+=_0x072e('0x63')+_0x113f34;var _0x231c52={'method':_0x072e('0x38'),'uri':_0x203947[_0x072e('0x55')]+_0x072e('0x64')+_0x3a0b7e,'json':!![]};return rp(_0x231c52)[_0x072e('0x1a')](function(_0x445243){var _0xd04eff=Object['keys'](_0x445243);if(_0x445243[_0xd04eff[0x0]][_0x072e('0x2a')]&&parseInt(_0x445243[_0xd04eff[0x0]][_0x072e('0x2a')])===0x0){var _0xd89607={'messageId':_0x445243[_0xd04eff[0x0]]['id_sms']};if(!_0x203947[_0x072e('0x3d')]){_0xd89607[_0x072e('0x3e')]=!![];}return _0x571a68[_0x072e('0x1b')](_0xd89607);}else{return logger[_0x072e('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x072e('0x2c'),_0x072e('0x59'),util[_0x072e('0x2e')](_0x445243[_0x072e('0x2a')],{'showHidden':![],'depth':null}));}})[_0x072e('0x1c')](function(_0x4f8c1e){return logger[_0x072e('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x072e('0x2c'),_0x072e('0x59'),util[_0x072e('0x2e')](_0x4f8c1e,{'showHidden':![],'depth':null}));});}else{logger[_0x072e('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x072e('0x2c'),_0x072e('0x59'),_0x072e('0x65'));}break;case _0x072e('0x66'):if(_0x203947[_0x072e('0x5b')]){var _0x2bc744={'method':_0x072e('0x39'),'uri':_0x072e('0x67'),'headers':{'Authorization':_0x203947['apiKey']},'body':{'content':_0x17a7d9[_0x072e('0xe')],'to':[_0x17a7d9[_0x072e('0x23')]],'from':_0x203947[_0x072e('0x23')],'binary':![],'clientMessageId':'uuid','charset':_0x072e('0x68')},'json':!![]};rp(_0x2bc744)[_0x072e('0x1a')](function(_0x27af7a){if(!_0x27af7a['error']){var _0x3ccc15={'messageId':_0x27af7a[_0x072e('0x24')][0x0][_0x072e('0x69')]};if(!_0x203947['deliveryReport']){_0x3ccc15[_0x072e('0x3e')]=!![];}return _0x571a68[_0x072e('0x1b')](_0x3ccc15);}else{return logger[_0x072e('0x2a')](_0x072e('0x2b'),_0x072e('0x2c'),_0x072e('0x66'),util[_0x072e('0x2e')](_0x27af7a['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4b09e1){return logger[_0x072e('0x2a')](_0x072e('0x2b'),_0x072e('0x2c'),_0x072e('0x66'),util['inspect'](_0x4b09e1,{'showHidden':![],'depth':null}));});}else{logger[_0x072e('0x2a')](_0x072e('0x2b'),'afterCreate',_0x072e('0x66'),_0x072e('0x65'));}break;case _0x072e('0x6a'):if(_0x203947[_0x072e('0x5b')]){var _0x30deae={};var _0x231c52={'method':_0x072e('0x39'),'uri':_0x072e('0x6b'),'headers':{'Authorization':_0x072e('0x6c')+_0x203947['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x203947[_0x072e('0x23')],'to':_0x17a7d9[_0x072e('0x23')],'text':_0x17a7d9[_0x072e('0xe')]},'json':!![]};return rp(_0x231c52)['then'](function(_0x55468f){if(_0x55468f['code']==0xca){_0x30deae['message']=_0x55468f;var _0x43a64d={'method':'POST','uri':_0x072e('0x6d'),'headers':{'Authorization':_0x072e('0x6c')+_0x203947[_0x072e('0x5b')],'Content-Type':'application/json'},'body':{'refid':_0x30deae[_0x072e('0x6e')]['refid']},'json':!![]};return rp(_0x43a64d)[_0x072e('0x1a')](function(_0x53f7e5){_0x30deae[_0x072e('0x6f')]=_0x53f7e5;var _0x1c4406={'messageId':_0x30deae['message'][_0x072e('0x70')],'read':!![]};return _0x571a68['update'](_0x1c4406);});}else{return logger[_0x072e('0x2a')](_0x072e('0x2b'),'afterCreate','intelepeer',util[_0x072e('0x2e')](_0x55468f,{'showHidden':![],'depth':null}));}})[_0x072e('0x1c')](function(_0x36b993){return logger[_0x072e('0x2a')](_0x072e('0x2b'),_0x072e('0x2c'),_0x072e('0x6a'),util[_0x072e('0x2e')](_0x36b993,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x072e('0x2b'),_0x072e('0x2c'),_0x072e('0x6a'),_0x072e('0x71'));}break;}}})[_0x072e('0x72')](function(){_0x53222e();});}else{_0x53222e();}}},'charset':_0x072e('0x73'),'collate':_0x072e('0x74')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 6dbfc28..9f9e271 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 _0x5f66=['stringify','error','code','message','info','result','SmsMessage','create','body','options','raw','CreateSmsMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','then','SmsMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x53e22c,_0x1cb123){var _0x273c0c=function(_0x3d2fbb){while(--_0x3d2fbb){_0x53e22c['push'](_0x53e22c['shift']());}};_0x273c0c(++_0x1cb123);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'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});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('SmsMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('SmsMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateSmsMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateSmsMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0x0b0e=['message','result','SmsMessage','create','body','options','CreateSmsMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s'];(function(_0x3ce8bd,_0x319a76){var _0x5eb067=function(_0x578c39){while(--_0x578c39){_0x3ce8bd['push'](_0x3ce8bd['shift']());}};_0x5eb067(++_0x319a76);}(_0x0b0e,0x187));var _0xe0b0=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0x0b0e[_0x20cc29];return _0x28d513;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateSmsMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateSmsMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index a149a53..b7c245e 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 _0x1241=['save','remove','update','removeListener','smsMessage:','./smsMessage.events'];(function(_0x5dd8f1,_0x324795){var _0x4749f3=function(_0x1986dc){while(--_0x1986dc){_0x5dd8f1['push'](_0x5dd8f1['shift']());}};_0x4749f3(++_0x324795);}(_0x1241,0x65));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require(_0x1124('0x0'));var events=[_0x1124('0x1'),_0x1124('0x2'),_0x1124('0x3')];function createListener(_0x4d7630,_0x4e65e0){return function(_0x497442){_0x4e65e0['emit'](_0x4d7630,_0x497442);};}function removeListener(_0x8bbb86,_0x29ff6a){return function(){SmsMessageEvents[_0x1124('0x4')](_0x8bbb86,_0x29ff6a);};}exports['register']=function(_0x24f7aa){for(var _0x580e20=0x0,_0x18f79e=events['length'];_0x580e20<_0x18f79e;_0x580e20++){var _0x1afe0d=events[_0x580e20];var _0x18893d=createListener(_0x1124('0x5')+_0x1afe0d,_0x24f7aa);SmsMessageEvents['on'](_0x1afe0d,_0x18893d);}}; \ No newline at end of file +var _0x69dd=['remove','register','length','smsMessage:','save'];(function(_0x20a97c,_0xef5d83){var _0x377968=function(_0x1c5240){while(--_0x1c5240){_0x20a97c['push'](_0x20a97c['shift']());}};_0x377968(++_0xef5d83);}(_0x69dd,0x13a));var _0xd69d=function(_0x31a176,_0x271c44){_0x31a176=_0x31a176-0x0;var _0x3ab000=_0x69dd[_0x31a176];return _0x3ab000;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xd69d('0x0'),_0xd69d('0x1'),'update'];function createListener(_0x466ed4,_0x9a87a){return function(_0x1c457a){_0x9a87a['emit'](_0x466ed4,_0x1c457a);};}function removeListener(_0x4b5360,_0x58fb53){return function(){SmsMessageEvents['removeListener'](_0x4b5360,_0x58fb53);};}exports[_0xd69d('0x2')]=function(_0x495872){for(var _0x5baf0e=0x0,_0xdc0393=events[_0xd69d('0x3')];_0x5baf0e<_0xdc0393;_0x5baf0e++){var _0x15488=events[_0x5baf0e];var _0x4c764=createListener(_0xd69d('0x4')+_0x15488,_0x495872);SmsMessageEvents['on'](_0x15488,_0x4c764);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index a8c6296..4d21757 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 _0x4300=['show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','removeTeams','delete','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','get','describe','/:id'];(function(_0x64f3a3,_0x29b36c){var _0x4a2c33=function(_0x369c9d){while(--_0x369c9d){_0x64f3a3['push'](_0x64f3a3['shift']());}};_0x4a2c33(++_0x29b36c);}(_0x4300,0x1a6));var _0x0430=function(_0x5a95cc,_0x1c0453){_0x5a95cc=_0x5a95cc-0x0;var _0x4c2367=_0x4300[_0x5a95cc];return _0x4c2367;};'use strict';var multer=require(_0x0430('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0430('0x1')]();var auth=require(_0x0430('0x2'));var interaction=require(_0x0430('0x3'));var config=require(_0x0430('0x4'));var controller=require(_0x0430('0x5'));router['get']('/',auth[_0x0430('0x6')](),controller['index']);router[_0x0430('0x7')]('/describe',auth[_0x0430('0x6')](),controller[_0x0430('0x8')]);router[_0x0430('0x7')](_0x0430('0x9'),auth[_0x0430('0x6')](),controller[_0x0430('0xa')]);router[_0x0430('0x7')](_0x0430('0xb'),auth[_0x0430('0x6')](),controller['getMembers']);router[_0x0430('0x7')](_0x0430('0xc'),auth[_0x0430('0x6')](),controller[_0x0430('0xd')]);router[_0x0430('0x7')](_0x0430('0xe'),auth[_0x0430('0x6')](),controller[_0x0430('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0430('0x10')]);router[_0x0430('0x11')](_0x0430('0xc'),auth[_0x0430('0x6')](),controller[_0x0430('0x12')]);router[_0x0430('0x11')](_0x0430('0xe'),auth['isAuthenticated'](),controller[_0x0430('0x13')]);router[_0x0430('0x14')](_0x0430('0x9'),auth[_0x0430('0x6')](),controller['update']);router['delete']('/:id',auth[_0x0430('0x6')](),controller['destroy']);router['delete'](_0x0430('0xc'),auth[_0x0430('0x6')](),controller[_0x0430('0x15')]);router[_0x0430('0x16')](_0x0430('0xe'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x0430('0x17')]=router; \ No newline at end of file +var _0x7ed1=['../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','post','/:id/teams','addAgents','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x411cd6,_0x997954){var _0x3491e4=function(_0x4aec04){while(--_0x4aec04){_0x411cd6['push'](_0x411cd6['shift']());}};_0x3491e4(++_0x997954);}(_0x7ed1,0xca));var _0x17ed=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7ed1[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x17ed('0x0'));var util=require('util');var path=require(_0x17ed('0x1'));var timeout=require(_0x17ed('0x2'));var express=require(_0x17ed('0x3'));var router=express[_0x17ed('0x4')]();var auth=require(_0x17ed('0x5'));var interaction=require(_0x17ed('0x6'));var config=require('../../config/environment');var controller=require(_0x17ed('0x7'));router[_0x17ed('0x8')]('/',auth[_0x17ed('0x9')](),controller[_0x17ed('0xa')]);router['get']('/describe',auth[_0x17ed('0x9')](),controller[_0x17ed('0xb')]);router[_0x17ed('0x8')](_0x17ed('0xc'),auth['isAuthenticated'](),controller[_0x17ed('0xd')]);router[_0x17ed('0x8')](_0x17ed('0xe'),auth[_0x17ed('0x9')](),controller[_0x17ed('0xf')]);router[_0x17ed('0x8')]('/:id/teams',auth[_0x17ed('0x9')](),controller['getTeams']);router['get'](_0x17ed('0x10'),auth[_0x17ed('0x9')](),controller[_0x17ed('0x11')]);router[_0x17ed('0x12')]('/',auth[_0x17ed('0x9')](),controller['create']);router[_0x17ed('0x12')](_0x17ed('0x13'),auth[_0x17ed('0x9')](),controller['addTeams']);router[_0x17ed('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x17ed('0x14')]);router['put'](_0x17ed('0xc'),auth[_0x17ed('0x9')](),controller[_0x17ed('0x15')]);router[_0x17ed('0x16')]('/:id',auth[_0x17ed('0x9')](),controller[_0x17ed('0x17')]);router[_0x17ed('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0x17ed('0x18')]);router[_0x17ed('0x16')](_0x17ed('0x10'),auth[_0x17ed('0x9')](),controller[_0x17ed('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 66c6958..a80affe 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 _0xa35d=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x2c6505,_0x58b6d3){var _0x3b6fbc=function(_0x3f180a){while(--_0x3f180a){_0x2c6505['push'](_0x2c6505['shift']());}};_0x3b6fbc(++_0x58b6d3);}(_0xa35d,0x11f));var _0xda35=function(_0x2eed8a,_0x5c04f8){_0x2eed8a=_0x2eed8a-0x0;var _0x77954b=_0xa35d[_0x2eed8a];return _0x77954b;};'use strict';var Sequelize=require(_0xda35('0x0'));module['exports']={'name':{'type':Sequelize[_0xda35('0x1')],'unique':_0xda35('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xda35('0x1')]},'timeout':{'type':Sequelize[_0xda35('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xda35('0x4')](_0xda35('0x5'),_0xda35('0x6'),_0xda35('0x7'))}}; \ No newline at end of file +var _0x6ce2=['name','INTEGER','rrmemory','beepall','sequelize','STRING'];(function(_0x3f3b5c,_0xa170a5){var _0x471c47=function(_0x548f32){while(--_0x548f32){_0x3f3b5c['push'](_0x3f3b5c['shift']());}};_0x471c47(++_0xa170a5);}(_0x6ce2,0xca));var _0x26ce=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6ce2[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x26ce('0x0'));module['exports']={'name':{'type':Sequelize[_0x26ce('0x1')],'unique':_0x26ce('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x26ce('0x1')]},'timeout':{'type':Sequelize[_0x26ce('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x26ce('0x4'),_0x26ce('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 8a62efb..559e7c1 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 _0x0b0e=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','status','offset','Content-Range','apply','reject','update','then','get','SmsQueues','destroy','end','error','stack','name','send','index','map','SmsQueue','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserSmsQueue','findAndCountAll','UserId','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','transaction','each','findOrCreate','emit','userSmsQueue:save','removeTeams','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeAgents','forEach','omit','spread','userSmsQueue:remove','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x34f545,_0x2bd2ee){_0x34f545=_0x34f545-0x0;var _0x1ff6b8=_0x0b0e[_0x34f545];return _0x1ff6b8;};'use strict';var pdf=require(_0xe0b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b0('0x2'));var rp=require(_0xe0b0('0x3'));var moment=require(_0xe0b0('0x4'));var BPromise=require(_0xe0b0('0x5'));var Mustache=require(_0xe0b0('0x6'));var util=require(_0xe0b0('0x7'));var path=require(_0xe0b0('0x8'));var sox=require(_0xe0b0('0x9'));var csv=require(_0xe0b0('0xa'));var ejs=require(_0xe0b0('0xb'));var fs=require('fs');var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0xa'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var db=require('../../mysqldb')['db'];config[_0xe0b0('0x17')]=_[_0xe0b0('0x18')](config[_0xe0b0('0x17')],{'host':_0xe0b0('0x19'),'port':0x18eb});var socket=require(_0xe0b0('0x1a'))(new Redis(config['redis']));require(_0xe0b0('0x1b'))[_0xe0b0('0x1c')](socket);function respondWithStatusCode(_0x743318,_0x24babd){_0x24babd=_0x24babd||0xcc;return function(_0x177c24){if(_0x177c24){return _0x743318['sendStatus'](_0x24babd);}return _0x743318[_0xe0b0('0x1d')](_0x24babd)['end']();};}function respondWithResult(_0x35cb40,_0xadee6e){_0xadee6e=_0xadee6e||0xc8;return function(_0x519ae8){if(_0x519ae8){return _0x35cb40[_0xe0b0('0x1d')](_0xadee6e)['json'](_0x519ae8);}};}function respondWithFilteredResult(_0x2d6fb6,_0x100204){return function(_0x56bcc7){if(_0x56bcc7){var _0x54a3eb=_0x56bcc7['count'],_0x46bb44=_0x100204[_0xe0b0('0x1e')],_0x50a441=_0x100204['offset']+_0x100204['limit'],_0x4df8da;if(_0x50a441>=_0x54a3eb){_0x50a441=_0x54a3eb;_0x4df8da=0xc8;}else{_0x4df8da=0xce;}_0x2d6fb6[_0xe0b0('0x1d')](_0x4df8da);return _0x2d6fb6['set'](_0xe0b0('0x1f'),_0x46bb44+'-'+_0x50a441+'/'+_0x54a3eb)['json'](_0x56bcc7);}return null;};}function patchUpdates(_0x2c84cc){return function(_0x1cd7c4){try{jsonpatch[_0xe0b0('0x20')](_0x1cd7c4,_0x2c84cc,!![]);}catch(_0x310a6d){return BPromise[_0xe0b0('0x21')](_0x310a6d);}return _0x1cd7c4['save']();};}function saveUpdates(_0x4cae54,_0x2fa820){return function(_0x5512bb){if(_0x5512bb){return _0x5512bb[_0xe0b0('0x22')](_0x4cae54)[_0xe0b0('0x23')](function(_0x513e63){return _0x513e63;});}return null;};}function removeEntity(_0x170ad8,_0x503883){return function(_0x2208d0){if(_0x2208d0){return _0x2208d0['destroy']()[_0xe0b0('0x23')](function(){var _0x576352=_0x2208d0[_0xe0b0('0x24')]({'plain':!![]});var _0x4de537=_0xe0b0('0x25');return db['UserProfileResource'][_0xe0b0('0x26')]({'where':{'type':_0x4de537,'resourceId':_0x576352['id']}})['then'](function(){return _0x2208d0;});})[_0xe0b0('0x23')](function(){_0x170ad8[_0xe0b0('0x1d')](0xcc)[_0xe0b0('0x27')]();});}};}function handleEntityNotFound(_0x1d91ad,_0x3ec2){return function(_0x10745d){if(!_0x10745d){_0x1d91ad['sendStatus'](0x194);}return _0x10745d;};}function handleError(_0x1444b9,_0x1b8aa8){_0x1b8aa8=_0x1b8aa8||0x1f4;return function(_0x5b7a64){logger[_0xe0b0('0x28')](_0x5b7a64[_0xe0b0('0x29')]);if(_0x5b7a64[_0xe0b0('0x2a')]){delete _0x5b7a64[_0xe0b0('0x2a')];}_0x1444b9[_0xe0b0('0x1d')](_0x1b8aa8)[_0xe0b0('0x2b')](_0x5b7a64);};}exports[_0xe0b0('0x2c')]=function(_0x4fb3b7,_0x1854b8){var _0x3c0109={},_0x48a9b5={},_0x4fe400={'count':0x0,'rows':[]};var _0x158b7f=_[_0xe0b0('0x2d')](db[_0xe0b0('0x2e')][_0xe0b0('0x2f')],function(_0x2ab1b1){return{'name':_0x2ab1b1['fieldName'],'type':_0x2ab1b1[_0xe0b0('0x30')][_0xe0b0('0x31')]};});_0x48a9b5[_0xe0b0('0x32')]=_[_0xe0b0('0x2d')](_0x158b7f,_0xe0b0('0x2a'));_0x48a9b5['query']=_[_0xe0b0('0x33')](_0x4fb3b7[_0xe0b0('0x34')]);_0x48a9b5[_0xe0b0('0x35')]=_[_0xe0b0('0x36')](_0x48a9b5[_0xe0b0('0x32')],_0x48a9b5[_0xe0b0('0x34')]);_0x3c0109[_0xe0b0('0x37')]=_[_0xe0b0('0x36')](_0x48a9b5[_0xe0b0('0x32')],qs[_0xe0b0('0x38')](_0x4fb3b7[_0xe0b0('0x34')][_0xe0b0('0x38')]));_0x3c0109[_0xe0b0('0x37')]=_0x3c0109[_0xe0b0('0x37')][_0xe0b0('0x39')]?_0x3c0109['attributes']:_0x48a9b5[_0xe0b0('0x32')];if(!_0x4fb3b7[_0xe0b0('0x34')][_0xe0b0('0x3a')](_0xe0b0('0x3b'))){_0x3c0109[_0xe0b0('0x3c')]=qs[_0xe0b0('0x3c')](_0x4fb3b7[_0xe0b0('0x34')]['limit']);_0x3c0109['offset']=qs['offset'](_0x4fb3b7['query'][_0xe0b0('0x1e')]);}_0x3c0109[_0xe0b0('0x3d')]=qs[_0xe0b0('0x3e')](_0x4fb3b7['query'][_0xe0b0('0x3e')]);_0x3c0109[_0xe0b0('0x3f')]=qs[_0xe0b0('0x35')](_[_0xe0b0('0x40')](_0x4fb3b7['query'],_0x48a9b5[_0xe0b0('0x35')]));if(_0x4fb3b7[_0xe0b0('0x34')][_0xe0b0('0x41')]){_0x3c0109[_0xe0b0('0x3f')]=_[_0xe0b0('0x42')](_0x3c0109[_0xe0b0('0x3f')],{'$or':_[_0xe0b0('0x2d')](_0x158b7f,function(_0x115a69){if(_0x115a69[_0xe0b0('0x30')]!=='VIRTUAL'){var _0x3e349b={};_0x3e349b[_0x115a69['name']]={'$like':'%'+_0x4fb3b7[_0xe0b0('0x34')][_0xe0b0('0x41')]+'%'};return _0x3e349b;}})});}_0x3c0109=_[_0xe0b0('0x42')]({},_0x3c0109,_0x4fb3b7[_0xe0b0('0x43')]);var _0x4d0f98={'where':_0x3c0109[_0xe0b0('0x3f')]};return db[_0xe0b0('0x2e')][_0xe0b0('0x44')](_0x4d0f98)[_0xe0b0('0x23')](function(_0x19c80e){_0x4fe400[_0xe0b0('0x44')]=_0x19c80e;if(_0x4fb3b7[_0xe0b0('0x34')][_0xe0b0('0x45')]){_0x3c0109['include']=[{'all':!![]}];}return db[_0xe0b0('0x2e')][_0xe0b0('0x46')](_0x3c0109);})['then'](function(_0x515bd2){_0x4fe400[_0xe0b0('0x47')]=_0x515bd2;return _0x4fe400;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x1854b8,_0x3c0109))['catch'](handleError(_0x1854b8,null));};exports[_0xe0b0('0x48')]=function(_0x285d61,_0x6bca5c){var _0x1c869d={'raw':!![],'where':{'id':_0x285d61['params']['id']}},_0x1a8cc7={};_0x1a8cc7['model']=_['keys'](db[_0xe0b0('0x2e')][_0xe0b0('0x2f')]);_0x1a8cc7['query']=_[_0xe0b0('0x33')](_0x285d61[_0xe0b0('0x34')]);_0x1a8cc7[_0xe0b0('0x35')]=_[_0xe0b0('0x36')](_0x1a8cc7[_0xe0b0('0x32')],_0x1a8cc7['query']);_0x1c869d['attributes']=_[_0xe0b0('0x36')](_0x1a8cc7[_0xe0b0('0x32')],qs[_0xe0b0('0x38')](_0x285d61[_0xe0b0('0x34')][_0xe0b0('0x38')]));_0x1c869d['attributes']=_0x1c869d[_0xe0b0('0x37')][_0xe0b0('0x39')]?_0x1c869d['attributes']:_0x1a8cc7['model'];if(_0x285d61['query'][_0xe0b0('0x45')]){_0x1c869d[_0xe0b0('0x49')]=[{'all':!![]}];}_0x1c869d=_[_0xe0b0('0x42')]({},_0x1c869d,_0x285d61[_0xe0b0('0x43')]);return db['SmsQueue'][_0xe0b0('0x4a')](_0x1c869d)[_0xe0b0('0x23')](handleEntityNotFound(_0x6bca5c,null))['then'](respondWithResult(_0x6bca5c,null))['catch'](handleError(_0x6bca5c,null));};exports[_0xe0b0('0x4b')]=function(_0x1bc6e0,_0x497f4f){return db[_0xe0b0('0x2e')][_0xe0b0('0x4b')](_0x1bc6e0['body'],{})['then'](function(_0x123ad2){var _0x511679=_0x1bc6e0[_0xe0b0('0x4c')][_0xe0b0('0x24')]({'plain':!![]});if(!_0x511679)throw new Error(_0xe0b0('0x4d'));if(_0x511679[_0xe0b0('0x4e')]===_0xe0b0('0x4c')){var _0xf9e694=_0x123ad2['get']({'plain':!![]});var _0x5d018d=_0xe0b0('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x5d018d,'userProfileId':_0x511679[_0xe0b0('0x4f')]},'raw':!![]})[_0xe0b0('0x23')](function(_0x54cf7b){if(_0x54cf7b&&_0x54cf7b['autoAssociation']===0x0){return db[_0xe0b0('0x50')][_0xe0b0('0x4b')]({'name':_0xf9e694[_0xe0b0('0x2a')],'resourceId':_0xf9e694['id'],'type':_0x54cf7b[_0xe0b0('0x2a')],'sectionId':_0x54cf7b['id']},{})[_0xe0b0('0x23')](function(){return _0x123ad2;});}else{return _0x123ad2;}})[_0xe0b0('0x51')](function(_0x84fabb){logger['error'](_0xe0b0('0x52'),_0x84fabb);throw _0x84fabb;});}return _0x123ad2;})['then'](respondWithResult(_0x497f4f,0xc9))[_0xe0b0('0x51')](handleError(_0x497f4f,null));};exports['update']=function(_0x5b2055,_0x33822e){if(_0x5b2055[_0xe0b0('0x53')]['id']){delete _0x5b2055[_0xe0b0('0x53')]['id'];}return db[_0xe0b0('0x2e')][_0xe0b0('0x4a')]({'where':{'id':_0x5b2055[_0xe0b0('0x54')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x33822e,null))[_0xe0b0('0x23')](saveUpdates(_0x5b2055[_0xe0b0('0x53')],null))['then'](respondWithResult(_0x33822e,null))[_0xe0b0('0x51')](handleError(_0x33822e,null));};exports['destroy']=function(_0x2b5553,_0x3ae36e){return db[_0xe0b0('0x2e')][_0xe0b0('0x4a')]({'where':{'id':_0x2b5553[_0xe0b0('0x54')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x3ae36e,null))['then'](removeEntity(_0x3ae36e,null))[_0xe0b0('0x51')](handleError(_0x3ae36e,null));};exports[_0xe0b0('0x55')]=function(_0x437a15,_0x271445){return db[_0xe0b0('0x2e')][_0xe0b0('0x55')]()[_0xe0b0('0x23')](respondWithResult(_0x271445,null))[_0xe0b0('0x51')](handleError(_0x271445,null));};exports[_0xe0b0('0x56')]=function(_0xf331df,_0x1eb5d6,_0x18ab99){var _0xc719d2={'raw':!![],'where':{}},_0x10eb99={},_0xcdf97;return db[_0xe0b0('0x2e')][_0xe0b0('0x57')]({'where':{'id':_0xf331df[_0xe0b0('0x54')]['id']}})['then'](handleEntityNotFound(_0x1eb5d6,null))[_0xe0b0('0x23')](function(_0xe7fbac){if(_0xe7fbac){_0xcdf97=_0xe7fbac[_0xe0b0('0x24')]({'plain':!![]});_0x10eb99[_0xe0b0('0x32')]=_[_0xe0b0('0x33')](db[_0xe0b0('0x58')][_0xe0b0('0x2f')]);_0x10eb99['query']=_['keys'](_0xf331df[_0xe0b0('0x34')]);_0x10eb99[_0xe0b0('0x35')]=_[_0xe0b0('0x36')](_0x10eb99['model'],_0x10eb99[_0xe0b0('0x34')]);_0xc719d2[_0xe0b0('0x37')]=_[_0xe0b0('0x36')](_0x10eb99[_0xe0b0('0x32')],qs[_0xe0b0('0x38')](_0xf331df['query'][_0xe0b0('0x38')]));_0xc719d2[_0xe0b0('0x37')]=_0xc719d2[_0xe0b0('0x37')]['length']?_0xc719d2[_0xe0b0('0x37')]:_0x10eb99[_0xe0b0('0x32')];if(!_0xf331df['query'][_0xe0b0('0x3a')]('nolimit')){_0xc719d2['limit']=qs[_0xe0b0('0x3c')](_0xf331df['query']['limit']);_0xc719d2[_0xe0b0('0x1e')]=qs[_0xe0b0('0x1e')](_0xf331df[_0xe0b0('0x34')][_0xe0b0('0x1e')]);}_0xc719d2['order']=qs[_0xe0b0('0x3e')](_0xf331df[_0xe0b0('0x34')][_0xe0b0('0x3e')]);_0xc719d2[_0xe0b0('0x3f')]=qs[_0xe0b0('0x35')](_[_0xe0b0('0x40')](_0xf331df[_0xe0b0('0x34')],_0x10eb99[_0xe0b0('0x35')]));_0xc719d2['where']['SmsQueueId']=_0xe7fbac['id'];if(_0xf331df[_0xe0b0('0x34')][_0xe0b0('0x41')]){_0xc719d2[_0xe0b0('0x3f')]=_['merge'](_0xc719d2['where'],{'$or':_[_0xe0b0('0x2d')](_0xc719d2[_0xe0b0('0x37')],function(_0x5d7cf4){var _0x5eca3d={};_0x5eca3d[_0x5d7cf4]={'$like':'%'+_0xf331df[_0xe0b0('0x34')][_0xe0b0('0x41')]+'%'};return _0x5eca3d;})});}_0xc719d2=_[_0xe0b0('0x42')]({},_0xc719d2,_0xf331df[_0xe0b0('0x43')]);return db[_0xe0b0('0x58')][_0xe0b0('0x46')](_0xc719d2);}})[_0xe0b0('0x23')](function(_0x1b997d){if(_0x1b997d){return db['User'][_0xe0b0('0x59')]({'where':{'id':_[_0xe0b0('0x2d')](_0x1b997d,_0xe0b0('0x5a')),'role':'agent'},'attributes':['id','name','smsPause','updatedAt','createdAt']});}})['then'](function(_0x252527){if(_0x252527){return{'count':_0x252527['count'],'rows':_['map'](_0x252527[_0xe0b0('0x47')],function(_0x2dc06d){return{'membername':_0x2dc06d[_0xe0b0('0x2a')],'UserId':_0x2dc06d['id'],'queue_name':_0xcdf97[_0xe0b0('0x2a')],'SmsQueueId':_0xcdf97['id'],'interface':util[_0xe0b0('0x5b')](_0xe0b0('0x5c'),_0xe0b0('0x5d'),_0x2dc06d[_0xe0b0('0x2a')]),'penalty':0x0,'paused':_0x2dc06d['smsPause'],'createdAt':_0x2dc06d[_0xe0b0('0x5e')],'updatedAt':_0x2dc06d[_0xe0b0('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x23')](respondWithFilteredResult(_0x1eb5d6,_0xc719d2))[_0xe0b0('0x51')](handleError(_0x1eb5d6,null));};exports[_0xe0b0('0x60')]=function(_0x1f70fb,_0x16a2ae,_0x5e3e28){var _0xaf2607={};var _0x5981a3={};var _0x2c9147;var _0x28b927;return db[_0xe0b0('0x2e')][_0xe0b0('0x57')]({'where':{'id':_0x1f70fb['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x16a2ae,null))[_0xe0b0('0x23')](function(_0x49deef){if(_0x49deef){_0x2c9147=_0x49deef;_0x5981a3['model']=_[_0xe0b0('0x33')](db[_0xe0b0('0x61')][_0xe0b0('0x2f')]);_0x5981a3[_0xe0b0('0x34')]=_[_0xe0b0('0x33')](_0x1f70fb[_0xe0b0('0x34')]);_0x5981a3[_0xe0b0('0x35')]=_[_0xe0b0('0x36')](_0x5981a3[_0xe0b0('0x32')],_0x5981a3[_0xe0b0('0x34')]);_0xaf2607['attributes']=_['intersection'](_0x5981a3[_0xe0b0('0x32')],qs['fields'](_0x1f70fb['query']['fields']));_0xaf2607['attributes']=_0xaf2607[_0xe0b0('0x37')]['length']?_0xaf2607[_0xe0b0('0x37')]:_0x5981a3[_0xe0b0('0x32')];_0xaf2607[_0xe0b0('0x3d')]=qs[_0xe0b0('0x3e')](_0x1f70fb['query'][_0xe0b0('0x3e')]);_0xaf2607[_0xe0b0('0x3f')]=qs['filters'](_[_0xe0b0('0x40')](_0x1f70fb[_0xe0b0('0x34')],_0x5981a3[_0xe0b0('0x35')]));if(_0x1f70fb[_0xe0b0('0x34')][_0xe0b0('0x41')]){_0xaf2607['where']=_['merge'](_0xaf2607['where'],{'$or':_['map'](_0xaf2607['attributes'],function(_0xfbe16d){var _0x567e1a={};_0x567e1a[_0xfbe16d]={'$like':'%'+_0x1f70fb[_0xe0b0('0x34')]['filter']+'%'};return _0x567e1a;})});}_0xaf2607=_[_0xe0b0('0x42')]({},_0xaf2607,_0x1f70fb[_0xe0b0('0x43')]);return _0x2c9147[_0xe0b0('0x60')](_0xaf2607);}})[_0xe0b0('0x23')](function(_0x199929){if(_0x199929){_0x28b927=_0x199929[_0xe0b0('0x39')];if(!_0x1f70fb['query']['hasOwnProperty']('nolimit')){_0xaf2607['limit']=qs[_0xe0b0('0x3c')](_0x1f70fb[_0xe0b0('0x34')][_0xe0b0('0x3c')]);_0xaf2607[_0xe0b0('0x1e')]=qs[_0xe0b0('0x1e')](_0x1f70fb['query'][_0xe0b0('0x1e')]);}return _0x2c9147[_0xe0b0('0x60')](_0xaf2607);}})[_0xe0b0('0x23')](function(_0xc6090e){if(_0xc6090e){return _0xc6090e?{'count':_0x28b927,'rows':_0xc6090e}:null;}})[_0xe0b0('0x23')](respondWithResult(_0x16a2ae,null))[_0xe0b0('0x51')](handleError(_0x16a2ae,null));};exports[_0xe0b0('0x62')]=function(_0x7beacf,_0x14f721,_0x5565ef){var _0x589c47=_0x7beacf[_0xe0b0('0x53')][_0xe0b0('0x63')];return db['Team'][_0xe0b0('0x46')]({'where':{'id':_0x589c47},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x64')],'as':_0xe0b0('0x65'),'attributes':['id',_0xe0b0('0x2a'),_0xe0b0('0x66'),_0xe0b0('0x67'),_0xe0b0('0x68')],'raw':!![]}]})[_0xe0b0('0x23')](function(_0x50b883){if(_0x50b883){var _0x5f4911=_['flatMap'](_0x50b883,function(_0xc19743){var _0x90d471=_0xc19743['get']({'plain':!![]});return _0x90d471[_0xe0b0('0x65')];});return db[_0xe0b0('0x2e')][_0xe0b0('0x4a')]({'where':{'id':_0x7beacf[_0xe0b0('0x54')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x69')](function(_0x266835){return _0x56c4b9['addTeams'](_0x589c47,{'transaction':_0x266835})[_0xe0b0('0x23')](function(){return BPromise[_0xe0b0('0x6a')](_0x5f4911,function(_0x5547ee){return db['UserSmsQueue'][_0xe0b0('0x6b')]({'where':{'UserId':_0x5547ee['id'],'SmsQueueId':_0x7beacf['params']['id']},'transaction':_0x266835});});})[_0xe0b0('0x23')](function(){_0x5f4911['forEach'](function(_0x22e240){socket[_0xe0b0('0x6c')](_0xe0b0('0x6d'),{'UserId':_0x22e240['id'],'SmsQueueId':_0x56c4b9['id']});});});});});}})[_0xe0b0('0x23')](respondWithStatusCode(_0x14f721,null))[_0xe0b0('0x51')](handleError(_0x14f721,null));};exports[_0xe0b0('0x6e')]=function(_0x434dfa,_0x2ebbb5,_0xf76449){return db['Team'][_0xe0b0('0x46')]({'where':{'id':_0x434dfa[_0xe0b0('0x34')][_0xe0b0('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2ebbb5,null))[_0xe0b0('0x23')](function(_0x350c40){var _0x570402=_[_0xe0b0('0x2d')](_0x350c40,'id');var _0x4e4b45=[];var _0x528932=[];var _0x4e0b18=squel['select']();_0x4e0b18['field'](_0xe0b0('0x6f'))[_0xe0b0('0x70')](_0xe0b0('0x71'),'tq')[_0xe0b0('0x72')](_0xe0b0('0x73'),'ut',_0xe0b0('0x74'))['where'](_0xe0b0('0x75'),_0x434dfa[_0xe0b0('0x54')]['id']);for(var _0x421b3b=0x0;_0x421b3b<_0x350c40['length'];_0x421b3b+=0x1){let _0x2a4f5d=_0x350c40[_0x421b3b];for(var _0x447641=0x0;_0x447641<_0x2a4f5d['Agents']['length'];_0x447641+=0x1){let _0x33f89a=_0x2a4f5d['Agents'][_0x447641];var _0x46ab89=_0x4e0b18[_0xe0b0('0x76')]();_0x46ab89[_0xe0b0('0x3f')](_0xe0b0('0x77'),_0x33f89a['id']);_0x528932[_0xe0b0('0x78')](db[_0xe0b0('0x79')][_0xe0b0('0x34')](_0x46ab89['toString'](),{'type':db[_0xe0b0('0x79')][_0xe0b0('0x7a')][_0xe0b0('0x7b')]})[_0xe0b0('0x23')](function(_0x2b087b){if(_0x2b087b['length']===0x1){return _0x33f89a['id'];}else{var _0x5b91a2=_[_0xe0b0('0x7c')](_[_0xe0b0('0x2d')](_0x2b087b,_0xe0b0('0x7d')),function(_0x268d0c){return _[_0xe0b0('0x7e')](_0x570402,_0x268d0c);});if(_0x5b91a2){return _0x33f89a['id'];}}}));}}return BPromise[_0xe0b0('0x7f')](_0x528932)[_0xe0b0('0x23')](function(_0x387389){_0x4e4b45=_(_0x4e4b45)[_0xe0b0('0x80')](_0x387389)[_0xe0b0('0x81')]()['value']();return db[_0xe0b0('0x2e')][_0xe0b0('0x4a')]({'where':{'id':_0x434dfa[_0xe0b0('0x54')]['id']}})[_0xe0b0('0x23')](function(_0x55e456){return db[_0xe0b0('0x79')][_0xe0b0('0x69')](function(_0x1641dd){return _0x55e456[_0xe0b0('0x6e')](_0x434dfa[_0xe0b0('0x34')]['ids'],{'transaction':_0x1641dd})[_0xe0b0('0x23')](function(){if(!_['isEmpty'](_0x4e4b45)){return _0x55e456[_0xe0b0('0x82')](_0x4e4b45,{'transaction':_0x1641dd});}})[_0xe0b0('0x23')](function(){_0x4e4b45[_0xe0b0('0x83')](function(_0x23c448){socket[_0xe0b0('0x6c')]('userSmsQueue:remove',{'UserId':_0x23c448,'SmsQueueId':_0x55e456['id']});});});});});});})['then'](respondWithStatusCode(_0x2ebbb5,null))[_0xe0b0('0x51')](handleError(_0x2ebbb5,null));};exports['addAgents']=function(_0x436ab9,_0x4c82d6,_0x1b10be){return db[_0xe0b0('0x2e')][_0xe0b0('0x4a')]({'where':{'id':_0x436ab9[_0xe0b0('0x54')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x4c82d6,null))[_0xe0b0('0x23')](function(_0x43ff30){if(_0x43ff30){return _0x43ff30['addAgents'](_0x436ab9['body'][_0xe0b0('0x63')],_[_0xe0b0('0x84')](_0x436ab9[_0xe0b0('0x53')],[_0xe0b0('0x63'),'id'])||{})[_0xe0b0('0x85')](function(_0x2b4d49){for(var _0x3b7a7a=0x0;_0x3b7a7a<_0x436ab9[_0xe0b0('0x53')][_0xe0b0('0x63')][_0xe0b0('0x39')];_0x3b7a7a+=0x1){socket['emit']('userSmsQueue:save',{'UserId':_0x436ab9[_0xe0b0('0x53')][_0xe0b0('0x63')][_0x3b7a7a],'SmsQueueId':_0x436ab9[_0xe0b0('0x54')]['id']});}return _0x2b4d49;});}})[_0xe0b0('0x23')](respondWithResult(_0x4c82d6,null))[_0xe0b0('0x51')](handleError(_0x4c82d6,null));};exports[_0xe0b0('0x82')]=function(_0x33b67a,_0x51995b,_0x4c4748){return db[_0xe0b0('0x2e')][_0xe0b0('0x4a')]({'where':{'id':_0x33b67a[_0xe0b0('0x54')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x51995b,null))[_0xe0b0('0x23')](function(_0x19cc74){if(_0x19cc74){return _0x19cc74[_0xe0b0('0x82')](_0x33b67a[_0xe0b0('0x34')][_0xe0b0('0x63')])[_0xe0b0('0x23')](function(){if(_['isArray'](_0x33b67a[_0xe0b0('0x34')][_0xe0b0('0x63')])){for(var _0x47b456=0x0;_0x47b456<_0x33b67a[_0xe0b0('0x34')][_0xe0b0('0x63')][_0xe0b0('0x39')];_0x47b456+=0x1){socket[_0xe0b0('0x6c')](_0xe0b0('0x86'),{'UserId':Number(_0x33b67a['query'][_0xe0b0('0x63')][_0x47b456]),'SmsQueueId':Number(_0x33b67a[_0xe0b0('0x54')]['id'])});}}else{socket[_0xe0b0('0x6c')](_0xe0b0('0x86'),{'UserId':Number(_0x33b67a[_0xe0b0('0x34')]['ids']),'SmsQueueId':Number(_0x33b67a[_0xe0b0('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x51995b,null))[_0xe0b0('0x51')](handleError(_0x51995b,null));};exports[_0xe0b0('0x87')]=function(_0x17cc14,_0x539a12,_0x5d5e32){var _0x45ae1a={};var _0x2349df={};var _0x619226;var _0x47d9d1;return db['SmsQueue']['findOne']({'where':{'id':_0x17cc14['params']['id']}})['then'](handleEntityNotFound(_0x539a12,null))['then'](function(_0x3474ab){if(_0x3474ab){_0x619226=_0x3474ab;_0x2349df[_0xe0b0('0x32')]=_['keys'](db[_0xe0b0('0x64')][_0xe0b0('0x2f')]);_0x2349df[_0xe0b0('0x34')]=_[_0xe0b0('0x33')](_0x17cc14[_0xe0b0('0x34')]);_0x2349df['filters']=_['intersection'](_0x2349df[_0xe0b0('0x32')],_0x2349df[_0xe0b0('0x34')]);_0x45ae1a[_0xe0b0('0x37')]=_['intersection'](_0x2349df[_0xe0b0('0x32')],qs[_0xe0b0('0x38')](_0x17cc14[_0xe0b0('0x34')][_0xe0b0('0x38')]));_0x45ae1a[_0xe0b0('0x37')]=_0x45ae1a[_0xe0b0('0x37')]['length']?_0x45ae1a['attributes']:_0x2349df['model'];_0x45ae1a[_0xe0b0('0x3d')]=qs[_0xe0b0('0x3e')](_0x17cc14[_0xe0b0('0x34')][_0xe0b0('0x3e')]);_0x45ae1a[_0xe0b0('0x3f')]=qs[_0xe0b0('0x35')](_[_0xe0b0('0x40')](_0x17cc14[_0xe0b0('0x34')],_0x2349df['filters']));if(_0x17cc14['query'][_0xe0b0('0x41')]){_0x45ae1a[_0xe0b0('0x3f')]=_[_0xe0b0('0x42')](_0x45ae1a['where'],{'$or':_[_0xe0b0('0x2d')](_0x45ae1a[_0xe0b0('0x37')],function(_0x9f1fb){var _0x4949fe={};_0x4949fe[_0x9f1fb]={'$like':'%'+_0x17cc14[_0xe0b0('0x34')]['filter']+'%'};return _0x4949fe;})});}_0x45ae1a=_[_0xe0b0('0x42')]({},_0x45ae1a,_0x17cc14[_0xe0b0('0x43')]);return _0x619226[_0xe0b0('0x87')](_0x45ae1a);}})[_0xe0b0('0x23')](function(_0x3b133a){if(_0x3b133a){_0x47d9d1=_0x3b133a[_0xe0b0('0x39')];if(!_0x17cc14[_0xe0b0('0x34')]['hasOwnProperty'](_0xe0b0('0x3b'))){_0x45ae1a[_0xe0b0('0x3c')]=qs['limit'](_0x17cc14[_0xe0b0('0x34')][_0xe0b0('0x3c')]);_0x45ae1a[_0xe0b0('0x1e')]=qs['offset'](_0x17cc14[_0xe0b0('0x34')][_0xe0b0('0x1e')]);}return _0x619226[_0xe0b0('0x87')](_0x45ae1a);}})['then'](function(_0xed8461){if(_0xed8461){return _0xed8461?{'count':_0x47d9d1,'rows':_0xed8461}:null;}})[_0xe0b0('0x23')](respondWithResult(_0x539a12,null))[_0xe0b0('0x51')](handleError(_0x539a12,null));}; \ No newline at end of file +var _0x5f66=['ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','addAgents','isArray','userSmsQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsQueue.socket','register','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','then','destroy','get','SmsQueues','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','SmsQueue','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','SmsQueueId','map','User','findAndCountAll','UserId','smsPause','updatedAt','createdAt','SIP','getTeams','addTeams','ids','Team','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x65f6('0x13'))['db'];config['redis']=_[_0x65f6('0x14')](config['redis'],{'host':_0x65f6('0x15'),'port':0x18eb});var socket=require(_0x65f6('0x16'))(new Redis(config[_0x65f6('0x17')]));require(_0x65f6('0x18'))[_0x65f6('0x19')](socket);function respondWithStatusCode(_0x1d29fd,_0x44144b){_0x44144b=_0x44144b||0xcc;return function(_0xb1d40a){if(_0xb1d40a){return _0x1d29fd[_0x65f6('0x1a')](_0x44144b);}return _0x1d29fd[_0x65f6('0x1b')](_0x44144b)['end']();};}function respondWithResult(_0x19b9ff,_0x49a913){_0x49a913=_0x49a913||0xc8;return function(_0x5dd324){if(_0x5dd324){return _0x19b9ff[_0x65f6('0x1b')](_0x49a913)[_0x65f6('0x1c')](_0x5dd324);}};}function respondWithFilteredResult(_0x37330d,_0x1c955c){return function(_0x1b1cbb){if(_0x1b1cbb){var _0x1f974c=_0x1b1cbb['count'],_0xc8660c=_0x1c955c[_0x65f6('0x1d')],_0x18380e=_0x1c955c['offset']+_0x1c955c['limit'],_0x495dd6;if(_0x18380e>=_0x1f974c){_0x18380e=_0x1f974c;_0x495dd6=0xc8;}else{_0x495dd6=0xce;}_0x37330d['status'](_0x495dd6);return _0x37330d[_0x65f6('0x1e')](_0x65f6('0x1f'),_0xc8660c+'-'+_0x18380e+'/'+_0x1f974c)['json'](_0x1b1cbb);}return null;};}function patchUpdates(_0x39e19f){return function(_0x270893){try{jsonpatch[_0x65f6('0x20')](_0x270893,_0x39e19f,!![]);}catch(_0x3876ed){return BPromise[_0x65f6('0x21')](_0x3876ed);}return _0x270893[_0x65f6('0x22')]();};}function saveUpdates(_0x581374,_0x197a49){return function(_0x4bb39e){if(_0x4bb39e){return _0x4bb39e['update'](_0x581374)[_0x65f6('0x23')](function(_0xd173f4){return _0xd173f4;});}return null;};}function removeEntity(_0x524e42,_0x1eeaaa){return function(_0x471a33){if(_0x471a33){return _0x471a33[_0x65f6('0x24')]()[_0x65f6('0x23')](function(){var _0x4f5a69=_0x471a33[_0x65f6('0x25')]({'plain':!![]});var _0x59ea32=_0x65f6('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x59ea32,'resourceId':_0x4f5a69['id']}})['then'](function(){return _0x471a33;});})[_0x65f6('0x23')](function(){_0x524e42[_0x65f6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x296cd9,_0x28f710){return function(_0x52277c){if(!_0x52277c){_0x296cd9[_0x65f6('0x1a')](0x194);}return _0x52277c;};}function handleError(_0x2bff2b,_0x28d0df){_0x28d0df=_0x28d0df||0x1f4;return function(_0x559330){logger['error'](_0x559330['stack']);if(_0x559330[_0x65f6('0x27')]){delete _0x559330[_0x65f6('0x27')];}_0x2bff2b[_0x65f6('0x1b')](_0x28d0df)[_0x65f6('0x28')](_0x559330);};}exports[_0x65f6('0x29')]=function(_0x14a387,_0x144e55){var _0x4ace4c={},_0x4ea23d={},_0x154cbd={'count':0x0,'rows':[]};var _0x27e284=_['map'](db['SmsQueue'][_0x65f6('0x2a')],function(_0x1ce43c){return{'name':_0x1ce43c[_0x65f6('0x2b')],'type':_0x1ce43c[_0x65f6('0x2c')][_0x65f6('0x2d')]};});_0x4ea23d[_0x65f6('0x2e')]=_['map'](_0x27e284,_0x65f6('0x27'));_0x4ea23d[_0x65f6('0x2f')]=_[_0x65f6('0x30')](_0x14a387['query']);_0x4ea23d[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x4ea23d[_0x65f6('0x2e')],_0x4ea23d[_0x65f6('0x2f')]);_0x4ace4c[_0x65f6('0x33')]=_[_0x65f6('0x32')](_0x4ea23d['model'],qs[_0x65f6('0x34')](_0x14a387[_0x65f6('0x2f')]['fields']));_0x4ace4c[_0x65f6('0x33')]=_0x4ace4c['attributes'][_0x65f6('0x35')]?_0x4ace4c['attributes']:_0x4ea23d[_0x65f6('0x2e')];if(!_0x14a387[_0x65f6('0x2f')]['hasOwnProperty'](_0x65f6('0x36'))){_0x4ace4c[_0x65f6('0x37')]=qs[_0x65f6('0x37')](_0x14a387['query']['limit']);_0x4ace4c[_0x65f6('0x1d')]=qs['offset'](_0x14a387[_0x65f6('0x2f')]['offset']);}_0x4ace4c[_0x65f6('0x38')]=qs[_0x65f6('0x39')](_0x14a387['query'][_0x65f6('0x39')]);_0x4ace4c['where']=qs['filters'](_[_0x65f6('0x3a')](_0x14a387[_0x65f6('0x2f')],_0x4ea23d[_0x65f6('0x31')]));if(_0x14a387[_0x65f6('0x2f')][_0x65f6('0x3b')]){_0x4ace4c[_0x65f6('0x3c')]=_[_0x65f6('0x3d')](_0x4ace4c[_0x65f6('0x3c')],{'$or':_['map'](_0x27e284,function(_0x3aa254){if(_0x3aa254['type']!==_0x65f6('0x3e')){var _0xa4394a={};_0xa4394a[_0x3aa254[_0x65f6('0x27')]]={'$like':'%'+_0x14a387[_0x65f6('0x2f')]['filter']+'%'};return _0xa4394a;}})});}_0x4ace4c=_[_0x65f6('0x3d')]({},_0x4ace4c,_0x14a387[_0x65f6('0x3f')]);var _0x413819={'where':_0x4ace4c[_0x65f6('0x3c')]};return db[_0x65f6('0x40')][_0x65f6('0x41')](_0x413819)[_0x65f6('0x23')](function(_0x2acca5){_0x154cbd[_0x65f6('0x41')]=_0x2acca5;if(_0x14a387['query'][_0x65f6('0x42')]){_0x4ace4c[_0x65f6('0x43')]=[{'all':!![]}];}return db[_0x65f6('0x40')][_0x65f6('0x44')](_0x4ace4c);})[_0x65f6('0x23')](function(_0x1ac040){_0x154cbd[_0x65f6('0x45')]=_0x1ac040;return _0x154cbd;})[_0x65f6('0x23')](respondWithFilteredResult(_0x144e55,_0x4ace4c))[_0x65f6('0x46')](handleError(_0x144e55,null));};exports[_0x65f6('0x47')]=function(_0xcf19da,_0x2c008a){var _0x6c4d94={'raw':!![],'where':{'id':_0xcf19da[_0x65f6('0x48')]['id']}},_0x27157d={};_0x27157d[_0x65f6('0x2e')]=_['keys'](db[_0x65f6('0x40')][_0x65f6('0x2a')]);_0x27157d[_0x65f6('0x2f')]=_[_0x65f6('0x30')](_0xcf19da['query']);_0x27157d[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x27157d[_0x65f6('0x2e')],_0x27157d['query']);_0x6c4d94[_0x65f6('0x33')]=_[_0x65f6('0x32')](_0x27157d[_0x65f6('0x2e')],qs[_0x65f6('0x34')](_0xcf19da['query'][_0x65f6('0x34')]));_0x6c4d94['attributes']=_0x6c4d94[_0x65f6('0x33')][_0x65f6('0x35')]?_0x6c4d94['attributes']:_0x27157d[_0x65f6('0x2e')];if(_0xcf19da['query'][_0x65f6('0x42')]){_0x6c4d94[_0x65f6('0x43')]=[{'all':!![]}];}_0x6c4d94=_[_0x65f6('0x3d')]({},_0x6c4d94,_0xcf19da[_0x65f6('0x3f')]);return db[_0x65f6('0x40')][_0x65f6('0x49')](_0x6c4d94)['then'](handleEntityNotFound(_0x2c008a,null))['then'](respondWithResult(_0x2c008a,null))[_0x65f6('0x46')](handleError(_0x2c008a,null));};exports[_0x65f6('0x4a')]=function(_0x3b647a,_0x1e9e29){return db[_0x65f6('0x40')][_0x65f6('0x4a')](_0x3b647a[_0x65f6('0x4b')],{})[_0x65f6('0x23')](function(_0x414f49){var _0x517a47=_0x3b647a[_0x65f6('0x4c')][_0x65f6('0x25')]({'plain':!![]});if(!_0x517a47)throw new Error(_0x65f6('0x4d'));if(_0x517a47['role']===_0x65f6('0x4c')){var _0x42d453=_0x414f49['get']({'plain':!![]});var _0x22d745=_0x65f6('0x26');return db['UserProfileSection'][_0x65f6('0x49')]({'where':{'name':_0x22d745,'userProfileId':_0x517a47['userProfileId']},'raw':!![]})[_0x65f6('0x23')](function(_0x3b241f){if(_0x3b241f&&_0x3b241f[_0x65f6('0x4e')]===0x0){return db['UserProfileResource'][_0x65f6('0x4a')]({'name':_0x42d453[_0x65f6('0x27')],'resourceId':_0x42d453['id'],'type':_0x3b241f['name'],'sectionId':_0x3b241f['id']},{})[_0x65f6('0x23')](function(){return _0x414f49;});}else{return _0x414f49;}})[_0x65f6('0x46')](function(_0x48a2ed){logger[_0x65f6('0x4f')](_0x65f6('0x50'),_0x48a2ed);throw _0x48a2ed;});}return _0x414f49;})[_0x65f6('0x23')](respondWithResult(_0x1e9e29,0xc9))[_0x65f6('0x46')](handleError(_0x1e9e29,null));};exports[_0x65f6('0x51')]=function(_0x2350ca,_0x1d620a){if(_0x2350ca[_0x65f6('0x4b')]['id']){delete _0x2350ca['body']['id'];}return db['SmsQueue']['find']({'where':{'id':_0x2350ca[_0x65f6('0x48')]['id']}})[_0x65f6('0x23')](handleEntityNotFound(_0x1d620a,null))[_0x65f6('0x23')](saveUpdates(_0x2350ca[_0x65f6('0x4b')],null))['then'](respondWithResult(_0x1d620a,null))[_0x65f6('0x46')](handleError(_0x1d620a,null));};exports[_0x65f6('0x24')]=function(_0x9ff849,_0x50f63a){return db[_0x65f6('0x40')][_0x65f6('0x49')]({'where':{'id':_0x9ff849[_0x65f6('0x48')]['id']}})['then'](handleEntityNotFound(_0x50f63a,null))['then'](removeEntity(_0x50f63a,null))[_0x65f6('0x46')](handleError(_0x50f63a,null));};exports[_0x65f6('0x52')]=function(_0x4125cb,_0x39364f){return db[_0x65f6('0x40')][_0x65f6('0x52')]()[_0x65f6('0x23')](respondWithResult(_0x39364f,null))[_0x65f6('0x46')](handleError(_0x39364f,null));};exports[_0x65f6('0x53')]=function(_0xddbd90,_0xa7eee9,_0x141fcc){var _0x30adee={'raw':!![],'where':{}},_0x3e3143={},_0x5ba9c6;return db[_0x65f6('0x40')][_0x65f6('0x54')]({'where':{'id':_0xddbd90[_0x65f6('0x48')]['id']}})['then'](handleEntityNotFound(_0xa7eee9,null))[_0x65f6('0x23')](function(_0x16dec0){if(_0x16dec0){_0x5ba9c6=_0x16dec0[_0x65f6('0x25')]({'plain':!![]});_0x3e3143[_0x65f6('0x2e')]=_['keys'](db[_0x65f6('0x55')][_0x65f6('0x2a')]);_0x3e3143[_0x65f6('0x2f')]=_[_0x65f6('0x30')](_0xddbd90['query']);_0x3e3143[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x3e3143['model'],_0x3e3143[_0x65f6('0x2f')]);_0x30adee[_0x65f6('0x33')]=_[_0x65f6('0x32')](_0x3e3143['model'],qs[_0x65f6('0x34')](_0xddbd90[_0x65f6('0x2f')][_0x65f6('0x34')]));_0x30adee[_0x65f6('0x33')]=_0x30adee[_0x65f6('0x33')][_0x65f6('0x35')]?_0x30adee['attributes']:_0x3e3143['model'];if(!_0xddbd90['query'][_0x65f6('0x56')](_0x65f6('0x36'))){_0x30adee[_0x65f6('0x37')]=qs[_0x65f6('0x37')](_0xddbd90[_0x65f6('0x2f')][_0x65f6('0x37')]);_0x30adee['offset']=qs[_0x65f6('0x1d')](_0xddbd90[_0x65f6('0x2f')]['offset']);}_0x30adee[_0x65f6('0x38')]=qs[_0x65f6('0x39')](_0xddbd90[_0x65f6('0x2f')]['sort']);_0x30adee[_0x65f6('0x3c')]=qs[_0x65f6('0x31')](_['pick'](_0xddbd90[_0x65f6('0x2f')],_0x3e3143[_0x65f6('0x31')]));_0x30adee[_0x65f6('0x3c')][_0x65f6('0x57')]=_0x16dec0['id'];if(_0xddbd90[_0x65f6('0x2f')][_0x65f6('0x3b')]){_0x30adee[_0x65f6('0x3c')]=_['merge'](_0x30adee['where'],{'$or':_[_0x65f6('0x58')](_0x30adee[_0x65f6('0x33')],function(_0x4a9524){var _0x417ba5={};_0x417ba5[_0x4a9524]={'$like':'%'+_0xddbd90['query'][_0x65f6('0x3b')]+'%'};return _0x417ba5;})});}_0x30adee=_['merge']({},_0x30adee,_0xddbd90[_0x65f6('0x3f')]);return db[_0x65f6('0x55')][_0x65f6('0x44')](_0x30adee);}})[_0x65f6('0x23')](function(_0x145aaa){if(_0x145aaa){return db[_0x65f6('0x59')][_0x65f6('0x5a')]({'where':{'id':_[_0x65f6('0x58')](_0x145aaa,_0x65f6('0x5b')),'role':'agent'},'attributes':['id','name',_0x65f6('0x5c'),_0x65f6('0x5d'),_0x65f6('0x5e')]});}})['then'](function(_0x49cd14){if(_0x49cd14){return{'count':_0x49cd14[_0x65f6('0x41')],'rows':_[_0x65f6('0x58')](_0x49cd14[_0x65f6('0x45')],function(_0xc703f9){return{'membername':_0xc703f9[_0x65f6('0x27')],'UserId':_0xc703f9['id'],'queue_name':_0x5ba9c6[_0x65f6('0x27')],'SmsQueueId':_0x5ba9c6['id'],'interface':util['format']('%s/%s',_0x65f6('0x5f'),_0xc703f9[_0x65f6('0x27')]),'penalty':0x0,'paused':_0xc703f9['smsPause'],'createdAt':_0xc703f9[_0x65f6('0x5e')],'updatedAt':_0xc703f9['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x23')](respondWithFilteredResult(_0xa7eee9,_0x30adee))[_0x65f6('0x46')](handleError(_0xa7eee9,null));};exports[_0x65f6('0x60')]=function(_0x16726d,_0x558888,_0x34ab7b){var _0x351d43={};var _0x11411c={};var _0x59131c;var _0x4c0511;return db[_0x65f6('0x40')]['findOne']({'where':{'id':_0x16726d[_0x65f6('0x48')]['id']}})[_0x65f6('0x23')](handleEntityNotFound(_0x558888,null))[_0x65f6('0x23')](function(_0x354b90){if(_0x354b90){_0x59131c=_0x354b90;_0x11411c['model']=_['keys'](db['Team'][_0x65f6('0x2a')]);_0x11411c[_0x65f6('0x2f')]=_[_0x65f6('0x30')](_0x16726d['query']);_0x11411c[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x11411c[_0x65f6('0x2e')],_0x11411c['query']);_0x351d43[_0x65f6('0x33')]=_[_0x65f6('0x32')](_0x11411c['model'],qs[_0x65f6('0x34')](_0x16726d[_0x65f6('0x2f')]['fields']));_0x351d43[_0x65f6('0x33')]=_0x351d43['attributes'][_0x65f6('0x35')]?_0x351d43['attributes']:_0x11411c[_0x65f6('0x2e')];_0x351d43[_0x65f6('0x38')]=qs['sort'](_0x16726d[_0x65f6('0x2f')][_0x65f6('0x39')]);_0x351d43[_0x65f6('0x3c')]=qs[_0x65f6('0x31')](_[_0x65f6('0x3a')](_0x16726d[_0x65f6('0x2f')],_0x11411c[_0x65f6('0x31')]));if(_0x16726d[_0x65f6('0x2f')][_0x65f6('0x3b')]){_0x351d43[_0x65f6('0x3c')]=_[_0x65f6('0x3d')](_0x351d43['where'],{'$or':_[_0x65f6('0x58')](_0x351d43[_0x65f6('0x33')],function(_0x15c8b7){var _0x219e42={};_0x219e42[_0x15c8b7]={'$like':'%'+_0x16726d['query'][_0x65f6('0x3b')]+'%'};return _0x219e42;})});}_0x351d43=_[_0x65f6('0x3d')]({},_0x351d43,_0x16726d['options']);return _0x59131c[_0x65f6('0x60')](_0x351d43);}})['then'](function(_0x10d98f){if(_0x10d98f){_0x4c0511=_0x10d98f['length'];if(!_0x16726d[_0x65f6('0x2f')][_0x65f6('0x56')]('nolimit')){_0x351d43['limit']=qs[_0x65f6('0x37')](_0x16726d[_0x65f6('0x2f')]['limit']);_0x351d43[_0x65f6('0x1d')]=qs[_0x65f6('0x1d')](_0x16726d[_0x65f6('0x2f')]['offset']);}return _0x59131c[_0x65f6('0x60')](_0x351d43);}})[_0x65f6('0x23')](function(_0x5889dc){if(_0x5889dc){return _0x5889dc?{'count':_0x4c0511,'rows':_0x5889dc}:null;}})[_0x65f6('0x23')](respondWithResult(_0x558888,null))['catch'](handleError(_0x558888,null));};exports[_0x65f6('0x61')]=function(_0x57eb49,_0x51105d,_0x20687f){var _0x1cf4ed=_0x57eb49[_0x65f6('0x4b')][_0x65f6('0x62')];return db[_0x65f6('0x63')][_0x65f6('0x44')]({'where':{'id':_0x1cf4ed},'attributes':['id'],'include':[{'model':db[_0x65f6('0x59')],'as':_0x65f6('0x64'),'attributes':['id','name','online',_0x65f6('0x65'),'interface'],'raw':!![]}]})[_0x65f6('0x23')](function(_0x36699b){if(_0x36699b){var _0x21b5f2=_[_0x65f6('0x66')](_0x36699b,function(_0x43127b){var _0x56bd9d=_0x43127b[_0x65f6('0x25')]({'plain':!![]});return _0x56bd9d[_0x65f6('0x64')];});return db[_0x65f6('0x40')]['find']({'where':{'id':_0x57eb49[_0x65f6('0x48')]['id']}})[_0x65f6('0x23')](function(_0x4254c2){return db[_0x65f6('0x67')][_0x65f6('0x68')](function(_0x16bf93){return _0x4254c2['addTeams'](_0x1cf4ed,{'transaction':_0x16bf93})['then'](function(){return BPromise[_0x65f6('0x69')](_0x21b5f2,function(_0x10d744){return db[_0x65f6('0x55')][_0x65f6('0x6a')]({'where':{'UserId':_0x10d744['id'],'SmsQueueId':_0x57eb49['params']['id']},'transaction':_0x16bf93});});})['then'](function(){_0x21b5f2[_0x65f6('0x6b')](function(_0x452f1e){socket[_0x65f6('0x6c')](_0x65f6('0x6d'),{'UserId':_0x452f1e['id'],'SmsQueueId':_0x4254c2['id']});});});});});}})[_0x65f6('0x23')](respondWithStatusCode(_0x51105d,null))[_0x65f6('0x46')](handleError(_0x51105d,null));};exports['removeTeams']=function(_0x4d607a,_0x5851b6,_0x2c59f6){return db[_0x65f6('0x63')][_0x65f6('0x44')]({'where':{'id':_0x4d607a[_0x65f6('0x2f')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x65f6('0x64'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x23')](handleEntityNotFound(_0x5851b6,null))['then'](function(_0x346fa9){var _0x52004e=_[_0x65f6('0x58')](_0x346fa9,'id');var _0x4f3ef8=[];var _0x3a30ed=[];var _0x208fee=squel['select']();_0x208fee[_0x65f6('0x6e')](_0x65f6('0x6f'))[_0x65f6('0x70')](_0x65f6('0x71'),'tq')[_0x65f6('0x72')](_0x65f6('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x65f6('0x3c')]('SmsQueueId\x20=\x20?',_0x4d607a[_0x65f6('0x48')]['id']);for(var _0x56336a=0x0;_0x56336a<_0x346fa9[_0x65f6('0x35')];_0x56336a+=0x1){let _0x3528be=_0x346fa9[_0x56336a];for(var _0xdf396c=0x0;_0xdf396c<_0x3528be[_0x65f6('0x64')]['length'];_0xdf396c+=0x1){let _0x2b6f98=_0x3528be[_0x65f6('0x64')][_0xdf396c];var _0x376a23=_0x208fee['clone']();_0x376a23['where'](_0x65f6('0x74'),_0x2b6f98['id']);_0x3a30ed[_0x65f6('0x75')](db['sequelize'][_0x65f6('0x2f')](_0x376a23[_0x65f6('0x76')](),{'type':db[_0x65f6('0x67')]['QueryTypes'][_0x65f6('0x77')]})[_0x65f6('0x23')](function(_0x5df361){if(_0x5df361[_0x65f6('0x35')]===0x1){return _0x2b6f98['id'];}else{var _0x7136bc=_[_0x65f6('0x78')](_['map'](_0x5df361,_0x65f6('0x79')),function(_0x2287fc){return _[_0x65f6('0x7a')](_0x52004e,_0x2287fc);});if(_0x7136bc){return _0x2b6f98['id'];}}}));}}return BPromise['all'](_0x3a30ed)[_0x65f6('0x23')](function(_0x4febfa){_0x4f3ef8=_(_0x4f3ef8)[_0x65f6('0x7b')](_0x4febfa)[_0x65f6('0x7c')]()[_0x65f6('0x7d')]();return db[_0x65f6('0x40')][_0x65f6('0x49')]({'where':{'id':_0x4d607a[_0x65f6('0x48')]['id']}})['then'](function(_0x284473){return db[_0x65f6('0x67')][_0x65f6('0x68')](function(_0x32a101){return _0x284473[_0x65f6('0x7e')](_0x4d607a['query']['ids'],{'transaction':_0x32a101})['then'](function(){if(!_[_0x65f6('0x7f')](_0x4f3ef8)){return _0x284473[_0x65f6('0x80')](_0x4f3ef8,{'transaction':_0x32a101});}})[_0x65f6('0x23')](function(){_0x4f3ef8['forEach'](function(_0x151cee){socket['emit']('userSmsQueue:remove',{'UserId':_0x151cee,'SmsQueueId':_0x284473['id']});});});});});});})[_0x65f6('0x23')](respondWithStatusCode(_0x5851b6,null))[_0x65f6('0x46')](handleError(_0x5851b6,null));};exports['addAgents']=function(_0xdd36c4,_0x3c5053,_0x43ed6c){return db[_0x65f6('0x40')][_0x65f6('0x49')]({'where':{'id':_0xdd36c4[_0x65f6('0x48')]['id']}})[_0x65f6('0x23')](handleEntityNotFound(_0x3c5053,null))[_0x65f6('0x23')](function(_0x477f29){if(_0x477f29){return _0x477f29[_0x65f6('0x81')](_0xdd36c4[_0x65f6('0x4b')][_0x65f6('0x62')],_['omit'](_0xdd36c4[_0x65f6('0x4b')],['ids','id'])||{})['spread'](function(_0x24d524){for(var _0x10a877=0x0;_0x10a877<_0xdd36c4[_0x65f6('0x4b')][_0x65f6('0x62')]['length'];_0x10a877+=0x1){socket[_0x65f6('0x6c')]('userSmsQueue:save',{'UserId':_0xdd36c4['body'][_0x65f6('0x62')][_0x10a877],'SmsQueueId':_0xdd36c4[_0x65f6('0x48')]['id']});}return _0x24d524;});}})[_0x65f6('0x23')](respondWithResult(_0x3c5053,null))[_0x65f6('0x46')](handleError(_0x3c5053,null));};exports[_0x65f6('0x80')]=function(_0xcdfebe,_0x5a33cf,_0x5c8131){return db['SmsQueue'][_0x65f6('0x49')]({'where':{'id':_0xcdfebe[_0x65f6('0x48')]['id']}})[_0x65f6('0x23')](handleEntityNotFound(_0x5a33cf,null))['then'](function(_0x29396f){if(_0x29396f){return _0x29396f['removeAgents'](_0xcdfebe['query'][_0x65f6('0x62')])[_0x65f6('0x23')](function(){if(_[_0x65f6('0x82')](_0xcdfebe[_0x65f6('0x2f')][_0x65f6('0x62')])){for(var _0x5adf21=0x0;_0x5adf21<_0xcdfebe[_0x65f6('0x2f')][_0x65f6('0x62')][_0x65f6('0x35')];_0x5adf21+=0x1){socket[_0x65f6('0x6c')]('userSmsQueue:remove',{'UserId':Number(_0xcdfebe[_0x65f6('0x2f')][_0x65f6('0x62')][_0x5adf21]),'SmsQueueId':Number(_0xcdfebe[_0x65f6('0x48')]['id'])});}}else{socket[_0x65f6('0x6c')](_0x65f6('0x83'),{'UserId':Number(_0xcdfebe[_0x65f6('0x2f')][_0x65f6('0x62')]),'SmsQueueId':Number(_0xcdfebe[_0x65f6('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x5a33cf,null))[_0x65f6('0x46')](handleError(_0x5a33cf,null));};exports[_0x65f6('0x84')]=function(_0x3efa55,_0x8adb47,_0x146c11){var _0x4171a1={};var _0x57667e={};var _0x3fd6ee;var _0x19c425;return db['SmsQueue'][_0x65f6('0x54')]({'where':{'id':_0x3efa55['params']['id']}})[_0x65f6('0x23')](handleEntityNotFound(_0x8adb47,null))[_0x65f6('0x23')](function(_0xd87bec){if(_0xd87bec){_0x3fd6ee=_0xd87bec;_0x57667e[_0x65f6('0x2e')]=_[_0x65f6('0x30')](db['User'][_0x65f6('0x2a')]);_0x57667e[_0x65f6('0x2f')]=_[_0x65f6('0x30')](_0x3efa55[_0x65f6('0x2f')]);_0x57667e[_0x65f6('0x31')]=_['intersection'](_0x57667e['model'],_0x57667e[_0x65f6('0x2f')]);_0x4171a1[_0x65f6('0x33')]=_[_0x65f6('0x32')](_0x57667e[_0x65f6('0x2e')],qs['fields'](_0x3efa55['query']['fields']));_0x4171a1[_0x65f6('0x33')]=_0x4171a1[_0x65f6('0x33')][_0x65f6('0x35')]?_0x4171a1['attributes']:_0x57667e[_0x65f6('0x2e')];_0x4171a1[_0x65f6('0x38')]=qs[_0x65f6('0x39')](_0x3efa55[_0x65f6('0x2f')][_0x65f6('0x39')]);_0x4171a1['where']=qs[_0x65f6('0x31')](_[_0x65f6('0x3a')](_0x3efa55['query'],_0x57667e['filters']));if(_0x3efa55[_0x65f6('0x2f')][_0x65f6('0x3b')]){_0x4171a1[_0x65f6('0x3c')]=_[_0x65f6('0x3d')](_0x4171a1[_0x65f6('0x3c')],{'$or':_['map'](_0x4171a1[_0x65f6('0x33')],function(_0x4b080a){var _0x280c96={};_0x280c96[_0x4b080a]={'$like':'%'+_0x3efa55['query'][_0x65f6('0x3b')]+'%'};return _0x280c96;})});}_0x4171a1=_['merge']({},_0x4171a1,_0x3efa55[_0x65f6('0x3f')]);return _0x3fd6ee['getAgents'](_0x4171a1);}})[_0x65f6('0x23')](function(_0x3b9aed){if(_0x3b9aed){_0x19c425=_0x3b9aed['length'];if(!_0x3efa55['query'][_0x65f6('0x56')](_0x65f6('0x36'))){_0x4171a1[_0x65f6('0x37')]=qs[_0x65f6('0x37')](_0x3efa55[_0x65f6('0x2f')][_0x65f6('0x37')]);_0x4171a1[_0x65f6('0x1d')]=qs[_0x65f6('0x1d')](_0x3efa55[_0x65f6('0x2f')][_0x65f6('0x1d')]);}return _0x3fd6ee[_0x65f6('0x84')](_0x4171a1);}})[_0x65f6('0x23')](function(_0x264d8b){if(_0x264d8b){return _0x264d8b?{'count':_0x19c425,'rows':_0x264d8b}:null;}})[_0x65f6('0x23')](respondWithResult(_0x8adb47,null))[_0x65f6('0x46')](handleError(_0x8adb47,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 21140a0..1c6fac6 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 _0xa374=['setMaxListeners','save','emit','hasOwnProperty','../../mysqldb'];(function(_0x55395b,_0x21641f){var _0x48658a=function(_0x1dae77){while(--_0x1dae77){_0x55395b['push'](_0x55395b['shift']());}};_0x48658a(++_0x21641f);}(_0xa374,0xe0));var _0x4a37=function(_0x42aedc,_0x1ae97d){_0x42aedc=_0x42aedc-0x0;var _0x319829=_0xa374[_0x42aedc];return _0x319829;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x4a37('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x4a37('0x1')](0x0);var events={'afterCreate':_0x4a37('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x55bc1d){return function(_0x57f565,_0x371333,_0x5b4107){SmsQueueEvents[_0x4a37('0x3')](_0x55bc1d+':'+_0x57f565['id'],_0x57f565);SmsQueueEvents['emit'](_0x55bc1d,_0x57f565);_0x5b4107(null);};}for(var e in events){if(events[_0x4a37('0x4')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xb98f=['SmsQueue','setMaxListeners','save','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x386842,_0x4cc77e){var _0x3bd4a7=function(_0x5369ef){while(--_0x5369ef){_0x386842['push'](_0x386842['shift']());}};_0x3bd4a7(++_0x4cc77e);}(_0xb98f,0xce));var _0xfb98=function(_0x5bd3a9,_0x25fa73){_0x5bd3a9=_0x5bd3a9-0x0;var _0x30387b=_0xb98f[_0x5bd3a9];return _0x30387b;};'use strict';var EventEmitter=require(_0xfb98('0x0'));var SmsQueue=require(_0xfb98('0x1'))['db'][_0xfb98('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xfb98('0x3')](0x0);var events={'afterCreate':_0xfb98('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x593d54){return function(_0x29600d,_0x201ab9,_0x2c9b5a){SmsQueueEvents[_0xfb98('0x5')](_0x593d54+':'+_0x29600d['id'],_0x29600d);SmsQueueEvents['emit'](_0x593d54,_0x29600d);_0x2c9b5a(null);};}for(var e in events){if(events[_0xfb98('0x6')](e)){var event=events[e];SmsQueue[_0xfb98('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 4d0b6ee..a86ac67 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 _0xe9f0=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xe9f0,0x1ea));var _0x0e9f=function(_0x4530be,_0x978008){_0x4530be=_0x4530be-0x0;var _0x5b1b35=_0xe9f0[_0x4530be];return _0x5b1b35;};'use strict';var _=require(_0x0e9f('0x0'));var util=require(_0x0e9f('0x1'));var logger=require(_0x0e9f('0x2'))(_0x0e9f('0x3'));var moment=require(_0x0e9f('0x4'));var BPromise=require(_0x0e9f('0x5'));var rp=require(_0x0e9f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e9f('0x7'));var config=require(_0x0e9f('0x8'));var attributes=require('./smsQueue.attributes');module[_0x0e9f('0x9')]=function(_0x440f68,_0x5279b1){return _0x440f68[_0x0e9f('0xa')](_0x0e9f('0xb'),attributes,{'tableName':_0x0e9f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd03=['bluebird','rimraf','../../config/environment','./smsQueue.attributes','define','../../config/logger','api','moment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdd03,0x165));var _0x3dd0=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdd03[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3dd0('0x0'))(_0x3dd0('0x1'));var moment=require(_0x3dd0('0x2'));var BPromise=require(_0x3dd0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3dd0('0x4'));var config=require(_0x3dd0('0x5'));var attributes=require(_0x3dd0('0x6'));module['exports']=function(_0x61c9cf,_0x3ddf36){return _0x61c9cf[_0x3dd0('0x7')]('SmsQueue',attributes,{'tableName':'sms_queues','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 5d349a3..9a908a6 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 _0xb47f=['map','model','GetSmsQueue','ShowSmsQueue','SmsQueue','find','catch','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','raw','options','where','attributes','limit','include'];(function(_0x4ce16a,_0x5826f7){var _0x465338=function(_0x3e5d4b){while(--_0x3e5d4b){_0x4ce16a['push'](_0x4ce16a['shift']());}};_0x465338(++_0x5826f7);}(_0xb47f,0xcf));var _0xfb47=function(_0x3abe2f,_0x1bdf2b){_0x3abe2f=_0x3abe2f-0x0;var _0x3f81e6=_0xb47f[_0x3abe2f];return _0x3f81e6;};'use strict';var _=require(_0xfb47('0x0'));var util=require(_0xfb47('0x1'));var moment=require(_0xfb47('0x2'));var BPromise=require(_0xfb47('0x3'));var rs=require(_0xfb47('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfb47('0x5'));var config=require(_0xfb47('0x6'));var jayson=require(_0xfb47('0x7'));var client=jayson[_0xfb47('0x8')][_0xfb47('0x9')]({'port':0x232a});config['redis']=_[_0xfb47('0xa')](config[_0xfb47('0xb')],{'host':_0xfb47('0xc'),'port':0x18eb});var socket=require(_0xfb47('0xd'))(new Redis(config[_0xfb47('0xb')]));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2f20c3,_0x5c038f,_0x47914e){return new BPromise(function(_0xe01acc,_0x3e286f){return client[_0xfb47('0xe')](_0x2f20c3,_0x47914e)[_0xfb47('0xf')](function(_0x5bc686){logger[_0xfb47('0x10')](_0xfb47('0x11'),_0x5c038f,_0xfb47('0x12'));logger[_0xfb47('0x13')](_0xfb47('0x14'),_0x5c038f,_0xfb47('0x12'),JSON[_0xfb47('0x15')](_0x5bc686));if(_0x5bc686[_0xfb47('0x16')]){if(_0x5bc686['error'][_0xfb47('0x17')]===0x1f4){logger[_0xfb47('0x16')](_0xfb47('0x11'),_0x5c038f,_0x5bc686[_0xfb47('0x16')][_0xfb47('0x18')]);return _0x3e286f(_0x5bc686[_0xfb47('0x16')]['message']);}logger['error'](_0xfb47('0x11'),_0x5c038f,_0x5bc686[_0xfb47('0x16')][_0xfb47('0x18')]);return _0xe01acc(_0x5bc686[_0xfb47('0x16')]['message']);}else{logger[_0xfb47('0x10')](_0xfb47('0x11'),_0x5c038f,_0xfb47('0x12'));_0xe01acc(_0x5bc686[_0xfb47('0x19')][_0xfb47('0x18')]);}})['catch'](function(_0x2e298f){logger['error'](_0xfb47('0x11'),_0x5c038f,_0x2e298f);_0x3e286f(_0x2e298f);});});}exports['GetSmsQueue']=function(_0x1d1768){var _0x4f204c=this;return new Promise(function(_0x472f2b,_0x1f1f2a){return db['SmsQueue'][_0xfb47('0x1a')]({'raw':_0x1d1768['options']?_0x1d1768['options'][_0xfb47('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d1768['options']?_0x1d1768[_0xfb47('0x1c')][_0xfb47('0x1d')]||null:null,'attributes':_0x1d1768[_0xfb47('0x1c')]?_0x1d1768[_0xfb47('0x1c')][_0xfb47('0x1e')]||null:null,'limit':_0x1d1768[_0xfb47('0x1c')]?_0x1d1768[_0xfb47('0x1c')][_0xfb47('0x1f')]||null:null,'include':_0x1d1768[_0xfb47('0x1c')]?_0x1d1768[_0xfb47('0x1c')][_0xfb47('0x20')]?_[_0xfb47('0x21')](_0x1d1768[_0xfb47('0x1c')][_0xfb47('0x20')],function(_0xd07cfb){return{'model':db[_0xd07cfb['model']],'as':_0xd07cfb['as'],'attributes':_0xd07cfb[_0xfb47('0x1e')],'include':_0xd07cfb[_0xfb47('0x20')]?_['map'](_0xd07cfb[_0xfb47('0x20')],function(_0x400117){return{'model':db[_0x400117[_0xfb47('0x22')]],'as':_0x400117['as'],'attributes':_0x400117[_0xfb47('0x1e')],'include':_0x400117[_0xfb47('0x20')]?_[_0xfb47('0x21')](_0x400117[_0xfb47('0x20')],function(_0x28c6fe){return{'model':db[_0x28c6fe[_0xfb47('0x22')]],'as':_0x28c6fe['as'],'attributes':_0x28c6fe[_0xfb47('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfb47('0xf')](function(_0x5d56f8){logger[_0xfb47('0x10')](_0xfb47('0x23'),_0x1d1768);logger[_0xfb47('0x13')]('GetSmsQueue',_0x1d1768,JSON[_0xfb47('0x15')](_0x5d56f8));_0x472f2b(_0x5d56f8);})['catch'](function(_0x4bc247){logger['error'](_0xfb47('0x23'),_0x4bc247[_0xfb47('0x18')],_0x1d1768);_0x1f1f2a(_0x4f204c[_0xfb47('0x16')](0x1f4,_0x4bc247[_0xfb47('0x18')]));});});};exports[_0xfb47('0x24')]=function(_0x5d533a){var _0xdd488e=this;return new Promise(function(_0x10aa18,_0x3184f9){return db[_0xfb47('0x25')][_0xfb47('0x26')]({'raw':_0x5d533a['options']?_0x5d533a[_0xfb47('0x1c')][_0xfb47('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d533a[_0xfb47('0x1c')]?_0x5d533a[_0xfb47('0x1c')]['where']||null:null,'attributes':_0x5d533a[_0xfb47('0x1c')]?_0x5d533a[_0xfb47('0x1c')][_0xfb47('0x1e')]||null:null,'include':_0x5d533a['options']?_0x5d533a[_0xfb47('0x1c')][_0xfb47('0x20')]?_['map'](_0x5d533a[_0xfb47('0x1c')][_0xfb47('0x20')],function(_0x42ff6b){return{'model':db[_0x42ff6b[_0xfb47('0x22')]],'as':_0x42ff6b['as'],'attributes':_0x42ff6b[_0xfb47('0x1e')],'include':_0x42ff6b[_0xfb47('0x20')]?_[_0xfb47('0x21')](_0x42ff6b[_0xfb47('0x20')],function(_0x4064f3){return{'model':db[_0x4064f3[_0xfb47('0x22')]],'as':_0x4064f3['as'],'attributes':_0x4064f3[_0xfb47('0x1e')],'include':_0x4064f3['include']?_[_0xfb47('0x21')](_0x4064f3[_0xfb47('0x20')],function(_0x337d38){return{'model':db[_0x337d38['model']],'as':_0x337d38['as'],'attributes':_0x337d38[_0xfb47('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfb47('0xf')](function(_0x5f5220){logger[_0xfb47('0x10')](_0xfb47('0x24'),_0x5d533a);logger[_0xfb47('0x13')](_0xfb47('0x24'),_0x5d533a,JSON[_0xfb47('0x15')](_0x5f5220));_0x10aa18(_0x5f5220);})[_0xfb47('0x27')](function(_0x1863c4){logger['error'](_0xfb47('0x24'),_0x1863c4['message'],_0x5d533a);_0x3184f9(_0xdd488e[_0xfb47('0x16')](0x1f4,_0x1863c4['message']));});});}; \ No newline at end of file +var _0x6eb1=['info','result','catch','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','model','map','then','stringify','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x6eb1,0x11c));var _0x16eb=function(_0x260b48,_0x117977){_0x260b48=_0x260b48-0x0;var _0x3f730b=_0x6eb1[_0x260b48];return _0x3f730b;};'use strict';var _=require(_0x16eb('0x0'));var util=require(_0x16eb('0x1'));var moment=require(_0x16eb('0x2'));var BPromise=require(_0x16eb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16eb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x16eb('0x5'));var logger=require('../../config/logger')(_0x16eb('0x6'));var config=require(_0x16eb('0x7'));var jayson=require(_0x16eb('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x16eb('0x9')]=_[_0x16eb('0xa')](config['redis'],{'host':_0x16eb('0xb'),'port':0x18eb});var socket=require(_0x16eb('0xc'))(new Redis(config[_0x16eb('0x9')]));require(_0x16eb('0xd'))['register'](socket);function respondWithRpcPromise(_0x9447dc,_0x2d5e76,_0x24fddb){return new BPromise(function(_0x588a51,_0x19011d){return client['request'](_0x9447dc,_0x24fddb)['then'](function(_0x57c280){logger['info'](_0x16eb('0xe'),_0x2d5e76,_0x16eb('0xf'));logger[_0x16eb('0x10')](_0x16eb('0x11'),_0x2d5e76,_0x16eb('0xf'),JSON['stringify'](_0x57c280));if(_0x57c280[_0x16eb('0x12')]){if(_0x57c280[_0x16eb('0x12')]['code']===0x1f4){logger[_0x16eb('0x12')](_0x16eb('0xe'),_0x2d5e76,_0x57c280['error']['message']);return _0x19011d(_0x57c280[_0x16eb('0x12')][_0x16eb('0x13')]);}logger[_0x16eb('0x12')](_0x16eb('0xe'),_0x2d5e76,_0x57c280['error']['message']);return _0x588a51(_0x57c280['error'][_0x16eb('0x13')]);}else{logger[_0x16eb('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2d5e76,_0x16eb('0xf'));_0x588a51(_0x57c280[_0x16eb('0x15')]['message']);}})[_0x16eb('0x16')](function(_0x18ae94){logger[_0x16eb('0x12')](_0x16eb('0xe'),_0x2d5e76,_0x18ae94);_0x19011d(_0x18ae94);});});}exports[_0x16eb('0x17')]=function(_0x26837e){var _0xc99530=this;return new Promise(function(_0x1a443a,_0x338e05){return db[_0x16eb('0x18')][_0x16eb('0x19')]({'raw':_0x26837e['options']?_0x26837e[_0x16eb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x26837e[_0x16eb('0x1a')]?_0x26837e[_0x16eb('0x1a')][_0x16eb('0x1b')]||null:null,'attributes':_0x26837e[_0x16eb('0x1a')]?_0x26837e[_0x16eb('0x1a')][_0x16eb('0x1c')]||null:null,'limit':_0x26837e[_0x16eb('0x1a')]?_0x26837e[_0x16eb('0x1a')][_0x16eb('0x1d')]||null:null,'include':_0x26837e[_0x16eb('0x1a')]?_0x26837e[_0x16eb('0x1a')][_0x16eb('0x1e')]?_['map'](_0x26837e[_0x16eb('0x1a')]['include'],function(_0x281848){return{'model':db[_0x281848[_0x16eb('0x1f')]],'as':_0x281848['as'],'attributes':_0x281848[_0x16eb('0x1c')],'include':_0x281848[_0x16eb('0x1e')]?_[_0x16eb('0x20')](_0x281848[_0x16eb('0x1e')],function(_0x5dddd7){return{'model':db[_0x5dddd7[_0x16eb('0x1f')]],'as':_0x5dddd7['as'],'attributes':_0x5dddd7[_0x16eb('0x1c')],'include':_0x5dddd7[_0x16eb('0x1e')]?_['map'](_0x5dddd7[_0x16eb('0x1e')],function(_0x5af893){return{'model':db[_0x5af893[_0x16eb('0x1f')]],'as':_0x5af893['as'],'attributes':_0x5af893[_0x16eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x16eb('0x21')](function(_0x17c91a){logger['info'](_0x16eb('0x17'),_0x26837e);logger[_0x16eb('0x10')](_0x16eb('0x17'),_0x26837e,JSON[_0x16eb('0x22')](_0x17c91a));_0x1a443a(_0x17c91a);})[_0x16eb('0x16')](function(_0x27143d){logger['error'](_0x16eb('0x17'),_0x27143d[_0x16eb('0x13')],_0x26837e);_0x338e05(_0xc99530[_0x16eb('0x12')](0x1f4,_0x27143d[_0x16eb('0x13')]));});});};exports[_0x16eb('0x23')]=function(_0x555619){var _0x16355f=this;return new Promise(function(_0x34d948,_0x30a915){return db[_0x16eb('0x18')][_0x16eb('0x24')]({'raw':_0x555619[_0x16eb('0x1a')]?_0x555619['options'][_0x16eb('0x25')]===undefined?!![]:![]:!![],'where':_0x555619['options']?_0x555619[_0x16eb('0x1a')]['where']||null:null,'attributes':_0x555619[_0x16eb('0x1a')]?_0x555619[_0x16eb('0x1a')][_0x16eb('0x1c')]||null:null,'include':_0x555619['options']?_0x555619[_0x16eb('0x1a')][_0x16eb('0x1e')]?_['map'](_0x555619['options'][_0x16eb('0x1e')],function(_0x45226a){return{'model':db[_0x45226a[_0x16eb('0x1f')]],'as':_0x45226a['as'],'attributes':_0x45226a[_0x16eb('0x1c')],'include':_0x45226a[_0x16eb('0x1e')]?_[_0x16eb('0x20')](_0x45226a[_0x16eb('0x1e')],function(_0x4b9baa){return{'model':db[_0x4b9baa[_0x16eb('0x1f')]],'as':_0x4b9baa['as'],'attributes':_0x4b9baa[_0x16eb('0x1c')],'include':_0x4b9baa['include']?_[_0x16eb('0x20')](_0x4b9baa[_0x16eb('0x1e')],function(_0x4483a2){return{'model':db[_0x4483a2[_0x16eb('0x1f')]],'as':_0x4483a2['as'],'attributes':_0x4483a2[_0x16eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x16eb('0x21')](function(_0x45d851){logger['info'](_0x16eb('0x23'),_0x555619);logger[_0x16eb('0x10')]('ShowSmsQueue',_0x555619,JSON[_0x16eb('0x22')](_0x45d851));_0x34d948(_0x45d851);})[_0x16eb('0x16')](function(_0xd2ef5a){logger[_0x16eb('0x12')](_0x16eb('0x23'),_0xd2ef5a[_0x16eb('0x13')],_0x555619);_0x30a915(_0x16355f[_0x16eb('0x12')](0x1f4,_0xd2ef5a[_0x16eb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index becf97c..4aac3bd 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 _0x31d7=['remove','update','removeListener','register','length','./smsQueue.events','save'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x31d7,0xde));var _0x731d=function(_0x45f0ab,_0x1a22eb){_0x45f0ab=_0x45f0ab-0x0;var _0x11ceb1=_0x31d7[_0x45f0ab];return _0x11ceb1;};'use strict';var SmsQueueEvents=require(_0x731d('0x0'));var events=[_0x731d('0x1'),_0x731d('0x2'),_0x731d('0x3')];function createListener(_0x45c331,_0x242403){return function(_0x338cc2){_0x242403['emit'](_0x45c331,_0x338cc2);};}function removeListener(_0x4da9c1,_0x4bc7ed){return function(){SmsQueueEvents[_0x731d('0x4')](_0x4da9c1,_0x4bc7ed);};}exports[_0x731d('0x5')]=function(_0x2297ae){for(var _0x3f7534=0x0,_0x12984d=events[_0x731d('0x6')];_0x3f7534<_0x12984d;_0x3f7534++){var _0xa7030c=events[_0x3f7534];var _0x39da5c=createListener('smsQueue:'+_0xa7030c,_0x2297ae);SmsQueueEvents['on'](_0xa7030c,_0x39da5c);}}; \ No newline at end of file +var _0x3b2a=['./smsQueue.events','update','removeListener','register','length','smsQueue:'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0x3b2a,0x1aa));var _0xa3b2=function(_0x635fca,_0x336b51){_0x635fca=_0x635fca-0x0;var _0x1ec018=_0x3b2a[_0x635fca];return _0x1ec018;};'use strict';var SmsQueueEvents=require(_0xa3b2('0x0'));var events=['save','remove',_0xa3b2('0x1')];function createListener(_0x1b8d15,_0x104ffa){return function(_0x357047){_0x104ffa['emit'](_0x1b8d15,_0x357047);};}function removeListener(_0x582072,_0x53cf70){return function(){SmsQueueEvents[_0xa3b2('0x2')](_0x582072,_0x53cf70);};}exports[_0xa3b2('0x3')]=function(_0x243af5){for(var _0x5250bc=0x0,_0x55773f=events[_0xa3b2('0x4')];_0x5250bc<_0x55773f;_0x5250bc++){var _0x485ee3=events[_0x5250bc];var _0x2e24b4=createListener(_0xa3b2('0x5')+_0x485ee3,_0x243af5);SmsQueueEvents['on'](_0x485ee3,_0x2e24b4);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 487c215..4aedf44 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 _0x7b77=['update','delete','destroy','exports','util','path','express','Router','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','describe','/:id','show','create','put'];(function(_0x20a8cd,_0x4db30b){var _0x1f91d8=function(_0x4edb0f){while(--_0x4edb0f){_0x20a8cd['push'](_0x20a8cd['shift']());}};_0x1f91d8(++_0x4db30b);}(_0x7b77,0x19c));var _0x77b7=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x7b77[_0x42bdad];return _0x122626;};'use strict';var multer=require('multer');var util=require(_0x77b7('0x0'));var path=require(_0x77b7('0x1'));var timeout=require('connect-timeout');var express=require(_0x77b7('0x2'));var router=express[_0x77b7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x77b7('0x4'));var config=require('../../config/environment');var controller=require(_0x77b7('0x5'));router[_0x77b7('0x6')]('/',auth[_0x77b7('0x7')](),controller['index']);router[_0x77b7('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x77b7('0x8')]);router[_0x77b7('0x6')](_0x77b7('0x9'),auth[_0x77b7('0x7')](),controller[_0x77b7('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x77b7('0xb')]);router[_0x77b7('0xc')](_0x77b7('0x9'),auth['isAuthenticated'](),controller[_0x77b7('0xd')]);router[_0x77b7('0xe')](_0x77b7('0x9'),auth['isAuthenticated'](),controller[_0x77b7('0xf')]);module[_0x77b7('0x10')]=router; \ No newline at end of file +var _0x7faf=['/:id','isAuthenticated','show','post','update','delete','exports','multer','express','../../components/auth/service','../../config/environment','get','index','/describe'];(function(_0x545150,_0x2c2b6c){var _0xff7fd6=function(_0x18bb22){while(--_0x18bb22){_0x545150['push'](_0x545150['shift']());}};_0xff7fd6(++_0x2c2b6c);}(_0x7faf,0x12d));var _0xf7fa=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7faf[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xf7fa('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf7fa('0x1'));var router=express['Router']();var auth=require(_0xf7fa('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xf7fa('0x3'));var controller=require('./smsQueueReport.controller');router[_0xf7fa('0x4')]('/',auth['isAuthenticated'](),controller[_0xf7fa('0x5')]);router[_0xf7fa('0x4')](_0xf7fa('0x6'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf7fa('0x7'),auth[_0xf7fa('0x8')](),controller[_0xf7fa('0x9')]);router[_0xf7fa('0xa')]('/',auth[_0xf7fa('0x8')](),controller['create']);router['put'](_0xf7fa('0x7'),auth[_0xf7fa('0x8')](),controller[_0xf7fa('0xb')]);router[_0xf7fa('0xc')](_0xf7fa('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xf7fa('0xd')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index bcbdded..78da099 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 _0x6780=['DATE','STRING'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x6780,0xc5));var _0x0678=function(_0x2d6ea1,_0x1588ef){_0x2d6ea1=_0x2d6ea1-0x0;var _0x4a0085=_0x6780[_0x2d6ea1];return _0x4a0085;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x0678('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0678('0x1')]},'leaveAt':{'type':Sequelize[_0x0678('0x1')]},'acceptAt':{'type':Sequelize[_0x0678('0x1')]},'exitAt':{'type':Sequelize[_0x0678('0x1')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xed5c=['sequelize','STRING','DATE','moment'];(function(_0x17823f,_0xffd807){var _0x51fc21=function(_0x5e4921){while(--_0x5e4921){_0x17823f['push'](_0x17823f['shift']());}};_0x51fc21(++_0xffd807);}(_0xed5c,0x13f));var _0xced5=function(_0x2ad2a1,_0x253b57){_0x2ad2a1=_0x2ad2a1-0x0;var _0x4f29ac=_0xed5c[_0x2ad2a1];return _0x4f29ac;};'use strict';var moment=require(_0xced5('0x0'));var Sequelize=require(_0xced5('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xced5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xced5('0x3')]},'leaveAt':{'type':Sequelize[_0xced5('0x3')]},'acceptAt':{'type':Sequelize[_0xced5('0x3')]},'exitAt':{'type':Sequelize[_0xced5('0x3')]},'reason':{'type':Sequelize[_0xced5('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 6e7458c..280f3d4 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 _0x7bc8=['sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','params','length','options','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','update','destroy','then','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x474ec6,_0x5b1e5a){var _0x5212e8=function(_0x18c0a3){while(--_0x18c0a3){_0x474ec6['push'](_0x474ec6['shift']());}};_0x5212e8(++_0x5b1e5a);}(_0x7bc8,0xa8));var _0x87bc=function(_0x2990e7,_0x2a21e6){_0x2990e7=_0x2990e7-0x0;var _0x20eec5=_0x7bc8[_0x2990e7];return _0x20eec5;};'use strict';var pdf=require(_0x87bc('0x0'));var emlformat=require(_0x87bc('0x1'));var rimraf=require(_0x87bc('0x2'));var zipdir=require(_0x87bc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x87bc('0x4'));var moment=require(_0x87bc('0x5'));var BPromise=require(_0x87bc('0x6'));var Mustache=require(_0x87bc('0x7'));var util=require(_0x87bc('0x8'));var path=require(_0x87bc('0x9'));var sox=require(_0x87bc('0xa'));var csv=require(_0x87bc('0xb'));var ejs=require(_0x87bc('0xc'));var fs=require('fs');var _=require(_0x87bc('0xd'));var squel=require(_0x87bc('0xe'));var crypto=require('crypto');var jsforce=require(_0x87bc('0xf'));var deskjs=require(_0x87bc('0x10'));var toCsv=require('to-csv');var querystring=require(_0x87bc('0x11'));var Papa=require(_0x87bc('0x12'));var Redis=require(_0x87bc('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x87bc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x87bc('0x15'));var logger=require('../../config/logger')(_0x87bc('0x16'));var utils=require(_0x87bc('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4693f0,_0x35b525){_0x35b525=_0x35b525||0xcc;return function(_0x2fde1d){if(_0x2fde1d){return _0x4693f0[_0x87bc('0x18')](_0x35b525);}return _0x4693f0[_0x87bc('0x19')](_0x35b525)[_0x87bc('0x1a')]();};}function respondWithResult(_0x434529,_0x52ea33){_0x52ea33=_0x52ea33||0xc8;return function(_0xa7e54b){if(_0xa7e54b){return _0x434529[_0x87bc('0x19')](_0x52ea33)['json'](_0xa7e54b);}};}function respondWithFilteredResult(_0x22a065,_0x129293){return function(_0x4fea0b){if(_0x4fea0b){var _0x801dbb=_0x4fea0b[_0x87bc('0x1b')],_0x2e9416=_0x129293[_0x87bc('0x1c')],_0x858a60=_0x129293[_0x87bc('0x1c')]+_0x129293[_0x87bc('0x1d')],_0x31d86f;if(_0x858a60>=_0x801dbb){_0x858a60=_0x801dbb;_0x31d86f=0xc8;}else{_0x31d86f=0xce;}_0x22a065[_0x87bc('0x19')](_0x31d86f);return _0x22a065[_0x87bc('0x1e')](_0x87bc('0x1f'),_0x2e9416+'-'+_0x858a60+'/'+_0x801dbb)[_0x87bc('0x20')](_0x4fea0b);}return null;};}function patchUpdates(_0x44d4c5){return function(_0x19839b){try{jsonpatch['apply'](_0x19839b,_0x44d4c5,!![]);}catch(_0x432773){return BPromise[_0x87bc('0x21')](_0x432773);}return _0x19839b['save']();};}function saveUpdates(_0x23e879,_0x2e9c8c){return function(_0x14b2a4){if(_0x14b2a4){return _0x14b2a4[_0x87bc('0x22')](_0x23e879)['then'](function(_0x439bed){return _0x439bed;});}return null;};}function removeEntity(_0x523484,_0x1adf5a){return function(_0x12f7f7){if(_0x12f7f7){return _0x12f7f7[_0x87bc('0x23')]()[_0x87bc('0x24')](function(){_0x523484[_0x87bc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b2dfd,_0x54a84d){return function(_0x3c75b1){if(!_0x3c75b1){_0x5b2dfd[_0x87bc('0x18')](0x194);}return _0x3c75b1;};}function handleError(_0x5a7941,_0x78e3a1){_0x78e3a1=_0x78e3a1||0x1f4;return function(_0x5878d2){logger[_0x87bc('0x25')](_0x5878d2[_0x87bc('0x26')]);if(_0x5878d2[_0x87bc('0x27')]){delete _0x5878d2[_0x87bc('0x27')];}_0x5a7941[_0x87bc('0x19')](_0x78e3a1)[_0x87bc('0x28')](_0x5878d2);};}exports[_0x87bc('0x29')]=function(_0x41a168,_0x543909){var _0x5b533d={},_0x3d8e45={},_0x181f93={'count':0x0,'rows':[]};var _0x43592e=_[_0x87bc('0x2a')](db[_0x87bc('0x2b')][_0x87bc('0x2c')],function(_0x12c54e){return{'name':_0x12c54e[_0x87bc('0x2d')],'type':_0x12c54e[_0x87bc('0x2e')][_0x87bc('0x2f')]};});_0x3d8e45[_0x87bc('0x30')]=_[_0x87bc('0x2a')](_0x43592e,_0x87bc('0x27'));_0x3d8e45[_0x87bc('0x31')]=_[_0x87bc('0x32')](_0x41a168[_0x87bc('0x31')]);_0x3d8e45[_0x87bc('0x33')]=_[_0x87bc('0x34')](_0x3d8e45[_0x87bc('0x30')],_0x3d8e45[_0x87bc('0x31')]);_0x5b533d['attributes']=_[_0x87bc('0x34')](_0x3d8e45[_0x87bc('0x30')],qs[_0x87bc('0x35')](_0x41a168[_0x87bc('0x31')][_0x87bc('0x35')]));_0x5b533d['attributes']=_0x5b533d[_0x87bc('0x36')]['length']?_0x5b533d[_0x87bc('0x36')]:_0x3d8e45[_0x87bc('0x30')];if(!_0x41a168[_0x87bc('0x31')][_0x87bc('0x37')](_0x87bc('0x38'))){_0x5b533d[_0x87bc('0x1d')]=qs[_0x87bc('0x1d')](_0x41a168['query'][_0x87bc('0x1d')]);_0x5b533d[_0x87bc('0x1c')]=qs[_0x87bc('0x1c')](_0x41a168['query'][_0x87bc('0x1c')]);}_0x5b533d['order']=qs[_0x87bc('0x39')](_0x41a168[_0x87bc('0x31')][_0x87bc('0x39')]);_0x5b533d[_0x87bc('0x3a')]=qs[_0x87bc('0x33')](_[_0x87bc('0x3b')](_0x41a168[_0x87bc('0x31')],_0x3d8e45[_0x87bc('0x33')]));if(_0x41a168[_0x87bc('0x31')][_0x87bc('0x3c')]){_0x5b533d['where']=_['merge'](_0x5b533d[_0x87bc('0x3a')],{'$or':_[_0x87bc('0x2a')](_0x43592e,function(_0x1a6cba){if(_0x1a6cba['type']!==_0x87bc('0x3d')){var _0x12c182={};_0x12c182[_0x1a6cba[_0x87bc('0x27')]]={'$like':'%'+_0x41a168[_0x87bc('0x31')][_0x87bc('0x3c')]+'%'};return _0x12c182;}})});}_0x5b533d=_[_0x87bc('0x3e')]({},_0x5b533d,_0x41a168['options']);var _0x43b45c={'where':_0x5b533d['where']};return db[_0x87bc('0x2b')]['count'](_0x43b45c)[_0x87bc('0x24')](function(_0x765199){_0x181f93[_0x87bc('0x1b')]=_0x765199;if(_0x41a168['query'][_0x87bc('0x3f')]){_0x5b533d[_0x87bc('0x40')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x87bc('0x41')](_0x5b533d);})[_0x87bc('0x24')](function(_0x2f0070){_0x181f93[_0x87bc('0x42')]=_0x2f0070;return _0x181f93;})['then'](respondWithFilteredResult(_0x543909,_0x5b533d))['catch'](handleError(_0x543909,null));};exports['show']=function(_0x2138b1,_0x42dfa3){var _0x1bfffe={'raw':!![],'where':{'id':_0x2138b1[_0x87bc('0x43')]['id']}},_0x47f454={};_0x47f454[_0x87bc('0x30')]=_[_0x87bc('0x32')](db[_0x87bc('0x2b')][_0x87bc('0x2c')]);_0x47f454[_0x87bc('0x31')]=_[_0x87bc('0x32')](_0x2138b1[_0x87bc('0x31')]);_0x47f454['filters']=_[_0x87bc('0x34')](_0x47f454[_0x87bc('0x30')],_0x47f454[_0x87bc('0x31')]);_0x1bfffe[_0x87bc('0x36')]=_[_0x87bc('0x34')](_0x47f454[_0x87bc('0x30')],qs[_0x87bc('0x35')](_0x2138b1[_0x87bc('0x31')][_0x87bc('0x35')]));_0x1bfffe[_0x87bc('0x36')]=_0x1bfffe['attributes'][_0x87bc('0x44')]?_0x1bfffe[_0x87bc('0x36')]:_0x47f454[_0x87bc('0x30')];if(_0x2138b1[_0x87bc('0x31')][_0x87bc('0x3f')]){_0x1bfffe[_0x87bc('0x40')]=[{'all':!![]}];}_0x1bfffe=_[_0x87bc('0x3e')]({},_0x1bfffe,_0x2138b1[_0x87bc('0x45')]);return db['SmsQueueReport'][_0x87bc('0x46')](_0x1bfffe)[_0x87bc('0x24')](handleEntityNotFound(_0x42dfa3,null))['then'](respondWithResult(_0x42dfa3,null))[_0x87bc('0x47')](handleError(_0x42dfa3,null));};exports[_0x87bc('0x48')]=function(_0x56d053,_0x2c3d11){return db['SmsQueueReport'][_0x87bc('0x48')](_0x56d053[_0x87bc('0x49')],{})[_0x87bc('0x24')](respondWithResult(_0x2c3d11,0xc9))[_0x87bc('0x47')](handleError(_0x2c3d11,null));};exports[_0x87bc('0x22')]=function(_0x4c182b,_0x540083){if(_0x4c182b['body']['id']){delete _0x4c182b[_0x87bc('0x49')]['id'];}return db[_0x87bc('0x2b')][_0x87bc('0x46')]({'where':{'id':_0x4c182b['params']['id']}})[_0x87bc('0x24')](handleEntityNotFound(_0x540083,null))['then'](saveUpdates(_0x4c182b[_0x87bc('0x49')],null))[_0x87bc('0x24')](respondWithResult(_0x540083,null))[_0x87bc('0x47')](handleError(_0x540083,null));};exports[_0x87bc('0x23')]=function(_0x4f5d18,_0x299902){return db['SmsQueueReport']['find']({'where':{'id':_0x4f5d18[_0x87bc('0x43')]['id']}})[_0x87bc('0x24')](handleEntityNotFound(_0x299902,null))[_0x87bc('0x24')](removeEntity(_0x299902,null))[_0x87bc('0x47')](handleError(_0x299902,null));};exports['describe']=function(_0x35835d,_0x451cd0){return db['SmsQueueReport'][_0x87bc('0x4a')]()[_0x87bc('0x24')](respondWithResult(_0x451cd0,null))[_0x87bc('0x47')](handleError(_0x451cd0,null));}; \ No newline at end of file +var _0x2a7b=['merge','VIRTUAL','options','SmsQueueReport','includeAll','findAll','rows','show','params','intersection','length','include','catch','create','update','body','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','nolimit','limit','order','sort','pick','filter','where'];(function(_0x1917bb,_0x3765f4){var _0x392753=function(_0x4380b8){while(--_0x4380b8){_0x1917bb['push'](_0x1917bb['shift']());}};_0x392753(++_0x3765f4);}(_0x2a7b,0x17f));var _0xb2a7=function(_0x56ad2f,_0x501b4f){_0x56ad2f=_0x56ad2f-0x0;var _0x7c61c6=_0x2a7b[_0x56ad2f];return _0x7c61c6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb2a7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb2a7('0x1'));var rp=require(_0xb2a7('0x2'));var moment=require(_0xb2a7('0x3'));var BPromise=require(_0xb2a7('0x4'));var Mustache=require(_0xb2a7('0x5'));var util=require(_0xb2a7('0x6'));var path=require(_0xb2a7('0x7'));var sox=require(_0xb2a7('0x8'));var csv=require(_0xb2a7('0x9'));var ejs=require(_0xb2a7('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb2a7('0xb'));var crypto=require(_0xb2a7('0xc'));var jsforce=require(_0xb2a7('0xd'));var deskjs=require(_0xb2a7('0xe'));var toCsv=require(_0xb2a7('0x9'));var querystring=require('querystring');var Papa=require(_0xb2a7('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb2a7('0x10'));var as=require(_0xb2a7('0x11'));var hardwareService=require(_0xb2a7('0x12'));var logger=require(_0xb2a7('0x13'))('api');var utils=require(_0xb2a7('0x14'));var config=require('../../config/environment');var db=require(_0xb2a7('0x15'))['db'];function respondWithStatusCode(_0x4bc96c,_0x32efc6){_0x32efc6=_0x32efc6||0xcc;return function(_0x4a32f7){if(_0x4a32f7){return _0x4bc96c[_0xb2a7('0x16')](_0x32efc6);}return _0x4bc96c[_0xb2a7('0x17')](_0x32efc6)['end']();};}function respondWithResult(_0x3d3eaf,_0x3177e9){_0x3177e9=_0x3177e9||0xc8;return function(_0x463017){if(_0x463017){return _0x3d3eaf[_0xb2a7('0x17')](_0x3177e9)[_0xb2a7('0x18')](_0x463017);}};}function respondWithFilteredResult(_0x419e93,_0xaf36f9){return function(_0x864384){if(_0x864384){var _0xeac96a=_0x864384[_0xb2a7('0x19')],_0x7bfe4a=_0xaf36f9['offset'],_0x1ffae=_0xaf36f9[_0xb2a7('0x1a')]+_0xaf36f9['limit'],_0x25e62e;if(_0x1ffae>=_0xeac96a){_0x1ffae=_0xeac96a;_0x25e62e=0xc8;}else{_0x25e62e=0xce;}_0x419e93[_0xb2a7('0x17')](_0x25e62e);return _0x419e93[_0xb2a7('0x1b')](_0xb2a7('0x1c'),_0x7bfe4a+'-'+_0x1ffae+'/'+_0xeac96a)[_0xb2a7('0x18')](_0x864384);}return null;};}function patchUpdates(_0x5dc142){return function(_0x32108a){try{jsonpatch[_0xb2a7('0x1d')](_0x32108a,_0x5dc142,!![]);}catch(_0x492def){return BPromise[_0xb2a7('0x1e')](_0x492def);}return _0x32108a[_0xb2a7('0x1f')]();};}function saveUpdates(_0x5efc76,_0x4237a7){return function(_0x3fd0a5){if(_0x3fd0a5){return _0x3fd0a5['update'](_0x5efc76)[_0xb2a7('0x20')](function(_0x1a6989){return _0x1a6989;});}return null;};}function removeEntity(_0x35a95c,_0x3a5cae){return function(_0x5c18b1){if(_0x5c18b1){return _0x5c18b1[_0xb2a7('0x21')]()[_0xb2a7('0x20')](function(){_0x35a95c[_0xb2a7('0x17')](0xcc)[_0xb2a7('0x22')]();});}};}function handleEntityNotFound(_0x47ed5e,_0x20ce9a){return function(_0x222b87){if(!_0x222b87){_0x47ed5e[_0xb2a7('0x16')](0x194);}return _0x222b87;};}function handleError(_0x59fb23,_0x198c5a){_0x198c5a=_0x198c5a||0x1f4;return function(_0x41a603){logger['error'](_0x41a603[_0xb2a7('0x23')]);if(_0x41a603[_0xb2a7('0x24')]){delete _0x41a603[_0xb2a7('0x24')];}_0x59fb23[_0xb2a7('0x17')](_0x198c5a)['send'](_0x41a603);};}exports['index']=function(_0x58e50f,_0x59bf18){var _0xd11ee5={},_0xc2e525={},_0x26f047={'count':0x0,'rows':[]};var _0x34b502=_[_0xb2a7('0x25')](db['SmsQueueReport'][_0xb2a7('0x26')],function(_0x3fe28d){return{'name':_0x3fe28d[_0xb2a7('0x27')],'type':_0x3fe28d[_0xb2a7('0x28')][_0xb2a7('0x29')]};});_0xc2e525[_0xb2a7('0x2a')]=_[_0xb2a7('0x25')](_0x34b502,_0xb2a7('0x24'));_0xc2e525[_0xb2a7('0x2b')]=_[_0xb2a7('0x2c')](_0x58e50f[_0xb2a7('0x2b')]);_0xc2e525[_0xb2a7('0x2d')]=_['intersection'](_0xc2e525[_0xb2a7('0x2a')],_0xc2e525[_0xb2a7('0x2b')]);_0xd11ee5[_0xb2a7('0x2e')]=_['intersection'](_0xc2e525['model'],qs[_0xb2a7('0x2f')](_0x58e50f[_0xb2a7('0x2b')][_0xb2a7('0x2f')]));_0xd11ee5[_0xb2a7('0x2e')]=_0xd11ee5[_0xb2a7('0x2e')]['length']?_0xd11ee5['attributes']:_0xc2e525[_0xb2a7('0x2a')];if(!_0x58e50f[_0xb2a7('0x2b')]['hasOwnProperty'](_0xb2a7('0x30'))){_0xd11ee5['limit']=qs[_0xb2a7('0x31')](_0x58e50f[_0xb2a7('0x2b')][_0xb2a7('0x31')]);_0xd11ee5[_0xb2a7('0x1a')]=qs[_0xb2a7('0x1a')](_0x58e50f[_0xb2a7('0x2b')]['offset']);}_0xd11ee5[_0xb2a7('0x32')]=qs[_0xb2a7('0x33')](_0x58e50f[_0xb2a7('0x2b')][_0xb2a7('0x33')]);_0xd11ee5['where']=qs[_0xb2a7('0x2d')](_[_0xb2a7('0x34')](_0x58e50f['query'],_0xc2e525[_0xb2a7('0x2d')]));if(_0x58e50f[_0xb2a7('0x2b')][_0xb2a7('0x35')]){_0xd11ee5[_0xb2a7('0x36')]=_[_0xb2a7('0x37')](_0xd11ee5['where'],{'$or':_[_0xb2a7('0x25')](_0x34b502,function(_0x58cbbc){if(_0x58cbbc['type']!==_0xb2a7('0x38')){var _0x296f5f={};_0x296f5f[_0x58cbbc[_0xb2a7('0x24')]]={'$like':'%'+_0x58e50f[_0xb2a7('0x2b')]['filter']+'%'};return _0x296f5f;}})});}_0xd11ee5=_['merge']({},_0xd11ee5,_0x58e50f[_0xb2a7('0x39')]);var _0x5e2d79={'where':_0xd11ee5[_0xb2a7('0x36')]};return db[_0xb2a7('0x3a')][_0xb2a7('0x19')](_0x5e2d79)['then'](function(_0x52f199){_0x26f047['count']=_0x52f199;if(_0x58e50f[_0xb2a7('0x2b')][_0xb2a7('0x3b')]){_0xd11ee5['include']=[{'all':!![]}];}return db['SmsQueueReport'][_0xb2a7('0x3c')](_0xd11ee5);})[_0xb2a7('0x20')](function(_0x4cfd5f){_0x26f047[_0xb2a7('0x3d')]=_0x4cfd5f;return _0x26f047;})[_0xb2a7('0x20')](respondWithFilteredResult(_0x59bf18,_0xd11ee5))['catch'](handleError(_0x59bf18,null));};exports[_0xb2a7('0x3e')]=function(_0x231c5f,_0x42bdef){var _0x4390a7={'raw':!![],'where':{'id':_0x231c5f[_0xb2a7('0x3f')]['id']}},_0x3802eb={};_0x3802eb[_0xb2a7('0x2a')]=_[_0xb2a7('0x2c')](db[_0xb2a7('0x3a')]['rawAttributes']);_0x3802eb[_0xb2a7('0x2b')]=_[_0xb2a7('0x2c')](_0x231c5f[_0xb2a7('0x2b')]);_0x3802eb[_0xb2a7('0x2d')]=_[_0xb2a7('0x40')](_0x3802eb['model'],_0x3802eb['query']);_0x4390a7[_0xb2a7('0x2e')]=_[_0xb2a7('0x40')](_0x3802eb[_0xb2a7('0x2a')],qs[_0xb2a7('0x2f')](_0x231c5f['query'][_0xb2a7('0x2f')]));_0x4390a7[_0xb2a7('0x2e')]=_0x4390a7[_0xb2a7('0x2e')][_0xb2a7('0x41')]?_0x4390a7[_0xb2a7('0x2e')]:_0x3802eb[_0xb2a7('0x2a')];if(_0x231c5f[_0xb2a7('0x2b')][_0xb2a7('0x3b')]){_0x4390a7[_0xb2a7('0x42')]=[{'all':!![]}];}_0x4390a7=_['merge']({},_0x4390a7,_0x231c5f['options']);return db[_0xb2a7('0x3a')]['find'](_0x4390a7)[_0xb2a7('0x20')](handleEntityNotFound(_0x42bdef,null))['then'](respondWithResult(_0x42bdef,null))[_0xb2a7('0x43')](handleError(_0x42bdef,null));};exports['create']=function(_0x51cbcf,_0x4c00a2){return db[_0xb2a7('0x3a')][_0xb2a7('0x44')](_0x51cbcf['body'],{})[_0xb2a7('0x20')](respondWithResult(_0x4c00a2,0xc9))[_0xb2a7('0x43')](handleError(_0x4c00a2,null));};exports[_0xb2a7('0x45')]=function(_0x4239be,_0x197fa1){if(_0x4239be[_0xb2a7('0x46')]['id']){delete _0x4239be['body']['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x4239be[_0xb2a7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x197fa1,null))[_0xb2a7('0x20')](saveUpdates(_0x4239be[_0xb2a7('0x46')],null))[_0xb2a7('0x20')](respondWithResult(_0x197fa1,null))[_0xb2a7('0x43')](handleError(_0x197fa1,null));};exports['destroy']=function(_0x2eaa4a,_0xee2547){return db[_0xb2a7('0x3a')][_0xb2a7('0x47')]({'where':{'id':_0x2eaa4a[_0xb2a7('0x3f')]['id']}})[_0xb2a7('0x20')](handleEntityNotFound(_0xee2547,null))['then'](removeEntity(_0xee2547,null))[_0xb2a7('0x43')](handleError(_0xee2547,null));};exports[_0xb2a7('0x48')]=function(_0x1a4583,_0x1ccc96){return db['SmsQueueReport'][_0xb2a7('0x48')]()[_0xb2a7('0x20')](respondWithResult(_0x1ccc96,null))[_0xb2a7('0x43')](handleError(_0x1ccc96,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 9ccb753..f5a3a36 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 _0x136c=['exports','SmsQueueReport','report_sms_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0x136c,0x1d2));var _0xc136=function(_0x493e27,_0x5ede0b){_0x493e27=_0x493e27-0x0;var _0x5e2080=_0x136c[_0x493e27];return _0x5e2080;};'use strict';var _=require(_0xc136('0x0'));var util=require(_0xc136('0x1'));var logger=require('../../config/logger')(_0xc136('0x2'));var moment=require(_0xc136('0x3'));var BPromise=require(_0xc136('0x4'));var rp=require(_0xc136('0x5'));var fs=require('fs');var path=require(_0xc136('0x6'));var rimraf=require(_0xc136('0x7'));var config=require(_0xc136('0x8'));var attributes=require(_0xc136('0x9'));module[_0xc136('0xa')]=function(_0x586570,_0x1ac41b){return _0x586570['define'](_0xc136('0xb'),attributes,{'tableName':_0xc136('0xc'),'paranoid':![],'indexes':[{'name':_0xc136('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8840=['bluebird','request-promise','path','rimraf','../../config/environment','define','SmsQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x356c74,_0x5c123d){var _0x32febd=function(_0x395aab){while(--_0x395aab){_0x356c74['push'](_0x356c74['shift']());}};_0x32febd(++_0x5c123d);}(_0x8840,0x1ac));var _0x0884=function(_0x13d577,_0x54156b){_0x13d577=_0x13d577-0x0;var _0x54304e=_0x8840[_0x13d577];return _0x54304e;};'use strict';var _=require(_0x0884('0x0'));var util=require('util');var logger=require(_0x0884('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0884('0x2'));var rp=require(_0x0884('0x3'));var fs=require('fs');var path=require(_0x0884('0x4'));var rimraf=require(_0x0884('0x5'));var config=require(_0x0884('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3011e4,_0x5d1866){return _0x3011e4[_0x0884('0x7')](_0x0884('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x0884('0x9'),'fields':[_0x0884('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 12bda97..c7751a6 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 _0x397a=['client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','error','message','result','catch','SmsQueueReport','create','options','raw','CreateSmsQueueReport','debug','stringify','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5626dc,_0x32c329){var _0x35802b=function(_0xa8ad53){while(--_0xa8ad53){_0x5626dc['push'](_0x5626dc['shift']());}};_0x35802b(++_0x32c329);}(_0x397a,0xd0));var _0xa397=function(_0x3f6f13,_0x279bcb){_0x3f6f13=_0x3f6f13-0x0;var _0x2eb698=_0x397a[_0x3f6f13];return _0x2eb698;};'use strict';var _=require(_0xa397('0x0'));var util=require(_0xa397('0x1'));var moment=require(_0xa397('0x2'));var BPromise=require('bluebird');var rs=require(_0xa397('0x3'));var fs=require('fs');var Redis=require(_0xa397('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa397('0x5'))(_0xa397('0x6'));var config=require(_0xa397('0x7'));var jayson=require(_0xa397('0x8'));var client=jayson[_0xa397('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49b4c4,_0x21f59a,_0x3c0d97){return new BPromise(function(_0x5c476f,_0xdea690){return client[_0xa397('0xa')](_0x49b4c4,_0x3c0d97)[_0xa397('0xb')](function(_0x6d820){logger[_0xa397('0xc')](_0xa397('0xd'),_0x21f59a,'request\x20sent');logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x21f59a,_0xa397('0xe'),JSON['stringify'](_0x6d820));if(_0x6d820['error']){if(_0x6d820['error']['code']===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x21f59a,_0x6d820[_0xa397('0xf')]['message']);return _0xdea690(_0x6d820[_0xa397('0xf')][_0xa397('0x10')]);}logger['error'](_0xa397('0xd'),_0x21f59a,_0x6d820[_0xa397('0xf')]['message']);return _0x5c476f(_0x6d820[_0xa397('0xf')][_0xa397('0x10')]);}else{logger['info'](_0xa397('0xd'),_0x21f59a,_0xa397('0xe'));_0x5c476f(_0x6d820[_0xa397('0x11')][_0xa397('0x10')]);}})[_0xa397('0x12')](function(_0x5aaa06){logger[_0xa397('0xf')](_0xa397('0xd'),_0x21f59a,_0x5aaa06);_0xdea690(_0x5aaa06);});});}exports['CreateSmsQueueReport']=function(_0x259204){var _0x1a1435=this;return new Promise(function(_0x2e7f4b,_0x562fcc){return db[_0xa397('0x13')][_0xa397('0x14')](_0x259204['body'],{'raw':_0x259204[_0xa397('0x15')]?_0x259204[_0xa397('0x15')][_0xa397('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x262285){logger[_0xa397('0xc')](_0xa397('0x17'),_0x259204);logger[_0xa397('0x18')](_0xa397('0x17'),_0x259204,JSON[_0xa397('0x19')](_0x262285));_0x2e7f4b(_0x262285);})[_0xa397('0x12')](function(_0x2b9399){logger[_0xa397('0xf')](_0xa397('0x17'),_0x2b9399[_0xa397('0x10')],_0x259204);_0x562fcc(_0x1a1435['error'](0x1f4,_0x2b9399[_0xa397('0x10')]));});});};exports['UpdateSmsQueueReport']=function(_0x181be3){var _0x348cce=this;return new Promise(function(_0x1e3597,_0x33f42e){return db[_0xa397('0x13')][_0xa397('0x1a')](_0x181be3['body'],{'raw':_0x181be3[_0xa397('0x15')]?_0x181be3[_0xa397('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x181be3[_0xa397('0x15')]?_0x181be3[_0xa397('0x15')][_0xa397('0x1b')]||null:null,'attributes':_0x181be3[_0xa397('0x15')]?_0x181be3[_0xa397('0x15')][_0xa397('0x1c')]||null:null,'limit':_0x181be3[_0xa397('0x15')]?_0x181be3[_0xa397('0x15')][_0xa397('0x1d')]||null:null})[_0xa397('0xb')](function(_0x507949){logger['info'](_0xa397('0x1e'),_0x181be3);logger['debug'](_0xa397('0x1e'),_0x181be3,JSON[_0xa397('0x19')](_0x507949));_0x1e3597(_0x507949);})[_0xa397('0x12')](function(_0x32b400){logger[_0xa397('0xf')](_0xa397('0x1e'),_0x32b400[_0xa397('0x10')],_0x181be3);_0x33f42e(_0x348cce['error'](0x1f4,_0x32b400[_0xa397('0x10')]));});});}; \ No newline at end of file +var _0xf716=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','where','limit','UpdateSmsQueueReport','lodash','util'];(function(_0x2dcbc6,_0xc590c6){var _0x44d238=function(_0x10bb94){while(--_0x10bb94){_0x2dcbc6['push'](_0x2dcbc6['shift']());}};_0x44d238(++_0xc590c6);}(_0xf716,0x152));var _0x6f71=function(_0x1ba953,_0x3d6ea8){_0x1ba953=_0x1ba953-0x0;var _0x58e4c2=_0xf716[_0x1ba953];return _0x58e4c2;};'use strict';var _=require(_0x6f71('0x0'));var util=require(_0x6f71('0x1'));var moment=require(_0x6f71('0x2'));var BPromise=require(_0x6f71('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f71('0x4'));var db=require(_0x6f71('0x5'))['db'];var utils=require(_0x6f71('0x6'));var logger=require(_0x6f71('0x7'))(_0x6f71('0x8'));var config=require('../../config/environment');var jayson=require(_0x6f71('0x9'));var client=jayson[_0x6f71('0xa')][_0x6f71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x599bc0,_0x44c825,_0x35749f){return new BPromise(function(_0x47ce28,_0x328b62){return client[_0x6f71('0xc')](_0x599bc0,_0x35749f)[_0x6f71('0xd')](function(_0x31412c){logger[_0x6f71('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x44c825,'request\x20sent');logger[_0x6f71('0xf')](_0x6f71('0x10'),_0x44c825,_0x6f71('0x11'),JSON[_0x6f71('0x12')](_0x31412c));if(_0x31412c[_0x6f71('0x13')]){if(_0x31412c[_0x6f71('0x13')][_0x6f71('0x14')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x44c825,_0x31412c[_0x6f71('0x13')][_0x6f71('0x15')]);return _0x328b62(_0x31412c[_0x6f71('0x13')][_0x6f71('0x15')]);}logger[_0x6f71('0x13')](_0x6f71('0x16'),_0x44c825,_0x31412c['error'][_0x6f71('0x15')]);return _0x47ce28(_0x31412c['error'][_0x6f71('0x15')]);}else{logger[_0x6f71('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x44c825,'request\x20sent');_0x47ce28(_0x31412c[_0x6f71('0x17')][_0x6f71('0x15')]);}})[_0x6f71('0x18')](function(_0x8dfa84){logger[_0x6f71('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x44c825,_0x8dfa84);_0x328b62(_0x8dfa84);});});}exports[_0x6f71('0x19')]=function(_0x415637){var _0xa9364b=this;return new Promise(function(_0x294342,_0x4fbcdc){return db[_0x6f71('0x1a')][_0x6f71('0x1b')](_0x415637[_0x6f71('0x1c')],{'raw':_0x415637[_0x6f71('0x1d')]?_0x415637[_0x6f71('0x1d')][_0x6f71('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0xf585d3){logger[_0x6f71('0xe')]('CreateSmsQueueReport',_0x415637);logger[_0x6f71('0xf')]('CreateSmsQueueReport',_0x415637,JSON['stringify'](_0xf585d3));_0x294342(_0xf585d3);})[_0x6f71('0x18')](function(_0x24b7ab){logger['error'](_0x6f71('0x19'),_0x24b7ab[_0x6f71('0x15')],_0x415637);_0x4fbcdc(_0xa9364b[_0x6f71('0x13')](0x1f4,_0x24b7ab[_0x6f71('0x15')]));});});};exports['UpdateSmsQueueReport']=function(_0x5609a0){var _0x179e4e=this;return new Promise(function(_0x2c624f,_0x117fe9){return db[_0x6f71('0x1a')]['update'](_0x5609a0[_0x6f71('0x1c')],{'raw':_0x5609a0[_0x6f71('0x1d')]?_0x5609a0[_0x6f71('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5609a0['options']?_0x5609a0[_0x6f71('0x1d')][_0x6f71('0x1f')]||null:null,'attributes':_0x5609a0[_0x6f71('0x1d')]?_0x5609a0['options']['attributes']||null:null,'limit':_0x5609a0[_0x6f71('0x1d')]?_0x5609a0['options'][_0x6f71('0x20')]||null:null})[_0x6f71('0xd')](function(_0x203054){logger[_0x6f71('0xe')]('UpdateSmsQueueReport',_0x5609a0);logger[_0x6f71('0xf')](_0x6f71('0x21'),_0x5609a0,JSON[_0x6f71('0x12')](_0x203054));_0x2c624f(_0x203054);})['catch'](function(_0x2eaf97){logger[_0x6f71('0x13')](_0x6f71('0x21'),_0x2eaf97[_0x6f71('0x15')],_0x5609a0);_0x117fe9(_0x179e4e[_0x6f71('0x13')](0x1f4,_0x2eaf97[_0x6f71('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index bbf9f55..5d1972a 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 _0xb03e=['describe','/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x2e32c1,_0x3ba179){var _0x51e359=function(_0x27f9f5){while(--_0x27f9f5){_0x2e32c1['push'](_0x2e32c1['shift']());}};_0x51e359(++_0x3ba179);}(_0xb03e,0x1eb));var _0xeb03=function(_0x1c2e4c,_0x22a023){_0x1c2e4c=_0x1c2e4c-0x0;var _0xc76f18=_0xb03e[_0x1c2e4c];return _0xc76f18;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var auth=require(_0xeb03('0x5'));var interaction=require(_0xeb03('0x6'));var config=require(_0xeb03('0x7'));var controller=require(_0xeb03('0x8'));router[_0xeb03('0x9')]('/',auth[_0xeb03('0xa')](),controller[_0xeb03('0xb')]);router['get'](_0xeb03('0xc'),auth[_0xeb03('0xa')](),controller[_0xeb03('0xd')]);router[_0xeb03('0x9')](_0xeb03('0xe'),auth[_0xeb03('0xa')](),controller['show']);router[_0xeb03('0xf')]('/',auth[_0xeb03('0xa')](),controller[_0xeb03('0x10')]);router['put'](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router[_0xeb03('0x12')](_0xeb03('0xe'),auth[_0xeb03('0xa')](),controller[_0xeb03('0x13')]);module[_0xeb03('0x14')]=router; \ No newline at end of file +var _0x4024=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./smsTransferReport.controller','index','get','/describe','describe','isAuthenticated','put','delete','/:id','destroy'];(function(_0x425e0f,_0x4dad0d){var _0x46497d=function(_0x2ec4ce){while(--_0x2ec4ce){_0x425e0f['push'](_0x425e0f['shift']());}};_0x46497d(++_0x4dad0d);}(_0x4024,0x89));var _0x4402=function(_0x4ab5fc,_0x3d4815){_0x4ab5fc=_0x4ab5fc-0x0;var _0x3669f4=_0x4024[_0x4ab5fc];return _0x3669f4;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var auth=require(_0x4402('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4402('0x5'));var controller=require(_0x4402('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4402('0x7')]);router[_0x4402('0x8')](_0x4402('0x9'),auth['isAuthenticated'](),controller[_0x4402('0xa')]);router['get']('/:id',auth[_0x4402('0xb')](),controller['show']);router['post']('/',auth[_0x4402('0xb')](),controller['create']);router[_0x4402('0xc')]('/:id',auth[_0x4402('0xb')](),controller['update']);router[_0x4402('0xd')](_0x4402('0xe'),auth['isAuthenticated'](),controller[_0x4402('0xf')]);module[_0x4402('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index b9bd013..a354b76 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 _0x3ab9=['sequelize','exports','ENUM','account','agent','queue','DATE','NOW'];(function(_0x1b4401,_0x8c1cdf){var _0x36e0c7=function(_0x2eb409){while(--_0x2eb409){_0x1b4401['push'](_0x1b4401['shift']());}};_0x36e0c7(++_0x8c1cdf);}(_0x3ab9,0xc8));var _0x93ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab9[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x93ab('0x0'));module[_0x93ab('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x93ab('0x2')](_0x93ab('0x3'),_0x93ab('0x4'),_0x93ab('0x5')),'allowNull':![],'defaultValue':_0x93ab('0x5')},'transferredAt':{'type':Sequelize[_0x93ab('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x93ab('0x7')]}}; \ No newline at end of file +var _0xafa3=['queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM','agent'];(function(_0x5bdb53,_0x382708){var _0x361815=function(_0x54b4ec){while(--_0x54b4ec){_0x5bdb53['push'](_0x5bdb53['shift']());}};_0x361815(++_0x382708);}(_0xafa3,0x174));var _0x3afa=function(_0x2ac13,_0x3f98a5){_0x2ac13=_0x2ac13-0x0;var _0x2a5c5f=_0xafa3[_0x2ac13];return _0x2a5c5f;};'use strict';var moment=require(_0x3afa('0x0'));var Sequelize=require(_0x3afa('0x1'));module[_0x3afa('0x2')]={'uniqueid':{'type':Sequelize[_0x3afa('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x3afa('0x4')]('account',_0x3afa('0x5'),_0x3afa('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x3afa('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x3afa('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 75c467b..dca1d42 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 _0x3320=['intersection','model','attributes','fields','length','nolimit','order','sort','where','map','VIRTUAL','filter','merge','options','count','include','findAll','catch','show','params','keys','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','end','status','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','SmsTransferReport','rawAttributes','fieldName','type','key','query','filters'];(function(_0x353abb,_0x194c80){var _0x43c9c5=function(_0x456b74){while(--_0x456b74){_0x353abb['push'](_0x353abb['shift']());}};_0x43c9c5(++_0x194c80);}(_0x3320,0xb0));var _0x0332=function(_0x480c74,_0x2d29b8){_0x480c74=_0x480c74-0x0;var _0x4a1214=_0x3320[_0x480c74];return _0x4a1214;};'use strict';var pdf=require(_0x0332('0x0'));var emlformat=require(_0x0332('0x1'));var rimraf=require(_0x0332('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0332('0x3'));var rp=require(_0x0332('0x4'));var moment=require('moment');var BPromise=require(_0x0332('0x5'));var Mustache=require(_0x0332('0x6'));var util=require(_0x0332('0x7'));var path=require(_0x0332('0x8'));var sox=require(_0x0332('0x9'));var csv=require('to-csv');var ejs=require(_0x0332('0xa'));var fs=require('fs');var _=require(_0x0332('0xb'));var squel=require(_0x0332('0xc'));var crypto=require(_0x0332('0xd'));var jsforce=require(_0x0332('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0332('0xf'));var querystring=require('querystring');var Papa=require(_0x0332('0x10'));var Redis=require(_0x0332('0x11'));var authService=require(_0x0332('0x12'));var qs=require(_0x0332('0x13'));var as=require(_0x0332('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0332('0x15'))(_0x0332('0x16'));var utils=require(_0x0332('0x17'));var config=require('../../config/environment');var db=require(_0x0332('0x18'))['db'];function respondWithStatusCode(_0x3ed46b,_0x4809cb){_0x4809cb=_0x4809cb||0xcc;return function(_0x1cb485){if(_0x1cb485){return _0x3ed46b['sendStatus'](_0x4809cb);}return _0x3ed46b['status'](_0x4809cb)[_0x0332('0x19')]();};}function respondWithResult(_0x1802e8,_0xcda9a6){_0xcda9a6=_0xcda9a6||0xc8;return function(_0x315509){if(_0x315509){return _0x1802e8[_0x0332('0x1a')](_0xcda9a6)['json'](_0x315509);}};}function respondWithFilteredResult(_0x148fad,_0x3bb73d){return function(_0x2bb51c){if(_0x2bb51c){var _0x46cc2a=_0x2bb51c['count'],_0x276c15=_0x3bb73d['offset'],_0x53be2f=_0x3bb73d[_0x0332('0x1b')]+_0x3bb73d[_0x0332('0x1c')],_0x2c662c;if(_0x53be2f>=_0x46cc2a){_0x53be2f=_0x46cc2a;_0x2c662c=0xc8;}else{_0x2c662c=0xce;}_0x148fad[_0x0332('0x1a')](_0x2c662c);return _0x148fad['set'](_0x0332('0x1d'),_0x276c15+'-'+_0x53be2f+'/'+_0x46cc2a)['json'](_0x2bb51c);}return null;};}function patchUpdates(_0x1e1762){return function(_0x14ae00){try{jsonpatch[_0x0332('0x1e')](_0x14ae00,_0x1e1762,!![]);}catch(_0x151d7f){return BPromise[_0x0332('0x1f')](_0x151d7f);}return _0x14ae00[_0x0332('0x20')]();};}function saveUpdates(_0x3cbac2,_0x4fef54){return function(_0x12ce2a){if(_0x12ce2a){return _0x12ce2a[_0x0332('0x21')](_0x3cbac2)[_0x0332('0x22')](function(_0x16bfc5){return _0x16bfc5;});}return null;};}function removeEntity(_0x14a4c4,_0x57297c){return function(_0x2c40fd){if(_0x2c40fd){return _0x2c40fd[_0x0332('0x23')]()[_0x0332('0x22')](function(){_0x14a4c4[_0x0332('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d0162,_0x10a21d){return function(_0x47d429){if(!_0x47d429){_0x3d0162[_0x0332('0x24')](0x194);}return _0x47d429;};}function handleError(_0x307d29,_0x5c01bc){_0x5c01bc=_0x5c01bc||0x1f4;return function(_0x2e2c75){logger[_0x0332('0x25')](_0x2e2c75[_0x0332('0x26')]);if(_0x2e2c75[_0x0332('0x27')]){delete _0x2e2c75[_0x0332('0x27')];}_0x307d29[_0x0332('0x1a')](_0x5c01bc)[_0x0332('0x28')](_0x2e2c75);};}exports[_0x0332('0x29')]=function(_0x51eaf0,_0x412360){var _0x25b5e9={},_0x3fa761={},_0x13e6da={'count':0x0,'rows':[]};var _0x22ef1a=_['map'](db[_0x0332('0x2a')][_0x0332('0x2b')],function(_0x5a51b4){return{'name':_0x5a51b4[_0x0332('0x2c')],'type':_0x5a51b4[_0x0332('0x2d')][_0x0332('0x2e')]};});_0x3fa761['model']=_['map'](_0x22ef1a,_0x0332('0x27'));_0x3fa761['query']=_['keys'](_0x51eaf0[_0x0332('0x2f')]);_0x3fa761[_0x0332('0x30')]=_[_0x0332('0x31')](_0x3fa761[_0x0332('0x32')],_0x3fa761[_0x0332('0x2f')]);_0x25b5e9[_0x0332('0x33')]=_[_0x0332('0x31')](_0x3fa761[_0x0332('0x32')],qs[_0x0332('0x34')](_0x51eaf0['query'][_0x0332('0x34')]));_0x25b5e9[_0x0332('0x33')]=_0x25b5e9[_0x0332('0x33')][_0x0332('0x35')]?_0x25b5e9['attributes']:_0x3fa761[_0x0332('0x32')];if(!_0x51eaf0[_0x0332('0x2f')]['hasOwnProperty'](_0x0332('0x36'))){_0x25b5e9['limit']=qs[_0x0332('0x1c')](_0x51eaf0['query'][_0x0332('0x1c')]);_0x25b5e9[_0x0332('0x1b')]=qs[_0x0332('0x1b')](_0x51eaf0[_0x0332('0x2f')][_0x0332('0x1b')]);}_0x25b5e9[_0x0332('0x37')]=qs[_0x0332('0x38')](_0x51eaf0['query'][_0x0332('0x38')]);_0x25b5e9['where']=qs[_0x0332('0x30')](_['pick'](_0x51eaf0[_0x0332('0x2f')],_0x3fa761[_0x0332('0x30')]));if(_0x51eaf0[_0x0332('0x2f')]['filter']){_0x25b5e9[_0x0332('0x39')]=_['merge'](_0x25b5e9[_0x0332('0x39')],{'$or':_[_0x0332('0x3a')](_0x22ef1a,function(_0x2bcb47){if(_0x2bcb47[_0x0332('0x2d')]!==_0x0332('0x3b')){var _0x2ec034={};_0x2ec034[_0x2bcb47[_0x0332('0x27')]]={'$like':'%'+_0x51eaf0['query'][_0x0332('0x3c')]+'%'};return _0x2ec034;}})});}_0x25b5e9=_[_0x0332('0x3d')]({},_0x25b5e9,_0x51eaf0[_0x0332('0x3e')]);var _0x3ff9f2={'where':_0x25b5e9['where']};return db[_0x0332('0x2a')][_0x0332('0x3f')](_0x3ff9f2)[_0x0332('0x22')](function(_0x5695d5){_0x13e6da[_0x0332('0x3f')]=_0x5695d5;if(_0x51eaf0['query']['includeAll']){_0x25b5e9[_0x0332('0x40')]=[{'all':!![]}];}return db[_0x0332('0x2a')][_0x0332('0x41')](_0x25b5e9);})[_0x0332('0x22')](function(_0x40b869){_0x13e6da['rows']=_0x40b869;return _0x13e6da;})[_0x0332('0x22')](respondWithFilteredResult(_0x412360,_0x25b5e9))[_0x0332('0x42')](handleError(_0x412360,null));};exports[_0x0332('0x43')]=function(_0x1dc77a,_0x46074f){var _0x33a467={'raw':!![],'where':{'id':_0x1dc77a[_0x0332('0x44')]['id']}},_0x58875b={};_0x58875b[_0x0332('0x32')]=_[_0x0332('0x45')](db[_0x0332('0x2a')][_0x0332('0x2b')]);_0x58875b[_0x0332('0x2f')]=_[_0x0332('0x45')](_0x1dc77a[_0x0332('0x2f')]);_0x58875b[_0x0332('0x30')]=_[_0x0332('0x31')](_0x58875b[_0x0332('0x32')],_0x58875b[_0x0332('0x2f')]);_0x33a467[_0x0332('0x33')]=_[_0x0332('0x31')](_0x58875b[_0x0332('0x32')],qs[_0x0332('0x34')](_0x1dc77a[_0x0332('0x2f')]['fields']));_0x33a467[_0x0332('0x33')]=_0x33a467['attributes'][_0x0332('0x35')]?_0x33a467[_0x0332('0x33')]:_0x58875b[_0x0332('0x32')];if(_0x1dc77a[_0x0332('0x2f')][_0x0332('0x46')]){_0x33a467[_0x0332('0x40')]=[{'all':!![]}];}_0x33a467=_[_0x0332('0x3d')]({},_0x33a467,_0x1dc77a[_0x0332('0x3e')]);return db[_0x0332('0x2a')][_0x0332('0x47')](_0x33a467)['then'](handleEntityNotFound(_0x46074f,null))[_0x0332('0x22')](respondWithResult(_0x46074f,null))[_0x0332('0x42')](handleError(_0x46074f,null));};exports[_0x0332('0x48')]=function(_0x967291,_0x3b17b2){return db[_0x0332('0x2a')]['create'](_0x967291[_0x0332('0x49')],{})[_0x0332('0x22')](respondWithResult(_0x3b17b2,0xc9))[_0x0332('0x42')](handleError(_0x3b17b2,null));};exports[_0x0332('0x21')]=function(_0x31f235,_0x1f1015){if(_0x31f235[_0x0332('0x49')]['id']){delete _0x31f235[_0x0332('0x49')]['id'];}return db[_0x0332('0x2a')]['find']({'where':{'id':_0x31f235[_0x0332('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f1015,null))[_0x0332('0x22')](saveUpdates(_0x31f235[_0x0332('0x49')],null))[_0x0332('0x22')](respondWithResult(_0x1f1015,null))[_0x0332('0x42')](handleError(_0x1f1015,null));};exports[_0x0332('0x23')]=function(_0x5bce12,_0x3eae0c){return db[_0x0332('0x2a')]['find']({'where':{'id':_0x5bce12[_0x0332('0x44')]['id']}})[_0x0332('0x22')](handleEntityNotFound(_0x3eae0c,null))[_0x0332('0x22')](removeEntity(_0x3eae0c,null))[_0x0332('0x42')](handleError(_0x3eae0c,null));};exports[_0x0332('0x4a')]=function(_0x26b7b0,_0x448ec3){return db[_0x0332('0x2a')][_0x0332('0x4a')]()[_0x0332('0x22')](respondWithResult(_0x448ec3,null))[_0x0332('0x42')](handleError(_0x448ec3,null));}; \ No newline at end of file +var _0x7bc5=['destroy','error','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then'];(function(_0x3ad8ce,_0x32b79f){var _0x898f50=function(_0x54a0b2){while(--_0x54a0b2){_0x3ad8ce['push'](_0x3ad8ce['shift']());}};_0x898f50(++_0x32b79f);}(_0x7bc5,0x1a1));var _0x57bc=function(_0x468a77,_0x1382be){_0x468a77=_0x468a77-0x0;var _0x2d1c33=_0x7bc5[_0x468a77];return _0x2d1c33;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x57bc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x57bc('0x1'));var jsonpatch=require(_0x57bc('0x2'));var rp=require(_0x57bc('0x3'));var moment=require(_0x57bc('0x4'));var BPromise=require(_0x57bc('0x5'));var Mustache=require(_0x57bc('0x6'));var util=require(_0x57bc('0x7'));var path=require(_0x57bc('0x8'));var sox=require(_0x57bc('0x9'));var csv=require(_0x57bc('0xa'));var ejs=require(_0x57bc('0xb'));var fs=require('fs');var _=require(_0x57bc('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x57bc('0xd'));var deskjs=require(_0x57bc('0xe'));var toCsv=require(_0x57bc('0xa'));var querystring=require(_0x57bc('0xf'));var Papa=require(_0x57bc('0x10'));var Redis=require(_0x57bc('0x11'));var authService=require(_0x57bc('0x12'));var qs=require(_0x57bc('0x13'));var as=require(_0x57bc('0x14'));var hardwareService=require(_0x57bc('0x15'));var logger=require(_0x57bc('0x16'))(_0x57bc('0x17'));var utils=require(_0x57bc('0x18'));var config=require(_0x57bc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17bd12,_0x41c3a5){_0x41c3a5=_0x41c3a5||0xcc;return function(_0x1edefd){if(_0x1edefd){return _0x17bd12[_0x57bc('0x1a')](_0x41c3a5);}return _0x17bd12['status'](_0x41c3a5)[_0x57bc('0x1b')]();};}function respondWithResult(_0x39542f,_0x19cbbb){_0x19cbbb=_0x19cbbb||0xc8;return function(_0x2bd78c){if(_0x2bd78c){return _0x39542f[_0x57bc('0x1c')](_0x19cbbb)['json'](_0x2bd78c);}};}function respondWithFilteredResult(_0x57d9cd,_0x55a98d){return function(_0x5e6c1c){if(_0x5e6c1c){var _0x8a2a6=_0x5e6c1c[_0x57bc('0x1d')],_0x80f8f4=_0x55a98d[_0x57bc('0x1e')],_0x1b64c3=_0x55a98d[_0x57bc('0x1e')]+_0x55a98d[_0x57bc('0x1f')],_0x19b0cf;if(_0x1b64c3>=_0x8a2a6){_0x1b64c3=_0x8a2a6;_0x19b0cf=0xc8;}else{_0x19b0cf=0xce;}_0x57d9cd[_0x57bc('0x1c')](_0x19b0cf);return _0x57d9cd['set'](_0x57bc('0x20'),_0x80f8f4+'-'+_0x1b64c3+'/'+_0x8a2a6)[_0x57bc('0x21')](_0x5e6c1c);}return null;};}function patchUpdates(_0x3f3b89){return function(_0x2e1346){try{jsonpatch[_0x57bc('0x22')](_0x2e1346,_0x3f3b89,!![]);}catch(_0x45bba9){return BPromise[_0x57bc('0x23')](_0x45bba9);}return _0x2e1346[_0x57bc('0x24')]();};}function saveUpdates(_0x236323,_0x4f06d8){return function(_0xc87bcc){if(_0xc87bcc){return _0xc87bcc[_0x57bc('0x25')](_0x236323)[_0x57bc('0x26')](function(_0x62b164){return _0x62b164;});}return null;};}function removeEntity(_0x3d0280,_0x867817){return function(_0xe32157){if(_0xe32157){return _0xe32157[_0x57bc('0x27')]()[_0x57bc('0x26')](function(){_0x3d0280['status'](0xcc)[_0x57bc('0x1b')]();});}};}function handleEntityNotFound(_0x321b86,_0x6a5163){return function(_0xa04e38){if(!_0xa04e38){_0x321b86[_0x57bc('0x1a')](0x194);}return _0xa04e38;};}function handleError(_0x454cf7,_0x247805){_0x247805=_0x247805||0x1f4;return function(_0x4b2ca1){logger[_0x57bc('0x28')](_0x4b2ca1[_0x57bc('0x29')]);if(_0x4b2ca1[_0x57bc('0x2a')]){delete _0x4b2ca1[_0x57bc('0x2a')];}_0x454cf7[_0x57bc('0x1c')](_0x247805)['send'](_0x4b2ca1);};}exports[_0x57bc('0x2b')]=function(_0x57ae6d,_0x54a080){var _0x15725b={},_0x4defa6={},_0x510820={'count':0x0,'rows':[]};var _0x2602d9=_[_0x57bc('0x2c')](db[_0x57bc('0x2d')][_0x57bc('0x2e')],function(_0x3091eb){return{'name':_0x3091eb[_0x57bc('0x2f')],'type':_0x3091eb[_0x57bc('0x30')][_0x57bc('0x31')]};});_0x4defa6[_0x57bc('0x32')]=_['map'](_0x2602d9,'name');_0x4defa6[_0x57bc('0x33')]=_[_0x57bc('0x34')](_0x57ae6d[_0x57bc('0x33')]);_0x4defa6[_0x57bc('0x35')]=_[_0x57bc('0x36')](_0x4defa6['model'],_0x4defa6[_0x57bc('0x33')]);_0x15725b['attributes']=_[_0x57bc('0x36')](_0x4defa6[_0x57bc('0x32')],qs['fields'](_0x57ae6d[_0x57bc('0x33')][_0x57bc('0x37')]));_0x15725b['attributes']=_0x15725b[_0x57bc('0x38')][_0x57bc('0x39')]?_0x15725b[_0x57bc('0x38')]:_0x4defa6[_0x57bc('0x32')];if(!_0x57ae6d[_0x57bc('0x33')][_0x57bc('0x3a')](_0x57bc('0x3b'))){_0x15725b[_0x57bc('0x1f')]=qs['limit'](_0x57ae6d[_0x57bc('0x33')]['limit']);_0x15725b[_0x57bc('0x1e')]=qs[_0x57bc('0x1e')](_0x57ae6d[_0x57bc('0x33')][_0x57bc('0x1e')]);}_0x15725b['order']=qs[_0x57bc('0x3c')](_0x57ae6d['query'][_0x57bc('0x3c')]);_0x15725b[_0x57bc('0x3d')]=qs[_0x57bc('0x35')](_[_0x57bc('0x3e')](_0x57ae6d[_0x57bc('0x33')],_0x4defa6[_0x57bc('0x35')]));if(_0x57ae6d['query']['filter']){_0x15725b[_0x57bc('0x3d')]=_[_0x57bc('0x3f')](_0x15725b[_0x57bc('0x3d')],{'$or':_[_0x57bc('0x2c')](_0x2602d9,function(_0x28bd7a){if(_0x28bd7a[_0x57bc('0x30')]!=='VIRTUAL'){var _0x58dd4e={};_0x58dd4e[_0x28bd7a['name']]={'$like':'%'+_0x57ae6d[_0x57bc('0x33')][_0x57bc('0x40')]+'%'};return _0x58dd4e;}})});}_0x15725b=_[_0x57bc('0x3f')]({},_0x15725b,_0x57ae6d[_0x57bc('0x41')]);var _0x30e3dd={'where':_0x15725b['where']};return db[_0x57bc('0x2d')][_0x57bc('0x1d')](_0x30e3dd)[_0x57bc('0x26')](function(_0x5f010f){_0x510820[_0x57bc('0x1d')]=_0x5f010f;if(_0x57ae6d['query'][_0x57bc('0x42')]){_0x15725b[_0x57bc('0x43')]=[{'all':!![]}];}return db[_0x57bc('0x2d')]['findAll'](_0x15725b);})[_0x57bc('0x26')](function(_0x27ae20){_0x510820[_0x57bc('0x44')]=_0x27ae20;return _0x510820;})['then'](respondWithFilteredResult(_0x54a080,_0x15725b))[_0x57bc('0x45')](handleError(_0x54a080,null));};exports[_0x57bc('0x46')]=function(_0x76646a,_0x21432a){var _0x2ea8a5={'raw':!![],'where':{'id':_0x76646a[_0x57bc('0x47')]['id']}},_0x5b9211={};_0x5b9211[_0x57bc('0x32')]=_[_0x57bc('0x34')](db[_0x57bc('0x2d')][_0x57bc('0x2e')]);_0x5b9211[_0x57bc('0x33')]=_[_0x57bc('0x34')](_0x76646a['query']);_0x5b9211[_0x57bc('0x35')]=_['intersection'](_0x5b9211['model'],_0x5b9211[_0x57bc('0x33')]);_0x2ea8a5[_0x57bc('0x38')]=_['intersection'](_0x5b9211[_0x57bc('0x32')],qs[_0x57bc('0x37')](_0x76646a[_0x57bc('0x33')][_0x57bc('0x37')]));_0x2ea8a5[_0x57bc('0x38')]=_0x2ea8a5[_0x57bc('0x38')][_0x57bc('0x39')]?_0x2ea8a5[_0x57bc('0x38')]:_0x5b9211[_0x57bc('0x32')];if(_0x76646a[_0x57bc('0x33')]['includeAll']){_0x2ea8a5[_0x57bc('0x43')]=[{'all':!![]}];}_0x2ea8a5=_[_0x57bc('0x3f')]({},_0x2ea8a5,_0x76646a[_0x57bc('0x41')]);return db[_0x57bc('0x2d')][_0x57bc('0x48')](_0x2ea8a5)['then'](handleEntityNotFound(_0x21432a,null))['then'](respondWithResult(_0x21432a,null))[_0x57bc('0x45')](handleError(_0x21432a,null));};exports[_0x57bc('0x49')]=function(_0x3dabbe,_0x4dbfae){return db[_0x57bc('0x2d')]['create'](_0x3dabbe[_0x57bc('0x4a')],{})[_0x57bc('0x26')](respondWithResult(_0x4dbfae,0xc9))['catch'](handleError(_0x4dbfae,null));};exports['update']=function(_0x1dd4bc,_0x23ae26){if(_0x1dd4bc['body']['id']){delete _0x1dd4bc[_0x57bc('0x4a')]['id'];}return db[_0x57bc('0x2d')][_0x57bc('0x48')]({'where':{'id':_0x1dd4bc['params']['id']}})[_0x57bc('0x26')](handleEntityNotFound(_0x23ae26,null))['then'](saveUpdates(_0x1dd4bc[_0x57bc('0x4a')],null))[_0x57bc('0x26')](respondWithResult(_0x23ae26,null))[_0x57bc('0x45')](handleError(_0x23ae26,null));};exports[_0x57bc('0x27')]=function(_0x496e24,_0xa85c43){return db[_0x57bc('0x2d')][_0x57bc('0x48')]({'where':{'id':_0x496e24[_0x57bc('0x47')]['id']}})[_0x57bc('0x26')](handleEntityNotFound(_0xa85c43,null))[_0x57bc('0x26')](removeEntity(_0xa85c43,null))['catch'](handleError(_0xa85c43,null));};exports['describe']=function(_0x11a2e9,_0x88b377){return db['SmsTransferReport'][_0x57bc('0x4b')]()[_0x57bc('0x26')](respondWithResult(_0x88b377,null))[_0x57bc('0x45')](handleError(_0x88b377,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index e913998..9a34d74 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 _0xd8fb=['exports','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','path','rimraf','./smsTransferReport.attributes'];(function(_0x2411f8,_0x19dbfe){var _0x175ff3=function(_0x2cb468){while(--_0x2cb468){_0x2411f8['push'](_0x2411f8['shift']());}};_0x175ff3(++_0x19dbfe);}(_0xd8fb,0x99));var _0xbd8f=function(_0x2f63c6,_0x59f4cc){_0x2f63c6=_0x2f63c6-0x0;var _0x2bdef0=_0xd8fb[_0x2f63c6];return _0x2bdef0;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xbd8f('0x9'),'fields':[_0xbd8f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa46e=['path','../../config/environment','exports','define','report_sms_transfer','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x3111a7,_0x5cca48){var _0x1ac4c8=function(_0x336907){while(--_0x336907){_0x3111a7['push'](_0x3111a7['shift']());}};_0x1ac4c8(++_0x5cca48);}(_0xa46e,0x8a));var _0xea46=function(_0x5678b5,_0x1c4aa8){_0x5678b5=_0x5678b5-0x0;var _0x4c09a5=_0xa46e[_0x5678b5];return _0x4c09a5;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('SmsTransferReport',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[{'name':_0xea46('0xa'),'fields':[_0xea46('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 27defdd..2c17c24 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 _0xa965=['code','message','result','catch','util','bluebird','randomstring','../../config/utils','../../config/environment','client','http','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x46d4eb,_0x25dcaa){var _0x494660=function(_0x6c0917){while(--_0x6c0917){_0x46d4eb['push'](_0x46d4eb['shift']());}};_0x494660(++_0x25dcaa);}(_0xa965,0xa6));var _0x5a96=function(_0x2ffc46,_0x35ce3c){_0x2ffc46=_0x2ffc46-0x0;var _0x1eda8f=_0xa965[_0x2ffc46];return _0x1eda8f;};'use strict';var _=require('lodash');var util=require(_0x5a96('0x0'));var moment=require('moment');var BPromise=require(_0x5a96('0x1'));var rs=require(_0x5a96('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5a96('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x5a96('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x5a96('0x5')][_0x5a96('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1cc147,_0x2c7602,_0x49bbd3){return new BPromise(function(_0x987e18,_0xd14117){return client['request'](_0x1cc147,_0x49bbd3)['then'](function(_0x2db4a4){logger[_0x5a96('0x7')](_0x5a96('0x8'),_0x2c7602,_0x5a96('0x9'));logger[_0x5a96('0xa')](_0x5a96('0xb'),_0x2c7602,_0x5a96('0x9'),JSON[_0x5a96('0xc')](_0x2db4a4));if(_0x2db4a4[_0x5a96('0xd')]){if(_0x2db4a4[_0x5a96('0xd')][_0x5a96('0xe')]===0x1f4){logger[_0x5a96('0xd')](_0x5a96('0x8'),_0x2c7602,_0x2db4a4[_0x5a96('0xd')][_0x5a96('0xf')]);return _0xd14117(_0x2db4a4[_0x5a96('0xd')]['message']);}logger['error'](_0x5a96('0x8'),_0x2c7602,_0x2db4a4['error'][_0x5a96('0xf')]);return _0x987e18(_0x2db4a4[_0x5a96('0xd')][_0x5a96('0xf')]);}else{logger[_0x5a96('0x7')](_0x5a96('0x8'),_0x2c7602,_0x5a96('0x9'));_0x987e18(_0x2db4a4[_0x5a96('0x10')][_0x5a96('0xf')]);}})[_0x5a96('0x11')](function(_0x165a4a){logger[_0x5a96('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x2c7602,_0x165a4a);_0xd14117(_0x165a4a);});});} \ No newline at end of file +var _0xd716=['jayson/promise','http','then','info','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','SmsTransferReport,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xd716,0x84));var _0x6d71=function(_0x30a193,_0x158ad6){_0x30a193=_0x30a193-0x0;var _0x5d6ccd=_0xd716[_0x30a193];return _0x5d6ccd;};'use strict';var _=require('lodash');var util=require(_0x6d71('0x0'));var moment=require(_0x6d71('0x1'));var BPromise=require(_0x6d71('0x2'));var rs=require(_0x6d71('0x3'));var fs=require('fs');var Redis=require(_0x6d71('0x4'));var db=require(_0x6d71('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d71('0x6'))(_0x6d71('0x7'));var config=require('../../config/environment');var jayson=require(_0x6d71('0x8'));var client=jayson['client'][_0x6d71('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e2163,_0x36ce15,_0x145d3d){return new BPromise(function(_0x41f221,_0x33bf00){return client['request'](_0x4e2163,_0x145d3d)[_0x6d71('0xa')](function(_0x195505){logger[_0x6d71('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x36ce15,_0x6d71('0xc'));logger['debug'](_0x6d71('0xd'),_0x36ce15,'request\x20sent',JSON['stringify'](_0x195505));if(_0x195505['error']){if(_0x195505[_0x6d71('0xe')][_0x6d71('0xf')]===0x1f4){logger[_0x6d71('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x36ce15,_0x195505[_0x6d71('0xe')][_0x6d71('0x10')]);return _0x33bf00(_0x195505[_0x6d71('0xe')][_0x6d71('0x10')]);}logger[_0x6d71('0xe')](_0x6d71('0x11'),_0x36ce15,_0x195505[_0x6d71('0xe')]['message']);return _0x41f221(_0x195505[_0x6d71('0xe')][_0x6d71('0x10')]);}else{logger['info'](_0x6d71('0x11'),_0x36ce15,_0x6d71('0xc'));_0x41f221(_0x195505[_0x6d71('0x12')][_0x6d71('0x10')]);}})[_0x6d71('0x13')](function(_0x276341){logger[_0x6d71('0xe')](_0x6d71('0x11'),_0x36ce15,_0x276341);_0x33bf00(_0x276341);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 053582c..851091b 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 _0xd2cf=['index','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','now','extname','post','single','file','create','put','/:id','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x2c4ceb,_0x5670bc){var _0x4652ff=function(_0x1992e7){while(--_0x1992e7){_0x2c4ceb['push'](_0x2c4ceb['shift']());}};_0x4652ff(++_0x5670bc);}(_0xd2cf,0xa4));var _0xfd2c=function(_0x1b1f88,_0x3fe1cb){_0x1b1f88=_0x1b1f88-0x0;var _0x5045b9=_0xd2cf[_0x1b1f88];return _0x5045b9;};'use strict';var multer=require(_0xfd2c('0x0'));var util=require(_0xfd2c('0x1'));var path=require(_0xfd2c('0x2'));var timeout=require(_0xfd2c('0x3'));var express=require(_0xfd2c('0x4'));var router=express[_0xfd2c('0x5')]();var auth=require(_0xfd2c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfd2c('0x7'));var controller=require('./sound.controller');router[_0xfd2c('0x8')]('/',auth[_0xfd2c('0x9')](),controller[_0xfd2c('0xa')]);router[_0xfd2c('0x8')]('/:id',auth[_0xfd2c('0x9')](),controller['show']);router[_0xfd2c('0x8')]('/:id/download',auth[_0xfd2c('0x9')](),controller[_0xfd2c('0xb')]);var upload=multer({'storage':multer[_0xfd2c('0xc')]({'destination':function(_0x1c07c6,_0x21e50d,_0x35bdc1){_0x35bdc1(null,path[_0xfd2c('0xd')](config[_0xfd2c('0xe')],_0xfd2c('0xf')));},'filename':function(_0x2bda3c,_0x28506f,_0x464bff){_0x28506f[_0xfd2c('0x10')]=_0x28506f[_0xfd2c('0x10')][_0xfd2c('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x464bff(null,util[_0xfd2c('0x12')](_0xfd2c('0x13'),path['basename'](_0x28506f['originalname'],path['extname'](_0x28506f[_0xfd2c('0x10')])),Date[_0xfd2c('0x14')](),path[_0xfd2c('0x15')](_0x28506f[_0xfd2c('0x10')])));}})});router[_0xfd2c('0x16')]('/',upload[_0xfd2c('0x17')](_0xfd2c('0x18')),controller[_0xfd2c('0x19')]);router[_0xfd2c('0x1a')](_0xfd2c('0x1b'),auth[_0xfd2c('0x9')](),controller['update']);router['delete'](_0xfd2c('0x1b'),auth[_0xfd2c('0x9')](),controller[_0xfd2c('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x2cf9=['format','basename','now','extname','post','single','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x2cf9,0x176));var _0x92cf=function(_0x234a15,_0x2758ce){_0x234a15=_0x234a15-0x0;var _0x39dcad=_0x2cf9[_0x234a15];return _0x39dcad;};'use strict';var multer=require(_0x92cf('0x0'));var util=require(_0x92cf('0x1'));var path=require(_0x92cf('0x2'));var timeout=require(_0x92cf('0x3'));var express=require(_0x92cf('0x4'));var router=express[_0x92cf('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x92cf('0x6'));var controller=require(_0x92cf('0x7'));router[_0x92cf('0x8')]('/',auth['isAuthenticated'](),controller[_0x92cf('0x9')]);router[_0x92cf('0x8')](_0x92cf('0xa'),auth[_0x92cf('0xb')](),controller['show']);router['get'](_0x92cf('0xc'),auth[_0x92cf('0xb')](),controller[_0x92cf('0xd')]);var upload=multer({'storage':multer[_0x92cf('0xe')]({'destination':function(_0x27b981,_0x3e965a,_0x36e291){_0x36e291(null,path[_0x92cf('0xf')](config['root'],_0x92cf('0x10')));},'filename':function(_0x315b09,_0x5e88d0,_0x2c0595){_0x5e88d0[_0x92cf('0x11')]=_0x5e88d0[_0x92cf('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c0595(null,util[_0x92cf('0x12')]('%s-%s%s',path[_0x92cf('0x13')](_0x5e88d0[_0x92cf('0x11')],path['extname'](_0x5e88d0[_0x92cf('0x11')])),Date[_0x92cf('0x14')](),path[_0x92cf('0x15')](_0x5e88d0[_0x92cf('0x11')])));}})});router[_0x92cf('0x16')]('/',upload[_0x92cf('0x17')]('file'),controller[_0x92cf('0x18')]);router['put'](_0x92cf('0xa'),auth['isAuthenticated'](),controller[_0x92cf('0x19')]);router['delete'](_0x92cf('0xa'),auth[_0x92cf('0xb')](),controller[_0x92cf('0x1a')]);module[_0x92cf('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index f676b4f..0bfc5af 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 _0xca8d=['STRING','name','FLOAT','INTEGER','BIGINT','sequelize'];(function(_0x290fa6,_0x16d017){var _0x47f1f3=function(_0x2b5eb8){while(--_0x2b5eb8){_0x290fa6['push'](_0x290fa6['shift']());}};_0x47f1f3(++_0x16d017);}(_0xca8d,0x143));var _0xdca8=function(_0xf83277,_0x55487e){_0xf83277=_0xf83277-0x0;var _0x361e0e=_0xca8d[_0xf83277];return _0x361e0e;};'use strict';var Sequelize=require(_0xdca8('0x0'));module['exports']={'name':{'type':Sequelize[_0xdca8('0x1')],'unique':_0xdca8('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xdca8('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xdca8('0x1')]},'original_format':{'type':Sequelize[_0xdca8('0x1')]},'original_duration':{'type':Sequelize[_0xdca8('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xdca8('0x4')]},'original_bitRate':{'type':Sequelize[_0xdca8('0x5')]},'original_sampleRate':{'type':Sequelize[_0xdca8('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xdca8('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xdca8('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x49ec=['FLOAT','BIGINT','INTEGER','STRING','name'];(function(_0x182094,_0x52bfb){var _0x54008e=function(_0x20cf24){while(--_0x20cf24){_0x182094['push'](_0x182094['shift']());}};_0x54008e(++_0x52bfb);}(_0x49ec,0x116));var _0xc49e=function(_0x17dffc,_0x40f6fb){_0x17dffc=_0x17dffc-0x0;var _0x16e8e4=_0x49ec[_0x17dffc];return _0x16e8e4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc49e('0x0')],'unique':_0xc49e('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xc49e('0x0')]},'display_name':{'type':Sequelize[_0xc49e('0x0')],'defaultValue':''},'description':{'type':Sequelize[_0xc49e('0x0')]},'original_format':{'type':Sequelize[_0xc49e('0x0')]},'original_duration':{'type':Sequelize[_0xc49e('0x2')]},'original_sampleCount':{'type':Sequelize[_0xc49e('0x3')]},'original_channelCount':{'type':Sequelize[_0xc49e('0x4')]},'original_bitRate':{'type':Sequelize[_0xc49e('0x3')]},'original_sampleRate':{'type':Sequelize[_0xc49e('0x4')]},'converted_format':{'type':Sequelize[_0xc49e('0x0')]},'converted_duration':{'type':Sequelize[_0xc49e('0x2')]},'converted_sampleCount':{'type':Sequelize[_0xc49e('0x3')]},'converted_channelCount':{'type':Sequelize[_0xc49e('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xc49e('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index c4dcde9..11b06d3 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 _0x6491=['index','map','Sound','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','include','rows','show','params','keys','find','catch','download','save_name','converted_format','existsSync','join','Sequelize','root','server/files/sounds/converted','format','create','basename','originalname','file','filename','extname','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_sampleCount','converted_channelCount','converted_bitRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','%s.%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','get','Sounds','UserProfileResource','error','stack','name','send'];(function(_0x9df81e,_0x4c5cc3){var _0xc97b53=function(_0x550a32){while(--_0x550a32){_0x9df81e['push'](_0x9df81e['shift']());}};_0xc97b53(++_0x4c5cc3);}(_0x6491,0xce));var _0x1649=function(_0xe861dc,_0x12c023){_0xe861dc=_0xe861dc-0x0;var _0x4ef977=_0x6491[_0xe861dc];return _0x4ef977;};'use strict';var pdf=require(_0x1649('0x0'));var emlformat=require(_0x1649('0x1'));var rimraf=require(_0x1649('0x2'));var zipdir=require(_0x1649('0x3'));var jsonpatch=require(_0x1649('0x4'));var rp=require(_0x1649('0x5'));var moment=require(_0x1649('0x6'));var BPromise=require(_0x1649('0x7'));var Mustache=require('mustache');var util=require(_0x1649('0x8'));var path=require(_0x1649('0x9'));var sox=require(_0x1649('0xa'));var csv=require(_0x1649('0xb'));var ejs=require(_0x1649('0xc'));var fs=require('fs');var _=require(_0x1649('0xd'));var squel=require(_0x1649('0xe'));var crypto=require('crypto');var jsforce=require(_0x1649('0xf'));var deskjs=require(_0x1649('0x10'));var toCsv=require(_0x1649('0xb'));var querystring=require('querystring');var Papa=require(_0x1649('0x11'));var Redis=require(_0x1649('0x12'));var authService=require(_0x1649('0x13'));var qs=require(_0x1649('0x14'));var as=require(_0x1649('0x15'));var hardwareService=require(_0x1649('0x16'));var logger=require(_0x1649('0x17'))(_0x1649('0x18'));var utils=require('../../config/utils');var config=require(_0x1649('0x19'));var db=require(_0x1649('0x1a'))['db'];function respondWithStatusCode(_0x4486ce,_0x26040f){_0x26040f=_0x26040f||0xcc;return function(_0x15b30a){if(_0x15b30a){return _0x4486ce[_0x1649('0x1b')](_0x26040f);}return _0x4486ce[_0x1649('0x1c')](_0x26040f)[_0x1649('0x1d')]();};}function respondWithResult(_0x234f82,_0x5bcd92){_0x5bcd92=_0x5bcd92||0xc8;return function(_0x59bbb9){if(_0x59bbb9){return _0x234f82[_0x1649('0x1c')](_0x5bcd92)[_0x1649('0x1e')](_0x59bbb9);}};}function respondWithFilteredResult(_0xb8d562,_0x29cbe1){return function(_0x5031eb){if(_0x5031eb){var _0x3c5070=_0x5031eb[_0x1649('0x1f')],_0x1e62ab=_0x29cbe1[_0x1649('0x20')],_0x1c1215=_0x29cbe1[_0x1649('0x20')]+_0x29cbe1[_0x1649('0x21')],_0x334306;if(_0x1c1215>=_0x3c5070){_0x1c1215=_0x3c5070;_0x334306=0xc8;}else{_0x334306=0xce;}_0xb8d562[_0x1649('0x1c')](_0x334306);return _0xb8d562[_0x1649('0x22')]('Content-Range',_0x1e62ab+'-'+_0x1c1215+'/'+_0x3c5070)[_0x1649('0x1e')](_0x5031eb);}return null;};}function patchUpdates(_0x27fb9f){return function(_0x4088cd){try{jsonpatch[_0x1649('0x23')](_0x4088cd,_0x27fb9f,!![]);}catch(_0x13ac01){return BPromise[_0x1649('0x24')](_0x13ac01);}return _0x4088cd[_0x1649('0x25')]();};}function saveUpdates(_0x16e7ec,_0x2dcc8c){return function(_0x2146a7){if(_0x2146a7){return _0x2146a7[_0x1649('0x26')](_0x16e7ec)['then'](function(_0x6b6e6a){return _0x6b6e6a;});}return null;};}function removeEntity(_0x2f56cf,_0x4392db){return function(_0x4f7653){if(_0x4f7653){return _0x4f7653[_0x1649('0x27')]()[_0x1649('0x28')](function(){var _0x363859=_0x4f7653[_0x1649('0x29')]({'plain':!![]});var _0x51da53=_0x1649('0x2a');return db[_0x1649('0x2b')][_0x1649('0x27')]({'where':{'type':_0x51da53,'resourceId':_0x363859['id']}})[_0x1649('0x28')](function(){return _0x4f7653;});})['then'](function(){_0x2f56cf[_0x1649('0x1c')](0xcc)[_0x1649('0x1d')]();});}};}function handleEntityNotFound(_0x26372a,_0x493e77){return function(_0xe81976){if(!_0xe81976){_0x26372a[_0x1649('0x1b')](0x194);}return _0xe81976;};}function handleError(_0x528fbe,_0x60c9ed){_0x60c9ed=_0x60c9ed||0x1f4;return function(_0x1462e){logger[_0x1649('0x2c')](_0x1462e[_0x1649('0x2d')]);if(_0x1462e['name']){delete _0x1462e[_0x1649('0x2e')];}_0x528fbe[_0x1649('0x1c')](_0x60c9ed)[_0x1649('0x2f')](_0x1462e);};}exports[_0x1649('0x30')]=function(_0x247ac7,_0x11fb7a){var _0x4b6c95={},_0x46961e={},_0x324178={'count':0x0,'rows':[]};var _0x2b0b40=_[_0x1649('0x31')](db[_0x1649('0x32')][_0x1649('0x33')],function(_0x21a4a5){return{'name':_0x21a4a5['fieldName'],'type':_0x21a4a5['type'][_0x1649('0x34')]};});_0x46961e[_0x1649('0x35')]=_[_0x1649('0x31')](_0x2b0b40,'name');_0x46961e[_0x1649('0x36')]=_['keys'](_0x247ac7[_0x1649('0x36')]);_0x46961e['filters']=_[_0x1649('0x37')](_0x46961e[_0x1649('0x35')],_0x46961e[_0x1649('0x36')]);_0x4b6c95[_0x1649('0x38')]=_[_0x1649('0x37')](_0x46961e[_0x1649('0x35')],qs[_0x1649('0x39')](_0x247ac7[_0x1649('0x36')][_0x1649('0x39')]));_0x4b6c95[_0x1649('0x38')]=_0x4b6c95[_0x1649('0x38')][_0x1649('0x3a')]?_0x4b6c95['attributes']:_0x46961e[_0x1649('0x35')];if(!_0x247ac7[_0x1649('0x36')][_0x1649('0x3b')](_0x1649('0x3c'))){_0x4b6c95[_0x1649('0x21')]=qs[_0x1649('0x21')](_0x247ac7['query'][_0x1649('0x21')]);_0x4b6c95[_0x1649('0x20')]=qs['offset'](_0x247ac7['query'][_0x1649('0x20')]);}_0x4b6c95[_0x1649('0x3d')]=qs[_0x1649('0x3e')](_0x247ac7[_0x1649('0x36')][_0x1649('0x3e')]);_0x4b6c95[_0x1649('0x3f')]=qs['filters'](_[_0x1649('0x40')](_0x247ac7['query'],_0x46961e[_0x1649('0x41')]));if(_0x247ac7['query'][_0x1649('0x42')]){_0x4b6c95[_0x1649('0x3f')]=_[_0x1649('0x43')](_0x4b6c95[_0x1649('0x3f')],{'$or':_['map'](_0x2b0b40,function(_0x98cefc){if(_0x98cefc[_0x1649('0x44')]!==_0x1649('0x45')){var _0x1db4c6={};_0x1db4c6[_0x98cefc[_0x1649('0x2e')]]={'$like':'%'+_0x247ac7[_0x1649('0x36')][_0x1649('0x42')]+'%'};return _0x1db4c6;}})});}_0x4b6c95=_['merge']({},_0x4b6c95,_0x247ac7[_0x1649('0x46')]);var _0x5c783e={'where':_0x4b6c95['where']};return db[_0x1649('0x32')][_0x1649('0x1f')](_0x5c783e)[_0x1649('0x28')](function(_0x23ff9a){_0x324178[_0x1649('0x1f')]=_0x23ff9a;if(_0x247ac7['query']['includeAll']){_0x4b6c95[_0x1649('0x47')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x4b6c95);})[_0x1649('0x28')](function(_0x129d1a){_0x324178[_0x1649('0x48')]=_0x129d1a;return _0x324178;})[_0x1649('0x28')](respondWithFilteredResult(_0x11fb7a,_0x4b6c95))['catch'](handleError(_0x11fb7a,null));};exports[_0x1649('0x49')]=function(_0x4fec96,_0x3d7384){var _0x39b339={'raw':!![],'where':{'id':_0x4fec96[_0x1649('0x4a')]['id']}},_0x566205={};_0x566205[_0x1649('0x35')]=_[_0x1649('0x4b')](db[_0x1649('0x32')][_0x1649('0x33')]);_0x566205[_0x1649('0x36')]=_[_0x1649('0x4b')](_0x4fec96[_0x1649('0x36')]);_0x566205[_0x1649('0x41')]=_[_0x1649('0x37')](_0x566205[_0x1649('0x35')],_0x566205[_0x1649('0x36')]);_0x39b339['attributes']=_[_0x1649('0x37')](_0x566205[_0x1649('0x35')],qs['fields'](_0x4fec96[_0x1649('0x36')][_0x1649('0x39')]));_0x39b339[_0x1649('0x38')]=_0x39b339[_0x1649('0x38')][_0x1649('0x3a')]?_0x39b339['attributes']:_0x566205[_0x1649('0x35')];if(_0x4fec96[_0x1649('0x36')]['includeAll']){_0x39b339[_0x1649('0x47')]=[{'all':!![]}];}_0x39b339=_[_0x1649('0x43')]({},_0x39b339,_0x4fec96[_0x1649('0x46')]);return db['Sound'][_0x1649('0x4c')](_0x39b339)[_0x1649('0x28')](handleEntityNotFound(_0x3d7384,null))['then'](respondWithResult(_0x3d7384,null))[_0x1649('0x4d')](handleError(_0x3d7384,null));};exports[_0x1649('0x4e')]=function(_0x548dcf,_0x3bc6af,_0x10f6e0){return db[_0x1649('0x32')][_0x1649('0x4c')]({'where':{'id':_0x548dcf['params']['id']},'attributes':[_0x1649('0x2e'),_0x1649('0x4f'),_0x1649('0x50')],'raw':!![]})[_0x1649('0x28')](handleEntityNotFound(_0x3bc6af,null))[_0x1649('0x28')](function(_0x323137){if(_0x323137){if(!fs[_0x1649('0x51')](path[_0x1649('0x52')](config['root'],'server/files/sounds/converted',_0x323137[_0x1649('0x4f')]+'.'+_0x323137[_0x1649('0x50')]))){throw new db[(_0x1649('0x53'))]['ValidationError']('Sound\x20not\x20found');}return _0x3bc6af[_0x1649('0x4e')](path[_0x1649('0x52')](config[_0x1649('0x54')],_0x1649('0x55'),util['format']('%s.%s',_0x323137[_0x1649('0x4f')],_0x323137['converted_format'])),util[_0x1649('0x56')]('%s.%s',_0x323137[_0x1649('0x2e')],_0x323137[_0x1649('0x50')]));}return null;})[_0x1649('0x4d')](handleError(_0x3bc6af,null));};exports[_0x1649('0x57')]=function(_0x33620a,_0x13254c,_0x551667){var _0x2cd5ae={'name':path[_0x1649('0x58')](_0x33620a['file'][_0x1649('0x59')],path['extname'](_0x33620a['file'][_0x1649('0x59')])),'save_name':path['basename'](_0x33620a[_0x1649('0x5a')]['filename'],path['extname'](_0x33620a['file'][_0x1649('0x5b')])),'original_format':path[_0x1649('0x5c')](_0x33620a['file'][_0x1649('0x59')])['substring'](0x1),'converted_format':_0x1649('0x5d')};var _0x1dd31e=path['join'](config[_0x1649('0x54')],_0x1649('0x5e'),_0x33620a[_0x1649('0x5a')]['filename']);var _0x550194=path[_0x1649('0x52')](config[_0x1649('0x54')],'server/files/sounds/converted',util[_0x1649('0x56')]('%s.%s',path[_0x1649('0x58')](_0x33620a[_0x1649('0x5a')][_0x1649('0x5b')],path[_0x1649('0x5c')](_0x33620a[_0x1649('0x5a')][_0x1649('0x5b')])),_0x2cd5ae[_0x1649('0x50')]));logger[_0x1649('0x5f')](_0x1649('0x60'),_0x1dd31e);logger[_0x1649('0x5f')](_0x1649('0x61'),_0x550194);try{fs[_0x1649('0x62')](_0x1dd31e,parseInt(_0x1649('0x63'),0x8));var _0x35c95f=sox['transcode'](_0x1dd31e,_0x550194,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x35c95f['on'](_0x1649('0x2c'),function(_0x3727a2){fs[_0x1649('0x64')](_0x1dd31e);_0x13254c[_0x1649('0x1c')](0x1f4)[_0x1649('0x2f')](_0x3727a2);});_0x35c95f['on'](_0x1649('0x65'),function(_0x559232){_0x2cd5ae[_0x1649('0x66')]=isNaN(_0x559232[_0x1649('0x67')])?null:_0x559232[_0x1649('0x67')]*0x3e8;_0x2cd5ae[_0x1649('0x68')]=isNaN(_0x559232[_0x1649('0x69')])?null:_0x559232['sampleCount'];_0x2cd5ae[_0x1649('0x6a')]=isNaN(_0x559232[_0x1649('0x6b')])?null:_0x559232[_0x1649('0x6b')];_0x2cd5ae[_0x1649('0x6c')]=isNaN(_0x559232[_0x1649('0x6d')])?null:_0x559232['bitRate'];_0x2cd5ae[_0x1649('0x6e')]=isNaN(_0x559232[_0x1649('0x6f')])?null:_0x559232[_0x1649('0x6f')];});_0x35c95f['on']('dest',function(_0xa7fa42){_0x2cd5ae['converted_duration']=isNaN(_0xa7fa42[_0x1649('0x67')])?null:_0xa7fa42[_0x1649('0x67')]*0x3e8;_0x2cd5ae[_0x1649('0x70')]=isNaN(_0xa7fa42[_0x1649('0x69')])?null:_0xa7fa42[_0x1649('0x69')];_0x2cd5ae[_0x1649('0x71')]=isNaN(_0xa7fa42['channelCount'])?null:_0xa7fa42[_0x1649('0x6b')];_0x2cd5ae[_0x1649('0x72')]=isNaN(_0xa7fa42['bitRate'])?null:_0xa7fa42[_0x1649('0x6d')];_0x2cd5ae['converted_sampleRate']=isNaN(_0xa7fa42[_0x1649('0x6f')])?null:_0xa7fa42['sampleRate'];});_0x35c95f['on']('end',function(){fs[_0x1649('0x62')](_0x550194,parseInt('0777',0x8));return db[_0x1649('0x32')]['create'](_0x2cd5ae)[_0x1649('0x28')](function(_0x318262){var _0x411b92={'role':_0x33620a[_0x1649('0x73')][_0x1649('0x74')],'userProfileId':_0x33620a[_0x1649('0x73')][_0x1649('0x75')]};if(!_0x411b92)throw new Error(_0x1649('0x76'));if(_0x411b92[_0x1649('0x74')]===_0x1649('0x77')){var _0x3fb2b9=_0x318262[_0x1649('0x29')]({'plain':!![]});return db[_0x1649('0x78')]['find']({'where':{'name':'Sounds','userProfileId':_0x411b92['userProfileId']},'raw':!![]})[_0x1649('0x28')](function(_0x2177d9){if(_0x2177d9&&_0x2177d9['autoAssociation']===0x0){return db[_0x1649('0x2b')]['create']({'name':_0x3fb2b9['name'],'resourceId':_0x3fb2b9['id'],'type':_0x2177d9[_0x1649('0x2e')],'sectionId':_0x2177d9['id']},{})[_0x1649('0x28')](function(){return _0x318262;});}else{return _0x318262;}})[_0x1649('0x4d')](function(_0x1cc2b7){logger[_0x1649('0x2c')](_0x1649('0x79'),_0x1cc2b7);throw _0x1cc2b7;});}return _0x318262;})[_0x1649('0x28')](respondWithResult(_0x13254c,null))[_0x1649('0x4d')](handleError(_0x13254c,null));});_0x35c95f[_0x1649('0x7a')]();}catch(_0x135f03){_0x13254c[_0x1649('0x1c')](0x1f4)[_0x1649('0x2f')](_0x135f03);}};exports[_0x1649('0x26')]=function(_0x2fd9ea,_0x3932da,_0x5bb6eb){return db[_0x1649('0x32')][_0x1649('0x4c')]({'where':{'id':_0x2fd9ea['params']['id']}})['then'](handleEntityNotFound(_0x3932da,null))[_0x1649('0x28')](saveUpdates(_[_0x1649('0x40')](_0x2fd9ea['body'],['name',_0x1649('0x7b')]),null))[_0x1649('0x28')](respondWithResult(_0x3932da,null))['catch'](handleError(_0x3932da,null));};exports[_0x1649('0x7c')]=function(_0x296ff5,_0x1721af,_0x5b1de8){return db[_0x1649('0x32')][_0x1649('0x4c')]({'where':{'id':_0x296ff5['params']['id']}})[_0x1649('0x28')](function(_0x4c2ca0){if(_0x4c2ca0){return _0x4c2ca0[_0x1649('0x27')]();}})[_0x1649('0x28')](function(_0x441ede){var _0x121084=path[_0x1649('0x52')](config[_0x1649('0x54')],'server/files/sounds/original',util[_0x1649('0x56')]('%s.%s',_0x441ede[_0x1649('0x4f')],_0x441ede[_0x1649('0x7d')]));var _0x39d2e7=path['join'](config[_0x1649('0x54')],_0x1649('0x55'),util['format'](_0x1649('0x7e'),_0x441ede[_0x1649('0x4f')],_0x441ede[_0x1649('0x50')]));fs[_0x1649('0x64')](_0x121084);fs[_0x1649('0x64')](_0x39d2e7);return _0x441ede;})['then'](function(_0x3be971){if(_0x3be971){return _0x1721af['status'](0xcc)[_0x1649('0x1d')]();}})[_0x1649('0x28')](handleEntityNotFound(_0x1721af,null))[_0x1649('0x4d')](handleError(_0x1721af,null));}; \ No newline at end of file +var _0x679b=['duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','params','description','save_name','original_format','zip-dir','fast-json-patch','bluebird','mustache','util','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','../../mysqldb','status','end','json','count','offset','limit','apply','reject','destroy','then','get','Sounds','UserProfileResource','sendStatus','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','length','download','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','root','format','%s.%s','catch','basename','originalname','filename','file','substring','wav','server/files/sounds/original','extname','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0x679b,0x195));var _0xb679=function(_0xad1117,_0x4f4a13){_0xad1117=_0xad1117-0x0;var _0x226f3e=_0x679b[_0xad1117];return _0x226f3e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb679('0x0'));var jsonpatch=require(_0xb679('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb679('0x2'));var Mustache=require(_0xb679('0x3'));var util=require(_0xb679('0x4'));var path=require(_0xb679('0x5'));var sox=require(_0xb679('0x6'));var csv=require(_0xb679('0x7'));var ejs=require(_0xb679('0x8'));var fs=require('fs');var _=require(_0xb679('0x9'));var squel=require(_0xb679('0xa'));var crypto=require(_0xb679('0xb'));var jsforce=require(_0xb679('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb679('0x7'));var querystring=require(_0xb679('0xd'));var Papa=require(_0xb679('0xe'));var Redis=require('ioredis');var authService=require(_0xb679('0xf'));var qs=require(_0xb679('0x10'));var as=require(_0xb679('0x11'));var hardwareService=require(_0xb679('0x12'));var logger=require(_0xb679('0x13'))(_0xb679('0x14'));var utils=require(_0xb679('0x15'));var config=require(_0xb679('0x16'));var db=require(_0xb679('0x17'))['db'];function respondWithStatusCode(_0x4a24f5,_0x5aded6){_0x5aded6=_0x5aded6||0xcc;return function(_0x21cb93){if(_0x21cb93){return _0x4a24f5['sendStatus'](_0x5aded6);}return _0x4a24f5[_0xb679('0x18')](_0x5aded6)[_0xb679('0x19')]();};}function respondWithResult(_0xe8c3b7,_0x4400b0){_0x4400b0=_0x4400b0||0xc8;return function(_0xec193f){if(_0xec193f){return _0xe8c3b7['status'](_0x4400b0)[_0xb679('0x1a')](_0xec193f);}};}function respondWithFilteredResult(_0x59b527,_0x57a134){return function(_0x5a383d){if(_0x5a383d){var _0x296819=_0x5a383d[_0xb679('0x1b')],_0x3d1743=_0x57a134[_0xb679('0x1c')],_0x489f54=_0x57a134['offset']+_0x57a134[_0xb679('0x1d')],_0x198fd7;if(_0x489f54>=_0x296819){_0x489f54=_0x296819;_0x198fd7=0xc8;}else{_0x198fd7=0xce;}_0x59b527[_0xb679('0x18')](_0x198fd7);return _0x59b527['set']('Content-Range',_0x3d1743+'-'+_0x489f54+'/'+_0x296819)[_0xb679('0x1a')](_0x5a383d);}return null;};}function patchUpdates(_0x5de35b){return function(_0x423f0d){try{jsonpatch[_0xb679('0x1e')](_0x423f0d,_0x5de35b,!![]);}catch(_0x4cafdc){return BPromise[_0xb679('0x1f')](_0x4cafdc);}return _0x423f0d['save']();};}function saveUpdates(_0x2edd06,_0x12545c){return function(_0x5a2721){if(_0x5a2721){return _0x5a2721['update'](_0x2edd06)['then'](function(_0x3c56e1){return _0x3c56e1;});}return null;};}function removeEntity(_0x5de8a7,_0x746857){return function(_0x5777cc){if(_0x5777cc){return _0x5777cc[_0xb679('0x20')]()[_0xb679('0x21')](function(){var _0x2d42c3=_0x5777cc[_0xb679('0x22')]({'plain':!![]});var _0xd4eb46=_0xb679('0x23');return db[_0xb679('0x24')][_0xb679('0x20')]({'where':{'type':_0xd4eb46,'resourceId':_0x2d42c3['id']}})[_0xb679('0x21')](function(){return _0x5777cc;});})[_0xb679('0x21')](function(){_0x5de8a7[_0xb679('0x18')](0xcc)[_0xb679('0x19')]();});}};}function handleEntityNotFound(_0x237314,_0x28d766){return function(_0x548b66){if(!_0x548b66){_0x237314[_0xb679('0x25')](0x194);}return _0x548b66;};}function handleError(_0x3ab93f,_0xd9cbaf){_0xd9cbaf=_0xd9cbaf||0x1f4;return function(_0x26d096){logger['error'](_0x26d096[_0xb679('0x26')]);if(_0x26d096[_0xb679('0x27')]){delete _0x26d096['name'];}_0x3ab93f[_0xb679('0x18')](_0xd9cbaf)[_0xb679('0x28')](_0x26d096);};}exports[_0xb679('0x29')]=function(_0x8df1a4,_0x2cd61f){var _0x5e4769={},_0x16ddc3={},_0x533578={'count':0x0,'rows':[]};var _0xac421b=_[_0xb679('0x2a')](db[_0xb679('0x2b')][_0xb679('0x2c')],function(_0xe80705){return{'name':_0xe80705[_0xb679('0x2d')],'type':_0xe80705[_0xb679('0x2e')][_0xb679('0x2f')]};});_0x16ddc3['model']=_[_0xb679('0x2a')](_0xac421b,_0xb679('0x27'));_0x16ddc3['query']=_[_0xb679('0x30')](_0x8df1a4[_0xb679('0x31')]);_0x16ddc3[_0xb679('0x32')]=_[_0xb679('0x33')](_0x16ddc3[_0xb679('0x34')],_0x16ddc3[_0xb679('0x31')]);_0x5e4769[_0xb679('0x35')]=_[_0xb679('0x33')](_0x16ddc3[_0xb679('0x34')],qs[_0xb679('0x36')](_0x8df1a4[_0xb679('0x31')]['fields']));_0x5e4769[_0xb679('0x35')]=_0x5e4769['attributes']['length']?_0x5e4769[_0xb679('0x35')]:_0x16ddc3['model'];if(!_0x8df1a4[_0xb679('0x31')]['hasOwnProperty'](_0xb679('0x37'))){_0x5e4769[_0xb679('0x1d')]=qs['limit'](_0x8df1a4[_0xb679('0x31')][_0xb679('0x1d')]);_0x5e4769[_0xb679('0x1c')]=qs[_0xb679('0x1c')](_0x8df1a4[_0xb679('0x31')][_0xb679('0x1c')]);}_0x5e4769['order']=qs[_0xb679('0x38')](_0x8df1a4[_0xb679('0x31')][_0xb679('0x38')]);_0x5e4769['where']=qs[_0xb679('0x32')](_[_0xb679('0x39')](_0x8df1a4['query'],_0x16ddc3[_0xb679('0x32')]));if(_0x8df1a4[_0xb679('0x31')][_0xb679('0x3a')]){_0x5e4769['where']=_[_0xb679('0x3b')](_0x5e4769[_0xb679('0x3c')],{'$or':_['map'](_0xac421b,function(_0x3547f8){if(_0x3547f8[_0xb679('0x2e')]!==_0xb679('0x3d')){var _0x51dd25={};_0x51dd25[_0x3547f8[_0xb679('0x27')]]={'$like':'%'+_0x8df1a4[_0xb679('0x31')]['filter']+'%'};return _0x51dd25;}})});}_0x5e4769=_['merge']({},_0x5e4769,_0x8df1a4[_0xb679('0x3e')]);var _0x1fa51b={'where':_0x5e4769[_0xb679('0x3c')]};return db[_0xb679('0x2b')]['count'](_0x1fa51b)[_0xb679('0x21')](function(_0x270e3b){_0x533578[_0xb679('0x1b')]=_0x270e3b;if(_0x8df1a4[_0xb679('0x31')][_0xb679('0x3f')]){_0x5e4769[_0xb679('0x40')]=[{'all':!![]}];}return db['Sound'][_0xb679('0x41')](_0x5e4769);})[_0xb679('0x21')](function(_0x13a898){_0x533578[_0xb679('0x42')]=_0x13a898;return _0x533578;})[_0xb679('0x21')](respondWithFilteredResult(_0x2cd61f,_0x5e4769))['catch'](handleError(_0x2cd61f,null));};exports['show']=function(_0x381b72,_0x49ea5f){var _0x286706={'raw':!![],'where':{'id':_0x381b72['params']['id']}},_0x410322={};_0x410322[_0xb679('0x34')]=_[_0xb679('0x30')](db[_0xb679('0x2b')]['rawAttributes']);_0x410322['query']=_[_0xb679('0x30')](_0x381b72[_0xb679('0x31')]);_0x410322[_0xb679('0x32')]=_['intersection'](_0x410322[_0xb679('0x34')],_0x410322[_0xb679('0x31')]);_0x286706[_0xb679('0x35')]=_[_0xb679('0x33')](_0x410322['model'],qs[_0xb679('0x36')](_0x381b72[_0xb679('0x31')][_0xb679('0x36')]));_0x286706['attributes']=_0x286706['attributes'][_0xb679('0x43')]?_0x286706[_0xb679('0x35')]:_0x410322[_0xb679('0x34')];if(_0x381b72[_0xb679('0x31')][_0xb679('0x3f')]){_0x286706[_0xb679('0x40')]=[{'all':!![]}];}_0x286706=_[_0xb679('0x3b')]({},_0x286706,_0x381b72[_0xb679('0x3e')]);return db[_0xb679('0x2b')]['find'](_0x286706)[_0xb679('0x21')](handleEntityNotFound(_0x49ea5f,null))[_0xb679('0x21')](respondWithResult(_0x49ea5f,null))['catch'](handleError(_0x49ea5f,null));};exports[_0xb679('0x44')]=function(_0x5bd1b8,_0x1c6989,_0x5113a7){return db[_0xb679('0x2b')]['find']({'where':{'id':_0x5bd1b8['params']['id']},'attributes':[_0xb679('0x27'),'save_name',_0xb679('0x45')],'raw':!![]})[_0xb679('0x21')](handleEntityNotFound(_0x1c6989,null))[_0xb679('0x21')](function(_0x2bd0b9){if(_0x2bd0b9){if(!fs[_0xb679('0x46')](path[_0xb679('0x47')](config['root'],_0xb679('0x48'),_0x2bd0b9['save_name']+'.'+_0x2bd0b9[_0xb679('0x45')]))){throw new db[(_0xb679('0x49'))]['ValidationError'](_0xb679('0x4a'));}return _0x1c6989[_0xb679('0x44')](path[_0xb679('0x47')](config[_0xb679('0x4b')],_0xb679('0x48'),util[_0xb679('0x4c')](_0xb679('0x4d'),_0x2bd0b9['save_name'],_0x2bd0b9['converted_format'])),util[_0xb679('0x4c')]('%s.%s',_0x2bd0b9['name'],_0x2bd0b9[_0xb679('0x45')]));}return null;})[_0xb679('0x4e')](handleError(_0x1c6989,null));};exports['create']=function(_0x5ba749,_0x4c04ed,_0x9529d9){var _0x17de35={'name':path[_0xb679('0x4f')](_0x5ba749['file'][_0xb679('0x50')],path['extname'](_0x5ba749['file'][_0xb679('0x50')])),'save_name':path[_0xb679('0x4f')](_0x5ba749['file'][_0xb679('0x51')],path['extname'](_0x5ba749[_0xb679('0x52')][_0xb679('0x51')])),'original_format':path['extname'](_0x5ba749[_0xb679('0x52')][_0xb679('0x50')])[_0xb679('0x53')](0x1),'converted_format':_0xb679('0x54')};var _0x5016f8=path[_0xb679('0x47')](config[_0xb679('0x4b')],_0xb679('0x55'),_0x5ba749[_0xb679('0x52')][_0xb679('0x51')]);var _0x1da5ee=path[_0xb679('0x47')](config[_0xb679('0x4b')],'server/files/sounds/converted',util[_0xb679('0x4c')]('%s.%s',path['basename'](_0x5ba749[_0xb679('0x52')][_0xb679('0x51')],path[_0xb679('0x56')](_0x5ba749[_0xb679('0x52')][_0xb679('0x51')])),_0x17de35[_0xb679('0x45')]));logger[_0xb679('0x57')](_0xb679('0x58'),_0x5016f8);logger['info'](_0xb679('0x59'),_0x1da5ee);try{fs[_0xb679('0x5a')](_0x5016f8,parseInt(_0xb679('0x5b'),0x8));var _0x61fbd5=sox[_0xb679('0x5c')](_0x5016f8,_0x1da5ee,{'sampleRate':0x1f40,'format':_0xb679('0x54'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x61fbd5['on']('error',function(_0x4d4536){fs[_0xb679('0x5d')](_0x5016f8);_0x4c04ed[_0xb679('0x18')](0x1f4)[_0xb679('0x28')](_0x4d4536);});_0x61fbd5['on'](_0xb679('0x5e'),function(_0x5157d7){_0x17de35['original_duration']=isNaN(_0x5157d7[_0xb679('0x5f')])?null:_0x5157d7[_0xb679('0x5f')]*0x3e8;_0x17de35[_0xb679('0x60')]=isNaN(_0x5157d7[_0xb679('0x61')])?null:_0x5157d7[_0xb679('0x61')];_0x17de35[_0xb679('0x62')]=isNaN(_0x5157d7[_0xb679('0x63')])?null:_0x5157d7[_0xb679('0x63')];_0x17de35[_0xb679('0x64')]=isNaN(_0x5157d7[_0xb679('0x65')])?null:_0x5157d7['bitRate'];_0x17de35[_0xb679('0x66')]=isNaN(_0x5157d7[_0xb679('0x67')])?null:_0x5157d7[_0xb679('0x67')];});_0x61fbd5['on'](_0xb679('0x68'),function(_0x4e12d2){_0x17de35['converted_duration']=isNaN(_0x4e12d2[_0xb679('0x5f')])?null:_0x4e12d2['duration']*0x3e8;_0x17de35[_0xb679('0x69')]=isNaN(_0x4e12d2[_0xb679('0x61')])?null:_0x4e12d2[_0xb679('0x61')];_0x17de35[_0xb679('0x6a')]=isNaN(_0x4e12d2[_0xb679('0x63')])?null:_0x4e12d2['channelCount'];_0x17de35[_0xb679('0x6b')]=isNaN(_0x4e12d2['bitRate'])?null:_0x4e12d2['bitRate'];_0x17de35[_0xb679('0x6c')]=isNaN(_0x4e12d2['sampleRate'])?null:_0x4e12d2['sampleRate'];});_0x61fbd5['on'](_0xb679('0x19'),function(){fs[_0xb679('0x5a')](_0x1da5ee,parseInt(_0xb679('0x5b'),0x8));return db[_0xb679('0x2b')]['create'](_0x17de35)['then'](function(_0x550acc){var _0x30aed8={'role':_0x5ba749['body']['role'],'userProfileId':_0x5ba749[_0xb679('0x6d')][_0xb679('0x6e')]};if(!_0x30aed8)throw new Error(_0xb679('0x6f'));if(_0x30aed8[_0xb679('0x70')]===_0xb679('0x71')){var _0x9bd100=_0x550acc[_0xb679('0x22')]({'plain':!![]});return db[_0xb679('0x72')][_0xb679('0x73')]({'where':{'name':'Sounds','userProfileId':_0x30aed8[_0xb679('0x6e')]},'raw':!![]})['then'](function(_0x1a69fa){if(_0x1a69fa&&_0x1a69fa[_0xb679('0x74')]===0x0){return db[_0xb679('0x24')]['create']({'name':_0x9bd100[_0xb679('0x27')],'resourceId':_0x9bd100['id'],'type':_0x1a69fa[_0xb679('0x27')],'sectionId':_0x1a69fa['id']},{})[_0xb679('0x21')](function(){return _0x550acc;});}else{return _0x550acc;}})[_0xb679('0x4e')](function(_0x3deec2){logger[_0xb679('0x75')](_0xb679('0x76'),_0x3deec2);throw _0x3deec2;});}return _0x550acc;})[_0xb679('0x21')](respondWithResult(_0x4c04ed,null))[_0xb679('0x4e')](handleError(_0x4c04ed,null));});_0x61fbd5[_0xb679('0x77')]();}catch(_0x55c12e){_0x4c04ed[_0xb679('0x18')](0x1f4)[_0xb679('0x28')](_0x55c12e);}};exports[_0xb679('0x78')]=function(_0x1ad268,_0x144fc2,_0x1d9535){return db['Sound'][_0xb679('0x73')]({'where':{'id':_0x1ad268[_0xb679('0x79')]['id']}})[_0xb679('0x21')](handleEntityNotFound(_0x144fc2,null))[_0xb679('0x21')](saveUpdates(_[_0xb679('0x39')](_0x1ad268[_0xb679('0x6d')],[_0xb679('0x27'),_0xb679('0x7a')]),null))[_0xb679('0x21')](respondWithResult(_0x144fc2,null))['catch'](handleError(_0x144fc2,null));};exports['delete']=function(_0x428235,_0x322278,_0x3efd13){return db[_0xb679('0x2b')][_0xb679('0x73')]({'where':{'id':_0x428235['params']['id']}})[_0xb679('0x21')](function(_0x38598b){if(_0x38598b){return _0x38598b[_0xb679('0x20')]();}})['then'](function(_0x44d266){var _0x26cb3e=path[_0xb679('0x47')](config['root'],'server/files/sounds/original',util['format'](_0xb679('0x4d'),_0x44d266[_0xb679('0x7b')],_0x44d266[_0xb679('0x7c')]));var _0x1b95f8=path[_0xb679('0x47')](config['root'],_0xb679('0x48'),util[_0xb679('0x4c')](_0xb679('0x4d'),_0x44d266[_0xb679('0x7b')],_0x44d266[_0xb679('0x45')]));fs[_0xb679('0x5d')](_0x26cb3e);fs['unlinkSync'](_0x1b95f8);return _0x44d266;})[_0xb679('0x21')](function(_0x503ee5){if(_0x503ee5){return _0x322278['status'](0xcc)['end']();}})['then'](handleEntityNotFound(_0x322278,null))['catch'](handleError(_0x322278,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index c576114..36a16f7 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 _0xa5c0=['define','Sound','tools_sounds','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./sound.attributes','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa5c0,0x162));var _0x0a5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5c0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0a5c('0x0'));var util=require(_0x0a5c('0x1'));var logger=require(_0x0a5c('0x2'))(_0x0a5c('0x3'));var moment=require('moment');var BPromise=require(_0x0a5c('0x4'));var rp=require(_0x0a5c('0x5'));var fs=require('fs');var path=require(_0x0a5c('0x6'));var rimraf=require(_0x0a5c('0x7'));var config=require('../../config/environment');var attributes=require(_0x0a5c('0x8'));module[_0x0a5c('0x9')]=function(_0x4b0ee2,_0x1c8cb0){return _0x4b0ee2[_0x0a5c('0xa')](_0x0a5c('0xb'),attributes,{'tableName':_0x0a5c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac52=['Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./sound.attributes','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xac52,0x188));var _0x2ac5=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0xac52[_0x1ca9e9];return _0x309f3c;};'use strict';var _=require(_0x2ac5('0x0'));var util=require(_0x2ac5('0x1'));var logger=require(_0x2ac5('0x2'))(_0x2ac5('0x3'));var moment=require(_0x2ac5('0x4'));var BPromise=require(_0x2ac5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ac5('0x6'));var rimraf=require(_0x2ac5('0x7'));var config=require('../../config/environment');var attributes=require(_0x2ac5('0x8'));module[_0x2ac5('0x9')]=function(_0x63e150,_0x75cd78){return _0x63e150[_0x2ac5('0xa')](_0x2ac5('0xb'),attributes,{'tableName':_0x2ac5('0xc'),'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 a63883e..1968b49 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 _0xe43a=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','info','result','catch','ShowSound','Sound','find','options','raw','map','include','attributes','model','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x2cd99d,_0x22238c){var _0x47acbd=function(_0x2bcb41){while(--_0x2bcb41){_0x2cd99d['push'](_0x2cd99d['shift']());}};_0x47acbd(++_0x22238c);}(_0xe43a,0x1b4));var _0xae43=function(_0x3daff2,_0x1a67f7){_0x3daff2=_0x3daff2-0x0;var _0x12c11d=_0xe43a[_0x3daff2];return _0x12c11d;};'use strict';var _=require(_0xae43('0x0'));var util=require(_0xae43('0x1'));var moment=require('moment');var BPromise=require(_0xae43('0x2'));var rs=require(_0xae43('0x3'));var fs=require('fs');var Redis=require(_0xae43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xae43('0x5'));var logger=require(_0xae43('0x6'))(_0xae43('0x7'));var config=require('../../config/environment');var jayson=require(_0xae43('0x8'));var client=jayson['client'][_0xae43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4730c5,_0x12ae72,_0x239799){return new BPromise(function(_0x3c3d1e,_0x1c76ab){return client[_0xae43('0xa')](_0x4730c5,_0x239799)[_0xae43('0xb')](function(_0x6dc778){logger['info']('Sound,\x20%s,\x20%s',_0x12ae72,_0xae43('0xc'));logger[_0xae43('0xd')](_0xae43('0xe'),_0x12ae72,'request\x20sent',JSON[_0xae43('0xf')](_0x6dc778));if(_0x6dc778['error']){if(_0x6dc778[_0xae43('0x10')][_0xae43('0x11')]===0x1f4){logger[_0xae43('0x10')](_0xae43('0x12'),_0x12ae72,_0x6dc778[_0xae43('0x10')][_0xae43('0x13')]);return _0x1c76ab(_0x6dc778[_0xae43('0x10')]['message']);}logger[_0xae43('0x10')](_0xae43('0x12'),_0x12ae72,_0x6dc778['error']['message']);return _0x3c3d1e(_0x6dc778[_0xae43('0x10')]['message']);}else{logger[_0xae43('0x14')](_0xae43('0x12'),_0x12ae72,'request\x20sent');_0x3c3d1e(_0x6dc778[_0xae43('0x15')][_0xae43('0x13')]);}})[_0xae43('0x16')](function(_0x15269d){logger[_0xae43('0x10')](_0xae43('0x12'),_0x12ae72,_0x15269d);_0x1c76ab(_0x15269d);});});}exports[_0xae43('0x17')]=function(_0x24a074){var _0x11738f=this;return new Promise(function(_0x2011dc,_0x5aca4c){return db[_0xae43('0x18')][_0xae43('0x19')]({'raw':_0x24a074[_0xae43('0x1a')]?_0x24a074[_0xae43('0x1a')][_0xae43('0x1b')]===undefined?!![]:![]:!![],'where':_0x24a074[_0xae43('0x1a')]?_0x24a074[_0xae43('0x1a')]['where']||null:null,'attributes':_0x24a074['options']?_0x24a074[_0xae43('0x1a')]['attributes']||null:null,'include':_0x24a074[_0xae43('0x1a')]?_0x24a074[_0xae43('0x1a')]['include']?_[_0xae43('0x1c')](_0x24a074['options'][_0xae43('0x1d')],function(_0x1ec412){return{'model':db[_0x1ec412['model']],'as':_0x1ec412['as'],'attributes':_0x1ec412[_0xae43('0x1e')],'include':_0x1ec412[_0xae43('0x1d')]?_[_0xae43('0x1c')](_0x1ec412[_0xae43('0x1d')],function(_0x2fa1ec){return{'model':db[_0x2fa1ec[_0xae43('0x1f')]],'as':_0x2fa1ec['as'],'attributes':_0x2fa1ec[_0xae43('0x1e')],'include':_0x2fa1ec['include']?_[_0xae43('0x1c')](_0x2fa1ec['include'],function(_0x7b603e){return{'model':db[_0x7b603e[_0xae43('0x1f')]],'as':_0x7b603e['as'],'attributes':_0x7b603e[_0xae43('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xae43('0xb')](function(_0x5a05e1){logger['info'](_0xae43('0x17'),_0x24a074);logger[_0xae43('0xd')](_0xae43('0x17'),_0x24a074,JSON['stringify'](_0x5a05e1));_0x2011dc(_0x5a05e1);})['catch'](function(_0x3a2674){logger['error'](_0xae43('0x17'),_0x3a2674[_0xae43('0x13')],_0x24a074);_0x5aca4c(_0x11738f[_0xae43('0x10')](0x1f4,_0x3a2674[_0xae43('0x13')]));});});}; \ No newline at end of file +var _0x082a=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Sound','options','raw','where','attributes','include','map','model','ShowSound','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1fc211,_0x364ed6){var _0xdbc2fa=function(_0xb2b2f8){while(--_0xb2b2f8){_0x1fc211['push'](_0x1fc211['shift']());}};_0xdbc2fa(++_0x364ed6);}(_0x082a,0x1d5));var _0xa082=function(_0xf8f952,_0x3745e3){_0xf8f952=_0xf8f952-0x0;var _0x59104a=_0x082a[_0xf8f952];return _0x59104a;};'use strict';var _=require(_0xa082('0x0'));var util=require(_0xa082('0x1'));var moment=require(_0xa082('0x2'));var BPromise=require(_0xa082('0x3'));var rs=require(_0xa082('0x4'));var fs=require('fs');var Redis=require(_0xa082('0x5'));var db=require(_0xa082('0x6'))['db'];var utils=require(_0xa082('0x7'));var logger=require(_0xa082('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa082('0x9'));var client=jayson[_0xa082('0xa')][_0xa082('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d174b,_0x1ed543,_0x4ef5f7){return new BPromise(function(_0x4105eb,_0x487d9f){return client[_0xa082('0xc')](_0x5d174b,_0x4ef5f7)[_0xa082('0xd')](function(_0x5a46b2){logger[_0xa082('0xe')](_0xa082('0xf'),_0x1ed543,_0xa082('0x10'));logger[_0xa082('0x11')](_0xa082('0x12'),_0x1ed543,_0xa082('0x10'),JSON[_0xa082('0x13')](_0x5a46b2));if(_0x5a46b2[_0xa082('0x14')]){if(_0x5a46b2['error'][_0xa082('0x15')]===0x1f4){logger['error'](_0xa082('0xf'),_0x1ed543,_0x5a46b2[_0xa082('0x14')][_0xa082('0x16')]);return _0x487d9f(_0x5a46b2[_0xa082('0x14')][_0xa082('0x16')]);}logger[_0xa082('0x14')](_0xa082('0xf'),_0x1ed543,_0x5a46b2[_0xa082('0x14')][_0xa082('0x16')]);return _0x4105eb(_0x5a46b2[_0xa082('0x14')][_0xa082('0x16')]);}else{logger[_0xa082('0xe')]('Sound,\x20%s,\x20%s',_0x1ed543,_0xa082('0x10'));_0x4105eb(_0x5a46b2[_0xa082('0x17')]['message']);}})[_0xa082('0x18')](function(_0x132bf4){logger[_0xa082('0x14')](_0xa082('0xf'),_0x1ed543,_0x132bf4);_0x487d9f(_0x132bf4);});});}exports['ShowSound']=function(_0x589fea){var _0x1bb130=this;return new Promise(function(_0x2ccec3,_0x16c5f8){return db[_0xa082('0x19')]['find']({'raw':_0x589fea[_0xa082('0x1a')]?_0x589fea[_0xa082('0x1a')][_0xa082('0x1b')]===undefined?!![]:![]:!![],'where':_0x589fea[_0xa082('0x1a')]?_0x589fea[_0xa082('0x1a')][_0xa082('0x1c')]||null:null,'attributes':_0x589fea[_0xa082('0x1a')]?_0x589fea[_0xa082('0x1a')][_0xa082('0x1d')]||null:null,'include':_0x589fea[_0xa082('0x1a')]?_0x589fea['options'][_0xa082('0x1e')]?_[_0xa082('0x1f')](_0x589fea[_0xa082('0x1a')]['include'],function(_0x390c81){return{'model':db[_0x390c81['model']],'as':_0x390c81['as'],'attributes':_0x390c81[_0xa082('0x1d')],'include':_0x390c81[_0xa082('0x1e')]?_[_0xa082('0x1f')](_0x390c81['include'],function(_0x2658e2){return{'model':db[_0x2658e2['model']],'as':_0x2658e2['as'],'attributes':_0x2658e2[_0xa082('0x1d')],'include':_0x2658e2['include']?_[_0xa082('0x1f')](_0x2658e2['include'],function(_0x4cac21){return{'model':db[_0x4cac21[_0xa082('0x20')]],'as':_0x4cac21['as'],'attributes':_0x4cac21[_0xa082('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa082('0xd')](function(_0x5bfdbe){logger['info']('ShowSound',_0x589fea);logger[_0xa082('0x11')]('ShowSound',_0x589fea,JSON['stringify'](_0x5bfdbe));_0x2ccec3(_0x5bfdbe);})['catch'](function(_0x298c39){logger['error'](_0xa082('0x21'),_0x298c39[_0xa082('0x16')],_0x589fea);_0x16c5f8(_0x1bb130[_0xa082('0x14')](0x1f4,_0x298c39[_0xa082('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 76055a5..c0f7345 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 _0x6428=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','/:id','show','create','put','update','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6428,0xe7));var _0x8642=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x6428[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x8642('0x0'));var util=require(_0x8642('0x1'));var path=require(_0x8642('0x2'));var timeout=require(_0x8642('0x3'));var express=require(_0x8642('0x4'));var router=express['Router']();var auth=require(_0x8642('0x5'));var interaction=require(_0x8642('0x6'));var config=require(_0x8642('0x7'));var controller=require(_0x8642('0x8'));router[_0x8642('0x9')]('/',auth[_0x8642('0xa')](),controller['index']);router[_0x8642('0x9')](_0x8642('0xb'),auth['isAuthenticated'](),controller[_0x8642('0xc')]);router['post']('/',auth[_0x8642('0xa')](),controller[_0x8642('0xd')]);router[_0x8642('0xe')](_0x8642('0xb'),auth[_0x8642('0xa')](),controller[_0x8642('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8642('0x10')]);module[_0x8642('0x11')]=router; \ No newline at end of file +var _0xddd1=['./squareMessage.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x533658,_0x5152c7){var _0x4b7f5a=function(_0x2cec83){while(--_0x2cec83){_0x533658['push'](_0x533658['shift']());}};_0x4b7f5a(++_0x5152c7);}(_0xddd1,0xbf));var _0x1ddd=function(_0x66dea5,_0x4200c3){_0x66dea5=_0x66dea5-0x0;var _0x206420=_0xddd1[_0x66dea5];return _0x206420;};'use strict';var multer=require(_0x1ddd('0x0'));var util=require(_0x1ddd('0x1'));var path=require('path');var timeout=require(_0x1ddd('0x2'));var express=require(_0x1ddd('0x3'));var router=express[_0x1ddd('0x4')]();var auth=require(_0x1ddd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1ddd('0x6'));var controller=require(_0x1ddd('0x7'));router[_0x1ddd('0x8')]('/',auth[_0x1ddd('0x9')](),controller[_0x1ddd('0xa')]);router[_0x1ddd('0x8')](_0x1ddd('0xb'),auth[_0x1ddd('0x9')](),controller['show']);router[_0x1ddd('0xc')]('/',auth[_0x1ddd('0x9')](),controller['create']);router[_0x1ddd('0xd')](_0x1ddd('0xb'),auth[_0x1ddd('0x9')](),controller[_0x1ddd('0xe')]);router[_0x1ddd('0xf')]('/:id',auth[_0x1ddd('0x9')](),controller[_0x1ddd('0x10')]);module[_0x1ddd('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index a739863..9ec8cce 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 _0x0c82=['medium','ENUM','out','exports'];(function(_0x4de810,_0x52a7f8){var _0x4fb3ed=function(_0x5be9c0){while(--_0x5be9c0){_0x4de810['push'](_0x4de810['shift']());}};_0x4fb3ed(++_0x52a7f8);}(_0x0c82,0xfb));var _0x20c8=function(_0x28ae89,_0x17cdd4){_0x28ae89=_0x28ae89-0x0;var _0x24f0f5=_0x0c82[_0x28ae89];return _0x24f0f5;};'use strict';var Sequelize=require('sequelize');module[_0x20c8('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0x20c8('0x1')),'allowNull':![]},'direction':{'type':Sequelize[_0x20c8('0x2')]('in',_0x20c8('0x3')),'defaultValue':_0x20c8('0x3'),'allowNull':![]}}; \ No newline at end of file +var _0x1dff=['TEXT','ENUM','out','sequelize','STRING'];(function(_0x4996d5,_0x123daf){var _0x4793f9=function(_0x30c7ec){while(--_0x30c7ec){_0x4996d5['push'](_0x4996d5['shift']());}};_0x4793f9(++_0x123daf);}(_0x1dff,0x1ac));var _0xf1df=function(_0x104914,_0x49debf){_0x104914=_0x104914-0x0;var _0x2fb6f1=_0x1dff[_0x104914];return _0x2fb6f1;};'use strict';var Sequelize=require(_0xf1df('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xf1df('0x1')]},'body':{'type':Sequelize[_0xf1df('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xf1df('0x3')]('in','out'),'defaultValue':_0xf1df('0x4'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 2a0b145..015c811 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 _0x252f=['params','html-pdf','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','limit','order','sort','filters','filter','where','merge','VIRTUAL','SquareMessage','includeAll','findAll','rows','catch','include','find','create','body'];(function(_0x49fa65,_0x5bdf70){var _0x420f6b=function(_0x46b637){while(--_0x46b637){_0x49fa65['push'](_0x49fa65['shift']());}};_0x420f6b(++_0x5bdf70);}(_0x252f,0xd0));var _0xf252=function(_0xcbe787,_0x401e4c){_0xcbe787=_0xcbe787-0x0;var _0x4c78fa=_0x252f[_0xcbe787];return _0x4c78fa;};'use strict';var pdf=require(_0xf252('0x0'));var emlformat=require(_0xf252('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf252('0x2'));var rp=require(_0xf252('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf252('0x4'));var util=require(_0xf252('0x5'));var path=require(_0xf252('0x6'));var sox=require(_0xf252('0x7'));var csv=require(_0xf252('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf252('0x9'));var squel=require(_0xf252('0xa'));var crypto=require(_0xf252('0xb'));var jsforce=require(_0xf252('0xc'));var deskjs=require(_0xf252('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf252('0xe'));var Papa=require(_0xf252('0xf'));var Redis=require('ioredis');var authService=require(_0xf252('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf252('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf252('0x12'))(_0xf252('0x13'));var utils=require(_0xf252('0x14'));var config=require(_0xf252('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7d1cd5,_0xf54ee9){_0xf54ee9=_0xf54ee9||0xcc;return function(_0x2fc7d3){if(_0x2fc7d3){return _0x7d1cd5[_0xf252('0x16')](_0xf54ee9);}return _0x7d1cd5[_0xf252('0x17')](_0xf54ee9)[_0xf252('0x18')]();};}function respondWithResult(_0x591b7c,_0x36da86){_0x36da86=_0x36da86||0xc8;return function(_0x18fa76){if(_0x18fa76){return _0x591b7c[_0xf252('0x17')](_0x36da86)['json'](_0x18fa76);}};}function respondWithFilteredResult(_0x17fc05,_0xf7285f){return function(_0x33c420){if(_0x33c420){var _0x25affc=_0x33c420[_0xf252('0x19')],_0x486254=_0xf7285f[_0xf252('0x1a')],_0x1c5411=_0xf7285f[_0xf252('0x1a')]+_0xf7285f['limit'],_0x5421a0;if(_0x1c5411>=_0x25affc){_0x1c5411=_0x25affc;_0x5421a0=0xc8;}else{_0x5421a0=0xce;}_0x17fc05['status'](_0x5421a0);return _0x17fc05[_0xf252('0x1b')](_0xf252('0x1c'),_0x486254+'-'+_0x1c5411+'/'+_0x25affc)[_0xf252('0x1d')](_0x33c420);}return null;};}function patchUpdates(_0x4d8c67){return function(_0xaa6041){try{jsonpatch['apply'](_0xaa6041,_0x4d8c67,!![]);}catch(_0x5acc79){return BPromise[_0xf252('0x1e')](_0x5acc79);}return _0xaa6041[_0xf252('0x1f')]();};}function saveUpdates(_0x25a9a2,_0x2ab64c){return function(_0x4c86fb){if(_0x4c86fb){return _0x4c86fb[_0xf252('0x20')](_0x25a9a2)[_0xf252('0x21')](function(_0x33087c){return _0x33087c;});}return null;};}function removeEntity(_0x3df315,_0x574614){return function(_0x579022){if(_0x579022){return _0x579022[_0xf252('0x22')]()[_0xf252('0x21')](function(){_0x3df315[_0xf252('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18c14d,_0x2ba040){return function(_0x284dca){if(!_0x284dca){_0x18c14d['sendStatus'](0x194);}return _0x284dca;};}function handleError(_0x3d8fd2,_0x7848e8){_0x7848e8=_0x7848e8||0x1f4;return function(_0x16bb93){logger[_0xf252('0x23')](_0x16bb93[_0xf252('0x24')]);if(_0x16bb93[_0xf252('0x25')]){delete _0x16bb93['name'];}_0x3d8fd2[_0xf252('0x17')](_0x7848e8)[_0xf252('0x26')](_0x16bb93);};}exports[_0xf252('0x27')]=function(_0x28fa03,_0x18cef6){var _0x321dbc={},_0x147111={},_0x2bb2ff={'count':0x0,'rows':[]};var _0x11fdcb=_[_0xf252('0x28')](db['SquareMessage'][_0xf252('0x29')],function(_0x5aedad){return{'name':_0x5aedad['fieldName'],'type':_0x5aedad[_0xf252('0x2a')][_0xf252('0x2b')]};});_0x147111['model']=_['map'](_0x11fdcb,'name');_0x147111[_0xf252('0x2c')]=_[_0xf252('0x2d')](_0x28fa03[_0xf252('0x2c')]);_0x147111['filters']=_[_0xf252('0x2e')](_0x147111['model'],_0x147111[_0xf252('0x2c')]);_0x321dbc['attributes']=_[_0xf252('0x2e')](_0x147111[_0xf252('0x2f')],qs[_0xf252('0x30')](_0x28fa03[_0xf252('0x2c')][_0xf252('0x30')]));_0x321dbc[_0xf252('0x31')]=_0x321dbc[_0xf252('0x31')][_0xf252('0x32')]?_0x321dbc[_0xf252('0x31')]:_0x147111['model'];if(!_0x28fa03[_0xf252('0x2c')]['hasOwnProperty']('nolimit')){_0x321dbc[_0xf252('0x33')]=qs[_0xf252('0x33')](_0x28fa03[_0xf252('0x2c')][_0xf252('0x33')]);_0x321dbc['offset']=qs['offset'](_0x28fa03[_0xf252('0x2c')][_0xf252('0x1a')]);}_0x321dbc[_0xf252('0x34')]=qs[_0xf252('0x35')](_0x28fa03[_0xf252('0x2c')][_0xf252('0x35')]);_0x321dbc['where']=qs[_0xf252('0x36')](_['pick'](_0x28fa03[_0xf252('0x2c')],_0x147111['filters']));if(_0x28fa03[_0xf252('0x2c')][_0xf252('0x37')]){_0x321dbc[_0xf252('0x38')]=_[_0xf252('0x39')](_0x321dbc[_0xf252('0x38')],{'$or':_['map'](_0x11fdcb,function(_0x949114){if(_0x949114[_0xf252('0x2a')]!==_0xf252('0x3a')){var _0xa24058={};_0xa24058[_0x949114[_0xf252('0x25')]]={'$like':'%'+_0x28fa03[_0xf252('0x2c')][_0xf252('0x37')]+'%'};return _0xa24058;}})});}_0x321dbc=_[_0xf252('0x39')]({},_0x321dbc,_0x28fa03['options']);var _0x285ad7={'where':_0x321dbc['where']};return db[_0xf252('0x3b')][_0xf252('0x19')](_0x285ad7)[_0xf252('0x21')](function(_0x3e46fe){_0x2bb2ff[_0xf252('0x19')]=_0x3e46fe;if(_0x28fa03[_0xf252('0x2c')][_0xf252('0x3c')]){_0x321dbc['include']=[{'all':!![]}];}return db[_0xf252('0x3b')][_0xf252('0x3d')](_0x321dbc);})[_0xf252('0x21')](function(_0x5d01f0){_0x2bb2ff[_0xf252('0x3e')]=_0x5d01f0;return _0x2bb2ff;})[_0xf252('0x21')](respondWithFilteredResult(_0x18cef6,_0x321dbc))[_0xf252('0x3f')](handleError(_0x18cef6,null));};exports['show']=function(_0x27e471,_0x46a632){var _0x47b13e={'raw':!![],'where':{'id':_0x27e471['params']['id']}},_0x49ca4e={};_0x49ca4e[_0xf252('0x2f')]=_[_0xf252('0x2d')](db[_0xf252('0x3b')]['rawAttributes']);_0x49ca4e[_0xf252('0x2c')]=_['keys'](_0x27e471[_0xf252('0x2c')]);_0x49ca4e[_0xf252('0x36')]=_[_0xf252('0x2e')](_0x49ca4e[_0xf252('0x2f')],_0x49ca4e[_0xf252('0x2c')]);_0x47b13e[_0xf252('0x31')]=_[_0xf252('0x2e')](_0x49ca4e[_0xf252('0x2f')],qs[_0xf252('0x30')](_0x27e471[_0xf252('0x2c')][_0xf252('0x30')]));_0x47b13e[_0xf252('0x31')]=_0x47b13e[_0xf252('0x31')][_0xf252('0x32')]?_0x47b13e[_0xf252('0x31')]:_0x49ca4e[_0xf252('0x2f')];if(_0x27e471['query'][_0xf252('0x3c')]){_0x47b13e[_0xf252('0x40')]=[{'all':!![]}];}_0x47b13e=_[_0xf252('0x39')]({},_0x47b13e,_0x27e471['options']);return db[_0xf252('0x3b')][_0xf252('0x41')](_0x47b13e)[_0xf252('0x21')](handleEntityNotFound(_0x46a632,null))['then'](respondWithResult(_0x46a632,null))['catch'](handleError(_0x46a632,null));};exports[_0xf252('0x42')]=function(_0x22380f,_0x46daf0){return db[_0xf252('0x3b')][_0xf252('0x42')](_0x22380f[_0xf252('0x43')],{})[_0xf252('0x21')](respondWithResult(_0x46daf0,0xc9))[_0xf252('0x3f')](handleError(_0x46daf0,null));};exports[_0xf252('0x20')]=function(_0x5bd1a7,_0x498089){if(_0x5bd1a7['body']['id']){delete _0x5bd1a7[_0xf252('0x43')]['id'];}return db[_0xf252('0x3b')]['find']({'where':{'id':_0x5bd1a7[_0xf252('0x44')]['id']}})['then'](handleEntityNotFound(_0x498089,null))[_0xf252('0x21')](saveUpdates(_0x5bd1a7[_0xf252('0x43')],null))['then'](respondWithResult(_0x498089,null))['catch'](handleError(_0x498089,null));};exports['destroy']=function(_0x2f9e58,_0x3ade3f){return db[_0xf252('0x3b')]['find']({'where':{'id':_0x2f9e58[_0xf252('0x44')]['id']}})[_0xf252('0x21')](handleEntityNotFound(_0x3ade3f,null))[_0xf252('0x21')](removeEntity(_0x3ade3f,null))['catch'](handleError(_0x3ade3f,null));}; \ No newline at end of file +var _0x1f66=['squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SquareMessage','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','intersection','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x2195fc,_0x3557ea){var _0x5ce567=function(_0x594924){while(--_0x594924){_0x2195fc['push'](_0x2195fc['shift']());}};_0x5ce567(++_0x3557ea);}(_0x1f66,0xd4));var _0x61f6=function(_0x3b37a4,_0x1c9e09){_0x3b37a4=_0x3b37a4-0x0;var _0x5d5d9f=_0x1f66[_0x3b37a4];return _0x5d5d9f;};'use strict';var pdf=require(_0x61f6('0x0'));var emlformat=require(_0x61f6('0x1'));var rimraf=require(_0x61f6('0x2'));var zipdir=require(_0x61f6('0x3'));var jsonpatch=require(_0x61f6('0x4'));var rp=require(_0x61f6('0x5'));var moment=require(_0x61f6('0x6'));var BPromise=require(_0x61f6('0x7'));var Mustache=require(_0x61f6('0x8'));var util=require(_0x61f6('0x9'));var path=require(_0x61f6('0xa'));var sox=require(_0x61f6('0xb'));var csv=require(_0x61f6('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x61f6('0xd'));var crypto=require(_0x61f6('0xe'));var jsforce=require(_0x61f6('0xf'));var deskjs=require(_0x61f6('0x10'));var toCsv=require(_0x61f6('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x61f6('0x11'));var authService=require(_0x61f6('0x12'));var qs=require(_0x61f6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x61f6('0x14'));var logger=require(_0x61f6('0x15'))('api');var utils=require(_0x61f6('0x16'));var config=require(_0x61f6('0x17'));var db=require(_0x61f6('0x18'))['db'];function respondWithStatusCode(_0x3cae43,_0x4f2c5a){_0x4f2c5a=_0x4f2c5a||0xcc;return function(_0x151a65){if(_0x151a65){return _0x3cae43[_0x61f6('0x19')](_0x4f2c5a);}return _0x3cae43[_0x61f6('0x1a')](_0x4f2c5a)['end']();};}function respondWithResult(_0x4e11c0,_0x36a240){_0x36a240=_0x36a240||0xc8;return function(_0x35c983){if(_0x35c983){return _0x4e11c0[_0x61f6('0x1a')](_0x36a240)[_0x61f6('0x1b')](_0x35c983);}};}function respondWithFilteredResult(_0x597ce4,_0x228c37){return function(_0x43db36){if(_0x43db36){var _0x381108=_0x43db36[_0x61f6('0x1c')],_0x3c6e5d=_0x228c37[_0x61f6('0x1d')],_0x522ce0=_0x228c37[_0x61f6('0x1d')]+_0x228c37[_0x61f6('0x1e')],_0x549506;if(_0x522ce0>=_0x381108){_0x522ce0=_0x381108;_0x549506=0xc8;}else{_0x549506=0xce;}_0x597ce4['status'](_0x549506);return _0x597ce4['set'](_0x61f6('0x1f'),_0x3c6e5d+'-'+_0x522ce0+'/'+_0x381108)[_0x61f6('0x1b')](_0x43db36);}return null;};}function patchUpdates(_0x458fce){return function(_0x1b460f){try{jsonpatch[_0x61f6('0x20')](_0x1b460f,_0x458fce,!![]);}catch(_0x1656b1){return BPromise[_0x61f6('0x21')](_0x1656b1);}return _0x1b460f[_0x61f6('0x22')]();};}function saveUpdates(_0x36c56b,_0x20099f){return function(_0xbdf934){if(_0xbdf934){return _0xbdf934[_0x61f6('0x23')](_0x36c56b)[_0x61f6('0x24')](function(_0xee3c21){return _0xee3c21;});}return null;};}function removeEntity(_0x2a82ff,_0x275677){return function(_0x36d38a){if(_0x36d38a){return _0x36d38a[_0x61f6('0x25')]()[_0x61f6('0x24')](function(){_0x2a82ff[_0x61f6('0x1a')](0xcc)[_0x61f6('0x26')]();});}};}function handleEntityNotFound(_0xeaa42f,_0x29e791){return function(_0x45f0d8){if(!_0x45f0d8){_0xeaa42f[_0x61f6('0x19')](0x194);}return _0x45f0d8;};}function handleError(_0x3324e0,_0x3c92bb){_0x3c92bb=_0x3c92bb||0x1f4;return function(_0x74b3de){logger[_0x61f6('0x27')](_0x74b3de[_0x61f6('0x28')]);if(_0x74b3de[_0x61f6('0x29')]){delete _0x74b3de[_0x61f6('0x29')];}_0x3324e0[_0x61f6('0x1a')](_0x3c92bb)[_0x61f6('0x2a')](_0x74b3de);};}exports[_0x61f6('0x2b')]=function(_0x4636e2,_0x4795bc){var _0x370f3d={},_0x296894={},_0x455cef={'count':0x0,'rows':[]};var _0x8693aa=_[_0x61f6('0x2c')](db[_0x61f6('0x2d')]['rawAttributes'],function(_0x2b478a){return{'name':_0x2b478a[_0x61f6('0x2e')],'type':_0x2b478a[_0x61f6('0x2f')][_0x61f6('0x30')]};});_0x296894[_0x61f6('0x31')]=_['map'](_0x8693aa,_0x61f6('0x29'));_0x296894[_0x61f6('0x32')]=_[_0x61f6('0x33')](_0x4636e2[_0x61f6('0x32')]);_0x296894['filters']=_['intersection'](_0x296894['model'],_0x296894['query']);_0x370f3d[_0x61f6('0x34')]=_['intersection'](_0x296894['model'],qs[_0x61f6('0x35')](_0x4636e2[_0x61f6('0x32')]['fields']));_0x370f3d[_0x61f6('0x34')]=_0x370f3d[_0x61f6('0x34')][_0x61f6('0x36')]?_0x370f3d[_0x61f6('0x34')]:_0x296894[_0x61f6('0x31')];if(!_0x4636e2[_0x61f6('0x32')]['hasOwnProperty'](_0x61f6('0x37'))){_0x370f3d['limit']=qs[_0x61f6('0x1e')](_0x4636e2['query'][_0x61f6('0x1e')]);_0x370f3d['offset']=qs[_0x61f6('0x1d')](_0x4636e2['query'][_0x61f6('0x1d')]);}_0x370f3d['order']=qs[_0x61f6('0x38')](_0x4636e2['query']['sort']);_0x370f3d[_0x61f6('0x39')]=qs[_0x61f6('0x3a')](_[_0x61f6('0x3b')](_0x4636e2['query'],_0x296894[_0x61f6('0x3a')]));if(_0x4636e2['query'][_0x61f6('0x3c')]){_0x370f3d[_0x61f6('0x39')]=_['merge'](_0x370f3d[_0x61f6('0x39')],{'$or':_[_0x61f6('0x2c')](_0x8693aa,function(_0x57c7ad){if(_0x57c7ad['type']!==_0x61f6('0x3d')){var _0x2f4cc6={};_0x2f4cc6[_0x57c7ad[_0x61f6('0x29')]]={'$like':'%'+_0x4636e2[_0x61f6('0x32')]['filter']+'%'};return _0x2f4cc6;}})});}_0x370f3d=_[_0x61f6('0x3e')]({},_0x370f3d,_0x4636e2[_0x61f6('0x3f')]);var _0x104d30={'where':_0x370f3d[_0x61f6('0x39')]};return db[_0x61f6('0x2d')][_0x61f6('0x1c')](_0x104d30)['then'](function(_0x1028c3){_0x455cef[_0x61f6('0x1c')]=_0x1028c3;if(_0x4636e2[_0x61f6('0x32')][_0x61f6('0x40')]){_0x370f3d[_0x61f6('0x41')]=[{'all':!![]}];}return db[_0x61f6('0x2d')][_0x61f6('0x42')](_0x370f3d);})[_0x61f6('0x24')](function(_0xde08c6){_0x455cef['rows']=_0xde08c6;return _0x455cef;})['then'](respondWithFilteredResult(_0x4795bc,_0x370f3d))[_0x61f6('0x43')](handleError(_0x4795bc,null));};exports[_0x61f6('0x44')]=function(_0x4b032e,_0x55dd6d){var _0x33bd66={'raw':!![],'where':{'id':_0x4b032e[_0x61f6('0x45')]['id']}},_0x6edd49={};_0x6edd49[_0x61f6('0x31')]=_['keys'](db[_0x61f6('0x2d')][_0x61f6('0x46')]);_0x6edd49[_0x61f6('0x32')]=_[_0x61f6('0x33')](_0x4b032e[_0x61f6('0x32')]);_0x6edd49[_0x61f6('0x3a')]=_[_0x61f6('0x47')](_0x6edd49[_0x61f6('0x31')],_0x6edd49['query']);_0x33bd66[_0x61f6('0x34')]=_[_0x61f6('0x47')](_0x6edd49[_0x61f6('0x31')],qs[_0x61f6('0x35')](_0x4b032e[_0x61f6('0x32')][_0x61f6('0x35')]));_0x33bd66[_0x61f6('0x34')]=_0x33bd66[_0x61f6('0x34')][_0x61f6('0x36')]?_0x33bd66[_0x61f6('0x34')]:_0x6edd49['model'];if(_0x4b032e['query'][_0x61f6('0x40')]){_0x33bd66[_0x61f6('0x41')]=[{'all':!![]}];}_0x33bd66=_[_0x61f6('0x3e')]({},_0x33bd66,_0x4b032e[_0x61f6('0x3f')]);return db[_0x61f6('0x2d')][_0x61f6('0x48')](_0x33bd66)[_0x61f6('0x24')](handleEntityNotFound(_0x55dd6d,null))['then'](respondWithResult(_0x55dd6d,null))[_0x61f6('0x43')](handleError(_0x55dd6d,null));};exports[_0x61f6('0x49')]=function(_0x491671,_0x398998){return db[_0x61f6('0x2d')][_0x61f6('0x49')](_0x491671[_0x61f6('0x4a')],{})[_0x61f6('0x24')](respondWithResult(_0x398998,0xc9))[_0x61f6('0x43')](handleError(_0x398998,null));};exports['update']=function(_0x19e5f1,_0x14c90){if(_0x19e5f1[_0x61f6('0x4a')]['id']){delete _0x19e5f1[_0x61f6('0x4a')]['id'];}return db['SquareMessage'][_0x61f6('0x48')]({'where':{'id':_0x19e5f1[_0x61f6('0x45')]['id']}})['then'](handleEntityNotFound(_0x14c90,null))[_0x61f6('0x24')](saveUpdates(_0x19e5f1[_0x61f6('0x4a')],null))[_0x61f6('0x24')](respondWithResult(_0x14c90,null))[_0x61f6('0x43')](handleError(_0x14c90,null));};exports['destroy']=function(_0x220dc9,_0x5d8cef){return db[_0x61f6('0x2d')][_0x61f6('0x48')]({'where':{'id':_0x220dc9['params']['id']}})['then'](handleEntityNotFound(_0x5d8cef,null))['then'](removeEntity(_0x5d8cef,null))['catch'](handleError(_0x5d8cef,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 5981f1e..aca49e4 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 _0x2b00=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','lodash'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2b00,0x6b));var _0x02b0=function(_0x46319c,_0x5a5ea4){_0x46319c=_0x46319c-0x0;var _0x4b741b=_0x2b00[_0x46319c];return _0x4b741b;};'use strict';var _=require(_0x02b0('0x0'));var util=require(_0x02b0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x02b0('0x2'));var BPromise=require(_0x02b0('0x3'));var rp=require(_0x02b0('0x4'));var fs=require('fs');var path=require(_0x02b0('0x5'));var rimraf=require(_0x02b0('0x6'));var config=require(_0x02b0('0x7'));var attributes=require(_0x02b0('0x8'));module['exports']=function(_0x3a4787,_0x2b7b01){return _0x3a4787[_0x02b0('0x9')](_0x02b0('0xa'),attributes,{'tableName':_0x02b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cbb=['./squareMessage.attributes','SquareMessage','square_messages','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x182cbd,_0x3b513a){var _0x48ade4=function(_0x544b8b){while(--_0x544b8b){_0x182cbd['push'](_0x182cbd['shift']());}};_0x48ade4(++_0x3b513a);}(_0x0cbb,0xea));var _0xb0cb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cbb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb0cb('0x0'));var util=require(_0xb0cb('0x1'));var logger=require(_0xb0cb('0x2'))('api');var moment=require(_0xb0cb('0x3'));var BPromise=require(_0xb0cb('0x4'));var rp=require(_0xb0cb('0x5'));var fs=require('fs');var path=require(_0xb0cb('0x6'));var rimraf=require('rimraf');var config=require(_0xb0cb('0x7'));var attributes=require(_0xb0cb('0x8'));module['exports']=function(_0xc1ad8e,_0x269168){return _0xc1ad8e['define'](_0xb0cb('0x9'),attributes,{'tableName':_0xb0cb('0xa'),'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 5fe2f22..5a7b7a8 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 _0x4f0d=['error','code','message','info','result','CreateSquareMessage','SquareMessage','create','body','options','raw','debug','catch','ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x550e29,_0x4047f){var _0x3515b6=function(_0x303fe2){while(--_0x303fe2){_0x550e29['push'](_0x550e29['shift']());}};_0x3515b6(++_0x4047f);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x4c4a8b,_0x402020){_0x4c4a8b=_0x4c4a8b-0x0;var _0x20fa14=_0x4f0d[_0x4c4a8b];return _0x20fa14;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4f0('0x0'));var db=require(_0xd4f0('0x1'))['db'];var utils=require(_0xd4f0('0x2'));var logger=require('../../config/logger')(_0xd4f0('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd4f0('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16da18,_0x4dd938,_0x50e79f){return new BPromise(function(_0x19a779,_0x69309d){return client[_0xd4f0('0x5')](_0x16da18,_0x50e79f)[_0xd4f0('0x6')](function(_0x9b959f){logger['info'](_0xd4f0('0x7'),_0x4dd938,_0xd4f0('0x8'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x4dd938,_0xd4f0('0x8'),JSON[_0xd4f0('0x9')](_0x9b959f));if(_0x9b959f['error']){if(_0x9b959f[_0xd4f0('0xa')][_0xd4f0('0xb')]===0x1f4){logger[_0xd4f0('0xa')](_0xd4f0('0x7'),_0x4dd938,_0x9b959f[_0xd4f0('0xa')]['message']);return _0x69309d(_0x9b959f[_0xd4f0('0xa')][_0xd4f0('0xc')]);}logger[_0xd4f0('0xa')](_0xd4f0('0x7'),_0x4dd938,_0x9b959f[_0xd4f0('0xa')][_0xd4f0('0xc')]);return _0x19a779(_0x9b959f[_0xd4f0('0xa')][_0xd4f0('0xc')]);}else{logger[_0xd4f0('0xd')](_0xd4f0('0x7'),_0x4dd938,_0xd4f0('0x8'));_0x19a779(_0x9b959f[_0xd4f0('0xe')]['message']);}})['catch'](function(_0x169443){logger[_0xd4f0('0xa')](_0xd4f0('0x7'),_0x4dd938,_0x169443);_0x69309d(_0x169443);});});}exports[_0xd4f0('0xf')]=function(_0x4d0dcc){var _0x5bf265=this;return new Promise(function(_0x122d27,_0x11316e){return db[_0xd4f0('0x10')][_0xd4f0('0x11')](_0x4d0dcc[_0xd4f0('0x12')],{'raw':_0x4d0dcc[_0xd4f0('0x13')]?_0x4d0dcc[_0xd4f0('0x13')][_0xd4f0('0x14')]===undefined?!![]:![]:!![]})[_0xd4f0('0x6')](function(_0x297e3c){logger['info'](_0xd4f0('0xf'),_0x4d0dcc);logger[_0xd4f0('0x15')](_0xd4f0('0xf'),_0x4d0dcc,JSON['stringify'](_0x297e3c));_0x122d27(_0x297e3c);})[_0xd4f0('0x16')](function(_0x31c7a0){logger[_0xd4f0('0xa')]('CreateSquareMessage',_0x31c7a0[_0xd4f0('0xc')],_0x4d0dcc);_0x11316e(_0x5bf265[_0xd4f0('0xa')](0x1f4,_0x31c7a0[_0xd4f0('0xc')]));});});}; \ No newline at end of file +var _0xa23f=['rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','SquareMessage,\x20%s,\x20%s','message','catch','create','body','options','raw','CreateSquareMessage','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa23f,0x7c));var _0xfa23=function(_0x187664,_0x1b5d00){_0x187664=_0x187664-0x0;var _0x585095=_0xa23f[_0x187664];return _0x585095;};'use strict';var _=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfa23('0x2'));var fs=require('fs');var Redis=require(_0xfa23('0x3'));var db=require(_0xfa23('0x4'))['db'];var utils=require(_0xfa23('0x5'));var logger=require('../../config/logger')(_0xfa23('0x6'));var config=require('../../config/environment');var jayson=require(_0xfa23('0x7'));var client=jayson[_0xfa23('0x8')][_0xfa23('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3696ef,_0x4fb6e6,_0x5a7882){return new BPromise(function(_0x59d53e,_0x19a1ac){return client[_0xfa23('0xa')](_0x3696ef,_0x5a7882)[_0xfa23('0xb')](function(_0x31bb2c){logger[_0xfa23('0xc')]('SquareMessage,\x20%s,\x20%s',_0x4fb6e6,'request\x20sent');logger[_0xfa23('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x4fb6e6,_0xfa23('0xe'),JSON['stringify'](_0x31bb2c));if(_0x31bb2c[_0xfa23('0xf')]){if(_0x31bb2c[_0xfa23('0xf')][_0xfa23('0x10')]===0x1f4){logger['error'](_0xfa23('0x11'),_0x4fb6e6,_0x31bb2c[_0xfa23('0xf')][_0xfa23('0x12')]);return _0x19a1ac(_0x31bb2c['error']['message']);}logger[_0xfa23('0xf')](_0xfa23('0x11'),_0x4fb6e6,_0x31bb2c[_0xfa23('0xf')][_0xfa23('0x12')]);return _0x59d53e(_0x31bb2c['error'][_0xfa23('0x12')]);}else{logger[_0xfa23('0xc')](_0xfa23('0x11'),_0x4fb6e6,_0xfa23('0xe'));_0x59d53e(_0x31bb2c['result'][_0xfa23('0x12')]);}})[_0xfa23('0x13')](function(_0x3ca6be){logger[_0xfa23('0xf')](_0xfa23('0x11'),_0x4fb6e6,_0x3ca6be);_0x19a1ac(_0x3ca6be);});});}exports['CreateSquareMessage']=function(_0x59610c){var _0x5c3c6d=this;return new Promise(function(_0x445bd0,_0xb3ced2){return db['SquareMessage'][_0xfa23('0x14')](_0x59610c[_0xfa23('0x15')],{'raw':_0x59610c[_0xfa23('0x16')]?_0x59610c['options'][_0xfa23('0x17')]===undefined?!![]:![]:!![]})[_0xfa23('0xb')](function(_0x47c323){logger[_0xfa23('0xc')](_0xfa23('0x18'),_0x59610c);logger[_0xfa23('0xd')](_0xfa23('0x18'),_0x59610c,JSON[_0xfa23('0x19')](_0x47c323));_0x445bd0(_0x47c323);})[_0xfa23('0x13')](function(_0x31eedb){logger['error'](_0xfa23('0x18'),_0x31eedb[_0xfa23('0x12')],_0x59610c);_0xb3ced2(_0x5c3c6d[_0xfa23('0xf')](0x1f4,_0x31eedb[_0xfa23('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 5f9106c..329b51d 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 _0xf1c9=['put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','show','/:id/test','post','create'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0xf1c9,0xa0));var _0x9f1c=function(_0x5311db,_0x4fc3cb){_0x5311db=_0x5311db-0x0;var _0x3943d8=_0xf1c9[_0x5311db];return _0x3943d8;};'use strict';var multer=require(_0x9f1c('0x0'));var util=require(_0x9f1c('0x1'));var path=require(_0x9f1c('0x2'));var timeout=require(_0x9f1c('0x3'));var express=require(_0x9f1c('0x4'));var router=express[_0x9f1c('0x5')]();var auth=require(_0x9f1c('0x6'));var interaction=require(_0x9f1c('0x7'));var config=require(_0x9f1c('0x8'));var controller=require(_0x9f1c('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9f1c('0xa')]('/:id',auth[_0x9f1c('0xb')](),controller[_0x9f1c('0xc')]);router[_0x9f1c('0xa')](_0x9f1c('0xd'),auth['isAuthenticated'](),timeout('15s'),controller['test']);router[_0x9f1c('0xe')]('/',auth[_0x9f1c('0xb')](),controller[_0x9f1c('0xf')]);router[_0x9f1c('0x10')]('/:id',auth[_0x9f1c('0xb')](),controller[_0x9f1c('0x11')]);router[_0x9f1c('0x12')](_0x9f1c('0x13'),auth[_0x9f1c('0xb')](),controller[_0x9f1c('0x14')]);module[_0x9f1c('0x15')]=router; \ No newline at end of file +var _0x4920=['../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','test','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x4920,0x14f));var _0x0492=function(_0x306d4f,_0x22a129){_0x306d4f=_0x306d4f-0x0;var _0x4a609c=_0x4920[_0x306d4f];return _0x4a609c;};'use strict';var multer=require(_0x0492('0x0'));var util=require(_0x0492('0x1'));var path=require('path');var timeout=require(_0x0492('0x2'));var express=require(_0x0492('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0492('0x4'));var config=require(_0x0492('0x5'));var controller=require(_0x0492('0x6'));router[_0x0492('0x7')]('/',auth[_0x0492('0x8')](),controller[_0x0492('0x9')]);router[_0x0492('0x7')](_0x0492('0xa'),auth['isAuthenticated'](),controller[_0x0492('0xb')]);router[_0x0492('0x7')](_0x0492('0xc'),auth[_0x0492('0x8')](),timeout('15s'),controller[_0x0492('0xd')]);router[_0x0492('0xe')]('/',auth[_0x0492('0x8')](),controller[_0x0492('0xf')]);router['put'](_0x0492('0xa'),auth[_0x0492('0x8')](),controller[_0x0492('0x10')]);router[_0x0492('0x11')](_0x0492('0xa'),auth[_0x0492('0x8')](),controller[_0x0492('0x12')]);module[_0x0492('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index b52be67..cb095e8 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 _0x798e=['STRING','name','sequelize','exports'];(function(_0x47df54,_0x1aeb61){var _0x261b87=function(_0x54bc77){while(--_0x54bc77){_0x47df54['push'](_0x47df54['shift']());}};_0x261b87(++_0x1aeb61);}(_0x798e,0x13a));var _0xe798=function(_0x32a726,_0x310f71){_0x32a726=_0x32a726-0x0;var _0x518c94=_0x798e[_0x32a726];return _0x518c94;};'use strict';var Sequelize=require(_0xe798('0x0'));module[_0xe798('0x1')]={'name':{'type':Sequelize[_0xe798('0x2')],'unique':_0xe798('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xe798('0x2')]},'description':{'type':Sequelize[_0xe798('0x2')]}}; \ No newline at end of file +var _0x0c8f=['sequelize','exports','STRING','name'];(function(_0x43a765,_0x8cbb62){var _0x16a9cb=function(_0x2209a1){while(--_0x2209a1){_0x43a765['push'](_0x43a765['shift']());}};_0x16a9cb(++_0x8cbb62);}(_0x0c8f,0x10c));var _0xf0c8=function(_0x52a8ff,_0x1f5cad){_0x52a8ff=_0x52a8ff-0x0;var _0x10d574=_0x0c8f[_0x52a8ff];return _0x10d574;};'use strict';var Sequelize=require(_0xf0c8('0x0'));module[_0xf0c8('0x1')]={'name':{'type':Sequelize[_0xf0c8('0x2')],'unique':_0xf0c8('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf0c8('0x2')]},'description':{'type':Sequelize[_0xf0c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 90b9dc2..0a0bb8b 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 _0xe85c=['filters','filter','merge','options','include','rows','show','params','find','create','body','role','user','userProfileId','catch','update','test','dsn','openSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','apply','reject','save','then','destroy','get','ODBC','UserProfileResource','error','stack','name','index','map','SquareOdbc','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','offset','order','sort','where'];(function(_0x10bc9c,_0x483f4d){var _0x4be5ed=function(_0x1b3af7){while(--_0x1b3af7){_0x10bc9c['push'](_0x10bc9c['shift']());}};_0x4be5ed(++_0x483f4d);}(_0xe85c,0x103));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xce85('0x0'));var emlformat=require(_0xce85('0x1'));var rimraf=require(_0xce85('0x2'));var zipdir=require(_0xce85('0x3'));var jsonpatch=require(_0xce85('0x4'));var rp=require('request-promise');var moment=require(_0xce85('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xce85('0x6'));var util=require(_0xce85('0x7'));var path=require(_0xce85('0x8'));var sox=require(_0xce85('0x9'));var csv=require(_0xce85('0xa'));var ejs=require(_0xce85('0xb'));var fs=require('fs');var _=require(_0xce85('0xc'));var squel=require('squel');var crypto=require(_0xce85('0xd'));var jsforce=require(_0xce85('0xe'));var deskjs=require(_0xce85('0xf'));var toCsv=require(_0xce85('0xa'));var querystring=require(_0xce85('0x10'));var Papa=require(_0xce85('0x11'));var Redis=require('ioredis');var authService=require(_0xce85('0x12'));var qs=require(_0xce85('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce85('0x14'));var logger=require(_0xce85('0x15'))(_0xce85('0x16'));var utils=require('../../config/utils');var config=require(_0xce85('0x17'));var db=require(_0xce85('0x18'))['db'];function respondWithStatusCode(_0x52ccda,_0x3ecde2){_0x3ecde2=_0x3ecde2||0xcc;return function(_0x34004b){if(_0x34004b){return _0x52ccda[_0xce85('0x19')](_0x3ecde2);}return _0x52ccda[_0xce85('0x1a')](_0x3ecde2)[_0xce85('0x1b')]();};}function respondWithResult(_0xae374f,_0x38b9a1){_0x38b9a1=_0x38b9a1||0xc8;return function(_0x7951f0){if(_0x7951f0){return _0xae374f[_0xce85('0x1a')](_0x38b9a1)[_0xce85('0x1c')](_0x7951f0);}};}function respondWithFilteredResult(_0x59fa90,_0x224ea0){return function(_0x3813da){if(_0x3813da){var _0x489f4d=_0x3813da[_0xce85('0x1d')],_0x1e31f7=_0x224ea0['offset'],_0x4b31e0=_0x224ea0['offset']+_0x224ea0[_0xce85('0x1e')],_0xe99a65;if(_0x4b31e0>=_0x489f4d){_0x4b31e0=_0x489f4d;_0xe99a65=0xc8;}else{_0xe99a65=0xce;}_0x59fa90[_0xce85('0x1a')](_0xe99a65);return _0x59fa90[_0xce85('0x1f')]('Content-Range',_0x1e31f7+'-'+_0x4b31e0+'/'+_0x489f4d)[_0xce85('0x1c')](_0x3813da);}return null;};}function patchUpdates(_0x5f4a07){return function(_0x1083c2){try{jsonpatch[_0xce85('0x20')](_0x1083c2,_0x5f4a07,!![]);}catch(_0x909fe2){return BPromise[_0xce85('0x21')](_0x909fe2);}return _0x1083c2[_0xce85('0x22')]();};}function saveUpdates(_0x2bf5f5,_0x5497ae){return function(_0x1ec48f){if(_0x1ec48f){return _0x1ec48f['update'](_0x2bf5f5)[_0xce85('0x23')](function(_0x23281e){return _0x23281e;});}return null;};}function removeEntity(_0x397e02,_0x17cffb){return function(_0x4bcc3e){if(_0x4bcc3e){return _0x4bcc3e[_0xce85('0x24')]()[_0xce85('0x23')](function(){var _0x5c3000=_0x4bcc3e[_0xce85('0x25')]({'plain':!![]});var _0x425c72=_0xce85('0x26');return db[_0xce85('0x27')][_0xce85('0x24')]({'where':{'type':_0x425c72,'resourceId':_0x5c3000['id']}})[_0xce85('0x23')](function(){return _0x4bcc3e;});})[_0xce85('0x23')](function(){_0x397e02[_0xce85('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1109ae,_0x382492){return function(_0x3672d3){if(!_0x3672d3){_0x1109ae[_0xce85('0x19')](0x194);}return _0x3672d3;};}function handleError(_0x5bdd13,_0x1d9cd2){_0x1d9cd2=_0x1d9cd2||0x1f4;return function(_0x19be83){logger[_0xce85('0x28')](_0x19be83[_0xce85('0x29')]);if(_0x19be83['name']){delete _0x19be83[_0xce85('0x2a')];}_0x5bdd13[_0xce85('0x1a')](_0x1d9cd2)['send'](_0x19be83);};}exports[_0xce85('0x2b')]=function(_0x435fbc,_0x1c180b){var _0x59d600={},_0x208ad2={},_0xacc91e={'count':0x0,'rows':[]};var _0x3f41d3=_[_0xce85('0x2c')](db[_0xce85('0x2d')][_0xce85('0x2e')],function(_0x452b2d){return{'name':_0x452b2d['fieldName'],'type':_0x452b2d[_0xce85('0x2f')][_0xce85('0x30')]};});_0x208ad2[_0xce85('0x31')]=_[_0xce85('0x2c')](_0x3f41d3,_0xce85('0x2a'));_0x208ad2['query']=_[_0xce85('0x32')](_0x435fbc[_0xce85('0x33')]);_0x208ad2['filters']=_[_0xce85('0x34')](_0x208ad2[_0xce85('0x31')],_0x208ad2[_0xce85('0x33')]);_0x59d600['attributes']=_[_0xce85('0x34')](_0x208ad2['model'],qs[_0xce85('0x35')](_0x435fbc['query'][_0xce85('0x35')]));_0x59d600[_0xce85('0x36')]=_0x59d600[_0xce85('0x36')][_0xce85('0x37')]?_0x59d600['attributes']:_0x208ad2[_0xce85('0x31')];if(!_0x435fbc[_0xce85('0x33')]['hasOwnProperty'](_0xce85('0x38'))){_0x59d600[_0xce85('0x1e')]=qs['limit'](_0x435fbc[_0xce85('0x33')][_0xce85('0x1e')]);_0x59d600['offset']=qs['offset'](_0x435fbc['query'][_0xce85('0x39')]);}_0x59d600[_0xce85('0x3a')]=qs[_0xce85('0x3b')](_0x435fbc['query'][_0xce85('0x3b')]);_0x59d600[_0xce85('0x3c')]=qs[_0xce85('0x3d')](_['pick'](_0x435fbc[_0xce85('0x33')],_0x208ad2['filters']));if(_0x435fbc[_0xce85('0x33')][_0xce85('0x3e')]){_0x59d600[_0xce85('0x3c')]=_[_0xce85('0x3f')](_0x59d600[_0xce85('0x3c')],{'$or':_['map'](_0x3f41d3,function(_0x18aea0){if(_0x18aea0[_0xce85('0x2f')]!=='VIRTUAL'){var _0x3d9e48={};_0x3d9e48[_0x18aea0[_0xce85('0x2a')]]={'$like':'%'+_0x435fbc[_0xce85('0x33')]['filter']+'%'};return _0x3d9e48;}})});}_0x59d600=_[_0xce85('0x3f')]({},_0x59d600,_0x435fbc[_0xce85('0x40')]);var _0x23b00e={'where':_0x59d600[_0xce85('0x3c')]};return db[_0xce85('0x2d')][_0xce85('0x1d')](_0x23b00e)[_0xce85('0x23')](function(_0x33a9c6){_0xacc91e['count']=_0x33a9c6;if(_0x435fbc[_0xce85('0x33')]['includeAll']){_0x59d600[_0xce85('0x41')]=[{'all':!![]}];}return db[_0xce85('0x2d')]['findAll'](_0x59d600);})[_0xce85('0x23')](function(_0xd8514a){_0xacc91e[_0xce85('0x42')]=_0xd8514a;return _0xacc91e;})[_0xce85('0x23')](respondWithFilteredResult(_0x1c180b,_0x59d600))['catch'](handleError(_0x1c180b,null));};exports[_0xce85('0x43')]=function(_0x202081,_0x2a7dd1){var _0x52afd5={'raw':!![],'where':{'id':_0x202081[_0xce85('0x44')]['id']}},_0x2d3ea2={};_0x2d3ea2[_0xce85('0x31')]=_[_0xce85('0x32')](db[_0xce85('0x2d')][_0xce85('0x2e')]);_0x2d3ea2[_0xce85('0x33')]=_['keys'](_0x202081['query']);_0x2d3ea2[_0xce85('0x3d')]=_['intersection'](_0x2d3ea2['model'],_0x2d3ea2[_0xce85('0x33')]);_0x52afd5[_0xce85('0x36')]=_[_0xce85('0x34')](_0x2d3ea2[_0xce85('0x31')],qs[_0xce85('0x35')](_0x202081['query'][_0xce85('0x35')]));_0x52afd5[_0xce85('0x36')]=_0x52afd5[_0xce85('0x36')][_0xce85('0x37')]?_0x52afd5[_0xce85('0x36')]:_0x2d3ea2[_0xce85('0x31')];if(_0x202081[_0xce85('0x33')]['includeAll']){_0x52afd5[_0xce85('0x41')]=[{'all':!![]}];}_0x52afd5=_['merge']({},_0x52afd5,_0x202081[_0xce85('0x40')]);return db[_0xce85('0x2d')][_0xce85('0x45')](_0x52afd5)[_0xce85('0x23')](handleEntityNotFound(_0x2a7dd1,null))[_0xce85('0x23')](respondWithResult(_0x2a7dd1,null))['catch'](handleError(_0x2a7dd1,null));};exports[_0xce85('0x46')]=function(_0x4e21b8,_0x5a946f){return db['SquareOdbc'][_0xce85('0x46')](_0x4e21b8[_0xce85('0x47')],{})[_0xce85('0x23')](function(_0x2aec6f){var _0x132348=_0x4e21b8['user'][_0xce85('0x25')]({'plain':!![]});if(!_0x132348)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x132348[_0xce85('0x48')]===_0xce85('0x49')){var _0xa1dfc0=_0x2aec6f[_0xce85('0x25')]({'plain':!![]});var _0x116dae='ODBC';return db['UserProfileSection']['find']({'where':{'name':_0x116dae,'userProfileId':_0x132348[_0xce85('0x4a')]},'raw':!![]})[_0xce85('0x23')](function(_0x53ba8e){if(_0x53ba8e&&_0x53ba8e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xa1dfc0[_0xce85('0x2a')],'resourceId':_0xa1dfc0['id'],'type':_0x53ba8e[_0xce85('0x2a')],'sectionId':_0x53ba8e['id']},{})[_0xce85('0x23')](function(){return _0x2aec6f;});}else{return _0x2aec6f;}})[_0xce85('0x4b')](function(_0x1da3af){logger[_0xce85('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1da3af);throw _0x1da3af;});}return _0x2aec6f;})[_0xce85('0x23')](respondWithResult(_0x5a946f,0xc9))[_0xce85('0x4b')](handleError(_0x5a946f,null));};exports[_0xce85('0x4c')]=function(_0x1e2d57,_0x554854){if(_0x1e2d57['body']['id']){delete _0x1e2d57[_0xce85('0x47')]['id'];}return db[_0xce85('0x2d')][_0xce85('0x45')]({'where':{'id':_0x1e2d57[_0xce85('0x44')]['id']}})[_0xce85('0x23')](handleEntityNotFound(_0x554854,null))['then'](saveUpdates(_0x1e2d57[_0xce85('0x47')],null))[_0xce85('0x23')](respondWithResult(_0x554854,null))[_0xce85('0x4b')](handleError(_0x554854,null));};exports['destroy']=function(_0x17ab24,_0x59685c){return db[_0xce85('0x2d')][_0xce85('0x45')]({'where':{'id':_0x17ab24['params']['id']}})[_0xce85('0x23')](handleEntityNotFound(_0x59685c,null))[_0xce85('0x23')](removeEntity(_0x59685c,null))[_0xce85('0x4b')](handleError(_0x59685c,null));};exports[_0xce85('0x4d')]=function(_0x234dc0,_0x389eac,_0x36c8a3){var _0xb1ef9e;return db[_0xce85('0x2d')][_0xce85('0x45')]({'where':{'id':_0x234dc0[_0xce85('0x44')]['id']},'attributes':['id',_0xce85('0x4e')]})[_0xce85('0x23')](handleEntityNotFound(_0x389eac,null))[_0xce85('0x23')](function(_0x4f926d){if(_0x4f926d){var _0x3c3ea6=require('odbc')();_0x3c3ea6[_0xce85('0x4f')](_0x4f926d[_0xce85('0x4e')]);_0x3c3ea6['closeSync']();return _0x4f926d;}})[_0xce85('0x23')](respondWithResult(_0x389eac,null))[_0xce85('0x4b')](handleError(_0x389eac,null));}; \ No newline at end of file +var _0x6dac=['fieldName','key','model','query','filters','attributes','intersection','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','catch','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','ioredis','../../components/auth/service','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','rawAttributes'];(function(_0x22e82a,_0x3523ff){var _0x36f17b=function(_0xc8d927){while(--_0xc8d927){_0x22e82a['push'](_0x22e82a['shift']());}};_0x36f17b(++_0x3523ff);}(_0x6dac,0x155));var _0xc6da=function(_0x25e478,_0x463537){_0x25e478=_0x25e478-0x0;var _0x2767df=_0x6dac[_0x25e478];return _0x2767df;};'use strict';var pdf=require(_0xc6da('0x0'));var emlformat=require(_0xc6da('0x1'));var rimraf=require(_0xc6da('0x2'));var zipdir=require(_0xc6da('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc6da('0x4'));var moment=require(_0xc6da('0x5'));var BPromise=require(_0xc6da('0x6'));var Mustache=require(_0xc6da('0x7'));var util=require(_0xc6da('0x8'));var path=require(_0xc6da('0x9'));var sox=require('sox');var csv=require(_0xc6da('0xa'));var ejs=require(_0xc6da('0xb'));var fs=require('fs');var _=require(_0xc6da('0xc'));var squel=require(_0xc6da('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc6da('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc6da('0xe'));var authService=require(_0xc6da('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6da('0x10'));var logger=require('../../config/logger')(_0xc6da('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc6da('0x12'))['db'];function respondWithStatusCode(_0x575bb7,_0xe86a3c){_0xe86a3c=_0xe86a3c||0xcc;return function(_0x134b56){if(_0x134b56){return _0x575bb7[_0xc6da('0x13')](_0xe86a3c);}return _0x575bb7[_0xc6da('0x14')](_0xe86a3c)[_0xc6da('0x15')]();};}function respondWithResult(_0x54b584,_0x844e35){_0x844e35=_0x844e35||0xc8;return function(_0x147421){if(_0x147421){return _0x54b584[_0xc6da('0x14')](_0x844e35)[_0xc6da('0x16')](_0x147421);}};}function respondWithFilteredResult(_0x30219d,_0x2bdfbb){return function(_0x137379){if(_0x137379){var _0x330c78=_0x137379[_0xc6da('0x17')],_0x588983=_0x2bdfbb[_0xc6da('0x18')],_0x210044=_0x2bdfbb[_0xc6da('0x18')]+_0x2bdfbb[_0xc6da('0x19')],_0x16eee3;if(_0x210044>=_0x330c78){_0x210044=_0x330c78;_0x16eee3=0xc8;}else{_0x16eee3=0xce;}_0x30219d[_0xc6da('0x14')](_0x16eee3);return _0x30219d[_0xc6da('0x1a')]('Content-Range',_0x588983+'-'+_0x210044+'/'+_0x330c78)[_0xc6da('0x16')](_0x137379);}return null;};}function patchUpdates(_0x39b03d){return function(_0x5d27ae){try{jsonpatch[_0xc6da('0x1b')](_0x5d27ae,_0x39b03d,!![]);}catch(_0x1445df){return BPromise[_0xc6da('0x1c')](_0x1445df);}return _0x5d27ae[_0xc6da('0x1d')]();};}function saveUpdates(_0x803871,_0x9602ea){return function(_0x4c83bd){if(_0x4c83bd){return _0x4c83bd[_0xc6da('0x1e')](_0x803871)[_0xc6da('0x1f')](function(_0x528fd0){return _0x528fd0;});}return null;};}function removeEntity(_0x4a88e0,_0x588c26){return function(_0x333ba0){if(_0x333ba0){return _0x333ba0[_0xc6da('0x20')]()[_0xc6da('0x1f')](function(){var _0x75f3b1=_0x333ba0[_0xc6da('0x21')]({'plain':!![]});var _0x5aa65f=_0xc6da('0x22');return db[_0xc6da('0x23')]['destroy']({'where':{'type':_0x5aa65f,'resourceId':_0x75f3b1['id']}})[_0xc6da('0x1f')](function(){return _0x333ba0;});})[_0xc6da('0x1f')](function(){_0x4a88e0[_0xc6da('0x14')](0xcc)[_0xc6da('0x15')]();});}};}function handleEntityNotFound(_0x28185b,_0x35f997){return function(_0x2024c5){if(!_0x2024c5){_0x28185b[_0xc6da('0x13')](0x194);}return _0x2024c5;};}function handleError(_0x5375e0,_0x3466ea){_0x3466ea=_0x3466ea||0x1f4;return function(_0x473b6d){logger[_0xc6da('0x24')](_0x473b6d[_0xc6da('0x25')]);if(_0x473b6d['name']){delete _0x473b6d[_0xc6da('0x26')];}_0x5375e0[_0xc6da('0x14')](_0x3466ea)[_0xc6da('0x27')](_0x473b6d);};}exports[_0xc6da('0x28')]=function(_0x14877f,_0x4c9776){var _0x107056={},_0x2ec0a3={},_0x5be161={'count':0x0,'rows':[]};var _0x297228=_[_0xc6da('0x29')](db[_0xc6da('0x2a')][_0xc6da('0x2b')],function(_0x11a936){return{'name':_0x11a936[_0xc6da('0x2c')],'type':_0x11a936['type'][_0xc6da('0x2d')]};});_0x2ec0a3[_0xc6da('0x2e')]=_[_0xc6da('0x29')](_0x297228,_0xc6da('0x26'));_0x2ec0a3['query']=_['keys'](_0x14877f[_0xc6da('0x2f')]);_0x2ec0a3[_0xc6da('0x30')]=_['intersection'](_0x2ec0a3['model'],_0x2ec0a3[_0xc6da('0x2f')]);_0x107056[_0xc6da('0x31')]=_[_0xc6da('0x32')](_0x2ec0a3[_0xc6da('0x2e')],qs['fields'](_0x14877f[_0xc6da('0x2f')]['fields']));_0x107056[_0xc6da('0x31')]=_0x107056[_0xc6da('0x31')]['length']?_0x107056['attributes']:_0x2ec0a3[_0xc6da('0x2e')];if(!_0x14877f[_0xc6da('0x2f')]['hasOwnProperty'](_0xc6da('0x33'))){_0x107056['limit']=qs['limit'](_0x14877f['query']['limit']);_0x107056[_0xc6da('0x18')]=qs['offset'](_0x14877f['query'][_0xc6da('0x18')]);}_0x107056[_0xc6da('0x34')]=qs[_0xc6da('0x35')](_0x14877f[_0xc6da('0x2f')][_0xc6da('0x35')]);_0x107056[_0xc6da('0x36')]=qs[_0xc6da('0x30')](_['pick'](_0x14877f[_0xc6da('0x2f')],_0x2ec0a3[_0xc6da('0x30')]));if(_0x14877f['query']['filter']){_0x107056[_0xc6da('0x36')]=_[_0xc6da('0x37')](_0x107056[_0xc6da('0x36')],{'$or':_[_0xc6da('0x29')](_0x297228,function(_0x3ea757){if(_0x3ea757['type']!==_0xc6da('0x38')){var _0x4bf89e={};_0x4bf89e[_0x3ea757[_0xc6da('0x26')]]={'$like':'%'+_0x14877f[_0xc6da('0x2f')][_0xc6da('0x39')]+'%'};return _0x4bf89e;}})});}_0x107056=_[_0xc6da('0x37')]({},_0x107056,_0x14877f[_0xc6da('0x3a')]);var _0x1447d4={'where':_0x107056['where']};return db[_0xc6da('0x2a')][_0xc6da('0x17')](_0x1447d4)[_0xc6da('0x1f')](function(_0x53d6b7){_0x5be161[_0xc6da('0x17')]=_0x53d6b7;if(_0x14877f[_0xc6da('0x2f')][_0xc6da('0x3b')]){_0x107056['include']=[{'all':!![]}];}return db[_0xc6da('0x2a')]['findAll'](_0x107056);})['then'](function(_0x447da2){_0x5be161['rows']=_0x447da2;return _0x5be161;})[_0xc6da('0x1f')](respondWithFilteredResult(_0x4c9776,_0x107056))[_0xc6da('0x3c')](handleError(_0x4c9776,null));};exports['show']=function(_0x4fb2ca,_0x66c0da){var _0x5c61d6={'raw':!![],'where':{'id':_0x4fb2ca['params']['id']}},_0x3ba747={};_0x3ba747[_0xc6da('0x2e')]=_[_0xc6da('0x3d')](db[_0xc6da('0x2a')]['rawAttributes']);_0x3ba747['query']=_[_0xc6da('0x3d')](_0x4fb2ca[_0xc6da('0x2f')]);_0x3ba747[_0xc6da('0x30')]=_[_0xc6da('0x32')](_0x3ba747[_0xc6da('0x2e')],_0x3ba747[_0xc6da('0x2f')]);_0x5c61d6[_0xc6da('0x31')]=_[_0xc6da('0x32')](_0x3ba747[_0xc6da('0x2e')],qs['fields'](_0x4fb2ca[_0xc6da('0x2f')]['fields']));_0x5c61d6[_0xc6da('0x31')]=_0x5c61d6[_0xc6da('0x31')][_0xc6da('0x3e')]?_0x5c61d6[_0xc6da('0x31')]:_0x3ba747['model'];if(_0x4fb2ca['query'][_0xc6da('0x3b')]){_0x5c61d6['include']=[{'all':!![]}];}_0x5c61d6=_[_0xc6da('0x37')]({},_0x5c61d6,_0x4fb2ca[_0xc6da('0x3a')]);return db[_0xc6da('0x2a')][_0xc6da('0x3f')](_0x5c61d6)[_0xc6da('0x1f')](handleEntityNotFound(_0x66c0da,null))[_0xc6da('0x1f')](respondWithResult(_0x66c0da,null))[_0xc6da('0x3c')](handleError(_0x66c0da,null));};exports[_0xc6da('0x40')]=function(_0x5bd372,_0x332475){return db['SquareOdbc'][_0xc6da('0x40')](_0x5bd372[_0xc6da('0x41')],{})[_0xc6da('0x1f')](function(_0x3ffb1c){var _0x5ec8a6=_0x5bd372[_0xc6da('0x42')][_0xc6da('0x21')]({'plain':!![]});if(!_0x5ec8a6)throw new Error(_0xc6da('0x43'));if(_0x5ec8a6[_0xc6da('0x44')]===_0xc6da('0x42')){var _0x425099=_0x3ffb1c[_0xc6da('0x21')]({'plain':!![]});var _0x3962ea=_0xc6da('0x22');return db[_0xc6da('0x45')]['find']({'where':{'name':_0x3962ea,'userProfileId':_0x5ec8a6[_0xc6da('0x46')]},'raw':!![]})['then'](function(_0x53c08b){if(_0x53c08b&&_0x53c08b['autoAssociation']===0x0){return db[_0xc6da('0x23')][_0xc6da('0x40')]({'name':_0x425099['name'],'resourceId':_0x425099['id'],'type':_0x53c08b[_0xc6da('0x26')],'sectionId':_0x53c08b['id']},{})[_0xc6da('0x1f')](function(){return _0x3ffb1c;});}else{return _0x3ffb1c;}})[_0xc6da('0x3c')](function(_0x1ba2b0){logger['error'](_0xc6da('0x47'),_0x1ba2b0);throw _0x1ba2b0;});}return _0x3ffb1c;})[_0xc6da('0x1f')](respondWithResult(_0x332475,0xc9))[_0xc6da('0x3c')](handleError(_0x332475,null));};exports[_0xc6da('0x1e')]=function(_0x37a57f,_0x4586f5){if(_0x37a57f['body']['id']){delete _0x37a57f[_0xc6da('0x41')]['id'];}return db[_0xc6da('0x2a')][_0xc6da('0x3f')]({'where':{'id':_0x37a57f[_0xc6da('0x48')]['id']}})['then'](handleEntityNotFound(_0x4586f5,null))['then'](saveUpdates(_0x37a57f[_0xc6da('0x41')],null))[_0xc6da('0x1f')](respondWithResult(_0x4586f5,null))[_0xc6da('0x3c')](handleError(_0x4586f5,null));};exports[_0xc6da('0x20')]=function(_0x2a320c,_0x57c61c){return db[_0xc6da('0x2a')][_0xc6da('0x3f')]({'where':{'id':_0x2a320c[_0xc6da('0x48')]['id']}})[_0xc6da('0x1f')](handleEntityNotFound(_0x57c61c,null))[_0xc6da('0x1f')](removeEntity(_0x57c61c,null))[_0xc6da('0x3c')](handleError(_0x57c61c,null));};exports[_0xc6da('0x49')]=function(_0x475fdd,_0x2dc1bb,_0x275e14){var _0xff1923;return db['SquareOdbc']['find']({'where':{'id':_0x475fdd['params']['id']},'attributes':['id',_0xc6da('0x4a')]})[_0xc6da('0x1f')](handleEntityNotFound(_0x2dc1bb,null))[_0xc6da('0x1f')](function(_0x30659d){if(_0x30659d){var _0x2441b8=require('odbc')();_0x2441b8[_0xc6da('0x4b')](_0x30659d[_0xc6da('0x4a')]);_0x2441b8[_0xc6da('0x4c')]();return _0x30659d;}})[_0xc6da('0x1f')](respondWithResult(_0x2dc1bb,null))[_0xc6da('0x3c')](handleError(_0x2dc1bb,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 9b95988..1cb006e 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 _0x98e5=['bluebird','request-promise','path','rimraf','../../config/environment','exports','SquareOdbc','lodash','../../config/logger','api','moment'];(function(_0x11879c,_0x804353){var _0x4964c3=function(_0x2e8e43){while(--_0x2e8e43){_0x11879c['push'](_0x11879c['shift']());}};_0x4964c3(++_0x804353);}(_0x98e5,0xa1));var _0x598e=function(_0x230b23,_0x3d5683){_0x230b23=_0x230b23-0x0;var _0x3e7836=_0x98e5[_0x230b23];return _0x3e7836;};'use strict';var _=require(_0x598e('0x0'));var util=require('util');var logger=require(_0x598e('0x1'))(_0x598e('0x2'));var moment=require(_0x598e('0x3'));var BPromise=require(_0x598e('0x4'));var rp=require(_0x598e('0x5'));var fs=require('fs');var path=require(_0x598e('0x6'));var rimraf=require(_0x598e('0x7'));var config=require(_0x598e('0x8'));var attributes=require('./squareOdbc.attributes');module[_0x598e('0x9')]=function(_0x596865,_0x4b6bd7){return _0x596865['define'](_0x598e('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x948c=['exports','define','square_odbc','api','moment','request-promise','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x5d8232,_0x156279){var _0x5daf30=function(_0x1ef696){while(--_0x1ef696){_0x5d8232['push'](_0x5d8232['shift']());}};_0x5daf30(++_0x156279);}(_0x948c,0x123));var _0xc948=function(_0x260a78,_0x20c234){_0x260a78=_0x260a78-0x0;var _0x56c872=_0x948c[_0x260a78];return _0x56c872;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc948('0x0'));var moment=require(_0xc948('0x1'));var BPromise=require('bluebird');var rp=require(_0xc948('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc948('0x3'));var config=require(_0xc948('0x4'));var attributes=require(_0xc948('0x5'));module[_0xc948('0x6')]=function(_0x1ae975,_0x2e55cf){return _0x1ae975[_0xc948('0x7')]('SquareOdbc',attributes,{'tableName':_0xc948('0x8'),'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 fc56009..5916584 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 _0x3e74=['catch','SquareOdbc','find','options','raw','where','attributes','include','map','model','then','ShowSquareOdbc','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','SquareOdbc,\x20%s,\x20%s','message','info'];(function(_0xeb80e,_0x337608){var _0x68e9d7=function(_0x50c896){while(--_0x50c896){_0xeb80e['push'](_0xeb80e['shift']());}};_0x68e9d7(++_0x337608);}(_0x3e74,0x175));var _0x43e7=function(_0x14fbc8,_0x427155){_0x14fbc8=_0x14fbc8-0x0;var _0x447a2e=_0x3e74[_0x14fbc8];return _0x447a2e;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowSquareOdbc']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file +var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x2abd13,_0x501317){var _0x5ad645=function(_0x55ae11){while(--_0x55ae11){_0x2abd13['push'](_0x2abd13['shift']());}};_0x5ad645(++_0x501317);}(_0x008c,0x188));var _0xc008=function(_0x255036,_0xf94145){_0x255036=_0x255036-0x0;var _0x3c4c56=_0x008c[_0x255036];return _0x3c4c56;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 2453d12..43e486f 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 _0xab40=['addUsers','put','update','destroy','delete','removeUsers','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','index','/:id','isAuthenticated','show','get','post','create','/:id/users'];(function(_0x218149,_0x25c280){var _0x2e5a8d=function(_0x5a535a){while(--_0x5a535a){_0x218149['push'](_0x218149['shift']());}};_0x2e5a8d(++_0x25c280);}(_0xab40,0xcd));var _0x0ab4=function(_0x639863,_0x4b2727){_0x639863=_0x639863-0x0;var _0x115b74=_0xab40[_0x639863];return _0x115b74;};'use strict';var multer=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0ab4('0x2')]();var auth=require(_0x0ab4('0x3'));var interaction=require(_0x0ab4('0x4'));var config=require(_0x0ab4('0x5'));var controller=require(_0x0ab4('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0ab4('0x7')]);router['get'](_0x0ab4('0x8'),auth[_0x0ab4('0x9')](),controller[_0x0ab4('0xa')]);router[_0x0ab4('0xb')]('/:id/users',auth['isAuthenticated'](),controller['getUsers']);router[_0x0ab4('0xc')]('/',auth[_0x0ab4('0x9')](),controller[_0x0ab4('0xd')]);router[_0x0ab4('0xc')](_0x0ab4('0xe'),auth[_0x0ab4('0x9')](),controller[_0x0ab4('0xf')]);router[_0x0ab4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0ab4('0x11')]);router['delete'](_0x0ab4('0x8'),auth[_0x0ab4('0x9')](),controller[_0x0ab4('0x12')]);router[_0x0ab4('0x13')](_0x0ab4('0xe'),auth[_0x0ab4('0x9')](),controller[_0x0ab4('0x14')]);module[_0x0ab4('0x15')]=router; \ No newline at end of file +var _0x9348=['express','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','create','addUsers','put','update','delete','destroy','removeUsers','multer','util','path','connect-timeout'];(function(_0x30d492,_0x16bbd6){var _0x5891e3=function(_0x13ae12){while(--_0x13ae12){_0x30d492['push'](_0x30d492['shift']());}};_0x5891e3(++_0x16bbd6);}(_0x9348,0x10d));var _0x8934=function(_0x49e644,_0x703a7d){_0x49e644=_0x49e644-0x0;var _0x45d45b=_0x9348[_0x49e644];return _0x45d45b;};'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['getUsers']);router['post']('/',auth['isAuthenticated'](),controller[_0x8934('0xe')]);router['post'](_0x8934('0xd'),auth[_0x8934('0x9')](),controller[_0x8934('0xf')]);router[_0x8934('0x10')](_0x8934('0xb'),auth[_0x8934('0x9')](),controller[_0x8934('0x11')]);router[_0x8934('0x12')]('/:id',auth[_0x8934('0x9')](),controller[_0x8934('0x13')]);router[_0x8934('0x12')](_0x8934('0xd'),auth[_0x8934('0x9')](),controller[_0x8934('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 6e3af25..aa218b3 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 _0xf4c0=['getDataValue','preproduction','toString','BLOB','production','utf8','sequelize','exports','STRING','TEXT','long'];(function(_0x2026eb,_0x77d522){var _0x4c2bdf=function(_0x548167){while(--_0x548167){_0x2026eb['push'](_0x2026eb['shift']());}};_0x4c2bdf(++_0x77d522);}(_0xf4c0,0x1b3));var _0x0f4c=function(_0x501c50,_0x408096){_0x501c50=_0x501c50-0x0;var _0x597445=_0xf4c0[_0x501c50];return _0x597445;};'use strict';var Sequelize=require(_0x0f4c('0x0'));module[_0x0f4c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x0f4c('0x2')]},'notes':{'type':Sequelize[_0x0f4c('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0x0f4c('0x4')),'get':function(){if(this[_0x0f4c('0x5')](_0x0f4c('0x6'))){return this[_0x0f4c('0x5')](_0x0f4c('0x6'))[_0x0f4c('0x7')]('utf8');}}},'production':{'type':Sequelize[_0x0f4c('0x8')](_0x0f4c('0x4')),'get':function(){if(this[_0x0f4c('0x5')](_0x0f4c('0x9'))){return this[_0x0f4c('0x5')]('production')['toString'](_0x0f4c('0xa'));}}}}; \ No newline at end of file +var _0xd744=['preproduction','utf8','production','sequelize','exports','STRING','name','BLOB','long','getDataValue'];(function(_0x410a23,_0x3fa552){var _0x2e78b7=function(_0x3f63c7){while(--_0x3f63c7){_0x410a23['push'](_0x410a23['shift']());}};_0x2e78b7(++_0x3fa552);}(_0xd744,0x1d9));var _0x4d74=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd744[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x4d74('0x0'));module[_0x4d74('0x1')]={'name':{'type':Sequelize[_0x4d74('0x2')],'unique':_0x4d74('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4d74('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x4d74('0x4')](_0x4d74('0x5')),'get':function(){if(this[_0x4d74('0x6')]('preproduction')){return this[_0x4d74('0x6')](_0x4d74('0x7'))['toString'](_0x4d74('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0x4d74('0x5')),'get':function(){if(this[_0x4d74('0x6')](_0x4d74('0x9'))){return this[_0x4d74('0x6')](_0x4d74('0x9'))['toString'](_0x4d74('0x8'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 1cf1476..d34acfd 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 _0x1cc7=['ioredis','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','redis','./squareProject.socket','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareProject','includeAll','include','findAll','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','html-pdf','eml-format','rimraf','moment','bluebird','mustache','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x42a5e4,_0x2ccfb6){var _0xd56657=function(_0x528265){while(--_0x528265){_0x42a5e4['push'](_0x42a5e4['shift']());}};_0xd56657(++_0x2ccfb6);}(_0x1cc7,0x15a));var _0x71cc=function(_0x3d9c38,_0x45ea35){_0x3d9c38=_0x3d9c38-0x0;var _0x40625a=_0x1cc7[_0x3d9c38];return _0x40625a;};'use strict';var pdf=require(_0x71cc('0x0'));var emlformat=require(_0x71cc('0x1'));var rimraf=require(_0x71cc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x71cc('0x3'));var BPromise=require(_0x71cc('0x4'));var Mustache=require(_0x71cc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x71cc('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x71cc('0x7'));var squel=require(_0x71cc('0x8'));var crypto=require(_0x71cc('0x9'));var jsforce=require(_0x71cc('0xa'));var deskjs=require(_0x71cc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x71cc('0xc'));var Papa=require(_0x71cc('0xd'));var Redis=require(_0x71cc('0xe'));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(_0x71cc('0xf'))(_0x71cc('0x10'));var utils=require(_0x71cc('0x11'));var config=require('../../config/environment');var db=require(_0x71cc('0x12'))['db'];config['redis']=_[_0x71cc('0x13')](config['redis'],{'host':_0x71cc('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x71cc('0x15')]));require(_0x71cc('0x16'))[_0x71cc('0x17')](socket);function respondWithStatusCode(_0xd16032,_0x33070e){_0x33070e=_0x33070e||0xcc;return function(_0x540200){if(_0x540200){return _0xd16032[_0x71cc('0x18')](_0x33070e);}return _0xd16032[_0x71cc('0x19')](_0x33070e)[_0x71cc('0x1a')]();};}function respondWithResult(_0x14d5ab,_0x3875b8){_0x3875b8=_0x3875b8||0xc8;return function(_0x14087c){if(_0x14087c){return _0x14d5ab[_0x71cc('0x19')](_0x3875b8)['json'](_0x14087c);}};}function respondWithFilteredResult(_0xf3c790,_0x14788d){return function(_0x1a7d71){if(_0x1a7d71){var _0x1d1da8=_0x1a7d71[_0x71cc('0x1b')],_0x1067be=_0x14788d[_0x71cc('0x1c')],_0x10da0a=_0x14788d['offset']+_0x14788d['limit'],_0x4c5c6d;if(_0x10da0a>=_0x1d1da8){_0x10da0a=_0x1d1da8;_0x4c5c6d=0xc8;}else{_0x4c5c6d=0xce;}_0xf3c790[_0x71cc('0x19')](_0x4c5c6d);return _0xf3c790[_0x71cc('0x1d')](_0x71cc('0x1e'),_0x1067be+'-'+_0x10da0a+'/'+_0x1d1da8)[_0x71cc('0x1f')](_0x1a7d71);}return null;};}function patchUpdates(_0x258d30){return function(_0xccbfb){try{jsonpatch[_0x71cc('0x20')](_0xccbfb,_0x258d30,!![]);}catch(_0x18683d){return BPromise['reject'](_0x18683d);}return _0xccbfb[_0x71cc('0x21')]();};}function saveUpdates(_0x109239,_0x587a0b){return function(_0x2bee90){if(_0x2bee90){return _0x2bee90[_0x71cc('0x22')](_0x109239)[_0x71cc('0x23')](function(_0x1a9b4f){return _0x1a9b4f;});}return null;};}function removeEntity(_0x1bc67c,_0x887399){return function(_0x4a0abc){if(_0x4a0abc){return _0x4a0abc[_0x71cc('0x24')]()[_0x71cc('0x23')](function(){var _0x446580=_0x4a0abc[_0x71cc('0x25')]({'plain':!![]});var _0x36367b=_0x71cc('0x26');return db[_0x71cc('0x27')][_0x71cc('0x24')]({'where':{'type':_0x36367b,'resourceId':_0x446580['id']}})[_0x71cc('0x23')](function(){return _0x4a0abc;});})['then'](function(){_0x1bc67c[_0x71cc('0x19')](0xcc)[_0x71cc('0x1a')]();});}};}function handleEntityNotFound(_0x28e095,_0x26becf){return function(_0x20b093){if(!_0x20b093){_0x28e095[_0x71cc('0x18')](0x194);}return _0x20b093;};}function handleError(_0x16fc33,_0x9a7ca3){_0x9a7ca3=_0x9a7ca3||0x1f4;return function(_0x3cc813){logger[_0x71cc('0x28')](_0x3cc813[_0x71cc('0x29')]);if(_0x3cc813[_0x71cc('0x2a')]){delete _0x3cc813[_0x71cc('0x2a')];}_0x16fc33[_0x71cc('0x19')](_0x9a7ca3)[_0x71cc('0x2b')](_0x3cc813);};}exports[_0x71cc('0x2c')]=function(_0x4fa63e,_0x3054ff){var _0x3b7451={},_0x34c6bc={},_0x184a51={'count':0x0,'rows':[]};var _0x11d0bc=_[_0x71cc('0x2d')](db['SquareProject'][_0x71cc('0x2e')],function(_0x11bd4e){return{'name':_0x11bd4e[_0x71cc('0x2f')],'type':_0x11bd4e[_0x71cc('0x30')][_0x71cc('0x31')]};});_0x34c6bc[_0x71cc('0x32')]=_[_0x71cc('0x2d')](_0x11d0bc,'name');_0x34c6bc[_0x71cc('0x33')]=_['keys'](_0x4fa63e['query']);_0x34c6bc[_0x71cc('0x34')]=_['intersection'](_0x34c6bc['model'],_0x34c6bc[_0x71cc('0x33')]);_0x3b7451['attributes']=_[_0x71cc('0x35')](_0x34c6bc['model'],qs[_0x71cc('0x36')](_0x4fa63e[_0x71cc('0x33')]['fields']));_0x3b7451[_0x71cc('0x37')]=_0x3b7451[_0x71cc('0x37')][_0x71cc('0x38')]?_0x3b7451[_0x71cc('0x37')]:_0x34c6bc[_0x71cc('0x32')];if(!_0x4fa63e[_0x71cc('0x33')][_0x71cc('0x39')](_0x71cc('0x3a'))){_0x3b7451[_0x71cc('0x3b')]=qs[_0x71cc('0x3b')](_0x4fa63e['query'][_0x71cc('0x3b')]);_0x3b7451['offset']=qs[_0x71cc('0x1c')](_0x4fa63e[_0x71cc('0x33')][_0x71cc('0x1c')]);}_0x3b7451[_0x71cc('0x3c')]=qs[_0x71cc('0x3d')](_0x4fa63e[_0x71cc('0x33')]['sort']);_0x3b7451[_0x71cc('0x3e')]=qs['filters'](_[_0x71cc('0x3f')](_0x4fa63e[_0x71cc('0x33')],_0x34c6bc[_0x71cc('0x34')]));if(_0x4fa63e['query'][_0x71cc('0x40')]){_0x3b7451['where']=_[_0x71cc('0x41')](_0x3b7451[_0x71cc('0x3e')],{'$or':_[_0x71cc('0x2d')](_0x11d0bc,function(_0x92389){if(_0x92389[_0x71cc('0x30')]!==_0x71cc('0x42')){var _0x104aee={};_0x104aee[_0x92389[_0x71cc('0x2a')]]={'$like':'%'+_0x4fa63e[_0x71cc('0x33')][_0x71cc('0x40')]+'%'};return _0x104aee;}})});}_0x3b7451=_[_0x71cc('0x41')]({},_0x3b7451,_0x4fa63e[_0x71cc('0x43')]);var _0x4f0bb0={'where':_0x3b7451[_0x71cc('0x3e')]};return db[_0x71cc('0x44')]['count'](_0x4f0bb0)['then'](function(_0x463cdd){_0x184a51[_0x71cc('0x1b')]=_0x463cdd;if(_0x4fa63e['query'][_0x71cc('0x45')]){_0x3b7451[_0x71cc('0x46')]=[{'all':!![]}];}return db[_0x71cc('0x44')][_0x71cc('0x47')](_0x3b7451);})[_0x71cc('0x23')](function(_0x5b3a38){_0x184a51['rows']=_0x5b3a38;return _0x184a51;})['then'](respondWithFilteredResult(_0x3054ff,_0x3b7451))[_0x71cc('0x48')](handleError(_0x3054ff,null));};exports['show']=function(_0x3bd7d0,_0x38ef60){var _0x70cd0e={'raw':![],'where':{'id':_0x3bd7d0[_0x71cc('0x49')]['id']}},_0x218558={};_0x218558[_0x71cc('0x32')]=_[_0x71cc('0x4a')](db[_0x71cc('0x44')][_0x71cc('0x2e')]);_0x218558[_0x71cc('0x33')]=_[_0x71cc('0x4a')](_0x3bd7d0[_0x71cc('0x33')]);_0x218558[_0x71cc('0x34')]=_['intersection'](_0x218558[_0x71cc('0x32')],_0x218558[_0x71cc('0x33')]);_0x70cd0e[_0x71cc('0x37')]=_['intersection'](_0x218558[_0x71cc('0x32')],qs[_0x71cc('0x36')](_0x3bd7d0[_0x71cc('0x33')][_0x71cc('0x36')]));_0x70cd0e[_0x71cc('0x37')]=_0x70cd0e[_0x71cc('0x37')][_0x71cc('0x38')]?_0x70cd0e[_0x71cc('0x37')]:_0x218558[_0x71cc('0x32')];if(_0x3bd7d0[_0x71cc('0x33')][_0x71cc('0x45')]){_0x70cd0e[_0x71cc('0x46')]=[{'all':!![]}];}_0x70cd0e=_['merge']({},_0x70cd0e,_0x3bd7d0[_0x71cc('0x43')]);return db[_0x71cc('0x44')][_0x71cc('0x4b')](_0x70cd0e)[_0x71cc('0x23')](handleEntityNotFound(_0x38ef60,null))[_0x71cc('0x23')](respondWithResult(_0x38ef60,null))[_0x71cc('0x48')](handleError(_0x38ef60,null));};exports[_0x71cc('0x4c')]=function(_0x51cd49,_0x108e3f){return db[_0x71cc('0x44')]['create'](_0x51cd49[_0x71cc('0x4d')],{})[_0x71cc('0x23')](function(_0x1bda7f){var _0xe6b3db=_0x51cd49[_0x71cc('0x4e')][_0x71cc('0x25')]({'plain':!![]});if(!_0xe6b3db)throw new Error(_0x71cc('0x4f'));if(_0xe6b3db[_0x71cc('0x50')]===_0x71cc('0x4e')){var _0x1647ce=_0x1bda7f[_0x71cc('0x25')]({'plain':!![]});var _0x580c21=_0x71cc('0x26');return db['UserProfileSection'][_0x71cc('0x4b')]({'where':{'name':_0x580c21,'userProfileId':_0xe6b3db['userProfileId']},'raw':!![]})[_0x71cc('0x23')](function(_0x36c71e){if(_0x36c71e&&_0x36c71e['autoAssociation']===0x0){return db[_0x71cc('0x27')][_0x71cc('0x4c')]({'name':_0x1647ce['name'],'resourceId':_0x1647ce['id'],'type':_0x36c71e[_0x71cc('0x2a')],'sectionId':_0x36c71e['id']},{})[_0x71cc('0x23')](function(){return _0x1bda7f;});}else{return _0x1bda7f;}})[_0x71cc('0x48')](function(_0x1f0673){logger[_0x71cc('0x28')](_0x71cc('0x51'),_0x1f0673);throw _0x1f0673;});}return _0x1bda7f;})[_0x71cc('0x23')](respondWithResult(_0x108e3f,0xc9))['catch'](handleError(_0x108e3f,null));};exports[_0x71cc('0x22')]=function(_0xdc11f2,_0x570f87){if(_0xdc11f2['body']['id']){delete _0xdc11f2[_0x71cc('0x4d')]['id'];}return db[_0x71cc('0x44')]['find']({'where':{'id':_0xdc11f2[_0x71cc('0x49')]['id']}})[_0x71cc('0x23')](handleEntityNotFound(_0x570f87,null))[_0x71cc('0x23')](saveUpdates(_0xdc11f2[_0x71cc('0x4d')],null))[_0x71cc('0x23')](respondWithResult(_0x570f87,null))[_0x71cc('0x48')](handleError(_0x570f87,null));};exports['destroy']=function(_0x49cd24,_0x211dbf){return db['SquareProject']['find']({'where':{'id':_0x49cd24[_0x71cc('0x49')]['id']}})['then'](handleEntityNotFound(_0x211dbf,null))['then'](removeEntity(_0x211dbf,null))['catch'](handleError(_0x211dbf,null));};exports['addUsers']=function(_0x572c62,_0x32999d,_0x4b5587){return db['SquareProject'][_0x71cc('0x4b')]({'where':{'id':_0x572c62[_0x71cc('0x49')]['id']}})[_0x71cc('0x23')](handleEntityNotFound(_0x32999d,null))[_0x71cc('0x23')](function(_0x2b108e){if(_0x2b108e){return _0x2b108e[_0x71cc('0x52')](_0x572c62['body']['ids'],_['omit'](_0x572c62[_0x71cc('0x4d')],[_0x71cc('0x53'),'id'])||{});}})[_0x71cc('0x23')](respondWithResult(_0x32999d,null))[_0x71cc('0x48')](handleError(_0x32999d,null));};exports[_0x71cc('0x54')]=function(_0x5b1560,_0xcd78b5,_0xca3919){return db['SquareProject']['find']({'where':{'id':_0x5b1560[_0x71cc('0x49')]['id']}})[_0x71cc('0x23')](handleEntityNotFound(_0xcd78b5,null))['then'](function(_0x5484c9){if(_0x5484c9){return _0x5484c9[_0x71cc('0x54')](_0x5b1560['query']['ids'])[_0x71cc('0x23')](function(){if(_[_0x71cc('0x55')](_0x5b1560[_0x71cc('0x33')]['ids'])){for(var _0x35e963=0x0;_0x35e963<_0x5b1560[_0x71cc('0x33')][_0x71cc('0x53')]['length'];_0x35e963+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x5b1560[_0x71cc('0x33')][_0x71cc('0x53')][_0x35e963]),'SquareProjectId':Number(_0x5b1560[_0x71cc('0x49')]['id'])});}}else{socket[_0x71cc('0x56')](_0x71cc('0x57'),{'UserId':Number(_0x5b1560[_0x71cc('0x33')]['ids']),'SquareProjectId':Number(_0x5b1560['params']['id'])});}});}})[_0x71cc('0x23')](respondWithStatusCode(_0xcd78b5,null))[_0x71cc('0x48')](handleError(_0xcd78b5,null));};exports[_0x71cc('0x58')]=function(_0x1c60f0,_0x355f28,_0x22b8ac){var _0x1f8649={};var _0x220b8f={};var _0x471cb7;var _0x17ecd1;return db['SquareProject']['findOne']({'where':{'id':_0x1c60f0[_0x71cc('0x49')]['id']}})[_0x71cc('0x23')](handleEntityNotFound(_0x355f28,null))[_0x71cc('0x23')](function(_0x2d05b5){if(_0x2d05b5){_0x471cb7=_0x2d05b5;_0x220b8f[_0x71cc('0x32')]=_[_0x71cc('0x4a')](db[_0x71cc('0x59')][_0x71cc('0x2e')]);_0x220b8f[_0x71cc('0x33')]=_['keys'](_0x1c60f0[_0x71cc('0x33')]);_0x220b8f[_0x71cc('0x34')]=_[_0x71cc('0x35')](_0x220b8f[_0x71cc('0x32')],_0x220b8f['query']);_0x1f8649['attributes']=_[_0x71cc('0x35')](_0x220b8f[_0x71cc('0x32')],qs[_0x71cc('0x36')](_0x1c60f0[_0x71cc('0x33')][_0x71cc('0x36')]));_0x1f8649['attributes']=_0x1f8649['attributes'][_0x71cc('0x38')]?_0x1f8649[_0x71cc('0x37')]:_0x220b8f['model'];_0x1f8649[_0x71cc('0x3c')]=qs[_0x71cc('0x3d')](_0x1c60f0[_0x71cc('0x33')][_0x71cc('0x3d')]);_0x1f8649['where']=qs['filters'](_['pick'](_0x1c60f0[_0x71cc('0x33')],_0x220b8f[_0x71cc('0x34')]));if(_0x1c60f0[_0x71cc('0x33')][_0x71cc('0x40')]){_0x1f8649[_0x71cc('0x3e')]=_[_0x71cc('0x41')](_0x1f8649[_0x71cc('0x3e')],{'$or':_[_0x71cc('0x2d')](_0x1f8649[_0x71cc('0x37')],function(_0x2248d5){var _0x53bf3c={};_0x53bf3c[_0x2248d5]={'$like':'%'+_0x1c60f0[_0x71cc('0x33')][_0x71cc('0x40')]+'%'};return _0x53bf3c;})});}_0x1f8649=_[_0x71cc('0x41')]({},_0x1f8649,_0x1c60f0[_0x71cc('0x43')]);return _0x471cb7['getUsers'](_0x1f8649);}})['then'](function(_0x434475){if(_0x434475){_0x17ecd1=_0x434475[_0x71cc('0x38')];if(!_0x1c60f0[_0x71cc('0x33')][_0x71cc('0x39')](_0x71cc('0x3a'))){_0x1f8649[_0x71cc('0x3b')]=qs['limit'](_0x1c60f0[_0x71cc('0x33')][_0x71cc('0x3b')]);_0x1f8649['offset']=qs['offset'](_0x1c60f0[_0x71cc('0x33')][_0x71cc('0x1c')]);}return _0x471cb7[_0x71cc('0x58')](_0x1f8649);}})[_0x71cc('0x23')](function(_0x48d807){if(_0x48d807){return _0x48d807?{'count':_0x17ecd1,'rows':_0x48d807}:null;}})['then'](respondWithResult(_0x355f28,null))['catch'](handleError(_0x355f28,null));}; \ No newline at end of file +var _0xde2c=['sort','pick','merge','where','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','keys','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','body','params','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','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','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','then','get','SquareProjects','UserProfileResource','error','name','send','index','map','SquareProject','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xde2c,0x7f));var _0xcde2=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0xde2c[_0x1793de];return _0x4f0309;};'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 db=require(_0xcde2('0x18'))['db'];config[_0xcde2('0x19')]=_[_0xcde2('0x1a')](config[_0xcde2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xcde2('0x1b'))(new Redis(config['redis']));require(_0xcde2('0x1c'))['register'](socket);function respondWithStatusCode(_0x4b0e0e,_0x34e079){_0x34e079=_0x34e079||0xcc;return function(_0x1c7103){if(_0x1c7103){return _0x4b0e0e[_0xcde2('0x1d')](_0x34e079);}return _0x4b0e0e[_0xcde2('0x1e')](_0x34e079)[_0xcde2('0x1f')]();};}function respondWithResult(_0x5312c7,_0x39b023){_0x39b023=_0x39b023||0xc8;return function(_0x4c558b){if(_0x4c558b){return _0x5312c7[_0xcde2('0x1e')](_0x39b023)[_0xcde2('0x20')](_0x4c558b);}};}function respondWithFilteredResult(_0xbade43,_0x1f1858){return function(_0x5223f1){if(_0x5223f1){var _0x4fd5aa=_0x5223f1[_0xcde2('0x21')],_0x4fe586=_0x1f1858[_0xcde2('0x22')],_0x2b4468=_0x1f1858[_0xcde2('0x22')]+_0x1f1858['limit'],_0x582e84;if(_0x2b4468>=_0x4fd5aa){_0x2b4468=_0x4fd5aa;_0x582e84=0xc8;}else{_0x582e84=0xce;}_0xbade43[_0xcde2('0x1e')](_0x582e84);return _0xbade43[_0xcde2('0x23')](_0xcde2('0x24'),_0x4fe586+'-'+_0x2b4468+'/'+_0x4fd5aa)[_0xcde2('0x20')](_0x5223f1);}return null;};}function patchUpdates(_0x43df7a){return function(_0x57210d){try{jsonpatch['apply'](_0x57210d,_0x43df7a,!![]);}catch(_0x5a92b9){return BPromise[_0xcde2('0x25')](_0x5a92b9);}return _0x57210d[_0xcde2('0x26')]();};}function saveUpdates(_0x2c9562,_0x4063d4){return function(_0xc86374){if(_0xc86374){return _0xc86374['update'](_0x2c9562)[_0xcde2('0x27')](function(_0x52368b){return _0x52368b;});}return null;};}function removeEntity(_0x280d8c,_0xb2123c){return function(_0x26d18e){if(_0x26d18e){return _0x26d18e['destroy']()['then'](function(){var _0x44a222=_0x26d18e[_0xcde2('0x28')]({'plain':!![]});var _0x3e8aaf=_0xcde2('0x29');return db[_0xcde2('0x2a')]['destroy']({'where':{'type':_0x3e8aaf,'resourceId':_0x44a222['id']}})[_0xcde2('0x27')](function(){return _0x26d18e;});})[_0xcde2('0x27')](function(){_0x280d8c[_0xcde2('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2487eb,_0x348ca1){return function(_0x8e1655){if(!_0x8e1655){_0x2487eb[_0xcde2('0x1d')](0x194);}return _0x8e1655;};}function handleError(_0xd7019,_0x5b2b7){_0x5b2b7=_0x5b2b7||0x1f4;return function(_0x40b12c){logger[_0xcde2('0x2b')](_0x40b12c['stack']);if(_0x40b12c[_0xcde2('0x2c')]){delete _0x40b12c['name'];}_0xd7019[_0xcde2('0x1e')](_0x5b2b7)[_0xcde2('0x2d')](_0x40b12c);};}exports[_0xcde2('0x2e')]=function(_0x49cb58,_0xae46dc){var _0x28fedd={},_0x58afb1={},_0x26ec42={'count':0x0,'rows':[]};var _0x7c50ef=_[_0xcde2('0x2f')](db[_0xcde2('0x30')][_0xcde2('0x31')],function(_0xb689cd){return{'name':_0xb689cd[_0xcde2('0x32')],'type':_0xb689cd[_0xcde2('0x33')]['key']};});_0x58afb1[_0xcde2('0x34')]=_[_0xcde2('0x2f')](_0x7c50ef,_0xcde2('0x2c'));_0x58afb1[_0xcde2('0x35')]=_['keys'](_0x49cb58[_0xcde2('0x35')]);_0x58afb1[_0xcde2('0x36')]=_[_0xcde2('0x37')](_0x58afb1[_0xcde2('0x34')],_0x58afb1['query']);_0x28fedd[_0xcde2('0x38')]=_[_0xcde2('0x37')](_0x58afb1[_0xcde2('0x34')],qs[_0xcde2('0x39')](_0x49cb58['query'][_0xcde2('0x39')]));_0x28fedd[_0xcde2('0x38')]=_0x28fedd[_0xcde2('0x38')][_0xcde2('0x3a')]?_0x28fedd[_0xcde2('0x38')]:_0x58afb1['model'];if(!_0x49cb58[_0xcde2('0x35')][_0xcde2('0x3b')](_0xcde2('0x3c'))){_0x28fedd[_0xcde2('0x3d')]=qs['limit'](_0x49cb58['query'][_0xcde2('0x3d')]);_0x28fedd[_0xcde2('0x22')]=qs[_0xcde2('0x22')](_0x49cb58[_0xcde2('0x35')][_0xcde2('0x22')]);}_0x28fedd[_0xcde2('0x3e')]=qs[_0xcde2('0x3f')](_0x49cb58[_0xcde2('0x35')][_0xcde2('0x3f')]);_0x28fedd['where']=qs[_0xcde2('0x36')](_[_0xcde2('0x40')](_0x49cb58[_0xcde2('0x35')],_0x58afb1[_0xcde2('0x36')]));if(_0x49cb58[_0xcde2('0x35')]['filter']){_0x28fedd['where']=_[_0xcde2('0x41')](_0x28fedd[_0xcde2('0x42')],{'$or':_[_0xcde2('0x2f')](_0x7c50ef,function(_0x383899){if(_0x383899[_0xcde2('0x33')]!==_0xcde2('0x43')){var _0x4cb808={};_0x4cb808[_0x383899['name']]={'$like':'%'+_0x49cb58['query'][_0xcde2('0x44')]+'%'};return _0x4cb808;}})});}_0x28fedd=_[_0xcde2('0x41')]({},_0x28fedd,_0x49cb58[_0xcde2('0x45')]);var _0x1d171c={'where':_0x28fedd[_0xcde2('0x42')]};return db[_0xcde2('0x30')][_0xcde2('0x21')](_0x1d171c)['then'](function(_0x48580a){_0x26ec42[_0xcde2('0x21')]=_0x48580a;if(_0x49cb58['query'][_0xcde2('0x46')]){_0x28fedd['include']=[{'all':!![]}];}return db[_0xcde2('0x30')][_0xcde2('0x47')](_0x28fedd);})[_0xcde2('0x27')](function(_0x5ea9a9){_0x26ec42[_0xcde2('0x48')]=_0x5ea9a9;return _0x26ec42;})['then'](respondWithFilteredResult(_0xae46dc,_0x28fedd))[_0xcde2('0x49')](handleError(_0xae46dc,null));};exports[_0xcde2('0x4a')]=function(_0x1e661f,_0x79e073){var _0xcafd7={'raw':![],'where':{'id':_0x1e661f['params']['id']}},_0x27b64f={};_0x27b64f['model']=_[_0xcde2('0x4b')](db['SquareProject']['rawAttributes']);_0x27b64f[_0xcde2('0x35')]=_['keys'](_0x1e661f[_0xcde2('0x35')]);_0x27b64f[_0xcde2('0x36')]=_['intersection'](_0x27b64f[_0xcde2('0x34')],_0x27b64f['query']);_0xcafd7['attributes']=_[_0xcde2('0x37')](_0x27b64f[_0xcde2('0x34')],qs['fields'](_0x1e661f[_0xcde2('0x35')]['fields']));_0xcafd7[_0xcde2('0x38')]=_0xcafd7[_0xcde2('0x38')][_0xcde2('0x3a')]?_0xcafd7[_0xcde2('0x38')]:_0x27b64f[_0xcde2('0x34')];if(_0x1e661f['query'][_0xcde2('0x46')]){_0xcafd7[_0xcde2('0x4c')]=[{'all':!![]}];}_0xcafd7=_[_0xcde2('0x41')]({},_0xcafd7,_0x1e661f[_0xcde2('0x45')]);return db['SquareProject']['find'](_0xcafd7)[_0xcde2('0x27')](handleEntityNotFound(_0x79e073,null))['then'](respondWithResult(_0x79e073,null))[_0xcde2('0x49')](handleError(_0x79e073,null));};exports[_0xcde2('0x4d')]=function(_0x381bd4,_0x16675f){return db[_0xcde2('0x30')][_0xcde2('0x4d')](_0x381bd4['body'],{})[_0xcde2('0x27')](function(_0x5b996d){var _0x1a76a5=_0x381bd4['user'][_0xcde2('0x28')]({'plain':!![]});if(!_0x1a76a5)throw new Error(_0xcde2('0x4e'));if(_0x1a76a5[_0xcde2('0x4f')]===_0xcde2('0x50')){var _0x446cf0=_0x5b996d[_0xcde2('0x28')]({'plain':!![]});var _0x52fbc4=_0xcde2('0x29');return db['UserProfileSection'][_0xcde2('0x51')]({'where':{'name':_0x52fbc4,'userProfileId':_0x1a76a5[_0xcde2('0x52')]},'raw':!![]})[_0xcde2('0x27')](function(_0x428a55){if(_0x428a55&&_0x428a55[_0xcde2('0x53')]===0x0){return db[_0xcde2('0x2a')][_0xcde2('0x4d')]({'name':_0x446cf0[_0xcde2('0x2c')],'resourceId':_0x446cf0['id'],'type':_0x428a55[_0xcde2('0x2c')],'sectionId':_0x428a55['id']},{})[_0xcde2('0x27')](function(){return _0x5b996d;});}else{return _0x5b996d;}})[_0xcde2('0x49')](function(_0xbefa2e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbefa2e);throw _0xbefa2e;});}return _0x5b996d;})['then'](respondWithResult(_0x16675f,0xc9))[_0xcde2('0x49')](handleError(_0x16675f,null));};exports['update']=function(_0x1751dd,_0x3b9724){if(_0x1751dd[_0xcde2('0x54')]['id']){delete _0x1751dd['body']['id'];}return db[_0xcde2('0x30')]['find']({'where':{'id':_0x1751dd[_0xcde2('0x55')]['id']}})['then'](handleEntityNotFound(_0x3b9724,null))[_0xcde2('0x27')](saveUpdates(_0x1751dd[_0xcde2('0x54')],null))['then'](respondWithResult(_0x3b9724,null))[_0xcde2('0x49')](handleError(_0x3b9724,null));};exports['destroy']=function(_0x5e6fd3,_0x1e96b4){return db[_0xcde2('0x30')][_0xcde2('0x51')]({'where':{'id':_0x5e6fd3[_0xcde2('0x55')]['id']}})[_0xcde2('0x27')](handleEntityNotFound(_0x1e96b4,null))[_0xcde2('0x27')](removeEntity(_0x1e96b4,null))['catch'](handleError(_0x1e96b4,null));};exports[_0xcde2('0x56')]=function(_0x44b3fb,_0x21b4e6,_0x145b4a){return db[_0xcde2('0x30')][_0xcde2('0x51')]({'where':{'id':_0x44b3fb['params']['id']}})['then'](handleEntityNotFound(_0x21b4e6,null))[_0xcde2('0x27')](function(_0x35c6e5){if(_0x35c6e5){return _0x35c6e5[_0xcde2('0x56')](_0x44b3fb[_0xcde2('0x54')]['ids'],_[_0xcde2('0x57')](_0x44b3fb[_0xcde2('0x54')],[_0xcde2('0x58'),'id'])||{});}})[_0xcde2('0x27')](respondWithResult(_0x21b4e6,null))[_0xcde2('0x49')](handleError(_0x21b4e6,null));};exports[_0xcde2('0x59')]=function(_0x50a1db,_0x1bea12,_0x3b9e2d){return db['SquareProject'][_0xcde2('0x51')]({'where':{'id':_0x50a1db[_0xcde2('0x55')]['id']}})[_0xcde2('0x27')](handleEntityNotFound(_0x1bea12,null))[_0xcde2('0x27')](function(_0x2b5383){if(_0x2b5383){return _0x2b5383[_0xcde2('0x59')](_0x50a1db[_0xcde2('0x35')][_0xcde2('0x58')])[_0xcde2('0x27')](function(){if(_[_0xcde2('0x5a')](_0x50a1db['query'][_0xcde2('0x58')])){for(var _0x33d76a=0x0;_0x33d76a<_0x50a1db['query'][_0xcde2('0x58')][_0xcde2('0x3a')];_0x33d76a+=0x1){socket[_0xcde2('0x5b')]('userSquareProject:remove',{'UserId':Number(_0x50a1db[_0xcde2('0x35')][_0xcde2('0x58')][_0x33d76a]),'SquareProjectId':Number(_0x50a1db[_0xcde2('0x55')]['id'])});}}else{socket[_0xcde2('0x5b')](_0xcde2('0x5c'),{'UserId':Number(_0x50a1db[_0xcde2('0x35')][_0xcde2('0x58')]),'SquareProjectId':Number(_0x50a1db[_0xcde2('0x55')]['id'])});}});}})[_0xcde2('0x27')](respondWithStatusCode(_0x1bea12,null))[_0xcde2('0x49')](handleError(_0x1bea12,null));};exports[_0xcde2('0x5d')]=function(_0x5d42f8,_0x5bd1bd,_0x39c723){var _0xd28773={};var _0x1c9fbb={};var _0x5b8262;var _0x485a79;return db['SquareProject'][_0xcde2('0x5e')]({'where':{'id':_0x5d42f8[_0xcde2('0x55')]['id']}})[_0xcde2('0x27')](handleEntityNotFound(_0x5bd1bd,null))[_0xcde2('0x27')](function(_0x325b51){if(_0x325b51){_0x5b8262=_0x325b51;_0x1c9fbb[_0xcde2('0x34')]=_['keys'](db['User'][_0xcde2('0x31')]);_0x1c9fbb[_0xcde2('0x35')]=_[_0xcde2('0x4b')](_0x5d42f8[_0xcde2('0x35')]);_0x1c9fbb[_0xcde2('0x36')]=_[_0xcde2('0x37')](_0x1c9fbb[_0xcde2('0x34')],_0x1c9fbb[_0xcde2('0x35')]);_0xd28773[_0xcde2('0x38')]=_[_0xcde2('0x37')](_0x1c9fbb[_0xcde2('0x34')],qs[_0xcde2('0x39')](_0x5d42f8[_0xcde2('0x35')][_0xcde2('0x39')]));_0xd28773[_0xcde2('0x38')]=_0xd28773[_0xcde2('0x38')][_0xcde2('0x3a')]?_0xd28773[_0xcde2('0x38')]:_0x1c9fbb[_0xcde2('0x34')];_0xd28773[_0xcde2('0x3e')]=qs['sort'](_0x5d42f8[_0xcde2('0x35')][_0xcde2('0x3f')]);_0xd28773[_0xcde2('0x42')]=qs[_0xcde2('0x36')](_[_0xcde2('0x40')](_0x5d42f8['query'],_0x1c9fbb[_0xcde2('0x36')]));if(_0x5d42f8['query'][_0xcde2('0x44')]){_0xd28773[_0xcde2('0x42')]=_[_0xcde2('0x41')](_0xd28773[_0xcde2('0x42')],{'$or':_[_0xcde2('0x2f')](_0xd28773[_0xcde2('0x38')],function(_0x3471ed){var _0x47a1fd={};_0x47a1fd[_0x3471ed]={'$like':'%'+_0x5d42f8['query'][_0xcde2('0x44')]+'%'};return _0x47a1fd;})});}_0xd28773=_['merge']({},_0xd28773,_0x5d42f8[_0xcde2('0x45')]);return _0x5b8262[_0xcde2('0x5d')](_0xd28773);}})[_0xcde2('0x27')](function(_0x1be6d6){if(_0x1be6d6){_0x485a79=_0x1be6d6[_0xcde2('0x3a')];if(!_0x5d42f8[_0xcde2('0x35')][_0xcde2('0x3b')]('nolimit')){_0xd28773[_0xcde2('0x3d')]=qs[_0xcde2('0x3d')](_0x5d42f8[_0xcde2('0x35')][_0xcde2('0x3d')]);_0xd28773['offset']=qs[_0xcde2('0x22')](_0x5d42f8[_0xcde2('0x35')][_0xcde2('0x22')]);}return _0x5b8262[_0xcde2('0x5d')](_0xd28773);}})[_0xcde2('0x27')](function(_0x2c3ce0){if(_0x2c3ce0){return _0x2c3ce0?{'count':_0x485a79,'rows':_0x2c3ce0}:null;}})[_0xcde2('0x27')](respondWithResult(_0x5bd1bd,null))[_0xcde2('0x49')](handleError(_0x5bd1bd,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index b5eb46b..74a566c 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 _0xbaf4=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x1ade53,_0x20ce13){var _0x4568fa=function(_0x5d4f61){while(--_0x5d4f61){_0x1ade53['push'](_0x1ade53['shift']());}};_0x4568fa(++_0x20ce13);}(_0xbaf4,0xc4));var _0x4baf=function(_0x46c718,_0x2e52d6){_0x46c718=_0x46c718-0x0;var _0x32e338=_0xbaf4[_0x46c718];return _0x32e338;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x4baf('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x4baf('0x1')](0x0);var events={'afterCreate':_0x4baf('0x2'),'afterUpdate':_0x4baf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x16cf9f){return function(_0x341e41,_0x1548a7,_0x191d5a){SquareProjectEvents[_0x4baf('0x4')](_0x16cf9f+':'+_0x341e41['id'],_0x341e41);SquareProjectEvents[_0x4baf('0x4')](_0x16cf9f,_0x341e41);_0x191d5a(null);};}for(var e in events){if(events[_0x4baf('0x5')](e)){var event=events[e];SquareProject[_0x4baf('0x6')](e,emitEvent(event));}}module[_0x4baf('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x0b40=['hasOwnProperty','hook','../../mysqldb','SquareProject','save','update','remove','emit'];(function(_0xcb3a5,_0x1a955d){var _0x39c2a2=function(_0x486d78){while(--_0x486d78){_0xcb3a5['push'](_0xcb3a5['shift']());}};_0x39c2a2(++_0x1a955d);}(_0x0b40,0xba));var _0x00b4=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x0b40[_0x342baa];return _0x1208f3;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x00b4('0x0'))['db'][_0x00b4('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x00b4('0x2'),'afterUpdate':_0x00b4('0x3'),'afterDestroy':_0x00b4('0x4')};function emitEvent(_0x173af6){return function(_0x350fba,_0x40d4f4,_0x4ff8ad){SquareProjectEvents[_0x00b4('0x5')](_0x173af6+':'+_0x350fba['id'],_0x350fba);SquareProjectEvents[_0x00b4('0x5')](_0x173af6,_0x350fba);_0x4ff8ad(null);};}for(var e in events){if(events[_0x00b4('0x6')](e)){var event=events[e];SquareProject[_0x00b4('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 05a7513..d9c100f 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 _0xe03c=['../../config/environment','./squareProject.attributes','exports','define','square_projects','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x100e28,_0x14a38e){var _0x11213e=function(_0x55659a){while(--_0x55659a){_0x100e28['push'](_0x100e28['shift']());}};_0x11213e(++_0x14a38e);}(_0xe03c,0xd1));var _0xce03=function(_0x356c85,_0x22b9c7){_0x356c85=_0x356c85-0x0;var _0x4d6fa1=_0xe03c[_0x356c85];return _0x4d6fa1;};'use strict';var _=require(_0xce03('0x0'));var util=require(_0xce03('0x1'));var logger=require(_0xce03('0x2'))('api');var moment=require(_0xce03('0x3'));var BPromise=require(_0xce03('0x4'));var rp=require(_0xce03('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce03('0x6'));var config=require(_0xce03('0x7'));var attributes=require(_0xce03('0x8'));module[_0xce03('0x9')]=function(_0x135112,_0x27f427){return _0x135112[_0xce03('0xa')]('SquareProject',attributes,{'tableName':_0xce03('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f85=['rimraf','../../config/environment','./squareProject.attributes','SquareProject','square_projects','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x431cf2,_0x1d4456){var _0x10c9a7=function(_0x574efe){while(--_0x574efe){_0x431cf2['push'](_0x431cf2['shift']());}};_0x10c9a7(++_0x1d4456);}(_0x3f85,0x15a));var _0x53f8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f85[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x53f8('0x0'));var util=require(_0x53f8('0x1'));var logger=require(_0x53f8('0x2'))('api');var moment=require(_0x53f8('0x3'));var BPromise=require(_0x53f8('0x4'));var rp=require(_0x53f8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53f8('0x6'));var config=require(_0x53f8('0x7'));var attributes=require(_0x53f8('0x8'));module['exports']=function(_0x3c010a,_0x183aec){return _0x3c010a['define'](_0x53f8('0x9'),attributes,{'tableName':_0x53f8('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 a4a0f4b..3ed3c70 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 _0xb37a=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','find','options','raw','where','include','map','attributes','model','ShowSquareProject','debug','lodash','util','moment'];(function(_0x2f11e6,_0x48c367){var _0x49553c=function(_0x53b78d){while(--_0x53b78d){_0x2f11e6['push'](_0x2f11e6['shift']());}};_0x49553c(++_0x48c367);}(_0xb37a,0xe7));var _0xab37=function(_0x1f9a81,_0x33ad2d){_0x1f9a81=_0x1f9a81-0x0;var _0xd0a764=_0xb37a[_0x1f9a81];return _0xd0a764;};'use strict';var _=require(_0xab37('0x0'));var util=require(_0xab37('0x1'));var moment=require(_0xab37('0x2'));var BPromise=require(_0xab37('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab37('0x4'));var db=require(_0xab37('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xab37('0x6'))(_0xab37('0x7'));var config=require(_0xab37('0x8'));var jayson=require(_0xab37('0x9'));var client=jayson[_0xab37('0xa')][_0xab37('0xb')]({'port':0x232a});config[_0xab37('0xc')]=_[_0xab37('0xd')](config[_0xab37('0xc')],{'host':_0xab37('0xe'),'port':0x18eb});var socket=require(_0xab37('0xf'))(new Redis(config[_0xab37('0xc')]));require(_0xab37('0x10'))[_0xab37('0x11')](socket);function respondWithRpcPromise(_0x544184,_0x310896,_0x4259d9){return new BPromise(function(_0x4db538,_0xc7eaae){return client[_0xab37('0x12')](_0x544184,_0x4259d9)[_0xab37('0x13')](function(_0x5891ad){logger[_0xab37('0x14')](_0xab37('0x15'),_0x310896,_0xab37('0x16'));logger['debug'](_0xab37('0x17'),_0x310896,_0xab37('0x16'),JSON[_0xab37('0x18')](_0x5891ad));if(_0x5891ad[_0xab37('0x19')]){if(_0x5891ad[_0xab37('0x19')][_0xab37('0x1a')]===0x1f4){logger[_0xab37('0x19')](_0xab37('0x15'),_0x310896,_0x5891ad['error'][_0xab37('0x1b')]);return _0xc7eaae(_0x5891ad[_0xab37('0x19')][_0xab37('0x1b')]);}logger[_0xab37('0x19')](_0xab37('0x15'),_0x310896,_0x5891ad[_0xab37('0x19')][_0xab37('0x1b')]);return _0x4db538(_0x5891ad['error']['message']);}else{logger[_0xab37('0x14')](_0xab37('0x15'),_0x310896,_0xab37('0x16'));_0x4db538(_0x5891ad[_0xab37('0x1c')]['message']);}})['catch'](function(_0x59be77){logger[_0xab37('0x19')](_0xab37('0x15'),_0x310896,_0x59be77);_0xc7eaae(_0x59be77);});});}exports['ShowSquareProject']=function(_0x583339){var _0x244afa=this;return new Promise(function(_0x19a7fb,_0xdd33d4){return db['SquareProject'][_0xab37('0x1d')]({'raw':_0x583339['options']?_0x583339[_0xab37('0x1e')][_0xab37('0x1f')]===undefined?!![]:![]:!![],'where':_0x583339[_0xab37('0x1e')]?_0x583339['options'][_0xab37('0x20')]||null:null,'attributes':_0x583339[_0xab37('0x1e')]?_0x583339['options']['attributes']||null:null,'include':_0x583339[_0xab37('0x1e')]?_0x583339[_0xab37('0x1e')][_0xab37('0x21')]?_[_0xab37('0x22')](_0x583339[_0xab37('0x1e')][_0xab37('0x21')],function(_0x1ddcf8){return{'model':db[_0x1ddcf8['model']],'as':_0x1ddcf8['as'],'attributes':_0x1ddcf8[_0xab37('0x23')],'include':_0x1ddcf8['include']?_['map'](_0x1ddcf8[_0xab37('0x21')],function(_0x38153b){return{'model':db[_0x38153b[_0xab37('0x24')]],'as':_0x38153b['as'],'attributes':_0x38153b['attributes'],'include':_0x38153b[_0xab37('0x21')]?_['map'](_0x38153b[_0xab37('0x21')],function(_0x50575f){return{'model':db[_0x50575f[_0xab37('0x24')]],'as':_0x50575f['as'],'attributes':_0x50575f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f51d8){logger[_0xab37('0x14')](_0xab37('0x25'),_0x583339);logger[_0xab37('0x26')](_0xab37('0x25'),_0x583339,JSON['stringify'](_0x4f51d8));_0x19a7fb(_0x4f51d8);})['catch'](function(_0x2212c0){logger[_0xab37('0x19')](_0xab37('0x25'),_0x2212c0[_0xab37('0x1b')],_0x583339);_0xdd33d4(_0x244afa['error'](0x1f4,_0x2212c0[_0xab37('0x1b')]));});});}; \ No newline at end of file +var _0xb5f3=['ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0xf9d1aa,_0x1061fa){var _0x5197c9=function(_0x5cf8d1){while(--_0x5cf8d1){_0xf9d1aa['push'](_0xf9d1aa['shift']());}};_0x5197c9(++_0x1061fa);}(_0xb5f3,0x1ce));var _0x3b5f=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0xb5f3[_0x3c81b5];return _0x5888c4;};'use strict';var _=require(_0x3b5f('0x0'));var util=require(_0x3b5f('0x1'));var moment=require(_0x3b5f('0x2'));var BPromise=require(_0x3b5f('0x3'));var rs=require(_0x3b5f('0x4'));var fs=require('fs');var Redis=require(_0x3b5f('0x5'));var db=require(_0x3b5f('0x6'))['db'];var utils=require(_0x3b5f('0x7'));var logger=require(_0x3b5f('0x8'))(_0x3b5f('0x9'));var config=require(_0x3b5f('0xa'));var jayson=require(_0x3b5f('0xb'));var client=jayson[_0x3b5f('0xc')][_0x3b5f('0xd')]({'port':0x232a});config[_0x3b5f('0xe')]=_[_0x3b5f('0xf')](config[_0x3b5f('0xe')],{'host':_0x3b5f('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3b5f('0x11'))[_0x3b5f('0x12')](socket);function respondWithRpcPromise(_0x415f12,_0x4b40cc,_0x2e0ee0){return new BPromise(function(_0x34109b,_0x187804){return client[_0x3b5f('0x13')](_0x415f12,_0x2e0ee0)[_0x3b5f('0x14')](function(_0x255322){logger[_0x3b5f('0x15')](_0x3b5f('0x16'),_0x4b40cc,'request\x20sent');logger[_0x3b5f('0x17')](_0x3b5f('0x18'),_0x4b40cc,_0x3b5f('0x19'),JSON['stringify'](_0x255322));if(_0x255322[_0x3b5f('0x1a')]){if(_0x255322[_0x3b5f('0x1a')][_0x3b5f('0x1b')]===0x1f4){logger['error'](_0x3b5f('0x16'),_0x4b40cc,_0x255322[_0x3b5f('0x1a')][_0x3b5f('0x1c')]);return _0x187804(_0x255322[_0x3b5f('0x1a')][_0x3b5f('0x1c')]);}logger['error'](_0x3b5f('0x16'),_0x4b40cc,_0x255322[_0x3b5f('0x1a')][_0x3b5f('0x1c')]);return _0x34109b(_0x255322[_0x3b5f('0x1a')][_0x3b5f('0x1c')]);}else{logger[_0x3b5f('0x15')]('SquareProject,\x20%s,\x20%s',_0x4b40cc,_0x3b5f('0x19'));_0x34109b(_0x255322['result'][_0x3b5f('0x1c')]);}})[_0x3b5f('0x1d')](function(_0x1c61e9){logger['error'](_0x3b5f('0x16'),_0x4b40cc,_0x1c61e9);_0x187804(_0x1c61e9);});});}exports[_0x3b5f('0x1e')]=function(_0x38a785){var _0x112337=this;return new Promise(function(_0x3b14b3,_0x393d83){return db[_0x3b5f('0x1f')][_0x3b5f('0x20')]({'raw':_0x38a785[_0x3b5f('0x21')]?_0x38a785['options'][_0x3b5f('0x22')]===undefined?!![]:![]:!![],'where':_0x38a785[_0x3b5f('0x21')]?_0x38a785[_0x3b5f('0x21')][_0x3b5f('0x23')]||null:null,'attributes':_0x38a785[_0x3b5f('0x21')]?_0x38a785[_0x3b5f('0x21')][_0x3b5f('0x24')]||null:null,'include':_0x38a785[_0x3b5f('0x21')]?_0x38a785['options'][_0x3b5f('0x25')]?_[_0x3b5f('0x26')](_0x38a785[_0x3b5f('0x21')]['include'],function(_0x556e85){return{'model':db[_0x556e85[_0x3b5f('0x27')]],'as':_0x556e85['as'],'attributes':_0x556e85['attributes'],'include':_0x556e85['include']?_[_0x3b5f('0x26')](_0x556e85[_0x3b5f('0x25')],function(_0x5f342e){return{'model':db[_0x5f342e['model']],'as':_0x5f342e['as'],'attributes':_0x5f342e['attributes'],'include':_0x5f342e[_0x3b5f('0x25')]?_['map'](_0x5f342e[_0x3b5f('0x25')],function(_0x59a14c){return{'model':db[_0x59a14c[_0x3b5f('0x27')]],'as':_0x59a14c['as'],'attributes':_0x59a14c[_0x3b5f('0x24')]};}):[]};}):[]};}):[]:[]})[_0x3b5f('0x14')](function(_0x12eda3){logger[_0x3b5f('0x15')](_0x3b5f('0x1e'),_0x38a785);logger[_0x3b5f('0x17')](_0x3b5f('0x1e'),_0x38a785,JSON[_0x3b5f('0x28')](_0x12eda3));_0x3b14b3(_0x12eda3);})[_0x3b5f('0x1d')](function(_0x50a012){logger[_0x3b5f('0x1a')](_0x3b5f('0x1e'),_0x50a012['message'],_0x38a785);_0x393d83(_0x112337[_0x3b5f('0x1a')](0x1f4,_0x50a012[_0x3b5f('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 9be8e05..69bb581 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 _0x5fab=['emit','removeListener','register','length','./squareProject.events','save','update'];(function(_0x60fe92,_0x1ada35){var _0x42de73=function(_0x210217){while(--_0x210217){_0x60fe92['push'](_0x60fe92['shift']());}};_0x42de73(++_0x1ada35);}(_0x5fab,0x177));var _0xb5fa=function(_0x44aac2,_0x336163){_0x44aac2=_0x44aac2-0x0;var _0x38a6bc=_0x5fab[_0x44aac2];return _0x38a6bc;};'use strict';var SquareProjectEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){SquareProjectEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('squareProject:'+_0x1aec3e,_0x44df89);SquareProjectEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','squareProject:','./squareProject.events','save'];(function(_0x213ea6,_0x26ee98){var _0x391226=function(_0x297edc){while(--_0x297edc){_0x213ea6['push'](_0x213ea6['shift']());}};_0x391226(++_0x26ee98);}(_0x7a54,0x106));var _0x47a5=function(_0x22fc7a,_0x38d0e1){_0x22fc7a=_0x22fc7a-0x0;var _0x1f3cfd=_0x7a54[_0x22fc7a];return _0x1f3cfd;};'use strict';var SquareProjectEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){SquareProjectEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);SquareProjectEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 31ef60f..dc740d2 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 _0x4988=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','destroy','exports','util','path','connect-timeout'];(function(_0x1b40b5,_0x5ee810){var _0x937381=function(_0x4cb036){while(--_0x4cb036){_0x1b40b5['push'](_0x1b40b5['shift']());}};_0x937381(++_0x5ee810);}(_0x4988,0x11e));var _0x8498=function(_0x325eb4,_0x41b249){_0x325eb4=_0x325eb4-0x0;var _0x6aef09=_0x4988[_0x325eb4];return _0x6aef09;};'use strict';var multer=require('multer');var util=require(_0x8498('0x0'));var path=require(_0x8498('0x1'));var timeout=require(_0x8498('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x8498('0x3'));var interaction=require(_0x8498('0x4'));var config=require(_0x8498('0x5'));var controller=require('./squareRecording.controller');router[_0x8498('0x6')]('/',auth[_0x8498('0x7')](),controller['index']);router[_0x8498('0x6')](_0x8498('0x8'),auth[_0x8498('0x7')](),controller[_0x8498('0x9')]);router[_0x8498('0x6')](_0x8498('0xa'),auth['isAuthenticated'](),controller[_0x8498('0xb')]);router[_0x8498('0xc')]('/',auth[_0x8498('0x7')](),controller[_0x8498('0xd')]);router[_0x8498('0xe')](_0x8498('0x8'),auth[_0x8498('0x7')](),controller['update']);router['delete']('/:id/delete',auth['isAuthenticated'](),controller[_0x8498('0xf')]);module[_0x8498('0x10')]=router; \ No newline at end of file +var _0x24dd=['delete','/:id/delete','exports','util','connect-timeout','express','Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','update'];(function(_0x4ada77,_0x5d4ab0){var _0x338905=function(_0x49c967){while(--_0x49c967){_0x4ada77['push'](_0x4ada77['shift']());}};_0x338905(++_0x5d4ab0);}(_0x24dd,0x1f1));var _0xd24d=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0x24dd[_0x240261];return _0x45c332;};'use strict';var multer=require('multer');var util=require(_0xd24d('0x0'));var path=require('path');var timeout=require(_0xd24d('0x1'));var express=require(_0xd24d('0x2'));var router=express[_0xd24d('0x3')]();var auth=require(_0xd24d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd24d('0x5'));router[_0xd24d('0x6')]('/',auth[_0xd24d('0x7')](),controller[_0xd24d('0x8')]);router[_0xd24d('0x6')](_0xd24d('0x9'),auth['isAuthenticated'](),controller[_0xd24d('0xa')]);router[_0xd24d('0x6')](_0xd24d('0xb'),auth[_0xd24d('0x7')](),controller[_0xd24d('0xc')]);router[_0xd24d('0xd')]('/',auth[_0xd24d('0x7')](),controller['create']);router[_0xd24d('0xe')](_0xd24d('0x9'),auth[_0xd24d('0x7')](),controller[_0xd24d('0xf')]);router[_0xd24d('0x10')](_0xd24d('0x11'),auth[_0xd24d('0x7')](),controller['destroy']);module[_0xd24d('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 3416296..cf9cdbb 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 _0x649f=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring'];(function(_0x27ca78,_0x3b5796){var _0x528091=function(_0x3e4dd6){while(--_0x3e4dd6){_0x27ca78['push'](_0x27ca78['shift']());}};_0x528091(++_0x3b5796);}(_0x649f,0x93));var _0xf649=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x649f[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0xf649('0x0'));module[_0xf649('0x1')]={'uniqueid':{'type':Sequelize[_0xf649('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf649('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf649('0x2')]},'accountcode':{'type':Sequelize[_0xf649('0x2')]},'dnid':{'type':Sequelize[_0xf649('0x2')]},'projectName':{'type':Sequelize[_0xf649('0x2')]},'saveName':{'type':Sequelize[_0xf649('0x2')]},'filename':{'type':Sequelize[_0xf649('0x2')]},'savePath':{'type':Sequelize[_0xf649('0x2')]},'format':{'type':Sequelize[_0xf649('0x3')],'get':function(){var _0x5ece5c='';var _0x53e568=this[_0xf649('0x4')](_0xf649('0x5'));if(_0x53e568){_0x5ece5c=_0x53e568[_0xf649('0x6')](_0x53e568['lastIndexOf']('.'));}return _0x5ece5c;}}}; \ No newline at end of file +var _0x847d=['substring','lastIndexOf','exports','STRING','VIRTUAL','savePath'];(function(_0x272650,_0x3bccaf){var _0x144163=function(_0x4cfa39){while(--_0x4cfa39){_0x272650['push'](_0x272650['shift']());}};_0x144163(++_0x3bccaf);}(_0x847d,0xf8));var _0xd847=function(_0x53afe9,_0x2c9f40){_0x53afe9=_0x53afe9-0x0;var _0x396396=_0x847d[_0x53afe9];return _0x396396;};'use strict';var Sequelize=require('sequelize');module[_0xd847('0x0')]={'uniqueid':{'type':Sequelize[_0xd847('0x1')]},'callerid':{'type':Sequelize[_0xd847('0x1')]},'calleridname':{'type':Sequelize[_0xd847('0x1')]},'context':{'type':Sequelize[_0xd847('0x1')]},'extension':{'type':Sequelize[_0xd847('0x1')]},'priority':{'type':Sequelize[_0xd847('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xd847('0x1')]},'projectName':{'type':Sequelize[_0xd847('0x1')]},'saveName':{'type':Sequelize[_0xd847('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xd847('0x1')]},'format':{'type':Sequelize[_0xd847('0x2')],'get':function(){var _0x4a9556='';var _0xb65371=this['getDataValue'](_0xd847('0x3'));if(_0xb65371){_0x4a9556=_0xb65371[_0xd847('0x4')](_0xb65371[_0xd847('0x5')]('.'));}return _0x4a9556;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 47d71a5..db71323 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 _0xfa48=['length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','update','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','unlinkSync','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','save','then','destroy','end','stack','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields'];(function(_0x309a5e,_0x1ec246){var _0x1d21f1=function(_0x1d902d){while(--_0x1d902d){_0x309a5e['push'](_0x309a5e['shift']());}};_0x1d21f1(++_0x1ec246);}(_0xfa48,0x8c));var _0x8fa4=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xfa48[_0x5c3c0b];return _0x52ecd2;};'use strict';var pdf=require(_0x8fa4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8fa4('0x1'));var zipdir=require(_0x8fa4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8fa4('0x3'));var moment=require(_0x8fa4('0x4'));var BPromise=require(_0x8fa4('0x5'));var Mustache=require('mustache');var util=require(_0x8fa4('0x6'));var path=require(_0x8fa4('0x7'));var sox=require('sox');var csv=require(_0x8fa4('0x8'));var ejs=require(_0x8fa4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8fa4('0xa'));var crypto=require(_0x8fa4('0xb'));var jsforce=require(_0x8fa4('0xc'));var deskjs=require(_0x8fa4('0xd'));var toCsv=require(_0x8fa4('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8fa4('0xe'));var authService=require(_0x8fa4('0xf'));var qs=require(_0x8fa4('0x10'));var as=require(_0x8fa4('0x11'));var hardwareService=require(_0x8fa4('0x12'));var logger=require(_0x8fa4('0x13'))('api');var utils=require(_0x8fa4('0x14'));var config=require(_0x8fa4('0x15'));var db=require(_0x8fa4('0x16'))['db'];function respondWithStatusCode(_0x2e9da8,_0x496600){_0x496600=_0x496600||0xcc;return function(_0xc2f624){if(_0xc2f624){return _0x2e9da8[_0x8fa4('0x17')](_0x496600);}return _0x2e9da8[_0x8fa4('0x18')](_0x496600)['end']();};}function respondWithResult(_0x8e5cea,_0x37905a){_0x37905a=_0x37905a||0xc8;return function(_0x414f7f){if(_0x414f7f){return _0x8e5cea[_0x8fa4('0x18')](_0x37905a)[_0x8fa4('0x19')](_0x414f7f);}};}function respondWithFilteredResult(_0xa803d0,_0x1d3a59){return function(_0x1835b2){if(_0x1835b2){var _0x934908=_0x1835b2[_0x8fa4('0x1a')],_0xdf77cd=_0x1d3a59[_0x8fa4('0x1b')],_0x451b88=_0x1d3a59[_0x8fa4('0x1b')]+_0x1d3a59['limit'],_0x361dec;if(_0x451b88>=_0x934908){_0x451b88=_0x934908;_0x361dec=0xc8;}else{_0x361dec=0xce;}_0xa803d0[_0x8fa4('0x18')](_0x361dec);return _0xa803d0[_0x8fa4('0x1c')]('Content-Range',_0xdf77cd+'-'+_0x451b88+'/'+_0x934908)[_0x8fa4('0x19')](_0x1835b2);}return null;};}function patchUpdates(_0x5def5a){return function(_0x886805){try{jsonpatch['apply'](_0x886805,_0x5def5a,!![]);}catch(_0x36f5dd){return BPromise['reject'](_0x36f5dd);}return _0x886805[_0x8fa4('0x1d')]();};}function saveUpdates(_0x434a53,_0x238b9c){return function(_0x17f89c){if(_0x17f89c){return _0x17f89c['update'](_0x434a53)[_0x8fa4('0x1e')](function(_0x3d5ef7){return _0x3d5ef7;});}return null;};}function removeEntity(_0x77311b,_0x232e32){return function(_0x216e90){if(_0x216e90){return _0x216e90[_0x8fa4('0x1f')]()[_0x8fa4('0x1e')](function(){_0x77311b[_0x8fa4('0x18')](0xcc)[_0x8fa4('0x20')]();});}};}function handleEntityNotFound(_0x103c23,_0x15a694){return function(_0x53e1b1){if(!_0x53e1b1){_0x103c23[_0x8fa4('0x17')](0x194);}return _0x53e1b1;};}function handleError(_0x3d64c4,_0x470caa){_0x470caa=_0x470caa||0x1f4;return function(_0x3fda63){logger['error'](_0x3fda63[_0x8fa4('0x21')]);if(_0x3fda63[_0x8fa4('0x22')]){delete _0x3fda63[_0x8fa4('0x22')];}_0x3d64c4[_0x8fa4('0x18')](_0x470caa)[_0x8fa4('0x23')](_0x3fda63);};}exports[_0x8fa4('0x24')]=function(_0x1a00f4,_0x1328b7){var _0x2f6940={},_0x2b854d={},_0x330f72={'count':0x0,'rows':[]};var _0x1ee73c=_['map'](db[_0x8fa4('0x25')][_0x8fa4('0x26')],function(_0x1bd643){return{'name':_0x1bd643[_0x8fa4('0x27')],'type':_0x1bd643[_0x8fa4('0x28')][_0x8fa4('0x29')]};});_0x2b854d['model']=_[_0x8fa4('0x2a')](_0x1ee73c,_0x8fa4('0x22'));_0x2b854d[_0x8fa4('0x2b')]=_[_0x8fa4('0x2c')](_0x1a00f4[_0x8fa4('0x2b')]);_0x2b854d[_0x8fa4('0x2d')]=_[_0x8fa4('0x2e')](_0x2b854d['model'],_0x2b854d[_0x8fa4('0x2b')]);_0x2f6940[_0x8fa4('0x2f')]=_[_0x8fa4('0x2e')](_0x2b854d[_0x8fa4('0x30')],qs[_0x8fa4('0x31')](_0x1a00f4['query']['fields']));_0x2f6940[_0x8fa4('0x2f')]=_0x2f6940[_0x8fa4('0x2f')][_0x8fa4('0x32')]?_0x2f6940['attributes']:_0x2b854d[_0x8fa4('0x30')];if(!_0x1a00f4['query'][_0x8fa4('0x33')](_0x8fa4('0x34'))){_0x2f6940[_0x8fa4('0x35')]=qs['limit'](_0x1a00f4[_0x8fa4('0x2b')][_0x8fa4('0x35')]);_0x2f6940[_0x8fa4('0x1b')]=qs['offset'](_0x1a00f4[_0x8fa4('0x2b')][_0x8fa4('0x1b')]);}_0x2f6940[_0x8fa4('0x36')]=qs[_0x8fa4('0x37')](_0x1a00f4[_0x8fa4('0x2b')][_0x8fa4('0x37')]);_0x2f6940[_0x8fa4('0x38')]=qs[_0x8fa4('0x2d')](_['pick'](_0x1a00f4[_0x8fa4('0x2b')],_0x2b854d[_0x8fa4('0x2d')]));if(_0x1a00f4[_0x8fa4('0x2b')][_0x8fa4('0x39')]){_0x2f6940[_0x8fa4('0x38')]=_[_0x8fa4('0x3a')](_0x2f6940[_0x8fa4('0x38')],{'$or':_[_0x8fa4('0x2a')](_0x1ee73c,function(_0x3c7981){if(_0x3c7981[_0x8fa4('0x28')]!==_0x8fa4('0x3b')){var _0x55c9b1={};_0x55c9b1[_0x3c7981[_0x8fa4('0x22')]]={'$like':'%'+_0x1a00f4[_0x8fa4('0x2b')][_0x8fa4('0x39')]+'%'};return _0x55c9b1;}})});}_0x2f6940=_['merge']({},_0x2f6940,_0x1a00f4['options']);var _0x4298a9={'where':_0x2f6940[_0x8fa4('0x38')]};return db[_0x8fa4('0x25')][_0x8fa4('0x1a')](_0x4298a9)[_0x8fa4('0x1e')](function(_0x395ef1){_0x330f72[_0x8fa4('0x1a')]=_0x395ef1;if(_0x1a00f4[_0x8fa4('0x2b')][_0x8fa4('0x3c')]){_0x2f6940[_0x8fa4('0x3d')]=[{'all':!![]}];}return db[_0x8fa4('0x25')][_0x8fa4('0x3e')](_0x2f6940);})[_0x8fa4('0x1e')](function(_0x2ecc5f){_0x330f72[_0x8fa4('0x3f')]=_0x2ecc5f;return _0x330f72;})['then'](respondWithFilteredResult(_0x1328b7,_0x2f6940))['catch'](handleError(_0x1328b7,null));};exports[_0x8fa4('0x40')]=function(_0x1356a9,_0x33dc4b){var _0xd08024={'raw':!![],'where':{'id':_0x1356a9[_0x8fa4('0x41')]['id']}},_0x4b3a24={};_0x4b3a24[_0x8fa4('0x30')]=_[_0x8fa4('0x2c')](db[_0x8fa4('0x25')]['rawAttributes']);_0x4b3a24[_0x8fa4('0x2b')]=_[_0x8fa4('0x2c')](_0x1356a9['query']);_0x4b3a24[_0x8fa4('0x2d')]=_[_0x8fa4('0x2e')](_0x4b3a24[_0x8fa4('0x30')],_0x4b3a24['query']);_0xd08024[_0x8fa4('0x2f')]=_[_0x8fa4('0x2e')](_0x4b3a24['model'],qs['fields'](_0x1356a9[_0x8fa4('0x2b')][_0x8fa4('0x31')]));_0xd08024['attributes']=_0xd08024[_0x8fa4('0x2f')]['length']?_0xd08024[_0x8fa4('0x2f')]:_0x4b3a24[_0x8fa4('0x30')];if(_0x1356a9[_0x8fa4('0x2b')][_0x8fa4('0x3c')]){_0xd08024[_0x8fa4('0x3d')]=[{'all':!![]}];}_0xd08024=_[_0x8fa4('0x3a')]({},_0xd08024,_0x1356a9[_0x8fa4('0x42')]);return db[_0x8fa4('0x25')][_0x8fa4('0x43')](_0xd08024)[_0x8fa4('0x1e')](handleEntityNotFound(_0x33dc4b,null))[_0x8fa4('0x1e')](respondWithResult(_0x33dc4b,null))[_0x8fa4('0x44')](handleError(_0x33dc4b,null));};exports[_0x8fa4('0x45')]=function(_0x3a05c9,_0x4cb10b){return db[_0x8fa4('0x25')][_0x8fa4('0x45')](_0x3a05c9[_0x8fa4('0x46')],{})[_0x8fa4('0x1e')](respondWithResult(_0x4cb10b,0xc9))[_0x8fa4('0x44')](handleError(_0x4cb10b,null));};exports[_0x8fa4('0x47')]=function(_0x3ff5b0,_0x5650be){if(_0x3ff5b0['body']['id']){delete _0x3ff5b0['body']['id'];}return db[_0x8fa4('0x25')][_0x8fa4('0x43')]({'where':{'id':_0x3ff5b0['params']['id']}})['then'](handleEntityNotFound(_0x5650be,null))[_0x8fa4('0x1e')](saveUpdates(_0x3ff5b0['body'],null))['then'](respondWithResult(_0x5650be,null))[_0x8fa4('0x44')](handleError(_0x5650be,null));};exports['download']=function(_0x488b0c,_0x509e2c,_0x3b7701){var _0x5baf30=require(_0x8fa4('0x48'));var _0x543b7b=![];var _0x43cd2f={};if(_0x488b0c['query'][_0x8fa4('0x28')]&&_0x488b0c[_0x8fa4('0x2b')][_0x8fa4('0x28')]===_0x8fa4('0x49')){_0x43cd2f[_0x8fa4('0x49')]=_0x488b0c[_0x8fa4('0x41')]['id'];}else{_0x43cd2f['id']=_0x488b0c[_0x8fa4('0x41')]['id'];}return db['SquareRecording'][_0x8fa4('0x43')]({'where':_0x43cd2f,'attributes':['id',_0x8fa4('0x4a'),_0x8fa4('0x4b')],'raw':!![]})[_0x8fa4('0x1e')](handleEntityNotFound(_0x509e2c,null))['then'](function(_0x1e3598){if(_0x1e3598){var _0x169481=_0x1e3598['savePath'];var _0x310ff8=util[_0x8fa4('0x4c')]('%s.cypher',_0x169481);if(fs[_0x8fa4('0x4d')](_0x310ff8)){_0x543b7b=!![];return _0x5baf30[_0x8fa4('0x4e')](_0x310ff8,_0x169481,config[_0x8fa4('0x4f')][_0x8fa4('0x50')])[_0x8fa4('0x1e')](function(){return _0x1e3598;});}return _0x1e3598;}})[_0x8fa4('0x1e')](function(_0x1e8a65){if(_0x1e8a65){var _0x41e05c=_0x1e8a65[_0x8fa4('0x4a')];if(!fs[_0x8fa4('0x4d')](_0x41e05c)){throw new db[(_0x8fa4('0x51'))]['ValidationError'](_0x8fa4('0x52'));}if(_0x1e8a65[_0x8fa4('0x4b')]){return _0x509e2c[_0x8fa4('0x53')](_0x41e05c,_0x1e8a65[_0x8fa4('0x4b')]+path[_0x8fa4('0x54')](_0x41e05c),function(){if(_0x543b7b){fs[_0x8fa4('0x55')](_0x41e05c);}});}else{return _0x509e2c[_0x8fa4('0x53')](_0x41e05c,function(_0x36f96d){if(_0x543b7b){fs['unlink'](_0x41e05c);}});}}})[_0x8fa4('0x44')](function(_0x97b2e6){if(_0x97b2e6[_0x8fa4('0x56')]===_0x8fa4('0x52')){_0x509e2c[_0x8fa4('0x18')](0x194)[_0x8fa4('0x23')](_0x8fa4('0x57'));}else{return handleError(_0x509e2c,null);}});};exports['destroy']=function(_0x57cc8f,_0x3ced88){return db['SquareRecording']['find']({'where':{'id':_0x57cc8f[_0x8fa4('0x41')]['id']}})['then'](function(_0x3d0f43){if(!_0x3d0f43)throw new ReferenceError(_0x8fa4('0x58'));return _0x3d0f43;})[_0x8fa4('0x1e')](function(_0x5afde0){var _0x7c17a0=_0x5afde0[_0x8fa4('0x4a')];logger[_0x8fa4('0x59')]('cancellazione\x20fisica\x20documento\x20%s',_0x7c17a0);if(!_[_0x8fa4('0x5a')](_0x5afde0[_0x8fa4('0x4a')])&&fs[_0x8fa4('0x4d')](_0x7c17a0)){logger[_0x8fa4('0x59')]('File:\x20\x22'+_0x7c17a0+_0x8fa4('0x5b'));fs['unlinkSync'](_0x7c17a0);}_0x7c17a0=_0x7c17a0+_0x8fa4('0x5c');if(!_[_0x8fa4('0x5a')](_0x5afde0[_0x8fa4('0x4a')])&&fs[_0x8fa4('0x4d')](_0x7c17a0)){logger[_0x8fa4('0x59')](_0x8fa4('0x5d')+_0x7c17a0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8fa4('0x5e')](_0x7c17a0);}return _0x5afde0;})['then'](function(_0x5b5e5d){if(!_0x5b5e5d)throw new InternalError();return _0x5b5e5d[_0x8fa4('0x1f')]();})[_0x8fa4('0x1e')](function(){_0x3ced88['status'](0xcc)[_0x8fa4('0x20')]();})['catch'](handleError(_0x3ced88,null));}; \ No newline at end of file +var _0x1f62=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','end','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','update','uniqueid','savePath','%s.cypher','existsSync','decryptFile','recording','Sequelize','SquareRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto'];(function(_0x35bf0a,_0x21776e){var _0x9d5213=function(_0x270d2a){while(--_0x270d2a){_0x35bf0a['push'](_0x35bf0a['shift']());}};_0x9d5213(++_0x21776e);}(_0x1f62,0x112));var _0x21f6=function(_0x3df186,_0x12592c){_0x3df186=_0x3df186-0x0;var _0x5440fc=_0x1f62[_0x3df186];return _0x5440fc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x21f6('0x0'));var rimraf=require(_0x21f6('0x1'));var zipdir=require(_0x21f6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21f6('0x3'));var moment=require(_0x21f6('0x4'));var BPromise=require(_0x21f6('0x5'));var Mustache=require(_0x21f6('0x6'));var util=require(_0x21f6('0x7'));var path=require(_0x21f6('0x8'));var sox=require(_0x21f6('0x9'));var csv=require(_0x21f6('0xa'));var ejs=require(_0x21f6('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x21f6('0xc'));var crypto=require(_0x21f6('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x21f6('0xa'));var querystring=require(_0x21f6('0xe'));var Papa=require(_0x21f6('0xf'));var Redis=require(_0x21f6('0x10'));var authService=require(_0x21f6('0x11'));var qs=require(_0x21f6('0x12'));var as=require(_0x21f6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x21f6('0x14'));var utils=require(_0x21f6('0x15'));var config=require(_0x21f6('0x16'));var db=require(_0x21f6('0x17'))['db'];function respondWithStatusCode(_0x1dad5a,_0x5675c8){_0x5675c8=_0x5675c8||0xcc;return function(_0x2db94a){if(_0x2db94a){return _0x1dad5a['sendStatus'](_0x5675c8);}return _0x1dad5a[_0x21f6('0x18')](_0x5675c8)['end']();};}function respondWithResult(_0x410eca,_0x1ad1a8){_0x1ad1a8=_0x1ad1a8||0xc8;return function(_0xccf98e){if(_0xccf98e){return _0x410eca[_0x21f6('0x18')](_0x1ad1a8)[_0x21f6('0x19')](_0xccf98e);}};}function respondWithFilteredResult(_0x32dab2,_0x511e2e){return function(_0x30c7d0){if(_0x30c7d0){var _0x426f22=_0x30c7d0[_0x21f6('0x1a')],_0x5e4d3d=_0x511e2e[_0x21f6('0x1b')],_0x3ade48=_0x511e2e[_0x21f6('0x1b')]+_0x511e2e[_0x21f6('0x1c')],_0x784bb6;if(_0x3ade48>=_0x426f22){_0x3ade48=_0x426f22;_0x784bb6=0xc8;}else{_0x784bb6=0xce;}_0x32dab2['status'](_0x784bb6);return _0x32dab2[_0x21f6('0x1d')](_0x21f6('0x1e'),_0x5e4d3d+'-'+_0x3ade48+'/'+_0x426f22)[_0x21f6('0x19')](_0x30c7d0);}return null;};}function patchUpdates(_0x1904e1){return function(_0x397169){try{jsonpatch[_0x21f6('0x1f')](_0x397169,_0x1904e1,!![]);}catch(_0x82ea26){return BPromise[_0x21f6('0x20')](_0x82ea26);}return _0x397169['save']();};}function saveUpdates(_0x4966b7,_0x402dbd){return function(_0x4bdb0d){if(_0x4bdb0d){return _0x4bdb0d['update'](_0x4966b7)[_0x21f6('0x21')](function(_0x5f599b){return _0x5f599b;});}return null;};}function removeEntity(_0x5ed919,_0x9f7aa1){return function(_0x456f36){if(_0x456f36){return _0x456f36[_0x21f6('0x22')]()['then'](function(){_0x5ed919[_0x21f6('0x18')](0xcc)[_0x21f6('0x23')]();});}};}function handleEntityNotFound(_0x45116b,_0x3d7e80){return function(_0x2a6c70){if(!_0x2a6c70){_0x45116b[_0x21f6('0x24')](0x194);}return _0x2a6c70;};}function handleError(_0x1ce8e8,_0x5b311e){_0x5b311e=_0x5b311e||0x1f4;return function(_0x2b036a){logger[_0x21f6('0x25')](_0x2b036a[_0x21f6('0x26')]);if(_0x2b036a[_0x21f6('0x27')]){delete _0x2b036a[_0x21f6('0x27')];}_0x1ce8e8['status'](_0x5b311e)[_0x21f6('0x28')](_0x2b036a);};}exports[_0x21f6('0x29')]=function(_0x5943e4,_0x204ce0){var _0x14028b={},_0xd1366c={},_0x12af4f={'count':0x0,'rows':[]};var _0x21112a=_[_0x21f6('0x2a')](db[_0x21f6('0x2b')][_0x21f6('0x2c')],function(_0x5a0a31){return{'name':_0x5a0a31['fieldName'],'type':_0x5a0a31[_0x21f6('0x2d')]['key']};});_0xd1366c[_0x21f6('0x2e')]=_[_0x21f6('0x2a')](_0x21112a,'name');_0xd1366c['query']=_['keys'](_0x5943e4[_0x21f6('0x2f')]);_0xd1366c[_0x21f6('0x30')]=_[_0x21f6('0x31')](_0xd1366c[_0x21f6('0x2e')],_0xd1366c[_0x21f6('0x2f')]);_0x14028b[_0x21f6('0x32')]=_['intersection'](_0xd1366c[_0x21f6('0x2e')],qs['fields'](_0x5943e4[_0x21f6('0x2f')][_0x21f6('0x33')]));_0x14028b['attributes']=_0x14028b['attributes'][_0x21f6('0x34')]?_0x14028b[_0x21f6('0x32')]:_0xd1366c[_0x21f6('0x2e')];if(!_0x5943e4[_0x21f6('0x2f')][_0x21f6('0x35')](_0x21f6('0x36'))){_0x14028b[_0x21f6('0x1c')]=qs[_0x21f6('0x1c')](_0x5943e4['query'][_0x21f6('0x1c')]);_0x14028b[_0x21f6('0x1b')]=qs[_0x21f6('0x1b')](_0x5943e4[_0x21f6('0x2f')][_0x21f6('0x1b')]);}_0x14028b[_0x21f6('0x37')]=qs[_0x21f6('0x38')](_0x5943e4[_0x21f6('0x2f')]['sort']);_0x14028b[_0x21f6('0x39')]=qs[_0x21f6('0x30')](_[_0x21f6('0x3a')](_0x5943e4[_0x21f6('0x2f')],_0xd1366c[_0x21f6('0x30')]));if(_0x5943e4[_0x21f6('0x2f')][_0x21f6('0x3b')]){_0x14028b['where']=_[_0x21f6('0x3c')](_0x14028b[_0x21f6('0x39')],{'$or':_['map'](_0x21112a,function(_0xe15895){if(_0xe15895[_0x21f6('0x2d')]!=='VIRTUAL'){var _0x1188d0={};_0x1188d0[_0xe15895[_0x21f6('0x27')]]={'$like':'%'+_0x5943e4['query'][_0x21f6('0x3b')]+'%'};return _0x1188d0;}})});}_0x14028b=_[_0x21f6('0x3c')]({},_0x14028b,_0x5943e4[_0x21f6('0x3d')]);var _0x297cf4={'where':_0x14028b[_0x21f6('0x39')]};return db[_0x21f6('0x2b')][_0x21f6('0x1a')](_0x297cf4)[_0x21f6('0x21')](function(_0x3f5235){_0x12af4f['count']=_0x3f5235;if(_0x5943e4[_0x21f6('0x2f')]['includeAll']){_0x14028b[_0x21f6('0x3e')]=[{'all':!![]}];}return db['SquareRecording'][_0x21f6('0x3f')](_0x14028b);})['then'](function(_0x3f04dd){_0x12af4f[_0x21f6('0x40')]=_0x3f04dd;return _0x12af4f;})[_0x21f6('0x21')](respondWithFilteredResult(_0x204ce0,_0x14028b))['catch'](handleError(_0x204ce0,null));};exports[_0x21f6('0x41')]=function(_0x8619d,_0x52834b){var _0x498f32={'raw':!![],'where':{'id':_0x8619d[_0x21f6('0x42')]['id']}},_0x4c9a0d={};_0x4c9a0d['model']=_[_0x21f6('0x43')](db[_0x21f6('0x2b')][_0x21f6('0x2c')]);_0x4c9a0d[_0x21f6('0x2f')]=_['keys'](_0x8619d['query']);_0x4c9a0d['filters']=_[_0x21f6('0x31')](_0x4c9a0d[_0x21f6('0x2e')],_0x4c9a0d['query']);_0x498f32[_0x21f6('0x32')]=_[_0x21f6('0x31')](_0x4c9a0d[_0x21f6('0x2e')],qs[_0x21f6('0x33')](_0x8619d[_0x21f6('0x2f')][_0x21f6('0x33')]));_0x498f32[_0x21f6('0x32')]=_0x498f32[_0x21f6('0x32')][_0x21f6('0x34')]?_0x498f32['attributes']:_0x4c9a0d['model'];if(_0x8619d[_0x21f6('0x2f')][_0x21f6('0x44')]){_0x498f32['include']=[{'all':!![]}];}_0x498f32=_[_0x21f6('0x3c')]({},_0x498f32,_0x8619d[_0x21f6('0x3d')]);return db[_0x21f6('0x2b')][_0x21f6('0x45')](_0x498f32)[_0x21f6('0x21')](handleEntityNotFound(_0x52834b,null))[_0x21f6('0x21')](respondWithResult(_0x52834b,null))[_0x21f6('0x46')](handleError(_0x52834b,null));};exports[_0x21f6('0x47')]=function(_0xeea72d,_0x1ba3a1){return db[_0x21f6('0x2b')][_0x21f6('0x47')](_0xeea72d[_0x21f6('0x48')],{})[_0x21f6('0x21')](respondWithResult(_0x1ba3a1,0xc9))['catch'](handleError(_0x1ba3a1,null));};exports[_0x21f6('0x49')]=function(_0x1c18ee,_0x2a25c1){if(_0x1c18ee[_0x21f6('0x48')]['id']){delete _0x1c18ee[_0x21f6('0x48')]['id'];}return db[_0x21f6('0x2b')][_0x21f6('0x45')]({'where':{'id':_0x1c18ee[_0x21f6('0x42')]['id']}})[_0x21f6('0x21')](handleEntityNotFound(_0x2a25c1,null))[_0x21f6('0x21')](saveUpdates(_0x1c18ee['body'],null))[_0x21f6('0x21')](respondWithResult(_0x2a25c1,null))[_0x21f6('0x46')](handleError(_0x2a25c1,null));};exports['download']=function(_0x17aa4d,_0x1bd805,_0x5921c0){var _0x245102=require('../../components/encryptor');var _0x2ce019=![];var _0x280307={};if(_0x17aa4d[_0x21f6('0x2f')][_0x21f6('0x2d')]&&_0x17aa4d[_0x21f6('0x2f')][_0x21f6('0x2d')]===_0x21f6('0x4a')){_0x280307[_0x21f6('0x4a')]=_0x17aa4d[_0x21f6('0x42')]['id'];}else{_0x280307['id']=_0x17aa4d[_0x21f6('0x42')]['id'];}return db[_0x21f6('0x2b')][_0x21f6('0x45')]({'where':_0x280307,'attributes':['id','savePath','filename'],'raw':!![]})[_0x21f6('0x21')](handleEntityNotFound(_0x1bd805,null))[_0x21f6('0x21')](function(_0x388461){if(_0x388461){var _0x4dbb21=_0x388461[_0x21f6('0x4b')];var _0x1d41a4=util['format'](_0x21f6('0x4c'),_0x4dbb21);if(fs[_0x21f6('0x4d')](_0x1d41a4)){_0x2ce019=!![];return _0x245102[_0x21f6('0x4e')](_0x1d41a4,_0x4dbb21,config['secrets'][_0x21f6('0x4f')])['then'](function(){return _0x388461;});}return _0x388461;}})[_0x21f6('0x21')](function(_0x42df36){if(_0x42df36){var _0x5d6e98=_0x42df36['savePath'];if(!fs[_0x21f6('0x4d')](_0x5d6e98)){throw new db[(_0x21f6('0x50'))]['ValidationError'](_0x21f6('0x51'));}if(_0x42df36[_0x21f6('0x52')]){return _0x1bd805[_0x21f6('0x53')](_0x5d6e98,_0x42df36[_0x21f6('0x52')]+path[_0x21f6('0x54')](_0x5d6e98),function(){if(_0x2ce019){fs[_0x21f6('0x55')](_0x5d6e98);}});}else{return _0x1bd805[_0x21f6('0x53')](_0x5d6e98,function(_0x33f4fe){if(_0x2ce019){fs[_0x21f6('0x55')](_0x5d6e98);}});}}})[_0x21f6('0x46')](function(_0x30398e){if(_0x30398e[_0x21f6('0x56')]===_0x21f6('0x51')){_0x1bd805[_0x21f6('0x18')](0x194)['send'](_0x21f6('0x57'));}else{return handleError(_0x1bd805,null);}});};exports[_0x21f6('0x22')]=function(_0x5b63b8,_0x133cb8){return db['SquareRecording'][_0x21f6('0x45')]({'where':{'id':_0x5b63b8[_0x21f6('0x42')]['id']}})['then'](function(_0x4b48f1){if(!_0x4b48f1)throw new ReferenceError(_0x21f6('0x58'));return _0x4b48f1;})[_0x21f6('0x21')](function(_0x330b1e){var _0x24a4ae=_0x330b1e[_0x21f6('0x4b')];logger[_0x21f6('0x59')](_0x21f6('0x5a'),_0x24a4ae);if(!_[_0x21f6('0x5b')](_0x330b1e[_0x21f6('0x4b')])&&fs[_0x21f6('0x4d')](_0x24a4ae)){logger[_0x21f6('0x59')]('File:\x20\x22'+_0x24a4ae+_0x21f6('0x5c'));fs[_0x21f6('0x5d')](_0x24a4ae);}_0x24a4ae=_0x24a4ae+_0x21f6('0x5e');if(!_[_0x21f6('0x5b')](_0x330b1e['savePath'])&&fs[_0x21f6('0x4d')](_0x24a4ae)){logger[_0x21f6('0x59')](_0x21f6('0x5f')+_0x24a4ae+_0x21f6('0x5c'));fs[_0x21f6('0x5d')](_0x24a4ae);}return _0x330b1e;})[_0x21f6('0x21')](function(_0x54aebe){if(!_0x54aebe)throw new InternalError();return _0x54aebe[_0x21f6('0x22')]();})[_0x21f6('0x21')](function(){_0x133cb8['status'](0xcc)['end']();})[_0x21f6('0x46')](handleError(_0x133cb8,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index b7307cb..ea60b8f 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 _0x2ace=['api','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','util','../../config/logger'];(function(_0x3f0ac2,_0x334ebb){var _0x25e0bb=function(_0x1e0235){while(--_0x1e0235){_0x3f0ac2['push'](_0x3f0ac2['shift']());}};_0x25e0bb(++_0x334ebb);}(_0x2ace,0x17e));var _0xe2ac=function(_0x38616d,_0x22fbe5){_0x38616d=_0x38616d-0x0;var _0x505626=_0x2ace[_0x38616d];return _0x505626;};'use strict';var _=require('lodash');var util=require(_0xe2ac('0x0'));var logger=require(_0xe2ac('0x1'))(_0xe2ac('0x2'));var moment=require('moment');var BPromise=require(_0xe2ac('0x3'));var rp=require(_0xe2ac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2ac('0x5'));var config=require(_0xe2ac('0x6'));var attributes=require(_0xe2ac('0x7'));module[_0xe2ac('0x8')]=function(_0x386b18,_0x46e9f3){return _0x386b18[_0xe2ac('0x9')](_0xe2ac('0xa'),attributes,{'tableName':_0xe2ac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b7f=['bluebird','request-promise','path','./squareRecording.attributes','exports','define','square_recordings','lodash','util','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b7f,0x115));var _0xf0b7=function(_0x19bdf5,_0x3a6395){_0x19bdf5=_0x19bdf5-0x0;var _0x140930=_0x0b7f[_0x19bdf5];return _0x140930;};'use strict';var _=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var logger=require('../../config/logger')(_0xf0b7('0x2'));var moment=require('moment');var BPromise=require(_0xf0b7('0x3'));var rp=require(_0xf0b7('0x4'));var fs=require('fs');var path=require(_0xf0b7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf0b7('0x6'));module[_0xf0b7('0x7')]=function(_0x77940d,_0x41c63d){return _0x77940d[_0xf0b7('0x8')]('SquareRecording',attributes,{'tableName':_0xf0b7('0x9'),'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 d59d2f3..197826f 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 _0xae54=['SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateSquareRecording','SquareRecording','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x9a9d4a,_0x449f80){var _0x1755e3=function(_0x3d7999){while(--_0x3d7999){_0x9a9d4a['push'](_0x9a9d4a['shift']());}};_0x1755e3(++_0x449f80);}(_0xae54,0x16e));var _0x4ae5=function(_0x13992d,_0x3029ea){_0x13992d=_0x13992d-0x0;var _0x3d15bf=_0xae54[_0x13992d];return _0x3d15bf;};'use strict';var _=require(_0x4ae5('0x0'));var util=require(_0x4ae5('0x1'));var moment=require(_0x4ae5('0x2'));var BPromise=require(_0x4ae5('0x3'));var rs=require(_0x4ae5('0x4'));var fs=require('fs');var Redis=require(_0x4ae5('0x5'));var db=require(_0x4ae5('0x6'))['db'];var utils=require(_0x4ae5('0x7'));var logger=require(_0x4ae5('0x8'))(_0x4ae5('0x9'));var config=require('../../config/environment');var jayson=require(_0x4ae5('0xa'));var client=jayson[_0x4ae5('0xb')][_0x4ae5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d8188,_0x68803b,_0x4be0aa){return new BPromise(function(_0x218e37,_0x5c15fe){return client[_0x4ae5('0xd')](_0x1d8188,_0x4be0aa)[_0x4ae5('0xe')](function(_0x1e6adf){logger['info'](_0x4ae5('0xf'),_0x68803b,_0x4ae5('0x10'));logger[_0x4ae5('0x11')](_0x4ae5('0x12'),_0x68803b,_0x4ae5('0x10'),JSON[_0x4ae5('0x13')](_0x1e6adf));if(_0x1e6adf[_0x4ae5('0x14')]){if(_0x1e6adf['error'][_0x4ae5('0x15')]===0x1f4){logger['error'](_0x4ae5('0xf'),_0x68803b,_0x1e6adf['error'][_0x4ae5('0x16')]);return _0x5c15fe(_0x1e6adf[_0x4ae5('0x14')]['message']);}logger[_0x4ae5('0x14')]('SquareRecording,\x20%s,\x20%s',_0x68803b,_0x1e6adf[_0x4ae5('0x14')][_0x4ae5('0x16')]);return _0x218e37(_0x1e6adf['error'][_0x4ae5('0x16')]);}else{logger[_0x4ae5('0x17')](_0x4ae5('0xf'),_0x68803b,_0x4ae5('0x10'));_0x218e37(_0x1e6adf[_0x4ae5('0x18')][_0x4ae5('0x16')]);}})['catch'](function(_0x51c276){logger['error']('SquareRecording,\x20%s,\x20%s',_0x68803b,_0x51c276);_0x5c15fe(_0x51c276);});});}exports[_0x4ae5('0x19')]=function(_0x45ac6c){var _0x27e144=this;return new Promise(function(_0x1b6779,_0x44cf3e){return db[_0x4ae5('0x1a')][_0x4ae5('0x1b')](_0x45ac6c[_0x4ae5('0x1c')],{'raw':_0x45ac6c[_0x4ae5('0x1d')]?_0x45ac6c[_0x4ae5('0x1d')][_0x4ae5('0x1e')]===undefined?!![]:![]:!![]})[_0x4ae5('0xe')](function(_0x56f2a2){logger[_0x4ae5('0x17')](_0x4ae5('0x19'),_0x45ac6c);logger[_0x4ae5('0x11')](_0x4ae5('0x19'),_0x45ac6c,JSON[_0x4ae5('0x13')](_0x56f2a2));_0x1b6779(_0x56f2a2);})[_0x4ae5('0x1f')](function(_0x42439f){logger[_0x4ae5('0x14')](_0x4ae5('0x19'),_0x42439f['message'],_0x45ac6c);_0x44cf3e(_0x27e144[_0x4ae5('0x14')](0x1f4,_0x42439f['message']));});});}; \ No newline at end of file +var _0x12c5=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','then','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5f1c76,_0x3ea554){var _0x394848=function(_0x39fc9b){while(--_0x39fc9b){_0x5f1c76['push'](_0x5f1c76['shift']());}};_0x394848(++_0x3ea554);}(_0x12c5,0x156));var _0x512c=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x12c5[_0x2283dc];return _0x16db90;};'use strict';var _=require(_0x512c('0x0'));var util=require(_0x512c('0x1'));var moment=require(_0x512c('0x2'));var BPromise=require(_0x512c('0x3'));var rs=require(_0x512c('0x4'));var fs=require('fs');var Redis=require(_0x512c('0x5'));var db=require(_0x512c('0x6'))['db'];var utils=require(_0x512c('0x7'));var logger=require(_0x512c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x512c('0x9'));var client=jayson[_0x512c('0xa')][_0x512c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45b2ae,_0x3345d6,_0x225d77){return new BPromise(function(_0x19b682,_0x3981b4){return client[_0x512c('0xc')](_0x45b2ae,_0x225d77)['then'](function(_0x519010){logger[_0x512c('0xd')](_0x512c('0xe'),_0x3345d6,'request\x20sent');logger[_0x512c('0xf')](_0x512c('0x10'),_0x3345d6,_0x512c('0x11'),JSON['stringify'](_0x519010));if(_0x519010[_0x512c('0x12')]){if(_0x519010[_0x512c('0x12')][_0x512c('0x13')]===0x1f4){logger[_0x512c('0x12')](_0x512c('0xe'),_0x3345d6,_0x519010[_0x512c('0x12')][_0x512c('0x14')]);return _0x3981b4(_0x519010[_0x512c('0x12')][_0x512c('0x14')]);}logger[_0x512c('0x12')](_0x512c('0xe'),_0x3345d6,_0x519010['error']['message']);return _0x19b682(_0x519010[_0x512c('0x12')][_0x512c('0x14')]);}else{logger[_0x512c('0xd')]('SquareRecording,\x20%s,\x20%s',_0x3345d6,_0x512c('0x11'));_0x19b682(_0x519010[_0x512c('0x15')][_0x512c('0x14')]);}})[_0x512c('0x16')](function(_0x22a4a5){logger[_0x512c('0x12')]('SquareRecording,\x20%s,\x20%s',_0x3345d6,_0x22a4a5);_0x3981b4(_0x22a4a5);});});}exports[_0x512c('0x17')]=function(_0x2f102b){var _0x33c108=this;return new Promise(function(_0x4f4f45,_0x486953){return db[_0x512c('0x18')][_0x512c('0x19')](_0x2f102b[_0x512c('0x1a')],{'raw':_0x2f102b[_0x512c('0x1b')]?_0x2f102b[_0x512c('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x512c('0x1c')](function(_0x2d253a){logger[_0x512c('0xd')]('CreateSquareRecording',_0x2f102b);logger[_0x512c('0xf')](_0x512c('0x17'),_0x2f102b,JSON['stringify'](_0x2d253a));_0x4f4f45(_0x2d253a);})[_0x512c('0x16')](function(_0x58adce){logger[_0x512c('0x12')](_0x512c('0x17'),_0x58adce[_0x512c('0x14')],_0x2f102b);_0x486953(_0x33c108[_0x512c('0x12')](0x1f4,_0x58adce['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index d7115af..7192abe 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 _0x4a66=['/:id','post','create','put','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','/describe','isAuthenticated'];(function(_0x206dad,_0x23ac23){var _0x39e2b1=function(_0x4cd187){while(--_0x4cd187){_0x206dad['push'](_0x206dad['shift']());}};_0x39e2b1(++_0x23ac23);}(_0x4a66,0x16c));var _0x64a6=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0x4a66[_0x31b5a5];return _0x364cc9;};'use strict';var multer=require(_0x64a6('0x0'));var util=require('util');var path=require(_0x64a6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x64a6('0x2')]();var auth=require(_0x64a6('0x3'));var interaction=require(_0x64a6('0x4'));var config=require(_0x64a6('0x5'));var controller=require(_0x64a6('0x6'));router[_0x64a6('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x64a6('0x7')](_0x64a6('0x8'),auth[_0x64a6('0x9')](),controller['describe']);router[_0x64a6('0x7')](_0x64a6('0xa'),auth[_0x64a6('0x9')](),controller['show']);router[_0x64a6('0xb')]('/',auth[_0x64a6('0x9')](),controller[_0x64a6('0xc')]);router[_0x64a6('0xd')](_0x64a6('0xa'),auth[_0x64a6('0x9')](),controller['update']);router[_0x64a6('0xe')]('/:id',auth[_0x64a6('0x9')](),controller[_0x64a6('0xf')]);module[_0x64a6('0x10')]=router; \ No newline at end of file +var _0x2175=['/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./squareReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x4c06ac,_0x568788){var _0x2333cb=function(_0xdb5c64){while(--_0xdb5c64){_0x4c06ac['push'](_0x4c06ac['shift']());}};_0x2333cb(++_0x568788);}(_0x2175,0x170));var _0x5217=function(_0x2d762d,_0x190e7a){_0x2d762d=_0x2d762d-0x0;var _0x2920d7=_0x2175[_0x2d762d];return _0x2920d7;};'use strict';var multer=require(_0x5217('0x0'));var util=require(_0x5217('0x1'));var path=require(_0x5217('0x2'));var timeout=require(_0x5217('0x3'));var express=require('express');var router=express[_0x5217('0x4')]();var auth=require(_0x5217('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5217('0x6'));router[_0x5217('0x7')]('/',auth[_0x5217('0x8')](),controller[_0x5217('0x9')]);router[_0x5217('0x7')](_0x5217('0xa'),auth['isAuthenticated'](),controller[_0x5217('0xb')]);router[_0x5217('0x7')](_0x5217('0xc'),auth[_0x5217('0x8')](),controller[_0x5217('0xd')]);router[_0x5217('0xe')]('/',auth[_0x5217('0x8')](),controller['create']);router[_0x5217('0xf')](_0x5217('0xc'),auth['isAuthenticated'](),controller[_0x5217('0x10')]);router['delete']('/:id',auth[_0x5217('0x8')](),controller[_0x5217('0x11')]);module[_0x5217('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index a7a02bc..f2e9216 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 _0xc7c2=['DATE','sequelize','exports','STRING'];(function(_0x422890,_0x434494){var _0x202cf0=function(_0x10e9f0){while(--_0x10e9f0){_0x422890['push'](_0x422890['shift']());}};_0x202cf0(++_0x434494);}(_0xc7c2,0x1a5));var _0x2c7c=function(_0xe58a50,_0x450b0b){_0xe58a50=_0xe58a50-0x0;var _0x10cd9c=_0xc7c2[_0xe58a50];return _0x10cd9c;};'use strict';var Sequelize=require(_0x2c7c('0x0'));module[_0x2c7c('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x2c7c('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2c7c('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2c7c('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2c7c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x2c7c('0x2')]},'callingani2':{'type':Sequelize[_0x2c7c('0x2')]},'callington':{'type':Sequelize[_0x2c7c('0x2')]},'callingtns':{'type':Sequelize[_0x2c7c('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2c7c('0x2')]},'extension':{'type':Sequelize[_0x2c7c('0x2')]},'priority':{'type':Sequelize[_0x2c7c('0x2')]},'enhanced':{'type':Sequelize[_0x2c7c('0x2')]},'accountcode':{'type':Sequelize[_0x2c7c('0x2')]},'threadid':{'type':Sequelize[_0x2c7c('0x2')]},'project_name':{'type':Sequelize[_0x2c7c('0x2')]},'joinAt':{'type':Sequelize[_0x2c7c('0x3')]},'leaveAt':{'type':Sequelize[_0x2c7c('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa16b=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x53d74f,_0x22463f){var _0x4cfd67=function(_0x516543){while(--_0x516543){_0x53d74f['push'](_0x53d74f['shift']());}};_0x4cfd67(++_0x22463f);}(_0xa16b,0x14b));var _0xba16=function(_0x3e0b7f,_0xc84c77){_0x3e0b7f=_0x3e0b7f-0x0;var _0x46b3ab=_0xa16b[_0x3e0b7f];return _0x46b3ab;};'use strict';var Sequelize=require(_0xba16('0x0'));module[_0xba16('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xba16('0x2')]},'request':{'type':Sequelize[_0xba16('0x2')]},'channel':{'type':Sequelize[_0xba16('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xba16('0x2')]},'uniqueid':{'type':Sequelize[_0xba16('0x2')]},'version':{'type':Sequelize[_0xba16('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xba16('0x2')]},'callingpres':{'type':Sequelize[_0xba16('0x2')]},'callingani2':{'type':Sequelize[_0xba16('0x2')]},'callington':{'type':Sequelize[_0xba16('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xba16('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xba16('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xba16('0x2')]},'enhanced':{'type':Sequelize[_0xba16('0x2')]},'accountcode':{'type':Sequelize[_0xba16('0x2')]},'threadid':{'type':Sequelize[_0xba16('0x2')]},'project_name':{'type':Sequelize[_0xba16('0x2')]},'joinAt':{'type':Sequelize[_0xba16('0x3')]},'leaveAt':{'type':Sequelize[_0xba16('0x3')]},'bot':{'type':Sequelize[_0xba16('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 dd3c373..108fb83 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 _0xe14b=['findAll','rows','catch','find','create','body','params','destroy','describe','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','error','stack','name','index','SquareReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x34219f,_0x57c485){var _0xd18eef=function(_0x574995){while(--_0x574995){_0x34219f['push'](_0x34219f['shift']());}};_0xd18eef(++_0x57c485);}(_0xe14b,0x93));var _0xbe14=function(_0x9fbe5b,_0xded2ab){_0x9fbe5b=_0x9fbe5b-0x0;var _0x23f73e=_0xe14b[_0x9fbe5b];return _0x23f73e;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];function respondWithStatusCode(_0x3d38c2,_0x27792f){_0x27792f=_0x27792f||0xcc;return function(_0x3b898d){if(_0x3b898d){return _0x3d38c2[_0xbe14('0x15')](_0x27792f);}return _0x3d38c2[_0xbe14('0x16')](_0x27792f)[_0xbe14('0x17')]();};}function respondWithResult(_0xa2cf72,_0x1e4826){_0x1e4826=_0x1e4826||0xc8;return function(_0x33fd54){if(_0x33fd54){return _0xa2cf72[_0xbe14('0x16')](_0x1e4826)['json'](_0x33fd54);}};}function respondWithFilteredResult(_0x55b3a7,_0x3f58f5){return function(_0x3dc4a9){if(_0x3dc4a9){var _0xf4ac9=_0x3dc4a9[_0xbe14('0x18')],_0x37ce4e=_0x3f58f5[_0xbe14('0x19')],_0x4e8f34=_0x3f58f5[_0xbe14('0x19')]+_0x3f58f5[_0xbe14('0x1a')],_0x21c789;if(_0x4e8f34>=_0xf4ac9){_0x4e8f34=_0xf4ac9;_0x21c789=0xc8;}else{_0x21c789=0xce;}_0x55b3a7[_0xbe14('0x16')](_0x21c789);return _0x55b3a7[_0xbe14('0x1b')]('Content-Range',_0x37ce4e+'-'+_0x4e8f34+'/'+_0xf4ac9)[_0xbe14('0x1c')](_0x3dc4a9);}return null;};}function patchUpdates(_0x456ca8){return function(_0x329588){try{jsonpatch[_0xbe14('0x1d')](_0x329588,_0x456ca8,!![]);}catch(_0x3249da){return BPromise[_0xbe14('0x1e')](_0x3249da);}return _0x329588['save']();};}function saveUpdates(_0x24f820,_0x4a1bbd){return function(_0x417c8d){if(_0x417c8d){return _0x417c8d[_0xbe14('0x1f')](_0x24f820)[_0xbe14('0x20')](function(_0x51dc0b){return _0x51dc0b;});}return null;};}function removeEntity(_0xe60f42,_0x56d845){return function(_0x3c1c85){if(_0x3c1c85){return _0x3c1c85['destroy']()[_0xbe14('0x20')](function(){_0xe60f42['status'](0xcc)[_0xbe14('0x17')]();});}};}function handleEntityNotFound(_0x3d3608,_0x505dbd){return function(_0x2da350){if(!_0x2da350){_0x3d3608['sendStatus'](0x194);}return _0x2da350;};}function handleError(_0x4587a8,_0x4851f8){_0x4851f8=_0x4851f8||0x1f4;return function(_0x36a21e){logger[_0xbe14('0x21')](_0x36a21e[_0xbe14('0x22')]);if(_0x36a21e[_0xbe14('0x23')]){delete _0x36a21e[_0xbe14('0x23')];}_0x4587a8[_0xbe14('0x16')](_0x4851f8)['send'](_0x36a21e);};}exports[_0xbe14('0x24')]=function(_0x1ba46a,_0x391556){var _0x169369={},_0x5dd475={},_0x16f884={'count':0x0,'rows':[]};var _0x29fc64=_['map'](db[_0xbe14('0x25')][_0xbe14('0x26')],function(_0x1c7cc7){return{'name':_0x1c7cc7[_0xbe14('0x27')],'type':_0x1c7cc7[_0xbe14('0x28')][_0xbe14('0x29')]};});_0x5dd475[_0xbe14('0x2a')]=_[_0xbe14('0x2b')](_0x29fc64,_0xbe14('0x23'));_0x5dd475[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](_0x1ba46a[_0xbe14('0x2c')]);_0x5dd475[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],_0x5dd475[_0xbe14('0x2c')]);_0x169369[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],qs[_0xbe14('0x31')](_0x1ba46a['query'][_0xbe14('0x31')]));_0x169369['attributes']=_0x169369['attributes'][_0xbe14('0x32')]?_0x169369['attributes']:_0x5dd475[_0xbe14('0x2a')];if(!_0x1ba46a[_0xbe14('0x2c')]['hasOwnProperty']('nolimit')){_0x169369['limit']=qs[_0xbe14('0x1a')](_0x1ba46a[_0xbe14('0x2c')]['limit']);_0x169369[_0xbe14('0x19')]=qs[_0xbe14('0x19')](_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x19')]);}_0x169369[_0xbe14('0x33')]=qs['sort'](_0x1ba46a['query'][_0xbe14('0x34')]);_0x169369['where']=qs['filters'](_['pick'](_0x1ba46a[_0xbe14('0x2c')],_0x5dd475[_0xbe14('0x2e')]));if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x35')]){_0x169369[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x169369[_0xbe14('0x36')],{'$or':_[_0xbe14('0x2b')](_0x29fc64,function(_0x2d9c12){if(_0x2d9c12[_0xbe14('0x28')]!==_0xbe14('0x38')){var _0x32c59d={};_0x32c59d[_0x2d9c12['name']]={'$like':'%'+_0x1ba46a['query'][_0xbe14('0x35')]+'%'};return _0x32c59d;}})});}_0x169369=_[_0xbe14('0x37')]({},_0x169369,_0x1ba46a[_0xbe14('0x39')]);var _0x520e09={'where':_0x169369[_0xbe14('0x36')]};return db[_0xbe14('0x25')][_0xbe14('0x18')](_0x520e09)[_0xbe14('0x20')](function(_0x3bd454){_0x16f884[_0xbe14('0x18')]=_0x3bd454;if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x3a')]){_0x169369[_0xbe14('0x3b')]=[{'all':!![]}];}return db['SquareReport'][_0xbe14('0x3c')](_0x169369);})[_0xbe14('0x20')](function(_0x3463c4){_0x16f884[_0xbe14('0x3d')]=_0x3463c4;return _0x16f884;})[_0xbe14('0x20')](respondWithFilteredResult(_0x391556,_0x169369))[_0xbe14('0x3e')](handleError(_0x391556,null));};exports['show']=function(_0xb0f143,_0x1974a4){var _0x1220c9={'raw':!![],'where':{'id':_0xb0f143['params']['id']}},_0x36263c={};_0x36263c['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x25')][_0xbe14('0x26')]);_0x36263c['query']=_['keys'](_0xb0f143[_0xbe14('0x2c')]);_0x36263c['filters']=_['intersection'](_0x36263c[_0xbe14('0x2a')],_0x36263c[_0xbe14('0x2c')]);_0x1220c9[_0xbe14('0x30')]=_['intersection'](_0x36263c['model'],qs['fields'](_0xb0f143[_0xbe14('0x2c')][_0xbe14('0x31')]));_0x1220c9[_0xbe14('0x30')]=_0x1220c9['attributes'][_0xbe14('0x32')]?_0x1220c9[_0xbe14('0x30')]:_0x36263c[_0xbe14('0x2a')];if(_0xb0f143[_0xbe14('0x2c')]['includeAll']){_0x1220c9['include']=[{'all':!![]}];}_0x1220c9=_[_0xbe14('0x37')]({},_0x1220c9,_0xb0f143[_0xbe14('0x39')]);return db[_0xbe14('0x25')][_0xbe14('0x3f')](_0x1220c9)[_0xbe14('0x20')](handleEntityNotFound(_0x1974a4,null))['then'](respondWithResult(_0x1974a4,null))['catch'](handleError(_0x1974a4,null));};exports[_0xbe14('0x40')]=function(_0x2a3623,_0x238c60){return db[_0xbe14('0x25')]['create'](_0x2a3623[_0xbe14('0x41')],{})[_0xbe14('0x20')](respondWithResult(_0x238c60,0xc9))['catch'](handleError(_0x238c60,null));};exports[_0xbe14('0x1f')]=function(_0x2a35e5,_0x2d6ee8){if(_0x2a35e5[_0xbe14('0x41')]['id']){delete _0x2a35e5['body']['id'];}return db['SquareReport'][_0xbe14('0x3f')]({'where':{'id':_0x2a35e5[_0xbe14('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d6ee8,null))['then'](saveUpdates(_0x2a35e5[_0xbe14('0x41')],null))[_0xbe14('0x20')](respondWithResult(_0x2d6ee8,null))[_0xbe14('0x3e')](handleError(_0x2d6ee8,null));};exports[_0xbe14('0x43')]=function(_0xdbc6e1,_0xd04fd5){return db[_0xbe14('0x25')]['find']({'where':{'id':_0xdbc6e1[_0xbe14('0x42')]['id']}})[_0xbe14('0x20')](handleEntityNotFound(_0xd04fd5,null))[_0xbe14('0x20')](removeEntity(_0xd04fd5,null))[_0xbe14('0x3e')](handleError(_0xd04fd5,null));};exports[_0xbe14('0x44')]=function(_0x494c32,_0x3a221b){return db[_0xbe14('0x25')][_0xbe14('0x44')]()[_0xbe14('0x20')](respondWithResult(_0x3a221b,null))[_0xbe14('0x3e')](handleError(_0x3a221b,null));}; \ No newline at end of file +var _0x53ec=['key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','rows','show','rawAttributes','options','find','catch','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','SquareReport','fieldName','type'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x53ec,0x192));var _0xc53e=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x53ec[_0x1b4b23];return _0x2a325b;};'use strict';var pdf=require(_0xc53e('0x0'));var emlformat=require(_0xc53e('0x1'));var rimraf=require(_0xc53e('0x2'));var zipdir=require(_0xc53e('0x3'));var jsonpatch=require(_0xc53e('0x4'));var rp=require(_0xc53e('0x5'));var moment=require('moment');var BPromise=require(_0xc53e('0x6'));var Mustache=require('mustache');var util=require(_0xc53e('0x7'));var path=require(_0xc53e('0x8'));var sox=require('sox');var csv=require(_0xc53e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0x9'));var querystring=require(_0xc53e('0xe'));var Papa=require(_0xc53e('0xf'));var Redis=require(_0xc53e('0x10'));var authService=require(_0xc53e('0x11'));var qs=require(_0xc53e('0x12'));var as=require(_0xc53e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc53e('0x15'))['db'];function respondWithStatusCode(_0x9ffbcb,_0x863fa){_0x863fa=_0x863fa||0xcc;return function(_0x4203aa){if(_0x4203aa){return _0x9ffbcb['sendStatus'](_0x863fa);}return _0x9ffbcb['status'](_0x863fa)[_0xc53e('0x16')]();};}function respondWithResult(_0x19a772,_0x7cd798){_0x7cd798=_0x7cd798||0xc8;return function(_0x3d2e17){if(_0x3d2e17){return _0x19a772[_0xc53e('0x17')](_0x7cd798)[_0xc53e('0x18')](_0x3d2e17);}};}function respondWithFilteredResult(_0x3dc2fa,_0x19c0d1){return function(_0x455e4d){if(_0x455e4d){var _0x2ad6eb=_0x455e4d[_0xc53e('0x19')],_0x5b0a88=_0x19c0d1[_0xc53e('0x1a')],_0x8a522e=_0x19c0d1[_0xc53e('0x1a')]+_0x19c0d1[_0xc53e('0x1b')],_0x191567;if(_0x8a522e>=_0x2ad6eb){_0x8a522e=_0x2ad6eb;_0x191567=0xc8;}else{_0x191567=0xce;}_0x3dc2fa[_0xc53e('0x17')](_0x191567);return _0x3dc2fa[_0xc53e('0x1c')](_0xc53e('0x1d'),_0x5b0a88+'-'+_0x8a522e+'/'+_0x2ad6eb)['json'](_0x455e4d);}return null;};}function patchUpdates(_0x546fab){return function(_0x35b7b2){try{jsonpatch[_0xc53e('0x1e')](_0x35b7b2,_0x546fab,!![]);}catch(_0x421641){return BPromise[_0xc53e('0x1f')](_0x421641);}return _0x35b7b2[_0xc53e('0x20')]();};}function saveUpdates(_0x2cfe2b,_0x15a015){return function(_0x25702b){if(_0x25702b){return _0x25702b[_0xc53e('0x21')](_0x2cfe2b)[_0xc53e('0x22')](function(_0x17d825){return _0x17d825;});}return null;};}function removeEntity(_0x44fd93,_0x426467){return function(_0x4fb695){if(_0x4fb695){return _0x4fb695['destroy']()['then'](function(){_0x44fd93[_0xc53e('0x17')](0xcc)[_0xc53e('0x16')]();});}};}function handleEntityNotFound(_0x7591c1,_0x4015c8){return function(_0x180811){if(!_0x180811){_0x7591c1['sendStatus'](0x194);}return _0x180811;};}function handleError(_0x5e5377,_0xe06e42){_0xe06e42=_0xe06e42||0x1f4;return function(_0x496167){logger[_0xc53e('0x23')](_0x496167[_0xc53e('0x24')]);if(_0x496167[_0xc53e('0x25')]){delete _0x496167[_0xc53e('0x25')];}_0x5e5377[_0xc53e('0x17')](_0xe06e42)['send'](_0x496167);};}exports[_0xc53e('0x26')]=function(_0x4b9f6a,_0x4d9a68){var _0x5c65d3={},_0x3c5056={},_0x57a1f5={'count':0x0,'rows':[]};var _0x28240a=_['map'](db[_0xc53e('0x27')]['rawAttributes'],function(_0x5ce216){return{'name':_0x5ce216[_0xc53e('0x28')],'type':_0x5ce216[_0xc53e('0x29')][_0xc53e('0x2a')]};});_0x3c5056[_0xc53e('0x2b')]=_[_0xc53e('0x2c')](_0x28240a,_0xc53e('0x25'));_0x3c5056[_0xc53e('0x2d')]=_[_0xc53e('0x2e')](_0x4b9f6a['query']);_0x3c5056[_0xc53e('0x2f')]=_[_0xc53e('0x30')](_0x3c5056[_0xc53e('0x2b')],_0x3c5056['query']);_0x5c65d3[_0xc53e('0x31')]=_['intersection'](_0x3c5056[_0xc53e('0x2b')],qs[_0xc53e('0x32')](_0x4b9f6a['query']['fields']));_0x5c65d3[_0xc53e('0x31')]=_0x5c65d3[_0xc53e('0x31')][_0xc53e('0x33')]?_0x5c65d3[_0xc53e('0x31')]:_0x3c5056[_0xc53e('0x2b')];if(!_0x4b9f6a[_0xc53e('0x2d')][_0xc53e('0x34')](_0xc53e('0x35'))){_0x5c65d3['limit']=qs[_0xc53e('0x1b')](_0x4b9f6a[_0xc53e('0x2d')][_0xc53e('0x1b')]);_0x5c65d3[_0xc53e('0x1a')]=qs[_0xc53e('0x1a')](_0x4b9f6a[_0xc53e('0x2d')][_0xc53e('0x1a')]);}_0x5c65d3[_0xc53e('0x36')]=qs[_0xc53e('0x37')](_0x4b9f6a['query'][_0xc53e('0x37')]);_0x5c65d3['where']=qs[_0xc53e('0x2f')](_[_0xc53e('0x38')](_0x4b9f6a['query'],_0x3c5056[_0xc53e('0x2f')]));if(_0x4b9f6a[_0xc53e('0x2d')][_0xc53e('0x39')]){_0x5c65d3['where']=_[_0xc53e('0x3a')](_0x5c65d3[_0xc53e('0x3b')],{'$or':_[_0xc53e('0x2c')](_0x28240a,function(_0x78eb5e){if(_0x78eb5e[_0xc53e('0x29')]!==_0xc53e('0x3c')){var _0x312c1b={};_0x312c1b[_0x78eb5e['name']]={'$like':'%'+_0x4b9f6a[_0xc53e('0x2d')][_0xc53e('0x39')]+'%'};return _0x312c1b;}})});}_0x5c65d3=_[_0xc53e('0x3a')]({},_0x5c65d3,_0x4b9f6a['options']);var _0x70b6c3={'where':_0x5c65d3['where']};return db[_0xc53e('0x27')][_0xc53e('0x19')](_0x70b6c3)[_0xc53e('0x22')](function(_0xad1232){_0x57a1f5[_0xc53e('0x19')]=_0xad1232;if(_0x4b9f6a['query'][_0xc53e('0x3d')]){_0x5c65d3[_0xc53e('0x3e')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x5c65d3);})['then'](function(_0x52cf0a){_0x57a1f5[_0xc53e('0x3f')]=_0x52cf0a;return _0x57a1f5;})[_0xc53e('0x22')](respondWithFilteredResult(_0x4d9a68,_0x5c65d3))['catch'](handleError(_0x4d9a68,null));};exports[_0xc53e('0x40')]=function(_0x574983,_0x55d07d){var _0x53447e={'raw':!![],'where':{'id':_0x574983['params']['id']}},_0x255794={};_0x255794['model']=_[_0xc53e('0x2e')](db['SquareReport'][_0xc53e('0x41')]);_0x255794[_0xc53e('0x2d')]=_['keys'](_0x574983[_0xc53e('0x2d')]);_0x255794[_0xc53e('0x2f')]=_['intersection'](_0x255794[_0xc53e('0x2b')],_0x255794['query']);_0x53447e['attributes']=_['intersection'](_0x255794['model'],qs[_0xc53e('0x32')](_0x574983[_0xc53e('0x2d')][_0xc53e('0x32')]));_0x53447e['attributes']=_0x53447e[_0xc53e('0x31')][_0xc53e('0x33')]?_0x53447e['attributes']:_0x255794['model'];if(_0x574983[_0xc53e('0x2d')][_0xc53e('0x3d')]){_0x53447e[_0xc53e('0x3e')]=[{'all':!![]}];}_0x53447e=_['merge']({},_0x53447e,_0x574983[_0xc53e('0x42')]);return db[_0xc53e('0x27')][_0xc53e('0x43')](_0x53447e)[_0xc53e('0x22')](handleEntityNotFound(_0x55d07d,null))[_0xc53e('0x22')](respondWithResult(_0x55d07d,null))[_0xc53e('0x44')](handleError(_0x55d07d,null));};exports[_0xc53e('0x45')]=function(_0x49b2e8,_0xed757e){return db[_0xc53e('0x27')][_0xc53e('0x45')](_0x49b2e8['body'],{})[_0xc53e('0x22')](respondWithResult(_0xed757e,0xc9))[_0xc53e('0x44')](handleError(_0xed757e,null));};exports[_0xc53e('0x21')]=function(_0x15e744,_0xa7d256){if(_0x15e744[_0xc53e('0x46')]['id']){delete _0x15e744['body']['id'];}return db[_0xc53e('0x27')][_0xc53e('0x43')]({'where':{'id':_0x15e744[_0xc53e('0x47')]['id']}})['then'](handleEntityNotFound(_0xa7d256,null))[_0xc53e('0x22')](saveUpdates(_0x15e744[_0xc53e('0x46')],null))[_0xc53e('0x22')](respondWithResult(_0xa7d256,null))[_0xc53e('0x44')](handleError(_0xa7d256,null));};exports[_0xc53e('0x48')]=function(_0x1ac62e,_0x1a5a8f){return db[_0xc53e('0x27')][_0xc53e('0x43')]({'where':{'id':_0x1ac62e[_0xc53e('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a5a8f,null))[_0xc53e('0x22')](removeEntity(_0x1a5a8f,null))[_0xc53e('0x44')](handleError(_0x1a5a8f,null));};exports[_0xc53e('0x49')]=function(_0x3d74ac,_0x136544){return db['SquareReport']['describe']()[_0xc53e('0x22')](respondWithResult(_0x136544,null))['catch'](handleError(_0x136544,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 7c23b41..f425d06 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 _0xb2ab=['uid_pname','project_name','leaveAt','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareReport'];(function(_0x51b698,_0x2fd161){var _0xfa0590=function(_0x3741ce){while(--_0x3741ce){_0x51b698['push'](_0x51b698['shift']());}};_0xfa0590(++_0x2fd161);}(_0xb2ab,0x6c));var _0xbb2a=function(_0x41ce3b,_0x571ba3){_0x41ce3b=_0x41ce3b-0x0;var _0x14f8cf=_0xb2ab[_0x41ce3b];return _0x14f8cf;};'use strict';var _=require(_0xbb2a('0x0'));var util=require(_0xbb2a('0x1'));var logger=require('../../config/logger')(_0xbb2a('0x2'));var moment=require(_0xbb2a('0x3'));var BPromise=require(_0xbb2a('0x4'));var rp=require(_0xbb2a('0x5'));var fs=require('fs');var path=require(_0xbb2a('0x6'));var rimraf=require(_0xbb2a('0x7'));var config=require(_0xbb2a('0x8'));var attributes=require('./squareReport.attributes');module[_0xbb2a('0x9')]=function(_0xa6bdb6,_0x289af1){return _0xa6bdb6[_0xbb2a('0xa')](_0xbb2a('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xbb2a('0xc'),'fields':['uniqueid',_0xbb2a('0xd')]},{'name':_0xbb2a('0xe'),'fields':[_0xbb2a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x89a7=['../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','api','moment','bluebird','request-promise','rimraf'];(function(_0x15709b,_0x537ee3){var _0x2a2192=function(_0xa0dfc1){while(--_0xa0dfc1){_0x15709b['push'](_0x15709b['shift']());}};_0x2a2192(++_0x537ee3);}(_0x89a7,0xdb));var _0x789a=function(_0x139c5a,_0x33b685){_0x139c5a=_0x139c5a-0x0;var _0x11934c=_0x89a7[_0x139c5a];return _0x11934c;};'use strict';var _=require(_0x789a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x789a('0x1'));var moment=require(_0x789a('0x2'));var BPromise=require(_0x789a('0x3'));var rp=require(_0x789a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x789a('0x5'));var config=require(_0x789a('0x6'));var attributes=require(_0x789a('0x7'));module[_0x789a('0x8')]=function(_0x230754,_0x4671fe){return _0x230754[_0x789a('0x9')](_0x789a('0xa'),attributes,{'tableName':_0x789a('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x789a('0xc'),_0x789a('0xd')]},{'name':_0x789a('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 4548f87..846181e 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 _0x0622=['request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','create','options','raw','UpdateSquareReport','SquareReport','update','body','where','limit','util','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x206f02,_0x36f322){var _0x8a2663=function(_0x5ac031){while(--_0x5ac031){_0x206f02['push'](_0x206f02['shift']());}};_0x8a2663(++_0x36f322);}(_0x0622,0x199));var _0x2062=function(_0xc36d01,_0x3bf1a6){_0xc36d01=_0xc36d01-0x0;var _0xecb231=_0x0622[_0xc36d01];return _0xecb231;};'use strict';var _=require('lodash');var util=require(_0x2062('0x0'));var moment=require('moment');var BPromise=require(_0x2062('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2062('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x2062('0x3'))('rpc');var config=require(_0x2062('0x4'));var jayson=require(_0x2062('0x5'));var client=jayson[_0x2062('0x6')][_0x2062('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3b51c5,_0x35782d,_0x3dfe32){return new BPromise(function(_0x49084c,_0x5c0daa){return client[_0x2062('0x8')](_0x3b51c5,_0x3dfe32)[_0x2062('0x9')](function(_0x66bef2){logger[_0x2062('0xa')]('SquareReport,\x20%s,\x20%s',_0x35782d,_0x2062('0xb'));logger[_0x2062('0xc')](_0x2062('0xd'),_0x35782d,_0x2062('0xb'),JSON[_0x2062('0xe')](_0x66bef2));if(_0x66bef2['error']){if(_0x66bef2[_0x2062('0xf')]['code']===0x1f4){logger['error'](_0x2062('0x10'),_0x35782d,_0x66bef2[_0x2062('0xf')]['message']);return _0x5c0daa(_0x66bef2[_0x2062('0xf')][_0x2062('0x11')]);}logger[_0x2062('0xf')](_0x2062('0x10'),_0x35782d,_0x66bef2[_0x2062('0xf')][_0x2062('0x11')]);return _0x49084c(_0x66bef2['error']['message']);}else{logger[_0x2062('0xa')]('SquareReport,\x20%s,\x20%s',_0x35782d,'request\x20sent');_0x49084c(_0x66bef2[_0x2062('0x12')][_0x2062('0x11')]);}})[_0x2062('0x13')](function(_0x49f31d){logger[_0x2062('0xf')](_0x2062('0x10'),_0x35782d,_0x49f31d);_0x5c0daa(_0x49f31d);});});}exports[_0x2062('0x14')]=function(_0x13a384){var _0x1a5539=this;return new Promise(function(_0x35412f,_0x3618aa){return db['SquareReport'][_0x2062('0x15')](_0x13a384['body'],{'raw':_0x13a384[_0x2062('0x16')]?_0x13a384['options'][_0x2062('0x17')]===undefined?!![]:![]:!![]})[_0x2062('0x9')](function(_0x4f0a75){logger[_0x2062('0xa')](_0x2062('0x14'),_0x13a384);logger[_0x2062('0xc')](_0x2062('0x14'),_0x13a384,JSON[_0x2062('0xe')](_0x4f0a75));_0x35412f(_0x4f0a75);})[_0x2062('0x13')](function(_0x331f32){logger['error']('CreateSquareReport',_0x331f32[_0x2062('0x11')],_0x13a384);_0x3618aa(_0x1a5539[_0x2062('0xf')](0x1f4,_0x331f32['message']));});});};exports[_0x2062('0x18')]=function(_0x5428e4){var _0x3c7d4f=this;return new Promise(function(_0x17eaf9,_0x24cb6b){return db[_0x2062('0x19')][_0x2062('0x1a')](_0x5428e4[_0x2062('0x1b')],{'raw':_0x5428e4[_0x2062('0x16')]?_0x5428e4[_0x2062('0x16')][_0x2062('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5428e4['options']?_0x5428e4['options'][_0x2062('0x1c')]||null:null,'attributes':_0x5428e4[_0x2062('0x16')]?_0x5428e4[_0x2062('0x16')]['attributes']||null:null,'limit':_0x5428e4[_0x2062('0x16')]?_0x5428e4[_0x2062('0x16')][_0x2062('0x1d')]||null:null})['then'](function(_0x1d0c7a){logger[_0x2062('0xa')](_0x2062('0x18'),_0x5428e4);logger['debug'](_0x2062('0x18'),_0x5428e4,JSON[_0x2062('0xe')](_0x1d0c7a));_0x17eaf9(_0x1d0c7a);})[_0x2062('0x13')](function(_0x27847a){logger['error']('UpdateSquareReport',_0x27847a[_0x2062('0x11')],_0x5428e4);_0x24cb6b(_0x3c7d4f[_0x2062('0xf')](0x1f4,_0x27847a[_0x2062('0x11')]));});});}; \ No newline at end of file +var _0xfc6f=['stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','create','body','options','UpdateSquareReport','update','raw','where','attributes','limit','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0x16f047,_0x2715d3){var _0x4d494b=function(_0xac5b4e){while(--_0xac5b4e){_0x16f047['push'](_0x16f047['shift']());}};_0x4d494b(++_0x2715d3);}(_0xfc6f,0xb7));var _0xffc6=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xfc6f[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0xffc6('0x0'));var util=require('util');var moment=require(_0xffc6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xffc6('0x2'));var db=require(_0xffc6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xffc6('0x4'))(_0xffc6('0x5'));var config=require(_0xffc6('0x6'));var jayson=require(_0xffc6('0x7'));var client=jayson[_0xffc6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b0262,_0x400821,_0x1ac1e9){return new BPromise(function(_0x52c216,_0x17fabc){return client[_0xffc6('0x9')](_0x2b0262,_0x1ac1e9)[_0xffc6('0xa')](function(_0x5d31f5){logger[_0xffc6('0xb')]('SquareReport,\x20%s,\x20%s',_0x400821,_0xffc6('0xc'));logger[_0xffc6('0xd')](_0xffc6('0xe'),_0x400821,'request\x20sent',JSON[_0xffc6('0xf')](_0x5d31f5));if(_0x5d31f5['error']){if(_0x5d31f5[_0xffc6('0x10')][_0xffc6('0x11')]===0x1f4){logger[_0xffc6('0x10')](_0xffc6('0x12'),_0x400821,_0x5d31f5[_0xffc6('0x10')]['message']);return _0x17fabc(_0x5d31f5[_0xffc6('0x10')][_0xffc6('0x13')]);}logger[_0xffc6('0x10')](_0xffc6('0x12'),_0x400821,_0x5d31f5[_0xffc6('0x10')][_0xffc6('0x13')]);return _0x52c216(_0x5d31f5[_0xffc6('0x10')][_0xffc6('0x13')]);}else{logger['info'](_0xffc6('0x12'),_0x400821,'request\x20sent');_0x52c216(_0x5d31f5[_0xffc6('0x14')][_0xffc6('0x13')]);}})[_0xffc6('0x15')](function(_0xe2e22f){logger[_0xffc6('0x10')](_0xffc6('0x12'),_0x400821,_0xe2e22f);_0x17fabc(_0xe2e22f);});});}exports[_0xffc6('0x16')]=function(_0x4179b9){var _0x1374f6=this;return new Promise(function(_0x3784d6,_0x1a1454){return db[_0xffc6('0x17')][_0xffc6('0x18')](_0x4179b9[_0xffc6('0x19')],{'raw':_0x4179b9[_0xffc6('0x1a')]?_0x4179b9['options']['raw']===undefined?!![]:![]:!![]})[_0xffc6('0xa')](function(_0x395876){logger[_0xffc6('0xb')](_0xffc6('0x16'),_0x4179b9);logger[_0xffc6('0xd')](_0xffc6('0x16'),_0x4179b9,JSON[_0xffc6('0xf')](_0x395876));_0x3784d6(_0x395876);})[_0xffc6('0x15')](function(_0x59ec4f){logger[_0xffc6('0x10')]('CreateSquareReport',_0x59ec4f[_0xffc6('0x13')],_0x4179b9);_0x1a1454(_0x1374f6['error'](0x1f4,_0x59ec4f['message']));});});};exports[_0xffc6('0x1b')]=function(_0x791cbd){var _0x4f12fe=this;return new Promise(function(_0x11e08c,_0x527681){return db[_0xffc6('0x17')][_0xffc6('0x1c')](_0x791cbd[_0xffc6('0x19')],{'raw':_0x791cbd[_0xffc6('0x1a')]?_0x791cbd[_0xffc6('0x1a')][_0xffc6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x791cbd[_0xffc6('0x1a')]?_0x791cbd[_0xffc6('0x1a')][_0xffc6('0x1e')]||null:null,'attributes':_0x791cbd[_0xffc6('0x1a')]?_0x791cbd[_0xffc6('0x1a')][_0xffc6('0x1f')]||null:null,'limit':_0x791cbd[_0xffc6('0x1a')]?_0x791cbd['options'][_0xffc6('0x20')]||null:null})['then'](function(_0x1310a3){logger[_0xffc6('0xb')](_0xffc6('0x1b'),_0x791cbd);logger[_0xffc6('0xd')](_0xffc6('0x1b'),_0x791cbd,JSON[_0xffc6('0xf')](_0x1310a3));_0x11e08c(_0x1310a3);})['catch'](function(_0x2d08ed){logger['error'](_0xffc6('0x1b'),_0x2d08ed[_0xffc6('0x13')],_0x791cbd);_0x527681(_0x4f12fe[_0xffc6('0x10')](0x1f4,_0x2d08ed['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index e3562e9..9aab87c 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(_0x6677ee,_0x1e47d5){var _0x459a09=function(_0xd9494f){while(--_0xd9494f){_0x6677ee['push'](_0x6677ee['shift']());}};_0x459a09(++_0x1e47d5);}(_0x7a54,0x106));var _0x47a5=function(_0x450105,_0x35f484){_0x450105=_0x450105-0x0;var _0x295fba=_0x7a54[_0x450105];return _0x295fba;};'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(_0x3425cf,_0x572e60){var _0x5841c0=function(_0x3a31ed){while(--_0x3a31ed){_0x3425cf['push'](_0x3425cf['shift']());}};_0x5841c0(++_0x572e60);}(_0x7a54,0x106));var _0x47a5=function(_0x2621f9,_0x13fd75){_0x2621f9=_0x2621f9-0x0;var _0x165898=_0x7a54[_0x2621f9];return _0x165898;};'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 3449719..48c81bd 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 _0xcfd1=['sequelize','STRING'];(function(_0x2e38e3,_0x5c443e){var _0x5cb83c=function(_0x35c1f4){while(--_0x35c1f4){_0x2e38e3['push'](_0x2e38e3['shift']());}};_0x5cb83c(++_0x5c443e);}(_0xcfd1,0x1f4));var _0x1cfd=function(_0x38e084,_0x5792dc){_0x38e084=_0x38e084-0x0;var _0x1dd0ea=_0xcfd1[_0x38e084];return _0x1dd0ea;};'use strict';var Sequelize=require(_0x1cfd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1cfd('0x1')]},'node':{'type':Sequelize[_0x1cfd('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x1cfd('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x92cf=['TEXT','sequelize','exports','STRING'];(function(_0xb48dcb,_0x2de9d0){var _0x26c70d=function(_0x187a35){while(--_0x187a35){_0xb48dcb['push'](_0xb48dcb['shift']());}};_0x26c70d(++_0x2de9d0);}(_0x92cf,0x1a9));var _0xf92c=function(_0x1b0c8c,_0x486222){_0x1b0c8c=_0x1b0c8c-0x0;var _0x2e67c9=_0x92cf[_0x1b0c8c];return _0x2e67c9;};'use strict';var Sequelize=require(_0xf92c('0x0'));module[_0xf92c('0x1')]={'uniqueid':{'type':Sequelize[_0xf92c('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xf92c('0x2')]},'data':{'type':Sequelize[_0xf92c('0x3')]},'project_name':{'type':Sequelize[_0xf92c('0x2')]},'callerid':{'type':Sequelize[_0xf92c('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 0a188ee..c2cffd1 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 _0xd289=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','catch','create','body','find','describe','html-pdf','rimraf','zip-dir','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','stack','name','send','index','SquareDetailsReport','fieldName','type'];(function(_0x2bda14,_0x4fab1b){var _0xb5dd49=function(_0x1da71e){while(--_0x1da71e){_0x2bda14['push'](_0x2bda14['shift']());}};_0xb5dd49(++_0x4fab1b);}(_0xd289,0x1b5));var _0x9d28=function(_0xfdb740,_0x14c2da){_0xfdb740=_0xfdb740-0x0;var _0x4a837d=_0xd289[_0xfdb740];return _0x4a837d;};'use strict';var pdf=require(_0x9d28('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9d28('0x1'));var zipdir=require(_0x9d28('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9d28('0x3'));var util=require(_0x9d28('0x4'));var path=require(_0x9d28('0x5'));var sox=require('sox');var csv=require(_0x9d28('0x6'));var ejs=require(_0x9d28('0x7'));var fs=require('fs');var _=require(_0x9d28('0x8'));var squel=require(_0x9d28('0x9'));var crypto=require(_0x9d28('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9d28('0xb'));var toCsv=require(_0x9d28('0x6'));var querystring=require(_0x9d28('0xc'));var Papa=require(_0x9d28('0xd'));var Redis=require(_0x9d28('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9d28('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d28('0x10'));var logger=require('../../config/logger')(_0x9d28('0x11'));var utils=require('../../config/utils');var config=require(_0x9d28('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dc751,_0x42bd52){_0x42bd52=_0x42bd52||0xcc;return function(_0x37f0a1){if(_0x37f0a1){return _0x5dc751[_0x9d28('0x13')](_0x42bd52);}return _0x5dc751[_0x9d28('0x14')](_0x42bd52)[_0x9d28('0x15')]();};}function respondWithResult(_0x454cbf,_0x656821){_0x656821=_0x656821||0xc8;return function(_0x5c66cc){if(_0x5c66cc){return _0x454cbf['status'](_0x656821)[_0x9d28('0x16')](_0x5c66cc);}};}function respondWithFilteredResult(_0x56322c,_0x4b6c77){return function(_0x5077e2){if(_0x5077e2){var _0x1b023d=_0x5077e2[_0x9d28('0x17')],_0x13cd3b=_0x4b6c77['offset'],_0x3c1b47=_0x4b6c77[_0x9d28('0x18')]+_0x4b6c77[_0x9d28('0x19')],_0x246b50;if(_0x3c1b47>=_0x1b023d){_0x3c1b47=_0x1b023d;_0x246b50=0xc8;}else{_0x246b50=0xce;}_0x56322c[_0x9d28('0x14')](_0x246b50);return _0x56322c[_0x9d28('0x1a')](_0x9d28('0x1b'),_0x13cd3b+'-'+_0x3c1b47+'/'+_0x1b023d)[_0x9d28('0x16')](_0x5077e2);}return null;};}function patchUpdates(_0x268c87){return function(_0x276f00){try{jsonpatch['apply'](_0x276f00,_0x268c87,!![]);}catch(_0x4bf495){return BPromise[_0x9d28('0x1c')](_0x4bf495);}return _0x276f00[_0x9d28('0x1d')]();};}function saveUpdates(_0x5aa033,_0xf0fddc){return function(_0x17023e){if(_0x17023e){return _0x17023e[_0x9d28('0x1e')](_0x5aa033)[_0x9d28('0x1f')](function(_0x3e36e3){return _0x3e36e3;});}return null;};}function removeEntity(_0x53b658,_0x2b3ef5){return function(_0x1c3c0f){if(_0x1c3c0f){return _0x1c3c0f['destroy']()[_0x9d28('0x1f')](function(){_0x53b658[_0x9d28('0x14')](0xcc)[_0x9d28('0x15')]();});}};}function handleEntityNotFound(_0x44c5b3,_0x5a286c){return function(_0x400659){if(!_0x400659){_0x44c5b3[_0x9d28('0x13')](0x194);}return _0x400659;};}function handleError(_0x371ac4,_0x4b42dd){_0x4b42dd=_0x4b42dd||0x1f4;return function(_0x3a0938){logger['error'](_0x3a0938[_0x9d28('0x20')]);if(_0x3a0938[_0x9d28('0x21')]){delete _0x3a0938[_0x9d28('0x21')];}_0x371ac4[_0x9d28('0x14')](_0x4b42dd)[_0x9d28('0x22')](_0x3a0938);};}exports[_0x9d28('0x23')]=function(_0x388101,_0x3bef81){var _0x174837={},_0x37eeae={},_0x173f24={'count':0x0,'rows':[]};var _0x5e2289=_['map'](db[_0x9d28('0x24')]['rawAttributes'],function(_0x7844dd){return{'name':_0x7844dd[_0x9d28('0x25')],'type':_0x7844dd[_0x9d28('0x26')][_0x9d28('0x27')]};});_0x37eeae[_0x9d28('0x28')]=_['map'](_0x5e2289,_0x9d28('0x21'));_0x37eeae['query']=_['keys'](_0x388101[_0x9d28('0x29')]);_0x37eeae[_0x9d28('0x2a')]=_[_0x9d28('0x2b')](_0x37eeae[_0x9d28('0x28')],_0x37eeae[_0x9d28('0x29')]);_0x174837[_0x9d28('0x2c')]=_[_0x9d28('0x2b')](_0x37eeae['model'],qs[_0x9d28('0x2d')](_0x388101['query'][_0x9d28('0x2d')]));_0x174837[_0x9d28('0x2c')]=_0x174837['attributes'][_0x9d28('0x2e')]?_0x174837[_0x9d28('0x2c')]:_0x37eeae[_0x9d28('0x28')];if(!_0x388101[_0x9d28('0x29')][_0x9d28('0x2f')](_0x9d28('0x30'))){_0x174837['limit']=qs[_0x9d28('0x19')](_0x388101['query'][_0x9d28('0x19')]);_0x174837[_0x9d28('0x18')]=qs['offset'](_0x388101[_0x9d28('0x29')][_0x9d28('0x18')]);}_0x174837['order']=qs[_0x9d28('0x31')](_0x388101[_0x9d28('0x29')][_0x9d28('0x31')]);_0x174837[_0x9d28('0x32')]=qs[_0x9d28('0x2a')](_[_0x9d28('0x33')](_0x388101[_0x9d28('0x29')],_0x37eeae[_0x9d28('0x2a')]));if(_0x388101[_0x9d28('0x29')][_0x9d28('0x34')]){_0x174837[_0x9d28('0x32')]=_['merge'](_0x174837['where'],{'$or':_['map'](_0x5e2289,function(_0xae7745){if(_0xae7745[_0x9d28('0x26')]!=='VIRTUAL'){var _0x83c8d6={};_0x83c8d6[_0xae7745['name']]={'$like':'%'+_0x388101[_0x9d28('0x29')][_0x9d28('0x34')]+'%'};return _0x83c8d6;}})});}_0x174837=_[_0x9d28('0x35')]({},_0x174837,_0x388101[_0x9d28('0x36')]);var _0x43e09b={'where':_0x174837['where']};return db[_0x9d28('0x24')]['count'](_0x43e09b)[_0x9d28('0x1f')](function(_0xfbd1bf){_0x173f24['count']=_0xfbd1bf;if(_0x388101[_0x9d28('0x29')][_0x9d28('0x37')]){_0x174837[_0x9d28('0x38')]=[{'all':!![]}];}return db[_0x9d28('0x24')][_0x9d28('0x39')](_0x174837);})[_0x9d28('0x1f')](function(_0x82a2a8){_0x173f24[_0x9d28('0x3a')]=_0x82a2a8;return _0x173f24;})['then'](respondWithFilteredResult(_0x3bef81,_0x174837))['catch'](handleError(_0x3bef81,null));};exports[_0x9d28('0x3b')]=function(_0x1e6344,_0x572dbb){var _0x8fadf={'raw':!![],'where':{'id':_0x1e6344[_0x9d28('0x3c')]['id']}},_0x3fc1f9={};_0x3fc1f9[_0x9d28('0x28')]=_[_0x9d28('0x3d')](db['SquareDetailsReport'][_0x9d28('0x3e')]);_0x3fc1f9['query']=_[_0x9d28('0x3d')](_0x1e6344[_0x9d28('0x29')]);_0x3fc1f9[_0x9d28('0x2a')]=_[_0x9d28('0x2b')](_0x3fc1f9[_0x9d28('0x28')],_0x3fc1f9[_0x9d28('0x29')]);_0x8fadf[_0x9d28('0x2c')]=_[_0x9d28('0x2b')](_0x3fc1f9[_0x9d28('0x28')],qs[_0x9d28('0x2d')](_0x1e6344['query'][_0x9d28('0x2d')]));_0x8fadf[_0x9d28('0x2c')]=_0x8fadf['attributes'][_0x9d28('0x2e')]?_0x8fadf['attributes']:_0x3fc1f9['model'];if(_0x1e6344[_0x9d28('0x29')][_0x9d28('0x37')]){_0x8fadf[_0x9d28('0x38')]=[{'all':!![]}];}_0x8fadf=_[_0x9d28('0x35')]({},_0x8fadf,_0x1e6344[_0x9d28('0x36')]);return db[_0x9d28('0x24')]['find'](_0x8fadf)[_0x9d28('0x1f')](handleEntityNotFound(_0x572dbb,null))['then'](respondWithResult(_0x572dbb,null))[_0x9d28('0x3f')](handleError(_0x572dbb,null));};exports[_0x9d28('0x40')]=function(_0x428de9,_0x20b4ec){return db[_0x9d28('0x24')]['create'](_0x428de9[_0x9d28('0x41')],{})['then'](respondWithResult(_0x20b4ec,0xc9))[_0x9d28('0x3f')](handleError(_0x20b4ec,null));};exports['update']=function(_0x4e9e12,_0x28e4e4){if(_0x4e9e12[_0x9d28('0x41')]['id']){delete _0x4e9e12[_0x9d28('0x41')]['id'];}return db['SquareDetailsReport'][_0x9d28('0x42')]({'where':{'id':_0x4e9e12[_0x9d28('0x3c')]['id']}})[_0x9d28('0x1f')](handleEntityNotFound(_0x28e4e4,null))[_0x9d28('0x1f')](saveUpdates(_0x4e9e12[_0x9d28('0x41')],null))['then'](respondWithResult(_0x28e4e4,null))[_0x9d28('0x3f')](handleError(_0x28e4e4,null));};exports['destroy']=function(_0x55673a,_0x40d740){return db[_0x9d28('0x24')][_0x9d28('0x42')]({'where':{'id':_0x55673a[_0x9d28('0x3c')]['id']}})[_0x9d28('0x1f')](handleEntityNotFound(_0x40d740,null))[_0x9d28('0x1f')](removeEntity(_0x40d740,null))['catch'](handleError(_0x40d740,null));};exports[_0x9d28('0x43')]=function(_0x29b57b,_0x2b00c1){return db[_0x9d28('0x24')][_0x9d28('0x43')]()['then'](respondWithResult(_0x2b00c1,null))[_0x9d28('0x3f')](handleError(_0x2b00c1,null));}; \ No newline at end of file +var _0x9003=['keys','query','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','intersection','length','find','create','update','params','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes','key','model'];(function(_0x111e94,_0x31c837){var _0x3de107=function(_0x65bd1e){while(--_0x65bd1e){_0x111e94['push'](_0x111e94['shift']());}};_0x3de107(++_0x31c837);}(_0x9003,0x141));var _0x3900=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x9003[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0x3900('0x0'));var emlformat=require(_0x3900('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3900('0x2'));var rp=require(_0x3900('0x3'));var moment=require(_0x3900('0x4'));var BPromise=require(_0x3900('0x5'));var Mustache=require('mustache');var util=require(_0x3900('0x6'));var path=require(_0x3900('0x7'));var sox=require(_0x3900('0x8'));var csv=require('to-csv');var ejs=require(_0x3900('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3900('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3900('0xb'));var querystring=require(_0x3900('0xc'));var Papa=require(_0x3900('0xd'));var Redis=require(_0x3900('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3900('0xf'));var as=require(_0x3900('0x10'));var hardwareService=require(_0x3900('0x11'));var logger=require(_0x3900('0x12'))(_0x3900('0x13'));var utils=require(_0x3900('0x14'));var config=require(_0x3900('0x15'));var db=require(_0x3900('0x16'))['db'];function respondWithStatusCode(_0x342aef,_0x4ed7cc){_0x4ed7cc=_0x4ed7cc||0xcc;return function(_0x45959e){if(_0x45959e){return _0x342aef[_0x3900('0x17')](_0x4ed7cc);}return _0x342aef[_0x3900('0x18')](_0x4ed7cc)[_0x3900('0x19')]();};}function respondWithResult(_0xe61464,_0x5d001a){_0x5d001a=_0x5d001a||0xc8;return function(_0x2b9126){if(_0x2b9126){return _0xe61464['status'](_0x5d001a)[_0x3900('0x1a')](_0x2b9126);}};}function respondWithFilteredResult(_0x49f43e,_0x3204c2){return function(_0x9b963b){if(_0x9b963b){var _0x77f68e=_0x9b963b[_0x3900('0x1b')],_0x592729=_0x3204c2[_0x3900('0x1c')],_0x110a96=_0x3204c2['offset']+_0x3204c2['limit'],_0x23403e;if(_0x110a96>=_0x77f68e){_0x110a96=_0x77f68e;_0x23403e=0xc8;}else{_0x23403e=0xce;}_0x49f43e[_0x3900('0x18')](_0x23403e);return _0x49f43e[_0x3900('0x1d')](_0x3900('0x1e'),_0x592729+'-'+_0x110a96+'/'+_0x77f68e)[_0x3900('0x1a')](_0x9b963b);}return null;};}function patchUpdates(_0x299134){return function(_0x4de5cb){try{jsonpatch[_0x3900('0x1f')](_0x4de5cb,_0x299134,!![]);}catch(_0x56a4fc){return BPromise[_0x3900('0x20')](_0x56a4fc);}return _0x4de5cb['save']();};}function saveUpdates(_0x407642,_0x4cc330){return function(_0x133555){if(_0x133555){return _0x133555['update'](_0x407642)[_0x3900('0x21')](function(_0xb23084){return _0xb23084;});}return null;};}function removeEntity(_0x416109,_0xa14bd){return function(_0x1f46ee){if(_0x1f46ee){return _0x1f46ee[_0x3900('0x22')]()[_0x3900('0x21')](function(){_0x416109[_0x3900('0x18')](0xcc)[_0x3900('0x19')]();});}};}function handleEntityNotFound(_0x8c9fa8,_0x2c424e){return function(_0x41ab91){if(!_0x41ab91){_0x8c9fa8['sendStatus'](0x194);}return _0x41ab91;};}function handleError(_0x360ad6,_0x153304){_0x153304=_0x153304||0x1f4;return function(_0x23532a){logger['error'](_0x23532a[_0x3900('0x23')]);if(_0x23532a[_0x3900('0x24')]){delete _0x23532a[_0x3900('0x24')];}_0x360ad6[_0x3900('0x18')](_0x153304)[_0x3900('0x25')](_0x23532a);};}exports[_0x3900('0x26')]=function(_0x5bfb21,_0x59fd2b){var _0x1ff5a2={},_0x2ee6c4={},_0x45ad34={'count':0x0,'rows':[]};var _0x49ae59=_[_0x3900('0x27')](db[_0x3900('0x28')][_0x3900('0x29')],function(_0x196de8){return{'name':_0x196de8['fieldName'],'type':_0x196de8['type'][_0x3900('0x2a')]};});_0x2ee6c4[_0x3900('0x2b')]=_[_0x3900('0x27')](_0x49ae59,'name');_0x2ee6c4['query']=_[_0x3900('0x2c')](_0x5bfb21[_0x3900('0x2d')]);_0x2ee6c4['filters']=_['intersection'](_0x2ee6c4['model'],_0x2ee6c4[_0x3900('0x2d')]);_0x1ff5a2[_0x3900('0x2e')]=_['intersection'](_0x2ee6c4[_0x3900('0x2b')],qs[_0x3900('0x2f')](_0x5bfb21[_0x3900('0x2d')][_0x3900('0x2f')]));_0x1ff5a2[_0x3900('0x2e')]=_0x1ff5a2[_0x3900('0x2e')]['length']?_0x1ff5a2['attributes']:_0x2ee6c4[_0x3900('0x2b')];if(!_0x5bfb21[_0x3900('0x2d')][_0x3900('0x30')](_0x3900('0x31'))){_0x1ff5a2[_0x3900('0x32')]=qs['limit'](_0x5bfb21[_0x3900('0x2d')]['limit']);_0x1ff5a2[_0x3900('0x1c')]=qs[_0x3900('0x1c')](_0x5bfb21[_0x3900('0x2d')]['offset']);}_0x1ff5a2[_0x3900('0x33')]=qs[_0x3900('0x34')](_0x5bfb21[_0x3900('0x2d')]['sort']);_0x1ff5a2[_0x3900('0x35')]=qs[_0x3900('0x36')](_['pick'](_0x5bfb21[_0x3900('0x2d')],_0x2ee6c4[_0x3900('0x36')]));if(_0x5bfb21[_0x3900('0x2d')][_0x3900('0x37')]){_0x1ff5a2[_0x3900('0x35')]=_[_0x3900('0x38')](_0x1ff5a2[_0x3900('0x35')],{'$or':_['map'](_0x49ae59,function(_0x360c35){if(_0x360c35[_0x3900('0x39')]!=='VIRTUAL'){var _0x1ac8f7={};_0x1ac8f7[_0x360c35[_0x3900('0x24')]]={'$like':'%'+_0x5bfb21[_0x3900('0x2d')][_0x3900('0x37')]+'%'};return _0x1ac8f7;}})});}_0x1ff5a2=_[_0x3900('0x38')]({},_0x1ff5a2,_0x5bfb21[_0x3900('0x3a')]);var _0x55bd61={'where':_0x1ff5a2[_0x3900('0x35')]};return db[_0x3900('0x28')][_0x3900('0x1b')](_0x55bd61)[_0x3900('0x21')](function(_0x3905f1){_0x45ad34['count']=_0x3905f1;if(_0x5bfb21['query'][_0x3900('0x3b')]){_0x1ff5a2[_0x3900('0x3c')]=[{'all':!![]}];}return db[_0x3900('0x28')][_0x3900('0x3d')](_0x1ff5a2);})[_0x3900('0x21')](function(_0xe29b09){_0x45ad34[_0x3900('0x3e')]=_0xe29b09;return _0x45ad34;})[_0x3900('0x21')](respondWithFilteredResult(_0x59fd2b,_0x1ff5a2))[_0x3900('0x3f')](handleError(_0x59fd2b,null));};exports[_0x3900('0x40')]=function(_0x1954c6,_0x2addd8){var _0x1f7d79={'raw':!![],'where':{'id':_0x1954c6['params']['id']}},_0x4f5b79={};_0x4f5b79[_0x3900('0x2b')]=_[_0x3900('0x2c')](db['SquareDetailsReport'][_0x3900('0x29')]);_0x4f5b79[_0x3900('0x2d')]=_[_0x3900('0x2c')](_0x1954c6['query']);_0x4f5b79[_0x3900('0x36')]=_[_0x3900('0x41')](_0x4f5b79[_0x3900('0x2b')],_0x4f5b79[_0x3900('0x2d')]);_0x1f7d79[_0x3900('0x2e')]=_['intersection'](_0x4f5b79['model'],qs[_0x3900('0x2f')](_0x1954c6[_0x3900('0x2d')][_0x3900('0x2f')]));_0x1f7d79[_0x3900('0x2e')]=_0x1f7d79[_0x3900('0x2e')][_0x3900('0x42')]?_0x1f7d79[_0x3900('0x2e')]:_0x4f5b79[_0x3900('0x2b')];if(_0x1954c6[_0x3900('0x2d')][_0x3900('0x3b')]){_0x1f7d79[_0x3900('0x3c')]=[{'all':!![]}];}_0x1f7d79=_[_0x3900('0x38')]({},_0x1f7d79,_0x1954c6[_0x3900('0x3a')]);return db[_0x3900('0x28')][_0x3900('0x43')](_0x1f7d79)[_0x3900('0x21')](handleEntityNotFound(_0x2addd8,null))[_0x3900('0x21')](respondWithResult(_0x2addd8,null))[_0x3900('0x3f')](handleError(_0x2addd8,null));};exports[_0x3900('0x44')]=function(_0x3e9c71,_0x4aa1c2){return db[_0x3900('0x28')][_0x3900('0x44')](_0x3e9c71['body'],{})[_0x3900('0x21')](respondWithResult(_0x4aa1c2,0xc9))[_0x3900('0x3f')](handleError(_0x4aa1c2,null));};exports[_0x3900('0x45')]=function(_0x15ee5f,_0x362675){if(_0x15ee5f['body']['id']){delete _0x15ee5f['body']['id'];}return db[_0x3900('0x28')][_0x3900('0x43')]({'where':{'id':_0x15ee5f[_0x3900('0x46')]['id']}})[_0x3900('0x21')](handleEntityNotFound(_0x362675,null))[_0x3900('0x21')](saveUpdates(_0x15ee5f[_0x3900('0x47')],null))[_0x3900('0x21')](respondWithResult(_0x362675,null))[_0x3900('0x3f')](handleError(_0x362675,null));};exports[_0x3900('0x22')]=function(_0x270120,_0xef20f8){return db[_0x3900('0x28')][_0x3900('0x43')]({'where':{'id':_0x270120[_0x3900('0x46')]['id']}})['then'](handleEntityNotFound(_0xef20f8,null))[_0x3900('0x21')](removeEntity(_0xef20f8,null))[_0x3900('0x3f')](handleError(_0xef20f8,null));};exports['describe']=function(_0x4aed30,_0x4a86c9){return db[_0x3900('0x28')][_0x3900('0x48')]()[_0x3900('0x21')](respondWithResult(_0x4a86c9,null))[_0x3900('0x3f')](handleError(_0x4a86c9,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index c210b42..457e964 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 _0x79e9=['../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2b7aa6,_0x2ef98a){var _0x31ba69=function(_0x14b98a){while(--_0x14b98a){_0x2b7aa6['push'](_0x2b7aa6['shift']());}};_0x31ba69(++_0x2ef98a);}(_0x79e9,0x116));var _0x979e=function(_0x15d3e8,_0x29b660){_0x15d3e8=_0x15d3e8-0x0;var _0xbf593a=_0x79e9[_0x15d3e8];return _0xbf593a;};'use strict';var _=require('lodash');var util=require(_0x979e('0x0'));var logger=require(_0x979e('0x1'))(_0x979e('0x2'));var moment=require(_0x979e('0x3'));var BPromise=require(_0x979e('0x4'));var rp=require(_0x979e('0x5'));var fs=require('fs');var path=require(_0x979e('0x6'));var rimraf=require(_0x979e('0x7'));var config=require(_0x979e('0x8'));var attributes=require(_0x979e('0x9'));module[_0x979e('0xa')]=function(_0x1a045f,_0x5160a9){return _0x1a045f[_0x979e('0xb')]('SquareDetailsReport',attributes,{'tableName':_0x979e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0755=['rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5c781c,_0x3995d9){var _0x2fafe3=function(_0x2bae60){while(--_0x2bae60){_0x5c781c['push'](_0x5c781c['shift']());}};_0x2fafe3(++_0x3995d9);}(_0x0755,0x7c));var _0x5075=function(_0x3f2ebe,_0x4cea82){_0x3f2ebe=_0x3f2ebe-0x0;var _0x2d4695=_0x0755[_0x3f2ebe];return _0x2d4695;};'use strict';var _=require(_0x5075('0x0'));var util=require(_0x5075('0x1'));var logger=require(_0x5075('0x2'))(_0x5075('0x3'));var moment=require(_0x5075('0x4'));var BPromise=require(_0x5075('0x5'));var rp=require(_0x5075('0x6'));var fs=require('fs');var path=require(_0x5075('0x7'));var rimraf=require(_0x5075('0x8'));var config=require(_0x5075('0x9'));var attributes=require('./squareReportDetail.attributes');module[_0x5075('0xa')]=function(_0x2a7be,_0x3f4fea){return _0x2a7be[_0x5075('0xb')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','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 d17e41c..8c90b5b 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 _0xa552=['client','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareDetailsReport','create','body','options','raw','info','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x32ee10,_0x29ade5){var _0x39ec1b=function(_0x57fda3){while(--_0x57fda3){_0x32ee10['push'](_0x32ee10['shift']());}};_0x39ec1b(++_0x29ade5);}(_0xa552,0x1c2));var _0x2a55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa552[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2a55('0x0'));var moment=require(_0x2a55('0x1'));var BPromise=require(_0x2a55('0x2'));var rs=require(_0x2a55('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a55('0x4'))['db'];var utils=require(_0x2a55('0x5'));var logger=require('../../config/logger')(_0x2a55('0x6'));var config=require(_0x2a55('0x7'));var jayson=require(_0x2a55('0x8'));var client=jayson[_0x2a55('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x472275,_0x1aceef,_0x4fc7da){return new BPromise(function(_0x259d6d,_0x16e03c){return client[_0x2a55('0xa')](_0x472275,_0x4fc7da)[_0x2a55('0xb')](function(_0x499b87){logger['info'](_0x2a55('0xc'),_0x1aceef,_0x2a55('0xd'));logger[_0x2a55('0xe')](_0x2a55('0xf'),_0x1aceef,'request\x20sent',JSON[_0x2a55('0x10')](_0x499b87));if(_0x499b87['error']){if(_0x499b87['error']['code']===0x1f4){logger[_0x2a55('0x11')](_0x2a55('0xc'),_0x1aceef,_0x499b87['error'][_0x2a55('0x12')]);return _0x16e03c(_0x499b87[_0x2a55('0x11')][_0x2a55('0x12')]);}logger[_0x2a55('0x11')](_0x2a55('0xc'),_0x1aceef,_0x499b87[_0x2a55('0x11')][_0x2a55('0x12')]);return _0x259d6d(_0x499b87['error']['message']);}else{logger['info'](_0x2a55('0xc'),_0x1aceef,_0x2a55('0xd'));_0x259d6d(_0x499b87[_0x2a55('0x13')]['message']);}})[_0x2a55('0x14')](function(_0x456dea){logger[_0x2a55('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1aceef,_0x456dea);_0x16e03c(_0x456dea);});});}exports[_0x2a55('0x15')]=function(_0x584ce7){var _0x814f5b=this;return new Promise(function(_0x3acbbb,_0x47745d){return db['SquareDetailsReport'][_0x2a55('0x16')](_0x584ce7[_0x2a55('0x17')],{'raw':_0x584ce7[_0x2a55('0x18')]?_0x584ce7[_0x2a55('0x18')][_0x2a55('0x19')]===undefined?!![]:![]:!![]})[_0x2a55('0xb')](function(_0x2b5307){logger[_0x2a55('0x1a')]('CreateSquareDetailsReport',_0x584ce7);logger['debug'](_0x2a55('0x15'),_0x584ce7,JSON[_0x2a55('0x10')](_0x2b5307));_0x3acbbb(_0x2b5307);})[_0x2a55('0x14')](function(_0x5649a1){logger[_0x2a55('0x11')](_0x2a55('0x15'),_0x5649a1['message'],_0x584ce7);_0x47745d(_0x814f5b[_0x2a55('0x11')](0x1f4,_0x5649a1['message']));});});}; \ No newline at end of file +var _0xad4a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xad4a,0x112));var _0xaad4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xad4a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaad4('0x0'));var util=require(_0xaad4('0x1'));var moment=require(_0xaad4('0x2'));var BPromise=require(_0xaad4('0x3'));var rs=require(_0xaad4('0x4'));var fs=require('fs');var Redis=require(_0xaad4('0x5'));var db=require(_0xaad4('0x6'))['db'];var utils=require(_0xaad4('0x7'));var logger=require(_0xaad4('0x8'))(_0xaad4('0x9'));var config=require(_0xaad4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xaad4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e6f4d,_0x2bec70,_0x1a8433){return new BPromise(function(_0x329ef1,_0x59ef0a){return client[_0xaad4('0xc')](_0x3e6f4d,_0x1a8433)[_0xaad4('0xd')](function(_0x3d98fd){logger[_0xaad4('0xe')](_0xaad4('0xf'),_0x2bec70,_0xaad4('0x10'));logger['debug'](_0xaad4('0x11'),_0x2bec70,_0xaad4('0x10'),JSON[_0xaad4('0x12')](_0x3d98fd));if(_0x3d98fd['error']){if(_0x3d98fd[_0xaad4('0x13')]['code']===0x1f4){logger[_0xaad4('0x13')](_0xaad4('0xf'),_0x2bec70,_0x3d98fd[_0xaad4('0x13')][_0xaad4('0x14')]);return _0x59ef0a(_0x3d98fd['error'][_0xaad4('0x14')]);}logger[_0xaad4('0x13')](_0xaad4('0xf'),_0x2bec70,_0x3d98fd[_0xaad4('0x13')]['message']);return _0x329ef1(_0x3d98fd[_0xaad4('0x13')][_0xaad4('0x14')]);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x2bec70,'request\x20sent');_0x329ef1(_0x3d98fd['result'][_0xaad4('0x14')]);}})[_0xaad4('0x15')](function(_0x36e0dc){logger[_0xaad4('0x13')](_0xaad4('0xf'),_0x2bec70,_0x36e0dc);_0x59ef0a(_0x36e0dc);});});}exports[_0xaad4('0x16')]=function(_0x16f7d3){var _0x528f3c=this;return new Promise(function(_0x273eb1,_0x1c4eee){return db[_0xaad4('0x17')][_0xaad4('0x18')](_0x16f7d3['body'],{'raw':_0x16f7d3[_0xaad4('0x19')]?_0x16f7d3[_0xaad4('0x19')][_0xaad4('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3466f0){logger[_0xaad4('0xe')](_0xaad4('0x16'),_0x16f7d3);logger[_0xaad4('0x1b')](_0xaad4('0x16'),_0x16f7d3,JSON[_0xaad4('0x12')](_0x3466f0));_0x273eb1(_0x3466f0);})[_0xaad4('0x15')](function(_0x430629){logger[_0xaad4('0x13')]('CreateSquareDetailsReport',_0x430629['message'],_0x16f7d3);_0x1c4eee(_0x528f3c[_0xaad4('0x13')](0x1f4,_0x430629[_0xaad4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 68b8a0b..ff9fac5 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 _0xd914=['Router','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','express'];(function(_0x5533d4,_0x525249){var _0x4cabd2=function(_0x3a9583){while(--_0x3a9583){_0x5533d4['push'](_0x5533d4['shift']());}};_0x4cabd2(++_0x525249);}(_0xd914,0x17f));var _0x4d91=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xd914[_0x28d18d];return _0x470640;};'use strict';var express=require(_0x4d91('0x0'));var router=express[_0x4d91('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x4d91('0x2'));router[_0x4d91('0x3')]('/',auth[_0x4d91('0x4')](),controller[_0x4d91('0x5')]);router[_0x4d91('0x3')](_0x4d91('0x6'),auth['isAuthenticated'](),controller[_0x4d91('0x7')]);module['exports']=router; \ No newline at end of file +var _0xbb35=['/process/:pid/kill','killProcess','exports','Router','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0x305486,_0x24acd4){var _0xa04940=function(_0x29e866){while(--_0x29e866){_0x305486['push'](_0x305486['shift']());}};_0xa04940(++_0x24acd4);}(_0xbb35,0x1d3));var _0x5bb3=function(_0xd011e9,_0x9ade6b){_0xd011e9=_0xd011e9-0x0;var _0x5f4b24=_0xbb35[_0xd011e9];return _0x5f4b24;};'use strict';var express=require('express');var router=express[_0x5bb3('0x0')]();var auth=require(_0x5bb3('0x1'));var controller=require(_0x5bb3('0x2'));router[_0x5bb3('0x3')]('/',auth[_0x5bb3('0x4')](),controller['index']);router[_0x5bb3('0x3')](_0x5bb3('0x5'),auth[_0x5bb3('0x4')](),controller[_0x5bb3('0x6')]);module[_0x5bb3('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 6be56f4..f3502b8 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 _0x191f=['api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','getAllData','then','json','catch','killProcess','components/import/cm','format','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','../../config/logger'];(function(_0x3d7022,_0x59dfd5){var _0x40870b=function(_0x20c643){while(--_0x20c643){_0x3d7022['push'](_0x3d7022['shift']());}};_0x40870b(++_0x59dfd5);}(_0x191f,0x9b));var _0xf191=function(_0x18369a,_0x4e8835){_0x18369a=_0x18369a-0x0;var _0xa6e2b8=_0x191f[_0x18369a];return _0xa6e2b8;};'use strict';var info=require('systeminformation');var exec=require('child_process')['exec'];var logger=require(_0xf191('0x0'))(_0xf191('0x1'));var util=require(_0xf191('0x2'));var BPromise=require(_0xf191('0x3'));var _=require(_0xf191('0x4'));function handleError(_0x4634a8,_0x4d1368,_0x57fbce){_0x4d1368=_0x4d1368||0x1f4;return function(_0x3c6790){logger[_0xf191('0x5')](_0xf191('0x6'),_0x57fbce,_0x4d1368,util[_0xf191('0x7')](_0x3c6790,{'showHidden':![],'depth':null}));delete _0x3c6790[_0xf191('0x8')];_0x4634a8[_0xf191('0x9')](_0x4d1368)['send'](_0x3c6790);};}exports['index']=function(_0x2dd71a,_0x172a4d){return info[_0xf191('0xa')]()[_0xf191('0xb')](function(_0x10e810){return _0x172a4d[_0xf191('0x9')](0xc8)[_0xf191('0xc')](_0x10e810);})[_0xf191('0xd')](function(_0x4f4984){return _0x172a4d[_0xf191('0x9')](0x1f4)['json'](_0x4f4984);});};exports[_0xf191('0xe')]=function(_0x471f4c,_0x1529ef){var _0x212b65=[_0xf191('0xf')];return new BPromise(function(_0x23f1b6,_0x52c15b){return exec(util[_0xf191('0x10')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x471f4c[_0xf191('0x11')]['pid']),function(_0x495e85,_0x5b00a5,_0x32a9b7){if(_0x495e85){return _0x52c15b(_0x495e85);}return _0x23f1b6(_0x5b00a5);});})[_0xf191('0xb')](function(_0x329bc5){var _0x14d9de=![];var _0x2f5d06=_0x329bc5[_0xf191('0x12')](/\n/);for(var _0x38a82f=0x0,_0x23cefc=_0x212b65[_0xf191('0x13')];_0x38a82f<_0x23cefc,_0x14d9de===![];_0x38a82f+=0x1){if(_0x329bc5[_0xf191('0x14')](_0x212b65[_0x38a82f])>=0x0){_0x14d9de=!![];}}if(!_0x14d9de){throw new Error(util[_0xf191('0x10')](_0xf191('0x15'),_0x471f4c['params']['pid']));}process[_0xf191('0x16')](_0x471f4c[_0xf191('0x11')][_0xf191('0x17')],_0xf191('0x18'));return _0x1529ef[_0xf191('0x9')](0xc8)['json']({'message':util[_0xf191('0x10')](_0xf191('0x19'),_0x471f4c[_0xf191('0x11')][_0xf191('0x17')])});})[_0xf191('0xd')](handleError(_0x1529ef,null,_0xf191('0xe')));}; \ No newline at end of file +var _0x276d=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format'];(function(_0x461119,_0x28ce98){var _0x4b5ed3=function(_0x4fdafc){while(--_0x4fdafc){_0x461119['push'](_0x461119['shift']());}};_0x4b5ed3(++_0x28ce98);}(_0x276d,0xe3));var _0xd276=function(_0x61889a,_0x46758e){_0x61889a=_0x61889a-0x0;var _0x478068=_0x276d[_0x61889a];return _0x478068;};'use strict';var info=require(_0xd276('0x0'));var exec=require(_0xd276('0x1'))['exec'];var logger=require(_0xd276('0x2'))(_0xd276('0x3'));var util=require(_0xd276('0x4'));var BPromise=require(_0xd276('0x5'));var _=require(_0xd276('0x6'));function handleError(_0x2819c3,_0x509403,_0x2f5400){_0x509403=_0x509403||0x1f4;return function(_0x18924d){logger[_0xd276('0x7')](_0xd276('0x8'),_0x2f5400,_0x509403,util[_0xd276('0x9')](_0x18924d,{'showHidden':![],'depth':null}));delete _0x18924d[_0xd276('0xa')];_0x2819c3[_0xd276('0xb')](_0x509403)[_0xd276('0xc')](_0x18924d);};}exports[_0xd276('0xd')]=function(_0x2df541,_0x3b7129){return info[_0xd276('0xe')]()[_0xd276('0xf')](function(_0x1b7f8a){return _0x3b7129[_0xd276('0xb')](0xc8)[_0xd276('0x10')](_0x1b7f8a);})[_0xd276('0x11')](function(_0x4cf7f6){return _0x3b7129[_0xd276('0xb')](0x1f4)[_0xd276('0x10')](_0x4cf7f6);});};exports[_0xd276('0x12')]=function(_0x4dc130,_0xbe2939){var _0x4ad28a=[_0xd276('0x13')];return new BPromise(function(_0x26a56f,_0x31eb1c){return exec(util[_0xd276('0x14')](_0xd276('0x15'),_0x4dc130[_0xd276('0x16')]['pid']),function(_0x2464b5,_0x15e98a,_0x5486f3){if(_0x2464b5){return _0x31eb1c(_0x2464b5);}return _0x26a56f(_0x15e98a);});})[_0xd276('0xf')](function(_0x5f19aa){var _0x17149b=![];var _0x5e313f=_0x5f19aa[_0xd276('0x17')](/\n/);for(var _0x55ab67=0x0,_0x58c1b4=_0x4ad28a[_0xd276('0x18')];_0x55ab67<_0x58c1b4,_0x17149b===![];_0x55ab67+=0x1){if(_0x5f19aa[_0xd276('0x19')](_0x4ad28a[_0x55ab67])>=0x0){_0x17149b=!![];}}if(!_0x17149b){throw new Error(util[_0xd276('0x14')](_0xd276('0x1a'),_0x4dc130[_0xd276('0x16')][_0xd276('0x1b')]));}process[_0xd276('0x1c')](_0x4dc130[_0xd276('0x16')][_0xd276('0x1b')],_0xd276('0x1d'));return _0xbe2939[_0xd276('0xb')](0xc8)[_0xd276('0x10')]({'message':util[_0xd276('0x14')](_0xd276('0x1e'),_0x4dc130[_0xd276('0x16')]['pid'])});})[_0xd276('0x11')](handleError(_0xbe2939,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index ced5d10..5acdfb3 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 _0x750a=['/:id','show','create','delete','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index'];(function(_0x29a617,_0x23af4c){var _0x33344c=function(_0x5f2f18){while(--_0x5f2f18){_0x29a617['push'](_0x29a617['shift']());}};_0x33344c(++_0x23af4c);}(_0x750a,0x140));var _0xa750=function(_0x54b907,_0x29ff96){_0x54b907=_0x54b907-0x0;var _0x363d89=_0x750a[_0x54b907];return _0x363d89;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var auth=require(_0xa750('0x3'));var interaction=require(_0xa750('0x4'));var config=require(_0xa750('0x5'));var controller=require(_0xa750('0x6'));router[_0xa750('0x7')]('/',auth[_0xa750('0x8')](),controller[_0xa750('0x9')]);router[_0xa750('0x7')](_0xa750('0xa'),auth[_0xa750('0x8')](),controller[_0xa750('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa750('0xc')]);router['put'](_0xa750('0xa'),auth[_0xa750('0x8')](),controller['update']);router[_0xa750('0xd')](_0xa750('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xa750('0xe')]=router; \ No newline at end of file +var _0xb43b=['get','isAuthenticated','show','post','create','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./tag.controller'];(function(_0x5060f7,_0x2c67bc){var _0x354b6b=function(_0x3672d6){while(--_0x3672d6){_0x5060f7['push'](_0x5060f7['shift']());}};_0x354b6b(++_0x2c67bc);}(_0xb43b,0x1b2));var _0xbb43=function(_0x29791a,_0x4085fd){_0x29791a=_0x29791a-0x0;var _0x44047f=_0xb43b[_0x29791a];return _0x44047f;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbb43('0x5'));var config=require(_0xbb43('0x6'));var controller=require(_0xbb43('0x7'));router[_0xbb43('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbb43('0x8')]('/:id',auth[_0xbb43('0x9')](),controller[_0xbb43('0xa')]);router[_0xbb43('0xb')]('/',auth[_0xbb43('0x9')](),controller[_0xbb43('0xc')]);router['put'](_0xbb43('0xd'),auth[_0xbb43('0x9')](),controller['update']);router[_0xbb43('0xe')](_0xbb43('0xd'),auth[_0xbb43('0x9')](),controller[_0xbb43('0xf')]);module[_0xbb43('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index e2a85c1..b9a9dfb 100644 --- a/server/api/tag/tag.attributes.js +++ b/server/api/tag/tag.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x878f=['STRING','name','#0091EA','exports'];(function(_0x3c7025,_0x565185){var _0x5a450c=function(_0x1a01f0){while(--_0x1a01f0){_0x3c7025['push'](_0x3c7025['shift']());}};_0x5a450c(++_0x565185);}(_0x878f,0x173));var _0xf878=function(_0x3f8472,_0x420821){_0x3f8472=_0x3f8472-0x0;var _0x1c5002=_0x878f[_0x3f8472];return _0x1c5002;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'name':{'type':Sequelize[_0xf878('0x1')],'unique':_0xf878('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf878('0x1')],'defaultValue':_0xf878('0x3')},'description':{'type':Sequelize[_0xf878('0x1')]}}; \ No newline at end of file +var _0xd8b0=['STRING','sequelize','exports','#0091EA'];(function(_0x4a42f0,_0x2da65d){var _0x3dc532=function(_0xb60cdf){while(--_0xb60cdf){_0x4a42f0['push'](_0x4a42f0['shift']());}};_0x3dc532(++_0x2da65d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0x2')},'description':{'type':Sequelize[_0x0d8b('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 2dd72f9..1a8fef8 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 _0x3154=['Tags','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Tag','includeAll','include','findAll','catch','show','params','keys','fields','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','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','util','path','ejs','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3154,0x1c7));var _0x4315=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x3154[_0x45d3f0];return _0x314b79;};'use strict';var pdf=require(_0x4315('0x0'));var emlformat=require(_0x4315('0x1'));var rimraf=require(_0x4315('0x2'));var zipdir=require(_0x4315('0x3'));var jsonpatch=require(_0x4315('0x4'));var rp=require(_0x4315('0x5'));var moment=require(_0x4315('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4315('0x7'));var path=require(_0x4315('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4315('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4315('0xa'));var crypto=require(_0x4315('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4315('0xc'));var toCsv=require(_0x4315('0xd'));var querystring=require('querystring');var Papa=require(_0x4315('0xe'));var Redis=require(_0x4315('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4315('0x10'));var as=require(_0x4315('0x11'));var hardwareService=require(_0x4315('0x12'));var logger=require('../../config/logger')(_0x4315('0x13'));var utils=require(_0x4315('0x14'));var config=require('../../config/environment');var db=require(_0x4315('0x15'))['db'];function respondWithStatusCode(_0x55097b,_0x2465dc){_0x2465dc=_0x2465dc||0xcc;return function(_0x3c2244){if(_0x3c2244){return _0x55097b[_0x4315('0x16')](_0x2465dc);}return _0x55097b['status'](_0x2465dc)[_0x4315('0x17')]();};}function respondWithResult(_0x1ec9f8,_0x437942){_0x437942=_0x437942||0xc8;return function(_0x2010ee){if(_0x2010ee){return _0x1ec9f8[_0x4315('0x18')](_0x437942)[_0x4315('0x19')](_0x2010ee);}};}function respondWithFilteredResult(_0x11a079,_0x534abd){return function(_0x2011d5){if(_0x2011d5){var _0x3fd86a=_0x2011d5[_0x4315('0x1a')],_0x45424f=_0x534abd[_0x4315('0x1b')],_0x463e29=_0x534abd[_0x4315('0x1b')]+_0x534abd[_0x4315('0x1c')],_0x35bf63;if(_0x463e29>=_0x3fd86a){_0x463e29=_0x3fd86a;_0x35bf63=0xc8;}else{_0x35bf63=0xce;}_0x11a079[_0x4315('0x18')](_0x35bf63);return _0x11a079[_0x4315('0x1d')](_0x4315('0x1e'),_0x45424f+'-'+_0x463e29+'/'+_0x3fd86a)[_0x4315('0x19')](_0x2011d5);}return null;};}function patchUpdates(_0x24a7bc){return function(_0x3d99bd){try{jsonpatch[_0x4315('0x1f')](_0x3d99bd,_0x24a7bc,!![]);}catch(_0x3c652c){return BPromise[_0x4315('0x20')](_0x3c652c);}return _0x3d99bd[_0x4315('0x21')]();};}function saveUpdates(_0x460631,_0x386426){return function(_0x419c80){if(_0x419c80){return _0x419c80[_0x4315('0x22')](_0x460631)[_0x4315('0x23')](function(_0x209b3e){return _0x209b3e;});}return null;};}function removeEntity(_0x437a51,_0x371b21){return function(_0x4c461e){if(_0x4c461e){return _0x4c461e[_0x4315('0x24')]()[_0x4315('0x23')](function(){var _0x6aefeb=_0x4c461e['get']({'plain':!![]});var _0x51f68b=_0x4315('0x25');return db[_0x4315('0x26')][_0x4315('0x24')]({'where':{'type':_0x51f68b,'resourceId':_0x6aefeb['id']}})[_0x4315('0x23')](function(){return _0x4c461e;});})[_0x4315('0x23')](function(){_0x437a51[_0x4315('0x18')](0xcc)[_0x4315('0x17')]();});}};}function handleEntityNotFound(_0x26cb37,_0x193da0){return function(_0x166cac){if(!_0x166cac){_0x26cb37[_0x4315('0x16')](0x194);}return _0x166cac;};}function handleError(_0x203c95,_0x532073){_0x532073=_0x532073||0x1f4;return function(_0x35b3c2){logger[_0x4315('0x27')](_0x35b3c2[_0x4315('0x28')]);if(_0x35b3c2['name']){delete _0x35b3c2[_0x4315('0x29')];}_0x203c95[_0x4315('0x18')](_0x532073)[_0x4315('0x2a')](_0x35b3c2);};}exports[_0x4315('0x2b')]=function(_0x4008a1,_0x848cfe){var _0x113207={},_0x363e04={},_0x355129={'count':0x0,'rows':[]};var _0x4fdac1=_[_0x4315('0x2c')](db['Tag'][_0x4315('0x2d')],function(_0xd5f2f3){return{'name':_0xd5f2f3['fieldName'],'type':_0xd5f2f3[_0x4315('0x2e')][_0x4315('0x2f')]};});_0x363e04[_0x4315('0x30')]=_[_0x4315('0x2c')](_0x4fdac1,_0x4315('0x29'));_0x363e04[_0x4315('0x31')]=_['keys'](_0x4008a1[_0x4315('0x31')]);_0x363e04[_0x4315('0x32')]=_[_0x4315('0x33')](_0x363e04[_0x4315('0x30')],_0x363e04[_0x4315('0x31')]);_0x113207[_0x4315('0x34')]=_['intersection'](_0x363e04[_0x4315('0x30')],qs['fields'](_0x4008a1[_0x4315('0x31')]['fields']));_0x113207[_0x4315('0x34')]=_0x113207[_0x4315('0x34')][_0x4315('0x35')]?_0x113207[_0x4315('0x34')]:_0x363e04[_0x4315('0x30')];if(!_0x4008a1[_0x4315('0x31')][_0x4315('0x36')](_0x4315('0x37'))){_0x113207[_0x4315('0x1c')]=qs['limit'](_0x4008a1[_0x4315('0x31')][_0x4315('0x1c')]);_0x113207[_0x4315('0x1b')]=qs[_0x4315('0x1b')](_0x4008a1[_0x4315('0x31')][_0x4315('0x1b')]);}_0x113207[_0x4315('0x38')]=qs['sort'](_0x4008a1[_0x4315('0x31')][_0x4315('0x39')]);_0x113207[_0x4315('0x3a')]=qs[_0x4315('0x32')](_[_0x4315('0x3b')](_0x4008a1[_0x4315('0x31')],_0x363e04[_0x4315('0x32')]));if(_0x4008a1['query'][_0x4315('0x3c')]){_0x113207['where']=_['merge'](_0x113207[_0x4315('0x3a')],{'$or':_[_0x4315('0x2c')](_0x4fdac1,function(_0x1096a2){if(_0x1096a2[_0x4315('0x2e')]!==_0x4315('0x3d')){var _0x1af40f={};_0x1af40f[_0x1096a2['name']]={'$like':'%'+_0x4008a1[_0x4315('0x31')][_0x4315('0x3c')]+'%'};return _0x1af40f;}})});}_0x113207=_[_0x4315('0x3e')]({},_0x113207,_0x4008a1[_0x4315('0x3f')]);var _0x14a48f={'where':_0x113207['where']};return db[_0x4315('0x40')][_0x4315('0x1a')](_0x14a48f)[_0x4315('0x23')](function(_0x37d44d){_0x355129[_0x4315('0x1a')]=_0x37d44d;if(_0x4008a1[_0x4315('0x31')][_0x4315('0x41')]){_0x113207[_0x4315('0x42')]=[{'all':!![]}];}return db[_0x4315('0x40')][_0x4315('0x43')](_0x113207);})[_0x4315('0x23')](function(_0x48a53b){_0x355129['rows']=_0x48a53b;return _0x355129;})[_0x4315('0x23')](respondWithFilteredResult(_0x848cfe,_0x113207))[_0x4315('0x44')](handleError(_0x848cfe,null));};exports[_0x4315('0x45')]=function(_0x4b8926,_0x3039a7){var _0x35ab87={'raw':!![],'where':{'id':_0x4b8926[_0x4315('0x46')]['id']}},_0xb7a099={};_0xb7a099['model']=_[_0x4315('0x47')](db[_0x4315('0x40')][_0x4315('0x2d')]);_0xb7a099[_0x4315('0x31')]=_['keys'](_0x4b8926[_0x4315('0x31')]);_0xb7a099[_0x4315('0x32')]=_[_0x4315('0x33')](_0xb7a099[_0x4315('0x30')],_0xb7a099['query']);_0x35ab87['attributes']=_[_0x4315('0x33')](_0xb7a099[_0x4315('0x30')],qs['fields'](_0x4b8926[_0x4315('0x31')][_0x4315('0x48')]));_0x35ab87[_0x4315('0x34')]=_0x35ab87['attributes'][_0x4315('0x35')]?_0x35ab87[_0x4315('0x34')]:_0xb7a099[_0x4315('0x30')];if(_0x4b8926[_0x4315('0x31')][_0x4315('0x41')]){_0x35ab87[_0x4315('0x42')]=[{'all':!![]}];}_0x35ab87=_['merge']({},_0x35ab87,_0x4b8926[_0x4315('0x3f')]);return db[_0x4315('0x40')]['find'](_0x35ab87)[_0x4315('0x23')](handleEntityNotFound(_0x3039a7,null))[_0x4315('0x23')](respondWithResult(_0x3039a7,null))['catch'](handleError(_0x3039a7,null));};exports[_0x4315('0x49')]=function(_0x2f03df,_0x192eb8){return db[_0x4315('0x40')][_0x4315('0x49')](_0x2f03df[_0x4315('0x4a')],{})['then'](function(_0x34959f){var _0x15b7e3=_0x2f03df[_0x4315('0x4b')][_0x4315('0x4c')]({'plain':!![]});if(!_0x15b7e3)throw new Error(_0x4315('0x4d'));if(_0x15b7e3['role']===_0x4315('0x4b')){var _0x4bfa7a=_0x34959f[_0x4315('0x4c')]({'plain':!![]});var _0x5bc788=_0x4315('0x25');return db[_0x4315('0x4e')][_0x4315('0x4f')]({'where':{'name':_0x5bc788,'userProfileId':_0x15b7e3['userProfileId']},'raw':!![]})[_0x4315('0x23')](function(_0x58f5d2){if(_0x58f5d2&&_0x58f5d2[_0x4315('0x50')]===0x0){return db['UserProfileResource'][_0x4315('0x49')]({'name':_0x4bfa7a[_0x4315('0x29')],'resourceId':_0x4bfa7a['id'],'type':_0x58f5d2['name'],'sectionId':_0x58f5d2['id']},{})['then'](function(){return _0x34959f;});}else{return _0x34959f;}})[_0x4315('0x44')](function(_0x44364d){logger[_0x4315('0x27')](_0x4315('0x51'),_0x44364d);throw _0x44364d;});}return _0x34959f;})['then'](respondWithResult(_0x192eb8,0xc9))['catch'](handleError(_0x192eb8,null));};exports[_0x4315('0x22')]=function(_0x1316b6,_0x2632ff){if(_0x1316b6[_0x4315('0x4a')]['id']){delete _0x1316b6[_0x4315('0x4a')]['id'];}return db[_0x4315('0x40')][_0x4315('0x4f')]({'where':{'id':_0x1316b6[_0x4315('0x46')]['id']}})['then'](handleEntityNotFound(_0x2632ff,null))[_0x4315('0x23')](saveUpdates(_0x1316b6[_0x4315('0x4a')],null))[_0x4315('0x23')](respondWithResult(_0x2632ff,null))[_0x4315('0x44')](handleError(_0x2632ff,null));};exports[_0x4315('0x24')]=function(_0x4848a2,_0xb93aab){return db[_0x4315('0x40')]['find']({'where':{'id':_0x4848a2[_0x4315('0x46')]['id']}})[_0x4315('0x23')](handleEntityNotFound(_0xb93aab,null))[_0x4315('0x23')](removeEntity(_0xb93aab,null))['catch'](handleError(_0xb93aab,null));}; \ No newline at end of file +var _0xc4ae=['nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','find','catch','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','json','apply','save','update','get','Tags','UserProfileResource','destroy','then','error','stack','map','Tag','rawAttributes','type','key','model','name','query','keys','filters','attributes','intersection','fields','length'];(function(_0x4f4570,_0xe45ec){var _0x3791ff=function(_0x3fed22){while(--_0x3fed22){_0x4f4570['push'](_0x4f4570['shift']());}};_0x3791ff(++_0xe45ec);}(_0xc4ae,0x66));var _0xec4a=function(_0x43f7c3,_0x152d47){_0x43f7c3=_0x43f7c3-0x0;var _0x403406=_0xc4ae[_0x43f7c3];return _0x403406;};'use strict';var pdf=require(_0xec4a('0x0'));var emlformat=require(_0xec4a('0x1'));var rimraf=require(_0xec4a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec4a('0x3'));var rp=require(_0xec4a('0x4'));var moment=require(_0xec4a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xec4a('0x6'));var util=require(_0xec4a('0x7'));var path=require(_0xec4a('0x8'));var sox=require(_0xec4a('0x9'));var csv=require(_0xec4a('0xa'));var ejs=require(_0xec4a('0xb'));var fs=require('fs');var _=require(_0xec4a('0xc'));var squel=require(_0xec4a('0xd'));var crypto=require('crypto');var jsforce=require(_0xec4a('0xe'));var deskjs=require(_0xec4a('0xf'));var toCsv=require(_0xec4a('0xa'));var querystring=require(_0xec4a('0x10'));var Papa=require(_0xec4a('0x11'));var Redis=require(_0xec4a('0x12'));var authService=require(_0xec4a('0x13'));var qs=require(_0xec4a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec4a('0x15'));var logger=require(_0xec4a('0x16'))(_0xec4a('0x17'));var utils=require(_0xec4a('0x18'));var config=require(_0xec4a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a9f01,_0x183c9f){_0x183c9f=_0x183c9f||0xcc;return function(_0x264bd1){if(_0x264bd1){return _0x2a9f01[_0xec4a('0x1a')](_0x183c9f);}return _0x2a9f01[_0xec4a('0x1b')](_0x183c9f)[_0xec4a('0x1c')]();};}function respondWithResult(_0x310e3d,_0xc8c772){_0xc8c772=_0xc8c772||0xc8;return function(_0x417c34){if(_0x417c34){return _0x310e3d['status'](_0xc8c772)['json'](_0x417c34);}};}function respondWithFilteredResult(_0x2afa54,_0x553ed9){return function(_0x23a349){if(_0x23a349){var _0x2b0d33=_0x23a349[_0xec4a('0x1d')],_0xe04851=_0x553ed9[_0xec4a('0x1e')],_0x5da063=_0x553ed9[_0xec4a('0x1e')]+_0x553ed9[_0xec4a('0x1f')],_0x705ca9;if(_0x5da063>=_0x2b0d33){_0x5da063=_0x2b0d33;_0x705ca9=0xc8;}else{_0x705ca9=0xce;}_0x2afa54[_0xec4a('0x1b')](_0x705ca9);return _0x2afa54[_0xec4a('0x20')]('Content-Range',_0xe04851+'-'+_0x5da063+'/'+_0x2b0d33)[_0xec4a('0x21')](_0x23a349);}return null;};}function patchUpdates(_0x1f0cbb){return function(_0x35873a){try{jsonpatch[_0xec4a('0x22')](_0x35873a,_0x1f0cbb,!![]);}catch(_0x547a21){return BPromise['reject'](_0x547a21);}return _0x35873a[_0xec4a('0x23')]();};}function saveUpdates(_0x240233,_0x36a273){return function(_0xc5a273){if(_0xc5a273){return _0xc5a273[_0xec4a('0x24')](_0x240233)['then'](function(_0x386fab){return _0x386fab;});}return null;};}function removeEntity(_0x5561a7,_0x412204){return function(_0x3fd9b3){if(_0x3fd9b3){return _0x3fd9b3['destroy']()['then'](function(){var _0x102f04=_0x3fd9b3[_0xec4a('0x25')]({'plain':!![]});var _0x46f5af=_0xec4a('0x26');return db[_0xec4a('0x27')][_0xec4a('0x28')]({'where':{'type':_0x46f5af,'resourceId':_0x102f04['id']}})[_0xec4a('0x29')](function(){return _0x3fd9b3;});})[_0xec4a('0x29')](function(){_0x5561a7[_0xec4a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b293b,_0x4287f2){return function(_0x34ef86){if(!_0x34ef86){_0x4b293b[_0xec4a('0x1a')](0x194);}return _0x34ef86;};}function handleError(_0x36b4e3,_0x5beceb){_0x5beceb=_0x5beceb||0x1f4;return function(_0x31c75c){logger[_0xec4a('0x2a')](_0x31c75c[_0xec4a('0x2b')]);if(_0x31c75c['name']){delete _0x31c75c['name'];}_0x36b4e3[_0xec4a('0x1b')](_0x5beceb)['send'](_0x31c75c);};}exports['index']=function(_0x4f745e,_0x3abb41){var _0x3e6722={},_0x4015e0={},_0x5178c5={'count':0x0,'rows':[]};var _0x253f0a=_[_0xec4a('0x2c')](db[_0xec4a('0x2d')][_0xec4a('0x2e')],function(_0x1f0769){return{'name':_0x1f0769['fieldName'],'type':_0x1f0769[_0xec4a('0x2f')][_0xec4a('0x30')]};});_0x4015e0[_0xec4a('0x31')]=_[_0xec4a('0x2c')](_0x253f0a,_0xec4a('0x32'));_0x4015e0[_0xec4a('0x33')]=_[_0xec4a('0x34')](_0x4f745e[_0xec4a('0x33')]);_0x4015e0[_0xec4a('0x35')]=_['intersection'](_0x4015e0['model'],_0x4015e0[_0xec4a('0x33')]);_0x3e6722[_0xec4a('0x36')]=_[_0xec4a('0x37')](_0x4015e0[_0xec4a('0x31')],qs[_0xec4a('0x38')](_0x4f745e['query'][_0xec4a('0x38')]));_0x3e6722[_0xec4a('0x36')]=_0x3e6722[_0xec4a('0x36')][_0xec4a('0x39')]?_0x3e6722[_0xec4a('0x36')]:_0x4015e0[_0xec4a('0x31')];if(!_0x4f745e['query']['hasOwnProperty'](_0xec4a('0x3a'))){_0x3e6722[_0xec4a('0x1f')]=qs[_0xec4a('0x1f')](_0x4f745e[_0xec4a('0x33')][_0xec4a('0x1f')]);_0x3e6722[_0xec4a('0x1e')]=qs[_0xec4a('0x1e')](_0x4f745e[_0xec4a('0x33')][_0xec4a('0x1e')]);}_0x3e6722['order']=qs[_0xec4a('0x3b')](_0x4f745e[_0xec4a('0x33')][_0xec4a('0x3b')]);_0x3e6722[_0xec4a('0x3c')]=qs[_0xec4a('0x35')](_[_0xec4a('0x3d')](_0x4f745e[_0xec4a('0x33')],_0x4015e0[_0xec4a('0x35')]));if(_0x4f745e[_0xec4a('0x33')][_0xec4a('0x3e')]){_0x3e6722['where']=_[_0xec4a('0x3f')](_0x3e6722[_0xec4a('0x3c')],{'$or':_['map'](_0x253f0a,function(_0x3e79c7){if(_0x3e79c7[_0xec4a('0x2f')]!=='VIRTUAL'){var _0x58c92f={};_0x58c92f[_0x3e79c7[_0xec4a('0x32')]]={'$like':'%'+_0x4f745e['query'][_0xec4a('0x3e')]+'%'};return _0x58c92f;}})});}_0x3e6722=_[_0xec4a('0x3f')]({},_0x3e6722,_0x4f745e[_0xec4a('0x40')]);var _0x46f979={'where':_0x3e6722['where']};return db[_0xec4a('0x2d')][_0xec4a('0x1d')](_0x46f979)[_0xec4a('0x29')](function(_0x4c80c6){_0x5178c5[_0xec4a('0x1d')]=_0x4c80c6;if(_0x4f745e[_0xec4a('0x33')][_0xec4a('0x41')]){_0x3e6722[_0xec4a('0x42')]=[{'all':!![]}];}return db['Tag'][_0xec4a('0x43')](_0x3e6722);})[_0xec4a('0x29')](function(_0x3d58b5){_0x5178c5[_0xec4a('0x44')]=_0x3d58b5;return _0x5178c5;})[_0xec4a('0x29')](respondWithFilteredResult(_0x3abb41,_0x3e6722))['catch'](handleError(_0x3abb41,null));};exports[_0xec4a('0x45')]=function(_0x380811,_0x31e972){var _0x4182bc={'raw':!![],'where':{'id':_0x380811['params']['id']}},_0x58a353={};_0x58a353[_0xec4a('0x31')]=_['keys'](db[_0xec4a('0x2d')][_0xec4a('0x2e')]);_0x58a353[_0xec4a('0x33')]=_[_0xec4a('0x34')](_0x380811[_0xec4a('0x33')]);_0x58a353[_0xec4a('0x35')]=_[_0xec4a('0x37')](_0x58a353['model'],_0x58a353[_0xec4a('0x33')]);_0x4182bc['attributes']=_[_0xec4a('0x37')](_0x58a353[_0xec4a('0x31')],qs['fields'](_0x380811[_0xec4a('0x33')][_0xec4a('0x38')]));_0x4182bc[_0xec4a('0x36')]=_0x4182bc[_0xec4a('0x36')][_0xec4a('0x39')]?_0x4182bc[_0xec4a('0x36')]:_0x58a353[_0xec4a('0x31')];if(_0x380811[_0xec4a('0x33')][_0xec4a('0x41')]){_0x4182bc[_0xec4a('0x42')]=[{'all':!![]}];}_0x4182bc=_['merge']({},_0x4182bc,_0x380811[_0xec4a('0x40')]);return db[_0xec4a('0x2d')][_0xec4a('0x46')](_0x4182bc)['then'](handleEntityNotFound(_0x31e972,null))[_0xec4a('0x29')](respondWithResult(_0x31e972,null))[_0xec4a('0x47')](handleError(_0x31e972,null));};exports[_0xec4a('0x48')]=function(_0x48f2fd,_0xa8a1b){return db['Tag']['create'](_0x48f2fd['body'],{})[_0xec4a('0x29')](function(_0xd0a88d){var _0x1c512a=_0x48f2fd[_0xec4a('0x49')]['get']({'plain':!![]});if(!_0x1c512a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c512a['role']===_0xec4a('0x49')){var _0x38b331=_0xd0a88d[_0xec4a('0x25')]({'plain':!![]});var _0x163ea9=_0xec4a('0x26');return db[_0xec4a('0x4a')]['find']({'where':{'name':_0x163ea9,'userProfileId':_0x1c512a[_0xec4a('0x4b')]},'raw':!![]})['then'](function(_0x619ea3){if(_0x619ea3&&_0x619ea3[_0xec4a('0x4c')]===0x0){return db[_0xec4a('0x27')][_0xec4a('0x48')]({'name':_0x38b331[_0xec4a('0x32')],'resourceId':_0x38b331['id'],'type':_0x619ea3['name'],'sectionId':_0x619ea3['id']},{})[_0xec4a('0x29')](function(){return _0xd0a88d;});}else{return _0xd0a88d;}})['catch'](function(_0x3a5034){logger[_0xec4a('0x2a')](_0xec4a('0x4d'),_0x3a5034);throw _0x3a5034;});}return _0xd0a88d;})[_0xec4a('0x29')](respondWithResult(_0xa8a1b,0xc9))[_0xec4a('0x47')](handleError(_0xa8a1b,null));};exports['update']=function(_0x76f810,_0x1651e2){if(_0x76f810[_0xec4a('0x4e')]['id']){delete _0x76f810['body']['id'];}return db['Tag']['find']({'where':{'id':_0x76f810[_0xec4a('0x4f')]['id']}})[_0xec4a('0x29')](handleEntityNotFound(_0x1651e2,null))[_0xec4a('0x29')](saveUpdates(_0x76f810['body'],null))['then'](respondWithResult(_0x1651e2,null))['catch'](handleError(_0x1651e2,null));};exports[_0xec4a('0x28')]=function(_0x3faf19,_0x4e2b60){return db[_0xec4a('0x2d')][_0xec4a('0x46')]({'where':{'id':_0x3faf19[_0xec4a('0x4f')]['id']}})[_0xec4a('0x29')](handleEntityNotFound(_0x4e2b60,null))[_0xec4a('0x29')](removeEntity(_0x4e2b60,null))[_0xec4a('0x47')](handleError(_0x4e2b60,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index ad05ff3..5c91008 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 _0xa96d=['bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','Tag','tools_tags','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa96d,0x116));var _0xda96=function(_0x36641f,_0x1de996){_0x36641f=_0x36641f-0x0;var _0x264197=_0xa96d[_0x36641f];return _0x264197;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xda96('0x0'));var BPromise=require(_0xda96('0x1'));var rp=require(_0xda96('0x2'));var fs=require('fs');var path=require(_0xda96('0x3'));var rimraf=require(_0xda96('0x4'));var config=require(_0xda96('0x5'));var attributes=require(_0xda96('0x6'));module['exports']=function(_0x1681ed,_0x4b890e){return _0x1681ed['define'](_0xda96('0x7'),attributes,{'tableName':_0xda96('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d5c=['define','tools_tags','util','api','moment','path','../../config/environment','./tag.attributes','exports'];(function(_0x2c416a,_0x732630){var _0x4218d5=function(_0x436357){while(--_0x436357){_0x2c416a['push'](_0x2c416a['shift']());}};_0x4218d5(++_0x732630);}(_0x2d5c,0x107));var _0xc2d5=function(_0xa90947,_0x526e7b){_0xa90947=_0xa90947-0x0;var _0x4d946b=_0x2d5c[_0xa90947];return _0x4d946b;};'use strict';var _=require('lodash');var util=require(_0xc2d5('0x0'));var logger=require('../../config/logger')(_0xc2d5('0x1'));var moment=require(_0xc2d5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc2d5('0x3'));var rimraf=require('rimraf');var config=require(_0xc2d5('0x4'));var attributes=require(_0xc2d5('0x5'));module[_0xc2d5('0x6')]=function(_0x4f42a5,_0xe058b4){return _0x4f42a5[_0xc2d5('0x7')]('Tag',attributes,{'tableName':_0xc2d5('0x8'),'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 3c39f1f..7635356 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 _0xd3d1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x53dff0,_0x50e2b2){var _0x4c2d49=function(_0x3764d0){while(--_0x3764d0){_0x53dff0['push'](_0x53dff0['shift']());}};_0x4c2d49(++_0x50e2b2);}(_0xd3d1,0x172));var _0x1d3d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd3d1[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d3d('0x2'));var fs=require('fs');var Redis=require(_0x1d3d('0x3'));var db=require(_0x1d3d('0x4'))['db'];var utils=require(_0x1d3d('0x5'));var logger=require(_0x1d3d('0x6'))(_0x1d3d('0x7'));var config=require(_0x1d3d('0x8'));var jayson=require(_0x1d3d('0x9'));var client=jayson[_0x1d3d('0xa')][_0x1d3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3831ce,_0xb1b3c6,_0xe10bca){return new BPromise(function(_0x2c377c,_0xbea61e){return client[_0x1d3d('0xc')](_0x3831ce,_0xe10bca)[_0x1d3d('0xd')](function(_0x510a37){logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));logger[_0x1d3d('0x11')](_0x1d3d('0x12'),_0xb1b3c6,_0x1d3d('0x10'),JSON[_0x1d3d('0x13')](_0x510a37));if(_0x510a37[_0x1d3d('0x14')]){if(_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x15')]===0x1f4){logger[_0x1d3d('0x14')]('Tag,\x20%s,\x20%s',_0xb1b3c6,_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x16')]);return _0xbea61e(_0x510a37['error']['message']);}logger[_0x1d3d('0x14')](_0x1d3d('0xf'),_0xb1b3c6,_0x510a37[_0x1d3d('0x14')]['message']);return _0x2c377c(_0x510a37[_0x1d3d('0x14')]['message']);}else{logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));_0x2c377c(_0x510a37[_0x1d3d('0x17')][_0x1d3d('0x16')]);}})[_0x1d3d('0x18')](function(_0x3dcb67){logger['error']('Tag,\x20%s,\x20%s',_0xb1b3c6,_0x3dcb67);_0xbea61e(_0x3dcb67);});});} \ No newline at end of file +var _0xdace=['request\x20sent','debug','stringify','error','code','Tag,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0xdace,0xc5));var _0xedac=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0xdace[_0x2a3c4d];return _0x55c390;};'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']('Tag,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('Tag,\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 diff --git a/server/api/team/index.js b/server/api/team/index.js index 65568c9..2c4593f 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 _0xd49a=['../../config/environment','./team.controller','isAuthenticated','index','get','/:id','show','/:id/queues','getQueues','/:id/users','post','create','addQueues','addAgents','put','update','delete','destroy','removeQueues','exports','multer','util','connect-timeout'];(function(_0x23e22d,_0x3b8093){var _0x1cf87f=function(_0x962320){while(--_0x962320){_0x23e22d['push'](_0x23e22d['shift']());}};_0x1cf87f(++_0x3b8093);}(_0xd49a,0xb5));var _0xad49=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd49a[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xad49('0x0'));var util=require(_0xad49('0x1'));var path=require('path');var timeout=require(_0xad49('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xad49('0x3'));var controller=require(_0xad49('0x4'));router['get']('/',auth[_0xad49('0x5')](),controller[_0xad49('0x6')]);router[_0xad49('0x7')](_0xad49('0x8'),auth[_0xad49('0x5')](),controller[_0xad49('0x9')]);router['get'](_0xad49('0xa'),auth[_0xad49('0x5')](),controller[_0xad49('0xb')]);router[_0xad49('0x7')](_0xad49('0xc'),auth[_0xad49('0x5')](),controller['getAgents']);router[_0xad49('0xd')]('/',auth['isAuthenticated'](),controller[_0xad49('0xe')]);router[_0xad49('0xd')](_0xad49('0xa'),auth[_0xad49('0x5')](),controller[_0xad49('0xf')]);router[_0xad49('0xd')](_0xad49('0xc'),auth['isAuthenticated'](),controller[_0xad49('0x10')]);router[_0xad49('0x11')](_0xad49('0x8'),auth[_0xad49('0x5')](),controller[_0xad49('0x12')]);router[_0xad49('0x13')](_0xad49('0x8'),auth[_0xad49('0x5')](),controller[_0xad49('0x14')]);router[_0xad49('0x13')](_0xad49('0xa'),auth['isAuthenticated'](),controller[_0xad49('0x15')]);router[_0xad49('0x13')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xad49('0x16')]=router; \ No newline at end of file +var _0x9da8=['../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','isAuthenticated','show','/:id/queues','/:id/users','getAgents','create','post','addAgents','update','delete','destroy','util','path','connect-timeout','../../components/auth/service'];(function(_0x559bae,_0x508072){var _0x12090c=function(_0xe868bf){while(--_0xe868bf){_0x559bae['push'](_0x559bae['shift']());}};_0x12090c(++_0x508072);}(_0x9da8,0x7a));var _0x89da=function(_0x5b209c,_0x1d3141){_0x5b209c=_0x5b209c-0x0;var _0x1afe7a=_0x9da8[_0x5b209c];return _0x1afe7a;};'use strict';var multer=require('multer');var util=require(_0x89da('0x0'));var path=require(_0x89da('0x1'));var timeout=require(_0x89da('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x89da('0x3'));var interaction=require(_0x89da('0x4'));var config=require(_0x89da('0x5'));var controller=require(_0x89da('0x6'));router[_0x89da('0x7')]('/',auth['isAuthenticated'](),controller[_0x89da('0x8')]);router['get'](_0x89da('0x9'),auth[_0x89da('0xa')](),controller[_0x89da('0xb')]);router['get'](_0x89da('0xc'),auth[_0x89da('0xa')](),controller['getQueues']);router['get'](_0x89da('0xd'),auth['isAuthenticated'](),controller[_0x89da('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x89da('0xf')]);router[_0x89da('0x10')](_0x89da('0xc'),auth['isAuthenticated'](),controller['addQueues']);router['post'](_0x89da('0xd'),auth[_0x89da('0xa')](),controller[_0x89da('0x11')]);router['put'](_0x89da('0x9'),auth['isAuthenticated'](),controller[_0x89da('0x12')]);router[_0x89da('0x13')](_0x89da('0x9'),auth[_0x89da('0xa')](),controller[_0x89da('0x14')]);router['delete'](_0x89da('0xc'),auth[_0x89da('0xa')](),controller['removeQueues']);router['delete'](_0x89da('0xd'),auth[_0x89da('0xa')](),controller['removeAgents']);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 4ab3681..1bf0aa8 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 _0x4d4d=['sequelize','exports','STRING'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4d4d,0xc3));var _0xd4d4=function(_0x54359d,_0x408047){_0x54359d=_0x54359d-0x0;var _0x7e4e28=_0x4d4d[_0x54359d];return _0x7e4e28;};'use strict';var Sequelize=require(_0xd4d4('0x0'));module[_0xd4d4('0x1')]={'name':{'type':Sequelize[_0xd4d4('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xd4d4('0x2')]}}; \ No newline at end of file +var _0xbdc5=['exports','STRING','sequelize'];(function(_0x545a66,_0x590e70){var _0x384b64=function(_0x42ff2e){while(--_0x42ff2e){_0x545a66['push'](_0x545a66['shift']());}};_0x384b64(++_0x590e70);}(_0xbdc5,0x1ee));var _0x5bdc=function(_0x5c32c1,_0x4fb20){_0x5c32c1=_0x5c32c1-0x0;var _0x57ad90=_0xbdc5[_0x5c32c1];return _0x57ad90;};'use strict';var Sequelize=require(_0x5bdc('0x0'));module[_0x5bdc('0x1')]={'name':{'type':Sequelize[_0x5bdc('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x5bdc('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 229835d..e0be61b 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 _0x3c91=['user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','Queues','addQueues','isValidChannel','add','ids','removeQueues','remove','Voice','Chat','Mail','Sms','Fax','Openchannel','each','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','addAgents','omit','spread','emit','userTeam:save','removeAgents','voice','sms','fax','openchannel','userTeam:remove','getAgents','User','nolimit','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','map','Team','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','include','find','create','body'];(function(_0x581416,_0x15b258){var _0x43ddd4=function(_0x22bf82){while(--_0x22bf82){_0x581416['push'](_0x581416['shift']());}};_0x43ddd4(++_0x15b258);}(_0x3c91,0x1af));var _0x13c9=function(_0x14bb98,_0x3187fe){_0x14bb98=_0x14bb98-0x0;var _0x2def12=_0x3c91[_0x14bb98];return _0x2def12;};'use strict';var pdf=require(_0x13c9('0x0'));var emlformat=require(_0x13c9('0x1'));var rimraf=require(_0x13c9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x13c9('0x3'));var moment=require(_0x13c9('0x4'));var BPromise=require(_0x13c9('0x5'));var Mustache=require('mustache');var util=require(_0x13c9('0x6'));var path=require(_0x13c9('0x7'));var sox=require(_0x13c9('0x8'));var csv=require(_0x13c9('0x9'));var ejs=require(_0x13c9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x13c9('0xb'));var jsforce=require(_0x13c9('0xc'));var deskjs=require(_0x13c9('0xd'));var toCsv=require(_0x13c9('0x9'));var querystring=require(_0x13c9('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x13c9('0xf'));var qs=require(_0x13c9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x13c9('0x11'))(_0x13c9('0x12'));var utils=require(_0x13c9('0x13'));var config=require(_0x13c9('0x14'));var db=require(_0x13c9('0x15'))['db'];config[_0x13c9('0x16')]=_[_0x13c9('0x17')](config['redis'],{'host':_0x13c9('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x5c1814,_0x5351f6){_0x5351f6=_0x5351f6||0xcc;return function(_0x5c5a18){if(_0x5c5a18){return _0x5c1814['sendStatus'](_0x5351f6);}return _0x5c1814[_0x13c9('0x19')](_0x5351f6)[_0x13c9('0x1a')]();};}function respondWithResult(_0xa59ee9,_0x1c9601){_0x1c9601=_0x1c9601||0xc8;return function(_0xb269f4){if(_0xb269f4){return _0xa59ee9[_0x13c9('0x19')](_0x1c9601)[_0x13c9('0x1b')](_0xb269f4);}};}function respondWithFilteredResult(_0x4e8e9a,_0x51c4fb){return function(_0x5cfd1f){if(_0x5cfd1f){var _0xd08fc0=_0x5cfd1f[_0x13c9('0x1c')],_0x1a6c06=_0x51c4fb['offset'],_0x1dcaf7=_0x51c4fb[_0x13c9('0x1d')]+_0x51c4fb[_0x13c9('0x1e')],_0x339e7f;if(_0x1dcaf7>=_0xd08fc0){_0x1dcaf7=_0xd08fc0;_0x339e7f=0xc8;}else{_0x339e7f=0xce;}_0x4e8e9a[_0x13c9('0x19')](_0x339e7f);return _0x4e8e9a[_0x13c9('0x1f')](_0x13c9('0x20'),_0x1a6c06+'-'+_0x1dcaf7+'/'+_0xd08fc0)[_0x13c9('0x1b')](_0x5cfd1f);}return null;};}function patchUpdates(_0x3e5d04){return function(_0x4eee50){try{jsonpatch[_0x13c9('0x21')](_0x4eee50,_0x3e5d04,!![]);}catch(_0xed27ee){return BPromise[_0x13c9('0x22')](_0xed27ee);}return _0x4eee50[_0x13c9('0x23')]();};}function saveUpdates(_0x27ebb6,_0x184912){return function(_0x193c91){if(_0x193c91){return _0x193c91[_0x13c9('0x24')](_0x27ebb6)[_0x13c9('0x25')](function(_0x3c3366){return _0x3c3366;});}return null;};}function removeEntity(_0x5dfd9d,_0x63df88){return function(_0x12f9ad){if(_0x12f9ad){return _0x12f9ad[_0x13c9('0x26')]()[_0x13c9('0x25')](function(){var _0x263171=_0x12f9ad['get']({'plain':!![]});var _0x4e1236='Teams';return db['UserProfileResource'][_0x13c9('0x26')]({'where':{'type':_0x4e1236,'resourceId':_0x263171['id']}})[_0x13c9('0x25')](function(){return _0x12f9ad;});})[_0x13c9('0x25')](function(){_0x5dfd9d[_0x13c9('0x19')](0xcc)[_0x13c9('0x1a')]();});}};}function handleEntityNotFound(_0x445486,_0x3fcf1c){return function(_0x447c76){if(!_0x447c76){_0x445486[_0x13c9('0x27')](0x194);}return _0x447c76;};}function handleError(_0x3b2da3,_0x4ec9ff){_0x4ec9ff=_0x4ec9ff||0x1f4;return function(_0x22b8f5){logger[_0x13c9('0x28')](_0x22b8f5['stack']);if(_0x22b8f5[_0x13c9('0x29')]){delete _0x22b8f5[_0x13c9('0x29')];}_0x3b2da3[_0x13c9('0x19')](_0x4ec9ff)['send'](_0x22b8f5);};}exports['index']=function(_0x390073,_0x35249b){var _0x1a1710={},_0x4cb64a={},_0x309606={'count':0x0,'rows':[]};var _0x307576=_[_0x13c9('0x2a')](db[_0x13c9('0x2b')][_0x13c9('0x2c')],function(_0x51c58d){return{'name':_0x51c58d[_0x13c9('0x2d')],'type':_0x51c58d[_0x13c9('0x2e')][_0x13c9('0x2f')]};});_0x4cb64a[_0x13c9('0x30')]=_[_0x13c9('0x2a')](_0x307576,_0x13c9('0x29'));_0x4cb64a[_0x13c9('0x31')]=_['keys'](_0x390073[_0x13c9('0x31')]);_0x4cb64a[_0x13c9('0x32')]=_['intersection'](_0x4cb64a[_0x13c9('0x30')],_0x4cb64a[_0x13c9('0x31')]);_0x1a1710[_0x13c9('0x33')]=_[_0x13c9('0x34')](_0x4cb64a[_0x13c9('0x30')],qs[_0x13c9('0x35')](_0x390073['query']['fields']));_0x1a1710[_0x13c9('0x33')]=_0x1a1710[_0x13c9('0x33')][_0x13c9('0x36')]?_0x1a1710[_0x13c9('0x33')]:_0x4cb64a['model'];if(!_0x390073[_0x13c9('0x31')][_0x13c9('0x37')]('nolimit')){_0x1a1710[_0x13c9('0x1e')]=qs[_0x13c9('0x1e')](_0x390073[_0x13c9('0x31')]['limit']);_0x1a1710[_0x13c9('0x1d')]=qs[_0x13c9('0x1d')](_0x390073[_0x13c9('0x31')][_0x13c9('0x1d')]);}_0x1a1710['order']=qs['sort'](_0x390073[_0x13c9('0x31')][_0x13c9('0x38')]);_0x1a1710['where']=qs[_0x13c9('0x32')](_[_0x13c9('0x39')](_0x390073[_0x13c9('0x31')],_0x4cb64a[_0x13c9('0x32')]));if(_0x390073[_0x13c9('0x31')][_0x13c9('0x3a')]){_0x1a1710[_0x13c9('0x3b')]=_[_0x13c9('0x3c')](_0x1a1710['where'],{'$or':_['map'](_0x307576,function(_0x397c6d){if(_0x397c6d[_0x13c9('0x2e')]!==_0x13c9('0x3d')){var _0x442867={};_0x442867[_0x397c6d[_0x13c9('0x29')]]={'$like':'%'+_0x390073[_0x13c9('0x31')]['filter']+'%'};return _0x442867;}})});}_0x1a1710=_[_0x13c9('0x3c')]({},_0x1a1710,_0x390073[_0x13c9('0x3e')]);var _0x31ebb5={'where':_0x1a1710['where']};return db[_0x13c9('0x2b')][_0x13c9('0x1c')](_0x31ebb5)[_0x13c9('0x25')](function(_0x1adfeb){_0x309606['count']=_0x1adfeb;if(_0x390073[_0x13c9('0x31')][_0x13c9('0x3f')]){_0x1a1710['include']=[{'all':!![]}];}return db[_0x13c9('0x2b')]['findAll'](_0x1a1710);})['then'](function(_0x141ebe){_0x309606[_0x13c9('0x40')]=_0x141ebe;return _0x309606;})[_0x13c9('0x25')](respondWithFilteredResult(_0x35249b,_0x1a1710))[_0x13c9('0x41')](handleError(_0x35249b,null));};exports[_0x13c9('0x42')]=function(_0x4e0f2f,_0x129a70){var _0x3a520d={'raw':![],'where':{'id':_0x4e0f2f[_0x13c9('0x43')]['id']}},_0x1d4075={};_0x1d4075[_0x13c9('0x30')]=_[_0x13c9('0x44')](db[_0x13c9('0x2b')][_0x13c9('0x2c')]);_0x1d4075[_0x13c9('0x31')]=_[_0x13c9('0x44')](_0x4e0f2f[_0x13c9('0x31')]);_0x1d4075[_0x13c9('0x32')]=_['intersection'](_0x1d4075[_0x13c9('0x30')],_0x1d4075[_0x13c9('0x31')]);_0x3a520d[_0x13c9('0x33')]=_['intersection'](_0x1d4075['model'],qs[_0x13c9('0x35')](_0x4e0f2f[_0x13c9('0x31')][_0x13c9('0x35')]));_0x3a520d[_0x13c9('0x33')]=_0x3a520d['attributes'][_0x13c9('0x36')]?_0x3a520d[_0x13c9('0x33')]:_0x1d4075['model'];if(_0x4e0f2f[_0x13c9('0x31')][_0x13c9('0x3f')]){_0x3a520d[_0x13c9('0x45')]=[{'all':!![]}];}_0x3a520d=_[_0x13c9('0x3c')]({},_0x3a520d,_0x4e0f2f[_0x13c9('0x3e')]);return db['Team'][_0x13c9('0x46')](_0x3a520d)['then'](handleEntityNotFound(_0x129a70,null))[_0x13c9('0x25')](respondWithResult(_0x129a70,null))[_0x13c9('0x41')](handleError(_0x129a70,null));};exports['create']=function(_0x2bc31a,_0xc99d18){return db[_0x13c9('0x2b')][_0x13c9('0x47')](_0x2bc31a[_0x13c9('0x48')],{})[_0x13c9('0x25')](function(_0x24907f){var _0x10c4f8=_0x2bc31a[_0x13c9('0x49')][_0x13c9('0x4a')]({'plain':!![]});if(!_0x10c4f8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10c4f8[_0x13c9('0x4b')]===_0x13c9('0x49')){var _0x1bcac9=_0x24907f['get']({'plain':!![]});var _0xab1963='Teams';return db[_0x13c9('0x4c')]['find']({'where':{'name':_0xab1963,'userProfileId':_0x10c4f8[_0x13c9('0x4d')]},'raw':!![]})[_0x13c9('0x25')](function(_0x221adf){if(_0x221adf&&_0x221adf[_0x13c9('0x4e')]===0x0){return db[_0x13c9('0x4f')][_0x13c9('0x47')]({'name':_0x1bcac9['name'],'resourceId':_0x1bcac9['id'],'type':_0x221adf[_0x13c9('0x29')],'sectionId':_0x221adf['id']},{})[_0x13c9('0x25')](function(){return _0x24907f;});}else{return _0x24907f;}})['catch'](function(_0x144554){logger[_0x13c9('0x28')](_0x13c9('0x50'),_0x144554);throw _0x144554;});}return _0x24907f;})['then'](respondWithResult(_0xc99d18,0xc9))[_0x13c9('0x41')](handleError(_0xc99d18,null));};exports[_0x13c9('0x24')]=function(_0x1ebe79,_0x189c57){if(_0x1ebe79['body']['id']){delete _0x1ebe79[_0x13c9('0x48')]['id'];}return db[_0x13c9('0x2b')][_0x13c9('0x46')]({'where':{'id':_0x1ebe79[_0x13c9('0x43')]['id']}})[_0x13c9('0x25')](handleEntityNotFound(_0x189c57,null))[_0x13c9('0x25')](saveUpdates(_0x1ebe79[_0x13c9('0x48')],null))[_0x13c9('0x25')](respondWithResult(_0x189c57,null))[_0x13c9('0x41')](handleError(_0x189c57,null));};exports[_0x13c9('0x26')]=function(_0x21acb2,_0x3d950f){return db[_0x13c9('0x2b')][_0x13c9('0x46')]({'where':{'id':_0x21acb2['params']['id']}})[_0x13c9('0x25')](handleEntityNotFound(_0x3d950f,null))[_0x13c9('0x25')](removeEntity(_0x3d950f,null))['catch'](handleError(_0x3d950f,null));};exports[_0x13c9('0x51')]=function(_0x35b335,_0x188d2f,_0x12ae9f){return db[_0x13c9('0x2b')][_0x13c9('0x52')]({'where':{'id':_0x35b335[_0x13c9('0x43')]['id']}})['then'](handleEntityNotFound(_0x188d2f,null))[_0x13c9('0x25')](function(_0x2f1aaf){if(!_0x35b335['query'][_0x13c9('0x53')]||!utils['isValidChannel'](_0x35b335[_0x13c9('0x31')]['channel'])){throw new db[(_0x13c9('0x54'))][(_0x13c9('0x55'))](_0x13c9('0x56'));}var _0x33a4c8={};var _0x45c388={};_0x45c388[_0x13c9('0x30')]=_[_0x13c9('0x44')](db[_[_0x13c9('0x57')](_0x35b335[_0x13c9('0x31')][_0x13c9('0x53')][_0x13c9('0x58')]())+_0x13c9('0x59')]['rawAttributes']);_0x45c388[_0x13c9('0x31')]=_[_0x13c9('0x44')](_0x35b335[_0x13c9('0x31')]);_0x45c388[_0x13c9('0x32')]=_[_0x13c9('0x34')](_0x45c388[_0x13c9('0x30')],_0x45c388[_0x13c9('0x31')]);_0x33a4c8['attributes']=_[_0x13c9('0x34')](_0x45c388[_0x13c9('0x30')],qs[_0x13c9('0x35')](_0x35b335[_0x13c9('0x31')]['fields']));_0x33a4c8['attributes']=_0x33a4c8['attributes'][_0x13c9('0x36')]?_0x33a4c8[_0x13c9('0x33')]:_0x45c388[_0x13c9('0x30')];_0x33a4c8['limit']=qs[_0x13c9('0x1e')](_0x35b335[_0x13c9('0x31')][_0x13c9('0x1e')]);_0x33a4c8[_0x13c9('0x1d')]=qs[_0x13c9('0x1d')](_0x35b335['query'][_0x13c9('0x1d')]);_0x33a4c8[_0x13c9('0x5a')]=qs[_0x13c9('0x38')](_0x35b335[_0x13c9('0x31')][_0x13c9('0x38')]);_0x33a4c8[_0x13c9('0x3b')]=qs[_0x13c9('0x32')](_[_0x13c9('0x39')](_0x35b335['query'],_0x45c388['filters']));_0x33a4c8=_[_0x13c9('0x3c')]({},_0x33a4c8,_0x35b335[_0x13c9('0x3e')]);return _0x2f1aaf[_0x13c9('0x4a')+_['capitalize'](_0x35b335[_0x13c9('0x31')]['channel'][_0x13c9('0x58')]())+_0x13c9('0x5b')](_0x33a4c8);})[_0x13c9('0x25')](respondWithResult(_0x188d2f,null))[_0x13c9('0x41')](handleError(_0x188d2f,null));};exports[_0x13c9('0x5c')]=function(_0x3a7050,_0x2f6d50,_0x1ac2b3){return db[_0x13c9('0x2b')][_0x13c9('0x52')]({'where':{'id':_0x3a7050[_0x13c9('0x43')]['id']}})[_0x13c9('0x25')](function(_0x18d029){if(_0x18d029){if(!_0x3a7050['body'][_0x13c9('0x53')]||!utils[_0x13c9('0x5d')](_0x3a7050[_0x13c9('0x48')][_0x13c9('0x53')])){throw new db[(_0x13c9('0x54'))][(_0x13c9('0x55'))](_0x13c9('0x56'));}return _0x18d029[_0x13c9('0x5e')+_[_0x13c9('0x57')](_0x3a7050[_0x13c9('0x48')]['channel'][_0x13c9('0x58')]())+_0x13c9('0x5b')](_0x3a7050[_0x13c9('0x48')][_0x13c9('0x5f')]);}return null;})[_0x13c9('0x25')](handleEntityNotFound(_0x2f6d50,null))[_0x13c9('0x25')](respondWithStatusCode(_0x2f6d50,null))[_0x13c9('0x41')](handleError(_0x2f6d50,null));};exports[_0x13c9('0x60')]=function(_0x4f0329,_0x245ec5,_0x1eebf6){return db['Team'][_0x13c9('0x52')]({'where':{'id':_0x4f0329['params']['id']}})['then'](function(_0x22c6aa){if(_0x22c6aa){if(!_0x4f0329[_0x13c9('0x31')]['channel']||!utils['isValidChannel'](_0x4f0329['query']['channel'])){throw new db[(_0x13c9('0x54'))][(_0x13c9('0x55'))](_0x13c9('0x56'));}return _0x22c6aa[_0x13c9('0x61')+_[_0x13c9('0x57')](_0x4f0329['query'][_0x13c9('0x53')][_0x13c9('0x58')]())+_0x13c9('0x5b')](_0x4f0329[_0x13c9('0x31')][_0x13c9('0x5f')]);}return null;})[_0x13c9('0x25')](handleEntityNotFound(_0x245ec5,null))[_0x13c9('0x25')](respondWithStatusCode(_0x245ec5,null))[_0x13c9('0x41')](handleError(_0x245ec5,null));};exports['addAgents']=function(_0x5d39ed,_0x5e1fcf,_0x593d7e){return db['Team']['find']({'where':{'id':_0x5d39ed[_0x13c9('0x43')]['id']}})[_0x13c9('0x25')](handleEntityNotFound(_0x5e1fcf,null))['then'](function(_0x20e3a2){if(_0x20e3a2){var _0x3475c9=[_0x13c9('0x62'),_0x13c9('0x63'),_0x13c9('0x64'),_0x13c9('0x65'),_0x13c9('0x66'),_0x13c9('0x67')];return BPromise[_0x13c9('0x68')](_0x3475c9,function(_0x27e662){return _0x20e3a2[_0x13c9('0x4a')+_0x27e662+_0x13c9('0x5b')]({'attributes':['id',_0x13c9('0x29')]})[_0x13c9('0x25')](function(_0x24f1d2){return BPromise[_0x13c9('0x68')](_0x24f1d2,function(_0x1ca90c){return _0x1ca90c['addAgents'](_0x5d39ed[_0x13c9('0x48')][_0x13c9('0x5f')])['then'](function(){if(_0x27e662==='Voice'){return db['User']['findAll']({'where':{'id':_0x5d39ed[_0x13c9('0x48')][_0x13c9('0x5f')]},'attributes':['id',_0x13c9('0x29'),'online',_0x13c9('0x69'),_0x13c9('0x6a')],'raw':!![]})[_0x13c9('0x25')](function(_0x219bf0){return BPromise[_0x13c9('0x68')](_['filter'](_0x219bf0,{'online':0x1}),function(_0x514b6f){return db[_0x13c9('0x6b')][_0x13c9('0x6c')]({'membername':_0x514b6f[_0x13c9('0x29')],'UserId':_0x514b6f['id'],'queue_name':_0x1ca90c[_0x13c9('0x29')],'VoiceQueueId':_0x1ca90c['id'],'interface':_[_0x13c9('0x6d')](_0x514b6f[_0x13c9('0x6a')])?util[_0x13c9('0x6e')](_0x13c9('0x6f'),_0x514b6f[_0x13c9('0x29')]):_0x514b6f[_0x13c9('0x6a')],'paused':_0x514b6f[_0x13c9('0x69')]||![],'penalty':0x0});});});}});});})[_0x13c9('0x25')](function(){return _0x20e3a2;});})[_0x13c9('0x25')](function(){return _0x20e3a2;});}})['then'](function(_0x428a8c){if(_0x428a8c){return _0x428a8c[_0x13c9('0x70')](_0x5d39ed[_0x13c9('0x48')]['ids'],_[_0x13c9('0x71')](_0x5d39ed[_0x13c9('0x48')],[_0x13c9('0x5f'),'id'])||{})[_0x13c9('0x72')](function(_0x1ebff7){for(var _0x4dd27e=0x0;_0x4dd27e<_0x5d39ed[_0x13c9('0x48')][_0x13c9('0x5f')]['length'];_0x4dd27e+=0x1){socket[_0x13c9('0x73')](_0x13c9('0x74'),{'UserId':_0x5d39ed['body']['ids'][_0x4dd27e],'TeamId':_0x5d39ed[_0x13c9('0x43')]['id']});}return _0x1ebff7;});}})[_0x13c9('0x25')](respondWithResult(_0x5e1fcf,null))[_0x13c9('0x41')](handleError(_0x5e1fcf,null));};exports[_0x13c9('0x75')]=function(_0x11bfc5,_0x537ad8,_0x36099d){return db[_0x13c9('0x2b')][_0x13c9('0x46')]({'where':{'id':_0x11bfc5[_0x13c9('0x43')]['id']}})[_0x13c9('0x25')](handleEntityNotFound(_0x537ad8,null))[_0x13c9('0x25')](function(_0x1a74d4){if(_0x1a74d4){return BPromise[_0x13c9('0x68')]([_0x13c9('0x76'),'chat','mail',_0x13c9('0x77'),_0x13c9('0x78'),_0x13c9('0x79')],function(_0x27b6bb){return _0x1a74d4['get'+_['capitalize'](_0x27b6bb)+_0x13c9('0x5b')]({'attributes':['id','name']})[_0x13c9('0x25')](function(_0x133354){return BPromise[_0x13c9('0x68')](_0x133354,function(_0xe52b47){return _0xe52b47[_0x13c9('0x75')](_0x11bfc5[_0x13c9('0x31')]['ids'])[_0x13c9('0x25')](function(){if(_0x27b6bb===_0x13c9('0x76')){return db[_0x13c9('0x6b')][_0x13c9('0x26')]({'where':{'VoiceQueueId':_0xe52b47['id'],'UserId':_0x11bfc5[_0x13c9('0x31')][_0x13c9('0x5f')]}});}});});})[_0x13c9('0x25')](function(){return _0x1a74d4;});})[_0x13c9('0x25')](function(){return _0x1a74d4;});}})[_0x13c9('0x25')](function(_0x11fb9b){if(_0x11fb9b){return _0x11fb9b[_0x13c9('0x75')](_0x11bfc5[_0x13c9('0x31')]['ids'])[_0x13c9('0x25')](function(){if(_['isArray'](_0x11bfc5[_0x13c9('0x31')][_0x13c9('0x5f')])){for(var _0x552e67=0x0;_0x552e67<_0x11bfc5[_0x13c9('0x31')][_0x13c9('0x5f')][_0x13c9('0x36')];_0x552e67+=0x1){socket[_0x13c9('0x73')](_0x13c9('0x7a'),{'UserId':Number(_0x11bfc5[_0x13c9('0x31')][_0x13c9('0x5f')][_0x552e67]),'TeamId':Number(_0x11bfc5[_0x13c9('0x43')]['id'])});}}else{socket[_0x13c9('0x73')](_0x13c9('0x7a'),{'UserId':Number(_0x11bfc5['query'][_0x13c9('0x5f')]),'TeamId':Number(_0x11bfc5[_0x13c9('0x43')]['id'])});}});}})[_0x13c9('0x25')](respondWithStatusCode(_0x537ad8,null))[_0x13c9('0x41')](handleError(_0x537ad8,null));};exports[_0x13c9('0x7b')]=function(_0x2b4d09,_0x1f0b72,_0xa502ba){var _0x476c82={};var _0x285213={};var _0x411c2e;var _0x148374;return db[_0x13c9('0x2b')][_0x13c9('0x52')]({'where':{'id':_0x2b4d09['params']['id']}})[_0x13c9('0x25')](handleEntityNotFound(_0x1f0b72,null))[_0x13c9('0x25')](function(_0x2e51b7){if(_0x2e51b7){_0x411c2e=_0x2e51b7;_0x285213[_0x13c9('0x30')]=_[_0x13c9('0x44')](db[_0x13c9('0x7c')][_0x13c9('0x2c')]);_0x285213['query']=_['keys'](_0x2b4d09[_0x13c9('0x31')]);_0x285213[_0x13c9('0x32')]=_[_0x13c9('0x34')](_0x285213[_0x13c9('0x30')],_0x285213[_0x13c9('0x31')]);_0x476c82[_0x13c9('0x33')]=_[_0x13c9('0x34')](_0x285213[_0x13c9('0x30')],qs[_0x13c9('0x35')](_0x2b4d09['query'][_0x13c9('0x35')]));_0x476c82[_0x13c9('0x33')]=_0x476c82[_0x13c9('0x33')][_0x13c9('0x36')]?_0x476c82[_0x13c9('0x33')]:_0x285213['model'];_0x476c82[_0x13c9('0x5a')]=qs[_0x13c9('0x38')](_0x2b4d09[_0x13c9('0x31')][_0x13c9('0x38')]);_0x476c82[_0x13c9('0x3b')]=qs['filters'](_[_0x13c9('0x39')](_0x2b4d09[_0x13c9('0x31')],_0x285213[_0x13c9('0x32')]));if(_0x2b4d09['query']['filter']){_0x476c82[_0x13c9('0x3b')]=_[_0x13c9('0x3c')](_0x476c82[_0x13c9('0x3b')],{'$or':_['map'](_0x476c82[_0x13c9('0x33')],function(_0x45dd8e){var _0x1a78c9={};_0x1a78c9[_0x45dd8e]={'$like':'%'+_0x2b4d09[_0x13c9('0x31')][_0x13c9('0x3a')]+'%'};return _0x1a78c9;})});}_0x476c82=_['merge']({},_0x476c82,_0x2b4d09[_0x13c9('0x3e')]);return _0x411c2e[_0x13c9('0x7b')](_0x476c82);}})['then'](function(_0x5d9598){if(_0x5d9598){_0x148374=_0x5d9598[_0x13c9('0x36')];if(!_0x2b4d09[_0x13c9('0x31')][_0x13c9('0x37')](_0x13c9('0x7d'))){_0x476c82['limit']=qs[_0x13c9('0x1e')](_0x2b4d09[_0x13c9('0x31')]['limit']);_0x476c82[_0x13c9('0x1d')]=qs[_0x13c9('0x1d')](_0x2b4d09[_0x13c9('0x31')][_0x13c9('0x1d')]);}return _0x411c2e[_0x13c9('0x7b')](_0x476c82);}})[_0x13c9('0x25')](function(_0x345f6e){if(_0x345f6e){return _0x345f6e?{'count':_0x148374,'rows':_0x345f6e}:null;}})['then'](respondWithResult(_0x1f0b72,null))[_0x13c9('0x41')](handleError(_0x1f0b72,null));}; \ No newline at end of file +var _0xdaa8=['count','set','Content-Range','apply','reject','destroy','then','get','Teams','UserProfileResource','error','stack','name','send','index','map','Team','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','offset','sort','where','filter','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Queue','order','pick','options','capitalize','toLowerCase','Queues','addQueues','add','removeQueues','remove','ids','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','each','online','voicePause','interface','upsert','isNil','format','SIP/%s','omit','spread','removeAgents','voice','chat','mail','sms','fax','openchannel','UserVoiceQueueRt','emit','User','merge','getAgents','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json'];(function(_0x55277c,_0x4c7ca5){var _0x25018c=function(_0x21fce5){while(--_0x21fce5){_0x55277c['push'](_0x55277c['shift']());}};_0x25018c(++_0x4c7ca5);}(_0xdaa8,0xe4));var _0x8daa=function(_0x2a727f,_0xba5c2){_0x2a727f=_0x2a727f-0x0;var _0x550313=_0xdaa8[_0x2a727f];return _0x550313;};'use strict';var pdf=require(_0x8daa('0x0'));var emlformat=require(_0x8daa('0x1'));var rimraf=require(_0x8daa('0x2'));var zipdir=require(_0x8daa('0x3'));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('util');var path=require(_0x8daa('0x4'));var sox=require(_0x8daa('0x5'));var csv=require(_0x8daa('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8daa('0x7'));var crypto=require('crypto');var jsforce=require(_0x8daa('0x8'));var deskjs=require(_0x8daa('0x9'));var toCsv=require(_0x8daa('0x6'));var querystring=require(_0x8daa('0xa'));var Papa=require(_0x8daa('0xb'));var Redis=require('ioredis');var authService=require(_0x8daa('0xc'));var qs=require(_0x8daa('0xd'));var as=require(_0x8daa('0xe'));var hardwareService=require(_0x8daa('0xf'));var logger=require(_0x8daa('0x10'))(_0x8daa('0x11'));var utils=require(_0x8daa('0x12'));var config=require(_0x8daa('0x13'));var db=require(_0x8daa('0x14'))['db'];config[_0x8daa('0x15')]=_[_0x8daa('0x16')](config['redis'],{'host':_0x8daa('0x17'),'port':0x18eb});var socket=require(_0x8daa('0x18'))(new Redis(config[_0x8daa('0x15')]));require('./team.socket')[_0x8daa('0x19')](socket);function respondWithStatusCode(_0x5130a4,_0x28900d){_0x28900d=_0x28900d||0xcc;return function(_0x336132){if(_0x336132){return _0x5130a4[_0x8daa('0x1a')](_0x28900d);}return _0x5130a4['status'](_0x28900d)[_0x8daa('0x1b')]();};}function respondWithResult(_0x3f1f8f,_0x55bf66){_0x55bf66=_0x55bf66||0xc8;return function(_0x4bfdfb){if(_0x4bfdfb){return _0x3f1f8f[_0x8daa('0x1c')](_0x55bf66)[_0x8daa('0x1d')](_0x4bfdfb);}};}function respondWithFilteredResult(_0x2b2df6,_0x2fd793){return function(_0x151dc1){if(_0x151dc1){var _0x1bca53=_0x151dc1[_0x8daa('0x1e')],_0x87f873=_0x2fd793['offset'],_0x15ab40=_0x2fd793['offset']+_0x2fd793['limit'],_0x1304f0;if(_0x15ab40>=_0x1bca53){_0x15ab40=_0x1bca53;_0x1304f0=0xc8;}else{_0x1304f0=0xce;}_0x2b2df6[_0x8daa('0x1c')](_0x1304f0);return _0x2b2df6[_0x8daa('0x1f')](_0x8daa('0x20'),_0x87f873+'-'+_0x15ab40+'/'+_0x1bca53)['json'](_0x151dc1);}return null;};}function patchUpdates(_0x3d5675){return function(_0x5f0e18){try{jsonpatch[_0x8daa('0x21')](_0x5f0e18,_0x3d5675,!![]);}catch(_0x3db4fc){return BPromise[_0x8daa('0x22')](_0x3db4fc);}return _0x5f0e18['save']();};}function saveUpdates(_0x1ed29e,_0x4db25d){return function(_0x92b96){if(_0x92b96){return _0x92b96['update'](_0x1ed29e)['then'](function(_0x202b2f){return _0x202b2f;});}return null;};}function removeEntity(_0x15a4be,_0x221d96){return function(_0x58af34){if(_0x58af34){return _0x58af34[_0x8daa('0x23')]()[_0x8daa('0x24')](function(){var _0x5d786a=_0x58af34[_0x8daa('0x25')]({'plain':!![]});var _0x413c09=_0x8daa('0x26');return db[_0x8daa('0x27')][_0x8daa('0x23')]({'where':{'type':_0x413c09,'resourceId':_0x5d786a['id']}})[_0x8daa('0x24')](function(){return _0x58af34;});})[_0x8daa('0x24')](function(){_0x15a4be['status'](0xcc)[_0x8daa('0x1b')]();});}};}function handleEntityNotFound(_0x5f1609,_0x41e96a){return function(_0x5151f8){if(!_0x5151f8){_0x5f1609[_0x8daa('0x1a')](0x194);}return _0x5151f8;};}function handleError(_0x54cfc1,_0x446304){_0x446304=_0x446304||0x1f4;return function(_0x203b98){logger[_0x8daa('0x28')](_0x203b98[_0x8daa('0x29')]);if(_0x203b98['name']){delete _0x203b98[_0x8daa('0x2a')];}_0x54cfc1[_0x8daa('0x1c')](_0x446304)[_0x8daa('0x2b')](_0x203b98);};}exports[_0x8daa('0x2c')]=function(_0x5a995b,_0x5da841){var _0x503e67={},_0x233f10={},_0x519289={'count':0x0,'rows':[]};var _0x2e4111=_[_0x8daa('0x2d')](db[_0x8daa('0x2e')][_0x8daa('0x2f')],function(_0x4c6691){return{'name':_0x4c6691[_0x8daa('0x30')],'type':_0x4c6691['type']['key']};});_0x233f10[_0x8daa('0x31')]=_[_0x8daa('0x2d')](_0x2e4111,_0x8daa('0x2a'));_0x233f10[_0x8daa('0x32')]=_[_0x8daa('0x33')](_0x5a995b[_0x8daa('0x32')]);_0x233f10[_0x8daa('0x34')]=_[_0x8daa('0x35')](_0x233f10['model'],_0x233f10[_0x8daa('0x32')]);_0x503e67[_0x8daa('0x36')]=_['intersection'](_0x233f10[_0x8daa('0x31')],qs[_0x8daa('0x37')](_0x5a995b[_0x8daa('0x32')][_0x8daa('0x37')]));_0x503e67[_0x8daa('0x36')]=_0x503e67['attributes'][_0x8daa('0x38')]?_0x503e67[_0x8daa('0x36')]:_0x233f10['model'];if(!_0x5a995b['query']['hasOwnProperty'](_0x8daa('0x39'))){_0x503e67[_0x8daa('0x3a')]=qs[_0x8daa('0x3a')](_0x5a995b[_0x8daa('0x32')][_0x8daa('0x3a')]);_0x503e67[_0x8daa('0x3b')]=qs['offset'](_0x5a995b['query'][_0x8daa('0x3b')]);}_0x503e67['order']=qs[_0x8daa('0x3c')](_0x5a995b['query'][_0x8daa('0x3c')]);_0x503e67[_0x8daa('0x3d')]=qs[_0x8daa('0x34')](_['pick'](_0x5a995b[_0x8daa('0x32')],_0x233f10[_0x8daa('0x34')]));if(_0x5a995b['query'][_0x8daa('0x3e')]){_0x503e67['where']=_['merge'](_0x503e67[_0x8daa('0x3d')],{'$or':_[_0x8daa('0x2d')](_0x2e4111,function(_0xcc1268){if(_0xcc1268[_0x8daa('0x3f')]!==_0x8daa('0x40')){var _0x1b77dd={};_0x1b77dd[_0xcc1268['name']]={'$like':'%'+_0x5a995b['query']['filter']+'%'};return _0x1b77dd;}})});}_0x503e67=_['merge']({},_0x503e67,_0x5a995b['options']);var _0xa6ea4e={'where':_0x503e67['where']};return db[_0x8daa('0x2e')][_0x8daa('0x1e')](_0xa6ea4e)[_0x8daa('0x24')](function(_0x4d8ca8){_0x519289['count']=_0x4d8ca8;if(_0x5a995b[_0x8daa('0x32')][_0x8daa('0x41')]){_0x503e67[_0x8daa('0x42')]=[{'all':!![]}];}return db[_0x8daa('0x2e')][_0x8daa('0x43')](_0x503e67);})['then'](function(_0x216e8f){_0x519289[_0x8daa('0x44')]=_0x216e8f;return _0x519289;})['then'](respondWithFilteredResult(_0x5da841,_0x503e67))[_0x8daa('0x45')](handleError(_0x5da841,null));};exports[_0x8daa('0x46')]=function(_0xf1ad1d,_0x521f77){var _0x1f0db9={'raw':![],'where':{'id':_0xf1ad1d['params']['id']}},_0x3c5ccf={};_0x3c5ccf['model']=_[_0x8daa('0x33')](db['Team']['rawAttributes']);_0x3c5ccf[_0x8daa('0x32')]=_[_0x8daa('0x33')](_0xf1ad1d[_0x8daa('0x32')]);_0x3c5ccf['filters']=_['intersection'](_0x3c5ccf[_0x8daa('0x31')],_0x3c5ccf[_0x8daa('0x32')]);_0x1f0db9[_0x8daa('0x36')]=_[_0x8daa('0x35')](_0x3c5ccf['model'],qs[_0x8daa('0x37')](_0xf1ad1d[_0x8daa('0x32')][_0x8daa('0x37')]));_0x1f0db9['attributes']=_0x1f0db9[_0x8daa('0x36')][_0x8daa('0x38')]?_0x1f0db9[_0x8daa('0x36')]:_0x3c5ccf[_0x8daa('0x31')];if(_0xf1ad1d[_0x8daa('0x32')][_0x8daa('0x41')]){_0x1f0db9[_0x8daa('0x42')]=[{'all':!![]}];}_0x1f0db9=_['merge']({},_0x1f0db9,_0xf1ad1d['options']);return db[_0x8daa('0x2e')]['find'](_0x1f0db9)[_0x8daa('0x24')](handleEntityNotFound(_0x521f77,null))[_0x8daa('0x24')](respondWithResult(_0x521f77,null))['catch'](handleError(_0x521f77,null));};exports[_0x8daa('0x47')]=function(_0x2669d5,_0x23cd94){return db[_0x8daa('0x2e')][_0x8daa('0x47')](_0x2669d5['body'],{})[_0x8daa('0x24')](function(_0x33ddf8){var _0x5b3ad5=_0x2669d5['user'][_0x8daa('0x25')]({'plain':!![]});if(!_0x5b3ad5)throw new Error(_0x8daa('0x48'));if(_0x5b3ad5['role']===_0x8daa('0x49')){var _0x1a000f=_0x33ddf8[_0x8daa('0x25')]({'plain':!![]});var _0x3c041b='Teams';return db[_0x8daa('0x4a')][_0x8daa('0x4b')]({'where':{'name':_0x3c041b,'userProfileId':_0x5b3ad5['userProfileId']},'raw':!![]})[_0x8daa('0x24')](function(_0x54ecf7){if(_0x54ecf7&&_0x54ecf7[_0x8daa('0x4c')]===0x0){return db[_0x8daa('0x27')]['create']({'name':_0x1a000f['name'],'resourceId':_0x1a000f['id'],'type':_0x54ecf7[_0x8daa('0x2a')],'sectionId':_0x54ecf7['id']},{})[_0x8daa('0x24')](function(){return _0x33ddf8;});}else{return _0x33ddf8;}})[_0x8daa('0x45')](function(_0x259738){logger[_0x8daa('0x28')](_0x8daa('0x4d'),_0x259738);throw _0x259738;});}return _0x33ddf8;})[_0x8daa('0x24')](respondWithResult(_0x23cd94,0xc9))[_0x8daa('0x45')](handleError(_0x23cd94,null));};exports[_0x8daa('0x4e')]=function(_0x3cad83,_0x4f5890){if(_0x3cad83[_0x8daa('0x4f')]['id']){delete _0x3cad83[_0x8daa('0x4f')]['id'];}return db['Team']['find']({'where':{'id':_0x3cad83[_0x8daa('0x50')]['id']}})[_0x8daa('0x24')](handleEntityNotFound(_0x4f5890,null))[_0x8daa('0x24')](saveUpdates(_0x3cad83[_0x8daa('0x4f')],null))['then'](respondWithResult(_0x4f5890,null))[_0x8daa('0x45')](handleError(_0x4f5890,null));};exports['destroy']=function(_0x42398f,_0x4d8fd9){return db[_0x8daa('0x2e')]['find']({'where':{'id':_0x42398f[_0x8daa('0x50')]['id']}})[_0x8daa('0x24')](handleEntityNotFound(_0x4d8fd9,null))[_0x8daa('0x24')](removeEntity(_0x4d8fd9,null))[_0x8daa('0x45')](handleError(_0x4d8fd9,null));};exports[_0x8daa('0x51')]=function(_0x1b6667,_0xd7b5fb,_0x711de1){return db[_0x8daa('0x2e')][_0x8daa('0x52')]({'where':{'id':_0x1b6667[_0x8daa('0x50')]['id']}})['then'](handleEntityNotFound(_0xd7b5fb,null))[_0x8daa('0x24')](function(_0x14ccd5){if(!_0x1b6667[_0x8daa('0x32')][_0x8daa('0x53')]||!utils[_0x8daa('0x54')](_0x1b6667[_0x8daa('0x32')]['channel'])){throw new db[(_0x8daa('0x55'))][(_0x8daa('0x56'))]('Unknown\x20channel');}var _0x1c57e1={};var _0xd91600={};_0xd91600[_0x8daa('0x31')]=_[_0x8daa('0x33')](db[_['capitalize'](_0x1b6667[_0x8daa('0x32')][_0x8daa('0x53')]['toLowerCase']())+_0x8daa('0x57')][_0x8daa('0x2f')]);_0xd91600[_0x8daa('0x32')]=_[_0x8daa('0x33')](_0x1b6667[_0x8daa('0x32')]);_0xd91600['filters']=_[_0x8daa('0x35')](_0xd91600[_0x8daa('0x31')],_0xd91600[_0x8daa('0x32')]);_0x1c57e1['attributes']=_[_0x8daa('0x35')](_0xd91600['model'],qs[_0x8daa('0x37')](_0x1b6667['query'][_0x8daa('0x37')]));_0x1c57e1[_0x8daa('0x36')]=_0x1c57e1[_0x8daa('0x36')][_0x8daa('0x38')]?_0x1c57e1[_0x8daa('0x36')]:_0xd91600[_0x8daa('0x31')];_0x1c57e1['limit']=qs[_0x8daa('0x3a')](_0x1b6667[_0x8daa('0x32')][_0x8daa('0x3a')]);_0x1c57e1['offset']=qs[_0x8daa('0x3b')](_0x1b6667[_0x8daa('0x32')][_0x8daa('0x3b')]);_0x1c57e1[_0x8daa('0x58')]=qs[_0x8daa('0x3c')](_0x1b6667['query'][_0x8daa('0x3c')]);_0x1c57e1[_0x8daa('0x3d')]=qs[_0x8daa('0x34')](_[_0x8daa('0x59')](_0x1b6667[_0x8daa('0x32')],_0xd91600[_0x8daa('0x34')]));_0x1c57e1=_['merge']({},_0x1c57e1,_0x1b6667[_0x8daa('0x5a')]);return _0x14ccd5['get'+_[_0x8daa('0x5b')](_0x1b6667['query'][_0x8daa('0x53')][_0x8daa('0x5c')]())+_0x8daa('0x5d')](_0x1c57e1);})['then'](respondWithResult(_0xd7b5fb,null))['catch'](handleError(_0xd7b5fb,null));};exports[_0x8daa('0x5e')]=function(_0x5702b8,_0x35971e,_0x3ff558){return db[_0x8daa('0x2e')][_0x8daa('0x52')]({'where':{'id':_0x5702b8[_0x8daa('0x50')]['id']}})[_0x8daa('0x24')](function(_0x39e0db){if(_0x39e0db){if(!_0x5702b8[_0x8daa('0x4f')][_0x8daa('0x53')]||!utils['isValidChannel'](_0x5702b8['body'][_0x8daa('0x53')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x39e0db[_0x8daa('0x5f')+_[_0x8daa('0x5b')](_0x5702b8[_0x8daa('0x4f')]['channel']['toLowerCase']())+_0x8daa('0x5d')](_0x5702b8['body']['ids']);}return null;})[_0x8daa('0x24')](handleEntityNotFound(_0x35971e,null))['then'](respondWithStatusCode(_0x35971e,null))[_0x8daa('0x45')](handleError(_0x35971e,null));};exports[_0x8daa('0x60')]=function(_0x1f58a0,_0x256d9b,_0x24a97a){return db[_0x8daa('0x2e')][_0x8daa('0x52')]({'where':{'id':_0x1f58a0[_0x8daa('0x50')]['id']}})[_0x8daa('0x24')](function(_0x267b78){if(_0x267b78){if(!_0x1f58a0[_0x8daa('0x32')]['channel']||!utils[_0x8daa('0x54')](_0x1f58a0[_0x8daa('0x32')][_0x8daa('0x53')])){throw new db[(_0x8daa('0x55'))]['ValidationError']('Unknown\x20channel');}return _0x267b78[_0x8daa('0x61')+_[_0x8daa('0x5b')](_0x1f58a0[_0x8daa('0x32')][_0x8daa('0x53')][_0x8daa('0x5c')]())+'Queues'](_0x1f58a0[_0x8daa('0x32')][_0x8daa('0x62')]);}return null;})[_0x8daa('0x24')](handleEntityNotFound(_0x256d9b,null))[_0x8daa('0x24')](respondWithStatusCode(_0x256d9b,null))[_0x8daa('0x45')](handleError(_0x256d9b,null));};exports[_0x8daa('0x63')]=function(_0x46cfe4,_0x3442ba,_0x1cf7be){return db[_0x8daa('0x2e')][_0x8daa('0x4b')]({'where':{'id':_0x46cfe4['params']['id']}})[_0x8daa('0x24')](handleEntityNotFound(_0x3442ba,null))[_0x8daa('0x24')](function(_0x5b25bc){if(_0x5b25bc){var _0x997551=[_0x8daa('0x64'),_0x8daa('0x65'),_0x8daa('0x66'),_0x8daa('0x67'),_0x8daa('0x68'),_0x8daa('0x69')];return BPromise[_0x8daa('0x6a')](_0x997551,function(_0x32b793){return _0x5b25bc['get'+_0x32b793+'Queues']({'attributes':['id','name']})[_0x8daa('0x24')](function(_0x2ca23d){return BPromise['each'](_0x2ca23d,function(_0x494886){return _0x494886[_0x8daa('0x63')](_0x46cfe4['body']['ids'])[_0x8daa('0x24')](function(){if(_0x32b793===_0x8daa('0x64')){return db['User'][_0x8daa('0x43')]({'where':{'id':_0x46cfe4['body'][_0x8daa('0x62')]},'attributes':['id',_0x8daa('0x2a'),_0x8daa('0x6b'),_0x8daa('0x6c'),_0x8daa('0x6d')],'raw':!![]})['then'](function(_0xa6c4c0){return BPromise[_0x8daa('0x6a')](_['filter'](_0xa6c4c0,{'online':0x1}),function(_0x4bf167){return db['UserVoiceQueueRt'][_0x8daa('0x6e')]({'membername':_0x4bf167[_0x8daa('0x2a')],'UserId':_0x4bf167['id'],'queue_name':_0x494886[_0x8daa('0x2a')],'VoiceQueueId':_0x494886['id'],'interface':_[_0x8daa('0x6f')](_0x4bf167[_0x8daa('0x6d')])?util[_0x8daa('0x70')](_0x8daa('0x71'),_0x4bf167[_0x8daa('0x2a')]):_0x4bf167[_0x8daa('0x6d')],'paused':_0x4bf167['voicePause']||![],'penalty':0x0});});});}});});})[_0x8daa('0x24')](function(){return _0x5b25bc;});})[_0x8daa('0x24')](function(){return _0x5b25bc;});}})['then'](function(_0x278413){if(_0x278413){return _0x278413[_0x8daa('0x63')](_0x46cfe4['body']['ids'],_[_0x8daa('0x72')](_0x46cfe4['body'],[_0x8daa('0x62'),'id'])||{})[_0x8daa('0x73')](function(_0x3a1603){for(var _0x181aee=0x0;_0x181aee<_0x46cfe4['body'][_0x8daa('0x62')][_0x8daa('0x38')];_0x181aee+=0x1){socket['emit']('userTeam:save',{'UserId':_0x46cfe4['body']['ids'][_0x181aee],'TeamId':_0x46cfe4[_0x8daa('0x50')]['id']});}return _0x3a1603;});}})[_0x8daa('0x24')](respondWithResult(_0x3442ba,null))[_0x8daa('0x45')](handleError(_0x3442ba,null));};exports[_0x8daa('0x74')]=function(_0x5ee47a,_0x55d803,_0xffc19b){return db[_0x8daa('0x2e')]['find']({'where':{'id':_0x5ee47a['params']['id']}})[_0x8daa('0x24')](handleEntityNotFound(_0x55d803,null))[_0x8daa('0x24')](function(_0x458efa){if(_0x458efa){return BPromise[_0x8daa('0x6a')]([_0x8daa('0x75'),_0x8daa('0x76'),_0x8daa('0x77'),_0x8daa('0x78'),_0x8daa('0x79'),_0x8daa('0x7a')],function(_0x397c1c){return _0x458efa[_0x8daa('0x25')+_[_0x8daa('0x5b')](_0x397c1c)+_0x8daa('0x5d')]({'attributes':['id',_0x8daa('0x2a')]})[_0x8daa('0x24')](function(_0x2ecbdd){return BPromise[_0x8daa('0x6a')](_0x2ecbdd,function(_0x258d43){return _0x258d43[_0x8daa('0x74')](_0x5ee47a[_0x8daa('0x32')][_0x8daa('0x62')])[_0x8daa('0x24')](function(){if(_0x397c1c===_0x8daa('0x75')){return db[_0x8daa('0x7b')][_0x8daa('0x23')]({'where':{'VoiceQueueId':_0x258d43['id'],'UserId':_0x5ee47a['query'][_0x8daa('0x62')]}});}});});})[_0x8daa('0x24')](function(){return _0x458efa;});})[_0x8daa('0x24')](function(){return _0x458efa;});}})[_0x8daa('0x24')](function(_0x4fe3e7){if(_0x4fe3e7){return _0x4fe3e7[_0x8daa('0x74')](_0x5ee47a[_0x8daa('0x32')]['ids'])[_0x8daa('0x24')](function(){if(_['isArray'](_0x5ee47a[_0x8daa('0x32')][_0x8daa('0x62')])){for(var _0x1af420=0x0;_0x1af420<_0x5ee47a[_0x8daa('0x32')][_0x8daa('0x62')][_0x8daa('0x38')];_0x1af420+=0x1){socket[_0x8daa('0x7c')]('userTeam:remove',{'UserId':Number(_0x5ee47a['query'][_0x8daa('0x62')][_0x1af420]),'TeamId':Number(_0x5ee47a['params']['id'])});}}else{socket['emit']('userTeam:remove',{'UserId':Number(_0x5ee47a['query'][_0x8daa('0x62')]),'TeamId':Number(_0x5ee47a[_0x8daa('0x50')]['id'])});}});}})[_0x8daa('0x24')](respondWithStatusCode(_0x55d803,null))[_0x8daa('0x45')](handleError(_0x55d803,null));};exports['getAgents']=function(_0x555935,_0x54c9f2,_0x4fbeee){var _0x56bde6={};var _0x5a5b47={};var _0x43df03;var _0x382185;return db[_0x8daa('0x2e')][_0x8daa('0x52')]({'where':{'id':_0x555935[_0x8daa('0x50')]['id']}})[_0x8daa('0x24')](handleEntityNotFound(_0x54c9f2,null))['then'](function(_0x194088){if(_0x194088){_0x43df03=_0x194088;_0x5a5b47[_0x8daa('0x31')]=_[_0x8daa('0x33')](db[_0x8daa('0x7d')][_0x8daa('0x2f')]);_0x5a5b47[_0x8daa('0x32')]=_[_0x8daa('0x33')](_0x555935[_0x8daa('0x32')]);_0x5a5b47['filters']=_['intersection'](_0x5a5b47[_0x8daa('0x31')],_0x5a5b47[_0x8daa('0x32')]);_0x56bde6[_0x8daa('0x36')]=_[_0x8daa('0x35')](_0x5a5b47['model'],qs[_0x8daa('0x37')](_0x555935['query'][_0x8daa('0x37')]));_0x56bde6[_0x8daa('0x36')]=_0x56bde6[_0x8daa('0x36')][_0x8daa('0x38')]?_0x56bde6['attributes']:_0x5a5b47[_0x8daa('0x31')];_0x56bde6[_0x8daa('0x58')]=qs[_0x8daa('0x3c')](_0x555935[_0x8daa('0x32')]['sort']);_0x56bde6[_0x8daa('0x3d')]=qs[_0x8daa('0x34')](_['pick'](_0x555935[_0x8daa('0x32')],_0x5a5b47['filters']));if(_0x555935['query'][_0x8daa('0x3e')]){_0x56bde6[_0x8daa('0x3d')]=_[_0x8daa('0x7e')](_0x56bde6['where'],{'$or':_[_0x8daa('0x2d')](_0x56bde6[_0x8daa('0x36')],function(_0x5b23f3){var _0x21bf38={};_0x21bf38[_0x5b23f3]={'$like':'%'+_0x555935[_0x8daa('0x32')][_0x8daa('0x3e')]+'%'};return _0x21bf38;})});}_0x56bde6=_[_0x8daa('0x7e')]({},_0x56bde6,_0x555935[_0x8daa('0x5a')]);return _0x43df03[_0x8daa('0x7f')](_0x56bde6);}})[_0x8daa('0x24')](function(_0x4faab8){if(_0x4faab8){_0x382185=_0x4faab8[_0x8daa('0x38')];if(!_0x555935[_0x8daa('0x32')][_0x8daa('0x80')](_0x8daa('0x39'))){_0x56bde6[_0x8daa('0x3a')]=qs['limit'](_0x555935[_0x8daa('0x32')][_0x8daa('0x3a')]);_0x56bde6[_0x8daa('0x3b')]=qs[_0x8daa('0x3b')](_0x555935[_0x8daa('0x32')][_0x8daa('0x3b')]);}return _0x43df03[_0x8daa('0x7f')](_0x56bde6);}})['then'](function(_0xfc47fa){if(_0xfc47fa){return _0xfc47fa?{'count':_0x382185,'rows':_0xfc47fa}:null;}})[_0x8daa('0x24')](respondWithResult(_0x54c9f2,null))[_0x8daa('0x45')](handleError(_0x54c9f2,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d009cb4..ea13aeb 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 _0x269b=['Team','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x23848f,_0xb8b8fe){var _0x541395=function(_0x141cf2){while(--_0x141cf2){_0x23848f['push'](_0x23848f['shift']());}};_0x541395(++_0xb8b8fe);}(_0x269b,0x1ae));var _0xb269=function(_0x159c2f,_0xd39d20){_0x159c2f=_0x159c2f-0x0;var _0x591f68=_0x269b[_0x159c2f];return _0x591f68;};'use strict';var EventEmitter=require(_0xb269('0x0'));var Team=require(_0xb269('0x1'))['db'][_0xb269('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb269('0x3'),'afterDestroy':_0xb269('0x4')};function emitEvent(_0x2439d5){return function(_0x239576,_0xa364f0,_0x3bf7c5){TeamEvents[_0xb269('0x5')](_0x2439d5+':'+_0x239576['id'],_0x239576);TeamEvents['emit'](_0x2439d5,_0x239576);_0x3bf7c5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xb269('0x6')](e,emitEvent(event));}}module[_0xb269('0x7')]=TeamEvents; \ No newline at end of file +var _0xa747=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xa747,0x1dd));var _0x7a74=function(_0x342a95,_0x4bd776){_0x342a95=_0x342a95-0x0;var _0x46101b=_0xa747[_0x342a95];return _0x46101b;};'use strict';var EventEmitter=require(_0x7a74('0x0'));var Team=require(_0x7a74('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x7a74('0x2')](0x0);var events={'afterCreate':_0x7a74('0x3'),'afterUpdate':_0x7a74('0x4'),'afterDestroy':_0x7a74('0x5')};function emitEvent(_0x5b21f3){return function(_0x2cda32,_0x3084a9,_0x51eb8e){TeamEvents['emit'](_0x5b21f3+':'+_0x2cda32['id'],_0x2cda32);TeamEvents[_0x7a74('0x6')](_0x5b21f3,_0x2cda32);_0x51eb8e(null);};}for(var e in events){if(events[_0x7a74('0x7')](e)){var event=events[e];Team[_0x7a74('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 7a0cbd2..cac58a3 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 _0x1863=['rimraf','../../config/environment','./team.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x1863,0x68));var _0x3186=function(_0x13b330,_0x297092){_0x13b330=_0x13b330-0x0;var _0x1f666c=_0x1863[_0x13b330];return _0x1f666c;};'use strict';var _=require(_0x3186('0x0'));var util=require(_0x3186('0x1'));var logger=require(_0x3186('0x2'))(_0x3186('0x3'));var moment=require(_0x3186('0x4'));var BPromise=require(_0x3186('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3186('0x6'));var config=require(_0x3186('0x7'));var attributes=require(_0x3186('0x8'));module[_0x3186('0x9')]=function(_0x385931,_0x1b36af){return _0x385931['define']('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4509=['path','rimraf','../../config/environment','exports','define','Team','teams','lodash','../../config/logger','api','moment','request-promise'];(function(_0x448083,_0xe0e32e){var _0x5ea7f4=function(_0x5d0a03){while(--_0x5d0a03){_0x448083['push'](_0x448083['shift']());}};_0x5ea7f4(++_0xe0e32e);}(_0x4509,0x10f));var _0x9450=function(_0x25efe1,_0x5b2f08){_0x25efe1=_0x25efe1-0x0;var _0x106102=_0x4509[_0x25efe1];return _0x106102;};'use strict';var _=require(_0x9450('0x0'));var util=require('util');var logger=require(_0x9450('0x1'))(_0x9450('0x2'));var moment=require(_0x9450('0x3'));var BPromise=require('bluebird');var rp=require(_0x9450('0x4'));var fs=require('fs');var path=require(_0x9450('0x5'));var rimraf=require(_0x9450('0x6'));var config=require(_0x9450('0x7'));var attributes=require('./team.attributes');module[_0x9450('0x8')]=function(_0x175dc7,_0xb10283){return _0x175dc7[_0x9450('0x9')](_0x9450('0xa'),attributes,{'tableName':_0x9450('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 b574077..7d24cc8 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 _0x7ecd=['then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./team.socket','register'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0x7ecd,0x15d));var _0xd7ec=function(_0x40f69c,_0x154dc6){_0x40f69c=_0x40f69c-0x0;var _0x49f323=_0x7ecd[_0x40f69c];return _0x49f323;};'use strict';var _=require(_0xd7ec('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd7ec('0x1'));var rs=require(_0xd7ec('0x2'));var fs=require('fs');var Redis=require(_0xd7ec('0x3'));var db=require(_0xd7ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd7ec('0x5'))('rpc');var config=require(_0xd7ec('0x6'));var jayson=require(_0xd7ec('0x7'));var client=jayson[_0xd7ec('0x8')][_0xd7ec('0x9')]({'port':0x232a});config[_0xd7ec('0xa')]=_[_0xd7ec('0xb')](config[_0xd7ec('0xa')],{'host':_0xd7ec('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd7ec('0xa')]));require(_0xd7ec('0xd'))[_0xd7ec('0xe')](socket);function respondWithRpcPromise(_0x51d850,_0x248803,_0x22a2f8){return new BPromise(function(_0x179a63,_0x3ebdbf){return client['request'](_0x51d850,_0x22a2f8)[_0xd7ec('0xf')](function(_0x5d99f1){logger[_0xd7ec('0x10')](_0xd7ec('0x11'),_0x248803,_0xd7ec('0x12'));logger['debug'](_0xd7ec('0x13'),_0x248803,'request\x20sent',JSON[_0xd7ec('0x14')](_0x5d99f1));if(_0x5d99f1[_0xd7ec('0x15')]){if(_0x5d99f1['error'][_0xd7ec('0x16')]===0x1f4){logger[_0xd7ec('0x15')](_0xd7ec('0x11'),_0x248803,_0x5d99f1['error'][_0xd7ec('0x17')]);return _0x3ebdbf(_0x5d99f1['error'][_0xd7ec('0x17')]);}logger[_0xd7ec('0x15')](_0xd7ec('0x11'),_0x248803,_0x5d99f1[_0xd7ec('0x15')]['message']);return _0x179a63(_0x5d99f1[_0xd7ec('0x15')][_0xd7ec('0x17')]);}else{logger[_0xd7ec('0x10')]('Team,\x20%s,\x20%s',_0x248803,_0xd7ec('0x12'));_0x179a63(_0x5d99f1[_0xd7ec('0x18')]['message']);}})[_0xd7ec('0x19')](function(_0x5e7a31){logger[_0xd7ec('0x15')](_0xd7ec('0x11'),_0x248803,_0x5e7a31);_0x3ebdbf(_0x5e7a31);});});} \ No newline at end of file +var _0x55c7=['request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./team.socket'];(function(_0x556ce8,_0x702af1){var _0x36aa0d=function(_0x3184a6){while(--_0x3184a6){_0x556ce8['push'](_0x556ce8['shift']());}};_0x36aa0d(++_0x702af1);}(_0x55c7,0xe2));var _0x755c=function(_0x1dc48e,_0x4c741e){_0x1dc48e=_0x1dc48e-0x0;var _0x565412=_0x55c7[_0x1dc48e];return _0x565412;};'use strict';var _=require(_0x755c('0x0'));var util=require(_0x755c('0x1'));var moment=require(_0x755c('0x2'));var BPromise=require(_0x755c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x755c('0x4'));var db=require(_0x755c('0x5'))['db'];var utils=require(_0x755c('0x6'));var logger=require(_0x755c('0x7'))('rpc');var config=require(_0x755c('0x8'));var jayson=require(_0x755c('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x755c('0xa')]=_[_0x755c('0xb')](config[_0x755c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x755c('0xc'))(new Redis(config[_0x755c('0xa')]));require(_0x755c('0xd'))['register'](socket);function respondWithRpcPromise(_0x4054f7,_0x3c0fbc,_0x4cb6a0){return new BPromise(function(_0x1d919a,_0x5ee498){return client[_0x755c('0xe')](_0x4054f7,_0x4cb6a0)[_0x755c('0xf')](function(_0x1226a0){logger[_0x755c('0x10')](_0x755c('0x11'),_0x3c0fbc,_0x755c('0x12'));logger['debug'](_0x755c('0x13'),_0x3c0fbc,'request\x20sent',JSON['stringify'](_0x1226a0));if(_0x1226a0[_0x755c('0x14')]){if(_0x1226a0[_0x755c('0x14')][_0x755c('0x15')]===0x1f4){logger[_0x755c('0x14')]('Team,\x20%s,\x20%s',_0x3c0fbc,_0x1226a0[_0x755c('0x14')][_0x755c('0x16')]);return _0x5ee498(_0x1226a0[_0x755c('0x14')][_0x755c('0x16')]);}logger[_0x755c('0x14')](_0x755c('0x11'),_0x3c0fbc,_0x1226a0[_0x755c('0x14')][_0x755c('0x16')]);return _0x1d919a(_0x1226a0[_0x755c('0x14')][_0x755c('0x16')]);}else{logger[_0x755c('0x10')](_0x755c('0x11'),_0x3c0fbc,'request\x20sent');_0x1d919a(_0x1226a0[_0x755c('0x17')]['message']);}})['catch'](function(_0x3a3017){logger[_0x755c('0x14')](_0x755c('0x11'),_0x3c0fbc,_0x3a3017);_0x5ee498(_0x3a3017);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 9ab9181..135be24 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 _0xafb9=['save','remove','update','emit','register','team:','./team.events'];(function(_0x14e27a,_0x3b4136){var _0x288688=function(_0x3d7ab1){while(--_0x3d7ab1){_0x14e27a['push'](_0x14e27a['shift']());}};_0x288688(++_0x3b4136);}(_0xafb9,0x68));var _0x9afb=function(_0x323d44,_0x373d74){_0x323d44=_0x323d44-0x0;var _0x2d7ce5=_0xafb9[_0x323d44];return _0x2d7ce5;};'use strict';var TeamEvents=require(_0x9afb('0x0'));var events=[_0x9afb('0x1'),_0x9afb('0x2'),_0x9afb('0x3')];function createListener(_0x190074,_0x1a7c38){return function(_0x467aa3){_0x1a7c38[_0x9afb('0x4')](_0x190074,_0x467aa3);};}function removeListener(_0xdaf0c6,_0x4e983d){return function(){TeamEvents['removeListener'](_0xdaf0c6,_0x4e983d);};}exports[_0x9afb('0x5')]=function(_0x56a139){for(var _0x1ccf93=0x0,_0x548b24=events['length'];_0x1ccf93<_0x548b24;_0x1ccf93++){var _0x4c0e9d=events[_0x1ccf93];var _0x1edf77=createListener(_0x9afb('0x6')+_0x4c0e9d,_0x56a139);TeamEvents['on'](_0x4c0e9d,_0x1edf77);}}; \ No newline at end of file +var _0x22e3=['register','length','team:','./team.events','save','remove','emit','removeListener'];(function(_0x3fb421,_0x1119f5){var _0x283c33=function(_0x36e604){while(--_0x36e604){_0x3fb421['push'](_0x3fb421['shift']());}};_0x283c33(++_0x1119f5);}(_0x22e3,0xf3));var _0x322e=function(_0x2fd6ab,_0x30301f){_0x2fd6ab=_0x2fd6ab-0x0;var _0x1173fb=_0x22e3[_0x2fd6ab];return _0x1173fb;};'use strict';var TeamEvents=require(_0x322e('0x0'));var events=[_0x322e('0x1'),_0x322e('0x2'),'update'];function createListener(_0x308b14,_0x4082ab){return function(_0x4b9e7f){_0x4082ab[_0x322e('0x3')](_0x308b14,_0x4b9e7f);};}function removeListener(_0x2d8822,_0x115e3c){return function(){TeamEvents[_0x322e('0x4')](_0x2d8822,_0x115e3c);};}exports[_0x322e('0x5')]=function(_0x539bdb){for(var _0x41afa2=0x0,_0x2b8360=events[_0x322e('0x6')];_0x41afa2<_0x2b8360;_0x41afa2++){var _0x2fcd6b=events[_0x41afa2];var _0xaba26c=createListener(_0x322e('0x7')+_0x2fcd6b,_0x539bdb);TeamEvents['on'](_0x2fcd6b,_0xaba26c);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 45e9e56..9f67369 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 _0x49b1=['Router','../../components/auth/service','../../config/environment','./template.controller','get','index','/:id','isAuthenticated','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4c5708,_0x34b1f9){var _0x37fa9b=function(_0x534dc4){while(--_0x534dc4){_0x4c5708['push'](_0x4c5708['shift']());}};_0x37fa9b(++_0x34b1f9);}(_0x49b1,0xcc));var _0x149b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49b1[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x149b('0x0'));var util=require(_0x149b('0x1'));var path=require(_0x149b('0x2'));var timeout=require(_0x149b('0x3'));var express=require(_0x149b('0x4'));var router=express[_0x149b('0x5')]();var auth=require(_0x149b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x149b('0x7'));var controller=require(_0x149b('0x8'));router[_0x149b('0x9')]('/',auth['isAuthenticated'](),controller[_0x149b('0xa')]);router[_0x149b('0x9')](_0x149b('0xb'),auth[_0x149b('0xc')](),controller[_0x149b('0xd')]);router[_0x149b('0xe')]('/',auth[_0x149b('0xc')](),controller[_0x149b('0xf')]);router[_0x149b('0x10')](_0x149b('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x149b('0xb'),auth[_0x149b('0xc')](),controller[_0x149b('0x11')]);module[_0x149b('0x12')]=router; \ No newline at end of file +var _0x1767=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x4ef29,_0xbf1aa){var _0xc91a1c=function(_0x4c49e6){while(--_0x4c49e6){_0x4ef29['push'](_0x4ef29['shift']());}};_0xc91a1c(++_0xbf1aa);}(_0x1767,0x95));var _0x7176=function(_0x2b7868,_0x3c7807){_0x2b7868=_0x2b7868-0x0;var _0x1d66f3=_0x1767[_0x2b7868];return _0x1d66f3;};'use strict';var multer=require('multer');var util=require(_0x7176('0x0'));var path=require(_0x7176('0x1'));var timeout=require(_0x7176('0x2'));var express=require(_0x7176('0x3'));var router=express['Router']();var auth=require(_0x7176('0x4'));var interaction=require(_0x7176('0x5'));var config=require(_0x7176('0x6'));var controller=require('./template.controller');router[_0x7176('0x7')]('/',auth[_0x7176('0x8')](),controller[_0x7176('0x9')]);router[_0x7176('0x7')](_0x7176('0xa'),auth[_0x7176('0x8')](),controller['show']);router[_0x7176('0xb')]('/',auth[_0x7176('0x8')](),controller[_0x7176('0xc')]);router[_0x7176('0xd')]('/:id',auth[_0x7176('0x8')](),controller[_0x7176('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7176('0xf')]);module[_0x7176('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 79e0482..375f906 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 _0xcb68=['sequelize','STRING','TEXT'];(function(_0x5eda6f,_0x281cdd){var _0x56c213=function(_0x54a070){while(--_0x54a070){_0x5eda6f['push'](_0x5eda6f['shift']());}};_0x56c213(++_0x281cdd);}(_0xcb68,0x1a7));var _0x8cb6=function(_0x3199c4,_0x3075e4){_0x3199c4=_0x3199c4-0x0;var _0x280594=_0xcb68[_0x3199c4];return _0x280594;};'use strict';var Sequelize=require(_0x8cb6('0x0'));module['exports']={'name':{'type':Sequelize[_0x8cb6('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x8cb6('0x2')]}}; \ No newline at end of file +var _0x64ea=['sequelize','exports','STRING'];(function(_0x5e823c,_0x33ff71){var _0x555190=function(_0x6b21f6){while(--_0x6b21f6){_0x5e823c['push'](_0x5e823c['shift']());}};_0x555190(++_0x33ff71);}(_0x64ea,0xff));var _0xa64e=function(_0x2e8889,_0xcd72f9){_0x2e8889=_0x2e8889-0x0;var _0x19dae6=_0x64ea[_0x2e8889];return _0x19dae6;};'use strict';var Sequelize=require(_0xa64e('0x0'));module[_0xa64e('0x1')]={'name':{'type':Sequelize[_0xa64e('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 8c4c627..3e89071 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 _0x60e6=['body','find','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','end','error','stack','name','send','index','map','Template','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x60e6,0x146));var _0x660e=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0x60e6[_0x1bc013];return _0x55df36;};'use strict';var pdf=require(_0x660e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x660e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x660e('0x2'));var rp=require(_0x660e('0x3'));var moment=require(_0x660e('0x4'));var BPromise=require(_0x660e('0x5'));var Mustache=require(_0x660e('0x6'));var util=require('util');var path=require('path');var sox=require(_0x660e('0x7'));var csv=require(_0x660e('0x8'));var ejs=require(_0x660e('0x9'));var fs=require('fs');var _=require(_0x660e('0xa'));var squel=require(_0x660e('0xb'));var crypto=require('crypto');var jsforce=require(_0x660e('0xc'));var deskjs=require(_0x660e('0xd'));var toCsv=require(_0x660e('0x8'));var querystring=require(_0x660e('0xe'));var Papa=require('papaparse');var Redis=require(_0x660e('0xf'));var authService=require(_0x660e('0x10'));var qs=require(_0x660e('0x11'));var as=require(_0x660e('0x12'));var hardwareService=require(_0x660e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x660e('0x14'));var config=require(_0x660e('0x15'));var db=require(_0x660e('0x16'))['db'];function respondWithStatusCode(_0x2b88de,_0x45414a){_0x45414a=_0x45414a||0xcc;return function(_0x3611ba){if(_0x3611ba){return _0x2b88de[_0x660e('0x17')](_0x45414a);}return _0x2b88de[_0x660e('0x18')](_0x45414a)['end']();};}function respondWithResult(_0x5a455c,_0x462a4d){_0x462a4d=_0x462a4d||0xc8;return function(_0x47d06f){if(_0x47d06f){return _0x5a455c[_0x660e('0x18')](_0x462a4d)[_0x660e('0x19')](_0x47d06f);}};}function respondWithFilteredResult(_0x309cae,_0x2b430b){return function(_0xb6cf71){if(_0xb6cf71){var _0x4870bc=_0xb6cf71[_0x660e('0x1a')],_0x454bd7=_0x2b430b['offset'],_0x434fd8=_0x2b430b[_0x660e('0x1b')]+_0x2b430b[_0x660e('0x1c')],_0x3c0941;if(_0x434fd8>=_0x4870bc){_0x434fd8=_0x4870bc;_0x3c0941=0xc8;}else{_0x3c0941=0xce;}_0x309cae['status'](_0x3c0941);return _0x309cae['set'](_0x660e('0x1d'),_0x454bd7+'-'+_0x434fd8+'/'+_0x4870bc)['json'](_0xb6cf71);}return null;};}function patchUpdates(_0x500487){return function(_0x3d3bb7){try{jsonpatch[_0x660e('0x1e')](_0x3d3bb7,_0x500487,!![]);}catch(_0x518404){return BPromise[_0x660e('0x1f')](_0x518404);}return _0x3d3bb7[_0x660e('0x20')]();};}function saveUpdates(_0x397db1,_0x2b3269){return function(_0x5d3ab1){if(_0x5d3ab1){return _0x5d3ab1[_0x660e('0x21')](_0x397db1)[_0x660e('0x22')](function(_0x4fa18a){return _0x4fa18a;});}return null;};}function removeEntity(_0x43262e,_0x2f9280){return function(_0x5ee981){if(_0x5ee981){return _0x5ee981[_0x660e('0x23')]()['then'](function(){var _0x5f1474=_0x5ee981[_0x660e('0x24')]({'plain':!![]});var _0x1446ac=_0x660e('0x25');return db[_0x660e('0x26')][_0x660e('0x23')]({'where':{'type':_0x1446ac,'resourceId':_0x5f1474['id']}})[_0x660e('0x22')](function(){return _0x5ee981;});})[_0x660e('0x22')](function(){_0x43262e[_0x660e('0x18')](0xcc)[_0x660e('0x27')]();});}};}function handleEntityNotFound(_0x18aef3,_0x540b97){return function(_0x4076f7){if(!_0x4076f7){_0x18aef3['sendStatus'](0x194);}return _0x4076f7;};}function handleError(_0x3d8225,_0x4de111){_0x4de111=_0x4de111||0x1f4;return function(_0x450819){logger[_0x660e('0x28')](_0x450819[_0x660e('0x29')]);if(_0x450819[_0x660e('0x2a')]){delete _0x450819[_0x660e('0x2a')];}_0x3d8225['status'](_0x4de111)[_0x660e('0x2b')](_0x450819);};}exports[_0x660e('0x2c')]=function(_0x2dd264,_0x5a4b02){var _0x110021={},_0x4779c3={},_0x4e12e8={'count':0x0,'rows':[]};var _0x381376=_[_0x660e('0x2d')](db[_0x660e('0x2e')]['rawAttributes'],function(_0x87f63){return{'name':_0x87f63[_0x660e('0x2f')],'type':_0x87f63[_0x660e('0x30')]['key']};});_0x4779c3[_0x660e('0x31')]=_[_0x660e('0x2d')](_0x381376,_0x660e('0x2a'));_0x4779c3[_0x660e('0x32')]=_[_0x660e('0x33')](_0x2dd264[_0x660e('0x32')]);_0x4779c3[_0x660e('0x34')]=_[_0x660e('0x35')](_0x4779c3[_0x660e('0x31')],_0x4779c3['query']);_0x110021[_0x660e('0x36')]=_[_0x660e('0x35')](_0x4779c3['model'],qs[_0x660e('0x37')](_0x2dd264[_0x660e('0x32')]['fields']));_0x110021['attributes']=_0x110021[_0x660e('0x36')][_0x660e('0x38')]?_0x110021[_0x660e('0x36')]:_0x4779c3[_0x660e('0x31')];if(!_0x2dd264[_0x660e('0x32')][_0x660e('0x39')](_0x660e('0x3a'))){_0x110021[_0x660e('0x1c')]=qs[_0x660e('0x1c')](_0x2dd264['query']['limit']);_0x110021[_0x660e('0x1b')]=qs[_0x660e('0x1b')](_0x2dd264['query'][_0x660e('0x1b')]);}_0x110021[_0x660e('0x3b')]=qs[_0x660e('0x3c')](_0x2dd264[_0x660e('0x32')][_0x660e('0x3c')]);_0x110021[_0x660e('0x3d')]=qs[_0x660e('0x34')](_[_0x660e('0x3e')](_0x2dd264[_0x660e('0x32')],_0x4779c3[_0x660e('0x34')]));if(_0x2dd264[_0x660e('0x32')][_0x660e('0x3f')]){_0x110021[_0x660e('0x3d')]=_[_0x660e('0x40')](_0x110021[_0x660e('0x3d')],{'$or':_[_0x660e('0x2d')](_0x381376,function(_0x1dd3a2){if(_0x1dd3a2[_0x660e('0x30')]!==_0x660e('0x41')){var _0x301364={};_0x301364[_0x1dd3a2[_0x660e('0x2a')]]={'$like':'%'+_0x2dd264[_0x660e('0x32')]['filter']+'%'};return _0x301364;}})});}_0x110021=_[_0x660e('0x40')]({},_0x110021,_0x2dd264[_0x660e('0x42')]);var _0x3c683b={'where':_0x110021[_0x660e('0x3d')]};return db[_0x660e('0x2e')]['count'](_0x3c683b)[_0x660e('0x22')](function(_0x57339d){_0x4e12e8[_0x660e('0x1a')]=_0x57339d;if(_0x2dd264[_0x660e('0x32')][_0x660e('0x43')]){_0x110021[_0x660e('0x44')]=[{'all':!![]}];}return db[_0x660e('0x2e')][_0x660e('0x45')](_0x110021);})[_0x660e('0x22')](function(_0x31b725){_0x4e12e8[_0x660e('0x46')]=_0x31b725;return _0x4e12e8;})['then'](respondWithFilteredResult(_0x5a4b02,_0x110021))[_0x660e('0x47')](handleError(_0x5a4b02,null));};exports['show']=function(_0x2f0fbe,_0x132b25){var _0x103143={'raw':!![],'where':{'id':_0x2f0fbe[_0x660e('0x48')]['id']}},_0x52adfa={};_0x52adfa[_0x660e('0x31')]=_[_0x660e('0x33')](db[_0x660e('0x2e')][_0x660e('0x49')]);_0x52adfa[_0x660e('0x32')]=_['keys'](_0x2f0fbe[_0x660e('0x32')]);_0x52adfa[_0x660e('0x34')]=_['intersection'](_0x52adfa['model'],_0x52adfa[_0x660e('0x32')]);_0x103143[_0x660e('0x36')]=_[_0x660e('0x35')](_0x52adfa[_0x660e('0x31')],qs['fields'](_0x2f0fbe['query'][_0x660e('0x37')]));_0x103143[_0x660e('0x36')]=_0x103143[_0x660e('0x36')][_0x660e('0x38')]?_0x103143['attributes']:_0x52adfa['model'];if(_0x2f0fbe[_0x660e('0x32')]['includeAll']){_0x103143[_0x660e('0x44')]=[{'all':!![]}];}_0x103143=_[_0x660e('0x40')]({},_0x103143,_0x2f0fbe['options']);return db[_0x660e('0x2e')]['find'](_0x103143)[_0x660e('0x22')](handleEntityNotFound(_0x132b25,null))[_0x660e('0x22')](respondWithResult(_0x132b25,null))['catch'](handleError(_0x132b25,null));};exports[_0x660e('0x4a')]=function(_0x247899,_0x52dd9c){return db[_0x660e('0x2e')][_0x660e('0x4a')](_0x247899['body'],{})[_0x660e('0x22')](function(_0x589955){var _0x179ea1=_0x247899['user'][_0x660e('0x24')]({'plain':!![]});if(!_0x179ea1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x179ea1[_0x660e('0x4b')]==='user'){var _0xdbb514=_0x589955['get']({'plain':!![]});var _0x37fdcb=_0x660e('0x25');return db[_0x660e('0x4c')]['find']({'where':{'name':_0x37fdcb,'userProfileId':_0x179ea1['userProfileId']},'raw':!![]})['then'](function(_0x3dbf33){if(_0x3dbf33&&_0x3dbf33[_0x660e('0x4d')]===0x0){return db[_0x660e('0x26')]['create']({'name':_0xdbb514[_0x660e('0x2a')],'resourceId':_0xdbb514['id'],'type':_0x3dbf33[_0x660e('0x2a')],'sectionId':_0x3dbf33['id']},{})[_0x660e('0x22')](function(){return _0x589955;});}else{return _0x589955;}})[_0x660e('0x47')](function(_0x324466){logger[_0x660e('0x28')](_0x660e('0x4e'),_0x324466);throw _0x324466;});}return _0x589955;})[_0x660e('0x22')](respondWithResult(_0x52dd9c,0xc9))['catch'](handleError(_0x52dd9c,null));};exports['update']=function(_0x5c8eb4,_0x563287){if(_0x5c8eb4['body']['id']){delete _0x5c8eb4[_0x660e('0x4f')]['id'];}return db[_0x660e('0x2e')]['find']({'where':{'id':_0x5c8eb4['params']['id']}})[_0x660e('0x22')](handleEntityNotFound(_0x563287,null))[_0x660e('0x22')](saveUpdates(_0x5c8eb4[_0x660e('0x4f')],null))[_0x660e('0x22')](respondWithResult(_0x563287,null))[_0x660e('0x47')](handleError(_0x563287,null));};exports[_0x660e('0x23')]=function(_0x4947d7,_0x50b64b){return db['Template'][_0x660e('0x50')]({'where':{'id':_0x4947d7[_0x660e('0x48')]['id']}})[_0x660e('0x22')](handleEntityNotFound(_0x50b64b,null))[_0x660e('0x22')](removeEntity(_0x50b64b,null))[_0x660e('0x47')](handleError(_0x50b64b,null));}; \ No newline at end of file +var _0x1869=['reject','update','destroy','get','UserProfileResource','then','end','error','stack','name','send','map','Template','rawAttributes','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Templates','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x436641,_0x4afca2){var _0x29e38f=function(_0x352f84){while(--_0x352f84){_0x436641['push'](_0x436641['shift']());}};_0x29e38f(++_0x4afca2);}(_0x1869,0x174));var _0x9186=function(_0x46d7b2,_0x547b66){_0x46d7b2=_0x46d7b2-0x0;var _0x5a6376=_0x1869[_0x46d7b2];return _0x5a6376;};'use strict';var pdf=require(_0x9186('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9186('0x1'));var zipdir=require(_0x9186('0x2'));var jsonpatch=require(_0x9186('0x3'));var rp=require(_0x9186('0x4'));var moment=require(_0x9186('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9186('0x6'));var sox=require(_0x9186('0x7'));var csv=require('to-csv');var ejs=require(_0x9186('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9186('0x9'));var crypto=require(_0x9186('0xa'));var jsforce=require(_0x9186('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9186('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9186('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x9186('0xe'));var hardwareService=require(_0x9186('0xf'));var logger=require('../../config/logger')(_0x9186('0x10'));var utils=require(_0x9186('0x11'));var config=require('../../config/environment');var db=require(_0x9186('0x12'))['db'];function respondWithStatusCode(_0x7e40c0,_0x1cf413){_0x1cf413=_0x1cf413||0xcc;return function(_0x506df6){if(_0x506df6){return _0x7e40c0[_0x9186('0x13')](_0x1cf413);}return _0x7e40c0[_0x9186('0x14')](_0x1cf413)['end']();};}function respondWithResult(_0x4ab0ed,_0x558dd8){_0x558dd8=_0x558dd8||0xc8;return function(_0x11ff50){if(_0x11ff50){return _0x4ab0ed[_0x9186('0x14')](_0x558dd8)[_0x9186('0x15')](_0x11ff50);}};}function respondWithFilteredResult(_0x1320b5,_0x11f28b){return function(_0x752585){if(_0x752585){var _0x177ee2=_0x752585[_0x9186('0x16')],_0x25f96c=_0x11f28b['offset'],_0x13ea6a=_0x11f28b[_0x9186('0x17')]+_0x11f28b[_0x9186('0x18')],_0x19b63a;if(_0x13ea6a>=_0x177ee2){_0x13ea6a=_0x177ee2;_0x19b63a=0xc8;}else{_0x19b63a=0xce;}_0x1320b5[_0x9186('0x14')](_0x19b63a);return _0x1320b5[_0x9186('0x19')](_0x9186('0x1a'),_0x25f96c+'-'+_0x13ea6a+'/'+_0x177ee2)[_0x9186('0x15')](_0x752585);}return null;};}function patchUpdates(_0x3033d4){return function(_0x4c814f){try{jsonpatch[_0x9186('0x1b')](_0x4c814f,_0x3033d4,!![]);}catch(_0x4efe43){return BPromise[_0x9186('0x1c')](_0x4efe43);}return _0x4c814f['save']();};}function saveUpdates(_0x33f691,_0x35907d){return function(_0x42954a){if(_0x42954a){return _0x42954a[_0x9186('0x1d')](_0x33f691)['then'](function(_0xace149){return _0xace149;});}return null;};}function removeEntity(_0x103580,_0x521ced){return function(_0x38c7d1){if(_0x38c7d1){return _0x38c7d1[_0x9186('0x1e')]()['then'](function(){var _0x45a284=_0x38c7d1[_0x9186('0x1f')]({'plain':!![]});var _0x4a70f9='Templates';return db[_0x9186('0x20')][_0x9186('0x1e')]({'where':{'type':_0x4a70f9,'resourceId':_0x45a284['id']}})['then'](function(){return _0x38c7d1;});})[_0x9186('0x21')](function(){_0x103580[_0x9186('0x14')](0xcc)[_0x9186('0x22')]();});}};}function handleEntityNotFound(_0x28f61f,_0x567a1f){return function(_0xb7f9d1){if(!_0xb7f9d1){_0x28f61f['sendStatus'](0x194);}return _0xb7f9d1;};}function handleError(_0x4b8d58,_0x39f19b){_0x39f19b=_0x39f19b||0x1f4;return function(_0x25c76f){logger[_0x9186('0x23')](_0x25c76f[_0x9186('0x24')]);if(_0x25c76f['name']){delete _0x25c76f[_0x9186('0x25')];}_0x4b8d58[_0x9186('0x14')](_0x39f19b)[_0x9186('0x26')](_0x25c76f);};}exports['index']=function(_0x4bd4bf,_0x1463cd){var _0x59992b={},_0x19aba5={},_0x240c20={'count':0x0,'rows':[]};var _0x3097d8=_[_0x9186('0x27')](db[_0x9186('0x28')][_0x9186('0x29')],function(_0x408031){return{'name':_0x408031['fieldName'],'type':_0x408031['type'][_0x9186('0x2a')]};});_0x19aba5[_0x9186('0x2b')]=_[_0x9186('0x27')](_0x3097d8,_0x9186('0x25'));_0x19aba5[_0x9186('0x2c')]=_['keys'](_0x4bd4bf['query']);_0x19aba5[_0x9186('0x2d')]=_[_0x9186('0x2e')](_0x19aba5['model'],_0x19aba5[_0x9186('0x2c')]);_0x59992b['attributes']=_[_0x9186('0x2e')](_0x19aba5[_0x9186('0x2b')],qs['fields'](_0x4bd4bf[_0x9186('0x2c')][_0x9186('0x2f')]));_0x59992b[_0x9186('0x30')]=_0x59992b[_0x9186('0x30')]['length']?_0x59992b['attributes']:_0x19aba5[_0x9186('0x2b')];if(!_0x4bd4bf[_0x9186('0x2c')][_0x9186('0x31')](_0x9186('0x32'))){_0x59992b[_0x9186('0x18')]=qs[_0x9186('0x18')](_0x4bd4bf[_0x9186('0x2c')][_0x9186('0x18')]);_0x59992b['offset']=qs[_0x9186('0x17')](_0x4bd4bf[_0x9186('0x2c')][_0x9186('0x17')]);}_0x59992b[_0x9186('0x33')]=qs['sort'](_0x4bd4bf[_0x9186('0x2c')][_0x9186('0x34')]);_0x59992b[_0x9186('0x35')]=qs[_0x9186('0x2d')](_[_0x9186('0x36')](_0x4bd4bf[_0x9186('0x2c')],_0x19aba5[_0x9186('0x2d')]));if(_0x4bd4bf['query'][_0x9186('0x37')]){_0x59992b[_0x9186('0x35')]=_[_0x9186('0x38')](_0x59992b[_0x9186('0x35')],{'$or':_[_0x9186('0x27')](_0x3097d8,function(_0x2b5eaa){if(_0x2b5eaa[_0x9186('0x39')]!==_0x9186('0x3a')){var _0xc06fc={};_0xc06fc[_0x2b5eaa[_0x9186('0x25')]]={'$like':'%'+_0x4bd4bf[_0x9186('0x2c')]['filter']+'%'};return _0xc06fc;}})});}_0x59992b=_[_0x9186('0x38')]({},_0x59992b,_0x4bd4bf['options']);var _0x3cdf93={'where':_0x59992b[_0x9186('0x35')]};return db[_0x9186('0x28')][_0x9186('0x16')](_0x3cdf93)[_0x9186('0x21')](function(_0xd13e63){_0x240c20[_0x9186('0x16')]=_0xd13e63;if(_0x4bd4bf[_0x9186('0x2c')][_0x9186('0x3b')]){_0x59992b[_0x9186('0x3c')]=[{'all':!![]}];}return db['Template'][_0x9186('0x3d')](_0x59992b);})[_0x9186('0x21')](function(_0x5beafe){_0x240c20[_0x9186('0x3e')]=_0x5beafe;return _0x240c20;})[_0x9186('0x21')](respondWithFilteredResult(_0x1463cd,_0x59992b))[_0x9186('0x3f')](handleError(_0x1463cd,null));};exports[_0x9186('0x40')]=function(_0x32ac5d,_0x2ba785){var _0x42bff1={'raw':!![],'where':{'id':_0x32ac5d[_0x9186('0x41')]['id']}},_0x5c0157={};_0x5c0157['model']=_[_0x9186('0x42')](db[_0x9186('0x28')][_0x9186('0x29')]);_0x5c0157[_0x9186('0x2c')]=_['keys'](_0x32ac5d['query']);_0x5c0157[_0x9186('0x2d')]=_['intersection'](_0x5c0157[_0x9186('0x2b')],_0x5c0157[_0x9186('0x2c')]);_0x42bff1[_0x9186('0x30')]=_[_0x9186('0x2e')](_0x5c0157[_0x9186('0x2b')],qs[_0x9186('0x2f')](_0x32ac5d[_0x9186('0x2c')][_0x9186('0x2f')]));_0x42bff1[_0x9186('0x30')]=_0x42bff1[_0x9186('0x30')][_0x9186('0x43')]?_0x42bff1[_0x9186('0x30')]:_0x5c0157[_0x9186('0x2b')];if(_0x32ac5d[_0x9186('0x2c')][_0x9186('0x3b')]){_0x42bff1['include']=[{'all':!![]}];}_0x42bff1=_[_0x9186('0x38')]({},_0x42bff1,_0x32ac5d[_0x9186('0x44')]);return db[_0x9186('0x28')][_0x9186('0x45')](_0x42bff1)[_0x9186('0x21')](handleEntityNotFound(_0x2ba785,null))['then'](respondWithResult(_0x2ba785,null))['catch'](handleError(_0x2ba785,null));};exports[_0x9186('0x46')]=function(_0x569c63,_0x276eca){return db[_0x9186('0x28')][_0x9186('0x46')](_0x569c63[_0x9186('0x47')],{})[_0x9186('0x21')](function(_0x6f23b3){var _0x4aba55=_0x569c63['user'][_0x9186('0x1f')]({'plain':!![]});if(!_0x4aba55)throw new Error(_0x9186('0x48'));if(_0x4aba55[_0x9186('0x49')]===_0x9186('0x4a')){var _0x5e39cc=_0x6f23b3[_0x9186('0x1f')]({'plain':!![]});var _0x30653f=_0x9186('0x4b');return db[_0x9186('0x4c')]['find']({'where':{'name':_0x30653f,'userProfileId':_0x4aba55[_0x9186('0x4d')]},'raw':!![]})[_0x9186('0x21')](function(_0x3cc9cf){if(_0x3cc9cf&&_0x3cc9cf[_0x9186('0x4e')]===0x0){return db[_0x9186('0x20')][_0x9186('0x46')]({'name':_0x5e39cc[_0x9186('0x25')],'resourceId':_0x5e39cc['id'],'type':_0x3cc9cf['name'],'sectionId':_0x3cc9cf['id']},{})['then'](function(){return _0x6f23b3;});}else{return _0x6f23b3;}})['catch'](function(_0x55e89d){logger['error'](_0x9186('0x4f'),_0x55e89d);throw _0x55e89d;});}return _0x6f23b3;})[_0x9186('0x21')](respondWithResult(_0x276eca,0xc9))[_0x9186('0x3f')](handleError(_0x276eca,null));};exports[_0x9186('0x1d')]=function(_0x171712,_0x5853ad){if(_0x171712[_0x9186('0x47')]['id']){delete _0x171712[_0x9186('0x47')]['id'];}return db[_0x9186('0x28')][_0x9186('0x45')]({'where':{'id':_0x171712[_0x9186('0x41')]['id']}})[_0x9186('0x21')](handleEntityNotFound(_0x5853ad,null))['then'](saveUpdates(_0x171712[_0x9186('0x47')],null))['then'](respondWithResult(_0x5853ad,null))[_0x9186('0x3f')](handleError(_0x5853ad,null));};exports[_0x9186('0x1e')]=function(_0x5d745d,_0x568062){return db[_0x9186('0x28')][_0x9186('0x45')]({'where':{'id':_0x5d745d[_0x9186('0x41')]['id']}})[_0x9186('0x21')](handleEntityNotFound(_0x568062,null))[_0x9186('0x21')](removeEntity(_0x568062,null))[_0x9186('0x3f')](handleError(_0x568062,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 8054069..51433bf 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 _0x0b3d=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./template.attributes','exports','define','tools_templates','lodash'];(function(_0x1c2c16,_0x48c169){var _0x3140f8=function(_0x3327ef){while(--_0x3327ef){_0x1c2c16['push'](_0x1c2c16['shift']());}};_0x3140f8(++_0x48c169);}(_0x0b3d,0xb5));var _0xd0b3=function(_0x3ed091,_0x3491d4){_0x3ed091=_0x3ed091-0x0;var _0x49f07c=_0x0b3d[_0x3ed091];return _0x49f07c;};'use strict';var _=require(_0xd0b3('0x0'));var util=require(_0xd0b3('0x1'));var logger=require(_0xd0b3('0x2'))(_0xd0b3('0x3'));var moment=require(_0xd0b3('0x4'));var BPromise=require(_0xd0b3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0b3('0x6'));var rimraf=require(_0xd0b3('0x7'));var config=require(_0xd0b3('0x8'));var attributes=require(_0xd0b3('0x9'));module[_0xd0b3('0xa')]=function(_0x2b13c5,_0x57b32c){return _0x2b13c5[_0xd0b3('0xb')]('Template',attributes,{'tableName':_0xd0b3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f7c=['define','Template','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./template.attributes','exports'];(function(_0x46a7d9,_0x581b26){var _0x4364e0=function(_0x1cf7f7){while(--_0x1cf7f7){_0x46a7d9['push'](_0x46a7d9['shift']());}};_0x4364e0(++_0x581b26);}(_0x6f7c,0xc5));var _0xc6f7=function(_0x508a12,_0x409469){_0x508a12=_0x508a12-0x0;var _0x3f3181=_0x6f7c[_0x508a12];return _0x3f3181;};'use strict';var _=require(_0xc6f7('0x0'));var util=require(_0xc6f7('0x1'));var logger=require(_0xc6f7('0x2'))(_0xc6f7('0x3'));var moment=require(_0xc6f7('0x4'));var BPromise=require(_0xc6f7('0x5'));var rp=require(_0xc6f7('0x6'));var fs=require('fs');var path=require(_0xc6f7('0x7'));var rimraf=require('rimraf');var config=require(_0xc6f7('0x8'));var attributes=require(_0xc6f7('0x9'));module[_0xc6f7('0xa')]=function(_0x20b0d7,_0x25842d){return _0x20b0d7[_0xc6f7('0xb')](_0xc6f7('0xc'),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 7224bcf..30123e4 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 _0xc1a8=['code','message','info','catch','GetTemplate','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5743aa,_0x222173){var _0x1a097a=function(_0x20d4bc){while(--_0x20d4bc){_0x5743aa['push'](_0x5743aa['shift']());}};_0x1a097a(++_0x222173);}(_0xc1a8,0x77));var _0x8c1a=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0xc1a8[_0x519c88];return _0x4668d7;};'use strict';var _=require(_0x8c1a('0x0'));var util=require(_0x8c1a('0x1'));var moment=require(_0x8c1a('0x2'));var BPromise=require(_0x8c1a('0x3'));var rs=require(_0x8c1a('0x4'));var fs=require('fs');var Redis=require(_0x8c1a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8c1a('0x6'))(_0x8c1a('0x7'));var config=require(_0x8c1a('0x8'));var jayson=require(_0x8c1a('0x9'));var client=jayson['client'][_0x8c1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cce51,_0x130436,_0x196f31){return new BPromise(function(_0x2e7a04,_0x1fa215){return client['request'](_0x5cce51,_0x196f31)[_0x8c1a('0xb')](function(_0x46c645){logger['info'](_0x8c1a('0xc'),_0x130436,'request\x20sent');logger['debug'](_0x8c1a('0xd'),_0x130436,'request\x20sent',JSON[_0x8c1a('0xe')](_0x46c645));if(_0x46c645[_0x8c1a('0xf')]){if(_0x46c645['error'][_0x8c1a('0x10')]===0x1f4){logger[_0x8c1a('0xf')]('Template,\x20%s,\x20%s',_0x130436,_0x46c645[_0x8c1a('0xf')][_0x8c1a('0x11')]);return _0x1fa215(_0x46c645[_0x8c1a('0xf')]['message']);}logger[_0x8c1a('0xf')](_0x8c1a('0xc'),_0x130436,_0x46c645[_0x8c1a('0xf')][_0x8c1a('0x11')]);return _0x2e7a04(_0x46c645['error'][_0x8c1a('0x11')]);}else{logger[_0x8c1a('0x12')](_0x8c1a('0xc'),_0x130436,'request\x20sent');_0x2e7a04(_0x46c645['result']['message']);}})[_0x8c1a('0x13')](function(_0x48c111){logger[_0x8c1a('0xf')](_0x8c1a('0xc'),_0x130436,_0x48c111);_0x1fa215(_0x48c111);});});}exports[_0x8c1a('0x14')]=function(_0x55835c){var _0x2d34f2=this;return new Promise(function(_0x587c41,_0x4d6ee6){return db['Template']['findAll']({'raw':_0x55835c['options']?_0x55835c['options']['raw']===undefined?!![]:![]:!![],'where':_0x55835c[_0x8c1a('0x15')]?_0x55835c[_0x8c1a('0x15')][_0x8c1a('0x16')]||null:null,'attributes':_0x55835c[_0x8c1a('0x15')]?_0x55835c['options'][_0x8c1a('0x17')]||null:null,'limit':_0x55835c[_0x8c1a('0x15')]?_0x55835c[_0x8c1a('0x15')]['limit']||null:null,'include':_0x55835c[_0x8c1a('0x15')]?_0x55835c[_0x8c1a('0x15')][_0x8c1a('0x18')]?_[_0x8c1a('0x19')](_0x55835c[_0x8c1a('0x15')][_0x8c1a('0x18')],function(_0x22ba14){return{'model':db[_0x22ba14[_0x8c1a('0x1a')]],'as':_0x22ba14['as'],'attributes':_0x22ba14[_0x8c1a('0x17')],'include':_0x22ba14[_0x8c1a('0x18')]?_[_0x8c1a('0x19')](_0x22ba14[_0x8c1a('0x18')],function(_0x43d548){return{'model':db[_0x43d548['model']],'as':_0x43d548['as'],'attributes':_0x43d548[_0x8c1a('0x17')],'include':_0x43d548[_0x8c1a('0x18')]?_[_0x8c1a('0x19')](_0x43d548[_0x8c1a('0x18')],function(_0x23acb6){return{'model':db[_0x23acb6[_0x8c1a('0x1a')]],'as':_0x23acb6['as'],'attributes':_0x23acb6[_0x8c1a('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8c1a('0xb')](function(_0x11f75e){logger[_0x8c1a('0x12')](_0x8c1a('0x14'),_0x55835c);logger['debug'](_0x8c1a('0x14'),_0x55835c,JSON[_0x8c1a('0xe')](_0x11f75e));_0x587c41(_0x11f75e);})['catch'](function(_0x193e0e){logger[_0x8c1a('0xf')](_0x8c1a('0x14'),_0x193e0e[_0x8c1a('0x11')],_0x55835c);_0x4d6ee6(_0x2d34f2['error'](0x1f4,_0x193e0e['message']));});});}; \ No newline at end of file +var _0xed1a=['limit','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','debug','stringify','code','error','message','catch','GetTemplate','options','raw','where','attributes'];(function(_0x49d71c,_0x4b8e41){var _0x3a1813=function(_0x5e946d){while(--_0x5e946d){_0x49d71c['push'](_0x49d71c['shift']());}};_0x3a1813(++_0x4b8e41);}(_0xed1a,0x1c4));var _0xaed1=function(_0x3d413e,_0x171704){_0x3d413e=_0x3d413e-0x0;var _0xdd0519=_0xed1a[_0x3d413e];return _0xdd0519;};'use strict';var _=require(_0xaed1('0x0'));var util=require(_0xaed1('0x1'));var moment=require(_0xaed1('0x2'));var BPromise=require('bluebird');var rs=require(_0xaed1('0x3'));var fs=require('fs');var Redis=require(_0xaed1('0x4'));var db=require(_0xaed1('0x5'))['db'];var utils=require(_0xaed1('0x6'));var logger=require(_0xaed1('0x7'))(_0xaed1('0x8'));var config=require(_0xaed1('0x9'));var jayson=require(_0xaed1('0xa'));var client=jayson[_0xaed1('0xb')][_0xaed1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x222530,_0x3cdb28,_0x5688fc){return new BPromise(function(_0x3321ca,_0x3f4fcc){return client[_0xaed1('0xd')](_0x222530,_0x5688fc)[_0xaed1('0xe')](function(_0x5ad827){logger[_0xaed1('0xf')](_0xaed1('0x10'),_0x3cdb28,'request\x20sent');logger[_0xaed1('0x11')]('Template,\x20%s,\x20%s,\x20%s',_0x3cdb28,'request\x20sent',JSON[_0xaed1('0x12')](_0x5ad827));if(_0x5ad827['error']){if(_0x5ad827['error'][_0xaed1('0x13')]===0x1f4){logger['error'](_0xaed1('0x10'),_0x3cdb28,_0x5ad827[_0xaed1('0x14')]['message']);return _0x3f4fcc(_0x5ad827[_0xaed1('0x14')][_0xaed1('0x15')]);}logger[_0xaed1('0x14')](_0xaed1('0x10'),_0x3cdb28,_0x5ad827[_0xaed1('0x14')]['message']);return _0x3321ca(_0x5ad827[_0xaed1('0x14')]['message']);}else{logger[_0xaed1('0xf')]('Template,\x20%s,\x20%s',_0x3cdb28,'request\x20sent');_0x3321ca(_0x5ad827['result'][_0xaed1('0x15')]);}})[_0xaed1('0x16')](function(_0x3bf33f){logger[_0xaed1('0x14')]('Template,\x20%s,\x20%s',_0x3cdb28,_0x3bf33f);_0x3f4fcc(_0x3bf33f);});});}exports[_0xaed1('0x17')]=function(_0x12396d){var _0x14c33b=this;return new Promise(function(_0xf55bf9,_0x49ae09){return db['Template']['findAll']({'raw':_0x12396d[_0xaed1('0x18')]?_0x12396d[_0xaed1('0x18')][_0xaed1('0x19')]===undefined?!![]:![]:!![],'where':_0x12396d[_0xaed1('0x18')]?_0x12396d[_0xaed1('0x18')][_0xaed1('0x1a')]||null:null,'attributes':_0x12396d[_0xaed1('0x18')]?_0x12396d[_0xaed1('0x18')][_0xaed1('0x1b')]||null:null,'limit':_0x12396d[_0xaed1('0x18')]?_0x12396d[_0xaed1('0x18')][_0xaed1('0x1c')]||null:null,'include':_0x12396d[_0xaed1('0x18')]?_0x12396d['options'][_0xaed1('0x1d')]?_['map'](_0x12396d[_0xaed1('0x18')][_0xaed1('0x1d')],function(_0x50b2f0){return{'model':db[_0x50b2f0['model']],'as':_0x50b2f0['as'],'attributes':_0x50b2f0['attributes'],'include':_0x50b2f0['include']?_[_0xaed1('0x1e')](_0x50b2f0[_0xaed1('0x1d')],function(_0x2cac26){return{'model':db[_0x2cac26[_0xaed1('0x1f')]],'as':_0x2cac26['as'],'attributes':_0x2cac26[_0xaed1('0x1b')],'include':_0x2cac26[_0xaed1('0x1d')]?_['map'](_0x2cac26['include'],function(_0x468390){return{'model':db[_0x468390[_0xaed1('0x1f')]],'as':_0x468390['as'],'attributes':_0x468390[_0xaed1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xaed1('0xe')](function(_0x4cb739){logger[_0xaed1('0xf')]('GetTemplate',_0x12396d);logger['debug'](_0xaed1('0x17'),_0x12396d,JSON[_0xaed1('0x12')](_0x4cb739));_0xf55bf9(_0x4cb739);})['catch'](function(_0x50cf67){logger[_0xaed1('0x14')](_0xaed1('0x17'),_0x50cf67[_0xaed1('0x15')],_0x12396d);_0x49ae09(_0x14c33b[_0xaed1('0x14')](0x1f4,_0x50cf67['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 8d25e4d..d13fe4b 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 _0x10d4=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/all_conditions','getAllConditions','getAnyConditions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','put','/:id','update','delete','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x10d4,0xa9));var _0x410d=function(_0x514c15,_0x486901){_0x514c15=_0x514c15-0x0;var _0x16283e=_0x10d4[_0x514c15];return _0x16283e;};'use strict';var multer=require('multer');var util=require(_0x410d('0x0'));var path=require(_0x410d('0x1'));var timeout=require(_0x410d('0x2'));var express=require(_0x410d('0x3'));var router=express[_0x410d('0x4')]();var auth=require(_0x410d('0x5'));var interaction=require(_0x410d('0x6'));var config=require(_0x410d('0x7'));var controller=require('./trigger.controller');router[_0x410d('0x8')]('/',auth[_0x410d('0x9')](),controller[_0x410d('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x410d('0x8')](_0x410d('0xb'),auth[_0x410d('0x9')](),controller[_0x410d('0xc')]);router[_0x410d('0x8')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x410d('0xd')]);router[_0x410d('0x8')]('/:id/actions',auth['isAuthenticated'](),controller[_0x410d('0xe')]);router[_0x410d('0xf')]('/',auth[_0x410d('0x9')](),controller[_0x410d('0x10')]);router['post'](_0x410d('0xb'),auth[_0x410d('0x9')](),controller[_0x410d('0x11')]);router[_0x410d('0xf')](_0x410d('0x12'),auth['isAuthenticated'](),controller[_0x410d('0x13')]);router[_0x410d('0xf')](_0x410d('0x14'),auth['isAuthenticated'](),controller[_0x410d('0x15')]);router[_0x410d('0x16')](_0x410d('0x17'),auth[_0x410d('0x9')](),controller[_0x410d('0x18')]);router[_0x410d('0x19')]('/:id',auth[_0x410d('0x9')](),controller[_0x410d('0x1a')]);module[_0x410d('0x1b')]=router; \ No newline at end of file +var _0xcf66=['../../config/environment','./trigger.controller','get','isAuthenticated','/:id','/:id/all_conditions','post','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x24a709,_0x347b7e){var _0x268b0b=function(_0x14817b){while(--_0x14817b){_0x24a709['push'](_0x24a709['shift']());}};_0x268b0b(++_0x347b7e);}(_0xcf66,0x12e));var _0x6cf6=function(_0xfa494,_0x42006c){_0xfa494=_0xfa494-0x0;var _0x267450=_0xcf66[_0xfa494];return _0x267450;};'use strict';var multer=require('multer');var util=require(_0x6cf6('0x0'));var path=require(_0x6cf6('0x1'));var timeout=require('connect-timeout');var express=require(_0x6cf6('0x2'));var router=express[_0x6cf6('0x3')]();var auth=require(_0x6cf6('0x4'));var interaction=require(_0x6cf6('0x5'));var config=require(_0x6cf6('0x6'));var controller=require(_0x6cf6('0x7'));router[_0x6cf6('0x8')]('/',auth[_0x6cf6('0x9')](),controller['index']);router[_0x6cf6('0x8')](_0x6cf6('0xa'),auth[_0x6cf6('0x9')](),controller['show']);router['get'](_0x6cf6('0xb'),auth[_0x6cf6('0x9')](),controller['getAllConditions']);router[_0x6cf6('0x8')]('/:id/any_conditions',auth[_0x6cf6('0x9')](),controller['getAnyConditions']);router[_0x6cf6('0x8')]('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router[_0x6cf6('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x6cf6('0xb'),auth[_0x6cf6('0x9')](),controller['addAllCondition']);router[_0x6cf6('0xc')](_0x6cf6('0xd'),auth[_0x6cf6('0x9')](),controller[_0x6cf6('0xe')]);router['post'](_0x6cf6('0xf'),auth[_0x6cf6('0x9')](),controller[_0x6cf6('0x10')]);router[_0x6cf6('0x11')](_0x6cf6('0xa'),auth[_0x6cf6('0x9')](),controller[_0x6cf6('0x12')]);router[_0x6cf6('0x13')](_0x6cf6('0xa'),auth[_0x6cf6('0x9')](),controller[_0x6cf6('0x14')]);module[_0x6cf6('0x15')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 1e0260c..364ff1e 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 _0x67f8=['sequelize','STRING','BOOLEAN'];(function(_0x432b9f,_0x2d1c3d){var _0x401a05=function(_0x4208b7){while(--_0x4208b7){_0x432b9f['push'](_0x432b9f['shift']());}};_0x401a05(++_0x2d1c3d);}(_0x67f8,0xb4));var _0x867f=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x67f8[_0x51ac09];return _0x3f827d;};'use strict';var Sequelize=require(_0x867f('0x0'));module['exports']={'name':{'type':Sequelize[_0x867f('0x1')]},'channel':{'type':Sequelize[_0x867f('0x1')]},'description':{'type':Sequelize[_0x867f('0x1')]},'status':{'type':Sequelize[_0x867f('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x934c=['BOOLEAN','exports','STRING'];(function(_0x5757cd,_0x1efc9b){var _0x26be4c=function(_0x51cae4){while(--_0x51cae4){_0x5757cd['push'](_0x5757cd['shift']());}};_0x26be4c(++_0x1efc9b);}(_0x934c,0x10f));var _0xc934=function(_0x5b6c90,_0x3b3358){_0x5b6c90=_0x5b6c90-0x0;var _0x28c736=_0x934c[_0x5b6c90];return _0x28c736;};'use strict';var Sequelize=require('sequelize');module[_0xc934('0x0')]={'name':{'type':Sequelize[_0xc934('0x1')]},'channel':{'type':Sequelize[_0xc934('0x1')]},'description':{'type':Sequelize[_0xc934('0x1')]},'status':{'type':Sequelize[_0xc934('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 21d7ddc..f3ba407 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 _0x38d2=['name','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','fields','getAllConditions','getAnyConditions','addAction','TriggerId','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','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','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','get','Triggers','UserProfileResource','error','stack'];(function(_0x5198d3,_0x28f2ce){var _0xb145dd=function(_0x88d32f){while(--_0x88d32f){_0x5198d3['push'](_0x5198d3['shift']());}};_0xb145dd(++_0x28f2ce);}(_0x38d2,0xed));var _0x238d=function(_0x4d5eb9,_0x39df07){_0x4d5eb9=_0x4d5eb9-0x0;var _0x3ce847=_0x38d2[_0x4d5eb9];return _0x3ce847;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x238d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x238d('0x1'));var jsonpatch=require(_0x238d('0x2'));var rp=require(_0x238d('0x3'));var moment=require(_0x238d('0x4'));var BPromise=require(_0x238d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x238d('0x6'));var sox=require(_0x238d('0x7'));var csv=require(_0x238d('0x8'));var ejs=require(_0x238d('0x9'));var fs=require('fs');var _=require(_0x238d('0xa'));var squel=require(_0x238d('0xb'));var crypto=require('crypto');var jsforce=require(_0x238d('0xc'));var deskjs=require(_0x238d('0xd'));var toCsv=require(_0x238d('0x8'));var querystring=require(_0x238d('0xe'));var Papa=require('papaparse');var Redis=require(_0x238d('0xf'));var authService=require(_0x238d('0x10'));var qs=require(_0x238d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x238d('0x12'));var logger=require(_0x238d('0x13'))(_0x238d('0x14'));var utils=require(_0x238d('0x15'));var config=require(_0x238d('0x16'));var db=require(_0x238d('0x17'))['db'];function respondWithStatusCode(_0x1102f2,_0x2aaed9){_0x2aaed9=_0x2aaed9||0xcc;return function(_0x418b0a){if(_0x418b0a){return _0x1102f2[_0x238d('0x18')](_0x2aaed9);}return _0x1102f2[_0x238d('0x19')](_0x2aaed9)[_0x238d('0x1a')]();};}function respondWithResult(_0x5bac8a,_0x23369a){_0x23369a=_0x23369a||0xc8;return function(_0x39eafe){if(_0x39eafe){return _0x5bac8a['status'](_0x23369a)[_0x238d('0x1b')](_0x39eafe);}};}function respondWithFilteredResult(_0x5c2945,_0x31af5f){return function(_0x485686){if(_0x485686){var _0x467cbe=_0x485686[_0x238d('0x1c')],_0x2105e0=_0x31af5f['offset'],_0x2ed010=_0x31af5f[_0x238d('0x1d')]+_0x31af5f['limit'],_0x8a5b09;if(_0x2ed010>=_0x467cbe){_0x2ed010=_0x467cbe;_0x8a5b09=0xc8;}else{_0x8a5b09=0xce;}_0x5c2945['status'](_0x8a5b09);return _0x5c2945[_0x238d('0x1e')](_0x238d('0x1f'),_0x2105e0+'-'+_0x2ed010+'/'+_0x467cbe)[_0x238d('0x1b')](_0x485686);}return null;};}function patchUpdates(_0x5a46bb){return function(_0x2e2267){try{jsonpatch[_0x238d('0x20')](_0x2e2267,_0x5a46bb,!![]);}catch(_0x180e3a){return BPromise[_0x238d('0x21')](_0x180e3a);}return _0x2e2267[_0x238d('0x22')]();};}function saveUpdates(_0x4c2db4,_0xc7d0d4){return function(_0x1b837f){if(_0x1b837f){return _0x1b837f['update'](_0x4c2db4)['then'](function(_0x2d7c7a){return _0x2d7c7a;});}return null;};}function removeEntity(_0x24a018,_0xf81896){return function(_0x7d0340){if(_0x7d0340){return _0x7d0340[_0x238d('0x23')]()[_0x238d('0x24')](function(){var _0x5f3a28=_0x7d0340[_0x238d('0x25')]({'plain':!![]});var _0x281cf6=_0x238d('0x26');return db[_0x238d('0x27')][_0x238d('0x23')]({'where':{'type':_0x281cf6,'resourceId':_0x5f3a28['id']}})['then'](function(){return _0x7d0340;});})[_0x238d('0x24')](function(){_0x24a018[_0x238d('0x19')](0xcc)[_0x238d('0x1a')]();});}};}function handleEntityNotFound(_0x1343d0,_0x2f189a){return function(_0x3dbc2e){if(!_0x3dbc2e){_0x1343d0[_0x238d('0x18')](0x194);}return _0x3dbc2e;};}function handleError(_0x6d7d27,_0x126995){_0x126995=_0x126995||0x1f4;return function(_0x2dc2d9){logger[_0x238d('0x28')](_0x2dc2d9[_0x238d('0x29')]);if(_0x2dc2d9['name']){delete _0x2dc2d9[_0x238d('0x2a')];}_0x6d7d27[_0x238d('0x19')](_0x126995)['send'](_0x2dc2d9);};}exports[_0x238d('0x2b')]=function(_0x1ea0c1,_0x446fd0){var _0x3055a1={},_0x378027={},_0x557adb={'count':0x0,'rows':[]};var _0xfebb5f=_[_0x238d('0x2c')](db[_0x238d('0x2d')][_0x238d('0x2e')],function(_0xe78901){return{'name':_0xe78901[_0x238d('0x2f')],'type':_0xe78901[_0x238d('0x30')][_0x238d('0x31')]};});_0x378027[_0x238d('0x32')]=_[_0x238d('0x2c')](_0xfebb5f,_0x238d('0x2a'));_0x378027[_0x238d('0x33')]=_[_0x238d('0x34')](_0x1ea0c1[_0x238d('0x33')]);_0x378027[_0x238d('0x35')]=_[_0x238d('0x36')](_0x378027[_0x238d('0x32')],_0x378027['query']);_0x3055a1['attributes']=_[_0x238d('0x36')](_0x378027['model'],qs['fields'](_0x1ea0c1[_0x238d('0x33')]['fields']));_0x3055a1[_0x238d('0x37')]=_0x3055a1[_0x238d('0x37')][_0x238d('0x38')]?_0x3055a1[_0x238d('0x37')]:_0x378027['model'];if(!_0x1ea0c1[_0x238d('0x33')][_0x238d('0x39')](_0x238d('0x3a'))){_0x3055a1['limit']=qs[_0x238d('0x3b')](_0x1ea0c1[_0x238d('0x33')]['limit']);_0x3055a1[_0x238d('0x1d')]=qs[_0x238d('0x1d')](_0x1ea0c1[_0x238d('0x33')][_0x238d('0x1d')]);}_0x3055a1[_0x238d('0x3c')]=qs[_0x238d('0x3d')](_0x1ea0c1['query']['sort']);_0x3055a1[_0x238d('0x3e')]=qs[_0x238d('0x35')](_[_0x238d('0x3f')](_0x1ea0c1[_0x238d('0x33')],_0x378027['filters']));if(_0x1ea0c1[_0x238d('0x33')][_0x238d('0x40')]){_0x3055a1[_0x238d('0x3e')]=_[_0x238d('0x41')](_0x3055a1[_0x238d('0x3e')],{'$or':_['map'](_0xfebb5f,function(_0xf9383d){if(_0xf9383d[_0x238d('0x30')]!==_0x238d('0x42')){var _0x4d0551={};_0x4d0551[_0xf9383d[_0x238d('0x2a')]]={'$like':'%'+_0x1ea0c1[_0x238d('0x33')][_0x238d('0x40')]+'%'};return _0x4d0551;}})});}_0x3055a1=_['merge']({},_0x3055a1,_0x1ea0c1['options']);var _0x123355={'where':_0x3055a1[_0x238d('0x3e')]};return db[_0x238d('0x2d')]['count'](_0x123355)['then'](function(_0x2706be){_0x557adb['count']=_0x2706be;if(_0x1ea0c1[_0x238d('0x33')][_0x238d('0x43')]){_0x3055a1['include']=[{'all':!![]}];}return db['Trigger'][_0x238d('0x44')](_0x3055a1);})[_0x238d('0x24')](function(_0x3ac74a){_0x557adb['rows']=_0x3ac74a;return _0x557adb;})['then'](respondWithFilteredResult(_0x446fd0,_0x3055a1))[_0x238d('0x45')](handleError(_0x446fd0,null));};exports[_0x238d('0x46')]=function(_0x533c8c,_0x247fdd){var _0x3827c4={'raw':![],'where':{'id':_0x533c8c[_0x238d('0x47')]['id']}},_0x479364={};_0x479364[_0x238d('0x32')]=_[_0x238d('0x34')](db[_0x238d('0x2d')][_0x238d('0x2e')]);_0x479364[_0x238d('0x33')]=_[_0x238d('0x34')](_0x533c8c[_0x238d('0x33')]);_0x479364[_0x238d('0x35')]=_[_0x238d('0x36')](_0x479364[_0x238d('0x32')],_0x479364[_0x238d('0x33')]);_0x3827c4[_0x238d('0x37')]=_['intersection'](_0x479364['model'],qs['fields'](_0x533c8c['query']['fields']));_0x3827c4[_0x238d('0x37')]=_0x3827c4['attributes']['length']?_0x3827c4[_0x238d('0x37')]:_0x479364['model'];if(_0x533c8c[_0x238d('0x33')][_0x238d('0x43')]){_0x3827c4[_0x238d('0x48')]=[{'all':!![]}];}_0x3827c4=_[_0x238d('0x41')]({},_0x3827c4,_0x533c8c[_0x238d('0x49')]);return db[_0x238d('0x2d')]['find'](_0x3827c4)[_0x238d('0x24')](handleEntityNotFound(_0x247fdd,null))[_0x238d('0x24')](respondWithResult(_0x247fdd,null))[_0x238d('0x45')](handleError(_0x247fdd,null));};exports['create']=function(_0xcc6405,_0x56d6ee){return db['Trigger'][_0x238d('0x4a')](_0xcc6405[_0x238d('0x4b')],{})[_0x238d('0x24')](function(_0x3ae3fa){var _0x3db780=_0xcc6405[_0x238d('0x4c')][_0x238d('0x25')]({'plain':!![]});if(!_0x3db780)throw new Error(_0x238d('0x4d'));if(_0x3db780['role']===_0x238d('0x4c')){var _0x1595fe=_0x3ae3fa[_0x238d('0x25')]({'plain':!![]});var _0x34d347=_0x238d('0x26');return db[_0x238d('0x4e')][_0x238d('0x4f')]({'where':{'name':_0x34d347,'userProfileId':_0x3db780[_0x238d('0x50')]},'raw':!![]})[_0x238d('0x24')](function(_0x2104c1){if(_0x2104c1&&_0x2104c1['autoAssociation']===0x0){return db[_0x238d('0x27')][_0x238d('0x4a')]({'name':_0x1595fe[_0x238d('0x2a')],'resourceId':_0x1595fe['id'],'type':_0x2104c1[_0x238d('0x2a')],'sectionId':_0x2104c1['id']},{})[_0x238d('0x24')](function(){return _0x3ae3fa;});}else{return _0x3ae3fa;}})['catch'](function(_0x7bacb8){logger[_0x238d('0x28')](_0x238d('0x51'),_0x7bacb8);throw _0x7bacb8;});}return _0x3ae3fa;})[_0x238d('0x24')](respondWithResult(_0x56d6ee,0xc9))[_0x238d('0x45')](handleError(_0x56d6ee,null));};exports['update']=function(_0x4b1858,_0x1c3033){if(_0x4b1858['body']['id']){delete _0x4b1858[_0x238d('0x4b')]['id'];}return db[_0x238d('0x2d')][_0x238d('0x4f')]({'where':{'id':_0x4b1858[_0x238d('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c3033,null))[_0x238d('0x24')](saveUpdates(_0x4b1858[_0x238d('0x4b')],null))[_0x238d('0x24')](respondWithResult(_0x1c3033,null))['catch'](handleError(_0x1c3033,null));};exports[_0x238d('0x23')]=function(_0x474396,_0x396901){return db[_0x238d('0x2d')][_0x238d('0x4f')]({'where':{'id':_0x474396[_0x238d('0x47')]['id']}})[_0x238d('0x24')](handleEntityNotFound(_0x396901,null))['then'](removeEntity(_0x396901,null))[_0x238d('0x45')](handleError(_0x396901,null));};exports['addAllCondition']=function(_0x3e89a4,_0xc38679,_0x85b5fe){if(_0x3e89a4[_0x238d('0x4b')]['id']){delete _0x3e89a4['body']['id'];}return db[_0x238d('0x2d')][_0x238d('0x4f')]({'where':{'id':_0x3e89a4[_0x238d('0x47')]['id']}})[_0x238d('0x24')](handleEntityNotFound(_0xc38679,null))[_0x238d('0x24')](function(_0x42960c){if(_0x42960c){_0x3e89a4[_0x238d('0x4b')][_0x238d('0x52')]=_0x42960c['id'];return db[_0x238d('0x53')][_0x238d('0x4a')](_0x3e89a4[_0x238d('0x4b')]);}})[_0x238d('0x24')](respondWithResult(_0xc38679,null))[_0x238d('0x45')](handleError(_0xc38679,null));};exports[_0x238d('0x54')]=function(_0x2182ce,_0xe72ff4,_0x59ec85){if(_0x2182ce[_0x238d('0x4b')]['id']){delete _0x2182ce['body']['id'];}return db[_0x238d('0x2d')][_0x238d('0x4f')]({'where':{'id':_0x2182ce[_0x238d('0x47')]['id']}})[_0x238d('0x24')](handleEntityNotFound(_0xe72ff4,null))[_0x238d('0x24')](function(_0xefcc55){if(_0xefcc55){_0x2182ce[_0x238d('0x4b')][_0x238d('0x55')]=_0xefcc55['id'];return db[_0x238d('0x53')][_0x238d('0x4a')](_0x2182ce[_0x238d('0x4b')]);}})[_0x238d('0x24')](respondWithResult(_0xe72ff4,null))[_0x238d('0x45')](handleError(_0xe72ff4,null));};exports['getAllConditions']=function(_0x3461a5,_0x3ea7ab,_0x449e63){var _0x207296={};var _0x8ad424={};var _0x44803d;var _0x23c56c;return db[_0x238d('0x2d')][_0x238d('0x56')]({'where':{'id':_0x3461a5['params']['id']}})[_0x238d('0x24')](handleEntityNotFound(_0x3ea7ab,null))['then'](function(_0x13bd05){if(_0x13bd05){_0x44803d=_0x13bd05;_0x8ad424[_0x238d('0x32')]=_[_0x238d('0x34')](db[_0x238d('0x53')][_0x238d('0x2e')]);_0x8ad424['query']=_[_0x238d('0x34')](_0x3461a5[_0x238d('0x33')]);_0x8ad424[_0x238d('0x35')]=_[_0x238d('0x36')](_0x8ad424[_0x238d('0x32')],_0x8ad424[_0x238d('0x33')]);_0x207296[_0x238d('0x37')]=_['intersection'](_0x8ad424[_0x238d('0x32')],qs[_0x238d('0x57')](_0x3461a5['query']['fields']));_0x207296['attributes']=_0x207296[_0x238d('0x37')]['length']?_0x207296[_0x238d('0x37')]:_0x8ad424[_0x238d('0x32')];_0x207296['order']=qs[_0x238d('0x3d')](_0x3461a5[_0x238d('0x33')][_0x238d('0x3d')]);_0x207296[_0x238d('0x3e')]=qs[_0x238d('0x35')](_[_0x238d('0x3f')](_0x3461a5[_0x238d('0x33')],_0x8ad424['filters']));if(_0x3461a5[_0x238d('0x33')]['filter']){_0x207296[_0x238d('0x3e')]=_[_0x238d('0x41')](_0x207296[_0x238d('0x3e')],{'$or':_[_0x238d('0x2c')](_0x207296[_0x238d('0x37')],function(_0x19f36e){var _0x26ee49={};_0x26ee49[_0x19f36e]={'$like':'%'+_0x3461a5[_0x238d('0x33')]['filter']+'%'};return _0x26ee49;})});}_0x207296=_[_0x238d('0x41')]({},_0x207296,_0x3461a5[_0x238d('0x49')]);return _0x44803d['getAllConditions'](_0x207296);}})[_0x238d('0x24')](function(_0x24459e){if(_0x24459e){_0x23c56c=_0x24459e[_0x238d('0x38')];if(!_0x3461a5[_0x238d('0x33')]['hasOwnProperty'](_0x238d('0x3a'))){_0x207296[_0x238d('0x3b')]=qs['limit'](_0x3461a5['query'][_0x238d('0x3b')]);_0x207296[_0x238d('0x1d')]=qs[_0x238d('0x1d')](_0x3461a5[_0x238d('0x33')][_0x238d('0x1d')]);}return _0x44803d[_0x238d('0x58')](_0x207296);}})[_0x238d('0x24')](function(_0x4b9603){if(_0x4b9603){return _0x4b9603?{'count':_0x23c56c,'rows':_0x4b9603}:null;}})[_0x238d('0x24')](respondWithResult(_0x3ea7ab,null))[_0x238d('0x45')](handleError(_0x3ea7ab,null));};exports['getAnyConditions']=function(_0x3e7efb,_0x3a2d51,_0x39dd02){var _0xf44f0e={};var _0x177ebc={};var _0x387364;var _0x5a61ca;return db[_0x238d('0x2d')][_0x238d('0x56')]({'where':{'id':_0x3e7efb['params']['id']}})[_0x238d('0x24')](handleEntityNotFound(_0x3a2d51,null))[_0x238d('0x24')](function(_0x34bf36){if(_0x34bf36){_0x387364=_0x34bf36;_0x177ebc['model']=_[_0x238d('0x34')](db[_0x238d('0x53')][_0x238d('0x2e')]);_0x177ebc['query']=_[_0x238d('0x34')](_0x3e7efb['query']);_0x177ebc[_0x238d('0x35')]=_[_0x238d('0x36')](_0x177ebc[_0x238d('0x32')],_0x177ebc[_0x238d('0x33')]);_0xf44f0e[_0x238d('0x37')]=_[_0x238d('0x36')](_0x177ebc[_0x238d('0x32')],qs[_0x238d('0x57')](_0x3e7efb['query'][_0x238d('0x57')]));_0xf44f0e['attributes']=_0xf44f0e[_0x238d('0x37')][_0x238d('0x38')]?_0xf44f0e['attributes']:_0x177ebc[_0x238d('0x32')];_0xf44f0e['order']=qs[_0x238d('0x3d')](_0x3e7efb[_0x238d('0x33')][_0x238d('0x3d')]);_0xf44f0e['where']=qs[_0x238d('0x35')](_[_0x238d('0x3f')](_0x3e7efb[_0x238d('0x33')],_0x177ebc[_0x238d('0x35')]));if(_0x3e7efb[_0x238d('0x33')]['filter']){_0xf44f0e[_0x238d('0x3e')]=_[_0x238d('0x41')](_0xf44f0e[_0x238d('0x3e')],{'$or':_[_0x238d('0x2c')](_0xf44f0e[_0x238d('0x37')],function(_0x5517d7){var _0x52175b={};_0x52175b[_0x5517d7]={'$like':'%'+_0x3e7efb[_0x238d('0x33')]['filter']+'%'};return _0x52175b;})});}_0xf44f0e=_[_0x238d('0x41')]({},_0xf44f0e,_0x3e7efb[_0x238d('0x49')]);return _0x387364[_0x238d('0x59')](_0xf44f0e);}})[_0x238d('0x24')](function(_0x1bcd8b){if(_0x1bcd8b){_0x5a61ca=_0x1bcd8b['length'];if(!_0x3e7efb[_0x238d('0x33')]['hasOwnProperty'](_0x238d('0x3a'))){_0xf44f0e[_0x238d('0x3b')]=qs[_0x238d('0x3b')](_0x3e7efb[_0x238d('0x33')][_0x238d('0x3b')]);_0xf44f0e[_0x238d('0x1d')]=qs['offset'](_0x3e7efb[_0x238d('0x33')][_0x238d('0x1d')]);}return _0x387364['getAnyConditions'](_0xf44f0e);}})[_0x238d('0x24')](function(_0x374a7c){if(_0x374a7c){return _0x374a7c?{'count':_0x5a61ca,'rows':_0x374a7c}:null;}})[_0x238d('0x24')](respondWithResult(_0x3a2d51,null))[_0x238d('0x45')](handleError(_0x3a2d51,null));};exports[_0x238d('0x5a')]=function(_0x43ddd4,_0x5d1885,_0x4884d1){if(_0x43ddd4[_0x238d('0x4b')]['id']){delete _0x43ddd4['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x43ddd4[_0x238d('0x47')]['id']}})[_0x238d('0x24')](handleEntityNotFound(_0x5d1885,null))[_0x238d('0x24')](function(_0x130bb2){if(_0x130bb2){_0x43ddd4[_0x238d('0x4b')][_0x238d('0x5b')]=_0x130bb2['id'];return db['Action'][_0x238d('0x4a')](_0x43ddd4[_0x238d('0x4b')]);}})['then'](respondWithResult(_0x5d1885,null))['catch'](handleError(_0x5d1885,null));};exports['getActions']=function(_0x22800a,_0x3a8d47,_0x5c3051){var _0x34e1cf={};var _0x585c4f={};var _0x3249d4;var _0x37d2ce;return db[_0x238d('0x2d')][_0x238d('0x56')]({'where':{'id':_0x22800a[_0x238d('0x47')]['id']}})[_0x238d('0x24')](handleEntityNotFound(_0x3a8d47,null))['then'](function(_0x2a080a){if(_0x2a080a){_0x3249d4=_0x2a080a;_0x585c4f[_0x238d('0x32')]=_[_0x238d('0x34')](db['Action']['rawAttributes']);_0x585c4f[_0x238d('0x33')]=_[_0x238d('0x34')](_0x22800a[_0x238d('0x33')]);_0x585c4f[_0x238d('0x35')]=_['intersection'](_0x585c4f[_0x238d('0x32')],_0x585c4f['query']);_0x34e1cf[_0x238d('0x37')]=_['intersection'](_0x585c4f['model'],qs[_0x238d('0x57')](_0x22800a[_0x238d('0x33')][_0x238d('0x57')]));_0x34e1cf[_0x238d('0x37')]=_0x34e1cf['attributes']['length']?_0x34e1cf[_0x238d('0x37')]:_0x585c4f[_0x238d('0x32')];_0x34e1cf[_0x238d('0x3c')]=qs['sort'](_0x22800a[_0x238d('0x33')][_0x238d('0x3d')]);_0x34e1cf[_0x238d('0x3e')]=qs[_0x238d('0x35')](_[_0x238d('0x3f')](_0x22800a[_0x238d('0x33')],_0x585c4f[_0x238d('0x35')]));if(_0x22800a[_0x238d('0x33')][_0x238d('0x40')]){_0x34e1cf[_0x238d('0x3e')]=_[_0x238d('0x41')](_0x34e1cf[_0x238d('0x3e')],{'$or':_[_0x238d('0x2c')](_0x34e1cf[_0x238d('0x37')],function(_0x3ff266){var _0x3464ff={};_0x3464ff[_0x3ff266]={'$like':'%'+_0x22800a[_0x238d('0x33')][_0x238d('0x40')]+'%'};return _0x3464ff;})});}_0x34e1cf=_['merge']({},_0x34e1cf,_0x22800a[_0x238d('0x49')]);return _0x3249d4['getActions'](_0x34e1cf);}})[_0x238d('0x24')](function(_0x42675b){if(_0x42675b){_0x37d2ce=_0x42675b['length'];if(!_0x22800a[_0x238d('0x33')][_0x238d('0x39')](_0x238d('0x3a'))){_0x34e1cf[_0x238d('0x3b')]=qs['limit'](_0x22800a[_0x238d('0x33')][_0x238d('0x3b')]);_0x34e1cf[_0x238d('0x1d')]=qs['offset'](_0x22800a[_0x238d('0x33')][_0x238d('0x1d')]);}return _0x3249d4[_0x238d('0x5c')](_0x34e1cf);}})['then'](function(_0x1d3c54){if(_0x1d3c54){return _0x1d3c54?{'count':_0x37d2ce,'rows':_0x1d3c54}:null;}})[_0x238d('0x24')](respondWithResult(_0x3a8d47,null))[_0x238d('0x45')](handleError(_0x3a8d47,null));}; \ No newline at end of file +var _0x8e61=['squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','then','destroy','get','Triggers','error','stack','name','send','index','map','type','key','query','filters','intersection','model','attributes','fields','length','sort','pick','filter','merge','options','where','Trigger','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','order','hasOwnProperty','nolimit','getAllConditions','getAnyConditions','getActions','Action','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0x8e61,0x163));var _0x18e6=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x8e61[_0x24061a];return _0x82054e;};'use strict';var pdf=require(_0x18e6('0x0'));var emlformat=require(_0x18e6('0x1'));var rimraf=require(_0x18e6('0x2'));var zipdir=require(_0x18e6('0x3'));var jsonpatch=require(_0x18e6('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x18e6('0x5'));var Mustache=require(_0x18e6('0x6'));var util=require(_0x18e6('0x7'));var path=require(_0x18e6('0x8'));var sox=require(_0x18e6('0x9'));var csv=require(_0x18e6('0xa'));var ejs=require(_0x18e6('0xb'));var fs=require('fs');var _=require(_0x18e6('0xc'));var squel=require(_0x18e6('0xd'));var crypto=require(_0x18e6('0xe'));var jsforce=require(_0x18e6('0xf'));var deskjs=require(_0x18e6('0x10'));var toCsv=require(_0x18e6('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x18e6('0x11'));var authService=require(_0x18e6('0x12'));var qs=require(_0x18e6('0x13'));var as=require(_0x18e6('0x14'));var hardwareService=require(_0x18e6('0x15'));var logger=require('../../config/logger')(_0x18e6('0x16'));var utils=require('../../config/utils');var config=require(_0x18e6('0x17'));var db=require(_0x18e6('0x18'))['db'];function respondWithStatusCode(_0x8dd62,_0x29ac6b){_0x29ac6b=_0x29ac6b||0xcc;return function(_0x5a75f1){if(_0x5a75f1){return _0x8dd62[_0x18e6('0x19')](_0x29ac6b);}return _0x8dd62[_0x18e6('0x1a')](_0x29ac6b)[_0x18e6('0x1b')]();};}function respondWithResult(_0x1d09e7,_0x2f24f2){_0x2f24f2=_0x2f24f2||0xc8;return function(_0x46b6a1){if(_0x46b6a1){return _0x1d09e7[_0x18e6('0x1a')](_0x2f24f2)[_0x18e6('0x1c')](_0x46b6a1);}};}function respondWithFilteredResult(_0x42b02e,_0x1ea9e4){return function(_0x1aa03e){if(_0x1aa03e){var _0x730dc9=_0x1aa03e[_0x18e6('0x1d')],_0x2a7e0d=_0x1ea9e4['offset'],_0x2ba3e6=_0x1ea9e4[_0x18e6('0x1e')]+_0x1ea9e4[_0x18e6('0x1f')],_0x253ac7;if(_0x2ba3e6>=_0x730dc9){_0x2ba3e6=_0x730dc9;_0x253ac7=0xc8;}else{_0x253ac7=0xce;}_0x42b02e[_0x18e6('0x1a')](_0x253ac7);return _0x42b02e[_0x18e6('0x20')](_0x18e6('0x21'),_0x2a7e0d+'-'+_0x2ba3e6+'/'+_0x730dc9)[_0x18e6('0x1c')](_0x1aa03e);}return null;};}function patchUpdates(_0x4784bc){return function(_0x5e64d8){try{jsonpatch['apply'](_0x5e64d8,_0x4784bc,!![]);}catch(_0x298d06){return BPromise['reject'](_0x298d06);}return _0x5e64d8['save']();};}function saveUpdates(_0x468506,_0x4c756a){return function(_0x3a88ec){if(_0x3a88ec){return _0x3a88ec[_0x18e6('0x22')](_0x468506)[_0x18e6('0x23')](function(_0x36d033){return _0x36d033;});}return null;};}function removeEntity(_0x47ea78,_0x5449e3){return function(_0x12ea33){if(_0x12ea33){return _0x12ea33[_0x18e6('0x24')]()[_0x18e6('0x23')](function(){var _0x50e86b=_0x12ea33[_0x18e6('0x25')]({'plain':!![]});var _0x52f753=_0x18e6('0x26');return db['UserProfileResource'][_0x18e6('0x24')]({'where':{'type':_0x52f753,'resourceId':_0x50e86b['id']}})['then'](function(){return _0x12ea33;});})[_0x18e6('0x23')](function(){_0x47ea78[_0x18e6('0x1a')](0xcc)[_0x18e6('0x1b')]();});}};}function handleEntityNotFound(_0x49d5be,_0x18801b){return function(_0x32b1c1){if(!_0x32b1c1){_0x49d5be[_0x18e6('0x19')](0x194);}return _0x32b1c1;};}function handleError(_0x1571e0,_0x58a24c){_0x58a24c=_0x58a24c||0x1f4;return function(_0x5b609d){logger[_0x18e6('0x27')](_0x5b609d[_0x18e6('0x28')]);if(_0x5b609d[_0x18e6('0x29')]){delete _0x5b609d[_0x18e6('0x29')];}_0x1571e0['status'](_0x58a24c)[_0x18e6('0x2a')](_0x5b609d);};}exports[_0x18e6('0x2b')]=function(_0x2b9530,_0x186761){var _0x3111f3={},_0x2245c5={},_0x30c07d={'count':0x0,'rows':[]};var _0x1936b3=_[_0x18e6('0x2c')](db['Trigger']['rawAttributes'],function(_0x2871a2){return{'name':_0x2871a2['fieldName'],'type':_0x2871a2[_0x18e6('0x2d')][_0x18e6('0x2e')]};});_0x2245c5['model']=_[_0x18e6('0x2c')](_0x1936b3,_0x18e6('0x29'));_0x2245c5[_0x18e6('0x2f')]=_['keys'](_0x2b9530[_0x18e6('0x2f')]);_0x2245c5[_0x18e6('0x30')]=_[_0x18e6('0x31')](_0x2245c5[_0x18e6('0x32')],_0x2245c5[_0x18e6('0x2f')]);_0x3111f3[_0x18e6('0x33')]=_['intersection'](_0x2245c5[_0x18e6('0x32')],qs[_0x18e6('0x34')](_0x2b9530['query']['fields']));_0x3111f3[_0x18e6('0x33')]=_0x3111f3[_0x18e6('0x33')][_0x18e6('0x35')]?_0x3111f3[_0x18e6('0x33')]:_0x2245c5[_0x18e6('0x32')];if(!_0x2b9530['query']['hasOwnProperty']('nolimit')){_0x3111f3[_0x18e6('0x1f')]=qs[_0x18e6('0x1f')](_0x2b9530[_0x18e6('0x2f')][_0x18e6('0x1f')]);_0x3111f3['offset']=qs[_0x18e6('0x1e')](_0x2b9530[_0x18e6('0x2f')][_0x18e6('0x1e')]);}_0x3111f3['order']=qs[_0x18e6('0x36')](_0x2b9530[_0x18e6('0x2f')][_0x18e6('0x36')]);_0x3111f3['where']=qs[_0x18e6('0x30')](_[_0x18e6('0x37')](_0x2b9530[_0x18e6('0x2f')],_0x2245c5[_0x18e6('0x30')]));if(_0x2b9530['query'][_0x18e6('0x38')]){_0x3111f3['where']=_[_0x18e6('0x39')](_0x3111f3['where'],{'$or':_[_0x18e6('0x2c')](_0x1936b3,function(_0x11b030){if(_0x11b030[_0x18e6('0x2d')]!=='VIRTUAL'){var _0x598119={};_0x598119[_0x11b030[_0x18e6('0x29')]]={'$like':'%'+_0x2b9530[_0x18e6('0x2f')]['filter']+'%'};return _0x598119;}})});}_0x3111f3=_['merge']({},_0x3111f3,_0x2b9530[_0x18e6('0x3a')]);var _0x515f75={'where':_0x3111f3[_0x18e6('0x3b')]};return db[_0x18e6('0x3c')][_0x18e6('0x1d')](_0x515f75)[_0x18e6('0x23')](function(_0x5a64a3){_0x30c07d[_0x18e6('0x1d')]=_0x5a64a3;if(_0x2b9530[_0x18e6('0x2f')][_0x18e6('0x3d')]){_0x3111f3[_0x18e6('0x3e')]=[{'all':!![]}];}return db[_0x18e6('0x3c')][_0x18e6('0x3f')](_0x3111f3);})['then'](function(_0x301e9d){_0x30c07d[_0x18e6('0x40')]=_0x301e9d;return _0x30c07d;})[_0x18e6('0x23')](respondWithFilteredResult(_0x186761,_0x3111f3))[_0x18e6('0x41')](handleError(_0x186761,null));};exports[_0x18e6('0x42')]=function(_0x43ad22,_0xedf9b6){var _0x150cca={'raw':![],'where':{'id':_0x43ad22[_0x18e6('0x43')]['id']}},_0x323cc1={};_0x323cc1[_0x18e6('0x32')]=_[_0x18e6('0x44')](db[_0x18e6('0x3c')][_0x18e6('0x45')]);_0x323cc1[_0x18e6('0x2f')]=_[_0x18e6('0x44')](_0x43ad22[_0x18e6('0x2f')]);_0x323cc1[_0x18e6('0x30')]=_[_0x18e6('0x31')](_0x323cc1['model'],_0x323cc1[_0x18e6('0x2f')]);_0x150cca[_0x18e6('0x33')]=_[_0x18e6('0x31')](_0x323cc1['model'],qs[_0x18e6('0x34')](_0x43ad22[_0x18e6('0x2f')][_0x18e6('0x34')]));_0x150cca[_0x18e6('0x33')]=_0x150cca[_0x18e6('0x33')][_0x18e6('0x35')]?_0x150cca[_0x18e6('0x33')]:_0x323cc1[_0x18e6('0x32')];if(_0x43ad22[_0x18e6('0x2f')][_0x18e6('0x3d')]){_0x150cca[_0x18e6('0x3e')]=[{'all':!![]}];}_0x150cca=_['merge']({},_0x150cca,_0x43ad22[_0x18e6('0x3a')]);return db['Trigger'][_0x18e6('0x46')](_0x150cca)[_0x18e6('0x23')](handleEntityNotFound(_0xedf9b6,null))[_0x18e6('0x23')](respondWithResult(_0xedf9b6,null))['catch'](handleError(_0xedf9b6,null));};exports[_0x18e6('0x47')]=function(_0x250438,_0x3becf4){return db[_0x18e6('0x3c')][_0x18e6('0x47')](_0x250438['body'],{})['then'](function(_0x3dd299){var _0x733826=_0x250438['user']['get']({'plain':!![]});if(!_0x733826)throw new Error(_0x18e6('0x48'));if(_0x733826[_0x18e6('0x49')]===_0x18e6('0x4a')){var _0x129fb8=_0x3dd299[_0x18e6('0x25')]({'plain':!![]});var _0x38e6a7=_0x18e6('0x26');return db['UserProfileSection'][_0x18e6('0x46')]({'where':{'name':_0x38e6a7,'userProfileId':_0x733826[_0x18e6('0x4b')]},'raw':!![]})[_0x18e6('0x23')](function(_0x18c0f5){if(_0x18c0f5&&_0x18c0f5[_0x18e6('0x4c')]===0x0){return db[_0x18e6('0x4d')][_0x18e6('0x47')]({'name':_0x129fb8[_0x18e6('0x29')],'resourceId':_0x129fb8['id'],'type':_0x18c0f5[_0x18e6('0x29')],'sectionId':_0x18c0f5['id']},{})['then'](function(){return _0x3dd299;});}else{return _0x3dd299;}})[_0x18e6('0x41')](function(_0x3e8d41){logger[_0x18e6('0x27')](_0x18e6('0x4e'),_0x3e8d41);throw _0x3e8d41;});}return _0x3dd299;})[_0x18e6('0x23')](respondWithResult(_0x3becf4,0xc9))[_0x18e6('0x41')](handleError(_0x3becf4,null));};exports[_0x18e6('0x22')]=function(_0x54eaa3,_0xd4bc05){if(_0x54eaa3[_0x18e6('0x4f')]['id']){delete _0x54eaa3[_0x18e6('0x4f')]['id'];}return db[_0x18e6('0x3c')][_0x18e6('0x46')]({'where':{'id':_0x54eaa3[_0x18e6('0x43')]['id']}})[_0x18e6('0x23')](handleEntityNotFound(_0xd4bc05,null))['then'](saveUpdates(_0x54eaa3[_0x18e6('0x4f')],null))[_0x18e6('0x23')](respondWithResult(_0xd4bc05,null))[_0x18e6('0x41')](handleError(_0xd4bc05,null));};exports[_0x18e6('0x24')]=function(_0x3d3fa9,_0x3f9557){return db[_0x18e6('0x3c')][_0x18e6('0x46')]({'where':{'id':_0x3d3fa9[_0x18e6('0x43')]['id']}})[_0x18e6('0x23')](handleEntityNotFound(_0x3f9557,null))['then'](removeEntity(_0x3f9557,null))['catch'](handleError(_0x3f9557,null));};exports['addAllCondition']=function(_0x59c174,_0x32b77a,_0x140ede){if(_0x59c174['body']['id']){delete _0x59c174[_0x18e6('0x4f')]['id'];}return db[_0x18e6('0x3c')][_0x18e6('0x46')]({'where':{'id':_0x59c174['params']['id']}})[_0x18e6('0x23')](handleEntityNotFound(_0x32b77a,null))['then'](function(_0x31abf9){if(_0x31abf9){_0x59c174['body'][_0x18e6('0x50')]=_0x31abf9['id'];return db[_0x18e6('0x51')][_0x18e6('0x47')](_0x59c174[_0x18e6('0x4f')]);}})[_0x18e6('0x23')](respondWithResult(_0x32b77a,null))[_0x18e6('0x41')](handleError(_0x32b77a,null));};exports[_0x18e6('0x52')]=function(_0x2939e9,_0x3ab700,_0x22307e){if(_0x2939e9['body']['id']){delete _0x2939e9[_0x18e6('0x4f')]['id'];}return db['Trigger'][_0x18e6('0x46')]({'where':{'id':_0x2939e9[_0x18e6('0x43')]['id']}})[_0x18e6('0x23')](handleEntityNotFound(_0x3ab700,null))[_0x18e6('0x23')](function(_0x3c0d5c){if(_0x3c0d5c){_0x2939e9[_0x18e6('0x4f')][_0x18e6('0x53')]=_0x3c0d5c['id'];return db[_0x18e6('0x51')][_0x18e6('0x47')](_0x2939e9[_0x18e6('0x4f')]);}})[_0x18e6('0x23')](respondWithResult(_0x3ab700,null))['catch'](handleError(_0x3ab700,null));};exports['getAllConditions']=function(_0x563a64,_0x476cdc,_0x1d61fc){var _0x4601a9={};var _0x57dbab={};var _0x40d67e;var _0x572a12;return db[_0x18e6('0x3c')][_0x18e6('0x54')]({'where':{'id':_0x563a64[_0x18e6('0x43')]['id']}})[_0x18e6('0x23')](handleEntityNotFound(_0x476cdc,null))[_0x18e6('0x23')](function(_0x120a7f){if(_0x120a7f){_0x40d67e=_0x120a7f;_0x57dbab[_0x18e6('0x32')]=_[_0x18e6('0x44')](db[_0x18e6('0x51')][_0x18e6('0x45')]);_0x57dbab[_0x18e6('0x2f')]=_[_0x18e6('0x44')](_0x563a64[_0x18e6('0x2f')]);_0x57dbab[_0x18e6('0x30')]=_[_0x18e6('0x31')](_0x57dbab[_0x18e6('0x32')],_0x57dbab['query']);_0x4601a9['attributes']=_[_0x18e6('0x31')](_0x57dbab[_0x18e6('0x32')],qs[_0x18e6('0x34')](_0x563a64[_0x18e6('0x2f')][_0x18e6('0x34')]));_0x4601a9['attributes']=_0x4601a9[_0x18e6('0x33')]['length']?_0x4601a9[_0x18e6('0x33')]:_0x57dbab[_0x18e6('0x32')];_0x4601a9[_0x18e6('0x55')]=qs[_0x18e6('0x36')](_0x563a64[_0x18e6('0x2f')]['sort']);_0x4601a9[_0x18e6('0x3b')]=qs[_0x18e6('0x30')](_['pick'](_0x563a64[_0x18e6('0x2f')],_0x57dbab[_0x18e6('0x30')]));if(_0x563a64[_0x18e6('0x2f')][_0x18e6('0x38')]){_0x4601a9['where']=_[_0x18e6('0x39')](_0x4601a9[_0x18e6('0x3b')],{'$or':_['map'](_0x4601a9[_0x18e6('0x33')],function(_0x2adae0){var _0xd99c05={};_0xd99c05[_0x2adae0]={'$like':'%'+_0x563a64[_0x18e6('0x2f')][_0x18e6('0x38')]+'%'};return _0xd99c05;})});}_0x4601a9=_[_0x18e6('0x39')]({},_0x4601a9,_0x563a64[_0x18e6('0x3a')]);return _0x40d67e['getAllConditions'](_0x4601a9);}})[_0x18e6('0x23')](function(_0x3cb362){if(_0x3cb362){_0x572a12=_0x3cb362[_0x18e6('0x35')];if(!_0x563a64[_0x18e6('0x2f')][_0x18e6('0x56')](_0x18e6('0x57'))){_0x4601a9[_0x18e6('0x1f')]=qs[_0x18e6('0x1f')](_0x563a64[_0x18e6('0x2f')][_0x18e6('0x1f')]);_0x4601a9[_0x18e6('0x1e')]=qs[_0x18e6('0x1e')](_0x563a64[_0x18e6('0x2f')]['offset']);}return _0x40d67e[_0x18e6('0x58')](_0x4601a9);}})[_0x18e6('0x23')](function(_0x3bcaa8){if(_0x3bcaa8){return _0x3bcaa8?{'count':_0x572a12,'rows':_0x3bcaa8}:null;}})[_0x18e6('0x23')](respondWithResult(_0x476cdc,null))[_0x18e6('0x41')](handleError(_0x476cdc,null));};exports[_0x18e6('0x59')]=function(_0x144b70,_0x3f05f5,_0x5d993d){var _0x3879d9={};var _0x598868={};var _0x1bfaef;var _0x1d5d7c;return db['Trigger'][_0x18e6('0x54')]({'where':{'id':_0x144b70[_0x18e6('0x43')]['id']}})[_0x18e6('0x23')](handleEntityNotFound(_0x3f05f5,null))[_0x18e6('0x23')](function(_0x11bd6f){if(_0x11bd6f){_0x1bfaef=_0x11bd6f;_0x598868['model']=_[_0x18e6('0x44')](db[_0x18e6('0x51')][_0x18e6('0x45')]);_0x598868[_0x18e6('0x2f')]=_[_0x18e6('0x44')](_0x144b70[_0x18e6('0x2f')]);_0x598868[_0x18e6('0x30')]=_[_0x18e6('0x31')](_0x598868[_0x18e6('0x32')],_0x598868['query']);_0x3879d9[_0x18e6('0x33')]=_[_0x18e6('0x31')](_0x598868[_0x18e6('0x32')],qs[_0x18e6('0x34')](_0x144b70[_0x18e6('0x2f')][_0x18e6('0x34')]));_0x3879d9[_0x18e6('0x33')]=_0x3879d9['attributes'][_0x18e6('0x35')]?_0x3879d9[_0x18e6('0x33')]:_0x598868[_0x18e6('0x32')];_0x3879d9[_0x18e6('0x55')]=qs[_0x18e6('0x36')](_0x144b70['query'][_0x18e6('0x36')]);_0x3879d9[_0x18e6('0x3b')]=qs[_0x18e6('0x30')](_[_0x18e6('0x37')](_0x144b70[_0x18e6('0x2f')],_0x598868[_0x18e6('0x30')]));if(_0x144b70[_0x18e6('0x2f')][_0x18e6('0x38')]){_0x3879d9[_0x18e6('0x3b')]=_['merge'](_0x3879d9[_0x18e6('0x3b')],{'$or':_[_0x18e6('0x2c')](_0x3879d9[_0x18e6('0x33')],function(_0x3819f6){var _0x39649d={};_0x39649d[_0x3819f6]={'$like':'%'+_0x144b70[_0x18e6('0x2f')]['filter']+'%'};return _0x39649d;})});}_0x3879d9=_[_0x18e6('0x39')]({},_0x3879d9,_0x144b70[_0x18e6('0x3a')]);return _0x1bfaef[_0x18e6('0x59')](_0x3879d9);}})[_0x18e6('0x23')](function(_0x21ddca){if(_0x21ddca){_0x1d5d7c=_0x21ddca[_0x18e6('0x35')];if(!_0x144b70[_0x18e6('0x2f')][_0x18e6('0x56')](_0x18e6('0x57'))){_0x3879d9['limit']=qs[_0x18e6('0x1f')](_0x144b70[_0x18e6('0x2f')][_0x18e6('0x1f')]);_0x3879d9[_0x18e6('0x1e')]=qs['offset'](_0x144b70[_0x18e6('0x2f')][_0x18e6('0x1e')]);}return _0x1bfaef[_0x18e6('0x59')](_0x3879d9);}})[_0x18e6('0x23')](function(_0x828689){if(_0x828689){return _0x828689?{'count':_0x1d5d7c,'rows':_0x828689}:null;}})[_0x18e6('0x23')](respondWithResult(_0x3f05f5,null))[_0x18e6('0x41')](handleError(_0x3f05f5,null));};exports['addAction']=function(_0x1571cc,_0x503df3,_0x14dd83){if(_0x1571cc[_0x18e6('0x4f')]['id']){delete _0x1571cc[_0x18e6('0x4f')]['id'];}return db['Trigger'][_0x18e6('0x46')]({'where':{'id':_0x1571cc[_0x18e6('0x43')]['id']}})[_0x18e6('0x23')](handleEntityNotFound(_0x503df3,null))['then'](function(_0x25caca){if(_0x25caca){_0x1571cc[_0x18e6('0x4f')]['TriggerId']=_0x25caca['id'];return db['Action'][_0x18e6('0x47')](_0x1571cc[_0x18e6('0x4f')]);}})[_0x18e6('0x23')](respondWithResult(_0x503df3,null))[_0x18e6('0x41')](handleError(_0x503df3,null));};exports[_0x18e6('0x5a')]=function(_0x5b39c6,_0x10971f,_0x5f35ed){var _0x4c1e30={};var _0x42da60={};var _0x38ae10;var _0x2f439c;return db['Trigger'][_0x18e6('0x54')]({'where':{'id':_0x5b39c6['params']['id']}})[_0x18e6('0x23')](handleEntityNotFound(_0x10971f,null))[_0x18e6('0x23')](function(_0x4416f9){if(_0x4416f9){_0x38ae10=_0x4416f9;_0x42da60['model']=_['keys'](db[_0x18e6('0x5b')][_0x18e6('0x45')]);_0x42da60[_0x18e6('0x2f')]=_['keys'](_0x5b39c6[_0x18e6('0x2f')]);_0x42da60['filters']=_[_0x18e6('0x31')](_0x42da60[_0x18e6('0x32')],_0x42da60[_0x18e6('0x2f')]);_0x4c1e30[_0x18e6('0x33')]=_[_0x18e6('0x31')](_0x42da60[_0x18e6('0x32')],qs['fields'](_0x5b39c6[_0x18e6('0x2f')]['fields']));_0x4c1e30[_0x18e6('0x33')]=_0x4c1e30[_0x18e6('0x33')][_0x18e6('0x35')]?_0x4c1e30[_0x18e6('0x33')]:_0x42da60['model'];_0x4c1e30['order']=qs[_0x18e6('0x36')](_0x5b39c6[_0x18e6('0x2f')][_0x18e6('0x36')]);_0x4c1e30[_0x18e6('0x3b')]=qs[_0x18e6('0x30')](_[_0x18e6('0x37')](_0x5b39c6[_0x18e6('0x2f')],_0x42da60[_0x18e6('0x30')]));if(_0x5b39c6['query'][_0x18e6('0x38')]){_0x4c1e30[_0x18e6('0x3b')]=_[_0x18e6('0x39')](_0x4c1e30[_0x18e6('0x3b')],{'$or':_['map'](_0x4c1e30[_0x18e6('0x33')],function(_0x480942){var _0x2d064={};_0x2d064[_0x480942]={'$like':'%'+_0x5b39c6['query'][_0x18e6('0x38')]+'%'};return _0x2d064;})});}_0x4c1e30=_[_0x18e6('0x39')]({},_0x4c1e30,_0x5b39c6[_0x18e6('0x3a')]);return _0x38ae10['getActions'](_0x4c1e30);}})[_0x18e6('0x23')](function(_0x4f6d46){if(_0x4f6d46){_0x2f439c=_0x4f6d46[_0x18e6('0x35')];if(!_0x5b39c6['query'][_0x18e6('0x56')]('nolimit')){_0x4c1e30[_0x18e6('0x1f')]=qs[_0x18e6('0x1f')](_0x5b39c6['query']['limit']);_0x4c1e30['offset']=qs['offset'](_0x5b39c6['query'][_0x18e6('0x1e')]);}return _0x38ae10[_0x18e6('0x5a')](_0x4c1e30);}})[_0x18e6('0x23')](function(_0x22aff4){if(_0x22aff4){return _0x22aff4?{'count':_0x2f439c,'rows':_0x22aff4}:null;}})['then'](respondWithResult(_0x10971f,null))[_0x18e6('0x41')](handleError(_0x10971f,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 0aa2209..0ec8001 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 _0xbdc9=['tools_triggers','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger'];(function(_0x29d2d2,_0x3344){var _0x3f6476=function(_0x29c2a2){while(--_0x29c2a2){_0x29d2d2['push'](_0x29d2d2['shift']());}};_0x3f6476(++_0x3344);}(_0xbdc9,0xf1));var _0x9bdc=function(_0x4ed9d6,_0x53a195){_0x4ed9d6=_0x4ed9d6-0x0;var _0x410ee8=_0xbdc9[_0x4ed9d6];return _0x410ee8;};'use strict';var _=require('lodash');var util=require(_0x9bdc('0x0'));var logger=require(_0x9bdc('0x1'))('api');var moment=require(_0x9bdc('0x2'));var BPromise=require('bluebird');var rp=require(_0x9bdc('0x3'));var fs=require('fs');var path=require(_0x9bdc('0x4'));var rimraf=require(_0x9bdc('0x5'));var config=require(_0x9bdc('0x6'));var attributes=require(_0x9bdc('0x7'));module[_0x9bdc('0x8')]=function(_0x338c1b,_0x5d5fbc){return _0x338c1b[_0x9bdc('0x9')](_0x9bdc('0xa'),attributes,{'tableName':_0x9bdc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x166c=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0x166c,0xe4));var _0xc166=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x166c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc166('0x0'));var util=require(_0xc166('0x1'));var logger=require('../../config/logger')(_0xc166('0x2'));var moment=require(_0xc166('0x3'));var BPromise=require(_0xc166('0x4'));var rp=require(_0xc166('0x5'));var fs=require('fs');var path=require(_0xc166('0x6'));var rimraf=require(_0xc166('0x7'));var config=require(_0xc166('0x8'));var attributes=require(_0xc166('0x9'));module[_0xc166('0xa')]=function(_0x3bb6dd,_0x248427){return _0x3bb6dd[_0xc166('0xb')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 779f2a5..ea0cc01 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 _0x1339=['stringify','error','code','message','result','catch','Trigger','findAll','options','attributes','map','include','model','GetTrigger','debug','raw','ShowTrigger','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s'];(function(_0x2b716b,_0x9001ae){var _0x4b4499=function(_0x3faaea){while(--_0x3faaea){_0x2b716b['push'](_0x2b716b['shift']());}};_0x4b4499(++_0x9001ae);}(_0x1339,0x1ed));var _0x9133=function(_0x1b7f1e,_0x2d0601){_0x1b7f1e=_0x1b7f1e-0x0;var _0x530192=_0x1339[_0x1b7f1e];return _0x530192;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9133('0x0'));var BPromise=require(_0x9133('0x1'));var rs=require(_0x9133('0x2'));var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require(_0x9133('0x4'))['db'];var utils=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var config=require('../../config/environment');var jayson=require(_0x9133('0x8'));var client=jayson[_0x9133('0x9')][_0x9133('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539af6,_0x2758e2,_0x334dcd){return new BPromise(function(_0x3059c4,_0x431a55){return client[_0x9133('0xb')](_0x539af6,_0x334dcd)[_0x9133('0xc')](function(_0x4294b7){logger[_0x9133('0xd')](_0x9133('0xe'),_0x2758e2,_0x9133('0xf'));logger['debug'](_0x9133('0x10'),_0x2758e2,_0x9133('0xf'),JSON[_0x9133('0x11')](_0x4294b7));if(_0x4294b7[_0x9133('0x12')]){if(_0x4294b7[_0x9133('0x12')][_0x9133('0x13')]===0x1f4){logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')]['message']);return _0x431a55(_0x4294b7['error'][_0x9133('0x14')]);}logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);return _0x3059c4(_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);}else{logger[_0x9133('0xd')]('Trigger,\x20%s,\x20%s',_0x2758e2,_0x9133('0xf'));_0x3059c4(_0x4294b7[_0x9133('0x15')]['message']);}})[_0x9133('0x16')](function(_0xa46eb1){logger[_0x9133('0x12')](_0x9133('0xe'),_0x2758e2,_0xa46eb1);_0x431a55(_0xa46eb1);});});}exports['GetTrigger']=function(_0x1f3484){var _0x573998=this;return new Promise(function(_0x3c48ef,_0x5d4a77){return db[_0x9133('0x17')][_0x9133('0x18')]({'raw':_0x1f3484['options']?_0x1f3484[_0x9133('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1f3484[_0x9133('0x19')]?_0x1f3484['options']['where']||null:null,'attributes':_0x1f3484[_0x9133('0x19')]?_0x1f3484['options'][_0x9133('0x1a')]||null:null,'limit':_0x1f3484['options']?_0x1f3484['options']['limit']||null:null,'include':_0x1f3484[_0x9133('0x19')]?_0x1f3484[_0x9133('0x19')]['include']?_[_0x9133('0x1b')](_0x1f3484[_0x9133('0x19')][_0x9133('0x1c')],function(_0x26190c){return{'model':db[_0x26190c['model']],'as':_0x26190c['as'],'attributes':_0x26190c[_0x9133('0x1a')],'include':_0x26190c['include']?_[_0x9133('0x1b')](_0x26190c[_0x9133('0x1c')],function(_0x3f278d){return{'model':db[_0x3f278d[_0x9133('0x1d')]],'as':_0x3f278d['as'],'attributes':_0x3f278d[_0x9133('0x1a')],'include':_0x3f278d[_0x9133('0x1c')]?_[_0x9133('0x1b')](_0x3f278d[_0x9133('0x1c')],function(_0x1b6b3e){return{'model':db[_0x1b6b3e[_0x9133('0x1d')]],'as':_0x1b6b3e['as'],'attributes':_0x1b6b3e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x477bf1){logger[_0x9133('0xd')](_0x9133('0x1e'),_0x1f3484);logger[_0x9133('0x1f')]('GetTrigger',_0x1f3484,JSON['stringify'](_0x477bf1));_0x3c48ef(_0x477bf1);})[_0x9133('0x16')](function(_0x45966d){logger[_0x9133('0x12')](_0x9133('0x1e'),_0x45966d[_0x9133('0x14')],_0x1f3484);_0x5d4a77(_0x573998[_0x9133('0x12')](0x1f4,_0x45966d['message']));});});};exports['ShowTrigger']=function(_0x5a27c1){var _0x1ad222=this;return new Promise(function(_0x4a4a8e,_0x43b5f3){return db[_0x9133('0x17')]['find']({'raw':_0x5a27c1[_0x9133('0x19')]?_0x5a27c1['options'][_0x9133('0x20')]===undefined?!![]:![]:!![],'where':_0x5a27c1[_0x9133('0x19')]?_0x5a27c1[_0x9133('0x19')]['where']||null:null,'attributes':_0x5a27c1[_0x9133('0x19')]?_0x5a27c1[_0x9133('0x19')][_0x9133('0x1a')]||null:null,'include':_0x5a27c1['options']?_0x5a27c1[_0x9133('0x19')][_0x9133('0x1c')]?_[_0x9133('0x1b')](_0x5a27c1['options'][_0x9133('0x1c')],function(_0x20da68){return{'model':db[_0x20da68[_0x9133('0x1d')]],'as':_0x20da68['as'],'attributes':_0x20da68[_0x9133('0x1a')],'include':_0x20da68['include']?_[_0x9133('0x1b')](_0x20da68[_0x9133('0x1c')],function(_0x56719e){return{'model':db[_0x56719e[_0x9133('0x1d')]],'as':_0x56719e['as'],'attributes':_0x56719e[_0x9133('0x1a')],'include':_0x56719e[_0x9133('0x1c')]?_[_0x9133('0x1b')](_0x56719e[_0x9133('0x1c')],function(_0x2db377){return{'model':db[_0x2db377[_0x9133('0x1d')]],'as':_0x2db377['as'],'attributes':_0x2db377[_0x9133('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9133('0xc')](function(_0x335217){logger[_0x9133('0xd')]('ShowTrigger',_0x5a27c1);logger[_0x9133('0x1f')](_0x9133('0x21'),_0x5a27c1,JSON['stringify'](_0x335217));_0x4a4a8e(_0x335217);})[_0x9133('0x16')](function(_0x3a2d1f){logger[_0x9133('0x12')](_0x9133('0x21'),_0x3a2d1f[_0x9133('0x14')],_0x5a27c1);_0x43b5f3(_0x1ad222[_0x9133('0x12')](0x1f4,_0x3a2d1f['message']));});});}; \ No newline at end of file +var _0xb574=['where','attributes','include','map','model','ShowTrigger','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetTrigger','Trigger','findAll','options','raw'];(function(_0x5c1345,_0x40116e){var _0x1c070d=function(_0x1e862f){while(--_0x1e862f){_0x5c1345['push'](_0x5c1345['shift']());}};_0x1c070d(++_0x40116e);}(_0xb574,0x106));var _0x4b57=function(_0x357042,_0x2de655){_0x357042=_0x357042-0x0;var _0x2f1072=_0xb574[_0x357042];return _0x2f1072;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var moment=require('moment');var BPromise=require(_0x4b57('0x2'));var rs=require(_0x4b57('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b57('0x4'))['db'];var utils=require(_0x4b57('0x5'));var logger=require(_0x4b57('0x6'))(_0x4b57('0x7'));var config=require(_0x4b57('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4b57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a4a0f,_0x585d86,_0x4b2d65){return new BPromise(function(_0x548ee8,_0x291e54){return client[_0x4b57('0xa')](_0x4a4a0f,_0x4b2d65)[_0x4b57('0xb')](function(_0x3b112d){logger[_0x4b57('0xc')](_0x4b57('0xd'),_0x585d86,_0x4b57('0xe'));logger[_0x4b57('0xf')]('Trigger,\x20%s,\x20%s,\x20%s',_0x585d86,_0x4b57('0xe'),JSON[_0x4b57('0x10')](_0x3b112d));if(_0x3b112d[_0x4b57('0x11')]){if(_0x3b112d['error']['code']===0x1f4){logger[_0x4b57('0x11')](_0x4b57('0xd'),_0x585d86,_0x3b112d[_0x4b57('0x11')][_0x4b57('0x12')]);return _0x291e54(_0x3b112d[_0x4b57('0x11')][_0x4b57('0x12')]);}logger[_0x4b57('0x11')](_0x4b57('0xd'),_0x585d86,_0x3b112d[_0x4b57('0x11')]['message']);return _0x548ee8(_0x3b112d['error'][_0x4b57('0x12')]);}else{logger[_0x4b57('0xc')](_0x4b57('0xd'),_0x585d86,'request\x20sent');_0x548ee8(_0x3b112d[_0x4b57('0x13')]['message']);}})[_0x4b57('0x14')](function(_0x42aff4){logger[_0x4b57('0x11')](_0x4b57('0xd'),_0x585d86,_0x42aff4);_0x291e54(_0x42aff4);});});}exports[_0x4b57('0x15')]=function(_0xfb71cc){var _0x4ede42=this;return new Promise(function(_0x1b35ff,_0x1a0b72){return db[_0x4b57('0x16')][_0x4b57('0x17')]({'raw':_0xfb71cc['options']?_0xfb71cc[_0x4b57('0x18')][_0x4b57('0x19')]===undefined?!![]:![]:!![],'where':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc[_0x4b57('0x18')][_0x4b57('0x1a')]||null:null,'attributes':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc['options'][_0x4b57('0x1b')]||null:null,'limit':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc[_0x4b57('0x18')]['limit']||null:null,'include':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc[_0x4b57('0x18')][_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0xfb71cc['options'][_0x4b57('0x1c')],function(_0x368c5f){return{'model':db[_0x368c5f['model']],'as':_0x368c5f['as'],'attributes':_0x368c5f[_0x4b57('0x1b')],'include':_0x368c5f[_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0x368c5f[_0x4b57('0x1c')],function(_0x540eff){return{'model':db[_0x540eff[_0x4b57('0x1e')]],'as':_0x540eff['as'],'attributes':_0x540eff['attributes'],'include':_0x540eff[_0x4b57('0x1c')]?_['map'](_0x540eff[_0x4b57('0x1c')],function(_0x2dc9d8){return{'model':db[_0x2dc9d8[_0x4b57('0x1e')]],'as':_0x2dc9d8['as'],'attributes':_0x2dc9d8[_0x4b57('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4b57('0xb')](function(_0x392e37){logger['info']('GetTrigger',_0xfb71cc);logger[_0x4b57('0xf')]('GetTrigger',_0xfb71cc,JSON[_0x4b57('0x10')](_0x392e37));_0x1b35ff(_0x392e37);})[_0x4b57('0x14')](function(_0x874cf7){logger[_0x4b57('0x11')](_0x4b57('0x15'),_0x874cf7[_0x4b57('0x12')],_0xfb71cc);_0x1a0b72(_0x4ede42['error'](0x1f4,_0x874cf7[_0x4b57('0x12')]));});});};exports[_0x4b57('0x1f')]=function(_0x68be27){var _0x3cd331=this;return new Promise(function(_0x4ccf89,_0xa91ba){return db[_0x4b57('0x16')]['find']({'raw':_0x68be27[_0x4b57('0x18')]?_0x68be27[_0x4b57('0x18')][_0x4b57('0x19')]===undefined?!![]:![]:!![],'where':_0x68be27[_0x4b57('0x18')]?_0x68be27['options']['where']||null:null,'attributes':_0x68be27['options']?_0x68be27[_0x4b57('0x18')][_0x4b57('0x1b')]||null:null,'include':_0x68be27[_0x4b57('0x18')]?_0x68be27[_0x4b57('0x18')][_0x4b57('0x1c')]?_['map'](_0x68be27[_0x4b57('0x18')][_0x4b57('0x1c')],function(_0x1fd3f7){return{'model':db[_0x1fd3f7['model']],'as':_0x1fd3f7['as'],'attributes':_0x1fd3f7[_0x4b57('0x1b')],'include':_0x1fd3f7[_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0x1fd3f7['include'],function(_0x28a0ee){return{'model':db[_0x28a0ee[_0x4b57('0x1e')]],'as':_0x28a0ee['as'],'attributes':_0x28a0ee['attributes'],'include':_0x28a0ee[_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0x28a0ee[_0x4b57('0x1c')],function(_0x91f32e){return{'model':db[_0x91f32e[_0x4b57('0x1e')]],'as':_0x91f32e['as'],'attributes':_0x91f32e[_0x4b57('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f9f76){logger[_0x4b57('0xc')](_0x4b57('0x1f'),_0x68be27);logger[_0x4b57('0xf')](_0x4b57('0x1f'),_0x68be27,JSON[_0x4b57('0x10')](_0x1f9f76));_0x4ccf89(_0x1f9f76);})[_0x4b57('0x14')](function(_0x4c5b82){logger['error'](_0x4b57('0x1f'),_0x4c5b82[_0x4b57('0x12')],_0x68be27);_0xa91ba(_0x3cd331[_0x4b57('0x11')](0x1f4,_0x4c5b82['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index df48cb9..51e963c 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 _0xee14=['index','/:id','isAuthenticated','show','post','/:id/clone','put','update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xee14,0x13a));var _0x4ee1=function(_0x3a8ac1,_0x176662){_0x3a8ac1=_0x3a8ac1-0x0;var _0x3bc52b=_0xee14[_0x3a8ac1];return _0x3bc52b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ee1('0x0'));var timeout=require(_0x4ee1('0x1'));var express=require(_0x4ee1('0x2'));var router=express[_0x4ee1('0x3')]();var auth=require(_0x4ee1('0x4'));var interaction=require(_0x4ee1('0x5'));var config=require(_0x4ee1('0x6'));var controller=require(_0x4ee1('0x7'));router[_0x4ee1('0x8')]('/',auth['isAuthenticated'](),controller[_0x4ee1('0x9')]);router['get'](_0x4ee1('0xa'),auth[_0x4ee1('0xb')](),controller[_0x4ee1('0xc')]);router[_0x4ee1('0xd')](_0x4ee1('0xe'),auth[_0x4ee1('0xb')](),controller['clone']);router[_0x4ee1('0xd')]('/',auth[_0x4ee1('0xb')](),controller['create']);router[_0x4ee1('0xf')](_0x4ee1('0xa'),auth[_0x4ee1('0xb')](),controller[_0x4ee1('0x10')]);router['delete'](_0x4ee1('0xa'),auth[_0x4ee1('0xb')](),controller[_0x4ee1('0x11')]);module[_0x4ee1('0x12')]=router; \ No newline at end of file +var _0x2d17=['destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./trunk.controller','isAuthenticated','get','/:id','show','post','/:id/clone','clone','put','update','delete'];(function(_0x27d149,_0x420a60){var _0x335c41=function(_0x73d523){while(--_0x73d523){_0x27d149['push'](_0x27d149['shift']());}};_0x335c41(++_0x420a60);}(_0x2d17,0x17e));var _0x72d1=function(_0x49b6a6,_0x163aba){_0x49b6a6=_0x49b6a6-0x0;var _0x14aa41=_0x2d17[_0x49b6a6];return _0x14aa41;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var auth=require(_0x72d1('0x4'));var interaction=require(_0x72d1('0x5'));var config=require('../../config/environment');var controller=require(_0x72d1('0x6'));router['get']('/',auth[_0x72d1('0x7')](),controller['index']);router[_0x72d1('0x8')](_0x72d1('0x9'),auth['isAuthenticated'](),controller[_0x72d1('0xa')]);router[_0x72d1('0xb')](_0x72d1('0xc'),auth['isAuthenticated'](),controller[_0x72d1('0xd')]);router[_0x72d1('0xb')]('/',auth[_0x72d1('0x7')](),controller['create']);router[_0x72d1('0xe')](_0x72d1('0x9'),auth[_0x72d1('0x7')](),controller[_0x72d1('0xf')]);router[_0x72d1('0x10')](_0x72d1('0x9'),auth[_0x72d1('0x7')](),controller[_0x72d1('0x11')]);module[_0x72d1('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 225e411..b77a96b 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 _0x4e78=['ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','setDataValue','allow','ulaw;alaw;gsm','insecure','split','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uas','pai','certificate','passive','actpass','dynamic','BOOLEAN','sequelize','STRING'];(function(_0x46533b,_0x2eb08f){var _0x4f1d5a=function(_0x18b47f){while(--_0x18b47f){_0x46533b['push'](_0x46533b['shift']());}};_0x4f1d5a(++_0x2eb08f);}(_0x4e78,0x7c));var _0x84e7=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0x4e78[_0x550e29];return _0x3515b6;};'use strict';var Sequelize=require(_0x84e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x84e7('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x3'),_0x84e7('0x4'),'peer'),'allowNull':![],'defaultValue':_0x84e7('0x3')},'context':{'type':Sequelize[_0x84e7('0x1')],'allowNull':![],'defaultValue':_0x84e7('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0x84e7('0x6'),_0x84e7('0x7'),_0x84e7('0x8'),_0x84e7('0x9'),'PROHIB_NOT_SCREENED',_0x84e7('0xa'),_0x84e7('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0x84e7('0x1')]},'permit':{'type':Sequelize[_0x84e7('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x84e7('0x1')]},'transport':{'type':Sequelize[_0x84e7('0x1')],'defaultValue':_0x84e7('0xc'),'set':function(_0x164c5c){this['setDataValue'](_0x84e7('0xd'),_0x164c5c?_0x164c5c[_0x84e7('0xe')](','):null);},'get':function(){return this['getDataValue']('transport')?this['getDataValue']('transport')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x84e7('0x2')]('rfc2833','info','shortinfo',_0x84e7('0xf'),_0x84e7('0x10')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x84e7('0x11'),'no',_0x84e7('0x12'),'update',_0x84e7('0x13')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x11'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x84e7('0x1')]},'directmediadeny':{'type':Sequelize[_0x84e7('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x84e7('0x14'),'set':function(_0xbdba7d){this['setDataValue'](_0x84e7('0x15'),_0xbdba7d?_0xbdba7d[_0x84e7('0xe')](','):null);},'get':function(){return this[_0x84e7('0x16')](_0x84e7('0x15'))?this[_0x84e7('0x16')](_0x84e7('0x15'))['split'](','):null;},'comment':_0x84e7('0x17')},'callgroup':{'type':Sequelize[_0x84e7('0x1')]},'namedcallgroup':{'type':Sequelize[_0x84e7('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x84e7('0x1')]},'language':{'type':Sequelize[_0x84e7('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x84e7('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x84e7('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xe199e3){this[_0x84e7('0x18')](_0x84e7('0x19'),_0xe199e3?_0xe199e3[_0x84e7('0xe')](';'):_0x84e7('0x1a'));},'get':function(){return this[_0x84e7('0x16')]('allow')?this[_0x84e7('0x16')](_0x84e7('0x19'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x11'),'no')},'insecure':{'type':Sequelize[_0x84e7('0x1')],'defaultValue':'port,invite','set':function(_0x483d84){this['setDataValue'](_0x84e7('0x1b'),_0x483d84?_0x483d84[_0x84e7('0xe')](','):null);},'get':function(){return this[_0x84e7('0x16')](_0x84e7('0x1b'))?this['getDataValue'](_0x84e7('0x1b'))[_0x84e7('0x1c')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x84e7('0x11'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x11'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x11'),'no',_0x84e7('0x1d'))},'promiscredir':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x11'),'no')},'useclientcode':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x11'),'no')},'accountcode':{'type':Sequelize[_0x84e7('0x1e')](0xb)},'setvar':{'type':Sequelize[_0x84e7('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x84e7('0x1f')},'amaflags':{'type':Sequelize[_0x84e7('0x1')]},'callcounter':{'type':Sequelize[_0x84e7('0x2')]('yes','no'),'defaultValue':_0x84e7('0x11')},'busylevel':{'type':Sequelize[_0x84e7('0x1e')](0xb)},'allowoverlap':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x11'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x11'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x84e7('0x1')]},'videosupport':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x11'),'no',_0x84e7('0x20')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x84e7('0x1e')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x11'),'no')},'mailbox':{'type':Sequelize[_0x84e7('0x1')]},'session_timers':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x21'),_0x84e7('0x22'),'originate')},'session_expires':{'type':Sequelize[_0x84e7('0x1e')](0xb)},'session_minse':{'type':Sequelize[_0x84e7('0x1e')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x84e7('0x23')),'defaultValue':_0x84e7('0x23')},'t38pt_usertpsource':{'type':Sequelize[_0x84e7('0x1')]},'regexten':{'type':Sequelize[_0x84e7('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x84e7('0x1')]},'port':{'type':Sequelize[_0x84e7('0x1e')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x84e7('0x11'),'no'),'defaultValue':_0x84e7('0x11')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x84e7('0x1')]},'defaultuser':{'type':Sequelize[_0x84e7('0x1')]},'rtptimeout':{'type':Sequelize[_0x84e7('0x1e')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x84e7('0x1e')](0xb)},'sendrpid':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x11'),'no',_0x84e7('0x24')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x84e7('0x1')]},'callbackextension':{'type':Sequelize[_0x84e7('0x1')]},'timert1':{'type':Sequelize[_0x84e7('0x1e')](0xb)},'timerb':{'type':Sequelize[_0x84e7('0x1e')](0xb)},'qualifyfreq':{'type':Sequelize[_0x84e7('0x1e')](0xb)},'contactpermit':{'type':Sequelize[_0x84e7('0x1')]},'contactdeny':{'type':Sequelize[_0x84e7('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x84e7('0x1')]},'use_q850_reason':{'type':Sequelize[_0x84e7('0x1')]},'maxforwards':{'type':Sequelize[_0x84e7('0x1e')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x84e7('0x11'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x84e7('0x11'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x11'),'no')},'dtlsenable':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x11'),'no')},'dtlsverify':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x11'),'no','fingerprint',_0x84e7('0x25'))},'dtlsrekey':{'type':Sequelize[_0x84e7('0x1e')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x84e7('0x1')]},'dtlscafile':{'type':Sequelize[_0x84e7('0x1')]},'dtlscapath':{'type':Sequelize[_0x84e7('0x1')]},'dtlssetup':{'type':Sequelize[_0x84e7('0x2')]('active',_0x84e7('0x26'),_0x84e7('0x27')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0x84e7('0x11'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x84e7('0x1')]},'recordofffeature':{'type':Sequelize[_0x84e7('0x1')]},'call_limit':{'type':Sequelize[_0x84e7('0x1e')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0x84e7('0x2')](_0x84e7('0x11'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x84e7('0x1')]},'mohsuggest':{'type':Sequelize[_0x84e7('0x1')]},'parkinglot':{'type':Sequelize[_0x84e7('0x1')]},'description':{'type':Sequelize[_0x84e7('0x1')]},'host':{'type':Sequelize[_0x84e7('0x1')],'defaultValue':_0x84e7('0x28')},'canreinvite':{'type':Sequelize['ENUM'](_0x84e7('0x11'),'no',_0x84e7('0x12'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x84e7('0x1')]},'active':{'type':Sequelize[_0x84e7('0x29')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x84e7('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x6ee4=['ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','uas','pai','fingerprint','active','passive','actpass','dynamic','update','exports','STRING','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED'];(function(_0x42be2b,_0x336f77){var _0x2698d6=function(_0x5a49d1){while(--_0x5a49d1){_0x42be2b['push'](_0x42be2b['shift']());}};_0x2698d6(++_0x336f77);}(_0x6ee4,0x150));var _0x46ee=function(_0x5e30a5,_0x32c168){_0x5e30a5=_0x5e30a5-0x0;var _0xafc1e2=_0x6ee4[_0x5e30a5];return _0xafc1e2;};'use strict';var Sequelize=require('sequelize');module[_0x46ee('0x0')]={'name':{'type':Sequelize[_0x46ee('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x3'),'user',_0x46ee('0x4')),'allowNull':![],'defaultValue':_0x46ee('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x46ee('0x5')},'callingpres':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x6'),_0x46ee('0x7'),_0x46ee('0x8'),_0x46ee('0x9'),_0x46ee('0xa'),_0x46ee('0xb'),_0x46ee('0xc'),_0x46ee('0xd'))},'deny':{'type':Sequelize[_0x46ee('0x1')]},'permit':{'type':Sequelize[_0x46ee('0x1')]},'secret':{'type':Sequelize[_0x46ee('0x1')]},'md5secret':{'type':Sequelize[_0x46ee('0x1')]},'remotesecret':{'type':Sequelize[_0x46ee('0x1')]},'transport':{'type':Sequelize[_0x46ee('0x1')],'defaultValue':'udp','set':function(_0x908830){this[_0x46ee('0xe')](_0x46ee('0xf'),_0x908830?_0x908830[_0x46ee('0x10')](','):null);},'get':function(){return this[_0x46ee('0x11')]('transport')?this['getDataValue'](_0x46ee('0xf'))['split'](','):null;},'comment':_0x46ee('0x12')},'dtmfmode':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x13'),_0x46ee('0x14'),_0x46ee('0x15'),_0x46ee('0x16'),_0x46ee('0x17')),'defaultValue':_0x46ee('0x13')},'directmedia':{'type':Sequelize['ENUM'](_0x46ee('0x18'),'no',_0x46ee('0x19'),'update',_0x46ee('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x46ee('0x1')]},'directmediadeny':{'type':Sequelize[_0x46ee('0x1')]},'nat':{'type':Sequelize[_0x46ee('0x1')],'defaultValue':_0x46ee('0x1b'),'set':function(_0x1d1e21){this[_0x46ee('0xe')](_0x46ee('0x1c'),_0x1d1e21?_0x1d1e21[_0x46ee('0x10')](','):null);},'get':function(){return this[_0x46ee('0x11')]('nat')?this[_0x46ee('0x11')](_0x46ee('0x1c'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x46ee('0x1')]},'namedcallgroup':{'type':Sequelize[_0x46ee('0x1')]},'pickupgroup':{'type':Sequelize[_0x46ee('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x46ee('0x1')]},'language':{'type':Sequelize[_0x46ee('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x46ee('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x46ee('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x46ee('0x1')],'allowNull':![],'defaultValue':_0x46ee('0x1d'),'set':function(_0x554278){this[_0x46ee('0xe')](_0x46ee('0x1e'),_0x554278?_0x554278[_0x46ee('0x10')](';'):_0x46ee('0x1d'));},'get':function(){return this[_0x46ee('0x11')]('allow')?this[_0x46ee('0x11')](_0x46ee('0x1e'))[_0x46ee('0x1f')](';'):null;},'comment':_0x46ee('0x20')},'autoframing':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x18'),'no')},'insecure':{'type':Sequelize[_0x46ee('0x1')],'defaultValue':_0x46ee('0x21'),'set':function(_0x14a691){this[_0x46ee('0xe')](_0x46ee('0x22'),_0x14a691?_0x14a691[_0x46ee('0x10')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x46ee('0x11')](_0x46ee('0x22'))[_0x46ee('0x1f')](','):null;},'comment':_0x46ee('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0x46ee('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x46ee('0x2')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0x46ee('0x2')]('yes','no')},'useclientcode':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x18'),'no')},'accountcode':{'type':Sequelize[_0x46ee('0x24')](0xb)},'setvar':{'type':Sequelize[_0x46ee('0x1')]},'callerid':{'type':Sequelize[_0x46ee('0x1')],'defaultValue':_0x46ee('0x25')},'amaflags':{'type':Sequelize[_0x46ee('0x1')]},'callcounter':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x46ee('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x46ee('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x46ee('0x18'),'no',_0x46ee('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x46ee('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x46ee('0x2')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x27'),_0x46ee('0x28'),'originate')},'session_expires':{'type':Sequelize[_0x46ee('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac','uas'),'defaultValue':_0x46ee('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x46ee('0x1')]},'regexten':{'type':Sequelize[_0x46ee('0x1')]},'fromdomain':{'type':Sequelize[_0x46ee('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x46ee('0x24')](0x5)},'qualify':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x46ee('0x1')]},'defaultuser':{'type':Sequelize[_0x46ee('0x1')]},'rtptimeout':{'type':Sequelize[_0x46ee('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x46ee('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x46ee('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x18'),'no',_0x46ee('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x46ee('0x1')]},'timert1':{'type':Sequelize[_0x46ee('0x24')](0xb)},'timerb':{'type':Sequelize[_0x46ee('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x46ee('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x46ee('0x1')]},'contactacl':{'type':Sequelize[_0x46ee('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x46ee('0x1')]},'use_q850_reason':{'type':Sequelize[_0x46ee('0x1')]},'maxforwards':{'type':Sequelize[_0x46ee('0x24')](0xb)},'encryption':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x18'),'no')},'force_avp':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x46ee('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x18'),'no',_0x46ee('0x2b'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x46ee('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x46ee('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x46ee('0x1')]},'dtlscafile':{'type':Sequelize[_0x46ee('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x2c'),_0x46ee('0x2d'),_0x46ee('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x46ee('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x46ee('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x46ee('0x2')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x46ee('0x2')]('yes','no')},'vmexten':{'type':Sequelize[_0x46ee('0x1')]},'mohinterpret':{'type':Sequelize[_0x46ee('0x1')]},'mohsuggest':{'type':Sequelize[_0x46ee('0x1')]},'parkinglot':{'type':Sequelize[_0x46ee('0x1')]},'description':{'type':Sequelize[_0x46ee('0x1')]},'host':{'type':Sequelize[_0x46ee('0x1')],'defaultValue':_0x46ee('0x2f')},'canreinvite':{'type':Sequelize[_0x46ee('0x2')](_0x46ee('0x18'),'no',_0x46ee('0x19'),_0x46ee('0x30'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x46ee('0x1')]},'otherFields':{'type':Sequelize[_0x46ee('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x46ee('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index f5328d4..a7b16de 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 _0x570a=['json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','index','map','Trunk','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','options','includeAll','findAll','rows','params','include','clone','merge','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','readFileSync','server/files/templates/trunk.ejs','Reload','html-pdf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end'];(function(_0x11eeda,_0x4a266f){var _0x385c89=function(_0x1a1ab1){while(--_0x1a1ab1){_0x11eeda['push'](_0x11eeda['shift']());}};_0x385c89(++_0x4a266f);}(_0x570a,0x11e));var _0xa570=function(_0x330ae7,_0xc925f5){_0x330ae7=_0x330ae7-0x0;var _0x44d402=_0x570a[_0x330ae7];return _0x44d402;};'use strict';var pdf=require(_0xa570('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa570('0x1'));var rp=require(_0xa570('0x2'));var moment=require(_0xa570('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa570('0x4'));var util=require('util');var path=require(_0xa570('0x5'));var sox=require(_0xa570('0x6'));var csv=require('to-csv');var ejs=require(_0xa570('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa570('0x8'));var crypto=require('crypto');var jsforce=require(_0xa570('0x9'));var deskjs=require(_0xa570('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa570('0xb'));var Papa=require(_0xa570('0xc'));var Redis=require('ioredis');var authService=require(_0xa570('0xd'));var qs=require(_0xa570('0xe'));var as=require(_0xa570('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa570('0x10'));var utils=require('../../config/utils');var config=require(_0xa570('0x11'));var db=require(_0xa570('0x12'))['db'];var jayson=require(_0xa570('0x13'));var client=jayson[_0xa570('0x14')]['http']({'port':0x232a});function checkPasswordPattern(_0x3aa72b,_0x5f1ca9,_0x1639e4){if(_0x1639e4){var _0x25bf61=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x25bf61[_0xa570('0x15')](_0x5f1ca9)){return _0x3aa72b;}else{throw new db[(_0xa570('0x16'))][(_0xa570('0x17'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3aa72b;}}function respondWithRpcPromise(_0x4c79e0,_0x1aad69,_0x307089,_0x429e21){return new BPromise(function(_0x14eb43,_0x457d17){var _0x188d02=_0x429e21||client;return _0x188d02[_0xa570('0x18')](_0x4c79e0,_0x307089)[_0xa570('0x19')](function(_0x3bc465){logger['info'](_0xa570('0x1a'),_0x1aad69,_0xa570('0x1b'));logger[_0xa570('0x1c')]('Trunk,\x20%s,\x20%s,\x20%s',_0x1aad69,_0xa570('0x1b'),JSON[_0xa570('0x1d')](_0x3bc465));if(_0x3bc465[_0xa570('0x1e')]){if(_0x3bc465[_0xa570('0x1e')][_0xa570('0x1f')]===0x1f4){logger[_0xa570('0x1e')](_0xa570('0x1a'),_0x1aad69,_0x3bc465[_0xa570('0x1e')][_0xa570('0x20')]);return _0x457d17(_0x3bc465[_0xa570('0x1e')]['message']);}logger[_0xa570('0x1e')](_0xa570('0x1a'),_0x1aad69,_0x3bc465[_0xa570('0x1e')][_0xa570('0x20')]);return _0x14eb43(_0x3bc465[_0xa570('0x1e')][_0xa570('0x20')]);}else{logger[_0xa570('0x21')](_0xa570('0x1a'),_0x1aad69,'request\x20sent');_0x14eb43(_0x3bc465[_0xa570('0x22')][_0xa570('0x20')]);}})[_0xa570('0x23')](function(_0x1129cf){logger[_0xa570('0x1e')](_0xa570('0x1a'),_0x1aad69,_0x1129cf);_0x457d17(_0x1129cf);});});}function respondWithStatusCode(_0x3a0048,_0x490a81){_0x490a81=_0x490a81||0xcc;return function(_0x429274){if(_0x429274){return _0x3a0048['sendStatus'](_0x490a81);}return _0x3a0048[_0xa570('0x24')](_0x490a81)[_0xa570('0x25')]();};}function respondWithResult(_0x3440d2,_0x8f2fe8){_0x8f2fe8=_0x8f2fe8||0xc8;return function(_0x3c72a2){if(_0x3c72a2){return _0x3440d2[_0xa570('0x24')](_0x8f2fe8)[_0xa570('0x26')](_0x3c72a2);}};}function respondWithFilteredResult(_0x557c5c,_0x31ac0c){return function(_0x179b88){if(_0x179b88){var _0x573fee=_0x179b88[_0xa570('0x27')],_0x319d8f=_0x31ac0c[_0xa570('0x28')],_0x35372c=_0x31ac0c[_0xa570('0x28')]+_0x31ac0c[_0xa570('0x29')],_0xb81a29;if(_0x35372c>=_0x573fee){_0x35372c=_0x573fee;_0xb81a29=0xc8;}else{_0xb81a29=0xce;}_0x557c5c['status'](_0xb81a29);return _0x557c5c['set'](_0xa570('0x2a'),_0x319d8f+'-'+_0x35372c+'/'+_0x573fee)[_0xa570('0x26')](_0x179b88);}return null;};}function patchUpdates(_0x19f48b){return function(_0x32b832){try{jsonpatch[_0xa570('0x2b')](_0x32b832,_0x19f48b,!![]);}catch(_0x3ce081){return BPromise[_0xa570('0x2c')](_0x3ce081);}return _0x32b832[_0xa570('0x2d')]();};}function saveUpdates(_0x1f99dd,_0x541c04){return function(_0xb41ae1){if(_0xb41ae1){return _0xb41ae1[_0xa570('0x2e')](_0x1f99dd)['then'](function(_0x42d2a8){return _0x42d2a8;});}return null;};}function removeEntity(_0x1f964d,_0x2ec55e){return function(_0x401415){if(_0x401415){return _0x401415[_0xa570('0x2f')]()['then'](function(){var _0x59121c=_0x401415[_0xa570('0x30')]({'plain':!![]});var _0x129a7f=_0xa570('0x31');return db[_0xa570('0x32')][_0xa570('0x2f')]({'where':{'type':_0x129a7f,'resourceId':_0x59121c['id']}})[_0xa570('0x19')](function(){return _0x401415;});})[_0xa570('0x19')](function(){_0x1f964d[_0xa570('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x389c2e,_0x5e40f7){return function(_0xa5df8e){if(!_0xa5df8e){_0x389c2e[_0xa570('0x33')](0x194);}return _0xa5df8e;};}function handleError(_0x14fc4c,_0x4b63fe){_0x4b63fe=_0x4b63fe||0x1f4;return function(_0x16f3e6){logger[_0xa570('0x1e')](_0x16f3e6[_0xa570('0x34')]);if(_0x16f3e6['name']){delete _0x16f3e6[_0xa570('0x35')];}_0x14fc4c[_0xa570('0x24')](_0x4b63fe)['send'](_0x16f3e6);};}exports[_0xa570('0x36')]=function(_0x13bc10,_0x8eed3b){var _0x32cca8={},_0x45a192={},_0x1588ae={'count':0x0,'rows':[]};var _0x39b19c=_[_0xa570('0x37')](db[_0xa570('0x38')][_0xa570('0x39')],function(_0x516530){return{'name':_0x516530[_0xa570('0x3a')],'type':_0x516530[_0xa570('0x3b')][_0xa570('0x3c')]};});_0x45a192['model']=_[_0xa570('0x37')](_0x39b19c,_0xa570('0x35'));_0x45a192[_0xa570('0x3d')]=_[_0xa570('0x3e')](_0x13bc10[_0xa570('0x3d')]);_0x45a192['filters']=_['intersection'](_0x45a192[_0xa570('0x3f')],_0x45a192[_0xa570('0x3d')]);_0x32cca8[_0xa570('0x40')]=_[_0xa570('0x41')](_0x45a192['model'],qs[_0xa570('0x42')](_0x13bc10['query'][_0xa570('0x42')]));_0x32cca8[_0xa570('0x40')]=_0x32cca8[_0xa570('0x40')][_0xa570('0x43')]?_0x32cca8[_0xa570('0x40')]:_0x45a192[_0xa570('0x3f')];if(!_0x13bc10[_0xa570('0x3d')]['hasOwnProperty']('nolimit')){_0x32cca8[_0xa570('0x29')]=qs[_0xa570('0x29')](_0x13bc10['query'][_0xa570('0x29')]);_0x32cca8['offset']=qs[_0xa570('0x28')](_0x13bc10[_0xa570('0x3d')][_0xa570('0x28')]);}_0x32cca8[_0xa570('0x44')]=qs[_0xa570('0x45')](_0x13bc10[_0xa570('0x3d')][_0xa570('0x45')]);_0x32cca8[_0xa570('0x46')]=qs[_0xa570('0x47')](_[_0xa570('0x48')](_0x13bc10[_0xa570('0x3d')],_0x45a192['filters']));if(_0x13bc10['query']['filter']){_0x32cca8[_0xa570('0x46')]=_['merge'](_0x32cca8[_0xa570('0x46')],{'$or':_[_0xa570('0x37')](_0x39b19c,function(_0xa9cc44){if(_0xa9cc44[_0xa570('0x3b')]!=='VIRTUAL'){var _0x1282cf={};_0x1282cf[_0xa9cc44['name']]={'$like':'%'+_0x13bc10['query'][_0xa570('0x49')]+'%'};return _0x1282cf;}})});}_0x32cca8=_['merge']({},_0x32cca8,_0x13bc10[_0xa570('0x4a')]);var _0x3e08be={'where':_0x32cca8[_0xa570('0x46')]};return db[_0xa570('0x38')][_0xa570('0x27')](_0x3e08be)['then'](function(_0x4374c1){_0x1588ae['count']=_0x4374c1;if(_0x13bc10[_0xa570('0x3d')][_0xa570('0x4b')]){_0x32cca8['include']=[{'all':!![]}];}return db['Trunk'][_0xa570('0x4c')](_0x32cca8);})[_0xa570('0x19')](function(_0x495ed9){_0x1588ae[_0xa570('0x4d')]=_0x495ed9;return _0x1588ae;})[_0xa570('0x19')](respondWithFilteredResult(_0x8eed3b,_0x32cca8))[_0xa570('0x23')](handleError(_0x8eed3b,null));};exports['show']=function(_0x5966cc,_0x59c3db){var _0x3b3f7e={'raw':![],'where':{'id':_0x5966cc[_0xa570('0x4e')]['id']}},_0x39cf7b={};_0x39cf7b[_0xa570('0x3f')]=_[_0xa570('0x3e')](db['Trunk']['rawAttributes']);_0x39cf7b[_0xa570('0x3d')]=_['keys'](_0x5966cc['query']);_0x39cf7b[_0xa570('0x47')]=_[_0xa570('0x41')](_0x39cf7b[_0xa570('0x3f')],_0x39cf7b[_0xa570('0x3d')]);_0x3b3f7e[_0xa570('0x40')]=_[_0xa570('0x41')](_0x39cf7b[_0xa570('0x3f')],qs['fields'](_0x5966cc['query']['fields']));_0x3b3f7e[_0xa570('0x40')]=_0x3b3f7e[_0xa570('0x40')][_0xa570('0x43')]?_0x3b3f7e['attributes']:_0x39cf7b[_0xa570('0x3f')];if(_0x5966cc[_0xa570('0x3d')][_0xa570('0x4b')]){_0x3b3f7e[_0xa570('0x4f')]=[{'all':!![]}];}_0x3b3f7e=_['merge']({},_0x3b3f7e,_0x5966cc[_0xa570('0x4a')]);return db[_0xa570('0x38')]['find'](_0x3b3f7e)[_0xa570('0x19')](handleEntityNotFound(_0x59c3db,null))[_0xa570('0x19')](respondWithResult(_0x59c3db,null))['catch'](handleError(_0x59c3db,null));};exports[_0xa570('0x50')]=function(_0x4cb0cc,_0x337748){var _0x49a933={'where':{'id':_0x4cb0cc[_0xa570('0x4e')]['id']}},_0x3875f2={};_0x3875f2[_0xa570('0x3f')]=_[_0xa570('0x3e')](db[_0xa570('0x38')][_0xa570('0x39')]);_0x49a933[_0xa570('0x40')]=_[_0xa570('0x41')](_0x3875f2['model'],qs[_0xa570('0x42')](_0x4cb0cc[_0xa570('0x3d')][_0xa570('0x42')]));_0x49a933['attributes']=_0x49a933[_0xa570('0x40')][_0xa570('0x43')]?_0x49a933[_0xa570('0x40')]:_0x3875f2['model'];if(_0x4cb0cc[_0xa570('0x3d')][_0xa570('0x4b')]){_0x49a933[_0xa570('0x4f')]=[{'all':!![]}];}_0x49a933=_[_0xa570('0x51')]({},_0x49a933,_0x4cb0cc[_0xa570('0x4a')]);return db[_0xa570('0x38')]['find'](_0x49a933)[_0xa570('0x19')](handleEntityNotFound(_0x337748,null))[_0xa570('0x19')](function(_0xfabe2d){if(_0xfabe2d){var _0xd512c=_0xfabe2d[_0xa570('0x30')]({'plain':!![]});_0xd512c=qs[_0xa570('0x52')](_0xd512c,['id',_0xa570('0x53'),_0xa570('0x54')]);_0x4cb0cc['body']=_[_0xa570('0x52')](_0x4cb0cc[_0xa570('0x55')],['id',_0xa570('0x53'),_0xa570('0x54')]);return db['Trunk'][_0xa570('0x56')](_[_0xa570('0x51')](_0xd512c,_0x4cb0cc[_0xa570('0x55')]),{'include':_0x4cb0cc['query']['includeAll']?[{'all':!![]}]:undefined})[_0xa570('0x19')](function(_0x21fc61){var _0x18cfe3=_0x4cb0cc['user']['get']({'plain':!![]});if(!_0x18cfe3)throw new Error(_0xa570('0x57'));if(_0x18cfe3[_0xa570('0x58')]===_0xa570('0x59')){var _0x5da677=_0x21fc61[_0xa570('0x30')]({'plain':!![]});var _0x5419d6=_0xa570('0x31');return db[_0xa570('0x5a')][_0xa570('0x5b')]({'where':{'name':_0x5419d6,'userProfileId':_0x18cfe3[_0xa570('0x5c')]},'raw':!![]})[_0xa570('0x19')](function(_0x59daf4){if(_0x59daf4&&_0x59daf4[_0xa570('0x5d')]===0x0){return db[_0xa570('0x32')][_0xa570('0x56')]({'name':_0x5da677[_0xa570('0x35')],'resourceId':_0x5da677['id'],'type':_0x59daf4[_0xa570('0x35')],'sectionId':_0x59daf4['id']},{})[_0xa570('0x19')](function(){return _0x21fc61;});}else{return _0x21fc61;}})[_0xa570('0x23')](function(_0x55f4cc){logger[_0xa570('0x1e')](_0xa570('0x5e'),_0x55f4cc);throw _0x55f4cc;});}return _0x21fc61;});}})['then'](respondWithResult(_0x337748,0xc9))['catch'](handleError(_0x337748,null));};exports[_0xa570('0x56')]=function(_0x5521e6,_0x2659e9,_0x13a837){var _0x1c2988;return db[_0xa570('0x38')][_0xa570('0x56')](_0x5521e6[_0xa570('0x55')],{'raw':!![]})[_0xa570('0x19')](function(_0x20eaeb){_0x1c2988=_0x20eaeb;return db[_0xa570('0x38')][_0xa570('0x4c')]({'raw':!![]});})[_0xa570('0x19')](function(_0x17b461){var _0x112892=fs['readFileSync'](path[_0xa570('0x5f')](config[_0xa570('0x60')],'server/files/templates/trunk.ejs'),_0xa570('0x61'));var _0x28f951=fs['readFileSync'](path[_0xa570('0x5f')](config[_0xa570('0x60')],_0xa570('0x62')),_0xa570('0x61'));var _0x360a84=ejs[_0xa570('0x63')](_0x112892,{'trunks':_0x17b461||[]});fs[_0xa570('0x64')](_0xa570('0x65'),_0x360a84);if(_0x1c2988[_0xa570('0x66')]){var _0xcc122e=ejs[_0xa570('0x63')](_0x28f951,{'trunks':_0x17b461||[]});fs[_0xa570('0x64')](_0xa570('0x67'),_0xcc122e);}})['then'](function(){return respondWithRpcPromise('Reload',_0xa570('0x56'),{'module':_0xa570('0x68')});})[_0xa570('0x19')](function(){var _0x2dbca9=_0x5521e6[_0xa570('0x59')][_0xa570('0x30')]({'plain':!![]});if(!_0x2dbca9)throw new Error(_0xa570('0x57'));if(_0x2dbca9[_0xa570('0x58')]===_0xa570('0x59')){var _0x3a137a=_0x1c2988[_0xa570('0x30')]({'plain':!![]});return db[_0xa570('0x5a')][_0xa570('0x5b')]({'where':{'name':'Trunks','userProfileId':_0x2dbca9[_0xa570('0x5c')]},'raw':!![]})[_0xa570('0x19')](function(_0x58fea7){if(_0x58fea7&&_0x58fea7['autoAssociation']===0x0){return db[_0xa570('0x32')][_0xa570('0x56')]({'name':_0x3a137a[_0xa570('0x35')],'resourceId':_0x3a137a['id'],'type':_0x58fea7[_0xa570('0x35')],'sectionId':_0x58fea7['id']},{})['then'](function(){return _0x1c2988;});}else{return _0x1c2988;}})[_0xa570('0x23')](function(_0x4d1cbd){logger[_0xa570('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d1cbd);throw _0x4d1cbd;});}return _0x1c2988;})[_0xa570('0x19')](respondWithResult(_0x2659e9,0xc9))[_0xa570('0x23')](handleError(_0x2659e9,null));};exports['update']=function(_0x2eea92,_0x17b703,_0x1ff41b){var _0x3a0ed7;return db['Trunk'][_0xa570('0x5b')]({'where':{'id':_0x2eea92[_0xa570('0x4e')]['id']}})[_0xa570('0x19')](handleEntityNotFound(_0x17b703,null))[_0xa570('0x19')](saveUpdates(_0x2eea92[_0xa570('0x55')],null))[_0xa570('0x19')](function(_0x2b2e06){if(_0x2b2e06){_0x3a0ed7=_0x2b2e06;return db[_0xa570('0x38')]['findAll']({'raw':!![]});}})['then'](function(_0x2ba7e5){if(_0x2ba7e5){var _0x1e442b=fs[_0xa570('0x69')](path['join'](config[_0xa570('0x60')],_0xa570('0x6a')),'utf8');var _0x24ef99=fs[_0xa570('0x69')](path[_0xa570('0x5f')](config[_0xa570('0x60')],'server/files/templates/registry.ejs'),_0xa570('0x61'));var _0x371cab=ejs['render'](_0x1e442b,{'trunks':_0x2ba7e5||[]});fs[_0xa570('0x64')](_0xa570('0x65'),_0x371cab);var _0x4ae309=ejs['render'](_0x24ef99,{'trunks':_0x2ba7e5||[]});fs[_0xa570('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x4ae309);return respondWithRpcPromise(_0xa570('0x6b'),_0xa570('0x2e'),{'module':_0xa570('0x68')});}return null;})[_0xa570('0x19')](function(_0x1112b7){if(_0x1112b7){return _0x3a0ed7;}})[_0xa570('0x19')](respondWithResult(_0x17b703,null))[_0xa570('0x23')](handleError(_0x17b703,null));};exports[_0xa570('0x2f')]=function(_0x42ca29,_0x24b1e0,_0x10e3e5){var _0x2610c0;return db[_0xa570('0x38')][_0xa570('0x5b')]({'where':{'id':_0x42ca29[_0xa570('0x4e')]['id']}})[_0xa570('0x19')](handleEntityNotFound(_0x24b1e0,null))[_0xa570('0x19')](removeEntity(_0x24b1e0,null))[_0xa570('0x19')](function(){return db[_0xa570('0x38')]['findAll']({'raw':!![]});})[_0xa570('0x19')](function(_0x4038e7){var _0x4824b2=fs[_0xa570('0x69')](path[_0xa570('0x5f')](config[_0xa570('0x60')],_0xa570('0x6a')),_0xa570('0x61'));var _0xa0636a=fs[_0xa570('0x69')](path[_0xa570('0x5f')](config[_0xa570('0x60')],'server/files/templates/registry.ejs'),_0xa570('0x61'));var _0x276182=ejs[_0xa570('0x63')](_0x4824b2,{'trunks':_0x4038e7});var _0x4944b7=ejs[_0xa570('0x63')](_0xa0636a,{'trunks':_0x4038e7});fs[_0xa570('0x64')](_0xa570('0x65'),_0x276182);fs[_0xa570('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x4944b7);return respondWithRpcPromise(_0xa570('0x6b'),_0xa570('0x2f'),{'module':_0xa570('0x68')});})['catch'](handleError(_0x24b1e0,null));}; \ No newline at end of file +var _0x0f69=['to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','destroy','get','Trunks','UserProfileResource','send','index','map','Trunk','fieldName','type','model','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','rawAttributes','fields','includeAll','find','omit','createdAt','updatedAt','body','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','join','render','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','utf8','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox'];(function(_0x32e2e8,_0x12d243){var _0x376655=function(_0xbeee7c){while(--_0xbeee7c){_0x32e2e8['push'](_0x32e2e8['shift']());}};_0x376655(++_0x12d243);}(_0x0f69,0x1ac));var _0x90f6=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x0f69[_0x1e4360];return _0x31e6b4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x90f6('0x0'));var rimraf=require(_0x90f6('0x1'));var zipdir=require(_0x90f6('0x2'));var jsonpatch=require(_0x90f6('0x3'));var rp=require(_0x90f6('0x4'));var moment=require(_0x90f6('0x5'));var BPromise=require(_0x90f6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x90f6('0x7'));var csv=require(_0x90f6('0x8'));var ejs=require(_0x90f6('0x9'));var fs=require('fs');var _=require(_0x90f6('0xa'));var squel=require(_0x90f6('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90f6('0xc'));var toCsv=require(_0x90f6('0x8'));var querystring=require(_0x90f6('0xd'));var Papa=require(_0x90f6('0xe'));var Redis=require('ioredis');var authService=require(_0x90f6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x90f6('0x10'));var hardwareService=require(_0x90f6('0x11'));var logger=require(_0x90f6('0x12'))('api');var utils=require(_0x90f6('0x13'));var config=require(_0x90f6('0x14'));var db=require(_0x90f6('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x90f6('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x345aee,_0x563344,_0x2f6778){if(_0x2f6778){var _0x2d964c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d964c[_0x90f6('0x17')](_0x563344)){return _0x345aee;}else{throw new db[(_0x90f6('0x18'))][(_0x90f6('0x19'))](_0x90f6('0x1a'));}}else{return _0x345aee;}}function respondWithRpcPromise(_0x2ede65,_0x454100,_0x6fcf85,_0x1abb04){return new BPromise(function(_0x137aea,_0x33792c){var _0x86ac40=_0x1abb04||client;return _0x86ac40[_0x90f6('0x1b')](_0x2ede65,_0x6fcf85)[_0x90f6('0x1c')](function(_0x57780e){logger[_0x90f6('0x1d')](_0x90f6('0x1e'),_0x454100,_0x90f6('0x1f'));logger[_0x90f6('0x20')](_0x90f6('0x21'),_0x454100,_0x90f6('0x1f'),JSON['stringify'](_0x57780e));if(_0x57780e['error']){if(_0x57780e[_0x90f6('0x22')][_0x90f6('0x23')]===0x1f4){logger[_0x90f6('0x22')](_0x90f6('0x1e'),_0x454100,_0x57780e[_0x90f6('0x22')][_0x90f6('0x24')]);return _0x33792c(_0x57780e['error'][_0x90f6('0x24')]);}logger[_0x90f6('0x22')](_0x90f6('0x1e'),_0x454100,_0x57780e[_0x90f6('0x22')][_0x90f6('0x24')]);return _0x137aea(_0x57780e[_0x90f6('0x22')][_0x90f6('0x24')]);}else{logger['info'](_0x90f6('0x1e'),_0x454100,_0x90f6('0x1f'));_0x137aea(_0x57780e['result'][_0x90f6('0x24')]);}})[_0x90f6('0x25')](function(_0x18b9eb){logger[_0x90f6('0x22')](_0x90f6('0x1e'),_0x454100,_0x18b9eb);_0x33792c(_0x18b9eb);});});}function respondWithStatusCode(_0x1996cf,_0x3ef89a){_0x3ef89a=_0x3ef89a||0xcc;return function(_0x2de1a6){if(_0x2de1a6){return _0x1996cf[_0x90f6('0x26')](_0x3ef89a);}return _0x1996cf[_0x90f6('0x27')](_0x3ef89a)[_0x90f6('0x28')]();};}function respondWithResult(_0x36d01c,_0x23434d){_0x23434d=_0x23434d||0xc8;return function(_0x52edbd){if(_0x52edbd){return _0x36d01c['status'](_0x23434d)[_0x90f6('0x29')](_0x52edbd);}};}function respondWithFilteredResult(_0xce45,_0x28dfdf){return function(_0x2155a7){if(_0x2155a7){var _0x7df45d=_0x2155a7[_0x90f6('0x2a')],_0x4bd645=_0x28dfdf['offset'],_0xd3e79e=_0x28dfdf[_0x90f6('0x2b')]+_0x28dfdf[_0x90f6('0x2c')],_0x5cc673;if(_0xd3e79e>=_0x7df45d){_0xd3e79e=_0x7df45d;_0x5cc673=0xc8;}else{_0x5cc673=0xce;}_0xce45['status'](_0x5cc673);return _0xce45[_0x90f6('0x2d')]('Content-Range',_0x4bd645+'-'+_0xd3e79e+'/'+_0x7df45d)[_0x90f6('0x29')](_0x2155a7);}return null;};}function patchUpdates(_0x5321af){return function(_0x49ab40){try{jsonpatch[_0x90f6('0x2e')](_0x49ab40,_0x5321af,!![]);}catch(_0x3aea38){return BPromise['reject'](_0x3aea38);}return _0x49ab40[_0x90f6('0x2f')]();};}function saveUpdates(_0xedb6b8,_0x357a78){return function(_0x519bae){if(_0x519bae){return _0x519bae[_0x90f6('0x30')](_0xedb6b8)[_0x90f6('0x1c')](function(_0x1b4716){return _0x1b4716;});}return null;};}function removeEntity(_0x17b38d,_0x20d1e2){return function(_0x273278){if(_0x273278){return _0x273278[_0x90f6('0x31')]()[_0x90f6('0x1c')](function(){var _0x329052=_0x273278[_0x90f6('0x32')]({'plain':!![]});var _0x158091=_0x90f6('0x33');return db[_0x90f6('0x34')]['destroy']({'where':{'type':_0x158091,'resourceId':_0x329052['id']}})[_0x90f6('0x1c')](function(){return _0x273278;});})['then'](function(){_0x17b38d[_0x90f6('0x27')](0xcc)[_0x90f6('0x28')]();});}};}function handleEntityNotFound(_0x1e0cce,_0x12896a){return function(_0x556609){if(!_0x556609){_0x1e0cce['sendStatus'](0x194);}return _0x556609;};}function handleError(_0x4fc6fa,_0x4ee4b0){_0x4ee4b0=_0x4ee4b0||0x1f4;return function(_0x216c54){logger[_0x90f6('0x22')](_0x216c54['stack']);if(_0x216c54['name']){delete _0x216c54['name'];}_0x4fc6fa['status'](_0x4ee4b0)[_0x90f6('0x35')](_0x216c54);};}exports[_0x90f6('0x36')]=function(_0x2270e0,_0x4a08b2){var _0x1ab7fb={},_0x5482de={},_0x5e5444={'count':0x0,'rows':[]};var _0x12b169=_[_0x90f6('0x37')](db[_0x90f6('0x38')]['rawAttributes'],function(_0x2f85b2){return{'name':_0x2f85b2[_0x90f6('0x39')],'type':_0x2f85b2[_0x90f6('0x3a')]['key']};});_0x5482de[_0x90f6('0x3b')]=_[_0x90f6('0x37')](_0x12b169,_0x90f6('0x3c'));_0x5482de[_0x90f6('0x3d')]=_[_0x90f6('0x3e')](_0x2270e0[_0x90f6('0x3d')]);_0x5482de[_0x90f6('0x3f')]=_[_0x90f6('0x40')](_0x5482de[_0x90f6('0x3b')],_0x5482de[_0x90f6('0x3d')]);_0x1ab7fb[_0x90f6('0x41')]=_[_0x90f6('0x40')](_0x5482de[_0x90f6('0x3b')],qs['fields'](_0x2270e0['query']['fields']));_0x1ab7fb['attributes']=_0x1ab7fb[_0x90f6('0x41')][_0x90f6('0x42')]?_0x1ab7fb[_0x90f6('0x41')]:_0x5482de[_0x90f6('0x3b')];if(!_0x2270e0[_0x90f6('0x3d')][_0x90f6('0x43')](_0x90f6('0x44'))){_0x1ab7fb[_0x90f6('0x2c')]=qs[_0x90f6('0x2c')](_0x2270e0[_0x90f6('0x3d')][_0x90f6('0x2c')]);_0x1ab7fb[_0x90f6('0x2b')]=qs['offset'](_0x2270e0[_0x90f6('0x3d')][_0x90f6('0x2b')]);}_0x1ab7fb[_0x90f6('0x45')]=qs['sort'](_0x2270e0[_0x90f6('0x3d')][_0x90f6('0x46')]);_0x1ab7fb[_0x90f6('0x47')]=qs[_0x90f6('0x3f')](_['pick'](_0x2270e0['query'],_0x5482de[_0x90f6('0x3f')]));if(_0x2270e0[_0x90f6('0x3d')]['filter']){_0x1ab7fb[_0x90f6('0x47')]=_[_0x90f6('0x48')](_0x1ab7fb['where'],{'$or':_[_0x90f6('0x37')](_0x12b169,function(_0x43b393){if(_0x43b393[_0x90f6('0x3a')]!==_0x90f6('0x49')){var _0x6aa8df={};_0x6aa8df[_0x43b393[_0x90f6('0x3c')]]={'$like':'%'+_0x2270e0['query'][_0x90f6('0x4a')]+'%'};return _0x6aa8df;}})});}_0x1ab7fb=_[_0x90f6('0x48')]({},_0x1ab7fb,_0x2270e0[_0x90f6('0x4b')]);var _0x4c5a50={'where':_0x1ab7fb[_0x90f6('0x47')]};return db[_0x90f6('0x38')][_0x90f6('0x2a')](_0x4c5a50)[_0x90f6('0x1c')](function(_0x4e5d53){_0x5e5444['count']=_0x4e5d53;if(_0x2270e0[_0x90f6('0x3d')]['includeAll']){_0x1ab7fb[_0x90f6('0x4c')]=[{'all':!![]}];}return db[_0x90f6('0x38')][_0x90f6('0x4d')](_0x1ab7fb);})[_0x90f6('0x1c')](function(_0xd61bb8){_0x5e5444[_0x90f6('0x4e')]=_0xd61bb8;return _0x5e5444;})[_0x90f6('0x1c')](respondWithFilteredResult(_0x4a08b2,_0x1ab7fb))['catch'](handleError(_0x4a08b2,null));};exports[_0x90f6('0x4f')]=function(_0x4d64be,_0x2f601c){var _0x340594={'raw':![],'where':{'id':_0x4d64be[_0x90f6('0x50')]['id']}},_0x2faf64={};_0x2faf64['model']=_[_0x90f6('0x3e')](db[_0x90f6('0x38')][_0x90f6('0x51')]);_0x2faf64[_0x90f6('0x3d')]=_[_0x90f6('0x3e')](_0x4d64be[_0x90f6('0x3d')]);_0x2faf64[_0x90f6('0x3f')]=_[_0x90f6('0x40')](_0x2faf64[_0x90f6('0x3b')],_0x2faf64['query']);_0x340594[_0x90f6('0x41')]=_[_0x90f6('0x40')](_0x2faf64[_0x90f6('0x3b')],qs['fields'](_0x4d64be['query'][_0x90f6('0x52')]));_0x340594[_0x90f6('0x41')]=_0x340594['attributes']['length']?_0x340594[_0x90f6('0x41')]:_0x2faf64[_0x90f6('0x3b')];if(_0x4d64be[_0x90f6('0x3d')][_0x90f6('0x53')]){_0x340594[_0x90f6('0x4c')]=[{'all':!![]}];}_0x340594=_[_0x90f6('0x48')]({},_0x340594,_0x4d64be[_0x90f6('0x4b')]);return db['Trunk'][_0x90f6('0x54')](_0x340594)[_0x90f6('0x1c')](handleEntityNotFound(_0x2f601c,null))[_0x90f6('0x1c')](respondWithResult(_0x2f601c,null))['catch'](handleError(_0x2f601c,null));};exports['clone']=function(_0x5b0d19,_0x215c8e){var _0xa9adc3={'where':{'id':_0x5b0d19[_0x90f6('0x50')]['id']}},_0x5f51db={};_0x5f51db[_0x90f6('0x3b')]=_[_0x90f6('0x3e')](db['Trunk'][_0x90f6('0x51')]);_0xa9adc3[_0x90f6('0x41')]=_[_0x90f6('0x40')](_0x5f51db[_0x90f6('0x3b')],qs[_0x90f6('0x52')](_0x5b0d19[_0x90f6('0x3d')][_0x90f6('0x52')]));_0xa9adc3[_0x90f6('0x41')]=_0xa9adc3[_0x90f6('0x41')]['length']?_0xa9adc3['attributes']:_0x5f51db[_0x90f6('0x3b')];if(_0x5b0d19[_0x90f6('0x3d')][_0x90f6('0x53')]){_0xa9adc3[_0x90f6('0x4c')]=[{'all':!![]}];}_0xa9adc3=_[_0x90f6('0x48')]({},_0xa9adc3,_0x5b0d19[_0x90f6('0x4b')]);return db[_0x90f6('0x38')]['find'](_0xa9adc3)[_0x90f6('0x1c')](handleEntityNotFound(_0x215c8e,null))[_0x90f6('0x1c')](function(_0x3bd922){if(_0x3bd922){var _0x349cd1=_0x3bd922[_0x90f6('0x32')]({'plain':!![]});_0x349cd1=qs[_0x90f6('0x55')](_0x349cd1,['id',_0x90f6('0x56'),_0x90f6('0x57')]);_0x5b0d19[_0x90f6('0x58')]=_['omit'](_0x5b0d19[_0x90f6('0x58')],['id',_0x90f6('0x56'),_0x90f6('0x57')]);return db[_0x90f6('0x38')][_0x90f6('0x59')](_['merge'](_0x349cd1,_0x5b0d19[_0x90f6('0x58')]),{'include':_0x5b0d19[_0x90f6('0x3d')][_0x90f6('0x53')]?[{'all':!![]}]:undefined})[_0x90f6('0x1c')](function(_0x4734bf){var _0x5ab3dc=_0x5b0d19[_0x90f6('0x5a')]['get']({'plain':!![]});if(!_0x5ab3dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ab3dc[_0x90f6('0x5b')]===_0x90f6('0x5a')){var _0x4d69ff=_0x4734bf[_0x90f6('0x32')]({'plain':!![]});var _0x42367e=_0x90f6('0x33');return db[_0x90f6('0x5c')][_0x90f6('0x54')]({'where':{'name':_0x42367e,'userProfileId':_0x5ab3dc[_0x90f6('0x5d')]},'raw':!![]})[_0x90f6('0x1c')](function(_0x39c3c5){if(_0x39c3c5&&_0x39c3c5['autoAssociation']===0x0){return db[_0x90f6('0x34')][_0x90f6('0x59')]({'name':_0x4d69ff[_0x90f6('0x3c')],'resourceId':_0x4d69ff['id'],'type':_0x39c3c5['name'],'sectionId':_0x39c3c5['id']},{})['then'](function(){return _0x4734bf;});}else{return _0x4734bf;}})[_0x90f6('0x25')](function(_0x71d6e8){logger[_0x90f6('0x22')](_0x90f6('0x5e'),_0x71d6e8);throw _0x71d6e8;});}return _0x4734bf;});}})[_0x90f6('0x1c')](respondWithResult(_0x215c8e,0xc9))[_0x90f6('0x25')](handleError(_0x215c8e,null));};exports[_0x90f6('0x59')]=function(_0x38d2b6,_0x5960b2,_0x357725){var _0x5b4754;return db[_0x90f6('0x38')]['create'](_0x38d2b6[_0x90f6('0x58')],{'raw':!![]})[_0x90f6('0x1c')](function(_0xbbf5ad){_0x5b4754=_0xbbf5ad;return db['Trunk']['findAll']({'raw':!![]});})['then'](function(_0x1ed792){var _0x44d55a=fs[_0x90f6('0x5f')](path['join'](config[_0x90f6('0x60')],_0x90f6('0x61')),'utf8');var _0x777ff7=fs[_0x90f6('0x5f')](path[_0x90f6('0x62')](config[_0x90f6('0x60')],'server/files/templates/registry.ejs'),'utf8');var _0x42c98b=ejs[_0x90f6('0x63')](_0x44d55a,{'trunks':_0x1ed792||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x42c98b);if(_0x5b4754[_0x90f6('0x64')]){var _0x30da04=ejs[_0x90f6('0x63')](_0x777ff7,{'trunks':_0x1ed792||[]});fs[_0x90f6('0x65')](_0x90f6('0x66'),_0x30da04);}})[_0x90f6('0x1c')](function(){return respondWithRpcPromise(_0x90f6('0x67'),_0x90f6('0x59'),{'module':_0x90f6('0x68')});})['then'](function(){var _0x3788d5=_0x38d2b6[_0x90f6('0x5a')][_0x90f6('0x32')]({'plain':!![]});if(!_0x3788d5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3788d5[_0x90f6('0x5b')]===_0x90f6('0x5a')){var _0x22cd76=_0x5b4754[_0x90f6('0x32')]({'plain':!![]});return db[_0x90f6('0x5c')][_0x90f6('0x54')]({'where':{'name':_0x90f6('0x33'),'userProfileId':_0x3788d5[_0x90f6('0x5d')]},'raw':!![]})[_0x90f6('0x1c')](function(_0x54bea2){if(_0x54bea2&&_0x54bea2[_0x90f6('0x69')]===0x0){return db[_0x90f6('0x34')][_0x90f6('0x59')]({'name':_0x22cd76[_0x90f6('0x3c')],'resourceId':_0x22cd76['id'],'type':_0x54bea2['name'],'sectionId':_0x54bea2['id']},{})[_0x90f6('0x1c')](function(){return _0x5b4754;});}else{return _0x5b4754;}})[_0x90f6('0x25')](function(_0x12f893){logger['error'](_0x90f6('0x5e'),_0x12f893);throw _0x12f893;});}return _0x5b4754;})[_0x90f6('0x1c')](respondWithResult(_0x5960b2,0xc9))['catch'](handleError(_0x5960b2,null));};exports[_0x90f6('0x30')]=function(_0x276c2b,_0x1da31e,_0x15ea77){var _0x51988f;return db[_0x90f6('0x38')][_0x90f6('0x54')]({'where':{'id':_0x276c2b[_0x90f6('0x50')]['id']}})[_0x90f6('0x1c')](handleEntityNotFound(_0x1da31e,null))['then'](saveUpdates(_0x276c2b[_0x90f6('0x58')],null))[_0x90f6('0x1c')](function(_0x445439){if(_0x445439){_0x51988f=_0x445439;return db[_0x90f6('0x38')][_0x90f6('0x4d')]({'raw':!![]});}})['then'](function(_0x526b5f){if(_0x526b5f){var _0x2fed36=fs[_0x90f6('0x5f')](path['join'](config['root'],'server/files/templates/trunk.ejs'),_0x90f6('0x6a'));var _0xd9e2ef=fs[_0x90f6('0x5f')](path[_0x90f6('0x62')](config[_0x90f6('0x60')],_0x90f6('0x6b')),_0x90f6('0x6a'));var _0x58e3a7=ejs[_0x90f6('0x63')](_0x2fed36,{'trunks':_0x526b5f||[]});fs[_0x90f6('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x58e3a7);var _0xcc9f1a=ejs[_0x90f6('0x63')](_0xd9e2ef,{'trunks':_0x526b5f||[]});fs[_0x90f6('0x65')](_0x90f6('0x66'),_0xcc9f1a);return respondWithRpcPromise(_0x90f6('0x67'),_0x90f6('0x30'),{'module':_0x90f6('0x68')});}return null;})['then'](function(_0x24bcb8){if(_0x24bcb8){return _0x51988f;}})[_0x90f6('0x1c')](respondWithResult(_0x1da31e,null))['catch'](handleError(_0x1da31e,null));};exports[_0x90f6('0x31')]=function(_0x2fd53f,_0x474166,_0x1939db){var _0x55431b;return db[_0x90f6('0x38')][_0x90f6('0x54')]({'where':{'id':_0x2fd53f[_0x90f6('0x50')]['id']}})['then'](handleEntityNotFound(_0x474166,null))[_0x90f6('0x1c')](removeEntity(_0x474166,null))[_0x90f6('0x1c')](function(){return db[_0x90f6('0x38')]['findAll']({'raw':!![]});})[_0x90f6('0x1c')](function(_0x33e02b){var _0x52d54a=fs[_0x90f6('0x5f')](path[_0x90f6('0x62')](config['root'],_0x90f6('0x61')),_0x90f6('0x6a'));var _0x10b00c=fs[_0x90f6('0x5f')](path['join'](config[_0x90f6('0x60')],_0x90f6('0x6b')),_0x90f6('0x6a'));var _0x12fcd8=ejs[_0x90f6('0x63')](_0x52d54a,{'trunks':_0x33e02b});var _0x58726c=ejs['render'](_0x10b00c,{'trunks':_0x33e02b});fs[_0x90f6('0x65')](_0x90f6('0x6c'),_0x12fcd8);fs[_0x90f6('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x58726c);return respondWithRpcPromise('Reload',_0x90f6('0x31'),{'module':_0x90f6('0x68')});})[_0x90f6('0x25')](handleError(_0x474166,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index ba5b4e8..d2e6ed1 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 _0x0bdc=['bluebird','request-promise','../../config/environment','./trunk.attributes','define','Trunk','tools_trunks','lodash','util','api','moment'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0bdc,0x146));var _0xc0bd=function(_0x23a2b8,_0x3a2b9a){_0x23a2b8=_0x23a2b8-0x0;var _0x1f4061=_0x0bdc[_0x23a2b8];return _0x1f4061;};'use strict';var _=require(_0xc0bd('0x0'));var util=require(_0xc0bd('0x1'));var logger=require('../../config/logger')(_0xc0bd('0x2'));var moment=require(_0xc0bd('0x3'));var BPromise=require(_0xc0bd('0x4'));var rp=require(_0xc0bd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc0bd('0x6'));var attributes=require(_0xc0bd('0x7'));module['exports']=function(_0x347a11,_0x1e8995){return _0x347a11[_0xc0bd('0x8')](_0xc0bd('0x9'),attributes,{'tableName':_0xc0bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cbb=['./trunk.attributes','exports','define','Trunk','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3a73e1,_0x3e81c7){var _0x1ed2fb=function(_0x51376d){while(--_0x51376d){_0x3a73e1['push'](_0x3a73e1['shift']());}};_0x1ed2fb(++_0x3e81c7);}(_0x0cbb,0x79));var _0xb0cb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cbb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb0cb('0x0'));var util=require(_0xb0cb('0x1'));var logger=require(_0xb0cb('0x2'))(_0xb0cb('0x3'));var moment=require(_0xb0cb('0x4'));var BPromise=require(_0xb0cb('0x5'));var rp=require(_0xb0cb('0x6'));var fs=require('fs');var path=require(_0xb0cb('0x7'));var rimraf=require('rimraf');var config=require(_0xb0cb('0x8'));var attributes=require(_0xb0cb('0x9'));module[_0xb0cb('0xa')]=function(_0x15c276,_0x4a0d1a){return _0x15c276[_0xb0cb('0xb')](_0xb0cb('0xc'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index e87d0ec..7b051d2 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 _0xb10b=['../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowTrunk','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5706e4,_0x202c69){var _0x1315eb=function(_0x250a36){while(--_0x250a36){_0x5706e4['push'](_0x5706e4['shift']());}};_0x1315eb(++_0x202c69);}(_0xb10b,0x12a));var _0xbb10=function(_0x4eeca4,_0x5901c9){_0x4eeca4=_0x4eeca4-0x0;var _0x430031=_0xb10b[_0x4eeca4];return _0x430031;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetTrunk',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowTrunk']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowTrunk',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x8603=['result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrunk','debug','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x94a6e6,_0x4bd681){var _0x19a8f6=function(_0x2288a2){while(--_0x2288a2){_0x94a6e6['push'](_0x94a6e6['shift']());}};_0x19a8f6(++_0x4bd681);}(_0x8603,0x190));var _0x3860=function(_0x40e98f,_0x4c3d81){_0x40e98f=_0x40e98f-0x0;var _0x293086=_0x8603[_0x40e98f];return _0x293086;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});}exports[_0x3860('0x12')]=function(_0x45b799){var _0x4b6b15=this;return new Promise(function(_0x4863bd,_0x373b06){return db[_0x3860('0x13')][_0x3860('0x14')]({'raw':_0x45b799['options']?_0x45b799[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x17')]||null:null,'attributes':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x18')]||null:null,'limit':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x19')]||null:null,'include':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x1a')]?_[_0x3860('0x1b')](_0x45b799['options'][_0x3860('0x1a')],function(_0x133093){return{'model':db[_0x133093[_0x3860('0x1c')]],'as':_0x133093['as'],'attributes':_0x133093[_0x3860('0x18')],'include':_0x133093[_0x3860('0x1a')]?_['map'](_0x133093[_0x3860('0x1a')],function(_0x568515){return{'model':db[_0x568515['model']],'as':_0x568515['as'],'attributes':_0x568515[_0x3860('0x18')],'include':_0x568515[_0x3860('0x1a')]?_['map'](_0x568515['include'],function(_0x5f42d5){return{'model':db[_0x5f42d5[_0x3860('0x1c')]],'as':_0x5f42d5['as'],'attributes':_0x5f42d5[_0x3860('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3860('0x9')](function(_0x371f3a){logger[_0x3860('0xf')](_0x3860('0x12'),_0x45b799);logger['debug']('GetTrunk',_0x45b799,JSON[_0x3860('0x1d')](_0x371f3a));_0x4863bd(_0x371f3a);})[_0x3860('0x11')](function(_0x5a9af2){logger[_0x3860('0xd')](_0x3860('0x12'),_0x5a9af2[_0x3860('0xe')],_0x45b799);_0x373b06(_0x4b6b15[_0x3860('0xd')](0x1f4,_0x5a9af2[_0x3860('0xe')]));});});};exports['ShowTrunk']=function(_0x36ae2b){var _0xf624ba=this;return new Promise(function(_0x367b14,_0x4bd90c){return db[_0x3860('0x13')]['find']({'raw':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b['options'][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b[_0x3860('0x15')]['where']||null:null,'attributes':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b[_0x3860('0x15')]['attributes']||null:null,'include':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b['options'][_0x3860('0x1a')]?_[_0x3860('0x1b')](_0x36ae2b[_0x3860('0x15')][_0x3860('0x1a')],function(_0x30dc2a){return{'model':db[_0x30dc2a[_0x3860('0x1c')]],'as':_0x30dc2a['as'],'attributes':_0x30dc2a[_0x3860('0x18')],'include':_0x30dc2a['include']?_[_0x3860('0x1b')](_0x30dc2a[_0x3860('0x1a')],function(_0x4d62e9){return{'model':db[_0x4d62e9[_0x3860('0x1c')]],'as':_0x4d62e9['as'],'attributes':_0x4d62e9[_0x3860('0x18')],'include':_0x4d62e9[_0x3860('0x1a')]?_['map'](_0x4d62e9['include'],function(_0x285b1b){return{'model':db[_0x285b1b[_0x3860('0x1c')]],'as':_0x285b1b['as'],'attributes':_0x285b1b[_0x3860('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3860('0x9')](function(_0x59271f){logger['info'](_0x3860('0x1e'),_0x36ae2b);logger[_0x3860('0x1f')](_0x3860('0x1e'),_0x36ae2b,JSON[_0x3860('0x1d')](_0x59271f));_0x367b14(_0x59271f);})[_0x3860('0x11')](function(_0x4df2a9){logger[_0x3860('0xd')](_0x3860('0x1e'),_0x4df2a9['message'],_0x36ae2b);_0x4bd90c(_0xf624ba['error'](0x1f4,_0x4df2a9[_0x3860('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 66fa043..cff880d 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 _0xadb5=['/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','post','/create_many','bulkCreate','addContacts','addQueues','diskStorage','join','root','server/files/images/','format','now','single','addAvatar','/:id/logout','/:id/pause','pause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addSquareProjects','/:id/api_key','createApiKey','put','update','removeQueues','delete','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/openchannel_interactions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeApiKey','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/:id','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions'];(function(_0x1be421,_0x25a3c1){var _0x5c60ea=function(_0x151258){while(--_0x151258){_0x1be421['push'](_0x1be421['shift']());}};_0x5c60ea(++_0x25a3c1);}(_0xadb5,0xad));var _0x5adb=function(_0x26bfc0,_0x48a63d){_0x26bfc0=_0x26bfc0-0x0;var _0x4ef1b1=_0xadb5[_0x26bfc0];return _0x4ef1b1;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var controller=require(_0x5adb('0x6'));router['get']('/',auth[_0x5adb('0x7')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0xa'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x9')](_0x5adb('0xc'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x9')](_0x5adb('0xe'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xf')]);router['get']('/:id/avatar',controller[_0x5adb('0x10')]);router[_0x5adb('0x9')](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x12')]);router['get'](_0x5adb('0x13'),auth['isAuthenticated'](),controller[_0x5adb('0x14')]);router[_0x5adb('0x9')](_0x5adb('0x15'),auth['isAuthenticated'](),controller[_0x5adb('0x16')]);router[_0x5adb('0x9')](_0x5adb('0x17'),auth['isAuthenticated'](),controller[_0x5adb('0x18')]);router['get'](_0x5adb('0x19'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x1a')]);router[_0x5adb('0x9')](_0x5adb('0x1b'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x1c')]);router[_0x5adb('0x9')](_0x5adb('0x1d'),auth['isAuthenticated'](),controller[_0x5adb('0x1e')]);router['get'](_0x5adb('0x1f'),auth['isAuthenticated'](),controller[_0x5adb('0x20')]);router['get']('/:id/mail/interactions',auth[_0x5adb('0x7')](),controller[_0x5adb('0x21')]);router[_0x5adb('0x9')](_0x5adb('0x22'),auth[_0x5adb('0x7')](),controller['getSmsInteractions']);router[_0x5adb('0x9')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x5adb('0x23')]);router[_0x5adb('0x9')](_0x5adb('0x24'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x25')]);router[_0x5adb('0x9')](_0x5adb('0x26'),auth['isAuthenticated'](),controller[_0x5adb('0x27')]);router[_0x5adb('0x9')](_0x5adb('0x28'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x29')]);router['get'](_0x5adb('0x2a'),auth[_0x5adb('0x7')](),controller['getVoicePrefixes']);router[_0x5adb('0x9')](_0x5adb('0x2b'),auth[_0x5adb('0x7')](),controller['getFaxAccounts']);router[_0x5adb('0x9')](_0x5adb('0x2c'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x2d')]);router[_0x5adb('0x9')](_0x5adb('0x2e'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0x5adb('0x2f'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x30')]);router[_0x5adb('0x9')](_0x5adb('0x31'),auth['isAuthenticated'](),controller[_0x5adb('0x32')]);router[_0x5adb('0x9')](_0x5adb('0x33'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x34')]);router[_0x5adb('0x9')](_0x5adb('0x35'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x36')]);router[_0x5adb('0x9')]('/:id/api_key',auth[_0x5adb('0x7')](),controller['getApiKey']);router[_0x5adb('0x37')](_0x5adb('0x38'),auth['isAuthenticated'](),controller[_0x5adb('0x39')]);router[_0x5adb('0x37')](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x3a')]);router[_0x5adb('0x37')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5adb('0x37')]('/:id/queues',auth[_0x5adb('0x7')](),controller[_0x5adb('0x3b')]);var upload=multer({'storage':multer[_0x5adb('0x3c')]({'destination':function(_0x2da912,_0x9bdece,_0x5ece39){_0x5ece39(null,path[_0x5adb('0x3d')](config[_0x5adb('0x3e')],_0x5adb('0x3f')));},'filename':function(_0x54851b,_0x4c8870,_0x32eb69){_0x32eb69(null,util[_0x5adb('0x40')]('%s-%s',Date[_0x5adb('0x41')](),_0x4c8870['originalname']));}})});router[_0x5adb('0x37')]('/:id/avatar',upload[_0x5adb('0x42')]('file'),controller[_0x5adb('0x43')]);router[_0x5adb('0x37')]('/:id/login',auth[_0x5adb('0x7')](),controller['login']);router[_0x5adb('0x37')](_0x5adb('0x44'),auth[_0x5adb('0x7')](),controller['logout']);router[_0x5adb('0x37')](_0x5adb('0x45'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x46')]);router[_0x5adb('0x37')]('/:id/unpause',auth['isAuthenticated'](),controller['unpause']);router['post'](_0x5adb('0x24'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x47')]);router[_0x5adb('0x37')](_0x5adb('0x48'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x49')]);router[_0x5adb('0x37')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x5adb('0x4a')]);router['post'](_0x5adb('0x4b'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x4c')]);router[_0x5adb('0x37')](_0x5adb('0x4d'),auth['isAuthenticated'](),controller[_0x5adb('0x4e')]);router[_0x5adb('0x37')]('/:id/openchannel_interactions',auth[_0x5adb('0x7')](),controller[_0x5adb('0x4f')]);router['post'](_0x5adb('0x2b'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x50')]);router[_0x5adb('0x37')](_0x5adb('0x2c'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x51')]);router['post']('/:id/openchannel_accounts',auth[_0x5adb('0x7')](),controller[_0x5adb('0x52')]);router[_0x5adb('0x37')](_0x5adb('0x2f'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x5adb('0x37')](_0x5adb('0x31'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x53')]);router[_0x5adb('0x37')]('/:id/square_projects',auth[_0x5adb('0x7')](),controller[_0x5adb('0x54')]);router['post'](_0x5adb('0x55'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x56')]);router[_0x5adb('0x57')](_0x5adb('0xe'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x58')]);router[_0x5adb('0x57')]('/:id/password',auth[_0x5adb('0x7')](),controller['changePassword']);router['delete']('/:id/queues',auth[_0x5adb('0x7')](),controller[_0x5adb('0x59')]);router[_0x5adb('0x5a')]('/:id/teams',auth[_0x5adb('0x7')](),controller['removeTeams']);router[_0x5adb('0x5a')](_0x5adb('0xe'),auth[_0x5adb('0x7')](),controller['destroy']);router[_0x5adb('0x5a')]('/:id/chat_interactions',auth[_0x5adb('0x7')](),controller[_0x5adb('0x5b')]);router['delete'](_0x5adb('0x5c'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x5d')]);router[_0x5adb('0x5a')](_0x5adb('0x4b'),auth['isAuthenticated'](),controller[_0x5adb('0x5e')]);router[_0x5adb('0x5a')](_0x5adb('0x4d'),auth[_0x5adb('0x7')](),controller['removeSmsInteractions']);router[_0x5adb('0x5a')](_0x5adb('0x5f'),auth[_0x5adb('0x7')](),controller['removeOpenchannelInteractions']);router[_0x5adb('0x5a')](_0x5adb('0x2b'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x60')]);router['delete'](_0x5adb('0x2c'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x61')]);router[_0x5adb('0x5a')](_0x5adb('0x2e'),auth['isAuthenticated'](),controller[_0x5adb('0x62')]);router['delete'](_0x5adb('0x2f'),auth['isAuthenticated'](),controller[_0x5adb('0x63')]);router[_0x5adb('0x5a')](_0x5adb('0x31'),auth[_0x5adb('0x7')](),controller['removeChatWebsites']);router[_0x5adb('0x5a')](_0x5adb('0x33'),auth[_0x5adb('0x7')](),controller['removeSquareProjects']);router['delete']('/:id/api_key',auth[_0x5adb('0x7')](),controller[_0x5adb('0x64')]);module[_0x5adb('0x65')]=router; \ No newline at end of file +var _0x7a54=['getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','/create_many','post','addContacts','create','addQueues','join','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','single','addAvatar','login','logout','/:id/pause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','addChatWebsites','addSquareProjects','createApiKey','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','describe','/whoami','/:id','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings'];(function(_0x2e2cad,_0x2dd56c){var _0x41daf0=function(_0x55d4f6){while(--_0x55d4f6){_0x2e2cad['push'](_0x2e2cad['shift']());}};_0x41daf0(++_0x2dd56c);}(_0x7a54,0x106));var _0x47a5=function(_0x59f4f9,_0x332940){_0x59f4f9=_0x59f4f9-0x0;var _0x4dbe1c=_0x7a54[_0x59f4f9];return _0x4dbe1c;};'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['whoami']);router['get'](_0x47a5('0xc'),auth[_0x47a5('0x9')](),controller['show']);router[_0x47a5('0x8')]('/:id/avatar',controller['getAvatar']);router[_0x47a5('0x8')](_0x47a5('0xd'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);router[_0x47a5('0x8')](_0x47a5('0xf'),auth[_0x47a5('0x9')](),controller['getQueues']);router[_0x47a5('0x8')](_0x47a5('0x10'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x8')](_0x47a5('0x12'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x13')]);router['get'](_0x47a5('0x14'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x15')]);router[_0x47a5('0x8')](_0x47a5('0x16'),auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0x47a5('0x8')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x47a5('0x17')]);router[_0x47a5('0x8')](_0x47a5('0x18'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x19')]);router[_0x47a5('0x8')](_0x47a5('0x1a'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x1b')]);router['get'](_0x47a5('0x1c'),auth[_0x47a5('0x9')](),controller['getSmsInteractions']);router[_0x47a5('0x8')](_0x47a5('0x1d'),auth[_0x47a5('0x9')](),controller['getFaxInteractions']);router[_0x47a5('0x8')](_0x47a5('0x1e'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x1f')]);router['get'](_0x47a5('0x20'),auth[_0x47a5('0x9')](),controller['getLists']);router[_0x47a5('0x8')](_0x47a5('0x21'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x22')]);router[_0x47a5('0x8')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x47a5('0x23')]);router['get'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router[_0x47a5('0x8')](_0x47a5('0x26'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x27')]);router[_0x47a5('0x8')](_0x47a5('0x28'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x29')]);router[_0x47a5('0x8')](_0x47a5('0x2a'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x2b')]);router['get'](_0x47a5('0x2c'),auth['isAuthenticated'](),controller[_0x47a5('0x2d')]);router[_0x47a5('0x8')](_0x47a5('0x2e'),auth['isAuthenticated'](),controller[_0x47a5('0x2f')]);router[_0x47a5('0x8')](_0x47a5('0x30'),auth[_0x47a5('0x9')](),controller['getScheduledCalls']);router['get'](_0x47a5('0x31'),auth[_0x47a5('0x9')](),controller['getApiKey']);router['post'](_0x47a5('0x32'),auth[_0x47a5('0x9')](),controller['bulkCreate']);router[_0x47a5('0x33')]('/:id/contacts',auth[_0x47a5('0x9')](),controller[_0x47a5('0x34')]);router['post']('/',auth['isAuthenticated'](),controller[_0x47a5('0x35')]);router['post'](_0x47a5('0xf'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x36')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x18f7e9,_0x50c086,_0x53c754){_0x53c754(null,path[_0x47a5('0x37')](config['root'],_0x47a5('0x38')));},'filename':function(_0x5ef577,_0x21ad34,_0x3534cb){_0x3534cb(null,util[_0x47a5('0x39')](_0x47a5('0x3a'),Date[_0x47a5('0x3b')](),_0x21ad34[_0x47a5('0x3c')]));}})});router[_0x47a5('0x33')](_0x47a5('0x3d'),upload[_0x47a5('0x3e')]('file'),controller[_0x47a5('0x3f')]);router[_0x47a5('0x33')]('/:id/login',auth[_0x47a5('0x9')](),controller[_0x47a5('0x40')]);router[_0x47a5('0x33')]('/:id/logout',auth[_0x47a5('0x9')](),controller[_0x47a5('0x41')]);router['post'](_0x47a5('0x42'),auth[_0x47a5('0x9')](),controller['pause']);router['post']('/:id/unpause',auth[_0x47a5('0x9')](),controller['unpause']);router[_0x47a5('0x33')](_0x47a5('0x1e'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x43')]);router[_0x47a5('0x33')](_0x47a5('0x44'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x45')]);router[_0x47a5('0x33')](_0x47a5('0x46'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x47')]);router[_0x47a5('0x33')]('/:id/fax_interactions',auth[_0x47a5('0x9')](),controller[_0x47a5('0x48')]);router[_0x47a5('0x33')](_0x47a5('0x49'),auth['isAuthenticated'](),controller[_0x47a5('0x4a')]);router['post']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0x47a5('0x33')]('/:id/fax_accounts',auth[_0x47a5('0x9')](),controller[_0x47a5('0x4b')]);router[_0x47a5('0x33')]('/:id/mail_accounts',auth[_0x47a5('0x9')](),controller[_0x47a5('0x4c')]);router['post']('/:id/openchannel_accounts',auth[_0x47a5('0x9')](),controller['addOpenchannelAccounts']);router[_0x47a5('0x33')](_0x47a5('0x2a'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x4d')]);router[_0x47a5('0x33')](_0x47a5('0x2c'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x4e')]);router[_0x47a5('0x33')](_0x47a5('0x2e'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x4f')]);router[_0x47a5('0x33')](_0x47a5('0x31'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x50')]);router['put'](_0x47a5('0xc'),auth[_0x47a5('0x9')](),controller['update']);router['put'](_0x47a5('0x51'),auth['isAuthenticated'](),controller[_0x47a5('0x52')]);router[_0x47a5('0x53')]('/:id/queues',auth['isAuthenticated'](),controller[_0x47a5('0x54')]);router['delete'](_0x47a5('0x1e'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x55')]);router[_0x47a5('0x53')](_0x47a5('0xc'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x56')]);router['delete']('/:id/chat_interactions',auth[_0x47a5('0x9')](),controller[_0x47a5('0x57')]);router[_0x47a5('0x53')](_0x47a5('0x46'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x58')]);router[_0x47a5('0x53')]('/:id/fax_interactions',auth[_0x47a5('0x9')](),controller[_0x47a5('0x59')]);router[_0x47a5('0x53')]('/:id/sms_interactions',auth[_0x47a5('0x9')](),controller['removeSmsInteractions']);router[_0x47a5('0x53')](_0x47a5('0x5a'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x5b')]);router['delete'](_0x47a5('0x24'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x5c')]);router[_0x47a5('0x53')](_0x47a5('0x26'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x5d')]);router['delete'](_0x47a5('0x28'),auth[_0x47a5('0x9')](),controller[_0x47a5('0x5e')]);router[_0x47a5('0x53')](_0x47a5('0x2a'),auth[_0x47a5('0x9')](),controller['removeSmsAccounts']);router[_0x47a5('0x53')](_0x47a5('0x2c'),auth[_0x47a5('0x9')](),controller['removeChatWebsites']);router[_0x47a5('0x53')](_0x47a5('0x2e'),auth[_0x47a5('0x9')](),controller['removeSquareProjects']);router['delete'](_0x47a5('0x31'),auth[_0x47a5('0x9')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 77da261..6dbc08d 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','update,nonat','showWebBar','get','wss','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','icesupport','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x142909,_0x23a9a2){var _0x521370=function(_0x755767){while(--_0x755767){_0x142909['push'](_0x142909['shift']());}};_0x521370(++_0x23a9a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':_0x0a9e('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')]('friend',_0x0a9e('0xc'),_0x0a9e('0x16')),'allowNull':!![],'defaultValue':_0x0a9e('0x17')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x19'),_0x0a9e('0x1a'),'ALLOWED_FAILED_SCREEN',_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x2e8759){this[_0x0a9e('0x4')]('transport',_0x2e8759?_0x2e8759[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28')),'allowNull':!![],'defaultValue':_0x0a9e('0x24')},'directmedia':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0xd1836d){this[_0x0a9e('0x4')](_0x0a9e('0x2c'),_0xd1836d?_0xd1836d['join'](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this['getDataValue'](_0x0a9e('0x2c'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x2d')},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':_0x0a9e('0x2e')},'allow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x546ef8){this[_0x0a9e('0x4')](_0x0a9e('0x2f'),_0x546ef8?_0x546ef8['join'](';'):_0x0a9e('0x30'));},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x2f'))?this[_0x0a9e('0x8')]('allow')['split'](';'):null;},'comment':_0x0a9e('0x31')},'autoframing':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x1dec2e){this[_0x0a9e('0x4')]('insecure',_0x1dec2e?_0x1dec2e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x32'))?this[_0x0a9e('0x8')](_0x0a9e('0x32'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x33')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no',_0x0a9e('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x35')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x3a'),'uas'),'allowNull':!![],'defaultValue':_0x0a9e('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no',_0x0a9e('0x3c'),_0x0a9e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),_0x0a9e('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x0a9e('0x13')]},'showWebBar':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0,'set':function(_0x5d86e9){this[_0x0a9e('0x4')](_0x0a9e('0x40'),_0x5d86e9);var _0x5239ef=this[_0x0a9e('0x41')]({'plain':!![]});switch(_0x5d86e9){case 0x0:case 0x1:var _0x5cc8fb=_0x5239ef[_0x0a9e('0x21')]?_['isArray'](_0x5239ef['transport'])?_0x5239ef['transport'][_0x0a9e('0x20')]():_0x5239ef['transport']:_0x0a9e('0x1f');if(_0x5cc8fb===_0x0a9e('0x42')){_0x5cc8fb=_0x0a9e('0x1f');}this[_0x0a9e('0x4')](_0x0a9e('0x21'),_0x5cc8fb);this[_0x0a9e('0x4')]('encryption','no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('icesupport',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this['setDataValue'](_0x0a9e('0x46'),null);this[_0x0a9e('0x4')]('dtlscertfile',null);this[_0x0a9e('0x4')](_0x0a9e('0x47'),null);this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x42'));this[_0x0a9e('0x4')](_0x0a9e('0x49'),'yes');this[_0x0a9e('0x4')]('avpf','yes');this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x4a'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x45'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x4b'));this[_0x0a9e('0x4')](_0x0a9e('0x4c'),_0x5239ef[_0x0a9e('0x4c')]||_0x0a9e('0x4d'));this['setDataValue'](_0x0a9e('0x47'),_0x5239ef[_0x0a9e('0x47')]||_0x0a9e('0x4e'));this['setDataValue'](_0x0a9e('0x48'),_0x0a9e('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x83f0b2){this[_0x0a9e('0x4')](_0x0a9e('0x4f'),_0x83f0b2?_0x83f0b2[_0x0a9e('0x20')](','):[]);},'get':function(){return this[_0x0a9e('0x8')]('permissions')?_['map'](this['getDataValue'](_0x0a9e('0x4f'))[_0x0a9e('0x22')](','),function(_0x1104ad){return parseInt(_0x1104ad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0a9e('0x3')]},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x50'))?this[_0x0a9e('0x8')](_0x0a9e('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x30a4c7){if(typeof _0x30a4c7===_0x0a9e('0x51')){var _0x332367=_0x30a4c7==='1'?!![]:_0x30a4c7==='0'?![]:_0x30a4c7===_0x0a9e('0x52')?!![]:_0x30a4c7===_0x0a9e('0x53')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x332367);}else{this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x30a4c7);}}},'blocked':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x25744a){this[_0x0a9e('0x4')]('blocked',_0x25744a);if(_0x25744a===!![]){this[_0x0a9e('0x4')](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')]('loginAttempts',0x0);}else{this[_0x0a9e('0x4')](_0x0a9e('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa9e0=['\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','update,nonat','showWebBar','get','wss','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','icesupport','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x3dad7f,_0x1f0244){var _0x43cea6=function(_0x2928db){while(--_0x2928db){_0x3dad7f['push'](_0x3dad7f['shift']());}};_0x43cea6(++_0x1f0244);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':_0x0a9e('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')]('friend',_0x0a9e('0xc'),_0x0a9e('0x16')),'allowNull':!![],'defaultValue':_0x0a9e('0x17')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x19'),_0x0a9e('0x1a'),'ALLOWED_FAILED_SCREEN',_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x2e8759){this[_0x0a9e('0x4')]('transport',_0x2e8759?_0x2e8759[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28')),'allowNull':!![],'defaultValue':_0x0a9e('0x24')},'directmedia':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0xd1836d){this[_0x0a9e('0x4')](_0x0a9e('0x2c'),_0xd1836d?_0xd1836d['join'](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this['getDataValue'](_0x0a9e('0x2c'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x2d')},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':_0x0a9e('0x2e')},'allow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x546ef8){this[_0x0a9e('0x4')](_0x0a9e('0x2f'),_0x546ef8?_0x546ef8['join'](';'):_0x0a9e('0x30'));},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x2f'))?this[_0x0a9e('0x8')]('allow')['split'](';'):null;},'comment':_0x0a9e('0x31')},'autoframing':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x1dec2e){this[_0x0a9e('0x4')]('insecure',_0x1dec2e?_0x1dec2e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x32'))?this[_0x0a9e('0x8')](_0x0a9e('0x32'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x33')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no',_0x0a9e('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x35')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x3a'),'uas'),'allowNull':!![],'defaultValue':_0x0a9e('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no',_0x0a9e('0x3c'),_0x0a9e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),_0x0a9e('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x0a9e('0x13')]},'showWebBar':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0,'set':function(_0x5d86e9){this[_0x0a9e('0x4')](_0x0a9e('0x40'),_0x5d86e9);var _0x5239ef=this[_0x0a9e('0x41')]({'plain':!![]});switch(_0x5d86e9){case 0x0:case 0x1:var _0x5cc8fb=_0x5239ef[_0x0a9e('0x21')]?_['isArray'](_0x5239ef['transport'])?_0x5239ef['transport'][_0x0a9e('0x20')]():_0x5239ef['transport']:_0x0a9e('0x1f');if(_0x5cc8fb===_0x0a9e('0x42')){_0x5cc8fb=_0x0a9e('0x1f');}this[_0x0a9e('0x4')](_0x0a9e('0x21'),_0x5cc8fb);this[_0x0a9e('0x4')]('encryption','no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('icesupport',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this['setDataValue'](_0x0a9e('0x46'),null);this[_0x0a9e('0x4')]('dtlscertfile',null);this[_0x0a9e('0x4')](_0x0a9e('0x47'),null);this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x42'));this[_0x0a9e('0x4')](_0x0a9e('0x49'),'yes');this[_0x0a9e('0x4')]('avpf','yes');this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x4a'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x45'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x4b'));this[_0x0a9e('0x4')](_0x0a9e('0x4c'),_0x5239ef[_0x0a9e('0x4c')]||_0x0a9e('0x4d'));this['setDataValue'](_0x0a9e('0x47'),_0x5239ef[_0x0a9e('0x47')]||_0x0a9e('0x4e'));this['setDataValue'](_0x0a9e('0x48'),_0x0a9e('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x83f0b2){this[_0x0a9e('0x4')](_0x0a9e('0x4f'),_0x83f0b2?_0x83f0b2[_0x0a9e('0x20')](','):[]);},'get':function(){return this[_0x0a9e('0x8')]('permissions')?_['map'](this['getDataValue'](_0x0a9e('0x4f'))[_0x0a9e('0x22')](','),function(_0x1104ad){return parseInt(_0x1104ad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0a9e('0x3')]},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x50'))?this[_0x0a9e('0x8')](_0x0a9e('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x30a4c7){if(typeof _0x30a4c7===_0x0a9e('0x51')){var _0x332367=_0x30a4c7==='1'?!![]:_0x30a4c7==='0'?![]:_0x30a4c7===_0x0a9e('0x52')?!![]:_0x30a4c7===_0x0a9e('0x53')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x332367);}else{this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x30a4c7);}}},'blocked':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x25744a){this[_0x0a9e('0x4')]('blocked',_0x25744a);if(_0x25744a===!![]){this[_0x0a9e('0x4')](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')]('loginAttempts',0x0);}else{this[_0x0a9e('0x4')](_0x0a9e('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 1fb0b02..b63d0f2 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 _0xd509=['capitalize','Queues','penalty','toLowerCase','QueueId','emit','voice','VoiceQueue','push','interface','format','SIP/%s','voicePause','each','UserVoiceQueueRt','upsert','removeQueues','Queue:remove','addAvatar','file','filename','getAvatar','server/files/images/logos/default_profile.png','userpic','download','existsSync','join','root','server/files/images/','getContacts','filter','CmList','Tag','Tags','color','tag','getQueues','findOne','isValidChannel','Queue','admin','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','user:%s','user:forcelogout','headers','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','mailPause','chatPause','openchannelPause','smsPause','pauseType','lastPauseAt','unpause','manual','mail','chat','fax','sms','set','%s%s','Pause','getTeams','addTeams','omit','Team','getVoiceQueues','setDataValue','Voice','getChatQueues','Chat','Mail','Sms','Fax','flatten','transaction','addAgent','getDataValue','Queue:save','removeTeams','getMailQueues','getSmsQueues','removeAgent','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','concat','$and','$or','$gt','$gte','$lte','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','firstName','lastName','getApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','apiKeyNonce','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./user.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','get','Users','Agents','agent','Telephones','telephone','ignore','map','value','includes','role','find','UserProfileResource','stack','name','send','User','rawAttributes','model','differenceBy','password','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','sequelize','lower','col','options','includeAll','include','findAll','rows','show','params','salt','bulkCreate','body','describe','addContacts','ids','agent\x20role','user','../../config/license/util','getLicense','telephones','isNil','License\x20limit\x20reached','count\x20%s:\x20%s','create','findById','securePassword','min_internal','internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','101','102','103','110','104','105','107','108','100','111','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','Setting','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Unauthorized','channel','online','loginInPause','Unknown\x20channel','add'];(function(_0x2fed84,_0x400ba7){var _0x3e1f31=function(_0x56356d){while(--_0x56356d){_0x2fed84['push'](_0x2fed84['shift']());}};_0x3e1f31(++_0x400ba7);}(_0xd509,0xc9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9d50('0x0'));var zipdir=require(_0x9d50('0x1'));var jsonpatch=require(_0x9d50('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9d50('0x3'));var Mustache=require(_0x9d50('0x4'));var util=require('util');var path=require(_0x9d50('0x5'));var sox=require(_0x9d50('0x6'));var csv=require(_0x9d50('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9d50('0x8'));var squel=require('squel');var crypto=require(_0x9d50('0x9'));var jsforce=require(_0x9d50('0xa'));var deskjs=require(_0x9d50('0xb'));var toCsv=require(_0x9d50('0x7'));var querystring=require(_0x9d50('0xc'));var Papa=require('papaparse');var Redis=require(_0x9d50('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9d50('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d50('0xf'))(_0x9d50('0x10'));var utils=require(_0x9d50('0x11'));var config=require(_0x9d50('0x12'));var db=require(_0x9d50('0x13'))['db'];config[_0x9d50('0x14')]=_[_0x9d50('0x15')](config['redis'],{'host':_0x9d50('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d50('0x14')]));require(_0x9d50('0x17'))[_0x9d50('0x18')](socket);var jayson=require(_0x9d50('0x19'));var client=jayson[_0x9d50('0x1a')][_0x9d50('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x339598,_0x3c115b,_0x25f253){if(_0x25f253){var _0x304b42=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x304b42[_0x9d50('0x1c')](_0x3c115b)){return _0x339598;}else{throw new db[(_0x9d50('0x1d'))]['ValidationError'](_0x9d50('0x1e'));}}else{return _0x339598;}}function respondWithRpcPromise(_0xb89da2,_0xa326fa,_0x1df08b,_0x9c4cbd){return new BPromise(function(_0x407944,_0x437462){var _0x340bac=_0x9c4cbd||client;return _0x340bac[_0x9d50('0x1f')](_0xb89da2,_0x1df08b)[_0x9d50('0x20')](function(_0x2965a3){logger[_0x9d50('0x21')](_0x9d50('0x22'),_0xa326fa,_0x9d50('0x23'));logger[_0x9d50('0x24')](_0x9d50('0x25'),_0xa326fa,_0x9d50('0x23'),JSON[_0x9d50('0x26')](_0x2965a3));if(_0x2965a3[_0x9d50('0x27')]){if(_0x2965a3[_0x9d50('0x27')][_0x9d50('0x28')]===0x1f4){logger[_0x9d50('0x27')](_0x9d50('0x22'),_0xa326fa,_0x2965a3['error'][_0x9d50('0x29')]);return _0x437462(_0x2965a3[_0x9d50('0x27')][_0x9d50('0x29')]);}logger[_0x9d50('0x27')](_0x9d50('0x22'),_0xa326fa,_0x2965a3[_0x9d50('0x27')][_0x9d50('0x29')]);return _0x407944(_0x2965a3[_0x9d50('0x27')][_0x9d50('0x29')]);}else{logger['info'](_0x9d50('0x22'),_0xa326fa,'request\x20sent');_0x407944(_0x2965a3['result'][_0x9d50('0x29')]);}})[_0x9d50('0x2a')](function(_0x31420b){logger[_0x9d50('0x27')]('User,\x20%s,\x20%s',_0xa326fa,_0x31420b);_0x437462(_0x31420b);});});}function respondWithStatusCode(_0x9623aa,_0x161c34){_0x161c34=_0x161c34||0xcc;return function(_0x5ce77a){if(_0x5ce77a){return _0x9623aa[_0x9d50('0x2b')](_0x161c34);}return _0x9623aa['status'](_0x161c34)[_0x9d50('0x2c')]();};}function respondWithResult(_0x460420,_0x40f8bd){_0x40f8bd=_0x40f8bd||0xc8;return function(_0x5b3642){if(_0x5b3642){return _0x460420[_0x9d50('0x2d')](_0x40f8bd)['json'](_0x5b3642);}};}function respondWithFilteredResult(_0x1d5a64,_0xfa52aa){return function(_0x1bb403){if(_0x1bb403){var _0xa71c61=_0x1bb403[_0x9d50('0x2e')],_0x282493=_0xfa52aa[_0x9d50('0x2f')],_0x72dda2=_0xfa52aa['offset']+_0xfa52aa[_0x9d50('0x30')],_0x22f811;if(_0x72dda2>=_0xa71c61){_0x72dda2=_0xa71c61;_0x22f811=0xc8;}else{_0x22f811=0xce;}_0x1d5a64['status'](_0x22f811);return _0x1d5a64['set'](_0x9d50('0x31'),_0x282493+'-'+_0x72dda2+'/'+_0xa71c61)[_0x9d50('0x32')](_0x1bb403);}return null;};}function patchUpdates(_0x15d4cc){return function(_0x5e2854){try{jsonpatch[_0x9d50('0x33')](_0x5e2854,_0x15d4cc,!![]);}catch(_0x132e1c){return BPromise[_0x9d50('0x34')](_0x132e1c);}return _0x5e2854[_0x9d50('0x35')]();};}function saveUpdates(_0x114662,_0x1b3917){return function(_0x1f66bd){if(_0x1f66bd){return _0x1f66bd[_0x9d50('0x36')](_0x114662)[_0x9d50('0x20')](function(_0x2d289a){return _0x2d289a;});}return null;};}function removeEntity(_0x9d85f0,_0x1cc6cb){return function(_0x251d33){if(_0x251d33){return _0x251d33[_0x9d50('0x37')]()[_0x9d50('0x20')](function(){var _0x487794=_0x251d33[_0x9d50('0x38')]({'plain':!![]});var _0x554874=[{'name':_0x9d50('0x39'),'value':'user','ignore':!![]},{'name':_0x9d50('0x3a'),'value':_0x9d50('0x3b'),'ignore':![]},{'name':_0x9d50('0x3c'),'value':_0x9d50('0x3d'),'ignore':![]}];var _0x1296e3=_(_0x554874)['filter'](_0x9d50('0x3e'))[_0x9d50('0x3f')](_0x9d50('0x40'))[_0x9d50('0x40')]();if(_[_0x9d50('0x41')](_0x1296e3,_0x487794[_0x9d50('0x42')])){return;}var _0x429d01=_[_0x9d50('0x43')](_0x554874,['value',_0x487794[_0x9d50('0x42')]])['name'];return db[_0x9d50('0x44')][_0x9d50('0x37')]({'where':{'type':_0x429d01,'resourceId':_0x487794['id']}})[_0x9d50('0x20')](function(){return _0x251d33;});})[_0x9d50('0x20')](function(){_0x9d85f0[_0x9d50('0x2d')](0xcc)[_0x9d50('0x2c')]();});}};}function handleEntityNotFound(_0x58b051,_0x5c5b94){return function(_0x3305f0){if(!_0x3305f0){_0x58b051[_0x9d50('0x2b')](0x194);}return _0x3305f0;};}function handleError(_0x365700,_0x1ab6f3){_0x1ab6f3=_0x1ab6f3||0x1f4;return function(_0x1f0b1f){logger[_0x9d50('0x27')](_0x1f0b1f[_0x9d50('0x45')]);if(_0x1f0b1f[_0x9d50('0x46')]){delete _0x1f0b1f[_0x9d50('0x46')];}_0x365700[_0x9d50('0x2d')](_0x1ab6f3)[_0x9d50('0x47')](_0x1f0b1f);};}exports['index']=function(_0x1ce5b9,_0xeba9ae){var _0x4d1140={},_0x14e4a7={},_0x436cb5={'count':0x0,'rows':[]};var _0x22a005=_[_0x9d50('0x3f')](db[_0x9d50('0x48')][_0x9d50('0x49')],function(_0x3bea37){return{'name':_0x3bea37['fieldName'],'type':_0x3bea37['type']['key']};});_0x14e4a7[_0x9d50('0x4a')]=_[_0x9d50('0x4b')](_[_0x9d50('0x3f')](_0x22a005,_0x9d50('0x46')),[_0x9d50('0x4c'),'salt']);_0x14e4a7['query']=_[_0x9d50('0x4d')](_0x1ce5b9[_0x9d50('0x4e')]);_0x14e4a7[_0x9d50('0x4f')]=_[_0x9d50('0x50')](_0x14e4a7[_0x9d50('0x4a')],_0x14e4a7[_0x9d50('0x4e')]);_0x4d1140[_0x9d50('0x51')]=_[_0x9d50('0x50')](_0x14e4a7[_0x9d50('0x4a')],qs[_0x9d50('0x52')](_0x1ce5b9['query'][_0x9d50('0x52')]));_0x4d1140[_0x9d50('0x51')]=_0x4d1140[_0x9d50('0x51')][_0x9d50('0x53')]?_0x4d1140[_0x9d50('0x51')]:_0x14e4a7['model'];if(!_0x1ce5b9['query'][_0x9d50('0x54')](_0x9d50('0x55'))){_0x4d1140[_0x9d50('0x30')]=qs[_0x9d50('0x30')](_0x1ce5b9[_0x9d50('0x4e')]['limit']);_0x4d1140[_0x9d50('0x2f')]=qs[_0x9d50('0x2f')](_0x1ce5b9['query'][_0x9d50('0x2f')]);}_0x4d1140[_0x9d50('0x56')]=qs['sort'](_0x1ce5b9['query'][_0x9d50('0x57')]);_0x4d1140[_0x9d50('0x58')]=qs[_0x9d50('0x4f')](_[_0x9d50('0x59')](_0x1ce5b9['query'],_0x14e4a7['filters']));if(_0x1ce5b9[_0x9d50('0x4e')]['filter']){_0x4d1140['where']=_[_0x9d50('0x5a')](_0x4d1140[_0x9d50('0x58')],{'$or':_['map'](_0x22a005,function(_0x4a4f90){if(_0x4a4f90[_0x9d50('0x5b')]!==_0x9d50('0x5c')){return db[_0x9d50('0x5d')]['where'](db[_0x9d50('0x5d')]['fn'](_0x9d50('0x5e'),db['sequelize'][_0x9d50('0x5f')](_0x4a4f90['name'])),{'$like':db[_0x9d50('0x5d')]['fn']('lower','%'+_0x1ce5b9[_0x9d50('0x4e')]['filter']+'%')});}})});}_0x4d1140=_[_0x9d50('0x5a')]({},_0x4d1140,_0x1ce5b9[_0x9d50('0x60')]);var _0x40dc97={'where':_0x4d1140[_0x9d50('0x58')]};return db['User'][_0x9d50('0x2e')](_0x40dc97)[_0x9d50('0x20')](function(_0x2fa9f7){_0x436cb5[_0x9d50('0x2e')]=_0x2fa9f7;if(_0x1ce5b9[_0x9d50('0x4e')][_0x9d50('0x61')]){_0x4d1140[_0x9d50('0x62')]=[{'all':!![]}];}return db[_0x9d50('0x48')][_0x9d50('0x63')](_0x4d1140);})['then'](function(_0x478c1c){_0x436cb5[_0x9d50('0x64')]=_0x478c1c;return _0x436cb5;})['then'](respondWithFilteredResult(_0xeba9ae,_0x4d1140))[_0x9d50('0x2a')](handleError(_0xeba9ae,null));};exports[_0x9d50('0x65')]=function(_0x4d469d,_0x5f5dc7){var _0x55bbf0={'raw':![],'where':{'id':_0x4d469d[_0x9d50('0x66')]['id']}},_0x171a65={};_0x171a65[_0x9d50('0x4a')]=_[_0x9d50('0x4b')](_[_0x9d50('0x4d')](db['User'][_0x9d50('0x49')]),['password',_0x9d50('0x67')]);_0x171a65[_0x9d50('0x4e')]=_[_0x9d50('0x4d')](_0x4d469d[_0x9d50('0x4e')]);_0x171a65[_0x9d50('0x4f')]=_[_0x9d50('0x50')](_0x171a65['model'],_0x171a65[_0x9d50('0x4e')]);_0x55bbf0[_0x9d50('0x51')]=_[_0x9d50('0x50')](_0x171a65[_0x9d50('0x4a')],qs[_0x9d50('0x52')](_0x4d469d[_0x9d50('0x4e')][_0x9d50('0x52')]));_0x55bbf0[_0x9d50('0x51')]=_0x55bbf0['attributes'][_0x9d50('0x53')]?_0x55bbf0['attributes']:_0x171a65['model'];if(_0x4d469d[_0x9d50('0x4e')]['includeAll']){_0x55bbf0[_0x9d50('0x62')]=[{'all':!![]}];}_0x55bbf0=_[_0x9d50('0x5a')]({},_0x55bbf0,_0x4d469d['options']);return db[_0x9d50('0x48')][_0x9d50('0x43')](_0x55bbf0)['then'](handleEntityNotFound(_0x5f5dc7,null))['then'](respondWithResult(_0x5f5dc7,null))[_0x9d50('0x2a')](handleError(_0x5f5dc7,null));};exports[_0x9d50('0x68')]=function(_0x44c6ce,_0x22d904){return db[_0x9d50('0x48')]['bulkCreate'](_0x44c6ce[_0x9d50('0x69')],{'raw':![],'individualHooks':!![]})[_0x9d50('0x20')](respondWithResult(_0x22d904,0xc9))['catch'](handleError(_0x22d904,null));};exports[_0x9d50('0x36')]=function(_0x746831,_0x24105e){if(_0x746831[_0x9d50('0x69')]['id']){delete _0x746831[_0x9d50('0x69')]['id'];}delete _0x746831[_0x9d50('0x69')][_0x9d50('0x42')];return db[_0x9d50('0x48')][_0x9d50('0x43')]({'where':{'id':_0x746831[_0x9d50('0x66')]['id']}})[_0x9d50('0x20')](handleEntityNotFound(_0x24105e,null))['then'](saveUpdates(_0x746831['body'],null))[_0x9d50('0x20')](respondWithResult(_0x24105e,null))[_0x9d50('0x2a')](handleError(_0x24105e,null));};exports[_0x9d50('0x6a')]=function(_0x2c6d6d,_0x19da59){return db[_0x9d50('0x48')][_0x9d50('0x6a')]()[_0x9d50('0x20')](respondWithResult(_0x19da59,null))[_0x9d50('0x2a')](handleError(_0x19da59,null));};exports[_0x9d50('0x6b')]=function(_0x4de512,_0x404165,_0x3380f2){return db[_0x9d50('0x48')][_0x9d50('0x43')]({'where':{'id':_0x4de512[_0x9d50('0x66')]['id']}})[_0x9d50('0x20')](handleEntityNotFound(_0x404165,null))[_0x9d50('0x20')](function(_0x1b1ee3){if(_0x1b1ee3){return _0x1b1ee3['addContacts'](_0x4de512['body'][_0x9d50('0x6c')],_['omit'](_0x4de512[_0x9d50('0x69')],[_0x9d50('0x6c'),'id'])||{});}})[_0x9d50('0x20')](respondWithResult(_0x404165,null))['catch'](handleError(_0x404165,null));};var getLicense=function(_0x1bfc57){return new BPromise(function(_0x12fbc3,_0x5d2ddc){var _0xcd22c3=0x0;_0x1bfc57['body'][_0x9d50('0x42')]==='agent'&&_0x12fbc3(_0x9d50('0x6d'));return db[_0x9d50('0x48')][_0x9d50('0x2e')]({'where':{'$or':[{'role':_0x1bfc57['body'][_0x9d50('0x42')]===_0x9d50('0x3d')?'telephone':['admin',_0x9d50('0x6e')]}]}})['then'](function(_0x9829db){_0xcd22c3=_0x9829db;return require(_0x9d50('0x6f'))[_0x9d50('0x70')]();})['then'](function(_0x5a6746){var _0x371fbf=_0x1bfc57[_0x9d50('0x69')][_0x9d50('0x42')]===_0x9d50('0x3d')?_0x9d50('0x71'):'users';if(!_[_0x9d50('0x72')](_0x5a6746[_0x371fbf])&&_0xcd22c3>=_0x5a6746[_0x371fbf]){return _0x5d2ddc({'message':_0x9d50('0x73')});}return _0x12fbc3(util['format'](_0x9d50('0x74'),_0x371fbf,_0xcd22c3));})[_0x9d50('0x2a')](function(_0xd135be){return _0x5d2ddc(_0xd135be);});});};exports[_0x9d50('0x75')]=function(_0x3ca323,_0x17949b){return getLicense(_0x3ca323)[_0x9d50('0x20')](function(_0x3d1540){if(!_0x3ca323[_0x9d50('0x69')]['internal']){var _0x2e17e6;return db['Setting'][_0x9d50('0x76')](0x1)[_0x9d50('0x20')](function(_0x29ccde){return checkPasswordPattern(_0x29ccde,_0x3ca323[_0x9d50('0x69')][_0x9d50('0x4c')],_0x29ccde[_0x9d50('0x77')]);})[_0x9d50('0x20')](function(_0x2a93ff){_0x2e17e6=_0x2a93ff[_0x9d50('0x78')];return db[_0x9d50('0x48')]['max'](_0x9d50('0x79'));})[_0x9d50('0x20')](function(_0x51d4e1){if(_[_0x9d50('0x72')](_0x51d4e1)){if(_0x2e17e6){_0x3ca323['body']['internal']=_0x2e17e6;}else{_0x3ca323[_0x9d50('0x69')]['internal']=0x1;}}else{if(_[_0x9d50('0x72')](_0x2e17e6)||_0x2e17e6==_0x51d4e1){_0x3ca323[_0x9d50('0x69')][_0x9d50('0x79')]=_0x51d4e1+0x1;}else if(_0x2e17e6>_0x51d4e1){_0x3ca323[_0x9d50('0x69')][_0x9d50('0x79')]=_0x2e17e6;}else{return db['sequelize'][_0x9d50('0x4e')](_0x9d50('0x7a'),{'type':db[_0x9d50('0x5d')][_0x9d50('0x7b')][_0x9d50('0x7c')]})[_0x9d50('0x20')](function(_0x1a3cdd){if(_0x1a3cdd&&_0x1a3cdd[_0x9d50('0x53')]){for(var _0x378d40=0x0,_0x2f0df6=_0x1a3cdd[_0x9d50('0x53')];_0x378d40<_0x2f0df6&&_[_0x9d50('0x72')](_0x3ca323['body'][_0x9d50('0x79')]);_0x378d40++){if(_0x2e17e6<=_0x1a3cdd[_0x378d40][_0x9d50('0x7d')]){_0x3ca323['body'][_0x9d50('0x79')]=_0x1a3cdd[_0x378d40][_0x9d50('0x7d')];}else if(_0x2e17e6>_0x1a3cdd[_0x378d40][_0x9d50('0x7d')]&&_0x2e17e6<=_0x1a3cdd[_0x378d40]['to']){_0x3ca323[_0x9d50('0x69')][_0x9d50('0x79')]=_0x2e17e6;}}}if(_['isNil'](_0x3ca323[_0x9d50('0x69')][_0x9d50('0x79')])){_0x3ca323[_0x9d50('0x69')][_0x9d50('0x79')]=_0x51d4e1+0x1;}});}}});}})[_0x9d50('0x20')](function(){if(_0x3ca323[_0x9d50('0x69')][_0x9d50('0x7e')]){_0x3ca323[_0x9d50('0x69')][_0x9d50('0x7f')]=_0x3ca323['body']['internal'];_0x3ca323['body'][_0x9d50('0x80')]={'mailbox':_0x3ca323['body'][_0x9d50('0x79')],'password':_0x3ca323[_0x9d50('0x69')][_0x9d50('0x4c')],'fullname':_0x3ca323[_0x9d50('0x69')][_0x9d50('0x81')],'email':_0x3ca323[_0x9d50('0x69')][_0x9d50('0x82')]};}if(_0x3ca323['body']&&_0x3ca323[_0x9d50('0x69')]['role']===_0x9d50('0x3b')){_0x3ca323[_0x9d50('0x69')]['permissions']=[_0x9d50('0x83'),_0x9d50('0x84'),_0x9d50('0x85'),_0x9d50('0x86'),_0x9d50('0x87'),_0x9d50('0x88'),'106',_0x9d50('0x89'),_0x9d50('0x8a'),'109',_0x9d50('0x8b'),_0x9d50('0x8c')];}return db[_0x9d50('0x48')][_0x9d50('0x75')](_0x3ca323['body'],{'include':[{'model':db['VoiceMail'],'as':_0x9d50('0x80')}]});})[_0x9d50('0x20')](function(_0x305f19){if(_0x3ca323[_0x9d50('0x69')][_0x9d50('0x42')]===_0x9d50('0x6e'))return _0x305f19;var _0x3a354e=_0x3ca323[_0x9d50('0x6e')][_0x9d50('0x38')]({'plain':!![]});if(!_0x3a354e)throw new Error(_0x9d50('0x8d'));if(_0x3a354e[_0x9d50('0x42')]===_0x9d50('0x6e')){var _0x55a6f4=_0x305f19[_0x9d50('0x38')]({'plain':!![]});var _0x36a98a=[{'name':_0x9d50('0x3a'),'value':_0x9d50('0x3b')},{'name':'Telephones','value':_0x9d50('0x3d')}];var _0x282740=_[_0x9d50('0x43')](_0x36a98a,['value',_0x55a6f4['role']])[_0x9d50('0x46')];return db[_0x9d50('0x8e')][_0x9d50('0x43')]({'where':{'name':_0x282740,'userProfileId':_0x3a354e[_0x9d50('0x8f')]},'raw':!![]})[_0x9d50('0x20')](function(_0x2c50d4){if(_0x2c50d4&&_0x2c50d4[_0x9d50('0x90')]===0x0){return db['UserProfileResource'][_0x9d50('0x75')]({'name':_0x55a6f4[_0x9d50('0x46')],'resourceId':_0x55a6f4['id'],'type':_0x2c50d4[_0x9d50('0x46')],'sectionId':_0x2c50d4['id']},{})['then'](function(){return _0x305f19;});}else{return _0x305f19;}})[_0x9d50('0x2a')](function(_0x43ff2c){logger['error'](_0x9d50('0x91'),_0x43ff2c);throw _0x43ff2c;});}return _0x305f19;})[_0x9d50('0x20')](respondWithResult(_0x17949b,0xc9))[_0x9d50('0x2a')](handleError(_0x17949b,null));};exports[_0x9d50('0x92')]=function(_0x4b689d,_0x40ae74,_0x169f58){var _0x2693a9=![];if(_0x4b689d[_0x9d50('0x69')]['id']){delete _0x4b689d['body']['id'];}return db[_0x9d50('0x93')]['findOne']({'attributes':['id',_0x9d50('0x77')]})[_0x9d50('0x20')](function(_0x1f45f0){_0x2693a9=_0x1f45f0[_0x9d50('0x77')];return db[_0x9d50('0x48')][_0x9d50('0x43')]({'where':{'id':_0x4b689d[_0x9d50('0x66')]['id']}});})[_0x9d50('0x20')](function(_0x117a9a){if(_0x117a9a){if(_0x117a9a['id']==_0x4b689d[_0x9d50('0x6e')]['id']){if(!_0x4b689d[_0x9d50('0x69')][_0x9d50('0x94')]||!_0x4b689d['body'][_0x9d50('0x95')]){throw new db[(_0x9d50('0x1d'))][(_0x9d50('0x96'))](_0x9d50('0x97'));}if(!_0x117a9a[_0x9d50('0x98')](_0x4b689d[_0x9d50('0x69')][_0x9d50('0x94')])){throw new db['Sequelize'][(_0x9d50('0x96'))](_0x9d50('0x99'));}if(_0x4b689d[_0x9d50('0x69')][_0x9d50('0x94')]==_0x4b689d[_0x9d50('0x69')][_0x9d50('0x95')]){throw new db['Sequelize'][(_0x9d50('0x96'))](_0x9d50('0x9a'));}return _0x117a9a;}else if(_0x4b689d[_0x9d50('0x6e')][_0x9d50('0x42')]=='admin'){if(!_0x4b689d[_0x9d50('0x69')][_0x9d50('0x95')]){throw new db[(_0x9d50('0x1d'))][(_0x9d50('0x96'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x117a9a;}else if(_0x4b689d[_0x9d50('0x6e')][_0x9d50('0x42')]==_0x9d50('0x6e')){if(!_0x4b689d['body'][_0x9d50('0x95')]){throw new db[(_0x9d50('0x1d'))][(_0x9d50('0x96'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x117a9a[_0x9d50('0x42')]!=_0x9d50('0x3b')){throw new db['Sequelize'][(_0x9d50('0x96'))](_0x9d50('0x9b'));}return _0x117a9a;}else{throw new db[(_0x9d50('0x1d'))][(_0x9d50('0x96'))](_0x9d50('0x9b'));}}return null;})['then'](handleEntityNotFound(_0x40ae74,null))[_0x9d50('0x20')](function(_0x304aba){return checkPasswordPattern(_0x304aba,_0x4b689d[_0x9d50('0x69')][_0x9d50('0x95')],_0x2693a9);})['then'](saveUpdates({'password':_0x4b689d[_0x9d50('0x69')][_0x9d50('0x95')],'passwordResetAt':_0x4b689d[_0x9d50('0x6e')]['id']==_0x4b689d[_0x9d50('0x66')]['id']?moment():null},null))[_0x9d50('0x20')](respondWithResult(_0x40ae74,null))[_0x9d50('0x2a')](handleError(_0x40ae74,null));};exports['addQueues']=function(_0x5c9003,_0xc86f35,_0x463fcf){var _0x3e4327=_0x5c9003[_0x9d50('0x69')][_0x9d50('0x9c')];return db[_0x9d50('0x48')][_0x9d50('0x43')]({'where':{'id':_0x5c9003[_0x9d50('0x66')]['id']},'attributes':['id',_0x9d50('0x46'),'role',_0x9d50('0x9d'),_0x9d50('0x9e'),'voicePause','interface']})['then'](handleEntityNotFound(_0xc86f35,null))[_0x9d50('0x20')](function(_0x2a7baf){if(_0x2a7baf){if(!utils['isValidChannel'](_0x3e4327)){throw new db[(_0x9d50('0x1d'))][(_0x9d50('0x96'))](_0x9d50('0x9f'));}return _0x2a7baf[_0x9d50('0xa0')+_[_0x9d50('0xa1')](_0x3e4327['toLowerCase']())+_0x9d50('0xa2')](_0x5c9003[_0x9d50('0x69')][_0x9d50('0x6c')],{'penalty':_0x5c9003[_0x9d50('0x69')][_0x9d50('0xa3')]||0x0})['spread'](function(_0x13fe9b){for(var _0x205599=0x0;_0x205599<_0x5c9003['body'][_0x9d50('0x6c')][_0x9d50('0x53')];_0x205599+=0x1){var _0x2203f1={'UserId':_0x5c9003['params']['id']};_0x2203f1[_[_0x9d50('0xa1')](_0x3e4327[_0x9d50('0xa4')]())+_0x9d50('0xa5')]=_0x5c9003[_0x9d50('0x69')][_0x9d50('0x6c')][_0x205599];socket[_0x9d50('0xa6')](_0x9d50('0x6e')+_['capitalize'](_0x3e4327[_0x9d50('0xa4')]())+'Queue:save',_0x2203f1);}return _0x13fe9b;})[_0x9d50('0x20')](function(){if(_0x3e4327===_0x9d50('0xa7')){return db[_0x9d50('0xa8')][_0x9d50('0x63')]({'where':{'id':_0x5c9003[_0x9d50('0x69')]['ids']||[]},'raw':!![],'attributes':['id',_0x9d50('0x46')]});}})[_0x9d50('0x20')](function(_0x31e2b3){var _0x39351c=_0x2a7baf[_0x9d50('0x38')]({'plain':!![]});var _0x2d4b77=[];if(_0x3e4327===_0x9d50('0xa7')&&_0x39351c[_0x9d50('0x42')]==='agent'&&_0x39351c['online']){for(var _0x4c8b3d=0x0;_0x4c8b3d<_0x31e2b3['length'];_0x4c8b3d+=0x1){_0x2d4b77[_0x9d50('0xa9')]({'membername':_0x39351c[_0x9d50('0x46')],'UserId':_0x39351c['id'],'queue_name':_0x31e2b3[_0x4c8b3d][_0x9d50('0x46')],'VoiceQueueId':_0x31e2b3[_0x4c8b3d]['id'],'interface':_[_0x9d50('0x72')](_0x39351c[_0x9d50('0xaa')])?util[_0x9d50('0xab')](_0x9d50('0xac'),_0x39351c[_0x9d50('0x46')]):_0x39351c['interface'],'paused':_0x39351c[_0x9d50('0xad')]||![],'penalty':_0x5c9003['body']['penalty']||0x0});}return BPromise[_0x9d50('0xae')](_0x2d4b77,function(_0x2eba75){return db[_0x9d50('0xaf')][_0x9d50('0xb0')](_0x2eba75);});}return _0x2a7baf;});}})['then'](respondWithStatusCode(_0xc86f35,null))[_0x9d50('0x2a')](handleError(_0xc86f35,null));};exports[_0x9d50('0xb1')]=function(_0x4415c9,_0x3289a7,_0x17b850){var _0x70d547;return db[_0x9d50('0x48')][_0x9d50('0x43')]({'where':{'id':_0x4415c9[_0x9d50('0x66')]['id']},'attributes':['id','name',_0x9d50('0x42')]})[_0x9d50('0x20')](handleEntityNotFound(_0x3289a7,null))[_0x9d50('0x20')](function(_0x3a34c0){if(_0x3a34c0){_0x70d547=_0x3a34c0;if(!_0x4415c9[_0x9d50('0x4e')][_0x9d50('0x9c')]||!utils['isValidChannel'](_0x4415c9['query'][_0x9d50('0x9c')])){throw new db[(_0x9d50('0x1d'))][(_0x9d50('0x96'))]('Unknown\x20channel');}return _0x3a34c0['remove'+_[_0x9d50('0xa1')](_0x4415c9['query'][_0x9d50('0x9c')]['toLowerCase']())+_0x9d50('0xa2')](_0x4415c9['query'][_0x9d50('0x6c')]);}})[_0x9d50('0x20')](function(_0x25f6b8){for(var _0x28c8c2=0x0;_0x28c8c2<_0x4415c9[_0x9d50('0x4e')][_0x9d50('0x6c')][_0x9d50('0x53')];_0x28c8c2+=0x1){var _0x1d2b59={'UserId':_0x4415c9[_0x9d50('0x66')]['id']};_0x1d2b59[_[_0x9d50('0xa1')](_0x4415c9[_0x9d50('0x4e')][_0x9d50('0x9c')][_0x9d50('0xa4')]())+'QueueId']=_0x4415c9['query'][_0x9d50('0x6c')][_0x28c8c2];socket[_0x9d50('0xa6')](_0x9d50('0x6e')+_[_0x9d50('0xa1')](_0x4415c9[_0x9d50('0x4e')][_0x9d50('0x9c')][_0x9d50('0xa4')]())+_0x9d50('0xb2'),_0x1d2b59);}return _0x25f6b8;})[_0x9d50('0x20')](function(){if(_0x4415c9[_0x9d50('0x4e')]['channel']==='voice'){return db[_0x9d50('0xaf')]['destroy']({'where':{'UserId':_0x4415c9[_0x9d50('0x66')]['id'],'VoiceQueueId':_0x4415c9['query']['ids']},'individualHooks':!![]})['then'](function(){return _0x70d547;});}return _0x70d547;})[_0x9d50('0x20')](respondWithStatusCode(_0x3289a7,null))['catch'](handleError(_0x3289a7,null));};exports[_0x9d50('0xb3')]=function(_0x5ae68a,_0x1695dd,_0x248386){_0x5ae68a[_0x9d50('0x69')]['userpic']=_0x5ae68a[_0x9d50('0xb4')][_0x9d50('0xb5')];return db[_0x9d50('0x48')]['find']({'where':{'id':_0x5ae68a[_0x9d50('0x66')]['id']}})[_0x9d50('0x20')](handleEntityNotFound(_0x1695dd,null))[_0x9d50('0x20')](saveUpdates(_0x5ae68a[_0x9d50('0x69')],null))['then'](respondWithResult(_0x1695dd,null))['catch'](handleError(_0x1695dd,null));};exports[_0x9d50('0xb6')]=function(_0x288cb4,_0x5caa6d,_0x2f0c00){var _0x5cea23=path['join'](config['root'],_0x9d50('0xb7'));return db[_0x9d50('0x48')][_0x9d50('0x43')]({'where':{'id':_0x288cb4['params']['id']},'attributes':['id',_0x9d50('0xb8')],'raw':!![]})['then'](handleEntityNotFound(_0x5caa6d,null))[_0x9d50('0x20')](function(_0x3ec9ed){if(_0x3ec9ed){if(_['isNil'](_0x3ec9ed['userpic'])){return _0x5caa6d[_0x9d50('0xb9')](_0x5cea23);}else{if(!fs[_0x9d50('0xba')](path[_0x9d50('0xbb')](config[_0x9d50('0xbc')],_0x9d50('0xbd'),_0x3ec9ed[_0x9d50('0xb8')]))){return _0x5caa6d[_0x9d50('0xb9')](_0x5cea23);}return _0x5caa6d[_0x9d50('0xb9')](path['join'](config[_0x9d50('0xbc')],'server/files/images/',_0x3ec9ed['userpic']));}}})[_0x9d50('0x2a')](handleError(_0x5caa6d,null));};exports[_0x9d50('0xbe')]=function(_0x4ccf7d,_0xd4585c,_0x5bb8d8){var _0x281fed={};var _0x3211fe={};var _0x590f40;var _0x5922a0;return db['User']['findOne']({'where':{'id':_0x4ccf7d[_0x9d50('0x66')]['id']}})[_0x9d50('0x20')](handleEntityNotFound(_0xd4585c,null))[_0x9d50('0x20')](function(_0x3d410b){if(_0x3d410b){_0x590f40=_0x3d410b;_0x3211fe[_0x9d50('0x4a')]=_[_0x9d50('0x4d')](db['CmContact'][_0x9d50('0x49')]);_0x3211fe['query']=_[_0x9d50('0x4d')](_0x4ccf7d[_0x9d50('0x4e')]);_0x3211fe[_0x9d50('0x4f')]=_[_0x9d50('0x50')](_0x3211fe[_0x9d50('0x4a')],_0x3211fe['query']);_0x281fed[_0x9d50('0x51')]=_[_0x9d50('0x50')](_0x3211fe[_0x9d50('0x4a')],qs[_0x9d50('0x52')](_0x4ccf7d[_0x9d50('0x4e')][_0x9d50('0x52')]));_0x281fed[_0x9d50('0x51')]=_0x281fed['attributes']['length']?_0x281fed[_0x9d50('0x51')]:_0x3211fe[_0x9d50('0x4a')];_0x281fed[_0x9d50('0x56')]=qs[_0x9d50('0x57')](_0x4ccf7d[_0x9d50('0x4e')][_0x9d50('0x57')]);_0x281fed[_0x9d50('0x58')]=qs[_0x9d50('0x4f')](_[_0x9d50('0x59')](_0x4ccf7d[_0x9d50('0x4e')],_0x3211fe['filters']));if(_0x4ccf7d[_0x9d50('0x4e')][_0x9d50('0xbf')]){_0x281fed['where']=_['merge'](_0x281fed[_0x9d50('0x58')],{'$or':_[_0x9d50('0x3f')](_0x281fed[_0x9d50('0x51')],function(_0x45bab8){var _0x145321={};_0x145321[_0x45bab8]={'$like':'%'+_0x4ccf7d[_0x9d50('0x4e')][_0x9d50('0xbf')]+'%'};return _0x145321;})});}_0x281fed=_[_0x9d50('0x5a')]({},_0x281fed,_0x4ccf7d[_0x9d50('0x60')]);return _0x590f40[_0x9d50('0xbe')](_0x281fed);}})[_0x9d50('0x20')](function(_0x33db06){if(_0x33db06){_0x5922a0=_0x33db06[_0x9d50('0x53')];if(_0x4ccf7d[_0x9d50('0x4e')][_0x9d50('0x54')](_0x9d50('0x61'))){_0x281fed[_0x9d50('0x62')]=[{'model':db[_0x9d50('0xc0')],'as':'List','required':![]},{'model':db[_0x9d50('0xc1')],'as':_0x9d50('0xc2'),'attributes':['id',_0x9d50('0x46'),_0x9d50('0xc3')],'where':_0x4ccf7d[_0x9d50('0x4e')][_0x9d50('0xc4')]?{'id':_0x4ccf7d[_0x9d50('0x4e')]['tag']}:undefined,'required':_0x4ccf7d[_0x9d50('0x4e')][_0x9d50('0xc4')]?!![]:![]}];}if(!_0x4ccf7d['query'][_0x9d50('0x54')](_0x9d50('0x55'))){_0x281fed[_0x9d50('0x30')]=qs[_0x9d50('0x30')](_0x4ccf7d[_0x9d50('0x4e')]['limit']);_0x281fed['offset']=qs[_0x9d50('0x2f')](_0x4ccf7d[_0x9d50('0x4e')][_0x9d50('0x2f')]);}return _0x590f40[_0x9d50('0xbe')](_0x281fed);}})[_0x9d50('0x20')](function(_0x37cfd9){if(_0x37cfd9){return _0x37cfd9?{'count':_0x5922a0,'rows':_0x37cfd9}:null;}})[_0x9d50('0x20')](respondWithResult(_0xd4585c,null))[_0x9d50('0x2a')](handleError(_0xd4585c,null));};exports[_0x9d50('0xc5')]=function(_0x268d2e,_0xd6f11,_0x57d64b){var _0x1899ff;var _0x41d351;var _0x352c80={};var _0x44054a;return db[_0x9d50('0x48')][_0x9d50('0xc6')]({'where':{'id':_0x268d2e['params']['id']},'attributes':['id',_0x9d50('0x46'),_0x9d50('0x42')]})[_0x9d50('0x20')](handleEntityNotFound(_0xd6f11,null))[_0x9d50('0x20')](function(_0x42a055){if(!utils[_0x9d50('0xc7')](_0x268d2e[_0x9d50('0x4e')][_0x9d50('0x9c')])){throw new db[(_0x9d50('0x1d'))][(_0x9d50('0x96'))]('Unknown\x20channel');}_0x1899ff=_0x42a055;var _0x3ca9a8={};_0x3ca9a8[_0x9d50('0x4a')]=_['keys'](db[_[_0x9d50('0xa1')](_0x268d2e[_0x9d50('0x4e')][_0x9d50('0x9c')])+_0x9d50('0xc8')][_0x9d50('0x49')]);_0x3ca9a8[_0x9d50('0x4e')]=_[_0x9d50('0x4d')](_0x268d2e['query']);_0x3ca9a8[_0x9d50('0x4f')]=_[_0x9d50('0x50')](_0x3ca9a8[_0x9d50('0x4a')],_0x3ca9a8[_0x9d50('0x4e')]);_0x352c80['attributes']=_[_0x9d50('0x50')](_0x3ca9a8['model'],qs[_0x9d50('0x52')](_0x268d2e[_0x9d50('0x4e')]['fields']));_0x352c80['attributes']=_0x352c80['attributes'][_0x9d50('0x53')]?_0x352c80[_0x9d50('0x51')]:_0x3ca9a8[_0x9d50('0x4a')];_0x352c80[_0x9d50('0x56')]=qs[_0x9d50('0x57')](_0x268d2e['query'][_0x9d50('0x57')]);_0x352c80['where']=qs[_0x9d50('0x4f')](_[_0x9d50('0x59')](_0x268d2e[_0x9d50('0x4e')],_0x3ca9a8[_0x9d50('0x4f')]));if(_0x268d2e[_0x9d50('0x4e')]['filter']){_0x352c80['where']=_[_0x9d50('0x5a')](_0x352c80[_0x9d50('0x58')],{'$or':_[_0x9d50('0x3f')](_0x352c80[_0x9d50('0x51')],function(_0x59e442){var _0x360876={};_0x360876[_0x59e442]={'$like':'%'+_0x268d2e[_0x9d50('0x4e')]['filter']+'%'};return _0x360876;})});}_0x352c80=_[_0x9d50('0x5a')]({},_0x352c80,_0x268d2e['options']);switch(_0x1899ff['role']){case _0x9d50('0xc9'):return db[_[_0x9d50('0xa1')](_0x268d2e[_0x9d50('0x4e')][_0x9d50('0x9c')])+_0x9d50('0xc8')][_0x9d50('0x63')](_0x352c80);case _0x9d50('0x6e'):case'agent':return _0x1899ff[_0x9d50('0x38')+_['capitalize'](_0x268d2e[_0x9d50('0x4e')][_0x9d50('0x9c')])+_0x9d50('0xa2')](_0x352c80);default:throw new db['Sequelize'][(_0x9d50('0x96'))](_0x9d50('0xca'));}})['then'](function(_0x455b8c){_0x44054a=_0x455b8c['length'];if(!_0x268d2e[_0x9d50('0x4e')]['hasOwnProperty'](_0x9d50('0x55'))){_0x352c80['limit']=qs['limit'](_0x268d2e[_0x9d50('0x4e')][_0x9d50('0x30')]);_0x352c80[_0x9d50('0x2f')]=qs[_0x9d50('0x2f')](_0x268d2e[_0x9d50('0x4e')][_0x9d50('0x2f')]);}switch(_0x1899ff[_0x9d50('0x42')]){case'admin':return db[_[_0x9d50('0xa1')](_0x268d2e['query']['channel'])+'Queue'][_0x9d50('0x63')](_0x352c80);case _0x9d50('0x6e'):case _0x9d50('0x3b'):return _0x1899ff[_0x9d50('0x38')+_[_0x9d50('0xa1')](_0x268d2e[_0x9d50('0x4e')][_0x9d50('0x9c')])+_0x9d50('0xa2')](_0x352c80);}})[_0x9d50('0x20')](function(_0x2d7bba){return{'count':_0x44054a,'rows':_0x2d7bba};})[_0x9d50('0x20')](respondWithResult(_0xd6f11,null))['catch'](handleError(_0xd6f11,null));};exports[_0x9d50('0xcb')]=function(_0x8eefd4,_0xfd674f,_0x1f1ceb){var _0x112456={};var _0x3b6981={};var _0x4778cb;var _0x4e4370;return db[_0x9d50('0x48')][_0x9d50('0xc6')]({'where':{'id':_0x8eefd4[_0x9d50('0x66')]['id']}})[_0x9d50('0x20')](handleEntityNotFound(_0xfd674f,null))['then'](function(_0x301954){if(_0x301954){_0x4778cb=_0x301954;_0x3b6981[_0x9d50('0x4a')]=_[_0x9d50('0x4d')](db[_0x9d50('0xaf')]['rawAttributes']);_0x3b6981['query']=_[_0x9d50('0x4d')](_0x8eefd4['query']);_0x3b6981[_0x9d50('0x4f')]=_['intersection'](_0x3b6981['model'],_0x3b6981[_0x9d50('0x4e')]);_0x112456[_0x9d50('0x51')]=_[_0x9d50('0x50')](_0x3b6981[_0x9d50('0x4a')],qs[_0x9d50('0x52')](_0x8eefd4[_0x9d50('0x4e')][_0x9d50('0x52')]));_0x112456[_0x9d50('0x51')]=_0x112456[_0x9d50('0x51')][_0x9d50('0x53')]?_0x112456['attributes']:_0x3b6981[_0x9d50('0x4a')];_0x112456['order']=qs[_0x9d50('0x57')](_0x8eefd4[_0x9d50('0x4e')][_0x9d50('0x57')]);_0x112456[_0x9d50('0x58')]=qs[_0x9d50('0x4f')](_[_0x9d50('0x59')](_0x8eefd4[_0x9d50('0x4e')],_0x3b6981[_0x9d50('0x4f')]));if(_0x8eefd4[_0x9d50('0x4e')]['filter']){_0x112456['where']=_[_0x9d50('0x5a')](_0x112456['where'],{'$or':_['map'](_0x112456['attributes'],function(_0x5c2239){var _0x268a88={};_0x268a88[_0x5c2239]={'$like':'%'+_0x8eefd4['query']['filter']+'%'};return _0x268a88;})});}_0x112456=_[_0x9d50('0x5a')]({},_0x112456,_0x8eefd4[_0x9d50('0x60')]);return _0x4778cb['getVoiceQueuesRt'](_0x112456);}})[_0x9d50('0x20')](function(_0x572a15){if(_0x572a15){_0x4e4370=_0x572a15[_0x9d50('0x53')];if(!_0x8eefd4[_0x9d50('0x4e')]['hasOwnProperty'](_0x9d50('0x55'))){_0x112456[_0x9d50('0x30')]=qs[_0x9d50('0x30')](_0x8eefd4[_0x9d50('0x4e')]['limit']);_0x112456['offset']=qs[_0x9d50('0x2f')](_0x8eefd4['query'][_0x9d50('0x2f')]);}return _0x4778cb[_0x9d50('0xcb')](_0x112456);}})[_0x9d50('0x20')](function(_0x473284){if(_0x473284){return _0x473284?{'count':_0x4e4370,'rows':_0x473284}:null;}})[_0x9d50('0x20')](respondWithResult(_0xfd674f,null))[_0x9d50('0x2a')](handleError(_0xfd674f,null));};exports['getGroups']=function(_0x1351a1,_0x2e52c3,_0x5c54e4){var _0x410165={};var _0x3b580b={};var _0x5e4496;var _0x265113;return db[_0x9d50('0x48')][_0x9d50('0xc6')]({'where':{'id':_0x1351a1[_0x9d50('0x66')]['id']}})[_0x9d50('0x20')](handleEntityNotFound(_0x2e52c3,null))[_0x9d50('0x20')](function(_0x5c4085){if(_0x5c4085){_0x5e4496=_0x5c4085;_0x3b580b[_0x9d50('0x4a')]=_[_0x9d50('0x4d')](db[_0x9d50('0xcc')][_0x9d50('0x49')]);_0x3b580b[_0x9d50('0x4e')]=_[_0x9d50('0x4d')](_0x1351a1[_0x9d50('0x4e')]);_0x3b580b[_0x9d50('0x4f')]=_[_0x9d50('0x50')](_0x3b580b['model'],_0x3b580b['query']);_0x410165[_0x9d50('0x51')]=_['intersection'](_0x3b580b['model'],qs[_0x9d50('0x52')](_0x1351a1[_0x9d50('0x4e')][_0x9d50('0x52')]));_0x410165[_0x9d50('0x51')]=_0x410165['attributes'][_0x9d50('0x53')]?_0x410165[_0x9d50('0x51')]:_0x3b580b[_0x9d50('0x4a')];_0x410165[_0x9d50('0x56')]=qs['sort'](_0x1351a1[_0x9d50('0x4e')][_0x9d50('0x57')]);_0x410165['where']=qs['filters'](_['pick'](_0x1351a1[_0x9d50('0x4e')],_0x3b580b[_0x9d50('0x4f')]));if(_0x1351a1['query'][_0x9d50('0xbf')]){_0x410165[_0x9d50('0x58')]=_['merge'](_0x410165[_0x9d50('0x58')],{'$or':_[_0x9d50('0x3f')](_0x410165[_0x9d50('0x51')],function(_0x89904){var _0x59a456={};_0x59a456[_0x89904]={'$like':'%'+_0x1351a1[_0x9d50('0x4e')][_0x9d50('0xbf')]+'%'};return _0x59a456;})});}_0x410165=_[_0x9d50('0x5a')]({},_0x410165,_0x1351a1[_0x9d50('0x60')]);return _0x5e4496['getGroups'](_0x410165);}})[_0x9d50('0x20')](function(_0x3ff5de){if(_0x3ff5de){_0x265113=_0x3ff5de[_0x9d50('0x53')];if(!_0x1351a1[_0x9d50('0x4e')][_0x9d50('0x54')](_0x9d50('0x55'))){_0x410165[_0x9d50('0x30')]=qs[_0x9d50('0x30')](_0x1351a1['query'][_0x9d50('0x30')]);_0x410165[_0x9d50('0x2f')]=qs['offset'](_0x1351a1[_0x9d50('0x4e')][_0x9d50('0x2f')]);}return _0x5e4496[_0x9d50('0xcd')](_0x410165);}})[_0x9d50('0x20')](function(_0x1516a4){if(_0x1516a4){return _0x1516a4?{'count':_0x265113,'rows':_0x1516a4}:null;}})['then'](respondWithResult(_0x2e52c3,null))['catch'](handleError(_0x2e52c3,null));};exports['getRecordings']=function(_0x18931a,_0x48ee48,_0x5b5d83){var _0x4836ca={'raw':!![],'where':{}};var _0x9dbf0f={};var _0x1552bd={'count':0x0,'rows':[]};return db[_0x9d50('0x48')][_0x9d50('0xc6')]({'where':{'id':_0x18931a[_0x9d50('0x66')]['id']}})['then'](handleEntityNotFound(_0x48ee48,null))[_0x9d50('0x20')](function(_0x4f67b8){if(_0x4f67b8){_0x9dbf0f['model']=_[_0x9d50('0x4d')](db[_0x9d50('0xce')][_0x9d50('0x49')]);_0x9dbf0f[_0x9d50('0x4e')]=_[_0x9d50('0x4d')](_0x18931a[_0x9d50('0x4e')]);_0x9dbf0f[_0x9d50('0x4f')]=_[_0x9d50('0x50')](_0x9dbf0f[_0x9d50('0x4a')],_0x9dbf0f['query']);_0x4836ca[_0x9d50('0x51')]=_[_0x9d50('0x50')](_0x9dbf0f['model'],qs['fields'](_0x18931a[_0x9d50('0x4e')]['fields']));_0x4836ca[_0x9d50('0x51')]=_0x4836ca[_0x9d50('0x51')][_0x9d50('0x53')]?_0x4836ca[_0x9d50('0x51')]:_0x9dbf0f[_0x9d50('0x4a')];if(!_0x18931a['query'][_0x9d50('0x54')](_0x9d50('0x55'))){_0x4836ca[_0x9d50('0x30')]=qs['limit'](_0x18931a[_0x9d50('0x4e')]['limit']);_0x4836ca[_0x9d50('0x2f')]=qs['offset'](_0x18931a[_0x9d50('0x4e')][_0x9d50('0x2f')]);}_0x4836ca[_0x9d50('0x56')]=qs['sort'](_0x18931a[_0x9d50('0x4e')]['sort']);_0x4836ca[_0x9d50('0x58')]=qs[_0x9d50('0x4f')](_['pick'](_0x18931a[_0x9d50('0x4e')],_0x9dbf0f['filters']));_0x4836ca[_0x9d50('0x58')][_0x9d50('0xcf')]=_0x4f67b8['id'];if(_0x18931a['query'][_0x9d50('0xbf')]){_0x4836ca['where']=_[_0x9d50('0x5a')](_0x4836ca[_0x9d50('0x58')],{'$or':_[_0x9d50('0x3f')](_0x4836ca[_0x9d50('0x51')],function(_0x383f23){var _0x30f27f={};_0x30f27f[_0x383f23]={'$like':'%'+_0x18931a[_0x9d50('0x4e')]['filter']+'%'};return _0x30f27f;})});}_0x4836ca=_[_0x9d50('0x5a')]({},_0x4836ca,_0x18931a[_0x9d50('0x60')]);return db['VoiceRecording'][_0x9d50('0x2e')]({'where':_0x4836ca[_0x9d50('0x58')]})[_0x9d50('0x20')](function(_0x38d374){_0x1552bd[_0x9d50('0x2e')]=_0x38d374;if(_0x18931a[_0x9d50('0x4e')]['includeAll']){_0x4836ca['include']=[{'all':!![]}];}return db[_0x9d50('0xce')][_0x9d50('0x63')](_0x4836ca);})[_0x9d50('0x20')](function(_0x2f9d7e){_0x1552bd[_0x9d50('0x64')]=_0x2f9d7e;return _0x1552bd;});}})['then'](respondWithFilteredResult(_0x48ee48,_0x4836ca))['catch'](handleError(_0x48ee48,null));};exports[_0x9d50('0xd0')]=function(_0x245fee,_0x298149,_0x2ebf6d){var _0x472c27={'raw':!![],'where':{}};var _0x457b60={};var _0x3f650b={'count':0x0,'rows':[]};return db[_0x9d50('0x48')][_0x9d50('0xc6')]({'where':{'id':_0x245fee['params']['id']}})[_0x9d50('0x20')](handleEntityNotFound(_0x298149,null))[_0x9d50('0x20')](function(_0x5a4691){if(_0x5a4691){_0x457b60[_0x9d50('0x4a')]=_['keys'](db[_0x9d50('0xd1')][_0x9d50('0x49')]);_0x457b60[_0x9d50('0x4e')]=_[_0x9d50('0x4d')](_0x245fee[_0x9d50('0x4e')]);_0x457b60[_0x9d50('0x4f')]=_[_0x9d50('0x50')](_0x457b60[_0x9d50('0x4a')],_0x457b60['query']);_0x472c27['attributes']=_[_0x9d50('0x50')](_0x457b60[_0x9d50('0x4a')],qs['fields'](_0x245fee[_0x9d50('0x4e')][_0x9d50('0x52')]));_0x472c27[_0x9d50('0x51')]=_0x472c27['attributes'][_0x9d50('0x53')]?_0x472c27[_0x9d50('0x51')]:_0x457b60[_0x9d50('0x4a')];if(!_0x245fee[_0x9d50('0x4e')][_0x9d50('0x54')](_0x9d50('0x55'))){_0x472c27[_0x9d50('0x30')]=qs[_0x9d50('0x30')](_0x245fee[_0x9d50('0x4e')]['limit']);_0x472c27[_0x9d50('0x2f')]=qs[_0x9d50('0x2f')](_0x245fee[_0x9d50('0x4e')][_0x9d50('0x2f')]);}_0x472c27[_0x9d50('0x56')]=qs[_0x9d50('0x57')](_0x245fee[_0x9d50('0x4e')]['sort']);_0x472c27['where']=qs[_0x9d50('0x4f')](_[_0x9d50('0x59')](_0x245fee['query'],_0x457b60['filters']));_0x472c27[_0x9d50('0x58')][_0x9d50('0xcf')]=_0x5a4691['id'];if(_0x245fee[_0x9d50('0x4e')][_0x9d50('0xbf')]){_0x472c27[_0x9d50('0x58')]=_[_0x9d50('0x5a')](_0x472c27[_0x9d50('0x58')],{'$or':_[_0x9d50('0x3f')](_0x472c27[_0x9d50('0x51')],function(_0x1c122d){var _0x409c31={};_0x409c31[_0x1c122d]={'$like':'%'+_0x245fee[_0x9d50('0x4e')][_0x9d50('0xbf')]+'%'};return _0x409c31;})});}_0x472c27=_[_0x9d50('0x5a')]({},_0x472c27,_0x245fee['options']);return db['ScreenRecording']['count']({'where':_0x472c27['where']})[_0x9d50('0x20')](function(_0xc66ebc){_0x3f650b[_0x9d50('0x2e')]=_0xc66ebc;if(_0x245fee['query'][_0x9d50('0x61')]){_0x472c27[_0x9d50('0x62')]=[{'all':!![]}];}return db[_0x9d50('0xd1')][_0x9d50('0x63')](_0x472c27);})[_0x9d50('0x20')](function(_0x519a98){_0x3f650b[_0x9d50('0x64')]=_0x519a98;return _0x3f650b;});}})['then'](respondWithFilteredResult(_0x298149,_0x472c27))['catch'](handleError(_0x298149,null));};exports['getChatInteractions']=function(_0x43f572,_0x3d176b,_0xa6d86a){var _0x320326={};var _0x27761d={};var _0x503e0c;var _0x1226a0;return db[_0x9d50('0x48')][_0x9d50('0xc6')]({'where':{'id':_0x43f572[_0x9d50('0x66')]['id']}})['then'](handleEntityNotFound(_0x3d176b,null))['then'](function(_0x47da8f){if(_0x47da8f){_0x503e0c=_0x47da8f;_0x27761d[_0x9d50('0x4a')]=_[_0x9d50('0x4d')](db['ChatInteraction']['rawAttributes']);_0x27761d[_0x9d50('0x4e')]=_[_0x9d50('0x4d')](_0x43f572[_0x9d50('0x4e')]);_0x27761d[_0x9d50('0x4f')]=_['intersection'](_0x27761d['model'],_0x27761d[_0x9d50('0x4e')]);_0x320326[_0x9d50('0x51')]=_[_0x9d50('0x50')](_0x27761d[_0x9d50('0x4a')],qs[_0x9d50('0x52')](_0x43f572[_0x9d50('0x4e')][_0x9d50('0x52')]));_0x320326[_0x9d50('0x51')]=_0x320326[_0x9d50('0x51')][_0x9d50('0x53')]?_0x320326[_0x9d50('0x51')]:_0x27761d['model'];_0x320326['order']=qs['sort'](_0x43f572['query']['sort']);_0x320326['where']=qs[_0x9d50('0x4f')](_[_0x9d50('0x59')](_0x43f572[_0x9d50('0x4e')],_0x27761d[_0x9d50('0x4f')]));if(_0x43f572['query'][_0x9d50('0xbf')]){_0x320326['where']=_[_0x9d50('0x5a')](_0x320326[_0x9d50('0x58')],{'$or':_[_0x9d50('0x3f')](_0x320326['attributes'],function(_0x4d6aaa){var _0x53e5f8={};_0x53e5f8[_0x4d6aaa]={'$like':'%'+_0x43f572[_0x9d50('0x4e')][_0x9d50('0xbf')]+'%'};return _0x53e5f8;})});}_0x320326=_['merge']({},_0x320326,_0x43f572[_0x9d50('0x60')]);return _0x503e0c['getChatInteractions'](_0x320326);}})[_0x9d50('0x20')](function(_0x40a34a){if(_0x40a34a){_0x1226a0=_0x40a34a[_0x9d50('0x53')];if(!_0x43f572['query'][_0x9d50('0x54')](_0x9d50('0x55'))){_0x320326[_0x9d50('0x30')]=qs[_0x9d50('0x30')](_0x43f572['query'][_0x9d50('0x30')]);_0x320326[_0x9d50('0x2f')]=qs[_0x9d50('0x2f')](_0x43f572[_0x9d50('0x4e')][_0x9d50('0x2f')]);}return _0x503e0c['getChatInteractions'](_0x320326);}})[_0x9d50('0x20')](function(_0x3d5270){if(_0x3d5270){return _0x3d5270?{'count':_0x1226a0,'rows':_0x3d5270}:null;}})[_0x9d50('0x20')](respondWithResult(_0x3d176b,null))['catch'](handleError(_0x3d176b,null));};exports[_0x9d50('0xd2')]=function(_0x3afc74,_0x19bff7,_0x3333cb){var _0x50789e={};var _0x195ca5={};var _0x56b0bc;var _0x265ee3;return db['User'][_0x9d50('0xc6')]({'where':{'id':_0x3afc74[_0x9d50('0x66')]['id']}})[_0x9d50('0x20')](handleEntityNotFound(_0x19bff7,null))[_0x9d50('0x20')](function(_0x5e1ea2){if(_0x5e1ea2){_0x56b0bc=_0x5e1ea2;_0x195ca5[_0x9d50('0x4a')]=_[_0x9d50('0x4d')](db[_0x9d50('0xd3')]['rawAttributes']);_0x195ca5[_0x9d50('0x4e')]=_[_0x9d50('0x4d')](_0x3afc74[_0x9d50('0x4e')]);_0x195ca5['filters']=_['intersection'](_0x195ca5[_0x9d50('0x4a')],_0x195ca5[_0x9d50('0x4e')]);_0x50789e[_0x9d50('0x51')]=_[_0x9d50('0x50')](_0x195ca5[_0x9d50('0x4a')],qs[_0x9d50('0x52')](_0x3afc74[_0x9d50('0x4e')][_0x9d50('0x52')]));_0x50789e['attributes']=_0x50789e[_0x9d50('0x51')][_0x9d50('0x53')]?_0x50789e['attributes']:_0x195ca5[_0x9d50('0x4a')];_0x50789e[_0x9d50('0x56')]=qs['sort'](_0x3afc74['query']['sort']);_0x50789e[_0x9d50('0x58')]=qs['filters'](_['pick'](_0x3afc74['query'],_0x195ca5['filters']));if(_0x3afc74[_0x9d50('0x4e')]['filter']){_0x50789e[_0x9d50('0x58')]=_[_0x9d50('0x5a')](_0x50789e[_0x9d50('0x58')],{'$or':_[_0x9d50('0x3f')](_0x50789e[_0x9d50('0x51')],function(_0x50c85e){var _0x45739={};_0x45739[_0x50c85e]={'$like':'%'+_0x3afc74[_0x9d50('0x4e')]['filter']+'%'};return _0x45739;})});}_0x50789e=_[_0x9d50('0x5a')]({},_0x50789e,_0x3afc74[_0x9d50('0x60')]);return _0x56b0bc[_0x9d50('0xd2')](_0x50789e);}})[_0x9d50('0x20')](function(_0x21042b){if(_0x21042b){_0x265ee3=_0x21042b[_0x9d50('0x53')];if(!_0x3afc74[_0x9d50('0x4e')][_0x9d50('0x54')](_0x9d50('0x55'))){_0x50789e[_0x9d50('0x30')]=qs[_0x9d50('0x30')](_0x3afc74['query'][_0x9d50('0x30')]);_0x50789e['offset']=qs[_0x9d50('0x2f')](_0x3afc74[_0x9d50('0x4e')]['offset']);}return _0x56b0bc[_0x9d50('0xd2')](_0x50789e);}})[_0x9d50('0x20')](function(_0xbb8dc0){if(_0xbb8dc0){return _0xbb8dc0?{'count':_0x265ee3,'rows':_0xbb8dc0}:null;}})[_0x9d50('0x20')](respondWithResult(_0x19bff7,null))[_0x9d50('0x2a')](handleError(_0x19bff7,null));};exports[_0x9d50('0xd4')]=function(_0x5ba486,_0x11b776,_0x19b24f){var _0x55b9ed={'raw':!![],'where':{}};var _0x103b46={};var _0xb83f2a={'count':0x0,'rows':[]};return db[_0x9d50('0x48')]['findOne']({'where':{'id':_0x5ba486[_0x9d50('0x66')]['id']}})['then'](handleEntityNotFound(_0x11b776,null))[_0x9d50('0x20')](function(_0x594f2f){if(_0x594f2f){_0x103b46[_0x9d50('0x4a')]=_[_0x9d50('0x4d')](db[_0x9d50('0xd5')][_0x9d50('0x49')]);_0x103b46[_0x9d50('0x4e')]=_[_0x9d50('0x4d')](_0x5ba486['query']);_0x103b46[_0x9d50('0x4f')]=_[_0x9d50('0x50')](_0x103b46['model'],_0x103b46[_0x9d50('0x4e')]);_0x55b9ed[_0x9d50('0x51')]=_['intersection'](_0x103b46[_0x9d50('0x4a')],qs[_0x9d50('0x52')](_0x5ba486[_0x9d50('0x4e')][_0x9d50('0x52')]));_0x55b9ed[_0x9d50('0x51')]=_0x55b9ed[_0x9d50('0x51')][_0x9d50('0x53')]?_0x55b9ed['attributes']:_0x103b46[_0x9d50('0x4a')];if(!_0x5ba486[_0x9d50('0x4e')]['hasOwnProperty']('nolimit')){_0x55b9ed[_0x9d50('0x30')]=qs[_0x9d50('0x30')](_0x5ba486[_0x9d50('0x4e')][_0x9d50('0x30')]);_0x55b9ed['offset']=qs['offset'](_0x5ba486[_0x9d50('0x4e')][_0x9d50('0x2f')]);}_0x55b9ed[_0x9d50('0x56')]=qs[_0x9d50('0x57')](_0x5ba486[_0x9d50('0x4e')][_0x9d50('0x57')]);_0x55b9ed['where']=qs[_0x9d50('0x4f')](_[_0x9d50('0x59')](_0x5ba486[_0x9d50('0x4e')],_0x103b46['filters']));_0x55b9ed['where'][_0x9d50('0xcf')]=_0x594f2f['id'];if(_0x5ba486[_0x9d50('0x4e')][_0x9d50('0xbf')]){_0x55b9ed['where']=_['merge'](_0x55b9ed[_0x9d50('0x58')],{'$or':_[_0x9d50('0x3f')](_0x55b9ed[_0x9d50('0x51')],function(_0x4e9520){var _0x4cecc2={};_0x4cecc2[_0x4e9520]={'$like':'%'+_0x5ba486[_0x9d50('0x4e')][_0x9d50('0xbf')]+'%'};return _0x4cecc2;})});}_0x55b9ed=_['merge']({},_0x55b9ed,_0x5ba486[_0x9d50('0x60')]);return db[_0x9d50('0xd5')][_0x9d50('0x2e')]({'where':_0x55b9ed[_0x9d50('0x58')]})[_0x9d50('0x20')](function(_0x44c1f9){_0xb83f2a[_0x9d50('0x2e')]=_0x44c1f9;if(_0x5ba486[_0x9d50('0x4e')][_0x9d50('0x61')]){_0x55b9ed['include']=[{'all':!![]}];}return db[_0x9d50('0xd5')][_0x9d50('0x63')](_0x55b9ed);})[_0x9d50('0x20')](function(_0x45a0e0){_0xb83f2a[_0x9d50('0x64')]=_0x45a0e0;return _0xb83f2a;});}})[_0x9d50('0x20')](respondWithFilteredResult(_0x11b776,_0x55b9ed))[_0x9d50('0x2a')](handleError(_0x11b776,null));};exports[_0x9d50('0xd6')]=function(_0x20f30e,_0x3d1396,_0x1787ea){var _0x6adf84={};var _0x35536f={};var _0x2868dc;var _0x5f29d1;return db['User']['findOne']({'where':{'id':_0x20f30e['params']['id']}})[_0x9d50('0x20')](handleEntityNotFound(_0x3d1396,null))[_0x9d50('0x20')](function(_0x487a38){if(_0x487a38){_0x2868dc=_0x487a38;_0x35536f[_0x9d50('0x4a')]=_[_0x9d50('0x4d')](db[_0x9d50('0xd7')]['rawAttributes']);_0x35536f[_0x9d50('0x4e')]=_[_0x9d50('0x4d')](_0x20f30e[_0x9d50('0x4e')]);_0x35536f['filters']=_[_0x9d50('0x50')](_0x35536f[_0x9d50('0x4a')],_0x35536f['query']);_0x6adf84[_0x9d50('0x51')]=_[_0x9d50('0x50')](_0x35536f[_0x9d50('0x4a')],qs[_0x9d50('0x52')](_0x20f30e[_0x9d50('0x4e')][_0x9d50('0x52')]));_0x6adf84[_0x9d50('0x51')]=_0x6adf84['attributes'][_0x9d50('0x53')]?_0x6adf84['attributes']:_0x35536f[_0x9d50('0x4a')];_0x6adf84['order']=qs[_0x9d50('0x57')](_0x20f30e[_0x9d50('0x4e')]['sort']);_0x6adf84[_0x9d50('0x58')]=qs['filters'](_['pick'](_0x20f30e[_0x9d50('0x4e')],_0x35536f[_0x9d50('0x4f')]));if(_0x20f30e['query'][_0x9d50('0xbf')]){_0x6adf84['where']=_[_0x9d50('0x5a')](_0x6adf84[_0x9d50('0x58')],{'$or':_[_0x9d50('0x3f')](_0x6adf84[_0x9d50('0x51')],function(_0x43e27d){var _0x3b57e7={};_0x3b57e7[_0x43e27d]={'$like':'%'+_0x20f30e[_0x9d50('0x4e')][_0x9d50('0xbf')]+'%'};return _0x3b57e7;})});}_0x6adf84=_['merge']({},_0x6adf84,_0x20f30e[_0x9d50('0x60')]);return _0x2868dc[_0x9d50('0xd6')](_0x6adf84);}})[_0x9d50('0x20')](function(_0x3da02b){if(_0x3da02b){_0x5f29d1=_0x3da02b['length'];if(!_0x20f30e['query'][_0x9d50('0x54')](_0x9d50('0x55'))){_0x6adf84['limit']=qs[_0x9d50('0x30')](_0x20f30e[_0x9d50('0x4e')]['limit']);_0x6adf84[_0x9d50('0x2f')]=qs['offset'](_0x20f30e[_0x9d50('0x4e')][_0x9d50('0x2f')]);}return _0x2868dc[_0x9d50('0xd6')](_0x6adf84);}})['then'](function(_0x20b758){if(_0x20b758){return _0x20b758?{'count':_0x5f29d1,'rows':_0x20b758}:null;}})['then'](respondWithResult(_0x3d1396,null))[_0x9d50('0x2a')](handleError(_0x3d1396,null));};exports[_0x9d50('0xd8')]=function(_0x8300f8,_0x306e96,_0x5bfd04){var _0x353aa3={};var _0x16d43a={};var _0x8c8c84;var _0x508659;return db[_0x9d50('0x48')][_0x9d50('0xc6')]({'where':{'id':_0x8300f8[_0x9d50('0x66')]['id']}})[_0x9d50('0x20')](handleEntityNotFound(_0x306e96,null))[_0x9d50('0x20')](function(_0x2253a9){if(_0x2253a9){_0x8c8c84=_0x2253a9;_0x16d43a[_0x9d50('0x4a')]=_[_0x9d50('0x4d')](db['FaxInteraction'][_0x9d50('0x49')]);_0x16d43a['query']=_['keys'](_0x8300f8[_0x9d50('0x4e')]);_0x16d43a['filters']=_[_0x9d50('0x50')](_0x16d43a['model'],_0x16d43a[_0x9d50('0x4e')]);_0x353aa3[_0x9d50('0x51')]=_[_0x9d50('0x50')](_0x16d43a[_0x9d50('0x4a')],qs[_0x9d50('0x52')](_0x8300f8['query'][_0x9d50('0x52')]));_0x353aa3['attributes']=_0x353aa3[_0x9d50('0x51')][_0x9d50('0x53')]?_0x353aa3[_0x9d50('0x51')]:_0x16d43a[_0x9d50('0x4a')];_0x353aa3['order']=qs[_0x9d50('0x57')](_0x8300f8[_0x9d50('0x4e')]['sort']);_0x353aa3[_0x9d50('0x58')]=qs[_0x9d50('0x4f')](_[_0x9d50('0x59')](_0x8300f8['query'],_0x16d43a['filters']));if(_0x8300f8[_0x9d50('0x4e')][_0x9d50('0xbf')]){_0x353aa3[_0x9d50('0x58')]=_[_0x9d50('0x5a')](_0x353aa3[_0x9d50('0x58')],{'$or':_[_0x9d50('0x3f')](_0x353aa3[_0x9d50('0x51')],function(_0x1b5b1e){var _0x1627bd={};_0x1627bd[_0x1b5b1e]={'$like':'%'+_0x8300f8[_0x9d50('0x4e')][_0x9d50('0xbf')]+'%'};return _0x1627bd;})});}_0x353aa3=_['merge']({},_0x353aa3,_0x8300f8[_0x9d50('0x60')]);return _0x8c8c84['getFaxInteractions'](_0x353aa3);}})[_0x9d50('0x20')](function(_0x5a929b){if(_0x5a929b){_0x508659=_0x5a929b[_0x9d50('0x53')];if(!_0x8300f8[_0x9d50('0x4e')]['hasOwnProperty']('nolimit')){_0x353aa3[_0x9d50('0x30')]=qs['limit'](_0x8300f8['query'][_0x9d50('0x30')]);_0x353aa3[_0x9d50('0x2f')]=qs[_0x9d50('0x2f')](_0x8300f8[_0x9d50('0x4e')][_0x9d50('0x2f')]);}return _0x8c8c84[_0x9d50('0xd8')](_0x353aa3);}})[_0x9d50('0x20')](function(_0x155314){if(_0x155314){return _0x155314?{'count':_0x508659,'rows':_0x155314}:null;}})[_0x9d50('0x20')](respondWithResult(_0x306e96,null))[_0x9d50('0x2a')](handleError(_0x306e96,null));};exports[_0x9d50('0xd9')]=function(_0x14290b,_0xe05476,_0x3e714e){var _0x471188;var _0x9708f5;var _0x2a18e2;var _0x24cac5=!_['isNil'](_0x14290b[_0x9d50('0x66')]['id'])?_0x14290b[_0x9d50('0x66')]['id']:!_['isNil'](_0x14290b['user']['id'])?_0x14290b[_0x9d50('0x6e')]['id']:null;return db[_0x9d50('0x48')]['find']({'where':{'id':_0x24cac5,'role':{'$or':[_0x9d50('0xc9'),_0x9d50('0x6e'),'agent']}},'attributes':['id',_0x9d50('0x46'),_0x9d50('0xda'),_0x9d50('0xdb'),_0x9d50('0x42'),_0x9d50('0x79'),_0x9d50('0x9e')]})[_0x9d50('0x20')](function(_0x1bc5f3){if(_0x1bc5f3){if(_0x1bc5f3['role']==='agent'){_0x471188=_0x1bc5f3;if(_0x14290b['body'][_0x9d50('0xaa')]){_0x2a18e2=util[_0x9d50('0xab')](_0x9d50('0xdc'),_0x471188[_0x14290b['body'][_0x9d50('0xaa')]]);}else if(_0x14290b[_0x9d50('0x69')]['intrf']){_0x2a18e2=util[_0x9d50('0xab')](_0x9d50('0xac'),_0x14290b[_0x9d50('0x69')]['intrf']);}else{_0x2a18e2=util['format'](_0x9d50('0xac'),_0x471188[_0x9d50('0x46')]);}socket['to'](util[_0x9d50('0xab')](_0x9d50('0xdd'),_0x471188[_0x9d50('0x46')]))[_0x9d50('0xa6')](_0x9d50('0xde'),{'ip':_0x14290b[_0x9d50('0xdf')]['x-forwarded-for']||_0x14290b[_0x9d50('0xe0')][_0x9d50('0xe1')]||_0x14290b[_0x9d50('0xe2')][_0x9d50('0xe1')]||_0x14290b[_0x9d50('0xe0')][_0x9d50('0xe2')]['remoteAddress']});return db[_0x9d50('0xaf')]['destroy']({'where':{'membername':_0x471188[_0x9d50('0x46')]},'individualHooks':!![]});}}else{throw new db[(_0x9d50('0x1d'))][(_0x9d50('0x96'))](_0x9d50('0xe3'));}})[_0x9d50('0x20')](function(){if(_0x471188){return _0x471188['getVoiceQueues']({'raw':!![]});}})[_0x9d50('0x20')](function(_0x30d1ab){if(_0x471188){var _0x54bc25=[];if(_0x30d1ab){_0x9708f5=_0x30d1ab;if(_0x9708f5['length']){for(var _0x23dd1d=0x0;_0x23dd1d<_0x9708f5[_0x9d50('0x53')];_0x23dd1d++){_0x54bc25['push']({'membername':_0x471188[_0x9d50('0x46')],'UserId':_0x471188['id'],'queue_name':_0x9708f5[_0x23dd1d][_0x9d50('0x46')],'VoiceQueueId':_0x9708f5[_0x23dd1d]['id'],'interface':_0x2a18e2,'paused':_0x471188[_0x9d50('0x9e')]||![],'penalty':_0x9708f5[_0x23dd1d][_0x9d50('0xe4')]||0x0});}return BPromise[_0x9d50('0xae')](_0x54bc25,function(_0x3ec30d){return db[_0x9d50('0xaf')][_0x9d50('0xb0')](_0x3ec30d);});}}}})[_0x9d50('0x20')](function(){if(_0x471188){return db[_0x9d50('0xe5')][_0x9d50('0x63')]({'where':{'membername':_0x471188['name'],'exitAt':null}});}})[_0x9d50('0x20')](function(_0x55c785){if(_0x471188){var _0x1e29a1=[];_0x55c785[_0x9d50('0xe6')](function(_0x461c08){_0x1e29a1[_0x9d50('0xa9')](_0x461c08[_0x9d50('0x36')]({'exitAt':moment()['format'](_0x9d50('0xe7'))}));});return BPromise[_0x9d50('0xe8')](_0x1e29a1);}})[_0x9d50('0x20')](function(){if(_0x471188){var _0x20e578=[];var _0x19a8f7=[];var _0x100c8f=utils[_0x9d50('0xe9')]();var _0x32f5e7={'membername':_0x471188[_0x9d50('0x46')],'interface':_0x2a18e2,'enterAt':moment()[_0x9d50('0xab')](_0x9d50('0xe7')),'role':_0x471188[_0x9d50('0x42')],'internal':_0x471188[_0x9d50('0x79')]};_0x100c8f[_0x9d50('0xe6')](function(_0x48c95a){_0x20e578[_0x9d50('0xa9')](_['merge']({'channel':_0x48c95a,'type':_0x9d50('0xea'),'data1':_0x14290b[_0x9d50('0x69')][_0x9d50('0xeb')],'data2':_0x2a18e2},_0x32f5e7));if(_0x471188[_0x9d50('0x9e')]){_0x19a8f7[_0x9d50('0xa9')](_['merge']({'channel':_0x48c95a,'type':_0x9d50('0xec'),'data1':'LOGININPAUSE'},_0x32f5e7));}});return db[_0x9d50('0xe5')][_0x9d50('0x68')](_0x20e578['concat'](_0x19a8f7),{'individualHooks':!![]});}})[_0x9d50('0x20')](function(){if(_0x471188){return _0x471188[_0x9d50('0x36')]({'online':!![],'lastLoginAt':moment()[_0x9d50('0xab')](_0x9d50('0xe7')),'voicePause':_0x471188[_0x9d50('0x9e')]||![],'mailPause':_0x471188['loginInPause']||![],'chatPause':_0x471188[_0x9d50('0x9e')]||![],'faxPause':_0x471188['loginInPause']||![],'smsPause':_0x471188[_0x9d50('0x9e')]||![],'openchannelPause':_0x471188[_0x9d50('0x9e')]||![],'pauseType':_0x471188['loginInPause']?_0x9d50('0xed'):null,'interface':_0x2a18e2,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x9d50('0x20')](function(_0x82811){if(_0x14290b[_0x9d50('0xee')]){return _0x3e714e();}else{return BPromise[_0x9d50('0xef')](_0x82811)[_0x9d50('0x20')](respondWithResult(_0xe05476,null));}})[_0x9d50('0x2a')](handleError(_0xe05476,null));};exports[_0x9d50('0xf0')]=function(_0x1d952e,_0xb698ae,_0x5c0a26){var _0x386491;return db[_0x9d50('0x48')]['find']({'where':{'id':_0x1d952e[_0x9d50('0x66')]['id'],'role':_0x9d50('0x3b')},'attributes':['id','name',_0x9d50('0x42')]})['then'](handleEntityNotFound(_0xb698ae,null))[_0x9d50('0x20')](function(_0x2f2720){if(_0x2f2720){_0x386491=_0x2f2720;return db[_0x9d50('0xaf')][_0x9d50('0x37')]({'where':{'membername':_0x386491[_0x9d50('0x46')]},'individualHooks':!![]});}})[_0x9d50('0x20')](function(){return db['MemberReport'][_0x9d50('0x63')]({'where':{'membername':_0x386491[_0x9d50('0x46')],'exitAt':null}});})[_0x9d50('0x20')](function(_0x44a315){var _0x387d8f=[];_0x44a315[_0x9d50('0xe6')](function(_0x20b163){_0x387d8f[_0x9d50('0xa9')](_0x20b163['update']({'exitAt':moment()[_0x9d50('0xab')](_0x9d50('0xe7'))}));});return BPromise['all'](_0x387d8f);})[_0x9d50('0x20')](function(){return _0x386491[_0x9d50('0x36')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0x9d50('0x20')](respondWithResult(_0xb698ae,null))[_0x9d50('0x2a')](handleError(_0xb698ae,null));};exports[_0x9d50('0xf1')]=function(_0x3c2e02,_0x4a612c,_0x28f75b){var _0x5ee3ea;return db[_0x9d50('0xaf')]['update']({'paused':0x1},{'where':{'UserId':_0x3c2e02[_0x9d50('0x66')]['id']},'individualHooks':!![]})[_0x9d50('0x20')](function(){return db['User'][_0x9d50('0x43')]({'where':{'id':_0x3c2e02[_0x9d50('0x66')]['id'],'role':_0x9d50('0x3b')},'attributes':['id','name',_0x9d50('0x42'),_0x9d50('0x79'),'interface']});})['then'](handleEntityNotFound(_0x4a612c,null))[_0x9d50('0x20')](function(_0x2ec23a){if(_0x2ec23a){_0x5ee3ea=_0x2ec23a;return respondWithRpcPromise(_0x9d50('0xf2'),_0x9d50('0xf1'),{'id':_0x5ee3ea['id'],'name':_0x5ee3ea[_0x9d50('0x46')],'pause':!![]});}})[_0x9d50('0x20')](function(){if(_0x5ee3ea){return db[_0x9d50('0xe5')][_0x9d50('0x63')]({'where':{'membername':_0x5ee3ea['name'],'type':'PAUSE','exitAt':null}});}})[_0x9d50('0x20')](function(_0x2bbde1){if(_0x2bbde1['length']){var _0x3f81b1=moment()['format'](_0x9d50('0xe7'));for(var _0x497753=0x0,_0x272378=_0x2bbde1[_0x9d50('0x53')];_0x497753<_0x272378;_0x497753++){_0x2bbde1[_0x497753][_0x9d50('0xf3')]({'exitAt':_0x3f81b1});}}})[_0x9d50('0x20')](function(){var _0x337a90=[];var _0x1f88f2=utils[_0x9d50('0xe9')]();_0x1f88f2[_0x9d50('0xe6')](function(_0x5483c6){_0x337a90['push']({'channel':_0x5483c6,'membername':_0x5ee3ea[_0x9d50('0x46')],'interface':_[_0x9d50('0x72')](_0x5ee3ea['interface'])?util['format'](_0x9d50('0xac'),_0x5ee3ea[_0x9d50('0x46')]):_0x5ee3ea[_0x9d50('0xaa')],'type':'PAUSE','enterAt':moment()[_0x9d50('0xab')](_0x9d50('0xe7')),'data1':_0x3c2e02[_0x9d50('0x69')]['type']||_0x9d50('0xf4'),'role':_0x5ee3ea['role'],'internal':_0x5ee3ea[_0x9d50('0x79')]});});return db[_0x9d50('0xe5')][_0x9d50('0x68')](_0x337a90,{'individualHooks':!![]});})[_0x9d50('0x20')](function(){return _0x5ee3ea[_0x9d50('0x36')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x3c2e02['body'][_0x9d50('0x5b')]||_0x9d50('0xf4'),'lastPauseAt':moment()['format'](_0x9d50('0xe7'))});})[_0x9d50('0x20')](respondWithResult(_0x4a612c,null))['catch'](handleError(_0x4a612c,null));};exports['unpause']=function(_0x149ce7,_0x589289,_0x319292){var _0x2e3440;return db['User'][_0x9d50('0x43')]({'where':{'id':_0x149ce7['params']['id']},'attributes':['id','name',_0x9d50('0x42'),'voicePause',_0x9d50('0xf5'),_0x9d50('0xf6'),'faxPause',_0x9d50('0xf7'),_0x9d50('0xf8'),_0x9d50('0xf9'),_0x9d50('0xfa')]})['then'](handleEntityNotFound(_0x589289,null))[_0x9d50('0x20')](function(_0x106170){if(_0x106170){_0x2e3440=_0x106170;if(_0x149ce7[_0x9d50('0x69')][_0x9d50('0x9c')]&&!utils[_0x9d50('0xc7')](_0x149ce7[_0x9d50('0x69')][_0x9d50('0x9c')])){throw new db['Sequelize'][(_0x9d50('0x96'))](_0x9d50('0x9f'));}switch(_0x149ce7[_0x9d50('0x69')][_0x9d50('0x9c')]){case'voice':return respondWithRpcPromise(_0x9d50('0xf2'),_0x9d50('0xfb'),{'id':_0x2e3440['id'],'name':_0x2e3440[_0x9d50('0x46')],'pause':![]})[_0x9d50('0x20')](function(){return db[_0x9d50('0xaf')]['update']({'paused':0x0},{'where':{'UserId':_0x2e3440['id']},'individualHooks':!![]});})['then'](function(){return db[_0x9d50('0xe5')][_0x9d50('0x43')]({'where':{'channel':_0x149ce7[_0x9d50('0x69')][_0x9d50('0x9c')],'membername':_0x2e3440[_0x9d50('0x46')],'type':_0x9d50('0xec'),'exitAt':null}});})[_0x9d50('0x20')](function(_0x18104e){if(_0x18104e){return _0x18104e[_0x9d50('0x36')]({'exitAt':moment()[_0x9d50('0xab')](_0x9d50('0xe7')),'data2':_0x9d50('0xfc')},{'individualHooks':!![]});}return null;})[_0x9d50('0x20')](function(){return _0x2e3440[_0x9d50('0x36')]({'voicePause':![]});});case _0x9d50('0xfd'):case _0x9d50('0xfe'):case _0x9d50('0xff'):case _0x9d50('0x100'):case'openchannel':return db[_0x9d50('0xe5')][_0x9d50('0x43')]({'where':{'channel':_0x149ce7[_0x9d50('0x69')][_0x9d50('0x9c')],'membername':_0x2e3440[_0x9d50('0x46')],'type':_0x9d50('0xec'),'exitAt':null}})[_0x9d50('0x20')](function(_0x3b8e93){if(_0x3b8e93){return _0x3b8e93['update']({'exitAt':moment()[_0x9d50('0xab')](_0x9d50('0xe7')),'data2':_0x9d50('0xfc')},{'individualHooks':!![]});}return null;})[_0x9d50('0x20')](function(){var _0x159c93={};_[_0x9d50('0x101')](_0x159c93,util['format'](_0x9d50('0x102'),_0x149ce7[_0x9d50('0x69')]['channel'],_0x9d50('0x103')),![]);return _0x2e3440[_0x9d50('0x36')](_0x159c93);});default:return respondWithRpcPromise(_0x9d50('0xf2'),_0x9d50('0xfb'),{'id':_0x2e3440['id'],'name':_0x2e3440['name'],'pause':![]})[_0x9d50('0x20')](function(){return db[_0x9d50('0xaf')][_0x9d50('0x36')]({'paused':0x0},{'where':{'UserId':_0x2e3440['id']}});})[_0x9d50('0x20')](function(){return db['MemberReport'][_0x9d50('0x63')]({'where':{'membername':_0x2e3440[_0x9d50('0x46')],'type':_0x9d50('0xec'),'exitAt':null}});})[_0x9d50('0x20')](function(_0x3ef26d){var _0x220a81=[];_0x3ef26d['forEach'](function(_0x1701ab){_0x220a81[_0x9d50('0xa9')](_0x1701ab[_0x9d50('0x36')]({'exitAt':moment()['format'](_0x9d50('0xe7')),'data2':_0x9d50('0xfc')}));});return BPromise[_0x9d50('0xe8')](_0x220a81);})[_0x9d50('0x20')](function(){return _0x2e3440[_0x9d50('0x36')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x9d50('0x20')](respondWithResult(_0x589289,null))[_0x9d50('0x2a')](handleError(_0x589289,null));};exports[_0x9d50('0x104')]=function(_0x4fa949,_0x542519,_0xb5623d){var _0x3b02e0={};var _0x4fe331={};var _0x420654;var _0x3cc057;return db[_0x9d50('0x48')][_0x9d50('0xc6')]({'where':{'id':_0x4fa949[_0x9d50('0x66')]['id']}})['then'](handleEntityNotFound(_0x542519,null))[_0x9d50('0x20')](function(_0x528e48){if(_0x528e48){_0x420654=_0x528e48;_0x4fe331[_0x9d50('0x4a')]=_[_0x9d50('0x4d')](db['Team'][_0x9d50('0x49')]);_0x4fe331[_0x9d50('0x4e')]=_[_0x9d50('0x4d')](_0x4fa949[_0x9d50('0x4e')]);_0x4fe331[_0x9d50('0x4f')]=_[_0x9d50('0x50')](_0x4fe331[_0x9d50('0x4a')],_0x4fe331[_0x9d50('0x4e')]);_0x3b02e0['attributes']=_[_0x9d50('0x50')](_0x4fe331[_0x9d50('0x4a')],qs[_0x9d50('0x52')](_0x4fa949[_0x9d50('0x4e')][_0x9d50('0x52')]));_0x3b02e0[_0x9d50('0x51')]=_0x3b02e0['attributes']['length']?_0x3b02e0[_0x9d50('0x51')]:_0x4fe331[_0x9d50('0x4a')];_0x3b02e0[_0x9d50('0x56')]=qs['sort'](_0x4fa949['query'][_0x9d50('0x57')]);_0x3b02e0[_0x9d50('0x58')]=qs['filters'](_['pick'](_0x4fa949[_0x9d50('0x4e')],_0x4fe331[_0x9d50('0x4f')]));if(_0x4fa949[_0x9d50('0x4e')]['filter']){_0x3b02e0['where']=_[_0x9d50('0x5a')](_0x3b02e0[_0x9d50('0x58')],{'$or':_[_0x9d50('0x3f')](_0x3b02e0['attributes'],function(_0x2ec30e){var _0x563016={};_0x563016[_0x2ec30e]={'$like':'%'+_0x4fa949['query'][_0x9d50('0xbf')]+'%'};return _0x563016;})});}_0x3b02e0=_[_0x9d50('0x5a')]({},_0x3b02e0,_0x4fa949[_0x9d50('0x60')]);return _0x420654[_0x9d50('0x104')](_0x3b02e0);}})[_0x9d50('0x20')](function(_0x406e0c){if(_0x406e0c){_0x3cc057=_0x406e0c[_0x9d50('0x53')];if(!_0x4fa949[_0x9d50('0x4e')]['hasOwnProperty']('nolimit')){_0x3b02e0['limit']=qs[_0x9d50('0x30')](_0x4fa949['query'][_0x9d50('0x30')]);_0x3b02e0[_0x9d50('0x2f')]=qs[_0x9d50('0x2f')](_0x4fa949['query'][_0x9d50('0x2f')]);}return _0x420654[_0x9d50('0x104')](_0x3b02e0);}})['then'](function(_0xacd9c5){if(_0xacd9c5){return _0xacd9c5?{'count':_0x3cc057,'rows':_0xacd9c5}:null;}})[_0x9d50('0x20')](respondWithResult(_0x542519,null))[_0x9d50('0x2a')](handleError(_0x542519,null));};exports[_0x9d50('0x105')]=function(_0x32bb72,_0x1375b8){return db[_0x9d50('0x48')]['find']({'where':{'id':_0x32bb72[_0x9d50('0x66')]['id']}})[_0x9d50('0x20')](handleEntityNotFound(_0x1375b8,null))['then'](function(_0x2665e1){if(_0x2665e1){var _0xc0a88b=_0x2665e1[_0x9d50('0x38')]({'plain':!![]});return _0x2665e1['addTeams'](_0x32bb72[_0x9d50('0x69')][_0x9d50('0x6c')],_[_0x9d50('0x106')](_0x32bb72[_0x9d50('0x69')],[_0x9d50('0x6c'),'id'])||{})[_0x9d50('0x20')](function(){for(var _0x43dc9c=0x0;_0x43dc9c<_0x32bb72[_0x9d50('0x69')]['ids'][_0x9d50('0x53')];_0x43dc9c++){var _0x14b78b=[];db[_0x9d50('0x107')]['findOne']({'where':{'id':_0x32bb72[_0x9d50('0x69')][_0x9d50('0x6c')][_0x43dc9c]}})['then'](function(_0x427f03){_0x14b78b[_0x9d50('0xa9')](_0x427f03[_0x9d50('0x108')]()[_0x9d50('0x20')](function(_0x1732ea){for(var _0x1d732d=0x0;_0x1d732d<_0x1732ea[_0x9d50('0x53')];_0x1d732d++){_0x1732ea[_0x1d732d][_0x9d50('0x109')](_0x9d50('0x9c'),_0x9d50('0x10a'));}return _0x1732ea;}));_0x14b78b['push'](_0x427f03[_0x9d50('0x10b')]()[_0x9d50('0x20')](function(_0x44ed18){for(var _0x54b962=0x0;_0x54b962<_0x44ed18['length'];_0x54b962++){_0x44ed18[_0x54b962]['setDataValue'](_0x9d50('0x9c'),_0x9d50('0x10c'));}return _0x44ed18;}));_0x14b78b[_0x9d50('0xa9')](_0x427f03['getMailQueues']()[_0x9d50('0x20')](function(_0x39117f){for(var _0x24a78d=0x0;_0x24a78d<_0x39117f[_0x9d50('0x53')];_0x24a78d++){_0x39117f[_0x24a78d]['setDataValue'](_0x9d50('0x9c'),_0x9d50('0x10d'));}return _0x39117f;}));_0x14b78b[_0x9d50('0xa9')](_0x427f03['getSmsQueues']()[_0x9d50('0x20')](function(_0x525549){for(var _0x1f3adf=0x0;_0x1f3adf<_0x525549[_0x9d50('0x53')];_0x1f3adf++){_0x525549[_0x1f3adf][_0x9d50('0x109')](_0x9d50('0x9c'),_0x9d50('0x10e'));}return _0x525549;}));_0x14b78b[_0x9d50('0xa9')](_0x427f03['getFaxQueues']()[_0x9d50('0x20')](function(_0x2bf753){for(var _0x46d3d6=0x0;_0x46d3d6<_0x2bf753[_0x9d50('0x53')];_0x46d3d6++){_0x2bf753[_0x46d3d6]['setDataValue'](_0x9d50('0x9c'),_0x9d50('0x10f'));}return _0x2bf753;}));_0x14b78b[_0x9d50('0xa9')](_0x427f03['getOpenchannelQueues']()[_0x9d50('0x20')](function(_0x160f50){for(var _0x58f1b2=0x0;_0x58f1b2<_0x160f50[_0x9d50('0x53')];_0x58f1b2++){_0x160f50[_0x58f1b2][_0x9d50('0x109')](_0x9d50('0x9c'),'Openchannel');}return _0x160f50;}));return BPromise[_0x9d50('0xe8')](_0x14b78b);})[_0x9d50('0x20')](function(_0x482dd0){var _0x16174e=_[_0x9d50('0x110')](_0x482dd0);_0x14b78b=[];return db[_0x9d50('0x5d')][_0x9d50('0x111')](function(_0x515ecb){for(var _0x475e11=0x0;_0x475e11<_0x16174e[_0x9d50('0x53')];_0x475e11++){_0x14b78b[_0x9d50('0xa9')](_0x16174e[_0x475e11][_0x9d50('0x112')](_0xc0a88b['id']),{'transaction':_0x515ecb});}return BPromise[_0x9d50('0xe8')](_0x14b78b)[_0x9d50('0x20')](function(){if(_0xc0a88b[_0x9d50('0x9d')]){return BPromise['each'](_['filter'](_0x16174e,function(_0x2457b1){return _0x2457b1[_0x9d50('0x113')](_0x9d50('0x9c'))===_0x9d50('0x10a');}),function(_0x15f172){return db['UserVoiceQueueRt'][_0x9d50('0xb0')]({'membername':_0xc0a88b[_0x9d50('0x46')],'UserId':_0xc0a88b['id'],'queue_name':_0x15f172['name'],'VoiceQueueId':_0x15f172['id'],'interface':_[_0x9d50('0x72')](_0xc0a88b[_0x9d50('0xaa')])?util[_0x9d50('0xab')](_0x9d50('0xac'),_0xc0a88b[_0x9d50('0x46')]):_0xc0a88b[_0x9d50('0xaa')],'paused':_0xc0a88b[_0x9d50('0xad')]||![],'penalty':_0xc0a88b['penalty']},{'transaction':_0x515ecb});});}else{return;}})['then'](function(){for(var _0x18bad5=0x0;_0x18bad5<_0x16174e[_0x9d50('0x53')];_0x18bad5++){var _0x582800=_0x16174e[_0x18bad5][_0x9d50('0x113')]('channel');var _0x5351d2=_0x582800+_0x9d50('0xa5');socket[_0x9d50('0xa6')](_0x9d50('0x6e')+_0x582800+_0x9d50('0x114'),{'UserId':_0xc0a88b['id'],['queueField']:_0x16174e[_0x18bad5]['id']});}});});});}});}})[_0x9d50('0x20')](respondWithStatusCode(_0x1375b8,null))[_0x9d50('0x2a')](handleError(_0x1375b8,null));};exports[_0x9d50('0x115')]=function(_0x4f6b77,_0x759bc2){return db['User'][_0x9d50('0xc6')]({'where':{'id':_0x4f6b77[_0x9d50('0x66')]['id']}})[_0x9d50('0x20')](handleEntityNotFound(_0x759bc2,null))[_0x9d50('0x20')](function(_0x419e04){if(_0x419e04){var _0x58f544=_0x419e04[_0x9d50('0x38')]({'plain':!![]});var _0x42b39b=_0x4f6b77[_0x9d50('0x4e')]['ids'];return _0x419e04['removeTeams'](_0x42b39b)[_0x9d50('0x20')](function(){for(var _0x530a7e=0x0;_0x530a7e<_0x42b39b[_0x9d50('0x53')];_0x530a7e++){var _0x1db41e=[];db['Team'][_0x9d50('0xc6')]({'where':{'id':_0x42b39b[_0x530a7e]}})[_0x9d50('0x20')](function(_0x5502bd){_0x1db41e[_0x9d50('0xa9')](_0x5502bd[_0x9d50('0x108')]()[_0x9d50('0x20')](function(_0x290b35){for(var _0x4cdbe4=0x0;_0x4cdbe4<_0x290b35[_0x9d50('0x53')];_0x4cdbe4++){_0x290b35[_0x4cdbe4][_0x9d50('0x109')](_0x9d50('0x9c'),_0x9d50('0x10a'));}return _0x290b35;}));_0x1db41e[_0x9d50('0xa9')](_0x5502bd['getChatQueues']()[_0x9d50('0x20')](function(_0x3fa78d){for(var _0x18e5fc=0x0;_0x18e5fc<_0x3fa78d[_0x9d50('0x53')];_0x18e5fc++){_0x3fa78d[_0x18e5fc][_0x9d50('0x109')](_0x9d50('0x9c'),_0x9d50('0x10c'));}return _0x3fa78d;}));_0x1db41e['push'](_0x5502bd[_0x9d50('0x116')]()[_0x9d50('0x20')](function(_0x33f132){for(var _0x1c9b73=0x0;_0x1c9b73<_0x33f132[_0x9d50('0x53')];_0x1c9b73++){_0x33f132[_0x1c9b73][_0x9d50('0x109')](_0x9d50('0x9c'),_0x9d50('0x10d'));}return _0x33f132;}));_0x1db41e[_0x9d50('0xa9')](_0x5502bd[_0x9d50('0x117')]()[_0x9d50('0x20')](function(_0x4e4dc2){for(var _0x4fc3a4=0x0;_0x4fc3a4<_0x4e4dc2[_0x9d50('0x53')];_0x4fc3a4++){_0x4e4dc2[_0x4fc3a4][_0x9d50('0x109')](_0x9d50('0x9c'),_0x9d50('0x10e'));}return _0x4e4dc2;}));_0x1db41e['push'](_0x5502bd['getFaxQueues']()[_0x9d50('0x20')](function(_0x15b4fd){for(var _0x526222=0x0;_0x526222<_0x15b4fd[_0x9d50('0x53')];_0x526222++){_0x15b4fd[_0x526222]['setDataValue'](_0x9d50('0x9c'),_0x9d50('0x10f'));}return _0x15b4fd;}));_0x1db41e[_0x9d50('0xa9')](_0x5502bd['getOpenchannelQueues']()['then'](function(_0x3836da){for(var _0x4bcb12=0x0;_0x4bcb12<_0x3836da['length'];_0x4bcb12++){_0x3836da[_0x4bcb12][_0x9d50('0x109')](_0x9d50('0x9c'),'Openchannel');}return _0x3836da;}));return BPromise[_0x9d50('0xe8')](_0x1db41e);})[_0x9d50('0x20')](function(_0x200b8d){var _0x563374=_[_0x9d50('0x110')](_0x200b8d);_0x1db41e=[];return db[_0x9d50('0x5d')][_0x9d50('0x111')](function(_0x2538ba){for(var _0x573f58=0x0;_0x573f58<_0x563374[_0x9d50('0x53')];_0x573f58++){_0x1db41e['push'](_0x563374[_0x573f58][_0x9d50('0x118')](_0x58f544['id']),{'transaction':_0x2538ba});}return BPromise[_0x9d50('0xe8')](_0x1db41e)[_0x9d50('0x20')](function(){if(_0x58f544[_0x9d50('0x9d')]){return BPromise['each'](_['filter'](_0x563374,function(_0x30a684){return _0x30a684['getDataValue'](_0x9d50('0x9c'))===_0x9d50('0x10a');}),function(_0x21b183){return db['UserVoiceQueueRt'][_0x9d50('0x37')]({'where':{'VoiceQueueId':_0x21b183['id'],'UserId':_0x58f544['id']},'transaction':_0x2538ba});});}else{return;}})[_0x9d50('0x20')](function(){for(var _0x18122d=0x0;_0x18122d<_0x563374['length'];_0x18122d++){var _0x4e16db=_0x563374[_0x18122d][_0x9d50('0x113')](_0x9d50('0x9c'));var _0x2de8e2=_0x4e16db+_0x9d50('0xa5');socket['emit'](_0x9d50('0x6e')+_0x4e16db+_0x9d50('0xb2'),{'UserId':_0x58f544['id'],['queueField']:_0x563374[_0x18122d]['id']});}});});});}});}})[_0x9d50('0x20')](respondWithStatusCode(_0x759bc2,null))[_0x9d50('0x2a')](handleError(_0x759bc2,null));};exports[_0x9d50('0x119')]=function(_0x281708,_0x38b527,_0x486982){var _0xd417f2={};var _0x41dfee={};var _0x4d95ea;var _0x45c663;return db[_0x9d50('0x48')][_0x9d50('0xc6')]({'where':{'id':_0x281708['params']['id']}})[_0x9d50('0x20')](handleEntityNotFound(_0x38b527,null))['then'](function(_0x58b53f){if(_0x58b53f){_0x4d95ea=_0x58b53f;_0x41dfee[_0x9d50('0x4a')]=_[_0x9d50('0x4d')](db['CmList'][_0x9d50('0x49')]);_0x41dfee[_0x9d50('0x4e')]=_['keys'](_0x281708[_0x9d50('0x4e')]);_0x41dfee[_0x9d50('0x4f')]=_[_0x9d50('0x50')](_0x41dfee[_0x9d50('0x4a')],_0x41dfee['query']);_0xd417f2['attributes']=_[_0x9d50('0x50')](_0x41dfee[_0x9d50('0x4a')],qs[_0x9d50('0x52')](_0x281708[_0x9d50('0x4e')]['fields']));_0xd417f2[_0x9d50('0x51')]=_0xd417f2[_0x9d50('0x51')][_0x9d50('0x53')]?_0xd417f2['attributes']:_0x41dfee[_0x9d50('0x4a')];_0xd417f2[_0x9d50('0x56')]=qs[_0x9d50('0x57')](_0x281708[_0x9d50('0x4e')]['sort']);_0xd417f2[_0x9d50('0x58')]=qs[_0x9d50('0x4f')](_[_0x9d50('0x59')](_0x281708['query'],_0x41dfee[_0x9d50('0x4f')]));if(_0x281708['query'][_0x9d50('0xbf')]){_0xd417f2[_0x9d50('0x58')]=_[_0x9d50('0x5a')](_0xd417f2[_0x9d50('0x58')],{'$or':_[_0x9d50('0x3f')](_0xd417f2[_0x9d50('0x51')],function(_0x1e846a){var _0x125c64={};_0x125c64[_0x1e846a]={'$like':'%'+_0x281708[_0x9d50('0x4e')][_0x9d50('0xbf')]+'%'};return _0x125c64;})});}_0xd417f2=_[_0x9d50('0x5a')]({},_0xd417f2,_0x281708['options']);return _0x4d95ea[_0x9d50('0x119')](_0xd417f2);}})[_0x9d50('0x20')](function(_0xd043e3){if(_0xd043e3){_0x45c663=_0xd043e3[_0x9d50('0x53')];if(!_0x281708[_0x9d50('0x4e')][_0x9d50('0x54')](_0x9d50('0x55'))){_0xd417f2['limit']=qs[_0x9d50('0x30')](_0x281708['query'][_0x9d50('0x30')]);_0xd417f2['offset']=qs['offset'](_0x281708['query']['offset']);}return _0x4d95ea[_0x9d50('0x119')](_0xd417f2);}})[_0x9d50('0x20')](function(_0x4009b9){if(_0x4009b9){return _0x4009b9?{'count':_0x45c663,'rows':_0x4009b9}:null;}})['then'](respondWithResult(_0x38b527,null))['catch'](handleError(_0x38b527,null));};exports['getAgents']=function(_0x51afe5,_0x5592ea,_0x1d5095){var _0x19d99a={};var _0x24b478={};var _0x34a92b;var _0xec9df6;return db['User']['findOne']({'where':{'id':_0x51afe5[_0x9d50('0x66')]['id']}})['then'](handleEntityNotFound(_0x5592ea,null))[_0x9d50('0x20')](function(_0x1f8a70){if(_0x1f8a70){_0x34a92b=_0x1f8a70;_0x24b478[_0x9d50('0x4a')]=_['keys'](db[_0x9d50('0x48')][_0x9d50('0x49')]);_0x24b478[_0x9d50('0x4e')]=_[_0x9d50('0x4d')](_0x51afe5[_0x9d50('0x4e')]);_0x24b478[_0x9d50('0x4f')]=_[_0x9d50('0x50')](_0x24b478['model'],_0x24b478[_0x9d50('0x4e')]);_0x19d99a[_0x9d50('0x51')]=_['intersection'](_0x24b478['model'],qs[_0x9d50('0x52')](_0x51afe5['query'][_0x9d50('0x52')]));_0x19d99a[_0x9d50('0x51')]=_0x19d99a[_0x9d50('0x51')]['length']?_0x19d99a['attributes']:_0x24b478[_0x9d50('0x4a')];_0x19d99a[_0x9d50('0x56')]=qs[_0x9d50('0x57')](_0x51afe5[_0x9d50('0x4e')][_0x9d50('0x57')]);_0x19d99a['where']=qs['filters'](_[_0x9d50('0x59')](_0x51afe5[_0x9d50('0x4e')],_0x24b478[_0x9d50('0x4f')]));if(_0x51afe5[_0x9d50('0x4e')][_0x9d50('0xbf')]){_0x19d99a[_0x9d50('0x58')]=_[_0x9d50('0x5a')](_0x19d99a[_0x9d50('0x58')],{'$or':_['map'](_0x19d99a[_0x9d50('0x51')],function(_0x58cc7b){var _0x3f8442={};_0x3f8442[_0x58cc7b]={'$like':'%'+_0x51afe5[_0x9d50('0x4e')][_0x9d50('0xbf')]+'%'};return _0x3f8442;})});}_0x19d99a[_0x9d50('0x4a')]=db[_0x9d50('0x48')];_0x19d99a['as']='Agents';_0x19d99a=_['merge']({},_0x19d99a,_0x51afe5['options']);return _0x34a92b[_0x9d50('0x108')]({'include':[_0x19d99a]});}})[_0x9d50('0x20')](function(_0x869585){if(_0x869585){var _0x44bed0={},_0x50f083=[],_0x4756a9=0x0;for(var _0x14f0a2=0x0;_0x14f0a2<_0x869585[_0x9d50('0x53')];_0x14f0a2+=0x1){for(var _0x3393f4=0x0,_0xad4d77;_0x3393f4<_0x869585[_0x14f0a2][_0x9d50('0x3a')][_0x9d50('0x53')];_0x3393f4+=0x1){_0xad4d77=_0x869585[_0x14f0a2][_0x9d50('0x3a')][_0x3393f4][_0x9d50('0x38')]({'plain':!![]});_0x44bed0[_0xad4d77['id']]=_0xad4d77;}}_0x44bed0=_[_0x9d50('0x11a')](_0x44bed0);for(var _0x778f6f=qs[_0x9d50('0x2f')](_0x51afe5[_0x9d50('0x4e')][_0x9d50('0x2f')]);_0x778f6f<_0x44bed0['length']&&_0x50f083[_0x9d50('0x53')]=_0x20a312){_0x4515ea=_0x20a312;_0x2b1ece=0xc8;}else{_0x2b1ece=0xce;}_0x5af984[_0x89a1('0x32')](_0x2b1ece);return _0x5af984[_0x89a1('0x38')]('Content-Range',_0x30e173+'-'+_0x4515ea+'/'+_0x20a312)[_0x89a1('0x34')](_0x22e8f9);}return null;};}function patchUpdates(_0x3368c9){return function(_0x2914a0){try{jsonpatch[_0x89a1('0x39')](_0x2914a0,_0x3368c9,!![]);}catch(_0x5c7f60){return BPromise[_0x89a1('0x3a')](_0x5c7f60);}return _0x2914a0[_0x89a1('0x3b')]();};}function saveUpdates(_0x29af03,_0x39ac1c){return function(_0x1931a2){if(_0x1931a2){return _0x1931a2[_0x89a1('0x3c')](_0x29af03)[_0x89a1('0x26')](function(_0xdcc7d7){return _0xdcc7d7;});}return null;};}function removeEntity(_0x3a215c,_0x3fe3ea){return function(_0xc317cb){if(_0xc317cb){return _0xc317cb[_0x89a1('0x3d')]()[_0x89a1('0x26')](function(){var _0x4b4f5f=_0xc317cb[_0x89a1('0x3e')]({'plain':!![]});var _0x3f441d=[{'name':_0x89a1('0x3f'),'value':_0x89a1('0x40'),'ignore':!![]},{'name':_0x89a1('0x41'),'value':_0x89a1('0x42'),'ignore':![]},{'name':'Telephones','value':_0x89a1('0x43'),'ignore':![]}];var _0x38cd4d=_(_0x3f441d)['filter'](_0x89a1('0x44'))['map'](_0x89a1('0x45'))[_0x89a1('0x45')]();if(_[_0x89a1('0x46')](_0x38cd4d,_0x4b4f5f[_0x89a1('0x47')])){return;}var _0x14bcfd=_['find'](_0x3f441d,[_0x89a1('0x45'),_0x4b4f5f[_0x89a1('0x47')]])[_0x89a1('0x48')];return db['UserProfileResource'][_0x89a1('0x3d')]({'where':{'type':_0x14bcfd,'resourceId':_0x4b4f5f['id']}})[_0x89a1('0x26')](function(){return _0xc317cb;});})[_0x89a1('0x26')](function(){_0x3a215c[_0x89a1('0x32')](0xcc)[_0x89a1('0x33')]();});}};}function handleEntityNotFound(_0x315b40,_0x270fe6){return function(_0x361c1b){if(!_0x361c1b){_0x315b40['sendStatus'](0x194);}return _0x361c1b;};}function handleError(_0x530a78,_0x44a2fa){_0x44a2fa=_0x44a2fa||0x1f4;return function(_0x40e8ad){logger[_0x89a1('0x2c')](_0x40e8ad['stack']);if(_0x40e8ad[_0x89a1('0x48')]){delete _0x40e8ad[_0x89a1('0x48')];}_0x530a78[_0x89a1('0x32')](_0x44a2fa)[_0x89a1('0x49')](_0x40e8ad);};}exports['index']=function(_0x21b3d4,_0x702874){var _0x1aac84={},_0x4a4e90={},_0x499913={'count':0x0,'rows':[]};var _0x386775=_[_0x89a1('0x4a')](db[_0x89a1('0x4b')][_0x89a1('0x4c')],function(_0x5f0299){return{'name':_0x5f0299['fieldName'],'type':_0x5f0299[_0x89a1('0x4d')][_0x89a1('0x4e')]};});_0x4a4e90[_0x89a1('0x4f')]=_[_0x89a1('0x50')](_[_0x89a1('0x4a')](_0x386775,_0x89a1('0x48')),['password',_0x89a1('0x51')]);_0x4a4e90[_0x89a1('0x52')]=_[_0x89a1('0x53')](_0x21b3d4[_0x89a1('0x52')]);_0x4a4e90[_0x89a1('0x54')]=_['intersection'](_0x4a4e90[_0x89a1('0x4f')],_0x4a4e90[_0x89a1('0x52')]);_0x1aac84[_0x89a1('0x55')]=_[_0x89a1('0x56')](_0x4a4e90['model'],qs[_0x89a1('0x57')](_0x21b3d4[_0x89a1('0x52')][_0x89a1('0x57')]));_0x1aac84['attributes']=_0x1aac84[_0x89a1('0x55')][_0x89a1('0x58')]?_0x1aac84[_0x89a1('0x55')]:_0x4a4e90[_0x89a1('0x4f')];if(!_0x21b3d4[_0x89a1('0x52')]['hasOwnProperty'](_0x89a1('0x59'))){_0x1aac84[_0x89a1('0x37')]=qs[_0x89a1('0x37')](_0x21b3d4['query'][_0x89a1('0x37')]);_0x1aac84['offset']=qs[_0x89a1('0x36')](_0x21b3d4['query'][_0x89a1('0x36')]);}_0x1aac84[_0x89a1('0x5a')]=qs['sort'](_0x21b3d4[_0x89a1('0x52')][_0x89a1('0x5b')]);_0x1aac84[_0x89a1('0x5c')]=qs[_0x89a1('0x54')](_[_0x89a1('0x5d')](_0x21b3d4[_0x89a1('0x52')],_0x4a4e90[_0x89a1('0x54')]));if(_0x21b3d4[_0x89a1('0x52')][_0x89a1('0x5e')]){_0x1aac84[_0x89a1('0x5c')]=_[_0x89a1('0x5f')](_0x1aac84[_0x89a1('0x5c')],{'$or':_['map'](_0x386775,function(_0x2cff9c){if(_0x2cff9c[_0x89a1('0x4d')]!==_0x89a1('0x60')){return db[_0x89a1('0x61')][_0x89a1('0x5c')](db[_0x89a1('0x61')]['fn'](_0x89a1('0x62'),db['sequelize'][_0x89a1('0x63')](_0x2cff9c[_0x89a1('0x48')])),{'$like':db[_0x89a1('0x61')]['fn'](_0x89a1('0x62'),'%'+_0x21b3d4[_0x89a1('0x52')][_0x89a1('0x5e')]+'%')});}})});}_0x1aac84=_[_0x89a1('0x5f')]({},_0x1aac84,_0x21b3d4['options']);var _0x14d902={'where':_0x1aac84[_0x89a1('0x5c')]};return db['User'][_0x89a1('0x35')](_0x14d902)['then'](function(_0x3c0217){_0x499913[_0x89a1('0x35')]=_0x3c0217;if(_0x21b3d4[_0x89a1('0x52')]['includeAll']){_0x1aac84['include']=[{'all':!![]}];}return db['User']['findAll'](_0x1aac84);})[_0x89a1('0x26')](function(_0x21e4dd){_0x499913[_0x89a1('0x64')]=_0x21e4dd;return _0x499913;})[_0x89a1('0x26')](respondWithFilteredResult(_0x702874,_0x1aac84))[_0x89a1('0x30')](handleError(_0x702874,null));};exports[_0x89a1('0x65')]=function(_0x8b521f,_0x1a4301){var _0x4587a0={'raw':![],'where':{'id':_0x8b521f['params']['id']}},_0x4711e7={};_0x4711e7[_0x89a1('0x4f')]=_['differenceBy'](_[_0x89a1('0x53')](db[_0x89a1('0x4b')]['rawAttributes']),[_0x89a1('0x66'),_0x89a1('0x51')]);_0x4711e7[_0x89a1('0x52')]=_[_0x89a1('0x53')](_0x8b521f[_0x89a1('0x52')]);_0x4711e7['filters']=_[_0x89a1('0x56')](_0x4711e7[_0x89a1('0x4f')],_0x4711e7[_0x89a1('0x52')]);_0x4587a0[_0x89a1('0x55')]=_[_0x89a1('0x56')](_0x4711e7['model'],qs[_0x89a1('0x57')](_0x8b521f[_0x89a1('0x52')][_0x89a1('0x57')]));_0x4587a0['attributes']=_0x4587a0[_0x89a1('0x55')][_0x89a1('0x58')]?_0x4587a0['attributes']:_0x4711e7[_0x89a1('0x4f')];if(_0x8b521f['query']['includeAll']){_0x4587a0[_0x89a1('0x67')]=[{'all':!![]}];}_0x4587a0=_[_0x89a1('0x5f')]({},_0x4587a0,_0x8b521f[_0x89a1('0x68')]);return db[_0x89a1('0x4b')][_0x89a1('0x69')](_0x4587a0)[_0x89a1('0x26')](handleEntityNotFound(_0x1a4301,null))['then'](respondWithResult(_0x1a4301,null))[_0x89a1('0x30')](handleError(_0x1a4301,null));};exports['bulkCreate']=function(_0x574dcc,_0x4c3b00){return db[_0x89a1('0x4b')][_0x89a1('0x6a')](_0x574dcc[_0x89a1('0x6b')],{'raw':![],'individualHooks':!![]})[_0x89a1('0x26')](respondWithResult(_0x4c3b00,0xc9))[_0x89a1('0x30')](handleError(_0x4c3b00,null));};exports[_0x89a1('0x3c')]=function(_0x5de36e,_0x3ded4d){if(_0x5de36e['body']['id']){delete _0x5de36e[_0x89a1('0x6b')]['id'];}delete _0x5de36e[_0x89a1('0x6b')]['role'];return db['User']['find']({'where':{'id':_0x5de36e['params']['id']}})[_0x89a1('0x26')](handleEntityNotFound(_0x3ded4d,null))[_0x89a1('0x26')](saveUpdates(_0x5de36e[_0x89a1('0x6b')],null))[_0x89a1('0x26')](respondWithResult(_0x3ded4d,null))[_0x89a1('0x30')](handleError(_0x3ded4d,null));};exports[_0x89a1('0x6c')]=function(_0x367e28,_0x40bafe){return db['User'][_0x89a1('0x6c')]()[_0x89a1('0x26')](respondWithResult(_0x40bafe,null))[_0x89a1('0x30')](handleError(_0x40bafe,null));};exports[_0x89a1('0x6d')]=function(_0x16487e,_0x363e09,_0x1e3c32){return db['User']['find']({'where':{'id':_0x16487e[_0x89a1('0x6e')]['id']}})[_0x89a1('0x26')](handleEntityNotFound(_0x363e09,null))['then'](function(_0x260260){if(_0x260260){return _0x260260[_0x89a1('0x6d')](_0x16487e[_0x89a1('0x6b')]['ids'],_[_0x89a1('0x6f')](_0x16487e[_0x89a1('0x6b')],[_0x89a1('0x70'),'id'])||{});}})[_0x89a1('0x26')](respondWithResult(_0x363e09,null))[_0x89a1('0x30')](handleError(_0x363e09,null));};var getLicense=function(_0x476d21){return new BPromise(function(_0xe507f0,_0x63260d){var _0x35fbfd=0x0;_0x476d21[_0x89a1('0x6b')][_0x89a1('0x47')]==='agent'&&_0xe507f0('agent\x20role');return db[_0x89a1('0x4b')][_0x89a1('0x35')]({'where':{'$or':[{'role':_0x476d21[_0x89a1('0x6b')]['role']===_0x89a1('0x43')?_0x89a1('0x43'):[_0x89a1('0x71'),_0x89a1('0x40')]}]}})[_0x89a1('0x26')](function(_0x243983){_0x35fbfd=_0x243983;return require(_0x89a1('0x72'))[_0x89a1('0x73')]();})['then'](function(_0x333c27){var _0x57973d=_0x476d21[_0x89a1('0x6b')][_0x89a1('0x47')]===_0x89a1('0x43')?_0x89a1('0x74'):_0x89a1('0x75');if(!_[_0x89a1('0x76')](_0x333c27[_0x57973d])&&_0x35fbfd>=_0x333c27[_0x57973d]){return _0x63260d({'message':_0x89a1('0x77')});}return _0xe507f0(util[_0x89a1('0x78')](_0x89a1('0x79'),_0x57973d,_0x35fbfd));})[_0x89a1('0x30')](function(_0x41e1a9){return _0x63260d(_0x41e1a9);});});};exports[_0x89a1('0x7a')]=function(_0x48c4a2,_0x4e0bfb){return getLicense(_0x48c4a2)[_0x89a1('0x26')](function(_0x521b0d){if(!_0x48c4a2[_0x89a1('0x6b')][_0x89a1('0x7b')]){var _0x2183b8;return db['Setting'][_0x89a1('0x7c')](0x1)['then'](function(_0x48a171){return checkPasswordPattern(_0x48a171,_0x48c4a2[_0x89a1('0x6b')][_0x89a1('0x66')],_0x48a171[_0x89a1('0x7d')]);})['then'](function(_0x5b7298){_0x2183b8=_0x5b7298['min_internal'];return db['User'][_0x89a1('0x7e')](_0x89a1('0x7b'));})[_0x89a1('0x26')](function(_0x278f63){if(_[_0x89a1('0x76')](_0x278f63)){if(_0x2183b8){_0x48c4a2[_0x89a1('0x6b')]['internal']=_0x2183b8;}else{_0x48c4a2[_0x89a1('0x6b')]['internal']=0x1;}}else{if(_['isNil'](_0x2183b8)||_0x2183b8==_0x278f63){_0x48c4a2[_0x89a1('0x6b')]['internal']=_0x278f63+0x1;}else if(_0x2183b8>_0x278f63){_0x48c4a2[_0x89a1('0x6b')][_0x89a1('0x7b')]=_0x2183b8;}else{return db['sequelize'][_0x89a1('0x52')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x89a1('0x61')][_0x89a1('0x7f')]['SELECT']})[_0x89a1('0x26')](function(_0x382a2f){if(_0x382a2f&&_0x382a2f['length']){for(var _0x523f67=0x0,_0x2d284e=_0x382a2f['length'];_0x523f67<_0x2d284e&&_[_0x89a1('0x76')](_0x48c4a2['body'][_0x89a1('0x7b')]);_0x523f67++){if(_0x2183b8<=_0x382a2f[_0x523f67][_0x89a1('0x80')]){_0x48c4a2[_0x89a1('0x6b')][_0x89a1('0x7b')]=_0x382a2f[_0x523f67]['from'];}else if(_0x2183b8>_0x382a2f[_0x523f67][_0x89a1('0x80')]&&_0x2183b8<=_0x382a2f[_0x523f67]['to']){_0x48c4a2['body'][_0x89a1('0x7b')]=_0x2183b8;}}}if(_[_0x89a1('0x76')](_0x48c4a2[_0x89a1('0x6b')]['internal'])){_0x48c4a2[_0x89a1('0x6b')][_0x89a1('0x7b')]=_0x278f63+0x1;}});}}});}})['then'](function(){if(_0x48c4a2[_0x89a1('0x6b')]['voicemail']){_0x48c4a2['body'][_0x89a1('0x81')]=_0x48c4a2[_0x89a1('0x6b')][_0x89a1('0x7b')];_0x48c4a2[_0x89a1('0x6b')]['VoiceMail']={'mailbox':_0x48c4a2[_0x89a1('0x6b')]['internal'],'password':_0x48c4a2[_0x89a1('0x6b')][_0x89a1('0x66')],'fullname':_0x48c4a2[_0x89a1('0x6b')][_0x89a1('0x82')],'email':_0x48c4a2[_0x89a1('0x6b')]['email']};}if(_0x48c4a2[_0x89a1('0x6b')]&&_0x48c4a2[_0x89a1('0x6b')]['role']==='agent'){_0x48c4a2['body']['permissions']=['101',_0x89a1('0x83'),_0x89a1('0x84'),_0x89a1('0x85'),_0x89a1('0x86'),_0x89a1('0x87'),_0x89a1('0x88'),_0x89a1('0x89'),_0x89a1('0x8a'),_0x89a1('0x8b'),_0x89a1('0x8c'),_0x89a1('0x8d')];}return db['User'][_0x89a1('0x7a')](_0x48c4a2[_0x89a1('0x6b')],{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0x89a1('0x26')](function(_0x4d515f){if(_0x48c4a2['body'][_0x89a1('0x47')]===_0x89a1('0x40'))return _0x4d515f;var _0x4358f4=_0x48c4a2[_0x89a1('0x40')][_0x89a1('0x3e')]({'plain':!![]});if(!_0x4358f4)throw new Error(_0x89a1('0x8e'));if(_0x4358f4['role']==='user'){var _0x318c37=_0x4d515f[_0x89a1('0x3e')]({'plain':!![]});var _0x70bede=[{'name':_0x89a1('0x41'),'value':_0x89a1('0x42')},{'name':'Telephones','value':_0x89a1('0x43')}];var _0x532bcf=_[_0x89a1('0x69')](_0x70bede,[_0x89a1('0x45'),_0x318c37[_0x89a1('0x47')]])[_0x89a1('0x48')];return db[_0x89a1('0x8f')][_0x89a1('0x69')]({'where':{'name':_0x532bcf,'userProfileId':_0x4358f4['userProfileId']},'raw':!![]})[_0x89a1('0x26')](function(_0x2b19fc){if(_0x2b19fc&&_0x2b19fc[_0x89a1('0x90')]===0x0){return db[_0x89a1('0x91')]['create']({'name':_0x318c37[_0x89a1('0x48')],'resourceId':_0x318c37['id'],'type':_0x2b19fc[_0x89a1('0x48')],'sectionId':_0x2b19fc['id']},{})[_0x89a1('0x26')](function(){return _0x4d515f;});}else{return _0x4d515f;}})[_0x89a1('0x30')](function(_0x3a8bd7){logger[_0x89a1('0x2c')](_0x89a1('0x92'),_0x3a8bd7);throw _0x3a8bd7;});}return _0x4d515f;})['then'](respondWithResult(_0x4e0bfb,0xc9))['catch'](handleError(_0x4e0bfb,null));};exports[_0x89a1('0x93')]=function(_0x3e4646,_0x327cd4,_0x2ee685){var _0x1c1d11=![];if(_0x3e4646['body']['id']){delete _0x3e4646['body']['id'];}return db['Setting'][_0x89a1('0x94')]({'attributes':['id',_0x89a1('0x7d')]})['then'](function(_0x10ffda){_0x1c1d11=_0x10ffda[_0x89a1('0x7d')];return db[_0x89a1('0x4b')]['find']({'where':{'id':_0x3e4646[_0x89a1('0x6e')]['id']}});})['then'](function(_0x3c45f3){if(_0x3c45f3){if(_0x3c45f3['id']==_0x3e4646[_0x89a1('0x40')]['id']){if(!_0x3e4646[_0x89a1('0x6b')][_0x89a1('0x95')]||!_0x3e4646[_0x89a1('0x6b')]['newPassword']){throw new db['Sequelize'][(_0x89a1('0x23'))]('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x3c45f3[_0x89a1('0x96')](_0x3e4646[_0x89a1('0x6b')][_0x89a1('0x95')])){throw new db['Sequelize'][(_0x89a1('0x23'))](_0x89a1('0x97'));}if(_0x3e4646[_0x89a1('0x6b')][_0x89a1('0x95')]==_0x3e4646['body'][_0x89a1('0x98')]){throw new db[(_0x89a1('0x22'))][(_0x89a1('0x23'))](_0x89a1('0x99'));}return _0x3c45f3;}else if(_0x3e4646[_0x89a1('0x40')][_0x89a1('0x47')]==_0x89a1('0x71')){if(!_0x3e4646['body']['newPassword']){throw new db[(_0x89a1('0x22'))][(_0x89a1('0x23'))](_0x89a1('0x9a'));}return _0x3c45f3;}else if(_0x3e4646['user'][_0x89a1('0x47')]=='user'){if(!_0x3e4646[_0x89a1('0x6b')][_0x89a1('0x98')]){throw new db[(_0x89a1('0x22'))][(_0x89a1('0x23'))](_0x89a1('0x9a'));}if(_0x3c45f3[_0x89a1('0x47')]!=_0x89a1('0x42')){throw new db[(_0x89a1('0x22'))]['ValidationError'](_0x89a1('0x9b'));}return _0x3c45f3;}else{throw new db[(_0x89a1('0x22'))]['ValidationError'](_0x89a1('0x9b'));}}return null;})[_0x89a1('0x26')](handleEntityNotFound(_0x327cd4,null))[_0x89a1('0x26')](function(_0x36661a){return checkPasswordPattern(_0x36661a,_0x3e4646[_0x89a1('0x6b')][_0x89a1('0x98')],_0x1c1d11);})[_0x89a1('0x26')](saveUpdates({'password':_0x3e4646[_0x89a1('0x6b')][_0x89a1('0x98')],'passwordResetAt':_0x3e4646[_0x89a1('0x40')]['id']==_0x3e4646[_0x89a1('0x6e')]['id']?moment():null},null))[_0x89a1('0x26')](respondWithResult(_0x327cd4,null))[_0x89a1('0x30')](handleError(_0x327cd4,null));};exports[_0x89a1('0x9c')]=function(_0x3cf7eb,_0x2130e0,_0x1e1e48){var _0x163f43=_0x3cf7eb['body']['channel'];return db[_0x89a1('0x4b')][_0x89a1('0x69')]({'where':{'id':_0x3cf7eb['params']['id']},'attributes':['id',_0x89a1('0x48'),_0x89a1('0x47'),_0x89a1('0x9d'),_0x89a1('0x9e'),'voicePause','interface']})['then'](handleEntityNotFound(_0x2130e0,null))[_0x89a1('0x26')](function(_0xd7f726){if(_0xd7f726){if(!utils['isValidChannel'](_0x163f43)){throw new db['Sequelize'][(_0x89a1('0x23'))](_0x89a1('0x9f'));}return _0xd7f726[_0x89a1('0xa0')+_[_0x89a1('0xa1')](_0x163f43[_0x89a1('0xa2')]())+_0x89a1('0xa3')](_0x3cf7eb['body']['ids'],{'penalty':_0x3cf7eb[_0x89a1('0x6b')][_0x89a1('0xa4')]||0x0})[_0x89a1('0xa5')](function(_0x136328){for(var _0x1ca2f8=0x0;_0x1ca2f8<_0x3cf7eb['body'][_0x89a1('0x70')]['length'];_0x1ca2f8+=0x1){var _0x2d3628={'UserId':_0x3cf7eb[_0x89a1('0x6e')]['id']};_0x2d3628[_['capitalize'](_0x163f43['toLowerCase']())+_0x89a1('0xa6')]=_0x3cf7eb[_0x89a1('0x6b')][_0x89a1('0x70')][_0x1ca2f8];socket[_0x89a1('0xa7')]('user'+_[_0x89a1('0xa1')](_0x163f43[_0x89a1('0xa2')]())+'Queue:save',_0x2d3628);}return _0x136328;})[_0x89a1('0x26')](function(){if(_0x163f43===_0x89a1('0xa8')){return db[_0x89a1('0xa9')]['findAll']({'where':{'id':_0x3cf7eb['body']['ids']||[]},'raw':!![],'attributes':['id',_0x89a1('0x48')]});}})[_0x89a1('0x26')](function(_0x406f8a){var _0x5dcaba=_0xd7f726[_0x89a1('0x3e')]({'plain':!![]});var _0x533ce1=[];if(_0x163f43==='voice'&&_0x5dcaba['role']===_0x89a1('0x42')&&_0x5dcaba[_0x89a1('0x9d')]){for(var _0x4de73a=0x0;_0x4de73a<_0x406f8a[_0x89a1('0x58')];_0x4de73a+=0x1){_0x533ce1['push']({'membername':_0x5dcaba[_0x89a1('0x48')],'UserId':_0x5dcaba['id'],'queue_name':_0x406f8a[_0x4de73a][_0x89a1('0x48')],'VoiceQueueId':_0x406f8a[_0x4de73a]['id'],'interface':_[_0x89a1('0x76')](_0x5dcaba['interface'])?util[_0x89a1('0x78')]('SIP/%s',_0x5dcaba[_0x89a1('0x48')]):_0x5dcaba[_0x89a1('0xaa')],'paused':_0x5dcaba['voicePause']||![],'penalty':_0x3cf7eb['body'][_0x89a1('0xa4')]||0x0});}return BPromise[_0x89a1('0xab')](_0x533ce1,function(_0x9f090a){return db[_0x89a1('0xac')][_0x89a1('0xad')](_0x9f090a);});}return _0xd7f726;});}})[_0x89a1('0x26')](respondWithStatusCode(_0x2130e0,null))[_0x89a1('0x30')](handleError(_0x2130e0,null));};exports[_0x89a1('0xae')]=function(_0x15daa1,_0x229bee,_0x412047){var _0x4ca2b1;return db[_0x89a1('0x4b')][_0x89a1('0x69')]({'where':{'id':_0x15daa1[_0x89a1('0x6e')]['id']},'attributes':['id',_0x89a1('0x48'),_0x89a1('0x47')]})[_0x89a1('0x26')](handleEntityNotFound(_0x229bee,null))[_0x89a1('0x26')](function(_0x66e376){if(_0x66e376){_0x4ca2b1=_0x66e376;if(!_0x15daa1[_0x89a1('0x52')][_0x89a1('0xaf')]||!utils[_0x89a1('0xb0')](_0x15daa1['query'][_0x89a1('0xaf')])){throw new db['Sequelize'][(_0x89a1('0x23'))](_0x89a1('0x9f'));}return _0x66e376[_0x89a1('0xb1')+_[_0x89a1('0xa1')](_0x15daa1[_0x89a1('0x52')][_0x89a1('0xaf')]['toLowerCase']())+_0x89a1('0xa3')](_0x15daa1[_0x89a1('0x52')][_0x89a1('0x70')]);}})[_0x89a1('0x26')](function(_0x37e88e){for(var _0x57fa63=0x0;_0x57fa63<_0x15daa1[_0x89a1('0x52')][_0x89a1('0x70')][_0x89a1('0x58')];_0x57fa63+=0x1){var _0x2890cd={'UserId':_0x15daa1[_0x89a1('0x6e')]['id']};_0x2890cd[_[_0x89a1('0xa1')](_0x15daa1[_0x89a1('0x52')][_0x89a1('0xaf')][_0x89a1('0xa2')]())+'QueueId']=_0x15daa1[_0x89a1('0x52')][_0x89a1('0x70')][_0x57fa63];socket[_0x89a1('0xa7')](_0x89a1('0x40')+_[_0x89a1('0xa1')](_0x15daa1[_0x89a1('0x52')][_0x89a1('0xaf')][_0x89a1('0xa2')]())+_0x89a1('0xb2'),_0x2890cd);}return _0x37e88e;})[_0x89a1('0x26')](function(){if(_0x15daa1[_0x89a1('0x52')]['channel']==='voice'){return db[_0x89a1('0xac')][_0x89a1('0x3d')]({'where':{'UserId':_0x15daa1['params']['id'],'VoiceQueueId':_0x15daa1[_0x89a1('0x52')]['ids']},'individualHooks':!![]})[_0x89a1('0x26')](function(){return _0x4ca2b1;});}return _0x4ca2b1;})[_0x89a1('0x26')](respondWithStatusCode(_0x229bee,null))['catch'](handleError(_0x229bee,null));};exports[_0x89a1('0xb3')]=function(_0x5c1ed8,_0x56ef0b,_0x3d4274){_0x5c1ed8[_0x89a1('0x6b')]['userpic']=_0x5c1ed8[_0x89a1('0xb4')]['filename'];return db[_0x89a1('0x4b')][_0x89a1('0x69')]({'where':{'id':_0x5c1ed8[_0x89a1('0x6e')]['id']}})[_0x89a1('0x26')](handleEntityNotFound(_0x56ef0b,null))['then'](saveUpdates(_0x5c1ed8[_0x89a1('0x6b')],null))['then'](respondWithResult(_0x56ef0b,null))['catch'](handleError(_0x56ef0b,null));};exports['getAvatar']=function(_0xf3ab3a,_0x4f15c0,_0x26908d){var _0x2ff3b7=path[_0x89a1('0xb5')](config['root'],_0x89a1('0xb6'));return db[_0x89a1('0x4b')][_0x89a1('0x69')]({'where':{'id':_0xf3ab3a[_0x89a1('0x6e')]['id']},'attributes':['id',_0x89a1('0xb7')],'raw':!![]})[_0x89a1('0x26')](handleEntityNotFound(_0x4f15c0,null))[_0x89a1('0x26')](function(_0x190d8b){if(_0x190d8b){if(_[_0x89a1('0x76')](_0x190d8b[_0x89a1('0xb7')])){return _0x4f15c0['download'](_0x2ff3b7);}else{if(!fs[_0x89a1('0xb8')](path[_0x89a1('0xb5')](config['root'],_0x89a1('0xb9'),_0x190d8b['userpic']))){return _0x4f15c0['download'](_0x2ff3b7);}return _0x4f15c0[_0x89a1('0xba')](path[_0x89a1('0xb5')](config[_0x89a1('0xbb')],'server/files/images/',_0x190d8b[_0x89a1('0xb7')]));}}})[_0x89a1('0x30')](handleError(_0x4f15c0,null));};exports[_0x89a1('0xbc')]=function(_0x5ab904,_0x2f8c39,_0x1bf688){var _0x397633={};var _0x15767d={};var _0x4eaedf;var _0x961338;return db[_0x89a1('0x4b')][_0x89a1('0x94')]({'where':{'id':_0x5ab904[_0x89a1('0x6e')]['id']}})[_0x89a1('0x26')](handleEntityNotFound(_0x2f8c39,null))['then'](function(_0x1b267b){if(_0x1b267b){_0x4eaedf=_0x1b267b;_0x15767d[_0x89a1('0x4f')]=_[_0x89a1('0x53')](db[_0x89a1('0xbd')]['rawAttributes']);_0x15767d[_0x89a1('0x52')]=_['keys'](_0x5ab904[_0x89a1('0x52')]);_0x15767d[_0x89a1('0x54')]=_[_0x89a1('0x56')](_0x15767d[_0x89a1('0x4f')],_0x15767d['query']);_0x397633['attributes']=_['intersection'](_0x15767d[_0x89a1('0x4f')],qs[_0x89a1('0x57')](_0x5ab904[_0x89a1('0x52')]['fields']));_0x397633[_0x89a1('0x55')]=_0x397633[_0x89a1('0x55')][_0x89a1('0x58')]?_0x397633[_0x89a1('0x55')]:_0x15767d['model'];_0x397633[_0x89a1('0x5a')]=qs[_0x89a1('0x5b')](_0x5ab904[_0x89a1('0x52')][_0x89a1('0x5b')]);_0x397633[_0x89a1('0x5c')]=qs[_0x89a1('0x54')](_[_0x89a1('0x5d')](_0x5ab904['query'],_0x15767d[_0x89a1('0x54')]));if(_0x5ab904[_0x89a1('0x52')][_0x89a1('0x5e')]){_0x397633['where']=_[_0x89a1('0x5f')](_0x397633['where'],{'$or':_[_0x89a1('0x4a')](_0x397633[_0x89a1('0x55')],function(_0x45df5e){var _0x54b7ef={};_0x54b7ef[_0x45df5e]={'$like':'%'+_0x5ab904['query'][_0x89a1('0x5e')]+'%'};return _0x54b7ef;})});}_0x397633=_['merge']({},_0x397633,_0x5ab904[_0x89a1('0x68')]);return _0x4eaedf[_0x89a1('0xbc')](_0x397633);}})[_0x89a1('0x26')](function(_0x894c49){if(_0x894c49){_0x961338=_0x894c49['length'];if(_0x5ab904[_0x89a1('0x52')][_0x89a1('0xbe')](_0x89a1('0xbf'))){_0x397633[_0x89a1('0x67')]=[{'model':db[_0x89a1('0xc0')],'as':'List','required':![]},{'model':db[_0x89a1('0xc1')],'as':'Tags','attributes':['id','name',_0x89a1('0xc2')],'where':_0x5ab904[_0x89a1('0x52')][_0x89a1('0xc3')]?{'id':_0x5ab904[_0x89a1('0x52')]['tag']}:undefined,'required':_0x5ab904[_0x89a1('0x52')]['tag']?!![]:![]}];}if(!_0x5ab904[_0x89a1('0x52')][_0x89a1('0xbe')](_0x89a1('0x59'))){_0x397633[_0x89a1('0x37')]=qs[_0x89a1('0x37')](_0x5ab904[_0x89a1('0x52')][_0x89a1('0x37')]);_0x397633[_0x89a1('0x36')]=qs[_0x89a1('0x36')](_0x5ab904[_0x89a1('0x52')]['offset']);}return _0x4eaedf['getContacts'](_0x397633);}})[_0x89a1('0x26')](function(_0x4dde75){if(_0x4dde75){return _0x4dde75?{'count':_0x961338,'rows':_0x4dde75}:null;}})['then'](respondWithResult(_0x2f8c39,null))[_0x89a1('0x30')](handleError(_0x2f8c39,null));};exports[_0x89a1('0xc4')]=function(_0x4850a1,_0x46f1ec,_0x553fdb){var _0x718760;var _0x19a22d;var _0x302691={};var _0x5853c2;return db[_0x89a1('0x4b')][_0x89a1('0x94')]({'where':{'id':_0x4850a1[_0x89a1('0x6e')]['id']},'attributes':['id',_0x89a1('0x48'),'role']})['then'](handleEntityNotFound(_0x46f1ec,null))[_0x89a1('0x26')](function(_0x2dde76){if(!utils[_0x89a1('0xb0')](_0x4850a1[_0x89a1('0x52')][_0x89a1('0xaf')])){throw new db[(_0x89a1('0x22'))][(_0x89a1('0x23'))](_0x89a1('0x9f'));}_0x718760=_0x2dde76;var _0x27716b={};_0x27716b['model']=_['keys'](db[_[_0x89a1('0xa1')](_0x4850a1[_0x89a1('0x52')][_0x89a1('0xaf')])+'Queue'][_0x89a1('0x4c')]);_0x27716b[_0x89a1('0x52')]=_[_0x89a1('0x53')](_0x4850a1[_0x89a1('0x52')]);_0x27716b[_0x89a1('0x54')]=_[_0x89a1('0x56')](_0x27716b[_0x89a1('0x4f')],_0x27716b[_0x89a1('0x52')]);_0x302691[_0x89a1('0x55')]=_['intersection'](_0x27716b[_0x89a1('0x4f')],qs['fields'](_0x4850a1[_0x89a1('0x52')][_0x89a1('0x57')]));_0x302691['attributes']=_0x302691[_0x89a1('0x55')][_0x89a1('0x58')]?_0x302691[_0x89a1('0x55')]:_0x27716b[_0x89a1('0x4f')];_0x302691[_0x89a1('0x5a')]=qs['sort'](_0x4850a1['query'][_0x89a1('0x5b')]);_0x302691[_0x89a1('0x5c')]=qs[_0x89a1('0x54')](_['pick'](_0x4850a1[_0x89a1('0x52')],_0x27716b[_0x89a1('0x54')]));if(_0x4850a1[_0x89a1('0x52')][_0x89a1('0x5e')]){_0x302691[_0x89a1('0x5c')]=_[_0x89a1('0x5f')](_0x302691[_0x89a1('0x5c')],{'$or':_['map'](_0x302691['attributes'],function(_0x566fdc){var _0xb968b6={};_0xb968b6[_0x566fdc]={'$like':'%'+_0x4850a1[_0x89a1('0x52')][_0x89a1('0x5e')]+'%'};return _0xb968b6;})});}_0x302691=_[_0x89a1('0x5f')]({},_0x302691,_0x4850a1['options']);switch(_0x718760['role']){case'admin':return db[_['capitalize'](_0x4850a1[_0x89a1('0x52')][_0x89a1('0xaf')])+_0x89a1('0xc5')][_0x89a1('0xc6')](_0x302691);case _0x89a1('0x40'):case _0x89a1('0x42'):return _0x718760[_0x89a1('0x3e')+_[_0x89a1('0xa1')](_0x4850a1[_0x89a1('0x52')][_0x89a1('0xaf')])+_0x89a1('0xa3')](_0x302691);default:throw new db[(_0x89a1('0x22'))][(_0x89a1('0x23'))]('Unknown\x20role');}})[_0x89a1('0x26')](function(_0x4176f5){_0x5853c2=_0x4176f5[_0x89a1('0x58')];if(!_0x4850a1[_0x89a1('0x52')][_0x89a1('0xbe')]('nolimit')){_0x302691[_0x89a1('0x37')]=qs[_0x89a1('0x37')](_0x4850a1[_0x89a1('0x52')][_0x89a1('0x37')]);_0x302691[_0x89a1('0x36')]=qs[_0x89a1('0x36')](_0x4850a1['query'][_0x89a1('0x36')]);}switch(_0x718760[_0x89a1('0x47')]){case _0x89a1('0x71'):return db[_['capitalize'](_0x4850a1['query'][_0x89a1('0xaf')])+_0x89a1('0xc5')][_0x89a1('0xc6')](_0x302691);case _0x89a1('0x40'):case _0x89a1('0x42'):return _0x718760[_0x89a1('0x3e')+_[_0x89a1('0xa1')](_0x4850a1[_0x89a1('0x52')][_0x89a1('0xaf')])+_0x89a1('0xa3')](_0x302691);}})[_0x89a1('0x26')](function(_0x167a07){return{'count':_0x5853c2,'rows':_0x167a07};})[_0x89a1('0x26')](respondWithResult(_0x46f1ec,null))[_0x89a1('0x30')](handleError(_0x46f1ec,null));};exports[_0x89a1('0xc7')]=function(_0x22cfda,_0xc0f9c9,_0x4c06f3){var _0x3b07a9={};var _0x575b23={};var _0x5f534a;var _0x121634;return db[_0x89a1('0x4b')]['findOne']({'where':{'id':_0x22cfda['params']['id']}})[_0x89a1('0x26')](handleEntityNotFound(_0xc0f9c9,null))[_0x89a1('0x26')](function(_0x8bd3ff){if(_0x8bd3ff){_0x5f534a=_0x8bd3ff;_0x575b23['model']=_[_0x89a1('0x53')](db[_0x89a1('0xac')][_0x89a1('0x4c')]);_0x575b23['query']=_[_0x89a1('0x53')](_0x22cfda[_0x89a1('0x52')]);_0x575b23['filters']=_[_0x89a1('0x56')](_0x575b23[_0x89a1('0x4f')],_0x575b23[_0x89a1('0x52')]);_0x3b07a9[_0x89a1('0x55')]=_[_0x89a1('0x56')](_0x575b23['model'],qs['fields'](_0x22cfda['query']['fields']));_0x3b07a9['attributes']=_0x3b07a9[_0x89a1('0x55')]['length']?_0x3b07a9[_0x89a1('0x55')]:_0x575b23[_0x89a1('0x4f')];_0x3b07a9['order']=qs['sort'](_0x22cfda['query'][_0x89a1('0x5b')]);_0x3b07a9[_0x89a1('0x5c')]=qs[_0x89a1('0x54')](_[_0x89a1('0x5d')](_0x22cfda[_0x89a1('0x52')],_0x575b23['filters']));if(_0x22cfda[_0x89a1('0x52')][_0x89a1('0x5e')]){_0x3b07a9[_0x89a1('0x5c')]=_[_0x89a1('0x5f')](_0x3b07a9['where'],{'$or':_[_0x89a1('0x4a')](_0x3b07a9[_0x89a1('0x55')],function(_0x271756){var _0x5f5ce7={};_0x5f5ce7[_0x271756]={'$like':'%'+_0x22cfda[_0x89a1('0x52')]['filter']+'%'};return _0x5f5ce7;})});}_0x3b07a9=_['merge']({},_0x3b07a9,_0x22cfda['options']);return _0x5f534a[_0x89a1('0xc7')](_0x3b07a9);}})[_0x89a1('0x26')](function(_0x2adda0){if(_0x2adda0){_0x121634=_0x2adda0[_0x89a1('0x58')];if(!_0x22cfda[_0x89a1('0x52')]['hasOwnProperty'](_0x89a1('0x59'))){_0x3b07a9['limit']=qs[_0x89a1('0x37')](_0x22cfda[_0x89a1('0x52')][_0x89a1('0x37')]);_0x3b07a9[_0x89a1('0x36')]=qs[_0x89a1('0x36')](_0x22cfda[_0x89a1('0x52')]['offset']);}return _0x5f534a[_0x89a1('0xc7')](_0x3b07a9);}})[_0x89a1('0x26')](function(_0x5dd969){if(_0x5dd969){return _0x5dd969?{'count':_0x121634,'rows':_0x5dd969}:null;}})[_0x89a1('0x26')](respondWithResult(_0xc0f9c9,null))[_0x89a1('0x30')](handleError(_0xc0f9c9,null));};exports[_0x89a1('0xc8')]=function(_0x2dac08,_0x4c796a,_0x4b5169){var _0x1652fe={};var _0x25a07d={};var _0x382559;var _0x46ee91;return db[_0x89a1('0x4b')]['findOne']({'where':{'id':_0x2dac08[_0x89a1('0x6e')]['id']}})[_0x89a1('0x26')](handleEntityNotFound(_0x4c796a,null))[_0x89a1('0x26')](function(_0x17b664){if(_0x17b664){_0x382559=_0x17b664;_0x25a07d[_0x89a1('0x4f')]=_[_0x89a1('0x53')](db[_0x89a1('0xc9')]['rawAttributes']);_0x25a07d[_0x89a1('0x52')]=_['keys'](_0x2dac08[_0x89a1('0x52')]);_0x25a07d[_0x89a1('0x54')]=_[_0x89a1('0x56')](_0x25a07d[_0x89a1('0x4f')],_0x25a07d[_0x89a1('0x52')]);_0x1652fe[_0x89a1('0x55')]=_[_0x89a1('0x56')](_0x25a07d['model'],qs[_0x89a1('0x57')](_0x2dac08[_0x89a1('0x52')]['fields']));_0x1652fe[_0x89a1('0x55')]=_0x1652fe[_0x89a1('0x55')][_0x89a1('0x58')]?_0x1652fe[_0x89a1('0x55')]:_0x25a07d[_0x89a1('0x4f')];_0x1652fe[_0x89a1('0x5a')]=qs['sort'](_0x2dac08['query'][_0x89a1('0x5b')]);_0x1652fe[_0x89a1('0x5c')]=qs[_0x89a1('0x54')](_[_0x89a1('0x5d')](_0x2dac08['query'],_0x25a07d[_0x89a1('0x54')]));if(_0x2dac08[_0x89a1('0x52')][_0x89a1('0x5e')]){_0x1652fe[_0x89a1('0x5c')]=_[_0x89a1('0x5f')](_0x1652fe[_0x89a1('0x5c')],{'$or':_['map'](_0x1652fe[_0x89a1('0x55')],function(_0x50716d){var _0x1cc47b={};_0x1cc47b[_0x50716d]={'$like':'%'+_0x2dac08[_0x89a1('0x52')][_0x89a1('0x5e')]+'%'};return _0x1cc47b;})});}_0x1652fe=_[_0x89a1('0x5f')]({},_0x1652fe,_0x2dac08[_0x89a1('0x68')]);return _0x382559[_0x89a1('0xc8')](_0x1652fe);}})[_0x89a1('0x26')](function(_0x2dd110){if(_0x2dd110){_0x46ee91=_0x2dd110[_0x89a1('0x58')];if(!_0x2dac08['query']['hasOwnProperty'](_0x89a1('0x59'))){_0x1652fe[_0x89a1('0x37')]=qs['limit'](_0x2dac08['query'][_0x89a1('0x37')]);_0x1652fe[_0x89a1('0x36')]=qs['offset'](_0x2dac08[_0x89a1('0x52')][_0x89a1('0x36')]);}return _0x382559[_0x89a1('0xc8')](_0x1652fe);}})[_0x89a1('0x26')](function(_0x13e938){if(_0x13e938){return _0x13e938?{'count':_0x46ee91,'rows':_0x13e938}:null;}})[_0x89a1('0x26')](respondWithResult(_0x4c796a,null))[_0x89a1('0x30')](handleError(_0x4c796a,null));};exports[_0x89a1('0xca')]=function(_0x440c50,_0x434223,_0x20213c){var _0x4155c8={'raw':!![],'where':{}};var _0x5b5dab={};var _0x1320e2={'count':0x0,'rows':[]};return db['User'][_0x89a1('0x94')]({'where':{'id':_0x440c50[_0x89a1('0x6e')]['id']}})['then'](handleEntityNotFound(_0x434223,null))[_0x89a1('0x26')](function(_0xe6d420){if(_0xe6d420){_0x5b5dab[_0x89a1('0x4f')]=_[_0x89a1('0x53')](db[_0x89a1('0xcb')][_0x89a1('0x4c')]);_0x5b5dab[_0x89a1('0x52')]=_[_0x89a1('0x53')](_0x440c50[_0x89a1('0x52')]);_0x5b5dab['filters']=_[_0x89a1('0x56')](_0x5b5dab['model'],_0x5b5dab['query']);_0x4155c8['attributes']=_[_0x89a1('0x56')](_0x5b5dab['model'],qs['fields'](_0x440c50[_0x89a1('0x52')][_0x89a1('0x57')]));_0x4155c8[_0x89a1('0x55')]=_0x4155c8['attributes'][_0x89a1('0x58')]?_0x4155c8[_0x89a1('0x55')]:_0x5b5dab[_0x89a1('0x4f')];if(!_0x440c50[_0x89a1('0x52')][_0x89a1('0xbe')](_0x89a1('0x59'))){_0x4155c8['limit']=qs[_0x89a1('0x37')](_0x440c50[_0x89a1('0x52')][_0x89a1('0x37')]);_0x4155c8[_0x89a1('0x36')]=qs['offset'](_0x440c50[_0x89a1('0x52')][_0x89a1('0x36')]);}_0x4155c8[_0x89a1('0x5a')]=qs['sort'](_0x440c50[_0x89a1('0x52')][_0x89a1('0x5b')]);_0x4155c8[_0x89a1('0x5c')]=qs['filters'](_[_0x89a1('0x5d')](_0x440c50[_0x89a1('0x52')],_0x5b5dab[_0x89a1('0x54')]));_0x4155c8[_0x89a1('0x5c')]['UserId']=_0xe6d420['id'];if(_0x440c50[_0x89a1('0x52')][_0x89a1('0x5e')]){_0x4155c8[_0x89a1('0x5c')]=_[_0x89a1('0x5f')](_0x4155c8[_0x89a1('0x5c')],{'$or':_[_0x89a1('0x4a')](_0x4155c8[_0x89a1('0x55')],function(_0x5e7d2f){var _0x206f3d={};_0x206f3d[_0x5e7d2f]={'$like':'%'+_0x440c50[_0x89a1('0x52')][_0x89a1('0x5e')]+'%'};return _0x206f3d;})});}_0x4155c8=_[_0x89a1('0x5f')]({},_0x4155c8,_0x440c50['options']);return db['VoiceRecording']['count']({'where':_0x4155c8[_0x89a1('0x5c')]})[_0x89a1('0x26')](function(_0x1b0657){_0x1320e2[_0x89a1('0x35')]=_0x1b0657;if(_0x440c50[_0x89a1('0x52')][_0x89a1('0xbf')]){_0x4155c8[_0x89a1('0x67')]=[{'all':!![]}];}return db['VoiceRecording'][_0x89a1('0xc6')](_0x4155c8);})['then'](function(_0x2c87a0){_0x1320e2['rows']=_0x2c87a0;return _0x1320e2;});}})[_0x89a1('0x26')](respondWithFilteredResult(_0x434223,_0x4155c8))[_0x89a1('0x30')](handleError(_0x434223,null));};exports[_0x89a1('0xcc')]=function(_0x3c4b53,_0x43c761,_0x335e9c){var _0x1a4d88={'raw':!![],'where':{}};var _0x28b8fa={};var _0x292412={'count':0x0,'rows':[]};return db[_0x89a1('0x4b')][_0x89a1('0x94')]({'where':{'id':_0x3c4b53['params']['id']}})['then'](handleEntityNotFound(_0x43c761,null))[_0x89a1('0x26')](function(_0x28a040){if(_0x28a040){_0x28b8fa[_0x89a1('0x4f')]=_[_0x89a1('0x53')](db[_0x89a1('0xcd')][_0x89a1('0x4c')]);_0x28b8fa[_0x89a1('0x52')]=_[_0x89a1('0x53')](_0x3c4b53[_0x89a1('0x52')]);_0x28b8fa[_0x89a1('0x54')]=_[_0x89a1('0x56')](_0x28b8fa[_0x89a1('0x4f')],_0x28b8fa['query']);_0x1a4d88[_0x89a1('0x55')]=_['intersection'](_0x28b8fa[_0x89a1('0x4f')],qs[_0x89a1('0x57')](_0x3c4b53[_0x89a1('0x52')][_0x89a1('0x57')]));_0x1a4d88['attributes']=_0x1a4d88[_0x89a1('0x55')][_0x89a1('0x58')]?_0x1a4d88['attributes']:_0x28b8fa[_0x89a1('0x4f')];if(!_0x3c4b53[_0x89a1('0x52')][_0x89a1('0xbe')](_0x89a1('0x59'))){_0x1a4d88['limit']=qs[_0x89a1('0x37')](_0x3c4b53[_0x89a1('0x52')]['limit']);_0x1a4d88[_0x89a1('0x36')]=qs[_0x89a1('0x36')](_0x3c4b53[_0x89a1('0x52')][_0x89a1('0x36')]);}_0x1a4d88[_0x89a1('0x5a')]=qs[_0x89a1('0x5b')](_0x3c4b53['query'][_0x89a1('0x5b')]);_0x1a4d88['where']=qs[_0x89a1('0x54')](_['pick'](_0x3c4b53[_0x89a1('0x52')],_0x28b8fa[_0x89a1('0x54')]));_0x1a4d88[_0x89a1('0x5c')][_0x89a1('0xce')]=_0x28a040['id'];if(_0x3c4b53[_0x89a1('0x52')][_0x89a1('0x5e')]){_0x1a4d88[_0x89a1('0x5c')]=_[_0x89a1('0x5f')](_0x1a4d88[_0x89a1('0x5c')],{'$or':_[_0x89a1('0x4a')](_0x1a4d88[_0x89a1('0x55')],function(_0x5caa3b){var _0x293226={};_0x293226[_0x5caa3b]={'$like':'%'+_0x3c4b53['query'][_0x89a1('0x5e')]+'%'};return _0x293226;})});}_0x1a4d88=_['merge']({},_0x1a4d88,_0x3c4b53['options']);return db[_0x89a1('0xcd')][_0x89a1('0x35')]({'where':_0x1a4d88[_0x89a1('0x5c')]})[_0x89a1('0x26')](function(_0x4d1d23){_0x292412['count']=_0x4d1d23;if(_0x3c4b53[_0x89a1('0x52')][_0x89a1('0xbf')]){_0x1a4d88[_0x89a1('0x67')]=[{'all':!![]}];}return db['ScreenRecording'][_0x89a1('0xc6')](_0x1a4d88);})['then'](function(_0x2ccfe0){_0x292412[_0x89a1('0x64')]=_0x2ccfe0;return _0x292412;});}})[_0x89a1('0x26')](respondWithFilteredResult(_0x43c761,_0x1a4d88))[_0x89a1('0x30')](handleError(_0x43c761,null));};exports[_0x89a1('0xcf')]=function(_0x3d3227,_0x4cbd0e,_0x4f94f9){var _0x49ad2f={};var _0x27323c={};var _0x4fb931;var _0x81736d;return db[_0x89a1('0x4b')][_0x89a1('0x94')]({'where':{'id':_0x3d3227[_0x89a1('0x6e')]['id']}})[_0x89a1('0x26')](handleEntityNotFound(_0x4cbd0e,null))[_0x89a1('0x26')](function(_0x3def31){if(_0x3def31){_0x4fb931=_0x3def31;_0x27323c[_0x89a1('0x4f')]=_[_0x89a1('0x53')](db[_0x89a1('0xd0')][_0x89a1('0x4c')]);_0x27323c['query']=_[_0x89a1('0x53')](_0x3d3227[_0x89a1('0x52')]);_0x27323c[_0x89a1('0x54')]=_[_0x89a1('0x56')](_0x27323c['model'],_0x27323c['query']);_0x49ad2f['attributes']=_['intersection'](_0x27323c[_0x89a1('0x4f')],qs[_0x89a1('0x57')](_0x3d3227[_0x89a1('0x52')][_0x89a1('0x57')]));_0x49ad2f[_0x89a1('0x55')]=_0x49ad2f[_0x89a1('0x55')][_0x89a1('0x58')]?_0x49ad2f['attributes']:_0x27323c['model'];_0x49ad2f[_0x89a1('0x5a')]=qs[_0x89a1('0x5b')](_0x3d3227['query']['sort']);_0x49ad2f['where']=qs[_0x89a1('0x54')](_[_0x89a1('0x5d')](_0x3d3227[_0x89a1('0x52')],_0x27323c[_0x89a1('0x54')]));if(_0x3d3227[_0x89a1('0x52')][_0x89a1('0x5e')]){_0x49ad2f['where']=_[_0x89a1('0x5f')](_0x49ad2f[_0x89a1('0x5c')],{'$or':_[_0x89a1('0x4a')](_0x49ad2f['attributes'],function(_0x35fd9b){var _0x35412d={};_0x35412d[_0x35fd9b]={'$like':'%'+_0x3d3227[_0x89a1('0x52')][_0x89a1('0x5e')]+'%'};return _0x35412d;})});}_0x49ad2f=_[_0x89a1('0x5f')]({},_0x49ad2f,_0x3d3227[_0x89a1('0x68')]);return _0x4fb931[_0x89a1('0xcf')](_0x49ad2f);}})[_0x89a1('0x26')](function(_0xbc9f2c){if(_0xbc9f2c){_0x81736d=_0xbc9f2c[_0x89a1('0x58')];if(!_0x3d3227['query']['hasOwnProperty'](_0x89a1('0x59'))){_0x49ad2f['limit']=qs[_0x89a1('0x37')](_0x3d3227[_0x89a1('0x52')][_0x89a1('0x37')]);_0x49ad2f[_0x89a1('0x36')]=qs[_0x89a1('0x36')](_0x3d3227[_0x89a1('0x52')][_0x89a1('0x36')]);}return _0x4fb931[_0x89a1('0xcf')](_0x49ad2f);}})[_0x89a1('0x26')](function(_0xcfa531){if(_0xcfa531){return _0xcfa531?{'count':_0x81736d,'rows':_0xcfa531}:null;}})[_0x89a1('0x26')](respondWithResult(_0x4cbd0e,null))[_0x89a1('0x30')](handleError(_0x4cbd0e,null));};exports[_0x89a1('0xd1')]=function(_0xa659c6,_0x5bda60,_0x1909a2){var _0x32eb9f={};var _0x1b1496={};var _0x181f93;var _0x5a25f7;return db['User']['findOne']({'where':{'id':_0xa659c6[_0x89a1('0x6e')]['id']}})[_0x89a1('0x26')](handleEntityNotFound(_0x5bda60,null))[_0x89a1('0x26')](function(_0x6d39f1){if(_0x6d39f1){_0x181f93=_0x6d39f1;_0x1b1496['model']=_[_0x89a1('0x53')](db['OpenchannelInteraction'][_0x89a1('0x4c')]);_0x1b1496[_0x89a1('0x52')]=_[_0x89a1('0x53')](_0xa659c6[_0x89a1('0x52')]);_0x1b1496[_0x89a1('0x54')]=_[_0x89a1('0x56')](_0x1b1496[_0x89a1('0x4f')],_0x1b1496['query']);_0x32eb9f['attributes']=_[_0x89a1('0x56')](_0x1b1496[_0x89a1('0x4f')],qs[_0x89a1('0x57')](_0xa659c6['query'][_0x89a1('0x57')]));_0x32eb9f[_0x89a1('0x55')]=_0x32eb9f[_0x89a1('0x55')][_0x89a1('0x58')]?_0x32eb9f[_0x89a1('0x55')]:_0x1b1496['model'];_0x32eb9f[_0x89a1('0x5a')]=qs[_0x89a1('0x5b')](_0xa659c6[_0x89a1('0x52')]['sort']);_0x32eb9f[_0x89a1('0x5c')]=qs[_0x89a1('0x54')](_['pick'](_0xa659c6[_0x89a1('0x52')],_0x1b1496['filters']));if(_0xa659c6[_0x89a1('0x52')][_0x89a1('0x5e')]){_0x32eb9f['where']=_[_0x89a1('0x5f')](_0x32eb9f[_0x89a1('0x5c')],{'$or':_[_0x89a1('0x4a')](_0x32eb9f[_0x89a1('0x55')],function(_0x25db31){var _0x9f39e8={};_0x9f39e8[_0x25db31]={'$like':'%'+_0xa659c6['query'][_0x89a1('0x5e')]+'%'};return _0x9f39e8;})});}_0x32eb9f=_[_0x89a1('0x5f')]({},_0x32eb9f,_0xa659c6['options']);return _0x181f93[_0x89a1('0xd1')](_0x32eb9f);}})[_0x89a1('0x26')](function(_0x4a7cb9){if(_0x4a7cb9){_0x5a25f7=_0x4a7cb9['length'];if(!_0xa659c6[_0x89a1('0x52')]['hasOwnProperty']('nolimit')){_0x32eb9f[_0x89a1('0x37')]=qs[_0x89a1('0x37')](_0xa659c6[_0x89a1('0x52')][_0x89a1('0x37')]);_0x32eb9f[_0x89a1('0x36')]=qs[_0x89a1('0x36')](_0xa659c6[_0x89a1('0x52')][_0x89a1('0x36')]);}return _0x181f93[_0x89a1('0xd1')](_0x32eb9f);}})[_0x89a1('0x26')](function(_0x281629){if(_0x281629){return _0x281629?{'count':_0x5a25f7,'rows':_0x281629}:null;}})[_0x89a1('0x26')](respondWithResult(_0x5bda60,null))['catch'](handleError(_0x5bda60,null));};exports[_0x89a1('0xd2')]=function(_0x3810da,_0x14e81a,_0x5c84c0){var _0x17300a={'raw':!![],'where':{}};var _0x2f4227={};var _0x31b837={'count':0x0,'rows':[]};return db[_0x89a1('0x4b')][_0x89a1('0x94')]({'where':{'id':_0x3810da['params']['id']}})[_0x89a1('0x26')](handleEntityNotFound(_0x14e81a,null))[_0x89a1('0x26')](function(_0x386644){if(_0x386644){_0x2f4227['model']=_['keys'](db[_0x89a1('0xd3')][_0x89a1('0x4c')]);_0x2f4227[_0x89a1('0x52')]=_[_0x89a1('0x53')](_0x3810da[_0x89a1('0x52')]);_0x2f4227[_0x89a1('0x54')]=_[_0x89a1('0x56')](_0x2f4227[_0x89a1('0x4f')],_0x2f4227[_0x89a1('0x52')]);_0x17300a[_0x89a1('0x55')]=_[_0x89a1('0x56')](_0x2f4227['model'],qs[_0x89a1('0x57')](_0x3810da[_0x89a1('0x52')][_0x89a1('0x57')]));_0x17300a['attributes']=_0x17300a[_0x89a1('0x55')][_0x89a1('0x58')]?_0x17300a[_0x89a1('0x55')]:_0x2f4227['model'];if(!_0x3810da[_0x89a1('0x52')][_0x89a1('0xbe')]('nolimit')){_0x17300a[_0x89a1('0x37')]=qs['limit'](_0x3810da[_0x89a1('0x52')][_0x89a1('0x37')]);_0x17300a['offset']=qs['offset'](_0x3810da['query'][_0x89a1('0x36')]);}_0x17300a['order']=qs[_0x89a1('0x5b')](_0x3810da[_0x89a1('0x52')][_0x89a1('0x5b')]);_0x17300a[_0x89a1('0x5c')]=qs[_0x89a1('0x54')](_[_0x89a1('0x5d')](_0x3810da[_0x89a1('0x52')],_0x2f4227[_0x89a1('0x54')]));_0x17300a['where']['UserId']=_0x386644['id'];if(_0x3810da['query'][_0x89a1('0x5e')]){_0x17300a['where']=_[_0x89a1('0x5f')](_0x17300a[_0x89a1('0x5c')],{'$or':_[_0x89a1('0x4a')](_0x17300a['attributes'],function(_0x3ca0a7){var _0x54c0ae={};_0x54c0ae[_0x3ca0a7]={'$like':'%'+_0x3810da[_0x89a1('0x52')]['filter']+'%'};return _0x54c0ae;})});}_0x17300a=_[_0x89a1('0x5f')]({},_0x17300a,_0x3810da[_0x89a1('0x68')]);return db[_0x89a1('0xd3')][_0x89a1('0x35')]({'where':_0x17300a['where']})['then'](function(_0x19e8a5){_0x31b837[_0x89a1('0x35')]=_0x19e8a5;if(_0x3810da['query'][_0x89a1('0xbf')]){_0x17300a[_0x89a1('0x67')]=[{'all':!![]}];}return db[_0x89a1('0xd3')]['findAll'](_0x17300a);})[_0x89a1('0x26')](function(_0x5adc7f){_0x31b837[_0x89a1('0x64')]=_0x5adc7f;return _0x31b837;});}})[_0x89a1('0x26')](respondWithFilteredResult(_0x14e81a,_0x17300a))[_0x89a1('0x30')](handleError(_0x14e81a,null));};exports[_0x89a1('0xd4')]=function(_0x20886c,_0x5f26d2,_0x45d79d){var _0x1af4dc={};var _0x198c98={};var _0x1ed254;var _0x265817;return db[_0x89a1('0x4b')][_0x89a1('0x94')]({'where':{'id':_0x20886c['params']['id']}})[_0x89a1('0x26')](handleEntityNotFound(_0x5f26d2,null))[_0x89a1('0x26')](function(_0x42f362){if(_0x42f362){_0x1ed254=_0x42f362;_0x198c98[_0x89a1('0x4f')]=_[_0x89a1('0x53')](db[_0x89a1('0xd5')]['rawAttributes']);_0x198c98[_0x89a1('0x52')]=_[_0x89a1('0x53')](_0x20886c[_0x89a1('0x52')]);_0x198c98[_0x89a1('0x54')]=_[_0x89a1('0x56')](_0x198c98[_0x89a1('0x4f')],_0x198c98[_0x89a1('0x52')]);_0x1af4dc[_0x89a1('0x55')]=_['intersection'](_0x198c98['model'],qs['fields'](_0x20886c[_0x89a1('0x52')]['fields']));_0x1af4dc[_0x89a1('0x55')]=_0x1af4dc[_0x89a1('0x55')]['length']?_0x1af4dc[_0x89a1('0x55')]:_0x198c98[_0x89a1('0x4f')];_0x1af4dc[_0x89a1('0x5a')]=qs[_0x89a1('0x5b')](_0x20886c['query']['sort']);_0x1af4dc[_0x89a1('0x5c')]=qs[_0x89a1('0x54')](_[_0x89a1('0x5d')](_0x20886c[_0x89a1('0x52')],_0x198c98[_0x89a1('0x54')]));if(_0x20886c[_0x89a1('0x52')][_0x89a1('0x5e')]){_0x1af4dc['where']=_[_0x89a1('0x5f')](_0x1af4dc[_0x89a1('0x5c')],{'$or':_['map'](_0x1af4dc[_0x89a1('0x55')],function(_0x1e02fb){var _0x4d5b55={};_0x4d5b55[_0x1e02fb]={'$like':'%'+_0x20886c[_0x89a1('0x52')][_0x89a1('0x5e')]+'%'};return _0x4d5b55;})});}_0x1af4dc=_[_0x89a1('0x5f')]({},_0x1af4dc,_0x20886c[_0x89a1('0x68')]);return _0x1ed254['getSmsInteractions'](_0x1af4dc);}})[_0x89a1('0x26')](function(_0x70d945){if(_0x70d945){_0x265817=_0x70d945[_0x89a1('0x58')];if(!_0x20886c[_0x89a1('0x52')][_0x89a1('0xbe')](_0x89a1('0x59'))){_0x1af4dc['limit']=qs['limit'](_0x20886c['query']['limit']);_0x1af4dc[_0x89a1('0x36')]=qs[_0x89a1('0x36')](_0x20886c[_0x89a1('0x52')]['offset']);}return _0x1ed254[_0x89a1('0xd4')](_0x1af4dc);}})[_0x89a1('0x26')](function(_0x2f50ba){if(_0x2f50ba){return _0x2f50ba?{'count':_0x265817,'rows':_0x2f50ba}:null;}})[_0x89a1('0x26')](respondWithResult(_0x5f26d2,null))['catch'](handleError(_0x5f26d2,null));};exports[_0x89a1('0xd6')]=function(_0x48e0d,_0x347497,_0x35f022){var _0x3068a4={};var _0xaa36ed={};var _0x5812bc;var _0x57162e;return db[_0x89a1('0x4b')][_0x89a1('0x94')]({'where':{'id':_0x48e0d['params']['id']}})[_0x89a1('0x26')](handleEntityNotFound(_0x347497,null))[_0x89a1('0x26')](function(_0x4c88de){if(_0x4c88de){_0x5812bc=_0x4c88de;_0xaa36ed[_0x89a1('0x4f')]=_[_0x89a1('0x53')](db[_0x89a1('0xd7')][_0x89a1('0x4c')]);_0xaa36ed[_0x89a1('0x52')]=_['keys'](_0x48e0d['query']);_0xaa36ed[_0x89a1('0x54')]=_['intersection'](_0xaa36ed[_0x89a1('0x4f')],_0xaa36ed['query']);_0x3068a4['attributes']=_[_0x89a1('0x56')](_0xaa36ed[_0x89a1('0x4f')],qs[_0x89a1('0x57')](_0x48e0d[_0x89a1('0x52')][_0x89a1('0x57')]));_0x3068a4[_0x89a1('0x55')]=_0x3068a4[_0x89a1('0x55')][_0x89a1('0x58')]?_0x3068a4[_0x89a1('0x55')]:_0xaa36ed[_0x89a1('0x4f')];_0x3068a4[_0x89a1('0x5a')]=qs[_0x89a1('0x5b')](_0x48e0d['query'][_0x89a1('0x5b')]);_0x3068a4[_0x89a1('0x5c')]=qs[_0x89a1('0x54')](_[_0x89a1('0x5d')](_0x48e0d[_0x89a1('0x52')],_0xaa36ed[_0x89a1('0x54')]));if(_0x48e0d[_0x89a1('0x52')]['filter']){_0x3068a4[_0x89a1('0x5c')]=_[_0x89a1('0x5f')](_0x3068a4[_0x89a1('0x5c')],{'$or':_[_0x89a1('0x4a')](_0x3068a4[_0x89a1('0x55')],function(_0x2c56b1){var _0x1afafb={};_0x1afafb[_0x2c56b1]={'$like':'%'+_0x48e0d[_0x89a1('0x52')]['filter']+'%'};return _0x1afafb;})});}_0x3068a4=_[_0x89a1('0x5f')]({},_0x3068a4,_0x48e0d['options']);return _0x5812bc[_0x89a1('0xd6')](_0x3068a4);}})['then'](function(_0x99e3a0){if(_0x99e3a0){_0x57162e=_0x99e3a0[_0x89a1('0x58')];if(!_0x48e0d['query'][_0x89a1('0xbe')](_0x89a1('0x59'))){_0x3068a4[_0x89a1('0x37')]=qs['limit'](_0x48e0d[_0x89a1('0x52')][_0x89a1('0x37')]);_0x3068a4[_0x89a1('0x36')]=qs[_0x89a1('0x36')](_0x48e0d[_0x89a1('0x52')]['offset']);}return _0x5812bc[_0x89a1('0xd6')](_0x3068a4);}})[_0x89a1('0x26')](function(_0x2e82ea){if(_0x2e82ea){return _0x2e82ea?{'count':_0x57162e,'rows':_0x2e82ea}:null;}})['then'](respondWithResult(_0x347497,null))[_0x89a1('0x30')](handleError(_0x347497,null));};exports['login']=function(_0x13b70b,_0x71b3b6,_0xade3cd){var _0x17bd8e;var _0x2c9a9f;var _0x534faf;var _0x479171=!_[_0x89a1('0x76')](_0x13b70b[_0x89a1('0x6e')]['id'])?_0x13b70b[_0x89a1('0x6e')]['id']:!_['isNil'](_0x13b70b[_0x89a1('0x40')]['id'])?_0x13b70b[_0x89a1('0x40')]['id']:null;return db['User'][_0x89a1('0x69')]({'where':{'id':_0x479171,'role':{'$or':['admin',_0x89a1('0x40'),_0x89a1('0x42')]}},'attributes':['id',_0x89a1('0x48'),_0x89a1('0xd8'),'mobile','role',_0x89a1('0x7b'),_0x89a1('0x9e')]})['then'](function(_0x340a8f){if(_0x340a8f){if(_0x340a8f[_0x89a1('0x47')]===_0x89a1('0x42')){_0x17bd8e=_0x340a8f;if(_0x13b70b[_0x89a1('0x6b')]['interface']){_0x534faf=util[_0x89a1('0x78')](_0x89a1('0xd9'),_0x17bd8e[_0x13b70b[_0x89a1('0x6b')][_0x89a1('0xaa')]]);}else if(_0x13b70b['body']['intrf']){_0x534faf=util['format'](_0x89a1('0xda'),_0x13b70b[_0x89a1('0x6b')]['intrf']);}else{_0x534faf=util[_0x89a1('0x78')](_0x89a1('0xda'),_0x17bd8e[_0x89a1('0x48')]);}socket['to'](util[_0x89a1('0x78')](_0x89a1('0xdb'),_0x17bd8e['name']))['emit'](_0x89a1('0xdc'),{'ip':_0x13b70b[_0x89a1('0xdd')][_0x89a1('0xde')]||_0x13b70b['connection'][_0x89a1('0xdf')]||_0x13b70b[_0x89a1('0xe0')][_0x89a1('0xdf')]||_0x13b70b[_0x89a1('0xe1')][_0x89a1('0xe0')][_0x89a1('0xdf')]});return db[_0x89a1('0xac')][_0x89a1('0x3d')]({'where':{'membername':_0x17bd8e[_0x89a1('0x48')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x89a1('0x23'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x17bd8e){return _0x17bd8e[_0x89a1('0xe2')]({'raw':!![]});}})[_0x89a1('0x26')](function(_0x5c1f49){if(_0x17bd8e){var _0x33e982=[];if(_0x5c1f49){_0x2c9a9f=_0x5c1f49;if(_0x2c9a9f['length']){for(var _0x24ecbd=0x0;_0x24ecbd<_0x2c9a9f[_0x89a1('0x58')];_0x24ecbd++){_0x33e982['push']({'membername':_0x17bd8e['name'],'UserId':_0x17bd8e['id'],'queue_name':_0x2c9a9f[_0x24ecbd]['name'],'VoiceQueueId':_0x2c9a9f[_0x24ecbd]['id'],'interface':_0x534faf,'paused':_0x17bd8e['loginInPause']||![],'penalty':_0x2c9a9f[_0x24ecbd][_0x89a1('0xe3')]||0x0});}return BPromise[_0x89a1('0xab')](_0x33e982,function(_0x53d726){return db[_0x89a1('0xac')][_0x89a1('0xad')](_0x53d726);});}}}})[_0x89a1('0x26')](function(){if(_0x17bd8e){return db['MemberReport'][_0x89a1('0xc6')]({'where':{'membername':_0x17bd8e[_0x89a1('0x48')],'exitAt':null}});}})['then'](function(_0x269fa9){if(_0x17bd8e){var _0x5601d1=[];_0x269fa9[_0x89a1('0xe4')](function(_0x569c35){_0x5601d1['push'](_0x569c35[_0x89a1('0x3c')]({'exitAt':moment()[_0x89a1('0x78')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x89a1('0xe5')](_0x5601d1);}})[_0x89a1('0x26')](function(){if(_0x17bd8e){var _0x175bdd=[];var _0x3aa63b=[];var _0x4a9361=utils[_0x89a1('0xe6')]();var _0x4bd96c={'membername':_0x17bd8e['name'],'interface':_0x534faf,'enterAt':moment()[_0x89a1('0x78')](_0x89a1('0xe7')),'role':_0x17bd8e[_0x89a1('0x47')],'internal':_0x17bd8e[_0x89a1('0x7b')]};_0x4a9361['forEach'](function(_0x5ccd9b){_0x175bdd[_0x89a1('0xe8')](_[_0x89a1('0x5f')]({'channel':_0x5ccd9b,'type':_0x89a1('0xe9'),'data1':_0x13b70b[_0x89a1('0x6b')]['device'],'data2':_0x534faf},_0x4bd96c));if(_0x17bd8e[_0x89a1('0x9e')]){_0x3aa63b['push'](_[_0x89a1('0x5f')]({'channel':_0x5ccd9b,'type':'PAUSE','data1':'LOGININPAUSE'},_0x4bd96c));}});return db[_0x89a1('0xea')][_0x89a1('0x6a')](_0x175bdd[_0x89a1('0xeb')](_0x3aa63b),{'individualHooks':!![]});}})[_0x89a1('0x26')](function(){if(_0x17bd8e){return _0x17bd8e[_0x89a1('0x3c')]({'online':!![],'lastLoginAt':moment()[_0x89a1('0x78')](_0x89a1('0xe7')),'voicePause':_0x17bd8e[_0x89a1('0x9e')]||![],'mailPause':_0x17bd8e[_0x89a1('0x9e')]||![],'chatPause':_0x17bd8e[_0x89a1('0x9e')]||![],'faxPause':_0x17bd8e[_0x89a1('0x9e')]||![],'smsPause':_0x17bd8e['loginInPause']||![],'openchannelPause':_0x17bd8e['loginInPause']||![],'pauseType':_0x17bd8e[_0x89a1('0x9e')]?_0x89a1('0xec'):null,'interface':_0x534faf,'lastPauseAt':moment()[_0x89a1('0x78')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x89a1('0x26')](function(_0x45745b){if(_0x13b70b[_0x89a1('0xed')]){return _0xade3cd();}else{return BPromise[_0x89a1('0xee')](_0x45745b)[_0x89a1('0x26')](respondWithResult(_0x71b3b6,null));}})[_0x89a1('0x30')](handleError(_0x71b3b6,null));};exports[_0x89a1('0xef')]=function(_0x32623c,_0x3d2e25,_0xe6313a){var _0xe89831;return db[_0x89a1('0x4b')][_0x89a1('0x69')]({'where':{'id':_0x32623c['params']['id'],'role':'agent'},'attributes':['id','name',_0x89a1('0x47')]})[_0x89a1('0x26')](handleEntityNotFound(_0x3d2e25,null))['then'](function(_0x1ee157){if(_0x1ee157){_0xe89831=_0x1ee157;return db[_0x89a1('0xac')][_0x89a1('0x3d')]({'where':{'membername':_0xe89831['name']},'individualHooks':!![]});}})[_0x89a1('0x26')](function(){return db[_0x89a1('0xea')][_0x89a1('0xc6')]({'where':{'membername':_0xe89831[_0x89a1('0x48')],'exitAt':null}});})[_0x89a1('0x26')](function(_0x334889){var _0x3841dd=[];_0x334889[_0x89a1('0xe4')](function(_0x335801){_0x3841dd['push'](_0x335801[_0x89a1('0x3c')]({'exitAt':moment()[_0x89a1('0x78')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x89a1('0xe5')](_0x3841dd);})['then'](function(){return _0xe89831['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0x89a1('0x26')](respondWithResult(_0x3d2e25,null))[_0x89a1('0x30')](handleError(_0x3d2e25,null));};exports[_0x89a1('0xf0')]=function(_0x211cdf,_0x35ccaf,_0x5e0ff8){var _0x3219a9;return db[_0x89a1('0xac')]['update']({'paused':0x1},{'where':{'UserId':_0x211cdf[_0x89a1('0x6e')]['id']},'individualHooks':!![]})[_0x89a1('0x26')](function(){return db['User'][_0x89a1('0x69')]({'where':{'id':_0x211cdf[_0x89a1('0x6e')]['id'],'role':_0x89a1('0x42')},'attributes':['id',_0x89a1('0x48'),'role','internal',_0x89a1('0xaa')]});})[_0x89a1('0x26')](handleEntityNotFound(_0x35ccaf,null))[_0x89a1('0x26')](function(_0x5d2e0f){if(_0x5d2e0f){_0x3219a9=_0x5d2e0f;return respondWithRpcPromise('QueuePause',_0x89a1('0xf0'),{'id':_0x3219a9['id'],'name':_0x3219a9[_0x89a1('0x48')],'pause':!![]});}})[_0x89a1('0x26')](function(){if(_0x3219a9){return db['MemberReport']['findAll']({'where':{'membername':_0x3219a9[_0x89a1('0x48')],'type':_0x89a1('0xf1'),'exitAt':null}});}})[_0x89a1('0x26')](function(_0x1e6d32){if(_0x1e6d32[_0x89a1('0x58')]){var _0x328c89=moment()[_0x89a1('0x78')](_0x89a1('0xe7'));for(var _0x459018=0x0,_0x4cdafa=_0x1e6d32[_0x89a1('0x58')];_0x459018<_0x4cdafa;_0x459018++){_0x1e6d32[_0x459018][_0x89a1('0xf2')]({'exitAt':_0x328c89});}}})[_0x89a1('0x26')](function(){var _0x1203e6=[];var _0xb0b915=utils['getChannels']();_0xb0b915[_0x89a1('0xe4')](function(_0x453252){_0x1203e6['push']({'channel':_0x453252,'membername':_0x3219a9['name'],'interface':_[_0x89a1('0x76')](_0x3219a9['interface'])?util['format'](_0x89a1('0xda'),_0x3219a9[_0x89a1('0x48')]):_0x3219a9[_0x89a1('0xaa')],'type':'PAUSE','enterAt':moment()[_0x89a1('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x211cdf[_0x89a1('0x6b')][_0x89a1('0x4d')]||_0x89a1('0xf3'),'role':_0x3219a9[_0x89a1('0x47')],'internal':_0x3219a9[_0x89a1('0x7b')]});});return db['MemberReport']['bulkCreate'](_0x1203e6,{'individualHooks':!![]});})[_0x89a1('0x26')](function(){return _0x3219a9[_0x89a1('0x3c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x211cdf['body'][_0x89a1('0x4d')]||_0x89a1('0xf3'),'lastPauseAt':moment()[_0x89a1('0x78')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x89a1('0x26')](respondWithResult(_0x35ccaf,null))['catch'](handleError(_0x35ccaf,null));};exports[_0x89a1('0xf4')]=function(_0x451bbf,_0xeaee6c,_0x1b9607){var _0x1e655;return db['User'][_0x89a1('0x69')]({'where':{'id':_0x451bbf[_0x89a1('0x6e')]['id']},'attributes':['id',_0x89a1('0x48'),_0x89a1('0x47'),'voicePause',_0x89a1('0xf5'),_0x89a1('0xf6'),'faxPause',_0x89a1('0xf7'),'smsPause','pauseType',_0x89a1('0xf8')]})['then'](handleEntityNotFound(_0xeaee6c,null))[_0x89a1('0x26')](function(_0x25de4d){if(_0x25de4d){_0x1e655=_0x25de4d;if(_0x451bbf['body'][_0x89a1('0xaf')]&&!utils[_0x89a1('0xb0')](_0x451bbf['body'][_0x89a1('0xaf')])){throw new db[(_0x89a1('0x22'))][(_0x89a1('0x23'))](_0x89a1('0x9f'));}switch(_0x451bbf[_0x89a1('0x6b')][_0x89a1('0xaf')]){case _0x89a1('0xa8'):return respondWithRpcPromise('QueuePause',_0x89a1('0xf4'),{'id':_0x1e655['id'],'name':_0x1e655[_0x89a1('0x48')],'pause':![]})[_0x89a1('0x26')](function(){return db[_0x89a1('0xac')][_0x89a1('0x3c')]({'paused':0x0},{'where':{'UserId':_0x1e655['id']},'individualHooks':!![]});})[_0x89a1('0x26')](function(){return db[_0x89a1('0xea')][_0x89a1('0x69')]({'where':{'channel':_0x451bbf[_0x89a1('0x6b')]['channel'],'membername':_0x1e655[_0x89a1('0x48')],'type':_0x89a1('0xf1'),'exitAt':null}});})[_0x89a1('0x26')](function(_0x1b169b){if(_0x1b169b){return _0x1b169b[_0x89a1('0x3c')]({'exitAt':moment()[_0x89a1('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x1e655[_0x89a1('0x3c')]({'voicePause':![]});});case _0x89a1('0xf9'):case _0x89a1('0xfa'):case _0x89a1('0xfb'):case _0x89a1('0xfc'):case _0x89a1('0xfd'):return db['MemberReport'][_0x89a1('0x69')]({'where':{'channel':_0x451bbf[_0x89a1('0x6b')][_0x89a1('0xaf')],'membername':_0x1e655[_0x89a1('0x48')],'type':_0x89a1('0xf1'),'exitAt':null}})[_0x89a1('0x26')](function(_0x547474){if(_0x547474){return _0x547474[_0x89a1('0x3c')]({'exitAt':moment()[_0x89a1('0x78')](_0x89a1('0xe7')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){var _0x313f00={};_[_0x89a1('0x38')](_0x313f00,util[_0x89a1('0x78')](_0x89a1('0xfe'),_0x451bbf['body'][_0x89a1('0xaf')],_0x89a1('0xff')),![]);return _0x1e655[_0x89a1('0x3c')](_0x313f00);});default:return respondWithRpcPromise(_0x89a1('0x100'),_0x89a1('0xf4'),{'id':_0x1e655['id'],'name':_0x1e655[_0x89a1('0x48')],'pause':![]})[_0x89a1('0x26')](function(){return db[_0x89a1('0xac')][_0x89a1('0x3c')]({'paused':0x0},{'where':{'UserId':_0x1e655['id']}});})[_0x89a1('0x26')](function(){return db[_0x89a1('0xea')][_0x89a1('0xc6')]({'where':{'membername':_0x1e655[_0x89a1('0x48')],'type':_0x89a1('0xf1'),'exitAt':null}});})['then'](function(_0x5b5ca0){var _0x29edaa=[];_0x5b5ca0[_0x89a1('0xe4')](function(_0x12e79b){_0x29edaa['push'](_0x12e79b['update']({'exitAt':moment()[_0x89a1('0x78')](_0x89a1('0xe7')),'data2':_0x89a1('0x101')}));});return BPromise[_0x89a1('0xe5')](_0x29edaa);})[_0x89a1('0x26')](function(){return _0x1e655['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x89a1('0x26')](respondWithResult(_0xeaee6c,null))[_0x89a1('0x30')](handleError(_0xeaee6c,null));};exports[_0x89a1('0x102')]=function(_0x15ee3a,_0x3216d5,_0x3770ff){var _0xac643a={};var _0x15a18e={};var _0x29e2f4;var _0x42c700;return db[_0x89a1('0x4b')]['findOne']({'where':{'id':_0x15ee3a[_0x89a1('0x6e')]['id']}})[_0x89a1('0x26')](handleEntityNotFound(_0x3216d5,null))['then'](function(_0x449eeb){if(_0x449eeb){_0x29e2f4=_0x449eeb;_0x15a18e[_0x89a1('0x4f')]=_[_0x89a1('0x53')](db[_0x89a1('0x103')][_0x89a1('0x4c')]);_0x15a18e['query']=_[_0x89a1('0x53')](_0x15ee3a[_0x89a1('0x52')]);_0x15a18e[_0x89a1('0x54')]=_[_0x89a1('0x56')](_0x15a18e[_0x89a1('0x4f')],_0x15a18e[_0x89a1('0x52')]);_0xac643a[_0x89a1('0x55')]=_[_0x89a1('0x56')](_0x15a18e[_0x89a1('0x4f')],qs['fields'](_0x15ee3a[_0x89a1('0x52')][_0x89a1('0x57')]));_0xac643a['attributes']=_0xac643a[_0x89a1('0x55')][_0x89a1('0x58')]?_0xac643a[_0x89a1('0x55')]:_0x15a18e['model'];_0xac643a[_0x89a1('0x5a')]=qs[_0x89a1('0x5b')](_0x15ee3a[_0x89a1('0x52')][_0x89a1('0x5b')]);_0xac643a[_0x89a1('0x5c')]=qs[_0x89a1('0x54')](_[_0x89a1('0x5d')](_0x15ee3a[_0x89a1('0x52')],_0x15a18e[_0x89a1('0x54')]));if(_0x15ee3a[_0x89a1('0x52')]['filter']){_0xac643a[_0x89a1('0x5c')]=_['merge'](_0xac643a['where'],{'$or':_[_0x89a1('0x4a')](_0xac643a[_0x89a1('0x55')],function(_0x44c027){var _0x4223d9={};_0x4223d9[_0x44c027]={'$like':'%'+_0x15ee3a[_0x89a1('0x52')][_0x89a1('0x5e')]+'%'};return _0x4223d9;})});}_0xac643a=_[_0x89a1('0x5f')]({},_0xac643a,_0x15ee3a[_0x89a1('0x68')]);return _0x29e2f4[_0x89a1('0x102')](_0xac643a);}})[_0x89a1('0x26')](function(_0x437e2d){if(_0x437e2d){_0x42c700=_0x437e2d[_0x89a1('0x58')];if(!_0x15ee3a['query'][_0x89a1('0xbe')](_0x89a1('0x59'))){_0xac643a[_0x89a1('0x37')]=qs[_0x89a1('0x37')](_0x15ee3a[_0x89a1('0x52')][_0x89a1('0x37')]);_0xac643a['offset']=qs[_0x89a1('0x36')](_0x15ee3a[_0x89a1('0x52')][_0x89a1('0x36')]);}return _0x29e2f4[_0x89a1('0x102')](_0xac643a);}})[_0x89a1('0x26')](function(_0x456fdc){if(_0x456fdc){return _0x456fdc?{'count':_0x42c700,'rows':_0x456fdc}:null;}})[_0x89a1('0x26')](respondWithResult(_0x3216d5,null))[_0x89a1('0x30')](handleError(_0x3216d5,null));};exports[_0x89a1('0x104')]=function(_0x3f482b,_0x1c11af){return db['User']['find']({'where':{'id':_0x3f482b['params']['id']}})[_0x89a1('0x26')](handleEntityNotFound(_0x1c11af,null))[_0x89a1('0x26')](function(_0x20b277){if(_0x20b277){var _0x34ea1e=_0x20b277[_0x89a1('0x3e')]({'plain':!![]});return _0x20b277['addTeams'](_0x3f482b[_0x89a1('0x6b')][_0x89a1('0x70')],_[_0x89a1('0x6f')](_0x3f482b['body'],['ids','id'])||{})[_0x89a1('0x26')](function(){for(var _0x711ecb=0x0;_0x711ecb<_0x3f482b[_0x89a1('0x6b')][_0x89a1('0x70')][_0x89a1('0x58')];_0x711ecb++){var _0x1cd34e=[];db[_0x89a1('0x103')][_0x89a1('0x94')]({'where':{'id':_0x3f482b['body'][_0x89a1('0x70')][_0x711ecb]}})[_0x89a1('0x26')](function(_0x598adf){_0x1cd34e[_0x89a1('0xe8')](_0x598adf[_0x89a1('0xe2')]()[_0x89a1('0x26')](function(_0x4ec901){for(var _0x4b4677=0x0;_0x4b4677<_0x4ec901['length'];_0x4b4677++){_0x4ec901[_0x4b4677][_0x89a1('0x105')](_0x89a1('0xaf'),_0x89a1('0x106'));}return _0x4ec901;}));_0x1cd34e[_0x89a1('0xe8')](_0x598adf[_0x89a1('0x107')]()[_0x89a1('0x26')](function(_0x3b56de){for(var _0x1d78fe=0x0;_0x1d78fe<_0x3b56de['length'];_0x1d78fe++){_0x3b56de[_0x1d78fe][_0x89a1('0x105')](_0x89a1('0xaf'),_0x89a1('0x108'));}return _0x3b56de;}));_0x1cd34e['push'](_0x598adf[_0x89a1('0x109')]()[_0x89a1('0x26')](function(_0x4079ce){for(var _0x1ba6db=0x0;_0x1ba6db<_0x4079ce[_0x89a1('0x58')];_0x1ba6db++){_0x4079ce[_0x1ba6db]['setDataValue'](_0x89a1('0xaf'),'Mail');}return _0x4079ce;}));_0x1cd34e['push'](_0x598adf[_0x89a1('0x10a')]()[_0x89a1('0x26')](function(_0x30ffe5){for(var _0x15f997=0x0;_0x15f997<_0x30ffe5[_0x89a1('0x58')];_0x15f997++){_0x30ffe5[_0x15f997][_0x89a1('0x105')](_0x89a1('0xaf'),'Sms');}return _0x30ffe5;}));_0x1cd34e[_0x89a1('0xe8')](_0x598adf[_0x89a1('0x10b')]()[_0x89a1('0x26')](function(_0x318bf1){for(var _0x265e51=0x0;_0x265e51<_0x318bf1[_0x89a1('0x58')];_0x265e51++){_0x318bf1[_0x265e51]['setDataValue'](_0x89a1('0xaf'),_0x89a1('0x10c'));}return _0x318bf1;}));_0x1cd34e[_0x89a1('0xe8')](_0x598adf[_0x89a1('0x10d')]()['then'](function(_0x565763){for(var _0x4773b5=0x0;_0x4773b5<_0x565763['length'];_0x4773b5++){_0x565763[_0x4773b5][_0x89a1('0x105')](_0x89a1('0xaf'),_0x89a1('0x10e'));}return _0x565763;}));return BPromise[_0x89a1('0xe5')](_0x1cd34e);})[_0x89a1('0x26')](function(_0x5266a4){var _0x19195e=_[_0x89a1('0x10f')](_0x5266a4);_0x1cd34e=[];return db[_0x89a1('0x61')][_0x89a1('0x110')](function(_0x103026){for(var _0x50a4e7=0x0;_0x50a4e7<_0x19195e['length'];_0x50a4e7++){_0x1cd34e[_0x89a1('0xe8')](_0x19195e[_0x50a4e7][_0x89a1('0x111')](_0x34ea1e['id']),{'transaction':_0x103026});}return BPromise[_0x89a1('0xe5')](_0x1cd34e)[_0x89a1('0x26')](function(){if(_0x34ea1e[_0x89a1('0x9d')]){return BPromise[_0x89a1('0xab')](_[_0x89a1('0x5e')](_0x19195e,function(_0x14a99a){return _0x14a99a[_0x89a1('0x112')]('channel')===_0x89a1('0x106');}),function(_0x311d72){return db[_0x89a1('0xac')][_0x89a1('0xad')]({'membername':_0x34ea1e['name'],'UserId':_0x34ea1e['id'],'queue_name':_0x311d72[_0x89a1('0x48')],'VoiceQueueId':_0x311d72['id'],'interface':_['isNil'](_0x34ea1e[_0x89a1('0xaa')])?util[_0x89a1('0x78')](_0x89a1('0xda'),_0x34ea1e['name']):_0x34ea1e['interface'],'paused':_0x34ea1e[_0x89a1('0x113')]||![],'penalty':_0x34ea1e[_0x89a1('0xa4')]},{'transaction':_0x103026});});}else{return;}})[_0x89a1('0x26')](function(){for(var _0x585e0a=0x0;_0x585e0a<_0x19195e[_0x89a1('0x58')];_0x585e0a++){var _0x33ba08=_0x19195e[_0x585e0a][_0x89a1('0x112')]('channel');var _0x2d596a=_0x33ba08+_0x89a1('0xa6');socket[_0x89a1('0xa7')](_0x89a1('0x40')+_0x33ba08+_0x89a1('0x114'),{'UserId':_0x34ea1e['id'],['queueField']:_0x19195e[_0x585e0a]['id']});}});});});}});}})[_0x89a1('0x26')](respondWithStatusCode(_0x1c11af,null))[_0x89a1('0x30')](handleError(_0x1c11af,null));};exports[_0x89a1('0x115')]=function(_0x279f20,_0x28656b){return db[_0x89a1('0x4b')][_0x89a1('0x94')]({'where':{'id':_0x279f20[_0x89a1('0x6e')]['id']}})[_0x89a1('0x26')](handleEntityNotFound(_0x28656b,null))['then'](function(_0x3a1d1b){if(_0x3a1d1b){var _0x208b55=_0x3a1d1b[_0x89a1('0x3e')]({'plain':!![]});var _0x3fd0b5=_0x279f20['query']['ids'];return _0x3a1d1b[_0x89a1('0x115')](_0x3fd0b5)[_0x89a1('0x26')](function(){for(var _0x49f7b=0x0;_0x49f7b<_0x3fd0b5[_0x89a1('0x58')];_0x49f7b++){var _0x5a056f=[];db[_0x89a1('0x103')][_0x89a1('0x94')]({'where':{'id':_0x3fd0b5[_0x49f7b]}})[_0x89a1('0x26')](function(_0x2620d1){_0x5a056f[_0x89a1('0xe8')](_0x2620d1[_0x89a1('0xe2')]()[_0x89a1('0x26')](function(_0x483df6){for(var _0x186a45=0x0;_0x186a45<_0x483df6[_0x89a1('0x58')];_0x186a45++){_0x483df6[_0x186a45][_0x89a1('0x105')]('channel',_0x89a1('0x106'));}return _0x483df6;}));_0x5a056f[_0x89a1('0xe8')](_0x2620d1[_0x89a1('0x107')]()[_0x89a1('0x26')](function(_0x43a2f7){for(var _0xfd90b=0x0;_0xfd90b<_0x43a2f7['length'];_0xfd90b++){_0x43a2f7[_0xfd90b][_0x89a1('0x105')](_0x89a1('0xaf'),_0x89a1('0x108'));}return _0x43a2f7;}));_0x5a056f[_0x89a1('0xe8')](_0x2620d1[_0x89a1('0x109')]()['then'](function(_0x210e20){for(var _0x46c909=0x0;_0x46c909<_0x210e20[_0x89a1('0x58')];_0x46c909++){_0x210e20[_0x46c909][_0x89a1('0x105')](_0x89a1('0xaf'),_0x89a1('0x116'));}return _0x210e20;}));_0x5a056f[_0x89a1('0xe8')](_0x2620d1[_0x89a1('0x10a')]()['then'](function(_0x350dea){for(var _0x505245=0x0;_0x505245<_0x350dea[_0x89a1('0x58')];_0x505245++){_0x350dea[_0x505245][_0x89a1('0x105')]('channel',_0x89a1('0x117'));}return _0x350dea;}));_0x5a056f[_0x89a1('0xe8')](_0x2620d1[_0x89a1('0x10b')]()[_0x89a1('0x26')](function(_0x1a2c75){for(var _0x32f6e7=0x0;_0x32f6e7<_0x1a2c75[_0x89a1('0x58')];_0x32f6e7++){_0x1a2c75[_0x32f6e7]['setDataValue'](_0x89a1('0xaf'),'Fax');}return _0x1a2c75;}));_0x5a056f['push'](_0x2620d1[_0x89a1('0x10d')]()['then'](function(_0x1602d8){for(var _0x217081=0x0;_0x217081<_0x1602d8[_0x89a1('0x58')];_0x217081++){_0x1602d8[_0x217081][_0x89a1('0x105')]('channel',_0x89a1('0x10e'));}return _0x1602d8;}));return BPromise[_0x89a1('0xe5')](_0x5a056f);})[_0x89a1('0x26')](function(_0x1bd87a){var _0x5566de=_[_0x89a1('0x10f')](_0x1bd87a);_0x5a056f=[];return db[_0x89a1('0x61')][_0x89a1('0x110')](function(_0x41d846){for(var _0x4f54a2=0x0;_0x4f54a2<_0x5566de[_0x89a1('0x58')];_0x4f54a2++){_0x5a056f[_0x89a1('0xe8')](_0x5566de[_0x4f54a2][_0x89a1('0x118')](_0x208b55['id']),{'transaction':_0x41d846});}return BPromise[_0x89a1('0xe5')](_0x5a056f)['then'](function(){if(_0x208b55[_0x89a1('0x9d')]){return BPromise[_0x89a1('0xab')](_[_0x89a1('0x5e')](_0x5566de,function(_0x56c6dd){return _0x56c6dd['getDataValue'](_0x89a1('0xaf'))===_0x89a1('0x106');}),function(_0x1b36d7){return db[_0x89a1('0xac')][_0x89a1('0x3d')]({'where':{'VoiceQueueId':_0x1b36d7['id'],'UserId':_0x208b55['id']},'transaction':_0x41d846});});}else{return;}})[_0x89a1('0x26')](function(){for(var _0x384f71=0x0;_0x384f71<_0x5566de[_0x89a1('0x58')];_0x384f71++){var _0x349a5e=_0x5566de[_0x384f71][_0x89a1('0x112')]('channel');var _0x50e836=_0x349a5e+'QueueId';socket[_0x89a1('0xa7')](_0x89a1('0x40')+_0x349a5e+_0x89a1('0xb2'),{'UserId':_0x208b55['id'],['queueField']:_0x5566de[_0x384f71]['id']});}});});});}});}})[_0x89a1('0x26')](respondWithStatusCode(_0x28656b,null))['catch'](handleError(_0x28656b,null));};exports[_0x89a1('0x119')]=function(_0x2591b6,_0x1b5608,_0x218552){var _0x1120ca={};var _0x43ce5c={};var _0x3bda79;var _0x57a504;return db['User']['findOne']({'where':{'id':_0x2591b6[_0x89a1('0x6e')]['id']}})['then'](handleEntityNotFound(_0x1b5608,null))['then'](function(_0x5ee48e){if(_0x5ee48e){_0x3bda79=_0x5ee48e;_0x43ce5c[_0x89a1('0x4f')]=_['keys'](db[_0x89a1('0xc0')]['rawAttributes']);_0x43ce5c[_0x89a1('0x52')]=_[_0x89a1('0x53')](_0x2591b6['query']);_0x43ce5c['filters']=_['intersection'](_0x43ce5c[_0x89a1('0x4f')],_0x43ce5c[_0x89a1('0x52')]);_0x1120ca[_0x89a1('0x55')]=_[_0x89a1('0x56')](_0x43ce5c[_0x89a1('0x4f')],qs['fields'](_0x2591b6[_0x89a1('0x52')][_0x89a1('0x57')]));_0x1120ca[_0x89a1('0x55')]=_0x1120ca[_0x89a1('0x55')][_0x89a1('0x58')]?_0x1120ca[_0x89a1('0x55')]:_0x43ce5c['model'];_0x1120ca['order']=qs[_0x89a1('0x5b')](_0x2591b6['query'][_0x89a1('0x5b')]);_0x1120ca['where']=qs[_0x89a1('0x54')](_[_0x89a1('0x5d')](_0x2591b6[_0x89a1('0x52')],_0x43ce5c[_0x89a1('0x54')]));if(_0x2591b6[_0x89a1('0x52')][_0x89a1('0x5e')]){_0x1120ca[_0x89a1('0x5c')]=_[_0x89a1('0x5f')](_0x1120ca[_0x89a1('0x5c')],{'$or':_[_0x89a1('0x4a')](_0x1120ca[_0x89a1('0x55')],function(_0xa1658d){var _0x14dcdf={};_0x14dcdf[_0xa1658d]={'$like':'%'+_0x2591b6['query'][_0x89a1('0x5e')]+'%'};return _0x14dcdf;})});}_0x1120ca=_['merge']({},_0x1120ca,_0x2591b6[_0x89a1('0x68')]);return _0x3bda79['getLists'](_0x1120ca);}})[_0x89a1('0x26')](function(_0x45b759){if(_0x45b759){_0x57a504=_0x45b759[_0x89a1('0x58')];if(!_0x2591b6[_0x89a1('0x52')][_0x89a1('0xbe')](_0x89a1('0x59'))){_0x1120ca['limit']=qs[_0x89a1('0x37')](_0x2591b6[_0x89a1('0x52')][_0x89a1('0x37')]);_0x1120ca[_0x89a1('0x36')]=qs[_0x89a1('0x36')](_0x2591b6[_0x89a1('0x52')][_0x89a1('0x36')]);}return _0x3bda79[_0x89a1('0x119')](_0x1120ca);}})[_0x89a1('0x26')](function(_0x32134f){if(_0x32134f){return _0x32134f?{'count':_0x57a504,'rows':_0x32134f}:null;}})[_0x89a1('0x26')](respondWithResult(_0x1b5608,null))[_0x89a1('0x30')](handleError(_0x1b5608,null));};exports[_0x89a1('0x11a')]=function(_0x3f1b89,_0x366ae0,_0x5d3e2c){var _0x3f2839={};var _0x597967={};var _0x234ddc;var _0x1278ee;return db[_0x89a1('0x4b')]['findOne']({'where':{'id':_0x3f1b89['params']['id']}})[_0x89a1('0x26')](handleEntityNotFound(_0x366ae0,null))[_0x89a1('0x26')](function(_0x2ae30c){if(_0x2ae30c){_0x234ddc=_0x2ae30c;_0x597967[_0x89a1('0x4f')]=_[_0x89a1('0x53')](db['User']['rawAttributes']);_0x597967['query']=_['keys'](_0x3f1b89[_0x89a1('0x52')]);_0x597967[_0x89a1('0x54')]=_[_0x89a1('0x56')](_0x597967[_0x89a1('0x4f')],_0x597967['query']);_0x3f2839[_0x89a1('0x55')]=_[_0x89a1('0x56')](_0x597967['model'],qs[_0x89a1('0x57')](_0x3f1b89[_0x89a1('0x52')][_0x89a1('0x57')]));_0x3f2839['attributes']=_0x3f2839[_0x89a1('0x55')][_0x89a1('0x58')]?_0x3f2839[_0x89a1('0x55')]:_0x597967[_0x89a1('0x4f')];_0x3f2839[_0x89a1('0x5a')]=qs[_0x89a1('0x5b')](_0x3f1b89[_0x89a1('0x52')]['sort']);_0x3f2839[_0x89a1('0x5c')]=qs[_0x89a1('0x54')](_['pick'](_0x3f1b89['query'],_0x597967[_0x89a1('0x54')]));if(_0x3f1b89[_0x89a1('0x52')][_0x89a1('0x5e')]){_0x3f2839['where']=_[_0x89a1('0x5f')](_0x3f2839[_0x89a1('0x5c')],{'$or':_[_0x89a1('0x4a')](_0x3f2839[_0x89a1('0x55')],function(_0xb70248){var _0x43119f={};_0x43119f[_0xb70248]={'$like':'%'+_0x3f1b89[_0x89a1('0x52')][_0x89a1('0x5e')]+'%'};return _0x43119f;})});}_0x3f2839[_0x89a1('0x4f')]=db[_0x89a1('0x4b')];_0x3f2839['as']=_0x89a1('0x41');_0x3f2839=_[_0x89a1('0x5f')]({},_0x3f2839,_0x3f1b89[_0x89a1('0x68')]);return _0x234ddc['getVoiceQueues']({'include':[_0x3f2839]});}})[_0x89a1('0x26')](function(_0x17614c){if(_0x17614c){var _0x1960e3={},_0x20a72e=[],_0x98b244=0x0;for(var _0x55a074=0x0;_0x55a074<_0x17614c[_0x89a1('0x58')];_0x55a074+=0x1){for(var _0x5bbcd7=0x0,_0x12a15d;_0x5bbcd7<_0x17614c[_0x55a074][_0x89a1('0x41')][_0x89a1('0x58')];_0x5bbcd7+=0x1){_0x12a15d=_0x17614c[_0x55a074][_0x89a1('0x41')][_0x5bbcd7][_0x89a1('0x3e')]({'plain':!![]});_0x1960e3[_0x12a15d['id']]=_0x12a15d;}}_0x1960e3=_[_0x89a1('0x11b')](_0x1960e3);for(var _0x5c9ad2=qs[_0x89a1('0x36')](_0x3f1b89[_0x89a1('0x52')][_0x89a1('0x36')]);_0x5c9ad2<_0x1960e3[_0x89a1('0x58')]&&_0x20a72e[_0x89a1('0x58')]=_0x58c602[_0xec02('0x4f')]){throw new Error(_0xec02('0x50'));}})['then'](function(){if(_0x5157db){return db[_0xec02('0x29')][_0xec02('0x47')]({'where':{'membername':_0x5157db[_0xec02('0x2b')]},'individualHooks':!![]});}})[_0xec02('0xe')](function(){if(_0x5157db){return _0x5157db[_0xec02('0x51')]({'raw':!![]});}})[_0xec02('0xe')](function(_0x5ef6ff){if(_0x5157db){if(_0x5ef6ff){var _0x143538=[];_0x317b59=_0x5ef6ff;if(_0x317b59[_0xec02('0x48')]){for(var _0x43a9aa=0x0;_0x43a9aa<_0x317b59['length'];_0x43a9aa++){_0x143538[_0xec02('0x44')](db[_0xec02('0x29')][_0xec02('0x52')]({'membername':_0x5157db['name'],'UserId':_0x5157db['id'],'queue_name':_0x317b59[_0x43a9aa][_0xec02('0x2b')],'VoiceQueueId':_0x317b59[_0x43a9aa]['id'],'interface':_0x3ac483,'paused':_0x5157db[_0xec02('0x4b')]||![],'penalty':_0x317b59[_0x43a9aa][_0xec02('0x53')]||0x0}));}return BPromise[_0xec02('0x45')](_0x143538);}}}})[_0xec02('0xe')](function(){if(_0x5157db){return db[_0xec02('0x35')][_0xec02('0x18')]({'where':{'membername':_0x5157db[_0xec02('0x2b')],'exitAt':null}});}})[_0xec02('0xe')](function(_0x292f46){if(_0x5157db){if(_0x292f46&&_0x292f46[_0xec02('0x48')]){var _0x59cc35=[];_0x292f46[_0xec02('0x30')](function(_0x5681b6){_0x59cc35['push'](_0x5681b6[_0xec02('0x2a')]({'exitAt':moment()[_0xec02('0x2d')](_0xec02('0x2e'))}));});return BPromise[_0xec02('0x45')](_0x59cc35);}}})[_0xec02('0xe')](function(_0x4861eb){if(_0x5157db){var _0x7bb07e=[];var _0x1720d4=[];var _0x2353f7=utils['getChannels']();var _0x5914b9={'membername':_0x5157db[_0xec02('0x2b')],'interface':_0x3ac483,'enterAt':moment()['format'](_0xec02('0x2e')),'role':_0x5157db['role'],'internal':_0x5157db[_0xec02('0x27')]};_0x2353f7[_0xec02('0x30')](function(_0x13904d){_0x7bb07e[_0xec02('0x44')](_[_0xec02('0x54')]({'channel':_0x13904d,'type':_0xec02('0x55'),'data1':_0xec02('0x56'),'data2':_0x3ac483},_0x5914b9));if(_0x5157db[_0xec02('0x4b')]){_0x1720d4[_0xec02('0x44')](_[_0xec02('0x54')]({'channel':_0x13904d,'type':_0xec02('0x2c'),'data1':_0xec02('0x57')},_0x5914b9));}});return db['MemberReport'][_0xec02('0x36')](_0x7bb07e[_0xec02('0x58')](_0x1720d4),{'individualHooks':!![]});}})[_0xec02('0xe')](function(){if(_0x5157db){return _0x5157db[_0xec02('0x2a')]({'online':!![],'lastLoginAt':moment()[_0xec02('0x2d')](_0xec02('0x2e')),'voicePause':_0x5157db['loginInPause']||![],'mailPause':_0x5157db[_0xec02('0x4b')]||![],'chatPause':_0x5157db[_0xec02('0x4b')]||![],'faxPause':_0x5157db[_0xec02('0x4b')]||![],'smsPause':_0x5157db[_0xec02('0x4b')]||![],'openchannelPause':_0x5157db[_0xec02('0x4b')]||![],'pauseType':_0x5157db[_0xec02('0x4b')]?_0xec02('0x57'):null,'lastPauseAt':moment()[_0xec02('0x2d')](_0xec02('0x2e')),'interface':_0x3ac483});}})[_0xec02('0xe')](function(_0x5cbeb3){_0x2a5b39(_0x5cbeb3);})['catch'](function(_0x55a97b){_0x2cc49d(_0x434e65[_0xec02('0x15')](0x1f4,_0x55a97b['message']));});});}; \ No newline at end of file +var _0x74f9=['agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','merge','LOGIN','LOGININPAUSE','concat','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetUser','findAll','options','where','attributes','limit','include','model','debug','ShowUser','User','find','raw','map','PauseUser','internal','UserVoiceQueueRt','update','MemberReport','PAUSE','length','updateAttributes','getChannels','forEach','push','name','interface','format','YYYY-MM-DD\x20HH:mm:ss','body','DEFAULT\x20PAUSE','role','uniqueid','bulkCreate','type','findOne','channel','isValidChannel','voice','mail','chat','sms','openchannel','%s%s','Pause','all','LogoutUser','destroy','LoginUser','phone','count','agent','../../config/license/util'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x74f9,0xba));var _0x974f=function(_0x259c7e,_0x96223a){_0x259c7e=_0x259c7e-0x0;var _0x15d791=_0x74f9[_0x259c7e];return _0x15d791;};'use strict';var _=require(_0x974f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x974f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x974f('0x2'))['db'];var utils=require(_0x974f('0x3'));var logger=require('../../config/logger')(_0x974f('0x4'));var config=require(_0x974f('0x5'));var jayson=require(_0x974f('0x6'));var client=jayson[_0x974f('0x7')][_0x974f('0x8')]({'port':0x232a});config[_0x974f('0x9')]=_[_0x974f('0xa')](config[_0x974f('0x9')],{'host':_0x974f('0xb'),'port':0x18eb});var socket=require(_0x974f('0xc'))(new Redis(config[_0x974f('0x9')]));require(_0x974f('0xd'))[_0x974f('0xe')](socket);function respondWithRpcPromise(_0x3951c4,_0x492d19,_0x400afd){return new BPromise(function(_0x4c630c,_0x35e544){return client['request'](_0x3951c4,_0x400afd)[_0x974f('0xf')](function(_0x350d16){logger[_0x974f('0x10')](_0x974f('0x11'),_0x492d19,_0x974f('0x12'));logger['debug'](_0x974f('0x13'),_0x492d19,_0x974f('0x12'),JSON[_0x974f('0x14')](_0x350d16));if(_0x350d16['error']){if(_0x350d16[_0x974f('0x15')][_0x974f('0x16')]===0x1f4){logger[_0x974f('0x15')](_0x974f('0x11'),_0x492d19,_0x350d16[_0x974f('0x15')]['message']);return _0x35e544(_0x350d16['error'][_0x974f('0x17')]);}logger[_0x974f('0x15')](_0x974f('0x11'),_0x492d19,_0x350d16['error']['message']);return _0x4c630c(_0x350d16['error'][_0x974f('0x17')]);}else{logger['info'](_0x974f('0x11'),_0x492d19,'request\x20sent');_0x4c630c(_0x350d16['result']['message']);}})[_0x974f('0x18')](function(_0x46e5be){logger[_0x974f('0x15')](_0x974f('0x11'),_0x492d19,_0x46e5be);_0x35e544(_0x46e5be);});});}exports[_0x974f('0x19')]=function(_0x4ba6b8){var _0x3e107b=this;return new Promise(function(_0x7b7fa6,_0xd892d9){return db['User'][_0x974f('0x1a')]({'raw':_0x4ba6b8['options']?_0x4ba6b8[_0x974f('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4ba6b8[_0x974f('0x1b')]?_0x4ba6b8[_0x974f('0x1b')][_0x974f('0x1c')]||null:null,'attributes':_0x4ba6b8[_0x974f('0x1b')]?_0x4ba6b8['options'][_0x974f('0x1d')]||null:null,'limit':_0x4ba6b8[_0x974f('0x1b')]?_0x4ba6b8[_0x974f('0x1b')][_0x974f('0x1e')]||null:null,'include':_0x4ba6b8['options']?_0x4ba6b8['options'][_0x974f('0x1f')]?_['map'](_0x4ba6b8[_0x974f('0x1b')][_0x974f('0x1f')],function(_0x171f41){return{'model':db[_0x171f41[_0x974f('0x20')]],'as':_0x171f41['as'],'attributes':_0x171f41[_0x974f('0x1d')],'include':_0x171f41[_0x974f('0x1f')]?_['map'](_0x171f41[_0x974f('0x1f')],function(_0x7290bf){return{'model':db[_0x7290bf[_0x974f('0x20')]],'as':_0x7290bf['as'],'attributes':_0x7290bf[_0x974f('0x1d')],'include':_0x7290bf[_0x974f('0x1f')]?_['map'](_0x7290bf[_0x974f('0x1f')],function(_0x2afab5){return{'model':db[_0x2afab5[_0x974f('0x20')]],'as':_0x2afab5['as'],'attributes':_0x2afab5[_0x974f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x974f('0xf')](function(_0x53824e){logger[_0x974f('0x10')](_0x974f('0x19'),_0x4ba6b8);logger[_0x974f('0x21')](_0x974f('0x19'),_0x4ba6b8,JSON[_0x974f('0x14')](_0x53824e));_0x7b7fa6(_0x53824e);})[_0x974f('0x18')](function(_0x2340d3){logger[_0x974f('0x15')](_0x974f('0x19'),_0x2340d3[_0x974f('0x17')],_0x4ba6b8);_0xd892d9(_0x3e107b[_0x974f('0x15')](0x1f4,_0x2340d3['message']));});});};exports[_0x974f('0x22')]=function(_0x5b919a){var _0x2d0199=this;return new Promise(function(_0x39ee83,_0x5ae803){return db[_0x974f('0x23')][_0x974f('0x24')]({'raw':_0x5b919a[_0x974f('0x1b')]?_0x5b919a[_0x974f('0x1b')][_0x974f('0x25')]===undefined?!![]:![]:!![],'where':_0x5b919a[_0x974f('0x1b')]?_0x5b919a[_0x974f('0x1b')]['where']||null:null,'attributes':_0x5b919a['options']?_0x5b919a[_0x974f('0x1b')][_0x974f('0x1d')]||null:null,'include':_0x5b919a['options']?_0x5b919a[_0x974f('0x1b')]['include']?_[_0x974f('0x26')](_0x5b919a[_0x974f('0x1b')][_0x974f('0x1f')],function(_0x58b406){return{'model':db[_0x58b406[_0x974f('0x20')]],'as':_0x58b406['as'],'attributes':_0x58b406['attributes'],'include':_0x58b406[_0x974f('0x1f')]?_[_0x974f('0x26')](_0x58b406[_0x974f('0x1f')],function(_0x543eda){return{'model':db[_0x543eda[_0x974f('0x20')]],'as':_0x543eda['as'],'attributes':_0x543eda[_0x974f('0x1d')],'include':_0x543eda[_0x974f('0x1f')]?_[_0x974f('0x26')](_0x543eda[_0x974f('0x1f')],function(_0x22e4d8){return{'model':db[_0x22e4d8[_0x974f('0x20')]],'as':_0x22e4d8['as'],'attributes':_0x22e4d8[_0x974f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x974f('0xf')](function(_0x5e141e){logger[_0x974f('0x10')]('ShowUser',_0x5b919a);logger[_0x974f('0x21')]('ShowUser',_0x5b919a,JSON[_0x974f('0x14')](_0x5e141e));_0x39ee83(_0x5e141e);})['catch'](function(_0x2d739f){logger[_0x974f('0x15')]('ShowUser',_0x2d739f['message'],_0x5b919a);_0x5ae803(_0x2d0199[_0x974f('0x15')](0x1f4,_0x2d739f[_0x974f('0x17')]));});});};exports[_0x974f('0x27')]=function(_0x1018b6){var _0x198972=this;return new Promise(function(_0x194767,_0x7ef108){var _0x1e2b96;return db['User']['find']({'where':_0x1018b6['options'][_0x974f('0x1c')]||{},'attributes':['id','name','role',_0x974f('0x28'),'interface']})['then'](function(_0x70fe75){if(_0x70fe75){_0x1e2b96=_0x70fe75;return db[_0x974f('0x29')][_0x974f('0x2a')]({'paused':0x1},{'where':{'UserId':_0x1e2b96['id']},'individualHooks':!![]});}})[_0x974f('0xf')](function(){if(_0x1e2b96){return db[_0x974f('0x2b')][_0x974f('0x1a')]({'where':{'membername':_0x1e2b96['name'],'type':_0x974f('0x2c'),'exitAt':null}});}})['then'](function(_0x44a4a0){if(_0x1e2b96){if(_0x44a4a0&&_0x44a4a0[_0x974f('0x2d')]){var _0x597238=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0xcfd3c9=0x0,_0x2adcd0=_0x44a4a0['length'];_0xcfd3c9<_0x2adcd0;_0xcfd3c9++){_0x44a4a0[_0xcfd3c9][_0x974f('0x2e')]({'exitAt':_0x597238});}}}})['then'](function(){if(_0x1e2b96){var _0x53e13a=[];var _0x2a5f1f=utils[_0x974f('0x2f')]();_0x2a5f1f[_0x974f('0x30')](function(_0x35f7d1){_0x53e13a[_0x974f('0x31')]({'channel':_0x35f7d1,'membername':_0x1e2b96[_0x974f('0x32')],'interface':_['isNil'](_0x1e2b96[_0x974f('0x33')])?util[_0x974f('0x34')]('SIP/%s',_0x1e2b96[_0x974f('0x32')]):_0x1e2b96[_0x974f('0x33')],'type':'PAUSE','enterAt':moment()[_0x974f('0x34')](_0x974f('0x35')),'data1':_0x1018b6[_0x974f('0x36')]['type']||_0x974f('0x37'),'role':_0x1e2b96[_0x974f('0x38')],'internal':_0x1e2b96[_0x974f('0x28')],'uniqueid':_0x1018b6[_0x974f('0x36')][_0x974f('0x39')]||null});});return db[_0x974f('0x2b')][_0x974f('0x3a')](_0x53e13a,{'individualHooks':!![]});}})[_0x974f('0xf')](function(){if(_0x1e2b96){return _0x1e2b96[_0x974f('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x1018b6['body'][_0x974f('0x3b')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x974f('0x34')](_0x974f('0x35'))});}})[_0x974f('0xf')](function(_0x12255b){_0x194767(_0x12255b);})[_0x974f('0x18')](function(_0x210cd2){_0x7ef108(_0x198972[_0x974f('0x15')](0x1f4,_0x210cd2[_0x974f('0x17')]));});});};exports['UnpauseUser']=function(_0x147a83){var _0x3444aa=this;return new Promise(function(_0x452c9a,_0x100bd7){var _0x5b1f6c;return db['User'][_0x974f('0x3c')]({'where':_0x147a83[_0x974f('0x1b')]['where']||{},'attributes':['id','name']})[_0x974f('0xf')](function(_0x2b5979){if(_0x2b5979){_0x5b1f6c=_0x2b5979;if(_0x147a83['body'][_0x974f('0x3d')]&&!utils[_0x974f('0x3e')](_0x147a83[_0x974f('0x36')][_0x974f('0x3d')])){throw new Error('Unknown\x20channel');}switch(_0x147a83[_0x974f('0x36')][_0x974f('0x3d')]){case _0x974f('0x3f'):return db['UserVoiceQueueRt'][_0x974f('0x2a')]({'paused':0x0},{'where':{'UserId':_0x5b1f6c['id']}})[_0x974f('0xf')](function(){return db['MemberReport'][_0x974f('0x24')]({'where':{'channel':_0x147a83[_0x974f('0x36')]['channel'],'membername':_0x5b1f6c['name'],'type':_0x974f('0x2c'),'exitAt':null}});})[_0x974f('0xf')](function(_0x4f0d37){if(_0x4f0d37){return _0x4f0d37[_0x974f('0x2a')]({'exitAt':moment()[_0x974f('0x34')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x974f('0xf')](function(){return _0x5b1f6c[_0x974f('0x2a')]({'voicePause':![]});});case _0x974f('0x40'):case _0x974f('0x41'):case'fax':case _0x974f('0x42'):case _0x974f('0x43'):return db['MemberReport'][_0x974f('0x24')]({'where':{'channel':_0x147a83[_0x974f('0x36')][_0x974f('0x3d')],'membername':_0x5b1f6c[_0x974f('0x32')],'type':'PAUSE','exitAt':null}})[_0x974f('0xf')](function(_0x1af0ae){return _0x1af0ae[_0x974f('0x2a')]({'exitAt':moment()[_0x974f('0x34')](_0x974f('0x35')),'data2':'system'},{'individualHooks':!![]});})[_0x974f('0xf')](function(){var _0x1142a4={};_['set'](_0x1142a4,util[_0x974f('0x34')](_0x974f('0x44'),_0x147a83[_0x974f('0x36')][_0x974f('0x3d')],_0x974f('0x45')),![]);return _0x5b1f6c[_0x974f('0x2a')](_0x1142a4);});default:return db[_0x974f('0x29')][_0x974f('0x2a')]({'paused':0x0},{'where':{'UserId':_0x5b1f6c['id']}})[_0x974f('0xf')](function(){return db[_0x974f('0x2b')][_0x974f('0x1a')]({'where':{'membername':_0x5b1f6c[_0x974f('0x32')],'type':_0x974f('0x2c'),'exitAt':null}});})['then'](function(_0x8b09fa){var _0x5ccd15=[];_0x8b09fa['forEach'](function(_0xee7620){_0x5ccd15['push'](_0xee7620[_0x974f('0x2a')]({'exitAt':moment()[_0x974f('0x34')](_0x974f('0x35')),'data2':'system'}));});return BPromise[_0x974f('0x46')](_0x5ccd15);})[_0x974f('0xf')](function(){return _0x5b1f6c[_0x974f('0x2a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x974f('0xf')](function(_0x307d54){_0x452c9a(_0x307d54);})[_0x974f('0x18')](function(_0x4c3d5e){_0x100bd7(_0x3444aa[_0x974f('0x15')](0x1f4,_0x4c3d5e['message']));});});};exports[_0x974f('0x47')]=function(_0x2ba90b){var _0x27f831=this;return new Promise(function(_0x42f70d,_0x1b59b3){var _0x4e12f8;return db[_0x974f('0x23')]['findOne']({'where':_0x2ba90b[_0x974f('0x1b')][_0x974f('0x1c')]||{},'attributes':['id',_0x974f('0x32')]})[_0x974f('0xf')](function(_0x4d12c8){if(_0x4d12c8){_0x4e12f8=_0x4d12c8;return db['UserVoiceQueueRt'][_0x974f('0x48')]({'where':{'membername':_0x4e12f8[_0x974f('0x32')]},'individualHooks':!![]});}})[_0x974f('0xf')](function(){if(_0x4e12f8){return db['MemberReport'][_0x974f('0x1a')]({'where':{'membername':_0x4e12f8[_0x974f('0x32')],'exitAt':null}});}})[_0x974f('0xf')](function(_0x41e5d5){if(_0x4e12f8){if(_0x41e5d5&&_0x41e5d5[_0x974f('0x2d')]){var _0x56ab34=[];_0x41e5d5[_0x974f('0x30')](function(_0x3ae948){_0x56ab34['push'](_0x3ae948[_0x974f('0x2a')]({'exitAt':moment()[_0x974f('0x34')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x974f('0x46')](_0x56ab34);}}})[_0x974f('0xf')](function(){if(_0x4e12f8){return _0x4e12f8['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x974f('0xf')](function(_0xaa3fbb){_0x42f70d(_0xaa3fbb);})[_0x974f('0x18')](function(_0x23aa8c){_0x1b59b3(_0x27f831[_0x974f('0x15')](0x1f4,_0x23aa8c[_0x974f('0x17')]));});});};exports[_0x974f('0x49')]=function(_0x4f394b){var _0x4eff75=this;return new Promise(function(_0x24088e,_0x18ef78){var _0x5b29ff;var _0x699e74;var _0x58f93c;var _0x3e0fec;return db[_0x974f('0x23')]['findOne']({'where':_0x4f394b[_0x974f('0x1b')]['where']||{},'attributes':['id','name','role','mobile',_0x974f('0x4a'),_0x974f('0x28'),'loginInPause',_0x974f('0x33')]})[_0x974f('0xf')](function(_0x36c600){if(_0x36c600){_0x5b29ff=_0x36c600;_0x3e0fec=_0x4f394b[_0x974f('0x36')][_0x974f('0x33')]?_0x4f394b['body'][_0x974f('0x33')]:util[_0x974f('0x34')]('SIP/%s',_0x5b29ff[_0x974f('0x32')]);return db[_0x974f('0x23')][_0x974f('0x4b')]({'where':{'role':_0x974f('0x4c'),'online':!![],'id':{'$ne':_0x5b29ff['id']}}});}})[_0x974f('0xf')](function(_0x618fe7){if(_0x618fe7){_0x58f93c=_0x618fe7;return require(_0x974f('0x4d'))['getLicense']();}})[_0x974f('0xf')](function(_0x1dced5){if(_0x1dced5&&_0x1dced5[_0x974f('0x4e')]&&_0x58f93c>=_0x1dced5[_0x974f('0x4e')]){throw new Error(_0x974f('0x4f'));}})['then'](function(){if(_0x5b29ff){return db[_0x974f('0x29')][_0x974f('0x48')]({'where':{'membername':_0x5b29ff[_0x974f('0x32')]},'individualHooks':!![]});}})['then'](function(){if(_0x5b29ff){return _0x5b29ff[_0x974f('0x50')]({'raw':!![]});}})[_0x974f('0xf')](function(_0x3042b5){if(_0x5b29ff){if(_0x3042b5){var _0x223b77=[];_0x699e74=_0x3042b5;if(_0x699e74[_0x974f('0x2d')]){for(var _0x4e29cf=0x0;_0x4e29cf<_0x699e74[_0x974f('0x2d')];_0x4e29cf++){_0x223b77[_0x974f('0x31')](db['UserVoiceQueueRt'][_0x974f('0x51')]({'membername':_0x5b29ff[_0x974f('0x32')],'UserId':_0x5b29ff['id'],'queue_name':_0x699e74[_0x4e29cf][_0x974f('0x32')],'VoiceQueueId':_0x699e74[_0x4e29cf]['id'],'interface':_0x3e0fec,'paused':_0x5b29ff[_0x974f('0x52')]||![],'penalty':_0x699e74[_0x4e29cf][_0x974f('0x53')]||0x0}));}return BPromise[_0x974f('0x46')](_0x223b77);}}}})[_0x974f('0xf')](function(){if(_0x5b29ff){return db['MemberReport'][_0x974f('0x1a')]({'where':{'membername':_0x5b29ff[_0x974f('0x32')],'exitAt':null}});}})['then'](function(_0x1b739b){if(_0x5b29ff){if(_0x1b739b&&_0x1b739b[_0x974f('0x2d')]){var _0x4ec95b=[];_0x1b739b[_0x974f('0x30')](function(_0x63a99a){_0x4ec95b['push'](_0x63a99a[_0x974f('0x2a')]({'exitAt':moment()[_0x974f('0x34')](_0x974f('0x35'))}));});return BPromise['all'](_0x4ec95b);}}})['then'](function(_0x4b24b3){if(_0x5b29ff){var _0xd8f700=[];var _0x5ece33=[];var _0x4e0b67=utils[_0x974f('0x2f')]();var _0x5a511d={'membername':_0x5b29ff['name'],'interface':_0x3e0fec,'enterAt':moment()[_0x974f('0x34')](_0x974f('0x35')),'role':_0x5b29ff[_0x974f('0x38')],'internal':_0x5b29ff['internal']};_0x4e0b67[_0x974f('0x30')](function(_0x28b0f5){_0xd8f700[_0x974f('0x31')](_[_0x974f('0x54')]({'channel':_0x28b0f5,'type':_0x974f('0x55'),'data1':'callysquare','data2':_0x3e0fec},_0x5a511d));if(_0x5b29ff[_0x974f('0x52')]){_0x5ece33[_0x974f('0x31')](_['merge']({'channel':_0x28b0f5,'type':_0x974f('0x2c'),'data1':_0x974f('0x56')},_0x5a511d));}});return db[_0x974f('0x2b')]['bulkCreate'](_0xd8f700[_0x974f('0x57')](_0x5ece33),{'individualHooks':!![]});}})['then'](function(){if(_0x5b29ff){return _0x5b29ff[_0x974f('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x974f('0x34')](_0x974f('0x35')),'voicePause':_0x5b29ff['loginInPause']||![],'mailPause':_0x5b29ff[_0x974f('0x52')]||![],'chatPause':_0x5b29ff[_0x974f('0x52')]||![],'faxPause':_0x5b29ff[_0x974f('0x52')]||![],'smsPause':_0x5b29ff['loginInPause']||![],'openchannelPause':_0x5b29ff[_0x974f('0x52')]||![],'pauseType':_0x5b29ff[_0x974f('0x52')]?_0x974f('0x56'):null,'lastPauseAt':moment()['format'](_0x974f('0x35')),'interface':_0x3e0fec});}})['then'](function(_0x5861db){_0x24088e(_0x5861db);})[_0x974f('0x18')](function(_0x42b6af){_0x18ef78(_0x4eff75[_0x974f('0x15')](0x1f4,_0x42b6af[_0x974f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index b6c3a67..f9fe877 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 _0x55e9=['update','emit','removeListener','register','length','user:','./user.events','save'];(function(_0x58321b,_0x4b551d){var _0x1d67ec=function(_0x5c2f6f){while(--_0x5c2f6f){_0x58321b['push'](_0x58321b['shift']());}};_0x1d67ec(++_0x4b551d);}(_0x55e9,0xce));var _0x955e=function(_0xffd8b0,_0x12c51f){_0xffd8b0=_0xffd8b0-0x0;var _0x301ba0=_0x55e9[_0xffd8b0];return _0x301ba0;};'use strict';var UserEvents=require(_0x955e('0x0'));var events=[_0x955e('0x1'),'remove',_0x955e('0x2')];function createListener(_0x42a782,_0x3c29b4){return function(_0x521579){_0x3c29b4[_0x955e('0x3')](_0x42a782,_0x521579);};}function removeListener(_0x39652c,_0x1cf06e){return function(){UserEvents[_0x955e('0x4')](_0x39652c,_0x1cf06e);};}exports[_0x955e('0x5')]=function(_0x54375a){for(var _0x57d56d=0x0,_0x10d299=events[_0x955e('0x6')];_0x57d56d<_0x10d299;_0x57d56d++){var _0x1e4d00=events[_0x57d56d];var _0x57d74b=createListener(_0x955e('0x7')+_0x1e4d00,_0x54375a);UserEvents['on'](_0x1e4d00,_0x57d74b);}}; \ No newline at end of file +var _0x3b17=['user:','save','update','emit','register','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3b17,0x6d));var _0x73b1=function(_0xdd816e,_0xf02339){_0xdd816e=_0xdd816e-0x0;var _0x1153de=_0x3b17[_0xdd816e];return _0x1153de;};'use strict';var UserEvents=require('./user.events');var events=[_0x73b1('0x0'),'remove',_0x73b1('0x1')];function createListener(_0x4d0d8a,_0x3cf7bf){return function(_0x5ea11c){_0x3cf7bf[_0x73b1('0x2')](_0x4d0d8a,_0x5ea11c);};}function removeListener(_0x57dbd0,_0x54fd3b){return function(){UserEvents['removeListener'](_0x57dbd0,_0x54fd3b);};}exports[_0x73b1('0x3')]=function(_0x3db5c1){for(var _0x28bde2=0x0,_0x586d05=events[_0x73b1('0x4')];_0x28bde2<_0x586d05;_0x28bde2++){var _0x369aea=events[_0x28bde2];var _0xce14c8=createListener(_0x73b1('0x5')+_0x369aea,_0x3db5c1);UserEvents['on'](_0x369aea,_0xce14c8);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index ef951a7..d0eda58 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 _0x6ebc=['../../components/interaction/service','../../config/environment','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x289298,_0x16dea8){var _0x4a818f=function(_0x4af6c7){while(--_0x4af6c7){_0x289298['push'](_0x289298['shift']());}};_0x4a818f(++_0x16dea8);}(_0x6ebc,0x19f));var _0xc6eb=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0x6ebc[_0x291d3f];return _0x242080;};'use strict';var multer=require(_0xc6eb('0x0'));var util=require(_0xc6eb('0x1'));var path=require('path');var timeout=require(_0xc6eb('0x2'));var express=require(_0xc6eb('0x3'));var router=express['Router']();var auth=require(_0xc6eb('0x4'));var interaction=require(_0xc6eb('0x5'));var config=require(_0xc6eb('0x6'));module['exports']=router; \ No newline at end of file +var _0x9454=['../../config/environment','exports','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0x9454,0x8e));var _0x4945=function(_0x38b7bb,_0x21fd02){_0x38b7bb=_0x38b7bb-0x0;var _0x183069=_0x9454[_0x38b7bb];return _0x183069;};'use strict';var multer=require(_0x4945('0x0'));var util=require('util');var path=require(_0x4945('0x1'));var timeout=require(_0x4945('0x2'));var express=require(_0x4945('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4945('0x4'));var config=require(_0x4945('0x5'));module[_0x4945('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 60804d8..130af3d 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x57ac3b,_0x32e884){var _0x4204c9=function(_0x54a70e){while(--_0x54a70e){_0x57ac3b['push'](_0x57ac3b['shift']());}};_0x4204c9(++_0x32e884);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'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 970c682..71cc8c0 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 _0xaae4=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue','user_has_chat_queues'];(function(_0x12b2b0,_0x278163){var _0x144fb7=function(_0x392f13){while(--_0x392f13){_0x12b2b0['push'](_0x12b2b0['shift']());}};_0x144fb7(++_0x278163);}(_0xaae4,0x120));var _0x4aae=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xaae4[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x4aae('0x0'));var util=require(_0x4aae('0x1'));var logger=require(_0x4aae('0x2'))('api');var moment=require(_0x4aae('0x3'));var BPromise=require(_0x4aae('0x4'));var rp=require(_0x4aae('0x5'));var fs=require('fs');var path=require(_0x4aae('0x6'));var rimraf=require(_0x4aae('0x7'));var config=require(_0x4aae('0x8'));var attributes=require(_0x4aae('0x9'));module['exports']=function(_0xb5135a,_0x32b1fc){return _0xb5135a['define'](_0x4aae('0xa'),attributes,{'tableName':_0x4aae('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cc1=['user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue'];(function(_0x61286b,_0x4b20e3){var _0x2a3b3d=function(_0x4fd856){while(--_0x4fd856){_0x61286b['push'](_0x61286b['shift']());}};_0x2a3b3d(++_0x4b20e3);}(_0x7cc1,0x199));var _0x17cc=function(_0x5add31,_0x916bdc){_0x5add31=_0x5add31-0x0;var _0x3b7c68=_0x7cc1[_0x5add31];return _0x3b7c68;};'use strict';var _=require(_0x17cc('0x0'));var util=require(_0x17cc('0x1'));var logger=require(_0x17cc('0x2'))(_0x17cc('0x3'));var moment=require('moment');var BPromise=require(_0x17cc('0x4'));var rp=require(_0x17cc('0x5'));var fs=require('fs');var path=require(_0x17cc('0x6'));var rimraf=require(_0x17cc('0x7'));var config=require(_0x17cc('0x8'));var attributes=require(_0x17cc('0x9'));module['exports']=function(_0x13998e,_0x18cad7){return _0x13998e['define'](_0x17cc('0xa'),attributes,{'tableName':_0x17cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 00b193f..d3f6d0f 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 _0xd4a6=['error','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x42a883,_0x58f546){var _0x2eb5b8=function(_0x338ae4){while(--_0x338ae4){_0x42a883['push'](_0x42a883['shift']());}};_0x2eb5b8(++_0x58f546);}(_0xd4a6,0x78));var _0x6d4a=function(_0x22c833,_0x174575){_0x22c833=_0x22c833-0x0;var _0x475e86=_0xd4a6[_0x22c833];return _0x475e86;};'use strict';var _=require(_0x6d4a('0x0'));var util=require(_0x6d4a('0x1'));var moment=require('moment');var BPromise=require(_0x6d4a('0x2'));var rs=require(_0x6d4a('0x3'));var fs=require('fs');var Redis=require(_0x6d4a('0x4'));var db=require(_0x6d4a('0x5'))['db'];var utils=require(_0x6d4a('0x6'));var logger=require('../../config/logger')(_0x6d4a('0x7'));var config=require(_0x6d4a('0x8'));var jayson=require(_0x6d4a('0x9'));var client=jayson[_0x6d4a('0xa')][_0x6d4a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x172fdd,_0x4ab489,_0x1efe4a){return new BPromise(function(_0x54956e,_0x52f4f1){return client[_0x6d4a('0xc')](_0x172fdd,_0x1efe4a)['then'](function(_0xcfadf2){logger[_0x6d4a('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x4ab489,_0x6d4a('0xe'));logger[_0x6d4a('0xf')](_0x6d4a('0x10'),_0x4ab489,_0x6d4a('0xe'),JSON[_0x6d4a('0x11')](_0xcfadf2));if(_0xcfadf2['error']){if(_0xcfadf2['error']['code']===0x1f4){logger[_0x6d4a('0x12')](_0x6d4a('0x13'),_0x4ab489,_0xcfadf2['error'][_0x6d4a('0x14')]);return _0x52f4f1(_0xcfadf2[_0x6d4a('0x12')][_0x6d4a('0x14')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x4ab489,_0xcfadf2['error']['message']);return _0x54956e(_0xcfadf2[_0x6d4a('0x12')][_0x6d4a('0x14')]);}else{logger[_0x6d4a('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x4ab489,_0x6d4a('0xe'));_0x54956e(_0xcfadf2[_0x6d4a('0x15')]['message']);}})[_0x6d4a('0x16')](function(_0x1734e6){logger[_0x6d4a('0x12')](_0x6d4a('0x13'),_0x4ab489,_0x1734e6);_0x52f4f1(_0x1734e6);});});} \ No newline at end of file +var _0xf176=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xf7f3c3,_0xb3601){var _0x326114=function(_0x246262){while(--_0x246262){_0xf7f3c3['push'](_0xf7f3c3['shift']());}};_0x326114(++_0xb3601);}(_0xf176,0x1b9));var _0x6f17=function(_0x5381e5,_0x36cedb){_0x5381e5=_0x5381e5-0x0;var _0x31a630=_0xf176[_0x5381e5];return _0x31a630;};'use strict';var _=require('lodash');var util=require(_0x6f17('0x0'));var moment=require(_0x6f17('0x1'));var BPromise=require(_0x6f17('0x2'));var rs=require(_0x6f17('0x3'));var fs=require('fs');var Redis=require(_0x6f17('0x4'));var db=require(_0x6f17('0x5'))['db'];var utils=require(_0x6f17('0x6'));var logger=require('../../config/logger')(_0x6f17('0x7'));var config=require(_0x6f17('0x8'));var jayson=require(_0x6f17('0x9'));var client=jayson['client'][_0x6f17('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13a102,_0x2c061b,_0x3422e2){return new BPromise(function(_0x58aba3,_0x381fec){return client['request'](_0x13a102,_0x3422e2)['then'](function(_0x38b80b){logger[_0x6f17('0xb')](_0x6f17('0xc'),_0x2c061b,_0x6f17('0xd'));logger['debug'](_0x6f17('0xe'),_0x2c061b,_0x6f17('0xd'),JSON[_0x6f17('0xf')](_0x38b80b));if(_0x38b80b[_0x6f17('0x10')]){if(_0x38b80b[_0x6f17('0x10')][_0x6f17('0x11')]===0x1f4){logger[_0x6f17('0x10')](_0x6f17('0xc'),_0x2c061b,_0x38b80b['error'][_0x6f17('0x12')]);return _0x381fec(_0x38b80b[_0x6f17('0x10')][_0x6f17('0x12')]);}logger[_0x6f17('0x10')](_0x6f17('0xc'),_0x2c061b,_0x38b80b[_0x6f17('0x10')][_0x6f17('0x12')]);return _0x58aba3(_0x38b80b[_0x6f17('0x10')][_0x6f17('0x12')]);}else{logger[_0x6f17('0xb')](_0x6f17('0xc'),_0x2c061b,_0x6f17('0xd'));_0x58aba3(_0x38b80b[_0x6f17('0x13')][_0x6f17('0x12')]);}})[_0x6f17('0x14')](function(_0x26a019){logger[_0x6f17('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x2c061b,_0x26a019);_0x381fec(_0x26a019);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 3f57569..06f9e14 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 _0xde2b=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x40023d,_0x32dd8a){var _0x359322=function(_0x449317){while(--_0x449317){_0x40023d['push'](_0x40023d['shift']());}};_0x359322(++_0x32dd8a);}(_0xde2b,0x131));var _0xbde2=function(_0x18755d,_0x512d7e){_0x18755d=_0x18755d-0x0;var _0x3e4810=_0xde2b[_0x18755d];return _0x3e4810;};'use strict';var multer=require(_0xbde2('0x0'));var util=require(_0xbde2('0x1'));var path=require(_0xbde2('0x2'));var timeout=require(_0xbde2('0x3'));var express=require(_0xbde2('0x4'));var router=express[_0xbde2('0x5')]();var auth=require(_0xbde2('0x6'));var interaction=require(_0xbde2('0x7'));var config=require(_0xbde2('0x8'));module['exports']=router; \ No newline at end of file +var _0x056c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x1e951b,_0x4eb1de){var _0x14890d=function(_0x301da4){while(--_0x301da4){_0x1e951b['push'](_0x1e951b['shift']());}};_0x14890d(++_0x4eb1de);}(_0x056c,0x7e));var _0xc056=function(_0x4444ab,_0x3fc6ad){_0x4444ab=_0x4444ab-0x0;var _0x4d86e9=_0x056c[_0x4444ab];return _0x4d86e9;};'use strict';var multer=require(_0xc056('0x0'));var util=require(_0xc056('0x1'));var path=require(_0xc056('0x2'));var timeout=require(_0xc056('0x3'));var express=require(_0xc056('0x4'));var router=express[_0xc056('0x5')]();var auth=require(_0xc056('0x6'));var interaction=require(_0xc056('0x7'));var config=require(_0xc056('0x8'));module[_0xc056('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 430c49b..1db7c08 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 _0x4213=['exports','INTEGER','STRING','sequelize'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0x4213,0x77));var _0x3421=function(_0x107eea,_0x14f3a7){_0x107eea=_0x107eea-0x0;var _0x43757b=_0x4213[_0x107eea];return _0x43757b;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'penalty':{'type':Sequelize[_0x3421('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3421('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x3421('0x3')]}}; \ No newline at end of file +var _0xed3c=['exports','INTEGER','sequelize'];(function(_0x38622b,_0x3cfdf7){var _0x2c1a7a=function(_0x5de9cc){while(--_0x5de9cc){_0x38622b['push'](_0x38622b['shift']());}};_0x2c1a7a(++_0x3cfdf7);}(_0xed3c,0x1a6));var _0xced3=function(_0x34fab4,_0x194738){_0x34fab4=_0x34fab4-0x0;var _0x42fa5c=_0xed3c[_0x34fab4];return _0x42fa5c;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'penalty':{'type':Sequelize[_0xced3('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xced3('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 4cab8ab..3bd5354 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 _0xe511=['bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','lodash','util','api'];(function(_0x493a77,_0x2b4f4f){var _0x29e614=function(_0x3cbb8b){while(--_0x3cbb8b){_0x493a77['push'](_0x493a77['shift']());}};_0x29e614(++_0x2b4f4f);}(_0xe511,0x16f));var _0x1e51=function(_0x2601c2,_0x16bec){_0x2601c2=_0x2601c2-0x0;var _0x499fcb=_0xe511[_0x2601c2];return _0x499fcb;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var logger=require('../../config/logger')(_0x1e51('0x2'));var moment=require('moment');var BPromise=require(_0x1e51('0x3'));var rp=require(_0x1e51('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var attributes=require(_0x1e51('0x7'));module[_0x1e51('0x8')]=function(_0x480cca,_0x26b22c){return _0x480cca[_0x1e51('0x9')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0de=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues'];(function(_0x221e7d,_0x11ac59){var _0x4447f7=function(_0x40248f){while(--_0x40248f){_0x221e7d['push'](_0x221e7d['shift']());}};_0x4447f7(++_0x11ac59);}(_0xe0de,0x1e4));var _0xee0d=function(_0x4af40c,_0x54f30d){_0x4af40c=_0x4af40c-0x0;var _0x53744c=_0xe0de[_0x4af40c];return _0x53744c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee0d('0x0'))(_0xee0d('0x1'));var moment=require(_0xee0d('0x2'));var BPromise=require(_0xee0d('0x3'));var rp=require(_0xee0d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee0d('0x5'));var config=require(_0xee0d('0x6'));var attributes=require(_0xee0d('0x7'));module[_0xee0d('0x8')]=function(_0x12486e,_0x985ba3){return _0x12486e[_0xee0d('0x9')]('UserFaxQueue',attributes,{'tableName':_0xee0d('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 21cc36f..5b82dc4 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 _0xc080=['result','catch','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc080,0x16b));var _0x0c08=function(_0x3c9ac0,_0x1d1fb0){_0x3c9ac0=_0x3c9ac0-0x0;var _0x137925=_0xc080[_0x3c9ac0];return _0x137925;};'use strict';var _=require(_0x0c08('0x0'));var util=require(_0x0c08('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0c08('0x2'));var fs=require('fs');var Redis=require(_0x0c08('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0c08('0x4'))(_0x0c08('0x5'));var config=require(_0x0c08('0x6'));var jayson=require(_0x0c08('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2be87f,_0x4312ff,_0xb95990){return new BPromise(function(_0x225b23,_0x194048){return client['request'](_0x2be87f,_0xb95990)['then'](function(_0x1f05e5){logger[_0x0c08('0x8')](_0x0c08('0x9'),_0x4312ff,_0x0c08('0xa'));logger[_0x0c08('0xb')](_0x0c08('0xc'),_0x4312ff,'request\x20sent',JSON[_0x0c08('0xd')](_0x1f05e5));if(_0x1f05e5['error']){if(_0x1f05e5[_0x0c08('0xe')][_0x0c08('0xf')]===0x1f4){logger[_0x0c08('0xe')](_0x0c08('0x9'),_0x4312ff,_0x1f05e5[_0x0c08('0xe')][_0x0c08('0x10')]);return _0x194048(_0x1f05e5[_0x0c08('0xe')][_0x0c08('0x10')]);}logger[_0x0c08('0xe')](_0x0c08('0x9'),_0x4312ff,_0x1f05e5['error'][_0x0c08('0x10')]);return _0x225b23(_0x1f05e5[_0x0c08('0xe')][_0x0c08('0x10')]);}else{logger[_0x0c08('0x8')](_0x0c08('0x9'),_0x4312ff,_0x0c08('0xa'));_0x225b23(_0x1f05e5[_0x0c08('0x11')][_0x0c08('0x10')]);}})[_0x0c08('0x12')](function(_0x14c612){logger[_0x0c08('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x4312ff,_0x14c612);_0x194048(_0x14c612);});});} \ No newline at end of file +var _0x65ac=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','UserFaxQueue,\x20%s,\x20%s','debug','error','code','message','request\x20sent'];(function(_0x262f44,_0x3847ba){var _0x33b27c=function(_0x5db154){while(--_0x5db154){_0x262f44['push'](_0x262f44['shift']());}};_0x33b27c(++_0x3847ba);}(_0x65ac,0x1a3));var _0xc65a=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x65ac[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xc65a('0x0'));var util=require(_0xc65a('0x1'));var moment=require(_0xc65a('0x2'));var BPromise=require(_0xc65a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc65a('0x4'));var db=require(_0xc65a('0x5'))['db'];var utils=require(_0xc65a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc65a('0x7'));var jayson=require(_0xc65a('0x8'));var client=jayson[_0xc65a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d16ae,_0x48017f,_0x35c906){return new BPromise(function(_0x2cecf7,_0x4a4ed7){return client[_0xc65a('0xa')](_0x1d16ae,_0x35c906)[_0xc65a('0xb')](function(_0x42c854){logger['info'](_0xc65a('0xc'),_0x48017f,'request\x20sent');logger[_0xc65a('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x48017f,'request\x20sent',JSON['stringify'](_0x42c854));if(_0x42c854[_0xc65a('0xe')]){if(_0x42c854[_0xc65a('0xe')][_0xc65a('0xf')]===0x1f4){logger[_0xc65a('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x48017f,_0x42c854[_0xc65a('0xe')][_0xc65a('0x10')]);return _0x4a4ed7(_0x42c854[_0xc65a('0xe')][_0xc65a('0x10')]);}logger[_0xc65a('0xe')](_0xc65a('0xc'),_0x48017f,_0x42c854[_0xc65a('0xe')]['message']);return _0x2cecf7(_0x42c854['error'][_0xc65a('0x10')]);}else{logger['info'](_0xc65a('0xc'),_0x48017f,_0xc65a('0x11'));_0x2cecf7(_0x42c854[_0xc65a('0x12')]['message']);}})['catch'](function(_0x3b9225){logger['error'](_0xc65a('0xc'),_0x48017f,_0x3b9225);_0x4a4ed7(_0x3b9225);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 9ac317b..33bb0ec 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 _0x8811=['util','path','connect-timeout','express','Router','../../components/auth/service','exports','multer'];(function(_0x4ecfcc,_0x25c464){var _0x50cf30=function(_0x12e4c9){while(--_0x12e4c9){_0x4ecfcc['push'](_0x4ecfcc['shift']());}};_0x50cf30(++_0x25c464);}(_0x8811,0x187));var _0x1881=function(_0x8abb35,_0x5595e8){_0x8abb35=_0x8abb35-0x0;var _0x4d45bb=_0x8811[_0x8abb35];return _0x4d45bb;};'use strict';var multer=require(_0x1881('0x0'));var util=require(_0x1881('0x1'));var path=require(_0x1881('0x2'));var timeout=require(_0x1881('0x3'));var express=require(_0x1881('0x4'));var router=express[_0x1881('0x5')]();var auth=require(_0x1881('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x1881('0x7')]=router; \ No newline at end of file +var _0x3590=['../../config/environment','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x47e7e7,_0x57b94f){var _0x34eed1=function(_0x3f0f53){while(--_0x3f0f53){_0x47e7e7['push'](_0x47e7e7['shift']());}};_0x34eed1(++_0x57b94f);}(_0x3590,0x158));var _0x0359=function(_0x325cea,_0x3fb1af){_0x325cea=_0x325cea-0x0;var _0x1ad413=_0x3590[_0x325cea];return _0x1ad413;};'use strict';var multer=require(_0x0359('0x0'));var util=require(_0x0359('0x1'));var path=require('path');var timeout=require(_0x0359('0x2'));var express=require(_0x0359('0x3'));var router=express[_0x0359('0x4')]();var auth=require(_0x0359('0x5'));var interaction=require(_0x0359('0x6'));var config=require(_0x0359('0x7'));module[_0x0359('0x8')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 8140753..62afba8 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x31f676,_0x55febc){var _0x211bc8=function(_0x54d327){while(--_0x54d327){_0x31f676['push'](_0x31f676['shift']());}};_0x211bc8(++_0x55febc);}(_0xe706,0xa3));var _0x6e70=function(_0x59d369,_0x56a533){_0x59d369=_0x59d369-0x0;var _0x58c3eb=_0xe706[_0x59d369];return _0x58c3eb;};'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(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index f47cdf3..cba168b 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(_0x405396,_0x1315ef){var _0x103c15=function(_0x590e97){while(--_0x590e97){_0x405396['push'](_0x405396['shift']());}};_0x103c15(++_0x1315ef);}(_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(_0x35bb8d,_0x56f16e){var _0x18dae2=function(_0x2c72ce){while(--_0x2c72ce){_0x35bb8d['push'](_0x35bb8d['shift']());}};_0x18dae2(++_0x56f16e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var 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 9d1f108..99d609a 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 _0x83ed=['then','UserMailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5d72c7,_0x534db5){var _0x193fe2=function(_0x39c0f3){while(--_0x39c0f3){_0x5d72c7['push'](_0x5d72c7['shift']());}};_0x193fe2(++_0x534db5);}(_0x83ed,0x66));var _0xd83e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x83ed[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0xd83e('0x0'));var util=require('util');var moment=require(_0xd83e('0x1'));var BPromise=require(_0xd83e('0x2'));var rs=require(_0xd83e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd83e('0x4'))['db'];var utils=require(_0xd83e('0x5'));var logger=require(_0xd83e('0x6'))(_0xd83e('0x7'));var config=require(_0xd83e('0x8'));var jayson=require(_0xd83e('0x9'));var client=jayson[_0xd83e('0xa')][_0xd83e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9c6ae,_0x542197,_0x384d0d){return new BPromise(function(_0x30f141,_0x47d268){return client[_0xd83e('0xc')](_0x9c6ae,_0x384d0d)[_0xd83e('0xd')](function(_0x2348cb){logger['info'](_0xd83e('0xe'),_0x542197,'request\x20sent');logger[_0xd83e('0xf')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x542197,_0xd83e('0x10'),JSON[_0xd83e('0x11')](_0x2348cb));if(_0x2348cb['error']){if(_0x2348cb[_0xd83e('0x12')][_0xd83e('0x13')]===0x1f4){logger[_0xd83e('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x542197,_0x2348cb[_0xd83e('0x12')][_0xd83e('0x14')]);return _0x47d268(_0x2348cb[_0xd83e('0x12')][_0xd83e('0x14')]);}logger[_0xd83e('0x12')](_0xd83e('0xe'),_0x542197,_0x2348cb[_0xd83e('0x12')][_0xd83e('0x14')]);return _0x30f141(_0x2348cb[_0xd83e('0x12')][_0xd83e('0x14')]);}else{logger[_0xd83e('0x15')](_0xd83e('0xe'),_0x542197,_0xd83e('0x10'));_0x30f141(_0x2348cb['result']['message']);}})[_0xd83e('0x16')](function(_0x4bfb10){logger[_0xd83e('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x542197,_0x4bfb10);_0x47d268(_0x4bfb10);});});} \ No newline at end of file +var _0xb5ec=['UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5219b,_0xe9fcf5){var _0xbf13ed=function(_0x22c89f){while(--_0x22c89f){_0x5219b['push'](_0x5219b['shift']());}};_0xbf13ed(++_0xe9fcf5);}(_0xb5ec,0x97));var _0xcb5e=function(_0x5a24fd,_0x1a6644){_0x5a24fd=_0x5a24fd-0x0;var _0x58ad3d=_0xb5ec[_0x5a24fd];return _0x58ad3d;};'use strict';var _=require(_0xcb5e('0x0'));var util=require(_0xcb5e('0x1'));var moment=require(_0xcb5e('0x2'));var BPromise=require(_0xcb5e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb5e('0x4'));var db=require(_0xcb5e('0x5'))['db'];var utils=require(_0xcb5e('0x6'));var logger=require('../../config/logger')(_0xcb5e('0x7'));var config=require('../../config/environment');var jayson=require(_0xcb5e('0x8'));var client=jayson[_0xcb5e('0x9')][_0xcb5e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20e2a2,_0x1c449c,_0x3a51a8){return new BPromise(function(_0x1c9952,_0x3150be){return client[_0xcb5e('0xb')](_0x20e2a2,_0x3a51a8)[_0xcb5e('0xc')](function(_0x5d9e02){logger[_0xcb5e('0xd')](_0xcb5e('0xe'),_0x1c449c,_0xcb5e('0xf'));logger[_0xcb5e('0x10')](_0xcb5e('0x11'),_0x1c449c,_0xcb5e('0xf'),JSON[_0xcb5e('0x12')](_0x5d9e02));if(_0x5d9e02[_0xcb5e('0x13')]){if(_0x5d9e02['error'][_0xcb5e('0x14')]===0x1f4){logger[_0xcb5e('0x13')](_0xcb5e('0xe'),_0x1c449c,_0x5d9e02[_0xcb5e('0x13')][_0xcb5e('0x15')]);return _0x3150be(_0x5d9e02[_0xcb5e('0x13')]['message']);}logger[_0xcb5e('0x13')](_0xcb5e('0xe'),_0x1c449c,_0x5d9e02['error'][_0xcb5e('0x15')]);return _0x1c9952(_0x5d9e02[_0xcb5e('0x13')][_0xcb5e('0x15')]);}else{logger[_0xcb5e('0xd')](_0xcb5e('0xe'),_0x1c449c,_0xcb5e('0xf'));_0x1c9952(_0x5d9e02[_0xcb5e('0x16')][_0xcb5e('0x15')]);}})[_0xcb5e('0x17')](function(_0x2e7ba9){logger[_0xcb5e('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x1c449c,_0x2e7ba9);_0x3150be(_0x2e7ba9);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index ab4252a..92b62da 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 _0x0c8d=['connect-timeout','../../config/environment','exports','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c8d,0x184));var _0xd0c8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0c8d[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0xd0c8('0x0'));var path=require(_0xd0c8('0x1'));var timeout=require(_0xd0c8('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd0c8('0x3'));module[_0xd0c8('0x4')]=router; \ No newline at end of file +var _0x6daf=['connect-timeout','Router','../../components/interaction/service','exports','multer','util','path'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x6daf,0x115));var _0xf6da=function(_0x2501cc,_0xea673c){_0x2501cc=_0x2501cc-0x0;var _0x295c47=_0x6daf[_0x2501cc];return _0x295c47;};'use strict';var multer=require(_0xf6da('0x0'));var util=require(_0xf6da('0x1'));var path=require(_0xf6da('0x2'));var timeout=require(_0xf6da('0x3'));var express=require('express');var router=express[_0xf6da('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf6da('0x5'));var config=require('../../config/environment');module[_0xf6da('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 9038e3e..0611d4c 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x553eb3,_0x2e88d0){var _0xefd67f=function(_0x563741){while(--_0x563741){_0x553eb3['push'](_0x553eb3['shift']());}};_0xefd67f(++_0x2e88d0);}(_0xe706,0xa3));var _0x6e70=function(_0x331b85,_0x5f3e6e){_0x331b85=_0x331b85-0x0;var _0x1b97b2=_0xe706[_0x331b85];return _0x1b97b2;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x263d7d,_0x4fe765){var _0x510b6d=function(_0x5e2f98){while(--_0x5e2f98){_0x263d7d['push'](_0x263d7d['shift']());}};_0x510b6d(++_0x4fe765);}(_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 0a18ba2..af5af52 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 _0x8f3d=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash'];(function(_0x28ee74,_0x289441){var _0x6cc80c=function(_0x16ee15){while(--_0x16ee15){_0x28ee74['push'](_0x28ee74['shift']());}};_0x6cc80c(++_0x289441);}(_0x8f3d,0xe3));var _0xd8f3=function(_0x2abb14,_0x4972d2){_0x2abb14=_0x2abb14-0x0;var _0x54d7f6=_0x8f3d[_0x2abb14];return _0x54d7f6;};'use strict';var _=require(_0xd8f3('0x0'));var util=require(_0xd8f3('0x1'));var logger=require(_0xd8f3('0x2'))(_0xd8f3('0x3'));var moment=require(_0xd8f3('0x4'));var BPromise=require('bluebird');var rp=require(_0xd8f3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd8f3('0x6'));var config=require(_0xd8f3('0x7'));var attributes=require(_0xd8f3('0x8'));module[_0xd8f3('0x9')]=function(_0x2dd010,_0xedcd53){return _0x2dd010[_0xd8f3('0xa')](_0xd8f3('0xb'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01d7=['request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','util','api','moment'];(function(_0x41a764,_0x5ca01a){var _0x129353=function(_0x45c88b){while(--_0x45c88b){_0x41a764['push'](_0x41a764['shift']());}};_0x129353(++_0x5ca01a);}(_0x01d7,0x133));var _0x701d=function(_0x353ecf,_0x4379a1){_0x353ecf=_0x353ecf-0x0;var _0x16014b=_0x01d7[_0x353ecf];return _0x16014b;};'use strict';var _=require('lodash');var util=require(_0x701d('0x0'));var logger=require('../../config/logger')(_0x701d('0x1'));var moment=require(_0x701d('0x2'));var BPromise=require('bluebird');var rp=require(_0x701d('0x3'));var fs=require('fs');var path=require(_0x701d('0x4'));var rimraf=require('rimraf');var config=require(_0x701d('0x5'));var attributes=require(_0x701d('0x6'));module[_0x701d('0x7')]=function(_0x1fe0cb,_0x37d6c2){return _0x1fe0cb[_0x701d('0x8')](_0x701d('0x9'),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 bd973bd..92f8c24 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 _0x6906=['client','http','then','info','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','UserOpenchannelQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x3b35ba,_0x5758d6){var _0x4fe4ac=function(_0xb89fee){while(--_0xb89fee){_0x3b35ba['push'](_0x3b35ba['shift']());}};_0x4fe4ac(++_0x5758d6);}(_0x6906,0x89));var _0x6690=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6906[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x6690('0x0'));var util=require(_0x6690('0x1'));var moment=require(_0x6690('0x2'));var BPromise=require(_0x6690('0x3'));var rs=require(_0x6690('0x4'));var fs=require('fs');var Redis=require(_0x6690('0x5'));var db=require(_0x6690('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6690('0x7'));var config=require(_0x6690('0x8'));var jayson=require(_0x6690('0x9'));var client=jayson[_0x6690('0xa')][_0x6690('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45b3ba,_0x2ce0a0,_0x2e4967){return new BPromise(function(_0xfd8960,_0x446a66){return client['request'](_0x45b3ba,_0x2e4967)[_0x6690('0xc')](function(_0x503384){logger[_0x6690('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2ce0a0,_0x6690('0xe'));logger['debug'](_0x6690('0xf'),_0x2ce0a0,_0x6690('0xe'),JSON['stringify'](_0x503384));if(_0x503384[_0x6690('0x10')]){if(_0x503384['error']['code']===0x1f4){logger[_0x6690('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2ce0a0,_0x503384[_0x6690('0x10')]['message']);return _0x446a66(_0x503384[_0x6690('0x10')][_0x6690('0x11')]);}logger[_0x6690('0x10')](_0x6690('0x12'),_0x2ce0a0,_0x503384[_0x6690('0x10')]['message']);return _0xfd8960(_0x503384['error']['message']);}else{logger[_0x6690('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2ce0a0,'request\x20sent');_0xfd8960(_0x503384[_0x6690('0x13')][_0x6690('0x11')]);}})[_0x6690('0x14')](function(_0x578815){logger[_0x6690('0x10')](_0x6690('0x12'),_0x2ce0a0,_0x578815);_0x446a66(_0x578815);});});} \ No newline at end of file +var _0x134d=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x134d,0xb4));var _0xd134=function(_0xfb5f07,_0x27c85d){_0xfb5f07=_0xfb5f07-0x0;var _0x9de086=_0x134d[_0xfb5f07];return _0x9de086;};'use strict';var _=require(_0xd134('0x0'));var util=require(_0xd134('0x1'));var moment=require(_0xd134('0x2'));var BPromise=require(_0xd134('0x3'));var rs=require(_0xd134('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd134('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd134('0x6'))(_0xd134('0x7'));var config=require(_0xd134('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd134('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55fad3,_0x18fd0b,_0x5c5e24){return new BPromise(function(_0x32b07a,_0x3415f6){return client['request'](_0x55fad3,_0x5c5e24)[_0xd134('0xa')](function(_0x39edcf){logger[_0xd134('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x18fd0b,'request\x20sent');logger[_0xd134('0xc')](_0xd134('0xd'),_0x18fd0b,'request\x20sent',JSON[_0xd134('0xe')](_0x39edcf));if(_0x39edcf['error']){if(_0x39edcf[_0xd134('0xf')][_0xd134('0x10')]===0x1f4){logger[_0xd134('0xf')](_0xd134('0x11'),_0x18fd0b,_0x39edcf[_0xd134('0xf')][_0xd134('0x12')]);return _0x3415f6(_0x39edcf['error'][_0xd134('0x12')]);}logger['error'](_0xd134('0x11'),_0x18fd0b,_0x39edcf[_0xd134('0xf')][_0xd134('0x12')]);return _0x32b07a(_0x39edcf[_0xd134('0xf')][_0xd134('0x12')]);}else{logger[_0xd134('0xb')](_0xd134('0x11'),_0x18fd0b,'request\x20sent');_0x32b07a(_0x39edcf[_0xd134('0x13')][_0xd134('0x12')]);}})['catch'](function(_0x1ff3bf){logger['error'](_0xd134('0x11'),_0x18fd0b,_0x1ff3bf);_0x3415f6(_0x1ff3bf);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 1199b09..18895be 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 _0xcb33=['./userProfile.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/sections','getSections','post','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x3e2e40,_0x5e42ed){var _0x3cdf0a=function(_0x5ad21e){while(--_0x5ad21e){_0x3e2e40['push'](_0x3e2e40['shift']());}};_0x3cdf0a(++_0x5e42ed);}(_0xcb33,0xa1));var _0x3cb3=function(_0x25dedf,_0x118e5e){_0x25dedf=_0x25dedf-0x0;var _0x3688f6=_0xcb33[_0x25dedf];return _0x3688f6;};'use strict';var multer=require(_0x3cb3('0x0'));var util=require(_0x3cb3('0x1'));var path=require(_0x3cb3('0x2'));var timeout=require(_0x3cb3('0x3'));var express=require('express');var router=express[_0x3cb3('0x4')]();var auth=require(_0x3cb3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3cb3('0x6'));var controller=require(_0x3cb3('0x7'));router[_0x3cb3('0x8')]('/',auth[_0x3cb3('0x9')](),controller['index']);router[_0x3cb3('0x8')](_0x3cb3('0xa'),auth[_0x3cb3('0x9')](),controller[_0x3cb3('0xb')]);router[_0x3cb3('0x8')](_0x3cb3('0xc'),auth[_0x3cb3('0x9')](),controller[_0x3cb3('0xd')]);router['get'](_0x3cb3('0xe'),auth[_0x3cb3('0x9')](),controller[_0x3cb3('0xf')]);router[_0x3cb3('0x8')]('/:id/resources',auth['isAuthenticated'](),controller['getResources']);router[_0x3cb3('0x10')]('/',auth[_0x3cb3('0x9')](),controller['create']);router['post'](_0x3cb3('0x11'),auth[_0x3cb3('0x9')](),controller[_0x3cb3('0x12')]);router[_0x3cb3('0x10')](_0x3cb3('0xe'),auth[_0x3cb3('0x9')](),controller[_0x3cb3('0x13')]);router[_0x3cb3('0x10')]('/:id/resources',auth['isAuthenticated'](),controller[_0x3cb3('0x14')]);router[_0x3cb3('0x15')](_0x3cb3('0xc'),auth[_0x3cb3('0x9')](),controller[_0x3cb3('0x16')]);router[_0x3cb3('0x17')](_0x3cb3('0xc'),auth['isAuthenticated'](),controller[_0x3cb3('0x18')]);router[_0x3cb3('0x17')]('/:id/sections',auth[_0x3cb3('0x9')](),controller[_0x3cb3('0x19')]);router[_0x3cb3('0x17')]('/:id/resources',auth[_0x3cb3('0x9')](),controller[_0x3cb3('0x1a')]);module[_0x3cb3('0x1b')]=router; \ No newline at end of file +var _0xac85=['get','isAuthenticated','/describe','/:id','show','/:id/resources','post','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeResources','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x10431e,_0x3ac24a){var _0x449a5f=function(_0x441236){while(--_0x441236){_0x10431e['push'](_0x10431e['shift']());}};_0x449a5f(++_0x3ac24a);}(_0xac85,0x13c));var _0x5ac8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xac85[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x5ac8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5ac8('0x1'));var express=require(_0x5ac8('0x2'));var router=express[_0x5ac8('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5ac8('0x4'));var config=require(_0x5ac8('0x5'));var controller=require('./userProfile.controller');router[_0x5ac8('0x6')]('/',auth[_0x5ac8('0x7')](),controller['index']);router[_0x5ac8('0x6')](_0x5ac8('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x5ac8('0x6')](_0x5ac8('0x9'),auth[_0x5ac8('0x7')](),controller[_0x5ac8('0xa')]);router[_0x5ac8('0x6')]('/:id/sections',auth[_0x5ac8('0x7')](),controller['getSections']);router['get'](_0x5ac8('0xb'),auth[_0x5ac8('0x7')](),controller['getResources']);router[_0x5ac8('0xc')]('/',auth[_0x5ac8('0x7')](),controller['create']);router[_0x5ac8('0xc')](_0x5ac8('0xd'),auth['isAuthenticated'](),controller[_0x5ac8('0xe')]);router[_0x5ac8('0xc')]('/:id/sections',auth[_0x5ac8('0x7')](),controller[_0x5ac8('0xf')]);router['post'](_0x5ac8('0xb'),auth[_0x5ac8('0x7')](),controller[_0x5ac8('0x10')]);router[_0x5ac8('0x11')]('/:id',auth[_0x5ac8('0x7')](),controller[_0x5ac8('0x12')]);router[_0x5ac8('0x13')]('/:id',auth[_0x5ac8('0x7')](),controller[_0x5ac8('0x14')]);router[_0x5ac8('0x13')]('/:id/sections',auth[_0x5ac8('0x7')](),controller['removeSections']);router[_0x5ac8('0x13')](_0x5ac8('0xb'),auth[_0x5ac8('0x7')](),controller[_0x5ac8('0x15')]);module[_0x5ac8('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 5a16fcf..f032b91 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 _0xbe5d=['sequelize','exports','name','STRING','join','getDataValue','crudPermissions','split'];(function(_0x2a666f,_0x5c7fac){var _0x5e30d8=function(_0x2c3bce){while(--_0x2c3bce){_0x2a666f['push'](_0x2a666f['shift']());}};_0x5e30d8(++_0x5c7fac);}(_0xbe5d,0x1b0));var _0xdbe5=function(_0x1de7e3,_0x2127c5){_0x1de7e3=_0x1de7e3-0x0;var _0x2860f2=_0xbe5d[_0x1de7e3];return _0x2860f2;};'use strict';var Sequelize=require(_0xdbe5('0x0'));module[_0xdbe5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdbe5('0x2')},'crudPermissions':{'type':Sequelize[_0xdbe5('0x3')],'set':function(_0x11d1eb){this['setDataValue']('crudPermissions',_0x11d1eb?_0x11d1eb[_0xdbe5('0x4')](''):[]);},'get':function(){return this[_0xdbe5('0x5')]('crudPermissions')?this[_0xdbe5('0x5')](_0xdbe5('0x6'))[_0xdbe5('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xdbe5('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0xb16f=['setDataValue','join','crudPermissions','split','exports','STRING','name'];(function(_0x553a93,_0x5e02a1){var _0x1ef2da=function(_0xb12a81){while(--_0xb12a81){_0x553a93['push'](_0x553a93['shift']());}};_0x1ef2da(++_0x5e02a1);}(_0xb16f,0x1c4));var _0xfb16=function(_0x513254,_0x1305ca){_0x513254=_0x513254-0x0;var _0x384c92=_0xb16f[_0x513254];return _0x384c92;};'use strict';var Sequelize=require('sequelize');module[_0xfb16('0x0')]={'name':{'type':Sequelize[_0xfb16('0x1')],'allowNull':![],'unique':_0xfb16('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x20e258){this[_0xfb16('0x3')]('crudPermissions',_0x20e258?_0x20e258[_0xfb16('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0xfb16('0x5'))?this['getDataValue'](_0xfb16('0x5'))[_0xfb16('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xfb16('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 22f00ef..46c5c1e 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 _0x073d=['ListId','lists','CmList','companies','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','contexts','VoiceContext','VoiceMail','voicerecordings','Agents','role','agent','Telephones','membername','telephone','VoiceQueues','inbound','QueueCampaigns','queue','VoiceQueue','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','User','admin','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','intervals','Interval','pauses','scheduler','Schedule','sounds','tags','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','metrics','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./userProfile.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','options','get','createdAt','updatedAt','crudPermissions','omit','sequelize','UserProfileSection','autoAssociation','sectionId','Resources','describe','transaction','userProfileId','each','UserProfileResource','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','Plugin','forEach','resourceId','bulkCreate','undefined','Sequelize','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','ignore','union','all','pick','field','AnalyticExtractedReport','foreignKey','associatedResources','default','reportId','DefaultReports','CmContact','Tags','color','tag','Tag','ThroughTags','value','SquareProject','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projects','JscriptyProject','contacts','Lists'];(function(_0x2c9f20,_0x326c14){var _0x3518e0=function(_0x195767){while(--_0x195767){_0x2c9f20['push'](_0x2c9f20['shift']());}};_0x3518e0(++_0x326c14);}(_0x073d,0x133));var _0xd073=function(_0x1a12c8,_0x2df4dc){_0x1a12c8=_0x1a12c8-0x0;var _0x305109=_0x073d[_0x1a12c8];return _0x305109;};'use strict';var pdf=require(_0xd073('0x0'));var emlformat=require(_0xd073('0x1'));var rimraf=require(_0xd073('0x2'));var zipdir=require(_0xd073('0x3'));var jsonpatch=require(_0xd073('0x4'));var rp=require(_0xd073('0x5'));var moment=require(_0xd073('0x6'));var BPromise=require(_0xd073('0x7'));var Mustache=require(_0xd073('0x8'));var util=require('util');var path=require(_0xd073('0x9'));var sox=require(_0xd073('0xa'));var csv=require(_0xd073('0xb'));var ejs=require(_0xd073('0xc'));var fs=require('fs');var _=require(_0xd073('0xd'));var squel=require(_0xd073('0xe'));var crypto=require(_0xd073('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd073('0xb'));var querystring=require(_0xd073('0x10'));var Papa=require('papaparse');var Redis=require(_0xd073('0x11'));var authService=require(_0xd073('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd073('0x13'));var hardwareService=require(_0xd073('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd073('0x15'))['db'];config['redis']=_[_0xd073('0x16')](config['redis'],{'host':_0xd073('0x17'),'port':0x18eb});var socket=require(_0xd073('0x18'))(new Redis(config[_0xd073('0x19')]));require(_0xd073('0x1a'))['register'](socket);function respondWithStatusCode(_0x1401b2,_0x18dcf7){_0x18dcf7=_0x18dcf7||0xcc;return function(_0x4ee397){if(_0x4ee397){return _0x1401b2[_0xd073('0x1b')](_0x18dcf7);}return _0x1401b2[_0xd073('0x1c')](_0x18dcf7)[_0xd073('0x1d')]();};}function respondWithResult(_0x129358,_0x2a42e8){_0x2a42e8=_0x2a42e8||0xc8;return function(_0x2f5cea){if(_0x2f5cea){return _0x129358[_0xd073('0x1c')](_0x2a42e8)[_0xd073('0x1e')](_0x2f5cea);}};}function respondWithFilteredResult(_0x14c2e3,_0x28228c){return function(_0x4e1a93){if(_0x4e1a93){var _0x1133a8=_0x4e1a93[_0xd073('0x1f')],_0x57b483=_0x28228c[_0xd073('0x20')],_0x1bdcd1=_0x28228c[_0xd073('0x20')]+_0x28228c[_0xd073('0x21')],_0x299079;if(_0x1bdcd1>=_0x1133a8){_0x1bdcd1=_0x1133a8;_0x299079=0xc8;}else{_0x299079=0xce;}_0x14c2e3[_0xd073('0x1c')](_0x299079);return _0x14c2e3[_0xd073('0x22')](_0xd073('0x23'),_0x57b483+'-'+_0x1bdcd1+'/'+_0x1133a8)[_0xd073('0x1e')](_0x4e1a93);}return null;};}function patchUpdates(_0x5ff6c4){return function(_0xd66d03){try{jsonpatch[_0xd073('0x24')](_0xd66d03,_0x5ff6c4,!![]);}catch(_0x60a59b){return BPromise['reject'](_0x60a59b);}return _0xd66d03[_0xd073('0x25')]();};}function saveUpdates(_0x407bf5,_0x20194a){return function(_0x2bbf6f){if(_0x2bbf6f){return _0x2bbf6f[_0xd073('0x26')](_0x407bf5)['then'](function(_0x2c55f5){return _0x2c55f5;});}return null;};}function removeEntity(_0x1453ad,_0x8a48e9){return function(_0x24a575){if(_0x24a575){return _0x24a575[_0xd073('0x27')]()['then'](function(){_0x1453ad[_0xd073('0x1c')](0xcc)[_0xd073('0x1d')]();});}};}function handleEntityNotFound(_0x1c04cb,_0x457e8a){return function(_0xac50f8){if(!_0xac50f8){_0x1c04cb[_0xd073('0x1b')](0x194);}return _0xac50f8;};}function handleError(_0xe0d64b,_0x3955f6){_0x3955f6=_0x3955f6||0x1f4;return function(_0x20d4c1){logger['error'](_0x20d4c1[_0xd073('0x28')]);if(_0x20d4c1[_0xd073('0x29')]){delete _0x20d4c1[_0xd073('0x29')];}_0xe0d64b[_0xd073('0x1c')](_0x3955f6)[_0xd073('0x2a')](_0x20d4c1);};}exports[_0xd073('0x2b')]=function(_0x274673,_0x40d103){var _0x24c540={},_0x34c09f={},_0x493f33={'count':0x0,'rows':[]};var _0x4b6926=_['map'](db[_0xd073('0x2c')][_0xd073('0x2d')],function(_0x2e2588){return{'name':_0x2e2588[_0xd073('0x2e')],'type':_0x2e2588[_0xd073('0x2f')][_0xd073('0x30')]};});_0x34c09f[_0xd073('0x31')]=_[_0xd073('0x32')](_0x4b6926,_0xd073('0x29'));_0x34c09f[_0xd073('0x33')]=_[_0xd073('0x34')](_0x274673[_0xd073('0x33')]);_0x34c09f['filters']=_[_0xd073('0x35')](_0x34c09f[_0xd073('0x31')],_0x34c09f[_0xd073('0x33')]);_0x24c540['attributes']=_[_0xd073('0x35')](_0x34c09f[_0xd073('0x31')],qs[_0xd073('0x36')](_0x274673[_0xd073('0x33')][_0xd073('0x36')]));_0x24c540[_0xd073('0x37')]=_0x24c540[_0xd073('0x37')]['length']?_0x24c540[_0xd073('0x37')]:_0x34c09f[_0xd073('0x31')];if(!_0x274673[_0xd073('0x33')][_0xd073('0x38')](_0xd073('0x39'))){_0x24c540['limit']=qs['limit'](_0x274673[_0xd073('0x33')]['limit']);_0x24c540[_0xd073('0x20')]=qs[_0xd073('0x20')](_0x274673[_0xd073('0x33')][_0xd073('0x20')]);}_0x24c540[_0xd073('0x3a')]=qs['sort'](_0x274673[_0xd073('0x33')][_0xd073('0x3b')]);_0x24c540[_0xd073('0x3c')]=qs['filters'](_['pick'](_0x274673['query'],_0x34c09f[_0xd073('0x3d')]));if(_0x274673[_0xd073('0x33')][_0xd073('0x3e')]){_0x24c540[_0xd073('0x3c')]=_[_0xd073('0x3f')](_0x24c540[_0xd073('0x3c')],{'$or':_['map'](_0x4b6926,function(_0x5997c7){if(_0x5997c7[_0xd073('0x2f')]!==_0xd073('0x40')){var _0x3d3ebf={};_0x3d3ebf[_0x5997c7[_0xd073('0x29')]]={'$like':'%'+_0x274673[_0xd073('0x33')][_0xd073('0x3e')]+'%'};return _0x3d3ebf;}})});}_0x24c540=_[_0xd073('0x3f')]({},_0x24c540,_0x274673['options']);var _0x3af427={'where':_0x24c540[_0xd073('0x3c')]};return db[_0xd073('0x2c')]['count'](_0x3af427)[_0xd073('0x41')](function(_0x369d97){_0x493f33[_0xd073('0x1f')]=_0x369d97;if(_0x274673[_0xd073('0x33')][_0xd073('0x42')]){_0x24c540[_0xd073('0x43')]=[{'all':!![]}];}return db[_0xd073('0x2c')][_0xd073('0x44')](_0x24c540);})[_0xd073('0x41')](function(_0x12aa46){_0x493f33[_0xd073('0x45')]=_0x12aa46;return _0x493f33;})[_0xd073('0x41')](respondWithFilteredResult(_0x40d103,_0x24c540))[_0xd073('0x46')](handleError(_0x40d103,null));};exports[_0xd073('0x47')]=function(_0x429c81,_0x342821){var _0x375aee={'raw':![],'where':{'id':_0x429c81['params']['id']}},_0xf5ff3={};_0xf5ff3['model']=_[_0xd073('0x34')](db['UserProfile'][_0xd073('0x2d')]);_0xf5ff3['query']=_[_0xd073('0x34')](_0x429c81['query']);_0xf5ff3[_0xd073('0x3d')]=_[_0xd073('0x35')](_0xf5ff3[_0xd073('0x31')],_0xf5ff3[_0xd073('0x33')]);_0x375aee[_0xd073('0x37')]=_[_0xd073('0x35')](_0xf5ff3['model'],qs[_0xd073('0x36')](_0x429c81[_0xd073('0x33')][_0xd073('0x36')]));_0x375aee[_0xd073('0x37')]=_0x375aee['attributes'][_0xd073('0x48')]?_0x375aee[_0xd073('0x37')]:_0xf5ff3['model'];if(_0x429c81[_0xd073('0x33')][_0xd073('0x42')]){_0x375aee['include']=[{'all':!![]}];}_0x375aee=_['merge']({},_0x375aee,_0x429c81['options']);return db[_0xd073('0x2c')][_0xd073('0x49')](_0x375aee)[_0xd073('0x41')](handleEntityNotFound(_0x342821,null))['then'](respondWithResult(_0x342821,null))['catch'](handleError(_0x342821,null));};exports['create']=function(_0x7a3b41,_0x2c86a2){return db[_0xd073('0x2c')][_0xd073('0x4a')](_0x7a3b41[_0xd073('0x4b')],{})[_0xd073('0x41')](respondWithResult(_0x2c86a2,0xc9))['catch'](handleError(_0x2c86a2,null));};exports['clone']=function(_0x94de5c,_0x1b996a){var _0x21d1b4={'where':{'id':_0x94de5c[_0xd073('0x4c')]['id']}},_0x296819={};_0x296819[_0xd073('0x31')]=_[_0xd073('0x34')](db[_0xd073('0x2c')]['rawAttributes']);_0x21d1b4['attributes']=_['intersection'](_0x296819[_0xd073('0x31')],qs[_0xd073('0x36')](_0x94de5c[_0xd073('0x33')]['fields']));_0x21d1b4[_0xd073('0x37')]=_0x21d1b4[_0xd073('0x37')][_0xd073('0x48')]?_0x21d1b4['attributes']:_0x296819[_0xd073('0x31')];if(_0x94de5c[_0xd073('0x33')][_0xd073('0x42')]){_0x21d1b4[_0xd073('0x43')]=[{'all':!![]}];}_0x21d1b4=_[_0xd073('0x3f')]({},_0x21d1b4,_0x94de5c[_0xd073('0x4d')]);return db['UserProfile']['find'](_0x21d1b4)['then'](handleEntityNotFound(_0x1b996a,null))[_0xd073('0x41')](function(_0x4c1c46){if(_0x4c1c46){var _0x341dcb=_0x4c1c46[_0xd073('0x4e')]({'plain':!![]});_0x341dcb=qs['omit'](_0x341dcb,['id',_0xd073('0x4f'),_0xd073('0x50'),_0xd073('0x51')]);_0x94de5c[_0xd073('0x4b')]=_[_0xd073('0x52')](_0x94de5c[_0xd073('0x4b')],['id',_0xd073('0x4f'),'updatedAt']);return db[_0xd073('0x53')]['transaction'](function(_0x38ed1e){return db[_0xd073('0x2c')][_0xd073('0x4a')](_[_0xd073('0x3f')](_0x341dcb,_0x94de5c[_0xd073('0x4b')]),{'include':_0x94de5c[_0xd073('0x33')][_0xd073('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x38ed1e})[_0xd073('0x41')](function(_0x17b352){var _0x20675b=_0x17b352[_0xd073('0x4e')]({'plain':!![]});return db[_0xd073('0x54')][_0xd073('0x44')]({'where':{'userProfileId':_0x94de5c[_0xd073('0x4c')]['id']},'raw':!![]})[_0xd073('0x41')](function(_0x573ca0){if(_0x573ca0){return BPromise['each'](_0x573ca0,function(_0x203bc3){return new BPromise(function(_0x10f984,_0x55f348){if(_0x203bc3[_0xd073('0x55')]===null||_0x203bc3['autoAssociation']===0x1)_0x10f984(null);return db['UserProfileResource'][_0xd073('0x44')]({'where':{'sectionId':_0x203bc3['id']},'raw':!![]})[_0xd073('0x41')](function(_0x2b5174){var _0x32ccd9=_['map'](_0x2b5174,function(_0x37b81e){return qs[_0xd073('0x52')](_0x37b81e,['id',_0xd073('0x4f'),_0xd073('0x50'),_0xd073('0x56')]);});_0x10f984(_0x32ccd9);})['catch'](function(_0x1589b5){_0x55f348(_0x1589b5);});})[_0xd073('0x41')](function(_0x358387){var _0x977e58=qs[_0xd073('0x52')](_0x203bc3,['id',_0xd073('0x4f'),_0xd073('0x50')]);_0x977e58['userProfileId']=_0x20675b['id'];if(_0x358387)_0x977e58[_0xd073('0x57')]=_0x358387;return _0x977e58;})[_0xd073('0x41')](function(_0x1e0e46){return db[_0xd073('0x54')][_0xd073('0x4a')](_0x1e0e46,{'include':[{'model':db['UserProfileResource'],'as':_0xd073('0x57')}],'raw':!![],'transaction':_0x38ed1e});});})[_0xd073('0x41')](function(){return _0x20675b;});}});});});}})[_0xd073('0x41')](respondWithResult(_0x1b996a,0xc9))[_0xd073('0x46')](handleError(_0x1b996a,null));};exports[_0xd073('0x26')]=function(_0x3c9d60,_0x11ceb1){if(_0x3c9d60[_0xd073('0x4b')]['id']){delete _0x3c9d60[_0xd073('0x4b')]['id'];}return db[_0xd073('0x2c')][_0xd073('0x49')]({'where':{'id':_0x3c9d60['params']['id']}})['then'](handleEntityNotFound(_0x11ceb1,null))[_0xd073('0x41')](saveUpdates(_0x3c9d60['body'],null))[_0xd073('0x41')](respondWithResult(_0x11ceb1,null))['catch'](handleError(_0x11ceb1,null));};exports[_0xd073('0x27')]=function(_0x1d4292,_0x5e6dba){return db[_0xd073('0x2c')][_0xd073('0x49')]({'where':{'id':_0x1d4292[_0xd073('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5e6dba,null))['then'](removeEntity(_0x5e6dba,null))[_0xd073('0x46')](handleError(_0x5e6dba,null));};exports[_0xd073('0x58')]=function(_0x1fed1d,_0x44a8e5){return db[_0xd073('0x2c')]['describe']()[_0xd073('0x41')](respondWithResult(_0x44a8e5,null))['catch'](handleError(_0x44a8e5,null));};exports['addSections']=function(_0x3dbc1c,_0x348888){var _0xeae631=_0x3dbc1c['body'];return db[_0xd073('0x2c')][_0xd073('0x49')]({'where':{'id':_0x3dbc1c[_0xd073('0x4c')]['id']}})[_0xd073('0x41')](handleEntityNotFound(_0x348888,null))['then'](function(_0x55a9ff){if(_0x55a9ff){return db['sequelize'][_0xd073('0x59')](function(_0x4f7096){return db['UserProfileSection'][_0xd073('0x27')]({'where':{'userProfileId':_0x3dbc1c[_0xd073('0x4c')]['id'],'sectionId':_[_0xd073('0x32')](_0xeae631,function(_0x1e0de2){return _0x1e0de2[_0xd073('0x56')];})},'transaction':_0x4f7096})[_0xd073('0x41')](function(){var _0x2ae99c=_[_0xd073('0x32')](_0xeae631,function(_0x55ba04){_0x55ba04[_0xd073('0x5a')]=_0x3dbc1c[_0xd073('0x4c')]['id'];return _0x55ba04;});var _0x15b72e=[];return BPromise[_0xd073('0x5b')](_0x2ae99c,function(_0x11eaeb){return db[_0xd073('0x54')]['create'](_0x11eaeb,{'include':[{'model':db[_0xd073('0x5c')],'as':_0xd073('0x57')}],'raw':!![],'transaction':_0x4f7096})['then'](function(_0x21c7fa){_0x15b72e[_0xd073('0x5d')](_0x21c7fa[_0xd073('0x4e')]({'plain':!![]}));});})[_0xd073('0x41')](function(){return _0x15b72e;});});});}})['then'](function(_0x237126){return _0x237126;})[_0xd073('0x41')](respondWithResult(_0x348888,null))[_0xd073('0x46')](handleError(_0x348888,null));};exports[_0xd073('0x5e')]=function(_0x58002b,_0xa645e){var _0x522c4e;return db[_0xd073('0x2c')][_0xd073('0x49')]({'where':{'id':_0x58002b[_0xd073('0x4c')]['id']},'attributes':['id',_0xd073('0x29')]})[_0xd073('0x41')](handleEntityNotFound(_0xa645e,null))[_0xd073('0x41')](function(_0x48d99c){if(_0x48d99c){_0x522c4e=_0x48d99c;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x58002b[_0xd073('0x4c')]['id'],'sectionId':_0x58002b[_0xd073('0x33')][_0xd073('0x5f')]}});}})[_0xd073('0x41')](function(){return _0x522c4e;})[_0xd073('0x41')](respondWithStatusCode(_0xa645e,null))[_0xd073('0x46')](handleError(_0xa645e,null));};exports[_0xd073('0x60')]=function(_0x573148,_0x37dfc2){var _0x1c0ad7=[];var _0x34995f=[];return db[_0xd073('0x54')]['findAll']({'where':{'userProfileId':_0x573148['params']['id']},'raw':!![]})['then'](function(_0x469f41){_0x1c0ad7=_[_0xd073('0x3e')](_0x469f41,function(_0x31f424){return _0x31f424[_0xd073('0x61')]===0x1||_[_0xd073('0x62')]([0x3eb,0x709],_0x31f424[_0xd073('0x56')]);});if(!_[_0xd073('0x63')](_0x1c0ad7)){return _[_0xd073('0x32')](_0x1c0ad7,function(_0x115c4e){return _0x115c4e[_0xd073('0x56')];});}else{return;}})[_0xd073('0x41')](function(_0x5645bb){if(_0x5645bb)_0x34995f=_0x5645bb;if(_[_0xd073('0x62')](_0x34995f,0x64)){var _0x3a74ae=_[_0xd073('0x49')](_0x1c0ad7,{'sectionId':0x64});return hasDefaultDashboard(_0x3a74ae)[_0xd073('0x41')](function(_0x5a96b0){return _[_0xd073('0x32')](_0x1c0ad7,function(_0x1e2386){if(_0x1e2386[_0xd073('0x56')]===0x64){_0x1e2386[_0xd073('0x64')]=_0x5a96b0;}return _0x1e2386;});});}else{return;}})[_0xd073('0x41')](function(_0x13780a){if(_0x13780a)_0x1c0ad7=_0x13780a;if(_[_0xd073('0x62')](_0x34995f,0x3eb)){var _0x8bab98=_[_0xd073('0x49')](_0x1c0ad7,{'sectionId':0x3eb});return getCustomDashboards(_0x8bab98)['then'](function(_0x21ec62){return _[_0xd073('0x32')](_0x1c0ad7,function(_0x84c5ff){if(_0x8bab98[_0xd073('0x61')]){if(_0x84c5ff[_0xd073('0x56')]===0x3eb){_0x84c5ff[_0xd073('0x64')]=_0x21ec62;}}else{if(_0x84c5ff['sectionId']===0x64){_0x84c5ff['subsections']=_0x21ec62;}}return _0x84c5ff;});});}else{return;}})[_0xd073('0x41')](function(_0x353080){if(_0x353080)_0x1c0ad7=_0x353080;if(_['includes'](_0x34995f,0x709)){var _0x626d8=_[_0xd073('0x49')](_0x1c0ad7,{'sectionId':0x709});return getPlugins(_0x626d8)[_0xd073('0x41')](function(_0x23fbfb){if(_0x626d8[_0xd073('0x61')]){return _[_0xd073('0x32')](_0x1c0ad7,function(_0x58a8f4){if(_0x58a8f4[_0xd073('0x56')]===0x709){_0x58a8f4[_0xd073('0x64')]=_0x23fbfb;}return _0x58a8f4;});}else{var _0x41219c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x23fbfb};var _0x11ca27=_['map'](_0x1c0ad7);_0x11ca27['push'](_0x41219c);return _0x11ca27;}});}else{return;}})[_0xd073('0x41')](function(_0x5a2f33){if(_0x5a2f33)_0x1c0ad7=_0x5a2f33;return _[_0xd073('0x3e')](_0x1c0ad7,['enabled',0x1]);})['then'](respondWithResult(_0x37dfc2,null))[_0xd073('0x46')](handleError(_0x37dfc2,null));};function hasDefaultDashboard(_0x51eaf3){var _0x31b097=[0x65];return new BPromise(function(_0x21bdbf,_0x1575b9){try{if(_0x51eaf3[_0xd073('0x55')]){_0x21bdbf(_0x31b097);}else{return db['UserProfileResource'][_0xd073('0x65')]({'where':{'sectionId':_0x51eaf3['id']},'raw':!![]})['then'](function(_0x36cb07){_0x36cb07?_0x21bdbf(_0x31b097):_0x21bdbf();});}}catch(_0x5997fb){_0x1575b9(_0x5997fb);}});}function getCustomDashboards(_0x177535){var _0x2eeee1=[];return new BPromise(function(_0x285811,_0x192ec5){try{if(_0x177535['autoAssociation']){return db[_0xd073('0x66')][_0xd073('0x44')]({'raw':!![]})[_0xd073('0x41')](function(_0x93ca13){_0x93ca13['forEach'](function(_0x231d6f){_0x2eeee1[_0xd073('0x5d')](_0x231d6f['id']+0x1869f);});_0x285811(_0x2eeee1);});}else{return db[_0xd073('0x5c')][_0xd073('0x44')]({'where':{'sectionId':_0x177535['id']},'raw':!![]})['then'](function(_0x54b803){_0x54b803['forEach'](function(_0x324650){_0x2eeee1[_0xd073('0x5d')](_0x324650['resourceId']+0x1869f);});_0x285811(_0x2eeee1);});}}catch(_0xdd639f){_0x192ec5(_0xdd639f);}});}function getPlugins(_0x559cd8){var _0x3d99df=[];return new BPromise(function(_0x18eed8,_0x393476){try{if(_0x559cd8[_0xd073('0x55')]){return db[_0xd073('0x67')][_0xd073('0x44')]({'raw':!![]})[_0xd073('0x41')](function(_0x546b90){_0x546b90[_0xd073('0x68')](function(_0x4447a9){_0x3d99df[_0xd073('0x5d')](_0x4447a9['id']+0x15b38);});_0x18eed8(_0x3d99df);});}else{return db['UserProfileResource'][_0xd073('0x44')]({'where':{'sectionId':_0x559cd8['id']},'raw':!![]})['then'](function(_0x35f4e7){_0x35f4e7[_0xd073('0x68')](function(_0x21b8e1){_0x3d99df['push'](_0x21b8e1[_0xd073('0x69')]+0x15b38);});_0x18eed8(_0x3d99df);});}}catch(_0x559a99){_0x393476(_0x559a99);}});}exports['addResources']=function(_0x262999,_0x39f60a){return db['UserProfile']['find']({'where':{'id':_0x262999[_0xd073('0x4c')]['id']}})[_0xd073('0x41')](handleEntityNotFound(_0x39f60a,null))[_0xd073('0x41')](function(_0x4f7f3d){if(_0x4f7f3d){return db['sequelize']['transaction'](function(_0x26bc1d){return db[_0xd073('0x54')][_0xd073('0x44')]({'where':{'userProfileId':_0x262999['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x46d969){if(_0x46d969){return db[_0xd073('0x54')][_0xd073('0x27')]({'where':{'userProfileId':_0x262999['params']['id'],'id':_[_0xd073('0x32')](_0x46d969,function(_0x5273d2){return _0x5273d2['id'];})},'transaction':_0x26bc1d});}})[_0xd073('0x41')](function(_0x38e498){var _0x5a5673=_[_0xd073('0x32')](_0x262999['body'],function(_0x1cda5a){_0x1cda5a['userProfileId']=_0x262999[_0xd073('0x4c')]['id'];return _0x1cda5a;});return db[_0xd073('0x54')][_0xd073('0x6a')](_0x5a5673,{'raw':!![],'transaction':_0x26bc1d});})[_0xd073('0x41')](function(_0x1c995c){var _0x372853=_[_0xd073('0x3e')](_[_0xd073('0x32')](_0x1c995c,function(_0x27ba85){return _0x27ba85[_0xd073('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x372853){return db[_0xd073('0x54')]['findAll']({'where':{'userProfileId':_0x262999['params']['id'],'sectionId':_[_0xd073('0x32')](_0x372853,function(_0x16fa6f){return _0x16fa6f[_0xd073('0x56')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xd073('0x41')](function(_0x435707){var _0x5dc718=_['map'](_0x262999[_0xd073('0x4b')],function(_0x2b0fce){_0x2b0fce['userProfileId']=_0x262999[_0xd073('0x4c')]['id'];return _0x2b0fce;});return db[_0xd073('0x5c')]['bulkCreate'](_0x5dc718,{'raw':!![],'transaction':_0x26bc1d});});}})[_0xd073('0x46')](handleError(_0x39f60a,null));});}})[_0xd073('0x41')](function(_0x462c0c){var _0x4e7267=_[_0xd073('0x32')](_0x462c0c,function(_0x2159ad){return _0x2159ad[_0xd073('0x4e')]({'plain':!![]});});})[_0xd073('0x41')](respondWithResult(_0x39f60a,null))['catch'](handleError(_0x39f60a,null));};exports['removeResources']=function(_0x33abe4,_0x16032f,_0x16041f){return db['UserProfile'][_0xd073('0x49')]({'where':{'id':_0x33abe4[_0xd073('0x4c')]['id']}})['then'](handleEntityNotFound(_0x16032f,null))['then'](function(_0x10cffe){if(_0x10cffe){return _0x10cffe['removeResources'](_0x33abe4[_0xd073('0x33')]['ids']);}})[_0xd073('0x41')](respondWithStatusCode(_0x16032f,null))[_0xd073('0x46')](handleError(_0x16032f,null));};exports['getResources']=function(_0x18fb46,_0x4be6af){var _0x2194ea={'raw':![],'where':{}};var _0xc1b623={};var _0x16e1f9={'count':0x0,'rows':[]};var _0x54f27c=_0x18fb46[_0xd073('0x33')]['section'];if(typeof _0x54f27c===_0xd073('0x6b')){throw new db[(_0xd073('0x6c'))]['ValidationError'](_0xd073('0x6d'));}var _0x170095=_0x18fb46[_0xd073('0x33')][_0xd073('0x6e')]||![];var _0x5906a0=getQueryModels(_0x54f27c,_0x170095);if(typeof _0x5906a0[_0xd073('0x6f')]===_0xd073('0x6b')){throw new db[(_0xd073('0x6c'))]['ValidationError'](_0xd073('0x70')+_0x54f27c+'\x27');}var _0x20266e=[];if(!_[_0xd073('0x63')](_0x5906a0[_0xd073('0x71')])){_0x20266e=_0x5906a0[_0xd073('0x71')];}else{_0x20266e=[{'name':_0x54f27c}];}return db['UserProfile'][_0xd073('0x65')]({'where':{'id':_0x18fb46['params']['id']}})[_0xd073('0x41')](handleEntityNotFound(_0x4be6af,null))['then'](function(_0x5d2312){if(_0x5d2312){var _0x30a9c3=[];for(var _0x480dcd=0x0;_0x480dcd<_0x20266e[_0xd073('0x48')];_0x480dcd++){_0x30a9c3[_0xd073('0x5d')](db[_0xd073('0x54')][_0xd073('0x65')]({'where':{'userProfileId':_0x5d2312['id'],'name':_0x20266e[_0x480dcd][_0xd073('0x29')]},'raw':!![]}));}return BPromise['all'](_0x30a9c3);}})[_0xd073('0x41')](function(_0x117b5f){var _0x28eb77=_['filter'](_0x117b5f,function(_0x2d67c4){return _0x2d67c4?_0x2d67c4:undefined;});var _0x1d3eb2=_[_0xd073('0x3e')](_0x20266e,[_0xd073('0x72'),!![]]);var _0x2baf4a=_[_0xd073('0x63')](_0x28eb77)&&_[_0xd073('0x63')](_0x1d3eb2)?null:_[_0xd073('0x73')](_0x1d3eb2,_0x28eb77);if(_0x2baf4a){var _0x12e759=[];for(var _0x94cc1=0x0;_0x94cc1<_0x2baf4a['length'];_0x94cc1++){var _0x38e8e2=_[_0xd073('0x49')](_0x20266e,function(_0x487d7e){return _0x2baf4a[_0x94cc1]?_0x487d7e[_0xd073('0x29')]===_0x2baf4a[_0x94cc1][_0xd073('0x29')]:null;});if(_0x38e8e2){if(_0x2baf4a[_0x94cc1][_0xd073('0x72')]){_0x12e759['push'](getAllResources(_0x5906a0['childModel'],_0x2baf4a[_0x94cc1]));}else{if(!_0x2baf4a[_0x94cc1]['autoAssociation']){_0x12e759[_0xd073('0x5d')](getAllowedResources(_0x38e8e2,_0x2baf4a[_0x94cc1],_0x5906a0[_0xd073('0x6f')]));}else{if(_0x38e8e2[_0xd073('0x31')]){_0x12e759[_0xd073('0x5d')](getAllFilteredResources(_0x38e8e2,_0x2baf4a[_0x94cc1]));}}}}}return BPromise[_0xd073('0x74')](_0x12e759);}else{return null;}})[_0xd073('0x41')](function(_0x46b250){var _0x2fb995=_0x46b250;var _0x57c1ac=null;if(_0x2fb995){_0x57c1ac=_0x2fb995[_0xd073('0x48')]===0x1?_0x2fb995[0x0]:null;}if(_0x57c1ac||_0x2fb995){var _0x259b62=db[_0x5906a0[_0xd073('0x6f')]]['rawAttributes'];_0xc1b623[_0xd073('0x31')]=_[_0xd073('0x34')](_0x259b62);_0xc1b623[_0xd073('0x33')]=_[_0xd073('0x34')](_0x18fb46['query']);_0xc1b623[_0xd073('0x3d')]=_[_0xd073('0x35')](_0xc1b623['model'],_0xc1b623[_0xd073('0x33')]);_0x2194ea[_0xd073('0x37')]=_['intersection'](_0xc1b623[_0xd073('0x31')],qs[_0xd073('0x36')](_0x18fb46[_0xd073('0x33')][_0xd073('0x36')]));_0x2194ea[_0xd073('0x37')]=_0x2194ea[_0xd073('0x37')][_0xd073('0x48')]?_0x2194ea[_0xd073('0x37')]:_0xc1b623['model'];if(!_0x18fb46[_0xd073('0x33')][_0xd073('0x38')](_0xd073('0x39'))){_0x2194ea[_0xd073('0x21')]=qs[_0xd073('0x21')](_0x18fb46['query'][_0xd073('0x21')]);_0x2194ea[_0xd073('0x20')]=qs[_0xd073('0x20')](_0x18fb46[_0xd073('0x33')][_0xd073('0x20')]);}_0x2194ea[_0xd073('0x3a')]=qs['sort'](_0x18fb46['query'][_0xd073('0x3b')]);_0x2194ea[_0xd073('0x3c')]=qs['filters'](_[_0xd073('0x75')](_0x18fb46[_0xd073('0x33')],_0xc1b623[_0xd073('0x3d')]));if(_0x18fb46[_0xd073('0x33')][_0xd073('0x3e')]){_0x2194ea[_0xd073('0x3c')]=_['merge'](_0x2194ea[_0xd073('0x3c')],{'$or':_['map'](_0x259b62,function(_0x524775){if(_0x524775[_0xd073('0x2f')]['key']!=='VIRTUAL'){var _0x246807={};_0x246807[_0x524775[_0xd073('0x76')]]={'$like':'%'+_0x18fb46['query'][_0xd073('0x3e')]+'%'};return _0x246807;}})});}var _0x5c8a46=[];if(_0x57c1ac){var _0x7f1af0=_[_0xd073('0x49')](_0x20266e,[_0xd073('0x29'),_0x57c1ac['name']]);if(_0x7f1af0[_0xd073('0x76')]){var _0x3e298c={};if(_0x5906a0[_0xd073('0x6f')]===_0xd073('0x77')){_0x3e298c[_0x7f1af0[_0xd073('0x78')]]=_['map'](_0x57c1ac[_0xd073('0x79')],'id');}else{_0x3e298c[_0x7f1af0[_0xd073('0x78')]]=_0x57c1ac[_0xd073('0x79')];}_0x5c8a46[_0xd073('0x5d')](_0x3e298c);}else{_0x2194ea[_0xd073('0x3c')]['id']=_0x57c1ac['associatedResources'];}}else{for(var _0x39e206=0x0;_0x39e206<_0x2fb995['length'];_0x39e206++){var _0x7f1af0=_[_0xd073('0x49')](_0x20266e,[_0xd073('0x29'),_0x2fb995[_0x39e206][_0xd073('0x29')]]);if(_0x7f1af0[_0xd073('0x76')]){var _0x3e298c={};_0x3e298c[_0x7f1af0['foreignKey']]=_0x2fb995[_0x39e206]['associatedResources'];_0x5c8a46[_0xd073('0x5d')](_0x3e298c);}else{if(!_0x2194ea['where']['id'])_0x2194ea[_0xd073('0x3c')]['id']=[];_0x2fb995[_0x39e206][_0xd073('0x79')][_0xd073('0x68')](function(_0x113dc8){_0x2194ea[_0xd073('0x3c')]['id']['push'](_0x113dc8);});}}}if(!_['isEmpty'](_0x5c8a46)){_0x2194ea[_0xd073('0x3c')]=_[_0xd073('0x3f')](_0x2194ea[_0xd073('0x3c')],{'$and':{'$or':_0x5c8a46}});}_0x2194ea=_[_0xd073('0x3f')]({},_0x2194ea,_0x18fb46[_0xd073('0x4d')]);if(_0x57c1ac&&!_0x57c1ac[_0xd073('0x55')]&&_0x5906a0['childModel']===_0xd073('0x77')){if(_0x18fb46[_0xd073('0x33')][_0xd073('0x42')]){_0x2194ea[_0xd073('0x43')]=[{'all':!![]}];}return db[_0x5906a0[_0xd073('0x6f')]][_0xd073('0x44')](_0x2194ea)[_0xd073('0x41')](function(_0x2af023){var _0x5e7a5d=[];_0x2af023['forEach'](function(_0x543926){var _0x3a2516;switch(_0x543926['reportType']){case _0xd073('0x7a'):_0x3a2516=_[_0xd073('0x49')](_0x57c1ac[_0xd073('0x79')],function(_0x3e37b9){return _0x3e37b9['id']===_0x543926[_0xd073('0x7b')]&&_0x3e37b9[_0xd073('0x2f')]===_0xd073('0x7c');});break;case'custom':_0x3a2516=_[_0xd073('0x49')](_0x57c1ac[_0xd073('0x79')],function(_0x2d8da3){return _0x2d8da3['id']===_0x543926[_0xd073('0x7b')]&&_0x2d8da3['type']==='CustomReports';});break;}if(_0x3a2516)_0x5e7a5d[_0xd073('0x5d')](_0x543926);});_0x16e1f9[_0xd073('0x1f')]=_0x5e7a5d[_0xd073('0x48')];_0x16e1f9[_0xd073('0x45')]=_0x5e7a5d;return _0x16e1f9;});}else{return db[_0x5906a0[_0xd073('0x6f')]]['count']({'where':_0x2194ea[_0xd073('0x3c')]})['then'](function(_0xcab1fe){_0x16e1f9[_0xd073('0x1f')]=_0xcab1fe;if(_0x18fb46[_0xd073('0x33')][_0xd073('0x42')]){if(_0x5906a0['childModel']===_0xd073('0x7d')){_0x2194ea['include']=[{'model':db['Tag'],'as':_0xd073('0x7e'),'attributes':['id',_0xd073('0x29'),_0xd073('0x7f')],'required':_0x18fb46['query'][_0xd073('0x80')]?!![]:![]},{'model':db[_0xd073('0x81')],'as':_0xd073('0x82'),'attributes':['id',_0xd073('0x29'),_0xd073('0x7f')],'through':_0x18fb46['query'][_0xd073('0x80')]?{'attributes':[],'where':{'TagId':_0x18fb46[_0xd073('0x33')][_0xd073('0x80')]||undefined}}:{},'required':_0x18fb46['query'][_0xd073('0x80')]?!![]:![]}];}else{_0x2194ea[_0xd073('0x43')]=[{'all':!![]}];}}return db[_0x5906a0[_0xd073('0x6f')]][_0xd073('0x44')](_0x2194ea);})[_0xd073('0x41')](function(_0x33fa10){_0x16e1f9['rows']=_0x33fa10;return _0x16e1f9;});}}else{return _0x16e1f9;}})[_0xd073('0x41')](respondWithFilteredResult(_0x4be6af,_0x2194ea))['catch'](handleError(_0x4be6af,null));};function getAllResources(_0x4f220b,_0x38772f){return new BPromise(function(_0x593554,_0x193b8d){if(_0x38772f){var _0x1d9c53=_0x38772f[_0xd073('0x3e')]?{[_0x38772f['filter']['field']]:_0x38772f[_0xd073('0x3e')][_0xd073('0x83')]}:undefined;return db[_0x4f220b][_0xd073('0x44')]({'where':_0x1d9c53,'raw':!![]})[_0xd073('0x41')](function(_0x1b5929){_0x38772f['associatedResources']=_[_0xd073('0x32')](_0x1b5929,'id');_0x593554(_0x38772f);})[_0xd073('0x46')](function(_0x495407){_0x193b8d(_0x495407);});}else{_0x593554(null);}});}function getAllFilteredResources(_0x629ee7,_0x39e09c){return new BPromise(function(_0x23aae2,_0x5834e7){var _0x5ddc09=_0x629ee7[_0xd073('0x3e')]?{[_0x629ee7[_0xd073('0x3e')][_0xd073('0x76')]]:_0x629ee7['filter'][_0xd073('0x83')]}:undefined;return db[_0x629ee7['model']][_0xd073('0x44')]({'where':_0x5ddc09,'raw':!![]})[_0xd073('0x41')](function(_0x29d639){_0x39e09c['associatedResources']=_[_0xd073('0x32')](_0x29d639,function(_0x256bbc){return _0x256bbc[_0xd073('0x29')];});_0x23aae2(_0x39e09c);})[_0xd073('0x46')](function(_0x496b46){_0x5834e7(_0x496b46);});});}function getAllowedResources(_0x1a70ae,_0x328670,_0x5124b9){return new BPromise(function(_0x424b41,_0x18c248){if(_0x328670){return db[_0xd073('0x5c')][_0xd073('0x44')]({'where':{'sectionId':_0x328670['id']},'raw':!![]})[_0xd073('0x41')](function(_0x5679d2){if(_0x1a70ae[_0xd073('0x76')]&&_0x1a70ae['field']!=='id'){_0x328670[_0xd073('0x79')]=_[_0xd073('0x32')](_0x5679d2,function(_0x497674){return _0x497674[_0x1a70ae[_0xd073('0x76')]];});}else{if(_0x5124b9===_0xd073('0x77')){_0x328670[_0xd073('0x79')]=_['map'](_0x5679d2,function(_0x53d461){return{'id':_0x53d461[_0xd073('0x69')],'type':_0x53d461[_0xd073('0x2f')]};});}else{_0x328670['associatedResources']=_[_0xd073('0x32')](_0x5679d2,function(_0x3d7ff5){return _0x3d7ff5[_0xd073('0x69')];});}}_0x424b41(_0x328670);})['catch'](function(_0x2fe795){_0x18c248(_0x2fe795);});}else{_0x424b41(null);}});}function getQueryModels(_0x3a5d7b,_0x127a8b){var _0x5110ff=_0x3a5d7b['toLowerCase']();var _0x2b5d14={'childModel':undefined,'parentSections':[]};switch(_0x5110ff){case'squareprojects':_0x2b5d14['childModel']=_0xd073('0x84');break;case'odbc':_0x2b5d14[_0xd073('0x6f')]=_0xd073('0x85');break;case _0xd073('0x86'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0x87');_0x2b5d14['parentSections']=[{'name':_0xd073('0x88'),'field':_0xd073('0x29'),'foreignKey':'projectName'}];break;case _0xd073('0x89'):_0x2b5d14['childModel']=_0xd073('0x8a');break;case _0xd073('0x8b'):_0x2b5d14[_0xd073('0x6f')]='CmContact';_0x2b5d14[_0xd073('0x71')]=[{'name':_0xd073('0x8c'),'field':'id','foreignKey':_0xd073('0x8d')}];break;case _0xd073('0x8e'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0x8f');break;case _0xd073('0x90'):_0x2b5d14[_0xd073('0x6f')]='CmCompany';break;case _0xd073('0x91'):_0x2b5d14[_0xd073('0x6f')]='CmCustomField';break;case _0xd073('0x92'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0x93');break;case _0xd073('0x94'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0x95');break;case _0xd073('0x96'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0x97');break;case _0xd073('0x98'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0x99');break;case _0xd073('0x9a'):case _0xd073('0x9b'):case'outboundroutes':_0x2b5d14[_0xd073('0x6f')]='VoiceExtension';break;case _0xd073('0x9c'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0x9d');break;case'voicemails':_0x2b5d14[_0xd073('0x6f')]=_0xd073('0x9e');break;case _0xd073('0x9f'):_0x2b5d14[_0xd073('0x6f')]='VoiceRecording';_0x2b5d14[_0xd073('0x71')]=[{'name':_0xd073('0xa0'),'field':_0xd073('0x29'),'foreignKey':'membername','model':'User','filter':{'field':_0xd073('0xa1'),'value':[_0xd073('0xa2')]}},{'name':_0xd073('0xa3'),'field':_0xd073('0x29'),'foreignKey':_0xd073('0xa4'),'model':'User','filter':{'field':_0xd073('0xa1'),'value':[_0xd073('0xa5')]}},{'name':_0xd073('0xa6'),'field':_0xd073('0x29'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0xd073('0x2f'),'value':[_0xd073('0xa7')]}},{'name':_0xd073('0xa8'),'field':_0xd073('0x29'),'foreignKey':_0xd073('0xa9'),'model':_0xd073('0xaa'),'filter':{'field':_0xd073('0x2f'),'value':['outbound']}}];break;case'musiconholds':_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xab');break;case _0xd073('0xac'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xad');break;case _0xd073('0xae'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xaf');break;case'ivrcampaigns':_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xb0');break;case'mailqueues':_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xb1');break;case _0xd073('0xb2'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xb3');break;case _0xd073('0xb4'):_0x2b5d14['childModel']=_0xd073('0xb5');break;case _0xd073('0xb6'):_0x2b5d14['childModel']='OpenchannelQueue';break;case _0xd073('0xb7'):_0x2b5d14['childModel']=_0xd073('0xb8');break;case _0xd073('0xb9'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xba');break;case'smsaccounts':_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xbb');break;case _0xd073('0xbc'):_0x2b5d14['childModel']=_0xd073('0xbd');break;case _0xd073('0xbe'):case _0xd073('0xbf'):_0x2b5d14[_0xd073('0x6f')]='VoiceQueue';if(_0x127a8b){_0x2b5d14['parentSections']=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0xd073('0xc0'):case _0xd073('0xc1'):case _0xd073('0xc2'):_0x2b5d14['childModel']=_0xd073('0xc3');if(_0x127a8b){_0x2b5d14[_0xd073('0x71')]=[{'name':'Users','filter':{'field':'role','value':[_0xd073('0xc4'),'user']},'ignore':!![]},{'name':_0xd073('0xa0')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x2b5d14['childModel']='ZendeskAccount';break;case _0xd073('0xc5'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xc6');break;case _0xd073('0xc7'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xc8');break;case _0xd073('0xc9'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xca');break;case'deskaccounts':_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xcb');break;case'zohoaccounts':_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xcc');break;case _0xd073('0xcd'):_0x2b5d14[_0xd073('0x6f')]='User';break;case _0xd073('0xce'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xcf');break;case _0xd073('0xd0'):_0x2b5d14[_0xd073('0x6f')]='Disposition';break;case'customdashboards':_0x2b5d14['childModel']=_0xd073('0x66');break;case _0xd073('0xd1'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xd2');break;case _0xd073('0xd3'):_0x2b5d14['childModel']='Pause';break;case _0xd073('0xd4'):_0x2b5d14['childModel']=_0xd073('0xd5');break;case _0xd073('0xd6'):_0x2b5d14[_0xd073('0x6f')]='Sound';break;case _0xd073('0xd7'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0x81');break;case'templates':_0x2b5d14[_0xd073('0x6f')]='Template';break;case'triggers':_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xd8');break;case _0xd073('0xd9'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xda');break;case _0xd073('0xdb'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0xdc');break;case _0xd073('0xdd'):_0x2b5d14[_0xd073('0x6f')]=_0xd073('0x67');break;case _0xd073('0xde'):_0x2b5d14['childModel']=_0xd073('0x77');_0x2b5d14['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0xd073('0x7b')}];break;case _0xd073('0xdf'):_0x2b5d14[_0xd073('0x6f')]='AnalyticMetric';break;default:return _0x2b5d14;}return _0x2b5d14;} \ No newline at end of file +var _0x7bd2=['omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','destroy','describe','addSections','removeSections','getSections','enabled','includes','subsections','findOne','Dashboard','forEach','push','resourceId','addResources','bulkCreate','removeResources','getResources','undefined','Sequelize','ValidationError','Unknown\x20section','childModel','isEmpty','parentSections','all','ignore','union','hasOwnProperty','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','custom','CmContact','Tag','Tags','color','ThroughTags','tag','value','squareprojects','SquareProject','squarerecordings','SquareRecording','SquareProjects','projectName','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCompany','ChatQueue','chatwebsites','faxqueues','faxaccounts','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','Agents','membername','role','agent','Telephones','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','ivrcampaigns','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','User','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Interval','pauses','Pause','scheduler','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','variables','Variable','Plugin','extractedreports','Reports','metrics','AnalyticMetric','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','update','then','error','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','length','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','UserProfile','count','findAll','rows','show','params','includeAll','include','options','find','catch','create','body','clone','get'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x7bd2,0x17b));var _0x27bd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7bd2[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x27bd('0x0'));var zipdir=require(_0x27bd('0x1'));var jsonpatch=require(_0x27bd('0x2'));var rp=require(_0x27bd('0x3'));var moment=require(_0x27bd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x27bd('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x27bd('0x6'));var ejs=require(_0x27bd('0x7'));var fs=require('fs');var _=require(_0x27bd('0x8'));var squel=require(_0x27bd('0x9'));var crypto=require(_0x27bd('0xa'));var jsforce=require(_0x27bd('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x27bd('0xc'));var Papa=require(_0x27bd('0xd'));var Redis=require(_0x27bd('0xe'));var authService=require(_0x27bd('0xf'));var qs=require(_0x27bd('0x10'));var as=require(_0x27bd('0x11'));var hardwareService=require(_0x27bd('0x12'));var logger=require(_0x27bd('0x13'))(_0x27bd('0x14'));var utils=require(_0x27bd('0x15'));var config=require(_0x27bd('0x16'));var db=require(_0x27bd('0x17'))['db'];config[_0x27bd('0x18')]=_[_0x27bd('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x27bd('0x1a'))(new Redis(config['redis']));require(_0x27bd('0x1b'))[_0x27bd('0x1c')](socket);function respondWithStatusCode(_0x19b4cf,_0x407a60){_0x407a60=_0x407a60||0xcc;return function(_0x3b418b){if(_0x3b418b){return _0x19b4cf[_0x27bd('0x1d')](_0x407a60);}return _0x19b4cf['status'](_0x407a60)[_0x27bd('0x1e')]();};}function respondWithResult(_0x4ec8db,_0x1e3384){_0x1e3384=_0x1e3384||0xc8;return function(_0x9937f9){if(_0x9937f9){return _0x4ec8db[_0x27bd('0x1f')](_0x1e3384)[_0x27bd('0x20')](_0x9937f9);}};}function respondWithFilteredResult(_0x2f1d2c,_0x43ff64){return function(_0x33ba59){if(_0x33ba59){var _0x59ee3a=_0x33ba59['count'],_0x359fe5=_0x43ff64['offset'],_0xf9fbee=_0x43ff64[_0x27bd('0x21')]+_0x43ff64[_0x27bd('0x22')],_0x340fbe;if(_0xf9fbee>=_0x59ee3a){_0xf9fbee=_0x59ee3a;_0x340fbe=0xc8;}else{_0x340fbe=0xce;}_0x2f1d2c['status'](_0x340fbe);return _0x2f1d2c[_0x27bd('0x23')](_0x27bd('0x24'),_0x359fe5+'-'+_0xf9fbee+'/'+_0x59ee3a)[_0x27bd('0x20')](_0x33ba59);}return null;};}function patchUpdates(_0x3354fa){return function(_0x38698a){try{jsonpatch[_0x27bd('0x25')](_0x38698a,_0x3354fa,!![]);}catch(_0x426270){return BPromise['reject'](_0x426270);}return _0x38698a[_0x27bd('0x26')]();};}function saveUpdates(_0x13a9eb,_0x2d257d){return function(_0x4c8bae){if(_0x4c8bae){return _0x4c8bae[_0x27bd('0x27')](_0x13a9eb)[_0x27bd('0x28')](function(_0x1de87e){return _0x1de87e;});}return null;};}function removeEntity(_0x4109f0,_0x32c66a){return function(_0x1b7344){if(_0x1b7344){return _0x1b7344['destroy']()[_0x27bd('0x28')](function(){_0x4109f0['status'](0xcc)[_0x27bd('0x1e')]();});}};}function handleEntityNotFound(_0x80d1ab,_0x91ca82){return function(_0x28c5e3){if(!_0x28c5e3){_0x80d1ab[_0x27bd('0x1d')](0x194);}return _0x28c5e3;};}function handleError(_0x5826ac,_0x4535a9){_0x4535a9=_0x4535a9||0x1f4;return function(_0x4e3afb){logger[_0x27bd('0x29')](_0x4e3afb['stack']);if(_0x4e3afb[_0x27bd('0x2a')]){delete _0x4e3afb[_0x27bd('0x2a')];}_0x5826ac[_0x27bd('0x1f')](_0x4535a9)[_0x27bd('0x2b')](_0x4e3afb);};}exports['index']=function(_0x289f8c,_0x272ef3){var _0x356287={},_0x48070a={},_0x5798f9={'count':0x0,'rows':[]};var _0x36d03c=_[_0x27bd('0x2c')](db['UserProfile'][_0x27bd('0x2d')],function(_0x37b2d7){return{'name':_0x37b2d7[_0x27bd('0x2e')],'type':_0x37b2d7[_0x27bd('0x2f')][_0x27bd('0x30')]};});_0x48070a['model']=_[_0x27bd('0x2c')](_0x36d03c,_0x27bd('0x2a'));_0x48070a[_0x27bd('0x31')]=_[_0x27bd('0x32')](_0x289f8c[_0x27bd('0x31')]);_0x48070a[_0x27bd('0x33')]=_[_0x27bd('0x34')](_0x48070a[_0x27bd('0x35')],_0x48070a['query']);_0x356287['attributes']=_[_0x27bd('0x34')](_0x48070a['model'],qs[_0x27bd('0x36')](_0x289f8c['query'][_0x27bd('0x36')]));_0x356287['attributes']=_0x356287['attributes'][_0x27bd('0x37')]?_0x356287[_0x27bd('0x38')]:_0x48070a[_0x27bd('0x35')];if(!_0x289f8c[_0x27bd('0x31')]['hasOwnProperty'](_0x27bd('0x39'))){_0x356287[_0x27bd('0x22')]=qs[_0x27bd('0x22')](_0x289f8c['query'][_0x27bd('0x22')]);_0x356287['offset']=qs['offset'](_0x289f8c[_0x27bd('0x31')][_0x27bd('0x21')]);}_0x356287['order']=qs[_0x27bd('0x3a')](_0x289f8c[_0x27bd('0x31')][_0x27bd('0x3a')]);_0x356287[_0x27bd('0x3b')]=qs[_0x27bd('0x33')](_[_0x27bd('0x3c')](_0x289f8c[_0x27bd('0x31')],_0x48070a[_0x27bd('0x33')]));if(_0x289f8c[_0x27bd('0x31')][_0x27bd('0x3d')]){_0x356287[_0x27bd('0x3b')]=_[_0x27bd('0x3e')](_0x356287[_0x27bd('0x3b')],{'$or':_[_0x27bd('0x2c')](_0x36d03c,function(_0x4434eb){if(_0x4434eb[_0x27bd('0x2f')]!==_0x27bd('0x3f')){var _0x17940c={};_0x17940c[_0x4434eb[_0x27bd('0x2a')]]={'$like':'%'+_0x289f8c[_0x27bd('0x31')]['filter']+'%'};return _0x17940c;}})});}_0x356287=_['merge']({},_0x356287,_0x289f8c['options']);var _0x5d1da8={'where':_0x356287[_0x27bd('0x3b')]};return db[_0x27bd('0x40')][_0x27bd('0x41')](_0x5d1da8)[_0x27bd('0x28')](function(_0x33a1fc){_0x5798f9['count']=_0x33a1fc;if(_0x289f8c['query']['includeAll']){_0x356287['include']=[{'all':!![]}];}return db[_0x27bd('0x40')][_0x27bd('0x42')](_0x356287);})[_0x27bd('0x28')](function(_0x3f77ab){_0x5798f9[_0x27bd('0x43')]=_0x3f77ab;return _0x5798f9;})[_0x27bd('0x28')](respondWithFilteredResult(_0x272ef3,_0x356287))['catch'](handleError(_0x272ef3,null));};exports[_0x27bd('0x44')]=function(_0x4b48a1,_0x5577ea){var _0x459c37={'raw':![],'where':{'id':_0x4b48a1[_0x27bd('0x45')]['id']}},_0x221dc5={};_0x221dc5[_0x27bd('0x35')]=_[_0x27bd('0x32')](db['UserProfile'][_0x27bd('0x2d')]);_0x221dc5[_0x27bd('0x31')]=_['keys'](_0x4b48a1[_0x27bd('0x31')]);_0x221dc5[_0x27bd('0x33')]=_[_0x27bd('0x34')](_0x221dc5['model'],_0x221dc5[_0x27bd('0x31')]);_0x459c37[_0x27bd('0x38')]=_[_0x27bd('0x34')](_0x221dc5[_0x27bd('0x35')],qs[_0x27bd('0x36')](_0x4b48a1[_0x27bd('0x31')][_0x27bd('0x36')]));_0x459c37[_0x27bd('0x38')]=_0x459c37[_0x27bd('0x38')]['length']?_0x459c37[_0x27bd('0x38')]:_0x221dc5['model'];if(_0x4b48a1[_0x27bd('0x31')][_0x27bd('0x46')]){_0x459c37[_0x27bd('0x47')]=[{'all':!![]}];}_0x459c37=_['merge']({},_0x459c37,_0x4b48a1[_0x27bd('0x48')]);return db[_0x27bd('0x40')][_0x27bd('0x49')](_0x459c37)[_0x27bd('0x28')](handleEntityNotFound(_0x5577ea,null))[_0x27bd('0x28')](respondWithResult(_0x5577ea,null))[_0x27bd('0x4a')](handleError(_0x5577ea,null));};exports[_0x27bd('0x4b')]=function(_0x737578,_0x7c9ecd){return db[_0x27bd('0x40')]['create'](_0x737578[_0x27bd('0x4c')],{})['then'](respondWithResult(_0x7c9ecd,0xc9))[_0x27bd('0x4a')](handleError(_0x7c9ecd,null));};exports[_0x27bd('0x4d')]=function(_0x4f829b,_0x2bf602){var _0x2fd500={'where':{'id':_0x4f829b['params']['id']}},_0x39eea9={};_0x39eea9[_0x27bd('0x35')]=_[_0x27bd('0x32')](db[_0x27bd('0x40')][_0x27bd('0x2d')]);_0x2fd500['attributes']=_[_0x27bd('0x34')](_0x39eea9[_0x27bd('0x35')],qs[_0x27bd('0x36')](_0x4f829b[_0x27bd('0x31')][_0x27bd('0x36')]));_0x2fd500[_0x27bd('0x38')]=_0x2fd500[_0x27bd('0x38')]['length']?_0x2fd500[_0x27bd('0x38')]:_0x39eea9[_0x27bd('0x35')];if(_0x4f829b['query'][_0x27bd('0x46')]){_0x2fd500[_0x27bd('0x47')]=[{'all':!![]}];}_0x2fd500=_[_0x27bd('0x3e')]({},_0x2fd500,_0x4f829b[_0x27bd('0x48')]);return db[_0x27bd('0x40')][_0x27bd('0x49')](_0x2fd500)['then'](handleEntityNotFound(_0x2bf602,null))['then'](function(_0x45ce7c){if(_0x45ce7c){var _0x27c0a9=_0x45ce7c[_0x27bd('0x4e')]({'plain':!![]});_0x27c0a9=qs[_0x27bd('0x4f')](_0x27c0a9,['id',_0x27bd('0x50'),_0x27bd('0x51'),_0x27bd('0x52')]);_0x4f829b['body']=_['omit'](_0x4f829b['body'],['id',_0x27bd('0x50'),_0x27bd('0x51')]);return db[_0x27bd('0x53')][_0x27bd('0x54')](function(_0x4e1cdf){return db['UserProfile'][_0x27bd('0x4b')](_[_0x27bd('0x3e')](_0x27c0a9,_0x4f829b[_0x27bd('0x4c')]),{'include':_0x4f829b[_0x27bd('0x31')][_0x27bd('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x4e1cdf})[_0x27bd('0x28')](function(_0x5d94a1){var _0x4c30a2=_0x5d94a1['get']({'plain':!![]});return db['UserProfileSection'][_0x27bd('0x42')]({'where':{'userProfileId':_0x4f829b[_0x27bd('0x45')]['id']},'raw':!![]})[_0x27bd('0x28')](function(_0x7b856e){if(_0x7b856e){return BPromise[_0x27bd('0x55')](_0x7b856e,function(_0x3d9320){return new BPromise(function(_0x122c99,_0x3ce7f1){if(_0x3d9320[_0x27bd('0x56')]===null||_0x3d9320[_0x27bd('0x56')]===0x1)_0x122c99(null);return db[_0x27bd('0x57')][_0x27bd('0x42')]({'where':{'sectionId':_0x3d9320['id']},'raw':!![]})['then'](function(_0x57e111){var _0x5bef60=_[_0x27bd('0x2c')](_0x57e111,function(_0x5112f1){return qs[_0x27bd('0x4f')](_0x5112f1,['id',_0x27bd('0x50'),'updatedAt',_0x27bd('0x58')]);});_0x122c99(_0x5bef60);})[_0x27bd('0x4a')](function(_0x9f2ca6){_0x3ce7f1(_0x9f2ca6);});})[_0x27bd('0x28')](function(_0x5ef8e9){var _0x4a6798=qs[_0x27bd('0x4f')](_0x3d9320,['id',_0x27bd('0x50'),_0x27bd('0x51')]);_0x4a6798[_0x27bd('0x59')]=_0x4c30a2['id'];if(_0x5ef8e9)_0x4a6798[_0x27bd('0x5a')]=_0x5ef8e9;return _0x4a6798;})[_0x27bd('0x28')](function(_0x1ffe16){return db[_0x27bd('0x5b')][_0x27bd('0x4b')](_0x1ffe16,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x4e1cdf});});})['then'](function(){return _0x4c30a2;});}});});});}})[_0x27bd('0x28')](respondWithResult(_0x2bf602,0xc9))[_0x27bd('0x4a')](handleError(_0x2bf602,null));};exports['update']=function(_0x19a7fa,_0x2075aa){if(_0x19a7fa['body']['id']){delete _0x19a7fa[_0x27bd('0x4c')]['id'];}return db['UserProfile'][_0x27bd('0x49')]({'where':{'id':_0x19a7fa['params']['id']}})[_0x27bd('0x28')](handleEntityNotFound(_0x2075aa,null))[_0x27bd('0x28')](saveUpdates(_0x19a7fa[_0x27bd('0x4c')],null))['then'](respondWithResult(_0x2075aa,null))[_0x27bd('0x4a')](handleError(_0x2075aa,null));};exports[_0x27bd('0x5c')]=function(_0x3c6047,_0x518e66){return db[_0x27bd('0x40')][_0x27bd('0x49')]({'where':{'id':_0x3c6047[_0x27bd('0x45')]['id']}})['then'](handleEntityNotFound(_0x518e66,null))['then'](removeEntity(_0x518e66,null))[_0x27bd('0x4a')](handleError(_0x518e66,null));};exports['describe']=function(_0x3f6a31,_0x18ebdf){return db[_0x27bd('0x40')][_0x27bd('0x5d')]()[_0x27bd('0x28')](respondWithResult(_0x18ebdf,null))[_0x27bd('0x4a')](handleError(_0x18ebdf,null));};exports[_0x27bd('0x5e')]=function(_0x41ce71,_0x30e736){var _0x209d23=_0x41ce71[_0x27bd('0x4c')];return db[_0x27bd('0x40')]['find']({'where':{'id':_0x41ce71[_0x27bd('0x45')]['id']}})[_0x27bd('0x28')](handleEntityNotFound(_0x30e736,null))[_0x27bd('0x28')](function(_0x456499){if(_0x456499){return db[_0x27bd('0x53')][_0x27bd('0x54')](function(_0x53e8dd){return db['UserProfileSection'][_0x27bd('0x5c')]({'where':{'userProfileId':_0x41ce71['params']['id'],'sectionId':_['map'](_0x209d23,function(_0xe8f7ba){return _0xe8f7ba[_0x27bd('0x58')];})},'transaction':_0x53e8dd})['then'](function(){var _0x401419=_[_0x27bd('0x2c')](_0x209d23,function(_0x15e84d){_0x15e84d[_0x27bd('0x59')]=_0x41ce71[_0x27bd('0x45')]['id'];return _0x15e84d;});var _0x14b9ff=[];return BPromise[_0x27bd('0x55')](_0x401419,function(_0x16d0ca){return db[_0x27bd('0x5b')]['create'](_0x16d0ca,{'include':[{'model':db[_0x27bd('0x57')],'as':_0x27bd('0x5a')}],'raw':!![],'transaction':_0x53e8dd})[_0x27bd('0x28')](function(_0x2ae0b7){_0x14b9ff['push'](_0x2ae0b7[_0x27bd('0x4e')]({'plain':!![]}));});})[_0x27bd('0x28')](function(){return _0x14b9ff;});});});}})[_0x27bd('0x28')](function(_0x34b920){return _0x34b920;})[_0x27bd('0x28')](respondWithResult(_0x30e736,null))[_0x27bd('0x4a')](handleError(_0x30e736,null));};exports[_0x27bd('0x5f')]=function(_0x56797a,_0x236f7a){var _0x2a5f95;return db[_0x27bd('0x40')][_0x27bd('0x49')]({'where':{'id':_0x56797a[_0x27bd('0x45')]['id']},'attributes':['id',_0x27bd('0x2a')]})[_0x27bd('0x28')](handleEntityNotFound(_0x236f7a,null))['then'](function(_0x4d0470){if(_0x4d0470){_0x2a5f95=_0x4d0470;return db[_0x27bd('0x5b')][_0x27bd('0x5c')]({'where':{'userProfileId':_0x56797a['params']['id'],'sectionId':_0x56797a['query']['ids']}});}})['then'](function(){return _0x2a5f95;})[_0x27bd('0x28')](respondWithStatusCode(_0x236f7a,null))[_0x27bd('0x4a')](handleError(_0x236f7a,null));};exports[_0x27bd('0x60')]=function(_0x3ca383,_0x114b73){var _0x4cd1e5=[];var _0x14bec6=[];return db[_0x27bd('0x5b')][_0x27bd('0x42')]({'where':{'userProfileId':_0x3ca383[_0x27bd('0x45')]['id']},'raw':!![]})[_0x27bd('0x28')](function(_0x213b77){_0x4cd1e5=_[_0x27bd('0x3d')](_0x213b77,function(_0x4fdf17){return _0x4fdf17[_0x27bd('0x61')]===0x1||_[_0x27bd('0x62')]([0x3eb,0x709],_0x4fdf17['sectionId']);});if(!_['isEmpty'](_0x4cd1e5)){return _[_0x27bd('0x2c')](_0x4cd1e5,function(_0x3caace){return _0x3caace[_0x27bd('0x58')];});}else{return;}})[_0x27bd('0x28')](function(_0x5313a3){if(_0x5313a3)_0x14bec6=_0x5313a3;if(_[_0x27bd('0x62')](_0x14bec6,0x64)){var _0x35f3db=_[_0x27bd('0x49')](_0x4cd1e5,{'sectionId':0x64});return hasDefaultDashboard(_0x35f3db)[_0x27bd('0x28')](function(_0x46463f){return _[_0x27bd('0x2c')](_0x4cd1e5,function(_0xba7c46){if(_0xba7c46[_0x27bd('0x58')]===0x64){_0xba7c46['subsections']=_0x46463f;}return _0xba7c46;});});}else{return;}})['then'](function(_0x2f3c0e){if(_0x2f3c0e)_0x4cd1e5=_0x2f3c0e;if(_[_0x27bd('0x62')](_0x14bec6,0x3eb)){var _0x113436=_[_0x27bd('0x49')](_0x4cd1e5,{'sectionId':0x3eb});return getCustomDashboards(_0x113436)['then'](function(_0x3f5141){return _[_0x27bd('0x2c')](_0x4cd1e5,function(_0x33f707){if(_0x113436[_0x27bd('0x61')]){if(_0x33f707[_0x27bd('0x58')]===0x3eb){_0x33f707[_0x27bd('0x63')]=_0x3f5141;}}else{if(_0x33f707[_0x27bd('0x58')]===0x64){_0x33f707['subsections']=_0x3f5141;}}return _0x33f707;});});}else{return;}})[_0x27bd('0x28')](function(_0x12f81d){if(_0x12f81d)_0x4cd1e5=_0x12f81d;if(_['includes'](_0x14bec6,0x709)){var _0x2fd09b=_[_0x27bd('0x49')](_0x4cd1e5,{'sectionId':0x709});return getPlugins(_0x2fd09b)[_0x27bd('0x28')](function(_0x1ca223){if(_0x2fd09b[_0x27bd('0x61')]){return _[_0x27bd('0x2c')](_0x4cd1e5,function(_0x5576a0){if(_0x5576a0[_0x27bd('0x58')]===0x709){_0x5576a0[_0x27bd('0x63')]=_0x1ca223;}return _0x5576a0;});}else{var _0x47fd3b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1ca223};var _0x28f39d=_[_0x27bd('0x2c')](_0x4cd1e5);_0x28f39d['push'](_0x47fd3b);return _0x28f39d;}});}else{return;}})[_0x27bd('0x28')](function(_0x292ea4){if(_0x292ea4)_0x4cd1e5=_0x292ea4;return _[_0x27bd('0x3d')](_0x4cd1e5,[_0x27bd('0x61'),0x1]);})[_0x27bd('0x28')](respondWithResult(_0x114b73,null))['catch'](handleError(_0x114b73,null));};function hasDefaultDashboard(_0x1a350e){var _0x2daa46=[0x65];return new BPromise(function(_0x426ce2,_0x54b9ff){try{if(_0x1a350e[_0x27bd('0x56')]){_0x426ce2(_0x2daa46);}else{return db[_0x27bd('0x57')][_0x27bd('0x64')]({'where':{'sectionId':_0x1a350e['id']},'raw':!![]})[_0x27bd('0x28')](function(_0x1bd167){_0x1bd167?_0x426ce2(_0x2daa46):_0x426ce2();});}}catch(_0x1c4f77){_0x54b9ff(_0x1c4f77);}});}function getCustomDashboards(_0x587460){var _0x45e927=[];return new BPromise(function(_0x108441,_0x35afc5){try{if(_0x587460[_0x27bd('0x56')]){return db[_0x27bd('0x65')][_0x27bd('0x42')]({'raw':!![]})[_0x27bd('0x28')](function(_0x3616be){_0x3616be[_0x27bd('0x66')](function(_0x5553b7){_0x45e927[_0x27bd('0x67')](_0x5553b7['id']+0x1869f);});_0x108441(_0x45e927);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x587460['id']},'raw':!![]})[_0x27bd('0x28')](function(_0x21fb63){_0x21fb63[_0x27bd('0x66')](function(_0x50fcb0){_0x45e927[_0x27bd('0x67')](_0x50fcb0[_0x27bd('0x68')]+0x1869f);});_0x108441(_0x45e927);});}}catch(_0x2c54e6){_0x35afc5(_0x2c54e6);}});}function getPlugins(_0x767b99){var _0x13bac3=[];return new BPromise(function(_0x54b6be,_0x535782){try{if(_0x767b99[_0x27bd('0x56')]){return db['Plugin'][_0x27bd('0x42')]({'raw':!![]})['then'](function(_0x449cf5){_0x449cf5[_0x27bd('0x66')](function(_0xef010d){_0x13bac3['push'](_0xef010d['id']+0x15b38);});_0x54b6be(_0x13bac3);});}else{return db[_0x27bd('0x57')]['findAll']({'where':{'sectionId':_0x767b99['id']},'raw':!![]})[_0x27bd('0x28')](function(_0x5805fa){_0x5805fa['forEach'](function(_0x5cd135){_0x13bac3[_0x27bd('0x67')](_0x5cd135[_0x27bd('0x68')]+0x15b38);});_0x54b6be(_0x13bac3);});}}catch(_0x1d5cf0){_0x535782(_0x1d5cf0);}});}exports[_0x27bd('0x69')]=function(_0x3ce1d2,_0x37fbfb){return db[_0x27bd('0x40')]['find']({'where':{'id':_0x3ce1d2[_0x27bd('0x45')]['id']}})[_0x27bd('0x28')](handleEntityNotFound(_0x37fbfb,null))['then'](function(_0x372845){if(_0x372845){return db[_0x27bd('0x53')]['transaction'](function(_0x2a2de6){return db[_0x27bd('0x5b')]['findAll']({'where':{'userProfileId':_0x3ce1d2[_0x27bd('0x45')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x41ac91){if(_0x41ac91){return db[_0x27bd('0x5b')][_0x27bd('0x5c')]({'where':{'userProfileId':_0x3ce1d2[_0x27bd('0x45')]['id'],'id':_[_0x27bd('0x2c')](_0x41ac91,function(_0x26c146){return _0x26c146['id'];})},'transaction':_0x2a2de6});}})[_0x27bd('0x28')](function(_0x10fd74){var _0x27496c=_[_0x27bd('0x2c')](_0x3ce1d2[_0x27bd('0x4c')],function(_0x52a337){_0x52a337[_0x27bd('0x59')]=_0x3ce1d2[_0x27bd('0x45')]['id'];return _0x52a337;});return db[_0x27bd('0x5b')]['bulkCreate'](_0x27496c,{'raw':!![],'transaction':_0x2a2de6});})[_0x27bd('0x28')](function(_0x352585){var _0x3ebd0b=_['filter'](_[_0x27bd('0x2c')](_0x352585,function(_0x133a05){return _0x133a05['get']({'plain':!![]});}),{'includeAll':![]});if(_0x3ebd0b){return db[_0x27bd('0x5b')][_0x27bd('0x42')]({'where':{'userProfileId':_0x3ce1d2[_0x27bd('0x45')]['id'],'sectionId':_[_0x27bd('0x2c')](_0x3ebd0b,function(_0x209401){return _0x209401['sectionId'];})},'attributes':['id',_0x27bd('0x58')],'raw':!![]})['then'](function(_0x3cb518){var _0x36def3=_[_0x27bd('0x2c')](_0x3ce1d2[_0x27bd('0x4c')],function(_0x3dda9c){_0x3dda9c[_0x27bd('0x59')]=_0x3ce1d2[_0x27bd('0x45')]['id'];return _0x3dda9c;});return db[_0x27bd('0x57')][_0x27bd('0x6a')](_0x36def3,{'raw':!![],'transaction':_0x2a2de6});});}})[_0x27bd('0x4a')](handleError(_0x37fbfb,null));});}})[_0x27bd('0x28')](function(_0x57ea7d){var _0x50c87a=_[_0x27bd('0x2c')](_0x57ea7d,function(_0x83f3ce){return _0x83f3ce[_0x27bd('0x4e')]({'plain':!![]});});})[_0x27bd('0x28')](respondWithResult(_0x37fbfb,null))[_0x27bd('0x4a')](handleError(_0x37fbfb,null));};exports[_0x27bd('0x6b')]=function(_0x4be4aa,_0x52d3f4,_0x2c476e){return db[_0x27bd('0x40')]['find']({'where':{'id':_0x4be4aa[_0x27bd('0x45')]['id']}})[_0x27bd('0x28')](handleEntityNotFound(_0x52d3f4,null))[_0x27bd('0x28')](function(_0x312726){if(_0x312726){return _0x312726[_0x27bd('0x6b')](_0x4be4aa[_0x27bd('0x31')]['ids']);}})[_0x27bd('0x28')](respondWithStatusCode(_0x52d3f4,null))['catch'](handleError(_0x52d3f4,null));};exports[_0x27bd('0x6c')]=function(_0x5641ea,_0x2a5ec7){var _0x1bfc6d={'raw':![],'where':{}};var _0x2679a5={};var _0x270f94={'count':0x0,'rows':[]};var _0x5947bb=_0x5641ea['query']['section'];if(typeof _0x5947bb===_0x27bd('0x6d')){throw new db[(_0x27bd('0x6e'))][(_0x27bd('0x6f'))](_0x27bd('0x70'));}var _0xad7641=_0x5641ea[_0x27bd('0x31')]['mergeResources']||![];var _0x4a4c33=getQueryModels(_0x5947bb,_0xad7641);if(typeof _0x4a4c33[_0x27bd('0x71')]===_0x27bd('0x6d')){throw new db['Sequelize'][(_0x27bd('0x6f'))]('Invalid\x20section\x20\x27'+_0x5947bb+'\x27');}var _0x56afb5=[];if(!_[_0x27bd('0x72')](_0x4a4c33[_0x27bd('0x73')])){_0x56afb5=_0x4a4c33[_0x27bd('0x73')];}else{_0x56afb5=[{'name':_0x5947bb}];}return db['UserProfile'][_0x27bd('0x64')]({'where':{'id':_0x5641ea[_0x27bd('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a5ec7,null))[_0x27bd('0x28')](function(_0x19e4b9){if(_0x19e4b9){var _0x30efde=[];for(var _0x4f3af9=0x0;_0x4f3af9<_0x56afb5[_0x27bd('0x37')];_0x4f3af9++){_0x30efde['push'](db[_0x27bd('0x5b')][_0x27bd('0x64')]({'where':{'userProfileId':_0x19e4b9['id'],'name':_0x56afb5[_0x4f3af9]['name']},'raw':!![]}));}return BPromise[_0x27bd('0x74')](_0x30efde);}})[_0x27bd('0x28')](function(_0x2acc26){var _0x5c66ba=_[_0x27bd('0x3d')](_0x2acc26,function(_0x5d9163){return _0x5d9163?_0x5d9163:undefined;});var _0x2f99b5=_[_0x27bd('0x3d')](_0x56afb5,[_0x27bd('0x75'),!![]]);var _0x5eb4b9=_[_0x27bd('0x72')](_0x5c66ba)&&_['isEmpty'](_0x2f99b5)?null:_[_0x27bd('0x76')](_0x2f99b5,_0x5c66ba);if(_0x5eb4b9){var _0x65fc27=[];for(var _0xf4add6=0x0;_0xf4add6<_0x5eb4b9[_0x27bd('0x37')];_0xf4add6++){var _0x314359=_['find'](_0x56afb5,function(_0x17e08d){return _0x5eb4b9[_0xf4add6]?_0x17e08d[_0x27bd('0x2a')]===_0x5eb4b9[_0xf4add6]['name']:null;});if(_0x314359){if(_0x5eb4b9[_0xf4add6][_0x27bd('0x75')]){_0x65fc27[_0x27bd('0x67')](getAllResources(_0x4a4c33['childModel'],_0x5eb4b9[_0xf4add6]));}else{if(!_0x5eb4b9[_0xf4add6][_0x27bd('0x56')]){_0x65fc27['push'](getAllowedResources(_0x314359,_0x5eb4b9[_0xf4add6],_0x4a4c33['childModel']));}else{if(_0x314359[_0x27bd('0x35')]){_0x65fc27[_0x27bd('0x67')](getAllFilteredResources(_0x314359,_0x5eb4b9[_0xf4add6]));}}}}}return BPromise['all'](_0x65fc27);}else{return null;}})[_0x27bd('0x28')](function(_0x31b125){var _0x2fb994=_0x31b125;var _0x2001ec=null;if(_0x2fb994){_0x2001ec=_0x2fb994[_0x27bd('0x37')]===0x1?_0x2fb994[0x0]:null;}if(_0x2001ec||_0x2fb994){var _0x256450=db[_0x4a4c33[_0x27bd('0x71')]][_0x27bd('0x2d')];_0x2679a5[_0x27bd('0x35')]=_[_0x27bd('0x32')](_0x256450);_0x2679a5[_0x27bd('0x31')]=_[_0x27bd('0x32')](_0x5641ea[_0x27bd('0x31')]);_0x2679a5['filters']=_[_0x27bd('0x34')](_0x2679a5[_0x27bd('0x35')],_0x2679a5[_0x27bd('0x31')]);_0x1bfc6d[_0x27bd('0x38')]=_[_0x27bd('0x34')](_0x2679a5[_0x27bd('0x35')],qs[_0x27bd('0x36')](_0x5641ea[_0x27bd('0x31')]['fields']));_0x1bfc6d[_0x27bd('0x38')]=_0x1bfc6d[_0x27bd('0x38')][_0x27bd('0x37')]?_0x1bfc6d['attributes']:_0x2679a5['model'];if(!_0x5641ea[_0x27bd('0x31')][_0x27bd('0x77')](_0x27bd('0x39'))){_0x1bfc6d[_0x27bd('0x22')]=qs[_0x27bd('0x22')](_0x5641ea['query']['limit']);_0x1bfc6d['offset']=qs[_0x27bd('0x21')](_0x5641ea[_0x27bd('0x31')][_0x27bd('0x21')]);}_0x1bfc6d['order']=qs['sort'](_0x5641ea[_0x27bd('0x31')][_0x27bd('0x3a')]);_0x1bfc6d[_0x27bd('0x3b')]=qs[_0x27bd('0x33')](_[_0x27bd('0x3c')](_0x5641ea[_0x27bd('0x31')],_0x2679a5[_0x27bd('0x33')]));if(_0x5641ea[_0x27bd('0x31')][_0x27bd('0x3d')]){_0x1bfc6d[_0x27bd('0x3b')]=_[_0x27bd('0x3e')](_0x1bfc6d[_0x27bd('0x3b')],{'$or':_[_0x27bd('0x2c')](_0x256450,function(_0x439332){if(_0x439332[_0x27bd('0x2f')]['key']!=='VIRTUAL'){var _0x2ccda6={};_0x2ccda6[_0x439332[_0x27bd('0x78')]]={'$like':'%'+_0x5641ea[_0x27bd('0x31')][_0x27bd('0x3d')]+'%'};return _0x2ccda6;}})});}var _0x263721=[];if(_0x2001ec){var _0x1cc523=_[_0x27bd('0x49')](_0x56afb5,[_0x27bd('0x2a'),_0x2001ec[_0x27bd('0x2a')]]);if(_0x1cc523['field']){var _0x3050b8={};if(_0x4a4c33['childModel']===_0x27bd('0x79')){_0x3050b8[_0x1cc523[_0x27bd('0x7a')]]=_[_0x27bd('0x2c')](_0x2001ec[_0x27bd('0x7b')],'id');}else{_0x3050b8[_0x1cc523[_0x27bd('0x7a')]]=_0x2001ec[_0x27bd('0x7b')];}_0x263721[_0x27bd('0x67')](_0x3050b8);}else{_0x1bfc6d[_0x27bd('0x3b')]['id']=_0x2001ec[_0x27bd('0x7b')];}}else{for(var _0x1f3abd=0x0;_0x1f3abd<_0x2fb994[_0x27bd('0x37')];_0x1f3abd++){var _0x1cc523=_[_0x27bd('0x49')](_0x56afb5,[_0x27bd('0x2a'),_0x2fb994[_0x1f3abd][_0x27bd('0x2a')]]);if(_0x1cc523['field']){var _0x3050b8={};_0x3050b8[_0x1cc523[_0x27bd('0x7a')]]=_0x2fb994[_0x1f3abd]['associatedResources'];_0x263721[_0x27bd('0x67')](_0x3050b8);}else{if(!_0x1bfc6d['where']['id'])_0x1bfc6d[_0x27bd('0x3b')]['id']=[];_0x2fb994[_0x1f3abd][_0x27bd('0x7b')]['forEach'](function(_0x259d96){_0x1bfc6d[_0x27bd('0x3b')]['id']['push'](_0x259d96);});}}}if(!_['isEmpty'](_0x263721)){_0x1bfc6d[_0x27bd('0x3b')]=_['merge'](_0x1bfc6d[_0x27bd('0x3b')],{'$and':{'$or':_0x263721}});}_0x1bfc6d=_[_0x27bd('0x3e')]({},_0x1bfc6d,_0x5641ea[_0x27bd('0x48')]);if(_0x2001ec&&!_0x2001ec['autoAssociation']&&_0x4a4c33[_0x27bd('0x71')]===_0x27bd('0x79')){if(_0x5641ea[_0x27bd('0x31')][_0x27bd('0x46')]){_0x1bfc6d[_0x27bd('0x47')]=[{'all':!![]}];}return db[_0x4a4c33[_0x27bd('0x71')]][_0x27bd('0x42')](_0x1bfc6d)[_0x27bd('0x28')](function(_0x2ca3e5){var _0x25083c=[];_0x2ca3e5[_0x27bd('0x66')](function(_0x1b1274){var _0x4a0494;switch(_0x1b1274[_0x27bd('0x7c')]){case _0x27bd('0x7d'):_0x4a0494=_[_0x27bd('0x49')](_0x2001ec[_0x27bd('0x7b')],function(_0xc42afc){return _0xc42afc['id']===_0x1b1274[_0x27bd('0x7e')]&&_0xc42afc[_0x27bd('0x2f')]==='DefaultReports';});break;case _0x27bd('0x7f'):_0x4a0494=_['find'](_0x2001ec[_0x27bd('0x7b')],function(_0x46105f){return _0x46105f['id']===_0x1b1274[_0x27bd('0x7e')]&&_0x46105f[_0x27bd('0x2f')]==='CustomReports';});break;}if(_0x4a0494)_0x25083c[_0x27bd('0x67')](_0x1b1274);});_0x270f94['count']=_0x25083c['length'];_0x270f94['rows']=_0x25083c;return _0x270f94;});}else{return db[_0x4a4c33[_0x27bd('0x71')]][_0x27bd('0x41')]({'where':_0x1bfc6d['where']})[_0x27bd('0x28')](function(_0x358c0c){_0x270f94['count']=_0x358c0c;if(_0x5641ea['query'][_0x27bd('0x46')]){if(_0x4a4c33[_0x27bd('0x71')]===_0x27bd('0x80')){_0x1bfc6d[_0x27bd('0x47')]=[{'model':db[_0x27bd('0x81')],'as':_0x27bd('0x82'),'attributes':['id','name',_0x27bd('0x83')],'required':_0x5641ea['query']['tag']?!![]:![]},{'model':db['Tag'],'as':_0x27bd('0x84'),'attributes':['id',_0x27bd('0x2a'),'color'],'through':_0x5641ea[_0x27bd('0x31')][_0x27bd('0x85')]?{'attributes':[],'where':{'TagId':_0x5641ea[_0x27bd('0x31')][_0x27bd('0x85')]||undefined}}:{},'required':_0x5641ea['query'][_0x27bd('0x85')]?!![]:![]}];}else{_0x1bfc6d[_0x27bd('0x47')]=[{'all':!![]}];}}return db[_0x4a4c33[_0x27bd('0x71')]]['findAll'](_0x1bfc6d);})[_0x27bd('0x28')](function(_0x20f60d){_0x270f94['rows']=_0x20f60d;return _0x270f94;});}}else{return _0x270f94;}})['then'](respondWithFilteredResult(_0x2a5ec7,_0x1bfc6d))['catch'](handleError(_0x2a5ec7,null));};function getAllResources(_0x38c7ad,_0x2c1109){return new BPromise(function(_0x186318,_0x5b595c){if(_0x2c1109){var _0x36e046=_0x2c1109['filter']?{[_0x2c1109['filter'][_0x27bd('0x78')]]:_0x2c1109[_0x27bd('0x3d')][_0x27bd('0x86')]}:undefined;return db[_0x38c7ad]['findAll']({'where':_0x36e046,'raw':!![]})[_0x27bd('0x28')](function(_0x6ab591){_0x2c1109['associatedResources']=_[_0x27bd('0x2c')](_0x6ab591,'id');_0x186318(_0x2c1109);})['catch'](function(_0x11533d){_0x5b595c(_0x11533d);});}else{_0x186318(null);}});}function getAllFilteredResources(_0x437d8e,_0x1187a1){return new BPromise(function(_0x3ddb7b,_0x46bb84){var _0x243a1c=_0x437d8e[_0x27bd('0x3d')]?{[_0x437d8e[_0x27bd('0x3d')][_0x27bd('0x78')]]:_0x437d8e[_0x27bd('0x3d')]['value']}:undefined;return db[_0x437d8e['model']]['findAll']({'where':_0x243a1c,'raw':!![]})[_0x27bd('0x28')](function(_0x7916d5){_0x1187a1[_0x27bd('0x7b')]=_[_0x27bd('0x2c')](_0x7916d5,function(_0x38be49){return _0x38be49['name'];});_0x3ddb7b(_0x1187a1);})['catch'](function(_0x5e7c50){_0x46bb84(_0x5e7c50);});});}function getAllowedResources(_0x2b611d,_0x1f51be,_0x3ad147){return new BPromise(function(_0x242074,_0x17c4c5){if(_0x1f51be){return db[_0x27bd('0x57')][_0x27bd('0x42')]({'where':{'sectionId':_0x1f51be['id']},'raw':!![]})[_0x27bd('0x28')](function(_0x47784c){if(_0x2b611d['field']&&_0x2b611d[_0x27bd('0x78')]!=='id'){_0x1f51be[_0x27bd('0x7b')]=_[_0x27bd('0x2c')](_0x47784c,function(_0x230b51){return _0x230b51[_0x2b611d[_0x27bd('0x78')]];});}else{if(_0x3ad147===_0x27bd('0x79')){_0x1f51be[_0x27bd('0x7b')]=_[_0x27bd('0x2c')](_0x47784c,function(_0x8bfebe){return{'id':_0x8bfebe[_0x27bd('0x68')],'type':_0x8bfebe['type']};});}else{_0x1f51be['associatedResources']=_['map'](_0x47784c,function(_0x1533db){return _0x1533db['resourceId'];});}}_0x242074(_0x1f51be);})['catch'](function(_0x1ec3c2){_0x17c4c5(_0x1ec3c2);});}else{_0x242074(null);}});}function getQueryModels(_0x45233b,_0x17b00f){var _0x14dd27=_0x45233b['toLowerCase']();var _0x1ed4e7={'childModel':undefined,'parentSections':[]};switch(_0x14dd27){case _0x27bd('0x87'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0x88');break;case'odbc':_0x1ed4e7[_0x27bd('0x71')]='SquareOdbc';break;case _0x27bd('0x89'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0x8a');_0x1ed4e7[_0x27bd('0x73')]=[{'name':_0x27bd('0x8b'),'field':_0x27bd('0x2a'),'foreignKey':_0x27bd('0x8c')}];break;case'projects':_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0x8d');break;case _0x27bd('0x8e'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0x80');_0x1ed4e7['parentSections']=[{'name':_0x27bd('0x8f'),'field':'id','foreignKey':_0x27bd('0x90')}];break;case _0x27bd('0x91'):_0x1ed4e7['childModel']=_0x27bd('0x92');break;case _0x27bd('0x93'):_0x1ed4e7['childModel']=_0x27bd('0x94');break;case'globalcustomfields':_0x1ed4e7[_0x27bd('0x71')]='CmCustomField';break;case'chatqueues':_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0x95');break;case _0x27bd('0x96'):_0x1ed4e7[_0x27bd('0x71')]='ChatWebsite';break;case _0x27bd('0x97'):_0x1ed4e7[_0x27bd('0x71')]='FaxQueue';break;case _0x27bd('0x98'):_0x1ed4e7[_0x27bd('0x71')]='FaxAccount';break;case _0x27bd('0x99'):case'internalroutes':case _0x27bd('0x9a'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0x9b');break;case _0x27bd('0x9c'):_0x1ed4e7['childModel']=_0x27bd('0x9d');break;case _0x27bd('0x9e'):_0x1ed4e7[_0x27bd('0x71')]='VoiceMail';break;case'voicerecordings':_0x1ed4e7[_0x27bd('0x71')]='VoiceRecording';_0x1ed4e7['parentSections']=[{'name':_0x27bd('0x9f'),'field':'name','foreignKey':_0x27bd('0xa0'),'model':'User','filter':{'field':_0x27bd('0xa1'),'value':[_0x27bd('0xa2')]}},{'name':_0x27bd('0xa3'),'field':_0x27bd('0x2a'),'foreignKey':_0x27bd('0xa0'),'model':'User','filter':{'field':_0x27bd('0xa1'),'value':['telephone']}},{'name':_0x27bd('0xa4'),'field':_0x27bd('0x2a'),'foreignKey':_0x27bd('0xa5'),'model':_0x27bd('0xa6'),'filter':{'field':_0x27bd('0x2f'),'value':[_0x27bd('0xa7')]}},{'name':_0x27bd('0xa8'),'field':_0x27bd('0x2a'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0x27bd('0xa9')]}}];break;case _0x27bd('0xaa'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xab');break;case _0x27bd('0xac'):_0x1ed4e7[_0x27bd('0x71')]='VoiceChanSpy';break;case _0x27bd('0xad'):_0x1ed4e7[_0x27bd('0x71')]='VoicePrefix';break;case _0x27bd('0xae'):_0x1ed4e7[_0x27bd('0x71')]='Campaign';break;case'mailqueues':_0x1ed4e7['childModel']='MailQueue';break;case _0x27bd('0xaf'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xb0');break;case _0x27bd('0xb1'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xb2');break;case _0x27bd('0xb3'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xb4');break;case _0x27bd('0xb5'):_0x1ed4e7['childModel']=_0x27bd('0xb6');break;case _0x27bd('0xb7'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xb8');break;case _0x27bd('0xb9'):_0x1ed4e7[_0x27bd('0x71')]='SmsAccount';break;case'teams':_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xba');break;case _0x27bd('0xbb'):case _0x27bd('0xbc'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xa6');if(_0x17b00f){_0x1ed4e7['parentSections']=[{'name':_0x27bd('0xa4')},{'name':'QueueCampaigns'}];}break;case _0x27bd('0xbd'):case _0x27bd('0xbe'):case _0x27bd('0xbf'):_0x1ed4e7[_0x27bd('0x71')]='User';if(_0x17b00f){_0x1ed4e7['parentSections']=[{'name':_0x27bd('0xc0'),'filter':{'field':_0x27bd('0xa1'),'value':[_0x27bd('0xc1'),_0x27bd('0xc2')]},'ignore':!![]},{'name':_0x27bd('0x9f')},{'name':_0x27bd('0xa3')}];}break;case _0x27bd('0xc3'):_0x1ed4e7['childModel']=_0x27bd('0xc4');break;case'salesforceaccounts':_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xc5');break;case _0x27bd('0xc6'):_0x1ed4e7[_0x27bd('0x71')]='FreshdeskAccount';break;case _0x27bd('0xc7'):_0x1ed4e7['childModel']=_0x27bd('0xc8');break;case'deskaccounts':_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xc9');break;case _0x27bd('0xca'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xcb');break;case'vtigeraccounts':_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xcc');break;case _0x27bd('0xcd'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xce');break;case _0x27bd('0xcf'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xd0');break;case _0x27bd('0xd1'):_0x1ed4e7['childModel']=_0x27bd('0x65');break;case'intervals':_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xd2');break;case _0x27bd('0xd3'):_0x1ed4e7['childModel']=_0x27bd('0xd4');break;case _0x27bd('0xd5'):_0x1ed4e7['childModel']='Schedule';break;case _0x27bd('0xd6'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xd7');break;case _0x27bd('0xd8'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0x81');break;case _0x27bd('0xd9'):_0x1ed4e7['childModel']=_0x27bd('0xda');break;case _0x27bd('0xdb'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xdc');break;case _0x27bd('0xdd'):_0x1ed4e7[_0x27bd('0x71')]='Trunk';break;case _0x27bd('0xde'):_0x1ed4e7['childModel']=_0x27bd('0xdf');break;case'plugins':_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xe0');break;case _0x27bd('0xe1'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0x79');_0x1ed4e7[_0x27bd('0x73')]=[{'name':_0x27bd('0xe2'),'field':'id','foreignKey':'reportId'}];break;case _0x27bd('0xe3'):_0x1ed4e7[_0x27bd('0x71')]=_0x27bd('0xe4');break;default:return _0x1ed4e7;}return _0x1ed4e7;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 77206bd..50b7f30 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 _0x5d50=['emit','hasOwnProperty','hook','exports','UserProfile','setMaxListeners','save','update'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x5d50,0xc4));var _0x05d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d50[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var UserProfile=require('../../mysqldb')['db'][_0x05d5('0x0')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x05d5('0x1')](0x0);var events={'afterCreate':_0x05d5('0x2'),'afterUpdate':_0x05d5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3e5c07){return function(_0x49b32f,_0xb3158f,_0x180323){UserProfileEvents[_0x05d5('0x4')](_0x3e5c07+':'+_0x49b32f['id'],_0x49b32f);UserProfileEvents[_0x05d5('0x4')](_0x3e5c07,_0x49b32f);_0x180323(null);};}for(var e in events){if(events[_0x05d5('0x5')](e)){var event=events[e];UserProfile[_0x05d5('0x6')](e,emitEvent(event));}}module[_0x05d5('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x70a9=['emit','hook','events','UserProfile','setMaxListeners','update'];(function(_0x5fc0d7,_0x5419b7){var _0x235a22=function(_0x58fcb3){while(--_0x58fcb3){_0x5fc0d7['push'](_0x5fc0d7['shift']());}};_0x235a22(++_0x5419b7);}(_0x70a9,0x68));var _0x970a=function(_0x27d588,_0x666f4f){_0x27d588=_0x27d588-0x0;var _0x2235c0=_0x70a9[_0x27d588];return _0x2235c0;};'use strict';var EventEmitter=require(_0x970a('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x970a('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x970a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x970a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2f1a16){return function(_0x2a75a1,_0x1907ab,_0x1d71e4){UserProfileEvents[_0x970a('0x4')](_0x2f1a16+':'+_0x2a75a1['id'],_0x2a75a1);UserProfileEvents[_0x970a('0x4')](_0x2f1a16,_0x2a75a1);_0x1d71e4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x970a('0x5')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index bc85835..65d8eac 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 _0x77d4=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfile.attributes','exports','user_profiles','lodash'];(function(_0x17f9d1,_0x53652b){var _0x3e6fdb=function(_0x110051){while(--_0x110051){_0x17f9d1['push'](_0x17f9d1['shift']());}};_0x3e6fdb(++_0x53652b);}(_0x77d4,0x149));var _0x477d=function(_0x34d6f4,_0x37435f){_0x34d6f4=_0x34d6f4-0x0;var _0x1ae55c=_0x77d4[_0x34d6f4];return _0x1ae55c;};'use strict';var _=require(_0x477d('0x0'));var util=require(_0x477d('0x1'));var logger=require(_0x477d('0x2'))('api');var moment=require(_0x477d('0x3'));var BPromise=require(_0x477d('0x4'));var rp=require(_0x477d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x477d('0x6'));var config=require(_0x477d('0x7'));var attributes=require(_0x477d('0x8'));module[_0x477d('0x9')]=function(_0x37a6af,_0x56cf5a){return _0x37a6af['define']('UserProfile',attributes,{'tableName':_0x477d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0e6=['moment','bluebird','path','./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','util','../../config/logger','api'];(function(_0x5a746b,_0x271635){var _0x3f851b=function(_0x50a6c5){while(--_0x50a6c5){_0x5a746b['push'](_0x5a746b['shift']());}};_0x3f851b(++_0x271635);}(_0xc0e6,0xb0));var _0x6c0e=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xc0e6[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0x6c0e('0x0'));var util=require(_0x6c0e('0x1'));var logger=require(_0x6c0e('0x2'))(_0x6c0e('0x3'));var moment=require(_0x6c0e('0x4'));var BPromise=require(_0x6c0e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c0e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6c0e('0x7'));module[_0x6c0e('0x8')]=function(_0x4190ea,_0x2b58a3){return _0x4190ea[_0x6c0e('0x9')](_0x6c0e('0xa'),attributes,{'tableName':_0x6c0e('0xb'),'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 a0648ca..61a377e 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 _0xac9d=['./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x332465,_0x590b90){var _0x41ba46=function(_0x2028ab){while(--_0x2028ab){_0x332465['push'](_0x332465['shift']());}};_0x41ba46(++_0x590b90);}(_0xac9d,0x14d));var _0xdac9=function(_0x5e465a,_0x3e0f32){_0x5e465a=_0x5e465a-0x0;var _0x52c7db=_0xac9d[_0x5e465a];return _0x52c7db;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});config[_0xdac9('0xc')]=_[_0xdac9('0xd')](config[_0xdac9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0xe'))(new Redis(config['redis']));require(_0xdac9('0xf'))[_0xdac9('0x10')](socket);function respondWithRpcPromise(_0x39c92c,_0x1a4674,_0x23ec14){return new BPromise(function(_0x2859bf,_0x255627){return client[_0xdac9('0x11')](_0x39c92c,_0x23ec14)[_0xdac9('0x12')](function(_0x5514c5){logger[_0xdac9('0x13')](_0xdac9('0x14'),_0x1a4674,'request\x20sent');logger[_0xdac9('0x15')](_0xdac9('0x16'),_0x1a4674,_0xdac9('0x17'),JSON['stringify'](_0x5514c5));if(_0x5514c5[_0xdac9('0x18')]){if(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x19')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x255627(_0x5514c5['error'][_0xdac9('0x1a')]);}logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x2859bf(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);}else{logger[_0xdac9('0x13')]('UserProfile,\x20%s,\x20%s',_0x1a4674,_0xdac9('0x17'));_0x2859bf(_0x5514c5[_0xdac9('0x1b')]['message']);}})[_0xdac9('0x1c')](function(_0xa57f2d){logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0xa57f2d);_0x255627(_0xa57f2d);});});} \ No newline at end of file +var _0xfdbd=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','localhost','socket.io-emitter','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x58c250,_0x29c0e1){var _0x274c1e=function(_0x56479f){while(--_0x56479f){_0x58c250['push'](_0x58c250['shift']());}};_0x274c1e(++_0x29c0e1);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2892da,_0x191a40){_0x2892da=_0x2892da-0x0;var _0x28cff2=_0xfdbd[_0x2892da];return _0x28cff2;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var moment=require(_0xdfdb('0x2'));var BPromise=require(_0xdfdb('0x3'));var rs=require(_0xdfdb('0x4'));var fs=require('fs');var Redis=require(_0xdfdb('0x5'));var db=require(_0xdfdb('0x6'))['db'];var utils=require(_0xdfdb('0x7'));var logger=require(_0xdfdb('0x8'))('rpc');var config=require(_0xdfdb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdfdb('0xa')][_0xdfdb('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xdfdb('0xc'),'port':0x18eb});var socket=require(_0xdfdb('0xd'))(new Redis(config['redis']));require(_0xdfdb('0xe'))[_0xdfdb('0xf')](socket);function respondWithRpcPromise(_0x24eb73,_0x27ddcd,_0x3a44a9){return new BPromise(function(_0x1ace28,_0x2bb8d4){return client['request'](_0x24eb73,_0x3a44a9)[_0xdfdb('0x10')](function(_0x1972db){logger['info'](_0xdfdb('0x11'),_0x27ddcd,_0xdfdb('0x12'));logger[_0xdfdb('0x13')](_0xdfdb('0x14'),_0x27ddcd,_0xdfdb('0x12'),JSON[_0xdfdb('0x15')](_0x1972db));if(_0x1972db[_0xdfdb('0x16')]){if(_0x1972db[_0xdfdb('0x16')]['code']===0x1f4){logger['error'](_0xdfdb('0x11'),_0x27ddcd,_0x1972db['error'][_0xdfdb('0x17')]);return _0x2bb8d4(_0x1972db[_0xdfdb('0x16')][_0xdfdb('0x17')]);}logger[_0xdfdb('0x16')](_0xdfdb('0x11'),_0x27ddcd,_0x1972db[_0xdfdb('0x16')]['message']);return _0x1ace28(_0x1972db['error'][_0xdfdb('0x17')]);}else{logger[_0xdfdb('0x18')](_0xdfdb('0x11'),_0x27ddcd,'request\x20sent');_0x1ace28(_0x1972db[_0xdfdb('0x19')][_0xdfdb('0x17')]);}})[_0xdfdb('0x1a')](function(_0xd60a30){logger[_0xdfdb('0x16')](_0xdfdb('0x11'),_0x27ddcd,_0xd60a30);_0x2bb8d4(_0xd60a30);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 862957a..27d4c15 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 _0x9c29=['userProfile:','save','update','emit','removeListener'];(function(_0x36a1ee,_0x34cbd3){var _0x71f849=function(_0x567be0){while(--_0x567be0){_0x36a1ee['push'](_0x36a1ee['shift']());}};_0x71f849(++_0x34cbd3);}(_0x9c29,0x65));var _0x99c2=function(_0x42b18d,_0x4bc453){_0x42b18d=_0x42b18d-0x0;var _0x26f3cb=_0x9c29[_0x42b18d];return _0x26f3cb;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x99c2('0x0'),'remove',_0x99c2('0x1')];function createListener(_0x128048,_0x5f48b8){return function(_0x35541b){_0x5f48b8[_0x99c2('0x2')](_0x128048,_0x35541b);};}function removeListener(_0x46d76b,_0x24c382){return function(){UserProfileEvents[_0x99c2('0x3')](_0x46d76b,_0x24c382);};}exports['register']=function(_0xebbd08){for(var _0x385307=0x0,_0x4e60d5=events['length'];_0x385307<_0x4e60d5;_0x385307++){var _0x3fea88=events[_0x385307];var _0x598bbe=createListener(_0x99c2('0x4')+_0x3fea88,_0xebbd08);UserProfileEvents['on'](_0x3fea88,_0x598bbe);}}; \ No newline at end of file +var _0xfc6e=['update','emit','removeListener','length','userProfile:','save','remove'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xfc6e,0x1c5));var _0xefc6=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xfc6e[_0x484e36];return _0xafc85d;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xefc6('0x0'),_0xefc6('0x1'),_0xefc6('0x2')];function createListener(_0x25930c,_0x418755){return function(_0x1c74ba){_0x418755[_0xefc6('0x3')](_0x25930c,_0x1c74ba);};}function removeListener(_0x2cc647,_0x16fd93){return function(){UserProfileEvents[_0xefc6('0x4')](_0x2cc647,_0x16fd93);};}exports['register']=function(_0x5102a4){for(var _0x428958=0x0,_0x432fbd=events[_0xefc6('0x5')];_0x428958<_0x432fbd;_0x428958++){var _0xda6bf4=events[_0x428958];var _0x3cb08c=createListener(_0xefc6('0x6')+_0xda6bf4,_0x5102a4);UserProfileEvents['on'](_0xda6bf4,_0x3cb08c);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 609646f..1a74115 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 _0x7d87=['Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x269141,_0x1a1f83){var _0x132c38=function(_0x52916a){while(--_0x52916a){_0x269141['push'](_0x269141['shift']());}};_0x132c38(++_0x1a1f83);}(_0x7d87,0x178));var _0x77d8=function(_0x107267,_0x1bcc4f){_0x107267=_0x107267-0x0;var _0x261669=_0x7d87[_0x107267];return _0x261669;};'use strict';var multer=require(_0x77d8('0x0'));var util=require('util');var path=require(_0x77d8('0x1'));var timeout=require(_0x77d8('0x2'));var express=require(_0x77d8('0x3'));var router=express[_0x77d8('0x4')]();var auth=require(_0x77d8('0x5'));var interaction=require(_0x77d8('0x6'));var config=require('../../config/environment');var controller=require(_0x77d8('0x7'));router[_0x77d8('0x8')]('/',auth[_0x77d8('0x9')](),controller[_0x77d8('0xa')]);router[_0x77d8('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x77d8('0xb')]);router[_0x77d8('0x8')](_0x77d8('0xc'),auth[_0x77d8('0x9')](),controller['show']);router['post']('/',auth[_0x77d8('0x9')](),controller[_0x77d8('0xd')]);router[_0x77d8('0xe')](_0x77d8('0xc'),auth['isAuthenticated'](),controller[_0x77d8('0xf')]);router[_0x77d8('0x10')](_0x77d8('0xc'),auth[_0x77d8('0x9')](),controller[_0x77d8('0x11')]);module[_0x77d8('0x12')]=router; \ No newline at end of file +var _0xedca=['/:id','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','show','post','create','put','update'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xedca,0xc9));var _0xaedc=function(_0x4ef763,_0xcb3d51){_0x4ef763=_0x4ef763-0x0;var _0x55d83f=_0xedca[_0x4ef763];return _0x55d83f;};'use strict';var multer=require(_0xaedc('0x0'));var util=require(_0xaedc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaedc('0x2'));var router=express['Router']();var auth=require(_0xaedc('0x3'));var interaction=require(_0xaedc('0x4'));var config=require(_0xaedc('0x5'));var controller=require(_0xaedc('0x6'));router['get']('/',auth[_0xaedc('0x7')](),controller[_0xaedc('0x8')]);router[_0xaedc('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xaedc('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xaedc('0xa')]);router[_0xaedc('0xb')]('/',auth[_0xaedc('0x7')](),controller[_0xaedc('0xc')]);router[_0xaedc('0xd')]('/:id',auth[_0xaedc('0x7')](),controller[_0xaedc('0xe')]);router['delete'](_0xaedc('0xf'),auth['isAuthenticated'](),controller[_0xaedc('0x10')]);module[_0xaedc('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 7ee83e1..cc56500 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 _0x66c0=['INTEGER','exports','STRING'];(function(_0x17e0a4,_0x3a8370){var _0x5f0a81=function(_0x3866e6){while(--_0x3866e6){_0x17e0a4['push'](_0x17e0a4['shift']());}};_0x5f0a81(++_0x3a8370);}(_0x66c0,0x1a2));var _0x066c=function(_0x3768d3,_0x25d3f0){_0x3768d3=_0x3768d3-0x0;var _0x98678b=_0x66c0[_0x3768d3];return _0x98678b;};'use strict';var Sequelize=require('sequelize');module[_0x066c('0x0')]={'name':{'type':Sequelize[_0x066c('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x066c('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x188e=['INTEGER','exports','STRING'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x188e,0x9d));var _0xe188=function(_0x415eb3,_0x2cd644){_0x415eb3=_0x415eb3-0x0;var _0x48ed6d=_0x188e[_0x415eb3];return _0x48ed6d;};'use strict';var Sequelize=require('sequelize');module[_0xe188('0x0')]={'name':{'type':Sequelize[_0xe188('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe188('0x2')],'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 c9867d8..3551948 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 _0x1ac0=['path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','UserProfileResource','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','create','body','find','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x28d834,_0x286992){var _0x18a1ca=function(_0xe1227d){while(--_0xe1227d){_0x28d834['push'](_0x28d834['shift']());}};_0x18a1ca(++_0x286992);}(_0x1ac0,0x191));var _0x01ac=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1ac0[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0x01ac('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x01ac('0x1'));var jsonpatch=require(_0x01ac('0x2'));var rp=require(_0x01ac('0x3'));var moment=require(_0x01ac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x01ac('0x5'));var util=require(_0x01ac('0x6'));var path=require(_0x01ac('0x7'));var sox=require(_0x01ac('0x8'));var csv=require(_0x01ac('0x9'));var ejs=require(_0x01ac('0xa'));var fs=require('fs');var _=require(_0x01ac('0xb'));var squel=require(_0x01ac('0xc'));var crypto=require('crypto');var jsforce=require(_0x01ac('0xd'));var deskjs=require(_0x01ac('0xe'));var toCsv=require(_0x01ac('0x9'));var querystring=require(_0x01ac('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x01ac('0x10'));var qs=require(_0x01ac('0x11'));var as=require(_0x01ac('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x01ac('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x468e05,_0x3fadbd){_0x3fadbd=_0x3fadbd||0xcc;return function(_0x42b4c1){if(_0x42b4c1){return _0x468e05[_0x01ac('0x14')](_0x3fadbd);}return _0x468e05[_0x01ac('0x15')](_0x3fadbd)[_0x01ac('0x16')]();};}function respondWithResult(_0x4022f7,_0x222a69){_0x222a69=_0x222a69||0xc8;return function(_0x2d75c5){if(_0x2d75c5){return _0x4022f7[_0x01ac('0x15')](_0x222a69)[_0x01ac('0x17')](_0x2d75c5);}};}function respondWithFilteredResult(_0x1ab156,_0xe463a3){return function(_0x3505df){if(_0x3505df){var _0x3a8fa1=_0x3505df[_0x01ac('0x18')],_0x4102cf=_0xe463a3[_0x01ac('0x19')],_0x40495a=_0xe463a3['offset']+_0xe463a3[_0x01ac('0x1a')],_0x547670;if(_0x40495a>=_0x3a8fa1){_0x40495a=_0x3a8fa1;_0x547670=0xc8;}else{_0x547670=0xce;}_0x1ab156[_0x01ac('0x15')](_0x547670);return _0x1ab156[_0x01ac('0x1b')](_0x01ac('0x1c'),_0x4102cf+'-'+_0x40495a+'/'+_0x3a8fa1)[_0x01ac('0x17')](_0x3505df);}return null;};}function patchUpdates(_0x227d2c){return function(_0x265449){try{jsonpatch[_0x01ac('0x1d')](_0x265449,_0x227d2c,!![]);}catch(_0x5cf71f){return BPromise[_0x01ac('0x1e')](_0x5cf71f);}return _0x265449[_0x01ac('0x1f')]();};}function saveUpdates(_0x3e460b,_0x3903c5){return function(_0x4cbaea){if(_0x4cbaea){return _0x4cbaea[_0x01ac('0x20')](_0x3e460b)[_0x01ac('0x21')](function(_0x50ae16){return _0x50ae16;});}return null;};}function removeEntity(_0x1381b3,_0x1bbd85){return function(_0x2852ca){if(_0x2852ca){return _0x2852ca['destroy']()[_0x01ac('0x21')](function(){_0x1381b3[_0x01ac('0x15')](0xcc)[_0x01ac('0x16')]();});}};}function handleEntityNotFound(_0x54bf17,_0x28b047){return function(_0x1bbb65){if(!_0x1bbb65){_0x54bf17[_0x01ac('0x14')](0x194);}return _0x1bbb65;};}function handleError(_0x3718e0,_0x29ed5c){_0x29ed5c=_0x29ed5c||0x1f4;return function(_0x110882){logger[_0x01ac('0x22')](_0x110882['stack']);if(_0x110882['name']){delete _0x110882[_0x01ac('0x23')];}_0x3718e0[_0x01ac('0x15')](_0x29ed5c)[_0x01ac('0x24')](_0x110882);};}exports[_0x01ac('0x25')]=function(_0x2c5be9,_0x14abae){var _0x206af2={},_0x4fcf81={},_0x945c57={'count':0x0,'rows':[]};var _0x49d8e1=_[_0x01ac('0x26')](db[_0x01ac('0x27')]['rawAttributes'],function(_0x3ca56e){return{'name':_0x3ca56e[_0x01ac('0x28')],'type':_0x3ca56e['type'][_0x01ac('0x29')]};});_0x4fcf81[_0x01ac('0x2a')]=_['map'](_0x49d8e1,'name');_0x4fcf81['query']=_[_0x01ac('0x2b')](_0x2c5be9[_0x01ac('0x2c')]);_0x4fcf81[_0x01ac('0x2d')]=_[_0x01ac('0x2e')](_0x4fcf81[_0x01ac('0x2a')],_0x4fcf81['query']);_0x206af2[_0x01ac('0x2f')]=_['intersection'](_0x4fcf81[_0x01ac('0x2a')],qs[_0x01ac('0x30')](_0x2c5be9[_0x01ac('0x2c')][_0x01ac('0x30')]));_0x206af2[_0x01ac('0x2f')]=_0x206af2[_0x01ac('0x2f')][_0x01ac('0x31')]?_0x206af2[_0x01ac('0x2f')]:_0x4fcf81[_0x01ac('0x2a')];if(!_0x2c5be9['query'][_0x01ac('0x32')](_0x01ac('0x33'))){_0x206af2[_0x01ac('0x1a')]=qs['limit'](_0x2c5be9['query'][_0x01ac('0x1a')]);_0x206af2[_0x01ac('0x19')]=qs[_0x01ac('0x19')](_0x2c5be9['query'][_0x01ac('0x19')]);}_0x206af2['order']=qs[_0x01ac('0x34')](_0x2c5be9[_0x01ac('0x2c')][_0x01ac('0x34')]);_0x206af2[_0x01ac('0x35')]=qs['filters'](_['pick'](_0x2c5be9[_0x01ac('0x2c')],_0x4fcf81['filters']));if(_0x2c5be9[_0x01ac('0x2c')][_0x01ac('0x36')]){_0x206af2[_0x01ac('0x35')]=_[_0x01ac('0x37')](_0x206af2[_0x01ac('0x35')],{'$or':_['map'](_0x49d8e1,function(_0x526e1a){if(_0x526e1a['type']!==_0x01ac('0x38')){var _0x497893={};_0x497893[_0x526e1a[_0x01ac('0x23')]]={'$like':'%'+_0x2c5be9[_0x01ac('0x2c')][_0x01ac('0x36')]+'%'};return _0x497893;}})});}_0x206af2=_['merge']({},_0x206af2,_0x2c5be9[_0x01ac('0x39')]);var _0x5d8a33={'where':_0x206af2[_0x01ac('0x35')]};return db[_0x01ac('0x27')][_0x01ac('0x18')](_0x5d8a33)[_0x01ac('0x21')](function(_0x2fb201){_0x945c57[_0x01ac('0x18')]=_0x2fb201;if(_0x2c5be9[_0x01ac('0x2c')]['includeAll']){_0x206af2[_0x01ac('0x3a')]=[{'all':!![]}];}return db['UserProfileResource'][_0x01ac('0x3b')](_0x206af2);})[_0x01ac('0x21')](function(_0x4e4a6d){_0x945c57[_0x01ac('0x3c')]=_0x4e4a6d;return _0x945c57;})['then'](respondWithFilteredResult(_0x14abae,_0x206af2))[_0x01ac('0x3d')](handleError(_0x14abae,null));};exports['show']=function(_0x45f1c9,_0x17763f){var _0x38e3d3={'raw':![],'where':{'id':_0x45f1c9[_0x01ac('0x3e')]['id']}},_0x4d31f1={};_0x4d31f1[_0x01ac('0x2a')]=_[_0x01ac('0x2b')](db[_0x01ac('0x27')]['rawAttributes']);_0x4d31f1['query']=_[_0x01ac('0x2b')](_0x45f1c9[_0x01ac('0x2c')]);_0x4d31f1[_0x01ac('0x2d')]=_[_0x01ac('0x2e')](_0x4d31f1[_0x01ac('0x2a')],_0x4d31f1[_0x01ac('0x2c')]);_0x38e3d3['attributes']=_['intersection'](_0x4d31f1['model'],qs[_0x01ac('0x30')](_0x45f1c9['query'][_0x01ac('0x30')]));_0x38e3d3[_0x01ac('0x2f')]=_0x38e3d3['attributes']['length']?_0x38e3d3[_0x01ac('0x2f')]:_0x4d31f1[_0x01ac('0x2a')];if(_0x45f1c9[_0x01ac('0x2c')][_0x01ac('0x3f')]){_0x38e3d3['include']=[{'all':!![]}];}_0x38e3d3=_['merge']({},_0x38e3d3,_0x45f1c9[_0x01ac('0x39')]);return db[_0x01ac('0x27')]['find'](_0x38e3d3)[_0x01ac('0x21')](handleEntityNotFound(_0x17763f,null))[_0x01ac('0x21')](respondWithResult(_0x17763f,null))[_0x01ac('0x3d')](handleError(_0x17763f,null));};exports[_0x01ac('0x40')]=function(_0x201a3b,_0x5d2c0d){return db['UserProfileResource'][_0x01ac('0x40')](_0x201a3b[_0x01ac('0x41')],{})['then'](respondWithResult(_0x5d2c0d,0xc9))['catch'](handleError(_0x5d2c0d,null));};exports[_0x01ac('0x20')]=function(_0x2df881,_0x53aca4){if(_0x2df881[_0x01ac('0x41')]['id']){delete _0x2df881[_0x01ac('0x41')]['id'];}return db[_0x01ac('0x27')][_0x01ac('0x42')]({'where':{'id':_0x2df881[_0x01ac('0x3e')]['id']}})['then'](handleEntityNotFound(_0x53aca4,null))['then'](saveUpdates(_0x2df881[_0x01ac('0x41')],null))[_0x01ac('0x21')](respondWithResult(_0x53aca4,null))['catch'](handleError(_0x53aca4,null));};exports['destroy']=function(_0x1edc8b,_0x45b9a4){return db[_0x01ac('0x27')][_0x01ac('0x42')]({'where':{'id':_0x1edc8b['params']['id']}})[_0x01ac('0x21')](handleEntityNotFound(_0x45b9a4,null))[_0x01ac('0x21')](removeEntity(_0x45b9a4,null))[_0x01ac('0x3d')](handleError(_0x45b9a4,null));};exports[_0x01ac('0x43')]=function(_0x28047c,_0x3a7a66){return db[_0x01ac('0x27')][_0x01ac('0x43')]()[_0x01ac('0x21')](respondWithResult(_0x3a7a66,null))[_0x01ac('0x3d')](handleError(_0x3a7a66,null));}; \ No newline at end of file +var _0x00ff=['attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','map','type','VIRTUAL','filter','count','includeAll','include','findAll','rows','show','params','fields','options','find','create','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','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','update','then','destroy','name','send','index','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','filters','intersection'];(function(_0x228a08,_0x534024){var _0x49edae=function(_0x159aa4){while(--_0x159aa4){_0x228a08['push'](_0x228a08['shift']());}};_0x49edae(++_0x534024);}(_0x00ff,0x66));var _0xf00f=function(_0x590f8d,_0x188d9e){_0x590f8d=_0x590f8d-0x0;var _0x435aab=_0x00ff[_0x590f8d];return _0x435aab;};'use strict';var pdf=require(_0xf00f('0x0'));var emlformat=require(_0xf00f('0x1'));var rimraf=require(_0xf00f('0x2'));var zipdir=require(_0xf00f('0x3'));var jsonpatch=require(_0xf00f('0x4'));var rp=require(_0xf00f('0x5'));var moment=require(_0xf00f('0x6'));var BPromise=require(_0xf00f('0x7'));var Mustache=require(_0xf00f('0x8'));var util=require(_0xf00f('0x9'));var path=require(_0xf00f('0xa'));var sox=require(_0xf00f('0xb'));var csv=require(_0xf00f('0xc'));var ejs=require(_0xf00f('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf00f('0xe'));var crypto=require(_0xf00f('0xf'));var jsforce=require(_0xf00f('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf00f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf00f('0x12'));var as=require(_0xf00f('0x13'));var hardwareService=require(_0xf00f('0x14'));var logger=require(_0xf00f('0x15'))(_0xf00f('0x16'));var utils=require(_0xf00f('0x17'));var config=require(_0xf00f('0x18'));var db=require(_0xf00f('0x19'))['db'];function respondWithStatusCode(_0x2f2111,_0x2e2a08){_0x2e2a08=_0x2e2a08||0xcc;return function(_0x19de42){if(_0x19de42){return _0x2f2111[_0xf00f('0x1a')](_0x2e2a08);}return _0x2f2111[_0xf00f('0x1b')](_0x2e2a08)[_0xf00f('0x1c')]();};}function respondWithResult(_0x20340c,_0x1a3b73){_0x1a3b73=_0x1a3b73||0xc8;return function(_0x48b951){if(_0x48b951){return _0x20340c['status'](_0x1a3b73)[_0xf00f('0x1d')](_0x48b951);}};}function respondWithFilteredResult(_0x150190,_0x17cf70){return function(_0x14bfb1){if(_0x14bfb1){var _0x586819=_0x14bfb1['count'],_0x27cbdb=_0x17cf70[_0xf00f('0x1e')],_0x24129e=_0x17cf70[_0xf00f('0x1e')]+_0x17cf70[_0xf00f('0x1f')],_0x25add2;if(_0x24129e>=_0x586819){_0x24129e=_0x586819;_0x25add2=0xc8;}else{_0x25add2=0xce;}_0x150190[_0xf00f('0x1b')](_0x25add2);return _0x150190[_0xf00f('0x20')](_0xf00f('0x21'),_0x27cbdb+'-'+_0x24129e+'/'+_0x586819)['json'](_0x14bfb1);}return null;};}function patchUpdates(_0x339fbf){return function(_0xa0800c){try{jsonpatch[_0xf00f('0x22')](_0xa0800c,_0x339fbf,!![]);}catch(_0x539bbe){return BPromise['reject'](_0x539bbe);}return _0xa0800c['save']();};}function saveUpdates(_0x3ae14b,_0x713456){return function(_0xdf1b6){if(_0xdf1b6){return _0xdf1b6[_0xf00f('0x23')](_0x3ae14b)[_0xf00f('0x24')](function(_0x356c36){return _0x356c36;});}return null;};}function removeEntity(_0x503cb9,_0x45bc40){return function(_0x95cadd){if(_0x95cadd){return _0x95cadd[_0xf00f('0x25')]()['then'](function(){_0x503cb9['status'](0xcc)[_0xf00f('0x1c')]();});}};}function handleEntityNotFound(_0x30f7b2,_0x40a105){return function(_0xe47f26){if(!_0xe47f26){_0x30f7b2[_0xf00f('0x1a')](0x194);}return _0xe47f26;};}function handleError(_0x110b01,_0x11d407){_0x11d407=_0x11d407||0x1f4;return function(_0x363157){logger['error'](_0x363157['stack']);if(_0x363157['name']){delete _0x363157[_0xf00f('0x26')];}_0x110b01[_0xf00f('0x1b')](_0x11d407)[_0xf00f('0x27')](_0x363157);};}exports[_0xf00f('0x28')]=function(_0x3495e5,_0x5b01c9){var _0x30f6d4={},_0x38377a={},_0x315066={'count':0x0,'rows':[]};var _0x47cf48=_['map'](db[_0xf00f('0x29')][_0xf00f('0x2a')],function(_0x2b5563){return{'name':_0x2b5563[_0xf00f('0x2b')],'type':_0x2b5563['type'][_0xf00f('0x2c')]};});_0x38377a[_0xf00f('0x2d')]=_['map'](_0x47cf48,_0xf00f('0x26'));_0x38377a[_0xf00f('0x2e')]=_[_0xf00f('0x2f')](_0x3495e5[_0xf00f('0x2e')]);_0x38377a[_0xf00f('0x30')]=_[_0xf00f('0x31')](_0x38377a[_0xf00f('0x2d')],_0x38377a[_0xf00f('0x2e')]);_0x30f6d4['attributes']=_['intersection'](_0x38377a[_0xf00f('0x2d')],qs['fields'](_0x3495e5['query']['fields']));_0x30f6d4[_0xf00f('0x32')]=_0x30f6d4['attributes'][_0xf00f('0x33')]?_0x30f6d4[_0xf00f('0x32')]:_0x38377a['model'];if(!_0x3495e5['query'][_0xf00f('0x34')](_0xf00f('0x35'))){_0x30f6d4[_0xf00f('0x1f')]=qs[_0xf00f('0x1f')](_0x3495e5[_0xf00f('0x2e')][_0xf00f('0x1f')]);_0x30f6d4[_0xf00f('0x1e')]=qs[_0xf00f('0x1e')](_0x3495e5[_0xf00f('0x2e')][_0xf00f('0x1e')]);}_0x30f6d4['order']=qs['sort'](_0x3495e5['query'][_0xf00f('0x36')]);_0x30f6d4['where']=qs[_0xf00f('0x30')](_[_0xf00f('0x37')](_0x3495e5[_0xf00f('0x2e')],_0x38377a[_0xf00f('0x30')]));if(_0x3495e5['query']['filter']){_0x30f6d4[_0xf00f('0x38')]=_[_0xf00f('0x39')](_0x30f6d4[_0xf00f('0x38')],{'$or':_[_0xf00f('0x3a')](_0x47cf48,function(_0x47fccf){if(_0x47fccf[_0xf00f('0x3b')]!==_0xf00f('0x3c')){var _0x358dce={};_0x358dce[_0x47fccf['name']]={'$like':'%'+_0x3495e5[_0xf00f('0x2e')][_0xf00f('0x3d')]+'%'};return _0x358dce;}})});}_0x30f6d4=_['merge']({},_0x30f6d4,_0x3495e5['options']);var _0x3cdbf4={'where':_0x30f6d4[_0xf00f('0x38')]};return db[_0xf00f('0x29')]['count'](_0x3cdbf4)[_0xf00f('0x24')](function(_0x2256ae){_0x315066[_0xf00f('0x3e')]=_0x2256ae;if(_0x3495e5[_0xf00f('0x2e')][_0xf00f('0x3f')]){_0x30f6d4[_0xf00f('0x40')]=[{'all':!![]}];}return db['UserProfileResource'][_0xf00f('0x41')](_0x30f6d4);})[_0xf00f('0x24')](function(_0x1639dc){_0x315066[_0xf00f('0x42')]=_0x1639dc;return _0x315066;})[_0xf00f('0x24')](respondWithFilteredResult(_0x5b01c9,_0x30f6d4))['catch'](handleError(_0x5b01c9,null));};exports[_0xf00f('0x43')]=function(_0x6b269,_0x628f8c){var _0x21c2ec={'raw':![],'where':{'id':_0x6b269[_0xf00f('0x44')]['id']}},_0x45568d={};_0x45568d[_0xf00f('0x2d')]=_[_0xf00f('0x2f')](db[_0xf00f('0x29')]['rawAttributes']);_0x45568d['query']=_[_0xf00f('0x2f')](_0x6b269[_0xf00f('0x2e')]);_0x45568d[_0xf00f('0x30')]=_[_0xf00f('0x31')](_0x45568d['model'],_0x45568d[_0xf00f('0x2e')]);_0x21c2ec[_0xf00f('0x32')]=_[_0xf00f('0x31')](_0x45568d['model'],qs[_0xf00f('0x45')](_0x6b269['query'][_0xf00f('0x45')]));_0x21c2ec[_0xf00f('0x32')]=_0x21c2ec[_0xf00f('0x32')]['length']?_0x21c2ec[_0xf00f('0x32')]:_0x45568d['model'];if(_0x6b269[_0xf00f('0x2e')][_0xf00f('0x3f')]){_0x21c2ec[_0xf00f('0x40')]=[{'all':!![]}];}_0x21c2ec=_[_0xf00f('0x39')]({},_0x21c2ec,_0x6b269[_0xf00f('0x46')]);return db[_0xf00f('0x29')][_0xf00f('0x47')](_0x21c2ec)[_0xf00f('0x24')](handleEntityNotFound(_0x628f8c,null))[_0xf00f('0x24')](respondWithResult(_0x628f8c,null))['catch'](handleError(_0x628f8c,null));};exports[_0xf00f('0x48')]=function(_0x3e5b56,_0x2510c3){return db[_0xf00f('0x29')]['create'](_0x3e5b56[_0xf00f('0x49')],{})[_0xf00f('0x24')](respondWithResult(_0x2510c3,0xc9))[_0xf00f('0x4a')](handleError(_0x2510c3,null));};exports[_0xf00f('0x23')]=function(_0x2d66b4,_0x2bf857){if(_0x2d66b4[_0xf00f('0x49')]['id']){delete _0x2d66b4[_0xf00f('0x49')]['id'];}return db['UserProfileResource']['find']({'where':{'id':_0x2d66b4['params']['id']}})[_0xf00f('0x24')](handleEntityNotFound(_0x2bf857,null))['then'](saveUpdates(_0x2d66b4[_0xf00f('0x49')],null))[_0xf00f('0x24')](respondWithResult(_0x2bf857,null))['catch'](handleError(_0x2bf857,null));};exports[_0xf00f('0x25')]=function(_0x1cd7ca,_0x1900de){return db[_0xf00f('0x29')]['find']({'where':{'id':_0x1cd7ca[_0xf00f('0x44')]['id']}})[_0xf00f('0x24')](handleEntityNotFound(_0x1900de,null))['then'](removeEntity(_0x1900de,null))['catch'](handleError(_0x1900de,null));};exports['describe']=function(_0x464fdb,_0x1455e7){return db[_0xf00f('0x29')][_0xf00f('0x4b')]()[_0xf00f('0x24')](respondWithResult(_0x1455e7,null))['catch'](handleError(_0x1455e7,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index a600007..a42873e 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 _0x911f=['lodash','util','api','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x4b5eaf,_0x2cebe2){var _0x52df77=function(_0x5f208b){while(--_0x5f208b){_0x4b5eaf['push'](_0x4b5eaf['shift']());}};_0x52df77(++_0x2cebe2);}(_0x911f,0x11e));var _0xf911=function(_0x56a776,_0x41213a){_0x56a776=_0x56a776-0x0;var _0x2172f9=_0x911f[_0x56a776];return _0x2172f9;};'use strict';var _=require(_0xf911('0x0'));var util=require(_0xf911('0x1'));var logger=require('../../config/logger')(_0xf911('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf911('0x3'));var rimraf=require(_0xf911('0x4'));var config=require(_0xf911('0x5'));var attributes=require(_0xf911('0x6'));module[_0xf911('0x7')]=function(_0x1387af,_0x1b69e8){return _0x1387af[_0xf911('0x8')](_0xf911('0x9'),attributes,{'tableName':_0xf911('0xa'),'paranoid':![],'indexes':[{'name':_0xf911('0xb'),'fields':[_0xf911('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e9e=['define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x54c9ba,_0x3cea45){var _0xfd2aa1=function(_0x1e1d46){while(--_0x1e1d46){_0x54c9ba['push'](_0x54c9ba['shift']());}};_0xfd2aa1(++_0x3cea45);}(_0x3e9e,0x1e5));var _0xe3e9=function(_0x54d8ba,_0x54fdfe){_0x54d8ba=_0x54d8ba-0x0;var _0x54c5bb=_0x3e9e[_0x54d8ba];return _0x54c5bb;};'use strict';var _=require(_0xe3e9('0x0'));var util=require(_0xe3e9('0x1'));var logger=require(_0xe3e9('0x2'))(_0xe3e9('0x3'));var moment=require(_0xe3e9('0x4'));var BPromise=require(_0xe3e9('0x5'));var rp=require(_0xe3e9('0x6'));var fs=require('fs');var path=require(_0xe3e9('0x7'));var rimraf=require(_0xe3e9('0x8'));var config=require(_0xe3e9('0x9'));var attributes=require(_0xe3e9('0xa'));module['exports']=function(_0x40653e,_0x118171){return _0x40653e[_0xe3e9('0xb')](_0xe3e9('0xc'),attributes,{'tableName':_0xe3e9('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xe3e9('0xe'),_0xe3e9('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index e0af430..aa8b950 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 _0x3fe5=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x216095,_0x182057){var _0x5930d8=function(_0xf45745){while(--_0xf45745){_0x216095['push'](_0x216095['shift']());}};_0x5930d8(++_0x182057);}(_0x3fe5,0x1b8));var _0x53fe=function(_0x41a290,_0x7a22d9){_0x41a290=_0x41a290-0x0;var _0x4d2755=_0x3fe5[_0x41a290];return _0x4d2755;};'use strict';var _=require(_0x53fe('0x0'));var util=require('util');var moment=require(_0x53fe('0x1'));var BPromise=require(_0x53fe('0x2'));var rs=require(_0x53fe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53fe('0x4'))['db'];var utils=require(_0x53fe('0x5'));var logger=require(_0x53fe('0x6'))(_0x53fe('0x7'));var config=require('../../config/environment');var jayson=require(_0x53fe('0x8'));var client=jayson[_0x53fe('0x9')][_0x53fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2725a9,_0x550e43,_0x3afc9d){return new BPromise(function(_0xd1352f,_0x51e983){return client[_0x53fe('0xb')](_0x2725a9,_0x3afc9d)['then'](function(_0x34c7fa){logger[_0x53fe('0xc')](_0x53fe('0xd'),_0x550e43,_0x53fe('0xe'));logger[_0x53fe('0xf')](_0x53fe('0x10'),_0x550e43,'request\x20sent',JSON['stringify'](_0x34c7fa));if(_0x34c7fa[_0x53fe('0x11')]){if(_0x34c7fa['error'][_0x53fe('0x12')]===0x1f4){logger[_0x53fe('0x11')](_0x53fe('0xd'),_0x550e43,_0x34c7fa[_0x53fe('0x11')]['message']);return _0x51e983(_0x34c7fa[_0x53fe('0x11')][_0x53fe('0x13')]);}logger[_0x53fe('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x550e43,_0x34c7fa['error'][_0x53fe('0x13')]);return _0xd1352f(_0x34c7fa[_0x53fe('0x11')][_0x53fe('0x13')]);}else{logger['info'](_0x53fe('0xd'),_0x550e43,'request\x20sent');_0xd1352f(_0x34c7fa[_0x53fe('0x14')][_0x53fe('0x13')]);}})[_0x53fe('0x15')](function(_0x5ca1c9){logger[_0x53fe('0x11')](_0x53fe('0xd'),_0x550e43,_0x5ca1c9);_0x51e983(_0x5ca1c9);});});} \ No newline at end of file +var _0xec53=['../../config/environment','client','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x1c3297,_0xfc395e){var _0x29e4ae=function(_0x1bfcd9){while(--_0x1bfcd9){_0x1c3297['push'](_0x1c3297['shift']());}};_0x29e4ae(++_0xfc395e);}(_0xec53,0x174));var _0x3ec5=function(_0x3adb8b,_0x2ea12c){_0x3adb8b=_0x3adb8b-0x0;var _0x2f4c69=_0xec53[_0x3adb8b];return _0x2f4c69;};'use strict';var _=require(_0x3ec5('0x0'));var util=require(_0x3ec5('0x1'));var moment=require(_0x3ec5('0x2'));var BPromise=require('bluebird');var rs=require(_0x3ec5('0x3'));var fs=require('fs');var Redis=require(_0x3ec5('0x4'));var db=require(_0x3ec5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ec5('0x6'))(_0x3ec5('0x7'));var config=require(_0x3ec5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3ec5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29cdec,_0x3a5d24,_0x14ff51){return new BPromise(function(_0x5e9fbc,_0x64fad7){return client['request'](_0x29cdec,_0x14ff51)[_0x3ec5('0xa')](function(_0x5d203e){logger[_0x3ec5('0xb')](_0x3ec5('0xc'),_0x3a5d24,_0x3ec5('0xd'));logger[_0x3ec5('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x3a5d24,_0x3ec5('0xd'),JSON[_0x3ec5('0xf')](_0x5d203e));if(_0x5d203e[_0x3ec5('0x10')]){if(_0x5d203e['error'][_0x3ec5('0x11')]===0x1f4){logger['error'](_0x3ec5('0xc'),_0x3a5d24,_0x5d203e[_0x3ec5('0x10')]['message']);return _0x64fad7(_0x5d203e['error']['message']);}logger['error'](_0x3ec5('0xc'),_0x3a5d24,_0x5d203e[_0x3ec5('0x10')]['message']);return _0x5e9fbc(_0x5d203e[_0x3ec5('0x10')][_0x3ec5('0x12')]);}else{logger['info'](_0x3ec5('0xc'),_0x3a5d24,_0x3ec5('0xd'));_0x5e9fbc(_0x5d203e[_0x3ec5('0x13')][_0x3ec5('0x12')]);}})['catch'](function(_0x2e9bfb){logger[_0x3ec5('0x10')](_0x3ec5('0xc'),_0x3a5d24,_0x2e9bfb);_0x64fad7(_0x2e9bfb);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 1ccbc64..8c66b42 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 _0xa952=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','show','post','put','/:id','update','destroy','exports','multer','util','path'];(function(_0x4b9978,_0x58eb71){var _0x42f0e5=function(_0x4ff5dc){while(--_0x4ff5dc){_0x4b9978['push'](_0x4b9978['shift']());}};_0x42f0e5(++_0x58eb71);}(_0xa952,0x1b2));var _0x2a95=function(_0x129ad3,_0x19a3c6){_0x129ad3=_0x129ad3-0x0;var _0x36e751=_0xa952[_0x129ad3];return _0x36e751;};'use strict';var multer=require(_0x2a95('0x0'));var util=require(_0x2a95('0x1'));var path=require(_0x2a95('0x2'));var timeout=require(_0x2a95('0x3'));var express=require(_0x2a95('0x4'));var router=express[_0x2a95('0x5')]();var auth=require(_0x2a95('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2a95('0x7'));var controller=require(_0x2a95('0x8'));router[_0x2a95('0x9')]('/',auth[_0x2a95('0xa')](),controller['index']);router[_0x2a95('0x9')](_0x2a95('0xb'),auth[_0x2a95('0xa')](),controller['describe']);router[_0x2a95('0x9')]('/:id',auth[_0x2a95('0xa')](),controller[_0x2a95('0xc')]);router[_0x2a95('0xd')]('/',auth[_0x2a95('0xa')](),controller['create']);router[_0x2a95('0xe')](_0x2a95('0xf'),auth['isAuthenticated'](),controller[_0x2a95('0x10')]);router['delete'](_0x2a95('0xf'),auth[_0x2a95('0xa')](),controller[_0x2a95('0x11')]);module[_0x2a95('0x12')]=router; \ No newline at end of file +var _0x888e=['create','put','/:id','update','delete','util','path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x59e5cb,_0x2b209a){var _0x4e69c1=function(_0x5c77f5){while(--_0x5c77f5){_0x59e5cb['push'](_0x59e5cb['shift']());}};_0x4e69c1(++_0x2b209a);}(_0x888e,0xc0));var _0xe888=function(_0x188697,_0x1d006a){_0x188697=_0x188697-0x0;var _0x1dfa6c=_0x888e[_0x188697];return _0x1dfa6c;};'use strict';var multer=require('multer');var util=require(_0xe888('0x0'));var path=require(_0xe888('0x1'));var timeout=require('connect-timeout');var express=require(_0xe888('0x2'));var router=express[_0xe888('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe888('0x4'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0xe888('0x5')]('/',auth[_0xe888('0x6')](),controller[_0xe888('0x7')]);router[_0xe888('0x5')](_0xe888('0x8'),auth[_0xe888('0x6')](),controller[_0xe888('0x9')]);router[_0xe888('0x5')]('/:id',auth[_0xe888('0x6')](),controller[_0xe888('0xa')]);router[_0xe888('0xb')]('/',auth[_0xe888('0x6')](),controller[_0xe888('0xc')]);router[_0xe888('0xd')](_0xe888('0xe'),auth['isAuthenticated'](),controller[_0xe888('0xf')]);router[_0xe888('0x10')]('/:id',auth[_0xe888('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 6d13873..0117db8 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 _0xb95a=['sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x13789b,_0x47c524){var _0x3f7a8b=function(_0x5f869b){while(--_0x5f869b){_0x13789b['push'](_0x13789b['shift']());}};_0x3f7a8b(++_0x47c524);}(_0xb95a,0x13b));var _0xab95=function(_0xaa54f6,_0xff46cd){_0xaa54f6=_0xaa54f6-0x0;var _0x50f174=_0xb95a[_0xaa54f6];return _0x50f174;};'use strict';var Sequelize=require(_0xab95('0x0'));module[_0xab95('0x1')]={'name':{'type':Sequelize[_0xab95('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xab95('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xab95('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xab95('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xab95('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xab95('0x2')],'set':function(_0x10c25e){this[_0xab95('0x5')](_0xab95('0x6'),_0x10c25e?_0x10c25e[_0xab95('0x7')](''):[]);},'get':function(){return this['getDataValue'](_0xab95('0x6'))?this[_0xab95('0x8')](_0xab95('0x6'))['split'](''):[];}}}; \ No newline at end of file +var _0xda1c=['BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports','STRING','INTEGER'];(function(_0x4cf615,_0x2f5b44){var _0x22aeed=function(_0x38195c){while(--_0x38195c){_0x4cf615['push'](_0x4cf615['shift']());}};_0x22aeed(++_0x2f5b44);}(_0xda1c,0x68));var _0xcda1=function(_0x1f4f2f,_0xd082a5){_0x1f4f2f=_0x1f4f2f-0x0;var _0x5e7331=_0xda1c[_0x1f4f2f];return _0x5e7331;};'use strict';var Sequelize=require(_0xcda1('0x0'));module[_0xcda1('0x1')]={'name':{'type':Sequelize[_0xcda1('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xcda1('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xcda1('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xcda1('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xcda1('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xcda1('0x2')],'set':function(_0x3e44ab){this[_0xcda1('0x5')](_0xcda1('0x6'),_0x3e44ab?_0x3e44ab['join'](''):[]);},'get':function(){return this[_0xcda1('0x7')](_0xcda1('0x6'))?this[_0xcda1('0x7')](_0xcda1('0x6'))[_0xcda1('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 66bf251..d1d611e 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 _0xf7e7=['offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','UserProfileSection','includeAll','findAll','rows','catch','show','params','include','create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf7e7,0x182));var _0x7f7e=function(_0x3fd709,_0x3914d4){_0x3fd709=_0x3fd709-0x0;var _0x55533d=_0xf7e7[_0x3fd709];return _0x55533d;};'use strict';var pdf=require(_0x7f7e('0x0'));var emlformat=require(_0x7f7e('0x1'));var rimraf=require(_0x7f7e('0x2'));var zipdir=require(_0x7f7e('0x3'));var jsonpatch=require(_0x7f7e('0x4'));var rp=require(_0x7f7e('0x5'));var moment=require(_0x7f7e('0x6'));var BPromise=require(_0x7f7e('0x7'));var Mustache=require(_0x7f7e('0x8'));var util=require(_0x7f7e('0x9'));var path=require(_0x7f7e('0xa'));var sox=require(_0x7f7e('0xb'));var csv=require('to-csv');var ejs=require(_0x7f7e('0xc'));var fs=require('fs');var _=require(_0x7f7e('0xd'));var squel=require('squel');var crypto=require(_0x7f7e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7f7e('0xf'));var toCsv=require(_0x7f7e('0x10'));var querystring=require(_0x7f7e('0x11'));var Papa=require(_0x7f7e('0x12'));var Redis=require(_0x7f7e('0x13'));var authService=require(_0x7f7e('0x14'));var qs=require(_0x7f7e('0x15'));var as=require(_0x7f7e('0x16'));var hardwareService=require(_0x7f7e('0x17'));var logger=require(_0x7f7e('0x18'))(_0x7f7e('0x19'));var utils=require(_0x7f7e('0x1a'));var config=require(_0x7f7e('0x1b'));var db=require(_0x7f7e('0x1c'))['db'];function respondWithStatusCode(_0x5a3744,_0x2971d0){_0x2971d0=_0x2971d0||0xcc;return function(_0x2862be){if(_0x2862be){return _0x5a3744[_0x7f7e('0x1d')](_0x2971d0);}return _0x5a3744['status'](_0x2971d0)[_0x7f7e('0x1e')]();};}function respondWithResult(_0x31bab7,_0x428e51){_0x428e51=_0x428e51||0xc8;return function(_0x558dbc){if(_0x558dbc){return _0x31bab7[_0x7f7e('0x1f')](_0x428e51)[_0x7f7e('0x20')](_0x558dbc);}};}function respondWithFilteredResult(_0x2eff03,_0x15efc3){return function(_0x363ac9){if(_0x363ac9){var _0x3b5f28=_0x363ac9[_0x7f7e('0x21')],_0x2cba4d=_0x15efc3[_0x7f7e('0x22')],_0x50f342=_0x15efc3[_0x7f7e('0x22')]+_0x15efc3[_0x7f7e('0x23')],_0x100bda;if(_0x50f342>=_0x3b5f28){_0x50f342=_0x3b5f28;_0x100bda=0xc8;}else{_0x100bda=0xce;}_0x2eff03['status'](_0x100bda);return _0x2eff03[_0x7f7e('0x24')](_0x7f7e('0x25'),_0x2cba4d+'-'+_0x50f342+'/'+_0x3b5f28)[_0x7f7e('0x20')](_0x363ac9);}return null;};}function patchUpdates(_0x3419ad){return function(_0x5ee246){try{jsonpatch[_0x7f7e('0x26')](_0x5ee246,_0x3419ad,!![]);}catch(_0x1e611d){return BPromise[_0x7f7e('0x27')](_0x1e611d);}return _0x5ee246[_0x7f7e('0x28')]();};}function saveUpdates(_0x332182,_0x39b38e){return function(_0x215d1e){if(_0x215d1e){return _0x215d1e['update'](_0x332182)[_0x7f7e('0x29')](function(_0x29f911){return _0x29f911;});}return null;};}function removeEntity(_0x5624e5,_0xaa6b9c){return function(_0x5a6b11){if(_0x5a6b11){return _0x5a6b11[_0x7f7e('0x2a')]()[_0x7f7e('0x29')](function(){_0x5624e5['status'](0xcc)[_0x7f7e('0x1e')]();});}};}function handleEntityNotFound(_0x19bd1d,_0x247bdf){return function(_0x43f3a7){if(!_0x43f3a7){_0x19bd1d[_0x7f7e('0x1d')](0x194);}return _0x43f3a7;};}function handleError(_0x41eed4,_0x638064){_0x638064=_0x638064||0x1f4;return function(_0x45f950){logger[_0x7f7e('0x2b')](_0x45f950[_0x7f7e('0x2c')]);if(_0x45f950[_0x7f7e('0x2d')]){delete _0x45f950[_0x7f7e('0x2d')];}_0x41eed4['status'](_0x638064)[_0x7f7e('0x2e')](_0x45f950);};}exports[_0x7f7e('0x2f')]=function(_0x2a9ba8,_0x3b0b63){var _0x1f1f7e={},_0x2b09da={},_0x39ff2f={'count':0x0,'rows':[]};var _0x3f3b68=_['map'](db['UserProfileSection'][_0x7f7e('0x30')],function(_0x528d93){return{'name':_0x528d93[_0x7f7e('0x31')],'type':_0x528d93[_0x7f7e('0x32')][_0x7f7e('0x33')]};});_0x2b09da[_0x7f7e('0x34')]=_[_0x7f7e('0x35')](_0x3f3b68,_0x7f7e('0x2d'));_0x2b09da['query']=_[_0x7f7e('0x36')](_0x2a9ba8[_0x7f7e('0x37')]);_0x2b09da[_0x7f7e('0x38')]=_[_0x7f7e('0x39')](_0x2b09da[_0x7f7e('0x34')],_0x2b09da[_0x7f7e('0x37')]);_0x1f1f7e[_0x7f7e('0x3a')]=_[_0x7f7e('0x39')](_0x2b09da['model'],qs[_0x7f7e('0x3b')](_0x2a9ba8['query'][_0x7f7e('0x3b')]));_0x1f1f7e[_0x7f7e('0x3a')]=_0x1f1f7e[_0x7f7e('0x3a')][_0x7f7e('0x3c')]?_0x1f1f7e[_0x7f7e('0x3a')]:_0x2b09da[_0x7f7e('0x34')];if(!_0x2a9ba8[_0x7f7e('0x37')][_0x7f7e('0x3d')](_0x7f7e('0x3e'))){_0x1f1f7e['limit']=qs[_0x7f7e('0x23')](_0x2a9ba8['query'][_0x7f7e('0x23')]);_0x1f1f7e[_0x7f7e('0x22')]=qs['offset'](_0x2a9ba8[_0x7f7e('0x37')][_0x7f7e('0x22')]);}_0x1f1f7e[_0x7f7e('0x3f')]=qs[_0x7f7e('0x40')](_0x2a9ba8[_0x7f7e('0x37')][_0x7f7e('0x40')]);_0x1f1f7e[_0x7f7e('0x41')]=qs[_0x7f7e('0x38')](_[_0x7f7e('0x42')](_0x2a9ba8['query'],_0x2b09da[_0x7f7e('0x38')]));if(_0x2a9ba8['query'][_0x7f7e('0x43')]){_0x1f1f7e[_0x7f7e('0x41')]=_[_0x7f7e('0x44')](_0x1f1f7e['where'],{'$or':_[_0x7f7e('0x35')](_0x3f3b68,function(_0x5ec390){if(_0x5ec390[_0x7f7e('0x32')]!==_0x7f7e('0x45')){var _0x2499e7={};_0x2499e7[_0x5ec390[_0x7f7e('0x2d')]]={'$like':'%'+_0x2a9ba8[_0x7f7e('0x37')]['filter']+'%'};return _0x2499e7;}})});}_0x1f1f7e=_[_0x7f7e('0x44')]({},_0x1f1f7e,_0x2a9ba8[_0x7f7e('0x46')]);var _0x6a1253={'where':_0x1f1f7e[_0x7f7e('0x41')]};return db[_0x7f7e('0x47')][_0x7f7e('0x21')](_0x6a1253)[_0x7f7e('0x29')](function(_0x54281c){_0x39ff2f[_0x7f7e('0x21')]=_0x54281c;if(_0x2a9ba8[_0x7f7e('0x37')][_0x7f7e('0x48')]){_0x1f1f7e['include']=[{'all':!![]}];}return db[_0x7f7e('0x47')][_0x7f7e('0x49')](_0x1f1f7e);})[_0x7f7e('0x29')](function(_0xfd188c){_0x39ff2f[_0x7f7e('0x4a')]=_0xfd188c;return _0x39ff2f;})['then'](respondWithFilteredResult(_0x3b0b63,_0x1f1f7e))[_0x7f7e('0x4b')](handleError(_0x3b0b63,null));};exports[_0x7f7e('0x4c')]=function(_0x3ca126,_0x315afd){var _0x408d21={'raw':![],'where':{'id':_0x3ca126[_0x7f7e('0x4d')]['id']}},_0x265486={};_0x265486[_0x7f7e('0x34')]=_[_0x7f7e('0x36')](db[_0x7f7e('0x47')][_0x7f7e('0x30')]);_0x265486['query']=_[_0x7f7e('0x36')](_0x3ca126[_0x7f7e('0x37')]);_0x265486[_0x7f7e('0x38')]=_[_0x7f7e('0x39')](_0x265486[_0x7f7e('0x34')],_0x265486[_0x7f7e('0x37')]);_0x408d21[_0x7f7e('0x3a')]=_['intersection'](_0x265486['model'],qs[_0x7f7e('0x3b')](_0x3ca126[_0x7f7e('0x37')][_0x7f7e('0x3b')]));_0x408d21[_0x7f7e('0x3a')]=_0x408d21[_0x7f7e('0x3a')][_0x7f7e('0x3c')]?_0x408d21[_0x7f7e('0x3a')]:_0x265486[_0x7f7e('0x34')];if(_0x3ca126['query'][_0x7f7e('0x48')]){_0x408d21[_0x7f7e('0x4e')]=[{'all':!![]}];}_0x408d21=_[_0x7f7e('0x44')]({},_0x408d21,_0x3ca126['options']);return db['UserProfileSection']['find'](_0x408d21)[_0x7f7e('0x29')](handleEntityNotFound(_0x315afd,null))[_0x7f7e('0x29')](respondWithResult(_0x315afd,null))['catch'](handleError(_0x315afd,null));};exports[_0x7f7e('0x4f')]=function(_0x1f7835,_0x47572c){return db[_0x7f7e('0x47')][_0x7f7e('0x4f')](_0x1f7835[_0x7f7e('0x50')],{})[_0x7f7e('0x29')](respondWithResult(_0x47572c,0xc9))['catch'](handleError(_0x47572c,null));};exports[_0x7f7e('0x51')]=function(_0xc88ede,_0x53f936){if(_0xc88ede[_0x7f7e('0x50')]['id']){delete _0xc88ede[_0x7f7e('0x50')]['id'];}return db[_0x7f7e('0x47')][_0x7f7e('0x52')]({'where':{'id':_0xc88ede[_0x7f7e('0x4d')]['id']}})[_0x7f7e('0x29')](handleEntityNotFound(_0x53f936,null))[_0x7f7e('0x29')](saveUpdates(_0xc88ede[_0x7f7e('0x50')],null))[_0x7f7e('0x29')](respondWithResult(_0x53f936,null))[_0x7f7e('0x4b')](handleError(_0x53f936,null));};exports[_0x7f7e('0x2a')]=function(_0x7ea95e,_0x42827c){return db[_0x7f7e('0x47')][_0x7f7e('0x52')]({'where':{'id':_0x7ea95e['params']['id']}})['then'](handleEntityNotFound(_0x42827c,null))[_0x7f7e('0x29')](removeEntity(_0x42827c,null))[_0x7f7e('0x4b')](handleError(_0x42827c,null));};exports[_0x7f7e('0x53')]=function(_0x156a31,_0x1134f2){return db['UserProfileSection']['describe']()['then'](respondWithResult(_0x1134f2,null))[_0x7f7e('0x4b')](handleError(_0x1134f2,null));}; \ No newline at end of file +var _0x8335=['sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','fieldName','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x1d4310,_0x454349){var _0x2c8e13=function(_0x5d42da){while(--_0x5d42da){_0x1d4310['push'](_0x1d4310['shift']());}};_0x2c8e13(++_0x454349);}(_0x8335,0x190));var _0x5833=function(_0x4859c8,_0x2ca737){_0x4859c8=_0x4859c8-0x0;var _0x596d6c=_0x8335[_0x4859c8];return _0x596d6c;};'use strict';var pdf=require(_0x5833('0x0'));var emlformat=require(_0x5833('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5833('0x2'));var jsonpatch=require(_0x5833('0x3'));var rp=require(_0x5833('0x4'));var moment=require(_0x5833('0x5'));var BPromise=require(_0x5833('0x6'));var Mustache=require(_0x5833('0x7'));var util=require(_0x5833('0x8'));var path=require(_0x5833('0x9'));var sox=require(_0x5833('0xa'));var csv=require(_0x5833('0xb'));var ejs=require(_0x5833('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5833('0xd'));var crypto=require(_0x5833('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5833('0xf'));var toCsv=require(_0x5833('0xb'));var querystring=require(_0x5833('0x10'));var Papa=require('papaparse');var Redis=require(_0x5833('0x11'));var authService=require(_0x5833('0x12'));var qs=require(_0x5833('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5833('0x14'));var logger=require(_0x5833('0x15'))(_0x5833('0x16'));var utils=require(_0x5833('0x17'));var config=require(_0x5833('0x18'));var db=require(_0x5833('0x19'))['db'];function respondWithStatusCode(_0x3e7037,_0x11777d){_0x11777d=_0x11777d||0xcc;return function(_0x3ef63f){if(_0x3ef63f){return _0x3e7037[_0x5833('0x1a')](_0x11777d);}return _0x3e7037[_0x5833('0x1b')](_0x11777d)['end']();};}function respondWithResult(_0x33d654,_0x4c0309){_0x4c0309=_0x4c0309||0xc8;return function(_0x2b76b2){if(_0x2b76b2){return _0x33d654[_0x5833('0x1b')](_0x4c0309)[_0x5833('0x1c')](_0x2b76b2);}};}function respondWithFilteredResult(_0x3ac5ba,_0x4adf82){return function(_0x50201f){if(_0x50201f){var _0x4ee570=_0x50201f[_0x5833('0x1d')],_0xf34d06=_0x4adf82[_0x5833('0x1e')],_0x25760c=_0x4adf82[_0x5833('0x1e')]+_0x4adf82['limit'],_0x115e76;if(_0x25760c>=_0x4ee570){_0x25760c=_0x4ee570;_0x115e76=0xc8;}else{_0x115e76=0xce;}_0x3ac5ba[_0x5833('0x1b')](_0x115e76);return _0x3ac5ba[_0x5833('0x1f')](_0x5833('0x20'),_0xf34d06+'-'+_0x25760c+'/'+_0x4ee570)[_0x5833('0x1c')](_0x50201f);}return null;};}function patchUpdates(_0x2bfa91){return function(_0x1ba34d){try{jsonpatch['apply'](_0x1ba34d,_0x2bfa91,!![]);}catch(_0x538ffb){return BPromise[_0x5833('0x21')](_0x538ffb);}return _0x1ba34d[_0x5833('0x22')]();};}function saveUpdates(_0x55d879,_0x4de2f7){return function(_0x1f4e88){if(_0x1f4e88){return _0x1f4e88[_0x5833('0x23')](_0x55d879)[_0x5833('0x24')](function(_0xdfa458){return _0xdfa458;});}return null;};}function removeEntity(_0x34060e,_0x1094d6){return function(_0x331b4c){if(_0x331b4c){return _0x331b4c[_0x5833('0x25')]()[_0x5833('0x24')](function(){_0x34060e[_0x5833('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b6716,_0x2367c4){return function(_0x4d4e3c){if(!_0x4d4e3c){_0x3b6716[_0x5833('0x1a')](0x194);}return _0x4d4e3c;};}function handleError(_0x19f929,_0x496033){_0x496033=_0x496033||0x1f4;return function(_0x102ff7){logger[_0x5833('0x26')](_0x102ff7[_0x5833('0x27')]);if(_0x102ff7[_0x5833('0x28')]){delete _0x102ff7[_0x5833('0x28')];}_0x19f929[_0x5833('0x1b')](_0x496033)[_0x5833('0x29')](_0x102ff7);};}exports[_0x5833('0x2a')]=function(_0x3b07f9,_0x5d9905){var _0x2c197e={},_0x955231={},_0x3d3452={'count':0x0,'rows':[]};var _0x4a4fc3=_[_0x5833('0x2b')](db[_0x5833('0x2c')]['rawAttributes'],function(_0x208724){return{'name':_0x208724[_0x5833('0x2d')],'type':_0x208724['type']['key']};});_0x955231[_0x5833('0x2e')]=_[_0x5833('0x2b')](_0x4a4fc3,_0x5833('0x28'));_0x955231[_0x5833('0x2f')]=_['keys'](_0x3b07f9['query']);_0x955231['filters']=_['intersection'](_0x955231[_0x5833('0x2e')],_0x955231[_0x5833('0x2f')]);_0x2c197e[_0x5833('0x30')]=_[_0x5833('0x31')](_0x955231['model'],qs[_0x5833('0x32')](_0x3b07f9[_0x5833('0x2f')][_0x5833('0x32')]));_0x2c197e[_0x5833('0x30')]=_0x2c197e[_0x5833('0x30')][_0x5833('0x33')]?_0x2c197e[_0x5833('0x30')]:_0x955231[_0x5833('0x2e')];if(!_0x3b07f9['query'][_0x5833('0x34')](_0x5833('0x35'))){_0x2c197e['limit']=qs[_0x5833('0x36')](_0x3b07f9[_0x5833('0x2f')][_0x5833('0x36')]);_0x2c197e['offset']=qs[_0x5833('0x1e')](_0x3b07f9[_0x5833('0x2f')]['offset']);}_0x2c197e[_0x5833('0x37')]=qs[_0x5833('0x38')](_0x3b07f9['query'][_0x5833('0x38')]);_0x2c197e[_0x5833('0x39')]=qs[_0x5833('0x3a')](_[_0x5833('0x3b')](_0x3b07f9[_0x5833('0x2f')],_0x955231[_0x5833('0x3a')]));if(_0x3b07f9[_0x5833('0x2f')][_0x5833('0x3c')]){_0x2c197e['where']=_['merge'](_0x2c197e[_0x5833('0x39')],{'$or':_[_0x5833('0x2b')](_0x4a4fc3,function(_0x58bc45){if(_0x58bc45[_0x5833('0x3d')]!==_0x5833('0x3e')){var _0x458ecb={};_0x458ecb[_0x58bc45[_0x5833('0x28')]]={'$like':'%'+_0x3b07f9[_0x5833('0x2f')][_0x5833('0x3c')]+'%'};return _0x458ecb;}})});}_0x2c197e=_[_0x5833('0x3f')]({},_0x2c197e,_0x3b07f9[_0x5833('0x40')]);var _0x9c2c7f={'where':_0x2c197e[_0x5833('0x39')]};return db[_0x5833('0x2c')][_0x5833('0x1d')](_0x9c2c7f)['then'](function(_0x3daaa1){_0x3d3452[_0x5833('0x1d')]=_0x3daaa1;if(_0x3b07f9[_0x5833('0x2f')][_0x5833('0x41')]){_0x2c197e[_0x5833('0x42')]=[{'all':!![]}];}return db[_0x5833('0x2c')][_0x5833('0x43')](_0x2c197e);})[_0x5833('0x24')](function(_0x49b686){_0x3d3452['rows']=_0x49b686;return _0x3d3452;})[_0x5833('0x24')](respondWithFilteredResult(_0x5d9905,_0x2c197e))[_0x5833('0x44')](handleError(_0x5d9905,null));};exports[_0x5833('0x45')]=function(_0x2af47b,_0x42c02b){var _0xc8b992={'raw':![],'where':{'id':_0x2af47b[_0x5833('0x46')]['id']}},_0x5b9bb4={};_0x5b9bb4[_0x5833('0x2e')]=_['keys'](db[_0x5833('0x2c')]['rawAttributes']);_0x5b9bb4['query']=_[_0x5833('0x47')](_0x2af47b['query']);_0x5b9bb4[_0x5833('0x3a')]=_[_0x5833('0x31')](_0x5b9bb4[_0x5833('0x2e')],_0x5b9bb4[_0x5833('0x2f')]);_0xc8b992[_0x5833('0x30')]=_['intersection'](_0x5b9bb4[_0x5833('0x2e')],qs[_0x5833('0x32')](_0x2af47b[_0x5833('0x2f')]['fields']));_0xc8b992[_0x5833('0x30')]=_0xc8b992[_0x5833('0x30')][_0x5833('0x33')]?_0xc8b992[_0x5833('0x30')]:_0x5b9bb4[_0x5833('0x2e')];if(_0x2af47b[_0x5833('0x2f')]['includeAll']){_0xc8b992[_0x5833('0x42')]=[{'all':!![]}];}_0xc8b992=_['merge']({},_0xc8b992,_0x2af47b[_0x5833('0x40')]);return db[_0x5833('0x2c')]['find'](_0xc8b992)['then'](handleEntityNotFound(_0x42c02b,null))['then'](respondWithResult(_0x42c02b,null))[_0x5833('0x44')](handleError(_0x42c02b,null));};exports['create']=function(_0x44a1ba,_0x3b9575){return db['UserProfileSection'][_0x5833('0x48')](_0x44a1ba[_0x5833('0x49')],{})['then'](respondWithResult(_0x3b9575,0xc9))['catch'](handleError(_0x3b9575,null));};exports[_0x5833('0x23')]=function(_0x4f503c,_0x24d069){if(_0x4f503c[_0x5833('0x49')]['id']){delete _0x4f503c[_0x5833('0x49')]['id'];}return db[_0x5833('0x2c')]['find']({'where':{'id':_0x4f503c['params']['id']}})[_0x5833('0x24')](handleEntityNotFound(_0x24d069,null))[_0x5833('0x24')](saveUpdates(_0x4f503c[_0x5833('0x49')],null))[_0x5833('0x24')](respondWithResult(_0x24d069,null))[_0x5833('0x44')](handleError(_0x24d069,null));};exports[_0x5833('0x25')]=function(_0x1b87e2,_0x103b87){return db[_0x5833('0x2c')][_0x5833('0x4a')]({'where':{'id':_0x1b87e2[_0x5833('0x46')]['id']}})[_0x5833('0x24')](handleEntityNotFound(_0x103b87,null))[_0x5833('0x24')](removeEntity(_0x103b87,null))[_0x5833('0x44')](handleError(_0x103b87,null));};exports[_0x5833('0x4b')]=function(_0x5f54e2,_0x123e32){return db[_0x5833('0x2c')]['describe']()[_0x5833('0x24')](respondWithResult(_0x123e32,null))[_0x5833('0x44')](handleError(_0x123e32,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 375d940..706debe 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 _0xf591=['bluebird','request-promise','path','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','lodash','util','../../config/logger','api'];(function(_0x2d2869,_0x184ed0){var _0x51ff5a=function(_0xd0076b){while(--_0xd0076b){_0x2d2869['push'](_0x2d2869['shift']());}};_0x51ff5a(++_0x184ed0);}(_0xf591,0x128));var _0x1f59=function(_0x3d93de,_0x2da4bd){_0x3d93de=_0x3d93de-0x0;var _0xedef58=_0xf591[_0x3d93de];return _0xedef58;};'use strict';var _=require(_0x1f59('0x0'));var util=require(_0x1f59('0x1'));var logger=require(_0x1f59('0x2'))(_0x1f59('0x3'));var moment=require('moment');var BPromise=require(_0x1f59('0x4'));var rp=require(_0x1f59('0x5'));var fs=require('fs');var path=require(_0x1f59('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0x1f59('0x7')]=function(_0x5d2a8b,_0x5f3d53){return _0x5d2a8b[_0x1f59('0x8')](_0x1f59('0x9'),attributes,{'tableName':_0x1f59('0xa'),'paranoid':![],'indexes':[{'name':_0x1f59('0xb'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3fb=['./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3f4a3c,_0x488f9e){var _0x5b3b57=function(_0x10aad7){while(--_0x10aad7){_0x3f4a3c['push'](_0x3f4a3c['shift']());}};_0x5b3b57(++_0x488f9e);}(_0xf3fb,0x13e));var _0xbf3f=function(_0x293274,_0x1f9041){_0x293274=_0x293274-0x0;var _0x21730e=_0xf3fb[_0x293274];return _0x21730e;};'use strict';var _=require(_0xbf3f('0x0'));var util=require('util');var logger=require(_0xbf3f('0x1'))(_0xbf3f('0x2'));var moment=require('moment');var BPromise=require(_0xbf3f('0x3'));var rp=require(_0xbf3f('0x4'));var fs=require('fs');var path=require(_0xbf3f('0x5'));var rimraf=require(_0xbf3f('0x6'));var config=require('../../config/environment');var attributes=require(_0xbf3f('0x7'));module['exports']=function(_0x449854,_0x127480){return _0x449854[_0xbf3f('0x8')](_0xbf3f('0x9'),attributes,{'tableName':_0xbf3f('0xa'),'paranoid':![],'indexes':[{'name':_0xbf3f('0xb'),'fields':[_0xbf3f('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 30f3f71..f0daf9a 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 _0xfb50=['request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xfb50,0x1ec));var _0x0fb5=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0xfb50[_0x1ed116];return _0x574066;};'use strict';var _=require(_0x0fb5('0x0'));var util=require(_0x0fb5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0fb5('0x2'));var fs=require('fs');var Redis=require(_0x0fb5('0x3'));var db=require(_0x0fb5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0fb5('0x5'));var config=require(_0x0fb5('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0fb5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23ea09,_0xb2691b,_0x5ddc62){return new BPromise(function(_0x13c81c,_0x41e446){return client[_0x0fb5('0x8')](_0x23ea09,_0x5ddc62)[_0x0fb5('0x9')](function(_0x3ce708){logger[_0x0fb5('0xa')](_0x0fb5('0xb'),_0xb2691b,_0x0fb5('0xc'));logger['debug'](_0x0fb5('0xd'),_0xb2691b,_0x0fb5('0xc'),JSON[_0x0fb5('0xe')](_0x3ce708));if(_0x3ce708['error']){if(_0x3ce708[_0x0fb5('0xf')][_0x0fb5('0x10')]===0x1f4){logger[_0x0fb5('0xf')]('UserProfileSection,\x20%s,\x20%s',_0xb2691b,_0x3ce708[_0x0fb5('0xf')][_0x0fb5('0x11')]);return _0x41e446(_0x3ce708[_0x0fb5('0xf')][_0x0fb5('0x11')]);}logger[_0x0fb5('0xf')](_0x0fb5('0xb'),_0xb2691b,_0x3ce708[_0x0fb5('0xf')][_0x0fb5('0x11')]);return _0x13c81c(_0x3ce708[_0x0fb5('0xf')]['message']);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0xb2691b,_0x0fb5('0xc'));_0x13c81c(_0x3ce708[_0x0fb5('0x12')][_0x0fb5('0x11')]);}})[_0x0fb5('0x13')](function(_0xb3a437){logger[_0x0fb5('0xf')](_0x0fb5('0xb'),_0xb2691b,_0xb3a437);_0x41e446(_0xb3a437);});});} \ No newline at end of file +var _0x2d4c=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','stringify','error','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d4c,0x92));var _0xc2d4=function(_0x58ee49,_0x267760){_0x58ee49=_0x58ee49-0x0;var _0x465572=_0x2d4c[_0x58ee49];return _0x465572;};'use strict';var _=require(_0xc2d4('0x0'));var util=require(_0xc2d4('0x1'));var moment=require(_0xc2d4('0x2'));var BPromise=require(_0xc2d4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2d4('0x4'));var db=require(_0xc2d4('0x5'))['db'];var utils=require(_0xc2d4('0x6'));var logger=require(_0xc2d4('0x7'))(_0xc2d4('0x8'));var config=require(_0xc2d4('0x9'));var jayson=require(_0xc2d4('0xa'));var client=jayson[_0xc2d4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b0a47,_0x14b53e,_0x1773d4){return new BPromise(function(_0x279a66,_0x2b19e3){return client[_0xc2d4('0xc')](_0x4b0a47,_0x1773d4)['then'](function(_0x26743b){logger[_0xc2d4('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x14b53e,_0xc2d4('0xe'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x14b53e,_0xc2d4('0xe'),JSON[_0xc2d4('0xf')](_0x26743b));if(_0x26743b['error']){if(_0x26743b[_0xc2d4('0x10')]['code']===0x1f4){logger['error'](_0xc2d4('0x11'),_0x14b53e,_0x26743b[_0xc2d4('0x10')]['message']);return _0x2b19e3(_0x26743b[_0xc2d4('0x10')][_0xc2d4('0x12')]);}logger[_0xc2d4('0x10')](_0xc2d4('0x11'),_0x14b53e,_0x26743b['error']['message']);return _0x279a66(_0x26743b[_0xc2d4('0x10')][_0xc2d4('0x12')]);}else{logger[_0xc2d4('0xd')](_0xc2d4('0x11'),_0x14b53e,_0xc2d4('0xe'));_0x279a66(_0x26743b[_0xc2d4('0x13')][_0xc2d4('0x12')]);}})[_0xc2d4('0x14')](function(_0x4d9caf){logger[_0xc2d4('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x14b53e,_0x4d9caf);_0x2b19e3(_0x4d9caf);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index cb890b3..b486914 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 _0xf326=['../../components/auth/service','exports','multer','util','path','connect-timeout','Router'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf326,0xa3));var _0x6f32=function(_0x393438,_0x4883a6){_0x393438=_0x393438-0x0;var _0x2a0986=_0xf326[_0x393438];return _0x2a0986;};'use strict';var multer=require(_0x6f32('0x0'));var util=require(_0x6f32('0x1'));var path=require(_0x6f32('0x2'));var timeout=require(_0x6f32('0x3'));var express=require('express');var router=express[_0x6f32('0x4')]();var auth=require(_0x6f32('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x6f32('0x6')]=router; \ No newline at end of file +var _0x4572=['../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4ac3bb,_0x557ddc){var _0x5c6da4=function(_0x3c0219){while(--_0x3c0219){_0x4ac3bb['push'](_0x4ac3bb['shift']());}};_0x5c6da4(++_0x557ddc);}(_0x4572,0x150));var _0x2457=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x4572[_0x4bf96c];return _0x281d09;};'use strict';var multer=require(_0x2457('0x0'));var util=require(_0x2457('0x1'));var path=require('path');var timeout=require(_0x2457('0x2'));var express=require(_0x2457('0x3'));var router=express[_0x2457('0x4')]();var auth=require(_0x2457('0x5'));var interaction=require(_0x2457('0x6'));var config=require(_0x2457('0x7'));module[_0x2457('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 3bf17a5..790c6a3 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 _0xb10b=['sequelize','INTEGER'];(function(_0x95de30,_0x13156f){var _0x164bf7=function(_0x464f06){while(--_0x464f06){_0x95de30['push'](_0x95de30['shift']());}};_0x164bf7(++_0x13156f);}(_0xb10b,0x12a));var _0xbb10=function(_0x1e4e1a,_0x3bdb4a){_0x1e4e1a=_0x1e4e1a-0x0;var _0x462e08=_0xb10b[_0x1e4e1a];return _0x462e08;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x57c601,_0x3293a2){var _0x10d301=function(_0x37c889){while(--_0x37c889){_0x57c601['push'](_0x57c601['shift']());}};_0x10d301(++_0x3293a2);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index f2d8c64..5450986 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 _0xcc3b=['user_has_sms_queues','lodash','util','moment','request-promise','path','./userSmsQueue.attributes','define','UserSmsQueue'];(function(_0x236cd0,_0x48b4ea){var _0x588e0d=function(_0x2f4f9b){while(--_0x2f4f9b){_0x236cd0['push'](_0x236cd0['shift']());}};_0x588e0d(++_0x48b4ea);}(_0xcc3b,0xac));var _0xbcc3=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xcc3b[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xbcc3('0x0'));var util=require(_0xbcc3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbcc3('0x2'));var BPromise=require('bluebird');var rp=require(_0xbcc3('0x3'));var fs=require('fs');var path=require(_0xbcc3('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbcc3('0x5'));module['exports']=function(_0x345ab6,_0x37f6f6){return _0x345ab6[_0xbcc3('0x6')](_0xbcc3('0x7'),attributes,{'tableName':_0xbcc3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0118=['request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x311443,_0x168caa){var _0x29d194=function(_0x994433){while(--_0x994433){_0x311443['push'](_0x311443['shift']());}};_0x29d194(++_0x168caa);}(_0x0118,0x171));var _0x8011=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0118[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8011('0x0'));var util=require(_0x8011('0x1'));var logger=require(_0x8011('0x2'))(_0x8011('0x3'));var moment=require(_0x8011('0x4'));var BPromise=require(_0x8011('0x5'));var rp=require(_0x8011('0x6'));var fs=require('fs');var path=require(_0x8011('0x7'));var rimraf=require(_0x8011('0x8'));var config=require(_0x8011('0x9'));var attributes=require(_0x8011('0xa'));module[_0x8011('0xb')]=function(_0x482835,_0x4debc2){return _0x482835[_0x8011('0xc')](_0x8011('0xd'),attributes,{'tableName':_0x8011('0xe'),'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 4bd0b42..eb49d35 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 _0x9f65=['../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','info','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x9f65,0x163));var _0x59f6=function(_0x3f5f08,_0x1ccd7f){_0x3f5f08=_0x3f5f08-0x0;var _0x566dd9=_0x9f65[_0x3f5f08];return _0x566dd9;};'use strict';var _=require(_0x59f6('0x0'));var util=require(_0x59f6('0x1'));var moment=require(_0x59f6('0x2'));var BPromise=require(_0x59f6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59f6('0x4'));var db=require(_0x59f6('0x5'))['db'];var utils=require(_0x59f6('0x6'));var logger=require('../../config/logger')(_0x59f6('0x7'));var config=require('../../config/environment');var jayson=require(_0x59f6('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1cd207,_0x4f222c,_0x3d8215){return new BPromise(function(_0x829382,_0xa5deb4){return client[_0x59f6('0x9')](_0x1cd207,_0x3d8215)[_0x59f6('0xa')](function(_0x5defc1){logger[_0x59f6('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x4f222c,_0x59f6('0xc'));logger['debug'](_0x59f6('0xd'),_0x4f222c,'request\x20sent',JSON[_0x59f6('0xe')](_0x5defc1));if(_0x5defc1['error']){if(_0x5defc1[_0x59f6('0xf')][_0x59f6('0x10')]===0x1f4){logger['error'](_0x59f6('0x11'),_0x4f222c,_0x5defc1[_0x59f6('0xf')][_0x59f6('0x12')]);return _0xa5deb4(_0x5defc1[_0x59f6('0xf')][_0x59f6('0x12')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x4f222c,_0x5defc1[_0x59f6('0xf')][_0x59f6('0x12')]);return _0x829382(_0x5defc1[_0x59f6('0xf')][_0x59f6('0x12')]);}else{logger[_0x59f6('0xb')](_0x59f6('0x11'),_0x4f222c,'request\x20sent');_0x829382(_0x5defc1[_0x59f6('0x13')]['message']);}})['catch'](function(_0x3998d9){logger[_0x59f6('0xf')](_0x59f6('0x11'),_0x4f222c,_0x3998d9);_0xa5deb4(_0x3998d9);});});} \ No newline at end of file +var _0x2918=['then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x2fbd50,_0x3c8aa6){var _0x187163=function(_0xe28d0b){while(--_0xe28d0b){_0x2fbd50['push'](_0x2fbd50['shift']());}};_0x187163(++_0x3c8aa6);}(_0x2918,0xb1));var _0x8291=function(_0x204d66,_0x2b0b7c){_0x204d66=_0x204d66-0x0;var _0x14c5a5=_0x2918[_0x204d66];return _0x14c5a5;};'use strict';var _=require(_0x8291('0x0'));var util=require('util');var moment=require(_0x8291('0x1'));var BPromise=require(_0x8291('0x2'));var rs=require(_0x8291('0x3'));var fs=require('fs');var Redis=require(_0x8291('0x4'));var db=require(_0x8291('0x5'))['db'];var utils=require(_0x8291('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8291('0x7'));var jayson=require(_0x8291('0x8'));var client=jayson[_0x8291('0x9')][_0x8291('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39366b,_0x208da6,_0x17108e){return new BPromise(function(_0x184cb6,_0x277eb9){return client[_0x8291('0xb')](_0x39366b,_0x17108e)[_0x8291('0xc')](function(_0x878417){logger['info'](_0x8291('0xd'),_0x208da6,_0x8291('0xe'));logger[_0x8291('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x208da6,'request\x20sent',JSON['stringify'](_0x878417));if(_0x878417[_0x8291('0x10')]){if(_0x878417[_0x8291('0x10')][_0x8291('0x11')]===0x1f4){logger[_0x8291('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x208da6,_0x878417[_0x8291('0x10')][_0x8291('0x12')]);return _0x277eb9(_0x878417[_0x8291('0x10')][_0x8291('0x12')]);}logger[_0x8291('0x10')](_0x8291('0xd'),_0x208da6,_0x878417[_0x8291('0x10')][_0x8291('0x12')]);return _0x184cb6(_0x878417['error'][_0x8291('0x12')]);}else{logger['info'](_0x8291('0xd'),_0x208da6,_0x8291('0xe'));_0x184cb6(_0x878417[_0x8291('0x13')][_0x8291('0x12')]);}})[_0x8291('0x14')](function(_0x43c690){logger[_0x8291('0x10')](_0x8291('0xd'),_0x208da6,_0x43c690);_0x277eb9(_0x43c690);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 6f16f74..001db32 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 _0xbd5a=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xbd5a,0x1d0));var _0xabd5=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xbd5a[_0x1694f5];return _0x5b4321;};'use strict';var multer=require(_0xabd5('0x0'));var util=require(_0xabd5('0x1'));var path=require(_0xabd5('0x2'));var timeout=require(_0xabd5('0x3'));var express=require(_0xabd5('0x4'));var router=express[_0xabd5('0x5')]();var auth=require(_0xabd5('0x6'));var interaction=require(_0xabd5('0x7'));var config=require(_0xabd5('0x8'));module[_0xabd5('0x9')]=router; \ No newline at end of file +var _0x4b4a=['../../config/environment','exports','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x38250f,_0xa18e96){var _0x425808=function(_0x23a11a){while(--_0x23a11a){_0x38250f['push'](_0x38250f['shift']());}};_0x425808(++_0xa18e96);}(_0x4b4a,0x9c));var _0xa4b4=function(_0x314ee0,_0x2c854d){_0x314ee0=_0x314ee0-0x0;var _0x2c618a=_0x4b4a[_0x314ee0];return _0x2c618a;};'use strict';var multer=require('multer');var util=require(_0xa4b4('0x0'));var path=require(_0xa4b4('0x1'));var timeout=require(_0xa4b4('0x2'));var express=require('express');var router=express[_0xa4b4('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa4b4('0x4'));var config=require(_0xa4b4('0x5'));module[_0xa4b4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 1080126..ba92d79 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 _0xbaf0=['exports','INTEGER'];(function(_0x255b94,_0x352b45){var _0xc5806b=function(_0x530e79){while(--_0x530e79){_0x255b94['push'](_0x255b94['shift']());}};_0xc5806b(++_0x352b45);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x3e2c88,_0x591433){var _0x55655f=function(_0x46f89a){while(--_0x46f89a){_0x3e2c88['push'](_0x3e2c88['shift']());}};_0x55655f(++_0x591433);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index e9de41d..6d87bc1 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 _0xc978=['api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger'];(function(_0x33adbf,_0x204f85){var _0x4f0f90=function(_0x35a7eb){while(--_0x35a7eb){_0x33adbf['push'](_0x33adbf['shift']());}};_0x4f0f90(++_0x204f85);}(_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':!![]});}; \ No newline at end of file +var _0x4c6d=['moment','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash','util','../../config/logger','api'];(function(_0x46f6c6,_0x5f337d){var _0x462bb8=function(_0x30c708){while(--_0x30c708){_0x46f6c6['push'](_0x46f6c6['shift']());}};_0x462bb8(++_0x5f337d);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x94bd23,_0x2c306a){_0x94bd23=_0x94bd23-0x0;var _0x5d72f2=_0x4c6d[_0x94bd23];return _0x5d72f2;};'use strict';var _=require(_0xd4c6('0x0'));var util=require(_0xd4c6('0x1'));var logger=require(_0xd4c6('0x2'))(_0xd4c6('0x3'));var moment=require(_0xd4c6('0x4'));var BPromise=require('bluebird');var rp=require(_0xd4c6('0x5'));var fs=require('fs');var path=require(_0xd4c6('0x6'));var rimraf=require(_0xd4c6('0x7'));var config=require('../../config/environment');var attributes=require(_0xd4c6('0x8'));module[_0xd4c6('0x9')]=function(_0x56279c,_0x182671){return _0x56279c[_0xd4c6('0xa')](_0xd4c6('0xb'),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 6ed10ad..665ad73 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 _0x5fbd=['../../config/environment','client','http','request','info','request\x20sent','debug','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x60a8fd,_0x52ffcb){var _0x2face8=function(_0x1cd9b1){while(--_0x1cd9b1){_0x60a8fd['push'](_0x60a8fd['shift']());}};_0x2face8(++_0x52ffcb);}(_0x5fbd,0x1c5));var _0xd5fb=function(_0x736e7e,_0x5deb56){_0x736e7e=_0x736e7e-0x0;var _0xc5508f=_0x5fbd[_0x736e7e];return _0xc5508f;};'use strict';var _=require('lodash');var util=require(_0xd5fb('0x0'));var moment=require(_0xd5fb('0x1'));var BPromise=require(_0xd5fb('0x2'));var rs=require(_0xd5fb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd5fb('0x4'))['db'];var utils=require(_0xd5fb('0x5'));var logger=require('../../config/logger')(_0xd5fb('0x6'));var config=require(_0xd5fb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd5fb('0x8')][_0xd5fb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x595049,_0x14cf79,_0x16584a){return new BPromise(function(_0x11c294,_0x5ceb0e){return client[_0xd5fb('0xa')](_0x595049,_0x16584a)['then'](function(_0x121ebe){logger[_0xd5fb('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x14cf79,_0xd5fb('0xc'));logger[_0xd5fb('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x14cf79,_0xd5fb('0xc'),JSON['stringify'](_0x121ebe));if(_0x121ebe[_0xd5fb('0xe')]){if(_0x121ebe[_0xd5fb('0xe')][_0xd5fb('0xf')]===0x1f4){logger[_0xd5fb('0xe')](_0xd5fb('0x10'),_0x14cf79,_0x121ebe[_0xd5fb('0xe')][_0xd5fb('0x11')]);return _0x5ceb0e(_0x121ebe['error'][_0xd5fb('0x11')]);}logger[_0xd5fb('0xe')](_0xd5fb('0x10'),_0x14cf79,_0x121ebe[_0xd5fb('0xe')][_0xd5fb('0x11')]);return _0x11c294(_0x121ebe[_0xd5fb('0xe')][_0xd5fb('0x11')]);}else{logger[_0xd5fb('0xb')](_0xd5fb('0x10'),_0x14cf79,_0xd5fb('0xc'));_0x11c294(_0x121ebe[_0xd5fb('0x12')][_0xd5fb('0x11')]);}})[_0xd5fb('0x13')](function(_0x522c4c){logger[_0xd5fb('0xe')](_0xd5fb('0x10'),_0x14cf79,_0x522c4c);_0x5ceb0e(_0x522c4c);});});} \ No newline at end of file +var _0x2cf5=['info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3a7a8c,_0xd472e8){var _0x55036b=function(_0x265aec){while(--_0x265aec){_0x3a7a8c['push'](_0x3a7a8c['shift']());}};_0x55036b(++_0xd472e8);}(_0x2cf5,0xfb));var _0x52cf=function(_0x3761b4,_0x4cdf14){_0x3761b4=_0x3761b4-0x0;var _0x2063b3=_0x2cf5[_0x3761b4];return _0x2063b3;};'use strict';var _=require(_0x52cf('0x0'));var util=require(_0x52cf('0x1'));var moment=require('moment');var BPromise=require(_0x52cf('0x2'));var rs=require(_0x52cf('0x3'));var fs=require('fs');var Redis=require(_0x52cf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x52cf('0x5'));var logger=require(_0x52cf('0x6'))('rpc');var config=require(_0x52cf('0x7'));var jayson=require(_0x52cf('0x8'));var client=jayson[_0x52cf('0x9')][_0x52cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x520c98,_0x4b698e,_0x2e9b34){return new BPromise(function(_0x3a4824,_0x4d9179){return client[_0x52cf('0xb')](_0x520c98,_0x2e9b34)[_0x52cf('0xc')](function(_0xc0b4ff){logger[_0x52cf('0xd')](_0x52cf('0xe'),_0x4b698e,_0x52cf('0xf'));logger[_0x52cf('0x10')](_0x52cf('0x11'),_0x4b698e,'request\x20sent',JSON[_0x52cf('0x12')](_0xc0b4ff));if(_0xc0b4ff[_0x52cf('0x13')]){if(_0xc0b4ff[_0x52cf('0x13')][_0x52cf('0x14')]===0x1f4){logger['error'](_0x52cf('0xe'),_0x4b698e,_0xc0b4ff['error']['message']);return _0x4d9179(_0xc0b4ff['error'][_0x52cf('0x15')]);}logger['error'](_0x52cf('0xe'),_0x4b698e,_0xc0b4ff['error'][_0x52cf('0x15')]);return _0x3a4824(_0xc0b4ff[_0x52cf('0x13')][_0x52cf('0x15')]);}else{logger['info'](_0x52cf('0xe'),_0x4b698e,_0x52cf('0xf'));_0x3a4824(_0xc0b4ff[_0x52cf('0x16')][_0x52cf('0x15')]);}})[_0x52cf('0x17')](function(_0x3be936){logger[_0x52cf('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x4b698e,_0x3be936);_0x4d9179(_0x3be936);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 2450b77..2fb5fa4 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 _0x1c56=['../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','Router'];(function(_0x482c95,_0x504190){var _0x38c2e8=function(_0x5685df){while(--_0x5685df){_0x482c95['push'](_0x482c95['shift']());}};_0x38c2e8(++_0x504190);}(_0x1c56,0x1bc));var _0x61c5=function(_0xbebf50,_0x44ec09){_0xbebf50=_0xbebf50-0x0;var _0xce1496=_0x1c56[_0xbebf50];return _0xce1496;};'use strict';var multer=require(_0x61c5('0x0'));var util=require(_0x61c5('0x1'));var path=require('path');var timeout=require(_0x61c5('0x2'));var express=require('express');var router=express[_0x61c5('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x61c5('0x4'));var config=require(_0x61c5('0x5'));module[_0x61c5('0x6')]=router; \ No newline at end of file +var _0x5dae=['express','Router','../../components/auth/service','../../config/environment','exports','multer','connect-timeout'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x5dae,0x1da));var _0xe5da=function(_0x5c767f,_0x2318e5){_0x5c767f=_0x5c767f-0x0;var _0x54732b=_0x5dae[_0x5c767f];return _0x54732b;};'use strict';var multer=require(_0xe5da('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe5da('0x1'));var express=require(_0xe5da('0x2'));var router=express[_0xe5da('0x3')]();var auth=require(_0xe5da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe5da('0x5'));module[_0xe5da('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 361a4da..8c56922 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 _0x3a4b=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x3d7b00,_0x8bc6f4){var _0x2a0e58=function(_0x173989){while(--_0x173989){_0x3d7b00['push'](_0x3d7b00['shift']());}};_0x2a0e58(++_0x8bc6f4);}(_0x3a4b,0xc0));var _0xb3a4=function(_0x560d43,_0x5403ab){_0x560d43=_0x560d43-0x0;var _0x30d871=_0x3a4b[_0x560d43];return _0x30d871;};'use strict';var Sequelize=require(_0xb3a4('0x0'));module[_0xb3a4('0x1')]={'uniqueid':{'type':Sequelize[_0xb3a4('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xb3a4('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xb3a4('0x3')},'UserId':{'type':Sequelize[_0xb3a4('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xb3a4('0x4')],'allowNull':![],'unique':_0xb3a4('0x5'),'comment':_0xb3a4('0x3')},'VoiceQueueId':{'type':Sequelize[_0xb3a4('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xb3a4('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xb3a4('0x3')},'paused':{'type':Sequelize[_0xb3a4('0x2')](0xb),'defaultValue':0x0,'comment':_0xb3a4('0x3')}}; \ No newline at end of file +var _0xe870=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x23a933,_0x4a27b8){var _0x5276a1=function(_0x1c40e4){while(--_0x1c40e4){_0x23a933['push'](_0x23a933['shift']());}};_0x5276a1(++_0x4a27b8);}(_0xe870,0x148));var _0x0e87=function(_0x312c4f,_0x82111a){_0x312c4f=_0x312c4f-0x0;var _0x1fc598=_0xe870[_0x312c4f];return _0x1fc598;};'use strict';var Sequelize=require(_0x0e87('0x0'));module[_0x0e87('0x1')]={'uniqueid':{'type':Sequelize[_0x0e87('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0e87('0x3')},'membername':{'type':Sequelize[_0x0e87('0x4')],'allowNull':![],'comment':_0x0e87('0x3')},'UserId':{'type':Sequelize[_0x0e87('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0e87('0x4')],'allowNull':![],'unique':_0x0e87('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x0e87('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0e87('0x5'),'comment':_0x0e87('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x0e87('0x2')](0xb),'defaultValue':0x0,'comment':_0x0e87('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 6c85761..993226f 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 _0xb7ef=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','remove','emit','hook'];(function(_0x2713de,_0x2024fc){var _0x378aba=function(_0x3c754e){while(--_0x3c754e){_0x2713de['push'](_0x2713de['shift']());}};_0x378aba(++_0x2024fc);}(_0xb7ef,0x93));var _0xfb7e=function(_0x3713f,_0xd0f493){_0x3713f=_0x3713f-0x0;var _0x290acd=_0xb7ef[_0x3713f];return _0x290acd;};'use strict';var EventEmitter=require(_0xfb7e('0x0'));var UserVoiceQueueRt=require(_0xfb7e('0x1'))['db'][_0xfb7e('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xfb7e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfb7e('0x4')};function emitEvent(_0x1226d0){return function(_0x258a4e,_0xd5fae8,_0x4a32b8){UserVoiceQueueRtEvents['emit'](_0x1226d0+':'+_0x258a4e['id'],_0x258a4e);UserVoiceQueueRtEvents[_0xfb7e('0x5')](_0x1226d0,_0x258a4e);_0x4a32b8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xfb7e('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x929b=['save','remove','emit','hasOwnProperty','exports','events','setMaxListeners'];(function(_0x34c553,_0x3e7dfc){var _0x1357d2=function(_0x3b509f){while(--_0x3b509f){_0x34c553['push'](_0x34c553['shift']());}};_0x1357d2(++_0x3e7dfc);}(_0x929b,0x1b7));var _0xb929=function(_0x4d189e,_0x2c0a04){_0x4d189e=_0x4d189e-0x0;var _0x1b36df=_0x929b[_0x4d189e];return _0x1b36df;};'use strict';var EventEmitter=require(_0xb929('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xb929('0x1')](0x0);var events={'afterCreate':_0xb929('0x2'),'afterUpdate':'update','afterDestroy':_0xb929('0x3')};function emitEvent(_0x591d11){return function(_0x5afb11,_0x112713,_0xed3d52){UserVoiceQueueRtEvents[_0xb929('0x4')](_0x591d11+':'+_0x5afb11['id'],_0x5afb11);UserVoiceQueueRtEvents[_0xb929('0x4')](_0x591d11,_0x5afb11);_0xed3d52(null);};}for(var e in events){if(events[_0xb929('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xb929('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index ea53730..a74dbac 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 _0x4a05=['path','rimraf','../../config/environment','define','UserVoiceQueueRt','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a05,0xff));var _0x54a0=function(_0x5168e3,_0x4b9c51){_0x5168e3=_0x5168e3-0x0;var _0x3112c3=_0x4a05[_0x5168e3];return _0x3112c3;};'use strict';var _=require(_0x54a0('0x0'));var util=require(_0x54a0('0x1'));var logger=require(_0x54a0('0x2'))('api');var moment=require(_0x54a0('0x3'));var BPromise=require(_0x54a0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x54a0('0x5'));var rimraf=require(_0x54a0('0x6'));var config=require(_0x54a0('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x4dffbd,_0x34e5c1){return _0x4dffbd[_0x54a0('0x8')](_0x54a0('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x617b=['user_has_voice_queues_rt','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define'];(function(_0x33831e,_0x2628a1){var _0x13f25b=function(_0x10ade7){while(--_0x10ade7){_0x33831e['push'](_0x33831e['shift']());}};_0x13f25b(++_0x2628a1);}(_0x617b,0x76));var _0xb617=function(_0x6bac87,_0x5add04){_0x6bac87=_0x6bac87-0x0;var _0x4f6708=_0x617b[_0x6bac87];return _0x4f6708;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb617('0x0'))('api');var moment=require(_0xb617('0x1'));var BPromise=require(_0xb617('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb617('0x3'));var rimraf=require(_0xb617('0x4'));var config=require(_0xb617('0x5'));var attributes=require(_0xb617('0x6'));module['exports']=function(_0x24ce1b,_0x4bdaba){return _0x24ce1b[_0xb617('0x7')]('UserVoiceQueueRt',attributes,{'tableName':_0xb617('0x8'),'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 27bedf0..fd2f0fe 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 _0x20ad=['request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','./userVoiceQueueRt.socket','register'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x20ad,0x1ba));var _0xd20a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x20ad[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0xd20a('0x0'));var util=require('util');var moment=require(_0xd20a('0x1'));var BPromise=require(_0xd20a('0x2'));var rs=require(_0xd20a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd20a('0x4'));var logger=require(_0xd20a('0x5'))(_0xd20a('0x6'));var config=require('../../config/environment');var jayson=require(_0xd20a('0x7'));var client=jayson['client'][_0xd20a('0x8')]({'port':0x232a});config[_0xd20a('0x9')]=_['defaults'](config[_0xd20a('0x9')],{'host':_0xd20a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd20a('0xb'))[_0xd20a('0xc')](socket);function respondWithRpcPromise(_0x3aba90,_0x1721de,_0x273165){return new BPromise(function(_0x23de24,_0x1cad74){return client[_0xd20a('0xd')](_0x3aba90,_0x273165)[_0xd20a('0xe')](function(_0x59f233){logger[_0xd20a('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1721de,_0xd20a('0x10'));logger[_0xd20a('0x11')](_0xd20a('0x12'),_0x1721de,_0xd20a('0x10'),JSON[_0xd20a('0x13')](_0x59f233));if(_0x59f233[_0xd20a('0x14')]){if(_0x59f233['error'][_0xd20a('0x15')]===0x1f4){logger[_0xd20a('0x14')](_0xd20a('0x16'),_0x1721de,_0x59f233[_0xd20a('0x14')][_0xd20a('0x17')]);return _0x1cad74(_0x59f233[_0xd20a('0x14')]['message']);}logger[_0xd20a('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1721de,_0x59f233[_0xd20a('0x14')][_0xd20a('0x17')]);return _0x23de24(_0x59f233[_0xd20a('0x14')][_0xd20a('0x17')]);}else{logger[_0xd20a('0xf')](_0xd20a('0x16'),_0x1721de,_0xd20a('0x10'));_0x23de24(_0x59f233['result'][_0xd20a('0x17')]);}})[_0xd20a('0x18')](function(_0x352075){logger[_0xd20a('0x14')](_0xd20a('0x16'),_0x1721de,_0x352075);_0x1cad74(_0x352075);});});}exports[_0xd20a('0x19')]=function(_0x3ba6cd){var _0xc7f1ea=this;return new Promise(function(_0x3fc2ab,_0x17086e){return db[_0xd20a('0x1a')][_0xd20a('0x1b')]({'raw':_0x3ba6cd[_0xd20a('0x1c')]?_0x3ba6cd[_0xd20a('0x1c')][_0xd20a('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ba6cd['options']?_0x3ba6cd[_0xd20a('0x1c')][_0xd20a('0x1e')]||null:null,'attributes':[[db[_0xd20a('0x1f')]['fn'](_0xd20a('0x20'),db[_0xd20a('0x1f')]['fn']('IF',db[_0xd20a('0x1f')][_0xd20a('0x21')]('`paused`\x20=\x201,\x201,\x20null'))),_0xd20a('0x22')]]})[_0xd20a('0xe')](function(_0x42fa6e){logger['info'](_0xd20a('0x19'),_0x3ba6cd);logger[_0xd20a('0x11')](_0xd20a('0x19'),_0x3ba6cd,JSON['stringify'](_0x42fa6e));_0x3fc2ab(_0x42fa6e);})['catch'](function(_0x136a04){logger['error'](_0xd20a('0x19'),_0x136a04['message'],_0x3ba6cd);_0x17086e(_0xc7f1ea[_0xd20a('0x14')](0x1f4,_0x136a04[_0xd20a('0x17')]));});});}; \ No newline at end of file +var _0xc7b3=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','info','catch','lodash','util','moment','bluebird'];(function(_0x13846e,_0x4c6eea){var _0x473baa=function(_0x7c792e){while(--_0x7c792e){_0x13846e['push'](_0x13846e['shift']());}};_0x473baa(++_0x4c6eea);}(_0xc7b3,0x1b8));var _0x3c7b=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc7b3[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x3c7b('0x0'));var util=require(_0x3c7b('0x1'));var moment=require(_0x3c7b('0x2'));var BPromise=require(_0x3c7b('0x3'));var rs=require(_0x3c7b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c7b('0x5'))['db'];var utils=require(_0x3c7b('0x6'));var logger=require('../../config/logger')(_0x3c7b('0x7'));var config=require('../../config/environment');var jayson=require(_0x3c7b('0x8'));var client=jayson['client'][_0x3c7b('0x9')]({'port':0x232a});config[_0x3c7b('0xa')]=_['defaults'](config[_0x3c7b('0xa')],{'host':_0x3c7b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c7b('0xa')]));require('./userVoiceQueueRt.socket')[_0x3c7b('0xc')](socket);function respondWithRpcPromise(_0x3faf5f,_0x3678b0,_0x36bae8){return new BPromise(function(_0x5d750d,_0x3f0b55){return client[_0x3c7b('0xd')](_0x3faf5f,_0x36bae8)[_0x3c7b('0xe')](function(_0x3327ed){logger['info'](_0x3c7b('0xf'),_0x3678b0,_0x3c7b('0x10'));logger[_0x3c7b('0x11')](_0x3c7b('0x12'),_0x3678b0,_0x3c7b('0x10'),JSON[_0x3c7b('0x13')](_0x3327ed));if(_0x3327ed[_0x3c7b('0x14')]){if(_0x3327ed['error'][_0x3c7b('0x15')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3678b0,_0x3327ed[_0x3c7b('0x14')]['message']);return _0x3f0b55(_0x3327ed['error'][_0x3c7b('0x16')]);}logger['error'](_0x3c7b('0xf'),_0x3678b0,_0x3327ed[_0x3c7b('0x14')][_0x3c7b('0x16')]);return _0x5d750d(_0x3327ed[_0x3c7b('0x14')][_0x3c7b('0x16')]);}else{logger['info'](_0x3c7b('0xf'),_0x3678b0,_0x3c7b('0x10'));_0x5d750d(_0x3327ed[_0x3c7b('0x17')][_0x3c7b('0x16')]);}})['catch'](function(_0x1506f9){logger[_0x3c7b('0x14')](_0x3c7b('0xf'),_0x3678b0,_0x1506f9);_0x3f0b55(_0x1506f9);});});}exports[_0x3c7b('0x18')]=function(_0x18d61b){var _0x2aabf7=this;return new Promise(function(_0x6d96ce,_0x378394){return db[_0x3c7b('0x19')][_0x3c7b('0x1a')]({'raw':_0x18d61b[_0x3c7b('0x1b')]?_0x18d61b[_0x3c7b('0x1b')][_0x3c7b('0x1c')]===undefined?!![]:![]:!![],'where':_0x18d61b['options']?_0x18d61b[_0x3c7b('0x1b')][_0x3c7b('0x1d')]||null:null,'attributes':[[db[_0x3c7b('0x1e')]['fn'](_0x3c7b('0x1f'),db[_0x3c7b('0x1e')]['fn']('IF',db['sequelize'][_0x3c7b('0x20')](_0x3c7b('0x21')))),_0x3c7b('0x22')]]})[_0x3c7b('0xe')](function(_0x3563ef){logger[_0x3c7b('0x23')]('GetVoiceQueueRtPauses',_0x18d61b);logger[_0x3c7b('0x11')](_0x3c7b('0x18'),_0x18d61b,JSON[_0x3c7b('0x13')](_0x3563ef));_0x6d96ce(_0x3563ef);})[_0x3c7b('0x24')](function(_0x3e3090){logger[_0x3c7b('0x14')](_0x3c7b('0x18'),_0x3e3090[_0x3c7b('0x16')],_0x18d61b);_0x378394(_0x2aabf7[_0x3c7b('0x14')](0x1f4,_0x3e3090['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 88c30e4..388603b 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 _0x6b11=['save','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x2dd465,_0x4c16dc){var _0x27b7b8=function(_0x58ddfd){while(--_0x58ddfd){_0x2dd465['push'](_0x2dd465['shift']());}};_0x27b7b8(++_0x4c16dc);}(_0x6b11,0x101));var _0x16b1=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0x6b11[_0x492535];return _0x256620;};'use strict';var UserVoiceQueueRtEvents=require(_0x16b1('0x0'));var events=[_0x16b1('0x1'),'remove','update'];function createListener(_0x32dae2,_0xb3a264){return function(_0x1432ab){_0xb3a264['emit'](_0x32dae2,_0x1432ab);};}function removeListener(_0x4389f4,_0x61a41e){return function(){UserVoiceQueueRtEvents[_0x16b1('0x2')](_0x4389f4,_0x61a41e);};}exports[_0x16b1('0x3')]=function(_0x52cf77){for(var _0x5ea180=0x0,_0x30e5a1=events[_0x16b1('0x4')];_0x5ea180<_0x30e5a1;_0x5ea180++){var _0x22b3a7=events[_0x5ea180];var _0x37b54f=createListener(_0x16b1('0x5')+_0x22b3a7,_0x52cf77);UserVoiceQueueRtEvents['on'](_0x22b3a7,_0x37b54f);}}; \ No newline at end of file +var _0xe124=['./userVoiceQueueRt.events','save','emit','register','length','userVoiceQueueRt:'];(function(_0x34b23b,_0x42fb8b){var _0x3207a1=function(_0x1984ae){while(--_0x1984ae){_0x34b23b['push'](_0x34b23b['shift']());}};_0x3207a1(++_0x42fb8b);}(_0xe124,0x1f2));var _0x4e12=function(_0x1a88e2,_0x28fd82){_0x1a88e2=_0x1a88e2-0x0;var _0x341c96=_0xe124[_0x1a88e2];return _0x341c96;};'use strict';var UserVoiceQueueRtEvents=require(_0x4e12('0x0'));var events=[_0x4e12('0x1'),'remove','update'];function createListener(_0x22fd1e,_0x13a707){return function(_0x446fbe){_0x13a707[_0x4e12('0x2')](_0x22fd1e,_0x446fbe);};}function removeListener(_0x42f33e,_0x560f80){return function(){UserVoiceQueueRtEvents['removeListener'](_0x42f33e,_0x560f80);};}exports[_0x4e12('0x3')]=function(_0x4f5dae){for(var _0x3b7006=0x0,_0x34551c=events[_0x4e12('0x4')];_0x3b7006<_0x34551c;_0x3b7006++){var _0x531e30=events[_0x3b7006];var _0x23d5b0=createListener(_0x4e12('0x5')+_0x531e30,_0x4f5dae);UserVoiceQueueRtEvents['on'](_0x531e30,_0x23d5b0);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index be0b9e1..d26a2e7 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 _0xeb52=['multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeb52,0x68));var _0x2eb5=function(_0x17240a,_0x2be160){_0x17240a=_0x17240a-0x0;var _0x1ffb7a=_0xeb52[_0x17240a];return _0x1ffb7a;};'use strict';var multer=require(_0x2eb5('0x0'));var util=require(_0x2eb5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x9658=['../../components/interaction/service','../../config/environment','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x368ae4,_0x5cc622){var _0x421604=function(_0x5d03d1){while(--_0x5d03d1){_0x368ae4['push'](_0x368ae4['shift']());}};_0x421604(++_0x5cc622);}(_0x9658,0x13a));var _0x8965=function(_0x482214,_0x2550ff){_0x482214=_0x482214-0x0;var _0x38d0cb=_0x9658[_0x482214];return _0x38d0cb;};'use strict';var multer=require(_0x8965('0x0'));var util=require(_0x8965('0x1'));var path=require('path');var timeout=require(_0x8965('0x2'));var express=require(_0x8965('0x3'));var router=express[_0x8965('0x4')]();var auth=require(_0x8965('0x5'));var interaction=require(_0x8965('0x6'));var config=require(_0x8965('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 139a9c5..7fe6028 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(_0x54f241,_0xcb87f6){var _0xa86d09=function(_0x386f9f){while(--_0x386f9f){_0x54f241['push'](_0x54f241['shift']());}};_0xa86d09(++_0xcb87f6);}(_0xe706,0xa3));var _0x6e70=function(_0x4605dc,_0x3f7ae5){_0x4605dc=_0x4605dc-0x0;var _0x5d3e81=_0xe706[_0x4605dc];return _0x5d3e81;};'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(_0xbec8e6,_0x2841b5){var _0x4aa6f2=function(_0x583a0a){while(--_0x583a0a){_0xbec8e6['push'](_0xbec8e6['shift']());}};_0x4aa6f2(++_0x2841b5);}(_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/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 122a901..1c32138 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 _0x4fc2=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0x4fc2,0x111));var _0x24fc=function(_0x4bb79e,_0xe2b71d){_0x4bb79e=_0x4bb79e-0x0;var _0x2a8f18=_0x4fc2[_0x4bb79e];return _0x2a8f18;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab40=['rimraf','../../config/environment','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','bluebird','request-promise','path'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xab40,0xcd));var _0x0ab4=function(_0x428e5a,_0x2806c3){_0x428e5a=_0x428e5a-0x0;var _0x418728=_0xab40[_0x428e5a];return _0x418728;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0ab4('0x2'));var rp=require(_0x0ab4('0x3'));var fs=require('fs');var path=require(_0x0ab4('0x4'));var rimraf=require(_0x0ab4('0x5'));var config=require(_0x0ab4('0x6'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x28b17a,_0x4ba9d2){return _0x28b17a[_0x0ab4('0x7')](_0x0ab4('0x8'),attributes,{'tableName':_0x0ab4('0x9'),'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 6a0a7f6..a91ead8 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(_0x5e9501,_0xec2341){var _0x2a701c=function(_0x4a0930){while(--_0x4a0930){_0x5e9501['push'](_0x5e9501['shift']());}};_0x2a701c(++_0xec2341);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x44d546,_0x5bd7ab){var _0x5c0776=function(_0x17b49a){while(--_0x17b49a){_0x44d546['push'](_0x44d546['shift']());}};_0x5c0776(++_0x5bd7ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index d1d4c96..4699f54 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 _0x9649=['/:id','show','post','put','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9649,0x1f3));var _0x9964=function(_0x4ea9b6,_0x1e0a2b){_0x4ea9b6=_0x4ea9b6-0x0;var _0xbdee21=_0x9649[_0x4ea9b6];return _0xbdee21;};'use strict';var multer=require('multer');var util=require(_0x9964('0x0'));var path=require('path');var timeout=require(_0x9964('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x9964('0x2'));var interaction=require(_0x9964('0x3'));var config=require(_0x9964('0x4'));var controller=require('./variable.controller');router['get']('/',auth[_0x9964('0x5')](),controller[_0x9964('0x6')]);router[_0x9964('0x7')](_0x9964('0x8'),auth[_0x9964('0x5')](),controller[_0x9964('0x9')]);router[_0x9964('0xa')]('/',auth[_0x9964('0x5')](),controller['create']);router[_0x9964('0xb')](_0x9964('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9964('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x9964('0xc')]=router; \ No newline at end of file +var _0xbc62=['path','express','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','post','update','delete','multer','util'];(function(_0x4c4002,_0xa716e0){var _0x12a2b7=function(_0x31569c){while(--_0x31569c){_0x4c4002['push'](_0x4c4002['shift']());}};_0x12a2b7(++_0xa716e0);}(_0xbc62,0x112));var _0x2bc6=function(_0x16b906,_0xb4b78e){_0x16b906=_0x16b906-0x0;var _0x277cf1=_0xbc62[_0x16b906];return _0x277cf1;};'use strict';var multer=require(_0x2bc6('0x0'));var util=require(_0x2bc6('0x1'));var path=require(_0x2bc6('0x2'));var timeout=require('connect-timeout');var express=require(_0x2bc6('0x3'));var router=express['Router']();var auth=require(_0x2bc6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2bc6('0x5'));var controller=require('./variable.controller');router[_0x2bc6('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2bc6('0x6')](_0x2bc6('0x7'),auth[_0x2bc6('0x8')](),controller['show']);router[_0x2bc6('0x9')]('/',auth[_0x2bc6('0x8')](),controller['create']);router['put'](_0x2bc6('0x7'),auth[_0x2bc6('0x8')](),controller[_0x2bc6('0xa')]);router[_0x2bc6('0xb')](_0x2bc6('0x7'),auth[_0x2bc6('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 959c66b..4ed3025 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 _0xcdf5=['exports','STRING','name'];(function(_0x2a4d76,_0x57a9f1){var _0x8c1e17=function(_0x35c703){while(--_0x35c703){_0x2a4d76['push'](_0x2a4d76['shift']());}};_0x8c1e17(++_0x57a9f1);}(_0xcdf5,0xc3));var _0x5cdf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xcdf5[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x5cdf('0x0')]={'name':{'type':Sequelize[_0x5cdf('0x1')],'unique':_0x5cdf('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5cdf('0x1')]}}; \ No newline at end of file +var _0xe586=['STRING','name','sequelize','exports'];(function(_0x47cdc4,_0xba312e){var _0x1cfd80=function(_0x2b0ca5){while(--_0x2b0ca5){_0x47cdc4['push'](_0x47cdc4['shift']());}};_0x1cfd80(++_0xba312e);}(_0xe586,0x8e));var _0x6e58=function(_0x40916e,_0xeb2a5e){_0x40916e=_0x40916e-0x0;var _0x4d1887=_0xe586[_0x40916e];return _0x4d1887;};'use strict';var Sequelize=require(_0x6e58('0x0'));module[_0x6e58('0x1')]={'name':{'type':Sequelize[_0x6e58('0x2')],'unique':_0x6e58('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 2281856..710c93f 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 _0xb453=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','then','get','sendStatus','error','name','send','index','Variable','rawAttributes','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','limit','order','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','catch','show','params','keys','length','include','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1305e3,_0x43a724){var _0x1068e9=function(_0x1bc555){while(--_0x1bc555){_0x1305e3['push'](_0x1305e3['shift']());}};_0x1068e9(++_0x43a724);}(_0xb453,0x12e));var _0x3b45=function(_0x22a675,_0x495743){_0x22a675=_0x22a675-0x0;var _0x4d911c=_0xb453[_0x22a675];return _0x4d911c;};'use strict';var pdf=require(_0x3b45('0x0'));var emlformat=require(_0x3b45('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3b45('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b45('0x3'));var moment=require(_0x3b45('0x4'));var BPromise=require(_0x3b45('0x5'));var Mustache=require(_0x3b45('0x6'));var util=require(_0x3b45('0x7'));var path=require('path');var sox=require(_0x3b45('0x8'));var csv=require(_0x3b45('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3b45('0xa'));var squel=require(_0x3b45('0xb'));var crypto=require(_0x3b45('0xc'));var jsforce=require(_0x3b45('0xd'));var deskjs=require(_0x3b45('0xe'));var toCsv=require(_0x3b45('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3b45('0xf'));var authService=require(_0x3b45('0x10'));var qs=require(_0x3b45('0x11'));var as=require(_0x3b45('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b45('0x13'))(_0x3b45('0x14'));var utils=require(_0x3b45('0x15'));var config=require(_0x3b45('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d3de6,_0xc3c6ff){_0xc3c6ff=_0xc3c6ff||0xcc;return function(_0x2765bb){if(_0x2765bb){return _0x5d3de6['sendStatus'](_0xc3c6ff);}return _0x5d3de6[_0x3b45('0x17')](_0xc3c6ff)[_0x3b45('0x18')]();};}function respondWithResult(_0x445df1,_0x153748){_0x153748=_0x153748||0xc8;return function(_0x26d060){if(_0x26d060){return _0x445df1[_0x3b45('0x17')](_0x153748)[_0x3b45('0x19')](_0x26d060);}};}function respondWithFilteredResult(_0x1bdfdc,_0x25a861){return function(_0x298060){if(_0x298060){var _0x523eba=_0x298060[_0x3b45('0x1a')],_0x14e981=_0x25a861[_0x3b45('0x1b')],_0x53a25f=_0x25a861['offset']+_0x25a861['limit'],_0x24e733;if(_0x53a25f>=_0x523eba){_0x53a25f=_0x523eba;_0x24e733=0xc8;}else{_0x24e733=0xce;}_0x1bdfdc['status'](_0x24e733);return _0x1bdfdc[_0x3b45('0x1c')](_0x3b45('0x1d'),_0x14e981+'-'+_0x53a25f+'/'+_0x523eba)[_0x3b45('0x19')](_0x298060);}return null;};}function patchUpdates(_0x4fd50e){return function(_0xa71e5c){try{jsonpatch['apply'](_0xa71e5c,_0x4fd50e,!![]);}catch(_0x2a8474){return BPromise[_0x3b45('0x1e')](_0x2a8474);}return _0xa71e5c[_0x3b45('0x1f')]();};}function saveUpdates(_0x247c0d,_0x13bc7d){return function(_0x25b87b){if(_0x25b87b){return _0x25b87b[_0x3b45('0x20')](_0x247c0d)['then'](function(_0x3ed08d){return _0x3ed08d;});}return null;};}function removeEntity(_0x87525f,_0x5443de){return function(_0x400344){if(_0x400344){return _0x400344[_0x3b45('0x21')]()[_0x3b45('0x22')](function(){var _0x139cf7=_0x400344[_0x3b45('0x23')]({'plain':!![]});var _0x3df397='Variables';return db['UserProfileResource'][_0x3b45('0x21')]({'where':{'type':_0x3df397,'resourceId':_0x139cf7['id']}})[_0x3b45('0x22')](function(){return _0x400344;});})[_0x3b45('0x22')](function(){_0x87525f[_0x3b45('0x17')](0xcc)[_0x3b45('0x18')]();});}};}function handleEntityNotFound(_0x28f8f9,_0x666b3b){return function(_0xdd1e1e){if(!_0xdd1e1e){_0x28f8f9[_0x3b45('0x24')](0x194);}return _0xdd1e1e;};}function handleError(_0x141575,_0x2d1222){_0x2d1222=_0x2d1222||0x1f4;return function(_0x13f770){logger[_0x3b45('0x25')](_0x13f770['stack']);if(_0x13f770[_0x3b45('0x26')]){delete _0x13f770[_0x3b45('0x26')];}_0x141575['status'](_0x2d1222)[_0x3b45('0x27')](_0x13f770);};}exports[_0x3b45('0x28')]=function(_0x5c6b2e,_0x1ba8db){var _0x5f2ee7={},_0x16c3d0={},_0x229fae={'count':0x0,'rows':[]};var _0x537081=_['map'](db[_0x3b45('0x29')][_0x3b45('0x2a')],function(_0x5110d7){return{'name':_0x5110d7['fieldName'],'type':_0x5110d7['type'][_0x3b45('0x2b')]};});_0x16c3d0[_0x3b45('0x2c')]=_[_0x3b45('0x2d')](_0x537081,_0x3b45('0x26'));_0x16c3d0[_0x3b45('0x2e')]=_['keys'](_0x5c6b2e[_0x3b45('0x2e')]);_0x16c3d0[_0x3b45('0x2f')]=_[_0x3b45('0x30')](_0x16c3d0[_0x3b45('0x2c')],_0x16c3d0[_0x3b45('0x2e')]);_0x5f2ee7['attributes']=_['intersection'](_0x16c3d0[_0x3b45('0x2c')],qs[_0x3b45('0x31')](_0x5c6b2e[_0x3b45('0x2e')][_0x3b45('0x31')]));_0x5f2ee7[_0x3b45('0x32')]=_0x5f2ee7[_0x3b45('0x32')]['length']?_0x5f2ee7['attributes']:_0x16c3d0[_0x3b45('0x2c')];if(!_0x5c6b2e[_0x3b45('0x2e')][_0x3b45('0x33')]('nolimit')){_0x5f2ee7[_0x3b45('0x34')]=qs[_0x3b45('0x34')](_0x5c6b2e[_0x3b45('0x2e')]['limit']);_0x5f2ee7[_0x3b45('0x1b')]=qs[_0x3b45('0x1b')](_0x5c6b2e[_0x3b45('0x2e')][_0x3b45('0x1b')]);}_0x5f2ee7[_0x3b45('0x35')]=qs['sort'](_0x5c6b2e['query']['sort']);_0x5f2ee7[_0x3b45('0x36')]=qs[_0x3b45('0x2f')](_[_0x3b45('0x37')](_0x5c6b2e[_0x3b45('0x2e')],_0x16c3d0[_0x3b45('0x2f')]));if(_0x5c6b2e[_0x3b45('0x2e')][_0x3b45('0x38')]){_0x5f2ee7[_0x3b45('0x36')]=_[_0x3b45('0x39')](_0x5f2ee7[_0x3b45('0x36')],{'$or':_[_0x3b45('0x2d')](_0x537081,function(_0x1e70b7){if(_0x1e70b7[_0x3b45('0x3a')]!==_0x3b45('0x3b')){var _0x21909f={};_0x21909f[_0x1e70b7[_0x3b45('0x26')]]={'$like':'%'+_0x5c6b2e['query'][_0x3b45('0x38')]+'%'};return _0x21909f;}})});}_0x5f2ee7=_[_0x3b45('0x39')]({},_0x5f2ee7,_0x5c6b2e['options']);var _0x280c1c={'where':_0x5f2ee7[_0x3b45('0x36')]};return db['Variable'][_0x3b45('0x1a')](_0x280c1c)[_0x3b45('0x22')](function(_0x2e1783){_0x229fae['count']=_0x2e1783;if(_0x5c6b2e['query'][_0x3b45('0x3c')]){_0x5f2ee7['include']=[{'all':!![]}];}return db[_0x3b45('0x29')][_0x3b45('0x3d')](_0x5f2ee7);})['then'](function(_0x245a0f){_0x229fae['rows']=_0x245a0f;return _0x229fae;})[_0x3b45('0x22')](respondWithFilteredResult(_0x1ba8db,_0x5f2ee7))[_0x3b45('0x3e')](handleError(_0x1ba8db,null));};exports[_0x3b45('0x3f')]=function(_0x11e2f1,_0x5ba069){var _0x1bc38e={'raw':!![],'where':{'id':_0x11e2f1[_0x3b45('0x40')]['id']}},_0x134fb1={};_0x134fb1['model']=_[_0x3b45('0x41')](db[_0x3b45('0x29')][_0x3b45('0x2a')]);_0x134fb1[_0x3b45('0x2e')]=_[_0x3b45('0x41')](_0x11e2f1[_0x3b45('0x2e')]);_0x134fb1[_0x3b45('0x2f')]=_[_0x3b45('0x30')](_0x134fb1[_0x3b45('0x2c')],_0x134fb1['query']);_0x1bc38e[_0x3b45('0x32')]=_['intersection'](_0x134fb1[_0x3b45('0x2c')],qs[_0x3b45('0x31')](_0x11e2f1[_0x3b45('0x2e')][_0x3b45('0x31')]));_0x1bc38e[_0x3b45('0x32')]=_0x1bc38e['attributes'][_0x3b45('0x42')]?_0x1bc38e[_0x3b45('0x32')]:_0x134fb1[_0x3b45('0x2c')];if(_0x11e2f1['query']['includeAll']){_0x1bc38e[_0x3b45('0x43')]=[{'all':!![]}];}_0x1bc38e=_['merge']({},_0x1bc38e,_0x11e2f1[_0x3b45('0x44')]);return db['Variable'][_0x3b45('0x45')](_0x1bc38e)[_0x3b45('0x22')](handleEntityNotFound(_0x5ba069,null))[_0x3b45('0x22')](respondWithResult(_0x5ba069,null))[_0x3b45('0x3e')](handleError(_0x5ba069,null));};exports['create']=function(_0x1da6fb,_0x539237){return db[_0x3b45('0x29')]['create'](_0x1da6fb[_0x3b45('0x46')],{})[_0x3b45('0x22')](function(_0x243228){var _0x3b8bad=_0x1da6fb[_0x3b45('0x47')][_0x3b45('0x23')]({'plain':!![]});if(!_0x3b8bad)throw new Error(_0x3b45('0x48'));if(_0x3b8bad[_0x3b45('0x49')]===_0x3b45('0x47')){var _0x5028f7=_0x243228[_0x3b45('0x23')]({'plain':!![]});var _0x3ab4a3=_0x3b45('0x4a');return db[_0x3b45('0x4b')]['find']({'where':{'name':_0x3ab4a3,'userProfileId':_0x3b8bad[_0x3b45('0x4c')]},'raw':!![]})[_0x3b45('0x22')](function(_0x41d8e5){if(_0x41d8e5&&_0x41d8e5[_0x3b45('0x4d')]===0x0){return db[_0x3b45('0x4e')][_0x3b45('0x4f')]({'name':_0x5028f7['name'],'resourceId':_0x5028f7['id'],'type':_0x41d8e5[_0x3b45('0x26')],'sectionId':_0x41d8e5['id']},{})[_0x3b45('0x22')](function(){return _0x243228;});}else{return _0x243228;}})['catch'](function(_0x22f600){logger[_0x3b45('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22f600);throw _0x22f600;});}return _0x243228;})['then'](respondWithResult(_0x539237,0xc9))[_0x3b45('0x3e')](handleError(_0x539237,null));};exports[_0x3b45('0x20')]=function(_0x154994,_0xef1def){if(_0x154994[_0x3b45('0x46')]['id']){delete _0x154994[_0x3b45('0x46')]['id'];}return db[_0x3b45('0x29')]['find']({'where':{'id':_0x154994[_0x3b45('0x40')]['id']}})[_0x3b45('0x22')](handleEntityNotFound(_0xef1def,null))[_0x3b45('0x22')](saveUpdates(_0x154994['body'],null))[_0x3b45('0x22')](respondWithResult(_0xef1def,null))['catch'](handleError(_0xef1def,null));};exports[_0x3b45('0x21')]=function(_0x2f5aee,_0x3b305b){return db[_0x3b45('0x29')][_0x3b45('0x45')]({'where':{'id':_0x2f5aee[_0x3b45('0x40')]['id']}})[_0x3b45('0x22')](handleEntityNotFound(_0x3b305b,null))[_0x3b45('0x22')](removeEntity(_0x3b305b,null))[_0x3b45('0x3e')](handleError(_0x3b305b,null));}; \ No newline at end of file +var _0x7c22=['hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','get','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields'];(function(_0x26a068,_0x526c25){var _0x27a532=function(_0x1561b4){while(--_0x1561b4){_0x26a068['push'](_0x26a068['shift']());}};_0x27a532(++_0x526c25);}(_0x7c22,0x6c));var _0x27c2=function(_0x2f6729,_0x49b92d){_0x2f6729=_0x2f6729-0x0;var _0x2d0043=_0x7c22[_0x2f6729];return _0x2d0043;};'use strict';var pdf=require(_0x27c2('0x0'));var emlformat=require(_0x27c2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x27c2('0x2'));var jsonpatch=require(_0x27c2('0x3'));var rp=require('request-promise');var moment=require(_0x27c2('0x4'));var BPromise=require(_0x27c2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x27c2('0x6'));var sox=require('sox');var csv=require(_0x27c2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x27c2('0x8'));var squel=require(_0x27c2('0x9'));var crypto=require('crypto');var jsforce=require(_0x27c2('0xa'));var deskjs=require(_0x27c2('0xb'));var toCsv=require(_0x27c2('0x7'));var querystring=require(_0x27c2('0xc'));var Papa=require(_0x27c2('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x27c2('0xe'));var as=require(_0x27c2('0xf'));var hardwareService=require(_0x27c2('0x10'));var logger=require(_0x27c2('0x11'))('api');var utils=require(_0x27c2('0x12'));var config=require(_0x27c2('0x13'));var db=require(_0x27c2('0x14'))['db'];function respondWithStatusCode(_0x5a3823,_0x4c654a){_0x4c654a=_0x4c654a||0xcc;return function(_0x23a6ed){if(_0x23a6ed){return _0x5a3823[_0x27c2('0x15')](_0x4c654a);}return _0x5a3823[_0x27c2('0x16')](_0x4c654a)[_0x27c2('0x17')]();};}function respondWithResult(_0x35fa3d,_0x599589){_0x599589=_0x599589||0xc8;return function(_0xa704c2){if(_0xa704c2){return _0x35fa3d['status'](_0x599589)[_0x27c2('0x18')](_0xa704c2);}};}function respondWithFilteredResult(_0x39f3f0,_0x333db1){return function(_0x2e2193){if(_0x2e2193){var _0x49241e=_0x2e2193[_0x27c2('0x19')],_0x272038=_0x333db1[_0x27c2('0x1a')],_0x11d677=_0x333db1[_0x27c2('0x1a')]+_0x333db1[_0x27c2('0x1b')],_0xb936d9;if(_0x11d677>=_0x49241e){_0x11d677=_0x49241e;_0xb936d9=0xc8;}else{_0xb936d9=0xce;}_0x39f3f0[_0x27c2('0x16')](_0xb936d9);return _0x39f3f0[_0x27c2('0x1c')]('Content-Range',_0x272038+'-'+_0x11d677+'/'+_0x49241e)[_0x27c2('0x18')](_0x2e2193);}return null;};}function patchUpdates(_0x2bd89e){return function(_0xf42ff1){try{jsonpatch[_0x27c2('0x1d')](_0xf42ff1,_0x2bd89e,!![]);}catch(_0x584761){return BPromise['reject'](_0x584761);}return _0xf42ff1[_0x27c2('0x1e')]();};}function saveUpdates(_0x34f20a,_0x25136d){return function(_0x282cdb){if(_0x282cdb){return _0x282cdb[_0x27c2('0x1f')](_0x34f20a)[_0x27c2('0x20')](function(_0x49c307){return _0x49c307;});}return null;};}function removeEntity(_0x9cad83,_0x111287){return function(_0x38e982){if(_0x38e982){return _0x38e982[_0x27c2('0x21')]()[_0x27c2('0x20')](function(){var _0x307f6c=_0x38e982[_0x27c2('0x22')]({'plain':!![]});var _0xb9af7f='Variables';return db['UserProfileResource'][_0x27c2('0x21')]({'where':{'type':_0xb9af7f,'resourceId':_0x307f6c['id']}})[_0x27c2('0x20')](function(){return _0x38e982;});})['then'](function(){_0x9cad83[_0x27c2('0x16')](0xcc)[_0x27c2('0x17')]();});}};}function handleEntityNotFound(_0x21ccb2,_0x1cf775){return function(_0x4afdc3){if(!_0x4afdc3){_0x21ccb2[_0x27c2('0x15')](0x194);}return _0x4afdc3;};}function handleError(_0x2d9974,_0x3d2338){_0x3d2338=_0x3d2338||0x1f4;return function(_0xd84fc){logger[_0x27c2('0x23')](_0xd84fc[_0x27c2('0x24')]);if(_0xd84fc[_0x27c2('0x25')]){delete _0xd84fc[_0x27c2('0x25')];}_0x2d9974['status'](_0x3d2338)[_0x27c2('0x26')](_0xd84fc);};}exports[_0x27c2('0x27')]=function(_0x54b061,_0x48ef72){var _0xeeba0b={},_0x34cf90={},_0x2b0b3={'count':0x0,'rows':[]};var _0x5d397b=_[_0x27c2('0x28')](db[_0x27c2('0x29')][_0x27c2('0x2a')],function(_0x16636a){return{'name':_0x16636a[_0x27c2('0x2b')],'type':_0x16636a[_0x27c2('0x2c')]['key']};});_0x34cf90[_0x27c2('0x2d')]=_[_0x27c2('0x28')](_0x5d397b,_0x27c2('0x25'));_0x34cf90['query']=_[_0x27c2('0x2e')](_0x54b061[_0x27c2('0x2f')]);_0x34cf90[_0x27c2('0x30')]=_[_0x27c2('0x31')](_0x34cf90['model'],_0x34cf90[_0x27c2('0x2f')]);_0xeeba0b[_0x27c2('0x32')]=_[_0x27c2('0x31')](_0x34cf90[_0x27c2('0x2d')],qs[_0x27c2('0x33')](_0x54b061[_0x27c2('0x2f')][_0x27c2('0x33')]));_0xeeba0b[_0x27c2('0x32')]=_0xeeba0b[_0x27c2('0x32')]['length']?_0xeeba0b[_0x27c2('0x32')]:_0x34cf90[_0x27c2('0x2d')];if(!_0x54b061[_0x27c2('0x2f')][_0x27c2('0x34')](_0x27c2('0x35'))){_0xeeba0b['limit']=qs[_0x27c2('0x1b')](_0x54b061[_0x27c2('0x2f')][_0x27c2('0x1b')]);_0xeeba0b[_0x27c2('0x1a')]=qs['offset'](_0x54b061[_0x27c2('0x2f')][_0x27c2('0x1a')]);}_0xeeba0b[_0x27c2('0x36')]=qs[_0x27c2('0x37')](_0x54b061[_0x27c2('0x2f')][_0x27c2('0x37')]);_0xeeba0b[_0x27c2('0x38')]=qs['filters'](_[_0x27c2('0x39')](_0x54b061[_0x27c2('0x2f')],_0x34cf90['filters']));if(_0x54b061[_0x27c2('0x2f')][_0x27c2('0x3a')]){_0xeeba0b[_0x27c2('0x38')]=_['merge'](_0xeeba0b[_0x27c2('0x38')],{'$or':_[_0x27c2('0x28')](_0x5d397b,function(_0x1102c0){if(_0x1102c0[_0x27c2('0x2c')]!==_0x27c2('0x3b')){var _0x5f260f={};_0x5f260f[_0x1102c0[_0x27c2('0x25')]]={'$like':'%'+_0x54b061['query'][_0x27c2('0x3a')]+'%'};return _0x5f260f;}})});}_0xeeba0b=_[_0x27c2('0x3c')]({},_0xeeba0b,_0x54b061[_0x27c2('0x3d')]);var _0x46f4ed={'where':_0xeeba0b[_0x27c2('0x38')]};return db[_0x27c2('0x29')]['count'](_0x46f4ed)[_0x27c2('0x20')](function(_0x93c8c6){_0x2b0b3['count']=_0x93c8c6;if(_0x54b061[_0x27c2('0x2f')][_0x27c2('0x3e')]){_0xeeba0b['include']=[{'all':!![]}];}return db[_0x27c2('0x29')][_0x27c2('0x3f')](_0xeeba0b);})['then'](function(_0x112f55){_0x2b0b3[_0x27c2('0x40')]=_0x112f55;return _0x2b0b3;})[_0x27c2('0x20')](respondWithFilteredResult(_0x48ef72,_0xeeba0b))['catch'](handleError(_0x48ef72,null));};exports[_0x27c2('0x41')]=function(_0xd44965,_0x30e13e){var _0x26546c={'raw':!![],'where':{'id':_0xd44965[_0x27c2('0x42')]['id']}},_0x1ca9dc={};_0x1ca9dc['model']=_['keys'](db[_0x27c2('0x29')][_0x27c2('0x2a')]);_0x1ca9dc[_0x27c2('0x2f')]=_[_0x27c2('0x2e')](_0xd44965['query']);_0x1ca9dc[_0x27c2('0x30')]=_[_0x27c2('0x31')](_0x1ca9dc[_0x27c2('0x2d')],_0x1ca9dc[_0x27c2('0x2f')]);_0x26546c['attributes']=_[_0x27c2('0x31')](_0x1ca9dc[_0x27c2('0x2d')],qs[_0x27c2('0x33')](_0xd44965['query']['fields']));_0x26546c[_0x27c2('0x32')]=_0x26546c['attributes'][_0x27c2('0x43')]?_0x26546c[_0x27c2('0x32')]:_0x1ca9dc[_0x27c2('0x2d')];if(_0xd44965[_0x27c2('0x2f')][_0x27c2('0x3e')]){_0x26546c['include']=[{'all':!![]}];}_0x26546c=_['merge']({},_0x26546c,_0xd44965[_0x27c2('0x3d')]);return db[_0x27c2('0x29')][_0x27c2('0x44')](_0x26546c)[_0x27c2('0x20')](handleEntityNotFound(_0x30e13e,null))[_0x27c2('0x20')](respondWithResult(_0x30e13e,null))['catch'](handleError(_0x30e13e,null));};exports['create']=function(_0x31bee2,_0x453055){return db[_0x27c2('0x29')][_0x27c2('0x45')](_0x31bee2[_0x27c2('0x46')],{})['then'](function(_0xa9e0d0){var _0xa6fdea=_0x31bee2[_0x27c2('0x47')][_0x27c2('0x22')]({'plain':!![]});if(!_0xa6fdea)throw new Error(_0x27c2('0x48'));if(_0xa6fdea[_0x27c2('0x49')]==='user'){var _0x37927d=_0xa9e0d0[_0x27c2('0x22')]({'plain':!![]});var _0x3f7ebb='Variables';return db[_0x27c2('0x4a')][_0x27c2('0x44')]({'where':{'name':_0x3f7ebb,'userProfileId':_0xa6fdea[_0x27c2('0x4b')]},'raw':!![]})['then'](function(_0x11068b){if(_0x11068b&&_0x11068b[_0x27c2('0x4c')]===0x0){return db[_0x27c2('0x4d')][_0x27c2('0x45')]({'name':_0x37927d[_0x27c2('0x25')],'resourceId':_0x37927d['id'],'type':_0x11068b[_0x27c2('0x25')],'sectionId':_0x11068b['id']},{})[_0x27c2('0x20')](function(){return _0xa9e0d0;});}else{return _0xa9e0d0;}})[_0x27c2('0x4e')](function(_0x4a4248){logger[_0x27c2('0x23')](_0x27c2('0x4f'),_0x4a4248);throw _0x4a4248;});}return _0xa9e0d0;})['then'](respondWithResult(_0x453055,0xc9))[_0x27c2('0x4e')](handleError(_0x453055,null));};exports[_0x27c2('0x1f')]=function(_0x394f75,_0x5b42df){if(_0x394f75[_0x27c2('0x46')]['id']){delete _0x394f75[_0x27c2('0x46')]['id'];}return db[_0x27c2('0x29')][_0x27c2('0x44')]({'where':{'id':_0x394f75[_0x27c2('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b42df,null))['then'](saveUpdates(_0x394f75[_0x27c2('0x46')],null))['then'](respondWithResult(_0x5b42df,null))[_0x27c2('0x4e')](handleError(_0x5b42df,null));};exports[_0x27c2('0x21')]=function(_0x393f96,_0x42e209){return db[_0x27c2('0x29')][_0x27c2('0x44')]({'where':{'id':_0x393f96[_0x27c2('0x42')]['id']}})[_0x27c2('0x20')](handleEntityNotFound(_0x42e209,null))['then'](removeEntity(_0x42e209,null))[_0x27c2('0x4e')](handleError(_0x42e209,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index cf13748..0c9749f 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 _0x6add=['moment','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','../../config/logger','api'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0x6add,0x1a2));var _0xd6ad=function(_0x2a7649,_0x1deb99){_0x2a7649=_0x2a7649-0x0;var _0x3e30c0=_0x6add[_0x2a7649];return _0x3e30c0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd6ad('0x0'))(_0xd6ad('0x1'));var moment=require(_0xd6ad('0x2'));var BPromise=require(_0xd6ad('0x3'));var rp=require(_0xd6ad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd6ad('0x5'));var config=require(_0xd6ad('0x6'));var attributes=require(_0xd6ad('0x7'));module[_0xd6ad('0x8')]=function(_0x35aa46,_0x25bab5){return _0x35aa46[_0xd6ad('0x9')](_0xd6ad('0xa'),attributes,{'tableName':_0xd6ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6655=['path','exports','define','Variable','lodash','bluebird','request-promise'];(function(_0x2aa375,_0x2bfaa4){var _0x443c44=function(_0x58739f){while(--_0x58739f){_0x2aa375['push'](_0x2aa375['shift']());}};_0x443c44(++_0x2bfaa4);}(_0x6655,0x193));var _0x5665=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x6655[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x5665('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5665('0x1'));var rp=require(_0x5665('0x2'));var fs=require('fs');var path=require(_0x5665('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x5665('0x4')]=function(_0x41fab0,_0x4b3985){return _0x41fab0[_0x5665('0x5')](_0x5665('0x6'),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 9b5a0c4..1ae4e2f 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 _0x7016=['include','model','map','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','find','options','raw','attributes'];(function(_0x1d3fdc,_0x2b5c54){var _0x128bb0=function(_0x3b7184){while(--_0x3b7184){_0x1d3fdc['push'](_0x1d3fdc['shift']());}};_0x128bb0(++_0x2b5c54);}(_0x7016,0x160));var _0x6701=function(_0x217dd2,_0x772c20){_0x217dd2=_0x217dd2-0x0;var _0x17bebd=_0x7016[_0x217dd2];return _0x17bebd;};'use strict';var _=require(_0x6701('0x0'));var util=require('util');var moment=require(_0x6701('0x1'));var BPromise=require(_0x6701('0x2'));var rs=require(_0x6701('0x3'));var fs=require('fs');var Redis=require(_0x6701('0x4'));var db=require(_0x6701('0x5'))['db'];var utils=require(_0x6701('0x6'));var logger=require('../../config/logger')(_0x6701('0x7'));var config=require('../../config/environment');var jayson=require(_0x6701('0x8'));var client=jayson['client'][_0x6701('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd76f97,_0x1e5865,_0x2f851f){return new BPromise(function(_0x2b0085,_0x99605b){return client['request'](_0xd76f97,_0x2f851f)[_0x6701('0xa')](function(_0x4cb20f){logger[_0x6701('0xb')](_0x6701('0xc'),_0x1e5865,_0x6701('0xd'));logger[_0x6701('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x1e5865,'request\x20sent',JSON[_0x6701('0xf')](_0x4cb20f));if(_0x4cb20f[_0x6701('0x10')]){if(_0x4cb20f[_0x6701('0x10')][_0x6701('0x11')]===0x1f4){logger['error'](_0x6701('0xc'),_0x1e5865,_0x4cb20f[_0x6701('0x10')][_0x6701('0x12')]);return _0x99605b(_0x4cb20f[_0x6701('0x10')]['message']);}logger['error'](_0x6701('0xc'),_0x1e5865,_0x4cb20f['error']['message']);return _0x2b0085(_0x4cb20f[_0x6701('0x10')][_0x6701('0x12')]);}else{logger[_0x6701('0xb')]('Variable,\x20%s,\x20%s',_0x1e5865,'request\x20sent');_0x2b0085(_0x4cb20f[_0x6701('0x13')]['message']);}})[_0x6701('0x14')](function(_0x2bdcda){logger[_0x6701('0x10')](_0x6701('0xc'),_0x1e5865,_0x2bdcda);_0x99605b(_0x2bdcda);});});}exports['ShowVariable']=function(_0x582c5b){var _0x23642a=this;return new Promise(function(_0x52a65c,_0x48f913){return db['Variable'][_0x6701('0x15')]({'raw':_0x582c5b['options']?_0x582c5b[_0x6701('0x16')][_0x6701('0x17')]===undefined?!![]:![]:!![],'where':_0x582c5b[_0x6701('0x16')]?_0x582c5b[_0x6701('0x16')]['where']||null:null,'attributes':_0x582c5b[_0x6701('0x16')]?_0x582c5b[_0x6701('0x16')][_0x6701('0x18')]||null:null,'include':_0x582c5b['options']?_0x582c5b[_0x6701('0x16')][_0x6701('0x19')]?_['map'](_0x582c5b['options'][_0x6701('0x19')],function(_0x3fd12f){return{'model':db[_0x3fd12f[_0x6701('0x1a')]],'as':_0x3fd12f['as'],'attributes':_0x3fd12f[_0x6701('0x18')],'include':_0x3fd12f[_0x6701('0x19')]?_[_0x6701('0x1b')](_0x3fd12f[_0x6701('0x19')],function(_0x3c797c){return{'model':db[_0x3c797c[_0x6701('0x1a')]],'as':_0x3c797c['as'],'attributes':_0x3c797c['attributes'],'include':_0x3c797c['include']?_[_0x6701('0x1b')](_0x3c797c['include'],function(_0x1654ac){return{'model':db[_0x1654ac[_0x6701('0x1a')]],'as':_0x1654ac['as'],'attributes':_0x1654ac[_0x6701('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34a339){logger[_0x6701('0xb')]('ShowVariable',_0x582c5b);logger[_0x6701('0xe')](_0x6701('0x1c'),_0x582c5b,JSON[_0x6701('0xf')](_0x34a339));_0x52a65c(_0x34a339);})[_0x6701('0x14')](function(_0x2d5c00){logger[_0x6701('0x10')](_0x6701('0x1c'),_0x2d5c00[_0x6701('0x12')],_0x582c5b);_0x48f913(_0x23642a[_0x6701('0x10')](0x1f4,_0x2d5c00['message']));});});}; \ No newline at end of file +var _0xd05d=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','ShowVariable','Variable','find','raw','options','where','attributes','include','map','model','stringify','catch','lodash'];(function(_0x51d6fb,_0x56f80d){var _0xb03144=function(_0x598ee8){while(--_0x598ee8){_0x51d6fb['push'](_0x51d6fb['shift']());}};_0xb03144(++_0x56f80d);}(_0xd05d,0x135));var _0xdd05=function(_0x1e6db9,_0x481a8a){_0x1e6db9=_0x1e6db9-0x0;var _0x4f840b=_0xd05d[_0x1e6db9];return _0x4f840b;};'use strict';var _=require(_0xdd05('0x0'));var util=require(_0xdd05('0x1'));var moment=require(_0xdd05('0x2'));var BPromise=require(_0xdd05('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd05('0x4'))['db'];var utils=require(_0xdd05('0x5'));var logger=require(_0xdd05('0x6'))(_0xdd05('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xdd05('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18b0a4,_0x59eafa,_0x31d124){return new BPromise(function(_0x5d8477,_0x5150b3){return client[_0xdd05('0x9')](_0x18b0a4,_0x31d124)[_0xdd05('0xa')](function(_0x4a5bab){logger[_0xdd05('0xb')](_0xdd05('0xc'),_0x59eafa,_0xdd05('0xd'));logger[_0xdd05('0xe')](_0xdd05('0xf'),_0x59eafa,_0xdd05('0xd'),JSON['stringify'](_0x4a5bab));if(_0x4a5bab[_0xdd05('0x10')]){if(_0x4a5bab['error'][_0xdd05('0x11')]===0x1f4){logger['error'](_0xdd05('0xc'),_0x59eafa,_0x4a5bab[_0xdd05('0x10')][_0xdd05('0x12')]);return _0x5150b3(_0x4a5bab[_0xdd05('0x10')][_0xdd05('0x12')]);}logger[_0xdd05('0x10')]('Variable,\x20%s,\x20%s',_0x59eafa,_0x4a5bab[_0xdd05('0x10')]['message']);return _0x5d8477(_0x4a5bab['error'][_0xdd05('0x12')]);}else{logger[_0xdd05('0xb')](_0xdd05('0xc'),_0x59eafa,'request\x20sent');_0x5d8477(_0x4a5bab['result'][_0xdd05('0x12')]);}})['catch'](function(_0x413727){logger[_0xdd05('0x10')]('Variable,\x20%s,\x20%s',_0x59eafa,_0x413727);_0x5150b3(_0x413727);});});}exports[_0xdd05('0x13')]=function(_0x545302){var _0x1b14df=this;return new Promise(function(_0x20dfe7,_0x318035){return db[_0xdd05('0x14')][_0xdd05('0x15')]({'raw':_0x545302['options']?_0x545302['options'][_0xdd05('0x16')]===undefined?!![]:![]:!![],'where':_0x545302[_0xdd05('0x17')]?_0x545302[_0xdd05('0x17')][_0xdd05('0x18')]||null:null,'attributes':_0x545302[_0xdd05('0x17')]?_0x545302['options'][_0xdd05('0x19')]||null:null,'include':_0x545302['options']?_0x545302['options'][_0xdd05('0x1a')]?_[_0xdd05('0x1b')](_0x545302[_0xdd05('0x17')][_0xdd05('0x1a')],function(_0x305cc6){return{'model':db[_0x305cc6[_0xdd05('0x1c')]],'as':_0x305cc6['as'],'attributes':_0x305cc6[_0xdd05('0x19')],'include':_0x305cc6[_0xdd05('0x1a')]?_[_0xdd05('0x1b')](_0x305cc6['include'],function(_0x3d043c){return{'model':db[_0x3d043c[_0xdd05('0x1c')]],'as':_0x3d043c['as'],'attributes':_0x3d043c[_0xdd05('0x19')],'include':_0x3d043c[_0xdd05('0x1a')]?_['map'](_0x3d043c[_0xdd05('0x1a')],function(_0x5f2e1b){return{'model':db[_0x5f2e1b[_0xdd05('0x1c')]],'as':_0x5f2e1b['as'],'attributes':_0x5f2e1b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1074f0){logger[_0xdd05('0xb')](_0xdd05('0x13'),_0x545302);logger[_0xdd05('0xe')](_0xdd05('0x13'),_0x545302,JSON[_0xdd05('0x1d')](_0x1074f0));_0x20dfe7(_0x1074f0);})[_0xdd05('0x1e')](function(_0x3111c4){logger[_0xdd05('0x10')](_0xdd05('0x13'),_0x3111c4[_0xdd05('0x12')],_0x545302);_0x318035(_0x1b14df[_0xdd05('0x10')](0x1f4,_0x3111c4[_0xdd05('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index e1174f2..7122c62 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 _0x00ad=['index','/fetch','isAuthenticated','canUpdate','fetch','/pull','pull','/migrations','migrations','exports','express','Router','./version.controller','get'];(function(_0x90f9fe,_0x522ac8){var _0x6fc5c5=function(_0x3a9d3f){while(--_0x3a9d3f){_0x90f9fe['push'](_0x90f9fe['shift']());}};_0x6fc5c5(++_0x522ac8);}(_0x00ad,0x15a));var _0xd00a=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x00ad[_0x2ec461];return _0x28603d;};'use strict';var express=require(_0xd00a('0x0'));var router=express[_0xd00a('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xd00a('0x2'));router[_0xd00a('0x3')]('/',controller[_0xd00a('0x4')]);router['get'](_0xd00a('0x5'),auth[_0xd00a('0x6')](),auth[_0xd00a('0x7')](),controller[_0xd00a('0x8')]);router[_0xd00a('0x3')]('/reset',auth[_0xd00a('0x6')](),auth[_0xd00a('0x7')](),controller['reset']);router[_0xd00a('0x3')](_0xd00a('0x9'),auth[_0xd00a('0x6')](),auth[_0xd00a('0x7')](),controller[_0xd00a('0xa')]);router[_0xd00a('0x3')]('/restart',auth[_0xd00a('0x6')](),controller['restart']);router[_0xd00a('0x3')](_0xd00a('0xb'),controller[_0xd00a('0xc')]);module[_0xd00a('0xd')]=router; \ No newline at end of file +var _0xc236=['get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','pull','/restart','restart','migrations','express','Router','../../components/auth/service','./version.controller'];(function(_0x3246b4,_0x401153){var _0x34b3d7=function(_0xfe942c){while(--_0xfe942c){_0x3246b4['push'](_0x3246b4['shift']());}};_0x34b3d7(++_0x401153);}(_0xc236,0x1bc));var _0x6c23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc236[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x6c23('0x0'));var router=express[_0x6c23('0x1')]();var auth=require(_0x6c23('0x2'));var controller=require(_0x6c23('0x3'));router[_0x6c23('0x4')]('/',controller[_0x6c23('0x5')]);router[_0x6c23('0x4')](_0x6c23('0x6'),auth[_0x6c23('0x7')](),auth[_0x6c23('0x8')](),controller[_0x6c23('0x9')]);router[_0x6c23('0x4')](_0x6c23('0xa'),auth[_0x6c23('0x7')](),auth['canUpdate'](),controller[_0x6c23('0xb')]);router['get']('/pull',auth[_0x6c23('0x7')](),auth[_0x6c23('0x8')](),controller[_0x6c23('0xc')]);router['get'](_0x6c23('0xd'),auth[_0x6c23('0x7')](),controller[_0x6c23('0xe')]);router[_0x6c23('0x4')]('/migrations',controller[_0x6c23('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index b11e6cd..c97b814 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 _0x7d37=['git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','root','server','replace','.js','length','sort','sequelize','Migration','constructor','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/logger','simple-git','index','exports','query','fetch','latest','2.0.0','status','json','master','error','git\x20fetch','reset','--hard','FETCH_HEAD','info'];(function(_0x32821d,_0x375848){var _0xb856bb=function(_0x160c4d){while(--_0x160c4d){_0x32821d['push'](_0x32821d['shift']());}};_0xb856bb(++_0x375848);}(_0x7d37,0x1db));var _0x77d3=function(_0x50ddc6,_0x2ee4ec){_0x50ddc6=_0x50ddc6-0x0;var _0x416b76=_0x7d37[_0x50ddc6];return _0x416b76;};'use strict';var Umzug=require(_0x77d3('0x0'));var path=require(_0x77d3('0x1'));var fs=require('fs');var _=require(_0x77d3('0x2'));var pkginfo=require('pkginfo')(module,_0x77d3('0x3'));var compareVersions=require(_0x77d3('0x4'));var exec=require(_0x77d3('0x5'))['exec'];var db=require(_0x77d3('0x6'))['db'];var config=require(_0x77d3('0x7'));var pm2=require('../../config/pm2');var logger=require(_0x77d3('0x8'))('update');var git=require(_0x77d3('0x9'))(config['root']);exports[_0x77d3('0xa')]=function(_0x373da8,_0x5c0108){var _0x555390={'current':module[_0x77d3('0xb')][_0x77d3('0x3')],'phonebar':0x2};if(_0x373da8['query']&&_0x373da8[_0x77d3('0xc')]['latest']){return git[_0x77d3('0xd')]()['tags'](function(_0x1afabc,_0x4bdd7a){_0x555390[_0x77d3('0xe')]=(_0x1afabc?module[_0x77d3('0xb')][_0x77d3('0x3')]:_0x4bdd7a[_0x77d3('0xe')])||_0x77d3('0xf');return _0x5c0108[_0x77d3('0x10')](0xc8)[_0x77d3('0x11')](_0x555390);});}else{return _0x5c0108[_0x77d3('0x10')](0xc8)[_0x77d3('0x11')](_0x555390);}};exports['fetch']=function(_0x15ce51,_0x4a621e){return git['fetch'](['origin',_0x77d3('0x12')],function(_0x33d3b8){if(_0x33d3b8){logger[_0x77d3('0x13')](_0x33d3b8);return _0x4a621e[_0x77d3('0x10')](0x1f4)[_0x77d3('0x11')](_0x33d3b8);}logger['info'](_0x77d3('0x14'));return _0x4a621e[_0x77d3('0x10')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x77d3('0x15')]=function(_0xcae48d,_0x60173f){return git[_0x77d3('0x15')]([_0x77d3('0x16'),_0x77d3('0x17')],function(_0x12fb05){if(_0x12fb05){logger[_0x77d3('0x13')](_0x12fb05);return _0x60173f[_0x77d3('0x10')](0x1f4)[_0x77d3('0x11')](_0x12fb05);}logger[_0x77d3('0x18')](_0x77d3('0x19'));return _0x60173f[_0x77d3('0x10')](0xc8)[_0x77d3('0x11')]({'output':_0x77d3('0x1a')});});};exports[_0x77d3('0x1b')]=function(_0xc9008d,_0x471bc0){exec('npm\x20install\x20--production',function(_0x2acc21,_0x17d3a3,_0x1504c7){logger[_0x77d3('0x18')](_0x17d3a3);logger[_0x77d3('0x18')](_0x1504c7);if(_0x2acc21){logger[_0x77d3('0x13')](_0x2acc21);return _0x471bc0[_0x77d3('0x10')](0x1f4)[_0x77d3('0x11')](_0x2acc21);}return _0x471bc0[_0x77d3('0x10')](0xc8)['json']({'output':_0x17d3a3});});};exports[_0x77d3('0x1c')]=function(_0x5dcb4f,_0x467335){return pm2[_0x77d3('0x1c')](_0x77d3('0x1d'))[_0x77d3('0x1e')](function(_0x181438){logger[_0x77d3('0x18')]('pm2\x20restart\x20motion\x20%s',_0x181438);return _0x467335[_0x77d3('0x10')](0xc8)[_0x77d3('0x11')]({'output':_0x77d3('0x1f')});})[_0x77d3('0x20')](function(_0x451c1a){logger[_0x77d3('0x13')](_0x451c1a);return _0x467335[_0x77d3('0x10')](0x1f4)[_0x77d3('0x11')](_0x451c1a);});};exports[_0x77d3('0x21')]=function(_0x41b79d,_0x59c650){var _0x3add49=fs[_0x77d3('0x22')](path['join'](config[_0x77d3('0x23')],_0x77d3('0x24'),'migrations'));var _0x524f89=[];for(var _0x2f4542=0x0;_0x2f4542<_0x3add49['length'];_0x2f4542++){var _0xb9ebbb=_0x3add49[_0x2f4542][_0x77d3('0x25')](_0x77d3('0x26'),'');if(compareVersions(module['exports']['version'],_0xb9ebbb)===-0x1){_0x524f89['push'](_0xb9ebbb);}}if(_0x524f89[_0x77d3('0x27')]){var _0x3c07b8=_0x524f89[_0x77d3('0x28')](compareVersions);var _0x1bd751=new Umzug({'storage':_0x77d3('0x29'),'storageOptions':{'model':db[_0x77d3('0x2a')],'modelName':_0x77d3('0x2a'),'columnName':_0x77d3('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0x77d3('0x29')][_0x77d3('0x2b')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x77d3('0x2c')](config['root'],_0x77d3('0x24'),_0x77d3('0x21')),'pattern':/\.js$/}});_0x1bd751['up']({'migrations':_[_0x77d3('0x2d')](_0x3c07b8,function(_0x1fef28){return _0x1fef28+_0x77d3('0x26');})})['then'](function(){return _0x59c650['status'](0xc8)[_0x77d3('0x11')]({'output':_0x77d3('0x2e')+module[_0x77d3('0xb')][_0x77d3('0x3')]+_0x77d3('0x2f')+_[_0x77d3('0x30')](_0x3c07b8),'migrations':_[_0x77d3('0x2c')](_0x3c07b8)});})[_0x77d3('0x20')](function(_0x96b1e3){if(_0x96b1e3 instanceof db[_0x77d3('0x29')]['UniqueConstraintError']){return _0x59c650['status'](0xc8)[_0x77d3('0x11')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x59c650[_0x77d3('0x10')](0x1f4)['json'](_0x96b1e3);}});}else{return _0x59c650[_0x77d3('0x10')](0xc8)['json']({'output':_0x77d3('0x31')});}}; \ No newline at end of file +var _0x5496=['UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','../../mysqldb','../../config/environment','../../config/pm2','simple-git','root','query','latest','fetch','tags','exports','2.0.0','status','json','origin','master','info','git\x20fetch\x20origin\x20master','reset','--hard','error','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','length','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last'];(function(_0x368c06,_0x809a6f){var _0x40fadf=function(_0x2fb58d){while(--_0x2fb58d){_0x368c06['push'](_0x368c06['shift']());}};_0x40fadf(++_0x809a6f);}(_0x5496,0x175));var _0x6549=function(_0xbf46ad,_0x3daad4){_0xbf46ad=_0xbf46ad-0x0;var _0x151ef2=_0x5496[_0xbf46ad];return _0x151ef2;};'use strict';var Umzug=require(_0x6549('0x0'));var path=require(_0x6549('0x1'));var fs=require('fs');var _=require(_0x6549('0x2'));var pkginfo=require(_0x6549('0x3'))(module,_0x6549('0x4'));var compareVersions=require('compare-versions');var exec=require(_0x6549('0x5'))['exec'];var db=require(_0x6549('0x6'))['db'];var config=require(_0x6549('0x7'));var pm2=require(_0x6549('0x8'));var logger=require('../../config/logger')('update');var git=require(_0x6549('0x9'))(config[_0x6549('0xa')]);exports['index']=function(_0x1ca8fc,_0x3442c3){var _0x1ef2a6={'current':module['exports'][_0x6549('0x4')],'phonebar':0x2};if(_0x1ca8fc[_0x6549('0xb')]&&_0x1ca8fc[_0x6549('0xb')][_0x6549('0xc')]){return git[_0x6549('0xd')]()[_0x6549('0xe')](function(_0x50fa35,_0x551133){_0x1ef2a6[_0x6549('0xc')]=(_0x50fa35?module[_0x6549('0xf')][_0x6549('0x4')]:_0x551133[_0x6549('0xc')])||_0x6549('0x10');return _0x3442c3['status'](0xc8)['json'](_0x1ef2a6);});}else{return _0x3442c3[_0x6549('0x11')](0xc8)[_0x6549('0x12')](_0x1ef2a6);}};exports['fetch']=function(_0x200ff1,_0x150fc8){return git[_0x6549('0xd')]([_0x6549('0x13'),_0x6549('0x14')],function(_0x86ae9d){if(_0x86ae9d){logger['error'](_0x86ae9d);return _0x150fc8['status'](0x1f4)[_0x6549('0x12')](_0x86ae9d);}logger[_0x6549('0x15')]('git\x20fetch');return _0x150fc8[_0x6549('0x11')](0xc8)[_0x6549('0x12')]({'output':_0x6549('0x16')});});};exports[_0x6549('0x17')]=function(_0xffc8b9,_0x53b12b){return git['reset']([_0x6549('0x18'),'FETCH_HEAD'],function(_0x56c15b){if(_0x56c15b){logger[_0x6549('0x19')](_0x56c15b);return _0x53b12b[_0x6549('0x11')](0x1f4)[_0x6549('0x12')](_0x56c15b);}logger[_0x6549('0x15')](_0x6549('0x1a'));return _0x53b12b['status'](0xc8)[_0x6549('0x12')]({'output':'git\x20reset\x20--hard'});});};exports[_0x6549('0x1b')]=function(_0x72322b,_0x3992cf){exec(_0x6549('0x1c'),function(_0x22bcf8,_0x12d547,_0x427b47){logger[_0x6549('0x15')](_0x12d547);logger[_0x6549('0x15')](_0x427b47);if(_0x22bcf8){logger[_0x6549('0x19')](_0x22bcf8);return _0x3992cf[_0x6549('0x11')](0x1f4)[_0x6549('0x12')](_0x22bcf8);}return _0x3992cf[_0x6549('0x11')](0xc8)['json']({'output':_0x12d547});});};exports[_0x6549('0x1d')]=function(_0x1bc8db,_0x53bbca){return pm2[_0x6549('0x1d')](_0x6549('0x1e'))[_0x6549('0x1f')](function(_0x583c7d){logger[_0x6549('0x15')](_0x6549('0x20'),_0x583c7d);return _0x53bbca[_0x6549('0x11')](0xc8)[_0x6549('0x12')]({'output':_0x6549('0x21')});})[_0x6549('0x22')](function(_0x2f58f7){logger[_0x6549('0x19')](_0x2f58f7);return _0x53bbca['status'](0x1f4)[_0x6549('0x12')](_0x2f58f7);});};exports[_0x6549('0x23')]=function(_0x17fdfb,_0x4c605c){var _0x3f1502=fs['readdirSync'](path['join'](config['root'],_0x6549('0x24'),_0x6549('0x23')));var _0x4f3069=[];for(var _0x30aac6=0x0;_0x30aac6<_0x3f1502[_0x6549('0x25')];_0x30aac6++){var _0x2e481f=_0x3f1502[_0x30aac6][_0x6549('0x26')](_0x6549('0x27'),'');if(compareVersions(module[_0x6549('0xf')][_0x6549('0x4')],_0x2e481f)===-0x1){_0x4f3069['push'](_0x2e481f);}}if(_0x4f3069[_0x6549('0x25')]){var _0x3ebea6=_0x4f3069[_0x6549('0x28')](compareVersions);var _0x33bf79=new Umzug({'storage':_0x6549('0x29'),'storageOptions':{'model':db[_0x6549('0x2a')],'modelName':'Migration','columnName':_0x6549('0x4')},'migrations':{'params':[db['sequelize'][_0x6549('0x2b')](),db['sequelize'][_0x6549('0x2c')],function(){throw new Error(_0x6549('0x2d'));}],'path':path[_0x6549('0x2e')](config['root'],_0x6549('0x24'),_0x6549('0x23')),'pattern':/\.js$/}});_0x33bf79['up']({'migrations':_[_0x6549('0x2f')](_0x3ebea6,function(_0x3040e3){return _0x3040e3+'.js';})})['then'](function(){return _0x4c605c['status'](0xc8)[_0x6549('0x12')]({'output':_0x6549('0x30')+module['exports'][_0x6549('0x4')]+_0x6549('0x31')+_[_0x6549('0x32')](_0x3ebea6),'migrations':_[_0x6549('0x2e')](_0x3ebea6)});})[_0x6549('0x22')](function(_0x4d3050){if(_0x4d3050 instanceof db['sequelize'][_0x6549('0x33')]){return _0x4c605c[_0x6549('0x11')](0xc8)[_0x6549('0x12')]({'output':_0x6549('0x34')});}else{return _0x4c605c[_0x6549('0x11')](0x1f4)[_0x6549('0x12')](_0x4d3050);}});}else{return _0x4c605c[_0x6549('0x11')](0xc8)[_0x6549('0x12')]({'output':_0x6549('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index f6bd84c..61f6b9f 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 _0xaf91=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x42aabd,_0x217ade){var _0x2e83fb=function(_0x1508d8){while(--_0x1508d8){_0x42aabd['push'](_0x42aabd['shift']());}};_0x2e83fb(++_0x217ade);}(_0xaf91,0x95));var _0x1af9=function(_0x1c7137,_0x4c7c26){_0x1c7137=_0x1c7137-0x0;var _0xeb4432=_0xaf91[_0x1c7137];return _0xeb4432;};'use strict';var multer=require(_0x1af9('0x0'));var util=require(_0x1af9('0x1'));var path=require(_0x1af9('0x2'));var timeout=require(_0x1af9('0x3'));var express=require(_0x1af9('0x4'));var router=express[_0x1af9('0x5')]();var auth=require(_0x1af9('0x6'));var interaction=require(_0x1af9('0x7'));var config=require(_0x1af9('0x8'));var controller=require(_0x1af9('0x9'));router[_0x1af9('0xa')]('/',auth[_0x1af9('0xb')](),controller[_0x1af9('0xc')]);router[_0x1af9('0xa')](_0x1af9('0xd'),auth[_0x1af9('0xb')](),controller[_0x1af9('0xe')]);router[_0x1af9('0xa')]('/:id',auth[_0x1af9('0xb')](),controller[_0x1af9('0xf')]);router[_0x1af9('0x10')]('/',auth[_0x1af9('0xb')](),controller['create']);router[_0x1af9('0x11')](_0x1af9('0x12'),auth[_0x1af9('0xb')](),controller['update']);router[_0x1af9('0x13')](_0x1af9('0x12'),auth[_0x1af9('0xb')](),controller[_0x1af9('0x14')]);module[_0x1af9('0x15')]=router; \ No newline at end of file +var _0x4f93=['create','update','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x312835,_0xff273e){var _0x1da8b9=function(_0x193c4){while(--_0x193c4){_0x312835['push'](_0x312835['shift']());}};_0x1da8b9(++_0xff273e);}(_0x4f93,0x111));var _0x34f9=function(_0x67c7e2,_0x5f02ee){_0x67c7e2=_0x67c7e2-0x0;var _0x52b665=_0x4f93[_0x67c7e2];return _0x52b665;};'use strict';var multer=require('multer');var util=require(_0x34f9('0x0'));var path=require(_0x34f9('0x1'));var timeout=require(_0x34f9('0x2'));var express=require('express');var router=express[_0x34f9('0x3')]();var auth=require(_0x34f9('0x4'));var interaction=require(_0x34f9('0x5'));var config=require(_0x34f9('0x6'));var controller=require(_0x34f9('0x7'));router[_0x34f9('0x8')]('/',auth[_0x34f9('0x9')](),controller[_0x34f9('0xa')]);router[_0x34f9('0x8')](_0x34f9('0xb'),auth[_0x34f9('0x9')](),controller[_0x34f9('0xc')]);router['get'](_0x34f9('0xd'),auth['isAuthenticated'](),controller[_0x34f9('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x34f9('0xf')]);router['put'](_0x34f9('0xd'),auth[_0x34f9('0x9')](),controller[_0x34f9('0x10')]);router['delete'](_0x34f9('0xd'),auth[_0x34f9('0x9')](),controller[_0x34f9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index c6f62cd..941402b 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 _0x5075=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x11c3ed,_0x65a48){var _0x128922=function(_0x161c2a){while(--_0x161c2a){_0x11c3ed['push'](_0x11c3ed['shift']());}};_0x128922(++_0x65a48);}(_0x5075,0x73));var _0x5507=function(_0x7d9c0d,_0x165295){_0x7d9c0d=_0x7d9c0d-0x0;var _0x26a3c7=_0x5075[_0x7d9c0d];return _0x26a3c7;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'type':{'type':Sequelize[_0x5507('0x2')]},'uniqueid':{'type':Sequelize[_0x5507('0x2')]},'calleridnum':{'type':Sequelize[_0x5507('0x2')]},'calleridname':{'type':Sequelize[_0x5507('0x2')]},'queue':{'type':Sequelize[_0x5507('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5507('0x2')]},'agentcalledAt':{'type':Sequelize[_0x5507('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5507('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x5507('0x3')]},'holdtime':{'type':Sequelize[_0x5507('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x5507('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x5507('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x5507('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x5507('0x2')]},'lastevent':{'type':Sequelize[_0x5507('0x2')]},'channel':{'type':Sequelize[_0x5507('0x2')]},'channelstate':{'type':Sequelize[_0x5507('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5507('0x2')]},'connectedlinename':{'type':Sequelize[_0x5507('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5507('0x2')]},'context':{'type':Sequelize[_0x5507('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5507('0x2')]},'destchannel':{'type':Sequelize[_0x5507('0x2')]},'destchannelstate':{'type':Sequelize[_0x5507('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x5507('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5507('0x2')]},'destcalleridname':{'type':Sequelize[_0x5507('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x5507('0x2')]},'destlanguage':{'type':Sequelize[_0x5507('0x2')]},'destaccountcode':{'type':Sequelize[_0x5507('0x2')]},'destcontext':{'type':Sequelize[_0x5507('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5507('0x2')]},'destuniqueid':{'type':Sequelize[_0x5507('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x5507('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x5507('0x2')]},'transfer':{'type':Sequelize[_0x5507('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5507('0x2')],'comment':_0x5507('0x6')},'transferexten':{'type':Sequelize[_0x5507('0x2')]},'transferuniqueid':{'type':Sequelize[_0x5507('0x2')]},'agententerreason':{'type':Sequelize[_0x5507('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xee14=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','STRING'];(function(_0xaa9ebc,_0x371e5c){var _0x2a05c3=function(_0xe9d66b){while(--_0xe9d66b){_0xaa9ebc['push'](_0xaa9ebc['shift']());}};_0x2a05c3(++_0x371e5c);}(_0xee14,0x13a));var _0x4ee1=function(_0x4745dd,_0x5ce061){_0x4745dd=_0x4745dd-0x0;var _0x418a2a=_0xee14[_0x4745dd];return _0x418a2a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x4ee1('0x0')]},'uniqueid':{'type':Sequelize[_0x4ee1('0x0')]},'calleridnum':{'type':Sequelize[_0x4ee1('0x0')]},'calleridname':{'type':Sequelize[_0x4ee1('0x0')]},'queue':{'type':Sequelize[_0x4ee1('0x0')]},'interface':{'type':Sequelize[_0x4ee1('0x0')]},'membername':{'type':Sequelize[_0x4ee1('0x0')]},'agentcalledAt':{'type':Sequelize[_0x4ee1('0x1')]},'agentconnectAt':{'type':Sequelize[_0x4ee1('0x1')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x4ee1('0x1')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x4ee1('0x2')]},'agentcomplete':{'type':Sequelize[_0x4ee1('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4ee1('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4ee1('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4ee1('0x2')]},'agentacw':{'type':Sequelize[_0x4ee1('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x4ee1('0x0')]},'lastevent':{'type':Sequelize[_0x4ee1('0x0')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x4ee1('0x2')]},'channelstatedesc':{'type':Sequelize[_0x4ee1('0x0')]},'connectedlinenum':{'type':Sequelize[_0x4ee1('0x0')]},'connectedlinename':{'type':Sequelize[_0x4ee1('0x0')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4ee1('0x0')]},'context':{'type':Sequelize[_0x4ee1('0x0')]},'exten':{'type':Sequelize[_0x4ee1('0x0')]},'priority':{'type':Sequelize[_0x4ee1('0x0')]},'destchannel':{'type':Sequelize[_0x4ee1('0x0')]},'destchannelstate':{'type':Sequelize[_0x4ee1('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x4ee1('0x0')]},'destcalleridname':{'type':Sequelize[_0x4ee1('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x4ee1('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x4ee1('0x0')]},'destlanguage':{'type':Sequelize[_0x4ee1('0x0')]},'destaccountcode':{'type':Sequelize[_0x4ee1('0x0')]},'destcontext':{'type':Sequelize[_0x4ee1('0x0')]},'destexten':{'type':Sequelize[_0x4ee1('0x0')]},'destpriority':{'type':Sequelize[_0x4ee1('0x0')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4ee1('0x0')]},'answeredelsewheremembername':{'type':Sequelize[_0x4ee1('0x0')]},'transfer':{'type':Sequelize[_0x4ee1('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4ee1('0x0')],'comment':_0x4ee1('0x4')},'transferexten':{'type':Sequelize[_0x4ee1('0x0')]},'transferuniqueid':{'type':Sequelize[_0x4ee1('0x0')]},'agententerreason':{'type':Sequelize[_0x4ee1('0x2')],'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 e8765ce..6c8bdbe 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 _0x602f=['filter','merge','includeAll','include','rows','catch','show','params','VoiceAgentReport','rawAttributes','intersection','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL'];(function(_0x59a7c2,_0x545089){var _0x2249dc=function(_0x3b6c8f){while(--_0x3b6c8f){_0x59a7c2['push'](_0x59a7c2['shift']());}};_0x2249dc(++_0x545089);}(_0x602f,0x17d));var _0xf602=function(_0x3a8189,_0xeb0098){_0x3a8189=_0x3a8189-0x0;var _0x830c51=_0x602f[_0x3a8189];return _0x830c51;};'use strict';var pdf=require(_0xf602('0x0'));var emlformat=require(_0xf602('0x1'));var rimraf=require(_0xf602('0x2'));var zipdir=require(_0xf602('0x3'));var jsonpatch=require(_0xf602('0x4'));var rp=require(_0xf602('0x5'));var moment=require(_0xf602('0x6'));var BPromise=require(_0xf602('0x7'));var Mustache=require(_0xf602('0x8'));var util=require('util');var path=require('path');var sox=require(_0xf602('0x9'));var csv=require(_0xf602('0xa'));var ejs=require(_0xf602('0xb'));var fs=require('fs');var _=require(_0xf602('0xc'));var squel=require('squel');var crypto=require(_0xf602('0xd'));var jsforce=require(_0xf602('0xe'));var deskjs=require(_0xf602('0xf'));var toCsv=require(_0xf602('0xa'));var querystring=require('querystring');var Papa=require(_0xf602('0x10'));var Redis=require(_0xf602('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf602('0x12'));var logger=require('../../config/logger')(_0xf602('0x13'));var utils=require('../../config/utils');var config=require(_0xf602('0x14'));var db=require(_0xf602('0x15'))['db'];function respondWithStatusCode(_0xf981d,_0x4b9093){_0x4b9093=_0x4b9093||0xcc;return function(_0x33ae8f){if(_0x33ae8f){return _0xf981d[_0xf602('0x16')](_0x4b9093);}return _0xf981d[_0xf602('0x17')](_0x4b9093)[_0xf602('0x18')]();};}function respondWithResult(_0x3a261e,_0x10a2ac){_0x10a2ac=_0x10a2ac||0xc8;return function(_0x5935ef){if(_0x5935ef){return _0x3a261e['status'](_0x10a2ac)['json'](_0x5935ef);}};}function respondWithFilteredResult(_0x435598,_0x4e8efa){return function(_0x4150ba){if(_0x4150ba){var _0x10dd28=_0x4150ba[_0xf602('0x19')],_0x269c43=_0x4e8efa['offset'],_0x2e5693=_0x4e8efa[_0xf602('0x1a')]+_0x4e8efa[_0xf602('0x1b')],_0x44af0f;if(_0x2e5693>=_0x10dd28){_0x2e5693=_0x10dd28;_0x44af0f=0xc8;}else{_0x44af0f=0xce;}_0x435598[_0xf602('0x17')](_0x44af0f);return _0x435598[_0xf602('0x1c')]('Content-Range',_0x269c43+'-'+_0x2e5693+'/'+_0x10dd28)[_0xf602('0x1d')](_0x4150ba);}return null;};}function patchUpdates(_0xddfc27){return function(_0xe9a540){try{jsonpatch[_0xf602('0x1e')](_0xe9a540,_0xddfc27,!![]);}catch(_0x1b59f1){return BPromise[_0xf602('0x1f')](_0x1b59f1);}return _0xe9a540[_0xf602('0x20')]();};}function saveUpdates(_0x43bd3c,_0xf7f339){return function(_0x551f56){if(_0x551f56){return _0x551f56[_0xf602('0x21')](_0x43bd3c)[_0xf602('0x22')](function(_0x5d9225){return _0x5d9225;});}return null;};}function removeEntity(_0x110249,_0x209650){return function(_0x1f192f){if(_0x1f192f){return _0x1f192f['destroy']()[_0xf602('0x22')](function(){_0x110249['status'](0xcc)[_0xf602('0x18')]();});}};}function handleEntityNotFound(_0x34aa18,_0x2eac35){return function(_0x110f9f){if(!_0x110f9f){_0x34aa18[_0xf602('0x16')](0x194);}return _0x110f9f;};}function handleError(_0x3d21a3,_0x1ba39b){_0x1ba39b=_0x1ba39b||0x1f4;return function(_0x5b6cd4){logger[_0xf602('0x23')](_0x5b6cd4[_0xf602('0x24')]);if(_0x5b6cd4[_0xf602('0x25')]){delete _0x5b6cd4[_0xf602('0x25')];}_0x3d21a3[_0xf602('0x17')](_0x1ba39b)[_0xf602('0x26')](_0x5b6cd4);};}exports[_0xf602('0x27')]=function(_0x2ae692,_0x5b1f08){var _0x4f3aa1={},_0x45cb4b={},_0x49e640={'count':0x0,'rows':[]};var _0x581a28=_['map'](db['VoiceAgentReport']['rawAttributes'],function(_0x2c9a50){return{'name':_0x2c9a50[_0xf602('0x28')],'type':_0x2c9a50[_0xf602('0x29')][_0xf602('0x2a')]};});_0x45cb4b[_0xf602('0x2b')]=_[_0xf602('0x2c')](_0x581a28,_0xf602('0x25'));_0x45cb4b[_0xf602('0x2d')]=_[_0xf602('0x2e')](_0x2ae692[_0xf602('0x2d')]);_0x45cb4b['filters']=_['intersection'](_0x45cb4b['model'],_0x45cb4b['query']);_0x4f3aa1[_0xf602('0x2f')]=_['intersection'](_0x45cb4b['model'],qs[_0xf602('0x30')](_0x2ae692[_0xf602('0x2d')]['fields']));_0x4f3aa1[_0xf602('0x2f')]=_0x4f3aa1[_0xf602('0x2f')][_0xf602('0x31')]?_0x4f3aa1[_0xf602('0x2f')]:_0x45cb4b[_0xf602('0x2b')];if(!_0x2ae692[_0xf602('0x2d')][_0xf602('0x32')](_0xf602('0x33'))){_0x4f3aa1[_0xf602('0x1b')]=qs[_0xf602('0x1b')](_0x2ae692[_0xf602('0x2d')]['limit']);_0x4f3aa1[_0xf602('0x1a')]=qs['offset'](_0x2ae692[_0xf602('0x2d')][_0xf602('0x1a')]);}_0x4f3aa1[_0xf602('0x34')]=qs[_0xf602('0x35')](_0x2ae692[_0xf602('0x2d')][_0xf602('0x35')]);_0x4f3aa1[_0xf602('0x36')]=qs['filters'](_['pick'](_0x2ae692['query'],_0x45cb4b[_0xf602('0x37')]));if(_0x2ae692['query']['filter']){_0x4f3aa1[_0xf602('0x36')]=_['merge'](_0x4f3aa1['where'],{'$or':_[_0xf602('0x2c')](_0x581a28,function(_0x5a0578){if(_0x5a0578['type']!==_0xf602('0x38')){var _0x28fdc1={};_0x28fdc1[_0x5a0578[_0xf602('0x25')]]={'$like':'%'+_0x2ae692[_0xf602('0x2d')][_0xf602('0x39')]+'%'};return _0x28fdc1;}})});}_0x4f3aa1=_[_0xf602('0x3a')]({},_0x4f3aa1,_0x2ae692['options']);var _0x2c15a2={'where':_0x4f3aa1[_0xf602('0x36')]};return db['VoiceAgentReport'][_0xf602('0x19')](_0x2c15a2)[_0xf602('0x22')](function(_0x56aad6){_0x49e640['count']=_0x56aad6;if(_0x2ae692[_0xf602('0x2d')][_0xf602('0x3b')]){_0x4f3aa1[_0xf602('0x3c')]=[{'all':!![]}];}return db['VoiceAgentReport']['findAll'](_0x4f3aa1);})[_0xf602('0x22')](function(_0xb59b65){_0x49e640[_0xf602('0x3d')]=_0xb59b65;return _0x49e640;})[_0xf602('0x22')](respondWithFilteredResult(_0x5b1f08,_0x4f3aa1))[_0xf602('0x3e')](handleError(_0x5b1f08,null));};exports[_0xf602('0x3f')]=function(_0x5294f8,_0x1f84bc){var _0x5cd352={'raw':![],'where':{'id':_0x5294f8[_0xf602('0x40')]['id']}},_0x5c5c57={};_0x5c5c57['model']=_[_0xf602('0x2e')](db[_0xf602('0x41')][_0xf602('0x42')]);_0x5c5c57[_0xf602('0x2d')]=_[_0xf602('0x2e')](_0x5294f8[_0xf602('0x2d')]);_0x5c5c57[_0xf602('0x37')]=_[_0xf602('0x43')](_0x5c5c57['model'],_0x5c5c57[_0xf602('0x2d')]);_0x5cd352[_0xf602('0x2f')]=_[_0xf602('0x43')](_0x5c5c57[_0xf602('0x2b')],qs[_0xf602('0x30')](_0x5294f8[_0xf602('0x2d')]['fields']));_0x5cd352['attributes']=_0x5cd352['attributes'][_0xf602('0x31')]?_0x5cd352[_0xf602('0x2f')]:_0x5c5c57[_0xf602('0x2b')];if(_0x5294f8[_0xf602('0x2d')]['includeAll']){_0x5cd352[_0xf602('0x3c')]=[{'all':!![]}];}_0x5cd352=_[_0xf602('0x3a')]({},_0x5cd352,_0x5294f8[_0xf602('0x44')]);return db[_0xf602('0x41')][_0xf602('0x45')](_0x5cd352)[_0xf602('0x22')](handleEntityNotFound(_0x1f84bc,null))['then'](respondWithResult(_0x1f84bc,null))[_0xf602('0x3e')](handleError(_0x1f84bc,null));};exports[_0xf602('0x46')]=function(_0x36de47,_0x1e5bdc){return db[_0xf602('0x41')][_0xf602('0x46')](_0x36de47[_0xf602('0x47')],{})[_0xf602('0x22')](respondWithResult(_0x1e5bdc,0xc9))[_0xf602('0x3e')](handleError(_0x1e5bdc,null));};exports[_0xf602('0x21')]=function(_0x5ee0ab,_0x25e10a){if(_0x5ee0ab[_0xf602('0x47')]['id']){delete _0x5ee0ab['body']['id'];}return db[_0xf602('0x41')][_0xf602('0x45')]({'where':{'id':_0x5ee0ab[_0xf602('0x40')]['id']}})['then'](handleEntityNotFound(_0x25e10a,null))['then'](saveUpdates(_0x5ee0ab['body'],null))[_0xf602('0x22')](respondWithResult(_0x25e10a,null))[_0xf602('0x3e')](handleError(_0x25e10a,null));};exports['destroy']=function(_0x487a48,_0x5ccccf){return db[_0xf602('0x41')]['find']({'where':{'id':_0x487a48[_0xf602('0x40')]['id']}})[_0xf602('0x22')](handleEntityNotFound(_0x5ccccf,null))[_0xf602('0x22')](removeEntity(_0x5ccccf,null))[_0xf602('0x3e')](handleError(_0x5ccccf,null));};exports[_0xf602('0x48')]=function(_0x4cd965,_0x5e4452){return db['VoiceAgentReport'][_0xf602('0x48')]()[_0xf602('0x22')](respondWithResult(_0x5e4452,null))['catch'](handleError(_0x5e4452,null));}; \ No newline at end of file +var _0x2ee6=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','VoiceAgentReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ee6,0xcd));var _0x62ee=function(_0x820ff8,_0x30f0e3){_0x820ff8=_0x820ff8-0x0;var _0x2678bb=_0x2ee6[_0x820ff8];return _0x2678bb;};'use strict';var pdf=require(_0x62ee('0x0'));var emlformat=require(_0x62ee('0x1'));var rimraf=require(_0x62ee('0x2'));var zipdir=require(_0x62ee('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x62ee('0x4'));var moment=require('moment');var BPromise=require(_0x62ee('0x5'));var Mustache=require(_0x62ee('0x6'));var util=require('util');var path=require('path');var sox=require(_0x62ee('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x62ee('0x8'));var crypto=require(_0x62ee('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x62ee('0xa'));var toCsv=require('to-csv');var querystring=require(_0x62ee('0xb'));var Papa=require(_0x62ee('0xc'));var Redis=require(_0x62ee('0xd'));var authService=require(_0x62ee('0xe'));var qs=require(_0x62ee('0xf'));var as=require(_0x62ee('0x10'));var hardwareService=require(_0x62ee('0x11'));var logger=require(_0x62ee('0x12'))(_0x62ee('0x13'));var utils=require(_0x62ee('0x14'));var config=require(_0x62ee('0x15'));var db=require(_0x62ee('0x16'))['db'];function respondWithStatusCode(_0x5bd24f,_0x17f08c){_0x17f08c=_0x17f08c||0xcc;return function(_0x3aaee6){if(_0x3aaee6){return _0x5bd24f[_0x62ee('0x17')](_0x17f08c);}return _0x5bd24f[_0x62ee('0x18')](_0x17f08c)['end']();};}function respondWithResult(_0x483727,_0x2f2ad7){_0x2f2ad7=_0x2f2ad7||0xc8;return function(_0x144e64){if(_0x144e64){return _0x483727[_0x62ee('0x18')](_0x2f2ad7)[_0x62ee('0x19')](_0x144e64);}};}function respondWithFilteredResult(_0x52fbbe,_0xabcc9b){return function(_0x23b31d){if(_0x23b31d){var _0x27f9cf=_0x23b31d[_0x62ee('0x1a')],_0x371e39=_0xabcc9b[_0x62ee('0x1b')],_0x41846c=_0xabcc9b[_0x62ee('0x1b')]+_0xabcc9b[_0x62ee('0x1c')],_0x28a00e;if(_0x41846c>=_0x27f9cf){_0x41846c=_0x27f9cf;_0x28a00e=0xc8;}else{_0x28a00e=0xce;}_0x52fbbe[_0x62ee('0x18')](_0x28a00e);return _0x52fbbe[_0x62ee('0x1d')]('Content-Range',_0x371e39+'-'+_0x41846c+'/'+_0x27f9cf)['json'](_0x23b31d);}return null;};}function patchUpdates(_0x2a3fb9){return function(_0x1c9df5){try{jsonpatch[_0x62ee('0x1e')](_0x1c9df5,_0x2a3fb9,!![]);}catch(_0xf44e1f){return BPromise[_0x62ee('0x1f')](_0xf44e1f);}return _0x1c9df5[_0x62ee('0x20')]();};}function saveUpdates(_0x54ba78,_0x4d41b2){return function(_0x22cf01){if(_0x22cf01){return _0x22cf01[_0x62ee('0x21')](_0x54ba78)[_0x62ee('0x22')](function(_0x4af2fd){return _0x4af2fd;});}return null;};}function removeEntity(_0x1fe625,_0x4ee21f){return function(_0x195222){if(_0x195222){return _0x195222[_0x62ee('0x23')]()['then'](function(){_0x1fe625[_0x62ee('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fed2c,_0x4709b1){return function(_0x3e2c8c){if(!_0x3e2c8c){_0x4fed2c[_0x62ee('0x17')](0x194);}return _0x3e2c8c;};}function handleError(_0x58d6bb,_0x2f574b){_0x2f574b=_0x2f574b||0x1f4;return function(_0x24a281){logger[_0x62ee('0x24')](_0x24a281[_0x62ee('0x25')]);if(_0x24a281['name']){delete _0x24a281[_0x62ee('0x26')];}_0x58d6bb[_0x62ee('0x18')](_0x2f574b)['send'](_0x24a281);};}exports[_0x62ee('0x27')]=function(_0x150ff3,_0x16bd37){var _0x307d84={},_0x519ee4={},_0x5e43f1={'count':0x0,'rows':[]};var _0x502be9=_[_0x62ee('0x28')](db[_0x62ee('0x29')][_0x62ee('0x2a')],function(_0x172355){return{'name':_0x172355[_0x62ee('0x2b')],'type':_0x172355['type'][_0x62ee('0x2c')]};});_0x519ee4['model']=_[_0x62ee('0x28')](_0x502be9,_0x62ee('0x26'));_0x519ee4[_0x62ee('0x2d')]=_[_0x62ee('0x2e')](_0x150ff3[_0x62ee('0x2d')]);_0x519ee4[_0x62ee('0x2f')]=_[_0x62ee('0x30')](_0x519ee4['model'],_0x519ee4[_0x62ee('0x2d')]);_0x307d84['attributes']=_[_0x62ee('0x30')](_0x519ee4[_0x62ee('0x31')],qs[_0x62ee('0x32')](_0x150ff3[_0x62ee('0x2d')][_0x62ee('0x32')]));_0x307d84[_0x62ee('0x33')]=_0x307d84[_0x62ee('0x33')][_0x62ee('0x34')]?_0x307d84[_0x62ee('0x33')]:_0x519ee4[_0x62ee('0x31')];if(!_0x150ff3[_0x62ee('0x2d')][_0x62ee('0x35')](_0x62ee('0x36'))){_0x307d84[_0x62ee('0x1c')]=qs[_0x62ee('0x1c')](_0x150ff3[_0x62ee('0x2d')][_0x62ee('0x1c')]);_0x307d84['offset']=qs[_0x62ee('0x1b')](_0x150ff3[_0x62ee('0x2d')][_0x62ee('0x1b')]);}_0x307d84['order']=qs[_0x62ee('0x37')](_0x150ff3[_0x62ee('0x2d')][_0x62ee('0x37')]);_0x307d84[_0x62ee('0x38')]=qs['filters'](_[_0x62ee('0x39')](_0x150ff3['query'],_0x519ee4[_0x62ee('0x2f')]));if(_0x150ff3[_0x62ee('0x2d')][_0x62ee('0x3a')]){_0x307d84[_0x62ee('0x38')]=_[_0x62ee('0x3b')](_0x307d84[_0x62ee('0x38')],{'$or':_['map'](_0x502be9,function(_0x147363){if(_0x147363[_0x62ee('0x3c')]!=='VIRTUAL'){var _0x240df7={};_0x240df7[_0x147363['name']]={'$like':'%'+_0x150ff3[_0x62ee('0x2d')]['filter']+'%'};return _0x240df7;}})});}_0x307d84=_[_0x62ee('0x3b')]({},_0x307d84,_0x150ff3[_0x62ee('0x3d')]);var _0x17bfc6={'where':_0x307d84[_0x62ee('0x38')]};return db['VoiceAgentReport'][_0x62ee('0x1a')](_0x17bfc6)['then'](function(_0x29c9e9){_0x5e43f1[_0x62ee('0x1a')]=_0x29c9e9;if(_0x150ff3['query'][_0x62ee('0x3e')]){_0x307d84[_0x62ee('0x3f')]=[{'all':!![]}];}return db[_0x62ee('0x29')][_0x62ee('0x40')](_0x307d84);})['then'](function(_0x582067){_0x5e43f1[_0x62ee('0x41')]=_0x582067;return _0x5e43f1;})['then'](respondWithFilteredResult(_0x16bd37,_0x307d84))[_0x62ee('0x42')](handleError(_0x16bd37,null));};exports[_0x62ee('0x43')]=function(_0x2ab178,_0x14bb58){var _0x349cb5={'raw':![],'where':{'id':_0x2ab178[_0x62ee('0x44')]['id']}},_0x50d38c={};_0x50d38c[_0x62ee('0x31')]=_['keys'](db[_0x62ee('0x29')]['rawAttributes']);_0x50d38c['query']=_[_0x62ee('0x2e')](_0x2ab178[_0x62ee('0x2d')]);_0x50d38c[_0x62ee('0x2f')]=_[_0x62ee('0x30')](_0x50d38c[_0x62ee('0x31')],_0x50d38c['query']);_0x349cb5[_0x62ee('0x33')]=_['intersection'](_0x50d38c[_0x62ee('0x31')],qs[_0x62ee('0x32')](_0x2ab178[_0x62ee('0x2d')]['fields']));_0x349cb5[_0x62ee('0x33')]=_0x349cb5[_0x62ee('0x33')]['length']?_0x349cb5['attributes']:_0x50d38c[_0x62ee('0x31')];if(_0x2ab178[_0x62ee('0x2d')][_0x62ee('0x3e')]){_0x349cb5['include']=[{'all':!![]}];}_0x349cb5=_[_0x62ee('0x3b')]({},_0x349cb5,_0x2ab178[_0x62ee('0x3d')]);return db[_0x62ee('0x29')][_0x62ee('0x45')](_0x349cb5)[_0x62ee('0x22')](handleEntityNotFound(_0x14bb58,null))[_0x62ee('0x22')](respondWithResult(_0x14bb58,null))[_0x62ee('0x42')](handleError(_0x14bb58,null));};exports[_0x62ee('0x46')]=function(_0x31d71e,_0x2847fd){return db[_0x62ee('0x29')]['create'](_0x31d71e[_0x62ee('0x47')],{})[_0x62ee('0x22')](respondWithResult(_0x2847fd,0xc9))[_0x62ee('0x42')](handleError(_0x2847fd,null));};exports[_0x62ee('0x21')]=function(_0x3f8786,_0x22ccc4){if(_0x3f8786[_0x62ee('0x47')]['id']){delete _0x3f8786[_0x62ee('0x47')]['id'];}return db[_0x62ee('0x29')][_0x62ee('0x45')]({'where':{'id':_0x3f8786[_0x62ee('0x44')]['id']}})[_0x62ee('0x22')](handleEntityNotFound(_0x22ccc4,null))[_0x62ee('0x22')](saveUpdates(_0x3f8786[_0x62ee('0x47')],null))[_0x62ee('0x22')](respondWithResult(_0x22ccc4,null))[_0x62ee('0x42')](handleError(_0x22ccc4,null));};exports[_0x62ee('0x23')]=function(_0x2c14dc,_0x4d095f){return db[_0x62ee('0x29')][_0x62ee('0x45')]({'where':{'id':_0x2c14dc[_0x62ee('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d095f,null))[_0x62ee('0x22')](removeEntity(_0x4d095f,null))['catch'](handleError(_0x4d095f,null));};exports[_0x62ee('0x48')]=function(_0x595fd9,_0x3e8562){return db['VoiceAgentReport'][_0x62ee('0x48')]()[_0x62ee('0x22')](respondWithResult(_0x3e8562,null))['catch'](handleError(_0x3e8562,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index e085c44..b5b95b1 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 _0xb941=['../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','destuniqueid','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x586c3c,_0x3ce11f){var _0x552d7d=function(_0x3e5932){while(--_0x3e5932){_0x586c3c['push'](_0x586c3c['shift']());}};_0x552d7d(++_0x3ce11f);}(_0xb941,0x7e));var _0x1b94=function(_0x51e49f,_0x5aebc3){_0x51e49f=_0x51e49f-0x0;var _0x210be3=_0xb941[_0x51e49f];return _0x210be3;};'use strict';var _=require(_0x1b94('0x0'));var util=require(_0x1b94('0x1'));var logger=require(_0x1b94('0x2'))('api');var moment=require(_0x1b94('0x3'));var BPromise=require(_0x1b94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b94('0x5'));var config=require(_0x1b94('0x6'));var attributes=require(_0x1b94('0x7'));module[_0x1b94('0x8')]=function(_0x2dd182,_0x218356){return _0x2dd182['define'](_0x1b94('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x1b94('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf333=['rimraf','exports','define','VoiceAgentReport','uniqueid','util','api','bluebird','request-promise','path'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0xf333,0x163));var _0x3f33=function(_0x465539,_0x2f00d2){_0x465539=_0x465539-0x0;var _0x3aeafa=_0xf333[_0x465539];return _0x3aeafa;};'use strict';var _=require('lodash');var util=require(_0x3f33('0x0'));var logger=require('../../config/logger')(_0x3f33('0x1'));var moment=require('moment');var BPromise=require(_0x3f33('0x2'));var rp=require(_0x3f33('0x3'));var fs=require('fs');var path=require(_0x3f33('0x4'));var rimraf=require(_0x3f33('0x5'));var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module[_0x3f33('0x6')]=function(_0x5c314b,_0x4cceef){return _0x5c314b[_0x3f33('0x7')](_0x3f33('0x8'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x3f33('0x9'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index ebf2cc3..23aee4c 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 _0x1fbf=['../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','stringify','UpdateVoiceAgentReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5be8ab,_0x4000a6){var _0x35914d=function(_0x5c5e05){while(--_0x5c5e05){_0x5be8ab['push'](_0x5be8ab['shift']());}};_0x35914d(++_0x4000a6);}(_0x1fbf,0x1c8));var _0xf1fb=function(_0x29fb63,_0xdd2860){_0x29fb63=_0x29fb63-0x0;var _0x1c8876=_0x1fbf[_0x29fb63];return _0x1c8876;};'use strict';var _=require(_0xf1fb('0x0'));var util=require(_0xf1fb('0x1'));var moment=require(_0xf1fb('0x2'));var BPromise=require(_0xf1fb('0x3'));var rs=require(_0xf1fb('0x4'));var fs=require('fs');var Redis=require(_0xf1fb('0x5'));var db=require(_0xf1fb('0x6'))['db'];var utils=require(_0xf1fb('0x7'));var logger=require(_0xf1fb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf1fb('0x9')][_0xf1fb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9da017,_0x1bff4e,_0x109262){return new BPromise(function(_0x451c39,_0x25c219){return client[_0xf1fb('0xb')](_0x9da017,_0x109262)[_0xf1fb('0xc')](function(_0x943181){logger[_0xf1fb('0xd')](_0xf1fb('0xe'),_0x1bff4e,_0xf1fb('0xf'));logger[_0xf1fb('0x10')](_0xf1fb('0x11'),_0x1bff4e,_0xf1fb('0xf'),JSON['stringify'](_0x943181));if(_0x943181[_0xf1fb('0x12')]){if(_0x943181[_0xf1fb('0x12')][_0xf1fb('0x13')]===0x1f4){logger['error'](_0xf1fb('0xe'),_0x1bff4e,_0x943181[_0xf1fb('0x12')]['message']);return _0x25c219(_0x943181[_0xf1fb('0x12')][_0xf1fb('0x14')]);}logger[_0xf1fb('0x12')](_0xf1fb('0xe'),_0x1bff4e,_0x943181[_0xf1fb('0x12')][_0xf1fb('0x14')]);return _0x451c39(_0x943181['error']['message']);}else{logger['info'](_0xf1fb('0xe'),_0x1bff4e,_0xf1fb('0xf'));_0x451c39(_0x943181[_0xf1fb('0x15')][_0xf1fb('0x14')]);}})[_0xf1fb('0x16')](function(_0x119d03){logger[_0xf1fb('0x12')](_0xf1fb('0xe'),_0x1bff4e,_0x119d03);_0x25c219(_0x119d03);});});}exports[_0xf1fb('0x17')]=function(_0x86466d){var _0x27b85e=this;return new Promise(function(_0x2d4d95,_0x3f868f){return db[_0xf1fb('0x18')][_0xf1fb('0x19')](_0x86466d['body'],{'raw':_0x86466d[_0xf1fb('0x1a')]?_0x86466d['options'][_0xf1fb('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5d8bca){logger[_0xf1fb('0xd')](_0xf1fb('0x17'),_0x86466d);logger[_0xf1fb('0x10')](_0xf1fb('0x17'),_0x86466d,JSON[_0xf1fb('0x1c')](_0x5d8bca));_0x2d4d95(_0x5d8bca);})[_0xf1fb('0x16')](function(_0x34f99f){logger['error'](_0xf1fb('0x17'),_0x34f99f[_0xf1fb('0x14')],_0x86466d);_0x3f868f(_0x27b85e['error'](0x1f4,_0x34f99f[_0xf1fb('0x14')]));});});};exports[_0xf1fb('0x1d')]=function(_0x422a5d){var _0x6fd8bd=this;return new Promise(function(_0x5261e3,_0x4e6b9c){return db[_0xf1fb('0x18')][_0xf1fb('0x1e')](_0x422a5d['body'],{'raw':_0x422a5d['options']?_0x422a5d[_0xf1fb('0x1a')][_0xf1fb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x422a5d[_0xf1fb('0x1a')]?_0x422a5d['options'][_0xf1fb('0x1f')]||null:null,'attributes':_0x422a5d[_0xf1fb('0x1a')]?_0x422a5d['options']['attributes']||null:null,'limit':_0x422a5d['options']?_0x422a5d[_0xf1fb('0x1a')][_0xf1fb('0x20')]||null:null})['then'](function(_0x1c58aa){logger[_0xf1fb('0xd')](_0xf1fb('0x1d'),_0x422a5d);logger[_0xf1fb('0x10')](_0xf1fb('0x1d'),_0x422a5d,JSON['stringify'](_0x1c58aa));_0x5261e3(_0x1c58aa);})[_0xf1fb('0x16')](function(_0x3d0b56){logger[_0xf1fb('0x12')](_0xf1fb('0x1d'),_0x3d0b56[_0xf1fb('0x14')],_0x422a5d);_0x4e6b9c(_0x6fd8bd[_0xf1fb('0x12')](0x1f4,_0x3d0b56[_0xf1fb('0x14')]));});});}; \ No newline at end of file +var _0xdf1b=['stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','update','raw','limit','UpdateVoiceAgentReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s'];(function(_0x205b98,_0x569622){var _0x5d7ec6=function(_0x38158c){while(--_0x38158c){_0x205b98['push'](_0x205b98['shift']());}};_0x5d7ec6(++_0x569622);}(_0xdf1b,0xcf));var _0xbdf1=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0xdf1b[_0x4f2c3a];return _0x17d91c;};'use strict';var _=require(_0xbdf1('0x0'));var util=require(_0xbdf1('0x1'));var moment=require(_0xbdf1('0x2'));var BPromise=require('bluebird');var rs=require(_0xbdf1('0x3'));var fs=require('fs');var Redis=require(_0xbdf1('0x4'));var db=require(_0xbdf1('0x5'))['db'];var utils=require(_0xbdf1('0x6'));var logger=require(_0xbdf1('0x7'))(_0xbdf1('0x8'));var config=require(_0xbdf1('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbdf1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14502e,_0x46af04,_0x3b183c){return new BPromise(function(_0x5caf80,_0x772820){return client[_0xbdf1('0xb')](_0x14502e,_0x3b183c)[_0xbdf1('0xc')](function(_0x57c518){logger[_0xbdf1('0xd')](_0xbdf1('0xe'),_0x46af04,'request\x20sent');logger[_0xbdf1('0xf')](_0xbdf1('0x10'),_0x46af04,'request\x20sent',JSON[_0xbdf1('0x11')](_0x57c518));if(_0x57c518[_0xbdf1('0x12')]){if(_0x57c518[_0xbdf1('0x12')][_0xbdf1('0x13')]===0x1f4){logger[_0xbdf1('0x12')](_0xbdf1('0xe'),_0x46af04,_0x57c518['error'][_0xbdf1('0x14')]);return _0x772820(_0x57c518[_0xbdf1('0x12')][_0xbdf1('0x14')]);}logger['error'](_0xbdf1('0xe'),_0x46af04,_0x57c518['error'][_0xbdf1('0x14')]);return _0x5caf80(_0x57c518[_0xbdf1('0x12')]['message']);}else{logger[_0xbdf1('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x46af04,'request\x20sent');_0x5caf80(_0x57c518[_0xbdf1('0x15')][_0xbdf1('0x14')]);}})[_0xbdf1('0x16')](function(_0x7ae31e){logger[_0xbdf1('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x46af04,_0x7ae31e);_0x772820(_0x7ae31e);});});}exports[_0xbdf1('0x17')]=function(_0x3eb3ef){var _0x1d7964=this;return new Promise(function(_0x5a3cb0,_0x38cdd1){return db[_0xbdf1('0x18')][_0xbdf1('0x19')](_0x3eb3ef[_0xbdf1('0x1a')],{'raw':_0x3eb3ef['options']?_0x3eb3ef[_0xbdf1('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xbdf1('0xc')](function(_0xe253f0){logger['info'](_0xbdf1('0x17'),_0x3eb3ef);logger[_0xbdf1('0xf')](_0xbdf1('0x17'),_0x3eb3ef,JSON[_0xbdf1('0x11')](_0xe253f0));_0x5a3cb0(_0xe253f0);})[_0xbdf1('0x16')](function(_0xc488ed){logger[_0xbdf1('0x12')](_0xbdf1('0x17'),_0xc488ed['message'],_0x3eb3ef);_0x38cdd1(_0x1d7964[_0xbdf1('0x12')](0x1f4,_0xc488ed['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x3331ff){var _0x23ec20=this;return new Promise(function(_0x19e5ac,_0x2a25a7){return db[_0xbdf1('0x18')][_0xbdf1('0x1c')](_0x3331ff[_0xbdf1('0x1a')],{'raw':_0x3331ff[_0xbdf1('0x1b')]?_0x3331ff[_0xbdf1('0x1b')][_0xbdf1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3331ff['options']?_0x3331ff[_0xbdf1('0x1b')]['where']||null:null,'attributes':_0x3331ff[_0xbdf1('0x1b')]?_0x3331ff[_0xbdf1('0x1b')]['attributes']||null:null,'limit':_0x3331ff[_0xbdf1('0x1b')]?_0x3331ff['options'][_0xbdf1('0x1e')]||null:null})[_0xbdf1('0xc')](function(_0x11c627){logger['info'](_0xbdf1('0x1f'),_0x3331ff);logger[_0xbdf1('0xf')](_0xbdf1('0x1f'),_0x3331ff,JSON['stringify'](_0x11c627));_0x19e5ac(_0x11c627);})['catch'](function(_0x3e43f4){logger[_0xbdf1('0x12')](_0xbdf1('0x1f'),_0x3e43f4[_0xbdf1('0x14')],_0x3331ff);_0x2a25a7(_0x23ec20['error'](0x1f4,_0x3e43f4[_0xbdf1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 261a5b7..a3fdcec 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 _0xa67f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','describe','show','post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x586106,_0x23eba5){var _0x6be57f=function(_0x35e7a9){while(--_0x35e7a9){_0x586106['push'](_0x586106['shift']());}};_0x6be57f(++_0x23eba5);}(_0xa67f,0xa2));var _0xfa67=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xa67f[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xfa67('0x0'));var util=require(_0xfa67('0x1'));var path=require(_0xfa67('0x2'));var timeout=require(_0xfa67('0x3'));var express=require(_0xfa67('0x4'));var router=express[_0xfa67('0x5')]();var auth=require(_0xfa67('0x6'));var interaction=require(_0xfa67('0x7'));var config=require(_0xfa67('0x8'));var controller=require(_0xfa67('0x9'));router[_0xfa67('0xa')]('/',auth[_0xfa67('0xb')](),controller[_0xfa67('0xc')]);router[_0xfa67('0xa')]('/describe',auth[_0xfa67('0xb')](),controller[_0xfa67('0xd')]);router[_0xfa67('0xa')]('/:id',auth[_0xfa67('0xb')](),controller[_0xfa67('0xe')]);router[_0xfa67('0xf')]('/',auth[_0xfa67('0xb')](),controller['create']);router[_0xfa67('0x10')](_0xfa67('0x11'),auth[_0xfa67('0xb')](),controller[_0xfa67('0x12')]);router['delete']('/:id',auth[_0xfa67('0xb')](),controller[_0xfa67('0x13')]);module[_0xfa67('0x14')]=router; \ No newline at end of file +var _0x9586=['/:id','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9586,0xf2));var _0x6958=function(_0x480409,_0x13b0a5){_0x480409=_0x480409-0x0;var _0x4201bf=_0x9586[_0x480409];return _0x4201bf;};'use strict';var multer=require(_0x6958('0x0'));var util=require(_0x6958('0x1'));var path=require(_0x6958('0x2'));var timeout=require(_0x6958('0x3'));var express=require('express');var router=express[_0x6958('0x4')]();var auth=require(_0x6958('0x5'));var interaction=require(_0x6958('0x6'));var config=require(_0x6958('0x7'));var controller=require(_0x6958('0x8'));router[_0x6958('0x9')]('/',auth[_0x6958('0xa')](),controller[_0x6958('0xb')]);router[_0x6958('0x9')](_0x6958('0xc'),auth[_0x6958('0xa')](),controller[_0x6958('0xd')]);router[_0x6958('0x9')]('/:id',auth[_0x6958('0xa')](),controller[_0x6958('0xe')]);router['post']('/',auth[_0x6958('0xa')](),controller[_0x6958('0xf')]);router[_0x6958('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6958('0x11')]);router['delete'](_0x6958('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x6958('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 4b05756..6bedbd6 100644 --- a/server/api/voiceCallReport/voiceCallReport.attributes.js +++ b/server/api/voiceCallReport/voiceCallReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x25e53e,_0xb1dc6){var _0x4dc1ab=function(_0xacf0cd){while(--_0xacf0cd){_0x25e53e['push'](_0x25e53e['shift']());}};_0x4dc1ab(++_0xb1dc6);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0xf482c1,_0x32cbca){var _0x184548=function(_0x2f8086){while(--_0x2f8086){_0xf482c1['push'](_0xf482c1['shift']());}};_0x184548(++_0x32cbca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'uniqueid':{'type':Sequelize[_0x0a9e('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0a9e('0x3'),'outbound',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'))},'tag':{'type':Sequelize[_0x0a9e('0x2')]},'accountcode':{'type':Sequelize[_0x0a9e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0a9e('0x2')]},'destinationcontext':{'type':Sequelize[_0x0a9e('0x2')]},'callerid':{'type':Sequelize[_0x0a9e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x0a9e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0a9e('0x7')]},'answertime':{'type':Sequelize[_0x0a9e('0x7')]},'endtime':{'type':Sequelize[_0x0a9e('0x7')]},'duration':{'type':Sequelize[_0x0a9e('0x8')]},'billableseconds':{'type':Sequelize[_0x0a9e('0x8')]},'mohtime':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0a9e('0x2')]},'prefix':{'type':Sequelize[_0x0a9e('0x2')]},'routeid':{'type':Sequelize[_0x0a9e('0x8')]},'sipcallid':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index b17d5da..2ec50e8 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 _0xe763=['nolimit','order','sort','where','pick','filter','merge','type','options','then','count','fullname','alias','User','findAll','catch','keys','includeAll','include','find','create','body','params','describe','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xe763,0xba));var _0x3e76=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0xe763[_0x83af7f];return _0x32d85c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3e76('0x0'));var rimraf=require(_0x3e76('0x1'));var zipdir=require(_0x3e76('0x2'));var jsonpatch=require(_0x3e76('0x3'));var rp=require(_0x3e76('0x4'));var moment=require(_0x3e76('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3e76('0x6'));var util=require(_0x3e76('0x7'));var path=require(_0x3e76('0x8'));var sox=require(_0x3e76('0x9'));var csv=require('to-csv');var ejs=require(_0x3e76('0xa'));var fs=require('fs');var _=require(_0x3e76('0xb'));var squel=require(_0x3e76('0xc'));var crypto=require(_0x3e76('0xd'));var jsforce=require(_0x3e76('0xe'));var deskjs=require(_0x3e76('0xf'));var toCsv=require(_0x3e76('0x10'));var querystring=require(_0x3e76('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3e76('0x12'));var qs=require(_0x3e76('0x13'));var as=require(_0x3e76('0x14'));var hardwareService=require(_0x3e76('0x15'));var logger=require(_0x3e76('0x16'))('api');var utils=require(_0x3e76('0x17'));var config=require(_0x3e76('0x18'));var db=require(_0x3e76('0x19'))['db'];function respondWithStatusCode(_0x2308d1,_0x17989e){_0x17989e=_0x17989e||0xcc;return function(_0x31d1b6){if(_0x31d1b6){return _0x2308d1[_0x3e76('0x1a')](_0x17989e);}return _0x2308d1[_0x3e76('0x1b')](_0x17989e)[_0x3e76('0x1c')]();};}function respondWithResult(_0x226b09,_0x549ed2){_0x549ed2=_0x549ed2||0xc8;return function(_0xd8718){if(_0xd8718){return _0x226b09[_0x3e76('0x1b')](_0x549ed2)['json'](_0xd8718);}};}function respondWithFilteredResult(_0x3e4f82,_0x59c591){return function(_0x59ae30){if(_0x59ae30){var _0x3feecd=_0x59ae30['count'],_0x5c88e3=_0x59c591[_0x3e76('0x1d')],_0x53fdca=_0x59c591[_0x3e76('0x1d')]+_0x59c591[_0x3e76('0x1e')],_0x399e72;if(_0x53fdca>=_0x3feecd){_0x53fdca=_0x3feecd;_0x399e72=0xc8;}else{_0x399e72=0xce;}_0x3e4f82['status'](_0x399e72);return _0x3e4f82[_0x3e76('0x1f')](_0x3e76('0x20'),_0x5c88e3+'-'+_0x53fdca+'/'+_0x3feecd)['json'](_0x59ae30);}return null;};}function patchUpdates(_0x4ecb21){return function(_0x561fc9){try{jsonpatch[_0x3e76('0x21')](_0x561fc9,_0x4ecb21,!![]);}catch(_0x366089){return BPromise[_0x3e76('0x22')](_0x366089);}return _0x561fc9[_0x3e76('0x23')]();};}function saveUpdates(_0x2b5c53,_0x27aca6){return function(_0x1dd807){if(_0x1dd807){return _0x1dd807['update'](_0x2b5c53)['then'](function(_0xe5ffa0){return _0xe5ffa0;});}return null;};}function removeEntity(_0x1fd8e3,_0x186490){return function(_0x97320c){if(_0x97320c){return _0x97320c[_0x3e76('0x24')]()['then'](function(){_0x1fd8e3[_0x3e76('0x1b')](0xcc)[_0x3e76('0x1c')]();});}};}function handleEntityNotFound(_0x22ce3b,_0x2868e5){return function(_0x3e8eda){if(!_0x3e8eda){_0x22ce3b['sendStatus'](0x194);}return _0x3e8eda;};}function handleError(_0x1e49f8,_0x543a4b){_0x543a4b=_0x543a4b||0x1f4;return function(_0x47ee94){logger[_0x3e76('0x25')](_0x47ee94[_0x3e76('0x26')]);if(_0x47ee94[_0x3e76('0x27')]){delete _0x47ee94['name'];}_0x1e49f8[_0x3e76('0x1b')](_0x543a4b)[_0x3e76('0x28')](_0x47ee94);};}exports[_0x3e76('0x29')]=function(_0x359cc0,_0x49f386){var _0x27027d={},_0xb51eee={},_0x4675d0={'count':0x0,'rows':[]};var _0x3115e7=_[_0x3e76('0x2a')](db[_0x3e76('0x2b')][_0x3e76('0x2c')],function(_0x5d68e7){return{'name':_0x5d68e7[_0x3e76('0x2d')],'type':_0x5d68e7['type']['key']};});_0xb51eee['model']=_[_0x3e76('0x2a')](_0x3115e7,'name');_0xb51eee[_0x3e76('0x2e')]=_['keys'](_0x359cc0[_0x3e76('0x2e')]);_0xb51eee[_0x3e76('0x2f')]=_[_0x3e76('0x30')](_0xb51eee[_0x3e76('0x31')],_0xb51eee[_0x3e76('0x2e')]);_0x27027d[_0x3e76('0x32')]=_['intersection'](_0xb51eee[_0x3e76('0x31')],qs[_0x3e76('0x33')](_0x359cc0[_0x3e76('0x2e')][_0x3e76('0x33')]));_0x27027d['attributes']=_0x27027d[_0x3e76('0x32')][_0x3e76('0x34')]?_0x27027d[_0x3e76('0x32')]:_0xb51eee[_0x3e76('0x31')];if(!_0x359cc0[_0x3e76('0x2e')][_0x3e76('0x35')](_0x3e76('0x36'))){_0x27027d[_0x3e76('0x1e')]=qs[_0x3e76('0x1e')](_0x359cc0[_0x3e76('0x2e')][_0x3e76('0x1e')]);_0x27027d[_0x3e76('0x1d')]=qs[_0x3e76('0x1d')](_0x359cc0['query'][_0x3e76('0x1d')]);}_0x27027d[_0x3e76('0x37')]=qs[_0x3e76('0x38')](_0x359cc0[_0x3e76('0x2e')][_0x3e76('0x38')]);_0x27027d[_0x3e76('0x39')]=qs[_0x3e76('0x2f')](_[_0x3e76('0x3a')](_0x359cc0['query'],_0xb51eee[_0x3e76('0x2f')]));if(_0x359cc0['query'][_0x3e76('0x3b')]){_0x27027d['where']=_[_0x3e76('0x3c')](_0x27027d['where'],{'$or':_[_0x3e76('0x2a')](_0x3115e7,function(_0x11cb2b){if(_0x11cb2b[_0x3e76('0x3d')]!=='VIRTUAL'){var _0x509d3a={};_0x509d3a[_0x11cb2b[_0x3e76('0x27')]]={'$like':'%'+_0x359cc0[_0x3e76('0x2e')][_0x3e76('0x3b')]+'%'};return _0x509d3a;}})});}_0x27027d=_['merge']({},_0x27027d,_0x359cc0[_0x3e76('0x3e')]);var _0x4385ff={'where':_0x27027d[_0x3e76('0x39')]};return db[_0x3e76('0x2b')]['count'](_0x4385ff)[_0x3e76('0x3f')](function(_0xffac51){_0x4675d0[_0x3e76('0x40')]=_0xffac51;if(_0x359cc0['query']['includeAll']){_0x27027d['include']=[{'attributes':['id',_0x3e76('0x27'),_0x3e76('0x41'),_0x3e76('0x42')],'model':db['User'],'as':_0x3e76('0x43')}];}return db['VoiceCallReport'][_0x3e76('0x44')](_0x27027d);})[_0x3e76('0x3f')](function(_0x5ee7a8){_0x4675d0['rows']=_0x5ee7a8;return _0x4675d0;})[_0x3e76('0x3f')](respondWithFilteredResult(_0x49f386,_0x27027d))[_0x3e76('0x45')](handleError(_0x49f386,null));};exports['show']=function(_0x3ffd87,_0x465f02){var _0x14a0ac={'raw':!![],'where':{'id':_0x3ffd87['params']['id']}},_0x42a88f={};_0x42a88f['model']=_[_0x3e76('0x46')](db['VoiceCallReport']['rawAttributes']);_0x42a88f[_0x3e76('0x2e')]=_[_0x3e76('0x46')](_0x3ffd87['query']);_0x42a88f[_0x3e76('0x2f')]=_['intersection'](_0x42a88f['model'],_0x42a88f[_0x3e76('0x2e')]);_0x14a0ac['attributes']=_[_0x3e76('0x30')](_0x42a88f[_0x3e76('0x31')],qs['fields'](_0x3ffd87[_0x3e76('0x2e')][_0x3e76('0x33')]));_0x14a0ac['attributes']=_0x14a0ac['attributes'][_0x3e76('0x34')]?_0x14a0ac['attributes']:_0x42a88f[_0x3e76('0x31')];if(_0x3ffd87['query'][_0x3e76('0x47')]){_0x14a0ac[_0x3e76('0x48')]=[{'all':!![]}];}_0x14a0ac=_[_0x3e76('0x3c')]({},_0x14a0ac,_0x3ffd87[_0x3e76('0x3e')]);return db[_0x3e76('0x2b')][_0x3e76('0x49')](_0x14a0ac)[_0x3e76('0x3f')](handleEntityNotFound(_0x465f02,null))[_0x3e76('0x3f')](respondWithResult(_0x465f02,null))[_0x3e76('0x45')](handleError(_0x465f02,null));};exports[_0x3e76('0x4a')]=function(_0x5bf534,_0x54bd91){return db[_0x3e76('0x2b')][_0x3e76('0x4a')](_0x5bf534[_0x3e76('0x4b')],{})[_0x3e76('0x3f')](respondWithResult(_0x54bd91,0xc9))[_0x3e76('0x45')](handleError(_0x54bd91,null));};exports['destroy']=function(_0x28809f,_0x16f290){return db[_0x3e76('0x2b')][_0x3e76('0x49')]({'where':{'id':_0x28809f[_0x3e76('0x4c')]['id']}})[_0x3e76('0x3f')](handleEntityNotFound(_0x16f290,null))[_0x3e76('0x3f')](removeEntity(_0x16f290,null))[_0x3e76('0x45')](handleError(_0x16f290,null));};exports[_0x3e76('0x4d')]=function(_0x19deb9,_0x57fb3f){return db[_0x3e76('0x2b')][_0x3e76('0x4d')]()[_0x3e76('0x3f')](respondWithResult(_0x57fb3f,null))[_0x3e76('0x45')](handleError(_0x57fb3f,null));};exports['update']=function(_0x2a0599,_0x5ec067){if(_0x2a0599[_0x3e76('0x4b')][_0x3e76('0x4e')]){delete _0x2a0599['body'][_0x3e76('0x4e')];}return db[_0x3e76('0x2b')][_0x3e76('0x49')]({'where':{'uniqueid':_0x2a0599[_0x3e76('0x4c')]['id'],'UserId':{'$or':[null,_0x2a0599[_0x3e76('0x4f')]['id']]}}})[_0x3e76('0x3f')](handleEntityNotFound(_0x5ec067,null))[_0x3e76('0x3f')](saveUpdates(_0x2a0599[_0x3e76('0x4b')],null))[_0x3e76('0x3f')](respondWithResult(_0x5ec067,null))[_0x3e76('0x45')](handleError(_0x5ec067,null));}; \ No newline at end of file +var _0x3690=['eml-format','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','VoiceCallReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','alias','User','findAll','rows','catch','show','params','include','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x372047,_0x7f5c2b){var _0x44f282=function(_0x5a3d1c){while(--_0x5a3d1c){_0x372047['push'](_0x372047['shift']());}};_0x44f282(++_0x7f5c2b);}(_0x3690,0x95));var _0x0369=function(_0x1a3ce1,_0xd6f21a){_0x1a3ce1=_0x1a3ce1-0x0;var _0xd91e0b=_0x3690[_0x1a3ce1];return _0xd91e0b;};'use strict';var pdf=require(_0x0369('0x0'));var emlformat=require(_0x0369('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0369('0x2'));var jsonpatch=require(_0x0369('0x3'));var rp=require(_0x0369('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0369('0x5'));var path=require('path');var sox=require(_0x0369('0x6'));var csv=require(_0x0369('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0369('0x8'));var crypto=require(_0x0369('0x9'));var jsforce=require(_0x0369('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0369('0x7'));var querystring=require(_0x0369('0xb'));var Papa=require(_0x0369('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0369('0xd'));var hardwareService=require(_0x0369('0xe'));var logger=require(_0x0369('0xf'))(_0x0369('0x10'));var utils=require(_0x0369('0x11'));var config=require(_0x0369('0x12'));var db=require(_0x0369('0x13'))['db'];function respondWithStatusCode(_0xb462b1,_0x20a8a5){_0x20a8a5=_0x20a8a5||0xcc;return function(_0x1608ec){if(_0x1608ec){return _0xb462b1[_0x0369('0x14')](_0x20a8a5);}return _0xb462b1[_0x0369('0x15')](_0x20a8a5)[_0x0369('0x16')]();};}function respondWithResult(_0x51d963,_0x304922){_0x304922=_0x304922||0xc8;return function(_0x59fc88){if(_0x59fc88){return _0x51d963['status'](_0x304922)[_0x0369('0x17')](_0x59fc88);}};}function respondWithFilteredResult(_0xb09d8e,_0x2dc3c3){return function(_0x266927){if(_0x266927){var _0x17f119=_0x266927[_0x0369('0x18')],_0x53286a=_0x2dc3c3[_0x0369('0x19')],_0x2c8c95=_0x2dc3c3['offset']+_0x2dc3c3['limit'],_0x414878;if(_0x2c8c95>=_0x17f119){_0x2c8c95=_0x17f119;_0x414878=0xc8;}else{_0x414878=0xce;}_0xb09d8e['status'](_0x414878);return _0xb09d8e[_0x0369('0x1a')](_0x0369('0x1b'),_0x53286a+'-'+_0x2c8c95+'/'+_0x17f119)[_0x0369('0x17')](_0x266927);}return null;};}function patchUpdates(_0x2e2c7e){return function(_0x3a7aab){try{jsonpatch[_0x0369('0x1c')](_0x3a7aab,_0x2e2c7e,!![]);}catch(_0x2c02ce){return BPromise[_0x0369('0x1d')](_0x2c02ce);}return _0x3a7aab[_0x0369('0x1e')]();};}function saveUpdates(_0x112d5,_0x26e6e6){return function(_0x572f62){if(_0x572f62){return _0x572f62[_0x0369('0x1f')](_0x112d5)['then'](function(_0x26c198){return _0x26c198;});}return null;};}function removeEntity(_0x558fe0,_0x59c094){return function(_0x59c119){if(_0x59c119){return _0x59c119[_0x0369('0x20')]()[_0x0369('0x21')](function(){_0x558fe0['status'](0xcc)[_0x0369('0x16')]();});}};}function handleEntityNotFound(_0x323056,_0xd7c621){return function(_0x2219e8){if(!_0x2219e8){_0x323056[_0x0369('0x14')](0x194);}return _0x2219e8;};}function handleError(_0x2f03a6,_0x5798d2){_0x5798d2=_0x5798d2||0x1f4;return function(_0x50417a){logger[_0x0369('0x22')](_0x50417a[_0x0369('0x23')]);if(_0x50417a[_0x0369('0x24')]){delete _0x50417a[_0x0369('0x24')];}_0x2f03a6[_0x0369('0x15')](_0x5798d2)[_0x0369('0x25')](_0x50417a);};}exports['index']=function(_0x327f82,_0x34a07a){var _0x5b27b0={},_0x254b24={},_0x39c184={'count':0x0,'rows':[]};var _0x1413e5=_[_0x0369('0x26')](db[_0x0369('0x27')][_0x0369('0x28')],function(_0x3cf626){return{'name':_0x3cf626['fieldName'],'type':_0x3cf626[_0x0369('0x29')]['key']};});_0x254b24[_0x0369('0x2a')]=_[_0x0369('0x26')](_0x1413e5,_0x0369('0x24'));_0x254b24[_0x0369('0x2b')]=_[_0x0369('0x2c')](_0x327f82[_0x0369('0x2b')]);_0x254b24[_0x0369('0x2d')]=_[_0x0369('0x2e')](_0x254b24[_0x0369('0x2a')],_0x254b24[_0x0369('0x2b')]);_0x5b27b0[_0x0369('0x2f')]=_[_0x0369('0x2e')](_0x254b24['model'],qs[_0x0369('0x30')](_0x327f82[_0x0369('0x2b')][_0x0369('0x30')]));_0x5b27b0[_0x0369('0x2f')]=_0x5b27b0[_0x0369('0x2f')][_0x0369('0x31')]?_0x5b27b0[_0x0369('0x2f')]:_0x254b24['model'];if(!_0x327f82[_0x0369('0x2b')][_0x0369('0x32')](_0x0369('0x33'))){_0x5b27b0['limit']=qs[_0x0369('0x34')](_0x327f82[_0x0369('0x2b')]['limit']);_0x5b27b0[_0x0369('0x19')]=qs[_0x0369('0x19')](_0x327f82['query'][_0x0369('0x19')]);}_0x5b27b0[_0x0369('0x35')]=qs[_0x0369('0x36')](_0x327f82['query'][_0x0369('0x36')]);_0x5b27b0[_0x0369('0x37')]=qs[_0x0369('0x2d')](_[_0x0369('0x38')](_0x327f82[_0x0369('0x2b')],_0x254b24[_0x0369('0x2d')]));if(_0x327f82[_0x0369('0x2b')][_0x0369('0x39')]){_0x5b27b0[_0x0369('0x37')]=_[_0x0369('0x3a')](_0x5b27b0[_0x0369('0x37')],{'$or':_['map'](_0x1413e5,function(_0x208115){if(_0x208115[_0x0369('0x29')]!==_0x0369('0x3b')){var _0x44a83d={};_0x44a83d[_0x208115[_0x0369('0x24')]]={'$like':'%'+_0x327f82[_0x0369('0x2b')][_0x0369('0x39')]+'%'};return _0x44a83d;}})});}_0x5b27b0=_[_0x0369('0x3a')]({},_0x5b27b0,_0x327f82['options']);var _0x3b43f6={'where':_0x5b27b0[_0x0369('0x37')]};return db[_0x0369('0x27')][_0x0369('0x18')](_0x3b43f6)['then'](function(_0x3d5c42){_0x39c184[_0x0369('0x18')]=_0x3d5c42;if(_0x327f82[_0x0369('0x2b')][_0x0369('0x3c')]){_0x5b27b0['include']=[{'attributes':['id',_0x0369('0x24'),'fullname',_0x0369('0x3d')],'model':db[_0x0369('0x3e')],'as':_0x0369('0x3e')}];}return db['VoiceCallReport'][_0x0369('0x3f')](_0x5b27b0);})['then'](function(_0x2a9dfd){_0x39c184[_0x0369('0x40')]=_0x2a9dfd;return _0x39c184;})[_0x0369('0x21')](respondWithFilteredResult(_0x34a07a,_0x5b27b0))[_0x0369('0x41')](handleError(_0x34a07a,null));};exports[_0x0369('0x42')]=function(_0x353bec,_0x1f6528){var _0x1cd7c6={'raw':!![],'where':{'id':_0x353bec[_0x0369('0x43')]['id']}},_0x5b0a0e={};_0x5b0a0e[_0x0369('0x2a')]=_[_0x0369('0x2c')](db[_0x0369('0x27')][_0x0369('0x28')]);_0x5b0a0e['query']=_['keys'](_0x353bec[_0x0369('0x2b')]);_0x5b0a0e[_0x0369('0x2d')]=_[_0x0369('0x2e')](_0x5b0a0e['model'],_0x5b0a0e[_0x0369('0x2b')]);_0x1cd7c6[_0x0369('0x2f')]=_[_0x0369('0x2e')](_0x5b0a0e[_0x0369('0x2a')],qs[_0x0369('0x30')](_0x353bec[_0x0369('0x2b')]['fields']));_0x1cd7c6['attributes']=_0x1cd7c6['attributes'][_0x0369('0x31')]?_0x1cd7c6['attributes']:_0x5b0a0e[_0x0369('0x2a')];if(_0x353bec['query'][_0x0369('0x3c')]){_0x1cd7c6[_0x0369('0x44')]=[{'all':!![]}];}_0x1cd7c6=_[_0x0369('0x3a')]({},_0x1cd7c6,_0x353bec['options']);return db[_0x0369('0x27')][_0x0369('0x45')](_0x1cd7c6)[_0x0369('0x21')](handleEntityNotFound(_0x1f6528,null))[_0x0369('0x21')](respondWithResult(_0x1f6528,null))[_0x0369('0x41')](handleError(_0x1f6528,null));};exports[_0x0369('0x46')]=function(_0x227fbb,_0x2862f7){return db[_0x0369('0x27')][_0x0369('0x46')](_0x227fbb['body'],{})[_0x0369('0x21')](respondWithResult(_0x2862f7,0xc9))[_0x0369('0x41')](handleError(_0x2862f7,null));};exports[_0x0369('0x20')]=function(_0x97c5c5,_0x2cf718){return db[_0x0369('0x27')][_0x0369('0x45')]({'where':{'id':_0x97c5c5[_0x0369('0x43')]['id']}})[_0x0369('0x21')](handleEntityNotFound(_0x2cf718,null))[_0x0369('0x21')](removeEntity(_0x2cf718,null))['catch'](handleError(_0x2cf718,null));};exports[_0x0369('0x47')]=function(_0x217c76,_0x25fc60){return db[_0x0369('0x27')][_0x0369('0x47')]()[_0x0369('0x21')](respondWithResult(_0x25fc60,null))[_0x0369('0x41')](handleError(_0x25fc60,null));};exports[_0x0369('0x1f')]=function(_0x25bed3,_0x394f97){if(_0x25bed3[_0x0369('0x48')][_0x0369('0x49')]){delete _0x25bed3[_0x0369('0x48')][_0x0369('0x49')];}return db[_0x0369('0x27')][_0x0369('0x45')]({'where':{'uniqueid':_0x25bed3[_0x0369('0x43')]['id'],'UserId':{'$or':[null,_0x25bed3[_0x0369('0x4a')]['id']]}}})[_0x0369('0x21')](handleEntityNotFound(_0x394f97,null))['then'](saveUpdates(_0x25bed3['body'],null))[_0x0369('0x21')](respondWithResult(_0x394f97,null))['catch'](handleError(_0x394f97,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index aed44c3..bd0ec3e 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 _0xe68e=['path','rimraf','./voiceCallReport.attributes','exports','VoiceCallReport','report_call','../../config/logger','api','bluebird','request-promise'];(function(_0x1cd6fa,_0x5962a1){var _0x14e22c=function(_0x2d63d3){while(--_0x2d63d3){_0x1cd6fa['push'](_0x1cd6fa['shift']());}};_0x14e22c(++_0x5962a1);}(_0xe68e,0xf6));var _0xee68=function(_0x2338ae,_0x1896f8){_0x2338ae=_0x2338ae-0x0;var _0x4adad9=_0xe68e[_0x2338ae];return _0x4adad9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee68('0x0'))(_0xee68('0x1'));var moment=require('moment');var BPromise=require(_0xee68('0x2'));var rp=require(_0xee68('0x3'));var fs=require('fs');var path=require(_0xee68('0x4'));var rimraf=require(_0xee68('0x5'));var config=require('../../config/environment');var attributes=require(_0xee68('0x6'));module[_0xee68('0x7')]=function(_0x5335b2,_0xc0e965){return _0x5335b2['define'](_0xee68('0x8'),attributes,{'tableName':_0xee68('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa494=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xafa7e8,_0x501da3){var _0x314110=function(_0x277f85){while(--_0x277f85){_0xafa7e8['push'](_0xafa7e8['shift']());}};_0x314110(++_0x501da3);}(_0xa494,0xcb));var _0x4a49=function(_0x49456a,_0x3667a6){_0x49456a=_0x49456a-0x0;var _0x2e013d=_0xa494[_0x49456a];return _0x2e013d;};'use strict';var _=require(_0x4a49('0x0'));var util=require(_0x4a49('0x1'));var logger=require(_0x4a49('0x2'))(_0x4a49('0x3'));var moment=require(_0x4a49('0x4'));var BPromise=require(_0x4a49('0x5'));var rp=require(_0x4a49('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a49('0x7'));var config=require(_0x4a49('0x8'));var attributes=require(_0x4a49('0x9'));module[_0x4a49('0xa')]=function(_0x556549,_0x1bbab4){return _0x556549[_0x4a49('0xb')](_0x4a49('0xc'),attributes,{'tableName':_0x4a49('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 af7ccee..192458e 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 _0x6cf5=['update','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','CreateVoiceCallReport','body','UpdateVoiceCallReport'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x6cf5,0xb6));var _0x56cf=function(_0x104530,_0x1a94c3){_0x104530=_0x104530-0x0;var _0x32821f=_0x6cf5[_0x104530];return _0x32821f;};'use strict';var _=require(_0x56cf('0x0'));var util=require(_0x56cf('0x1'));var moment=require(_0x56cf('0x2'));var BPromise=require(_0x56cf('0x3'));var rs=require(_0x56cf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56cf('0x5'))['db'];var utils=require(_0x56cf('0x6'));var logger=require('../../config/logger')(_0x56cf('0x7'));var config=require(_0x56cf('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59d537,_0x4ea835,_0x395265){return new BPromise(function(_0x7a0c7b,_0x50a40d){return client[_0x56cf('0x9')](_0x59d537,_0x395265)[_0x56cf('0xa')](function(_0x2ea7be){logger[_0x56cf('0xb')](_0x56cf('0xc'),_0x4ea835,_0x56cf('0xd'));logger[_0x56cf('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x4ea835,_0x56cf('0xd'),JSON[_0x56cf('0xf')](_0x2ea7be));if(_0x2ea7be['error']){if(_0x2ea7be[_0x56cf('0x10')][_0x56cf('0x11')]===0x1f4){logger[_0x56cf('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x4ea835,_0x2ea7be['error']['message']);return _0x50a40d(_0x2ea7be['error'][_0x56cf('0x12')]);}logger[_0x56cf('0x10')](_0x56cf('0xc'),_0x4ea835,_0x2ea7be[_0x56cf('0x10')][_0x56cf('0x12')]);return _0x7a0c7b(_0x2ea7be[_0x56cf('0x10')][_0x56cf('0x12')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x4ea835,'request\x20sent');_0x7a0c7b(_0x2ea7be[_0x56cf('0x13')][_0x56cf('0x12')]);}})[_0x56cf('0x14')](function(_0x37df25){logger['error'](_0x56cf('0xc'),_0x4ea835,_0x37df25);_0x50a40d(_0x37df25);});});}exports[_0x56cf('0x15')]=function(_0x3578fd){var _0x191fb8=this;return new Promise(function(_0x35ded4,_0x3813c2){return db[_0x56cf('0x16')][_0x56cf('0x17')]({'raw':_0x3578fd[_0x56cf('0x18')]?_0x3578fd[_0x56cf('0x18')][_0x56cf('0x19')]===undefined?!![]:![]:!![],'where':_0x3578fd['options']?_0x3578fd[_0x56cf('0x18')]['where']||null:null,'attributes':_0x3578fd[_0x56cf('0x18')]?_0x3578fd[_0x56cf('0x18')][_0x56cf('0x1a')]||null:null,'limit':_0x3578fd[_0x56cf('0x18')]?_0x3578fd['options'][_0x56cf('0x1b')]||null:null,'include':_0x3578fd[_0x56cf('0x18')]?_0x3578fd[_0x56cf('0x18')][_0x56cf('0x1c')]?_[_0x56cf('0x1d')](_0x3578fd[_0x56cf('0x18')][_0x56cf('0x1c')],function(_0x2e0eab){return{'model':db[_0x2e0eab[_0x56cf('0x1e')]],'as':_0x2e0eab['as'],'attributes':_0x2e0eab[_0x56cf('0x1a')],'include':_0x2e0eab[_0x56cf('0x1c')]?_[_0x56cf('0x1d')](_0x2e0eab['include'],function(_0x40f31a){return{'model':db[_0x40f31a[_0x56cf('0x1e')]],'as':_0x40f31a['as'],'attributes':_0x40f31a[_0x56cf('0x1a')],'include':_0x40f31a[_0x56cf('0x1c')]?_[_0x56cf('0x1d')](_0x40f31a['include'],function(_0x3cf6c5){return{'model':db[_0x3cf6c5[_0x56cf('0x1e')]],'as':_0x3cf6c5['as'],'attributes':_0x3cf6c5[_0x56cf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x56cf('0xa')](function(_0x9c03e2){logger[_0x56cf('0xb')](_0x56cf('0x15'),_0x3578fd);logger[_0x56cf('0xe')](_0x56cf('0x15'),_0x3578fd,JSON[_0x56cf('0xf')](_0x9c03e2));_0x35ded4(_0x9c03e2);})[_0x56cf('0x14')](function(_0x59cace){logger['error']('GetVoiceCallReport',_0x59cace['message'],_0x3578fd);_0x3813c2(_0x191fb8[_0x56cf('0x10')](0x1f4,_0x59cace['message']));});});};exports[_0x56cf('0x1f')]=function(_0x1cb061){var _0x3cc3b4=this;return new Promise(function(_0x5e966e,_0x5a7b71){return db[_0x56cf('0x16')]['create'](_0x1cb061[_0x56cf('0x20')],{'raw':_0x1cb061[_0x56cf('0x18')]?_0x1cb061['options'][_0x56cf('0x19')]===undefined?!![]:![]:!![]})[_0x56cf('0xa')](function(_0x3ccf85){logger[_0x56cf('0xb')](_0x56cf('0x1f'),_0x1cb061);logger[_0x56cf('0xe')](_0x56cf('0x1f'),_0x1cb061,JSON[_0x56cf('0xf')](_0x3ccf85));_0x5e966e(_0x3ccf85);})['catch'](function(_0x242124){logger['error'](_0x56cf('0x1f'),_0x242124[_0x56cf('0x12')],_0x1cb061);_0x5a7b71(_0x3cc3b4[_0x56cf('0x10')](0x1f4,_0x242124[_0x56cf('0x12')]));});});};exports[_0x56cf('0x21')]=function(_0x5a1a8f){var _0x261dfc=this;return new Promise(function(_0x50a0f6,_0x3c5ada){return db[_0x56cf('0x16')][_0x56cf('0x22')](_0x5a1a8f[_0x56cf('0x20')],{'raw':_0x5a1a8f[_0x56cf('0x18')]?_0x5a1a8f[_0x56cf('0x18')][_0x56cf('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a1a8f[_0x56cf('0x18')]?_0x5a1a8f[_0x56cf('0x18')][_0x56cf('0x23')]||null:null,'attributes':_0x5a1a8f[_0x56cf('0x18')]?_0x5a1a8f[_0x56cf('0x18')][_0x56cf('0x1a')]||null:null,'limit':_0x5a1a8f[_0x56cf('0x18')]?_0x5a1a8f[_0x56cf('0x18')][_0x56cf('0x1b')]||null:null})[_0x56cf('0xa')](function(_0x21b410){logger[_0x56cf('0xb')](_0x56cf('0x21'),_0x5a1a8f);logger[_0x56cf('0xe')](_0x56cf('0x21'),_0x5a1a8f,JSON[_0x56cf('0xf')](_0x21b410));_0x50a0f6(_0x21b410);})[_0x56cf('0x14')](function(_0x6ac06c){logger[_0x56cf('0x10')](_0x56cf('0x21'),_0x6ac06c[_0x56cf('0x12')],_0x5a1a8f);_0x3c5ada(_0x261dfc[_0x56cf('0x10')](0x1f4,_0x6ac06c[_0x56cf('0x12')]));});});}; \ No newline at end of file +var _0xd124=['VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','info','VoiceCallReport,\x20%s,\x20%s','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','map','include','model','debug','create','body','CreateVoiceCallReport','stringify','UpdateVoiceCallReport','update','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','then','request\x20sent'];(function(_0x2845c8,_0x54fd83){var _0x4792c7=function(_0x1bbc6b){while(--_0x1bbc6b){_0x2845c8['push'](_0x2845c8['shift']());}};_0x4792c7(++_0x54fd83);}(_0xd124,0x155));var _0x4d12=function(_0x40462d,_0x11da4e){_0x40462d=_0x40462d-0x0;var _0x36e3e4=_0xd124[_0x40462d];return _0x36e3e4;};'use strict';var _=require('lodash');var util=require(_0x4d12('0x0'));var moment=require('moment');var BPromise=require(_0x4d12('0x1'));var rs=require(_0x4d12('0x2'));var fs=require('fs');var Redis=require(_0x4d12('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d12('0x4'));var logger=require(_0x4d12('0x5'))(_0x4d12('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f7645,_0x3dc680,_0x32d29c){return new BPromise(function(_0x10e528,_0x1b9732){return client['request'](_0x2f7645,_0x32d29c)[_0x4d12('0x7')](function(_0x17e386){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x3dc680,_0x4d12('0x8'));logger['debug'](_0x4d12('0x9'),_0x3dc680,_0x4d12('0x8'),JSON['stringify'](_0x17e386));if(_0x17e386[_0x4d12('0xa')]){if(_0x17e386[_0x4d12('0xa')][_0x4d12('0xb')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x3dc680,_0x17e386[_0x4d12('0xa')][_0x4d12('0xc')]);return _0x1b9732(_0x17e386[_0x4d12('0xa')][_0x4d12('0xc')]);}logger[_0x4d12('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x3dc680,_0x17e386[_0x4d12('0xa')][_0x4d12('0xc')]);return _0x10e528(_0x17e386[_0x4d12('0xa')][_0x4d12('0xc')]);}else{logger[_0x4d12('0xd')](_0x4d12('0xe'),_0x3dc680,_0x4d12('0x8'));_0x10e528(_0x17e386[_0x4d12('0xf')][_0x4d12('0xc')]);}})[_0x4d12('0x10')](function(_0x25ad2e){logger['error'](_0x4d12('0xe'),_0x3dc680,_0x25ad2e);_0x1b9732(_0x25ad2e);});});}exports[_0x4d12('0x11')]=function(_0x5e2c9d){var _0x121d1e=this;return new Promise(function(_0x3eb2da,_0x430606){return db[_0x4d12('0x12')][_0x4d12('0x13')]({'raw':_0x5e2c9d[_0x4d12('0x14')]?_0x5e2c9d['options'][_0x4d12('0x15')]===undefined?!![]:![]:!![],'where':_0x5e2c9d[_0x4d12('0x14')]?_0x5e2c9d[_0x4d12('0x14')][_0x4d12('0x16')]||null:null,'attributes':_0x5e2c9d['options']?_0x5e2c9d[_0x4d12('0x14')][_0x4d12('0x17')]||null:null,'limit':_0x5e2c9d[_0x4d12('0x14')]?_0x5e2c9d[_0x4d12('0x14')][_0x4d12('0x18')]||null:null,'include':_0x5e2c9d[_0x4d12('0x14')]?_0x5e2c9d[_0x4d12('0x14')]['include']?_[_0x4d12('0x19')](_0x5e2c9d[_0x4d12('0x14')][_0x4d12('0x1a')],function(_0x34b01f){return{'model':db[_0x34b01f[_0x4d12('0x1b')]],'as':_0x34b01f['as'],'attributes':_0x34b01f[_0x4d12('0x17')],'include':_0x34b01f['include']?_[_0x4d12('0x19')](_0x34b01f[_0x4d12('0x1a')],function(_0xeb778c){return{'model':db[_0xeb778c[_0x4d12('0x1b')]],'as':_0xeb778c['as'],'attributes':_0xeb778c[_0x4d12('0x17')],'include':_0xeb778c[_0x4d12('0x1a')]?_['map'](_0xeb778c[_0x4d12('0x1a')],function(_0x41094b){return{'model':db[_0x41094b[_0x4d12('0x1b')]],'as':_0x41094b['as'],'attributes':_0x41094b[_0x4d12('0x17')]};}):[]};}):[]};}):[]:[]})[_0x4d12('0x7')](function(_0x147a70){logger[_0x4d12('0xd')]('GetVoiceCallReport',_0x5e2c9d);logger[_0x4d12('0x1c')](_0x4d12('0x11'),_0x5e2c9d,JSON['stringify'](_0x147a70));_0x3eb2da(_0x147a70);})[_0x4d12('0x10')](function(_0x2e6f2f){logger[_0x4d12('0xa')](_0x4d12('0x11'),_0x2e6f2f[_0x4d12('0xc')],_0x5e2c9d);_0x430606(_0x121d1e[_0x4d12('0xa')](0x1f4,_0x2e6f2f[_0x4d12('0xc')]));});});};exports['CreateVoiceCallReport']=function(_0x571f05){var _0x307981=this;return new Promise(function(_0x197d89,_0x2c803d){return db[_0x4d12('0x12')][_0x4d12('0x1d')](_0x571f05[_0x4d12('0x1e')],{'raw':_0x571f05['options']?_0x571f05[_0x4d12('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x4d12('0x7')](function(_0x264c81){logger[_0x4d12('0xd')](_0x4d12('0x1f'),_0x571f05);logger[_0x4d12('0x1c')](_0x4d12('0x1f'),_0x571f05,JSON[_0x4d12('0x20')](_0x264c81));_0x197d89(_0x264c81);})['catch'](function(_0x259283){logger[_0x4d12('0xa')](_0x4d12('0x1f'),_0x259283[_0x4d12('0xc')],_0x571f05);_0x2c803d(_0x307981[_0x4d12('0xa')](0x1f4,_0x259283[_0x4d12('0xc')]));});});};exports[_0x4d12('0x21')]=function(_0x156e8b){var _0x4ef8fe=this;return new Promise(function(_0x413c78,_0x53fd50){return db['VoiceCallReport'][_0x4d12('0x22')](_0x156e8b['body'],{'raw':_0x156e8b['options']?_0x156e8b[_0x4d12('0x14')][_0x4d12('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x156e8b[_0x4d12('0x14')]?_0x156e8b['options'][_0x4d12('0x16')]||null:null,'attributes':_0x156e8b[_0x4d12('0x14')]?_0x156e8b['options'][_0x4d12('0x17')]||null:null,'limit':_0x156e8b[_0x4d12('0x14')]?_0x156e8b[_0x4d12('0x14')]['limit']||null:null})[_0x4d12('0x7')](function(_0x2e4bde){logger['info'](_0x4d12('0x21'),_0x156e8b);logger[_0x4d12('0x1c')](_0x4d12('0x21'),_0x156e8b,JSON[_0x4d12('0x20')](_0x2e4bde));_0x413c78(_0x2e4bde);})[_0x4d12('0x10')](function(_0x4a1fc5){logger['error']('UpdateVoiceCallReport',_0x4a1fc5[_0x4d12('0xc')],_0x156e8b);_0x53fd50(_0x4ef8fe[_0x4d12('0xa')](0x1f4,_0x4a1fc5['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 67470b0..7cabe3b 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 _0x853e=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','show','post','create','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x853e,0xea));var _0xe853=function(_0x19270e,_0x56de20){_0x19270e=_0x19270e-0x0;var _0x5666b6=_0x853e[_0x19270e];return _0x5666b6;};'use strict';var multer=require(_0xe853('0x0'));var util=require(_0xe853('0x1'));var path=require(_0xe853('0x2'));var timeout=require(_0xe853('0x3'));var express=require(_0xe853('0x4'));var router=express['Router']();var auth=require(_0xe853('0x5'));var interaction=require(_0xe853('0x6'));var config=require(_0xe853('0x7'));var controller=require(_0xe853('0x8'));router[_0xe853('0x9')]('/',auth[_0xe853('0xa')](),controller['index']);router['get']('/:id',auth[_0xe853('0xa')](),controller[_0xe853('0xb')]);router[_0xe853('0xc')]('/',auth[_0xe853('0xa')](),controller[_0xe853('0xd')]);router['put'](_0xe853('0xe'),auth[_0xe853('0xa')](),controller['update']);router['delete'](_0xe853('0xe'),auth[_0xe853('0xa')](),controller[_0xe853('0xf')]);module[_0xe853('0x10')]=router; \ No newline at end of file +var _0x9c0a=['index','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4bdb2e,_0x53ae98){var _0x372646=function(_0x23b355){while(--_0x23b355){_0x4bdb2e['push'](_0x4bdb2e['shift']());}};_0x372646(++_0x53ae98);}(_0x9c0a,0x117));var _0xa9c0=function(_0x418ad2,_0x2eb809){_0x418ad2=_0x418ad2-0x0;var _0x53e614=_0x9c0a[_0x418ad2];return _0x53e614;};'use strict';var multer=require('multer');var util=require(_0xa9c0('0x0'));var path=require(_0xa9c0('0x1'));var timeout=require(_0xa9c0('0x2'));var express=require('express');var router=express[_0xa9c0('0x3')]();var auth=require(_0xa9c0('0x4'));var interaction=require(_0xa9c0('0x5'));var config=require(_0xa9c0('0x6'));var controller=require('./voiceChanSpy.controller');router[_0xa9c0('0x7')]('/',auth[_0xa9c0('0x8')](),controller[_0xa9c0('0x9')]);router['get'](_0xa9c0('0xa'),auth[_0xa9c0('0x8')](),controller[_0xa9c0('0xb')]);router['post']('/',auth[_0xa9c0('0x8')](),controller[_0xa9c0('0xc')]);router[_0xa9c0('0xd')]('/:id',auth[_0xa9c0('0x8')](),controller[_0xa9c0('0xe')]);router[_0xa9c0('0xf')](_0xa9c0('0xa'),auth[_0xa9c0('0x8')](),controller[_0xa9c0('0x10')]);module[_0xa9c0('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 3c644e1..f73c0b2 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 _0x692e=['STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x39170a,_0x5882a6){var _0x3ade24=function(_0x27080b){while(--_0x27080b){_0x39170a['push'](_0x39170a['shift']());}};_0x3ade24(++_0x5882a6);}(_0x692e,0x1c0));var _0xe692=function(_0x466da7,_0x5ea5f8){_0x466da7=_0x466da7-0x0;var _0x3ab029=_0x692e[_0x466da7];return _0x3ab029;};'use strict';var Sequelize=require(_0xe692('0x0'));module[_0xe692('0x1')]={'name':{'type':Sequelize[_0xe692('0x2')]},'prefix':{'type':Sequelize[_0xe692('0x2')],'unique':_0xe692('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xe692('0x2')],'set':function(_0x2f4d39){this[_0xe692('0x4')](_0xe692('0x5'),_0x2f4d39?_0x2f4d39[_0xe692('0x6')](''):[]);},'get':function(){return this[_0xe692('0x7')]('options')?this['getDataValue']('options')[_0xe692('0x8')](''):[];}},'auth':{'type':Sequelize[_0xe692('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0xe692('0x2')]},'record':{'type':Sequelize[_0xe692('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe692('0x2')]},'description':{'type':Sequelize[_0xe692('0x2')]}}; \ No newline at end of file +var _0x8e9f=['exports','STRING','name','setDataValue','options','join','getDataValue','BOOLEAN','sequelize'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8e9f,0x1dc));var _0xf8e9=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x8e9f[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0xf8e9('0x0'));module[_0xf8e9('0x1')]={'name':{'type':Sequelize[_0xf8e9('0x2')]},'prefix':{'type':Sequelize[_0xf8e9('0x2')],'unique':_0xf8e9('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x50780a){this[_0xf8e9('0x4')](_0xf8e9('0x5'),_0x50780a?_0x50780a[_0xf8e9('0x6')](''):[]);},'get':function(){return this[_0xf8e9('0x7')](_0xf8e9('0x5'))?this[_0xf8e9('0x7')](_0xf8e9('0x5'))['split'](''):[];}},'auth':{'type':Sequelize[_0xf8e9('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xf8e9('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 45d24b6..c2ff49c 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 _0x1884=['eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','map','VoiceChanSpy','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','rawAttributes','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1884,0x15b));var _0x4188=function(_0x1ec589,_0x3fa2d1){_0x1ec589=_0x1ec589-0x0;var _0x2b4601=_0x1884[_0x1ec589];return _0x2b4601;};'use strict';var pdf=require(_0x4188('0x0'));var emlformat=require(_0x4188('0x1'));var rimraf=require(_0x4188('0x2'));var zipdir=require(_0x4188('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4188('0x4'));var moment=require('moment');var BPromise=require(_0x4188('0x5'));var Mustache=require(_0x4188('0x6'));var util=require(_0x4188('0x7'));var path=require(_0x4188('0x8'));var sox=require(_0x4188('0x9'));var csv=require(_0x4188('0xa'));var ejs=require(_0x4188('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4188('0xc'));var crypto=require(_0x4188('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4188('0xe'));var toCsv=require(_0x4188('0xa'));var querystring=require(_0x4188('0xf'));var Papa=require(_0x4188('0x10'));var Redis=require('ioredis');var authService=require(_0x4188('0x11'));var qs=require(_0x4188('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4188('0x13'));var logger=require('../../config/logger')(_0x4188('0x14'));var utils=require(_0x4188('0x15'));var config=require(_0x4188('0x16'));var db=require(_0x4188('0x17'))['db'];function respondWithStatusCode(_0x24d98f,_0x462f38){_0x462f38=_0x462f38||0xcc;return function(_0x272b5f){if(_0x272b5f){return _0x24d98f[_0x4188('0x18')](_0x462f38);}return _0x24d98f[_0x4188('0x19')](_0x462f38)[_0x4188('0x1a')]();};}function respondWithResult(_0x19de03,_0x282c33){_0x282c33=_0x282c33||0xc8;return function(_0x6d5bb9){if(_0x6d5bb9){return _0x19de03[_0x4188('0x19')](_0x282c33)['json'](_0x6d5bb9);}};}function respondWithFilteredResult(_0x2596f6,_0x40eae5){return function(_0x11885c){if(_0x11885c){var _0x2b26f6=_0x11885c[_0x4188('0x1b')],_0x4fcd54=_0x40eae5['offset'],_0x3826ce=_0x40eae5[_0x4188('0x1c')]+_0x40eae5[_0x4188('0x1d')],_0x2fbaa3;if(_0x3826ce>=_0x2b26f6){_0x3826ce=_0x2b26f6;_0x2fbaa3=0xc8;}else{_0x2fbaa3=0xce;}_0x2596f6[_0x4188('0x19')](_0x2fbaa3);return _0x2596f6[_0x4188('0x1e')](_0x4188('0x1f'),_0x4fcd54+'-'+_0x3826ce+'/'+_0x2b26f6)[_0x4188('0x20')](_0x11885c);}return null;};}function patchUpdates(_0x298887){return function(_0x2d33b3){try{jsonpatch[_0x4188('0x21')](_0x2d33b3,_0x298887,!![]);}catch(_0x30e433){return BPromise[_0x4188('0x22')](_0x30e433);}return _0x2d33b3[_0x4188('0x23')]();};}function saveUpdates(_0x145e8c,_0xea522c){return function(_0x27c089){if(_0x27c089){return _0x27c089[_0x4188('0x24')](_0x145e8c)[_0x4188('0x25')](function(_0x53eebf){return _0x53eebf;});}return null;};}function removeEntity(_0x2e299f,_0x31f14f){return function(_0x598fcf){if(_0x598fcf){return _0x598fcf[_0x4188('0x26')]()['then'](function(){var _0x291052=_0x598fcf[_0x4188('0x27')]({'plain':!![]});var _0x2b31b2=_0x4188('0x28');return db[_0x4188('0x29')][_0x4188('0x26')]({'where':{'type':_0x2b31b2,'resourceId':_0x291052['id']}})[_0x4188('0x25')](function(){return _0x598fcf;});})[_0x4188('0x25')](function(){_0x2e299f[_0x4188('0x19')](0xcc)[_0x4188('0x1a')]();});}};}function handleEntityNotFound(_0x3ab570,_0x307c82){return function(_0x5199c5){if(!_0x5199c5){_0x3ab570[_0x4188('0x18')](0x194);}return _0x5199c5;};}function handleError(_0xeca6e6,_0x4fcb59){_0x4fcb59=_0x4fcb59||0x1f4;return function(_0x5a5615){logger[_0x4188('0x2a')](_0x5a5615[_0x4188('0x2b')]);if(_0x5a5615[_0x4188('0x2c')]){delete _0x5a5615['name'];}_0xeca6e6[_0x4188('0x19')](_0x4fcb59)[_0x4188('0x2d')](_0x5a5615);};}exports['index']=function(_0x361720,_0x49acbf){var _0x32c901={},_0x2e90c4={},_0x1ceb4c={'count':0x0,'rows':[]};var _0x14e2bf=_[_0x4188('0x2e')](db[_0x4188('0x2f')]['rawAttributes'],function(_0x352cd5){return{'name':_0x352cd5[_0x4188('0x30')],'type':_0x352cd5[_0x4188('0x31')][_0x4188('0x32')]};});_0x2e90c4[_0x4188('0x33')]=_[_0x4188('0x2e')](_0x14e2bf,_0x4188('0x2c'));_0x2e90c4[_0x4188('0x34')]=_[_0x4188('0x35')](_0x361720['query']);_0x2e90c4[_0x4188('0x36')]=_[_0x4188('0x37')](_0x2e90c4['model'],_0x2e90c4[_0x4188('0x34')]);_0x32c901['attributes']=_[_0x4188('0x37')](_0x2e90c4['model'],qs[_0x4188('0x38')](_0x361720[_0x4188('0x34')]['fields']));_0x32c901[_0x4188('0x39')]=_0x32c901[_0x4188('0x39')][_0x4188('0x3a')]?_0x32c901[_0x4188('0x39')]:_0x2e90c4[_0x4188('0x33')];if(!_0x361720['query'][_0x4188('0x3b')](_0x4188('0x3c'))){_0x32c901['limit']=qs['limit'](_0x361720[_0x4188('0x34')][_0x4188('0x1d')]);_0x32c901[_0x4188('0x1c')]=qs[_0x4188('0x1c')](_0x361720[_0x4188('0x34')][_0x4188('0x1c')]);}_0x32c901[_0x4188('0x3d')]=qs[_0x4188('0x3e')](_0x361720[_0x4188('0x34')]['sort']);_0x32c901[_0x4188('0x3f')]=qs[_0x4188('0x36')](_[_0x4188('0x40')](_0x361720[_0x4188('0x34')],_0x2e90c4[_0x4188('0x36')]));if(_0x361720['query']['filter']){_0x32c901['where']=_['merge'](_0x32c901['where'],{'$or':_['map'](_0x14e2bf,function(_0x56a1f5){if(_0x56a1f5[_0x4188('0x31')]!==_0x4188('0x41')){var _0x4beb06={};_0x4beb06[_0x56a1f5[_0x4188('0x2c')]]={'$like':'%'+_0x361720[_0x4188('0x34')][_0x4188('0x42')]+'%'};return _0x4beb06;}})});}_0x32c901=_['merge']({},_0x32c901,_0x361720[_0x4188('0x43')]);var _0x1838c2={'where':_0x32c901[_0x4188('0x3f')]};return db[_0x4188('0x2f')][_0x4188('0x1b')](_0x1838c2)['then'](function(_0x24d257){_0x1ceb4c[_0x4188('0x1b')]=_0x24d257;if(_0x361720[_0x4188('0x34')][_0x4188('0x44')]){_0x32c901['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x4188('0x45')](_0x32c901);})[_0x4188('0x25')](function(_0x11f3b8){_0x1ceb4c[_0x4188('0x46')]=_0x11f3b8;return _0x1ceb4c;})['then'](respondWithFilteredResult(_0x49acbf,_0x32c901))[_0x4188('0x47')](handleError(_0x49acbf,null));};exports[_0x4188('0x48')]=function(_0x139eef,_0x59c75e){var _0x469423={'raw':![],'where':{'id':_0x139eef['params']['id']}},_0x585704={};_0x585704[_0x4188('0x33')]=_[_0x4188('0x35')](db[_0x4188('0x2f')][_0x4188('0x49')]);_0x585704[_0x4188('0x34')]=_['keys'](_0x139eef[_0x4188('0x34')]);_0x585704[_0x4188('0x36')]=_[_0x4188('0x37')](_0x585704[_0x4188('0x33')],_0x585704[_0x4188('0x34')]);_0x469423[_0x4188('0x39')]=_['intersection'](_0x585704[_0x4188('0x33')],qs[_0x4188('0x38')](_0x139eef['query'][_0x4188('0x38')]));_0x469423[_0x4188('0x39')]=_0x469423[_0x4188('0x39')][_0x4188('0x3a')]?_0x469423[_0x4188('0x39')]:_0x585704[_0x4188('0x33')];if(_0x139eef[_0x4188('0x34')][_0x4188('0x44')]){_0x469423[_0x4188('0x4a')]=[{'all':!![]}];}_0x469423=_[_0x4188('0x4b')]({},_0x469423,_0x139eef['options']);return db[_0x4188('0x2f')][_0x4188('0x4c')](_0x469423)[_0x4188('0x25')](handleEntityNotFound(_0x59c75e,null))[_0x4188('0x25')](respondWithResult(_0x59c75e,null))['catch'](handleError(_0x59c75e,null));};exports['create']=function(_0x5f6910,_0x42d7b0){return db[_0x4188('0x2f')][_0x4188('0x4d')](_0x5f6910[_0x4188('0x4e')],{})[_0x4188('0x25')](function(_0x12d3e0){var _0x23e768=_0x5f6910[_0x4188('0x4f')][_0x4188('0x27')]({'plain':!![]});if(!_0x23e768)throw new Error(_0x4188('0x50'));if(_0x23e768[_0x4188('0x51')]===_0x4188('0x4f')){var _0x56a8ad=_0x12d3e0['get']({'plain':!![]});var _0x398212=_0x4188('0x28');return db[_0x4188('0x52')][_0x4188('0x4c')]({'where':{'name':_0x398212,'userProfileId':_0x23e768[_0x4188('0x53')]},'raw':!![]})[_0x4188('0x25')](function(_0x4719c8){if(_0x4719c8&&_0x4719c8[_0x4188('0x54')]===0x0){return db['UserProfileResource'][_0x4188('0x4d')]({'name':_0x56a8ad[_0x4188('0x2c')],'resourceId':_0x56a8ad['id'],'type':_0x4719c8['name'],'sectionId':_0x4719c8['id']},{})[_0x4188('0x25')](function(){return _0x12d3e0;});}else{return _0x12d3e0;}})[_0x4188('0x47')](function(_0x54280f){logger[_0x4188('0x2a')](_0x4188('0x55'),_0x54280f);throw _0x54280f;});}return _0x12d3e0;})[_0x4188('0x25')](respondWithResult(_0x42d7b0,0xc9))[_0x4188('0x47')](handleError(_0x42d7b0,null));};exports['update']=function(_0x229c3d,_0x16ee04){if(_0x229c3d[_0x4188('0x4e')]['id']){delete _0x229c3d[_0x4188('0x4e')]['id'];}return db[_0x4188('0x2f')][_0x4188('0x4c')]({'where':{'id':_0x229c3d[_0x4188('0x56')]['id']}})['then'](handleEntityNotFound(_0x16ee04,null))[_0x4188('0x25')](saveUpdates(_0x229c3d['body'],null))['then'](respondWithResult(_0x16ee04,null))[_0x4188('0x47')](handleError(_0x16ee04,null));};exports[_0x4188('0x26')]=function(_0x5bd2f1,_0x522ab2){return db[_0x4188('0x2f')]['find']({'where':{'id':_0x5bd2f1[_0x4188('0x56')]['id']}})[_0x4188('0x25')](handleEntityNotFound(_0x522ab2,null))[_0x4188('0x25')](removeEntity(_0x522ab2,null))['catch'](handleError(_0x522ab2,null));}; \ No newline at end of file +var _0x5f32=['name','send','index','map','VoiceChanSpy','rawAttributes','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','merge','VIRTUAL','options','include','findAll','rows','catch','keys','includeAll','find','create','body','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','moment','bluebird','mustache','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','sendStatus','status','end','json','count','offset','limit','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack'];(function(_0x68bee4,_0x22a4c0){var _0x33b12f=function(_0x18eb14){while(--_0x18eb14){_0x68bee4['push'](_0x68bee4['shift']());}};_0x33b12f(++_0x22a4c0);}(_0x5f32,0x6f));var _0x25f3=function(_0x17136b,_0x6e4a61){_0x17136b=_0x17136b-0x0;var _0x13842a=_0x5f32[_0x17136b];return _0x13842a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x25f3('0x0'));var rimraf=require(_0x25f3('0x1'));var zipdir=require(_0x25f3('0x2'));var jsonpatch=require(_0x25f3('0x3'));var rp=require(_0x25f3('0x4'));var moment=require(_0x25f3('0x5'));var BPromise=require(_0x25f3('0x6'));var Mustache=require(_0x25f3('0x7'));var util=require('util');var path=require(_0x25f3('0x8'));var sox=require(_0x25f3('0x9'));var csv=require('to-csv');var ejs=require(_0x25f3('0xa'));var fs=require('fs');var _=require(_0x25f3('0xb'));var squel=require(_0x25f3('0xc'));var crypto=require(_0x25f3('0xd'));var jsforce=require(_0x25f3('0xe'));var deskjs=require(_0x25f3('0xf'));var toCsv=require(_0x25f3('0x10'));var querystring=require(_0x25f3('0x11'));var Papa=require(_0x25f3('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x25f3('0x13'));var as=require(_0x25f3('0x14'));var hardwareService=require(_0x25f3('0x15'));var logger=require(_0x25f3('0x16'))(_0x25f3('0x17'));var utils=require(_0x25f3('0x18'));var config=require(_0x25f3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x355366,_0x2883ba){_0x2883ba=_0x2883ba||0xcc;return function(_0x1c493c){if(_0x1c493c){return _0x355366[_0x25f3('0x1a')](_0x2883ba);}return _0x355366[_0x25f3('0x1b')](_0x2883ba)[_0x25f3('0x1c')]();};}function respondWithResult(_0x34802f,_0x309448){_0x309448=_0x309448||0xc8;return function(_0x1520af){if(_0x1520af){return _0x34802f[_0x25f3('0x1b')](_0x309448)[_0x25f3('0x1d')](_0x1520af);}};}function respondWithFilteredResult(_0x4a17b3,_0x253231){return function(_0x42fd69){if(_0x42fd69){var _0x19dd97=_0x42fd69[_0x25f3('0x1e')],_0x262379=_0x253231['offset'],_0xded406=_0x253231[_0x25f3('0x1f')]+_0x253231[_0x25f3('0x20')],_0x2f5c59;if(_0xded406>=_0x19dd97){_0xded406=_0x19dd97;_0x2f5c59=0xc8;}else{_0x2f5c59=0xce;}_0x4a17b3[_0x25f3('0x1b')](_0x2f5c59);return _0x4a17b3['set']('Content-Range',_0x262379+'-'+_0xded406+'/'+_0x19dd97)[_0x25f3('0x1d')](_0x42fd69);}return null;};}function patchUpdates(_0xc0e6a8){return function(_0x274761){try{jsonpatch['apply'](_0x274761,_0xc0e6a8,!![]);}catch(_0x3e5aca){return BPromise[_0x25f3('0x21')](_0x3e5aca);}return _0x274761[_0x25f3('0x22')]();};}function saveUpdates(_0x49a08e,_0xb25bec){return function(_0x227a83){if(_0x227a83){return _0x227a83[_0x25f3('0x23')](_0x49a08e)[_0x25f3('0x24')](function(_0x36bedc){return _0x36bedc;});}return null;};}function removeEntity(_0x4f9d24,_0x1d4a9f){return function(_0x26a5ae){if(_0x26a5ae){return _0x26a5ae[_0x25f3('0x25')]()['then'](function(){var _0x320789=_0x26a5ae[_0x25f3('0x26')]({'plain':!![]});var _0x3c43db=_0x25f3('0x27');return db[_0x25f3('0x28')][_0x25f3('0x25')]({'where':{'type':_0x3c43db,'resourceId':_0x320789['id']}})[_0x25f3('0x24')](function(){return _0x26a5ae;});})[_0x25f3('0x24')](function(){_0x4f9d24[_0x25f3('0x1b')](0xcc)[_0x25f3('0x1c')]();});}};}function handleEntityNotFound(_0x3e9f4e,_0x5a6cb3){return function(_0x20bcc6){if(!_0x20bcc6){_0x3e9f4e['sendStatus'](0x194);}return _0x20bcc6;};}function handleError(_0x71adde,_0x21b199){_0x21b199=_0x21b199||0x1f4;return function(_0x1f6083){logger[_0x25f3('0x29')](_0x1f6083[_0x25f3('0x2a')]);if(_0x1f6083['name']){delete _0x1f6083[_0x25f3('0x2b')];}_0x71adde['status'](_0x21b199)[_0x25f3('0x2c')](_0x1f6083);};}exports[_0x25f3('0x2d')]=function(_0x1041aa,_0x5201f2){var _0xb387d2={},_0x39fb3e={},_0x314bd7={'count':0x0,'rows':[]};var _0x2dab2b=_[_0x25f3('0x2e')](db[_0x25f3('0x2f')][_0x25f3('0x30')],function(_0x220b59){return{'name':_0x220b59['fieldName'],'type':_0x220b59['type'][_0x25f3('0x31')]};});_0x39fb3e['model']=_[_0x25f3('0x2e')](_0x2dab2b,_0x25f3('0x2b'));_0x39fb3e['query']=_['keys'](_0x1041aa[_0x25f3('0x32')]);_0x39fb3e[_0x25f3('0x33')]=_[_0x25f3('0x34')](_0x39fb3e['model'],_0x39fb3e[_0x25f3('0x32')]);_0xb387d2['attributes']=_['intersection'](_0x39fb3e[_0x25f3('0x35')],qs[_0x25f3('0x36')](_0x1041aa[_0x25f3('0x32')][_0x25f3('0x36')]));_0xb387d2[_0x25f3('0x37')]=_0xb387d2['attributes'][_0x25f3('0x38')]?_0xb387d2[_0x25f3('0x37')]:_0x39fb3e[_0x25f3('0x35')];if(!_0x1041aa['query'][_0x25f3('0x39')]('nolimit')){_0xb387d2[_0x25f3('0x20')]=qs[_0x25f3('0x20')](_0x1041aa[_0x25f3('0x32')][_0x25f3('0x20')]);_0xb387d2['offset']=qs[_0x25f3('0x1f')](_0x1041aa[_0x25f3('0x32')][_0x25f3('0x1f')]);}_0xb387d2[_0x25f3('0x3a')]=qs['sort'](_0x1041aa['query']['sort']);_0xb387d2[_0x25f3('0x3b')]=qs[_0x25f3('0x33')](_['pick'](_0x1041aa['query'],_0x39fb3e[_0x25f3('0x33')]));if(_0x1041aa[_0x25f3('0x32')]['filter']){_0xb387d2[_0x25f3('0x3b')]=_[_0x25f3('0x3c')](_0xb387d2['where'],{'$or':_[_0x25f3('0x2e')](_0x2dab2b,function(_0x48fd8e){if(_0x48fd8e['type']!==_0x25f3('0x3d')){var _0x4426fc={};_0x4426fc[_0x48fd8e['name']]={'$like':'%'+_0x1041aa['query']['filter']+'%'};return _0x4426fc;}})});}_0xb387d2=_[_0x25f3('0x3c')]({},_0xb387d2,_0x1041aa[_0x25f3('0x3e')]);var _0x545a66={'where':_0xb387d2[_0x25f3('0x3b')]};return db[_0x25f3('0x2f')][_0x25f3('0x1e')](_0x545a66)[_0x25f3('0x24')](function(_0x4a064a){_0x314bd7[_0x25f3('0x1e')]=_0x4a064a;if(_0x1041aa[_0x25f3('0x32')]['includeAll']){_0xb387d2[_0x25f3('0x3f')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x25f3('0x40')](_0xb387d2);})['then'](function(_0x3b6b4b){_0x314bd7[_0x25f3('0x41')]=_0x3b6b4b;return _0x314bd7;})[_0x25f3('0x24')](respondWithFilteredResult(_0x5201f2,_0xb387d2))[_0x25f3('0x42')](handleError(_0x5201f2,null));};exports['show']=function(_0x132ab4,_0x18131b){var _0x359401={'raw':![],'where':{'id':_0x132ab4['params']['id']}},_0x7a978f={};_0x7a978f['model']=_['keys'](db[_0x25f3('0x2f')][_0x25f3('0x30')]);_0x7a978f['query']=_[_0x25f3('0x43')](_0x132ab4[_0x25f3('0x32')]);_0x7a978f[_0x25f3('0x33')]=_[_0x25f3('0x34')](_0x7a978f[_0x25f3('0x35')],_0x7a978f[_0x25f3('0x32')]);_0x359401[_0x25f3('0x37')]=_[_0x25f3('0x34')](_0x7a978f[_0x25f3('0x35')],qs['fields'](_0x132ab4[_0x25f3('0x32')][_0x25f3('0x36')]));_0x359401[_0x25f3('0x37')]=_0x359401[_0x25f3('0x37')][_0x25f3('0x38')]?_0x359401[_0x25f3('0x37')]:_0x7a978f[_0x25f3('0x35')];if(_0x132ab4[_0x25f3('0x32')][_0x25f3('0x44')]){_0x359401['include']=[{'all':!![]}];}_0x359401=_[_0x25f3('0x3c')]({},_0x359401,_0x132ab4[_0x25f3('0x3e')]);return db[_0x25f3('0x2f')][_0x25f3('0x45')](_0x359401)[_0x25f3('0x24')](handleEntityNotFound(_0x18131b,null))[_0x25f3('0x24')](respondWithResult(_0x18131b,null))[_0x25f3('0x42')](handleError(_0x18131b,null));};exports[_0x25f3('0x46')]=function(_0x30c6c8,_0x11a924){return db[_0x25f3('0x2f')]['create'](_0x30c6c8[_0x25f3('0x47')],{})['then'](function(_0x5521ea){var _0x2ef06d=_0x30c6c8[_0x25f3('0x48')][_0x25f3('0x26')]({'plain':!![]});if(!_0x2ef06d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ef06d['role']==='user'){var _0x54034b=_0x5521ea['get']({'plain':!![]});var _0x245f04='ChanSpies';return db[_0x25f3('0x49')][_0x25f3('0x45')]({'where':{'name':_0x245f04,'userProfileId':_0x2ef06d['userProfileId']},'raw':!![]})['then'](function(_0x1b1121){if(_0x1b1121&&_0x1b1121[_0x25f3('0x4a')]===0x0){return db[_0x25f3('0x28')][_0x25f3('0x46')]({'name':_0x54034b[_0x25f3('0x2b')],'resourceId':_0x54034b['id'],'type':_0x1b1121[_0x25f3('0x2b')],'sectionId':_0x1b1121['id']},{})[_0x25f3('0x24')](function(){return _0x5521ea;});}else{return _0x5521ea;}})['catch'](function(_0x5b718e){logger[_0x25f3('0x29')](_0x25f3('0x4b'),_0x5b718e);throw _0x5b718e;});}return _0x5521ea;})[_0x25f3('0x24')](respondWithResult(_0x11a924,0xc9))['catch'](handleError(_0x11a924,null));};exports['update']=function(_0x17a600,_0x3d6712){if(_0x17a600[_0x25f3('0x47')]['id']){delete _0x17a600[_0x25f3('0x47')]['id'];}return db[_0x25f3('0x2f')]['find']({'where':{'id':_0x17a600[_0x25f3('0x4c')]['id']}})[_0x25f3('0x24')](handleEntityNotFound(_0x3d6712,null))[_0x25f3('0x24')](saveUpdates(_0x17a600['body'],null))['then'](respondWithResult(_0x3d6712,null))[_0x25f3('0x42')](handleError(_0x3d6712,null));};exports[_0x25f3('0x25')]=function(_0x592c02,_0x351074){return db[_0x25f3('0x2f')]['find']({'where':{'id':_0x592c02[_0x25f3('0x4c')]['id']}})[_0x25f3('0x24')](handleEntityNotFound(_0x351074,null))[_0x25f3('0x24')](removeEntity(_0x351074,null))[_0x25f3('0x42')](handleError(_0x351074,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 74c4d19..df67244 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 _0x5dfc=['merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','findAll','then','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','prefix','system'];(function(_0x3629d9,_0x1b27a4){var _0x4503f4=function(_0x4fda73){while(--_0x4fda73){_0x3629d9['push'](_0x3629d9['shift']());}};_0x4503f4(++_0x1b27a4);}(_0x5dfc,0xb6));var _0xc5df=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0x5dfc[_0x5caf7e];return _0x5c3435;};'use strict';var _=require(_0xc5df('0x0'));var util=require(_0xc5df('0x1'));var BPromise=require('bluebird');var attributes=require(_0xc5df('0x2'));var getUserApplications=function(_0x12d7c2,_0x4998d7,_0x274739){var _0x244ce6=0x1;var _0x472bf6=[];var _0x1bee4b={'context':_0x4998d7[_0xc5df('0x3')]||_0xc5df('0x4'),'exten':util[_0xc5df('0x5')]('%s%s',_0x12d7c2[_0xc5df('0x6')],_0x274739),'type':_0xc5df('0x7'),'isApp':![],'ChanSpyId':_0x12d7c2['id'],'UserId':_0x4998d7['id']};_0x472bf6['push'](_[_0xc5df('0x8')]({'app':_0xc5df('0x9'),'appdata':util['format'](_0xc5df('0xa'),_0xc5df('0xb')),'priority':_0x244ce6++},_0x1bee4b));if(_0x12d7c2[_0xc5df('0xc')]){_0x472bf6[_0xc5df('0xd')](_[_0xc5df('0x8')]({'app':_0xc5df('0xe'),'appdata':util[_0xc5df('0x5')](_0xc5df('0xf'),_0x12d7c2[_0xc5df('0x10')]),'priority':_0x244ce6++},_0x1bee4b));}if(_0x12d7c2['auth']){_0x472bf6['push'](_[_0xc5df('0x8')]({'app':_0xc5df('0x11'),'appdata':_0x12d7c2['password'],'priority':_0x244ce6++},_0x1bee4b));}_0x472bf6[_0xc5df('0xd')](_['merge']({'app':_0xc5df('0x12'),'appdata':util[_0xc5df('0x5')](_0xc5df('0x13'),_0x4998d7[_0xc5df('0x14')],_0x12d7c2[_0xc5df('0x15')]?_0x12d7c2[_0xc5df('0x15')][_0xc5df('0x16')](''):''),'priority':_0x244ce6++},_0x1bee4b));if(_0x12d7c2[_0xc5df('0xc')]){_0x472bf6[_0xc5df('0xd')](_[_0xc5df('0x8')]({'app':_0xc5df('0x17'),'priority':_0x244ce6++},_0x1bee4b));}return _0x472bf6;};var getChanSpyApplications=function(_0x338c0f,_0x246815){var _0xf6d9b2=[];for(var _0x264dad=0x0,_0x3d7db4=0x1;_0x264dad<_0x246815[_0xc5df('0x18')];_0x264dad++,_0x3d7db4=0x1){_0xf6d9b2=_0xf6d9b2[_0xc5df('0x19')](getUserApplications(_0x338c0f,_0x246815[_0x264dad],_0x246815[_0x264dad][_0xc5df('0x1a')]));if(_0x246815[_0x264dad][_0xc5df('0x1a')]!=_0x246815[_0x264dad][_0xc5df('0x14')]){_0xf6d9b2=_0xf6d9b2[_0xc5df('0x19')](getUserApplications(_0x338c0f,_0x246815[_0x264dad],_0x246815[_0x264dad][_0xc5df('0x14')]));}}return _0xf6d9b2;};var getChanSpyPromise=function(_0x2a14c5,_0x2fee8b){return new BPromise(function(_0x3a38bd,_0xf02458){return _0x2a14c5['User'][_0xc5df('0x1b')]({'attributes':['id','name',_0xc5df('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xc5df('0x1c')](function(_0x1ebab9){if(_0x1ebab9){return _0x3a38bd(getChanSpyApplications(_0x2fee8b,_0x1ebab9));}return _0x3a38bd([]);})['catch'](function(_0x85a561){_0xf02458(_0x85a561);});});};module[_0xc5df('0x1d')]=function(_0x195366,_0x892551){var _0x2f2ee0=_0x195366[_0xc5df('0x1e')];return _0x195366[_0xc5df('0x1f')](_0xc5df('0x20'),attributes,{'tableName':_0xc5df('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f2508,_0x2dfb65,_0x11514f){return getChanSpyPromise(_0x2f2ee0,_0x4f2508)['then'](function(_0x26511c){if(_0x26511c&&_0x26511c[_0xc5df('0x18')]){return _0x2f2ee0[_0xc5df('0x22')][_0xc5df('0x23')](_0x26511c);}})[_0xc5df('0x1c')](function(){_0x11514f();})[_0xc5df('0x24')](function(_0x1a071b){_0x11514f(_0x1a071b);});},'afterUpdate':function(_0x4fea9f,_0xed0de9,_0x14764b){return _0x2f2ee0['VoiceExtension'][_0xc5df('0x25')]({'where':{'ChanSpyId':_0x4fea9f['id']}})[_0xc5df('0x1c')](function(){return getChanSpyPromise(_0x2f2ee0,_0x4fea9f);})[_0xc5df('0x1c')](function(_0x2f38a0){if(_0x2f38a0&&_0x2f38a0[_0xc5df('0x18')]){return _0x2f2ee0[_0xc5df('0x22')][_0xc5df('0x23')](_0x2f38a0);}})[_0xc5df('0x1c')](function(){_0x14764b();})[_0xc5df('0x24')](function(_0x663d62){_0x14764b(_0x663d62);});},'afterDestroy':function(_0x304a49,_0x1fc03b,_0x21e49a){return _0x2f2ee0[_0xc5df('0x22')]['destroy']({'where':{'ChanSpyId':_0x304a49['id']}})[_0xc5df('0x1c')](function(){_0x21e49a();})[_0xc5df('0x24')](function(_0x2045f5){_0x21e49a(_0x2045f5);});}}});}; \ No newline at end of file +var _0x1e90=['${UNIQUEID}.%s,ab','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','options','join','length','concat','internal','name','User','findAll','agent','then','catch','exports','define','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','push','Set','format','chanspy','record','merge','MixMonitor'];(function(_0x2cff3d,_0x86b25a){var _0x13bfd9=function(_0x29cdc5){while(--_0x29cdc5){_0x2cff3d['push'](_0x2cff3d['shift']());}};_0x13bfd9(++_0x86b25a);}(_0x1e90,0x1b8));var _0x01e9=function(_0x52939e,_0x35c17f){_0x52939e=_0x52939e-0x0;var _0x7503d=_0x1e90[_0x52939e];return _0x7503d;};'use strict';var _=require(_0x01e9('0x0'));var util=require(_0x01e9('0x1'));var BPromise=require(_0x01e9('0x2'));var attributes=require(_0x01e9('0x3'));var getUserApplications=function(_0x3aeb8,_0x2c48ae,_0x2fe31a){var _0x3d1d49=0x1;var _0x22efd8=[];var _0x56e12d={'context':_0x2c48ae[_0x01e9('0x4')]||_0x01e9('0x5'),'exten':util['format'](_0x01e9('0x6'),_0x3aeb8[_0x01e9('0x7')],_0x2fe31a),'type':_0x01e9('0x8'),'isApp':![],'ChanSpyId':_0x3aeb8['id'],'UserId':_0x2c48ae['id']};_0x22efd8[_0x01e9('0x9')](_['merge']({'app':_0x01e9('0xa'),'appdata':util[_0x01e9('0xb')]('CDR(type)=%s',_0x01e9('0xc')),'priority':_0x3d1d49++},_0x56e12d));if(_0x3aeb8[_0x01e9('0xd')]){_0x22efd8[_0x01e9('0x9')](_[_0x01e9('0xe')]({'app':_0x01e9('0xf'),'appdata':util['format'](_0x01e9('0x10'),_0x3aeb8[_0x01e9('0x11')]),'priority':_0x3d1d49++},_0x56e12d));}if(_0x3aeb8[_0x01e9('0x12')]){_0x22efd8['push'](_[_0x01e9('0xe')]({'app':_0x01e9('0x13'),'appdata':_0x3aeb8['password'],'priority':_0x3d1d49++},_0x56e12d));}_0x22efd8[_0x01e9('0x9')](_[_0x01e9('0xe')]({'app':_0x01e9('0x14'),'appdata':util['format'](_0x01e9('0x15'),_0x2c48ae['name'],_0x3aeb8['options']?_0x3aeb8[_0x01e9('0x16')][_0x01e9('0x17')](''):''),'priority':_0x3d1d49++},_0x56e12d));if(_0x3aeb8['record']){_0x22efd8[_0x01e9('0x9')](_['merge']({'app':'StopMixMonitor','priority':_0x3d1d49++},_0x56e12d));}return _0x22efd8;};var getChanSpyApplications=function(_0x461f79,_0x5e1262){var _0x231d50=[];for(var _0x5535e2=0x0,_0x57b67a=0x1;_0x5535e2<_0x5e1262[_0x01e9('0x18')];_0x5535e2++,_0x57b67a=0x1){_0x231d50=_0x231d50[_0x01e9('0x19')](getUserApplications(_0x461f79,_0x5e1262[_0x5535e2],_0x5e1262[_0x5535e2]['internal']));if(_0x5e1262[_0x5535e2][_0x01e9('0x1a')]!=_0x5e1262[_0x5535e2][_0x01e9('0x1b')]){_0x231d50=_0x231d50[_0x01e9('0x19')](getUserApplications(_0x461f79,_0x5e1262[_0x5535e2],_0x5e1262[_0x5535e2][_0x01e9('0x1b')]));}}return _0x231d50;};var getChanSpyPromise=function(_0x420499,_0x46a57c){return new BPromise(function(_0x4bcf28,_0x519b2b){return _0x420499[_0x01e9('0x1c')][_0x01e9('0x1d')]({'attributes':['id',_0x01e9('0x1b'),_0x01e9('0x1a')],'where':{'role':_0x01e9('0x1e'),'chanspy':!![]},'raw':!![]})[_0x01e9('0x1f')](function(_0x5829e4){if(_0x5829e4){return _0x4bcf28(getChanSpyApplications(_0x46a57c,_0x5829e4));}return _0x4bcf28([]);})[_0x01e9('0x20')](function(_0x4d7cc4){_0x519b2b(_0x4d7cc4);});});};module[_0x01e9('0x21')]=function(_0x5327df,_0x37cdcf){var _0x9e92db=_0x5327df['models'];return _0x5327df[_0x01e9('0x22')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x54c333,_0x4f958c,_0x250f37){return getChanSpyPromise(_0x9e92db,_0x54c333)['then'](function(_0x5c44f9){if(_0x5c44f9&&_0x5c44f9[_0x01e9('0x18')]){return _0x9e92db[_0x01e9('0x23')][_0x01e9('0x24')](_0x5c44f9);}})[_0x01e9('0x1f')](function(){_0x250f37();})['catch'](function(_0xf25e67){_0x250f37(_0xf25e67);});},'afterUpdate':function(_0x1d272a,_0x387439,_0x31762a){return _0x9e92db[_0x01e9('0x23')][_0x01e9('0x25')]({'where':{'ChanSpyId':_0x1d272a['id']}})['then'](function(){return getChanSpyPromise(_0x9e92db,_0x1d272a);})[_0x01e9('0x1f')](function(_0x16f1c8){if(_0x16f1c8&&_0x16f1c8[_0x01e9('0x18')]){return _0x9e92db[_0x01e9('0x23')]['bulkCreate'](_0x16f1c8);}})[_0x01e9('0x1f')](function(){_0x31762a();})[_0x01e9('0x20')](function(_0x29c91b){_0x31762a(_0x29c91b);});},'afterDestroy':function(_0x53262e,_0x39501d,_0x5898c1){return _0x9e92db[_0x01e9('0x23')][_0x01e9('0x25')]({'where':{'ChanSpyId':_0x53262e['id']}})[_0x01e9('0x1f')](function(){_0x5898c1();})[_0x01e9('0x20')](function(_0x452d3b){_0x5898c1(_0x452d3b);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 2e6efeb..7bcfd87 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 _0x187d=['jayson/promise','client','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x38b7ce,_0xc4d93){var _0x49b2bf=function(_0x378612){while(--_0x378612){_0x38b7ce['push'](_0x38b7ce['shift']());}};_0x49b2bf(++_0xc4d93);}(_0x187d,0x1e6));var _0xd187=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x187d[_0xbe200f];return _0x192597;};'use strict';var _=require(_0xd187('0x0'));var util=require(_0xd187('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd187('0x2'));var fs=require('fs');var Redis=require(_0xd187('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd187('0x4'));var logger=require(_0xd187('0x5'))(_0xd187('0x6'));var config=require(_0xd187('0x7'));var jayson=require(_0xd187('0x8'));var client=jayson[_0xd187('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xded258,_0x1ff1a1,_0x479106){return new BPromise(function(_0x484897,_0x2a4773){return client['request'](_0xded258,_0x479106)['then'](function(_0x45a6ee){logger[_0xd187('0xa')](_0xd187('0xb'),_0x1ff1a1,'request\x20sent');logger[_0xd187('0xc')](_0xd187('0xd'),_0x1ff1a1,_0xd187('0xe'),JSON[_0xd187('0xf')](_0x45a6ee));if(_0x45a6ee[_0xd187('0x10')]){if(_0x45a6ee[_0xd187('0x10')]['code']===0x1f4){logger[_0xd187('0x10')](_0xd187('0xb'),_0x1ff1a1,_0x45a6ee[_0xd187('0x10')]['message']);return _0x2a4773(_0x45a6ee[_0xd187('0x10')][_0xd187('0x11')]);}logger['error'](_0xd187('0xb'),_0x1ff1a1,_0x45a6ee[_0xd187('0x10')][_0xd187('0x11')]);return _0x484897(_0x45a6ee['error'][_0xd187('0x11')]);}else{logger['info'](_0xd187('0xb'),_0x1ff1a1,_0xd187('0xe'));_0x484897(_0x45a6ee['result']['message']);}})[_0xd187('0x12')](function(_0x5264a9){logger[_0xd187('0x10')](_0xd187('0xb'),_0x1ff1a1,_0x5264a9);_0x2a4773(_0x5264a9);});});} \ No newline at end of file +var _0x1036=['../../config/logger','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xf462b9,_0x2dc475){var _0xfaba22=function(_0x50668b){while(--_0x50668b){_0xf462b9['push'](_0xf462b9['shift']());}};_0xfaba22(++_0x2dc475);}(_0x1036,0x151));var _0x6103=function(_0x2c4d94,_0x32c025){_0x2c4d94=_0x2c4d94-0x0;var _0x18d6ce=_0x1036[_0x2c4d94];return _0x18d6ce;};'use strict';var _=require('lodash');var util=require(_0x6103('0x0'));var moment=require('moment');var BPromise=require(_0x6103('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6103('0x2'));var db=require(_0x6103('0x3'))['db'];var utils=require(_0x6103('0x4'));var logger=require(_0x6103('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6103('0x6'));var client=jayson[_0x6103('0x7')][_0x6103('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x37111b,_0x4f00dd,_0x2a6174){return new BPromise(function(_0x1ac1c5,_0x1f6b28){return client['request'](_0x37111b,_0x2a6174)[_0x6103('0x9')](function(_0x3b80e6){logger[_0x6103('0xa')](_0x6103('0xb'),_0x4f00dd,_0x6103('0xc'));logger[_0x6103('0xd')](_0x6103('0xe'),_0x4f00dd,_0x6103('0xc'),JSON['stringify'](_0x3b80e6));if(_0x3b80e6['error']){if(_0x3b80e6['error']['code']===0x1f4){logger[_0x6103('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x4f00dd,_0x3b80e6[_0x6103('0xf')][_0x6103('0x10')]);return _0x1f6b28(_0x3b80e6[_0x6103('0xf')][_0x6103('0x10')]);}logger[_0x6103('0xf')](_0x6103('0xb'),_0x4f00dd,_0x3b80e6[_0x6103('0xf')][_0x6103('0x10')]);return _0x1ac1c5(_0x3b80e6[_0x6103('0xf')][_0x6103('0x10')]);}else{logger[_0x6103('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x4f00dd,_0x6103('0xc'));_0x1ac1c5(_0x3b80e6[_0x6103('0x11')][_0x6103('0x10')]);}})[_0x6103('0x12')](function(_0x4e35ef){logger[_0x6103('0xf')](_0x6103('0xb'),_0x4f00dd,_0x4e35ef);_0x1f6b28(_0x4e35ef);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 4afa0a2..7c400c6 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 _0x9bd8=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x88dbd4,_0x53ac6c){var _0xaaea4a=function(_0x369061){while(--_0x369061){_0x88dbd4['push'](_0x88dbd4['shift']());}};_0xaaea4a(++_0x53ac6c);}(_0x9bd8,0x1de));var _0x89bd=function(_0x56a226,_0x2fb531){_0x56a226=_0x56a226-0x0;var _0x15fcfe=_0x9bd8[_0x56a226];return _0x15fcfe;};'use strict';var multer=require(_0x89bd('0x0'));var util=require(_0x89bd('0x1'));var path=require(_0x89bd('0x2'));var timeout=require(_0x89bd('0x3'));var express=require(_0x89bd('0x4'));var router=express[_0x89bd('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x89bd('0x6'));var config=require(_0x89bd('0x7'));var controller=require(_0x89bd('0x8'));router[_0x89bd('0x9')]('/',auth[_0x89bd('0xa')](),controller[_0x89bd('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x89bd('0xc')]);router[_0x89bd('0xd')]('/',auth['isAuthenticated'](),controller[_0x89bd('0xe')]);router[_0x89bd('0xf')](_0x89bd('0x10'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x89bd('0x10'),auth[_0x89bd('0xa')](),controller[_0x89bd('0x11')]);module[_0x89bd('0x12')]=router; \ No newline at end of file +var _0x1e89=['destroy','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','/:id','show','create','put','delete'];(function(_0x584b6e,_0x2329b0){var _0x5f2927=function(_0x369c13){while(--_0x369c13){_0x584b6e['push'](_0x584b6e['shift']());}};_0x5f2927(++_0x2329b0);}(_0x1e89,0xd3));var _0x91e8=function(_0x39088a,_0x5fdc4e){_0x39088a=_0x39088a-0x0;var _0x4d733a=_0x1e89[_0x39088a];return _0x4d733a;};'use strict';var multer=require(_0x91e8('0x0'));var util=require(_0x91e8('0x1'));var path=require(_0x91e8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x91e8('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x91e8('0x4'));var config=require(_0x91e8('0x5'));var controller=require(_0x91e8('0x6'));router['get']('/',auth[_0x91e8('0x7')](),controller[_0x91e8('0x8')]);router['get'](_0x91e8('0x9'),auth[_0x91e8('0x7')](),controller[_0x91e8('0xa')]);router['post']('/',auth[_0x91e8('0x7')](),controller[_0x91e8('0xb')]);router[_0x91e8('0xc')](_0x91e8('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x91e8('0xd')](_0x91e8('0x9'),auth[_0x91e8('0x7')](),controller[_0x91e8('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 e749167..947ec3f 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x2c99ca,_0x2bce8a){var _0xa51e9c=function(_0x2ee938){while(--_0x2ee938){_0x2c99ca['push'](_0x2c99ca['shift']());}};_0xa51e9c(++_0x2bce8a);}(_0x34e8,0x12c));var _0x834e=function(_0x4ad5ea,_0x1d30d8){_0x4ad5ea=_0x4ad5ea-0x0;var _0x76ecdd=_0x34e8[_0x4ad5ea];return _0x76ecdd;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe14b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1393bb,_0x2a93e1){var _0x305025=function(_0x13b28d){while(--_0x13b28d){_0x1393bb['push'](_0x1393bb['shift']());}};_0x305025(++_0x2a93e1);}(_0xe14b,0x93));var _0xbe14=function(_0x3877a4,_0x34e460){_0x3877a4=_0x3877a4-0x0;var _0xa717ec=_0xe14b[_0x3877a4];return _0xa717ec;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xbe14('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbe14('0x3')],'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 e7b3eed..a751425 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 _0x20b8=['then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','Contexts','UserProfileResource','sendStatus','stack','name','index','VoiceContext','rawAttributes','key','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','count','include','findAll','show','params','keys','intersection','includeAll','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','role','userProfileId','utf8','chan_sip.so','render','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','request'];(function(_0x1658f1,_0x188311){var _0x1850ed=function(_0x395ddb){while(--_0x395ddb){_0x1658f1['push'](_0x1658f1['shift']());}};_0x1850ed(++_0x188311);}(_0x20b8,0x170));var _0x820b=function(_0x5ab4e2,_0x165e94){_0x5ab4e2=_0x5ab4e2-0x0;var _0xb876a6=_0x20b8[_0x5ab4e2];return _0xb876a6;};'use strict';var pdf=require(_0x820b('0x0'));var emlformat=require(_0x820b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x820b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x820b('0x3'));var moment=require('moment');var BPromise=require(_0x820b('0x4'));var Mustache=require(_0x820b('0x5'));var util=require(_0x820b('0x6'));var path=require('path');var sox=require(_0x820b('0x7'));var csv=require(_0x820b('0x8'));var ejs=require(_0x820b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x820b('0xa'));var jsforce=require(_0x820b('0xb'));var deskjs=require(_0x820b('0xc'));var toCsv=require(_0x820b('0x8'));var querystring=require(_0x820b('0xd'));var Papa=require(_0x820b('0xe'));var Redis=require(_0x820b('0xf'));var authService=require(_0x820b('0x10'));var qs=require(_0x820b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x820b('0x12'))(_0x820b('0x13'));var utils=require(_0x820b('0x14'));var config=require(_0x820b('0x15'));var db=require(_0x820b('0x16'))['db'];var jayson=require(_0x820b('0x17'));var client=jayson['client'][_0x820b('0x18')]({'port':0x232a});function checkPasswordPattern(_0xa9a1ae,_0x374393,_0x270a54){if(_0x270a54){var _0x4d5be8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d5be8[_0x820b('0x19')](_0x374393)){return _0xa9a1ae;}else{throw new db[(_0x820b('0x1a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xa9a1ae;}}function respondWithRpcPromise(_0x3e28e4,_0x32f092,_0x559673,_0x2bf6eb){return new BPromise(function(_0x1338ae,_0x498cf2){var _0x174551=_0x2bf6eb||client;return _0x174551[_0x820b('0x1b')](_0x3e28e4,_0x559673)[_0x820b('0x1c')](function(_0x452ae3){logger[_0x820b('0x1d')](_0x820b('0x1e'),_0x32f092,_0x820b('0x1f'));logger[_0x820b('0x20')](_0x820b('0x21'),_0x32f092,_0x820b('0x1f'),JSON[_0x820b('0x22')](_0x452ae3));if(_0x452ae3[_0x820b('0x23')]){if(_0x452ae3[_0x820b('0x23')][_0x820b('0x24')]===0x1f4){logger[_0x820b('0x23')](_0x820b('0x1e'),_0x32f092,_0x452ae3[_0x820b('0x23')][_0x820b('0x25')]);return _0x498cf2(_0x452ae3[_0x820b('0x23')][_0x820b('0x25')]);}logger['error'](_0x820b('0x1e'),_0x32f092,_0x452ae3[_0x820b('0x23')][_0x820b('0x25')]);return _0x1338ae(_0x452ae3['error'][_0x820b('0x25')]);}else{logger[_0x820b('0x1d')](_0x820b('0x1e'),_0x32f092,_0x820b('0x1f'));_0x1338ae(_0x452ae3[_0x820b('0x26')]['message']);}})[_0x820b('0x27')](function(_0x52cc1e){logger[_0x820b('0x23')]('VoiceContext,\x20%s,\x20%s',_0x32f092,_0x52cc1e);_0x498cf2(_0x52cc1e);});});}function respondWithStatusCode(_0x4205b6,_0xdf5593){_0xdf5593=_0xdf5593||0xcc;return function(_0x4e1837){if(_0x4e1837){return _0x4205b6['sendStatus'](_0xdf5593);}return _0x4205b6['status'](_0xdf5593)[_0x820b('0x28')]();};}function respondWithResult(_0x2202f2,_0x2753d3){_0x2753d3=_0x2753d3||0xc8;return function(_0x44bd51){if(_0x44bd51){return _0x2202f2[_0x820b('0x29')](_0x2753d3)[_0x820b('0x2a')](_0x44bd51);}};}function respondWithFilteredResult(_0x32944d,_0x48b547){return function(_0x54f38f){if(_0x54f38f){var _0x5379dc=_0x54f38f['count'],_0x23f41d=_0x48b547[_0x820b('0x2b')],_0xec6e2d=_0x48b547[_0x820b('0x2b')]+_0x48b547[_0x820b('0x2c')],_0x4daa09;if(_0xec6e2d>=_0x5379dc){_0xec6e2d=_0x5379dc;_0x4daa09=0xc8;}else{_0x4daa09=0xce;}_0x32944d['status'](_0x4daa09);return _0x32944d[_0x820b('0x2d')](_0x820b('0x2e'),_0x23f41d+'-'+_0xec6e2d+'/'+_0x5379dc)[_0x820b('0x2a')](_0x54f38f);}return null;};}function patchUpdates(_0x519027){return function(_0x4a4603){try{jsonpatch[_0x820b('0x2f')](_0x4a4603,_0x519027,!![]);}catch(_0x34c098){return BPromise['reject'](_0x34c098);}return _0x4a4603[_0x820b('0x30')]();};}function saveUpdates(_0x34a651,_0xcb4ebe){return function(_0x96c900){if(_0x96c900){return _0x96c900[_0x820b('0x31')](_0x34a651)[_0x820b('0x1c')](function(_0x1de76b){return _0x1de76b;});}return null;};}function removeEntity(_0x276dc1,_0x1a22f5){return function(_0x1587f){if(_0x1587f){return _0x1587f[_0x820b('0x32')]()[_0x820b('0x1c')](function(){var _0x57881e=_0x1587f['get']({'plain':!![]});var _0x549a1c=_0x820b('0x33');return db[_0x820b('0x34')]['destroy']({'where':{'type':_0x549a1c,'resourceId':_0x57881e['id']}})[_0x820b('0x1c')](function(){return _0x1587f;});})['then'](function(){_0x276dc1[_0x820b('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e4774,_0x3dcf96){return function(_0x2e46c1){if(!_0x2e46c1){_0x2e4774[_0x820b('0x35')](0x194);}return _0x2e46c1;};}function handleError(_0x2e68d6,_0x53d2b0){_0x53d2b0=_0x53d2b0||0x1f4;return function(_0x2fceab){logger[_0x820b('0x23')](_0x2fceab[_0x820b('0x36')]);if(_0x2fceab[_0x820b('0x37')]){delete _0x2fceab[_0x820b('0x37')];}_0x2e68d6[_0x820b('0x29')](_0x53d2b0)['send'](_0x2fceab);};}exports[_0x820b('0x38')]=function(_0x22009e,_0xc0236a){var _0x64e046={},_0x2cef4f={},_0x2fdd8f={'count':0x0,'rows':[]};var _0x19ac03=_['map'](db[_0x820b('0x39')][_0x820b('0x3a')],function(_0xc4a124){return{'name':_0xc4a124['fieldName'],'type':_0xc4a124['type'][_0x820b('0x3b')]};});_0x2cef4f['model']=_['map'](_0x19ac03,'name');_0x2cef4f[_0x820b('0x3c')]=_['keys'](_0x22009e[_0x820b('0x3c')]);_0x2cef4f[_0x820b('0x3d')]=_['intersection'](_0x2cef4f[_0x820b('0x3e')],_0x2cef4f['query']);_0x64e046['attributes']=_['intersection'](_0x2cef4f[_0x820b('0x3e')],qs['fields'](_0x22009e[_0x820b('0x3c')][_0x820b('0x3f')]));_0x64e046[_0x820b('0x40')]=_0x64e046['attributes'][_0x820b('0x41')]?_0x64e046[_0x820b('0x40')]:_0x2cef4f['model'];if(!_0x22009e[_0x820b('0x3c')][_0x820b('0x42')](_0x820b('0x43'))){_0x64e046['limit']=qs[_0x820b('0x2c')](_0x22009e[_0x820b('0x3c')][_0x820b('0x2c')]);_0x64e046[_0x820b('0x2b')]=qs[_0x820b('0x2b')](_0x22009e[_0x820b('0x3c')][_0x820b('0x2b')]);}_0x64e046['order']=qs[_0x820b('0x44')](_0x22009e[_0x820b('0x3c')][_0x820b('0x44')]);_0x64e046[_0x820b('0x45')]=qs[_0x820b('0x3d')](_['pick'](_0x22009e[_0x820b('0x3c')],_0x2cef4f[_0x820b('0x3d')]));if(_0x22009e[_0x820b('0x3c')][_0x820b('0x46')]){_0x64e046[_0x820b('0x45')]=_[_0x820b('0x47')](_0x64e046['where'],{'$or':_[_0x820b('0x48')](_0x19ac03,function(_0x5bc371){if(_0x5bc371['type']!==_0x820b('0x49')){var _0x547844={};_0x547844[_0x5bc371[_0x820b('0x37')]]={'$like':'%'+_0x22009e[_0x820b('0x3c')][_0x820b('0x46')]+'%'};return _0x547844;}})});}_0x64e046=_[_0x820b('0x47')]({},_0x64e046,_0x22009e[_0x820b('0x4a')]);var _0x322737={'where':_0x64e046[_0x820b('0x45')]};return db[_0x820b('0x39')][_0x820b('0x4b')](_0x322737)[_0x820b('0x1c')](function(_0x4435af){_0x2fdd8f[_0x820b('0x4b')]=_0x4435af;if(_0x22009e[_0x820b('0x3c')]['includeAll']){_0x64e046[_0x820b('0x4c')]=[{'all':!![]}];}return db[_0x820b('0x39')][_0x820b('0x4d')](_0x64e046);})[_0x820b('0x1c')](function(_0x4fe7a8){_0x2fdd8f['rows']=_0x4fe7a8;return _0x2fdd8f;})[_0x820b('0x1c')](respondWithFilteredResult(_0xc0236a,_0x64e046))[_0x820b('0x27')](handleError(_0xc0236a,null));};exports[_0x820b('0x4e')]=function(_0x5b13b1,_0x3d6ff3){var _0x3d9806={'raw':![],'where':{'id':_0x5b13b1[_0x820b('0x4f')]['id']}},_0x2183b1={};_0x2183b1[_0x820b('0x3e')]=_[_0x820b('0x50')](db[_0x820b('0x39')][_0x820b('0x3a')]);_0x2183b1[_0x820b('0x3c')]=_[_0x820b('0x50')](_0x5b13b1[_0x820b('0x3c')]);_0x2183b1[_0x820b('0x3d')]=_[_0x820b('0x51')](_0x2183b1['model'],_0x2183b1[_0x820b('0x3c')]);_0x3d9806[_0x820b('0x40')]=_['intersection'](_0x2183b1[_0x820b('0x3e')],qs[_0x820b('0x3f')](_0x5b13b1[_0x820b('0x3c')][_0x820b('0x3f')]));_0x3d9806[_0x820b('0x40')]=_0x3d9806[_0x820b('0x40')]['length']?_0x3d9806[_0x820b('0x40')]:_0x2183b1[_0x820b('0x3e')];if(_0x5b13b1[_0x820b('0x3c')][_0x820b('0x52')]){_0x3d9806[_0x820b('0x4c')]=[{'all':!![]}];}_0x3d9806=_[_0x820b('0x47')]({},_0x3d9806,_0x5b13b1[_0x820b('0x4a')]);return db[_0x820b('0x39')][_0x820b('0x53')](_0x3d9806)[_0x820b('0x1c')](handleEntityNotFound(_0x3d6ff3,null))[_0x820b('0x1c')](respondWithResult(_0x3d6ff3,null))[_0x820b('0x27')](handleError(_0x3d6ff3,null));};exports[_0x820b('0x54')]=function(_0x1ed650,_0x24ec3b,_0x49db03){var _0x45eeb8;return db[_0x820b('0x39')]['create'](_0x1ed650[_0x820b('0x55')],{'raw':!![]})[_0x820b('0x1c')](function(_0x20b871){_0x45eeb8=_0x20b871;return db[_0x820b('0x39')][_0x820b('0x4d')]({'raw':!![]});})[_0x820b('0x1c')](function(_0x7e788b){var _0x7aaf8a=fs[_0x820b('0x56')](path[_0x820b('0x57')](config[_0x820b('0x58')],_0x820b('0x59')),'utf8');var _0x593861=ejs['render'](_0x7aaf8a,{'contexts':_0x7e788b||[]});fs[_0x820b('0x5a')](_0x820b('0x5b'),_0x593861);})['then'](function(){return respondWithRpcPromise(_0x820b('0x5c'),_0x820b('0x54'),{'module':'chan_sip.so'});})['then'](function(){var _0x1392be=_0x1ed650[_0x820b('0x5d')]['get']({'plain':!![]});if(!_0x1392be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1392be[_0x820b('0x5e')]===_0x820b('0x5d')){var _0x1f8f0e=_0x45eeb8['get']({'plain':!![]});return db['UserProfileSection'][_0x820b('0x53')]({'where':{'name':_0x820b('0x33'),'userProfileId':_0x1392be[_0x820b('0x5f')]},'raw':!![]})[_0x820b('0x1c')](function(_0x11173a){if(_0x11173a&&_0x11173a['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x1f8f0e[_0x820b('0x37')],'resourceId':_0x1f8f0e['id'],'type':_0x11173a[_0x820b('0x37')],'sectionId':_0x11173a['id']},{})['then'](function(){return _0x45eeb8;});}else{return _0x45eeb8;}})['catch'](function(_0x25d389){logger[_0x820b('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25d389);throw _0x25d389;});}return _0x45eeb8;})[_0x820b('0x1c')](respondWithResult(_0x24ec3b,0xc9))[_0x820b('0x27')](handleError(_0x24ec3b,null));};exports[_0x820b('0x31')]=function(_0xb987de,_0x105bd6,_0x3b9e9a){var _0x1d3b0f;return db[_0x820b('0x39')][_0x820b('0x53')]({'where':{'id':_0xb987de[_0x820b('0x4f')]['id']}})[_0x820b('0x1c')](handleEntityNotFound(_0x105bd6,null))[_0x820b('0x1c')](saveUpdates(_0xb987de[_0x820b('0x55')],null))[_0x820b('0x1c')](function(_0x174d39){if(_0x174d39){_0x1d3b0f=_0x174d39;return db[_0x820b('0x39')][_0x820b('0x4d')]({'raw':!![]});}})['then'](function(_0x2a6235){var _0xb7ae2c=fs['readFileSync'](path[_0x820b('0x57')](config[_0x820b('0x58')],'server/files/templates/context.ejs'),_0x820b('0x60'));var _0x33d22c=ejs['render'](_0xb7ae2c,{'contexts':_0x2a6235||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x33d22c);})[_0x820b('0x1c')](function(){return respondWithRpcPromise('Reload',_0x820b('0x31'),{'module':_0x820b('0x61')});})[_0x820b('0x1c')](function(){return _0x1d3b0f;})['then'](respondWithResult(_0x105bd6,null))[_0x820b('0x27')](handleError(_0x105bd6,null));};exports[_0x820b('0x32')]=function(_0x29976c,_0x25a1fd,_0x20d880){var _0x52d390;return db['VoiceContext'][_0x820b('0x53')]({'where':{'id':_0x29976c[_0x820b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x25a1fd,null))['then'](removeEntity(_0x25a1fd,null))[_0x820b('0x1c')](function(){return db[_0x820b('0x39')][_0x820b('0x4d')]({'raw':!![]});})[_0x820b('0x1c')](function(_0x20ff7e){var _0x510223=fs[_0x820b('0x56')](path['join'](config[_0x820b('0x58')],_0x820b('0x59')),_0x820b('0x60'));var _0xa8fedc=ejs[_0x820b('0x62')](_0x510223,{'contexts':_0x20ff7e});fs[_0x820b('0x5a')](_0x820b('0x5b'),_0xa8fedc);return respondWithRpcPromise(_0x820b('0x5c'),_0x820b('0x32'),{'module':'chan_sip.so'});})[_0x820b('0x27')](handleError(_0x25a1fd,null));}; \ No newline at end of file +var _0xa0fe=['html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','get','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','merge','includeAll','include','findAll','params','length','options','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','find','userProfileId','destroy'];(function(_0x141bbc,_0x1c29f2){var _0x555185=function(_0x4a227a){while(--_0x4a227a){_0x141bbc['push'](_0x141bbc['shift']());}};_0x555185(++_0x1c29f2);}(_0xa0fe,0xd8));var _0xea0f=function(_0x4dff05,_0x315a2a){_0x4dff05=_0x4dff05-0x0;var _0x5bbe81=_0xa0fe[_0x4dff05];return _0x5bbe81;};'use strict';var pdf=require(_0xea0f('0x0'));var emlformat=require(_0xea0f('0x1'));var rimraf=require(_0xea0f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea0f('0x3'));var rp=require(_0xea0f('0x4'));var moment=require(_0xea0f('0x5'));var BPromise=require(_0xea0f('0x6'));var Mustache=require(_0xea0f('0x7'));var util=require(_0xea0f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xea0f('0x9'));var ejs=require(_0xea0f('0xa'));var fs=require('fs');var _=require(_0xea0f('0xb'));var squel=require(_0xea0f('0xc'));var crypto=require(_0xea0f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xea0f('0xe'));var toCsv=require(_0xea0f('0x9'));var querystring=require(_0xea0f('0xf'));var Papa=require(_0xea0f('0x10'));var Redis=require(_0xea0f('0x11'));var authService=require(_0xea0f('0x12'));var qs=require(_0xea0f('0x13'));var as=require(_0xea0f('0x14'));var hardwareService=require(_0xea0f('0x15'));var logger=require(_0xea0f('0x16'))(_0xea0f('0x17'));var utils=require(_0xea0f('0x18'));var config=require(_0xea0f('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xea0f('0x1a'));var client=jayson[_0xea0f('0x1b')][_0xea0f('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3e0460,_0x3bbb42,_0x25247b){if(_0x25247b){var _0x44af12=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x44af12[_0xea0f('0x1d')](_0x3bbb42)){return _0x3e0460;}else{throw new db[(_0xea0f('0x1e'))][(_0xea0f('0x1f'))](_0xea0f('0x20'));}}else{return _0x3e0460;}}function respondWithRpcPromise(_0x5c9443,_0x54159d,_0x26f810,_0x228cf2){return new BPromise(function(_0x384118,_0x5b2af2){var _0x2cbc54=_0x228cf2||client;return _0x2cbc54['request'](_0x5c9443,_0x26f810)[_0xea0f('0x21')](function(_0x504322){logger['info']('VoiceContext,\x20%s,\x20%s',_0x54159d,_0xea0f('0x22'));logger[_0xea0f('0x23')](_0xea0f('0x24'),_0x54159d,'request\x20sent',JSON[_0xea0f('0x25')](_0x504322));if(_0x504322[_0xea0f('0x26')]){if(_0x504322[_0xea0f('0x26')][_0xea0f('0x27')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x54159d,_0x504322[_0xea0f('0x26')][_0xea0f('0x28')]);return _0x5b2af2(_0x504322[_0xea0f('0x26')][_0xea0f('0x28')]);}logger['error'](_0xea0f('0x29'),_0x54159d,_0x504322['error'][_0xea0f('0x28')]);return _0x384118(_0x504322['error'][_0xea0f('0x28')]);}else{logger[_0xea0f('0x2a')](_0xea0f('0x29'),_0x54159d,'request\x20sent');_0x384118(_0x504322[_0xea0f('0x2b')]['message']);}})[_0xea0f('0x2c')](function(_0x1971fe){logger['error']('VoiceContext,\x20%s,\x20%s',_0x54159d,_0x1971fe);_0x5b2af2(_0x1971fe);});});}function respondWithStatusCode(_0x4398a6,_0x4a56a0){_0x4a56a0=_0x4a56a0||0xcc;return function(_0x1fa7a0){if(_0x1fa7a0){return _0x4398a6[_0xea0f('0x2d')](_0x4a56a0);}return _0x4398a6[_0xea0f('0x2e')](_0x4a56a0)[_0xea0f('0x2f')]();};}function respondWithResult(_0x3904fa,_0x4f4c19){_0x4f4c19=_0x4f4c19||0xc8;return function(_0x599c70){if(_0x599c70){return _0x3904fa[_0xea0f('0x2e')](_0x4f4c19)[_0xea0f('0x30')](_0x599c70);}};}function respondWithFilteredResult(_0x29e584,_0x3c1634){return function(_0xad531c){if(_0xad531c){var _0x47ece7=_0xad531c[_0xea0f('0x31')],_0x1d03fc=_0x3c1634[_0xea0f('0x32')],_0x4d9500=_0x3c1634[_0xea0f('0x32')]+_0x3c1634[_0xea0f('0x33')],_0x1e0ced;if(_0x4d9500>=_0x47ece7){_0x4d9500=_0x47ece7;_0x1e0ced=0xc8;}else{_0x1e0ced=0xce;}_0x29e584[_0xea0f('0x2e')](_0x1e0ced);return _0x29e584[_0xea0f('0x34')](_0xea0f('0x35'),_0x1d03fc+'-'+_0x4d9500+'/'+_0x47ece7)['json'](_0xad531c);}return null;};}function patchUpdates(_0x3f1846){return function(_0x4c1f4d){try{jsonpatch[_0xea0f('0x36')](_0x4c1f4d,_0x3f1846,!![]);}catch(_0x471313){return BPromise[_0xea0f('0x37')](_0x471313);}return _0x4c1f4d[_0xea0f('0x38')]();};}function saveUpdates(_0x388f64,_0x1b5c6a){return function(_0x39e10c){if(_0x39e10c){return _0x39e10c['update'](_0x388f64)[_0xea0f('0x21')](function(_0x8c2235){return _0x8c2235;});}return null;};}function removeEntity(_0x5dbc92,_0x19774c){return function(_0x199f45){if(_0x199f45){return _0x199f45['destroy']()[_0xea0f('0x21')](function(){var _0x2c7f5d=_0x199f45[_0xea0f('0x39')]({'plain':!![]});var _0x1235d2='Contexts';return db[_0xea0f('0x3a')]['destroy']({'where':{'type':_0x1235d2,'resourceId':_0x2c7f5d['id']}})[_0xea0f('0x21')](function(){return _0x199f45;});})['then'](function(){_0x5dbc92[_0xea0f('0x2e')](0xcc)[_0xea0f('0x2f')]();});}};}function handleEntityNotFound(_0x1e0225,_0x488be3){return function(_0x2db8c2){if(!_0x2db8c2){_0x1e0225[_0xea0f('0x2d')](0x194);}return _0x2db8c2;};}function handleError(_0x159284,_0x3fba6d){_0x3fba6d=_0x3fba6d||0x1f4;return function(_0x2f5c1f){logger['error'](_0x2f5c1f[_0xea0f('0x3b')]);if(_0x2f5c1f[_0xea0f('0x3c')]){delete _0x2f5c1f['name'];}_0x159284['status'](_0x3fba6d)[_0xea0f('0x3d')](_0x2f5c1f);};}exports[_0xea0f('0x3e')]=function(_0x22a6f0,_0x189ee5){var _0xa4df71={},_0x42f329={},_0x2f49ae={'count':0x0,'rows':[]};var _0x437e55=_[_0xea0f('0x3f')](db[_0xea0f('0x40')][_0xea0f('0x41')],function(_0x58c8b2){return{'name':_0x58c8b2[_0xea0f('0x42')],'type':_0x58c8b2['type'][_0xea0f('0x43')]};});_0x42f329[_0xea0f('0x44')]=_[_0xea0f('0x3f')](_0x437e55,_0xea0f('0x3c'));_0x42f329[_0xea0f('0x45')]=_[_0xea0f('0x46')](_0x22a6f0[_0xea0f('0x45')]);_0x42f329[_0xea0f('0x47')]=_[_0xea0f('0x48')](_0x42f329[_0xea0f('0x44')],_0x42f329[_0xea0f('0x45')]);_0xa4df71[_0xea0f('0x49')]=_[_0xea0f('0x48')](_0x42f329['model'],qs[_0xea0f('0x4a')](_0x22a6f0[_0xea0f('0x45')][_0xea0f('0x4a')]));_0xa4df71[_0xea0f('0x49')]=_0xa4df71['attributes']['length']?_0xa4df71[_0xea0f('0x49')]:_0x42f329[_0xea0f('0x44')];if(!_0x22a6f0['query'][_0xea0f('0x4b')](_0xea0f('0x4c'))){_0xa4df71['limit']=qs[_0xea0f('0x33')](_0x22a6f0[_0xea0f('0x45')][_0xea0f('0x33')]);_0xa4df71[_0xea0f('0x32')]=qs['offset'](_0x22a6f0['query'][_0xea0f('0x32')]);}_0xa4df71[_0xea0f('0x4d')]=qs[_0xea0f('0x4e')](_0x22a6f0[_0xea0f('0x45')][_0xea0f('0x4e')]);_0xa4df71[_0xea0f('0x4f')]=qs[_0xea0f('0x47')](_[_0xea0f('0x50')](_0x22a6f0[_0xea0f('0x45')],_0x42f329['filters']));if(_0x22a6f0[_0xea0f('0x45')]['filter']){_0xa4df71[_0xea0f('0x4f')]=_['merge'](_0xa4df71[_0xea0f('0x4f')],{'$or':_[_0xea0f('0x3f')](_0x437e55,function(_0x27a535){if(_0x27a535[_0xea0f('0x51')]!=='VIRTUAL'){var _0x1b6747={};_0x1b6747[_0x27a535['name']]={'$like':'%'+_0x22a6f0[_0xea0f('0x45')][_0xea0f('0x52')]+'%'};return _0x1b6747;}})});}_0xa4df71=_[_0xea0f('0x53')]({},_0xa4df71,_0x22a6f0['options']);var _0x171d31={'where':_0xa4df71[_0xea0f('0x4f')]};return db[_0xea0f('0x40')]['count'](_0x171d31)[_0xea0f('0x21')](function(_0x31295f){_0x2f49ae[_0xea0f('0x31')]=_0x31295f;if(_0x22a6f0[_0xea0f('0x45')][_0xea0f('0x54')]){_0xa4df71[_0xea0f('0x55')]=[{'all':!![]}];}return db['VoiceContext'][_0xea0f('0x56')](_0xa4df71);})['then'](function(_0x48dbfb){_0x2f49ae['rows']=_0x48dbfb;return _0x2f49ae;})[_0xea0f('0x21')](respondWithFilteredResult(_0x189ee5,_0xa4df71))[_0xea0f('0x2c')](handleError(_0x189ee5,null));};exports['show']=function(_0x44d313,_0x5a367c){var _0x1ca303={'raw':![],'where':{'id':_0x44d313[_0xea0f('0x57')]['id']}},_0x2c79b3={};_0x2c79b3[_0xea0f('0x44')]=_[_0xea0f('0x46')](db['VoiceContext'][_0xea0f('0x41')]);_0x2c79b3[_0xea0f('0x45')]=_[_0xea0f('0x46')](_0x44d313[_0xea0f('0x45')]);_0x2c79b3['filters']=_[_0xea0f('0x48')](_0x2c79b3[_0xea0f('0x44')],_0x2c79b3[_0xea0f('0x45')]);_0x1ca303[_0xea0f('0x49')]=_[_0xea0f('0x48')](_0x2c79b3[_0xea0f('0x44')],qs['fields'](_0x44d313[_0xea0f('0x45')][_0xea0f('0x4a')]));_0x1ca303[_0xea0f('0x49')]=_0x1ca303[_0xea0f('0x49')][_0xea0f('0x58')]?_0x1ca303[_0xea0f('0x49')]:_0x2c79b3[_0xea0f('0x44')];if(_0x44d313[_0xea0f('0x45')]['includeAll']){_0x1ca303[_0xea0f('0x55')]=[{'all':!![]}];}_0x1ca303=_[_0xea0f('0x53')]({},_0x1ca303,_0x44d313[_0xea0f('0x59')]);return db[_0xea0f('0x40')]['find'](_0x1ca303)[_0xea0f('0x21')](handleEntityNotFound(_0x5a367c,null))[_0xea0f('0x21')](respondWithResult(_0x5a367c,null))[_0xea0f('0x2c')](handleError(_0x5a367c,null));};exports[_0xea0f('0x5a')]=function(_0x3df601,_0x50869d,_0x327fde){var _0x51ea6f;return db['VoiceContext']['create'](_0x3df601[_0xea0f('0x5b')],{'raw':!![]})[_0xea0f('0x21')](function(_0xafdbf9){_0x51ea6f=_0xafdbf9;return db[_0xea0f('0x40')][_0xea0f('0x56')]({'raw':!![]});})[_0xea0f('0x21')](function(_0x362d39){var _0x33f59e=fs[_0xea0f('0x5c')](path[_0xea0f('0x5d')](config[_0xea0f('0x5e')],_0xea0f('0x5f')),_0xea0f('0x60'));var _0x4740e=ejs[_0xea0f('0x61')](_0x33f59e,{'contexts':_0x362d39||[]});fs[_0xea0f('0x62')](_0xea0f('0x63'),_0x4740e);})[_0xea0f('0x21')](function(){return respondWithRpcPromise(_0xea0f('0x64'),_0xea0f('0x5a'),{'module':_0xea0f('0x65')});})[_0xea0f('0x21')](function(){var _0x308895=_0x3df601[_0xea0f('0x66')][_0xea0f('0x39')]({'plain':!![]});if(!_0x308895)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x308895[_0xea0f('0x67')]===_0xea0f('0x66')){var _0x4646fa=_0x51ea6f[_0xea0f('0x39')]({'plain':!![]});return db[_0xea0f('0x68')][_0xea0f('0x69')]({'where':{'name':'Contexts','userProfileId':_0x308895[_0xea0f('0x6a')]},'raw':!![]})[_0xea0f('0x21')](function(_0x167c48){if(_0x167c48&&_0x167c48['autoAssociation']===0x0){return db['UserProfileResource'][_0xea0f('0x5a')]({'name':_0x4646fa[_0xea0f('0x3c')],'resourceId':_0x4646fa['id'],'type':_0x167c48[_0xea0f('0x3c')],'sectionId':_0x167c48['id']},{})['then'](function(){return _0x51ea6f;});}else{return _0x51ea6f;}})[_0xea0f('0x2c')](function(_0x2d83de){logger[_0xea0f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d83de);throw _0x2d83de;});}return _0x51ea6f;})[_0xea0f('0x21')](respondWithResult(_0x50869d,0xc9))['catch'](handleError(_0x50869d,null));};exports['update']=function(_0x1fda33,_0x5c7385,_0x47cde2){var _0x14356c;return db[_0xea0f('0x40')][_0xea0f('0x69')]({'where':{'id':_0x1fda33[_0xea0f('0x57')]['id']}})[_0xea0f('0x21')](handleEntityNotFound(_0x5c7385,null))[_0xea0f('0x21')](saveUpdates(_0x1fda33['body'],null))[_0xea0f('0x21')](function(_0x1291c4){if(_0x1291c4){_0x14356c=_0x1291c4;return db[_0xea0f('0x40')][_0xea0f('0x56')]({'raw':!![]});}})[_0xea0f('0x21')](function(_0x23cbb1){var _0x2e78f7=fs[_0xea0f('0x5c')](path[_0xea0f('0x5d')](config[_0xea0f('0x5e')],_0xea0f('0x5f')),'utf8');var _0x58aad9=ejs[_0xea0f('0x61')](_0x2e78f7,{'contexts':_0x23cbb1||[]});fs[_0xea0f('0x62')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x58aad9);})[_0xea0f('0x21')](function(){return respondWithRpcPromise('Reload','update',{'module':_0xea0f('0x65')});})[_0xea0f('0x21')](function(){return _0x14356c;})[_0xea0f('0x21')](respondWithResult(_0x5c7385,null))[_0xea0f('0x2c')](handleError(_0x5c7385,null));};exports[_0xea0f('0x6b')]=function(_0x42b4b6,_0x152590,_0x4ff014){var _0x172c2b;return db[_0xea0f('0x40')][_0xea0f('0x69')]({'where':{'id':_0x42b4b6['params']['id']}})['then'](handleEntityNotFound(_0x152590,null))['then'](removeEntity(_0x152590,null))['then'](function(){return db[_0xea0f('0x40')]['findAll']({'raw':!![]});})['then'](function(_0x38fda9){var _0x51c7fe=fs[_0xea0f('0x5c')](path[_0xea0f('0x5d')](config[_0xea0f('0x5e')],_0xea0f('0x5f')),_0xea0f('0x60'));var _0xf509c4=ejs[_0xea0f('0x61')](_0x51c7fe,{'contexts':_0x38fda9});fs['writeFileSync'](_0xea0f('0x63'),_0xf509c4);return respondWithRpcPromise(_0xea0f('0x64'),_0xea0f('0x6b'),{'module':_0xea0f('0x65')});})[_0xea0f('0x2c')](handleError(_0x152590,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index b0be029..bd1bef8 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 _0x12ed=['moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0x12ed,0x100));var _0xd12e=function(_0x11179e,_0x1673c6){_0x11179e=_0x11179e-0x0;var _0x2a746b=_0x12ed[_0x11179e];return _0x2a746b;};'use strict';var _=require(_0xd12e('0x0'));var util=require(_0xd12e('0x1'));var logger=require(_0xd12e('0x2'))(_0xd12e('0x3'));var moment=require(_0xd12e('0x4'));var BPromise=require('bluebird');var rp=require(_0xd12e('0x5'));var fs=require('fs');var path=require(_0xd12e('0x6'));var rimraf=require(_0xd12e('0x7'));var config=require(_0xd12e('0x8'));var attributes=require('./voiceContext.attributes');module[_0xd12e('0x9')]=function(_0x5221ae,_0x3e73c1){return _0x5221ae[_0xd12e('0xa')](_0xd12e('0xb'),attributes,{'tableName':_0xd12e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x372f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext','util','../../config/logger','api'];(function(_0x102914,_0x14a7fa){var _0x2dc143=function(_0x33a6b6){while(--_0x33a6b6){_0x102914['push'](_0x102914['shift']());}};_0x2dc143(++_0x14a7fa);}(_0x372f,0x14d));var _0xf372=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x372f[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0xf372('0x0'));var logger=require(_0xf372('0x1'))(_0xf372('0x2'));var moment=require(_0xf372('0x3'));var BPromise=require(_0xf372('0x4'));var rp=require(_0xf372('0x5'));var fs=require('fs');var path=require(_0xf372('0x6'));var rimraf=require(_0xf372('0x7'));var config=require(_0xf372('0x8'));var attributes=require(_0xf372('0x9'));module['exports']=function(_0xacfc31,_0x859772){return _0xacfc31[_0xf372('0xa')](_0xf372('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index f40e71d..4466606 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 _0xb3f6=['client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x38b836,_0x50ba34){var _0x55cbd5=function(_0x34fecc){while(--_0x34fecc){_0x38b836['push'](_0x38b836['shift']());}};_0x55cbd5(++_0x50ba34);}(_0xb3f6,0x198));var _0x6b3f=function(_0x2cd411,_0x128ed6){_0x2cd411=_0x2cd411-0x0;var _0x1d1be7=_0xb3f6[_0x2cd411];return _0x1d1be7;};'use strict';var _=require(_0x6b3f('0x0'));var util=require(_0x6b3f('0x1'));var moment=require(_0x6b3f('0x2'));var BPromise=require(_0x6b3f('0x3'));var rs=require(_0x6b3f('0x4'));var fs=require('fs');var Redis=require(_0x6b3f('0x5'));var db=require(_0x6b3f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b3f('0x7'))('rpc');var config=require(_0x6b3f('0x8'));var jayson=require(_0x6b3f('0x9'));var client=jayson[_0x6b3f('0xa')][_0x6b3f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b5c48,_0xc5f111,_0x326e62){return new BPromise(function(_0x481ae4,_0x5a6c6b){return client[_0x6b3f('0xc')](_0x2b5c48,_0x326e62)[_0x6b3f('0xd')](function(_0x18805a){logger['info'](_0x6b3f('0xe'),_0xc5f111,_0x6b3f('0xf'));logger[_0x6b3f('0x10')](_0x6b3f('0x11'),_0xc5f111,_0x6b3f('0xf'),JSON[_0x6b3f('0x12')](_0x18805a));if(_0x18805a['error']){if(_0x18805a[_0x6b3f('0x13')][_0x6b3f('0x14')]===0x1f4){logger[_0x6b3f('0x13')]('VoiceContext,\x20%s,\x20%s',_0xc5f111,_0x18805a[_0x6b3f('0x13')][_0x6b3f('0x15')]);return _0x5a6c6b(_0x18805a[_0x6b3f('0x13')][_0x6b3f('0x15')]);}logger[_0x6b3f('0x13')]('VoiceContext,\x20%s,\x20%s',_0xc5f111,_0x18805a['error'][_0x6b3f('0x15')]);return _0x481ae4(_0x18805a[_0x6b3f('0x13')]['message']);}else{logger['info'](_0x6b3f('0xe'),_0xc5f111,_0x6b3f('0xf'));_0x481ae4(_0x18805a['result']['message']);}})['catch'](function(_0x668dd3){logger[_0x6b3f('0x13')](_0x6b3f('0xe'),_0xc5f111,_0x668dd3);_0x5a6c6b(_0x668dd3);});});} \ No newline at end of file +var _0xdaec=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3dfbc3,_0x41a601){var _0x53fc9e=function(_0xaeae50){while(--_0xaeae50){_0x3dfbc3['push'](_0x3dfbc3['shift']());}};_0x53fc9e(++_0x41a601);}(_0xdaec,0x14e));var _0xcdae=function(_0x508a3a,_0x351c88){_0x508a3a=_0x508a3a-0x0;var _0xae3151=_0xdaec[_0x508a3a];return _0xae3151;};'use strict';var _=require(_0xcdae('0x0'));var util=require(_0xcdae('0x1'));var moment=require(_0xcdae('0x2'));var BPromise=require(_0xcdae('0x3'));var rs=require(_0xcdae('0x4'));var fs=require('fs');var Redis=require(_0xcdae('0x5'));var db=require(_0xcdae('0x6'))['db'];var utils=require(_0xcdae('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xcdae('0x8'));var jayson=require(_0xcdae('0x9'));var client=jayson[_0xcdae('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a0f11,_0x3b524a,_0x578a03){return new BPromise(function(_0x3ebc30,_0x519b9f){return client[_0xcdae('0xb')](_0x5a0f11,_0x578a03)[_0xcdae('0xc')](function(_0x5e540e){logger[_0xcdae('0xd')](_0xcdae('0xe'),_0x3b524a,_0xcdae('0xf'));logger['debug'](_0xcdae('0x10'),_0x3b524a,'request\x20sent',JSON[_0xcdae('0x11')](_0x5e540e));if(_0x5e540e[_0xcdae('0x12')]){if(_0x5e540e[_0xcdae('0x12')]['code']===0x1f4){logger[_0xcdae('0x12')](_0xcdae('0xe'),_0x3b524a,_0x5e540e['error']['message']);return _0x519b9f(_0x5e540e[_0xcdae('0x12')]['message']);}logger[_0xcdae('0x12')](_0xcdae('0xe'),_0x3b524a,_0x5e540e[_0xcdae('0x12')][_0xcdae('0x13')]);return _0x3ebc30(_0x5e540e[_0xcdae('0x12')]['message']);}else{logger[_0xcdae('0xd')]('VoiceContext,\x20%s,\x20%s',_0x3b524a,'request\x20sent');_0x3ebc30(_0x5e540e['result'][_0xcdae('0x13')]);}})['catch'](function(_0x1303b3){logger[_0xcdae('0x12')](_0xcdae('0xe'),_0x3b524a,_0x1303b3);_0x519b9f(_0x1303b3);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index d200997..4acf7a1 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 _0xbc31=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','index','get','/describe','isAuthenticated','describe','/:id','post','update','delete','destroy','exports','multer'];(function(_0x2074ef,_0x39f781){var _0x25b7f4=function(_0x47cd5a){while(--_0x47cd5a){_0x2074ef['push'](_0x2074ef['shift']());}};_0x25b7f4(++_0x39f781);}(_0xbc31,0x1a3));var _0x1bc3=function(_0x44695c,_0x3ada49){_0x44695c=_0x44695c-0x0;var _0x2e8473=_0xbc31[_0x44695c];return _0x2e8473;};'use strict';var multer=require(_0x1bc3('0x0'));var util=require(_0x1bc3('0x1'));var path=require(_0x1bc3('0x2'));var timeout=require(_0x1bc3('0x3'));var express=require(_0x1bc3('0x4'));var router=express['Router']();var auth=require(_0x1bc3('0x5'));var interaction=require(_0x1bc3('0x6'));var config=require(_0x1bc3('0x7'));var controller=require(_0x1bc3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1bc3('0x9')]);router[_0x1bc3('0xa')](_0x1bc3('0xb'),auth[_0x1bc3('0xc')](),controller[_0x1bc3('0xd')]);router[_0x1bc3('0xa')](_0x1bc3('0xe'),auth[_0x1bc3('0xc')](),controller['show']);router[_0x1bc3('0xf')]('/',auth[_0x1bc3('0xc')](),controller['create']);router['put']('/:id',auth[_0x1bc3('0xc')](),controller[_0x1bc3('0x10')]);router[_0x1bc3('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1bc3('0x12')]);module[_0x1bc3('0x13')]=router; \ No newline at end of file +var _0x172d=['get','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','index','isAuthenticated','describe'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0x172d,0x1ca));var _0xd172=function(_0x4fa88f,_0x540865){_0x4fa88f=_0x4fa88f-0x0;var _0x94ea74=_0x172d[_0x4fa88f];return _0x94ea74;};'use strict';var multer=require(_0xd172('0x0'));var util=require(_0xd172('0x1'));var path=require(_0xd172('0x2'));var timeout=require(_0xd172('0x3'));var express=require(_0xd172('0x4'));var router=express[_0xd172('0x5')]();var auth=require(_0xd172('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd172('0x7')]);router['get']('/describe',auth[_0xd172('0x8')](),controller[_0xd172('0x9')]);router[_0xd172('0xa')](_0xd172('0xb'),auth[_0xd172('0x8')](),controller['show']);router[_0xd172('0xc')]('/',auth['isAuthenticated'](),controller[_0xd172('0xd')]);router[_0xd172('0xe')](_0xd172('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xd172('0xf')](_0xd172('0xb'),auth[_0xd172('0x8')](),controller[_0xd172('0x10')]);module[_0xd172('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index ffe5856..fd4ac35 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 _0x1c95=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0x1c95,0x1ca));var _0x51c9=function(_0x46342c,_0x5b03f2){_0x46342c=_0x46342c-0x0;var _0x5e392a=_0x1c95[_0x46342c];return _0x5e392a;};'use strict';var Sequelize=require(_0x51c9('0x0'));module[_0x51c9('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x51c9('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x51c9('0x2')]},'calleridnum':{'type':Sequelize[_0x51c9('0x2')]},'calleridname':{'type':Sequelize[_0x51c9('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x51c9('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x51c9('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x51c9('0x2')]},'priority':{'type':Sequelize[_0x51c9('0x3')]},'uniqueid':{'type':Sequelize[_0x51c9('0x2')]},'linkedid':{'type':Sequelize[_0x51c9('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x51c9('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x51c9('0x2')]},'destcalleridname':{'type':Sequelize[_0x51c9('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x51c9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x51c9('0x2')]},'destlanguage':{'type':Sequelize[_0x51c9('0x2')]},'destaccountcode':{'type':Sequelize[_0x51c9('0x2')]},'destcontext':{'type':Sequelize[_0x51c9('0x2')]},'destexten':{'type':Sequelize[_0x51c9('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x51c9('0x2')]},'destlinkedid':{'type':Sequelize[_0x51c9('0x2')]},'dialstring':{'type':Sequelize[_0x51c9('0x2')]},'dialstatus':{'type':Sequelize[_0x51c9('0x2')]},'starttime':{'type':Sequelize[_0x51c9('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x51c9('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x51c9('0x5')},'routeId':{'type':Sequelize[_0x51c9('0x3')]},'duration':{'type':Sequelize[_0x51c9('0x3')]},'holdtime':{'type':Sequelize[_0x51c9('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xaf95=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xaf95,0x99));var _0x5af9=function(_0xb4f705,_0x39327b){_0xb4f705=_0xb4f705-0x0;var _0x48e5b6=_0xaf95[_0xb4f705];return _0x48e5b6;};'use strict';var Sequelize=require(_0x5af9('0x0'));module[_0x5af9('0x1')]={'privilege':{'type':Sequelize[_0x5af9('0x2')]},'channel':{'type':Sequelize[_0x5af9('0x2')]},'channelstate':{'type':Sequelize[_0x5af9('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5af9('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5af9('0x2')]},'language':{'type':Sequelize[_0x5af9('0x2')]},'accountcode':{'type':Sequelize[_0x5af9('0x2')]},'context':{'type':Sequelize[_0x5af9('0x2')]},'exten':{'type':Sequelize[_0x5af9('0x2')]},'priority':{'type':Sequelize[_0x5af9('0x3')]},'uniqueid':{'type':Sequelize[_0x5af9('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x5af9('0x2')]},'destchannelstate':{'type':Sequelize[_0x5af9('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5af9('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5af9('0x2')]},'destcalleridname':{'type':Sequelize[_0x5af9('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x5af9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x5af9('0x2')]},'destlanguage':{'type':Sequelize[_0x5af9('0x2')]},'destaccountcode':{'type':Sequelize[_0x5af9('0x2')]},'destcontext':{'type':Sequelize[_0x5af9('0x2')]},'destexten':{'type':Sequelize[_0x5af9('0x2')]},'destpriority':{'type':Sequelize[_0x5af9('0x3')]},'destuniqueid':{'type':Sequelize[_0x5af9('0x2')]},'destlinkedid':{'type':Sequelize[_0x5af9('0x2')]},'dialstring':{'type':Sequelize[_0x5af9('0x2')]},'dialstatus':{'type':Sequelize[_0x5af9('0x2')]},'starttime':{'type':Sequelize[_0x5af9('0x4')]},'answertime':{'type':Sequelize[_0x5af9('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x5af9('0x2')],'comment':_0x5af9('0x5')},'routeId':{'type':Sequelize[_0x5af9('0x3')]},'duration':{'type':Sequelize[_0x5af9('0x3')]},'holdtime':{'type':Sequelize[_0x5af9('0x3')]},'billableseconds':{'type':Sequelize[_0x5af9('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 7b284b4..9c3cc77 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 _0x3c30=['../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','type','key','query','keys','filters','intersection','model','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','options','VoiceDialReport','includeAll','include','findAll','rows','catch','rawAttributes','fields','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0x3c30,0x11a));var _0x03c3=function(_0x262b30,_0x3a53c9){_0x262b30=_0x262b30-0x0;var _0x401e8b=_0x3c30[_0x262b30];return _0x401e8b;};'use strict';var pdf=require(_0x03c3('0x0'));var emlformat=require(_0x03c3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x03c3('0x2'));var jsonpatch=require(_0x03c3('0x3'));var rp=require('request-promise');var moment=require(_0x03c3('0x4'));var BPromise=require(_0x03c3('0x5'));var Mustache=require(_0x03c3('0x6'));var util=require(_0x03c3('0x7'));var path=require(_0x03c3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x03c3('0x9'));var fs=require('fs');var _=require(_0x03c3('0xa'));var squel=require(_0x03c3('0xb'));var crypto=require(_0x03c3('0xc'));var jsforce=require(_0x03c3('0xd'));var deskjs=require(_0x03c3('0xe'));var toCsv=require(_0x03c3('0xf'));var querystring=require(_0x03c3('0x10'));var Papa=require(_0x03c3('0x11'));var Redis=require(_0x03c3('0x12'));var authService=require(_0x03c3('0x13'));var qs=require(_0x03c3('0x14'));var as=require(_0x03c3('0x15'));var hardwareService=require(_0x03c3('0x16'));var logger=require(_0x03c3('0x17'))(_0x03c3('0x18'));var utils=require(_0x03c3('0x19'));var config=require(_0x03c3('0x1a'));var db=require(_0x03c3('0x1b'))['db'];function respondWithStatusCode(_0x2445c2,_0x317612){_0x317612=_0x317612||0xcc;return function(_0x18c83d){if(_0x18c83d){return _0x2445c2[_0x03c3('0x1c')](_0x317612);}return _0x2445c2['status'](_0x317612)[_0x03c3('0x1d')]();};}function respondWithResult(_0x25fb12,_0x5401da){_0x5401da=_0x5401da||0xc8;return function(_0x5861fd){if(_0x5861fd){return _0x25fb12[_0x03c3('0x1e')](_0x5401da)['json'](_0x5861fd);}};}function respondWithFilteredResult(_0x100dc0,_0x36a5c5){return function(_0x4dae35){if(_0x4dae35){var _0x12db39=_0x4dae35[_0x03c3('0x1f')],_0x145297=_0x36a5c5['offset'],_0x4521c2=_0x36a5c5[_0x03c3('0x20')]+_0x36a5c5[_0x03c3('0x21')],_0x286a3b;if(_0x4521c2>=_0x12db39){_0x4521c2=_0x12db39;_0x286a3b=0xc8;}else{_0x286a3b=0xce;}_0x100dc0['status'](_0x286a3b);return _0x100dc0[_0x03c3('0x22')]('Content-Range',_0x145297+'-'+_0x4521c2+'/'+_0x12db39)[_0x03c3('0x23')](_0x4dae35);}return null;};}function patchUpdates(_0x28a8bb){return function(_0x156348){try{jsonpatch[_0x03c3('0x24')](_0x156348,_0x28a8bb,!![]);}catch(_0x2d469e){return BPromise[_0x03c3('0x25')](_0x2d469e);}return _0x156348[_0x03c3('0x26')]();};}function saveUpdates(_0x5cc2b2,_0x2065c8){return function(_0x52a374){if(_0x52a374){return _0x52a374[_0x03c3('0x27')](_0x5cc2b2)[_0x03c3('0x28')](function(_0xa57364){return _0xa57364;});}return null;};}function removeEntity(_0x4c9734,_0x3ea91a){return function(_0x5d2979){if(_0x5d2979){return _0x5d2979[_0x03c3('0x29')]()['then'](function(){_0x4c9734[_0x03c3('0x1e')](0xcc)[_0x03c3('0x1d')]();});}};}function handleEntityNotFound(_0x5ee853,_0x2d8a6f){return function(_0x354599){if(!_0x354599){_0x5ee853['sendStatus'](0x194);}return _0x354599;};}function handleError(_0x1c3afc,_0x512bbd){_0x512bbd=_0x512bbd||0x1f4;return function(_0x2521f5){logger[_0x03c3('0x2a')](_0x2521f5[_0x03c3('0x2b')]);if(_0x2521f5[_0x03c3('0x2c')]){delete _0x2521f5['name'];}_0x1c3afc[_0x03c3('0x1e')](_0x512bbd)[_0x03c3('0x2d')](_0x2521f5);};}exports[_0x03c3('0x2e')]=function(_0x27e83b,_0x17d7c6){var _0x4f2af6={},_0x20abe7={},_0x48a710={'count':0x0,'rows':[]};var _0x30c41b=_[_0x03c3('0x2f')](db['VoiceDialReport']['rawAttributes'],function(_0xc9ab19){return{'name':_0xc9ab19['fieldName'],'type':_0xc9ab19[_0x03c3('0x30')][_0x03c3('0x31')]};});_0x20abe7['model']=_[_0x03c3('0x2f')](_0x30c41b,_0x03c3('0x2c'));_0x20abe7[_0x03c3('0x32')]=_[_0x03c3('0x33')](_0x27e83b[_0x03c3('0x32')]);_0x20abe7[_0x03c3('0x34')]=_[_0x03c3('0x35')](_0x20abe7[_0x03c3('0x36')],_0x20abe7[_0x03c3('0x32')]);_0x4f2af6['attributes']=_[_0x03c3('0x35')](_0x20abe7[_0x03c3('0x36')],qs['fields'](_0x27e83b[_0x03c3('0x32')]['fields']));_0x4f2af6[_0x03c3('0x37')]=_0x4f2af6[_0x03c3('0x37')][_0x03c3('0x38')]?_0x4f2af6[_0x03c3('0x37')]:_0x20abe7[_0x03c3('0x36')];if(!_0x27e83b[_0x03c3('0x32')]['hasOwnProperty'](_0x03c3('0x39'))){_0x4f2af6[_0x03c3('0x21')]=qs[_0x03c3('0x21')](_0x27e83b[_0x03c3('0x32')][_0x03c3('0x21')]);_0x4f2af6[_0x03c3('0x20')]=qs[_0x03c3('0x20')](_0x27e83b[_0x03c3('0x32')]['offset']);}_0x4f2af6['order']=qs['sort'](_0x27e83b[_0x03c3('0x32')][_0x03c3('0x3a')]);_0x4f2af6[_0x03c3('0x3b')]=qs[_0x03c3('0x34')](_[_0x03c3('0x3c')](_0x27e83b[_0x03c3('0x32')],_0x20abe7[_0x03c3('0x34')]));if(_0x27e83b['query']['filter']){_0x4f2af6[_0x03c3('0x3b')]=_[_0x03c3('0x3d')](_0x4f2af6['where'],{'$or':_['map'](_0x30c41b,function(_0x8b6c59){if(_0x8b6c59[_0x03c3('0x30')]!==_0x03c3('0x3e')){var _0x29cec9={};_0x29cec9[_0x8b6c59[_0x03c3('0x2c')]]={'$like':'%'+_0x27e83b[_0x03c3('0x32')]['filter']+'%'};return _0x29cec9;}})});}_0x4f2af6=_[_0x03c3('0x3d')]({},_0x4f2af6,_0x27e83b[_0x03c3('0x3f')]);var _0x55dd66={'where':_0x4f2af6[_0x03c3('0x3b')]};return db[_0x03c3('0x40')][_0x03c3('0x1f')](_0x55dd66)[_0x03c3('0x28')](function(_0x16116e){_0x48a710[_0x03c3('0x1f')]=_0x16116e;if(_0x27e83b[_0x03c3('0x32')][_0x03c3('0x41')]){_0x4f2af6[_0x03c3('0x42')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x03c3('0x43')](_0x4f2af6);})[_0x03c3('0x28')](function(_0x68dfb5){_0x48a710[_0x03c3('0x44')]=_0x68dfb5;return _0x48a710;})[_0x03c3('0x28')](respondWithFilteredResult(_0x17d7c6,_0x4f2af6))[_0x03c3('0x45')](handleError(_0x17d7c6,null));};exports['show']=function(_0x3f4eb7,_0xa0d8c3){var _0x2aec3f={'raw':!![],'where':{'id':_0x3f4eb7['params']['id']}},_0xa2b67d={};_0xa2b67d[_0x03c3('0x36')]=_[_0x03c3('0x33')](db[_0x03c3('0x40')][_0x03c3('0x46')]);_0xa2b67d[_0x03c3('0x32')]=_[_0x03c3('0x33')](_0x3f4eb7[_0x03c3('0x32')]);_0xa2b67d[_0x03c3('0x34')]=_[_0x03c3('0x35')](_0xa2b67d[_0x03c3('0x36')],_0xa2b67d[_0x03c3('0x32')]);_0x2aec3f[_0x03c3('0x37')]=_['intersection'](_0xa2b67d['model'],qs[_0x03c3('0x47')](_0x3f4eb7[_0x03c3('0x32')][_0x03c3('0x47')]));_0x2aec3f[_0x03c3('0x37')]=_0x2aec3f[_0x03c3('0x37')][_0x03c3('0x38')]?_0x2aec3f[_0x03c3('0x37')]:_0xa2b67d[_0x03c3('0x36')];if(_0x3f4eb7['query'][_0x03c3('0x41')]){_0x2aec3f[_0x03c3('0x42')]=[{'all':!![]}];}_0x2aec3f=_[_0x03c3('0x3d')]({},_0x2aec3f,_0x3f4eb7['options']);return db[_0x03c3('0x40')][_0x03c3('0x48')](_0x2aec3f)[_0x03c3('0x28')](handleEntityNotFound(_0xa0d8c3,null))['then'](respondWithResult(_0xa0d8c3,null))[_0x03c3('0x45')](handleError(_0xa0d8c3,null));};exports['create']=function(_0xa8035b,_0x12ba2d){return db['VoiceDialReport'][_0x03c3('0x49')](_0xa8035b['body'],{})['then'](respondWithResult(_0x12ba2d,0xc9))[_0x03c3('0x45')](handleError(_0x12ba2d,null));};exports[_0x03c3('0x27')]=function(_0x15649a,_0x124e59){if(_0x15649a[_0x03c3('0x4a')]['id']){delete _0x15649a[_0x03c3('0x4a')]['id'];}return db['VoiceDialReport'][_0x03c3('0x48')]({'where':{'id':_0x15649a['params']['id']}})['then'](handleEntityNotFound(_0x124e59,null))[_0x03c3('0x28')](saveUpdates(_0x15649a[_0x03c3('0x4a')],null))[_0x03c3('0x28')](respondWithResult(_0x124e59,null))[_0x03c3('0x45')](handleError(_0x124e59,null));};exports[_0x03c3('0x29')]=function(_0x51ab39,_0x3e324a){return db[_0x03c3('0x40')][_0x03c3('0x48')]({'where':{'id':_0x51ab39[_0x03c3('0x4b')]['id']}})[_0x03c3('0x28')](handleEntityNotFound(_0x3e324a,null))[_0x03c3('0x28')](removeEntity(_0x3e324a,null))['catch'](handleError(_0x3e324a,null));};exports[_0x03c3('0x4c')]=function(_0x3758bf,_0x271c2d){return db['VoiceDialReport']['describe']()[_0x03c3('0x28')](respondWithResult(_0x271c2d,null))[_0x03c3('0x45')](handleError(_0x271c2d,null));}; \ No newline at end of file +var _0x0135=['path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','VoiceDialReport','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','options','include','findAll','show','rawAttributes','includeAll','merge','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x169f8e,_0x2bf78e){var _0x29449f=function(_0x1ec0bb){while(--_0x1ec0bb){_0x169f8e['push'](_0x169f8e['shift']());}};_0x29449f(++_0x2bf78e);}(_0x0135,0x89));var _0x5013=function(_0x19b3e1,_0x441aa8){_0x19b3e1=_0x19b3e1-0x0;var _0x29b654=_0x0135[_0x19b3e1];return _0x29b654;};'use strict';var pdf=require(_0x5013('0x0'));var emlformat=require(_0x5013('0x1'));var rimraf=require(_0x5013('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5013('0x3'));var rp=require(_0x5013('0x4'));var moment=require(_0x5013('0x5'));var BPromise=require(_0x5013('0x6'));var Mustache=require(_0x5013('0x7'));var util=require(_0x5013('0x8'));var path=require(_0x5013('0x9'));var sox=require(_0x5013('0xa'));var csv=require(_0x5013('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5013('0xc'));var squel=require(_0x5013('0xd'));var crypto=require('crypto');var jsforce=require(_0x5013('0xe'));var deskjs=require(_0x5013('0xf'));var toCsv=require(_0x5013('0xb'));var querystring=require(_0x5013('0x10'));var Papa=require('papaparse');var Redis=require(_0x5013('0x11'));var authService=require(_0x5013('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5013('0x13'));var utils=require(_0x5013('0x14'));var config=require(_0x5013('0x15'));var db=require(_0x5013('0x16'))['db'];function respondWithStatusCode(_0x597e81,_0x2b1b74){_0x2b1b74=_0x2b1b74||0xcc;return function(_0x97d342){if(_0x97d342){return _0x597e81[_0x5013('0x17')](_0x2b1b74);}return _0x597e81['status'](_0x2b1b74)[_0x5013('0x18')]();};}function respondWithResult(_0x46656e,_0x3e9755){_0x3e9755=_0x3e9755||0xc8;return function(_0x1ee245){if(_0x1ee245){return _0x46656e[_0x5013('0x19')](_0x3e9755)[_0x5013('0x1a')](_0x1ee245);}};}function respondWithFilteredResult(_0xb93327,_0x115567){return function(_0x36e041){if(_0x36e041){var _0x3cacbd=_0x36e041[_0x5013('0x1b')],_0x88a9f6=_0x115567[_0x5013('0x1c')],_0x535333=_0x115567[_0x5013('0x1c')]+_0x115567[_0x5013('0x1d')],_0x52ab5e;if(_0x535333>=_0x3cacbd){_0x535333=_0x3cacbd;_0x52ab5e=0xc8;}else{_0x52ab5e=0xce;}_0xb93327[_0x5013('0x19')](_0x52ab5e);return _0xb93327[_0x5013('0x1e')](_0x5013('0x1f'),_0x88a9f6+'-'+_0x535333+'/'+_0x3cacbd)['json'](_0x36e041);}return null;};}function patchUpdates(_0x3267b7){return function(_0x3bf38b){try{jsonpatch['apply'](_0x3bf38b,_0x3267b7,!![]);}catch(_0x421a6f){return BPromise[_0x5013('0x20')](_0x421a6f);}return _0x3bf38b[_0x5013('0x21')]();};}function saveUpdates(_0x485e8d,_0x3b7d3d){return function(_0x5dd122){if(_0x5dd122){return _0x5dd122['update'](_0x485e8d)[_0x5013('0x22')](function(_0xb76afc){return _0xb76afc;});}return null;};}function removeEntity(_0x1d0c40,_0x41044b){return function(_0x2105f8){if(_0x2105f8){return _0x2105f8[_0x5013('0x23')]()[_0x5013('0x22')](function(){_0x1d0c40[_0x5013('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42fe12,_0x226443){return function(_0x5541ff){if(!_0x5541ff){_0x42fe12[_0x5013('0x17')](0x194);}return _0x5541ff;};}function handleError(_0x18f6c2,_0x338ba4){_0x338ba4=_0x338ba4||0x1f4;return function(_0x54b2ae){logger[_0x5013('0x24')](_0x54b2ae[_0x5013('0x25')]);if(_0x54b2ae[_0x5013('0x26')]){delete _0x54b2ae[_0x5013('0x26')];}_0x18f6c2['status'](_0x338ba4)[_0x5013('0x27')](_0x54b2ae);};}exports[_0x5013('0x28')]=function(_0x3291e1,_0x4d3513){var _0x2a8e68={},_0x350b62={},_0x228e72={'count':0x0,'rows':[]};var _0x2218c2=_['map'](db[_0x5013('0x29')]['rawAttributes'],function(_0x46b08d){return{'name':_0x46b08d[_0x5013('0x2a')],'type':_0x46b08d[_0x5013('0x2b')][_0x5013('0x2c')]};});_0x350b62[_0x5013('0x2d')]=_[_0x5013('0x2e')](_0x2218c2,_0x5013('0x26'));_0x350b62[_0x5013('0x2f')]=_[_0x5013('0x30')](_0x3291e1[_0x5013('0x2f')]);_0x350b62['filters']=_[_0x5013('0x31')](_0x350b62[_0x5013('0x2d')],_0x350b62[_0x5013('0x2f')]);_0x2a8e68['attributes']=_[_0x5013('0x31')](_0x350b62[_0x5013('0x2d')],qs[_0x5013('0x32')](_0x3291e1[_0x5013('0x2f')][_0x5013('0x32')]));_0x2a8e68[_0x5013('0x33')]=_0x2a8e68['attributes'][_0x5013('0x34')]?_0x2a8e68['attributes']:_0x350b62[_0x5013('0x2d')];if(!_0x3291e1[_0x5013('0x2f')][_0x5013('0x35')]('nolimit')){_0x2a8e68[_0x5013('0x1d')]=qs['limit'](_0x3291e1['query'][_0x5013('0x1d')]);_0x2a8e68[_0x5013('0x1c')]=qs[_0x5013('0x1c')](_0x3291e1['query'][_0x5013('0x1c')]);}_0x2a8e68['order']=qs[_0x5013('0x36')](_0x3291e1[_0x5013('0x2f')][_0x5013('0x36')]);_0x2a8e68['where']=qs[_0x5013('0x37')](_[_0x5013('0x38')](_0x3291e1[_0x5013('0x2f')],_0x350b62[_0x5013('0x37')]));if(_0x3291e1['query'][_0x5013('0x39')]){_0x2a8e68[_0x5013('0x3a')]=_['merge'](_0x2a8e68[_0x5013('0x3a')],{'$or':_[_0x5013('0x2e')](_0x2218c2,function(_0x149cf1){if(_0x149cf1[_0x5013('0x2b')]!==_0x5013('0x3b')){var _0x284ec6={};_0x284ec6[_0x149cf1['name']]={'$like':'%'+_0x3291e1[_0x5013('0x2f')][_0x5013('0x39')]+'%'};return _0x284ec6;}})});}_0x2a8e68=_['merge']({},_0x2a8e68,_0x3291e1[_0x5013('0x3c')]);var _0x3a8b8a={'where':_0x2a8e68[_0x5013('0x3a')]};return db['VoiceDialReport'][_0x5013('0x1b')](_0x3a8b8a)[_0x5013('0x22')](function(_0x59517b){_0x228e72[_0x5013('0x1b')]=_0x59517b;if(_0x3291e1[_0x5013('0x2f')]['includeAll']){_0x2a8e68[_0x5013('0x3d')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x5013('0x3e')](_0x2a8e68);})['then'](function(_0x2eb760){_0x228e72['rows']=_0x2eb760;return _0x228e72;})[_0x5013('0x22')](respondWithFilteredResult(_0x4d3513,_0x2a8e68))['catch'](handleError(_0x4d3513,null));};exports[_0x5013('0x3f')]=function(_0x523172,_0x35a555){var _0x4d7569={'raw':!![],'where':{'id':_0x523172['params']['id']}},_0x389b7b={};_0x389b7b[_0x5013('0x2d')]=_[_0x5013('0x30')](db[_0x5013('0x29')][_0x5013('0x40')]);_0x389b7b[_0x5013('0x2f')]=_[_0x5013('0x30')](_0x523172[_0x5013('0x2f')]);_0x389b7b[_0x5013('0x37')]=_[_0x5013('0x31')](_0x389b7b[_0x5013('0x2d')],_0x389b7b[_0x5013('0x2f')]);_0x4d7569['attributes']=_[_0x5013('0x31')](_0x389b7b[_0x5013('0x2d')],qs[_0x5013('0x32')](_0x523172[_0x5013('0x2f')][_0x5013('0x32')]));_0x4d7569[_0x5013('0x33')]=_0x4d7569['attributes']['length']?_0x4d7569['attributes']:_0x389b7b['model'];if(_0x523172[_0x5013('0x2f')][_0x5013('0x41')]){_0x4d7569['include']=[{'all':!![]}];}_0x4d7569=_[_0x5013('0x42')]({},_0x4d7569,_0x523172[_0x5013('0x3c')]);return db[_0x5013('0x29')][_0x5013('0x43')](_0x4d7569)[_0x5013('0x22')](handleEntityNotFound(_0x35a555,null))[_0x5013('0x22')](respondWithResult(_0x35a555,null))[_0x5013('0x44')](handleError(_0x35a555,null));};exports[_0x5013('0x45')]=function(_0x29ffcf,_0x5a34ec){return db[_0x5013('0x29')][_0x5013('0x45')](_0x29ffcf[_0x5013('0x46')],{})[_0x5013('0x22')](respondWithResult(_0x5a34ec,0xc9))[_0x5013('0x44')](handleError(_0x5a34ec,null));};exports['update']=function(_0xec1136,_0x5c8075){if(_0xec1136['body']['id']){delete _0xec1136[_0x5013('0x46')]['id'];}return db[_0x5013('0x29')]['find']({'where':{'id':_0xec1136[_0x5013('0x47')]['id']}})[_0x5013('0x22')](handleEntityNotFound(_0x5c8075,null))[_0x5013('0x22')](saveUpdates(_0xec1136[_0x5013('0x46')],null))['then'](respondWithResult(_0x5c8075,null))[_0x5013('0x44')](handleError(_0x5c8075,null));};exports[_0x5013('0x23')]=function(_0x314f02,_0x1a93f4){return db[_0x5013('0x29')][_0x5013('0x43')]({'where':{'id':_0x314f02[_0x5013('0x47')]['id']}})[_0x5013('0x22')](handleEntityNotFound(_0x1a93f4,null))[_0x5013('0x22')](removeEntity(_0x1a93f4,null))[_0x5013('0x44')](handleError(_0x1a93f4,null));};exports['describe']=function(_0x2e6298,_0x35a09f){return db[_0x5013('0x29')][_0x5013('0x48')]()[_0x5013('0x22')](respondWithResult(_0x35a09f,null))['catch'](handleError(_0x35a09f,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 828964e..95ab569 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 _0x3b23=['api','moment','bluebird','request-promise','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','lodash','util'];(function(_0x1a3fdf,_0x25b2b2){var _0x5468d8=function(_0x227a89){while(--_0x227a89){_0x1a3fdf['push'](_0x1a3fdf['shift']());}};_0x5468d8(++_0x25b2b2);}(_0x3b23,0x1a2));var _0x33b2=function(_0x273ee4,_0x502194){_0x273ee4=_0x273ee4-0x0;var _0x107912=_0x3b23[_0x273ee4];return _0x107912;};'use strict';var _=require(_0x33b2('0x0'));var util=require(_0x33b2('0x1'));var logger=require('../../config/logger')(_0x33b2('0x2'));var moment=require(_0x33b2('0x3'));var BPromise=require(_0x33b2('0x4'));var rp=require(_0x33b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x33b2('0x6'));var attributes=require(_0x33b2('0x7'));module['exports']=function(_0x5590e2,_0x22c4f5){return _0x5590e2[_0x33b2('0x8')](_0x33b2('0x9'),attributes,{'tableName':_0x33b2('0xa'),'paranoid':![],'indexes':[{'fields':[_0x33b2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6060=['define','VoiceDialReport','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x204861,_0x31f177){var _0x1d27ad=function(_0x3a8837){while(--_0x3a8837){_0x204861['push'](_0x204861['shift']());}};_0x1d27ad(++_0x31f177);}(_0x6060,0x16b));var _0x0606=function(_0x3e41a6,_0xe86451){_0x3e41a6=_0x3e41a6-0x0;var _0x221e4e=_0x6060[_0x3e41a6];return _0x221e4e;};'use strict';var _=require(_0x0606('0x0'));var util=require('util');var logger=require(_0x0606('0x1'))('api');var moment=require(_0x0606('0x2'));var BPromise=require(_0x0606('0x3'));var rp=require(_0x0606('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0606('0x5'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0xa408d4,_0x311475){return _0xa408d4[_0x0606('0x6')](_0x0606('0x7'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x0606('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 7318461..0a27387 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 _0x25b5=['UpdateVoiceDialReport','update','body','where','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','stringify','error','code','message','VoiceDialReport,\x20%s,\x20%s','result','catch','CreateVoiceDialReport','VoiceDialReport','options','raw','debug'];(function(_0x395116,_0x36dfda){var _0xfb18ed=function(_0x515292){while(--_0x515292){_0x395116['push'](_0x395116['shift']());}};_0xfb18ed(++_0x36dfda);}(_0x25b5,0x198));var _0x525b=function(_0xb38246,_0x5f1357){_0xb38246=_0xb38246-0x0;var _0x3a0b0b=_0x25b5[_0xb38246];return _0x3a0b0b;};'use strict';var _=require(_0x525b('0x0'));var util=require(_0x525b('0x1'));var moment=require(_0x525b('0x2'));var BPromise=require(_0x525b('0x3'));var rs=require(_0x525b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x525b('0x5'))['db'];var utils=require(_0x525b('0x6'));var logger=require(_0x525b('0x7'))(_0x525b('0x8'));var config=require(_0x525b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x525b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x511ef5,_0x4d6f5b,_0x17b475){return new BPromise(function(_0x3ef6f1,_0x1656ac){return client['request'](_0x511ef5,_0x17b475)[_0x525b('0xb')](function(_0x1b2d14){logger[_0x525b('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x4d6f5b,'request\x20sent');logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x4d6f5b,_0x525b('0xd'),JSON[_0x525b('0xe')](_0x1b2d14));if(_0x1b2d14['error']){if(_0x1b2d14[_0x525b('0xf')][_0x525b('0x10')]===0x1f4){logger[_0x525b('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x4d6f5b,_0x1b2d14['error'][_0x525b('0x11')]);return _0x1656ac(_0x1b2d14[_0x525b('0xf')][_0x525b('0x11')]);}logger[_0x525b('0xf')](_0x525b('0x12'),_0x4d6f5b,_0x1b2d14[_0x525b('0xf')][_0x525b('0x11')]);return _0x3ef6f1(_0x1b2d14[_0x525b('0xf')][_0x525b('0x11')]);}else{logger[_0x525b('0xc')](_0x525b('0x12'),_0x4d6f5b,'request\x20sent');_0x3ef6f1(_0x1b2d14[_0x525b('0x13')][_0x525b('0x11')]);}})[_0x525b('0x14')](function(_0x4d523f){logger['error'](_0x525b('0x12'),_0x4d6f5b,_0x4d523f);_0x1656ac(_0x4d523f);});});}exports[_0x525b('0x15')]=function(_0x1cc987){var _0x4c4d33=this;return new Promise(function(_0x19eabd,_0x206492){return db[_0x525b('0x16')]['create'](_0x1cc987['body'],{'raw':_0x1cc987['options']?_0x1cc987[_0x525b('0x17')][_0x525b('0x18')]===undefined?!![]:![]:!![]})[_0x525b('0xb')](function(_0xe41f69){logger[_0x525b('0xc')](_0x525b('0x15'),_0x1cc987);logger[_0x525b('0x19')](_0x525b('0x15'),_0x1cc987,JSON[_0x525b('0xe')](_0xe41f69));_0x19eabd(_0xe41f69);})['catch'](function(_0x22b7f3){logger[_0x525b('0xf')](_0x525b('0x15'),_0x22b7f3['message'],_0x1cc987);_0x206492(_0x4c4d33[_0x525b('0xf')](0x1f4,_0x22b7f3[_0x525b('0x11')]));});});};exports[_0x525b('0x1a')]=function(_0x4bfd2b){var _0x497ca8=this;return new Promise(function(_0x44147b,_0x9858df){return db[_0x525b('0x16')][_0x525b('0x1b')](_0x4bfd2b[_0x525b('0x1c')],{'raw':_0x4bfd2b[_0x525b('0x17')]?_0x4bfd2b[_0x525b('0x17')][_0x525b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bfd2b[_0x525b('0x17')]?_0x4bfd2b[_0x525b('0x17')][_0x525b('0x1d')]||null:null,'attributes':_0x4bfd2b[_0x525b('0x17')]?_0x4bfd2b['options']['attributes']||null:null,'limit':_0x4bfd2b[_0x525b('0x17')]?_0x4bfd2b['options'][_0x525b('0x1e')]||null:null})[_0x525b('0xb')](function(_0x126477){logger['info']('UpdateVoiceDialReport',_0x4bfd2b);logger[_0x525b('0x19')](_0x525b('0x1a'),_0x4bfd2b,JSON[_0x525b('0xe')](_0x126477));_0x44147b(_0x126477);})[_0x525b('0x14')](function(_0x268fb2){logger['error'](_0x525b('0x1a'),_0x268fb2[_0x525b('0x11')],_0x4bfd2b);_0x9858df(_0x497ca8[_0x525b('0xf')](0x1f4,_0x268fb2['message']));});});}; \ No newline at end of file +var _0x02ef=['result','catch','CreateVoiceDialReport','create','body','options','raw','debug','VoiceDialReport','update','where','attributes','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x23a5aa,_0x3b85de){var _0x4a60da=function(_0x5bff7e){while(--_0x5bff7e){_0x23a5aa['push'](_0x23a5aa['shift']());}};_0x4a60da(++_0x3b85de);}(_0x02ef,0x11a));var _0xf02e=function(_0x1c7fc2,_0x5eff2b){_0x1c7fc2=_0x1c7fc2-0x0;var _0x5d94da=_0x02ef[_0x1c7fc2];return _0x5d94da;};'use strict';var _=require(_0xf02e('0x0'));var util=require('util');var moment=require(_0xf02e('0x1'));var BPromise=require('bluebird');var rs=require(_0xf02e('0x2'));var fs=require('fs');var Redis=require(_0xf02e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf02e('0x4'));var logger=require(_0xf02e('0x5'))(_0xf02e('0x6'));var config=require(_0xf02e('0x7'));var jayson=require(_0xf02e('0x8'));var client=jayson['client'][_0xf02e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x411cbe,_0x13ef2f,_0x4682a6){return new BPromise(function(_0x2b79b3,_0x37abc8){return client[_0xf02e('0xa')](_0x411cbe,_0x4682a6)[_0xf02e('0xb')](function(_0x22a384){logger[_0xf02e('0xc')](_0xf02e('0xd'),_0x13ef2f,_0xf02e('0xe'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x13ef2f,_0xf02e('0xe'),JSON[_0xf02e('0xf')](_0x22a384));if(_0x22a384['error']){if(_0x22a384['error']['code']===0x1f4){logger[_0xf02e('0x10')](_0xf02e('0xd'),_0x13ef2f,_0x22a384[_0xf02e('0x10')][_0xf02e('0x11')]);return _0x37abc8(_0x22a384[_0xf02e('0x10')][_0xf02e('0x11')]);}logger['error'](_0xf02e('0xd'),_0x13ef2f,_0x22a384['error'][_0xf02e('0x11')]);return _0x2b79b3(_0x22a384[_0xf02e('0x10')]['message']);}else{logger[_0xf02e('0xc')](_0xf02e('0xd'),_0x13ef2f,'request\x20sent');_0x2b79b3(_0x22a384[_0xf02e('0x12')]['message']);}})[_0xf02e('0x13')](function(_0x19c7b9){logger[_0xf02e('0x10')](_0xf02e('0xd'),_0x13ef2f,_0x19c7b9);_0x37abc8(_0x19c7b9);});});}exports[_0xf02e('0x14')]=function(_0x5e7f85){var _0x1d670c=this;return new Promise(function(_0x280af9,_0xc310e1){return db['VoiceDialReport'][_0xf02e('0x15')](_0x5e7f85[_0xf02e('0x16')],{'raw':_0x5e7f85['options']?_0x5e7f85[_0xf02e('0x17')][_0xf02e('0x18')]===undefined?!![]:![]:!![]})[_0xf02e('0xb')](function(_0x3161fd){logger['info'](_0xf02e('0x14'),_0x5e7f85);logger[_0xf02e('0x19')]('CreateVoiceDialReport',_0x5e7f85,JSON[_0xf02e('0xf')](_0x3161fd));_0x280af9(_0x3161fd);})[_0xf02e('0x13')](function(_0x3c8ef8){logger['error'](_0xf02e('0x14'),_0x3c8ef8[_0xf02e('0x11')],_0x5e7f85);_0xc310e1(_0x1d670c['error'](0x1f4,_0x3c8ef8['message']));});});};exports['UpdateVoiceDialReport']=function(_0x40e168){var _0x8d3b44=this;return new Promise(function(_0x2890ab,_0x5f0c71){return db[_0xf02e('0x1a')][_0xf02e('0x1b')](_0x40e168['body'],{'raw':_0x40e168[_0xf02e('0x17')]?_0x40e168[_0xf02e('0x17')][_0xf02e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40e168[_0xf02e('0x17')]?_0x40e168[_0xf02e('0x17')][_0xf02e('0x1c')]||null:null,'attributes':_0x40e168[_0xf02e('0x17')]?_0x40e168[_0xf02e('0x17')][_0xf02e('0x1d')]||null:null,'limit':_0x40e168[_0xf02e('0x17')]?_0x40e168[_0xf02e('0x17')]['limit']||null:null})[_0xf02e('0xb')](function(_0x4507a0){logger[_0xf02e('0xc')]('UpdateVoiceDialReport',_0x40e168);logger[_0xf02e('0x19')]('UpdateVoiceDialReport',_0x40e168,JSON[_0xf02e('0xf')](_0x4507a0));_0x2890ab(_0x4507a0);})[_0xf02e('0x13')](function(_0x4d2ea8){logger[_0xf02e('0x10')]('UpdateVoiceDialReport',_0x4d2ea8[_0xf02e('0x11')],_0x40e168);_0x5f0c71(_0x8d3b44['error'](0x1f4,_0x4d2ea8[_0xf02e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 1521ba3..357ef4e 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 _0xef1a=['/:id','show','post','create','/:id/applications','addApplications','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index'];(function(_0x33959d,_0x38d579){var _0x2ce2b7=function(_0x354e17){while(--_0x354e17){_0x33959d['push'](_0x33959d['shift']());}};_0x2ce2b7(++_0x38d579);}(_0xef1a,0x1c1));var _0xaef1=function(_0x29cf54,_0x1be9c5){_0x29cf54=_0x29cf54-0x0;var _0x35dd6f=_0xef1a[_0x29cf54];return _0x35dd6f;};'use strict';var multer=require(_0xaef1('0x0'));var util=require(_0xaef1('0x1'));var path=require(_0xaef1('0x2'));var timeout=require(_0xaef1('0x3'));var express=require(_0xaef1('0x4'));var router=express[_0xaef1('0x5')]();var auth=require(_0xaef1('0x6'));var interaction=require(_0xaef1('0x7'));var config=require(_0xaef1('0x8'));var controller=require(_0xaef1('0x9'));router[_0xaef1('0xa')]('/',auth[_0xaef1('0xb')](),controller[_0xaef1('0xc')]);router[_0xaef1('0xa')](_0xaef1('0xd'),auth[_0xaef1('0xb')](),controller[_0xaef1('0xe')]);router[_0xaef1('0xf')]('/',auth['isAuthenticated'](),controller[_0xaef1('0x10')]);router[_0xaef1('0xf')](_0xaef1('0x11'),auth['isAuthenticated'](),controller[_0xaef1('0x12')]);router[_0xaef1('0x13')](_0xaef1('0xd'),auth[_0xaef1('0xb')](),controller[_0xaef1('0x14')]);router['delete'](_0xaef1('0xd'),auth['isAuthenticated'](),controller[_0xaef1('0x15')]);module['exports']=router; \ No newline at end of file +var _0xda3b=['destroy','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','update','delete'];(function(_0x2e4b71,_0x170dcc){var _0x2c9092=function(_0x543364){while(--_0x543364){_0x2e4b71['push'](_0x2e4b71['shift']());}};_0x2c9092(++_0x170dcc);}(_0xda3b,0x18d));var _0xbda3=function(_0x4b966b,_0x463b51){_0x4b966b=_0x4b966b-0x0;var _0x86b205=_0xda3b[_0x4b966b];return _0x86b205;};'use strict';var multer=require(_0xbda3('0x0'));var util=require(_0xbda3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xbda3('0x2'));var interaction=require(_0xbda3('0x3'));var config=require(_0xbda3('0x4'));var controller=require('./voiceExtension.controller');router[_0xbda3('0x5')]('/',auth[_0xbda3('0x6')](),controller[_0xbda3('0x7')]);router['get'](_0xbda3('0x8'),auth['isAuthenticated'](),controller[_0xbda3('0x9')]);router[_0xbda3('0xa')]('/',auth['isAuthenticated'](),controller[_0xbda3('0xb')]);router[_0xbda3('0xa')](_0xbda3('0xc'),auth[_0xbda3('0x6')](),controller[_0xbda3('0xd')]);router[_0xbda3('0xe')](_0xbda3('0x8'),auth[_0xbda3('0x6')](),controller[_0xbda3('0xf')]);router[_0xbda3('0x10')](_0xbda3('0x8'),auth[_0xbda3('0x6')](),controller[_0xbda3('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 1ac9f62..ae92826 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(_0x313a14,_0x29a398){var _0x19eadd=function(_0x3cb09e){while(--_0x3cb09e){_0x313a14['push'](_0x313a14['shift']());}};_0x19eadd(++_0x29a398);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x4d654c,_0x3e5fe0){var _0x531305=function(_0x542e14){while(--_0x542e14){_0x4d654c['push'](_0x4d654c['shift']());}};_0x531305(++_0x3e5fe0);}(_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')]={'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 d448671..83de045 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 _0xd947=['to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','includes','type','find','name','error','stack','send','index','map','VoiceExtension','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','pick','where','merge','includeAll','findAll','catch','show','params','length','startsWith','body','exten','concat','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','recordingFormat','cutdigits','mandatoryDisposition','context','addApplications','sequelize','transaction','VoiceExtensionId','bulkCreate','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','sox'];(function(_0x37ace5,_0x5546de){var _0x235299=function(_0x149321){while(--_0x149321){_0x37ace5['push'](_0x37ace5['shift']());}};_0x235299(++_0x5546de);}(_0xd947,0x130));var _0x7d94=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd947[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0x7d94('0x0'));var emlformat=require(_0x7d94('0x1'));var rimraf=require(_0x7d94('0x2'));var zipdir=require(_0x7d94('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7d94('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7d94('0x5'));var util=require(_0x7d94('0x6'));var path=require('path');var sox=require(_0x7d94('0x7'));var csv=require(_0x7d94('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7d94('0x9'));var squel=require(_0x7d94('0xa'));var crypto=require('crypto');var jsforce=require(_0x7d94('0xb'));var deskjs=require(_0x7d94('0xc'));var toCsv=require(_0x7d94('0x8'));var querystring=require(_0x7d94('0xd'));var Papa=require(_0x7d94('0xe'));var Redis=require(_0x7d94('0xf'));var authService=require(_0x7d94('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7d94('0x11'));var hardwareService=require(_0x7d94('0x12'));var logger=require('../../config/logger')(_0x7d94('0x13'));var utils=require('../../config/utils');var config=require(_0x7d94('0x14'));var db=require(_0x7d94('0x15'))['db'];config[_0x7d94('0x16')]=_[_0x7d94('0x17')](config[_0x7d94('0x16')],{'host':_0x7d94('0x18'),'port':0x18eb});var socket=require(_0x7d94('0x19'))(new Redis(config[_0x7d94('0x16')]));require(_0x7d94('0x1a'))[_0x7d94('0x1b')](socket);function respondWithStatusCode(_0x2e4799,_0x4463ac){_0x4463ac=_0x4463ac||0xcc;return function(_0x423e3d){if(_0x423e3d){return _0x2e4799[_0x7d94('0x1c')](_0x4463ac);}return _0x2e4799[_0x7d94('0x1d')](_0x4463ac)[_0x7d94('0x1e')]();};}function respondWithResult(_0x3597b8,_0x58fdcb){_0x58fdcb=_0x58fdcb||0xc8;return function(_0x5e3871){if(_0x5e3871){return _0x3597b8[_0x7d94('0x1d')](_0x58fdcb)[_0x7d94('0x1f')](_0x5e3871);}};}function respondWithFilteredResult(_0x6d0dc0,_0x241ec7){return function(_0x5e61a3){if(_0x5e61a3){var _0x214d17=_0x5e61a3[_0x7d94('0x20')],_0x5395cd=_0x241ec7[_0x7d94('0x21')],_0x25d401=_0x241ec7['offset']+_0x241ec7['limit'],_0x2646c3;if(_0x25d401>=_0x214d17){_0x25d401=_0x214d17;_0x2646c3=0xc8;}else{_0x2646c3=0xce;}_0x6d0dc0[_0x7d94('0x1d')](_0x2646c3);return _0x6d0dc0[_0x7d94('0x22')](_0x7d94('0x23'),_0x5395cd+'-'+_0x25d401+'/'+_0x214d17)[_0x7d94('0x1f')](_0x5e61a3);}return null;};}function patchUpdates(_0x1da106){return function(_0x52c2f0){try{jsonpatch[_0x7d94('0x24')](_0x52c2f0,_0x1da106,!![]);}catch(_0x4a5d32){return BPromise[_0x7d94('0x25')](_0x4a5d32);}return _0x52c2f0[_0x7d94('0x26')]();};}function saveUpdates(_0x3ec680,_0x5045c3){return function(_0x4771b8){if(_0x4771b8){return _0x4771b8[_0x7d94('0x27')](_0x3ec680)[_0x7d94('0x28')](function(_0x5e68ea){return _0x5e68ea;});}return null;};}function removeEntity(_0x11b2ed,_0x1d2a95){return function(_0x36aec8){if(_0x36aec8){return _0x36aec8[_0x7d94('0x29')]()[_0x7d94('0x28')](function(){var _0x2706ca=_0x36aec8[_0x7d94('0x2a')]({'plain':!![]});var _0x69e9d8=[{'name':'InboundRoutes','value':_0x7d94('0x2b'),'ignore':![]},{'name':_0x7d94('0x2c'),'value':_0x7d94('0x2d'),'ignore':![]},{'name':_0x7d94('0x2e'),'value':_0x7d94('0x2f'),'ignore':![]}];var _0x3c2fcb=_(_0x69e9d8)[_0x7d94('0x30')](_0x7d94('0x31'))['map'](_0x7d94('0x32'))[_0x7d94('0x32')]();if(_[_0x7d94('0x33')](_0x3c2fcb,_0x2706ca[_0x7d94('0x34')])){return;}var _0x586b7f=_[_0x7d94('0x35')](_0x69e9d8,[_0x7d94('0x32'),_0x2706ca[_0x7d94('0x34')]])[_0x7d94('0x36')];return db['UserProfileResource']['destroy']({'where':{'type':_0x586b7f,'resourceId':_0x2706ca['id']}})['then'](function(){return _0x36aec8;});})[_0x7d94('0x28')](function(){_0x11b2ed[_0x7d94('0x1d')](0xcc)[_0x7d94('0x1e')]();});}};}function handleEntityNotFound(_0x109404,_0x262a17){return function(_0x4b6a84){if(!_0x4b6a84){_0x109404['sendStatus'](0x194);}return _0x4b6a84;};}function handleError(_0x1b0bf0,_0x17564f){_0x17564f=_0x17564f||0x1f4;return function(_0x5ed067){logger[_0x7d94('0x37')](_0x5ed067[_0x7d94('0x38')]);if(_0x5ed067['name']){delete _0x5ed067[_0x7d94('0x36')];}_0x1b0bf0[_0x7d94('0x1d')](_0x17564f)[_0x7d94('0x39')](_0x5ed067);};}exports[_0x7d94('0x3a')]=function(_0x4ee2bb,_0x1c9e2a){var _0xfa7ce={},_0xc16ce8={},_0x8aa3df={'count':0x0,'rows':[]};var _0x35cd7f=_[_0x7d94('0x3b')](db[_0x7d94('0x3c')][_0x7d94('0x3d')],function(_0x49b0d3){return{'name':_0x49b0d3['fieldName'],'type':_0x49b0d3[_0x7d94('0x34')][_0x7d94('0x3e')]};});_0xc16ce8[_0x7d94('0x3f')]=_[_0x7d94('0x3b')](_0x35cd7f,_0x7d94('0x36'));_0xc16ce8[_0x7d94('0x40')]=_[_0x7d94('0x41')](_0x4ee2bb[_0x7d94('0x40')]);_0xc16ce8[_0x7d94('0x42')]=_[_0x7d94('0x43')](_0xc16ce8[_0x7d94('0x3f')],_0xc16ce8[_0x7d94('0x40')]);_0xfa7ce[_0x7d94('0x44')]=_['intersection'](_0xc16ce8[_0x7d94('0x3f')],qs[_0x7d94('0x45')](_0x4ee2bb[_0x7d94('0x40')]['fields']));_0xfa7ce[_0x7d94('0x44')]=_0xfa7ce[_0x7d94('0x44')]['length']?_0xfa7ce[_0x7d94('0x44')]:_0xc16ce8[_0x7d94('0x3f')];if(!_0x4ee2bb[_0x7d94('0x40')]['hasOwnProperty'](_0x7d94('0x46'))){_0xfa7ce[_0x7d94('0x47')]=qs[_0x7d94('0x47')](_0x4ee2bb['query'][_0x7d94('0x47')]);_0xfa7ce[_0x7d94('0x21')]=qs[_0x7d94('0x21')](_0x4ee2bb[_0x7d94('0x40')][_0x7d94('0x21')]);}_0xfa7ce[_0x7d94('0x48')]=qs[_0x7d94('0x49')](_0x4ee2bb[_0x7d94('0x40')][_0x7d94('0x49')]);_0xfa7ce['where']=qs[_0x7d94('0x42')](_[_0x7d94('0x4a')](_0x4ee2bb[_0x7d94('0x40')],_0xc16ce8['filters']));if(_0x4ee2bb[_0x7d94('0x40')][_0x7d94('0x30')]){_0xfa7ce[_0x7d94('0x4b')]=_[_0x7d94('0x4c')](_0xfa7ce[_0x7d94('0x4b')],{'$or':_[_0x7d94('0x3b')](_0x35cd7f,function(_0x353391){if(_0x353391[_0x7d94('0x34')]!=='VIRTUAL'){var _0x57dac2={};_0x57dac2[_0x353391[_0x7d94('0x36')]]={'$like':'%'+_0x4ee2bb[_0x7d94('0x40')][_0x7d94('0x30')]+'%'};return _0x57dac2;}})});}_0xfa7ce=_[_0x7d94('0x4c')]({},_0xfa7ce,_0x4ee2bb['options']);var _0x4cd0b0={'where':_0xfa7ce[_0x7d94('0x4b')]};return db[_0x7d94('0x3c')]['count'](_0x4cd0b0)[_0x7d94('0x28')](function(_0x3fb759){_0x8aa3df[_0x7d94('0x20')]=_0x3fb759;if(_0x4ee2bb['query'][_0x7d94('0x4d')]){_0xfa7ce['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x7d94('0x4e')](_0xfa7ce);})[_0x7d94('0x28')](function(_0x204e7e){_0x8aa3df['rows']=_0x204e7e;return _0x8aa3df;})[_0x7d94('0x28')](respondWithFilteredResult(_0x1c9e2a,_0xfa7ce))[_0x7d94('0x4f')](handleError(_0x1c9e2a,null));};exports[_0x7d94('0x50')]=function(_0x522ed2,_0x545fde){var _0x342636={'raw':![],'where':{'id':_0x522ed2[_0x7d94('0x51')]['id']}},_0x51bd62={};_0x51bd62[_0x7d94('0x3f')]=_[_0x7d94('0x41')](db[_0x7d94('0x3c')][_0x7d94('0x3d')]);_0x51bd62[_0x7d94('0x40')]=_[_0x7d94('0x41')](_0x522ed2[_0x7d94('0x40')]);_0x51bd62[_0x7d94('0x42')]=_[_0x7d94('0x43')](_0x51bd62[_0x7d94('0x3f')],_0x51bd62[_0x7d94('0x40')]);_0x342636[_0x7d94('0x44')]=_[_0x7d94('0x43')](_0x51bd62[_0x7d94('0x3f')],qs[_0x7d94('0x45')](_0x522ed2['query']['fields']));_0x342636[_0x7d94('0x44')]=_0x342636['attributes'][_0x7d94('0x52')]?_0x342636['attributes']:_0x51bd62[_0x7d94('0x3f')];if(_0x522ed2[_0x7d94('0x40')][_0x7d94('0x4d')]){_0x342636['include']=[{'all':!![]}];}_0x342636=_[_0x7d94('0x4c')]({},_0x342636,_0x522ed2['options']);return db['VoiceExtension']['find'](_0x342636)[_0x7d94('0x28')](handleEntityNotFound(_0x545fde,null))[_0x7d94('0x28')](respondWithResult(_0x545fde,null))['catch'](handleError(_0x545fde,null));};exports[_0x7d94('0x29')]=function(_0x1f2463,_0x3f7709){return db[_0x7d94('0x3c')][_0x7d94('0x35')]({'where':{'id':_0x1f2463[_0x7d94('0x51')]['id']}})[_0x7d94('0x28')](handleEntityNotFound(_0x3f7709,null))[_0x7d94('0x28')](removeEntity(_0x3f7709,null))['catch'](handleError(_0x3f7709,null));};exports['create']=function(_0x58d9fe,_0x116b2a){if(_0x58d9fe['body'][_0x7d94('0x34')]===_0x7d94('0x2d')&&!_[_0x7d94('0x53')](_0x58d9fe[_0x7d94('0x54')][_0x7d94('0x55')],'_')){_0x58d9fe[_0x7d94('0x54')][_0x7d94('0x55')]='_'[_0x7d94('0x56')](_0x58d9fe[_0x7d94('0x54')][_0x7d94('0x55')]);}return db['VoiceExtension'][_0x7d94('0x57')](_0x58d9fe[_0x7d94('0x54')],{'raw':![]})[_0x7d94('0x28')](function(_0x3b6dd6){var _0x5062a4=_0x58d9fe[_0x7d94('0x58')][_0x7d94('0x2a')]({'plain':!![]});if(!_0x5062a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5062a4[_0x7d94('0x59')]==='user'){var _0x162cda=_0x3b6dd6[_0x7d94('0x2a')]({'plain':!![]});var _0x56fa42=[{'name':'InboundRoutes','value':_0x7d94('0x2b')},{'name':_0x7d94('0x2c'),'value':_0x7d94('0x2d')},{'name':_0x7d94('0x2e'),'value':_0x7d94('0x2f')}];var _0x18e870=_[_0x7d94('0x35')](_0x56fa42,[_0x7d94('0x32'),_0x162cda[_0x7d94('0x34')]])[_0x7d94('0x36')];return db[_0x7d94('0x5a')][_0x7d94('0x35')]({'where':{'name':_0x18e870,'userProfileId':_0x5062a4[_0x7d94('0x5b')]},'raw':!![]})['then'](function(_0x4a9a63){if(_0x4a9a63&&_0x4a9a63[_0x7d94('0x5c')]===0x0){return db['UserProfileResource'][_0x7d94('0x57')]({'name':_0x162cda['name'],'resourceId':_0x162cda['id'],'type':_0x4a9a63['name'],'sectionId':_0x4a9a63['id']},{})[_0x7d94('0x28')](function(){return _0x3b6dd6;});}else{return _0x3b6dd6;}})[_0x7d94('0x4f')](function(_0x63fb67){logger[_0x7d94('0x37')](_0x7d94('0x5d'),_0x63fb67);throw _0x63fb67;});}return _0x3b6dd6;})['then'](respondWithResult(_0x116b2a,0xc9))[_0x7d94('0x4f')](handleError(_0x116b2a,null));};exports[_0x7d94('0x27')]=function(_0x256195,_0x35e6cd){if(_0x256195[_0x7d94('0x54')]['id']){delete _0x256195[_0x7d94('0x54')]['id'];}return db[_0x7d94('0x3c')][_0x7d94('0x35')]({'where':{'id':_0x256195[_0x7d94('0x51')]['id']}})[_0x7d94('0x28')](handleEntityNotFound(_0x35e6cd,null))[_0x7d94('0x28')](function(_0x5289f7){if(_0x5289f7){return db[_0x7d94('0x3c')][_0x7d94('0x27')](_[_0x7d94('0x4a')](_0x256195[_0x7d94('0x54')],['exten','context','description',_0x7d94('0x5e'),_0x7d94('0x5f'),_0x7d94('0x60')]),{'where':{'context':_0x5289f7[_0x7d94('0x61')],'exten':_0x5289f7['exten']},'individualHooks':!![]})['then'](function(_0x16c7a5){return _0x16c7a5;});}return null;})[_0x7d94('0x28')](respondWithStatusCode(_0x35e6cd,null))[_0x7d94('0x4f')](handleError(_0x35e6cd,null));};exports[_0x7d94('0x62')]=function(_0x5cac4b,_0x59d9ae,_0x4c29f6){return db[_0x7d94('0x3c')]['findOne']({'where':{'id':_0x5cac4b[_0x7d94('0x51')]['id']}})[_0x7d94('0x28')](handleEntityNotFound(_0x59d9ae,null))[_0x7d94('0x28')](function(_0x3926e5){if(_0x3926e5){return db[_0x7d94('0x63')][_0x7d94('0x64')](function(_0x12db4a){return db[_0x7d94('0x3c')][_0x7d94('0x29')]({'where':{'VoiceExtensionId':_0x5cac4b['params']['id']},'transaction':_0x12db4a})[_0x7d94('0x28')](function(_0x4fc0a9){var _0x339910=_[_0x7d94('0x3b')](_0x5cac4b[_0x7d94('0x54')],function(_0x147978){_0x147978[_0x7d94('0x65')]=_0x5cac4b[_0x7d94('0x51')]['id'];return _0x147978;});return db[_0x7d94('0x3c')][_0x7d94('0x66')](_0x339910,{'transaction':_0x12db4a});});})['then'](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x5cac4b[_0x7d94('0x51')]['id']},'order':_0x7d94('0x67')});});}})[_0x7d94('0x28')](respondWithResult(_0x59d9ae,null))[_0x7d94('0x4f')](handleError(_0x59d9ae,null));}; \ No newline at end of file +var _0x16f4=['count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','type','find','name','error','stack','send','index','rawAttributes','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','merge','options','VoiceExtension','includeAll','show','params','include','catch','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','pick','context','recordingFormat','cutdigits','mandatoryDisposition','sequelize','transaction','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voiceExtension.socket','register','sendStatus','status','end'];(function(_0x2062bf,_0xef8bc4){var _0x328ee6=function(_0x568ed1){while(--_0x568ed1){_0x2062bf['push'](_0x2062bf['shift']());}};_0x328ee6(++_0xef8bc4);}(_0x16f4,0x10e));var _0x416f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x16f4[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0x416f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x416f('0x1'));var zipdir=require(_0x416f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x416f('0x3'));var moment=require(_0x416f('0x4'));var BPromise=require(_0x416f('0x5'));var Mustache=require(_0x416f('0x6'));var util=require(_0x416f('0x7'));var path=require(_0x416f('0x8'));var sox=require(_0x416f('0x9'));var csv=require(_0x416f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x416f('0xb'));var squel=require('squel');var crypto=require(_0x416f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x416f('0xd'));var toCsv=require(_0x416f('0xa'));var querystring=require(_0x416f('0xe'));var Papa=require(_0x416f('0xf'));var Redis=require(_0x416f('0x10'));var authService=require(_0x416f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x416f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x416f('0x13'));var db=require(_0x416f('0x14'))['db'];config['redis']=_[_0x416f('0x15')](config['redis'],{'host':_0x416f('0x16'),'port':0x18eb});var socket=require(_0x416f('0x17'))(new Redis(config[_0x416f('0x18')]));require(_0x416f('0x19'))[_0x416f('0x1a')](socket);function respondWithStatusCode(_0x31bae7,_0x2c9f72){_0x2c9f72=_0x2c9f72||0xcc;return function(_0x4ef4ca){if(_0x4ef4ca){return _0x31bae7[_0x416f('0x1b')](_0x2c9f72);}return _0x31bae7[_0x416f('0x1c')](_0x2c9f72)[_0x416f('0x1d')]();};}function respondWithResult(_0x501a24,_0x2fc7e7){_0x2fc7e7=_0x2fc7e7||0xc8;return function(_0x26d76c){if(_0x26d76c){return _0x501a24[_0x416f('0x1c')](_0x2fc7e7)['json'](_0x26d76c);}};}function respondWithFilteredResult(_0x165358,_0xc0d5a0){return function(_0x1f5b78){if(_0x1f5b78){var _0x434587=_0x1f5b78[_0x416f('0x1e')],_0xd5cfa5=_0xc0d5a0[_0x416f('0x1f')],_0x365523=_0xc0d5a0['offset']+_0xc0d5a0[_0x416f('0x20')],_0x2fabc6;if(_0x365523>=_0x434587){_0x365523=_0x434587;_0x2fabc6=0xc8;}else{_0x2fabc6=0xce;}_0x165358['status'](_0x2fabc6);return _0x165358['set'](_0x416f('0x21'),_0xd5cfa5+'-'+_0x365523+'/'+_0x434587)[_0x416f('0x22')](_0x1f5b78);}return null;};}function patchUpdates(_0x57187a){return function(_0x456873){try{jsonpatch[_0x416f('0x23')](_0x456873,_0x57187a,!![]);}catch(_0x563596){return BPromise[_0x416f('0x24')](_0x563596);}return _0x456873[_0x416f('0x25')]();};}function saveUpdates(_0x4c04d2,_0x19d968){return function(_0x281664){if(_0x281664){return _0x281664[_0x416f('0x26')](_0x4c04d2)[_0x416f('0x27')](function(_0x4ea893){return _0x4ea893;});}return null;};}function removeEntity(_0x5eb859,_0x364618){return function(_0x3a0238){if(_0x3a0238){return _0x3a0238[_0x416f('0x28')]()[_0x416f('0x27')](function(){var _0x288563=_0x3a0238[_0x416f('0x29')]({'plain':!![]});var _0x4b9d4e=[{'name':_0x416f('0x2a'),'value':_0x416f('0x2b'),'ignore':![]},{'name':_0x416f('0x2c'),'value':_0x416f('0x2d'),'ignore':![]},{'name':_0x416f('0x2e'),'value':_0x416f('0x2f'),'ignore':![]}];var _0x3dceb1=_(_0x4b9d4e)[_0x416f('0x30')](_0x416f('0x31'))['map'](_0x416f('0x32'))[_0x416f('0x32')]();if(_['includes'](_0x3dceb1,_0x288563[_0x416f('0x33')])){return;}var _0x2b5ffa=_[_0x416f('0x34')](_0x4b9d4e,['value',_0x288563[_0x416f('0x33')]])[_0x416f('0x35')];return db['UserProfileResource']['destroy']({'where':{'type':_0x2b5ffa,'resourceId':_0x288563['id']}})[_0x416f('0x27')](function(){return _0x3a0238;});})['then'](function(){_0x5eb859[_0x416f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x113716,_0x10a900){return function(_0x12d17a){if(!_0x12d17a){_0x113716[_0x416f('0x1b')](0x194);}return _0x12d17a;};}function handleError(_0x390142,_0x38ee09){_0x38ee09=_0x38ee09||0x1f4;return function(_0x46e3b7){logger[_0x416f('0x36')](_0x46e3b7[_0x416f('0x37')]);if(_0x46e3b7[_0x416f('0x35')]){delete _0x46e3b7[_0x416f('0x35')];}_0x390142[_0x416f('0x1c')](_0x38ee09)[_0x416f('0x38')](_0x46e3b7);};}exports[_0x416f('0x39')]=function(_0x5550b8,_0x148902){var _0x4543d6={},_0x31d22f={},_0x4a0579={'count':0x0,'rows':[]};var _0xa10baf=_['map'](db['VoiceExtension'][_0x416f('0x3a')],function(_0x709f4e){return{'name':_0x709f4e['fieldName'],'type':_0x709f4e[_0x416f('0x33')][_0x416f('0x3b')]};});_0x31d22f['model']=_[_0x416f('0x3c')](_0xa10baf,_0x416f('0x35'));_0x31d22f[_0x416f('0x3d')]=_[_0x416f('0x3e')](_0x5550b8['query']);_0x31d22f[_0x416f('0x3f')]=_[_0x416f('0x40')](_0x31d22f['model'],_0x31d22f['query']);_0x4543d6[_0x416f('0x41')]=_[_0x416f('0x40')](_0x31d22f[_0x416f('0x42')],qs[_0x416f('0x43')](_0x5550b8[_0x416f('0x3d')][_0x416f('0x43')]));_0x4543d6['attributes']=_0x4543d6['attributes']['length']?_0x4543d6[_0x416f('0x41')]:_0x31d22f[_0x416f('0x42')];if(!_0x5550b8['query'][_0x416f('0x44')](_0x416f('0x45'))){_0x4543d6[_0x416f('0x20')]=qs['limit'](_0x5550b8[_0x416f('0x3d')]['limit']);_0x4543d6[_0x416f('0x1f')]=qs[_0x416f('0x1f')](_0x5550b8[_0x416f('0x3d')]['offset']);}_0x4543d6[_0x416f('0x46')]=qs[_0x416f('0x47')](_0x5550b8[_0x416f('0x3d')][_0x416f('0x47')]);_0x4543d6[_0x416f('0x48')]=qs[_0x416f('0x3f')](_['pick'](_0x5550b8[_0x416f('0x3d')],_0x31d22f['filters']));if(_0x5550b8['query'][_0x416f('0x30')]){_0x4543d6[_0x416f('0x48')]=_[_0x416f('0x49')](_0x4543d6[_0x416f('0x48')],{'$or':_[_0x416f('0x3c')](_0xa10baf,function(_0x39b4fd){if(_0x39b4fd[_0x416f('0x33')]!=='VIRTUAL'){var _0x36ef51={};_0x36ef51[_0x39b4fd['name']]={'$like':'%'+_0x5550b8[_0x416f('0x3d')][_0x416f('0x30')]+'%'};return _0x36ef51;}})});}_0x4543d6=_[_0x416f('0x49')]({},_0x4543d6,_0x5550b8[_0x416f('0x4a')]);var _0x2e0542={'where':_0x4543d6[_0x416f('0x48')]};return db[_0x416f('0x4b')][_0x416f('0x1e')](_0x2e0542)[_0x416f('0x27')](function(_0x44ad04){_0x4a0579[_0x416f('0x1e')]=_0x44ad04;if(_0x5550b8[_0x416f('0x3d')][_0x416f('0x4c')]){_0x4543d6['include']=[{'all':!![]}];}return db[_0x416f('0x4b')]['findAll'](_0x4543d6);})[_0x416f('0x27')](function(_0x1d55f7){_0x4a0579['rows']=_0x1d55f7;return _0x4a0579;})['then'](respondWithFilteredResult(_0x148902,_0x4543d6))['catch'](handleError(_0x148902,null));};exports[_0x416f('0x4d')]=function(_0x57a195,_0x421843){var _0x470dc4={'raw':![],'where':{'id':_0x57a195[_0x416f('0x4e')]['id']}},_0x1e02f8={};_0x1e02f8[_0x416f('0x42')]=_['keys'](db['VoiceExtension'][_0x416f('0x3a')]);_0x1e02f8[_0x416f('0x3d')]=_[_0x416f('0x3e')](_0x57a195['query']);_0x1e02f8[_0x416f('0x3f')]=_['intersection'](_0x1e02f8[_0x416f('0x42')],_0x1e02f8[_0x416f('0x3d')]);_0x470dc4['attributes']=_[_0x416f('0x40')](_0x1e02f8[_0x416f('0x42')],qs[_0x416f('0x43')](_0x57a195[_0x416f('0x3d')][_0x416f('0x43')]));_0x470dc4[_0x416f('0x41')]=_0x470dc4[_0x416f('0x41')]['length']?_0x470dc4[_0x416f('0x41')]:_0x1e02f8['model'];if(_0x57a195[_0x416f('0x3d')][_0x416f('0x4c')]){_0x470dc4[_0x416f('0x4f')]=[{'all':!![]}];}_0x470dc4=_[_0x416f('0x49')]({},_0x470dc4,_0x57a195[_0x416f('0x4a')]);return db['VoiceExtension'][_0x416f('0x34')](_0x470dc4)[_0x416f('0x27')](handleEntityNotFound(_0x421843,null))[_0x416f('0x27')](respondWithResult(_0x421843,null))['catch'](handleError(_0x421843,null));};exports[_0x416f('0x28')]=function(_0x2b40b4,_0x10cda8){return db[_0x416f('0x4b')][_0x416f('0x34')]({'where':{'id':_0x2b40b4[_0x416f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x10cda8,null))[_0x416f('0x27')](removeEntity(_0x10cda8,null))[_0x416f('0x50')](handleError(_0x10cda8,null));};exports[_0x416f('0x51')]=function(_0x479780,_0x163395){if(_0x479780['body'][_0x416f('0x33')]===_0x416f('0x2d')&&!_[_0x416f('0x52')](_0x479780[_0x416f('0x53')][_0x416f('0x54')],'_')){_0x479780[_0x416f('0x53')][_0x416f('0x54')]='_'[_0x416f('0x55')](_0x479780[_0x416f('0x53')][_0x416f('0x54')]);}return db[_0x416f('0x4b')][_0x416f('0x51')](_0x479780[_0x416f('0x53')],{'raw':![]})[_0x416f('0x27')](function(_0x88c5fd){var _0x32946b=_0x479780[_0x416f('0x56')][_0x416f('0x29')]({'plain':!![]});if(!_0x32946b)throw new Error(_0x416f('0x57'));if(_0x32946b['role']==='user'){var _0x30da02=_0x88c5fd[_0x416f('0x29')]({'plain':!![]});var _0x601cb1=[{'name':_0x416f('0x2a'),'value':_0x416f('0x2b')},{'name':_0x416f('0x2c'),'value':_0x416f('0x2d')},{'name':_0x416f('0x2e'),'value':_0x416f('0x2f')}];var _0x1dcd32=_['find'](_0x601cb1,[_0x416f('0x32'),_0x30da02[_0x416f('0x33')]])[_0x416f('0x35')];return db['UserProfileSection'][_0x416f('0x34')]({'where':{'name':_0x1dcd32,'userProfileId':_0x32946b[_0x416f('0x58')]},'raw':!![]})[_0x416f('0x27')](function(_0x66762c){if(_0x66762c&&_0x66762c['autoAssociation']===0x0){return db[_0x416f('0x59')][_0x416f('0x51')]({'name':_0x30da02[_0x416f('0x35')],'resourceId':_0x30da02['id'],'type':_0x66762c[_0x416f('0x35')],'sectionId':_0x66762c['id']},{})['then'](function(){return _0x88c5fd;});}else{return _0x88c5fd;}})['catch'](function(_0x4987b9){logger[_0x416f('0x36')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4987b9);throw _0x4987b9;});}return _0x88c5fd;})['then'](respondWithResult(_0x163395,0xc9))[_0x416f('0x50')](handleError(_0x163395,null));};exports[_0x416f('0x26')]=function(_0xeeeceb,_0x20dde0){if(_0xeeeceb['body']['id']){delete _0xeeeceb['body']['id'];}return db[_0x416f('0x4b')][_0x416f('0x34')]({'where':{'id':_0xeeeceb[_0x416f('0x4e')]['id']}})[_0x416f('0x27')](handleEntityNotFound(_0x20dde0,null))['then'](function(_0x28e8bf){if(_0x28e8bf){return db[_0x416f('0x4b')][_0x416f('0x26')](_[_0x416f('0x5a')](_0xeeeceb[_0x416f('0x53')],[_0x416f('0x54'),_0x416f('0x5b'),'description',_0x416f('0x5c'),_0x416f('0x5d'),_0x416f('0x5e')]),{'where':{'context':_0x28e8bf[_0x416f('0x5b')],'exten':_0x28e8bf[_0x416f('0x54')]},'individualHooks':!![]})[_0x416f('0x27')](function(_0x575fbf){return _0x575fbf;});}return null;})[_0x416f('0x27')](respondWithStatusCode(_0x20dde0,null))[_0x416f('0x50')](handleError(_0x20dde0,null));};exports['addApplications']=function(_0x22c38e,_0x11ae33,_0x915480){return db['VoiceExtension']['findOne']({'where':{'id':_0x22c38e[_0x416f('0x4e')]['id']}})[_0x416f('0x27')](handleEntityNotFound(_0x11ae33,null))[_0x416f('0x27')](function(_0x5069f8){if(_0x5069f8){return db[_0x416f('0x5f')][_0x416f('0x60')](function(_0x260af0){return db[_0x416f('0x4b')][_0x416f('0x28')]({'where':{'VoiceExtensionId':_0x22c38e['params']['id']},'transaction':_0x260af0})['then'](function(_0x39c399){var _0x1427e4=_[_0x416f('0x3c')](_0x22c38e[_0x416f('0x53')],function(_0x2ef56b){_0x2ef56b['VoiceExtensionId']=_0x22c38e[_0x416f('0x4e')]['id'];return _0x2ef56b;});return db[_0x416f('0x4b')][_0x416f('0x61')](_0x1427e4,{'transaction':_0x260af0});});})[_0x416f('0x27')](function(){return db[_0x416f('0x4b')][_0x416f('0x62')]({'where':{'isApp':!![],'VoiceExtensionId':_0x22c38e[_0x416f('0x4e')]['id']},'order':_0x416f('0x63')});});}})['then'](respondWithResult(_0x11ae33,null))[_0x416f('0x50')](handleError(_0x11ae33,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index f33ffa8..919ec79 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 _0xcff2=['exports','events','../../mysqldb','VoiceExtension','save','update','remove','hasOwnProperty','hook'];(function(_0x4af52a,_0x40daf9){var _0x20e015=function(_0x4804bc){while(--_0x4804bc){_0x4af52a['push'](_0x4af52a['shift']());}};_0x20e015(++_0x40daf9);}(_0xcff2,0x172));var _0x2cff=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0xcff2[_0x5a1a51];return _0x47edd7;};'use strict';var EventEmitter=require(_0x2cff('0x0'));var VoiceExtension=require(_0x2cff('0x1'))['db'][_0x2cff('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2cff('0x3'),'afterUpdate':_0x2cff('0x4'),'afterDestroy':_0x2cff('0x5')};function emitEvent(_0x227c15){return function(_0x4304d7,_0x86cb45,_0x488f66){VoiceExtensionEvents['emit'](_0x227c15+':'+_0x4304d7['id'],_0x4304d7);VoiceExtensionEvents['emit'](_0x227c15,_0x4304d7);_0x488f66(null);};}for(var e in events){if(events[_0x2cff('0x6')](e)){var event=events[e];VoiceExtension[_0x2cff('0x7')](e,emitEvent(event));}}module[_0x2cff('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xef4b=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x140752,_0x3cc756){var _0x24de5b=function(_0x55f963){while(--_0x55f963){_0x140752['push'](_0x140752['shift']());}};_0x24de5b(++_0x3cc756);}(_0xef4b,0x96));var _0xbef4=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0xef4b[_0x1b3564];return _0x504069;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xbef4('0x0'))['db'][_0xbef4('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xbef4('0x2')](0x0);var events={'afterCreate':_0xbef4('0x3'),'afterUpdate':_0xbef4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2e8ed6){return function(_0x487f8b,_0x515bd7,_0x2ba6b2){VoiceExtensionEvents[_0xbef4('0x5')](_0x2e8ed6+':'+_0x487f8b['id'],_0x487f8b);VoiceExtensionEvents[_0xbef4('0x5')](_0x2e8ed6,_0x487f8b);_0x2ba6b2(null);};}for(var e in events){if(events[_0xbef4('0x6')](e)){var event=events[e];VoiceExtension[_0xbef4('0x7')](e,emitEvent(event));}}module[_0xbef4('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 f233d57..3349bd8 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 _0x0afd=['../../config/environment','./voiceExtension.attributes','exports','define','VoiceExtension','voice_extensions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x0afd,0x1e6));var _0xd0af=function(_0xd26a0d,_0x4d4685){_0xd26a0d=_0xd26a0d-0x0;var _0x5060f4=_0x0afd[_0xd26a0d];return _0x5060f4;};'use strict';var _=require(_0xd0af('0x0'));var util=require(_0xd0af('0x1'));var logger=require(_0xd0af('0x2'))(_0xd0af('0x3'));var moment=require(_0xd0af('0x4'));var BPromise=require(_0xd0af('0x5'));var rp=require(_0xd0af('0x6'));var fs=require('fs');var path=require(_0xd0af('0x7'));var rimraf=require(_0xd0af('0x8'));var config=require(_0xd0af('0x9'));var attributes=require(_0xd0af('0xa'));module[_0xd0af('0xb')]=function(_0x3ea417,_0x53f5f5){return _0x3ea417[_0xd0af('0xc')](_0xd0af('0xd'),attributes,{'tableName':_0xd0af('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5234=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','./voiceExtension.attributes','exports'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x5234,0x168));var _0x4523=function(_0x316d62,_0x187190){_0x316d62=_0x316d62-0x0;var _0x1d868f=_0x5234[_0x316d62];return _0x1d868f;};'use strict';var _=require(_0x4523('0x0'));var util=require(_0x4523('0x1'));var logger=require(_0x4523('0x2'))('api');var moment=require(_0x4523('0x3'));var BPromise=require(_0x4523('0x4'));var rp=require(_0x4523('0x5'));var fs=require('fs');var path=require(_0x4523('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4523('0x7'));module[_0x4523('0x8')]=function(_0x2fa020,_0x3591a7){return _0x2fa020['define']('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 51b8010..405588b 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 _0x7dac=['GetVoiceExtension','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','localhost','socket.io-emitter','redis','./voiceExtension.socket','register','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceExtension','raw','options','where','attributes','limit','include','map','model','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7dac,0x8d));var _0xc7da=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7dac[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xc7da('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc7da('0x1'));var fs=require('fs');var Redis=require(_0xc7da('0x2'));var db=require(_0xc7da('0x3'))['db'];var utils=require(_0xc7da('0x4'));var logger=require(_0xc7da('0x5'))('rpc');var config=require(_0xc7da('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc7da('0x7')][_0xc7da('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xc7da('0x9'),'port':0x18eb});var socket=require(_0xc7da('0xa'))(new Redis(config[_0xc7da('0xb')]));require(_0xc7da('0xc'))[_0xc7da('0xd')](socket);function respondWithRpcPromise(_0xd4d400,_0x5d24b3,_0x37cd61){return new BPromise(function(_0x549c3d,_0x5db2f7){return client['request'](_0xd4d400,_0x37cd61)['then'](function(_0x4ed082){logger['info'](_0xc7da('0xe'),_0x5d24b3,_0xc7da('0xf'));logger[_0xc7da('0x10')](_0xc7da('0x11'),_0x5d24b3,_0xc7da('0xf'),JSON[_0xc7da('0x12')](_0x4ed082));if(_0x4ed082[_0xc7da('0x13')]){if(_0x4ed082[_0xc7da('0x13')][_0xc7da('0x14')]===0x1f4){logger[_0xc7da('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x5d24b3,_0x4ed082[_0xc7da('0x13')][_0xc7da('0x15')]);return _0x5db2f7(_0x4ed082[_0xc7da('0x13')][_0xc7da('0x15')]);}logger[_0xc7da('0x13')](_0xc7da('0xe'),_0x5d24b3,_0x4ed082['error']['message']);return _0x549c3d(_0x4ed082[_0xc7da('0x13')]['message']);}else{logger['info'](_0xc7da('0xe'),_0x5d24b3,_0xc7da('0xf'));_0x549c3d(_0x4ed082[_0xc7da('0x16')][_0xc7da('0x15')]);}})[_0xc7da('0x17')](function(_0x17cb84){logger[_0xc7da('0x13')](_0xc7da('0xe'),_0x5d24b3,_0x17cb84);_0x5db2f7(_0x17cb84);});});}exports['GetVoiceExtension']=function(_0x26d46c){var _0x333cdf=this;return new Promise(function(_0x1bc47,_0xb60a35){return db[_0xc7da('0x18')]['findAll']({'raw':_0x26d46c['options']?_0x26d46c['options'][_0xc7da('0x19')]===undefined?!![]:![]:!![],'where':_0x26d46c[_0xc7da('0x1a')]?_0x26d46c[_0xc7da('0x1a')][_0xc7da('0x1b')]||null:null,'attributes':_0x26d46c[_0xc7da('0x1a')]?_0x26d46c[_0xc7da('0x1a')][_0xc7da('0x1c')]||null:null,'limit':_0x26d46c['options']?_0x26d46c[_0xc7da('0x1a')][_0xc7da('0x1d')]||null:null,'include':_0x26d46c[_0xc7da('0x1a')]?_0x26d46c[_0xc7da('0x1a')][_0xc7da('0x1e')]?_['map'](_0x26d46c[_0xc7da('0x1a')]['include'],function(_0x207e62){return{'model':db[_0x207e62['model']],'as':_0x207e62['as'],'attributes':_0x207e62['attributes'],'include':_0x207e62[_0xc7da('0x1e')]?_[_0xc7da('0x1f')](_0x207e62['include'],function(_0x351b9c){return{'model':db[_0x351b9c[_0xc7da('0x20')]],'as':_0x351b9c['as'],'attributes':_0x351b9c[_0xc7da('0x1c')],'include':_0x351b9c[_0xc7da('0x1e')]?_[_0xc7da('0x1f')](_0x351b9c[_0xc7da('0x1e')],function(_0x561fbb){return{'model':db[_0x561fbb[_0xc7da('0x20')]],'as':_0x561fbb['as'],'attributes':_0x561fbb[_0xc7da('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3900e2){logger[_0xc7da('0x21')]('GetVoiceExtension',_0x26d46c);logger['debug'](_0xc7da('0x22'),_0x26d46c,JSON[_0xc7da('0x12')](_0x3900e2));_0x1bc47(_0x3900e2);})[_0xc7da('0x17')](function(_0x44c055){logger['error']('GetVoiceExtension',_0x44c055[_0xc7da('0x15')],_0x26d46c);_0xb60a35(_0x333cdf['error'](0x1f4,_0x44c055[_0xc7da('0x15')]));});});}; \ No newline at end of file +var _0x4742=['findAll','options','raw','where','attributes','limit','map','include','model','info','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVoiceExtension'];(function(_0x3ee0da,_0x19122f){var _0x3a117d=function(_0x183440){while(--_0x183440){_0x3ee0da['push'](_0x3ee0da['shift']());}};_0x3a117d(++_0x19122f);}(_0x4742,0x97));var _0x2474=function(_0x1f70f8,_0x540842){_0x1f70f8=_0x1f70f8-0x0;var _0x3b89db=_0x4742[_0x1f70f8];return _0x3b89db;};'use strict';var _=require(_0x2474('0x0'));var util=require(_0x2474('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2474('0x2'));var fs=require('fs');var Redis=require(_0x2474('0x3'));var db=require(_0x2474('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2474('0x5'))(_0x2474('0x6'));var config=require(_0x2474('0x7'));var jayson=require(_0x2474('0x8'));var client=jayson[_0x2474('0x9')]['http']({'port':0x232a});config[_0x2474('0xa')]=_[_0x2474('0xb')](config[_0x2474('0xa')],{'host':_0x2474('0xc'),'port':0x18eb});var socket=require(_0x2474('0xd'))(new Redis(config['redis']));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x982baf,_0x31c456,_0x3ba305){return new BPromise(function(_0x52d5b4,_0x209da0){return client['request'](_0x982baf,_0x3ba305)[_0x2474('0xe')](function(_0x4313d3){logger['info'](_0x2474('0xf'),_0x31c456,_0x2474('0x10'));logger[_0x2474('0x11')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x31c456,_0x2474('0x10'),JSON['stringify'](_0x4313d3));if(_0x4313d3[_0x2474('0x12')]){if(_0x4313d3['error'][_0x2474('0x13')]===0x1f4){logger[_0x2474('0x12')](_0x2474('0xf'),_0x31c456,_0x4313d3[_0x2474('0x12')][_0x2474('0x14')]);return _0x209da0(_0x4313d3[_0x2474('0x12')]['message']);}logger[_0x2474('0x12')](_0x2474('0xf'),_0x31c456,_0x4313d3[_0x2474('0x12')]['message']);return _0x52d5b4(_0x4313d3['error'][_0x2474('0x14')]);}else{logger['info'](_0x2474('0xf'),_0x31c456,'request\x20sent');_0x52d5b4(_0x4313d3[_0x2474('0x15')]['message']);}})[_0x2474('0x16')](function(_0x5bef70){logger['error'](_0x2474('0xf'),_0x31c456,_0x5bef70);_0x209da0(_0x5bef70);});});}exports[_0x2474('0x17')]=function(_0x395943){var _0x42e102=this;return new Promise(function(_0x2412b7,_0x37b52d){return db['VoiceExtension'][_0x2474('0x18')]({'raw':_0x395943[_0x2474('0x19')]?_0x395943[_0x2474('0x19')][_0x2474('0x1a')]===undefined?!![]:![]:!![],'where':_0x395943[_0x2474('0x19')]?_0x395943[_0x2474('0x19')][_0x2474('0x1b')]||null:null,'attributes':_0x395943['options']?_0x395943[_0x2474('0x19')][_0x2474('0x1c')]||null:null,'limit':_0x395943['options']?_0x395943[_0x2474('0x19')][_0x2474('0x1d')]||null:null,'include':_0x395943[_0x2474('0x19')]?_0x395943[_0x2474('0x19')]['include']?_[_0x2474('0x1e')](_0x395943[_0x2474('0x19')][_0x2474('0x1f')],function(_0x143182){return{'model':db[_0x143182[_0x2474('0x20')]],'as':_0x143182['as'],'attributes':_0x143182['attributes'],'include':_0x143182[_0x2474('0x1f')]?_['map'](_0x143182[_0x2474('0x1f')],function(_0x4b1cab){return{'model':db[_0x4b1cab[_0x2474('0x20')]],'as':_0x4b1cab['as'],'attributes':_0x4b1cab['attributes'],'include':_0x4b1cab['include']?_[_0x2474('0x1e')](_0x4b1cab[_0x2474('0x1f')],function(_0x386525){return{'model':db[_0x386525['model']],'as':_0x386525['as'],'attributes':_0x386525['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x511107){logger[_0x2474('0x21')]('GetVoiceExtension',_0x395943);logger['debug'](_0x2474('0x17'),_0x395943,JSON[_0x2474('0x22')](_0x511107));_0x2412b7(_0x511107);})[_0x2474('0x16')](function(_0x31337c){logger['error']('GetVoiceExtension',_0x31337c[_0x2474('0x14')],_0x395943);_0x37b52d(_0x42e102[_0x2474('0x12')](0x1f4,_0x31337c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index df7e809..369adb0 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 _0xbaca=['emit','removeListener','register','length','remove','update'];(function(_0x34eb50,_0x989798){var _0x2761dd=function(_0x1801c8){while(--_0x1801c8){_0x34eb50['push'](_0x34eb50['shift']());}};_0x2761dd(++_0x989798);}(_0xbaca,0x8e));var _0xabac=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0xbaca[_0x212bf5];return _0xfcad21;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=['save',_0xabac('0x0'),_0xabac('0x1')];function createListener(_0xfcfa22,_0xa3d7f4){return function(_0x289bc9){_0xa3d7f4[_0xabac('0x2')](_0xfcfa22,_0x289bc9);};}function removeListener(_0x5c4891,_0x471183){return function(){VoiceExtensionEvents[_0xabac('0x3')](_0x5c4891,_0x471183);};}exports[_0xabac('0x4')]=function(_0x3c4595){for(var _0x10f4b3=0x0,_0x4c7906=events[_0xabac('0x5')];_0x10f4b3<_0x4c7906;_0x10f4b3++){var _0x58f145=events[_0x10f4b3];var _0x4a88ce=createListener('voiceExtension:'+_0x58f145,_0x3c4595);VoiceExtensionEvents['on'](_0x58f145,_0x4a88ce);}}; \ No newline at end of file +var _0x50c4=['./voiceExtension.events','save','remove','emit','removeListener','register','voiceExtension:'];(function(_0x25b865,_0x228b9d){var _0x42723c=function(_0x10c2d7){while(--_0x10c2d7){_0x25b865['push'](_0x25b865['shift']());}};_0x42723c(++_0x228b9d);}(_0x50c4,0x13b));var _0x450c=function(_0x3f0743,_0x19c784){_0x3f0743=_0x3f0743-0x0;var _0x291c35=_0x50c4[_0x3f0743];return _0x291c35;};'use strict';var VoiceExtensionEvents=require(_0x450c('0x0'));var events=[_0x450c('0x1'),_0x450c('0x2'),'update'];function createListener(_0x37979b,_0x15ce03){return function(_0x38300d){_0x15ce03[_0x450c('0x3')](_0x37979b,_0x38300d);};}function removeListener(_0x218f2f,_0x35c522){return function(){VoiceExtensionEvents[_0x450c('0x4')](_0x218f2f,_0x35c522);};}exports[_0x450c('0x5')]=function(_0x4ce518){for(var _0x98c4f1=0x0,_0x77a69a=events['length'];_0x98c4f1<_0x77a69a;_0x98c4f1++){var _0x252b65=events[_0x98c4f1];var _0x46281e=createListener(_0x450c('0x6')+_0x252b65,_0x4ce518);VoiceExtensionEvents['on'](_0x252b65,_0x46281e);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index a9f5276..83a0ed0 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 _0x343e=['express','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','show','/:id/messages','getMessages','post','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x343e,0xec));var _0xe343=function(_0x4eb573,_0x1b2041){_0x4eb573=_0x4eb573-0x0;var _0x3ac715=_0x343e[_0x4eb573];return _0x3ac715;};'use strict';var multer=require(_0xe343('0x0'));var util=require(_0xe343('0x1'));var path=require(_0xe343('0x2'));var timeout=require(_0xe343('0x3'));var express=require(_0xe343('0x4'));var router=express[_0xe343('0x5')]();var auth=require(_0xe343('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe343('0x7'));var controller=require(_0xe343('0x8'));router[_0xe343('0x9')]('/',auth[_0xe343('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe343('0xb')]);router[_0xe343('0x9')](_0xe343('0xc'),auth[_0xe343('0xa')](),controller[_0xe343('0xd')]);router[_0xe343('0xe')]('/',auth[_0xe343('0xa')](),controller['create']);router[_0xe343('0xf')](_0xe343('0x10'),auth[_0xe343('0xa')](),controller['update']);router[_0xe343('0x11')](_0xe343('0x10'),auth[_0xe343('0xa')](),controller[_0xe343('0x12')]);module[_0xe343('0x13')]=router; \ No newline at end of file +var _0xd405=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','show','/:id/messages','getMessages','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x498c73,_0x371b2b){var _0x51720a=function(_0xb83093){while(--_0xb83093){_0x498c73['push'](_0x498c73['shift']());}};_0x51720a(++_0x371b2b);}(_0xd405,0x16b));var _0x5d40=function(_0x34c063,_0x11d3d7){_0x34c063=_0x34c063-0x0;var _0x2c63a3=_0xd405[_0x34c063];return _0x2c63a3;};'use strict';var multer=require('multer');var util=require(_0x5d40('0x0'));var path=require(_0x5d40('0x1'));var timeout=require(_0x5d40('0x2'));var express=require(_0x5d40('0x3'));var router=express[_0x5d40('0x4')]();var auth=require(_0x5d40('0x5'));var interaction=require(_0x5d40('0x6'));var config=require(_0x5d40('0x7'));var controller=require(_0x5d40('0x8'));router['get']('/',auth[_0x5d40('0x9')](),controller[_0x5d40('0xa')]);router[_0x5d40('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x5d40('0xc')]);router[_0x5d40('0xb')](_0x5d40('0xd'),auth['isAuthenticated'](),controller[_0x5d40('0xe')]);router[_0x5d40('0xf')]('/',auth['isAuthenticated'](),controller[_0x5d40('0x10')]);router[_0x5d40('0x11')](_0x5d40('0x12'),auth['isAuthenticated'](),controller[_0x5d40('0x13')]);router[_0x5d40('0x14')](_0x5d40('0x12'),auth[_0x5d40('0x9')](),controller[_0x5d40('0x15')]);module[_0x5d40('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 4d4bc3e..7c6c01d 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 _0xe605=['email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xe605,0x92));var _0x5e60=function(_0x5ebb64,_0x4c3b52){_0x5ebb64=_0x5ebb64-0x0;var _0x4626e7=_0xe605[_0x5ebb64];return _0x4626e7;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5e60('0x2')],'defaultValue':_0x5e60('0x3'),'unique':_0x5e60('0x4')},'mailbox':{'type':Sequelize[_0x5e60('0x2')],'defaultValue':'','allowNull':![],'unique':_0x5e60('0x4')},'password':{'type':Sequelize[_0x5e60('0x2')]},'fullname':{'type':Sequelize[_0x5e60('0x2')]},'email':{'type':Sequelize[_0x5e60('0x2')],'validate':{'isEmail':!![]},'set':function(_0x297ab2){this[_0x5e60('0x5')](_0x5e60('0x6'),typeof _0x297ab2===_0x5e60('0x7')&&_0x297ab2['trim']()?_0x297ab2[_0x5e60('0x8')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x5e60('0x9')](_0x5e60('0xa'),'no'),'defaultValue':_0x5e60('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x5e60('0x9')](_0x5e60('0xa'),'no'),'defaultValue':_0x5e60('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x5e60('0x2')]},'review':{'type':Sequelize['ENUM'](_0x5e60('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x5e60('0x9')](_0x5e60('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x5e60('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x5e60('0x9')](_0x5e60('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5e60('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x5e60('0x9')](_0x5e60('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x5e60('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x5e60('0x9')](_0x5e60('0xa'),'no'),'defaultValue':_0x5e60('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x5e60('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x5e60('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x5e60('0x9')]('yes','no'),'defaultValue':_0x5e60('0xa'),'allowNull':![]},'stamp':{'type':_0x5e60('0xc')},'emailsubject':{'type':Sequelize[_0x5e60('0x2')]},'emailbody':{'type':Sequelize[_0x5e60('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x5e60('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x5e60('0xe')],'get':function(){return this['getDataValue'](_0x5e60('0xf'))+_0x5e60('0x10')+this[_0x5e60('0x11')](_0x5e60('0x12'));}}}; \ 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(_0x35ecdf,_0xb1aeb7){var _0x2f9842=function(_0x3a4ac0){while(--_0x3a4ac0){_0x35ecdf['push'](_0x35ecdf['shift']());}};_0x2f9842(++_0xb1aeb7);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x39a66e,_0x3b2081){_0x39a66e=_0x39a66e-0x0;var _0x1401d3=_0xdd4f[_0x39a66e];return _0x1401d3;};'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 3db6470..5b4fbbb 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 _0x5e61=['json','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','Voicemails','UserProfileResource','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','keys','filters','model','query','attributes','fields','length','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','VoiceMail','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','nolimit','mailbox','VoiceMailMessage','findAndCountAll','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end'];(function(_0x99e345,_0x3ab7d2){var _0x1d1487=function(_0x54546a){while(--_0x54546a){_0x99e345['push'](_0x99e345['shift']());}};_0x1d1487(++_0x3ab7d2);}(_0x5e61,0xe2));var _0x15e6=function(_0x22d5c8,_0x19c52e){_0x22d5c8=_0x22d5c8-0x0;var _0x356a41=_0x5e61[_0x22d5c8];return _0x356a41;};'use strict';var pdf=require(_0x15e6('0x0'));var emlformat=require(_0x15e6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x15e6('0x2'));var jsonpatch=require(_0x15e6('0x3'));var rp=require(_0x15e6('0x4'));var moment=require(_0x15e6('0x5'));var BPromise=require(_0x15e6('0x6'));var Mustache=require(_0x15e6('0x7'));var util=require(_0x15e6('0x8'));var path=require(_0x15e6('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x15e6('0xa'));var fs=require('fs');var _=require(_0x15e6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x15e6('0xc'));var toCsv=require(_0x15e6('0xd'));var querystring=require(_0x15e6('0xe'));var Papa=require(_0x15e6('0xf'));var Redis=require('ioredis');var authService=require(_0x15e6('0x10'));var qs=require(_0x15e6('0x11'));var as=require(_0x15e6('0x12'));var hardwareService=require(_0x15e6('0x13'));var logger=require(_0x15e6('0x14'))(_0x15e6('0x15'));var utils=require(_0x15e6('0x16'));var config=require('../../config/environment');var db=require(_0x15e6('0x17'))['db'];function respondWithStatusCode(_0x5bdd43,_0x5938a9){_0x5938a9=_0x5938a9||0xcc;return function(_0x4c5914){if(_0x4c5914){return _0x5bdd43['sendStatus'](_0x5938a9);}return _0x5bdd43[_0x15e6('0x18')](_0x5938a9)[_0x15e6('0x19')]();};}function respondWithResult(_0x118b9b,_0xcd82d7){_0xcd82d7=_0xcd82d7||0xc8;return function(_0x718ed4){if(_0x718ed4){return _0x118b9b['status'](_0xcd82d7)[_0x15e6('0x1a')](_0x718ed4);}};}function respondWithFilteredResult(_0x536aaf,_0xfaebc0){return function(_0x45a718){if(_0x45a718){var _0x2364de=_0x45a718[_0x15e6('0x1b')],_0x142ae0=_0xfaebc0[_0x15e6('0x1c')],_0xc2effb=_0xfaebc0[_0x15e6('0x1c')]+_0xfaebc0[_0x15e6('0x1d')],_0x38f84c;if(_0xc2effb>=_0x2364de){_0xc2effb=_0x2364de;_0x38f84c=0xc8;}else{_0x38f84c=0xce;}_0x536aaf[_0x15e6('0x18')](_0x38f84c);return _0x536aaf[_0x15e6('0x1e')](_0x15e6('0x1f'),_0x142ae0+'-'+_0xc2effb+'/'+_0x2364de)[_0x15e6('0x1a')](_0x45a718);}return null;};}function patchUpdates(_0x392b74){return function(_0x326e6f){try{jsonpatch[_0x15e6('0x20')](_0x326e6f,_0x392b74,!![]);}catch(_0x4205ae){return BPromise['reject'](_0x4205ae);}return _0x326e6f['save']();};}function saveUpdates(_0x150442,_0x472efc){return function(_0x5a5ce9){if(_0x5a5ce9){return _0x5a5ce9[_0x15e6('0x21')](_0x150442)[_0x15e6('0x22')](function(_0x4db68a){return _0x4db68a;});}return null;};}function removeEntity(_0x1f911d,_0x5926a2){return function(_0x251723){if(_0x251723){return _0x251723[_0x15e6('0x23')]()['then'](function(){var _0x5229a0=_0x251723[_0x15e6('0x24')]({'plain':!![]});var _0x32aa46=_0x15e6('0x25');return db[_0x15e6('0x26')]['destroy']({'where':{'type':_0x32aa46,'resourceId':_0x5229a0['id']}})['then'](function(){return _0x251723;});})[_0x15e6('0x22')](function(){_0x1f911d['status'](0xcc)[_0x15e6('0x19')]();});}};}function handleEntityNotFound(_0x155918,_0x392317){return function(_0x5b9a80){if(!_0x5b9a80){_0x155918[_0x15e6('0x27')](0x194);}return _0x5b9a80;};}function handleError(_0x1658c1,_0x20a891){_0x20a891=_0x20a891||0x1f4;return function(_0x56dbd5){logger[_0x15e6('0x28')](_0x56dbd5[_0x15e6('0x29')]);if(_0x56dbd5[_0x15e6('0x2a')]){delete _0x56dbd5['name'];}_0x1658c1[_0x15e6('0x18')](_0x20a891)[_0x15e6('0x2b')](_0x56dbd5);};}exports['index']=function(_0x17d1b3,_0x4cf324){var _0x380ff3={},_0x47b86f={},_0x5d8589={'count':0x0,'rows':[]};var _0xa26f88=_[_0x15e6('0x2c')](db['VoiceMail'][_0x15e6('0x2d')],function(_0x14a4ea){return{'name':_0x14a4ea[_0x15e6('0x2e')],'type':_0x14a4ea[_0x15e6('0x2f')][_0x15e6('0x30')]};});_0x47b86f['model']=_[_0x15e6('0x2c')](_0xa26f88,'name');_0x47b86f['query']=_[_0x15e6('0x31')](_0x17d1b3['query']);_0x47b86f[_0x15e6('0x32')]=_['intersection'](_0x47b86f[_0x15e6('0x33')],_0x47b86f[_0x15e6('0x34')]);_0x380ff3[_0x15e6('0x35')]=_['intersection'](_0x47b86f[_0x15e6('0x33')],qs[_0x15e6('0x36')](_0x17d1b3['query'][_0x15e6('0x36')]));_0x380ff3[_0x15e6('0x35')]=_0x380ff3['attributes'][_0x15e6('0x37')]?_0x380ff3[_0x15e6('0x35')]:_0x47b86f[_0x15e6('0x33')];if(!_0x17d1b3[_0x15e6('0x34')]['hasOwnProperty']('nolimit')){_0x380ff3[_0x15e6('0x1d')]=qs['limit'](_0x17d1b3[_0x15e6('0x34')]['limit']);_0x380ff3[_0x15e6('0x1c')]=qs[_0x15e6('0x1c')](_0x17d1b3[_0x15e6('0x34')][_0x15e6('0x1c')]);}_0x380ff3[_0x15e6('0x38')]=qs[_0x15e6('0x39')](_0x17d1b3[_0x15e6('0x34')][_0x15e6('0x39')]);_0x380ff3[_0x15e6('0x3a')]=qs[_0x15e6('0x32')](_[_0x15e6('0x3b')](_0x17d1b3[_0x15e6('0x34')],_0x47b86f[_0x15e6('0x32')]));if(_0x17d1b3[_0x15e6('0x34')][_0x15e6('0x3c')]){_0x380ff3[_0x15e6('0x3a')]=_[_0x15e6('0x3d')](_0x380ff3[_0x15e6('0x3a')],{'$or':_[_0x15e6('0x2c')](_0xa26f88,function(_0x2d2389){if(_0x2d2389[_0x15e6('0x2f')]!=='VIRTUAL'){var _0x4f27a6={};_0x4f27a6[_0x2d2389[_0x15e6('0x2a')]]={'$like':'%'+_0x17d1b3[_0x15e6('0x34')][_0x15e6('0x3c')]+'%'};return _0x4f27a6;}})});}_0x380ff3=_['merge']({},_0x380ff3,_0x17d1b3[_0x15e6('0x3e')]);var _0x2700d5={'where':_0x380ff3[_0x15e6('0x3a')]};return db['VoiceMail'][_0x15e6('0x1b')](_0x2700d5)[_0x15e6('0x22')](function(_0x2b520b){_0x5d8589[_0x15e6('0x1b')]=_0x2b520b;if(_0x17d1b3[_0x15e6('0x34')]['includeAll']){_0x380ff3[_0x15e6('0x3f')]=[{'all':!![]}];}return db['VoiceMail'][_0x15e6('0x40')](_0x380ff3);})[_0x15e6('0x22')](function(_0x2076e2){_0x5d8589[_0x15e6('0x41')]=_0x2076e2;return _0x5d8589;})[_0x15e6('0x22')](respondWithFilteredResult(_0x4cf324,_0x380ff3))[_0x15e6('0x42')](handleError(_0x4cf324,null));};exports[_0x15e6('0x43')]=function(_0x29f4d2,_0x50135a){var _0x35e309={'raw':!![],'where':{'id':_0x29f4d2[_0x15e6('0x44')]['id']}},_0x1cab8d={};_0x1cab8d['model']=_[_0x15e6('0x31')](db[_0x15e6('0x45')]['rawAttributes']);_0x1cab8d[_0x15e6('0x34')]=_['keys'](_0x29f4d2[_0x15e6('0x34')]);_0x1cab8d[_0x15e6('0x32')]=_[_0x15e6('0x46')](_0x1cab8d[_0x15e6('0x33')],_0x1cab8d[_0x15e6('0x34')]);_0x35e309[_0x15e6('0x35')]=_[_0x15e6('0x46')](_0x1cab8d['model'],qs['fields'](_0x29f4d2[_0x15e6('0x34')][_0x15e6('0x36')]));_0x35e309[_0x15e6('0x35')]=_0x35e309[_0x15e6('0x35')][_0x15e6('0x37')]?_0x35e309[_0x15e6('0x35')]:_0x1cab8d[_0x15e6('0x33')];if(_0x29f4d2['query']['includeAll']){_0x35e309[_0x15e6('0x3f')]=[{'all':!![]}];}_0x35e309=_[_0x15e6('0x3d')]({},_0x35e309,_0x29f4d2[_0x15e6('0x3e')]);return db[_0x15e6('0x45')]['find'](_0x35e309)[_0x15e6('0x22')](handleEntityNotFound(_0x50135a,null))[_0x15e6('0x22')](respondWithResult(_0x50135a,null))['catch'](handleError(_0x50135a,null));};exports[_0x15e6('0x47')]=function(_0x2654a8,_0x3faf2f){return db[_0x15e6('0x45')][_0x15e6('0x47')](_0x2654a8[_0x15e6('0x48')],{})[_0x15e6('0x22')](function(_0x155a37){var _0xfc39c2=_0x2654a8[_0x15e6('0x49')]['get']({'plain':!![]});if(!_0xfc39c2)throw new Error(_0x15e6('0x4a'));if(_0xfc39c2[_0x15e6('0x4b')]==='user'){var _0x14ae9b=_0x155a37['get']({'plain':!![]});var _0x20110c=_0x15e6('0x25');return db['UserProfileSection'][_0x15e6('0x4c')]({'where':{'name':_0x20110c,'userProfileId':_0xfc39c2['userProfileId']},'raw':!![]})[_0x15e6('0x22')](function(_0x19c5a3){if(_0x19c5a3&&_0x19c5a3['autoAssociation']===0x0){return db[_0x15e6('0x26')][_0x15e6('0x47')]({'name':_0x14ae9b[_0x15e6('0x2a')],'resourceId':_0x14ae9b['id'],'type':_0x19c5a3[_0x15e6('0x2a')],'sectionId':_0x19c5a3['id']},{})[_0x15e6('0x22')](function(){return _0x155a37;});}else{return _0x155a37;}})[_0x15e6('0x42')](function(_0xbbf5c0){logger[_0x15e6('0x28')](_0x15e6('0x4d'),_0xbbf5c0);throw _0xbbf5c0;});}return _0x155a37;})[_0x15e6('0x22')](respondWithResult(_0x3faf2f,0xc9))['catch'](handleError(_0x3faf2f,null));};exports[_0x15e6('0x21')]=function(_0x21b970,_0x46c0bf){if(_0x21b970[_0x15e6('0x48')]['id']){delete _0x21b970[_0x15e6('0x48')]['id'];}return db[_0x15e6('0x45')][_0x15e6('0x4c')]({'where':{'id':_0x21b970[_0x15e6('0x44')]['id']}})[_0x15e6('0x22')](handleEntityNotFound(_0x46c0bf,null))[_0x15e6('0x22')](saveUpdates(_0x21b970[_0x15e6('0x48')],null))[_0x15e6('0x22')](respondWithResult(_0x46c0bf,null))[_0x15e6('0x42')](handleError(_0x46c0bf,null));};exports[_0x15e6('0x23')]=function(_0x5f668f,_0xa30324){return db[_0x15e6('0x45')]['find']({'where':{'id':_0x5f668f['params']['id']}})['then'](handleEntityNotFound(_0xa30324,null))[_0x15e6('0x22')](removeEntity(_0xa30324,null))[_0x15e6('0x42')](handleError(_0xa30324,null));};exports[_0x15e6('0x4e')]=function(_0x5a5b12,_0x1c4af4,_0x3b8fa8){return db[_0x15e6('0x45')][_0x15e6('0x4f')]({'where':{'id':_0x5a5b12[_0x15e6('0x44')]['id']}})[_0x15e6('0x22')](handleEntityNotFound(_0x1c4af4,null))[_0x15e6('0x22')](function(_0x50981b){var _0x345fea;var _0x50a743={},_0x39533d={};_0x39533d[_0x15e6('0x33')]=_['keys'](db['VoiceMailMessage'][_0x15e6('0x2d')]);_0x39533d[_0x15e6('0x34')]=_['keys'](_0x5a5b12[_0x15e6('0x34')]);_0x39533d[_0x15e6('0x32')]=_[_0x15e6('0x46')](_0x39533d['model'],_0x39533d['query']);_0x50a743['attributes']=_[_0x15e6('0x46')](_0x39533d[_0x15e6('0x33')],qs[_0x15e6('0x36')](_0x5a5b12[_0x15e6('0x34')][_0x15e6('0x36')]));_0x50a743[_0x15e6('0x35')]=_0x50a743['attributes'][_0x15e6('0x37')]?_0x50a743[_0x15e6('0x35')]:_0x39533d[_0x15e6('0x33')];if(!_0x5a5b12[_0x15e6('0x34')]['hasOwnProperty'](_0x15e6('0x50'))){_0x50a743[_0x15e6('0x1d')]=qs[_0x15e6('0x1d')](_0x5a5b12[_0x15e6('0x34')][_0x15e6('0x1d')]);_0x50a743[_0x15e6('0x1c')]=qs[_0x15e6('0x1c')](_0x5a5b12[_0x15e6('0x34')][_0x15e6('0x1c')]);}_0x50a743['order']=qs[_0x15e6('0x39')](_0x5a5b12[_0x15e6('0x34')][_0x15e6('0x39')]);_0x50a743[_0x15e6('0x3a')]=qs[_0x15e6('0x32')](_[_0x15e6('0x3b')](_0x5a5b12[_0x15e6('0x34')],_0x39533d['filters']));if(_0x5a5b12['query']['filter']){_0x50a743['where']=_['merge'](_0x50a743[_0x15e6('0x3a')],{'$or':_[_0x15e6('0x2c')](_0x50a743[_0x15e6('0x35')],function(_0x23c1fd){var _0x447569={};_0x447569[_0x23c1fd]={'$like':'%'+_0x5a5b12['query']['filter']+'%'};return _0x447569;})});}_0x50a743[_0x15e6('0x3a')]=_[_0x15e6('0x3d')](_0x50a743[_0x15e6('0x3a')],{'mailboxuser':_0x50981b[_0x15e6('0x51')]});_0x50a743=_['merge']({},_0x50a743,_0x5a5b12['options']);return db[_0x15e6('0x52')][_0x15e6('0x53')](_0x50a743)[_0x15e6('0x22')](respondWithFilteredResult(_0x1c4af4,_0x50a743));})[_0x15e6('0x42')](handleError(_0x1c4af4,null));}; \ No newline at end of file +var _0x7333=['html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','end','stack','name','send','index','map','VoiceMail','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','count','include','rows','catch','options','find','create','user','role','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','getMessages','findOne','VoiceMailMessage','sort','mailbox','findAndCountAll'];(function(_0x26ddb6,_0x3db3f9){var _0x3a6b2c=function(_0x144437){while(--_0x144437){_0x26ddb6['push'](_0x26ddb6['shift']());}};_0x3a6b2c(++_0x3db3f9);}(_0x7333,0xfc));var _0x3733=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7333[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0x3733('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3733('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3733('0x2'));var rp=require(_0x3733('0x3'));var moment=require(_0x3733('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3733('0x5'));var util=require(_0x3733('0x6'));var path=require(_0x3733('0x7'));var sox=require('sox');var csv=require(_0x3733('0x8'));var ejs=require(_0x3733('0x9'));var fs=require('fs');var _=require(_0x3733('0xa'));var squel=require(_0x3733('0xb'));var crypto=require('crypto');var jsforce=require(_0x3733('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3733('0x8'));var querystring=require(_0x3733('0xd'));var Papa=require(_0x3733('0xe'));var Redis=require(_0x3733('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3733('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3733('0x11'));var logger=require(_0x3733('0x12'))(_0x3733('0x13'));var utils=require(_0x3733('0x14'));var config=require(_0x3733('0x15'));var db=require(_0x3733('0x16'))['db'];function respondWithStatusCode(_0x303589,_0x1402f8){_0x1402f8=_0x1402f8||0xcc;return function(_0x331f5d){if(_0x331f5d){return _0x303589[_0x3733('0x17')](_0x1402f8);}return _0x303589[_0x3733('0x18')](_0x1402f8)['end']();};}function respondWithResult(_0x58628c,_0x387268){_0x387268=_0x387268||0xc8;return function(_0x2de05f){if(_0x2de05f){return _0x58628c[_0x3733('0x18')](_0x387268)[_0x3733('0x19')](_0x2de05f);}};}function respondWithFilteredResult(_0x46a3cb,_0x46a03e){return function(_0x520008){if(_0x520008){var _0x1fd598=_0x520008['count'],_0x607186=_0x46a03e[_0x3733('0x1a')],_0x42e87f=_0x46a03e[_0x3733('0x1a')]+_0x46a03e[_0x3733('0x1b')],_0xcf12d3;if(_0x42e87f>=_0x1fd598){_0x42e87f=_0x1fd598;_0xcf12d3=0xc8;}else{_0xcf12d3=0xce;}_0x46a3cb[_0x3733('0x18')](_0xcf12d3);return _0x46a3cb['set'](_0x3733('0x1c'),_0x607186+'-'+_0x42e87f+'/'+_0x1fd598)[_0x3733('0x19')](_0x520008);}return null;};}function patchUpdates(_0x37cc11){return function(_0x27b6b2){try{jsonpatch[_0x3733('0x1d')](_0x27b6b2,_0x37cc11,!![]);}catch(_0x1a4e56){return BPromise[_0x3733('0x1e')](_0x1a4e56);}return _0x27b6b2[_0x3733('0x1f')]();};}function saveUpdates(_0x3ad371,_0x48e182){return function(_0x92539){if(_0x92539){return _0x92539[_0x3733('0x20')](_0x3ad371)[_0x3733('0x21')](function(_0x5525f4){return _0x5525f4;});}return null;};}function removeEntity(_0x1c0eed,_0x2fee60){return function(_0x425495){if(_0x425495){return _0x425495[_0x3733('0x22')]()[_0x3733('0x21')](function(){var _0x17e23b=_0x425495[_0x3733('0x23')]({'plain':!![]});var _0x48826c=_0x3733('0x24');return db['UserProfileResource'][_0x3733('0x22')]({'where':{'type':_0x48826c,'resourceId':_0x17e23b['id']}})[_0x3733('0x21')](function(){return _0x425495;});})[_0x3733('0x21')](function(){_0x1c0eed[_0x3733('0x18')](0xcc)[_0x3733('0x25')]();});}};}function handleEntityNotFound(_0xf21aa9,_0x34a572){return function(_0x42cdc6){if(!_0x42cdc6){_0xf21aa9[_0x3733('0x17')](0x194);}return _0x42cdc6;};}function handleError(_0x52ed95,_0x1ce6c1){_0x1ce6c1=_0x1ce6c1||0x1f4;return function(_0x4a55e5){logger['error'](_0x4a55e5[_0x3733('0x26')]);if(_0x4a55e5[_0x3733('0x27')]){delete _0x4a55e5[_0x3733('0x27')];}_0x52ed95['status'](_0x1ce6c1)[_0x3733('0x28')](_0x4a55e5);};}exports[_0x3733('0x29')]=function(_0x1a8a88,_0x2be841){var _0x13b66e={},_0x1054bb={},_0x2fc431={'count':0x0,'rows':[]};var _0x4e4bb6=_[_0x3733('0x2a')](db[_0x3733('0x2b')][_0x3733('0x2c')],function(_0x934ddc){return{'name':_0x934ddc['fieldName'],'type':_0x934ddc['type'][_0x3733('0x2d')]};});_0x1054bb['model']=_[_0x3733('0x2a')](_0x4e4bb6,'name');_0x1054bb[_0x3733('0x2e')]=_[_0x3733('0x2f')](_0x1a8a88[_0x3733('0x2e')]);_0x1054bb[_0x3733('0x30')]=_[_0x3733('0x31')](_0x1054bb[_0x3733('0x32')],_0x1054bb[_0x3733('0x2e')]);_0x13b66e[_0x3733('0x33')]=_['intersection'](_0x1054bb[_0x3733('0x32')],qs[_0x3733('0x34')](_0x1a8a88[_0x3733('0x2e')][_0x3733('0x34')]));_0x13b66e[_0x3733('0x33')]=_0x13b66e[_0x3733('0x33')][_0x3733('0x35')]?_0x13b66e[_0x3733('0x33')]:_0x1054bb[_0x3733('0x32')];if(!_0x1a8a88[_0x3733('0x2e')][_0x3733('0x36')](_0x3733('0x37'))){_0x13b66e[_0x3733('0x1b')]=qs[_0x3733('0x1b')](_0x1a8a88[_0x3733('0x2e')]['limit']);_0x13b66e[_0x3733('0x1a')]=qs[_0x3733('0x1a')](_0x1a8a88[_0x3733('0x2e')][_0x3733('0x1a')]);}_0x13b66e[_0x3733('0x38')]=qs['sort'](_0x1a8a88[_0x3733('0x2e')]['sort']);_0x13b66e[_0x3733('0x39')]=qs[_0x3733('0x30')](_[_0x3733('0x3a')](_0x1a8a88['query'],_0x1054bb[_0x3733('0x30')]));if(_0x1a8a88['query'][_0x3733('0x3b')]){_0x13b66e[_0x3733('0x39')]=_['merge'](_0x13b66e[_0x3733('0x39')],{'$or':_[_0x3733('0x2a')](_0x4e4bb6,function(_0x1df545){if(_0x1df545['type']!==_0x3733('0x3c')){var _0x4678e1={};_0x4678e1[_0x1df545[_0x3733('0x27')]]={'$like':'%'+_0x1a8a88[_0x3733('0x2e')][_0x3733('0x3b')]+'%'};return _0x4678e1;}})});}_0x13b66e=_[_0x3733('0x3d')]({},_0x13b66e,_0x1a8a88['options']);var _0x44eecf={'where':_0x13b66e['where']};return db['VoiceMail'][_0x3733('0x3e')](_0x44eecf)[_0x3733('0x21')](function(_0x837f0c){_0x2fc431[_0x3733('0x3e')]=_0x837f0c;if(_0x1a8a88[_0x3733('0x2e')]['includeAll']){_0x13b66e[_0x3733('0x3f')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x13b66e);})[_0x3733('0x21')](function(_0x125259){_0x2fc431[_0x3733('0x40')]=_0x125259;return _0x2fc431;})[_0x3733('0x21')](respondWithFilteredResult(_0x2be841,_0x13b66e))[_0x3733('0x41')](handleError(_0x2be841,null));};exports['show']=function(_0x58b5b5,_0x3d5a00){var _0x3b0f86={'raw':!![],'where':{'id':_0x58b5b5['params']['id']}},_0x4a9532={};_0x4a9532['model']=_['keys'](db['VoiceMail'][_0x3733('0x2c')]);_0x4a9532['query']=_['keys'](_0x58b5b5['query']);_0x4a9532['filters']=_[_0x3733('0x31')](_0x4a9532[_0x3733('0x32')],_0x4a9532[_0x3733('0x2e')]);_0x3b0f86['attributes']=_[_0x3733('0x31')](_0x4a9532[_0x3733('0x32')],qs[_0x3733('0x34')](_0x58b5b5['query'][_0x3733('0x34')]));_0x3b0f86[_0x3733('0x33')]=_0x3b0f86[_0x3733('0x33')][_0x3733('0x35')]?_0x3b0f86['attributes']:_0x4a9532[_0x3733('0x32')];if(_0x58b5b5[_0x3733('0x2e')]['includeAll']){_0x3b0f86['include']=[{'all':!![]}];}_0x3b0f86=_['merge']({},_0x3b0f86,_0x58b5b5[_0x3733('0x42')]);return db[_0x3733('0x2b')][_0x3733('0x43')](_0x3b0f86)[_0x3733('0x21')](handleEntityNotFound(_0x3d5a00,null))[_0x3733('0x21')](respondWithResult(_0x3d5a00,null))['catch'](handleError(_0x3d5a00,null));};exports[_0x3733('0x44')]=function(_0x31f762,_0x4fbf8d){return db['VoiceMail'][_0x3733('0x44')](_0x31f762['body'],{})[_0x3733('0x21')](function(_0x1f4c86){var _0x10bdd9=_0x31f762[_0x3733('0x45')]['get']({'plain':!![]});if(!_0x10bdd9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10bdd9[_0x3733('0x46')]==='user'){var _0x4014d8=_0x1f4c86['get']({'plain':!![]});var _0x262f17='Voicemails';return db[_0x3733('0x47')]['find']({'where':{'name':_0x262f17,'userProfileId':_0x10bdd9[_0x3733('0x48')]},'raw':!![]})['then'](function(_0x25c042){if(_0x25c042&&_0x25c042['autoAssociation']===0x0){return db[_0x3733('0x49')][_0x3733('0x44')]({'name':_0x4014d8[_0x3733('0x27')],'resourceId':_0x4014d8['id'],'type':_0x25c042[_0x3733('0x27')],'sectionId':_0x25c042['id']},{})[_0x3733('0x21')](function(){return _0x1f4c86;});}else{return _0x1f4c86;}})[_0x3733('0x41')](function(_0x5babbc){logger[_0x3733('0x4a')](_0x3733('0x4b'),_0x5babbc);throw _0x5babbc;});}return _0x1f4c86;})[_0x3733('0x21')](respondWithResult(_0x4fbf8d,0xc9))[_0x3733('0x41')](handleError(_0x4fbf8d,null));};exports[_0x3733('0x20')]=function(_0x22cc8b,_0x3f0e22){if(_0x22cc8b['body']['id']){delete _0x22cc8b['body']['id'];}return db[_0x3733('0x2b')]['find']({'where':{'id':_0x22cc8b[_0x3733('0x4c')]['id']}})[_0x3733('0x21')](handleEntityNotFound(_0x3f0e22,null))[_0x3733('0x21')](saveUpdates(_0x22cc8b[_0x3733('0x4d')],null))['then'](respondWithResult(_0x3f0e22,null))[_0x3733('0x41')](handleError(_0x3f0e22,null));};exports[_0x3733('0x22')]=function(_0x2233af,_0x2d205c){return db['VoiceMail'][_0x3733('0x43')]({'where':{'id':_0x2233af[_0x3733('0x4c')]['id']}})[_0x3733('0x21')](handleEntityNotFound(_0x2d205c,null))[_0x3733('0x21')](removeEntity(_0x2d205c,null))[_0x3733('0x41')](handleError(_0x2d205c,null));};exports[_0x3733('0x4e')]=function(_0x15fc52,_0x41ec00,_0x251ce4){return db[_0x3733('0x2b')][_0x3733('0x4f')]({'where':{'id':_0x15fc52['params']['id']}})[_0x3733('0x21')](handleEntityNotFound(_0x41ec00,null))[_0x3733('0x21')](function(_0x43110a){var _0x18b4b1;var _0x2af095={},_0x56baf0={};_0x56baf0[_0x3733('0x32')]=_['keys'](db[_0x3733('0x50')]['rawAttributes']);_0x56baf0[_0x3733('0x2e')]=_[_0x3733('0x2f')](_0x15fc52[_0x3733('0x2e')]);_0x56baf0[_0x3733('0x30')]=_[_0x3733('0x31')](_0x56baf0[_0x3733('0x32')],_0x56baf0[_0x3733('0x2e')]);_0x2af095[_0x3733('0x33')]=_['intersection'](_0x56baf0[_0x3733('0x32')],qs['fields'](_0x15fc52[_0x3733('0x2e')]['fields']));_0x2af095['attributes']=_0x2af095['attributes']['length']?_0x2af095['attributes']:_0x56baf0[_0x3733('0x32')];if(!_0x15fc52[_0x3733('0x2e')][_0x3733('0x36')](_0x3733('0x37'))){_0x2af095[_0x3733('0x1b')]=qs['limit'](_0x15fc52[_0x3733('0x2e')][_0x3733('0x1b')]);_0x2af095[_0x3733('0x1a')]=qs[_0x3733('0x1a')](_0x15fc52[_0x3733('0x2e')][_0x3733('0x1a')]);}_0x2af095[_0x3733('0x38')]=qs['sort'](_0x15fc52[_0x3733('0x2e')][_0x3733('0x51')]);_0x2af095[_0x3733('0x39')]=qs[_0x3733('0x30')](_[_0x3733('0x3a')](_0x15fc52['query'],_0x56baf0[_0x3733('0x30')]));if(_0x15fc52[_0x3733('0x2e')][_0x3733('0x3b')]){_0x2af095[_0x3733('0x39')]=_[_0x3733('0x3d')](_0x2af095[_0x3733('0x39')],{'$or':_[_0x3733('0x2a')](_0x2af095[_0x3733('0x33')],function(_0x50cfa1){var _0x3d2a38={};_0x3d2a38[_0x50cfa1]={'$like':'%'+_0x15fc52[_0x3733('0x2e')]['filter']+'%'};return _0x3d2a38;})});}_0x2af095[_0x3733('0x39')]=_['merge'](_0x2af095[_0x3733('0x39')],{'mailboxuser':_0x43110a[_0x3733('0x52')]});_0x2af095=_[_0x3733('0x3d')]({},_0x2af095,_0x15fc52[_0x3733('0x42')]);return db[_0x3733('0x50')][_0x3733('0x53')](_0x2af095)[_0x3733('0x21')](respondWithFilteredResult(_0x41ec00,_0x2af095));})['catch'](handleError(_0x41ec00,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 93263c9..6bf2560 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 _0xf57e=['api','moment','request-promise','path','exports','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger'];(function(_0x2ceea8,_0x49dbd5){var _0x329547=function(_0x393602){while(--_0x393602){_0x2ceea8['push'](_0x2ceea8['shift']());}};_0x329547(++_0x49dbd5);}(_0xf57e,0x1e9));var _0xef57=function(_0x4f4dd1,_0x1a3142){_0x4f4dd1=_0x4f4dd1-0x0;var _0x12d105=_0xf57e[_0x4f4dd1];return _0x12d105;};'use strict';var _=require(_0xef57('0x0'));var util=require(_0xef57('0x1'));var logger=require(_0xef57('0x2'))(_0xef57('0x3'));var moment=require(_0xef57('0x4'));var BPromise=require('bluebird');var rp=require(_0xef57('0x5'));var fs=require('fs');var path=require(_0xef57('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0xef57('0x7')]=function(_0x3da419,_0x5ee7e5){return _0x3da419['define']('VoiceMail',attributes,{'tableName':_0xef57('0x8'),'paranoid':![],'indexes':[{'name':_0xef57('0x9'),'fields':[_0xef57('0xa'),_0xef57('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2faf=['rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x55f2d9,_0x525684){var _0xce8e80=function(_0x2b1973){while(--_0x2b1973){_0x55f2d9['push'](_0x55f2d9['shift']());}};_0xce8e80(++_0x525684);}(_0x2faf,0xb0));var _0xf2fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2faf[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf2fa('0x0'));var util=require(_0xf2fa('0x1'));var logger=require(_0xf2fa('0x2'))('api');var moment=require(_0xf2fa('0x3'));var BPromise=require(_0xf2fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2fa('0x5'));var rimraf=require(_0xf2fa('0x6'));var config=require(_0xf2fa('0x7'));var attributes=require(_0xf2fa('0x8'));module[_0xf2fa('0x9')]=function(_0x33c832,_0x44d406){return _0x33c832['define'](_0xf2fa('0xa'),attributes,{'tableName':_0xf2fa('0xb'),'paranoid':![],'indexes':[{'name':_0xf2fa('0xc'),'fields':[_0xf2fa('0xd'),'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 5b23a32..ab70285 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 _0x1952=['VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1e9193,_0x5cf170){var _0x367675=function(_0x49b40a){while(--_0x49b40a){_0x1e9193['push'](_0x1e9193['shift']());}};_0x367675(++_0x5cf170);}(_0x1952,0x1a8));var _0x2195=function(_0x3acdec,_0x4813b4){_0x3acdec=_0x3acdec-0x0;var _0x5ec9f9=_0x1952[_0x3acdec];return _0x5ec9f9;};'use strict';var _=require(_0x2195('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2195('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2195('0x2'))['db'];var utils=require(_0x2195('0x3'));var logger=require(_0x2195('0x4'))(_0x2195('0x5'));var config=require(_0x2195('0x6'));var jayson=require(_0x2195('0x7'));var client=jayson[_0x2195('0x8')][_0x2195('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a2ca3,_0x58e74b,_0x3be3f1){return new BPromise(function(_0xf55728,_0x7421b){return client[_0x2195('0xa')](_0x5a2ca3,_0x3be3f1)[_0x2195('0xb')](function(_0x3fd5d9){logger[_0x2195('0xc')](_0x2195('0xd'),_0x58e74b,_0x2195('0xe'));logger[_0x2195('0xf')](_0x2195('0x10'),_0x58e74b,'request\x20sent',JSON['stringify'](_0x3fd5d9));if(_0x3fd5d9[_0x2195('0x11')]){if(_0x3fd5d9[_0x2195('0x11')][_0x2195('0x12')]===0x1f4){logger[_0x2195('0x11')]('VoiceMail,\x20%s,\x20%s',_0x58e74b,_0x3fd5d9[_0x2195('0x11')]['message']);return _0x7421b(_0x3fd5d9[_0x2195('0x11')][_0x2195('0x13')]);}logger[_0x2195('0x11')]('VoiceMail,\x20%s,\x20%s',_0x58e74b,_0x3fd5d9[_0x2195('0x11')]['message']);return _0xf55728(_0x3fd5d9[_0x2195('0x11')][_0x2195('0x13')]);}else{logger[_0x2195('0xc')](_0x2195('0xd'),_0x58e74b,_0x2195('0xe'));_0xf55728(_0x3fd5d9['result'][_0x2195('0x13')]);}})['catch'](function(_0x22eb13){logger[_0x2195('0x11')](_0x2195('0xd'),_0x58e74b,_0x22eb13);_0x7421b(_0x22eb13);});});} \ No newline at end of file +var _0x8507=['info','debug','request\x20sent','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then'];(function(_0x1fbf1c,_0x46cccc){var _0x11a5e4=function(_0x207739){while(--_0x207739){_0x1fbf1c['push'](_0x1fbf1c['shift']());}};_0x11a5e4(++_0x46cccc);}(_0x8507,0x1c2));var _0x7850=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8507[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7850('0x0'));var util=require(_0x7850('0x1'));var moment=require(_0x7850('0x2'));var BPromise=require(_0x7850('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7850('0x4'));var db=require(_0x7850('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7850('0x6'))(_0x7850('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7850('0x8')][_0x7850('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f0fdf,_0x13baac,_0x259f15){return new BPromise(function(_0x48af8b,_0x11a3c7){return client[_0x7850('0xa')](_0x2f0fdf,_0x259f15)[_0x7850('0xb')](function(_0x3b8cf1){logger[_0x7850('0xc')]('VoiceMail,\x20%s,\x20%s',_0x13baac,'request\x20sent');logger[_0x7850('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x13baac,_0x7850('0xe'),JSON[_0x7850('0xf')](_0x3b8cf1));if(_0x3b8cf1[_0x7850('0x10')]){if(_0x3b8cf1[_0x7850('0x10')][_0x7850('0x11')]===0x1f4){logger['error'](_0x7850('0x12'),_0x13baac,_0x3b8cf1[_0x7850('0x10')][_0x7850('0x13')]);return _0x11a3c7(_0x3b8cf1['error'][_0x7850('0x13')]);}logger['error'](_0x7850('0x12'),_0x13baac,_0x3b8cf1['error'][_0x7850('0x13')]);return _0x48af8b(_0x3b8cf1[_0x7850('0x10')][_0x7850('0x13')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x13baac,_0x7850('0xe'));_0x48af8b(_0x3b8cf1[_0x7850('0x14')][_0x7850('0x13')]);}})[_0x7850('0x15')](function(_0x5631c2){logger[_0x7850('0x10')](_0x7850('0x12'),_0x13baac,_0x5631c2);_0x11a3c7(_0x5631c2);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 9b41f11..207a0a3 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 _0x1261=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id','show','/:id/download','isAuthenticated','download','create','put','destroy'];(function(_0x1a6007,_0x350755){var _0x120665=function(_0x51e6ba){while(--_0x51e6ba){_0x1a6007['push'](_0x1a6007['shift']());}};_0x120665(++_0x350755);}(_0x1261,0x144));var _0x1126=function(_0x5ab340,_0x3bf3e4){_0x5ab340=_0x5ab340-0x0;var _0x2ed5b7=_0x1261[_0x5ab340];return _0x2ed5b7;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var auth=require(_0x1126('0x5'));var interaction=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var controller=require(_0x1126('0x8'));router[_0x1126('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1126('0x9')](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0xb')]);router[_0x1126('0x9')](_0x1126('0xc'),auth[_0x1126('0xd')](),controller[_0x1126('0xe')]);router['post']('/',auth[_0x1126('0xd')](),controller[_0x1126('0xf')]);router[_0x1126('0x10')]('/:id',auth[_0x1126('0xd')](),controller['update']);router['delete'](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0x11')]);module[_0x1126('0x12')]=router; \ No newline at end of file +var _0xda19=['index','/:id','show','post','create','put','update','delete','exports','util','path','express','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated'];(function(_0x402205,_0x2f6a8d){var _0xe6cab2=function(_0x1074c9){while(--_0x1074c9){_0x402205['push'](_0x402205['shift']());}};_0xe6cab2(++_0x2f6a8d);}(_0xda19,0xd5));var _0x9da1=function(_0x29a2af,_0x6e088c){_0x29a2af=_0x29a2af-0x0;var _0x12e4b9=_0xda19[_0x29a2af];return _0x12e4b9;};'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')]('/',auth[_0x9da1('0x7')](),controller[_0x9da1('0x8')]);router[_0x9da1('0x6')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xa')]);router[_0x9da1('0x6')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x9da1('0xb')]('/',auth['isAuthenticated'](),controller[_0x9da1('0xc')]);router[_0x9da1('0xd')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xe')]);router[_0x9da1('0xf')](_0x9da1('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x9da1('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index b2fed62..12263bb 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 _0x1b87=['BLOB','long','TIMESTAMP','getDataValue','INTEGER','STRING'];(function(_0x844537,_0x1b742b){var _0x216b00=function(_0x350682){while(--_0x350682){_0x844537['push'](_0x844537['shift']());}};_0x216b00(++_0x1b742b);}(_0x1b87,0xff));var _0x71b8=function(_0x139a4f,_0x5c6d66){_0x139a4f=_0x139a4f-0x0;var _0x46ed1c=_0x1b87[_0x139a4f];return _0x46ed1c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5639fb){return this[_0x71b8('0x0')]('id');}},'msgnum':{'type':Sequelize[_0x71b8('0x1')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x71b8('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0x71b8('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x71b8('0x2')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x71b8('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x71b8('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0x71b8('0x3')](_0x71b8('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x71b8('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x71b8('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0x8837=['STRING','BLOB','long','TIMESTAMP','sequelize','exports','VIRTUAL','INTEGER'];(function(_0x162e12,_0x4b44f0){var _0x35841f=function(_0x481007){while(--_0x481007){_0x162e12['push'](_0x162e12['shift']());}};_0x35841f(++_0x4b44f0);}(_0x8837,0x1c4));var _0x7883=function(_0x424e84,_0x832b1e){_0x424e84=_0x424e84-0x0;var _0x228894=_0x8837[_0x424e84];return _0x228894;};'use strict';var Sequelize=require(_0x7883('0x0'));module[_0x7883('0x1')]={'name':{'type':Sequelize[_0x7883('0x2')],'get':function(_0x59fd81){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x7883('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x7883('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x7883('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x7883('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x7883('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x7883('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x7883('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x7883('0x5')](_0x7883('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x7883('0x4')],'defaultValue':''},'stamp':{'type':_0x7883('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 fa29df3..be54df3 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 _0xe107=['params','find','catch','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','differenceBy','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show'];(function(_0x211a36,_0x336c20){var _0x2c4c32=function(_0x16f493){while(--_0x16f493){_0x211a36['push'](_0x211a36['shift']());}};_0x2c4c32(++_0x336c20);}(_0xe107,0xb3));var _0x7e10=function(_0x44078a,_0x5f3a5f){_0x44078a=_0x44078a-0x0;var _0x3f72d7=_0xe107[_0x44078a];return _0x3f72d7;};'use strict';var pdf=require(_0x7e10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7e10('0x1'));var zipdir=require(_0x7e10('0x2'));var jsonpatch=require(_0x7e10('0x3'));var rp=require('request-promise');var moment=require(_0x7e10('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7e10('0x5'));var path=require(_0x7e10('0x6'));var sox=require(_0x7e10('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7e10('0x8'));var squel=require(_0x7e10('0x9'));var crypto=require(_0x7e10('0xa'));var jsforce=require(_0x7e10('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7e10('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7e10('0xd'));var qs=require(_0x7e10('0xe'));var as=require(_0x7e10('0xf'));var hardwareService=require(_0x7e10('0x10'));var logger=require(_0x7e10('0x11'))('api');var utils=require(_0x7e10('0x12'));var config=require('../../config/environment');var db=require(_0x7e10('0x13'))['db'];function respondWithStatusCode(_0x2ca84c,_0x2f4d72){_0x2f4d72=_0x2f4d72||0xcc;return function(_0x5434dd){if(_0x5434dd){return _0x2ca84c[_0x7e10('0x14')](_0x2f4d72);}return _0x2ca84c[_0x7e10('0x15')](_0x2f4d72)[_0x7e10('0x16')]();};}function respondWithResult(_0x3ec8d9,_0x119ff5){_0x119ff5=_0x119ff5||0xc8;return function(_0x1b4d9d){if(_0x1b4d9d){return _0x3ec8d9[_0x7e10('0x15')](_0x119ff5)[_0x7e10('0x17')](_0x1b4d9d);}};}function respondWithFilteredResult(_0x5e41b7,_0x15e9e5){return function(_0x433221){if(_0x433221){var _0x4bd78a=_0x433221[_0x7e10('0x18')],_0x48339f=_0x15e9e5[_0x7e10('0x19')],_0x4f5666=_0x15e9e5[_0x7e10('0x19')]+_0x15e9e5[_0x7e10('0x1a')],_0x4b717e;if(_0x4f5666>=_0x4bd78a){_0x4f5666=_0x4bd78a;_0x4b717e=0xc8;}else{_0x4b717e=0xce;}_0x5e41b7['status'](_0x4b717e);return _0x5e41b7[_0x7e10('0x1b')](_0x7e10('0x1c'),_0x48339f+'-'+_0x4f5666+'/'+_0x4bd78a)[_0x7e10('0x17')](_0x433221);}return null;};}function patchUpdates(_0x5d9da3){return function(_0x3b9ea2){try{jsonpatch[_0x7e10('0x1d')](_0x3b9ea2,_0x5d9da3,!![]);}catch(_0x157b22){return BPromise[_0x7e10('0x1e')](_0x157b22);}return _0x3b9ea2[_0x7e10('0x1f')]();};}function saveUpdates(_0x580ac7,_0x45a0cb){return function(_0x2c6227){if(_0x2c6227){return _0x2c6227['update'](_0x580ac7)[_0x7e10('0x20')](function(_0x39daf6){return _0x39daf6;});}return null;};}function removeEntity(_0x29405c,_0x482faa){return function(_0x4a667b){if(_0x4a667b){return _0x4a667b[_0x7e10('0x21')]()[_0x7e10('0x20')](function(){_0x29405c[_0x7e10('0x15')](0xcc)[_0x7e10('0x16')]();});}};}function handleEntityNotFound(_0x35e7c9,_0x105a55){return function(_0x12c36d){if(!_0x12c36d){_0x35e7c9[_0x7e10('0x14')](0x194);}return _0x12c36d;};}function handleError(_0x5d7586,_0x4ad422){_0x4ad422=_0x4ad422||0x1f4;return function(_0x11e9cc){logger[_0x7e10('0x22')](_0x11e9cc[_0x7e10('0x23')]);if(_0x11e9cc[_0x7e10('0x24')]){delete _0x11e9cc['name'];}_0x5d7586['status'](_0x4ad422)[_0x7e10('0x25')](_0x11e9cc);};}exports[_0x7e10('0x26')]=function(_0x31bbf2,_0x13c7d4){var _0x10f93d={},_0xfd3e87={},_0x330103={'count':0x0,'rows':[]};var _0x116d00=_[_0x7e10('0x27')](db[_0x7e10('0x28')][_0x7e10('0x29')],function(_0x4e225d){return{'name':_0x4e225d[_0x7e10('0x2a')],'type':_0x4e225d[_0x7e10('0x2b')]['key']};});_0xfd3e87['model']=_[_0x7e10('0x2c')](_[_0x7e10('0x27')](_0x116d00,'name'),[_0x7e10('0x24')]);_0xfd3e87['query']=_[_0x7e10('0x2d')](_0x31bbf2[_0x7e10('0x2e')]);_0xfd3e87[_0x7e10('0x2f')]=_[_0x7e10('0x30')](_0xfd3e87[_0x7e10('0x31')],_0xfd3e87[_0x7e10('0x2e')]);_0x10f93d['attributes']=_[_0x7e10('0x30')](_0xfd3e87['model'],qs[_0x7e10('0x32')](_0x31bbf2[_0x7e10('0x2e')][_0x7e10('0x32')]));_0x10f93d[_0x7e10('0x33')]=_0x10f93d[_0x7e10('0x33')][_0x7e10('0x34')]?_0x10f93d[_0x7e10('0x33')]:_0xfd3e87[_0x7e10('0x31')];if(!_0x31bbf2[_0x7e10('0x2e')]['hasOwnProperty'](_0x7e10('0x35'))){_0x10f93d[_0x7e10('0x1a')]=qs[_0x7e10('0x1a')](_0x31bbf2[_0x7e10('0x2e')][_0x7e10('0x1a')]);_0x10f93d['offset']=qs[_0x7e10('0x19')](_0x31bbf2[_0x7e10('0x2e')][_0x7e10('0x19')]);}_0x10f93d[_0x7e10('0x36')]=qs['sort'](_0x31bbf2['query'][_0x7e10('0x37')]);_0x10f93d[_0x7e10('0x38')]=qs[_0x7e10('0x2f')](_[_0x7e10('0x39')](_0x31bbf2['query'],_0xfd3e87[_0x7e10('0x2f')]));if(_0x31bbf2[_0x7e10('0x2e')]['filter']){_0x10f93d[_0x7e10('0x38')]=_[_0x7e10('0x3a')](_0x10f93d['where'],{'$or':_['map'](_0x116d00,function(_0x4d5aaa){if(_0x4d5aaa[_0x7e10('0x2b')]!==_0x7e10('0x3b')){var _0x299c76={};_0x299c76[_0x4d5aaa[_0x7e10('0x24')]]={'$like':'%'+_0x31bbf2[_0x7e10('0x2e')][_0x7e10('0x3c')]+'%'};return _0x299c76;}})});}_0x10f93d=_[_0x7e10('0x3a')]({},_0x10f93d,_0x31bbf2[_0x7e10('0x3d')]);var _0x5e120f={'where':_0x10f93d[_0x7e10('0x38')]};return db[_0x7e10('0x28')][_0x7e10('0x18')](_0x5e120f)[_0x7e10('0x20')](function(_0x4ebf4a){_0x330103[_0x7e10('0x18')]=_0x4ebf4a;if(_0x31bbf2[_0x7e10('0x2e')][_0x7e10('0x3e')]){_0x10f93d[_0x7e10('0x3f')]=[{'all':!![]}];}return db[_0x7e10('0x28')][_0x7e10('0x40')](_0x10f93d);})[_0x7e10('0x20')](function(_0x58d4ca){_0x330103[_0x7e10('0x41')]=_0x58d4ca;return _0x330103;})[_0x7e10('0x20')](respondWithFilteredResult(_0x13c7d4,_0x10f93d))['catch'](handleError(_0x13c7d4,null));};exports[_0x7e10('0x42')]=function(_0x5c62ac,_0x25a9fc){var _0x548235={'raw':!![],'where':{'id':_0x5c62ac[_0x7e10('0x43')]['id']}},_0x1306fe={};_0x1306fe[_0x7e10('0x31')]=_[_0x7e10('0x2d')](db[_0x7e10('0x28')]['rawAttributes']);_0x1306fe[_0x7e10('0x2e')]=_[_0x7e10('0x2d')](_0x5c62ac[_0x7e10('0x2e')]);_0x1306fe[_0x7e10('0x2f')]=_[_0x7e10('0x30')](_0x1306fe['model'],_0x1306fe[_0x7e10('0x2e')]);_0x548235[_0x7e10('0x33')]=_['intersection'](_0x1306fe['model'],qs[_0x7e10('0x32')](_0x5c62ac[_0x7e10('0x2e')]['fields']));_0x548235[_0x7e10('0x33')]=_0x548235['attributes'][_0x7e10('0x34')]?_0x548235['attributes']:_0x1306fe[_0x7e10('0x31')];if(_0x5c62ac[_0x7e10('0x2e')]['includeAll']){_0x548235['include']=[{'all':!![]}];}_0x548235=_['merge']({},_0x548235,_0x5c62ac['options']);return db['VoiceMailMessage'][_0x7e10('0x44')](_0x548235)[_0x7e10('0x20')](handleEntityNotFound(_0x25a9fc,null))[_0x7e10('0x20')](respondWithResult(_0x25a9fc,null))[_0x7e10('0x45')](handleError(_0x25a9fc,null));};exports[_0x7e10('0x46')]=function(_0x49d773,_0x7d6206){return db['VoiceMailMessage'][_0x7e10('0x46')](_0x49d773[_0x7e10('0x47')],{})[_0x7e10('0x20')](respondWithResult(_0x7d6206,0xc9))[_0x7e10('0x45')](handleError(_0x7d6206,null));};exports['update']=function(_0x5d96be,_0x2d1113){if(_0x5d96be[_0x7e10('0x47')]['id']){delete _0x5d96be['body']['id'];}return db['VoiceMailMessage'][_0x7e10('0x44')]({'where':{'id':_0x5d96be[_0x7e10('0x43')]['id']}})[_0x7e10('0x20')](handleEntityNotFound(_0x2d1113,null))[_0x7e10('0x20')](saveUpdates(_0x5d96be[_0x7e10('0x47')],null))[_0x7e10('0x20')](respondWithResult(_0x2d1113,null))[_0x7e10('0x45')](handleError(_0x2d1113,null));};exports[_0x7e10('0x21')]=function(_0x5900f4,_0x3a72ad){return db['VoiceMailMessage'][_0x7e10('0x44')]({'where':{'id':_0x5900f4[_0x7e10('0x43')]['id']}})[_0x7e10('0x20')](handleEntityNotFound(_0x3a72ad,null))['then'](removeEntity(_0x3a72ad,null))['catch'](handleError(_0x3a72ad,null));};exports[_0x7e10('0x48')]=function(_0x2edc73,_0x46eb48,_0x18d9fc){return db[_0x7e10('0x28')]['find']({'where':{'id':_0x2edc73[_0x7e10('0x43')]['id']},'attributes':['id','recording','msg_id']})[_0x7e10('0x20')](handleEntityNotFound(_0x46eb48,null))[_0x7e10('0x20')](function(_0x4a532f){if(_0x4a532f){if(!_0x4a532f[_0x7e10('0x49')]){throw new db[(_0x7e10('0x4a'))][(_0x7e10('0x4b'))](_0x7e10('0x4c'));}var _0xcc26e8={'Content-Type':_0x7e10('0x4d'),'Content-Disposition':'attachment'};if(_0x4a532f[_0x7e10('0x4e')]){_0xcc26e8[_0x7e10('0x4f')]=_0x7e10('0x50')+_0x4a532f[_0x7e10('0x4e')]+_0x7e10('0x51');}_0x46eb48[_0x7e10('0x1b')](_0xcc26e8);return _0x46eb48[_0x7e10('0x25')](new Buffer(_0x4a532f['recording']));}})[_0x7e10('0x45')](handleError(_0x46eb48,null));}; \ No newline at end of file +var _0x9f62=['includeAll','findAll','catch','show','include','options','find','create','body','update','params','download','recording','Sequelize','ValidationError','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','then','destroy','error','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x23e33d,_0x31c8c8){var _0x818fc=function(_0x19f33e){while(--_0x19f33e){_0x23e33d['push'](_0x23e33d['shift']());}};_0x818fc(++_0x31c8c8);}(_0x9f62,0x154));var _0x29f6=function(_0x289921,_0x15f55c){_0x289921=_0x289921-0x0;var _0x29bb5a=_0x9f62[_0x289921];return _0x29bb5a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x29f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x29f6('0x1'));var jsonpatch=require(_0x29f6('0x2'));var rp=require(_0x29f6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x29f6('0x4'));var util=require(_0x29f6('0x5'));var path=require(_0x29f6('0x6'));var sox=require(_0x29f6('0x7'));var csv=require('to-csv');var ejs=require(_0x29f6('0x8'));var fs=require('fs');var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b9b6a,_0x559585){_0x559585=_0x559585||0xcc;return function(_0x57b2d2){if(_0x57b2d2){return _0x5b9b6a[_0x29f6('0x13')](_0x559585);}return _0x5b9b6a[_0x29f6('0x14')](_0x559585)[_0x29f6('0x15')]();};}function respondWithResult(_0x11a1fd,_0x17de6e){_0x17de6e=_0x17de6e||0xc8;return function(_0x156c96){if(_0x156c96){return _0x11a1fd[_0x29f6('0x14')](_0x17de6e)[_0x29f6('0x16')](_0x156c96);}};}function respondWithFilteredResult(_0x1ae582,_0x19331f){return function(_0x28d314){if(_0x28d314){var _0x370484=_0x28d314[_0x29f6('0x17')],_0x1dde97=_0x19331f[_0x29f6('0x18')],_0x3a75d0=_0x19331f['offset']+_0x19331f['limit'],_0x25e5a2;if(_0x3a75d0>=_0x370484){_0x3a75d0=_0x370484;_0x25e5a2=0xc8;}else{_0x25e5a2=0xce;}_0x1ae582[_0x29f6('0x14')](_0x25e5a2);return _0x1ae582[_0x29f6('0x19')](_0x29f6('0x1a'),_0x1dde97+'-'+_0x3a75d0+'/'+_0x370484)['json'](_0x28d314);}return null;};}function patchUpdates(_0xcb90){return function(_0x46931d){try{jsonpatch['apply'](_0x46931d,_0xcb90,!![]);}catch(_0x159227){return BPromise[_0x29f6('0x1b')](_0x159227);}return _0x46931d[_0x29f6('0x1c')]();};}function saveUpdates(_0x41b9f0,_0xb6e7a9){return function(_0x2bfb3d){if(_0x2bfb3d){return _0x2bfb3d['update'](_0x41b9f0)[_0x29f6('0x1d')](function(_0x59def4){return _0x59def4;});}return null;};}function removeEntity(_0x4acb15,_0x470019){return function(_0x1fa159){if(_0x1fa159){return _0x1fa159[_0x29f6('0x1e')]()[_0x29f6('0x1d')](function(){_0x4acb15['status'](0xcc)[_0x29f6('0x15')]();});}};}function handleEntityNotFound(_0x49f67d,_0xd4179c){return function(_0xcce041){if(!_0xcce041){_0x49f67d[_0x29f6('0x13')](0x194);}return _0xcce041;};}function handleError(_0x1b80aa,_0x4fc725){_0x4fc725=_0x4fc725||0x1f4;return function(_0x4290a2){logger[_0x29f6('0x1f')](_0x4290a2['stack']);if(_0x4290a2[_0x29f6('0x20')]){delete _0x4290a2[_0x29f6('0x20')];}_0x1b80aa[_0x29f6('0x14')](_0x4fc725)[_0x29f6('0x21')](_0x4290a2);};}exports[_0x29f6('0x22')]=function(_0x4333bc,_0x23c630){var _0x50cdd2={},_0x2183b7={},_0x454a4a={'count':0x0,'rows':[]};var _0x1ab8d8=_[_0x29f6('0x23')](db[_0x29f6('0x24')][_0x29f6('0x25')],function(_0x3790f5){return{'name':_0x3790f5[_0x29f6('0x26')],'type':_0x3790f5[_0x29f6('0x27')][_0x29f6('0x28')]};});_0x2183b7[_0x29f6('0x29')]=_[_0x29f6('0x2a')](_[_0x29f6('0x23')](_0x1ab8d8,_0x29f6('0x20')),[_0x29f6('0x20')]);_0x2183b7[_0x29f6('0x2b')]=_[_0x29f6('0x2c')](_0x4333bc['query']);_0x2183b7['filters']=_[_0x29f6('0x2d')](_0x2183b7['model'],_0x2183b7[_0x29f6('0x2b')]);_0x50cdd2[_0x29f6('0x2e')]=_[_0x29f6('0x2d')](_0x2183b7[_0x29f6('0x29')],qs['fields'](_0x4333bc['query'][_0x29f6('0x2f')]));_0x50cdd2[_0x29f6('0x2e')]=_0x50cdd2[_0x29f6('0x2e')][_0x29f6('0x30')]?_0x50cdd2[_0x29f6('0x2e')]:_0x2183b7[_0x29f6('0x29')];if(!_0x4333bc[_0x29f6('0x2b')][_0x29f6('0x31')](_0x29f6('0x32'))){_0x50cdd2[_0x29f6('0x33')]=qs[_0x29f6('0x33')](_0x4333bc[_0x29f6('0x2b')][_0x29f6('0x33')]);_0x50cdd2[_0x29f6('0x18')]=qs['offset'](_0x4333bc['query'][_0x29f6('0x18')]);}_0x50cdd2[_0x29f6('0x34')]=qs[_0x29f6('0x35')](_0x4333bc['query'][_0x29f6('0x35')]);_0x50cdd2[_0x29f6('0x36')]=qs[_0x29f6('0x37')](_[_0x29f6('0x38')](_0x4333bc[_0x29f6('0x2b')],_0x2183b7['filters']));if(_0x4333bc[_0x29f6('0x2b')][_0x29f6('0x39')]){_0x50cdd2[_0x29f6('0x36')]=_[_0x29f6('0x3a')](_0x50cdd2['where'],{'$or':_[_0x29f6('0x23')](_0x1ab8d8,function(_0x2a09e8){if(_0x2a09e8[_0x29f6('0x27')]!==_0x29f6('0x3b')){var _0x5ddc09={};_0x5ddc09[_0x2a09e8['name']]={'$like':'%'+_0x4333bc[_0x29f6('0x2b')]['filter']+'%'};return _0x5ddc09;}})});}_0x50cdd2=_[_0x29f6('0x3a')]({},_0x50cdd2,_0x4333bc['options']);var _0x3a1a75={'where':_0x50cdd2['where']};return db[_0x29f6('0x24')][_0x29f6('0x17')](_0x3a1a75)['then'](function(_0x1431fc){_0x454a4a['count']=_0x1431fc;if(_0x4333bc[_0x29f6('0x2b')][_0x29f6('0x3c')]){_0x50cdd2['include']=[{'all':!![]}];}return db[_0x29f6('0x24')][_0x29f6('0x3d')](_0x50cdd2);})[_0x29f6('0x1d')](function(_0x1e9d5a){_0x454a4a['rows']=_0x1e9d5a;return _0x454a4a;})[_0x29f6('0x1d')](respondWithFilteredResult(_0x23c630,_0x50cdd2))[_0x29f6('0x3e')](handleError(_0x23c630,null));};exports[_0x29f6('0x3f')]=function(_0x2322eb,_0x1dbd17){var _0x4d4189={'raw':!![],'where':{'id':_0x2322eb['params']['id']}},_0xb5f2b1={};_0xb5f2b1[_0x29f6('0x29')]=_['keys'](db[_0x29f6('0x24')][_0x29f6('0x25')]);_0xb5f2b1['query']=_[_0x29f6('0x2c')](_0x2322eb[_0x29f6('0x2b')]);_0xb5f2b1[_0x29f6('0x37')]=_[_0x29f6('0x2d')](_0xb5f2b1['model'],_0xb5f2b1[_0x29f6('0x2b')]);_0x4d4189[_0x29f6('0x2e')]=_[_0x29f6('0x2d')](_0xb5f2b1['model'],qs[_0x29f6('0x2f')](_0x2322eb['query'][_0x29f6('0x2f')]));_0x4d4189['attributes']=_0x4d4189['attributes']['length']?_0x4d4189[_0x29f6('0x2e')]:_0xb5f2b1[_0x29f6('0x29')];if(_0x2322eb[_0x29f6('0x2b')][_0x29f6('0x3c')]){_0x4d4189[_0x29f6('0x40')]=[{'all':!![]}];}_0x4d4189=_[_0x29f6('0x3a')]({},_0x4d4189,_0x2322eb[_0x29f6('0x41')]);return db[_0x29f6('0x24')][_0x29f6('0x42')](_0x4d4189)[_0x29f6('0x1d')](handleEntityNotFound(_0x1dbd17,null))['then'](respondWithResult(_0x1dbd17,null))['catch'](handleError(_0x1dbd17,null));};exports[_0x29f6('0x43')]=function(_0x450e76,_0x7a65c0){return db[_0x29f6('0x24')]['create'](_0x450e76[_0x29f6('0x44')],{})[_0x29f6('0x1d')](respondWithResult(_0x7a65c0,0xc9))['catch'](handleError(_0x7a65c0,null));};exports[_0x29f6('0x45')]=function(_0xd8514a,_0x123e2f){if(_0xd8514a[_0x29f6('0x44')]['id']){delete _0xd8514a[_0x29f6('0x44')]['id'];}return db[_0x29f6('0x24')][_0x29f6('0x42')]({'where':{'id':_0xd8514a[_0x29f6('0x46')]['id']}})[_0x29f6('0x1d')](handleEntityNotFound(_0x123e2f,null))[_0x29f6('0x1d')](saveUpdates(_0xd8514a[_0x29f6('0x44')],null))[_0x29f6('0x1d')](respondWithResult(_0x123e2f,null))['catch'](handleError(_0x123e2f,null));};exports[_0x29f6('0x1e')]=function(_0x463551,_0x335ec1){return db[_0x29f6('0x24')][_0x29f6('0x42')]({'where':{'id':_0x463551['params']['id']}})[_0x29f6('0x1d')](handleEntityNotFound(_0x335ec1,null))['then'](removeEntity(_0x335ec1,null))['catch'](handleError(_0x335ec1,null));};exports[_0x29f6('0x47')]=function(_0x4538de,_0x3194fa,_0x1a566f){return db[_0x29f6('0x24')]['find']({'where':{'id':_0x4538de[_0x29f6('0x46')]['id']},'attributes':['id',_0x29f6('0x48'),'msg_id']})[_0x29f6('0x1d')](handleEntityNotFound(_0x3194fa,null))['then'](function(_0x288cf2){if(_0x288cf2){if(!_0x288cf2[_0x29f6('0x48')]){throw new db[(_0x29f6('0x49'))][(_0x29f6('0x4a'))]('VoiceMailMessage\x20not\x20found');}var _0x199060={'Content-Type':_0x29f6('0x4b'),'Content-Disposition':_0x29f6('0x4c')};if(_0x288cf2[_0x29f6('0x4d')]){_0x199060[_0x29f6('0x4e')]=_0x29f6('0x4f')+_0x288cf2[_0x29f6('0x4d')]+'.wav\x22';}_0x3194fa[_0x29f6('0x19')](_0x199060);return _0x3194fa[_0x29f6('0x21')](new Buffer(_0x288cf2[_0x29f6('0x48')]));}})[_0x29f6('0x3e')](handleError(_0x3194fa,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 4a73e34..a4cf1ce 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 _0x07fd=['rimraf','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','moment','request-promise','path'];(function(_0x4653f7,_0x3d3ae3){var _0x5454da=function(_0x448f55){while(--_0x448f55){_0x4653f7['push'](_0x4653f7['shift']());}};_0x5454da(++_0x3d3ae3);}(_0x07fd,0x69));var _0xd07f=function(_0x3cbbf1,_0x3d9a88){_0x3cbbf1=_0x3cbbf1-0x0;var _0x15a4e5=_0x07fd[_0x3cbbf1];return _0x15a4e5;};'use strict';var _=require(_0xd07f('0x0'));var util=require('util');var logger=require(_0xd07f('0x1'))('api');var moment=require(_0xd07f('0x2'));var BPromise=require('bluebird');var rp=require(_0xd07f('0x3'));var fs=require('fs');var path=require(_0xd07f('0x4'));var rimraf=require(_0xd07f('0x5'));var config=require('../../config/environment');var attributes=require(_0xd07f('0x6'));module['exports']=function(_0x31cea4,_0x5e5661){return _0x31cea4[_0xd07f('0x7')](_0xd07f('0x8'),attributes,{'tableName':_0xd07f('0x9'),'paranoid':![],'indexes':[{'name':_0xd07f('0xa'),'fields':[_0xd07f('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0c35=['voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage'];(function(_0x1b8e15,_0x36220e){var _0x1aa18a=function(_0x762d3f){while(--_0x762d3f){_0x1b8e15['push'](_0x1b8e15['shift']());}};_0x1aa18a(++_0x36220e);}(_0x0c35,0x17c));var _0x50c3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0c35[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x50c3('0x0'));var util=require('util');var logger=require(_0x50c3('0x1'))(_0x50c3('0x2'));var moment=require(_0x50c3('0x3'));var BPromise=require(_0x50c3('0x4'));var rp=require(_0x50c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x50c3('0x6'));var config=require(_0x50c3('0x7'));var attributes=require(_0x50c3('0x8'));module[_0x50c3('0x9')]=function(_0x4dd1ac,_0x1d70c8){return _0x4dd1ac[_0x50c3('0xa')](_0x50c3('0xb'),attributes,{'tableName':_0x50c3('0xc'),'paranoid':![],'indexes':[{'name':_0x50c3('0xd'),'fields':[_0x50c3('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 0476674..79c044a 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 _0x0b0e=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x459335,_0x2e95dd){_0x459335=_0x459335-0x0;var _0x50f00b=_0x0b0e[_0x459335];return _0x50f00b;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceMailMessage,\x20%s,\x20%s','message','catch','lodash'];(function(_0x566bf9,_0x5b0de7){var _0x3e8f90=function(_0x1088a0){while(--_0x1088a0){_0x566bf9['push'](_0x566bf9['shift']());}};_0x3e8f90(++_0x5b0de7);}(_0x66fa,0x117));var _0xa66f=function(_0x4af802,_0x248fc1){_0x4af802=_0x4af802-0x0;var _0x10a0a0=_0x66fa[_0x4af802];return _0x10a0a0;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 8301dcf..b89ae41 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 _0x6326=['delete','destroy','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','Router','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','getSounds','post','create','addSound','put','update'];(function(_0x2f196b,_0x50bae1){var _0x3d07ff=function(_0x1f1c32){while(--_0x1f1c32){_0x2f196b['push'](_0x2f196b['shift']());}};_0x3d07ff(++_0x50bae1);}(_0x6326,0x17b));var _0x6632=function(_0x89debd,_0x4ca93a){_0x89debd=_0x89debd-0x0;var _0x407fb0=_0x6326[_0x89debd];return _0x407fb0;};'use strict';var multer=require('multer');var util=require(_0x6632('0x0'));var path=require(_0x6632('0x1'));var timeout=require(_0x6632('0x2'));var express=require('express');var router=express[_0x6632('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6632('0x4'));var config=require('../../config/environment');var controller=require(_0x6632('0x5'));router[_0x6632('0x6')]('/',auth[_0x6632('0x7')](),controller[_0x6632('0x8')]);router[_0x6632('0x6')](_0x6632('0x9'),auth[_0x6632('0x7')](),controller[_0x6632('0xa')]);router[_0x6632('0x6')]('/:id/sounds',auth[_0x6632('0x7')](),controller[_0x6632('0xb')]);router[_0x6632('0xc')]('/',auth[_0x6632('0x7')](),controller[_0x6632('0xd')]);router[_0x6632('0xc')]('/:id/sounds',auth['isAuthenticated'](),controller[_0x6632('0xe')]);router[_0x6632('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6632('0x10')]);router[_0x6632('0x11')](_0x6632('0x9'),auth[_0x6632('0x7')](),controller[_0x6632('0x12')]);router['delete'](_0x6632('0x13'),auth[_0x6632('0x7')](),controller[_0x6632('0x14')]);module[_0x6632('0x15')]=router; \ No newline at end of file +var _0x4964=['exports','connect-timeout','express','Router','../../components/auth/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','getSounds','post','create','addSound','update','destroy','delete','removeSound'];(function(_0xa81275,_0x520100){var _0x581248=function(_0x16f957){while(--_0x16f957){_0xa81275['push'](_0xa81275['shift']());}};_0x581248(++_0x520100);}(_0x4964,0xe5));var _0x4496=function(_0x5d9cea,_0x1ce249){_0x5d9cea=_0x5d9cea-0x0;var _0x3197a2=_0x4964[_0x5d9cea];return _0x3197a2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4496('0x0'));var express=require(_0x4496('0x1'));var router=express[_0x4496('0x2')]();var auth=require(_0x4496('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4496('0x4'));router[_0x4496('0x5')]('/',auth[_0x4496('0x6')](),controller[_0x4496('0x7')]);router[_0x4496('0x5')](_0x4496('0x8'),auth[_0x4496('0x6')](),controller[_0x4496('0x9')]);router[_0x4496('0x5')]('/:id/sounds',auth[_0x4496('0x6')](),controller[_0x4496('0xa')]);router[_0x4496('0xb')]('/',auth['isAuthenticated'](),controller[_0x4496('0xc')]);router[_0x4496('0xb')]('/:id/sounds',auth[_0x4496('0x6')](),controller[_0x4496('0xd')]);router['put'](_0x4496('0x8'),auth['isAuthenticated'](),controller[_0x4496('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4496('0xf')]);router[_0x4496('0x10')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0x4496('0x11')]);module[_0x4496('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 91ed256..f428cbd 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 _0x95c2=['name','ENUM','custom','files','mp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','sequelize','exports'];(function(_0x267390,_0x1733f2){var _0x19c5a9=function(_0x373f3a){while(--_0x373f3a){_0x267390['push'](_0x267390['shift']());}};_0x19c5a9(++_0x1733f2);}(_0x95c2,0x9a));var _0x295c=function(_0xeea64a,_0x1dc4cd){_0xeea64a=_0xeea64a-0x0;var _0x121613=_0x95c2[_0xeea64a];return _0x121613;};'use strict';var Sequelize=require(_0x295c('0x0'));module[_0x295c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x295c('0x2')},'mode':{'type':Sequelize[_0x295c('0x3')](_0x295c('0x4'),_0x295c('0x5'),_0x295c('0x6'),'quietmp3nb',_0x295c('0x7'),_0x295c('0x8')),'allowNull':!![],'defaultValue':_0x295c('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x295c('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0x295c('0x9')],'allowNull':!![]},'sort':{'type':Sequelize[_0x295c('0x9')],'allowNull':!![],'defaultValue':_0x295c('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x295c('0xb')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xaef2=['BOOLEAN','sequelize','exports','STRING','name','ENUM','files','mp3nb','quietmp3','mp3','alpha','TIMESTAMP'];(function(_0x32ff0b,_0x52202b){var _0x2e2c94=function(_0x8c0c2){while(--_0x8c0c2){_0x32ff0b['push'](_0x32ff0b['shift']());}};_0x2e2c94(++_0x52202b);}(_0xaef2,0xb5));var _0x2aef=function(_0x2fda36,_0x3012d9){_0x2fda36=_0x2fda36-0x0;var _0x48866c=_0xaef2[_0x2fda36];return _0x48866c;};'use strict';var Sequelize=require(_0x2aef('0x0'));module[_0x2aef('0x1')]={'name':{'type':Sequelize[_0x2aef('0x2')],'allowNull':![],'unique':_0x2aef('0x3')},'mode':{'type':Sequelize[_0x2aef('0x4')]('custom',_0x2aef('0x5'),_0x2aef('0x6'),'quietmp3nb',_0x2aef('0x7'),_0x2aef('0x8')),'allowNull':!![],'defaultValue':_0x2aef('0x5')},'directory':{'type':Sequelize[_0x2aef('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x2aef('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x2aef('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2aef('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x2aef('0xa')},'defaultEntry':{'type':Sequelize[_0x2aef('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 5078dd3..328429d 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 _0xa946=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','offset','limit','set','Content-Range','json','apply','reject','then','destroy','get','MusicOnHolds','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','VoiceMusicOnHold','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','count','includeAll','include','findAll','catch','params','rawAttributes','find','update','body','create','sequelize','transaction','mode','files','directory','join','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','basename','server/files/moh','%s.%s','symlinkSync','message','removeSound','id2','getSounds','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4944bf,_0x25dfcc){var _0x1a5808=function(_0x2858df){while(--_0x2858df){_0x4944bf['push'](_0x4944bf['shift']());}};_0x1a5808(++_0x25dfcc);}(_0xa946,0x1ad));var _0x6a94=function(_0x27a8ee,_0x4b606e){_0x27a8ee=_0x27a8ee-0x0;var _0x354050=_0xa946[_0x27a8ee];return _0x354050;};'use strict';var pdf=require(_0x6a94('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6a94('0x1'));var zipdir=require(_0x6a94('0x2'));var jsonpatch=require(_0x6a94('0x3'));var rp=require(_0x6a94('0x4'));var moment=require(_0x6a94('0x5'));var BPromise=require(_0x6a94('0x6'));var Mustache=require(_0x6a94('0x7'));var util=require(_0x6a94('0x8'));var path=require(_0x6a94('0x9'));var sox=require(_0x6a94('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6a94('0xb'));var squel=require(_0x6a94('0xc'));var crypto=require(_0x6a94('0xd'));var jsforce=require(_0x6a94('0xe'));var deskjs=require(_0x6a94('0xf'));var toCsv=require(_0x6a94('0x10'));var querystring=require(_0x6a94('0x11'));var Papa=require(_0x6a94('0x12'));var Redis=require(_0x6a94('0x13'));var authService=require(_0x6a94('0x14'));var qs=require(_0x6a94('0x15'));var as=require(_0x6a94('0x16'));var hardwareService=require(_0x6a94('0x17'));var logger=require(_0x6a94('0x18'))('api');var utils=require(_0x6a94('0x19'));var config=require(_0x6a94('0x1a'));var db=require(_0x6a94('0x1b'))['db'];function respondWithStatusCode(_0x506bba,_0x4aca41){_0x4aca41=_0x4aca41||0xcc;return function(_0x2eb1af){if(_0x2eb1af){return _0x506bba['sendStatus'](_0x4aca41);}return _0x506bba[_0x6a94('0x1c')](_0x4aca41)['end']();};}function respondWithResult(_0x289d58,_0x2c8eee){_0x2c8eee=_0x2c8eee||0xc8;return function(_0x417d66){if(_0x417d66){return _0x289d58[_0x6a94('0x1c')](_0x2c8eee)['json'](_0x417d66);}};}function respondWithFilteredResult(_0x4e47a2,_0x2e47f0){return function(_0xcbcee9){if(_0xcbcee9){var _0xf43bb2=_0xcbcee9['count'],_0x53612d=_0x2e47f0['offset'],_0x185ca5=_0x2e47f0[_0x6a94('0x1d')]+_0x2e47f0[_0x6a94('0x1e')],_0x536118;if(_0x185ca5>=_0xf43bb2){_0x185ca5=_0xf43bb2;_0x536118=0xc8;}else{_0x536118=0xce;}_0x4e47a2[_0x6a94('0x1c')](_0x536118);return _0x4e47a2[_0x6a94('0x1f')](_0x6a94('0x20'),_0x53612d+'-'+_0x185ca5+'/'+_0xf43bb2)[_0x6a94('0x21')](_0xcbcee9);}return null;};}function patchUpdates(_0x541687){return function(_0x2b49e1){try{jsonpatch[_0x6a94('0x22')](_0x2b49e1,_0x541687,!![]);}catch(_0x38d49b){return BPromise[_0x6a94('0x23')](_0x38d49b);}return _0x2b49e1['save']();};}function saveUpdates(_0x47ee30,_0x82c39e){return function(_0x3b0233){if(_0x3b0233){return _0x3b0233['update'](_0x47ee30)[_0x6a94('0x24')](function(_0x5b2fb2){return _0x5b2fb2;});}return null;};}function removeEntity(_0x461ffc,_0x5068bc){return function(_0x26689b){if(_0x26689b){return _0x26689b[_0x6a94('0x25')]()[_0x6a94('0x24')](function(){var _0x21833d=_0x26689b[_0x6a94('0x26')]({'plain':!![]});var _0x3935a4=_0x6a94('0x27');return db[_0x6a94('0x28')][_0x6a94('0x25')]({'where':{'type':_0x3935a4,'resourceId':_0x21833d['id']}})[_0x6a94('0x24')](function(){return _0x26689b;});})[_0x6a94('0x24')](function(){_0x461ffc[_0x6a94('0x1c')](0xcc)[_0x6a94('0x29')]();});}};}function handleEntityNotFound(_0x41e165,_0x3ee21f){return function(_0x580850){if(!_0x580850){_0x41e165[_0x6a94('0x2a')](0x194);}return _0x580850;};}function handleError(_0x4be3a3,_0x96f50a){_0x96f50a=_0x96f50a||0x1f4;return function(_0x39b786){logger[_0x6a94('0x2b')](_0x39b786[_0x6a94('0x2c')]);if(_0x39b786[_0x6a94('0x2d')]){delete _0x39b786[_0x6a94('0x2d')];}_0x4be3a3[_0x6a94('0x1c')](_0x96f50a)[_0x6a94('0x2e')](_0x39b786);};}exports[_0x6a94('0x2f')]=function(_0x2b3745,_0x2e05ab){var _0x2c2d44={},_0x310286={},_0x35651d={'count':0x0,'rows':[]};var _0x3957bb=_[_0x6a94('0x30')](db[_0x6a94('0x31')]['rawAttributes'],function(_0x2dc3e9){return{'name':_0x2dc3e9['fieldName'],'type':_0x2dc3e9['type'][_0x6a94('0x32')]};});_0x310286[_0x6a94('0x33')]=_[_0x6a94('0x30')](_0x3957bb,_0x6a94('0x2d'));_0x310286[_0x6a94('0x34')]=_[_0x6a94('0x35')](_0x2b3745[_0x6a94('0x34')]);_0x310286[_0x6a94('0x36')]=_[_0x6a94('0x37')](_0x310286[_0x6a94('0x33')],_0x310286[_0x6a94('0x34')]);_0x2c2d44[_0x6a94('0x38')]=_[_0x6a94('0x37')](_0x310286[_0x6a94('0x33')],qs['fields'](_0x2b3745['query'][_0x6a94('0x39')]));_0x2c2d44['attributes']=_0x2c2d44[_0x6a94('0x38')][_0x6a94('0x3a')]?_0x2c2d44[_0x6a94('0x38')]:_0x310286[_0x6a94('0x33')];if(!_0x2b3745['query'][_0x6a94('0x3b')](_0x6a94('0x3c'))){_0x2c2d44[_0x6a94('0x1e')]=qs[_0x6a94('0x1e')](_0x2b3745[_0x6a94('0x34')][_0x6a94('0x1e')]);_0x2c2d44[_0x6a94('0x1d')]=qs[_0x6a94('0x1d')](_0x2b3745[_0x6a94('0x34')]['offset']);}_0x2c2d44[_0x6a94('0x3d')]=qs[_0x6a94('0x3e')](_0x2b3745[_0x6a94('0x34')][_0x6a94('0x3e')]);_0x2c2d44[_0x6a94('0x3f')]=qs[_0x6a94('0x36')](_[_0x6a94('0x40')](_0x2b3745[_0x6a94('0x34')],_0x310286[_0x6a94('0x36')]));if(_0x2b3745[_0x6a94('0x34')]['filter']){_0x2c2d44[_0x6a94('0x3f')]=_[_0x6a94('0x41')](_0x2c2d44['where'],{'$or':_[_0x6a94('0x30')](_0x3957bb,function(_0x27ac42){if(_0x27ac42[_0x6a94('0x42')]!==_0x6a94('0x43')){var _0x46cf8a={};_0x46cf8a[_0x27ac42[_0x6a94('0x2d')]]={'$like':'%'+_0x2b3745[_0x6a94('0x34')][_0x6a94('0x44')]+'%'};return _0x46cf8a;}})});}_0x2c2d44=_[_0x6a94('0x41')]({},_0x2c2d44,_0x2b3745['options']);var _0x35ba8f={'where':_0x2c2d44[_0x6a94('0x3f')]};return db[_0x6a94('0x31')][_0x6a94('0x45')](_0x35ba8f)[_0x6a94('0x24')](function(_0x3d39cd){_0x35651d[_0x6a94('0x45')]=_0x3d39cd;if(_0x2b3745[_0x6a94('0x34')][_0x6a94('0x46')]){_0x2c2d44[_0x6a94('0x47')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x6a94('0x48')](_0x2c2d44);})['then'](function(_0x36d622){_0x35651d['rows']=_0x36d622;return _0x35651d;})[_0x6a94('0x24')](respondWithFilteredResult(_0x2e05ab,_0x2c2d44))[_0x6a94('0x49')](handleError(_0x2e05ab,null));};exports['show']=function(_0x29967e,_0x594ba0){var _0x497763={'raw':![],'where':{'id':_0x29967e[_0x6a94('0x4a')]['id']}},_0xdc9c9={};_0xdc9c9[_0x6a94('0x33')]=_['keys'](db[_0x6a94('0x31')][_0x6a94('0x4b')]);_0xdc9c9[_0x6a94('0x34')]=_[_0x6a94('0x35')](_0x29967e['query']);_0xdc9c9[_0x6a94('0x36')]=_[_0x6a94('0x37')](_0xdc9c9[_0x6a94('0x33')],_0xdc9c9['query']);_0x497763[_0x6a94('0x38')]=_[_0x6a94('0x37')](_0xdc9c9[_0x6a94('0x33')],qs['fields'](_0x29967e[_0x6a94('0x34')][_0x6a94('0x39')]));_0x497763[_0x6a94('0x38')]=_0x497763[_0x6a94('0x38')][_0x6a94('0x3a')]?_0x497763['attributes']:_0xdc9c9[_0x6a94('0x33')];if(_0x29967e[_0x6a94('0x34')][_0x6a94('0x46')]){_0x497763[_0x6a94('0x47')]=[{'all':!![]}];}_0x497763=_[_0x6a94('0x41')]({},_0x497763,_0x29967e['options']);return db['VoiceMusicOnHold'][_0x6a94('0x4c')](_0x497763)[_0x6a94('0x24')](handleEntityNotFound(_0x594ba0,null))[_0x6a94('0x24')](respondWithResult(_0x594ba0,null))[_0x6a94('0x49')](handleError(_0x594ba0,null));};exports[_0x6a94('0x4d')]=function(_0x3b26fc,_0x355ecc){if(_0x3b26fc[_0x6a94('0x4e')]['id']){delete _0x3b26fc[_0x6a94('0x4e')]['id'];}return db[_0x6a94('0x31')]['find']({'where':{'id':_0x3b26fc[_0x6a94('0x4a')]['id']}})[_0x6a94('0x24')](handleEntityNotFound(_0x355ecc,null))['then'](saveUpdates(_0x3b26fc['body'],null))[_0x6a94('0x24')](respondWithResult(_0x355ecc,null))[_0x6a94('0x49')](handleError(_0x355ecc,null));};exports[_0x6a94('0x4f')]=function(_0x88a38,_0xed0233,_0x54fed0){return db[_0x6a94('0x50')][_0x6a94('0x51')](function(_0x2ba91b){if(_0x88a38[_0x6a94('0x4e')][_0x6a94('0x52')]===_0x6a94('0x53')){_0x88a38[_0x6a94('0x4e')][_0x6a94('0x54')]=path[_0x6a94('0x55')](config['root'],'server/files/moh',_0x88a38['body'][_0x6a94('0x2d')]);}return db[_0x6a94('0x31')]['create'](_0x88a38[_0x6a94('0x4e')],{'transaction':_0x2ba91b})[_0x6a94('0x24')](function(_0x2d8ea6){if(_0x88a38[_0x6a94('0x4e')]['mode']===_0x6a94('0x53')){fs[_0x6a94('0x56')](_0x2d8ea6[_0x6a94('0x54')],parseInt('0777',0x8));}var _0x109653=_0x88a38['user'][_0x6a94('0x26')]({'plain':!![]});if(!_0x109653)throw new Error(_0x6a94('0x57'));if(_0x109653['role']===_0x6a94('0x58')){var _0x5d9e36=_0x2d8ea6[_0x6a94('0x26')]({'plain':!![]});return db[_0x6a94('0x59')][_0x6a94('0x4c')]({'where':{'name':_0x6a94('0x27'),'userProfileId':_0x109653['userProfileId']},'raw':!![]})['then'](function(_0x48e856){if(_0x48e856&&_0x48e856[_0x6a94('0x5a')]===0x0){return db[_0x6a94('0x28')][_0x6a94('0x4f')]({'name':_0x5d9e36[_0x6a94('0x2d')],'resourceId':_0x5d9e36['id'],'type':_0x48e856['name'],'sectionId':_0x48e856['id']},{})['then'](function(){return _0x2d8ea6;});}else{return _0x2d8ea6;}})['catch'](function(_0x577efd){logger[_0x6a94('0x2b')](_0x6a94('0x5b'),_0x577efd);});}return _0x2d8ea6;});})['then'](respondWithResult(_0xed0233,0xc9))[_0x6a94('0x49')](handleError(_0xed0233,null));};exports[_0x6a94('0x25')]=function(_0x3ae4b1,_0x46b7d0,_0x29e36b){var _0x4afe00;return db['VoiceMusicOnHold'][_0x6a94('0x4c')]({'where':{'id':_0x3ae4b1[_0x6a94('0x4a')]['id']}})[_0x6a94('0x24')](function(_0x3b0404){if(_0x3b0404){return db[_0x6a94('0x50')]['transaction'](function(_0x15e819){return _0x3b0404[_0x6a94('0x25')]({'transaction':_0x15e819,'raw':!![]})[_0x6a94('0x24')](function(_0x1ba926){if(_0x1ba926[_0x6a94('0x54')]){fs['readdirSync'](_0x1ba926[_0x6a94('0x54')])[_0x6a94('0x5c')](function(_0x4a4425){fs[_0x6a94('0x5d')](path[_0x6a94('0x55')](_0x1ba926[_0x6a94('0x54')],_0x4a4425));});fs['rmdirSync'](_0x1ba926[_0x6a94('0x54')]);}return _0x1ba926;});})[_0x6a94('0x49')](function(_0x530bca){throw new db[(_0x6a94('0x5e'))][(_0x6a94('0x5f'))](_0x530bca['message']);});}})[_0x6a94('0x24')](handleEntityNotFound(_0x46b7d0,null))[_0x6a94('0x24')](removeEntity(_0x46b7d0,null))[_0x6a94('0x49')](handleError(_0x46b7d0,null));};exports['addSound']=function(_0x501601,_0x2ccc84,_0x1fe089){return db[_0x6a94('0x50')]['transaction'](function(_0x41d978){var _0x359ad5;return db[_0x6a94('0x31')][_0x6a94('0x4c')]({'where':{'id':_0x501601['params']['id']}})[_0x6a94('0x24')](function(_0x5072ae){if(_0x5072ae){_0x359ad5=_0x5072ae;return _0x5072ae[_0x6a94('0x60')](_0x501601[_0x6a94('0x4e')]['id'],{'transaction':_0x41d978});}})[_0x6a94('0x24')](function(_0x30255c){if(_0x30255c){return db[_0x6a94('0x61')][_0x6a94('0x62')]({'where':{'id':_0x501601[_0x6a94('0x4e')]['id']},'attributes':['id',_0x6a94('0x2d'),_0x6a94('0x63'),_0x6a94('0x64'),_0x6a94('0x65')],'raw':!![]});}})[_0x6a94('0x24')](function(_0x1bff7e){if(_0x1bff7e){var _0x4f7580=path[_0x6a94('0x55')](config[_0x6a94('0x66')],_0x6a94('0x67'),util[_0x6a94('0x68')]('%s.%s',path[_0x6a94('0x69')](_0x1bff7e[_0x6a94('0x63')],path['extname'](_0x1bff7e[_0x6a94('0x63')])),_0x1bff7e[_0x6a94('0x64')]));var _0x51dcaa=path[_0x6a94('0x55')](config[_0x6a94('0x66')],_0x6a94('0x6a'),_0x359ad5[_0x6a94('0x2d')],util['format'](_0x6a94('0x6b'),_0x1bff7e[_0x6a94('0x2d')],_0x1bff7e[_0x6a94('0x64')]));fs[_0x6a94('0x6c')](_0x4f7580,_0x51dcaa);return _0x1bff7e;}})[_0x6a94('0x49')](function(_0x4234cd){throw new db['Sequelize']['ValidationError'](_0x4234cd[_0x6a94('0x6d')]);});})['then'](handleEntityNotFound(_0x2ccc84,null))[_0x6a94('0x24')](respondWithResult(_0x2ccc84,0xc9))[_0x6a94('0x49')](handleError(_0x2ccc84,null));};exports[_0x6a94('0x6e')]=function(_0x5132d2,_0x2150f3,_0x1a7f03){return db[_0x6a94('0x50')][_0x6a94('0x51')](function(_0x5e01c9){var _0x14bf2d;return db[_0x6a94('0x31')][_0x6a94('0x62')]({'where':{'id':_0x5132d2[_0x6a94('0x4a')]['id']}})[_0x6a94('0x24')](handleEntityNotFound(_0x2150f3,null))[_0x6a94('0x24')](function(_0x405b1a){if(_0x405b1a){_0x14bf2d=_0x405b1a;return _0x405b1a['removeSound'](_0x5132d2[_0x6a94('0x4a')][_0x6a94('0x6f')]);}})[_0x6a94('0x24')](function(_0x5a0945){if(_0x5a0945){return db[_0x6a94('0x61')][_0x6a94('0x62')]({'where':{'id':_0x5132d2[_0x6a94('0x4a')][_0x6a94('0x6f')]},'attributes':['id',_0x6a94('0x2d'),_0x6a94('0x63'),_0x6a94('0x64'),_0x6a94('0x65')],'raw':!![]});}})[_0x6a94('0x24')](function(_0x9e8c23){if(_0x9e8c23){fs[_0x6a94('0x5d')](path[_0x6a94('0x55')](_0x14bf2d[_0x6a94('0x54')],util[_0x6a94('0x68')](_0x6a94('0x6b'),_0x9e8c23[_0x6a94('0x2d')],_0x9e8c23[_0x6a94('0x64')])));return _0x9e8c23;}})['catch'](function(_0x52a297){throw new db[(_0x6a94('0x5e'))][(_0x6a94('0x5f'))](_0x52a297[_0x6a94('0x6d')]);});})[_0x6a94('0x24')](handleEntityNotFound(_0x2150f3,null))['then'](respondWithStatusCode(_0x2150f3,0xcc))['catch'](handleError(_0x2150f3,null));};exports[_0x6a94('0x70')]=function(_0x4f9541,_0x1bf336,_0x46d782){var _0x3df6db={};var _0x6281a8={};var _0x939fe2;var _0x488ac7;return db['VoiceMusicOnHold'][_0x6a94('0x62')]({'where':{'id':_0x4f9541['params']['id']}})[_0x6a94('0x24')](handleEntityNotFound(_0x1bf336,null))[_0x6a94('0x24')](function(_0x2d14b2){if(_0x2d14b2){_0x939fe2=_0x2d14b2;_0x6281a8[_0x6a94('0x33')]=_['keys'](db[_0x6a94('0x61')][_0x6a94('0x4b')]);_0x6281a8[_0x6a94('0x34')]=_[_0x6a94('0x35')](_0x4f9541[_0x6a94('0x34')]);_0x6281a8[_0x6a94('0x36')]=_['intersection'](_0x6281a8[_0x6a94('0x33')],_0x6281a8['query']);_0x3df6db[_0x6a94('0x38')]=_[_0x6a94('0x37')](_0x6281a8[_0x6a94('0x33')],qs[_0x6a94('0x39')](_0x4f9541[_0x6a94('0x34')][_0x6a94('0x39')]));_0x3df6db[_0x6a94('0x38')]=_0x3df6db[_0x6a94('0x38')][_0x6a94('0x3a')]?_0x3df6db[_0x6a94('0x38')]:_0x6281a8[_0x6a94('0x33')];_0x3df6db[_0x6a94('0x3d')]=qs[_0x6a94('0x3e')](_0x4f9541['query'][_0x6a94('0x3e')]);_0x3df6db['where']=qs[_0x6a94('0x36')](_['pick'](_0x4f9541[_0x6a94('0x34')],_0x6281a8[_0x6a94('0x36')]));if(_0x4f9541[_0x6a94('0x34')][_0x6a94('0x44')]){_0x3df6db[_0x6a94('0x3f')]=_[_0x6a94('0x41')](_0x3df6db[_0x6a94('0x3f')],{'$or':_[_0x6a94('0x30')](_0x3df6db[_0x6a94('0x38')],function(_0x45e132){var _0x4725db={};_0x4725db[_0x45e132]={'$like':'%'+_0x4f9541[_0x6a94('0x34')][_0x6a94('0x44')]+'%'};return _0x4725db;})});}_0x3df6db=_['merge']({},_0x3df6db,_0x4f9541['options']);return _0x939fe2[_0x6a94('0x70')](_0x3df6db);}})['then'](function(_0x3341ac){if(_0x3341ac){_0x488ac7=_0x3341ac[_0x6a94('0x3a')];if(!_0x4f9541[_0x6a94('0x34')][_0x6a94('0x3b')](_0x6a94('0x3c'))){_0x3df6db[_0x6a94('0x1e')]=qs['limit'](_0x4f9541[_0x6a94('0x34')][_0x6a94('0x1e')]);_0x3df6db[_0x6a94('0x1d')]=qs[_0x6a94('0x1d')](_0x4f9541['query'][_0x6a94('0x1d')]);}return _0x939fe2['getSounds'](_0x3df6db);}})['then'](function(_0x1b6cec){if(_0x1b6cec){return _0x1b6cec?{'count':_0x488ac7,'rows':_0x1b6cec}:null;}})[_0x6a94('0x24')](respondWithResult(_0x1bf336,null))[_0x6a94('0x49')](handleError(_0x1bf336,null));}; \ No newline at end of file +var _0xd96a=['mode','files','directory','root','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','error','unlinkSync','ValidationError','message','addSound','sequelize','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','join','symlinkSync','Sequelize','removeSound','id2','getSounds','length','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','MusicOnHolds','UserProfileResource','stack','name','index','VoiceMusicOnHold','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','findAll','rows','show','rawAttributes','includeAll','include','find','catch','body','params','create','transaction'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xd96a,0x8e));var _0xad96=function(_0x3690a0,_0x38bbec){_0x3690a0=_0x3690a0-0x0;var _0x5b518c=_0xd96a[_0x3690a0];return _0x5b518c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xad96('0x0'));var rp=require(_0xad96('0x1'));var moment=require('moment');var BPromise=require(_0xad96('0x2'));var Mustache=require(_0xad96('0x3'));var util=require(_0xad96('0x4'));var path=require(_0xad96('0x5'));var sox=require(_0xad96('0x6'));var csv=require('to-csv');var ejs=require(_0xad96('0x7'));var fs=require('fs');var _=require(_0xad96('0x8'));var squel=require(_0xad96('0x9'));var crypto=require(_0xad96('0xa'));var jsforce=require(_0xad96('0xb'));var deskjs=require(_0xad96('0xc'));var toCsv=require(_0xad96('0xd'));var querystring=require(_0xad96('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xad96('0xf'));var qs=require(_0xad96('0x10'));var as=require(_0xad96('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad96('0x12'))('api');var utils=require(_0xad96('0x13'));var config=require(_0xad96('0x14'));var db=require(_0xad96('0x15'))['db'];function respondWithStatusCode(_0x132424,_0x18e024){_0x18e024=_0x18e024||0xcc;return function(_0x48a983){if(_0x48a983){return _0x132424[_0xad96('0x16')](_0x18e024);}return _0x132424[_0xad96('0x17')](_0x18e024)[_0xad96('0x18')]();};}function respondWithResult(_0x51b766,_0x2dacf7){_0x2dacf7=_0x2dacf7||0xc8;return function(_0x36d0e6){if(_0x36d0e6){return _0x51b766[_0xad96('0x17')](_0x2dacf7)[_0xad96('0x19')](_0x36d0e6);}};}function respondWithFilteredResult(_0x38e16a,_0xb5e9a1){return function(_0x136cb0){if(_0x136cb0){var _0x4fe3f6=_0x136cb0[_0xad96('0x1a')],_0x3d647e=_0xb5e9a1[_0xad96('0x1b')],_0x19ce91=_0xb5e9a1[_0xad96('0x1b')]+_0xb5e9a1[_0xad96('0x1c')],_0x3f26aa;if(_0x19ce91>=_0x4fe3f6){_0x19ce91=_0x4fe3f6;_0x3f26aa=0xc8;}else{_0x3f26aa=0xce;}_0x38e16a['status'](_0x3f26aa);return _0x38e16a[_0xad96('0x1d')]('Content-Range',_0x3d647e+'-'+_0x19ce91+'/'+_0x4fe3f6)[_0xad96('0x19')](_0x136cb0);}return null;};}function patchUpdates(_0x31989d){return function(_0x51a920){try{jsonpatch[_0xad96('0x1e')](_0x51a920,_0x31989d,!![]);}catch(_0x516184){return BPromise[_0xad96('0x1f')](_0x516184);}return _0x51a920[_0xad96('0x20')]();};}function saveUpdates(_0x43c6a5,_0x1ce12b){return function(_0x20cde0){if(_0x20cde0){return _0x20cde0[_0xad96('0x21')](_0x43c6a5)[_0xad96('0x22')](function(_0x7ea46c){return _0x7ea46c;});}return null;};}function removeEntity(_0x113aef,_0x2297a1){return function(_0x377eac){if(_0x377eac){return _0x377eac[_0xad96('0x23')]()['then'](function(){var _0x43a5d7=_0x377eac['get']({'plain':!![]});var _0xf51ae3=_0xad96('0x24');return db[_0xad96('0x25')][_0xad96('0x23')]({'where':{'type':_0xf51ae3,'resourceId':_0x43a5d7['id']}})['then'](function(){return _0x377eac;});})[_0xad96('0x22')](function(){_0x113aef[_0xad96('0x17')](0xcc)[_0xad96('0x18')]();});}};}function handleEntityNotFound(_0x13e534,_0x2e465a){return function(_0x53f1cb){if(!_0x53f1cb){_0x13e534['sendStatus'](0x194);}return _0x53f1cb;};}function handleError(_0x540e0b,_0x187da9){_0x187da9=_0x187da9||0x1f4;return function(_0x4376b2){logger['error'](_0x4376b2[_0xad96('0x26')]);if(_0x4376b2[_0xad96('0x27')]){delete _0x4376b2[_0xad96('0x27')];}_0x540e0b['status'](_0x187da9)['send'](_0x4376b2);};}exports[_0xad96('0x28')]=function(_0x38c4c1,_0x74dd88){var _0x847cea={},_0x4401d7={},_0x328312={'count':0x0,'rows':[]};var _0x508694=_['map'](db[_0xad96('0x29')]['rawAttributes'],function(_0x20e647){return{'name':_0x20e647['fieldName'],'type':_0x20e647[_0xad96('0x2a')][_0xad96('0x2b')]};});_0x4401d7[_0xad96('0x2c')]=_[_0xad96('0x2d')](_0x508694,_0xad96('0x27'));_0x4401d7[_0xad96('0x2e')]=_[_0xad96('0x2f')](_0x38c4c1[_0xad96('0x2e')]);_0x4401d7[_0xad96('0x30')]=_[_0xad96('0x31')](_0x4401d7['model'],_0x4401d7['query']);_0x847cea[_0xad96('0x32')]=_[_0xad96('0x31')](_0x4401d7['model'],qs[_0xad96('0x33')](_0x38c4c1[_0xad96('0x2e')]['fields']));_0x847cea[_0xad96('0x32')]=_0x847cea[_0xad96('0x32')]['length']?_0x847cea[_0xad96('0x32')]:_0x4401d7[_0xad96('0x2c')];if(!_0x38c4c1[_0xad96('0x2e')][_0xad96('0x34')](_0xad96('0x35'))){_0x847cea[_0xad96('0x1c')]=qs[_0xad96('0x1c')](_0x38c4c1[_0xad96('0x2e')][_0xad96('0x1c')]);_0x847cea[_0xad96('0x1b')]=qs['offset'](_0x38c4c1['query'][_0xad96('0x1b')]);}_0x847cea[_0xad96('0x36')]=qs['sort'](_0x38c4c1[_0xad96('0x2e')][_0xad96('0x37')]);_0x847cea['where']=qs[_0xad96('0x30')](_[_0xad96('0x38')](_0x38c4c1[_0xad96('0x2e')],_0x4401d7[_0xad96('0x30')]));if(_0x38c4c1[_0xad96('0x2e')][_0xad96('0x39')]){_0x847cea[_0xad96('0x3a')]=_['merge'](_0x847cea[_0xad96('0x3a')],{'$or':_[_0xad96('0x2d')](_0x508694,function(_0x2c124a){if(_0x2c124a[_0xad96('0x2a')]!==_0xad96('0x3b')){var _0x59781a={};_0x59781a[_0x2c124a[_0xad96('0x27')]]={'$like':'%'+_0x38c4c1['query'][_0xad96('0x39')]+'%'};return _0x59781a;}})});}_0x847cea=_[_0xad96('0x3c')]({},_0x847cea,_0x38c4c1[_0xad96('0x3d')]);var _0x4bd9b3={'where':_0x847cea['where']};return db[_0xad96('0x29')]['count'](_0x4bd9b3)[_0xad96('0x22')](function(_0x5691c5){_0x328312[_0xad96('0x1a')]=_0x5691c5;if(_0x38c4c1[_0xad96('0x2e')]['includeAll']){_0x847cea['include']=[{'all':!![]}];}return db[_0xad96('0x29')][_0xad96('0x3e')](_0x847cea);})['then'](function(_0x1145dd){_0x328312[_0xad96('0x3f')]=_0x1145dd;return _0x328312;})[_0xad96('0x22')](respondWithFilteredResult(_0x74dd88,_0x847cea))['catch'](handleError(_0x74dd88,null));};exports[_0xad96('0x40')]=function(_0x34b4a8,_0x17a01e){var _0x566709={'raw':![],'where':{'id':_0x34b4a8['params']['id']}},_0x51c8d8={};_0x51c8d8[_0xad96('0x2c')]=_[_0xad96('0x2f')](db[_0xad96('0x29')][_0xad96('0x41')]);_0x51c8d8['query']=_[_0xad96('0x2f')](_0x34b4a8[_0xad96('0x2e')]);_0x51c8d8[_0xad96('0x30')]=_['intersection'](_0x51c8d8[_0xad96('0x2c')],_0x51c8d8['query']);_0x566709[_0xad96('0x32')]=_[_0xad96('0x31')](_0x51c8d8['model'],qs[_0xad96('0x33')](_0x34b4a8['query'][_0xad96('0x33')]));_0x566709[_0xad96('0x32')]=_0x566709[_0xad96('0x32')]['length']?_0x566709[_0xad96('0x32')]:_0x51c8d8[_0xad96('0x2c')];if(_0x34b4a8[_0xad96('0x2e')][_0xad96('0x42')]){_0x566709[_0xad96('0x43')]=[{'all':!![]}];}_0x566709=_[_0xad96('0x3c')]({},_0x566709,_0x34b4a8['options']);return db[_0xad96('0x29')][_0xad96('0x44')](_0x566709)[_0xad96('0x22')](handleEntityNotFound(_0x17a01e,null))[_0xad96('0x22')](respondWithResult(_0x17a01e,null))[_0xad96('0x45')](handleError(_0x17a01e,null));};exports['update']=function(_0x2369ca,_0x5c3850){if(_0x2369ca[_0xad96('0x46')]['id']){delete _0x2369ca[_0xad96('0x46')]['id'];}return db[_0xad96('0x29')][_0xad96('0x44')]({'where':{'id':_0x2369ca[_0xad96('0x47')]['id']}})['then'](handleEntityNotFound(_0x5c3850,null))[_0xad96('0x22')](saveUpdates(_0x2369ca[_0xad96('0x46')],null))[_0xad96('0x22')](respondWithResult(_0x5c3850,null))[_0xad96('0x45')](handleError(_0x5c3850,null));};exports[_0xad96('0x48')]=function(_0x233843,_0x249954,_0x166ca7){return db['sequelize'][_0xad96('0x49')](function(_0x5c1e2c){if(_0x233843[_0xad96('0x46')][_0xad96('0x4a')]===_0xad96('0x4b')){_0x233843[_0xad96('0x46')][_0xad96('0x4c')]=path['join'](config[_0xad96('0x4d')],'server/files/moh',_0x233843[_0xad96('0x46')][_0xad96('0x27')]);}return db[_0xad96('0x29')][_0xad96('0x48')](_0x233843[_0xad96('0x46')],{'transaction':_0x5c1e2c})[_0xad96('0x22')](function(_0x3dea7e){if(_0x233843[_0xad96('0x46')][_0xad96('0x4a')]===_0xad96('0x4b')){fs[_0xad96('0x4e')](_0x3dea7e[_0xad96('0x4c')],parseInt(_0xad96('0x4f'),0x8));}var _0x2c17d2=_0x233843[_0xad96('0x50')]['get']({'plain':!![]});if(!_0x2c17d2)throw new Error(_0xad96('0x51'));if(_0x2c17d2[_0xad96('0x52')]===_0xad96('0x50')){var _0x580e35=_0x3dea7e[_0xad96('0x53')]({'plain':!![]});return db['UserProfileSection'][_0xad96('0x44')]({'where':{'name':_0xad96('0x24'),'userProfileId':_0x2c17d2[_0xad96('0x54')]},'raw':!![]})['then'](function(_0x4e2aa1){if(_0x4e2aa1&&_0x4e2aa1['autoAssociation']===0x0){return db[_0xad96('0x25')][_0xad96('0x48')]({'name':_0x580e35[_0xad96('0x27')],'resourceId':_0x580e35['id'],'type':_0x4e2aa1['name'],'sectionId':_0x4e2aa1['id']},{})[_0xad96('0x22')](function(){return _0x3dea7e;});}else{return _0x3dea7e;}})[_0xad96('0x45')](function(_0x7bf982){logger[_0xad96('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7bf982);});}return _0x3dea7e;});})[_0xad96('0x22')](respondWithResult(_0x249954,0xc9))[_0xad96('0x45')](handleError(_0x249954,null));};exports[_0xad96('0x23')]=function(_0x9a35ab,_0x44ae68,_0x4aeea1){var _0xcec1bf;return db[_0xad96('0x29')]['find']({'where':{'id':_0x9a35ab[_0xad96('0x47')]['id']}})[_0xad96('0x22')](function(_0x2d21c7){if(_0x2d21c7){return db['sequelize'][_0xad96('0x49')](function(_0xa7c824){return _0x2d21c7['destroy']({'transaction':_0xa7c824,'raw':!![]})[_0xad96('0x22')](function(_0x280130){if(_0x280130[_0xad96('0x4c')]){fs['readdirSync'](_0x280130[_0xad96('0x4c')])['forEach'](function(_0x16ca53){fs[_0xad96('0x56')](path['join'](_0x280130[_0xad96('0x4c')],_0x16ca53));});fs['rmdirSync'](_0x280130['directory']);}return _0x280130;});})[_0xad96('0x45')](function(_0x2111f2){throw new db['Sequelize'][(_0xad96('0x57'))](_0x2111f2[_0xad96('0x58')]);});}})[_0xad96('0x22')](handleEntityNotFound(_0x44ae68,null))['then'](removeEntity(_0x44ae68,null))[_0xad96('0x45')](handleError(_0x44ae68,null));};exports[_0xad96('0x59')]=function(_0x625049,_0x35f1e2,_0x4771cf){return db[_0xad96('0x5a')][_0xad96('0x49')](function(_0x8a54f6){var _0x28396b;return db[_0xad96('0x29')][_0xad96('0x44')]({'where':{'id':_0x625049[_0xad96('0x47')]['id']}})[_0xad96('0x22')](function(_0x1f8a4e){if(_0x1f8a4e){_0x28396b=_0x1f8a4e;return _0x1f8a4e['addSound'](_0x625049[_0xad96('0x46')]['id'],{'transaction':_0x8a54f6});}})[_0xad96('0x22')](function(_0x17af9e){if(_0x17af9e){return db[_0xad96('0x5b')][_0xad96('0x5c')]({'where':{'id':_0x625049['body']['id']},'attributes':['id',_0xad96('0x27'),_0xad96('0x5d'),_0xad96('0x5e'),_0xad96('0x5f')],'raw':!![]});}})[_0xad96('0x22')](function(_0x5aa613){if(_0x5aa613){var _0x45e12f=path['join'](config[_0xad96('0x4d')],_0xad96('0x60'),util[_0xad96('0x61')](_0xad96('0x62'),path[_0xad96('0x63')](_0x5aa613[_0xad96('0x5d')],path[_0xad96('0x64')](_0x5aa613[_0xad96('0x5d')])),_0x5aa613[_0xad96('0x5e')]));var _0x57050d=path[_0xad96('0x65')](config[_0xad96('0x4d')],'server/files/moh',_0x28396b[_0xad96('0x27')],util['format']('%s.%s',_0x5aa613['name'],_0x5aa613[_0xad96('0x5e')]));fs[_0xad96('0x66')](_0x45e12f,_0x57050d);return _0x5aa613;}})['catch'](function(_0x3a0710){throw new db[(_0xad96('0x67'))][(_0xad96('0x57'))](_0x3a0710['message']);});})['then'](handleEntityNotFound(_0x35f1e2,null))[_0xad96('0x22')](respondWithResult(_0x35f1e2,0xc9))[_0xad96('0x45')](handleError(_0x35f1e2,null));};exports['removeSound']=function(_0x4efe76,_0x3b57db,_0x2d9364){return db[_0xad96('0x5a')][_0xad96('0x49')](function(_0x2b4511){var _0x341203;return db[_0xad96('0x29')][_0xad96('0x5c')]({'where':{'id':_0x4efe76[_0xad96('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b57db,null))[_0xad96('0x22')](function(_0x3f380f){if(_0x3f380f){_0x341203=_0x3f380f;return _0x3f380f[_0xad96('0x68')](_0x4efe76[_0xad96('0x47')]['id2']);}})[_0xad96('0x22')](function(_0x455517){if(_0x455517){return db[_0xad96('0x5b')][_0xad96('0x5c')]({'where':{'id':_0x4efe76[_0xad96('0x47')][_0xad96('0x69')]},'attributes':['id',_0xad96('0x27'),_0xad96('0x5d'),_0xad96('0x5e'),'createdAt'],'raw':!![]});}})[_0xad96('0x22')](function(_0x48feee){if(_0x48feee){fs['unlinkSync'](path[_0xad96('0x65')](_0x341203['directory'],util['format'](_0xad96('0x62'),_0x48feee['name'],_0x48feee['converted_format'])));return _0x48feee;}})[_0xad96('0x45')](function(_0x46631c){throw new db[(_0xad96('0x67'))]['ValidationError'](_0x46631c[_0xad96('0x58')]);});})['then'](handleEntityNotFound(_0x3b57db,null))[_0xad96('0x22')](respondWithStatusCode(_0x3b57db,0xcc))[_0xad96('0x45')](handleError(_0x3b57db,null));};exports[_0xad96('0x6a')]=function(_0x46fab0,_0x3cf851,_0x1911ad){var _0x2f9627={};var _0x28ce61={};var _0x333e65;var _0x4970f0;return db[_0xad96('0x29')][_0xad96('0x5c')]({'where':{'id':_0x46fab0[_0xad96('0x47')]['id']}})[_0xad96('0x22')](handleEntityNotFound(_0x3cf851,null))['then'](function(_0x5971cc){if(_0x5971cc){_0x333e65=_0x5971cc;_0x28ce61['model']=_[_0xad96('0x2f')](db[_0xad96('0x5b')][_0xad96('0x41')]);_0x28ce61[_0xad96('0x2e')]=_[_0xad96('0x2f')](_0x46fab0[_0xad96('0x2e')]);_0x28ce61['filters']=_[_0xad96('0x31')](_0x28ce61['model'],_0x28ce61[_0xad96('0x2e')]);_0x2f9627[_0xad96('0x32')]=_[_0xad96('0x31')](_0x28ce61['model'],qs['fields'](_0x46fab0[_0xad96('0x2e')][_0xad96('0x33')]));_0x2f9627[_0xad96('0x32')]=_0x2f9627[_0xad96('0x32')][_0xad96('0x6b')]?_0x2f9627[_0xad96('0x32')]:_0x28ce61[_0xad96('0x2c')];_0x2f9627[_0xad96('0x36')]=qs[_0xad96('0x37')](_0x46fab0['query']['sort']);_0x2f9627[_0xad96('0x3a')]=qs['filters'](_[_0xad96('0x38')](_0x46fab0[_0xad96('0x2e')],_0x28ce61[_0xad96('0x30')]));if(_0x46fab0['query'][_0xad96('0x39')]){_0x2f9627[_0xad96('0x3a')]=_[_0xad96('0x3c')](_0x2f9627[_0xad96('0x3a')],{'$or':_[_0xad96('0x2d')](_0x2f9627['attributes'],function(_0x2ec81d){var _0x1260d8={};_0x1260d8[_0x2ec81d]={'$like':'%'+_0x46fab0[_0xad96('0x2e')]['filter']+'%'};return _0x1260d8;})});}_0x2f9627=_[_0xad96('0x3c')]({},_0x2f9627,_0x46fab0[_0xad96('0x3d')]);return _0x333e65['getSounds'](_0x2f9627);}})[_0xad96('0x22')](function(_0x1fd3f1){if(_0x1fd3f1){_0x4970f0=_0x1fd3f1[_0xad96('0x6b')];if(!_0x46fab0['query'][_0xad96('0x34')](_0xad96('0x35'))){_0x2f9627[_0xad96('0x1c')]=qs[_0xad96('0x1c')](_0x46fab0[_0xad96('0x2e')]['limit']);_0x2f9627['offset']=qs[_0xad96('0x1b')](_0x46fab0[_0xad96('0x2e')][_0xad96('0x1b')]);}return _0x333e65[_0xad96('0x6a')](_0x2f9627);}})['then'](function(_0x4fcc6a){if(_0x4fcc6a){return _0x4fcc6a?{'count':_0x4970f0,'rows':_0x4fcc6a}:null;}})['then'](respondWithResult(_0x3cf851,null))['catch'](handleError(_0x3cf851,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index c8d7aca..69a5d59 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 _0x3213=['lodash','util','api','moment','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x15d92c,_0x1b1d72){var _0x1eb093=function(_0x3543de){while(--_0x3543de){_0x15d92c['push'](_0x15d92c['shift']());}};_0x1eb093(++_0x1b1d72);}(_0x3213,0x13f));var _0x3321=function(_0x3ae565,_0x5a061c){_0x3ae565=_0x3ae565-0x0;var _0x190755=_0x3213[_0x3ae565];return _0x190755;};'use strict';var _=require(_0x3321('0x0'));var util=require(_0x3321('0x1'));var logger=require('../../config/logger')(_0x3321('0x2'));var moment=require(_0x3321('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3321('0x4'));var rimraf=require(_0x3321('0x5'));var config=require(_0x3321('0x6'));var attributes=require(_0x3321('0x7'));module[_0x3321('0x8')]=function(_0x3647b3,_0x2fb827){return _0x3647b3[_0x3321('0x9')](_0x3321('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe767=['../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','util','api','bluebird','rimraf'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xe767,0x137));var _0x7e76=function(_0x139405,_0x41eb1e){_0x139405=_0x139405-0x0;var _0x7b38fe=_0xe767[_0x139405];return _0x7b38fe;};'use strict';var _=require('lodash');var util=require(_0x7e76('0x0'));var logger=require('../../config/logger')(_0x7e76('0x1'));var moment=require('moment');var BPromise=require(_0x7e76('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e76('0x3'));var config=require(_0x7e76('0x4'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x7e76('0x5')]=function(_0x9183fe,_0x3fd254){return _0x9183fe[_0x7e76('0x6')](_0x7e76('0x7'),attributes,{'tableName':_0x7e76('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 30e9ec9..d388907 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 _0xcdef=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x459d7d,_0x55db19){var _0x26abf1=function(_0x39e5d5){while(--_0x39e5d5){_0x459d7d['push'](_0x459d7d['shift']());}};_0x26abf1(++_0x55db19);}(_0xcdef,0x1b9));var _0xfcde=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcdef[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0xfcde('0x0'));var moment=require(_0xfcde('0x1'));var BPromise=require(_0xfcde('0x2'));var rs=require(_0xfcde('0x3'));var fs=require('fs');var Redis=require(_0xfcde('0x4'));var db=require(_0xfcde('0x5'))['db'];var utils=require(_0xfcde('0x6'));var logger=require('../../config/logger')(_0xfcde('0x7'));var config=require(_0xfcde('0x8'));var jayson=require(_0xfcde('0x9'));var client=jayson[_0xfcde('0xa')][_0xfcde('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x139ccf,_0x352798,_0x1a8b2e){return new BPromise(function(_0x174e6f,_0x425d3c){return client[_0xfcde('0xc')](_0x139ccf,_0x1a8b2e)[_0xfcde('0xd')](function(_0x466a08){logger[_0xfcde('0xe')](_0xfcde('0xf'),_0x352798,_0xfcde('0x10'));logger['debug']('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x352798,_0xfcde('0x10'),JSON[_0xfcde('0x11')](_0x466a08));if(_0x466a08[_0xfcde('0x12')]){if(_0x466a08[_0xfcde('0x12')][_0xfcde('0x13')]===0x1f4){logger[_0xfcde('0x12')](_0xfcde('0xf'),_0x352798,_0x466a08[_0xfcde('0x12')][_0xfcde('0x14')]);return _0x425d3c(_0x466a08['error'][_0xfcde('0x14')]);}logger[_0xfcde('0x12')](_0xfcde('0xf'),_0x352798,_0x466a08['error'][_0xfcde('0x14')]);return _0x174e6f(_0x466a08[_0xfcde('0x12')][_0xfcde('0x14')]);}else{logger[_0xfcde('0xe')](_0xfcde('0xf'),_0x352798,'request\x20sent');_0x174e6f(_0x466a08[_0xfcde('0x15')][_0xfcde('0x14')]);}})[_0xfcde('0x16')](function(_0x4af066){logger['error'](_0xfcde('0xf'),_0x352798,_0x4af066);_0x425d3c(_0x4af066);});});} \ No newline at end of file +var _0xc76f=['VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent'];(function(_0x3c815e,_0x3d8105){var _0xf66654=function(_0x55cf6b){while(--_0x55cf6b){_0x3c815e['push'](_0x3c815e['shift']());}};_0xf66654(++_0x3d8105);}(_0xc76f,0x1eb));var _0xfc76=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc76f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfc76('0x0'));var util=require(_0xfc76('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfc76('0x2'));var fs=require('fs');var Redis=require(_0xfc76('0x3'));var db=require(_0xfc76('0x4'))['db'];var utils=require(_0xfc76('0x5'));var logger=require(_0xfc76('0x6'))(_0xfc76('0x7'));var config=require(_0xfc76('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfc76('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b64a,_0x3c02a1,_0x4e5296){return new BPromise(function(_0x2a10f0,_0x23829d){return client[_0xfc76('0xa')](_0x2b64a,_0x4e5296)[_0xfc76('0xb')](function(_0x28677e){logger[_0xfc76('0xc')](_0xfc76('0xd'),_0x3c02a1,_0xfc76('0xe'));logger['debug'](_0xfc76('0xf'),_0x3c02a1,_0xfc76('0xe'),JSON[_0xfc76('0x10')](_0x28677e));if(_0x28677e[_0xfc76('0x11')]){if(_0x28677e[_0xfc76('0x11')][_0xfc76('0x12')]===0x1f4){logger['error'](_0xfc76('0xd'),_0x3c02a1,_0x28677e[_0xfc76('0x11')][_0xfc76('0x13')]);return _0x23829d(_0x28677e[_0xfc76('0x11')][_0xfc76('0x13')]);}logger[_0xfc76('0x11')](_0xfc76('0xd'),_0x3c02a1,_0x28677e[_0xfc76('0x11')]['message']);return _0x2a10f0(_0x28677e[_0xfc76('0x11')]['message']);}else{logger[_0xfc76('0xc')](_0xfc76('0xd'),_0x3c02a1,_0xfc76('0xe'));_0x2a10f0(_0x28677e[_0xfc76('0x14')][_0xfc76('0x13')]);}})[_0xfc76('0x15')](function(_0x361b8e){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x3c02a1,_0x361b8e);_0x23829d(_0x361b8e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 8181495..b59656c 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 _0xec32=['post','create','addAgents','put','delete','destroy','/:id/users','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','getAgents'];(function(_0x5c77b9,_0x26407e){var _0x58354c=function(_0x137c16){while(--_0x137c16){_0x5c77b9['push'](_0x5c77b9['shift']());}};_0x58354c(++_0x26407e);}(_0xec32,0xb8));var _0x2ec3=function(_0x58148b,_0x25398c){_0x58148b=_0x58148b-0x0;var _0x54abcf=_0xec32[_0x58148b];return _0x54abcf;};'use strict';var multer=require(_0x2ec3('0x0'));var util=require(_0x2ec3('0x1'));var path=require(_0x2ec3('0x2'));var timeout=require(_0x2ec3('0x3'));var express=require(_0x2ec3('0x4'));var router=express[_0x2ec3('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2ec3('0x6'));var config=require('../../config/environment');var controller=require(_0x2ec3('0x7'));router[_0x2ec3('0x8')]('/',auth[_0x2ec3('0x9')](),controller[_0x2ec3('0xa')]);router['get'](_0x2ec3('0xb'),auth[_0x2ec3('0x9')](),controller['describe']);router[_0x2ec3('0x8')](_0x2ec3('0xc'),auth[_0x2ec3('0x9')](),controller['show']);router[_0x2ec3('0x8')]('/:id/users',auth[_0x2ec3('0x9')](),controller[_0x2ec3('0xd')]);router[_0x2ec3('0xe')]('/',auth['isAuthenticated'](),controller[_0x2ec3('0xf')]);router[_0x2ec3('0xe')]('/:id/users',auth['isAuthenticated'](),controller[_0x2ec3('0x10')]);router[_0x2ec3('0x11')](_0x2ec3('0xc'),auth[_0x2ec3('0x9')](),controller['update']);router[_0x2ec3('0x12')]('/:id',auth[_0x2ec3('0x9')](),controller[_0x2ec3('0x13')]);router[_0x2ec3('0x12')](_0x2ec3('0x14'),auth[_0x2ec3('0x9')](),controller[_0x2ec3('0x15')]);module['exports']=router; \ No newline at end of file +var _0xad55=['get','isAuthenticated','describe','/:id','show','/:id/users','getAgents','post','create','put','update','destroy','delete','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xad55,0xad));var _0x5ad5=function(_0x4e5a15,_0xda6a00){_0x4e5a15=_0x4e5a15-0x0;var _0x49b675=_0xad55[_0x4e5a15];return _0x49b675;};'use strict';var multer=require(_0x5ad5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5ad5('0x1'));var router=express[_0x5ad5('0x2')]();var auth=require(_0x5ad5('0x3'));var interaction=require(_0x5ad5('0x4'));var config=require(_0x5ad5('0x5'));var controller=require(_0x5ad5('0x6'));router[_0x5ad5('0x7')]('/',auth[_0x5ad5('0x8')](),controller['index']);router[_0x5ad5('0x7')]('/describe',auth[_0x5ad5('0x8')](),controller[_0x5ad5('0x9')]);router['get'](_0x5ad5('0xa'),auth[_0x5ad5('0x8')](),controller[_0x5ad5('0xb')]);router[_0x5ad5('0x7')](_0x5ad5('0xc'),auth['isAuthenticated'](),controller[_0x5ad5('0xd')]);router[_0x5ad5('0xe')]('/',auth['isAuthenticated'](),controller[_0x5ad5('0xf')]);router[_0x5ad5('0xe')](_0x5ad5('0xc'),auth[_0x5ad5('0x8')](),controller['addAgents']);router[_0x5ad5('0x10')](_0x5ad5('0xa'),auth[_0x5ad5('0x8')](),controller[_0x5ad5('0x11')]);router['delete'](_0x5ad5('0xa'),auth[_0x5ad5('0x8')](),controller[_0x5ad5('0x12')]);router[_0x5ad5('0x13')](_0x5ad5('0xc'),auth[_0x5ad5('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index b086252..35b0fb9 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 _0xbda2=['system-','name','INTEGER','sequelize','STRING','VIRTUAL'];(function(_0x4849f6,_0x104836){var _0x1a3dcd=function(_0x494d3c){while(--_0x494d3c){_0x4849f6['push'](_0x4849f6['shift']());}};_0x1a3dcd(++_0x104836);}(_0xbda2,0x123));var _0x2bda=function(_0x4afc69,_0x349c3c){_0x4afc69=_0x4afc69-0x0;var _0x2a114d=_0xbda2[_0x4afc69];return _0x2a114d;};'use strict';var Sequelize=require(_0x2bda('0x0'));module['exports']={'name':{'type':Sequelize[_0x2bda('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x2bda('0x2')],'get':function(_0x2d952a){return _0x2bda('0x3')+this['getDataValue'](_0x2bda('0x4'))+'-';}},'description':{'type':Sequelize[_0x2bda('0x1')]},'callerIdAll':{'type':Sequelize[_0x2bda('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x2bda('0x5')]}}; \ No newline at end of file +var _0x23dd=['STRING','name','VIRTUAL','INTEGER'];(function(_0x196ea4,_0x4ec9c5){var _0x1d8077=function(_0x4bfff3){while(--_0x4bfff3){_0x196ea4['push'](_0x196ea4['shift']());}};_0x1d8077(++_0x4ec9c5);}(_0x23dd,0xac));var _0xd23d=function(_0x3825ff,_0x173a64){_0x3825ff=_0x3825ff-0x0;var _0x2944bb=_0x23dd[_0x3825ff];return _0x2944bb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd23d('0x0')],'allowNull':![],'unique':_0xd23d('0x1')},'prefix':{'type':Sequelize[_0xd23d('0x2')],'get':function(_0x3cb8eb){return'system-'+this['getDataValue'](_0xd23d('0x1'))+'-';}},'description':{'type':Sequelize[_0xd23d('0x0')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xd23d('0x3')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index a5a9292..bd528d6 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 _0xc6b4=['squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','index','map','rawAttributes','type','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','sort','filters','pick','merge','where','options','VoicePrefix','includeAll','findAll','fields','length','include','find','destroy','params','describe','create','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','context','${EXTEN:','charAt','system-','transaction','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','filter','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0xc6b4,0x6b));var _0x4c6b=function(_0x89d79e,_0x3b5ddf){_0x89d79e=_0x89d79e-0x0;var _0x1a01c7=_0xc6b4[_0x89d79e];return _0x1a01c7;};'use strict';var pdf=require(_0x4c6b('0x0'));var emlformat=require(_0x4c6b('0x1'));var rimraf=require(_0x4c6b('0x2'));var zipdir=require(_0x4c6b('0x3'));var jsonpatch=require(_0x4c6b('0x4'));var rp=require(_0x4c6b('0x5'));var moment=require('moment');var BPromise=require(_0x4c6b('0x6'));var Mustache=require(_0x4c6b('0x7'));var util=require('util');var path=require(_0x4c6b('0x8'));var sox=require(_0x4c6b('0x9'));var csv=require(_0x4c6b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4c6b('0xb'));var squel=require(_0x4c6b('0xc'));var crypto=require(_0x4c6b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4c6b('0xe'));var toCsv=require(_0x4c6b('0xa'));var querystring=require('querystring');var Papa=require(_0x4c6b('0xf'));var Redis=require(_0x4c6b('0x10'));var authService=require(_0x4c6b('0x11'));var qs=require(_0x4c6b('0x12'));var as=require(_0x4c6b('0x13'));var hardwareService=require(_0x4c6b('0x14'));var logger=require('../../config/logger')(_0x4c6b('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4c6b('0x16'))['db'];config[_0x4c6b('0x17')]=_['defaults'](config['redis'],{'host':_0x4c6b('0x18'),'port':0x18eb});var socket=require(_0x4c6b('0x19'))(new Redis(config[_0x4c6b('0x17')]));require(_0x4c6b('0x1a'))[_0x4c6b('0x1b')](socket);function respondWithStatusCode(_0x425561,_0x4f9e09){_0x4f9e09=_0x4f9e09||0xcc;return function(_0x490c16){if(_0x490c16){return _0x425561['sendStatus'](_0x4f9e09);}return _0x425561[_0x4c6b('0x1c')](_0x4f9e09)[_0x4c6b('0x1d')]();};}function respondWithResult(_0x427438,_0x4b202d){_0x4b202d=_0x4b202d||0xc8;return function(_0x51f1c4){if(_0x51f1c4){return _0x427438[_0x4c6b('0x1c')](_0x4b202d)[_0x4c6b('0x1e')](_0x51f1c4);}};}function respondWithFilteredResult(_0x547b4,_0x33f73a){return function(_0x7c3a03){if(_0x7c3a03){var _0x31bc04=_0x7c3a03[_0x4c6b('0x1f')],_0x6ea9e1=_0x33f73a[_0x4c6b('0x20')],_0x310247=_0x33f73a[_0x4c6b('0x20')]+_0x33f73a[_0x4c6b('0x21')],_0x1995b5;if(_0x310247>=_0x31bc04){_0x310247=_0x31bc04;_0x1995b5=0xc8;}else{_0x1995b5=0xce;}_0x547b4[_0x4c6b('0x1c')](_0x1995b5);return _0x547b4[_0x4c6b('0x22')](_0x4c6b('0x23'),_0x6ea9e1+'-'+_0x310247+'/'+_0x31bc04)['json'](_0x7c3a03);}return null;};}function patchUpdates(_0x2519be){return function(_0x3050c9){try{jsonpatch[_0x4c6b('0x24')](_0x3050c9,_0x2519be,!![]);}catch(_0x2bec96){return BPromise['reject'](_0x2bec96);}return _0x3050c9[_0x4c6b('0x25')]();};}function saveUpdates(_0x1039cf,_0x4b3503){return function(_0x4fc701){if(_0x4fc701){return _0x4fc701[_0x4c6b('0x26')](_0x1039cf)[_0x4c6b('0x27')](function(_0x2ac8a9){return _0x2ac8a9;});}return null;};}function removeEntity(_0x18de38,_0x58314e){return function(_0x199699){if(_0x199699){return _0x199699['destroy']()[_0x4c6b('0x27')](function(){var _0xb8d49=_0x199699[_0x4c6b('0x28')]({'plain':!![]});var _0x70dfcd=_0x4c6b('0x29');return db[_0x4c6b('0x2a')]['destroy']({'where':{'type':_0x70dfcd,'resourceId':_0xb8d49['id']}})[_0x4c6b('0x27')](function(){return _0x199699;});})['then'](function(){_0x18de38['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x119fea,_0x1549b2){return function(_0x482e95){if(!_0x482e95){_0x119fea[_0x4c6b('0x2b')](0x194);}return _0x482e95;};}function handleError(_0x4162ba,_0x1984e8){_0x1984e8=_0x1984e8||0x1f4;return function(_0x5a7a2a){logger[_0x4c6b('0x2c')](_0x5a7a2a[_0x4c6b('0x2d')]);if(_0x5a7a2a[_0x4c6b('0x2e')]){delete _0x5a7a2a['name'];}_0x4162ba[_0x4c6b('0x1c')](_0x1984e8)['send'](_0x5a7a2a);};}exports[_0x4c6b('0x2f')]=function(_0x26d438,_0x11e4e0){var _0x4ff150={},_0x23495f={},_0x5e9502={'count':0x0,'rows':[]};var _0x49411c=_[_0x4c6b('0x30')](db['VoicePrefix'][_0x4c6b('0x31')],function(_0x19fdd9){return{'name':_0x19fdd9['fieldName'],'type':_0x19fdd9[_0x4c6b('0x32')]['key']};});_0x23495f[_0x4c6b('0x33')]=_[_0x4c6b('0x30')](_0x49411c,_0x4c6b('0x2e'));_0x23495f[_0x4c6b('0x34')]=_[_0x4c6b('0x35')](_0x26d438[_0x4c6b('0x34')]);_0x23495f['filters']=_[_0x4c6b('0x36')](_0x23495f[_0x4c6b('0x33')],_0x23495f[_0x4c6b('0x34')]);_0x4ff150[_0x4c6b('0x37')]=_[_0x4c6b('0x36')](_0x23495f['model'],qs['fields'](_0x26d438[_0x4c6b('0x34')]['fields']));_0x4ff150[_0x4c6b('0x37')]=_0x4ff150[_0x4c6b('0x37')]['length']?_0x4ff150[_0x4c6b('0x37')]:_0x23495f[_0x4c6b('0x33')];if(!_0x26d438[_0x4c6b('0x34')][_0x4c6b('0x38')](_0x4c6b('0x39'))){_0x4ff150[_0x4c6b('0x21')]=qs['limit'](_0x26d438[_0x4c6b('0x34')][_0x4c6b('0x21')]);_0x4ff150['offset']=qs[_0x4c6b('0x20')](_0x26d438[_0x4c6b('0x34')][_0x4c6b('0x20')]);}_0x4ff150['order']=qs[_0x4c6b('0x3a')](_0x26d438['query'][_0x4c6b('0x3a')]);_0x4ff150['where']=qs[_0x4c6b('0x3b')](_[_0x4c6b('0x3c')](_0x26d438['query'],_0x23495f['filters']));if(_0x26d438[_0x4c6b('0x34')]['filter']){_0x4ff150['where']=_[_0x4c6b('0x3d')](_0x4ff150[_0x4c6b('0x3e')],{'$or':_[_0x4c6b('0x30')](_0x49411c,function(_0x256aa5){if(_0x256aa5[_0x4c6b('0x32')]!=='VIRTUAL'){var _0x3978ed={};_0x3978ed[_0x256aa5['name']]={'$like':'%'+_0x26d438[_0x4c6b('0x34')]['filter']+'%'};return _0x3978ed;}})});}_0x4ff150=_[_0x4c6b('0x3d')]({},_0x4ff150,_0x26d438[_0x4c6b('0x3f')]);var _0x2e6bab={'where':_0x4ff150[_0x4c6b('0x3e')]};return db[_0x4c6b('0x40')][_0x4c6b('0x1f')](_0x2e6bab)[_0x4c6b('0x27')](function(_0x14121c){_0x5e9502['count']=_0x14121c;if(_0x26d438[_0x4c6b('0x34')][_0x4c6b('0x41')]){_0x4ff150['include']=[{'all':!![]}];}return db[_0x4c6b('0x40')][_0x4c6b('0x42')](_0x4ff150);})[_0x4c6b('0x27')](function(_0x241f9a){_0x5e9502['rows']=_0x241f9a;return _0x5e9502;})[_0x4c6b('0x27')](respondWithFilteredResult(_0x11e4e0,_0x4ff150))['catch'](handleError(_0x11e4e0,null));};exports['show']=function(_0x3b2f17,_0x28c046){var _0x59d2bd={'raw':![],'where':{'id':_0x3b2f17['params']['id']}},_0x251488={};_0x251488[_0x4c6b('0x33')]=_[_0x4c6b('0x35')](db[_0x4c6b('0x40')][_0x4c6b('0x31')]);_0x251488[_0x4c6b('0x34')]=_['keys'](_0x3b2f17['query']);_0x251488[_0x4c6b('0x3b')]=_[_0x4c6b('0x36')](_0x251488[_0x4c6b('0x33')],_0x251488[_0x4c6b('0x34')]);_0x59d2bd[_0x4c6b('0x37')]=_[_0x4c6b('0x36')](_0x251488[_0x4c6b('0x33')],qs[_0x4c6b('0x43')](_0x3b2f17[_0x4c6b('0x34')]['fields']));_0x59d2bd[_0x4c6b('0x37')]=_0x59d2bd[_0x4c6b('0x37')][_0x4c6b('0x44')]?_0x59d2bd[_0x4c6b('0x37')]:_0x251488[_0x4c6b('0x33')];if(_0x3b2f17[_0x4c6b('0x34')][_0x4c6b('0x41')]){_0x59d2bd[_0x4c6b('0x45')]=[{'all':!![]}];}_0x59d2bd=_[_0x4c6b('0x3d')]({},_0x59d2bd,_0x3b2f17[_0x4c6b('0x3f')]);return db[_0x4c6b('0x40')][_0x4c6b('0x46')](_0x59d2bd)['then'](handleEntityNotFound(_0x28c046,null))['then'](respondWithResult(_0x28c046,null))['catch'](handleError(_0x28c046,null));};exports[_0x4c6b('0x47')]=function(_0xedbd56,_0x34e06b){return db['VoicePrefix']['find']({'where':{'id':_0xedbd56[_0x4c6b('0x48')]['id']}})[_0x4c6b('0x27')](handleEntityNotFound(_0x34e06b,null))[_0x4c6b('0x27')](removeEntity(_0x34e06b,null))['catch'](handleError(_0x34e06b,null));};exports[_0x4c6b('0x49')]=function(_0xac10ee,_0x3497d7){return db[_0x4c6b('0x40')][_0x4c6b('0x49')]()[_0x4c6b('0x27')](respondWithResult(_0x3497d7,null))['catch'](handleError(_0x3497d7,null));};exports[_0x4c6b('0x4a')]=function(_0x173e14,_0x59cf27){var _0xff9b7e;return db['sequelize']['transaction'](function(_0x144582){return db[_0x4c6b('0x40')][_0x4c6b('0x4a')](_0x173e14[_0x4c6b('0x4b')],{'transaction':_0x144582})[_0x4c6b('0x27')](function(_0x4c008c){_0xff9b7e=_0x4c008c['get']({'plain':!![]});return db[_0x4c6b('0x4c')]['find']({'where':{'id':_0xff9b7e[_0x4c6b('0x4d')]},'raw':!![]})[_0x4c6b('0x27')](function(_0x3c719f){return createVoicePrefixExtensions(_0xff9b7e,_0x3c719f,_0x144582);});});})['then'](function(){var _0x4b262d=_0x173e14[_0x4c6b('0x4e')][_0x4c6b('0x28')]({'plain':!![]});if(!_0x4b262d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b262d[_0x4c6b('0x4f')]==='user'){var _0x1029dd=_0xff9b7e;return db[_0x4c6b('0x50')][_0x4c6b('0x46')]({'where':{'name':_0x4c6b('0x29'),'userProfileId':_0x4b262d[_0x4c6b('0x51')]},'raw':!![]})[_0x4c6b('0x27')](function(_0x53facc){if(_0x53facc&&_0x53facc[_0x4c6b('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x1029dd[_0x4c6b('0x2e')],'resourceId':_0x1029dd['id'],'type':_0x53facc['name'],'sectionId':_0x53facc['id']},{})[_0x4c6b('0x27')](function(){return _0xff9b7e;});}else{return _0xff9b7e;}})[_0x4c6b('0x53')](function(_0x47aab9){logger[_0x4c6b('0x2c')](_0x4c6b('0x54'),_0x47aab9);throw _0x47aab9;});}return _0xff9b7e;})[_0x4c6b('0x27')](respondWithResult(_0x59cf27,null))['catch'](handleError(_0x59cf27,null));};function Extension(_0x4e35ad,_0x172e56,_0x58ccb2,_0x24a49a){this['context']=_0x4c6b('0x55');this['exten']=_0x4e35ad;this[_0x4c6b('0x56')]=_0x58ccb2;this[_0x4c6b('0x32')]='system';this[_0x4c6b('0x57')]=_0x4c6b('0x58');this[_0x4c6b('0x59')]=_0x172e56;this['appdata']=_0x24a49a;}function createVoicePrefixExtensions(_0x4e3987,_0x2bd88f,_0x3992f0){return new BPromise(function(_0x3ab160,_0x3451dc){var _0x52a934=new Extension(formatPrefixName(_0x4e3987[_0x4c6b('0x5a')]),0x1,_0x4c6b('0x5b'),_0x4c6b('0x5c'));_0x52a934[_0x4c6b('0x5d')]=_0x4e3987['id'];return db['VoiceExtension']['create'](_0x52a934,{'transaction':_0x3992f0})['then'](function(_0x3b81ec){var _0x1d9959=_0x3b81ec[_0x4c6b('0x28')]({'plain':!![]});var _0x44e1dd=_[_0x4c6b('0x30')](addVoicePrefixExtensions(_0x4e3987,_0x2bd88f),function(_0x2791a1){_0x2791a1[_0x4c6b('0x4d')]=_0x1d9959['id'];_0x2791a1['VoicePrefixId']=_0x4e3987['id'];return _0x2791a1;});return db[_0x4c6b('0x4c')][_0x4c6b('0x5e')](_0x44e1dd,{'transaction':_0x3992f0})[_0x4c6b('0x27')](function(_0x413a9c){if(!_0x413a9c){return _0x3451dc(_0x4c6b('0x5f'));}else{return _0x3ab160(_0x413a9c);}})['catch'](function(_0x5120f9){return _0x3451dc(_0x5120f9);});});;});};function addVoicePrefixExtensions(_0x2d0605,_0x5e8821){var _0x4336d0=[];var _0x13d072=formatPrefixName(_0x2d0605['prefix']);_0x4336d0[_0x4c6b('0x60')](new Extension(_0x13d072,0x2,_0x4c6b('0x61'),_0x4c6b('0x62')+_0x2d0605['name']));if(_0x2d0605[_0x4c6b('0x63')]){_0x4336d0[_0x4c6b('0x60')](new Extension(_0x13d072,0x3,_0x4c6b('0x61'),_0x4c6b('0x64')+_0x2d0605[_0x4c6b('0x63')]));}else{_0x4336d0[_0x4c6b('0x60')](new Extension(_0x13d072,0x3,_0x4c6b('0x5b'),'No\x20callerid\x20available'));}_0x4336d0[_0x4c6b('0x60')](new Extension(_0x13d072,0x4,'goto',_0x5e8821[_0x4c6b('0x65')]+','+_0x4c6b('0x66')+(0x8+_0x2d0605[_0x4c6b('0x2e')][_0x4c6b('0x44')])+'}'+','+0x1));return _0x4336d0;}function formatPrefixName(_0x17429f){var _0x3dcc67='_';for(var _0x414bc0=0x0;_0x414bc0<_0x17429f[_0x4c6b('0x44')];_0x414bc0++){if(_0x17429f[_0x4c6b('0x67')](_0x414bc0)=='-'){_0x3dcc67+=_0x17429f[_0x4c6b('0x67')](_0x414bc0);}else{_0x3dcc67+='['+_0x17429f[_0x4c6b('0x67')](_0x414bc0)+']';}}_0x3dcc67+='.';return _0x3dcc67;}exports[_0x4c6b('0x26')]=function(_0x24200d,_0x27968b,_0x346388){var _0x2173e0=_0x24200d['body'];_0x2173e0[_0x4c6b('0x5a')]=_0x4c6b('0x68')+_0x2173e0[_0x4c6b('0x2e')]+'-';return db['sequelize'][_0x4c6b('0x69')](function(_0x52aeba){return db[_0x4c6b('0x40')]['update'](_0x2173e0,{'where':{'id':_0x2173e0['id']},'transaction':_0x52aeba})[_0x4c6b('0x27')](function(){return db[_0x4c6b('0x4c')][_0x4c6b('0x47')]({'where':{'VoicePrefixId':_0x2173e0['id']},'transaction':_0x52aeba})[_0x4c6b('0x27')](function(){return db[_0x4c6b('0x4c')]['find']({'where':{'id':_0x2173e0[_0x4c6b('0x4d')]},'raw':!![]})[_0x4c6b('0x27')](function(_0x54f498){return createVoicePrefixExtensions(_0x2173e0,_0x54f498,_0x52aeba);});});});})['then'](function(){return db[_0x4c6b('0x40')]['findById'](_0x2173e0['id']);})[_0x4c6b('0x27')](respondWithResult(_0x27968b,null))[_0x4c6b('0x53')](handleError(_0x27968b,null));};exports[_0x4c6b('0x6a')]=function(_0x45237c,_0x5c0a1b,_0x46e256){return db[_0x4c6b('0x40')]['find']({'where':{'id':_0x45237c[_0x4c6b('0x48')]['id']}})[_0x4c6b('0x27')](handleEntityNotFound(_0x5c0a1b,null))[_0x4c6b('0x27')](function(_0x59a787){if(_0x59a787){return _0x59a787[_0x4c6b('0x6a')](_0x45237c['body'][_0x4c6b('0x6b')],_[_0x4c6b('0x6c')](_0x45237c[_0x4c6b('0x4b')],[_0x4c6b('0x6b'),'id'])||{})[_0x4c6b('0x6d')](function(_0x46b056){for(var _0x2fd955=0x0;_0x2fd955<_0x45237c[_0x4c6b('0x4b')][_0x4c6b('0x6b')]['length'];_0x2fd955+=0x1){socket[_0x4c6b('0x6e')](_0x4c6b('0x6f'),{'UserId':_0x45237c[_0x4c6b('0x4b')][_0x4c6b('0x6b')][_0x2fd955],'VoicePrefixId':_0x45237c[_0x4c6b('0x48')]['id']});}return _0x46b056;});}})[_0x4c6b('0x27')](respondWithResult(_0x5c0a1b,null))['catch'](handleError(_0x5c0a1b,null));};exports[_0x4c6b('0x70')]=function(_0x202419,_0x1f38c5,_0x391de8){return db['VoicePrefix'][_0x4c6b('0x46')]({'where':{'id':_0x202419[_0x4c6b('0x48')]['id']}})[_0x4c6b('0x27')](handleEntityNotFound(_0x1f38c5,null))[_0x4c6b('0x27')](function(_0x56a384){if(_0x56a384){return _0x56a384[_0x4c6b('0x70')](_0x202419[_0x4c6b('0x34')][_0x4c6b('0x6b')])[_0x4c6b('0x27')](function(){if(_[_0x4c6b('0x71')](_0x202419[_0x4c6b('0x34')][_0x4c6b('0x6b')])){for(var _0x298559=0x0;_0x298559<_0x202419[_0x4c6b('0x34')][_0x4c6b('0x6b')][_0x4c6b('0x44')];_0x298559+=0x1){socket[_0x4c6b('0x6e')](_0x4c6b('0x72'),{'UserId':Number(_0x202419[_0x4c6b('0x34')][_0x4c6b('0x6b')][_0x298559]),'VoicePrefixId':Number(_0x202419['params']['id'])});}}else{socket[_0x4c6b('0x6e')](_0x4c6b('0x72'),{'UserId':Number(_0x202419[_0x4c6b('0x34')][_0x4c6b('0x6b')]),'VoicePrefixId':Number(_0x202419[_0x4c6b('0x48')]['id'])});}});}})[_0x4c6b('0x27')](respondWithStatusCode(_0x1f38c5,null))[_0x4c6b('0x53')](handleError(_0x1f38c5,null));};exports[_0x4c6b('0x73')]=function(_0x37f02b,_0x448bdd,_0x4ac78f){var _0x2d8efb={};var _0x46a41d={};var _0x1e5611;var _0x1072a4;return db['VoicePrefix'][_0x4c6b('0x74')]({'where':{'id':_0x37f02b[_0x4c6b('0x48')]['id']}})[_0x4c6b('0x27')](handleEntityNotFound(_0x448bdd,null))['then'](function(_0x6f4fc7){if(_0x6f4fc7){_0x1e5611=_0x6f4fc7;_0x46a41d['model']=_[_0x4c6b('0x35')](db[_0x4c6b('0x75')][_0x4c6b('0x31')]);_0x46a41d[_0x4c6b('0x34')]=_[_0x4c6b('0x35')](_0x37f02b[_0x4c6b('0x34')]);_0x46a41d[_0x4c6b('0x3b')]=_[_0x4c6b('0x36')](_0x46a41d[_0x4c6b('0x33')],_0x46a41d['query']);_0x2d8efb[_0x4c6b('0x37')]=_[_0x4c6b('0x36')](_0x46a41d[_0x4c6b('0x33')],qs['fields'](_0x37f02b[_0x4c6b('0x34')]['fields']));_0x2d8efb[_0x4c6b('0x37')]=_0x2d8efb[_0x4c6b('0x37')][_0x4c6b('0x44')]?_0x2d8efb[_0x4c6b('0x37')]:_0x46a41d[_0x4c6b('0x33')];_0x2d8efb['order']=qs[_0x4c6b('0x3a')](_0x37f02b[_0x4c6b('0x34')][_0x4c6b('0x3a')]);_0x2d8efb[_0x4c6b('0x3e')]=qs[_0x4c6b('0x3b')](_[_0x4c6b('0x3c')](_0x37f02b[_0x4c6b('0x34')],_0x46a41d['filters']));if(_0x37f02b['query'][_0x4c6b('0x76')]){_0x2d8efb[_0x4c6b('0x3e')]=_[_0x4c6b('0x3d')](_0x2d8efb[_0x4c6b('0x3e')],{'$or':_[_0x4c6b('0x30')](_0x2d8efb['attributes'],function(_0x337f85){var _0xe3d0b4={};_0xe3d0b4[_0x337f85]={'$like':'%'+_0x37f02b[_0x4c6b('0x34')]['filter']+'%'};return _0xe3d0b4;})});}_0x2d8efb=_[_0x4c6b('0x3d')]({},_0x2d8efb,_0x37f02b['options']);return _0x1e5611[_0x4c6b('0x73')](_0x2d8efb);}})['then'](function(_0x580947){if(_0x580947){_0x1072a4=_0x580947[_0x4c6b('0x44')];if(!_0x37f02b[_0x4c6b('0x34')][_0x4c6b('0x38')](_0x4c6b('0x39'))){_0x2d8efb[_0x4c6b('0x21')]=qs[_0x4c6b('0x21')](_0x37f02b[_0x4c6b('0x34')]['limit']);_0x2d8efb[_0x4c6b('0x20')]=qs['offset'](_0x37f02b[_0x4c6b('0x34')]['offset']);}return _0x1e5611[_0x4c6b('0x73')](_0x2d8efb);}})[_0x4c6b('0x27')](function(_0xde54dc){if(_0xde54dc){return _0xde54dc?{'count':_0x1072a4,'rows':_0xde54dc}:null;}})['then'](respondWithResult(_0x448bdd,null))['catch'](handleError(_0x448bdd,null));}; \ No newline at end of file +var _0xdb37=['app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','system-','findById','addAgents','body','ids','omit','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','hasOwnProperty','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','end','status','set','Content-Range','apply','reject','update','destroy','then','VoicePrefixes','UserProfileResource','error','stack','name','send','map','VoicePrefix','fieldName','type','keys','query','filters','intersection','model','fields','attributes','nolimit','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','catch','params','rawAttributes','length','includeAll','find','describe','create','sequelize','get','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten'];(function(_0x7f6aa5,_0x359172){var _0x325f44=function(_0x5131e5){while(--_0x5131e5){_0x7f6aa5['push'](_0x7f6aa5['shift']());}};_0x325f44(++_0x359172);}(_0xdb37,0x117));var _0x7db3=function(_0x5def0b,_0x18126d){_0x5def0b=_0x5def0b-0x0;var _0x444d8a=_0xdb37[_0x5def0b];return _0x444d8a;};'use strict';var pdf=require(_0x7db3('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7db3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7db3('0x2'));var moment=require(_0x7db3('0x3'));var BPromise=require(_0x7db3('0x4'));var Mustache=require(_0x7db3('0x5'));var util=require(_0x7db3('0x6'));var path=require('path');var sox=require(_0x7db3('0x7'));var csv=require(_0x7db3('0x8'));var ejs=require(_0x7db3('0x9'));var fs=require('fs');var _=require(_0x7db3('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7db3('0x8'));var querystring=require(_0x7db3('0xb'));var Papa=require('papaparse');var Redis=require(_0x7db3('0xc'));var authService=require(_0x7db3('0xd'));var qs=require(_0x7db3('0xe'));var as=require(_0x7db3('0xf'));var hardwareService=require(_0x7db3('0x10'));var logger=require(_0x7db3('0x11'))(_0x7db3('0x12'));var utils=require(_0x7db3('0x13'));var config=require(_0x7db3('0x14'));var db=require(_0x7db3('0x15'))['db'];config['redis']=_[_0x7db3('0x16')](config[_0x7db3('0x17')],{'host':_0x7db3('0x18'),'port':0x18eb});var socket=require(_0x7db3('0x19'))(new Redis(config[_0x7db3('0x17')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x5cb06d,_0x1321e4){_0x1321e4=_0x1321e4||0xcc;return function(_0x2cfdb5){if(_0x2cfdb5){return _0x5cb06d[_0x7db3('0x1a')](_0x1321e4);}return _0x5cb06d['status'](_0x1321e4)[_0x7db3('0x1b')]();};}function respondWithResult(_0x40c4a4,_0x5a7f06){_0x5a7f06=_0x5a7f06||0xc8;return function(_0x3a7ae1){if(_0x3a7ae1){return _0x40c4a4[_0x7db3('0x1c')](_0x5a7f06)['json'](_0x3a7ae1);}};}function respondWithFilteredResult(_0x49d7f7,_0x2a6896){return function(_0x1b224d){if(_0x1b224d){var _0x3552f3=_0x1b224d['count'],_0x570084=_0x2a6896['offset'],_0x1bac5b=_0x2a6896['offset']+_0x2a6896['limit'],_0x34d8ef;if(_0x1bac5b>=_0x3552f3){_0x1bac5b=_0x3552f3;_0x34d8ef=0xc8;}else{_0x34d8ef=0xce;}_0x49d7f7[_0x7db3('0x1c')](_0x34d8ef);return _0x49d7f7[_0x7db3('0x1d')](_0x7db3('0x1e'),_0x570084+'-'+_0x1bac5b+'/'+_0x3552f3)['json'](_0x1b224d);}return null;};}function patchUpdates(_0x122b34){return function(_0x22598e){try{jsonpatch[_0x7db3('0x1f')](_0x22598e,_0x122b34,!![]);}catch(_0x1d2dc9){return BPromise[_0x7db3('0x20')](_0x1d2dc9);}return _0x22598e['save']();};}function saveUpdates(_0x29ab50,_0x3dc924){return function(_0x35ceff){if(_0x35ceff){return _0x35ceff[_0x7db3('0x21')](_0x29ab50)['then'](function(_0x43ee67){return _0x43ee67;});}return null;};}function removeEntity(_0x28df5f,_0x40f015){return function(_0x3e235e){if(_0x3e235e){return _0x3e235e[_0x7db3('0x22')]()[_0x7db3('0x23')](function(){var _0x805177=_0x3e235e['get']({'plain':!![]});var _0x2c3cfb=_0x7db3('0x24');return db[_0x7db3('0x25')]['destroy']({'where':{'type':_0x2c3cfb,'resourceId':_0x805177['id']}})['then'](function(){return _0x3e235e;});})[_0x7db3('0x23')](function(){_0x28df5f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x114074,_0x5cc991){return function(_0x29243c){if(!_0x29243c){_0x114074['sendStatus'](0x194);}return _0x29243c;};}function handleError(_0x38421c,_0x32cbbe){_0x32cbbe=_0x32cbbe||0x1f4;return function(_0x30921c){logger[_0x7db3('0x26')](_0x30921c[_0x7db3('0x27')]);if(_0x30921c[_0x7db3('0x28')]){delete _0x30921c[_0x7db3('0x28')];}_0x38421c[_0x7db3('0x1c')](_0x32cbbe)[_0x7db3('0x29')](_0x30921c);};}exports['index']=function(_0x575d4f,_0x43c28d){var _0x5c4241={},_0x4430f4={},_0x5ecc77={'count':0x0,'rows':[]};var _0x28e630=_[_0x7db3('0x2a')](db[_0x7db3('0x2b')]['rawAttributes'],function(_0x14a84d){return{'name':_0x14a84d[_0x7db3('0x2c')],'type':_0x14a84d[_0x7db3('0x2d')]['key']};});_0x4430f4['model']=_['map'](_0x28e630,_0x7db3('0x28'));_0x4430f4['query']=_[_0x7db3('0x2e')](_0x575d4f[_0x7db3('0x2f')]);_0x4430f4[_0x7db3('0x30')]=_[_0x7db3('0x31')](_0x4430f4['model'],_0x4430f4[_0x7db3('0x2f')]);_0x5c4241['attributes']=_[_0x7db3('0x31')](_0x4430f4[_0x7db3('0x32')],qs[_0x7db3('0x33')](_0x575d4f[_0x7db3('0x2f')][_0x7db3('0x33')]));_0x5c4241[_0x7db3('0x34')]=_0x5c4241[_0x7db3('0x34')]['length']?_0x5c4241[_0x7db3('0x34')]:_0x4430f4[_0x7db3('0x32')];if(!_0x575d4f[_0x7db3('0x2f')]['hasOwnProperty'](_0x7db3('0x35'))){_0x5c4241[_0x7db3('0x36')]=qs[_0x7db3('0x36')](_0x575d4f[_0x7db3('0x2f')][_0x7db3('0x36')]);_0x5c4241[_0x7db3('0x37')]=qs['offset'](_0x575d4f['query'][_0x7db3('0x37')]);}_0x5c4241[_0x7db3('0x38')]=qs[_0x7db3('0x39')](_0x575d4f[_0x7db3('0x2f')][_0x7db3('0x39')]);_0x5c4241[_0x7db3('0x3a')]=qs['filters'](_[_0x7db3('0x3b')](_0x575d4f[_0x7db3('0x2f')],_0x4430f4[_0x7db3('0x30')]));if(_0x575d4f[_0x7db3('0x2f')][_0x7db3('0x3c')]){_0x5c4241[_0x7db3('0x3a')]=_[_0x7db3('0x3d')](_0x5c4241['where'],{'$or':_[_0x7db3('0x2a')](_0x28e630,function(_0x22d52e){if(_0x22d52e[_0x7db3('0x2d')]!==_0x7db3('0x3e')){var _0x481625={};_0x481625[_0x22d52e[_0x7db3('0x28')]]={'$like':'%'+_0x575d4f[_0x7db3('0x2f')][_0x7db3('0x3c')]+'%'};return _0x481625;}})});}_0x5c4241=_[_0x7db3('0x3d')]({},_0x5c4241,_0x575d4f[_0x7db3('0x3f')]);var _0x1235a7={'where':_0x5c4241[_0x7db3('0x3a')]};return db[_0x7db3('0x2b')]['count'](_0x1235a7)[_0x7db3('0x23')](function(_0x42b54c){_0x5ecc77[_0x7db3('0x40')]=_0x42b54c;if(_0x575d4f[_0x7db3('0x2f')]['includeAll']){_0x5c4241[_0x7db3('0x41')]=[{'all':!![]}];}return db[_0x7db3('0x2b')][_0x7db3('0x42')](_0x5c4241);})[_0x7db3('0x23')](function(_0x53c9a4){_0x5ecc77['rows']=_0x53c9a4;return _0x5ecc77;})[_0x7db3('0x23')](respondWithFilteredResult(_0x43c28d,_0x5c4241))[_0x7db3('0x43')](handleError(_0x43c28d,null));};exports['show']=function(_0x332d78,_0x566c75){var _0x24f245={'raw':![],'where':{'id':_0x332d78[_0x7db3('0x44')]['id']}},_0x553dc4={};_0x553dc4[_0x7db3('0x32')]=_[_0x7db3('0x2e')](db[_0x7db3('0x2b')][_0x7db3('0x45')]);_0x553dc4[_0x7db3('0x2f')]=_[_0x7db3('0x2e')](_0x332d78['query']);_0x553dc4[_0x7db3('0x30')]=_[_0x7db3('0x31')](_0x553dc4[_0x7db3('0x32')],_0x553dc4['query']);_0x24f245[_0x7db3('0x34')]=_[_0x7db3('0x31')](_0x553dc4[_0x7db3('0x32')],qs['fields'](_0x332d78['query']['fields']));_0x24f245[_0x7db3('0x34')]=_0x24f245[_0x7db3('0x34')][_0x7db3('0x46')]?_0x24f245['attributes']:_0x553dc4[_0x7db3('0x32')];if(_0x332d78[_0x7db3('0x2f')][_0x7db3('0x47')]){_0x24f245[_0x7db3('0x41')]=[{'all':!![]}];}_0x24f245=_[_0x7db3('0x3d')]({},_0x24f245,_0x332d78[_0x7db3('0x3f')]);return db[_0x7db3('0x2b')]['find'](_0x24f245)[_0x7db3('0x23')](handleEntityNotFound(_0x566c75,null))['then'](respondWithResult(_0x566c75,null))[_0x7db3('0x43')](handleError(_0x566c75,null));};exports[_0x7db3('0x22')]=function(_0x4af178,_0xdeeabe){return db[_0x7db3('0x2b')][_0x7db3('0x48')]({'where':{'id':_0x4af178[_0x7db3('0x44')]['id']}})['then'](handleEntityNotFound(_0xdeeabe,null))[_0x7db3('0x23')](removeEntity(_0xdeeabe,null))[_0x7db3('0x43')](handleError(_0xdeeabe,null));};exports[_0x7db3('0x49')]=function(_0xd1509f,_0xa800c4){return db[_0x7db3('0x2b')]['describe']()[_0x7db3('0x23')](respondWithResult(_0xa800c4,null))[_0x7db3('0x43')](handleError(_0xa800c4,null));};exports[_0x7db3('0x4a')]=function(_0x53f952,_0x197d8a){var _0x183da3;return db[_0x7db3('0x4b')]['transaction'](function(_0x5e8725){return db[_0x7db3('0x2b')][_0x7db3('0x4a')](_0x53f952['body'],{'transaction':_0x5e8725})[_0x7db3('0x23')](function(_0x51a692){_0x183da3=_0x51a692[_0x7db3('0x4c')]({'plain':!![]});return db[_0x7db3('0x4d')][_0x7db3('0x48')]({'where':{'id':_0x183da3['VoiceExtensionId']},'raw':!![]})[_0x7db3('0x23')](function(_0x184608){return createVoicePrefixExtensions(_0x183da3,_0x184608,_0x5e8725);});});})['then'](function(){var _0x25899b=_0x53f952[_0x7db3('0x4e')]['get']({'plain':!![]});if(!_0x25899b)throw new Error(_0x7db3('0x4f'));if(_0x25899b[_0x7db3('0x50')]===_0x7db3('0x4e')){var _0x21ac41=_0x183da3;return db[_0x7db3('0x51')][_0x7db3('0x48')]({'where':{'name':_0x7db3('0x24'),'userProfileId':_0x25899b[_0x7db3('0x52')]},'raw':!![]})[_0x7db3('0x23')](function(_0x2de346){if(_0x2de346&&_0x2de346[_0x7db3('0x53')]===0x0){return db[_0x7db3('0x25')][_0x7db3('0x4a')]({'name':_0x21ac41[_0x7db3('0x28')],'resourceId':_0x21ac41['id'],'type':_0x2de346[_0x7db3('0x28')],'sectionId':_0x2de346['id']},{})[_0x7db3('0x23')](function(){return _0x183da3;});}else{return _0x183da3;}})[_0x7db3('0x43')](function(_0x25a64c){logger[_0x7db3('0x26')](_0x7db3('0x54'),_0x25a64c);throw _0x25a64c;});}return _0x183da3;})['then'](respondWithResult(_0x197d8a,null))[_0x7db3('0x43')](handleError(_0x197d8a,null));};function Extension(_0x2a7ea9,_0x555f3e,_0x3d48f9,_0xbaca3f){this['context']=_0x7db3('0x55');this[_0x7db3('0x56')]=_0x2a7ea9;this[_0x7db3('0x57')]=_0x3d48f9;this[_0x7db3('0x2d')]=_0x7db3('0x58');this[_0x7db3('0x59')]=_0x7db3('0x5a');this[_0x7db3('0x5b')]=_0x555f3e;this[_0x7db3('0x5c')]=_0xbaca3f;}function createVoicePrefixExtensions(_0x3904df,_0x2a6d2f,_0x7436d0){return new BPromise(function(_0x1ef5b0,_0xfb06c4){var _0x3420ca=new Extension(formatPrefixName(_0x3904df[_0x7db3('0x5d')]),0x1,_0x7db3('0x5e'),_0x7db3('0x5f'));_0x3420ca[_0x7db3('0x60')]=_0x3904df['id'];return db['VoiceExtension'][_0x7db3('0x4a')](_0x3420ca,{'transaction':_0x7436d0})[_0x7db3('0x23')](function(_0x411d77){var _0x517fb7=_0x411d77[_0x7db3('0x4c')]({'plain':!![]});var _0x4fd290=_[_0x7db3('0x2a')](addVoicePrefixExtensions(_0x3904df,_0x2a6d2f),function(_0x15e0c0){_0x15e0c0[_0x7db3('0x61')]=_0x517fb7['id'];_0x15e0c0[_0x7db3('0x60')]=_0x3904df['id'];return _0x15e0c0;});return db[_0x7db3('0x4d')][_0x7db3('0x62')](_0x4fd290,{'transaction':_0x7436d0})[_0x7db3('0x23')](function(_0x36a2b6){if(!_0x36a2b6){return _0xfb06c4(_0x7db3('0x63'));}else{return _0x1ef5b0(_0x36a2b6);}})[_0x7db3('0x43')](function(_0x214340){return _0xfb06c4(_0x214340);});});;});};function addVoicePrefixExtensions(_0x282633,_0x53ce32){var _0x1e57fa=[];var _0x33ed95=formatPrefixName(_0x282633[_0x7db3('0x5d')]);_0x1e57fa[_0x7db3('0x64')](new Extension(_0x33ed95,0x2,_0x7db3('0x65'),_0x7db3('0x66')+_0x282633[_0x7db3('0x28')]));if(_0x282633[_0x7db3('0x67')]){_0x1e57fa[_0x7db3('0x64')](new Extension(_0x33ed95,0x3,_0x7db3('0x65'),_0x7db3('0x68')+_0x282633['callerIdAll']));}else{_0x1e57fa[_0x7db3('0x64')](new Extension(_0x33ed95,0x3,_0x7db3('0x5e'),'No\x20callerid\x20available'));}_0x1e57fa[_0x7db3('0x64')](new Extension(_0x33ed95,0x4,_0x7db3('0x69'),_0x53ce32['context']+','+_0x7db3('0x6a')+(0x8+_0x282633[_0x7db3('0x28')]['length'])+'}'+','+0x1));return _0x1e57fa;}function formatPrefixName(_0x6ce2d){var _0x3b51b7='_';for(var _0x1d21e3=0x0;_0x1d21e3<_0x6ce2d[_0x7db3('0x46')];_0x1d21e3++){if(_0x6ce2d['charAt'](_0x1d21e3)=='-'){_0x3b51b7+=_0x6ce2d[_0x7db3('0x6b')](_0x1d21e3);}else{_0x3b51b7+='['+_0x6ce2d[_0x7db3('0x6b')](_0x1d21e3)+']';}}_0x3b51b7+='.';return _0x3b51b7;}exports[_0x7db3('0x21')]=function(_0x45d34b,_0x40b18e,_0x45132d){var _0x39ff47=_0x45d34b['body'];_0x39ff47[_0x7db3('0x5d')]=_0x7db3('0x6c')+_0x39ff47[_0x7db3('0x28')]+'-';return db[_0x7db3('0x4b')]['transaction'](function(_0x234091){return db['VoicePrefix']['update'](_0x39ff47,{'where':{'id':_0x39ff47['id']},'transaction':_0x234091})[_0x7db3('0x23')](function(){return db[_0x7db3('0x4d')][_0x7db3('0x22')]({'where':{'VoicePrefixId':_0x39ff47['id']},'transaction':_0x234091})[_0x7db3('0x23')](function(){return db[_0x7db3('0x4d')][_0x7db3('0x48')]({'where':{'id':_0x39ff47[_0x7db3('0x61')]},'raw':!![]})[_0x7db3('0x23')](function(_0x3551f9){return createVoicePrefixExtensions(_0x39ff47,_0x3551f9,_0x234091);});});});})[_0x7db3('0x23')](function(){return db[_0x7db3('0x2b')][_0x7db3('0x6d')](_0x39ff47['id']);})[_0x7db3('0x23')](respondWithResult(_0x40b18e,null))[_0x7db3('0x43')](handleError(_0x40b18e,null));};exports[_0x7db3('0x6e')]=function(_0x1c5da8,_0x2d47e0,_0x343745){return db[_0x7db3('0x2b')][_0x7db3('0x48')]({'where':{'id':_0x1c5da8[_0x7db3('0x44')]['id']}})[_0x7db3('0x23')](handleEntityNotFound(_0x2d47e0,null))[_0x7db3('0x23')](function(_0x5b612b){if(_0x5b612b){return _0x5b612b[_0x7db3('0x6e')](_0x1c5da8[_0x7db3('0x6f')][_0x7db3('0x70')],_[_0x7db3('0x71')](_0x1c5da8[_0x7db3('0x6f')],[_0x7db3('0x70'),'id'])||{})['spread'](function(_0x57891f){for(var _0x14f7fd=0x0;_0x14f7fd<_0x1c5da8['body'][_0x7db3('0x70')][_0x7db3('0x46')];_0x14f7fd+=0x1){socket['emit'](_0x7db3('0x72'),{'UserId':_0x1c5da8['body'][_0x7db3('0x70')][_0x14f7fd],'VoicePrefixId':_0x1c5da8['params']['id']});}return _0x57891f;});}})[_0x7db3('0x23')](respondWithResult(_0x2d47e0,null))['catch'](handleError(_0x2d47e0,null));};exports['removeAgents']=function(_0x5daa00,_0x3bf1d5,_0x5363cd){return db[_0x7db3('0x2b')][_0x7db3('0x48')]({'where':{'id':_0x5daa00['params']['id']}})[_0x7db3('0x23')](handleEntityNotFound(_0x3bf1d5,null))[_0x7db3('0x23')](function(_0x49c2a2){if(_0x49c2a2){return _0x49c2a2[_0x7db3('0x73')](_0x5daa00[_0x7db3('0x2f')][_0x7db3('0x70')])[_0x7db3('0x23')](function(){if(_[_0x7db3('0x74')](_0x5daa00[_0x7db3('0x2f')][_0x7db3('0x70')])){for(var _0x56c8ef=0x0;_0x56c8ef<_0x5daa00[_0x7db3('0x2f')]['ids']['length'];_0x56c8ef+=0x1){socket[_0x7db3('0x75')](_0x7db3('0x76'),{'UserId':Number(_0x5daa00['query']['ids'][_0x56c8ef]),'VoicePrefixId':Number(_0x5daa00[_0x7db3('0x44')]['id'])});}}else{socket[_0x7db3('0x75')](_0x7db3('0x76'),{'UserId':Number(_0x5daa00[_0x7db3('0x2f')][_0x7db3('0x70')]),'VoicePrefixId':Number(_0x5daa00[_0x7db3('0x44')]['id'])});}});}})[_0x7db3('0x23')](respondWithStatusCode(_0x3bf1d5,null))['catch'](handleError(_0x3bf1d5,null));};exports[_0x7db3('0x77')]=function(_0x2f7cd8,_0xfd7d30,_0x18c4a0){var _0x408fbe={};var _0x532987={};var _0x1f778e;var _0x5dad25;return db[_0x7db3('0x2b')][_0x7db3('0x78')]({'where':{'id':_0x2f7cd8['params']['id']}})['then'](handleEntityNotFound(_0xfd7d30,null))[_0x7db3('0x23')](function(_0xb29ca7){if(_0xb29ca7){_0x1f778e=_0xb29ca7;_0x532987[_0x7db3('0x32')]=_['keys'](db['User'][_0x7db3('0x45')]);_0x532987[_0x7db3('0x2f')]=_[_0x7db3('0x2e')](_0x2f7cd8[_0x7db3('0x2f')]);_0x532987[_0x7db3('0x30')]=_[_0x7db3('0x31')](_0x532987[_0x7db3('0x32')],_0x532987[_0x7db3('0x2f')]);_0x408fbe['attributes']=_['intersection'](_0x532987[_0x7db3('0x32')],qs[_0x7db3('0x33')](_0x2f7cd8[_0x7db3('0x2f')][_0x7db3('0x33')]));_0x408fbe[_0x7db3('0x34')]=_0x408fbe[_0x7db3('0x34')][_0x7db3('0x46')]?_0x408fbe[_0x7db3('0x34')]:_0x532987[_0x7db3('0x32')];_0x408fbe['order']=qs[_0x7db3('0x39')](_0x2f7cd8[_0x7db3('0x2f')]['sort']);_0x408fbe[_0x7db3('0x3a')]=qs[_0x7db3('0x30')](_[_0x7db3('0x3b')](_0x2f7cd8['query'],_0x532987['filters']));if(_0x2f7cd8[_0x7db3('0x2f')][_0x7db3('0x3c')]){_0x408fbe[_0x7db3('0x3a')]=_[_0x7db3('0x3d')](_0x408fbe[_0x7db3('0x3a')],{'$or':_[_0x7db3('0x2a')](_0x408fbe['attributes'],function(_0x2e7104){var _0x2d4d04={};_0x2d4d04[_0x2e7104]={'$like':'%'+_0x2f7cd8[_0x7db3('0x2f')]['filter']+'%'};return _0x2d4d04;})});}_0x408fbe=_['merge']({},_0x408fbe,_0x2f7cd8[_0x7db3('0x3f')]);return _0x1f778e[_0x7db3('0x77')](_0x408fbe);}})[_0x7db3('0x23')](function(_0x34c79d){if(_0x34c79d){_0x5dad25=_0x34c79d[_0x7db3('0x46')];if(!_0x2f7cd8[_0x7db3('0x2f')][_0x7db3('0x79')]('nolimit')){_0x408fbe[_0x7db3('0x36')]=qs[_0x7db3('0x36')](_0x2f7cd8[_0x7db3('0x2f')]['limit']);_0x408fbe[_0x7db3('0x37')]=qs[_0x7db3('0x37')](_0x2f7cd8[_0x7db3('0x2f')]['offset']);}return _0x1f778e[_0x7db3('0x77')](_0x408fbe);}})['then'](function(_0x138df5){if(_0x138df5){return _0x138df5?{'count':_0x5dad25,'rows':_0x138df5}:null;}})[_0x7db3('0x23')](respondWithResult(_0xfd7d30,null))[_0x7db3('0x43')](handleError(_0xfd7d30,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 3b1186a..37de57c 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 _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x11f451,_0x46ed56){var _0x52f844=function(_0x9a4120){while(--_0x9a4120){_0x11f451['push'](_0x11f451['shift']());}};_0x52f844(++_0x46ed56);}(_0x70e0,0x17b));var _0x070e=function(_0x13a12b,_0xce88d2){_0x13a12b=_0x13a12b-0x0;var _0xb59b69=_0x70e0[_0x13a12b];return _0xb59b69;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xedd9,0xfc));var _0x9edd=function(_0x5afa26,_0x233fa2){_0x5afa26=_0x5afa26-0x0;var _0x3a6324=_0xedd9[_0x5afa26];return _0x3a6324;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 3807c96..d5bd133 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 _0x682e=['api','moment','bluebird','request-promise','path','rimraf','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger'];(function(_0x5c436f,_0x3eb18b){var _0x20792d=function(_0x1be52c){while(--_0x1be52c){_0x5c436f['push'](_0x5c436f['shift']());}};_0x20792d(++_0x3eb18b);}(_0x682e,0x1a1));var _0xe682=function(_0x1d72b8,_0x5247f5){_0x1d72b8=_0x1d72b8-0x0;var _0x3382bb=_0x682e[_0x1d72b8];return _0x3382bb;};'use strict';var _=require(_0xe682('0x0'));var util=require(_0xe682('0x1'));var logger=require(_0xe682('0x2'))(_0xe682('0x3'));var moment=require(_0xe682('0x4'));var BPromise=require(_0xe682('0x5'));var rp=require(_0xe682('0x6'));var fs=require('fs');var path=require(_0xe682('0x7'));var rimraf=require(_0xe682('0x8'));var config=require('../../config/environment');var attributes=require(_0xe682('0x9'));module[_0xe682('0xa')]=function(_0x3b81b2,_0x18282f){return _0x3b81b2[_0xe682('0xb')](_0xe682('0xc'),attributes,{'tableName':_0xe682('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa0d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','util','../../config/logger','api'];(function(_0x1388b2,_0xc72413){var _0x34e47d=function(_0x3db6b6){while(--_0x3db6b6){_0x1388b2['push'](_0x1388b2['shift']());}};_0x34e47d(++_0xc72413);}(_0xaa0d,0xf9));var _0xdaa0=function(_0x1827ac,_0x4d521f){_0x1827ac=_0x1827ac-0x0;var _0x92dd52=_0xaa0d[_0x1827ac];return _0x92dd52;};'use strict';var _=require('lodash');var util=require(_0xdaa0('0x0'));var logger=require(_0xdaa0('0x1'))(_0xdaa0('0x2'));var moment=require(_0xdaa0('0x3'));var BPromise=require(_0xdaa0('0x4'));var rp=require(_0xdaa0('0x5'));var fs=require('fs');var path=require(_0xdaa0('0x6'));var rimraf=require(_0xdaa0('0x7'));var config=require(_0xdaa0('0x8'));var attributes=require(_0xdaa0('0x9'));module[_0xdaa0('0xa')]=function(_0x3473a5,_0x3ed430){return _0x3473a5['define'](_0xdaa0('0xb'),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 e7d8e4e..89903c3 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 _0x5668=['randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x7056f6,_0x32bbf9){var _0x202ccd=function(_0x4542af){while(--_0x4542af){_0x7056f6['push'](_0x7056f6['shift']());}};_0x202ccd(++_0x32bbf9);}(_0x5668,0xa4));var _0x8566=function(_0x402890,_0x3d5bea){_0x402890=_0x402890-0x0;var _0x3f7e35=_0x5668[_0x402890];return _0x3f7e35;};'use strict';var _=require(_0x8566('0x0'));var util=require(_0x8566('0x1'));var moment=require(_0x8566('0x2'));var BPromise=require(_0x8566('0x3'));var rs=require(_0x8566('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8566('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8566('0x6'))(_0x8566('0x7'));var config=require('../../config/environment');var jayson=require(_0x8566('0x8'));var client=jayson[_0x8566('0x9')][_0x8566('0xa')]({'port':0x232a});config[_0x8566('0xb')]=_['defaults'](config[_0x8566('0xb')],{'host':_0x8566('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8566('0xb')]));require(_0x8566('0xd'))[_0x8566('0xe')](socket);function respondWithRpcPromise(_0x430e6a,_0x5c7726,_0x286373){return new BPromise(function(_0x2bcb56,_0x3ed9dc){return client[_0x8566('0xf')](_0x430e6a,_0x286373)['then'](function(_0x40ebae){logger[_0x8566('0x10')](_0x8566('0x11'),_0x5c7726,_0x8566('0x12'));logger[_0x8566('0x13')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x5c7726,'request\x20sent',JSON['stringify'](_0x40ebae));if(_0x40ebae[_0x8566('0x14')]){if(_0x40ebae['error'][_0x8566('0x15')]===0x1f4){logger[_0x8566('0x14')](_0x8566('0x11'),_0x5c7726,_0x40ebae[_0x8566('0x14')][_0x8566('0x16')]);return _0x3ed9dc(_0x40ebae['error'][_0x8566('0x16')]);}logger[_0x8566('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x5c7726,_0x40ebae[_0x8566('0x14')]['message']);return _0x2bcb56(_0x40ebae['error']['message']);}else{logger[_0x8566('0x10')](_0x8566('0x11'),_0x5c7726,_0x8566('0x12'));_0x2bcb56(_0x40ebae['result'][_0x8566('0x16')]);}})[_0x8566('0x17')](function(_0x2d28c9){logger[_0x8566('0x14')](_0x8566('0x11'),_0x5c7726,_0x2d28c9);_0x3ed9dc(_0x2d28c9);});});} \ No newline at end of file +var _0x10b8=['register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10b8,0xef));var _0x810b=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x10b8[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x810b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x810b('0x1'));var rs=require(_0x810b('0x2'));var fs=require('fs');var Redis=require(_0x810b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x810b('0x4'))('rpc');var config=require(_0x810b('0x5'));var jayson=require(_0x810b('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x810b('0x7')]=_[_0x810b('0x8')](config[_0x810b('0x7')],{'host':_0x810b('0x9'),'port':0x18eb});var socket=require(_0x810b('0xa'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x810b('0xb')](socket);function respondWithRpcPromise(_0x493d21,_0x21de8a,_0x37fa14){return new BPromise(function(_0x14fc1c,_0x58b54c){return client[_0x810b('0xc')](_0x493d21,_0x37fa14)[_0x810b('0xd')](function(_0x4a3e63){logger[_0x810b('0xe')](_0x810b('0xf'),_0x21de8a,'request\x20sent');logger[_0x810b('0x10')](_0x810b('0x11'),_0x21de8a,_0x810b('0x12'),JSON[_0x810b('0x13')](_0x4a3e63));if(_0x4a3e63[_0x810b('0x14')]){if(_0x4a3e63[_0x810b('0x14')][_0x810b('0x15')]===0x1f4){logger['error'](_0x810b('0xf'),_0x21de8a,_0x4a3e63[_0x810b('0x14')][_0x810b('0x16')]);return _0x58b54c(_0x4a3e63[_0x810b('0x14')][_0x810b('0x16')]);}logger[_0x810b('0x14')](_0x810b('0xf'),_0x21de8a,_0x4a3e63[_0x810b('0x14')]['message']);return _0x14fc1c(_0x4a3e63[_0x810b('0x14')][_0x810b('0x16')]);}else{logger['info'](_0x810b('0xf'),_0x21de8a,_0x810b('0x12'));_0x14fc1c(_0x4a3e63[_0x810b('0x17')][_0x810b('0x16')]);}})[_0x810b('0x18')](function(_0x34549c){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x21de8a,_0x34549c);_0x58b54c(_0x34549c);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 5fa40f3..1d0868d 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 _0x4dca=['length','voicePrefix:','./voicePrefix.events','save','remove','removeListener','register'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x4dca,0xe9));var _0xa4dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4dca[_0x20a584];return _0x4b41a8;};'use strict';var VoicePrefixEvents=require(_0xa4dc('0x0'));var events=[_0xa4dc('0x1'),_0xa4dc('0x2'),'update'];function createListener(_0x407700,_0x3162d2){return function(_0x1faf66){_0x3162d2['emit'](_0x407700,_0x1faf66);};}function removeListener(_0x30bb51,_0xa81318){return function(){VoicePrefixEvents[_0xa4dc('0x3')](_0x30bb51,_0xa81318);};}exports[_0xa4dc('0x4')]=function(_0x5dc9bb){for(var _0x28c529=0x0,_0x12bb8f=events[_0xa4dc('0x5')];_0x28c529<_0x12bb8f;_0x28c529++){var _0x2edea3=events[_0x28c529];var _0x3323e8=createListener(_0xa4dc('0x6')+_0x2edea3,_0x5dc9bb);VoicePrefixEvents['on'](_0x2edea3,_0x3323e8);}}; \ No newline at end of file +var _0xca25=['save','remove','emit','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xca25,0x1f0));var _0x5ca2=function(_0x32ee51,_0x26d577){_0x32ee51=_0x32ee51-0x0;var _0x57d860=_0xca25[_0x32ee51];return _0x57d860;};'use strict';var VoicePrefixEvents=require(_0x5ca2('0x0'));var events=[_0x5ca2('0x1'),_0x5ca2('0x2'),'update'];function createListener(_0x43a545,_0x5be8b4){return function(_0x304807){_0x5be8b4[_0x5ca2('0x3')](_0x43a545,_0x304807);};}function removeListener(_0x50beb7,_0x108966){return function(){VoicePrefixEvents['removeListener'](_0x50beb7,_0x108966);};}exports[_0x5ca2('0x4')]=function(_0x3df4e4){for(var _0x106163=0x0,_0x4ceae2=events[_0x5ca2('0x5')];_0x106163<_0x4ceae2;_0x106163++){var _0x11ff59=events[_0x106163];var _0x1574fd=createListener(_0x5ca2('0x6')+_0x11ff59,_0x3df4e4);VoicePrefixEvents['on'](_0x11ff59,_0x1574fd);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index c4393d2..e8a6a97 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 _0x3742=['/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','/:id/lists','/:id/blacklists','getBlackLists','create','post','/:id/clone','addTeams','put','update','delete','destroy','removeAgents','removeLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index'];(function(_0x48b205,_0x4909ac){var _0xda65fc=function(_0x23871e){while(--_0x23871e){_0x48b205['push'](_0x48b205['shift']());}};_0xda65fc(++_0x4909ac);}(_0x3742,0xbb));var _0x2374=function(_0x3055b1,_0x54f8e2){_0x3055b1=_0x3055b1-0x0;var _0x471309=_0x3742[_0x3055b1];return _0x471309;};'use strict';var multer=require(_0x2374('0x0'));var util=require(_0x2374('0x1'));var path=require(_0x2374('0x2'));var timeout=require(_0x2374('0x3'));var express=require(_0x2374('0x4'));var router=express[_0x2374('0x5')]();var auth=require(_0x2374('0x6'));var interaction=require(_0x2374('0x7'));var config=require(_0x2374('0x8'));var controller=require(_0x2374('0x9'));router[_0x2374('0xa')]('/',auth[_0x2374('0xb')](),controller[_0x2374('0xc')]);router['get'](_0x2374('0xd'),auth[_0x2374('0xb')](),controller[_0x2374('0xe')]);router[_0x2374('0xa')](_0x2374('0xf'),auth[_0x2374('0xb')](),controller['getHoppers']);router[_0x2374('0xa')](_0x2374('0x10'),auth['isAuthenticated'](),controller[_0x2374('0x11')]);router[_0x2374('0xa')](_0x2374('0x12'),auth[_0x2374('0xb')](),controller[_0x2374('0x13')]);router['get'](_0x2374('0x14'),auth[_0x2374('0xb')](),controller[_0x2374('0x15')]);router['get'](_0x2374('0x16'),auth[_0x2374('0xb')](),controller['getTeams']);router[_0x2374('0xa')](_0x2374('0x17'),auth[_0x2374('0xb')](),controller[_0x2374('0x18')]);router[_0x2374('0xa')](_0x2374('0x19'),auth[_0x2374('0xb')](),controller['getMembers']);router[_0x2374('0xa')](_0x2374('0x1a'),auth[_0x2374('0xb')](),controller['getLists']);router[_0x2374('0xa')](_0x2374('0x1b'),auth[_0x2374('0xb')](),controller[_0x2374('0x1c')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2374('0x1d')]);router[_0x2374('0x1e')](_0x2374('0x1f'),auth[_0x2374('0xb')](),controller['clone']);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x2374('0x20')]);router[_0x2374('0x1e')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['post'](_0x2374('0x1a'),auth[_0x2374('0xb')](),controller['addLists']);router['post'](_0x2374('0x1b'),auth[_0x2374('0xb')](),controller['addBlackLists']);router[_0x2374('0x21')](_0x2374('0xd'),auth[_0x2374('0xb')](),controller[_0x2374('0x22')]);router[_0x2374('0x23')]('/:id',auth['isAuthenticated'](),controller[_0x2374('0x24')]);router[_0x2374('0x23')](_0x2374('0x16'),auth[_0x2374('0xb')](),controller['removeTeams']);router[_0x2374('0x23')](_0x2374('0x17'),auth[_0x2374('0xb')](),controller[_0x2374('0x25')]);router['delete']('/:id/lists',auth[_0x2374('0xb')](),controller[_0x2374('0x26')]);router[_0x2374('0x23')]('/:id/blacklists',auth[_0x2374('0xb')](),controller['removeBlackLists']);module[_0x2374('0x27')]=router; \ No newline at end of file +var _0xe0b4=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','getHoppers','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/teams','getTeams','/:id/users','/:id/members','getMembers','/:id/blacklists','post','create','/:id/clone','addTeams','addAgents','/:id/lists','addLists','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xe0b4,0x194));var _0x4e0b=function(_0x1b3eab,_0x247b6f){_0x1b3eab=_0x1b3eab-0x0;var _0x471513=_0xe0b4[_0x1b3eab];return _0x471513;};'use strict';var multer=require(_0x4e0b('0x0'));var util=require(_0x4e0b('0x1'));var path=require(_0x4e0b('0x2'));var timeout=require(_0x4e0b('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x4e0b('0x4'));var interaction=require(_0x4e0b('0x5'));var config=require(_0x4e0b('0x6'));var controller=require('./voiceQueue.controller');router[_0x4e0b('0x7')]('/',auth['isAuthenticated'](),controller[_0x4e0b('0x8')]);router[_0x4e0b('0x7')](_0x4e0b('0x9'),auth[_0x4e0b('0xa')](),controller['show']);router[_0x4e0b('0x7')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x4e0b('0xb')]);router[_0x4e0b('0x7')]('/:id/hopper_histories',auth[_0x4e0b('0xa')](),controller[_0x4e0b('0xc')]);router[_0x4e0b('0x7')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x4e0b('0xd')]);router[_0x4e0b('0x7')]('/:id/hopper_black',auth[_0x4e0b('0xa')](),controller[_0x4e0b('0xe')]);router['get'](_0x4e0b('0xf'),auth[_0x4e0b('0xa')](),controller[_0x4e0b('0x10')]);router[_0x4e0b('0x7')](_0x4e0b('0x11'),auth[_0x4e0b('0xa')](),controller['getAgents']);router[_0x4e0b('0x7')](_0x4e0b('0x12'),auth[_0x4e0b('0xa')](),controller[_0x4e0b('0x13')]);router[_0x4e0b('0x7')]('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0x4e0b('0x7')](_0x4e0b('0x14'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x4e0b('0x15')]('/',auth['isAuthenticated'](),controller[_0x4e0b('0x16')]);router[_0x4e0b('0x15')](_0x4e0b('0x17'),auth[_0x4e0b('0xa')](),controller['clone']);router[_0x4e0b('0x15')](_0x4e0b('0xf'),auth[_0x4e0b('0xa')](),controller[_0x4e0b('0x18')]);router[_0x4e0b('0x15')]('/:id/users',auth[_0x4e0b('0xa')](),controller[_0x4e0b('0x19')]);router[_0x4e0b('0x15')](_0x4e0b('0x1a'),auth[_0x4e0b('0xa')](),controller[_0x4e0b('0x1b')]);router['post'](_0x4e0b('0x14'),auth[_0x4e0b('0xa')](),controller['addBlackLists']);router['put'](_0x4e0b('0x9'),auth[_0x4e0b('0xa')](),controller['update']);router[_0x4e0b('0x1c')](_0x4e0b('0x9'),auth['isAuthenticated'](),controller['destroy']);router[_0x4e0b('0x1c')](_0x4e0b('0xf'),auth[_0x4e0b('0xa')](),controller[_0x4e0b('0x1d')]);router['delete'](_0x4e0b('0x11'),auth[_0x4e0b('0xa')](),controller[_0x4e0b('0x1e')]);router[_0x4e0b('0x1c')]('/:id/lists',auth[_0x4e0b('0xa')](),controller[_0x4e0b('0x1f')]);router[_0x4e0b('0x1c')](_0x4e0b('0x14'),auth[_0x4e0b('0xa')](),controller[_0x4e0b('0x20')]);module[_0x4e0b('0x21')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 0490e6d..767f3af 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(_0xdc0e64,_0x38bf67){var _0xb04e82=function(_0x638bea){while(--_0x638bea){_0xdc0e64['push'](_0xdc0e64['shift']());}};_0xb04e82(++_0x38bf67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x4c6373,_0x47cb5d){var _0x8ed848=function(_0x23d513){while(--_0x23d513){_0x4c6373['push'](_0x4c6373['shift']());}};_0x8ed848(++_0x47cb5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 7f2cc9e..cdf55a4 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 _0xb574=['Team','getTeams','addTeams','teams','User','online','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','UserVoiceQueue','findOrCreate','upsert','isNil','format','SIP/%s','voicePause','userVoiceQueue:save','removeTeams','select','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','ids','isEmpty','emit','userVoiceQueue:remove','addAgents','omit','spread','UserVoiceQueueRt','removeAgents','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','field','NOW()','CmListId','toString','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','inbound','outbound','filter','ignore','map','value','type','find','name','UserProfileResource','error','stack','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','VoiceQueue','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','QueueCampaigns','userProfileId','clone','createdAt','updatedAt','UserProfileSection','autoAssociation','getHoppers','findOne','order','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','pick','CmHopperFinal','getHopperBlacks','CmHopperBlack'];(function(_0x158dd7,_0x1f5f90){var _0x1772ba=function(_0x20cbf1){while(--_0x20cbf1){_0x158dd7['push'](_0x158dd7['shift']());}};_0x1772ba(++_0x1f5f90);}(_0xb574,0x106));var _0x4b57=function(_0x26297f,_0x5123f0){_0x26297f=_0x26297f-0x0;var _0x4974cb=_0xb574[_0x26297f];return _0x4974cb;};'use strict';var pdf=require(_0x4b57('0x0'));var emlformat=require(_0x4b57('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4b57('0x2'));var jsonpatch=require(_0x4b57('0x3'));var rp=require('request-promise');var moment=require(_0x4b57('0x4'));var BPromise=require(_0x4b57('0x5'));var Mustache=require(_0x4b57('0x6'));var util=require(_0x4b57('0x7'));var path=require(_0x4b57('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4b57('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4b57('0x15')]=_[_0x4b57('0x16')](config[_0x4b57('0x15')],{'host':_0x4b57('0x17'),'port':0x18eb});var socket=require(_0x4b57('0x18'))(new Redis(config[_0x4b57('0x15')]));require(_0x4b57('0x19'))[_0x4b57('0x1a')](socket);function respondWithStatusCode(_0x31cced,_0x4e15be){_0x4e15be=_0x4e15be||0xcc;return function(_0x4a58dc){if(_0x4a58dc){return _0x31cced[_0x4b57('0x1b')](_0x4e15be);}return _0x31cced[_0x4b57('0x1c')](_0x4e15be)[_0x4b57('0x1d')]();};}function respondWithResult(_0x58d6bd,_0x284640){_0x284640=_0x284640||0xc8;return function(_0x48bd13){if(_0x48bd13){return _0x58d6bd[_0x4b57('0x1c')](_0x284640)[_0x4b57('0x1e')](_0x48bd13);}};}function respondWithFilteredResult(_0x1b018c,_0x10eda5){return function(_0x20cf5e){if(_0x20cf5e){var _0xfb71cc=_0x20cf5e[_0x4b57('0x1f')],_0x4ede42=_0x10eda5[_0x4b57('0x20')],_0x1b35ff=_0x10eda5['offset']+_0x10eda5[_0x4b57('0x21')],_0x1a0b72;if(_0x1b35ff>=_0xfb71cc){_0x1b35ff=_0xfb71cc;_0x1a0b72=0xc8;}else{_0x1a0b72=0xce;}_0x1b018c[_0x4b57('0x1c')](_0x1a0b72);return _0x1b018c[_0x4b57('0x22')](_0x4b57('0x23'),_0x4ede42+'-'+_0x1b35ff+'/'+_0xfb71cc)[_0x4b57('0x1e')](_0x20cf5e);}return null;};}function patchUpdates(_0x4454c8){return function(_0x4f407d){try{jsonpatch[_0x4b57('0x24')](_0x4f407d,_0x4454c8,!![]);}catch(_0x131fed){return BPromise[_0x4b57('0x25')](_0x131fed);}return _0x4f407d['save']();};}function saveUpdates(_0x380554,_0x4a34b2){return function(_0x286c7d){if(_0x286c7d){return _0x286c7d[_0x4b57('0x26')](_0x380554)['then'](function(_0x271361){return _0x271361;});}return null;};}function removeEntity(_0x368c5f,_0x4d07c9){return function(_0x3e7b96){if(_0x3e7b96){return _0x3e7b96[_0x4b57('0x27')]()[_0x4b57('0x28')](function(){var _0x36197e=_0x3e7b96['get']({'plain':!![]});var _0x156962=[{'name':'VoiceQueues','value':_0x4b57('0x29'),'ignore':![]},{'name':'QueueCampaigns','value':_0x4b57('0x2a'),'ignore':![]}];var _0x2dc9d8=_(_0x156962)[_0x4b57('0x2b')](_0x4b57('0x2c'))[_0x4b57('0x2d')](_0x4b57('0x2e'))['value']();if(_['includes'](_0x2dc9d8,_0x36197e[_0x4b57('0x2f')])){return;}var _0x4c58e4=_[_0x4b57('0x30')](_0x156962,[_0x4b57('0x2e'),_0x36197e[_0x4b57('0x2f')]])[_0x4b57('0x31')];return db[_0x4b57('0x32')][_0x4b57('0x27')]({'where':{'type':_0x4c58e4,'resourceId':_0x36197e['id']}})['then'](function(){return _0x3e7b96;});})[_0x4b57('0x28')](function(){_0x368c5f[_0x4b57('0x1c')](0xcc)[_0x4b57('0x1d')]();});}};}function handleEntityNotFound(_0x3cd331,_0x4ccf89){return function(_0xa91ba){if(!_0xa91ba){_0x3cd331[_0x4b57('0x1b')](0x194);}return _0xa91ba;};}function handleError(_0x4cc72a,_0xbfb420){_0xbfb420=_0xbfb420||0x1f4;return function(_0xa5b5dc){logger[_0x4b57('0x33')](_0xa5b5dc[_0x4b57('0x34')]);if(_0xa5b5dc['name']){delete _0xa5b5dc['name'];}_0x4cc72a['status'](_0xbfb420)[_0x4b57('0x35')](_0xa5b5dc);};}exports[_0x4b57('0x36')]=function(_0xccc679,_0xb43038){var _0x33fbfd={},_0x5355d5={},_0x3ca5b1={'count':0x0,'rows':[]};var _0x3e77e0=_[_0x4b57('0x2d')](db['VoiceQueue'][_0x4b57('0x37')],function(_0x1135a1){return{'name':_0x1135a1[_0x4b57('0x38')],'type':_0x1135a1['type'][_0x4b57('0x39')]};});_0x5355d5[_0x4b57('0x3a')]=_['map'](_0x3e77e0,_0x4b57('0x31'));_0x5355d5[_0x4b57('0x3b')]=_[_0x4b57('0x3c')](_0xccc679[_0x4b57('0x3b')]);_0x5355d5[_0x4b57('0x3d')]=_[_0x4b57('0x3e')](_0x5355d5['model'],_0x5355d5[_0x4b57('0x3b')]);_0x33fbfd[_0x4b57('0x3f')]=_[_0x4b57('0x3e')](_0x5355d5[_0x4b57('0x3a')],qs[_0x4b57('0x40')](_0xccc679[_0x4b57('0x3b')][_0x4b57('0x40')]));_0x33fbfd['attributes']=_0x33fbfd['attributes'][_0x4b57('0x41')]?_0x33fbfd[_0x4b57('0x3f')]:_0x5355d5[_0x4b57('0x3a')];if(!_0xccc679['query'][_0x4b57('0x42')](_0x4b57('0x43'))){_0x33fbfd[_0x4b57('0x21')]=qs[_0x4b57('0x21')](_0xccc679['query'][_0x4b57('0x21')]);_0x33fbfd[_0x4b57('0x20')]=qs[_0x4b57('0x20')](_0xccc679[_0x4b57('0x3b')]['offset']);}_0x33fbfd['order']=qs['sort'](_0xccc679[_0x4b57('0x3b')][_0x4b57('0x44')]);_0x33fbfd[_0x4b57('0x45')]=qs[_0x4b57('0x3d')](_['pick'](_0xccc679[_0x4b57('0x3b')],_0x5355d5[_0x4b57('0x3d')]));if(_0xccc679[_0x4b57('0x3b')][_0x4b57('0x2b')]){_0x33fbfd[_0x4b57('0x45')]=_[_0x4b57('0x46')](_0x33fbfd[_0x4b57('0x45')],{'$or':_[_0x4b57('0x2d')](_0x3e77e0,function(_0x1e222b){if(_0x1e222b['type']!==_0x4b57('0x47')){var _0x3685fd={};_0x3685fd[_0x1e222b[_0x4b57('0x31')]]={'$like':'%'+_0xccc679['query'][_0x4b57('0x2b')]+'%'};return _0x3685fd;}})});}_0x33fbfd=_['merge']({},_0x33fbfd,_0xccc679[_0x4b57('0x48')]);var _0x1cd4bf={'where':_0x33fbfd[_0x4b57('0x45')]};return db[_0x4b57('0x49')][_0x4b57('0x1f')](_0x1cd4bf)[_0x4b57('0x28')](function(_0x1c1c46){_0x3ca5b1[_0x4b57('0x1f')]=_0x1c1c46;if(_0xccc679[_0x4b57('0x3b')][_0x4b57('0x4a')]){_0x33fbfd[_0x4b57('0x4b')]=[{'all':!![]}];}return db[_0x4b57('0x49')][_0x4b57('0x4c')](_0x33fbfd);})['then'](function(_0x5b83ab){_0x3ca5b1[_0x4b57('0x4d')]=_0x5b83ab;return _0x3ca5b1;})[_0x4b57('0x28')](respondWithFilteredResult(_0xb43038,_0x33fbfd))[_0x4b57('0x4e')](handleError(_0xb43038,null));};exports[_0x4b57('0x4f')]=function(_0x47fac6,_0x21fd79){var _0x5609a9={'raw':![],'where':{'id':_0x47fac6[_0x4b57('0x50')]['id']}},_0x5531d0={};_0x5531d0['model']=_[_0x4b57('0x3c')](db['VoiceQueue']['rawAttributes']);_0x5531d0[_0x4b57('0x3b')]=_[_0x4b57('0x3c')](_0x47fac6['query']);_0x5531d0[_0x4b57('0x3d')]=_[_0x4b57('0x3e')](_0x5531d0[_0x4b57('0x3a')],_0x5531d0[_0x4b57('0x3b')]);_0x5609a9[_0x4b57('0x3f')]=_[_0x4b57('0x3e')](_0x5531d0['model'],qs[_0x4b57('0x40')](_0x47fac6[_0x4b57('0x3b')]['fields']));_0x5609a9[_0x4b57('0x3f')]=_0x5609a9[_0x4b57('0x3f')][_0x4b57('0x41')]?_0x5609a9['attributes']:_0x5531d0[_0x4b57('0x3a')];if(_0x47fac6['query'][_0x4b57('0x4a')]){_0x5609a9[_0x4b57('0x4b')]=[{'all':!![]}];}_0x5609a9=_[_0x4b57('0x46')]({},_0x5609a9,_0x47fac6[_0x4b57('0x48')]);return db[_0x4b57('0x49')][_0x4b57('0x30')](_0x5609a9)[_0x4b57('0x28')](handleEntityNotFound(_0x21fd79,null))[_0x4b57('0x28')](respondWithResult(_0x21fd79,null))['catch'](handleError(_0x21fd79,null));};exports[_0x4b57('0x51')]=function(_0x19349b,_0x3ad98f){return db['VoiceQueue'][_0x4b57('0x51')](_0x19349b[_0x4b57('0x52')],{})[_0x4b57('0x28')](function(_0x488bea){var _0x1579d1=_0x19349b[_0x4b57('0x53')][_0x4b57('0x54')]({'plain':!![]});if(!_0x1579d1)throw new Error(_0x4b57('0x55'));if(_0x1579d1[_0x4b57('0x56')]===_0x4b57('0x53')){var _0x20ee9b=_0x488bea['get']({'plain':!![]});var _0x4d6469=[{'name':_0x4b57('0x57'),'value':_0x4b57('0x29')},{'name':_0x4b57('0x58'),'value':_0x4b57('0x2a')}];var _0x568cfc=_[_0x4b57('0x30')](_0x4d6469,[_0x4b57('0x2e'),_0x20ee9b[_0x4b57('0x2f')]])[_0x4b57('0x31')];return db['UserProfileSection']['find']({'where':{'name':_0x568cfc,'userProfileId':_0x1579d1[_0x4b57('0x59')]},'raw':!![]})[_0x4b57('0x28')](function(_0x57efcc){if(_0x57efcc&&_0x57efcc['autoAssociation']===0x0){return db[_0x4b57('0x32')]['create']({'name':_0x20ee9b[_0x4b57('0x31')],'resourceId':_0x20ee9b['id'],'type':_0x57efcc[_0x4b57('0x31')],'sectionId':_0x57efcc['id']},{})[_0x4b57('0x28')](function(){return _0x488bea;});}else{return _0x488bea;}})[_0x4b57('0x4e')](function(_0x37d420){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37d420);throw _0x37d420;});}return _0x488bea;})['then'](respondWithResult(_0x3ad98f,0xc9))['catch'](handleError(_0x3ad98f,null));};exports[_0x4b57('0x5a')]=function(_0x470cd5,_0x5e7a35){var _0x34aa23={'where':{'id':_0x470cd5[_0x4b57('0x50')]['id']}},_0x44ecb6={};_0x44ecb6[_0x4b57('0x3a')]=_[_0x4b57('0x3c')](db[_0x4b57('0x49')][_0x4b57('0x37')]);_0x34aa23[_0x4b57('0x3f')]=_[_0x4b57('0x3e')](_0x44ecb6['model'],qs[_0x4b57('0x40')](_0x470cd5['query'][_0x4b57('0x40')]));_0x34aa23[_0x4b57('0x3f')]=_0x34aa23['attributes'][_0x4b57('0x41')]?_0x34aa23[_0x4b57('0x3f')]:_0x44ecb6[_0x4b57('0x3a')];if(_0x470cd5[_0x4b57('0x3b')][_0x4b57('0x4a')]){_0x34aa23[_0x4b57('0x4b')]=[{'all':!![]}];}_0x34aa23=_[_0x4b57('0x46')]({},_0x34aa23,_0x470cd5[_0x4b57('0x48')]);return db[_0x4b57('0x49')][_0x4b57('0x30')](_0x34aa23)[_0x4b57('0x28')](handleEntityNotFound(_0x5e7a35,null))[_0x4b57('0x28')](function(_0x59e4bb){if(_0x59e4bb){var _0x163bfa=_0x59e4bb[_0x4b57('0x54')]({'plain':!![]});_0x163bfa=qs['omit'](_0x163bfa,['id',_0x4b57('0x5b'),'updatedAt']);_0x470cd5['body']=_['omit'](_0x470cd5[_0x4b57('0x52')],['id','createdAt',_0x4b57('0x5c')]);return db[_0x4b57('0x49')]['create'](_['merge'](_0x163bfa,_0x470cd5[_0x4b57('0x52')]),{'include':_0x470cd5[_0x4b57('0x3b')][_0x4b57('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x3ae420){var _0x3619a1=_0x470cd5['user'][_0x4b57('0x54')]({'plain':!![]});if(!_0x3619a1)throw new Error(_0x4b57('0x55'));if(_0x3619a1['role']===_0x4b57('0x53')){var _0x91241d=_0x3ae420[_0x4b57('0x54')]({'plain':!![]});var _0x210050=[{'name':_0x4b57('0x57'),'value':_0x4b57('0x29')},{'name':_0x4b57('0x58'),'value':'outbound'}];var _0x4fbf2b=_[_0x4b57('0x30')](_0x210050,[_0x4b57('0x2e'),_0x91241d['type']])['name'];return db[_0x4b57('0x5d')][_0x4b57('0x30')]({'where':{'name':_0x4fbf2b,'userProfileId':_0x3619a1['userProfileId']},'raw':!![]})['then'](function(_0x4e88ef){if(_0x4e88ef&&_0x4e88ef[_0x4b57('0x5e')]===0x0){return db[_0x4b57('0x32')][_0x4b57('0x51')]({'name':_0x91241d['name'],'resourceId':_0x91241d['id'],'type':_0x4e88ef['name'],'sectionId':_0x4e88ef['id']},{})['then'](function(){return _0x3ae420;});}else{return _0x3ae420;}})[_0x4b57('0x4e')](function(_0x59cd7c){logger[_0x4b57('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59cd7c);throw _0x59cd7c;});}return _0x3ae420;});}})[_0x4b57('0x28')](respondWithResult(_0x5e7a35,0xc9))[_0x4b57('0x4e')](handleError(_0x5e7a35,null));};exports[_0x4b57('0x26')]=function(_0x24b00f,_0x576b4d){if(_0x24b00f[_0x4b57('0x52')]['id']){delete _0x24b00f['body']['id'];}return db['VoiceQueue'][_0x4b57('0x30')]({'where':{'id':_0x24b00f[_0x4b57('0x50')]['id']}})['then'](handleEntityNotFound(_0x576b4d,null))[_0x4b57('0x28')](saveUpdates(_0x24b00f[_0x4b57('0x52')],null))[_0x4b57('0x28')](respondWithResult(_0x576b4d,null))[_0x4b57('0x4e')](handleError(_0x576b4d,null));};exports[_0x4b57('0x27')]=function(_0x9a8f08,_0x57e9eb){return db[_0x4b57('0x49')][_0x4b57('0x30')]({'where':{'id':_0x9a8f08[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x57e9eb,null))[_0x4b57('0x28')](removeEntity(_0x57e9eb,null))['catch'](handleError(_0x57e9eb,null));};exports[_0x4b57('0x5f')]=function(_0x3c7166,_0x2a2bc9,_0x24bd50){var _0x5565f4={'raw':![],'where':{}};var _0x4b17c3={};var _0x3c8894={'count':0x0,'rows':[]};return db[_0x4b57('0x49')][_0x4b57('0x60')]({'where':{'id':_0x3c7166['params']['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x2a2bc9,null))['then'](function(_0x123d19){if(_0x123d19){_0x4b17c3[_0x4b57('0x3a')]=_['keys'](db['CmHopper'][_0x4b57('0x37')]);_0x4b17c3['query']=_[_0x4b57('0x3c')](_0x3c7166[_0x4b57('0x3b')]);_0x4b17c3[_0x4b57('0x3d')]=_[_0x4b57('0x3e')](_0x4b17c3[_0x4b57('0x3a')],_0x4b17c3['query']);_0x5565f4[_0x4b57('0x3f')]=_[_0x4b57('0x3e')](_0x4b17c3[_0x4b57('0x3a')],qs['fields'](_0x3c7166['query'][_0x4b57('0x40')]));_0x5565f4[_0x4b57('0x3f')]=_0x5565f4['attributes'][_0x4b57('0x41')]?_0x5565f4[_0x4b57('0x3f')]:_0x4b17c3['model'];if(!_0x3c7166[_0x4b57('0x3b')][_0x4b57('0x42')]('nolimit')){_0x5565f4[_0x4b57('0x21')]=qs[_0x4b57('0x21')](_0x3c7166[_0x4b57('0x3b')]['limit']);_0x5565f4[_0x4b57('0x20')]=qs[_0x4b57('0x20')](_0x3c7166[_0x4b57('0x3b')][_0x4b57('0x20')]);}_0x5565f4[_0x4b57('0x61')]=qs[_0x4b57('0x44')](_0x3c7166[_0x4b57('0x3b')]['sort']);_0x5565f4[_0x4b57('0x45')]=qs[_0x4b57('0x3d')](_['pick'](_0x3c7166[_0x4b57('0x3b')],_0x4b17c3[_0x4b57('0x3d')]));_0x5565f4['where'][_0x4b57('0x62')]=_0x123d19['id'];if(_0x3c7166[_0x4b57('0x3b')][_0x4b57('0x2b')]){_0x5565f4[_0x4b57('0x45')]=_[_0x4b57('0x46')](_0x5565f4[_0x4b57('0x45')],{'$or':_[_0x4b57('0x2d')](_0x5565f4[_0x4b57('0x3f')],function(_0xe62144){var _0x830213={};_0x830213[_0xe62144]={'$like':'%'+_0x3c7166[_0x4b57('0x3b')][_0x4b57('0x2b')]+'%'};return _0x830213;})});}_0x5565f4=_[_0x4b57('0x46')]({},_0x5565f4,_0x3c7166[_0x4b57('0x48')]);return db[_0x4b57('0x63')][_0x4b57('0x1f')]({'where':_0x5565f4[_0x4b57('0x45')]})[_0x4b57('0x28')](function(_0x40d259){_0x3c8894[_0x4b57('0x1f')]=_0x40d259;if(_0x3c7166[_0x4b57('0x3b')][_0x4b57('0x4a')]){_0x5565f4[_0x4b57('0x4b')]=[{'all':!![]}];}return db[_0x4b57('0x63')][_0x4b57('0x4c')](_0x5565f4);})['then'](function(_0x4cfed4){_0x3c8894['rows']=_0x4cfed4;return _0x3c8894;});}})['then'](respondWithFilteredResult(_0x2a2bc9,_0x5565f4))[_0x4b57('0x4e')](handleError(_0x2a2bc9,null));};exports[_0x4b57('0x64')]=function(_0x54834f,_0x65e42c,_0x3bc08e){var _0x5482be={'raw':!![],'where':{}};var _0x254165={};var _0x245887={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x54834f[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x65e42c,null))[_0x4b57('0x28')](function(_0x238a77){if(_0x238a77){_0x254165[_0x4b57('0x3a')]=_[_0x4b57('0x3c')](db[_0x4b57('0x65')]['rawAttributes']);_0x254165['query']=_[_0x4b57('0x3c')](_0x54834f[_0x4b57('0x3b')]);_0x254165[_0x4b57('0x3d')]=_[_0x4b57('0x3e')](_0x254165[_0x4b57('0x3a')],_0x254165[_0x4b57('0x3b')]);_0x5482be[_0x4b57('0x3f')]=_[_0x4b57('0x3e')](_0x254165[_0x4b57('0x3a')],qs['fields'](_0x54834f[_0x4b57('0x3b')][_0x4b57('0x40')]));_0x5482be[_0x4b57('0x3f')]=_0x5482be[_0x4b57('0x3f')]['length']?_0x5482be['attributes']:_0x254165[_0x4b57('0x3a')];if(!_0x54834f[_0x4b57('0x3b')]['hasOwnProperty'](_0x4b57('0x43'))){_0x5482be[_0x4b57('0x21')]=qs['limit'](_0x54834f[_0x4b57('0x3b')]['limit']);_0x5482be['offset']=qs[_0x4b57('0x20')](_0x54834f[_0x4b57('0x3b')][_0x4b57('0x20')]);}_0x5482be[_0x4b57('0x61')]=qs[_0x4b57('0x44')](_0x54834f['query'][_0x4b57('0x44')]);_0x5482be[_0x4b57('0x45')]=qs[_0x4b57('0x3d')](_[_0x4b57('0x66')](_0x54834f[_0x4b57('0x3b')],_0x254165[_0x4b57('0x3d')]));_0x5482be[_0x4b57('0x45')]['VoiceQueueId']=_0x238a77['id'];if(_0x54834f[_0x4b57('0x3b')]['filter']){_0x5482be[_0x4b57('0x45')]=_[_0x4b57('0x46')](_0x5482be[_0x4b57('0x45')],{'$or':_['map'](_0x5482be['attributes'],function(_0x10e365){var _0x1942d2={};_0x1942d2[_0x10e365]={'$like':'%'+_0x54834f[_0x4b57('0x3b')]['filter']+'%'};return _0x1942d2;})});}_0x5482be=_[_0x4b57('0x46')]({},_0x5482be,_0x54834f[_0x4b57('0x48')]);return db['CmHopperHistory'][_0x4b57('0x1f')]({'where':_0x5482be[_0x4b57('0x45')]})[_0x4b57('0x28')](function(_0x45b150){_0x245887[_0x4b57('0x1f')]=_0x45b150;if(_0x54834f[_0x4b57('0x3b')][_0x4b57('0x4a')]){_0x5482be[_0x4b57('0x4b')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x4b57('0x4c')](_0x5482be);})[_0x4b57('0x28')](function(_0x40667c){_0x245887['rows']=_0x40667c;return _0x245887;});}})[_0x4b57('0x28')](respondWithFilteredResult(_0x65e42c,_0x5482be))['catch'](handleError(_0x65e42c,null));};exports['getHopperFinals']=function(_0x342c89,_0x39049d,_0x364643){var _0x202765={'raw':!![],'where':{}};var _0x102bb9={};var _0x1e5a08={'count':0x0,'rows':[]};return db[_0x4b57('0x49')][_0x4b57('0x60')]({'where':{'id':_0x342c89[_0x4b57('0x50')]['id']}})['then'](handleEntityNotFound(_0x39049d,null))[_0x4b57('0x28')](function(_0x5ed810){if(_0x5ed810){_0x102bb9[_0x4b57('0x3a')]=_['keys'](db['CmHopperFinal'][_0x4b57('0x37')]);_0x102bb9[_0x4b57('0x3b')]=_[_0x4b57('0x3c')](_0x342c89[_0x4b57('0x3b')]);_0x102bb9[_0x4b57('0x3d')]=_[_0x4b57('0x3e')](_0x102bb9[_0x4b57('0x3a')],_0x102bb9[_0x4b57('0x3b')]);_0x202765[_0x4b57('0x3f')]=_[_0x4b57('0x3e')](_0x102bb9[_0x4b57('0x3a')],qs[_0x4b57('0x40')](_0x342c89[_0x4b57('0x3b')][_0x4b57('0x40')]));_0x202765['attributes']=_0x202765[_0x4b57('0x3f')][_0x4b57('0x41')]?_0x202765[_0x4b57('0x3f')]:_0x102bb9['model'];if(!_0x342c89[_0x4b57('0x3b')][_0x4b57('0x42')](_0x4b57('0x43'))){_0x202765[_0x4b57('0x21')]=qs[_0x4b57('0x21')](_0x342c89['query'][_0x4b57('0x21')]);_0x202765[_0x4b57('0x20')]=qs[_0x4b57('0x20')](_0x342c89[_0x4b57('0x3b')][_0x4b57('0x20')]);}_0x202765[_0x4b57('0x61')]=qs[_0x4b57('0x44')](_0x342c89[_0x4b57('0x3b')][_0x4b57('0x44')]);_0x202765['where']=qs[_0x4b57('0x3d')](_[_0x4b57('0x66')](_0x342c89[_0x4b57('0x3b')],_0x102bb9[_0x4b57('0x3d')]));_0x202765[_0x4b57('0x45')][_0x4b57('0x62')]=_0x5ed810['id'];if(_0x342c89[_0x4b57('0x3b')]['filter']){_0x202765[_0x4b57('0x45')]=_[_0x4b57('0x46')](_0x202765[_0x4b57('0x45')],{'$or':_[_0x4b57('0x2d')](_0x202765[_0x4b57('0x3f')],function(_0x219072){var _0x4c7fa8={};_0x4c7fa8[_0x219072]={'$like':'%'+_0x342c89[_0x4b57('0x3b')][_0x4b57('0x2b')]+'%'};return _0x4c7fa8;})});}_0x202765=_[_0x4b57('0x46')]({},_0x202765,_0x342c89[_0x4b57('0x48')]);return db[_0x4b57('0x67')][_0x4b57('0x1f')]({'where':_0x202765['where']})[_0x4b57('0x28')](function(_0x346896){_0x1e5a08['count']=_0x346896;if(_0x342c89[_0x4b57('0x3b')][_0x4b57('0x4a')]){_0x202765[_0x4b57('0x4b')]=[{'all':!![]}];}return db[_0x4b57('0x67')][_0x4b57('0x4c')](_0x202765);})[_0x4b57('0x28')](function(_0x5e4621){_0x1e5a08['rows']=_0x5e4621;return _0x1e5a08;});}})[_0x4b57('0x28')](respondWithFilteredResult(_0x39049d,_0x202765))['catch'](handleError(_0x39049d,null));};exports[_0x4b57('0x68')]=function(_0x14569e,_0x6c09a,_0x46037e){var _0x50b4b7={'raw':!![],'where':{}};var _0x4d6eab={};var _0x57d275={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x4b57('0x60')]({'where':{'id':_0x14569e[_0x4b57('0x50')]['id']}})['then'](handleEntityNotFound(_0x6c09a,null))[_0x4b57('0x28')](function(_0x2f802f){if(_0x2f802f){_0x4d6eab[_0x4b57('0x3a')]=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x4d6eab['query']=_[_0x4b57('0x3c')](_0x14569e[_0x4b57('0x3b')]);_0x4d6eab[_0x4b57('0x3d')]=_[_0x4b57('0x3e')](_0x4d6eab[_0x4b57('0x3a')],_0x4d6eab[_0x4b57('0x3b')]);_0x50b4b7[_0x4b57('0x3f')]=_[_0x4b57('0x3e')](_0x4d6eab[_0x4b57('0x3a')],qs[_0x4b57('0x40')](_0x14569e['query'][_0x4b57('0x40')]));_0x50b4b7[_0x4b57('0x3f')]=_0x50b4b7[_0x4b57('0x3f')][_0x4b57('0x41')]?_0x50b4b7[_0x4b57('0x3f')]:_0x4d6eab[_0x4b57('0x3a')];if(!_0x14569e[_0x4b57('0x3b')]['hasOwnProperty'](_0x4b57('0x43'))){_0x50b4b7[_0x4b57('0x21')]=qs[_0x4b57('0x21')](_0x14569e['query'][_0x4b57('0x21')]);_0x50b4b7[_0x4b57('0x20')]=qs[_0x4b57('0x20')](_0x14569e[_0x4b57('0x3b')][_0x4b57('0x20')]);}_0x50b4b7[_0x4b57('0x61')]=qs[_0x4b57('0x44')](_0x14569e[_0x4b57('0x3b')][_0x4b57('0x44')]);_0x50b4b7[_0x4b57('0x45')]=qs['filters'](_[_0x4b57('0x66')](_0x14569e[_0x4b57('0x3b')],_0x4d6eab[_0x4b57('0x3d')]));_0x50b4b7[_0x4b57('0x45')][_0x4b57('0x62')]=_0x2f802f['id'];if(_0x14569e[_0x4b57('0x3b')][_0x4b57('0x2b')]){_0x50b4b7[_0x4b57('0x45')]=_[_0x4b57('0x46')](_0x50b4b7[_0x4b57('0x45')],{'$or':_[_0x4b57('0x2d')](_0x50b4b7[_0x4b57('0x3f')],function(_0x4db2a6){var _0x365017={};_0x365017[_0x4db2a6]={'$like':'%'+_0x14569e[_0x4b57('0x3b')]['filter']+'%'};return _0x365017;})});}_0x50b4b7=_[_0x4b57('0x46')]({},_0x50b4b7,_0x14569e['options']);return db[_0x4b57('0x69')][_0x4b57('0x1f')]({'where':_0x50b4b7[_0x4b57('0x45')]})[_0x4b57('0x28')](function(_0x5ac59a){_0x57d275[_0x4b57('0x1f')]=_0x5ac59a;if(_0x14569e[_0x4b57('0x3b')][_0x4b57('0x4a')]){_0x50b4b7[_0x4b57('0x4b')]=[{'all':!![]}];}return db[_0x4b57('0x69')][_0x4b57('0x4c')](_0x50b4b7);})[_0x4b57('0x28')](function(_0x52a532){_0x57d275[_0x4b57('0x4d')]=_0x52a532;return _0x57d275;});}})[_0x4b57('0x28')](respondWithFilteredResult(_0x6c09a,_0x50b4b7))[_0x4b57('0x4e')](handleError(_0x6c09a,null));};exports['getTeams']=function(_0x577f95,_0x305e70,_0x56d9e4){var _0x518b2a={};var _0x3f3848={};var _0x3ed9cd;var _0x592b7d;return db[_0x4b57('0x49')][_0x4b57('0x60')]({'where':{'id':_0x577f95['params']['id']}})['then'](handleEntityNotFound(_0x305e70,null))['then'](function(_0x16ef3b){if(_0x16ef3b){_0x3ed9cd=_0x16ef3b;_0x3f3848[_0x4b57('0x3a')]=_[_0x4b57('0x3c')](db[_0x4b57('0x6a')][_0x4b57('0x37')]);_0x3f3848['query']=_['keys'](_0x577f95['query']);_0x3f3848[_0x4b57('0x3d')]=_['intersection'](_0x3f3848[_0x4b57('0x3a')],_0x3f3848[_0x4b57('0x3b')]);_0x518b2a[_0x4b57('0x3f')]=_['intersection'](_0x3f3848[_0x4b57('0x3a')],qs[_0x4b57('0x40')](_0x577f95[_0x4b57('0x3b')][_0x4b57('0x40')]));_0x518b2a['attributes']=_0x518b2a['attributes'][_0x4b57('0x41')]?_0x518b2a[_0x4b57('0x3f')]:_0x3f3848['model'];_0x518b2a[_0x4b57('0x61')]=qs['sort'](_0x577f95['query'][_0x4b57('0x44')]);_0x518b2a['where']=qs[_0x4b57('0x3d')](_[_0x4b57('0x66')](_0x577f95[_0x4b57('0x3b')],_0x3f3848['filters']));if(_0x577f95[_0x4b57('0x3b')][_0x4b57('0x2b')]){_0x518b2a[_0x4b57('0x45')]=_['merge'](_0x518b2a[_0x4b57('0x45')],{'$or':_[_0x4b57('0x2d')](_0x518b2a[_0x4b57('0x3f')],function(_0x1fe479){var _0x651090={};_0x651090[_0x1fe479]={'$like':'%'+_0x577f95[_0x4b57('0x3b')][_0x4b57('0x2b')]+'%'};return _0x651090;})});}_0x518b2a=_[_0x4b57('0x46')]({},_0x518b2a,_0x577f95[_0x4b57('0x48')]);return _0x3ed9cd[_0x4b57('0x6b')](_0x518b2a);}})[_0x4b57('0x28')](function(_0x451b64){if(_0x451b64){_0x592b7d=_0x451b64[_0x4b57('0x41')];if(!_0x577f95['query'][_0x4b57('0x42')](_0x4b57('0x43'))){_0x518b2a['limit']=qs['limit'](_0x577f95[_0x4b57('0x3b')][_0x4b57('0x21')]);_0x518b2a[_0x4b57('0x20')]=qs[_0x4b57('0x20')](_0x577f95[_0x4b57('0x3b')][_0x4b57('0x20')]);}return _0x3ed9cd[_0x4b57('0x6b')](_0x518b2a);}})['then'](function(_0x1f59ea){if(_0x1f59ea){return _0x1f59ea?{'count':_0x592b7d,'rows':_0x1f59ea}:null;}})[_0x4b57('0x28')](respondWithResult(_0x305e70,null))['catch'](handleError(_0x305e70,null));};exports[_0x4b57('0x6c')]=function(_0x3dfd72,_0x4aa20a,_0x14acfe){var _0x2c1438=_0x3dfd72[_0x4b57('0x52')][_0x4b57('0x6d')];var _0x246dbe=_[_0x4b57('0x2d')](_0x2c1438,'id');return db['Team'][_0x4b57('0x4c')]({'where':{'id':_0x246dbe},'attributes':['id'],'include':[{'model':db[_0x4b57('0x6e')],'as':'Agents','attributes':['id',_0x4b57('0x31'),_0x4b57('0x6f'),'voicePause',_0x4b57('0x70')],'raw':!![]}]})['then'](function(_0x306a72){if(_0x306a72){var _0x143548=_[_0x4b57('0x71')](_0x306a72,function(_0x2aa732){var _0x2da6ad=_0x2aa732[_0x4b57('0x54')]({'plain':!![]});_0x2da6ad[_0x4b57('0x72')][_0x4b57('0x73')](function(_0xf61eb7){_0xf61eb7[_0x4b57('0x74')]=_[_0x4b57('0x30')](_0x2c1438,{'id':_0x2da6ad['id']})[_0x4b57('0x74')];});return _0x2da6ad[_0x4b57('0x72')];});return db['VoiceQueue']['find']({'where':{'id':_0x3dfd72[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](function(_0x4d1cf7){return db[_0x4b57('0x75')][_0x4b57('0x76')](function(_0x53a938){return _0x4d1cf7[_0x4b57('0x6c')](_0x246dbe,{'transaction':_0x53a938})[_0x4b57('0x28')](function(){return BPromise['each'](_0x143548,function(_0x3cfbb7){return db[_0x4b57('0x77')][_0x4b57('0x78')]({'where':{'UserId':_0x3cfbb7['id'],'VoiceQueueId':_0x3dfd72[_0x4b57('0x50')]['id']},'defaults':{'penalty':_0x3cfbb7[_0x4b57('0x74')]},'transaction':_0x53a938});});})[_0x4b57('0x28')](function(){return BPromise['each'](_[_0x4b57('0x2b')](_0x143548,{'online':!![]}),function(_0x2608ad){return db['UserVoiceQueueRt'][_0x4b57('0x79')]({'membername':_0x2608ad[_0x4b57('0x31')],'UserId':_0x2608ad['id'],'queue_name':_0x4d1cf7[_0x4b57('0x31')],'VoiceQueueId':_0x4d1cf7['id'],'interface':_[_0x4b57('0x7a')](_0x2608ad[_0x4b57('0x70')])?util[_0x4b57('0x7b')](_0x4b57('0x7c'),_0x2608ad['name']):_0x2608ad['interface'],'paused':_0x2608ad[_0x4b57('0x7d')]||![],'penalty':_0x2608ad[_0x4b57('0x74')]},{'transaction':_0x53a938});});})[_0x4b57('0x28')](function(){_0x143548[_0x4b57('0x73')](function(_0x5764e6){socket['emit'](_0x4b57('0x7e'),{'UserId':_0x5764e6['id'],'VoiceQueueId':_0x4d1cf7['id']});});});});});}})[_0x4b57('0x28')](respondWithStatusCode(_0x4aa20a,null))[_0x4b57('0x4e')](handleError(_0x4aa20a,null));};exports[_0x4b57('0x7f')]=function(_0x4bf6ab,_0x31a7af,_0x5ebb0b){return db[_0x4b57('0x6a')][_0x4b57('0x4c')]({'where':{'id':_0x4bf6ab[_0x4b57('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4b57('0x28')](handleEntityNotFound(_0x31a7af,null))[_0x4b57('0x28')](function(_0x2cf73c){var _0x2717d0=_[_0x4b57('0x2d')](_0x2cf73c,'id');var _0x39cc06=[];var _0x241da8=[];var _0x501c4d=squel[_0x4b57('0x80')]();_0x501c4d['field']('tq.TeamId')[_0x4b57('0x81')](_0x4b57('0x82'),'tq')[_0x4b57('0x83')](_0x4b57('0x84'),'ut',_0x4b57('0x85'))[_0x4b57('0x45')](_0x4b57('0x86'),_0x4bf6ab[_0x4b57('0x50')]['id']);for(var _0x560791=0x0;_0x560791<_0x2cf73c[_0x4b57('0x41')];_0x560791+=0x1){let _0x524d1c=_0x2cf73c[_0x560791];for(var _0x14dd55=0x0;_0x14dd55<_0x524d1c[_0x4b57('0x72')]['length'];_0x14dd55+=0x1){let _0x3865a7=_0x524d1c[_0x4b57('0x72')][_0x14dd55];var _0x9a3a70=_0x501c4d['clone']();_0x9a3a70[_0x4b57('0x45')](_0x4b57('0x87'),_0x3865a7['id']);_0x241da8[_0x4b57('0x88')](db[_0x4b57('0x75')][_0x4b57('0x3b')](_0x9a3a70['toString'](),{'type':db[_0x4b57('0x75')][_0x4b57('0x89')][_0x4b57('0x8a')]})[_0x4b57('0x28')](function(_0x3003a1){if(_0x3003a1['length']===0x1){return _0x3865a7['id'];}else{var _0xa47fbd=_[_0x4b57('0x8b')](_[_0x4b57('0x2d')](_0x3003a1,_0x4b57('0x8c')),function(_0x7e9bfa){return _[_0x4b57('0x8d')](_0x2717d0,_0x7e9bfa);});if(_0xa47fbd){return _0x3865a7['id'];}}}));}}return BPromise['all'](_0x241da8)[_0x4b57('0x28')](function(_0x6548d2){_0x39cc06=_(_0x39cc06)[_0x4b57('0x8e')](_0x6548d2)['compact']()['value']();return db[_0x4b57('0x49')][_0x4b57('0x30')]({'where':{'id':_0x4bf6ab['params']['id']}})['then'](function(_0x4776aa){return db[_0x4b57('0x75')]['transaction'](function(_0x722853){return _0x4776aa[_0x4b57('0x7f')](_0x4bf6ab[_0x4b57('0x3b')][_0x4b57('0x8f')],{'transaction':_0x722853})[_0x4b57('0x28')](function(){if(!_[_0x4b57('0x90')](_0x39cc06)){return _0x4776aa['removeAgents'](_0x39cc06,{'transaction':_0x722853})['then'](function(){return db['UserVoiceQueueRt'][_0x4b57('0x27')]({'where':{'VoiceQueueId':_0x4bf6ab['params']['id'],'UserId':_0x39cc06},'transaction':_0x722853});});}})['then'](function(){_0x39cc06['forEach'](function(_0x4adf17){socket[_0x4b57('0x91')](_0x4b57('0x92'),{'UserId':_0x4adf17,'VoiceQueueId':_0x4776aa['id']});});});});});});})[_0x4b57('0x28')](respondWithStatusCode(_0x31a7af,null))[_0x4b57('0x4e')](handleError(_0x31a7af,null));};exports[_0x4b57('0x93')]=function(_0x2840d5,_0x3de078,_0x4edb1b){var _0x3c3e4c,_0x2a8d27;return db[_0x4b57('0x49')]['find']({'where':{'id':_0x2840d5[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x3de078,null))[_0x4b57('0x28')](function(_0x1d6d8c){if(_0x1d6d8c){_0x2a8d27=_0x1d6d8c;return _0x1d6d8c[_0x4b57('0x93')](_0x2840d5[_0x4b57('0x52')][_0x4b57('0x8f')],_[_0x4b57('0x94')](_0x2840d5['body'],[_0x4b57('0x8f'),'id'])||{})[_0x4b57('0x95')](function(_0x36cdd9){for(var _0x41671a=0x0;_0x41671a<_0x2840d5['body']['ids'][_0x4b57('0x41')];_0x41671a+=0x1){socket[_0x4b57('0x91')]('userVoiceQueue:save',{'UserId':_0x2840d5['body'][_0x4b57('0x8f')][_0x41671a],'VoiceQueueId':_0x2840d5['params']['id']});}return _0x36cdd9;});}})['then'](function(_0x4e8b80){_0x3c3e4c=_0x4e8b80||[];if(_0x2a8d27){return db['User'][_0x4b57('0x4c')]({'where':{'id':_0x2840d5['body'][_0x4b57('0x8f')]},'attributes':['id',_0x4b57('0x31'),_0x4b57('0x6f'),_0x4b57('0x7d'),'interface'],'raw':!![]});}})[_0x4b57('0x28')](function(_0x1a464c){if(!_['isEmpty'](_0x1a464c)){var _0x2a7f6a=[];for(var _0x2e138c=0x0;_0x2e138c<_0x1a464c[_0x4b57('0x41')];_0x2e138c++){if(_0x1a464c[_0x2e138c][_0x4b57('0x6f')]){_0x2a7f6a[_0x4b57('0x88')](db[_0x4b57('0x96')]['upsert']({'membername':_0x1a464c[_0x2e138c]['name'],'UserId':_0x1a464c[_0x2e138c]['id'],'queue_name':_0x2a8d27[_0x4b57('0x31')],'VoiceQueueId':_0x2a8d27['id'],'interface':_['isNil'](_0x1a464c[_0x2e138c][_0x4b57('0x70')])?util['format']('SIP/%s',_0x1a464c[_0x2e138c]['name']):_0x1a464c[_0x2e138c][_0x4b57('0x70')],'paused':_0x1a464c[_0x2e138c]['voicePause']||![],'penalty':_0x2840d5[_0x4b57('0x52')]['penalty']||0x0}));}}return BPromise['all'](_0x2a7f6a);}})[_0x4b57('0x28')](function(){return _0x3c3e4c;})[_0x4b57('0x28')](respondWithResult(_0x3de078,null))[_0x4b57('0x4e')](handleError(_0x3de078,null));};exports[_0x4b57('0x97')]=function(_0x35a54b,_0x1248b2,_0x2574bc){return db['VoiceQueue'][_0x4b57('0x30')]({'where':{'id':_0x35a54b[_0x4b57('0x50')]['id']}})['then'](handleEntityNotFound(_0x1248b2,null))[_0x4b57('0x28')](function(_0x5694b7){if(_0x5694b7){return _0x5694b7[_0x4b57('0x97')](_0x35a54b[_0x4b57('0x3b')]['ids'])['then'](function(){if(_['isArray'](_0x35a54b[_0x4b57('0x3b')][_0x4b57('0x8f')])){for(var _0x5ec6fe=0x0;_0x5ec6fe<_0x35a54b['query'][_0x4b57('0x8f')][_0x4b57('0x41')];_0x5ec6fe+=0x1){socket[_0x4b57('0x91')]('userVoiceQueue:remove',{'UserId':Number(_0x35a54b[_0x4b57('0x3b')][_0x4b57('0x8f')][_0x5ec6fe]),'VoiceQueueId':Number(_0x35a54b[_0x4b57('0x50')]['id'])});}}else{socket[_0x4b57('0x91')](_0x4b57('0x92'),{'UserId':Number(_0x35a54b[_0x4b57('0x3b')]['ids']),'VoiceQueueId':Number(_0x35a54b['params']['id'])});}});}})[_0x4b57('0x28')](function(_0x9020bc){return db[_0x4b57('0x96')]['destroy']({'where':{'VoiceQueueId':_0x35a54b[_0x4b57('0x50')]['id'],'UserId':_0x35a54b[_0x4b57('0x3b')]['ids']}})[_0x4b57('0x28')](function(){return _0x9020bc;});})['then'](respondWithStatusCode(_0x1248b2,null))['catch'](handleError(_0x1248b2,null));};exports[_0x4b57('0x98')]=function(_0x1902c5,_0x33e9eb,_0x4daa6e){var _0x55d84f={};var _0x40b8a5={};var _0x14ca04;var _0x4c11ed;return db[_0x4b57('0x49')][_0x4b57('0x60')]({'where':{'id':_0x1902c5[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x33e9eb,null))[_0x4b57('0x28')](function(_0x418237){if(_0x418237){_0x14ca04=_0x418237;_0x40b8a5[_0x4b57('0x3a')]=_[_0x4b57('0x3c')](db[_0x4b57('0x6e')]['rawAttributes']);_0x40b8a5[_0x4b57('0x3b')]=_['keys'](_0x1902c5[_0x4b57('0x3b')]);_0x40b8a5[_0x4b57('0x3d')]=_[_0x4b57('0x3e')](_0x40b8a5[_0x4b57('0x3a')],_0x40b8a5[_0x4b57('0x3b')]);_0x55d84f['attributes']=_[_0x4b57('0x3e')](_0x40b8a5['model'],qs[_0x4b57('0x40')](_0x1902c5[_0x4b57('0x3b')][_0x4b57('0x40')]));_0x55d84f['attributes']=_0x55d84f[_0x4b57('0x3f')]['length']?_0x55d84f[_0x4b57('0x3f')]:_0x40b8a5['model'];_0x55d84f[_0x4b57('0x61')]=qs[_0x4b57('0x44')](_0x1902c5[_0x4b57('0x3b')][_0x4b57('0x44')]);_0x55d84f[_0x4b57('0x45')]=qs[_0x4b57('0x3d')](_[_0x4b57('0x66')](_0x1902c5[_0x4b57('0x3b')],_0x40b8a5[_0x4b57('0x3d')]));if(_0x1902c5[_0x4b57('0x3b')][_0x4b57('0x2b')]){_0x55d84f[_0x4b57('0x45')]=_[_0x4b57('0x46')](_0x55d84f['where'],{'$or':_[_0x4b57('0x2d')](_0x55d84f[_0x4b57('0x3f')],function(_0x500f18){var _0x5582aa={};_0x5582aa[_0x500f18]={'$like':'%'+_0x1902c5[_0x4b57('0x3b')][_0x4b57('0x2b')]+'%'};return _0x5582aa;})});}_0x55d84f=_['merge']({},_0x55d84f,_0x1902c5[_0x4b57('0x48')]);return _0x14ca04[_0x4b57('0x98')](_0x55d84f);}})['then'](function(_0x2bf79d){if(_0x2bf79d){_0x4c11ed=_0x2bf79d[_0x4b57('0x41')];if(!_0x1902c5['query']['hasOwnProperty']('nolimit')){_0x55d84f[_0x4b57('0x21')]=qs[_0x4b57('0x21')](_0x1902c5[_0x4b57('0x3b')]['limit']);_0x55d84f['offset']=qs[_0x4b57('0x20')](_0x1902c5[_0x4b57('0x3b')][_0x4b57('0x20')]);}return _0x14ca04[_0x4b57('0x98')](_0x55d84f);}})[_0x4b57('0x28')](function(_0x2f1a94){if(_0x2f1a94){return _0x2f1a94?{'count':_0x4c11ed,'rows':_0x2f1a94}:null;}})[_0x4b57('0x28')](respondWithResult(_0x33e9eb,null))['catch'](handleError(_0x33e9eb,null));};exports[_0x4b57('0x99')]=function(_0x1b9c1f,_0x388809,_0x3000af){var _0x40f3e0={};var _0x524a54={};var _0x30a7a8;var _0x2c3a56;return db[_0x4b57('0x49')][_0x4b57('0x60')]({'where':{'id':_0x1b9c1f[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x388809,null))[_0x4b57('0x28')](function(_0x563133){if(_0x563133){_0x30a7a8=_0x563133;_0x524a54[_0x4b57('0x3a')]=_[_0x4b57('0x3c')](db[_0x4b57('0x96')][_0x4b57('0x37')]);_0x524a54['query']=_[_0x4b57('0x3c')](_0x1b9c1f['query']);_0x524a54['filters']=_[_0x4b57('0x3e')](_0x524a54[_0x4b57('0x3a')],_0x524a54[_0x4b57('0x3b')]);_0x40f3e0['attributes']=_['intersection'](_0x524a54['model'],qs[_0x4b57('0x40')](_0x1b9c1f[_0x4b57('0x3b')][_0x4b57('0x40')]));_0x40f3e0[_0x4b57('0x3f')]=_0x40f3e0[_0x4b57('0x3f')]['length']?_0x40f3e0[_0x4b57('0x3f')]:_0x524a54[_0x4b57('0x3a')];_0x40f3e0['order']=qs[_0x4b57('0x44')](_0x1b9c1f[_0x4b57('0x3b')][_0x4b57('0x44')]);_0x40f3e0[_0x4b57('0x45')]=qs[_0x4b57('0x3d')](_[_0x4b57('0x66')](_0x1b9c1f[_0x4b57('0x3b')],_0x524a54['filters']));if(_0x1b9c1f[_0x4b57('0x3b')][_0x4b57('0x2b')]){_0x40f3e0[_0x4b57('0x45')]=_[_0x4b57('0x46')](_0x40f3e0[_0x4b57('0x45')],{'$or':_[_0x4b57('0x2d')](_0x40f3e0[_0x4b57('0x3f')],function(_0x2122f8){var _0x364720={};_0x364720[_0x2122f8]={'$like':'%'+_0x1b9c1f['query'][_0x4b57('0x2b')]+'%'};return _0x364720;})});}_0x40f3e0=_[_0x4b57('0x46')]({},_0x40f3e0,_0x1b9c1f[_0x4b57('0x48')]);return _0x30a7a8['getMembers'](_0x40f3e0);}})[_0x4b57('0x28')](function(_0x3f6d68){if(_0x3f6d68){_0x2c3a56=_0x3f6d68[_0x4b57('0x41')];if(!_0x1b9c1f[_0x4b57('0x3b')][_0x4b57('0x42')](_0x4b57('0x43'))){_0x40f3e0[_0x4b57('0x21')]=qs['limit'](_0x1b9c1f[_0x4b57('0x3b')]['limit']);_0x40f3e0['offset']=qs[_0x4b57('0x20')](_0x1b9c1f[_0x4b57('0x3b')][_0x4b57('0x20')]);}return _0x30a7a8[_0x4b57('0x99')](_0x40f3e0);}})[_0x4b57('0x28')](function(_0x2888c3){return _0x2888c3?{'count':_0x2c3a56,'rows':_0x2888c3}:null;})[_0x4b57('0x28')](respondWithResult(_0x388809,null))[_0x4b57('0x4e')](handleError(_0x388809,null));};exports[_0x4b57('0x9a')]=function(_0x2babe4,_0x317b9f,_0x51dd56){var _0x57f8e7={};var _0x51b528={};var _0xd902ac;var _0x341543;return db[_0x4b57('0x49')][_0x4b57('0x60')]({'where':{'id':_0x2babe4[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x317b9f,null))[_0x4b57('0x28')](function(_0x549c2d){if(_0x549c2d){_0xd902ac=_0x549c2d;_0x51b528[_0x4b57('0x3a')]=_[_0x4b57('0x3c')](db[_0x4b57('0x9b')][_0x4b57('0x37')]);_0x51b528[_0x4b57('0x3b')]=_[_0x4b57('0x3c')](_0x2babe4[_0x4b57('0x3b')]);_0x51b528[_0x4b57('0x3d')]=_['intersection'](_0x51b528[_0x4b57('0x3a')],_0x51b528[_0x4b57('0x3b')]);_0x57f8e7[_0x4b57('0x3f')]=_[_0x4b57('0x3e')](_0x51b528[_0x4b57('0x3a')],qs[_0x4b57('0x40')](_0x2babe4['query'][_0x4b57('0x40')]));_0x57f8e7[_0x4b57('0x3f')]=_0x57f8e7[_0x4b57('0x3f')][_0x4b57('0x41')]?_0x57f8e7['attributes']:_0x51b528[_0x4b57('0x3a')];_0x57f8e7[_0x4b57('0x61')]=qs[_0x4b57('0x44')](_0x2babe4[_0x4b57('0x3b')][_0x4b57('0x44')]);_0x57f8e7[_0x4b57('0x45')]=qs['filters'](_[_0x4b57('0x66')](_0x2babe4[_0x4b57('0x3b')],_0x51b528[_0x4b57('0x3d')]));if(_0x2babe4['query'][_0x4b57('0x2b')]){_0x57f8e7[_0x4b57('0x45')]=_['merge'](_0x57f8e7[_0x4b57('0x45')],{'$or':_[_0x4b57('0x2d')](_0x57f8e7[_0x4b57('0x3f')],function(_0x4bc10d){var _0x3efd20={};_0x3efd20[_0x4bc10d]={'$like':'%'+_0x2babe4[_0x4b57('0x3b')][_0x4b57('0x2b')]+'%'};return _0x3efd20;})});}_0x57f8e7=_[_0x4b57('0x46')]({},_0x57f8e7,_0x2babe4[_0x4b57('0x48')]);return _0xd902ac[_0x4b57('0x9a')](_0x57f8e7);}})[_0x4b57('0x28')](function(_0x3da531){if(_0x3da531){_0x341543=_0x3da531[_0x4b57('0x41')];if(!_0x2babe4['query'][_0x4b57('0x42')](_0x4b57('0x43'))){_0x57f8e7[_0x4b57('0x21')]=qs[_0x4b57('0x21')](_0x2babe4[_0x4b57('0x3b')]['limit']);_0x57f8e7[_0x4b57('0x20')]=qs[_0x4b57('0x20')](_0x2babe4[_0x4b57('0x3b')][_0x4b57('0x20')]);}return _0xd902ac[_0x4b57('0x9a')](_0x57f8e7);}})[_0x4b57('0x28')](function(_0x1aa6b9){if(_0x1aa6b9){return _0x1aa6b9?{'count':_0x341543,'rows':_0x1aa6b9}:null;}})[_0x4b57('0x28')](respondWithResult(_0x317b9f,null))[_0x4b57('0x4e')](handleError(_0x317b9f,null));};exports[_0x4b57('0x9c')]=function(_0x4bda75,_0x5beba1,_0xc0d1a3){var _0x4bc8e7,_0x28c100;return db[_0x4b57('0x49')]['find']({'where':{'id':_0x4bda75[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x5beba1,null))['then'](function(_0x4e9e03){if(_0x4e9e03){_0x28c100=_0x4e9e03;return _0x4e9e03[_0x4b57('0x9c')](_0x4bda75[_0x4b57('0x52')][_0x4b57('0x8f')],_[_0x4b57('0x94')](_0x4bda75[_0x4b57('0x52')],[_0x4b57('0x8f'),'id'])||{});}return null;})['spread'](function(_0x3a5229){var _0x5c1e96;_0x4bc8e7=_0x3a5229||[];var _0x150c20=[];if(_0x3a5229){for(var _0x297e48=0x0;_0x297e48<_0x3a5229[_0x4b57('0x41')];_0x297e48+=0x1){var _0x200f2d=_0x3a5229[_0x297e48][_0x4b57('0x54')]({'plain':!![]});_0x28c100[_0x4b57('0x9d')]=_0x4bda75[_0x4b57('0x52')][_0x4b57('0x9d')]?_0x4bda75[_0x4b57('0x52')]['dialCheckDuplicateType']:_0x28c100[_0x4b57('0x9d')];switch(_0x28c100[_0x4b57('0x9d')]){case _0x4b57('0x9e'):_0x5c1e96=squel[_0x4b57('0x9f')]()[_0x4b57('0xa0')](_0x4b57('0xa1'))[_0x4b57('0xa2')]([_0x4b57('0xa3'),_0x4b57('0xa4'),_0x4b57('0xa5'),'ListId',_0x4b57('0x62'),_0x4b57('0x5b'),'updatedAt'],squel['select']()[_0x4b57('0xa6')](_0x4b57('0xa3'),'phone')[_0x4b57('0xa6')](_0x4b57('0xa7'),_0x4b57('0xa4'))[_0x4b57('0xa6')]('id','ContactId')[_0x4b57('0xa6')](_0x200f2d[_0x4b57('0xa8')][_0x4b57('0xa9')](),_0x4b57('0xaa'))['field'](_0x4bda75[_0x4b57('0x50')]['id']['toString'](),'VoiceQueueId')[_0x4b57('0xa6')](_0x4b57('0xa7'),_0x4b57('0x5b'))[_0x4b57('0xa6')]('NOW()',_0x4b57('0x5c'))[_0x4b57('0x81')](_0x4b57('0xab'))[_0x4b57('0x45')](_0x4b57('0xac'))[_0x4b57('0x45')](_0x4b57('0xad'),_0x200f2d[_0x4b57('0xa8')]['toString']())[_0x4b57('0x45')](_0x4b57('0xae'))[_0x4b57('0x45')](_0x4b57('0xaf'),squel[_0x4b57('0x80')]()[_0x4b57('0xa6')](_0x4b57('0xb0'))['from'](_0x4b57('0xb1'))[_0x4b57('0x45')]('VoiceQueueId\x20=\x20?',_0x4bda75['params']['id'][_0x4b57('0xa9')]()))[_0x4b57('0x45')](_0x4b57('0xaf'),squel[_0x4b57('0x80')]()[_0x4b57('0xa6')](_0x4b57('0xb2'))[_0x4b57('0x81')]('cm_hopper')[_0x4b57('0x45')](_0x4b57('0x86'),_0x4bda75[_0x4b57('0x50')]['id'][_0x4b57('0xa9')]())))[_0x4b57('0xa9')]();break;case'onlyIfOpen':_0x5c1e96=squel[_0x4b57('0x9f')]()[_0x4b57('0xa0')](_0x4b57('0xa1'))[_0x4b57('0xa2')]([_0x4b57('0xa3'),_0x4b57('0xa4'),'ContactId','ListId','VoiceQueueId','createdAt',_0x4b57('0x5c')],squel[_0x4b57('0x80')]()[_0x4b57('0xa6')](_0x4b57('0xa3'),_0x4b57('0xa3'))[_0x4b57('0xa6')](_0x4b57('0xa7'),_0x4b57('0xa4'))[_0x4b57('0xa6')]('id',_0x4b57('0xa5'))[_0x4b57('0xa6')](_0x200f2d[_0x4b57('0xa8')][_0x4b57('0xa9')](),_0x4b57('0xaa'))[_0x4b57('0xa6')](_0x4bda75[_0x4b57('0x50')]['id'][_0x4b57('0xa9')](),_0x4b57('0x62'))[_0x4b57('0xa6')](_0x4b57('0xa7'),'createdAt')[_0x4b57('0xa6')](_0x4b57('0xa7'),_0x4b57('0x5c'))['from'](_0x4b57('0xab'))[_0x4b57('0x45')](_0x4b57('0xac'))[_0x4b57('0x45')](_0x4b57('0xad'),_0x200f2d[_0x4b57('0xa8')][_0x4b57('0xa9')]())[_0x4b57('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0x4b57('0x45')](_0x4b57('0xaf'),squel[_0x4b57('0x80')]()[_0x4b57('0xa6')](_0x4b57('0xb2'))[_0x4b57('0x81')](_0x4b57('0xa1'))[_0x4b57('0x45')](_0x4b57('0x86'),_0x4bda75[_0x4b57('0x50')]['id']['toString']())))[_0x4b57('0xa9')]();break;default:_0x5c1e96=squel[_0x4b57('0x9f')]()[_0x4b57('0xa0')](_0x4b57('0xa1'))[_0x4b57('0xa2')]([_0x4b57('0xa3'),_0x4b57('0xa4'),'ContactId',_0x4b57('0xaa'),_0x4b57('0x62'),_0x4b57('0x5b'),'updatedAt'],squel[_0x4b57('0x80')]()[_0x4b57('0xa6')](_0x4b57('0xa3'),'phone')[_0x4b57('0xa6')](_0x4b57('0xa7'),_0x4b57('0xa4'))[_0x4b57('0xa6')]('id',_0x4b57('0xa5'))[_0x4b57('0xa6')](_0x200f2d[_0x4b57('0xa8')][_0x4b57('0xa9')](),_0x4b57('0xaa'))['field'](_0x4bda75[_0x4b57('0x50')]['id']['toString'](),'VoiceQueueId')[_0x4b57('0xa6')](_0x4b57('0xa7'),_0x4b57('0x5b'))[_0x4b57('0xa6')](_0x4b57('0xa7'),_0x4b57('0x5c'))[_0x4b57('0x81')](_0x4b57('0xab'))[_0x4b57('0x45')](_0x4b57('0xac'))[_0x4b57('0x45')]('ListId\x20=\x20?',_0x200f2d[_0x4b57('0xa8')][_0x4b57('0xa9')]())[_0x4b57('0x45')](_0x4b57('0xae')))[_0x4b57('0xa9')]();}_0x150c20[_0x4b57('0x88')](db[_0x4b57('0x75')]['query'](_0x5c1e96));}return BPromise['all'](_0x150c20);}})[_0x4b57('0x28')](function(){return _0x4bc8e7;})['then'](respondWithResult(_0x5beba1,null))[_0x4b57('0x4e')](handleError(_0x5beba1,null));};exports['removeLists']=function(_0xdac10b,_0x1b4405,_0x5c67e0){return db[_0x4b57('0x49')]['find']({'where':{'id':_0xdac10b['params']['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x1b4405,null))[_0x4b57('0x28')](function(_0x6ec32e){if(_0x6ec32e){return _0x6ec32e['removeLists'](_0xdac10b[_0x4b57('0x3b')][_0x4b57('0x8f')]);}})[_0x4b57('0x28')](function(_0x285a7d){if(_0x285a7d){return db[_0x4b57('0x63')]['destroy']({'where':{'ListId':_0xdac10b[_0x4b57('0x3b')]['ids'],'VoiceQueueId':_0xdac10b[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](function(){return _0x285a7d;});}})[_0x4b57('0x28')](respondWithStatusCode(_0x1b4405,null))[_0x4b57('0x4e')](handleError(_0x1b4405,null));};exports[_0x4b57('0xb3')]=function(_0x110074,_0x1c97a0,_0x376b98){var _0x2ad7fa={};var _0x59d450={};var _0x3b82b0;var _0x30973e;return db[_0x4b57('0x49')][_0x4b57('0x60')]({'where':{'id':_0x110074[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x1c97a0,null))['then'](function(_0x3cc9ef){if(_0x3cc9ef){_0x3b82b0=_0x3cc9ef;_0x59d450[_0x4b57('0x3a')]=_[_0x4b57('0x3c')](db[_0x4b57('0x9b')][_0x4b57('0x37')]);_0x59d450[_0x4b57('0x3b')]=_[_0x4b57('0x3c')](_0x110074[_0x4b57('0x3b')]);_0x59d450['filters']=_[_0x4b57('0x3e')](_0x59d450[_0x4b57('0x3a')],_0x59d450[_0x4b57('0x3b')]);_0x2ad7fa[_0x4b57('0x3f')]=_[_0x4b57('0x3e')](_0x59d450[_0x4b57('0x3a')],qs['fields'](_0x110074[_0x4b57('0x3b')]['fields']));_0x2ad7fa[_0x4b57('0x3f')]=_0x2ad7fa[_0x4b57('0x3f')][_0x4b57('0x41')]?_0x2ad7fa[_0x4b57('0x3f')]:_0x59d450['model'];_0x2ad7fa[_0x4b57('0x61')]=qs['sort'](_0x110074[_0x4b57('0x3b')]['sort']);_0x2ad7fa[_0x4b57('0x45')]=qs[_0x4b57('0x3d')](_[_0x4b57('0x66')](_0x110074[_0x4b57('0x3b')],_0x59d450[_0x4b57('0x3d')]));if(_0x110074['query']['filter']){_0x2ad7fa[_0x4b57('0x45')]=_[_0x4b57('0x46')](_0x2ad7fa[_0x4b57('0x45')],{'$or':_[_0x4b57('0x2d')](_0x2ad7fa['attributes'],function(_0x38fc13){var _0x3d399a={};_0x3d399a[_0x38fc13]={'$like':'%'+_0x110074[_0x4b57('0x3b')]['filter']+'%'};return _0x3d399a;})});}_0x2ad7fa=_[_0x4b57('0x46')]({},_0x2ad7fa,_0x110074[_0x4b57('0x48')]);return _0x3b82b0[_0x4b57('0xb3')](_0x2ad7fa);}})[_0x4b57('0x28')](function(_0x418fff){if(_0x418fff){_0x30973e=_0x418fff[_0x4b57('0x41')];if(!_0x110074[_0x4b57('0x3b')][_0x4b57('0x42')]('nolimit')){_0x2ad7fa[_0x4b57('0x21')]=qs[_0x4b57('0x21')](_0x110074[_0x4b57('0x3b')][_0x4b57('0x21')]);_0x2ad7fa[_0x4b57('0x20')]=qs[_0x4b57('0x20')](_0x110074[_0x4b57('0x3b')]['offset']);}return _0x3b82b0[_0x4b57('0xb3')](_0x2ad7fa);}})[_0x4b57('0x28')](function(_0x4fe7a4){if(_0x4fe7a4){return _0x4fe7a4?{'count':_0x30973e,'rows':_0x4fe7a4}:null;}})[_0x4b57('0x28')](respondWithResult(_0x1c97a0,null))[_0x4b57('0x4e')](handleError(_0x1c97a0,null));};exports[_0x4b57('0xb4')]=function(_0x5959e8,_0x49f9d9,_0x4f8eed){var _0x2c5ba3,_0x5cf9c9;return db[_0x4b57('0x49')]['find']({'where':{'id':_0x5959e8[_0x4b57('0x50')]['id']}})['then'](handleEntityNotFound(_0x49f9d9,null))[_0x4b57('0x28')](function(_0x43c62d){if(_0x43c62d){_0x5cf9c9=_0x43c62d;return _0x43c62d[_0x4b57('0xb4')](_0x5959e8[_0x4b57('0x52')]['ids'],_[_0x4b57('0x94')](_0x5959e8[_0x4b57('0x52')],[_0x4b57('0x8f'),'id'])||{});}return null;})[_0x4b57('0x95')](function(_0x2f93a8){var _0x1af6b7;_0x2c5ba3=_0x2f93a8||[];var _0x2366dc=[];if(_0x2f93a8){for(var _0x315222=0x0;_0x315222<_0x2f93a8[_0x4b57('0x41')];_0x315222+=0x1){var _0x2fe126=_0x2f93a8[_0x315222][_0x4b57('0x54')]({'plain':!![]});_0x1af6b7=squel[_0x4b57('0x9f')]()[_0x4b57('0xa0')](_0x4b57('0xb5'))[_0x4b57('0xa2')]([_0x4b57('0xa3'),_0x4b57('0xa5'),_0x4b57('0xaa'),_0x4b57('0x62'),_0x4b57('0x5b'),_0x4b57('0x5c')],squel['select']()['field'](_0x4b57('0xa3'),_0x4b57('0xa3'))[_0x4b57('0xa6')]('id',_0x4b57('0xa5'))[_0x4b57('0xa6')](_0x2fe126['CmListId'][_0x4b57('0xa9')](),_0x4b57('0xaa'))['field'](_0x5959e8[_0x4b57('0x50')]['id'][_0x4b57('0xa9')](),_0x4b57('0x62'))[_0x4b57('0xa6')](_0x4b57('0xa7'),'createdAt')[_0x4b57('0xa6')](_0x4b57('0xa7'),_0x4b57('0x5c'))[_0x4b57('0x81')](_0x4b57('0xab'))['where']('deletedAt\x20IS\x20NULL')[_0x4b57('0x45')](_0x4b57('0xad'),_0x2fe126[_0x4b57('0xa8')][_0x4b57('0xa9')]())[_0x4b57('0x45')](_0x4b57('0xae')))[_0x4b57('0xa9')]();_0x2366dc['push'](db[_0x4b57('0x75')][_0x4b57('0x3b')](_0x1af6b7));}return BPromise[_0x4b57('0xb6')](_0x2366dc);}})[_0x4b57('0x28')](function(){return _0x2c5ba3;})[_0x4b57('0x28')](respondWithResult(_0x49f9d9,null))[_0x4b57('0x4e')](handleError(_0x49f9d9,null));};exports[_0x4b57('0xb7')]=function(_0x50c6b8,_0x43fe0b,_0x4156aa){return db[_0x4b57('0x49')][_0x4b57('0x30')]({'where':{'id':_0x50c6b8[_0x4b57('0x50')]['id']}})[_0x4b57('0x28')](handleEntityNotFound(_0x43fe0b,null))['then'](function(_0x1d89b7){if(_0x1d89b7){return _0x1d89b7[_0x4b57('0xb7')](_0x50c6b8[_0x4b57('0x3b')]['ids']);}})[_0x4b57('0x28')](function(_0xc2706){if(_0xc2706){return db['CmHopperBlack'][_0x4b57('0x27')]({'where':{'ListId':_0x50c6b8[_0x4b57('0x3b')][_0x4b57('0x8f')],'VoiceQueueId':_0x50c6b8['params']['id']}})[_0x4b57('0x28')](function(){return _0xc2706;});}})[_0x4b57('0x28')](respondWithStatusCode(_0x43fe0b,null))[_0x4b57('0x4e')](handleError(_0x43fe0b,null));}; \ No newline at end of file +var _0xfff0=['stack','send','index','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','VoiceQueue','includeAll','include','rows','catch','show','params','keys','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','role','getHoppers','findOne','VoiceQueueId','CmHopper','findAll','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','teams','online','voicePause','interface','flatMap','penalty','Agents','sequelize','addTeams','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','emit','userVoiceQueue:save','removeTeams','Team','ids','User','select','field','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','union','compact','transaction','isEmpty','userVoiceQueue:remove','addAgents','spread','SIP/%s','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','updatedAt','NOW()','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','register','sendStatus','json','count','offset','status','set','Content-Range','apply','reject','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','end','error'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfff0,0x139));var _0x0fff=function(_0xc04dc8,_0x3833da){_0xc04dc8=_0xc04dc8-0x0;var _0x2d893b=_0xfff0[_0xc04dc8];return _0x2d893b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0fff('0x0'));var rimraf=require(_0x0fff('0x1'));var zipdir=require(_0x0fff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0fff('0x3'));var moment=require(_0x0fff('0x4'));var BPromise=require(_0x0fff('0x5'));var Mustache=require('mustache');var util=require(_0x0fff('0x6'));var path=require(_0x0fff('0x7'));var sox=require('sox');var csv=require(_0x0fff('0x8'));var ejs=require(_0x0fff('0x9'));var fs=require('fs');var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var db=require(_0x0fff('0x17'))['db'];config[_0x0fff('0x18')]=_[_0x0fff('0x19')](config['redis'],{'host':_0x0fff('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0fff('0x18')]));require(_0x0fff('0x1b'))[_0x0fff('0x1c')](socket);function respondWithStatusCode(_0x2c0322,_0x55e5fa){_0x55e5fa=_0x55e5fa||0xcc;return function(_0x53bde9){if(_0x53bde9){return _0x2c0322[_0x0fff('0x1d')](_0x55e5fa);}return _0x2c0322['status'](_0x55e5fa)['end']();};}function respondWithResult(_0x51ceea,_0x1fb430){_0x1fb430=_0x1fb430||0xc8;return function(_0x41e2e7){if(_0x41e2e7){return _0x51ceea['status'](_0x1fb430)[_0x0fff('0x1e')](_0x41e2e7);}};}function respondWithFilteredResult(_0x6c24d2,_0x540a67){return function(_0x528071){if(_0x528071){var _0x48f36d=_0x528071[_0x0fff('0x1f')],_0x2337f=_0x540a67[_0x0fff('0x20')],_0x606792=_0x540a67[_0x0fff('0x20')]+_0x540a67['limit'],_0x46a02d;if(_0x606792>=_0x48f36d){_0x606792=_0x48f36d;_0x46a02d=0xc8;}else{_0x46a02d=0xce;}_0x6c24d2[_0x0fff('0x21')](_0x46a02d);return _0x6c24d2[_0x0fff('0x22')](_0x0fff('0x23'),_0x2337f+'-'+_0x606792+'/'+_0x48f36d)['json'](_0x528071);}return null;};}function patchUpdates(_0x5e27df){return function(_0x40831d){try{jsonpatch[_0x0fff('0x24')](_0x40831d,_0x5e27df,!![]);}catch(_0x1f97c5){return BPromise[_0x0fff('0x25')](_0x1f97c5);}return _0x40831d['save']();};}function saveUpdates(_0x155132,_0x2f8665){return function(_0x29d703){if(_0x29d703){return _0x29d703[_0x0fff('0x26')](_0x155132)[_0x0fff('0x27')](function(_0x17fba6){return _0x17fba6;});}return null;};}function removeEntity(_0x580b8e,_0x6a116c){return function(_0x29f702){if(_0x29f702){return _0x29f702[_0x0fff('0x28')]()[_0x0fff('0x27')](function(){var _0x11ac00=_0x29f702[_0x0fff('0x29')]({'plain':!![]});var _0x482e1e=[{'name':_0x0fff('0x2a'),'value':_0x0fff('0x2b'),'ignore':![]},{'name':_0x0fff('0x2c'),'value':_0x0fff('0x2d'),'ignore':![]}];var _0x36d268=_(_0x482e1e)[_0x0fff('0x2e')](_0x0fff('0x2f'))[_0x0fff('0x30')](_0x0fff('0x31'))[_0x0fff('0x31')]();if(_[_0x0fff('0x32')](_0x36d268,_0x11ac00[_0x0fff('0x33')])){return;}var _0x495734=_[_0x0fff('0x34')](_0x482e1e,[_0x0fff('0x31'),_0x11ac00[_0x0fff('0x33')]])[_0x0fff('0x35')];return db[_0x0fff('0x36')][_0x0fff('0x28')]({'where':{'type':_0x495734,'resourceId':_0x11ac00['id']}})['then'](function(){return _0x29f702;});})[_0x0fff('0x27')](function(){_0x580b8e[_0x0fff('0x21')](0xcc)[_0x0fff('0x37')]();});}};}function handleEntityNotFound(_0x48f1d1,_0x1016fa){return function(_0x3fa6fc){if(!_0x3fa6fc){_0x48f1d1['sendStatus'](0x194);}return _0x3fa6fc;};}function handleError(_0x3daf51,_0x433de6){_0x433de6=_0x433de6||0x1f4;return function(_0x15bb46){logger[_0x0fff('0x38')](_0x15bb46[_0x0fff('0x39')]);if(_0x15bb46[_0x0fff('0x35')]){delete _0x15bb46[_0x0fff('0x35')];}_0x3daf51[_0x0fff('0x21')](_0x433de6)[_0x0fff('0x3a')](_0x15bb46);};}exports[_0x0fff('0x3b')]=function(_0x58469b,_0x157863){var _0x1c19f5={},_0x2b5a2a={},_0x1bbb9e={'count':0x0,'rows':[]};var _0x39349e=_['map'](db['VoiceQueue'][_0x0fff('0x3c')],function(_0x1a5ef6){return{'name':_0x1a5ef6[_0x0fff('0x3d')],'type':_0x1a5ef6[_0x0fff('0x33')]['key']};});_0x2b5a2a[_0x0fff('0x3e')]=_[_0x0fff('0x30')](_0x39349e,_0x0fff('0x35'));_0x2b5a2a[_0x0fff('0x3f')]=_['keys'](_0x58469b[_0x0fff('0x3f')]);_0x2b5a2a[_0x0fff('0x40')]=_[_0x0fff('0x41')](_0x2b5a2a[_0x0fff('0x3e')],_0x2b5a2a[_0x0fff('0x3f')]);_0x1c19f5[_0x0fff('0x42')]=_[_0x0fff('0x41')](_0x2b5a2a[_0x0fff('0x3e')],qs[_0x0fff('0x43')](_0x58469b[_0x0fff('0x3f')][_0x0fff('0x43')]));_0x1c19f5[_0x0fff('0x42')]=_0x1c19f5['attributes'][_0x0fff('0x44')]?_0x1c19f5[_0x0fff('0x42')]:_0x2b5a2a[_0x0fff('0x3e')];if(!_0x58469b[_0x0fff('0x3f')][_0x0fff('0x45')](_0x0fff('0x46'))){_0x1c19f5['limit']=qs[_0x0fff('0x47')](_0x58469b[_0x0fff('0x3f')][_0x0fff('0x47')]);_0x1c19f5[_0x0fff('0x20')]=qs[_0x0fff('0x20')](_0x58469b[_0x0fff('0x3f')][_0x0fff('0x20')]);}_0x1c19f5[_0x0fff('0x48')]=qs[_0x0fff('0x49')](_0x58469b['query'][_0x0fff('0x49')]);_0x1c19f5['where']=qs[_0x0fff('0x40')](_[_0x0fff('0x4a')](_0x58469b[_0x0fff('0x3f')],_0x2b5a2a['filters']));if(_0x58469b['query'][_0x0fff('0x2e')]){_0x1c19f5[_0x0fff('0x4b')]=_[_0x0fff('0x4c')](_0x1c19f5['where'],{'$or':_['map'](_0x39349e,function(_0x4668b3){if(_0x4668b3['type']!==_0x0fff('0x4d')){var _0x957265={};_0x957265[_0x4668b3[_0x0fff('0x35')]]={'$like':'%'+_0x58469b[_0x0fff('0x3f')][_0x0fff('0x2e')]+'%'};return _0x957265;}})});}_0x1c19f5=_[_0x0fff('0x4c')]({},_0x1c19f5,_0x58469b['options']);var _0x9e235c={'where':_0x1c19f5[_0x0fff('0x4b')]};return db[_0x0fff('0x4e')][_0x0fff('0x1f')](_0x9e235c)[_0x0fff('0x27')](function(_0xebc17b){_0x1bbb9e[_0x0fff('0x1f')]=_0xebc17b;if(_0x58469b['query'][_0x0fff('0x4f')]){_0x1c19f5[_0x0fff('0x50')]=[{'all':!![]}];}return db[_0x0fff('0x4e')]['findAll'](_0x1c19f5);})[_0x0fff('0x27')](function(_0x365c03){_0x1bbb9e[_0x0fff('0x51')]=_0x365c03;return _0x1bbb9e;})[_0x0fff('0x27')](respondWithFilteredResult(_0x157863,_0x1c19f5))[_0x0fff('0x52')](handleError(_0x157863,null));};exports[_0x0fff('0x53')]=function(_0x2f73cf,_0x2059f2){var _0x29b210={'raw':![],'where':{'id':_0x2f73cf[_0x0fff('0x54')]['id']}},_0x1ab27d={};_0x1ab27d['model']=_[_0x0fff('0x55')](db[_0x0fff('0x4e')]['rawAttributes']);_0x1ab27d[_0x0fff('0x3f')]=_[_0x0fff('0x55')](_0x2f73cf[_0x0fff('0x3f')]);_0x1ab27d['filters']=_['intersection'](_0x1ab27d[_0x0fff('0x3e')],_0x1ab27d['query']);_0x29b210['attributes']=_[_0x0fff('0x41')](_0x1ab27d[_0x0fff('0x3e')],qs[_0x0fff('0x43')](_0x2f73cf[_0x0fff('0x3f')][_0x0fff('0x43')]));_0x29b210[_0x0fff('0x42')]=_0x29b210['attributes'][_0x0fff('0x44')]?_0x29b210[_0x0fff('0x42')]:_0x1ab27d[_0x0fff('0x3e')];if(_0x2f73cf[_0x0fff('0x3f')][_0x0fff('0x4f')]){_0x29b210[_0x0fff('0x50')]=[{'all':!![]}];}_0x29b210=_['merge']({},_0x29b210,_0x2f73cf[_0x0fff('0x56')]);return db[_0x0fff('0x4e')]['find'](_0x29b210)[_0x0fff('0x27')](handleEntityNotFound(_0x2059f2,null))['then'](respondWithResult(_0x2059f2,null))['catch'](handleError(_0x2059f2,null));};exports['create']=function(_0x218e1c,_0x30967c){return db[_0x0fff('0x4e')][_0x0fff('0x57')](_0x218e1c[_0x0fff('0x58')],{})['then'](function(_0x2524ad){var _0x2c765f=_0x218e1c[_0x0fff('0x59')][_0x0fff('0x29')]({'plain':!![]});if(!_0x2c765f)throw new Error(_0x0fff('0x5a'));if(_0x2c765f['role']===_0x0fff('0x59')){var _0x3d185d=_0x2524ad[_0x0fff('0x29')]({'plain':!![]});var _0x168f3a=[{'name':_0x0fff('0x2a'),'value':_0x0fff('0x2b')},{'name':_0x0fff('0x2c'),'value':_0x0fff('0x2d')}];var _0x306815=_[_0x0fff('0x34')](_0x168f3a,[_0x0fff('0x31'),_0x3d185d[_0x0fff('0x33')]])[_0x0fff('0x35')];return db[_0x0fff('0x5b')][_0x0fff('0x34')]({'where':{'name':_0x306815,'userProfileId':_0x2c765f[_0x0fff('0x5c')]},'raw':!![]})[_0x0fff('0x27')](function(_0x130398){if(_0x130398&&_0x130398[_0x0fff('0x5d')]===0x0){return db[_0x0fff('0x36')][_0x0fff('0x57')]({'name':_0x3d185d['name'],'resourceId':_0x3d185d['id'],'type':_0x130398[_0x0fff('0x35')],'sectionId':_0x130398['id']},{})[_0x0fff('0x27')](function(){return _0x2524ad;});}else{return _0x2524ad;}})[_0x0fff('0x52')](function(_0x2744b4){logger['error'](_0x0fff('0x5e'),_0x2744b4);throw _0x2744b4;});}return _0x2524ad;})['then'](respondWithResult(_0x30967c,0xc9))[_0x0fff('0x52')](handleError(_0x30967c,null));};exports[_0x0fff('0x5f')]=function(_0x131842,_0x22a0a0){var _0x4bf865={'where':{'id':_0x131842[_0x0fff('0x54')]['id']}},_0x112284={};_0x112284[_0x0fff('0x3e')]=_[_0x0fff('0x55')](db['VoiceQueue']['rawAttributes']);_0x4bf865[_0x0fff('0x42')]=_[_0x0fff('0x41')](_0x112284[_0x0fff('0x3e')],qs[_0x0fff('0x43')](_0x131842[_0x0fff('0x3f')][_0x0fff('0x43')]));_0x4bf865['attributes']=_0x4bf865['attributes'][_0x0fff('0x44')]?_0x4bf865[_0x0fff('0x42')]:_0x112284[_0x0fff('0x3e')];if(_0x131842[_0x0fff('0x3f')][_0x0fff('0x4f')]){_0x4bf865[_0x0fff('0x50')]=[{'all':!![]}];}_0x4bf865=_[_0x0fff('0x4c')]({},_0x4bf865,_0x131842[_0x0fff('0x56')]);return db['VoiceQueue'][_0x0fff('0x34')](_0x4bf865)['then'](handleEntityNotFound(_0x22a0a0,null))[_0x0fff('0x27')](function(_0x145dd4){if(_0x145dd4){var _0x163d8a=_0x145dd4['get']({'plain':!![]});_0x163d8a=qs['omit'](_0x163d8a,['id',_0x0fff('0x60'),'updatedAt']);_0x131842[_0x0fff('0x58')]=_[_0x0fff('0x61')](_0x131842[_0x0fff('0x58')],['id',_0x0fff('0x60'),'updatedAt']);return db[_0x0fff('0x4e')][_0x0fff('0x57')](_['merge'](_0x163d8a,_0x131842[_0x0fff('0x58')]),{'include':_0x131842[_0x0fff('0x3f')][_0x0fff('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0xb33919){var _0x1dc3d6=_0x131842[_0x0fff('0x59')][_0x0fff('0x29')]({'plain':!![]});if(!_0x1dc3d6)throw new Error(_0x0fff('0x5a'));if(_0x1dc3d6[_0x0fff('0x62')]===_0x0fff('0x59')){var _0x18aaca=_0xb33919[_0x0fff('0x29')]({'plain':!![]});var _0x31848c=[{'name':_0x0fff('0x2a'),'value':_0x0fff('0x2b')},{'name':'QueueCampaigns','value':'outbound'}];var _0x247819=_['find'](_0x31848c,['value',_0x18aaca[_0x0fff('0x33')]])[_0x0fff('0x35')];return db[_0x0fff('0x5b')]['find']({'where':{'name':_0x247819,'userProfileId':_0x1dc3d6['userProfileId']},'raw':!![]})[_0x0fff('0x27')](function(_0x1f9869){if(_0x1f9869&&_0x1f9869[_0x0fff('0x5d')]===0x0){return db[_0x0fff('0x36')]['create']({'name':_0x18aaca[_0x0fff('0x35')],'resourceId':_0x18aaca['id'],'type':_0x1f9869[_0x0fff('0x35')],'sectionId':_0x1f9869['id']},{})[_0x0fff('0x27')](function(){return _0xb33919;});}else{return _0xb33919;}})[_0x0fff('0x52')](function(_0x5db230){logger[_0x0fff('0x38')](_0x0fff('0x5e'),_0x5db230);throw _0x5db230;});}return _0xb33919;});}})['then'](respondWithResult(_0x22a0a0,0xc9))['catch'](handleError(_0x22a0a0,null));};exports[_0x0fff('0x26')]=function(_0x1dac18,_0x2e91e0){if(_0x1dac18[_0x0fff('0x58')]['id']){delete _0x1dac18[_0x0fff('0x58')]['id'];}return db['VoiceQueue'][_0x0fff('0x34')]({'where':{'id':_0x1dac18[_0x0fff('0x54')]['id']}})[_0x0fff('0x27')](handleEntityNotFound(_0x2e91e0,null))[_0x0fff('0x27')](saveUpdates(_0x1dac18[_0x0fff('0x58')],null))['then'](respondWithResult(_0x2e91e0,null))['catch'](handleError(_0x2e91e0,null));};exports[_0x0fff('0x28')]=function(_0x5e55c8,_0x7c1ffa){return db[_0x0fff('0x4e')][_0x0fff('0x34')]({'where':{'id':_0x5e55c8[_0x0fff('0x54')]['id']}})[_0x0fff('0x27')](handleEntityNotFound(_0x7c1ffa,null))['then'](removeEntity(_0x7c1ffa,null))[_0x0fff('0x52')](handleError(_0x7c1ffa,null));};exports[_0x0fff('0x63')]=function(_0x2ba884,_0xa97b12,_0x31ff4e){var _0x15ab8e={'raw':![],'where':{}};var _0x38e2e9={};var _0x41c7a8={'count':0x0,'rows':[]};return db[_0x0fff('0x4e')][_0x0fff('0x64')]({'where':{'id':_0x2ba884[_0x0fff('0x54')]['id']}})['then'](handleEntityNotFound(_0xa97b12,null))[_0x0fff('0x27')](function(_0x3d5b12){if(_0x3d5b12){_0x38e2e9['model']=_[_0x0fff('0x55')](db['CmHopper'][_0x0fff('0x3c')]);_0x38e2e9[_0x0fff('0x3f')]=_[_0x0fff('0x55')](_0x2ba884[_0x0fff('0x3f')]);_0x38e2e9[_0x0fff('0x40')]=_['intersection'](_0x38e2e9[_0x0fff('0x3e')],_0x38e2e9[_0x0fff('0x3f')]);_0x15ab8e['attributes']=_[_0x0fff('0x41')](_0x38e2e9[_0x0fff('0x3e')],qs[_0x0fff('0x43')](_0x2ba884['query'][_0x0fff('0x43')]));_0x15ab8e[_0x0fff('0x42')]=_0x15ab8e['attributes']['length']?_0x15ab8e[_0x0fff('0x42')]:_0x38e2e9['model'];if(!_0x2ba884['query'][_0x0fff('0x45')](_0x0fff('0x46'))){_0x15ab8e[_0x0fff('0x47')]=qs['limit'](_0x2ba884['query'][_0x0fff('0x47')]);_0x15ab8e['offset']=qs[_0x0fff('0x20')](_0x2ba884[_0x0fff('0x3f')][_0x0fff('0x20')]);}_0x15ab8e[_0x0fff('0x48')]=qs[_0x0fff('0x49')](_0x2ba884[_0x0fff('0x3f')][_0x0fff('0x49')]);_0x15ab8e['where']=qs[_0x0fff('0x40')](_[_0x0fff('0x4a')](_0x2ba884[_0x0fff('0x3f')],_0x38e2e9[_0x0fff('0x40')]));_0x15ab8e[_0x0fff('0x4b')][_0x0fff('0x65')]=_0x3d5b12['id'];if(_0x2ba884['query'][_0x0fff('0x2e')]){_0x15ab8e['where']=_[_0x0fff('0x4c')](_0x15ab8e[_0x0fff('0x4b')],{'$or':_[_0x0fff('0x30')](_0x15ab8e[_0x0fff('0x42')],function(_0x50f302){var _0x4fc7c7={};_0x4fc7c7[_0x50f302]={'$like':'%'+_0x2ba884[_0x0fff('0x3f')]['filter']+'%'};return _0x4fc7c7;})});}_0x15ab8e=_[_0x0fff('0x4c')]({},_0x15ab8e,_0x2ba884[_0x0fff('0x56')]);return db['CmHopper']['count']({'where':_0x15ab8e[_0x0fff('0x4b')]})[_0x0fff('0x27')](function(_0x1daac3){_0x41c7a8[_0x0fff('0x1f')]=_0x1daac3;if(_0x2ba884['query'][_0x0fff('0x4f')]){_0x15ab8e['include']=[{'all':!![]}];}return db[_0x0fff('0x66')][_0x0fff('0x67')](_0x15ab8e);})[_0x0fff('0x27')](function(_0x5a6a66){_0x41c7a8['rows']=_0x5a6a66;return _0x41c7a8;});}})['then'](respondWithFilteredResult(_0xa97b12,_0x15ab8e))[_0x0fff('0x52')](handleError(_0xa97b12,null));};exports['getHopperHistories']=function(_0x14966c,_0x348bf4,_0x12d309){var _0x2c7c12={'raw':!![],'where':{}};var _0x152b1a={};var _0x171e29={'count':0x0,'rows':[]};return db[_0x0fff('0x4e')][_0x0fff('0x64')]({'where':{'id':_0x14966c[_0x0fff('0x54')]['id']}})[_0x0fff('0x27')](handleEntityNotFound(_0x348bf4,null))[_0x0fff('0x27')](function(_0x55a9d2){if(_0x55a9d2){_0x152b1a[_0x0fff('0x3e')]=_[_0x0fff('0x55')](db[_0x0fff('0x68')][_0x0fff('0x3c')]);_0x152b1a[_0x0fff('0x3f')]=_['keys'](_0x14966c[_0x0fff('0x3f')]);_0x152b1a[_0x0fff('0x40')]=_['intersection'](_0x152b1a[_0x0fff('0x3e')],_0x152b1a[_0x0fff('0x3f')]);_0x2c7c12[_0x0fff('0x42')]=_[_0x0fff('0x41')](_0x152b1a[_0x0fff('0x3e')],qs[_0x0fff('0x43')](_0x14966c[_0x0fff('0x3f')][_0x0fff('0x43')]));_0x2c7c12[_0x0fff('0x42')]=_0x2c7c12[_0x0fff('0x42')]['length']?_0x2c7c12[_0x0fff('0x42')]:_0x152b1a[_0x0fff('0x3e')];if(!_0x14966c[_0x0fff('0x3f')][_0x0fff('0x45')](_0x0fff('0x46'))){_0x2c7c12[_0x0fff('0x47')]=qs[_0x0fff('0x47')](_0x14966c['query'][_0x0fff('0x47')]);_0x2c7c12['offset']=qs[_0x0fff('0x20')](_0x14966c[_0x0fff('0x3f')][_0x0fff('0x20')]);}_0x2c7c12[_0x0fff('0x48')]=qs[_0x0fff('0x49')](_0x14966c['query'][_0x0fff('0x49')]);_0x2c7c12['where']=qs['filters'](_[_0x0fff('0x4a')](_0x14966c[_0x0fff('0x3f')],_0x152b1a[_0x0fff('0x40')]));_0x2c7c12[_0x0fff('0x4b')][_0x0fff('0x65')]=_0x55a9d2['id'];if(_0x14966c[_0x0fff('0x3f')]['filter']){_0x2c7c12['where']=_['merge'](_0x2c7c12[_0x0fff('0x4b')],{'$or':_[_0x0fff('0x30')](_0x2c7c12[_0x0fff('0x42')],function(_0x506156){var _0x21c6ae={};_0x21c6ae[_0x506156]={'$like':'%'+_0x14966c[_0x0fff('0x3f')][_0x0fff('0x2e')]+'%'};return _0x21c6ae;})});}_0x2c7c12=_[_0x0fff('0x4c')]({},_0x2c7c12,_0x14966c[_0x0fff('0x56')]);return db[_0x0fff('0x68')][_0x0fff('0x1f')]({'where':_0x2c7c12[_0x0fff('0x4b')]})[_0x0fff('0x27')](function(_0x453f18){_0x171e29[_0x0fff('0x1f')]=_0x453f18;if(_0x14966c[_0x0fff('0x3f')][_0x0fff('0x4f')]){_0x2c7c12['include']=[{'all':!![]}];}return db[_0x0fff('0x68')][_0x0fff('0x67')](_0x2c7c12);})[_0x0fff('0x27')](function(_0x39d3cb){_0x171e29[_0x0fff('0x51')]=_0x39d3cb;return _0x171e29;});}})[_0x0fff('0x27')](respondWithFilteredResult(_0x348bf4,_0x2c7c12))[_0x0fff('0x52')](handleError(_0x348bf4,null));};exports['getHopperFinals']=function(_0x3a99b1,_0x344877,_0x4e1039){var _0x3922b0={'raw':!![],'where':{}};var _0x5d4996={};var _0x3e926b={'count':0x0,'rows':[]};return db[_0x0fff('0x4e')]['findOne']({'where':{'id':_0x3a99b1['params']['id']}})['then'](handleEntityNotFound(_0x344877,null))[_0x0fff('0x27')](function(_0x4cc04d){if(_0x4cc04d){_0x5d4996['model']=_['keys'](db['CmHopperFinal'][_0x0fff('0x3c')]);_0x5d4996['query']=_[_0x0fff('0x55')](_0x3a99b1['query']);_0x5d4996[_0x0fff('0x40')]=_['intersection'](_0x5d4996[_0x0fff('0x3e')],_0x5d4996[_0x0fff('0x3f')]);_0x3922b0['attributes']=_['intersection'](_0x5d4996[_0x0fff('0x3e')],qs[_0x0fff('0x43')](_0x3a99b1[_0x0fff('0x3f')][_0x0fff('0x43')]));_0x3922b0[_0x0fff('0x42')]=_0x3922b0[_0x0fff('0x42')][_0x0fff('0x44')]?_0x3922b0['attributes']:_0x5d4996[_0x0fff('0x3e')];if(!_0x3a99b1[_0x0fff('0x3f')][_0x0fff('0x45')](_0x0fff('0x46'))){_0x3922b0['limit']=qs[_0x0fff('0x47')](_0x3a99b1[_0x0fff('0x3f')][_0x0fff('0x47')]);_0x3922b0['offset']=qs['offset'](_0x3a99b1[_0x0fff('0x3f')][_0x0fff('0x20')]);}_0x3922b0['order']=qs[_0x0fff('0x49')](_0x3a99b1[_0x0fff('0x3f')]['sort']);_0x3922b0[_0x0fff('0x4b')]=qs[_0x0fff('0x40')](_[_0x0fff('0x4a')](_0x3a99b1['query'],_0x5d4996['filters']));_0x3922b0[_0x0fff('0x4b')][_0x0fff('0x65')]=_0x4cc04d['id'];if(_0x3a99b1['query'][_0x0fff('0x2e')]){_0x3922b0[_0x0fff('0x4b')]=_[_0x0fff('0x4c')](_0x3922b0[_0x0fff('0x4b')],{'$or':_[_0x0fff('0x30')](_0x3922b0[_0x0fff('0x42')],function(_0x458c38){var _0x1b500a={};_0x1b500a[_0x458c38]={'$like':'%'+_0x3a99b1[_0x0fff('0x3f')][_0x0fff('0x2e')]+'%'};return _0x1b500a;})});}_0x3922b0=_[_0x0fff('0x4c')]({},_0x3922b0,_0x3a99b1[_0x0fff('0x56')]);return db['CmHopperFinal'][_0x0fff('0x1f')]({'where':_0x3922b0['where']})[_0x0fff('0x27')](function(_0x4e54cf){_0x3e926b[_0x0fff('0x1f')]=_0x4e54cf;if(_0x3a99b1[_0x0fff('0x3f')][_0x0fff('0x4f')]){_0x3922b0[_0x0fff('0x50')]=[{'all':!![]}];}return db[_0x0fff('0x69')][_0x0fff('0x67')](_0x3922b0);})['then'](function(_0x3ed560){_0x3e926b[_0x0fff('0x51')]=_0x3ed560;return _0x3e926b;});}})['then'](respondWithFilteredResult(_0x344877,_0x3922b0))[_0x0fff('0x52')](handleError(_0x344877,null));};exports['getHopperBlacks']=function(_0x47f766,_0x420b4b,_0x2e38c3){var _0x4629d9={'raw':!![],'where':{}};var _0x13c271={};var _0x1295bd={'count':0x0,'rows':[]};return db[_0x0fff('0x4e')]['findOne']({'where':{'id':_0x47f766[_0x0fff('0x54')]['id']}})[_0x0fff('0x27')](handleEntityNotFound(_0x420b4b,null))[_0x0fff('0x27')](function(_0x2c9588){if(_0x2c9588){_0x13c271[_0x0fff('0x3e')]=_['keys'](db[_0x0fff('0x6a')][_0x0fff('0x3c')]);_0x13c271[_0x0fff('0x3f')]=_[_0x0fff('0x55')](_0x47f766[_0x0fff('0x3f')]);_0x13c271[_0x0fff('0x40')]=_[_0x0fff('0x41')](_0x13c271['model'],_0x13c271['query']);_0x4629d9[_0x0fff('0x42')]=_['intersection'](_0x13c271[_0x0fff('0x3e')],qs['fields'](_0x47f766['query']['fields']));_0x4629d9[_0x0fff('0x42')]=_0x4629d9[_0x0fff('0x42')][_0x0fff('0x44')]?_0x4629d9[_0x0fff('0x42')]:_0x13c271[_0x0fff('0x3e')];if(!_0x47f766['query'][_0x0fff('0x45')](_0x0fff('0x46'))){_0x4629d9[_0x0fff('0x47')]=qs[_0x0fff('0x47')](_0x47f766[_0x0fff('0x3f')][_0x0fff('0x47')]);_0x4629d9[_0x0fff('0x20')]=qs[_0x0fff('0x20')](_0x47f766['query']['offset']);}_0x4629d9[_0x0fff('0x48')]=qs[_0x0fff('0x49')](_0x47f766[_0x0fff('0x3f')]['sort']);_0x4629d9[_0x0fff('0x4b')]=qs[_0x0fff('0x40')](_[_0x0fff('0x4a')](_0x47f766['query'],_0x13c271[_0x0fff('0x40')]));_0x4629d9[_0x0fff('0x4b')][_0x0fff('0x65')]=_0x2c9588['id'];if(_0x47f766[_0x0fff('0x3f')][_0x0fff('0x2e')]){_0x4629d9[_0x0fff('0x4b')]=_[_0x0fff('0x4c')](_0x4629d9['where'],{'$or':_['map'](_0x4629d9['attributes'],function(_0x247b3a){var _0x425412={};_0x425412[_0x247b3a]={'$like':'%'+_0x47f766[_0x0fff('0x3f')][_0x0fff('0x2e')]+'%'};return _0x425412;})});}_0x4629d9=_[_0x0fff('0x4c')]({},_0x4629d9,_0x47f766[_0x0fff('0x56')]);return db['CmHopperBlack'][_0x0fff('0x1f')]({'where':_0x4629d9[_0x0fff('0x4b')]})[_0x0fff('0x27')](function(_0x50ffc3){_0x1295bd['count']=_0x50ffc3;if(_0x47f766[_0x0fff('0x3f')]['includeAll']){_0x4629d9[_0x0fff('0x50')]=[{'all':!![]}];}return db[_0x0fff('0x6a')]['findAll'](_0x4629d9);})[_0x0fff('0x27')](function(_0x1c6b2f){_0x1295bd['rows']=_0x1c6b2f;return _0x1295bd;});}})[_0x0fff('0x27')](respondWithFilteredResult(_0x420b4b,_0x4629d9))[_0x0fff('0x52')](handleError(_0x420b4b,null));};exports[_0x0fff('0x6b')]=function(_0x443fac,_0xbf1d13,_0x2cc1cc){var _0x536b8d={};var _0x14fed3={};var _0x4fd42c;var _0xf72b2b;return db['VoiceQueue'][_0x0fff('0x64')]({'where':{'id':_0x443fac['params']['id']}})[_0x0fff('0x27')](handleEntityNotFound(_0xbf1d13,null))[_0x0fff('0x27')](function(_0x1d7516){if(_0x1d7516){_0x4fd42c=_0x1d7516;_0x14fed3['model']=_[_0x0fff('0x55')](db['Team'][_0x0fff('0x3c')]);_0x14fed3[_0x0fff('0x3f')]=_[_0x0fff('0x55')](_0x443fac['query']);_0x14fed3['filters']=_[_0x0fff('0x41')](_0x14fed3[_0x0fff('0x3e')],_0x14fed3['query']);_0x536b8d['attributes']=_[_0x0fff('0x41')](_0x14fed3[_0x0fff('0x3e')],qs[_0x0fff('0x43')](_0x443fac[_0x0fff('0x3f')][_0x0fff('0x43')]));_0x536b8d['attributes']=_0x536b8d[_0x0fff('0x42')]['length']?_0x536b8d[_0x0fff('0x42')]:_0x14fed3[_0x0fff('0x3e')];_0x536b8d[_0x0fff('0x48')]=qs[_0x0fff('0x49')](_0x443fac['query'][_0x0fff('0x49')]);_0x536b8d['where']=qs[_0x0fff('0x40')](_[_0x0fff('0x4a')](_0x443fac[_0x0fff('0x3f')],_0x14fed3[_0x0fff('0x40')]));if(_0x443fac[_0x0fff('0x3f')]['filter']){_0x536b8d['where']=_[_0x0fff('0x4c')](_0x536b8d[_0x0fff('0x4b')],{'$or':_[_0x0fff('0x30')](_0x536b8d['attributes'],function(_0xd3260){var _0x37d959={};_0x37d959[_0xd3260]={'$like':'%'+_0x443fac[_0x0fff('0x3f')]['filter']+'%'};return _0x37d959;})});}_0x536b8d=_[_0x0fff('0x4c')]({},_0x536b8d,_0x443fac['options']);return _0x4fd42c[_0x0fff('0x6b')](_0x536b8d);}})[_0x0fff('0x27')](function(_0x3df9df){if(_0x3df9df){_0xf72b2b=_0x3df9df[_0x0fff('0x44')];if(!_0x443fac[_0x0fff('0x3f')][_0x0fff('0x45')](_0x0fff('0x46'))){_0x536b8d[_0x0fff('0x47')]=qs[_0x0fff('0x47')](_0x443fac[_0x0fff('0x3f')]['limit']);_0x536b8d[_0x0fff('0x20')]=qs[_0x0fff('0x20')](_0x443fac[_0x0fff('0x3f')][_0x0fff('0x20')]);}return _0x4fd42c[_0x0fff('0x6b')](_0x536b8d);}})[_0x0fff('0x27')](function(_0x520505){if(_0x520505){return _0x520505?{'count':_0xf72b2b,'rows':_0x520505}:null;}})['then'](respondWithResult(_0xbf1d13,null))[_0x0fff('0x52')](handleError(_0xbf1d13,null));};exports['addTeams']=function(_0x80af50,_0x67b725,_0x545191){var _0x383130=_0x80af50['body'][_0x0fff('0x6c')];var _0x585315=_['map'](_0x383130,'id');return db['Team']['findAll']({'where':{'id':_0x585315},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x0fff('0x35'),_0x0fff('0x6d'),_0x0fff('0x6e'),_0x0fff('0x6f')],'raw':!![]}]})['then'](function(_0x1a9eca){if(_0x1a9eca){var _0x5c89ae=_[_0x0fff('0x70')](_0x1a9eca,function(_0x5e6692){var _0x752a12=_0x5e6692['get']({'plain':!![]});_0x752a12['Agents']['forEach'](function(_0x29b6ab){_0x29b6ab[_0x0fff('0x71')]=_[_0x0fff('0x34')](_0x383130,{'id':_0x752a12['id']})[_0x0fff('0x71')];});return _0x752a12[_0x0fff('0x72')];});return db[_0x0fff('0x4e')][_0x0fff('0x34')]({'where':{'id':_0x80af50[_0x0fff('0x54')]['id']}})[_0x0fff('0x27')](function(_0x154bb7){return db[_0x0fff('0x73')]['transaction'](function(_0x523f18){return _0x154bb7[_0x0fff('0x74')](_0x585315,{'transaction':_0x523f18})['then'](function(){return BPromise['each'](_0x5c89ae,function(_0x5dc838){return db[_0x0fff('0x75')]['findOrCreate']({'where':{'UserId':_0x5dc838['id'],'VoiceQueueId':_0x80af50[_0x0fff('0x54')]['id']},'defaults':{'penalty':_0x5dc838['penalty']},'transaction':_0x523f18});});})['then'](function(){return BPromise['each'](_[_0x0fff('0x2e')](_0x5c89ae,{'online':!![]}),function(_0xed29b9){return db[_0x0fff('0x76')][_0x0fff('0x77')]({'membername':_0xed29b9['name'],'UserId':_0xed29b9['id'],'queue_name':_0x154bb7[_0x0fff('0x35')],'VoiceQueueId':_0x154bb7['id'],'interface':_[_0x0fff('0x78')](_0xed29b9[_0x0fff('0x6f')])?util[_0x0fff('0x79')]('SIP/%s',_0xed29b9[_0x0fff('0x35')]):_0xed29b9[_0x0fff('0x6f')],'paused':_0xed29b9[_0x0fff('0x6e')]||![],'penalty':_0xed29b9['penalty']},{'transaction':_0x523f18});});})[_0x0fff('0x27')](function(){_0x5c89ae['forEach'](function(_0x274bcd){socket[_0x0fff('0x7a')](_0x0fff('0x7b'),{'UserId':_0x274bcd['id'],'VoiceQueueId':_0x154bb7['id']});});});});});}})[_0x0fff('0x27')](respondWithStatusCode(_0x67b725,null))['catch'](handleError(_0x67b725,null));};exports[_0x0fff('0x7c')]=function(_0x4f625d,_0x2bb5f4,_0x31f36d){return db[_0x0fff('0x7d')][_0x0fff('0x67')]({'where':{'id':_0x4f625d[_0x0fff('0x3f')][_0x0fff('0x7e')]},'attributes':['id'],'include':[{'model':db[_0x0fff('0x7f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0fff('0x27')](handleEntityNotFound(_0x2bb5f4,null))[_0x0fff('0x27')](function(_0x4ab77d){var _0x1fcee9=_[_0x0fff('0x30')](_0x4ab77d,'id');var _0x161de0=[];var _0x28c06a=[];var _0x27e716=squel[_0x0fff('0x80')]();_0x27e716[_0x0fff('0x81')]('tq.TeamId')['from'](_0x0fff('0x82'),'tq')['join'](_0x0fff('0x83'),'ut',_0x0fff('0x84'))[_0x0fff('0x4b')](_0x0fff('0x85'),_0x4f625d[_0x0fff('0x54')]['id']);for(var _0x2eeb15=0x0;_0x2eeb15<_0x4ab77d[_0x0fff('0x44')];_0x2eeb15+=0x1){let _0x2746d2=_0x4ab77d[_0x2eeb15];for(var _0x288f9e=0x0;_0x288f9e<_0x2746d2[_0x0fff('0x72')][_0x0fff('0x44')];_0x288f9e+=0x1){let _0x231d44=_0x2746d2[_0x0fff('0x72')][_0x288f9e];var _0x1f3a7b=_0x27e716['clone']();_0x1f3a7b[_0x0fff('0x4b')](_0x0fff('0x86'),_0x231d44['id']);_0x28c06a[_0x0fff('0x87')](db[_0x0fff('0x73')][_0x0fff('0x3f')](_0x1f3a7b[_0x0fff('0x88')](),{'type':db['sequelize'][_0x0fff('0x89')][_0x0fff('0x8a')]})[_0x0fff('0x27')](function(_0x2bbdd7){if(_0x2bbdd7['length']===0x1){return _0x231d44['id'];}else{var _0x4dddeb=_[_0x0fff('0x8b')](_[_0x0fff('0x30')](_0x2bbdd7,_0x0fff('0x8c')),function(_0x269270){return _['includes'](_0x1fcee9,_0x269270);});if(_0x4dddeb){return _0x231d44['id'];}}}));}}return BPromise['all'](_0x28c06a)[_0x0fff('0x27')](function(_0x427c5e){_0x161de0=_(_0x161de0)[_0x0fff('0x8d')](_0x427c5e)[_0x0fff('0x8e')]()['value']();return db[_0x0fff('0x4e')][_0x0fff('0x34')]({'where':{'id':_0x4f625d[_0x0fff('0x54')]['id']}})[_0x0fff('0x27')](function(_0x594550){return db[_0x0fff('0x73')][_0x0fff('0x8f')](function(_0x2b685f){return _0x594550[_0x0fff('0x7c')](_0x4f625d['query']['ids'],{'transaction':_0x2b685f})[_0x0fff('0x27')](function(){if(!_[_0x0fff('0x90')](_0x161de0)){return _0x594550['removeAgents'](_0x161de0,{'transaction':_0x2b685f})[_0x0fff('0x27')](function(){return db[_0x0fff('0x76')][_0x0fff('0x28')]({'where':{'VoiceQueueId':_0x4f625d['params']['id'],'UserId':_0x161de0},'transaction':_0x2b685f});});}})[_0x0fff('0x27')](function(){_0x161de0['forEach'](function(_0x151d0a){socket['emit'](_0x0fff('0x91'),{'UserId':_0x151d0a,'VoiceQueueId':_0x594550['id']});});});});});});})[_0x0fff('0x27')](respondWithStatusCode(_0x2bb5f4,null))[_0x0fff('0x52')](handleError(_0x2bb5f4,null));};exports[_0x0fff('0x92')]=function(_0x4f5c80,_0x506e95,_0x4edf3b){var _0x560dfc,_0xa26efc;return db[_0x0fff('0x4e')][_0x0fff('0x34')]({'where':{'id':_0x4f5c80[_0x0fff('0x54')]['id']}})[_0x0fff('0x27')](handleEntityNotFound(_0x506e95,null))[_0x0fff('0x27')](function(_0x4b26ea){if(_0x4b26ea){_0xa26efc=_0x4b26ea;return _0x4b26ea[_0x0fff('0x92')](_0x4f5c80[_0x0fff('0x58')]['ids'],_[_0x0fff('0x61')](_0x4f5c80[_0x0fff('0x58')],[_0x0fff('0x7e'),'id'])||{})[_0x0fff('0x93')](function(_0x4cab57){for(var _0x487086=0x0;_0x487086<_0x4f5c80['body'][_0x0fff('0x7e')][_0x0fff('0x44')];_0x487086+=0x1){socket[_0x0fff('0x7a')](_0x0fff('0x7b'),{'UserId':_0x4f5c80[_0x0fff('0x58')]['ids'][_0x487086],'VoiceQueueId':_0x4f5c80['params']['id']});}return _0x4cab57;});}})[_0x0fff('0x27')](function(_0x534355){_0x560dfc=_0x534355||[];if(_0xa26efc){return db['User'][_0x0fff('0x67')]({'where':{'id':_0x4f5c80[_0x0fff('0x58')][_0x0fff('0x7e')]},'attributes':['id',_0x0fff('0x35'),'online','voicePause',_0x0fff('0x6f')],'raw':!![]});}})[_0x0fff('0x27')](function(_0x3f0aab){if(!_[_0x0fff('0x90')](_0x3f0aab)){var _0x1ccc53=[];for(var _0x5e5dfd=0x0;_0x5e5dfd<_0x3f0aab[_0x0fff('0x44')];_0x5e5dfd++){if(_0x3f0aab[_0x5e5dfd][_0x0fff('0x6d')]){_0x1ccc53[_0x0fff('0x87')](db[_0x0fff('0x76')][_0x0fff('0x77')]({'membername':_0x3f0aab[_0x5e5dfd][_0x0fff('0x35')],'UserId':_0x3f0aab[_0x5e5dfd]['id'],'queue_name':_0xa26efc[_0x0fff('0x35')],'VoiceQueueId':_0xa26efc['id'],'interface':_['isNil'](_0x3f0aab[_0x5e5dfd]['interface'])?util[_0x0fff('0x79')](_0x0fff('0x94'),_0x3f0aab[_0x5e5dfd][_0x0fff('0x35')]):_0x3f0aab[_0x5e5dfd][_0x0fff('0x6f')],'paused':_0x3f0aab[_0x5e5dfd][_0x0fff('0x6e')]||![],'penalty':_0x4f5c80['body'][_0x0fff('0x71')]||0x0}));}}return BPromise['all'](_0x1ccc53);}})[_0x0fff('0x27')](function(){return _0x560dfc;})['then'](respondWithResult(_0x506e95,null))[_0x0fff('0x52')](handleError(_0x506e95,null));};exports[_0x0fff('0x95')]=function(_0x1132b4,_0x9ba0cd,_0x5c1a85){return db[_0x0fff('0x4e')]['find']({'where':{'id':_0x1132b4[_0x0fff('0x54')]['id']}})[_0x0fff('0x27')](handleEntityNotFound(_0x9ba0cd,null))[_0x0fff('0x27')](function(_0x2a5259){if(_0x2a5259){return _0x2a5259['removeAgents'](_0x1132b4[_0x0fff('0x3f')][_0x0fff('0x7e')])[_0x0fff('0x27')](function(){if(_[_0x0fff('0x96')](_0x1132b4[_0x0fff('0x3f')][_0x0fff('0x7e')])){for(var _0x4f1bbc=0x0;_0x4f1bbc<_0x1132b4[_0x0fff('0x3f')][_0x0fff('0x7e')][_0x0fff('0x44')];_0x4f1bbc+=0x1){socket[_0x0fff('0x7a')](_0x0fff('0x91'),{'UserId':Number(_0x1132b4['query'][_0x0fff('0x7e')][_0x4f1bbc]),'VoiceQueueId':Number(_0x1132b4[_0x0fff('0x54')]['id'])});}}else{socket[_0x0fff('0x7a')](_0x0fff('0x91'),{'UserId':Number(_0x1132b4['query'][_0x0fff('0x7e')]),'VoiceQueueId':Number(_0x1132b4[_0x0fff('0x54')]['id'])});}});}})[_0x0fff('0x27')](function(_0x4e820a){return db[_0x0fff('0x76')][_0x0fff('0x28')]({'where':{'VoiceQueueId':_0x1132b4[_0x0fff('0x54')]['id'],'UserId':_0x1132b4[_0x0fff('0x3f')][_0x0fff('0x7e')]}})[_0x0fff('0x27')](function(){return _0x4e820a;});})['then'](respondWithStatusCode(_0x9ba0cd,null))[_0x0fff('0x52')](handleError(_0x9ba0cd,null));};exports[_0x0fff('0x97')]=function(_0xb5d949,_0xd175e5,_0x2a3eae){var _0x51bcff={};var _0x42fb84={};var _0x386dce;var _0x379400;return db[_0x0fff('0x4e')][_0x0fff('0x64')]({'where':{'id':_0xb5d949[_0x0fff('0x54')]['id']}})[_0x0fff('0x27')](handleEntityNotFound(_0xd175e5,null))[_0x0fff('0x27')](function(_0x46a684){if(_0x46a684){_0x386dce=_0x46a684;_0x42fb84[_0x0fff('0x3e')]=_[_0x0fff('0x55')](db[_0x0fff('0x7f')][_0x0fff('0x3c')]);_0x42fb84[_0x0fff('0x3f')]=_['keys'](_0xb5d949[_0x0fff('0x3f')]);_0x42fb84['filters']=_[_0x0fff('0x41')](_0x42fb84[_0x0fff('0x3e')],_0x42fb84[_0x0fff('0x3f')]);_0x51bcff[_0x0fff('0x42')]=_[_0x0fff('0x41')](_0x42fb84[_0x0fff('0x3e')],qs['fields'](_0xb5d949['query'][_0x0fff('0x43')]));_0x51bcff[_0x0fff('0x42')]=_0x51bcff[_0x0fff('0x42')][_0x0fff('0x44')]?_0x51bcff[_0x0fff('0x42')]:_0x42fb84[_0x0fff('0x3e')];_0x51bcff[_0x0fff('0x48')]=qs['sort'](_0xb5d949[_0x0fff('0x3f')][_0x0fff('0x49')]);_0x51bcff[_0x0fff('0x4b')]=qs[_0x0fff('0x40')](_['pick'](_0xb5d949['query'],_0x42fb84['filters']));if(_0xb5d949[_0x0fff('0x3f')]['filter']){_0x51bcff[_0x0fff('0x4b')]=_[_0x0fff('0x4c')](_0x51bcff[_0x0fff('0x4b')],{'$or':_['map'](_0x51bcff['attributes'],function(_0x475a5e){var _0xb3528c={};_0xb3528c[_0x475a5e]={'$like':'%'+_0xb5d949[_0x0fff('0x3f')]['filter']+'%'};return _0xb3528c;})});}_0x51bcff=_[_0x0fff('0x4c')]({},_0x51bcff,_0xb5d949['options']);return _0x386dce[_0x0fff('0x97')](_0x51bcff);}})[_0x0fff('0x27')](function(_0x8072d2){if(_0x8072d2){_0x379400=_0x8072d2[_0x0fff('0x44')];if(!_0xb5d949[_0x0fff('0x3f')][_0x0fff('0x45')](_0x0fff('0x46'))){_0x51bcff['limit']=qs[_0x0fff('0x47')](_0xb5d949[_0x0fff('0x3f')]['limit']);_0x51bcff[_0x0fff('0x20')]=qs[_0x0fff('0x20')](_0xb5d949[_0x0fff('0x3f')]['offset']);}return _0x386dce[_0x0fff('0x97')](_0x51bcff);}})[_0x0fff('0x27')](function(_0x2f102c){if(_0x2f102c){return _0x2f102c?{'count':_0x379400,'rows':_0x2f102c}:null;}})['then'](respondWithResult(_0xd175e5,null))[_0x0fff('0x52')](handleError(_0xd175e5,null));};exports[_0x0fff('0x98')]=function(_0x4f6866,_0x4644d6,_0x589061){var _0x2fe337={};var _0x11197a={};var _0x2426e5;var _0x3cb506;return db[_0x0fff('0x4e')][_0x0fff('0x64')]({'where':{'id':_0x4f6866[_0x0fff('0x54')]['id']}})[_0x0fff('0x27')](handleEntityNotFound(_0x4644d6,null))[_0x0fff('0x27')](function(_0x447de2){if(_0x447de2){_0x2426e5=_0x447de2;_0x11197a[_0x0fff('0x3e')]=_[_0x0fff('0x55')](db[_0x0fff('0x76')][_0x0fff('0x3c')]);_0x11197a[_0x0fff('0x3f')]=_[_0x0fff('0x55')](_0x4f6866[_0x0fff('0x3f')]);_0x11197a['filters']=_[_0x0fff('0x41')](_0x11197a[_0x0fff('0x3e')],_0x11197a[_0x0fff('0x3f')]);_0x2fe337['attributes']=_[_0x0fff('0x41')](_0x11197a['model'],qs[_0x0fff('0x43')](_0x4f6866[_0x0fff('0x3f')]['fields']));_0x2fe337[_0x0fff('0x42')]=_0x2fe337[_0x0fff('0x42')]['length']?_0x2fe337[_0x0fff('0x42')]:_0x11197a[_0x0fff('0x3e')];_0x2fe337[_0x0fff('0x48')]=qs[_0x0fff('0x49')](_0x4f6866['query'][_0x0fff('0x49')]);_0x2fe337['where']=qs[_0x0fff('0x40')](_['pick'](_0x4f6866[_0x0fff('0x3f')],_0x11197a['filters']));if(_0x4f6866[_0x0fff('0x3f')][_0x0fff('0x2e')]){_0x2fe337[_0x0fff('0x4b')]=_[_0x0fff('0x4c')](_0x2fe337[_0x0fff('0x4b')],{'$or':_[_0x0fff('0x30')](_0x2fe337[_0x0fff('0x42')],function(_0x2c1895){var _0x4294c1={};_0x4294c1[_0x2c1895]={'$like':'%'+_0x4f6866['query']['filter']+'%'};return _0x4294c1;})});}_0x2fe337=_[_0x0fff('0x4c')]({},_0x2fe337,_0x4f6866['options']);return _0x2426e5['getMembers'](_0x2fe337);}})['then'](function(_0x3f5bc3){if(_0x3f5bc3){_0x3cb506=_0x3f5bc3[_0x0fff('0x44')];if(!_0x4f6866[_0x0fff('0x3f')]['hasOwnProperty']('nolimit')){_0x2fe337[_0x0fff('0x47')]=qs[_0x0fff('0x47')](_0x4f6866['query'][_0x0fff('0x47')]);_0x2fe337[_0x0fff('0x20')]=qs[_0x0fff('0x20')](_0x4f6866[_0x0fff('0x3f')][_0x0fff('0x20')]);}return _0x2426e5[_0x0fff('0x98')](_0x2fe337);}})['then'](function(_0x2d0627){return _0x2d0627?{'count':_0x3cb506,'rows':_0x2d0627}:null;})[_0x0fff('0x27')](respondWithResult(_0x4644d6,null))[_0x0fff('0x52')](handleError(_0x4644d6,null));};exports[_0x0fff('0x99')]=function(_0x2e2705,_0x10225b,_0x701741){var _0x273d66={};var _0x4893a6={};var _0x2846c3;var _0x483e52;return db[_0x0fff('0x4e')][_0x0fff('0x64')]({'where':{'id':_0x2e2705[_0x0fff('0x54')]['id']}})[_0x0fff('0x27')](handleEntityNotFound(_0x10225b,null))[_0x0fff('0x27')](function(_0x569518){if(_0x569518){_0x2846c3=_0x569518;_0x4893a6[_0x0fff('0x3e')]=_[_0x0fff('0x55')](db[_0x0fff('0x9a')][_0x0fff('0x3c')]);_0x4893a6[_0x0fff('0x3f')]=_[_0x0fff('0x55')](_0x2e2705[_0x0fff('0x3f')]);_0x4893a6[_0x0fff('0x40')]=_[_0x0fff('0x41')](_0x4893a6[_0x0fff('0x3e')],_0x4893a6[_0x0fff('0x3f')]);_0x273d66[_0x0fff('0x42')]=_['intersection'](_0x4893a6[_0x0fff('0x3e')],qs['fields'](_0x2e2705['query'][_0x0fff('0x43')]));_0x273d66['attributes']=_0x273d66[_0x0fff('0x42')][_0x0fff('0x44')]?_0x273d66[_0x0fff('0x42')]:_0x4893a6[_0x0fff('0x3e')];_0x273d66[_0x0fff('0x48')]=qs[_0x0fff('0x49')](_0x2e2705[_0x0fff('0x3f')]['sort']);_0x273d66[_0x0fff('0x4b')]=qs[_0x0fff('0x40')](_['pick'](_0x2e2705[_0x0fff('0x3f')],_0x4893a6['filters']));if(_0x2e2705[_0x0fff('0x3f')][_0x0fff('0x2e')]){_0x273d66[_0x0fff('0x4b')]=_['merge'](_0x273d66['where'],{'$or':_[_0x0fff('0x30')](_0x273d66[_0x0fff('0x42')],function(_0x57fce2){var _0x2d1a0d={};_0x2d1a0d[_0x57fce2]={'$like':'%'+_0x2e2705['query'][_0x0fff('0x2e')]+'%'};return _0x2d1a0d;})});}_0x273d66=_[_0x0fff('0x4c')]({},_0x273d66,_0x2e2705[_0x0fff('0x56')]);return _0x2846c3[_0x0fff('0x99')](_0x273d66);}})[_0x0fff('0x27')](function(_0x321c90){if(_0x321c90){_0x483e52=_0x321c90[_0x0fff('0x44')];if(!_0x2e2705['query'][_0x0fff('0x45')](_0x0fff('0x46'))){_0x273d66['limit']=qs[_0x0fff('0x47')](_0x2e2705[_0x0fff('0x3f')][_0x0fff('0x47')]);_0x273d66['offset']=qs[_0x0fff('0x20')](_0x2e2705['query']['offset']);}return _0x2846c3[_0x0fff('0x99')](_0x273d66);}})[_0x0fff('0x27')](function(_0x333172){if(_0x333172){return _0x333172?{'count':_0x483e52,'rows':_0x333172}:null;}})['then'](respondWithResult(_0x10225b,null))['catch'](handleError(_0x10225b,null));};exports[_0x0fff('0x9b')]=function(_0x5d9286,_0x2f921d,_0x5b7ff8){var _0x540fb5,_0x33c43d;return db[_0x0fff('0x4e')]['find']({'where':{'id':_0x5d9286[_0x0fff('0x54')]['id']}})[_0x0fff('0x27')](handleEntityNotFound(_0x2f921d,null))[_0x0fff('0x27')](function(_0x2da0a4){if(_0x2da0a4){_0x33c43d=_0x2da0a4;return _0x2da0a4[_0x0fff('0x9b')](_0x5d9286['body'][_0x0fff('0x7e')],_[_0x0fff('0x61')](_0x5d9286[_0x0fff('0x58')],['ids','id'])||{});}return null;})['spread'](function(_0x9f0fda){var _0x5c6408;_0x540fb5=_0x9f0fda||[];var _0x3ffca3=[];if(_0x9f0fda){for(var _0x53b6f9=0x0;_0x53b6f9<_0x9f0fda['length'];_0x53b6f9+=0x1){var _0x4f614b=_0x9f0fda[_0x53b6f9][_0x0fff('0x29')]({'plain':!![]});_0x33c43d[_0x0fff('0x9c')]=_0x5d9286['body']['dialCheckDuplicateType']?_0x5d9286[_0x0fff('0x58')]['dialCheckDuplicateType']:_0x33c43d[_0x0fff('0x9c')];switch(_0x33c43d[_0x0fff('0x9c')]){case _0x0fff('0x9d'):_0x5c6408=squel['insert']()['into'](_0x0fff('0x9e'))[_0x0fff('0x9f')]([_0x0fff('0xa0'),_0x0fff('0xa1'),_0x0fff('0xa2'),_0x0fff('0xa3'),_0x0fff('0x65'),'createdAt',_0x0fff('0xa4')],squel['select']()[_0x0fff('0x81')](_0x0fff('0xa0'),_0x0fff('0xa0'))[_0x0fff('0x81')](_0x0fff('0xa5'),_0x0fff('0xa1'))[_0x0fff('0x81')]('id',_0x0fff('0xa2'))['field'](_0x4f614b[_0x0fff('0xa6')][_0x0fff('0x88')](),_0x0fff('0xa3'))[_0x0fff('0x81')](_0x5d9286[_0x0fff('0x54')]['id'][_0x0fff('0x88')](),_0x0fff('0x65'))[_0x0fff('0x81')]('NOW()',_0x0fff('0x60'))[_0x0fff('0x81')](_0x0fff('0xa5'),_0x0fff('0xa4'))[_0x0fff('0xa7')](_0x0fff('0xa8'))['where'](_0x0fff('0xa9'))['where'](_0x0fff('0xaa'),_0x4f614b[_0x0fff('0xa6')]['toString']())['where'](_0x0fff('0xab'))[_0x0fff('0x4b')](_0x0fff('0xac'),squel['select']()['field'](_0x0fff('0xad'))[_0x0fff('0xa7')](_0x0fff('0xae'))[_0x0fff('0x4b')](_0x0fff('0x85'),_0x5d9286[_0x0fff('0x54')]['id'][_0x0fff('0x88')]()))['where'](_0x0fff('0xac'),squel[_0x0fff('0x80')]()[_0x0fff('0x81')](_0x0fff('0xaf'))[_0x0fff('0xa7')](_0x0fff('0x9e'))['where'](_0x0fff('0x85'),_0x5d9286[_0x0fff('0x54')]['id']['toString']())))[_0x0fff('0x88')]();break;case _0x0fff('0xb0'):_0x5c6408=squel[_0x0fff('0xb1')]()['into']('cm_hopper')['fromQuery']([_0x0fff('0xa0'),_0x0fff('0xa1'),_0x0fff('0xa2'),'ListId','VoiceQueueId','createdAt',_0x0fff('0xa4')],squel[_0x0fff('0x80')]()[_0x0fff('0x81')](_0x0fff('0xa0'),_0x0fff('0xa0'))[_0x0fff('0x81')](_0x0fff('0xa5'),_0x0fff('0xa1'))[_0x0fff('0x81')]('id',_0x0fff('0xa2'))['field'](_0x4f614b[_0x0fff('0xa6')]['toString'](),'ListId')[_0x0fff('0x81')](_0x5d9286[_0x0fff('0x54')]['id'][_0x0fff('0x88')](),_0x0fff('0x65'))[_0x0fff('0x81')](_0x0fff('0xa5'),'createdAt')[_0x0fff('0x81')](_0x0fff('0xa5'),_0x0fff('0xa4'))['from'](_0x0fff('0xa8'))[_0x0fff('0x4b')]('deletedAt\x20IS\x20NULL')[_0x0fff('0x4b')]('ListId\x20=\x20?',_0x4f614b[_0x0fff('0xa6')][_0x0fff('0x88')]())['where'](_0x0fff('0xab'))[_0x0fff('0x4b')](_0x0fff('0xac'),squel[_0x0fff('0x80')]()['field'](_0x0fff('0xaf'))[_0x0fff('0xa7')](_0x0fff('0x9e'))[_0x0fff('0x4b')](_0x0fff('0x85'),_0x5d9286['params']['id'][_0x0fff('0x88')]())))[_0x0fff('0x88')]();break;default:_0x5c6408=squel['insert']()[_0x0fff('0xb2')](_0x0fff('0x9e'))['fromQuery']([_0x0fff('0xa0'),_0x0fff('0xa1'),_0x0fff('0xa2'),_0x0fff('0xa3'),_0x0fff('0x65'),'createdAt',_0x0fff('0xa4')],squel[_0x0fff('0x80')]()['field'](_0x0fff('0xa0'),_0x0fff('0xa0'))[_0x0fff('0x81')](_0x0fff('0xa5'),'scheduledAt')['field']('id','ContactId')[_0x0fff('0x81')](_0x4f614b[_0x0fff('0xa6')]['toString'](),_0x0fff('0xa3'))[_0x0fff('0x81')](_0x5d9286[_0x0fff('0x54')]['id'][_0x0fff('0x88')](),'VoiceQueueId')[_0x0fff('0x81')](_0x0fff('0xa5'),_0x0fff('0x60'))[_0x0fff('0x81')](_0x0fff('0xa5'),_0x0fff('0xa4'))[_0x0fff('0xa7')](_0x0fff('0xa8'))['where'](_0x0fff('0xa9'))['where']('ListId\x20=\x20?',_0x4f614b['CmListId'][_0x0fff('0x88')]())[_0x0fff('0x4b')](_0x0fff('0xab')))[_0x0fff('0x88')]();}_0x3ffca3['push'](db[_0x0fff('0x73')][_0x0fff('0x3f')](_0x5c6408));}return BPromise[_0x0fff('0xb3')](_0x3ffca3);}})['then'](function(){return _0x540fb5;})[_0x0fff('0x27')](respondWithResult(_0x2f921d,null))['catch'](handleError(_0x2f921d,null));};exports[_0x0fff('0xb4')]=function(_0x1ae0d0,_0x1be2e5,_0x108ea7){return db[_0x0fff('0x4e')][_0x0fff('0x34')]({'where':{'id':_0x1ae0d0[_0x0fff('0x54')]['id']}})[_0x0fff('0x27')](handleEntityNotFound(_0x1be2e5,null))['then'](function(_0x6e1d27){if(_0x6e1d27){return _0x6e1d27[_0x0fff('0xb4')](_0x1ae0d0[_0x0fff('0x3f')]['ids']);}})[_0x0fff('0x27')](function(_0x344ee3){if(_0x344ee3){return db[_0x0fff('0x66')][_0x0fff('0x28')]({'where':{'ListId':_0x1ae0d0[_0x0fff('0x3f')][_0x0fff('0x7e')],'VoiceQueueId':_0x1ae0d0['params']['id']}})[_0x0fff('0x27')](function(){return _0x344ee3;});}})['then'](respondWithStatusCode(_0x1be2e5,null))[_0x0fff('0x52')](handleError(_0x1be2e5,null));};exports[_0x0fff('0xb5')]=function(_0x4f2c8f,_0x12368b,_0x2be9b6){var _0x5209ca={};var _0x487d9b={};var _0x104e44;var _0x487173;return db['VoiceQueue'][_0x0fff('0x64')]({'where':{'id':_0x4f2c8f[_0x0fff('0x54')]['id']}})['then'](handleEntityNotFound(_0x12368b,null))[_0x0fff('0x27')](function(_0x399a6a){if(_0x399a6a){_0x104e44=_0x399a6a;_0x487d9b[_0x0fff('0x3e')]=_[_0x0fff('0x55')](db[_0x0fff('0x9a')][_0x0fff('0x3c')]);_0x487d9b[_0x0fff('0x3f')]=_['keys'](_0x4f2c8f[_0x0fff('0x3f')]);_0x487d9b[_0x0fff('0x40')]=_[_0x0fff('0x41')](_0x487d9b[_0x0fff('0x3e')],_0x487d9b['query']);_0x5209ca[_0x0fff('0x42')]=_[_0x0fff('0x41')](_0x487d9b[_0x0fff('0x3e')],qs['fields'](_0x4f2c8f[_0x0fff('0x3f')][_0x0fff('0x43')]));_0x5209ca[_0x0fff('0x42')]=_0x5209ca[_0x0fff('0x42')][_0x0fff('0x44')]?_0x5209ca['attributes']:_0x487d9b[_0x0fff('0x3e')];_0x5209ca['order']=qs['sort'](_0x4f2c8f['query'][_0x0fff('0x49')]);_0x5209ca[_0x0fff('0x4b')]=qs[_0x0fff('0x40')](_[_0x0fff('0x4a')](_0x4f2c8f[_0x0fff('0x3f')],_0x487d9b[_0x0fff('0x40')]));if(_0x4f2c8f[_0x0fff('0x3f')]['filter']){_0x5209ca[_0x0fff('0x4b')]=_['merge'](_0x5209ca['where'],{'$or':_[_0x0fff('0x30')](_0x5209ca[_0x0fff('0x42')],function(_0x5e4ede){var _0x19f8ef={};_0x19f8ef[_0x5e4ede]={'$like':'%'+_0x4f2c8f[_0x0fff('0x3f')][_0x0fff('0x2e')]+'%'};return _0x19f8ef;})});}_0x5209ca=_[_0x0fff('0x4c')]({},_0x5209ca,_0x4f2c8f[_0x0fff('0x56')]);return _0x104e44['getBlackLists'](_0x5209ca);}})[_0x0fff('0x27')](function(_0x23774a){if(_0x23774a){_0x487173=_0x23774a[_0x0fff('0x44')];if(!_0x4f2c8f[_0x0fff('0x3f')][_0x0fff('0x45')](_0x0fff('0x46'))){_0x5209ca[_0x0fff('0x47')]=qs[_0x0fff('0x47')](_0x4f2c8f['query'][_0x0fff('0x47')]);_0x5209ca[_0x0fff('0x20')]=qs[_0x0fff('0x20')](_0x4f2c8f['query']['offset']);}return _0x104e44['getBlackLists'](_0x5209ca);}})[_0x0fff('0x27')](function(_0x114e3d){if(_0x114e3d){return _0x114e3d?{'count':_0x487173,'rows':_0x114e3d}:null;}})[_0x0fff('0x27')](respondWithResult(_0x12368b,null))[_0x0fff('0x52')](handleError(_0x12368b,null));};exports[_0x0fff('0xb6')]=function(_0x30844b,_0x89eb44,_0x52f36f){var _0x439b55,_0x294e20;return db[_0x0fff('0x4e')][_0x0fff('0x34')]({'where':{'id':_0x30844b[_0x0fff('0x54')]['id']}})[_0x0fff('0x27')](handleEntityNotFound(_0x89eb44,null))[_0x0fff('0x27')](function(_0x313933){if(_0x313933){_0x294e20=_0x313933;return _0x313933[_0x0fff('0xb6')](_0x30844b[_0x0fff('0x58')]['ids'],_[_0x0fff('0x61')](_0x30844b[_0x0fff('0x58')],['ids','id'])||{});}return null;})[_0x0fff('0x93')](function(_0x539e31){var _0x402533;_0x439b55=_0x539e31||[];var _0x1790cd=[];if(_0x539e31){for(var _0x41feb4=0x0;_0x41feb4<_0x539e31[_0x0fff('0x44')];_0x41feb4+=0x1){var _0x271f00=_0x539e31[_0x41feb4]['get']({'plain':!![]});_0x402533=squel[_0x0fff('0xb1')]()[_0x0fff('0xb2')](_0x0fff('0xb7'))['fromQuery'](['phone',_0x0fff('0xa2'),_0x0fff('0xa3'),_0x0fff('0x65'),_0x0fff('0x60'),_0x0fff('0xa4')],squel[_0x0fff('0x80')]()[_0x0fff('0x81')]('phone',_0x0fff('0xa0'))[_0x0fff('0x81')]('id','ContactId')[_0x0fff('0x81')](_0x271f00['CmListId'][_0x0fff('0x88')](),'ListId')['field'](_0x30844b[_0x0fff('0x54')]['id'][_0x0fff('0x88')](),_0x0fff('0x65'))[_0x0fff('0x81')](_0x0fff('0xa5'),_0x0fff('0x60'))[_0x0fff('0x81')]('NOW()',_0x0fff('0xa4'))[_0x0fff('0xa7')](_0x0fff('0xa8'))[_0x0fff('0x4b')](_0x0fff('0xa9'))['where'](_0x0fff('0xaa'),_0x271f00[_0x0fff('0xa6')][_0x0fff('0x88')]())['where'](_0x0fff('0xab')))['toString']();_0x1790cd[_0x0fff('0x87')](db[_0x0fff('0x73')][_0x0fff('0x3f')](_0x402533));}return BPromise[_0x0fff('0xb3')](_0x1790cd);}})[_0x0fff('0x27')](function(){return _0x439b55;})[_0x0fff('0x27')](respondWithResult(_0x89eb44,null))['catch'](handleError(_0x89eb44,null));};exports[_0x0fff('0xb8')]=function(_0xd3fbb3,_0x27c2dd,_0x420fef){return db[_0x0fff('0x4e')]['find']({'where':{'id':_0xd3fbb3[_0x0fff('0x54')]['id']}})[_0x0fff('0x27')](handleEntityNotFound(_0x27c2dd,null))['then'](function(_0xcb2661){if(_0xcb2661){return _0xcb2661[_0x0fff('0xb8')](_0xd3fbb3[_0x0fff('0x3f')][_0x0fff('0x7e')]);}})[_0x0fff('0x27')](function(_0x38f3e2){if(_0x38f3e2){return db[_0x0fff('0x6a')][_0x0fff('0x28')]({'where':{'ListId':_0xd3fbb3['query']['ids'],'VoiceQueueId':_0xd3fbb3[_0x0fff('0x54')]['id']}})[_0x0fff('0x27')](function(){return _0x38f3e2;});}})[_0x0fff('0x27')](respondWithStatusCode(_0x27c2dd,null))[_0x0fff('0x52')](handleError(_0x27c2dd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index a10a998..5b6616f 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 _0x0b9c=['exports','events','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x0b9c,0x169));var _0xc0b9=function(_0x26b7fa,_0x48a0fd){_0x26b7fa=_0x26b7fa-0x0;var _0x53ba3d=_0x0b9c[_0x26b7fa];return _0x53ba3d;};'use strict';var EventEmitter=require(_0xc0b9('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xc0b9('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xc0b9('0x2')](0x0);var events={'afterCreate':_0xc0b9('0x3'),'afterUpdate':_0xc0b9('0x4'),'afterDestroy':_0xc0b9('0x5')};function emitEvent(_0x55acf7){return function(_0x41ed26,_0x19f7ca,_0x4bb4bc){VoiceQueueEvents[_0xc0b9('0x6')](_0x55acf7+':'+_0x41ed26['id'],_0x41ed26);VoiceQueueEvents[_0xc0b9('0x6')](_0x55acf7,_0x41ed26);_0x4bb4bc(null);};}for(var e in events){if(events[_0xc0b9('0x7')](e)){var event=events[e];VoiceQueue[_0xc0b9('0x8')](e,emitEvent(event));}}module[_0xc0b9('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xadc4=['hook','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit'];(function(_0x6ed779,_0x35abd1){var _0x2a5d72=function(_0x22e4d6){while(--_0x22e4d6){_0x6ed779['push'](_0x6ed779['shift']());}};_0x2a5d72(++_0x35abd1);}(_0xadc4,0xe2));var _0x4adc=function(_0x31e803,_0x4171b0){_0x31e803=_0x31e803-0x0;var _0x24e60a=_0xadc4[_0x31e803];return _0x24e60a;};'use strict';var EventEmitter=require(_0x4adc('0x0'));var VoiceQueue=require(_0x4adc('0x1'))['db'][_0x4adc('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4adc('0x3')](0x0);var events={'afterCreate':_0x4adc('0x4'),'afterUpdate':_0x4adc('0x5'),'afterDestroy':_0x4adc('0x6')};function emitEvent(_0x200d17){return function(_0x5e7f09,_0x56ee40,_0xbf62ae){VoiceQueueEvents[_0x4adc('0x7')](_0x200d17+':'+_0x5e7f09['id'],_0x5e7f09);VoiceQueueEvents[_0x4adc('0x7')](_0x200d17,_0x5e7f09);_0xbf62ae(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x4adc('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index fefdb34..7937434 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 _0x4c5e=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueue.attributes','exports','voice_queues','lodash'];(function(_0x185882,_0x4caf8d){var _0x957610=function(_0x527d7d){while(--_0x527d7d){_0x185882['push'](_0x185882['shift']());}};_0x957610(++_0x4caf8d);}(_0x4c5e,0xdb));var _0xe4c5=function(_0x49e4e1,_0x10e4f1){_0x49e4e1=_0x49e4e1-0x0;var _0x2d7d79=_0x4c5e[_0x49e4e1];return _0x2d7d79;};'use strict';var _=require(_0xe4c5('0x0'));var util=require(_0xe4c5('0x1'));var logger=require(_0xe4c5('0x2'))('api');var moment=require(_0xe4c5('0x3'));var BPromise=require(_0xe4c5('0x4'));var rp=require(_0xe4c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4c5('0x6'));var config=require(_0xe4c5('0x7'));var attributes=require(_0xe4c5('0x8'));module[_0xe4c5('0x9')]=function(_0x2121fd,_0x320097){return _0x2121fd['define']('VoiceQueue',attributes,{'tableName':_0xe4c5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa25b=['define','voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports'];(function(_0x27f797,_0x53fff6){var _0x548f84=function(_0x37426c){while(--_0x37426c){_0x27f797['push'](_0x27f797['shift']());}};_0x548f84(++_0x53fff6);}(_0xa25b,0x86));var _0xba25=function(_0x4263c7,_0x127749){_0x4263c7=_0x4263c7-0x0;var _0x46b768=_0xa25b[_0x4263c7];return _0x46b768;};'use strict';var _=require(_0xba25('0x0'));var util=require(_0xba25('0x1'));var logger=require(_0xba25('0x2'))(_0xba25('0x3'));var moment=require('moment');var BPromise=require(_0xba25('0x4'));var rp=require(_0xba25('0x5'));var fs=require('fs');var path=require(_0xba25('0x6'));var rimraf=require(_0xba25('0x7'));var config=require('../../config/environment');var attributes=require(_0xba25('0x8'));module[_0xba25('0x9')]=function(_0x3e1b0f,_0x340395){return _0x3e1b0f[_0xba25('0xa')]('VoiceQueue',attributes,{'tableName':_0xba25('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index fe22bb2..89ec586 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 _0x1a74=['client','http','redis','localhost','./voiceQueue.socket','register','request','then','info','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceQueue,\x20%s,\x20%s','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','include','model','map','stringify','catch','find','where','ShowVoiceQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1a74,0xc8));var _0x41a7=function(_0x592fc4,_0x47ea18){_0x592fc4=_0x592fc4-0x0;var _0x346e3d=_0x1a74[_0x592fc4];return _0x346e3d;};'use strict';var _=require(_0x41a7('0x0'));var util=require(_0x41a7('0x1'));var moment=require('moment');var BPromise=require(_0x41a7('0x2'));var rs=require(_0x41a7('0x3'));var fs=require('fs');var Redis=require(_0x41a7('0x4'));var db=require(_0x41a7('0x5'))['db'];var utils=require(_0x41a7('0x6'));var logger=require(_0x41a7('0x7'))(_0x41a7('0x8'));var config=require(_0x41a7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x41a7('0xa')][_0x41a7('0xb')]({'port':0x232a});config[_0x41a7('0xc')]=_['defaults'](config['redis'],{'host':_0x41a7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41a7('0xc')]));require(_0x41a7('0xe'))[_0x41a7('0xf')](socket);function respondWithRpcPromise(_0x260c1e,_0x104927,_0x44d8d1){return new BPromise(function(_0x58162f,_0xa1420f){return client[_0x41a7('0x10')](_0x260c1e,_0x44d8d1)[_0x41a7('0x11')](function(_0x49b102){logger[_0x41a7('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x104927,'request\x20sent');logger[_0x41a7('0x13')](_0x41a7('0x14'),_0x104927,_0x41a7('0x15'),JSON['stringify'](_0x49b102));if(_0x49b102[_0x41a7('0x16')]){if(_0x49b102[_0x41a7('0x16')][_0x41a7('0x17')]===0x1f4){logger[_0x41a7('0x16')](_0x41a7('0x18'),_0x104927,_0x49b102[_0x41a7('0x16')][_0x41a7('0x19')]);return _0xa1420f(_0x49b102[_0x41a7('0x16')][_0x41a7('0x19')]);}logger[_0x41a7('0x16')](_0x41a7('0x18'),_0x104927,_0x49b102['error'][_0x41a7('0x19')]);return _0x58162f(_0x49b102[_0x41a7('0x16')]['message']);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x104927,_0x41a7('0x15'));_0x58162f(_0x49b102[_0x41a7('0x1a')][_0x41a7('0x19')]);}})['catch'](function(_0x4f0d3b){logger[_0x41a7('0x16')](_0x41a7('0x18'),_0x104927,_0x4f0d3b);_0xa1420f(_0x4f0d3b);});});}exports[_0x41a7('0x1b')]=function(_0x10b991){var _0x5a3189=this;return new Promise(function(_0x1cad29,_0x4a3fd7){return db[_0x41a7('0x1c')][_0x41a7('0x1d')]({'raw':_0x10b991[_0x41a7('0x1e')]?_0x10b991[_0x41a7('0x1e')][_0x41a7('0x1f')]===undefined?!![]:![]:!![],'where':_0x10b991[_0x41a7('0x1e')]?_0x10b991[_0x41a7('0x1e')]['where']||null:null,'attributes':_0x10b991[_0x41a7('0x1e')]?_0x10b991[_0x41a7('0x1e')][_0x41a7('0x20')]||null:null,'limit':_0x10b991[_0x41a7('0x1e')]?_0x10b991[_0x41a7('0x1e')][_0x41a7('0x21')]||null:null,'include':_0x10b991[_0x41a7('0x1e')]?_0x10b991[_0x41a7('0x1e')][_0x41a7('0x22')]?_['map'](_0x10b991[_0x41a7('0x1e')][_0x41a7('0x22')],function(_0x537669){return{'model':db[_0x537669[_0x41a7('0x23')]],'as':_0x537669['as'],'attributes':_0x537669[_0x41a7('0x20')],'include':_0x537669[_0x41a7('0x22')]?_[_0x41a7('0x24')](_0x537669['include'],function(_0x3028f1){return{'model':db[_0x3028f1[_0x41a7('0x23')]],'as':_0x3028f1['as'],'attributes':_0x3028f1[_0x41a7('0x20')],'include':_0x3028f1[_0x41a7('0x22')]?_[_0x41a7('0x24')](_0x3028f1[_0x41a7('0x22')],function(_0x5cef7c){return{'model':db[_0x5cef7c[_0x41a7('0x23')]],'as':_0x5cef7c['as'],'attributes':_0x5cef7c[_0x41a7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x41a7('0x11')](function(_0x3c6af2){logger['info'](_0x41a7('0x1b'),_0x10b991);logger[_0x41a7('0x13')](_0x41a7('0x1b'),_0x10b991,JSON[_0x41a7('0x25')](_0x3c6af2));_0x1cad29(_0x3c6af2);})[_0x41a7('0x26')](function(_0x471575){logger['error'](_0x41a7('0x1b'),_0x471575[_0x41a7('0x19')],_0x10b991);_0x4a3fd7(_0x5a3189[_0x41a7('0x16')](0x1f4,_0x471575['message']));});});};exports['ShowVoiceQueue']=function(_0x3301f7){var _0xa0c862=this;return new Promise(function(_0x5ac31c,_0xb80d0f){return db['VoiceQueue'][_0x41a7('0x27')]({'raw':_0x3301f7[_0x41a7('0x1e')]?_0x3301f7[_0x41a7('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3301f7[_0x41a7('0x1e')]?_0x3301f7[_0x41a7('0x1e')][_0x41a7('0x28')]||null:null,'attributes':_0x3301f7[_0x41a7('0x1e')]?_0x3301f7[_0x41a7('0x1e')]['attributes']||null:null,'include':_0x3301f7['options']?_0x3301f7['options'][_0x41a7('0x22')]?_['map'](_0x3301f7[_0x41a7('0x1e')][_0x41a7('0x22')],function(_0x2d770f){return{'model':db[_0x2d770f[_0x41a7('0x23')]],'as':_0x2d770f['as'],'attributes':_0x2d770f[_0x41a7('0x20')],'include':_0x2d770f[_0x41a7('0x22')]?_[_0x41a7('0x24')](_0x2d770f[_0x41a7('0x22')],function(_0x16f6f7){return{'model':db[_0x16f6f7[_0x41a7('0x23')]],'as':_0x16f6f7['as'],'attributes':_0x16f6f7['attributes'],'include':_0x16f6f7[_0x41a7('0x22')]?_['map'](_0x16f6f7['include'],function(_0x27c8a1){return{'model':db[_0x27c8a1[_0x41a7('0x23')]],'as':_0x27c8a1['as'],'attributes':_0x27c8a1[_0x41a7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x41a7('0x11')](function(_0x3d34b5){logger[_0x41a7('0x12')](_0x41a7('0x29'),_0x3301f7);logger[_0x41a7('0x13')]('ShowVoiceQueue',_0x3301f7,JSON[_0x41a7('0x25')](_0x3d34b5));_0x5ac31c(_0x3d34b5);})[_0x41a7('0x26')](function(_0x4926dc){logger[_0x41a7('0x16')](_0x41a7('0x29'),_0x4926dc[_0x41a7('0x19')],_0x3301f7);_0xb80d0f(_0xa0c862[_0x41a7('0x16')](0x1f4,_0x4926dc[_0x41a7('0x19')]));});});}; \ No newline at end of file +var _0xdb18=['catch','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','include','model','map','ShowVoiceQueue','find','raw','debug','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x1f5249,_0x5c4c86){var _0x20e223=function(_0x15eb45){while(--_0x15eb45){_0x1f5249['push'](_0x1f5249['shift']());}};_0x20e223(++_0x5c4c86);}(_0xdb18,0x127));var _0x8db1=function(_0x19a6c6,_0x486db5){_0x19a6c6=_0x19a6c6-0x0;var _0x4e9c66=_0xdb18[_0x19a6c6];return _0x4e9c66;};'use strict';var _=require('lodash');var util=require(_0x8db1('0x0'));var moment=require('moment');var BPromise=require(_0x8db1('0x1'));var rs=require(_0x8db1('0x2'));var fs=require('fs');var Redis=require(_0x8db1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8db1('0x4'))(_0x8db1('0x5'));var config=require(_0x8db1('0x6'));var jayson=require(_0x8db1('0x7'));var client=jayson[_0x8db1('0x8')][_0x8db1('0x9')]({'port':0x232a});config[_0x8db1('0xa')]=_['defaults'](config[_0x8db1('0xa')],{'host':_0x8db1('0xb'),'port':0x18eb});var socket=require(_0x8db1('0xc'))(new Redis(config[_0x8db1('0xa')]));require(_0x8db1('0xd'))[_0x8db1('0xe')](socket);function respondWithRpcPromise(_0x36ab31,_0x4d2bee,_0x54e94d){return new BPromise(function(_0x5eafbe,_0x187544){return client[_0x8db1('0xf')](_0x36ab31,_0x54e94d)[_0x8db1('0x10')](function(_0x182c2a){logger[_0x8db1('0x11')](_0x8db1('0x12'),_0x4d2bee,_0x8db1('0x13'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x4d2bee,_0x8db1('0x13'),JSON[_0x8db1('0x14')](_0x182c2a));if(_0x182c2a[_0x8db1('0x15')]){if(_0x182c2a['error'][_0x8db1('0x16')]===0x1f4){logger['error'](_0x8db1('0x12'),_0x4d2bee,_0x182c2a[_0x8db1('0x15')][_0x8db1('0x17')]);return _0x187544(_0x182c2a[_0x8db1('0x15')][_0x8db1('0x17')]);}logger[_0x8db1('0x15')](_0x8db1('0x12'),_0x4d2bee,_0x182c2a['error'][_0x8db1('0x17')]);return _0x5eafbe(_0x182c2a['error']['message']);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x4d2bee,_0x8db1('0x13'));_0x5eafbe(_0x182c2a[_0x8db1('0x18')]['message']);}})[_0x8db1('0x19')](function(_0xfc6cfe){logger[_0x8db1('0x15')](_0x8db1('0x12'),_0x4d2bee,_0xfc6cfe);_0x187544(_0xfc6cfe);});});}exports[_0x8db1('0x1a')]=function(_0x4052f3){var _0x397d18=this;return new Promise(function(_0x2c7400,_0x16785e){return db[_0x8db1('0x1b')][_0x8db1('0x1c')]({'raw':_0x4052f3['options']?_0x4052f3[_0x8db1('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4052f3[_0x8db1('0x1d')]?_0x4052f3[_0x8db1('0x1d')][_0x8db1('0x1e')]||null:null,'attributes':_0x4052f3[_0x8db1('0x1d')]?_0x4052f3['options'][_0x8db1('0x1f')]||null:null,'limit':_0x4052f3[_0x8db1('0x1d')]?_0x4052f3['options'][_0x8db1('0x20')]||null:null,'include':_0x4052f3[_0x8db1('0x1d')]?_0x4052f3[_0x8db1('0x1d')][_0x8db1('0x21')]?_['map'](_0x4052f3[_0x8db1('0x1d')][_0x8db1('0x21')],function(_0x4c8339){return{'model':db[_0x4c8339[_0x8db1('0x22')]],'as':_0x4c8339['as'],'attributes':_0x4c8339[_0x8db1('0x1f')],'include':_0x4c8339[_0x8db1('0x21')]?_[_0x8db1('0x23')](_0x4c8339[_0x8db1('0x21')],function(_0x331647){return{'model':db[_0x331647[_0x8db1('0x22')]],'as':_0x331647['as'],'attributes':_0x331647[_0x8db1('0x1f')],'include':_0x331647[_0x8db1('0x21')]?_['map'](_0x331647['include'],function(_0xd482c2){return{'model':db[_0xd482c2[_0x8db1('0x22')]],'as':_0xd482c2['as'],'attributes':_0xd482c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x8db1('0x10')](function(_0x140bce){logger[_0x8db1('0x11')]('GetVoiceQueue',_0x4052f3);logger['debug'](_0x8db1('0x1a'),_0x4052f3,JSON[_0x8db1('0x14')](_0x140bce));_0x2c7400(_0x140bce);})[_0x8db1('0x19')](function(_0x34aa50){logger[_0x8db1('0x15')](_0x8db1('0x1a'),_0x34aa50['message'],_0x4052f3);_0x16785e(_0x397d18['error'](0x1f4,_0x34aa50['message']));});});};exports[_0x8db1('0x24')]=function(_0x343927){var _0x329995=this;return new Promise(function(_0x12f1be,_0x533b54){return db[_0x8db1('0x1b')][_0x8db1('0x25')]({'raw':_0x343927[_0x8db1('0x1d')]?_0x343927[_0x8db1('0x1d')][_0x8db1('0x26')]===undefined?!![]:![]:!![],'where':_0x343927[_0x8db1('0x1d')]?_0x343927[_0x8db1('0x1d')]['where']||null:null,'attributes':_0x343927['options']?_0x343927['options'][_0x8db1('0x1f')]||null:null,'include':_0x343927['options']?_0x343927[_0x8db1('0x1d')][_0x8db1('0x21')]?_[_0x8db1('0x23')](_0x343927[_0x8db1('0x1d')][_0x8db1('0x21')],function(_0x2b51ce){return{'model':db[_0x2b51ce[_0x8db1('0x22')]],'as':_0x2b51ce['as'],'attributes':_0x2b51ce['attributes'],'include':_0x2b51ce[_0x8db1('0x21')]?_[_0x8db1('0x23')](_0x2b51ce[_0x8db1('0x21')],function(_0x111094){return{'model':db[_0x111094[_0x8db1('0x22')]],'as':_0x111094['as'],'attributes':_0x111094[_0x8db1('0x1f')],'include':_0x111094['include']?_[_0x8db1('0x23')](_0x111094[_0x8db1('0x21')],function(_0xa48d46){return{'model':db[_0xa48d46[_0x8db1('0x22')]],'as':_0xa48d46['as'],'attributes':_0xa48d46[_0x8db1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8db1('0x10')](function(_0x5711dd){logger[_0x8db1('0x11')]('ShowVoiceQueue',_0x343927);logger[_0x8db1('0x27')](_0x8db1('0x24'),_0x343927,JSON[_0x8db1('0x14')](_0x5711dd));_0x12f1be(_0x5711dd);})[_0x8db1('0x19')](function(_0x224df2){logger['error'](_0x8db1('0x24'),_0x224df2[_0x8db1('0x17')],_0x343927);_0x533b54(_0x329995[_0x8db1('0x15')](0x1f4,_0x224df2[_0x8db1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 404c156..201dcd3 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 _0x7134=['./voiceQueue.events','save','remove','removeListener','register','length','voiceQueue:'];(function(_0x5db3f1,_0x272bb2){var _0x2507eb=function(_0x4e450d){while(--_0x4e450d){_0x5db3f1['push'](_0x5db3f1['shift']());}};_0x2507eb(++_0x272bb2);}(_0x7134,0x85));var _0x4713=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7134[_0x14add3];return _0x4a174f;};'use strict';var VoiceQueueEvents=require(_0x4713('0x0'));var events=[_0x4713('0x1'),_0x4713('0x2'),'update'];function createListener(_0x46e9e6,_0x594553){return function(_0x5b2cd6){_0x594553['emit'](_0x46e9e6,_0x5b2cd6);};}function removeListener(_0x24c926,_0x191ba2){return function(){VoiceQueueEvents[_0x4713('0x3')](_0x24c926,_0x191ba2);};}exports[_0x4713('0x4')]=function(_0x5d26f7){for(var _0x4cff39=0x0,_0x5a219a=events[_0x4713('0x5')];_0x4cff39<_0x5a219a;_0x4cff39++){var _0x54a842=events[_0x4cff39];var _0x505886=createListener(_0x4713('0x6')+_0x54a842,_0x5d26f7);VoiceQueueEvents['on'](_0x54a842,_0x505886);}}; \ No newline at end of file +var _0x467e=['length','voiceQueue:','./voiceQueue.events','save','remove','removeListener','register'];(function(_0xa63ea3,_0x4367ff){var _0x2aa5ff=function(_0x30dc84){while(--_0x30dc84){_0xa63ea3['push'](_0xa63ea3['shift']());}};_0x2aa5ff(++_0x4367ff);}(_0x467e,0x121));var _0xe467=function(_0x24f862,_0x4b645a){_0x24f862=_0x24f862-0x0;var _0x198aa4=_0x467e[_0x24f862];return _0x198aa4;};'use strict';var VoiceQueueEvents=require(_0xe467('0x0'));var events=[_0xe467('0x1'),_0xe467('0x2'),'update'];function createListener(_0x3dfb4e,_0x57c739){return function(_0x15f465){_0x57c739['emit'](_0x3dfb4e,_0x15f465);};}function removeListener(_0x2a1e1f,_0x35afa0){return function(){VoiceQueueEvents[_0xe467('0x3')](_0x2a1e1f,_0x35afa0);};}exports[_0xe467('0x4')]=function(_0x4934f5){for(var _0x531c00=0x0,_0x2b2442=events[_0xe467('0x5')];_0x531c00<_0x2b2442;_0x531c00++){var _0x2b1a3d=events[_0x531c00];var _0x5d2a11=createListener(_0xe467('0x6')+_0x2b1a3d,_0x4934f5);VoiceQueueEvents['on'](_0x2b1a3d,_0x5d2a11);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index c20394b..eb18a24 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 _0x5d17=['/describe','describe','/index','/:id','post','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5d17,0x114));var _0x75d1=function(_0x1eec3a,_0x168828){_0x1eec3a=_0x1eec3a-0x0;var _0x133cf7=_0x5d17[_0x1eec3a];return _0x133cf7;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var auth=require(_0x75d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x75d1('0x5'));var controller=require(_0x75d1('0x6'));router[_0x75d1('0x7')]('/',auth[_0x75d1('0x8')](),controller['index']);router[_0x75d1('0x7')](_0x75d1('0x9'),auth[_0x75d1('0x8')](),controller[_0x75d1('0xa')]);router[_0x75d1('0x7')](_0x75d1('0xb'),auth[_0x75d1('0x8')](),controller['getVoiceQueuesReport']);router['get'](_0x75d1('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x75d1('0xd')]('/',auth[_0x75d1('0x8')](),controller['create']);router[_0x75d1('0xe')](_0x75d1('0xc'),auth[_0x75d1('0x8')](),controller[_0x75d1('0xf')]);router[_0x75d1('0x10')](_0x75d1('0xc'),auth['isAuthenticated'](),controller[_0x75d1('0x11')]);module[_0x75d1('0x12')]=router; \ No newline at end of file +var _0x741c=['post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/index','show'];(function(_0x262ed2,_0x3918db){var _0x46f37b=function(_0x5805b0){while(--_0x5805b0){_0x262ed2['push'](_0x262ed2['shift']());}};_0x46f37b(++_0x3918db);}(_0x741c,0x196));var _0xc741=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x741c[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc741('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xc741('0x7')]('/',auth[_0xc741('0x8')](),controller[_0xc741('0x9')]);router[_0xc741('0x7')](_0xc741('0xa'),auth[_0xc741('0x8')](),controller[_0xc741('0xb')]);router['get'](_0xc741('0xc'),auth[_0xc741('0x8')](),controller['getVoiceQueuesReport']);router[_0xc741('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xc741('0xd')]);router[_0xc741('0xe')]('/',auth[_0xc741('0x8')](),controller[_0xc741('0xf')]);router[_0xc741('0x10')](_0xc741('0x11'),auth[_0xc741('0x8')](),controller['update']);router['delete']('/:id',auth[_0xc741('0x8')](),controller[_0xc741('0x12')]);module[_0xc741('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 63f155f..d1a2c8c 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 _0xb4a0=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','moment','STRING','DATE','getDataValue'];(function(_0x13c174,_0xda25fe){var _0x160654=function(_0x1b6ac2){while(--_0x1b6ac2){_0x13c174['push'](_0x13c174['shift']());}};_0x160654(++_0xda25fe);}(_0xb4a0,0x128));var _0x0b4a=function(_0x895c6b,_0x50833f){_0x895c6b=_0x895c6b-0x0;var _0x579fed=_0xb4a0[_0x895c6b];return _0x579fed;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0b4a('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0b4a('0x1')]},'calleridnum':{'type':Sequelize[_0x0b4a('0x1')]},'calleridname':{'type':Sequelize[_0x0b4a('0x1')]},'queue':{'type':Sequelize[_0x0b4a('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x0b4a('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x0b4a('0x2')],'set':function(_0x2f0095){var _0x3200c1=moment(_0x2f0095);var _0x3fa124=moment(this[_0x0b4a('0x3')]('queuecallerjoinAt'))['format'](_0x0b4a('0x4'));var _0x19aeea=_0x3200c1[_0x0b4a('0x5')](_0x3fa124,_0x0b4a('0x6'));this[_0x0b4a('0x7')](_0x0b4a('0x8'),_0x2f0095);this[_0x0b4a('0x7')]('holdtime',_0x19aeea||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x0b4a('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x0b4a('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x0b4a('0x2')]},'queuecallerexit':{'type':Sequelize[_0x0b4a('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0b4a('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x0b4a('0x1')],'comment':_0x0b4a('0xa')},'originalposition':{'type':Sequelize[_0x0b4a('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x0b4a('0x1')]},'accountcode':{'type':Sequelize[_0x0b4a('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x0b4a('0x1')]},'priority':{'type':Sequelize[_0x0b4a('0x1')]},'holdtime':{'type':Sequelize[_0x0b4a('0xb')]},'mohtime':{'type':Sequelize[_0x0b4a('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0b4a('0x1')]},'transfer':{'type':Sequelize[_0x0b4a('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x0b4a('0x1')]},'transferuniqueid':{'type':Sequelize[_0x0b4a('0x1')]},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbc7b=['exports','STRING','DATE','queuecallerjoinAt','format','diff','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize'];(function(_0x413d08,_0x1f5590){var _0x5175ee=function(_0x1806c9){while(--_0x1806c9){_0x413d08['push'](_0x413d08['shift']());}};_0x5175ee(++_0x1f5590);}(_0xbc7b,0x195));var _0xbbc7=function(_0x11233d,_0x570001){_0x11233d=_0x11233d-0x0;var _0x1a38bd=_0xbc7b[_0x11233d];return _0x1a38bd;};'use strict';var Sequelize=require(_0xbbc7('0x0'));var moment=require('moment');module[_0xbbc7('0x1')]={'type':{'type':Sequelize[_0xbbc7('0x2')]},'uniqueid':{'type':Sequelize[_0xbbc7('0x2')]},'calleridnum':{'type':Sequelize[_0xbbc7('0x2')]},'calleridname':{'type':Sequelize[_0xbbc7('0x2')]},'queue':{'type':Sequelize[_0xbbc7('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xbbc7('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xbbc7('0x3')],'set':function(_0x18fbfa){var _0x14faf1=moment(_0x18fbfa);var _0x1ffc2=moment(this['getDataValue'](_0xbbc7('0x4')))[_0xbbc7('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x173585=_0x14faf1[_0xbbc7('0x6')](_0x1ffc2,_0xbbc7('0x7'));this['setDataValue'](_0xbbc7('0x8'),_0x18fbfa);this[_0xbbc7('0x9')](_0xbbc7('0xa'),_0x173585||null);}},'position':{'type':Sequelize[_0xbbc7('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xbbc7('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xbbc7('0x2')],'comment':_0xbbc7('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xbbc7('0x2')]},'connectedlinenum':{'type':Sequelize[_0xbbc7('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbbc7('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xbbc7('0x2')]},'priority':{'type':Sequelize[_0xbbc7('0x2')]},'holdtime':{'type':Sequelize[_0xbbc7('0xb')]},'mohtime':{'type':Sequelize[_0xbbc7('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xbbc7('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xbbc7('0x2')]},'transfer':{'type':Sequelize[_0xbbc7('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xbbc7('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xbbc7('0x2')]},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 89a2af3..c8d7fc2 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 _0x5fab=['sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','status','count','offset','limit','set','json','reject','then','end','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','merge','options','find','create','body','update','destroy','describe','getVoiceQueuesReport','filter','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x2b62d8,_0x3004a8){var _0x37ffdb=function(_0x1675b0){while(--_0x1675b0){_0x2b62d8['push'](_0x2b62d8['shift']());}};_0x37ffdb(++_0x3004a8);}(_0x5fab,0x177));var _0xb5fa=function(_0x59d546,_0x107f05){_0x59d546=_0x59d546-0x0;var _0x41fbdb=_0x5fab[_0x59d546];return _0x41fbdb;};'use strict';var pdf=require(_0xb5fa('0x0'));var emlformat=require(_0xb5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xb'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var db=require(_0xb5fa('0x18'))['db'];config[_0xb5fa('0x19')]=_['defaults'](config[_0xb5fa('0x19')],{'host':_0xb5fa('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5fa('0x19')]));require('./voiceQueueReport.socket')[_0xb5fa('0x1b')](socket);function respondWithStatusCode(_0x3fc372,_0x40c914){_0x40c914=_0x40c914||0xcc;return function(_0xca8d82){if(_0xca8d82){return _0x3fc372[_0xb5fa('0x1c')](_0x40c914);}return _0x3fc372['status'](_0x40c914)['end']();};}function respondWithResult(_0x38e964,_0x587043){_0x587043=_0x587043||0xc8;return function(_0x31f252){if(_0x31f252){return _0x38e964[_0xb5fa('0x1d')](_0x587043)['json'](_0x31f252);}};}function respondWithFilteredResult(_0x4fabcc,_0x451a55){return function(_0x1f7f05){if(_0x1f7f05){var _0x32e9e5=_0x1f7f05[_0xb5fa('0x1e')],_0x46eef0=_0x451a55[_0xb5fa('0x1f')],_0x324ba5=_0x451a55[_0xb5fa('0x1f')]+_0x451a55[_0xb5fa('0x20')],_0x13e82b;if(_0x324ba5>=_0x32e9e5){_0x324ba5=_0x32e9e5;_0x13e82b=0xc8;}else{_0x13e82b=0xce;}_0x4fabcc[_0xb5fa('0x1d')](_0x13e82b);return _0x4fabcc[_0xb5fa('0x21')]('Content-Range',_0x46eef0+'-'+_0x324ba5+'/'+_0x32e9e5)[_0xb5fa('0x22')](_0x1f7f05);}return null;};}function patchUpdates(_0x519e20){return function(_0x37ae06){try{jsonpatch['apply'](_0x37ae06,_0x519e20,!![]);}catch(_0xd0fe2b){return BPromise[_0xb5fa('0x23')](_0xd0fe2b);}return _0x37ae06['save']();};}function saveUpdates(_0x40dfdf,_0x3a2ab9){return function(_0x283a56){if(_0x283a56){return _0x283a56['update'](_0x40dfdf)[_0xb5fa('0x24')](function(_0xec108f){return _0xec108f;});}return null;};}function removeEntity(_0x444237,_0x542348){return function(_0x224ec8){if(_0x224ec8){return _0x224ec8['destroy']()[_0xb5fa('0x24')](function(){_0x444237[_0xb5fa('0x1d')](0xcc)[_0xb5fa('0x25')]();});}};}function handleEntityNotFound(_0x543edf,_0x2dbd22){return function(_0x3f61cd){if(!_0x3f61cd){_0x543edf[_0xb5fa('0x1c')](0x194);}return _0x3f61cd;};}function handleError(_0x20d649,_0x568870){_0x568870=_0x568870||0x1f4;return function(_0x4ec294){logger['error'](_0x4ec294['stack']);if(_0x4ec294[_0xb5fa('0x26')]){delete _0x4ec294[_0xb5fa('0x26')];}_0x20d649[_0xb5fa('0x1d')](_0x568870)[_0xb5fa('0x27')](_0x4ec294);};}exports[_0xb5fa('0x28')]=function(_0x3506a4,_0x358549){var _0x353314={},_0x409af9={},_0x2a5690={'count':0x0,'rows':[]};var _0x142bfa=_[_0xb5fa('0x29')](db[_0xb5fa('0x2a')][_0xb5fa('0x2b')],function(_0xed02e){return{'name':_0xed02e[_0xb5fa('0x2c')],'type':_0xed02e[_0xb5fa('0x2d')][_0xb5fa('0x2e')]};});_0x409af9[_0xb5fa('0x2f')]=_[_0xb5fa('0x29')](_0x142bfa,_0xb5fa('0x26'));_0x409af9[_0xb5fa('0x30')]=_[_0xb5fa('0x31')](_0x3506a4[_0xb5fa('0x30')]);_0x409af9['filters']=_[_0xb5fa('0x32')](_0x409af9['model'],_0x409af9['query']);_0x353314['attributes']=_[_0xb5fa('0x32')](_0x409af9['model'],qs[_0xb5fa('0x33')](_0x3506a4['query']['fields']));_0x353314[_0xb5fa('0x34')]=_0x353314[_0xb5fa('0x34')]['length']?_0x353314['attributes']:_0x409af9[_0xb5fa('0x2f')];if(!_0x3506a4[_0xb5fa('0x30')][_0xb5fa('0x35')]('nolimit')){_0x353314[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0x3506a4['query'][_0xb5fa('0x20')]);_0x353314[_0xb5fa('0x1f')]=qs[_0xb5fa('0x1f')](_0x3506a4['query'][_0xb5fa('0x1f')]);}_0x353314[_0xb5fa('0x36')]=qs[_0xb5fa('0x37')](_0x3506a4['query'][_0xb5fa('0x37')]);_0x353314[_0xb5fa('0x38')]=qs[_0xb5fa('0x39')](_[_0xb5fa('0x3a')](_0x3506a4['query'],_0x409af9['filters']));if(_0x3506a4['query']['filter']){_0x353314['where']=_['merge'](_0x353314[_0xb5fa('0x38')],{'$or':_['map'](_0x142bfa,function(_0x43de71){if(_0x43de71[_0xb5fa('0x2d')]!==_0xb5fa('0x3b')){var _0x30b288={};_0x30b288[_0x43de71[_0xb5fa('0x26')]]={'$like':'%'+_0x3506a4[_0xb5fa('0x30')]['filter']+'%'};return _0x30b288;}})});}_0x353314=_['merge']({},_0x353314,_0x3506a4['options']);var _0x534b38={'where':_0x353314['where']};return db[_0xb5fa('0x2a')]['count'](_0x534b38)['then'](function(_0x3cdf63){_0x2a5690[_0xb5fa('0x1e')]=_0x3cdf63;if(_0x3506a4[_0xb5fa('0x30')][_0xb5fa('0x3c')]){_0x353314[_0xb5fa('0x3d')]=[{'all':!![]}];}return db[_0xb5fa('0x2a')][_0xb5fa('0x3e')](_0x353314);})[_0xb5fa('0x24')](function(_0x19e370){_0x2a5690[_0xb5fa('0x3f')]=_0x19e370;return _0x2a5690;})['then'](respondWithFilteredResult(_0x358549,_0x353314))[_0xb5fa('0x40')](handleError(_0x358549,null));};exports['show']=function(_0x233f90,_0x39aac3){var _0x2c7c5f={'raw':![],'where':{'id':_0x233f90[_0xb5fa('0x41')]['id']}},_0x2ef359={};_0x2ef359[_0xb5fa('0x2f')]=_[_0xb5fa('0x31')](db[_0xb5fa('0x2a')]['rawAttributes']);_0x2ef359[_0xb5fa('0x30')]=_[_0xb5fa('0x31')](_0x233f90['query']);_0x2ef359[_0xb5fa('0x39')]=_['intersection'](_0x2ef359[_0xb5fa('0x2f')],_0x2ef359[_0xb5fa('0x30')]);_0x2c7c5f['attributes']=_['intersection'](_0x2ef359[_0xb5fa('0x2f')],qs[_0xb5fa('0x33')](_0x233f90[_0xb5fa('0x30')][_0xb5fa('0x33')]));_0x2c7c5f[_0xb5fa('0x34')]=_0x2c7c5f[_0xb5fa('0x34')][_0xb5fa('0x42')]?_0x2c7c5f[_0xb5fa('0x34')]:_0x2ef359['model'];if(_0x233f90[_0xb5fa('0x30')][_0xb5fa('0x3c')]){_0x2c7c5f['include']=[{'all':!![]}];}_0x2c7c5f=_[_0xb5fa('0x43')]({},_0x2c7c5f,_0x233f90[_0xb5fa('0x44')]);return db[_0xb5fa('0x2a')][_0xb5fa('0x45')](_0x2c7c5f)[_0xb5fa('0x24')](handleEntityNotFound(_0x39aac3,null))[_0xb5fa('0x24')](respondWithResult(_0x39aac3,null))[_0xb5fa('0x40')](handleError(_0x39aac3,null));};exports[_0xb5fa('0x46')]=function(_0x20f5f5,_0x464e36){return db[_0xb5fa('0x2a')][_0xb5fa('0x46')](_0x20f5f5[_0xb5fa('0x47')],{})[_0xb5fa('0x24')](respondWithResult(_0x464e36,0xc9))[_0xb5fa('0x40')](handleError(_0x464e36,null));};exports[_0xb5fa('0x48')]=function(_0x52f5d8,_0x56dceb){if(_0x52f5d8[_0xb5fa('0x47')]['id']){delete _0x52f5d8['body']['id'];}return db[_0xb5fa('0x2a')][_0xb5fa('0x45')]({'where':{'id':_0x52f5d8['params']['id']}})[_0xb5fa('0x24')](handleEntityNotFound(_0x56dceb,null))[_0xb5fa('0x24')](saveUpdates(_0x52f5d8[_0xb5fa('0x47')],null))[_0xb5fa('0x24')](respondWithResult(_0x56dceb,null))[_0xb5fa('0x40')](handleError(_0x56dceb,null));};exports[_0xb5fa('0x49')]=function(_0x51d5f7,_0x27a651){return db['VoiceQueueReport'][_0xb5fa('0x45')]({'where':{'id':_0x51d5f7[_0xb5fa('0x41')]['id']}})[_0xb5fa('0x24')](handleEntityNotFound(_0x27a651,null))['then'](removeEntity(_0x27a651,null))[_0xb5fa('0x40')](handleError(_0x27a651,null));};exports[_0xb5fa('0x4a')]=function(_0x4dea87,_0x4f6ffa){return db[_0xb5fa('0x2a')][_0xb5fa('0x4a')]()[_0xb5fa('0x24')](respondWithResult(_0x4f6ffa,null))[_0xb5fa('0x40')](handleError(_0x4f6ffa,null));};exports[_0xb5fa('0x4b')]=function(_0x7775b4,_0x31c91f){var _0x3b092a={},_0x1c1f1b={},_0x1578e6={'count':0x0,'rows':[]};_0x1c1f1b[_0xb5fa('0x2f')]=_[_0xb5fa('0x31')](db[_0xb5fa('0x2a')][_0xb5fa('0x2b')]);_0x1c1f1b[_0xb5fa('0x30')]=_[_0xb5fa('0x31')](_0x7775b4[_0xb5fa('0x30')]);_0x1c1f1b[_0xb5fa('0x39')]=_['intersection'](_0x1c1f1b[_0xb5fa('0x2f')],_0x1c1f1b[_0xb5fa('0x30')]);_0x3b092a[_0xb5fa('0x34')]=_[_0xb5fa('0x32')](_0x1c1f1b[_0xb5fa('0x2f')],qs[_0xb5fa('0x33')](_0x7775b4[_0xb5fa('0x30')][_0xb5fa('0x33')]));_0x3b092a[_0xb5fa('0x34')]=_0x3b092a[_0xb5fa('0x34')]['length']?_0x3b092a['attributes']:_0x1c1f1b[_0xb5fa('0x2f')];if(!_0x7775b4[_0xb5fa('0x30')][_0xb5fa('0x35')]('nolimit')){_0x3b092a[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0x7775b4[_0xb5fa('0x30')][_0xb5fa('0x20')]);_0x3b092a[_0xb5fa('0x1f')]=qs[_0xb5fa('0x1f')](_0x7775b4[_0xb5fa('0x30')]['offset']);}_0x3b092a[_0xb5fa('0x36')]=qs[_0xb5fa('0x37')](_0x7775b4['query'][_0xb5fa('0x37')]);_0x3b092a[_0xb5fa('0x38')]=qs['filters'](_[_0xb5fa('0x3a')](_0x7775b4[_0xb5fa('0x30')],_0x1c1f1b[_0xb5fa('0x39')]));if(_0x7775b4[_0xb5fa('0x30')][_0xb5fa('0x4c')]){_0x3b092a[_0xb5fa('0x38')]=_[_0xb5fa('0x43')](_0x3b092a[_0xb5fa('0x38')],{'$or':_[_0xb5fa('0x29')](_0x3b092a[_0xb5fa('0x34')],function(_0xfb88cc){var _0x3caf48={};_0x3caf48[_0xfb88cc]={'$like':'%'+_0x7775b4[_0xb5fa('0x30')][_0xb5fa('0x4c')]+'%'};return _0x3caf48;})});}_0x3b092a=_[_0xb5fa('0x43')]({},_0x3b092a,_0x7775b4[_0xb5fa('0x44')]);var _0x41cce9={'where':_0x3b092a[_0xb5fa('0x38')]};return db[_0xb5fa('0x2a')][_0xb5fa('0x1e')](_0x41cce9)[_0xb5fa('0x24')](function(_0x36fc0f){_0x1578e6['count']=_0x36fc0f;if(_0x7775b4[_0xb5fa('0x30')][_0xb5fa('0x3c')]){_0x3b092a[_0xb5fa('0x3d')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xb5fa('0x3e')](_0x3b092a);})[_0xb5fa('0x24')](function(_0x58d394){_0x1578e6[_0xb5fa('0x3f')]=_0x58d394;return _0x1578e6;})[_0xb5fa('0x24')](respondWithFilteredResult(_0x31c91f,_0x3b092a,_0xb5fa('0x4b')))['catch'](handleError(_0x31c91f,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x66fa=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','includeAll','include','findAll','rows','show','params','intersection','options','find','catch','create','body','getVoiceQueuesReport','pick','filter','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','./voiceQueueReport.socket','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x66fa,0x117));var _0xa66f=function(_0x571e2f,_0x30cfb5){_0x571e2f=_0x571e2f-0x0;var _0x563a74=_0x66fa[_0x571e2f];return _0x563a74;};'use strict';var pdf=require(_0xa66f('0x0'));var emlformat=require(_0xa66f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa66f('0x2'));var jsonpatch=require(_0xa66f('0x3'));var rp=require(_0xa66f('0x4'));var moment=require(_0xa66f('0x5'));var BPromise=require(_0xa66f('0x6'));var Mustache=require(_0xa66f('0x7'));var util=require(_0xa66f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa66f('0x9'));var ejs=require(_0xa66f('0xa'));var fs=require('fs');var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var db=require(_0xa66f('0x14'))['db'];config['redis']=_[_0xa66f('0x15')](config[_0xa66f('0x16')],{'host':_0xa66f('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa66f('0x18'))['register'](socket);function respondWithStatusCode(_0x528427,_0x5a7b16){_0x5a7b16=_0x5a7b16||0xcc;return function(_0x3ac0ac){if(_0x3ac0ac){return _0x528427[_0xa66f('0x19')](_0x5a7b16);}return _0x528427[_0xa66f('0x1a')](_0x5a7b16)[_0xa66f('0x1b')]();};}function respondWithResult(_0xd348f9,_0x567d4f){_0x567d4f=_0x567d4f||0xc8;return function(_0x5510dc){if(_0x5510dc){return _0xd348f9[_0xa66f('0x1a')](_0x567d4f)[_0xa66f('0x1c')](_0x5510dc);}};}function respondWithFilteredResult(_0x295acf,_0x403f4d){return function(_0x5c67f5){if(_0x5c67f5){var _0x1cbe64=_0x5c67f5[_0xa66f('0x1d')],_0x55b59d=_0x403f4d[_0xa66f('0x1e')],_0x4a28d4=_0x403f4d[_0xa66f('0x1e')]+_0x403f4d[_0xa66f('0x1f')],_0x2f9da2;if(_0x4a28d4>=_0x1cbe64){_0x4a28d4=_0x1cbe64;_0x2f9da2=0xc8;}else{_0x2f9da2=0xce;}_0x295acf[_0xa66f('0x1a')](_0x2f9da2);return _0x295acf[_0xa66f('0x20')](_0xa66f('0x21'),_0x55b59d+'-'+_0x4a28d4+'/'+_0x1cbe64)[_0xa66f('0x1c')](_0x5c67f5);}return null;};}function patchUpdates(_0x2d9602){return function(_0x235b61){try{jsonpatch[_0xa66f('0x22')](_0x235b61,_0x2d9602,!![]);}catch(_0x3c4eb1){return BPromise[_0xa66f('0x23')](_0x3c4eb1);}return _0x235b61[_0xa66f('0x24')]();};}function saveUpdates(_0x5cd613,_0x27f570){return function(_0xc5c82e){if(_0xc5c82e){return _0xc5c82e[_0xa66f('0x25')](_0x5cd613)[_0xa66f('0x26')](function(_0x5cbd82){return _0x5cbd82;});}return null;};}function removeEntity(_0x337602,_0x473822){return function(_0x209f4d){if(_0x209f4d){return _0x209f4d[_0xa66f('0x27')]()['then'](function(){_0x337602['status'](0xcc)[_0xa66f('0x1b')]();});}};}function handleEntityNotFound(_0x598942,_0x3a3e4f){return function(_0xc661f2){if(!_0xc661f2){_0x598942[_0xa66f('0x19')](0x194);}return _0xc661f2;};}function handleError(_0x57da7f,_0x4683c7){_0x4683c7=_0x4683c7||0x1f4;return function(_0x1c2903){logger[_0xa66f('0x28')](_0x1c2903[_0xa66f('0x29')]);if(_0x1c2903[_0xa66f('0x2a')]){delete _0x1c2903[_0xa66f('0x2a')];}_0x57da7f[_0xa66f('0x1a')](_0x4683c7)[_0xa66f('0x2b')](_0x1c2903);};}exports[_0xa66f('0x2c')]=function(_0x117d03,_0x45f71c){var _0x63650b={},_0x42b966={},_0xeeb22e={'count':0x0,'rows':[]};var _0x49f615=_['map'](db[_0xa66f('0x2d')][_0xa66f('0x2e')],function(_0x55f309){return{'name':_0x55f309[_0xa66f('0x2f')],'type':_0x55f309[_0xa66f('0x30')]['key']};});_0x42b966[_0xa66f('0x31')]=_[_0xa66f('0x32')](_0x49f615,_0xa66f('0x2a'));_0x42b966[_0xa66f('0x33')]=_[_0xa66f('0x34')](_0x117d03['query']);_0x42b966[_0xa66f('0x35')]=_['intersection'](_0x42b966[_0xa66f('0x31')],_0x42b966[_0xa66f('0x33')]);_0x63650b[_0xa66f('0x36')]=_['intersection'](_0x42b966[_0xa66f('0x31')],qs[_0xa66f('0x37')](_0x117d03['query'][_0xa66f('0x37')]));_0x63650b[_0xa66f('0x36')]=_0x63650b[_0xa66f('0x36')][_0xa66f('0x38')]?_0x63650b[_0xa66f('0x36')]:_0x42b966[_0xa66f('0x31')];if(!_0x117d03[_0xa66f('0x33')][_0xa66f('0x39')](_0xa66f('0x3a'))){_0x63650b[_0xa66f('0x1f')]=qs['limit'](_0x117d03[_0xa66f('0x33')]['limit']);_0x63650b[_0xa66f('0x1e')]=qs[_0xa66f('0x1e')](_0x117d03[_0xa66f('0x33')][_0xa66f('0x1e')]);}_0x63650b[_0xa66f('0x3b')]=qs[_0xa66f('0x3c')](_0x117d03[_0xa66f('0x33')][_0xa66f('0x3c')]);_0x63650b['where']=qs[_0xa66f('0x35')](_['pick'](_0x117d03[_0xa66f('0x33')],_0x42b966[_0xa66f('0x35')]));if(_0x117d03[_0xa66f('0x33')]['filter']){_0x63650b['where']=_[_0xa66f('0x3d')](_0x63650b[_0xa66f('0x3e')],{'$or':_[_0xa66f('0x32')](_0x49f615,function(_0x1f5a5f){if(_0x1f5a5f[_0xa66f('0x30')]!=='VIRTUAL'){var _0x5cb0a9={};_0x5cb0a9[_0x1f5a5f['name']]={'$like':'%'+_0x117d03[_0xa66f('0x33')]['filter']+'%'};return _0x5cb0a9;}})});}_0x63650b=_['merge']({},_0x63650b,_0x117d03['options']);var _0x5fdc3e={'where':_0x63650b['where']};return db[_0xa66f('0x2d')][_0xa66f('0x1d')](_0x5fdc3e)[_0xa66f('0x26')](function(_0x1647a0){_0xeeb22e[_0xa66f('0x1d')]=_0x1647a0;if(_0x117d03[_0xa66f('0x33')][_0xa66f('0x3f')]){_0x63650b[_0xa66f('0x40')]=[{'all':!![]}];}return db[_0xa66f('0x2d')][_0xa66f('0x41')](_0x63650b);})[_0xa66f('0x26')](function(_0x93f6ff){_0xeeb22e[_0xa66f('0x42')]=_0x93f6ff;return _0xeeb22e;})[_0xa66f('0x26')](respondWithFilteredResult(_0x45f71c,_0x63650b))['catch'](handleError(_0x45f71c,null));};exports[_0xa66f('0x43')]=function(_0x25c2cb,_0x58c1f2){var _0x248587={'raw':![],'where':{'id':_0x25c2cb[_0xa66f('0x44')]['id']}},_0x4b6e6b={};_0x4b6e6b[_0xa66f('0x31')]=_['keys'](db[_0xa66f('0x2d')][_0xa66f('0x2e')]);_0x4b6e6b[_0xa66f('0x33')]=_['keys'](_0x25c2cb[_0xa66f('0x33')]);_0x4b6e6b['filters']=_[_0xa66f('0x45')](_0x4b6e6b[_0xa66f('0x31')],_0x4b6e6b[_0xa66f('0x33')]);_0x248587[_0xa66f('0x36')]=_[_0xa66f('0x45')](_0x4b6e6b[_0xa66f('0x31')],qs[_0xa66f('0x37')](_0x25c2cb['query'][_0xa66f('0x37')]));_0x248587[_0xa66f('0x36')]=_0x248587[_0xa66f('0x36')][_0xa66f('0x38')]?_0x248587[_0xa66f('0x36')]:_0x4b6e6b['model'];if(_0x25c2cb['query'][_0xa66f('0x3f')]){_0x248587[_0xa66f('0x40')]=[{'all':!![]}];}_0x248587=_[_0xa66f('0x3d')]({},_0x248587,_0x25c2cb[_0xa66f('0x46')]);return db[_0xa66f('0x2d')][_0xa66f('0x47')](_0x248587)['then'](handleEntityNotFound(_0x58c1f2,null))[_0xa66f('0x26')](respondWithResult(_0x58c1f2,null))[_0xa66f('0x48')](handleError(_0x58c1f2,null));};exports[_0xa66f('0x49')]=function(_0x5651e9,_0x57c8a0){return db[_0xa66f('0x2d')][_0xa66f('0x49')](_0x5651e9[_0xa66f('0x4a')],{})['then'](respondWithResult(_0x57c8a0,0xc9))['catch'](handleError(_0x57c8a0,null));};exports['update']=function(_0x19e7ce,_0x35e477){if(_0x19e7ce[_0xa66f('0x4a')]['id']){delete _0x19e7ce[_0xa66f('0x4a')]['id'];}return db[_0xa66f('0x2d')][_0xa66f('0x47')]({'where':{'id':_0x19e7ce[_0xa66f('0x44')]['id']}})[_0xa66f('0x26')](handleEntityNotFound(_0x35e477,null))['then'](saveUpdates(_0x19e7ce[_0xa66f('0x4a')],null))[_0xa66f('0x26')](respondWithResult(_0x35e477,null))[_0xa66f('0x48')](handleError(_0x35e477,null));};exports[_0xa66f('0x27')]=function(_0x11597b,_0x33cdc7){return db['VoiceQueueReport'][_0xa66f('0x47')]({'where':{'id':_0x11597b[_0xa66f('0x44')]['id']}})[_0xa66f('0x26')](handleEntityNotFound(_0x33cdc7,null))[_0xa66f('0x26')](removeEntity(_0x33cdc7,null))[_0xa66f('0x48')](handleError(_0x33cdc7,null));};exports['describe']=function(_0x389b9a,_0x50e0cd){return db[_0xa66f('0x2d')]['describe']()['then'](respondWithResult(_0x50e0cd,null))[_0xa66f('0x48')](handleError(_0x50e0cd,null));};exports[_0xa66f('0x4b')]=function(_0x12271d,_0x2c79df){var _0x35ed5b={},_0xe97cf4={},_0x53a62f={'count':0x0,'rows':[]};_0xe97cf4[_0xa66f('0x31')]=_[_0xa66f('0x34')](db[_0xa66f('0x2d')][_0xa66f('0x2e')]);_0xe97cf4['query']=_[_0xa66f('0x34')](_0x12271d['query']);_0xe97cf4[_0xa66f('0x35')]=_[_0xa66f('0x45')](_0xe97cf4[_0xa66f('0x31')],_0xe97cf4[_0xa66f('0x33')]);_0x35ed5b[_0xa66f('0x36')]=_[_0xa66f('0x45')](_0xe97cf4[_0xa66f('0x31')],qs['fields'](_0x12271d[_0xa66f('0x33')][_0xa66f('0x37')]));_0x35ed5b[_0xa66f('0x36')]=_0x35ed5b[_0xa66f('0x36')][_0xa66f('0x38')]?_0x35ed5b[_0xa66f('0x36')]:_0xe97cf4[_0xa66f('0x31')];if(!_0x12271d[_0xa66f('0x33')][_0xa66f('0x39')]('nolimit')){_0x35ed5b['limit']=qs[_0xa66f('0x1f')](_0x12271d[_0xa66f('0x33')][_0xa66f('0x1f')]);_0x35ed5b[_0xa66f('0x1e')]=qs[_0xa66f('0x1e')](_0x12271d[_0xa66f('0x33')][_0xa66f('0x1e')]);}_0x35ed5b['order']=qs[_0xa66f('0x3c')](_0x12271d[_0xa66f('0x33')][_0xa66f('0x3c')]);_0x35ed5b[_0xa66f('0x3e')]=qs['filters'](_[_0xa66f('0x4c')](_0x12271d[_0xa66f('0x33')],_0xe97cf4[_0xa66f('0x35')]));if(_0x12271d[_0xa66f('0x33')][_0xa66f('0x4d')]){_0x35ed5b[_0xa66f('0x3e')]=_['merge'](_0x35ed5b['where'],{'$or':_[_0xa66f('0x32')](_0x35ed5b[_0xa66f('0x36')],function(_0x174aad){var _0x52edb3={};_0x52edb3[_0x174aad]={'$like':'%'+_0x12271d[_0xa66f('0x33')][_0xa66f('0x4d')]+'%'};return _0x52edb3;})});}_0x35ed5b=_[_0xa66f('0x3d')]({},_0x35ed5b,_0x12271d[_0xa66f('0x46')]);var _0x17b2cf={'where':_0x35ed5b[_0xa66f('0x3e')]};return db[_0xa66f('0x2d')][_0xa66f('0x1d')](_0x17b2cf)[_0xa66f('0x26')](function(_0x5d4299){_0x53a62f[_0xa66f('0x1d')]=_0x5d4299;if(_0x12271d[_0xa66f('0x33')][_0xa66f('0x3f')]){_0x35ed5b[_0xa66f('0x40')]=[{'all':!![]}];}return db[_0xa66f('0x2d')][_0xa66f('0x41')](_0x35ed5b);})[_0xa66f('0x26')](function(_0x3b38ad){_0x53a62f['rows']=_0x3b38ad;return _0x53a62f;})['then'](respondWithFilteredResult(_0x2c79df,_0x35ed5b,_0xa66f('0x4b')))[_0xa66f('0x48')](handleError(_0x2c79df,null,_0xa66f('0x4b')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index dbc6f92..fa63d08 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 _0x01d6=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','save'];(function(_0x4279dc,_0x3ac81c){var _0x410855=function(_0x1aba00){while(--_0x1aba00){_0x4279dc['push'](_0x4279dc['shift']());}};_0x410855(++_0x3ac81c);}(_0x01d6,0x65));var _0x601d=function(_0x53fb93,_0x13c7c6){_0x53fb93=_0x53fb93-0x0;var _0x24841b=_0x01d6[_0x53fb93];return _0x24841b;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x601d('0x0'))['db'][_0x601d('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x601d('0x2'),'afterUpdate':'update','afterDestroy':_0x601d('0x3')};function emitEvent(_0x1ab626){return function(_0x580c87,_0x43b30d,_0x4b167a){VoiceQueueReportEvents[_0x601d('0x4')](_0x1ab626+':'+_0x580c87['id'],_0x580c87);VoiceQueueReportEvents[_0x601d('0x4')](_0x1ab626,_0x580c87);_0x4b167a(null);};}for(var e in events){if(events[_0x601d('0x5')](e)){var event=events[e];VoiceQueueReport[_0x601d('0x6')](e,emitEvent(event));}}module[_0x601d('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xa9bd=['events','../../mysqldb','VoiceQueueReport','save','update','remove','emit','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa9bd,0x1f0));var _0xda9b=function(_0xe5ef08,_0x5f55aa){_0xe5ef08=_0xe5ef08-0x0;var _0x12a5ee=_0xa9bd[_0xe5ef08];return _0x12a5ee;};'use strict';var EventEmitter=require(_0xda9b('0x0'));var VoiceQueueReport=require(_0xda9b('0x1'))['db'][_0xda9b('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xda9b('0x3'),'afterUpdate':_0xda9b('0x4'),'afterDestroy':_0xda9b('0x5')};function emitEvent(_0x588162){return function(_0x470802,_0x558e5d,_0x5d1a81){VoiceQueueReportEvents[_0xda9b('0x6')](_0x588162+':'+_0x470802['id'],_0x470802);VoiceQueueReportEvents[_0xda9b('0x6')](_0x588162,_0x470802);_0x5d1a81(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xda9b('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index e2e34ae..8657a1a 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 _0x2032=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0x2032,0xd9));var _0x2203=function(_0x2cf813,_0x5774e6){_0x2cf813=_0x2cf813-0x0;var _0x2efe02=_0x2032[_0x2cf813];return _0x2efe02;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2203('0xc')]},{'fields':[_0x2203('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x57b6cf,_0x57c58c){var _0x2ecc77=function(_0x4bb058){while(--_0x4bb058){_0x57b6cf['push'](_0x57b6cf['shift']());}};_0x2ecc77(++_0x57c58c);}(_0x757a,0xde));var _0xa757=function(_0x21a6d8,_0x5b3943){_0x21a6d8=_0x21a6d8-0x0;var _0x5398e9=_0x757a[_0x21a6d8];return _0x5398e9;};'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 diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 475ab09..d3e683f 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 _0x1fcd=['raw','attributes','limit','include','map','model','catch','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','where','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options'];(function(_0x51b236,_0x31044f){var _0x1d5261=function(_0x3278d6){while(--_0x3278d6){_0x51b236['push'](_0x51b236['shift']());}};_0x1d5261(++_0x31044f);}(_0x1fcd,0x19c));var _0xd1fc=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x1fcd[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0xd1fc('0x0'));var util=require('util');var moment=require(_0xd1fc('0x1'));var BPromise=require(_0xd1fc('0x2'));var rs=require(_0xd1fc('0x3'));var fs=require('fs');var Redis=require(_0xd1fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd1fc('0x5'))('rpc');var config=require(_0xd1fc('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd1fc('0x7')]({'port':0x232a});config['redis']=_[_0xd1fc('0x8')](config[_0xd1fc('0x9')],{'host':_0xd1fc('0xa'),'port':0x18eb});var socket=require(_0xd1fc('0xb'))(new Redis(config[_0xd1fc('0x9')]));require(_0xd1fc('0xc'))['register'](socket);function respondWithRpcPromise(_0x471972,_0xc210b4,_0x1f335e){return new BPromise(function(_0x126d8c,_0x175505){return client[_0xd1fc('0xd')](_0x471972,_0x1f335e)[_0xd1fc('0xe')](function(_0x4e9cb9){logger[_0xd1fc('0xf')](_0xd1fc('0x10'),_0xc210b4,_0xd1fc('0x11'));logger[_0xd1fc('0x12')](_0xd1fc('0x13'),_0xc210b4,_0xd1fc('0x11'),JSON[_0xd1fc('0x14')](_0x4e9cb9));if(_0x4e9cb9[_0xd1fc('0x15')]){if(_0x4e9cb9[_0xd1fc('0x15')]['code']===0x1f4){logger[_0xd1fc('0x15')](_0xd1fc('0x10'),_0xc210b4,_0x4e9cb9[_0xd1fc('0x15')][_0xd1fc('0x16')]);return _0x175505(_0x4e9cb9[_0xd1fc('0x15')]['message']);}logger['error'](_0xd1fc('0x10'),_0xc210b4,_0x4e9cb9['error'][_0xd1fc('0x16')]);return _0x126d8c(_0x4e9cb9[_0xd1fc('0x15')][_0xd1fc('0x16')]);}else{logger[_0xd1fc('0xf')](_0xd1fc('0x10'),_0xc210b4,_0xd1fc('0x11'));_0x126d8c(_0x4e9cb9[_0xd1fc('0x17')][_0xd1fc('0x16')]);}})['catch'](function(_0x1d0f40){logger[_0xd1fc('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0xc210b4,_0x1d0f40);_0x175505(_0x1d0f40);});});}exports[_0xd1fc('0x18')]=function(_0x36d5a9){var _0x1f8fe2=this;return new Promise(function(_0x41940b,_0x47fb62){return db[_0xd1fc('0x19')][_0xd1fc('0x1a')]({'raw':_0x36d5a9[_0xd1fc('0x1b')]?_0x36d5a9[_0xd1fc('0x1b')][_0xd1fc('0x1c')]===undefined?!![]:![]:!![],'where':_0x36d5a9[_0xd1fc('0x1b')]?_0x36d5a9['options']['where']||null:null,'attributes':_0x36d5a9[_0xd1fc('0x1b')]?_0x36d5a9[_0xd1fc('0x1b')][_0xd1fc('0x1d')]||null:null,'limit':_0x36d5a9[_0xd1fc('0x1b')]?_0x36d5a9[_0xd1fc('0x1b')][_0xd1fc('0x1e')]||null:null,'include':_0x36d5a9[_0xd1fc('0x1b')]?_0x36d5a9[_0xd1fc('0x1b')][_0xd1fc('0x1f')]?_[_0xd1fc('0x20')](_0x36d5a9['options'][_0xd1fc('0x1f')],function(_0x202ba8){return{'model':db[_0x202ba8['model']],'as':_0x202ba8['as'],'attributes':_0x202ba8[_0xd1fc('0x1d')],'include':_0x202ba8[_0xd1fc('0x1f')]?_[_0xd1fc('0x20')](_0x202ba8['include'],function(_0x2aac34){return{'model':db[_0x2aac34[_0xd1fc('0x21')]],'as':_0x2aac34['as'],'attributes':_0x2aac34[_0xd1fc('0x1d')],'include':_0x2aac34[_0xd1fc('0x1f')]?_[_0xd1fc('0x20')](_0x2aac34[_0xd1fc('0x1f')],function(_0x5b028d){return{'model':db[_0x5b028d['model']],'as':_0x5b028d['as'],'attributes':_0x5b028d[_0xd1fc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd1fc('0xe')](function(_0x29d2fe){logger['info'](_0xd1fc('0x18'),_0x36d5a9);logger[_0xd1fc('0x12')](_0xd1fc('0x18'),_0x36d5a9,JSON['stringify'](_0x29d2fe));_0x41940b(_0x29d2fe);})[_0xd1fc('0x22')](function(_0x37be38){logger['error'](_0xd1fc('0x18'),_0x37be38[_0xd1fc('0x16')],_0x36d5a9);_0x47fb62(_0x1f8fe2[_0xd1fc('0x15')](0x1f4,_0x37be38['message']));});});};exports['CreateVoiceQueueReport']=function(_0x4d9c00){var _0x188fb5=this;return new Promise(function(_0x42e0b8,_0x2ba0ca){return db[_0xd1fc('0x19')][_0xd1fc('0x23')](_0x4d9c00[_0xd1fc('0x24')],{'raw':_0x4d9c00[_0xd1fc('0x1b')]?_0x4d9c00[_0xd1fc('0x1b')][_0xd1fc('0x1c')]===undefined?!![]:![]:!![]})[_0xd1fc('0xe')](function(_0x4e9183){logger[_0xd1fc('0xf')](_0xd1fc('0x25'),_0x4d9c00);logger[_0xd1fc('0x12')]('CreateVoiceQueueReport',_0x4d9c00,JSON[_0xd1fc('0x14')](_0x4e9183));_0x42e0b8(_0x4e9183);})[_0xd1fc('0x22')](function(_0x5608ee){logger[_0xd1fc('0x15')](_0xd1fc('0x25'),_0x5608ee['message'],_0x4d9c00);_0x2ba0ca(_0x188fb5[_0xd1fc('0x15')](0x1f4,_0x5608ee[_0xd1fc('0x16')]));});});};exports[_0xd1fc('0x26')]=function(_0x2c7e55){var _0x424963=this;return new Promise(function(_0x28615c,_0x3212c1){return db[_0xd1fc('0x19')]['update'](_0x2c7e55[_0xd1fc('0x24')],{'raw':_0x2c7e55[_0xd1fc('0x1b')]?_0x2c7e55['options'][_0xd1fc('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c7e55['options']?_0x2c7e55['options'][_0xd1fc('0x27')]||null:null,'attributes':_0x2c7e55['options']?_0x2c7e55[_0xd1fc('0x1b')][_0xd1fc('0x1d')]||null:null,'limit':_0x2c7e55[_0xd1fc('0x1b')]?_0x2c7e55[_0xd1fc('0x1b')][_0xd1fc('0x1e')]||null:null})[_0xd1fc('0xe')](function(_0x4a9bd0){logger['info'](_0xd1fc('0x26'),_0x2c7e55);logger[_0xd1fc('0x12')]('UpdateVoiceQueueReport',_0x2c7e55,JSON['stringify'](_0x4a9bd0));_0x28615c(_0x4a9bd0);})[_0xd1fc('0x22')](function(_0x1831b2){logger[_0xd1fc('0x15')](_0xd1fc('0x26'),_0x1831b2[_0xd1fc('0x16')],_0x2c7e55);_0x3212c1(_0x424963[_0xd1fc('0x15')](0x1f4,_0x1831b2[_0xd1fc('0x16')]));});});}; \ No newline at end of file +var _0xd49c=['include','model','stringify','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','then','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','VoiceQueueReport,\x20%s,\x20%s','info','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','map'];(function(_0x5d51a6,_0x40a51a){var _0x1e20b1=function(_0x36f6fe){while(--_0x36f6fe){_0x5d51a6['push'](_0x5d51a6['shift']());}};_0x1e20b1(++_0x40a51a);}(_0xd49c,0x178));var _0xcd49=function(_0x1ef689,_0x463724){_0x1ef689=_0x1ef689-0x0;var _0x184e99=_0xd49c[_0x1ef689];return _0x184e99;};'use strict';var _=require(_0xcd49('0x0'));var util=require('util');var moment=require(_0xcd49('0x1'));var BPromise=require(_0xcd49('0x2'));var rs=require(_0xcd49('0x3'));var fs=require('fs');var Redis=require(_0xcd49('0x4'));var db=require(_0xcd49('0x5'))['db'];var utils=require(_0xcd49('0x6'));var logger=require(_0xcd49('0x7'))(_0xcd49('0x8'));var config=require(_0xcd49('0x9'));var jayson=require(_0xcd49('0xa'));var client=jayson[_0xcd49('0xb')][_0xcd49('0xc')]({'port':0x232a});config[_0xcd49('0xd')]=_[_0xcd49('0xe')](config[_0xcd49('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd49('0xf'))(new Redis(config[_0xcd49('0xd')]));require(_0xcd49('0x10'))[_0xcd49('0x11')](socket);function respondWithRpcPromise(_0x940e8d,_0x979f28,_0x5da886){return new BPromise(function(_0x5e5a1f,_0x549a20){return client[_0xcd49('0x12')](_0x940e8d,_0x5da886)[_0xcd49('0x13')](function(_0x586fb0){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x979f28,'request\x20sent');logger[_0xcd49('0x14')](_0xcd49('0x15'),_0x979f28,_0xcd49('0x16'),JSON['stringify'](_0x586fb0));if(_0x586fb0[_0xcd49('0x17')]){if(_0x586fb0[_0xcd49('0x17')][_0xcd49('0x18')]===0x1f4){logger[_0xcd49('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x979f28,_0x586fb0['error'][_0xcd49('0x19')]);return _0x549a20(_0x586fb0['error']['message']);}logger[_0xcd49('0x17')](_0xcd49('0x1a'),_0x979f28,_0x586fb0['error'][_0xcd49('0x19')]);return _0x5e5a1f(_0x586fb0['error'][_0xcd49('0x19')]);}else{logger[_0xcd49('0x1b')](_0xcd49('0x1a'),_0x979f28,_0xcd49('0x16'));_0x5e5a1f(_0x586fb0['result'][_0xcd49('0x19')]);}})[_0xcd49('0x1c')](function(_0x1147ce){logger[_0xcd49('0x17')](_0xcd49('0x1a'),_0x979f28,_0x1147ce);_0x549a20(_0x1147ce);});});}exports[_0xcd49('0x1d')]=function(_0x2f567b){var _0x2ee730=this;return new Promise(function(_0x2e9dbb,_0x185909){return db[_0xcd49('0x1e')][_0xcd49('0x1f')]({'raw':_0x2f567b['options']?_0x2f567b[_0xcd49('0x20')][_0xcd49('0x21')]===undefined?!![]:![]:!![],'where':_0x2f567b[_0xcd49('0x20')]?_0x2f567b[_0xcd49('0x20')][_0xcd49('0x22')]||null:null,'attributes':_0x2f567b[_0xcd49('0x20')]?_0x2f567b[_0xcd49('0x20')][_0xcd49('0x23')]||null:null,'limit':_0x2f567b['options']?_0x2f567b[_0xcd49('0x20')][_0xcd49('0x24')]||null:null,'include':_0x2f567b[_0xcd49('0x20')]?_0x2f567b['options']['include']?_[_0xcd49('0x25')](_0x2f567b['options'][_0xcd49('0x26')],function(_0x807ac3){return{'model':db[_0x807ac3[_0xcd49('0x27')]],'as':_0x807ac3['as'],'attributes':_0x807ac3[_0xcd49('0x23')],'include':_0x807ac3['include']?_[_0xcd49('0x25')](_0x807ac3[_0xcd49('0x26')],function(_0x591728){return{'model':db[_0x591728[_0xcd49('0x27')]],'as':_0x591728['as'],'attributes':_0x591728[_0xcd49('0x23')],'include':_0x591728['include']?_[_0xcd49('0x25')](_0x591728['include'],function(_0x21b38c){return{'model':db[_0x21b38c[_0xcd49('0x27')]],'as':_0x21b38c['as'],'attributes':_0x21b38c['attributes']};}):[]};}):[]};}):[]:[]})[_0xcd49('0x13')](function(_0x1a9731){logger[_0xcd49('0x1b')](_0xcd49('0x1d'),_0x2f567b);logger[_0xcd49('0x14')](_0xcd49('0x1d'),_0x2f567b,JSON[_0xcd49('0x28')](_0x1a9731));_0x2e9dbb(_0x1a9731);})[_0xcd49('0x1c')](function(_0x3e850b){logger[_0xcd49('0x17')](_0xcd49('0x1d'),_0x3e850b['message'],_0x2f567b);_0x185909(_0x2ee730['error'](0x1f4,_0x3e850b['message']));});});};exports[_0xcd49('0x29')]=function(_0x4bc3c1){var _0x1bb11f=this;return new Promise(function(_0x20c936,_0x3b32eb){return db[_0xcd49('0x1e')][_0xcd49('0x2a')](_0x4bc3c1[_0xcd49('0x2b')],{'raw':_0x4bc3c1[_0xcd49('0x20')]?_0x4bc3c1['options'][_0xcd49('0x21')]===undefined?!![]:![]:!![]})[_0xcd49('0x13')](function(_0x1c0694){logger[_0xcd49('0x1b')](_0xcd49('0x29'),_0x4bc3c1);logger['debug'](_0xcd49('0x29'),_0x4bc3c1,JSON['stringify'](_0x1c0694));_0x20c936(_0x1c0694);})[_0xcd49('0x1c')](function(_0x5755ef){logger[_0xcd49('0x17')](_0xcd49('0x29'),_0x5755ef[_0xcd49('0x19')],_0x4bc3c1);_0x3b32eb(_0x1bb11f[_0xcd49('0x17')](0x1f4,_0x5755ef['message']));});});};exports[_0xcd49('0x2c')]=function(_0x53fc29){var _0xdcbb7f=this;return new Promise(function(_0x18eb13,_0xc1965){return db['VoiceQueueReport'][_0xcd49('0x2d')](_0x53fc29[_0xcd49('0x2b')],{'raw':_0x53fc29[_0xcd49('0x20')]?_0x53fc29[_0xcd49('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53fc29['options']?_0x53fc29[_0xcd49('0x20')][_0xcd49('0x22')]||null:null,'attributes':_0x53fc29[_0xcd49('0x20')]?_0x53fc29[_0xcd49('0x20')][_0xcd49('0x23')]||null:null,'limit':_0x53fc29[_0xcd49('0x20')]?_0x53fc29[_0xcd49('0x20')]['limit']||null:null})[_0xcd49('0x13')](function(_0x199537){logger['info'](_0xcd49('0x2c'),_0x53fc29);logger[_0xcd49('0x14')](_0xcd49('0x2c'),_0x53fc29,JSON['stringify'](_0x199537));_0x18eb13(_0x199537);})[_0xcd49('0x1c')](function(_0x34caee){logger['error']('UpdateVoiceQueueReport',_0x34caee['message'],_0x53fc29);_0xc1965(_0xdcbb7f[_0xcd49('0x17')](0x1f4,_0x34caee[_0xcd49('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 599ab84..b670392 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 _0x3e7a=['emit','removeListener','./voiceQueueReport.events','remove','update'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0x3e7a,0xb1));var _0xa3e7=function(_0x31cd2a,_0x3e3402){_0x31cd2a=_0x31cd2a-0x0;var _0x38da4e=_0x3e7a[_0x31cd2a];return _0x38da4e;};'use strict';var VoiceQueueReportEvents=require(_0xa3e7('0x0'));var events=['save',_0xa3e7('0x1'),_0xa3e7('0x2')];function createListener(_0x5212c7,_0x566793){return function(_0x575974){_0x566793[_0xa3e7('0x3')](_0x5212c7,_0x575974);};}function removeListener(_0x441170,_0x4f5a8b){return function(){VoiceQueueReportEvents[_0xa3e7('0x4')](_0x441170,_0x4f5a8b);};}exports['register']=function(_0x41c1c3){for(var _0x4ddc9d=0x0,_0x54e4e4=events['length'];_0x4ddc9d<_0x54e4e4;_0x4ddc9d++){var _0x178101=events[_0x4ddc9d];var _0x555f0a=createListener('voiceQueueReport:'+_0x178101,_0x41c1c3);VoiceQueueReportEvents['on'](_0x178101,_0x555f0a);}}; \ No newline at end of file +var _0xe785=['remove','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0xe785,0x13e));var _0x5e78=function(_0x8baa0b,_0x24b3fa){_0x8baa0b=_0x8baa0b-0x0;var _0x5ebdb9=_0xe785[_0x8baa0b];return _0x5ebdb9;};'use strict';var VoiceQueueReportEvents=require(_0x5e78('0x0'));var events=[_0x5e78('0x1'),_0x5e78('0x2'),'update'];function createListener(_0x37e676,_0x440e78){return function(_0x284ffe){_0x440e78[_0x5e78('0x3')](_0x37e676,_0x284ffe);};}function removeListener(_0x369cdb,_0x4695ba){return function(){VoiceQueueReportEvents[_0x5e78('0x4')](_0x369cdb,_0x4695ba);};}exports[_0x5e78('0x5')]=function(_0x14b91b){for(var _0x40518b=0x0,_0xdbe053=events[_0x5e78('0x6')];_0x40518b<_0xdbe053;_0x40518b++){var _0x3b3a7d=events[_0x40518b];var _0x5bd012=createListener(_0x5e78('0x7')+_0x3b3a7d,_0x14b91b);VoiceQueueReportEvents['on'](_0x3b3a7d,_0x5bd012);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index dd5e266..0e53f70 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 _0x6b21=['post','create','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show'];(function(_0x47611c,_0x1c0736){var _0x3bb12d=function(_0x4217b2){while(--_0x4217b2){_0x47611c['push'](_0x47611c['shift']());}};_0x3bb12d(++_0x1c0736);}(_0x6b21,0x112));var _0x16b2=function(_0x231297,_0x52c84c){_0x231297=_0x231297-0x0;var _0x1b9e5d=_0x6b21[_0x231297];return _0x1b9e5d;};'use strict';var multer=require('multer');var util=require(_0x16b2('0x0'));var path=require(_0x16b2('0x1'));var timeout=require(_0x16b2('0x2'));var express=require(_0x16b2('0x3'));var router=express[_0x16b2('0x4')]();var auth=require(_0x16b2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x16b2('0x6'));var controller=require('./voiceQueuesLog.controller');router['get']('/',auth[_0x16b2('0x7')](),controller[_0x16b2('0x8')]);router['get'](_0x16b2('0x9'),auth[_0x16b2('0x7')](),controller[_0x16b2('0xa')]);router[_0x16b2('0xb')]('/',auth[_0x16b2('0x7')](),controller[_0x16b2('0xc')]);router['put'](_0x16b2('0x9'),auth[_0x16b2('0x7')](),controller['update']);router['delete']('/:id',auth[_0x16b2('0x7')](),controller[_0x16b2('0xd')]);module[_0x16b2('0xe')]=router; \ No newline at end of file +var _0x0d0f=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated'];(function(_0x43139e,_0x762629){var _0x2bc838=function(_0x593ec3){while(--_0x593ec3){_0x43139e['push'](_0x43139e['shift']());}};_0x2bc838(++_0x762629);}(_0x0d0f,0x6e));var _0xf0d0=function(_0x62ae03,_0xe5a1d2){_0x62ae03=_0x62ae03-0x0;var _0x335278=_0x0d0f[_0x62ae03];return _0x335278;};'use strict';var multer=require(_0xf0d0('0x0'));var util=require(_0xf0d0('0x1'));var path=require(_0xf0d0('0x2'));var timeout=require(_0xf0d0('0x3'));var express=require(_0xf0d0('0x4'));var router=express[_0xf0d0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf0d0('0x6'));var config=require('../../config/environment');var controller=require(_0xf0d0('0x7'));router[_0xf0d0('0x8')]('/',auth[_0xf0d0('0x9')](),controller[_0xf0d0('0xa')]);router[_0xf0d0('0x8')](_0xf0d0('0xb'),auth[_0xf0d0('0x9')](),controller[_0xf0d0('0xc')]);router[_0xf0d0('0xd')]('/',auth[_0xf0d0('0x9')](),controller[_0xf0d0('0xe')]);router[_0xf0d0('0xf')]('/:id',auth[_0xf0d0('0x9')](),controller[_0xf0d0('0x10')]);router[_0xf0d0('0x11')](_0xf0d0('0xb'),auth[_0xf0d0('0x9')](),controller[_0xf0d0('0x12')]);module[_0xf0d0('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 9b96793..722314e 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 _0x86fd=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0x86fd,0xd4));var _0xd86f=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0x86fd[_0xb7a459];return _0x104ab5;};'use strict';var Sequelize=require(_0xd86f('0x0'));var moment=require(_0xd86f('0x1'));module[_0xd86f('0x2')]={'time':{'type':Sequelize[_0xd86f('0x3')]},'callid':{'type':Sequelize[_0xd86f('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xd86f('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd86f('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xd86f('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xd86f('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd86f('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xd86f('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xd86f('0x4')],'allowNull':![],'defaultValue':moment()[_0xd86f('0x5')](_0xd86f('0x6'))}}; \ No newline at end of file +var _0xd552=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE'];(function(_0x3afbdf,_0x9e463b){var _0x5b6861=function(_0x31d287){while(--_0x31d287){_0x3afbdf['push'](_0x3afbdf['shift']());}};_0x5b6861(++_0x9e463b);}(_0xd552,0x1de));var _0x2d55=function(_0x524346,_0x3a9cdd){_0x524346=_0x524346-0x0;var _0x47a3ea=_0xd552[_0x524346];return _0x47a3ea;};'use strict';var Sequelize=require(_0x2d55('0x0'));var moment=require(_0x2d55('0x1'));module[_0x2d55('0x2')]={'time':{'type':Sequelize[_0x2d55('0x3')]},'callid':{'type':Sequelize[_0x2d55('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x2d55('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x2d55('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x2d55('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x2d55('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x2d55('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x2d55('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x2d55('0x4')],'allowNull':![],'defaultValue':moment()[_0x2d55('0x5')](_0x2d55('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index a814fe3..57c37a9 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 _0xecce=['lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','stack','name','send','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','sort','where','pick','merge','VIRTUAL','filter','options','VoiceQueuesLog','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x52a113,_0x164c4d){var _0x4b4208=function(_0x2a0bcf){while(--_0x2a0bcf){_0x52a113['push'](_0x52a113['shift']());}};_0x4b4208(++_0x164c4d);}(_0xecce,0x1ed));var _0xeecc=function(_0x57402d,_0x3ebd30){_0x57402d=_0x57402d-0x0;var _0x224071=_0xecce[_0x57402d];return _0x224071;};'use strict';var pdf=require(_0xeecc('0x0'));var emlformat=require(_0xeecc('0x1'));var rimraf=require(_0xeecc('0x2'));var zipdir=require(_0xeecc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeecc('0x4'));var BPromise=require(_0xeecc('0x5'));var Mustache=require('mustache');var util=require(_0xeecc('0x6'));var path=require(_0xeecc('0x7'));var sox=require(_0xeecc('0x8'));var csv=require(_0xeecc('0x9'));var ejs=require(_0xeecc('0xa'));var fs=require('fs');var _=require(_0xeecc('0xb'));var squel=require(_0xeecc('0xc'));var crypto=require(_0xeecc('0xd'));var jsforce=require(_0xeecc('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeecc('0xf'));var Redis=require(_0xeecc('0x10'));var authService=require(_0xeecc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeecc('0x12'));var hardwareService=require(_0xeecc('0x13'));var logger=require(_0xeecc('0x14'))(_0xeecc('0x15'));var utils=require(_0xeecc('0x16'));var config=require(_0xeecc('0x17'));var db=require(_0xeecc('0x18'))['db'];function respondWithStatusCode(_0x643f25,_0x5e2fe4){_0x5e2fe4=_0x5e2fe4||0xcc;return function(_0x3d37f1){if(_0x3d37f1){return _0x643f25[_0xeecc('0x19')](_0x5e2fe4);}return _0x643f25[_0xeecc('0x1a')](_0x5e2fe4)[_0xeecc('0x1b')]();};}function respondWithResult(_0x5db93d,_0x2228b0){_0x2228b0=_0x2228b0||0xc8;return function(_0x4147ed){if(_0x4147ed){return _0x5db93d[_0xeecc('0x1a')](_0x2228b0)[_0xeecc('0x1c')](_0x4147ed);}};}function respondWithFilteredResult(_0x374f14,_0xadab41){return function(_0x598582){if(_0x598582){var _0x6f5527=_0x598582[_0xeecc('0x1d')],_0x182023=_0xadab41[_0xeecc('0x1e')],_0x308147=_0xadab41['offset']+_0xadab41[_0xeecc('0x1f')],_0x3d766a;if(_0x308147>=_0x6f5527){_0x308147=_0x6f5527;_0x3d766a=0xc8;}else{_0x3d766a=0xce;}_0x374f14[_0xeecc('0x1a')](_0x3d766a);return _0x374f14[_0xeecc('0x20')](_0xeecc('0x21'),_0x182023+'-'+_0x308147+'/'+_0x6f5527)[_0xeecc('0x1c')](_0x598582);}return null;};}function patchUpdates(_0x408432){return function(_0x18ce74){try{jsonpatch['apply'](_0x18ce74,_0x408432,!![]);}catch(_0x719616){return BPromise[_0xeecc('0x22')](_0x719616);}return _0x18ce74[_0xeecc('0x23')]();};}function saveUpdates(_0x5b991a,_0x13ad26){return function(_0x47d25e){if(_0x47d25e){return _0x47d25e[_0xeecc('0x24')](_0x5b991a)[_0xeecc('0x25')](function(_0x5d5b1b){return _0x5d5b1b;});}return null;};}function removeEntity(_0x4a7003,_0x4b605b){return function(_0x1b1b01){if(_0x1b1b01){return _0x1b1b01['destroy']()['then'](function(){_0x4a7003[_0xeecc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb9be4,_0xcf3434){return function(_0x52f53c){if(!_0x52f53c){_0xfb9be4[_0xeecc('0x19')](0x194);}return _0x52f53c;};}function handleError(_0x3b00ec,_0xc3831a){_0xc3831a=_0xc3831a||0x1f4;return function(_0x277a26){logger['error'](_0x277a26[_0xeecc('0x26')]);if(_0x277a26[_0xeecc('0x27')]){delete _0x277a26[_0xeecc('0x27')];}_0x3b00ec[_0xeecc('0x1a')](_0xc3831a)[_0xeecc('0x28')](_0x277a26);};}exports['index']=function(_0x5cc156,_0x5231c8){var _0x414bc7={},_0xbb27c5={},_0x16b64d={'count':0x0,'rows':[]};var _0x462203=_['map'](db['VoiceQueuesLog'][_0xeecc('0x29')],function(_0x1011d4){return{'name':_0x1011d4['fieldName'],'type':_0x1011d4[_0xeecc('0x2a')][_0xeecc('0x2b')]};});_0xbb27c5[_0xeecc('0x2c')]=_[_0xeecc('0x2d')](_0x462203,_0xeecc('0x27'));_0xbb27c5[_0xeecc('0x2e')]=_[_0xeecc('0x2f')](_0x5cc156[_0xeecc('0x2e')]);_0xbb27c5[_0xeecc('0x30')]=_['intersection'](_0xbb27c5['model'],_0xbb27c5[_0xeecc('0x2e')]);_0x414bc7[_0xeecc('0x31')]=_[_0xeecc('0x32')](_0xbb27c5[_0xeecc('0x2c')],qs[_0xeecc('0x33')](_0x5cc156['query']['fields']));_0x414bc7[_0xeecc('0x31')]=_0x414bc7['attributes']['length']?_0x414bc7[_0xeecc('0x31')]:_0xbb27c5[_0xeecc('0x2c')];if(!_0x5cc156['query']['hasOwnProperty']('nolimit')){_0x414bc7[_0xeecc('0x1f')]=qs['limit'](_0x5cc156['query'][_0xeecc('0x1f')]);_0x414bc7[_0xeecc('0x1e')]=qs['offset'](_0x5cc156[_0xeecc('0x2e')][_0xeecc('0x1e')]);}_0x414bc7['order']=qs['sort'](_0x5cc156[_0xeecc('0x2e')][_0xeecc('0x34')]);_0x414bc7[_0xeecc('0x35')]=qs[_0xeecc('0x30')](_[_0xeecc('0x36')](_0x5cc156['query'],_0xbb27c5[_0xeecc('0x30')]));if(_0x5cc156[_0xeecc('0x2e')]['filter']){_0x414bc7[_0xeecc('0x35')]=_[_0xeecc('0x37')](_0x414bc7['where'],{'$or':_[_0xeecc('0x2d')](_0x462203,function(_0xd56be8){if(_0xd56be8[_0xeecc('0x2a')]!==_0xeecc('0x38')){var _0x27e173={};_0x27e173[_0xd56be8['name']]={'$like':'%'+_0x5cc156[_0xeecc('0x2e')][_0xeecc('0x39')]+'%'};return _0x27e173;}})});}_0x414bc7=_[_0xeecc('0x37')]({},_0x414bc7,_0x5cc156[_0xeecc('0x3a')]);var _0x2a85cb={'where':_0x414bc7[_0xeecc('0x35')]};return db[_0xeecc('0x3b')][_0xeecc('0x1d')](_0x2a85cb)[_0xeecc('0x25')](function(_0x571f06){_0x16b64d[_0xeecc('0x1d')]=_0x571f06;if(_0x5cc156['query'][_0xeecc('0x3c')]){_0x414bc7['include']=[{'all':!![]}];}return db[_0xeecc('0x3b')][_0xeecc('0x3d')](_0x414bc7);})[_0xeecc('0x25')](function(_0x2f5835){_0x16b64d[_0xeecc('0x3e')]=_0x2f5835;return _0x16b64d;})[_0xeecc('0x25')](respondWithFilteredResult(_0x5231c8,_0x414bc7))[_0xeecc('0x3f')](handleError(_0x5231c8,null));};exports[_0xeecc('0x40')]=function(_0x19ef1e,_0x3b8200){var _0x420921={'raw':!![],'where':{'id':_0x19ef1e[_0xeecc('0x41')]['id']}},_0xbd4465={};_0xbd4465['model']=_[_0xeecc('0x2f')](db['VoiceQueuesLog'][_0xeecc('0x29')]);_0xbd4465[_0xeecc('0x2e')]=_['keys'](_0x19ef1e[_0xeecc('0x2e')]);_0xbd4465['filters']=_['intersection'](_0xbd4465['model'],_0xbd4465[_0xeecc('0x2e')]);_0x420921[_0xeecc('0x31')]=_[_0xeecc('0x32')](_0xbd4465[_0xeecc('0x2c')],qs[_0xeecc('0x33')](_0x19ef1e[_0xeecc('0x2e')][_0xeecc('0x33')]));_0x420921[_0xeecc('0x31')]=_0x420921[_0xeecc('0x31')][_0xeecc('0x42')]?_0x420921['attributes']:_0xbd4465['model'];if(_0x19ef1e[_0xeecc('0x2e')][_0xeecc('0x3c')]){_0x420921[_0xeecc('0x43')]=[{'all':!![]}];}_0x420921=_[_0xeecc('0x37')]({},_0x420921,_0x19ef1e['options']);return db[_0xeecc('0x3b')][_0xeecc('0x44')](_0x420921)['then'](handleEntityNotFound(_0x3b8200,null))['then'](respondWithResult(_0x3b8200,null))['catch'](handleError(_0x3b8200,null));};exports['create']=function(_0x4aa9af,_0x5dba54){return db[_0xeecc('0x3b')][_0xeecc('0x45')](_0x4aa9af[_0xeecc('0x46')],{})['then'](respondWithResult(_0x5dba54,0xc9))[_0xeecc('0x3f')](handleError(_0x5dba54,null));};exports[_0xeecc('0x24')]=function(_0x1d1fc6,_0x2b683e){if(_0x1d1fc6[_0xeecc('0x46')]['id']){delete _0x1d1fc6[_0xeecc('0x46')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x1d1fc6[_0xeecc('0x41')]['id']}})[_0xeecc('0x25')](handleEntityNotFound(_0x2b683e,null))[_0xeecc('0x25')](saveUpdates(_0x1d1fc6[_0xeecc('0x46')],null))['then'](respondWithResult(_0x2b683e,null))[_0xeecc('0x3f')](handleError(_0x2b683e,null));};exports[_0xeecc('0x47')]=function(_0x19caf3,_0x5662eb){return db['VoiceQueuesLog']['find']({'where':{'id':_0x19caf3[_0xeecc('0x41')]['id']}})[_0xeecc('0x25')](handleEntityNotFound(_0x5662eb,null))[_0xeecc('0x25')](removeEntity(_0x5662eb,null))[_0xeecc('0x3f')](handleError(_0x5662eb,null));}; \ No newline at end of file +var _0x854a=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','reject','save','then','destroy','sendStatus','error','name','send','index','VoiceQueuesLog','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','include','keys','rawAttributes','options','find','catch','create','body','update','params'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0x854a,0x18c));var _0xa854=function(_0x56690e,_0x3af6a5){_0x56690e=_0x56690e-0x0;var _0x5baac2=_0x854a[_0x56690e];return _0x5baac2;};'use strict';var pdf=require(_0xa854('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa854('0x1'));var zipdir=require(_0xa854('0x2'));var jsonpatch=require(_0xa854('0x3'));var rp=require(_0xa854('0x4'));var moment=require(_0xa854('0x5'));var BPromise=require(_0xa854('0x6'));var Mustache=require('mustache');var util=require(_0xa854('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa854('0x8'));var ejs=require(_0xa854('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa854('0xa'));var crypto=require(_0xa854('0xb'));var jsforce=require(_0xa854('0xc'));var deskjs=require(_0xa854('0xd'));var toCsv=require(_0xa854('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa854('0xe'));var authService=require(_0xa854('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa854('0x10'));var hardwareService=require(_0xa854('0x11'));var logger=require(_0xa854('0x12'))(_0xa854('0x13'));var utils=require('../../config/utils');var config=require(_0xa854('0x14'));var db=require(_0xa854('0x15'))['db'];function respondWithStatusCode(_0x382416,_0x2c8142){_0x2c8142=_0x2c8142||0xcc;return function(_0x591bd3){if(_0x591bd3){return _0x382416['sendStatus'](_0x2c8142);}return _0x382416[_0xa854('0x16')](_0x2c8142)[_0xa854('0x17')]();};}function respondWithResult(_0x96c307,_0x8e1a63){_0x8e1a63=_0x8e1a63||0xc8;return function(_0x2fbbf1){if(_0x2fbbf1){return _0x96c307[_0xa854('0x16')](_0x8e1a63)[_0xa854('0x18')](_0x2fbbf1);}};}function respondWithFilteredResult(_0x588343,_0x253f18){return function(_0x572cea){if(_0x572cea){var _0x53043e=_0x572cea[_0xa854('0x19')],_0x31e54d=_0x253f18[_0xa854('0x1a')],_0x13da64=_0x253f18[_0xa854('0x1a')]+_0x253f18[_0xa854('0x1b')],_0x37d7c3;if(_0x13da64>=_0x53043e){_0x13da64=_0x53043e;_0x37d7c3=0xc8;}else{_0x37d7c3=0xce;}_0x588343[_0xa854('0x16')](_0x37d7c3);return _0x588343[_0xa854('0x1c')]('Content-Range',_0x31e54d+'-'+_0x13da64+'/'+_0x53043e)[_0xa854('0x18')](_0x572cea);}return null;};}function patchUpdates(_0x149ccf){return function(_0x3163ba){try{jsonpatch['apply'](_0x3163ba,_0x149ccf,!![]);}catch(_0x27a2b1){return BPromise[_0xa854('0x1d')](_0x27a2b1);}return _0x3163ba[_0xa854('0x1e')]();};}function saveUpdates(_0x4abefb,_0x32215d){return function(_0x4b405b){if(_0x4b405b){return _0x4b405b['update'](_0x4abefb)[_0xa854('0x1f')](function(_0x21ffb4){return _0x21ffb4;});}return null;};}function removeEntity(_0x668f05,_0x44fff1){return function(_0x3024fe){if(_0x3024fe){return _0x3024fe[_0xa854('0x20')]()[_0xa854('0x1f')](function(){_0x668f05[_0xa854('0x16')](0xcc)[_0xa854('0x17')]();});}};}function handleEntityNotFound(_0x1d73d2,_0x1ba4a8){return function(_0x249628){if(!_0x249628){_0x1d73d2[_0xa854('0x21')](0x194);}return _0x249628;};}function handleError(_0x480515,_0x3d6b02){_0x3d6b02=_0x3d6b02||0x1f4;return function(_0x4ffe25){logger[_0xa854('0x22')](_0x4ffe25['stack']);if(_0x4ffe25[_0xa854('0x23')]){delete _0x4ffe25[_0xa854('0x23')];}_0x480515[_0xa854('0x16')](_0x3d6b02)[_0xa854('0x24')](_0x4ffe25);};}exports[_0xa854('0x25')]=function(_0x5b9213,_0x37906d){var _0x585d40={},_0x2a37ed={},_0x417ae3={'count':0x0,'rows':[]};var _0x178e63=_['map'](db[_0xa854('0x26')]['rawAttributes'],function(_0x367ed0){return{'name':_0x367ed0['fieldName'],'type':_0x367ed0['type'][_0xa854('0x27')]};});_0x2a37ed['model']=_[_0xa854('0x28')](_0x178e63,_0xa854('0x23'));_0x2a37ed[_0xa854('0x29')]=_['keys'](_0x5b9213[_0xa854('0x29')]);_0x2a37ed[_0xa854('0x2a')]=_[_0xa854('0x2b')](_0x2a37ed[_0xa854('0x2c')],_0x2a37ed[_0xa854('0x29')]);_0x585d40[_0xa854('0x2d')]=_['intersection'](_0x2a37ed['model'],qs[_0xa854('0x2e')](_0x5b9213[_0xa854('0x29')][_0xa854('0x2e')]));_0x585d40[_0xa854('0x2d')]=_0x585d40['attributes'][_0xa854('0x2f')]?_0x585d40[_0xa854('0x2d')]:_0x2a37ed[_0xa854('0x2c')];if(!_0x5b9213[_0xa854('0x29')][_0xa854('0x30')](_0xa854('0x31'))){_0x585d40[_0xa854('0x1b')]=qs['limit'](_0x5b9213[_0xa854('0x29')][_0xa854('0x1b')]);_0x585d40[_0xa854('0x1a')]=qs[_0xa854('0x1a')](_0x5b9213['query'][_0xa854('0x1a')]);}_0x585d40[_0xa854('0x32')]=qs[_0xa854('0x33')](_0x5b9213[_0xa854('0x29')][_0xa854('0x33')]);_0x585d40[_0xa854('0x34')]=qs[_0xa854('0x2a')](_[_0xa854('0x35')](_0x5b9213[_0xa854('0x29')],_0x2a37ed['filters']));if(_0x5b9213['query']['filter']){_0x585d40[_0xa854('0x34')]=_[_0xa854('0x36')](_0x585d40['where'],{'$or':_['map'](_0x178e63,function(_0x25ce2c){if(_0x25ce2c['type']!=='VIRTUAL'){var _0x3d88f0={};_0x3d88f0[_0x25ce2c['name']]={'$like':'%'+_0x5b9213[_0xa854('0x29')]['filter']+'%'};return _0x3d88f0;}})});}_0x585d40=_[_0xa854('0x36')]({},_0x585d40,_0x5b9213['options']);var _0x4f93cb={'where':_0x585d40[_0xa854('0x34')]};return db[_0xa854('0x26')][_0xa854('0x19')](_0x4f93cb)[_0xa854('0x1f')](function(_0xe47b8e){_0x417ae3[_0xa854('0x19')]=_0xe47b8e;if(_0x5b9213[_0xa854('0x29')][_0xa854('0x37')]){_0x585d40[_0xa854('0x38')]=[{'all':!![]}];}return db[_0xa854('0x26')]['findAll'](_0x585d40);})[_0xa854('0x1f')](function(_0x57f993){_0x417ae3['rows']=_0x57f993;return _0x417ae3;})[_0xa854('0x1f')](respondWithFilteredResult(_0x37906d,_0x585d40))['catch'](handleError(_0x37906d,null));};exports['show']=function(_0x2d7ee2,_0x147e72){var _0x419220={'raw':!![],'where':{'id':_0x2d7ee2['params']['id']}},_0x20df48={};_0x20df48[_0xa854('0x2c')]=_[_0xa854('0x39')](db[_0xa854('0x26')][_0xa854('0x3a')]);_0x20df48['query']=_[_0xa854('0x39')](_0x2d7ee2[_0xa854('0x29')]);_0x20df48['filters']=_[_0xa854('0x2b')](_0x20df48[_0xa854('0x2c')],_0x20df48[_0xa854('0x29')]);_0x419220[_0xa854('0x2d')]=_[_0xa854('0x2b')](_0x20df48['model'],qs[_0xa854('0x2e')](_0x2d7ee2[_0xa854('0x29')]['fields']));_0x419220[_0xa854('0x2d')]=_0x419220[_0xa854('0x2d')][_0xa854('0x2f')]?_0x419220[_0xa854('0x2d')]:_0x20df48[_0xa854('0x2c')];if(_0x2d7ee2['query'][_0xa854('0x37')]){_0x419220['include']=[{'all':!![]}];}_0x419220=_[_0xa854('0x36')]({},_0x419220,_0x2d7ee2[_0xa854('0x3b')]);return db[_0xa854('0x26')][_0xa854('0x3c')](_0x419220)[_0xa854('0x1f')](handleEntityNotFound(_0x147e72,null))[_0xa854('0x1f')](respondWithResult(_0x147e72,null))[_0xa854('0x3d')](handleError(_0x147e72,null));};exports[_0xa854('0x3e')]=function(_0x4a95aa,_0x312783){return db[_0xa854('0x26')]['create'](_0x4a95aa[_0xa854('0x3f')],{})[_0xa854('0x1f')](respondWithResult(_0x312783,0xc9))[_0xa854('0x3d')](handleError(_0x312783,null));};exports[_0xa854('0x40')]=function(_0xf547f0,_0x4f7275){if(_0xf547f0[_0xa854('0x3f')]['id']){delete _0xf547f0['body']['id'];}return db[_0xa854('0x26')][_0xa854('0x3c')]({'where':{'id':_0xf547f0[_0xa854('0x41')]['id']}})[_0xa854('0x1f')](handleEntityNotFound(_0x4f7275,null))[_0xa854('0x1f')](saveUpdates(_0xf547f0['body'],null))[_0xa854('0x1f')](respondWithResult(_0x4f7275,null))[_0xa854('0x3d')](handleError(_0x4f7275,null));};exports['destroy']=function(_0x492828,_0x2161a7){return db[_0xa854('0x26')][_0xa854('0x3c')]({'where':{'id':_0x492828['params']['id']}})[_0xa854('0x1f')](handleEntityNotFound(_0x2161a7,null))[_0xa854('0x1f')](removeEntity(_0x2161a7,null))['catch'](handleError(_0x2161a7,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 6b8fa5d..9cd6cd3 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 _0xcf22=['event_dtm','dtm','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log'];(function(_0x5cc671,_0x155e5c){var _0x44a7dd=function(_0x2385a1){while(--_0x2385a1){_0x5cc671['push'](_0x5cc671['shift']());}};_0x44a7dd(++_0x155e5c);}(_0xcf22,0x122));var _0x2cf2=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xcf22[_0x256b72];return _0x2183e3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2cf2('0x0'));var BPromise=require(_0x2cf2('0x1'));var rp=require(_0x2cf2('0x2'));var fs=require('fs');var path=require(_0x2cf2('0x3'));var rimraf=require(_0x2cf2('0x4'));var config=require(_0x2cf2('0x5'));var attributes=require(_0x2cf2('0x6'));module[_0x2cf2('0x7')]=function(_0xe118ac,_0x11ca77){return _0xe118ac[_0x2cf2('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0x2cf2('0x9'),'paranoid':![],'indexes':[{'name':_0x2cf2('0xa'),'fields':['event',_0x2cf2('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc541=['dtm','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','event_dtm','event'];(function(_0x3dd893,_0x485c75){var _0xeef91=function(_0x536fe3){while(--_0x536fe3){_0x3dd893['push'](_0x3dd893['shift']());}};_0xeef91(++_0x485c75);}(_0xc541,0x194));var _0x1c54=function(_0x3438cf,_0x73b174){_0x3438cf=_0x3438cf-0x0;var _0x278698=_0xc541[_0x3438cf];return _0x278698;};'use strict';var _=require(_0x1c54('0x0'));var util=require('util');var logger=require(_0x1c54('0x1'))('api');var moment=require(_0x1c54('0x2'));var BPromise=require(_0x1c54('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c54('0x4'));var rimraf=require(_0x1c54('0x5'));var config=require(_0x1c54('0x6'));var attributes=require(_0x1c54('0x7'));module['exports']=function(_0xfd56ed,_0x513e45){return _0xfd56ed[_0x1c54('0x8')](_0x1c54('0x9'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x1c54('0xa'),'fields':[_0x1c54('0xb'),_0x1c54('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index bc08b26..ced3d7b 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 _0x1d2d=['lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2bcee3,_0x5517b3){var _0x478941=function(_0x2c369e){while(--_0x2c369e){_0x2bcee3['push'](_0x2bcee3['shift']());}};_0x478941(++_0x5517b3);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x5c0627,_0x1c404f){_0x5c0627=_0x5c0627-0x0;var _0x4a83a6=_0x1d2d[_0x5c0627];return _0x4a83a6;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var moment=require(_0xd1d2('0x2'));var BPromise=require(_0xd1d2('0x3'));var rs=require(_0xd1d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd1d2('0x6'));var config=require(_0xd1d2('0x7'));var jayson=require(_0xd1d2('0x8'));var client=jayson[_0xd1d2('0x9')][_0xd1d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x353dbd,_0x55be7a,_0x1eaf41){return new BPromise(function(_0x21bc28,_0x35735f){return client[_0xd1d2('0xb')](_0x353dbd,_0x1eaf41)[_0xd1d2('0xc')](function(_0x59e484){logger[_0xd1d2('0xd')](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));logger[_0xd1d2('0x10')](_0xd1d2('0x11'),_0x55be7a,_0xd1d2('0xf'),JSON[_0xd1d2('0x12')](_0x59e484));if(_0x59e484['error']){if(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x14')]===0x1f4){logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);return _0x35735f(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484['error'][_0xd1d2('0x15')]);return _0x21bc28(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}else{logger['info'](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));_0x21bc28(_0x59e484[_0xd1d2('0x16')][_0xd1d2('0x15')]);}})[_0xd1d2('0x17')](function(_0x2723b3){logger[_0xd1d2('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x55be7a,_0x2723b3);_0x35735f(_0x2723b3);});});} \ No newline at end of file +var _0x1bc6=['then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5a9a58,_0x466b47){var _0x24dbe9=function(_0x9f4a11){while(--_0x9f4a11){_0x5a9a58['push'](_0x5a9a58['shift']());}};_0x24dbe9(++_0x466b47);}(_0x1bc6,0x94));var _0x61bc=function(_0x22ffde,_0x49995d){_0x22ffde=_0x22ffde-0x0;var _0x1fe872=_0x1bc6[_0x22ffde];return _0x1fe872;};'use strict';var _=require(_0x61bc('0x0'));var util=require(_0x61bc('0x1'));var moment=require(_0x61bc('0x2'));var BPromise=require(_0x61bc('0x3'));var rs=require(_0x61bc('0x4'));var fs=require('fs');var Redis=require(_0x61bc('0x5'));var db=require(_0x61bc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x61bc('0x7'))(_0x61bc('0x8'));var config=require(_0x61bc('0x9'));var jayson=require(_0x61bc('0xa'));var client=jayson[_0x61bc('0xb')][_0x61bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x410656,_0x1b29e3,_0x151ef4){return new BPromise(function(_0x5ebb87,_0x339305){return client['request'](_0x410656,_0x151ef4)[_0x61bc('0xd')](function(_0x502dc0){logger[_0x61bc('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1b29e3,_0x61bc('0xf'));logger[_0x61bc('0x10')](_0x61bc('0x11'),_0x1b29e3,'request\x20sent',JSON['stringify'](_0x502dc0));if(_0x502dc0['error']){if(_0x502dc0['error']['code']===0x1f4){logger[_0x61bc('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1b29e3,_0x502dc0[_0x61bc('0x12')][_0x61bc('0x13')]);return _0x339305(_0x502dc0['error']['message']);}logger['error'](_0x61bc('0x14'),_0x1b29e3,_0x502dc0[_0x61bc('0x12')]['message']);return _0x5ebb87(_0x502dc0[_0x61bc('0x12')][_0x61bc('0x13')]);}else{logger[_0x61bc('0xe')](_0x61bc('0x14'),_0x1b29e3,_0x61bc('0xf'));_0x5ebb87(_0x502dc0[_0x61bc('0x15')]['message']);}})[_0x61bc('0x16')](function(_0x21b974){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x1b29e3,_0x21b974);_0x339305(_0x21b974);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 4a2ca5a..89c4a94 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 _0x9f76=['connect-timeout','express','Router','../../components/interaction/service','./voiceRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','downloads','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x53ca5d,_0x11e148){var _0x17b26d=function(_0x177f7d){while(--_0x177f7d){_0x53ca5d['push'](_0x53ca5d['shift']());}};_0x17b26d(++_0x11e148);}(_0x9f76,0x1ca));var _0x69f7=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x9f76[_0x164eca];return _0x2ce562;};'use strict';var multer=require(_0x69f7('0x0'));var util=require(_0x69f7('0x1'));var path=require('path');var timeout=require(_0x69f7('0x2'));var express=require(_0x69f7('0x3'));var router=express[_0x69f7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x69f7('0x5'));var config=require('../../config/environment');var controller=require(_0x69f7('0x6'));router[_0x69f7('0x7')]('/',auth['isAuthenticated'](),controller[_0x69f7('0x8')]);router[_0x69f7('0x7')](_0x69f7('0x9'),auth[_0x69f7('0xa')](),controller[_0x69f7('0xb')]);router[_0x69f7('0x7')](_0x69f7('0xc'),auth[_0x69f7('0xa')](),controller[_0x69f7('0xd')]);router[_0x69f7('0x7')](_0x69f7('0xe'),auth[_0x69f7('0xa')](),controller['download']);router['get']('/:id/downloads',controller[_0x69f7('0xf')]);router[_0x69f7('0x10')]('/',auth[_0x69f7('0xa')](),controller[_0x69f7('0x11')]);router[_0x69f7('0x12')](_0x69f7('0xc'),auth['isAuthenticated'](),controller[_0x69f7('0x13')]);router[_0x69f7('0x14')]('/:id',auth[_0x69f7('0xa')](),controller[_0x69f7('0x15')]);module[_0x69f7('0x16')]=router; \ No newline at end of file +var _0xcd4f=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','/:id/downloads','downloads','delete','destroy'];(function(_0x21524e,_0x46a290){var _0x565275=function(_0x378b28){while(--_0x378b28){_0x21524e['push'](_0x21524e['shift']());}};_0x565275(++_0x46a290);}(_0xcd4f,0x1cf));var _0xfcd4=function(_0x52c2a2,_0x1fcb97){_0x52c2a2=_0x52c2a2-0x0;var _0x4b589c=_0xcd4f[_0x52c2a2];return _0x4b589c;};'use strict';var multer=require(_0xfcd4('0x0'));var util=require('util');var path=require(_0xfcd4('0x1'));var timeout=require(_0xfcd4('0x2'));var express=require(_0xfcd4('0x3'));var router=express[_0xfcd4('0x4')]();var auth=require(_0xfcd4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfcd4('0x6'));var controller=require(_0xfcd4('0x7'));router[_0xfcd4('0x8')]('/',auth[_0xfcd4('0x9')](),controller[_0xfcd4('0xa')]);router[_0xfcd4('0x8')](_0xfcd4('0xb'),auth[_0xfcd4('0x9')](),controller[_0xfcd4('0xc')]);router[_0xfcd4('0x8')](_0xfcd4('0xd'),auth['isAuthenticated'](),controller[_0xfcd4('0xe')]);router[_0xfcd4('0x8')](_0xfcd4('0xf'),auth[_0xfcd4('0x9')](),controller['download']);router[_0xfcd4('0x8')](_0xfcd4('0x10'),controller[_0xfcd4('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfcd4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xfcd4('0x12')](_0xfcd4('0xd'),auth[_0xfcd4('0x9')](),controller[_0xfcd4('0x13')]);module[_0xfcd4('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 6151f65..38c5ccb 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 _0x8d62=['moment','exports','VIRTUAL','getDataValue','value','extname','STRING','channel','setDataValue','membername','DATE','format','updatedAt','MM-DD-YYYY\x20HH:mm','toString','sequelize'];(function(_0x5a055f,_0x380821){var _0xafe578=function(_0xd9ef82){while(--_0xd9ef82){_0x5a055f['push'](_0x5a055f['shift']());}};_0xafe578(++_0x380821);}(_0x8d62,0x15f));var _0x28d6=function(_0x13174d,_0x532076){_0x13174d=_0x13174d-0x0;var _0x5f5b9c=_0x8d62[_0x13174d];return _0x5f5b9c;};'use strict';var Sequelize=require(_0x28d6('0x0'));var moment=require(_0x28d6('0x1'));var path=require('path');module[_0x28d6('0x2')]={'format':{'type':Sequelize[_0x28d6('0x3')],'get':function(){return this[_0x28d6('0x4')](_0x28d6('0x5'))?path[_0x28d6('0x6')](this['getDataValue'](_0x28d6('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x28d6('0x7')]},'channel':{'type':Sequelize[_0x28d6('0x7')],'set':function(_0x1b0e16){if(_0x1b0e16){this['setDataValue'](_0x28d6('0x8'),_0x1b0e16);this[_0x28d6('0x9')](_0x28d6('0xa'),_0x1b0e16['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x28d6('0x7')]},'calleridnum':{'type':Sequelize[_0x28d6('0x7')]},'calleridname':{'type':Sequelize[_0x28d6('0x7')]},'connectedlinenum':{'type':Sequelize[_0x28d6('0x7')]},'connectedlinename':{'type':Sequelize[_0x28d6('0x7')]},'accountcode':{'type':Sequelize[_0x28d6('0x7')]},'context':{'type':Sequelize[_0x28d6('0x7')]},'exten':{'type':Sequelize[_0x28d6('0x7')]},'value':{'type':Sequelize[_0x28d6('0x7')]},'type':{'type':Sequelize[_0x28d6('0x7')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x28d6('0x7')]},'createdAt':{'type':Sequelize[_0x28d6('0xb')],'get':function(){return moment(this[_0x28d6('0x4')]('createdAt'))[_0x28d6('0xc')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x28d6('0xb')],'get':function(){return moment(this['getDataValue'](_0x28d6('0xd')))[_0x28d6('0xc')](_0x28d6('0xe'))[_0x28d6('0xf')]();}}}; \ No newline at end of file +var _0x399d=['split','INTEGER','DATE','createdAt','MM-DD-YYYY\x20HH:mm','toString','updatedAt','format','path','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel'];(function(_0x413409,_0x4aabda){var _0x7bb8fa=function(_0x143f0d){while(--_0x143f0d){_0x413409['push'](_0x413409['shift']());}};_0x7bb8fa(++_0x4aabda);}(_0x399d,0x1d8));var _0xd399=function(_0xf1dec0,_0x45a34c){_0xf1dec0=_0xf1dec0-0x0;var _0x3547b6=_0x399d[_0xf1dec0];return _0x3547b6;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0xd399('0x0'));module['exports']={'format':{'type':Sequelize[_0xd399('0x1')],'get':function(){return this[_0xd399('0x2')](_0xd399('0x3'))?path[_0xd399('0x4')](this[_0xd399('0x2')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0xd399('0x5')]},'channel':{'type':Sequelize[_0xd399('0x5')],'set':function(_0xa9afd6){if(_0xa9afd6){this[_0xd399('0x6')](_0xd399('0x7'),_0xa9afd6);this[_0xd399('0x6')]('membername',_0xa9afd6[_0xd399('0x8')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xd399('0x5')]},'calleridnum':{'type':Sequelize[_0xd399('0x5')]},'calleridname':{'type':Sequelize[_0xd399('0x5')]},'connectedlinenum':{'type':Sequelize[_0xd399('0x5')]},'connectedlinename':{'type':Sequelize[_0xd399('0x5')]},'accountcode':{'type':Sequelize[_0xd399('0x5')]},'context':{'type':Sequelize[_0xd399('0x5')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xd399('0x5')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0xd399('0x9')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xd399('0x5')]},'createdAt':{'type':Sequelize[_0xd399('0xa')],'get':function(){return moment(this['getDataValue'](_0xd399('0xb')))['format'](_0xd399('0xc'))[_0xd399('0xd')]();}},'updatedAt':{'type':Sequelize[_0xd399('0xa')],'get':function(){return moment(this[_0xd399('0x2')](_0xd399('0xe')))[_0xd399('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xd399('0xd')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index bb0c56d..9124d8b 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 _0xe940=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','intersection','attributes','fields','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','show','length','find','create','catch','body','params','describe','../../components/encryptor','uniqueid','value','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','decryptFile','secrets','download','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js'];(function(_0x36234b,_0x4332d3){var _0x18737e=function(_0xb0bff0){while(--_0xb0bff0){_0x36234b['push'](_0x36234b['shift']());}};_0x18737e(++_0x4332d3);}(_0xe940,0xcd));var _0x0e94=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe940[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x0e94('0x0'));var emlformat=require(_0x0e94('0x1'));var rimraf=require(_0x0e94('0x2'));var zipdir=require(_0x0e94('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e94('0x4'));var moment=require(_0x0e94('0x5'));var BPromise=require(_0x0e94('0x6'));var Mustache=require(_0x0e94('0x7'));var util=require(_0x0e94('0x8'));var path=require(_0x0e94('0x9'));var sox=require(_0x0e94('0xa'));var csv=require('to-csv');var ejs=require(_0x0e94('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0e94('0xc'));var jsforce=require(_0x0e94('0xd'));var deskjs=require(_0x0e94('0xe'));var toCsv=require(_0x0e94('0xf'));var querystring=require(_0x0e94('0x10'));var Papa=require(_0x0e94('0x11'));var Redis=require(_0x0e94('0x12'));var authService=require(_0x0e94('0x13'));var qs=require(_0x0e94('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e94('0x15'));var logger=require('../../config/logger')(_0x0e94('0x16'));var utils=require('../../config/utils');var config=require(_0x0e94('0x17'));var db=require(_0x0e94('0x18'))['db'];function respondWithStatusCode(_0x289bce,_0x27426e){_0x27426e=_0x27426e||0xcc;return function(_0x2a6cff){if(_0x2a6cff){return _0x289bce['sendStatus'](_0x27426e);}return _0x289bce['status'](_0x27426e)[_0x0e94('0x19')]();};}function respondWithResult(_0x4ea008,_0xa46abc){_0xa46abc=_0xa46abc||0xc8;return function(_0x2d7180){if(_0x2d7180){return _0x4ea008[_0x0e94('0x1a')](_0xa46abc)['json'](_0x2d7180);}};}function respondWithFilteredResult(_0x599879,_0x1be9f5){return function(_0x330aa5){if(_0x330aa5){var _0xd4f693=_0x330aa5[_0x0e94('0x1b')],_0x58ec60=_0x1be9f5[_0x0e94('0x1c')],_0x58c7c5=_0x1be9f5[_0x0e94('0x1c')]+_0x1be9f5['limit'],_0x4edc38;if(_0x58c7c5>=_0xd4f693){_0x58c7c5=_0xd4f693;_0x4edc38=0xc8;}else{_0x4edc38=0xce;}_0x599879['status'](_0x4edc38);return _0x599879[_0x0e94('0x1d')](_0x0e94('0x1e'),_0x58ec60+'-'+_0x58c7c5+'/'+_0xd4f693)[_0x0e94('0x1f')](_0x330aa5);}return null;};}function patchUpdates(_0x41c225){return function(_0x30266a){try{jsonpatch[_0x0e94('0x20')](_0x30266a,_0x41c225,!![]);}catch(_0xb040e8){return BPromise[_0x0e94('0x21')](_0xb040e8);}return _0x30266a[_0x0e94('0x22')]();};}function saveUpdates(_0xe6625d,_0x48d11d){return function(_0x5a3320){if(_0x5a3320){return _0x5a3320[_0x0e94('0x23')](_0xe6625d)['then'](function(_0x7def5){return _0x7def5;});}return null;};}function removeEntity(_0x29d62e,_0x43fc16){return function(_0x3da38d){if(_0x3da38d){return _0x3da38d[_0x0e94('0x24')]()['then'](function(){_0x29d62e[_0x0e94('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb8d5a4,_0x3685a4){return function(_0x564061){if(!_0x564061){_0xb8d5a4[_0x0e94('0x25')](0x194);}return _0x564061;};}function handleError(_0x18a0c7,_0x3be9fb){_0x3be9fb=_0x3be9fb||0x1f4;return function(_0x132f17){logger[_0x0e94('0x26')](_0x132f17[_0x0e94('0x27')]);if(_0x132f17['name']){delete _0x132f17[_0x0e94('0x28')];}_0x18a0c7[_0x0e94('0x1a')](_0x3be9fb)[_0x0e94('0x29')](_0x132f17);};}exports['index']=function(_0x354fbb,_0x1b71d2){var _0x41ed00={},_0x3909d9={},_0x2ea4a8={'count':0x0,'rows':[]};var _0x443eed=_[_0x0e94('0x2a')](db[_0x0e94('0x2b')][_0x0e94('0x2c')],function(_0x3df0ff){return{'name':_0x3df0ff[_0x0e94('0x2d')],'type':_0x3df0ff[_0x0e94('0x2e')][_0x0e94('0x2f')]};});_0x3909d9[_0x0e94('0x30')]=_[_0x0e94('0x31')](_[_0x0e94('0x2a')](_0x443eed,_0x0e94('0x28')),[_0x0e94('0x32')]);_0x3909d9[_0x0e94('0x33')]=_[_0x0e94('0x34')](_0x354fbb[_0x0e94('0x33')]);_0x3909d9['filters']=_[_0x0e94('0x35')](_0x3909d9[_0x0e94('0x30')],_0x3909d9[_0x0e94('0x33')]);_0x41ed00[_0x0e94('0x36')]=_[_0x0e94('0x35')](_0x3909d9[_0x0e94('0x30')],qs[_0x0e94('0x37')](_0x354fbb[_0x0e94('0x33')][_0x0e94('0x37')]));_0x41ed00['attributes']=_0x41ed00[_0x0e94('0x36')]['length']?_0x41ed00[_0x0e94('0x36')]:_0x3909d9[_0x0e94('0x30')];if(!_0x354fbb['query']['hasOwnProperty']('nolimit')){_0x41ed00[_0x0e94('0x38')]=qs[_0x0e94('0x38')](_0x354fbb[_0x0e94('0x33')][_0x0e94('0x38')]);_0x41ed00[_0x0e94('0x1c')]=qs['offset'](_0x354fbb[_0x0e94('0x33')][_0x0e94('0x1c')]);}_0x41ed00[_0x0e94('0x39')]=qs['sort'](_0x354fbb[_0x0e94('0x33')][_0x0e94('0x3a')]);_0x41ed00[_0x0e94('0x3b')]=qs[_0x0e94('0x3c')](_[_0x0e94('0x3d')](_0x354fbb['query'],_0x3909d9['filters']));if(_0x354fbb[_0x0e94('0x33')][_0x0e94('0x3e')]){_0x41ed00[_0x0e94('0x3b')]=_[_0x0e94('0x3f')](_0x41ed00[_0x0e94('0x3b')],{'$or':_[_0x0e94('0x2a')](_0x443eed,function(_0x4b3468){if(_0x4b3468[_0x0e94('0x2e')]!==_0x0e94('0x40')){var _0x34d14e={};_0x34d14e[_0x4b3468[_0x0e94('0x28')]]={'$like':'%'+_0x354fbb[_0x0e94('0x33')][_0x0e94('0x3e')]+'%'};return _0x34d14e;}})});}_0x41ed00=_['merge']({},_0x41ed00,_0x354fbb[_0x0e94('0x41')]);var _0x4e0c30={'where':_0x41ed00['where']};return db[_0x0e94('0x2b')][_0x0e94('0x1b')](_0x4e0c30)['then'](function(_0x4a8977){_0x2ea4a8[_0x0e94('0x1b')]=_0x4a8977;if(_0x354fbb[_0x0e94('0x33')][_0x0e94('0x42')]){_0x41ed00[_0x0e94('0x43')]=[{'all':!![]}];}return db[_0x0e94('0x2b')][_0x0e94('0x44')](_0x41ed00);})[_0x0e94('0x45')](function(_0x392aed){_0x2ea4a8['rows']=_0x392aed;return _0x2ea4a8;})['then'](respondWithFilteredResult(_0x1b71d2,_0x41ed00))['catch'](handleError(_0x1b71d2,null));};exports[_0x0e94('0x46')]=function(_0x534b33,_0x4602f1){var _0x377186={'raw':![],'where':{'id':_0x534b33['params']['id']}},_0x281e28={};_0x281e28[_0x0e94('0x30')]=_[_0x0e94('0x34')](db[_0x0e94('0x2b')][_0x0e94('0x2c')]);_0x281e28['query']=_[_0x0e94('0x34')](_0x534b33[_0x0e94('0x33')]);_0x281e28[_0x0e94('0x3c')]=_[_0x0e94('0x35')](_0x281e28['model'],_0x281e28[_0x0e94('0x33')]);_0x377186['attributes']=_['intersection'](_0x281e28['model'],qs[_0x0e94('0x37')](_0x534b33[_0x0e94('0x33')][_0x0e94('0x37')]));_0x377186['attributes']=_0x377186[_0x0e94('0x36')][_0x0e94('0x47')]?_0x377186[_0x0e94('0x36')]:_0x281e28[_0x0e94('0x30')];if(_0x534b33[_0x0e94('0x33')][_0x0e94('0x42')]){_0x377186[_0x0e94('0x43')]=[{'all':!![]}];}_0x377186=_[_0x0e94('0x3f')]({},_0x377186,_0x534b33['options']);return db[_0x0e94('0x2b')][_0x0e94('0x48')](_0x377186)['then'](handleEntityNotFound(_0x4602f1,null))['then'](respondWithResult(_0x4602f1,null))['catch'](handleError(_0x4602f1,null));};exports['create']=function(_0x1d88e8,_0x434ae1){return db['VoiceRecording'][_0x0e94('0x49')](_0x1d88e8['body'],{})[_0x0e94('0x45')](respondWithResult(_0x434ae1,0xc9))[_0x0e94('0x4a')](handleError(_0x434ae1,null));};exports[_0x0e94('0x23')]=function(_0x5d4580,_0x23b50f){if(_0x5d4580[_0x0e94('0x4b')]['id']){delete _0x5d4580[_0x0e94('0x4b')]['id'];}return db[_0x0e94('0x2b')][_0x0e94('0x48')]({'where':{'id':_0x5d4580[_0x0e94('0x4c')]['id']}})[_0x0e94('0x45')](handleEntityNotFound(_0x23b50f,null))[_0x0e94('0x45')](saveUpdates(_0x5d4580[_0x0e94('0x4b')],null))[_0x0e94('0x45')](respondWithResult(_0x23b50f,null))[_0x0e94('0x4a')](handleError(_0x23b50f,null));};exports[_0x0e94('0x4d')]=function(_0x3484d8,_0x3d071d){return db['VoiceRecording'][_0x0e94('0x4d')]()[_0x0e94('0x45')](respondWithResult(_0x3d071d,null))[_0x0e94('0x4a')](handleError(_0x3d071d,null));};exports['download']=function(_0x284299,_0x4c14ab,_0x4df9ae){var _0x45537d=require(_0x0e94('0x4e'));var _0x351f47=![];var _0x1c9cbf={};if(_0x284299[_0x0e94('0x33')][_0x0e94('0x2e')]&&_0x284299['query']['type']===_0x0e94('0x4f')){_0x1c9cbf[_0x0e94('0x4f')]=_0x284299[_0x0e94('0x4c')]['id'];}else{_0x1c9cbf['id']=_0x284299[_0x0e94('0x4c')]['id'];}return db['VoiceRecording']['find']({'where':_0x1c9cbf,'attributes':['id','value'],'raw':!![]})[_0x0e94('0x45')](handleEntityNotFound(_0x4c14ab,null))['then'](function(_0x40716a){if(_0x40716a){var _0xdda2f9=_0x40716a[_0x0e94('0x50')];var _0x36bd32=util[_0x0e94('0x32')]('%s.cypher',_0xdda2f9);if(fs['existsSync'](_0x36bd32)){_0x351f47=!![];return _0x45537d['decryptFile'](_0x36bd32,_0xdda2f9,config['secrets'][_0x0e94('0x51')])['then'](function(){return _0x40716a;});}return _0x40716a;}})['then'](function(_0x2d92b0){if(_0x2d92b0){var _0x200791=_0x2d92b0[_0x0e94('0x50')];if(!fs[_0x0e94('0x52')](_0x200791)){throw new db[(_0x0e94('0x53'))][(_0x0e94('0x54'))](_0x0e94('0x55'));}if(_0x2d92b0[_0x0e94('0x56')]){return _0x4c14ab['download'](_0x200791,_0x2d92b0['filename']+path[_0x0e94('0x57')](_0x200791),function(){if(_0x351f47){fs[_0x0e94('0x58')](_0x200791);}});}else{return _0x4c14ab['download'](_0x200791,function(_0x25291f){if(_0x351f47){fs[_0x0e94('0x58')](_0x200791);}});}}})[_0x0e94('0x4a')](function(_0x4313ba){if(_0x4313ba[_0x0e94('0x59')]===_0x0e94('0x55')){_0x4c14ab['status'](0x194)['send'](_0x0e94('0x5a'));}else{return handleError(_0x4c14ab,null);}});};exports[_0x0e94('0x5b')]=function(_0x2ef030,_0xceae7e,_0x2c9a02){var _0x3c2b41=require(_0x0e94('0x4e'));var _0x49e68c=![];var _0x371082={'$and':[db[_0x0e94('0x5c')][_0x0e94('0x3b')](db['sequelize']['fn'](_0x0e94('0x5d'),db['sequelize'][_0x0e94('0x5e')](_0x0e94('0x4f'))),_0x2ef030['query'][_0x0e94('0x5f')])]};if(_0x2ef030[_0x0e94('0x33')][_0x0e94('0x2e')]&&_0x2ef030[_0x0e94('0x33')][_0x0e94('0x2e')]===_0x0e94('0x4f')){_0x371082[_0x0e94('0x60')][_0x0e94('0x61')]({'uniqueid':_0x2ef030['params']['id']});}else{_0x371082[_0x0e94('0x60')][_0x0e94('0x61')]({'id':_0x2ef030[_0x0e94('0x4c')]['id']});}return db[_0x0e94('0x2b')][_0x0e94('0x48')]({'where':_0x371082,'attributes':['id',_0x0e94('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0xceae7e,null))[_0x0e94('0x45')](function(_0x989e7b){if(_0x989e7b){var _0x53a644=util['format'](_0x0e94('0x62'),_0x989e7b[_0x0e94('0x50')]);if(fs[_0x0e94('0x52')](_0x53a644)){_0x49e68c=!![];return _0x3c2b41[_0x0e94('0x63')](_0x53a644,_0x989e7b[_0x0e94('0x50')],config[_0x0e94('0x64')]['recording'])[_0x0e94('0x45')](function(){return _0x989e7b;});}return _0x989e7b;}})[_0x0e94('0x45')](function(_0x4ea12b){if(_0x4ea12b){if(!fs[_0x0e94('0x52')](_0x4ea12b['value'])){throw new db[(_0x0e94('0x53'))][(_0x0e94('0x54'))](_0x0e94('0x55'));}if(_0x4ea12b[_0x0e94('0x56')]){return _0xceae7e[_0x0e94('0x65')](_0x4ea12b[_0x0e94('0x50')],_0x4ea12b[_0x0e94('0x56')]+path[_0x0e94('0x57')](_0x4ea12b[_0x0e94('0x50')]),function(){if(_0x49e68c){fs['unlink'](_0x4ea12b[_0x0e94('0x50')]);}});}else{return _0xceae7e[_0x0e94('0x65')](_0x4ea12b['value'],function(_0x359b33){if(_0x49e68c){fs[_0x0e94('0x58')](_0x4ea12b[_0x0e94('0x50')]);}});}}})[_0x0e94('0x4a')](handleError(_0xceae7e,null));};exports[_0x0e94('0x24')]=function(_0x56848d,_0x2ca977){return db[_0x0e94('0x2b')][_0x0e94('0x48')]({'where':{'id':_0x56848d['params']['id']}})[_0x0e94('0x45')](function(_0x12513a){if(!_0x12513a)throw new ReferenceError(_0x0e94('0x66'));return _0x12513a;})[_0x0e94('0x45')](function(_0x2ec2b4){var _0x404094=_0x2ec2b4['value'];logger[_0x0e94('0x67')](_0x0e94('0x68'),_0x404094);if(!_[_0x0e94('0x69')](_0x2ec2b4['value'])&&fs[_0x0e94('0x52')](_0x404094)){logger['info'](_0x0e94('0x6a')+_0x404094+_0x0e94('0x6b'));fs[_0x0e94('0x6c')](_0x404094);}_0x404094=_0x404094+_0x0e94('0x6d');if(!_[_0x0e94('0x69')](_0x2ec2b4[_0x0e94('0x50')])&&fs['existsSync'](_0x404094)){logger[_0x0e94('0x67')](_0x0e94('0x6a')+_0x404094+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0e94('0x6c')](_0x404094);}return _0x2ec2b4;})['then'](function(_0x42e461){if(!_0x42e461)throw new InternalError();return _0x42e461[_0x0e94('0x24')]();})[_0x0e94('0x45')](function(){_0x2ca977[_0x0e94('0x1a')](0xcc)[_0x0e94('0x19')]();})[_0x0e94('0x4a')](handleError(_0x2ca977,null));}; \ No newline at end of file +var _0x5f93=['format','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','unlink','Not\x20found','downloads','sequelize','MD5','$and','push','extname','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','status','end','sendStatus','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy'];(function(_0x472e79,_0x3a2bbb){var _0x30d4ff=function(_0x34bc60){while(--_0x34bc60){_0x472e79['push'](_0x472e79['shift']());}};_0x30d4ff(++_0x3a2bbb);}(_0x5f93,0x106));var _0x35f9=function(_0x3482d8,_0x48ee94){_0x3482d8=_0x3482d8-0x0;var _0x2bdecc=_0x5f93[_0x3482d8];return _0x2bdecc;};'use strict';var pdf=require(_0x35f9('0x0'));var emlformat=require(_0x35f9('0x1'));var rimraf=require(_0x35f9('0x2'));var zipdir=require(_0x35f9('0x3'));var jsonpatch=require(_0x35f9('0x4'));var rp=require(_0x35f9('0x5'));var moment=require('moment');var BPromise=require(_0x35f9('0x6'));var Mustache=require(_0x35f9('0x7'));var util=require(_0x35f9('0x8'));var path=require(_0x35f9('0x9'));var sox=require('sox');var csv=require(_0x35f9('0xa'));var ejs=require(_0x35f9('0xb'));var fs=require('fs');var _=require(_0x35f9('0xc'));var squel=require('squel');var crypto=require(_0x35f9('0xd'));var jsforce=require(_0x35f9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x35f9('0xa'));var querystring=require('querystring');var Papa=require(_0x35f9('0xf'));var Redis=require(_0x35f9('0x10'));var authService=require(_0x35f9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x35f9('0x12'));var hardwareService=require(_0x35f9('0x13'));var logger=require(_0x35f9('0x14'))(_0x35f9('0x15'));var utils=require('../../config/utils');var config=require(_0x35f9('0x16'));var db=require(_0x35f9('0x17'))['db'];function respondWithStatusCode(_0x34cdae,_0x336ceb){_0x336ceb=_0x336ceb||0xcc;return function(_0x2092b0){if(_0x2092b0){return _0x34cdae['sendStatus'](_0x336ceb);}return _0x34cdae['status'](_0x336ceb)['end']();};}function respondWithResult(_0x3300b8,_0x2ca82b){_0x2ca82b=_0x2ca82b||0xc8;return function(_0x3c8ef7){if(_0x3c8ef7){return _0x3300b8['status'](_0x2ca82b)[_0x35f9('0x18')](_0x3c8ef7);}};}function respondWithFilteredResult(_0x354cfb,_0x4fe5e0){return function(_0x4e9f16){if(_0x4e9f16){var _0x1b7599=_0x4e9f16[_0x35f9('0x19')],_0x2cd0e3=_0x4fe5e0['offset'],_0x389fdb=_0x4fe5e0['offset']+_0x4fe5e0[_0x35f9('0x1a')],_0x4cda29;if(_0x389fdb>=_0x1b7599){_0x389fdb=_0x1b7599;_0x4cda29=0xc8;}else{_0x4cda29=0xce;}_0x354cfb['status'](_0x4cda29);return _0x354cfb[_0x35f9('0x1b')](_0x35f9('0x1c'),_0x2cd0e3+'-'+_0x389fdb+'/'+_0x1b7599)[_0x35f9('0x18')](_0x4e9f16);}return null;};}function patchUpdates(_0x3d2c4c){return function(_0x37c046){try{jsonpatch[_0x35f9('0x1d')](_0x37c046,_0x3d2c4c,!![]);}catch(_0x41affd){return BPromise[_0x35f9('0x1e')](_0x41affd);}return _0x37c046[_0x35f9('0x1f')]();};}function saveUpdates(_0x3cc357,_0x5cb0b8){return function(_0x3ee058){if(_0x3ee058){return _0x3ee058[_0x35f9('0x20')](_0x3cc357)[_0x35f9('0x21')](function(_0x28964d){return _0x28964d;});}return null;};}function removeEntity(_0x1fc7f6,_0x2a410c){return function(_0x394c1d){if(_0x394c1d){return _0x394c1d[_0x35f9('0x22')]()[_0x35f9('0x21')](function(){_0x1fc7f6[_0x35f9('0x23')](0xcc)[_0x35f9('0x24')]();});}};}function handleEntityNotFound(_0x41dea3,_0x4ba4c6){return function(_0x1e2356){if(!_0x1e2356){_0x41dea3[_0x35f9('0x25')](0x194);}return _0x1e2356;};}function handleError(_0x2b9d10,_0x1417c5){_0x1417c5=_0x1417c5||0x1f4;return function(_0x17daad){logger[_0x35f9('0x26')](_0x17daad[_0x35f9('0x27')]);if(_0x17daad[_0x35f9('0x28')]){delete _0x17daad['name'];}_0x2b9d10['status'](_0x1417c5)[_0x35f9('0x29')](_0x17daad);};}exports[_0x35f9('0x2a')]=function(_0x4546da,_0x377cc0){var _0x47be01={},_0xf57067={},_0x26423f={'count':0x0,'rows':[]};var _0x21d5fe=_[_0x35f9('0x2b')](db[_0x35f9('0x2c')][_0x35f9('0x2d')],function(_0x11bb7d){return{'name':_0x11bb7d[_0x35f9('0x2e')],'type':_0x11bb7d[_0x35f9('0x2f')][_0x35f9('0x30')]};});_0xf57067['model']=_[_0x35f9('0x31')](_[_0x35f9('0x2b')](_0x21d5fe,_0x35f9('0x28')),[_0x35f9('0x32')]);_0xf57067[_0x35f9('0x33')]=_[_0x35f9('0x34')](_0x4546da['query']);_0xf57067[_0x35f9('0x35')]=_[_0x35f9('0x36')](_0xf57067['model'],_0xf57067[_0x35f9('0x33')]);_0x47be01[_0x35f9('0x37')]=_[_0x35f9('0x36')](_0xf57067['model'],qs[_0x35f9('0x38')](_0x4546da['query']['fields']));_0x47be01[_0x35f9('0x37')]=_0x47be01[_0x35f9('0x37')][_0x35f9('0x39')]?_0x47be01['attributes']:_0xf57067[_0x35f9('0x3a')];if(!_0x4546da[_0x35f9('0x33')][_0x35f9('0x3b')]('nolimit')){_0x47be01['limit']=qs[_0x35f9('0x1a')](_0x4546da[_0x35f9('0x33')][_0x35f9('0x1a')]);_0x47be01[_0x35f9('0x3c')]=qs[_0x35f9('0x3c')](_0x4546da[_0x35f9('0x33')][_0x35f9('0x3c')]);}_0x47be01['order']=qs['sort'](_0x4546da['query'][_0x35f9('0x3d')]);_0x47be01[_0x35f9('0x3e')]=qs['filters'](_[_0x35f9('0x3f')](_0x4546da[_0x35f9('0x33')],_0xf57067[_0x35f9('0x35')]));if(_0x4546da[_0x35f9('0x33')][_0x35f9('0x40')]){_0x47be01['where']=_[_0x35f9('0x41')](_0x47be01[_0x35f9('0x3e')],{'$or':_[_0x35f9('0x2b')](_0x21d5fe,function(_0x410327){if(_0x410327['type']!==_0x35f9('0x42')){var _0x3ad027={};_0x3ad027[_0x410327['name']]={'$like':'%'+_0x4546da[_0x35f9('0x33')][_0x35f9('0x40')]+'%'};return _0x3ad027;}})});}_0x47be01=_[_0x35f9('0x41')]({},_0x47be01,_0x4546da[_0x35f9('0x43')]);var _0x56b039={'where':_0x47be01[_0x35f9('0x3e')]};return db[_0x35f9('0x2c')][_0x35f9('0x19')](_0x56b039)[_0x35f9('0x21')](function(_0x3f24a9){_0x26423f[_0x35f9('0x19')]=_0x3f24a9;if(_0x4546da[_0x35f9('0x33')][_0x35f9('0x44')]){_0x47be01[_0x35f9('0x45')]=[{'all':!![]}];}return db[_0x35f9('0x2c')]['findAll'](_0x47be01);})[_0x35f9('0x21')](function(_0x5541c3){_0x26423f[_0x35f9('0x46')]=_0x5541c3;return _0x26423f;})[_0x35f9('0x21')](respondWithFilteredResult(_0x377cc0,_0x47be01))[_0x35f9('0x47')](handleError(_0x377cc0,null));};exports[_0x35f9('0x48')]=function(_0x1bcb42,_0x103836){var _0x1c5e30={'raw':![],'where':{'id':_0x1bcb42[_0x35f9('0x49')]['id']}},_0x28a240={};_0x28a240[_0x35f9('0x3a')]=_[_0x35f9('0x34')](db[_0x35f9('0x2c')][_0x35f9('0x2d')]);_0x28a240[_0x35f9('0x33')]=_['keys'](_0x1bcb42['query']);_0x28a240[_0x35f9('0x35')]=_[_0x35f9('0x36')](_0x28a240[_0x35f9('0x3a')],_0x28a240['query']);_0x1c5e30[_0x35f9('0x37')]=_[_0x35f9('0x36')](_0x28a240[_0x35f9('0x3a')],qs[_0x35f9('0x38')](_0x1bcb42[_0x35f9('0x33')][_0x35f9('0x38')]));_0x1c5e30[_0x35f9('0x37')]=_0x1c5e30[_0x35f9('0x37')][_0x35f9('0x39')]?_0x1c5e30['attributes']:_0x28a240[_0x35f9('0x3a')];if(_0x1bcb42['query'][_0x35f9('0x44')]){_0x1c5e30[_0x35f9('0x45')]=[{'all':!![]}];}_0x1c5e30=_[_0x35f9('0x41')]({},_0x1c5e30,_0x1bcb42[_0x35f9('0x43')]);return db[_0x35f9('0x2c')][_0x35f9('0x4a')](_0x1c5e30)[_0x35f9('0x21')](handleEntityNotFound(_0x103836,null))[_0x35f9('0x21')](respondWithResult(_0x103836,null))['catch'](handleError(_0x103836,null));};exports[_0x35f9('0x4b')]=function(_0x344b44,_0x2569c4){return db['VoiceRecording'][_0x35f9('0x4b')](_0x344b44['body'],{})['then'](respondWithResult(_0x2569c4,0xc9))[_0x35f9('0x47')](handleError(_0x2569c4,null));};exports[_0x35f9('0x20')]=function(_0xe59543,_0x3eaf81){if(_0xe59543['body']['id']){delete _0xe59543['body']['id'];}return db[_0x35f9('0x2c')][_0x35f9('0x4a')]({'where':{'id':_0xe59543[_0x35f9('0x49')]['id']}})[_0x35f9('0x21')](handleEntityNotFound(_0x3eaf81,null))[_0x35f9('0x21')](saveUpdates(_0xe59543[_0x35f9('0x4c')],null))[_0x35f9('0x21')](respondWithResult(_0x3eaf81,null))['catch'](handleError(_0x3eaf81,null));};exports['describe']=function(_0x8356b0,_0x5c3465){return db[_0x35f9('0x2c')]['describe']()['then'](respondWithResult(_0x5c3465,null))[_0x35f9('0x47')](handleError(_0x5c3465,null));};exports['download']=function(_0x454501,_0x527068,_0x1d44fc){var _0xd826eb=require(_0x35f9('0x4d'));var _0x37b459=![];var _0x93d0a9={};if(_0x454501[_0x35f9('0x33')][_0x35f9('0x2f')]&&_0x454501[_0x35f9('0x33')][_0x35f9('0x2f')]===_0x35f9('0x4e')){_0x93d0a9['uniqueid']=_0x454501['params']['id'];}else{_0x93d0a9['id']=_0x454501[_0x35f9('0x49')]['id'];}return db['VoiceRecording'][_0x35f9('0x4a')]({'where':_0x93d0a9,'attributes':['id',_0x35f9('0x4f')],'raw':!![]})[_0x35f9('0x21')](handleEntityNotFound(_0x527068,null))[_0x35f9('0x21')](function(_0x173e35){if(_0x173e35){var _0x5befd8=_0x173e35['value'];var _0xb30b2f=util[_0x35f9('0x32')](_0x35f9('0x50'),_0x5befd8);if(fs['existsSync'](_0xb30b2f)){_0x37b459=!![];return _0xd826eb[_0x35f9('0x51')](_0xb30b2f,_0x5befd8,config[_0x35f9('0x52')][_0x35f9('0x53')])[_0x35f9('0x21')](function(){return _0x173e35;});}return _0x173e35;}})[_0x35f9('0x21')](function(_0x54a5d8){if(_0x54a5d8){var _0x55e328=_0x54a5d8[_0x35f9('0x4f')];if(!fs[_0x35f9('0x54')](_0x55e328)){throw new db[(_0x35f9('0x55'))][(_0x35f9('0x56'))](_0x35f9('0x57'));}if(_0x54a5d8[_0x35f9('0x58')]){return _0x527068[_0x35f9('0x59')](_0x55e328,_0x54a5d8[_0x35f9('0x58')]+path['extname'](_0x55e328),function(){if(_0x37b459){fs[_0x35f9('0x5a')](_0x55e328);}});}else{return _0x527068[_0x35f9('0x59')](_0x55e328,function(_0x2a16b1){if(_0x37b459){fs['unlink'](_0x55e328);}});}}})[_0x35f9('0x47')](function(_0x3c0b96){if(_0x3c0b96['message']===_0x35f9('0x57')){_0x527068[_0x35f9('0x23')](0x194)[_0x35f9('0x29')](_0x35f9('0x5b'));}else{return handleError(_0x527068,null);}});};exports[_0x35f9('0x5c')]=function(_0x36e5a1,_0x4f513f,_0x3d95b7){var _0x50bd14=require(_0x35f9('0x4d'));var _0x284ee4=![];var _0x565744={'$and':[db[_0x35f9('0x5d')][_0x35f9('0x3e')](db[_0x35f9('0x5d')]['fn'](_0x35f9('0x5e'),db[_0x35f9('0x5d')]['col'](_0x35f9('0x4e'))),_0x36e5a1[_0x35f9('0x33')]['token'])]};if(_0x36e5a1[_0x35f9('0x33')][_0x35f9('0x2f')]&&_0x36e5a1['query'][_0x35f9('0x2f')]===_0x35f9('0x4e')){_0x565744[_0x35f9('0x5f')][_0x35f9('0x60')]({'uniqueid':_0x36e5a1[_0x35f9('0x49')]['id']});}else{_0x565744[_0x35f9('0x5f')][_0x35f9('0x60')]({'id':_0x36e5a1[_0x35f9('0x49')]['id']});}return db[_0x35f9('0x2c')]['find']({'where':_0x565744,'attributes':['id',_0x35f9('0x4f')],'raw':!![]})[_0x35f9('0x21')](handleEntityNotFound(_0x4f513f,null))['then'](function(_0x188343){if(_0x188343){var _0x5537e9=util[_0x35f9('0x32')]('%s.cypher',_0x188343[_0x35f9('0x4f')]);if(fs[_0x35f9('0x54')](_0x5537e9)){_0x284ee4=!![];return _0x50bd14['decryptFile'](_0x5537e9,_0x188343['value'],config[_0x35f9('0x52')][_0x35f9('0x53')])[_0x35f9('0x21')](function(){return _0x188343;});}return _0x188343;}})[_0x35f9('0x21')](function(_0x3fa3ac){if(_0x3fa3ac){if(!fs[_0x35f9('0x54')](_0x3fa3ac['value'])){throw new db[(_0x35f9('0x55'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x3fa3ac[_0x35f9('0x58')]){return _0x4f513f[_0x35f9('0x59')](_0x3fa3ac[_0x35f9('0x4f')],_0x3fa3ac[_0x35f9('0x58')]+path[_0x35f9('0x61')](_0x3fa3ac[_0x35f9('0x4f')]),function(){if(_0x284ee4){fs[_0x35f9('0x5a')](_0x3fa3ac[_0x35f9('0x4f')]);}});}else{return _0x4f513f['download'](_0x3fa3ac[_0x35f9('0x4f')],function(_0x1a767f){if(_0x284ee4){fs['unlink'](_0x3fa3ac[_0x35f9('0x4f')]);}});}}})[_0x35f9('0x47')](handleError(_0x4f513f,null));};exports[_0x35f9('0x22')]=function(_0x1c9469,_0x2e8188){return db[_0x35f9('0x2c')][_0x35f9('0x4a')]({'where':{'id':_0x1c9469[_0x35f9('0x49')]['id']}})[_0x35f9('0x21')](function(_0x5347b8){if(!_0x5347b8)throw new ReferenceError(_0x35f9('0x62'));return _0x5347b8;})[_0x35f9('0x21')](function(_0xcc7422){var _0xc9bae0=_0xcc7422['value'];logger[_0x35f9('0x63')](_0x35f9('0x64'),_0xc9bae0);if(!_[_0x35f9('0x65')](_0xcc7422[_0x35f9('0x4f')])&&fs[_0x35f9('0x54')](_0xc9bae0)){logger['info'](_0x35f9('0x66')+_0xc9bae0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x35f9('0x67')](_0xc9bae0);}_0xc9bae0=_0xc9bae0+'.cypher';if(!_[_0x35f9('0x65')](_0xcc7422[_0x35f9('0x4f')])&&fs[_0x35f9('0x54')](_0xc9bae0)){logger[_0x35f9('0x63')]('File:\x20\x22'+_0xc9bae0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x35f9('0x67')](_0xc9bae0);}return _0xcc7422;})[_0x35f9('0x21')](function(_0x4db8ab){if(!_0x4db8ab)throw new InternalError();return _0x4db8ab[_0x35f9('0x22')]();})['then'](function(){_0x2e8188[_0x35f9('0x23')](0xcc)['end']();})[_0x35f9('0x47')](handleError(_0x2e8188,null));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 8843238..04ea0b8 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 _0x0801=['api','moment','request-promise','rimraf','../../config/environment','./voiceRecording.attributes','exports','VoiceRecording','uniqueid','lodash','util','../../config/logger'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0801,0x105));var _0x1080=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x0801[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x1080('0x0'));var util=require(_0x1080('0x1'));var logger=require(_0x1080('0x2'))(_0x1080('0x3'));var moment=require(_0x1080('0x4'));var BPromise=require('bluebird');var rp=require(_0x1080('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1080('0x6'));var config=require(_0x1080('0x7'));var attributes=require(_0x1080('0x8'));module[_0x1080('0x9')]=function(_0x120990,_0x54d384){return _0x120990['define'](_0x1080('0xa'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x1080('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d1f=['../../config/logger','api','moment','request-promise','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','util'];(function(_0x4b2734,_0x200bed){var _0x2cafa1=function(_0x32af4b){while(--_0x32af4b){_0x4b2734['push'](_0x4b2734['shift']());}};_0x2cafa1(++_0x200bed);}(_0x2d1f,0x14f));var _0xf2d1=function(_0x516615,_0x357a73){_0x516615=_0x516615-0x0;var _0x399faa=_0x2d1f[_0x516615];return _0x399faa;};'use strict';var _=require('lodash');var util=require(_0xf2d1('0x0'));var logger=require(_0xf2d1('0x1'))(_0xf2d1('0x2'));var moment=require(_0xf2d1('0x3'));var BPromise=require('bluebird');var rp=require(_0xf2d1('0x4'));var fs=require('fs');var path=require(_0xf2d1('0x5'));var rimraf=require(_0xf2d1('0x6'));var config=require('../../config/environment');var attributes=require(_0xf2d1('0x7'));module[_0xf2d1('0x8')]=function(_0x327637,_0x192466){return _0x327637[_0xf2d1('0x9')](_0xf2d1('0xa'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf2d1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 5da56bd..084fed9 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(_0x348fec,_0x486f87){var _0x5914c7=function(_0xed01d5){while(--_0xed01d5){_0x348fec['push'](_0x348fec['shift']());}};_0x5914c7(++_0x486f87);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['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(_0x137aa6,_0xc9ad62){var _0x24cb82=function(_0x278fcd){while(--_0x278fcd){_0x137aa6['push'](_0x137aa6['shift']());}};_0x24cb82(++_0xc9ad62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 cd9ccb7..66f6429 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 _0x7096=['../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','util','connect-timeout','Router','../../components/auth/service'];(function(_0x32c150,_0x52db3f){var _0x176bac=function(_0x1978bf){while(--_0x1978bf){_0x32c150['push'](_0x32c150['shift']());}};_0x176bac(++_0x52db3f);}(_0x7096,0x10c));var _0x6709=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7096[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x6709('0x0'));var path=require('path');var timeout=require(_0x6709('0x1'));var express=require('express');var router=express[_0x6709('0x2')]();var auth=require(_0x6709('0x3'));var interaction=require(_0x6709('0x4'));var config=require(_0x6709('0x5'));var controller=require(_0x6709('0x6'));router[_0x6709('0x7')]('/',auth[_0x6709('0x8')](),controller[_0x6709('0x9')]);router[_0x6709('0x7')](_0x6709('0xa'),auth[_0x6709('0x8')](),controller[_0x6709('0xb')]);router[_0x6709('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6709('0xd')](_0x6709('0xa'),auth[_0x6709('0x8')](),controller[_0x6709('0xe')]);router[_0x6709('0xf')](_0x6709('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6709('0x10')]=router; \ No newline at end of file +var _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0x687b,0x14a));var _0xb687=function(_0x13486c,_0x139348){_0x13486c=_0x13486c-0x0;var _0x135738=_0x687b[_0x13486c];return _0x135738;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0xc')]('/',auth[_0xb687('0x9')](),controller['create']);router[_0xb687('0xd')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 311fdfe..f9bf72b 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 _0x0a56=['Yes','exports','ENUM','blind','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0a56,0x1e6));var _0x60a5=function(_0x7efac3,_0xce660a){_0x7efac3=_0x7efac3-0x0;var _0x1ab06f=_0x0a56[_0x7efac3];return _0x1ab06f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x60a5('0x0')]={'type':{'type':Sequelize[_0x60a5('0x1')](_0x60a5('0x2'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x60a5('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x60a5('0x3')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x60a5('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x60a5('0x3')]},'transferercontext':{'type':Sequelize[_0x60a5('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x60a5('0x3')]},'transfereechannel':{'type':Sequelize[_0x60a5('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x60a5('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x60a5('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x60a5('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x60a5('0x3')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x60a5('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0x60a5('0x4'),'No')},'context':{'type':Sequelize[_0x60a5('0x3')]},'extension':{'type':Sequelize[_0x60a5('0x3')]}}; \ No newline at end of file +var _0x150e=['attended','STRING','sequelize','moment','exports','ENUM'];(function(_0x121db7,_0x5983ad){var _0x123658=function(_0xdb5898){while(--_0xdb5898){_0x121db7['push'](_0x121db7['shift']());}};_0x123658(++_0x5983ad);}(_0x150e,0x170));var _0xe150=function(_0x346597,_0x275261){_0x346597=_0x346597-0x0;var _0x4a375a=_0x150e[_0x346597];return _0x4a375a;};'use strict';var Sequelize=require(_0xe150('0x0'));var moment=require(_0xe150('0x1'));module[_0xe150('0x2')]={'type':{'type':Sequelize[_0xe150('0x3')]('blind',_0xe150('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xe150('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xe150('0x5')]},'transferercalleridname':{'type':Sequelize[_0xe150('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xe150('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xe150('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xe150('0x5')]},'transferercontext':{'type':Sequelize[_0xe150('0x5')]},'transfererexten':{'type':Sequelize[_0xe150('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xe150('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xe150('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xe150('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xe150('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xe150('0x5')]},'transfereecontext':{'type':Sequelize[_0xe150('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xe150('0x5')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0xe150('0x5')]},'extension':{'type':Sequelize[_0xe150('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 3d0a1d4..42f2991 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 _0x4fc2=['../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','keys','filters','intersection','query','fields','length','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','attributes','includeAll','create','update','body','find','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'];(function(_0x384da0,_0x237fa2){var _0x29fe8b=function(_0x4852cf){while(--_0x4852cf){_0x384da0['push'](_0x384da0['shift']());}};_0x29fe8b(++_0x237fa2);}(_0x4fc2,0x111));var _0x24fc=function(_0x4ae1c0,_0x35be02){_0x4ae1c0=_0x4ae1c0-0x0;var _0x5c92cc=_0x4fc2[_0x4ae1c0];return _0x5c92cc;};'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 db=require(_0x24fc('0x18'))['db'];function respondWithStatusCode(_0x1cde5d,_0x5cc65e){_0x5cc65e=_0x5cc65e||0xcc;return function(_0x306873){if(_0x306873){return _0x1cde5d[_0x24fc('0x19')](_0x5cc65e);}return _0x1cde5d[_0x24fc('0x1a')](_0x5cc65e)[_0x24fc('0x1b')]();};}function respondWithResult(_0x30f19b,_0x326276){_0x326276=_0x326276||0xc8;return function(_0x537b5c){if(_0x537b5c){return _0x30f19b[_0x24fc('0x1a')](_0x326276)[_0x24fc('0x1c')](_0x537b5c);}};}function respondWithFilteredResult(_0x2ffed3,_0x42cbe8){return function(_0x4acd36){if(_0x4acd36){var _0x2ac989=_0x4acd36[_0x24fc('0x1d')],_0x588543=_0x42cbe8[_0x24fc('0x1e')],_0x4af098=_0x42cbe8[_0x24fc('0x1e')]+_0x42cbe8['limit'],_0x3385c7;if(_0x4af098>=_0x2ac989){_0x4af098=_0x2ac989;_0x3385c7=0xc8;}else{_0x3385c7=0xce;}_0x2ffed3[_0x24fc('0x1a')](_0x3385c7);return _0x2ffed3[_0x24fc('0x1f')](_0x24fc('0x20'),_0x588543+'-'+_0x4af098+'/'+_0x2ac989)[_0x24fc('0x1c')](_0x4acd36);}return null;};}function patchUpdates(_0x4c5a43){return function(_0x5eabee){try{jsonpatch[_0x24fc('0x21')](_0x5eabee,_0x4c5a43,!![]);}catch(_0x304881){return BPromise['reject'](_0x304881);}return _0x5eabee[_0x24fc('0x22')]();};}function saveUpdates(_0x36a771,_0xbf1d6b){return function(_0x2d0e3d){if(_0x2d0e3d){return _0x2d0e3d['update'](_0x36a771)[_0x24fc('0x23')](function(_0x545939){return _0x545939;});}return null;};}function removeEntity(_0x339b50,_0x591c8f){return function(_0x3ed464){if(_0x3ed464){return _0x3ed464[_0x24fc('0x24')]()[_0x24fc('0x23')](function(){_0x339b50['status'](0xcc)[_0x24fc('0x1b')]();});}};}function handleEntityNotFound(_0x552035,_0x35a9c7){return function(_0x2bb93a){if(!_0x2bb93a){_0x552035[_0x24fc('0x19')](0x194);}return _0x2bb93a;};}function handleError(_0x34b5b2,_0x3296fc){_0x3296fc=_0x3296fc||0x1f4;return function(_0x262e11){logger[_0x24fc('0x25')](_0x262e11[_0x24fc('0x26')]);if(_0x262e11[_0x24fc('0x27')]){delete _0x262e11[_0x24fc('0x27')];}_0x34b5b2['status'](_0x3296fc)[_0x24fc('0x28')](_0x262e11);};}exports[_0x24fc('0x29')]=function(_0x3ee302,_0x5bb4c8){var _0xf2f77d={},_0x3d1ec8={},_0x35f9f9={'count':0x0,'rows':[]};var _0x290f84=_[_0x24fc('0x2a')](db[_0x24fc('0x2b')]['rawAttributes'],function(_0x240ae7){return{'name':_0x240ae7[_0x24fc('0x2c')],'type':_0x240ae7[_0x24fc('0x2d')][_0x24fc('0x2e')]};});_0x3d1ec8[_0x24fc('0x2f')]=_['map'](_0x290f84,'name');_0x3d1ec8['query']=_[_0x24fc('0x30')](_0x3ee302['query']);_0x3d1ec8[_0x24fc('0x31')]=_[_0x24fc('0x32')](_0x3d1ec8[_0x24fc('0x2f')],_0x3d1ec8[_0x24fc('0x33')]);_0xf2f77d['attributes']=_[_0x24fc('0x32')](_0x3d1ec8[_0x24fc('0x2f')],qs['fields'](_0x3ee302[_0x24fc('0x33')][_0x24fc('0x34')]));_0xf2f77d['attributes']=_0xf2f77d['attributes'][_0x24fc('0x35')]?_0xf2f77d['attributes']:_0x3d1ec8[_0x24fc('0x2f')];if(!_0x3ee302[_0x24fc('0x33')]['hasOwnProperty'](_0x24fc('0x36'))){_0xf2f77d[_0x24fc('0x37')]=qs[_0x24fc('0x37')](_0x3ee302[_0x24fc('0x33')][_0x24fc('0x37')]);_0xf2f77d[_0x24fc('0x1e')]=qs[_0x24fc('0x1e')](_0x3ee302[_0x24fc('0x33')][_0x24fc('0x1e')]);}_0xf2f77d['order']=qs[_0x24fc('0x38')](_0x3ee302[_0x24fc('0x33')][_0x24fc('0x38')]);_0xf2f77d[_0x24fc('0x39')]=qs[_0x24fc('0x31')](_['pick'](_0x3ee302['query'],_0x3d1ec8[_0x24fc('0x31')]));if(_0x3ee302['query'][_0x24fc('0x3a')]){_0xf2f77d[_0x24fc('0x39')]=_[_0x24fc('0x3b')](_0xf2f77d[_0x24fc('0x39')],{'$or':_['map'](_0x290f84,function(_0x610638){if(_0x610638['type']!==_0x24fc('0x3c')){var _0x3b8fb6={};_0x3b8fb6[_0x610638[_0x24fc('0x27')]]={'$like':'%'+_0x3ee302[_0x24fc('0x33')][_0x24fc('0x3a')]+'%'};return _0x3b8fb6;}})});}_0xf2f77d=_['merge']({},_0xf2f77d,_0x3ee302[_0x24fc('0x3d')]);var _0x3f40cd={'where':_0xf2f77d[_0x24fc('0x39')]};return db[_0x24fc('0x2b')]['count'](_0x3f40cd)[_0x24fc('0x23')](function(_0x2f0bd9){_0x35f9f9['count']=_0x2f0bd9;if(_0x3ee302[_0x24fc('0x33')]['includeAll']){_0xf2f77d[_0x24fc('0x3e')]=[{'all':!![]}];}return db[_0x24fc('0x2b')][_0x24fc('0x3f')](_0xf2f77d);})[_0x24fc('0x23')](function(_0x431189){_0x35f9f9[_0x24fc('0x40')]=_0x431189;return _0x35f9f9;})[_0x24fc('0x23')](respondWithFilteredResult(_0x5bb4c8,_0xf2f77d))[_0x24fc('0x41')](handleError(_0x5bb4c8,null));};exports['show']=function(_0x1721ea,_0x43fb6d){var _0x32f72c={'raw':!![],'where':{'id':_0x1721ea[_0x24fc('0x42')]['id']}},_0x4fee9f={};_0x4fee9f[_0x24fc('0x2f')]=_['keys'](db[_0x24fc('0x2b')][_0x24fc('0x43')]);_0x4fee9f[_0x24fc('0x33')]=_['keys'](_0x1721ea[_0x24fc('0x33')]);_0x4fee9f[_0x24fc('0x31')]=_['intersection'](_0x4fee9f[_0x24fc('0x2f')],_0x4fee9f[_0x24fc('0x33')]);_0x32f72c[_0x24fc('0x44')]=_[_0x24fc('0x32')](_0x4fee9f['model'],qs[_0x24fc('0x34')](_0x1721ea[_0x24fc('0x33')][_0x24fc('0x34')]));_0x32f72c[_0x24fc('0x44')]=_0x32f72c[_0x24fc('0x44')]['length']?_0x32f72c[_0x24fc('0x44')]:_0x4fee9f[_0x24fc('0x2f')];if(_0x1721ea[_0x24fc('0x33')][_0x24fc('0x45')]){_0x32f72c['include']=[{'all':!![]}];}_0x32f72c=_[_0x24fc('0x3b')]({},_0x32f72c,_0x1721ea[_0x24fc('0x3d')]);return db['VoiceTransferReport']['find'](_0x32f72c)[_0x24fc('0x23')](handleEntityNotFound(_0x43fb6d,null))['then'](respondWithResult(_0x43fb6d,null))['catch'](handleError(_0x43fb6d,null));};exports[_0x24fc('0x46')]=function(_0x5879c2,_0x281194){return db[_0x24fc('0x2b')][_0x24fc('0x46')](_0x5879c2['body'],{})[_0x24fc('0x23')](respondWithResult(_0x281194,0xc9))[_0x24fc('0x41')](handleError(_0x281194,null));};exports[_0x24fc('0x47')]=function(_0x1ad8d6,_0x39873d){if(_0x1ad8d6[_0x24fc('0x48')]['id']){delete _0x1ad8d6[_0x24fc('0x48')]['id'];}return db[_0x24fc('0x2b')]['find']({'where':{'id':_0x1ad8d6['params']['id']}})[_0x24fc('0x23')](handleEntityNotFound(_0x39873d,null))[_0x24fc('0x23')](saveUpdates(_0x1ad8d6[_0x24fc('0x48')],null))['then'](respondWithResult(_0x39873d,null))['catch'](handleError(_0x39873d,null));};exports[_0x24fc('0x24')]=function(_0x213439,_0x179a60){return db[_0x24fc('0x2b')][_0x24fc('0x49')]({'where':{'id':_0x213439[_0x24fc('0x42')]['id']}})[_0x24fc('0x23')](handleEntityNotFound(_0x179a60,null))[_0x24fc('0x23')](removeEntity(_0x179a60,null))[_0x24fc('0x41')](handleError(_0x179a60,null));}; \ No newline at end of file +var _0xf4eb=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','apply','save','update','then','destroy','sendStatus','error','stack','name','VoiceTransferReport','rawAttributes','type','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','options','find','create','body','params','html-pdf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse'];(function(_0x1c5df7,_0x1b8ba4){var _0x223457=function(_0x41d260){while(--_0x41d260){_0x1c5df7['push'](_0x1c5df7['shift']());}};_0x223457(++_0x1b8ba4);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3ea542,_0x35bae0){_0x3ea542=_0x3ea542-0x0;var _0x465590=_0xf4eb[_0x3ea542];return _0x465590;};'use strict';var pdf=require(_0xbf4e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbf4e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf4e('0x2'));var util=require(_0xbf4e('0x3'));var path=require(_0xbf4e('0x4'));var sox=require(_0xbf4e('0x5'));var csv=require(_0xbf4e('0x6'));var ejs=require(_0xbf4e('0x7'));var fs=require('fs');var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x6'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var db=require(_0xbf4e('0x12'))['db'];function respondWithStatusCode(_0x54a96e,_0x17fd01){_0x17fd01=_0x17fd01||0xcc;return function(_0x5a3035){if(_0x5a3035){return _0x54a96e['sendStatus'](_0x17fd01);}return _0x54a96e[_0xbf4e('0x13')](_0x17fd01)[_0xbf4e('0x14')]();};}function respondWithResult(_0x1e029b,_0x302841){_0x302841=_0x302841||0xc8;return function(_0x3b74bd){if(_0x3b74bd){return _0x1e029b[_0xbf4e('0x13')](_0x302841)['json'](_0x3b74bd);}};}function respondWithFilteredResult(_0x59fb15,_0x180432){return function(_0x1735ae){if(_0x1735ae){var _0x28fc6b=_0x1735ae[_0xbf4e('0x15')],_0x542909=_0x180432[_0xbf4e('0x16')],_0x14110b=_0x180432['offset']+_0x180432[_0xbf4e('0x17')],_0x2c292c;if(_0x14110b>=_0x28fc6b){_0x14110b=_0x28fc6b;_0x2c292c=0xc8;}else{_0x2c292c=0xce;}_0x59fb15['status'](_0x2c292c);return _0x59fb15['set']('Content-Range',_0x542909+'-'+_0x14110b+'/'+_0x28fc6b)['json'](_0x1735ae);}return null;};}function patchUpdates(_0x35992b){return function(_0x1ca73c){try{jsonpatch[_0xbf4e('0x18')](_0x1ca73c,_0x35992b,!![]);}catch(_0x4d9c2a){return BPromise['reject'](_0x4d9c2a);}return _0x1ca73c[_0xbf4e('0x19')]();};}function saveUpdates(_0x9a46ee,_0x3be138){return function(_0x3a875b){if(_0x3a875b){return _0x3a875b[_0xbf4e('0x1a')](_0x9a46ee)[_0xbf4e('0x1b')](function(_0x415963){return _0x415963;});}return null;};}function removeEntity(_0x3d642a,_0xd09e12){return function(_0x376832){if(_0x376832){return _0x376832[_0xbf4e('0x1c')]()['then'](function(){_0x3d642a[_0xbf4e('0x13')](0xcc)[_0xbf4e('0x14')]();});}};}function handleEntityNotFound(_0x51648c,_0x31e3f5){return function(_0x30994d){if(!_0x30994d){_0x51648c[_0xbf4e('0x1d')](0x194);}return _0x30994d;};}function handleError(_0x1bda8b,_0x3a5d72){_0x3a5d72=_0x3a5d72||0x1f4;return function(_0x4a0243){logger[_0xbf4e('0x1e')](_0x4a0243[_0xbf4e('0x1f')]);if(_0x4a0243[_0xbf4e('0x20')]){delete _0x4a0243['name'];}_0x1bda8b[_0xbf4e('0x13')](_0x3a5d72)['send'](_0x4a0243);};}exports['index']=function(_0x2bfccf,_0x5a0a9b){var _0x38c923={},_0x315df3={},_0x4021a9={'count':0x0,'rows':[]};var _0x41f918=_['map'](db[_0xbf4e('0x21')][_0xbf4e('0x22')],function(_0x43879d){return{'name':_0x43879d['fieldName'],'type':_0x43879d[_0xbf4e('0x23')]['key']};});_0x315df3[_0xbf4e('0x24')]=_[_0xbf4e('0x25')](_0x41f918,_0xbf4e('0x20'));_0x315df3['query']=_[_0xbf4e('0x26')](_0x2bfccf[_0xbf4e('0x27')]);_0x315df3[_0xbf4e('0x28')]=_[_0xbf4e('0x29')](_0x315df3[_0xbf4e('0x24')],_0x315df3[_0xbf4e('0x27')]);_0x38c923['attributes']=_[_0xbf4e('0x29')](_0x315df3[_0xbf4e('0x24')],qs['fields'](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2a')]));_0x38c923['attributes']=_0x38c923[_0xbf4e('0x2b')]['length']?_0x38c923[_0xbf4e('0x2b')]:_0x315df3['model'];if(!_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2c')](_0xbf4e('0x2d'))){_0x38c923['limit']=qs[_0xbf4e('0x17')](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x17')]);_0x38c923[_0xbf4e('0x16')]=qs[_0xbf4e('0x16')](_0x2bfccf[_0xbf4e('0x27')]['offset']);}_0x38c923[_0xbf4e('0x2e')]=qs[_0xbf4e('0x2f')](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2f')]);_0x38c923[_0xbf4e('0x30')]=qs['filters'](_['pick'](_0x2bfccf['query'],_0x315df3['filters']));if(_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x31')]){_0x38c923[_0xbf4e('0x30')]=_[_0xbf4e('0x32')](_0x38c923[_0xbf4e('0x30')],{'$or':_[_0xbf4e('0x25')](_0x41f918,function(_0x355b42){if(_0x355b42[_0xbf4e('0x23')]!==_0xbf4e('0x33')){var _0x54527d={};_0x54527d[_0x355b42['name']]={'$like':'%'+_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x31')]+'%'};return _0x54527d;}})});}_0x38c923=_[_0xbf4e('0x32')]({},_0x38c923,_0x2bfccf['options']);var _0x3f46f1={'where':_0x38c923['where']};return db[_0xbf4e('0x21')][_0xbf4e('0x15')](_0x3f46f1)[_0xbf4e('0x1b')](function(_0xb30f90){_0x4021a9['count']=_0xb30f90;if(_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x34')]){_0x38c923[_0xbf4e('0x35')]=[{'all':!![]}];}return db[_0xbf4e('0x21')]['findAll'](_0x38c923);})[_0xbf4e('0x1b')](function(_0x44e96b){_0x4021a9[_0xbf4e('0x36')]=_0x44e96b;return _0x4021a9;})[_0xbf4e('0x1b')](respondWithFilteredResult(_0x5a0a9b,_0x38c923))[_0xbf4e('0x37')](handleError(_0x5a0a9b,null));};exports[_0xbf4e('0x38')]=function(_0xdb3c1,_0x541576){var _0x176166={'raw':!![],'where':{'id':_0xdb3c1['params']['id']}},_0x7b3a94={};_0x7b3a94['model']=_[_0xbf4e('0x26')](db[_0xbf4e('0x21')]['rawAttributes']);_0x7b3a94['query']=_[_0xbf4e('0x26')](_0xdb3c1[_0xbf4e('0x27')]);_0x7b3a94[_0xbf4e('0x28')]=_[_0xbf4e('0x29')](_0x7b3a94[_0xbf4e('0x24')],_0x7b3a94[_0xbf4e('0x27')]);_0x176166['attributes']=_[_0xbf4e('0x29')](_0x7b3a94[_0xbf4e('0x24')],qs['fields'](_0xdb3c1['query']['fields']));_0x176166['attributes']=_0x176166[_0xbf4e('0x2b')]['length']?_0x176166[_0xbf4e('0x2b')]:_0x7b3a94[_0xbf4e('0x24')];if(_0xdb3c1['query']['includeAll']){_0x176166[_0xbf4e('0x35')]=[{'all':!![]}];}_0x176166=_[_0xbf4e('0x32')]({},_0x176166,_0xdb3c1[_0xbf4e('0x39')]);return db[_0xbf4e('0x21')][_0xbf4e('0x3a')](_0x176166)['then'](handleEntityNotFound(_0x541576,null))[_0xbf4e('0x1b')](respondWithResult(_0x541576,null))[_0xbf4e('0x37')](handleError(_0x541576,null));};exports[_0xbf4e('0x3b')]=function(_0x39843e,_0x1be469){return db[_0xbf4e('0x21')][_0xbf4e('0x3b')](_0x39843e[_0xbf4e('0x3c')],{})['then'](respondWithResult(_0x1be469,0xc9))[_0xbf4e('0x37')](handleError(_0x1be469,null));};exports[_0xbf4e('0x1a')]=function(_0x1833c1,_0x32bed6){if(_0x1833c1[_0xbf4e('0x3c')]['id']){delete _0x1833c1[_0xbf4e('0x3c')]['id'];}return db[_0xbf4e('0x21')][_0xbf4e('0x3a')]({'where':{'id':_0x1833c1[_0xbf4e('0x3d')]['id']}})[_0xbf4e('0x1b')](handleEntityNotFound(_0x32bed6,null))[_0xbf4e('0x1b')](saveUpdates(_0x1833c1[_0xbf4e('0x3c')],null))[_0xbf4e('0x1b')](respondWithResult(_0x32bed6,null))[_0xbf4e('0x37')](handleError(_0x32bed6,null));};exports[_0xbf4e('0x1c')]=function(_0x2892ce,_0x10bc23){return db['VoiceTransferReport'][_0xbf4e('0x3a')]({'where':{'id':_0x2892ce[_0xbf4e('0x3d')]['id']}})[_0xbf4e('0x1b')](handleEntityNotFound(_0x10bc23,null))['then'](removeEntity(_0x10bc23,null))[_0xbf4e('0x37')](handleError(_0x10bc23,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 5fc45bd..8d35e41 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 _0x22d7=['exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','bluebird','../../config/environment','./voiceTransferReport.attributes'];(function(_0x315d5a,_0x518e18){var _0x4e46d0=function(_0x1f9430){while(--_0x1f9430){_0x315d5a['push'](_0x315d5a['shift']());}};_0x4e46d0(++_0x518e18);}(_0x22d7,0x158));var _0x722d=function(_0x14608c,_0x426670){_0x14608c=_0x14608c-0x0;var _0x1a0746=_0x22d7[_0x14608c];return _0x1a0746;};'use strict';var _=require(_0x722d('0x0'));var util=require('util');var logger=require(_0x722d('0x1'))(_0x722d('0x2'));var moment=require('moment');var BPromise=require(_0x722d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x722d('0x4'));var attributes=require(_0x722d('0x5'));module[_0x722d('0x6')]=function(_0x405e41,_0x3d5017){return _0x405e41[_0x722d('0x7')](_0x722d('0x8'),attributes,{'tableName':_0x722d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4df2=['rimraf','../../config/environment','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x235015,_0x3d2b35){var _0x36df98=function(_0x546fce){while(--_0x546fce){_0x235015['push'](_0x235015['shift']());}};_0x36df98(++_0x3d2b35);}(_0x4df2,0xbf));var _0x24df=function(_0x579a7e,_0x180b88){_0x579a7e=_0x579a7e-0x0;var _0x41c868=_0x4df2[_0x579a7e];return _0x41c868;};'use strict';var _=require(_0x24df('0x0'));var util=require(_0x24df('0x1'));var logger=require(_0x24df('0x2'))('api');var moment=require(_0x24df('0x3'));var BPromise=require(_0x24df('0x4'));var rp=require(_0x24df('0x5'));var fs=require('fs');var path=require(_0x24df('0x6'));var rimraf=require(_0x24df('0x7'));var config=require(_0x24df('0x8'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x2efb17,_0x200ad7){return _0x2efb17['define'](_0x24df('0x9'),attributes,{'tableName':_0x24df('0xa'),'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 e803888..e47a4da 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 _0x7697=['raw','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options'];(function(_0x4c5e48,_0xc065e){var _0x39e96d=function(_0x3bc4fe){while(--_0x3bc4fe){_0x4c5e48['push'](_0x4c5e48['shift']());}};_0x39e96d(++_0xc065e);}(_0x7697,0xb7));var _0x7769=function(_0x2d1971,_0x20b764){_0x2d1971=_0x2d1971-0x0;var _0x4d7759=_0x7697[_0x2d1971];return _0x4d7759;};'use strict';var _=require(_0x7769('0x0'));var util=require('util');var moment=require(_0x7769('0x1'));var BPromise=require('bluebird');var rs=require(_0x7769('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7769('0x3'))['db'];var utils=require(_0x7769('0x4'));var logger=require('../../config/logger')(_0x7769('0x5'));var config=require(_0x7769('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7769('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3def5f,_0x8e4311,_0x525576){return new BPromise(function(_0x51cee6,_0x9d832c){return client[_0x7769('0x8')](_0x3def5f,_0x525576)[_0x7769('0x9')](function(_0x1f7a41){logger[_0x7769('0xa')](_0x7769('0xb'),_0x8e4311,_0x7769('0xc'));logger[_0x7769('0xd')](_0x7769('0xe'),_0x8e4311,'request\x20sent',JSON[_0x7769('0xf')](_0x1f7a41));if(_0x1f7a41[_0x7769('0x10')]){if(_0x1f7a41[_0x7769('0x10')][_0x7769('0x11')]===0x1f4){logger[_0x7769('0x10')](_0x7769('0xb'),_0x8e4311,_0x1f7a41[_0x7769('0x10')]['message']);return _0x9d832c(_0x1f7a41['error'][_0x7769('0x12')]);}logger['error'](_0x7769('0xb'),_0x8e4311,_0x1f7a41[_0x7769('0x10')][_0x7769('0x12')]);return _0x51cee6(_0x1f7a41[_0x7769('0x10')]['message']);}else{logger[_0x7769('0xa')](_0x7769('0xb'),_0x8e4311,'request\x20sent');_0x51cee6(_0x1f7a41['result'][_0x7769('0x12')]);}})[_0x7769('0x13')](function(_0xef8575){logger[_0x7769('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x8e4311,_0xef8575);_0x9d832c(_0xef8575);});});}exports[_0x7769('0x14')]=function(_0x3f7dbd){var _0x3e1ee1=this;return new Promise(function(_0x2bf89a,_0x2d06cd){return db[_0x7769('0x15')][_0x7769('0x16')](_0x3f7dbd[_0x7769('0x17')],{'raw':_0x3f7dbd[_0x7769('0x18')]?_0x3f7dbd['options'][_0x7769('0x19')]===undefined?!![]:![]:!![]})[_0x7769('0x9')](function(_0x5b9251){logger[_0x7769('0xa')](_0x7769('0x14'),_0x3f7dbd);logger[_0x7769('0xd')]('CreateVoiceTransferReport',_0x3f7dbd,JSON[_0x7769('0xf')](_0x5b9251));_0x2bf89a(_0x5b9251);})['catch'](function(_0x37aa25){logger[_0x7769('0x10')](_0x7769('0x14'),_0x37aa25[_0x7769('0x12')],_0x3f7dbd);_0x2d06cd(_0x3e1ee1[_0x7769('0x10')](0x1f4,_0x37aa25['message']));});});}; \ No newline at end of file +var _0x4c14=['raw','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','result','catch','CreateVoiceTransferReport','VoiceTransferReport','options'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0x4c14,0xec));var _0x44c1=function(_0x5253d5,_0x677b9d){_0x5253d5=_0x5253d5-0x0;var _0x108878=_0x4c14[_0x5253d5];return _0x108878;};'use strict';var _=require(_0x44c1('0x0'));var util=require(_0x44c1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44c1('0x2'));var fs=require('fs');var Redis=require(_0x44c1('0x3'));var db=require(_0x44c1('0x4'))['db'];var utils=require(_0x44c1('0x5'));var logger=require('../../config/logger')(_0x44c1('0x6'));var config=require(_0x44c1('0x7'));var jayson=require(_0x44c1('0x8'));var client=jayson[_0x44c1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f68ef,_0x49d4fd,_0xaa2f6a){return new BPromise(function(_0x4ad992,_0x5cc3f9){return client[_0x44c1('0xa')](_0x2f68ef,_0xaa2f6a)[_0x44c1('0xb')](function(_0x4ded22){logger[_0x44c1('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x49d4fd,_0x44c1('0xd'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x49d4fd,'request\x20sent',JSON[_0x44c1('0xe')](_0x4ded22));if(_0x4ded22[_0x44c1('0xf')]){if(_0x4ded22[_0x44c1('0xf')][_0x44c1('0x10')]===0x1f4){logger[_0x44c1('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x49d4fd,_0x4ded22['error'][_0x44c1('0x11')]);return _0x5cc3f9(_0x4ded22[_0x44c1('0xf')][_0x44c1('0x11')]);}logger[_0x44c1('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x49d4fd,_0x4ded22[_0x44c1('0xf')]['message']);return _0x4ad992(_0x4ded22[_0x44c1('0xf')][_0x44c1('0x11')]);}else{logger[_0x44c1('0xc')](_0x44c1('0x12'),_0x49d4fd,_0x44c1('0xd'));_0x4ad992(_0x4ded22[_0x44c1('0x13')][_0x44c1('0x11')]);}})[_0x44c1('0x14')](function(_0x2eaf76){logger[_0x44c1('0xf')](_0x44c1('0x12'),_0x49d4fd,_0x2eaf76);_0x5cc3f9(_0x2eaf76);});});}exports[_0x44c1('0x15')]=function(_0x38bef2){var _0x4a69c1=this;return new Promise(function(_0x351cc7,_0x59c481){return db[_0x44c1('0x16')]['create'](_0x38bef2['body'],{'raw':_0x38bef2[_0x44c1('0x17')]?_0x38bef2['options'][_0x44c1('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x12540c){logger[_0x44c1('0xc')](_0x44c1('0x15'),_0x38bef2);logger[_0x44c1('0x19')](_0x44c1('0x15'),_0x38bef2,JSON[_0x44c1('0xe')](_0x12540c));_0x351cc7(_0x12540c);})['catch'](function(_0x2a5c7a){logger['error'](_0x44c1('0x15'),_0x2a5c7a['message'],_0x38bef2);_0x59c481(_0x4a69c1['error'](0x1f4,_0x2a5c7a[_0x44c1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index c290bda..faa75aa 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 _0x86fd=['/unhold','/calls','calls','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','canUpdate','originate','/hangup','isAuthenticated','post','answer','/hold','hold'];(function(_0x3385d2,_0x17d686){var _0x822bf5=function(_0x41beab){while(--_0x41beab){_0x3385d2['push'](_0x3385d2['shift']());}};_0x822bf5(++_0x17d686);}(_0x86fd,0xa7));var _0xd86f=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0x86fd[_0x9b2bb0];return _0x2cdb3b;};'use strict';var express=require(_0xd86f('0x0'));var router=express[_0xd86f('0x1')]();var auth=require(_0xd86f('0x2'));var controller=require(_0xd86f('0x3'));router['post'](_0xd86f('0x4'),auth['isAuthenticated'](),auth[_0xd86f('0x5')](),controller[_0xd86f('0x6')]);router['post'](_0xd86f('0x7'),auth[_0xd86f('0x8')](),auth['canUpdate'](),controller['hangup']);router[_0xd86f('0x9')]('/answer',auth[_0xd86f('0x8')](),auth['canUpdate'](),controller[_0xd86f('0xa')]);router[_0xd86f('0x9')](_0xd86f('0xb'),auth[_0xd86f('0x8')](),auth['canUpdate'](),controller[_0xd86f('0xc')]);router[_0xd86f('0x9')](_0xd86f('0xd'),auth['isAuthenticated'](),auth['canUpdate'](),controller['unhold']);router['post'](_0xd86f('0xe'),auth[_0xd86f('0x8')](),auth[_0xd86f('0x5')](),controller[_0xd86f('0xf')]);router['post']('/transfer',auth[_0xd86f('0x8')](),auth[_0xd86f('0x5')](),controller[_0xd86f('0x10')]);module[_0xd86f('0x11')]=router; \ No newline at end of file +var _0x48d0=['transfer','exports','express','Router','./webbar.controller','post','/originate','canUpdate','originate','/hangup','isAuthenticated','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls'];(function(_0x323bb6,_0x146da5){var _0x31b42a=function(_0x54204d){while(--_0x54204d){_0x323bb6['push'](_0x323bb6['shift']());}};_0x31b42a(++_0x146da5);}(_0x48d0,0xd3));var _0x048d=function(_0x565ac5,_0x1086f1){_0x565ac5=_0x565ac5-0x0;var _0xb5a0e4=_0x48d0[_0x565ac5];return _0xb5a0e4;};'use strict';var express=require(_0x048d('0x0'));var router=express[_0x048d('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x048d('0x2'));router[_0x048d('0x3')](_0x048d('0x4'),auth['isAuthenticated'](),auth[_0x048d('0x5')](),controller[_0x048d('0x6')]);router['post'](_0x048d('0x7'),auth[_0x048d('0x8')](),auth[_0x048d('0x5')](),controller['hangup']);router[_0x048d('0x3')](_0x048d('0x9'),auth['isAuthenticated'](),auth[_0x048d('0x5')](),controller[_0x048d('0xa')]);router[_0x048d('0x3')](_0x048d('0xb'),auth[_0x048d('0x8')](),auth[_0x048d('0x5')](),controller[_0x048d('0xc')]);router[_0x048d('0x3')](_0x048d('0xd'),auth[_0x048d('0x8')](),auth[_0x048d('0x5')](),controller[_0x048d('0xe')]);router['post'](_0x048d('0xf'),auth['isAuthenticated'](),auth[_0x048d('0x5')](),controller[_0x048d('0x10')]);router[_0x048d('0x3')]('/transfer',auth[_0x048d('0x8')](),auth['canUpdate'](),controller[_0x048d('0x11')]);module[_0x048d('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index d53b47b..1b9314e 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 _0x4a81=['userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','conference','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','jayson/promise','http','../../config/logger','redis','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','info','emit','log','handleError:','error','stack','name','status','send','request','code','message','result','catch','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','json','body'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x4a81,0x1b7));var _0x14a8=function(_0x4e4aa6,_0x2a78eb){_0x4e4aa6=_0x4e4aa6-0x0;var _0x11b828=_0x4a81[_0x4e4aa6];return _0x11b828;};'use strict';var path=require(_0x14a8('0x0'));var fs=require('fs');var _=require(_0x14a8('0x1'));var db=require(_0x14a8('0x2'))['db'];var config=require(_0x14a8('0x3'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x14a8('0x4'));var amiClient=jayson['client'][_0x14a8('0x5')]({'port':0x232a});var logger=require(_0x14a8('0x6'))('webbarapi');var Redis=require('ioredis');config[_0x14a8('0x7')]=_['defaults'](config[_0x14a8('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x14a8('0x8'))(new Redis(config[_0x14a8('0x7')]));var Schema=require(_0x14a8('0x9'));var originateValidation=new Schema({'userId':{'type':_0x14a8('0xa'),'required':[!![],_0x14a8('0xb')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x14a8('0xc')},'callbackUrl':{'type':_0x14a8('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0x14a8('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x14a8('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x14a8('0xa'),'required':[!![],_0x14a8('0xb')]},'sessionId':{'type':_0x14a8('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x14a8('0xa'),'required':[!![],_0x14a8('0xb')]},'sessionId':{'type':_0x14a8('0xc'),'required':[!![],_0x14a8('0xd')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x14a8('0xa'),'required':[!![],_0x14a8('0xb')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x14a8('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x14a8('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x14a8('0xa'),'required':[!![],_0x14a8('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0x14a8('0xa'),'required':[!![],_0x14a8('0xb')]}});function emit(_0x3a7152,_0x4dac6b,_0x356cf0){logger[_0x14a8('0xe')](_0x3a7152,_0x4dac6b,JSON['stringify'](_0x356cf0));io['to'](_0x3a7152)[_0x14a8('0xf')](_0x4dac6b,_0x356cf0);}function handleError(_0x524e35){return function(_0x98e1d5){console[_0x14a8('0x10')](_0x14a8('0x11'),_0x98e1d5,_0x98e1d5 instanceof RangeError);logger[_0x14a8('0x12')](_0x98e1d5[_0x14a8('0x13')]);if(_0x98e1d5 instanceof RangeError){if(_0x98e1d5[_0x14a8('0x14')]){delete _0x98e1d5['name'];}_0x524e35[_0x14a8('0x15')](0x194)[_0x14a8('0x16')](_0x98e1d5);}else{if(_0x98e1d5['name']){delete _0x98e1d5['name'];}_0x524e35[_0x14a8('0x15')](0x1f4)['send'](_0x98e1d5);}};}function checkError(){return function(_0x452c6c){if(!_0x452c6c){throw new RangeError('NotFound');}return _0x452c6c;};}function respondWithRpcPromise(_0x207e9f,_0x53f402){return new BPromise(function(_0x190189,_0x3afd58){var _0x182f2b=amiClient;return _0x182f2b[_0x14a8('0x17')](_0x207e9f,_0x53f402)['then'](function(_0x3d8cd1){if(_0x3d8cd1['error']){if(_0x3d8cd1[_0x14a8('0x12')][_0x14a8('0x18')]===0x1f4){return _0x3afd58(_0x3d8cd1[_0x14a8('0x12')][_0x14a8('0x19')]);}return _0x190189(_0x3d8cd1[_0x14a8('0x12')][_0x14a8('0x19')]);}else{_0x190189(_0x3d8cd1[_0x14a8('0x1a')]);}})[_0x14a8('0x1b')](function(_0x505655){_0x3afd58(_0x505655);});});}function getAgent(_0x2505d9){return db[_0x14a8('0x1c')][_0x14a8('0x1d')]({'where':{'id':_0x2505d9,'role':_0x14a8('0x1e')}})[_0x14a8('0x1f')](checkError());}function getAgentCheckSession(_0x42bdea,_0x3ae40c){return new BPromise(function(_0x37a780,_0x35b1c8){var _0x28d25c=respondWithRpcPromise(_0x14a8('0x20'));var _0x1c378a=getAgent(_0x42bdea);Promise[_0x14a8('0x21')]([_0x28d25c,_0x1c378a])['then'](function(_0x380e9a){var _0x2fdaed=_0x380e9a[0x0];var _0x4d71a1=_0x380e9a[0x1];var _0x3c3268=_[_0x14a8('0x22')](_0x2fdaed[_0x14a8('0x23')],function(_0x486f3f){return _0x486f3f[_0x14a8('0x24')]==_0x4d71a1['id']&&_0x486f3f[_0x14a8('0x25')]==_0x3ae40c;});if(_0x3c3268[_0x14a8('0x26')]==0x1){_0x37a780(_0x4d71a1);}else{_0x35b1c8(new RangeError(_0x14a8('0x27')+_0x3ae40c+_0x14a8('0x28')));}});});}exports[_0x14a8('0x29')]=function(_0x2a3fbc,_0x4f98a0){logger[_0x14a8('0xe')]('originate\x20fired:',_0x2a3fbc['body']);var _0xd74489=originateValidation['validate'](_0x2a3fbc['body']);if(_0xd74489[_0x14a8('0x26')]>0x0){return _0x4f98a0[_0x14a8('0x15')](0x190)[_0x14a8('0x2a')](_0xd74489);}var _0x50f50c=_0x2a3fbc[_0x14a8('0x2b')][_0x14a8('0x2c')];var _0x40e38b=_0x2a3fbc['body'][_0x14a8('0x2d')];var _0x2f9fc0=_0x2a3fbc[_0x14a8('0x2b')][_0x14a8('0x2e')];var _0x2a4c0c=_0x2a3fbc['body']['callbackUrl'];return getAgent(_0x50f50c)[_0x14a8('0x1f')](function(_0x3c96f5){logger[_0x14a8('0xe')](_0x14a8('0x2f'),_0x3c96f5[_0x14a8('0x14')]);emit(util[_0x14a8('0x30')](_0x14a8('0x31'),_0x3c96f5['name']),_0x14a8('0x32'),{'callNumber':_0x40e38b,'callerId':_0x2f9fc0,'callbackUrl':_0x2a4c0c});return _0x4f98a0[_0x14a8('0x15')](0xc8)['json']({'error':![],'message':_0x14a8('0x33')});})['catch'](handleError(_0x4f98a0));};exports['hangup']=function(_0x5d77e3,_0x2da3a1){logger['info']('hangup\x20fired:',_0x5d77e3[_0x14a8('0x2b')]);var _0x334b9e=hangupValidation[_0x14a8('0x9')](_0x5d77e3[_0x14a8('0x2b')]);if(_0x334b9e[_0x14a8('0x26')]>0x0){return _0x2da3a1['status'](0x190)[_0x14a8('0x2a')](_0x334b9e);}var _0x57545b=_0x5d77e3['body'][_0x14a8('0x2c')];var _0x32a3d9=_0x5d77e3[_0x14a8('0x2b')]['sessionId'];return getAgent(_0x57545b)[_0x14a8('0x1f')](function(_0x268a1a){logger[_0x14a8('0xe')](_0x14a8('0x2f'),_0x268a1a['name']);emit(util[_0x14a8('0x30')](_0x14a8('0x31'),_0x268a1a['name']),_0x14a8('0x34'),{'sessionId':_0x32a3d9});return _0x2da3a1[_0x14a8('0x15')](0xc8)[_0x14a8('0x2a')]({'error':![],'message':_0x14a8('0x35')});})[_0x14a8('0x1b')](handleError(_0x2da3a1));};exports[_0x14a8('0x36')]=function(_0x3a8323,_0x56372f){logger[_0x14a8('0xe')](_0x14a8('0x37'),_0x3a8323['body']);var _0x1c28a1=answerValidation[_0x14a8('0x9')](_0x3a8323['body']);if(_0x1c28a1[_0x14a8('0x26')]>0x0){return _0x56372f[_0x14a8('0x15')](0x190)[_0x14a8('0x2a')](_0x1c28a1);}var _0x2b279f=_0x3a8323[_0x14a8('0x2b')][_0x14a8('0x2c')];var _0x4ad341=_0x3a8323[_0x14a8('0x2b')]['sessionId'];return getAgent(_0x2b279f)[_0x14a8('0x1f')](function(_0x9c0a28){logger[_0x14a8('0xe')](_0x14a8('0x2f'),_0x9c0a28[_0x14a8('0x14')]);emit(util[_0x14a8('0x30')](_0x14a8('0x31'),_0x9c0a28['name']),_0x14a8('0x38'),{'sessionId':_0x4ad341});return _0x56372f[_0x14a8('0x15')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x14a8('0x1b')](handleError(_0x56372f));};exports['hold']=function(_0x976e04,_0x4f559a){logger[_0x14a8('0xe')](_0x14a8('0x39'),_0x976e04[_0x14a8('0x2b')]);var _0x3433af=holdValidation[_0x14a8('0x9')](_0x976e04[_0x14a8('0x2b')]);if(_0x3433af['length']>0x0){return _0x4f559a['status'](0x190)['json'](_0x3433af);}var _0x14138c=_0x976e04[_0x14a8('0x2b')][_0x14a8('0x2c')];var _0x21df3d=_0x976e04['body'][_0x14a8('0x25')];return getAgent(_0x14138c)[_0x14a8('0x1f')](function(_0xb3a3a0){logger[_0x14a8('0xe')]('entityFound:',_0xb3a3a0['name']);emit(util[_0x14a8('0x30')](_0x14a8('0x31'),_0xb3a3a0[_0x14a8('0x14')]),_0x14a8('0x3a'),{'sessionId':_0x21df3d});return _0x4f559a['status'](0xc8)[_0x14a8('0x2a')]({'error':![],'message':_0x14a8('0x3b')});})[_0x14a8('0x1b')](handleError(_0x4f559a));};exports[_0x14a8('0x3c')]=function(_0x33b86f,_0x1053db){logger[_0x14a8('0xe')](_0x14a8('0x3d'),_0x33b86f[_0x14a8('0x2b')]);var _0x20e54c=unholdValidation[_0x14a8('0x9')](_0x33b86f[_0x14a8('0x2b')]);if(_0x20e54c[_0x14a8('0x26')]>0x0){return _0x1053db[_0x14a8('0x15')](0x190)['json'](_0x20e54c);}var _0x295484=_0x33b86f[_0x14a8('0x2b')][_0x14a8('0x2c')];var _0xfb197b=_0x33b86f['body'][_0x14a8('0x25')];return getAgent(_0x295484)['then'](function(_0x3a373f){logger[_0x14a8('0xe')]('entityFound:',_0x3a373f['name']);emit(util[_0x14a8('0x30')](_0x14a8('0x31'),_0x3a373f[_0x14a8('0x14')]),'webbar:unhold',{'sessionId':_0xfb197b});return _0x1053db[_0x14a8('0x15')](0xc8)[_0x14a8('0x2a')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x1053db));};exports[_0x14a8('0x3e')]=function(_0x60f310,_0x49dfea){logger['info']('calls\x20fired:',_0x49dfea['body']);var _0x192d6c=callsValidation[_0x14a8('0x9')](_0x60f310['body']);if(_0x192d6c[_0x14a8('0x26')]>0x0){return _0x49dfea['status'](0x190)['json'](_0x192d6c);}var _0x3830f8=_0x60f310[_0x14a8('0x2b')]['userId'];var _0x17b945=respondWithRpcPromise(_0x14a8('0x20'));var _0xa1dd0e=getAgent(_0x3830f8);return Promise[_0x14a8('0x21')]([_0x17b945,_0xa1dd0e])[_0x14a8('0x1f')](function(_0x2ef13f){var _0x226ff7=_0x2ef13f[0x0];var _0x5e4de0=_0x2ef13f[0x1];var _0xb4e58d=_[_0x14a8('0x22')](_0x226ff7['rows'],function(_0x27dab7){return _0x27dab7[_0x14a8('0x24')]==_0x5e4de0['id'];});return _0x49dfea[_0x14a8('0x15')](0xc8)[_0x14a8('0x2a')]({'count':_0xb4e58d['length'],'rows':_0xb4e58d});})[_0x14a8('0x1b')](handleError(_0x49dfea));};exports[_0x14a8('0x3f')]=function(_0x4ec75c,_0x545a33){logger[_0x14a8('0xe')]('conference\x20fired:',_0x4ec75c['body']);var _0x448afd=conferenceValidation[_0x14a8('0x9')](_0x4ec75c[_0x14a8('0x2b')]);if(_0x448afd['length']>0x0){return _0x545a33['status'](0x190)[_0x14a8('0x2a')](_0x448afd);}var _0x4b88e7=_0x4ec75c['body']['userId'];return getAgent(_0x4b88e7)['then'](function(_0x119b22){logger['info'](_0x14a8('0x2f'),_0x119b22[_0x14a8('0x14')]);emit(util['format'](_0x14a8('0x31'),_0x119b22[_0x14a8('0x14')]),_0x14a8('0x40'));return _0x545a33[_0x14a8('0x15')](0xc8)[_0x14a8('0x2a')]({'error':![],'message':_0x14a8('0x41')});})[_0x14a8('0x1b')](handleError(_0x545a33));};exports['transfer']=function(_0x2c12ee,_0x4d3de9){logger[_0x14a8('0xe')](_0x14a8('0x42'),_0x2c12ee[_0x14a8('0x2b')]);var _0x3f898e=transferValidation['validate'](_0x2c12ee[_0x14a8('0x2b')]);if(_0x3f898e['length']>0x0){return _0x4d3de9['status'](0x190)[_0x14a8('0x2a')](_0x3f898e);}var _0x17fd52=_0x2c12ee[_0x14a8('0x2b')]['userId'];var _0x3ba685=_0x2c12ee['body'][_0x14a8('0x25')];var _0x3f2ae2=_0x2c12ee[_0x14a8('0x2b')][_0x14a8('0x43')];return getAgent(_0x17fd52)[_0x14a8('0x1f')](function(_0x386a03){logger[_0x14a8('0xe')](_0x14a8('0x2f'),_0x386a03['name']);emit(util['format']('user:%s',_0x386a03[_0x14a8('0x14')]),_0x14a8('0x44'),{'sessionId':_0x3ba685,'transferNumber':_0x3f2ae2});return _0x4d3de9[_0x14a8('0x15')](0xc8)[_0x14a8('0x2a')]({'error':![],'message':'transfer\x20executed!'});})[_0x14a8('0x1b')](handleError(_0x4d3de9));}; \ No newline at end of file +var _0xca66=['sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','code','message','result','catch','User','findOne','agent','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','hangup','hangup\x20fired:','validate','then','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','userId','sessionId','answer\x20executed!','hold','webbar:hold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','transfer\x20executed!','path','../../config/environment','util','bluebird','client','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required'];(function(_0x468481,_0x3d8b88){var _0x363252=function(_0x32e2a9){while(--_0x32e2a9){_0x468481['push'](_0x468481['shift']());}};_0x363252(++_0x3d8b88);}(_0xca66,0x8b));var _0x6ca6=function(_0xf19d7a,_0x43bfd2){_0xf19d7a=_0xf19d7a-0x0;var _0x52d675=_0xca66[_0xf19d7a];return _0x52d675;};'use strict';var path=require(_0x6ca6('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0x6ca6('0x1'));var util=require(_0x6ca6('0x2'));var BPromise=require(_0x6ca6('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x6ca6('0x4')]['http']({'port':0x232a});var logger=require(_0x6ca6('0x5'))('webbarapi');var Redis=require(_0x6ca6('0x6'));config[_0x6ca6('0x7')]=_[_0x6ca6('0x8')](config[_0x6ca6('0x7')],{'host':_0x6ca6('0x9'),'port':0x18eb});var io=require(_0x6ca6('0xa'))(new Redis(config[_0x6ca6('0x7')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'callNumber':{'type':_0x6ca6('0xd'),'required':[!![],_0x6ca6('0xe')]},'callerId':{'type':_0x6ca6('0xd')},'callbackUrl':{'type':_0x6ca6('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':'string','required':[!![],_0x6ca6('0xf')]},'transferNumber':{'type':_0x6ca6('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6ca6('0xc')]}});function emit(_0x19e94f,_0x260b56,_0x3f03e6){logger[_0x6ca6('0x10')](_0x19e94f,_0x260b56,JSON[_0x6ca6('0x11')](_0x3f03e6));io['to'](_0x19e94f)[_0x6ca6('0x12')](_0x260b56,_0x3f03e6);}function handleError(_0x4f056d){return function(_0x2391ce){console[_0x6ca6('0x13')](_0x6ca6('0x14'),_0x2391ce,_0x2391ce instanceof RangeError);logger[_0x6ca6('0x15')](_0x2391ce[_0x6ca6('0x16')]);if(_0x2391ce instanceof RangeError){if(_0x2391ce[_0x6ca6('0x17')]){delete _0x2391ce[_0x6ca6('0x17')];}_0x4f056d[_0x6ca6('0x18')](0x194)[_0x6ca6('0x19')](_0x2391ce);}else{if(_0x2391ce[_0x6ca6('0x17')]){delete _0x2391ce[_0x6ca6('0x17')];}_0x4f056d['status'](0x1f4)[_0x6ca6('0x19')](_0x2391ce);}};}function checkError(){return function(_0x254afe){if(!_0x254afe){throw new RangeError(_0x6ca6('0x1a'));}return _0x254afe;};}function respondWithRpcPromise(_0x195c92,_0x3a24aa){return new BPromise(function(_0x438694,_0x593f15){var _0xfb962d=amiClient;return _0xfb962d[_0x6ca6('0x1b')](_0x195c92,_0x3a24aa)['then'](function(_0x4927c1){if(_0x4927c1[_0x6ca6('0x15')]){if(_0x4927c1[_0x6ca6('0x15')][_0x6ca6('0x1c')]===0x1f4){return _0x593f15(_0x4927c1[_0x6ca6('0x15')][_0x6ca6('0x1d')]);}return _0x438694(_0x4927c1['error'][_0x6ca6('0x1d')]);}else{_0x438694(_0x4927c1[_0x6ca6('0x1e')]);}})[_0x6ca6('0x1f')](function(_0x2d8c64){_0x593f15(_0x2d8c64);});});}function getAgent(_0x3971a2){return db[_0x6ca6('0x20')][_0x6ca6('0x21')]({'where':{'id':_0x3971a2,'role':_0x6ca6('0x22')}})['then'](checkError());}function getAgentCheckSession(_0x55b07f,_0x144ec5){return new BPromise(function(_0x9467bd,_0xf1d821){var _0x141c0f=respondWithRpcPromise('VoiceChannels');var _0x5ea6f7=getAgent(_0x55b07f);Promise[_0x6ca6('0x23')]([_0x141c0f,_0x5ea6f7])['then'](function(_0x4ab84c){var _0x141e78=_0x4ab84c[0x0];var _0xefd407=_0x4ab84c[0x1];var _0x4a15cb=_[_0x6ca6('0x24')](_0x141e78[_0x6ca6('0x25')],function(_0xac50e8){return _0xac50e8[_0x6ca6('0x26')]==_0xefd407['id']&&_0xac50e8['sessionId']==_0x144ec5;});if(_0x4a15cb[_0x6ca6('0x27')]==0x1){_0x9467bd(_0xefd407);}else{_0xf1d821(new RangeError(_0x6ca6('0x28')+_0x144ec5+_0x6ca6('0x29')));}});});}exports[_0x6ca6('0x2a')]=function(_0x480264,_0x467a89){logger[_0x6ca6('0x10')](_0x6ca6('0x2b'),_0x480264[_0x6ca6('0x2c')]);var _0x5788a2=originateValidation['validate'](_0x480264['body']);if(_0x5788a2['length']>0x0){return _0x467a89['status'](0x190)[_0x6ca6('0x2d')](_0x5788a2);}var _0x3389c2=_0x480264[_0x6ca6('0x2c')]['userId'];var _0x206ecd=_0x480264[_0x6ca6('0x2c')][_0x6ca6('0x2e')];var _0x388e32=_0x480264['body'][_0x6ca6('0x2f')];var _0x40de00=_0x480264[_0x6ca6('0x2c')][_0x6ca6('0x30')];return getAgent(_0x3389c2)['then'](function(_0x1e28b4){logger['info'](_0x6ca6('0x31'),_0x1e28b4['name']);emit(util['format'](_0x6ca6('0x32'),_0x1e28b4[_0x6ca6('0x17')]),_0x6ca6('0x33'),{'callNumber':_0x206ecd,'callerId':_0x388e32,'callbackUrl':_0x40de00});return _0x467a89[_0x6ca6('0x18')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x6ca6('0x1f')](handleError(_0x467a89));};exports[_0x6ca6('0x34')]=function(_0x49c8a4,_0x43c2cb){logger['info'](_0x6ca6('0x35'),_0x49c8a4['body']);var _0x1ada8b=hangupValidation[_0x6ca6('0x36')](_0x49c8a4[_0x6ca6('0x2c')]);if(_0x1ada8b[_0x6ca6('0x27')]>0x0){return _0x43c2cb[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x1ada8b);}var _0x45e77b=_0x49c8a4[_0x6ca6('0x2c')]['userId'];var _0x2f6daf=_0x49c8a4['body']['sessionId'];return getAgent(_0x45e77b)[_0x6ca6('0x37')](function(_0x306eda){logger['info'](_0x6ca6('0x31'),_0x306eda['name']);emit(util[_0x6ca6('0x38')](_0x6ca6('0x32'),_0x306eda[_0x6ca6('0x17')]),_0x6ca6('0x39'),{'sessionId':_0x2f6daf});return _0x43c2cb['status'](0xc8)['json']({'error':![],'message':_0x6ca6('0x3a')});})[_0x6ca6('0x1f')](handleError(_0x43c2cb));};exports[_0x6ca6('0x3b')]=function(_0x3423e2,_0x4e6d4){logger['info'](_0x6ca6('0x3c'),_0x3423e2[_0x6ca6('0x2c')]);var _0x5bed6e=answerValidation[_0x6ca6('0x36')](_0x3423e2[_0x6ca6('0x2c')]);if(_0x5bed6e[_0x6ca6('0x27')]>0x0){return _0x4e6d4[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x5bed6e);}var _0x3e658e=_0x3423e2[_0x6ca6('0x2c')][_0x6ca6('0x3d')];var _0x1a8b7e=_0x3423e2['body'][_0x6ca6('0x3e')];return getAgent(_0x3e658e)[_0x6ca6('0x37')](function(_0x243661){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x243661[_0x6ca6('0x17')]);emit(util[_0x6ca6('0x38')](_0x6ca6('0x32'),_0x243661['name']),'webbar:answer',{'sessionId':_0x1a8b7e});return _0x4e6d4[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':_0x6ca6('0x3f')});})[_0x6ca6('0x1f')](handleError(_0x4e6d4));};exports[_0x6ca6('0x40')]=function(_0x33f5d5,_0x1f51f4){logger['info']('hold\x20fired:',_0x33f5d5[_0x6ca6('0x2c')]);var _0x42b263=holdValidation['validate'](_0x33f5d5[_0x6ca6('0x2c')]);if(_0x42b263[_0x6ca6('0x27')]>0x0){return _0x1f51f4[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x42b263);}var _0xc1928f=_0x33f5d5[_0x6ca6('0x2c')][_0x6ca6('0x3d')];var _0x5f27f5=_0x33f5d5[_0x6ca6('0x2c')][_0x6ca6('0x3e')];return getAgent(_0xc1928f)[_0x6ca6('0x37')](function(_0x4fde51){logger[_0x6ca6('0x10')]('entityFound:',_0x4fde51[_0x6ca6('0x17')]);emit(util['format']('user:%s',_0x4fde51['name']),_0x6ca6('0x41'),{'sessionId':_0x5f27f5});return _0x1f51f4[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':'hold\x20executed!'});})[_0x6ca6('0x1f')](handleError(_0x1f51f4));};exports['unhold']=function(_0x1f552d,_0x1010a6){logger[_0x6ca6('0x10')](_0x6ca6('0x42'),_0x1f552d[_0x6ca6('0x2c')]);var _0x2e6364=unholdValidation[_0x6ca6('0x36')](_0x1f552d[_0x6ca6('0x2c')]);if(_0x2e6364[_0x6ca6('0x27')]>0x0){return _0x1010a6[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x2e6364);}var _0x5578fb=_0x1f552d[_0x6ca6('0x2c')][_0x6ca6('0x3d')];var _0x1de2ca=_0x1f552d[_0x6ca6('0x2c')][_0x6ca6('0x3e')];return getAgent(_0x5578fb)['then'](function(_0x14d87a){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x14d87a['name']);emit(util['format']('user:%s',_0x14d87a['name']),_0x6ca6('0x43'),{'sessionId':_0x1de2ca});return _0x1010a6[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x1010a6));};exports[_0x6ca6('0x44')]=function(_0x2cbf30,_0x2591de){logger['info'](_0x6ca6('0x45'),_0x2591de['body']);var _0x281759=callsValidation[_0x6ca6('0x36')](_0x2cbf30[_0x6ca6('0x2c')]);if(_0x281759[_0x6ca6('0x27')]>0x0){return _0x2591de['status'](0x190)[_0x6ca6('0x2d')](_0x281759);}var _0x4874d8=_0x2cbf30['body'][_0x6ca6('0x3d')];var _0x11538e=respondWithRpcPromise(_0x6ca6('0x46'));var _0x35854a=getAgent(_0x4874d8);return Promise['all']([_0x11538e,_0x35854a])[_0x6ca6('0x37')](function(_0x1c12ae){var _0x2c4053=_0x1c12ae[0x0];var _0x13d3ea=_0x1c12ae[0x1];var _0x43881a=_[_0x6ca6('0x24')](_0x2c4053[_0x6ca6('0x25')],function(_0x405609){return _0x405609[_0x6ca6('0x26')]==_0x13d3ea['id'];});return _0x2591de[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'count':_0x43881a[_0x6ca6('0x27')],'rows':_0x43881a});})[_0x6ca6('0x1f')](handleError(_0x2591de));};exports[_0x6ca6('0x47')]=function(_0x2eeed6,_0x290c04){logger['info'](_0x6ca6('0x48'),_0x2eeed6[_0x6ca6('0x2c')]);var _0x2f4886=conferenceValidation[_0x6ca6('0x36')](_0x2eeed6[_0x6ca6('0x2c')]);if(_0x2f4886[_0x6ca6('0x27')]>0x0){return _0x290c04[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x2f4886);}var _0x3328ea=_0x2eeed6[_0x6ca6('0x2c')][_0x6ca6('0x3d')];return getAgent(_0x3328ea)[_0x6ca6('0x37')](function(_0x9834d6){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x9834d6[_0x6ca6('0x17')]);emit(util['format'](_0x6ca6('0x32'),_0x9834d6[_0x6ca6('0x17')]),_0x6ca6('0x49'));return _0x290c04[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':_0x6ca6('0x4a')});})['catch'](handleError(_0x290c04));};exports['transfer']=function(_0x509fe3,_0x21f786){logger[_0x6ca6('0x10')]('transfer\x20fired:',_0x509fe3[_0x6ca6('0x2c')]);var _0xc6021a=transferValidation[_0x6ca6('0x36')](_0x509fe3['body']);if(_0xc6021a[_0x6ca6('0x27')]>0x0){return _0x21f786[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0xc6021a);}var _0x1c3064=_0x509fe3[_0x6ca6('0x2c')]['userId'];var _0x514684=_0x509fe3[_0x6ca6('0x2c')][_0x6ca6('0x3e')];var _0x47d420=_0x509fe3[_0x6ca6('0x2c')][_0x6ca6('0x4b')];return getAgent(_0x1c3064)[_0x6ca6('0x37')](function(_0x19e7ac){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x19e7ac[_0x6ca6('0x17')]);emit(util[_0x6ca6('0x38')](_0x6ca6('0x32'),_0x19e7ac['name']),'webbar:transfer',{'sessionId':_0x514684,'transferNumber':_0x47d420});return _0x21f786[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':_0x6ca6('0x4c')});})[_0x6ca6('0x1f')](handleError(_0x21f786));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index b80999c..9188e0f 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 _0x3223=['/:id/users','getAgents','/:id/applications','getApplications','post','create','/:id/canned_answers','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','destroy','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/dispositions','getAnswers'];(function(_0x1b4add,_0x120b33){var _0xc4cd66=function(_0x1e2533){while(--_0x1e2533){_0x1b4add['push'](_0x1b4add['shift']());}};_0xc4cd66(++_0x120b33);}(_0x3223,0x1ab));var _0x3322=function(_0x2f2020,_0x3223de){_0x2f2020=_0x2f2020-0x0;var _0x3c431e=_0x3223[_0x2f2020];return _0x3c431e;};'use strict';var multer=require(_0x3322('0x0'));var util=require(_0x3322('0x1'));var path=require(_0x3322('0x2'));var timeout=require(_0x3322('0x3'));var express=require(_0x3322('0x4'));var router=express[_0x3322('0x5')]();var auth=require(_0x3322('0x6'));var interaction=require(_0x3322('0x7'));var config=require(_0x3322('0x8'));var controller=require('./whatsappAccount.controller');router[_0x3322('0x9')]('/',auth[_0x3322('0xa')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x3322('0xb'),auth[_0x3322('0xa')](),controller[_0x3322('0xc')]);router[_0x3322('0x9')](_0x3322('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x3322('0x9')]('/:id/canned_answers',auth[_0x3322('0xa')](),controller[_0x3322('0xe')]);router['get'](_0x3322('0xf'),auth[_0x3322('0xa')](),controller[_0x3322('0x10')]);router[_0x3322('0x9')](_0x3322('0x11'),auth[_0x3322('0xa')](),controller[_0x3322('0x12')]);router[_0x3322('0x13')]('/',auth[_0x3322('0xa')](),controller[_0x3322('0x14')]);router[_0x3322('0x13')]('/:id/dispositions',auth[_0x3322('0xa')](),controller['addDisposition']);router['post'](_0x3322('0x15'),auth[_0x3322('0xa')](),controller['addAnswer']);router[_0x3322('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x3322('0x16')]);router['post'](_0x3322('0x11'),auth[_0x3322('0xa')](),controller[_0x3322('0x17')]);router['post'](_0x3322('0x18'),controller[_0x3322('0x19')]);router[_0x3322('0x13')](_0x3322('0x1a'),auth[_0x3322('0xa')](),controller[_0x3322('0x1b')]);router[_0x3322('0x1c')](_0x3322('0xb'),auth[_0x3322('0xa')](),controller['update']);router['delete'](_0x3322('0xb'),auth['isAuthenticated'](),controller[_0x3322('0x1d')]);router[_0x3322('0x1e')](_0x3322('0xd'),auth[_0x3322('0xa')](),controller['removeDispositions']);router[_0x3322('0x1e')](_0x3322('0x15'),auth[_0x3322('0xa')](),controller[_0x3322('0x1f')]);router[_0x3322('0x1e')](_0x3322('0xf'),auth[_0x3322('0xa')](),controller[_0x3322('0x20')]);module[_0x3322('0x21')]=router; \ No newline at end of file +var _0x54ac=['/describe','show','getDispositions','getAnswers','/:id/users','/:id/applications','getApplications','post','create','/:id/canned_answers','addAnswer','addAgents','addApplications','notify','send','/:id','update','delete','destroy','/:id/dispositions','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index'];(function(_0x35e167,_0x3df9e2){var _0x2801b9=function(_0xec323){while(--_0xec323){_0x35e167['push'](_0x35e167['shift']());}};_0x2801b9(++_0x3df9e2);}(_0x54ac,0x12f));var _0xc54a=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0x54ac[_0x53e3fa];return _0xe8584a;};'use strict';var multer=require(_0xc54a('0x0'));var util=require(_0xc54a('0x1'));var path=require(_0xc54a('0x2'));var timeout=require(_0xc54a('0x3'));var express=require(_0xc54a('0x4'));var router=express[_0xc54a('0x5')]();var auth=require(_0xc54a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc54a('0x7'));var controller=require(_0xc54a('0x8'));router[_0xc54a('0x9')]('/',auth[_0xc54a('0xa')](),controller[_0xc54a('0xb')]);router['get'](_0xc54a('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xc54a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc54a('0xd')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc54a('0xe')]);router[_0xc54a('0x9')]('/:id/canned_answers',auth[_0xc54a('0xa')](),controller[_0xc54a('0xf')]);router['get'](_0xc54a('0x10'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xc54a('0x11'),auth[_0xc54a('0xa')](),controller[_0xc54a('0x12')]);router[_0xc54a('0x13')]('/',auth[_0xc54a('0xa')](),controller[_0xc54a('0x14')]);router[_0xc54a('0x13')]('/:id/dispositions',auth[_0xc54a('0xa')](),controller['addDisposition']);router[_0xc54a('0x13')](_0xc54a('0x15'),auth[_0xc54a('0xa')](),controller[_0xc54a('0x16')]);router[_0xc54a('0x13')]('/:id/users',auth[_0xc54a('0xa')](),controller[_0xc54a('0x17')]);router[_0xc54a('0x13')](_0xc54a('0x11'),auth[_0xc54a('0xa')](),controller[_0xc54a('0x18')]);router[_0xc54a('0x13')]('/:id/notify',controller[_0xc54a('0x19')]);router[_0xc54a('0x13')]('/:id/send',auth['isAuthenticated'](),controller[_0xc54a('0x1a')]);router['put'](_0xc54a('0x1b'),auth['isAuthenticated'](),controller[_0xc54a('0x1c')]);router[_0xc54a('0x1d')]('/:id',auth[_0xc54a('0xa')](),controller[_0xc54a('0x1e')]);router[_0xc54a('0x1d')](_0xc54a('0x1f'),auth[_0xc54a('0xa')](),controller[_0xc54a('0x20')]);router[_0xc54a('0x1d')](_0xc54a('0x15'),auth[_0xc54a('0xa')](),controller['removeAnswers']);router[_0xc54a('0x1d')]('/:id/users',auth[_0xc54a('0xa')](),controller[_0xc54a('0x21')]);module[_0xc54a('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index eeb80ca..ffe0bd1 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 _0xc239=['STRING','name','generate','ENUM','twilio','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring'];(function(_0x4fbb49,_0x2c76a0){var _0x22e980=function(_0x3a6ffd){while(--_0x3a6ffd){_0x4fbb49['push'](_0x4fbb49['shift']());}};_0x22e980(++_0x2c76a0);}(_0xc239,0x6e));var _0x9c23=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc239[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x9c23('0x0'));var rs=require(_0x9c23('0x1'));module['exports']={'name':{'type':Sequelize[_0x9c23('0x2')],'unique':_0x9c23('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x9c23('0x2')],'defaultValue':function(){return rs[_0x9c23('0x4')]();}},'phone':{'type':Sequelize[_0x9c23('0x2')]},'type':{'type':Sequelize[_0x9c23('0x5')](_0x9c23('0x6'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x9c23('0x2')]},'notificationTemplate':{'type':Sequelize[_0x9c23('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9c23('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x9c23('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9c23('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9c23('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9c23('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9c23('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9c23('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9c23('0x8')],'defaultValue':![],'comment':_0x9c23('0xa'),'set':function(_0x149369){if(!_0x149369){this['setDataValue'](_0x9c23('0xb'),null);}this[_0x9c23('0xc')](_0x9c23('0xd'),_0x149369);}},'description':{'type':Sequelize[_0x9c23('0x2')]}}; \ No newline at end of file +var _0x56f6=['generate','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','STRING'];(function(_0x20da4b,_0x375b41){var _0xc4c916=function(_0x5089be){while(--_0x5089be){_0x20da4b['push'](_0x20da4b['shift']());}};_0xc4c916(++_0x375b41);}(_0x56f6,0x1a0));var _0x656f=function(_0x5bcf21,_0x11751e){_0x5bcf21=_0x5bcf21-0x0;var _0x2c1a2b=_0x56f6[_0x5bcf21];return _0x2c1a2b;};'use strict';var Sequelize=require(_0x656f('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x656f('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x656f('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x656f('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x656f('0x1')],'defaultValue':function(){return rs[_0x656f('0x2')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x656f('0x3'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x656f('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x656f('0x4');}},'notificationSound':{'type':Sequelize[_0x656f('0x5')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x656f('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x656f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x656f('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x656f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x656f('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x656f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x656f('0x6')],'comment':_0x656f('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x656f('0x5')],'defaultValue':![],'comment':_0x656f('0x8'),'set':function(_0x6342d6){if(!_0x6342d6){this[_0x656f('0x9')](_0x656f('0xa'),null);}this[_0x656f('0x9')]('mandatoryDisposition',_0x6342d6);}},'description':{'type':Sequelize[_0x656f('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 96f5efb..6faa41c 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 _0xca66=['status','json','count','offset','limit','set','Content-Range','destroy','get','WhatsappAccounts','end','name','send','index','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','Pause','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','WhatsappAccountId','Disposition','findOne','nolimit','order','filter','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','Applications','account','applications','orderBy','priority','asc','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','twilio','from','From','whatsapp:','Body','messageId','MessageSid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','list','omit','defaults','contact','WhatsappInteraction','interaction','autoclose','push','created','WhatsappMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','to\x20is\x20mandatory','List','DESC','out','dataValues','Messages','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','util','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','../../config/environment','../../mysqldb','redis','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus'];(function(_0x25beb5,_0x42e990){var _0x450b78=function(_0x1e758c){while(--_0x1e758c){_0x25beb5['push'](_0x25beb5['shift']());}};_0x450b78(++_0x42e990);}(_0xca66,0x8b));var _0x6ca6=function(_0x2e6d07,_0x1dbd9a){_0x2e6d07=_0x2e6d07-0x0;var _0x3bb3bf=_0xca66[_0x2e6d07];return _0x3bb3bf;};'use strict';var pdf=require(_0x6ca6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6ca6('0x1'));var jsonpatch=require(_0x6ca6('0x2'));var rp=require(_0x6ca6('0x3'));var moment=require('moment');var BPromise=require(_0x6ca6('0x4'));var Mustache=require('mustache');var util=require(_0x6ca6('0x5'));var path=require('path');var sox=require(_0x6ca6('0x6'));var csv=require(_0x6ca6('0x7'));var ejs=require(_0x6ca6('0x8'));var fs=require('fs');var _=require(_0x6ca6('0x9'));var squel=require(_0x6ca6('0xa'));var crypto=require(_0x6ca6('0xb'));var jsforce=require(_0x6ca6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6ca6('0x7'));var querystring=require(_0x6ca6('0xd'));var Papa=require(_0x6ca6('0xe'));var Redis=require(_0x6ca6('0xf'));var authService=require(_0x6ca6('0x10'));var qs=require(_0x6ca6('0x11'));var as=require(_0x6ca6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ca6('0x13'))(_0x6ca6('0x14'));var utils=require(_0x6ca6('0x15'));var config=require(_0x6ca6('0x16'));var db=require(_0x6ca6('0x17'))['db'];config[_0x6ca6('0x18')]=_['defaults'](config[_0x6ca6('0x18')],{'host':_0x6ca6('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6ca6('0x18')]));require(_0x6ca6('0x1a'))[_0x6ca6('0x1b')](socket);var jayson=require(_0x6ca6('0x1c'));var client=jayson[_0x6ca6('0x1d')][_0x6ca6('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x4c053a,_0x52c59a,_0x5785b1){if(_0x5785b1){var _0x36ff3e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x36ff3e[_0x6ca6('0x1f')](_0x52c59a)){return _0x4c053a;}else{throw new db[(_0x6ca6('0x20'))][(_0x6ca6('0x21'))](_0x6ca6('0x22'));}}else{return _0x4c053a;}}function respondWithRpcPromise(_0x3d7f3f,_0x25dc6c,_0x4f056d,_0x2391ce){return new BPromise(function(_0x10be57,_0xc97f0){var _0x1f21ff=_0x2391ce||client;return _0x1f21ff[_0x6ca6('0x23')](_0x3d7f3f,_0x4f056d)[_0x6ca6('0x24')](function(_0x16a3d7){logger[_0x6ca6('0x25')](_0x6ca6('0x26'),_0x25dc6c,_0x6ca6('0x27'));logger[_0x6ca6('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x25dc6c,_0x6ca6('0x27'),JSON[_0x6ca6('0x29')](_0x16a3d7));if(_0x16a3d7[_0x6ca6('0x2a')]){if(_0x16a3d7[_0x6ca6('0x2a')][_0x6ca6('0x2b')]===0x1f4){logger[_0x6ca6('0x2a')]('WhatsappAccount,\x20%s,\x20%s',_0x25dc6c,_0x16a3d7[_0x6ca6('0x2a')][_0x6ca6('0x2c')]);return _0xc97f0(_0x16a3d7['error']['message']);}logger[_0x6ca6('0x2a')](_0x6ca6('0x26'),_0x25dc6c,_0x16a3d7[_0x6ca6('0x2a')][_0x6ca6('0x2c')]);return _0x10be57(_0x16a3d7[_0x6ca6('0x2a')]['message']);}else{logger[_0x6ca6('0x25')](_0x6ca6('0x26'),_0x25dc6c,_0x6ca6('0x27'));_0x10be57(_0x16a3d7[_0x6ca6('0x2d')][_0x6ca6('0x2c')]);}})[_0x6ca6('0x2e')](function(_0x3c32ae){logger[_0x6ca6('0x2a')]('WhatsappAccount,\x20%s,\x20%s',_0x25dc6c,_0x3c32ae);_0xc97f0(_0x3c32ae);});});}function respondWithStatusCode(_0x55b07f,_0x144ec5){_0x144ec5=_0x144ec5||0xcc;return function(_0x9467bd){if(_0x9467bd){return _0x55b07f[_0x6ca6('0x2f')](_0x144ec5);}return _0x55b07f[_0x6ca6('0x30')](_0x144ec5)['end']();};}function respondWithResult(_0x5ea6f7,_0x306583){_0x306583=_0x306583||0xc8;return function(_0x47cf48){if(_0x47cf48){return _0x5ea6f7['status'](_0x306583)[_0x6ca6('0x31')](_0x47cf48);}};}function respondWithFilteredResult(_0xefd407,_0x4a15cb){return function(_0x50aa5a){if(_0x50aa5a){var _0xf829ee=_0x50aa5a[_0x6ca6('0x32')],_0xac50e8=_0x4a15cb[_0x6ca6('0x33')],_0x566543=_0x4a15cb[_0x6ca6('0x33')]+_0x4a15cb[_0x6ca6('0x34')],_0x484411;if(_0x566543>=_0xf829ee){_0x566543=_0xf829ee;_0x484411=0xc8;}else{_0x484411=0xce;}_0xefd407['status'](_0x484411);return _0xefd407[_0x6ca6('0x35')](_0x6ca6('0x36'),_0xac50e8+'-'+_0x566543+'/'+_0xf829ee)[_0x6ca6('0x31')](_0x50aa5a);}return null;};}function patchUpdates(_0x1c6d50){return function(_0x5788a2){try{jsonpatch['apply'](_0x5788a2,_0x1c6d50,!![]);}catch(_0x4bb0cd){return BPromise['reject'](_0x4bb0cd);}return _0x5788a2['save']();};}function saveUpdates(_0x1c3505,_0x3389c2){return function(_0x138cce){if(_0x138cce){return _0x138cce['update'](_0x1c3505)[_0x6ca6('0x24')](function(_0x731414){return _0x731414;});}return null;};}function removeEntity(_0x12d057,_0x388e32){return function(_0x4c1218){if(_0x4c1218){return _0x4c1218[_0x6ca6('0x37')]()[_0x6ca6('0x24')](function(){var _0x437396=_0x4c1218[_0x6ca6('0x38')]({'plain':!![]});var _0x4da670=_0x6ca6('0x39');return db['UserProfileResource'][_0x6ca6('0x37')]({'where':{'type':_0x4da670,'resourceId':_0x437396['id']}})['then'](function(){return _0x4c1218;});})['then'](function(){_0x12d057[_0x6ca6('0x30')](0xcc)[_0x6ca6('0x3a')]();});}};}function handleEntityNotFound(_0x2b57bf,_0x79c65c){return function(_0x55d50c){if(!_0x55d50c){_0x2b57bf['sendStatus'](0x194);}return _0x55d50c;};}function handleError(_0x17a1da,_0x224257){_0x224257=_0x224257||0x1f4;return function(_0x49c8a4){logger[_0x6ca6('0x2a')](_0x49c8a4['stack']);if(_0x49c8a4[_0x6ca6('0x3b')]){delete _0x49c8a4['name'];}_0x17a1da[_0x6ca6('0x30')](_0x224257)[_0x6ca6('0x3c')](_0x49c8a4);};}exports[_0x6ca6('0x3d')]=function(_0x1eee08,_0x33b5e6){var _0x3ca258={'include':[{'model':db['Pause'],'as':_0x6ca6('0x3e')}]},_0x45e77b={},_0x204f4e={'count':0x0,'rows':[]};var _0x4ac816=_['map'](db[_0x6ca6('0x3f')][_0x6ca6('0x40')],function(_0x52cc41){return{'name':_0x52cc41[_0x6ca6('0x41')],'type':_0x52cc41['type'][_0x6ca6('0x42')]};});_0x45e77b[_0x6ca6('0x43')]=_[_0x6ca6('0x44')](_0x4ac816,_0x6ca6('0x3b'));_0x45e77b['query']=_['keys'](_0x1eee08[_0x6ca6('0x45')]);_0x45e77b[_0x6ca6('0x46')]=_[_0x6ca6('0x47')](_0x45e77b[_0x6ca6('0x43')],_0x45e77b[_0x6ca6('0x45')]);_0x3ca258['attributes']=_[_0x6ca6('0x47')](_0x45e77b[_0x6ca6('0x43')],qs['fields'](_0x1eee08[_0x6ca6('0x45')][_0x6ca6('0x48')]));_0x3ca258[_0x6ca6('0x49')]=_0x3ca258[_0x6ca6('0x49')][_0x6ca6('0x4a')]?_0x3ca258[_0x6ca6('0x49')]:_0x45e77b[_0x6ca6('0x43')];if(!_0x1eee08[_0x6ca6('0x45')][_0x6ca6('0x4b')]('nolimit')){_0x3ca258[_0x6ca6('0x34')]=qs[_0x6ca6('0x34')](_0x1eee08[_0x6ca6('0x45')][_0x6ca6('0x34')]);_0x3ca258[_0x6ca6('0x33')]=qs[_0x6ca6('0x33')](_0x1eee08[_0x6ca6('0x45')][_0x6ca6('0x33')]);}_0x3ca258['order']=qs['sort'](_0x1eee08[_0x6ca6('0x45')][_0x6ca6('0x4c')]);_0x3ca258[_0x6ca6('0x4d')]=qs[_0x6ca6('0x46')](_[_0x6ca6('0x4e')](_0x1eee08[_0x6ca6('0x45')],_0x45e77b[_0x6ca6('0x46')]),_0x4ac816);if(_0x1eee08['query']['filter']){_0x3ca258[_0x6ca6('0x4d')]=_[_0x6ca6('0x4f')](_0x3ca258['where'],{'$or':_[_0x6ca6('0x44')](_0x4ac816,function(_0x16654){if(_0x16654[_0x6ca6('0x50')]!==_0x6ca6('0x51')){var _0xc1928f={};_0xc1928f[_0x16654[_0x6ca6('0x3b')]]={'$like':'%'+_0x1eee08[_0x6ca6('0x45')]['filter']+'%'};return _0xc1928f;}})});}_0x3ca258=_[_0x6ca6('0x4f')]({},_0x3ca258,_0x1eee08[_0x6ca6('0x52')]);var _0x3e6efc={'where':_0x3ca258['where']};return db[_0x6ca6('0x3f')]['count'](_0x3e6efc)[_0x6ca6('0x24')](function(_0x4bc056){_0x204f4e['count']=_0x4bc056;if(_0x1eee08['query'][_0x6ca6('0x53')]){_0x3ca258[_0x6ca6('0x54')]=[{'all':!![]}];}return db[_0x6ca6('0x3f')]['findAll'](_0x3ca258);})[_0x6ca6('0x24')](function(_0x569278){_0x204f4e[_0x6ca6('0x55')]=_0x569278;return _0x204f4e;})[_0x6ca6('0x24')](respondWithFilteredResult(_0x33b5e6,_0x3ca258))[_0x6ca6('0x2e')](handleError(_0x33b5e6,null));};exports[_0x6ca6('0x56')]=function(_0x1da1ed,_0x2e6364){var _0xbeef13={'raw':![],'where':{'id':_0x1da1ed[_0x6ca6('0x57')]['id']},'include':[{'model':db[_0x6ca6('0x58')],'as':_0x6ca6('0x3e')}]},_0x3be8c6={};_0x3be8c6['model']=_[_0x6ca6('0x59')](db[_0x6ca6('0x3f')][_0x6ca6('0x40')]);_0x3be8c6[_0x6ca6('0x45')]=_[_0x6ca6('0x59')](_0x1da1ed['query']);_0x3be8c6[_0x6ca6('0x46')]=_[_0x6ca6('0x47')](_0x3be8c6[_0x6ca6('0x43')],_0x3be8c6['query']);_0xbeef13['attributes']=_['intersection'](_0x3be8c6['model'],qs[_0x6ca6('0x48')](_0x1da1ed[_0x6ca6('0x45')][_0x6ca6('0x48')]));_0xbeef13['attributes']=_0xbeef13['attributes'][_0x6ca6('0x4a')]?_0xbeef13[_0x6ca6('0x49')]:_0x3be8c6[_0x6ca6('0x43')];if(_0x1da1ed['query'][_0x6ca6('0x53')]){_0xbeef13['include']=[{'all':!![]}];}_0xbeef13=_[_0x6ca6('0x4f')]({},_0xbeef13,_0x1da1ed[_0x6ca6('0x52')]);return db[_0x6ca6('0x3f')][_0x6ca6('0x5a')](_0xbeef13)['then'](handleEntityNotFound(_0x2e6364,null))[_0x6ca6('0x24')](respondWithResult(_0x2e6364,null))['catch'](handleError(_0x2e6364,null));};exports['create']=function(_0x2b1022,_0x11538e){return db[_0x6ca6('0x3f')][_0x6ca6('0x5b')](_0x2b1022['body'],{})[_0x6ca6('0x24')](function(_0x1c12ae){var _0x2c4053=_0x2b1022[_0x6ca6('0x5c')][_0x6ca6('0x38')]({'plain':!![]});if(!_0x2c4053)throw new Error(_0x6ca6('0x5d'));if(_0x2c4053[_0x6ca6('0x5e')]===_0x6ca6('0x5c')){var _0x98004d=_0x1c12ae[_0x6ca6('0x38')]({'plain':!![]});var _0x3870bb=_0x6ca6('0x39');return db[_0x6ca6('0x5f')][_0x6ca6('0x5a')]({'where':{'name':_0x3870bb,'userProfileId':_0x2c4053[_0x6ca6('0x60')]},'raw':!![]})[_0x6ca6('0x24')](function(_0x493e5d){if(_0x493e5d&&_0x493e5d[_0x6ca6('0x61')]===0x0){return db[_0x6ca6('0x62')][_0x6ca6('0x5b')]({'name':_0x98004d[_0x6ca6('0x3b')],'resourceId':_0x98004d['id'],'type':_0x493e5d[_0x6ca6('0x3b')],'sectionId':_0x493e5d['id']},{})[_0x6ca6('0x24')](function(){return _0x1c12ae;});}else{return _0x1c12ae;}})[_0x6ca6('0x2e')](function(_0xd5ff88){logger[_0x6ca6('0x2a')](_0x6ca6('0x63'),_0xd5ff88);throw _0xd5ff88;});}return _0x1c12ae;})[_0x6ca6('0x24')](respondWithResult(_0x11538e,0xc9))[_0x6ca6('0x2e')](handleError(_0x11538e,null));};exports[_0x6ca6('0x64')]=function(_0x16a4f9,_0x278342){if(_0x16a4f9[_0x6ca6('0x65')]['id']){delete _0x16a4f9['body']['id'];}return db[_0x6ca6('0x3f')][_0x6ca6('0x5a')]({'where':{'id':_0x16a4f9[_0x6ca6('0x57')]['id']},'include':[{'model':db[_0x6ca6('0x58')],'as':_0x6ca6('0x3e')}]})[_0x6ca6('0x24')](handleEntityNotFound(_0x278342,null))['then'](saveUpdates(_0x16a4f9['body'],null))['then'](respondWithResult(_0x278342,null))[_0x6ca6('0x2e')](handleError(_0x278342,null));};exports[_0x6ca6('0x37')]=function(_0x55251d,_0x9cfe52){return db[_0x6ca6('0x3f')][_0x6ca6('0x5a')]({'where':{'id':_0x55251d['params']['id']}})[_0x6ca6('0x24')](handleEntityNotFound(_0x9cfe52,null))[_0x6ca6('0x24')](removeEntity(_0x9cfe52,null))[_0x6ca6('0x2e')](handleError(_0x9cfe52,null));};exports[_0x6ca6('0x66')]=function(_0x1cca4a,_0x50849e){return db['WhatsappAccount'][_0x6ca6('0x66')]()[_0x6ca6('0x24')](respondWithResult(_0x50849e,null))['catch'](handleError(_0x50849e,null));};exports[_0x6ca6('0x67')]=function(_0x43ec39,_0x217dc8,_0x19e7ac){if(_0x43ec39[_0x6ca6('0x65')]['id']){delete _0x43ec39[_0x6ca6('0x65')]['id'];}return db[_0x6ca6('0x3f')][_0x6ca6('0x5a')]({'where':{'id':_0x43ec39[_0x6ca6('0x57')]['id']}})['then'](handleEntityNotFound(_0x217dc8,null))['then'](function(_0x9d788f){if(_0x9d788f){_0x43ec39[_0x6ca6('0x65')][_0x6ca6('0x68')]=_0x9d788f['id'];return db[_0x6ca6('0x69')][_0x6ca6('0x5b')](_0x43ec39[_0x6ca6('0x65')]);}})['then'](respondWithResult(_0x217dc8,null))[_0x6ca6('0x2e')](handleError(_0x217dc8,null));};exports['getDispositions']=function(_0x450126,_0x44bbe6,_0x347e4c){var _0x1dd135={'raw':![],'where':{}};var _0xa12039={};var _0x5a2775={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x6ca6('0x6a')]({'where':{'id':_0x450126[_0x6ca6('0x57')]['id']}})[_0x6ca6('0x24')](handleEntityNotFound(_0x44bbe6,null))['then'](function(_0x1508e6){if(_0x1508e6){_0xa12039[_0x6ca6('0x43')]=_[_0x6ca6('0x59')](db[_0x6ca6('0x69')]['rawAttributes']);_0xa12039[_0x6ca6('0x45')]=_[_0x6ca6('0x59')](_0x450126[_0x6ca6('0x45')]);_0xa12039['filters']=_[_0x6ca6('0x47')](_0xa12039['model'],_0xa12039[_0x6ca6('0x45')]);_0x1dd135[_0x6ca6('0x49')]=_[_0x6ca6('0x47')](_0xa12039[_0x6ca6('0x43')],qs[_0x6ca6('0x48')](_0x450126[_0x6ca6('0x45')][_0x6ca6('0x48')]));_0x1dd135['attributes']=_0x1dd135['attributes'][_0x6ca6('0x4a')]?_0x1dd135[_0x6ca6('0x49')]:_0xa12039[_0x6ca6('0x43')];if(!_0x450126['query'][_0x6ca6('0x4b')](_0x6ca6('0x6b'))){_0x1dd135[_0x6ca6('0x34')]=qs[_0x6ca6('0x34')](_0x450126[_0x6ca6('0x45')][_0x6ca6('0x34')]);_0x1dd135['offset']=qs['offset'](_0x450126[_0x6ca6('0x45')]['offset']);}_0x1dd135[_0x6ca6('0x6c')]=qs[_0x6ca6('0x4c')](_0x450126[_0x6ca6('0x45')][_0x6ca6('0x4c')]);_0x1dd135[_0x6ca6('0x4d')]=qs[_0x6ca6('0x46')](_[_0x6ca6('0x4e')](_0x450126['query'],_0xa12039[_0x6ca6('0x46')]));_0x1dd135[_0x6ca6('0x4d')][_0x6ca6('0x68')]=_0x1508e6['id'];if(_0x450126[_0x6ca6('0x45')]['filter']){_0x1dd135['where']=_['merge'](_0x1dd135[_0x6ca6('0x4d')],{'$or':_[_0x6ca6('0x44')](_0x1dd135[_0x6ca6('0x49')],function(_0x150c18){var _0x3cfbb7={};_0x3cfbb7[_0x150c18]={'$like':'%'+_0x450126['query'][_0x6ca6('0x6d')]+'%'};return _0x3cfbb7;})});}_0x1dd135=_[_0x6ca6('0x4f')]({},_0x1dd135,_0x450126['options']);return db[_0x6ca6('0x69')][_0x6ca6('0x32')]({'where':_0x1dd135[_0x6ca6('0x4d')]})['then'](function(_0x4269a9){_0x5a2775[_0x6ca6('0x32')]=_0x4269a9;if(_0x450126['query'][_0x6ca6('0x53')]){_0x1dd135['include']=[{'all':!![]}];}return db[_0x6ca6('0x69')][_0x6ca6('0x6e')](_0x1dd135);})[_0x6ca6('0x24')](function(_0x209508){_0x5a2775[_0x6ca6('0x55')]=_0x209508;return _0x5a2775;});}})['then'](respondWithFilteredResult(_0x44bbe6,_0x1dd135))[_0x6ca6('0x2e')](handleError(_0x44bbe6,null));};exports['removeDispositions']=function(_0x277b58,_0x2c72d8,_0x2a79ee){return db['WhatsappAccount']['find']({'where':{'id':_0x277b58[_0x6ca6('0x57')]['id']}})[_0x6ca6('0x24')](handleEntityNotFound(_0x2c72d8,null))[_0x6ca6('0x24')](function(_0x34ba6b){if(_0x34ba6b){return _0x34ba6b[_0x6ca6('0x6f')](_0x277b58[_0x6ca6('0x45')][_0x6ca6('0x70')]);}})[_0x6ca6('0x24')](respondWithStatusCode(_0x2c72d8,null))['catch'](handleError(_0x2c72d8,null));};exports[_0x6ca6('0x71')]=function(_0x1b2d80,_0x2be7eb,_0x20dac2){if(_0x1b2d80[_0x6ca6('0x65')]['id']){delete _0x1b2d80[_0x6ca6('0x65')]['id'];}return db[_0x6ca6('0x3f')][_0x6ca6('0x5a')]({'where':{'id':_0x1b2d80[_0x6ca6('0x57')]['id']}})[_0x6ca6('0x24')](handleEntityNotFound(_0x2be7eb,null))['then'](function(_0x1e9674){if(_0x1e9674){_0x1b2d80[_0x6ca6('0x65')][_0x6ca6('0x68')]=_0x1e9674['id'];return db[_0x6ca6('0x72')][_0x6ca6('0x5b')](_0x1b2d80[_0x6ca6('0x65')]);}})['then'](respondWithResult(_0x2be7eb,null))[_0x6ca6('0x2e')](handleError(_0x2be7eb,null));};exports[_0x6ca6('0x73')]=function(_0x32ade0,_0x503670,_0x8153c3){var _0x4d5c23={'raw':![],'where':{}};var _0x1b67f6={};var _0x1d353d={'count':0x0,'rows':[]};return db[_0x6ca6('0x3f')]['findOne']({'where':{'id':_0x32ade0[_0x6ca6('0x57')]['id']}})['then'](handleEntityNotFound(_0x503670,null))[_0x6ca6('0x24')](function(_0x5a1da4){if(_0x5a1da4){_0x1b67f6['model']=_[_0x6ca6('0x59')](db[_0x6ca6('0x72')][_0x6ca6('0x40')]);_0x1b67f6[_0x6ca6('0x45')]=_[_0x6ca6('0x59')](_0x32ade0['query']);_0x1b67f6[_0x6ca6('0x46')]=_[_0x6ca6('0x47')](_0x1b67f6[_0x6ca6('0x43')],_0x1b67f6[_0x6ca6('0x45')]);_0x4d5c23[_0x6ca6('0x49')]=_[_0x6ca6('0x47')](_0x1b67f6['model'],qs[_0x6ca6('0x48')](_0x32ade0[_0x6ca6('0x45')][_0x6ca6('0x48')]));_0x4d5c23[_0x6ca6('0x49')]=_0x4d5c23['attributes'][_0x6ca6('0x4a')]?_0x4d5c23['attributes']:_0x1b67f6[_0x6ca6('0x43')];if(!_0x32ade0['query'][_0x6ca6('0x4b')](_0x6ca6('0x6b'))){_0x4d5c23[_0x6ca6('0x34')]=qs['limit'](_0x32ade0[_0x6ca6('0x45')][_0x6ca6('0x34')]);_0x4d5c23['offset']=qs[_0x6ca6('0x33')](_0x32ade0['query'][_0x6ca6('0x33')]);}_0x4d5c23[_0x6ca6('0x6c')]=qs[_0x6ca6('0x4c')](_0x32ade0['query'][_0x6ca6('0x4c')]);_0x4d5c23['where']=qs[_0x6ca6('0x46')](_['pick'](_0x32ade0[_0x6ca6('0x45')],_0x1b67f6[_0x6ca6('0x46')]));_0x4d5c23['where'][_0x6ca6('0x68')]=_0x5a1da4['id'];if(_0x32ade0[_0x6ca6('0x45')]['filter']){_0x4d5c23[_0x6ca6('0x4d')]=_[_0x6ca6('0x4f')](_0x4d5c23[_0x6ca6('0x4d')],{'$or':_[_0x6ca6('0x44')](_0x4d5c23[_0x6ca6('0x49')],function(_0x3f35d6){var _0x37d287={};_0x37d287[_0x3f35d6]={'$like':'%'+_0x32ade0[_0x6ca6('0x45')]['filter']+'%'};return _0x37d287;})});}_0x4d5c23=_[_0x6ca6('0x4f')]({},_0x4d5c23,_0x32ade0['options']);return db[_0x6ca6('0x72')]['count']({'where':_0x4d5c23['where']})[_0x6ca6('0x24')](function(_0x327de1){_0x1d353d['count']=_0x327de1;if(_0x32ade0[_0x6ca6('0x45')]['includeAll']){_0x4d5c23['include']=[{'all':!![]}];}return db[_0x6ca6('0x72')][_0x6ca6('0x6e')](_0x4d5c23);})[_0x6ca6('0x24')](function(_0x1ae672){_0x1d353d[_0x6ca6('0x55')]=_0x1ae672;return _0x1d353d;});}})[_0x6ca6('0x24')](respondWithFilteredResult(_0x503670,_0x4d5c23))[_0x6ca6('0x2e')](handleError(_0x503670,null));};exports[_0x6ca6('0x74')]=function(_0x2ecae5,_0x5290ca,_0x15199a){return db['WhatsappAccount']['find']({'where':{'id':_0x2ecae5['params']['id']}})[_0x6ca6('0x24')](handleEntityNotFound(_0x5290ca,null))[_0x6ca6('0x24')](function(_0x1b9cf5){if(_0x1b9cf5){return _0x1b9cf5[_0x6ca6('0x74')](_0x2ecae5[_0x6ca6('0x45')][_0x6ca6('0x70')]);}})[_0x6ca6('0x24')](respondWithStatusCode(_0x5290ca,null))[_0x6ca6('0x2e')](handleError(_0x5290ca,null));};exports[_0x6ca6('0x75')]=function(_0x377b88,_0x339fa8,_0x2b30f5){return db[_0x6ca6('0x3f')][_0x6ca6('0x5a')]({'where':{'id':_0x377b88[_0x6ca6('0x57')]['id']}})[_0x6ca6('0x24')](handleEntityNotFound(_0x339fa8,null))[_0x6ca6('0x24')](function(_0x4badbe){if(_0x4badbe){return _0x4badbe['addAgents'](_0x377b88[_0x6ca6('0x65')][_0x6ca6('0x70')],_['omit'](_0x377b88['body'],[_0x6ca6('0x70'),'id'])||{})[_0x6ca6('0x76')](function(_0x445e83){for(var _0xd12480=0x0;_0xd12480<_0x377b88['body'][_0x6ca6('0x70')][_0x6ca6('0x4a')];_0xd12480+=0x1){socket[_0x6ca6('0x77')](_0x6ca6('0x78'),{'UserId':_0x377b88[_0x6ca6('0x65')][_0x6ca6('0x70')][_0xd12480],'WhatsappAccountId':_0x377b88[_0x6ca6('0x57')]['id']});}return _0x445e83;});}})[_0x6ca6('0x24')](respondWithResult(_0x339fa8,null))[_0x6ca6('0x2e')](handleError(_0x339fa8,null));};exports[_0x6ca6('0x79')]=function(_0x334ccc,_0x5ad695,_0x269a77){return db[_0x6ca6('0x3f')][_0x6ca6('0x5a')]({'where':{'id':_0x334ccc['params']['id']}})[_0x6ca6('0x24')](handleEntityNotFound(_0x5ad695,null))[_0x6ca6('0x24')](function(_0x10916e){if(_0x10916e){return _0x10916e[_0x6ca6('0x79')](_0x334ccc[_0x6ca6('0x45')]['ids'])[_0x6ca6('0x24')](function(){if(_[_0x6ca6('0x7a')](_0x334ccc[_0x6ca6('0x45')][_0x6ca6('0x70')])){for(var _0xe3a285=0x0;_0xe3a285<_0x334ccc[_0x6ca6('0x45')][_0x6ca6('0x70')][_0x6ca6('0x4a')];_0xe3a285+=0x1){socket[_0x6ca6('0x77')](_0x6ca6('0x7b'),{'UserId':Number(_0x334ccc[_0x6ca6('0x45')][_0x6ca6('0x70')][_0xe3a285]),'WhatsappAccountId':Number(_0x334ccc[_0x6ca6('0x57')]['id'])});}}else{socket[_0x6ca6('0x77')](_0x6ca6('0x7b'),{'UserId':Number(_0x334ccc[_0x6ca6('0x45')][_0x6ca6('0x70')]),'WhatsappAccountId':Number(_0x334ccc[_0x6ca6('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x5ad695,null))['catch'](handleError(_0x5ad695,null));};exports[_0x6ca6('0x7c')]=function(_0x523671,_0x3eacac,_0x58a242){var _0x4b54fb={};var _0x1417c4={};var _0x233c06;var _0x281b6e;return db[_0x6ca6('0x3f')]['findOne']({'where':{'id':_0x523671['params']['id']}})[_0x6ca6('0x24')](handleEntityNotFound(_0x3eacac,null))[_0x6ca6('0x24')](function(_0x3fc98e){if(_0x3fc98e){_0x233c06=_0x3fc98e;_0x1417c4[_0x6ca6('0x43')]=_['keys'](db[_0x6ca6('0x7d')][_0x6ca6('0x40')]);_0x1417c4[_0x6ca6('0x45')]=_['keys'](_0x523671[_0x6ca6('0x45')]);_0x1417c4['filters']=_[_0x6ca6('0x47')](_0x1417c4[_0x6ca6('0x43')],_0x1417c4[_0x6ca6('0x45')]);_0x4b54fb[_0x6ca6('0x49')]=_[_0x6ca6('0x47')](_0x1417c4[_0x6ca6('0x43')],qs[_0x6ca6('0x48')](_0x523671[_0x6ca6('0x45')][_0x6ca6('0x48')]));_0x4b54fb[_0x6ca6('0x49')]=_0x4b54fb[_0x6ca6('0x49')][_0x6ca6('0x4a')]?_0x4b54fb['attributes']:_0x1417c4[_0x6ca6('0x43')];_0x4b54fb[_0x6ca6('0x6c')]=qs[_0x6ca6('0x4c')](_0x523671[_0x6ca6('0x45')][_0x6ca6('0x4c')]);_0x4b54fb[_0x6ca6('0x4d')]=qs[_0x6ca6('0x46')](_[_0x6ca6('0x4e')](_0x523671[_0x6ca6('0x45')],_0x1417c4[_0x6ca6('0x46')]));if(_0x523671['query']['filter']){_0x4b54fb[_0x6ca6('0x4d')]=_['merge'](_0x4b54fb[_0x6ca6('0x4d')],{'$or':_[_0x6ca6('0x44')](_0x4b54fb[_0x6ca6('0x49')],function(_0x31ea43){var _0x52cb11={};_0x52cb11[_0x31ea43]={'$like':'%'+_0x523671['query']['filter']+'%'};return _0x52cb11;})});}_0x4b54fb=_[_0x6ca6('0x4f')]({},_0x4b54fb,_0x523671[_0x6ca6('0x52')]);return _0x233c06[_0x6ca6('0x7c')](_0x4b54fb);}})[_0x6ca6('0x24')](function(_0x107e8d){if(_0x107e8d){_0x281b6e=_0x107e8d[_0x6ca6('0x4a')];if(!_0x523671['query'][_0x6ca6('0x4b')](_0x6ca6('0x6b'))){_0x4b54fb[_0x6ca6('0x34')]=qs[_0x6ca6('0x34')](_0x523671[_0x6ca6('0x45')]['limit']);_0x4b54fb[_0x6ca6('0x33')]=qs[_0x6ca6('0x33')](_0x523671['query'][_0x6ca6('0x33')]);}return _0x233c06[_0x6ca6('0x7c')](_0x4b54fb);}})[_0x6ca6('0x24')](function(_0x182e96){if(_0x182e96){return _0x182e96?{'count':_0x281b6e,'rows':_0x182e96}:null;}})[_0x6ca6('0x24')](respondWithResult(_0x3eacac,null))['catch'](handleError(_0x3eacac,null));};exports[_0x6ca6('0x7e')]=function(_0x1fd7ed,_0xf85365,_0x453109){return db[_0x6ca6('0x3f')][_0x6ca6('0x6a')]({'where':{'id':_0x1fd7ed[_0x6ca6('0x57')]['id']}})[_0x6ca6('0x24')](handleEntityNotFound(_0xf85365,null))[_0x6ca6('0x24')](function(_0x1f55ab){if(_0x1f55ab){return db[_0x6ca6('0x7f')][_0x6ca6('0x80')](function(_0x5b29ab){return db[_0x6ca6('0x81')]['destroy']({'where':{'WhatsappAccountId':_0x1fd7ed[_0x6ca6('0x57')]['id']},'transaction':_0x5b29ab})[_0x6ca6('0x24')](function(_0x3affd1){var _0x1aaf75=_[_0x6ca6('0x44')](_0x1fd7ed[_0x6ca6('0x65')],function(_0xd0e8e){_0xd0e8e[_0x6ca6('0x68')]=_0x1fd7ed['params']['id'];return _0xd0e8e;});return db[_0x6ca6('0x81')][_0x6ca6('0x82')](_0x1aaf75,{'transaction':_0x5b29ab});});})[_0x6ca6('0x24')](function(){return db['WhatsappApplication'][_0x6ca6('0x83')]({'where':{'WhatsappAccountId':_0x1fd7ed[_0x6ca6('0x57')]['id']},'order':'priority'});});}})[_0x6ca6('0x24')](respondWithResult(_0xf85365,null))[_0x6ca6('0x2e')](handleError(_0xf85365,null));};exports['getApplications']=function(_0x33f1dd,_0x204800,_0x3571fa){var _0x384a2d={};var _0x58245d={};var _0x4c70a7;var _0x20ca1d;return db[_0x6ca6('0x3f')][_0x6ca6('0x6a')]({'where':{'id':_0x33f1dd[_0x6ca6('0x57')]['id']}})[_0x6ca6('0x24')](handleEntityNotFound(_0x204800,null))[_0x6ca6('0x24')](function(_0x341314){if(_0x341314){_0x4c70a7=_0x341314;_0x58245d['model']=_[_0x6ca6('0x59')](db[_0x6ca6('0x81')]['rawAttributes']);_0x58245d[_0x6ca6('0x45')]=_[_0x6ca6('0x59')](_0x33f1dd['query']);_0x58245d[_0x6ca6('0x46')]=_[_0x6ca6('0x47')](_0x58245d[_0x6ca6('0x43')],_0x58245d[_0x6ca6('0x45')]);_0x384a2d[_0x6ca6('0x49')]=_[_0x6ca6('0x47')](_0x58245d['model'],qs[_0x6ca6('0x48')](_0x33f1dd['query'][_0x6ca6('0x48')]));_0x384a2d[_0x6ca6('0x49')]=_0x384a2d[_0x6ca6('0x49')][_0x6ca6('0x4a')]?_0x384a2d[_0x6ca6('0x49')]:_0x58245d['model'];_0x384a2d[_0x6ca6('0x6c')]=qs[_0x6ca6('0x4c')](_0x33f1dd[_0x6ca6('0x45')][_0x6ca6('0x4c')]);_0x384a2d[_0x6ca6('0x4d')]=qs[_0x6ca6('0x46')](_['pick'](_0x33f1dd[_0x6ca6('0x45')],_0x58245d['filters']));if(_0x33f1dd[_0x6ca6('0x45')][_0x6ca6('0x6d')]){_0x384a2d['where']=_[_0x6ca6('0x4f')](_0x384a2d[_0x6ca6('0x4d')],{'$or':_[_0x6ca6('0x44')](_0x384a2d[_0x6ca6('0x49')],function(_0x5ad176){var _0x23b8fe={};_0x23b8fe[_0x5ad176]={'$like':'%'+_0x33f1dd[_0x6ca6('0x45')][_0x6ca6('0x6d')]+'%'};return _0x23b8fe;})});}_0x384a2d=_[_0x6ca6('0x4f')]({},_0x384a2d,_0x33f1dd[_0x6ca6('0x52')]);return _0x4c70a7[_0x6ca6('0x84')](_0x384a2d);}})[_0x6ca6('0x24')](function(_0x3feb6a){if(_0x3feb6a){_0x20ca1d=_0x3feb6a[_0x6ca6('0x4a')];if(!_0x33f1dd[_0x6ca6('0x45')][_0x6ca6('0x4b')](_0x6ca6('0x6b'))){_0x384a2d[_0x6ca6('0x34')]=qs[_0x6ca6('0x34')](_0x33f1dd[_0x6ca6('0x45')][_0x6ca6('0x34')]);_0x384a2d[_0x6ca6('0x33')]=qs[_0x6ca6('0x33')](_0x33f1dd[_0x6ca6('0x45')]['offset']);}return _0x4c70a7['getApplications'](_0x384a2d);}})[_0x6ca6('0x24')](function(_0x1373b6){if(_0x1373b6){return _0x1373b6?{'count':_0x20ca1d,'rows':_0x1373b6}:null;}})[_0x6ca6('0x24')](respondWithResult(_0x204800,null))[_0x6ca6('0x2e')](handleError(_0x204800,null));};exports[_0x6ca6('0x85')]=function(_0x1a4092,_0x9c48d4,_0x58caf8){var _0x4770c0={'channel':'whatsapp'};var _0x1af602=[];var _0x331089=[];var _0x523bd7={};return db[_0x6ca6('0x3f')][_0x6ca6('0x5a')]({'where':{'id':_0x1a4092[_0x6ca6('0x57')]['id']},'include':[{'model':db[_0x6ca6('0x81')],'as':_0x6ca6('0x86')}]})[_0x6ca6('0x24')](handleEntityNotFound(_0x9c48d4,null))[_0x6ca6('0x24')](function(_0x4b2b15){_0x4770c0[_0x6ca6('0x87')]=_0x4b2b15;_0x4770c0[_0x6ca6('0x88')]=_[_0x6ca6('0x89')](_0x4b2b15[_0x6ca6('0x86')],[_0x6ca6('0x8a')],[_0x6ca6('0x8b')]);if(_0x4770c0[_0x6ca6('0x87')]['Applications']){delete _0x4770c0[_0x6ca6('0x87')][_0x6ca6('0x86')];}return db[_0x6ca6('0x8c')][_0x6ca6('0x66')]();})['then'](function(_0x376cdd){if(!_0x376cdd){throw new db[(_0x6ca6('0x20'))][(_0x6ca6('0x21'))](_0x6ca6('0x8d'));}_0x1af602=_[_0x6ca6('0x8e')](_[_0x6ca6('0x59')](_0x376cdd),[_0x6ca6('0x8f'),'updatedAt']);_0x331089=_[_0x6ca6('0x8e')](_[_0x6ca6('0x59')](_0x376cdd),['createdAt',_0x6ca6('0x90'),'CompanyId','ListId']);_0x4770c0[_0x6ca6('0x65')]={'mapKey':_0x6ca6('0x91')};if(_0x4770c0[_0x6ca6('0x87')]['type']&&_0x4770c0[_0x6ca6('0x87')]['type']===_0x6ca6('0x92')){_0x4770c0[_0x6ca6('0x65')][_0x6ca6('0x93')]=_0x1a4092['body'][_0x6ca6('0x94')]['replace'](_0x6ca6('0x95'),'');_0x4770c0['body'][_0x6ca6('0x65')]=_0x1a4092[_0x6ca6('0x65')][_0x6ca6('0x96')];_0x4770c0[_0x6ca6('0x65')][_0x6ca6('0x97')]=_0x1a4092[_0x6ca6('0x65')][_0x6ca6('0x98')];}if(_0x4770c0[_0x6ca6('0x65')]['id']){delete _0x4770c0[_0x6ca6('0x65')]['id'];}if(_[_0x6ca6('0x99')](_0x4770c0['body'][_0x6ca6('0x93')])){throw new db[(_0x6ca6('0x20'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x4770c0[_0x6ca6('0x65')][_0x6ca6('0x65')])||_0x4770c0['body']['body']===''){throw new db[(_0x6ca6('0x20'))][(_0x6ca6('0x21'))](_0x6ca6('0x9a'));}if(_[_0x6ca6('0x99')](_0x4770c0[_0x6ca6('0x65')][_0x6ca6('0x9b')])){throw new db['Sequelize'][(_0x6ca6('0x21'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x331089);}if(!_['includes'](_0x331089,_0x4770c0[_0x6ca6('0x65')][_0x6ca6('0x9b')])){throw new db['Sequelize'][(_0x6ca6('0x21'))](_0x6ca6('0x9c')+_0x331089);}_0x523bd7[_0x4770c0[_0x6ca6('0x65')][_0x6ca6('0x9b')]]=_0x4770c0[_0x6ca6('0x65')][_0x6ca6('0x93')];return db[_0x6ca6('0x9d')][_0x6ca6('0x5a')]({'where':{'id':_0x4770c0[_0x6ca6('0x87')][_0x6ca6('0x9e')]},'include':[{'model':db[_0x6ca6('0x8c')],'as':_0x6ca6('0x9f'),'where':_0x523bd7,'limit':0x1,'order':[[_0x6ca6('0x90'),'DESC']]}]});})['then'](handleEntityNotFound(_0x9c48d4,null))[_0x6ca6('0x24')](function(_0x1d740a){if(_0x1d740a){_0x4770c0[_0x6ca6('0xa0')]=_[_0x6ca6('0xa1')](_0x1d740a,[_0x6ca6('0x9f')]);if(_0x1d740a[_0x6ca6('0x9f')][_0x6ca6('0x4a')]){return _0x1d740a[_0x6ca6('0x9f')][0x0];}var _0x2d35fd=_[_0x6ca6('0xa2')](_0x4770c0[_0x6ca6('0x65')],{'firstName':_0x4770c0[_0x6ca6('0x65')][_0x6ca6('0x93')],'ListId':_0x1d740a['id']});_0x2d35fd[_0x4770c0['body'][_0x6ca6('0x9b')]]=_0x4770c0[_0x6ca6('0x65')][_0x6ca6('0x93')];return db[_0x6ca6('0x8c')]['create'](_0x2d35fd,{'fields':_0x1af602,'raw':!![]});}})[_0x6ca6('0x24')](handleEntityNotFound(_0x9c48d4,null))[_0x6ca6('0x24')](function(_0x4f5687){if(_0x4f5687){_0x4770c0[_0x6ca6('0xa3')]=_0x4f5687;var _0x4220f2={'ContactId':_0x4f5687['id'],'phone':_0x4770c0[_0x6ca6('0x65')][_0x6ca6('0x93')],'WhatsappAccountId':_0x1a4092[_0x6ca6('0x57')]['id']};var _0x5e4da8={'ContactId':_0x4f5687['id'],'WhatsappAccountId':_0x1a4092[_0x6ca6('0x57')]['id'],'closed':![]};return db[_0x6ca6('0xa4')][_0x6ca6('0x5a')]({'where':_0x5e4da8})[_0x6ca6('0x24')](function(_0x243ae6){if(_0x243ae6){return[_0x243ae6,![]];}return db[_0x6ca6('0xa4')]['create'](_0x4220f2)[_0x6ca6('0x24')](function(_0x1aaaea){return[_0x1aaaea,!![]];});});}})['spread'](function(_0x2c5599,_0x428391){_0x4770c0[_0x6ca6('0xa5')]=_0x2c5599['get']({'plain':!![]});_0x4770c0[_0x6ca6('0xa5')]['created']=![];if(_0x428391){if(_0x4770c0[_0x6ca6('0x87')][_0x6ca6('0xa6')]){_0x4770c0['applications'][_0x6ca6('0xa7')]({'id':0x0,'priority':_0x4770c0['applications'][_0x6ca6('0x4a')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x4770c0[_0x6ca6('0xa5')][_0x6ca6('0xa8')]=!![];}return db[_0x6ca6('0xa9')]['create']({'phone':_0x4770c0['body'][_0x6ca6('0x93')],'messageId':_0x4770c0[_0x6ca6('0x65')][_0x6ca6('0x97')],'body':_0x4770c0[_0x6ca6('0x65')][_0x6ca6('0x65')],'WhatsappAccountId':_0x1a4092[_0x6ca6('0x57')]['id'],'WhatsappInteractionId':_0x2c5599['id'],'direction':'in','ContactId':_0x2c5599['ContactId'],'AttachmentId':_0x4770c0[_0x6ca6('0x65')][_0x6ca6('0xaa')]});})[_0x6ca6('0x24')](function(_0x548741){_0x4770c0[_0x6ca6('0x2c')]=_0x548741;if(_0x4770c0[_0x6ca6('0xa5')][_0x6ca6('0xab')]){return db[_0x6ca6('0x7d')][_0x6ca6('0x5a')]({'attributes':['id','name'],'where':{'id':_0x4770c0[_0x6ca6('0xa5')][_0x6ca6('0xab')]}})['then'](function(_0x583c4f){if(_0x583c4f){_0x4770c0[_0x6ca6('0x88')][_0x6ca6('0xac')]({'id':0x0,'priority':0x0,'app':_0x6ca6('0xad'),'appdata':_0x583c4f[_0x6ca6('0x3b')]+','+(_0x4770c0[_0x6ca6('0x87')][_0x6ca6('0xae')]||0xa),'interval':_0x6ca6('0xaf')});}return respondWithRpcPromise(_0x6ca6('0xb0'),'startRouting',_0x4770c0);});}return respondWithRpcPromise(_0x6ca6('0xb0'),_0x6ca6('0xb1'),_0x4770c0);})[_0x6ca6('0x24')](function(_0x4183d3){if(_0x4183d3){var _0x4d1c2d=0xc8;var _0x9f02e=_0x6ca6('0xb2');logger[_0x6ca6('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x9f02e,_0x4d1c2d,_0x6ca6('0xb3'));logger[_0x6ca6('0x28')](_0x6ca6('0xb4'),_0x9f02e,_0x4d1c2d,'entity\x20found',JSON[_0x6ca6('0x29')](_0x4183d3));if(_0x4770c0[_0x6ca6('0x87')][_0x6ca6('0x50')]===_0x6ca6('0x92')){return _0x9c48d4['status'](_0x4d1c2d)[_0x6ca6('0x35')]('Content-Type','text/xml')['send']('\x0a');}else{return _0x9c48d4['status'](_0x4d1c2d)[_0x6ca6('0x31')](_0x4183d3);}}})[_0x6ca6('0x2e')](handleError(_0x9c48d4,null));};exports[_0x6ca6('0x3c')]=function(_0x2dd188,_0x55b7ed,_0x229169){var _0x3fc50,_0x5ed5e1,_0x5217fb;if(_[_0x6ca6('0x99')](_0x2dd188[_0x6ca6('0x65')][_0x6ca6('0x65')])||_0x2dd188[_0x6ca6('0x65')][_0x6ca6('0x65')]===''){throw new db[(_0x6ca6('0x20'))][(_0x6ca6('0x21'))](_0x6ca6('0x9a'));}if(_[_0x6ca6('0x99')](_0x2dd188[_0x6ca6('0x65')]['to'])){throw new db[(_0x6ca6('0x20'))][(_0x6ca6('0x21'))](_0x6ca6('0xb5'));}_0x3fc50=_0x2dd188[_0x6ca6('0x65')]['to'];return db['WhatsappAccount'][_0x6ca6('0x5a')]({'where':{'id':_0x2dd188[_0x6ca6('0x57')]['id']},'include':[{'model':db[_0x6ca6('0x9d')],'as':_0x6ca6('0xb6'),'include':[{'model':db[_0x6ca6('0x8c')],'as':'Contacts','where':{'mobile':_0x3fc50},'limit':0x1,'order':[[_0x6ca6('0x90'),_0x6ca6('0xb7')]]}]}]})[_0x6ca6('0x24')](handleEntityNotFound(_0x55b7ed,null))['then'](function(_0x4be7b9){if(_0x4be7b9&&_0x4be7b9[_0x6ca6('0xb6')]){_0x5ed5e1=_0x4be7b9[_0x6ca6('0x38')]({'plain':!![]});if(_0x5ed5e1['List']&&_0x5ed5e1['List'][_0x6ca6('0x9f')][_0x6ca6('0x4a')]){return _0x5ed5e1[_0x6ca6('0xb6')][_0x6ca6('0x9f')][0x0];}return db[_0x6ca6('0x8c')]['create'](_[_0x6ca6('0xa2')](_0x2dd188['body'],{'firstName':_0x3fc50,'mobile':_0x3fc50,'phone':_0x3fc50,'ListId':_0x5ed5e1[_0x6ca6('0x9e')]}));}})[_0x6ca6('0x24')](handleEntityNotFound(_0x55b7ed,null))[_0x6ca6('0x24')](function(_0x571eae){if(_0x571eae){_0x5217fb=_0x571eae;return db[_0x6ca6('0xa4')][_0x6ca6('0x5a')]({'where':{'ContactId':_0x5217fb['id'],'closed':![],'WhatsappAccountId':_0x5ed5e1['id']}})['then'](function(_0x283fd){if(_0x283fd){return[_0x283fd,![]];}return db[_0x6ca6('0xa4')][_0x6ca6('0x5b')]({'UserId':_0x2dd188[_0x6ca6('0x5c')]['id'],'ContactId':_0x5217fb['id'],'WhatsappAccountId':_0x5ed5e1['id'],'phone':_0x3fc50,'firstMsgDirection':_0x6ca6('0xb8'),'Messages':[_[_0x6ca6('0x4f')](_0x2dd188[_0x6ca6('0x65')],{'read':![],'body':_0x2dd188[_0x6ca6('0x65')][_0x6ca6('0x65')],'phone':_0x3fc50,'WhatsappAccountId':_0x5ed5e1['id'],'UserId':_0x2dd188['user']['id'],'ContactId':_0x5217fb['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})['then'](function(_0x550688){return[_0x550688,!![]];});});}})[_0x6ca6('0x76')](function(_0x2eb64c,_0x1aa1b1){if(_0x1aa1b1){return _0x2eb64c;}return db[_0x6ca6('0xa9')]['create'](_['merge'](_0x2dd188[_0x6ca6('0x65')],{'read':![],'body':_0x2dd188[_0x6ca6('0x65')][_0x6ca6('0x65')],'phone':_0x3fc50,'WhatsappAccountId':_0x5ed5e1['id'],'WhatsappInteractionId':_0x2eb64c['id'],'UserId':_0x2dd188[_0x6ca6('0x5c')]['id'],'ContactId':_0x5217fb['id']}))[_0x6ca6('0x24')](function(_0x29ff1f){_0x2eb64c[_0x6ca6('0xb9')][_0x6ca6('0xba')]=[];_0x2eb64c[_0x6ca6('0xb9')][_0x6ca6('0xba')][_0x6ca6('0xa7')](_0x29ff1f['dataValues']);return _0x2eb64c;});})[_0x6ca6('0x24')](respondWithResult(_0x55b7ed,null))[_0x6ca6('0x2e')](handleError(_0x55b7ed,null));}; \ No newline at end of file +var _0x2dae=['Content-Type','text/xml','\x0a','List','DESC','out','Messages','dataValues','push','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','get','WhatsappAccounts','name','send','map','WhatsappAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','Pause','mandatoryDispositionPause','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','find','describe','addDisposition','WhatsappAccountId','Disposition','sort','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','findOne','User','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','account','orderBy','Applications','asc','CmContact','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','whatsapp:','messageId','MessageSid','isNil','Sequelize','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','list','omit','defaults','WhatsappInteraction','spread','interaction','created','autoclose','applications','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','set'];(function(_0x24f47c,_0x1c2e4d){var _0x3f4dc4=function(_0x244cc7){while(--_0x244cc7){_0x24f47c['push'](_0x24f47c['shift']());}};_0x3f4dc4(++_0x1c2e4d);}(_0x2dae,0xc3));var _0xe2da=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0x2dae[_0x142020];return _0x40da8f;};'use strict';var pdf=require(_0xe2da('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe2da('0x1'));var zipdir=require(_0xe2da('0x2'));var jsonpatch=require(_0xe2da('0x3'));var rp=require(_0xe2da('0x4'));var moment=require(_0xe2da('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe2da('0x6'));var util=require(_0xe2da('0x7'));var path=require(_0xe2da('0x8'));var sox=require(_0xe2da('0x9'));var csv=require('to-csv');var ejs=require(_0xe2da('0xa'));var fs=require('fs');var _=require(_0xe2da('0xb'));var squel=require(_0xe2da('0xc'));var crypto=require(_0xe2da('0xd'));var jsforce=require(_0xe2da('0xe'));var deskjs=require(_0xe2da('0xf'));var toCsv=require(_0xe2da('0x10'));var querystring=require(_0xe2da('0x11'));var Papa=require(_0xe2da('0x12'));var Redis=require('ioredis');var authService=require(_0xe2da('0x13'));var qs=require(_0xe2da('0x14'));var as=require(_0xe2da('0x15'));var hardwareService=require(_0xe2da('0x16'));var logger=require(_0xe2da('0x17'))(_0xe2da('0x18'));var utils=require(_0xe2da('0x19'));var config=require(_0xe2da('0x1a'));var db=require('../../mysqldb')['db'];config[_0xe2da('0x1b')]=_['defaults'](config[_0xe2da('0x1b')],{'host':_0xe2da('0x1c'),'port':0x18eb});var socket=require(_0xe2da('0x1d'))(new Redis(config[_0xe2da('0x1b')]));require(_0xe2da('0x1e'))[_0xe2da('0x1f')](socket);var jayson=require(_0xe2da('0x20'));var client=jayson['client'][_0xe2da('0x21')]({'port':0x232c});function checkPasswordPattern(_0x5e1702,_0x586b27,_0x403d1c){if(_0x403d1c){var _0x3dfc52=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3dfc52[_0xe2da('0x22')](_0x586b27)){return _0x5e1702;}else{throw new db['Sequelize'][(_0xe2da('0x23'))](_0xe2da('0x24'));}}else{return _0x5e1702;}}function respondWithRpcPromise(_0x2ea60e,_0x33568f,_0x4e1623,_0x45bb92){return new BPromise(function(_0x1f7d33,_0x417363){var _0x2e5730=_0x45bb92||client;return _0x2e5730[_0xe2da('0x25')](_0x2ea60e,_0x4e1623)['then'](function(_0x56eeb1){logger[_0xe2da('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x33568f,_0xe2da('0x27'));logger[_0xe2da('0x28')](_0xe2da('0x29'),_0x33568f,_0xe2da('0x27'),JSON[_0xe2da('0x2a')](_0x56eeb1));if(_0x56eeb1[_0xe2da('0x2b')]){if(_0x56eeb1['error'][_0xe2da('0x2c')]===0x1f4){logger['error'](_0xe2da('0x2d'),_0x33568f,_0x56eeb1[_0xe2da('0x2b')][_0xe2da('0x2e')]);return _0x417363(_0x56eeb1[_0xe2da('0x2b')][_0xe2da('0x2e')]);}logger[_0xe2da('0x2b')](_0xe2da('0x2d'),_0x33568f,_0x56eeb1[_0xe2da('0x2b')]['message']);return _0x1f7d33(_0x56eeb1[_0xe2da('0x2b')][_0xe2da('0x2e')]);}else{logger[_0xe2da('0x26')](_0xe2da('0x2d'),_0x33568f,_0xe2da('0x27'));_0x1f7d33(_0x56eeb1[_0xe2da('0x2f')][_0xe2da('0x2e')]);}})['catch'](function(_0x2adc49){logger[_0xe2da('0x2b')](_0xe2da('0x2d'),_0x33568f,_0x2adc49);_0x417363(_0x2adc49);});});}function respondWithStatusCode(_0x38ee5e,_0x36ca43){_0x36ca43=_0x36ca43||0xcc;return function(_0x2b6c9e){if(_0x2b6c9e){return _0x38ee5e[_0xe2da('0x30')](_0x36ca43);}return _0x38ee5e[_0xe2da('0x31')](_0x36ca43)['end']();};}function respondWithResult(_0x487a7c,_0x5e259a){_0x5e259a=_0x5e259a||0xc8;return function(_0x3c4845){if(_0x3c4845){return _0x487a7c[_0xe2da('0x31')](_0x5e259a)[_0xe2da('0x32')](_0x3c4845);}};}function respondWithFilteredResult(_0x1ab91a,_0x5de7fb){return function(_0x490794){if(_0x490794){var _0x356ab4=_0x490794[_0xe2da('0x33')],_0x1ec8ca=_0x5de7fb[_0xe2da('0x34')],_0x262d40=_0x5de7fb[_0xe2da('0x34')]+_0x5de7fb[_0xe2da('0x35')],_0x39f983;if(_0x262d40>=_0x356ab4){_0x262d40=_0x356ab4;_0x39f983=0xc8;}else{_0x39f983=0xce;}_0x1ab91a[_0xe2da('0x31')](_0x39f983);return _0x1ab91a['set']('Content-Range',_0x1ec8ca+'-'+_0x262d40+'/'+_0x356ab4)[_0xe2da('0x32')](_0x490794);}return null;};}function patchUpdates(_0x249c8d){return function(_0x2cb457){try{jsonpatch[_0xe2da('0x36')](_0x2cb457,_0x249c8d,!![]);}catch(_0x195537){return BPromise[_0xe2da('0x37')](_0x195537);}return _0x2cb457[_0xe2da('0x38')]();};}function saveUpdates(_0x7fa46c,_0x28e61a){return function(_0x46df04){if(_0x46df04){return _0x46df04[_0xe2da('0x39')](_0x7fa46c)[_0xe2da('0x3a')](function(_0x4ef546){return _0x4ef546;});}return null;};}function removeEntity(_0x19d6c8,_0x3649cd){return function(_0x2618a1){if(_0x2618a1){return _0x2618a1[_0xe2da('0x3b')]()[_0xe2da('0x3a')](function(){var _0x5a078e=_0x2618a1[_0xe2da('0x3c')]({'plain':!![]});var _0x8bd0fc=_0xe2da('0x3d');return db['UserProfileResource'][_0xe2da('0x3b')]({'where':{'type':_0x8bd0fc,'resourceId':_0x5a078e['id']}})[_0xe2da('0x3a')](function(){return _0x2618a1;});})[_0xe2da('0x3a')](function(){_0x19d6c8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x156deb,_0x1f4a5a){return function(_0x4d6e6c){if(!_0x4d6e6c){_0x156deb[_0xe2da('0x30')](0x194);}return _0x4d6e6c;};}function handleError(_0x15df09,_0x3aefe2){_0x3aefe2=_0x3aefe2||0x1f4;return function(_0x256a0c){logger[_0xe2da('0x2b')](_0x256a0c['stack']);if(_0x256a0c[_0xe2da('0x3e')]){delete _0x256a0c['name'];}_0x15df09['status'](_0x3aefe2)[_0xe2da('0x3f')](_0x256a0c);};}exports['index']=function(_0x2aa22c,_0x27435b){var _0x54d8a3={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x365968={},_0x3ef0e8={'count':0x0,'rows':[]};var _0x55be3e=_[_0xe2da('0x40')](db[_0xe2da('0x41')][_0xe2da('0x42')],function(_0x38c77e){return{'name':_0x38c77e[_0xe2da('0x43')],'type':_0x38c77e[_0xe2da('0x44')][_0xe2da('0x45')]};});_0x365968['model']=_[_0xe2da('0x40')](_0x55be3e,_0xe2da('0x3e'));_0x365968[_0xe2da('0x46')]=_[_0xe2da('0x47')](_0x2aa22c[_0xe2da('0x46')]);_0x365968['filters']=_[_0xe2da('0x48')](_0x365968[_0xe2da('0x49')],_0x365968[_0xe2da('0x46')]);_0x54d8a3['attributes']=_[_0xe2da('0x48')](_0x365968[_0xe2da('0x49')],qs[_0xe2da('0x4a')](_0x2aa22c[_0xe2da('0x46')][_0xe2da('0x4a')]));_0x54d8a3[_0xe2da('0x4b')]=_0x54d8a3[_0xe2da('0x4b')][_0xe2da('0x4c')]?_0x54d8a3['attributes']:_0x365968[_0xe2da('0x49')];if(!_0x2aa22c[_0xe2da('0x46')][_0xe2da('0x4d')](_0xe2da('0x4e'))){_0x54d8a3[_0xe2da('0x35')]=qs['limit'](_0x2aa22c[_0xe2da('0x46')][_0xe2da('0x35')]);_0x54d8a3[_0xe2da('0x34')]=qs[_0xe2da('0x34')](_0x2aa22c[_0xe2da('0x46')][_0xe2da('0x34')]);}_0x54d8a3[_0xe2da('0x4f')]=qs['sort'](_0x2aa22c[_0xe2da('0x46')]['sort']);_0x54d8a3[_0xe2da('0x50')]=qs[_0xe2da('0x51')](_[_0xe2da('0x52')](_0x2aa22c['query'],_0x365968[_0xe2da('0x51')]),_0x55be3e);if(_0x2aa22c[_0xe2da('0x46')]['filter']){_0x54d8a3[_0xe2da('0x50')]=_[_0xe2da('0x53')](_0x54d8a3[_0xe2da('0x50')],{'$or':_['map'](_0x55be3e,function(_0x164151){if(_0x164151['type']!=='VIRTUAL'){var _0x16a393={};_0x16a393[_0x164151['name']]={'$like':'%'+_0x2aa22c[_0xe2da('0x46')][_0xe2da('0x54')]+'%'};return _0x16a393;}})});}_0x54d8a3=_['merge']({},_0x54d8a3,_0x2aa22c[_0xe2da('0x55')]);var _0x1464b7={'where':_0x54d8a3['where']};return db['WhatsappAccount'][_0xe2da('0x33')](_0x1464b7)['then'](function(_0x115a00){_0x3ef0e8[_0xe2da('0x33')]=_0x115a00;if(_0x2aa22c[_0xe2da('0x46')][_0xe2da('0x56')]){_0x54d8a3[_0xe2da('0x57')]=[{'all':!![]}];}return db[_0xe2da('0x41')][_0xe2da('0x58')](_0x54d8a3);})[_0xe2da('0x3a')](function(_0x1d86a6){_0x3ef0e8['rows']=_0x1d86a6;return _0x3ef0e8;})[_0xe2da('0x3a')](respondWithFilteredResult(_0x27435b,_0x54d8a3))[_0xe2da('0x59')](handleError(_0x27435b,null));};exports[_0xe2da('0x5a')]=function(_0x50c260,_0x17b64f){var _0x270700={'raw':![],'where':{'id':_0x50c260[_0xe2da('0x5b')]['id']},'include':[{'model':db[_0xe2da('0x5c')],'as':_0xe2da('0x5d')}]},_0x36d226={};_0x36d226[_0xe2da('0x49')]=_['keys'](db['WhatsappAccount'][_0xe2da('0x42')]);_0x36d226[_0xe2da('0x46')]=_[_0xe2da('0x47')](_0x50c260['query']);_0x36d226['filters']=_[_0xe2da('0x48')](_0x36d226['model'],_0x36d226[_0xe2da('0x46')]);_0x270700[_0xe2da('0x4b')]=_[_0xe2da('0x48')](_0x36d226[_0xe2da('0x49')],qs[_0xe2da('0x4a')](_0x50c260[_0xe2da('0x46')][_0xe2da('0x4a')]));_0x270700[_0xe2da('0x4b')]=_0x270700[_0xe2da('0x4b')]['length']?_0x270700[_0xe2da('0x4b')]:_0x36d226[_0xe2da('0x49')];if(_0x50c260[_0xe2da('0x46')][_0xe2da('0x56')]){_0x270700['include']=[{'all':!![]}];}_0x270700=_[_0xe2da('0x53')]({},_0x270700,_0x50c260[_0xe2da('0x55')]);return db[_0xe2da('0x41')]['find'](_0x270700)[_0xe2da('0x3a')](handleEntityNotFound(_0x17b64f,null))[_0xe2da('0x3a')](respondWithResult(_0x17b64f,null))[_0xe2da('0x59')](handleError(_0x17b64f,null));};exports[_0xe2da('0x5e')]=function(_0x188bb0,_0x22a571){return db[_0xe2da('0x41')][_0xe2da('0x5e')](_0x188bb0[_0xe2da('0x5f')],{})[_0xe2da('0x3a')](function(_0x154877){var _0x3b4d10=_0x188bb0['user'][_0xe2da('0x3c')]({'plain':!![]});if(!_0x3b4d10)throw new Error(_0xe2da('0x60'));if(_0x3b4d10[_0xe2da('0x61')]===_0xe2da('0x62')){var _0x7526bd=_0x154877[_0xe2da('0x3c')]({'plain':!![]});var _0x1fc0df='WhatsappAccounts';return db[_0xe2da('0x63')]['find']({'where':{'name':_0x1fc0df,'userProfileId':_0x3b4d10[_0xe2da('0x64')]},'raw':!![]})[_0xe2da('0x3a')](function(_0x5b0c33){if(_0x5b0c33&&_0x5b0c33['autoAssociation']===0x0){return db[_0xe2da('0x65')]['create']({'name':_0x7526bd[_0xe2da('0x3e')],'resourceId':_0x7526bd['id'],'type':_0x5b0c33['name'],'sectionId':_0x5b0c33['id']},{})[_0xe2da('0x3a')](function(){return _0x154877;});}else{return _0x154877;}})[_0xe2da('0x59')](function(_0x3558b5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3558b5);throw _0x3558b5;});}return _0x154877;})['then'](respondWithResult(_0x22a571,0xc9))[_0xe2da('0x59')](handleError(_0x22a571,null));};exports[_0xe2da('0x39')]=function(_0x104f47,_0x3bd86e){if(_0x104f47['body']['id']){delete _0x104f47[_0xe2da('0x5f')]['id'];}return db[_0xe2da('0x41')][_0xe2da('0x66')]({'where':{'id':_0x104f47[_0xe2da('0x5b')]['id']},'include':[{'model':db[_0xe2da('0x5c')],'as':_0xe2da('0x5d')}]})[_0xe2da('0x3a')](handleEntityNotFound(_0x3bd86e,null))['then'](saveUpdates(_0x104f47[_0xe2da('0x5f')],null))[_0xe2da('0x3a')](respondWithResult(_0x3bd86e,null))[_0xe2da('0x59')](handleError(_0x3bd86e,null));};exports[_0xe2da('0x3b')]=function(_0x16537b,_0x4cf58d){return db[_0xe2da('0x41')]['find']({'where':{'id':_0x16537b[_0xe2da('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4cf58d,null))[_0xe2da('0x3a')](removeEntity(_0x4cf58d,null))['catch'](handleError(_0x4cf58d,null));};exports['describe']=function(_0x12b911,_0x405743){return db[_0xe2da('0x41')][_0xe2da('0x67')]()[_0xe2da('0x3a')](respondWithResult(_0x405743,null))[_0xe2da('0x59')](handleError(_0x405743,null));};exports[_0xe2da('0x68')]=function(_0xa1a51d,_0x3209ea,_0x17af45){if(_0xa1a51d['body']['id']){delete _0xa1a51d[_0xe2da('0x5f')]['id'];}return db[_0xe2da('0x41')][_0xe2da('0x66')]({'where':{'id':_0xa1a51d[_0xe2da('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3209ea,null))[_0xe2da('0x3a')](function(_0x9877c2){if(_0x9877c2){_0xa1a51d[_0xe2da('0x5f')][_0xe2da('0x69')]=_0x9877c2['id'];return db['Disposition'][_0xe2da('0x5e')](_0xa1a51d['body']);}})[_0xe2da('0x3a')](respondWithResult(_0x3209ea,null))[_0xe2da('0x59')](handleError(_0x3209ea,null));};exports['getDispositions']=function(_0x19f06f,_0xe006f5,_0x2843b){var _0x835995={'raw':![],'where':{}};var _0x42f865={};var _0x4fe3dd={'count':0x0,'rows':[]};return db[_0xe2da('0x41')]['findOne']({'where':{'id':_0x19f06f['params']['id']}})['then'](handleEntityNotFound(_0xe006f5,null))['then'](function(_0x35836b){if(_0x35836b){_0x42f865[_0xe2da('0x49')]=_[_0xe2da('0x47')](db[_0xe2da('0x6a')][_0xe2da('0x42')]);_0x42f865[_0xe2da('0x46')]=_[_0xe2da('0x47')](_0x19f06f[_0xe2da('0x46')]);_0x42f865[_0xe2da('0x51')]=_['intersection'](_0x42f865[_0xe2da('0x49')],_0x42f865[_0xe2da('0x46')]);_0x835995[_0xe2da('0x4b')]=_[_0xe2da('0x48')](_0x42f865[_0xe2da('0x49')],qs[_0xe2da('0x4a')](_0x19f06f[_0xe2da('0x46')][_0xe2da('0x4a')]));_0x835995[_0xe2da('0x4b')]=_0x835995[_0xe2da('0x4b')]['length']?_0x835995[_0xe2da('0x4b')]:_0x42f865[_0xe2da('0x49')];if(!_0x19f06f[_0xe2da('0x46')][_0xe2da('0x4d')](_0xe2da('0x4e'))){_0x835995[_0xe2da('0x35')]=qs[_0xe2da('0x35')](_0x19f06f[_0xe2da('0x46')][_0xe2da('0x35')]);_0x835995[_0xe2da('0x34')]=qs[_0xe2da('0x34')](_0x19f06f[_0xe2da('0x46')]['offset']);}_0x835995[_0xe2da('0x4f')]=qs['sort'](_0x19f06f[_0xe2da('0x46')][_0xe2da('0x6b')]);_0x835995[_0xe2da('0x50')]=qs[_0xe2da('0x51')](_[_0xe2da('0x52')](_0x19f06f[_0xe2da('0x46')],_0x42f865[_0xe2da('0x51')]));_0x835995['where'][_0xe2da('0x69')]=_0x35836b['id'];if(_0x19f06f[_0xe2da('0x46')][_0xe2da('0x54')]){_0x835995[_0xe2da('0x50')]=_[_0xe2da('0x53')](_0x835995[_0xe2da('0x50')],{'$or':_['map'](_0x835995[_0xe2da('0x4b')],function(_0x3d1083){var _0xd94955={};_0xd94955[_0x3d1083]={'$like':'%'+_0x19f06f[_0xe2da('0x46')][_0xe2da('0x54')]+'%'};return _0xd94955;})});}_0x835995=_[_0xe2da('0x53')]({},_0x835995,_0x19f06f[_0xe2da('0x55')]);return db['Disposition'][_0xe2da('0x33')]({'where':_0x835995[_0xe2da('0x50')]})[_0xe2da('0x3a')](function(_0x172745){_0x4fe3dd[_0xe2da('0x33')]=_0x172745;if(_0x19f06f[_0xe2da('0x46')]['includeAll']){_0x835995[_0xe2da('0x57')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x835995);})[_0xe2da('0x3a')](function(_0x6b5a99){_0x4fe3dd[_0xe2da('0x6c')]=_0x6b5a99;return _0x4fe3dd;});}})['then'](respondWithFilteredResult(_0xe006f5,_0x835995))[_0xe2da('0x59')](handleError(_0xe006f5,null));};exports[_0xe2da('0x6d')]=function(_0x20bf30,_0x2508d6,_0x4dba4d){return db[_0xe2da('0x41')]['find']({'where':{'id':_0x20bf30['params']['id']}})[_0xe2da('0x3a')](handleEntityNotFound(_0x2508d6,null))[_0xe2da('0x3a')](function(_0x4419af){if(_0x4419af){return _0x4419af[_0xe2da('0x6d')](_0x20bf30[_0xe2da('0x46')][_0xe2da('0x6e')]);}})['then'](respondWithStatusCode(_0x2508d6,null))[_0xe2da('0x59')](handleError(_0x2508d6,null));};exports[_0xe2da('0x6f')]=function(_0x10a3f3,_0x4a1808,_0x3a4104){if(_0x10a3f3[_0xe2da('0x5f')]['id']){delete _0x10a3f3[_0xe2da('0x5f')]['id'];}return db['WhatsappAccount'][_0xe2da('0x66')]({'where':{'id':_0x10a3f3[_0xe2da('0x5b')]['id']}})[_0xe2da('0x3a')](handleEntityNotFound(_0x4a1808,null))[_0xe2da('0x3a')](function(_0x283fb4){if(_0x283fb4){_0x10a3f3['body'][_0xe2da('0x69')]=_0x283fb4['id'];return db[_0xe2da('0x70')][_0xe2da('0x5e')](_0x10a3f3[_0xe2da('0x5f')]);}})[_0xe2da('0x3a')](respondWithResult(_0x4a1808,null))[_0xe2da('0x59')](handleError(_0x4a1808,null));};exports[_0xe2da('0x71')]=function(_0x10d3ed,_0x862f5c,_0x5e6c49){var _0x312c7a={'raw':![],'where':{}};var _0x38fc64={};var _0x53d3c3={'count':0x0,'rows':[]};return db[_0xe2da('0x41')]['findOne']({'where':{'id':_0x10d3ed['params']['id']}})['then'](handleEntityNotFound(_0x862f5c,null))[_0xe2da('0x3a')](function(_0x69d108){if(_0x69d108){_0x38fc64['model']=_[_0xe2da('0x47')](db['CannedAnswer'][_0xe2da('0x42')]);_0x38fc64[_0xe2da('0x46')]=_[_0xe2da('0x47')](_0x10d3ed[_0xe2da('0x46')]);_0x38fc64[_0xe2da('0x51')]=_[_0xe2da('0x48')](_0x38fc64[_0xe2da('0x49')],_0x38fc64['query']);_0x312c7a['attributes']=_[_0xe2da('0x48')](_0x38fc64[_0xe2da('0x49')],qs[_0xe2da('0x4a')](_0x10d3ed[_0xe2da('0x46')]['fields']));_0x312c7a[_0xe2da('0x4b')]=_0x312c7a['attributes'][_0xe2da('0x4c')]?_0x312c7a[_0xe2da('0x4b')]:_0x38fc64[_0xe2da('0x49')];if(!_0x10d3ed[_0xe2da('0x46')][_0xe2da('0x4d')](_0xe2da('0x4e'))){_0x312c7a['limit']=qs[_0xe2da('0x35')](_0x10d3ed[_0xe2da('0x46')][_0xe2da('0x35')]);_0x312c7a[_0xe2da('0x34')]=qs[_0xe2da('0x34')](_0x10d3ed[_0xe2da('0x46')][_0xe2da('0x34')]);}_0x312c7a[_0xe2da('0x4f')]=qs['sort'](_0x10d3ed[_0xe2da('0x46')]['sort']);_0x312c7a[_0xe2da('0x50')]=qs[_0xe2da('0x51')](_['pick'](_0x10d3ed['query'],_0x38fc64[_0xe2da('0x51')]));_0x312c7a['where'][_0xe2da('0x69')]=_0x69d108['id'];if(_0x10d3ed[_0xe2da('0x46')][_0xe2da('0x54')]){_0x312c7a['where']=_[_0xe2da('0x53')](_0x312c7a['where'],{'$or':_['map'](_0x312c7a[_0xe2da('0x4b')],function(_0x32f9db){var _0x4f6f55={};_0x4f6f55[_0x32f9db]={'$like':'%'+_0x10d3ed[_0xe2da('0x46')]['filter']+'%'};return _0x4f6f55;})});}_0x312c7a=_[_0xe2da('0x53')]({},_0x312c7a,_0x10d3ed[_0xe2da('0x55')]);return db[_0xe2da('0x70')][_0xe2da('0x33')]({'where':_0x312c7a[_0xe2da('0x50')]})['then'](function(_0x1f2f94){_0x53d3c3[_0xe2da('0x33')]=_0x1f2f94;if(_0x10d3ed[_0xe2da('0x46')]['includeAll']){_0x312c7a[_0xe2da('0x57')]=[{'all':!![]}];}return db[_0xe2da('0x70')][_0xe2da('0x58')](_0x312c7a);})[_0xe2da('0x3a')](function(_0x36cf43){_0x53d3c3[_0xe2da('0x6c')]=_0x36cf43;return _0x53d3c3;});}})[_0xe2da('0x3a')](respondWithFilteredResult(_0x862f5c,_0x312c7a))[_0xe2da('0x59')](handleError(_0x862f5c,null));};exports['removeAnswers']=function(_0x481137,_0x8ef53e,_0x507d18){return db[_0xe2da('0x41')][_0xe2da('0x66')]({'where':{'id':_0x481137[_0xe2da('0x5b')]['id']}})[_0xe2da('0x3a')](handleEntityNotFound(_0x8ef53e,null))[_0xe2da('0x3a')](function(_0x456649){if(_0x456649){return _0x456649[_0xe2da('0x72')](_0x481137['query'][_0xe2da('0x6e')]);}})['then'](respondWithStatusCode(_0x8ef53e,null))[_0xe2da('0x59')](handleError(_0x8ef53e,null));};exports['addAgents']=function(_0x4800fd,_0x45dbb3,_0x2e684a){return db[_0xe2da('0x41')][_0xe2da('0x66')]({'where':{'id':_0x4800fd[_0xe2da('0x5b')]['id']}})[_0xe2da('0x3a')](handleEntityNotFound(_0x45dbb3,null))[_0xe2da('0x3a')](function(_0x52f25b){if(_0x52f25b){return _0x52f25b[_0xe2da('0x73')](_0x4800fd[_0xe2da('0x5f')][_0xe2da('0x6e')],_['omit'](_0x4800fd[_0xe2da('0x5f')],['ids','id'])||{})['spread'](function(_0x17c7da){for(var _0x7ec526=0x0;_0x7ec526<_0x4800fd['body']['ids'][_0xe2da('0x4c')];_0x7ec526+=0x1){socket['emit'](_0xe2da('0x74'),{'UserId':_0x4800fd[_0xe2da('0x5f')][_0xe2da('0x6e')][_0x7ec526],'WhatsappAccountId':_0x4800fd[_0xe2da('0x5b')]['id']});}return _0x17c7da;});}})[_0xe2da('0x3a')](respondWithResult(_0x45dbb3,null))[_0xe2da('0x59')](handleError(_0x45dbb3,null));};exports['removeAgents']=function(_0x29a89d,_0xc41f34,_0x21dff0){return db[_0xe2da('0x41')][_0xe2da('0x66')]({'where':{'id':_0x29a89d[_0xe2da('0x5b')]['id']}})['then'](handleEntityNotFound(_0xc41f34,null))[_0xe2da('0x3a')](function(_0x30eadd){if(_0x30eadd){return _0x30eadd[_0xe2da('0x75')](_0x29a89d['query'][_0xe2da('0x6e')])[_0xe2da('0x3a')](function(){if(_[_0xe2da('0x76')](_0x29a89d[_0xe2da('0x46')][_0xe2da('0x6e')])){for(var _0x2b6c45=0x0;_0x2b6c45<_0x29a89d['query']['ids'][_0xe2da('0x4c')];_0x2b6c45+=0x1){socket[_0xe2da('0x77')]('userWhatsappAccount:remove',{'UserId':Number(_0x29a89d['query'][_0xe2da('0x6e')][_0x2b6c45]),'WhatsappAccountId':Number(_0x29a89d['params']['id'])});}}else{socket[_0xe2da('0x77')](_0xe2da('0x78'),{'UserId':Number(_0x29a89d['query'][_0xe2da('0x6e')]),'WhatsappAccountId':Number(_0x29a89d[_0xe2da('0x5b')]['id'])});}});}})[_0xe2da('0x3a')](respondWithStatusCode(_0xc41f34,null))[_0xe2da('0x59')](handleError(_0xc41f34,null));};exports[_0xe2da('0x79')]=function(_0x18f79a,_0x5bc403,_0x236933){var _0x5ecfa1={};var _0x2bf538={};var _0x39c44b;var _0x12ff1f;return db['WhatsappAccount'][_0xe2da('0x7a')]({'where':{'id':_0x18f79a['params']['id']}})[_0xe2da('0x3a')](handleEntityNotFound(_0x5bc403,null))['then'](function(_0x4c6b21){if(_0x4c6b21){_0x39c44b=_0x4c6b21;_0x2bf538[_0xe2da('0x49')]=_['keys'](db[_0xe2da('0x7b')][_0xe2da('0x42')]);_0x2bf538[_0xe2da('0x46')]=_[_0xe2da('0x47')](_0x18f79a[_0xe2da('0x46')]);_0x2bf538[_0xe2da('0x51')]=_[_0xe2da('0x48')](_0x2bf538['model'],_0x2bf538['query']);_0x5ecfa1[_0xe2da('0x4b')]=_[_0xe2da('0x48')](_0x2bf538[_0xe2da('0x49')],qs[_0xe2da('0x4a')](_0x18f79a[_0xe2da('0x46')][_0xe2da('0x4a')]));_0x5ecfa1['attributes']=_0x5ecfa1['attributes'][_0xe2da('0x4c')]?_0x5ecfa1[_0xe2da('0x4b')]:_0x2bf538[_0xe2da('0x49')];_0x5ecfa1['order']=qs[_0xe2da('0x6b')](_0x18f79a[_0xe2da('0x46')][_0xe2da('0x6b')]);_0x5ecfa1[_0xe2da('0x50')]=qs['filters'](_[_0xe2da('0x52')](_0x18f79a['query'],_0x2bf538['filters']));if(_0x18f79a[_0xe2da('0x46')]['filter']){_0x5ecfa1['where']=_[_0xe2da('0x53')](_0x5ecfa1[_0xe2da('0x50')],{'$or':_[_0xe2da('0x40')](_0x5ecfa1[_0xe2da('0x4b')],function(_0x4be1fe){var _0x1d71c6={};_0x1d71c6[_0x4be1fe]={'$like':'%'+_0x18f79a['query']['filter']+'%'};return _0x1d71c6;})});}_0x5ecfa1=_['merge']({},_0x5ecfa1,_0x18f79a[_0xe2da('0x55')]);return _0x39c44b[_0xe2da('0x79')](_0x5ecfa1);}})['then'](function(_0xc7be7){if(_0xc7be7){_0x12ff1f=_0xc7be7[_0xe2da('0x4c')];if(!_0x18f79a['query'][_0xe2da('0x4d')](_0xe2da('0x4e'))){_0x5ecfa1['limit']=qs[_0xe2da('0x35')](_0x18f79a['query'][_0xe2da('0x35')]);_0x5ecfa1[_0xe2da('0x34')]=qs['offset'](_0x18f79a['query'][_0xe2da('0x34')]);}return _0x39c44b[_0xe2da('0x79')](_0x5ecfa1);}})[_0xe2da('0x3a')](function(_0x5a6e1f){if(_0x5a6e1f){return _0x5a6e1f?{'count':_0x12ff1f,'rows':_0x5a6e1f}:null;}})['then'](respondWithResult(_0x5bc403,null))['catch'](handleError(_0x5bc403,null));};exports['addApplications']=function(_0x244e96,_0x3fc83f,_0x13f4bb){return db[_0xe2da('0x41')][_0xe2da('0x7a')]({'where':{'id':_0x244e96[_0xe2da('0x5b')]['id']}})[_0xe2da('0x3a')](handleEntityNotFound(_0x3fc83f,null))[_0xe2da('0x3a')](function(_0x3073a9){if(_0x3073a9){return db[_0xe2da('0x7c')][_0xe2da('0x7d')](function(_0xf328ac){return db['WhatsappApplication'][_0xe2da('0x3b')]({'where':{'WhatsappAccountId':_0x244e96[_0xe2da('0x5b')]['id']},'transaction':_0xf328ac})['then'](function(_0x134373){var _0x38cf52=_[_0xe2da('0x40')](_0x244e96[_0xe2da('0x5f')],function(_0x5eb8cb){_0x5eb8cb[_0xe2da('0x69')]=_0x244e96[_0xe2da('0x5b')]['id'];return _0x5eb8cb;});return db[_0xe2da('0x7e')][_0xe2da('0x7f')](_0x38cf52,{'transaction':_0xf328ac});});})[_0xe2da('0x3a')](function(){return db[_0xe2da('0x7e')][_0xe2da('0x80')]({'where':{'WhatsappAccountId':_0x244e96[_0xe2da('0x5b')]['id']},'order':_0xe2da('0x81')});});}})[_0xe2da('0x3a')](respondWithResult(_0x3fc83f,null))[_0xe2da('0x59')](handleError(_0x3fc83f,null));};exports[_0xe2da('0x82')]=function(_0x5e0e20,_0x39c18a,_0x59df7){var _0x41c519={};var _0x5461ef={};var _0x3c4065;var _0x2bdd56;return db[_0xe2da('0x41')][_0xe2da('0x7a')]({'where':{'id':_0x5e0e20[_0xe2da('0x5b')]['id']}})[_0xe2da('0x3a')](handleEntityNotFound(_0x39c18a,null))['then'](function(_0x1535e3){if(_0x1535e3){_0x3c4065=_0x1535e3;_0x5461ef[_0xe2da('0x49')]=_[_0xe2da('0x47')](db[_0xe2da('0x7e')][_0xe2da('0x42')]);_0x5461ef['query']=_['keys'](_0x5e0e20[_0xe2da('0x46')]);_0x5461ef[_0xe2da('0x51')]=_['intersection'](_0x5461ef[_0xe2da('0x49')],_0x5461ef[_0xe2da('0x46')]);_0x41c519[_0xe2da('0x4b')]=_[_0xe2da('0x48')](_0x5461ef[_0xe2da('0x49')],qs['fields'](_0x5e0e20[_0xe2da('0x46')][_0xe2da('0x4a')]));_0x41c519['attributes']=_0x41c519['attributes']['length']?_0x41c519[_0xe2da('0x4b')]:_0x5461ef['model'];_0x41c519['order']=qs['sort'](_0x5e0e20[_0xe2da('0x46')]['sort']);_0x41c519[_0xe2da('0x50')]=qs[_0xe2da('0x51')](_[_0xe2da('0x52')](_0x5e0e20[_0xe2da('0x46')],_0x5461ef['filters']));if(_0x5e0e20[_0xe2da('0x46')][_0xe2da('0x54')]){_0x41c519[_0xe2da('0x50')]=_[_0xe2da('0x53')](_0x41c519[_0xe2da('0x50')],{'$or':_[_0xe2da('0x40')](_0x41c519[_0xe2da('0x4b')],function(_0x394176){var _0xa4188={};_0xa4188[_0x394176]={'$like':'%'+_0x5e0e20[_0xe2da('0x46')][_0xe2da('0x54')]+'%'};return _0xa4188;})});}_0x41c519=_[_0xe2da('0x53')]({},_0x41c519,_0x5e0e20[_0xe2da('0x55')]);return _0x3c4065[_0xe2da('0x82')](_0x41c519);}})['then'](function(_0x541fce){if(_0x541fce){_0x2bdd56=_0x541fce['length'];if(!_0x5e0e20[_0xe2da('0x46')][_0xe2da('0x4d')](_0xe2da('0x4e'))){_0x41c519['limit']=qs[_0xe2da('0x35')](_0x5e0e20[_0xe2da('0x46')][_0xe2da('0x35')]);_0x41c519[_0xe2da('0x34')]=qs[_0xe2da('0x34')](_0x5e0e20[_0xe2da('0x46')]['offset']);}return _0x3c4065[_0xe2da('0x82')](_0x41c519);}})[_0xe2da('0x3a')](function(_0x27f6a9){if(_0x27f6a9){return _0x27f6a9?{'count':_0x2bdd56,'rows':_0x27f6a9}:null;}})[_0xe2da('0x3a')](respondWithResult(_0x39c18a,null))[_0xe2da('0x59')](handleError(_0x39c18a,null));};exports[_0xe2da('0x83')]=function(_0x4b30b2,_0x2b6d27,_0x2d6ee0){var _0x12c4a7={'channel':'whatsapp'};var _0x18a7ba=[];var _0x57e4a4=[];var _0x1970ff={};return db[_0xe2da('0x41')][_0xe2da('0x66')]({'where':{'id':_0x4b30b2[_0xe2da('0x5b')]['id']},'include':[{'model':db[_0xe2da('0x7e')],'as':'Applications'}]})[_0xe2da('0x3a')](handleEntityNotFound(_0x2b6d27,null))[_0xe2da('0x3a')](function(_0x2fa2f9){_0x12c4a7[_0xe2da('0x84')]=_0x2fa2f9;_0x12c4a7['applications']=_[_0xe2da('0x85')](_0x2fa2f9[_0xe2da('0x86')],['priority'],[_0xe2da('0x87')]);if(_0x12c4a7[_0xe2da('0x84')][_0xe2da('0x86')]){delete _0x12c4a7[_0xe2da('0x84')][_0xe2da('0x86')];}return db[_0xe2da('0x88')]['describe']();})[_0xe2da('0x3a')](function(_0x38a60d){if(!_0x38a60d){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x18a7ba=_['difference'](_['keys'](_0x38a60d),[_0xe2da('0x89'),_0xe2da('0x8a')]);_0x57e4a4=_['difference'](_[_0xe2da('0x47')](_0x38a60d),[_0xe2da('0x89'),_0xe2da('0x8a'),_0xe2da('0x8b'),_0xe2da('0x8c')]);_0x12c4a7[_0xe2da('0x5f')]={'mapKey':_0xe2da('0x8d')};if(_0x12c4a7[_0xe2da('0x84')][_0xe2da('0x44')]&&_0x12c4a7[_0xe2da('0x84')][_0xe2da('0x44')]===_0xe2da('0x8e')){_0x12c4a7[_0xe2da('0x5f')][_0xe2da('0x8f')]=_0x4b30b2[_0xe2da('0x5f')]['From']['replace'](_0xe2da('0x90'),'');_0x12c4a7[_0xe2da('0x5f')]['body']=_0x4b30b2[_0xe2da('0x5f')]['Body'];_0x12c4a7[_0xe2da('0x5f')][_0xe2da('0x91')]=_0x4b30b2[_0xe2da('0x5f')][_0xe2da('0x92')];}if(_0x12c4a7['body']['id']){delete _0x12c4a7[_0xe2da('0x5f')]['id'];}if(_[_0xe2da('0x93')](_0x12c4a7[_0xe2da('0x5f')][_0xe2da('0x8f')])){throw new db[(_0xe2da('0x94'))][(_0xe2da('0x23'))](_0xe2da('0x95'));}if(_[_0xe2da('0x93')](_0x12c4a7[_0xe2da('0x5f')][_0xe2da('0x5f')])||_0x12c4a7[_0xe2da('0x5f')][_0xe2da('0x5f')]===''){throw new db[(_0xe2da('0x94'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe2da('0x93')](_0x12c4a7[_0xe2da('0x5f')]['mapKey'])){throw new db[(_0xe2da('0x94'))][(_0xe2da('0x23'))](_0xe2da('0x96')+_0x57e4a4);}if(!_[_0xe2da('0x97')](_0x57e4a4,_0x12c4a7[_0xe2da('0x5f')]['mapKey'])){throw new db[(_0xe2da('0x94'))][(_0xe2da('0x23'))](_0xe2da('0x98')+_0x57e4a4);}_0x1970ff[_0x12c4a7[_0xe2da('0x5f')][_0xe2da('0x99')]]=_0x12c4a7[_0xe2da('0x5f')][_0xe2da('0x8f')];return db[_0xe2da('0x9a')]['find']({'where':{'id':_0x12c4a7['account'][_0xe2da('0x8c')]},'include':[{'model':db[_0xe2da('0x88')],'as':_0xe2da('0x9b'),'where':_0x1970ff,'limit':0x1,'order':[[_0xe2da('0x8a'),'DESC']]}]});})[_0xe2da('0x3a')](handleEntityNotFound(_0x2b6d27,null))[_0xe2da('0x3a')](function(_0x48a011){if(_0x48a011){_0x12c4a7[_0xe2da('0x9c')]=_[_0xe2da('0x9d')](_0x48a011,[_0xe2da('0x9b')]);if(_0x48a011[_0xe2da('0x9b')][_0xe2da('0x4c')]){return _0x48a011['Contacts'][0x0];}var _0x3828e3=_[_0xe2da('0x9e')](_0x12c4a7[_0xe2da('0x5f')],{'firstName':_0x12c4a7[_0xe2da('0x5f')]['from'],'ListId':_0x48a011['id']});_0x3828e3[_0x12c4a7[_0xe2da('0x5f')][_0xe2da('0x99')]]=_0x12c4a7[_0xe2da('0x5f')]['from'];return db['CmContact'][_0xe2da('0x5e')](_0x3828e3,{'fields':_0x18a7ba,'raw':!![]});}})[_0xe2da('0x3a')](handleEntityNotFound(_0x2b6d27,null))[_0xe2da('0x3a')](function(_0x25c9b9){if(_0x25c9b9){_0x12c4a7['contact']=_0x25c9b9;var _0x2fc787={'ContactId':_0x25c9b9['id'],'phone':_0x12c4a7[_0xe2da('0x5f')][_0xe2da('0x8f')],'WhatsappAccountId':_0x4b30b2[_0xe2da('0x5b')]['id']};var _0x19da52={'ContactId':_0x25c9b9['id'],'WhatsappAccountId':_0x4b30b2[_0xe2da('0x5b')]['id'],'closed':![]};return db[_0xe2da('0x9f')][_0xe2da('0x66')]({'where':_0x19da52})['then'](function(_0x3126f7){if(_0x3126f7){return[_0x3126f7,![]];}return db[_0xe2da('0x9f')][_0xe2da('0x5e')](_0x2fc787)[_0xe2da('0x3a')](function(_0x5038b0){return[_0x5038b0,!![]];});});}})[_0xe2da('0xa0')](function(_0x191113,_0x40636b){_0x12c4a7[_0xe2da('0xa1')]=_0x191113[_0xe2da('0x3c')]({'plain':!![]});_0x12c4a7[_0xe2da('0xa1')][_0xe2da('0xa2')]=![];if(_0x40636b){if(_0x12c4a7[_0xe2da('0x84')][_0xe2da('0xa3')]){_0x12c4a7[_0xe2da('0xa4')]['push']({'id':0x0,'priority':_0x12c4a7[_0xe2da('0xa4')][_0xe2da('0x4c')]+0x1,'app':'close','appdata':_0xe2da('0xa5'),'interval':_0xe2da('0xa6')});}_0x12c4a7[_0xe2da('0xa1')][_0xe2da('0xa2')]=!![];}return db[_0xe2da('0xa7')][_0xe2da('0x5e')]({'phone':_0x12c4a7[_0xe2da('0x5f')][_0xe2da('0x8f')],'messageId':_0x12c4a7[_0xe2da('0x5f')][_0xe2da('0x91')],'body':_0x12c4a7[_0xe2da('0x5f')][_0xe2da('0x5f')],'WhatsappAccountId':_0x4b30b2[_0xe2da('0x5b')]['id'],'WhatsappInteractionId':_0x191113['id'],'direction':'in','ContactId':_0x191113[_0xe2da('0xa8')],'AttachmentId':_0x12c4a7[_0xe2da('0x5f')][_0xe2da('0xa9')]});})[_0xe2da('0x3a')](function(_0x40215e){_0x12c4a7[_0xe2da('0x2e')]=_0x40215e;if(_0x12c4a7[_0xe2da('0xa1')][_0xe2da('0xaa')]){return db[_0xe2da('0x7b')][_0xe2da('0x66')]({'attributes':['id',_0xe2da('0x3e')],'where':{'id':_0x12c4a7[_0xe2da('0xa1')]['UserId']}})[_0xe2da('0x3a')](function(_0x13f188){if(_0x13f188){_0x12c4a7[_0xe2da('0xa4')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe2da('0xab'),'appdata':_0x13f188[_0xe2da('0x3e')]+','+(_0x12c4a7[_0xe2da('0x84')][_0xe2da('0xac')]||0xa),'interval':_0xe2da('0xa6')});}return respondWithRpcPromise(_0xe2da('0xad'),_0xe2da('0xae'),_0x12c4a7);});}return respondWithRpcPromise(_0xe2da('0xad'),'startRouting',_0x12c4a7);})[_0xe2da('0x3a')](function(_0x51431f){if(_0x51431f){var _0x5bcf6b=0xc8;var _0x33d86e='receiveMessage';logger[_0xe2da('0x26')](_0xe2da('0x29'),_0x33d86e,_0x5bcf6b,_0xe2da('0xaf'));logger[_0xe2da('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x33d86e,_0x5bcf6b,'entity\x20found',JSON[_0xe2da('0x2a')](_0x51431f));if(_0x12c4a7[_0xe2da('0x84')][_0xe2da('0x44')]===_0xe2da('0x8e')){return _0x2b6d27[_0xe2da('0x31')](_0x5bcf6b)[_0xe2da('0xb0')](_0xe2da('0xb1'),_0xe2da('0xb2'))[_0xe2da('0x3f')](_0xe2da('0xb3'));}else{return _0x2b6d27[_0xe2da('0x31')](_0x5bcf6b)[_0xe2da('0x32')](_0x51431f);}}})[_0xe2da('0x59')](handleError(_0x2b6d27,null));};exports['send']=function(_0x1f8b64,_0x3a2f79,_0x33f6de){var _0x1833f8,_0x201ce5,_0x85615e;if(_[_0xe2da('0x93')](_0x1f8b64[_0xe2da('0x5f')][_0xe2da('0x5f')])||_0x1f8b64[_0xe2da('0x5f')][_0xe2da('0x5f')]===''){throw new db[(_0xe2da('0x94'))][(_0xe2da('0x23'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1f8b64[_0xe2da('0x5f')]['to'])){throw new db[(_0xe2da('0x94'))][(_0xe2da('0x23'))]('to\x20is\x20mandatory');}_0x1833f8=_0x1f8b64['body']['to'];return db[_0xe2da('0x41')]['find']({'where':{'id':_0x1f8b64[_0xe2da('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0xe2da('0xb4'),'include':[{'model':db[_0xe2da('0x88')],'as':_0xe2da('0x9b'),'where':{'mobile':_0x1833f8},'limit':0x1,'order':[[_0xe2da('0x8a'),_0xe2da('0xb5')]]}]}]})[_0xe2da('0x3a')](handleEntityNotFound(_0x3a2f79,null))[_0xe2da('0x3a')](function(_0x21b8b1){if(_0x21b8b1&&_0x21b8b1[_0xe2da('0xb4')]){_0x201ce5=_0x21b8b1['get']({'plain':!![]});if(_0x201ce5[_0xe2da('0xb4')]&&_0x201ce5[_0xe2da('0xb4')][_0xe2da('0x9b')][_0xe2da('0x4c')]){return _0x201ce5[_0xe2da('0xb4')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0xe2da('0x9e')](_0x1f8b64[_0xe2da('0x5f')],{'firstName':_0x1833f8,'mobile':_0x1833f8,'phone':_0x1833f8,'ListId':_0x201ce5[_0xe2da('0x8c')]}));}})['then'](handleEntityNotFound(_0x3a2f79,null))[_0xe2da('0x3a')](function(_0x34f9e4){if(_0x34f9e4){_0x85615e=_0x34f9e4;return db[_0xe2da('0x9f')][_0xe2da('0x66')]({'where':{'ContactId':_0x85615e['id'],'closed':![],'WhatsappAccountId':_0x201ce5['id']}})[_0xe2da('0x3a')](function(_0x3ac749){if(_0x3ac749){return[_0x3ac749,![]];}return db[_0xe2da('0x9f')][_0xe2da('0x5e')]({'UserId':_0x1f8b64[_0xe2da('0x62')]['id'],'ContactId':_0x85615e['id'],'WhatsappAccountId':_0x201ce5['id'],'phone':_0x1833f8,'firstMsgDirection':_0xe2da('0xb6'),'Messages':[_[_0xe2da('0x53')](_0x1f8b64[_0xe2da('0x5f')],{'read':![],'body':_0x1f8b64['body'][_0xe2da('0x5f')],'phone':_0x1833f8,'WhatsappAccountId':_0x201ce5['id'],'UserId':_0x1f8b64[_0xe2da('0x62')]['id'],'ContactId':_0x85615e['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xe2da('0xb7')}]})[_0xe2da('0x3a')](function(_0x37e2e8){return[_0x37e2e8,!![]];});});}})[_0xe2da('0xa0')](function(_0x2c817a,_0x4588c2){if(_0x4588c2){return _0x2c817a;}return db[_0xe2da('0xa7')][_0xe2da('0x5e')](_['merge'](_0x1f8b64[_0xe2da('0x5f')],{'read':![],'body':_0x1f8b64['body'][_0xe2da('0x5f')],'phone':_0x1833f8,'WhatsappAccountId':_0x201ce5['id'],'WhatsappInteractionId':_0x2c817a['id'],'UserId':_0x1f8b64['user']['id'],'ContactId':_0x85615e['id']}))['then'](function(_0x4dfc17){_0x2c817a[_0xe2da('0xb8')][_0xe2da('0xb7')]=[];_0x2c817a[_0xe2da('0xb8')]['Messages'][_0xe2da('0xb9')](_0x4dfc17[_0xe2da('0xb8')]);return _0x2c817a;});})[_0xe2da('0x3a')](respondWithResult(_0x3a2f79,null))[_0xe2da('0x59')](handleError(_0x3a2f79,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 059311c..4da132f 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 _0xe3da=['../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3f3688,_0x313e6a){var _0x1ad02b=function(_0x3310e4){while(--_0x3310e4){_0x3f3688['push'](_0x3f3688['shift']());}};_0x1ad02b(++_0x313e6a);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xae3d('0x0'));var WhatsappAccount=require(_0xae3d('0x1'))['db'][_0xae3d('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xae3d('0x3')](0x0);var events={'afterCreate':_0xae3d('0x4'),'afterUpdate':_0xae3d('0x5'),'afterDestroy':_0xae3d('0x6')};function emitEvent(_0x17952f){return function(_0xb2dfd3,_0x22bacf,_0x1b9397){WhatsappAccountEvents[_0xae3d('0x7')](_0x17952f+':'+_0xb2dfd3['id'],_0xb2dfd3);WhatsappAccountEvents[_0xae3d('0x7')](_0x17952f,_0xb2dfd3);_0x1b9397(null);};}for(var e in events){if(events[_0xae3d('0x8')](e)){var event=events[e];WhatsappAccount[_0xae3d('0x9')](e,emitEvent(event));}}module[_0xae3d('0xa')]=WhatsappAccountEvents; \ No newline at end of file +var _0x323f=['save','update','remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x4b040b,_0x5f3f0b){var _0x22c56c=function(_0xd807b4){while(--_0xd807b4){_0x4b040b['push'](_0x4b040b['shift']());}};_0x22c56c(++_0x5f3f0b);}(_0x323f,0x1ee));var _0xf323=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x323f[_0x484e36];return _0xafc85d;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xf323('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf323('0x1')](0x0);var events={'afterCreate':_0xf323('0x2'),'afterUpdate':_0xf323('0x3'),'afterDestroy':_0xf323('0x4')};function emitEvent(_0x111042){return function(_0x2c9d35,_0xb4caa8,_0x2d4750){WhatsappAccountEvents[_0xf323('0x5')](_0x111042+':'+_0x2c9d35['id'],_0x2c9d35);WhatsappAccountEvents[_0xf323('0x5')](_0x111042,_0x2c9d35);_0x2d4750(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xf323('0x6')](e,emitEvent(event));}}module[_0xf323('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index d417b46..443e498 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 _0x0335=['./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x428659,_0x14feb4){var _0x48b985=function(_0x3d81d2){while(--_0x3d81d2){_0x428659['push'](_0x428659['shift']());}};_0x48b985(++_0x14feb4);}(_0x0335,0x162));var _0x5033=function(_0x5bf3c8,_0x5c268b){_0x5bf3c8=_0x5bf3c8-0x0;var _0xf2a998=_0x0335[_0x5bf3c8];return _0xf2a998;};'use strict';var _=require('lodash');var util=require(_0x5033('0x0'));var logger=require(_0x5033('0x1'))('api');var moment=require(_0x5033('0x2'));var BPromise=require(_0x5033('0x3'));var rp=require(_0x5033('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5033('0x5'));var attributes=require(_0x5033('0x6'));module['exports']=function(_0x5125e2,_0x585a22){return _0x5125e2[_0x5033('0x7')](_0x5033('0x8'),attributes,{'tableName':_0x5033('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4171=['util','api','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x436cd8,_0x4955d2){var _0x1bd84e=function(_0x269bdf){while(--_0x269bdf){_0x436cd8['push'](_0x436cd8['shift']());}};_0x1bd84e(++_0x4955d2);}(_0x4171,0xbb));var _0x1417=function(_0x3b8f97,_0x18771){_0x3b8f97=_0x3b8f97-0x0;var _0x36667d=_0x4171[_0x3b8f97];return _0x36667d;};'use strict';var _=require('lodash');var util=require(_0x1417('0x0'));var logger=require('../../config/logger')(_0x1417('0x1'));var moment=require('moment');var BPromise=require(_0x1417('0x2'));var rp=require(_0x1417('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1417('0x4'));var config=require(_0x1417('0x5'));var attributes=require(_0x1417('0x6'));module[_0x1417('0x7')]=function(_0x294175,_0x3d4815){return _0x294175[_0x1417('0x8')](_0x1417('0x9'),attributes,{'tableName':_0x1417('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 ee47914..9a3e19a 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 _0x1a41=['options','attributes','include','map','model','then','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowWhatsappAccount','WhatsappAccount'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x1a41,0x126));var _0x11a4=function(_0x52006f,_0x35cfdf){_0x52006f=_0x52006f-0x0;var _0x441eff=_0x1a41[_0x52006f];return _0x441eff;};'use strict';var _=require('lodash');var util=require(_0x11a4('0x0'));var moment=require('moment');var BPromise=require(_0x11a4('0x1'));var rs=require(_0x11a4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11a4('0x3'))['db'];var utils=require(_0x11a4('0x4'));var logger=require(_0x11a4('0x5'))('rpc');var config=require(_0x11a4('0x6'));var jayson=require(_0x11a4('0x7'));var client=jayson['client'][_0x11a4('0x8')]({'port':0x232a});config[_0x11a4('0x9')]=_[_0x11a4('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x11a4('0xb'))(new Redis(config[_0x11a4('0x9')]));require(_0x11a4('0xc'))['register'](socket);function respondWithRpcPromise(_0x5d148f,_0x46d15d,_0x5781ee){return new BPromise(function(_0x3bc0bf,_0x4be9a7){return client[_0x11a4('0xd')](_0x5d148f,_0x5781ee)['then'](function(_0x2e8949){logger[_0x11a4('0xe')](_0x11a4('0xf'),_0x46d15d,_0x11a4('0x10'));logger[_0x11a4('0x11')](_0x11a4('0x12'),_0x46d15d,_0x11a4('0x10'),JSON[_0x11a4('0x13')](_0x2e8949));if(_0x2e8949[_0x11a4('0x14')]){if(_0x2e8949[_0x11a4('0x14')][_0x11a4('0x15')]===0x1f4){logger[_0x11a4('0x14')](_0x11a4('0xf'),_0x46d15d,_0x2e8949[_0x11a4('0x14')]['message']);return _0x4be9a7(_0x2e8949[_0x11a4('0x14')][_0x11a4('0x16')]);}logger[_0x11a4('0x14')](_0x11a4('0xf'),_0x46d15d,_0x2e8949[_0x11a4('0x14')][_0x11a4('0x16')]);return _0x3bc0bf(_0x2e8949[_0x11a4('0x14')][_0x11a4('0x16')]);}else{logger[_0x11a4('0xe')](_0x11a4('0xf'),_0x46d15d,_0x11a4('0x10'));_0x3bc0bf(_0x2e8949['result'][_0x11a4('0x16')]);}})[_0x11a4('0x17')](function(_0x27f48c){logger[_0x11a4('0x14')](_0x11a4('0xf'),_0x46d15d,_0x27f48c);_0x4be9a7(_0x27f48c);});});}exports[_0x11a4('0x18')]=function(_0x36ba70){var _0x520517=this;return new Promise(function(_0xfd3e1b,_0x896804){return db[_0x11a4('0x19')]['find']({'raw':_0x36ba70[_0x11a4('0x1a')]?_0x36ba70['options']['raw']===undefined?!![]:![]:!![],'where':_0x36ba70[_0x11a4('0x1a')]?_0x36ba70[_0x11a4('0x1a')]['where']||null:null,'attributes':_0x36ba70[_0x11a4('0x1a')]?_0x36ba70['options'][_0x11a4('0x1b')]||null:null,'include':_0x36ba70[_0x11a4('0x1a')]?_0x36ba70[_0x11a4('0x1a')][_0x11a4('0x1c')]?_[_0x11a4('0x1d')](_0x36ba70[_0x11a4('0x1a')][_0x11a4('0x1c')],function(_0x2ecb57){return{'model':db[_0x2ecb57[_0x11a4('0x1e')]],'as':_0x2ecb57['as'],'attributes':_0x2ecb57[_0x11a4('0x1b')],'include':_0x2ecb57[_0x11a4('0x1c')]?_[_0x11a4('0x1d')](_0x2ecb57['include'],function(_0x351ff0){return{'model':db[_0x351ff0[_0x11a4('0x1e')]],'as':_0x351ff0['as'],'attributes':_0x351ff0[_0x11a4('0x1b')],'include':_0x351ff0[_0x11a4('0x1c')]?_[_0x11a4('0x1d')](_0x351ff0[_0x11a4('0x1c')],function(_0x940cd3){return{'model':db[_0x940cd3[_0x11a4('0x1e')]],'as':_0x940cd3['as'],'attributes':_0x940cd3['attributes']};}):[]};}):[]};}):[]:[]})[_0x11a4('0x1f')](function(_0x5f5e29){logger[_0x11a4('0xe')]('ShowWhatsappAccount',_0x36ba70);logger[_0x11a4('0x11')](_0x11a4('0x18'),_0x36ba70,JSON['stringify'](_0x5f5e29));_0xfd3e1b(_0x5f5e29);})[_0x11a4('0x17')](function(_0x5c44c9){logger[_0x11a4('0x14')](_0x11a4('0x18'),_0x5c44c9['message'],_0x36ba70);_0x896804(_0x520517[_0x11a4('0x14')](0x1f4,_0x5c44c9[_0x11a4('0x16')]));});});}; \ No newline at end of file +var _0x1a68=['rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x329915,_0x1c75b0){var _0x46e9f6=function(_0x1f5b25){while(--_0x1f5b25){_0x329915['push'](_0x329915['shift']());}};_0x46e9f6(++_0x1c75b0);}(_0x1a68,0x174));var _0x81a6=function(_0x535e80,_0xc27efe){_0x535e80=_0x535e80-0x0;var _0x31d501=_0x1a68[_0x535e80];return _0x31d501;};'use strict';var _=require(_0x81a6('0x0'));var util=require(_0x81a6('0x1'));var moment=require('moment');var BPromise=require(_0x81a6('0x2'));var rs=require(_0x81a6('0x3'));var fs=require('fs');var Redis=require(_0x81a6('0x4'));var db=require(_0x81a6('0x5'))['db'];var utils=require(_0x81a6('0x6'));var logger=require(_0x81a6('0x7'))(_0x81a6('0x8'));var config=require('../../config/environment');var jayson=require(_0x81a6('0x9'));var client=jayson[_0x81a6('0xa')][_0x81a6('0xb')]({'port':0x232a});config[_0x81a6('0xc')]=_[_0x81a6('0xd')](config[_0x81a6('0xc')],{'host':_0x81a6('0xe'),'port':0x18eb});var socket=require(_0x81a6('0xf'))(new Redis(config['redis']));require(_0x81a6('0x10'))['register'](socket);function respondWithRpcPromise(_0x1cef24,_0x3ce0df,_0x18d3f9){return new BPromise(function(_0x704f24,_0x4760e6){return client[_0x81a6('0x11')](_0x1cef24,_0x18d3f9)[_0x81a6('0x12')](function(_0x246bbd){logger[_0x81a6('0x13')](_0x81a6('0x14'),_0x3ce0df,'request\x20sent');logger[_0x81a6('0x15')](_0x81a6('0x16'),_0x3ce0df,_0x81a6('0x17'),JSON[_0x81a6('0x18')](_0x246bbd));if(_0x246bbd[_0x81a6('0x19')]){if(_0x246bbd[_0x81a6('0x19')][_0x81a6('0x1a')]===0x1f4){logger['error'](_0x81a6('0x14'),_0x3ce0df,_0x246bbd['error'][_0x81a6('0x1b')]);return _0x4760e6(_0x246bbd[_0x81a6('0x19')][_0x81a6('0x1b')]);}logger[_0x81a6('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x3ce0df,_0x246bbd[_0x81a6('0x19')][_0x81a6('0x1b')]);return _0x704f24(_0x246bbd[_0x81a6('0x19')][_0x81a6('0x1b')]);}else{logger[_0x81a6('0x13')](_0x81a6('0x14'),_0x3ce0df,'request\x20sent');_0x704f24(_0x246bbd[_0x81a6('0x1c')][_0x81a6('0x1b')]);}})[_0x81a6('0x1d')](function(_0x4ec583){logger['error'](_0x81a6('0x14'),_0x3ce0df,_0x4ec583);_0x4760e6(_0x4ec583);});});}exports[_0x81a6('0x1e')]=function(_0x9b12b7){var _0x4afc0a=this;return new Promise(function(_0x4ecb69,_0x4ce673){return db[_0x81a6('0x1f')]['find']({'raw':_0x9b12b7['options']?_0x9b12b7[_0x81a6('0x20')][_0x81a6('0x21')]===undefined?!![]:![]:!![],'where':_0x9b12b7[_0x81a6('0x20')]?_0x9b12b7[_0x81a6('0x20')]['where']||null:null,'attributes':_0x9b12b7[_0x81a6('0x20')]?_0x9b12b7['options'][_0x81a6('0x22')]||null:null,'include':_0x9b12b7['options']?_0x9b12b7[_0x81a6('0x20')]['include']?_['map'](_0x9b12b7['options'][_0x81a6('0x23')],function(_0x3d21c6){return{'model':db[_0x3d21c6['model']],'as':_0x3d21c6['as'],'attributes':_0x3d21c6[_0x81a6('0x22')],'include':_0x3d21c6[_0x81a6('0x23')]?_[_0x81a6('0x24')](_0x3d21c6[_0x81a6('0x23')],function(_0x344245){return{'model':db[_0x344245['model']],'as':_0x344245['as'],'attributes':_0x344245[_0x81a6('0x22')],'include':_0x344245[_0x81a6('0x23')]?_[_0x81a6('0x24')](_0x344245[_0x81a6('0x23')],function(_0x1e2e9a){return{'model':db[_0x1e2e9a[_0x81a6('0x25')]],'as':_0x1e2e9a['as'],'attributes':_0x1e2e9a[_0x81a6('0x22')]};}):[]};}):[]};}):[]:[]})[_0x81a6('0x12')](function(_0x39cf8e){logger[_0x81a6('0x13')]('ShowWhatsappAccount',_0x9b12b7);logger[_0x81a6('0x15')](_0x81a6('0x1e'),_0x9b12b7,JSON[_0x81a6('0x18')](_0x39cf8e));_0x4ecb69(_0x39cf8e);})[_0x81a6('0x1d')](function(_0x4a78fb){logger[_0x81a6('0x19')](_0x81a6('0x1e'),_0x4a78fb[_0x81a6('0x1b')],_0x9b12b7);_0x4ce673(_0x4afc0a[_0x81a6('0x19')](0x1f4,_0x4a78fb[_0x81a6('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 16bc97f..d8f1ff0 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 _0x6d15=['whatsappAccount:','save','update','emit','removeListener','length'];(function(_0x5e38ef,_0x42ad7c){var _0x47665a=function(_0x2bd7df){while(--_0x2bd7df){_0x5e38ef['push'](_0x5e38ef['shift']());}};_0x47665a(++_0x42ad7c);}(_0x6d15,0x139));var _0x56d1=function(_0x4a54f7,_0x332f47){_0x4a54f7=_0x4a54f7-0x0;var _0x3673d5=_0x6d15[_0x4a54f7];return _0x3673d5;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x56d1('0x0'),'remove',_0x56d1('0x1')];function createListener(_0x188a62,_0x43032c){return function(_0x12a591){_0x43032c[_0x56d1('0x2')](_0x188a62,_0x12a591);};}function removeListener(_0x320583,_0x388cb1){return function(){WhatsappAccountEvents[_0x56d1('0x3')](_0x320583,_0x388cb1);};}exports['register']=function(_0x3b6af5){for(var _0x2e0bbe=0x0,_0x10666e=events[_0x56d1('0x4')];_0x2e0bbe<_0x10666e;_0x2e0bbe++){var _0x5ad902=events[_0x2e0bbe];var _0x4df6d7=createListener(_0x56d1('0x5')+_0x5ad902,_0x3b6af5);WhatsappAccountEvents['on'](_0x5ad902,_0x4df6d7);}}; \ No newline at end of file +var _0xbea6=['emit','length','whatsappAccount:','save','remove','update'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xbea6,0x147));var _0x6bea=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xbea6[_0x4a9fb1];return _0x348672;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x6bea('0x0'),_0x6bea('0x1'),_0x6bea('0x2')];function createListener(_0x1941ec,_0x59389b){return function(_0x650d22){_0x59389b[_0x6bea('0x3')](_0x1941ec,_0x650d22);};}function removeListener(_0x366bce,_0x141e0e){return function(){WhatsappAccountEvents['removeListener'](_0x366bce,_0x141e0e);};}exports['register']=function(_0x1b429f){for(var _0x10095b=0x0,_0xb03a59=events[_0x6bea('0x4')];_0x10095b<_0xb03a59;_0x10095b++){var _0x4c30c8=events[_0x10095b];var _0xbdd89b=createListener(_0x6bea('0x5')+_0x4c30c8,_0x1b429f);WhatsappAccountEvents['on'](_0x4c30c8,_0xbdd89b);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index acc99e3..0a16850 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 _0xf61a=['isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get'];(function(_0xa56442,_0x9c426a){var _0x5e1c56=function(_0x1cf68d){while(--_0x1cf68d){_0xa56442['push'](_0xa56442['shift']());}};_0x5e1c56(++_0x9c426a);}(_0xf61a,0x1ac));var _0xaf61=function(_0x14baf8,_0x9ad251){_0x14baf8=_0x14baf8-0x0;var _0x5b3698=_0xf61a[_0x14baf8];return _0x5b3698;};'use strict';var multer=require('multer');var util=require(_0xaf61('0x0'));var path=require('path');var timeout=require(_0xaf61('0x1'));var express=require(_0xaf61('0x2'));var router=express[_0xaf61('0x3')]();var auth=require(_0xaf61('0x4'));var interaction=require(_0xaf61('0x5'));var config=require(_0xaf61('0x6'));var controller=require(_0xaf61('0x7'));router[_0xaf61('0x8')]('/',auth[_0xaf61('0x9')](),controller[_0xaf61('0xa')]);router[_0xaf61('0x8')](_0xaf61('0xb'),auth[_0xaf61('0x9')](),controller[_0xaf61('0xc')]);router[_0xaf61('0xd')]('/',auth[_0xaf61('0x9')](),controller[_0xaf61('0xe')]);router[_0xaf61('0xf')](_0xaf61('0xb'),auth[_0xaf61('0x9')](),controller[_0xaf61('0x10')]);router['delete'](_0xaf61('0xb'),auth['isAuthenticated'](),controller[_0xaf61('0x11')]);module[_0xaf61('0x12')]=router; \ No newline at end of file +var _0x38b8=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','create','put','exports','multer'];(function(_0x216e3b,_0x21e6cd){var _0x31673d=function(_0x13af25){while(--_0x13af25){_0x216e3b['push'](_0x216e3b['shift']());}};_0x31673d(++_0x21e6cd);}(_0x38b8,0x179));var _0x838b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38b8[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x838b('0x0'));var util=require(_0x838b('0x1'));var path=require(_0x838b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x838b('0x3')]();var auth=require(_0x838b('0x4'));var interaction=require(_0x838b('0x5'));var config=require(_0x838b('0x6'));var controller=require(_0x838b('0x7'));router[_0x838b('0x8')]('/',auth[_0x838b('0x9')](),controller['index']);router[_0x838b('0x8')](_0x838b('0xa'),auth[_0x838b('0x9')](),controller['show']);router['post']('/',auth[_0x838b('0x9')](),controller[_0x838b('0xb')]);router[_0x838b('0xc')](_0x838b('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x838b('0xa'),auth[_0x838b('0x9')](),controller['destroy']);module[_0x838b('0xd')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 5ee0e04..7fd50c1 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 _0x105e=['noop','*,*,*,*','sequelize','exports','STRING'];(function(_0x15ca46,_0x22a967){var _0x2b249b=function(_0x214818){while(--_0x214818){_0x15ca46['push'](_0x15ca46['shift']());}};_0x2b249b(++_0x22a967);}(_0x105e,0x188));var _0xe105=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x105e[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xe105('0x0'));module[_0xe105('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe105('0x2')],'allowNull':![],'defaultValue':_0xe105('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe105('0x2')]},'interval':{'type':Sequelize[_0xe105('0x2')],'defaultValue':_0xe105('0x4')}}; \ No newline at end of file +var _0xab2e=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x427b66,_0x4a8f7f){var _0x24c80f=function(_0x21b4ac){while(--_0x21b4ac){_0x427b66['push'](_0x427b66['shift']());}};_0x24c80f(++_0x4a8f7f);}(_0xab2e,0x164));var _0xeab2=function(_0x28b4fb,_0x59d50c){_0x28b4fb=_0x28b4fb-0x0;var _0x55273a=_0xab2e[_0x28b4fb];return _0x55273a;};'use strict';var Sequelize=require(_0xeab2('0x0'));module[_0xeab2('0x1')]={'priority':{'type':Sequelize[_0xeab2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xeab2('0x3')],'allowNull':![],'defaultValue':_0xeab2('0x4')},'appdata':{'type':Sequelize[_0xeab2('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xeab2('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index a5d0d4e..00084eb 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 _0x6094=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','where','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3cf383,_0x3f659d){var _0x41b463=function(_0x20c7f7){while(--_0x20c7f7){_0x3cf383['push'](_0x3cf383['shift']());}};_0x41b463(++_0x3f659d);}(_0x6094,0x10c));var _0x4609=function(_0x599f3d,_0x11da01){_0x599f3d=_0x599f3d-0x0;var _0x141e52=_0x6094[_0x599f3d];return _0x141e52;};'use strict';var pdf=require(_0x4609('0x0'));var emlformat=require(_0x4609('0x1'));var rimraf=require(_0x4609('0x2'));var zipdir=require(_0x4609('0x3'));var jsonpatch=require(_0x4609('0x4'));var rp=require('request-promise');var moment=require(_0x4609('0x5'));var BPromise=require(_0x4609('0x6'));var Mustache=require(_0x4609('0x7'));var util=require(_0x4609('0x8'));var path=require(_0x4609('0x9'));var sox=require(_0x4609('0xa'));var csv=require(_0x4609('0xb'));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(_0x4609('0xc'));var toCsv=require(_0x4609('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4609('0xd'));var authService=require(_0x4609('0xe'));var qs=require(_0x4609('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4609('0x10'))(_0x4609('0x11'));var utils=require(_0x4609('0x12'));var config=require(_0x4609('0x13'));var db=require(_0x4609('0x14'))['db'];function respondWithStatusCode(_0x40a7a2,_0x44707c){_0x44707c=_0x44707c||0xcc;return function(_0x44af3c){if(_0x44af3c){return _0x40a7a2[_0x4609('0x15')](_0x44707c);}return _0x40a7a2[_0x4609('0x16')](_0x44707c)[_0x4609('0x17')]();};}function respondWithResult(_0x1da688,_0x1a8556){_0x1a8556=_0x1a8556||0xc8;return function(_0x3e107e){if(_0x3e107e){return _0x1da688[_0x4609('0x16')](_0x1a8556)['json'](_0x3e107e);}};}function respondWithFilteredResult(_0x2678d8,_0x307340){return function(_0x16da7f){if(_0x16da7f){var _0x30be28=_0x16da7f[_0x4609('0x18')],_0x3648f9=_0x307340[_0x4609('0x19')],_0x222475=_0x307340['offset']+_0x307340['limit'],_0x3503db;if(_0x222475>=_0x30be28){_0x222475=_0x30be28;_0x3503db=0xc8;}else{_0x3503db=0xce;}_0x2678d8[_0x4609('0x16')](_0x3503db);return _0x2678d8[_0x4609('0x1a')](_0x4609('0x1b'),_0x3648f9+'-'+_0x222475+'/'+_0x30be28)[_0x4609('0x1c')](_0x16da7f);}return null;};}function patchUpdates(_0x5ad02b){return function(_0x2897e9){try{jsonpatch[_0x4609('0x1d')](_0x2897e9,_0x5ad02b,!![]);}catch(_0x33313a){return BPromise[_0x4609('0x1e')](_0x33313a);}return _0x2897e9[_0x4609('0x1f')]();};}function saveUpdates(_0xfdd3f5,_0x20cb29){return function(_0x158f4d){if(_0x158f4d){return _0x158f4d[_0x4609('0x20')](_0xfdd3f5)['then'](function(_0x23569f){return _0x23569f;});}return null;};}function removeEntity(_0x181099,_0x7b51ad){return function(_0x5a46c5){if(_0x5a46c5){return _0x5a46c5['destroy']()['then'](function(){_0x181099['status'](0xcc)[_0x4609('0x17')]();});}};}function handleEntityNotFound(_0x37faaa,_0x3a3dbd){return function(_0x141039){if(!_0x141039){_0x37faaa[_0x4609('0x15')](0x194);}return _0x141039;};}function handleError(_0x497878,_0x4fb532){_0x4fb532=_0x4fb532||0x1f4;return function(_0x47cbb0){logger['error'](_0x47cbb0[_0x4609('0x21')]);if(_0x47cbb0['name']){delete _0x47cbb0[_0x4609('0x22')];}_0x497878['status'](_0x4fb532)[_0x4609('0x23')](_0x47cbb0);};}exports[_0x4609('0x24')]=function(_0x15e5e,_0x30b79c){var _0x23bf63={},_0x213b01={},_0x3a638e={'count':0x0,'rows':[]};var _0x3b334e=_[_0x4609('0x25')](db[_0x4609('0x26')][_0x4609('0x27')],function(_0x378672){return{'name':_0x378672[_0x4609('0x28')],'type':_0x378672[_0x4609('0x29')][_0x4609('0x2a')]};});_0x213b01[_0x4609('0x2b')]=_[_0x4609('0x25')](_0x3b334e,_0x4609('0x22'));_0x213b01[_0x4609('0x2c')]=_[_0x4609('0x2d')](_0x15e5e[_0x4609('0x2c')]);_0x213b01[_0x4609('0x2e')]=_['intersection'](_0x213b01[_0x4609('0x2b')],_0x213b01[_0x4609('0x2c')]);_0x23bf63[_0x4609('0x2f')]=_[_0x4609('0x30')](_0x213b01[_0x4609('0x2b')],qs[_0x4609('0x31')](_0x15e5e[_0x4609('0x2c')][_0x4609('0x31')]));_0x23bf63['attributes']=_0x23bf63[_0x4609('0x2f')]['length']?_0x23bf63[_0x4609('0x2f')]:_0x213b01[_0x4609('0x2b')];if(!_0x15e5e[_0x4609('0x2c')][_0x4609('0x32')](_0x4609('0x33'))){_0x23bf63[_0x4609('0x34')]=qs['limit'](_0x15e5e['query'][_0x4609('0x34')]);_0x23bf63['offset']=qs[_0x4609('0x19')](_0x15e5e[_0x4609('0x2c')][_0x4609('0x19')]);}_0x23bf63[_0x4609('0x35')]=qs[_0x4609('0x36')](_0x15e5e[_0x4609('0x2c')][_0x4609('0x36')]);_0x23bf63['where']=qs[_0x4609('0x2e')](_[_0x4609('0x37')](_0x15e5e[_0x4609('0x2c')],_0x213b01[_0x4609('0x2e')]),_0x3b334e);if(_0x15e5e[_0x4609('0x2c')]['filter']){_0x23bf63['where']=_['merge'](_0x23bf63[_0x4609('0x38')],{'$or':_[_0x4609('0x25')](_0x3b334e,function(_0x44b2c9){if(_0x44b2c9['type']!==_0x4609('0x39')){var _0x4cab23={};_0x4cab23[_0x44b2c9[_0x4609('0x22')]]={'$like':'%'+_0x15e5e[_0x4609('0x2c')]['filter']+'%'};return _0x4cab23;}})});}_0x23bf63=_[_0x4609('0x3a')]({},_0x23bf63,_0x15e5e[_0x4609('0x3b')]);var _0x2b2307={'where':_0x23bf63[_0x4609('0x38')]};return db[_0x4609('0x26')][_0x4609('0x18')](_0x2b2307)[_0x4609('0x3c')](function(_0x56f731){_0x3a638e[_0x4609('0x18')]=_0x56f731;if(_0x15e5e[_0x4609('0x2c')][_0x4609('0x3d')]){_0x23bf63[_0x4609('0x3e')]=[{'all':!![]}];}return db[_0x4609('0x26')][_0x4609('0x3f')](_0x23bf63);})[_0x4609('0x3c')](function(_0x44c031){_0x3a638e[_0x4609('0x40')]=_0x44c031;return _0x3a638e;})[_0x4609('0x3c')](respondWithFilteredResult(_0x30b79c,_0x23bf63))[_0x4609('0x41')](handleError(_0x30b79c,null));};exports[_0x4609('0x42')]=function(_0xe70491,_0x446594){var _0x1adbde={'raw':!![],'where':{'id':_0xe70491[_0x4609('0x43')]['id']}},_0x45f9fc={};_0x45f9fc[_0x4609('0x2b')]=_['keys'](db[_0x4609('0x26')][_0x4609('0x27')]);_0x45f9fc[_0x4609('0x2c')]=_[_0x4609('0x2d')](_0xe70491[_0x4609('0x2c')]);_0x45f9fc[_0x4609('0x2e')]=_[_0x4609('0x30')](_0x45f9fc[_0x4609('0x2b')],_0x45f9fc[_0x4609('0x2c')]);_0x1adbde[_0x4609('0x2f')]=_[_0x4609('0x30')](_0x45f9fc['model'],qs[_0x4609('0x31')](_0xe70491[_0x4609('0x2c')][_0x4609('0x31')]));_0x1adbde['attributes']=_0x1adbde['attributes']['length']?_0x1adbde['attributes']:_0x45f9fc['model'];if(_0xe70491[_0x4609('0x2c')][_0x4609('0x3d')]){_0x1adbde[_0x4609('0x3e')]=[{'all':!![]}];}_0x1adbde=_[_0x4609('0x3a')]({},_0x1adbde,_0xe70491[_0x4609('0x3b')]);return db[_0x4609('0x26')][_0x4609('0x44')](_0x1adbde)[_0x4609('0x3c')](handleEntityNotFound(_0x446594,null))[_0x4609('0x3c')](respondWithResult(_0x446594,null))[_0x4609('0x41')](handleError(_0x446594,null));};exports[_0x4609('0x45')]=function(_0x441a34,_0x59afa6){return db[_0x4609('0x26')]['create'](_0x441a34[_0x4609('0x46')],{})[_0x4609('0x3c')](respondWithResult(_0x59afa6,0xc9))[_0x4609('0x41')](handleError(_0x59afa6,null));};exports['update']=function(_0x43df5f,_0x535f06){if(_0x43df5f[_0x4609('0x46')]['id']){delete _0x43df5f[_0x4609('0x46')]['id'];}return db[_0x4609('0x26')][_0x4609('0x44')]({'where':{'id':_0x43df5f['params']['id']}})['then'](handleEntityNotFound(_0x535f06,null))['then'](saveUpdates(_0x43df5f[_0x4609('0x46')],null))[_0x4609('0x3c')](respondWithResult(_0x535f06,null))[_0x4609('0x41')](handleError(_0x535f06,null));};exports['destroy']=function(_0xa5337d,_0x4a2638){return db[_0x4609('0x26')][_0x4609('0x44')]({'where':{'id':_0xa5337d['params']['id']}})[_0x4609('0x3c')](handleEntityNotFound(_0x4a2638,null))['then'](removeEntity(_0x4a2638,null))[_0x4609('0x41')](handleError(_0x4a2638,null));}; \ No newline at end of file +var _0x1ae8=['model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','filters','pick','filter','merge','where','options','WhatsappApplication','includeAll','include','findAll','rows','params','keys','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key'];(function(_0x5435b,_0x1c3759){var _0x1bff97=function(_0x2b7e78){while(--_0x2b7e78){_0x5435b['push'](_0x5435b['shift']());}};_0x1bff97(++_0x1c3759);}(_0x1ae8,0xfa));var _0x81ae=function(_0x4b006b,_0x3c1db3){_0x4b006b=_0x4b006b-0x0;var _0x362121=_0x1ae8[_0x4b006b];return _0x362121;};'use strict';var pdf=require(_0x81ae('0x0'));var emlformat=require(_0x81ae('0x1'));var rimraf=require(_0x81ae('0x2'));var zipdir=require(_0x81ae('0x3'));var jsonpatch=require(_0x81ae('0x4'));var rp=require(_0x81ae('0x5'));var moment=require(_0x81ae('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x81ae('0x7'));var util=require(_0x81ae('0x8'));var path=require(_0x81ae('0x9'));var sox=require(_0x81ae('0xa'));var csv=require(_0x81ae('0xb'));var ejs=require(_0x81ae('0xc'));var fs=require('fs');var _=require(_0x81ae('0xd'));var squel=require(_0x81ae('0xe'));var crypto=require(_0x81ae('0xf'));var jsforce=require(_0x81ae('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x81ae('0x11'));var Redis=require(_0x81ae('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x81ae('0x13'));var as=require(_0x81ae('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x81ae('0x15'));var utils=require(_0x81ae('0x16'));var config=require(_0x81ae('0x17'));var db=require(_0x81ae('0x18'))['db'];function respondWithStatusCode(_0x2ea47b,_0x6f8092){_0x6f8092=_0x6f8092||0xcc;return function(_0xb5bb5c){if(_0xb5bb5c){return _0x2ea47b[_0x81ae('0x19')](_0x6f8092);}return _0x2ea47b[_0x81ae('0x1a')](_0x6f8092)[_0x81ae('0x1b')]();};}function respondWithResult(_0x19b9c2,_0x3f236a){_0x3f236a=_0x3f236a||0xc8;return function(_0xe0ac42){if(_0xe0ac42){return _0x19b9c2[_0x81ae('0x1a')](_0x3f236a)['json'](_0xe0ac42);}};}function respondWithFilteredResult(_0x5b2359,_0x451603){return function(_0x37fa9c){if(_0x37fa9c){var _0x42310d=_0x37fa9c[_0x81ae('0x1c')],_0x1b0f54=_0x451603['offset'],_0x1f3d51=_0x451603['offset']+_0x451603['limit'],_0xb94033;if(_0x1f3d51>=_0x42310d){_0x1f3d51=_0x42310d;_0xb94033=0xc8;}else{_0xb94033=0xce;}_0x5b2359[_0x81ae('0x1a')](_0xb94033);return _0x5b2359[_0x81ae('0x1d')](_0x81ae('0x1e'),_0x1b0f54+'-'+_0x1f3d51+'/'+_0x42310d)[_0x81ae('0x1f')](_0x37fa9c);}return null;};}function patchUpdates(_0x457f7c){return function(_0x3d08b9){try{jsonpatch[_0x81ae('0x20')](_0x3d08b9,_0x457f7c,!![]);}catch(_0x3d4a82){return BPromise[_0x81ae('0x21')](_0x3d4a82);}return _0x3d08b9[_0x81ae('0x22')]();};}function saveUpdates(_0x4fd286,_0x28bc93){return function(_0x29287b){if(_0x29287b){return _0x29287b[_0x81ae('0x23')](_0x4fd286)[_0x81ae('0x24')](function(_0x4305fa){return _0x4305fa;});}return null;};}function removeEntity(_0x56a0a,_0x307542){return function(_0x11f33e){if(_0x11f33e){return _0x11f33e[_0x81ae('0x25')]()[_0x81ae('0x24')](function(){_0x56a0a[_0x81ae('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21441b,_0x1c06ea){return function(_0x2f7f5a){if(!_0x2f7f5a){_0x21441b['sendStatus'](0x194);}return _0x2f7f5a;};}function handleError(_0x26e07c,_0x3d0d1c){_0x3d0d1c=_0x3d0d1c||0x1f4;return function(_0x29f454){logger['error'](_0x29f454[_0x81ae('0x26')]);if(_0x29f454[_0x81ae('0x27')]){delete _0x29f454['name'];}_0x26e07c['status'](_0x3d0d1c)['send'](_0x29f454);};}exports[_0x81ae('0x28')]=function(_0x436d2c,_0x106345){var _0x337811={},_0x32780b={},_0x24f93d={'count':0x0,'rows':[]};var _0x2ea67e=_[_0x81ae('0x29')](db['WhatsappApplication'][_0x81ae('0x2a')],function(_0xa51342){return{'name':_0xa51342[_0x81ae('0x2b')],'type':_0xa51342[_0x81ae('0x2c')][_0x81ae('0x2d')]};});_0x32780b[_0x81ae('0x2e')]=_[_0x81ae('0x29')](_0x2ea67e,_0x81ae('0x27'));_0x32780b[_0x81ae('0x2f')]=_['keys'](_0x436d2c[_0x81ae('0x2f')]);_0x32780b['filters']=_[_0x81ae('0x30')](_0x32780b[_0x81ae('0x2e')],_0x32780b[_0x81ae('0x2f')]);_0x337811[_0x81ae('0x31')]=_[_0x81ae('0x30')](_0x32780b[_0x81ae('0x2e')],qs[_0x81ae('0x32')](_0x436d2c[_0x81ae('0x2f')][_0x81ae('0x32')]));_0x337811['attributes']=_0x337811['attributes'][_0x81ae('0x33')]?_0x337811[_0x81ae('0x31')]:_0x32780b[_0x81ae('0x2e')];if(!_0x436d2c['query'][_0x81ae('0x34')](_0x81ae('0x35'))){_0x337811[_0x81ae('0x36')]=qs[_0x81ae('0x36')](_0x436d2c['query']['limit']);_0x337811[_0x81ae('0x37')]=qs[_0x81ae('0x37')](_0x436d2c[_0x81ae('0x2f')][_0x81ae('0x37')]);}_0x337811[_0x81ae('0x38')]=qs['sort'](_0x436d2c[_0x81ae('0x2f')]['sort']);_0x337811['where']=qs[_0x81ae('0x39')](_[_0x81ae('0x3a')](_0x436d2c[_0x81ae('0x2f')],_0x32780b[_0x81ae('0x39')]),_0x2ea67e);if(_0x436d2c['query'][_0x81ae('0x3b')]){_0x337811['where']=_[_0x81ae('0x3c')](_0x337811[_0x81ae('0x3d')],{'$or':_[_0x81ae('0x29')](_0x2ea67e,function(_0x432fc6){if(_0x432fc6[_0x81ae('0x2c')]!=='VIRTUAL'){var _0x16b8dd={};_0x16b8dd[_0x432fc6[_0x81ae('0x27')]]={'$like':'%'+_0x436d2c['query']['filter']+'%'};return _0x16b8dd;}})});}_0x337811=_['merge']({},_0x337811,_0x436d2c[_0x81ae('0x3e')]);var _0x315145={'where':_0x337811[_0x81ae('0x3d')]};return db[_0x81ae('0x3f')][_0x81ae('0x1c')](_0x315145)[_0x81ae('0x24')](function(_0x5701e4){_0x24f93d['count']=_0x5701e4;if(_0x436d2c[_0x81ae('0x2f')][_0x81ae('0x40')]){_0x337811[_0x81ae('0x41')]=[{'all':!![]}];}return db[_0x81ae('0x3f')][_0x81ae('0x42')](_0x337811);})[_0x81ae('0x24')](function(_0x3292c5){_0x24f93d[_0x81ae('0x43')]=_0x3292c5;return _0x24f93d;})[_0x81ae('0x24')](respondWithFilteredResult(_0x106345,_0x337811))['catch'](handleError(_0x106345,null));};exports['show']=function(_0x80cccc,_0x51bff2){var _0x3b363={'raw':!![],'where':{'id':_0x80cccc[_0x81ae('0x44')]['id']}},_0x4f61e9={};_0x4f61e9[_0x81ae('0x2e')]=_[_0x81ae('0x45')](db['WhatsappApplication']['rawAttributes']);_0x4f61e9[_0x81ae('0x2f')]=_[_0x81ae('0x45')](_0x80cccc[_0x81ae('0x2f')]);_0x4f61e9[_0x81ae('0x39')]=_[_0x81ae('0x30')](_0x4f61e9[_0x81ae('0x2e')],_0x4f61e9[_0x81ae('0x2f')]);_0x3b363[_0x81ae('0x31')]=_[_0x81ae('0x30')](_0x4f61e9[_0x81ae('0x2e')],qs['fields'](_0x80cccc['query'][_0x81ae('0x32')]));_0x3b363[_0x81ae('0x31')]=_0x3b363['attributes']['length']?_0x3b363[_0x81ae('0x31')]:_0x4f61e9['model'];if(_0x80cccc[_0x81ae('0x2f')][_0x81ae('0x40')]){_0x3b363['include']=[{'all':!![]}];}_0x3b363=_['merge']({},_0x3b363,_0x80cccc[_0x81ae('0x3e')]);return db[_0x81ae('0x3f')][_0x81ae('0x46')](_0x3b363)['then'](handleEntityNotFound(_0x51bff2,null))[_0x81ae('0x24')](respondWithResult(_0x51bff2,null))[_0x81ae('0x47')](handleError(_0x51bff2,null));};exports[_0x81ae('0x48')]=function(_0x393d3f,_0x8b195f){return db[_0x81ae('0x3f')][_0x81ae('0x48')](_0x393d3f[_0x81ae('0x49')],{})[_0x81ae('0x24')](respondWithResult(_0x8b195f,0xc9))['catch'](handleError(_0x8b195f,null));};exports['update']=function(_0x4d57c1,_0x1ccd16){if(_0x4d57c1['body']['id']){delete _0x4d57c1['body']['id'];}return db[_0x81ae('0x3f')]['find']({'where':{'id':_0x4d57c1[_0x81ae('0x44')]['id']}})[_0x81ae('0x24')](handleEntityNotFound(_0x1ccd16,null))[_0x81ae('0x24')](saveUpdates(_0x4d57c1[_0x81ae('0x49')],null))[_0x81ae('0x24')](respondWithResult(_0x1ccd16,null))[_0x81ae('0x47')](handleError(_0x1ccd16,null));};exports[_0x81ae('0x25')]=function(_0x3f4da8,_0x57454e){return db['WhatsappApplication'][_0x81ae('0x46')]({'where':{'id':_0x3f4da8[_0x81ae('0x44')]['id']}})['then'](handleEntityNotFound(_0x57454e,null))[_0x81ae('0x24')](removeEntity(_0x57454e,null))['catch'](handleError(_0x57454e,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 5f09d0e..66a5aeb 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 _0xcf89=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x17e31b,_0x3dccef){var _0x90ff34=function(_0x1eb7d5){while(--_0x1eb7d5){_0x17e31b['push'](_0x17e31b['shift']());}};_0x90ff34(++_0x3dccef);}(_0xcf89,0x1ab));var _0x9cf8=function(_0x10d9c8,_0x304560){_0x10d9c8=_0x10d9c8-0x0;var _0x11cde2=_0xcf89[_0x10d9c8];return _0x11cde2;};'use strict';var _=require(_0x9cf8('0x0'));var util=require(_0x9cf8('0x1'));var logger=require(_0x9cf8('0x2'))(_0x9cf8('0x3'));var moment=require(_0x9cf8('0x4'));var BPromise=require(_0x9cf8('0x5'));var rp=require(_0x9cf8('0x6'));var fs=require('fs');var path=require(_0x9cf8('0x7'));var rimraf=require(_0x9cf8('0x8'));var config=require(_0x9cf8('0x9'));var attributes=require(_0x9cf8('0xa'));module[_0x9cf8('0xb')]=function(_0x2d6a53,_0x163ee1){return _0x2d6a53[_0x9cf8('0xc')](_0x9cf8('0xd'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9cf8('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x86a3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','WhatsappApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x19f908,_0x610a28){var _0x3737b6=function(_0x558b38){while(--_0x558b38){_0x19f908['push'](_0x19f908['shift']());}};_0x3737b6(++_0x610a28);}(_0x86a3,0x127));var _0x386a=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x86a3[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0x386a('0x0'));var util=require(_0x386a('0x1'));var logger=require(_0x386a('0x2'))(_0x386a('0x3'));var moment=require(_0x386a('0x4'));var BPromise=require(_0x386a('0x5'));var rp=require(_0x386a('0x6'));var fs=require('fs');var path=require(_0x386a('0x7'));var rimraf=require(_0x386a('0x8'));var config=require(_0x386a('0x9'));var attributes=require(_0x386a('0xa'));module['exports']=function(_0x4fe3f2,_0x4ffa16){return _0x4fe3f2['define'](_0x386a('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x386a('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index ff588eb..eb6b23a 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 _0xaa3f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','WhatsappApplication,\x20%s,\x20%s','catch','lodash','util'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x46891a,_0x3e3051){_0x46891a=_0x46891a-0x0;var _0x4c578d=_0xaa3f[_0x46891a];return _0x4c578d;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var moment=require(_0xfaa3('0x2'));var BPromise=require(_0xfaa3('0x3'));var rs=require(_0xfaa3('0x4'));var fs=require('fs');var Redis=require(_0xfaa3('0x5'));var db=require(_0xfaa3('0x6'))['db'];var utils=require(_0xfaa3('0x7'));var logger=require(_0xfaa3('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfaa3('0x9'));var client=jayson['client'][_0xfaa3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeecce5,_0x352958,_0xbf270c){return new BPromise(function(_0x328d5f,_0x2e422d){return client[_0xfaa3('0xb')](_0xeecce5,_0xbf270c)['then'](function(_0x37bcd5){logger[_0xfaa3('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x352958,'request\x20sent');logger[_0xfaa3('0xd')](_0xfaa3('0xe'),_0x352958,_0xfaa3('0xf'),JSON[_0xfaa3('0x10')](_0x37bcd5));if(_0x37bcd5[_0xfaa3('0x11')]){if(_0x37bcd5[_0xfaa3('0x11')]['code']===0x1f4){logger[_0xfaa3('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x352958,_0x37bcd5[_0xfaa3('0x11')][_0xfaa3('0x12')]);return _0x2e422d(_0x37bcd5[_0xfaa3('0x11')]['message']);}logger[_0xfaa3('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x352958,_0x37bcd5[_0xfaa3('0x11')][_0xfaa3('0x12')]);return _0x328d5f(_0x37bcd5[_0xfaa3('0x11')][_0xfaa3('0x12')]);}else{logger[_0xfaa3('0xc')](_0xfaa3('0x13'),_0x352958,'request\x20sent');_0x328d5f(_0x37bcd5['result'][_0xfaa3('0x12')]);}})[_0xfaa3('0x14')](function(_0x407384){logger[_0xfaa3('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x352958,_0x407384);_0x2e422d(_0x407384);});});} \ No newline at end of file +var _0x5496=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x569493,_0x1ccd4b){var _0x236e39=function(_0x3d3354){while(--_0x3d3354){_0x569493['push'](_0x569493['shift']());}};_0x236e39(++_0x1ccd4b);}(_0x5496,0x175));var _0x6549=function(_0x2ee1fa,_0x1a2290){_0x2ee1fa=_0x2ee1fa-0x0;var _0x2e5aaa=_0x5496[_0x2ee1fa];return _0x2e5aaa;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 02e876d..7dd6196 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 _0x00d8=['getMessages','/:id/download','download','create','addMessage','post','tracked','whatsapp','addTags','put','/:id','whatsappinteraction:update','destroy','delete','/:id/tags','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','/describe','isAuthenticated','describe','get','show','/:id/messages'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x00d8,0xe2));var _0x800d=function(_0x3111df,_0x5e20a7){_0x3111df=_0x3111df-0x0;var _0x37471=_0x00d8[_0x3111df];return _0x37471;};'use strict';var multer=require(_0x800d('0x0'));var util=require(_0x800d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x800d('0x2'));var router=express[_0x800d('0x3')]();var auth=require(_0x800d('0x4'));var interaction=require(_0x800d('0x5'));var config=require(_0x800d('0x6'));var controller=require(_0x800d('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x800d('0x8'),auth[_0x800d('0x9')](),controller[_0x800d('0xa')]);router[_0x800d('0xb')]('/:id',auth[_0x800d('0x9')](),controller[_0x800d('0xc')]);router[_0x800d('0xb')](_0x800d('0xd'),auth[_0x800d('0x9')](),controller[_0x800d('0xe')]);router[_0x800d('0xb')](_0x800d('0xf'),auth[_0x800d('0x9')](),controller[_0x800d('0x10')]);router['post']('/',auth[_0x800d('0x9')](),controller[_0x800d('0x11')]);router['post'](_0x800d('0xd'),auth['isAuthenticated'](),controller[_0x800d('0x12')]);router[_0x800d('0x13')]('/:id/tags',auth[_0x800d('0x9')](),interaction[_0x800d('0x14')](_0x800d('0x15'),'whatsappinteraction:addtags'),controller[_0x800d('0x16')]);router[_0x800d('0x17')](_0x800d('0x18'),auth[_0x800d('0x9')](),interaction[_0x800d('0x14')](_0x800d('0x15'),_0x800d('0x19')),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x800d('0x14')](_0x800d('0x15'),'whatsappinteraction:destroy'),controller[_0x800d('0x1a')]);router[_0x800d('0x1b')](_0x800d('0x1c'),auth[_0x800d('0x9')](),controller['removeTags']);module[_0x800d('0x1d')]=router; \ No newline at end of file +var _0x5665=['delete','whatsappinteraction:destroy','exports','multer','path','express','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','describe','/:id','/:id/messages','isAuthenticated','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','put','tracked','update'];(function(_0x3a96bd,_0x23201f){var _0x33d213=function(_0x59d3af){while(--_0x59d3af){_0x3a96bd['push'](_0x3a96bd['shift']());}};_0x33d213(++_0x23201f);}(_0x5665,0x162));var _0x5566=function(_0x34f8dd,_0x1a8c55){_0x34f8dd=_0x34f8dd-0x0;var _0x54728e=_0x5665[_0x34f8dd];return _0x54728e;};'use strict';var multer=require(_0x5566('0x0'));var util=require('util');var path=require(_0x5566('0x1'));var timeout=require('connect-timeout');var express=require(_0x5566('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5566('0x3'));var config=require(_0x5566('0x4'));var controller=require(_0x5566('0x5'));router[_0x5566('0x6')]('/',auth['isAuthenticated'](),controller[_0x5566('0x7')]);router[_0x5566('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x5566('0x8')]);router[_0x5566('0x6')](_0x5566('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x5566('0x6')](_0x5566('0xa'),auth[_0x5566('0xb')](),controller[_0x5566('0xc')]);router['get'](_0x5566('0xd'),auth[_0x5566('0xb')](),controller[_0x5566('0xe')]);router[_0x5566('0xf')]('/',auth['isAuthenticated'](),controller[_0x5566('0x10')]);router['post'](_0x5566('0xa'),auth[_0x5566('0xb')](),controller[_0x5566('0x11')]);router[_0x5566('0xf')](_0x5566('0x12'),auth[_0x5566('0xb')](),interaction['tracked'](_0x5566('0x13'),_0x5566('0x14')),controller['addTags']);router[_0x5566('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0x5566('0x16')]('whatsapp','whatsappinteraction:update'),controller[_0x5566('0x17')]);router[_0x5566('0x18')]('/:id',auth[_0x5566('0xb')](),interaction[_0x5566('0x16')](_0x5566('0x13'),_0x5566('0x19')),controller['destroy']);router['delete']('/:id/tags',auth[_0x5566('0xb')](),controller['removeTags']);module[_0x5566('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 93b5b2b..31ebc3d 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 _0x35ed=['moment','exports','BOOLEAN','DATE','STRING','out','ENUM','sequelize'];(function(_0x4ecd76,_0x79f1f3){var _0x240f34=function(_0x563f79){while(--_0x563f79){_0x4ecd76['push'](_0x4ecd76['shift']());}};_0x240f34(++_0x79f1f3);}(_0x35ed,0x1d7));var _0xd35e=function(_0x243051,_0x4c1886){_0x243051=_0x243051-0x0;var _0x1faa49=_0x35ed[_0x243051];return _0x1faa49;};'use strict';var Sequelize=require(_0xd35e('0x0'));var moment=require(_0xd35e('0x1'));module[_0xd35e('0x2')]={'closed':{'type':Sequelize[_0xd35e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd35e('0x4')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd35e('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xd35e('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xd35e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd35e('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xd35e('0x7')]('in',_0xd35e('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x8b24=['moment','exports','BOOLEAN','STRING','ENUM','out','DATE','sequelize'];(function(_0x33d0ca,_0x34850b){var _0x2f76f2=function(_0x49e78d){while(--_0x49e78d){_0x33d0ca['push'](_0x33d0ca['shift']());}};_0x2f76f2(++_0x34850b);}(_0x8b24,0xb7));var _0x48b2=function(_0x5ba033,_0xed091d){_0x5ba033=_0x5ba033-0x0;var _0x2a59bb=_0x8b24[_0x5ba033];return _0x2a59bb;};'use strict';var Sequelize=require(_0x48b2('0x0'));var moment=require(_0x48b2('0x1'));module[_0x48b2('0x2')]={'closed':{'type':Sequelize[_0x48b2('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x48b2('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x48b2('0x5')]('in',_0x48b2('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x48b2('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x48b2('0x5')]('in',_0x48b2('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 9163238..3c6615d 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','length','getFullTextValue','ContactId','buildExpression','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','group','QueryTypes','SELECT','clone','order','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','include','merge','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','format','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','downloadInteraction.html','transcript-','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus'];(function(_0x3a5cb3,_0x113971){var _0x5962dd=function(_0x587986){while(--_0x587986){_0x3a5cb3['push'](_0x3a5cb3['shift']());}};_0x5962dd(++_0x113971);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc4aa[_0xfae23b];return _0x200640;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}function getInteractionUsers(_0x42a33c,_0x2772fe){return new BPromise(function(_0x116700,_0x4a5a9e){try{if(_0x2772fe[_0x42a33c['id']]){_0x42a33c['Users']=_[_0xac4a('0x2d')](_0x2772fe[_0x42a33c['id']],function(_0x7a948b){return{'id':_0x7a948b['id'],'fullname':_0x7a948b[_0xac4a('0x2e')]};});}}catch(_0x546b65){_0x4a5a9e(_0x546b65);}_0x116700(_0x42a33c);});}function getInteractionTags(_0x4bda1f,_0x355755){return new BPromise(function(_0x2896bc,_0x228629){try{if(_0x4bda1f[_0xac4a('0x2f')]){_0x4bda1f[_0xac4a('0x30')]=[];_0x4bda1f['TagIds'][_0xac4a('0x31')](',')['forEach'](function(_0x30364b){_0x4bda1f['Tags'][_0xac4a('0x32')](_0x355755[_0x30364b]);});}delete _0x4bda1f[_0xac4a('0x2f')];}catch(_0x31501b){_0x228629(_0x31501b);}_0x2896bc(_0x4bda1f);});}function updateWhatsappInteraction(_0x228aa7,_0x34577f,_0x61e552){return new BPromise(function(_0xbd4591,_0x1f13f3){return getInteractionUsers(_0x228aa7,_0x61e552)[_0xac4a('0x27')](function(_0xfd7c16){return getInteractionTags(_0xfd7c16,_0x34577f);})[_0xac4a('0x27')](function(_0x1634df){_0xbd4591(_0x1634df);})[_0xac4a('0x33')](function(_0x1a9d4e){_0x1f13f3(_0x1a9d4e);});});}exports['index']=function(_0x30442d,_0x1c41fb){var _0x5a4e2b={},_0x2a5419={},_0x1af1c1={'count':0x0,'rows':[]};var _0x565164=_['map'](db[_0xac4a('0x34')][_0xac4a('0x35')],function(_0x1b42b6){return{'name':_0x1b42b6[_0xac4a('0x36')],'type':_0x1b42b6['type'][_0xac4a('0x37')]};});_0x2a5419[_0xac4a('0x38')]=_['map'](_0x565164,_0xac4a('0x2b'));_0x2a5419[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x30442d['query']);_0x2a5419[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2a5419[_0xac4a('0x38')],_0x2a5419['query']);_0x5a4e2b[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x2a5419['model'],qs['fields'](_0x30442d[_0xac4a('0x39')]['fields']));_0x5a4e2b['attributes']=_0x5a4e2b['attributes']['length']?_0x5a4e2b[_0xac4a('0x3d')]:_0x2a5419[_0xac4a('0x38')];if(!_0x30442d[_0xac4a('0x39')][_0xac4a('0x3e')](_0xac4a('0x3f'))){_0x5a4e2b[_0xac4a('0x40')]=qs[_0xac4a('0x40')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x40')]);_0x5a4e2b[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x30442d[_0xac4a('0x39')]['offset']);}_0x5a4e2b['order']=qs['sort'](_0x30442d[_0xac4a('0x39')][_0xac4a('0x41')]);_0x5a4e2b[_0xac4a('0x42')]=qs[_0xac4a('0x3b')](_[_0xac4a('0x43')](_0x30442d[_0xac4a('0x39')],_0x2a5419[_0xac4a('0x3b')]),_0x565164);var _0x3441f2=[];var _0x3e9973=squel[_0xac4a('0x44')]()['field']('id')[_0xac4a('0x45')](_0xac4a('0x2b'))[_0xac4a('0x45')](_0xac4a('0x46'))[_0xac4a('0x47')]('tools_tags');var _0x8700b4=squel[_0xac4a('0x44')]()['field'](_0xac4a('0x48'))['field'](_0xac4a('0x49'))[_0xac4a('0x45')](_0xac4a('0x4a'))[_0xac4a('0x47')](_0xac4a('0x4b'),'ui')[_0xac4a('0x4c')](_0xac4a('0x4d'),'u',_0xac4a('0x4e'));var _0x98e0c4=squel[_0xac4a('0x44')]()[_0xac4a('0x47')](_0xac4a('0x4f'),'i')['left_join'](_0xac4a('0x50'),'c',_0xac4a('0x51'))[_0xac4a('0x4c')]('users','o',_0xac4a('0x52'))[_0xac4a('0x4c')]('whatsapp_accounts','a',_0xac4a('0x53'))['left_join'](_0xac4a('0x54'),'me',_0xac4a('0x55'))[_0xac4a('0x4c')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xac4a('0x4c')]('tools_tags','t',_0xac4a('0x56'));var _0x566258=squel[_0xac4a('0x57')]();var _0x530bbb=[];var _0x3be103=squel[_0xac4a('0x57')]();var _0x424f9b;if(_0x30442d[_0xac4a('0x39')]['search']){_0x424f9b=as[_0xac4a('0x58')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x59')]);var _0x1ee454=_0x424f9b[_0xac4a('0x5a')];for(var _0x138876=0x0;_0x138876<_0x424f9b[_0xac4a('0x5b')]['length'];_0x138876++){var _0x35dee5=_0x424f9b[_0xac4a('0x5b')][_0x138876];var _0x4828e3='i';var _0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0x35dee5[_0xac4a('0x45')]]);if(!_0x16afbe){switch(_0x35dee5['field']){case _0xac4a('0x5d'):if(_0x35dee5[_0xac4a('0x5e')]==0x1){_0x98e0c4[_0xac4a('0x5f')]('`'+_0x35dee5[_0xac4a('0x45')]+_0xac4a('0x60'));}else{_0x98e0c4['having']('`'+_0x35dee5[_0xac4a('0x45')]+'`\x20>\x200');}break;case _0xac4a('0x61'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){if(_0x35dee5['value'][_0xac4a('0x31')]('\x20')[_0xac4a('0x63')]>0x1){_0x566258[_0x1ee454]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x35dee5[_0xac4a('0x5e')]),null);}else{var _0x26b582='%'+_0x35dee5[_0xac4a('0x5e')]+'%';_0x566258[_0x1ee454]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26b582,_0x26b582,_0x26b582);}}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0xac4a('0x65')]);_0x35dee5[_0xac4a('0x45')]=_0xac4a('0x65');_0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c['text'],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x69'):var _0x2ac1e9=_0x35dee5[_0xac4a('0x5e')][_0xac4a('0x31')](',')[_0xac4a('0x2d')](function(_0x786d9){return Number(_0x786d9);});_0x2ac1e9[_0xac4a('0x6a')](function(_0x38dd4f){_0x3be103['or'](_0xac4a('0x6b'),'%,'+_0x38dd4f+',%');});_0x530bbb=_[_0xac4a('0x6c')](_0x530bbb,_0x2ac1e9);break;case _0xac4a('0x6d'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){_0x566258[_0x1ee454](_0xac4a('0x6e'),'%'+_0x35dee5['value']+'%',null);}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,['name',_0xac4a('0x6f')]);_0x35dee5['field']=_0xac4a('0x6f');_0x19ce2c=as['buildExpression'](_0x4828e3,_0x16afbe['type'],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x71'):_0x19ce2c=as['buildExpression']('me',null,_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c['value'][_0xac4a('0x68')],_0x19ce2c['value'][_0xac4a('0x1e')]);break;}}else{var _0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}}}else{var _0x430dd0=_(_0x30442d[_0xac4a('0x39')])[_0xac4a('0x3a')]()[_0xac4a('0x2d')](function(_0x2cc410){return _[_0xac4a('0x72')](_0x565164,[_0xac4a('0x2b'),_0x2cc410])?_0x2cc410:undefined;})[_0xac4a('0x73')]()['value']();if(!_[_0xac4a('0x74')](_0x430dd0)){_0x430dd0[_0xac4a('0x6a')](function(_0x4fb812){if(_0x4fb812===_0xac4a('0x75')){_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),[][_0xac4a('0x77')](_0x30442d[_0xac4a('0x39')][_0x4fb812]));}else if(_0x4fb812==='createdAt'){var _0x47c6d8=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x79')];var _0x148288=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x7a')];_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x7b'),_0x47c6d8,_0x148288);}else{if(_0x30442d[_0xac4a('0x39')][_0x4fb812]===_0xac4a('0x7c')){_0x98e0c4['where']('i.'+_0x4fb812+'\x20IS\x20NULL');}else{_0x98e0c4[_0xac4a('0x42')]('i.'+_0x4fb812+_0xac4a('0x7d'),_0x30442d[_0xac4a('0x39')][_0x4fb812]);}}});}if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]==0x1){_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x7f'));}else{_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x80'));}}if(_0x30442d[_0xac4a('0x39')]['tag']){_0x530bbb=_[_0xac4a('0x81')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x82')])?_0x30442d[_0xac4a('0x39')]['tag']:new Array(_0x30442d[_0xac4a('0x39')]['tag']);_0x530bbb[_0xac4a('0x6a')](function(_0x3af39a){_0x3be103['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3af39a+',%');});}if(_0x30442d['query'][_0xac4a('0x83')]){var _0x3b8974=_0x30442d[_0xac4a('0x39')]['filter'][_0xac4a('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xac4a('0x85'));if(qs['isNumeric'](_0x3b8974)){_0x566258['or']('i.id\x20LIKE\x20?',_0x3b8974+'%')['or'](_0xac4a('0x86'),_0x3b8974+'%');}else{_0x566258['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x3b8974))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3b8974+'%');}}}_0x98e0c4[_0xac4a('0x42')](_0x566258);_0x98e0c4[_0xac4a('0x87')]('i.id');var _0x3980ae={'type':db['Sequelize'][_0xac4a('0x88')][_0xac4a('0x89')],'raw':!![]};var _0x522949=_0x98e0c4[_0xac4a('0x8a')]();_0x522949['field']('i.id');_0x522949[_0xac4a('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xac4a('0x5d'));if(_0x5a4e2b['order']){_0x5a4e2b['order'][_0xac4a('0x6a')](function(_0x4065c0){_0x98e0c4[_0xac4a('0x8b')]('i.'+_0x4065c0[0x0],_0x4065c0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x530bbb)){_0x98e0c4[_0xac4a('0x5f')](_0x3be103);_0x522949[_0xac4a('0x42')]('t.id\x20IN\x20?',_0x530bbb);}BPromise['resolve']()[_0xac4a('0x27')](function(){if(!_0x424f9b){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x75')]||_0x30442d[_0xac4a('0x39')][_0xac4a('0x8c')])return;_0x522949[_0xac4a('0x42')](_0xac4a('0x8d'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8d'));return;}return _0x30442d['user'][_0xac4a('0x8e')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x27')](function(_0x3ba61e){if(_['isEmpty'](_0x3ba61e)){_0x522949[_0xac4a('0x42')](_0xac4a('0x8f'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8f'));}else{_0x522949[_0xac4a('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0xac4a('0x2d')](_0x3ba61e,'id'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),_[_0xac4a('0x2d')](_0x3ba61e,'id'));}});})[_0xac4a('0x27')](function(){db[_0xac4a('0x90')][_0xac4a('0x39')](_0x522949['toString'](),_0x3980ae)[_0xac4a('0x27')](function(_0x2be178){_0x1af1c1[_0xac4a('0x20')]=_0x2be178[_0xac4a('0x63')];if(_0x1af1c1[_0xac4a('0x20')]===0x0)return[];return db[_0xac4a('0x90')]['query'](_0x3e9973[_0xac4a('0x91')](),_0x3980ae)[_0xac4a('0x27')](function(_0x1b9a33){_0x3441f2=_[_0xac4a('0x92')](_0x1b9a33,'id');_0x3980ae=_['merge'](_0x3980ae,{'model':db[_0xac4a('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30442d['query'][_0xac4a('0x93')]){_0x5a4e2b[_0xac4a('0x3d')]['forEach'](function(_0x5b95ab){_0x98e0c4[_0xac4a('0x45')]('i.'+_0x5b95ab);});}else{_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x94'),'unreadMessages');_0x98e0c4[_0xac4a('0x45')]('a.key',_0xac4a('0x95'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x96'),_0xac4a('0x97'));_0x98e0c4[_0xac4a('0x45')]('i.*');_0x98e0c4['field'](_0xac4a('0x98'),_0xac4a('0x99'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9a'),_0xac4a('0x9b'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9c'),_0xac4a('0x9d'));_0x98e0c4['field']('c.phone',_0xac4a('0x9e'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9f'),_0xac4a('0xa0'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa1'),_0xac4a('0xa2'));_0x98e0c4[_0xac4a('0x45')]('o.fullname','Owner.fullname');_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa3'),_0xac4a('0xa4'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa5'),_0xac4a('0x2f'));}if(_0x5a4e2b[_0xac4a('0x40')])_0x98e0c4['limit'](_0x5a4e2b[_0xac4a('0x40')]);if(_0x5a4e2b[_0xac4a('0x21')])_0x98e0c4[_0xac4a('0x21')](_0x5a4e2b['offset']);return db[_0xac4a('0x90')][_0xac4a('0x39')](_0x98e0c4[_0xac4a('0x91')](),_0x3980ae);})[_0xac4a('0x27')](function(_0x1a7448){_0x8700b4[_0xac4a('0x42')](_0xac4a('0xa6'),_[_0xac4a('0x2d')](_0x1a7448,'id'));return db[_0xac4a('0x90')]['query'](_0x8700b4[_0xac4a('0x91')](),_0x3980ae)['then'](function(_0x203321){var _0x1199f6=_[_0xac4a('0xa7')](_0x203321,_0xac4a('0xa8'));var _0x840fec=[];_0x1a7448[_0xac4a('0x6a')](function(_0x19766a){_0x840fec['push'](updateWhatsappInteraction(_0x19766a,_0x3441f2,_0x1199f6));});return BPromise[_0xac4a('0xa9')](_0x840fec);});});})[_0xac4a('0x27')](function(_0x279f9b){_0x1af1c1[_0xac4a('0xaa')]=_0x279f9b;return _0x1af1c1;})[_0xac4a('0x27')](respondWithFilteredResult(_0x1c41fb,_0x5a4e2b));})['catch'](handleError(_0x1c41fb,null));};exports[_0xac4a('0xab')]=function(_0x360d4f,_0x4f2b19){var _0x55af32={'raw':![],'where':{'id':_0x360d4f[_0xac4a('0xac')]['id']}},_0x386d6d={};_0x386d6d['model']=_[_0xac4a('0x3a')](db[_0xac4a('0x34')][_0xac4a('0x35')]);_0x386d6d[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x360d4f[_0xac4a('0x39')]);_0x386d6d['filters']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],_0x386d6d[_0xac4a('0x39')]);_0x55af32['attributes']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],qs[_0xac4a('0x93')](_0x360d4f[_0xac4a('0x39')][_0xac4a('0x93')]));_0x55af32[_0xac4a('0x3d')]=_0x55af32['attributes'][_0xac4a('0x63')]?_0x55af32[_0xac4a('0x3d')]:_0x386d6d['model'];if(_0x360d4f[_0xac4a('0x39')]['includeAll']){_0x55af32[_0xac4a('0xad')]=[{'all':!![]}];}_0x55af32=_[_0xac4a('0xae')]({},_0x55af32,_0x360d4f['options']);return db[_0xac4a('0x34')]['find'](_0x55af32)[_0xac4a('0x27')](handleEntityNotFound(_0x4f2b19,null))['then'](respondWithResult(_0x4f2b19,null))[_0xac4a('0x33')](handleError(_0x4f2b19,null));};exports[_0xac4a('0xaf')]=function(_0x24f464,_0xfe8977){return db[_0xac4a('0x34')][_0xac4a('0xaf')](_0x24f464[_0xac4a('0x71')],{})[_0xac4a('0x27')](respondWithResult(_0xfe8977,0xc9))[_0xac4a('0x33')](handleError(_0xfe8977,null));};exports[_0xac4a('0x26')]=function(_0x3a0163,_0x455eb7){if(_0x3a0163[_0xac4a('0x71')]['id']){delete _0x3a0163[_0xac4a('0x71')]['id'];}return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x3a0163[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x455eb7,null))[_0xac4a('0x27')](saveUpdates(_0x3a0163[_0xac4a('0x71')],null))[_0xac4a('0x27')](respondWithResult(_0x455eb7,null))[_0xac4a('0x33')](handleError(_0x455eb7,null));};exports[_0xac4a('0x28')]=function(_0x5d5bb3,_0x101137){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x5d5bb3[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x101137,null))[_0xac4a('0x27')](removeEntity(_0x101137,null))['catch'](handleError(_0x101137,null));};exports[_0xac4a('0xb0')]=function(_0x55866d,_0x277fd1){return db[_0xac4a('0x34')][_0xac4a('0xb0')]()['then'](respondWithResult(_0x277fd1,null))[_0xac4a('0x33')](handleError(_0x277fd1,null));};exports[_0xac4a('0xb1')]=function(_0x127ede,_0x52f3f2,_0x2da95f){return db[_0xac4a('0xb2')][_0xac4a('0x5c')]({'where':{'id':_0x127ede[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x52f3f2,null))[_0xac4a('0x27')](function(_0x3b4183){if(_0x3b4183){return _0x3b4183[_0xac4a('0xb1')](_0x127ede['body'][_0xac4a('0xb3')],_['omit'](_0x127ede['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x52f3f2,null))['catch'](handleError(_0x52f3f2,null));};exports[_0xac4a('0xb4')]=function(_0x58fcb0,_0xc014a6,_0x377444){var _0x2132b2={'raw':![],'where':{}};var _0x525d50={};var _0x9ea4d1={'count':0x0,'rows':[]};return db[_0xac4a('0x34')][_0xac4a('0xb5')]({'where':{'id':_0x58fcb0[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0xc014a6,null))[_0xac4a('0x27')](function(_0x7a1b25){if(_0x7a1b25){_0x525d50[_0xac4a('0x38')]=_['keys'](db[_0xac4a('0xb2')][_0xac4a('0x35')]);_0x525d50[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x58fcb0[_0xac4a('0x39')]);_0x525d50[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x525d50['model'],_0x525d50['query']);_0x2132b2[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x525d50['model'],qs[_0xac4a('0x93')](_0x58fcb0[_0xac4a('0x39')]['fields']));_0x2132b2['attributes']=_0x2132b2[_0xac4a('0x3d')][_0xac4a('0x63')]?_0x2132b2[_0xac4a('0x3d')]:_0x525d50[_0xac4a('0x38')];if(!_0x58fcb0[_0xac4a('0x39')]['hasOwnProperty'](_0xac4a('0x3f'))){_0x2132b2['limit']=qs['limit'](_0x58fcb0['query'][_0xac4a('0x40')]);_0x2132b2[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x21')]);}_0x2132b2[_0xac4a('0x8b')]=qs[_0xac4a('0x41')](_0x58fcb0[_0xac4a('0x39')]['sort']);_0x2132b2['where']=qs['filters'](_[_0xac4a('0x43')](_0x58fcb0[_0xac4a('0x39')],_0x525d50[_0xac4a('0x3b')]));_0x2132b2[_0xac4a('0x42')][_0xac4a('0xa8')]=_0x7a1b25['id'];if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]){_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],{'$or':_[_0xac4a('0x2d')](_0x2132b2[_0xac4a('0x3d')],function(_0xe0fd57){var _0x32b013={};_0x32b013[_0xe0fd57]={'$like':'%'+_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]+'%'};return _0x32b013;})});}if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')]){var _0x41cdb5=_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')][_0xac4a('0x31')](',');var _0x3e2575={};_0x3e2575[_0x41cdb5[0x0]]={'$gte':moment(_0x41cdb5[0x1])['format'](_0xac4a('0xb6'))};_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],_0x3e2575);}_0x2132b2=_[_0xac4a('0xae')]({},_0x2132b2,_0x58fcb0[_0xac4a('0xb7')]);return db[_0xac4a('0xb2')][_0xac4a('0x20')]({'where':_0x2132b2['where']})['then'](function(_0x113f80){_0x9ea4d1[_0xac4a('0x20')]=_0x113f80;if(_0x58fcb0[_0xac4a('0x39')]['includeAll']){_0x2132b2['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xac4a('0xb8')](_0x2132b2);})['then'](function(_0x59e82c){_0x9ea4d1[_0xac4a('0xaa')]=_0x59e82c;return _0x9ea4d1;});}})['then'](respondWithFilteredResult(_0xc014a6,_0x2132b2))[_0xac4a('0x33')](handleError(_0xc014a6,null));};exports['addTags']=function(_0x3f95a4,_0x2b4f28,_0x413f5f){return db[_0xac4a('0x34')][_0xac4a('0x5c')]({'where':{'id':_0x3f95a4[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x2b4f28,null))[_0xac4a('0x27')](function(_0x34b6d7){if(_0x34b6d7){return _0x34b6d7[_0xac4a('0xb9')](_0x3f95a4['body'][_0xac4a('0xb3')],_[_0xac4a('0xba')](_0x3f95a4[_0xac4a('0x71')],[_0xac4a('0xb3'),'id'])||{})['spread'](function(){return db[_0xac4a('0x69')][_0xac4a('0xb8')]({'attributes':['id',_0xac4a('0x2b'),_0xac4a('0x46')],'where':{'id':_0x3f95a4[_0xac4a('0x71')][_0xac4a('0xb3')]}});})['then'](function(_0x57d3cd){socket[_0xac4a('0xbb')](_0xac4a('0xbc'),{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]});return{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]};});}})[_0xac4a('0x27')](respondWithResult(_0x2b4f28,null))[_0xac4a('0x33')](handleError(_0x2b4f28,null));};exports['removeTags']=function(_0x21a6f6,_0x580c9b,_0xe4165d){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x21a6f6[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x580c9b,null))[_0xac4a('0x27')](function(_0x5650ce){if(_0x5650ce){return _0x5650ce[_0xac4a('0xbd')](_0x21a6f6[_0xac4a('0x39')][_0xac4a('0xb3')]);}})[_0xac4a('0x27')](respondWithStatusCode(_0x580c9b,null))[_0xac4a('0x33')](handleError(_0x580c9b,null));};exports['download']=function(_0x3dd60a,_0xbe1958){var _0x462964=moment()[_0xac4a('0xbe')]()[_0xac4a('0x91')]();var _0x5e5eb1=path[_0xac4a('0xbf')](config[_0xac4a('0xc0')],_0xac4a('0xc1'),_0xac4a('0xc2'),_0xac4a('0xc3'));var _0x55ccc3=path['join'](config['root'],'server',_0xac4a('0xc2'),_0xac4a('0xc4'));var _0x17f815=path[_0xac4a('0xbf')](_0x5e5eb1,_0x462964);var _0xa8b5bb=util['format'](_0xac4a('0xc5'),_0x3dd60a[_0xac4a('0xac')]['id'],_0x462964);var _0x5aad90=path[_0xac4a('0xbf')](_0x5e5eb1,_0xa8b5bb);var _0x14b425=[];_0x14b425[_0xac4a('0x32')]({'model':db['User'],'as':_0xac4a('0x6d'),'attributes':['id',_0xac4a('0x2e')],'raw':!![]});_0x14b425[_0xac4a('0x32')]({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x61'),'attributes':['id',_0xac4a('0xc7'),_0xac4a('0xc8')],'raw':!![]});if(_0x3dd60a[_0xac4a('0x39')][_0xac4a('0xc4')]){_0x14b425['push']({'model':db[_0xac4a('0xc9')],'as':_0xac4a('0xc9'),'raw':!![]});}var _0x579181=[{'model':db[_0xac4a('0xb2')],'as':'Messages','attributes':['id',_0xac4a('0x71'),_0xac4a('0xca'),'direction',_0xac4a('0xcb'),_0xac4a('0x7e')],'include':_0x14b425}];_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0xcc')],'as':_0xac4a('0xcd'),'attributes':['id',_0xac4a('0x2b')]});_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xac4a('0x34')]['find']({'where':{'id':_0x3dd60a['params']['id']},'include':_0x579181})[_0xac4a('0x27')](handleEntityNotFound(_0xbe1958,null))[_0xac4a('0x27')](function(_0x3254c3){if(_0x3254c3){var _0x516225=_0x3254c3[_0xac4a('0xce')]({'plain':!![]});fs[_0xac4a('0xcf')](_0x17f815);var _0x5a2abf={'format':'A4','border':'10px','header':{'height':_0xac4a('0xd0'),'contents':{'first':_0xac4a('0xd1')}},'footer':{'height':_0xac4a('0xd2'),'contents':{'default':util[_0xac4a('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xac4a('0xd3')](_0xac4a('0xd4'),_0xac4a('0xd5'),_0x516225['id']),moment()['format'](_0xac4a('0xd6'))[_0xac4a('0x91')]())}}};var _0x15b97a={'channel':_0xac4a('0xd5'),'account':_0x516225[_0xac4a('0xcd')]['name'],'agent':_0x516225['Owner']?_0x516225[_0xac4a('0xd7')][_0xac4a('0x2e')]:_0xac4a('0xd8'),'createdAt':moment(_0x516225[_0xac4a('0xca')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')](),'closedAt':_0x516225[_0xac4a('0xd9')]?moment(_0x516225[_0xac4a('0xda')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')]():'','disposition':_0x516225[_0xac4a('0xdb')],'messages':_(_0x516225['Messages'])[_0xac4a('0x83')]({'secret':![]})['map'](function(_0x4ec2c3){if(_0x4ec2c3[_0xac4a('0xc9')]){var _0x27833a=path[_0xac4a('0xbf')](_0x55ccc3,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]);if(fs[_0xac4a('0xdd')](_0x27833a)){fs[_0xac4a('0xde')](_0x27833a)[_0xac4a('0xdf')](fs[_0xac4a('0xe0')](path['join'](_0x17f815,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')])));}}return{'date':moment(_0x4ec2c3[_0xac4a('0xca')])[_0xac4a('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ec2c3[_0xac4a('0xe1')]===_0xac4a('0xe2')?_0x4ec2c3[_0xac4a('0x6d')]?_0x4ec2c3[_0xac4a('0x6d')][_0xac4a('0x2e')]:_0xac4a('0xe3'):_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc7')]+(_0x4ec2c3[_0xac4a('0x61')]['lastName']?'\x20'+_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc8')]:''),'body':_0x4ec2c3[_0xac4a('0xc9')]?_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]:_0x4ec2c3[_0xac4a('0x71')],'direction':_0x4ec2c3['direction']==='out'?'A':'C','secret':_0x4ec2c3['secret'],'read':_0x4ec2c3[_0xac4a('0x7e')],'attachment':_0x4ec2c3[_0xac4a('0xc9')]};})['value']()};return ejs['renderFile'](path[_0xac4a('0xbf')](config['root'],_0xac4a('0xc1'),'views',_0xac4a('0xe4')),{'interaction':_0x15b97a})[_0xac4a('0x27')](function(_0x1888c3){return new BPromise(function(_0x4a04c3,_0x14435d){pdf[_0xac4a('0xaf')](_0x1888c3,_0x5a2abf)['toFile'](path[_0xac4a('0xbf')](_0x17f815,_0xac4a('0xe5')+_0x516225['id']+'-'+_0x462964+'.pdf'),function(_0x48a75c,_0x4514a5){if(_0x48a75c)return _0x14435d(_0x48a75c);_0x4a04c3(_0x4514a5);});});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x43df37,_0x45e45b){zipdir(_0x17f815,{'saveTo':_0x5aad90},function(_0x367254,_0x22cc71){if(_0x367254)return _0x45e45b(_0x367254);return _0x43df37(_0x22cc71);});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x1ea4ef,_0x156b67){rimraf(_0x17f815,function(_0x330070){if(_0x330070)_0x156b67(_0x330070);return _0x1ea4ef();});});})[_0xac4a('0x27')](function(){return _0xbe1958[_0xac4a('0xe6')](_0x5aad90,_0xa8b5bb,function(_0x2d755c){if(_0x2d755c){console[_0xac4a('0xe7')](_0xac4a('0xe8'),_0x2d755c);}else{fs[_0xac4a('0xe9')](_0x5aad90);}});});});}else{return _0xbe1958[_0xac4a('0x1c')](0xc8);}})['catch'](handleError(_0xbe1958,null));}; \ No newline at end of file +var _0x7a54=['attachments','Attachment','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','30px','%s\x20#%d','Whatsapp','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','select','color','tools_tags','u.id','field','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','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?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','buildExpression','start','body','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','rows','show','params','includeAll','include','WhatsappInteraction','create','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','format','options','findAll','emit','removeTags','unix','root','files','tmp','server','join','transcript-%d-%s.zip','User','firstName','lastName'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x7a54,0x106));var _0x47a5=function(_0x4b5f05,_0x5dd930){_0x4b5f05=_0x4b5f05-0x0;var _0x384039=_0x7a54[_0x4b5f05];return _0x384039;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}function getInteractionUsers(_0x136b14,_0x16631f){return new BPromise(function(_0x361bfa,_0x1127f8){try{if(_0x16631f[_0x136b14['id']]){_0x136b14[_0x47a5('0x2b')]=_[_0x47a5('0x2c')](_0x16631f[_0x136b14['id']],function(_0x528582){return{'id':_0x528582['id'],'fullname':_0x528582[_0x47a5('0x2d')]};});}}catch(_0x51833b){_0x1127f8(_0x51833b);}_0x361bfa(_0x136b14);});}function getInteractionTags(_0x2ef875,_0x9ac908){return new BPromise(function(_0x16901f,_0x4d6b57){try{if(_0x2ef875[_0x47a5('0x2e')]){_0x2ef875[_0x47a5('0x2f')]=[];_0x2ef875[_0x47a5('0x2e')][_0x47a5('0x30')](',')['forEach'](function(_0x50d875){_0x2ef875[_0x47a5('0x2f')][_0x47a5('0x31')](_0x9ac908[_0x50d875]);});}delete _0x2ef875['TagIds'];}catch(_0x4e1006){_0x4d6b57(_0x4e1006);}_0x16901f(_0x2ef875);});}function updateWhatsappInteraction(_0x836303,_0x51544e,_0x57bff6){return new BPromise(function(_0x42f70c,_0x53119b){return getInteractionUsers(_0x836303,_0x57bff6)[_0x47a5('0x26')](function(_0xd972c){return getInteractionTags(_0xd972c,_0x51544e);})['then'](function(_0x4843c0){_0x42f70c(_0x4843c0);})[_0x47a5('0x32')](function(_0x5910bb){_0x53119b(_0x5910bb);});});}exports[_0x47a5('0x33')]=function(_0x87e4c9,_0xf269a8){var _0x52749b={},_0x18f7e9={},_0x50c086={'count':0x0,'rows':[]};var _0x53c754=_[_0x47a5('0x2c')](db['WhatsappInteraction'][_0x47a5('0x34')],function(_0x5ef577){return{'name':_0x5ef577[_0x47a5('0x35')],'type':_0x5ef577[_0x47a5('0x36')][_0x47a5('0x37')]};});_0x18f7e9[_0x47a5('0x38')]=_[_0x47a5('0x2c')](_0x53c754,_0x47a5('0x29'));_0x18f7e9[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x87e4c9[_0x47a5('0x39')]);_0x18f7e9['filters']=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],_0x18f7e9['query']);_0x52749b[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],qs['fields'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x3d')]));_0x52749b['attributes']=_0x52749b[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x52749b['attributes']:_0x18f7e9['model'];if(!_0x87e4c9['query'][_0x47a5('0x3f')]('nolimit')){_0x52749b[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1f')]);_0x52749b[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x52749b[_0x47a5('0x40')]=qs[_0x47a5('0x41')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x41')]);_0x52749b[_0x47a5('0x42')]=qs['filters'](_[_0x47a5('0x43')](_0x87e4c9[_0x47a5('0x39')],_0x18f7e9[_0x47a5('0x44')]),_0x53c754);var _0x23bd8d=[];var _0x586f4f=squel[_0x47a5('0x45')]()['field']('id')['field']('name')['field'](_0x47a5('0x46'))['from'](_0x47a5('0x47'));var _0x3a740b=squel[_0x47a5('0x45')]()['field'](_0x47a5('0x48'))[_0x47a5('0x49')]('u.fullname')['field'](_0x47a5('0x4a'))['from'](_0x47a5('0x4b'),'ui')[_0x47a5('0x4c')](_0x47a5('0x4d'),'u',_0x47a5('0x4e'));var _0x34a9ae=squel[_0x47a5('0x45')]()[_0x47a5('0x4f')](_0x47a5('0x50'),'i')[_0x47a5('0x4c')](_0x47a5('0x51'),'c',_0x47a5('0x52'))[_0x47a5('0x4c')](_0x47a5('0x4d'),'o',_0x47a5('0x53'))[_0x47a5('0x4c')](_0x47a5('0x54'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x47a5('0x4c')](_0x47a5('0x55'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x47a5('0x56'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x47a5('0x4c')](_0x47a5('0x47'),'t','t.id\x20=\x20it.TagId');var _0x4f62d3=squel[_0x47a5('0x57')]();var _0x52d409=[];var _0x2d147c=squel[_0x47a5('0x57')]();var _0x3548bc;if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x58')]){_0x3548bc=as[_0x47a5('0x59')](_0x87e4c9[_0x47a5('0x39')]['search']);var _0x48a0ef=_0x3548bc[_0x47a5('0x5a')];for(var _0x411230=0x0;_0x411230<_0x3548bc[_0x47a5('0x5b')][_0x47a5('0x3e')];_0x411230++){var _0x2c7020=_0x3548bc[_0x47a5('0x5b')][_0x411230];var _0x249de5='i';var _0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x2c7020[_0x47a5('0x49')]]);if(!_0x492cf7){switch(_0x2c7020['field']){case _0x47a5('0x5d'):if(_0x2c7020['value']==0x1){_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020[_0x47a5('0x49')]+_0x47a5('0x5f'));}else{_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020['field']+_0x47a5('0x60'));}break;case _0x47a5('0x61'):if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){if(_0x2c7020[_0x47a5('0x64')][_0x47a5('0x30')]('\x20')[_0x47a5('0x3e')]>0x1){_0x4f62d3[_0x48a0ef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x47a5('0x65')](_0x2c7020[_0x47a5('0x64')]),null);}else{var _0x187d7e='%'+_0x2c7020[_0x47a5('0x64')]+'%';_0x4f62d3[_0x48a0ef](_0x47a5('0x66'),_0x187d7e,_0x187d7e,_0x187d7e);}}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,['name',_0x47a5('0x67')]);_0x2c7020[_0x47a5('0x49')]=_0x47a5('0x67');_0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x69'):var _0x4fa1da=_0x2c7020['value'][_0x47a5('0x30')](',')['map'](function(_0x16bb8a){return Number(_0x16bb8a);});_0x4fa1da['forEach'](function(_0x482de6){_0x2d147c['or'](_0x47a5('0x6a'),'%,'+_0x482de6+',%');});_0x52d409=_[_0x47a5('0x6b')](_0x52d409,_0x4fa1da);break;case'User':if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){_0x4f62d3[_0x48a0ef]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2c7020['value']+'%',null);}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x47a5('0x6c')]);_0x2c7020[_0x47a5('0x49')]='UserId';_0x5cbe97=as[_0x47a5('0x6d')](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97['value'][_0x47a5('0x6e')],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x6f'):_0x5cbe97=as[_0x47a5('0x6d')]('me',null,_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97[_0x47a5('0x64')]['end']);break;}}else{var _0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7['type'],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')][_0x47a5('0x6e')],_0x5cbe97['value']['end']);}}}else{var _0x139229=_(_0x87e4c9[_0x47a5('0x39')])[_0x47a5('0x3a')]()[_0x47a5('0x2c')](function(_0xc45e25){return _['some'](_0x53c754,[_0x47a5('0x29'),_0xc45e25])?_0xc45e25:undefined;})['compact']()[_0x47a5('0x64')]();if(!_[_0x47a5('0x70')](_0x139229)){_0x139229['forEach'](function(_0x32b4de){if(_0x32b4de===_0x47a5('0x71')){_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x72'),[][_0x47a5('0x73')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de]));}else if(_0x32b4de===_0x47a5('0x74')){var _0x3ac38c=JSON['parse'](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])[_0x47a5('0x75')];var _0x3c75c6=JSON[_0x47a5('0x76')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])['$lte'];_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x77'),_0x3ac38c,_0x3c75c6);}else{if(_0x87e4c9[_0x47a5('0x39')][_0x32b4de]===_0x47a5('0x78')){_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x79'));}else{_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x7a'),_0x87e4c9[_0x47a5('0x39')][_0x32b4de]);}}});}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]==0x1){_0x34a9ae[_0x47a5('0x5e')](_0x47a5('0x7c'));}else{_0x34a9ae['having'](_0x47a5('0x7d'));}}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]){_0x52d409=_['isArray'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')])?_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]:new Array(_0x87e4c9['query'][_0x47a5('0x7e')]);_0x52d409['forEach'](function(_0x2d5ee6){_0x2d147c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2d5ee6+',%');});}if(_0x87e4c9[_0x47a5('0x39')]['filter']){var _0x7c1190=_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7f')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x47a5('0x80')](_0x7c1190)){_0x4f62d3['or'](_0x47a5('0x81'),_0x7c1190+'%')['or'](_0x47a5('0x82'),_0x7c1190+'%');}else{_0x4f62d3['or'](_0x47a5('0x83'),qs['getFullTextValue'](_0x7c1190))['or'](_0x47a5('0x84'),_0x7c1190+'%');}}}_0x34a9ae[_0x47a5('0x42')](_0x4f62d3);_0x34a9ae[_0x47a5('0x85')](_0x47a5('0x86'));var _0x308c9a={'type':db[_0x47a5('0x87')][_0x47a5('0x88')][_0x47a5('0x89')],'raw':!![]};var _0x4618a0=_0x34a9ae[_0x47a5('0x8a')]();_0x4618a0[_0x47a5('0x49')](_0x47a5('0x86'));_0x4618a0['field'](_0x47a5('0x8b'),'unreadMessages');if(_0x52749b[_0x47a5('0x40')]){_0x52749b[_0x47a5('0x40')][_0x47a5('0x8c')](function(_0x12fec9){_0x34a9ae[_0x47a5('0x40')]('i.'+_0x12fec9[0x0],_0x12fec9[0x1]===_0x47a5('0x8d')?![]:!![]);});}if(!_[_0x47a5('0x70')](_0x52d409)){_0x34a9ae[_0x47a5('0x5e')](_0x2d147c);_0x4618a0[_0x47a5('0x42')](_0x47a5('0x8e'),_0x52d409);}BPromise[_0x47a5('0x8f')]()[_0x47a5('0x26')](function(){if(!_0x3548bc){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x71')]||_0x87e4c9[_0x47a5('0x39')]['journey'])return;_0x4618a0['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x34a9ae['where'](_0x47a5('0x90'));return;}return _0x87e4c9[_0x47a5('0x91')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x47a5('0x26')](function(_0x44dda2){if(_[_0x47a5('0x70')](_0x44dda2)){_0x4618a0[_0x47a5('0x42')](_0x47a5('0x92'));_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x92'));}else{_0x4618a0[_0x47a5('0x42')](_0x47a5('0x72'),_[_0x47a5('0x2c')](_0x44dda2,'id'));_0x34a9ae[_0x47a5('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0x47a5('0x2c')](_0x44dda2,'id'));}});})[_0x47a5('0x26')](function(){db[_0x47a5('0x93')]['query'](_0x4618a0[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x17b61d){_0x50c086['count']=_0x17b61d[_0x47a5('0x3e')];if(_0x50c086['count']===0x0)return[];return db['sequelize'][_0x47a5('0x39')](_0x586f4f[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x27333e){_0x23bd8d=_[_0x47a5('0x95')](_0x27333e,'id');_0x308c9a=_[_0x47a5('0x96')](_0x308c9a,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x87e4c9['query'][_0x47a5('0x3d')]){_0x52749b['attributes'][_0x47a5('0x8c')](function(_0x3fffd1){_0x34a9ae[_0x47a5('0x49')]('i.'+_0x3fffd1);});}else{_0x34a9ae[_0x47a5('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x47a5('0x5d'));_0x34a9ae['field']('a.key',_0x47a5('0x97'));_0x34a9ae[_0x47a5('0x49')]('a.mandatoryDisposition',_0x47a5('0x98'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x99'));_0x34a9ae['field'](_0x47a5('0x9a'),'Contact.firstName');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x9b'),_0x47a5('0x9c'));_0x34a9ae['field'](_0x47a5('0x9d'),_0x47a5('0x9e'));_0x34a9ae[_0x47a5('0x49')]('c.phone',_0x47a5('0x9f'));_0x34a9ae['field'](_0x47a5('0xa0'),'Contact.mobile');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa1'),_0x47a5('0xa2'));_0x34a9ae[_0x47a5('0x49')]('o.fullname',_0x47a5('0xa3'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa4'),_0x47a5('0xa5'));_0x34a9ae[_0x47a5('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x52749b[_0x47a5('0x1f')])_0x34a9ae['limit'](_0x52749b[_0x47a5('0x1f')]);if(_0x52749b[_0x47a5('0x1e')])_0x34a9ae[_0x47a5('0x1e')](_0x52749b['offset']);return db[_0x47a5('0x93')][_0x47a5('0x39')](_0x34a9ae['toString'](),_0x308c9a);})[_0x47a5('0x26')](function(_0x8a9dea){_0x3a740b[_0x47a5('0x42')](_0x47a5('0xa6'),_['map'](_0x8a9dea,'id'));return db['sequelize'][_0x47a5('0x39')](_0x3a740b[_0x47a5('0x94')](),_0x308c9a)['then'](function(_0x27d422){var _0x23f055=_['groupBy'](_0x27d422,_0x47a5('0xa7'));var _0x2a02cd=[];_0x8a9dea[_0x47a5('0x8c')](function(_0x59f010){_0x2a02cd[_0x47a5('0x31')](updateWhatsappInteraction(_0x59f010,_0x23bd8d,_0x23f055));});return BPromise['all'](_0x2a02cd);});});})[_0x47a5('0x26')](function(_0x5e2946){_0x50c086[_0x47a5('0xa8')]=_0x5e2946;return _0x50c086;})[_0x47a5('0x26')](respondWithFilteredResult(_0xf269a8,_0x52749b));})['catch'](handleError(_0xf269a8,null));};exports[_0x47a5('0xa9')]=function(_0x597cb2,_0x1eabef){var _0x36f619={'raw':![],'where':{'id':_0x597cb2[_0x47a5('0xaa')]['id']}},_0x37e045={};_0x37e045['model']=_[_0x47a5('0x3a')](db['WhatsappInteraction']['rawAttributes']);_0x37e045[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x597cb2[_0x47a5('0x39')]);_0x37e045[_0x47a5('0x44')]=_[_0x47a5('0x3b')](_0x37e045['model'],_0x37e045[_0x47a5('0x39')]);_0x36f619[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x37e045[_0x47a5('0x38')],qs['fields'](_0x597cb2[_0x47a5('0x39')]['fields']));_0x36f619[_0x47a5('0x3c')]=_0x36f619[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x36f619[_0x47a5('0x3c')]:_0x37e045[_0x47a5('0x38')];if(_0x597cb2[_0x47a5('0x39')][_0x47a5('0xab')]){_0x36f619[_0x47a5('0xac')]=[{'all':!![]}];}_0x36f619=_[_0x47a5('0x96')]({},_0x36f619,_0x597cb2['options']);return db[_0x47a5('0xad')][_0x47a5('0x5c')](_0x36f619)['then'](handleEntityNotFound(_0x1eabef,null))[_0x47a5('0x26')](respondWithResult(_0x1eabef,null))[_0x47a5('0x32')](handleError(_0x1eabef,null));};exports[_0x47a5('0xae')]=function(_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0xad')][_0x47a5('0xae')](_0x5b85cd['body'],{})['then'](respondWithResult(_0x4bf1f5,0xc9))[_0x47a5('0x32')](handleError(_0x4bf1f5,null));};exports[_0x47a5('0x24')]=function(_0x54eab1,_0x29e384){if(_0x54eab1[_0x47a5('0x6f')]['id']){delete _0x54eab1['body']['id'];}return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x54eab1[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x29e384,null))[_0x47a5('0x26')](saveUpdates(_0x54eab1[_0x47a5('0x6f')],null))['then'](respondWithResult(_0x29e384,null))['catch'](handleError(_0x29e384,null));};exports['destroy']=function(_0x133b7a,_0xce5ada){return db['WhatsappInteraction'][_0x47a5('0x5c')]({'where':{'id':_0x133b7a[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0xce5ada,null))[_0x47a5('0x26')](removeEntity(_0xce5ada,null))[_0x47a5('0x32')](handleError(_0xce5ada,null));};exports['describe']=function(_0x3e7750,_0x548a06){return db['WhatsappInteraction']['describe']()[_0x47a5('0x26')](respondWithResult(_0x548a06,null))['catch'](handleError(_0x548a06,null));};exports[_0x47a5('0xaf')]=function(_0xf3edc8,_0x5a316e,_0x49f791){return db[_0x47a5('0xb0')][_0x47a5('0x5c')]({'where':{'id':_0xf3edc8[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x5a316e,null))[_0x47a5('0x26')](function(_0x581a87){if(_0x581a87){return _0x581a87[_0x47a5('0xaf')](_0xf3edc8[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0xf3edc8[_0x47a5('0x6f')],[_0x47a5('0xb2'),'id'])||{});}})[_0x47a5('0x26')](respondWithResult(_0x5a316e,null))[_0x47a5('0x32')](handleError(_0x5a316e,null));};exports[_0x47a5('0xb3')]=function(_0x5112d7,_0x6a8174,_0x2e418d){var _0x50b236={'raw':![],'where':{}};var _0x263521={};var _0x9769b5={'count':0x0,'rows':[]};return db[_0x47a5('0xad')][_0x47a5('0xb4')]({'where':{'id':_0x5112d7['params']['id']}})['then'](handleEntityNotFound(_0x6a8174,null))['then'](function(_0x4eee99){if(_0x4eee99){_0x263521[_0x47a5('0x38')]=_[_0x47a5('0x3a')](db[_0x47a5('0xb0')][_0x47a5('0x34')]);_0x263521[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5112d7[_0x47a5('0x39')]);_0x263521[_0x47a5('0x44')]=_['intersection'](_0x263521[_0x47a5('0x38')],_0x263521[_0x47a5('0x39')]);_0x50b236[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x263521['model'],qs['fields'](_0x5112d7[_0x47a5('0x39')]['fields']));_0x50b236['attributes']=_0x50b236[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x50b236['attributes']:_0x263521[_0x47a5('0x38')];if(!_0x5112d7[_0x47a5('0x39')][_0x47a5('0x3f')]('nolimit')){_0x50b236[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x5112d7['query'][_0x47a5('0x1f')]);_0x50b236[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x5112d7[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x50b236[_0x47a5('0x40')]=qs['sort'](_0x5112d7[_0x47a5('0x39')]['sort']);_0x50b236[_0x47a5('0x42')]=qs[_0x47a5('0x44')](_[_0x47a5('0x43')](_0x5112d7[_0x47a5('0x39')],_0x263521['filters']));_0x50b236[_0x47a5('0x42')][_0x47a5('0xa7')]=_0x4eee99['id'];if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x7f')]){_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],{'$or':_[_0x47a5('0x2c')](_0x50b236[_0x47a5('0x3c')],function(_0xa2045c){var _0x109738={};_0x109738[_0xa2045c]={'$like':'%'+_0x5112d7[_0x47a5('0x39')]['filter']+'%'};return _0x109738;})});}if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')]){var _0x591bde=_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')][_0x47a5('0x30')](',');var _0x2ccf21={};_0x2ccf21[_0x591bde[0x0]]={'$gte':moment(_0x591bde[0x1])[_0x47a5('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],_0x2ccf21);}_0x50b236=_[_0x47a5('0x96')]({},_0x50b236,_0x5112d7[_0x47a5('0xb6')]);return db[_0x47a5('0xb0')][_0x47a5('0x1d')]({'where':_0x50b236['where']})['then'](function(_0xa3d578){_0x9769b5['count']=_0xa3d578;if(_0x5112d7[_0x47a5('0x39')]['includeAll']){_0x50b236[_0x47a5('0xac')]=[{'all':!![]}];}return db[_0x47a5('0xb0')][_0x47a5('0xb7')](_0x50b236);})[_0x47a5('0x26')](function(_0x49cb8c){_0x9769b5[_0x47a5('0xa8')]=_0x49cb8c;return _0x9769b5;});}})[_0x47a5('0x26')](respondWithFilteredResult(_0x6a8174,_0x50b236))[_0x47a5('0x32')](handleError(_0x6a8174,null));};exports['addTags']=function(_0x581759,_0x30375f,_0x29015a){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x581759[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x30375f,null))[_0x47a5('0x26')](function(_0xe662d7){if(_0xe662d7){return _0xe662d7['setTags'](_0x581759[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0x581759[_0x47a5('0x6f')],['ids','id'])||{})['spread'](function(){return db[_0x47a5('0x69')][_0x47a5('0xb7')]({'attributes':['id','name',_0x47a5('0x46')],'where':{'id':_0x581759[_0x47a5('0x6f')][_0x47a5('0xb2')]}});})[_0x47a5('0x26')](function(_0x5a7f32){socket[_0x47a5('0xb8')]('whatsappInteractionTags:save',{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]});return{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]};});}})[_0x47a5('0x26')](respondWithResult(_0x30375f,null))['catch'](handleError(_0x30375f,null));};exports[_0x47a5('0xb9')]=function(_0x156d51,_0x401139,_0x2005d5){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x156d51[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x401139,null))[_0x47a5('0x26')](function(_0x2200f9){if(_0x2200f9){return _0x2200f9[_0x47a5('0xb9')](_0x156d51[_0x47a5('0x39')][_0x47a5('0xb2')]);}})[_0x47a5('0x26')](respondWithStatusCode(_0x401139,null))[_0x47a5('0x32')](handleError(_0x401139,null));};exports['download']=function(_0xdd95c8,_0x40aee5){var _0x322cee=moment()[_0x47a5('0xba')]()['toString']();var _0x367662=path['join'](config[_0x47a5('0xbb')],'server',_0x47a5('0xbc'),_0x47a5('0xbd'));var _0x3b894d=path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xbc'),'attachments');var _0x52798d=path[_0x47a5('0xbf')](_0x367662,_0x322cee);var _0x1a5e07=util[_0x47a5('0xb5')](_0x47a5('0xc0'),_0xdd95c8[_0x47a5('0xaa')]['id'],_0x322cee);var _0x579e5c=path[_0x47a5('0xbf')](_0x367662,_0x1a5e07);var _0x4b3ae4=[];_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc1')],'as':_0x47a5('0xc1'),'attributes':['id',_0x47a5('0x2d')],'raw':!![]});_0x4b3ae4['push']({'model':db['CmContact'],'as':_0x47a5('0x61'),'attributes':['id',_0x47a5('0xc2'),_0x47a5('0xc3')],'raw':!![]});if(_0xdd95c8[_0x47a5('0x39')][_0x47a5('0xc4')]){_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc5')],'as':_0x47a5('0xc5'),'raw':!![]});}var _0x2c2245=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x47a5('0x6f'),'createdAt',_0x47a5('0xc6'),_0x47a5('0xc7'),_0x47a5('0x7b')],'include':_0x4b3ae4}];_0x2c2245['push']({'model':db[_0x47a5('0xc8')],'as':_0x47a5('0xc9'),'attributes':['id','name']});_0x2c2245[_0x47a5('0x31')]({'model':db['User'],'as':_0x47a5('0xca'),'attributes':['id',_0x47a5('0x2d')]});return db[_0x47a5('0xad')]['find']({'where':{'id':_0xdd95c8['params']['id']},'include':_0x2c2245})['then'](handleEntityNotFound(_0x40aee5,null))['then'](function(_0x5075a6){if(_0x5075a6){var _0x1ba5b6=_0x5075a6['get']({'plain':!![]});fs[_0x47a5('0xcb')](_0x52798d);var _0x2287b0={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x47a5('0xcc'),'contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x47a5('0xcd'),_0x47a5('0xce'),_0x1ba5b6['id']),moment()[_0x47a5('0xb5')](_0x47a5('0xcf'))['toString']())}}};var _0xdda046={'channel':'Whatsapp','account':_0x1ba5b6[_0x47a5('0xc9')]['name'],'agent':_0x1ba5b6[_0x47a5('0xca')]?_0x1ba5b6[_0x47a5('0xca')][_0x47a5('0x2d')]:'N.A.','createdAt':moment(_0x1ba5b6[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')](),'closedAt':_0x1ba5b6['closed']?moment(_0x1ba5b6[_0x47a5('0xd1')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')]():'','disposition':_0x1ba5b6[_0x47a5('0xd2')],'messages':_(_0x1ba5b6[_0x47a5('0xd3')])['filter']({'secret':![]})[_0x47a5('0x2c')](function(_0xe245ca){if(_0xe245ca[_0x47a5('0xc5')]){var _0xac8d4f=path[_0x47a5('0xbf')](_0x3b894d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]);if(fs[_0x47a5('0xd5')](_0xac8d4f)){fs[_0x47a5('0xd6')](_0xac8d4f)[_0x47a5('0xd7')](fs[_0x47a5('0xd8')](path[_0x47a5('0xbf')](_0x52798d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')])));}}return{'date':moment(_0xe245ca[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))['toString'](),'sender':_0xe245ca[_0x47a5('0xc6')]==='out'?_0xe245ca['User']?_0xe245ca[_0x47a5('0xc1')][_0x47a5('0x2d')]:_0x47a5('0xd9'):_0xe245ca['Contact'][_0x47a5('0xc2')]+(_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]?'\x20'+_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]:''),'body':_0xe245ca[_0x47a5('0xc5')]?_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]:_0xe245ca[_0x47a5('0x6f')],'direction':_0xe245ca[_0x47a5('0xc6')]===_0x47a5('0xda')?'A':'C','secret':_0xe245ca[_0x47a5('0xc7')],'read':_0xe245ca[_0x47a5('0x7b')],'attachment':_0xe245ca['Attachment']};})['value']()};return ejs[_0x47a5('0xdb')](path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xdc'),_0x47a5('0xdd')),{'interaction':_0xdda046})[_0x47a5('0x26')](function(_0x3708ea){return new BPromise(function(_0x583b37,_0x2b4039){pdf[_0x47a5('0xae')](_0x3708ea,_0x2287b0)[_0x47a5('0xde')](path['join'](_0x52798d,_0x47a5('0xdf')+_0x1ba5b6['id']+'-'+_0x322cee+_0x47a5('0xe0')),function(_0x3ecc41,_0x3e4148){if(_0x3ecc41)return _0x2b4039(_0x3ecc41);_0x583b37(_0x3e4148);});});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x23e649,_0x35e20f){zipdir(_0x52798d,{'saveTo':_0x579e5c},function(_0x46615a,_0xd6e255){if(_0x46615a)return _0x35e20f(_0x46615a);return _0x23e649(_0xd6e255);});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x1b91ad,_0x40b7a5){rimraf(_0x52798d,function(_0x28e998){if(_0x28e998)_0x40b7a5(_0x28e998);return _0x1b91ad();});});})[_0x47a5('0x26')](function(){return _0x40aee5[_0x47a5('0xe1')](_0x579e5c,_0x1a5e07,function(_0x3f7fdc){if(_0x3f7fdc){console[_0x47a5('0xe2')](_0x47a5('0xe3'),_0x3f7fdc);}else{fs[_0x47a5('0xe4')](_0x579e5c);}});});});}else{return _0x40aee5[_0x47a5('0x1a')](0xc8);}})[_0x47a5('0x32')](handleError(_0x40aee5,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index a5e085c..3716484 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 _0x1ea1=['findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','WhatsappInteraction','WhatsappMessage','getUsers','setDataValue','Users','map'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x1ea1,0x1c9));var _0x11ea=function(_0x1a64f7,_0x164602){_0x1a64f7=_0x1a64f7-0x0;var _0x575dc2=_0x1ea1[_0x1a64f7];return _0x575dc2;};'use strict';var EventEmitter=require(_0x11ea('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x11ea('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0x11ea('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1d0070){return function(_0x5924ed,_0x5f4b7f,_0x1cd112){_0x5924ed[_0x11ea('0x3')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4ee37f){_0x5924ed[_0x11ea('0x4')](_0x11ea('0x5'),_0x4ee37f[_0x11ea('0x6')](function(_0x50e224){return{'id':_0x50e224['id']};}));return WhatsappMessage[_0x11ea('0x7')]({'where':{'WhatsappInteractionId':_0x5924ed['id'],'direction':'in','read':![]},'raw':!![]});})[_0x11ea('0x8')](function(_0x1686d7){_0x5924ed[_0x11ea('0x4')](_0x11ea('0x9'),_0x1686d7[_0x11ea('0xa')]);WhatsappInteractionEvents['emit'](_0x1d0070+':'+_0x5924ed['id'],_0x5924ed);WhatsappInteractionEvents[_0x11ea('0xb')](_0x1d0070,_0x5924ed);_0x1cd112(null);})[_0x11ea('0xc')](_0x1cd112(null));};}for(var e in events){if(events[_0x11ea('0xd')](e)){var event=events[e];WhatsappInteraction[_0x11ea('0xe')](e,emitEvent(event));}}module[_0x11ea('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xc6de=['update','remove','getUsers','then','setDataValue','map','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0xc6de,0x193));var _0xec6d=function(_0x4cefbc,_0x3ffa6c){_0x4cefbc=_0x4cefbc-0x0;var _0x423c86=_0xc6de[_0x4cefbc];return _0x423c86;};'use strict';var EventEmitter=require(_0xec6d('0x0'));var WhatsappInteraction=require(_0xec6d('0x1'))['db'][_0xec6d('0x2')];var WhatsappMessage=require(_0xec6d('0x1'))['db'][_0xec6d('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xec6d('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xec6d('0x5'),'afterDestroy':_0xec6d('0x6')};function emitEvent(_0x1226e0){return function(_0x46624e,_0x6ae13b,_0x3bb1ac){_0x46624e[_0xec6d('0x7')]({'attributes':['id'],'raw':!![]})[_0xec6d('0x8')](function(_0x39bf51){_0x46624e[_0xec6d('0x9')]('Users',_0x39bf51[_0xec6d('0xa')](function(_0x15bcff){return{'id':_0x15bcff['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x46624e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xec6d('0x8')](function(_0x437391){_0x46624e[_0xec6d('0x9')]('unreadMessages',_0x437391[_0xec6d('0xb')]);WhatsappInteractionEvents[_0xec6d('0xc')](_0x1226e0+':'+_0x46624e['id'],_0x46624e);WhatsappInteractionEvents[_0xec6d('0xc')](_0x1226e0,_0x46624e);_0x3bb1ac(null);})[_0xec6d('0xd')](_0x3bb1ac(null));};}for(var e in events){if(events[_0xec6d('0xe')](e)){var event=events[e];WhatsappInteraction[_0xec6d('0xf')](e,emitEvent(event));}}module[_0xec6d('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 44743f7..ca725cf 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 _0x0c90=['format','YYYY-MM-DD\x20HH:mm:ss','api','moment','bluebird','request-promise','rimraf','./whatsappInteraction.attributes','define','whatsapp_interactions','changed','closed'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x0c90,0x1a6));var _0x00c9=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0c90[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x00c9('0x0'));var moment=require(_0x00c9('0x1'));var BPromise=require(_0x00c9('0x2'));var rp=require(_0x00c9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00c9('0x4'));var config=require('../../config/environment');var attributes=require(_0x00c9('0x5'));module['exports']=function(_0x5c59f2,_0x31ca37){return _0x5c59f2[_0x00c9('0x6')]('WhatsappInteraction',attributes,{'tableName':_0x00c9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15845d,_0x1310e1,_0x446bf1){if(_0x15845d[_0x00c9('0x8')](_0x00c9('0x9'))){_0x15845d['closedAt']=moment()[_0x00c9('0xa')](_0x00c9('0xb'));}_0x446bf1(null,_0x15845d);}}});}; \ No newline at end of file +var _0x3e53=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x16cc91,_0x4a8a1c){var _0x2eac3a=function(_0x36bd15){while(--_0x36bd15){_0x16cc91['push'](_0x16cc91['shift']());}};_0x2eac3a(++_0x4a8a1c);}(_0x3e53,0x1ba));var _0x33e5=function(_0xef3206,_0x41be3c){_0xef3206=_0xef3206-0x0;var _0x120919=_0x3e53[_0xef3206];return _0x120919;};'use strict';var _=require('lodash');var util=require(_0x33e5('0x0'));var logger=require(_0x33e5('0x1'))('api');var moment=require(_0x33e5('0x2'));var BPromise=require(_0x33e5('0x3'));var rp=require(_0x33e5('0x4'));var fs=require('fs');var path=require(_0x33e5('0x5'));var rimraf=require(_0x33e5('0x6'));var config=require('../../config/environment');var attributes=require(_0x33e5('0x7'));module[_0x33e5('0x8')]=function(_0x91a0ce,_0x1290e3){return _0x91a0ce['define'](_0x33e5('0x9'),attributes,{'tableName':_0x33e5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2688e2,_0x1c7b76,_0x2600e3){if(_0x2688e2['changed']('closed')){_0x2688e2[_0x33e5('0xb')]=moment()['format'](_0x33e5('0xc'));}_0x2600e3(null,_0x2688e2);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index ee1bb9d..3a301cb 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 _0xeae4=['WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','UpdateWhatsappInteraction','body','options','raw','where','attributes','limit','WhatsappInteraction','find','addTags','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then'];(function(_0x4082d7,_0x963f0c){var _0x5a96d7=function(_0x3ef84a){while(--_0x3ef84a){_0x4082d7['push'](_0x4082d7['shift']());}};_0x5a96d7(++_0x963f0c);}(_0xeae4,0xdf));var _0x4eae=function(_0x22fb1b,_0x390eb4){_0x22fb1b=_0x22fb1b-0x0;var _0x271025=_0xeae4[_0x22fb1b];return _0x271025;};'use strict';var _=require('lodash');var util=require(_0x4eae('0x0'));var moment=require(_0x4eae('0x1'));var BPromise=require(_0x4eae('0x2'));var rs=require(_0x4eae('0x3'));var fs=require('fs');var Redis=require(_0x4eae('0x4'));var db=require(_0x4eae('0x5'))['db'];var utils=require(_0x4eae('0x6'));var logger=require('../../config/logger')(_0x4eae('0x7'));var config=require('../../config/environment');var jayson=require(_0x4eae('0x8'));var client=jayson['client'][_0x4eae('0x9')]({'port':0x232a});config['redis']=_[_0x4eae('0xa')](config[_0x4eae('0xb')],{'host':_0x4eae('0xc'),'port':0x18eb});var socket=require(_0x4eae('0xd'))(new Redis(config[_0x4eae('0xb')]));require(_0x4eae('0xe'))['register'](socket);function respondWithRpcPromise(_0x176ee7,_0x502889,_0x4801dc){return new BPromise(function(_0x562e79,_0x38ce60){return client[_0x4eae('0xf')](_0x176ee7,_0x4801dc)[_0x4eae('0x10')](function(_0xd03321){logger['info'](_0x4eae('0x11'),_0x502889,'request\x20sent');logger[_0x4eae('0x12')](_0x4eae('0x13'),_0x502889,_0x4eae('0x14'),JSON[_0x4eae('0x15')](_0xd03321));if(_0xd03321[_0x4eae('0x16')]){if(_0xd03321[_0x4eae('0x16')][_0x4eae('0x17')]===0x1f4){logger[_0x4eae('0x16')](_0x4eae('0x11'),_0x502889,_0xd03321[_0x4eae('0x16')][_0x4eae('0x18')]);return _0x38ce60(_0xd03321['error'][_0x4eae('0x18')]);}logger[_0x4eae('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x502889,_0xd03321[_0x4eae('0x16')][_0x4eae('0x18')]);return _0x562e79(_0xd03321[_0x4eae('0x16')][_0x4eae('0x18')]);}else{logger[_0x4eae('0x19')]('WhatsappInteraction,\x20%s,\x20%s',_0x502889,_0x4eae('0x14'));_0x562e79(_0xd03321['result'][_0x4eae('0x18')]);}})[_0x4eae('0x1a')](function(_0x291b02){logger[_0x4eae('0x16')](_0x4eae('0x11'),_0x502889,_0x291b02);_0x38ce60(_0x291b02);});});}exports[_0x4eae('0x1b')]=function(_0x42e88f){var _0x4c909e=this;return new Promise(function(_0x2ab962,_0xf9378){return db['WhatsappInteraction']['update'](_0x42e88f[_0x4eae('0x1c')],{'raw':_0x42e88f[_0x4eae('0x1d')]?_0x42e88f['options'][_0x4eae('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42e88f[_0x4eae('0x1d')]?_0x42e88f['options'][_0x4eae('0x1f')]||null:null,'attributes':_0x42e88f['options']?_0x42e88f['options'][_0x4eae('0x20')]||null:null,'limit':_0x42e88f[_0x4eae('0x1d')]?_0x42e88f[_0x4eae('0x1d')][_0x4eae('0x21')]||null:null})[_0x4eae('0x10')](function(_0x3f6c2d){logger[_0x4eae('0x19')](_0x4eae('0x1b'),_0x42e88f);logger['debug']('UpdateWhatsappInteraction',_0x42e88f,JSON['stringify'](_0x3f6c2d));_0x2ab962(_0x3f6c2d);})[_0x4eae('0x1a')](function(_0x5466f2){logger[_0x4eae('0x16')](_0x4eae('0x1b'),_0x5466f2[_0x4eae('0x18')],_0x42e88f);_0xf9378(_0x4c909e[_0x4eae('0x16')](0x1f4,_0x5466f2[_0x4eae('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x39bfd6){return new Promise(function(_0x525385,_0x55652d){return db[_0x4eae('0x22')][_0x4eae('0x23')]({'where':_0x39bfd6[_0x4eae('0x1d')]?_0x39bfd6[_0x4eae('0x1d')][_0x4eae('0x1f')]||null:null})[_0x4eae('0x10')](function(_0x4aeb68){if(_0x4aeb68){return _0x4aeb68[_0x4eae('0x24')](_0x39bfd6[_0x4eae('0x1c')]['ids'],_[_0x4eae('0x25')](_0x39bfd6[_0x4eae('0x1c')],['ids','id'])||{});}})[_0x4eae('0x26')](function(_0x599ed7){logger[_0x4eae('0x19')]('AddTags',_0x39bfd6);logger[_0x4eae('0x12')](_0x4eae('0x27'),_0x39bfd6,JSON[_0x4eae('0x15')](_0x599ed7));_0x525385(_0x599ed7);})['catch'](function(_0x4473f6){logger[_0x4eae('0x16')](_0x4eae('0x27'),_0x4473f6[_0x4eae('0x18')],_0x39bfd6);_0x55652d(_this[_0x4eae('0x16')](0x1f4,_0x4473f6[_0x4eae('0x18')]));});});}; \ No newline at end of file +var _0x2eb7=['attributes','limit','UpdateWhatsappInteraction','stringify','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','WhatsappInteraction','body','raw','options','where'];(function(_0x2cc307,_0x326ef9){var _0x2bf803=function(_0x414ede){while(--_0x414ede){_0x2cc307['push'](_0x2cc307['shift']());}};_0x2bf803(++_0x326ef9);}(_0x2eb7,0x1e3));var _0x72eb=function(_0x3bbb32,_0x455ab1){_0x3bbb32=_0x3bbb32-0x0;var _0x268666=_0x2eb7[_0x3bbb32];return _0x268666;};'use strict';var _=require('lodash');var util=require(_0x72eb('0x0'));var moment=require(_0x72eb('0x1'));var BPromise=require(_0x72eb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72eb('0x3'));var db=require(_0x72eb('0x4'))['db'];var utils=require(_0x72eb('0x5'));var logger=require(_0x72eb('0x6'))('rpc');var config=require(_0x72eb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x72eb('0x8')][_0x72eb('0x9')]({'port':0x232a});config['redis']=_[_0x72eb('0xa')](config[_0x72eb('0xb')],{'host':_0x72eb('0xc'),'port':0x18eb});var socket=require(_0x72eb('0xd'))(new Redis(config['redis']));require(_0x72eb('0xe'))[_0x72eb('0xf')](socket);function respondWithRpcPromise(_0x24a18b,_0x471c98,_0xa3dbd3){return new BPromise(function(_0x2a46d7,_0x3a0e62){return client[_0x72eb('0x10')](_0x24a18b,_0xa3dbd3)[_0x72eb('0x11')](function(_0x214d76){logger[_0x72eb('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x471c98,_0x72eb('0x13'));logger[_0x72eb('0x14')](_0x72eb('0x15'),_0x471c98,_0x72eb('0x13'),JSON['stringify'](_0x214d76));if(_0x214d76[_0x72eb('0x16')]){if(_0x214d76[_0x72eb('0x16')][_0x72eb('0x17')]===0x1f4){logger[_0x72eb('0x16')](_0x72eb('0x18'),_0x471c98,_0x214d76[_0x72eb('0x16')][_0x72eb('0x19')]);return _0x3a0e62(_0x214d76[_0x72eb('0x16')][_0x72eb('0x19')]);}logger[_0x72eb('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x471c98,_0x214d76[_0x72eb('0x16')][_0x72eb('0x19')]);return _0x2a46d7(_0x214d76[_0x72eb('0x16')][_0x72eb('0x19')]);}else{logger[_0x72eb('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x471c98,_0x72eb('0x13'));_0x2a46d7(_0x214d76[_0x72eb('0x1a')][_0x72eb('0x19')]);}})[_0x72eb('0x1b')](function(_0x476c50){logger[_0x72eb('0x16')](_0x72eb('0x18'),_0x471c98,_0x476c50);_0x3a0e62(_0x476c50);});});}exports['UpdateWhatsappInteraction']=function(_0x4724da){var _0x76eb00=this;return new Promise(function(_0x507ea7,_0x411b71){return db[_0x72eb('0x1c')]['update'](_0x4724da[_0x72eb('0x1d')],{'raw':_0x4724da['options']?_0x4724da['options'][_0x72eb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4724da[_0x72eb('0x1f')]?_0x4724da[_0x72eb('0x1f')][_0x72eb('0x20')]||null:null,'attributes':_0x4724da['options']?_0x4724da[_0x72eb('0x1f')][_0x72eb('0x21')]||null:null,'limit':_0x4724da['options']?_0x4724da[_0x72eb('0x1f')][_0x72eb('0x22')]||null:null})[_0x72eb('0x11')](function(_0x1a87b2){logger[_0x72eb('0x12')](_0x72eb('0x23'),_0x4724da);logger[_0x72eb('0x14')](_0x72eb('0x23'),_0x4724da,JSON[_0x72eb('0x24')](_0x1a87b2));_0x507ea7(_0x1a87b2);})[_0x72eb('0x1b')](function(_0xe6ea6e){logger['error'](_0x72eb('0x23'),_0xe6ea6e['message'],_0x4724da);_0x411b71(_0x76eb00[_0x72eb('0x16')](0x1f4,_0xe6ea6e[_0x72eb('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x502007){return new Promise(function(_0x296f70,_0x5df75a){return db['WhatsappInteraction'][_0x72eb('0x25')]({'where':_0x502007[_0x72eb('0x1f')]?_0x502007[_0x72eb('0x1f')][_0x72eb('0x20')]||null:null})[_0x72eb('0x11')](function(_0x42be2a){if(_0x42be2a){return _0x42be2a[_0x72eb('0x26')](_0x502007[_0x72eb('0x1d')][_0x72eb('0x27')],_[_0x72eb('0x28')](_0x502007['body'],[_0x72eb('0x27'),'id'])||{});}})[_0x72eb('0x29')](function(_0x2e07ba){logger[_0x72eb('0x12')](_0x72eb('0x2a'),_0x502007);logger[_0x72eb('0x14')](_0x72eb('0x2a'),_0x502007,JSON[_0x72eb('0x24')](_0x2e07ba));_0x296f70(_0x2e07ba);})['catch'](function(_0x450cdb){logger[_0x72eb('0x16')](_0x72eb('0x2a'),_0x450cdb[_0x72eb('0x19')],_0x502007);_0x5df75a(_this[_0x72eb('0x16')](0x1f4,_0x450cdb[_0x72eb('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 1b6b8ee..190e242 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 _0x83f6=['removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit'];(function(_0x4dd566,_0xb70f5a){var _0x57a60f=function(_0x513669){while(--_0x513669){_0x4dd566['push'](_0x4dd566['shift']());}};_0x57a60f(++_0xb70f5a);}(_0x83f6,0x1cf));var _0x683f=function(_0x5ad771,_0x34186f){_0x5ad771=_0x5ad771-0x0;var _0x5b5dce=_0x83f6[_0x5ad771];return _0x5b5dce;};'use strict';var WhatsappInteractionEvents=require(_0x683f('0x0'));var events=[_0x683f('0x1'),_0x683f('0x2'),_0x683f('0x3')];function createListener(_0x16a2cb,_0x49650e){return function(_0x5d8ffc){_0x49650e[_0x683f('0x4')](_0x16a2cb,_0x5d8ffc);};}function removeListener(_0x43a1c8,_0x4c2d49){return function(){WhatsappInteractionEvents[_0x683f('0x5')](_0x43a1c8,_0x4c2d49);};}exports[_0x683f('0x6')]=function(_0x25a9cf){for(var _0x121a12=0x0,_0x543b82=events[_0x683f('0x7')];_0x121a12<_0x543b82;_0x121a12++){var _0x3bb466=events[_0x121a12];var _0x1f184e=createListener(_0x683f('0x8')+_0x3bb466,_0x25a9cf);WhatsappInteractionEvents['on'](_0x3bb466,_0x1f184e);}}; \ No newline at end of file +var _0x11b1=['remove','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x11b1,0x157));var _0x111b=function(_0x1932c3,_0x3d6ffe){_0x1932c3=_0x1932c3-0x0;var _0x2edb23=_0x11b1[_0x1932c3];return _0x2edb23;};'use strict';var WhatsappInteractionEvents=require(_0x111b('0x0'));var events=[_0x111b('0x1'),_0x111b('0x2'),'update'];function createListener(_0x2af03f,_0x3a8a7b){return function(_0x4db5f6){_0x3a8a7b['emit'](_0x2af03f,_0x4db5f6);};}function removeListener(_0x4a8be8,_0xdb54de){return function(){WhatsappInteractionEvents['removeListener'](_0x4a8be8,_0xdb54de);};}exports['register']=function(_0x1d4288){for(var _0x3ba83d=0x0,_0x27409e=events[_0x111b('0x3')];_0x3ba83d<_0x27409e;_0x3ba83d++){var _0x5cf73f=events[_0x3ba83d];var _0x53c7f7=createListener(_0x111b('0x4')+_0x5cf73f,_0x1d4288);WhatsappInteractionEvents['on'](_0x5cf73f,_0x53c7f7);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index da26465..4c0cf18 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 _0x13ee=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','whatsapp','create','/:id/status','status','put','update','accept','reject','delete','destroy','exports','multer','util'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0x13ee,0x178));var _0xe13e=function(_0x2b81be,_0x544bdf){_0x2b81be=_0x2b81be-0x0;var _0x8ed4a7=_0x13ee[_0x2b81be];return _0x8ed4a7;};'use strict';var multer=require(_0xe13e('0x0'));var util=require(_0xe13e('0x1'));var path=require('path');var timeout=require(_0xe13e('0x2'));var express=require(_0xe13e('0x3'));var router=express[_0xe13e('0x4')]();var auth=require(_0xe13e('0x5'));var interaction=require(_0xe13e('0x6'));var config=require(_0xe13e('0x7'));var controller=require('./whatsappMessage.controller');router[_0xe13e('0x8')]('/',auth[_0xe13e('0x9')](),controller['index']);router[_0xe13e('0x8')](_0xe13e('0xa'),auth[_0xe13e('0x9')](),controller[_0xe13e('0xb')]);router[_0xe13e('0x8')](_0xe13e('0xc'),auth[_0xe13e('0x9')](),controller[_0xe13e('0xd')]);router[_0xe13e('0xe')]('/',auth['isAuthenticated'](),interaction[_0xe13e('0xf')](_0xe13e('0x10'),'whatsappmessage:create'),controller[_0xe13e('0x11')]);router[_0xe13e('0xe')](_0xe13e('0x12'),controller[_0xe13e('0x13')]);router[_0xe13e('0x14')](_0xe13e('0xc'),auth[_0xe13e('0x9')](),controller[_0xe13e('0x15')]);router['put']('/:id/accept',auth[_0xe13e('0x9')](),controller[_0xe13e('0x16')]);router[_0xe13e('0x14')]('/:id/reject',auth[_0xe13e('0x9')](),controller[_0xe13e('0x17')]);router[_0xe13e('0x18')](_0xe13e('0xc'),auth[_0xe13e('0x9')](),controller[_0xe13e('0x19')]);module[_0xe13e('0x1a')]=router; \ No newline at end of file +var _0x2294=['../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','status','put','update','accept','/:id/reject','reject','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x5a94ad,_0x5e7b23){var _0x1205c3=function(_0x272f33){while(--_0x272f33){_0x5a94ad['push'](_0x5a94ad['shift']());}};_0x1205c3(++_0x5e7b23);}(_0x2294,0x161));var _0x4229=function(_0x4c5787,_0x3ca1e0){_0x4c5787=_0x4c5787-0x0;var _0x1c0b72=_0x2294[_0x4c5787];return _0x1c0b72;};'use strict';var multer=require(_0x4229('0x0'));var util=require(_0x4229('0x1'));var path=require(_0x4229('0x2'));var timeout=require(_0x4229('0x3'));var express=require(_0x4229('0x4'));var router=express[_0x4229('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4229('0x6'));var config=require(_0x4229('0x7'));var controller=require(_0x4229('0x8'));router[_0x4229('0x9')]('/',auth[_0x4229('0xa')](),controller[_0x4229('0xb')]);router['get'](_0x4229('0xc'),auth[_0x4229('0xa')](),controller[_0x4229('0xd')]);router['get']('/:id',auth[_0x4229('0xa')](),controller['show']);router['post']('/',auth[_0x4229('0xa')](),interaction[_0x4229('0xe')](_0x4229('0xf'),_0x4229('0x10')),controller[_0x4229('0x11')]);router[_0x4229('0x12')](_0x4229('0x13'),controller[_0x4229('0x14')]);router[_0x4229('0x15')]('/:id',auth[_0x4229('0xa')](),controller[_0x4229('0x16')]);router[_0x4229('0x15')]('/:id/accept',auth[_0x4229('0xa')](),controller[_0x4229('0x17')]);router['put'](_0x4229('0x18'),auth[_0x4229('0xa')](),controller[_0x4229('0x19')]);router[_0x4229('0x1a')](_0x4229('0x1b'),auth[_0x4229('0xa')](),controller[_0x4229('0x1c')]);module[_0x4229('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 2ed505d..c98b29a 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 _0x6b0e=['BOOLEAN','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b0e,0x185));var _0xe6b0=function(_0x1feece,_0x356416){_0x1feece=_0x1feece-0x0;var _0x31ca97=_0x6b0e[_0x1feece];return _0x31ca97;};'use strict';var Sequelize=require(_0xe6b0('0x0'));module[_0xe6b0('0x1')]={'body':{'type':Sequelize[_0xe6b0('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe6b0('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe6b0('0x4')),'defaultValue':_0xe6b0('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xe6b0('0x5')]},'readAt':{'type':Sequelize[_0xe6b0('0x6')]},'secret':{'type':Sequelize[_0xe6b0('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc540=['out','STRING','BOOLEAN','medium','ENUM'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc540,0x184));var _0x0c54=function(_0x2bb3d6,_0x560ab7){_0x2bb3d6=_0x2bb3d6-0x0;var _0xc80e9f=_0xc540[_0x2bb3d6];return _0xc80e9f;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x0c54('0x0')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0c54('0x1')]('in',_0x0c54('0x2')),'defaultValue':_0x0c54('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0c54('0x3')](0xbe)},'phone':{'type':Sequelize[_0x0c54('0x3')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x0c54('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 1f8ca2a..0ee3eb7 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 _0xe7e9=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','jayson/promise','client','http','Sequelize','ValidationError','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','acceptMessage','manual','interface','format','SIP/%s','channel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','lodash'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe7e9,0x7a));var _0x9e7e=function(_0x4fd767,_0x25cdca){_0x4fd767=_0x4fd767-0x0;var _0x48e469=_0xe7e9[_0x4fd767];return _0x48e469;};'use strict';var pdf=require(_0x9e7e('0x0'));var emlformat=require(_0x9e7e('0x1'));var rimraf=require(_0x9e7e('0x2'));var zipdir=require(_0x9e7e('0x3'));var jsonpatch=require(_0x9e7e('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9e7e('0x5'));var Mustache=require(_0x9e7e('0x6'));var util=require('util');var path=require(_0x9e7e('0x7'));var sox=require(_0x9e7e('0x8'));var csv=require(_0x9e7e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9e7e('0xa'));var squel=require('squel');var crypto=require(_0x9e7e('0xb'));var jsforce=require(_0x9e7e('0xc'));var deskjs=require(_0x9e7e('0xd'));var toCsv=require(_0x9e7e('0x9'));var querystring=require(_0x9e7e('0xe'));var Papa=require(_0x9e7e('0xf'));var Redis=require(_0x9e7e('0x10'));var authService=require(_0x9e7e('0x11'));var qs=require(_0x9e7e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e7e('0x13'));var logger=require(_0x9e7e('0x14'))(_0x9e7e('0x15'));var utils=require(_0x9e7e('0x16'));var config=require(_0x9e7e('0x17'));var db=require(_0x9e7e('0x18'))['db'];config[_0x9e7e('0x19')]=_[_0x9e7e('0x1a')](config[_0x9e7e('0x19')],{'host':_0x9e7e('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9e7e('0x1c'))['register'](socket);var jayson=require(_0x9e7e('0x1d'));var client=jayson[_0x9e7e('0x1e')][_0x9e7e('0x1f')]({'port':0x232c});var client9002=jayson[_0x9e7e('0x1e')][_0x9e7e('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x1c8383,_0x5ef0db,_0x36b0d1){if(_0x36b0d1){var _0x53ff09=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x53ff09['test'](_0x5ef0db)){return _0x1c8383;}else{throw new db[(_0x9e7e('0x20'))][(_0x9e7e('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1c8383;}}function respondWithRpcPromise(_0x32922b,_0x3b6c20,_0x5cd742,_0x4fd8b9){return new BPromise(function(_0x23e9a7,_0x420d9e){var _0x3185a4=_0x4fd8b9||client;return _0x3185a4['request'](_0x32922b,_0x5cd742)['then'](function(_0x123da3){logger[_0x9e7e('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x3b6c20,_0x9e7e('0x23'));logger[_0x9e7e('0x24')](_0x9e7e('0x25'),_0x3b6c20,_0x9e7e('0x23'),JSON['stringify'](_0x123da3));if(_0x123da3[_0x9e7e('0x26')]){if(_0x123da3[_0x9e7e('0x26')][_0x9e7e('0x27')]===0x1f4){logger['error'](_0x9e7e('0x28'),_0x3b6c20,_0x123da3[_0x9e7e('0x26')][_0x9e7e('0x29')]);return _0x420d9e(_0x123da3[_0x9e7e('0x26')][_0x9e7e('0x29')]);}logger[_0x9e7e('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x3b6c20,_0x123da3[_0x9e7e('0x26')][_0x9e7e('0x29')]);return _0x23e9a7(_0x123da3['error']['message']);}else{logger['info'](_0x9e7e('0x28'),_0x3b6c20,'request\x20sent');_0x23e9a7(_0x123da3[_0x9e7e('0x2a')][_0x9e7e('0x29')]);}})[_0x9e7e('0x2b')](function(_0x55ee56){logger[_0x9e7e('0x26')](_0x9e7e('0x28'),_0x3b6c20,_0x55ee56);_0x420d9e(_0x55ee56);});});}function respondWithStatusCode(_0x5b1293,_0x9e47d){_0x9e47d=_0x9e47d||0xcc;return function(_0x9f681c){if(_0x9f681c){return _0x5b1293[_0x9e7e('0x2c')](_0x9e47d);}return _0x5b1293['status'](_0x9e47d)[_0x9e7e('0x2d')]();};}function respondWithResult(_0x189e8d,_0x59d113){_0x59d113=_0x59d113||0xc8;return function(_0x4cdf2e){if(_0x4cdf2e){return _0x189e8d[_0x9e7e('0x2e')](_0x59d113)['json'](_0x4cdf2e);}};}function respondWithFilteredResult(_0x5a8d95,_0x3ab5d5){return function(_0x4b924c){if(_0x4b924c){var _0x38f030=_0x4b924c[_0x9e7e('0x2f')],_0x1ed508=_0x3ab5d5[_0x9e7e('0x30')],_0x5451e7=_0x3ab5d5[_0x9e7e('0x30')]+_0x3ab5d5[_0x9e7e('0x31')],_0x28b019;if(_0x5451e7>=_0x38f030){_0x5451e7=_0x38f030;_0x28b019=0xc8;}else{_0x28b019=0xce;}_0x5a8d95[_0x9e7e('0x2e')](_0x28b019);return _0x5a8d95[_0x9e7e('0x32')](_0x9e7e('0x33'),_0x1ed508+'-'+_0x5451e7+'/'+_0x38f030)['json'](_0x4b924c);}return null;};}function patchUpdates(_0x3635e1){return function(_0x2a39a3){try{jsonpatch['apply'](_0x2a39a3,_0x3635e1,!![]);}catch(_0x2bb3db){return BPromise[_0x9e7e('0x34')](_0x2bb3db);}return _0x2a39a3[_0x9e7e('0x35')]();};}function saveUpdates(_0x1592f4,_0x1439de){return function(_0x54ac54){if(_0x54ac54){return _0x54ac54[_0x9e7e('0x36')](_0x1592f4)[_0x9e7e('0x37')](function(_0x1b3b05){return _0x1b3b05;});}return null;};}function removeEntity(_0x3de943,_0xfe340f){return function(_0x166227){if(_0x166227){return _0x166227[_0x9e7e('0x38')]()['then'](function(){_0x3de943[_0x9e7e('0x2e')](0xcc)[_0x9e7e('0x2d')]();});}};}function handleEntityNotFound(_0x14cb5a,_0x38bccc){return function(_0x2e8d73){if(!_0x2e8d73){_0x14cb5a['sendStatus'](0x194);}return _0x2e8d73;};}function handleError(_0x22d793,_0xaeea7f){_0xaeea7f=_0xaeea7f||0x1f4;return function(_0x546280){logger[_0x9e7e('0x26')](_0x546280['stack']);if(_0x546280[_0x9e7e('0x39')]){delete _0x546280['name'];}_0x22d793[_0x9e7e('0x2e')](_0xaeea7f)[_0x9e7e('0x3a')](_0x546280);};}exports[_0x9e7e('0x3b')]=function(_0x4f4e0f,_0x1ce853){var _0x59593e={},_0x666b37={},_0x5842b8={'count':0x0,'rows':[]};var _0x211a04=_[_0x9e7e('0x3c')](db[_0x9e7e('0x3d')][_0x9e7e('0x3e')],function(_0x2cc8d3){return{'name':_0x2cc8d3[_0x9e7e('0x3f')],'type':_0x2cc8d3[_0x9e7e('0x40')][_0x9e7e('0x41')]};});_0x666b37[_0x9e7e('0x42')]=_[_0x9e7e('0x3c')](_0x211a04,_0x9e7e('0x39'));_0x666b37[_0x9e7e('0x43')]=_[_0x9e7e('0x44')](_0x4f4e0f['query']);_0x666b37['filters']=_[_0x9e7e('0x45')](_0x666b37[_0x9e7e('0x42')],_0x666b37[_0x9e7e('0x43')]);_0x59593e[_0x9e7e('0x46')]=_[_0x9e7e('0x45')](_0x666b37['model'],qs[_0x9e7e('0x47')](_0x4f4e0f[_0x9e7e('0x43')][_0x9e7e('0x47')]));_0x59593e[_0x9e7e('0x46')]=_0x59593e[_0x9e7e('0x46')][_0x9e7e('0x48')]?_0x59593e['attributes']:_0x666b37[_0x9e7e('0x42')];if(!_0x4f4e0f[_0x9e7e('0x43')][_0x9e7e('0x49')](_0x9e7e('0x4a'))){_0x59593e[_0x9e7e('0x31')]=qs[_0x9e7e('0x31')](_0x4f4e0f[_0x9e7e('0x43')][_0x9e7e('0x31')]);_0x59593e['offset']=qs[_0x9e7e('0x30')](_0x4f4e0f[_0x9e7e('0x43')][_0x9e7e('0x30')]);}_0x59593e[_0x9e7e('0x4b')]=qs[_0x9e7e('0x4c')](_0x4f4e0f['query']['sort']);_0x59593e[_0x9e7e('0x4d')]=qs[_0x9e7e('0x4e')](_['pick'](_0x4f4e0f[_0x9e7e('0x43')],_0x666b37['filters']),_0x211a04);if(_0x4f4e0f[_0x9e7e('0x43')][_0x9e7e('0x4f')]){_0x59593e[_0x9e7e('0x4d')]=_[_0x9e7e('0x50')](_0x59593e[_0x9e7e('0x4d')],{'$or':_[_0x9e7e('0x3c')](_0x211a04,function(_0x4240a4){if(_0x4240a4[_0x9e7e('0x40')]!==_0x9e7e('0x51')){var _0x40a1e3={};_0x40a1e3[_0x4240a4[_0x9e7e('0x39')]]={'$like':'%'+_0x4f4e0f['query'][_0x9e7e('0x4f')]+'%'};return _0x40a1e3;}})});}_0x59593e=_[_0x9e7e('0x50')]({},_0x59593e,_0x4f4e0f[_0x9e7e('0x52')]);var _0xad3d6c={'where':_0x59593e['where']};return db[_0x9e7e('0x3d')]['count'](_0xad3d6c)[_0x9e7e('0x37')](function(_0x4fbced){_0x5842b8['count']=_0x4fbced;if(_0x4f4e0f[_0x9e7e('0x43')][_0x9e7e('0x53')]){_0x59593e[_0x9e7e('0x54')]=[{'all':!![]}];}return db[_0x9e7e('0x3d')][_0x9e7e('0x55')](_0x59593e);})[_0x9e7e('0x37')](function(_0x1ef8f1){_0x5842b8['rows']=_0x1ef8f1;return _0x5842b8;})[_0x9e7e('0x37')](respondWithFilteredResult(_0x1ce853,_0x59593e))[_0x9e7e('0x2b')](handleError(_0x1ce853,null));};exports[_0x9e7e('0x56')]=function(_0x262952,_0x3242ac){var _0x527da7={'raw':!![],'where':{'id':_0x262952[_0x9e7e('0x57')]['id']}},_0x5f153b={};_0x5f153b[_0x9e7e('0x42')]=_[_0x9e7e('0x44')](db[_0x9e7e('0x3d')][_0x9e7e('0x3e')]);_0x5f153b['query']=_[_0x9e7e('0x44')](_0x262952['query']);_0x5f153b['filters']=_[_0x9e7e('0x45')](_0x5f153b[_0x9e7e('0x42')],_0x5f153b[_0x9e7e('0x43')]);_0x527da7[_0x9e7e('0x46')]=_[_0x9e7e('0x45')](_0x5f153b[_0x9e7e('0x42')],qs[_0x9e7e('0x47')](_0x262952[_0x9e7e('0x43')][_0x9e7e('0x47')]));_0x527da7[_0x9e7e('0x46')]=_0x527da7[_0x9e7e('0x46')][_0x9e7e('0x48')]?_0x527da7['attributes']:_0x5f153b[_0x9e7e('0x42')];if(_0x262952['query']['includeAll']){_0x527da7['include']=[{'all':!![]}];}_0x527da7=_[_0x9e7e('0x50')]({},_0x527da7,_0x262952[_0x9e7e('0x52')]);return db[_0x9e7e('0x3d')][_0x9e7e('0x58')](_0x527da7)[_0x9e7e('0x37')](handleEntityNotFound(_0x3242ac,null))['then'](respondWithResult(_0x3242ac,null))[_0x9e7e('0x2b')](handleError(_0x3242ac,null));};exports['create']=function(_0x2983b8,_0x1c1456){return db[_0x9e7e('0x3d')][_0x9e7e('0x59')](_0x2983b8[_0x9e7e('0x5a')],{})[_0x9e7e('0x37')](respondWithResult(_0x1c1456,0xc9))[_0x9e7e('0x2b')](handleError(_0x1c1456,null));};exports[_0x9e7e('0x36')]=function(_0x45b27a,_0x417820){if(_0x45b27a[_0x9e7e('0x5a')]['id']){delete _0x45b27a['body']['id'];}return db['WhatsappMessage'][_0x9e7e('0x58')]({'where':{'id':_0x45b27a['params']['id']}})['then'](handleEntityNotFound(_0x417820,null))[_0x9e7e('0x37')](saveUpdates(_0x45b27a['body'],null))[_0x9e7e('0x37')](respondWithResult(_0x417820,null))[_0x9e7e('0x2b')](handleError(_0x417820,null));};exports[_0x9e7e('0x38')]=function(_0x329e76,_0x5da3f3){return db[_0x9e7e('0x3d')][_0x9e7e('0x58')]({'where':{'id':_0x329e76[_0x9e7e('0x57')]['id']}})[_0x9e7e('0x37')](handleEntityNotFound(_0x5da3f3,null))[_0x9e7e('0x37')](removeEntity(_0x5da3f3,null))[_0x9e7e('0x2b')](handleError(_0x5da3f3,null));};exports['describe']=function(_0x569f9f,_0x2133b3){return db[_0x9e7e('0x3d')][_0x9e7e('0x5b')]()['then'](respondWithResult(_0x2133b3,null))[_0x9e7e('0x2b')](handleError(_0x2133b3,null));};var interaction_log=require('../../config/logger')(_0x9e7e('0x5c'));exports[_0x9e7e('0x5d')]=function(_0x3ae3a3,_0x2bf543,_0x3094f6){var _0x1000c0={'channel':_0x9e7e('0x5e')};if(_0x3ae3a3[_0x9e7e('0x5a')]['id']){delete _0x3ae3a3[_0x9e7e('0x5a')]['id'];}_0x3ae3a3[_0x9e7e('0x5a')][_0x9e7e('0x5f')]=!![];_0x3ae3a3['body'][_0x9e7e('0x60')]=moment()['format'](_0x9e7e('0x61'));_0x3ae3a3[_0x9e7e('0x5a')][_0x9e7e('0x62')]=_0x3ae3a3[_0x9e7e('0x5a')][_0x9e7e('0x62')]||_0x3ae3a3['user']['id'];return db[_0x9e7e('0x3d')][_0x9e7e('0x58')]({'where':{'id':_0x3ae3a3[_0x9e7e('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x9e7e('0x63')],'as':_0x9e7e('0x64')}]})[_0x9e7e('0x37')](handleEntityNotFound(_0x2bf543,null))[_0x9e7e('0x37')](saveUpdates(_0x3ae3a3[_0x9e7e('0x5a')],null))[_0x9e7e('0x37')](function(_0x20a4ea){if(_0x20a4ea){_0x1000c0[_0x9e7e('0x29')]=_0x20a4ea['get']({'plain':!![]});return db[_0x9e7e('0x65')]['find']({'where':{'id':_0x20a4ea[_0x9e7e('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x2bf543,null))['then'](function(_0x3acbda){if(_0x3acbda){return _0x3acbda[_0x9e7e('0x36')]({'UserId':_0x3ae3a3[_0x9e7e('0x5a')][_0x9e7e('0x62')],'read1stAt':_[_0x9e7e('0x67')](_0x3acbda[_0x9e7e('0x68')])?moment()['format'](_0x9e7e('0x61')):undefined});}return null;})[_0x9e7e('0x37')](function(_0x390885){if(_0x390885){_0x1000c0[_0x9e7e('0x69')]=_0x390885[_0x9e7e('0x6a')]({'plain':!![]});interaction_log['info'](_0x9e7e('0x6b'),_0x3ae3a3[_0x9e7e('0x6c')]['id'],_0x3ae3a3[_0x9e7e('0x6c')]['name'],_0x3ae3a3[_0x9e7e('0x6c')][_0x9e7e('0x6d')],_0x1000c0[_0x9e7e('0x69')]['id'],_0x3ae3a3['body']?JSON[_0x9e7e('0x6e')](_0x3ae3a3[_0x9e7e('0x5a')]):'null');return respondWithRpcPromise('AcceptMessage',_0x9e7e('0x6f'),_0x1000c0);}return null;})[_0x9e7e('0x37')](function(_0x196ba8){if(_0x196ba8){if(_0x3ae3a3[_0x9e7e('0x5a')][_0x9e7e('0x70')]){_0x1000c0['message'][_0x9e7e('0x71')]=util[_0x9e7e('0x72')](_0x9e7e('0x73'),_0x3ae3a3['user'][_0x9e7e('0x39')]);_0x1000c0['message'][_0x9e7e('0x74')]=_0x1000c0[_0x9e7e('0x74')];_0x1000c0[_0x9e7e('0x29')][_0x9e7e('0x75')]=_0x9e7e('0x5d');return respondWithRpcPromise(_0x9e7e('0x76'),_0x9e7e('0x76'),{'event':_0x9e7e('0x77'),'message':_0x1000c0['message']},client9002)['then'](function(){return _0x1000c0;});}return _0x1000c0;}return null;})['then'](respondWithResult(_0x2bf543,null))['catch'](handleError(_0x2bf543,null));};var interaction_log=require(_0x9e7e('0x14'))(_0x9e7e('0x5c'));exports['reject']=function(_0x1deb45,_0x1da54a,_0x1da41d){var _0x9b68bf={'agent':{},'channel':_0x9e7e('0x5e')};if(_0x1deb45['body']['id']){delete _0x1deb45[_0x9e7e('0x5a')]['id'];}_0x1deb45['body'][_0x9e7e('0x62')]=_0x1deb45[_0x9e7e('0x5a')]['UserId']||_0x1deb45[_0x9e7e('0x6c')]['id'];_0x9b68bf['agent']['id']=_0x1deb45[_0x9e7e('0x5a')][_0x9e7e('0x62')];return db[_0x9e7e('0x3d')]['find']({'where':{'id':_0x1deb45['params']['id'],'UserId':null}})[_0x9e7e('0x37')](handleEntityNotFound(_0x1da54a,null))['then'](function(_0x594c1b){if(_0x594c1b){_0x9b68bf[_0x9e7e('0x29')]=_0x594c1b['get']({'plain':!![]});return db['WhatsappInteraction'][_0x9e7e('0x58')]({'where':{'id':_0x594c1b[_0x9e7e('0x66')]}});}return null;})[_0x9e7e('0x37')](handleEntityNotFound(_0x1da54a,null))[_0x9e7e('0x37')](function(_0x2086d9){if(_0x2086d9){_0x9b68bf['interaction']=_0x2086d9[_0x9e7e('0x6a')]({'plain':!![]});interaction_log['info'](_0x9e7e('0x78'),_0x1deb45[_0x9e7e('0x6c')]['id'],_0x1deb45[_0x9e7e('0x6c')][_0x9e7e('0x39')],_0x1deb45[_0x9e7e('0x6c')][_0x9e7e('0x6d')],_0x9b68bf[_0x9e7e('0x69')]['id'],_0x1deb45[_0x9e7e('0x5a')]?JSON[_0x9e7e('0x6e')](_0x1deb45[_0x9e7e('0x5a')]):_0x9e7e('0x79'));return respondWithRpcPromise('RejectMessage',_0x9e7e('0x7a'),_0x9b68bf);}return null;})[_0x9e7e('0x37')](function(_0xafc545){if(_0xafc545){_0xafc545[_0x9e7e('0x29')][_0x9e7e('0x71')]=util[_0x9e7e('0x72')]('SIP/%s',_0x1deb45[_0x9e7e('0x6c')][_0x9e7e('0x39')]);_0xafc545['message'][_0x9e7e('0x74')]=_0x9b68bf['channel'];_0xafc545[_0x9e7e('0x29')][_0x9e7e('0x75')]='reject';respondWithRpcPromise(_0x9e7e('0x76'),'EventManager',{'event':_0x9e7e('0x7b'),'message':_0xafc545['message']},client9002);return _0x9b68bf;}return null;})[_0x9e7e('0x37')](respondWithResult(_0x1da54a,null))[_0x9e7e('0x2b')](handleError(_0x1da54a,null));};exports[_0x9e7e('0x2e')]=function(_0x54317b,_0x66c20b,_0x553dd1){if(_0x54317b['body']['id']){delete _0x54317b[_0x9e7e('0x5a')]['id'];}var _0x9b9304;return db[_0x9e7e('0x3d')][_0x9e7e('0x58')]({'where':{'id':_0x54317b[_0x9e7e('0x57')]['id']}})[_0x9e7e('0x37')](handleEntityNotFound(_0x66c20b,null))[_0x9e7e('0x37')](function(_0x26dced){if(_0x26dced){_0x9b9304=_0x26dced;return db[_0x9e7e('0x7c')][_0x9e7e('0x58')]({'where':{'id':_0x26dced[_0x9e7e('0x7d')]}});}})['then'](handleEntityNotFound(_0x66c20b,null))['then'](function(_0x2cd7af){if(_0x2cd7af){logger['debug'](_0x9e7e('0x7e'),'status',_0x9e7e('0x7f'),_0x2cd7af[_0x9e7e('0x40')],util['inspect'](_0x54317b[_0x9e7e('0x5a')],{'showHidden':![],'depth':null}));switch(_0x2cd7af[_0x9e7e('0x40')]){case'twilio':if(_0x54317b[_0x9e7e('0x5a')][_0x9e7e('0x80')]&&_0x54317b[_0x9e7e('0x5a')]['MessageSid']===_0x9b9304[_0x9e7e('0x81')]&&_0x54317b[_0x9e7e('0x5a')][_0x9e7e('0x82')]&&_0x54317b[_0x9e7e('0x5a')][_0x9e7e('0x82')]===_0x9e7e('0x5f')){return _0x9b9304['update']({'read':!![]});}else{logger[_0x9e7e('0x26')](_0x9e7e('0x83'),_0x9e7e('0x2e'),_0x9e7e('0x84'),util['inspect'](_0x54317b[_0x9e7e('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x9b9304;}})[_0x9e7e('0x37')](respondWithResult(_0x66c20b,null))[_0x9e7e('0x2b')](handleError(_0x66c20b,null));}; \ No newline at end of file +var _0x38fc=['fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','status','end','json','count','limit','set','Content-Range','reject','save','update','destroy','name','send','index','map','rawAttributes','type','key','model','query','keys','fields','attributes','length','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','WhatsappMessage','then','includeAll','include','show','params','intersection','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','read','readAt','format','UserId','user','CmContact','Contact','get','WhatsappInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp','agent','WhatsappInteractionId','role','stringify','rejectMessage','rejectmessage','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir'];(function(_0x4c4749,_0x1f776d){var _0x138d91=function(_0x37a29c){while(--_0x37a29c){_0x4c4749['push'](_0x4c4749['shift']());}};_0x138d91(++_0x1f776d);}(_0x38fc,0x107));var _0xc38f=function(_0x14498e,_0x150037){_0x14498e=_0x14498e-0x0;var _0x37f2ff=_0x38fc[_0x14498e];return _0x37f2ff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc38f('0x0'));var rimraf=require(_0xc38f('0x1'));var zipdir=require(_0xc38f('0x2'));var jsonpatch=require(_0xc38f('0x3'));var rp=require(_0xc38f('0x4'));var moment=require(_0xc38f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc38f('0x6'));var util=require(_0xc38f('0x7'));var path=require('path');var sox=require(_0xc38f('0x8'));var csv=require(_0xc38f('0x9'));var ejs=require(_0xc38f('0xa'));var fs=require('fs');var _=require(_0xc38f('0xb'));var squel=require(_0xc38f('0xc'));var crypto=require(_0xc38f('0xd'));var jsforce=require(_0xc38f('0xe'));var deskjs=require(_0xc38f('0xf'));var toCsv=require(_0xc38f('0x9'));var querystring=require('querystring');var Papa=require(_0xc38f('0x10'));var Redis=require(_0xc38f('0x11'));var authService=require(_0xc38f('0x12'));var qs=require(_0xc38f('0x13'));var as=require(_0xc38f('0x14'));var hardwareService=require(_0xc38f('0x15'));var logger=require('../../config/logger')(_0xc38f('0x16'));var utils=require(_0xc38f('0x17'));var config=require(_0xc38f('0x18'));var db=require(_0xc38f('0x19'))['db'];config[_0xc38f('0x1a')]=_[_0xc38f('0x1b')](config['redis'],{'host':_0xc38f('0x1c'),'port':0x18eb});var socket=require(_0xc38f('0x1d'))(new Redis(config[_0xc38f('0x1a')]));require(_0xc38f('0x1e'))[_0xc38f('0x1f')](socket);var jayson=require(_0xc38f('0x20'));var client=jayson[_0xc38f('0x21')][_0xc38f('0x22')]({'port':0x232c});var client9002=jayson[_0xc38f('0x21')][_0xc38f('0x22')]({'port':0x232a});function checkPasswordPattern(_0x4ac0eb,_0x1c3723,_0x26240e){if(_0x26240e){var _0x5629d2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5629d2['test'](_0x1c3723)){return _0x4ac0eb;}else{throw new db[(_0xc38f('0x23'))][(_0xc38f('0x24'))](_0xc38f('0x25'));}}else{return _0x4ac0eb;}}function respondWithRpcPromise(_0x1f7654,_0x1781c4,_0x5e9ff4,_0x581356){return new BPromise(function(_0x558d8e,_0x4665b5){var _0x3c9710=_0x581356||client;return _0x3c9710[_0xc38f('0x26')](_0x1f7654,_0x5e9ff4)['then'](function(_0x5d0033){logger[_0xc38f('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x1781c4,_0xc38f('0x28'));logger['debug'](_0xc38f('0x29'),_0x1781c4,_0xc38f('0x28'),JSON['stringify'](_0x5d0033));if(_0x5d0033[_0xc38f('0x2a')]){if(_0x5d0033[_0xc38f('0x2a')][_0xc38f('0x2b')]===0x1f4){logger['error'](_0xc38f('0x2c'),_0x1781c4,_0x5d0033[_0xc38f('0x2a')][_0xc38f('0x2d')]);return _0x4665b5(_0x5d0033[_0xc38f('0x2a')]['message']);}logger[_0xc38f('0x2a')](_0xc38f('0x2c'),_0x1781c4,_0x5d0033[_0xc38f('0x2a')][_0xc38f('0x2d')]);return _0x558d8e(_0x5d0033[_0xc38f('0x2a')]['message']);}else{logger[_0xc38f('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x1781c4,_0xc38f('0x28'));_0x558d8e(_0x5d0033['result'][_0xc38f('0x2d')]);}})[_0xc38f('0x2e')](function(_0x537830){logger[_0xc38f('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x1781c4,_0x537830);_0x4665b5(_0x537830);});});}function respondWithStatusCode(_0x1d5100,_0x4ec16c){_0x4ec16c=_0x4ec16c||0xcc;return function(_0x19ee42){if(_0x19ee42){return _0x1d5100['sendStatus'](_0x4ec16c);}return _0x1d5100[_0xc38f('0x2f')](_0x4ec16c)[_0xc38f('0x30')]();};}function respondWithResult(_0x315181,_0x55e0b5){_0x55e0b5=_0x55e0b5||0xc8;return function(_0x3f8b5c){if(_0x3f8b5c){return _0x315181[_0xc38f('0x2f')](_0x55e0b5)[_0xc38f('0x31')](_0x3f8b5c);}};}function respondWithFilteredResult(_0x5a7346,_0x1c2fb5){return function(_0x5d906e){if(_0x5d906e){var _0x42b0bf=_0x5d906e[_0xc38f('0x32')],_0x4dd003=_0x1c2fb5['offset'],_0x3cbe9e=_0x1c2fb5['offset']+_0x1c2fb5[_0xc38f('0x33')],_0x3c01a4;if(_0x3cbe9e>=_0x42b0bf){_0x3cbe9e=_0x42b0bf;_0x3c01a4=0xc8;}else{_0x3c01a4=0xce;}_0x5a7346[_0xc38f('0x2f')](_0x3c01a4);return _0x5a7346[_0xc38f('0x34')](_0xc38f('0x35'),_0x4dd003+'-'+_0x3cbe9e+'/'+_0x42b0bf)[_0xc38f('0x31')](_0x5d906e);}return null;};}function patchUpdates(_0x3eab21){return function(_0x21caec){try{jsonpatch['apply'](_0x21caec,_0x3eab21,!![]);}catch(_0x146d0b){return BPromise[_0xc38f('0x36')](_0x146d0b);}return _0x21caec[_0xc38f('0x37')]();};}function saveUpdates(_0x36d1f8,_0x5ba23e){return function(_0x433fec){if(_0x433fec){return _0x433fec[_0xc38f('0x38')](_0x36d1f8)['then'](function(_0x5cd4d7){return _0x5cd4d7;});}return null;};}function removeEntity(_0x52d5bb,_0xa1897e){return function(_0x414c29){if(_0x414c29){return _0x414c29[_0xc38f('0x39')]()['then'](function(){_0x52d5bb[_0xc38f('0x2f')](0xcc)[_0xc38f('0x30')]();});}};}function handleEntityNotFound(_0x48b3e3,_0x5bfa29){return function(_0xa80fb3){if(!_0xa80fb3){_0x48b3e3['sendStatus'](0x194);}return _0xa80fb3;};}function handleError(_0x49fad9,_0x424e69){_0x424e69=_0x424e69||0x1f4;return function(_0x1dfe44){logger[_0xc38f('0x2a')](_0x1dfe44['stack']);if(_0x1dfe44[_0xc38f('0x3a')]){delete _0x1dfe44[_0xc38f('0x3a')];}_0x49fad9['status'](_0x424e69)[_0xc38f('0x3b')](_0x1dfe44);};}exports[_0xc38f('0x3c')]=function(_0x167153,_0x15f589){var _0x13e32e={},_0x2aff73={},_0x4eb1cc={'count':0x0,'rows':[]};var _0x8c7cf5=_[_0xc38f('0x3d')](db['WhatsappMessage'][_0xc38f('0x3e')],function(_0x1fb273){return{'name':_0x1fb273['fieldName'],'type':_0x1fb273[_0xc38f('0x3f')][_0xc38f('0x40')]};});_0x2aff73[_0xc38f('0x41')]=_[_0xc38f('0x3d')](_0x8c7cf5,_0xc38f('0x3a'));_0x2aff73[_0xc38f('0x42')]=_[_0xc38f('0x43')](_0x167153[_0xc38f('0x42')]);_0x2aff73['filters']=_['intersection'](_0x2aff73[_0xc38f('0x41')],_0x2aff73['query']);_0x13e32e['attributes']=_['intersection'](_0x2aff73[_0xc38f('0x41')],qs[_0xc38f('0x44')](_0x167153['query'][_0xc38f('0x44')]));_0x13e32e[_0xc38f('0x45')]=_0x13e32e[_0xc38f('0x45')][_0xc38f('0x46')]?_0x13e32e[_0xc38f('0x45')]:_0x2aff73['model'];if(!_0x167153[_0xc38f('0x42')]['hasOwnProperty'](_0xc38f('0x47'))){_0x13e32e[_0xc38f('0x33')]=qs[_0xc38f('0x33')](_0x167153[_0xc38f('0x42')][_0xc38f('0x33')]);_0x13e32e[_0xc38f('0x48')]=qs['offset'](_0x167153[_0xc38f('0x42')][_0xc38f('0x48')]);}_0x13e32e[_0xc38f('0x49')]=qs[_0xc38f('0x4a')](_0x167153['query'][_0xc38f('0x4a')]);_0x13e32e[_0xc38f('0x4b')]=qs[_0xc38f('0x4c')](_[_0xc38f('0x4d')](_0x167153[_0xc38f('0x42')],_0x2aff73['filters']),_0x8c7cf5);if(_0x167153['query'][_0xc38f('0x4e')]){_0x13e32e[_0xc38f('0x4b')]=_[_0xc38f('0x4f')](_0x13e32e['where'],{'$or':_['map'](_0x8c7cf5,function(_0x59bf21){if(_0x59bf21[_0xc38f('0x3f')]!==_0xc38f('0x50')){var _0x1f1893={};_0x1f1893[_0x59bf21[_0xc38f('0x3a')]]={'$like':'%'+_0x167153[_0xc38f('0x42')][_0xc38f('0x4e')]+'%'};return _0x1f1893;}})});}_0x13e32e=_[_0xc38f('0x4f')]({},_0x13e32e,_0x167153['options']);var _0x25f4b3={'where':_0x13e32e['where']};return db[_0xc38f('0x51')][_0xc38f('0x32')](_0x25f4b3)[_0xc38f('0x52')](function(_0x3fbb16){_0x4eb1cc['count']=_0x3fbb16;if(_0x167153['query'][_0xc38f('0x53')]){_0x13e32e[_0xc38f('0x54')]=[{'all':!![]}];}return db[_0xc38f('0x51')]['findAll'](_0x13e32e);})[_0xc38f('0x52')](function(_0x46efc9){_0x4eb1cc['rows']=_0x46efc9;return _0x4eb1cc;})[_0xc38f('0x52')](respondWithFilteredResult(_0x15f589,_0x13e32e))['catch'](handleError(_0x15f589,null));};exports[_0xc38f('0x55')]=function(_0x2c7bf7,_0x29e9ef){var _0x308e7d={'raw':!![],'where':{'id':_0x2c7bf7[_0xc38f('0x56')]['id']}},_0x3a396d={};_0x3a396d[_0xc38f('0x41')]=_[_0xc38f('0x43')](db[_0xc38f('0x51')]['rawAttributes']);_0x3a396d[_0xc38f('0x42')]=_['keys'](_0x2c7bf7['query']);_0x3a396d[_0xc38f('0x4c')]=_[_0xc38f('0x57')](_0x3a396d[_0xc38f('0x41')],_0x3a396d[_0xc38f('0x42')]);_0x308e7d['attributes']=_[_0xc38f('0x57')](_0x3a396d[_0xc38f('0x41')],qs[_0xc38f('0x44')](_0x2c7bf7['query'][_0xc38f('0x44')]));_0x308e7d[_0xc38f('0x45')]=_0x308e7d[_0xc38f('0x45')][_0xc38f('0x46')]?_0x308e7d[_0xc38f('0x45')]:_0x3a396d[_0xc38f('0x41')];if(_0x2c7bf7[_0xc38f('0x42')][_0xc38f('0x53')]){_0x308e7d[_0xc38f('0x54')]=[{'all':!![]}];}_0x308e7d=_[_0xc38f('0x4f')]({},_0x308e7d,_0x2c7bf7['options']);return db[_0xc38f('0x51')][_0xc38f('0x58')](_0x308e7d)[_0xc38f('0x52')](handleEntityNotFound(_0x29e9ef,null))[_0xc38f('0x52')](respondWithResult(_0x29e9ef,null))[_0xc38f('0x2e')](handleError(_0x29e9ef,null));};exports[_0xc38f('0x59')]=function(_0x95571a,_0x21ecc6){return db[_0xc38f('0x51')][_0xc38f('0x59')](_0x95571a[_0xc38f('0x5a')],{})['then'](respondWithResult(_0x21ecc6,0xc9))['catch'](handleError(_0x21ecc6,null));};exports[_0xc38f('0x38')]=function(_0x407a8f,_0x5c2f72){if(_0x407a8f[_0xc38f('0x5a')]['id']){delete _0x407a8f[_0xc38f('0x5a')]['id'];}return db[_0xc38f('0x51')][_0xc38f('0x58')]({'where':{'id':_0x407a8f[_0xc38f('0x56')]['id']}})[_0xc38f('0x52')](handleEntityNotFound(_0x5c2f72,null))[_0xc38f('0x52')](saveUpdates(_0x407a8f[_0xc38f('0x5a')],null))['then'](respondWithResult(_0x5c2f72,null))['catch'](handleError(_0x5c2f72,null));};exports[_0xc38f('0x39')]=function(_0x59f636,_0x285467){return db[_0xc38f('0x51')][_0xc38f('0x58')]({'where':{'id':_0x59f636['params']['id']}})[_0xc38f('0x52')](handleEntityNotFound(_0x285467,null))['then'](removeEntity(_0x285467,null))[_0xc38f('0x2e')](handleError(_0x285467,null));};exports['describe']=function(_0x2cd1ed,_0x1f37f9){return db[_0xc38f('0x51')][_0xc38f('0x5b')]()['then'](respondWithResult(_0x1f37f9,null))['catch'](handleError(_0x1f37f9,null));};var interaction_log=require(_0xc38f('0x5c'))(_0xc38f('0x5d'));exports[_0xc38f('0x5e')]=function(_0x22140e,_0x491047,_0x2df2f3){var _0x5780f1={'channel':'whatsapp'};if(_0x22140e[_0xc38f('0x5a')]['id']){delete _0x22140e[_0xc38f('0x5a')]['id'];}_0x22140e['body'][_0xc38f('0x5f')]=!![];_0x22140e['body'][_0xc38f('0x60')]=moment()[_0xc38f('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x22140e['body'][_0xc38f('0x62')]=_0x22140e[_0xc38f('0x5a')][_0xc38f('0x62')]||_0x22140e[_0xc38f('0x63')]['id'];return db['WhatsappMessage'][_0xc38f('0x58')]({'where':{'id':_0x22140e[_0xc38f('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xc38f('0x64')],'as':_0xc38f('0x65')}]})['then'](handleEntityNotFound(_0x491047,null))[_0xc38f('0x52')](saveUpdates(_0x22140e[_0xc38f('0x5a')],null))[_0xc38f('0x52')](function(_0x405d95){if(_0x405d95){_0x5780f1[_0xc38f('0x2d')]=_0x405d95[_0xc38f('0x66')]({'plain':!![]});return db[_0xc38f('0x67')]['find']({'where':{'id':_0x405d95['WhatsappInteractionId']}});}return null;})[_0xc38f('0x52')](handleEntityNotFound(_0x491047,null))['then'](function(_0x1a8c79){if(_0x1a8c79){return _0x1a8c79[_0xc38f('0x38')]({'UserId':_0x22140e[_0xc38f('0x5a')][_0xc38f('0x62')],'read1stAt':_[_0xc38f('0x68')](_0x1a8c79[_0xc38f('0x69')])?moment()[_0xc38f('0x61')](_0xc38f('0x6a')):undefined});}return null;})['then'](function(_0x531029){if(_0x531029){_0x5780f1[_0xc38f('0x6b')]=_0x531029[_0xc38f('0x66')]({'plain':!![]});interaction_log[_0xc38f('0x27')](_0xc38f('0x6c'),_0x22140e['user']['id'],_0x22140e['user'][_0xc38f('0x3a')],_0x22140e[_0xc38f('0x63')]['role'],_0x5780f1[_0xc38f('0x6b')]['id'],_0x22140e['body']?JSON['stringify'](_0x22140e[_0xc38f('0x5a')]):_0xc38f('0x6d'));return respondWithRpcPromise(_0xc38f('0x6e'),_0xc38f('0x6f'),_0x5780f1);}return null;})[_0xc38f('0x52')](function(_0x44b8c6){if(_0x44b8c6){if(_0x22140e[_0xc38f('0x5a')][_0xc38f('0x70')]){_0x5780f1[_0xc38f('0x2d')][_0xc38f('0x71')]=util[_0xc38f('0x61')](_0xc38f('0x72'),_0x22140e[_0xc38f('0x63')]['name']);_0x5780f1['message'][_0xc38f('0x73')]=_0x5780f1['channel'];_0x5780f1[_0xc38f('0x2d')][_0xc38f('0x74')]=_0xc38f('0x5e');return respondWithRpcPromise(_0xc38f('0x75'),'EventManager',{'event':_0xc38f('0x76'),'message':_0x5780f1['message']},client9002)[_0xc38f('0x52')](function(){return _0x5780f1;});}return _0x5780f1;}return null;})[_0xc38f('0x52')](respondWithResult(_0x491047,null))[_0xc38f('0x2e')](handleError(_0x491047,null));};var interaction_log=require('../../config/logger')(_0xc38f('0x5d'));exports['reject']=function(_0x29f222,_0x4d31ab,_0x14c0c0){var _0x14bb3d={'agent':{},'channel':_0xc38f('0x77')};if(_0x29f222[_0xc38f('0x5a')]['id']){delete _0x29f222[_0xc38f('0x5a')]['id'];}_0x29f222[_0xc38f('0x5a')][_0xc38f('0x62')]=_0x29f222['body'][_0xc38f('0x62')]||_0x29f222[_0xc38f('0x63')]['id'];_0x14bb3d[_0xc38f('0x78')]['id']=_0x29f222[_0xc38f('0x5a')][_0xc38f('0x62')];return db[_0xc38f('0x51')][_0xc38f('0x58')]({'where':{'id':_0x29f222['params']['id'],'UserId':null}})[_0xc38f('0x52')](handleEntityNotFound(_0x4d31ab,null))['then'](function(_0x5a62c0){if(_0x5a62c0){_0x14bb3d[_0xc38f('0x2d')]=_0x5a62c0[_0xc38f('0x66')]({'plain':!![]});return db[_0xc38f('0x67')]['find']({'where':{'id':_0x5a62c0[_0xc38f('0x79')]}});}return null;})['then'](handleEntityNotFound(_0x4d31ab,null))['then'](function(_0x48aee8){if(_0x48aee8){_0x14bb3d[_0xc38f('0x6b')]=_0x48aee8['get']({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x29f222[_0xc38f('0x63')]['id'],_0x29f222[_0xc38f('0x63')][_0xc38f('0x3a')],_0x29f222[_0xc38f('0x63')][_0xc38f('0x7a')],_0x14bb3d[_0xc38f('0x6b')]['id'],_0x29f222[_0xc38f('0x5a')]?JSON[_0xc38f('0x7b')](_0x29f222['body']):'null');return respondWithRpcPromise('RejectMessage',_0xc38f('0x7c'),_0x14bb3d);}return null;})[_0xc38f('0x52')](function(_0x9cf6b0){if(_0x9cf6b0){_0x9cf6b0[_0xc38f('0x2d')][_0xc38f('0x71')]=util[_0xc38f('0x61')](_0xc38f('0x72'),_0x29f222[_0xc38f('0x63')][_0xc38f('0x3a')]);_0x9cf6b0[_0xc38f('0x2d')][_0xc38f('0x73')]=_0x14bb3d['channel'];_0x9cf6b0['message'][_0xc38f('0x74')]=_0xc38f('0x36');respondWithRpcPromise(_0xc38f('0x75'),_0xc38f('0x75'),{'event':_0xc38f('0x7d'),'message':_0x9cf6b0['message']},client9002);return _0x14bb3d;}return null;})[_0xc38f('0x52')](respondWithResult(_0x4d31ab,null))[_0xc38f('0x2e')](handleError(_0x4d31ab,null));};exports['status']=function(_0x3fb34f,_0x776b5b,_0x8d43b6){if(_0x3fb34f[_0xc38f('0x5a')]['id']){delete _0x3fb34f[_0xc38f('0x5a')]['id'];}var _0x5ebb2e;return db[_0xc38f('0x51')][_0xc38f('0x58')]({'where':{'id':_0x3fb34f[_0xc38f('0x56')]['id']}})[_0xc38f('0x52')](handleEntityNotFound(_0x776b5b,null))[_0xc38f('0x52')](function(_0x24cb6c){if(_0x24cb6c){_0x5ebb2e=_0x24cb6c;return db['WhatsappAccount']['find']({'where':{'id':_0x24cb6c['WhatsappAccountId']}});}})[_0xc38f('0x52')](handleEntityNotFound(_0x776b5b,null))['then'](function(_0x33c3b6){if(_0x33c3b6){logger[_0xc38f('0x7e')](_0xc38f('0x7f'),_0xc38f('0x2f'),_0xc38f('0x80'),_0x33c3b6['type'],util['inspect'](_0x3fb34f[_0xc38f('0x5a')],{'showHidden':![],'depth':null}));switch(_0x33c3b6[_0xc38f('0x3f')]){case _0xc38f('0x81'):if(_0x3fb34f[_0xc38f('0x5a')][_0xc38f('0x82')]&&_0x3fb34f[_0xc38f('0x5a')]['MessageSid']===_0x5ebb2e['messageId']&&_0x3fb34f[_0xc38f('0x5a')][_0xc38f('0x83')]&&_0x3fb34f['body']['MessageStatus']===_0xc38f('0x5f')){return _0x5ebb2e['update']({'read':!![]});}else{logger[_0xc38f('0x2a')](_0xc38f('0x84'),_0xc38f('0x2f'),'twilio',util['inspect'](_0x3fb34f['body'],{'showHidden':![],'depth':null}));}break;}return _0x5ebb2e;}})[_0xc38f('0x52')](respondWithResult(_0x776b5b,null))[_0xc38f('0x2e')](handleError(_0x776b5b,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 00cb07d..ebbd56a 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x47352c,_0x2dca70){var _0x40c63c=function(_0x24b641){while(--_0x24b641){_0x47352c['push'](_0x47352c['shift']());}};_0x40c63c(++_0x2dca70);}(_0xb10b,0x12a));var _0xbb10=function(_0x32ff1d,_0x3e29bb){_0x32ff1d=_0x32ff1d-0x0;var _0x50489e=_0xb10b[_0x32ff1d];return _0x50489e;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x25ea4f,_0x1717cd){var _0x209c3c=function(_0x1749e8){while(--_0x1749e8){_0x25ea4f['push'](_0x25ea4f['shift']());}};_0x209c3c(++_0x1717cd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3e83c2,_0x3e5de0){_0x3e83c2=_0x3e83c2-0x0;var _0xf86fe9=_0x5f2f[_0x3e83c2];return _0xf86fe9;};'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 62f0fee..5df0cea 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 _0x5098=['UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','error','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5098,0xb6));var _0x8509=function(_0x5421ee,_0x7c8348){_0x5421ee=_0x5421ee-0x0;var _0x4b483e=_0x5098[_0x5421ee];return _0x4b483e;};'use strict';var _=require(_0x8509('0x0'));var util=require(_0x8509('0x1'));var logger=require(_0x8509('0x2'))(_0x8509('0x3'));var moment=require(_0x8509('0x4'));var BPromise=require(_0x8509('0x5'));var rp=require(_0x8509('0x6'));var fs=require('fs');var path=require(_0x8509('0x7'));var rimraf=require('rimraf');var config=require(_0x8509('0x8'));var attributes=require(_0x8509('0x9'));module[_0x8509('0xa')]=function(_0x28b7da,_0x4345ec){return _0x28b7da[_0x8509('0xb')]('WhatsappMessage',attributes,{'tableName':_0x8509('0xc'),'paranoid':![],'indexes':[{'name':_0x8509('0xd'),'fields':['messageId']},{'name':_0x8509('0xe'),'fields':['body'],'type':_0x8509('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b9c2b,_0x57c868,_0x48b04f){var _0x2d3fca=_0x28b7da[_0x8509('0x10')];var _0x33c00d=_0x2b9c2b[_0x8509('0x11')]({'plain':!![]});if(_0x33c00d[_0x8509('0x12')][_0x8509('0x13')]()==='in'||_0x33c00d[_0x8509('0x12')]['toLowerCase']()===_0x8509('0x14')&&!_0x33c00d[_0x8509('0x15')]&&!_['isNil'](_0x33c00d[_0x8509('0x16')])){_0x2d3fca[_0x8509('0x17')][_0x8509('0x18')]({'where':{'id':_0x33c00d['WhatsappInteractionId']}})[_0x8509('0x19')](function(_0x2055f){if(_0x2055f){_0x2055f[_0x8509('0x1a')]({'lastMsgAt':_0x33c00d[_0x8509('0x1b')],'lastMsgDirection':_0x33c00d['direction']['toLowerCase']()});}})[_0x8509('0x1c')](function(_0xa895ea){console[_0x8509('0x1d')](_0xa895ea);});}if(_0x33c00d[_0x8509('0x12')]===_0x8509('0x14')&&!_0x33c00d[_0x8509('0x15')]){var _0x3e0cfa;_0x2d3fca['WhatsappAccount']['find']({'where':{'id':_0x33c00d[_0x8509('0x1e')]},'raw':!![]})[_0x8509('0x19')](function(_0x5163cc){_0x3e0cfa=_0x5163cc;if(_0x3e0cfa&&_0x3e0cfa['type']){switch(_0x3e0cfa[_0x8509('0x1f')]){case _0x8509('0x20'):var _0x5193ea=require('twilio');if(_0x3e0cfa[_0x8509('0x21')]&&_0x3e0cfa[_0x8509('0x22')]&&_0x3e0cfa[_0x8509('0x23')]){var _0x2acdee=new _0x5193ea(_0x3e0cfa[_0x8509('0x21')],_0x3e0cfa[_0x8509('0x22')]);_0x2acdee[_0x8509('0x24')][_0x8509('0x25')]({'body':_0x33c00d[_0x8509('0x26')],'to':_0x8509('0x27')+_0x33c00d['phone'],'from':_0x8509('0x27')+_0x3e0cfa[_0x8509('0x23')],'statusCallback':_0x3e0cfa[_0x8509('0x28')]+_0x8509('0x29')+_0x33c00d['id']+_0x8509('0x2a')+_0x3e0cfa[_0x8509('0x2b')]})[_0x8509('0x19')](function(_0xe202c0){if(_0xe202c0['sid']){return _0x2b9c2b[_0x8509('0x1a')]({'messageId':_0xe202c0[_0x8509('0x2c')]});}})[_0x8509('0x1c')](function(_0x46c9f9){logger[_0x8509('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x8509('0x2d'),_0x8509('0x20'),util[_0x8509('0x2e')](_0x46c9f9,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',_0x8509('0x2f'));}break;}}})[_0x8509('0x30')](function(){_0x48b04f();});}else{_0x48b04f();}}},'charset':_0x8509('0x31'),'collate':_0x8509('0x32')});}; \ No newline at end of file +var _0xa23f=['body','FULLTEXT','models','toLowerCase','direction','secret','isNil','findOne','then','update','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','messages','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','finally','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappMessage','messageId'];(function(_0x18894b,_0xb20093){var _0x4b3230=function(_0x434091){while(--_0x434091){_0x18894b['push'](_0x18894b['shift']());}};_0x4b3230(++_0xb20093);}(_0xa23f,0x1ce));var _0xfa23=function(_0x1f9f96,_0x1e4fd1){_0x1f9f96=_0x1f9f96-0x0;var _0x4d26e6=_0xa23f[_0x1f9f96];return _0x4d26e6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa23('0x0'))('api');var moment=require(_0xfa23('0x1'));var BPromise=require(_0xfa23('0x2'));var rp=require(_0xfa23('0x3'));var fs=require('fs');var path=require(_0xfa23('0x4'));var rimraf=require(_0xfa23('0x5'));var config=require(_0xfa23('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0xfa23('0x7')]=function(_0x2b4e74,_0x4e03ef){return _0x2b4e74[_0xfa23('0x8')](_0xfa23('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xfa23('0xa')]},{'name':'fti_whatsapp_messages','fields':[_0xfa23('0xb')],'type':_0xfa23('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x18b4d0,_0x27b0f5,_0x759784){var _0x3e53b0=_0x2b4e74[_0xfa23('0xd')];var _0x5787f1=_0x18b4d0['get']({'plain':!![]});if(_0x5787f1['direction'][_0xfa23('0xe')]()==='in'||_0x5787f1[_0xfa23('0xf')][_0xfa23('0xe')]()==='out'&&!_0x5787f1[_0xfa23('0x10')]&&!_[_0xfa23('0x11')](_0x5787f1['UserId'])){_0x3e53b0['WhatsappInteraction'][_0xfa23('0x12')]({'where':{'id':_0x5787f1['WhatsappInteractionId']}})[_0xfa23('0x13')](function(_0x5a87d3){if(_0x5a87d3){_0x5a87d3[_0xfa23('0x14')]({'lastMsgAt':_0x5787f1[_0xfa23('0x15')],'lastMsgDirection':_0x5787f1[_0xfa23('0xf')][_0xfa23('0xe')]()});}})[_0xfa23('0x16')](function(_0x1d309b){console[_0xfa23('0x17')](_0x1d309b);});}if(_0x5787f1[_0xfa23('0xf')]===_0xfa23('0x18')&&!_0x5787f1[_0xfa23('0x10')]){var _0x2f7f4e;_0x3e53b0[_0xfa23('0x19')][_0xfa23('0x1a')]({'where':{'id':_0x5787f1[_0xfa23('0x1b')]},'raw':!![]})[_0xfa23('0x13')](function(_0x572e30){_0x2f7f4e=_0x572e30;if(_0x2f7f4e&&_0x2f7f4e[_0xfa23('0x1c')]){switch(_0x2f7f4e[_0xfa23('0x1c')]){case _0xfa23('0x1d'):var _0x3808b7=require('twilio');if(_0x2f7f4e[_0xfa23('0x1e')]&&_0x2f7f4e['authToken']&&_0x2f7f4e[_0xfa23('0x1f')]){var _0x2f3a28=new _0x3808b7(_0x2f7f4e['accountSid'],_0x2f7f4e['authToken']);_0x2f3a28[_0xfa23('0x20')][_0xfa23('0x21')]({'body':_0x5787f1['body'],'to':_0xfa23('0x22')+_0x5787f1[_0xfa23('0x1f')],'from':'whatsapp:'+_0x2f7f4e[_0xfa23('0x1f')],'statusCallback':_0x2f7f4e['remote']+_0xfa23('0x23')+_0x5787f1['id']+_0xfa23('0x24')+_0x2f7f4e[_0xfa23('0x25')]})['then'](function(_0x4f3e1d){if(_0x4f3e1d[_0xfa23('0x26')]){return _0x18b4d0[_0xfa23('0x14')]({'messageId':_0x4f3e1d[_0xfa23('0x26')]});}})['catch'](function(_0x1fbc34){logger[_0xfa23('0x17')](_0xfa23('0x27'),_0xfa23('0x28'),_0xfa23('0x1d'),util['inspect'](_0x1fbc34,{'showHidden':![],'depth':null}));});}else{logger[_0xfa23('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xfa23('0x28'),_0xfa23('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0xfa23('0x29')](function(){_0x759784();});}else{_0x759784();}}},'charset':'utf8mb4','collate':_0xfa23('0x2a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 91492ad..3b9ca94 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 _0xa935=['rpc','../../config/environment','client','defaults','redis','./whatsappMessage.socket','register','request','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','WhatsappMessage,\x20%s,\x20%s','message','info','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','catch','lodash','util','bluebird','ioredis','../../config/utils'];(function(_0x5d06b5,_0x562a42){var _0xdc7bca=function(_0x6d9ee3){while(--_0x6d9ee3){_0x5d06b5['push'](_0x5d06b5['shift']());}};_0xdc7bca(++_0x562a42);}(_0xa935,0x190));var _0x5a93=function(_0x1cf6dd,_0x5bd0c4){_0x1cf6dd=_0x1cf6dd-0x0;var _0x566408=_0xa935[_0x1cf6dd];return _0x566408;};'use strict';var _=require(_0x5a93('0x0'));var util=require(_0x5a93('0x1'));var moment=require('moment');var BPromise=require(_0x5a93('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a93('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a93('0x4'));var logger=require('../../config/logger')(_0x5a93('0x5'));var config=require(_0x5a93('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5a93('0x7')]['http']({'port':0x232a});config['redis']=_[_0x5a93('0x8')](config[_0x5a93('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5a93('0x9')]));require(_0x5a93('0xa'))[_0x5a93('0xb')](socket);function respondWithRpcPromise(_0x1a64c8,_0x550f5b,_0x52cadd){return new BPromise(function(_0x433474,_0x4fb9ca){return client[_0x5a93('0xc')](_0x1a64c8,_0x52cadd)['then'](function(_0x56ef99){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x550f5b,_0x5a93('0xd'));logger[_0x5a93('0xe')](_0x5a93('0xf'),_0x550f5b,'request\x20sent',JSON['stringify'](_0x56ef99));if(_0x56ef99[_0x5a93('0x10')]){if(_0x56ef99[_0x5a93('0x10')]['code']===0x1f4){logger['error'](_0x5a93('0x11'),_0x550f5b,_0x56ef99[_0x5a93('0x10')][_0x5a93('0x12')]);return _0x4fb9ca(_0x56ef99[_0x5a93('0x10')][_0x5a93('0x12')]);}logger[_0x5a93('0x10')](_0x5a93('0x11'),_0x550f5b,_0x56ef99[_0x5a93('0x10')]['message']);return _0x433474(_0x56ef99[_0x5a93('0x10')]['message']);}else{logger[_0x5a93('0x13')](_0x5a93('0x11'),_0x550f5b,_0x5a93('0xd'));_0x433474(_0x56ef99['result'][_0x5a93('0x12')]);}})['catch'](function(_0x4688aa){logger[_0x5a93('0x10')](_0x5a93('0x11'),_0x550f5b,_0x4688aa);_0x4fb9ca(_0x4688aa);});});}exports[_0x5a93('0x14')]=function(_0x4d1142){var _0x191cb5=this;return new Promise(function(_0x3d29e2,_0x9ddf8d){return db[_0x5a93('0x15')][_0x5a93('0x16')](_0x4d1142[_0x5a93('0x17')],{'raw':_0x4d1142[_0x5a93('0x18')]?_0x4d1142[_0x5a93('0x18')][_0x5a93('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x149b96){logger['info'](_0x5a93('0x14'),_0x4d1142);logger[_0x5a93('0xe')]('CreateWhatsappMessage',_0x4d1142,JSON['stringify'](_0x149b96));_0x3d29e2(_0x149b96);})[_0x5a93('0x1a')](function(_0x3a9b6d){logger[_0x5a93('0x10')](_0x5a93('0x14'),_0x3a9b6d[_0x5a93('0x12')],_0x4d1142);_0x9ddf8d(_0x191cb5[_0x5a93('0x10')](0x1f4,_0x3a9b6d[_0x5a93('0x12')]));});});}; \ No newline at end of file +var _0x8196=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','then','stringify','catch'];(function(_0x26d386,_0x1660c0){var _0x4ef9a8=function(_0x55e2d3){while(--_0x55e2d3){_0x26d386['push'](_0x26d386['shift']());}};_0x4ef9a8(++_0x1660c0);}(_0x8196,0x1dc));var _0x6819=function(_0x4b2e50,_0x54eec1){_0x4b2e50=_0x4b2e50-0x0;var _0x27dfb6=_0x8196[_0x4b2e50];return _0x27dfb6;};'use strict';var _=require(_0x6819('0x0'));var util=require(_0x6819('0x1'));var moment=require('moment');var BPromise=require(_0x6819('0x2'));var rs=require(_0x6819('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6819('0x4'))['db'];var utils=require(_0x6819('0x5'));var logger=require('../../config/logger')(_0x6819('0x6'));var config=require(_0x6819('0x7'));var jayson=require(_0x6819('0x8'));var client=jayson['client'][_0x6819('0x9')]({'port':0x232a});config[_0x6819('0xa')]=_[_0x6819('0xb')](config['redis'],{'host':_0x6819('0xc'),'port':0x18eb});var socket=require(_0x6819('0xd'))(new Redis(config[_0x6819('0xa')]));require(_0x6819('0xe'))[_0x6819('0xf')](socket);function respondWithRpcPromise(_0x3a6a81,_0x316aee,_0x4796bf){return new BPromise(function(_0x93d90a,_0x73b413){return client[_0x6819('0x10')](_0x3a6a81,_0x4796bf)['then'](function(_0x109fbc){logger[_0x6819('0x11')](_0x6819('0x12'),_0x316aee,'request\x20sent');logger[_0x6819('0x13')](_0x6819('0x14'),_0x316aee,_0x6819('0x15'),JSON['stringify'](_0x109fbc));if(_0x109fbc[_0x6819('0x16')]){if(_0x109fbc[_0x6819('0x16')][_0x6819('0x17')]===0x1f4){logger[_0x6819('0x16')](_0x6819('0x12'),_0x316aee,_0x109fbc[_0x6819('0x16')][_0x6819('0x18')]);return _0x73b413(_0x109fbc[_0x6819('0x16')]['message']);}logger[_0x6819('0x16')](_0x6819('0x12'),_0x316aee,_0x109fbc['error']['message']);return _0x93d90a(_0x109fbc[_0x6819('0x16')]['message']);}else{logger['info'](_0x6819('0x12'),_0x316aee,_0x6819('0x15'));_0x93d90a(_0x109fbc['result'][_0x6819('0x18')]);}})['catch'](function(_0x376c2a){logger[_0x6819('0x16')](_0x6819('0x12'),_0x316aee,_0x376c2a);_0x73b413(_0x376c2a);});});}exports[_0x6819('0x19')]=function(_0x51ebc8){var _0x7f0c49=this;return new Promise(function(_0x289845,_0x25822d){return db[_0x6819('0x1a')][_0x6819('0x1b')](_0x51ebc8[_0x6819('0x1c')],{'raw':_0x51ebc8[_0x6819('0x1d')]?_0x51ebc8[_0x6819('0x1d')][_0x6819('0x1e')]===undefined?!![]:![]:!![]})[_0x6819('0x1f')](function(_0xf16c81){logger[_0x6819('0x11')](_0x6819('0x19'),_0x51ebc8);logger[_0x6819('0x13')](_0x6819('0x19'),_0x51ebc8,JSON[_0x6819('0x20')](_0xf16c81));_0x289845(_0xf16c81);})[_0x6819('0x21')](function(_0x4bebe1){logger[_0x6819('0x16')](_0x6819('0x19'),_0x4bebe1['message'],_0x51ebc8);_0x25822d(_0x7f0c49['error'](0x1f4,_0x4bebe1[_0x6819('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 3f58efe..18813dd 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 _0xe58a=['./whatsappMessage.events','save','remove','update','removeListener','register','length','whatsappMessage:'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xe58a,0xc8));var _0xae58=function(_0x2f6a50,_0x1c4c8c){_0x2f6a50=_0x2f6a50-0x0;var _0x1a3a6f=_0xe58a[_0x2f6a50];return _0x1a3a6f;};'use strict';var WhatsappMessageEvents=require(_0xae58('0x0'));var events=[_0xae58('0x1'),_0xae58('0x2'),_0xae58('0x3')];function createListener(_0x19cab7,_0x223a3c){return function(_0x3ec59f){_0x223a3c['emit'](_0x19cab7,_0x3ec59f);};}function removeListener(_0x54db3a,_0x294903){return function(){WhatsappMessageEvents[_0xae58('0x4')](_0x54db3a,_0x294903);};}exports[_0xae58('0x5')]=function(_0x3c5f66){for(var _0x48fc47=0x0,_0x5c1b23=events[_0xae58('0x6')];_0x48fc47<_0x5c1b23;_0x48fc47++){var _0x211ac9=events[_0x48fc47];var _0x268231=createListener(_0xae58('0x7')+_0x211ac9,_0x3c5f66);WhatsappMessageEvents['on'](_0x211ac9,_0x268231);}}; \ No newline at end of file +var _0x626d=['length','whatsappMessage:','./whatsappMessage.events','emit','removeListener'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x626d,0x89));var _0xd626=function(_0x290aa2,_0xb99e87){_0x290aa2=_0x290aa2-0x0;var _0x10c5f4=_0x626d[_0x290aa2];return _0x10c5f4;};'use strict';var WhatsappMessageEvents=require(_0xd626('0x0'));var events=['save','remove','update'];function createListener(_0x1ccdbb,_0x594c00){return function(_0x3b0803){_0x594c00[_0xd626('0x1')](_0x1ccdbb,_0x3b0803);};}function removeListener(_0x24e962,_0x278ea4){return function(){WhatsappMessageEvents[_0xd626('0x2')](_0x24e962,_0x278ea4);};}exports['register']=function(_0x25f7ea){for(var _0x1f3b95=0x0,_0xc3878a=events[_0xd626('0x3')];_0x1f3b95<_0xc3878a;_0x1f3b95++){var _0x3d1dcd=events[_0x1f3b95];var _0x5ce73f=createListener(_0xd626('0x4')+_0x3d1dcd,_0x25f7ea);WhatsappMessageEvents['on'](_0x3d1dcd,_0x5ce73f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index d782ce0..64552a4 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 _0x5460=['./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','post','create','addTeams','addAgents','put','update','delete','removeTeams','/:id/users','removeAgents','exports','util','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0xe2494e,_0x3aa732){var _0x3894d6=function(_0x4cc459){while(--_0x4cc459){_0xe2494e['push'](_0xe2494e['shift']());}};_0x3894d6(++_0x3aa732);}(_0x5460,0xda));var _0x0546=function(_0x353736,_0x152ce8){_0x353736=_0x353736-0x0;var _0x585b29=_0x5460[_0x353736];return _0x585b29;};'use strict';var multer=require('multer');var util=require(_0x0546('0x0'));var path=require(_0x0546('0x1'));var timeout=require('connect-timeout');var express=require(_0x0546('0x2'));var router=express[_0x0546('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0546('0x4'));var config=require(_0x0546('0x5'));var controller=require(_0x0546('0x6'));router[_0x0546('0x7')]('/',auth[_0x0546('0x8')](),controller[_0x0546('0x9')]);router[_0x0546('0x7')](_0x0546('0xa'),auth[_0x0546('0x8')](),controller[_0x0546('0xb')]);router[_0x0546('0x7')](_0x0546('0xc'),auth['isAuthenticated'](),controller[_0x0546('0xd')]);router[_0x0546('0x7')](_0x0546('0xe'),auth[_0x0546('0x8')](),controller['getMembers']);router[_0x0546('0x7')](_0x0546('0xf'),auth[_0x0546('0x8')](),controller[_0x0546('0x10')]);router[_0x0546('0x7')]('/:id/users',auth[_0x0546('0x8')](),controller['getAgents']);router[_0x0546('0x11')]('/',auth['isAuthenticated'](),controller[_0x0546('0x12')]);router[_0x0546('0x11')](_0x0546('0xf'),auth[_0x0546('0x8')](),controller[_0x0546('0x13')]);router[_0x0546('0x11')]('/:id/users',auth[_0x0546('0x8')](),controller[_0x0546('0x14')]);router[_0x0546('0x15')](_0x0546('0xc'),auth['isAuthenticated'](),controller[_0x0546('0x16')]);router[_0x0546('0x17')]('/:id',auth[_0x0546('0x8')](),controller['destroy']);router[_0x0546('0x17')](_0x0546('0xf'),auth[_0x0546('0x8')](),controller[_0x0546('0x18')]);router['delete'](_0x0546('0x19'),auth[_0x0546('0x8')](),controller[_0x0546('0x1a')]);module[_0x0546('0x1b')]=router; \ No newline at end of file +var _0xf945=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','getMembers','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','/:id','destroy','/:id/teams','removeTeams','removeAgents'];(function(_0x53e9f9,_0xfe79f9){var _0x46c9f2=function(_0x1ca9a7){while(--_0x1ca9a7){_0x53e9f9['push'](_0x53e9f9['shift']());}};_0x46c9f2(++_0xfe79f9);}(_0xf945,0x1b3));var _0x5f94=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf945[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x5f94('0x0'));var util=require('util');var path=require(_0x5f94('0x1'));var timeout=require(_0x5f94('0x2'));var express=require(_0x5f94('0x3'));var router=express[_0x5f94('0x4')]();var auth=require(_0x5f94('0x5'));var interaction=require(_0x5f94('0x6'));var config=require('../../config/environment');var controller=require(_0x5f94('0x7'));router[_0x5f94('0x8')]('/',auth[_0x5f94('0x9')](),controller[_0x5f94('0xa')]);router[_0x5f94('0x8')]('/describe',auth[_0x5f94('0x9')](),controller[_0x5f94('0xb')]);router[_0x5f94('0x8')]('/:id',auth[_0x5f94('0x9')](),controller[_0x5f94('0xc')]);router['get'](_0x5f94('0xd'),auth[_0x5f94('0x9')](),controller[_0x5f94('0xe')]);router[_0x5f94('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5f94('0xf')]);router[_0x5f94('0x8')]('/:id/users',auth[_0x5f94('0x9')](),controller[_0x5f94('0x10')]);router[_0x5f94('0x11')]('/',auth['isAuthenticated'](),controller[_0x5f94('0x12')]);router[_0x5f94('0x11')]('/:id/teams',auth[_0x5f94('0x9')](),controller[_0x5f94('0x13')]);router[_0x5f94('0x11')](_0x5f94('0x14'),auth[_0x5f94('0x9')](),controller[_0x5f94('0x15')]);router[_0x5f94('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x5f94('0x17')]);router[_0x5f94('0x18')](_0x5f94('0x19'),auth[_0x5f94('0x9')](),controller[_0x5f94('0x1a')]);router[_0x5f94('0x18')](_0x5f94('0x1b'),auth[_0x5f94('0x9')](),controller[_0x5f94('0x1c')]);router[_0x5f94('0x18')]('/:id/users',auth[_0x5f94('0x9')](),controller[_0x5f94('0x1d')]);module[_0x5f94('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index f9348e0..65f626e 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 _0xa0e0=['sequelize','STRING','name','INTEGER','ENUM','roundrobin'];(function(_0x38356a,_0x3efea3){var _0x3cf5e9=function(_0x1b340b){while(--_0x1b340b){_0x38356a['push'](_0x38356a['shift']());}};_0x3cf5e9(++_0x3efea3);}(_0xa0e0,0x198));var _0x0a0e=function(_0x46e809,_0x3f0d4f){_0x46e809=_0x46e809-0x0;var _0x24d877=_0xa0e0[_0x46e809];return _0x24d877;};'use strict';var Sequelize=require(_0x0a0e('0x0'));module['exports']={'name':{'type':Sequelize[_0x0a0e('0x1')],'unique':_0x0a0e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x0a0e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0a0e('0x4')]('rrmemory','beepall',_0x0a0e('0x5'))},'description':{'type':Sequelize[_0x0a0e('0x1')]}}; \ No newline at end of file +var _0x0877=['beepall','roundrobin','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x172d1e,_0x5a0e29){var _0x51448e=function(_0x3de664){while(--_0x3de664){_0x172d1e['push'](_0x172d1e['shift']());}};_0x51448e(++_0x5a0e29);}(_0x0877,0x1c3));var _0x7087=function(_0x535956,_0x411673){_0x535956=_0x535956-0x0;var _0x5b21ab=_0x0877[_0x535956];return _0x5b21ab;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x7087('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7087('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7087('0x2')](_0x7087('0x3'),_0x7087('0x4'),_0x7087('0x5'))},'description':{'type':Sequelize[_0x7087('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index f5963df..7082542 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 _0x04c3=['filters','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filter','where','merge','type','VIRTUAL','findAll','rows','catch','show','params','intersection','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserWhatsappQueue','order','pick','User','findAndCountAll','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','online','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','TeamId','includes','union','removeTeams','isEmpty','emit','userWhatsappQueue:remove','spread','userWhatsappQueue:save','removeAgents','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','destroy','get','UserProfileResource','then','error','name','send','map','WhatsappQueue','rawAttributes','fieldName','key','model','query','keys'];(function(_0x3bf955,_0x2e99ec){var _0x1a47c2=function(_0x20b1a1){while(--_0x20b1a1){_0x3bf955['push'](_0x3bf955['shift']());}};_0x1a47c2(++_0x2e99ec);}(_0x04c3,0x1de));var _0x304c=function(_0x43f390,_0x11bda7){_0x43f390=_0x43f390-0x0;var _0x199a49=_0x04c3[_0x43f390];return _0x199a49;};'use strict';var pdf=require(_0x304c('0x0'));var emlformat=require(_0x304c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x304c('0x2'));var jsonpatch=require(_0x304c('0x3'));var rp=require(_0x304c('0x4'));var moment=require('moment');var BPromise=require(_0x304c('0x5'));var Mustache=require(_0x304c('0x6'));var util=require(_0x304c('0x7'));var path=require('path');var sox=require(_0x304c('0x8'));var csv=require('to-csv');var ejs=require(_0x304c('0x9'));var fs=require('fs');var _=require(_0x304c('0xa'));var squel=require(_0x304c('0xb'));var crypto=require(_0x304c('0xc'));var jsforce=require(_0x304c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x304c('0xe'));var querystring=require(_0x304c('0xf'));var Papa=require(_0x304c('0x10'));var Redis=require(_0x304c('0x11'));var authService=require(_0x304c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x304c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x304c('0x14'))(_0x304c('0x15'));var utils=require(_0x304c('0x16'));var config=require(_0x304c('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x304c('0x18')](config[_0x304c('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x304c('0x1a'))(new Redis(config[_0x304c('0x19')]));require(_0x304c('0x1b'))[_0x304c('0x1c')](socket);function respondWithStatusCode(_0x28ea94,_0x5d9007){_0x5d9007=_0x5d9007||0xcc;return function(_0x4e3c54){if(_0x4e3c54){return _0x28ea94[_0x304c('0x1d')](_0x5d9007);}return _0x28ea94[_0x304c('0x1e')](_0x5d9007)[_0x304c('0x1f')]();};}function respondWithResult(_0x42a4cf,_0x38fd1b){_0x38fd1b=_0x38fd1b||0xc8;return function(_0x175135){if(_0x175135){return _0x42a4cf[_0x304c('0x1e')](_0x38fd1b)[_0x304c('0x20')](_0x175135);}};}function respondWithFilteredResult(_0x401bb3,_0x26a9ae){return function(_0x54ee39){if(_0x54ee39){var _0x1021a9=_0x54ee39[_0x304c('0x21')],_0x42e0c9=_0x26a9ae[_0x304c('0x22')],_0x144171=_0x26a9ae[_0x304c('0x22')]+_0x26a9ae['limit'],_0xf8982a;if(_0x144171>=_0x1021a9){_0x144171=_0x1021a9;_0xf8982a=0xc8;}else{_0xf8982a=0xce;}_0x401bb3['status'](_0xf8982a);return _0x401bb3[_0x304c('0x23')](_0x304c('0x24'),_0x42e0c9+'-'+_0x144171+'/'+_0x1021a9)[_0x304c('0x20')](_0x54ee39);}return null;};}function patchUpdates(_0x4169ab){return function(_0x3df986){try{jsonpatch['apply'](_0x3df986,_0x4169ab,!![]);}catch(_0x4ba41c){return BPromise['reject'](_0x4ba41c);}return _0x3df986[_0x304c('0x25')]();};}function saveUpdates(_0xc80674,_0x451fd3){return function(_0xaf023c){if(_0xaf023c){return _0xaf023c[_0x304c('0x26')](_0xc80674)['then'](function(_0x7aa4f6){return _0x7aa4f6;});}return null;};}function removeEntity(_0xbb1afc,_0xc8bc85){return function(_0xa0f0f9){if(_0xa0f0f9){return _0xa0f0f9[_0x304c('0x27')]()['then'](function(){var _0x2fc648=_0xa0f0f9[_0x304c('0x28')]({'plain':!![]});var _0x2bbfcd='WhatsappQueues';return db[_0x304c('0x29')][_0x304c('0x27')]({'where':{'type':_0x2bbfcd,'resourceId':_0x2fc648['id']}})[_0x304c('0x2a')](function(){return _0xa0f0f9;});})[_0x304c('0x2a')](function(){_0xbb1afc['status'](0xcc)[_0x304c('0x1f')]();});}};}function handleEntityNotFound(_0x4f1026,_0x2d657e){return function(_0x35f378){if(!_0x35f378){_0x4f1026[_0x304c('0x1d')](0x194);}return _0x35f378;};}function handleError(_0x2a6b69,_0x29b869){_0x29b869=_0x29b869||0x1f4;return function(_0x2af762){logger[_0x304c('0x2b')](_0x2af762['stack']);if(_0x2af762['name']){delete _0x2af762[_0x304c('0x2c')];}_0x2a6b69[_0x304c('0x1e')](_0x29b869)[_0x304c('0x2d')](_0x2af762);};}exports['index']=function(_0x2dc298,_0x19c137){var _0x1273c2={},_0x33e9f9={},_0x43d45={'count':0x0,'rows':[]};var _0x24e754=_[_0x304c('0x2e')](db[_0x304c('0x2f')][_0x304c('0x30')],function(_0x10d0cc){return{'name':_0x10d0cc[_0x304c('0x31')],'type':_0x10d0cc['type'][_0x304c('0x32')]};});_0x33e9f9[_0x304c('0x33')]=_[_0x304c('0x2e')](_0x24e754,_0x304c('0x2c'));_0x33e9f9[_0x304c('0x34')]=_[_0x304c('0x35')](_0x2dc298[_0x304c('0x34')]);_0x33e9f9[_0x304c('0x36')]=_['intersection'](_0x33e9f9[_0x304c('0x33')],_0x33e9f9['query']);_0x1273c2[_0x304c('0x37')]=_['intersection'](_0x33e9f9[_0x304c('0x33')],qs[_0x304c('0x38')](_0x2dc298[_0x304c('0x34')][_0x304c('0x38')]));_0x1273c2['attributes']=_0x1273c2[_0x304c('0x37')][_0x304c('0x39')]?_0x1273c2[_0x304c('0x37')]:_0x33e9f9[_0x304c('0x33')];if(!_0x2dc298[_0x304c('0x34')][_0x304c('0x3a')](_0x304c('0x3b'))){_0x1273c2[_0x304c('0x3c')]=qs[_0x304c('0x3c')](_0x2dc298[_0x304c('0x34')]['limit']);_0x1273c2[_0x304c('0x22')]=qs[_0x304c('0x22')](_0x2dc298[_0x304c('0x34')][_0x304c('0x22')]);}_0x1273c2['order']=qs[_0x304c('0x3d')](_0x2dc298['query']['sort']);_0x1273c2['where']=qs[_0x304c('0x36')](_['pick'](_0x2dc298['query'],_0x33e9f9[_0x304c('0x36')]),_0x24e754);if(_0x2dc298[_0x304c('0x34')][_0x304c('0x3e')]){_0x1273c2[_0x304c('0x3f')]=_[_0x304c('0x40')](_0x1273c2[_0x304c('0x3f')],{'$or':_[_0x304c('0x2e')](_0x24e754,function(_0x47bc6d){if(_0x47bc6d[_0x304c('0x41')]!==_0x304c('0x42')){var _0x4fb918={};_0x4fb918[_0x47bc6d[_0x304c('0x2c')]]={'$like':'%'+_0x2dc298[_0x304c('0x34')][_0x304c('0x3e')]+'%'};return _0x4fb918;}})});}_0x1273c2=_[_0x304c('0x40')]({},_0x1273c2,_0x2dc298['options']);var _0x153517={'where':_0x1273c2[_0x304c('0x3f')]};return db['WhatsappQueue'][_0x304c('0x21')](_0x153517)['then'](function(_0x33eb62){_0x43d45[_0x304c('0x21')]=_0x33eb62;if(_0x2dc298[_0x304c('0x34')]['includeAll']){_0x1273c2['include']=[{'all':!![]}];}return db[_0x304c('0x2f')][_0x304c('0x43')](_0x1273c2);})[_0x304c('0x2a')](function(_0x3cf71c){_0x43d45[_0x304c('0x44')]=_0x3cf71c;return _0x43d45;})['then'](respondWithFilteredResult(_0x19c137,_0x1273c2))[_0x304c('0x45')](handleError(_0x19c137,null));};exports[_0x304c('0x46')]=function(_0x3de5cb,_0x58dc16){var _0x5ee7b8={'raw':!![],'where':{'id':_0x3de5cb[_0x304c('0x47')]['id']}},_0x5b20f1={};_0x5b20f1[_0x304c('0x33')]=_[_0x304c('0x35')](db[_0x304c('0x2f')]['rawAttributes']);_0x5b20f1[_0x304c('0x34')]=_[_0x304c('0x35')](_0x3de5cb[_0x304c('0x34')]);_0x5b20f1[_0x304c('0x36')]=_['intersection'](_0x5b20f1[_0x304c('0x33')],_0x5b20f1[_0x304c('0x34')]);_0x5ee7b8[_0x304c('0x37')]=_[_0x304c('0x48')](_0x5b20f1[_0x304c('0x33')],qs[_0x304c('0x38')](_0x3de5cb[_0x304c('0x34')]['fields']));_0x5ee7b8['attributes']=_0x5ee7b8[_0x304c('0x37')][_0x304c('0x39')]?_0x5ee7b8[_0x304c('0x37')]:_0x5b20f1['model'];if(_0x3de5cb[_0x304c('0x34')][_0x304c('0x49')]){_0x5ee7b8[_0x304c('0x4a')]=[{'all':!![]}];}_0x5ee7b8=_[_0x304c('0x40')]({},_0x5ee7b8,_0x3de5cb[_0x304c('0x4b')]);return db[_0x304c('0x2f')][_0x304c('0x4c')](_0x5ee7b8)[_0x304c('0x2a')](handleEntityNotFound(_0x58dc16,null))[_0x304c('0x2a')](respondWithResult(_0x58dc16,null))[_0x304c('0x45')](handleError(_0x58dc16,null));};exports[_0x304c('0x4d')]=function(_0x26cd66,_0x4129bb){return db['WhatsappQueue'][_0x304c('0x4d')](_0x26cd66[_0x304c('0x4e')],{})['then'](function(_0x614c1b){var _0x4a0b85=_0x26cd66[_0x304c('0x4f')][_0x304c('0x28')]({'plain':!![]});if(!_0x4a0b85)throw new Error(_0x304c('0x50'));if(_0x4a0b85[_0x304c('0x51')]===_0x304c('0x4f')){var _0x12dcaa=_0x614c1b[_0x304c('0x28')]({'plain':!![]});var _0x1c4c5a='WhatsappQueues';return db[_0x304c('0x52')][_0x304c('0x4c')]({'where':{'name':_0x1c4c5a,'userProfileId':_0x4a0b85[_0x304c('0x53')]},'raw':!![]})[_0x304c('0x2a')](function(_0x55e57d){if(_0x55e57d&&_0x55e57d[_0x304c('0x54')]===0x0){return db['UserProfileResource'][_0x304c('0x4d')]({'name':_0x12dcaa[_0x304c('0x2c')],'resourceId':_0x12dcaa['id'],'type':_0x55e57d[_0x304c('0x2c')],'sectionId':_0x55e57d['id']},{})[_0x304c('0x2a')](function(){return _0x614c1b;});}else{return _0x614c1b;}})[_0x304c('0x45')](function(_0x133821){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x133821);throw _0x133821;});}return _0x614c1b;})['then'](respondWithResult(_0x4129bb,0xc9))['catch'](handleError(_0x4129bb,null));};exports['update']=function(_0x1a4862,_0x25b099){if(_0x1a4862[_0x304c('0x4e')]['id']){delete _0x1a4862[_0x304c('0x4e')]['id'];}return db[_0x304c('0x2f')][_0x304c('0x4c')]({'where':{'id':_0x1a4862[_0x304c('0x47')]['id']}})[_0x304c('0x2a')](handleEntityNotFound(_0x25b099,null))[_0x304c('0x2a')](saveUpdates(_0x1a4862[_0x304c('0x4e')],null))[_0x304c('0x2a')](respondWithResult(_0x25b099,null))[_0x304c('0x45')](handleError(_0x25b099,null));};exports[_0x304c('0x27')]=function(_0x226655,_0x4fa37e){return db[_0x304c('0x2f')][_0x304c('0x4c')]({'where':{'id':_0x226655[_0x304c('0x47')]['id']}})['then'](handleEntityNotFound(_0x4fa37e,null))[_0x304c('0x2a')](removeEntity(_0x4fa37e,null))[_0x304c('0x45')](handleError(_0x4fa37e,null));};exports[_0x304c('0x55')]=function(_0x2a8214,_0x325645){return db[_0x304c('0x2f')][_0x304c('0x55')]()[_0x304c('0x2a')](respondWithResult(_0x325645,null))[_0x304c('0x45')](handleError(_0x325645,null));};exports[_0x304c('0x56')]=function(_0x5a9d8f,_0x48ebfe,_0x5071db){var _0x3352dd={'raw':!![],'where':{}},_0x19dd38={},_0x539abb;return db[_0x304c('0x2f')][_0x304c('0x57')]({'where':{'id':_0x5a9d8f[_0x304c('0x47')]['id']}})['then'](handleEntityNotFound(_0x48ebfe,null))[_0x304c('0x2a')](function(_0x14f733){if(_0x14f733){_0x539abb=_0x14f733[_0x304c('0x28')]({'plain':!![]});_0x19dd38['model']=_['keys'](db[_0x304c('0x58')][_0x304c('0x30')]);_0x19dd38[_0x304c('0x34')]=_[_0x304c('0x35')](_0x5a9d8f[_0x304c('0x34')]);_0x19dd38['filters']=_[_0x304c('0x48')](_0x19dd38['model'],_0x19dd38[_0x304c('0x34')]);_0x3352dd['attributes']=_[_0x304c('0x48')](_0x19dd38[_0x304c('0x33')],qs[_0x304c('0x38')](_0x5a9d8f['query'][_0x304c('0x38')]));_0x3352dd[_0x304c('0x37')]=_0x3352dd[_0x304c('0x37')][_0x304c('0x39')]?_0x3352dd['attributes']:_0x19dd38[_0x304c('0x33')];if(!_0x5a9d8f[_0x304c('0x34')]['hasOwnProperty'](_0x304c('0x3b'))){_0x3352dd[_0x304c('0x3c')]=qs[_0x304c('0x3c')](_0x5a9d8f[_0x304c('0x34')][_0x304c('0x3c')]);_0x3352dd['offset']=qs['offset'](_0x5a9d8f[_0x304c('0x34')][_0x304c('0x22')]);}_0x3352dd[_0x304c('0x59')]=qs['sort'](_0x5a9d8f[_0x304c('0x34')]['sort']);_0x3352dd[_0x304c('0x3f')]=qs[_0x304c('0x36')](_[_0x304c('0x5a')](_0x5a9d8f[_0x304c('0x34')],_0x19dd38[_0x304c('0x36')]));_0x3352dd[_0x304c('0x3f')]['WhatsappQueueId']=_0x14f733['id'];if(_0x5a9d8f[_0x304c('0x34')]['filter']){_0x3352dd[_0x304c('0x3f')]=_['merge'](_0x3352dd['where'],{'$or':_[_0x304c('0x2e')](_0x3352dd[_0x304c('0x37')],function(_0x31ffa6){var _0xfaeb8b={};_0xfaeb8b[_0x31ffa6]={'$like':'%'+_0x5a9d8f[_0x304c('0x34')][_0x304c('0x3e')]+'%'};return _0xfaeb8b;})});}_0x3352dd=_[_0x304c('0x40')]({},_0x3352dd,_0x5a9d8f[_0x304c('0x4b')]);return db[_0x304c('0x58')]['findAll'](_0x3352dd);}})['then'](function(_0x12886d){if(_0x12886d){return db[_0x304c('0x5b')][_0x304c('0x5c')]({'where':{'id':_[_0x304c('0x2e')](_0x12886d,'UserId'),'role':'agent'},'attributes':['id','name',_0x304c('0x5d'),_0x304c('0x5e'),_0x304c('0x5f')]});}})[_0x304c('0x2a')](function(_0x1d429d){if(_0x1d429d){return{'count':_0x1d429d[_0x304c('0x21')],'rows':_[_0x304c('0x2e')](_0x1d429d[_0x304c('0x44')],function(_0x361b82){return{'membername':_0x361b82[_0x304c('0x2c')],'UserId':_0x361b82['id'],'queue_name':_0x539abb[_0x304c('0x2c')],'WhatsappQueueId':_0x539abb['id'],'interface':util[_0x304c('0x60')]('%s/%s',_0x304c('0x61'),_0x361b82[_0x304c('0x2c')]),'penalty':0x0,'paused':_0x361b82['whatsappPause'],'createdAt':_0x361b82[_0x304c('0x5f')],'updatedAt':_0x361b82['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x48ebfe,_0x3352dd))[_0x304c('0x45')](handleError(_0x48ebfe,null));};exports[_0x304c('0x62')]=function(_0x28a343,_0x372fa2,_0x590ba2){var _0x433a28={};var _0x22ce63={};var _0xdc10ff;var _0x13aa66;return db['WhatsappQueue'][_0x304c('0x57')]({'where':{'id':_0x28a343[_0x304c('0x47')]['id']}})[_0x304c('0x2a')](handleEntityNotFound(_0x372fa2,null))['then'](function(_0x1f33ee){if(_0x1f33ee){_0xdc10ff=_0x1f33ee;_0x22ce63['model']=_[_0x304c('0x35')](db[_0x304c('0x63')][_0x304c('0x30')]);_0x22ce63[_0x304c('0x34')]=_['keys'](_0x28a343[_0x304c('0x34')]);_0x22ce63[_0x304c('0x36')]=_[_0x304c('0x48')](_0x22ce63['model'],_0x22ce63[_0x304c('0x34')]);_0x433a28[_0x304c('0x37')]=_[_0x304c('0x48')](_0x22ce63[_0x304c('0x33')],qs[_0x304c('0x38')](_0x28a343[_0x304c('0x34')][_0x304c('0x38')]));_0x433a28['attributes']=_0x433a28[_0x304c('0x37')]['length']?_0x433a28[_0x304c('0x37')]:_0x22ce63[_0x304c('0x33')];_0x433a28[_0x304c('0x59')]=qs[_0x304c('0x3d')](_0x28a343[_0x304c('0x34')][_0x304c('0x3d')]);_0x433a28[_0x304c('0x3f')]=qs[_0x304c('0x36')](_[_0x304c('0x5a')](_0x28a343[_0x304c('0x34')],_0x22ce63[_0x304c('0x36')]));if(_0x28a343['query'][_0x304c('0x3e')]){_0x433a28['where']=_['merge'](_0x433a28[_0x304c('0x3f')],{'$or':_['map'](_0x433a28[_0x304c('0x37')],function(_0x27a3de){var _0x549575={};_0x549575[_0x27a3de]={'$like':'%'+_0x28a343[_0x304c('0x34')][_0x304c('0x3e')]+'%'};return _0x549575;})});}_0x433a28=_[_0x304c('0x40')]({},_0x433a28,_0x28a343[_0x304c('0x4b')]);return _0xdc10ff['getTeams'](_0x433a28);}})[_0x304c('0x2a')](function(_0x2322e6){if(_0x2322e6){_0x13aa66=_0x2322e6[_0x304c('0x39')];if(!_0x28a343['query'][_0x304c('0x3a')]('nolimit')){_0x433a28['limit']=qs[_0x304c('0x3c')](_0x28a343[_0x304c('0x34')][_0x304c('0x3c')]);_0x433a28['offset']=qs[_0x304c('0x22')](_0x28a343[_0x304c('0x34')][_0x304c('0x22')]);}return _0xdc10ff['getTeams'](_0x433a28);}})[_0x304c('0x2a')](function(_0x6608c9){if(_0x6608c9){return _0x6608c9?{'count':_0x13aa66,'rows':_0x6608c9}:null;}})['then'](respondWithResult(_0x372fa2,null))[_0x304c('0x45')](handleError(_0x372fa2,null));};exports[_0x304c('0x64')]=function(_0x4e8072,_0xf8da,_0x18ab31){var _0x32eff9=_0x4e8072['body'][_0x304c('0x65')];return db[_0x304c('0x63')][_0x304c('0x43')]({'where':{'id':_0x32eff9},'attributes':['id'],'include':[{'model':db[_0x304c('0x5b')],'as':'Agents','attributes':['id',_0x304c('0x2c'),_0x304c('0x66'),'voicePause','interface'],'raw':!![]}]})[_0x304c('0x2a')](function(_0x34acf1){if(_0x34acf1){var _0x2d290d=_[_0x304c('0x67')](_0x34acf1,function(_0xa9baaf){var _0x1c969d=_0xa9baaf[_0x304c('0x28')]({'plain':!![]});return _0x1c969d[_0x304c('0x68')];});return db[_0x304c('0x2f')][_0x304c('0x4c')]({'where':{'id':_0x4e8072['params']['id']}})['then'](function(_0x28a8df){return db[_0x304c('0x69')][_0x304c('0x6a')](function(_0x6283c1){return _0x28a8df[_0x304c('0x64')](_0x32eff9,{'transaction':_0x6283c1})[_0x304c('0x2a')](function(){return BPromise['each'](_0x2d290d,function(_0x20a883){return db[_0x304c('0x58')][_0x304c('0x6b')]({'where':{'UserId':_0x20a883['id'],'WhatsappQueueId':_0x4e8072['params']['id']},'transaction':_0x6283c1});});})[_0x304c('0x2a')](function(){_0x2d290d[_0x304c('0x6c')](function(_0x27e3cc){socket['emit']('userWhatsappQueue:save',{'UserId':_0x27e3cc['id'],'WhatsappQueueId':_0x28a8df['id']});});});});});}})[_0x304c('0x2a')](respondWithStatusCode(_0xf8da,null))[_0x304c('0x45')](handleError(_0xf8da,null));};exports['removeTeams']=function(_0x39d96a,_0x1d71c8,_0x75f675){return db[_0x304c('0x63')][_0x304c('0x43')]({'where':{'id':_0x39d96a[_0x304c('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x304c('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1d71c8,null))['then'](function(_0x31e9c4){var _0x1afdeb=_[_0x304c('0x2e')](_0x31e9c4,'id');var _0x33c05=[];var _0x530dd0=[];var _0x50b7f7=squel[_0x304c('0x6d')]();_0x50b7f7[_0x304c('0x6e')](_0x304c('0x6f'))[_0x304c('0x70')](_0x304c('0x71'),'tq')[_0x304c('0x72')]('user_has_teams','ut',_0x304c('0x73'))['where'](_0x304c('0x74'),_0x39d96a[_0x304c('0x47')]['id']);for(var _0x52ac95=0x0;_0x52ac95<_0x31e9c4[_0x304c('0x39')];_0x52ac95+=0x1){let _0x4d2d1b=_0x31e9c4[_0x52ac95];for(var _0x35f01d=0x0;_0x35f01d<_0x4d2d1b['Agents'][_0x304c('0x39')];_0x35f01d+=0x1){let _0x5b7852=_0x4d2d1b[_0x304c('0x68')][_0x35f01d];var _0x5b2b26=_0x50b7f7[_0x304c('0x75')]();_0x5b2b26['where'](_0x304c('0x76'),_0x5b7852['id']);_0x530dd0['push'](db['sequelize'][_0x304c('0x34')](_0x5b2b26[_0x304c('0x77')](),{'type':db[_0x304c('0x69')]['QueryTypes'][_0x304c('0x78')]})['then'](function(_0x4c85d6){if(_0x4c85d6[_0x304c('0x39')]===0x1){return _0x5b7852['id'];}else{var _0x39e642=_['every'](_[_0x304c('0x2e')](_0x4c85d6,_0x304c('0x79')),function(_0x492b7a){return _[_0x304c('0x7a')](_0x1afdeb,_0x492b7a);});if(_0x39e642){return _0x5b7852['id'];}}}));}}return BPromise['all'](_0x530dd0)[_0x304c('0x2a')](function(_0xd67890){_0x33c05=_(_0x33c05)[_0x304c('0x7b')](_0xd67890)['compact']()['value']();return db['WhatsappQueue']['find']({'where':{'id':_0x39d96a[_0x304c('0x47')]['id']}})[_0x304c('0x2a')](function(_0x2f3935){return db[_0x304c('0x69')][_0x304c('0x6a')](function(_0x6b0f5d){return _0x2f3935[_0x304c('0x7c')](_0x39d96a['query'][_0x304c('0x65')],{'transaction':_0x6b0f5d})[_0x304c('0x2a')](function(){if(!_[_0x304c('0x7d')](_0x33c05)){return _0x2f3935['removeAgents'](_0x33c05,{'transaction':_0x6b0f5d});}})[_0x304c('0x2a')](function(){_0x33c05[_0x304c('0x6c')](function(_0x33dd10){socket[_0x304c('0x7e')](_0x304c('0x7f'),{'UserId':_0x33dd10,'WhatsappQueueId':_0x2f3935['id']});});});});});});})[_0x304c('0x2a')](respondWithStatusCode(_0x1d71c8,null))[_0x304c('0x45')](handleError(_0x1d71c8,null));};exports['addAgents']=function(_0x21df9c,_0x453e26,_0x2f896c){return db[_0x304c('0x2f')]['find']({'where':{'id':_0x21df9c[_0x304c('0x47')]['id']}})[_0x304c('0x2a')](handleEntityNotFound(_0x453e26,null))['then'](function(_0x5b742a){if(_0x5b742a){return _0x5b742a['addAgents'](_0x21df9c[_0x304c('0x4e')][_0x304c('0x65')],_['omit'](_0x21df9c['body'],['ids','id'])||{})[_0x304c('0x80')](function(_0x1986bc){for(var _0xfa9b3a=0x0;_0xfa9b3a<_0x21df9c['body'][_0x304c('0x65')][_0x304c('0x39')];_0xfa9b3a+=0x1){socket[_0x304c('0x7e')](_0x304c('0x81'),{'UserId':_0x21df9c['body']['ids'][_0xfa9b3a],'WhatsappQueueId':_0x21df9c[_0x304c('0x47')]['id']});}return _0x1986bc;});}})[_0x304c('0x2a')](respondWithResult(_0x453e26,null))[_0x304c('0x45')](handleError(_0x453e26,null));};exports[_0x304c('0x82')]=function(_0x1a596c,_0x99b555,_0x3326a2){return db[_0x304c('0x2f')][_0x304c('0x4c')]({'where':{'id':_0x1a596c['params']['id']}})[_0x304c('0x2a')](handleEntityNotFound(_0x99b555,null))[_0x304c('0x2a')](function(_0x1ea009){if(_0x1ea009){return _0x1ea009[_0x304c('0x82')](_0x1a596c[_0x304c('0x34')][_0x304c('0x65')])[_0x304c('0x2a')](function(){if(_[_0x304c('0x83')](_0x1a596c[_0x304c('0x34')]['ids'])){for(var _0x2adf6b=0x0;_0x2adf6b<_0x1a596c['query'][_0x304c('0x65')]['length'];_0x2adf6b+=0x1){socket['emit'](_0x304c('0x7f'),{'UserId':Number(_0x1a596c['query'][_0x304c('0x65')][_0x2adf6b]),'WhatsappQueueId':Number(_0x1a596c[_0x304c('0x47')]['id'])});}}else{socket['emit'](_0x304c('0x7f'),{'UserId':Number(_0x1a596c['query'][_0x304c('0x65')]),'WhatsappQueueId':Number(_0x1a596c[_0x304c('0x47')]['id'])});}});}})[_0x304c('0x2a')](respondWithStatusCode(_0x99b555,null))[_0x304c('0x45')](handleError(_0x99b555,null));};exports[_0x304c('0x84')]=function(_0x1a3168,_0x382996,_0x5c45e7){var _0x4569fd={};var _0x387f82={};var _0x4f6c97;var _0x323ac7;return db[_0x304c('0x2f')]['findOne']({'where':{'id':_0x1a3168[_0x304c('0x47')]['id']}})['then'](handleEntityNotFound(_0x382996,null))['then'](function(_0x487eee){if(_0x487eee){_0x4f6c97=_0x487eee;_0x387f82['model']=_[_0x304c('0x35')](db[_0x304c('0x5b')]['rawAttributes']);_0x387f82['query']=_[_0x304c('0x35')](_0x1a3168['query']);_0x387f82[_0x304c('0x36')]=_[_0x304c('0x48')](_0x387f82[_0x304c('0x33')],_0x387f82['query']);_0x4569fd[_0x304c('0x37')]=_[_0x304c('0x48')](_0x387f82[_0x304c('0x33')],qs[_0x304c('0x38')](_0x1a3168['query'][_0x304c('0x38')]));_0x4569fd[_0x304c('0x37')]=_0x4569fd[_0x304c('0x37')][_0x304c('0x39')]?_0x4569fd['attributes']:_0x387f82[_0x304c('0x33')];_0x4569fd[_0x304c('0x59')]=qs[_0x304c('0x3d')](_0x1a3168[_0x304c('0x34')]['sort']);_0x4569fd[_0x304c('0x3f')]=qs[_0x304c('0x36')](_['pick'](_0x1a3168[_0x304c('0x34')],_0x387f82[_0x304c('0x36')]));if(_0x1a3168['query'][_0x304c('0x3e')]){_0x4569fd[_0x304c('0x3f')]=_[_0x304c('0x40')](_0x4569fd[_0x304c('0x3f')],{'$or':_[_0x304c('0x2e')](_0x4569fd['attributes'],function(_0x329e2f){var _0x528317={};_0x528317[_0x329e2f]={'$like':'%'+_0x1a3168[_0x304c('0x34')][_0x304c('0x3e')]+'%'};return _0x528317;})});}_0x4569fd=_[_0x304c('0x40')]({},_0x4569fd,_0x1a3168['options']);return _0x4f6c97[_0x304c('0x84')](_0x4569fd);}})['then'](function(_0x923e1a){if(_0x923e1a){_0x323ac7=_0x923e1a[_0x304c('0x39')];if(!_0x1a3168[_0x304c('0x34')]['hasOwnProperty'](_0x304c('0x3b'))){_0x4569fd[_0x304c('0x3c')]=qs[_0x304c('0x3c')](_0x1a3168[_0x304c('0x34')][_0x304c('0x3c')]);_0x4569fd[_0x304c('0x22')]=qs[_0x304c('0x22')](_0x1a3168[_0x304c('0x34')][_0x304c('0x22')]);}return _0x4f6c97['getAgents'](_0x4569fd);}})[_0x304c('0x2a')](function(_0x38e2be){if(_0x38e2be){return _0x38e2be?{'count':_0x323ac7,'rows':_0x38e2be}:null;}})['then'](respondWithResult(_0x382996,null))[_0x304c('0x45')](handleError(_0x382996,null));}; \ No newline at end of file +var _0x3610=['where','filter','merge','options','count','includeAll','include','findAll','rows','params','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','findOne','UserWhatsappQueue','order','pick','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','SIP','createdAt','getTeams','Team','ids','Agents','online','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','removeTeams','isEmpty','emit','userWhatsappQueue:remove','addAgents','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','offset','limit','status','Content-Range','apply','reject','save','update','then','get','WhatsappQueues','UserProfileResource','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0x5e1a1e,_0x296c9b){var _0x45b105=function(_0x4867d3){while(--_0x4867d3){_0x5e1a1e['push'](_0x5e1a1e['shift']());}};_0x45b105(++_0x296c9b);}(_0x3610,0x156));var _0x0361=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x3610[_0x4b2436];return _0x4f5ab2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0361('0x0'));var rimraf=require(_0x0361('0x1'));var zipdir=require(_0x0361('0x2'));var jsonpatch=require(_0x0361('0x3'));var rp=require(_0x0361('0x4'));var moment=require(_0x0361('0x5'));var BPromise=require(_0x0361('0x6'));var Mustache=require(_0x0361('0x7'));var util=require(_0x0361('0x8'));var path=require(_0x0361('0x9'));var sox=require(_0x0361('0xa'));var csv=require(_0x0361('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0361('0xc'));var squel=require(_0x0361('0xd'));var crypto=require('crypto');var jsforce=require(_0x0361('0xe'));var deskjs=require(_0x0361('0xf'));var toCsv=require(_0x0361('0xb'));var querystring=require(_0x0361('0x10'));var Papa=require(_0x0361('0x11'));var Redis=require(_0x0361('0x12'));var authService=require(_0x0361('0x13'));var qs=require(_0x0361('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0361('0x15'));var config=require(_0x0361('0x16'));var db=require(_0x0361('0x17'))['db'];config[_0x0361('0x18')]=_[_0x0361('0x19')](config[_0x0361('0x18')],{'host':_0x0361('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0361('0x18')]));require('./whatsappQueue.socket')[_0x0361('0x1b')](socket);function respondWithStatusCode(_0x249ab0,_0x44eeaf){_0x44eeaf=_0x44eeaf||0xcc;return function(_0x1abb56){if(_0x1abb56){return _0x249ab0[_0x0361('0x1c')](_0x44eeaf);}return _0x249ab0['status'](_0x44eeaf)[_0x0361('0x1d')]();};}function respondWithResult(_0x102b0c,_0x13dd4c){_0x13dd4c=_0x13dd4c||0xc8;return function(_0x3e01b8){if(_0x3e01b8){return _0x102b0c['status'](_0x13dd4c)['json'](_0x3e01b8);}};}function respondWithFilteredResult(_0x1644f3,_0x27a477){return function(_0x1264ff){if(_0x1264ff){var _0x1b7721=_0x1264ff['count'],_0x47948f=_0x27a477[_0x0361('0x1e')],_0x5d12f1=_0x27a477[_0x0361('0x1e')]+_0x27a477[_0x0361('0x1f')],_0x261fa5;if(_0x5d12f1>=_0x1b7721){_0x5d12f1=_0x1b7721;_0x261fa5=0xc8;}else{_0x261fa5=0xce;}_0x1644f3[_0x0361('0x20')](_0x261fa5);return _0x1644f3['set'](_0x0361('0x21'),_0x47948f+'-'+_0x5d12f1+'/'+_0x1b7721)['json'](_0x1264ff);}return null;};}function patchUpdates(_0x1e057e){return function(_0x53e2b6){try{jsonpatch[_0x0361('0x22')](_0x53e2b6,_0x1e057e,!![]);}catch(_0x23be10){return BPromise[_0x0361('0x23')](_0x23be10);}return _0x53e2b6[_0x0361('0x24')]();};}function saveUpdates(_0xbc87fd,_0x2f8131){return function(_0x444996){if(_0x444996){return _0x444996[_0x0361('0x25')](_0xbc87fd)['then'](function(_0x1ce093){return _0x1ce093;});}return null;};}function removeEntity(_0x99de02,_0x56c972){return function(_0xa56148){if(_0xa56148){return _0xa56148['destroy']()[_0x0361('0x26')](function(){var _0x112a7a=_0xa56148[_0x0361('0x27')]({'plain':!![]});var _0x5077b4=_0x0361('0x28');return db[_0x0361('0x29')]['destroy']({'where':{'type':_0x5077b4,'resourceId':_0x112a7a['id']}})[_0x0361('0x26')](function(){return _0xa56148;});})[_0x0361('0x26')](function(){_0x99de02['status'](0xcc)[_0x0361('0x1d')]();});}};}function handleEntityNotFound(_0x5b516f,_0x488bc5){return function(_0x56a357){if(!_0x56a357){_0x5b516f[_0x0361('0x1c')](0x194);}return _0x56a357;};}function handleError(_0x1b5607,_0x149c38){_0x149c38=_0x149c38||0x1f4;return function(_0x7bb949){logger[_0x0361('0x2a')](_0x7bb949[_0x0361('0x2b')]);if(_0x7bb949[_0x0361('0x2c')]){delete _0x7bb949[_0x0361('0x2c')];}_0x1b5607[_0x0361('0x20')](_0x149c38)['send'](_0x7bb949);};}exports[_0x0361('0x2d')]=function(_0x548db3,_0x358a8d){var _0x1b592d={},_0x3d3857={},_0x32f6c8={'count':0x0,'rows':[]};var _0x3ef487=_[_0x0361('0x2e')](db[_0x0361('0x2f')][_0x0361('0x30')],function(_0xa306b0){return{'name':_0xa306b0[_0x0361('0x31')],'type':_0xa306b0[_0x0361('0x32')][_0x0361('0x33')]};});_0x3d3857[_0x0361('0x34')]=_[_0x0361('0x2e')](_0x3ef487,'name');_0x3d3857[_0x0361('0x35')]=_[_0x0361('0x36')](_0x548db3[_0x0361('0x35')]);_0x3d3857[_0x0361('0x37')]=_[_0x0361('0x38')](_0x3d3857[_0x0361('0x34')],_0x3d3857['query']);_0x1b592d['attributes']=_[_0x0361('0x38')](_0x3d3857[_0x0361('0x34')],qs[_0x0361('0x39')](_0x548db3['query'][_0x0361('0x39')]));_0x1b592d[_0x0361('0x3a')]=_0x1b592d[_0x0361('0x3a')][_0x0361('0x3b')]?_0x1b592d[_0x0361('0x3a')]:_0x3d3857[_0x0361('0x34')];if(!_0x548db3[_0x0361('0x35')][_0x0361('0x3c')](_0x0361('0x3d'))){_0x1b592d[_0x0361('0x1f')]=qs[_0x0361('0x1f')](_0x548db3[_0x0361('0x35')][_0x0361('0x1f')]);_0x1b592d['offset']=qs[_0x0361('0x1e')](_0x548db3[_0x0361('0x35')][_0x0361('0x1e')]);}_0x1b592d['order']=qs[_0x0361('0x3e')](_0x548db3[_0x0361('0x35')][_0x0361('0x3e')]);_0x1b592d[_0x0361('0x3f')]=qs[_0x0361('0x37')](_['pick'](_0x548db3[_0x0361('0x35')],_0x3d3857[_0x0361('0x37')]),_0x3ef487);if(_0x548db3[_0x0361('0x35')][_0x0361('0x40')]){_0x1b592d[_0x0361('0x3f')]=_['merge'](_0x1b592d['where'],{'$or':_[_0x0361('0x2e')](_0x3ef487,function(_0x27bb78){if(_0x27bb78[_0x0361('0x32')]!=='VIRTUAL'){var _0x518547={};_0x518547[_0x27bb78[_0x0361('0x2c')]]={'$like':'%'+_0x548db3[_0x0361('0x35')][_0x0361('0x40')]+'%'};return _0x518547;}})});}_0x1b592d=_[_0x0361('0x41')]({},_0x1b592d,_0x548db3[_0x0361('0x42')]);var _0x488f10={'where':_0x1b592d[_0x0361('0x3f')]};return db[_0x0361('0x2f')][_0x0361('0x43')](_0x488f10)[_0x0361('0x26')](function(_0x4ee626){_0x32f6c8[_0x0361('0x43')]=_0x4ee626;if(_0x548db3[_0x0361('0x35')][_0x0361('0x44')]){_0x1b592d[_0x0361('0x45')]=[{'all':!![]}];}return db[_0x0361('0x2f')][_0x0361('0x46')](_0x1b592d);})[_0x0361('0x26')](function(_0x18b798){_0x32f6c8[_0x0361('0x47')]=_0x18b798;return _0x32f6c8;})[_0x0361('0x26')](respondWithFilteredResult(_0x358a8d,_0x1b592d))['catch'](handleError(_0x358a8d,null));};exports['show']=function(_0x2353b7,_0x200d78){var _0x2a5b2f={'raw':!![],'where':{'id':_0x2353b7[_0x0361('0x48')]['id']}},_0x24a18e={};_0x24a18e[_0x0361('0x34')]=_['keys'](db[_0x0361('0x2f')]['rawAttributes']);_0x24a18e[_0x0361('0x35')]=_[_0x0361('0x36')](_0x2353b7['query']);_0x24a18e['filters']=_[_0x0361('0x38')](_0x24a18e['model'],_0x24a18e['query']);_0x2a5b2f[_0x0361('0x3a')]=_[_0x0361('0x38')](_0x24a18e['model'],qs[_0x0361('0x39')](_0x2353b7['query'][_0x0361('0x39')]));_0x2a5b2f[_0x0361('0x3a')]=_0x2a5b2f['attributes'][_0x0361('0x3b')]?_0x2a5b2f[_0x0361('0x3a')]:_0x24a18e['model'];if(_0x2353b7[_0x0361('0x35')][_0x0361('0x44')]){_0x2a5b2f[_0x0361('0x45')]=[{'all':!![]}];}_0x2a5b2f=_['merge']({},_0x2a5b2f,_0x2353b7[_0x0361('0x42')]);return db[_0x0361('0x2f')][_0x0361('0x49')](_0x2a5b2f)[_0x0361('0x26')](handleEntityNotFound(_0x200d78,null))[_0x0361('0x26')](respondWithResult(_0x200d78,null))[_0x0361('0x4a')](handleError(_0x200d78,null));};exports[_0x0361('0x4b')]=function(_0x37d708,_0x15f6f7){return db[_0x0361('0x2f')][_0x0361('0x4b')](_0x37d708['body'],{})[_0x0361('0x26')](function(_0x93ab23){var _0xb055d3=_0x37d708[_0x0361('0x4c')]['get']({'plain':!![]});if(!_0xb055d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb055d3[_0x0361('0x4d')]===_0x0361('0x4c')){var _0x210c4f=_0x93ab23[_0x0361('0x27')]({'plain':!![]});var _0x3efbb0=_0x0361('0x28');return db[_0x0361('0x4e')]['find']({'where':{'name':_0x3efbb0,'userProfileId':_0xb055d3[_0x0361('0x4f')]},'raw':!![]})[_0x0361('0x26')](function(_0x423b1f){if(_0x423b1f&&_0x423b1f[_0x0361('0x50')]===0x0){return db[_0x0361('0x29')][_0x0361('0x4b')]({'name':_0x210c4f[_0x0361('0x2c')],'resourceId':_0x210c4f['id'],'type':_0x423b1f[_0x0361('0x2c')],'sectionId':_0x423b1f['id']},{})[_0x0361('0x26')](function(){return _0x93ab23;});}else{return _0x93ab23;}})[_0x0361('0x4a')](function(_0x414896){logger['error'](_0x0361('0x51'),_0x414896);throw _0x414896;});}return _0x93ab23;})['then'](respondWithResult(_0x15f6f7,0xc9))[_0x0361('0x4a')](handleError(_0x15f6f7,null));};exports['update']=function(_0x542aae,_0x549552){if(_0x542aae[_0x0361('0x52')]['id']){delete _0x542aae['body']['id'];}return db[_0x0361('0x2f')]['find']({'where':{'id':_0x542aae[_0x0361('0x48')]['id']}})['then'](handleEntityNotFound(_0x549552,null))[_0x0361('0x26')](saveUpdates(_0x542aae[_0x0361('0x52')],null))[_0x0361('0x26')](respondWithResult(_0x549552,null))[_0x0361('0x4a')](handleError(_0x549552,null));};exports[_0x0361('0x53')]=function(_0x23619f,_0x5d5a49){return db[_0x0361('0x2f')][_0x0361('0x49')]({'where':{'id':_0x23619f[_0x0361('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d5a49,null))[_0x0361('0x26')](removeEntity(_0x5d5a49,null))[_0x0361('0x4a')](handleError(_0x5d5a49,null));};exports['describe']=function(_0x12a491,_0x2b8aae){return db['WhatsappQueue'][_0x0361('0x54')]()[_0x0361('0x26')](respondWithResult(_0x2b8aae,null))[_0x0361('0x4a')](handleError(_0x2b8aae,null));};exports['getMembers']=function(_0x4f87cd,_0x3ca981,_0x287fbe){var _0x1e3a2d={'raw':!![],'where':{}},_0x1a058a={},_0x75e0f8;return db[_0x0361('0x2f')][_0x0361('0x55')]({'where':{'id':_0x4f87cd[_0x0361('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ca981,null))[_0x0361('0x26')](function(_0xae83de){if(_0xae83de){_0x75e0f8=_0xae83de[_0x0361('0x27')]({'plain':!![]});_0x1a058a['model']=_[_0x0361('0x36')](db[_0x0361('0x56')]['rawAttributes']);_0x1a058a['query']=_['keys'](_0x4f87cd[_0x0361('0x35')]);_0x1a058a[_0x0361('0x37')]=_[_0x0361('0x38')](_0x1a058a[_0x0361('0x34')],_0x1a058a[_0x0361('0x35')]);_0x1e3a2d[_0x0361('0x3a')]=_['intersection'](_0x1a058a[_0x0361('0x34')],qs[_0x0361('0x39')](_0x4f87cd[_0x0361('0x35')]['fields']));_0x1e3a2d['attributes']=_0x1e3a2d[_0x0361('0x3a')]['length']?_0x1e3a2d[_0x0361('0x3a')]:_0x1a058a[_0x0361('0x34')];if(!_0x4f87cd[_0x0361('0x35')][_0x0361('0x3c')](_0x0361('0x3d'))){_0x1e3a2d[_0x0361('0x1f')]=qs[_0x0361('0x1f')](_0x4f87cd[_0x0361('0x35')][_0x0361('0x1f')]);_0x1e3a2d[_0x0361('0x1e')]=qs[_0x0361('0x1e')](_0x4f87cd[_0x0361('0x35')][_0x0361('0x1e')]);}_0x1e3a2d[_0x0361('0x57')]=qs[_0x0361('0x3e')](_0x4f87cd[_0x0361('0x35')][_0x0361('0x3e')]);_0x1e3a2d['where']=qs['filters'](_[_0x0361('0x58')](_0x4f87cd[_0x0361('0x35')],_0x1a058a['filters']));_0x1e3a2d[_0x0361('0x3f')][_0x0361('0x59')]=_0xae83de['id'];if(_0x4f87cd['query']['filter']){_0x1e3a2d['where']=_[_0x0361('0x41')](_0x1e3a2d[_0x0361('0x3f')],{'$or':_[_0x0361('0x2e')](_0x1e3a2d[_0x0361('0x3a')],function(_0xdfd05a){var _0xe2bb2b={};_0xe2bb2b[_0xdfd05a]={'$like':'%'+_0x4f87cd[_0x0361('0x35')]['filter']+'%'};return _0xe2bb2b;})});}_0x1e3a2d=_[_0x0361('0x41')]({},_0x1e3a2d,_0x4f87cd['options']);return db['UserWhatsappQueue'][_0x0361('0x46')](_0x1e3a2d);}})[_0x0361('0x26')](function(_0x1e0318){if(_0x1e0318){return db[_0x0361('0x5a')][_0x0361('0x5b')]({'where':{'id':_[_0x0361('0x2e')](_0x1e0318,_0x0361('0x5c')),'role':_0x0361('0x5d')},'attributes':['id',_0x0361('0x2c'),_0x0361('0x5e'),_0x0361('0x5f'),'createdAt']});}})[_0x0361('0x26')](function(_0x16df31){if(_0x16df31){return{'count':_0x16df31[_0x0361('0x43')],'rows':_[_0x0361('0x2e')](_0x16df31[_0x0361('0x47')],function(_0x29d4f1){return{'membername':_0x29d4f1[_0x0361('0x2c')],'UserId':_0x29d4f1['id'],'queue_name':_0x75e0f8['name'],'WhatsappQueueId':_0x75e0f8['id'],'interface':util['format']('%s/%s',_0x0361('0x60'),_0x29d4f1['name']),'penalty':0x0,'paused':_0x29d4f1[_0x0361('0x5e')],'createdAt':_0x29d4f1[_0x0361('0x61')],'updatedAt':_0x29d4f1[_0x0361('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0361('0x26')](respondWithFilteredResult(_0x3ca981,_0x1e3a2d))[_0x0361('0x4a')](handleError(_0x3ca981,null));};exports[_0x0361('0x62')]=function(_0x2ad86e,_0x4bdbbe,_0x31ff8c){var _0x52897b={};var _0x45df79={};var _0x24403b;var _0x233f4e;return db[_0x0361('0x2f')][_0x0361('0x55')]({'where':{'id':_0x2ad86e[_0x0361('0x48')]['id']}})[_0x0361('0x26')](handleEntityNotFound(_0x4bdbbe,null))[_0x0361('0x26')](function(_0x1f8200){if(_0x1f8200){_0x24403b=_0x1f8200;_0x45df79[_0x0361('0x34')]=_[_0x0361('0x36')](db[_0x0361('0x63')][_0x0361('0x30')]);_0x45df79[_0x0361('0x35')]=_['keys'](_0x2ad86e[_0x0361('0x35')]);_0x45df79['filters']=_['intersection'](_0x45df79['model'],_0x45df79[_0x0361('0x35')]);_0x52897b[_0x0361('0x3a')]=_[_0x0361('0x38')](_0x45df79[_0x0361('0x34')],qs[_0x0361('0x39')](_0x2ad86e[_0x0361('0x35')]['fields']));_0x52897b[_0x0361('0x3a')]=_0x52897b[_0x0361('0x3a')][_0x0361('0x3b')]?_0x52897b['attributes']:_0x45df79['model'];_0x52897b['order']=qs[_0x0361('0x3e')](_0x2ad86e[_0x0361('0x35')][_0x0361('0x3e')]);_0x52897b[_0x0361('0x3f')]=qs[_0x0361('0x37')](_['pick'](_0x2ad86e[_0x0361('0x35')],_0x45df79[_0x0361('0x37')]));if(_0x2ad86e[_0x0361('0x35')][_0x0361('0x40')]){_0x52897b[_0x0361('0x3f')]=_[_0x0361('0x41')](_0x52897b[_0x0361('0x3f')],{'$or':_['map'](_0x52897b[_0x0361('0x3a')],function(_0x5d550e){var _0x4427ec={};_0x4427ec[_0x5d550e]={'$like':'%'+_0x2ad86e['query']['filter']+'%'};return _0x4427ec;})});}_0x52897b=_[_0x0361('0x41')]({},_0x52897b,_0x2ad86e['options']);return _0x24403b[_0x0361('0x62')](_0x52897b);}})[_0x0361('0x26')](function(_0x324c26){if(_0x324c26){_0x233f4e=_0x324c26['length'];if(!_0x2ad86e[_0x0361('0x35')][_0x0361('0x3c')](_0x0361('0x3d'))){_0x52897b[_0x0361('0x1f')]=qs['limit'](_0x2ad86e[_0x0361('0x35')][_0x0361('0x1f')]);_0x52897b['offset']=qs[_0x0361('0x1e')](_0x2ad86e[_0x0361('0x35')]['offset']);}return _0x24403b[_0x0361('0x62')](_0x52897b);}})[_0x0361('0x26')](function(_0x7ee508){if(_0x7ee508){return _0x7ee508?{'count':_0x233f4e,'rows':_0x7ee508}:null;}})['then'](respondWithResult(_0x4bdbbe,null))[_0x0361('0x4a')](handleError(_0x4bdbbe,null));};exports['addTeams']=function(_0x1707a1,_0x5b5780,_0x11790f){var _0x3ad098=_0x1707a1[_0x0361('0x52')][_0x0361('0x64')];return db[_0x0361('0x63')][_0x0361('0x46')]({'where':{'id':_0x3ad098},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0361('0x65'),'attributes':['id','name',_0x0361('0x66'),'voicePause',_0x0361('0x67')],'raw':!![]}]})[_0x0361('0x26')](function(_0x44b478){if(_0x44b478){var _0x2c71d6=_['flatMap'](_0x44b478,function(_0x2c4a05){var _0x534fdf=_0x2c4a05[_0x0361('0x27')]({'plain':!![]});return _0x534fdf[_0x0361('0x65')];});return db[_0x0361('0x2f')][_0x0361('0x49')]({'where':{'id':_0x1707a1[_0x0361('0x48')]['id']}})[_0x0361('0x26')](function(_0x344446){return db[_0x0361('0x68')][_0x0361('0x69')](function(_0x5bc4d3){return _0x344446[_0x0361('0x6a')](_0x3ad098,{'transaction':_0x5bc4d3})[_0x0361('0x26')](function(){return BPromise[_0x0361('0x6b')](_0x2c71d6,function(_0x3f7d07){return db['UserWhatsappQueue'][_0x0361('0x6c')]({'where':{'UserId':_0x3f7d07['id'],'WhatsappQueueId':_0x1707a1[_0x0361('0x48')]['id']},'transaction':_0x5bc4d3});});})[_0x0361('0x26')](function(){_0x2c71d6[_0x0361('0x6d')](function(_0x3a88cc){socket['emit'](_0x0361('0x6e'),{'UserId':_0x3a88cc['id'],'WhatsappQueueId':_0x344446['id']});});});});});}})[_0x0361('0x26')](respondWithStatusCode(_0x5b5780,null))['catch'](handleError(_0x5b5780,null));};exports['removeTeams']=function(_0x3d1fd7,_0x3d83eb,_0x4706e6){return db['Team'][_0x0361('0x46')]({'where':{'id':_0x3d1fd7['query'][_0x0361('0x64')]},'attributes':['id'],'include':[{'model':db[_0x0361('0x5a')],'as':_0x0361('0x65'),'attributes':['id'],'raw':!![]}]})[_0x0361('0x26')](handleEntityNotFound(_0x3d83eb,null))[_0x0361('0x26')](function(_0x437dc2){var _0x22dc8d=_[_0x0361('0x2e')](_0x437dc2,'id');var _0x4530fe=[];var _0x458f58=[];var _0xa2b8b2=squel[_0x0361('0x6f')]();_0xa2b8b2[_0x0361('0x70')](_0x0361('0x71'))[_0x0361('0x72')](_0x0361('0x73'),'tq')[_0x0361('0x74')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0361('0x3f')]('WhatsappQueueId\x20=\x20?',_0x3d1fd7[_0x0361('0x48')]['id']);for(var _0x5ec1b8=0x0;_0x5ec1b8<_0x437dc2['length'];_0x5ec1b8+=0x1){let _0x133099=_0x437dc2[_0x5ec1b8];for(var _0x2444aa=0x0;_0x2444aa<_0x133099[_0x0361('0x65')][_0x0361('0x3b')];_0x2444aa+=0x1){let _0x3e160b=_0x133099['Agents'][_0x2444aa];var _0x9d2538=_0xa2b8b2[_0x0361('0x75')]();_0x9d2538[_0x0361('0x3f')](_0x0361('0x76'),_0x3e160b['id']);_0x458f58[_0x0361('0x77')](db[_0x0361('0x68')][_0x0361('0x35')](_0x9d2538[_0x0361('0x78')](),{'type':db[_0x0361('0x68')][_0x0361('0x79')][_0x0361('0x7a')]})['then'](function(_0x253963){if(_0x253963[_0x0361('0x3b')]===0x1){return _0x3e160b['id'];}else{var _0x1b8bc3=_['every'](_[_0x0361('0x2e')](_0x253963,_0x0361('0x7b')),function(_0xab5ae4){return _[_0x0361('0x7c')](_0x22dc8d,_0xab5ae4);});if(_0x1b8bc3){return _0x3e160b['id'];}}}));}}return BPromise[_0x0361('0x7d')](_0x458f58)[_0x0361('0x26')](function(_0x40bb11){_0x4530fe=_(_0x4530fe)[_0x0361('0x7e')](_0x40bb11)['compact']()['value']();return db['WhatsappQueue'][_0x0361('0x49')]({'where':{'id':_0x3d1fd7[_0x0361('0x48')]['id']}})['then'](function(_0x5e7705){return db['sequelize'][_0x0361('0x69')](function(_0x639f2b){return _0x5e7705[_0x0361('0x7f')](_0x3d1fd7[_0x0361('0x35')]['ids'],{'transaction':_0x639f2b})['then'](function(){if(!_[_0x0361('0x80')](_0x4530fe)){return _0x5e7705['removeAgents'](_0x4530fe,{'transaction':_0x639f2b});}})[_0x0361('0x26')](function(){_0x4530fe[_0x0361('0x6d')](function(_0xadafc){socket[_0x0361('0x81')](_0x0361('0x82'),{'UserId':_0xadafc,'WhatsappQueueId':_0x5e7705['id']});});});});});});})[_0x0361('0x26')](respondWithStatusCode(_0x3d83eb,null))[_0x0361('0x4a')](handleError(_0x3d83eb,null));};exports[_0x0361('0x83')]=function(_0x1b7bf6,_0x9dee67,_0xa9e7){return db[_0x0361('0x2f')][_0x0361('0x49')]({'where':{'id':_0x1b7bf6[_0x0361('0x48')]['id']}})[_0x0361('0x26')](handleEntityNotFound(_0x9dee67,null))[_0x0361('0x26')](function(_0x1bbdee){if(_0x1bbdee){return _0x1bbdee[_0x0361('0x83')](_0x1b7bf6[_0x0361('0x52')][_0x0361('0x64')],_['omit'](_0x1b7bf6[_0x0361('0x52')],[_0x0361('0x64'),'id'])||{})['spread'](function(_0x133685){for(var _0x1b2192=0x0;_0x1b2192<_0x1b7bf6[_0x0361('0x52')][_0x0361('0x64')][_0x0361('0x3b')];_0x1b2192+=0x1){socket[_0x0361('0x81')](_0x0361('0x6e'),{'UserId':_0x1b7bf6[_0x0361('0x52')]['ids'][_0x1b2192],'WhatsappQueueId':_0x1b7bf6['params']['id']});}return _0x133685;});}})[_0x0361('0x26')](respondWithResult(_0x9dee67,null))['catch'](handleError(_0x9dee67,null));};exports['removeAgents']=function(_0x55eb61,_0xc5c3d8,_0x148963){return db[_0x0361('0x2f')]['find']({'where':{'id':_0x55eb61[_0x0361('0x48')]['id']}})['then'](handleEntityNotFound(_0xc5c3d8,null))[_0x0361('0x26')](function(_0x27a554){if(_0x27a554){return _0x27a554[_0x0361('0x84')](_0x55eb61[_0x0361('0x35')]['ids'])[_0x0361('0x26')](function(){if(_[_0x0361('0x85')](_0x55eb61[_0x0361('0x35')][_0x0361('0x64')])){for(var _0x2aaa30=0x0;_0x2aaa30<_0x55eb61[_0x0361('0x35')]['ids'][_0x0361('0x3b')];_0x2aaa30+=0x1){socket[_0x0361('0x81')](_0x0361('0x82'),{'UserId':Number(_0x55eb61[_0x0361('0x35')][_0x0361('0x64')][_0x2aaa30]),'WhatsappQueueId':Number(_0x55eb61[_0x0361('0x48')]['id'])});}}else{socket[_0x0361('0x81')](_0x0361('0x82'),{'UserId':Number(_0x55eb61[_0x0361('0x35')][_0x0361('0x64')]),'WhatsappQueueId':Number(_0x55eb61[_0x0361('0x48')]['id'])});}});}})[_0x0361('0x26')](respondWithStatusCode(_0xc5c3d8,null))['catch'](handleError(_0xc5c3d8,null));};exports[_0x0361('0x86')]=function(_0x2076f2,_0x403c44,_0x2c84a4){var _0xcc4aed={};var _0xb600d2={};var _0x2ba364;var _0x26076c;return db['WhatsappQueue'][_0x0361('0x55')]({'where':{'id':_0x2076f2[_0x0361('0x48')]['id']}})['then'](handleEntityNotFound(_0x403c44,null))['then'](function(_0x16eb39){if(_0x16eb39){_0x2ba364=_0x16eb39;_0xb600d2[_0x0361('0x34')]=_[_0x0361('0x36')](db[_0x0361('0x5a')][_0x0361('0x30')]);_0xb600d2[_0x0361('0x35')]=_['keys'](_0x2076f2[_0x0361('0x35')]);_0xb600d2[_0x0361('0x37')]=_['intersection'](_0xb600d2['model'],_0xb600d2[_0x0361('0x35')]);_0xcc4aed['attributes']=_[_0x0361('0x38')](_0xb600d2['model'],qs[_0x0361('0x39')](_0x2076f2[_0x0361('0x35')][_0x0361('0x39')]));_0xcc4aed[_0x0361('0x3a')]=_0xcc4aed[_0x0361('0x3a')]['length']?_0xcc4aed['attributes']:_0xb600d2[_0x0361('0x34')];_0xcc4aed[_0x0361('0x57')]=qs[_0x0361('0x3e')](_0x2076f2[_0x0361('0x35')][_0x0361('0x3e')]);_0xcc4aed[_0x0361('0x3f')]=qs[_0x0361('0x37')](_[_0x0361('0x58')](_0x2076f2['query'],_0xb600d2[_0x0361('0x37')]));if(_0x2076f2['query'][_0x0361('0x40')]){_0xcc4aed[_0x0361('0x3f')]=_[_0x0361('0x41')](_0xcc4aed[_0x0361('0x3f')],{'$or':_[_0x0361('0x2e')](_0xcc4aed[_0x0361('0x3a')],function(_0x9bc359){var _0x2dcc6c={};_0x2dcc6c[_0x9bc359]={'$like':'%'+_0x2076f2[_0x0361('0x35')][_0x0361('0x40')]+'%'};return _0x2dcc6c;})});}_0xcc4aed=_['merge']({},_0xcc4aed,_0x2076f2[_0x0361('0x42')]);return _0x2ba364[_0x0361('0x86')](_0xcc4aed);}})[_0x0361('0x26')](function(_0x498a8){if(_0x498a8){_0x26076c=_0x498a8[_0x0361('0x3b')];if(!_0x2076f2[_0x0361('0x35')][_0x0361('0x3c')]('nolimit')){_0xcc4aed[_0x0361('0x1f')]=qs[_0x0361('0x1f')](_0x2076f2[_0x0361('0x35')][_0x0361('0x1f')]);_0xcc4aed[_0x0361('0x1e')]=qs[_0x0361('0x1e')](_0x2076f2['query'][_0x0361('0x1e')]);}return _0x2ba364[_0x0361('0x86')](_0xcc4aed);}})[_0x0361('0x26')](function(_0x2ef059){if(_0x2ef059){return _0x2ef059?{'count':_0x26076c,'rows':_0x2ef059}:null;}})[_0x0361('0x26')](respondWithResult(_0x403c44,null))[_0x0361('0x4a')](handleError(_0x403c44,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4b3f3d4..10c1a43 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 _0xc344=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xc344,0x190));var _0x4c34=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xc344[_0x38ced4];return _0x547c07;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x4c34('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x4c34('0x1')](0x0);var events={'afterCreate':_0x4c34('0x2'),'afterUpdate':_0x4c34('0x3'),'afterDestroy':_0x4c34('0x4')};function emitEvent(_0x6bf463){return function(_0x281c78,_0x1a0b8f,_0x3b7c5b){WhatsappQueueEvents[_0x4c34('0x5')](_0x6bf463+':'+_0x281c78['id'],_0x281c78);WhatsappQueueEvents[_0x4c34('0x5')](_0x6bf463,_0x281c78);_0x3b7c5b(null);};}for(var e in events){if(events[_0x4c34('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x4c34('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xb281=['update','emit','hook','exports','../../mysqldb','WhatsappQueue','save'];(function(_0x2db9fe,_0x2621fd){var _0x37bb26=function(_0x56e8b5){while(--_0x56e8b5){_0x2db9fe['push'](_0x2db9fe['shift']());}};_0x37bb26(++_0x2621fd);}(_0xb281,0x138));var _0x1b28=function(_0x7e784e,_0x565054){_0x7e784e=_0x7e784e-0x0;var _0x4e76b0=_0xb281[_0x7e784e];return _0x4e76b0;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x1b28('0x0'))['db'][_0x1b28('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1b28('0x2'),'afterUpdate':_0x1b28('0x3'),'afterDestroy':'remove'};function emitEvent(_0x464c83){return function(_0x2d2426,_0x9d49a1,_0x33dbf5){WhatsappQueueEvents[_0x1b28('0x4')](_0x464c83+':'+_0x2d2426['id'],_0x2d2426);WhatsappQueueEvents[_0x1b28('0x4')](_0x464c83,_0x2d2426);_0x33dbf5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x1b28('0x5')](e,emitEvent(event));}}module[_0x1b28('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 94c9660..bc67096 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 _0xa6a8=['./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x9f43b1,_0x534142){var _0x2df141=function(_0x51bb80){while(--_0x51bb80){_0x9f43b1['push'](_0x9f43b1['shift']());}};_0x2df141(++_0x534142);}(_0xa6a8,0x1c1));var _0x8a6a=function(_0x2f8c29,_0xa634b3){_0x2f8c29=_0x2f8c29-0x0;var _0x5e3400=_0xa6a8[_0x2f8c29];return _0x5e3400;};'use strict';var _=require(_0x8a6a('0x0'));var util=require(_0x8a6a('0x1'));var logger=require('../../config/logger')(_0x8a6a('0x2'));var moment=require(_0x8a6a('0x3'));var BPromise=require(_0x8a6a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8a6a('0x5'));var config=require(_0x8a6a('0x6'));var attributes=require(_0x8a6a('0x7'));module[_0x8a6a('0x8')]=function(_0x7ddc75,_0x4baa51){return _0x7ddc75[_0x8a6a('0x9')](_0x8a6a('0xa'),attributes,{'tableName':_0x8a6a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e98=['path','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','api','moment','bluebird','request-promise'];(function(_0x486cb2,_0x46f520){var _0x5309bf=function(_0x3b91df){while(--_0x3b91df){_0x486cb2['push'](_0x486cb2['shift']());}};_0x5309bf(++_0x46f520);}(_0x3e98,0x145));var _0x83e9=function(_0x1978cf,_0x106e44){_0x1978cf=_0x1978cf-0x0;var _0x7ec3f5=_0x3e98[_0x1978cf];return _0x7ec3f5;};'use strict';var _=require(_0x83e9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x83e9('0x1'));var moment=require(_0x83e9('0x2'));var BPromise=require(_0x83e9('0x3'));var rp=require(_0x83e9('0x4'));var fs=require('fs');var path=require(_0x83e9('0x5'));var rimraf=require('rimraf');var config=require(_0x83e9('0x6'));var attributes=require(_0x83e9('0x7'));module[_0x83e9('0x8')]=function(_0x2f20a8,_0x237ebb){return _0x2f20a8[_0x83e9('0x9')]('WhatsappQueue',attributes,{'tableName':_0x83e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 7990126..1db319a 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 _0x61ff=['debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetWhatsappQueue','WhatsappQueue','options','where','attributes','include','map','model','ShowWhatsappQueue','find','raw','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','WhatsappQueue,\x20%s,\x20%s'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0x61ff,0x83));var _0xf61f=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0x61ff[_0x44a3b0];return _0x39e6f6;};'use strict';var _=require('lodash');var util=require(_0xf61f('0x0'));var moment=require(_0xf61f('0x1'));var BPromise=require('bluebird');var rs=require(_0xf61f('0x2'));var fs=require('fs');var Redis=require(_0xf61f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf61f('0x4'));var logger=require(_0xf61f('0x5'))(_0xf61f('0x6'));var config=require('../../config/environment');var jayson=require(_0xf61f('0x7'));var client=jayson[_0xf61f('0x8')][_0xf61f('0x9')]({'port':0x232a});config[_0xf61f('0xa')]=_['defaults'](config['redis'],{'host':_0xf61f('0xb'),'port':0x18eb});var socket=require(_0xf61f('0xc'))(new Redis(config[_0xf61f('0xa')]));require(_0xf61f('0xd'))['register'](socket);function respondWithRpcPromise(_0x4daa77,_0x41122e,_0x5efa1f){return new BPromise(function(_0x17f10f,_0x45646d){return client[_0xf61f('0xe')](_0x4daa77,_0x5efa1f)[_0xf61f('0xf')](function(_0x2fb8b0){logger['info'](_0xf61f('0x10'),_0x41122e,'request\x20sent');logger[_0xf61f('0x11')](_0xf61f('0x12'),_0x41122e,_0xf61f('0x13'),JSON[_0xf61f('0x14')](_0x2fb8b0));if(_0x2fb8b0[_0xf61f('0x15')]){if(_0x2fb8b0['error'][_0xf61f('0x16')]===0x1f4){logger[_0xf61f('0x15')](_0xf61f('0x10'),_0x41122e,_0x2fb8b0['error'][_0xf61f('0x17')]);return _0x45646d(_0x2fb8b0[_0xf61f('0x15')][_0xf61f('0x17')]);}logger['error'](_0xf61f('0x10'),_0x41122e,_0x2fb8b0[_0xf61f('0x15')][_0xf61f('0x17')]);return _0x17f10f(_0x2fb8b0[_0xf61f('0x15')]['message']);}else{logger[_0xf61f('0x18')](_0xf61f('0x10'),_0x41122e,_0xf61f('0x13'));_0x17f10f(_0x2fb8b0['result']['message']);}})[_0xf61f('0x19')](function(_0x10c495){logger[_0xf61f('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x41122e,_0x10c495);_0x45646d(_0x10c495);});});}exports[_0xf61f('0x1a')]=function(_0x3fa9f3){var _0x4727c0=this;return new Promise(function(_0x349f3c,_0x28161d){return db[_0xf61f('0x1b')]['findAll']({'raw':_0x3fa9f3['options']?_0x3fa9f3[_0xf61f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3fa9f3[_0xf61f('0x1c')]?_0x3fa9f3[_0xf61f('0x1c')][_0xf61f('0x1d')]||null:null,'attributes':_0x3fa9f3[_0xf61f('0x1c')]?_0x3fa9f3[_0xf61f('0x1c')][_0xf61f('0x1e')]||null:null,'limit':_0x3fa9f3[_0xf61f('0x1c')]?_0x3fa9f3[_0xf61f('0x1c')]['limit']||null:null,'include':_0x3fa9f3[_0xf61f('0x1c')]?_0x3fa9f3['options'][_0xf61f('0x1f')]?_[_0xf61f('0x20')](_0x3fa9f3['options'][_0xf61f('0x1f')],function(_0x32dde9){return{'model':db[_0x32dde9[_0xf61f('0x21')]],'as':_0x32dde9['as'],'attributes':_0x32dde9[_0xf61f('0x1e')],'include':_0x32dde9[_0xf61f('0x1f')]?_[_0xf61f('0x20')](_0x32dde9['include'],function(_0x432375){return{'model':db[_0x432375['model']],'as':_0x432375['as'],'attributes':_0x432375[_0xf61f('0x1e')],'include':_0x432375['include']?_['map'](_0x432375[_0xf61f('0x1f')],function(_0x13ed6c){return{'model':db[_0x13ed6c[_0xf61f('0x21')]],'as':_0x13ed6c['as'],'attributes':_0x13ed6c[_0xf61f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf61f('0xf')](function(_0x45e764){logger['info'](_0xf61f('0x1a'),_0x3fa9f3);logger[_0xf61f('0x11')](_0xf61f('0x1a'),_0x3fa9f3,JSON['stringify'](_0x45e764));_0x349f3c(_0x45e764);})[_0xf61f('0x19')](function(_0x2000cb){logger[_0xf61f('0x15')](_0xf61f('0x1a'),_0x2000cb[_0xf61f('0x17')],_0x3fa9f3);_0x28161d(_0x4727c0[_0xf61f('0x15')](0x1f4,_0x2000cb['message']));});});};exports[_0xf61f('0x22')]=function(_0x16777a){var _0x2662d7=this;return new Promise(function(_0x24c628,_0x15c2e1){return db[_0xf61f('0x1b')][_0xf61f('0x23')]({'raw':_0x16777a[_0xf61f('0x1c')]?_0x16777a[_0xf61f('0x1c')][_0xf61f('0x24')]===undefined?!![]:![]:!![],'where':_0x16777a[_0xf61f('0x1c')]?_0x16777a['options'][_0xf61f('0x1d')]||null:null,'attributes':_0x16777a[_0xf61f('0x1c')]?_0x16777a[_0xf61f('0x1c')]['attributes']||null:null,'include':_0x16777a[_0xf61f('0x1c')]?_0x16777a[_0xf61f('0x1c')][_0xf61f('0x1f')]?_[_0xf61f('0x20')](_0x16777a['options'][_0xf61f('0x1f')],function(_0x204ebc){return{'model':db[_0x204ebc[_0xf61f('0x21')]],'as':_0x204ebc['as'],'attributes':_0x204ebc[_0xf61f('0x1e')],'include':_0x204ebc[_0xf61f('0x1f')]?_[_0xf61f('0x20')](_0x204ebc['include'],function(_0x30109d){return{'model':db[_0x30109d['model']],'as':_0x30109d['as'],'attributes':_0x30109d[_0xf61f('0x1e')],'include':_0x30109d['include']?_['map'](_0x30109d[_0xf61f('0x1f')],function(_0x23ea91){return{'model':db[_0x23ea91[_0xf61f('0x21')]],'as':_0x23ea91['as'],'attributes':_0x23ea91[_0xf61f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf61f('0xf')](function(_0x7cf7b4){logger['info'](_0xf61f('0x22'),_0x16777a);logger[_0xf61f('0x11')]('ShowWhatsappQueue',_0x16777a,JSON[_0xf61f('0x14')](_0x7cf7b4));_0x24c628(_0x7cf7b4);})[_0xf61f('0x19')](function(_0x384601){logger['error']('ShowWhatsappQueue',_0x384601[_0xf61f('0x17')],_0x16777a);_0x15c2e1(_0x2662d7[_0xf61f('0x15')](0x1f4,_0x384601[_0xf61f('0x17')]));});});}; \ No newline at end of file +var _0x254c=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','where','limit','map','include','model','attributes','info','debug','catch','ShowWhatsappQueue','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x304b81,_0x7a90f9){var _0x5af7c1=function(_0x3e978e){while(--_0x3e978e){_0x304b81['push'](_0x304b81['shift']());}};_0x5af7c1(++_0x7a90f9);}(_0x254c,0xf5));var _0xc254=function(_0x2c5265,_0x13b748){_0x2c5265=_0x2c5265-0x0;var _0xf1131d=_0x254c[_0x2c5265];return _0xf1131d;};'use strict';var _=require(_0xc254('0x0'));var util=require(_0xc254('0x1'));var moment=require(_0xc254('0x2'));var BPromise=require(_0xc254('0x3'));var rs=require(_0xc254('0x4'));var fs=require('fs');var Redis=require(_0xc254('0x5'));var db=require(_0xc254('0x6'))['db'];var utils=require(_0xc254('0x7'));var logger=require(_0xc254('0x8'))(_0xc254('0x9'));var config=require(_0xc254('0xa'));var jayson=require(_0xc254('0xb'));var client=jayson[_0xc254('0xc')][_0xc254('0xd')]({'port':0x232a});config[_0xc254('0xe')]=_[_0xc254('0xf')](config[_0xc254('0xe')],{'host':_0xc254('0x10'),'port':0x18eb});var socket=require(_0xc254('0x11'))(new Redis(config[_0xc254('0xe')]));require('./whatsappQueue.socket')[_0xc254('0x12')](socket);function respondWithRpcPromise(_0xe11d1d,_0x4b1459,_0x4b7faa){return new BPromise(function(_0x1e2729,_0x2be1e9){return client[_0xc254('0x13')](_0xe11d1d,_0x4b7faa)[_0xc254('0x14')](function(_0x2344cc){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x4b1459,_0xc254('0x15'));logger['debug'](_0xc254('0x16'),_0x4b1459,_0xc254('0x15'),JSON[_0xc254('0x17')](_0x2344cc));if(_0x2344cc[_0xc254('0x18')]){if(_0x2344cc[_0xc254('0x18')]['code']===0x1f4){logger[_0xc254('0x18')](_0xc254('0x19'),_0x4b1459,_0x2344cc['error'][_0xc254('0x1a')]);return _0x2be1e9(_0x2344cc[_0xc254('0x18')][_0xc254('0x1a')]);}logger[_0xc254('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x4b1459,_0x2344cc[_0xc254('0x18')]['message']);return _0x1e2729(_0x2344cc[_0xc254('0x18')][_0xc254('0x1a')]);}else{logger['info'](_0xc254('0x19'),_0x4b1459,'request\x20sent');_0x1e2729(_0x2344cc[_0xc254('0x1b')][_0xc254('0x1a')]);}})['catch'](function(_0x4de42c){logger[_0xc254('0x18')](_0xc254('0x19'),_0x4b1459,_0x4de42c);_0x2be1e9(_0x4de42c);});});}exports[_0xc254('0x1c')]=function(_0x32c893){var _0x71a260=this;return new Promise(function(_0x48bf58,_0x539c73){return db[_0xc254('0x1d')][_0xc254('0x1e')]({'raw':_0x32c893[_0xc254('0x1f')]?_0x32c893[_0xc254('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x32c893[_0xc254('0x1f')]?_0x32c893[_0xc254('0x1f')][_0xc254('0x20')]||null:null,'attributes':_0x32c893[_0xc254('0x1f')]?_0x32c893[_0xc254('0x1f')]['attributes']||null:null,'limit':_0x32c893[_0xc254('0x1f')]?_0x32c893[_0xc254('0x1f')][_0xc254('0x21')]||null:null,'include':_0x32c893['options']?_0x32c893[_0xc254('0x1f')]['include']?_[_0xc254('0x22')](_0x32c893[_0xc254('0x1f')][_0xc254('0x23')],function(_0x4cdd3e){return{'model':db[_0x4cdd3e[_0xc254('0x24')]],'as':_0x4cdd3e['as'],'attributes':_0x4cdd3e[_0xc254('0x25')],'include':_0x4cdd3e[_0xc254('0x23')]?_[_0xc254('0x22')](_0x4cdd3e[_0xc254('0x23')],function(_0x284cdf){return{'model':db[_0x284cdf['model']],'as':_0x284cdf['as'],'attributes':_0x284cdf[_0xc254('0x25')],'include':_0x284cdf[_0xc254('0x23')]?_[_0xc254('0x22')](_0x284cdf[_0xc254('0x23')],function(_0x49fec8){return{'model':db[_0x49fec8[_0xc254('0x24')]],'as':_0x49fec8['as'],'attributes':_0x49fec8['attributes']};}):[]};}):[]};}):[]:[]})[_0xc254('0x14')](function(_0x169881){logger[_0xc254('0x26')](_0xc254('0x1c'),_0x32c893);logger[_0xc254('0x27')]('GetWhatsappQueue',_0x32c893,JSON[_0xc254('0x17')](_0x169881));_0x48bf58(_0x169881);})[_0xc254('0x28')](function(_0x52647c){logger['error']('GetWhatsappQueue',_0x52647c[_0xc254('0x1a')],_0x32c893);_0x539c73(_0x71a260['error'](0x1f4,_0x52647c['message']));});});};exports[_0xc254('0x29')]=function(_0x4ce7a1){var _0x31e57c=this;return new Promise(function(_0x56201f,_0x599289){return db['WhatsappQueue']['find']({'raw':_0x4ce7a1['options']?_0x4ce7a1[_0xc254('0x1f')][_0xc254('0x2a')]===undefined?!![]:![]:!![],'where':_0x4ce7a1[_0xc254('0x1f')]?_0x4ce7a1[_0xc254('0x1f')][_0xc254('0x20')]||null:null,'attributes':_0x4ce7a1[_0xc254('0x1f')]?_0x4ce7a1[_0xc254('0x1f')]['attributes']||null:null,'include':_0x4ce7a1[_0xc254('0x1f')]?_0x4ce7a1[_0xc254('0x1f')][_0xc254('0x23')]?_[_0xc254('0x22')](_0x4ce7a1[_0xc254('0x1f')]['include'],function(_0x4c5c7a){return{'model':db[_0x4c5c7a['model']],'as':_0x4c5c7a['as'],'attributes':_0x4c5c7a['attributes'],'include':_0x4c5c7a[_0xc254('0x23')]?_[_0xc254('0x22')](_0x4c5c7a[_0xc254('0x23')],function(_0x519a04){return{'model':db[_0x519a04[_0xc254('0x24')]],'as':_0x519a04['as'],'attributes':_0x519a04[_0xc254('0x25')],'include':_0x519a04[_0xc254('0x23')]?_[_0xc254('0x22')](_0x519a04[_0xc254('0x23')],function(_0x298d13){return{'model':db[_0x298d13[_0xc254('0x24')]],'as':_0x298d13['as'],'attributes':_0x298d13['attributes']};}):[]};}):[]};}):[]:[]})[_0xc254('0x14')](function(_0x49e658){logger['info'](_0xc254('0x29'),_0x4ce7a1);logger[_0xc254('0x27')](_0xc254('0x29'),_0x4ce7a1,JSON[_0xc254('0x17')](_0x49e658));_0x56201f(_0x49e658);})[_0xc254('0x28')](function(_0x574c9c){logger[_0xc254('0x18')](_0xc254('0x29'),_0x574c9c[_0xc254('0x1a')],_0x4ce7a1);_0x599289(_0x31e57c[_0xc254('0x18')](0x1f4,_0x574c9c[_0xc254('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 651bd0c..ace16ce 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 _0x142b=['removeListener','register','emit'];(function(_0x219b57,_0x44e2c0){var _0x3457f5=function(_0x2fc755){while(--_0x2fc755){_0x219b57['push'](_0x219b57['shift']());}};_0x3457f5(++_0x44e2c0);}(_0x142b,0x1bb));var _0xb142=function(_0x3880f1,_0x324557){_0x3880f1=_0x3880f1-0x0;var _0xf4b95d=_0x142b[_0x3880f1];return _0xf4b95d;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save','remove','update'];function createListener(_0x29bb97,_0xe93154){return function(_0x1b4d88){_0xe93154[_0xb142('0x0')](_0x29bb97,_0x1b4d88);};}function removeListener(_0x181593,_0x562372){return function(){WhatsappQueueEvents[_0xb142('0x1')](_0x181593,_0x562372);};}exports[_0xb142('0x2')]=function(_0x26b4c1){for(var _0x42fc09=0x0,_0x524cee=events['length'];_0x42fc09<_0x524cee;_0x42fc09++){var _0x1ebfb7=events[_0x42fc09];var _0xd52ccb=createListener('whatsappQueue:'+_0x1ebfb7,_0x26b4c1);WhatsappQueueEvents['on'](_0x1ebfb7,_0xd52ccb);}}; \ No newline at end of file +var _0xd293=['length','whatsappQueue:','./whatsappQueue.events','removeListener'];(function(_0x5707be,_0x4177c7){var _0x1d22cb=function(_0x240597){while(--_0x240597){_0x5707be['push'](_0x5707be['shift']());}};_0x1d22cb(++_0x4177c7);}(_0xd293,0x10e));var _0x3d29=function(_0x10de13,_0x44c639){_0x10de13=_0x10de13-0x0;var _0x1c6687=_0xd293[_0x10de13];return _0x1c6687;};'use strict';var WhatsappQueueEvents=require(_0x3d29('0x0'));var events=['save','remove','update'];function createListener(_0x2541e5,_0x17354d){return function(_0x15063b){_0x17354d['emit'](_0x2541e5,_0x15063b);};}function removeListener(_0x13fe0d,_0x2df6a9){return function(){WhatsappQueueEvents[_0x3d29('0x1')](_0x13fe0d,_0x2df6a9);};}exports['register']=function(_0x2a9239){for(var _0x55fdc2=0x0,_0x47538a=events[_0x3d29('0x2')];_0x55fdc2<_0x47538a;_0x55fdc2++){var _0x36dd09=events[_0x55fdc2];var _0x1d1d36=createListener(_0x3d29('0x3')+_0x36dd09,_0x2a9239);WhatsappQueueEvents['on'](_0x36dd09,_0x1d1d36);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 5c6b90d..7663688 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 _0xdab3=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','multer','util','connect-timeout','express','Router'];(function(_0x3fcc58,_0x1cbd87){var _0x387ba0=function(_0x3a2ba3){while(--_0x3a2ba3){_0x3fcc58['push'](_0x3fcc58['shift']());}};_0x387ba0(++_0x1cbd87);}(_0xdab3,0xeb));var _0x3dab=function(_0x314920,_0x2ca517){_0x314920=_0x314920-0x0;var _0x29638e=_0xdab3[_0x314920];return _0x29638e;};'use strict';var multer=require(_0x3dab('0x0'));var util=require(_0x3dab('0x1'));var path=require('path');var timeout=require(_0x3dab('0x2'));var express=require(_0x3dab('0x3'));var router=express[_0x3dab('0x4')]();var auth=require(_0x3dab('0x5'));var interaction=require(_0x3dab('0x6'));var config=require(_0x3dab('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x3dab('0x8')](),controller[_0x3dab('0x9')]);router[_0x3dab('0xa')](_0x3dab('0xb'),auth[_0x3dab('0x8')](),controller[_0x3dab('0xc')]);router['get'](_0x3dab('0xd'),auth[_0x3dab('0x8')](),controller[_0x3dab('0xe')]);router[_0x3dab('0xf')]('/',auth[_0x3dab('0x8')](),controller[_0x3dab('0x10')]);router[_0x3dab('0x11')]('/:id',auth[_0x3dab('0x8')](),controller[_0x3dab('0x12')]);router[_0x3dab('0x13')](_0x3dab('0xd'),auth[_0x3dab('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf39c=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','describe','/:id','post','create','put'];(function(_0x19f3be,_0x5cee34){var _0x2e0479=function(_0x152289){while(--_0x152289){_0x19f3be['push'](_0x19f3be['shift']());}};_0x2e0479(++_0x5cee34);}(_0xf39c,0x16c));var _0xcf39=function(_0x57d784,_0x384762){_0x57d784=_0x57d784-0x0;var _0x52821b=_0xf39c[_0x57d784];return _0x52821b;};'use strict';var multer=require(_0xcf39('0x0'));var util=require(_0xcf39('0x1'));var path=require(_0xcf39('0x2'));var timeout=require(_0xcf39('0x3'));var express=require('express');var router=express[_0xcf39('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcf39('0x5'));var config=require('../../config/environment');var controller=require(_0xcf39('0x6'));router[_0xcf39('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcf39('0x7')]('/describe',auth[_0xcf39('0x8')](),controller[_0xcf39('0x9')]);router[_0xcf39('0x7')](_0xcf39('0xa'),auth[_0xcf39('0x8')](),controller['show']);router[_0xcf39('0xb')]('/',auth[_0xcf39('0x8')](),controller[_0xcf39('0xc')]);router[_0xcf39('0xd')](_0xcf39('0xa'),auth[_0xcf39('0x8')](),controller[_0xcf39('0xe')]);router[_0xcf39('0xf')](_0xcf39('0xa'),auth['isAuthenticated'](),controller[_0xcf39('0x10')]);module[_0xcf39('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index b7a544f..233381d 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 _0x34e8=['sequelize','exports','STRING','DATE'];(function(_0x299b94,_0x509140){var _0x5ea5b4=function(_0x4ce2b4){while(--_0x4ce2b4){_0x299b94['push'](_0x299b94['shift']());}};_0x5ea5b4(++_0x509140);}(_0x34e8,0x12c));var _0x834e=function(_0x9364d7,_0x1690ef){_0x9364d7=_0x9364d7-0x0;var _0xb0f89c=_0x34e8[_0x9364d7];return _0xb0f89c;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'uniqueid':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x834e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x834e('0x3')]},'acceptAt':{'type':Sequelize[_0x834e('0x3')]},'exitAt':{'type':Sequelize[_0x834e('0x3')]},'reason':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file +var _0x8ef6=['STRING','DATE','sequelize','exports'];(function(_0x533d42,_0xd70979){var _0x276547=function(_0x39acd7){while(--_0x39acd7){_0x533d42['push'](_0x533d42['shift']());}};_0x276547(++_0xd70979);}(_0x8ef6,0xf2));var _0x68ef=function(_0x283545,_0x425e18){_0x283545=_0x283545-0x0;var _0x347702=_0x8ef6[_0x283545];return _0x347702;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'uniqueid':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x68ef('0x2')]},'joinAt':{'type':Sequelize[_0x68ef('0x3')]},'leaveAt':{'type':Sequelize[_0x68ef('0x3')]},'acceptAt':{'type':Sequelize[_0x68ef('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x68ef('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index c7647ca..c0000d1 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 _0xcc4d=['querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','order','sort','where','filters','merge','filter','options','count','includeAll','include','findAll','show','params','find','catch','create','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce'];(function(_0x9eb367,_0x31ae6d){var _0x26f71f=function(_0x49f27f){while(--_0x49f27f){_0x9eb367['push'](_0x9eb367['shift']());}};_0x26f71f(++_0x31ae6d);}(_0xcc4d,0x103));var _0xdcc4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xcc4d[_0x543084];return _0x306a57;};'use strict';var pdf=require(_0xdcc4('0x0'));var emlformat=require(_0xdcc4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdcc4('0x2'));var rp=require(_0xdcc4('0x3'));var moment=require(_0xdcc4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdcc4('0x5'));var util=require(_0xdcc4('0x6'));var path=require(_0xdcc4('0x7'));var sox=require(_0xdcc4('0x8'));var csv=require(_0xdcc4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xdcc4('0xa'));var crypto=require(_0xdcc4('0xb'));var jsforce=require(_0xdcc4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdcc4('0x9'));var querystring=require(_0xdcc4('0xd'));var Papa=require('papaparse');var Redis=require(_0xdcc4('0xe'));var authService=require(_0xdcc4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdcc4('0x10'));var hardwareService=require(_0xdcc4('0x11'));var logger=require(_0xdcc4('0x12'))('api');var utils=require(_0xdcc4('0x13'));var config=require('../../config/environment');var db=require(_0xdcc4('0x14'))['db'];function respondWithStatusCode(_0x17634e,_0x5926ab){_0x5926ab=_0x5926ab||0xcc;return function(_0xdc03c6){if(_0xdc03c6){return _0x17634e[_0xdcc4('0x15')](_0x5926ab);}return _0x17634e[_0xdcc4('0x16')](_0x5926ab)[_0xdcc4('0x17')]();};}function respondWithResult(_0x5a4fd6,_0x5a3704){_0x5a3704=_0x5a3704||0xc8;return function(_0xa86c8d){if(_0xa86c8d){return _0x5a4fd6['status'](_0x5a3704)['json'](_0xa86c8d);}};}function respondWithFilteredResult(_0x3121f4,_0x23e577){return function(_0x496e57){if(_0x496e57){var _0x576125=_0x496e57['count'],_0x574603=_0x23e577[_0xdcc4('0x18')],_0x5df842=_0x23e577[_0xdcc4('0x18')]+_0x23e577[_0xdcc4('0x19')],_0x2f128a;if(_0x5df842>=_0x576125){_0x5df842=_0x576125;_0x2f128a=0xc8;}else{_0x2f128a=0xce;}_0x3121f4['status'](_0x2f128a);return _0x3121f4['set'](_0xdcc4('0x1a'),_0x574603+'-'+_0x5df842+'/'+_0x576125)[_0xdcc4('0x1b')](_0x496e57);}return null;};}function patchUpdates(_0x6f5417){return function(_0x5e46be){try{jsonpatch[_0xdcc4('0x1c')](_0x5e46be,_0x6f5417,!![]);}catch(_0x11f059){return BPromise[_0xdcc4('0x1d')](_0x11f059);}return _0x5e46be[_0xdcc4('0x1e')]();};}function saveUpdates(_0x5e8a32,_0x3e95c3){return function(_0x278a90){if(_0x278a90){return _0x278a90[_0xdcc4('0x1f')](_0x5e8a32)[_0xdcc4('0x20')](function(_0x241110){return _0x241110;});}return null;};}function removeEntity(_0x1425cd,_0x33be6b){return function(_0x38a6f0){if(_0x38a6f0){return _0x38a6f0[_0xdcc4('0x21')]()[_0xdcc4('0x20')](function(){_0x1425cd[_0xdcc4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x910b73,_0x3fb377){return function(_0xf856e0){if(!_0xf856e0){_0x910b73[_0xdcc4('0x15')](0x194);}return _0xf856e0;};}function handleError(_0x2139c5,_0x4038c7){_0x4038c7=_0x4038c7||0x1f4;return function(_0x17a70f){logger['error'](_0x17a70f[_0xdcc4('0x22')]);if(_0x17a70f['name']){delete _0x17a70f[_0xdcc4('0x23')];}_0x2139c5[_0xdcc4('0x16')](_0x4038c7)[_0xdcc4('0x24')](_0x17a70f);};}exports['index']=function(_0x367a29,_0x51852c){var _0x338002={},_0xb0cf50={},_0x492ea5={'count':0x0,'rows':[]};var _0x5965ba=_[_0xdcc4('0x25')](db[_0xdcc4('0x26')][_0xdcc4('0x27')],function(_0x5c3b7c){return{'name':_0x5c3b7c[_0xdcc4('0x28')],'type':_0x5c3b7c[_0xdcc4('0x29')][_0xdcc4('0x2a')]};});_0xb0cf50[_0xdcc4('0x2b')]=_[_0xdcc4('0x25')](_0x5965ba,_0xdcc4('0x23'));_0xb0cf50['query']=_[_0xdcc4('0x2c')](_0x367a29[_0xdcc4('0x2d')]);_0xb0cf50['filters']=_[_0xdcc4('0x2e')](_0xb0cf50[_0xdcc4('0x2b')],_0xb0cf50[_0xdcc4('0x2d')]);_0x338002[_0xdcc4('0x2f')]=_[_0xdcc4('0x2e')](_0xb0cf50[_0xdcc4('0x2b')],qs['fields'](_0x367a29[_0xdcc4('0x2d')][_0xdcc4('0x30')]));_0x338002[_0xdcc4('0x2f')]=_0x338002[_0xdcc4('0x2f')][_0xdcc4('0x31')]?_0x338002['attributes']:_0xb0cf50[_0xdcc4('0x2b')];if(!_0x367a29['query']['hasOwnProperty']('nolimit')){_0x338002[_0xdcc4('0x19')]=qs[_0xdcc4('0x19')](_0x367a29[_0xdcc4('0x2d')][_0xdcc4('0x19')]);_0x338002[_0xdcc4('0x18')]=qs[_0xdcc4('0x18')](_0x367a29[_0xdcc4('0x2d')][_0xdcc4('0x18')]);}_0x338002[_0xdcc4('0x32')]=qs[_0xdcc4('0x33')](_0x367a29[_0xdcc4('0x2d')][_0xdcc4('0x33')]);_0x338002[_0xdcc4('0x34')]=qs[_0xdcc4('0x35')](_['pick'](_0x367a29[_0xdcc4('0x2d')],_0xb0cf50[_0xdcc4('0x35')]),_0x5965ba);if(_0x367a29[_0xdcc4('0x2d')]['filter']){_0x338002[_0xdcc4('0x34')]=_[_0xdcc4('0x36')](_0x338002[_0xdcc4('0x34')],{'$or':_[_0xdcc4('0x25')](_0x5965ba,function(_0x2cf603){if(_0x2cf603[_0xdcc4('0x29')]!=='VIRTUAL'){var _0x3b8669={};_0x3b8669[_0x2cf603[_0xdcc4('0x23')]]={'$like':'%'+_0x367a29[_0xdcc4('0x2d')][_0xdcc4('0x37')]+'%'};return _0x3b8669;}})});}_0x338002=_[_0xdcc4('0x36')]({},_0x338002,_0x367a29[_0xdcc4('0x38')]);var _0x5825cd={'where':_0x338002[_0xdcc4('0x34')]};return db['WhatsappQueueReport'][_0xdcc4('0x39')](_0x5825cd)[_0xdcc4('0x20')](function(_0x4a11a3){_0x492ea5[_0xdcc4('0x39')]=_0x4a11a3;if(_0x367a29[_0xdcc4('0x2d')][_0xdcc4('0x3a')]){_0x338002[_0xdcc4('0x3b')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xdcc4('0x3c')](_0x338002);})[_0xdcc4('0x20')](function(_0x404999){_0x492ea5['rows']=_0x404999;return _0x492ea5;})['then'](respondWithFilteredResult(_0x51852c,_0x338002))['catch'](handleError(_0x51852c,null));};exports[_0xdcc4('0x3d')]=function(_0xb8b51b,_0x47c3b7){var _0x20e70a={'raw':!![],'where':{'id':_0xb8b51b[_0xdcc4('0x3e')]['id']}},_0x5f4845={};_0x5f4845[_0xdcc4('0x2b')]=_[_0xdcc4('0x2c')](db['WhatsappQueueReport'][_0xdcc4('0x27')]);_0x5f4845[_0xdcc4('0x2d')]=_['keys'](_0xb8b51b['query']);_0x5f4845[_0xdcc4('0x35')]=_[_0xdcc4('0x2e')](_0x5f4845[_0xdcc4('0x2b')],_0x5f4845[_0xdcc4('0x2d')]);_0x20e70a[_0xdcc4('0x2f')]=_[_0xdcc4('0x2e')](_0x5f4845[_0xdcc4('0x2b')],qs[_0xdcc4('0x30')](_0xb8b51b[_0xdcc4('0x2d')][_0xdcc4('0x30')]));_0x20e70a['attributes']=_0x20e70a[_0xdcc4('0x2f')][_0xdcc4('0x31')]?_0x20e70a['attributes']:_0x5f4845['model'];if(_0xb8b51b[_0xdcc4('0x2d')]['includeAll']){_0x20e70a['include']=[{'all':!![]}];}_0x20e70a=_[_0xdcc4('0x36')]({},_0x20e70a,_0xb8b51b[_0xdcc4('0x38')]);return db[_0xdcc4('0x26')][_0xdcc4('0x3f')](_0x20e70a)[_0xdcc4('0x20')](handleEntityNotFound(_0x47c3b7,null))[_0xdcc4('0x20')](respondWithResult(_0x47c3b7,null))[_0xdcc4('0x40')](handleError(_0x47c3b7,null));};exports[_0xdcc4('0x41')]=function(_0x2fbd05,_0x2e9b2d){return db[_0xdcc4('0x26')][_0xdcc4('0x41')](_0x2fbd05[_0xdcc4('0x42')],{})['then'](respondWithResult(_0x2e9b2d,0xc9))[_0xdcc4('0x40')](handleError(_0x2e9b2d,null));};exports[_0xdcc4('0x1f')]=function(_0x314a6d,_0x13be00){if(_0x314a6d[_0xdcc4('0x42')]['id']){delete _0x314a6d['body']['id'];}return db['WhatsappQueueReport'][_0xdcc4('0x3f')]({'where':{'id':_0x314a6d['params']['id']}})['then'](handleEntityNotFound(_0x13be00,null))['then'](saveUpdates(_0x314a6d[_0xdcc4('0x42')],null))[_0xdcc4('0x20')](respondWithResult(_0x13be00,null))[_0xdcc4('0x40')](handleError(_0x13be00,null));};exports[_0xdcc4('0x21')]=function(_0x375b91,_0x5cc1ea){return db[_0xdcc4('0x26')]['find']({'where':{'id':_0x375b91[_0xdcc4('0x3e')]['id']}})[_0xdcc4('0x20')](handleEntityNotFound(_0x5cc1ea,null))[_0xdcc4('0x20')](removeEntity(_0x5cc1ea,null))[_0xdcc4('0x40')](handleError(_0x5cc1ea,null));};exports[_0xdcc4('0x43')]=function(_0x4c2197,_0x3255de){return db['WhatsappQueueReport'][_0xdcc4('0x43')]()['then'](respondWithResult(_0x3255de,null))[_0xdcc4('0x40')](handleError(_0x3255de,null));}; \ No newline at end of file +var _0xcd7f=['findAll','rows','show','params','find','create','body','catch','update','destroy','describe','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','reject','save','then','stack','send','index','WhatsappQueueReport','rawAttributes','type','key','model','map','name','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x4f1ff3,_0x2736a1){var _0x1768a5=function(_0xa12836){while(--_0xa12836){_0x4f1ff3['push'](_0x4f1ff3['shift']());}};_0x1768a5(++_0x2736a1);}(_0xcd7f,0x16e));var _0xfcd7=function(_0x458d84,_0x31e574){_0x458d84=_0x458d84-0x0;var _0x3268d1=_0xcd7f[_0x458d84];return _0x3268d1;};'use strict';var pdf=require(_0xfcd7('0x0'));var emlformat=require(_0xfcd7('0x1'));var rimraf=require(_0xfcd7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfcd7('0x3'));var BPromise=require(_0xfcd7('0x4'));var Mustache=require(_0xfcd7('0x5'));var util=require(_0xfcd7('0x6'));var path=require(_0xfcd7('0x7'));var sox=require('sox');var csv=require(_0xfcd7('0x8'));var ejs=require(_0xfcd7('0x9'));var fs=require('fs');var _=require(_0xfcd7('0xa'));var squel=require(_0xfcd7('0xb'));var crypto=require(_0xfcd7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfcd7('0x8'));var querystring=require(_0xfcd7('0xd'));var Papa=require(_0xfcd7('0xe'));var Redis=require(_0xfcd7('0xf'));var authService=require(_0xfcd7('0x10'));var qs=require(_0xfcd7('0x11'));var as=require(_0xfcd7('0x12'));var hardwareService=require(_0xfcd7('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xfcd7('0x14'));var config=require(_0xfcd7('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5969f9,_0x10428c){_0x10428c=_0x10428c||0xcc;return function(_0x565099){if(_0x565099){return _0x5969f9[_0xfcd7('0x16')](_0x10428c);}return _0x5969f9[_0xfcd7('0x17')](_0x10428c)['end']();};}function respondWithResult(_0x3616c9,_0x4aad4a){_0x4aad4a=_0x4aad4a||0xc8;return function(_0x1f0eda){if(_0x1f0eda){return _0x3616c9[_0xfcd7('0x17')](_0x4aad4a)[_0xfcd7('0x18')](_0x1f0eda);}};}function respondWithFilteredResult(_0x50be12,_0x26f09a){return function(_0x54ffe8){if(_0x54ffe8){var _0x22a1b7=_0x54ffe8[_0xfcd7('0x19')],_0x1ba619=_0x26f09a['offset'],_0x9d4b8e=_0x26f09a[_0xfcd7('0x1a')]+_0x26f09a[_0xfcd7('0x1b')],_0x4c9ff3;if(_0x9d4b8e>=_0x22a1b7){_0x9d4b8e=_0x22a1b7;_0x4c9ff3=0xc8;}else{_0x4c9ff3=0xce;}_0x50be12[_0xfcd7('0x17')](_0x4c9ff3);return _0x50be12[_0xfcd7('0x1c')]('Content-Range',_0x1ba619+'-'+_0x9d4b8e+'/'+_0x22a1b7)[_0xfcd7('0x18')](_0x54ffe8);}return null;};}function patchUpdates(_0x22eaa8){return function(_0x3b0d05){try{jsonpatch['apply'](_0x3b0d05,_0x22eaa8,!![]);}catch(_0x22e53d){return BPromise[_0xfcd7('0x1d')](_0x22e53d);}return _0x3b0d05[_0xfcd7('0x1e')]();};}function saveUpdates(_0x2103d6,_0x4f6521){return function(_0xae3dc2){if(_0xae3dc2){return _0xae3dc2['update'](_0x2103d6)[_0xfcd7('0x1f')](function(_0x44a531){return _0x44a531;});}return null;};}function removeEntity(_0x3417e7,_0x49602f){return function(_0x503899){if(_0x503899){return _0x503899['destroy']()[_0xfcd7('0x1f')](function(){_0x3417e7[_0xfcd7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ee7ca,_0x161971){return function(_0x4e4da2){if(!_0x4e4da2){_0x3ee7ca[_0xfcd7('0x16')](0x194);}return _0x4e4da2;};}function handleError(_0x214d1c,_0x458292){_0x458292=_0x458292||0x1f4;return function(_0x2b48ab){logger['error'](_0x2b48ab[_0xfcd7('0x20')]);if(_0x2b48ab['name']){delete _0x2b48ab['name'];}_0x214d1c[_0xfcd7('0x17')](_0x458292)[_0xfcd7('0x21')](_0x2b48ab);};}exports[_0xfcd7('0x22')]=function(_0x4028d9,_0x5d1555){var _0x27c236={},_0x54f9f6={},_0x42b1cd={'count':0x0,'rows':[]};var _0x2b712b=_['map'](db[_0xfcd7('0x23')][_0xfcd7('0x24')],function(_0x3f3fae){return{'name':_0x3f3fae['fieldName'],'type':_0x3f3fae[_0xfcd7('0x25')][_0xfcd7('0x26')]};});_0x54f9f6[_0xfcd7('0x27')]=_[_0xfcd7('0x28')](_0x2b712b,_0xfcd7('0x29'));_0x54f9f6['query']=_[_0xfcd7('0x2a')](_0x4028d9[_0xfcd7('0x2b')]);_0x54f9f6['filters']=_[_0xfcd7('0x2c')](_0x54f9f6[_0xfcd7('0x27')],_0x54f9f6['query']);_0x27c236[_0xfcd7('0x2d')]=_['intersection'](_0x54f9f6[_0xfcd7('0x27')],qs['fields'](_0x4028d9[_0xfcd7('0x2b')][_0xfcd7('0x2e')]));_0x27c236[_0xfcd7('0x2d')]=_0x27c236[_0xfcd7('0x2d')][_0xfcd7('0x2f')]?_0x27c236['attributes']:_0x54f9f6[_0xfcd7('0x27')];if(!_0x4028d9['query']['hasOwnProperty'](_0xfcd7('0x30'))){_0x27c236[_0xfcd7('0x1b')]=qs[_0xfcd7('0x1b')](_0x4028d9[_0xfcd7('0x2b')][_0xfcd7('0x1b')]);_0x27c236['offset']=qs['offset'](_0x4028d9[_0xfcd7('0x2b')][_0xfcd7('0x1a')]);}_0x27c236[_0xfcd7('0x31')]=qs['sort'](_0x4028d9['query'][_0xfcd7('0x32')]);_0x27c236[_0xfcd7('0x33')]=qs[_0xfcd7('0x34')](_[_0xfcd7('0x35')](_0x4028d9['query'],_0x54f9f6[_0xfcd7('0x34')]),_0x2b712b);if(_0x4028d9['query'][_0xfcd7('0x36')]){_0x27c236[_0xfcd7('0x33')]=_[_0xfcd7('0x37')](_0x27c236[_0xfcd7('0x33')],{'$or':_[_0xfcd7('0x28')](_0x2b712b,function(_0x1e45a6){if(_0x1e45a6[_0xfcd7('0x25')]!==_0xfcd7('0x38')){var _0x31c28a={};_0x31c28a[_0x1e45a6[_0xfcd7('0x29')]]={'$like':'%'+_0x4028d9['query'][_0xfcd7('0x36')]+'%'};return _0x31c28a;}})});}_0x27c236=_[_0xfcd7('0x37')]({},_0x27c236,_0x4028d9[_0xfcd7('0x39')]);var _0x15c590={'where':_0x27c236['where']};return db[_0xfcd7('0x23')][_0xfcd7('0x19')](_0x15c590)['then'](function(_0x1a17e6){_0x42b1cd['count']=_0x1a17e6;if(_0x4028d9[_0xfcd7('0x2b')][_0xfcd7('0x3a')]){_0x27c236[_0xfcd7('0x3b')]=[{'all':!![]}];}return db[_0xfcd7('0x23')][_0xfcd7('0x3c')](_0x27c236);})[_0xfcd7('0x1f')](function(_0x439738){_0x42b1cd[_0xfcd7('0x3d')]=_0x439738;return _0x42b1cd;})[_0xfcd7('0x1f')](respondWithFilteredResult(_0x5d1555,_0x27c236))['catch'](handleError(_0x5d1555,null));};exports[_0xfcd7('0x3e')]=function(_0x40e0e1,_0x4ae5ca){var _0x3c191a={'raw':!![],'where':{'id':_0x40e0e1[_0xfcd7('0x3f')]['id']}},_0xda0d23={};_0xda0d23[_0xfcd7('0x27')]=_[_0xfcd7('0x2a')](db[_0xfcd7('0x23')][_0xfcd7('0x24')]);_0xda0d23[_0xfcd7('0x2b')]=_[_0xfcd7('0x2a')](_0x40e0e1[_0xfcd7('0x2b')]);_0xda0d23[_0xfcd7('0x34')]=_[_0xfcd7('0x2c')](_0xda0d23[_0xfcd7('0x27')],_0xda0d23['query']);_0x3c191a['attributes']=_['intersection'](_0xda0d23[_0xfcd7('0x27')],qs[_0xfcd7('0x2e')](_0x40e0e1[_0xfcd7('0x2b')][_0xfcd7('0x2e')]));_0x3c191a[_0xfcd7('0x2d')]=_0x3c191a[_0xfcd7('0x2d')][_0xfcd7('0x2f')]?_0x3c191a['attributes']:_0xda0d23['model'];if(_0x40e0e1[_0xfcd7('0x2b')][_0xfcd7('0x3a')]){_0x3c191a['include']=[{'all':!![]}];}_0x3c191a=_['merge']({},_0x3c191a,_0x40e0e1[_0xfcd7('0x39')]);return db[_0xfcd7('0x23')][_0xfcd7('0x40')](_0x3c191a)[_0xfcd7('0x1f')](handleEntityNotFound(_0x4ae5ca,null))['then'](respondWithResult(_0x4ae5ca,null))['catch'](handleError(_0x4ae5ca,null));};exports[_0xfcd7('0x41')]=function(_0x3ed187,_0x4de375){return db[_0xfcd7('0x23')][_0xfcd7('0x41')](_0x3ed187[_0xfcd7('0x42')],{})[_0xfcd7('0x1f')](respondWithResult(_0x4de375,0xc9))[_0xfcd7('0x43')](handleError(_0x4de375,null));};exports[_0xfcd7('0x44')]=function(_0x542f3e,_0x398faf){if(_0x542f3e[_0xfcd7('0x42')]['id']){delete _0x542f3e['body']['id'];}return db[_0xfcd7('0x23')][_0xfcd7('0x40')]({'where':{'id':_0x542f3e[_0xfcd7('0x3f')]['id']}})[_0xfcd7('0x1f')](handleEntityNotFound(_0x398faf,null))[_0xfcd7('0x1f')](saveUpdates(_0x542f3e[_0xfcd7('0x42')],null))[_0xfcd7('0x1f')](respondWithResult(_0x398faf,null))[_0xfcd7('0x43')](handleError(_0x398faf,null));};exports[_0xfcd7('0x45')]=function(_0x2ebead,_0x3b9cb0){return db[_0xfcd7('0x23')][_0xfcd7('0x40')]({'where':{'id':_0x2ebead[_0xfcd7('0x3f')]['id']}})[_0xfcd7('0x1f')](handleEntityNotFound(_0x3b9cb0,null))[_0xfcd7('0x1f')](removeEntity(_0x3b9cb0,null))[_0xfcd7('0x43')](handleError(_0x3b9cb0,null));};exports[_0xfcd7('0x46')]=function(_0x170de9,_0x39c1cc){return db[_0xfcd7('0x23')]['describe']()[_0xfcd7('0x1f')](respondWithResult(_0x39c1cc,null))[_0xfcd7('0x43')](handleError(_0x39c1cc,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index e6f2226..fd4485f 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 _0x7443=['define','WhatsappQueueReport','uniqueid','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x7443,0x1d1));var _0x3744=function(_0x892232,_0x4001f3){_0x892232=_0x892232-0x0;var _0x394d1d=_0x7443[_0x892232];return _0x394d1d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3744('0x0'))(_0x3744('0x1'));var moment=require('moment');var BPromise=require(_0x3744('0x2'));var rp=require(_0x3744('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3744('0x4'));var config=require(_0x3744('0x5'));var attributes=require(_0x3744('0x6'));module[_0x3744('0x7')]=function(_0x122752,_0x3d1ca0){return _0x122752[_0x3744('0x8')](_0x3744('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x3744('0xa'),'fields':[_0x3744('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ac4=['path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x1ac4,0x117));var _0x41ac=function(_0x516dae,_0x4e14c8){_0x516dae=_0x516dae-0x0;var _0x2344c5=_0x1ac4[_0x516dae];return _0x2344c5;};'use strict';var _=require(_0x41ac('0x0'));var util=require(_0x41ac('0x1'));var logger=require('../../config/logger')(_0x41ac('0x2'));var moment=require(_0x41ac('0x3'));var BPromise=require(_0x41ac('0x4'));var rp=require(_0x41ac('0x5'));var fs=require('fs');var path=require(_0x41ac('0x6'));var rimraf=require(_0x41ac('0x7'));var config=require(_0x41ac('0x8'));var attributes=require(_0x41ac('0x9'));module[_0x41ac('0xa')]=function(_0x58e5f1,_0x3b164d){return _0x58e5f1[_0x41ac('0xb')](_0x41ac('0xc'),attributes,{'tableName':_0x41ac('0xd'),'paranoid':![],'indexes':[{'name':_0x41ac('0xe'),'fields':[_0x41ac('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index ef70301..53f2d54 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 _0x0d56=['WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','attributes','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x4b6db4,_0x1ab6e2){var _0x3e1d9d=function(_0x4011e5){while(--_0x4011e5){_0x4b6db4['push'](_0x4b6db4['shift']());}};_0x3e1d9d(++_0x1ab6e2);}(_0x0d56,0x197));var _0x60d5=function(_0x3fa666,_0x140e26){_0x3fa666=_0x3fa666-0x0;var _0x201f49=_0x0d56[_0x3fa666];return _0x201f49;};'use strict';var _=require(_0x60d5('0x0'));var util=require(_0x60d5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x60d5('0x2'));var fs=require('fs');var Redis=require(_0x60d5('0x3'));var db=require(_0x60d5('0x4'))['db'];var utils=require(_0x60d5('0x5'));var logger=require('../../config/logger')(_0x60d5('0x6'));var config=require(_0x60d5('0x7'));var jayson=require(_0x60d5('0x8'));var client=jayson[_0x60d5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50ff67,_0x4acb89,_0x5f419c){return new BPromise(function(_0x17a5f3,_0x3671c4){return client[_0x60d5('0xa')](_0x50ff67,_0x5f419c)[_0x60d5('0xb')](function(_0x230910){logger[_0x60d5('0xc')](_0x60d5('0xd'),_0x4acb89,_0x60d5('0xe'));logger[_0x60d5('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x4acb89,_0x60d5('0xe'),JSON[_0x60d5('0x10')](_0x230910));if(_0x230910['error']){if(_0x230910['error']['code']===0x1f4){logger[_0x60d5('0x11')](_0x60d5('0xd'),_0x4acb89,_0x230910[_0x60d5('0x11')][_0x60d5('0x12')]);return _0x3671c4(_0x230910['error'][_0x60d5('0x12')]);}logger[_0x60d5('0x11')](_0x60d5('0xd'),_0x4acb89,_0x230910[_0x60d5('0x11')][_0x60d5('0x12')]);return _0x17a5f3(_0x230910[_0x60d5('0x11')][_0x60d5('0x12')]);}else{logger[_0x60d5('0xc')](_0x60d5('0xd'),_0x4acb89,_0x60d5('0xe'));_0x17a5f3(_0x230910['result'][_0x60d5('0x12')]);}})[_0x60d5('0x13')](function(_0x57efdf){logger['error'](_0x60d5('0xd'),_0x4acb89,_0x57efdf);_0x3671c4(_0x57efdf);});});}exports[_0x60d5('0x14')]=function(_0x27b070){var _0x2e3e20=this;return new Promise(function(_0x46f080,_0x2711cf){return db[_0x60d5('0x15')][_0x60d5('0x16')](_0x27b070[_0x60d5('0x17')],{'raw':_0x27b070[_0x60d5('0x18')]?_0x27b070[_0x60d5('0x18')][_0x60d5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x299a95){logger['info']('CreateWhatsappQueueReport',_0x27b070);logger[_0x60d5('0xf')](_0x60d5('0x14'),_0x27b070,JSON[_0x60d5('0x10')](_0x299a95));_0x46f080(_0x299a95);})['catch'](function(_0xd683fe){logger['error']('CreateWhatsappQueueReport',_0xd683fe['message'],_0x27b070);_0x2711cf(_0x2e3e20[_0x60d5('0x11')](0x1f4,_0xd683fe[_0x60d5('0x12')]));});});};exports[_0x60d5('0x1a')]=function(_0x1f4ded){var _0x28fb6f=this;return new Promise(function(_0xa04c76,_0x1539b0){return db[_0x60d5('0x15')][_0x60d5('0x1b')](_0x1f4ded[_0x60d5('0x17')],{'raw':_0x1f4ded[_0x60d5('0x18')]?_0x1f4ded[_0x60d5('0x18')][_0x60d5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f4ded[_0x60d5('0x18')]?_0x1f4ded['options']['where']||null:null,'attributes':_0x1f4ded[_0x60d5('0x18')]?_0x1f4ded[_0x60d5('0x18')][_0x60d5('0x1c')]||null:null,'limit':_0x1f4ded['options']?_0x1f4ded[_0x60d5('0x18')][_0x60d5('0x1d')]||null:null})[_0x60d5('0xb')](function(_0x3fc580){logger[_0x60d5('0xc')]('UpdateWhatsappQueueReport',_0x1f4ded);logger[_0x60d5('0xf')](_0x60d5('0x1a'),_0x1f4ded,JSON[_0x60d5('0x10')](_0x3fc580));_0xa04c76(_0x3fc580);})[_0x60d5('0x13')](function(_0x131195){logger[_0x60d5('0x11')]('UpdateWhatsappQueueReport',_0x131195[_0x60d5('0x12')],_0x1f4ded);_0x1539b0(_0x28fb6f[_0x60d5('0x11')](0x1f4,_0x131195[_0x60d5('0x12')]));});});}; \ No newline at end of file +var _0xf506=['then','info','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','WhatsappQueueReport','body','options','raw','debug','CreateWhatsappQueueReport','update','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3574f0,_0x5e1850){var _0x931b71=function(_0x3794c8){while(--_0x3794c8){_0x3574f0['push'](_0x3574f0['shift']());}};_0x931b71(++_0x5e1850);}(_0xf506,0xd6));var _0x6f50=function(_0x4d893a,_0x413399){_0x4d893a=_0x4d893a-0x0;var _0x2a2eed=_0xf506[_0x4d893a];return _0x2a2eed;};'use strict';var _=require(_0x6f50('0x0'));var util=require(_0x6f50('0x1'));var moment=require(_0x6f50('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f50('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f50('0x4'));var logger=require(_0x6f50('0x5'))(_0x6f50('0x6'));var config=require('../../config/environment');var jayson=require(_0x6f50('0x7'));var client=jayson[_0x6f50('0x8')][_0x6f50('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11bd7e,_0x35fdcb,_0x4c4d2c){return new BPromise(function(_0x1e9f69,_0x2443ca){return client['request'](_0x11bd7e,_0x4c4d2c)[_0x6f50('0xa')](function(_0x121d17){logger[_0x6f50('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x35fdcb,_0x6f50('0xc'));logger['debug'](_0x6f50('0xd'),_0x35fdcb,_0x6f50('0xc'),JSON[_0x6f50('0xe')](_0x121d17));if(_0x121d17[_0x6f50('0xf')]){if(_0x121d17[_0x6f50('0xf')][_0x6f50('0x10')]===0x1f4){logger[_0x6f50('0xf')](_0x6f50('0x11'),_0x35fdcb,_0x121d17[_0x6f50('0xf')][_0x6f50('0x12')]);return _0x2443ca(_0x121d17['error'][_0x6f50('0x12')]);}logger[_0x6f50('0xf')](_0x6f50('0x11'),_0x35fdcb,_0x121d17[_0x6f50('0xf')][_0x6f50('0x12')]);return _0x1e9f69(_0x121d17[_0x6f50('0xf')][_0x6f50('0x12')]);}else{logger['info'](_0x6f50('0x11'),_0x35fdcb,_0x6f50('0xc'));_0x1e9f69(_0x121d17[_0x6f50('0x13')][_0x6f50('0x12')]);}})[_0x6f50('0x14')](function(_0x522854){logger['error'](_0x6f50('0x11'),_0x35fdcb,_0x522854);_0x2443ca(_0x522854);});});}exports['CreateWhatsappQueueReport']=function(_0x34d997){var _0x1f99c1=this;return new Promise(function(_0x397a25,_0x3decd6){return db[_0x6f50('0x15')]['create'](_0x34d997[_0x6f50('0x16')],{'raw':_0x34d997['options']?_0x34d997[_0x6f50('0x17')][_0x6f50('0x18')]===undefined?!![]:![]:!![]})[_0x6f50('0xa')](function(_0x2c68be){logger[_0x6f50('0xb')]('CreateWhatsappQueueReport',_0x34d997);logger[_0x6f50('0x19')](_0x6f50('0x1a'),_0x34d997,JSON[_0x6f50('0xe')](_0x2c68be));_0x397a25(_0x2c68be);})[_0x6f50('0x14')](function(_0x1c24c8){logger['error'](_0x6f50('0x1a'),_0x1c24c8[_0x6f50('0x12')],_0x34d997);_0x3decd6(_0x1f99c1[_0x6f50('0xf')](0x1f4,_0x1c24c8['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x363a1c){var _0x37f0f2=this;return new Promise(function(_0x272c50,_0x10ba30){return db['WhatsappQueueReport'][_0x6f50('0x1b')](_0x363a1c[_0x6f50('0x16')],{'raw':_0x363a1c['options']?_0x363a1c['options'][_0x6f50('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x363a1c['options']?_0x363a1c[_0x6f50('0x17')][_0x6f50('0x1c')]||null:null,'attributes':_0x363a1c['options']?_0x363a1c[_0x6f50('0x17')][_0x6f50('0x1d')]||null:null,'limit':_0x363a1c[_0x6f50('0x17')]?_0x363a1c['options'][_0x6f50('0x1e')]||null:null})['then'](function(_0x1cbb12){logger[_0x6f50('0xb')]('UpdateWhatsappQueueReport',_0x363a1c);logger[_0x6f50('0x19')](_0x6f50('0x1f'),_0x363a1c,JSON['stringify'](_0x1cbb12));_0x272c50(_0x1cbb12);})['catch'](function(_0x460f4e){logger[_0x6f50('0xf')](_0x6f50('0x1f'),_0x460f4e['message'],_0x363a1c);_0x10ba30(_0x37f0f2[_0x6f50('0xf')](0x1f4,_0x460f4e['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 76db95d..16cb972 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 _0x598a=['describe','/:id','show','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x3d31bd,_0x293a79){var _0xa68951=function(_0x35253f){while(--_0x35253f){_0x3d31bd['push'](_0x3d31bd['shift']());}};_0xa68951(++_0x293a79);}(_0x598a,0x1c9));var _0xa598=function(_0x5b7212,_0x487aee){_0x5b7212=_0x5b7212-0x0;var _0x4f4874=_0x598a[_0x5b7212];return _0x4f4874;};'use strict';var multer=require(_0xa598('0x0'));var util=require(_0xa598('0x1'));var path=require(_0xa598('0x2'));var timeout=require(_0xa598('0x3'));var express=require(_0xa598('0x4'));var router=express[_0xa598('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa598('0x6'));var config=require(_0xa598('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xa598('0x8')]('/',auth['isAuthenticated'](),controller[_0xa598('0x9')]);router[_0xa598('0x8')]('/describe',auth[_0xa598('0xa')](),controller[_0xa598('0xb')]);router[_0xa598('0x8')](_0xa598('0xc'),auth[_0xa598('0xa')](),controller[_0xa598('0xd')]);router['post']('/',auth[_0xa598('0xa')](),controller[_0xa598('0xe')]);router[_0xa598('0xf')]('/:id',auth[_0xa598('0xa')](),controller[_0xa598('0x10')]);router[_0xa598('0x11')]('/:id',auth[_0xa598('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfd6e=['/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','describe'];(function(_0x4a187b,_0x3ff0b6){var _0x35f3ae=function(_0x458839){while(--_0x458839){_0x4a187b['push'](_0x4a187b['shift']());}};_0x35f3ae(++_0x3ff0b6);}(_0xfd6e,0x183));var _0xefd6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfd6e[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xefd6('0x0'));var util=require(_0xefd6('0x1'));var path=require(_0xefd6('0x2'));var timeout=require(_0xefd6('0x3'));var express=require(_0xefd6('0x4'));var router=express['Router']();var auth=require(_0xefd6('0x5'));var interaction=require(_0xefd6('0x6'));var config=require(_0xefd6('0x7'));var controller=require(_0xefd6('0x8'));router['get']('/',auth[_0xefd6('0x9')](),controller[_0xefd6('0xa')]);router[_0xefd6('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xefd6('0xc')]);router[_0xefd6('0xb')](_0xefd6('0xd'),auth[_0xefd6('0x9')](),controller['show']);router[_0xefd6('0xe')]('/',auth[_0xefd6('0x9')](),controller[_0xefd6('0xf')]);router['put']('/:id',auth[_0xefd6('0x9')](),controller[_0xefd6('0x10')]);router[_0xefd6('0x11')]('/:id',auth[_0xefd6('0x9')](),controller[_0xefd6('0x12')]);module[_0xefd6('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 9e0c868..6512c71 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 _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0xc7cd9e,_0x5f4b30){var _0x5afc0e=function(_0xca5932){while(--_0xca5932){_0xc7cd9e['push'](_0xc7cd9e['shift']());}};_0x5afc0e(++_0x5f4b30);}(_0x2032,0xd9));var _0x2203=function(_0xa96d12,_0x1daace){_0xa96d12=_0xa96d12-0x0;var _0x4a0814=_0x2032[_0xa96d12];return _0x4a0814;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'uniqueid':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2203('0x2')]('account',_0x2203('0x3'),_0x2203('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x0b0e[_0x4eafed];return _0x159c85;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 9727c47..ad7125c 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 _0x4123=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','html-pdf','eml-format','rimraf'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x4123,0x179));var _0x3412=function(_0x1aa2a2,_0x570bb3){_0x1aa2a2=_0x1aa2a2-0x0;var _0x596b90=_0x4123[_0x1aa2a2];return _0x596b90;};'use strict';var pdf=require(_0x3412('0x0'));var emlformat=require(_0x3412('0x1'));var rimraf=require(_0x3412('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3412('0x3'));var rp=require(_0x3412('0x4'));var moment=require(_0x3412('0x5'));var BPromise=require(_0x3412('0x6'));var Mustache=require(_0x3412('0x7'));var util=require(_0x3412('0x8'));var path=require(_0x3412('0x9'));var sox=require(_0x3412('0xa'));var csv=require(_0x3412('0xb'));var ejs=require(_0x3412('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3412('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3412('0xb'));var querystring=require(_0x3412('0xe'));var Papa=require('papaparse');var Redis=require(_0x3412('0xf'));var authService=require(_0x3412('0x10'));var qs=require(_0x3412('0x11'));var as=require(_0x3412('0x12'));var hardwareService=require(_0x3412('0x13'));var logger=require(_0x3412('0x14'))(_0x3412('0x15'));var utils=require(_0x3412('0x16'));var config=require(_0x3412('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19ee07,_0x55b442){_0x55b442=_0x55b442||0xcc;return function(_0x315239){if(_0x315239){return _0x19ee07[_0x3412('0x18')](_0x55b442);}return _0x19ee07[_0x3412('0x19')](_0x55b442)['end']();};}function respondWithResult(_0x262a90,_0x2bdbda){_0x2bdbda=_0x2bdbda||0xc8;return function(_0x41d13d){if(_0x41d13d){return _0x262a90['status'](_0x2bdbda)[_0x3412('0x1a')](_0x41d13d);}};}function respondWithFilteredResult(_0x214cd3,_0x42bd32){return function(_0x1060c8){if(_0x1060c8){var _0x20936c=_0x1060c8[_0x3412('0x1b')],_0x3b64e1=_0x42bd32[_0x3412('0x1c')],_0x3c79f4=_0x42bd32['offset']+_0x42bd32[_0x3412('0x1d')],_0x25c3be;if(_0x3c79f4>=_0x20936c){_0x3c79f4=_0x20936c;_0x25c3be=0xc8;}else{_0x25c3be=0xce;}_0x214cd3['status'](_0x25c3be);return _0x214cd3[_0x3412('0x1e')](_0x3412('0x1f'),_0x3b64e1+'-'+_0x3c79f4+'/'+_0x20936c)[_0x3412('0x1a')](_0x1060c8);}return null;};}function patchUpdates(_0x307987){return function(_0x5640d9){try{jsonpatch[_0x3412('0x20')](_0x5640d9,_0x307987,!![]);}catch(_0x55031f){return BPromise[_0x3412('0x21')](_0x55031f);}return _0x5640d9[_0x3412('0x22')]();};}function saveUpdates(_0x1f4244,_0x1471ad){return function(_0x1bf450){if(_0x1bf450){return _0x1bf450[_0x3412('0x23')](_0x1f4244)['then'](function(_0x5bb802){return _0x5bb802;});}return null;};}function removeEntity(_0x40c195,_0x25b864){return function(_0x5b7b4c){if(_0x5b7b4c){return _0x5b7b4c[_0x3412('0x24')]()['then'](function(){_0x40c195[_0x3412('0x19')](0xcc)[_0x3412('0x25')]();});}};}function handleEntityNotFound(_0x509810,_0x477c30){return function(_0x32b30c){if(!_0x32b30c){_0x509810[_0x3412('0x18')](0x194);}return _0x32b30c;};}function handleError(_0x21a7ec,_0x5a9940){_0x5a9940=_0x5a9940||0x1f4;return function(_0x2750a8){logger[_0x3412('0x26')](_0x2750a8[_0x3412('0x27')]);if(_0x2750a8[_0x3412('0x28')]){delete _0x2750a8[_0x3412('0x28')];}_0x21a7ec[_0x3412('0x19')](_0x5a9940)[_0x3412('0x29')](_0x2750a8);};}exports[_0x3412('0x2a')]=function(_0x20e19a,_0xe41ed2){var _0xd461d6={},_0x5808c3={},_0x2f67a8={'count':0x0,'rows':[]};var _0x337c88=_[_0x3412('0x2b')](db[_0x3412('0x2c')][_0x3412('0x2d')],function(_0x4a364c){return{'name':_0x4a364c[_0x3412('0x2e')],'type':_0x4a364c[_0x3412('0x2f')][_0x3412('0x30')]};});_0x5808c3[_0x3412('0x31')]=_[_0x3412('0x2b')](_0x337c88,'name');_0x5808c3[_0x3412('0x32')]=_['keys'](_0x20e19a[_0x3412('0x32')]);_0x5808c3['filters']=_[_0x3412('0x33')](_0x5808c3[_0x3412('0x31')],_0x5808c3['query']);_0xd461d6[_0x3412('0x34')]=_[_0x3412('0x33')](_0x5808c3['model'],qs[_0x3412('0x35')](_0x20e19a[_0x3412('0x32')][_0x3412('0x35')]));_0xd461d6[_0x3412('0x34')]=_0xd461d6['attributes']['length']?_0xd461d6[_0x3412('0x34')]:_0x5808c3[_0x3412('0x31')];if(!_0x20e19a[_0x3412('0x32')]['hasOwnProperty'](_0x3412('0x36'))){_0xd461d6['limit']=qs['limit'](_0x20e19a[_0x3412('0x32')]['limit']);_0xd461d6[_0x3412('0x1c')]=qs[_0x3412('0x1c')](_0x20e19a[_0x3412('0x32')][_0x3412('0x1c')]);}_0xd461d6[_0x3412('0x37')]=qs[_0x3412('0x38')](_0x20e19a[_0x3412('0x32')][_0x3412('0x38')]);_0xd461d6[_0x3412('0x39')]=qs[_0x3412('0x3a')](_[_0x3412('0x3b')](_0x20e19a[_0x3412('0x32')],_0x5808c3[_0x3412('0x3a')]),_0x337c88);if(_0x20e19a[_0x3412('0x32')]['filter']){_0xd461d6[_0x3412('0x39')]=_[_0x3412('0x3c')](_0xd461d6['where'],{'$or':_[_0x3412('0x2b')](_0x337c88,function(_0x1d37f0){if(_0x1d37f0['type']!==_0x3412('0x3d')){var _0x135e09={};_0x135e09[_0x1d37f0[_0x3412('0x28')]]={'$like':'%'+_0x20e19a['query']['filter']+'%'};return _0x135e09;}})});}_0xd461d6=_[_0x3412('0x3c')]({},_0xd461d6,_0x20e19a[_0x3412('0x3e')]);var _0x6194fe={'where':_0xd461d6['where']};return db[_0x3412('0x2c')]['count'](_0x6194fe)[_0x3412('0x3f')](function(_0x16b0b7){_0x2f67a8['count']=_0x16b0b7;if(_0x20e19a[_0x3412('0x32')][_0x3412('0x40')]){_0xd461d6[_0x3412('0x41')]=[{'all':!![]}];}return db[_0x3412('0x2c')][_0x3412('0x42')](_0xd461d6);})[_0x3412('0x3f')](function(_0x160684){_0x2f67a8[_0x3412('0x43')]=_0x160684;return _0x2f67a8;})[_0x3412('0x3f')](respondWithFilteredResult(_0xe41ed2,_0xd461d6))[_0x3412('0x44')](handleError(_0xe41ed2,null));};exports[_0x3412('0x45')]=function(_0x360ffe,_0x410114){var _0x401c33={'raw':!![],'where':{'id':_0x360ffe[_0x3412('0x46')]['id']}},_0xd30a57={};_0xd30a57['model']=_[_0x3412('0x47')](db['WhatsappTransferReport'][_0x3412('0x2d')]);_0xd30a57[_0x3412('0x32')]=_[_0x3412('0x47')](_0x360ffe[_0x3412('0x32')]);_0xd30a57[_0x3412('0x3a')]=_[_0x3412('0x33')](_0xd30a57[_0x3412('0x31')],_0xd30a57['query']);_0x401c33['attributes']=_[_0x3412('0x33')](_0xd30a57[_0x3412('0x31')],qs[_0x3412('0x35')](_0x360ffe['query'][_0x3412('0x35')]));_0x401c33[_0x3412('0x34')]=_0x401c33[_0x3412('0x34')]['length']?_0x401c33[_0x3412('0x34')]:_0xd30a57[_0x3412('0x31')];if(_0x360ffe[_0x3412('0x32')][_0x3412('0x40')]){_0x401c33[_0x3412('0x41')]=[{'all':!![]}];}_0x401c33=_[_0x3412('0x3c')]({},_0x401c33,_0x360ffe[_0x3412('0x3e')]);return db[_0x3412('0x2c')][_0x3412('0x48')](_0x401c33)[_0x3412('0x3f')](handleEntityNotFound(_0x410114,null))[_0x3412('0x3f')](respondWithResult(_0x410114,null))[_0x3412('0x44')](handleError(_0x410114,null));};exports['create']=function(_0x40edcd,_0x4b0978){return db['WhatsappTransferReport'][_0x3412('0x49')](_0x40edcd[_0x3412('0x4a')],{})[_0x3412('0x3f')](respondWithResult(_0x4b0978,0xc9))[_0x3412('0x44')](handleError(_0x4b0978,null));};exports[_0x3412('0x23')]=function(_0x4c6d93,_0x16ef4c){if(_0x4c6d93[_0x3412('0x4a')]['id']){delete _0x4c6d93[_0x3412('0x4a')]['id'];}return db[_0x3412('0x2c')][_0x3412('0x48')]({'where':{'id':_0x4c6d93['params']['id']}})[_0x3412('0x3f')](handleEntityNotFound(_0x16ef4c,null))['then'](saveUpdates(_0x4c6d93[_0x3412('0x4a')],null))[_0x3412('0x3f')](respondWithResult(_0x16ef4c,null))[_0x3412('0x44')](handleError(_0x16ef4c,null));};exports[_0x3412('0x24')]=function(_0x7d3022,_0x1abc70){return db[_0x3412('0x2c')][_0x3412('0x48')]({'where':{'id':_0x7d3022[_0x3412('0x46')]['id']}})[_0x3412('0x3f')](handleEntityNotFound(_0x1abc70,null))['then'](removeEntity(_0x1abc70,null))[_0x3412('0x44')](handleError(_0x1abc70,null));};exports[_0x3412('0x4b')]=function(_0x2476fa,_0x28383f){return db[_0x3412('0x2c')][_0x3412('0x4b')]()[_0x3412('0x3f')](respondWithResult(_0x28383f,null))[_0x3412('0x44')](handleError(_0x28383f,null));}; \ No newline at end of file +var _0xcb9c=['nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','show','params','include','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','save','update','destroy','then','end','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xcb9c,0x17a));var _0xccb9=function(_0x5bd164,_0x19ce4c){_0x5bd164=_0x5bd164-0x0;var _0x157d0a=_0xcb9c[_0x5bd164];return _0x157d0a;};'use strict';var pdf=require(_0xccb9('0x0'));var emlformat=require(_0xccb9('0x1'));var rimraf=require(_0xccb9('0x2'));var zipdir=require(_0xccb9('0x3'));var jsonpatch=require(_0xccb9('0x4'));var rp=require(_0xccb9('0x5'));var moment=require(_0xccb9('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xccb9('0x7'));var path=require(_0xccb9('0x8'));var sox=require(_0xccb9('0x9'));var csv=require(_0xccb9('0xa'));var ejs=require(_0xccb9('0xb'));var fs=require('fs');var _=require(_0xccb9('0xc'));var squel=require(_0xccb9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xccb9('0xe'));var toCsv=require(_0xccb9('0xa'));var querystring=require(_0xccb9('0xf'));var Papa=require(_0xccb9('0x10'));var Redis=require('ioredis');var authService=require(_0xccb9('0x11'));var qs=require(_0xccb9('0x12'));var as=require(_0xccb9('0x13'));var hardwareService=require(_0xccb9('0x14'));var logger=require('../../config/logger')(_0xccb9('0x15'));var utils=require(_0xccb9('0x16'));var config=require('../../config/environment');var db=require(_0xccb9('0x17'))['db'];function respondWithStatusCode(_0x207cba,_0x4707dd){_0x4707dd=_0x4707dd||0xcc;return function(_0x99f000){if(_0x99f000){return _0x207cba[_0xccb9('0x18')](_0x4707dd);}return _0x207cba[_0xccb9('0x19')](_0x4707dd)['end']();};}function respondWithResult(_0x5195a8,_0x5c41f7){_0x5c41f7=_0x5c41f7||0xc8;return function(_0x567955){if(_0x567955){return _0x5195a8[_0xccb9('0x19')](_0x5c41f7)['json'](_0x567955);}};}function respondWithFilteredResult(_0x44593e,_0x19591d){return function(_0xef0df8){if(_0xef0df8){var _0x5b8867=_0xef0df8['count'],_0x54d235=_0x19591d[_0xccb9('0x1a')],_0x53556e=_0x19591d[_0xccb9('0x1a')]+_0x19591d[_0xccb9('0x1b')],_0x1e685e;if(_0x53556e>=_0x5b8867){_0x53556e=_0x5b8867;_0x1e685e=0xc8;}else{_0x1e685e=0xce;}_0x44593e[_0xccb9('0x19')](_0x1e685e);return _0x44593e[_0xccb9('0x1c')](_0xccb9('0x1d'),_0x54d235+'-'+_0x53556e+'/'+_0x5b8867)[_0xccb9('0x1e')](_0xef0df8);}return null;};}function patchUpdates(_0x190d16){return function(_0x5a5118){try{jsonpatch['apply'](_0x5a5118,_0x190d16,!![]);}catch(_0x5ebbfe){return BPromise['reject'](_0x5ebbfe);}return _0x5a5118[_0xccb9('0x1f')]();};}function saveUpdates(_0x40f8a1,_0x1a649f){return function(_0x10d1a8){if(_0x10d1a8){return _0x10d1a8[_0xccb9('0x20')](_0x40f8a1)['then'](function(_0x484ad5){return _0x484ad5;});}return null;};}function removeEntity(_0x34a0cb,_0x4cb642){return function(_0x3e5200){if(_0x3e5200){return _0x3e5200[_0xccb9('0x21')]()[_0xccb9('0x22')](function(){_0x34a0cb[_0xccb9('0x19')](0xcc)[_0xccb9('0x23')]();});}};}function handleEntityNotFound(_0x204e37,_0x39f502){return function(_0x47ed07){if(!_0x47ed07){_0x204e37[_0xccb9('0x18')](0x194);}return _0x47ed07;};}function handleError(_0x3af23e,_0x113c26){_0x113c26=_0x113c26||0x1f4;return function(_0x3a8a79){logger[_0xccb9('0x24')](_0x3a8a79[_0xccb9('0x25')]);if(_0x3a8a79[_0xccb9('0x26')]){delete _0x3a8a79[_0xccb9('0x26')];}_0x3af23e[_0xccb9('0x19')](_0x113c26)[_0xccb9('0x27')](_0x3a8a79);};}exports[_0xccb9('0x28')]=function(_0x52e0f9,_0x2df600){var _0x38e745={},_0x47cfee={},_0x1de5bd={'count':0x0,'rows':[]};var _0x54452a=_['map'](db[_0xccb9('0x29')][_0xccb9('0x2a')],function(_0x3eb178){return{'name':_0x3eb178['fieldName'],'type':_0x3eb178[_0xccb9('0x2b')][_0xccb9('0x2c')]};});_0x47cfee[_0xccb9('0x2d')]=_['map'](_0x54452a,_0xccb9('0x26'));_0x47cfee[_0xccb9('0x2e')]=_[_0xccb9('0x2f')](_0x52e0f9[_0xccb9('0x2e')]);_0x47cfee[_0xccb9('0x30')]=_[_0xccb9('0x31')](_0x47cfee[_0xccb9('0x2d')],_0x47cfee['query']);_0x38e745[_0xccb9('0x32')]=_[_0xccb9('0x31')](_0x47cfee[_0xccb9('0x2d')],qs[_0xccb9('0x33')](_0x52e0f9[_0xccb9('0x2e')][_0xccb9('0x33')]));_0x38e745[_0xccb9('0x32')]=_0x38e745[_0xccb9('0x32')][_0xccb9('0x34')]?_0x38e745[_0xccb9('0x32')]:_0x47cfee[_0xccb9('0x2d')];if(!_0x52e0f9[_0xccb9('0x2e')][_0xccb9('0x35')](_0xccb9('0x36'))){_0x38e745['limit']=qs['limit'](_0x52e0f9['query']['limit']);_0x38e745['offset']=qs['offset'](_0x52e0f9[_0xccb9('0x2e')]['offset']);}_0x38e745['order']=qs[_0xccb9('0x37')](_0x52e0f9[_0xccb9('0x2e')]['sort']);_0x38e745[_0xccb9('0x38')]=qs['filters'](_[_0xccb9('0x39')](_0x52e0f9[_0xccb9('0x2e')],_0x47cfee['filters']),_0x54452a);if(_0x52e0f9[_0xccb9('0x2e')][_0xccb9('0x3a')]){_0x38e745[_0xccb9('0x38')]=_[_0xccb9('0x3b')](_0x38e745[_0xccb9('0x38')],{'$or':_[_0xccb9('0x3c')](_0x54452a,function(_0x1aabff){if(_0x1aabff[_0xccb9('0x2b')]!==_0xccb9('0x3d')){var _0x644a6e={};_0x644a6e[_0x1aabff[_0xccb9('0x26')]]={'$like':'%'+_0x52e0f9[_0xccb9('0x2e')][_0xccb9('0x3a')]+'%'};return _0x644a6e;}})});}_0x38e745=_[_0xccb9('0x3b')]({},_0x38e745,_0x52e0f9[_0xccb9('0x3e')]);var _0x488f60={'where':_0x38e745[_0xccb9('0x38')]};return db['WhatsappTransferReport'][_0xccb9('0x3f')](_0x488f60)[_0xccb9('0x22')](function(_0x19f089){_0x1de5bd[_0xccb9('0x3f')]=_0x19f089;if(_0x52e0f9[_0xccb9('0x2e')][_0xccb9('0x40')]){_0x38e745['include']=[{'all':!![]}];}return db[_0xccb9('0x29')]['findAll'](_0x38e745);})[_0xccb9('0x22')](function(_0x437333){_0x1de5bd['rows']=_0x437333;return _0x1de5bd;})[_0xccb9('0x22')](respondWithFilteredResult(_0x2df600,_0x38e745))['catch'](handleError(_0x2df600,null));};exports[_0xccb9('0x41')]=function(_0x384ced,_0x418804){var _0x2fb75f={'raw':!![],'where':{'id':_0x384ced[_0xccb9('0x42')]['id']}},_0x400927={};_0x400927['model']=_[_0xccb9('0x2f')](db[_0xccb9('0x29')][_0xccb9('0x2a')]);_0x400927[_0xccb9('0x2e')]=_[_0xccb9('0x2f')](_0x384ced[_0xccb9('0x2e')]);_0x400927[_0xccb9('0x30')]=_[_0xccb9('0x31')](_0x400927[_0xccb9('0x2d')],_0x400927['query']);_0x2fb75f['attributes']=_[_0xccb9('0x31')](_0x400927[_0xccb9('0x2d')],qs['fields'](_0x384ced[_0xccb9('0x2e')][_0xccb9('0x33')]));_0x2fb75f[_0xccb9('0x32')]=_0x2fb75f[_0xccb9('0x32')][_0xccb9('0x34')]?_0x2fb75f[_0xccb9('0x32')]:_0x400927['model'];if(_0x384ced['query'][_0xccb9('0x40')]){_0x2fb75f[_0xccb9('0x43')]=[{'all':!![]}];}_0x2fb75f=_[_0xccb9('0x3b')]({},_0x2fb75f,_0x384ced[_0xccb9('0x3e')]);return db[_0xccb9('0x29')][_0xccb9('0x44')](_0x2fb75f)['then'](handleEntityNotFound(_0x418804,null))[_0xccb9('0x22')](respondWithResult(_0x418804,null))[_0xccb9('0x45')](handleError(_0x418804,null));};exports[_0xccb9('0x46')]=function(_0x219bac,_0x9a8666){return db['WhatsappTransferReport'][_0xccb9('0x46')](_0x219bac['body'],{})[_0xccb9('0x22')](respondWithResult(_0x9a8666,0xc9))[_0xccb9('0x45')](handleError(_0x9a8666,null));};exports['update']=function(_0x2c67cf,_0x5ec287){if(_0x2c67cf[_0xccb9('0x47')]['id']){delete _0x2c67cf[_0xccb9('0x47')]['id'];}return db[_0xccb9('0x29')][_0xccb9('0x44')]({'where':{'id':_0x2c67cf['params']['id']}})[_0xccb9('0x22')](handleEntityNotFound(_0x5ec287,null))[_0xccb9('0x22')](saveUpdates(_0x2c67cf[_0xccb9('0x47')],null))[_0xccb9('0x22')](respondWithResult(_0x5ec287,null))[_0xccb9('0x45')](handleError(_0x5ec287,null));};exports['destroy']=function(_0x491b7b,_0xc438b7){return db[_0xccb9('0x29')][_0xccb9('0x44')]({'where':{'id':_0x491b7b[_0xccb9('0x42')]['id']}})[_0xccb9('0x22')](handleEntityNotFound(_0xc438b7,null))[_0xccb9('0x22')](removeEntity(_0xc438b7,null))[_0xccb9('0x45')](handleError(_0xc438b7,null));};exports['describe']=function(_0x5079c0,_0x149891){return db[_0xccb9('0x29')]['describe']()['then'](respondWithResult(_0x149891,null))[_0xccb9('0x45')](handleError(_0x149891,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 926a1c6..7e09440 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 _0x03ca=['lodash','../../config/logger','api','moment','bluebird','path','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x03ca,0xf0));var _0xa03c=function(_0x214b37,_0x2accac){_0x214b37=_0x214b37-0x0;var _0x498356=_0x03ca[_0x214b37];return _0x498356;};'use strict';var _=require(_0xa03c('0x0'));var util=require('util');var logger=require(_0xa03c('0x1'))(_0xa03c('0x2'));var moment=require(_0xa03c('0x3'));var BPromise=require(_0xa03c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa03c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa03c('0x6'));module[_0xa03c('0x7')]=function(_0x135e0a,_0x2d67c3){return _0x135e0a[_0xa03c('0x8')](_0xa03c('0x9'),attributes,{'tableName':_0xa03c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa03c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x47c2=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash'];(function(_0x3c4274,_0x858023){var _0x36a214=function(_0x5273e5){while(--_0x5273e5){_0x3c4274['push'](_0x3c4274['shift']());}};_0x36a214(++_0x858023);}(_0x47c2,0xcf));var _0x247c=function(_0xce429b,_0x504f2a){_0xce429b=_0xce429b-0x0;var _0x115647=_0x47c2[_0xce429b];return _0x115647;};'use strict';var _=require(_0x247c('0x0'));var util=require(_0x247c('0x1'));var logger=require('../../config/logger')(_0x247c('0x2'));var moment=require(_0x247c('0x3'));var BPromise=require(_0x247c('0x4'));var rp=require(_0x247c('0x5'));var fs=require('fs');var path=require(_0x247c('0x6'));var rimraf=require('rimraf');var config=require(_0x247c('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0x247c('0x8')]=function(_0x494fbe,_0x382cda){return _0x494fbe[_0x247c('0x9')](_0x247c('0xa'),attributes,{'tableName':_0x247c('0xb'),'paranoid':![],'indexes':[{'name':_0x247c('0xc'),'fields':[_0x247c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 8a6ddaa..2c933e5 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(_0x43ac7f,_0x3d04de){var _0x3bf961=function(_0x502271){while(--_0x502271){_0x43ac7f['push'](_0x43ac7f['shift']());}};_0x3bf961(++_0x3d04de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x3b7572,_0x811c63){var _0x143f8d=function(_0x51e8a2){while(--_0x51e8a2){_0x3b7572['push'](_0x3b7572['shift']());}};_0x143f8d(++_0x811c63);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 1e741de..c002f47 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x438b=['./config/license','catch','error','exit','lodash','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','sequelize','sync','then','info','start','map','filter','online','name','join','None','seedDB','./config/seedDB'];(function(_0x351d3a,_0x5d3c49){var _0x27433c=function(_0x2d53fe){while(--_0x2d53fe){_0x351d3a['push'](_0x351d3a['shift']());}};_0x27433c(++_0x5d3c49);}(_0x438b,0x77));var _0xb438=function(_0x277733,_0x1799b5){_0x277733=_0x277733-0x0;var _0x24b824=_0x438b[_0x277733];return _0x24b824;};'use strict';var _=require(_0xb438('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0xb438('0x1'));var config=require('./config/environment');var logger=require(_0xb438('0x2'))('app');var pm2=require(_0xb438('0x3'));var pm2Config=require(_0xb438('0x4'));var schedule=require(_0xb438('0x5'));var chat=require('./config/schedule/chat');function main(){return mysqldb['db'][_0xb438('0x6')][_0xb438('0x7')]()[_0xb438('0x8')](function(){return rpc['listen']();})[_0xb438('0x8')](function(_0x13f85a){logger[_0xb438('0x9')](_0x13f85a);return chat['start']();})['then'](function(){return schedule['start']();})[_0xb438('0x8')](function(_0x9968d2){logger[_0xb438('0x9')](_0x9968d2);return pm2[_0xb438('0xa')](pm2Config);})['then'](function(_0x4a9bdb){logger[_0xb438('0x9')]('Online\x20apps:',_[_0xb438('0xb')](_[_0xb438('0xc')](_0x4a9bdb,{'status':_0xb438('0xd')}),_0xb438('0xe'))[_0xb438('0xf')]());logger[_0xb438('0x9')]('Offline\x20apps:',_['map'](_[_0xb438('0xc')](_0x4a9bdb,function(_0xaefdc4){return _0xaefdc4['status']!==_0xb438('0xd');}),'name')[_0xb438('0xf')]()||_0xb438('0x10'));config[_0xb438('0x11')]&&require(_0xb438('0x12'))['default']();require(_0xb438('0x13'))['default']();})[_0xb438('0x14')](function(_0xdc5841){logger[_0xb438('0x15')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0xdc5841);process[_0xb438('0x16')](0x1);});}main(); \ No newline at end of file +var _0x02a6=['sync','then','listen','start','info','Online\x20apps:','filter','online','name','join','Offline\x20apps:','map','status','None','./config/seedDB','default','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x02a6,0xde));var _0x602a=function(_0x5e59e7,_0x2ca30d){_0x5e59e7=_0x5e59e7-0x0;var _0x591959=_0x02a6[_0x5e59e7];return _0x591959;};'use strict';var _=require(_0x602a('0x0'));var mysqldb=require(_0x602a('0x1'));var rpc=require(_0x602a('0x2'));var config=require(_0x602a('0x3'));var logger=require(_0x602a('0x4'))(_0x602a('0x5'));var pm2=require(_0x602a('0x6'));var pm2Config=require(_0x602a('0x7'));var schedule=require('./config/schedule');var chat=require(_0x602a('0x8'));function main(){return mysqldb['db'][_0x602a('0x9')][_0x602a('0xa')]()[_0x602a('0xb')](function(){return rpc[_0x602a('0xc')]();})[_0x602a('0xb')](function(_0x4b3685){logger['info'](_0x4b3685);return chat[_0x602a('0xd')]();})['then'](function(){return schedule[_0x602a('0xd')]();})[_0x602a('0xb')](function(_0x105c62){logger[_0x602a('0xe')](_0x105c62);return pm2[_0x602a('0xd')](pm2Config);})[_0x602a('0xb')](function(_0x45cb6f){logger[_0x602a('0xe')](_0x602a('0xf'),_['map'](_[_0x602a('0x10')](_0x45cb6f,{'status':_0x602a('0x11')}),_0x602a('0x12'))[_0x602a('0x13')]());logger[_0x602a('0xe')](_0x602a('0x14'),_[_0x602a('0x15')](_['filter'](_0x45cb6f,function(_0x4778eb){return _0x4778eb[_0x602a('0x16')]!==_0x602a('0x11');}),_0x602a('0x12'))[_0x602a('0x13')]()||_0x602a('0x17'));config['seedDB']&&require(_0x602a('0x18'))[_0x602a('0x19')]();require('./config/license')[_0x602a('0x19')]();})['catch'](function(_0x5bde0c){logger[_0x602a('0x1a')](_0x602a('0x1b'),_0x5bde0c);process[_0x602a('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 1895b9d..0546239 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 _0xd7d1=['pass','Wrong\x20credentials.','catch','Bearer','apikey','getUuid','query','find','sub','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','use','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyNonce','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','sign','secret','options','promisify','verify','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','params','closed','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','authorization','startsWith','headers','User','then','authenticate'];(function(_0x3c3f47,_0x23461a){var _0x3b9fd9=function(_0x33c57d){while(--_0x33c57d){_0x3c3f47['push'](_0x3c3f47['shift']());}};_0x3b9fd9(++_0x23461a);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x242434,_0x21cddf){_0x242434=_0x242434-0x0;var _0xbe980=_0xd7d1[_0x242434];return _0xbe980;};'use strict';var db=require(_0x1d7d('0x0'))['db'];var config=require(_0x1d7d('0x1'));var hardwareConf=require(_0x1d7d('0x2'));var _=require(_0x1d7d('0x3'));var jwt=require(_0x1d7d('0x4'));var expressJwt=require(_0x1d7d('0x5'));var compose=require(_0x1d7d('0x6'));var basicAuth=require(_0x1d7d('0x7'));var crypto=require(_0x1d7d('0x8'));var BPromise=require(_0x1d7d('0x9'));var validateJwt=expressJwt({'secret':config[_0x1d7d('0xa')][_0x1d7d('0xb')]});var userAttributes=['id',_0x1d7d('0xc'),'fullname',_0x1d7d('0xd'),_0x1d7d('0xe'),_0x1d7d('0xf'),_0x1d7d('0x10'),_0x1d7d('0x11'),_0x1d7d('0x12'),_0x1d7d('0x13'),_0x1d7d('0x14'),_0x1d7d('0x15'),_0x1d7d('0x16'),_0x1d7d('0x17'),'openchannelPause',_0x1d7d('0x18'),'showWebBar',_0x1d7d('0x19'),_0x1d7d('0x1a'),_0x1d7d('0x1b'),_0x1d7d('0x1c'),'passwordResetAt',_0x1d7d('0x1d'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0x1d7d('0x1e'),_0x1d7d('0x1f'),'phoneBarEnableSettings','phoneBarExpires',_0x1d7d('0x20'),_0x1d7d('0x21'),_0x1d7d('0x22'),_0x1d7d('0x23'),_0x1d7d('0x24'),'userProfileId'];exports[_0x1d7d('0x25')]=function(){return this[_0x1d7d('0x26')](!![])['use'](function(_0xb90a8c,_0x162c3a,_0x3c3417){if(_0xb90a8c[_0x1d7d('0x27')]){_0x3c3417();}else{return db[_0x1d7d('0x28')]['findOne']({'where':{'id':_0xb90a8c[_0x1d7d('0x29')]['id']},'attributes':['id',_0x1d7d('0x2a'),'disposition'],'raw':!![]})['then'](function(_0x2406dd){if(_0x2406dd&&_0x2406dd[_0x1d7d('0x2a')]){return _0x162c3a[_0x1d7d('0x2b')](_0x2406dd[_0x1d7d('0x2c')]===_0x1d7d('0x2d')?0x195:0x193)[_0x1d7d('0x2e')]({'message':_0x2406dd['disposition']===_0x1d7d('0x2d')?_0x1d7d('0x2f'):_0x1d7d('0x30')});}else{_0x3c3417();}})['catch'](function(_0x29caf4){_0x3c3417(_0x29caf4);});}});};exports[_0x1d7d('0x26')]=function isAuthenticated(_0x4a1cdc){return compose()['use'](function(_0x1dcaf2,_0x264a4e,_0x3d631f){if(_0x1dcaf2['headers'][_0x1d7d('0x31')]){if(_[_0x1d7d('0x32')](_0x1dcaf2[_0x1d7d('0x33')][_0x1d7d('0x31')],'Basic')){var _0x233463=basicAuth(_0x1dcaf2);db[_0x1d7d('0x34')]['find']({'where':{'name':_0x233463['name']}})[_0x1d7d('0x35')](function(_0x52c618){if(!_0x52c618||!_0x52c618[_0x1d7d('0x36')](_0x233463[_0x1d7d('0x37')])){return _0x264a4e[_0x1d7d('0x2b')](0x191)[_0x1d7d('0x2e')]({'message':_0x1d7d('0x38')});}_0x1dcaf2['user']={'id':_0x52c618['id']};_0x3d631f();})[_0x1d7d('0x39')](function(_0x98c1ad){_0x3d631f(_0x98c1ad);});}else if(_[_0x1d7d('0x32')](_0x1dcaf2['headers'][_0x1d7d('0x31')],_0x1d7d('0x3a'))){validateJwt(_0x1dcaf2,_0x264a4e,_0x3d631f);}else{if(_0x4a1cdc){_0x3d631f();}else{return _0x264a4e[_0x1d7d('0x2b')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x1dcaf2['query'][_0x1d7d('0x3b')]){try{var _0x329f56={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x1d7d('0x3c')]()};verifyJwt(_0x1dcaf2[_0x1d7d('0x3d')][_0x1d7d('0x3b')],_0x329f56)[_0x1d7d('0x35')](function(_0x342f4e){return db[_0x1d7d('0x34')][_0x1d7d('0x3e')]({'where':{'id':_0x342f4e[_0x1d7d('0x3f')]}})[_0x1d7d('0x35')](function(_0x456b56){if(!_0x456b56||!_['isEqual'](_0x456b56['apiKeyNonce'],_0x342f4e[_0x1d7d('0x40')])){return _0x264a4e[_0x1d7d('0x2b')](0x191)[_0x1d7d('0x2e')]({'message':_0x1d7d('0x41')});}_0x1dcaf2[_0x1d7d('0x27')]={'id':_0x456b56['id']};_0x3d631f();});})[_0x1d7d('0x39')](function(){return _0x264a4e[_0x1d7d('0x2b')](0x191)[_0x1d7d('0x2e')]({'message':_0x1d7d('0x42')});});}catch(_0x47b6b2){_0x3d631f(_0x47b6b2);}}else if(_0x4a1cdc){_0x3d631f();}else{return _0x264a4e[_0x1d7d('0x2b')](0x193)[_0x1d7d('0x2e')]({'message':_0x1d7d('0x43')});}})[_0x1d7d('0x44')](function(_0x4cc364,_0x4ee17f,_0x472fd9){if(_0x4cc364[_0x1d7d('0x27')]){db['User'][_0x1d7d('0x3e')]({'where':{'id':_0x4cc364[_0x1d7d('0x27')]['id']},'attributes':userAttributes})['then'](function(_0x4cd758){if(!_0x4cd758){return _0x4ee17f[_0x1d7d('0x2b')](0x194)[_0x1d7d('0x2e')]({'message':_0x1d7d('0x45')});}_0x4cc364[_0x1d7d('0x27')]=_0x4cd758;_0x472fd9();})[_0x1d7d('0x39')](function(_0x3427eb){_0x472fd9(_0x3427eb);});}else if(_0x4a1cdc){_0x472fd9();}else{return _0x4ee17f[_0x1d7d('0x2b')](0x194)[_0x1d7d('0x2e')]({'message':_0x1d7d('0x46')});}});};exports[_0x1d7d('0x47')]=function canUpdate(){return compose()['use'](function(_0x5ed8a6,_0x57db7a,_0x5cab41){return require(_0x1d7d('0x48'))['getLicense']()[_0x1d7d('0x35')](function(_0x414083){if(_0x414083[_0x1d7d('0x49')]){_0x5cab41();}else{return _0x57db7a['status'](0x193)[_0x1d7d('0x2e')]({'message':_0x1d7d('0x4a')});}})[_0x1d7d('0x39')](function(_0x5b7e01){_0x5cab41(_0x5b7e01);});});};exports[_0x1d7d('0x4b')]=function(_0xa53806,_0xfb9845,_0x2100f6){_0xa53806['isMiddleware']=!![];return _0x2100f6();};exports[_0x1d7d('0x4c')]=function signToken(_0x42c229){return signJwt(_0x42c229);};exports[_0x1d7d('0x4d')]=function(_0x456d51,_0x5049ff){if(!_0x456d51[_0x1d7d('0x27')]){return _0x5049ff['status'](0x194)[_0x1d7d('0x2e')]({'message':_0x1d7d('0x4e')});}var _0x671580={'payload':{'id':_0x456d51[_0x1d7d('0x27')]['id'],'role':_0x456d51[_0x1d7d('0x27')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x671580)['then'](function(_0x33582a){_0x5049ff[_0x1d7d('0x4f')](_0x1d7d('0x50'),_0x33582a);_0x5049ff['redirect']('/dashboards/general');})[_0x1d7d('0x39')](function(_0x4f5ba3){return _0x5049ff[_0x1d7d('0x2b')](0x1f4)[_0x1d7d('0x51')](_0x4f5ba3);});};exports[_0x1d7d('0x52')]=function(_0x21394c){if(_[_0x1d7d('0x53')](_0x21394c[_0x1d7d('0x54')])||_[_0x1d7d('0x53')](_0x21394c['apiKeyIat'])){return null;}else{return createJwt(_0x21394c);}};exports[_0x1d7d('0x55')]=function(_0x8b0c22){_0x8b0c22['apiKeyNonce']=generateNonce();_0x8b0c22[_0x1d7d('0x56')]=generateIssuedAt();return createJwt(_0x8b0c22);};exports[_0x1d7d('0x57')]=function(_0x40599b,_0x24b5e7){var _0x11bbe3=_0x40599b[_0x1d7d('0x3d')][_0x1d7d('0x3b')];if(_0x11bbe3){var _0x1f7066={'nonce':_0x24b5e7[_0x1d7d('0x54')],'iat':_0x24b5e7[_0x1d7d('0x56')],'audience':hardwareConf[_0x1d7d('0x3c')](),'issuer':hardwareConf[_0x1d7d('0x3c')]()};return verifyJwt(_0x11bbe3,_0x1f7066)['then'](function(){return generateApiKey(_0x24b5e7);});}else{throw{'message':_0x1d7d('0x58')};}};function signJwt(_0x5904e0){var _0xbfe60=BPromise['promisify'](jwt[_0x1d7d('0x59')],{'context':jwt});var _0x3e9104=_0x5904e0[_0x1d7d('0x5a')]||config[_0x1d7d('0xa')]['session'];return new BPromise(function(_0x2dbb61,_0x5535d4){_0xbfe60(_0x5904e0['payload'],_0x3e9104,_0x5904e0[_0x1d7d('0x5b')])['then'](function(_0x57e416){_0x2dbb61(_0x57e416);})[_0x1d7d('0x39')](function(_0xf9b677){_0x5535d4(_0xf9b677);});});}function verifyJwt(_0x506564,_0x101abf,_0x1383f9){var _0x527711=BPromise[_0x1d7d('0x5c')](jwt[_0x1d7d('0x5d')],{'context':jwt});var _0xa64dbe=_0x1383f9||config[_0x1d7d('0xa')]['session'];return new BPromise(function(_0x4a577a,_0x3f73eb){_0x527711(_0x506564,_0xa64dbe,_0x101abf)[_0x1d7d('0x35')](function(_0x35ff5d){_0x4a577a(_0x35ff5d);})[_0x1d7d('0x39')](function(_0x3cc5b7){_0x3f73eb(_0x3cc5b7);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x1d7d('0x5e')](_0x1d7d('0x5f'));}function generateIssuedAt(){return Math[_0x1d7d('0x60')](Date[_0x1d7d('0x61')]()/0x3e8)[_0x1d7d('0x5e')]();}function createJwt(_0x42a103){var _0x276e7e={'payload':{'iat':_0x42a103[_0x1d7d('0x56')],'nonce':_0x42a103[_0x1d7d('0x54')]},'options':{'algorithm':'HS512','subject':_0x42a103['id'][_0x1d7d('0x5e')](),'issuer':hardwareConf[_0x1d7d('0x3c')](),'audience':hardwareConf[_0x1d7d('0x3c')]()}};return signJwt(_0x276e7e)['then'](function(_0x591555){return{'iat':_0x42a103[_0x1d7d('0x56')],'nonce':_0x42a103[_0x1d7d('0x54')],'token':_0x591555};});} \ No newline at end of file +var _0x757a=['find','authenticate','pass','json','query','getUuid','User','sub','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','catch','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','update','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','apikey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','options','randomBytes','toString','hex','floor','now','HS512','../../config/environment','../../config/license/hardware','composable-middleware','basic-auth','crypto','bluebird','secrets','session','fullname','name','email','userpic','permissions','md5secret','voicePause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','phoneBarAutoAnswer','phoneBarEnableDtmfTone','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','closed','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','headers','authorization','startsWith'];(function(_0x30cbab,_0x579a8e){var _0x301cd6=function(_0x53e59b){while(--_0x53e59b){_0x30cbab['push'](_0x30cbab['shift']());}};_0x301cd6(++_0x579a8e);}(_0x757a,0xde));var _0xa757=function(_0x441dd8,_0x3af41a){_0x441dd8=_0x441dd8-0x0;var _0x468d95=_0x757a[_0x441dd8];return _0x468d95;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xa757('0x0'));var hardwareConf=require(_0xa757('0x1'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0xa757('0x2'));var basicAuth=require(_0xa757('0x3'));var crypto=require(_0xa757('0x4'));var BPromise=require(_0xa757('0x5'));var validateJwt=expressJwt({'secret':config[_0xa757('0x6')][_0xa757('0x7')]});var userAttributes=['id','role',_0xa757('0x8'),_0xa757('0x9'),'internal',_0xa757('0xa'),_0xa757('0xb'),_0xa757('0xc'),_0xa757('0xd'),_0xa757('0xe'),'chatPause',_0xa757('0xf'),_0xa757('0x10'),_0xa757('0x11'),_0xa757('0x12'),_0xa757('0x13'),_0xa757('0x14'),_0xa757('0x15'),'lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias',_0xa757('0x16'),'phoneBarAutoAnswerDelay','phoneBarEnableRecording',_0xa757('0x17'),'phoneBarEnableSettings','phoneBarExpires',_0xa757('0x18'),_0xa757('0x19'),_0xa757('0x1a'),_0xa757('0x1b'),_0xa757('0x1c'),_0xa757('0x1d')];exports[_0xa757('0x1e')]=function(){return this[_0xa757('0x1f')](!![])[_0xa757('0x20')](function(_0x3df1f9,_0x50aac1,_0x2e195b){if(_0x3df1f9[_0xa757('0x21')]){_0x2e195b();}else{return db[_0xa757('0x22')]['findOne']({'where':{'id':_0x3df1f9['params']['id']},'attributes':['id',_0xa757('0x23'),_0xa757('0x24')],'raw':!![]})[_0xa757('0x25')](function(_0x340599){if(_0x340599&&_0x340599[_0xa757('0x23')]){return _0x50aac1[_0xa757('0x26')](_0x340599['disposition']===_0xa757('0x27')?0x195:0x193)['json']({'message':_0x340599[_0xa757('0x24')]===_0xa757('0x27')?_0xa757('0x28'):_0xa757('0x29')});}else{_0x2e195b();}})['catch'](function(_0x5638c7){_0x2e195b(_0x5638c7);});}});};exports[_0xa757('0x1f')]=function isAuthenticated(_0x2159cf){return compose()[_0xa757('0x20')](function(_0x8d121f,_0x1d6e2,_0x40562f){if(_0x8d121f[_0xa757('0x2a')][_0xa757('0x2b')]){if(_[_0xa757('0x2c')](_0x8d121f['headers'][_0xa757('0x2b')],'Basic')){var _0x422e9e=basicAuth(_0x8d121f);db['User'][_0xa757('0x2d')]({'where':{'name':_0x422e9e[_0xa757('0x9')]}})[_0xa757('0x25')](function(_0x4d58a4){if(!_0x4d58a4||!_0x4d58a4[_0xa757('0x2e')](_0x422e9e[_0xa757('0x2f')])){return _0x1d6e2[_0xa757('0x26')](0x191)[_0xa757('0x30')]({'message':'Wrong\x20credentials.'});}_0x8d121f[_0xa757('0x21')]={'id':_0x4d58a4['id']};_0x40562f();})['catch'](function(_0x5a5664){_0x40562f(_0x5a5664);});}else if(_['startsWith'](_0x8d121f['headers'][_0xa757('0x2b')],'Bearer')){validateJwt(_0x8d121f,_0x1d6e2,_0x40562f);}else{if(_0x2159cf){_0x40562f();}else{return _0x1d6e2[_0xa757('0x26')](0x193)[_0xa757('0x30')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x8d121f[_0xa757('0x31')]['apikey']){try{var _0x2c4823={'audience':hardwareConf[_0xa757('0x32')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x8d121f[_0xa757('0x31')]['apikey'],_0x2c4823)[_0xa757('0x25')](function(_0x27b3e2){return db[_0xa757('0x33')][_0xa757('0x2d')]({'where':{'id':_0x27b3e2[_0xa757('0x34')]}})[_0xa757('0x25')](function(_0x1a44a9){if(!_0x1a44a9||!_[_0xa757('0x35')](_0x1a44a9[_0xa757('0x36')],_0x27b3e2[_0xa757('0x37')])){return _0x1d6e2[_0xa757('0x26')](0x191)[_0xa757('0x30')]({'message':_0xa757('0x38')});}_0x8d121f[_0xa757('0x21')]={'id':_0x1a44a9['id']};_0x40562f();});})[_0xa757('0x39')](function(){return _0x1d6e2[_0xa757('0x26')](0x191)[_0xa757('0x30')]({'message':_0xa757('0x3a')});});}catch(_0x1eacde){_0x40562f(_0x1eacde);}}else if(_0x2159cf){_0x40562f();}else{return _0x1d6e2[_0xa757('0x26')](0x193)[_0xa757('0x30')]({'message':_0xa757('0x3b')});}})[_0xa757('0x20')](function(_0x3aae1e,_0x59700d,_0x2adf93){if(_0x3aae1e[_0xa757('0x21')]){db[_0xa757('0x33')][_0xa757('0x2d')]({'where':{'id':_0x3aae1e[_0xa757('0x21')]['id']},'attributes':userAttributes})['then'](function(_0x1d4414){if(!_0x1d4414){return _0x59700d[_0xa757('0x26')](0x194)[_0xa757('0x30')]({'message':_0xa757('0x3c')});}_0x3aae1e[_0xa757('0x21')]=_0x1d4414;_0x2adf93();})[_0xa757('0x39')](function(_0x499390){_0x2adf93(_0x499390);});}else if(_0x2159cf){_0x2adf93();}else{return _0x59700d[_0xa757('0x26')](0x194)[_0xa757('0x30')]({'message':_0xa757('0x3d')});}});};exports[_0xa757('0x3e')]=function canUpdate(){return compose()[_0xa757('0x20')](function(_0x111cfe,_0x24e280,_0x3e12a5){return require(_0xa757('0x3f'))['getLicense']()[_0xa757('0x25')](function(_0x34fba8){if(_0x34fba8[_0xa757('0x40')]){_0x3e12a5();}else{return _0x24e280[_0xa757('0x26')](0x193)[_0xa757('0x30')]({'message':_0xa757('0x41')});}})['catch'](function(_0x10d3fd){_0x3e12a5(_0x10d3fd);});});};exports[_0xa757('0x42')]=function(_0x48cde9,_0x5eae0b,_0x9607af){_0x48cde9[_0xa757('0x42')]=!![];return _0x9607af();};exports['signToken']=function signToken(_0x51c3d1){return signJwt(_0x51c3d1);};exports[_0xa757('0x43')]=function(_0x1725a2,_0xd80ee2){if(!_0x1725a2['user']){return _0xd80ee2[_0xa757('0x26')](0x194)[_0xa757('0x30')]({'message':_0xa757('0x44')});}var _0x1ba399={'payload':{'id':_0x1725a2[_0xa757('0x21')]['id'],'role':_0x1725a2['user'][_0xa757('0x45')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1ba399)['then'](function(_0x564d40){_0xd80ee2[_0xa757('0x46')](_0xa757('0x47'),_0x564d40);_0xd80ee2[_0xa757('0x48')](_0xa757('0x49'));})[_0xa757('0x39')](function(_0x5d347c){return _0xd80ee2['status'](0x1f4)[_0xa757('0x4a')](_0x5d347c);});};exports[_0xa757('0x4b')]=function(_0x2b171c){if(_[_0xa757('0x4c')](_0x2b171c[_0xa757('0x36')])||_[_0xa757('0x4c')](_0x2b171c['apiKeyIat'])){return null;}else{return createJwt(_0x2b171c);}};exports[_0xa757('0x4d')]=function(_0x364998){_0x364998['apiKeyNonce']=generateNonce();_0x364998[_0xa757('0x4e')]=generateIssuedAt();return createJwt(_0x364998);};exports['regenerateApiKey']=function(_0x2d111e,_0x4518dc){var _0x4cf90f=_0x2d111e[_0xa757('0x31')][_0xa757('0x4f')];if(_0x4cf90f){var _0x4bee69={'nonce':_0x4518dc[_0xa757('0x36')],'iat':_0x4518dc[_0xa757('0x4e')],'audience':hardwareConf[_0xa757('0x32')](),'issuer':hardwareConf[_0xa757('0x32')]()};return verifyJwt(_0x4cf90f,_0x4bee69)['then'](function(){return generateApiKey(_0x4518dc);});}else{throw{'message':_0xa757('0x50')};}};function signJwt(_0x1be3bb){var _0x450815=BPromise[_0xa757('0x51')](jwt['sign'],{'context':jwt});var _0xd4c1b=_0x1be3bb['secret']||config['secrets'][_0xa757('0x7')];return new BPromise(function(_0x3c039d,_0x1ae3ae){_0x450815(_0x1be3bb['payload'],_0xd4c1b,_0x1be3bb[_0xa757('0x52')])['then'](function(_0x2ed63f){_0x3c039d(_0x2ed63f);})[_0xa757('0x39')](function(_0x265793){_0x1ae3ae(_0x265793);});});}function verifyJwt(_0xbef575,_0x18b0ca,_0x1f21c0){var _0x57bf73=BPromise[_0xa757('0x51')](jwt['verify'],{'context':jwt});var _0x2de226=_0x1f21c0||config[_0xa757('0x6')][_0xa757('0x7')];return new BPromise(function(_0x29434d,_0x319988){_0x57bf73(_0xbef575,_0x2de226,_0x18b0ca)[_0xa757('0x25')](function(_0x15bad7){_0x29434d(_0x15bad7);})[_0xa757('0x39')](function(_0x405397){_0x319988(_0x405397);});});}function generateNonce(){return crypto[_0xa757('0x53')](0x10)[_0xa757('0x54')](_0xa757('0x55'));}function generateIssuedAt(){return Math[_0xa757('0x56')](Date[_0xa757('0x57')]()/0x3e8)[_0xa757('0x54')]();}function createJwt(_0x23caca){var _0x492e7e={'payload':{'iat':_0x23caca[_0xa757('0x4e')],'nonce':_0x23caca['apiKeyNonce']},'options':{'algorithm':_0xa757('0x58'),'subject':_0x23caca['id'][_0xa757('0x54')](),'issuer':hardwareConf[_0xa757('0x32')](),'audience':hardwareConf[_0xa757('0x32')]()}};return signJwt(_0x492e7e)['then'](function(_0x35cd81){return{'iat':_0x23caca[_0xa757('0x4e')],'nonce':_0x23caca[_0xa757('0x36')],'token':_0x35cd81};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index bf07e53..4f0fb0c 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 _0xe706=['unlink','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','update','end','final','binary','write','close','createDecipher'];(function(_0x313532,_0x33e75f){var _0x44bc16=function(_0x31ab32){while(--_0x31ab32){_0x313532['push'](_0x313532['shift']());}};_0x44bc16(++_0x33e75f);}(_0xe706,0xa3));var _0x6e70=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0xe706[_0x2ddfd9];return _0x2668f0;};'use strict';var crypto=require(_0x6e70('0x0'));var fs=require('fs');var BPromise=require(_0x6e70('0x1'));var defaultOptions={'algorithm':_0x6e70('0x2')};function combineOptions(_0x5e8446){var _0x2cae77={};for(var _0x315629 in defaultOptions){if(defaultOptions[_0x6e70('0x3')](_0x315629)){_0x2cae77[_0x315629]=defaultOptions[_0x315629];}}if(_0x5e8446){for(var _0x7dfbc3 in _0x5e8446){if(_0x5e8446[_0x6e70('0x3')](_0x7dfbc3)){_0x2cae77[_0x7dfbc3]=_0x5e8446[_0x7dfbc3];}}}return _0x2cae77;}exports[_0x6e70('0x4')]=function(_0x376a8d,_0x506db9,_0x1b0389,_0x4381d1){return new BPromise(function(_0x36357b,_0x293ce7){_0x4381d1=combineOptions(_0x4381d1);var _0x45a2d4=new Buffer(_0x1b0389);var _0x188ed3=fs[_0x6e70('0x5')](_0x376a8d);var _0x449b48=fs[_0x6e70('0x6')](_0x506db9);var _0x25e61c=crypto[_0x6e70('0x7')](_0x4381d1[_0x6e70('0x8')],_0x45a2d4);_0x188ed3['on'](_0x6e70('0x9'),function(_0x3f474a){var _0x37b3e0=new Buffer(_0x25e61c[_0x6e70('0xa')](_0x3f474a),'binary');_0x449b48['write'](_0x37b3e0);});_0x188ed3['on'](_0x6e70('0xb'),function(){try{var _0x15a1a5=new Buffer(_0x25e61c[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x449b48[_0x6e70('0xe')](_0x15a1a5);_0x449b48[_0x6e70('0xb')]();_0x449b48['on'](_0x6e70('0xf'),function(){return _0x36357b(_0x506db9);});}catch(_0x5dfbaa){fs['unlink'](_0x506db9);return _0x293ce7(_0x5dfbaa);}});});};exports['decryptFile']=function(_0x257e81,_0x5a37a6,_0x53aed0,_0x304716){return new BPromise(function(_0x22c50c,_0x5d9263){_0x304716=combineOptions(_0x304716);var _0x24f3ac=new Buffer(_0x53aed0);var _0x5c3fe7=fs[_0x6e70('0x5')](_0x257e81);var _0x161f23=fs['createWriteStream'](_0x5a37a6);var _0x49029f=crypto[_0x6e70('0x10')](_0x304716['algorithm'],_0x24f3ac);_0x5c3fe7['on'](_0x6e70('0x9'),function(_0x173afe){var _0x53acdc=new Buffer(_0x49029f['update'](_0x173afe),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x53acdc);});_0x5c3fe7['on'](_0x6e70('0xb'),function(){try{var _0x3a9978=new Buffer(_0x49029f[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x3a9978);_0x161f23[_0x6e70('0xb')]();_0x161f23['on'](_0x6e70('0xf'),function(){return _0x22c50c(_0x5a37a6);});}catch(_0x4a0cfe){fs[_0x6e70('0x11')](_0x5a37a6);return _0x5d9263(_0x4a0cfe);}});});}; \ No newline at end of file +var _0xd8b0=['data','binary','end','final','write','close','unlink','decryptFile','createReadStream','createDecipher','update','crypto','bluebird','hasOwnProperty','encryptFile','createWriteStream','createCipher','algorithm'];(function(_0x236282,_0x4a2390){var _0x5c2f78=function(_0x35f0e4){while(--_0x35f0e4){_0x236282['push'](_0x236282['shift']());}};_0x5c2f78(++_0x4a2390);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var crypto=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var defaultOptions={'algorithm':'aes192'};function combineOptions(_0x585166){var _0x4b72b0={};for(var _0x3ff8df in defaultOptions){if(defaultOptions[_0x0d8b('0x2')](_0x3ff8df)){_0x4b72b0[_0x3ff8df]=defaultOptions[_0x3ff8df];}}if(_0x585166){for(var _0x43bca1 in _0x585166){if(_0x585166[_0x0d8b('0x2')](_0x43bca1)){_0x4b72b0[_0x43bca1]=_0x585166[_0x43bca1];}}}return _0x4b72b0;}exports[_0x0d8b('0x3')]=function(_0x577834,_0x5e15e6,_0x3f8b6f,_0x227c63){return new BPromise(function(_0x39f43a,_0x4a4470){_0x227c63=combineOptions(_0x227c63);var _0x413284=new Buffer(_0x3f8b6f);var _0x284169=fs['createReadStream'](_0x577834);var _0x129310=fs[_0x0d8b('0x4')](_0x5e15e6);var _0x3b027f=crypto[_0x0d8b('0x5')](_0x227c63[_0x0d8b('0x6')],_0x413284);_0x284169['on'](_0x0d8b('0x7'),function(_0x2c5e9e){var _0x28f87c=new Buffer(_0x3b027f['update'](_0x2c5e9e),_0x0d8b('0x8'));_0x129310['write'](_0x28f87c);});_0x284169['on'](_0x0d8b('0x9'),function(){try{var _0xc574a3=new Buffer(_0x3b027f[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x129310[_0x0d8b('0xb')](_0xc574a3);_0x129310[_0x0d8b('0x9')]();_0x129310['on'](_0x0d8b('0xc'),function(){return _0x39f43a(_0x5e15e6);});}catch(_0x1d4bbc){fs[_0x0d8b('0xd')](_0x5e15e6);return _0x4a4470(_0x1d4bbc);}});});};exports[_0x0d8b('0xe')]=function(_0xe65334,_0x1567ce,_0x2d4e1c,_0x4f6f21){return new BPromise(function(_0x23eb7b,_0xa86349){_0x4f6f21=combineOptions(_0x4f6f21);var _0x17f7df=new Buffer(_0x2d4e1c);var _0xe2e167=fs[_0x0d8b('0xf')](_0xe65334);var _0x5cd485=fs[_0x0d8b('0x4')](_0x1567ce);var _0x4586c2=crypto[_0x0d8b('0x10')](_0x4f6f21[_0x0d8b('0x6')],_0x17f7df);_0xe2e167['on'](_0x0d8b('0x7'),function(_0x18dd2d){var _0x264b39=new Buffer(_0x4586c2[_0x0d8b('0x11')](_0x18dd2d),'binary');_0x5cd485[_0x0d8b('0xb')](_0x264b39);});_0xe2e167['on'](_0x0d8b('0x9'),function(){try{var _0x196c0a=new Buffer(_0x4586c2[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x5cd485[_0x0d8b('0xb')](_0x196c0a);_0x5cd485[_0x0d8b('0x9')]();_0x5cd485['on']('close',function(){return _0x23eb7b(_0x1567ce);});}catch(_0x4f0a1a){fs[_0x0d8b('0xd')](_0x1567ce);return _0xa86349(_0x4f0a1a);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index d574a3a..5382cef 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 _0xb43b=['basename','.csv','existsSync','join','length','%s%d.%s','csv','%s.%s','writeFileSync','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','sequelize','QueryTypes','num','Empty','split','push','query','SELECT','dirname'];(function(_0x58b66e,_0x55a3d6){var _0x245660=function(_0x3f53c2){while(--_0x3f53c2){_0x58b66e['push'](_0x58b66e['shift']());}};_0x245660(++_0x55a3d6);}(_0xb43b,0x1b2));var _0xbb43=function(_0x31d505,_0x4974d3){_0x31d505=_0x31d505-0x0;var _0x33322f=_0xb43b[_0x31d505];return _0x33322f;};'use strict';var util=require(_0xbb43('0x0'));var path=require(_0xbb43('0x1'));var _=require('lodash');var csv=require(_0xbb43('0x2'));var fs=require('fs');var BPromise=require(_0xbb43('0x3'));var zipdir=require(_0xbb43('0x4'));var rimraf=require('rimraf');var db=require(_0xbb43('0x5'))['db'];var dbH=require(_0xbb43('0x5'))[_0xbb43('0x6')];var logger=require(_0xbb43('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xbb43('0x8')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x80fe61,_0x1ccd49){var _0x2a2f11={'status':_0x80fe61};var _0x29ae1a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1ccd49){_0x2a2f11[_0xbb43('0x9')]=_0x1ccd49;}return db['AnalyticExtractedReport'][_0xbb43('0xa')](_0x2a2f11,_0x29ae1a);}function main(){var _0xf54ac5=0x1388;var _0x5d5b11;logger[_0xbb43('0xb')](util[_0xbb43('0xc')](_0xbb43('0xd'),EXTRACTED_REPORT_ID,_0xbb43('0xe')));return db[_0xbb43('0xf')][_0xbb43('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xbb43('0x11')]})[_0xbb43('0x12')](function(_0x50e2c0){if(_0x50e2c0){_0x5d5b11=_0x50e2c0;_0xf54ac5=_0x5d5b11['splitSizeCsv']||0x1388;}})[_0xbb43('0x12')](function(){return dbH['sequelize']['query'](util[_0xbb43('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xbb43('0x13')][_0xbb43('0x14')]['SELECT']});})['then'](function(_0x4d5bcf){if(!_0x4d5bcf[0x0][_0xbb43('0x15')]){return analyticExtractedReport(_0xbb43('0x16'));}var _0x57bd1d=[];var _0x526330=0x0;var _0x202980=!![];if(_0x4d5bcf&&_0x4d5bcf['length']){var _0x5923dc=_0x4d5bcf[0x0][_0xbb43('0x15')]%(_0x526330+_0xf54ac5);if(_0x5d5b11[_0xbb43('0x17')]){for(;_0x202980;_0x526330+=_0xf54ac5,_0x5923dc=_0x4d5bcf[0x0][_0xbb43('0x15')]%(_0x526330+_0xf54ac5)){if(_0x5923dc==0x0||_0x5923dc==_0x4d5bcf[0x0]['num']){_0x202980=![];}_0x57bd1d[_0xbb43('0x18')](dbH['sequelize'][_0xbb43('0x19')](util[_0xbb43('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xf54ac5,_0x526330),{'type':dbH['sequelize'][_0xbb43('0x14')][_0xbb43('0x1a')]}));}}else{_0x57bd1d[_0xbb43('0x18')](dbH[_0xbb43('0x13')]['query'](QUERY,{'type':dbH[_0xbb43('0x13')]['QueryTypes'][_0xbb43('0x1a')]}));}}var _0x4bfaca=path[_0xbb43('0x1b')](PATH);var _0x565256=path[_0xbb43('0x1c')](PATH,_0xbb43('0x1d'));var _0x577ddd=_0x5d5b11[_0xbb43('0x17')]&&_0x57bd1d['length']>0x1;var _0xf24e60=[];if(!fs[_0xbb43('0x1e')](path[_0xbb43('0x1f')](_0x4bfaca,_0x565256))&&_0x577ddd){fs['mkdirSync'](path['join'](_0x4bfaca,_0x565256));}return BPromise['each'](_0x57bd1d,function(_0x269ca5){_0xf24e60[_0xbb43('0x18')](_0x269ca5);})['then'](function(){for(var _0x3b3083=0x0;_0x3b3083<_0xf24e60[_0xbb43('0x20')];_0x3b3083+=0x1){var _0x226827;var _0x3874fb=_0xf24e60[_0x3b3083];if(_0x577ddd){_0x226827=path['join'](_0x4bfaca,_0x565256,util['format'](_0xbb43('0x21'),_0x565256,_0x3b3083,_0xbb43('0x22')));}else{_0x226827=path[_0xbb43('0x1f')](_0x4bfaca,util[_0xbb43('0xc')](_0xbb43('0x23'),_0x565256,_0xbb43('0x22')));}fs[_0xbb43('0x24')](_0x226827,csv(_0x3874fb));}})[_0xbb43('0x12')](function(){if(_0x577ddd){zipdir(path['join'](_0x4bfaca,_0x565256),{'saveTo':path[_0xbb43('0x1f')](_0x4bfaca,util['format'](_0xbb43('0x23'),_0x565256,_0xbb43('0x25')))},function(_0x34f5b2,_0x1880cd){});rimraf(path['join'](_0x4bfaca,_0x565256),function(){});}})[_0xbb43('0x12')](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xbb43('0xe')));return analyticExtractedReport('Completed',_0x577ddd?util[_0xbb43('0xc')](_0xbb43('0x23'),_0x565256,_0x577ddd?_0xbb43('0x25'):'csv'):null);});})[_0xbb43('0x26')](function(_0x1bdf91){logger[_0xbb43('0xb')](util[_0xbb43('0xc')](_0xbb43('0x27'),EXTRACTED_REPORT_ID,_0xbb43('0xe')),util[_0xbb43('0x28')](_0x1bdf91,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb43('0x29'));});}main(); \ No newline at end of file +var _0xa8a8=['SELECT','Empty','length','num','push','query','dirname','basename','.csv','split','existsSync','mkdirSync','join','each','csv','writeFileSync','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','format','CSV','Setting','find','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x2c17d7,_0x103c0a){var _0x2e7c72=function(_0xaf0e5b){while(--_0xaf0e5b){_0x2c17d7['push'](_0x2c17d7['shift']());}};_0x2e7c72(++_0x103c0a);}(_0xa8a8,0xec));var _0x8a8a=function(_0x1bec02,_0x4a34b4){_0x1bec02=_0x1bec02-0x0;var _0x3d8917=_0xa8a8[_0x1bec02];return _0x3d8917;};'use strict';var util=require(_0x8a8a('0x0'));var path=require(_0x8a8a('0x1'));var _=require(_0x8a8a('0x2'));var csv=require(_0x8a8a('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x8a8a('0x4'));var rimraf=require(_0x8a8a('0x5'));var db=require(_0x8a8a('0x6'))['db'];var dbH=require(_0x8a8a('0x6'))[_0x8a8a('0x7')];var logger=require(_0x8a8a('0x8'))(_0x8a8a('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x8a8a('0xa')][0x2]);var QUERY=process[_0x8a8a('0xa')][0x3];var PATH=process[_0x8a8a('0xa')][0x4];function analyticExtractedReport(_0x1d7121,_0x8e7aa0){var _0x4225b9={'status':_0x1d7121};var _0xecaa6f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8e7aa0){_0x4225b9[_0x8a8a('0xb')]=_0x8e7aa0;}return db['AnalyticExtractedReport']['update'](_0x4225b9,_0xecaa6f);}function main(){var _0x3c01cd=0x1388;var _0x497b8a;logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8a8a('0xe')));return db[_0x8a8a('0xf')][_0x8a8a('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8a8a('0x11')]})[_0x8a8a('0x12')](function(_0x330796){if(_0x330796){_0x497b8a=_0x330796;_0x3c01cd=_0x497b8a[_0x8a8a('0x11')]||0x1388;}})['then'](function(){return dbH[_0x8a8a('0x13')]['query'](util[_0x8a8a('0xd')](_0x8a8a('0x14'),QUERY),{'type':dbH[_0x8a8a('0x13')][_0x8a8a('0x15')][_0x8a8a('0x16')]});})[_0x8a8a('0x12')](function(_0x16d38d){if(!_0x16d38d[0x0]['num']){return analyticExtractedReport(_0x8a8a('0x17'));}var _0x568b83=[];var _0x1f36b6=0x0;var _0x3046ae=!![];if(_0x16d38d&&_0x16d38d[_0x8a8a('0x18')]){var _0x4291e9=_0x16d38d[0x0][_0x8a8a('0x19')]%(_0x1f36b6+_0x3c01cd);if(_0x497b8a['split']){for(;_0x3046ae;_0x1f36b6+=_0x3c01cd,_0x4291e9=_0x16d38d[0x0][_0x8a8a('0x19')]%(_0x1f36b6+_0x3c01cd)){if(_0x4291e9==0x0||_0x4291e9==_0x16d38d[0x0][_0x8a8a('0x19')]){_0x3046ae=![];}_0x568b83[_0x8a8a('0x1a')](dbH[_0x8a8a('0x13')][_0x8a8a('0x1b')](util[_0x8a8a('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3c01cd,_0x1f36b6),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}else{_0x568b83['push'](dbH[_0x8a8a('0x13')][_0x8a8a('0x1b')](QUERY,{'type':dbH[_0x8a8a('0x13')][_0x8a8a('0x15')][_0x8a8a('0x16')]}));}}var _0x2f6af2=path[_0x8a8a('0x1c')](PATH);var _0xe0321c=path[_0x8a8a('0x1d')](PATH,_0x8a8a('0x1e'));var _0xb9db78=_0x497b8a[_0x8a8a('0x1f')]&&_0x568b83[_0x8a8a('0x18')]>0x1;var _0x625c1b=[];if(!fs[_0x8a8a('0x20')](path['join'](_0x2f6af2,_0xe0321c))&&_0xb9db78){fs[_0x8a8a('0x21')](path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c));}return BPromise[_0x8a8a('0x23')](_0x568b83,function(_0x7662e){_0x625c1b[_0x8a8a('0x1a')](_0x7662e);})[_0x8a8a('0x12')](function(){for(var _0x3aa46d=0x0;_0x3aa46d<_0x625c1b['length'];_0x3aa46d+=0x1){var _0x31d21a;var _0x38c1e0=_0x625c1b[_0x3aa46d];if(_0xb9db78){_0x31d21a=path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c,util['format']('%s%d.%s',_0xe0321c,_0x3aa46d,_0x8a8a('0x24')));}else{_0x31d21a=path[_0x8a8a('0x22')](_0x2f6af2,util['format']('%s.%s',_0xe0321c,'csv'));}fs[_0x8a8a('0x25')](_0x31d21a,csv(_0x38c1e0));}})['then'](function(){if(_0xb9db78){zipdir(path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c),{'saveTo':path[_0x8a8a('0x22')](_0x2f6af2,util['format'](_0x8a8a('0x26'),_0xe0321c,_0x8a8a('0x27')))},function(_0x250852,_0x8df0cb){});rimraf(path[_0x8a8a('0x22')](_0x2f6af2,_0xe0321c),function(){});}})[_0x8a8a('0x12')](function(){logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0xb9db78?util[_0x8a8a('0xd')](_0x8a8a('0x26'),_0xe0321c,_0xb9db78?'zip':_0x8a8a('0x24')):null);});})[_0x8a8a('0x28')](function(_0x481e92){logger[_0x8a8a('0xc')](util[_0x8a8a('0xd')](_0x8a8a('0x29'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x481e92,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x8a8a('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 4dd7493..3113677 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x2b7398,_0xc02f9d){var _0x3e6443=function(_0x14924e){while(--_0x14924e){_0x2b7398['push'](_0x2b7398['shift']());}};_0x3e6443(++_0xc02f9d);}(_0xb10b,0x12a));var _0xbb10=function(_0x535780,_0x5d5d47){_0x535780=_0x535780-0x0;var _0x1a03fb=_0xb10b[_0x535780];return _0x1a03fb;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _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(_0x319f95,_0x2697a8){var _0x57ecfe=function(_0x849518){while(--_0x849518){_0x319f95['push'](_0x319f95['shift']());}};_0x57ecfe(++_0x2697a8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x372b3c,_0x93198){_0x372b3c=_0x372b3c-0x0;var _0x5c127f=_0x5f2f[_0x372b3c];return _0x5c127f;};'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 diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index a83aeef..c4fcb0e 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 _0x6054=['zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6054,0x127));var _0x4605=function(_0x4a248b,_0x29e290){_0x4a248b=_0x4a248b-0x0;var _0x565f8c=_0x6054[_0x4a248b];return _0x565f8c;};'use strict';var util=require(_0x4605('0x0'));var path=require('path');var _=require(_0x4605('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x4605('0x2'));var zipdir=require(_0x4605('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x4605('0x4'))[_0x4605('0x5')];var logger=require(_0x4605('0x6'))(_0x4605('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4605('0x8')][0x3];var PATH=process[_0x4605('0x8')][0x4];function analyticExtractedReport(_0x2288d3,_0x2c8cc2){var _0x2358ca={'status':_0x2288d3};var _0x5bd43a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2c8cc2){_0x2358ca[_0x4605('0x9')]=_0x2c8cc2;}return db[_0x4605('0xa')][_0x4605('0xb')](_0x2358ca,_0x5bd43a);}function main(){var _0x5b9737=0x1388;var _0x351874;logger[_0x4605('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4605('0xd')));return db[_0x4605('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4605('0xf'),_0x4605('0x10')]})[_0x4605('0x11')](function(_0x415fa3){if(_0x415fa3){_0x351874=_0x415fa3;_0x5b9737=_0x351874[_0x4605('0x10')]||0x1388;}})[_0x4605('0x11')](function(){return dbH[_0x4605('0x12')][_0x4605('0x13')](util[_0x4605('0x14')](_0x4605('0x15'),QUERY),{'type':dbH[_0x4605('0x12')][_0x4605('0x16')][_0x4605('0x17')]});})[_0x4605('0x11')](function(_0xbd4dbc){if(!_0xbd4dbc[0x0][_0x4605('0x18')]){return analyticExtractedReport(_0x4605('0x19'));}var _0x60d885=[];var _0x4b4dd2=0x0;var _0x1f4123=!![];if(_0x351874['split']){if(_0xbd4dbc&&_0xbd4dbc[_0x4605('0x1a')]){var _0x70b5ff=_0xbd4dbc[0x0][_0x4605('0x18')]%(_0x4b4dd2+_0x5b9737);for(;_0x1f4123;_0x4b4dd2+=_0x5b9737,_0x70b5ff=_0xbd4dbc[0x0]['num']%(_0x4b4dd2+_0x5b9737)){if(_0x70b5ff==0x0||_0x70b5ff==_0xbd4dbc[0x0][_0x4605('0x18')]){_0x1f4123=![];}_0x60d885[_0x4605('0x1b')](dbH[_0x4605('0x12')]['query'](util['format'](_0x4605('0x1c'),QUERY,_0x5b9737,_0x4b4dd2),{'type':dbH[_0x4605('0x12')]['QueryTypes']['SELECT']}));}}}else{_0x60d885[_0x4605('0x1b')](dbH['sequelize'][_0x4605('0x13')](QUERY,{'type':dbH[_0x4605('0x12')][_0x4605('0x16')][_0x4605('0x17')]}));}var _0x2962cb=path[_0x4605('0x1d')](PATH);var _0x1f7e07=path[_0x4605('0x1e')](PATH,_0x4605('0x1f'));var _0x24f5b0=_0x351874['split']&&_0x60d885[_0x4605('0x1a')]>0x1;var _0x4b2cd3=[];if(!fs[_0x4605('0x20')](path[_0x4605('0x21')](_0x2962cb,_0x1f7e07))&&_0x24f5b0){fs[_0x4605('0x22')](path[_0x4605('0x21')](_0x2962cb,_0x1f7e07));}return BPromise[_0x4605('0x23')](_0x60d885,function(_0x4ff2c0){_0x4b2cd3[_0x4605('0x1b')](_0x4ff2c0);})[_0x4605('0x11')](function(){for(var _0x3ad318=0x0;_0x3ad318<_0x4b2cd3['length'];_0x3ad318+=0x1){var _0x83d117;var _0x83a71f=_0x4b2cd3[_0x3ad318];if(_0x24f5b0){_0x83d117=path['join'](_0x2962cb,_0x1f7e07,util['format'](_0x4605('0x24'),_0x1f7e07,_0x3ad318,'xlsx'));}else{_0x83d117=path[_0x4605('0x21')](_0x2962cb,util[_0x4605('0x14')](_0x4605('0x25'),_0x1f7e07,_0x4605('0x26')));}fs[_0x4605('0x27')](_0x83d117,json2xls(_0x83a71f),_0x4605('0x28'));}})[_0x4605('0x11')](function(){if(_0x24f5b0){zipdir(path['join'](_0x2962cb,_0x1f7e07),{'saveTo':path['join'](_0x2962cb,util['format'](_0x4605('0x25'),_0x1f7e07,_0x4605('0x29')))},function(_0x5ab67f,_0xb52d40){});rimraf(path[_0x4605('0x21')](_0x2962cb,_0x1f7e07),function(){});}})['then'](function(){logger[_0x4605('0xc')](util['format'](_0x4605('0x2a'),EXTRACTED_REPORT_ID,_0x4605('0xd')));return analyticExtractedReport(_0x4605('0x2b'),_0x24f5b0?util[_0x4605('0x14')](_0x4605('0x25'),_0x1f7e07,_0x24f5b0?_0x4605('0x29'):'xlsx'):null);});})[_0x4605('0x2c')](function(_0x18e11f){logger[_0x4605('0xc')](util[_0x4605('0x14')](_0x4605('0x2d'),EXTRACTED_REPORT_ID,_0x4605('0xd')),util[_0x4605('0x2e')](_0x18e11f,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x4605('0x2f'));});}main(); \ No newline at end of file +var _0xc74c=['length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.xlsx','existsSync','mkdirSync','join','each','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty'];(function(_0x450ff1,_0x24124e){var _0x2f03d3=function(_0x25dcf3){while(--_0x25dcf3){_0x450ff1['push'](_0x450ff1['shift']());}};_0x2f03d3(++_0x24124e);}(_0xc74c,0x163));var _0xcc74=function(_0x1149ca,_0x28229a){_0x1149ca=_0x1149ca-0x0;var _0x327569=_0xc74c[_0x1149ca];return _0x327569;};'use strict';var util=require(_0xcc74('0x0'));var path=require(_0xcc74('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xcc74('0x2'));var zipdir=require(_0xcc74('0x3'));var rimraf=require('rimraf');var db=require(_0xcc74('0x4'))['db'];var dbH=require(_0xcc74('0x4'))[_0xcc74('0x5')];var logger=require(_0xcc74('0x6'))(_0xcc74('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xcc74('0x8')][0x2]);var QUERY=process[_0xcc74('0x8')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x15248f,_0x86f429){var _0x1eb886={'status':_0x15248f};var _0x473308={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x86f429){_0x1eb886[_0xcc74('0x9')]=_0x86f429;}return db['AnalyticExtractedReport']['update'](_0x1eb886,_0x473308);}function main(){var _0xad246b=0x1388;var _0x1aeb8f;logger[_0xcc74('0xa')](util['format'](_0xcc74('0xb'),EXTRACTED_REPORT_ID,_0xcc74('0xc')));return db[_0xcc74('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcc74('0xe'),'splitSizeXlsx']})[_0xcc74('0xf')](function(_0x4b3988){if(_0x4b3988){_0x1aeb8f=_0x4b3988;_0xad246b=_0x1aeb8f['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0xcc74('0x10')][_0xcc74('0x11')](util[_0xcc74('0x12')](_0xcc74('0x13'),QUERY),{'type':dbH[_0xcc74('0x10')]['QueryTypes'][_0xcc74('0x14')]});})[_0xcc74('0xf')](function(_0x1ab204){if(!_0x1ab204[0x0][_0xcc74('0x15')]){return analyticExtractedReport(_0xcc74('0x16'));}var _0x57f804=[];var _0x3ffb75=0x0;var _0xbcdba8=!![];if(_0x1aeb8f[_0xcc74('0xe')]){if(_0x1ab204&&_0x1ab204[_0xcc74('0x17')]){var _0x2f33ad=_0x1ab204[0x0][_0xcc74('0x15')]%(_0x3ffb75+_0xad246b);for(;_0xbcdba8;_0x3ffb75+=_0xad246b,_0x2f33ad=_0x1ab204[0x0][_0xcc74('0x15')]%(_0x3ffb75+_0xad246b)){if(_0x2f33ad==0x0||_0x2f33ad==_0x1ab204[0x0][_0xcc74('0x15')]){_0xbcdba8=![];}_0x57f804[_0xcc74('0x18')](dbH['sequelize'][_0xcc74('0x11')](util[_0xcc74('0x12')](_0xcc74('0x19'),QUERY,_0xad246b,_0x3ffb75),{'type':dbH[_0xcc74('0x10')][_0xcc74('0x1a')][_0xcc74('0x14')]}));}}}else{_0x57f804['push'](dbH[_0xcc74('0x10')][_0xcc74('0x11')](QUERY,{'type':dbH['sequelize'][_0xcc74('0x1a')][_0xcc74('0x14')]}));}var _0x13de0e=path['dirname'](PATH);var _0x1a2e25=path[_0xcc74('0x1b')](PATH,_0xcc74('0x1c'));var _0x27938d=_0x1aeb8f['split']&&_0x57f804[_0xcc74('0x17')]>0x1;var _0x11811d=[];if(!fs[_0xcc74('0x1d')](path['join'](_0x13de0e,_0x1a2e25))&&_0x27938d){fs[_0xcc74('0x1e')](path[_0xcc74('0x1f')](_0x13de0e,_0x1a2e25));}return BPromise[_0xcc74('0x20')](_0x57f804,function(_0x5a9fa6){_0x11811d['push'](_0x5a9fa6);})['then'](function(){for(var _0x134ad4=0x0;_0x134ad4<_0x11811d[_0xcc74('0x17')];_0x134ad4+=0x1){var _0x387c57;var _0x311cc2=_0x11811d[_0x134ad4];if(_0x27938d){_0x387c57=path[_0xcc74('0x1f')](_0x13de0e,_0x1a2e25,util[_0xcc74('0x12')]('%s%d.%s',_0x1a2e25,_0x134ad4,_0xcc74('0x21')));}else{_0x387c57=path[_0xcc74('0x1f')](_0x13de0e,util[_0xcc74('0x12')](_0xcc74('0x22'),_0x1a2e25,'xlsx'));}fs[_0xcc74('0x23')](_0x387c57,json2xls(_0x311cc2),_0xcc74('0x24'));}})[_0xcc74('0xf')](function(){if(_0x27938d){zipdir(path[_0xcc74('0x1f')](_0x13de0e,_0x1a2e25),{'saveTo':path[_0xcc74('0x1f')](_0x13de0e,util[_0xcc74('0x12')]('%s.%s',_0x1a2e25,_0xcc74('0x25')))},function(_0x5cb390,_0x3faeab){});rimraf(path[_0xcc74('0x1f')](_0x13de0e,_0x1a2e25),function(){});}})[_0xcc74('0xf')](function(){logger[_0xcc74('0xa')](util[_0xcc74('0x12')](_0xcc74('0x26'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x27938d?util[_0xcc74('0x12')](_0xcc74('0x22'),_0x1a2e25,_0x27938d?_0xcc74('0x25'):'xlsx'):null);});})[_0xcc74('0x27')](function(_0x342adf){logger['info'](util['format'](_0xcc74('0x28'),EXTRACTED_REPORT_ID,_0xcc74('0xc')),util['inspect'](_0x342adf,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xcc74('0x29'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 421ca30..0bad397 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 _0x30c6=['wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','rewrite','lodash','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','extensions','extension','push','type','Set','format','context','priority','VoiceExtensionId','outbound','cutdigits','${EXTEN:','${EXTEN}','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='];(function(_0xbcd268,_0x200876){var _0x4f85b0=function(_0x8e8d73){while(--_0x8e8d73){_0xbcd268['push'](_0xbcd268['shift']());}};_0x4f85b0(++_0x200876);}(_0x30c6,0x171));var _0x630c=function(_0x21dc9c,_0x355d73){_0x21dc9c=_0x21dc9c-0x0;var _0x45a444=_0x30c6[_0x21dc9c];return _0x45a444;};'use strict';var _=require(_0x630c('0x0'));var util=require('util');function rewrite(_0x10f1c7,_0x88c343){var _0x9bb592=this;return _0x10f1c7[_0x630c('0x1')][_0x630c('0x2')][_0x630c('0x3')]({'raw':!![]})[_0x630c('0x4')](function(_0x412ab7){_0x9bb592[_0x630c('0x5')]=_0x412ab7;return _0x10f1c7[_0x630c('0x1')][_0x630c('0x6')][_0x630c('0x3')]({'where':{'IntervalId':_0x88c343[_0x630c('0x7')]},'raw':!![]});})[_0x630c('0x4')](function(_0x342291){return _0x10f1c7[_0x630c('0x1')][_0x630c('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x630c('0x8')](_[_0x630c('0x9')](_0x342291,_0x630c('0xa')))}},'order':[{'raw':_0x630c('0xb')}],'raw':!![]});})[_0x630c('0x4')](function(_0xb1de0c){var _0x2bc386=_[_0x630c('0xc')](_0xb1de0c,{'priority':'1'});var _0x526cb2=_[_0x630c('0xc')](_0xb1de0c,{'isApp':0x1});var _0x5d80c4=_[_0x630c('0xd')](_0x526cb2,'exten');var _0x89655c=['queue',_0x630c('0xe')];var _0x148a45=[];var _0x2a2779=[];for(var _0x31ab5a in _0x5d80c4){if(_0x5d80c4[_0x630c('0xf')](_0x31ab5a)){_0x9bb592['priority']=0x2;_0x9bb592[_0x630c('0x10')]=[];_0x9bb592[_0x630c('0x11')]=_['find'](_0x2bc386,{'exten':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0xa')]});_0x9bb592['extensions'][_0x630c('0x12')]({'type':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x13')],'app':_0x630c('0x14'),'appdata':util[_0x630c('0x15')]('CDR(type)=%s',_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x13')]),'context':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x16')],'exten':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0xa')],'priority':_0x9bb592[_0x630c('0x17')]++,'VoiceExtensionId':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x18')]});if(_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x13')]===_0x630c('0x19')){if(_0x9bb592[_0x630c('0x11')]){_0x9bb592['extensions'][_0x630c('0x12')]({'type':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x13')],'app':'Set','appdata':'CDR(destination)='+(_0x9bb592[_0x630c('0x11')][_0x630c('0x1a')]?_0x630c('0x1b')+_0x9bb592[_0x630c('0x11')]['cutdigits']+'}':_0x630c('0x1c')),'context':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x16')],'exten':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0xa')],'priority':_0x9bb592['priority']++,'VoiceExtensionId':_0x5d80c4[_0x31ab5a][0x0]['VoiceExtensionId']});}_0x9bb592['extensions'][_0x630c('0x12')]({'type':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x13')],'app':_0x630c('0x14'),'appdata':'CDR(routeid)='+_0x5d80c4[_0x31ab5a][0x0]['VoiceExtensionId'],'context':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x16')],'exten':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0xa')],'priority':_0x9bb592[_0x630c('0x17')]++,'VoiceExtensionId':_0x5d80c4[_0x31ab5a][0x0]['VoiceExtensionId']});var _0x550312=_0x9bb592[_0x630c('0x17')]++;_0x9bb592[_0x630c('0x10')]['push']({'type':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x13')],'app':_0x630c('0x1d'),'appdata':_0x630c('0x1e')+(_0x550312+0x2)+_0x630c('0x1f')+(_0x550312+0x1)+')','context':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x16')],'exten':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0xa')],'priority':_0x550312,'VoiceExtensionId':_0x5d80c4[_0x31ab5a][0x0]['VoiceExtensionId']});if(_0x9bb592['extension']){_0x9bb592[_0x630c('0x10')][_0x630c('0x12')]({'type':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x13')],'app':_0x630c('0x14'),'appdata':_0x9bb592[_0x630c('0x11')][_0x630c('0x1a')]?_0x630c('0x20')+_0x9bb592[_0x630c('0x11')][_0x630c('0x1a')]+'}':_0x630c('0x21'),'context':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x16')],'exten':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0xa')],'priority':_0x9bb592['priority']++,'VoiceExtensionId':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x18')]});}_0x9bb592['extensions'][_0x630c('0x12')]({'type':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x13')],'app':'Set','appdata':_0x630c('0x22')+_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x18')],'context':_0x5d80c4[_0x31ab5a][0x0]['context'],'exten':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0xa')],'priority':_0x9bb592[_0x630c('0x17')]++,'VoiceExtensionId':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x18')]});if(_0x9bb592[_0x630c('0x11')]&&_0x9bb592[_0x630c('0x11')][_0x630c('0xf')](_0x630c('0x23'))&&_0x9bb592[_0x630c('0x11')][_0x630c('0x23')]!==_0x630c('0x24')){_0x9bb592[_0x630c('0x10')]['push']({'type':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x13')],'app':_0x630c('0x14'),'appdata':_0x630c('0x25'),'context':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x16')],'exten':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0xa')],'priority':_0x9bb592[_0x630c('0x17')]++,'VoiceExtensionId':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x18')]});_0x9bb592['extensions'][_0x630c('0x12')]({'type':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x13')],'app':'Set','appdata':_0x630c('0x26')+_0x9bb592[_0x630c('0x11')]['recordingFormat']||_0x630c('0x27'),'context':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x16')],'exten':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0xa')],'priority':_0x9bb592['priority']++,'VoiceExtensionId':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x18')]});}}_0x9bb592[_0x630c('0x10')][_0x630c('0x12')]({'type':_0x5d80c4[_0x31ab5a][0x0]['type'],'app':_0x630c('0x14'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x16')],'exten':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0xa')],'priority':_0x9bb592[_0x630c('0x17')]++,'VoiceExtensionId':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x18')]});_0x9bb592[_0x630c('0x10')][_0x630c('0x12')]({'type':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x13')],'app':_0x630c('0x14'),'appdata':_0x630c('0x28'),'context':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x16')],'exten':_0x5d80c4[_0x31ab5a][0x0]['exten'],'priority':_0x9bb592[_0x630c('0x17')]++,'VoiceExtensionId':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x18')]});_0x9bb592[_0x630c('0x10')]['push']({'type':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x13')],'app':'Set','appdata':_0x630c('0x29'),'context':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x16')],'exten':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0xa')],'priority':_0x9bb592['priority']++,'VoiceExtensionId':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x18')]});for(var _0xa7139c=0x0,_0xd7cfec=0x0;_0xa7139c<_0x5d80c4[_0x31ab5a]['length'];_0xa7139c+=0x1,_0xd7cfec=0x0){var _0x4a4718=_0x5d80c4[_0x31ab5a][_0xa7139c];if(_0x4a4718[_0x630c('0x13')]){_0x4a4718[_0x630c('0x13')]=_0x4a4718[_0x630c('0x13')][_0x630c('0x2a')]();}var _0x43eb91=[];var _0x20795a=[];delete _0x4a4718['id'];delete _0x4a4718[_0x630c('0x2b')];delete _0x4a4718[_0x630c('0x2c')];var _0x412322=_0x4a4718[_0x630c('0x2d')]!==_0x630c('0x2e')?[_0x4a4718['interval']]:_0x4a4718[_0x630c('0x7')]?_[_0x630c('0x9')](_[_0x630c('0xc')](_0x9bb592[_0x630c('0x5')],{'IntervalId':_0x4a4718[_0x630c('0x7')]}),_0x630c('0x2d')):[];if(_0x4a4718[_0x630c('0xf')](_0x630c('0x2f'))){if(_0x4a4718[_0x630c('0x2f')]&&_0x4a4718[_0x630c('0x2f')]!=='--'){_0x43eb91[_0x630c('0x12')]({'type':_0x4a4718[_0x630c('0x13')],'app':_0x630c('0x14'),'appdata':'CDR(tag)='+_0x4a4718['tag'],'context':_0x4a4718[_0x630c('0x16')],'exten':_0x4a4718['exten'],'priority':_0x412322[_0x630c('0x30')]+_0x9bb592[_0x630c('0x17')]+_0xd7cfec++,'VoiceExtensionId':_0x4a4718[_0x630c('0x18')]});}}if(_0x4a4718[_0x630c('0x13')]==='outbound'&&_0x4a4718[_0x630c('0xf')](_0x630c('0x31'))){if(_0x4a4718[_0x630c('0x31')]){_0x43eb91[_0x630c('0x12')]({'type':_0x4a4718[_0x630c('0x13')],'app':_0x630c('0x1d'),'appdata':_0x630c('0x32')+_0x4a4718[_0x630c('0x31')]+')','context':_0x4a4718[_0x630c('0x16')],'exten':_0x4a4718[_0x630c('0xa')],'priority':_0x412322[_0x630c('0x30')]+_0x9bb592[_0x630c('0x17')]+_0xd7cfec++,'VoiceExtensionId':_0x4a4718[_0x630c('0x18')]});}else{_0x43eb91[_0x630c('0x12')]({'type':_0x4a4718[_0x630c('0x13')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x4a4718[_0x630c('0x16')],'exten':_0x4a4718[_0x630c('0xa')],'priority':_0x412322[_0x630c('0x30')]+_0x9bb592[_0x630c('0x17')]+_0xd7cfec++,'VoiceExtensionId':_0x4a4718['VoiceExtensionId']});}}if(_0x4a4718['hasOwnProperty'](_0x630c('0x33'))){if(_0x89655c['indexOf'](_0x4a4718[_0x630c('0x34')][_0x630c('0x2a')]())>=0x0&&_0x4a4718['appType']!=='custom'){if(_0x4a4718[_0x630c('0x33')]){_0x43eb91['push']({'type':_0x4a4718[_0x630c('0x13')],'app':_0x630c('0x1d'),'appdata':_0x630c('0x35'),'context':_0x4a4718[_0x630c('0x16')],'exten':_0x4a4718['exten'],'priority':_0x412322['length']+_0x9bb592[_0x630c('0x17')]+_0xd7cfec++,'VoiceExtensionId':_0x4a4718[_0x630c('0x18')]});_0x43eb91[_0x630c('0x12')]({'type':_0x4a4718[_0x630c('0x13')],'app':'Set','appdata':_0x630c('0x36'),'context':_0x4a4718['context'],'exten':_0x4a4718[_0x630c('0xa')],'priority':_0x412322[_0x630c('0x30')]+_0x9bb592[_0x630c('0x17')]+_0xd7cfec++,'VoiceExtensionId':_0x4a4718[_0x630c('0x18')]});}else{_0x43eb91['push']({'type':_0x4a4718[_0x630c('0x13')],'app':_0x630c('0x1d'),'appdata':_0x630c('0x37'),'context':_0x4a4718[_0x630c('0x16')],'exten':_0x4a4718[_0x630c('0xa')],'priority':_0x412322[_0x630c('0x30')]+_0x9bb592['priority']+_0xd7cfec++,'VoiceExtensionId':_0x4a4718[_0x630c('0x18')]});_0x43eb91[_0x630c('0x12')]({'type':_0x4a4718[_0x630c('0x13')],'app':_0x630c('0x14'),'appdata':_0x630c('0x38'),'context':_0x4a4718[_0x630c('0x16')],'exten':_0x4a4718[_0x630c('0xa')],'priority':_0x412322[_0x630c('0x30')]+_0x9bb592[_0x630c('0x17')]+_0xd7cfec++,'VoiceExtensionId':_0x4a4718[_0x630c('0x18')]});}}}for(var _0x434376=0x0;_0x434376<_0x412322['length'];_0x434376+=0x1){var _0x525f5c=_0x9bb592['priority']+_0x412322[_0x630c('0x30')];var _0x4e638f=_0x434376===_0x412322['length']-0x1?_0x9bb592[_0x630c('0x17')]+_0x43eb91[_0x630c('0x30')]+_0x20795a['length']+0x2:_0x9bb592[_0x630c('0x17')]+_0x434376+0x1;_0x43eb91[_0x630c('0x39')](_0x434376,0x0,{'type':_0x4a4718['type'],'app':'GotoIfTime','appdata':_0x412322[_0x434376]+'?'+_0x4a4718[_0x630c('0x16')]+_0x630c('0x3a')+_0x525f5c+':'+_0x4a4718[_0x630c('0x16')]+',${EXTEN},'+_0x4e638f,'exten':_0x4a4718[_0x630c('0xa')],'context':_0x4a4718[_0x630c('0x16')],'priority':_0x9bb592['priority']+_0x434376,'VoiceExtensionId':_0x5d80c4[_0x31ab5a][0x0]['VoiceExtensionId']});}_0x4a4718[_0x630c('0x17')]=_0x43eb91[_0x630c('0x30')]?_[_0x630c('0x3b')](_0x43eb91)[_0x630c('0x17')]+0x1:_0x9bb592[_0x630c('0x17')];_0x9bb592[_0x630c('0x17')]=(_0x20795a['length']?_[_0x630c('0x3b')](_0x20795a)[_0x630c('0x17')]:_0x4a4718['priority'])+0x1;_0x9bb592[_0x630c('0x10')]=_[_0x630c('0x3c')](_0x9bb592['extensions'],_0x43eb91,[_0x4a4718],_0x20795a);}_0x9bb592[_0x630c('0x10')][_0x630c('0x12')]({'type':_0x5d80c4[_0x31ab5a][0x0]['type'],'app':_0x630c('0x3d'),'exten':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0xa')],'context':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x16')],'priority':_0x9bb592[_0x630c('0x17')],'VoiceExtensionId':_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x18')]});_0x148a45[_0x630c('0x12')](_0x5d80c4[_0x31ab5a][0x0][_0x630c('0x18')]);_0x2a2779=_[_0x630c('0x3c')](_0x2a2779,_0x9bb592[_0x630c('0x10')]);}}return _0x10f1c7[_0x630c('0x3e')](function(_0x399446){return _0x10f1c7['models'][_0x630c('0x6')][_0x630c('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x148a45}},'transaction':_0x399446})['then'](function(_0x32676b){return _0x10f1c7[_0x630c('0x1')][_0x630c('0x6')][_0x630c('0x40')](_[_0x630c('0x41')](_0x2a2779,_0x630c('0x17')),{'transaction':_0x399446});});});})[_0x630c('0x42')](function(_0x5c88d0){console['error'](_0x5c88d0);});}exports[_0x630c('0x43')]=rewrite; \ No newline at end of file +var _0xdd89=['queue','extensions','extension','find','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','outbound','cutdigits','${EXTEN:','CDR(routeid)=','priority','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','catch','error','rewrite','lodash','util','models','then','intervals','VoiceExtension','findAll','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xdd89,0xc5));var _0x9dd8=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0xdd89[_0x4fa0ea];return _0x51d027;};'use strict';var _=require(_0x9dd8('0x0'));var util=require(_0x9dd8('0x1'));function rewrite(_0x38d296,_0x3a3175){var _0x2d663f=this;return _0x38d296[_0x9dd8('0x2')]['Interval']['findAll']({'raw':!![]})[_0x9dd8('0x3')](function(_0x3b1c8e){_0x2d663f[_0x9dd8('0x4')]=_0x3b1c8e;return _0x38d296[_0x9dd8('0x2')][_0x9dd8('0x5')][_0x9dd8('0x6')]({'where':{'IntervalId':_0x3a3175[_0x9dd8('0x7')]},'raw':!![]});})[_0x9dd8('0x3')](function(_0x4198fe){return _0x38d296[_0x9dd8('0x2')]['VoiceExtension'][_0x9dd8('0x6')]({'where':{'exten':{'$in':_[_0x9dd8('0x8')](_[_0x9dd8('0x9')](_0x4198fe,_0x9dd8('0xa')))}},'order':[{'raw':_0x9dd8('0xb')}],'raw':!![]});})[_0x9dd8('0x3')](function(_0x132887){var _0x34e69d=_['filter'](_0x132887,{'priority':'1'});var _0x25e454=_[_0x9dd8('0xc')](_0x132887,{'isApp':0x1});var _0x1cf8f5=_['groupBy'](_0x25e454,_0x9dd8('0xa'));var _0x18a77b=[_0x9dd8('0xd'),'playback'];var _0x5a7da1=[];var _0x4c2b5b=[];for(var _0x32a1d9 in _0x1cf8f5){if(_0x1cf8f5['hasOwnProperty'](_0x32a1d9)){_0x2d663f['priority']=0x2;_0x2d663f[_0x9dd8('0xe')]=[];_0x2d663f[_0x9dd8('0xf')]=_[_0x9dd8('0x10')](_0x34e69d,{'exten':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0xa')]});_0x2d663f[_0x9dd8('0xe')][_0x9dd8('0x11')]({'type':_0x1cf8f5[_0x32a1d9][0x0]['type'],'app':_0x9dd8('0x12'),'appdata':util[_0x9dd8('0x13')](_0x9dd8('0x14'),_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x15')]),'context':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x16')],'exten':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0xa')],'priority':_0x2d663f['priority']++,'VoiceExtensionId':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x17')]});if(_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x15')]===_0x9dd8('0x18')){if(_0x2d663f['extension']){_0x2d663f[_0x9dd8('0xe')]['push']({'type':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x15')],'app':_0x9dd8('0x12'),'appdata':'CDR(destination)='+(_0x2d663f['extension'][_0x9dd8('0x19')]?_0x9dd8('0x1a')+_0x2d663f[_0x9dd8('0xf')]['cutdigits']+'}':'${EXTEN}'),'context':_0x1cf8f5[_0x32a1d9][0x0]['context'],'exten':_0x1cf8f5[_0x32a1d9][0x0]['exten'],'priority':_0x2d663f['priority']++,'VoiceExtensionId':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x17')]});}_0x2d663f[_0x9dd8('0xe')][_0x9dd8('0x11')]({'type':_0x1cf8f5[_0x32a1d9][0x0]['type'],'app':_0x9dd8('0x12'),'appdata':_0x9dd8('0x1b')+_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x17')],'context':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x16')],'exten':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0xa')],'priority':_0x2d663f['priority']++,'VoiceExtensionId':_0x1cf8f5[_0x32a1d9][0x0]['VoiceExtensionId']});var _0x292883=_0x2d663f[_0x9dd8('0x1c')]++;_0x2d663f[_0x9dd8('0xe')][_0x9dd8('0x11')]({'type':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x15')],'app':_0x9dd8('0x1d'),'appdata':_0x9dd8('0x1e')+(_0x292883+0x2)+_0x9dd8('0x1f')+(_0x292883+0x1)+')','context':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x16')],'exten':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0xa')],'priority':_0x292883,'VoiceExtensionId':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x17')]});if(_0x2d663f['extension']){_0x2d663f[_0x9dd8('0xe')][_0x9dd8('0x11')]({'type':_0x1cf8f5[_0x32a1d9][0x0]['type'],'app':'Set','appdata':_0x2d663f[_0x9dd8('0xf')]['cutdigits']?_0x9dd8('0x20')+_0x2d663f['extension'][_0x9dd8('0x19')]+'}':_0x9dd8('0x21'),'context':_0x1cf8f5[_0x32a1d9][0x0]['context'],'exten':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0xa')],'priority':_0x2d663f[_0x9dd8('0x1c')]++,'VoiceExtensionId':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x17')]});}_0x2d663f['extensions']['push']({'type':_0x1cf8f5[_0x32a1d9][0x0]['type'],'app':_0x9dd8('0x12'),'appdata':_0x9dd8('0x22')+_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x17')],'context':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x16')],'exten':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0xa')],'priority':_0x2d663f[_0x9dd8('0x1c')]++,'VoiceExtensionId':_0x1cf8f5[_0x32a1d9][0x0]['VoiceExtensionId']});if(_0x2d663f['extension']&&_0x2d663f[_0x9dd8('0xf')][_0x9dd8('0x23')]('recordingFormat')&&_0x2d663f[_0x9dd8('0xf')][_0x9dd8('0x24')]!=='none'){_0x2d663f[_0x9dd8('0xe')]['push']({'type':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x15')],'app':_0x9dd8('0x12'),'appdata':_0x9dd8('0x25'),'context':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x16')],'exten':_0x1cf8f5[_0x32a1d9][0x0]['exten'],'priority':_0x2d663f[_0x9dd8('0x1c')]++,'VoiceExtensionId':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x17')]});_0x2d663f['extensions'][_0x9dd8('0x11')]({'type':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x15')],'app':_0x9dd8('0x12'),'appdata':_0x9dd8('0x26')+_0x2d663f[_0x9dd8('0xf')][_0x9dd8('0x24')]||_0x9dd8('0x27'),'context':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x16')],'exten':_0x1cf8f5[_0x32a1d9][0x0]['exten'],'priority':_0x2d663f[_0x9dd8('0x1c')]++,'VoiceExtensionId':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x17')]});}}_0x2d663f[_0x9dd8('0xe')]['push']({'type':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x15')],'app':_0x9dd8('0x12'),'appdata':_0x9dd8('0x28'),'context':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x16')],'exten':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0xa')],'priority':_0x2d663f['priority']++,'VoiceExtensionId':_0x1cf8f5[_0x32a1d9][0x0]['VoiceExtensionId']});_0x2d663f['extensions'][_0x9dd8('0x11')]({'type':_0x1cf8f5[_0x32a1d9][0x0]['type'],'app':_0x9dd8('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1cf8f5[_0x32a1d9][0x0]['context'],'exten':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0xa')],'priority':_0x2d663f[_0x9dd8('0x1c')]++,'VoiceExtensionId':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x17')]});_0x2d663f[_0x9dd8('0xe')]['push']({'type':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x15')],'app':_0x9dd8('0x12'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1cf8f5[_0x32a1d9][0x0]['context'],'exten':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0xa')],'priority':_0x2d663f[_0x9dd8('0x1c')]++,'VoiceExtensionId':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x17')]});for(var _0x117018=0x0,_0x1e3486=0x0;_0x117018<_0x1cf8f5[_0x32a1d9][_0x9dd8('0x29')];_0x117018+=0x1,_0x1e3486=0x0){var _0x323f1e=_0x1cf8f5[_0x32a1d9][_0x117018];if(_0x323f1e[_0x9dd8('0x15')]){_0x323f1e[_0x9dd8('0x15')]=_0x323f1e['type'][_0x9dd8('0x2a')]();}var _0x7780b5=[];var _0x417151=[];delete _0x323f1e['id'];delete _0x323f1e[_0x9dd8('0x2b')];delete _0x323f1e[_0x9dd8('0x2c')];var _0x19da5f=_0x323f1e[_0x9dd8('0x2d')]!==_0x9dd8('0x2e')?[_0x323f1e[_0x9dd8('0x2d')]]:_0x323f1e['IntervalId']?_['map'](_['filter'](_0x2d663f[_0x9dd8('0x4')],{'IntervalId':_0x323f1e['IntervalId']}),'interval'):[];if(_0x323f1e[_0x9dd8('0x23')](_0x9dd8('0x2f'))){if(_0x323f1e[_0x9dd8('0x2f')]&&_0x323f1e['tag']!=='--'){_0x7780b5[_0x9dd8('0x11')]({'type':_0x323f1e[_0x9dd8('0x15')],'app':_0x9dd8('0x12'),'appdata':_0x9dd8('0x30')+_0x323f1e[_0x9dd8('0x2f')],'context':_0x323f1e[_0x9dd8('0x16')],'exten':_0x323f1e[_0x9dd8('0xa')],'priority':_0x19da5f['length']+_0x2d663f['priority']+_0x1e3486++,'VoiceExtensionId':_0x323f1e[_0x9dd8('0x17')]});}}if(_0x323f1e[_0x9dd8('0x15')]==='outbound'&&_0x323f1e[_0x9dd8('0x23')](_0x9dd8('0x31'))){if(_0x323f1e[_0x9dd8('0x31')]){_0x7780b5['push']({'type':_0x323f1e['type'],'app':'ExecIf','appdata':_0x9dd8('0x32')+_0x323f1e[_0x9dd8('0x31')]+')','context':_0x323f1e[_0x9dd8('0x16')],'exten':_0x323f1e[_0x9dd8('0xa')],'priority':_0x19da5f[_0x9dd8('0x29')]+_0x2d663f[_0x9dd8('0x1c')]+_0x1e3486++,'VoiceExtensionId':_0x323f1e[_0x9dd8('0x17')]});}else{_0x7780b5[_0x9dd8('0x11')]({'type':_0x323f1e[_0x9dd8('0x15')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x323f1e[_0x9dd8('0x16')],'exten':_0x323f1e[_0x9dd8('0xa')],'priority':_0x19da5f[_0x9dd8('0x29')]+_0x2d663f[_0x9dd8('0x1c')]+_0x1e3486++,'VoiceExtensionId':_0x323f1e[_0x9dd8('0x17')]});}}if(_0x323f1e[_0x9dd8('0x23')](_0x9dd8('0x33'))){if(_0x18a77b[_0x9dd8('0x34')](_0x323f1e[_0x9dd8('0x35')][_0x9dd8('0x2a')]())>=0x0&&_0x323f1e[_0x9dd8('0x36')]!==_0x9dd8('0x37')){if(_0x323f1e[_0x9dd8('0x33')]){_0x7780b5[_0x9dd8('0x11')]({'type':_0x323f1e[_0x9dd8('0x15')],'app':'ExecIf','appdata':_0x9dd8('0x38'),'context':_0x323f1e['context'],'exten':_0x323f1e[_0x9dd8('0xa')],'priority':_0x19da5f['length']+_0x2d663f['priority']+_0x1e3486++,'VoiceExtensionId':_0x323f1e[_0x9dd8('0x17')]});_0x7780b5[_0x9dd8('0x11')]({'type':_0x323f1e[_0x9dd8('0x15')],'app':_0x9dd8('0x12'),'appdata':_0x9dd8('0x39'),'context':_0x323f1e[_0x9dd8('0x16')],'exten':_0x323f1e[_0x9dd8('0xa')],'priority':_0x19da5f[_0x9dd8('0x29')]+_0x2d663f[_0x9dd8('0x1c')]+_0x1e3486++,'VoiceExtensionId':_0x323f1e['VoiceExtensionId']});}else{_0x7780b5[_0x9dd8('0x11')]({'type':_0x323f1e[_0x9dd8('0x15')],'app':_0x9dd8('0x1d'),'appdata':_0x9dd8('0x3a'),'context':_0x323f1e['context'],'exten':_0x323f1e['exten'],'priority':_0x19da5f[_0x9dd8('0x29')]+_0x2d663f[_0x9dd8('0x1c')]+_0x1e3486++,'VoiceExtensionId':_0x323f1e[_0x9dd8('0x17')]});_0x7780b5[_0x9dd8('0x11')]({'type':_0x323f1e['type'],'app':_0x9dd8('0x12'),'appdata':_0x9dd8('0x3b'),'context':_0x323f1e[_0x9dd8('0x16')],'exten':_0x323f1e[_0x9dd8('0xa')],'priority':_0x19da5f[_0x9dd8('0x29')]+_0x2d663f[_0x9dd8('0x1c')]+_0x1e3486++,'VoiceExtensionId':_0x323f1e[_0x9dd8('0x17')]});}}}for(var _0x17a614=0x0;_0x17a614<_0x19da5f[_0x9dd8('0x29')];_0x17a614+=0x1){var _0x469abf=_0x2d663f['priority']+_0x19da5f[_0x9dd8('0x29')];var _0x2e94f6=_0x17a614===_0x19da5f[_0x9dd8('0x29')]-0x1?_0x2d663f[_0x9dd8('0x1c')]+_0x7780b5[_0x9dd8('0x29')]+_0x417151[_0x9dd8('0x29')]+0x2:_0x2d663f[_0x9dd8('0x1c')]+_0x17a614+0x1;_0x7780b5[_0x9dd8('0x3c')](_0x17a614,0x0,{'type':_0x323f1e[_0x9dd8('0x15')],'app':'GotoIfTime','appdata':_0x19da5f[_0x17a614]+'?'+_0x323f1e[_0x9dd8('0x16')]+',${EXTEN},'+_0x469abf+':'+_0x323f1e[_0x9dd8('0x16')]+_0x9dd8('0x3d')+_0x2e94f6,'exten':_0x323f1e[_0x9dd8('0xa')],'context':_0x323f1e[_0x9dd8('0x16')],'priority':_0x2d663f[_0x9dd8('0x1c')]+_0x17a614,'VoiceExtensionId':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x17')]});}_0x323f1e['priority']=_0x7780b5[_0x9dd8('0x29')]?_[_0x9dd8('0x3e')](_0x7780b5)[_0x9dd8('0x1c')]+0x1:_0x2d663f[_0x9dd8('0x1c')];_0x2d663f[_0x9dd8('0x1c')]=(_0x417151[_0x9dd8('0x29')]?_[_0x9dd8('0x3e')](_0x417151)[_0x9dd8('0x1c')]:_0x323f1e['priority'])+0x1;_0x2d663f['extensions']=_[_0x9dd8('0x3f')](_0x2d663f['extensions'],_0x7780b5,[_0x323f1e],_0x417151);}_0x2d663f[_0x9dd8('0xe')][_0x9dd8('0x11')]({'type':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x15')],'app':_0x9dd8('0x40'),'exten':_0x1cf8f5[_0x32a1d9][0x0]['exten'],'context':_0x1cf8f5[_0x32a1d9][0x0]['context'],'priority':_0x2d663f['priority'],'VoiceExtensionId':_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x17')]});_0x5a7da1[_0x9dd8('0x11')](_0x1cf8f5[_0x32a1d9][0x0][_0x9dd8('0x17')]);_0x4c2b5b=_[_0x9dd8('0x3f')](_0x4c2b5b,_0x2d663f[_0x9dd8('0xe')]);}}return _0x38d296[_0x9dd8('0x41')](function(_0x14bda0){return _0x38d296['models']['VoiceExtension'][_0x9dd8('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x5a7da1}},'transaction':_0x14bda0})[_0x9dd8('0x3')](function(_0x11451e){return _0x38d296[_0x9dd8('0x2')][_0x9dd8('0x5')]['bulkCreate'](_['sortBy'](_0x4c2b5b,'priority'),{'transaction':_0x14bda0});});});})[_0x9dd8('0x43')](function(_0x3d5109){console[_0x9dd8('0x44')](_0x3d5109);});}exports[_0x9dd8('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index f9b4e4e..489334a 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x4b0f7b,_0x4dc34b){var _0x36f876=function(_0x46afb2){while(--_0x46afb2){_0x4b0f7b['push'](_0x4b0f7b['shift']());}};_0x36f876(++_0x4dc34b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file +var _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x119abb,_0x59266d){var _0x5b9efd=function(_0x3f2069){while(--_0x3f2069){_0x119abb['push'](_0x119abb['shift']());}};_0x5b9efd(++_0x59266d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index f05ddbe..79f1a06 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 _0x6647=['each','then','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','ContactId','priority','UserId','recallme','fields','join','cm_contacts','cm_contacts.ListId\x20=\x20','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','into','cm_hopper_black','ListId','updatedAt','.CmListId','ListId\x20=\x20?','toString','keys','CompanyId','createdAt','deletedAt\x20IS\x20NULL','group','info','error','message','exit','code','sequelize','spread','push','catch','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','errors','trim','replace','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','\x20LIKE\x20cm_contacts;','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','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns','CampaignId','campaigns_has_cm_blacklists'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6647,0x190));var _0x7664=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6647[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require(_0x7664('0x0'));var _=require(_0x7664('0x1'));var Papa=require(_0x7664('0x2'));var util=require(_0x7664('0x3'));var BPromise=require(_0x7664('0x4'));var moment=require(_0x7664('0x5'));var squel=require(_0x7664('0x6'));var Redis=require(_0x7664('0x7'));var db=require(_0x7664('0x8'))['db'];var config=require('../../../config/environment');var logger=require(_0x7664('0x9'))('import');config[_0x7664('0xa')]=_[_0x7664('0xb')](config['redis'],{'host':_0x7664('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x7664('0xd')](_0x7664('0xe'));function isEmail(_0x1b5213){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'](_0x1b5213);}function selectNotIn(_0x4dd4a4,_0x287385,_0x143bd0,_0xa10e9d,_0x312f7d){return squel[_0x7664('0xf')]()[_0x7664('0x10')](_0x7664('0x11'))[_0x7664('0x12')](_0xa10e9d)['join'](_0x287385,null,_0x287385+_0x7664('0x13')+_0xa10e9d+'.'+_0x143bd0)['where'](_0xa10e9d+'.'+_0x143bd0+_0x7664('0x14')+_0x4dd4a4+'.'+_0x143bd0)['where'](_0x287385+_0x7664('0x15')+_0x312f7d['join']()+')');}function insertCmHopper(_0x3f3722,_0x29d075,_0x5005ec,_0x29a152,_0x44582a){var _0x5d2474=['cm_contacts.phone',_0x7664('0x16'),'cm_contacts.id',_0x7664('0x17'),_0x29d075+'.'+_0x29a152,'cm_contacts.createdAt',_0x7664('0x18'),_0x7664('0x19'),_0x7664('0x1a'),'\x22'+_0x44582a+'\x22'];return squel[_0x7664('0x1b')]()['into'](_0x7664('0x1c'))[_0x7664('0x1d')]([_0x7664('0x11'),'scheduledat',_0x7664('0x1e'),'ListId',_0x29a152,'createdAt','updatedAt',_0x7664('0x1f'),_0x7664('0x20'),_0x7664('0x21')],squel['select']()[_0x7664('0x22')](_0x5d2474)[_0x7664('0x12')](_0x29d075)[_0x7664('0x23')](_0x7664('0x24'),null,_0x7664('0x25')+_0x29d075+'.CmListId')[_0x7664('0x23')](_0x5005ec,null,_0x5005ec+_0x7664('0x13')+_0x29d075+'.'+_0x29a152)[_0x7664('0x26')](_0x29d075+_0x7664('0x27'),_0x3f3722)[_0x7664('0x26')](_0x7664('0x28'),NOW)[_0x7664('0x26')](_0x7664('0x29'),selectNotIn(_0x29d075,_0x5005ec,_0x29a152,_0x7664('0x1c'),[_0x7664('0x2a'),'\x22onlyIfOpen\x22']))['where'](_0x7664('0x29'),selectNotIn(_0x29d075,_0x5005ec,_0x29a152,_0x7664('0x1c'),[_0x7664('0x2a')])))['toString']();}function insertCmHopperBlack(_0x13f539,_0x383cbd,_0x2a37fe,_0x34ceef){var _0x41150d=[_0x7664('0x2b'),_0x7664('0x2c'),_0x7664('0x17'),_0x383cbd+'.'+_0x34ceef,_0x7664('0x2d'),_0x7664('0x18')];return squel[_0x7664('0x1b')]()[_0x7664('0x2e')](_0x7664('0x2f'))['fromQuery']([_0x7664('0x11'),'ContactId',_0x7664('0x30'),_0x34ceef,'createdAt',_0x7664('0x31')],squel[_0x7664('0xf')]()[_0x7664('0x22')](_0x41150d)[_0x7664('0x12')](_0x383cbd)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x383cbd+_0x7664('0x32'))[_0x7664('0x23')](_0x2a37fe,null,_0x2a37fe+_0x7664('0x13')+_0x383cbd+'.'+_0x34ceef)['where'](_0x383cbd+'.CmListId\x20=\x20?',_0x13f539)[_0x7664('0x26')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x7664('0x26')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x7664('0x10')]('phone')[_0x7664('0x12')]('cm_hopper_black')[_0x7664('0x26')](_0x7664('0x33'),_0x13f539)[_0x7664('0x26')](_0x34ceef+'\x20=\x20?',_0x383cbd+'.'+_0x34ceef)))[_0x7664('0x34')]();}function insertCmContact(_0x14c200,_0x1053f5,_0x4572c1,_0x52f2c5){var _0x3c784d=_['concat'](_[_0x7664('0x35')](_0x52f2c5),[_0x7664('0x30'),_0x7664('0x36'),_0x7664('0x37'),_0x7664('0x31')]);return squel['insert']()[_0x7664('0x2e')](_0x7664('0x24'))[_0x7664('0x1d')](_0x3c784d,squel['select']()[_0x7664('0x22')](_0x3c784d)['from'](_0x1053f5)[_0x7664('0x26')]('('+_0x4572c1[_0x7664('0x23')](',')+')\x20NOT\x20IN\x20?',squel[_0x7664('0xf')]()['fields'](_0x4572c1)[_0x7664('0x12')](_0x7664('0x24'))['where'](_0x7664('0x33'),_0x14c200)[_0x7664('0x26')](_0x7664('0x38')))['where']('id\x20IN\x20?',squel[_0x7664('0xf')]()['field']('MIN(id)','min_id')[_0x7664('0x12')](_0x1053f5)[_0x7664('0x39')](_0x4572c1[_0x7664('0x23')](','))))[_0x7664('0x34')]();}function handleStop(){logger[_0x7664('0x3a')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x25bb32){logger[_0x7664('0x3b')](_0x25bb32[_0x7664('0x3c')]);process[_0x7664('0x3d')](0x1);}function handleError(_0x3f6aa9,_0x1a8ba3){stats['errors']['push']({'name':_0x1a8ba3[_0x7664('0x3e')],'message':_0x1a8ba3[_0x7664('0x3c')],'row':_0x3f6aa9});}function handleQuery(_0x5b3758){logger[_0x7664('0x3a')](_0x5b3758);return db[_0x7664('0x3f')]['query'](_0x5b3758)[_0x7664('0x40')](function(_0x52eba5){results[_0x7664('0x41')](_0x52eba5);})[_0x7664('0x42')](function(_0xc789e0){logger[_0x7664('0x3b')](_0xc789e0['message']);});}function main(_0x5f524a,_0x38d641,_0x78a10c,_0xfc098a){logger[_0x7664('0x3a')](_0x7664('0x43'),_0x5f524a,JSON[_0x7664('0x44')](_0x38d641));process[_0x7664('0x45')](_0x7664('0x46'));var _0x3eacb9=_0x38d641[_0x7664('0x47')];var _0xf6df4b=_0x38d641[_0x7664('0x48')];var _0x23a0f8=path['join'](config[_0x7664('0x49')],_0x7664('0x4a'),_0xf6df4b+_0x7664('0x4b'));var _0x3a228b=_['keys'](_0x3eacb9)[_0x7664('0x23')]();logger[_0x7664('0x3a')](_0x7664('0x4c'),_0x3a228b);fs[_0x7664('0x4d')](_0x23a0f8,_0x3a228b+'\x0a');Papa[_0x7664('0x4e')](fs[_0x7664('0x4f')](_0x5f524a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x183e9b,_0x58cd58){try{for(var _0x267ead=0x0,_0x233f0a=[];_0x267ead<_0x183e9b[_0x7664('0x50')][_0x7664('0x51')];_0x267ead++){stats[_0x7664('0x52')]+=0x1;if(_0x183e9b[_0x7664('0x53')][_0x267ead]){handleError(_0x183e9b[_0x7664('0x50')][_0x267ead],_0x183e9b[_0x7664('0x53')][_0x267ead]);}else{var _0x44a99f=[];for(var _0x46772e in _0x3eacb9){if(_0x3eacb9['hasOwnProperty'](_0x46772e)){if(_0x183e9b[_0x7664('0x50')][_0x267ead][_0x3eacb9[_0x46772e]]){var _0x44ae11=_[_0x7664('0x54')](_0x183e9b[_0x7664('0x50')][_0x267ead][_0x3eacb9[_0x46772e]][_0x7664('0x55')](/"/g,'\x27'));switch(_0x46772e){case _0x7664('0x56'):var _0x33225e=moment(_0x44ae11,_0x7664('0xe'),!![]);if(_0x33225e['isValid']()){_0x233f0a[_0x7664('0x41')]('\x22'+_0x44ae11+'\x22');}else{_0x44a99f[_0x7664('0x41')](_0x7664('0x57'));}break;case _0x7664('0x1f'):var _0x5722fd=parseInt(_0x44ae11);_0x44ae11=_['isNaN'](_0x5722fd)||_0x5722fd<0x0||_0x5722fd>0x4?_0xfc098a?0x3:0x2:_0x5722fd;_0x233f0a['push']('\x22'+_0x44ae11+'\x22');break;case _0x7664('0x20'):var _0x5c0039=parseInt(_0x44ae11);if(_['isNumber'](_0x5c0039)&&_['includes'](_0x78a10c,_0x5c0039)){_0x233f0a['push']('\x22'+_0x5c0039+'\x22');}else{_0x44a99f['push']('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x44ae11)){_0x233f0a[_0x7664('0x41')]('\x22'+_0x44ae11+'\x22');}else{_0x44a99f[_0x7664('0x41')]('email\x20wrong\x20format');}break;case _0x7664('0x58'):var _0x32dc2b=moment(_0x44ae11,_0x7664('0x59'),!![]);if(_0x32dc2b[_0x7664('0x5a')]()){_0x233f0a[_0x7664('0x41')]('\x22'+_0x44ae11+'\x22');}else{_0x44a99f[_0x7664('0x41')](_0x7664('0x5b'));}break;default:_0x233f0a[_0x7664('0x41')]('\x22'+_0x44ae11+'\x22');}}else{switch(_0x46772e){case _0x7664('0x5c'):case'phone':_0x44a99f[_0x7664('0x41')](_0x46772e+_0x7664('0x5d'));break;default:_0x233f0a[_0x7664('0x41')]('\x22\x22');}}}}if(_0x44a99f[_0x7664('0x51')]){handleError(_0x183e9b[_0x7664('0x50')][_0x267ead],{'code':_0x7664('0x5e'),'message':_0x44a99f[_0x7664('0x23')]()});}else{fs[_0x7664('0x5f')](_0x23a0f8,_0x233f0a[_0x7664('0x23')]()+'\x0a');}_0x233f0a=[];}if(!(stats[_0x7664('0x52')]%0xc8)){socket[_0x7664('0x60')](_0x7664('0x61')+_0xf6df4b,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7664('0x62'));_0x58cd58['abort']();}}catch(_0x3778e2){handleError(_0x183e9b[_0x7664('0x50')][_0x267ead],{'code':_0x7664('0x63'),'message':_0x3778e2[_0x7664('0x3c')]});logger[_0x7664('0x3b')](_0x7664('0x64'),_0x3778e2['message']);}},'complete':function(){try{var _0x5ed0cc=[];var _0x2bd664=_0x7664('0x24');if(_0x38d641[_0x7664('0x65')]&&_0x38d641[_0x7664('0x65')][_0x7664('0x51')]){_0x2bd664='cm_contacts_'+_0xf6df4b;_0x5ed0cc['push']('CREATE\x20TABLE\x20'+_0x2bd664+_0x7664('0x66'));}var _0x478a13=util[_0x7664('0xd')](_0x7664('0x67'),_0x23a0f8,_0x2bd664,_0x3a228b,_0x38d641[_0x7664('0x30')],_0x38d641[_0x7664('0x36')]||null,NOW,NOW);if(_[_0x7664('0x68')](_0x3eacb9['scheduledat'])){_0x478a13+=_0x7664('0x69');}_0x5ed0cc['push'](_0x478a13);if(_0x38d641[_0x7664('0x65')]&&_0x38d641[_0x7664('0x65')]['length']){_0x5ed0cc['push'](insertCmContact(_0x38d641['ListId'],_0x2bd664,_0x38d641['duplicates'],_0x3eacb9));_0x5ed0cc[_0x7664('0x41')](_0x7664('0x6a')+_0x2bd664+';');}_0x5ed0cc['push'](insertCmHopper(_0x38d641['ListId'],'voice_queues_has_cm_lists','voice_queues','VoiceQueueId',_0xfc098a));_0x5ed0cc[_0x7664('0x41')](insertCmHopperBlack(_0x38d641[_0x7664('0x30')],_0x7664('0x6b'),'voice_queues',_0x7664('0x6c')));_0x5ed0cc[_0x7664('0x41')](insertCmHopper(_0x38d641[_0x7664('0x30')],'campaigns_has_cm_lists',_0x7664('0x6d'),_0x7664('0x6e'),_0xfc098a));_0x5ed0cc[_0x7664('0x41')](insertCmHopperBlack(_0x38d641['ListId'],_0x7664('0x6f'),_0x7664('0x6d'),_0x7664('0x6e')));BPromise[_0x7664('0x70')](_0x5ed0cc,handleQuery)[_0x7664('0x71')](function(_0x3b68f8){stats['finish']=!![];stats[_0x7664('0x72')]=_0x38d641['duplicates']&&_0x38d641[_0x7664('0x65')][_0x7664('0x51')]?results[0x2]['affectedRows']:results[0x0][_0x7664('0x72')];socket['emit'](_0x7664('0x61')+_0xf6df4b,stats);fs[_0x7664('0x73')](_0x5f524a);fs[_0x7664('0x73')](_0x23a0f8);process[_0x7664('0x3d')](0x0);})[_0x7664('0x42')](function(_0x7cb444){logger['error'](_0x7cb444[_0x7664('0x3c')]);process['exit'](0x1);});}catch(_0x3ed920){logger[_0x7664('0x3b')](_0x7664('0x74'),_0x3ed920[_0x7664('0x3c')]);process[_0x7664('0x3d')](0x1);}},'error':function(_0xc106b9,_0x3425d9,_0x3ed335,_0x463bba){throw new Error(_0x463bba);}});}function validate(){if(process[_0x7664('0x75')]&&process[_0x7664('0x75')][_0x7664('0x51')]<0x4){throw new Error(_0x7664('0x76'));}var _0x3d4592=path[_0x7664('0x23')](config[_0x7664('0x49')],'server/files/tmp',process[_0x7664('0x75')][0x2]);if(!fs[_0x7664('0x77')](_0x3d4592)){throw new Error(_0x7664('0x78'));}var _0x4c8e32={};try{_0x4c8e32=JSON[_0x7664('0x4e')](process[_0x7664('0x75')][0x3]);if(!_0x4c8e32[_0x7664('0x47')]){throw new Error(_0x7664('0x79'));}if(!_0x4c8e32[_0x7664('0x47')][_0x7664('0x11')]){throw new Error(_0x7664('0x7a'));}if(!_0x4c8e32[_0x7664('0x47')][_0x7664('0x5c')]){throw new Error(_0x7664('0x7b'));}var _0x25e100=0x0;if(_0x4c8e32[_0x7664('0x47')]['UserId']){_0x25e100=0x1;}if(!_0x4c8e32[_0x7664('0x30')]){throw new Error(_0x7664('0x7c'));}}catch(_0xdde971){throw new Error(_0x7664('0x7d'));}var _0x840817=[];try{_0x840817=_['map'](JSON[_0x7664('0x4e')](process['argv'][0x4]),'id');}catch(_0xfaa7f6){logger[_0x7664('0x3a')]('No\x20agent\x20available');}main(_0x3d4592,_0x4c8e32,_0x840817,_0x25e100);}validate();process['on'](_0x7664('0x7e'),handleStop);process['on'](_0x7664('0x7f'),handleUncaughtException); \ No newline at end of file +var _0xb79a=['Received\x20SIGINT','message','exit','errors','push','code','info','sequelize','query','spread','catch','main','stringify','start','binding','socket_timestamp','root','header','writeFileSync','parse','createReadStream','length','rows','data','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','each','finish','affectedRows','unlink','error','complete','argv','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','cm_contacts.phone','into','fromQuery','.CmListId','cm_hopper_black','toString','concat','keys','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','field','MIN(id)','min_id','group'];(function(_0x54bd64,_0x142b58){var _0xdd9a9f=function(_0x29eae9){while(--_0x29eae9){_0x54bd64['push'](_0x54bd64['shift']());}};_0xdd9a9f(++_0x142b58);}(_0xb79a,0x1ca));var _0xab79=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb79a[_0x2641f9];return _0x585741;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require('papaparse');var util=require(_0xab79('0x0'));var BPromise=require(_0xab79('0x1'));var moment=require(_0xab79('0x2'));var squel=require(_0xab79('0x3'));var Redis=require(_0xab79('0x4'));var db=require(_0xab79('0x5'))['db'];var config=require(_0xab79('0x6'));var logger=require('../../../config/logger')(_0xab79('0x7'));config[_0xab79('0x8')]=_[_0xab79('0x9')](config[_0xab79('0x8')],{'host':_0xab79('0xa'),'port':0x18eb});var socket=require(_0xab79('0xb'))(new Redis(config[_0xab79('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xab79('0xc')](_0xab79('0xd'));function isEmail(_0x2d22e3){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))*$/[_0xab79('0xe')](_0x2d22e3);}function selectNotIn(_0x4556d1,_0x33fd68,_0x352ac8,_0x1140ff,_0x4f1214){return squel[_0xab79('0xf')]()['field'](_0xab79('0x10'))[_0xab79('0x11')](_0x1140ff)[_0xab79('0x12')](_0x33fd68,null,_0x33fd68+'.id\x20=\x20'+_0x1140ff+'.'+_0x352ac8)['where'](_0x1140ff+'.'+_0x352ac8+'\x20=\x20'+_0x4556d1+'.'+_0x352ac8)['where'](_0x33fd68+_0xab79('0x13')+_0x4f1214[_0xab79('0x12')]()+')');}function insertCmHopper(_0x46dfd6,_0x2eede9,_0xd92903,_0xfefd31,_0x4b22e7){var _0x516e79=['cm_contacts.phone',_0xab79('0x14'),_0xab79('0x15'),_0xab79('0x16'),_0x2eede9+'.'+_0xfefd31,_0xab79('0x17'),_0xab79('0x18'),_0xab79('0x19'),'cm_contacts.UserId','\x22'+_0x4b22e7+'\x22'];return squel[_0xab79('0x1a')]()['into']('cm_hopper')['fromQuery']([_0xab79('0x10'),_0xab79('0x1b'),'ContactId',_0xab79('0x1c'),_0xfefd31,_0xab79('0x1d'),_0xab79('0x1e'),_0xab79('0x1f'),_0xab79('0x20'),_0xab79('0x21')],squel[_0xab79('0xf')]()[_0xab79('0x22')](_0x516e79)[_0xab79('0x11')](_0x2eede9)[_0xab79('0x12')](_0xab79('0x23'),null,_0xab79('0x24')+_0x2eede9+'.CmListId')[_0xab79('0x12')](_0xd92903,null,_0xd92903+_0xab79('0x25')+_0x2eede9+'.'+_0xfefd31)[_0xab79('0x26')](_0x2eede9+_0xab79('0x27'),_0x46dfd6)[_0xab79('0x26')](_0xab79('0x28'),NOW)[_0xab79('0x26')](_0xab79('0x29'),selectNotIn(_0x2eede9,_0xd92903,_0xfefd31,_0xab79('0x2a'),[_0xab79('0x2b'),'\x22onlyIfOpen\x22']))[_0xab79('0x26')](_0xab79('0x29'),selectNotIn(_0x2eede9,_0xd92903,_0xfefd31,'cm_hopper',['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x2d872d,_0x1d987c,_0x33bdb9,_0x12d3d8){var _0x2af97d=[_0xab79('0x2c'),'cm_contacts.id','cm_contacts.ListId',_0x1d987c+'.'+_0x12d3d8,_0xab79('0x17'),_0xab79('0x18')];return squel[_0xab79('0x1a')]()[_0xab79('0x2d')]('cm_hopper_black')[_0xab79('0x2e')]([_0xab79('0x10'),'ContactId','ListId',_0x12d3d8,_0xab79('0x1d'),_0xab79('0x1e')],squel[_0xab79('0xf')]()['fields'](_0x2af97d)[_0xab79('0x11')](_0x1d987c)[_0xab79('0x12')](_0xab79('0x23'),null,_0xab79('0x24')+_0x1d987c+_0xab79('0x2f'))[_0xab79('0x12')](_0x33bdb9,null,_0x33bdb9+_0xab79('0x25')+_0x1d987c+'.'+_0x12d3d8)[_0xab79('0x26')](_0x1d987c+'.CmListId\x20=\x20?',_0x2d872d)[_0xab79('0x26')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xab79('0x10'))[_0xab79('0x11')](_0xab79('0x30'))[_0xab79('0x26')]('ListId\x20=\x20?',_0x2d872d)['where'](_0x12d3d8+'\x20=\x20?',_0x1d987c+'.'+_0x12d3d8)))[_0xab79('0x31')]();}function insertCmContact(_0x5134d6,_0x19b2d5,_0xbc2c81,_0x301e7b){var _0x504f66=_[_0xab79('0x32')](_[_0xab79('0x33')](_0x301e7b),['ListId','CompanyId',_0xab79('0x1d'),'updatedAt']);return squel['insert']()['into'](_0xab79('0x23'))[_0xab79('0x2e')](_0x504f66,squel[_0xab79('0xf')]()[_0xab79('0x22')](_0x504f66)[_0xab79('0x11')](_0x19b2d5)[_0xab79('0x26')]('('+_0xbc2c81['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xab79('0xf')]()[_0xab79('0x22')](_0xbc2c81)[_0xab79('0x11')]('cm_contacts')[_0xab79('0x26')](_0xab79('0x34'),_0x5134d6)[_0xab79('0x26')](_0xab79('0x35')))[_0xab79('0x26')]('id\x20IN\x20?',squel[_0xab79('0xf')]()[_0xab79('0x36')](_0xab79('0x37'),_0xab79('0x38'))[_0xab79('0x11')](_0x19b2d5)[_0xab79('0x39')](_0xbc2c81[_0xab79('0x12')](','))))['toString']();}function handleStop(){logger['info'](_0xab79('0x3a'));stopped=!![];}function handleUncaughtException(_0x3c81df){logger['error'](_0x3c81df[_0xab79('0x3b')]);process[_0xab79('0x3c')](0x1);}function handleError(_0x51da3e,_0x12a230){stats[_0xab79('0x3d')][_0xab79('0x3e')]({'name':_0x12a230[_0xab79('0x3f')],'message':_0x12a230['message'],'row':_0x51da3e});}function handleQuery(_0x1c88dc){logger[_0xab79('0x40')](_0x1c88dc);return db[_0xab79('0x41')][_0xab79('0x42')](_0x1c88dc)[_0xab79('0x43')](function(_0x33ed0e){results[_0xab79('0x3e')](_0x33ed0e);})[_0xab79('0x44')](function(_0x1e57f4){logger['error'](_0x1e57f4[_0xab79('0x3b')]);});}function main(_0x51a591,_0x401932,_0x45a805,_0x455172){logger['info'](_0xab79('0x45'),_0x51a591,JSON[_0xab79('0x46')](_0x401932));process['send'](_0xab79('0x47'));var _0x1de273=_0x401932[_0xab79('0x48')];var _0x9b9322=_0x401932[_0xab79('0x49')];var _0x386d6e=path[_0xab79('0x12')](config[_0xab79('0x4a')],'server/files/tmp',_0x9b9322+'.csv');var _0x2cd4a8=_[_0xab79('0x33')](_0x1de273)[_0xab79('0x12')]();logger[_0xab79('0x40')](_0xab79('0x4b'),_0x2cd4a8);fs[_0xab79('0x4c')](_0x386d6e,_0x2cd4a8+'\x0a');Papa[_0xab79('0x4d')](fs[_0xab79('0x4e')](_0x51a591),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3118d1,_0x10abcc){try{for(var _0x335245=0x0,_0x380bf1=[];_0x335245<_0x3118d1['data'][_0xab79('0x4f')];_0x335245++){stats[_0xab79('0x50')]+=0x1;if(_0x3118d1[_0xab79('0x3d')][_0x335245]){handleError(_0x3118d1[_0xab79('0x51')][_0x335245],_0x3118d1[_0xab79('0x3d')][_0x335245]);}else{var _0xad5b42=[];for(var _0x51d28a in _0x1de273){if(_0x1de273['hasOwnProperty'](_0x51d28a)){if(_0x3118d1['data'][_0x335245][_0x1de273[_0x51d28a]]){var _0x4fbbda=_[_0xab79('0x52')](_0x3118d1[_0xab79('0x51')][_0x335245][_0x1de273[_0x51d28a]][_0xab79('0x53')](/"/g,'\x27'));switch(_0x51d28a){case _0xab79('0x1b'):var _0x31eb29=moment(_0x4fbbda,_0xab79('0xd'),!![]);if(_0x31eb29[_0xab79('0x54')]()){_0x380bf1['push']('\x22'+_0x4fbbda+'\x22');}else{_0xad5b42[_0xab79('0x3e')](_0xab79('0x55'));}break;case'priority':var _0x30b8b3=parseInt(_0x4fbbda);_0x4fbbda=_['isNaN'](_0x30b8b3)||_0x30b8b3<0x0||_0x30b8b3>0x4?_0x455172?0x3:0x2:_0x30b8b3;_0x380bf1[_0xab79('0x3e')]('\x22'+_0x4fbbda+'\x22');break;case _0xab79('0x20'):var _0x243fe6=parseInt(_0x4fbbda);if(_[_0xab79('0x56')](_0x243fe6)&&_[_0xab79('0x57')](_0x45a805,_0x243fe6)){_0x380bf1[_0xab79('0x3e')]('\x22'+_0x243fe6+'\x22');}else{_0xad5b42['push']('agent\x20not\x20exists');}break;case _0xab79('0x58'):if(isEmail(_0x4fbbda)){_0x380bf1[_0xab79('0x3e')]('\x22'+_0x4fbbda+'\x22');}else{_0xad5b42['push'](_0xab79('0x59'));}break;case _0xab79('0x5a'):var _0x5781d2=moment(_0x4fbbda,_0xab79('0x5b'),!![]);if(_0x5781d2['isValid']()){_0x380bf1[_0xab79('0x3e')]('\x22'+_0x4fbbda+'\x22');}else{_0xad5b42[_0xab79('0x3e')](_0xab79('0x5c'));}break;default:_0x380bf1[_0xab79('0x3e')]('\x22'+_0x4fbbda+'\x22');}}else{switch(_0x51d28a){case _0xab79('0x5d'):case _0xab79('0x10'):_0xad5b42[_0xab79('0x3e')](_0x51d28a+'\x20not\x20specified');break;default:_0x380bf1[_0xab79('0x3e')]('\x22\x22');}}}}if(_0xad5b42[_0xab79('0x4f')]){handleError(_0x3118d1[_0xab79('0x51')][_0x335245],{'code':_0xab79('0x5e'),'message':_0xad5b42['join']()});}else{fs[_0xab79('0x5f')](_0x386d6e,_0x380bf1['join']()+'\x0a');}_0x380bf1=[];}if(!(stats[_0xab79('0x50')]%0xc8)){socket[_0xab79('0x60')](_0xab79('0x61')+_0x9b9322,stats);stats['errors']=[];}}if(stopped){logger['info'](_0xab79('0x62'));_0x10abcc[_0xab79('0x63')]();}}catch(_0x5c79ec){handleError(_0x3118d1[_0xab79('0x51')][_0x335245],{'code':'SystemError','message':_0x5c79ec[_0xab79('0x3b')]});logger['error'](_0xab79('0x64'),_0x5c79ec[_0xab79('0x3b')]);}},'complete':function(){try{var _0xfa1072=[];var _0x2ff32a=_0xab79('0x23');if(_0x401932[_0xab79('0x65')]&&_0x401932[_0xab79('0x65')]['length']){_0x2ff32a=_0xab79('0x66')+_0x9b9322;_0xfa1072[_0xab79('0x3e')](_0xab79('0x67')+_0x2ff32a+'\x20LIKE\x20cm_contacts;');}var _0x2abecd=util['format']('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',_0x386d6e,_0x2ff32a,_0x2cd4a8,_0x401932[_0xab79('0x1c')],_0x401932['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x1de273['scheduledat'])){_0x2abecd+=',\x20scheduledAt\x20=\x20NOW()';}_0xfa1072[_0xab79('0x3e')](_0x2abecd);if(_0x401932[_0xab79('0x65')]&&_0x401932[_0xab79('0x65')][_0xab79('0x4f')]){_0xfa1072[_0xab79('0x3e')](insertCmContact(_0x401932[_0xab79('0x1c')],_0x2ff32a,_0x401932[_0xab79('0x65')],_0x1de273));_0xfa1072['push']('DROP\x20TABLE\x20'+_0x2ff32a+';');}_0xfa1072['push'](insertCmHopper(_0x401932['ListId'],_0xab79('0x68'),_0xab79('0x69'),_0xab79('0x6a'),_0x455172));_0xfa1072[_0xab79('0x3e')](insertCmHopperBlack(_0x401932[_0xab79('0x1c')],_0xab79('0x6b'),'voice_queues',_0xab79('0x6a')));_0xfa1072[_0xab79('0x3e')](insertCmHopper(_0x401932[_0xab79('0x1c')],_0xab79('0x6c'),_0xab79('0x6d'),_0xab79('0x6e'),_0x455172));_0xfa1072[_0xab79('0x3e')](insertCmHopperBlack(_0x401932[_0xab79('0x1c')],'campaigns_has_cm_blacklists',_0xab79('0x6d'),_0xab79('0x6e')));BPromise[_0xab79('0x6f')](_0xfa1072,handleQuery)['then'](function(_0x1e2f52){stats[_0xab79('0x70')]=!![];stats['affectedRows']=_0x401932[_0xab79('0x65')]&&_0x401932['duplicates']['length']?results[0x2][_0xab79('0x71')]:results[0x0]['affectedRows'];socket[_0xab79('0x60')]('contact:import:'+_0x9b9322,stats);fs[_0xab79('0x72')](_0x51a591);fs['unlink'](_0x386d6e);process[_0xab79('0x3c')](0x0);})[_0xab79('0x44')](function(_0x1db0fb){logger[_0xab79('0x73')](_0x1db0fb[_0xab79('0x3b')]);process['exit'](0x1);});}catch(_0x4192eb){logger[_0xab79('0x73')](_0xab79('0x74'),_0x4192eb[_0xab79('0x3b')]);process['exit'](0x1);}},'error':function(_0x8322c9,_0xe0a85f,_0x17a05d,_0x48197c){throw new Error(_0x48197c);}});}function validate(){if(process[_0xab79('0x75')]&&process[_0xab79('0x75')][_0xab79('0x4f')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x331c47=path[_0xab79('0x12')](config[_0xab79('0x4a')],_0xab79('0x76'),process[_0xab79('0x75')][0x2]);if(!fs[_0xab79('0x77')](_0x331c47)){throw new Error(_0xab79('0x78'));}var _0x3087ff={};try{_0x3087ff=JSON['parse'](process['argv'][0x3]);if(!_0x3087ff[_0xab79('0x48')]){throw new Error(_0xab79('0x79'));}if(!_0x3087ff['binding']['phone']){throw new Error(_0xab79('0x7a'));}if(!_0x3087ff[_0xab79('0x48')][_0xab79('0x5d')]){throw new Error(_0xab79('0x7b'));}var _0x454545=0x0;if(_0x3087ff[_0xab79('0x48')][_0xab79('0x20')]){_0x454545=0x1;}if(!_0x3087ff[_0xab79('0x1c')]){throw new Error(_0xab79('0x7c'));}}catch(_0x3fe769){throw new Error(_0xab79('0x7d'));}var _0x160321=[];try{_0x160321=_['map'](JSON['parse'](process[_0xab79('0x75')][0x4]),'id');}catch(_0x2f20b2){logger[_0xab79('0x40')](_0xab79('0x7e'));}main(_0x331c47,_0x3087ff,_0x160321,_0x454545);}validate();process['on'](_0xab79('0x7f'),handleStop);process['on'](_0xab79('0x80'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 035cac2..3b88fcc 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7be1=['Complete\x20Time','endtime','Duration','duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','queue','push','calleridnum','outbound','Outbound\x20Call','destcalleridnum','inbound','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','variable','calleridname','Call\x20To','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Ring','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','talktime','Called\x20Number','Member\x20Name','membername','starttime','***\x20Time\x20Info\x20***','answertime'];(function(_0xcb9ec4,_0x1773ba){var _0x57d183=function(_0x39915d){while(--_0x39915d){_0xcb9ec4['push'](_0xcb9ec4['shift']());}};_0x57d183(++_0x1773ba);}(_0x7be1,0x165));var _0x17be=function(_0x23bed6,_0x45f84f){_0x23bed6=_0x23bed6-0x0;var _0x1f9d5b=_0x7be1[_0x23bed6];return _0x1f9d5b;};'use strict';exports[_0x17be('0x0')]=function(_0x2d2049,_0x6a550d){var _0x5ec6c0=[{'type':_0x17be('0x1'),'content':_0x17be('0x2'),'variableName':null}];switch(_0x2d2049[_0x17be('0x3')]()){case _0x17be('0x4'):switch(_0x6a550d[_0x17be('0x3')]()){case'inbound':_0x5ec6c0['push']({'type':'variable','content':'','variableName':_0x17be('0x5')});_0x5ec6c0[_0x17be('0x6')]({'type':'variable','content':'','variableName':_0x17be('0x7')});break;case _0x17be('0x8'):_0x5ec6c0[_0x17be('0x6')]({'type':_0x17be('0x1'),'content':_0x17be('0x9'),'variableName':null});_0x5ec6c0[_0x17be('0x6')]({'type':'variable','content':'','variableName':_0x17be('0xa')});break;}}return _0x5ec6c0;};exports['getDescriptions']=function(_0x3d23c3,_0x2c276e){var _0x520a49=[];switch(_0x3d23c3[_0x17be('0x3')]()){case _0x17be('0x4'):switch(_0x2c276e[_0x17be('0x3')]()){case _0x17be('0xb'):_0x520a49=[{'type':'string','content':_0x17be('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x17be('0xd'),'keyType':'variable','variableName':_0x17be('0x7')},{'type':_0x17be('0xe'),'content':'','key':_0x17be('0xf'),'keyType':_0x17be('0x10'),'variableName':_0x17be('0x11')},{'type':'keyValue','content':'','key':_0x17be('0x12'),'keyType':'variable','variableName':'destexten'},{'type':_0x17be('0xe'),'content':'','key':'Queue','keyType':_0x17be('0x10'),'variableName':'queue'},{'type':_0x17be('0xe'),'content':'','key':_0x17be('0x13'),'keyType':'variable','variableName':_0x17be('0x14')},{'type':'keyValue','content':'','key':_0x17be('0x15'),'keyType':'variable','variableName':_0x17be('0x16')},{'type':_0x17be('0x1'),'content':_0x17be('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x17be('0xe'),'content':'','key':_0x17be('0x18'),'keyType':'variable','variableName':_0x17be('0x19')},{'type':_0x17be('0xe'),'content':'','key':_0x17be('0x1a'),'keyType':_0x17be('0x10'),'variableName':'destcalleridnum'},{'type':_0x17be('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x17be('0x1b'),'keyType':_0x17be('0x10'),'variableName':_0x17be('0x16')},{'type':_0x17be('0xe'),'content':'','key':'Agent\x20Connect','keyType':_0x17be('0x10'),'variableName':_0x17be('0x1c')},{'type':'keyValue','content':'','key':_0x17be('0x1d'),'keyType':'variable','variableName':_0x17be('0x1e')},{'type':_0x17be('0xe'),'content':'','key':_0x17be('0x1f'),'keyType':_0x17be('0x10'),'variableName':'holdtime'},{'type':_0x17be('0xe'),'content':'','key':'Talk\x20Time','keyType':'variable','variableName':_0x17be('0x20')}];break;case'outbound':_0x520a49=[{'type':_0x17be('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x17be('0xe'),'content':'','key':_0x17be('0x21'),'keyType':_0x17be('0x10'),'keyContent':'','variableName':_0x17be('0xa')},{'type':_0x17be('0xe'),'content':'','key':_0x17be('0x22'),'keyType':_0x17be('0x10'),'keyContent':'','variableName':_0x17be('0x23')},{'type':'keyValue','content':'','key':_0x17be('0x13'),'keyType':_0x17be('0x10'),'keyContent':'','variableName':_0x17be('0x14')},{'type':_0x17be('0xe'),'content':'','key':_0x17be('0x15'),'keyType':'variable','keyContent':'','variableName':_0x17be('0x24')},{'type':_0x17be('0x1'),'content':_0x17be('0x25')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0x17be('0x10'),'keyContent':'','variableName':_0x17be('0x26')},{'type':'keyValue','content':'','key':_0x17be('0x27'),'keyType':'variable','keyContent':'','variableName':_0x17be('0x28')},{'type':_0x17be('0xe'),'content':'','key':_0x17be('0x29'),'keyType':_0x17be('0x10'),'keyContent':'','variableName':_0x17be('0x2a')},{'type':_0x17be('0xe'),'content':'','key':_0x17be('0x2b'),'keyType':_0x17be('0x10'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x520a49;}; \ No newline at end of file +var _0xa866=['Queue','uniqueid','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Called\x20Number','UniqueId','Date','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','getSubjects','string','toLowerCase','voice','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','destexten'];(function(_0x2c6ac,_0x2fc8c8){var _0x6b0e79=function(_0x1d4e90){while(--_0x1d4e90){_0x2c6ac['push'](_0x2c6ac['shift']());}};_0x6b0e79(++_0x2fc8c8);}(_0xa866,0x6a));var _0x6a86=function(_0xa100fc,_0x5c08a1){_0xa100fc=_0xa100fc-0x0;var _0xcec366=_0xa866[_0xa100fc];return _0xcec366;};'use strict';exports[_0x6a86('0x0')]=function(_0x1bcdcb,_0x33ac9f){var _0x13a2cf=[{'type':_0x6a86('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x1bcdcb[_0x6a86('0x2')]()){case _0x6a86('0x3'):switch(_0x33ac9f[_0x6a86('0x2')]()){case'inbound':_0x13a2cf[_0x6a86('0x4')]({'type':_0x6a86('0x5'),'content':'','variableName':_0x6a86('0x6')});_0x13a2cf['push']({'type':_0x6a86('0x5'),'content':'','variableName':_0x6a86('0x7')});break;case _0x6a86('0x8'):_0x13a2cf[_0x6a86('0x4')]({'type':_0x6a86('0x1'),'content':_0x6a86('0x9'),'variableName':null});_0x13a2cf[_0x6a86('0x4')]({'type':_0x6a86('0x5'),'content':'','variableName':_0x6a86('0xa')});break;}}return _0x13a2cf;};exports['getDescriptions']=function(_0x3435a8,_0x1a4548){var _0x100925=[];switch(_0x3435a8['toLowerCase']()){case _0x6a86('0x3'):switch(_0x1a4548[_0x6a86('0x2')]()){case'inbound':_0x100925=[{'type':'string','content':_0x6a86('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x6a86('0xc'),'content':'','key':_0x6a86('0xd'),'keyType':_0x6a86('0x5'),'variableName':_0x6a86('0x7')},{'type':_0x6a86('0xc'),'content':'','key':_0x6a86('0xe'),'keyType':_0x6a86('0x5'),'variableName':'calleridname'},{'type':_0x6a86('0xc'),'content':'','key':_0x6a86('0xf'),'keyType':'variable','variableName':_0x6a86('0x10')},{'type':_0x6a86('0xc'),'content':'','key':_0x6a86('0x11'),'keyType':_0x6a86('0x5'),'variableName':_0x6a86('0x6')},{'type':_0x6a86('0xc'),'content':'','key':'UniqueId','keyType':_0x6a86('0x5'),'variableName':_0x6a86('0x12')},{'type':'keyValue','content':'','key':'Date','keyType':_0x6a86('0x5'),'variableName':'agentcalledAt'},{'type':'string','content':_0x6a86('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0x6a86('0xc'),'content':'','key':_0x6a86('0x14'),'keyType':'variable','variableName':_0x6a86('0x15')},{'type':_0x6a86('0xc'),'content':'','key':_0x6a86('0x16'),'keyType':_0x6a86('0x5'),'variableName':_0x6a86('0xa')},{'type':_0x6a86('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0x6a86('0x5'),'variableName':_0x6a86('0x17')},{'type':_0x6a86('0xc'),'content':'','key':_0x6a86('0x18'),'keyType':'variable','variableName':_0x6a86('0x19')},{'type':_0x6a86('0xc'),'content':'','key':_0x6a86('0x1a'),'keyType':_0x6a86('0x5'),'variableName':_0x6a86('0x1b')},{'type':_0x6a86('0xc'),'content':'','key':_0x6a86('0x1c'),'keyType':_0x6a86('0x5'),'variableName':_0x6a86('0x1d')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':_0x6a86('0x5'),'variableName':'talktime'}];break;case _0x6a86('0x8'):_0x100925=[{'type':_0x6a86('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x6a86('0xc'),'content':'','key':_0x6a86('0x1e'),'keyType':_0x6a86('0x5'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x6a86('0xc'),'content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':'membername'},{'type':_0x6a86('0xc'),'content':'','key':_0x6a86('0x1f'),'keyType':_0x6a86('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':_0x6a86('0xc'),'content':'','key':_0x6a86('0x20'),'keyType':_0x6a86('0x5'),'keyContent':'','variableName':_0x6a86('0x21')},{'type':'string','content':_0x6a86('0x22')},{'type':'keyValue','content':'','key':_0x6a86('0x23'),'keyType':_0x6a86('0x5'),'keyContent':'','variableName':_0x6a86('0x24')},{'type':_0x6a86('0xc'),'content':'','key':_0x6a86('0x25'),'keyType':'variable','keyContent':'','variableName':_0x6a86('0x26')},{'type':_0x6a86('0xc'),'content':'','key':'Duration','keyType':_0x6a86('0x5'),'keyContent':'','variableName':_0x6a86('0x27')},{'type':'keyValue','content':'','key':_0x6a86('0x28'),'keyType':_0x6a86('0x5'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x100925;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index e41922d..cd95005 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e38=['error','tracked','query','clone','body','html','phone','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','upperFirst','InteractionId','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','Interaction','findOne','then','catch'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0e38,0x149));var _0x80e3=function(_0x15f883,_0x495157){_0x15f883=_0x15f883-0x0;var _0x423171=_0x0e38[_0x15f883];return _0x423171;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x80e3('0x0'))(_0x80e3('0x1')),'mail':require('../../config/logger')(_0x80e3('0x2')),'fax':require(_0x80e3('0x0'))(_0x80e3('0x3')),'sms':require(_0x80e3('0x0'))('sms-interactions'),'chat':require(_0x80e3('0x0'))(_0x80e3('0x4'))};function getInteractionId(_0x4d5284,_0xf6c3b,_0x2b8c6d){if(_0x4d5284&&_0x4d5284[_[_0x80e3('0x5')](_0x2b8c6d)+_0x80e3('0x6')]){return _0x4d5284[_[_0x80e3('0x5')](_0x2b8c6d)+_0x80e3('0x6')];}else if(_0x4d5284&&_0x4d5284['id']){return _0x4d5284['id'];}else if(_0xf6c3b&&_0xf6c3b['id']){return _0xf6c3b['id'];}else{return'unknown';}}function log(_0x4e92e4,_0x4a4621,_0x4804de,_0x1f5dfb,_0x7e5fbf,_0x4e8d83){loggers[_0x7e5fbf['toLowerCase']()][_0x4e92e4](_0x80e3('0x7'),_0x4e8d83[_0x80e3('0x8')](),_0x4a4621?_0x4a4621['id']:null,_0x4a4621?_0x4a4621[_0x80e3('0x9')]:null,_0x4a4621?_0x4a4621[_0x80e3('0xa')]:null,getInteractionId(_0x4804de,_0x1f5dfb,_0x7e5fbf),_0x4804de?JSON[_0x80e3('0xb')](_0x4804de):'null');}function updateUser(_0x1b7150,_0x2e338d,_0x3e902e,_0x36758e,_0x1caa68){db[_[_0x80e3('0x5')](_0x36758e)+_0x80e3('0xc')][_0x80e3('0xd')]({'where':{'id':getInteractionId(_0x2e338d,_0x3e902e,_0x36758e)}})[_0x80e3('0xe')](function(_0xa3b514){if(_0xa3b514){return _0xa3b514['update']({'UserId':_0x1b7150?_0x1b7150['id']:null});}})[_0x80e3('0xe')](function(_0x35403f){if(_0x35403f){log('info',_0x1b7150,_0x2e338d,_0x3e902e,_0x36758e,_0x1caa68);}})[_0x80e3('0xf')](function(){log(_0x80e3('0x10'),_0x1b7150,_0x2e338d,_0x3e902e,_0x36758e,_0x1caa68);});}exports[_0x80e3('0x11')]=function(_0xe208b5,_0x7f35ab){return function(_0xbba8b6,_0x4521ea,_0x431758){var _0x173175=_0xbba8b6['user'];var _0x1ffda1={};var _0x33030d=_0xbba8b6[_0x80e3('0x12')];if(_0x1ffda1){_0x1ffda1=_[_0x80e3('0x13')](_0xbba8b6[_0x80e3('0x14')]);_0x1ffda1=_['omit'](_0x1ffda1,[_0x80e3('0x14'),_0x80e3('0x15'),_0x80e3('0x16'),'fax','mobile']);}updateUser(_0x173175,_0x1ffda1,_0x33030d,_0xe208b5,_0x7f35ab);_0x431758(null);};}; \ No newline at end of file +var _0x7683=['mobile','../../mysqldb','openchannel-interactions','../../config/logger','fax-interactions','sms-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','findOne','then','update','info','catch','error','user','clone','body','phone','fax'];(function(_0x3b37de,_0x144737){var _0x504f9f=function(_0x559404){while(--_0x559404){_0x3b37de['push'](_0x3b37de['shift']());}};_0x504f9f(++_0x144737);}(_0x7683,0x1b6));var _0x3768=function(_0x40ddc0,_0x41c082){_0x40ddc0=_0x40ddc0-0x0;var _0x1aebf1=_0x7683[_0x40ddc0];return _0x1aebf1;};'use strict';var _=require('lodash');var db=require(_0x3768('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x3768('0x1')),'mail':require(_0x3768('0x2'))('mail-interactions'),'fax':require('../../config/logger')(_0x3768('0x3')),'sms':require(_0x3768('0x2'))(_0x3768('0x4')),'chat':require(_0x3768('0x2'))('chat-interactions')};function getInteractionId(_0x562fc2,_0x1a1dd5,_0x1565f2){if(_0x562fc2&&_0x562fc2[_['upperFirst'](_0x1565f2)+'InteractionId']){return _0x562fc2[_[_0x3768('0x5')](_0x1565f2)+_0x3768('0x6')];}else if(_0x562fc2&&_0x562fc2['id']){return _0x562fc2['id'];}else if(_0x1a1dd5&&_0x1a1dd5['id']){return _0x1a1dd5['id'];}else{return'unknown';}}function log(_0x85c7ab,_0x58ec61,_0x32fe02,_0x2f1d26,_0x549961,_0xb52380){loggers[_0x549961[_0x3768('0x7')]()][_0x85c7ab](_0x3768('0x8'),_0xb52380['toUpperCase'](),_0x58ec61?_0x58ec61['id']:null,_0x58ec61?_0x58ec61['name']:null,_0x58ec61?_0x58ec61[_0x3768('0x9')]:null,getInteractionId(_0x32fe02,_0x2f1d26,_0x549961),_0x32fe02?JSON['stringify'](_0x32fe02):_0x3768('0xa'));}function updateUser(_0x5d2d2f,_0x268da5,_0x5ca222,_0x179105,_0x1b0e86){db[_[_0x3768('0x5')](_0x179105)+'Interaction'][_0x3768('0xb')]({'where':{'id':getInteractionId(_0x268da5,_0x5ca222,_0x179105)}})[_0x3768('0xc')](function(_0x37b847){if(_0x37b847){return _0x37b847[_0x3768('0xd')]({'UserId':_0x5d2d2f?_0x5d2d2f['id']:null});}})['then'](function(_0x193aeb){if(_0x193aeb){log(_0x3768('0xe'),_0x5d2d2f,_0x268da5,_0x5ca222,_0x179105,_0x1b0e86);}})[_0x3768('0xf')](function(){log(_0x3768('0x10'),_0x5d2d2f,_0x268da5,_0x5ca222,_0x179105,_0x1b0e86);});}exports['tracked']=function(_0x21e82a,_0x477e65){return function(_0x45a0f6,_0x53d404,_0x975a){var _0x503948=_0x45a0f6[_0x3768('0x11')];var _0x3af139={};var _0x662e0e=_0x45a0f6['query'];if(_0x3af139){_0x3af139=_[_0x3768('0x12')](_0x45a0f6[_0x3768('0x13')]);_0x3af139=_['omit'](_0x3af139,[_0x3768('0x13'),'html',_0x3768('0x14'),_0x3768('0x15'),_0x3768('0x16')]);}updateUser(_0x503948,_0x3af139,_0x662e0e,_0x21e82a,_0x477e65);_0x975a(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index a036c72..a25380c 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd517=['aes-256-ctr','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','user','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher'];(function(_0x56ab45,_0x282dfd){var _0x5a27c5=function(_0x2a040e){while(--_0x2a040e){_0x56ab45['push'](_0x56ab45['shift']());}};_0x5a27c5(++_0x282dfd);}(_0xd517,0x151));var _0x7d51=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0xd517[_0x5caf7e];return _0x5c3435;};'use strict';var crypto=require('crypto');var util=require(_0x7d51('0x0'));var compose=require(_0x7d51('0x1'));var db=require(_0x7d51('0x2'))['db'];var config=require(_0x7d51('0x3'));function getValueFromLicense(_0x128af4,_0x504e11){if(_0x128af4&&_0x504e11){if(_0x504e11[_0x7d51('0x4')]&&_0x504e11[_0x7d51('0x5')]){var _0x4dcbc1=_0x504e11[_0x7d51('0x4')];var _0x451537=_0x504e11[_0x7d51('0x5')];var _0xef628b=_0x4dcbc1[_0x7d51('0x6')]('-')[0x4];var _0x26aa2c=_0x4dcbc1[_0x7d51('0x6')]('-')[0x0];var _0x131ee8=crypto[_0x7d51('0x7')](_0x7d51('0x8'),util['format']('%s:%s:%s',_0xef628b,_0x4dcbc1,_0x26aa2c));var _0x352d63=_0x131ee8['update'](_0x451537,_0x7d51('0x9'),_0x7d51('0xa'));_0x352d63+=_0x131ee8[_0x7d51('0xb')](_0x7d51('0xa'));var _0x20ba91=JSON[_0x7d51('0xc')](_0x352d63);return _0x20ba91[_0x7d51('0xd')](_0x128af4)?_0x20ba91[_0x128af4]:null;}}return null;}function isLimit(_0x1628b7,_0x4ff2d2,_0x38e6b8,_0x3edc71){var _0x2b4129=_0x4ff2d2;return compose()[_0x7d51('0xe')](function(_0xd3bdde,_0xa41ed0,_0x426c44){return db['License'][_0x7d51('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x7d51('0x10')](function(_0x1dc138){var _0x53b8e3=getValueFromLicense(_0x1628b7,_0x1dc138);return _0x53b8e3?_0x53b8e3:_0x2b4129;})['then'](function(_0x345328){_0x2b4129=_0x345328;return _0x38e6b8[_0x7d51('0x11')](_0x3edc71);})['then'](function(_0x5bae7e){if(_0x5bae7e>=_0x2b4129){return _0xa41ed0[_0x7d51('0x12')](0x193)[_0x7d51('0x13')]({'message':util['format'](_0x7d51('0x14'),_0x1628b7)});}_0x426c44();})[_0x7d51('0x15')](function(_0x1d1d89){_0x426c44(_0x1d1d89);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x7d51('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xdbc6=['base64','utf8','final','parse','hasOwnProperty','use','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s'];(function(_0x3ae851,_0x49bd52){var _0x279303=function(_0x3e7d04){while(--_0x3e7d04){_0x3ae851['push'](_0x3ae851['shift']());}};_0x279303(++_0x49bd52);}(_0xdbc6,0x77));var _0x6dbc=function(_0x53b3aa,_0x305b09){_0x53b3aa=_0x53b3aa-0x0;var _0x133131=_0xdbc6[_0x53b3aa];return _0x133131;};'use strict';var crypto=require(_0x6dbc('0x0'));var util=require(_0x6dbc('0x1'));var compose=require(_0x6dbc('0x2'));var db=require(_0x6dbc('0x3'))['db'];var config=require(_0x6dbc('0x4'));function getValueFromLicense(_0x1a57b0,_0x50141a){if(_0x1a57b0&&_0x50141a){if(_0x50141a[_0x6dbc('0x5')]&&_0x50141a[_0x6dbc('0x6')]){var _0x54c41f=_0x50141a[_0x6dbc('0x5')];var _0x4e24ad=_0x50141a['license'];var _0x305495=_0x54c41f[_0x6dbc('0x7')]('-')[0x4];var _0x3dd47f=_0x54c41f[_0x6dbc('0x7')]('-')[0x0];var _0x88d79b=crypto['createDecipher'](_0x6dbc('0x8'),util[_0x6dbc('0x9')](_0x6dbc('0xa'),_0x305495,_0x54c41f,_0x3dd47f));var _0x37672f=_0x88d79b['update'](_0x4e24ad,_0x6dbc('0xb'),_0x6dbc('0xc'));_0x37672f+=_0x88d79b[_0x6dbc('0xd')]('utf8');var _0x3fc77e=JSON[_0x6dbc('0xe')](_0x37672f);return _0x3fc77e[_0x6dbc('0xf')](_0x1a57b0)?_0x3fc77e[_0x1a57b0]:null;}}return null;}function isLimit(_0x40865c,_0x1d0490,_0x7a066b,_0x11a672){var _0x1dcddd=_0x1d0490;return compose()[_0x6dbc('0x10')](function(_0x34abcf,_0x36658d,_0x40da4a){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0x6dbc('0x11')](function(_0x3b5572){var _0x35ab04=getValueFromLicense(_0x40865c,_0x3b5572);return _0x35ab04?_0x35ab04:_0x1dcddd;})['then'](function(_0x5d2243){_0x1dcddd=_0x5d2243;return _0x7a066b[_0x6dbc('0x12')](_0x11a672);})[_0x6dbc('0x11')](function(_0x3f9fa2){if(_0x3f9fa2>=_0x1dcddd){return _0x36658d[_0x6dbc('0x13')](0x193)[_0x6dbc('0x14')]({'message':util[_0x6dbc('0x9')](_0x6dbc('0x15'),_0x40865c)});}_0x40da4a();})[_0x6dbc('0x16')](function(_0x41f09f){_0x40da4a(_0x41f09f);});});}function isUserLimit(){return isLimit(_0x6dbc('0x17'),0x1,db[_0x6dbc('0x18')],{'where':{'$or':[{'role':'admin'},{'role':_0x6dbc('0x19')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index a531557..8e03d4c 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 _0x42d2=['format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20IS\x20NULL)','IN\x20?','$notIn','NOT\x20IN\x20?','$eq','<>\x20?','$substring','$endsWith','LIKE\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','$in','start','$startsWith','pop','utcOffset','hours','minutes','moment','parseSearch','sqlOperator','startsWith','[$or]','[$and]','replace','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','value','includes','$gt','$lte','add','days'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x42d2,0x1e6));var _0x242d=function(_0x421725,_0x318a04){_0x421725=_0x421725-0x0;var _0x51b322=_0x42d2[_0x421725];return _0x51b322;};'use strict';var _=require('lodash');var moment=require(_0x242d('0x0'));exports[_0x242d('0x1')]=function(_0x528dbb){var _0x5cdec6={'conditions':[]};_0x5cdec6[_0x242d('0x2')]=_[_0x242d('0x3')](_0x528dbb,_0x242d('0x4'))?'or':'and';var _0xbb5dc0=_0x528dbb['replace'](_0x242d('0x5'),'')[_0x242d('0x6')]('[$or]','')[_0x242d('0x7')]('||');for(var _0x21ce21=0x0;_0x21ce21<_0xbb5dc0[_0x242d('0x8')];_0x21ce21++){var _0xb40271=_0xbb5dc0[_0x21ce21][_0x242d('0x7')](':=');var _0x1bc73a=_0xb40271[0x0];var _0x3f603f=_0xb40271[_0x242d('0x9')](0x1);_0x3f603f[_0x242d('0xa')](function(_0x4da988){var _0x1da28f=_0x4da988[_0x242d('0x7')]('[')[_0x242d('0xb')]();var _0x244b1a=_0x4da988[_0x242d('0xc')](/\[(.*?)\]/g);_0x244b1a['forEach'](function(_0x311c47){var _0x31dae4=_0x311c47[_0x242d('0x7')]('[')[_0x242d('0xd')](function(_0x5d309d){return _0x5d309d[_0x242d('0xe')](']')>-0x1;})[_0x242d('0xf')](function(_0x171d71){return _0x171d71[_0x242d('0x7')](']')[0x0];})[0x0];_0x5cdec6[_0x242d('0x10')][_0x242d('0x11')]({'field':_0x1bc73a,'operator':_0x1da28f,'value':_0x31dae4});});});}return _0x5cdec6;};exports[_0x242d('0x12')]=function(_0xd67ca5,_0x13f91c,_0x5067d5){var _0xb379eb={};if(_0x13f91c===_0x242d('0x13')){if(_0x5067d5[_0x242d('0x14')]==='$eq'){_0x5067d5['operator']='$between';_0x5067d5[_0x242d('0x15')]+=','+_0x5067d5[_0x242d('0x15')];}else if(_[_0x242d('0x16')]([_0x242d('0x17'),_0x242d('0x18')],_0x5067d5[_0x242d('0x14')])){_0x5067d5[_0x242d('0x15')]=moment(_0x5067d5['value'])[_0x242d('0x19')](0x1,_0x242d('0x1a'))[_0x242d('0x1b')](_0x242d('0x1c'));}}if(_0x5067d5[_0x242d('0x1d')]){_0x13f91c=_0x5067d5[_0x242d('0x1d')];_0xb379eb[_0x242d('0x1e')]=_0x242d('0x1f')+_0xd67ca5+'.'+_0x5067d5[_0x242d('0x20')]+_0x242d('0x21')+_0x5067d5[_0x242d('0x1d')]+')\x20'+parseOperator(_0x5067d5[_0x242d('0x14')]);}else{_0xb379eb[_0x242d('0x1e')]=_0xd67ca5+'.'+_0x5067d5['field']+'\x20'+parseOperator(_0x5067d5[_0x242d('0x14')]);}if(_[_0x242d('0x16')]([_0x242d('0x22'),'$notIn'],_0x5067d5[_0x242d('0x14')]))_0xb379eb[_0x242d('0x1e')]='('+_0xb379eb['text']+'\x20OR\x20'+_0xd67ca5+'.'+_0x5067d5[_0x242d('0x20')]+_0x242d('0x23');_0xb379eb[_0x242d('0x15')]=parseValue(_0x13f91c,_0x5067d5[_0x242d('0x14')],_0x5067d5[_0x242d('0x15')]);return _0xb379eb;};function parseOperator(_0x114cdb){var _0x15ddb5;switch(_0x114cdb){case'$in':_0x15ddb5=_0x242d('0x24');break;case _0x242d('0x25'):_0x15ddb5=_0x242d('0x26');break;case _0x242d('0x27'):_0x15ddb5='=\x20?';break;case _0x242d('0x22'):_0x15ddb5=_0x242d('0x28');break;case _0x242d('0x29'):case'$startsWith':case _0x242d('0x2a'):_0x15ddb5=_0x242d('0x2b');break;case'$lt':_0x15ddb5='<\x20?';break;case _0x242d('0x17'):_0x15ddb5=_0x242d('0x2c');break;case _0x242d('0x18'):_0x15ddb5=_0x242d('0x2d');break;case _0x242d('0x2e'):_0x15ddb5=_0x242d('0x2f');break;case _0x242d('0x30'):_0x15ddb5=_0x242d('0x31');break;}return _0x15ddb5;}function parseValue(_0x2fe41a,_0x14b8b9,_0x439510){var _0x1fa271={'start':undefined,'end':undefined};switch(_0x14b8b9){case _0x242d('0x32'):case _0x242d('0x25'):_0x1fa271['start']=_0x439510[_0x242d('0x7')](',');break;case _0x242d('0x29'):_0x1fa271[_0x242d('0x33')]='%'+_0x439510+'%';break;case _0x242d('0x34'):_0x1fa271['start']=_0x439510+'%';break;case'$endsWith':_0x1fa271[_0x242d('0x33')]='%'+_0x439510;break;case _0x242d('0x30'):var _0x5389ba=_0x439510[_0x242d('0x7')](',');var _0x439510=_0x5389ba['shift']();var _0x432269=_0x5389ba[_0x242d('0x35')]();if(_0x2fe41a==='DATE'){_0x439510=moment(_0x439510)['utcOffset'](0x0,!![])[_0x242d('0x1b')]();_0x432269=moment(_0x432269)[_0x242d('0x36')](0x0,!![])[_0x242d('0x19')](0x17,_0x242d('0x37'))[_0x242d('0x19')](0x3b,_0x242d('0x38'))[_0x242d('0x19')](0x3b,'seconds')[_0x242d('0x1b')]();}_0x1fa271={'start':_0x439510,'end':_0x432269};break;default:_0x1fa271[_0x242d('0x33')]=_0x439510;break;}return _0x1fa271;} \ No newline at end of file +var _0x920d=['startsWith','[$or]','and','[$and]','split','length','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','castTo','text','field','\x20AS\x20','$ne','\x20OR\x20','IN\x20?','$notIn','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','format','utcOffset','add','minutes','sqlOperator'];(function(_0x2a14a5,_0x3783ff){var _0x4d4da6=function(_0x19fd04){while(--_0x19fd04){_0x2a14a5['push'](_0x2a14a5['shift']());}};_0x4d4da6(++_0x3783ff);}(_0x920d,0xef));var _0xd920=function(_0x2879b8,_0x2f9ca0){_0x2879b8=_0x2879b8-0x0;var _0x30680d=_0x920d[_0x2879b8];return _0x30680d;};'use strict';var _=require('lodash');var moment=require('moment');exports['parseSearch']=function(_0x4764a8){var _0xe1fbc0={'conditions':[]};_0xe1fbc0[_0xd920('0x0')]=_[_0xd920('0x1')](_0x4764a8,_0xd920('0x2'))?'or':_0xd920('0x3');var _0x19787e=_0x4764a8['replace'](_0xd920('0x4'),'')['replace']('[$or]','')[_0xd920('0x5')]('||');for(var _0x25f471=0x0;_0x25f471<_0x19787e[_0xd920('0x6')];_0x25f471++){var _0x156cd5=_0x19787e[_0x25f471]['split'](':=');var _0x2561f2=_0x156cd5[0x0];var _0x4ee185=_0x156cd5['slice'](0x1);_0x4ee185['forEach'](function(_0x44c7ea){var _0xa89dcd=_0x44c7ea[_0xd920('0x5')]('[')['shift']();var _0xfcff2=_0x44c7ea['match'](/\[(.*?)\]/g);_0xfcff2['forEach'](function(_0xc0c2b2){var _0x1ac3de=_0xc0c2b2[_0xd920('0x5')]('[')[_0xd920('0x7')](function(_0x26a292){return _0x26a292[_0xd920('0x8')](']')>-0x1;})[_0xd920('0x9')](function(_0x3d7e30){return _0x3d7e30[_0xd920('0x5')](']')[0x0];})[0x0];_0xe1fbc0[_0xd920('0xa')][_0xd920('0xb')]({'field':_0x2561f2,'operator':_0xa89dcd,'value':_0x1ac3de});});});}return _0xe1fbc0;};exports[_0xd920('0xc')]=function(_0x1f414f,_0x81e65f,_0x18ac3f){var _0x5cde06={};if(_0x81e65f===_0xd920('0xd')){if(_0x18ac3f[_0xd920('0xe')]===_0xd920('0xf')){_0x18ac3f[_0xd920('0xe')]=_0xd920('0x10');_0x18ac3f[_0xd920('0x11')]+=','+_0x18ac3f[_0xd920('0x11')];}else if(_[_0xd920('0x12')]([_0xd920('0x13'),_0xd920('0x14')],_0x18ac3f['operator'])){_0x18ac3f[_0xd920('0x11')]=moment(_0x18ac3f[_0xd920('0x11')])['add'](0x1,'days')['format']('YYYY-MM-DD');}}if(_0x18ac3f[_0xd920('0x15')]){_0x81e65f=_0x18ac3f['castTo'];_0x5cde06[_0xd920('0x16')]='CAST('+_0x1f414f+'.'+_0x18ac3f[_0xd920('0x17')]+_0xd920('0x18')+_0x18ac3f[_0xd920('0x15')]+')\x20'+parseOperator(_0x18ac3f[_0xd920('0xe')]);}else{_0x5cde06['text']=_0x1f414f+'.'+_0x18ac3f[_0xd920('0x17')]+'\x20'+parseOperator(_0x18ac3f[_0xd920('0xe')]);}if(_['includes']([_0xd920('0x19'),'$notIn'],_0x18ac3f[_0xd920('0xe')]))_0x5cde06[_0xd920('0x16')]='('+_0x5cde06[_0xd920('0x16')]+_0xd920('0x1a')+_0x1f414f+'.'+_0x18ac3f['field']+'\x20IS\x20NULL)';_0x5cde06[_0xd920('0x11')]=parseValue(_0x81e65f,_0x18ac3f[_0xd920('0xe')],_0x18ac3f['value']);return _0x5cde06;};function parseOperator(_0x35a118){var _0x14283f;switch(_0x35a118){case'$in':_0x14283f=_0xd920('0x1b');break;case _0xd920('0x1c'):_0x14283f=_0xd920('0x1d');break;case _0xd920('0xf'):_0x14283f='=\x20?';break;case'$ne':_0x14283f=_0xd920('0x1e');break;case _0xd920('0x1f'):case _0xd920('0x20'):case _0xd920('0x21'):_0x14283f=_0xd920('0x22');break;case _0xd920('0x23'):_0x14283f=_0xd920('0x24');break;case'$gt':_0x14283f=_0xd920('0x25');break;case'$lte':_0x14283f=_0xd920('0x26');break;case _0xd920('0x27'):_0x14283f=_0xd920('0x28');break;case'$between':_0x14283f=_0xd920('0x29');break;}return _0x14283f;}function parseValue(_0x28a88d,_0x29f2d5,_0x45ec0f){var _0x30e588={'start':undefined,'end':undefined};switch(_0x29f2d5){case _0xd920('0x2a'):case _0xd920('0x1c'):_0x30e588['start']=_0x45ec0f[_0xd920('0x5')](',');break;case _0xd920('0x1f'):_0x30e588[_0xd920('0x2b')]='%'+_0x45ec0f+'%';break;case _0xd920('0x20'):_0x30e588[_0xd920('0x2b')]=_0x45ec0f+'%';break;case _0xd920('0x21'):_0x30e588[_0xd920('0x2b')]='%'+_0x45ec0f;break;case'$between':var _0xcff2ec=_0x45ec0f[_0xd920('0x5')](',');var _0x45ec0f=_0xcff2ec['shift']();var _0x215d78=_0xcff2ec['pop']();if(_0x28a88d===_0xd920('0xd')){_0x45ec0f=moment(_0x45ec0f)['utcOffset'](0x0,!![])[_0xd920('0x2c')]();_0x215d78=moment(_0x215d78)[_0xd920('0x2d')](0x0,!![])['add'](0x17,'hours')[_0xd920('0x2e')](0x3b,_0xd920('0x2f'))['add'](0x3b,'seconds')[_0xd920('0x2c')]();}_0x30e588={'start':_0x45ec0f,'end':_0x215d78};break;default:_0x30e588[_0xd920('0x2b')]=_0x45ec0f;break;}return _0x30e588;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index d1539b2..51c63da 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 _0x03b6=['match','isEmail','getFullTextValue','forEach','push','join','lodash','sequelize','isEmpty','forOwn','isArray','parse','split','sort','map','indexOf','priority','unsigned','substr','cast','length','omit','isObject','isString','hasOwnProperty','isNumeric'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0x03b6,0xbc));var _0x603b=function(_0xe5ee84,_0x273a20){_0xe5ee84=_0xe5ee84-0x0;var _0x1784c3=_0x03b6[_0xe5ee84];return _0x1784c3;};'use strict';var _=require(_0x603b('0x0'));var sequelize=require(_0x603b('0x1'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x1c16ee){var _0x3a0d20=null;if(_0x1c16ee){_0x3a0d20=_0x1c16ee['split'](',');}return _0x3a0d20;};exports['filters']=function(_0x2f19fc){var _0x5d2ecf={};if(!_[_0x603b('0x2')](_0x2f19fc)){_0x5d2ecf={};_[_0x603b('0x3')](_0x2f19fc,function(_0x514d7c,_0x314566){try{_0x5d2ecf[_0x314566]=_[_0x603b('0x4')](_0x514d7c)?_0x514d7c:JSON[_0x603b('0x5')](_0x514d7c);}catch(_0x53e9f3){_0x5d2ecf[_0x314566]=_0x514d7c[_0x603b('0x6')](',');}});}return _0x5d2ecf;};exports['limit']=function(_0x5acd63){_0x5acd63=parseInt(_0x5acd63,0xa);if(!_0x5acd63||_0x5acd63<0x0){_0x5acd63=LIMIT_VALUE;}return _0x5acd63;};exports['offset']=function(_0x2ceba5){_0x2ceba5=parseInt(_0x2ceba5,0xa);if(!_0x2ceba5||_0x2ceba5<0x0){_0x2ceba5=0x0;}return _0x2ceba5;};exports[_0x603b('0x7')]=function(_0x606e45){var _0x2efb02,_0x2a209b=null;if(_0x606e45){_0x2efb02=_0x606e45['split'](',');_0x2a209b=_[_0x603b('0x8')](_0x2efb02,function(_0x4caedf){if(_0x4caedf[_0x603b('0x9')]('-')===0x0){return[_0x4caedf==='priority'?sequelize['cast'](sequelize['col'](_0x603b('0xa')),_0x603b('0xb')):_0x4caedf[_0x603b('0xc')](0x1),'DESC'];}else{return[_0x4caedf===_0x603b('0xa')?sequelize[_0x603b('0xd')](sequelize['col']('priority'),_0x603b('0xb')):_0x4caedf,'ASC'];}});}return _0x2a209b;};exports['omit']=function(_0x5b4563,_0x2fd3ba){if(_[_0x603b('0x2')](_0x5b4563)){return _0x5b4563;}if(_[_0x603b('0x4')](_0x5b4563)){for(var _0x2dad46=0x0;_0x2dad46<_0x5b4563[_0x603b('0xe')];_0x2dad46+=0x1){_0x5b4563[_0x2dad46]=this[_0x603b('0xf')](_0x5b4563[_0x2dad46],_0x2fd3ba);}return _0x5b4563;}if(!_[_0x603b('0x10')](_0x5b4563)){return _0x5b4563;}if(_[_0x603b('0x11')](_0x2fd3ba)){_0x2fd3ba=[_0x2fd3ba];}if(!_['isArray'](_0x2fd3ba)){return _0x5b4563;}for(var _0x13f0cc=0x0;_0x13f0cc<_0x2fd3ba[_0x603b('0xe')];_0x13f0cc+=0x1){_['unset'](_0x5b4563,_0x2fd3ba[_0x13f0cc]);}for(var _0x58f2d4 in _0x5b4563){if(_0x5b4563[_0x603b('0x12')](_0x58f2d4)){_0x5b4563[_0x58f2d4]=this[_0x603b('0xf')](_0x5b4563[_0x58f2d4],_0x2fd3ba);}}return _0x5b4563;};exports[_0x603b('0x13')]=function(_0x353d90){return _0x353d90[_0x603b('0x14')](RegExp('^[0-9]*$'))?!![]:![];};exports[_0x603b('0x15')]=function(_0x468cd4){return _0x468cd4[_0x603b('0x14')](/^\S+@\S+$/)?!![]:![];};exports[_0x603b('0x16')]=function(_0x342022){var _0x139a70=[];_0x342022['split']('\x20')[_0x603b('0x17')](function(_0x169d09){_0x139a70[_0x603b('0x18')]('+'+_0x169d09['toString']()+'*');});return _0x139a70[_0x603b('0x19')]('\x20');}; \ No newline at end of file +var _0x6c9c=['map','indexOf','cast','col','priority','unsigned','omit','length','isObject','isString','unset','isNumeric','match','isEmail','getFullTextValue','forEach','push','toString','join','lodash','sequelize','fields','split','filters','isEmpty','forOwn','isArray','limit','offset','sort'];(function(_0xe742b6,_0x220f38){var _0x3cb710=function(_0x43e3e5){while(--_0x43e3e5){_0xe742b6['push'](_0xe742b6['shift']());}};_0x3cb710(++_0x220f38);}(_0x6c9c,0x15d));var _0xc6c9=function(_0x2ff5cb,_0x56db52){_0x2ff5cb=_0x2ff5cb-0x0;var _0x10b534=_0x6c9c[_0x2ff5cb];return _0x10b534;};'use strict';var _=require(_0xc6c9('0x0'));var sequelize=require(_0xc6c9('0x1'));var LIMIT_VALUE=0xfa;exports[_0xc6c9('0x2')]=function(_0x56345e){var _0x4fa398=null;if(_0x56345e){_0x4fa398=_0x56345e[_0xc6c9('0x3')](',');}return _0x4fa398;};exports[_0xc6c9('0x4')]=function(_0x38be3f){var _0x4e5e2b={};if(!_[_0xc6c9('0x5')](_0x38be3f)){_0x4e5e2b={};_[_0xc6c9('0x6')](_0x38be3f,function(_0x3f2ba7,_0x570378){try{_0x4e5e2b[_0x570378]=_[_0xc6c9('0x7')](_0x3f2ba7)?_0x3f2ba7:JSON['parse'](_0x3f2ba7);}catch(_0x991141){_0x4e5e2b[_0x570378]=_0x3f2ba7[_0xc6c9('0x3')](',');}});}return _0x4e5e2b;};exports[_0xc6c9('0x8')]=function(_0x55b014){_0x55b014=parseInt(_0x55b014,0xa);if(!_0x55b014||_0x55b014<0x0){_0x55b014=LIMIT_VALUE;}return _0x55b014;};exports[_0xc6c9('0x9')]=function(_0x28f645){_0x28f645=parseInt(_0x28f645,0xa);if(!_0x28f645||_0x28f645<0x0){_0x28f645=0x0;}return _0x28f645;};exports[_0xc6c9('0xa')]=function(_0x2263c0){var _0x2dd049,_0x257d9f=null;if(_0x2263c0){_0x2dd049=_0x2263c0[_0xc6c9('0x3')](',');_0x257d9f=_[_0xc6c9('0xb')](_0x2dd049,function(_0x8aa6b1){if(_0x8aa6b1[_0xc6c9('0xc')]('-')===0x0){return[_0x8aa6b1==='priority'?sequelize[_0xc6c9('0xd')](sequelize[_0xc6c9('0xe')](_0xc6c9('0xf')),'unsigned'):_0x8aa6b1['substr'](0x1),'DESC'];}else{return[_0x8aa6b1===_0xc6c9('0xf')?sequelize[_0xc6c9('0xd')](sequelize[_0xc6c9('0xe')](_0xc6c9('0xf')),_0xc6c9('0x10')):_0x8aa6b1,'ASC'];}});}return _0x257d9f;};exports[_0xc6c9('0x11')]=function(_0xff6126,_0x1af43e){if(_[_0xc6c9('0x5')](_0xff6126)){return _0xff6126;}if(_[_0xc6c9('0x7')](_0xff6126)){for(var _0x42a2df=0x0;_0x42a2df<_0xff6126[_0xc6c9('0x12')];_0x42a2df+=0x1){_0xff6126[_0x42a2df]=this[_0xc6c9('0x11')](_0xff6126[_0x42a2df],_0x1af43e);}return _0xff6126;}if(!_[_0xc6c9('0x13')](_0xff6126)){return _0xff6126;}if(_[_0xc6c9('0x14')](_0x1af43e)){_0x1af43e=[_0x1af43e];}if(!_['isArray'](_0x1af43e)){return _0xff6126;}for(var _0x541422=0x0;_0x541422<_0x1af43e['length'];_0x541422+=0x1){_[_0xc6c9('0x15')](_0xff6126,_0x1af43e[_0x541422]);}for(var _0x33a888 in _0xff6126){if(_0xff6126['hasOwnProperty'](_0x33a888)){_0xff6126[_0x33a888]=this[_0xc6c9('0x11')](_0xff6126[_0x33a888],_0x1af43e);}}return _0xff6126;};exports[_0xc6c9('0x16')]=function(_0x4d51f3){return _0x4d51f3[_0xc6c9('0x17')](RegExp('^[0-9]*$'))?!![]:![];};exports[_0xc6c9('0x18')]=function(_0x2c62fa){return _0x2c62fa[_0xc6c9('0x17')](/^\S+@\S+$/)?!![]:![];};exports[_0xc6c9('0x19')]=function(_0x2a45c7){var _0x428739=[];_0x2a45c7[_0xc6c9('0x3')]('\x20')[_0xc6c9('0x1a')](function(_0x34618f){_0x428739[_0xc6c9('0x1b')]('+'+_0x34618f[_0xc6c9('0x1c')]()+'*');});return _0x428739[_0xc6c9('0x1d')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 10dd49e..1a666fc 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d30=['initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','env','production','set','join','root','use','json\x20replacer','toISOString','static','appPath','/server/views','html','view\x20engine','urlencoded','50mb'];(function(_0x1b5f43,_0x102bd1){var _0x42e44c=function(_0xb8f6b2){while(--_0xb8f6b2){_0x1b5f43['push'](_0x1b5f43['shift']());}};_0x42e44c(++_0x102bd1);}(_0x9d30,0x97));var _0x09d3=function(_0x2e6a3d,_0x4be0e2){_0x2e6a3d=_0x2e6a3d-0x0;var _0x32ed1a=_0x9d30[_0x2e6a3d];return _0x32ed1a;};'use strict';var express=require(_0x09d3('0x0'));var favicon=require(_0x09d3('0x1'));var bodyParser=require(_0x09d3('0x2'));var methodOverride=require(_0x09d3('0x3'));var cookieParser=require(_0x09d3('0x4'));var errorHandler=require(_0x09d3('0x5'));var path=require(_0x09d3('0x6'));var passport=require(_0x09d3('0x7'));var cors=require(_0x09d3('0x8'));var moment=require(_0x09d3('0x9'));var config=require(_0x09d3('0xa'));var db=require(_0x09d3('0xb'))['db'];exports[_0x09d3('0xc')]=function(_0x14a030){var _0xc7c5ab=_0x14a030[_0x09d3('0xd')](_0x09d3('0xe'));if(_0xc7c5ab===_0x09d3('0xf')){_0x14a030[_0x09d3('0x10')]('appPath',path[_0x09d3('0x11')](config[_0x09d3('0x12')],'public'));}if(_0xc7c5ab==='development'||_0xc7c5ab==='test'){_0x14a030[_0x09d3('0x10')]('appPath',path['join'](config[_0x09d3('0x12')],'client'));_0x14a030[_0x09d3('0x13')](errorHandler());}_0x14a030[_0x09d3('0x10')](_0x09d3('0x14'),function(_0x4d51ca,_0x425416){if(this[_0x4d51ca]instanceof Date){_0x425416=this[_0x4d51ca][_0x09d3('0x15')]()['split']('.')[0x0]+'Z';}return _0x425416;});_0x14a030['use'](express[_0x09d3('0x16')](_0x14a030['get'](_0x09d3('0x17'))));_0x14a030[_0x09d3('0x10')]('views',config['root']+_0x09d3('0x18'));_0x14a030['engine'](_0x09d3('0x19'),require('ejs')['renderFile']);_0x14a030['set'](_0x09d3('0x1a'),'html');_0x14a030[_0x09d3('0x13')](bodyParser[_0x09d3('0x1b')]({'limit':_0x09d3('0x1c'),'extended':!![]}));_0x14a030[_0x09d3('0x13')](bodyParser['json']({'limit':_0x09d3('0x1c')}));_0x14a030[_0x09d3('0x13')](cors());_0x14a030[_0x09d3('0x13')](methodOverride());_0x14a030[_0x09d3('0x13')](cookieParser());_0x14a030['use'](passport[_0x09d3('0x1d')]());}; \ No newline at end of file +var _0xa3ed=['html','urlencoded','50mb','json','initialize','body-parser','cookie-parser','path','passport','cors','moment','./environment','default','get','production','join','root','test','set','appPath','use','json\x20replacer','toISOString','split','views','/server/views','view\x20engine'];(function(_0xad51da,_0x18b900){var _0x2f1ac7=function(_0x398569){while(--_0x398569){_0xad51da['push'](_0xad51da['shift']());}};_0x2f1ac7(++_0x18b900);}(_0xa3ed,0x164));var _0xda3e=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xa3ed[_0x4b055c];return _0x4b62bb;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0xda3e('0x0'));var methodOverride=require('method-override');var cookieParser=require(_0xda3e('0x1'));var errorHandler=require('errorhandler');var path=require(_0xda3e('0x2'));var passport=require(_0xda3e('0x3'));var cors=require(_0xda3e('0x4'));var moment=require(_0xda3e('0x5'));var config=require(_0xda3e('0x6'));var db=require('../mysqldb')['db'];exports[_0xda3e('0x7')]=function(_0x3b7a52){var _0x12b6cc=_0x3b7a52[_0xda3e('0x8')]('env');if(_0x12b6cc===_0xda3e('0x9')){_0x3b7a52['set']('appPath',path[_0xda3e('0xa')](config[_0xda3e('0xb')],'public'));}if(_0x12b6cc==='development'||_0x12b6cc===_0xda3e('0xc')){_0x3b7a52[_0xda3e('0xd')](_0xda3e('0xe'),path[_0xda3e('0xa')](config[_0xda3e('0xb')],'client'));_0x3b7a52[_0xda3e('0xf')](errorHandler());}_0x3b7a52[_0xda3e('0xd')](_0xda3e('0x10'),function(_0x27db06,_0x224ed9){if(this[_0x27db06]instanceof Date){_0x224ed9=this[_0x27db06][_0xda3e('0x11')]()[_0xda3e('0x12')]('.')[0x0]+'Z';}return _0x224ed9;});_0x3b7a52['use'](express['static'](_0x3b7a52[_0xda3e('0x8')](_0xda3e('0xe'))));_0x3b7a52[_0xda3e('0xd')](_0xda3e('0x13'),config[_0xda3e('0xb')]+_0xda3e('0x14'));_0x3b7a52['engine']('html',require('ejs')['renderFile']);_0x3b7a52[_0xda3e('0xd')](_0xda3e('0x15'),_0xda3e('0x16'));_0x3b7a52[_0xda3e('0xf')](bodyParser[_0xda3e('0x17')]({'limit':_0xda3e('0x18'),'extended':!![]}));_0x3b7a52['use'](bodyParser[_0xda3e('0x19')]({'limit':_0xda3e('0x18')}));_0x3b7a52[_0xda3e('0xf')](cors());_0x3b7a52[_0xda3e('0xf')](methodOverride());_0x3b7a52[_0xda3e('0xf')](cookieParser());_0x3b7a52[_0xda3e('0xf')](passport[_0xda3e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 88be816..805fc1d 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 _0xcb66=['orderBy','keys','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','cpus','map','model','createHash','md5','digest','hex','platform','win32','hostname','macAddress','ipAddress','update','substring','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces'];(function(_0x174771,_0x574d7d){var _0x2e9cfa=function(_0x23310a){while(--_0x23310a){_0x174771['push'](_0x174771['shift']());}};_0x2e9cfa(++_0x574d7d);}(_0xcb66,0x19f));var _0x6cb6=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0xcb66[_0x20b29c];return _0x20d81b;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x6cb6('0x0'));var machine=require(_0x6cb6('0x1'));var exec=require(_0x6cb6('0x2'))[_0x6cb6('0x3')];function getInterfaces(){var _0x205243=[];var _0x56618a=os[_0x6cb6('0x4')]();var _0x2d7dbb=_[_0x6cb6('0x5')](_[_0x6cb6('0x6')](_0x56618a));for(var _0x16bb9d=0x0;_0x16bb9d<_0x2d7dbb['length'];_0x16bb9d++){var _0x53078d=_0x56618a[_0x2d7dbb[_0x16bb9d]][_0x6cb6('0x7')](function(_0x1595c9){return _0x1595c9[_0x6cb6('0x8')]===_0x6cb6('0x9')&&_0x1595c9[_0x6cb6('0xa')]===![];});_0x205243=_0x205243[_0x6cb6('0xb')](_0x53078d);}return _0x205243;}function getFirstInterface(){var _0x3a5927=_[_0x6cb6('0xc')](getInterfaces());return{'macAddress':_0x3a5927&&_0x3a5927[_0x6cb6('0xd')]?_0x3a5927[_0x6cb6('0xd')]:_0x6cb6('0xe'),'ipAddress':_0x3a5927&&_0x3a5927[_0x6cb6('0xf')]?_0x3a5927[_0x6cb6('0xf')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x576aea=_['orderBy'](os[_0x6cb6('0x10')]()[_0x6cb6('0x11')](function(_0xad49d9){return _0xad49d9[_0x6cb6('0x12')];}))['join'](':');return crypto[_0x6cb6('0x13')](_0x6cb6('0x14'))['update'](_0x576aea)[_0x6cb6('0x15')](_0x6cb6('0x16'));}exports['getUuid']=function(){switch(os[_0x6cb6('0x17')]()){case _0x6cb6('0x18'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})['replace']('\x0d\x0a','');default:var _0x5dd4cd=getFirstInterface();var _0x380edc=getCPUhash();var _0x298daa=_0x380edc+'|'+os[_0x6cb6('0x19')]()+'|'+_0x5dd4cd[_0x6cb6('0x1a')]+'|'+_0x5dd4cd[_0x6cb6('0x1b')];var _0x40d445=crypto['createHash'](_0x6cb6('0x14'))[_0x6cb6('0x1c')](_0x298daa)['digest']('hex');return _0x40d445['substring'](0x0,0x8)+'-'+_0x40d445['substring'](0x8,0xc)+'-'+_0x40d445['substring'](0xc,0x10)+'-'+_0x40d445['substring'](0x10,0x14)+'-'+_0x40d445[_0x6cb6('0x1d')](0x14);}}; \ No newline at end of file +var _0x7c09=['hex','getUuid','platform','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','digest','substring','crypto','bimedia-machine-uuid','execSync','networkInterfaces','orderBy','keys','filter','family','IPv4','internal','mac','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update'];(function(_0x6f5f8b,_0x1631cc){var _0x178d58=function(_0x20c35a){while(--_0x20c35a){_0x6f5f8b['push'](_0x6f5f8b['shift']());}};_0x178d58(++_0x1631cc);}(_0x7c09,0x102));var _0x97c0=function(_0x236ef5,_0xf3480d){_0x236ef5=_0x236ef5-0x0;var _0x3694cd=_0x7c09[_0x236ef5];return _0x3694cd;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x97c0('0x0'));var machine=require(_0x97c0('0x1'));var exec=require('child_process')[_0x97c0('0x2')];function getInterfaces(){var _0x7d8f6f=[];var _0x2d04b9=os[_0x97c0('0x3')]();var _0x12eb6d=_[_0x97c0('0x4')](_[_0x97c0('0x5')](_0x2d04b9));for(var _0x4a7788=0x0;_0x4a7788<_0x12eb6d['length'];_0x4a7788++){var _0x590368=_0x2d04b9[_0x12eb6d[_0x4a7788]][_0x97c0('0x6')](function(_0x42c6c7){return _0x42c6c7[_0x97c0('0x7')]===_0x97c0('0x8')&&_0x42c6c7[_0x97c0('0x9')]===![];});_0x7d8f6f=_0x7d8f6f['concat'](_0x590368);}return _0x7d8f6f;}function getFirstInterface(){var _0x205520=_['head'](getInterfaces());return{'macAddress':_0x205520&&_0x205520[_0x97c0('0xa')]?_0x205520[_0x97c0('0xa')]:'00:00:00:00:00:00','ipAddress':_0x205520&&_0x205520['address']?_0x205520[_0x97c0('0xb')]:_0x97c0('0xc')};}exports[_0x97c0('0xd')]=getFirstInterface;function getCPUhash(){var _0x238ed9=_[_0x97c0('0x4')](os[_0x97c0('0xe')]()[_0x97c0('0xf')](function(_0x39a3b4){return _0x39a3b4[_0x97c0('0x10')];}))[_0x97c0('0x11')](':');return crypto[_0x97c0('0x12')](_0x97c0('0x13'))[_0x97c0('0x14')](_0x238ed9)['digest'](_0x97c0('0x15'));}exports[_0x97c0('0x16')]=function(){switch(os[_0x97c0('0x17')]()){case'win32':return exec(_0x97c0('0x18'),{'encoding':_0x97c0('0x19')})[_0x97c0('0x1a')]('\x0d\x0a','');default:var _0x21e5f7=getFirstInterface();var _0x482be5=getCPUhash();var _0x13d46e=_0x482be5+'|'+os['hostname']()+'|'+_0x21e5f7[_0x97c0('0x1b')]+'|'+_0x21e5f7[_0x97c0('0x1c')];var _0x51180e=crypto[_0x97c0('0x12')](_0x97c0('0x13'))[_0x97c0('0x14')](_0x13d46e)[_0x97c0('0x1d')](_0x97c0('0x15'));return _0x51180e[_0x97c0('0x1e')](0x0,0x8)+'-'+_0x51180e[_0x97c0('0x1e')](0x8,0xc)+'-'+_0x51180e[_0x97c0('0x1e')](0xc,0x10)+'-'+_0x51180e[_0x97c0('0x1e')](0x10,0x14)+'-'+_0x51180e[_0x97c0('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index aa220c8..3f1e313 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 _0x82d8=['ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','data1','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','diff','days','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','findOrCreate','spread','default','util','moment','pkginfo','../../mysqldb','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','version','GET','catch','createCipher','aes-256-ctr','update','utf8','base64','final','createDecipher','secrets','session','||FIELD||VALUE||\x0a','User','admin','fullname','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','then'];(function(_0x11f2f3,_0x2edb98){var _0x10b7d8=function(_0x47f578){while(--_0x47f578){_0x11f2f3['push'](_0x11f2f3['shift']());}};_0x10b7d8(++_0x2edb98);}(_0x82d8,0xff));var _0x882d=function(_0x531579,_0x447482){_0x531579=_0x531579-0x0;var _0x282e43=_0x82d8[_0x531579];return _0x282e43;};'use strict';var util=require(_0x882d('0x0'));var crypto=require('crypto');var moment=require(_0x882d('0x1'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0x882d('0x2'))(module,'version');var db=require(_0x882d('0x3'))['db'];var config=require('../environment');var hardware=require('./hardware');var logger=require(_0x882d('0x4'))(_0x882d('0x5'));var jira=require(_0x882d('0x6'));var HOST=_0x882d('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0xb7539b){return new BPromise(function(_0x3c8b67,_0x4067a9){var _0x4ea710=util[_0x882d('0x8')](_0x882d('0x9'),HOST,_0xb7539b,module[_0x882d('0xa')]['version']);if(oldToken){_0x4ea710=util[_0x882d('0x8')](_0x882d('0xb'),HOST,_0xb7539b,module['exports'][_0x882d('0xc')],oldToken);}var _0xa2ca7f={'uri':_0x4ea710,'method':_0x882d('0xd'),'timeout':0xea60,'json':!![]};return rp(_0xa2ca7f)['then'](function(_0x287672){_0x3c8b67(_0x287672);})[_0x882d('0xe')](function(_0x18ce3e){_0x4067a9(_0x18ce3e);});});}function encryptDate(_0x3fffe0){var _0x3bd4d9=crypto[_0x882d('0xf')](_0x882d('0x10'),config['secrets']['session']);var _0x2a7091=_0x3bd4d9[_0x882d('0x11')](_0x3fffe0,_0x882d('0x12'),_0x882d('0x13'));_0x2a7091+=_0x3bd4d9[_0x882d('0x14')]('base64');return _0x2a7091;}function decryptDate(_0x3ce2b0){var _0x2d88e5=crypto[_0x882d('0x15')](_0x882d('0x10'),config[_0x882d('0x16')][_0x882d('0x17')]);var _0x46cfcc=_0x2d88e5[_0x882d('0x11')](_0x3ce2b0,_0x882d('0x13'),'utf8');_0x46cfcc+=_0x2d88e5['final'](_0x882d('0x12'));return _0x46cfcc;}function sendJiraAlert(_0x59aaec,_0x3e4cf5,_0x47d6a0){var _0x36ecd0=_0x882d('0x18');return db[_0x882d('0x19')]['findOne']({'where':{'role':_0x882d('0x1a')},'attributes':[_0x882d('0x1b'),_0x882d('0x1c')],'raw':!![]})['then'](function(_0x3420cd){ADMIN=_0x3420cd;_0x36ecd0+=_0x882d('0x1d')+_0x47d6a0+'|\x0a';_0x36ecd0+=_0x882d('0x1e')+_0x59aaec+'|\x0a';_0x36ecd0+=_0x882d('0x1f')+_0x3e4cf5+'|\x0a';_0x36ecd0+=_0x882d('0x20')+ADMIN[_0x882d('0x1b')]+'|\x0a';_0x36ecd0+=_0x882d('0x21')+ADMIN[_0x882d('0x1c')]+'|\x0a';return _0x36ecd0;})[_0x882d('0x22')](function(_0x57f1d4){var _0x37e6fa=hardware['getFirstInterface']()[_0x882d('0x23')];return jira[_0x882d('0x24')]({'key':_0x882d('0x25'),'summary':_0x882d('0x26'),'description':_0x57f1d4,'issuetype':_0x882d('0x27'),'oldToken':_0x59aaec,'newToken':_0x3e4cf5,'email':ADMIN['email'],'name':ADMIN[_0x882d('0x1b')],'reason':GRAY_PERIOD_REASON,'ip':_0x37e6fa});});}function manageLicense(_0x58ddb2,_0xb49a3c){var _0x3cb1e2=_0xb49a3c['get']({'plain':!![]});httpRequest(_0x58ddb2)['then'](function(_0x508003){if(oldToken){oldToken=undefined;}if(_0x508003['active']){if(!_0x3cb1e2[_0x882d('0x5')]&&_0x3cb1e2[_0x882d('0x5')]!=_0x508003[_0x882d('0x5')]||_0x3cb1e2[_0x882d('0x5')]&&_0x3cb1e2['data2']){logger[_0x882d('0x28')](_0x882d('0x29'));}if(_0x3cb1e2[_0x882d('0x5')]&&!_0x3cb1e2[_0x882d('0x2a')]&&_0x3cb1e2[_0x882d('0x5')]!=_0x508003['license']){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3cb1e2[_0x882d('0x5')]&&!_0x3cb1e2[_0x882d('0x2a')]&&_0x3cb1e2[_0x882d('0x5')]==_0x508003['license']){return _0xb49a3c;}return _0xb49a3c[_0x882d('0x11')]({'data1':_0x58ddb2,'data2':null,'license':_0x508003[_0x882d('0x5')]});}else{if(_0x508003[_0x882d('0x5')]||_0x3cb1e2[_0x882d('0x5')]){if(!_0x3cb1e2[_0x882d('0x2a')]){if(_0x3cb1e2[_0x882d('0x2b')]==_0x58ddb2){GRAY_PERIOD_REASON='Disabled';logger[_0x882d('0x28')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x882d('0x2c');oldToken=_0x3cb1e2['data1'];logger[_0x882d('0x28')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3cb1e2[_0x882d('0x2b')],_0x58ddb2);}sendJiraAlert(_0x3cb1e2[_0x882d('0x2b')],_0x508003[_0x882d('0x2d')],GRAY_PERIOD_REASON);logger[_0x882d('0x28')](_0x882d('0x2e'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x882d('0x8')]('YYYY-MM-DD\x20HH:mm'));return _0xb49a3c[_0x882d('0x11')]({'data2':encryptDate(moment()[_0x882d('0x8')](_0x882d('0x2f')))});}else{if(moment()[_0x882d('0x30')](decryptDate(_0x3cb1e2[_0x882d('0x2a')]),_0x882d('0x31'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x882d('0x2f')));return _0xb49a3c[_0x882d('0x11')]({'data1':_0x58ddb2,'data2':null,'license':null});}}}else{if(_0x3cb1e2[_0x882d('0x2b')]!=_0x58ddb2){logger[_0x882d('0x28')](_0x882d('0x32'),_0x3cb1e2['data1'],_0x58ddb2);return _0xb49a3c[_0x882d('0x11')]({'data1':_0x58ddb2,'data2':null,'license':null});}}}return _0xb49a3c;})[_0x882d('0x22')](function(_0xc412ec){_0xb49a3c=_0xc412ec;})[_0x882d('0xe')](function(_0x335dc0){logger[_0x882d('0x33')](_0x335dc0[_0x882d('0x34')]);})[_0x882d('0x35')](function(){setTimeout(function(){manageLicense(hardware[_0x882d('0x36')](),_0xb49a3c);},TIME);});}function defaultLicense(){var _0x56b3fa=hardware['getUuid']();if(_0x56b3fa){return db['License'][_0x882d('0x37')]({'where':{'id':0x1},'defaults':{'data1':_0x56b3fa}})[_0x882d('0x38')](function(_0x1aec6f,_0x6d04f){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x56b3fa);manageLicense(_0x56b3fa,_0x1aec6f);})[_0x882d('0xe')](function(_0x21dd0e){logger[_0x882d('0x33')](_0x21dd0e['message']);});}}exports[_0x882d('0x39')]=defaultLicense; \ No newline at end of file +var _0x4849=['THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','DEMO\x20START\x20AT\x20%s','message','getUuid','findOrCreate','spread','util','crypto','moment','pkginfo','version','../../mysqldb','../environment','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','secrets','session','update','utf8','base64','aes-256-ctr','final','User','findOne','fullname','|reason|','|uuid|','|machineUuid|','|name|','email','getFirstInterface','ipAddress','openIssue','Motion\x20License\x20Alert','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data1','Disabled'];(function(_0x283b5f,_0x335c12){var _0x15f4be=function(_0x3ab42a){while(--_0x3ab42a){_0x283b5f['push'](_0x283b5f['shift']());}};_0x15f4be(++_0x335c12);}(_0x4849,0xf8));var _0x9484=function(_0x2ed80a,_0x4b9583){_0x2ed80a=_0x2ed80a-0x0;var _0x214584=_0x4849[_0x2ed80a];return _0x214584;};'use strict';var util=require(_0x9484('0x0'));var crypto=require(_0x9484('0x1'));var moment=require(_0x9484('0x2'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0x9484('0x3'))(module,_0x9484('0x4'));var db=require(_0x9484('0x5'))['db'];var config=require(_0x9484('0x6'));var hardware=require(_0x9484('0x7'));var logger=require(_0x9484('0x8'))(_0x9484('0x9'));var jira=require(_0x9484('0xa'));var HOST=_0x9484('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x536b43){return new BPromise(function(_0x4a8a70,_0x11f2a1){var _0x583079=util[_0x9484('0xc')](_0x9484('0xd'),HOST,_0x536b43,module[_0x9484('0xe')][_0x9484('0x4')]);if(oldToken){_0x583079=util[_0x9484('0xc')](_0x9484('0xf'),HOST,_0x536b43,module[_0x9484('0xe')][_0x9484('0x4')],oldToken);}var _0x3cb258={'uri':_0x583079,'method':_0x9484('0x10'),'timeout':0xea60,'json':!![]};return rp(_0x3cb258)[_0x9484('0x11')](function(_0x44668c){_0x4a8a70(_0x44668c);})[_0x9484('0x12')](function(_0x241895){_0x11f2a1(_0x241895);});});}function encryptDate(_0x3273a8){var _0x5d4092=crypto[_0x9484('0x13')]('aes-256-ctr',config[_0x9484('0x14')][_0x9484('0x15')]);var _0x347b26=_0x5d4092[_0x9484('0x16')](_0x3273a8,_0x9484('0x17'),_0x9484('0x18'));_0x347b26+=_0x5d4092['final'](_0x9484('0x18'));return _0x347b26;}function decryptDate(_0x4485f9){var _0x537fe2=crypto['createDecipher'](_0x9484('0x19'),config['secrets'][_0x9484('0x15')]);var _0x4e974f=_0x537fe2[_0x9484('0x16')](_0x4485f9,_0x9484('0x18'),_0x9484('0x17'));_0x4e974f+=_0x537fe2[_0x9484('0x1a')](_0x9484('0x17'));return _0x4e974f;}function sendJiraAlert(_0x232694,_0x4b900f,_0x28069a){var _0x16848d='||FIELD||VALUE||\x0a';return db[_0x9484('0x1b')][_0x9484('0x1c')]({'where':{'role':'admin'},'attributes':[_0x9484('0x1d'),'email'],'raw':!![]})[_0x9484('0x11')](function(_0x5969e7){ADMIN=_0x5969e7;_0x16848d+=_0x9484('0x1e')+_0x28069a+'|\x0a';_0x16848d+=_0x9484('0x1f')+_0x232694+'|\x0a';_0x16848d+=_0x9484('0x20')+_0x4b900f+'|\x0a';_0x16848d+=_0x9484('0x21')+ADMIN['fullname']+'|\x0a';_0x16848d+='|email|'+ADMIN[_0x9484('0x22')]+'|\x0a';return _0x16848d;})['then'](function(_0x43ff40){var _0x56498e=hardware[_0x9484('0x23')]()[_0x9484('0x24')];return jira[_0x9484('0x25')]({'key':'MOTLICENSE','summary':_0x9484('0x26'),'description':_0x43ff40,'issuetype':_0x9484('0x27'),'oldToken':_0x232694,'newToken':_0x4b900f,'email':ADMIN[_0x9484('0x22')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x56498e});});}function manageLicense(_0x50e037,_0x4b0666){var _0x12f870=_0x4b0666[_0x9484('0x28')]({'plain':!![]});httpRequest(_0x50e037)['then'](function(_0x431a8a){if(oldToken){oldToken=undefined;}if(_0x431a8a[_0x9484('0x29')]){if(!_0x12f870[_0x9484('0x9')]&&_0x12f870['license']!=_0x431a8a[_0x9484('0x9')]||_0x12f870['license']&&_0x12f870[_0x9484('0x2a')]){logger[_0x9484('0x2b')](_0x9484('0x2c'));}if(_0x12f870[_0x9484('0x9')]&&!_0x12f870['data2']&&_0x12f870['license']!=_0x431a8a[_0x9484('0x9')]){logger[_0x9484('0x2b')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x12f870[_0x9484('0x9')]&&!_0x12f870[_0x9484('0x2a')]&&_0x12f870[_0x9484('0x9')]==_0x431a8a[_0x9484('0x9')]){return _0x4b0666;}return _0x4b0666[_0x9484('0x16')]({'data1':_0x50e037,'data2':null,'license':_0x431a8a['license']});}else{if(_0x431a8a[_0x9484('0x9')]||_0x12f870[_0x9484('0x9')]){if(!_0x12f870[_0x9484('0x2a')]){if(_0x12f870[_0x9484('0x2d')]==_0x50e037){GRAY_PERIOD_REASON=_0x9484('0x2e');logger[_0x9484('0x2b')](_0x9484('0x2f'));}else{GRAY_PERIOD_REASON=_0x9484('0x30');oldToken=_0x12f870[_0x9484('0x2d')];logger['info'](_0x9484('0x31'),_0x12f870[_0x9484('0x2d')],_0x50e037);}sendJiraAlert(_0x12f870[_0x9484('0x2d')],_0x431a8a[_0x9484('0x32')],GRAY_PERIOD_REASON);logger[_0x9484('0x2b')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x9484('0x33')](),moment()[_0x9484('0xc')]('YYYY-MM-DD\x20HH:mm'));return _0x4b0666[_0x9484('0x16')]({'data2':encryptDate(moment()['format'](_0x9484('0x34')))});}else{if(moment()[_0x9484('0x35')](decryptDate(_0x12f870[_0x9484('0x2a')]),'days')>DAYS){logger[_0x9484('0x2b')](_0x9484('0x36'),moment()['format'](_0x9484('0x34')));return _0x4b0666['update']({'data1':_0x50e037,'data2':null,'license':null});}}}else{if(_0x12f870[_0x9484('0x2d')]!=_0x50e037){logger[_0x9484('0x2b')](_0x9484('0x31'),_0x12f870[_0x9484('0x2d')],_0x50e037);return _0x4b0666[_0x9484('0x16')]({'data1':_0x50e037,'data2':null,'license':null});}}}return _0x4b0666;})['then'](function(_0x4ce142){_0x4b0666=_0x4ce142;})[_0x9484('0x12')](function(_0xc058a3){logger['error'](_0xc058a3[_0x9484('0x37')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x9484('0x38')](),_0x4b0666);},TIME);});}function defaultLicense(){var _0x481f55=hardware[_0x9484('0x38')]();if(_0x481f55){return db['License'][_0x9484('0x39')]({'where':{'id':0x1},'defaults':{'data1':_0x481f55}})[_0x9484('0x3a')](function(_0x11f143,_0x10106b){logger[_0x9484('0x2b')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x481f55);manageLicense(_0x481f55,_0x11f143);})[_0x9484('0x12')](function(_0x5205bb){logger['error'](_0x5205bb['message']);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index fdaf153..3b33bbe 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 _0x050e=['Demo\x20license','getLicense','License','find','defaults','then','crypto','lodash','moment','./hardware','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','demo','uuid','machineUuid','getUuid','secrets','session','update','gray','deadline','add','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license'];(function(_0x66f9f9,_0x4e5148){var _0x83efea=function(_0x170509){while(--_0x170509){_0x66f9f9['push'](_0x66f9f9['shift']());}};_0x83efea(++_0x4e5148);}(_0x050e,0x156));var _0xe050=function(_0x31b8f8,_0x3c4d7b){_0x31b8f8=_0x31b8f8-0x0;var _0x7474fb=_0x050e[_0x31b8f8];return _0x7474fb;};'use strict';var crypto=require(_0xe050('0x0'));var util=require('util');var _=require(_0xe050('0x1'));var moment=require(_0xe050('0x2'));var hardware=require(_0xe050('0x3'));var config=require(_0xe050('0x4'));var db=require(_0xe050('0x5'))['db'];function checkLicense(_0x142825,_0x494abd){if(_0x142825){try{var _0x511caf=_0x494abd||_0x142825[_0xe050('0x6')];if(_[_0xe050('0x7')](_0x511caf)){throw new Error(_0xe050('0x8'));}var _0x4bf7bd=_0x142825[_0xe050('0x9')];var _0x24d35b=_0x142825[_0xe050('0xa')];var _0x3201f0=_0x4bf7bd[_0xe050('0xb')]('-')[0x4];var _0x5f14bc=_0x4bf7bd['split']('-')[0x0];var _0x4bf412=crypto[_0xe050('0xc')](_0xe050('0xd'),util[_0xe050('0xe')](_0xe050('0xf'),_0x3201f0,_0x4bf7bd,_0x5f14bc));var _0xb8c823=_0x4bf412['update'](_0x511caf,_0xe050('0x10'),_0xe050('0x11'));_0xb8c823+=_0x4bf412[_0xe050('0x12')]('utf8');var _0x236a52=JSON[_0xe050('0x13')](_0xb8c823);_0x236a52[_0xe050('0x14')]=![];_0x236a52[_0xe050('0x15')]=_0x4bf7bd;_0x236a52[_0xe050('0x16')]=hardware[_0xe050('0x17')]();if(_0x24d35b){var _0x5c910a=crypto[_0xe050('0xc')](_0xe050('0xd'),config[_0xe050('0x18')][_0xe050('0x19')]);var _0x306bda=_0x5c910a[_0xe050('0x1a')](_0x24d35b,_0xe050('0x10'),'utf8');_0x306bda+=_0x5c910a[_0xe050('0x12')](_0xe050('0x11'));_0x236a52[_0xe050('0x1b')]=_0x306bda;_0x236a52[_0xe050('0x1c')]=moment(_0x306bda)[_0xe050('0x1d')](0x7,_0xe050('0x1e'))[_0xe050('0xe')]();_0x236a52[_0xe050('0x1f')]=_0x236a52['uuid']!=_0x236a52[_0xe050('0x16')]?_0xe050('0x20'):_0xe050('0x21');}return _0x236a52;}catch(_0x627a5){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe050('0x22'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe050('0x23'),'uuid':_0x142825['data1'],'machineUuid':hardware[_0xe050('0x17')](),'message':_0x627a5['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xe050('0x24'),'uuid':_0x142825['data1'],'machineUuid':hardware[_0xe050('0x17')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports[_0xe050('0x25')]=function(_0x165d38){return db[_0xe050('0x26')][_0xe050('0x27')](_[_0xe050('0x28')](_0x165d38,{'raw':!![],'where':{'id':0x1}}))[_0xe050('0x29')](function(_0x392984){return checkLicense(_0x392984,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file +var _0x01b4=['grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','Demo\x20license','getUuid','getLicense','License','find','then','checkLicense','crypto','util','lodash','moment','./hardware','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','machineUuid','secrets','session','update','deadline','add','days'];(function(_0x103762,_0x39d529){var _0x24844e=function(_0x47c09e){while(--_0x47c09e){_0x103762['push'](_0x103762['shift']());}};_0x24844e(++_0x39d529);}(_0x01b4,0xcf));var _0x401b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01b4[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0x401b('0x0'));var util=require(_0x401b('0x1'));var _=require(_0x401b('0x2'));var moment=require(_0x401b('0x3'));var hardware=require(_0x401b('0x4'));var config=require('../environment');var db=require(_0x401b('0x5'))['db'];function checkLicense(_0x3a1e16,_0x25c167){if(_0x3a1e16){try{var _0x36393b=_0x25c167||_0x3a1e16[_0x401b('0x6')];if(_[_0x401b('0x7')](_0x36393b)){throw new Error(_0x401b('0x8'));}var _0x4bebe0=_0x3a1e16[_0x401b('0x9')];var _0x20a052=_0x3a1e16[_0x401b('0xa')];var _0x2c69e6=_0x4bebe0[_0x401b('0xb')]('-')[0x4];var _0x3033a9=_0x4bebe0[_0x401b('0xb')]('-')[0x0];var _0x23cde0=crypto[_0x401b('0xc')](_0x401b('0xd'),util[_0x401b('0xe')](_0x401b('0xf'),_0x2c69e6,_0x4bebe0,_0x3033a9));var _0x2cf9df=_0x23cde0['update'](_0x36393b,_0x401b('0x10'),_0x401b('0x11'));_0x2cf9df+=_0x23cde0[_0x401b('0x12')](_0x401b('0x11'));var _0x39ab0b=JSON[_0x401b('0x13')](_0x2cf9df);_0x39ab0b['demo']=![];_0x39ab0b['uuid']=_0x4bebe0;_0x39ab0b[_0x401b('0x14')]=hardware['getUuid']();if(_0x20a052){var _0x59beb5=crypto[_0x401b('0xc')](_0x401b('0xd'),config[_0x401b('0x15')][_0x401b('0x16')]);var _0x58571e=_0x59beb5[_0x401b('0x17')](_0x20a052,'base64',_0x401b('0x11'));_0x58571e+=_0x59beb5[_0x401b('0x12')](_0x401b('0x11'));_0x39ab0b['gray']=_0x58571e;_0x39ab0b[_0x401b('0x18')]=moment(_0x58571e)[_0x401b('0x19')](0x7,_0x401b('0x1a'))[_0x401b('0xe')]();_0x39ab0b[_0x401b('0x1b')]=_0x39ab0b['uuid']!=_0x39ab0b[_0x401b('0x14')]?_0x401b('0x1c'):_0x401b('0x1d');}return _0x39ab0b;}catch(_0x5933b5){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x401b('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x401b('0x1f'),'uuid':_0x3a1e16[_0x401b('0x9')],'machineUuid':hardware['getUuid'](),'message':_0x5933b5['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x401b('0x20'),'uuid':_0x3a1e16[_0x401b('0x9')],'machineUuid':hardware[_0x401b('0x21')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports[_0x401b('0x22')]=function(_0x7ebf73){return db[_0x401b('0x23')][_0x401b('0x24')](_['defaults'](_0x7ebf73,{'raw':!![],'where':{'id':0x1}}))[_0x401b('0x25')](function(_0x245e0e){return checkLicense(_0x245e0e,null);});};exports[_0x401b('0x26')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 5ab3598..c71791a 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 _0xd35e=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x2c949f,_0x59b146){var _0x4ab1b3=function(_0x58f9a5){while(--_0x58f9a5){_0x2c949f['push'](_0x2c949f['shift']());}};_0x4ab1b3(++_0x59b146);}(_0xd35e,0x14a));var _0xed35=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0xd35e[_0x5a2d3f];return _0x5c65d8;};'use strict';module[_0xed35('0x0')]={'DOMAIN':_0xed35('0x1'),'SESSION_SECRET':_0xed35('0x2'),'GOOGLE_ID':_0xed35('0x3'),'GOOGLE_SECRET':_0xed35('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x311a=['secret','exports','http://localhost:9000','app-id'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x311a,0xf9));var _0xa311=function(_0x5684c0,_0x12d9b4){_0x5684c0=_0x5684c0-0x0;var _0x68372e=_0x311a[_0x5684c0];return _0x68372e;};'use strict';module[_0xa311('0x0')]={'DOMAIN':_0xa311('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xa311('0x2'),'GOOGLE_SECRET':_0xa311('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 93d8f88..112f171 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x79f0=['YYYY-MM-DD\x20HH:mm:ss','Logger','transports','File','error','%s-%s','info','Console','env','moment','winston','util','INFO','/var','log','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s'];(function(_0x344adc,_0x183c37){var _0x4014b2=function(_0xe809e5){while(--_0xe809e5){_0x344adc['push'](_0x344adc['shift']());}};_0x4014b2(++_0x183c37);}(_0x79f0,0x171));var _0x079f=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x79f0[_0x432682];return _0x463d05;};'use strict';var moment=require(_0x079f('0x0'));var winston=require(_0x079f('0x1'));var util=require(_0x079f('0x2'));var path=require('path');var debugLevel=_0x079f('0x3');function filename(_0x507b1d,_0x3f7fb9){return path['join'](_0x079f('0x4'),_0x079f('0x5'),'xcally',util[_0x079f('0x6')](_0x079f('0x7'),_0x507b1d,_0x3f7fb9));}function formatter(_0x4a553d,_0x34e32c){return util['format'](_0x079f('0x8'),moment()[_0x079f('0x6')](_0x079f('0x9')),_0x34e32c['level']['toUpperCase'](),_0x4a553d,_0x34e32c['message']);}module['exports']=function(_0x5747c5){return new winston[(_0x079f('0xa'))]({'transports':[new winston[(_0x079f('0xb'))][(_0x079f('0xc'))]({'name':util['format']('%s-%s',_0x5747c5,_0x079f('0xd')),'filename':filename(_0x5747c5,_0x079f('0xd')),'level':_0x079f('0xd'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5ae686){return formatter(_0x5747c5,_0x5ae686);}}),new winston[(_0x079f('0xb'))][(_0x079f('0xc'))]({'name':util[_0x079f('0x6')](_0x079f('0xe'),_0x5747c5,_0x079f('0xf')),'filename':filename(_0x5747c5,_0x079f('0xf')),'level':_0x079f('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x471936){return formatter(_0x5747c5,_0x471936);}}),new winston[(_0x079f('0xb'))][(_0x079f('0x10'))]({'level':process[_0x079f('0x11')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x281a02){return formatter(_0x5747c5,_0x281a02);}})]});}; \ No newline at end of file +var _0xcf85=['moment','path','INFO','join','/var','xcally','%s-%s.log','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','File','error','%s-%s','info','Console','env'];(function(_0x552f40,_0x504f63){var _0xa1eb7c=function(_0x22ba15){while(--_0x22ba15){_0x552f40['push'](_0x552f40['shift']());}};_0xa1eb7c(++_0x504f63);}(_0xcf85,0xb4));var _0x5cf8=function(_0x2dc411,_0x4bef6c){_0x2dc411=_0x2dc411-0x0;var _0xe68f22=_0xcf85[_0x2dc411];return _0xe68f22;};'use strict';var moment=require(_0x5cf8('0x0'));var winston=require('winston');var util=require('util');var path=require(_0x5cf8('0x1'));var debugLevel=_0x5cf8('0x2');function filename(_0x3532e8,_0x14fcad){return path[_0x5cf8('0x3')](_0x5cf8('0x4'),'log',_0x5cf8('0x5'),util['format'](_0x5cf8('0x6'),_0x3532e8,_0x14fcad));}function formatter(_0x40911c,_0x15e467){return util[_0x5cf8('0x7')](_0x5cf8('0x8'),moment()['format'](_0x5cf8('0x9')),_0x15e467[_0x5cf8('0xa')][_0x5cf8('0xb')](),_0x40911c,_0x15e467['message']);}module['exports']=function(_0x1fa0e5){return new winston[(_0x5cf8('0xc'))]({'transports':[new winston[(_0x5cf8('0xd'))][(_0x5cf8('0xe'))]({'name':util[_0x5cf8('0x7')]('%s-%s',_0x1fa0e5,_0x5cf8('0xf')),'filename':filename(_0x1fa0e5,_0x5cf8('0xf')),'level':_0x5cf8('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x44de09){return formatter(_0x1fa0e5,_0x44de09);}}),new winston[(_0x5cf8('0xd'))][(_0x5cf8('0xe'))]({'name':util[_0x5cf8('0x7')](_0x5cf8('0x10'),_0x1fa0e5,_0x5cf8('0x11')),'filename':filename(_0x1fa0e5,_0x5cf8('0x11')),'level':_0x5cf8('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x108e35){return formatter(_0x1fa0e5,_0x108e35);}}),new winston[(_0x5cf8('0xd'))][(_0x5cf8('0x12'))]({'level':process[_0x5cf8('0x13')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x32e75d){return formatter(_0x1fa0e5,_0x32e75d);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index b19ea69..b05a30a 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 _0x0851=['agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path','express','join','../../services/express/index.js','../../services/ami/index.js'];(function(_0x27c0b1,_0x31361f){var _0x4a0c49=function(_0x36f952){while(--_0x36f952){_0x27c0b1['push'](_0x27c0b1['shift']());}};_0x4a0c49(++_0x31361f);}(_0x0851,0x8a));var _0x1085=function(_0x537501,_0x1509e4){_0x537501=_0x537501-0x0;var _0x54bfc2=_0x0851[_0x537501];return _0x54bfc2;};'use strict';var path=require(_0x1085('0x0'));var os=require('os');var config={'apps':[{'name':_0x1085('0x1'),'script':path[_0x1085('0x2')](__dirname,_0x1085('0x3'))},{'name':'ami','script':path[_0x1085('0x2')](__dirname,_0x1085('0x4'))},{'name':_0x1085('0x5'),'script':path[_0x1085('0x2')](__dirname,_0x1085('0x6'))},{'name':_0x1085('0x7'),'script':path[_0x1085('0x2')](__dirname,_0x1085('0x8'))},{'name':_0x1085('0x9'),'script':path[_0x1085('0x2')](__dirname,_0x1085('0xa'))},{'name':_0x1085('0xb'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0x1085('0xc')]=config; \ No newline at end of file +var _0x3de9=['join','ami','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','path'];(function(_0x29feb0,_0x166d9b){var _0x2f9ee6=function(_0x499f95){while(--_0x499f95){_0x29feb0['push'](_0x29feb0['shift']());}};_0x2f9ee6(++_0x166d9b);}(_0x3de9,0x143));var _0x93de=function(_0x52bd34,_0x4a7ba2){_0x52bd34=_0x52bd34-0x0;var _0x503658=_0x3de9[_0x52bd34];return _0x503658;};'use strict';var path=require(_0x93de('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x93de('0x1')](__dirname,'../../services/express/index.js')},{'name':_0x93de('0x2'),'script':path[_0x93de('0x1')](__dirname,'../../services/ami/index.js')},{'name':_0x93de('0x3'),'script':path['join'](__dirname,_0x93de('0x4'))},{'name':_0x93de('0x5'),'script':path['join'](__dirname,_0x93de('0x6'))},{'name':_0x93de('0x7'),'script':path[_0x93de('0x1')](__dirname,_0x93de('0x8'))},{'name':'xdr','script':path['join'](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 5c766c0..9a4b012 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 _0x49e5=['saved','pm2','bluebird','./config','connected','start','then','disconnect','stop','restart','list','describe','delete','dump'];(function(_0x2cc499,_0x305c3a){var _0x19c299=function(_0x44476d){while(--_0x44476d){_0x2cc499['push'](_0x2cc499['shift']());}};_0x19c299(++_0x305c3a);}(_0x49e5,0x71));var _0x549e=function(_0x2c6ba7,_0x2dea69){_0x2c6ba7=_0x2c6ba7-0x0;var _0x259085=_0x49e5[_0x2c6ba7];return _0x259085;};'use strict';var pm2=require(_0x549e('0x0'));var BPromise=require(_0x549e('0x1'));var config=require(_0x549e('0x2'));function connect(){return new BPromise(function(_0x106de4,_0x3b5cfb){return pm2['connect'](function(_0x34b3fb){if(_0x34b3fb){return _0x3b5cfb(_0x34b3fb);}return _0x106de4(_0x549e('0x3'));});});};exports[_0x549e('0x4')]=function(_0x3fb4a3){return connect()[_0x549e('0x5')](function(){return new BPromise(function(_0x4b6c1a,_0x6e9529){return pm2['start'](_0x3fb4a3,function(_0x5677b2,_0x44b1e3){if(_0x5677b2){return _0x6e9529(_0x5677b2);}pm2[_0x549e('0x6')]();return _0x4b6c1a(_0x44b1e3);});});});};exports[_0x549e('0x7')]=function(_0x5e3c38){return connect()['then'](function(){return new BPromise(function(_0x49ba7a,_0x230ae5){return pm2[_0x549e('0x7')](_0x5e3c38,function(_0x254556,_0x468c6c){if(_0x254556){return _0x230ae5(_0x254556);}pm2[_0x549e('0x6')]();return _0x49ba7a(_0x468c6c);});});});};exports[_0x549e('0x8')]=function(_0x58c4e6){return connect()[_0x549e('0x5')](function(){return new BPromise(function(_0x546af4,_0xecbab9){return pm2[_0x549e('0x8')](_0x58c4e6,function(_0x3b9c34,_0x4c2f34){if(_0x3b9c34){return _0xecbab9(_0x3b9c34);}pm2[_0x549e('0x6')]();return _0x546af4(_0x4c2f34);});});});};exports[_0x549e('0x9')]=function(){return connect()[_0x549e('0x5')](function(){return new BPromise(function(_0x5d3d98,_0x2d239f){return pm2[_0x549e('0x9')](function(_0x3d6014,_0x2b7310){if(_0x3d6014){return _0x2d239f(_0x3d6014);}pm2[_0x549e('0x6')]();return _0x5d3d98(_0x2b7310);});});});};exports[_0x549e('0xa')]=function(_0x3e637f){return connect()[_0x549e('0x5')](function(){return new BPromise(function(_0x46c150,_0x3636f9){return pm2[_0x549e('0xa')](_0x3e637f,function(_0x207fe0,_0x402c51){if(_0x207fe0){return _0x3636f9(_0x207fe0);}pm2[_0x549e('0x6')]();return _0x46c150(_0x402c51);});});});};exports[_0x549e('0xb')]=function(_0x48c662){return connect()[_0x549e('0x5')](function(){return new BPromise(function(_0x233a69,_0x48f639){return pm2[_0x549e('0xb')](_0x48c662,function(_0x3f17c6,_0x3e2264){if(_0x3f17c6){return _0x48f639(_0x3f17c6);}pm2[_0x549e('0x6')]();return _0x233a69(_0x3e2264);});});});};exports[_0x549e('0xc')]=function(){return connect()[_0x549e('0x5')](function(){return new BPromise(function(_0x311de3,_0x3dd01a){return pm2[_0x549e('0xc')](function(_0x244ac7){if(_0x244ac7){return _0x3dd01a(_0x244ac7);}return _0x311de3(_0x549e('0xd'));});});});}; \ No newline at end of file +var _0x3fe7=['connect','connected','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config'];(function(_0x52938b,_0x51fa54){var _0x129491=function(_0x1d3066){while(--_0x1d3066){_0x52938b['push'](_0x52938b['shift']());}};_0x129491(++_0x51fa54);}(_0x3fe7,0x97));var _0x73fe=function(_0x509dad,_0x1f995f){_0x509dad=_0x509dad-0x0;var _0x21e122=_0x3fe7[_0x509dad];return _0x21e122;};'use strict';var pm2=require(_0x73fe('0x0'));var BPromise=require(_0x73fe('0x1'));var config=require(_0x73fe('0x2'));function connect(){return new BPromise(function(_0x19c8cf,_0x51001b){return pm2[_0x73fe('0x3')](function(_0x563932){if(_0x563932){return _0x51001b(_0x563932);}return _0x19c8cf(_0x73fe('0x4'));});});};exports['start']=function(_0xf81267){return connect()[_0x73fe('0x5')](function(){return new BPromise(function(_0x5278d0,_0x3e5423){return pm2['start'](_0xf81267,function(_0x3c2cce,_0x2b6b63){if(_0x3c2cce){return _0x3e5423(_0x3c2cce);}pm2[_0x73fe('0x6')]();return _0x5278d0(_0x2b6b63);});});});};exports[_0x73fe('0x7')]=function(_0x8e73fa){return connect()[_0x73fe('0x5')](function(){return new BPromise(function(_0x3a7c26,_0x30e3b6){return pm2[_0x73fe('0x7')](_0x8e73fa,function(_0x567c09,_0x573576){if(_0x567c09){return _0x30e3b6(_0x567c09);}pm2[_0x73fe('0x6')]();return _0x3a7c26(_0x573576);});});});};exports[_0x73fe('0x8')]=function(_0x2e85b1){return connect()[_0x73fe('0x5')](function(){return new BPromise(function(_0x483fd1,_0x144a17){return pm2[_0x73fe('0x8')](_0x2e85b1,function(_0x7de923,_0x37e7a8){if(_0x7de923){return _0x144a17(_0x7de923);}pm2[_0x73fe('0x6')]();return _0x483fd1(_0x37e7a8);});});});};exports[_0x73fe('0x9')]=function(){return connect()[_0x73fe('0x5')](function(){return new BPromise(function(_0x26c01e,_0x4db25b){return pm2[_0x73fe('0x9')](function(_0x5e2dec,_0x553238){if(_0x5e2dec){return _0x4db25b(_0x5e2dec);}pm2[_0x73fe('0x6')]();return _0x26c01e(_0x553238);});});});};exports['describe']=function(_0x4ed991){return connect()[_0x73fe('0x5')](function(){return new BPromise(function(_0x8aab48,_0x42874e){return pm2[_0x73fe('0xa')](_0x4ed991,function(_0x11d66f,_0x4bcf22){if(_0x11d66f){return _0x42874e(_0x11d66f);}pm2[_0x73fe('0x6')]();return _0x8aab48(_0x4bcf22);});});});};exports[_0x73fe('0xb')]=function(_0x536f40){return connect()[_0x73fe('0x5')](function(){return new BPromise(function(_0x3de7d3,_0x3a7715){return pm2['delete'](_0x536f40,function(_0x276db2,_0x1551a5){if(_0x276db2){return _0x3a7715(_0x276db2);}pm2[_0x73fe('0x6')]();return _0x3de7d3(_0x1551a5);});});});};exports[_0x73fe('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x12df4b,_0x43581f){return pm2[_0x73fe('0xc')](function(_0x570e26){if(_0x570e26){return _0x43581f(_0x570e26);}return _0x12df4b(_0x73fe('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 6b47cc0..8ddaa7a 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 _0x6df7=['length','chatInteraction:update','catch','start','moment','ioredis','../../mysqldb','../../config/environment','defaults','redis','socket.io-emitter','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','timeout','format','YYYY-MM-DD\x20HH:mm:ss','map','then'];(function(_0x56903e,_0x2fb585){var _0x573a8a=function(_0x7badf4){while(--_0x7badf4){_0x56903e['push'](_0x56903e['shift']());}};_0x573a8a(++_0x2fb585);}(_0x6df7,0xc1));var _0x76df=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6df7[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require(_0x76df('0x0'));var Redis=require(_0x76df('0x1'));var db=require(_0x76df('0x2'))['db'];var config=require(_0x76df('0x3'));config['redis']=_[_0x76df('0x4')](config[_0x76df('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x76df('0x6'))(new Redis(config[_0x76df('0x5')]));function closeInteractions(){var _0x43edf4=0x0;var _0x3470c2=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x76df('0x7')],'where':{'id':0x1}})['then'](function(_0x933321){_0x43edf4=_0x933321[_0x76df('0x7')];if(_0x43edf4){return db[_0x76df('0x8')][_0x76df('0x9')]({'raw':!![],'attributes':['id',_0x76df('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x76df('0xb')](_0x933321[_0x76df('0x7')],'minutes')}}});}else{return[];}})['then'](function(_0x490535){_0x3470c2=_0x490535;if(_0x43edf4){return db['ChatInteraction']['update']({'closeReason':'system','disposition':_0x76df('0xc'),'closed':!![],'closedAt':moment()[_0x76df('0xd')](_0x76df('0xe'))},{'where':{'id':_[_0x76df('0xf')](_0x3470c2||[],'id')}});}})[_0x76df('0x10')](function(_0x3ee0e4){for(var _0x37ce74=0x0;_0x37ce74<_0x3470c2[_0x76df('0x11')];_0x37ce74++){io['emit'](_0x76df('0x12'),{'id':_0x3470c2[_0x37ce74]['id'],'closed':!![]});}})[_0x76df('0x13')](function(_0x23539f){console['error'](_0x23539f);});}exports[_0x76df('0x14')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xd39c=['update','timeout','format','length','emit','catch','error','start','moment','../../mysqldb','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','minutes'];(function(_0x3a77a0,_0x33c357){var _0x3aec8b=function(_0xbcfa35){while(--_0xbcfa35){_0x3a77a0['push'](_0x3a77a0['shift']());}};_0x3aec8b(++_0x33c357);}(_0xd39c,0x1aa));var _0xcd39=function(_0x2c7c6e,_0x569452){_0x2c7c6e=_0x2c7c6e-0x0;var _0x3a4b9c=_0xd39c[_0x2c7c6e];return _0x3a4b9c;};'use strict';var _=require('lodash');var moment=require(_0xcd39('0x0'));var Redis=require('ioredis');var db=require(_0xcd39('0x1'))['db'];var config=require('../../config/environment');config[_0xcd39('0x2')]=_['defaults'](config[_0xcd39('0x2')],{'host':_0xcd39('0x3'),'port':0x18eb});var io=require(_0xcd39('0x4'))(new Redis(config[_0xcd39('0x2')]));function closeInteractions(){var _0x31db18=0x0;var _0x5a5657=[];return db[_0xcd39('0x5')][_0xcd39('0x6')]({'raw':!![],'attributes':['id',_0xcd39('0x7')],'where':{'id':0x1}})[_0xcd39('0x8')](function(_0x42b291){_0x31db18=_0x42b291[_0xcd39('0x7')];if(_0x31db18){return db[_0xcd39('0x9')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x42b291[_0xcd39('0x7')],_0xcd39('0xa'))}}});}else{return[];}})['then'](function(_0x596c94){_0x5a5657=_0x596c94;if(_0x31db18){return db[_0xcd39('0x9')][_0xcd39('0xb')]({'closeReason':'system','disposition':_0xcd39('0xc'),'closed':!![],'closedAt':moment()[_0xcd39('0xd')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_['map'](_0x5a5657||[],'id')}});}})['then'](function(_0x715d60){for(var _0x4bf0a8=0x0;_0x4bf0a8<_0x5a5657[_0xcd39('0xe')];_0x4bf0a8++){io[_0xcd39('0xf')]('chatInteraction:update',{'id':_0x5a5657[_0x4bf0a8]['id'],'closed':!![]});}})[_0xcd39('0x10')](function(_0x1a2b59){console[_0xcd39('0x11')](_0x1a2b59);});}exports[_0xcd39('0x12')]=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 bbe6124..d86dc00 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 _0xd64e=['authentication','auth','user','pass','\x22%s\x22\x20<%s>','name','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','%s.%s','basename','savename','join','existsSync','Sent','message','attachments','text','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','then','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','map','keyBy','toString','difference','intersection','length','stop','deleteJob','index','my\x20id','run\x20job','active','isBetween','startAt','endAt','add','cron','add\x20cron','exists','stop\x20cron','update','start','util','path','lodash','cron-job-manager','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure'];(function(_0x53c506,_0x1c0fe8){var _0x165888=function(_0x46f0b6){while(--_0x46f0b6){_0x53c506['push'](_0x53c506['shift']());}};_0x165888(++_0x1c0fe8);}(_0xd64e,0x1ae));var _0xed64=function(_0x328a3d,_0x5ad89c){_0x328a3d=_0x328a3d-0x0;var _0x4e7409=_0xd64e[_0x328a3d];return _0x4e7409;};'use strict';var fs=require('fs');var util=require(_0xed64('0x0'));var path=require(_0xed64('0x1'));var _=require(_0xed64('0x2'));var moment=require('moment');var CronJobManager=require(_0xed64('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0xed64('0x4'));var logger=require('../logger')(_0xed64('0x5'));var db=require(_0xed64('0x6'))['db'];var analyticCustomReportController=require(_0xed64('0x7'));var analyticDefaultReportController=require(_0xed64('0x8'));var client=jayson[_0xed64('0x9')][_0xed64('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x56bf50,_0xd67ab4){return function(){logger[_0xed64('0xb')](_0xed64('0xc'),_0x56bf50[_0xed64('0xd')]);var _0x51a90e=!![];var _0x47854c={'tls':{'rejectUnauthorized':![]}};if(_0x56bf50[_0xed64('0xe')][_0xed64('0xf')][_0xed64('0x10')]){_0x47854c[_0xed64('0x10')]=_0x56bf50['MailAccount'][_0xed64('0xf')][_0xed64('0x10')];}else{_0x47854c[_0xed64('0x11')]=_0x56bf50['MailAccount'][_0xed64('0xf')][_0xed64('0x11')];_0x47854c['port']=_0x56bf50[_0xed64('0xe')][_0xed64('0xf')][_0xed64('0x12')];_0x47854c[_0xed64('0x13')]=_0x56bf50['MailAccount'][_0xed64('0xf')][_0xed64('0x13')];}if(_0x56bf50[_0xed64('0xe')]['Smtp'][_0xed64('0x14')]){_0x47854c[_0xed64('0x15')]={'user':_0x56bf50['MailAccount'][_0xed64('0xf')][_0xed64('0x16')],'pass':_0x56bf50['MailAccount'][_0xed64('0xf')][_0xed64('0x17')]};}var _0x13f64b={'account':_0x47854c,'message':{'from':util['format'](_0xed64('0x18'),_0x56bf50['MailAccount'][_0xed64('0x19')],_0x56bf50[_0xed64('0xe')][_0xed64('0xd')]||_0x56bf50[_0xed64('0xe')][_0xed64('0xf')]['user']),'to':_0x56bf50[_0xed64('0xd')],'cc':_0x56bf50['cc'],'bcc':_0x56bf50[_0xed64('0x1a')],'subject':util[_0xed64('0x1b')](_0xed64('0x1c'),_0xd67ab4[_0xed64('0x19')],_0x56bf50[_0xed64('0x1d')],_0x56bf50[_0xed64('0x1e')])}};var _0x58ae86=path['join'](__dirname,_0xed64('0x1f'));var _0x49d6f4=_0xd67ab4['savename'];var _0x217198=util[_0xed64('0x1b')](_0xed64('0x20'),path[_0xed64('0x21')](_0xd67ab4[_0xed64('0x22')],path['extname'](_0xd67ab4[_0xed64('0x22')])),'zip');var _0x44fa7b=path[_0xed64('0x23')](_0x58ae86,_0x49d6f4);var _0x9b09f9=path[_0xed64('0x23')](_0x58ae86,_0x217198);if(fs[_0xed64('0x24')](_0x44fa7b)){_0xd67ab4['status']=_0xed64('0x25');_0x13f64b[_0xed64('0x26')][_0xed64('0x27')]=[{'filename':_0x49d6f4,'path':_0x44fa7b}];_0x13f64b[_0xed64('0x26')][_0xed64('0x28')]=util[_0xed64('0x1b')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xed64('0x29')](_0xd67ab4,null,0x2));}else if(fs['existsSync'](_0x9b09f9)){_0xd67ab4[_0xed64('0x2a')]=_0xed64('0x25');_0x13f64b[_0xed64('0x26')][_0xed64('0x27')]=[{'filename':_0x217198,'path':_0x9b09f9}];}else{_0x13f64b[_0xed64('0x26')]['text']=_0xed64('0x2b');if(!_0x56bf50['sendIfEmpty']){_0x51a90e=![];logger[_0xed64('0xb')](_0xed64('0x2c'));}}if(_0x51a90e){return client[_0xed64('0x2d')]('SendMail',_0x13f64b)['then'](function(_0x109409){if(_0x109409[_0xed64('0x2e')]){return logger[_0xed64('0x2e')](_0xed64('0x2f'),JSON[_0xed64('0x29')](_0x109409));}return logger[_0xed64('0xb')](_0xed64('0x30'));})[_0xed64('0x31')](function(_0xfc0c3c){return logger[_0xed64('0x2e')](_0xed64('0x2f'),JSON[_0xed64('0x29')](_0xfc0c3c));});}};}function handleError(){return function(_0x14ae5b){return logger[_0xed64('0x2e')](JSON[_0xed64('0x29')](_0x14ae5b));};}function handleResult(_0x495ea1){return function(_0x2ce3f5){logger[_0xed64('0xb')](_0xed64('0x32'),JSON[_0xed64('0x29')](_0x2ce3f5));if(_0x495ea1['MailAccount']&&_0x495ea1['MailAccount']['Smtp']&&!_[_0xed64('0x33')](_0x495ea1['email'])){setTimeout(handleSendEmail(_0x495ea1,_0x2ce3f5),0x3c*0x3e8);}};}function handleJob(_0x542013){return function(){try{if(_[_0xed64('0x33')](_0x542013['subtractNumber'])){return logger[_0xed64('0xb')](_0xed64('0x34'));}if(_[_0xed64('0x33')](_0x542013[_0xed64('0x1e')])){return logger[_0xed64('0xb')](_0xed64('0x35'));}var _0x136624={'startDate':moment()[_0xed64('0x36')](_0x542013['subtractNumber'],_0x542013[_0xed64('0x1e')])[_0xed64('0x1b')](_0xed64('0x37')),'endDate':moment()[_0xed64('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xed64('0x38'),'output':_0x542013[_0xed64('0x39')],'name':_0x542013['name']};if(!_[_0xed64('0x33')](_0x542013[_0xed64('0x3a')])){logger[_0xed64('0xb')](_0xed64('0x3b'),_0x542013[_0xed64('0x3a')]);return analyticDefaultReportController['runReport']({'id':_0x542013['DefaultReportId']},_0x136624)['then'](handleResult(_0x542013))[_0xed64('0x31')](handleError());}if(!_[_0xed64('0x33')](_0x542013[_0xed64('0x3c')])){logger[_0xed64('0xb')](_0xed64('0x3d'),_0x542013[_0xed64('0x3c')]);return analyticCustomReportController['runReport']({'id':_0x542013[_0xed64('0x3c')]},_0x136624)[_0xed64('0x3e')](handleResult(_0x542013))[_0xed64('0x31')](handleError());}}catch(_0x47cf57){logger[_0xed64('0x2e')](JSON['stringify'](_0x47cf57));}return logger[_0xed64('0xb')](_0xed64('0x3f'));};}function getJobs(_0x358f0e){var _0x17ce2c={};if(_0x358f0e){_0x17ce2c['id']=_0x358f0e;}return db[_0xed64('0x40')][_0xed64('0x41')]({'where':_0x17ce2c,'include':[{'model':db[_0xed64('0xe')],'attributes':['id','name','email'],'include':[{'model':db[_0xed64('0x42')],'as':_0xed64('0xf')}]}]})[_0xed64('0x3e')](function(_0x21cdff){var _0x1eb05e=_['keys'](manager[_0xed64('0x43')]);var _0xc899f4=_[_0xed64('0x44')](_0x21cdff,function(_0x5a8602){return _0x5a8602['id']['toString']();});var _0x480f47=_[_0xed64('0x45')](_0x21cdff,function(_0x350bfc){return _0x350bfc['id'][_0xed64('0x46')]();});var _0x17e4c8=_0x358f0e?_0xc899f4:_[_0xed64('0x47')](_0xc899f4,_0x1eb05e);var _0x438a4d=_[_0xed64('0x48')](_0xc899f4,_0x1eb05e);var _0x43f8d1=_['difference'](_0x1eb05e,_0xc899f4);var _0x2829a5;var _0x39ff5d;for(_0x2829a5=0x0;_0x2829a5<_0x43f8d1[_0xed64('0x49')]&&!_0x358f0e;_0x2829a5+=0x1){_0x39ff5d=_0x43f8d1[_0x2829a5]['toString']();if(manager['exists'](_0x39ff5d)){manager[_0xed64('0x4a')](_0x39ff5d);manager[_0xed64('0x4b')](_0x39ff5d);logger['info']('delete\x20cron',_0x39ff5d);}}logger[_0xed64('0xb')]('toRun',JSON[_0xed64('0x29')](_0x17e4c8));for(_0x2829a5=0x0;_0x2829a5<_0x17e4c8[_0xed64('0x49')];_0x2829a5+=0x1){_0x39ff5d=_0x17e4c8[_0x2829a5][_0xed64('0x46')]();logger[_0xed64('0xb')](_0xed64('0x4c'),_0x39ff5d);if(_0x358f0e){logger[_0xed64('0xb')](_0xed64('0x4d'),_0x358f0e);logger[_0xed64('0xb')](JSON[_0xed64('0x29')](_0x480f47[_0x39ff5d]));BPromise['resolve']()[_0xed64('0x3e')](handleJob(_0x480f47[_0x39ff5d]));logger[_0xed64('0xb')](_0xed64('0x4e'),_0x480f47[_0x39ff5d]['name'],_0x480f47[_0x39ff5d]['cron']);}else if(_0x480f47[_0x39ff5d]['cron']&&_0x480f47[_0x39ff5d][_0xed64('0x4f')]&&moment()[_0xed64('0x50')](_0x480f47[_0x39ff5d][_0xed64('0x51')],_0x480f47[_0x39ff5d][_0xed64('0x52')])){manager[_0xed64('0x53')](_0x39ff5d,_0x480f47[_0x39ff5d][_0xed64('0x54')],handleJob(_0x480f47[_0x39ff5d]));manager['start'](_0x39ff5d);logger[_0xed64('0xb')](_0xed64('0x55'),_0x480f47[_0x39ff5d]['name'],_0x480f47[_0x39ff5d][_0xed64('0x54')]);}else if(manager[_0xed64('0x56')](_0x39ff5d)){manager[_0xed64('0x4a')](_0x39ff5d);manager[_0xed64('0x4b')](_0x39ff5d);logger['info'](_0xed64('0x57'),_0x480f47[_0x39ff5d][_0xed64('0x19')],_0x480f47[_0x39ff5d]['cron']);}}for(_0x2829a5=0x0,_0x39ff5d;_0x2829a5<_0x438a4d[_0xed64('0x49')]&&!_0x358f0e;_0x2829a5+=0x1){_0x39ff5d=_0x438a4d[_0x2829a5][_0xed64('0x46')]();if(manager[_0xed64('0x56')](_0x39ff5d)){if(_0x480f47[_0x39ff5d][_0xed64('0x54')]&&_0x480f47[_0x39ff5d]['active']&&moment()[_0xed64('0x50')](_0x480f47[_0x39ff5d][_0xed64('0x51')],_0x480f47[_0x39ff5d][_0xed64('0x52')])){manager[_0xed64('0x58')](_0x39ff5d,_0x480f47[_0x39ff5d][_0xed64('0x54')],handleJob(_0x480f47[_0x39ff5d]));logger[_0xed64('0xb')]('update\x20cron',_0x480f47[_0x39ff5d][_0xed64('0x19')],_0x480f47[_0x39ff5d][_0xed64('0x54')]);}else{manager[_0xed64('0x4a')](_0x39ff5d);manager[_0xed64('0x4b')](_0x39ff5d);logger[_0xed64('0xb')](_0xed64('0x57'),_0x480f47[_0x39ff5d][_0xed64('0x19')],_0x480f47[_0x39ff5d][_0xed64('0x54')]);}}}})[_0xed64('0x31')](function(_0x21d86d){logger[_0xed64('0x2e')](JSON['stringify'](_0x21d86d));});}exports['run']=function(_0x49e1e3){return getJobs(_0x49e1e3);};exports[_0xed64('0x59')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x6730=['http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','service','MailAccount','host','Smtp','port','secure','authentication','user','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','savename','format','%s.%s','extname','existsSync','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','toString','keyBy','intersection','difference','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','isBetween','startAt','endAt','add','exists','stop\x20cron','update\x20cron','run','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client'];(function(_0x38cac1,_0x1c5d2f){var _0x2938b3=function(_0x4ba0e9){while(--_0x4ba0e9){_0x38cac1['push'](_0x38cac1['shift']());}};_0x2938b3(++_0x1c5d2f);}(_0x6730,0xa6));var _0x0673=function(_0x469fc4,_0x427a80){_0x469fc4=_0x469fc4-0x0;var _0x11f6d4=_0x6730[_0x469fc4];return _0x11f6d4;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x0673('0x0'));var moment=require(_0x0673('0x1'));var CronJobManager=require(_0x0673('0x2'));var jayson=require(_0x0673('0x3'));var BPromise=require(_0x0673('0x4'));var logger=require(_0x0673('0x5'))(_0x0673('0x6'));var db=require(_0x0673('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x0673('0x8'));var client=jayson[_0x0673('0x9')][_0x0673('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4d15f6,_0x2ae995){return function(){logger[_0x0673('0xb')](_0x0673('0xc'),_0x4d15f6[_0x0673('0xd')]);var _0x3977d9=!![];var _0x56aee2={'tls':{'rejectUnauthorized':![]}};if(_0x4d15f6['MailAccount']['Smtp'][_0x0673('0xe')]){_0x56aee2[_0x0673('0xe')]=_0x4d15f6[_0x0673('0xf')]['Smtp'][_0x0673('0xe')];}else{_0x56aee2[_0x0673('0x10')]=_0x4d15f6[_0x0673('0xf')][_0x0673('0x11')][_0x0673('0x10')];_0x56aee2[_0x0673('0x12')]=_0x4d15f6['MailAccount']['Smtp'][_0x0673('0x12')];_0x56aee2[_0x0673('0x13')]=_0x4d15f6['MailAccount'][_0x0673('0x11')][_0x0673('0x13')];}if(_0x4d15f6[_0x0673('0xf')]['Smtp'][_0x0673('0x14')]){_0x56aee2['auth']={'user':_0x4d15f6[_0x0673('0xf')][_0x0673('0x11')][_0x0673('0x15')],'pass':_0x4d15f6[_0x0673('0xf')][_0x0673('0x11')]['pass']};}var _0x1a6b84={'account':_0x56aee2,'message':{'from':util['format'](_0x0673('0x16'),_0x4d15f6['MailAccount']['name'],_0x4d15f6['MailAccount'][_0x0673('0xd')]||_0x4d15f6[_0x0673('0xf')][_0x0673('0x11')]['user']),'to':_0x4d15f6[_0x0673('0xd')],'cc':_0x4d15f6['cc'],'bcc':_0x4d15f6[_0x0673('0x17')],'subject':util['format'](_0x0673('0x18'),_0x2ae995[_0x0673('0x19')],_0x4d15f6[_0x0673('0x1a')],_0x4d15f6[_0x0673('0x1b')])}};var _0x4099e7=path[_0x0673('0x1c')](__dirname,_0x0673('0x1d'));var _0x408948=_0x2ae995[_0x0673('0x1e')];var _0x485df5=util[_0x0673('0x1f')](_0x0673('0x20'),path['basename'](_0x2ae995[_0x0673('0x1e')],path[_0x0673('0x21')](_0x2ae995[_0x0673('0x1e')])),'zip');var _0xc2c523=path[_0x0673('0x1c')](_0x4099e7,_0x408948);var _0x5db966=path[_0x0673('0x1c')](_0x4099e7,_0x485df5);if(fs[_0x0673('0x22')](_0xc2c523)){_0x2ae995[_0x0673('0x23')]='Sent';_0x1a6b84[_0x0673('0x24')][_0x0673('0x25')]=[{'filename':_0x408948,'path':_0xc2c523}];_0x1a6b84[_0x0673('0x24')]['text']=util[_0x0673('0x1f')](_0x0673('0x26'),JSON[_0x0673('0x27')](_0x2ae995,null,0x2));}else if(fs['existsSync'](_0x5db966)){_0x2ae995[_0x0673('0x23')]=_0x0673('0x28');_0x1a6b84[_0x0673('0x24')][_0x0673('0x25')]=[{'filename':_0x485df5,'path':_0x5db966}];}else{_0x1a6b84['message'][_0x0673('0x29')]=_0x0673('0x2a');if(!_0x4d15f6[_0x0673('0x2b')]){_0x3977d9=![];logger['info'](_0x0673('0x2c'));}}if(_0x3977d9){return client[_0x0673('0x2d')](_0x0673('0x2e'),_0x1a6b84)[_0x0673('0x2f')](function(_0x1af3e7){if(_0x1af3e7['error']){return logger[_0x0673('0x30')](_0x0673('0x31'),JSON['stringify'](_0x1af3e7));}return logger[_0x0673('0xb')]('email\x20sent');})['catch'](function(_0x4205fc){return logger['error']('error\x20mail',JSON['stringify'](_0x4205fc));});}};}function handleError(){return function(_0x4bb538){return logger[_0x0673('0x30')](JSON[_0x0673('0x27')](_0x4bb538));};}function handleResult(_0x565ebb){return function(_0x21a05c){logger[_0x0673('0xb')](_0x0673('0x32'),JSON[_0x0673('0x27')](_0x21a05c));if(_0x565ebb[_0x0673('0xf')]&&_0x565ebb['MailAccount'][_0x0673('0x11')]&&!_[_0x0673('0x33')](_0x565ebb['email'])){setTimeout(handleSendEmail(_0x565ebb,_0x21a05c),0x3c*0x3e8);}};}function handleJob(_0x426273){return function(){try{if(_[_0x0673('0x33')](_0x426273[_0x0673('0x1a')])){return logger[_0x0673('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x0673('0x33')](_0x426273[_0x0673('0x1b')])){return logger[_0x0673('0xb')](_0x0673('0x34'));}var _0x387e1e={'startDate':moment()[_0x0673('0x35')](_0x426273[_0x0673('0x1a')],_0x426273[_0x0673('0x1b')])['format'](_0x0673('0x36')),'endDate':moment()[_0x0673('0x1f')](_0x0673('0x36')),'type':_0x0673('0x37'),'output':_0x426273['output'],'name':_0x426273[_0x0673('0x19')]};if(!_[_0x0673('0x33')](_0x426273[_0x0673('0x38')])){logger[_0x0673('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x426273['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x426273[_0x0673('0x38')]},_0x387e1e)[_0x0673('0x2f')](handleResult(_0x426273))[_0x0673('0x39')](handleError());}if(!_[_0x0673('0x33')](_0x426273[_0x0673('0x3a')])){logger[_0x0673('0xb')](_0x0673('0x3b'),_0x426273[_0x0673('0x3a')]);return analyticCustomReportController['runReport']({'id':_0x426273['CustomReportId']},_0x387e1e)['then'](handleResult(_0x426273))[_0x0673('0x39')](handleError());}}catch(_0xc52bd6){logger[_0x0673('0x30')](JSON['stringify'](_0xc52bd6));}return logger[_0x0673('0xb')](_0x0673('0x3c'));};}function getJobs(_0x20b24a){var _0x56b946={};if(_0x20b24a){_0x56b946['id']=_0x20b24a;}return db[_0x0673('0x3d')][_0x0673('0x3e')]({'where':_0x56b946,'include':[{'model':db[_0x0673('0xf')],'attributes':['id',_0x0673('0x19'),'email'],'include':[{'model':db[_0x0673('0x3f')],'as':_0x0673('0x11')}]}]})['then'](function(_0x50878d){var _0x137d32=_[_0x0673('0x40')](manager[_0x0673('0x41')]);var _0x4ba540=_['map'](_0x50878d,function(_0x19e9cc){return _0x19e9cc['id'][_0x0673('0x42')]();});var _0x203f85=_[_0x0673('0x43')](_0x50878d,function(_0x389a1b){return _0x389a1b['id']['toString']();});var _0x513853=_0x20b24a?_0x4ba540:_['difference'](_0x4ba540,_0x137d32);var _0x442c41=_[_0x0673('0x44')](_0x4ba540,_0x137d32);var _0x54032e=_[_0x0673('0x45')](_0x137d32,_0x4ba540);var _0x41d99b;var _0x4a3a04;for(_0x41d99b=0x0;_0x41d99b<_0x54032e[_0x0673('0x46')]&&!_0x20b24a;_0x41d99b+=0x1){_0x4a3a04=_0x54032e[_0x41d99b][_0x0673('0x42')]();if(manager['exists'](_0x4a3a04)){manager[_0x0673('0x47')](_0x4a3a04);manager[_0x0673('0x48')](_0x4a3a04);logger['info'](_0x0673('0x49'),_0x4a3a04);}}logger['info'](_0x0673('0x4a'),JSON['stringify'](_0x513853));for(_0x41d99b=0x0;_0x41d99b<_0x513853['length'];_0x41d99b+=0x1){_0x4a3a04=_0x513853[_0x41d99b]['toString']();logger['info'](_0x0673('0x4b'),_0x4a3a04);if(_0x20b24a){logger[_0x0673('0xb')](_0x0673('0x4c'),_0x20b24a);logger['info'](JSON[_0x0673('0x27')](_0x203f85[_0x4a3a04]));BPromise[_0x0673('0x4d')]()['then'](handleJob(_0x203f85[_0x4a3a04]));logger[_0x0673('0xb')]('run\x20job',_0x203f85[_0x4a3a04][_0x0673('0x19')],_0x203f85[_0x4a3a04][_0x0673('0x4e')]);}else if(_0x203f85[_0x4a3a04][_0x0673('0x4e')]&&_0x203f85[_0x4a3a04][_0x0673('0x4f')]&&moment()[_0x0673('0x50')](_0x203f85[_0x4a3a04][_0x0673('0x51')],_0x203f85[_0x4a3a04][_0x0673('0x52')])){manager[_0x0673('0x53')](_0x4a3a04,_0x203f85[_0x4a3a04][_0x0673('0x4e')],handleJob(_0x203f85[_0x4a3a04]));manager['start'](_0x4a3a04);logger['info']('add\x20cron',_0x203f85[_0x4a3a04][_0x0673('0x19')],_0x203f85[_0x4a3a04][_0x0673('0x4e')]);}else if(manager[_0x0673('0x54')](_0x4a3a04)){manager['stop'](_0x4a3a04);manager[_0x0673('0x48')](_0x4a3a04);logger[_0x0673('0xb')](_0x0673('0x55'),_0x203f85[_0x4a3a04][_0x0673('0x19')],_0x203f85[_0x4a3a04][_0x0673('0x4e')]);}}for(_0x41d99b=0x0,_0x4a3a04;_0x41d99b<_0x442c41['length']&&!_0x20b24a;_0x41d99b+=0x1){_0x4a3a04=_0x442c41[_0x41d99b][_0x0673('0x42')]();if(manager['exists'](_0x4a3a04)){if(_0x203f85[_0x4a3a04][_0x0673('0x4e')]&&_0x203f85[_0x4a3a04]['active']&&moment()[_0x0673('0x50')](_0x203f85[_0x4a3a04][_0x0673('0x51')],_0x203f85[_0x4a3a04][_0x0673('0x52')])){manager['update'](_0x4a3a04,_0x203f85[_0x4a3a04][_0x0673('0x4e')],handleJob(_0x203f85[_0x4a3a04]));logger['info'](_0x0673('0x56'),_0x203f85[_0x4a3a04][_0x0673('0x19')],_0x203f85[_0x4a3a04][_0x0673('0x4e')]);}else{manager[_0x0673('0x47')](_0x4a3a04);manager[_0x0673('0x48')](_0x4a3a04);logger[_0x0673('0xb')]('stop\x20cron',_0x203f85[_0x4a3a04][_0x0673('0x19')],_0x203f85[_0x4a3a04]['cron']);}}}})['catch'](function(_0x402d14){logger[_0x0673('0x30')](JSON['stringify'](_0x402d14));});}exports[_0x0673('0x57')]=function(_0x3bc8b2){return getJobs(_0x3bc8b2);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 4993c9c..35b7768 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 _0x7453=['Cloud\x20Provider\x20not\x20configured','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','resolve','tempSentiment','sentiment','Cloud\x20Provider\x20not\x20available','catch','name','error','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','SequelizeValidationError','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','sentimentAccountId','Sequelize'];(function(_0x39abf6,_0x5cd4f1){var _0x2af92d=function(_0x4c40f1){while(--_0x4c40f1){_0x39abf6['push'](_0x39abf6['shift']());}};_0x2af92d(++_0x5cd4f1);}(_0x7453,0x1ce));var _0x3745=function(_0x1db3b6,_0x2925e3){_0x1db3b6=_0x1db3b6-0x0;var _0x2dc878=_0x7453[_0x1db3b6];return _0x2dc878;};var _=require(_0x3745('0x0'));var AWS=require('aws-sdk');var rp=require(_0x3745('0x1'));var util=require(_0x3745('0x2'));var BPromise=require(_0x3745('0x3'));var db=require(_0x3745('0x4'))['db'];var logger=require(_0x3745('0x5'))(_0x3745('0x6'));function getTranscriptionJob(_0x236c22,_0x3f262e,_0x3066d5,_0x20f882){return new Promise(function(_0x17966e,_0x4c3974){var _0x5aa66c=new AWS['TranscribeService']({'accessKeyId':_0x3f262e,'secretAccessKey':_0x236c22,'region':_0x3066d5});_0x5aa66c[_0x3745('0x7')]({'TranscriptionJobName':_0x20f882},function(_0x1c1fda,_0x376c97){if(_0x1c1fda){return _0x4c3974(_0x1c1fda);}else{return _0x17966e(_0x376c97);}});});}function sentiment(_0x49d180,_0x392d5c,_0x31b3a3,_0x1a5253,_0x4d81b6){return new Promise(function(_0x570f93,_0x552d39){var _0x27a034=new AWS['Comprehend']({'accessKeyId':_0x392d5c,'secretAccessKey':_0x49d180,'region':_0x31b3a3});_0x27a034[_0x3745('0x8')]({'Text':_0x1a5253,'LanguageCode':_0x4d81b6[_0x3745('0x9')](0x0,0x2)},function(_0x3593b6,_0x2fb8e1){if(_0x3593b6){return _0x552d39(_0x3593b6);}else{return _0x570f93(_0x2fb8e1);}});});}function checkTranscribeJob(_0x207370,_0x2a06a6,_0x5e2a93){var _0x2c7ced;return new BPromise(function(_0x498253,_0x3e2e5a){logger['info'](util[_0x3745('0xa')](_0x3745('0xb'),_0x207370['id'],_0x207370[_0x3745('0xc')]));return getTranscriptionJob(_0x5e2a93[_0x3745('0xd')],_0x5e2a93[_0x3745('0xe')],_0x2a06a6[_0x3745('0xf')],_0x207370[_0x3745('0xc')])[_0x3745('0x10')](function(_0x356e44){logger[_0x3745('0x11')](util[_0x3745('0xa')](_0x3745('0x12'),_0x207370['id'],_0x207370[_0x3745('0xc')],_0x356e44[_0x3745('0x13')][_0x3745('0x14')]));if(!_0x207370[_0x3745('0x15')]){switch(_0x356e44[_0x3745('0x13')][_0x3745('0x14')]){case _0x3745('0x16'):var _0x2c11cb={'transcribeStatus':_0x356e44[_0x3745('0x13')][_0x3745('0x14')],'fileUri':_0x356e44[_0x3745('0x13')]['Transcript']['TranscriptFileUri']};logger[_0x3745('0x11')](util['format'](_0x3745('0x17'),_0x207370['id']));return rp({'uri':_0x356e44[_0x3745('0x13')][_0x3745('0x18')]['TranscriptFileUri'],'json':!![]})[_0x3745('0x10')](function(_0x33017f){logger['info'](util[_0x3745('0xa')](_0x3745('0x19'),_0x207370['id']));if(_0x33017f&&_0x33017f[_0x3745('0x1a')]&&_0x33017f[_0x3745('0x1a')][_0x3745('0x1b')]&&_0x33017f['results']['transcripts'][_0x3745('0x1c')]){_0x2c11cb[_0x3745('0x15')]='';for(var _0x50d6c7=0x0;_0x50d6c7<_0x33017f[_0x3745('0x1a')][_0x3745('0x1b')][_0x3745('0x1c')];_0x50d6c7++){_0x2c11cb[_0x3745('0x15')]+=_0x33017f['results']['transcripts'][_0x50d6c7][_0x3745('0x1d')]+'';}}return _0x207370[_0x3745('0x1e')](_0x2c11cb);})[_0x3745('0x10')](function(){logger[_0x3745('0x11')](util[_0x3745('0xa')](_0x3745('0x1f'),_0x207370['id']));if(!_0x207370['tempSentiment']){throw new db['Sequelize'][(_0x3745('0x20'))](_0x3745('0x21'));}if(!_0x2a06a6['sentiment']||!_0x2a06a6['sentimentAccountId']||!_0x2a06a6[_0x3745('0x22')]||!_0x2a06a6['language']||!_0x2a06a6[_0x3745('0x23')]){throw new db['Sequelize']['ValidationError'](_0x3745('0x24'));}if(!_0x2c11cb[_0x3745('0x15')]){throw new Error(_0x3745('0x25'));}if(_0x2a06a6['sentimentAccountId']===_0x5e2a93['id']){return _0x5e2a93;}else{return db[_0x3745('0x26')][_0x3745('0x27')]({'where':{'id':_settings[_0x3745('0x28')]}});}})[_0x3745('0x10')](function(_0x12a8b7){if(!_0x12a8b7){throw new db[(_0x3745('0x29'))][(_0x3745('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x12a8b7[_0x3745('0xd')]||!_0x12a8b7[_0x3745('0xe')]){throw new db['Sequelize'][(_0x3745('0x20'))](_0x3745('0x2a'));}_0x2c7ced=_0x12a8b7;logger['info'](util[_0x3745('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x207370['id']));return sentiment(_0x2c7ced[_0x3745('0xd')],_0x2c7ced['data2'],_0x2a06a6[_0x3745('0x22')],_0x2c11cb[_0x3745('0x15')],_0x2a06a6[_0x3745('0x2b')]);})['then'](function(_0x7212ca){logger[_0x3745('0x11')](util[_0x3745('0xa')](_0x3745('0x2c'),_0x207370['id']));return _0x207370['update']({'sentiment':_0x7212ca[_0x3745('0x2d')],'sPositive':_0x7212ca['SentimentScore'][_0x3745('0x2e')],'sNegative':_0x7212ca[_0x3745('0x2f')][_0x3745('0x30')],'sMixed':_0x7212ca[_0x3745('0x2f')][_0x3745('0x31')],'sNeutral':_0x7212ca['SentimentScore'][_0x3745('0x32')]});})[_0x3745('0x10')](function(){logger[_0x3745('0x11')](util[_0x3745('0xa')](_0x3745('0x1f'),_0x207370['id']));_0x498253();});case _0x3745('0x33'):return _0x207370[_0x3745('0x1e')]({'transcribeStatus':_0x3745('0x33'),'failureReason':_0x356e44['TranscriptionJob']['FailureReason']})[_0x3745('0x10')](function(){logger[_0x3745('0x11')](util[_0x3745('0xa')](_0x3745('0x1f'),_0x207370['id']));_0x498253();});default:logger[_0x3745('0x11')](util[_0x3745('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x207370['id']));break;}}else{return BPromise[_0x3745('0x34')]()[_0x3745('0x10')](function(){if(!_0x207370[_0x3745('0x35')]){throw new db[(_0x3745('0x29'))][(_0x3745('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2a06a6[_0x3745('0x36')]||!_0x2a06a6['sentimentAccountId']||!_0x2a06a6[_0x3745('0x22')]||!_0x2a06a6[_0x3745('0x2b')]||!_0x2a06a6['bucket']){throw new db['Sequelize'][(_0x3745('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x207370[_0x3745('0x15')]){throw new Error(_0x3745('0x25'));}if(_0x2a06a6[_0x3745('0x28')]===_0x5e2a93['id']){return _0x5e2a93;}else{return db[_0x3745('0x26')][_0x3745('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x1a3dd7){if(!_0x1a3dd7){throw new db[(_0x3745('0x29'))][(_0x3745('0x20'))](_0x3745('0x37'));}if(!_0x1a3dd7[_0x3745('0xd')]||!_0x1a3dd7[_0x3745('0xe')]){throw new db[(_0x3745('0x29'))][(_0x3745('0x20'))](_0x3745('0x2a'));}_0x2c7ced=_0x1a3dd7;logger[_0x3745('0x11')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x207370['id']));return sentiment(_0x2c7ced[_0x3745('0xd')],_0x2c7ced[_0x3745('0xe')],_0x2a06a6[_0x3745('0x22')],_0x207370[_0x3745('0x15')],_0x2a06a6[_0x3745('0x2b')]);})[_0x3745('0x10')](function(_0x583e60){logger[_0x3745('0x11')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x207370['id']));return _0x207370[_0x3745('0x1e')]({'sentiment':_0x583e60['Sentiment'],'sPositive':_0x583e60[_0x3745('0x2f')][_0x3745('0x2e')],'sNegative':_0x583e60[_0x3745('0x2f')][_0x3745('0x30')],'sMixed':_0x583e60[_0x3745('0x2f')][_0x3745('0x31')],'sNeutral':_0x583e60[_0x3745('0x2f')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x3745('0x10')](function(){logger[_0x3745('0x11')](util[_0x3745('0xa')](_0x3745('0x1f'),_0x207370['id']));_0x498253();});}})[_0x3745('0x38')](function(_0x3b0552){if(_0x3b0552){if(!_0x3b0552['name']||_0x3b0552[_0x3745('0x39')]!=='SequelizeValidationError'){logger[_0x3745('0x3a')](util[_0x3745('0xa')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x207370['id']),util[_0x3745('0x3b')](_0x3b0552,{'showHidden':![],'depth':null}));}}_0x498253();});});}function checkTranscribe(){var _0x181fb2;var _0xe72096;var _0x3a68fc;return db[_0x3745('0x3c')][_0x3745('0x3d')]({'where':{'transcribeStatus':_0x3745('0x3e')}})[_0x3745('0x10')](function(_0x3ed257){if(!_0x3ed257||!_0x3ed257[_0x3745('0x1c')]){throw new db[(_0x3745('0x29'))][(_0x3745('0x20'))](_0x3745('0x3f'));}_0x181fb2=_0x3ed257;return db[_0x3745('0x40')][_0x3745('0x27')]({'where':{'id':0x1}});})[_0x3745('0x10')](function(_0x5ae572){if(!_0x5ae572){throw new db[(_0x3745('0x29'))][(_0x3745('0x20'))](_0x3745('0x41'));}_0xe72096=_0x5ae572;if(!_0xe72096[_0x3745('0x6')]||!_0xe72096['transcribeAccountId']||!_0xe72096['transcribeRegion']||!_0xe72096[_0x3745('0x2b')]||!_0xe72096[_0x3745('0x23')]){throw new db['Sequelize'][(_0x3745('0x20'))](_0x3745('0x42'));}return db[_0x3745('0x26')][_0x3745('0x27')]({'where':{'id':_0xe72096[_0x3745('0x43')]}});})[_0x3745('0x10')](function(_0x48903c){if(!_0x48903c){throw new db[(_0x3745('0x29'))][(_0x3745('0x20'))](_0x3745('0x37'));}if(!_0x48903c[_0x3745('0xd')]||!_0x48903c[_0x3745('0xe')]){throw new db[(_0x3745('0x29'))]['ValidationError'](_0x3745('0x2a'));}_0x3a68fc=_0x48903c;var _0x18bd89=[];_0x181fb2[_0x3745('0x44')](function(_0x12f5ba){_0x18bd89[_0x3745('0x45')](checkTranscribeJob(_0x12f5ba,_0xe72096,_0x3a68fc));});return BPromise[_0x3745('0x46')](_0x18bd89);})[_0x3745('0x38')](function(_0x38e475){if(_0x38e475){if(!_0x38e475[_0x3745('0x39')]||_0x38e475[_0x3745('0x39')]!==_0x3745('0x47')){logger[_0x3745('0x3a')](util[_0x3745('0x3b')](_0x38e475,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xe4a5=['VoiceRecording','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','inspect','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','then','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','Sentiment','Positive','Negative','SentimentScore','Mixed','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','sentiment','bucket','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis'];(function(_0x29d2f4,_0x40bc60){var _0x7a7dbb=function(_0x1e6935){while(--_0x1e6935){_0x29d2f4['push'](_0x29d2f4['shift']());}};_0x7a7dbb(++_0x40bc60);}(_0xe4a5,0x9f));var _0x5e4a=function(_0x2383bc,_0x2d5ec9){_0x2383bc=_0x2383bc-0x0;var _0x283573=_0xe4a5[_0x2383bc];return _0x283573;};var _=require(_0x5e4a('0x0'));var AWS=require(_0x5e4a('0x1'));var rp=require(_0x5e4a('0x2'));var util=require(_0x5e4a('0x3'));var BPromise=require(_0x5e4a('0x4'));var db=require(_0x5e4a('0x5'))['db'];var logger=require(_0x5e4a('0x6'))(_0x5e4a('0x7'));function getTranscriptionJob(_0x1edf6c,_0x4170ab,_0x286208,_0x405fe1){return new Promise(function(_0x351332,_0x186f06){var _0x41afa2=new AWS[(_0x5e4a('0x8'))]({'accessKeyId':_0x4170ab,'secretAccessKey':_0x1edf6c,'region':_0x286208});_0x41afa2['getTranscriptionJob']({'TranscriptionJobName':_0x405fe1},function(_0x5e93c5,_0x428721){if(_0x5e93c5){return _0x186f06(_0x5e93c5);}else{return _0x351332(_0x428721);}});});}function sentiment(_0x6d70a8,_0x139edd,_0x5c8108,_0x2a1730,_0x348d0e){return new Promise(function(_0x3b3ef9,_0x33aa14){var _0x282b65=new AWS[(_0x5e4a('0x9'))]({'accessKeyId':_0x139edd,'secretAccessKey':_0x6d70a8,'region':_0x5c8108});_0x282b65['detectSentiment']({'Text':_0x2a1730,'LanguageCode':_0x348d0e[_0x5e4a('0xa')](0x0,0x2)},function(_0x322874,_0x62303c){if(_0x322874){return _0x33aa14(_0x322874);}else{return _0x3b3ef9(_0x62303c);}});});}function checkTranscribeJob(_0x288c7c,_0x1f0f6d,_0x2f3b52){var _0x1869ac;return new BPromise(function(_0xb25a46,_0x17f0c7){logger[_0x5e4a('0xb')](util[_0x5e4a('0xc')](_0x5e4a('0xd'),_0x288c7c['id'],_0x288c7c[_0x5e4a('0xe')]));return getTranscriptionJob(_0x2f3b52['data1'],_0x2f3b52[_0x5e4a('0xf')],_0x1f0f6d['transcribeRegion'],_0x288c7c[_0x5e4a('0xe')])['then'](function(_0x182c0c){logger[_0x5e4a('0xb')](util[_0x5e4a('0xc')](_0x5e4a('0x10'),_0x288c7c['id'],_0x288c7c[_0x5e4a('0xe')],_0x182c0c['TranscriptionJob'][_0x5e4a('0x11')]));if(!_0x288c7c[_0x5e4a('0x12')]){switch(_0x182c0c[_0x5e4a('0x13')]['TranscriptionJobStatus']){case _0x5e4a('0x14'):var _0x2a3066={'transcribeStatus':_0x182c0c[_0x5e4a('0x13')][_0x5e4a('0x11')],'fileUri':_0x182c0c['TranscriptionJob']['Transcript'][_0x5e4a('0x15')]};logger[_0x5e4a('0xb')](util['format'](_0x5e4a('0x16'),_0x288c7c['id']));return rp({'uri':_0x182c0c['TranscriptionJob'][_0x5e4a('0x17')][_0x5e4a('0x15')],'json':!![]})['then'](function(_0x15eba9){logger['info'](util[_0x5e4a('0xc')](_0x5e4a('0x18'),_0x288c7c['id']));if(_0x15eba9&&_0x15eba9[_0x5e4a('0x19')]&&_0x15eba9['results'][_0x5e4a('0x1a')]&&_0x15eba9[_0x5e4a('0x19')][_0x5e4a('0x1a')][_0x5e4a('0x1b')]){_0x2a3066[_0x5e4a('0x12')]='';for(var _0x4197b5=0x0;_0x4197b5<_0x15eba9[_0x5e4a('0x19')][_0x5e4a('0x1a')][_0x5e4a('0x1b')];_0x4197b5++){_0x2a3066[_0x5e4a('0x12')]+=_0x15eba9['results'][_0x5e4a('0x1a')][_0x4197b5][_0x5e4a('0x1c')]+'';}}return _0x288c7c[_0x5e4a('0x1d')](_0x2a3066);})['then'](function(){logger[_0x5e4a('0xb')](util[_0x5e4a('0xc')](_0x5e4a('0x1e'),_0x288c7c['id']));if(!_0x288c7c['tempSentiment']){throw new db[(_0x5e4a('0x1f'))]['ValidationError'](_0x5e4a('0x20'));}if(!_0x1f0f6d['sentiment']||!_0x1f0f6d[_0x5e4a('0x21')]||!_0x1f0f6d[_0x5e4a('0x22')]||!_0x1f0f6d['language']||!_0x1f0f6d['bucket']){throw new db['Sequelize'][(_0x5e4a('0x23'))](_0x5e4a('0x24'));}if(!_0x2a3066[_0x5e4a('0x12')]){throw new Error(_0x5e4a('0x25'));}if(_0x1f0f6d[_0x5e4a('0x21')]===_0x2f3b52['id']){return _0x2f3b52;}else{return db[_0x5e4a('0x26')]['findOne']({'where':{'id':_settings[_0x5e4a('0x21')]}});}})[_0x5e4a('0x27')](function(_0x2414f7){if(!_0x2414f7){throw new db[(_0x5e4a('0x1f'))][(_0x5e4a('0x23'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2414f7[_0x5e4a('0x28')]||!_0x2414f7[_0x5e4a('0xf')]){throw new db['Sequelize'][(_0x5e4a('0x23'))](_0x5e4a('0x29'));}_0x1869ac=_0x2414f7;logger['info'](util['format'](_0x5e4a('0x2a'),_0x288c7c['id']));return sentiment(_0x1869ac['data1'],_0x1869ac[_0x5e4a('0xf')],_0x1f0f6d[_0x5e4a('0x22')],_0x2a3066[_0x5e4a('0x12')],_0x1f0f6d[_0x5e4a('0x2b')]);})[_0x5e4a('0x27')](function(_0x551dcc){logger[_0x5e4a('0xb')](util[_0x5e4a('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x288c7c['id']));return _0x288c7c[_0x5e4a('0x1d')]({'sentiment':_0x551dcc[_0x5e4a('0x2c')],'sPositive':_0x551dcc['SentimentScore'][_0x5e4a('0x2d')],'sNegative':_0x551dcc['SentimentScore'][_0x5e4a('0x2e')],'sMixed':_0x551dcc[_0x5e4a('0x2f')][_0x5e4a('0x30')],'sNeutral':_0x551dcc[_0x5e4a('0x2f')]['Neutral']});})[_0x5e4a('0x27')](function(){logger[_0x5e4a('0xb')](util[_0x5e4a('0xc')](_0x5e4a('0x1e'),_0x288c7c['id']));_0xb25a46();});case'FAILED':return _0x288c7c[_0x5e4a('0x1d')]({'transcribeStatus':_0x5e4a('0x31'),'failureReason':_0x182c0c[_0x5e4a('0x13')]['FailureReason']})['then'](function(){logger[_0x5e4a('0xb')](util[_0x5e4a('0xc')](_0x5e4a('0x1e'),_0x288c7c['id']));_0xb25a46();});default:logger[_0x5e4a('0xb')](util[_0x5e4a('0xc')](_0x5e4a('0x32'),_0x288c7c['id']));break;}}else{return BPromise[_0x5e4a('0x33')]()[_0x5e4a('0x27')](function(){if(!_0x288c7c[_0x5e4a('0x34')]){throw new db[(_0x5e4a('0x1f'))][(_0x5e4a('0x23'))](_0x5e4a('0x20'));}if(!_0x1f0f6d[_0x5e4a('0x35')]||!_0x1f0f6d[_0x5e4a('0x21')]||!_0x1f0f6d['sentimentRegion']||!_0x1f0f6d[_0x5e4a('0x2b')]||!_0x1f0f6d[_0x5e4a('0x36')]){throw new db[(_0x5e4a('0x1f'))][(_0x5e4a('0x23'))](_0x5e4a('0x24'));}if(!_0x288c7c[_0x5e4a('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x1f0f6d[_0x5e4a('0x21')]===_0x2f3b52['id']){return _0x2f3b52;}else{return db[_0x5e4a('0x26')][_0x5e4a('0x37')]({'where':{'id':_settings[_0x5e4a('0x21')]}});}})[_0x5e4a('0x27')](function(_0x1e1efa){if(!_0x1e1efa){throw new db['Sequelize']['ValidationError'](_0x5e4a('0x38'));}if(!_0x1e1efa['data1']||!_0x1e1efa[_0x5e4a('0xf')]){throw new db[(_0x5e4a('0x1f'))][(_0x5e4a('0x23'))](_0x5e4a('0x29'));}_0x1869ac=_0x1e1efa;logger[_0x5e4a('0xb')](util[_0x5e4a('0xc')](_0x5e4a('0x2a'),_0x288c7c['id']));return sentiment(_0x1869ac[_0x5e4a('0x28')],_0x1869ac[_0x5e4a('0xf')],_0x1f0f6d[_0x5e4a('0x22')],_0x288c7c[_0x5e4a('0x12')],_0x1f0f6d[_0x5e4a('0x2b')]);})[_0x5e4a('0x27')](function(_0x4506c4){logger[_0x5e4a('0xb')](util['format'](_0x5e4a('0x39'),_0x288c7c['id']));return _0x288c7c[_0x5e4a('0x1d')]({'sentiment':_0x4506c4[_0x5e4a('0x2c')],'sPositive':_0x4506c4[_0x5e4a('0x2f')][_0x5e4a('0x2d')],'sNegative':_0x4506c4['SentimentScore']['Negative'],'sMixed':_0x4506c4['SentimentScore'][_0x5e4a('0x30')],'sNeutral':_0x4506c4[_0x5e4a('0x2f')]['Neutral'],'transcribeStatus':_0x5e4a('0x14')});})[_0x5e4a('0x27')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x288c7c['id']));_0xb25a46();});}})[_0x5e4a('0x3a')](function(_0x346847){if(_0x346847){if(!_0x346847[_0x5e4a('0x3b')]||_0x346847[_0x5e4a('0x3b')]!==_0x5e4a('0x3c')){logger[_0x5e4a('0x3d')](util[_0x5e4a('0xc')](_0x5e4a('0x3e'),_0x288c7c['id']),util['inspect'](_0x346847,{'showHidden':![],'depth':null}));}}_0xb25a46();});});}function checkTranscribe(){var _0x947cfd;var _0x385275;var _0x14482e;return db[_0x5e4a('0x3f')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x160ce8){if(!_0x160ce8||!_0x160ce8[_0x5e4a('0x1b')]){throw new db['Sequelize'][(_0x5e4a('0x23'))]('No\x20transcribe\x20job\x20to\x20check');}_0x947cfd=_0x160ce8;return db[_0x5e4a('0x40')]['findOne']({'where':{'id':0x1}});})[_0x5e4a('0x27')](function(_0x528ab5){if(!_0x528ab5){throw new db[(_0x5e4a('0x1f'))][(_0x5e4a('0x23'))](_0x5e4a('0x41'));}_0x385275=_0x528ab5;if(!_0x385275[_0x5e4a('0x7')]||!_0x385275[_0x5e4a('0x42')]||!_0x385275[_0x5e4a('0x43')]||!_0x385275[_0x5e4a('0x2b')]||!_0x385275[_0x5e4a('0x36')]){throw new db[(_0x5e4a('0x1f'))]['ValidationError'](_0x5e4a('0x44'));}return db[_0x5e4a('0x26')][_0x5e4a('0x37')]({'where':{'id':_0x385275[_0x5e4a('0x42')]}});})[_0x5e4a('0x27')](function(_0xe51be3){if(!_0xe51be3){throw new db[(_0x5e4a('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0xe51be3[_0x5e4a('0x28')]||!_0xe51be3[_0x5e4a('0xf')]){throw new db[(_0x5e4a('0x1f'))][(_0x5e4a('0x23'))](_0x5e4a('0x29'));}_0x14482e=_0xe51be3;var _0x230e72=[];_0x947cfd[_0x5e4a('0x45')](function(_0x7ee13d){_0x230e72[_0x5e4a('0x46')](checkTranscribeJob(_0x7ee13d,_0x385275,_0x14482e));});return BPromise[_0x5e4a('0x47')](_0x230e72);})['catch'](function(_0x5d87e9){if(_0x5d87e9){if(!_0x5d87e9[_0x5e4a('0x3b')]||_0x5d87e9['name']!==_0x5e4a('0x3c')){logger[_0x5e4a('0x3d')](util[_0x5e4a('0x48')](_0x5d87e9,{'showHidden':![],'depth':null}));}}});}exports[_0x5e4a('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 9c40690..23a0ac7 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec4b=['then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','hopper2','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','destroy'];(function(_0x2cc60b,_0x38f7b2){var _0x390fb1=function(_0x17bf8f){while(--_0x17bf8f){_0x2cc60b['push'](_0x2cc60b['shift']());}};_0x390fb1(++_0x38f7b2);}(_0xec4b,0xf6));var _0xbec4=function(_0x472642,_0x4f2a71){_0x472642=_0x472642-0x0;var _0x6cc582=_0xec4b[_0x472642];return _0x6cc582;};'use strict';var util=require('util');var db=require(_0xbec4('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xbec4('0x1')]({'id':i,'firstName':_0xbec4('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xbec4('0x3')+i+_0xbec4('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xbec4('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbec4('0x5')](),'updatedAt':Date[_0xbec4('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xbec4('0x1')]({'id':i,'firstName':_0xbec4('0x2')+i,'lastName':_0xbec4('0x6')+i,'phone':0xf879fb460+i,'email':_0xbec4('0x3')+i+_0xbec4('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xbec4('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xbec4('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}db[_0xbec4('0x7')][_0xbec4('0x8')]({'where':{}})[_0xbec4('0x9')](function(){return db[_0xbec4('0x7')][_0xbec4('0xa')](contacts);})['then'](function(){console[_0xbec4('0xb')](_0xbec4('0xc'),_0xbec4('0xd'));return db[_0xbec4('0xe')][_0xbec4('0x8')]({'where':{}});})[_0xbec4('0x9')](function(){return db[_0xbec4('0xe')][_0xbec4('0xa')](hopper);})[_0xbec4('0x9')](function(){console['log']('finished\x20populating',_0xbec4('0xf'));return db['CmContact'][_0xbec4('0xa')](contacts2);})[_0xbec4('0x9')](function(){console[_0xbec4('0xb')](_0xbec4('0xc'),'contacts2');return db[_0xbec4('0xe')][_0xbec4('0xa')](hopper2);})[_0xbec4('0x9')](function(){console[_0xbec4('0xb')](_0xbec4('0xc'),_0xbec4('0x10'));})['catch'](function(_0x31a8e0){console[_0xbec4('0xb')](_0x31a8e0);}); \ No newline at end of file +var _0x3ddb=['then','contacts1','CmHopper','bulkCreate','log','finished\x20populating','hopper1','contacts2','catch','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','destroy'];(function(_0xc047e9,_0x52dffd){var _0x3dde41=function(_0x97d4c6){while(--_0x97d4c6){_0xc047e9['push'](_0xc047e9['shift']());}};_0x3dde41(++_0x52dffd);}(_0x3ddb,0xab));var _0xb3dd=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x3ddb[_0x298ed3];return _0x5aad28;};'use strict';var util=require('util');var db=require(_0xb3dd('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xb3dd('0x1')+i,'lastName':_0xb3dd('0x2')+i,'phone':0xf879fb460+i,'email':_0xb3dd('0x3')+i+_0xb3dd('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb3dd('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xb3dd('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xb3dd('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xb3dd('0x5')]({'id':i,'firstName':_0xb3dd('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xb3dd('0x3')+i+_0xb3dd('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb3dd('0x6')](),'updatedAt':Date[_0xb3dd('0x6')]()});}db[_0xb3dd('0x7')][_0xb3dd('0x8')]({'where':{}})[_0xb3dd('0x9')](function(){return db[_0xb3dd('0x7')]['bulkCreate'](contacts);})[_0xb3dd('0x9')](function(){console['log']('finished\x20populating',_0xb3dd('0xa'));return db[_0xb3dd('0xb')]['destroy']({'where':{}});})[_0xb3dd('0x9')](function(){return db[_0xb3dd('0xb')][_0xb3dd('0xc')](hopper);})[_0xb3dd('0x9')](function(){console[_0xb3dd('0xd')](_0xb3dd('0xe'),_0xb3dd('0xf'));return db['CmContact'][_0xb3dd('0xc')](contacts2);})['then'](function(){console[_0xb3dd('0xd')](_0xb3dd('0xe'),_0xb3dd('0x10'));return db[_0xb3dd('0xb')][_0xb3dd('0xc')](hopper2);})['then'](function(){console['log']('finished\x20populating','hopper2');})[_0xb3dd('0x11')](function(_0x416a9a){console[_0xb3dd('0xd')](_0x416a9a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 056c85b..bb27ffa 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e56=['then','log','catch','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e56,0x7b));var _0x67e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e56[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x67e5('0x0'));var db=require(_0x67e5('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x67e5('0x2')](_0x67e5('0x3'),_0x67e5('0x4'),i),'fullname':util[_0x67e5('0x2')]('%s%s','agent',i),'email':util[_0x67e5('0x2')](_0x67e5('0x5'),_0x67e5('0x4'),i),'role':_0x67e5('0x4'),'password':_0x67e5('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x67e5('0x7'),'ws',_0x67e5('0x8')],'disallow':[_0x67e5('0x9')],'allow':['ulaw'],'defaultuser':util[_0x67e5('0x2')](_0x67e5('0x3'),_0x67e5('0x4'),i),'encryption':_0x67e5('0xa'),'avpf':_0x67e5('0xa'),'force_avp':_0x67e5('0xa'),'icesupport':_0x67e5('0xa'),'dtlsenable':_0x67e5('0xa'),'dtlsverify':'no','dtlscertfile':_0x67e5('0xb'),'dtlsprivatekey':_0x67e5('0xc'),'dtlssetup':_0x67e5('0xd'),'callerid':util[_0x67e5('0x2')](_0x67e5('0xe'),util['format'](_0x67e5('0x3'),_0x67e5('0x4'),i),0xfa0+i)});}db[_0x67e5('0xf')][_0x67e5('0x10')](users)[_0x67e5('0x11')](function(){console[_0x67e5('0x12')]('add\x20user');})[_0x67e5('0x13')](function(_0x2c6631){console['log'](_0x2c6631);}); \ No newline at end of file +var _0xa943=['friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','User','bulkCreate','then','log','catch','util','../mysqldb','push','format','%s%s','agent','password'];(function(_0x3f6831,_0x259cef){var _0x570678=function(_0x324820){while(--_0x324820){_0x3f6831['push'](_0x3f6831['shift']());}};_0x570678(++_0x259cef);}(_0xa943,0x1ed));var _0x3a94=function(_0x1ba0cf,_0x568871){_0x1ba0cf=_0x1ba0cf-0x0;var _0x5708a4=_0xa943[_0x1ba0cf];return _0x5708a4;};'use strict';var util=require(_0x3a94('0x0'));var db=require(_0x3a94('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3a94('0x2')]({'name':util[_0x3a94('0x3')](_0x3a94('0x4'),_0x3a94('0x5'),i),'fullname':util[_0x3a94('0x3')]('%s%s',_0x3a94('0x5'),i),'email':util[_0x3a94('0x3')]('%s%s@xcally.com',_0x3a94('0x5'),i),'role':_0x3a94('0x5'),'password':_0x3a94('0x6'),'internal':0xfa0+i,'type':_0x3a94('0x7'),'transport':[_0x3a94('0x8'),'ws',_0x3a94('0x9')],'disallow':[_0x3a94('0xa')],'allow':[_0x3a94('0xb')],'defaultuser':util[_0x3a94('0x3')]('%s%s',_0x3a94('0x5'),i),'encryption':'yes','avpf':_0x3a94('0xc'),'force_avp':_0x3a94('0xc'),'icesupport':'yes','dtlsenable':_0x3a94('0xc'),'dtlsverify':'no','dtlscertfile':_0x3a94('0xd'),'dtlsprivatekey':_0x3a94('0xe'),'dtlssetup':'actpass','callerid':util[_0x3a94('0x3')]('\x22%s\x22\x20<%s>',util[_0x3a94('0x3')](_0x3a94('0x4'),_0x3a94('0x5'),i),0xfa0+i)});}db[_0x3a94('0xf')][_0x3a94('0x10')](users)[_0x3a94('0x11')](function(){console[_0x3a94('0x12')]('add\x20user');})[_0x3a94('0x13')](function(_0x17a2ee){console[_0x3a94('0x12')](_0x17a2ee);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 024a699..874e008 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3325=['catch','log','connection','setMaxListeners','request','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','../mysqldb','./environment','name','User','telephone','agent','ivr','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','Telephones','findAll','IvrCampaigns','UserProfileResource','resourceId','map','where','role','Campaign','type','format','%s:queue:%s','Agents','length','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','ChatQueues','Trunks','Trunk','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','voice','mail','openchannel','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove'];(function(_0x5e6c40,_0x183a2c){var _0x844ad8=function(_0x3488b6){while(--_0x3488b6){_0x5e6c40['push'](_0x5e6c40['shift']());}};_0x844ad8(++_0x183a2c);}(_0x3325,0x1c3));var _0x5332=function(_0x5953d3,_0xebf3f3){_0x5953d3=_0x5953d3-0x0;var _0x3a4d54=_0x3325[_0x5953d3];return _0x3a4d54;};'use strict';var _=require(_0x5332('0x0'));var util=require(_0x5332('0x1'));var BPromise=require('bluebird');var db=require(_0x5332('0x2'))['db'];var config=require(_0x5332('0x3'));var queryQueues={'attributes':['id',_0x5332('0x4')],'include':[{'as':'Agents','model':db[_0x5332('0x5')],'attributes':['id',_0x5332('0x4'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x5332('0x6')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x5332('0x4')],'where':{'role':_0x5332('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x5332('0x4'),'type'],'where':{'type':_0x5332('0x8')}};function getAssociatedResources(_0x23e0f6,_0x228e68,_0x369fd4){return db['UserProfileSection'][_0x5332('0x9')]({'where':{'name':_0x23e0f6,'userProfileId':_0x228e68},'raw':!![]})[_0x5332('0xa')](function(_0x3bd0f0){if(_0x3bd0f0){if(_0x3bd0f0[_0x5332('0xb')]){switch(_0x23e0f6){case _0x5332('0xc'):case'ChatQueues':case _0x5332('0xd'):case _0x5332('0xe'):case _0x5332('0xf'):case'OpenchannelQueues':return db[_0x369fd4]['findAll'](queryQueues);case _0x5332('0x10'):return db[_0x369fd4][_0x5332('0x11')](queryTelephones);case'Trunks':return db[_0x369fd4]['findAll'](queryTrunks);case _0x5332('0x12'):return db[_0x369fd4]['findAll'](queryCampaigns);}}else{return db[_0x5332('0x13')][_0x5332('0x11')]({'attributes':[_0x5332('0x14')],'where':{'sectionId':_0x3bd0f0['id']},'raw':!![]})['then'](function(_0x2bc5e5){if(_0x2bc5e5){var _0x52a843={'where':{'id':_[_0x5332('0x15')](_0x2bc5e5,_0x5332('0x14'))},'raw':!![]};switch(_0x369fd4){case _0x5332('0x5'):_0x52a843[_0x5332('0x16')][_0x5332('0x17')]=_0x5332('0x6');break;case _0x5332('0x18'):_0x52a843['where'][_0x5332('0x19')]='ivr';break;}return db[_0x369fd4]['findAll'](_0x52a843);}else{return[];}});}}else{return[];}})[_0x5332('0xa')](function(_0x246568){return _0x246568;});}function joinOrLeaveQueues(_0x2cda93,_0x55ff60,_0x273e33,_0x4cccd5){_0x2cda93[_0x55ff60](util[_0x5332('0x1a')](_0x5332('0x1b'),_0x273e33,_0x4cccd5[_0x5332('0x4')]));if(_0x4cccd5[_0x5332('0x1c')]){for(var _0x2c0abb=0x0;_0x2c0abb<_0x4cccd5[_0x5332('0x1c')][_0x5332('0x1d')];_0x2c0abb+=0x1){_0x2cda93[_0x55ff60](util[_0x5332('0x1a')](_0x5332('0x1e'),_0x4cccd5[_0x5332('0x1c')][_0x2c0abb][_0x5332('0x4')]));}}}function joinOrLeave(_0x472b4c,_0x2ff257,_0x5e44b2){var _0x578d42;if(_0x472b4c[_0x5332('0x1f')]['query']['id']){db[_0x5332('0x5')][_0x5332('0x20')]({'attributes':['id',_0x5332('0x4'),_0x5332('0x17'),_0x5332('0x21')],'where':{'id':_0x472b4c[_0x5332('0x1f')][_0x5332('0x22')]['id']},'include':[{'model':db[_0x5332('0x23')],'as':_0x5332('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x5332('0x25')],'as':_0x5332('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x5332('0x27')],'as':_0x5332('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x5332('0x29')],'as':_0x5332('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x5332('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x5332('0xa')](function(_0x53c0c9){if(_0x53c0c9){_0x578d42=_0x53c0c9;_0x472b4c[_0x2ff257](util['format']('user:%s',_0x53c0c9[_0x5332('0x4')]));var _0x721620=[];switch(_0x53c0c9[_0x5332('0x17')]){case _0x5332('0x2c'):_0x472b4c[_0x2ff257](_0x5332('0x2d'));_0x472b4c[_0x2ff257](_0x5332('0x2e'));if(queryQueues[_0x5332('0x2f')](_0x5332('0x30'))){delete queryQueues[_0x5332('0x30')];}_0x721620[_0x5332('0x31')](db[_0x5332('0x32')][_0x5332('0x11')](queryQueues));_0x721620[_0x5332('0x31')](db[_0x5332('0x33')][_0x5332('0x11')](queryQueues));_0x721620[_0x5332('0x31')](db[_0x5332('0x34')][_0x5332('0x11')](queryQueues));_0x721620[_0x5332('0x31')](db['SmsQueue'][_0x5332('0x11')](queryQueues));_0x721620[_0x5332('0x31')](db[_0x5332('0x35')][_0x5332('0x11')](queryQueues));_0x721620[_0x5332('0x31')](db[_0x5332('0x36')]['findAll'](queryQueues));_0x721620[_0x5332('0x31')](db['User']['findAll'](queryTelephones));_0x721620[_0x5332('0x31')](db['Trunk']['findAll'](queryTrunks));_0x721620[_0x5332('0x31')](db['Campaign'][_0x5332('0x11')](queryCampaigns));_0x721620[_0x5332('0x31')](db['User'][_0x5332('0x11')](queryAgents));break;case'user':_0x472b4c[_0x2ff257](_0x5332('0x2d'));_0x472b4c[_0x2ff257](_0x5332('0x2e'));_0x721620['push'](getAssociatedResources(_0x5332('0xc'),_0x53c0c9[_0x5332('0x21')],_0x5332('0x32')));_0x721620[_0x5332('0x31')](getAssociatedResources(_0x5332('0x37'),_0x53c0c9['userProfileId'],_0x5332('0x33')));_0x721620['push'](getAssociatedResources(_0x5332('0xd'),_0x53c0c9[_0x5332('0x21')],_0x5332('0x34')));_0x721620[_0x5332('0x31')](getAssociatedResources('SmsQueues',_0x53c0c9[_0x5332('0x21')],'SmsQueue'));_0x721620[_0x5332('0x31')](getAssociatedResources(_0x5332('0xf'),_0x53c0c9[_0x5332('0x21')],_0x5332('0x35')));_0x721620[_0x5332('0x31')](getAssociatedResources('OpenchannelQueues',_0x53c0c9['userProfileId'],'OpenchannelQueue'));_0x721620['push'](getAssociatedResources(_0x5332('0x10'),_0x53c0c9['userProfileId'],_0x5332('0x5')));_0x721620[_0x5332('0x31')](getAssociatedResources(_0x5332('0x38'),_0x53c0c9[_0x5332('0x21')],_0x5332('0x39')));_0x721620[_0x5332('0x31')](getAssociatedResources(_0x5332('0x12'),_0x53c0c9[_0x5332('0x21')],'Campaign'));_0x721620[_0x5332('0x31')](db['User'][_0x5332('0x11')](queryAgents));break;case'agent':_0x472b4c[_0x2ff257](_0x5332('0x2d'));_0x472b4c[_0x2ff257](_0x5332('0x2e'));_0x721620[_0x5332('0x31')](_0x53c0c9['getVoiceQueues']({'attributes':['id',_0x5332('0x4')]}));_0x721620[_0x5332('0x31')](_0x53c0c9[_0x5332('0x3a')]({'attributes':['id','name']}));_0x721620[_0x5332('0x31')](_0x53c0c9[_0x5332('0x3b')]({'attributes':['id',_0x5332('0x4')]}));_0x721620['push'](_0x53c0c9[_0x5332('0x3c')]({'attributes':['id',_0x5332('0x4')]}));_0x721620[_0x5332('0x31')](_0x53c0c9['getMailQueues']({'attributes':['id',_0x5332('0x4')]}));_0x721620[_0x5332('0x31')](_0x53c0c9[_0x5332('0x3d')]({'attributes':['id',_0x5332('0x4')]}));break;}return BPromise['all'](_0x721620);}})[_0x5332('0xa')](function(_0x24a631){if(_0x24a631&&_0x24a631[_0x5332('0x1d')]){for(var _0x1affdc=0x0;_0x1affdc<_0x24a631['length'];_0x1affdc+=0x1){for(var _0x564cc2=0x0;_0x564cc2<_0x24a631[_0x1affdc][_0x5332('0x1d')];_0x564cc2+=0x1){switch(_0x1affdc){case 0x0:joinOrLeaveQueues(_0x472b4c,_0x2ff257,_0x5332('0x3e'),_0x24a631[_0x1affdc][_0x564cc2]);break;case 0x1:joinOrLeaveQueues(_0x472b4c,_0x2ff257,'chat',_0x24a631[_0x1affdc][_0x564cc2]);break;case 0x2:joinOrLeaveQueues(_0x472b4c,_0x2ff257,'fax',_0x24a631[_0x1affdc][_0x564cc2]);break;case 0x3:joinOrLeaveQueues(_0x472b4c,_0x2ff257,'sms',_0x24a631[_0x1affdc][_0x564cc2]);break;case 0x4:joinOrLeaveQueues(_0x472b4c,_0x2ff257,_0x5332('0x3f'),_0x24a631[_0x1affdc][_0x564cc2]);break;case 0x5:joinOrLeaveQueues(_0x472b4c,_0x2ff257,_0x5332('0x40'),_0x24a631[_0x1affdc][_0x564cc2]);break;case 0x6:_0x472b4c[_0x2ff257](util['format'](_0x5332('0x41'),_0x24a631[_0x1affdc][_0x564cc2]['name']));break;case 0x7:_0x472b4c[_0x2ff257](util['format']('trunk:%s',_0x24a631[_0x1affdc][_0x564cc2][_0x5332('0x4')]));break;case 0x8:_0x472b4c[_0x2ff257](util['format'](_0x5332('0x42'),_0x24a631[_0x1affdc][_0x564cc2]['type'],_0x24a631[_0x1affdc][_0x564cc2][_0x5332('0x4')]));break;case 0x9:_0x472b4c[_0x2ff257](util['format'](_0x5332('0x1e'),_0x24a631[_0x1affdc][_0x564cc2][_0x5332('0x4')]));break;}}}}})[_0x5332('0xa')](function(){if(_0x2ff257===_0x5332('0x43')){var _0x32fae6=_[_0x5332('0x15')](_0x578d42[_0x5332('0x24')],'id');return _0x578d42[_0x5332('0x44')](_0x32fae6)[_0x5332('0xa')](function(){for(var _0x5759e1=0x0;_0x5759e1<_0x32fae6[_0x5332('0x1d')];_0x5759e1+=0x1){_0x5e44b2[_0x5332('0x45')](_0x5332('0x46'),{'ChatInteractionId':Number(_0x32fae6[_0x5759e1]),'UserId':Number(_0x578d42['id'])});}});}})[_0x5332('0xa')](function(){if(_0x2ff257===_0x5332('0x43')){var _0x3b2b45=_[_0x5332('0x15')](_0x578d42['MailInteractions'],'id');return _0x578d42['removeMailInteractions'](_0x3b2b45)['then'](function(){for(var _0x41ecd4=0x0;_0x41ecd4<_0x3b2b45[_0x5332('0x1d')];_0x41ecd4+=0x1){_0x5e44b2['emit'](_0x5332('0x47'),{'MailInteractionId':Number(_0x3b2b45[_0x41ecd4]),'UserId':Number(_0x578d42['id'])});}});}})[_0x5332('0xa')](function(){if(_0x2ff257===_0x5332('0x43')){var _0x4354f6=_[_0x5332('0x15')](_0x578d42['FaxInteractions'],'id');return _0x578d42[_0x5332('0x48')](_0x4354f6)[_0x5332('0xa')](function(){for(var _0x6d30e0=0x0;_0x6d30e0<_0x4354f6['length'];_0x6d30e0+=0x1){_0x5e44b2[_0x5332('0x45')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x4354f6[_0x6d30e0]),'UserId':Number(_0x578d42['id'])});}});}})[_0x5332('0xa')](function(){if(_0x2ff257===_0x5332('0x43')){var _0x3b56db=_['map'](_0x578d42[_0x5332('0x2a')],'id');return _0x578d42[_0x5332('0x49')](_0x3b56db)['then'](function(){for(var _0x2a04c3=0x0;_0x2a04c3<_0x3b56db[_0x5332('0x1d')];_0x2a04c3+=0x1){_0x5e44b2[_0x5332('0x45')](_0x5332('0x4a'),{'SmsInteractionId':Number(_0x3b56db[_0x2a04c3]),'UserId':Number(_0x578d42['id'])});}});}})['then'](function(){if(_0x2ff257===_0x5332('0x43')){var _0x3fb0a2=_[_0x5332('0x15')](_0x578d42[_0x5332('0x2b')],'id');return _0x578d42[_0x5332('0x4b')](_0x3fb0a2)[_0x5332('0xa')](function(){for(var _0x49072a=0x0;_0x49072a<_0x3fb0a2['length'];_0x49072a+=0x1){_0x5e44b2[_0x5332('0x45')](_0x5332('0x4c'),{'OpenchannelInteractionId':Number(_0x3fb0a2[_0x49072a]),'UserId':Number(_0x578d42['id'])});}});}})[_0x5332('0x4d')](function(_0x45e9b8){_0x472b4c[_0x5332('0x4e')](_0x45e9b8);});}}function onDisconnect(_0x2af8da,_0x4dd1aa){joinOrLeave(_0x2af8da,_0x5332('0x43'),_0x4dd1aa);}function onConnect(_0x1ff127){joinOrLeave(_0x1ff127,'join');}exports['default']=function(_0x7b3de6){_0x7b3de6['on'](_0x5332('0x4f'),function(_0x776f52){_0x776f52[_0x5332('0x50')](0x0);_0x776f52['address']=_0x776f52[_0x5332('0x51')]['connection'][_0x5332('0x52')]+':'+_0x776f52['request'][_0x5332('0x4f')]['remotePort'];_0x776f52[_0x5332('0x53')]=new Date();_0x776f52['log']=function(_0x10459d){console[_0x5332('0x4e')](_0x5332('0x54')+_0x776f52[_0x5332('0x55')][_0x5332('0x4')]+'['+_0x776f52['address']+']',_0x10459d);};_0x776f52['on'](_0x5332('0x56'),function(){onDisconnect(_0x776f52,_0x7b3de6);_0x776f52[_0x5332('0x4e')](_0x5332('0x57'));});onConnect(_0x776f52);_0x776f52[_0x5332('0x4e')]('CONNECTED');});}; \ No newline at end of file +var _0x1675=['MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','role','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','user','voice:inbound','VoiceQueues','ChatQueues','OpenchannelQueues','Telephones','Trunk','IvrCampaigns','voice:outbound','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','fax','mail','openchannel','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','join','setMaxListeners','address','connection','request','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','User','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','FaxQueues','SmsQueues','MailQueues','findAll','Trunks','map','resourceId','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','userProfileId','query','ChatInteractions','MailInteraction'];(function(_0x1bbe80,_0x3a29ee){var _0x2bd0a4=function(_0x32dd9a){while(--_0x32dd9a){_0x1bbe80['push'](_0x1bbe80['shift']());}};_0x2bd0a4(++_0x3a29ee);}(_0x1675,0x99));var _0x5167=function(_0x133d48,_0x123c37){_0x133d48=_0x133d48-0x0;var _0x2623ef=_0x1675[_0x133d48];return _0x2623ef;};'use strict';var _=require(_0x5167('0x0'));var util=require(_0x5167('0x1'));var BPromise=require(_0x5167('0x2'));var db=require(_0x5167('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x5167('0x4')],'include':[{'as':_0x5167('0x5'),'model':db[_0x5167('0x6')],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0x5167('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x5167('0x4')],'where':{'role':_0x5167('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x5167('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x5167('0x4')],'where':{'role':_0x5167('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x5167('0x4'),_0x5167('0x9')],'where':{'type':_0x5167('0xa')}};function getAssociatedResources(_0x3906c5,_0x377148,_0x53c1a4){return db[_0x5167('0xb')][_0x5167('0xc')]({'where':{'name':_0x3906c5,'userProfileId':_0x377148},'raw':!![]})[_0x5167('0xd')](function(_0x1479fa){if(_0x1479fa){if(_0x1479fa[_0x5167('0xe')]){switch(_0x3906c5){case'VoiceQueues':case'ChatQueues':case _0x5167('0xf'):case _0x5167('0x10'):case _0x5167('0x11'):case'OpenchannelQueues':return db[_0x53c1a4][_0x5167('0x12')](queryQueues);case'Telephones':return db[_0x53c1a4][_0x5167('0x12')](queryTelephones);case _0x5167('0x13'):return db[_0x53c1a4][_0x5167('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x53c1a4]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0x5167('0x12')]({'attributes':['resourceId'],'where':{'sectionId':_0x1479fa['id']},'raw':!![]})[_0x5167('0xd')](function(_0x4742e1){if(_0x4742e1){var _0x58f2ff={'where':{'id':_[_0x5167('0x14')](_0x4742e1,_0x5167('0x15'))},'raw':!![]};switch(_0x53c1a4){case _0x5167('0x6'):_0x58f2ff[_0x5167('0x16')]['role']=_0x5167('0x8');break;case _0x5167('0x17'):_0x58f2ff[_0x5167('0x16')][_0x5167('0x9')]=_0x5167('0xa');break;}return db[_0x53c1a4][_0x5167('0x12')](_0x58f2ff);}else{return[];}});}}else{return[];}})[_0x5167('0xd')](function(_0x3c035c){return _0x3c035c;});}function joinOrLeaveQueues(_0x2892ff,_0x30526f,_0x5178b2,_0x81fad7){_0x2892ff[_0x30526f](util[_0x5167('0x18')](_0x5167('0x19'),_0x5178b2,_0x81fad7[_0x5167('0x4')]));if(_0x81fad7[_0x5167('0x5')]){for(var _0x266d6f=0x0;_0x266d6f<_0x81fad7[_0x5167('0x5')][_0x5167('0x1a')];_0x266d6f+=0x1){_0x2892ff[_0x30526f](util[_0x5167('0x18')](_0x5167('0x1b'),_0x81fad7[_0x5167('0x5')][_0x266d6f][_0x5167('0x4')]));}}}function joinOrLeave(_0x2a06df,_0x141274,_0x47efbd){var _0x3398ce;if(_0x2a06df[_0x5167('0x1c')]['query']['id']){db['User']['find']({'attributes':['id',_0x5167('0x4'),'role',_0x5167('0x1d')],'where':{'id':_0x2a06df['handshake'][_0x5167('0x1e')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x5167('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0x5167('0x20')],'as':_0x5167('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x5167('0x22')],'as':_0x5167('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x5167('0x24')],'as':_0x5167('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x5167('0x26')],'as':_0x5167('0x27'),'attributes':['id'],'raw':!![]}]})['then'](function(_0xda5165){if(_0xda5165){_0x3398ce=_0xda5165;_0x2a06df[_0x141274](util[_0x5167('0x18')](_0x5167('0x1b'),_0xda5165[_0x5167('0x4')]));var _0x375fc1=[];switch(_0xda5165[_0x5167('0x28')]){case'admin':_0x2a06df[_0x141274]('voice:inbound');_0x2a06df[_0x141274]('voice:outbound');if(queryQueues[_0x5167('0x29')](_0x5167('0x2a'))){delete queryQueues[_0x5167('0x2a')];}_0x375fc1[_0x5167('0x2b')](db[_0x5167('0x2c')][_0x5167('0x12')](queryQueues));_0x375fc1[_0x5167('0x2b')](db[_0x5167('0x2d')]['findAll'](queryQueues));_0x375fc1[_0x5167('0x2b')](db[_0x5167('0x2e')][_0x5167('0x12')](queryQueues));_0x375fc1[_0x5167('0x2b')](db[_0x5167('0x2f')][_0x5167('0x12')](queryQueues));_0x375fc1['push'](db[_0x5167('0x30')][_0x5167('0x12')](queryQueues));_0x375fc1[_0x5167('0x2b')](db[_0x5167('0x31')][_0x5167('0x12')](queryQueues));_0x375fc1['push'](db[_0x5167('0x6')]['findAll'](queryTelephones));_0x375fc1['push'](db['Trunk'][_0x5167('0x12')](queryTrunks));_0x375fc1[_0x5167('0x2b')](db[_0x5167('0x17')][_0x5167('0x12')](queryCampaigns));_0x375fc1[_0x5167('0x2b')](db['User']['findAll'](queryAgents));break;case _0x5167('0x32'):_0x2a06df[_0x141274](_0x5167('0x33'));_0x2a06df[_0x141274]('voice:outbound');_0x375fc1['push'](getAssociatedResources(_0x5167('0x34'),_0xda5165[_0x5167('0x1d')],_0x5167('0x2c')));_0x375fc1[_0x5167('0x2b')](getAssociatedResources(_0x5167('0x35'),_0xda5165[_0x5167('0x1d')],_0x5167('0x2d')));_0x375fc1['push'](getAssociatedResources('FaxQueues',_0xda5165[_0x5167('0x1d')],_0x5167('0x2e')));_0x375fc1['push'](getAssociatedResources(_0x5167('0x10'),_0xda5165[_0x5167('0x1d')],_0x5167('0x2f')));_0x375fc1[_0x5167('0x2b')](getAssociatedResources(_0x5167('0x11'),_0xda5165[_0x5167('0x1d')],_0x5167('0x30')));_0x375fc1[_0x5167('0x2b')](getAssociatedResources(_0x5167('0x36'),_0xda5165[_0x5167('0x1d')],_0x5167('0x31')));_0x375fc1[_0x5167('0x2b')](getAssociatedResources(_0x5167('0x37'),_0xda5165[_0x5167('0x1d')],'User'));_0x375fc1[_0x5167('0x2b')](getAssociatedResources(_0x5167('0x13'),_0xda5165[_0x5167('0x1d')],_0x5167('0x38')));_0x375fc1[_0x5167('0x2b')](getAssociatedResources(_0x5167('0x39'),_0xda5165[_0x5167('0x1d')],_0x5167('0x17')));_0x375fc1['push'](db[_0x5167('0x6')]['findAll'](queryAgents));break;case'agent':_0x2a06df[_0x141274](_0x5167('0x33'));_0x2a06df[_0x141274](_0x5167('0x3a'));_0x375fc1[_0x5167('0x2b')](_0xda5165[_0x5167('0x3b')]({'attributes':['id',_0x5167('0x4')]}));_0x375fc1[_0x5167('0x2b')](_0xda5165[_0x5167('0x3c')]({'attributes':['id','name']}));_0x375fc1[_0x5167('0x2b')](_0xda5165['getFaxQueues']({'attributes':['id',_0x5167('0x4')]}));_0x375fc1[_0x5167('0x2b')](_0xda5165[_0x5167('0x3d')]({'attributes':['id',_0x5167('0x4')]}));_0x375fc1[_0x5167('0x2b')](_0xda5165[_0x5167('0x3e')]({'attributes':['id',_0x5167('0x4')]}));_0x375fc1[_0x5167('0x2b')](_0xda5165[_0x5167('0x3f')]({'attributes':['id',_0x5167('0x4')]}));break;}return BPromise[_0x5167('0x40')](_0x375fc1);}})[_0x5167('0xd')](function(_0x62b8ca){if(_0x62b8ca&&_0x62b8ca[_0x5167('0x1a')]){for(var _0xfefdb4=0x0;_0xfefdb4<_0x62b8ca[_0x5167('0x1a')];_0xfefdb4+=0x1){for(var _0x215f5b=0x0;_0x215f5b<_0x62b8ca[_0xfefdb4][_0x5167('0x1a')];_0x215f5b+=0x1){switch(_0xfefdb4){case 0x0:joinOrLeaveQueues(_0x2a06df,_0x141274,_0x5167('0x41'),_0x62b8ca[_0xfefdb4][_0x215f5b]);break;case 0x1:joinOrLeaveQueues(_0x2a06df,_0x141274,'chat',_0x62b8ca[_0xfefdb4][_0x215f5b]);break;case 0x2:joinOrLeaveQueues(_0x2a06df,_0x141274,_0x5167('0x42'),_0x62b8ca[_0xfefdb4][_0x215f5b]);break;case 0x3:joinOrLeaveQueues(_0x2a06df,_0x141274,'sms',_0x62b8ca[_0xfefdb4][_0x215f5b]);break;case 0x4:joinOrLeaveQueues(_0x2a06df,_0x141274,_0x5167('0x43'),_0x62b8ca[_0xfefdb4][_0x215f5b]);break;case 0x5:joinOrLeaveQueues(_0x2a06df,_0x141274,_0x5167('0x44'),_0x62b8ca[_0xfefdb4][_0x215f5b]);break;case 0x6:_0x2a06df[_0x141274](util[_0x5167('0x18')](_0x5167('0x45'),_0x62b8ca[_0xfefdb4][_0x215f5b][_0x5167('0x4')]));break;case 0x7:_0x2a06df[_0x141274](util[_0x5167('0x18')]('trunk:%s',_0x62b8ca[_0xfefdb4][_0x215f5b][_0x5167('0x4')]));break;case 0x8:_0x2a06df[_0x141274](util['format'](_0x5167('0x46'),_0x62b8ca[_0xfefdb4][_0x215f5b][_0x5167('0x9')],_0x62b8ca[_0xfefdb4][_0x215f5b]['name']));break;case 0x9:_0x2a06df[_0x141274](util['format']('user:%s',_0x62b8ca[_0xfefdb4][_0x215f5b]['name']));break;}}}}})['then'](function(){if(_0x141274===_0x5167('0x47')){var _0x3b58e4=_[_0x5167('0x14')](_0x3398ce['ChatInteractions'],'id');return _0x3398ce[_0x5167('0x48')](_0x3b58e4)[_0x5167('0xd')](function(){for(var _0x25f896=0x0;_0x25f896<_0x3b58e4['length'];_0x25f896+=0x1){_0x47efbd[_0x5167('0x49')](_0x5167('0x4a'),{'ChatInteractionId':Number(_0x3b58e4[_0x25f896]),'UserId':Number(_0x3398ce['id'])});}});}})[_0x5167('0xd')](function(){if(_0x141274===_0x5167('0x47')){var _0x28a35b=_[_0x5167('0x14')](_0x3398ce[_0x5167('0x21')],'id');return _0x3398ce[_0x5167('0x4b')](_0x28a35b)[_0x5167('0xd')](function(){for(var _0x18bd9a=0x0;_0x18bd9a<_0x28a35b[_0x5167('0x1a')];_0x18bd9a+=0x1){_0x47efbd[_0x5167('0x49')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x28a35b[_0x18bd9a]),'UserId':Number(_0x3398ce['id'])});}});}})[_0x5167('0xd')](function(){if(_0x141274===_0x5167('0x47')){var _0x43a013=_[_0x5167('0x14')](_0x3398ce[_0x5167('0x23')],'id');return _0x3398ce[_0x5167('0x4c')](_0x43a013)['then'](function(){for(var _0x5995fe=0x0;_0x5995fe<_0x43a013[_0x5167('0x1a')];_0x5995fe+=0x1){_0x47efbd[_0x5167('0x49')](_0x5167('0x4d'),{'FaxInteractionId':Number(_0x43a013[_0x5995fe]),'UserId':Number(_0x3398ce['id'])});}});}})[_0x5167('0xd')](function(){if(_0x141274===_0x5167('0x47')){var _0x426d78=_['map'](_0x3398ce[_0x5167('0x25')],'id');return _0x3398ce[_0x5167('0x4e')](_0x426d78)[_0x5167('0xd')](function(){for(var _0x3180d1=0x0;_0x3180d1<_0x426d78[_0x5167('0x1a')];_0x3180d1+=0x1){_0x47efbd['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x426d78[_0x3180d1]),'UserId':Number(_0x3398ce['id'])});}});}})[_0x5167('0xd')](function(){if(_0x141274==='leave'){var _0x436d8b=_[_0x5167('0x14')](_0x3398ce[_0x5167('0x27')],'id');return _0x3398ce[_0x5167('0x4f')](_0x436d8b)[_0x5167('0xd')](function(){for(var _0x248257=0x0;_0x248257<_0x436d8b[_0x5167('0x1a')];_0x248257+=0x1){_0x47efbd[_0x5167('0x49')](_0x5167('0x50'),{'OpenchannelInteractionId':Number(_0x436d8b[_0x248257]),'UserId':Number(_0x3398ce['id'])});}});}})[_0x5167('0x51')](function(_0x2a208b){_0x2a06df[_0x5167('0x52')](_0x2a208b);});}}function onDisconnect(_0x1ae602,_0x335bc6){joinOrLeave(_0x1ae602,'leave',_0x335bc6);}function onConnect(_0x4829c5){joinOrLeave(_0x4829c5,_0x5167('0x53'));}exports['default']=function(_0x12009b){_0x12009b['on']('connection',function(_0x3d0ab2){_0x3d0ab2[_0x5167('0x54')](0x0);_0x3d0ab2[_0x5167('0x55')]=_0x3d0ab2['request'][_0x5167('0x56')]['remoteAddress']+':'+_0x3d0ab2[_0x5167('0x57')][_0x5167('0x56')]['remotePort'];_0x3d0ab2[_0x5167('0x58')]=new Date();_0x3d0ab2['log']=function(_0x4b2c7a){console[_0x5167('0x52')](_0x5167('0x59')+_0x3d0ab2[_0x5167('0x5a')][_0x5167('0x4')]+'['+_0x3d0ab2['address']+']',_0x4b2c7a);};_0x3d0ab2['on'](_0x5167('0x5b'),function(){onDisconnect(_0x3d0ab2,_0x12009b);_0x3d0ab2[_0x5167('0x52')](_0x5167('0x5c'));});onConnect(_0x3d0ab2);_0x3d0ab2[_0x5167('0x52')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index dca1bc8..a512c1d 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 _0xaf2e=['util','jayson/promise','triggers','client','ChatInteraction','afterCreate','newinteraction','Chat','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','afterUpdate','SmsMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','EventManager','info','error','code','Trigger,\x20%s','catch','channel','direction','UserId','find','name','then','interface','format','outgoingmessage','get','event','changed','closed','User','SIP/%s','default','length','hasOwnProperty','hook','toLowerCase','condition'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xaf2e,0x157));var _0xeaf2=function(_0xe48e3a,_0x4279cd){_0xe48e3a=_0xe48e3a-0x0;var _0x51bed9=_0xaf2e[_0xe48e3a];return _0x51bed9;};'use strict';var util=require(_0xeaf2('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0xeaf2('0x1'));var logger=require('../logger')(_0xeaf2('0x2'));var client=jayson[_0xeaf2('0x3')]['http']({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xeaf2('0x4'),'event':_0xeaf2('0x5'),'condition':_0xeaf2('0x6'),'callback':afterCreate},{'channel':_0xeaf2('0x7'),'model':_0xeaf2('0x4'),'event':'afterUpdate','condition':_0xeaf2('0x8'),'callback':afterUpdate},{'channel':_0xeaf2('0x7'),'model':_0xeaf2('0x9'),'event':_0xeaf2('0x5'),'condition':_0xeaf2('0xa'),'callback':afterCreateMessage},{'channel':_0xeaf2('0xb'),'model':_0xeaf2('0xc'),'event':_0xeaf2('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':_0xeaf2('0xc'),'event':_0xeaf2('0xd'),'condition':_0xeaf2('0x8'),'callback':afterUpdate},{'channel':_0xeaf2('0xb'),'model':_0xeaf2('0xe'),'event':_0xeaf2('0x5'),'condition':_0xeaf2('0xa'),'callback':afterCreateMessage},{'channel':_0xeaf2('0xf'),'model':_0xeaf2('0x10'),'event':_0xeaf2('0x5'),'condition':_0xeaf2('0x6'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':'afterUpdate','condition':_0xeaf2('0x8'),'callback':afterUpdate},{'channel':_0xeaf2('0xf'),'model':'FaxMessage','event':_0xeaf2('0x5'),'condition':_0xeaf2('0xa'),'callback':afterCreateMessage},{'channel':_0xeaf2('0x11'),'model':_0xeaf2('0x12'),'event':_0xeaf2('0x5'),'condition':_0xeaf2('0x6'),'callback':afterCreate},{'channel':_0xeaf2('0x11'),'model':_0xeaf2('0x12'),'event':_0xeaf2('0xd'),'condition':_0xeaf2('0x8'),'callback':afterUpdate},{'channel':_0xeaf2('0x11'),'model':_0xeaf2('0x13'),'event':_0xeaf2('0x5'),'condition':_0xeaf2('0xa'),'callback':afterCreateMessage},{'channel':_0xeaf2('0x14'),'model':_0xeaf2('0x15'),'event':_0xeaf2('0x5'),'condition':_0xeaf2('0x6'),'callback':afterCreate},{'channel':'Openchannel','model':_0xeaf2('0x15'),'event':_0xeaf2('0xd'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xeaf2('0x14'),'model':'OpenchannelMessage','event':_0xeaf2('0x5'),'condition':_0xeaf2('0xa'),'callback':afterCreateMessage}];function request(_0x5084dd){return client['request'](_0xeaf2('0x16'),_0x5084dd)['then'](function(_0x136fd0){logger[_0xeaf2('0x17')]('Trigger,\x20%s',_0xeaf2('0x16'),_0x136fd0);if(_0x136fd0[_0xeaf2('0x18')]){if(_0x136fd0['error'][_0xeaf2('0x19')]===0x1f4){logger['error'](_0xeaf2('0x1a'),_0xeaf2('0x16'),_0x136fd0[_0xeaf2('0x18')]);}}})[_0xeaf2('0x1b')](function(_0xd83d14){logger[_0xeaf2('0x18')]('Trigger,\x20%s',_0xeaf2('0x16'),_0xd83d14);});}function afterCreateMessage(_0x5e9317,_0x1a59fc){return function(_0x4e554c,_0x53c9b5){_0x4e554c=_0x4e554c['get']({'plain':!![]});_0x4e554c[_0xeaf2('0x1c')]=_0x5e9317;_0x4e554c['event']=_0x4e554c[_0xeaf2('0x1d')];if(_0x4e554c[_0xeaf2('0x1e')]){return db['User'][_0xeaf2('0x1f')]({'where':{'id':_0x4e554c[_0xeaf2('0x1e')]},'attributes':['id',_0xeaf2('0x20')],'raw':!![]})[_0xeaf2('0x21')](function(_0x324c64){_0x4e554c[_0xeaf2('0x22')]=util[_0xeaf2('0x23')]('SIP/%s',_0x324c64[_0xeaf2('0x20')]);_0x4e554c[_0xeaf2('0x1c')]=_0x5e9317;return request({'event':'incomingmessage','message':_0x4e554c});})[_0xeaf2('0x1b')](function(_0x1c8351){console[_0xeaf2('0x18')](_0x1c8351);});}else{return request({'event':_0xeaf2('0x24'),'message':_0x4e554c});}};}function afterCreate(_0x5021b9,_0x5ac5c2){return function(_0x8d350e,_0x3b6c26){_0x8d350e=_0x8d350e[_0xeaf2('0x25')]({'plain':!![]});_0x8d350e[_0xeaf2('0x1c')]=_0x5021b9;_0x8d350e[_0xeaf2('0x26')]='opened';return request({'event':_0x5ac5c2,'message':_0x8d350e});};}function afterUpdate(_0x3e934f,_0x31c4f8){return function(_0x26cb27,_0x474c88){if(_0x26cb27[_0xeaf2('0x27')](_0xeaf2('0x28'))&&_0x26cb27[_0xeaf2('0x28')]){_0x26cb27=_0x26cb27[_0xeaf2('0x25')]({'plain':!![]});_0x26cb27[_0xeaf2('0x1c')]=_0x3e934f;_0x26cb27[_0xeaf2('0x26')]=_0xeaf2('0x28');if(_0x26cb27[_0xeaf2('0x1e')]){return db[_0xeaf2('0x29')]['find']({'where':{'id':_0x26cb27[_0xeaf2('0x1e')]},'attributes':['id',_0xeaf2('0x20')],'raw':!![]})[_0xeaf2('0x21')](function(_0x38826a){_0x26cb27['interface']=util[_0xeaf2('0x23')](_0xeaf2('0x2a'),_0x38826a[_0xeaf2('0x20')]);return request({'event':_0x31c4f8,'message':_0x26cb27});})[_0xeaf2('0x1b')](function(_0x39590a){console[_0xeaf2('0x18')](_0x39590a);});}else{return request({'event':_0x31c4f8,'message':_0x26cb27});}}};}exports[_0xeaf2('0x2b')]=function(){for(var _0x530bf6=0x0;_0x530bf6=_0x8af49e['agents']){throw Error(_0x9f2e('0x15'));}_0x3eb080(_0x4395e3);})['catch'](function(_0x4c186c){_0x18a356(_0x4c186c);});});}; \ No newline at end of file +var _0x0690=['agents','../mysqldb','./license/util','voice','chat','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','then'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0690,0x17d));var _0x0069=function(_0x122e9b,_0x391bf4){_0x122e9b=_0x122e9b-0x0;var _0x22c247=_0x0690[_0x122e9b];return _0x22c247;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require(_0x0069('0x0'))['db'];var util=require(_0x0069('0x1'));var channels=[_0x0069('0x2'),'mail',_0x0069('0x3'),'fax',_0x0069('0x4'),_0x0069('0x5')];exports[_0x0069('0x6')]=function(){return channels;};exports[_0x0069('0x7')]=function(_0x1b4eff){_0x1b4eff=_0x1b4eff[_0x0069('0x8')]();return _[_0x0069('0x9')](channels,_0x1b4eff);};exports['clearBlockUser']=function(_0x50497e,_0x10e961,_0x530356,_0x343166){var _0x4cfb81={'loginAttempts':_0x10e961,'blocked':_0x530356};if(!_[_0x0069('0xa')](_0x343166)){_0x4cfb81[_0x0069('0xb')]=_0x343166;}return _0x50497e[_0x0069('0xc')](_0x4cfb81);};exports[_0x0069('0xd')]=function(_0x5712d1){return new BPromise(function(_0xe28e8b,_0x38c4f8){var _0x4f7cd3=0x0;if(_0x5712d1[_0x0069('0xe')]!==_0x0069('0xf')){_0xe28e8b(_0x5712d1);}db[_0x0069('0x10')][_0x0069('0x11')]({'where':{'role':_0x0069('0xf'),'online':!![],'id':{'$ne':_0x5712d1['id']}}})[_0x0069('0x12')](function(_0x642908){_0x4f7cd3=_0x642908;return util['getLicense']();})[_0x0069('0x12')](function(_0x1af04f){if(_0x1af04f&&_0x1af04f['agents']&&_0x4f7cd3>=_0x1af04f[_0x0069('0x13')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0xe28e8b(_0x5712d1);})['catch'](function(_0x2bd620){_0x38c4f8(_0x2bd620);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 360bfe6..25c6c2f 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab3e=['status','send','404'];(function(_0xb8d7fd,_0x55ecc7){var _0xa6568=function(_0xbbb125){while(--_0xbbb125){_0xb8d7fd['push'](_0xb8d7fd['shift']());}};_0xa6568(++_0x55ecc7);}(_0xab3e,0x191));var _0xeab3=function(_0x5a10ec,_0x442756){_0x5a10ec=_0x5a10ec-0x0;var _0x2fdf3=_0xab3e[_0x5a10ec];return _0x2fdf3;};'use strict';module['exports'][0x194]=function pageNotFound(_0x593dea,_0x2df47b){var _0xef8ace=_0xeab3('0x0');var _0x21580c=0x194;var _0x1800d3={'status':_0x21580c};_0x2df47b[_0xeab3('0x1')](_0x1800d3[_0xeab3('0x1')]);_0x2df47b['render'](_0xef8ace,{},function(_0x4d0115,_0x3ab779){if(_0x4d0115){return _0x2df47b[_0xeab3('0x1')](_0x1800d3[_0xeab3('0x1')])['json'](_0x1800d3);}_0x2df47b[_0xeab3('0x2')](_0x3ab779);});}; \ No newline at end of file +var _0x18dd=['404','status','render','json','exports'];(function(_0x418fbe,_0x205230){var _0xe74b34=function(_0x5948b0){while(--_0x5948b0){_0x418fbe['push'](_0x418fbe['shift']());}};_0xe74b34(++_0x205230);}(_0x18dd,0xd1));var _0xd18d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x18dd[_0xfae23b];return _0x200640;};'use strict';module[_0xd18d('0x0')][0x194]=function pageNotFound(_0x206497,_0x22b25a){var _0x1196f7=_0xd18d('0x1');var _0x48dc1f=0x194;var _0x4a40cc={'status':_0x48dc1f};_0x22b25a[_0xd18d('0x2')](_0x4a40cc['status']);_0x22b25a[_0xd18d('0x3')](_0x1196f7,{},function(_0x4c0032,_0x37653e){if(_0x4c0032){return _0x22b25a[_0xd18d('0x2')](_0x4a40cc['status'])[_0xd18d('0x4')](_0x4a40cc);}_0x22b25a['send'](_0x37653e);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 3ff8cc3..2df2111 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0af4=['int_freshdesk_configuration_has_tags','ServicenowAccount','Dynamics365Account','FreshsalesAccount','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','team_has_voice_queues','team_has_mail_queues','TrunkId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToQueue','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','sectionId','exports','../config/environment','sequelize','determine','defaultsDeep','xcall','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','127.0.0.1','username','password','options','database','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailQueueReport','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/openchannelQueueReport/openchannelQueueReport.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','../api/variable/variable.model','Integration','IntegrationReport','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','hasOne','UserId','Recordings','hasMany','VoiceQueuesRt','VoiceExtension','cascade','CmHopperHistory','HopperHistory','SmsInteractions','FaxInteractions','MailInteractions','userProfileId','belongsToMany','ChatGroup','Groups','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueues','CmList','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','FaxAccounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sound','moh_has_sounds','HopperFinals','HopperHistories','VoiceQueueId','JscriptySessions','belongsTo','TrunkBackup','TrunkBackupId','Interval','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Team','Teams','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','uniqueid','AgentReports','ContactId','MailServerIn','Imap','Smtp','Disposition','MailAccountId','Answers','Messages','Interactions','List','ListId','TemplateId','MailInteraction','MailInteractionId','Account','Contact','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','MailApplication','restrict','TagId','Items','FaxAccountId','user_has_fax_accounts','FaxApplication','FaxInteractionId','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','Dispositions','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','UserOpenchannelQueue','team_has_openchannel_queues','ChatWebsiteId','ChatMessage','user_has_chat_websites','OpenchannelQueueReport','Agent','ChatApplication','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatQueue','team_has_chat_queues','chat_group_has_users','CmCompany','CompanyId','Hoppers','Company','cm_contact_has_tags','Queue','Campaign','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','Actions','AutomationId','Intervals','IntervalId','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','AnyConditions','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','Variable','VariableId','AccountId','SugarcrmAccount','DeskAccount','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskConfiguration','int_zendesk_configuration_has_tags'];(function(_0x12270c,_0x29778a){var _0x5eeee0=function(_0x14b9f8){while(--_0x14b9f8){_0x12270c['push'](_0x12270c['shift']());}};_0x5eeee0(++_0x29778a);}(_0x0af4,0x1f4));var _0x40af=function(_0x5322eb,_0x9c5d31){_0x5322eb=_0x5322eb-0x0;var _0x596a4d=_0x0af4[_0x5322eb];return _0x596a4d;};'use strict';var path=require('path');var config=require(_0x40af('0x0'));var Sequelize=require(_0x40af('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0x40af('0x2')]();config[_0x40af('0x1')]=_[_0x40af('0x3')](config[_0x40af('0x1')],{'database':'motion2','username':_0x40af('0x4'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x40af('0x5'),'dialectOptions':{'charset':_0x40af('0x6')},'logging':![],'timezone':timezone[_0x40af('0x7')](),'define':{'charset':_0x40af('0x8'),'collate':_0x40af('0x9')}}});config[_0x40af('0xa')]=_[_0x40af('0x3')](config[_0x40af('0xa')],{'database':_0x40af('0xb'),'username':'xcall','password':'xC@LL1234','options':{'host':_0x40af('0xc'),'port':0xcea,'dialect':_0x40af('0x5'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x40af('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x40af('0x1')][_0x40af('0xd')],config[_0x40af('0x1')][_0x40af('0xe')],config[_0x40af('0x1')][_0x40af('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x40af('0x10')],config[_0x40af('0xa')][_0x40af('0xd')],config[_0x40af('0xa')][_0x40af('0xe')],config['sequelizeHistory']['options'])};db[_0x40af('0x11')]=db['sequelize'][_0x40af('0x12')]('../api/user/user.model');db[_0x40af('0x13')]=db['sequelize'][_0x40af('0x12')](_0x40af('0x14'));db['VoiceContext']=db['sequelize']['import'](_0x40af('0x15'));db['VoiceExtension']=db['sequelize']['import'](_0x40af('0x16'));db['VoiceMusicOnHold']=db[_0x40af('0x1')][_0x40af('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x17'));db[_0x40af('0x18')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x19'));db[_0x40af('0x1a')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x1b'));db[_0x40af('0x1c')]=db[_0x40af('0x1')][_0x40af('0x12')]('../api/voiceMail/voiceMail.model');db[_0x40af('0x1d')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x1e'));db[_0x40af('0x1f')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x20'));db[_0x40af('0x21')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x22'));db[_0x40af('0x23')]=db['sequelize'][_0x40af('0x12')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x40af('0x24')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x25'));db['MemberReport']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x26'));db[_0x40af('0x27')]=db[_0x40af('0x1')]['import'](_0x40af('0x28'));db[_0x40af('0x29')]=db['sequelize']['import'](_0x40af('0x2a'));db[_0x40af('0x2b')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x2c'));db[_0x40af('0x2d')]=db['sequelize']['import'](_0x40af('0x2e'));db['UserChatQueue']=db[_0x40af('0x1')][_0x40af('0x12')]('../api/userChatQueue/userChatQueue.model');db[_0x40af('0x2f')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x30'));db[_0x40af('0x31')]=db['sequelize'][_0x40af('0x12')](_0x40af('0x32'));db[_0x40af('0x33')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x34'));db['UserOpenchannelQueue']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x35'));db['MailServerIn']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x36'));db[_0x40af('0x37')]=db['sequelize'][_0x40af('0x12')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0x40af('0x1')][_0x40af('0x12')]('../api/mailAccount/mailAccount.model');db[_0x40af('0x38')]=db[_0x40af('0x1')]['import'](_0x40af('0x39'));db['MailSubstatus']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x3a'));db['MailInteraction']=db[_0x40af('0x1')]['import'](_0x40af('0x3b'));db[_0x40af('0x3c')]=db['sequelize'][_0x40af('0x12')](_0x40af('0x3d'));db['MailApplication']=db['sequelize'][_0x40af('0x12')]('../api/mailApplication/mailApplication.model');db[_0x40af('0x3e')]=db[_0x40af('0x1')][_0x40af('0x12')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x3f'));db[_0x40af('0x40')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x41'));db[_0x40af('0x42')]=db[_0x40af('0x1')]['import'](_0x40af('0x43'));db['FaxApplication']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x44'));db[_0x40af('0x45')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x46'));db[_0x40af('0x47')]=db[_0x40af('0x1')][_0x40af('0x12')]('../api/faxMessage/faxMessage.model');db[_0x40af('0x48')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x49'));db[_0x40af('0x4a')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x4b'));db[_0x40af('0x4c')]=db['sequelize'][_0x40af('0x12')](_0x40af('0x4d'));db[_0x40af('0x4e')]=db['sequelize'][_0x40af('0x12')](_0x40af('0x4f'));db[_0x40af('0x50')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x51'));db[_0x40af('0x52')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x53'));db['SmsQueue']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x54'));db[_0x40af('0x55')]=db['sequelize'][_0x40af('0x12')](_0x40af('0x56'));db['OpenchannelApplication']=db['sequelize']['import'](_0x40af('0x57'));db[_0x40af('0x58')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x59'));db[_0x40af('0x5a')]=db[_0x40af('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0x40af('0x5b')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x5c'));db[_0x40af('0x5d')]=db['sequelize'][_0x40af('0x12')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db['sequelize']['import'](_0x40af('0x5e'));db['ChatApplication']=db['sequelize']['import']('../api/chatApplication/chatApplication.model');db[_0x40af('0x5f')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x60'));db['ChatMessage']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x61'));db[_0x40af('0x62')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x63'));db['ChatQueue']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x64'));db['ChatGroup']=db['sequelize']['import'](_0x40af('0x65'));db[_0x40af('0x66')]=db[_0x40af('0x1')]['import'](_0x40af('0x67'));db['CmCompany']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x68'));db[_0x40af('0x69')]=db[_0x40af('0x1')]['import'](_0x40af('0x6a'));db[_0x40af('0x6b')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x6c'));db[_0x40af('0x6d')]=db['sequelize'][_0x40af('0x12')](_0x40af('0x6e'));db[_0x40af('0x6f')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x70'));db['CmHopperHistory']=db['sequelize'][_0x40af('0x12')](_0x40af('0x71'));db[_0x40af('0x72')]=db['sequelize'][_0x40af('0x12')](_0x40af('0x73'));db['CmCustomField']=db['sequelize'][_0x40af('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x40af('0x74')]=db['sequelize'][_0x40af('0x12')](_0x40af('0x75'));db[_0x40af('0x76')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x77'));db[_0x40af('0x78')]=db[_0x40af('0x1')][_0x40af('0x12')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db[_0x40af('0x1')]['import'](_0x40af('0x79'));db[_0x40af('0x7a')]=db['sequelize']['import'](_0x40af('0x7b'));db['Interval']=db[_0x40af('0x1')]['import']('../api/interval/interval.model');db[_0x40af('0x7c')]=db['sequelize'][_0x40af('0x12')](_0x40af('0x7d'));db[_0x40af('0x7e')]=db[_0x40af('0x1')][_0x40af('0x12')]('../api/cdr/cdr.model');db[_0x40af('0x7f')]=db[_0x40af('0x1')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x40af('0x80')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x81'));db['Sound']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x82'));db[_0x40af('0x83')]=db['sequelize']['import']('../api/tag/tag.model');db[_0x40af('0x84')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x85'));db[_0x40af('0x86')]=db[_0x40af('0x1')][_0x40af('0x12')]('../api/trigger/trigger.model');db['Variable']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x87'));db[_0x40af('0x88')]=db[_0x40af('0x1')]['import']('../api/integration/integration.model');db[_0x40af('0x89')]=db[_0x40af('0x1')]['import']('../api/integrationReport/integrationReport.model');db[_0x40af('0x8a')]=db[_0x40af('0x1')][_0x40af('0x12')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x40af('0x8b')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x8c'));db[_0x40af('0x8d')]=db['sequelize'][_0x40af('0x12')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x40af('0x8e')]=db[_0x40af('0x1')][_0x40af('0x12')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x8f'));db['AnalyticTreeReport']=db['sequelize'][_0x40af('0x12')](_0x40af('0x90'));db[_0x40af('0x91')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x92'));db[_0x40af('0x93')]=db['sequelize']['import'](_0x40af('0x94'));db[_0x40af('0x95')]=db[_0x40af('0x1')]['import'](_0x40af('0x96'));db['SugarcrmAccount']=db[_0x40af('0x1')]['import'](_0x40af('0x97'));db[_0x40af('0x98')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x99'));db[_0x40af('0x9a')]=db['sequelize']['import']('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x9b'));db[_0x40af('0x9c')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0x9d'));db[_0x40af('0x9e')]=db['sequelize'][_0x40af('0x12')](_0x40af('0x9f'));db[_0x40af('0xa0')]=db[_0x40af('0x1')]['import'](_0x40af('0xa1'));db['ZohoConfiguration']=db['sequelize']['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x40af('0xa2')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xa3'));db[_0x40af('0xa4')]=db[_0x40af('0x1')]['import'](_0x40af('0xa5'));db['ZendeskConfiguration']=db[_0x40af('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x40af('0xa6')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xa7'));db[_0x40af('0xa8')]=db['sequelize'][_0x40af('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x40af('0xa9')]=db['sequelize']['import'](_0x40af('0xaa'));db[_0x40af('0xab')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xac'));db[_0x40af('0xad')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xae'));db[_0x40af('0xaf')]=db['sequelize'][_0x40af('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x40af('0xb0')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xb1'));db['ServicenowAccount']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xb2'));db[_0x40af('0xb3')]=db[_0x40af('0x1')][_0x40af('0x12')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x40af('0xb4')]=db[_0x40af('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db['sequelize'][_0x40af('0x12')](_0x40af('0xb5'));db[_0x40af('0xb6')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xb7'));db[_0x40af('0xb8')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xb9'));db['FreshsalesAccount']=db[_0x40af('0x1')]['import'](_0x40af('0xba'));db[_0x40af('0xbb')]=db['sequelize'][_0x40af('0x12')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x40af('0xbc')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xbd'));db[_0x40af('0x88')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xbe'));db['Network']=db['sequelize'][_0x40af('0x12')]('../api/network/network.model');db[_0x40af('0xbf')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xc0'));db[_0x40af('0xc1')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xc2'));db[_0x40af('0xc3')]=db['sequelize'][_0x40af('0x12')](_0x40af('0xc4'));db['JscriptyQuestionReport']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xc5'));db[_0x40af('0xc6')]=db[_0x40af('0x1')]['import'](_0x40af('0xc7'));db[_0x40af('0xc8')]=db['sequelize'][_0x40af('0x12')](_0x40af('0xc9'));db['SquareReport']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xca'));db['SquareDetailsReport']=db['sequelize'][_0x40af('0x12')](_0x40af('0xcb'));db[_0x40af('0xcc')]=db[_0x40af('0x1')][_0x40af('0x12')]('../api/jscriptyProject/jscriptyProject.model');db[_0x40af('0xcd')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xce'));db[_0x40af('0xcf')]=db[_0x40af('0x1')]['import'](_0x40af('0xd0'));db['SquareProject']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xd1'));db[_0x40af('0xd2')]=db[_0x40af('0x1')]['import']('../api/squareRecording/squareRecording.model');db[_0x40af('0xd3')]=db['sequelize'][_0x40af('0x12')](_0x40af('0xd4'));db['Team']=db[_0x40af('0x1')]['import']('../api/team/team.model');db['License']=db['sequelize'][_0x40af('0x12')](_0x40af('0xd5'));db['Campaign']=db[_0x40af('0x1')]['import'](_0x40af('0xd6'));db[_0x40af('0xd7')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xd8'));db[_0x40af('0xd9')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xda'));db[_0x40af('0xdb')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xdc'));db['MailTransferReport']=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xdd'));db[_0x40af('0xde')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xdf'));db[_0x40af('0xe0')]=db[_0x40af('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x40af('0xe1')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xe2'));db[_0x40af('0xe3')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xe4'));db['CmList']=db['sequelize'][_0x40af('0x12')](_0x40af('0xe5'));db[_0x40af('0xe6')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xe7'));db[_0x40af('0xe8')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xe9'));db[_0x40af('0xea')]=db['sequelize'][_0x40af('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x40af('0xeb')]=db[_0x40af('0x1')][_0x40af('0x12')](_0x40af('0xec'));db[_0x40af('0x11')][_0x40af('0xed')](db[_0x40af('0x1c')],{'as':_0x40af('0x1c'),'onDelete':'cascade','foreignKey':_0x40af('0xee')});db[_0x40af('0x11')]['hasMany'](db['VoiceRecording'],{'as':_0x40af('0xef'),'foreignKey':_0x40af('0xee')});db['User'][_0x40af('0xf0')](db['UserVoiceQueueRt'],{'as':_0x40af('0xf1'),'foreignKey':'UserId'});db[_0x40af('0x11')][_0x40af('0xf0')](db[_0x40af('0xf2')],{'as':'Extensions','onDelete':_0x40af('0xf3'),'hooks':!![]});db['User'][_0x40af('0xf0')](db[_0x40af('0x6f')],{'as':'HopperFinals','foreignKey':_0x40af('0xee')});db['User'][_0x40af('0xf0')](db[_0x40af('0xf4')],{'as':_0x40af('0xf5'),'foreignKey':_0x40af('0xee')});db[_0x40af('0x11')]['hasMany'](db[_0x40af('0x72')],{'as':_0x40af('0x72'),'foreignKey':'UserId'});db[_0x40af('0x11')][_0x40af('0xf0')](db[_0x40af('0x58')],{'as':'OpenchannelInteractions','foreignKey':_0x40af('0xee')});db[_0x40af('0x11')]['hasMany'](db[_0x40af('0x5f')],{'as':'ChatInteractions','foreignKey':_0x40af('0xee')});db[_0x40af('0x11')][_0x40af('0xf0')](db[_0x40af('0x50')],{'as':_0x40af('0xf6'),'foreignKey':_0x40af('0xee')});db[_0x40af('0x11')][_0x40af('0xf0')](db[_0x40af('0x45')],{'as':_0x40af('0xf7'),'foreignKey':_0x40af('0xee')});db['User'][_0x40af('0xf0')](db['MailInteraction'],{'as':_0x40af('0xf8'),'foreignKey':_0x40af('0xee')});db[_0x40af('0x11')]['belongsTo'](db[_0x40af('0xe8')],{'as':_0x40af('0xe8'),'foreignKey':_0x40af('0xf9')});db['User'][_0x40af('0xfa')](db[_0x40af('0xfb')],{'as':_0x40af('0xfc'),'through':'chat_group_has_users'});db[_0x40af('0x11')][_0x40af('0xfa')](db[_0x40af('0x69')],{'as':_0x40af('0xfd'),'through':_0x40af('0xfe')});db[_0x40af('0x11')][_0x40af('0xfa')](db['CmList'],{'as':_0x40af('0xff'),'through':_0x40af('0x100')});db['User'][_0x40af('0xfa')](db['Team'],{'through':_0x40af('0x101')});db[_0x40af('0x11')][_0x40af('0xfa')](db['MailInteraction'],{'as':_0x40af('0xf8'),'through':_0x40af('0x102')});db['User']['belongsToMany'](db['ChatInteraction'],{'as':_0x40af('0x103'),'through':_0x40af('0x104')});db[_0x40af('0x11')][_0x40af('0xfa')](db['FaxInteraction'],{'as':_0x40af('0xf7'),'through':_0x40af('0x105')});db[_0x40af('0x11')][_0x40af('0xfa')](db[_0x40af('0x50')],{'as':_0x40af('0xf6'),'through':_0x40af('0x106')});db[_0x40af('0x11')][_0x40af('0xfa')](db[_0x40af('0x58')],{'as':_0x40af('0x107'),'through':_0x40af('0x108')});db[_0x40af('0x11')][_0x40af('0xfa')](db[_0x40af('0x109')],{'as':_0x40af('0x10a'),'through':_0x40af('0x2d'),'required':![]});db[_0x40af('0x11')][_0x40af('0xfa')](db[_0x40af('0x38')],{'as':_0x40af('0x10b'),'through':'UserMailQueue','required':![]});db['User'][_0x40af('0xfa')](db['ChatQueue'],{'as':_0x40af('0x10c'),'through':_0x40af('0x10d'),'required':![],'hooks':!![]});db[_0x40af('0x11')][_0x40af('0xfa')](db['FaxQueue'],{'as':_0x40af('0x10e'),'through':'UserFaxQueue','required':![]});db[_0x40af('0x11')]['belongsToMany'](db[_0x40af('0x10f')],{'as':_0x40af('0x110'),'through':_0x40af('0x33'),'required':![]});db[_0x40af('0x11')][_0x40af('0xfa')](db[_0x40af('0x5b')],{'as':_0x40af('0x111'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0x40af('0xfa')](db[_0x40af('0x112')],{'through':'cm_user_has_lists'});db[_0x40af('0x11')]['belongsToMany'](db[_0x40af('0xe6')],{'as':_0x40af('0x113'),'through':_0x40af('0x114'),'required':![]});db['User'][_0x40af('0xfa')](db[_0x40af('0x5d')],{'as':_0x40af('0x115'),'through':'user_has_chat_websites'});db[_0x40af('0x11')][_0x40af('0xfa')](db[_0x40af('0x42')],{'as':_0x40af('0x116'),'through':'user_has_fax_accounts'});db[_0x40af('0x11')][_0x40af('0xfa')](db[_0x40af('0x117')],{'as':_0x40af('0x118'),'through':_0x40af('0x119')});db['User'][_0x40af('0xfa')](db[_0x40af('0x55')],{'as':_0x40af('0x11a'),'through':_0x40af('0x11b')});db['User'][_0x40af('0xfa')](db[_0x40af('0x4c')],{'as':'SmsAccounts','through':_0x40af('0x11c')});db[_0x40af('0x11')][_0x40af('0xfa')](db[_0x40af('0x11d')],{'as':_0x40af('0x11e'),'through':_0x40af('0x11f')});db[_0x40af('0x13')][_0x40af('0xf0')](db[_0x40af('0xf2')],{'as':_0x40af('0x120'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x121')});db['VoiceContext'][_0x40af('0xf0')](db[_0x40af('0xf2')],{'onDelete':_0x40af('0xf3')});db[_0x40af('0xf2')][_0x40af('0xf0')](db[_0x40af('0xf2')],{'as':_0x40af('0x122'),'onDelete':_0x40af('0xf3')});db[_0x40af('0x123')][_0x40af('0xfa')](db[_0x40af('0x124')],{'as':'Sounds','through':_0x40af('0x125')});db['VoiceQueue'][_0x40af('0xf0')](db[_0x40af('0x2b')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x40af('0x109')][_0x40af('0xf0')](db[_0x40af('0x6b')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0x40af('0x109')]['hasMany'](db[_0x40af('0x6f')],{'as':_0x40af('0x126'),'foreignKey':'VoiceQueueId'});db[_0x40af('0x109')][_0x40af('0xf0')](db[_0x40af('0xf4')],{'as':_0x40af('0x127'),'foreignKey':_0x40af('0x128')});db['VoiceQueue'][_0x40af('0xf0')](db['ReportAgentPreview'],{'as':_0x40af('0x72'),'foreignKey':_0x40af('0x128')});db['VoiceQueue'][_0x40af('0xf0')](db[_0x40af('0x6d')],{'as':'HopperBlacks','foreignKey':_0x40af('0x128')});db['VoiceQueue']['hasMany'](db['JscriptySessionReport'],{'as':_0x40af('0x129'),'foreignKey':'VoiceQueueId'});db[_0x40af('0x109')][_0x40af('0x12a')](db['Trunk'],{'as':_0x40af('0x27'),'foreignKey':'TrunkId'});db[_0x40af('0x109')][_0x40af('0x12a')](db['Trunk'],{'as':_0x40af('0x12b'),'foreignKey':_0x40af('0x12c')});db[_0x40af('0x109')][_0x40af('0x12a')](db[_0x40af('0x12d')],{'as':_0x40af('0x12d'),'foreignKey':'IntervalId'});db[_0x40af('0x109')][_0x40af('0x12a')](db[_0x40af('0x7c')],{'as':_0x40af('0x12e'),'foreignKey':_0x40af('0x12f')});db[_0x40af('0x109')]['belongsToMany'](db['CmList'],{'as':_0x40af('0xff'),'through':_0x40af('0x130')});db[_0x40af('0x109')][_0x40af('0xfa')](db[_0x40af('0x11')],{'as':_0x40af('0x131'),'through':'UserVoiceQueue'});db[_0x40af('0x109')][_0x40af('0xfa')](db[_0x40af('0x132')],{'as':_0x40af('0x133'),'through':'team_has_voice_queues'});db[_0x40af('0x109')][_0x40af('0xfa')](db[_0x40af('0x112')],{'as':_0x40af('0x134'),'through':_0x40af('0x135')});db[_0x40af('0x18')][_0x40af('0x12a')](db[_0x40af('0x11')],{'as':_0x40af('0x11'),'foreignKey':_0x40af('0xee')});db[_0x40af('0x1a')][_0x40af('0x12a')](db[_0x40af('0x11')],{'as':_0x40af('0x11'),'foreignKey':_0x40af('0xee')});db['VoiceMail']['hasMany'](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x40af('0xf3'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db['VoiceMailMessage'][_0x40af('0x12a')](db['VoiceMail'],{'foreignKey':_0x40af('0x136'),'targetKey':_0x40af('0x137')});db['VoiceCallReport'][_0x40af('0xf0')](db[_0x40af('0x24')],{'as':'QueueCalls','foreignKey':_0x40af('0x138'),'constraints':![]});db[_0x40af('0x1f')][_0x40af('0xf0')](db[_0x40af('0x23')],{'as':_0x40af('0x139'),'foreignKey':_0x40af('0x138'),'constraints':![]});db[_0x40af('0x1f')][_0x40af('0x12a')](db[_0x40af('0x11')],{'as':'User','foreignKey':_0x40af('0xee')});db[_0x40af('0x1f')][_0x40af('0x12a')](db[_0x40af('0x69')],{'as':'Contact','foreignKey':_0x40af('0x13a')});db['MailServerIn']['belongsTo'](db[_0x40af('0x117')],{'as':_0x40af('0x117'),'foreignKey':'MailAccountId'});db[_0x40af('0x37')]['belongsTo'](db[_0x40af('0x117')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x40af('0x117')][_0x40af('0xed')](db[_0x40af('0x13b')],{'as':_0x40af('0x13c'),'onDelete':_0x40af('0xf3')});db[_0x40af('0x117')][_0x40af('0xed')](db['MailServerOut'],{'as':_0x40af('0x13d'),'onDelete':_0x40af('0xf3')});db['MailAccount'][_0x40af('0xf0')](db[_0x40af('0x13e')],{'as':'Dispositions','foreignKey':_0x40af('0x13f')});db[_0x40af('0x117')]['hasMany'](db[_0x40af('0x78')],{'as':_0x40af('0x140'),'foreignKey':_0x40af('0x13f')});db['MailAccount'][_0x40af('0xf0')](db['MailMessage'],{'as':_0x40af('0x141'),'foreignKey':_0x40af('0x13f')});db[_0x40af('0x117')][_0x40af('0xf0')](db['MailInteraction'],{'as':_0x40af('0x142')});db[_0x40af('0x117')][_0x40af('0xf0')](db['MailApplication'],{'as':_0x40af('0x122')});db[_0x40af('0x117')][_0x40af('0x12a')](db[_0x40af('0x112')],{'as':_0x40af('0x143'),'foreignKey':_0x40af('0x144')});db[_0x40af('0x117')][_0x40af('0x12a')](db[_0x40af('0x84')],{'as':_0x40af('0x84'),'foreignKey':_0x40af('0x145')});db[_0x40af('0x117')][_0x40af('0x12a')](db[_0x40af('0x7c')],{'as':'mandatoryDispositionPause','foreignKey':_0x40af('0x12f')});db[_0x40af('0x117')][_0x40af('0xfa')](db[_0x40af('0x11')],{'as':_0x40af('0x131'),'through':_0x40af('0x119')});db[_0x40af('0x38')][_0x40af('0xfa')](db[_0x40af('0x11')],{'as':'Agents','through':_0x40af('0x2f')});db[_0x40af('0x38')]['belongsToMany'](db['Team'],{'through':'team_has_mail_queues','as':_0x40af('0x133')});db[_0x40af('0x146')][_0x40af('0xf0')](db['MailMessage'],{'as':_0x40af('0x141'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x147')});db[_0x40af('0x146')]['belongsTo'](db[_0x40af('0x117')],{'as':_0x40af('0x148'),'foreignKey':_0x40af('0x13f')});db['MailInteraction']['belongsTo'](db['CmContact'],{'as':_0x40af('0x149'),'foreignKey':'ContactId'});db[_0x40af('0x146')]['belongsTo'](db[_0x40af('0x11')],{'as':'Owner','foreignKey':_0x40af('0xee')});db[_0x40af('0x146')][_0x40af('0xfa')](db[_0x40af('0x83')],{'through':_0x40af('0x14a'),'as':_0x40af('0x14b')});db[_0x40af('0x146')][_0x40af('0xfa')](db[_0x40af('0x83')],{'through':_0x40af('0x14a'),'as':_0x40af('0x14c')});db[_0x40af('0x146')][_0x40af('0xfa')](db[_0x40af('0x11')],{'as':_0x40af('0x14d'),'through':'user_has_mail_interactions','foreignKey':_0x40af('0x147')});db[_0x40af('0x3c')][_0x40af('0xf0')](db[_0x40af('0xd9')],{'as':_0x40af('0x14e'),'onDelete':_0x40af('0xf3')});db[_0x40af('0x3c')]['belongsTo'](db[_0x40af('0x11')],{'as':'User'});db['MailMessage']['belongsTo'](db[_0x40af('0x69')],{'onDelete':_0x40af('0xf3'),'as':_0x40af('0x149')});db[_0x40af('0x3c')]['belongsTo'](db[_0x40af('0x146')],{'as':_0x40af('0x14f'),'foreignKey':'MailInteractionId'});db[_0x40af('0x3c')][_0x40af('0x12a')](db['MailAccount'],{'as':_0x40af('0x148'),'foreignKey':'MailAccountId'});db[_0x40af('0x150')][_0x40af('0x12a')](db[_0x40af('0x11')],{'onDelete':_0x40af('0x151')});db['MailApplication']['belongsTo'](db[_0x40af('0x38')],{'onDelete':_0x40af('0x151')});db['MailApplication'][_0x40af('0x12a')](db['MailAccount'],{'onDelete':_0x40af('0x151')});db['MailApplication'][_0x40af('0x12a')](db['Interval'],{'onDelete':_0x40af('0x151'),'foreignKey':'IntervalId'});db[_0x40af('0x150')][_0x40af('0x12a')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x40af('0x152')});db[_0x40af('0x3e')]['belongsTo'](db[_0x40af('0x117')],{});db[_0x40af('0x3e')][_0x40af('0x12a')](db[_0x40af('0x112')],{'as':_0x40af('0x143'),'foreignKey':'ListId'});db[_0x40af('0x3e')]['belongsTo'](db[_0x40af('0x69')],{'as':_0x40af('0x149'),'foreignKey':_0x40af('0x13a')});db[_0x40af('0x3e')][_0x40af('0x12a')](db[_0x40af('0x146')],{});db[_0x40af('0x3e')]['belongsTo'](db[_0x40af('0x3c')],{});db[_0x40af('0x3e')][_0x40af('0x12a')](db[_0x40af('0x11')],{});db[_0x40af('0x3e')][_0x40af('0x12a')](db['MailQueue'],{});db['Dashboard']['hasMany'](db[_0x40af('0x40')],{'as':_0x40af('0x153'),'onDelete':'cascade'});db['FaxAccount'][_0x40af('0xf0')](db[_0x40af('0x13e')],{'as':'Dispositions','foreignKey':_0x40af('0x154')});db[_0x40af('0x42')]['hasMany'](db[_0x40af('0x78')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x40af('0x42')]['hasMany'](db['FaxInteraction'],{'as':_0x40af('0x142')});db[_0x40af('0x42')]['hasMany'](db['FaxApplication'],{'as':_0x40af('0x122')});db[_0x40af('0x42')][_0x40af('0xf0')](db[_0x40af('0xf2')],{'as':'Exntensions','onDelete':'cascade'});db[_0x40af('0x42')][_0x40af('0xf0')](db[_0x40af('0x47')],{'as':_0x40af('0x141')});db[_0x40af('0x42')][_0x40af('0x12a')](db[_0x40af('0x27')],{'as':_0x40af('0x27')});db[_0x40af('0x42')][_0x40af('0x12a')](db['CmList'],{'as':'List','foreignKey':_0x40af('0x144')});db[_0x40af('0x42')]['belongsTo'](db[_0x40af('0x7c')],{'as':_0x40af('0x12e'),'foreignKey':_0x40af('0x12f')});db[_0x40af('0x42')][_0x40af('0xfa')](db['User'],{'as':'Agents','through':_0x40af('0x155')});db['FaxApplication'][_0x40af('0x12a')](db[_0x40af('0x11')],{'onDelete':_0x40af('0x151')});db[_0x40af('0x156')][_0x40af('0x12a')](db[_0x40af('0x48')],{'onDelete':'restrict'});db[_0x40af('0x156')][_0x40af('0x12a')](db['FaxAccount'],{'onDelete':_0x40af('0x151')});db[_0x40af('0x156')][_0x40af('0x12a')](db[_0x40af('0x83')],{'onDelete':_0x40af('0x151'),'foreignKey':_0x40af('0x152')});db['FaxInteraction'][_0x40af('0xf0')](db[_0x40af('0x47')],{'as':'Messages','onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x157')});db[_0x40af('0x45')][_0x40af('0x12a')](db['FaxAccount'],{'as':'Account','foreignKey':'FaxAccountId'});db['FaxInteraction']['belongsTo'](db[_0x40af('0x69')],{'as':_0x40af('0x149'),'foreignKey':_0x40af('0x13a')});db[_0x40af('0x45')][_0x40af('0x12a')](db[_0x40af('0x11')],{'as':_0x40af('0x158'),'foreignKey':_0x40af('0xee')});db[_0x40af('0x45')][_0x40af('0xfa')](db[_0x40af('0x83')],{'through':_0x40af('0x159'),'as':_0x40af('0x14b')});db[_0x40af('0x45')][_0x40af('0xfa')](db[_0x40af('0x83')],{'through':'fax_interaction_has_tags','as':_0x40af('0x14c')});db[_0x40af('0x45')][_0x40af('0xfa')](db[_0x40af('0x11')],{'as':'Users','through':_0x40af('0x105'),'foreignKey':_0x40af('0x157')});db['FaxMessage'][_0x40af('0x12a')](db[_0x40af('0x11')],{'onDelete':_0x40af('0xf3'),'as':_0x40af('0x11')});db[_0x40af('0x47')]['belongsTo'](db[_0x40af('0x45')],{'as':_0x40af('0x14f'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x40af('0x12a')](db['CmContact'],{'onDelete':'cascade','as':_0x40af('0x149')});db[_0x40af('0x47')]['belongsTo'](db[_0x40af('0xd9')],{'as':'Attachment','foreignKey':_0x40af('0x15a')});db[_0x40af('0x47')][_0x40af('0x12a')](db['FaxAccount'],{'as':_0x40af('0x148'),'foreignKey':_0x40af('0x154')});db[_0x40af('0x48')][_0x40af('0xfa')](db['User'],{'as':_0x40af('0x131'),'through':_0x40af('0x31')});db[_0x40af('0x48')][_0x40af('0xfa')](db['Team'],{'through':_0x40af('0x15b'),'as':'Teams'});db[_0x40af('0x4a')][_0x40af('0x12a')](db[_0x40af('0x42')],{});db[_0x40af('0x4a')][_0x40af('0x12a')](db[_0x40af('0x112')],{'as':_0x40af('0x143'),'foreignKey':_0x40af('0x144')});db[_0x40af('0x4a')][_0x40af('0x12a')](db[_0x40af('0x69')],{'as':_0x40af('0x149'),'foreignKey':_0x40af('0x13a')});db[_0x40af('0x4a')][_0x40af('0x12a')](db[_0x40af('0x45')],{});db[_0x40af('0x4a')][_0x40af('0x12a')](db[_0x40af('0x47')],{});db[_0x40af('0x4a')]['belongsTo'](db[_0x40af('0x11')],{});db[_0x40af('0x4a')][_0x40af('0x12a')](db[_0x40af('0x48')],{});db['SmsAccount'][_0x40af('0xf0')](db[_0x40af('0x13e')],{'as':_0x40af('0x15c'),'foreignKey':_0x40af('0x15d')});db[_0x40af('0x4c')][_0x40af('0xf0')](db[_0x40af('0x78')],{'as':_0x40af('0x140'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x40af('0xf0')](db[_0x40af('0x52')],{'as':_0x40af('0x141'),'foreignKey':_0x40af('0x15d')});db[_0x40af('0x4c')][_0x40af('0xf0')](db[_0x40af('0x50')],{'as':_0x40af('0x142')});db[_0x40af('0x4c')][_0x40af('0xf0')](db[_0x40af('0x4e')],{'as':'Applications'});db[_0x40af('0x4c')][_0x40af('0x12a')](db['CmList'],{'as':'List','foreignKey':_0x40af('0x144')});db[_0x40af('0x4c')][_0x40af('0x12a')](db[_0x40af('0x7c')],{'as':_0x40af('0x12e'),'foreignKey':_0x40af('0x12f')});db[_0x40af('0x4c')][_0x40af('0xfa')](db[_0x40af('0x11')],{'as':_0x40af('0x131'),'through':'user_has_sms_accounts'});db['SmsApplication']['belongsTo'](db[_0x40af('0x11')],{'onDelete':'restrict'});db[_0x40af('0x4e')][_0x40af('0x12a')](db[_0x40af('0x10f')],{'onDelete':_0x40af('0x151')});db[_0x40af('0x4e')]['belongsTo'](db[_0x40af('0x4c')],{'onDelete':_0x40af('0x151')});db[_0x40af('0x4e')][_0x40af('0x12a')](db[_0x40af('0x12d')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x40af('0x4e')][_0x40af('0x12a')](db[_0x40af('0x83')],{'onDelete':_0x40af('0x151'),'foreignKey':_0x40af('0x152')});db['SmsInteraction'][_0x40af('0xf0')](db['SmsMessage'],{'as':'Messages','onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x15e')});db['SmsInteraction']['belongsTo'](db[_0x40af('0x4c')],{'as':_0x40af('0x148'),'foreignKey':_0x40af('0x15d')});db[_0x40af('0x50')][_0x40af('0x12a')](db['CmContact'],{'as':_0x40af('0x149'),'foreignKey':_0x40af('0x13a')});db[_0x40af('0x50')][_0x40af('0x12a')](db[_0x40af('0x11')],{'as':'Owner','foreignKey':_0x40af('0xee')});db['SmsInteraction'][_0x40af('0xfa')](db[_0x40af('0x83')],{'through':_0x40af('0x15f'),'as':_0x40af('0x14b')});db[_0x40af('0x50')][_0x40af('0xfa')](db['Tag'],{'through':_0x40af('0x15f'),'as':_0x40af('0x14c')});db[_0x40af('0x50')]['belongsToMany'](db[_0x40af('0x11')],{'as':_0x40af('0x14d'),'through':_0x40af('0x106'),'foreignKey':_0x40af('0x15e')});db['SmsMessage']['belongsTo'](db[_0x40af('0x11')],{'as':_0x40af('0x11')});db[_0x40af('0x52')][_0x40af('0x12a')](db[_0x40af('0x69')],{'onDelete':_0x40af('0xf3'),'as':_0x40af('0x149')});db[_0x40af('0x52')][_0x40af('0x12a')](db[_0x40af('0x50')],{'onDelete':'cascade','as':_0x40af('0x14f'),'foreignKey':_0x40af('0x15e')});db[_0x40af('0x52')][_0x40af('0x12a')](db[_0x40af('0x4c')],{'as':_0x40af('0x148'),'foreignKey':_0x40af('0x15d')});db[_0x40af('0x10f')]['belongsToMany'](db[_0x40af('0x11')],{'as':'Agents','through':_0x40af('0x33'),'foreignKey':'SmsQueueId'});db[_0x40af('0x10f')][_0x40af('0xfa')](db[_0x40af('0x132')],{'through':_0x40af('0x160'),'as':_0x40af('0x133')});db['OpenchannelAccount'][_0x40af('0xf0')](db['Disposition'],{'as':_0x40af('0x15c'),'foreignKey':_0x40af('0x161')});db[_0x40af('0x55')][_0x40af('0xf0')](db['CannedAnswer'],{'as':_0x40af('0x140'),'foreignKey':_0x40af('0x161')});db[_0x40af('0x55')][_0x40af('0xf0')](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':_0x40af('0x161')});db['OpenchannelAccount'][_0x40af('0xf0')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x40af('0x161')});db['OpenchannelAccount']['hasMany'](db[_0x40af('0x162')],{'as':_0x40af('0x122'),'foreignKey':_0x40af('0x161')});db[_0x40af('0x55')]['belongsTo'](db['CmList'],{'as':_0x40af('0x143'),'foreignKey':_0x40af('0x144')});db[_0x40af('0x55')][_0x40af('0x12a')](db[_0x40af('0x7c')],{'as':'mandatoryDispositionPause','foreignKey':_0x40af('0x12f')});db['OpenchannelAccount'][_0x40af('0xfa')](db[_0x40af('0x11')],{'as':_0x40af('0x131'),'through':'user_has_openchannel_accounts'});db[_0x40af('0x162')][_0x40af('0x12a')](db[_0x40af('0x11')],{'onDelete':_0x40af('0x151')});db['OpenchannelApplication'][_0x40af('0x12a')](db[_0x40af('0x5b')],{'onDelete':_0x40af('0x151'),'foreignKey':_0x40af('0x163')});db[_0x40af('0x162')][_0x40af('0x12a')](db[_0x40af('0x55')],{'onDelete':_0x40af('0x151'),'foreignKey':_0x40af('0x161')});db['OpenchannelApplication'][_0x40af('0x12a')](db['Interval'],{'onDelete':_0x40af('0x151'),'foreignKey':'IntervalId'});db[_0x40af('0x162')][_0x40af('0x12a')](db[_0x40af('0x83')],{'onDelete':_0x40af('0x151'),'foreignKey':'TagId'});db[_0x40af('0x58')][_0x40af('0xf0')](db['OpenchannelMessage'],{'as':_0x40af('0x141'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x164')});db[_0x40af('0x58')][_0x40af('0x12a')](db[_0x40af('0x55')],{'as':_0x40af('0x148'),'foreignKey':_0x40af('0x161')});db[_0x40af('0x58')][_0x40af('0x12a')](db[_0x40af('0x69')],{'as':'Contact','foreignKey':'ContactId'});db[_0x40af('0x58')][_0x40af('0x12a')](db['User'],{'as':'Owner','foreignKey':_0x40af('0xee')});db[_0x40af('0x58')]['belongsToMany'](db[_0x40af('0x83')],{'through':_0x40af('0x165'),'as':_0x40af('0x14b')});db[_0x40af('0x58')]['belongsToMany'](db[_0x40af('0x83')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db['OpenchannelInteraction']['belongsToMany'](db[_0x40af('0x11')],{'as':_0x40af('0x14d'),'through':'user_has_openchannel_interactions','foreignKey':_0x40af('0x164')});db[_0x40af('0x5a')]['belongsTo'](db[_0x40af('0x11')],{'onDelete':_0x40af('0xf3'),'as':'User'});db[_0x40af('0x5a')][_0x40af('0x12a')](db[_0x40af('0x69')],{'onDelete':'cascade','as':_0x40af('0x149')});db[_0x40af('0x5a')][_0x40af('0x12a')](db[_0x40af('0x58')],{'onDelete':_0x40af('0xf3'),'as':_0x40af('0x14f'),'foreignKey':_0x40af('0x164')});db[_0x40af('0x5a')]['belongsTo'](db[_0x40af('0xd9')],{'as':_0x40af('0xd9'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x40af('0x12a')](db[_0x40af('0x55')],{'as':'Account','foreignKey':_0x40af('0x161')});db[_0x40af('0x5b')][_0x40af('0xfa')](db[_0x40af('0x11')],{'as':_0x40af('0x131'),'through':_0x40af('0x166'),'foreignKey':'OpenchannelQueueId'});db[_0x40af('0x5b')]['belongsToMany'](db['Team'],{'through':_0x40af('0x167'),'as':_0x40af('0x133')});db['ChatWebsite'][_0x40af('0xf0')](db[_0x40af('0x13e')],{'as':'Dispositions','foreignKey':_0x40af('0x168')});db['ChatWebsite'][_0x40af('0xf0')](db[_0x40af('0x78')],{'as':_0x40af('0x140'),'foreignKey':_0x40af('0x168')});db[_0x40af('0x5d')][_0x40af('0xf0')](db[_0x40af('0x66')],{'as':'ProactiveActions'});db[_0x40af('0x5d')][_0x40af('0xf0')](db['ChatInteraction'],{'as':_0x40af('0x142')});db[_0x40af('0x5d')][_0x40af('0xf0')](db['ChatApplication'],{'as':_0x40af('0x122')});db[_0x40af('0x5d')]['hasMany'](db[_0x40af('0x169')],{'as':'Messages'});db[_0x40af('0x5d')]['belongsTo'](db[_0x40af('0x112')],{'as':_0x40af('0x143'),'foreignKey':_0x40af('0x144')});db['ChatWebsite']['belongsTo'](db[_0x40af('0x12d')],{'as':_0x40af('0x12d'),'foreignKey':'IntervalId'});db[_0x40af('0x5d')]['belongsTo'](db[_0x40af('0x7c')],{'as':'mandatoryDispositionPause','foreignKey':_0x40af('0x12f')});db[_0x40af('0x5d')][_0x40af('0xfa')](db[_0x40af('0x11')],{'as':_0x40af('0x131'),'through':_0x40af('0x16a')});db[_0x40af('0x16b')][_0x40af('0x12a')](db[_0x40af('0x55')],{});db[_0x40af('0x16b')][_0x40af('0x12a')](db['CmList'],{'as':'List','foreignKey':_0x40af('0x144')});db[_0x40af('0x16b')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x40af('0x16b')][_0x40af('0x12a')](db['OpenchannelInteraction'],{});db[_0x40af('0x16b')][_0x40af('0x12a')](db[_0x40af('0x5a')],{});db[_0x40af('0x16b')]['belongsTo'](db[_0x40af('0x11')],{});db[_0x40af('0x16b')][_0x40af('0x12a')](db[_0x40af('0x5b')],{});db['ChatApplication'][_0x40af('0x12a')](db[_0x40af('0x11')],{'as':_0x40af('0x16c'),'foreignKey':_0x40af('0xee'),'onDelete':_0x40af('0x151')});db[_0x40af('0x16d')][_0x40af('0x12a')](db['ChatQueue'],{'as':'Queue','foreignKey':_0x40af('0x16e'),'onDelete':_0x40af('0x151')});db['ChatApplication'][_0x40af('0x12a')](db[_0x40af('0x5d')],{'as':_0x40af('0x16f'),'foreignKey':'ChatWebsiteId','onDelete':_0x40af('0x151')});db[_0x40af('0x16d')][_0x40af('0x12a')](db[_0x40af('0x83')],{'onDelete':_0x40af('0x151'),'foreignKey':_0x40af('0x152')});db[_0x40af('0x5f')][_0x40af('0xf0')](db['ChatMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x40af('0x170')});db[_0x40af('0x5f')][_0x40af('0x12a')](db[_0x40af('0x5d')],{'as':_0x40af('0x148'),'foreignKey':_0x40af('0x168')});db['ChatInteraction'][_0x40af('0x12a')](db[_0x40af('0x69')],{'as':_0x40af('0x149'),'foreignKey':_0x40af('0x13a')});db['ChatInteraction'][_0x40af('0x12a')](db[_0x40af('0x11')],{'as':'Owner','foreignKey':_0x40af('0xee')});db[_0x40af('0x5f')][_0x40af('0xfa')](db[_0x40af('0x83')],{'through':_0x40af('0x171'),'as':'Tags'});db[_0x40af('0x5f')][_0x40af('0xfa')](db['Tag'],{'through':_0x40af('0x171'),'as':'ThroughTags'});db[_0x40af('0x5f')]['belongsToMany'](db[_0x40af('0x11')],{'as':_0x40af('0x14d'),'through':_0x40af('0x104'),'foreignKey':_0x40af('0x170')});db['ChatMessage']['belongsTo'](db[_0x40af('0x11')],{'onDelete':_0x40af('0xf3'),'as':'User'});db[_0x40af('0x169')][_0x40af('0x12a')](db['CmContact'],{'onDelete':_0x40af('0xf3'),'as':'Contact','foreignKey':_0x40af('0x13a')});db[_0x40af('0x169')][_0x40af('0x12a')](db[_0x40af('0x5f')],{'onDelete':_0x40af('0xf3'),'as':_0x40af('0x14f'),'foreignKey':_0x40af('0x170')});db[_0x40af('0x169')]['belongsTo'](db['Attachment'],{'as':_0x40af('0xd9'),'foreignKey':'AttachmentId'});db['ChatMessage'][_0x40af('0x12a')](db[_0x40af('0x5d')],{'as':_0x40af('0x148'),'foreignKey':_0x40af('0x168')});db['ChatOfflineMessage'][_0x40af('0x12a')](db[_0x40af('0x69')],{'onDelete':_0x40af('0xf3'),'as':_0x40af('0x149'),'foreignKey':_0x40af('0x13a')});db[_0x40af('0x62')][_0x40af('0x12a')](db[_0x40af('0x5d')],{'as':_0x40af('0x148'),'foreignKey':_0x40af('0x168')});db[_0x40af('0x172')]['belongsToMany'](db[_0x40af('0x11')],{'as':_0x40af('0x131'),'through':_0x40af('0x10d'),'hooks':!![]});db[_0x40af('0x172')][_0x40af('0xfa')](db['Team'],{'through':_0x40af('0x173'),'as':_0x40af('0x133')});db[_0x40af('0xfb')][_0x40af('0xf0')](db[_0x40af('0xc1')],{'as':_0x40af('0x141'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0x40af('0xfb')][_0x40af('0xfa')](db[_0x40af('0x11')],{'as':'Members','through':_0x40af('0x174')});db['ChatProactiveAction'][_0x40af('0x12a')](db['ChatWebsite'],{'as':'Website','foreignKey':_0x40af('0x168')});db[_0x40af('0x175')][_0x40af('0xf0')](db[_0x40af('0x69')],{'as':'Contacts','foreignKey':_0x40af('0x176')});db[_0x40af('0x69')]['hasMany'](db[_0x40af('0x6b')],{'as':_0x40af('0x177'),'foreignKey':_0x40af('0x13a')});db['CmContact'][_0x40af('0xf0')](db[_0x40af('0x6f')],{'as':_0x40af('0x126'),'foreignKey':'ContactId'});db[_0x40af('0x69')][_0x40af('0xf0')](db[_0x40af('0xf4')],{'as':_0x40af('0x127'),'foreignKey':'ContactId'});db[_0x40af('0x69')][_0x40af('0xf0')](db[_0x40af('0x72')],{'as':_0x40af('0x72'),'foreignKey':'ContactId'});db[_0x40af('0x69')][_0x40af('0xf0')](db[_0x40af('0xc6')],{'as':'JscriptySessions','foreignKey':_0x40af('0x13a')});db[_0x40af('0x69')][_0x40af('0xf0')](db[_0x40af('0x58')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x40af('0x151')});db['CmContact']['hasMany'](db[_0x40af('0x5f')],{'as':_0x40af('0x103'),'foreignKey':'ContactId','onDelete':_0x40af('0x151')});db[_0x40af('0x69')]['hasMany'](db[_0x40af('0x50')],{'as':_0x40af('0xf6'),'foreignKey':_0x40af('0x13a'),'onDelete':'restrict'});db[_0x40af('0x69')]['hasMany'](db[_0x40af('0x45')],{'as':'FaxInteractions','foreignKey':_0x40af('0x13a'),'onDelete':_0x40af('0x151')});db[_0x40af('0x69')][_0x40af('0xf0')](db['MailInteraction'],{'as':_0x40af('0xf8'),'foreignKey':_0x40af('0x13a'),'onDelete':_0x40af('0x151')});db['CmContact'][_0x40af('0x12a')](db[_0x40af('0x175')],{'as':_0x40af('0x178'),'foreignKey':'CompanyId'});db['CmContact'][_0x40af('0x12a')](db['CmList'],{'as':_0x40af('0x143'),'foreignKey':'ListId','onDelete':_0x40af('0xf3')});db[_0x40af('0x69')][_0x40af('0xfa')](db['User'],{'as':_0x40af('0x14d'),'through':_0x40af('0xfe')});db[_0x40af('0x69')]['belongsToMany'](db[_0x40af('0x83')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x40af('0x69')][_0x40af('0xfa')](db[_0x40af('0x83')],{'through':_0x40af('0x179'),'as':'ThroughTags'});db[_0x40af('0x6b')][_0x40af('0x12a')](db['CmContact'],{'as':_0x40af('0x149'),'foreignKey':_0x40af('0x13a'),'onDelete':_0x40af('0xf3')});db[_0x40af('0x6b')][_0x40af('0x12a')](db[_0x40af('0x112')],{'as':_0x40af('0x143'),'foreignKey':_0x40af('0x144'),'onDelete':_0x40af('0xf3')});db[_0x40af('0x6b')]['belongsTo'](db['User'],{'as':_0x40af('0x16c'),'foreignKey':_0x40af('0xee')});db[_0x40af('0x6b')][_0x40af('0x12a')](db[_0x40af('0x109')],{'as':_0x40af('0x17a'),'foreignKey':_0x40af('0x128'),'onDelete':_0x40af('0xf3')});db[_0x40af('0x6b')]['belongsTo'](db[_0x40af('0x17b')],{'as':_0x40af('0x17b'),'foreignKey':_0x40af('0x17c'),'onDelete':'cascade'});db[_0x40af('0x6b')][_0x40af('0x12a')](db[_0x40af('0x11')],{'as':_0x40af('0x158'),'foreignKey':_0x40af('0x17d')});db[_0x40af('0x6d')]['belongsTo'](db[_0x40af('0x69')],{'as':_0x40af('0x149'),'foreignKey':_0x40af('0x13a'),'onDelete':'cascade'});db[_0x40af('0x6d')][_0x40af('0x12a')](db[_0x40af('0x112')],{'as':'List','foreignKey':_0x40af('0x144'),'onDelete':_0x40af('0xf3')});db[_0x40af('0x6d')][_0x40af('0x12a')](db[_0x40af('0x109')],{'as':_0x40af('0x17a'),'foreignKey':_0x40af('0x128'),'onDelete':'cascade'});db[_0x40af('0x6d')][_0x40af('0x12a')](db[_0x40af('0x17b')],{'as':_0x40af('0x17b'),'foreignKey':_0x40af('0x17c'),'onDelete':_0x40af('0xf3')});db['Automation'][_0x40af('0xf0')](db['Condition'],{'as':{'plural':_0x40af('0x17e'),'singular':_0x40af('0x17f')},'foreignKey':_0x40af('0x180'),'onDelete':_0x40af('0xf3'),'hooks':!![]});db[_0x40af('0x76')][_0x40af('0xf0')](db[_0x40af('0x7a')],{'as':{'plural':_0x40af('0x181'),'singular':_0x40af('0x182')},'foreignKey':'AutomationAnyId','onDelete':_0x40af('0xf3'),'hooks':!![]});db[_0x40af('0x76')]['hasMany'](db['Action'],{'as':_0x40af('0x183'),'foreignKey':_0x40af('0x184'),'onDelete':'cascade','hooks':!![]});db[_0x40af('0x12d')]['hasMany'](db[_0x40af('0x12d')],{'as':_0x40af('0x185'),'foreignKey':_0x40af('0x186'),'onDelete':_0x40af('0xf3'),'hooks':!![],'required':![]});db[_0x40af('0x12d')][_0x40af('0xf0')](db['VoiceExtension'],{'as':_0x40af('0x187'),'foreignKey':_0x40af('0x186'),'onDelete':_0x40af('0x151')});db['Interval'][_0x40af('0xf0')](db[_0x40af('0x150')],{'as':_0x40af('0x188'),'foreignKey':_0x40af('0x186')});db[_0x40af('0x12d')][_0x40af('0xf0')](db[_0x40af('0x16d')],{'as':_0x40af('0x189'),'foreignKey':'IntervalId'});db[_0x40af('0x12d')][_0x40af('0xf0')](db[_0x40af('0x156')],{'as':_0x40af('0x18a'),'foreignKey':'IntervalId'});db['Interval'][_0x40af('0xf0')](db[_0x40af('0x4e')],{'as':_0x40af('0x18b'),'foreignKey':_0x40af('0x186')});db[_0x40af('0x80')][_0x40af('0x12a')](db[_0x40af('0x117')],{});db[_0x40af('0x80')][_0x40af('0x12a')](db[_0x40af('0x8b')],{'foreignKey':_0x40af('0x18c')});db[_0x40af('0x80')]['belongsTo'](db[_0x40af('0x8a')],{'foreignKey':_0x40af('0x18d')});db[_0x40af('0x124')][_0x40af('0xfa')](db[_0x40af('0x123')],{'as':_0x40af('0x18e'),'through':'moh_has_sounds','onDelete':_0x40af('0x151')});db['Tag'][_0x40af('0xfa')](db[_0x40af('0x69')],{'through':'cm_contact_has_tags'});db[_0x40af('0x83')][_0x40af('0xfa')](db[_0x40af('0x5f')],{'through':_0x40af('0x171')});db[_0x40af('0x83')][_0x40af('0xfa')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x40af('0x83')][_0x40af('0xfa')](db[_0x40af('0x50')],{'through':_0x40af('0x15f')});db[_0x40af('0x83')][_0x40af('0xfa')](db[_0x40af('0x45')],{'through':_0x40af('0x159')});db[_0x40af('0x83')]['belongsToMany'](db[_0x40af('0x58')],{'through':_0x40af('0x165')});db['Trigger'][_0x40af('0xf0')](db[_0x40af('0x7a')],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':_0x40af('0xf3'),'hooks':!![]});db['Trigger'][_0x40af('0xf0')](db[_0x40af('0x7a')],{'as':{'plural':_0x40af('0x18f'),'singular':'AnyCondition'},'foreignKey':'TriggerAnyId','onDelete':_0x40af('0xf3'),'hooks':!![]});db['Trigger'][_0x40af('0xf0')](db['Action'],{'as':'Actions','foreignKey':_0x40af('0x190'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x40af('0x191')],{'as':_0x40af('0x192'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x18d'),'hooks':!![]});db['AnalyticDefaultReport'][_0x40af('0xf0')](db['AnalyticFieldReport'],{'as':_0x40af('0x192'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x18c')});db['AnalyticMetric'][_0x40af('0xf0')](db[_0x40af('0x191')],{'as':_0x40af('0x192'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x193')});db[_0x40af('0x191')]['belongsTo'](db[_0x40af('0x8e')],{'foreignKey':_0x40af('0x193')});db[_0x40af('0x91')][_0x40af('0xf0')](db['SalesforceConfiguration'],{'as':_0x40af('0x194'),'onDelete':_0x40af('0xf3'),'foreignKey':'AccountId'});db[_0x40af('0x93')][_0x40af('0xf0')](db[_0x40af('0x95')],{'as':_0x40af('0x195'),'onDelete':_0x40af('0xf3'),'foreignKey':'SubjectId'});db[_0x40af('0x93')][_0x40af('0xf0')](db[_0x40af('0x95')],{'as':_0x40af('0x196'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x197')});db['SalesforceConfiguration']['hasMany'](db[_0x40af('0x95')],{'as':_0x40af('0x192'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x198')});db[_0x40af('0x93')][_0x40af('0x12a')](db['SalesforceAccount'],{'as':'Account','foreignKey':'AccountId'});db['SalesforceField'][_0x40af('0xf0')](db[_0x40af('0x95')],{'as':_0x40af('0x199'),'foreignKey':_0x40af('0x19a')});db[_0x40af('0x95')][_0x40af('0xf0')](db[_0x40af('0x95')],{'as':_0x40af('0x19b'),'foreignKey':_0x40af('0x197')});db[_0x40af('0x95')]['hasMany'](db[_0x40af('0x95')],{'as':_0x40af('0x19c'),'foreignKey':_0x40af('0x198')});db[_0x40af('0x95')][_0x40af('0x12a')](db['Variable'],{'as':_0x40af('0x19d'),'foreignKey':_0x40af('0x19e')});db['SugarcrmAccount']['hasMany'](db[_0x40af('0x98')],{'as':_0x40af('0x194'),'onDelete':'cascade','foreignKey':_0x40af('0x19f')});db[_0x40af('0x98')][_0x40af('0xf0')](db[_0x40af('0x9a')],{'as':_0x40af('0x195'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x19a')});db[_0x40af('0x98')][_0x40af('0xf0')](db[_0x40af('0x9a')],{'as':_0x40af('0x196'),'onDelete':_0x40af('0xf3'),'foreignKey':'DescriptionId'});db['SugarcrmConfiguration']['hasMany'](db[_0x40af('0x9a')],{'as':'Fields','onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x198')});db[_0x40af('0x98')][_0x40af('0x12a')](db[_0x40af('0x1a0')],{'as':_0x40af('0x148'),'foreignKey':_0x40af('0x19f')});db['SugarcrmField'][_0x40af('0xf0')](db[_0x40af('0x9a')],{'as':'Subject','foreignKey':_0x40af('0x19a')});db[_0x40af('0x9a')][_0x40af('0xf0')](db['SugarcrmField'],{'as':_0x40af('0x19b'),'foreignKey':_0x40af('0x197')});db[_0x40af('0x9a')]['hasMany'](db[_0x40af('0x9a')],{'as':'Field','foreignKey':'FieldId'});db[_0x40af('0x9a')][_0x40af('0x12a')](db[_0x40af('0x19d')],{'as':_0x40af('0x19d'),'foreignKey':'VariableId'});db[_0x40af('0x1a1')]['hasMany'](db['DeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db['DeskConfiguration'][_0x40af('0xf0')](db[_0x40af('0x9e')],{'as':_0x40af('0x195'),'onDelete':'cascade','foreignKey':_0x40af('0x19a')});db[_0x40af('0x9c')][_0x40af('0xf0')](db[_0x40af('0x9e')],{'as':_0x40af('0x196'),'onDelete':'cascade','foreignKey':_0x40af('0x197')});db[_0x40af('0x9c')]['hasMany'](db[_0x40af('0x9e')],{'as':_0x40af('0x192'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x198')});db[_0x40af('0x9c')][_0x40af('0x12a')](db['DeskAccount'],{'as':_0x40af('0x148'),'foreignKey':_0x40af('0x19f')});db[_0x40af('0x9c')]['belongsToMany'](db[_0x40af('0x83')],{'through':_0x40af('0x1a2')});db[_0x40af('0x9e')][_0x40af('0xf0')](db[_0x40af('0x9e')],{'as':_0x40af('0x199'),'foreignKey':_0x40af('0x19a')});db[_0x40af('0x9e')][_0x40af('0xf0')](db[_0x40af('0x9e')],{'as':_0x40af('0x19b'),'foreignKey':_0x40af('0x197')});db[_0x40af('0x9e')][_0x40af('0xf0')](db[_0x40af('0x9e')],{'as':_0x40af('0x19c'),'foreignKey':_0x40af('0x198')});db['DeskField'][_0x40af('0x12a')](db[_0x40af('0x19d')],{'as':_0x40af('0x19d'),'foreignKey':_0x40af('0x19e')});db[_0x40af('0xa0')][_0x40af('0xf0')](db[_0x40af('0x1a3')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x40af('0x19f')});db[_0x40af('0x1a3')][_0x40af('0xf0')](db[_0x40af('0xa2')],{'as':_0x40af('0x195'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x19a')});db[_0x40af('0x1a3')][_0x40af('0xf0')](db['ZohoField'],{'as':'Descriptions','onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x197')});db[_0x40af('0x1a3')][_0x40af('0xf0')](db[_0x40af('0xa2')],{'as':'Fields','onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x198')});db[_0x40af('0x1a3')][_0x40af('0x12a')](db[_0x40af('0xa0')],{'as':'Account','foreignKey':_0x40af('0x19f')});db[_0x40af('0xa2')][_0x40af('0xf0')](db['ZohoField'],{'as':_0x40af('0x199'),'foreignKey':_0x40af('0x19a')});db[_0x40af('0xa2')]['hasMany'](db[_0x40af('0xa2')],{'as':_0x40af('0x19b'),'foreignKey':_0x40af('0x197')});db[_0x40af('0xa2')][_0x40af('0xf0')](db[_0x40af('0xa2')],{'as':_0x40af('0x19c'),'foreignKey':_0x40af('0x198')});db['ZohoField']['belongsTo'](db[_0x40af('0x19d')],{'as':_0x40af('0x19d'),'foreignKey':_0x40af('0x19e')});db[_0x40af('0xa4')]['hasMany'](db[_0x40af('0x1a4')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x40af('0x19f')});db[_0x40af('0x1a4')][_0x40af('0xf0')](db[_0x40af('0xa6')],{'as':_0x40af('0x195'),'foreignKey':_0x40af('0x19a')});db[_0x40af('0x1a4')][_0x40af('0xf0')](db[_0x40af('0xa6')],{'as':_0x40af('0x196'),'foreignKey':_0x40af('0x197')});db[_0x40af('0x1a4')][_0x40af('0xf0')](db[_0x40af('0xa6')],{'as':_0x40af('0x192'),'foreignKey':_0x40af('0x198')});db['ZendeskConfiguration'][_0x40af('0x12a')](db[_0x40af('0xa4')],{'as':_0x40af('0x148'),'foreignKey':'AccountId'});db[_0x40af('0x1a4')][_0x40af('0xfa')](db[_0x40af('0x83')],{'through':_0x40af('0x1a5')});db[_0x40af('0xa6')][_0x40af('0xf0')](db[_0x40af('0xa6')],{'as':_0x40af('0x199'),'foreignKey':_0x40af('0x19a')});db[_0x40af('0xa6')][_0x40af('0xf0')](db['ZendeskField'],{'as':_0x40af('0x19b'),'foreignKey':_0x40af('0x197')});db[_0x40af('0xa6')][_0x40af('0xf0')](db[_0x40af('0xa6')],{'as':_0x40af('0x19c'),'foreignKey':_0x40af('0x198')});db['ZendeskField'][_0x40af('0x12a')](db[_0x40af('0x19d')],{'as':_0x40af('0x19d'),'foreignKey':_0x40af('0x19e')});db[_0x40af('0xa8')]['hasMany'](db[_0x40af('0xa9')],{'as':'Configurations','onDelete':_0x40af('0xf3'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x40af('0xf0')](db[_0x40af('0xab')],{'as':_0x40af('0x195'),'onDelete':'cascade','foreignKey':_0x40af('0x19a')});db['FreshdeskConfiguration'][_0x40af('0xf0')](db['FreshdeskField'],{'as':_0x40af('0x196'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x197')});db['FreshdeskConfiguration'][_0x40af('0xf0')](db[_0x40af('0xab')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x40af('0x198')});db[_0x40af('0xa9')][_0x40af('0x12a')](db[_0x40af('0xa8')],{'as':_0x40af('0x148'),'foreignKey':'AccountId'});db[_0x40af('0xa9')][_0x40af('0xfa')](db[_0x40af('0x83')],{'through':_0x40af('0x1a6')});db[_0x40af('0xab')][_0x40af('0xf0')](db[_0x40af('0xab')],{'as':_0x40af('0x199'),'foreignKey':_0x40af('0x19a')});db[_0x40af('0xab')][_0x40af('0xf0')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x40af('0xab')][_0x40af('0xf0')](db[_0x40af('0xab')],{'as':_0x40af('0x19c'),'foreignKey':_0x40af('0x198')});db[_0x40af('0xab')][_0x40af('0x12a')](db[_0x40af('0x19d')],{'as':_0x40af('0x19d'),'foreignKey':_0x40af('0x19e')});db[_0x40af('0xad')][_0x40af('0xf0')](db['VtigerConfiguration'],{'as':_0x40af('0x194'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x19f')});db[_0x40af('0xaf')][_0x40af('0xf0')](db[_0x40af('0xb0')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x40af('0xaf')][_0x40af('0xf0')](db[_0x40af('0xb0')],{'as':_0x40af('0x196'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x40af('0xf0')](db['VtigerField'],{'as':_0x40af('0x192'),'foreignKey':_0x40af('0x198')});db[_0x40af('0xaf')]['belongsTo'](db[_0x40af('0xad')],{'as':_0x40af('0x148'),'foreignKey':_0x40af('0x19f')});db[_0x40af('0xb0')][_0x40af('0xf0')](db[_0x40af('0xb0')],{'as':_0x40af('0x199'),'foreignKey':'SubjectId'});db[_0x40af('0xb0')]['hasMany'](db[_0x40af('0xb0')],{'as':_0x40af('0x19b'),'foreignKey':_0x40af('0x197')});db[_0x40af('0xb0')][_0x40af('0xf0')](db[_0x40af('0xb0')],{'as':'Field','foreignKey':'FieldId'});db[_0x40af('0xb0')][_0x40af('0x12a')](db[_0x40af('0x19d')],{'as':_0x40af('0x19d'),'foreignKey':'VariableId'});db[_0x40af('0x1a7')][_0x40af('0xf0')](db[_0x40af('0xb3')],{'as':_0x40af('0x194'),'onDelete':_0x40af('0xf3'),'foreignKey':'AccountId'});db['ServicenowConfiguration']['hasMany'](db[_0x40af('0xb4')],{'as':'Subjects','foreignKey':_0x40af('0x19a')});db['ServicenowConfiguration'][_0x40af('0xf0')](db[_0x40af('0xb4')],{'as':_0x40af('0x196'),'foreignKey':_0x40af('0x197')});db[_0x40af('0xb3')][_0x40af('0xf0')](db[_0x40af('0xb4')],{'as':_0x40af('0x192'),'foreignKey':_0x40af('0x198')});db[_0x40af('0xb3')][_0x40af('0x12a')](db[_0x40af('0x1a7')],{'as':_0x40af('0x148'),'foreignKey':_0x40af('0x19f')});db[_0x40af('0xb4')]['hasMany'](db[_0x40af('0xb4')],{'as':_0x40af('0x199'),'foreignKey':_0x40af('0x19a')});db[_0x40af('0xb4')][_0x40af('0xf0')](db[_0x40af('0xb4')],{'as':'Description','foreignKey':_0x40af('0x197')});db[_0x40af('0xb4')][_0x40af('0xf0')](db[_0x40af('0xb4')],{'as':'Field','foreignKey':_0x40af('0x198')});db[_0x40af('0xb4')][_0x40af('0x12a')](db[_0x40af('0x19d')],{'as':_0x40af('0x19d'),'foreignKey':_0x40af('0x19e')});db[_0x40af('0x1a8')][_0x40af('0xf0')](db[_0x40af('0xb6')],{'as':_0x40af('0x194'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x19f')});db[_0x40af('0xb6')][_0x40af('0xf0')](db['Dynamics365Field'],{'as':_0x40af('0x195'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x19a')});db['Dynamics365Configuration']['hasMany'](db[_0x40af('0xb8')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x40af('0xb6')][_0x40af('0xf0')](db['Dynamics365Field'],{'as':_0x40af('0x192'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x198')});db[_0x40af('0xb6')][_0x40af('0x12a')](db['Dynamics365Account'],{'as':_0x40af('0x148'),'foreignKey':_0x40af('0x19f')});db[_0x40af('0xb8')]['hasMany'](db['Dynamics365Field'],{'as':_0x40af('0x199'),'foreignKey':_0x40af('0x19a')});db[_0x40af('0xb8')][_0x40af('0xf0')](db[_0x40af('0xb8')],{'as':_0x40af('0x19b'),'foreignKey':_0x40af('0x197')});db[_0x40af('0xb8')]['hasMany'](db['Dynamics365Field'],{'as':_0x40af('0x19c'),'foreignKey':_0x40af('0x198')});db[_0x40af('0xb8')]['belongsTo'](db[_0x40af('0x19d')],{'as':_0x40af('0x19d'),'foreignKey':_0x40af('0x19e')});db[_0x40af('0x1a9')]['hasMany'](db[_0x40af('0xbb')],{'as':_0x40af('0x194'),'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x19f')});db[_0x40af('0xbb')][_0x40af('0xf0')](db['FreshsalesField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x40af('0xbb')]['hasMany'](db[_0x40af('0xbc')],{'as':_0x40af('0x196'),'foreignKey':'DescriptionId'});db[_0x40af('0xbb')][_0x40af('0xf0')](db[_0x40af('0xbc')],{'as':_0x40af('0x192'),'foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0x40af('0x12a')](db['FreshsalesAccount'],{'as':_0x40af('0x148'),'foreignKey':'AccountId'});db[_0x40af('0xbc')]['hasMany'](db[_0x40af('0xbc')],{'as':'Subject','foreignKey':_0x40af('0x19a')});db[_0x40af('0xbc')]['hasMany'](db['FreshsalesField'],{'as':_0x40af('0x19b'),'foreignKey':_0x40af('0x197')});db['FreshsalesField'][_0x40af('0xf0')](db[_0x40af('0xbc')],{'as':_0x40af('0x19c'),'foreignKey':'FieldId'});db[_0x40af('0xbc')][_0x40af('0x12a')](db[_0x40af('0x19d')],{'as':_0x40af('0x19d'),'foreignKey':_0x40af('0x19e')});db['ChatQueueReport']['belongsTo'](db[_0x40af('0x5d')],{});db[_0x40af('0xbf')]['belongsTo'](db[_0x40af('0x112')],{'as':_0x40af('0x143'),'foreignKey':_0x40af('0x144')});db[_0x40af('0xbf')][_0x40af('0x12a')](db[_0x40af('0x69')],{'as':'Contact','foreignKey':'ContactId'});db[_0x40af('0xbf')]['belongsTo'](db['ChatInteraction'],{});db[_0x40af('0xbf')][_0x40af('0x12a')](db[_0x40af('0x169')],{});db['ChatQueueReport'][_0x40af('0x12a')](db[_0x40af('0x11')],{});db[_0x40af('0xbf')]['belongsTo'](db['ChatQueue'],{});db[_0x40af('0xc1')][_0x40af('0x12a')](db['User'],{'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x1aa')});db[_0x40af('0xc1')][_0x40af('0x12a')](db[_0x40af('0x11')],{'onDelete':_0x40af('0xf3'),'foreignKey':_0x40af('0x1ab')});db['JscriptySessionReport'][_0x40af('0xf0')](db[_0x40af('0x1ac')],{'foreignKey':_0x40af('0x1ad'),'onDelete':_0x40af('0xf3')});db[_0x40af('0xc6')]['hasMany'](db[_0x40af('0xc3')],{'foreignKey':_0x40af('0x1ad'),'onDelete':_0x40af('0xf3')});db[_0x40af('0xc8')][_0x40af('0x12a')](db[_0x40af('0x4c')],{});db[_0x40af('0xc8')][_0x40af('0x12a')](db[_0x40af('0x112')],{'as':'List','foreignKey':_0x40af('0x144')});db[_0x40af('0xc8')][_0x40af('0x12a')](db[_0x40af('0x69')],{'as':_0x40af('0x149'),'foreignKey':'ContactId'});db[_0x40af('0xc8')][_0x40af('0x12a')](db[_0x40af('0x50')],{});db[_0x40af('0xc8')][_0x40af('0x12a')](db[_0x40af('0x52')],{});db[_0x40af('0xc8')][_0x40af('0x12a')](db[_0x40af('0x11')],{});db[_0x40af('0xc8')][_0x40af('0x12a')](db[_0x40af('0x10f')],{});db[_0x40af('0xcc')][_0x40af('0xf0')](db[_0x40af('0xc6')],{'foreignKey':_0x40af('0x1ae')});db[_0x40af('0xcc')][_0x40af('0xf0')](db['JscriptyQuestionReport'],{'foreignKey':_0x40af('0x1ae')});db['JscriptyProject'][_0x40af('0xf0')](db[_0x40af('0xc3')],{'foreignKey':'ProjectId'});db[_0x40af('0x11d')]['belongsToMany'](db[_0x40af('0x11')],{'as':_0x40af('0x14d'),'through':_0x40af('0x11f')});db[_0x40af('0x132')][_0x40af('0xfa')](db[_0x40af('0x11')],{'as':_0x40af('0x131'),'through':_0x40af('0x101')});db[_0x40af('0x132')][_0x40af('0xfa')](db[_0x40af('0x109')],{'through':_0x40af('0x1af'),'as':'VoiceQueues'});db[_0x40af('0x132')][_0x40af('0xfa')](db[_0x40af('0x38')],{'through':_0x40af('0x1b0'),'as':_0x40af('0x10b')});db['Team'][_0x40af('0xfa')](db[_0x40af('0x172')],{'through':_0x40af('0x173'),'as':_0x40af('0x10c')});db[_0x40af('0x132')]['belongsToMany'](db['FaxQueue'],{'through':_0x40af('0x15b'),'as':_0x40af('0x10e')});db[_0x40af('0x132')][_0x40af('0xfa')](db[_0x40af('0x10f')],{'through':_0x40af('0x160'),'as':'SmsQueues'});db[_0x40af('0x132')]['belongsToMany'](db[_0x40af('0x5b')],{'through':_0x40af('0x167'),'as':'OpenchannelQueues'});db[_0x40af('0x17b')][_0x40af('0xf0')](db[_0x40af('0x6b')],{'as':_0x40af('0x177'),'foreignKey':'CampaignId'});db['Campaign'][_0x40af('0xf0')](db['CmHopperFinal'],{'as':_0x40af('0x126'),'foreignKey':_0x40af('0x17c')});db[_0x40af('0x17b')][_0x40af('0xf0')](db[_0x40af('0xf4')],{'as':_0x40af('0x127'),'foreignKey':_0x40af('0x17c')});db[_0x40af('0x17b')][_0x40af('0xf0')](db[_0x40af('0x6d')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x40af('0x17b')]['belongsTo'](db[_0x40af('0x27')],{'as':_0x40af('0x27'),'foreignKey':_0x40af('0x1b1')});db[_0x40af('0x17b')][_0x40af('0x12a')](db[_0x40af('0x27')],{'as':_0x40af('0x12b'),'foreignKey':_0x40af('0x12c')});db[_0x40af('0x17b')][_0x40af('0x12a')](db[_0x40af('0x12d')],{'as':'Interval','foreignKey':_0x40af('0x186')});db['Campaign']['belongsTo'](db[_0x40af('0x11d')],{'as':'SquareProject','foreignKey':_0x40af('0x1b2')});db['Campaign']['belongsToMany'](db[_0x40af('0x112')],{'as':_0x40af('0xff'),'through':_0x40af('0x1b3')});db[_0x40af('0x17b')]['belongsToMany'](db[_0x40af('0x112')],{'as':_0x40af('0x134'),'through':_0x40af('0x1b4')});db[_0x40af('0x1b5')][_0x40af('0x12a')](db[_0x40af('0x3c')],{});db[_0x40af('0x1b5')][_0x40af('0x12a')](db['MailInteraction'],{});db[_0x40af('0x1b5')]['belongsTo'](db[_0x40af('0x117')],{'foreignKey':'FromMailAccountId','as':_0x40af('0x1b6')});db[_0x40af('0x1b5')][_0x40af('0x12a')](db[_0x40af('0x11')],{'foreignKey':_0x40af('0x1b7'),'as':_0x40af('0x1b8')});db['MailTransferReport'][_0x40af('0x12a')](db[_0x40af('0x11')],{'foreignKey':_0x40af('0x1b9'),'as':_0x40af('0x1ba')});db[_0x40af('0x1b5')][_0x40af('0x12a')](db[_0x40af('0x38')],{'foreignKey':_0x40af('0x1bb'),'as':'ToQueue'});db[_0x40af('0x1b5')][_0x40af('0x12a')](db[_0x40af('0x117')],{'foreignKey':_0x40af('0x1bc'),'as':_0x40af('0x1bd')});db[_0x40af('0xde')][_0x40af('0x12a')](db[_0x40af('0x169')],{});db[_0x40af('0xde')]['belongsTo'](db['ChatInteraction'],{});db[_0x40af('0xde')]['belongsTo'](db[_0x40af('0x5d')],{'foreignKey':_0x40af('0x1be'),'as':_0x40af('0x1b6')});db[_0x40af('0xde')]['belongsTo'](db['User'],{'foreignKey':_0x40af('0x1b7'),'as':_0x40af('0x1b8')});db[_0x40af('0xde')][_0x40af('0x12a')](db[_0x40af('0x11')],{'foreignKey':'ToUserId','as':_0x40af('0x1ba')});db[_0x40af('0xde')]['belongsTo'](db[_0x40af('0x172')],{'foreignKey':_0x40af('0x1bf'),'as':'ToQueue'});db[_0x40af('0xde')][_0x40af('0x12a')](db[_0x40af('0x5d')],{'foreignKey':'ToChatWebsiteId','as':_0x40af('0x1bd')});db[_0x40af('0xe0')]['belongsTo'](db[_0x40af('0x47')],{});db[_0x40af('0xe0')]['belongsTo'](db[_0x40af('0x45')],{});db['FaxTransferReport'][_0x40af('0x12a')](db[_0x40af('0x42')],{'foreignKey':_0x40af('0x1c0'),'as':_0x40af('0x1b6')});db[_0x40af('0xe0')][_0x40af('0x12a')](db['User'],{'foreignKey':_0x40af('0x1b7'),'as':_0x40af('0x1b8')});db[_0x40af('0xe0')]['belongsTo'](db[_0x40af('0x11')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x40af('0xe0')][_0x40af('0x12a')](db[_0x40af('0x48')],{'foreignKey':_0x40af('0x1c1'),'as':'ToQueue'});db[_0x40af('0xe0')]['belongsTo'](db[_0x40af('0x42')],{'foreignKey':_0x40af('0x1c2'),'as':_0x40af('0x1bd')});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelMessage'],{});db[_0x40af('0xe1')][_0x40af('0x12a')](db[_0x40af('0x58')],{});db[_0x40af('0xe1')][_0x40af('0x12a')](db[_0x40af('0x55')],{'foreignKey':'FromOpenchannelAccountId','as':_0x40af('0x1b6')});db[_0x40af('0xe1')][_0x40af('0x12a')](db[_0x40af('0x11')],{'foreignKey':_0x40af('0x1b7'),'as':_0x40af('0x1b8')});db[_0x40af('0xe1')][_0x40af('0x12a')](db[_0x40af('0x11')],{'foreignKey':_0x40af('0x1b9'),'as':_0x40af('0x1ba')});db[_0x40af('0xe1')]['belongsTo'](db[_0x40af('0x5b')],{'foreignKey':_0x40af('0x1c3'),'as':_0x40af('0x1c4')});db[_0x40af('0xe1')]['belongsTo'](db[_0x40af('0x55')],{'foreignKey':'ToOpenchannelAccountId','as':_0x40af('0x1bd')});db[_0x40af('0xe3')][_0x40af('0x12a')](db[_0x40af('0x52')],{});db['SmsTransferReport'][_0x40af('0x12a')](db[_0x40af('0x50')],{});db['SmsTransferReport'][_0x40af('0x12a')](db[_0x40af('0x4c')],{'foreignKey':_0x40af('0x1c5'),'as':_0x40af('0x1b6')});db[_0x40af('0xe3')][_0x40af('0x12a')](db[_0x40af('0x11')],{'foreignKey':_0x40af('0x1b7'),'as':_0x40af('0x1b8')});db['SmsTransferReport'][_0x40af('0x12a')](db[_0x40af('0x11')],{'foreignKey':_0x40af('0x1b9'),'as':_0x40af('0x1ba')});db[_0x40af('0xe3')][_0x40af('0x12a')](db[_0x40af('0x10f')],{'foreignKey':_0x40af('0x1c6'),'as':_0x40af('0x1c4')});db[_0x40af('0xe3')][_0x40af('0x12a')](db['SmsAccount'],{'foreignKey':_0x40af('0x1c7'),'as':_0x40af('0x1bd')});db[_0x40af('0x112')][_0x40af('0xf0')](db[_0x40af('0x13e')],{'as':_0x40af('0x15c'),'foreignKey':'ListId'});db['CmList']['hasMany'](db['CmCustomField'],{'as':_0x40af('0x1c8'),'foreignKey':_0x40af('0x144')});db[_0x40af('0x112')]['hasMany'](db[_0x40af('0x69')],{'as':_0x40af('0xfd'),'onDelete':'cascade','foreignKey':_0x40af('0x144')});db[_0x40af('0x112')][_0x40af('0xf0')](db[_0x40af('0x6f')],{'as':_0x40af('0x126'),'foreignKey':_0x40af('0x144')});db['CmList'][_0x40af('0xf0')](db[_0x40af('0xf4')],{'as':_0x40af('0xf5'),'foreignKey':_0x40af('0x144')});db[_0x40af('0x112')][_0x40af('0xf0')](db[_0x40af('0x72')],{'as':_0x40af('0x72'),'foreignKey':_0x40af('0x144')});db['CmList'][_0x40af('0xfa')](db['VoiceQueue'],{'as':_0x40af('0x1c9'),'through':_0x40af('0x130')});db[_0x40af('0x112')][_0x40af('0xfa')](db['User'],{'as':_0x40af('0x131'),'through':_0x40af('0x100')});db[_0x40af('0xe6')]['hasMany'](db[_0x40af('0xf2')],{'as':_0x40af('0x187'),'onDelete':_0x40af('0x151')});db['VoicePrefix'][_0x40af('0xfa')](db[_0x40af('0x11')],{'as':_0x40af('0x131'),'through':'user_has_voice_prefixes'});db[_0x40af('0xe8')]['hasMany'](db[_0x40af('0x11')],{'as':_0x40af('0x14d'),'foreignKey':_0x40af('0xf9')});db['UserProfile'][_0x40af('0xf0')](db[_0x40af('0xea')],{'as':_0x40af('0x1ca'),'foreignKey':_0x40af('0xf9'),'onDelete':_0x40af('0xf3')});db[_0x40af('0xea')][_0x40af('0xf0')](db['UserProfileResource'],{'as':'Resources','foreignKey':_0x40af('0x1cb'),'onDelete':'cascade'});module[_0x40af('0x1cc')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x14f0=['../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','hasOne','cascade','UserId','Recordings','hasMany','UserVoiceQueueRt','VoiceQueuesRt','HopperHistory','OpenchannelInteractions','FaxInteractions','MailInteractions','belongsTo','UserProfile','userProfileId','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','belongsToMany','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','SmsInteractions','user_has_openchannel_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','SmsQueue','SmsQueues','UserOpenchannelQueue','user_has_voice_prefixes','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','SmsAccounts','SquareProjects','user_has_square_projects','Applications','moh_has_sounds','VoiceQueueId','HopperFinals','HopperHistories','HopperBlacks','JscriptySessionReport','TrunkId','TrunkBackup','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','Contact','ContactId','MailServerIn','MailAccountId','Smtp','Dispositions','Answers','Interactions','List','MailQueue','Messages','Account','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','restrict','ListId','DashboardItem','FaxAccount','FaxAccountId','Exntensions','TagId','Owner','fax_interaction_has_tags','user_has_fax_interactions','FaxInteractionId','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','OpenchannelAccount','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Members','Website','Hoppers','Company','CompanyId','Campaign','CampaignId','OwnerId','All','AutomationAllId','Automation','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','cm_contact_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Action','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','SalesforceConfiguration','SubjectId','Descriptions','DescriptionId','AccountId','Subject','Field','VariableId','SugarcrmConfiguration','FieldId','Description','DeskAccount','DeskField','Subjects','ZendeskAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ChatInternalMessage','ToId','JscriptyQuestionReport','SessionId','SmsQueueReport','ProjectId','team_has_sms_queues','OpenchannelQueues','TrunkBackupId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','voice_queues_has_cm_lists','Resources','sectionId','path','../config/environment','sequelize','lodash','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','utf8mb4','name','utf8_general_ci','sequelizeHistory','mysql','utf8','database','username','password','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceCallReport/voiceCallReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Schedule','../api/schedule/schedule.model','Sound','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','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','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptySessionReport/jscriptySessionReport.model'];(function(_0x3c1cd9,_0x566007){var _0x472a60=function(_0x321682){while(--_0x321682){_0x3c1cd9['push'](_0x3c1cd9['shift']());}};_0x472a60(++_0x566007);}(_0x14f0,0xfb));var _0x014f=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x14f0[_0x2aec52];return _0x3b8835;};'use strict';var path=require(_0x014f('0x0'));var config=require(_0x014f('0x1'));var Sequelize=require(_0x014f('0x2'));var _=require(_0x014f('0x3'));var jstz=require('jstz');var timezone=jstz[_0x014f('0x4')]();config[_0x014f('0x2')]=_[_0x014f('0x5')](config[_0x014f('0x2')],{'database':_0x014f('0x6'),'username':'xcall','password':_0x014f('0x7'),'options':{'host':_0x014f('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x014f('0x9')},'logging':![],'timezone':timezone[_0x014f('0xa')](),'define':{'charset':'utf8','collate':_0x014f('0xb')}}});config[_0x014f('0xc')]=_['defaultsDeep'](config[_0x014f('0xc')],{'database':_0x014f('0x6'),'username':'xcall','password':_0x014f('0x7'),'options':{'host':_0x014f('0x8'),'port':0xcea,'dialect':_0x014f('0xd'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x014f('0xe'),'collate':_0x014f('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x014f('0xf')],config[_0x014f('0x2')][_0x014f('0x10')],config[_0x014f('0x2')]['password'],config[_0x014f('0x2')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x014f('0xc')][_0x014f('0xf')],config['sequelizeHistory'][_0x014f('0x10')],config['sequelizeHistory'][_0x014f('0x11')],config['sequelizeHistory']['options'])};db[_0x014f('0x12')]=db['sequelize']['import'](_0x014f('0x13'));db[_0x014f('0x14')]=db['sequelize'][_0x014f('0x15')](_0x014f('0x16'));db[_0x014f('0x17')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/voiceContext/voiceContext.model');db[_0x014f('0x18')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x19'));db[_0x014f('0x1a')]=db['sequelize'][_0x014f('0x15')](_0x014f('0x1b'));db[_0x014f('0x1c')]=db['sequelize'][_0x014f('0x15')](_0x014f('0x1d'));db[_0x014f('0x1e')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x1f'));db[_0x014f('0x20')]=db['sequelize'][_0x014f('0x15')](_0x014f('0x21'));db[_0x014f('0x22')]=db[_0x014f('0x2')]['import']('../api/voiceMail/voiceMail.model');db[_0x014f('0x23')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x24'));db['VoiceDialReport']=db[_0x014f('0x2')][_0x014f('0x15')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db['sequelize']['import'](_0x014f('0x25'));db[_0x014f('0x26')]=db[_0x014f('0x2')]['import'](_0x014f('0x27'));db['MemberReport']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x28'));db[_0x014f('0x29')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x2a'));db[_0x014f('0x2b')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x2c'));db['UserVoiceQueueRt']=db[_0x014f('0x2')][_0x014f('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x014f('0x2d')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x2e'));db[_0x014f('0x2f')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/userChatQueue/userChatQueue.model');db[_0x014f('0x30')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/userMailQueue/userMailQueue.model');db[_0x014f('0x31')]=db[_0x014f('0x2')]['import']('../api/userFaxQueue/userFaxQueue.model');db[_0x014f('0x32')]=db['sequelize'][_0x014f('0x15')](_0x014f('0x33'));db['UserOpenchannelQueue']=db[_0x014f('0x2')]['import'](_0x014f('0x34'));db['MailServerIn']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x35'));db[_0x014f('0x36')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x37'));db[_0x014f('0x38')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db['sequelize']['import'](_0x014f('0x39'));db[_0x014f('0x3a')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/mailSubstatus/mailSubstatus.model');db[_0x014f('0x3b')]=db['sequelize'][_0x014f('0x15')](_0x014f('0x3c'));db[_0x014f('0x3d')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/mailMessage/mailMessage.model');db[_0x014f('0x3e')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x3f'));db[_0x014f('0x40')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/mailQueueReport/mailQueueReport.model');db[_0x014f('0x41')]=db['sequelize'][_0x014f('0x15')](_0x014f('0x42'));db['DashboardItem']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x43'));db['FaxAccount']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x44'));db[_0x014f('0x45')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x46'));db[_0x014f('0x47')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/faxInteraction/faxInteraction.model');db[_0x014f('0x48')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x49'));db[_0x014f('0x4a')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/faxQueue/faxQueue.model');db[_0x014f('0x4b')]=db[_0x014f('0x2')]['import'](_0x014f('0x4c'));db[_0x014f('0x4d')]=db[_0x014f('0x2')]['import']('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0x014f('0x2')][_0x014f('0x15')]('../api/smsApplication/smsApplication.model');db[_0x014f('0x4e')]=db['sequelize'][_0x014f('0x15')]('../api/smsInteraction/smsInteraction.model');db[_0x014f('0x4f')]=db['sequelize'][_0x014f('0x15')](_0x014f('0x50'));db['SmsQueue']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x51'));db['OpenchannelAccount']=db[_0x014f('0x2')]['import'](_0x014f('0x52'));db['OpenchannelApplication']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x53'));db[_0x014f('0x54')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x014f('0x55')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/openchannelMessage/openchannelMessage.model');db[_0x014f('0x56')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x57'));db[_0x014f('0x58')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x59'));db[_0x014f('0x5a')]=db['sequelize'][_0x014f('0x15')](_0x014f('0x5b'));db[_0x014f('0x5c')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x5d'));db[_0x014f('0x5e')]=db['sequelize'][_0x014f('0x15')](_0x014f('0x5f'));db[_0x014f('0x60')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x61'));db[_0x014f('0x62')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x63'));db[_0x014f('0x64')]=db[_0x014f('0x2')]['import'](_0x014f('0x65'));db[_0x014f('0x66')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x67'));db['ChatProactiveAction']=db['sequelize']['import'](_0x014f('0x68'));db[_0x014f('0x69')]=db['sequelize'][_0x014f('0x15')](_0x014f('0x6a'));db[_0x014f('0x6b')]=db[_0x014f('0x2')]['import'](_0x014f('0x6c'));db[_0x014f('0x6d')]=db['sequelize'][_0x014f('0x15')](_0x014f('0x6e'));db[_0x014f('0x6f')]=db['sequelize']['import'](_0x014f('0x70'));db[_0x014f('0x71')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x014f('0x72')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x73'));db[_0x014f('0x74')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x75'));db[_0x014f('0x76')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x77'));db['Action']=db['sequelize'][_0x014f('0x15')](_0x014f('0x78'));db['Automation']=db['sequelize'][_0x014f('0x15')](_0x014f('0x79'));db[_0x014f('0x7a')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/cannedAnswer/cannedAnswer.model');db[_0x014f('0x7b')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x7c'));db[_0x014f('0x7d')]=db[_0x014f('0x2')]['import'](_0x014f('0x7e'));db['Interval']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x7f'));db[_0x014f('0x80')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x81'));db['Cdr']=db['sequelize'][_0x014f('0x15')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0x014f('0x2')][_0x014f('0x15')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x014f('0x82')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x83'));db[_0x014f('0x84')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/sound/sound.model');db['Tag']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x85'));db[_0x014f('0x86')]=db['sequelize']['import'](_0x014f('0x87'));db[_0x014f('0x88')]=db[_0x014f('0x2')]['import'](_0x014f('0x89'));db[_0x014f('0x8a')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/variable/variable.model');db['Integration']=db['sequelize'][_0x014f('0x15')](_0x014f('0x8b'));db[_0x014f('0x8c')]=db['sequelize'][_0x014f('0x15')]('../api/integrationReport/integrationReport.model');db[_0x014f('0x8d')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x8e'));db[_0x014f('0x8f')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x90'));db['AnalyticExtractedReport']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x91'));db['AnalyticMetric']=db['sequelize'][_0x014f('0x15')](_0x014f('0x92'));db[_0x014f('0x93')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x014f('0x94')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x95'));db[_0x014f('0x96')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x97'));db['SalesforceConfiguration']=db[_0x014f('0x2')]['import'](_0x014f('0x98'));db[_0x014f('0x99')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x9a'));db[_0x014f('0x9b')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x9c'));db['SugarcrmConfiguration']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x9d'));db[_0x014f('0x9e')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x9f'));db['DeskAccount']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xa0'));db[_0x014f('0xa1')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xa2'));db['DeskField']=db[_0x014f('0x2')]['import']('../api/intDeskField/intDeskField.model');db[_0x014f('0xa3')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xa4'));db[_0x014f('0xa5')]=db[_0x014f('0x2')]['import'](_0x014f('0xa6'));db[_0x014f('0xa7')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xa8'));db['ZendeskAccount']=db[_0x014f('0x2')]['import'](_0x014f('0xa9'));db[_0x014f('0xaa')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x014f('0xab')]=db['sequelize'][_0x014f('0x15')](_0x014f('0xac'));db[_0x014f('0xad')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xae'));db[_0x014f('0xaf')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xb0'));db[_0x014f('0xb1')]=db['sequelize'][_0x014f('0x15')](_0x014f('0xb2'));db[_0x014f('0xb3')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xb4'));db[_0x014f('0xb5')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xb6'));db[_0x014f('0xb7')]=db[_0x014f('0x2')]['import'](_0x014f('0xb8'));db[_0x014f('0xb9')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xba'));db[_0x014f('0xbb')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xbc'));db[_0x014f('0xbd')]=db[_0x014f('0x2')]['import']('../api/intServicenowField/intServicenowField.model');db[_0x014f('0xbe')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xbf'));db[_0x014f('0xc0')]=db['sequelize'][_0x014f('0x15')](_0x014f('0xc1'));db[_0x014f('0xc2')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xc3'));db[_0x014f('0xc4')]=db['sequelize'][_0x014f('0x15')](_0x014f('0xc5'));db[_0x014f('0xc6')]=db['sequelize'][_0x014f('0x15')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x014f('0xc7')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xc8'));db[_0x014f('0xc9')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0x8b'));db[_0x014f('0xca')]=db['sequelize'][_0x014f('0x15')](_0x014f('0xcb'));db[_0x014f('0xcc')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xcd'));db['ChatInternalMessage']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xce'));db[_0x014f('0xcf')]=db[_0x014f('0x2')]['import'](_0x014f('0xd0'));db['JscriptyQuestionReport']=db[_0x014f('0x2')][_0x014f('0x15')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xd1'));db['SmsQueueReport']=db['sequelize'][_0x014f('0x15')](_0x014f('0xd2'));db[_0x014f('0xd3')]=db['sequelize'][_0x014f('0x15')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xd4'));db[_0x014f('0xd5')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/jscriptyProject/jscriptyProject.model');db[_0x014f('0xd6')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xd7'));db[_0x014f('0xd8')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xd9'));db[_0x014f('0xda')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xdb'));db[_0x014f('0xdc')]=db[_0x014f('0x2')]['import']('../api/squareRecording/squareRecording.model');db[_0x014f('0xdd')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xde'));db[_0x014f('0xdf')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xe0'));db[_0x014f('0xe1')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xe2'));db['Campaign']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xe3'));db[_0x014f('0xe4')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xe5'));db[_0x014f('0xe6')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/attachment/attachment.model');db['Plugin']=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xe7'));db[_0x014f('0xe8')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xe9'));db['ChatTransferReport']=db['sequelize'][_0x014f('0x15')](_0x014f('0xea'));db[_0x014f('0xeb')]=db[_0x014f('0x2')]['import'](_0x014f('0xec'));db[_0x014f('0xed')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xee'));db[_0x014f('0xef')]=db[_0x014f('0x2')][_0x014f('0x15')]('../api/smsTransferReport/smsTransferReport.model');db[_0x014f('0xf0')]=db['sequelize'][_0x014f('0x15')](_0x014f('0xf1'));db[_0x014f('0xf2')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xf3'));db['UserProfile']=db['sequelize']['import']('../api/userProfile/userProfile.model');db[_0x014f('0xf4')]=db[_0x014f('0x2')][_0x014f('0x15')](_0x014f('0xf5'));db[_0x014f('0xf6')]=db[_0x014f('0x2')]['import'](_0x014f('0xf7'));db[_0x014f('0x12')][_0x014f('0xf8')](db['VoiceMail'],{'as':_0x014f('0x22'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0xfa')});db[_0x014f('0x12')]['hasMany'](db[_0x014f('0x1e')],{'as':_0x014f('0xfb'),'foreignKey':_0x014f('0xfa')});db['User'][_0x014f('0xfc')](db[_0x014f('0xfd')],{'as':_0x014f('0xfe'),'foreignKey':_0x014f('0xfa')});db[_0x014f('0x12')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db['User'][_0x014f('0xfc')](db[_0x014f('0x71')],{'as':'HopperFinals','foreignKey':'UserId'});db[_0x014f('0x12')][_0x014f('0xfc')](db[_0x014f('0x72')],{'as':_0x014f('0xff'),'foreignKey':_0x014f('0xfa')});db[_0x014f('0x12')]['hasMany'](db[_0x014f('0x74')],{'as':_0x014f('0x74'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0x014f('0x54')],{'as':_0x014f('0x100'),'foreignKey':_0x014f('0xfa')});db[_0x014f('0x12')][_0x014f('0xfc')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':'UserId'});db[_0x014f('0x12')]['hasMany'](db[_0x014f('0x4e')],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0x014f('0x12')][_0x014f('0xfc')](db[_0x014f('0x47')],{'as':_0x014f('0x101'),'foreignKey':'UserId'});db[_0x014f('0x12')]['hasMany'](db[_0x014f('0x3b')],{'as':_0x014f('0x102'),'foreignKey':_0x014f('0xfa')});db['User'][_0x014f('0x103')](db[_0x014f('0x104')],{'as':_0x014f('0x104'),'foreignKey':_0x014f('0x105')});db['User']['belongsToMany'](db[_0x014f('0x66')],{'as':_0x014f('0x106'),'through':_0x014f('0x107')});db['User']['belongsToMany'](db['CmContact'],{'as':_0x014f('0x108'),'through':_0x014f('0x109')});db[_0x014f('0x12')][_0x014f('0x10a')](db['CmList'],{'as':_0x014f('0x10b'),'through':_0x014f('0x10c')});db[_0x014f('0x12')][_0x014f('0x10a')](db[_0x014f('0xdf')],{'through':_0x014f('0x10d')});db[_0x014f('0x12')][_0x014f('0x10a')](db[_0x014f('0x3b')],{'as':_0x014f('0x102'),'through':_0x014f('0x10e')});db['User'][_0x014f('0x10a')](db[_0x014f('0x5e')],{'as':_0x014f('0x10f'),'through':_0x014f('0x110')});db['User']['belongsToMany'](db[_0x014f('0x47')],{'as':_0x014f('0x101'),'through':'user_has_fax_interactions'});db[_0x014f('0x12')][_0x014f('0x10a')](db['SmsInteraction'],{'as':_0x014f('0x111'),'through':'user_has_sms_interactions'});db[_0x014f('0x12')]['belongsToMany'](db['OpenchannelInteraction'],{'as':_0x014f('0x100'),'through':_0x014f('0x112')});db[_0x014f('0x12')][_0x014f('0x10a')](db[_0x014f('0x1c')],{'as':_0x014f('0x113'),'through':_0x014f('0x2d'),'required':![]});db['User'][_0x014f('0x10a')](db['MailQueue'],{'as':_0x014f('0x114'),'through':_0x014f('0x30'),'required':![]});db[_0x014f('0x12')][_0x014f('0x10a')](db[_0x014f('0x64')],{'as':_0x014f('0x115'),'through':_0x014f('0x2f'),'required':![],'hooks':!![]});db[_0x014f('0x12')][_0x014f('0x10a')](db['FaxQueue'],{'as':_0x014f('0x116'),'through':_0x014f('0x31'),'required':![]});db[_0x014f('0x12')][_0x014f('0x10a')](db[_0x014f('0x117')],{'as':_0x014f('0x118'),'through':_0x014f('0x32'),'required':![]});db[_0x014f('0x12')]['belongsToMany'](db[_0x014f('0x56')],{'as':'OpenchannelQueues','through':_0x014f('0x119'),'required':![]});db['User'][_0x014f('0x10a')](db['CmList'],{'through':_0x014f('0x10c')});db[_0x014f('0x12')][_0x014f('0x10a')](db['VoicePrefix'],{'as':'VoicePrefixes','through':_0x014f('0x11a'),'required':![]});db[_0x014f('0x12')]['belongsToMany'](db[_0x014f('0x58')],{'as':'ChatWebsites','through':_0x014f('0x11b')});db[_0x014f('0x12')]['belongsToMany'](db['FaxAccount'],{'as':_0x014f('0x11c'),'through':_0x014f('0x11d')});db[_0x014f('0x12')]['belongsToMany'](db[_0x014f('0x38')],{'as':_0x014f('0x11e'),'through':_0x014f('0x11f')});db['User'][_0x014f('0x10a')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0x014f('0x12')][_0x014f('0x10a')](db[_0x014f('0x4d')],{'as':_0x014f('0x120'),'through':'user_has_sms_accounts'});db[_0x014f('0x12')]['belongsToMany'](db[_0x014f('0xda')],{'as':_0x014f('0x121'),'through':_0x014f('0x122')});db['VoiceChanSpy']['hasMany'](db[_0x014f('0x18')],{'as':'SpiedAgents','onDelete':_0x014f('0xf9'),'foreignKey':'ChanSpyId'});db[_0x014f('0x17')][_0x014f('0xfc')](db[_0x014f('0x18')],{'onDelete':_0x014f('0xf9')});db[_0x014f('0x18')][_0x014f('0xfc')](db[_0x014f('0x18')],{'as':_0x014f('0x123'),'onDelete':_0x014f('0xf9')});db[_0x014f('0x1a')][_0x014f('0x10a')](db['Sound'],{'as':'Sounds','through':_0x014f('0x124')});db[_0x014f('0x1c')]['hasMany'](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0x014f('0x125')});db['VoiceQueue'][_0x014f('0xfc')](db[_0x014f('0x6d')],{'as':'Hoppers','foreignKey':_0x014f('0x125')});db[_0x014f('0x1c')][_0x014f('0xfc')](db[_0x014f('0x71')],{'as':_0x014f('0x126'),'foreignKey':_0x014f('0x125')});db['VoiceQueue']['hasMany'](db[_0x014f('0x72')],{'as':_0x014f('0x127'),'foreignKey':'VoiceQueueId'});db[_0x014f('0x1c')][_0x014f('0xfc')](db['ReportAgentPreview'],{'as':_0x014f('0x74'),'foreignKey':_0x014f('0x125')});db['VoiceQueue']['hasMany'](db['CmHopperBlack'],{'as':_0x014f('0x128'),'foreignKey':_0x014f('0x125')});db[_0x014f('0x1c')][_0x014f('0xfc')](db[_0x014f('0x129')],{'as':'JscriptySessions','foreignKey':_0x014f('0x125')});db['VoiceQueue'][_0x014f('0x103')](db[_0x014f('0x29')],{'as':_0x014f('0x29'),'foreignKey':_0x014f('0x12a')});db[_0x014f('0x1c')]['belongsTo'](db['Trunk'],{'as':_0x014f('0x12b'),'foreignKey':'TrunkBackupId'});db[_0x014f('0x1c')][_0x014f('0x103')](db[_0x014f('0x12c')],{'as':_0x014f('0x12c'),'foreignKey':_0x014f('0x12d')});db[_0x014f('0x1c')][_0x014f('0x103')](db[_0x014f('0x80')],{'as':_0x014f('0x12e'),'foreignKey':_0x014f('0x12f')});db[_0x014f('0x1c')][_0x014f('0x10a')](db[_0x014f('0xf0')],{'as':_0x014f('0x10b'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue']['belongsToMany'](db[_0x014f('0x12')],{'as':_0x014f('0x130'),'through':_0x014f('0x2d')});db['VoiceQueue']['belongsToMany'](db[_0x014f('0xdf')],{'as':_0x014f('0x131'),'through':_0x014f('0x132')});db[_0x014f('0x1c')][_0x014f('0x10a')](db[_0x014f('0xf0')],{'as':_0x014f('0x133'),'through':_0x014f('0x134')});db[_0x014f('0x1e')]['belongsTo'](db[_0x014f('0x12')],{'as':_0x014f('0x12'),'foreignKey':_0x014f('0xfa')});db[_0x014f('0x20')]['belongsTo'](db[_0x014f('0x12')],{'as':_0x014f('0x12'),'foreignKey':_0x014f('0xfa')});db['VoiceMail']['hasMany'](db['VoiceMailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x014f('0x23')][_0x014f('0x103')](db['VoiceMail'],{'foreignKey':_0x014f('0x135'),'targetKey':_0x014f('0x136')});db[_0x014f('0x137')][_0x014f('0xfc')](db[_0x014f('0x26')],{'as':_0x014f('0x138'),'foreignKey':_0x014f('0x139'),'constraints':![]});db[_0x014f('0x137')][_0x014f('0xfc')](db[_0x014f('0x13a')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0x014f('0x12')],{'as':_0x014f('0x12'),'foreignKey':_0x014f('0xfa')});db[_0x014f('0x137')][_0x014f('0x103')](db[_0x014f('0x6b')],{'as':_0x014f('0x13b'),'foreignKey':_0x014f('0x13c')});db[_0x014f('0x13d')]['belongsTo'](db[_0x014f('0x38')],{'as':'MailAccount','foreignKey':_0x014f('0x13e')});db['MailServerOut']['belongsTo'](db[_0x014f('0x38')],{'as':_0x014f('0x38'),'foreignKey':'MailAccountId'});db[_0x014f('0x38')][_0x014f('0xf8')](db[_0x014f('0x13d')],{'as':'Imap','onDelete':_0x014f('0xf9')});db[_0x014f('0x38')]['hasOne'](db[_0x014f('0x36')],{'as':_0x014f('0x13f'),'onDelete':_0x014f('0xf9')});db['MailAccount']['hasMany'](db[_0x014f('0x7b')],{'as':_0x014f('0x140'),'foreignKey':_0x014f('0x13e')});db[_0x014f('0x38')]['hasMany'](db[_0x014f('0x7a')],{'as':_0x014f('0x141'),'foreignKey':_0x014f('0x13e')});db[_0x014f('0x38')]['hasMany'](db[_0x014f('0x3d')],{'as':'Messages','foreignKey':_0x014f('0x13e')});db[_0x014f('0x38')][_0x014f('0xfc')](db['MailInteraction'],{'as':_0x014f('0x142')});db[_0x014f('0x38')][_0x014f('0xfc')](db[_0x014f('0x3e')],{'as':_0x014f('0x123')});db[_0x014f('0x38')]['belongsTo'](db[_0x014f('0xf0')],{'as':_0x014f('0x143'),'foreignKey':'ListId'});db[_0x014f('0x38')][_0x014f('0x103')](db[_0x014f('0x86')],{'as':_0x014f('0x86'),'foreignKey':'TemplateId'});db[_0x014f('0x38')]['belongsTo'](db[_0x014f('0x80')],{'as':_0x014f('0x12e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x014f('0x38')]['belongsToMany'](db[_0x014f('0x12')],{'as':'Agents','through':_0x014f('0x11f')});db[_0x014f('0x144')][_0x014f('0x10a')](db[_0x014f('0x12')],{'as':_0x014f('0x130'),'through':_0x014f('0x30')});db['MailQueue'][_0x014f('0x10a')](db[_0x014f('0xdf')],{'through':'team_has_mail_queues','as':_0x014f('0x131')});db[_0x014f('0x3b')]['hasMany'](db['MailMessage'],{'as':_0x014f('0x145'),'onDelete':_0x014f('0xf9'),'foreignKey':'MailInteractionId'});db['MailInteraction']['belongsTo'](db[_0x014f('0x38')],{'as':_0x014f('0x146'),'foreignKey':'MailAccountId'});db[_0x014f('0x3b')][_0x014f('0x103')](db[_0x014f('0x6b')],{'as':_0x014f('0x13b'),'foreignKey':_0x014f('0x13c')});db['MailInteraction']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x014f('0xfa')});db['MailInteraction'][_0x014f('0x10a')](db[_0x014f('0x147')],{'through':_0x014f('0x148'),'as':_0x014f('0x149')});db[_0x014f('0x3b')]['belongsToMany'](db[_0x014f('0x147')],{'through':_0x014f('0x148'),'as':_0x014f('0x14a')});db[_0x014f('0x3b')][_0x014f('0x10a')](db['User'],{'as':_0x014f('0x14b'),'through':_0x014f('0x10e'),'foreignKey':_0x014f('0x14c')});db[_0x014f('0x3d')]['hasMany'](db['Attachment'],{'as':_0x014f('0x14d'),'onDelete':'cascade'});db[_0x014f('0x3d')][_0x014f('0x103')](db[_0x014f('0x12')],{'as':_0x014f('0x12')});db[_0x014f('0x3d')]['belongsTo'](db[_0x014f('0x6b')],{'onDelete':_0x014f('0xf9'),'as':'Contact'});db[_0x014f('0x3d')][_0x014f('0x103')](db[_0x014f('0x3b')],{'as':'Interaction','foreignKey':_0x014f('0x14c')});db[_0x014f('0x3d')][_0x014f('0x103')](db[_0x014f('0x38')],{'as':_0x014f('0x146'),'foreignKey':_0x014f('0x13e')});db[_0x014f('0x3e')][_0x014f('0x103')](db[_0x014f('0x12')],{'onDelete':_0x014f('0x14e')});db['MailApplication'][_0x014f('0x103')](db[_0x014f('0x144')],{'onDelete':_0x014f('0x14e')});db[_0x014f('0x3e')]['belongsTo'](db[_0x014f('0x38')],{'onDelete':_0x014f('0x14e')});db[_0x014f('0x3e')][_0x014f('0x103')](db['Interval'],{'onDelete':_0x014f('0x14e'),'foreignKey':_0x014f('0x12d')});db['MailApplication'][_0x014f('0x103')](db[_0x014f('0x147')],{'onDelete':_0x014f('0x14e'),'foreignKey':'TagId'});db[_0x014f('0x40')][_0x014f('0x103')](db[_0x014f('0x38')],{});db[_0x014f('0x40')][_0x014f('0x103')](db[_0x014f('0xf0')],{'as':_0x014f('0x143'),'foreignKey':_0x014f('0x14f')});db[_0x014f('0x40')][_0x014f('0x103')](db[_0x014f('0x6b')],{'as':_0x014f('0x13b'),'foreignKey':_0x014f('0x13c')});db['MailQueueReport'][_0x014f('0x103')](db[_0x014f('0x3b')],{});db[_0x014f('0x40')][_0x014f('0x103')](db[_0x014f('0x3d')],{});db[_0x014f('0x40')][_0x014f('0x103')](db[_0x014f('0x12')],{});db[_0x014f('0x40')]['belongsTo'](db[_0x014f('0x144')],{});db[_0x014f('0x41')][_0x014f('0xfc')](db[_0x014f('0x150')],{'as':'Items','onDelete':'cascade'});db['FaxAccount']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'FaxAccountId'});db[_0x014f('0x151')][_0x014f('0xfc')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x014f('0x152')});db[_0x014f('0x151')]['hasMany'](db[_0x014f('0x47')],{'as':_0x014f('0x142')});db[_0x014f('0x151')]['hasMany'](db[_0x014f('0x45')],{'as':_0x014f('0x123')});db[_0x014f('0x151')]['hasMany'](db[_0x014f('0x18')],{'as':_0x014f('0x153'),'onDelete':_0x014f('0xf9')});db[_0x014f('0x151')][_0x014f('0xfc')](db[_0x014f('0x48')],{'as':_0x014f('0x145')});db[_0x014f('0x151')][_0x014f('0x103')](db['Trunk'],{'as':_0x014f('0x29')});db[_0x014f('0x151')][_0x014f('0x103')](db[_0x014f('0xf0')],{'as':'List','foreignKey':_0x014f('0x14f')});db[_0x014f('0x151')][_0x014f('0x103')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x014f('0x12f')});db[_0x014f('0x151')]['belongsToMany'](db[_0x014f('0x12')],{'as':_0x014f('0x130'),'through':_0x014f('0x11d')});db[_0x014f('0x45')]['belongsTo'](db[_0x014f('0x12')],{'onDelete':_0x014f('0x14e')});db[_0x014f('0x45')]['belongsTo'](db[_0x014f('0x4a')],{'onDelete':_0x014f('0x14e')});db[_0x014f('0x45')][_0x014f('0x103')](db[_0x014f('0x151')],{'onDelete':'restrict'});db[_0x014f('0x45')][_0x014f('0x103')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x014f('0x154')});db[_0x014f('0x47')][_0x014f('0xfc')](db['FaxMessage'],{'as':_0x014f('0x145'),'onDelete':_0x014f('0xf9'),'foreignKey':'FaxInteractionId'});db[_0x014f('0x47')][_0x014f('0x103')](db[_0x014f('0x151')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x014f('0x47')]['belongsTo'](db[_0x014f('0x6b')],{'as':_0x014f('0x13b'),'foreignKey':_0x014f('0x13c')});db[_0x014f('0x47')][_0x014f('0x103')](db[_0x014f('0x12')],{'as':_0x014f('0x155'),'foreignKey':_0x014f('0xfa')});db[_0x014f('0x47')][_0x014f('0x10a')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x014f('0x149')});db[_0x014f('0x47')]['belongsToMany'](db[_0x014f('0x147')],{'through':_0x014f('0x156'),'as':_0x014f('0x14a')});db[_0x014f('0x47')][_0x014f('0x10a')](db['User'],{'as':_0x014f('0x14b'),'through':_0x014f('0x157'),'foreignKey':_0x014f('0x158')});db[_0x014f('0x48')]['belongsTo'](db[_0x014f('0x12')],{'onDelete':_0x014f('0xf9'),'as':_0x014f('0x12')});db[_0x014f('0x48')][_0x014f('0x103')](db[_0x014f('0x47')],{'as':_0x014f('0x159'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x014f('0x103')](db[_0x014f('0x6b')],{'onDelete':_0x014f('0xf9'),'as':_0x014f('0x13b')});db['FaxMessage'][_0x014f('0x103')](db[_0x014f('0xe6')],{'as':_0x014f('0xe6'),'foreignKey':_0x014f('0x15a')});db['FaxMessage'][_0x014f('0x103')](db[_0x014f('0x151')],{'as':_0x014f('0x146'),'foreignKey':_0x014f('0x152')});db[_0x014f('0x4a')][_0x014f('0x10a')](db[_0x014f('0x12')],{'as':_0x014f('0x130'),'through':'UserFaxQueue'});db[_0x014f('0x4a')]['belongsToMany'](db[_0x014f('0xdf')],{'through':_0x014f('0x15b'),'as':'Teams'});db[_0x014f('0x4b')][_0x014f('0x103')](db[_0x014f('0x151')],{});db[_0x014f('0x4b')][_0x014f('0x103')](db[_0x014f('0xf0')],{'as':_0x014f('0x143'),'foreignKey':_0x014f('0x14f')});db[_0x014f('0x4b')][_0x014f('0x103')](db['CmContact'],{'as':_0x014f('0x13b'),'foreignKey':_0x014f('0x13c')});db['FaxQueueReport']['belongsTo'](db[_0x014f('0x47')],{});db['FaxQueueReport'][_0x014f('0x103')](db['FaxMessage'],{});db[_0x014f('0x4b')]['belongsTo'](db[_0x014f('0x12')],{});db[_0x014f('0x4b')]['belongsTo'](db[_0x014f('0x4a')],{});db[_0x014f('0x4d')]['hasMany'](db[_0x014f('0x7b')],{'as':_0x014f('0x140'),'foreignKey':_0x014f('0x15c')});db[_0x014f('0x4d')][_0x014f('0xfc')](db[_0x014f('0x7a')],{'as':_0x014f('0x141'),'foreignKey':_0x014f('0x15c')});db['SmsAccount'][_0x014f('0xfc')](db[_0x014f('0x4f')],{'as':'Messages','foreignKey':_0x014f('0x15c')});db[_0x014f('0x4d')][_0x014f('0xfc')](db[_0x014f('0x4e')],{'as':_0x014f('0x142')});db[_0x014f('0x4d')][_0x014f('0xfc')](db[_0x014f('0x15d')],{'as':_0x014f('0x123')});db['SmsAccount'][_0x014f('0x103')](db[_0x014f('0xf0')],{'as':_0x014f('0x143'),'foreignKey':_0x014f('0x14f')});db['SmsAccount'][_0x014f('0x103')](db[_0x014f('0x80')],{'as':_0x014f('0x12e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x014f('0x4d')][_0x014f('0x10a')](db['User'],{'as':'Agents','through':_0x014f('0x15e')});db[_0x014f('0x15d')]['belongsTo'](db[_0x014f('0x12')],{'onDelete':_0x014f('0x14e')});db[_0x014f('0x15d')][_0x014f('0x103')](db[_0x014f('0x117')],{'onDelete':_0x014f('0x14e')});db[_0x014f('0x15d')][_0x014f('0x103')](db[_0x014f('0x4d')],{'onDelete':_0x014f('0x14e')});db['SmsApplication'][_0x014f('0x103')](db[_0x014f('0x12c')],{'onDelete':_0x014f('0x14e'),'foreignKey':_0x014f('0x12d')});db[_0x014f('0x15d')]['belongsTo'](db[_0x014f('0x147')],{'onDelete':'restrict','foreignKey':_0x014f('0x154')});db['SmsInteraction'][_0x014f('0xfc')](db[_0x014f('0x4f')],{'as':_0x014f('0x145'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x15f')});db[_0x014f('0x4e')]['belongsTo'](db['SmsAccount'],{'as':_0x014f('0x146'),'foreignKey':'SmsAccountId'});db[_0x014f('0x4e')]['belongsTo'](db[_0x014f('0x6b')],{'as':_0x014f('0x13b'),'foreignKey':'ContactId'});db['SmsInteraction']['belongsTo'](db[_0x014f('0x12')],{'as':_0x014f('0x155'),'foreignKey':_0x014f('0xfa')});db[_0x014f('0x4e')][_0x014f('0x10a')](db['Tag'],{'through':_0x014f('0x160'),'as':'Tags'});db[_0x014f('0x4e')][_0x014f('0x10a')](db[_0x014f('0x147')],{'through':_0x014f('0x160'),'as':_0x014f('0x14a')});db[_0x014f('0x4e')]['belongsToMany'](db[_0x014f('0x12')],{'as':_0x014f('0x14b'),'through':_0x014f('0x161'),'foreignKey':_0x014f('0x15f')});db['SmsMessage'][_0x014f('0x103')](db['User'],{'as':'User'});db[_0x014f('0x4f')][_0x014f('0x103')](db['CmContact'],{'onDelete':_0x014f('0xf9'),'as':_0x014f('0x13b')});db['SmsMessage'][_0x014f('0x103')](db['SmsInteraction'],{'onDelete':'cascade','as':_0x014f('0x159'),'foreignKey':_0x014f('0x15f')});db[_0x014f('0x4f')][_0x014f('0x103')](db['SmsAccount'],{'as':_0x014f('0x146'),'foreignKey':_0x014f('0x15c')});db['SmsQueue']['belongsToMany'](db[_0x014f('0x12')],{'as':_0x014f('0x130'),'through':_0x014f('0x32'),'foreignKey':'SmsQueueId'});db[_0x014f('0x117')][_0x014f('0x10a')](db['Team'],{'through':'team_has_sms_queues','as':_0x014f('0x131')});db[_0x014f('0x162')]['hasMany'](db[_0x014f('0x7b')],{'as':_0x014f('0x140'),'foreignKey':_0x014f('0x163')});db[_0x014f('0x162')][_0x014f('0xfc')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x014f('0x163')});db[_0x014f('0x162')]['hasMany'](db[_0x014f('0x54')],{'as':_0x014f('0x142'),'foreignKey':_0x014f('0x163')});db[_0x014f('0x162')][_0x014f('0xfc')](db['OpenchannelMessage'],{'as':_0x014f('0x145'),'foreignKey':_0x014f('0x163')});db[_0x014f('0x162')][_0x014f('0xfc')](db[_0x014f('0x164')],{'as':_0x014f('0x123'),'foreignKey':_0x014f('0x163')});db[_0x014f('0x162')][_0x014f('0x103')](db[_0x014f('0xf0')],{'as':_0x014f('0x143'),'foreignKey':_0x014f('0x14f')});db[_0x014f('0x162')][_0x014f('0x103')](db[_0x014f('0x80')],{'as':_0x014f('0x12e'),'foreignKey':_0x014f('0x12f')});db[_0x014f('0x162')][_0x014f('0x10a')](db[_0x014f('0x12')],{'as':_0x014f('0x130'),'through':'user_has_openchannel_accounts'});db[_0x014f('0x164')][_0x014f('0x103')](db['User'],{'onDelete':_0x014f('0x14e')});db['OpenchannelApplication'][_0x014f('0x103')](db['OpenchannelQueue'],{'onDelete':_0x014f('0x14e'),'foreignKey':_0x014f('0x165')});db[_0x014f('0x164')][_0x014f('0x103')](db['OpenchannelAccount'],{'onDelete':_0x014f('0x14e'),'foreignKey':'OpenchannelAccountId'});db[_0x014f('0x164')][_0x014f('0x103')](db[_0x014f('0x12c')],{'onDelete':_0x014f('0x14e'),'foreignKey':_0x014f('0x12d')});db[_0x014f('0x164')]['belongsTo'](db[_0x014f('0x147')],{'onDelete':_0x014f('0x14e'),'foreignKey':_0x014f('0x154')});db[_0x014f('0x54')][_0x014f('0xfc')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x166')});db[_0x014f('0x54')][_0x014f('0x103')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x014f('0x163')});db['OpenchannelInteraction'][_0x014f('0x103')](db[_0x014f('0x6b')],{'as':_0x014f('0x13b'),'foreignKey':_0x014f('0x13c')});db[_0x014f('0x54')][_0x014f('0x103')](db[_0x014f('0x12')],{'as':'Owner','foreignKey':_0x014f('0xfa')});db[_0x014f('0x54')][_0x014f('0x10a')](db[_0x014f('0x147')],{'through':_0x014f('0x167'),'as':_0x014f('0x149')});db[_0x014f('0x54')][_0x014f('0x10a')](db[_0x014f('0x147')],{'through':_0x014f('0x167'),'as':_0x014f('0x14a')});db[_0x014f('0x54')][_0x014f('0x10a')](db[_0x014f('0x12')],{'as':'Users','through':_0x014f('0x112'),'foreignKey':_0x014f('0x166')});db[_0x014f('0x55')][_0x014f('0x103')](db[_0x014f('0x12')],{'onDelete':_0x014f('0xf9'),'as':_0x014f('0x12')});db[_0x014f('0x55')]['belongsTo'](db[_0x014f('0x6b')],{'onDelete':'cascade','as':_0x014f('0x13b')});db[_0x014f('0x55')]['belongsTo'](db[_0x014f('0x54')],{'onDelete':_0x014f('0xf9'),'as':_0x014f('0x159'),'foreignKey':_0x014f('0x166')});db[_0x014f('0x55')][_0x014f('0x103')](db[_0x014f('0xe6')],{'as':_0x014f('0xe6'),'foreignKey':_0x014f('0x15a')});db['OpenchannelMessage'][_0x014f('0x103')](db[_0x014f('0x162')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue']['belongsToMany'](db[_0x014f('0x12')],{'as':_0x014f('0x130'),'through':_0x014f('0x119'),'foreignKey':_0x014f('0x165')});db[_0x014f('0x56')]['belongsToMany'](db['Team'],{'through':_0x014f('0x168'),'as':'Teams'});db[_0x014f('0x58')][_0x014f('0xfc')](db['Disposition'],{'as':_0x014f('0x140'),'foreignKey':'ChatWebsiteId'});db[_0x014f('0x58')]['hasMany'](db['CannedAnswer'],{'as':_0x014f('0x141'),'foreignKey':_0x014f('0x169')});db[_0x014f('0x58')][_0x014f('0xfc')](db[_0x014f('0x16a')],{'as':_0x014f('0x16b')});db[_0x014f('0x58')]['hasMany'](db[_0x014f('0x5e')],{'as':_0x014f('0x142')});db['ChatWebsite'][_0x014f('0xfc')](db[_0x014f('0x5c')],{'as':_0x014f('0x123')});db[_0x014f('0x58')][_0x014f('0xfc')](db['ChatMessage'],{'as':_0x014f('0x145')});db[_0x014f('0x58')][_0x014f('0x103')](db[_0x014f('0xf0')],{'as':_0x014f('0x143'),'foreignKey':_0x014f('0x14f')});db[_0x014f('0x58')][_0x014f('0x103')](db[_0x014f('0x12c')],{'as':_0x014f('0x12c'),'foreignKey':_0x014f('0x12d')});db[_0x014f('0x58')][_0x014f('0x103')](db[_0x014f('0x80')],{'as':_0x014f('0x12e'),'foreignKey':_0x014f('0x12f')});db[_0x014f('0x58')][_0x014f('0x10a')](db[_0x014f('0x12')],{'as':_0x014f('0x130'),'through':_0x014f('0x11b')});db[_0x014f('0x5a')][_0x014f('0x103')](db['OpenchannelAccount'],{});db[_0x014f('0x5a')][_0x014f('0x103')](db['CmList'],{'as':_0x014f('0x143'),'foreignKey':_0x014f('0x14f')});db['OpenchannelQueueReport']['belongsTo'](db[_0x014f('0x6b')],{'as':_0x014f('0x13b'),'foreignKey':_0x014f('0x13c')});db[_0x014f('0x5a')][_0x014f('0x103')](db['OpenchannelInteraction'],{});db[_0x014f('0x5a')][_0x014f('0x103')](db[_0x014f('0x55')],{});db[_0x014f('0x5a')][_0x014f('0x103')](db['User'],{});db[_0x014f('0x5a')][_0x014f('0x103')](db[_0x014f('0x56')],{});db['ChatApplication'][_0x014f('0x103')](db[_0x014f('0x12')],{'as':_0x014f('0x16c'),'foreignKey':_0x014f('0xfa'),'onDelete':_0x014f('0x14e')});db[_0x014f('0x5c')][_0x014f('0x103')](db['ChatQueue'],{'as':_0x014f('0x16d'),'foreignKey':_0x014f('0x16e'),'onDelete':_0x014f('0x14e')});db[_0x014f('0x5c')]['belongsTo'](db[_0x014f('0x58')],{'as':'Website','foreignKey':_0x014f('0x169'),'onDelete':_0x014f('0x14e')});db[_0x014f('0x5c')][_0x014f('0x103')](db[_0x014f('0x147')],{'onDelete':_0x014f('0x14e'),'foreignKey':_0x014f('0x154')});db[_0x014f('0x5e')]['hasMany'](db[_0x014f('0x60')],{'as':_0x014f('0x145'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x16f')});db[_0x014f('0x5e')][_0x014f('0x103')](db[_0x014f('0x58')],{'as':'Account','foreignKey':_0x014f('0x169')});db[_0x014f('0x5e')][_0x014f('0x103')](db[_0x014f('0x6b')],{'as':_0x014f('0x13b'),'foreignKey':_0x014f('0x13c')});db[_0x014f('0x5e')][_0x014f('0x103')](db[_0x014f('0x12')],{'as':'Owner','foreignKey':_0x014f('0xfa')});db[_0x014f('0x5e')][_0x014f('0x10a')](db[_0x014f('0x147')],{'through':_0x014f('0x170'),'as':_0x014f('0x149')});db[_0x014f('0x5e')][_0x014f('0x10a')](db[_0x014f('0x147')],{'through':'chat_interaction_has_tags','as':_0x014f('0x14a')});db[_0x014f('0x5e')]['belongsToMany'](db['User'],{'as':_0x014f('0x14b'),'through':_0x014f('0x110'),'foreignKey':'ChatInteractionId'});db[_0x014f('0x60')]['belongsTo'](db['User'],{'onDelete':_0x014f('0xf9'),'as':'User'});db[_0x014f('0x60')]['belongsTo'](db['CmContact'],{'onDelete':_0x014f('0xf9'),'as':'Contact','foreignKey':_0x014f('0x13c')});db[_0x014f('0x60')][_0x014f('0x103')](db['ChatInteraction'],{'onDelete':_0x014f('0xf9'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0x014f('0x60')]['belongsTo'](db[_0x014f('0xe6')],{'as':_0x014f('0xe6'),'foreignKey':'AttachmentId'});db[_0x014f('0x60')][_0x014f('0x103')](db[_0x014f('0x58')],{'as':_0x014f('0x146'),'foreignKey':_0x014f('0x169')});db['ChatOfflineMessage'][_0x014f('0x103')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':_0x014f('0x13c')});db[_0x014f('0x62')][_0x014f('0x103')](db[_0x014f('0x58')],{'as':_0x014f('0x146'),'foreignKey':'ChatWebsiteId'});db[_0x014f('0x64')][_0x014f('0x10a')](db[_0x014f('0x12')],{'as':_0x014f('0x130'),'through':_0x014f('0x2f'),'hooks':!![]});db[_0x014f('0x64')][_0x014f('0x10a')](db[_0x014f('0xdf')],{'through':_0x014f('0x171'),'as':_0x014f('0x131')});db[_0x014f('0x66')][_0x014f('0xfc')](db['ChatInternalMessage'],{'as':_0x014f('0x145'),'foreignKey':_0x014f('0x172'),'onDelete':'cascade'});db[_0x014f('0x66')][_0x014f('0x10a')](db[_0x014f('0x12')],{'as':_0x014f('0x173'),'through':_0x014f('0x107')});db[_0x014f('0x16a')]['belongsTo'](db[_0x014f('0x58')],{'as':_0x014f('0x174'),'foreignKey':_0x014f('0x169')});db[_0x014f('0x69')][_0x014f('0xfc')](db[_0x014f('0x6b')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0x014f('0x6b')][_0x014f('0xfc')](db[_0x014f('0x6d')],{'as':_0x014f('0x175'),'foreignKey':_0x014f('0x13c')});db[_0x014f('0x6b')]['hasMany'](db[_0x014f('0x71')],{'as':_0x014f('0x126'),'foreignKey':_0x014f('0x13c')});db[_0x014f('0x6b')][_0x014f('0xfc')](db[_0x014f('0x72')],{'as':_0x014f('0x127'),'foreignKey':_0x014f('0x13c')});db[_0x014f('0x6b')][_0x014f('0xfc')](db['ReportAgentPreview'],{'as':_0x014f('0x74'),'foreignKey':'ContactId'});db['CmContact'][_0x014f('0xfc')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x014f('0x13c')});db[_0x014f('0x6b')][_0x014f('0xfc')](db[_0x014f('0x54')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x014f('0xfc')](db['ChatInteraction'],{'as':_0x014f('0x10f'),'foreignKey':_0x014f('0x13c'),'onDelete':_0x014f('0x14e')});db[_0x014f('0x6b')]['hasMany'](db[_0x014f('0x4e')],{'as':_0x014f('0x111'),'foreignKey':_0x014f('0x13c'),'onDelete':_0x014f('0x14e')});db['CmContact'][_0x014f('0xfc')](db[_0x014f('0x47')],{'as':_0x014f('0x101'),'foreignKey':_0x014f('0x13c'),'onDelete':_0x014f('0x14e')});db[_0x014f('0x6b')][_0x014f('0xfc')](db[_0x014f('0x3b')],{'as':_0x014f('0x102'),'foreignKey':_0x014f('0x13c'),'onDelete':'restrict'});db[_0x014f('0x6b')][_0x014f('0x103')](db[_0x014f('0x69')],{'as':_0x014f('0x176'),'foreignKey':_0x014f('0x177')});db[_0x014f('0x6b')][_0x014f('0x103')](db['CmList'],{'as':_0x014f('0x143'),'foreignKey':_0x014f('0x14f'),'onDelete':_0x014f('0xf9')});db[_0x014f('0x6b')]['belongsToMany'](db[_0x014f('0x12')],{'as':'Users','through':'cm_user_has_contacts'});db['CmContact']['belongsToMany'](db[_0x014f('0x147')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x014f('0x6b')][_0x014f('0x10a')](db[_0x014f('0x147')],{'through':'cm_contact_has_tags','as':_0x014f('0x14a')});db[_0x014f('0x6d')][_0x014f('0x103')](db[_0x014f('0x6b')],{'as':_0x014f('0x13b'),'foreignKey':_0x014f('0x13c'),'onDelete':_0x014f('0xf9')});db['CmHopper'][_0x014f('0x103')](db['CmList'],{'as':'List','foreignKey':_0x014f('0x14f'),'onDelete':_0x014f('0xf9')});db[_0x014f('0x6d')][_0x014f('0x103')](db[_0x014f('0x12')],{'as':_0x014f('0x16c'),'foreignKey':'UserId'});db[_0x014f('0x6d')][_0x014f('0x103')](db[_0x014f('0x1c')],{'as':_0x014f('0x16d'),'foreignKey':_0x014f('0x125'),'onDelete':_0x014f('0xf9')});db[_0x014f('0x6d')][_0x014f('0x103')](db[_0x014f('0x178')],{'as':'Campaign','foreignKey':_0x014f('0x179'),'onDelete':_0x014f('0xf9')});db[_0x014f('0x6d')]['belongsTo'](db[_0x014f('0x12')],{'as':_0x014f('0x155'),'foreignKey':_0x014f('0x17a')});db[_0x014f('0x6f')]['belongsTo'](db[_0x014f('0x6b')],{'as':_0x014f('0x13b'),'foreignKey':'ContactId','onDelete':_0x014f('0xf9')});db[_0x014f('0x6f')][_0x014f('0x103')](db[_0x014f('0xf0')],{'as':_0x014f('0x143'),'foreignKey':'ListId','onDelete':_0x014f('0xf9')});db[_0x014f('0x6f')][_0x014f('0x103')](db[_0x014f('0x1c')],{'as':_0x014f('0x16d'),'foreignKey':_0x014f('0x125'),'onDelete':_0x014f('0xf9')});db[_0x014f('0x6f')][_0x014f('0x103')](db['Campaign'],{'as':_0x014f('0x178'),'foreignKey':'CampaignId','onDelete':'cascade'});db['Automation']['hasMany'](db[_0x014f('0x7d')],{'as':{'plural':_0x014f('0x17b'),'singular':'OneAll'},'foreignKey':_0x014f('0x17c'),'onDelete':_0x014f('0xf9'),'hooks':!![]});db[_0x014f('0x17d')]['hasMany'](db['Condition'],{'as':{'plural':_0x014f('0x17e'),'singular':_0x014f('0x17f')},'foreignKey':_0x014f('0x180'),'onDelete':_0x014f('0xf9'),'hooks':!![]});db[_0x014f('0x17d')][_0x014f('0xfc')](db['Action'],{'as':_0x014f('0x181'),'foreignKey':_0x014f('0x182'),'onDelete':'cascade','hooks':!![]});db['Interval'][_0x014f('0xfc')](db[_0x014f('0x12c')],{'as':_0x014f('0x183'),'foreignKey':_0x014f('0x12d'),'onDelete':_0x014f('0xf9'),'hooks':!![],'required':![]});db[_0x014f('0x12c')]['hasMany'](db[_0x014f('0x18')],{'as':_0x014f('0x184'),'foreignKey':'IntervalId','onDelete':_0x014f('0x14e')});db[_0x014f('0x12c')]['hasMany'](db[_0x014f('0x3e')],{'as':_0x014f('0x185'),'foreignKey':_0x014f('0x12d')});db[_0x014f('0x12c')][_0x014f('0xfc')](db['ChatApplication'],{'as':_0x014f('0x186'),'foreignKey':_0x014f('0x12d')});db[_0x014f('0x12c')][_0x014f('0xfc')](db[_0x014f('0x45')],{'as':_0x014f('0x187'),'foreignKey':'IntervalId'});db[_0x014f('0x12c')]['hasMany'](db[_0x014f('0x15d')],{'as':_0x014f('0x188'),'foreignKey':_0x014f('0x12d')});db[_0x014f('0x82')][_0x014f('0x103')](db[_0x014f('0x38')],{});db['Schedule']['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':_0x014f('0x189')});db[_0x014f('0x82')][_0x014f('0x103')](db[_0x014f('0x8d')],{'foreignKey':_0x014f('0x18a')});db[_0x014f('0x84')]['belongsToMany'](db[_0x014f('0x1a')],{'as':'Mohs','through':_0x014f('0x124'),'onDelete':'restrict'});db['Tag'][_0x014f('0x10a')](db[_0x014f('0x6b')],{'through':_0x014f('0x18b')});db[_0x014f('0x147')][_0x014f('0x10a')](db[_0x014f('0x5e')],{'through':'chat_interaction_has_tags'});db[_0x014f('0x147')]['belongsToMany'](db[_0x014f('0x3b')],{'through':_0x014f('0x148')});db[_0x014f('0x147')][_0x014f('0x10a')](db[_0x014f('0x4e')],{'through':'sms_interaction_has_tags'});db[_0x014f('0x147')][_0x014f('0x10a')](db[_0x014f('0x47')],{'through':_0x014f('0x156')});db[_0x014f('0x147')][_0x014f('0x10a')](db['OpenchannelInteraction'],{'through':_0x014f('0x167')});db[_0x014f('0x88')][_0x014f('0xfc')](db[_0x014f('0x7d')],{'as':{'plural':_0x014f('0x18c'),'singular':_0x014f('0x18d')},'foreignKey':_0x014f('0x18e'),'onDelete':_0x014f('0xf9'),'hooks':!![]});db[_0x014f('0x88')]['hasMany'](db['Condition'],{'as':{'plural':_0x014f('0x18f'),'singular':_0x014f('0x190')},'foreignKey':_0x014f('0x191'),'onDelete':_0x014f('0xf9'),'hooks':!![]});db[_0x014f('0x88')][_0x014f('0xfc')](db[_0x014f('0x192')],{'as':_0x014f('0x181'),'foreignKey':_0x014f('0x193'),'onDelete':_0x014f('0xf9'),'hooks':!![]});db[_0x014f('0x8d')][_0x014f('0xfc')](db[_0x014f('0x93')],{'as':'Fields','onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x014f('0xfc')](db[_0x014f('0x93')],{'as':_0x014f('0x194'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x189')});db[_0x014f('0x195')][_0x014f('0xfc')](db[_0x014f('0x93')],{'as':_0x014f('0x194'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x196')});db[_0x014f('0x93')][_0x014f('0x103')](db[_0x014f('0x195')],{'foreignKey':_0x014f('0x196')});db[_0x014f('0x96')][_0x014f('0xfc')](db['SalesforceConfiguration'],{'as':_0x014f('0x197'),'onDelete':_0x014f('0xf9'),'foreignKey':'AccountId'});db[_0x014f('0x198')][_0x014f('0xfc')](db['SalesforceField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x014f('0x199')});db['SalesforceConfiguration'][_0x014f('0xfc')](db[_0x014f('0x99')],{'as':_0x014f('0x19a'),'onDelete':'cascade','foreignKey':_0x014f('0x19b')});db[_0x014f('0x198')][_0x014f('0xfc')](db[_0x014f('0x99')],{'as':_0x014f('0x194'),'onDelete':_0x014f('0xf9'),'foreignKey':'FieldId'});db[_0x014f('0x198')][_0x014f('0x103')](db[_0x014f('0x96')],{'as':_0x014f('0x146'),'foreignKey':_0x014f('0x19c')});db[_0x014f('0x99')][_0x014f('0xfc')](db[_0x014f('0x99')],{'as':_0x014f('0x19d'),'foreignKey':_0x014f('0x199')});db['SalesforceField'][_0x014f('0xfc')](db['SalesforceField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x014f('0x99')][_0x014f('0xfc')](db[_0x014f('0x99')],{'as':_0x014f('0x19e'),'foreignKey':'FieldId'});db[_0x014f('0x99')]['belongsTo'](db[_0x014f('0x8a')],{'as':_0x014f('0x8a'),'foreignKey':_0x014f('0x19f')});db['SugarcrmAccount'][_0x014f('0xfc')](db[_0x014f('0x1a0')],{'as':_0x014f('0x197'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x19c')});db[_0x014f('0x1a0')]['hasMany'](db['SugarcrmField'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0x014f('0xfc')](db[_0x014f('0x9e')],{'as':_0x014f('0x19a'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x19b')});db[_0x014f('0x1a0')][_0x014f('0xfc')](db[_0x014f('0x9e')],{'as':_0x014f('0x194'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x1a1')});db[_0x014f('0x1a0')][_0x014f('0x103')](db[_0x014f('0x9b')],{'as':_0x014f('0x146'),'foreignKey':_0x014f('0x19c')});db[_0x014f('0x9e')][_0x014f('0xfc')](db[_0x014f('0x9e')],{'as':_0x014f('0x19d'),'foreignKey':_0x014f('0x199')});db['SugarcrmField'][_0x014f('0xfc')](db['SugarcrmField'],{'as':_0x014f('0x1a2'),'foreignKey':_0x014f('0x19b')});db[_0x014f('0x9e')][_0x014f('0xfc')](db[_0x014f('0x9e')],{'as':_0x014f('0x19e'),'foreignKey':_0x014f('0x1a1')});db[_0x014f('0x9e')][_0x014f('0x103')](db[_0x014f('0x8a')],{'as':_0x014f('0x8a'),'foreignKey':_0x014f('0x19f')});db[_0x014f('0x1a3')][_0x014f('0xfc')](db[_0x014f('0xa1')],{'as':_0x014f('0x197'),'onDelete':'cascade','foreignKey':_0x014f('0x19c')});db[_0x014f('0xa1')][_0x014f('0xfc')](db[_0x014f('0x1a4')],{'as':_0x014f('0x1a5'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x199')});db[_0x014f('0xa1')]['hasMany'](db[_0x014f('0x1a4')],{'as':_0x014f('0x19a'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x19b')});db[_0x014f('0xa1')][_0x014f('0xfc')](db['DeskField'],{'as':_0x014f('0x194'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x1a1')});db[_0x014f('0xa1')][_0x014f('0x103')](db['DeskAccount'],{'as':_0x014f('0x146'),'foreignKey':_0x014f('0x19c')});db[_0x014f('0xa1')][_0x014f('0x10a')](db[_0x014f('0x147')],{'through':'int_desk_configuration_has_tags'});db[_0x014f('0x1a4')][_0x014f('0xfc')](db[_0x014f('0x1a4')],{'as':'Subject','foreignKey':_0x014f('0x199')});db[_0x014f('0x1a4')][_0x014f('0xfc')](db[_0x014f('0x1a4')],{'as':_0x014f('0x1a2'),'foreignKey':_0x014f('0x19b')});db[_0x014f('0x1a4')][_0x014f('0xfc')](db['DeskField'],{'as':_0x014f('0x19e'),'foreignKey':'FieldId'});db[_0x014f('0x1a4')][_0x014f('0x103')](db[_0x014f('0x8a')],{'as':_0x014f('0x8a'),'foreignKey':_0x014f('0x19f')});db[_0x014f('0xa3')][_0x014f('0xfc')](db[_0x014f('0xa5')],{'as':_0x014f('0x197'),'onDelete':_0x014f('0xf9'),'foreignKey':'AccountId'});db[_0x014f('0xa5')][_0x014f('0xfc')](db[_0x014f('0xa7')],{'as':'Subjects','onDelete':_0x014f('0xf9'),'foreignKey':'SubjectId'});db[_0x014f('0xa5')][_0x014f('0xfc')](db['ZohoField'],{'as':'Descriptions','onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x19b')});db['ZohoConfiguration'][_0x014f('0xfc')](db[_0x014f('0xa7')],{'as':'Fields','onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x1a1')});db['ZohoConfiguration']['belongsTo'](db[_0x014f('0xa3')],{'as':'Account','foreignKey':_0x014f('0x19c')});db[_0x014f('0xa7')]['hasMany'](db[_0x014f('0xa7')],{'as':_0x014f('0x19d'),'foreignKey':_0x014f('0x199')});db[_0x014f('0xa7')][_0x014f('0xfc')](db[_0x014f('0xa7')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x014f('0xa7')][_0x014f('0xfc')](db['ZohoField'],{'as':_0x014f('0x19e'),'foreignKey':'FieldId'});db[_0x014f('0xa7')][_0x014f('0x103')](db['Variable'],{'as':_0x014f('0x8a'),'foreignKey':_0x014f('0x19f')});db[_0x014f('0x1a6')][_0x014f('0xfc')](db[_0x014f('0xaa')],{'as':'Configurations','onDelete':_0x014f('0xf9'),'foreignKey':'AccountId'});db[_0x014f('0xaa')][_0x014f('0xfc')](db[_0x014f('0xab')],{'as':_0x014f('0x1a5'),'foreignKey':_0x014f('0x199')});db[_0x014f('0xaa')][_0x014f('0xfc')](db[_0x014f('0xab')],{'as':_0x014f('0x19a'),'foreignKey':_0x014f('0x19b')});db[_0x014f('0xaa')][_0x014f('0xfc')](db[_0x014f('0xab')],{'as':_0x014f('0x194'),'foreignKey':_0x014f('0x1a1')});db[_0x014f('0xaa')][_0x014f('0x103')](db[_0x014f('0x1a6')],{'as':_0x014f('0x146'),'foreignKey':_0x014f('0x19c')});db[_0x014f('0xaa')][_0x014f('0x10a')](db[_0x014f('0x147')],{'through':_0x014f('0x1a7')});db[_0x014f('0xab')][_0x014f('0xfc')](db[_0x014f('0xab')],{'as':_0x014f('0x19d'),'foreignKey':_0x014f('0x199')});db[_0x014f('0xab')][_0x014f('0xfc')](db['ZendeskField'],{'as':_0x014f('0x1a2'),'foreignKey':'DescriptionId'});db[_0x014f('0xab')]['hasMany'](db[_0x014f('0xab')],{'as':_0x014f('0x19e'),'foreignKey':_0x014f('0x1a1')});db[_0x014f('0xab')][_0x014f('0x103')](db[_0x014f('0x8a')],{'as':_0x014f('0x8a'),'foreignKey':_0x014f('0x19f')});db[_0x014f('0xad')][_0x014f('0xfc')](db[_0x014f('0xaf')],{'as':_0x014f('0x197'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x19c')});db[_0x014f('0xaf')][_0x014f('0xfc')](db[_0x014f('0xb1')],{'as':_0x014f('0x1a5'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x199')});db[_0x014f('0xaf')][_0x014f('0xfc')](db[_0x014f('0xb1')],{'as':'Descriptions','onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x19b')});db[_0x014f('0xaf')]['hasMany'](db[_0x014f('0xb1')],{'as':_0x014f('0x194'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x1a1')});db[_0x014f('0xaf')][_0x014f('0x103')](db['FreshdeskAccount'],{'as':_0x014f('0x146'),'foreignKey':_0x014f('0x19c')});db['FreshdeskConfiguration']['belongsToMany'](db[_0x014f('0x147')],{'through':_0x014f('0x1a8')});db[_0x014f('0xb1')][_0x014f('0xfc')](db['FreshdeskField'],{'as':_0x014f('0x19d'),'foreignKey':'SubjectId'});db[_0x014f('0xb1')][_0x014f('0xfc')](db[_0x014f('0xb1')],{'as':_0x014f('0x1a2'),'foreignKey':'DescriptionId'});db[_0x014f('0xb1')]['hasMany'](db[_0x014f('0xb1')],{'as':_0x014f('0x19e'),'foreignKey':'FieldId'});db[_0x014f('0xb1')][_0x014f('0x103')](db[_0x014f('0x8a')],{'as':_0x014f('0x8a'),'foreignKey':_0x014f('0x19f')});db['VtigerAccount'][_0x014f('0xfc')](db['VtigerConfiguration'],{'as':_0x014f('0x197'),'onDelete':'cascade','foreignKey':_0x014f('0x19c')});db[_0x014f('0xb5')]['hasMany'](db['VtigerField'],{'as':_0x014f('0x1a5'),'foreignKey':_0x014f('0x199')});db[_0x014f('0xb5')][_0x014f('0xfc')](db[_0x014f('0xb7')],{'as':_0x014f('0x19a'),'foreignKey':_0x014f('0x19b')});db[_0x014f('0xb5')]['hasMany'](db['VtigerField'],{'as':_0x014f('0x194'),'foreignKey':_0x014f('0x1a1')});db[_0x014f('0xb5')][_0x014f('0x103')](db[_0x014f('0xb3')],{'as':_0x014f('0x146'),'foreignKey':_0x014f('0x19c')});db[_0x014f('0xb7')][_0x014f('0xfc')](db[_0x014f('0xb7')],{'as':_0x014f('0x19d'),'foreignKey':'SubjectId'});db['VtigerField'][_0x014f('0xfc')](db[_0x014f('0xb7')],{'as':'Description','foreignKey':_0x014f('0x19b')});db[_0x014f('0xb7')][_0x014f('0xfc')](db[_0x014f('0xb7')],{'as':_0x014f('0x19e'),'foreignKey':_0x014f('0x1a1')});db[_0x014f('0xb7')][_0x014f('0x103')](db[_0x014f('0x8a')],{'as':'Variable','foreignKey':_0x014f('0x19f')});db[_0x014f('0xb9')][_0x014f('0xfc')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x19c')});db['ServicenowConfiguration'][_0x014f('0xfc')](db[_0x014f('0xbd')],{'as':_0x014f('0x1a5'),'foreignKey':_0x014f('0x199')});db[_0x014f('0xbb')][_0x014f('0xfc')](db[_0x014f('0xbd')],{'as':_0x014f('0x19a'),'foreignKey':_0x014f('0x19b')});db['ServicenowConfiguration'][_0x014f('0xfc')](db['ServicenowField'],{'as':_0x014f('0x194'),'foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x014f('0x103')](db[_0x014f('0xb9')],{'as':_0x014f('0x146'),'foreignKey':_0x014f('0x19c')});db[_0x014f('0xbd')][_0x014f('0xfc')](db[_0x014f('0xbd')],{'as':_0x014f('0x19d'),'foreignKey':_0x014f('0x199')});db[_0x014f('0xbd')][_0x014f('0xfc')](db[_0x014f('0xbd')],{'as':_0x014f('0x1a2'),'foreignKey':'DescriptionId'});db[_0x014f('0xbd')][_0x014f('0xfc')](db[_0x014f('0xbd')],{'as':_0x014f('0x19e'),'foreignKey':_0x014f('0x1a1')});db['ServicenowField'][_0x014f('0x103')](db[_0x014f('0x8a')],{'as':'Variable','foreignKey':_0x014f('0x19f')});db['Dynamics365Account'][_0x014f('0xfc')](db[_0x014f('0xc0')],{'as':_0x014f('0x197'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x19c')});db[_0x014f('0xc0')][_0x014f('0xfc')](db[_0x014f('0xc2')],{'as':_0x014f('0x1a5'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x199')});db[_0x014f('0xc0')][_0x014f('0xfc')](db[_0x014f('0xc2')],{'as':_0x014f('0x19a'),'onDelete':_0x014f('0xf9'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration']['hasMany'](db[_0x014f('0xc2')],{'as':'Fields','onDelete':_0x014f('0xf9'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x014f('0x103')](db[_0x014f('0xbe')],{'as':_0x014f('0x146'),'foreignKey':_0x014f('0x19c')});db[_0x014f('0xc2')][_0x014f('0xfc')](db[_0x014f('0xc2')],{'as':_0x014f('0x19d'),'foreignKey':_0x014f('0x199')});db['Dynamics365Field'][_0x014f('0xfc')](db['Dynamics365Field'],{'as':_0x014f('0x1a2'),'foreignKey':'DescriptionId'});db[_0x014f('0xc2')][_0x014f('0xfc')](db[_0x014f('0xc2')],{'as':_0x014f('0x19e'),'foreignKey':_0x014f('0x1a1')});db['Dynamics365Field'][_0x014f('0x103')](db[_0x014f('0x8a')],{'as':_0x014f('0x8a'),'foreignKey':_0x014f('0x19f')});db[_0x014f('0xc4')]['hasMany'](db[_0x014f('0xc6')],{'as':_0x014f('0x197'),'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x19c')});db[_0x014f('0xc6')][_0x014f('0xfc')](db[_0x014f('0xc7')],{'as':_0x014f('0x1a5'),'foreignKey':_0x014f('0x199')});db[_0x014f('0xc6')]['hasMany'](db['FreshsalesField'],{'as':_0x014f('0x19a'),'foreignKey':_0x014f('0x19b')});db[_0x014f('0xc6')]['hasMany'](db[_0x014f('0xc7')],{'as':_0x014f('0x194'),'foreignKey':_0x014f('0x1a1')});db[_0x014f('0xc6')][_0x014f('0x103')](db['FreshsalesAccount'],{'as':_0x014f('0x146'),'foreignKey':_0x014f('0x19c')});db[_0x014f('0xc7')]['hasMany'](db[_0x014f('0xc7')],{'as':_0x014f('0x19d'),'foreignKey':_0x014f('0x199')});db[_0x014f('0xc7')]['hasMany'](db[_0x014f('0xc7')],{'as':_0x014f('0x1a2'),'foreignKey':_0x014f('0x19b')});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':'Field','foreignKey':_0x014f('0x1a1')});db[_0x014f('0xc7')][_0x014f('0x103')](db[_0x014f('0x8a')],{'as':_0x014f('0x8a'),'foreignKey':_0x014f('0x19f')});db[_0x014f('0xcc')][_0x014f('0x103')](db[_0x014f('0x58')],{});db['ChatQueueReport']['belongsTo'](db['CmList'],{'as':_0x014f('0x143'),'foreignKey':_0x014f('0x14f')});db[_0x014f('0xcc')][_0x014f('0x103')](db[_0x014f('0x6b')],{'as':_0x014f('0x13b'),'foreignKey':'ContactId'});db[_0x014f('0xcc')][_0x014f('0x103')](db[_0x014f('0x5e')],{});db['ChatQueueReport'][_0x014f('0x103')](db[_0x014f('0x60')],{});db[_0x014f('0xcc')][_0x014f('0x103')](db[_0x014f('0x12')],{});db[_0x014f('0xcc')]['belongsTo'](db['ChatQueue'],{});db[_0x014f('0x1a9')]['belongsTo'](db[_0x014f('0x12')],{'onDelete':_0x014f('0xf9'),'foreignKey':'FromId'});db[_0x014f('0x1a9')]['belongsTo'](db[_0x014f('0x12')],{'onDelete':_0x014f('0xf9'),'foreignKey':_0x014f('0x1aa')});db['JscriptySessionReport'][_0x014f('0xfc')](db[_0x014f('0x1ab')],{'foreignKey':_0x014f('0x1ac'),'onDelete':'cascade'});db['JscriptySessionReport'][_0x014f('0xfc')](db[_0x014f('0xcf')],{'foreignKey':_0x014f('0x1ac'),'onDelete':_0x014f('0xf9')});db[_0x014f('0x1ad')]['belongsTo'](db[_0x014f('0x4d')],{});db[_0x014f('0x1ad')][_0x014f('0x103')](db[_0x014f('0xf0')],{'as':_0x014f('0x143'),'foreignKey':_0x014f('0x14f')});db[_0x014f('0x1ad')]['belongsTo'](db[_0x014f('0x6b')],{'as':'Contact','foreignKey':_0x014f('0x13c')});db['SmsQueueReport']['belongsTo'](db[_0x014f('0x4e')],{});db[_0x014f('0x1ad')]['belongsTo'](db[_0x014f('0x4f')],{});db[_0x014f('0x1ad')][_0x014f('0x103')](db[_0x014f('0x12')],{});db[_0x014f('0x1ad')][_0x014f('0x103')](db['SmsQueue'],{});db[_0x014f('0xd5')][_0x014f('0xfc')](db[_0x014f('0x129')],{'foreignKey':_0x014f('0x1ae')});db[_0x014f('0xd5')][_0x014f('0xfc')](db[_0x014f('0x1ab')],{'foreignKey':'ProjectId'});db[_0x014f('0xd5')]['hasMany'](db[_0x014f('0xcf')],{'foreignKey':_0x014f('0x1ae')});db[_0x014f('0xda')][_0x014f('0x10a')](db['User'],{'as':_0x014f('0x14b'),'through':'user_has_square_projects'});db[_0x014f('0xdf')][_0x014f('0x10a')](db['User'],{'as':_0x014f('0x130'),'through':_0x014f('0x10d')});db[_0x014f('0xdf')][_0x014f('0x10a')](db[_0x014f('0x1c')],{'through':_0x014f('0x132'),'as':_0x014f('0x113')});db['Team'][_0x014f('0x10a')](db[_0x014f('0x144')],{'through':'team_has_mail_queues','as':_0x014f('0x114')});db[_0x014f('0xdf')]['belongsToMany'](db['ChatQueue'],{'through':_0x014f('0x171'),'as':_0x014f('0x115')});db[_0x014f('0xdf')][_0x014f('0x10a')](db[_0x014f('0x4a')],{'through':'team_has_fax_queues','as':_0x014f('0x116')});db[_0x014f('0xdf')][_0x014f('0x10a')](db['SmsQueue'],{'through':_0x014f('0x1af'),'as':_0x014f('0x118')});db[_0x014f('0xdf')]['belongsToMany'](db[_0x014f('0x56')],{'through':_0x014f('0x168'),'as':_0x014f('0x1b0')});db['Campaign'][_0x014f('0xfc')](db[_0x014f('0x6d')],{'as':_0x014f('0x175'),'foreignKey':_0x014f('0x179')});db[_0x014f('0x178')]['hasMany'](db[_0x014f('0x71')],{'as':_0x014f('0x126'),'foreignKey':_0x014f('0x179')});db[_0x014f('0x178')]['hasMany'](db[_0x014f('0x72')],{'as':_0x014f('0x127'),'foreignKey':'CampaignId'});db['Campaign'][_0x014f('0xfc')](db['CmHopperBlack'],{'as':_0x014f('0x128'),'foreignKey':_0x014f('0x179')});db['Campaign']['belongsTo'](db[_0x014f('0x29')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x014f('0x178')][_0x014f('0x103')](db[_0x014f('0x29')],{'as':_0x014f('0x12b'),'foreignKey':_0x014f('0x1b1')});db['Campaign'][_0x014f('0x103')](db[_0x014f('0x12c')],{'as':_0x014f('0x12c'),'foreignKey':'IntervalId'});db[_0x014f('0x178')]['belongsTo'](db[_0x014f('0xda')],{'as':_0x014f('0xda'),'foreignKey':'SquareProjectId'});db[_0x014f('0x178')][_0x014f('0x10a')](db[_0x014f('0xf0')],{'as':_0x014f('0x10b'),'through':_0x014f('0x1b2')});db[_0x014f('0x178')][_0x014f('0x10a')](db['CmList'],{'as':'BlackLists','through':_0x014f('0x1b3')});db[_0x014f('0xe8')][_0x014f('0x103')](db['MailMessage'],{});db['MailTransferReport'][_0x014f('0x103')](db[_0x014f('0x3b')],{});db[_0x014f('0xe8')]['belongsTo'](db[_0x014f('0x38')],{'foreignKey':_0x014f('0x1b4'),'as':_0x014f('0x1b5')});db[_0x014f('0xe8')]['belongsTo'](db[_0x014f('0x12')],{'foreignKey':_0x014f('0x1b6'),'as':_0x014f('0x1b7')});db[_0x014f('0xe8')]['belongsTo'](db['User'],{'foreignKey':_0x014f('0x1b8'),'as':_0x014f('0x1b9')});db[_0x014f('0xe8')][_0x014f('0x103')](db[_0x014f('0x144')],{'foreignKey':_0x014f('0x1ba'),'as':_0x014f('0x1bb')});db['MailTransferReport']['belongsTo'](db['MailAccount'],{'foreignKey':_0x014f('0x1bc'),'as':_0x014f('0x1bd')});db[_0x014f('0x1be')]['belongsTo'](db[_0x014f('0x60')],{});db[_0x014f('0x1be')][_0x014f('0x103')](db[_0x014f('0x5e')],{});db[_0x014f('0x1be')][_0x014f('0x103')](db[_0x014f('0x58')],{'foreignKey':'FromChatWebsiteId','as':_0x014f('0x1b5')});db[_0x014f('0x1be')]['belongsTo'](db[_0x014f('0x12')],{'foreignKey':_0x014f('0x1b6'),'as':_0x014f('0x1b7')});db['ChatTransferReport'][_0x014f('0x103')](db[_0x014f('0x12')],{'foreignKey':'ToUserId','as':_0x014f('0x1b9')});db[_0x014f('0x1be')][_0x014f('0x103')](db[_0x014f('0x64')],{'foreignKey':_0x014f('0x1bf'),'as':_0x014f('0x1bb')});db[_0x014f('0x1be')][_0x014f('0x103')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0x014f('0x1bd')});db[_0x014f('0xeb')][_0x014f('0x103')](db[_0x014f('0x48')],{});db['FaxTransferReport'][_0x014f('0x103')](db[_0x014f('0x47')],{});db['FaxTransferReport'][_0x014f('0x103')](db[_0x014f('0x151')],{'foreignKey':_0x014f('0x1c0'),'as':'FromAccount'});db[_0x014f('0xeb')][_0x014f('0x103')](db['User'],{'foreignKey':_0x014f('0x1b6'),'as':'FromAgent'});db[_0x014f('0xeb')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0x014f('0x1b9')});db[_0x014f('0xeb')]['belongsTo'](db[_0x014f('0x4a')],{'foreignKey':_0x014f('0x1c1'),'as':_0x014f('0x1bb')});db[_0x014f('0xeb')][_0x014f('0x103')](db['FaxAccount'],{'foreignKey':_0x014f('0x1c2'),'as':'ToAccount'});db[_0x014f('0xed')]['belongsTo'](db[_0x014f('0x55')],{});db[_0x014f('0xed')][_0x014f('0x103')](db[_0x014f('0x54')],{});db[_0x014f('0xed')][_0x014f('0x103')](db[_0x014f('0x162')],{'foreignKey':'FromOpenchannelAccountId','as':_0x014f('0x1b5')});db[_0x014f('0xed')][_0x014f('0x103')](db[_0x014f('0x12')],{'foreignKey':'FromUserId','as':_0x014f('0x1b7')});db[_0x014f('0xed')][_0x014f('0x103')](db[_0x014f('0x12')],{'foreignKey':'ToUserId','as':_0x014f('0x1b9')});db[_0x014f('0xed')]['belongsTo'](db[_0x014f('0x56')],{'foreignKey':_0x014f('0x1c3'),'as':_0x014f('0x1bb')});db['OpenchannelTransferReport'][_0x014f('0x103')](db[_0x014f('0x162')],{'foreignKey':_0x014f('0x1c4'),'as':_0x014f('0x1bd')});db['SmsTransferReport']['belongsTo'](db['SmsMessage'],{});db[_0x014f('0xef')][_0x014f('0x103')](db[_0x014f('0x4e')],{});db[_0x014f('0xef')][_0x014f('0x103')](db[_0x014f('0x4d')],{'foreignKey':_0x014f('0x1c5'),'as':_0x014f('0x1b5')});db['SmsTransferReport']['belongsTo'](db[_0x014f('0x12')],{'foreignKey':_0x014f('0x1b6'),'as':_0x014f('0x1b7')});db['SmsTransferReport']['belongsTo'](db[_0x014f('0x12')],{'foreignKey':_0x014f('0x1b8'),'as':_0x014f('0x1b9')});db[_0x014f('0xef')][_0x014f('0x103')](db[_0x014f('0x117')],{'foreignKey':_0x014f('0x1c6'),'as':_0x014f('0x1bb')});db[_0x014f('0xef')][_0x014f('0x103')](db[_0x014f('0x4d')],{'foreignKey':_0x014f('0x1c7'),'as':'ToAccount'});db[_0x014f('0xf0')][_0x014f('0xfc')](db[_0x014f('0x7b')],{'as':_0x014f('0x140'),'foreignKey':_0x014f('0x14f')});db[_0x014f('0xf0')]['hasMany'](db['CmCustomField'],{'as':_0x014f('0x1c8'),'foreignKey':_0x014f('0x14f')});db[_0x014f('0xf0')][_0x014f('0xfc')](db[_0x014f('0x6b')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0x014f('0x14f')});db[_0x014f('0xf0')][_0x014f('0xfc')](db['CmHopperFinal'],{'as':_0x014f('0x126'),'foreignKey':_0x014f('0x14f')});db[_0x014f('0xf0')][_0x014f('0xfc')](db[_0x014f('0x72')],{'as':_0x014f('0xff'),'foreignKey':_0x014f('0x14f')});db[_0x014f('0xf0')]['hasMany'](db[_0x014f('0x74')],{'as':'ReportAgentPreview','foreignKey':_0x014f('0x14f')});db[_0x014f('0xf0')]['belongsToMany'](db[_0x014f('0x1c')],{'as':_0x014f('0x1c9'),'through':_0x014f('0x1ca')});db[_0x014f('0xf0')]['belongsToMany'](db[_0x014f('0x12')],{'as':_0x014f('0x130'),'through':_0x014f('0x10c')});db[_0x014f('0xf2')][_0x014f('0xfc')](db['VoiceExtension'],{'as':_0x014f('0x184'),'onDelete':_0x014f('0x14e')});db[_0x014f('0xf2')][_0x014f('0x10a')](db['User'],{'as':_0x014f('0x130'),'through':'user_has_voice_prefixes'});db[_0x014f('0x104')][_0x014f('0xfc')](db[_0x014f('0x12')],{'as':_0x014f('0x14b'),'foreignKey':_0x014f('0x105')});db['UserProfile'][_0x014f('0xfc')](db[_0x014f('0xf4')],{'as':'UserProfileSections','foreignKey':_0x014f('0x105'),'onDelete':_0x014f('0xf9')});db['UserProfileSection'][_0x014f('0xfc')](db[_0x014f('0xf6')],{'as':_0x014f('0x1cb'),'foreignKey':_0x014f('0x1cc'),'onDelete':'cascade'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index ed50ed1..3d1cff6 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d67=['responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','format','connection','remoteAddress','device','agent_id','agent_name','test','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopperBlack','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/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/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','./api/userProfileResource','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','static','join','root','/apidoc','/www','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','express','express-winston','util','./errors','./config/environment','./config/logger','api','use','logger','headers','x-forwarded-for','url','statusCode'];(function(_0x1bb5f2,_0x4fa8c7){var _0x3ce467=function(_0x50c098){while(--_0x50c098){_0x1bb5f2['push'](_0x1bb5f2['shift']());}};_0x3ce467(++_0x4fa8c7);}(_0x9d67,0x10c));var _0x79d6=function(_0x4b48a7,_0x5f3e26){_0x4b48a7=_0x4b48a7-0x0;var _0x5608a5=_0x9d67[_0x4b48a7];return _0x5608a5;};'use strict';var path=require('path');var express=require(_0x79d6('0x0'));var ewinston=require(_0x79d6('0x1'));var util=require(_0x79d6('0x2'));var errors=require(_0x79d6('0x3'));var config=require(_0x79d6('0x4'));var logger=require(_0x79d6('0x5'))(_0x79d6('0x6'));var authLogger=require(_0x79d6('0x5'))('auth');exports['default']=function(_0x5d8617){_0x5d8617[_0x79d6('0x7')](ewinston[_0x79d6('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x180d7c,_0x44484e){return util['format']('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x180d7c['method'],_0x180d7c[_0x79d6('0x9')][_0x79d6('0xa')]?_0x180d7c[_0x79d6('0x9')][_0x79d6('0xa')]:_0x180d7c['connection']['remoteAddress']||_0x180d7c['ip'],_0x180d7c[_0x79d6('0xb')],_0x44484e[_0x79d6('0xc')],_0x44484e[_0x79d6('0xd')],_0x180d7c['user']?_0x180d7c['user']['id']:null,_0x180d7c[_0x79d6('0xe')]?_0x180d7c[_0x79d6('0xe')][_0x79d6('0xf')]:null,_0x180d7c[_0x79d6('0xe')]?_0x180d7c[_0x79d6('0xe')][_0x79d6('0x10')]:null);}}));_0x5d8617[_0x79d6('0x7')](ewinston[_0x79d6('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4c4a64,_0x2b4a0a){var _0x2df4ac=_0x79d6('0x11');if(_0x4c4a64[_0x79d6('0x12')]&&_0x4c4a64[_0x79d6('0x12')]['device']&&_0x4c4a64['body']['agent_id']){_0x2df4ac='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x79d6('0x13')](_0x2df4ac,_0x4c4a64['method'],_0x4c4a64[_0x79d6('0x9')][_0x79d6('0xa')]?_0x4c4a64[_0x79d6('0x9')][_0x79d6('0xa')]:_0x4c4a64[_0x79d6('0x14')][_0x79d6('0x15')]||_0x4c4a64['ip'],_0x4c4a64['url'],_0x2b4a0a[_0x79d6('0xc')],_0x2b4a0a['responseTime'],_0x4c4a64[_0x79d6('0xe')]?_0x4c4a64[_0x79d6('0xe')]['id']:null,_0x4c4a64['user']?_0x4c4a64['user'][_0x79d6('0xf')]:null,_0x4c4a64[_0x79d6('0xe')]?_0x4c4a64['user'][_0x79d6('0x10')]:null,_0x4c4a64[_0x79d6('0x12')]&&_0x4c4a64[_0x79d6('0x12')][_0x79d6('0x16')]?_0x4c4a64[_0x79d6('0x12')][_0x79d6('0x16')]:'other',_0x4c4a64[_0x79d6('0x12')]&&_0x4c4a64[_0x79d6('0x12')][_0x79d6('0x17')]?_0x4c4a64[_0x79d6('0x12')][_0x79d6('0x17')]:'',_0x4c4a64[_0x79d6('0x12')]&&_0x4c4a64[_0x79d6('0x12')]['agent_name']?_0x4c4a64[_0x79d6('0x12')][_0x79d6('0x18')]:'');},'ignoreRoute':function(_0x33accf){var _0x3a0b14=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3a0b14[_0x79d6('0x19')](_0x33accf[_0x79d6('0xb')]);}}));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x1a'),require('./api/user'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x1b'),require(_0x79d6('0x1c')));_0x5d8617['use']('/api/voice/contexts',require('./api/voiceContext'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x1d'),require(_0x79d6('0x1e')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x1f'),require(_0x79d6('0x20')));_0x5d8617['use']('/api/voice/queues',require(_0x79d6('0x21')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x22'),require(_0x79d6('0x23')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x24'),require(_0x79d6('0x25')));_0x5d8617['use'](_0x79d6('0x26'),require('./api/voiceMail'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x27'),require(_0x79d6('0x28')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x29'),require('./api/voiceCallReport'));_0x5d8617['use'](_0x79d6('0x2a'),require(_0x79d6('0x2b')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x2c'),require(_0x79d6('0x2d')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x2e'),require(_0x79d6('0x2f')));_0x5d8617['use']('/api/members/reports',require(_0x79d6('0x30')));_0x5d8617['use'](_0x79d6('0x31'),require(_0x79d6('0x32')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x33'),require(_0x79d6('0x34')));_0x5d8617['use'](_0x79d6('0x35'),require(_0x79d6('0x36')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x37'),require(_0x79d6('0x38')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x39'),require(_0x79d6('0x3a')));_0x5d8617[_0x79d6('0x7')]('/api/mail/substatuses',require(_0x79d6('0x3b')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x3c'),require(_0x79d6('0x3d')));_0x5d8617['use'](_0x79d6('0x3e'),require(_0x79d6('0x3f')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x40'),require('./api/mailApplication'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x41'),require(_0x79d6('0x42')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x43'),require('./api/dashboard'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x44'),require(_0x79d6('0x45')));_0x5d8617['use'](_0x79d6('0x46'),require(_0x79d6('0x47')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x48'),require('./api/faxApplication'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x49'),require('./api/faxInteraction'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x4a'),require(_0x79d6('0x4b')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x4c'),require('./api/faxQueue'));_0x5d8617[_0x79d6('0x7')]('/api/fax/reports/queue',require(_0x79d6('0x4d')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x4e'),require(_0x79d6('0x4f')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x50'),require(_0x79d6('0x51')));_0x5d8617['use'](_0x79d6('0x52'),require(_0x79d6('0x53')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x54'),require(_0x79d6('0x55')));_0x5d8617['use'](_0x79d6('0x56'),require(_0x79d6('0x57')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x58'),require('./api/openchannelAccount'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x59'),require('./api/openchannelApplication'));_0x5d8617[_0x79d6('0x7')]('/api/openchannel/interactions',require(_0x79d6('0x5a')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x5b'),require(_0x79d6('0x5c')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x5d'),require('./api/openchannelQueue'));_0x5d8617['use'](_0x79d6('0x5e'),require(_0x79d6('0x5f')));_0x5d8617[_0x79d6('0x7')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x5d8617['use'](_0x79d6('0x60'),require('./api/chatApplication'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x61'),require(_0x79d6('0x62')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x63'),require(_0x79d6('0x64')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x65'),require(_0x79d6('0x66')));_0x5d8617[_0x79d6('0x7')]('/api/chat/queues',require('./api/chatQueue'));_0x5d8617['use'](_0x79d6('0x67'),require(_0x79d6('0x68')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x69'),require(_0x79d6('0x6a')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x6b'),require(_0x79d6('0x6c')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x6d'),require(_0x79d6('0x6e')));_0x5d8617[_0x79d6('0x7')]('/api/cm/hopper',require('./api/cmHopper'));_0x5d8617[_0x79d6('0x7')]('/api/cm/hopper_black',require(_0x79d6('0x6f')));_0x5d8617[_0x79d6('0x7')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x5d8617['use'](_0x79d6('0x70'),require(_0x79d6('0x71')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x72'),require(_0x79d6('0x73')));_0x5d8617['use'](_0x79d6('0x74'),require(_0x79d6('0x75')));_0x5d8617[_0x79d6('0x7')]('/api/automations',require('./api/automation'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x76'),require(_0x79d6('0x77')));_0x5d8617['use'](_0x79d6('0x78'),require(_0x79d6('0x79')));_0x5d8617['use'](_0x79d6('0x7a'),require(_0x79d6('0x7b')));_0x5d8617[_0x79d6('0x7')]('/api/intervals',require(_0x79d6('0x7c')));_0x5d8617['use'](_0x79d6('0x7d'),require(_0x79d6('0x7e')));_0x5d8617['use'](_0x79d6('0x7f'),require('./api/cdr'));_0x5d8617['use'](_0x79d6('0x80'),require('./api/voiceQueuesLog'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x81'),require(_0x79d6('0x82')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x83'),require(_0x79d6('0x84')));_0x5d8617['use'](_0x79d6('0x85'),require(_0x79d6('0x86')));_0x5d8617[_0x79d6('0x7')]('/api/templates',require(_0x79d6('0x87')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x88'),require(_0x79d6('0x89')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x8a'),require(_0x79d6('0x8b')));_0x5d8617[_0x79d6('0x7')]('/api/integrations',require('./api/integration'));_0x5d8617['use'](_0x79d6('0x8c'),require(_0x79d6('0x8d')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x8e'),require('./api/analyticCustomReport'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x8f'),require('./api/analyticDefaultReport'));_0x5d8617['use'](_0x79d6('0x90'),require('./api/analyticExtractedReport'));_0x5d8617[_0x79d6('0x7')]('/api/analytics/metrics',require(_0x79d6('0x91')));_0x5d8617['use'](_0x79d6('0x92'),require(_0x79d6('0x93')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x94'),require(_0x79d6('0x95')));_0x5d8617['use'](_0x79d6('0x96'),require(_0x79d6('0x97')));_0x5d8617['use']('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x98'),require(_0x79d6('0x99')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x9a'),require(_0x79d6('0x9b')));_0x5d8617[_0x79d6('0x7')]('/api/integrations/sugarcrm/configurations',require(_0x79d6('0x9c')));_0x5d8617['use'](_0x79d6('0x9d'),require(_0x79d6('0x9e')));_0x5d8617['use'](_0x79d6('0x9f'),require('./api/intDeskAccount'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xa0'),require(_0x79d6('0xa1')));_0x5d8617['use'](_0x79d6('0xa2'),require('./api/intDeskField'));_0x5d8617['use'](_0x79d6('0xa3'),require(_0x79d6('0xa4')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xa5'),require(_0x79d6('0xa6')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xa7'),require(_0x79d6('0xa8')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xa9'),require('./api/intZendeskAccount'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xaa'),require(_0x79d6('0xab')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xac'),require('./api/intZendeskField'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xad'),require(_0x79d6('0xae')));_0x5d8617['use'](_0x79d6('0xaf'),require(_0x79d6('0xb0')));_0x5d8617['use'](_0x79d6('0xb1'),require(_0x79d6('0xb2')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xb3'),require(_0x79d6('0xb4')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xb5'),require(_0x79d6('0xb6')));_0x5d8617['use']('/api/integrations/vtiger/fields',require(_0x79d6('0xb7')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xb8'),require(_0x79d6('0xb9')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xba'),require(_0x79d6('0xbb')));_0x5d8617['use'](_0x79d6('0xbc'),require(_0x79d6('0xbd')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xbe'),require(_0x79d6('0xbf')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xc0'),require(_0x79d6('0xc1')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xc2'),require(_0x79d6('0xc3')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xc4'),require(_0x79d6('0xc5')));_0x5d8617['use'](_0x79d6('0xc6'),require(_0x79d6('0xc7')));_0x5d8617['use'](_0x79d6('0xc8'),require(_0x79d6('0xc9')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xca'),require(_0x79d6('0xcb')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xcc'),require(_0x79d6('0xcd')));_0x5d8617['use'](_0x79d6('0xce'),require(_0x79d6('0xcf')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xd0'),require('./api/jscriptyAnswerReport'));_0x5d8617['use'](_0x79d6('0xd1'),require(_0x79d6('0xd2')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xd3'),require(_0x79d6('0xd4')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xd5'),require(_0x79d6('0xd6')));_0x5d8617[_0x79d6('0x7')]('/api/square/reports',require('./api/squareReport'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xd7'),require(_0x79d6('0xd8')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xd9'),require(_0x79d6('0xda')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xdb'),require(_0x79d6('0xdc')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xdd'),require(_0x79d6('0xde')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xdf'),require('./api/squareProject'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xe0'),require(_0x79d6('0xe1')));_0x5d8617['use'](_0x79d6('0xe2'),require(_0x79d6('0xe3')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xe4'),require(_0x79d6('0xe5')));_0x5d8617[_0x79d6('0x7')]('/api/license',require('./api/license'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xe6'),require('./api/campaign'));_0x5d8617['use'](_0x79d6('0xe7'),require(_0x79d6('0xe8')));_0x5d8617['use'](_0x79d6('0xe9'),require(_0x79d6('0xea')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xeb'),require(_0x79d6('0xec')));_0x5d8617[_0x79d6('0x7')]('/api/mail/reports/transfer',require(_0x79d6('0xed')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xee'),require(_0x79d6('0xef')));_0x5d8617[_0x79d6('0x7')]('/api/fax/reports/transfer',require(_0x79d6('0xf0')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xf1'),require(_0x79d6('0xf2')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xf3'),require(_0x79d6('0xf4')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xf5'),require(_0x79d6('0xf6')));_0x5d8617['use'](_0x79d6('0xf7'),require(_0x79d6('0xf8')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xf9'),require(_0x79d6('0xfa')));_0x5d8617[_0x79d6('0x7')]('/api/userProfile/sections',require(_0x79d6('0xfb')));_0x5d8617[_0x79d6('0x7')]('/api/userProfile/resources',require(_0x79d6('0xfc')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xfd'),require('./api/authLocal'));_0x5d8617[_0x79d6('0x7')](_0x79d6('0xfe'),require(_0x79d6('0xff')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x100'),require(_0x79d6('0x101')));_0x5d8617['use']('/api/rpc',require(_0x79d6('0x102')));_0x5d8617['use'](_0x79d6('0x103'),require(_0x79d6('0x104')));_0x5d8617[_0x79d6('0x7')]('/api/system',require(_0x79d6('0x105')));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x106'),require('./api/pm2'));_0x5d8617[_0x79d6('0x7')]('/apidoc',express[_0x79d6('0x107')](path[_0x79d6('0x108')](config[_0x79d6('0x109')],_0x79d6('0x10a'))));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x10b'),express['static'](path[_0x79d6('0x108')](config[_0x79d6('0x109')],_0x79d6('0x10b'))));_0x5d8617[_0x79d6('0x7')](_0x79d6('0x10c'),express[_0x79d6('0x107')](path[_0x79d6('0x108')](config[_0x79d6('0x109')],_0x79d6('0x10c'))));_0x5d8617['use'](_0x79d6('0x10d'),express[_0x79d6('0x107')](path[_0x79d6('0x108')](config[_0x79d6('0x109')],_0x79d6('0x10e'),_0x79d6('0x10f'))));_0x5d8617['use'](_0x79d6('0x110'),express[_0x79d6('0x107')](path[_0x79d6('0x108')](config[_0x79d6('0x109')],_0x79d6('0x111'))));_0x5d8617[_0x79d6('0x112')](_0x79d6('0x113'))[_0x79d6('0x114')](errors[0x194]);_0x5d8617['route']('/*')[_0x79d6('0x114')](function(_0x5874a2,_0x92af3){_0x92af3[_0x79d6('0x115')](path[_0x79d6('0x116')](_0x5d8617[_0x79d6('0x114')](_0x79d6('0x117'))+_0x79d6('0x118')));});}; \ No newline at end of file +var _0xa1af=['/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/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/attachments','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileResource','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/pm2','./api/pm2','/apidoc','static','join','root','/demo','/snippet','1.0.16','/server/files/plugins','route','sendFile','resolve','appPath','/index.html','path','express','express-winston','util','./errors','./config/environment','./config/logger','auth','default','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','x-forwarded-for','headers','connection','remoteAddress','statusCode','responseTime','user','name','role','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','url','other','agent_name','test','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./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/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/reports/queue','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','./api/cannedAnswer','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField'];(function(_0x2f619e,_0x2e9e42){var _0x4fc620=function(_0x5ea497){while(--_0x5ea497){_0x2f619e['push'](_0x2f619e['shift']());}};_0x4fc620(++_0x2e9e42);}(_0xa1af,0x6b));var _0xfa1a=function(_0x242098,_0x5ccae7){_0x242098=_0x242098-0x0;var _0x298ae5=_0xa1af[_0x242098];return _0x298ae5;};'use strict';var path=require(_0xfa1a('0x0'));var express=require(_0xfa1a('0x1'));var ewinston=require(_0xfa1a('0x2'));var util=require(_0xfa1a('0x3'));var errors=require(_0xfa1a('0x4'));var config=require(_0xfa1a('0x5'));var logger=require(_0xfa1a('0x6'))('api');var authLogger=require('./config/logger')(_0xfa1a('0x7'));exports[_0xfa1a('0x8')]=function(_0x5cab0b){_0x5cab0b['use'](ewinston[_0xfa1a('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5664e8,_0x57bdd1){return util[_0xfa1a('0xa')](_0xfa1a('0xb'),_0x5664e8['method'],_0x5664e8['headers'][_0xfa1a('0xc')]?_0x5664e8[_0xfa1a('0xd')][_0xfa1a('0xc')]:_0x5664e8[_0xfa1a('0xe')][_0xfa1a('0xf')]||_0x5664e8['ip'],_0x5664e8['url'],_0x57bdd1[_0xfa1a('0x10')],_0x57bdd1[_0xfa1a('0x11')],_0x5664e8[_0xfa1a('0x12')]?_0x5664e8[_0xfa1a('0x12')]['id']:null,_0x5664e8['user']?_0x5664e8[_0xfa1a('0x12')][_0xfa1a('0x13')]:null,_0x5664e8[_0xfa1a('0x12')]?_0x5664e8[_0xfa1a('0x12')][_0xfa1a('0x14')]:null);}}));_0x5cab0b[_0xfa1a('0x15')](ewinston[_0xfa1a('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xed86eb,_0x40843f){var _0x57fcad=_0xfa1a('0x16');if(_0xed86eb[_0xfa1a('0x17')]&&_0xed86eb[_0xfa1a('0x17')][_0xfa1a('0x18')]&&_0xed86eb['body'][_0xfa1a('0x19')]){_0x57fcad=_0xfa1a('0x1a');}return util['format'](_0x57fcad,_0xed86eb[_0xfa1a('0x1b')],_0xed86eb[_0xfa1a('0xd')][_0xfa1a('0xc')]?_0xed86eb['headers'][_0xfa1a('0xc')]:_0xed86eb[_0xfa1a('0xe')][_0xfa1a('0xf')]||_0xed86eb['ip'],_0xed86eb[_0xfa1a('0x1c')],_0x40843f['statusCode'],_0x40843f[_0xfa1a('0x11')],_0xed86eb[_0xfa1a('0x12')]?_0xed86eb[_0xfa1a('0x12')]['id']:null,_0xed86eb[_0xfa1a('0x12')]?_0xed86eb[_0xfa1a('0x12')][_0xfa1a('0x13')]:null,_0xed86eb[_0xfa1a('0x12')]?_0xed86eb[_0xfa1a('0x12')][_0xfa1a('0x14')]:null,_0xed86eb[_0xfa1a('0x17')]&&_0xed86eb[_0xfa1a('0x17')][_0xfa1a('0x18')]?_0xed86eb[_0xfa1a('0x17')][_0xfa1a('0x18')]:_0xfa1a('0x1d'),_0xed86eb[_0xfa1a('0x17')]&&_0xed86eb[_0xfa1a('0x17')][_0xfa1a('0x19')]?_0xed86eb[_0xfa1a('0x17')][_0xfa1a('0x19')]:'',_0xed86eb[_0xfa1a('0x17')]&&_0xed86eb[_0xfa1a('0x17')]['agent_name']?_0xed86eb[_0xfa1a('0x17')][_0xfa1a('0x1e')]:'');},'ignoreRoute':function(_0x5f0383){var _0x5322af=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5322af[_0xfa1a('0x1f')](_0x5f0383[_0xfa1a('0x1c')]);}}));_0x5cab0b[_0xfa1a('0x15')]('/api/users',require('./api/user'));_0x5cab0b[_0xfa1a('0x15')]('/api/voice/chanspy',require(_0xfa1a('0x20')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x21'),require(_0xfa1a('0x22')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x23'),require('./api/voiceExtension'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x24'),require(_0xfa1a('0x25')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x26'),require(_0xfa1a('0x27')));_0x5cab0b['use'](_0xfa1a('0x28'),require(_0xfa1a('0x29')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x2a'),require(_0xfa1a('0x2b')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x2c'),require('./api/voiceMail'));_0x5cab0b['use'](_0xfa1a('0x2d'),require(_0xfa1a('0x2e')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x2f'),require(_0xfa1a('0x30')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x31'),require('./api/voiceDialReport'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x32'),require(_0xfa1a('0x33')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x34'),require(_0xfa1a('0x35')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x36'),require(_0xfa1a('0x37')));_0x5cab0b[_0xfa1a('0x15')]('/api/trunks',require(_0xfa1a('0x38')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x39'),require(_0xfa1a('0x3a')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x3b'),require(_0xfa1a('0x3c')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x3d'),require('./api/mailAccount'));_0x5cab0b['use'](_0xfa1a('0x3e'),require(_0xfa1a('0x3f')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x40'),require('./api/mailSubstatus'));_0x5cab0b['use']('/api/mail/interactions',require(_0xfa1a('0x41')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x42'),require(_0xfa1a('0x43')));_0x5cab0b['use']('/api/mail/applications',require('./api/mailApplication'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x44'),require('./api/mailQueueReport'));_0x5cab0b[_0xfa1a('0x15')]('/api/dashboards',require('./api/dashboard'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x45'),require(_0xfa1a('0x46')));_0x5cab0b[_0xfa1a('0x15')]('/api/fax/accounts',require(_0xfa1a('0x47')));_0x5cab0b['use']('/api/fax/applications',require('./api/faxApplication'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x48'),require(_0xfa1a('0x49')));_0x5cab0b['use'](_0xfa1a('0x4a'),require('./api/faxMessage'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x4b'),require(_0xfa1a('0x4c')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x4d'),require(_0xfa1a('0x4e')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x4f'),require(_0xfa1a('0x50')));_0x5cab0b['use'](_0xfa1a('0x51'),require('./api/smsApplication'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x52'),require(_0xfa1a('0x53')));_0x5cab0b['use'](_0xfa1a('0x54'),require(_0xfa1a('0x55')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x56'),require(_0xfa1a('0x57')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x58'),require(_0xfa1a('0x59')));_0x5cab0b['use']('/api/openchannel/applications',require(_0xfa1a('0x5a')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x5b'),require(_0xfa1a('0x5c')));_0x5cab0b['use'](_0xfa1a('0x5d'),require(_0xfa1a('0x5e')));_0x5cab0b[_0xfa1a('0x15')]('/api/openchannel/queues',require(_0xfa1a('0x5f')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x60'),require(_0xfa1a('0x61')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x62'),require(_0xfa1a('0x63')));_0x5cab0b[_0xfa1a('0x15')]('/api/chat/applications',require(_0xfa1a('0x64')));_0x5cab0b['use'](_0xfa1a('0x65'),require(_0xfa1a('0x66')));_0x5cab0b['use'](_0xfa1a('0x67'),require(_0xfa1a('0x68')));_0x5cab0b['use'](_0xfa1a('0x69'),require(_0xfa1a('0x6a')));_0x5cab0b[_0xfa1a('0x15')]('/api/chat/queues',require(_0xfa1a('0x6b')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x6c'),require(_0xfa1a('0x6d')));_0x5cab0b['use'](_0xfa1a('0x6e'),require(_0xfa1a('0x6f')));_0x5cab0b['use'](_0xfa1a('0x70'),require(_0xfa1a('0x71')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x72'),require('./api/cmContact'));_0x5cab0b[_0xfa1a('0x15')]('/api/cm/hopper',require('./api/cmHopper'));_0x5cab0b['use'](_0xfa1a('0x73'),require('./api/cmHopperBlack'));_0x5cab0b['use'](_0xfa1a('0x74'),require(_0xfa1a('0x75')));_0x5cab0b['use'](_0xfa1a('0x76'),require(_0xfa1a('0x77')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x78'),require(_0xfa1a('0x79')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x7a'),require(_0xfa1a('0x7b')));_0x5cab0b[_0xfa1a('0x15')]('/api/automations',require(_0xfa1a('0x7c')));_0x5cab0b[_0xfa1a('0x15')]('/api/canned_answers',require(_0xfa1a('0x7d')));_0x5cab0b[_0xfa1a('0x15')]('/api/dispositions',require(_0xfa1a('0x7e')));_0x5cab0b[_0xfa1a('0x15')]('/api/conditions',require(_0xfa1a('0x7f')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x80'),require(_0xfa1a('0x81')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x82'),require('./api/pause'));_0x5cab0b['use'](_0xfa1a('0x83'),require(_0xfa1a('0x84')));_0x5cab0b['use'](_0xfa1a('0x85'),require(_0xfa1a('0x86')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x87'),require(_0xfa1a('0x88')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x89'),require('./api/sound'));_0x5cab0b['use'](_0xfa1a('0x8a'),require(_0xfa1a('0x8b')));_0x5cab0b[_0xfa1a('0x15')]('/api/templates',require(_0xfa1a('0x8c')));_0x5cab0b['use'](_0xfa1a('0x8d'),require('./api/trigger'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x8e'),require(_0xfa1a('0x8f')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x90'),require(_0xfa1a('0x91')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x92'),require(_0xfa1a('0x93')));_0x5cab0b['use'](_0xfa1a('0x94'),require(_0xfa1a('0x95')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x96'),require(_0xfa1a('0x97')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x98'),require(_0xfa1a('0x99')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x9a'),require('./api/analyticMetric'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x9b'),require('./api/analyticFieldReport'));_0x5cab0b[_0xfa1a('0x15')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x9c'),require(_0xfa1a('0x9d')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x9e'),require(_0xfa1a('0x9f')));_0x5cab0b['use'](_0xfa1a('0xa0'),require(_0xfa1a('0xa1')));_0x5cab0b['use'](_0xfa1a('0xa2'),require(_0xfa1a('0xa3')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xa4'),require(_0xfa1a('0xa5')));_0x5cab0b[_0xfa1a('0x15')]('/api/integrations/sugarcrm/fields',require(_0xfa1a('0xa6')));_0x5cab0b['use']('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xa7'),require(_0xfa1a('0xa8')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xa9'),require(_0xfa1a('0xaa')));_0x5cab0b['use'](_0xfa1a('0xab'),require(_0xfa1a('0xac')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xad'),require('./api/intZohoConfiguration'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xae'),require(_0xfa1a('0xaf')));_0x5cab0b['use'](_0xfa1a('0xb0'),require('./api/intZendeskAccount'));_0x5cab0b['use'](_0xfa1a('0xb1'),require(_0xfa1a('0xb2')));_0x5cab0b['use'](_0xfa1a('0xb3'),require(_0xfa1a('0xb4')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xb5'),require(_0xfa1a('0xb6')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xb7'),require(_0xfa1a('0xb8')));_0x5cab0b['use']('/api/integrations/freshdesk/fields',require(_0xfa1a('0xb9')));_0x5cab0b[_0xfa1a('0x15')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x5cab0b['use'](_0xfa1a('0xba'),require('./api/intVtigerConfiguration'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xbb'),require('./api/intVtigerField'));_0x5cab0b['use'](_0xfa1a('0xbc'),require(_0xfa1a('0xbd')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xbe'),require(_0xfa1a('0xbf')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xc0'),require(_0xfa1a('0xc1')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xc2'),require('./api/intDynamics365Account'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xc3'),require(_0xfa1a('0xc4')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xc5'),require(_0xfa1a('0xc6')));_0x5cab0b['use'](_0xfa1a('0xc7'),require(_0xfa1a('0xc8')));_0x5cab0b[_0xfa1a('0x15')]('/api/integrations/freshsales/configurations',require(_0xfa1a('0xc9')));_0x5cab0b['use'](_0xfa1a('0xca'),require(_0xfa1a('0xcb')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xcc'),require(_0xfa1a('0xcd')));_0x5cab0b[_0xfa1a('0x15')]('/api/chat/reports/queue',require(_0xfa1a('0xce')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xcf'),require(_0xfa1a('0xd0')));_0x5cab0b['use'](_0xfa1a('0xd1'),require('./api/jscriptyAnswerReport'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xd2'),require(_0xfa1a('0xd3')));_0x5cab0b[_0xfa1a('0x15')]('/api/jscripty/sessions/reports',require(_0xfa1a('0xd4')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xd5'),require(_0xfa1a('0xd6')));_0x5cab0b['use'](_0xfa1a('0xd7'),require(_0xfa1a('0xd8')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xd9'),require(_0xfa1a('0xda')));_0x5cab0b[_0xfa1a('0x15')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xdb'),require(_0xfa1a('0xdc')));_0x5cab0b['use'](_0xfa1a('0xdd'),require(_0xfa1a('0xde')));_0x5cab0b['use'](_0xfa1a('0xdf'),require(_0xfa1a('0xe0')));_0x5cab0b['use'](_0xfa1a('0xe1'),require(_0xfa1a('0xe2')));_0x5cab0b[_0xfa1a('0x15')]('/api/square/messages',require(_0xfa1a('0xe3')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xe4'),require(_0xfa1a('0xe5')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xe6'),require(_0xfa1a('0xe7')));_0x5cab0b['use'](_0xfa1a('0xe8'),require(_0xfa1a('0xe9')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xea'),require(_0xfa1a('0xeb')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xec'),require('./api/attachment'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xed'),require('./api/plugin'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xee'),require(_0xfa1a('0xef')));_0x5cab0b['use']('/api/chat/reports/transfer',require(_0xfa1a('0xf0')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xf1'),require(_0xfa1a('0xf2')));_0x5cab0b['use'](_0xfa1a('0xf3'),require(_0xfa1a('0xf4')));_0x5cab0b[_0xfa1a('0x15')]('/api/sms/reports/transfer',require(_0xfa1a('0xf5')));_0x5cab0b['use'](_0xfa1a('0xf6'),require(_0xfa1a('0xf7')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xf8'),require(_0xfa1a('0xf9')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xfa'),require(_0xfa1a('0xfb')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xfc'),require('./api/userProfileSection'));_0x5cab0b['use']('/api/userProfile/resources',require(_0xfa1a('0xfd')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0xfe'),require(_0xfa1a('0xff')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x100'),require(_0xfa1a('0x101')));_0x5cab0b['use'](_0xfa1a('0x102'),require(_0xfa1a('0x103')));_0x5cab0b[_0xfa1a('0x15')]('/api/rpc',require(_0xfa1a('0x104')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x105'),require(_0xfa1a('0x106')));_0x5cab0b['use']('/api/system',require('./api/system'));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x107'),require(_0xfa1a('0x108')));_0x5cab0b['use'](_0xfa1a('0x109'),express[_0xfa1a('0x10a')](path[_0xfa1a('0x10b')](config[_0xfa1a('0x10c')],'/apidoc')));_0x5cab0b[_0xfa1a('0x15')]('/www',express[_0xfa1a('0x10a')](path[_0xfa1a('0x10b')](config[_0xfa1a('0x10c')],'/www')));_0x5cab0b[_0xfa1a('0x15')](_0xfa1a('0x10d'),express['static'](path[_0xfa1a('0x10b')](config[_0xfa1a('0x10c')],'/demo')));_0x5cab0b['use'](_0xfa1a('0x10e'),express[_0xfa1a('0x10a')](path[_0xfa1a('0x10b')](config[_0xfa1a('0x10c')],'snippet',_0xfa1a('0x10f'))));_0x5cab0b[_0xfa1a('0x15')]('/plugins',express['static'](path[_0xfa1a('0x10b')](config['root'],_0xfa1a('0x110'))));_0x5cab0b[_0xfa1a('0x111')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x5cab0b[_0xfa1a('0x111')]('/*')['get'](function(_0x5f0d89,_0x5057f7){_0x5057f7[_0xfa1a('0x112')](path[_0xfa1a('0x113')](_0x5cab0b['get'](_0xfa1a('0x114'))+_0xfa1a('0x115')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index cae5d44..5e2ed0a 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7755=['../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','http','rpc','port','localhost','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.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'];(function(_0x40dd7e,_0x155d5f){var _0x669dcd=function(_0x2c19b1){while(--_0x2c19b1){_0x40dd7e['push'](_0x40dd7e['shift']());}};_0x669dcd(++_0x155d5f);}(_0x7755,0xb3));var _0x5775=function(_0x1839fa,_0x2d18ba){_0x1839fa=_0x1839fa-0x0;var _0x599af0=_0x7755[_0x1839fa];return _0x599af0;};'use strict';var jayson=require(_0x5775('0x0'));var BPromise=require(_0x5775('0x1'));var _=require(_0x5775('0x2'));var config=require('../config/environment');exports[_0x5775('0x3')]=function(){return new BPromise(function(_0x171726,_0x4d9e44){var _0x53dc93={};_0x53dc93=_['merge'](_0x53dc93,require(_0x5775('0x4')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x6')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x7')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x8')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x9')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0xa')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0xb')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0xc')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require('../api/trunk/trunk.rpc'));_0x53dc93=_['merge'](_0x53dc93,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0xd')));_0x53dc93=_['merge'](_0x53dc93,require(_0x5775('0xe')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0xf')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x10')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x11')));_0x53dc93=_['merge'](_0x53dc93,require('../api/mailMessage/mailMessage.rpc'));_0x53dc93=_['merge'](_0x53dc93,require(_0x5775('0x12')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x13')));_0x53dc93=_['merge'](_0x53dc93,require(_0x5775('0x14')));_0x53dc93=_['merge'](_0x53dc93,require('../api/faxApplication/faxApplication.rpc'));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x15')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x16')));_0x53dc93=_['merge'](_0x53dc93,require(_0x5775('0x17')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x18')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require('../api/smsAccount/smsAccount.rpc'));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x19')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x1a')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x1b')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x1c')));_0x53dc93=_['merge'](_0x53dc93,require(_0x5775('0x1d')));_0x53dc93=_['merge'](_0x53dc93,require(_0x5775('0x1e')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x1f')));_0x53dc93=_['merge'](_0x53dc93,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require('../api/chatInteraction/chatInteraction.rpc'));_0x53dc93=_['merge'](_0x53dc93,require(_0x5775('0x20')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x21')));_0x53dc93=_['merge'](_0x53dc93,require(_0x5775('0x22')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x23')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x24')));_0x53dc93=_['merge'](_0x53dc93,require(_0x5775('0x25')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x26')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x53dc93=_['merge'](_0x53dc93,require('../api/interval/interval.rpc'));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x27')));_0x53dc93=_['merge'](_0x53dc93,require(_0x5775('0x28')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require('../api/template/template.rpc'));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x29')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x2a')));_0x53dc93=_['merge'](_0x53dc93,require(_0x5775('0x2b')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x2c')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x2d')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x2e')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x2f')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x30')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x31')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x32')));_0x53dc93=_['merge'](_0x53dc93,require(_0x5775('0x33')));_0x53dc93=_['merge'](_0x53dc93,require(_0x5775('0x34')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x35')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x36')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x37')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x38')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x39')));_0x53dc93=_['merge'](_0x53dc93,require(_0x5775('0x3a')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x3b')));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require('../api/attachment/attachment.rpc'));_0x53dc93=_[_0x5775('0x5')](_0x53dc93,require(_0x5775('0x3c')));var _0x5bb33a=jayson['server'](_0x53dc93)[_0x5775('0x3d')]();var _0x4ecd9f=config[_0x5775('0x3e')][_0x5775('0x3f')]||config[_0x5775('0x3f')]+0x1;var _0x716e62=config[_0x5775('0x3e')]['ip']||_0x5775('0x40');_0x5bb33a['on']('error',function(_0x5c56fb){return _0x4d9e44(_0x5c56fb);});_0x5bb33a['listen'](_0x4ecd9f,_0x716e62,function(){console['log'](_0x5775('0x41'),_0x716e62,_0x4ecd9f);require('../config/triggers')[_0x5775('0x42')]();return _0x171726(_0x5775('0x43')+_0x716e62+':'+_0x4ecd9f);});});}; \ No newline at end of file +var _0x001a=['../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','server','http','rpc','port','localhost','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x001a,0x1cf));var _0xa001=function(_0x2e6dbf,_0x57dd06){_0x2e6dbf=_0x2e6dbf-0x0;var _0x2680e5=_0x001a[_0x2e6dbf];return _0x2680e5;};'use strict';var jayson=require(_0xa001('0x0'));var BPromise=require('bluebird');var _=require(_0xa001('0x1'));var config=require(_0xa001('0x2'));exports['listen']=function(){return new BPromise(function(_0x2b49a0,_0x4400a1){var _0x3f242f={};_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x4')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x5')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require('../api/voiceQueue/voiceQueue.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x6')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x7')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x8')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x3f242f=_['merge'](_0x3f242f,require(_0xa001('0x9')));_0x3f242f=_['merge'](_0x3f242f,require(_0xa001('0xa')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0xb')));_0x3f242f=_['merge'](_0x3f242f,require(_0xa001('0xc')));_0x3f242f=_['merge'](_0x3f242f,require('../api/mailServerIn/mailServerIn.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0xd')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0xe')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require('../api/mailInteraction/mailInteraction.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0xf')));_0x3f242f=_['merge'](_0x3f242f,require(_0xa001('0x10')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x3f242f=_['merge'](_0x3f242f,require(_0xa001('0x11')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x12')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x13')));_0x3f242f=_['merge'](_0x3f242f,require(_0xa001('0x14')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x15')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x16')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require('../api/smsAccount/smsAccount.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x17')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x18')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x19')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x1a')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x1b')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x1c')));_0x3f242f=_['merge'](_0x3f242f,require('../api/chatInteraction/chatInteraction.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x1d')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x1e')));_0x3f242f=_['merge'](_0x3f242f,require(_0xa001('0x1f')));_0x3f242f=_['merge'](_0x3f242f,require('../api/cmHopper/cmHopper.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x20')));_0x3f242f=_['merge'](_0x3f242f,require(_0xa001('0x21')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x22')));_0x3f242f=_['merge'](_0x3f242f,require(_0xa001('0x23')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require('../api/sound/sound.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x24')));_0x3f242f=_['merge'](_0x3f242f,require(_0xa001('0x25')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x26')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x27')));_0x3f242f=_['merge'](_0x3f242f,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x28')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x29')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x2a')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x2b')));_0x3f242f=_['merge'](_0x3f242f,require(_0xa001('0x2c')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x2d')));_0x3f242f=_['merge'](_0x3f242f,require(_0xa001('0x2e')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x2f')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x30')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x31')));_0x3f242f=_['merge'](_0x3f242f,require('../api/squareReport/squareReport.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x32')));_0x3f242f=_['merge'](_0x3f242f,require('../api/squareProject/squareProject.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require('../api/squareRecording/squareRecording.rpc'));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x33')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x34')));_0x3f242f=_[_0xa001('0x3')](_0x3f242f,require(_0xa001('0x35')));_0x3f242f=_['merge'](_0x3f242f,require(_0xa001('0x36')));var _0x2b21d5=jayson[_0xa001('0x37')](_0x3f242f)[_0xa001('0x38')]();var _0x464b1e=config[_0xa001('0x39')][_0xa001('0x3a')]||config['port']+0x1;var _0x4e2a49=config[_0xa001('0x39')]['ip']||_0xa001('0x3b');_0x2b21d5['on']('error',function(_0x3e526b){return _0x4400a1(_0x3e526b);});_0x2b21d5[_0xa001('0x3c')](_0x464b1e,_0x4e2a49,function(){console['log'](_0xa001('0x3d'),_0x4e2a49,_0x464b1e);require('../config/triggers')['default']();return _0x2b49a0(_0xa001('0x3e')+_0x4e2a49+':'+_0x464b1e);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 8cda082..7f47d05 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file +var _0xedd9=['getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','sendRequest','exec','isArray','EXEC\x20%s\x20%s','join','setContext','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','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xedd9,0xfc));var _0x9edd=function(_0x44e1f4,_0x4530d8){_0x44e1f4=_0x44e1f4-0x0;var _0x47b591=_0xedd9[_0x44e1f4];return _0x47b591;};'use strict';var util=require('util');var _=require(_0x9edd('0x0'));var EventEmitter=require(_0x9edd('0x1'))[_0x9edd('0x2')];var AGIReply=require(_0x9edd('0x3'));var AGIError=require(_0x9edd('0x4'));function AGIChannel(_0x127cbe){var _0x3e6d3a=this,_0x36b53f=new AGIReply(),_0x5943b3=![],_0x33679f={};EventEmitter[_0x9edd('0x5')](_0x3e6d3a);_0x127cbe[_0x9edd('0x6')](_0x9edd('0x7'));_0x127cbe['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x36b53f[_0x9edd('0x6')]('utf8');_0x36b53f['on'](_0x9edd('0x8'),function(_0x190185){for(var _0x1355be in _0x190185){_0x3e6d3a[_0x1355be]=_0x190185[_0x1355be];}_0x3e6d3a[_0x9edd('0x9')]('ready');});_0x36b53f['on'](_0x9edd('0xa'),function(_0x5d2f90){if(_0x5d2f90[_0x9edd('0xb')]()==_0x9edd('0xc')){_0x3e6d3a['emit'](_0x9edd('0xc'));return;}if(_0x5d2f90[_0x9edd('0xd')](0x0,0xb)=='520-Invalid'){_0x5943b3=!![];}if(_0x5943b3){_0x33679f['rx']+=_0x5d2f90+'\x0a';if(_0x5d2f90[_0x9edd('0xe')](_0x9edd('0xf'))!=-0x1){_0x5943b3=![];}}else{_0x33679f['rx']=_0x5d2f90;}if(_0x5943b3){return;}if(typeof _0x33679f['cb']==_0x9edd('0x10')){var _0xfd544a=_0x33679f['rx'][_0x9edd('0xd')](0x0,0x3),_0x287ddd=null,_0x3a7b84=null;_0xfd544a=parseInt(_0xfd544a);if(isNaN(_0xfd544a)){_0x33679f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9edd('0x11')});return;}if(_0xfd544a!=0xc8){_0x33679f['cb'](null,{'code':_0xfd544a,'result':-0x1,'extra':'KO'});return;}_0x287ddd=_0x33679f['rx']['substring'](0x4)[_0x9edd('0x12')](_0x9edd('0x13'),'');if(_0x287ddd[_0x9edd('0x14')]('\x20')!=-0x1){_0x287ddd=_0x287ddd[_0x9edd('0x15')](0x0,_0x287ddd[_0x9edd('0x14')]('\x20'));}if(_[_0x9edd('0x16')](_0x287ddd,'-1')){_0x287ddd=parseInt(_0x287ddd);}_0x3a7b84=_0x33679f['rx'][_0x9edd('0x17')]('\x20');if(_0x3a7b84[_0x9edd('0x18')]==0x3){_0x3a7b84=_0x3a7b84[0x2]['substring'](0x1,_0x3a7b84[0x2][_0x9edd('0x18')]-0x1);}else if(_0x3a7b84[_0x9edd('0x18')]>0x3){var _0x449cee=/\((.+)\)/;var _0x5acf65=_0x33679f['rx'][_0x9edd('0x19')](_0x449cee);if(_0x5acf65){_0x3a7b84=_0x5acf65[0x1];}else{_0x3a7b84=null;}}else{_0x3a7b84=null;}_0x33679f['cb'](null,{'code':_0xfd544a,'result':_0x287ddd,'extra':_0x3a7b84});}});_0x127cbe['on'](_0x9edd('0x1a'),function(_0x40ba32){_0x3e6d3a['emit'](_0x9edd('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x40ba32[_0x9edd('0x1b')]));});_0x127cbe['on'](_0x9edd('0x1c'),function(){_0x3e6d3a['emit']('close',new AGIError(_0x9edd('0x1d')));});_0x127cbe['on']('timeout',function(){_0x3e6d3a[_0x9edd('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x127cbe[_0x9edd('0x1e')]();});_0x127cbe[_0x9edd('0x1f')](_0x36b53f);this['command']=function(_0x5823bc,_0x341d67){var _0x5823bc=_0x5823bc||'',_0x341d67=typeof _0x341d67=='function'?_0x341d67:new Function();_0x33679f={'tx':_0x5823bc,'rx':'','cb':_0x341d67};_0x127cbe[_0x9edd('0x20')](_0x5823bc+'\x0a');},this[_0x9edd('0x1c')]=function(){_0x127cbe[_0x9edd('0x1e')]();};}util[_0x9edd('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x9edd('0x22')]['sendRequest']=function(_0x46c383){return this[_0x9edd('0x23')][_0x9edd('0x24')](this,_0x46c383);};AGIChannel[_0x9edd('0x22')][_0x9edd('0x25')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x9edd('0x22')][_0x9edd('0x26')]=function(_0x8d67aa,_0x25e135,_0x3c2227){_0x8d67aa=_0x8d67aa===undefined?'beep':_0x8d67aa;_0x25e135=_0x25e135===undefined?'5':_0x25e135;_0x3c2227=_0x3c2227===undefined?'1':_0x3c2227;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x28'),_0x8d67aa,_0x25e135*0x3e8,_0x3c2227));};AGIChannel[_0x9edd('0x22')]['noop']=function(_0x238b22){_0x238b22=_0x238b22||_0x9edd('0x29');return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('VERBOSE\x20\x22%s\x22',_0x238b22));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2b')]=function(_0xbe87e1,_0x12c1bc){if(_[_0x9edd('0x2c')](_0x12c1bc)){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc[_0x9edd('0x2e')](',')));}return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2f')]=function(_0x1a6c23){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x30'),_0x1a6c23));};AGIChannel[_0x9edd('0x22')]['setExtension']=function(_0x2d2f88){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x31'),_0x2d2f88));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x32')]=function(_0x473068){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x33'),_0x473068));};AGIChannel[_0x9edd('0x22')][_0x9edd('0xc')]=function(){return this[_0x9edd('0x2a')](_0x9edd('0x34'));};AGIChannel['prototype'][_0x9edd('0x35')]=function(_0x5ed62d,_0x968303){var _0x148630=_[_0x9edd('0x36')](_0x968303)||_[_0x9edd('0x37')](_0x968303)?_0x968303[_0x9edd('0x38')]():_0x968303;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x39'),_0x5ed62d,_0x148630?_0x148630[_0x9edd('0x38')]()[_0x9edd('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3a')]=function(_0x5c0627,_0x1cbbac){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0x5c0627,_0x1cbbac));};AGIChannel[_0x9edd('0x22')]['sayDigits']=function(_0x3ef1d5,_0x5658d6){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x3b'),_0x3ef1d5,_0x5658d6));};AGIChannel['prototype'][_0x9edd('0x3c')]=function(_0xcbd0ef,_0x2f8f61){return this['sendRequest'](util[_0x9edd('0x27')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xcbd0ef,_0x2f8f61));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3d')]=function(_0x50be2c,_0x315f52,_0x40fdfb){_0x315f52=_0x315f52||this[_0x9edd('0x3e')];_0x40fdfb=_0x40fdfb||0x1;this[_0x9edd('0x2f')](_0x50be2c);this['setExtension'](_0x315f52);this[_0x9edd('0x32')](_0x40fdfb);return this['noop'](util[_0x9edd('0x27')](_0x9edd('0x3f'),_0x50be2c,_0x315f52,_0x40fdfb));};AGIChannel['prototype'][_0x9edd('0x40')]=function(_0x49a128){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x41'),_0x49a128));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x42')]=function(_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x18c149,_0x2b081a){_0x4737ae=_0x4737ae||_0x9edd('0x43');_0x3ff512=_0x3ff512||'';_0x75efbe=_0x75efbe===undefined?-0x1:_0x75efbe==='-1'?-0x1:_0x75efbe*0x3e8;_0x18c149=_0x18c149===undefined?'':'s='+_0x18c149;_0x2b081a=_0x2b081a?_0x9edd('0x44'):'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x45'),_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x2b081a,_0x18c149));};AGIChannel['prototype'][_0x9edd('0x46')]=function(_0x2570e3,_0x2231c1){_0x2231c1=_0x2231c1||'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x47'),_0x2570e3,_0x2231c1));};AGIChannel[_0x9edd('0x22')]['agi']=function(_0x4a4656){return this['exec'](_0x9edd('0x48'),_0x4a4656);};AGIChannel['prototype'][_0x9edd('0x49')]=function(_0x19b56b){return this[_0x9edd('0x2b')](_0x9edd('0x4a'),_0x19b56b);};AGIChannel[_0x9edd('0x22')]['error']=function(_0x387fb8,_0x35e63c){this[_0x9edd('0x4b')](util['format'](_0x9edd('0x4c'),_0x387fb8['id'],_0x387fb8[_0x9edd('0x4d')],_0x35e63c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9edd('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 02c841f..4132cca 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 _0xb2ef=['name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format'];(function(_0x288536,_0x369b51){var _0x525e94=function(_0x2fe9db){while(--_0x2fe9db){_0x288536['push'](_0x288536['shift']());}};_0x525e94(++_0x369b51);}(_0xb2ef,0xa7));var _0xfb2e=function(_0xf8853e,_0x2d7c09){_0xf8853e=_0xf8853e-0x0;var _0x44ad9e=_0xb2ef[_0xf8853e];return _0x44ad9e;};'use strict';var util=require(_0xfb2e('0x0'));var error={'E_AGI_UNDEFINED':_0xfb2e('0x1'),'E_AGI_ARGUMENT_PORT':_0xfb2e('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xfb2e('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xfb2e('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xfb2e('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xfb2e('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xfb2e('0x7'),'E_AGI_COMMAND_EMPTY':_0xfb2e('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xfb2e('0x9'),'E_AGI_IVR_ENTRY':_0xfb2e('0xa')};function AGIError(_0x2a1c23){var _0x2a1c23=_0x2a1c23||null,_0x72054c=_0x72054c||[],_0x1d0a05=0x1,_0x46c641='';if(!error[_0x2a1c23]){_0x2a1c23='E_AGI_UNDEFINED';}_0x72054c[_0xfb2e('0xb')](error[_0x2a1c23]);while(arguments[_0x1d0a05]){_0x72054c[_0xfb2e('0xb')](arguments[_0x1d0a05]);_0x1d0a05++;}_0x46c641=util[_0xfb2e('0xc')]['apply'](util,_0x72054c);this['message']=_0x46c641;this[_0xfb2e('0xd')]=_0x2a1c23;}module[_0xfb2e('0xe')]=AGIError; \ No newline at end of file +var _0xbdb0=['exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0xbdb0,0x189));var _0x0bdb=function(_0x1c7137,_0x4c7c26){_0x1c7137=_0x1c7137-0x0;var _0xeb4432=_0xbdb0[_0x1c7137];return _0xeb4432;};'use strict';var util=require(_0x0bdb('0x0'));var error={'E_AGI_UNDEFINED':_0x0bdb('0x1'),'E_AGI_ARGUMENT_PORT':_0x0bdb('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x0bdb('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x0bdb('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x0bdb('0x5'),'E_AGI_SOCKET_ERROR':_0x0bdb('0x6'),'E_AGI_SOCKET_CLOSE':_0x0bdb('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x0bdb('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x0bdb('0x9')};function AGIError(_0x5254ca){var _0x5254ca=_0x5254ca||null,_0x1a189c=_0x1a189c||[],_0x9a24fd=0x1,_0x3afa5e='';if(!error[_0x5254ca]){_0x5254ca=_0x0bdb('0xa');}_0x1a189c[_0x0bdb('0xb')](error[_0x5254ca]);while(arguments[_0x9a24fd]){_0x1a189c[_0x0bdb('0xb')](arguments[_0x9a24fd]);_0x9a24fd++;}_0x3afa5e=util['format'][_0x0bdb('0xc')](util,_0x1a189c);this['message']=_0x3afa5e;this['name']=_0x5254ca;}module[_0x0bdb('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index a412628..8b973e8 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 _0xa5fa=['info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','../../../config/logger','agi','menu','getdigits','vertices','edges','prototype','addVertex','addEdge','numberOfEdges','getVertex','traverseBFS'];(function(_0x21484c,_0x1211cf){var _0x53b225=function(_0x36954c){while(--_0x36954c){_0x21484c['push'](_0x21484c['shift']());}};_0x53b225(++_0x1211cf);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x14433c,_0x3f4e97){_0x14433c=_0x14433c-0x0;var _0x2a0230=_0xa5fa[_0x14433c];return _0x2a0230;};'use strict';var _=require('lodash');var logger=require(_0xaa5f('0x0'))(_0xaa5f('0x1'));var verticesWithRetry=[_0xaa5f('0x2'),_0xaa5f('0x3'),'getsecretdigits'];var Graph=function(){this[_0xaa5f('0x4')]={};this[_0xaa5f('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0xaa5f('0x6')][_0xaa5f('0x7')]=function(_0x37f7bc){this[_0xaa5f('0x4')][_0x37f7bc['id']]=_0x37f7bc;this[_0xaa5f('0x5')][_0x37f7bc['id']]=[];};Graph[_0xaa5f('0x6')][_0xaa5f('0x8')]=function(_0xc326df,_0x74f64f,_0x3f550e){this[_0xaa5f('0x5')][_0xc326df]['push']({'target':_0x74f64f,'condition':_0x3f550e});this[_0xaa5f('0x9')]+=0x1;};Graph[_0xaa5f('0x6')]['size']=function(){return _['size'](this[_0xaa5f('0x4')]);};Graph['prototype']['relations']=function(){return this[_0xaa5f('0x9')];};Graph['prototype'][_0xaa5f('0xa')]=function(_0x471e14){return this[_0xaa5f('0x4')][_0x471e14];};Graph[_0xaa5f('0x6')][_0xaa5f('0xb')]=function(_0x48d1d3,_0xbd4e10){if(!this['vertices'][_0x48d1d3]){return logger[_0xaa5f('0xc')](_0xaa5f('0xd'));}var _0x31eabc=_0xbd4e10(this[_0xaa5f('0x4')][_0x48d1d3]);if(!_0x31eabc){return logger[_0xaa5f('0xc')]('stop\x20traverse');}if(this['edges'][_0x48d1d3][_0xaa5f('0xe')]===0x0){return logger[_0xaa5f('0xc')](_0xaa5f('0xf'));}for(var _0x4265ab=0x0,_0x27fdca=[],_0x1fa36a=![];_0x4265ab\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','syncho','util','moment','../../config/environment','agi','../../config/license/util','./mailRpc','./graph','./vertices','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','[%s]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','evtHangup','toJson','mxGraphModel','root','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','getSquareProject','catch','agi_','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','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','clear','vertex','agicommand'];(function(_0x484ad6,_0x4efaee){var _0x4950d0=function(_0x11afec){while(--_0x11afec){_0x484ad6['push'](_0x484ad6['shift']());}};_0x4950d0(++_0x4efaee);}(_0xc949,0x181));var _0x9c94=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xc949[_0x9df060];return _0x338dfe;};'use strict';var parser=require(_0x9c94('0x0'));var _=require('lodash');var syncho=require(_0x9c94('0x1'));var util=require(_0x9c94('0x2'));var moment=require(_0x9c94('0x3'));var config=require(_0x9c94('0x4'));var logger=require('../../config/logger')(_0x9c94('0x5'));var utilLicense=require(_0x9c94('0x6'));var rpc=require('./rpc');var mailRpc=require(_0x9c94('0x7'));var Graph=require(_0x9c94('0x8'));var Vertices=require(_0x9c94('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x9c94('0x5')]=_['defaults'](config[_0x9c94('0x5')],{'ip':_0x9c94('0xa'),'port':0x11dd});function connectionHandler(_0x25ecd0){process[_0x9c94('0xb')](function(){syncho(function(){try{setChannelVariables(_0x25ecd0);agiHandler(_0x25ecd0);}catch(_0xa874c7){logger[_0x9c94('0xc')](_0xa874c7[_0x9c94('0xd')]);}});});}function listeningHandler(){console[_0x9c94('0xe')](_0x9c94('0xf'),config[_0x9c94('0x5')]['port']);logger[_0x9c94('0x10')](util[_0x9c94('0x11')](_0x9c94('0x12'),config[_0x9c94('0x5')]['ip'],config[_0x9c94('0x5')][_0x9c94('0x13')]));}function errorHandler(_0x3dea2a){if(_0x3dea2a&&_0x3dea2a[_0x9c94('0x14')]&&_0x3dea2a[_0x9c94('0x15')]){logger[_0x9c94('0xc')](util[_0x9c94('0x11')](_0x9c94('0x16'),_0x3dea2a[_0x9c94('0x14')],_0x3dea2a[_0x9c94('0x15')]));}else{logger['error'](util[_0x9c94('0x11')]('[ERROR]\x20%s',_0x3dea2a[_0x9c94('0xd')]));}}function closeHandler(){logger[_0x9c94('0x10')](util['format'](_0x9c94('0x17'),this['arg_1'],this['calleridname'],this[_0x9c94('0x18')],this['dnid'],this[_0x9c94('0x19')]));try{createSquareReport(this);}catch(_0x33bd19){logger['error'](_0x33bd19[_0x9c94('0xd')]);}}function timeoutHandler(){logger[_0x9c94('0x10')](util[_0x9c94('0x11')](_0x9c94('0x1a'),this[_0x9c94('0x1b')],this[_0x9c94('0x1c')],this[_0x9c94('0x18')],this['dnid'],this[_0x9c94('0x19')]));}function hangupHandler(){logger[_0x9c94('0x10')](util['format'](_0x9c94('0x1d'),this[_0x9c94('0x1b')],this[_0x9c94('0x1c')],this[_0x9c94('0x18')],this[_0x9c94('0x1e')],this[_0x9c94('0x19')]));this[_0x9c94('0x1f')]=!![];}function getRoot(_0x23cdf5){return parser[_0x9c94('0x20')](_0x23cdf5,{'object':!![]})[_0x9c94('0x21')][_0x9c94('0x22')];}function addVertex(_0xe9280a,_0x44d732,_0x8c0b7f){_0x44d732['agicommand']=_0x8c0b7f;if(_0x44d732[_0x9c94('0x23')](_0x9c94('0x24'))){_0x44d732['maxRetry']=parseInt(_0x44d732[_0x9c94('0x24')],0xa);}_0xe9280a[_0x9c94('0x25')](_[_0x9c94('0x26')](_0x44d732,_0x9c94('0x27')));}function initGraph(_0x180b09,_0x4dd38e){var _0xc18230=new Graph();for(var _0x45cf4d in _0x180b09){if(_0x180b09['hasOwnProperty'](_0x45cf4d)){if(_[_0x9c94('0x28')](_0x180b09[_0x45cf4d])){for(var _0x4cfb9c=0x0;_0x4cfb9c<_0x180b09[_0x45cf4d][_0x9c94('0x29')];_0x4cfb9c+=0x1){addVertex(_0xc18230,_0x180b09[_0x45cf4d][_0x4cfb9c],_0x45cf4d);}}else{addVertex(_0xc18230,_0x180b09[_0x45cf4d],_0x45cf4d);}}}for(var _0x14d41b=0x0;_0x14d41b<_0x4dd38e[_0x9c94('0x29')];_0x14d41b+=0x1){if(_0x4dd38e[_0x14d41b][_0x9c94('0x2a')]&&_0x4dd38e[_0x14d41b][_0x9c94('0x2b')]){_0xc18230[_0x9c94('0x2c')](_0x4dd38e[_0x14d41b][_0x9c94('0x2a')],_0x4dd38e[_0x14d41b]['target'],_0x4dd38e[_0x14d41b]['value']);}}return _0xc18230;}function getSquareProject(_0xc4a819,_0x1878b5){rpc[_0x9c94('0x2d')](_0xc4a819)['then'](function(_0x25a6b9){_0x1878b5(null,_0x25a6b9);})['catch'](function(_0x356ee8){_0x1878b5(null,_0x356ee8);});}function createSquareReport(_0x4592e5,_0x1fd8ab){rpc['createSquareReport'](_0x4592e5)['then'](function(_0x1f4e4f){if(_0x1fd8ab){_0x1fd8ab(null,_0x1f4e4f);}})[_0x9c94('0x2e')](function(_0x1f91ef){if(_0x1fd8ab){_0x1fd8ab(null,_0x1f91ef);}});}function setChannelVariables(_0x48cbe0){for(var _0x5800e7 in _0x48cbe0){if(_0x48cbe0['hasOwnProperty'](_0x5800e7)){if(_0x5800e7['indexOf'](_0x9c94('0x2f'))===0x0){_0x48cbe0[_0x5800e7['substring'](0x4)]=_0x48cbe0[_0x5800e7];delete _0x48cbe0[_0x5800e7];}}}}function getLogFromObject(_0x125bbf){return util[_0x9c94('0x30')](_0x125bbf,{'showHidden':![],'depth':null});}function agiHandler(_0x593dde){var _0x5a9f71,_0x2465b5,_0x6b1b1a,_0x3c59ef,_0x8eb925;logger[_0x9c94('0x31')](_0x9c94('0x32'),JSON[_0x9c94('0x33')](_0x593dde,null,0x2));logger[_0x9c94('0x10')](util[_0x9c94('0x11')](_0x9c94('0x34'),_0x593dde[_0x9c94('0x1b')],_0x593dde[_0x9c94('0x1c')],_0x593dde[_0x9c94('0x18')],_0x593dde[_0x9c94('0x1e')],_0x593dde[_0x9c94('0x19')]));_0x593dde['on'](_0x9c94('0xc'),errorHandler);_0x593dde['on'](_0x9c94('0x35'),closeHandler);_0x593dde['on'](_0x9c94('0x36'),timeoutHandler);_0x593dde['evtHangup']=![];_0x593dde['on'](_0x9c94('0x37'),hangupHandler);var _0x230685=getSquareProject[_0x9c94('0x38')](null,_0x593dde[_0x9c94('0x1b')]);if(_0x230685){if(_0x230685[_0x9c94('0x39')]){_0x5a9f71=getRoot(_0x230685[_0x9c94('0x39')]);if(_0x5a9f71&&_0x5a9f71[_0x9c94('0x3a')]){logger['debug'](_0x9c94('0x22'),JSON['stringify'](_0x5a9f71,null,0x2));_0x593dde[_0x9c94('0x3b')]=moment()[_0x9c94('0x11')](_0x9c94('0x3c'));_0x2465b5=initGraph(_[_0x9c94('0x26')](_0x5a9f71,'mxCell'),_0x5a9f71[_0x9c94('0x27')]);_0x6b1b1a=new Vertices(_0x593dde,rpc,mailRpc);logger['info'](util[_0x9c94('0x11')](_0x9c94('0x3d'),_0x593dde[_0x9c94('0x1b')],_0x593dde['calleridname'],_0x593dde[_0x9c94('0x18')],_0x593dde['dnid'],_0x593dde[_0x9c94('0x19')]));_0x2465b5['traverseBFS'](_0x5a9f71['start']['id'],function(_0x9a75f0){try{_0x9a75f0=_0x6b1b1a[_0x9c94('0x3e')](_0x9a75f0);logger[_0x9c94('0x31')](_0x9c94('0x3f'),JSON['stringify'](_0x9a75f0,null,0x2));if(_0x9a75f0[_0x9c94('0x40')]===_0x9c94('0x41')){logger[_0x9c94('0x10')](_0x9c94('0x42'));_0x593dde['context']=_0x9a75f0[_0x9c94('0x43')]||_0x593dde[_0x9c94('0x43')];_0x593dde['extension']=_0x9a75f0[_0x9c94('0x44')];_0x593dde[_0x9c94('0x45')]=_0x9a75f0[_0x9c94('0x45')]?_0x9a75f0['priority']-0x1:0x1;return null;}else if(_0x9a75f0&&_0x6b1b1a[_0x9a75f0['agicommand']]){_0x8eb925=_0x6b1b1a[_0x9a75f0[_0x9c94('0x40')]](_0x9a75f0);logger[_0x9c94('0x10')](_0x9c94('0x46'),JSON[_0x9c94('0x33')](_0x8eb925,null,0x2));if(_0x8eb925&&_0x8eb925[_0x9c94('0x47')]===AGI_CODE_SUCCESS&&_0x8eb925[_0x9c94('0x48')]!==AGI_RESULT_ERROR&&!_0x593dde[_0x9c94('0x1f')]){logger[_0x9c94('0x31')](_0x9c94('0x46'),getLogFromObject(_0x8eb925));return _[_0x9c94('0x49')](_0x8eb925[_0x9c94('0x48')])?null:_0x8eb925['result'][_0x9c94('0x4a')]();}else{logger['error'](_0x9c94('0x46'),getLogFromObject(_0x8eb925));return null;}}else{logger[_0x9c94('0xc')](_0x9c94('0x4b'));return null;}}catch(_0xd0b3a9){logger[_0x9c94('0xc')](_0xd0b3a9[_0x9c94('0xd')]);return null;}});if(_0x5a9f71[_0x9c94('0x4c')]){logger['info'](util['format'](_0x9c94('0x4d'),_0x593dde[_0x9c94('0x1b')],_0x593dde[_0x9c94('0x1c')],_0x593dde['callerid'],_0x593dde[_0x9c94('0x1e')],_0x593dde[_0x9c94('0x19')]));_0x2465b5['traverseBFS'](_0x5a9f71['finally']['id'],function(_0x576383){try{_0x576383=_0x6b1b1a['clear'](_0x576383);logger[_0x9c94('0x31')]('vertex',JSON['stringify'](_0x576383,null,0x2));if(_0x576383&&_0x6b1b1a[_0x576383[_0x9c94('0x40')]]){_0x8eb925=_0x6b1b1a[_0x576383['agicommand']](_0x576383);if(_0x8eb925){logger[_0x9c94('0x31')](_0x9c94('0x46'),getLogFromObject(_0x8eb925));return _[_0x9c94('0x49')](_0x8eb925[_0x9c94('0x48')])?null:_0x8eb925[_0x9c94('0x48')]['toString']();}else{logger[_0x9c94('0xc')](_0x9c94('0x46'),getLogFromObject(_0x8eb925));return null;}}else{logger[_0x9c94('0xc')](_0x9c94('0x4b'));return null;}}catch(_0x41226a){logger[_0x9c94('0xc')](_0x41226a['stack']);return null;}});}logger[_0x9c94('0x10')](util['format'](_0x9c94('0x4e'),_0x593dde[_0x9c94('0x1b')],_0x593dde[_0x9c94('0x1c')],_0x593dde['callerid'],_0x593dde[_0x9c94('0x1e')],_0x593dde[_0x9c94('0x19')]));logger['info'](util[_0x9c94('0x11')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x593dde[_0x9c94('0x43')],_0x593dde[_0x9c94('0x44')],parseInt(_0x593dde['priority'],0xa)+0x1));_0x593dde['continueAt'](_0x593dde[_0x9c94('0x43')],_0x593dde['extension'],parseInt(_0x593dde[_0x9c94('0x45')],0xa)+0x1);_0x593dde[_0x9c94('0x35')]();}}else{logger[_0x9c94('0xc')](util[_0x9c94('0x11')]('Project\x20%s\x20not\x20published',_0x593dde[_0x9c94('0x1b')]));_0x593dde[_0x9c94('0x4f')](_0x593dde['context'],_0x593dde['extension'],parseInt(_0x593dde[_0x9c94('0x45')],0xa)+0x1);_0x593dde[_0x9c94('0x35')]();}}else{logger[_0x9c94('0xc')](util[_0x9c94('0x11')](_0x9c94('0x50'),_0x593dde[_0x9c94('0x1b')]));_0x593dde['continueAt'](_0x593dde[_0x9c94('0x43')],_0x593dde[_0x9c94('0x44')],parseInt(_0x593dde[_0x9c94('0x45')],0xa)+0x1);_0x593dde[_0x9c94('0x35')]();}}function main(){var _0x3f34f2;return utilLicense[_0x9c94('0x51')]()['then'](function(_0x2fad44){if(_0x2fad44){if(_0x2fad44['voice']){if(_0x2fad44[_0x9c94('0x52')]&&_0x2fad44[_0x9c94('0x52')]>0x0){logger[_0x9c94('0x10')](util['format'](_0x9c94('0x53'),_0x2fad44['callysquare']));_0x3f34f2=_0x2fad44['callysquare'];}else{logger[_0x9c94('0x10')](_0x9c94('0x54'));}}else{logger['info'](_0x9c94('0x55'));_0x3f34f2=-0x1;}}})[_0x9c94('0x2e')](function(_0x1f0beb){logger[_0x9c94('0xc')](_0x9c94('0x56'),_0x1f0beb[_0x9c94('0xd')]);})[_0x9c94('0x4c')](function(){var _0x730b6d=require(_0x9c94('0x57'))(config[_0x9c94('0x5')][_0x9c94('0x13')],config['agi']['ip'],_0x3f34f2);_0x730b6d['on']('error',errorHandler);_0x730b6d['on'](_0x9c94('0x58'),listeningHandler);_0x730b6d['on'](_0x9c94('0x59'),connectionHandler);_0x730b6d['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xb647=['variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','production','start','joinAt','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','listening','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','./rpc','./graph','./vertices','defaults','127.0.0.1','nextTick','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','port','name','message','error','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','length','source','target','addEdge','value','getSquareProject','then','catch','inspect','debug'];(function(_0x35245d,_0x193583){var _0x184a83=function(_0x2d46bd){while(--_0x2d46bd){_0x35245d['push'](_0x35245d['shift']());}};_0x184a83(++_0x193583);}(_0xb647,0xdb));var _0x7b64=function(_0x2b4f16,_0x507259){_0x2b4f16=_0x2b4f16-0x0;var _0x3b8e21=_0xb647[_0x2b4f16];return _0x3b8e21;};'use strict';var parser=require(_0x7b64('0x0'));var _=require(_0x7b64('0x1'));var syncho=require(_0x7b64('0x2'));var util=require(_0x7b64('0x3'));var moment=require(_0x7b64('0x4'));var config=require(_0x7b64('0x5'));var logger=require(_0x7b64('0x6'))(_0x7b64('0x7'));var utilLicense=require('../../config/license/util');var rpc=require(_0x7b64('0x8'));var mailRpc=require('./mailRpc');var Graph=require(_0x7b64('0x9'));var Vertices=require(_0x7b64('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x7b64('0x7')]=_[_0x7b64('0xb')](config[_0x7b64('0x7')],{'ip':_0x7b64('0xc'),'port':0x11dd});function connectionHandler(_0x727684){process[_0x7b64('0xd')](function(){syncho(function(){try{setChannelVariables(_0x727684);agiHandler(_0x727684);}catch(_0x432ced){logger['error'](_0x432ced[_0x7b64('0xe')]);}});});}function listeningHandler(){console['log'](_0x7b64('0xf'),config['agi']['port']);logger[_0x7b64('0x10')](util[_0x7b64('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x7b64('0x7')]['ip'],config[_0x7b64('0x7')][_0x7b64('0x12')]));}function errorHandler(_0x42fb71){if(_0x42fb71&&_0x42fb71[_0x7b64('0x13')]&&_0x42fb71[_0x7b64('0x14')]){logger[_0x7b64('0x15')](util['format'](_0x7b64('0x16'),_0x42fb71['name'],_0x42fb71['message']));}else{logger[_0x7b64('0x15')](util[_0x7b64('0x11')](_0x7b64('0x17'),_0x42fb71[_0x7b64('0xe')]));}}function closeHandler(){logger[_0x7b64('0x10')](util[_0x7b64('0x11')](_0x7b64('0x18'),this['arg_1'],this[_0x7b64('0x19')],this[_0x7b64('0x1a')],this[_0x7b64('0x1b')],this[_0x7b64('0x1c')]));try{createSquareReport(this);}catch(_0x157c03){logger['error'](_0x157c03[_0x7b64('0xe')]);}}function timeoutHandler(){logger[_0x7b64('0x10')](util['format'](_0x7b64('0x1d'),this[_0x7b64('0x1e')],this['calleridname'],this[_0x7b64('0x1a')],this[_0x7b64('0x1b')],this[_0x7b64('0x1c')]));}function hangupHandler(){logger[_0x7b64('0x10')](util['format'](_0x7b64('0x1f'),this[_0x7b64('0x1e')],this['calleridname'],this[_0x7b64('0x1a')],this['dnid'],this[_0x7b64('0x1c')]));this['evtHangup']=!![];}function getRoot(_0x1bbd87){return parser[_0x7b64('0x20')](_0x1bbd87,{'object':!![]})[_0x7b64('0x21')][_0x7b64('0x22')];}function addVertex(_0x450b7e,_0x3c0d97,_0x215ea9){_0x3c0d97[_0x7b64('0x23')]=_0x215ea9;if(_0x3c0d97[_0x7b64('0x24')](_0x7b64('0x25'))){_0x3c0d97[_0x7b64('0x26')]=parseInt(_0x3c0d97[_0x7b64('0x25')],0xa);}_0x450b7e[_0x7b64('0x27')](_[_0x7b64('0x28')](_0x3c0d97,'mxCell'));}function initGraph(_0xc61df8,_0x5d9586){var _0x1580d0=new Graph();for(var _0x21fbd3 in _0xc61df8){if(_0xc61df8['hasOwnProperty'](_0x21fbd3)){if(_['isArray'](_0xc61df8[_0x21fbd3])){for(var _0x38738c=0x0;_0x38738c<_0xc61df8[_0x21fbd3][_0x7b64('0x29')];_0x38738c+=0x1){addVertex(_0x1580d0,_0xc61df8[_0x21fbd3][_0x38738c],_0x21fbd3);}}else{addVertex(_0x1580d0,_0xc61df8[_0x21fbd3],_0x21fbd3);}}}for(var _0x1a8d6b=0x0;_0x1a8d6b<_0x5d9586[_0x7b64('0x29')];_0x1a8d6b+=0x1){if(_0x5d9586[_0x1a8d6b][_0x7b64('0x2a')]&&_0x5d9586[_0x1a8d6b][_0x7b64('0x2b')]){_0x1580d0[_0x7b64('0x2c')](_0x5d9586[_0x1a8d6b][_0x7b64('0x2a')],_0x5d9586[_0x1a8d6b]['target'],_0x5d9586[_0x1a8d6b][_0x7b64('0x2d')]);}}return _0x1580d0;}function getSquareProject(_0x2c4619,_0x5d7fd9){rpc[_0x7b64('0x2e')](_0x2c4619)[_0x7b64('0x2f')](function(_0x369402){_0x5d7fd9(null,_0x369402);})[_0x7b64('0x30')](function(_0x144327){_0x5d7fd9(null,_0x144327);});}function createSquareReport(_0x38a059,_0x5bc7fb){rpc['createSquareReport'](_0x38a059)[_0x7b64('0x2f')](function(_0x3fb4a8){if(_0x5bc7fb){_0x5bc7fb(null,_0x3fb4a8);}})['catch'](function(_0x508c6d){if(_0x5bc7fb){_0x5bc7fb(null,_0x508c6d);}});}function setChannelVariables(_0x345664){for(var _0x4914d5 in _0x345664){if(_0x345664[_0x7b64('0x24')](_0x4914d5)){if(_0x4914d5['indexOf']('agi_')===0x0){_0x345664[_0x4914d5['substring'](0x4)]=_0x345664[_0x4914d5];delete _0x345664[_0x4914d5];}}}}function getLogFromObject(_0x12f4e5){return util[_0x7b64('0x31')](_0x12f4e5,{'showHidden':![],'depth':null});}function agiHandler(_0x120a84){var _0x58ffdb,_0xaac9e8,_0x51cff5,_0x2a74e4,_0x7e1083;logger[_0x7b64('0x32')](_0x7b64('0x33'),JSON[_0x7b64('0x34')](_0x120a84,null,0x2));logger['info'](util[_0x7b64('0x11')](_0x7b64('0x35'),_0x120a84[_0x7b64('0x1e')],_0x120a84[_0x7b64('0x19')],_0x120a84['callerid'],_0x120a84[_0x7b64('0x1b')],_0x120a84[_0x7b64('0x1c')]));_0x120a84['on'](_0x7b64('0x15'),errorHandler);_0x120a84['on'](_0x7b64('0x36'),closeHandler);_0x120a84['on'](_0x7b64('0x37'),timeoutHandler);_0x120a84[_0x7b64('0x38')]=![];_0x120a84['on'](_0x7b64('0x39'),hangupHandler);var _0x526389=getSquareProject['sync'](null,_0x120a84[_0x7b64('0x1e')]);if(_0x526389){if(_0x526389[_0x7b64('0x3a')]){_0x58ffdb=getRoot(_0x526389[_0x7b64('0x3a')]);if(_0x58ffdb&&_0x58ffdb[_0x7b64('0x3b')]){logger[_0x7b64('0x32')](_0x7b64('0x22'),JSON[_0x7b64('0x34')](_0x58ffdb,null,0x2));_0x120a84[_0x7b64('0x3c')]=moment()[_0x7b64('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0xaac9e8=initGraph(_[_0x7b64('0x28')](_0x58ffdb,_0x7b64('0x3d')),_0x58ffdb[_0x7b64('0x3d')]);_0x51cff5=new Vertices(_0x120a84,rpc,mailRpc);logger[_0x7b64('0x10')](util[_0x7b64('0x11')](_0x7b64('0x3e'),_0x120a84[_0x7b64('0x1e')],_0x120a84[_0x7b64('0x19')],_0x120a84[_0x7b64('0x1a')],_0x120a84[_0x7b64('0x1b')],_0x120a84[_0x7b64('0x1c')]));_0xaac9e8[_0x7b64('0x3f')](_0x58ffdb[_0x7b64('0x3b')]['id'],function(_0x36cfce){try{_0x36cfce=_0x51cff5[_0x7b64('0x40')](_0x36cfce);logger[_0x7b64('0x32')](_0x7b64('0x41'),JSON[_0x7b64('0x34')](_0x36cfce,null,0x2));if(_0x36cfce[_0x7b64('0x23')]===_0x7b64('0x42')){logger['info'](_0x7b64('0x43'));_0x120a84[_0x7b64('0x44')]=_0x36cfce[_0x7b64('0x44')]||_0x120a84['context'];_0x120a84[_0x7b64('0x45')]=_0x36cfce[_0x7b64('0x45')];_0x120a84['priority']=_0x36cfce[_0x7b64('0x46')]?_0x36cfce[_0x7b64('0x46')]-0x1:0x1;return null;}else if(_0x36cfce&&_0x51cff5[_0x36cfce['agicommand']]){_0x7e1083=_0x51cff5[_0x36cfce[_0x7b64('0x23')]](_0x36cfce);logger['info'](_0x7b64('0x47'),JSON[_0x7b64('0x34')](_0x7e1083,null,0x2));if(_0x7e1083&&_0x7e1083[_0x7b64('0x48')]===AGI_CODE_SUCCESS&&_0x7e1083['result']!==AGI_RESULT_ERROR&&!_0x120a84[_0x7b64('0x38')]){logger[_0x7b64('0x32')](_0x7b64('0x47'),getLogFromObject(_0x7e1083));return _[_0x7b64('0x49')](_0x7e1083[_0x7b64('0x4a')])?null:_0x7e1083[_0x7b64('0x4a')]['toString']();}else{logger[_0x7b64('0x15')](_0x7b64('0x47'),getLogFromObject(_0x7e1083));return null;}}else{logger[_0x7b64('0x15')](_0x7b64('0x4b'));return null;}}catch(_0xdcca4e){logger['error'](_0xdcca4e['stack']);return null;}});if(_0x58ffdb['finally']){logger['info'](util[_0x7b64('0x11')](_0x7b64('0x4c'),_0x120a84[_0x7b64('0x1e')],_0x120a84[_0x7b64('0x19')],_0x120a84[_0x7b64('0x1a')],_0x120a84[_0x7b64('0x1b')],_0x120a84[_0x7b64('0x1c')]));_0xaac9e8[_0x7b64('0x3f')](_0x58ffdb[_0x7b64('0x4d')]['id'],function(_0x118690){try{_0x118690=_0x51cff5[_0x7b64('0x40')](_0x118690);logger[_0x7b64('0x32')]('vertex',JSON['stringify'](_0x118690,null,0x2));if(_0x118690&&_0x51cff5[_0x118690[_0x7b64('0x23')]]){_0x7e1083=_0x51cff5[_0x118690[_0x7b64('0x23')]](_0x118690);if(_0x7e1083){logger[_0x7b64('0x32')](_0x7b64('0x47'),getLogFromObject(_0x7e1083));return _[_0x7b64('0x49')](_0x7e1083['result'])?null:_0x7e1083[_0x7b64('0x4a')][_0x7b64('0x4e')]();}else{logger[_0x7b64('0x15')]('response',getLogFromObject(_0x7e1083));return null;}}else{logger[_0x7b64('0x15')](_0x7b64('0x4b'));return null;}}catch(_0x27c9f9){logger[_0x7b64('0x15')](_0x27c9f9[_0x7b64('0xe')]);return null;}});}logger['info'](util[_0x7b64('0x11')](_0x7b64('0x4f'),_0x120a84['arg_1'],_0x120a84[_0x7b64('0x19')],_0x120a84[_0x7b64('0x1a')],_0x120a84['dnid'],_0x120a84[_0x7b64('0x1c')]));logger[_0x7b64('0x10')](util[_0x7b64('0x11')](_0x7b64('0x50'),_0x120a84[_0x7b64('0x44')],_0x120a84[_0x7b64('0x45')],parseInt(_0x120a84[_0x7b64('0x46')],0xa)+0x1));_0x120a84[_0x7b64('0x51')](_0x120a84[_0x7b64('0x44')],_0x120a84[_0x7b64('0x45')],parseInt(_0x120a84[_0x7b64('0x46')],0xa)+0x1);_0x120a84[_0x7b64('0x36')]();}}else{logger[_0x7b64('0x15')](util[_0x7b64('0x11')](_0x7b64('0x52'),_0x120a84[_0x7b64('0x1e')]));_0x120a84[_0x7b64('0x51')](_0x120a84[_0x7b64('0x44')],_0x120a84['extension'],parseInt(_0x120a84[_0x7b64('0x46')],0xa)+0x1);_0x120a84['close']();}}else{logger[_0x7b64('0x15')](util[_0x7b64('0x11')](_0x7b64('0x53'),_0x120a84['arg_1']));_0x120a84['continueAt'](_0x120a84[_0x7b64('0x44')],_0x120a84['extension'],parseInt(_0x120a84['priority'],0xa)+0x1);_0x120a84[_0x7b64('0x36')]();}}function main(){var _0x40c17c;return utilLicense[_0x7b64('0x54')]()['then'](function(_0x1fd98a){if(_0x1fd98a){if(_0x1fd98a[_0x7b64('0x55')]){if(_0x1fd98a[_0x7b64('0x56')]&&_0x1fd98a[_0x7b64('0x56')]>0x0){logger[_0x7b64('0x10')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x1fd98a[_0x7b64('0x56')]));_0x40c17c=_0x1fd98a[_0x7b64('0x56')];}else{logger[_0x7b64('0x10')](_0x7b64('0x57'));}}else{logger[_0x7b64('0x10')](_0x7b64('0x58'));_0x40c17c=-0x1;}}})[_0x7b64('0x30')](function(_0x18ef41){logger[_0x7b64('0x15')]('[LICENSE]',_0x18ef41[_0x7b64('0xe')]);})['finally'](function(){var _0xc22a67=require('./server')(config['agi']['port'],config['agi']['ip'],_0x40c17c);_0xc22a67['on'](_0x7b64('0x15'),errorHandler);_0xc22a67['on'](_0x7b64('0x59'),listeningHandler);_0xc22a67['on']('connection',connectionHandler);_0xc22a67['on'](_0x7b64('0x36'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 7db04e2..91d8440 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x1727a9,_0x53c5fc){var _0x57bd2f=function(_0x329865){while(--_0x329865){_0x1727a9['push'](_0x1727a9['shift']());}};_0x57bd2f(++_0x53c5fc);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x7ecafa,_0x347408){var _0x1d0929=function(_0x32a92c){while(--_0x32a92c){_0x7ecafa['push'](_0x7ecafa['shift']());}};_0x1d0929(++_0x347408);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 78d5b5a..ca3568b 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 _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x2ced4f,_0x54891c){var _0x5acd2a=function(_0x3ff619){while(--_0x3ff619){_0x2ced4f['push'](_0x2ced4f['shift']());}};_0x5acd2a(++_0x54891c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x48104c,_0x8157b8){_0x48104c=_0x48104c-0x0;var _0x327f9c=_0x5f2f[_0x48104c];return _0x327f9c;};'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 +var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0xd6c010,_0x5355e6){var _0x15893b=function(_0x1b0a5a){while(--_0x1b0a5a){_0xd6c010['push'](_0xd6c010['shift']());}};_0x15893b(++_0x5355e6);}(_0xb10b,0x12a));var _0xbb10=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0xb10b[_0x421263];return _0x34e4b5;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 9b465d9..ee52d7d 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 _0x0918=['CreateSquareMessage','createCmContact','ShowCmHopper','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','lodash','util','jayson/promise','client','http','error','message','result','catch','ShowSquareProject','production','ShowMailAccount','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','dsn','ShowUser','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x0918,0x1b4));var _0x8091=function(_0x1c72eb,_0x48ba9a){_0x1c72eb=_0x1c72eb-0x0;var _0x4182c4=_0x0918[_0x1c72eb];return _0x4182c4;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x8091('0x0'));var util=require(_0x8091('0x1'));var jayson=require(_0x8091('0x2'));var client=jayson[_0x8091('0x3')][_0x8091('0x4')]({'port':0x2329});function request(_0x3f44bf,_0x246679){return new BPromise(function(_0x4d052d,_0x475259){return client['request'](_0x3f44bf,_0x246679)['then'](function(_0x3d414c){if(_0x3d414c[_0x8091('0x5')]){return _0x475259(_0x3d414c[_0x8091('0x5')][_0x8091('0x6')]);}else{return _0x4d052d(_0x3d414c[_0x8091('0x7')]);}})[_0x8091('0x8')](function(_0x3a6e42){return _0x475259(_0x3a6e42);});});}exports['getSquareProject']=function(_0x2279de){return request(_0x8091('0x9'),{'options':{'raw':![],'where':{'name':_0x2279de},'attributes':[_0x8091('0xa')]}});};exports['getMailAccountById']=function(_0x4b4098){return request(_0x8091('0xb'),{'options':{'raw':![],'where':{'id':_0x4b4098},'include':[{'model':'MailServerOut','as':_0x8091('0xc')}],'attributes':['id',_0x8091('0xd'),_0x8091('0xe')]}});};exports[_0x8091('0xf')]=function(_0x12d1c7){return request(_0x8091('0x9'),{'options':{'where':{'id':_0x12d1c7},'attributes':['name']}});};exports[_0x8091('0x10')]=function(_0x1fa821){return request(_0x8091('0x11'),{'options':{'where':{'id':_0x1fa821},'attributes':['name']}});};exports['getVariableById']=function(_0x9ab457){return request(_0x8091('0x12'),{'options':{'where':{'id':_0x9ab457},'attributes':[_0x8091('0xd')]}});};exports['getSquareOdbcById']=function(_0x14978c){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x14978c},'attributes':[_0x8091('0x13')]}});};exports['getUserById']=function(_0x4208a9){return request(_0x8091('0x14'),{'options':{'where':{'id':_0x4208a9},'attributes':[_0x8091('0xd')]}});};exports[_0x8091('0x15')]=function(_0x8802eb){return request('ShowTrunk',{'options':{'where':{'id':_0x8802eb},'attributes':[_0x8091('0xd')]}});};exports[_0x8091('0x16')]=function(_0x429fd2){return request(_0x8091('0x17'),{'options':{'where':{'id':_0x429fd2},'attributes':[_0x8091('0x18')]}});};exports[_0x8091('0x19')]=function(_0x13382c){return request(_0x8091('0x1a'),{'options':{'raw':![],'where':{'id':_0x13382c},'include':[{'model':_0x8091('0x1b'),'as':_0x8091('0x1c')}]}});};exports[_0x8091('0x1d')]=function(_0x2cc281){return request(_0x8091('0x1e'),{'options':{'where':{'id':_0x2cc281},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x1ac8b9){return request('CreateSmsMessage',{'body':_0x1ac8b9});};exports['createSquareDetailsReport']=function(_0x4141b3){return request(_0x8091('0x1f'),{'body':_0x4141b3});};exports[_0x8091('0x20')]=function(_0x51f702){return request(_0x8091('0x21'),{'body':_[_0x8091('0x22')](_0x51f702,{'project_name':_0x51f702[_0x8091('0x23')],'prev_project_name':_0x51f702[_0x8091('0x24')]||'','is_subproject':_0x51f702['arg_2']?!![]:![],'leaveAt':moment()[_0x8091('0x25')](_0x8091('0x26'))})});};exports[_0x8091('0x27')]=function(_0x429051){return request(_0x8091('0x28'),{'body':_0x429051});};exports['createSquareMessage']=function(_0x259e41){return request(_0x8091('0x29'),{'body':_0x259e41});};exports[_0x8091('0x2a')]=function(_0x400a9c){return request(_0x8091('0x2b'),{'options':{'raw':![],'where':{'phone':_0x400a9c['phone'],'ListId':_0x400a9c[_0x8091('0x2c')]}}})[_0x8091('0x2d')](function(_0x4fbc85){if(_0x4fbc85){return _0x4fbc85;}return request(_0x8091('0x2e'),{'body':_0x400a9c});});};exports[_0x8091('0x2f')]=function(_0x22a865){return request(_0x8091('0x30'),{'options':{'where':{'id':_0x22a865},'attributes':[_0x8091('0xd')]}});};exports[_0x8091('0x31')]=function(_0x4ba626,_0x2733cd){return request(_0x8091('0x32'),{'body':{'interface':_0x2733cd},'options':{'where':_0x4ba626}});};exports[_0x8091('0x33')]=function(_0x34e1d6,_0x287a72,_0x31abcf){return request('PauseUser',{'body':{'type':_0x287a72,'uniqueid':_0x31abcf},'options':{'where':_0x34e1d6}});};exports[_0x8091('0x34')]=function(_0x1c3ae6){return request('UnpauseUser',{'body':{},'options':{'where':_0x1c3ae6}});};exports['agentLogout']=function(_0xd01121){return request('LogoutUser',{'body':{},'options':{'where':_0xd01121}});}; \ No newline at end of file +var _0xa2c6=['request','then','error','result','catch','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','ShowSquareProject','name','ShowVoiceQueue','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','CreateCmContact','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','http'];(function(_0xba712e,_0x29145f){var _0x2271ed=function(_0x44ff34){while(--_0x44ff34){_0xba712e['push'](_0xba712e['shift']());}};_0x2271ed(++_0x29145f);}(_0xa2c6,0xf2));var _0x6a2c=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xa2c6[_0x12fc8d];return _0x3f9d04;};'use strict';var BPromise=require(_0x6a2c('0x0'));var moment=require(_0x6a2c('0x1'));var _=require(_0x6a2c('0x2'));var util=require(_0x6a2c('0x3'));var jayson=require(_0x6a2c('0x4'));var client=jayson['client'][_0x6a2c('0x5')]({'port':0x2329});function request(_0x1fba05,_0xff1717){return new BPromise(function(_0x1f0b1e,_0x4872cc){return client[_0x6a2c('0x6')](_0x1fba05,_0xff1717)[_0x6a2c('0x7')](function(_0x3a012a){if(_0x3a012a[_0x6a2c('0x8')]){return _0x4872cc(_0x3a012a[_0x6a2c('0x8')]['message']);}else{return _0x1f0b1e(_0x3a012a[_0x6a2c('0x9')]);}})[_0x6a2c('0xa')](function(_0x2cb60d){return _0x4872cc(_0x2cb60d);});});}exports[_0x6a2c('0xb')]=function(_0x28cc56){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x28cc56},'attributes':[_0x6a2c('0xc')]}});};exports[_0x6a2c('0xd')]=function(_0x541061){return request(_0x6a2c('0xe'),{'options':{'raw':![],'where':{'id':_0x541061},'include':[{'model':_0x6a2c('0xf'),'as':_0x6a2c('0x10')}],'attributes':['id','name','email']}});};exports['getSquareProjectById']=function(_0x49db56){return request(_0x6a2c('0x11'),{'options':{'where':{'id':_0x49db56},'attributes':[_0x6a2c('0x12')]}});};exports['getVoiceQueueById']=function(_0x5126b8){return request(_0x6a2c('0x13'),{'options':{'where':{'id':_0x5126b8},'attributes':['name']}});};exports['getVariableById']=function(_0x267cf7){return request(_0x6a2c('0x14'),{'options':{'where':{'id':_0x267cf7},'attributes':[_0x6a2c('0x12')]}});};exports[_0x6a2c('0x15')]=function(_0x3ac4ad){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x3ac4ad},'attributes':[_0x6a2c('0x16')]}});};exports[_0x6a2c('0x17')]=function(_0x1dd48f){return request(_0x6a2c('0x18'),{'options':{'where':{'id':_0x1dd48f},'attributes':[_0x6a2c('0x12')]}});};exports[_0x6a2c('0x19')]=function(_0x104259){return request(_0x6a2c('0x1a'),{'options':{'where':{'id':_0x104259},'attributes':[_0x6a2c('0x12')]}});};exports[_0x6a2c('0x1b')]=function(_0xd7806c){return request(_0x6a2c('0x1c'),{'options':{'where':{'id':_0xd7806c},'attributes':[_0x6a2c('0x1d')]}});};exports[_0x6a2c('0x1e')]=function(_0x2928a4){return request(_0x6a2c('0x1f'),{'options':{'raw':![],'where':{'id':_0x2928a4},'include':[{'model':_0x6a2c('0x20'),'as':_0x6a2c('0x21')}]}});};exports[_0x6a2c('0x22')]=function(_0x35a72c){return request(_0x6a2c('0x23'),{'options':{'where':{'id':_0x35a72c},'attributes':['id','name']}});};exports[_0x6a2c('0x24')]=function(_0x23b512){return request(_0x6a2c('0x25'),{'body':_0x23b512});};exports[_0x6a2c('0x26')]=function(_0x3f4e56){return request(_0x6a2c('0x27'),{'body':_0x3f4e56});};exports[_0x6a2c('0x28')]=function(_0x1610b2){return request(_0x6a2c('0x29'),{'body':_['merge'](_0x1610b2,{'project_name':_0x1610b2[_0x6a2c('0x2a')],'prev_project_name':_0x1610b2[_0x6a2c('0x2b')]||'','is_subproject':_0x1610b2[_0x6a2c('0x2b')]?!![]:![],'leaveAt':moment()[_0x6a2c('0x2c')](_0x6a2c('0x2d'))})});};exports[_0x6a2c('0x2e')]=function(_0x2f3cc9){return request(_0x6a2c('0x2f'),{'body':_0x2f3cc9});};exports[_0x6a2c('0x30')]=function(_0xcfd487){return request(_0x6a2c('0x31'),{'body':_0xcfd487});};exports['createCmContact']=function(_0x728c67){return request(_0x6a2c('0x32'),{'options':{'raw':![],'where':{'phone':_0x728c67[_0x6a2c('0x33')],'ListId':_0x728c67[_0x6a2c('0x34')]}}})[_0x6a2c('0x7')](function(_0x108625){if(_0x108625){return _0x108625;}return request(_0x6a2c('0x35'),{'body':_0x728c67});});};exports['getPauseById']=function(_0x2fe24c){return request(_0x6a2c('0x36'),{'options':{'where':{'id':_0x2fe24c},'attributes':[_0x6a2c('0x12')]}});};exports['agentLogin']=function(_0x194e0b,_0x43b5bc){return request(_0x6a2c('0x37'),{'body':{'interface':_0x43b5bc},'options':{'where':_0x194e0b}});};exports[_0x6a2c('0x38')]=function(_0x210843,_0x401dfd,_0x4c36c6){return request(_0x6a2c('0x39'),{'body':{'type':_0x401dfd,'uniqueid':_0x4c36c6},'options':{'where':_0x210843}});};exports[_0x6a2c('0x3a')]=function(_0x533819){return request(_0x6a2c('0x3b'),{'body':{},'options':{'where':_0x533819}});};exports[_0x6a2c('0x3c')]=function(_0xb3ac89){return request(_0x6a2c('0x3d'),{'body':{},'options':{'where':_0xb3ac89}});}; \ 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 c60dc1b..52e060d 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 _0x4bc3=['./polly','./lex'];(function(_0x401609,_0x5eb61d){var _0x35fd57=function(_0x5dcddd){while(--_0x5dcddd){_0x401609['push'](_0x401609['shift']());}};_0x35fd57(++_0x5eb61d);}(_0x4bc3,0x16e));var _0x34bc=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x4bc3[_0x2064e5];return _0x21a233;};var polly=require(_0x34bc('0x0'));var lex=require(_0x34bc('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xb66c=['exports','./polly'];(function(_0x20d12f,_0x945b5f){var _0x43bb79=function(_0x367cb9){while(--_0x367cb9){_0x20d12f['push'](_0x20d12f['shift']());}};_0x43bb79(++_0x945b5f);}(_0xb66c,0x175));var _0xcb66=function(_0x195ffe,_0x129872){_0x195ffe=_0x195ffe-0x0;var _0x451deb=_0xb66c[_0x195ffe];return _0x451deb;};var polly=require(_0xcb66('0x0'));var lex=require('./lex');module[_0xcb66('0x1')]={'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 ad3e793..cbcd6dd 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 _0x073e=['exports','./lib/api'];(function(_0x10a398,_0x10d419){var _0x34c43=function(_0x2e0b96){while(--_0x2e0b96){_0x10a398['push'](_0x10a398['shift']());}};_0x34c43(++_0x10d419);}(_0x073e,0x181));var _0xe073=function(_0xf3c504,_0x4d5a57){_0xf3c504=_0xf3c504-0x0;var _0x30c191=_0x073e[_0xf3c504];return _0x30c191;};'use strict';var lex=require(_0xe073('0x0'));module[_0xe073('0x1')]=function(_0x876bb9,_0x358375,_0x4a6f42,_0x488838,_0x4e8df8,_0x3eff57){return lex(_0x876bb9,_0x358375,_0x4a6f42,_0x488838,_0x4e8df8,_0x3eff57);}; \ No newline at end of file +var _0xee5b=['./lib/api'];(function(_0x5914a3,_0x9aa61){var _0x46b722=function(_0x44b9de){while(--_0x44b9de){_0x5914a3['push'](_0x5914a3['shift']());}};_0x46b722(++_0x9aa61);}(_0xee5b,0x1f4));var _0xbee5=function(_0x2861c6,_0x193e5e){_0x2861c6=_0x2861c6-0x0;var _0x462211=_0xee5b[_0x2861c6];return _0x462211;};'use strict';var lex=require(_0xbee5('0x0'));module['exports']=function(_0x7b2344,_0x203bba,_0x4f850a,_0x1893e4,_0x2b93c2,_0x2eb857){return lex(_0x7b2344,_0x203bba,_0x4f850a,_0x1893e4,_0x2b93c2,_0x2eb857);}; \ 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 81c6dd7..bcd7980 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 _0x5fb0=['slot_','exports','LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x5c876a,_0x467fff){var _0x428f60=function(_0x3ef702){while(--_0x3ef702){_0x5c876a['push'](_0x5c876a['shift']());}};_0x428f60(++_0x467fff);}(_0x5fb0,0xc0));var _0x05fb=function(_0x592945,_0x3940b3){_0x592945=_0x592945-0x0;var _0x1635b3=_0x5fb0[_0x592945];return _0x1635b3;};'use strict';var BPromise=require(_0x05fb('0x0'));var AWS=require(_0x05fb('0x1'));function lexResult(_0x5d3933,_0x7aa125){return new BPromise(function(_0xfcc9cc,_0x5d70f0){_0x5d3933['postText'](_0x7aa125,function(_0x136a2a,_0x4ff74e){if(_0x136a2a){_0x5d70f0(_0x136a2a);}if(_0x4ff74e['slots']){for(const _0x352f7c in _0x4ff74e[_0x05fb('0x2')]){if(_0x4ff74e['slots'][_0x05fb('0x3')](_0x352f7c)){var _0x30fd30=_0x4ff74e[_0x05fb('0x2')][_0x352f7c];_0x4ff74e[_0x05fb('0x4')+_0x352f7c]=_0x30fd30;}}}_0xfcc9cc(_0x4ff74e);});});}module[_0x05fb('0x5')]=function(_0x275184,_0x36c56d,_0xbc2b20,_0x5e602a,_0x57c435,_0x139aaf){var _0x364ddf=new AWS[(_0x05fb('0x6'))]({'accessKeyId':_0x36c56d,'secretAccessKey':_0xbc2b20,'region':_0x5e602a});var _0x55f329={'botAlias':'$LATEST','botName':_0x139aaf,'inputText':_0x57c435,'userId':_0x275184};return lexResult(_0x364ddf,_0x55f329);}; \ No newline at end of file +var _0x3608=['slot_','LexRuntime','$LATEST','bluebird','aws-sdk','postText','slots'];(function(_0x4605dc,_0x3f7ae5){var _0x5d3e81=function(_0x1d0375){while(--_0x1d0375){_0x4605dc['push'](_0x4605dc['shift']());}};_0x5d3e81(++_0x3f7ae5);}(_0x3608,0x10d));var _0x8360=function(_0x590b1f,_0x32f7c5){_0x590b1f=_0x590b1f-0x0;var _0x167a14=_0x3608[_0x590b1f];return _0x167a14;};'use strict';var BPromise=require(_0x8360('0x0'));var AWS=require(_0x8360('0x1'));function lexResult(_0x236811,_0x3850bd){return new BPromise(function(_0x3f3114,_0xe21a5){_0x236811[_0x8360('0x2')](_0x3850bd,function(_0x48d044,_0xba1f6b){if(_0x48d044){_0xe21a5(_0x48d044);}if(_0xba1f6b[_0x8360('0x3')]){for(const _0x56cebe in _0xba1f6b[_0x8360('0x3')]){if(_0xba1f6b[_0x8360('0x3')]['hasOwnProperty'](_0x56cebe)){var _0x1e7f85=_0xba1f6b['slots'][_0x56cebe];_0xba1f6b[_0x8360('0x4')+_0x56cebe]=_0x1e7f85;}}}_0x3f3114(_0xba1f6b);});});}module['exports']=function(_0x23d878,_0x414853,_0x13f83c,_0x5c5746,_0x10b59b,_0x59b1a9){var _0x5eac61=new AWS[(_0x8360('0x5'))]({'accessKeyId':_0x414853,'secretAccessKey':_0x13f83c,'region':_0x5c5746});var _0x4ced46={'botAlias':_0x8360('0x6'),'botName':_0x59b1a9,'inputText':_0x10b59b,'userId':_0x23d878};return lexResult(_0x5eac61,_0x4ced46);}; \ 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 da2db4f..d72f264 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 _0xdf28=['./lib/api','exports'];(function(_0x496739,_0xac163e){var _0x1ad9a2=function(_0x2f10c7){while(--_0x2f10c7){_0x496739['push'](_0x496739['shift']());}};_0x1ad9a2(++_0xac163e);}(_0xdf28,0x190));var _0x8df2=function(_0x469fe3,_0x1c116f){_0x469fe3=_0x469fe3-0x0;var _0x323496=_0xdf28[_0x469fe3];return _0x323496;};'use strict';var polly=require(_0x8df2('0x0'));module[_0x8df2('0x1')]=function(_0xed5227,_0x5c03fb,_0x3c38d5,_0x47fe83,_0x484313,_0x3dac16,_0x417b19){return polly(_0xed5227,_0x5c03fb,_0x3c38d5,_0x47fe83,_0x484313,_0x3dac16,_0x417b19);}; \ No newline at end of file +var _0x1cad=['./lib/api','exports'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0x1cad,0xac));var _0xd1ca=function(_0x28a65a,_0x161aea){_0x28a65a=_0x28a65a-0x0;var _0x269d7f=_0x1cad[_0x28a65a];return _0x269d7f;};'use strict';var polly=require(_0xd1ca('0x0'));module[_0xd1ca('0x1')]=function(_0x456e58,_0x2d6315,_0x36af23,_0x554768,_0x4185b5,_0x3b2d33,_0x49eb11){return polly(_0x456e58,_0x2d6315,_0x36af23,_0x554768,_0x4185b5,_0x3b2d33,_0x49eb11);}; \ 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 b366020..2f6886a 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 _0x7770=['exports','text','mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0x7770,0x92));var _0x0777=function(_0x3fc84a,_0x2ac01d){_0x3fc84a=_0x3fc84a-0x0;var _0x591c69=_0x7770[_0x3fc84a];return _0x591c69;};'use strict';var fs=require('fs');var path=require(_0x0777('0x0'));var BPromise=require(_0x0777('0x1'));var rs=require(_0x0777('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x518a4d,_0x2821ff,_0x224c02){return new BPromise(function(_0x4adcfc,_0x430be4){_0x518a4d[_0x0777('0x3')](_0x2821ff,function(_0x284b79,_0x186dfc){if(_0x284b79){_0x430be4(_0x284b79);}else if(_0x186dfc){if(_0x186dfc[_0x0777('0x4')]instanceof Buffer){fs[_0x0777('0x5')](_0x224c02,_0x186dfc[_0x0777('0x4')],function(_0x306a17){if(_0x306a17){_0x430be4(_0x306a17);}else{_0x4adcfc();}});}else{_0x430be4(new Error(_0x0777('0x6')));}}else{_0x430be4(new Error(_0x0777('0x7')));}});});}module[_0x0777('0x8')]=function(_0x436376,_0x20fc2f,_0x3ab7f9,_0x4c2d2c,_0x403b26,_0x65cd9a,_0x4ac5c4){var _0x489ab9=new AWS['Polly']({'accessKeyId':_0x436376,'secretAccessKey':_0x20fc2f,'region':_0x3ab7f9});var _0x18ddfb={'Text':_0x403b26,'TextType':_0x65cd9a||_0x0777('0x9'),'OutputFormat':_0x0777('0xa'),'VoiceId':_0x4c2d2c};return pollyResult(_0x489ab9,_0x18ddfb,_0x4ac5c4);}; \ No newline at end of file +var _0xbca7=['exports','Polly','text','mp3','randomstring','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x5e3602,_0x5e6df0){var _0x121d06=function(_0x1b06bb){while(--_0x1b06bb){_0x5e3602['push'](_0x5e3602['shift']());}};_0x121d06(++_0x5e6df0);}(_0xbca7,0x112));var _0x7bca=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xbca7[_0x4ae625];return _0x31accf;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x7bca('0x0'));var AWS=require(_0x7bca('0x1'));function pollyResult(_0x21c1c9,_0x39788e,_0x56f9ea){return new BPromise(function(_0x4196aa,_0x3948c){_0x21c1c9['synthesizeSpeech'](_0x39788e,function(_0xd866fa,_0x76850e){if(_0xd866fa){_0x3948c(_0xd866fa);}else if(_0x76850e){if(_0x76850e[_0x7bca('0x2')]instanceof Buffer){fs[_0x7bca('0x3')](_0x56f9ea,_0x76850e['AudioStream'],function(_0x5c6542){if(_0x5c6542){_0x3948c(_0x5c6542);}else{_0x4196aa();}});}else{_0x3948c(new Error(_0x7bca('0x4')));}}else{_0x3948c(new Error(_0x7bca('0x5')));}});});}module[_0x7bca('0x6')]=function(_0x5b3245,_0x2dc662,_0x36f406,_0x3e3d91,_0x548584,_0x34bf2b,_0x249013){var _0x1c21bf=new AWS[(_0x7bca('0x7'))]({'accessKeyId':_0x5b3245,'secretAccessKey':_0x2dc662,'region':_0x36f406});var _0x4f94b0={'Text':_0x548584,'TextType':_0x34bf2b||_0x7bca('0x8'),'OutputFormat':_0x7bca('0x9'),'VoiceId':_0x3e3d91};return pollyResult(_0x1c21bf,_0x4f94b0,_0x249013);}; \ 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 d8cf236..3eaccd4 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 _0x39d4=['exports','./lib/api'];(function(_0x1ba4d7,_0x5c8b17){var _0x3790e8=function(_0x2b3b4a){while(--_0x2b3b4a){_0x1ba4d7['push'](_0x1ba4d7['shift']());}};_0x3790e8(++_0x5c8b17);}(_0x39d4,0x12b));var _0x439d=function(_0xb8d78e,_0x34c3db){_0xb8d78e=_0xb8d78e-0x0;var _0x22e354=_0x39d4[_0xb8d78e];return _0x22e354;};'use strict';var asr=require(_0x439d('0x0'));module[_0x439d('0x1')]=function(_0x4b389b,_0x489cca,_0x178ff4,_0x46d6c2){return asr(_0x4b389b,_0x489cca,_0x178ff4);}; \ No newline at end of file +var _0x2266=['exports'];(function(_0x269b2c,_0x215c0d){var _0x499bbf=function(_0x58ceda){while(--_0x58ceda){_0x269b2c['push'](_0x269b2c['shift']());}};_0x499bbf(++_0x215c0d);}(_0x2266,0x160));var _0x6226=function(_0x3465b6,_0x4cb238){_0x3465b6=_0x3465b6-0x0;var _0x4aaa02=_0x2266[_0x3465b6];return _0x4aaa02;};'use strict';var asr=require('./lib/api');module[_0x6226('0x0')]=function(_0x2e47e8,_0x1ed9b2,_0x5106bb,_0x12a358){return asr(_0x2e47e8,_0x1ed9b2,_0x5106bb);}; \ 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 8d32802..0b1cb9b 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 _0x9cc5=['key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','exports','string','length'];(function(_0x28d89a,_0x4fa72e){var _0xe909d0=function(_0x59f12d){while(--_0x59f12d){_0x28d89a['push'](_0x28d89a['shift']());}};_0xe909d0(++_0x4fa72e);}(_0x9cc5,0x181));var _0x59cc=function(_0x103575,_0x3c92b2){_0x103575=_0x103575-0x0;var _0x23b27a=_0x9cc5[_0x103575];return _0x23b27a;};'use strict';var url=require(_0x59cc('0x0'));var BPromise=require(_0x59cc('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x59cc('0x2')]=function(_0x12ec32,_0x2db8a9,_0x1c32b6){return new BPromise(function(_0x2f9278,_0x4932c6){var _0x2d1214;if(typeof _0x12ec32!==_0x59cc('0x3')||_0x12ec32['length']===0x0){return _0x4932c6('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x2db8a9!==_0x59cc('0x3')||_0x2db8a9[_0x59cc('0x4')]===0x0){return _0x4932c6(_0x59cc('0x5'));}if(typeof _0x1c32b6!==_0x59cc('0x6')&&(typeof _0x1c32b6!=='string'||_0x1c32b6['length']===0x0)){return _0x4932c6('lang\x20should\x20be\x20a\x20string');}try{_0x2d1214=fs[_0x59cc('0x7')](_0x12ec32)[_0x59cc('0x8')](_0x59cc('0x9'));}catch(_0x436faa){return _0x4932c6(_0x436faa);}return _0x2f9278({'method':'POST','uri':host+_0x59cc('0xa')+_0x2db8a9,'body':{'config':{'encoding':_0x59cc('0xb'),'sampleRateHertz':_0x59cc('0xc'),'languageCode':_0x1c32b6},'audio':{'content':_0x2d1214}},'json':!![]});});}; \ No newline at end of file +var _0xfa89=['LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa89,0x106));var _0x9fa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa89[_0x3dd15e];return _0x231fd0;};'use strict';var url=require('url');var BPromise=require(_0x9fa8('0x0'));var fs=require('fs');var host=_0x9fa8('0x1');module[_0x9fa8('0x2')]=function(_0x2c8d87,_0x4b00ea,_0x312f41){return new BPromise(function(_0x2b9034,_0x575844){var _0x404fe5;if(typeof _0x2c8d87!==_0x9fa8('0x3')||_0x2c8d87['length']===0x0){return _0x575844('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x4b00ea!==_0x9fa8('0x3')||_0x4b00ea[_0x9fa8('0x4')]===0x0){return _0x575844(_0x9fa8('0x5'));}if(typeof _0x312f41!==_0x9fa8('0x6')&&(typeof _0x312f41!==_0x9fa8('0x3')||_0x312f41[_0x9fa8('0x4')]===0x0)){return _0x575844(_0x9fa8('0x7'));}try{_0x404fe5=fs['readFileSync'](_0x2c8d87)[_0x9fa8('0x8')](_0x9fa8('0x9'));}catch(_0x3892cb){return _0x575844(_0x3892cb);}return _0x2b9034({'method':_0x9fa8('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x4b00ea,'body':{'config':{'encoding':_0x9fa8('0xb'),'sampleRateHertz':_0x9fa8('0xc'),'languageCode':_0x312f41},'audio':{'content':_0x404fe5}},'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 1245496..86a033d 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 _0x17bb=['./asr','exports'];(function(_0x12bee7,_0x1d7e65){var _0x2da2db=function(_0x14f2c1){while(--_0x14f2c1){_0x12bee7['push'](_0x12bee7['shift']());}};_0x2da2db(++_0x1d7e65);}(_0x17bb,0x188));var _0xb17b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x17bb[_0x4b369d];return _0x571a98;};var asr=require(_0xb17b('0x0'));module[_0xb17b('0x1')]={'asr':asr}; \ No newline at end of file +var _0xc7ec=['./asr','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7ec,0x164));var _0xcc7e=function(_0x131fe7,_0x21fcdb){_0x131fe7=_0x131fe7-0x0;var _0x2eddf3=_0xc7ec[_0x131fe7];return _0x2eddf3;};var asr=require(_0xcc7e('0x0'));module[_0xcc7e('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 b2752d3..918e4a0 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 _0x276e=['./aws','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','WHAT_EVER','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','end','protocol','host','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','audioContent','writeFile','chmodSync','googleTTS','goggleTTS\x20path','googleASR','asr','results','alternatives','transcript','map','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','speech','status','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','stringify','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','path','http','https','url','parse','request-promise','util','querystring','apiai-promise','md5'];(function(_0x4a567e,_0x458966){var _0x42666b=function(_0x2434e3){while(--_0x2434e3){_0x4a567e['push'](_0x4a567e['shift']());}};_0x42666b(++_0x458966);}(_0x276e,0xd0));var _0xe276=function(_0x2ac5f8,_0x4c3a9f){_0x2ac5f8=_0x2ac5f8-0x0;var _0x3b8229=_0x276e[_0x2ac5f8];return _0x3b8229;};'use strict';var fs=require('fs');var path=require(_0xe276('0x0'));var http=require(_0xe276('0x1'));var https=require(_0xe276('0x2'));var urlParse=require(_0xe276('0x3'))[_0xe276('0x4')];var BPromise=require('bluebird');var rs=require('randomstring');var sox=require('sox');var rp=require(_0xe276('0x5'));var util=require(_0xe276('0x6'));var querystring=require(_0xe276('0x7'));var tts=require('google-tts-api');var apiai=require(_0xe276('0x8'));var md5=require(_0xe276('0x9'));var google=require('./google');var aws=require(_0xe276('0xa'));var tilde=require('./tilde');var sestek=require(_0xe276('0xb'));var logger=require(_0xe276('0xc'))(_0xe276('0xd'));var ISPEECH_API=_0xe276('0xe');function downloadFile(_0xb97124,_0x556010){return new BPromise(function(_0x1480cd,_0xdfe7d8){var _0x57128b=urlParse(_0xb97124);var _0x1995f9=_0x57128b['protocol']===_0xe276('0xf')?https:http;var _0x4831da={'host':_0x57128b['host'],'path':_0x57128b['path'],'headers':{'user-agent':_0xe276('0x10')}};_0x1995f9['get'](_0x4831da,function(_0x4dd5f3){if(_0x4dd5f3['statusCode']!==0xc8){logger[_0xe276('0x11')](_0xe276('0x12')+_0xb97124+_0xe276('0x13')+_0x4dd5f3[_0xe276('0x14')]+'\x20('+_0x4dd5f3[_0xe276('0x15')]+')');_0xdfe7d8(new Error('request\x20to\x20'+_0xb97124+_0xe276('0x13')+_0x4dd5f3[_0xe276('0x14')]+'\x20('+_0x4dd5f3['statusMessage']+')'));return;}var _0x4a8fe6=fs[_0xe276('0x16')](_0x556010);_0x4a8fe6['on'](_0xe276('0x17'),function(){logger[_0xe276('0x18')](_0xe276('0x19'));_0x4a8fe6[_0xe276('0x1a')](_0x1480cd);});_0x4a8fe6['on']('error',function(_0x222d00){fs[_0xe276('0x1b')](_0x556010);logger[_0xe276('0x11')](_0xe276('0x1c'),_0x222d00);_0xdfe7d8(_0x222d00);});_0x4dd5f3['pipe'](_0x4a8fe6);})['on']('error',function(_0x430048){logger['error'](_0x430048);_0xdfe7d8(_0x430048);})[_0xe276('0x1d')]();});}function uploadFile(_0x983047){return new BPromise(function(_0x5745ff,_0x12660b){var _0x4dac98=urlParse(_0x983047);var _0x1b77e1=_0x4dac98[_0xe276('0x1e')]===_0xe276('0xf')?https:http;var _0x4b43a8={'host':_0x4dac98[_0xe276('0x1f')],'path':_0x4dac98['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x1b77e1['get'](_0x4b43a8,function(_0x38286f){if(_0x38286f[_0xe276('0x14')]!==0xc8){_0x12660b(new Error(_0xe276('0x12')+_0x983047+_0xe276('0x13')+_0x38286f[_0xe276('0x14')]+'\x20('+_0x38286f[_0xe276('0x15')]+')'));return;}var _0x2b39ae='';_0x38286f['on']('data',function(_0x319569){_0x2b39ae+=_0x319569;});_0x38286f['on']('end',function(){_0x5745ff(_0x2b39ae);});})['on'](_0xe276('0x11'),function(_0x46be40){_0x12660b(_0x46be40);})['end']();});}function convertFile(_0xb58b3c,_0x5108fd){return new BPromise(function(_0x52e5a8,_0x2b8a63){var _0x4d6e5b=sox[_0xe276('0x20')](_0xb58b3c,_0x5108fd,{'sampleRate':0x1f40,'format':_0xe276('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4d6e5b['on'](_0xe276('0x11'),function(_0x5c1070){logger[_0xe276('0x11')](_0xe276('0x22'),_0x5c1070);_0x2b8a63(_0x5c1070);});_0x4d6e5b['on'](_0xe276('0x1d'),function(){logger['info'](_0xe276('0x23'));_0x52e5a8();});_0x4d6e5b[_0xe276('0x24')]();});}function base64Decode(_0x1d5858,_0x36248a){var _0x43089e=path[_0xe276('0x25')](__dirname,_0xe276('0x26'),rs[_0xe276('0x27')](0x4)+_0xe276('0x28'));fs[_0xe276('0x29')](_0x43089e,_0x1d5858,_0xe276('0x2a'));return convertFile(_0x43089e,_0x36248a)[_0xe276('0x2b')](function(){try{fs[_0xe276('0x1b')](_0x43089e);fs['chmodSync'](_0x36248a,_0xe276('0x2c'));}catch(_0x128350){logger[_0xe276('0x11')](_0x128350);}return _0x36248a[_0xe276('0x2d')]('.')[0x0];});}function base64Encode(_0x425351){var _0x81f1c8=fs[_0xe276('0x2e')](_0x425351);return new Buffer(_0x81f1c8)[_0xe276('0x2f')](_0xe276('0x2a'));}exports['googleCloudTTS']=function(_0x5c8fe3,_0x111d07,_0x221a44,_0x4ab765,_0x1eca74,_0x564a2b){var _0x301eb6,_0x515421;var _0x16e7de=_0xe276('0x30');var _0x34ce06=_0xe276('0x31')+_0x5c8fe3;var _0x15a053={};if(_0x111d07==='ssml'){_0x15a053[_0xe276('0x32')]={'ssml':_0x221a44};}else{_0x15a053[_0xe276('0x32')]={'text':_0x221a44};};_0x15a053[_0xe276('0x33')]={'languageCode':_0x4ab765,'ssmlGender':_0x1eca74};_0x15a053[_0xe276('0x34')]={'audioEncoding':_0xe276('0x35'),'sampleRateHertz':0x1f40};var _0x4e8440={'url':_0x16e7de+_0xe276('0x36')+_0x34ce06,'method':_0xe276('0x37'),'json':!![],'body':_0x15a053};return rp(_0x4e8440)[_0xe276('0x2b')](function(_0x3ee517){return new BPromise(function(_0x203b9d,_0x157300){_0x301eb6=path[_0xe276('0x25')](__dirname,_0xe276('0x26'),rs['generate'](0x4)+_0xe276('0x38'));var _0x3b420e=Buffer['from'](_0x3ee517[_0xe276('0x39')],'base64');return fs[_0xe276('0x3a')](_0x301eb6,_0x3b420e,function(_0x1c6cb2){_0x157300(_0x1c6cb2);},function(_0x9415cb){fs[_0xe276('0x3b')](_0x301eb6,_0xe276('0x2c'));_0x203b9d(_0x9415cb);});});})[_0xe276('0x2b')](function(_0x4799cf){_0x515421=path[_0xe276('0x25')](__dirname,_0xe276('0x26'),rs['generate'](0x4)+_0xe276('0x28'));return convertFile(_0x301eb6,_0x515421);})[_0xe276('0x2b')](function(){try{fs[_0xe276('0x1b')](_0x301eb6);fs['chmodSync'](_0x515421,_0xe276('0x2c'));}catch(_0x314d28){logger[_0xe276('0x11')](_0x314d28);}logger[_0xe276('0x18')]('googleCloudTTS\x20path',_0x515421[_0xe276('0x2d')]('.')[0x0]);return _0x515421[_0xe276('0x2d')]('.')[0x0];});};exports[_0xe276('0x3c')]=function(_0x4854de,_0x49a99c){var _0x32d4c3,_0x527ba0;return tts(_0x4854de,_0x49a99c||'en',0x1)['then'](function(_0x5cce92){logger[_0xe276('0x18')](_0x5cce92);_0x32d4c3=path[_0xe276('0x25')](__dirname,_0xe276('0x26'),rs[_0xe276('0x27')](0x4)+'.mp3');return downloadFile(_0x5cce92,_0x32d4c3);})[_0xe276('0x2b')](function(){_0x527ba0=path[_0xe276('0x25')](__dirname,'tmp',rs[_0xe276('0x27')](0x4)+'.wav');return convertFile(_0x32d4c3,_0x527ba0);})[_0xe276('0x2b')](function(){try{fs[_0xe276('0x1b')](_0x32d4c3);fs[_0xe276('0x3b')](_0x527ba0,_0xe276('0x2c'));}catch(_0x1cdb99){logger[_0xe276('0x11')](_0x1cdb99);}logger[_0xe276('0x18')](_0xe276('0x3d'),_0x527ba0[_0xe276('0x2d')]('.')[0x0]);return _0x527ba0[_0xe276('0x2d')]('.')[0x0];});};exports[_0xe276('0x3e')]=function(_0x363125,_0x4ac4f6,_0xcf8279){return google[_0xe276('0x3f')](_0x363125,_0x4ac4f6,_0xcf8279)[_0xe276('0x2b')](function(_0x426d7e){logger['info'](_0x426d7e['uri']);return rp(_0x426d7e);})[_0xe276('0x2b')](function(_0xcab0ea){var _0x3b0a47='';var _0x4c289b=0x0;try{fs[_0xe276('0x1b')](_0x363125);}catch(_0x460afa){logger[_0xe276('0x11')](_0x460afa);}if(_0xcab0ea&&_0xcab0ea[_0xe276('0x40')]){_0x3b0a47=_0xcab0ea[_0xe276('0x40')]['map'](function(_0x141428){return _0x141428&&_0x141428[_0xe276('0x41')][0x0]&&_0x141428['alternatives'][0x0]['transcript']?_0x141428[_0xe276('0x41')][0x0][_0xe276('0x42')]:'';})['join']('\x0a');_0x4c289b=_0xcab0ea[_0xe276('0x40')][_0xe276('0x43')](function(_0x2606c4){return _0x2606c4&&_0x2606c4[_0xe276('0x41')][0x0]&&_0x2606c4[_0xe276('0x41')][0x0][_0xe276('0x44')]?_0x2606c4['alternatives'][0x0][_0xe276('0x44')]:0x0;})[_0xe276('0x45')]('\x0a');}logger[_0xe276('0x18')](_0xe276('0x46'),_0x3b0a47);logger['info'](_0xe276('0x47'),_0x4c289b);return{'transcript':_0x3b0a47,'confidence':_0x4c289b};})[_0xe276('0x48')](function(_0x374ef9){logger[_0xe276('0x11')](_0xe276('0x49'),_0x374ef9[_0xe276('0x14')],_0x374ef9[_0xe276('0x4a')],_0x374ef9[_0xe276('0x4b')]);});};exports[_0xe276('0x4c')]=function(_0x2836d4,_0x312548,_0x3e0ad6,_0x438b75){var _0x121a71=apiai(_0x312548,{'language':_0x438b75||'en'});return _0x121a71[_0xe276('0x4d')](_0x3e0ad6,{'sessionId':md5(_0x2836d4)})[_0xe276('0x2b')](function(_0x49ec18){logger[_0xe276('0x18')](JSON['stringify'](_0x49ec18));return{'source':_0x49ec18['result']['source'],'resolvedQuery':_0x49ec18[_0xe276('0x4e')][_0xe276('0x4f')],'action':_0x49ec18[_0xe276('0x4e')][_0xe276('0x50')],'actionIncomplete':_0x49ec18['result'][_0xe276('0x51')],'speech':_0x49ec18['result']['fulfillment'][_0xe276('0x52')],'score':_0x49ec18[_0xe276('0x4e')]['score'],'statusCode':_0x49ec18[_0xe276('0x53')][_0xe276('0x54')],'endConversation':_0x49ec18[_0xe276('0x4e')][_0xe276('0x55')][_0xe276('0x56')]||![],'isFallbackIntent':_0x49ec18[_0xe276('0x4e')][_0xe276('0x55')][_0xe276('0x57')]};});};exports[_0xe276('0x58')]=function(_0x15c435,_0x414091,_0x3ecfe6,_0x25fe09){return tilde[_0xe276('0x3f')](_0x15c435,_0x414091,_0x3ecfe6,_0x25fe09)[_0xe276('0x2b')](function(_0x3af379){try{fs[_0xe276('0x1b')](_0x15c435);}catch(_0x40b796){logger[_0xe276('0x11')](_0x40b796);}logger[_0xe276('0x18')](_0xe276('0x59'),_0x3af379[_0xe276('0x42')]);logger[_0xe276('0x18')](_0xe276('0x5a'),_0x3af379[_0xe276('0x44')]);return _0x3af379;});};exports[_0xe276('0x5b')]=function(_0x1158c0,_0x10e95b,_0x5343ae,_0x45ec75,_0x10eeaf,_0xeb60ca){var _0x4f021e=path['resolve'](__dirname,_0xe276('0x26'),rs[_0xe276('0x27')](0x4)+_0xe276('0x38'));var _0x54d27d;return aws[_0xe276('0x5c')](_0x1158c0,_0x10e95b,_0x5343ae,_0x45ec75,_0x10eeaf,_0xeb60ca,_0x4f021e)[_0xe276('0x2b')](function(){_0x54d27d=path[_0xe276('0x25')](__dirname,_0xe276('0x26'),rs[_0xe276('0x27')](0x4)+_0xe276('0x28'));return convertFile(_0x4f021e,_0x54d27d);})['then'](function(){try{fs[_0xe276('0x1b')](_0x4f021e);fs[_0xe276('0x3b')](_0x54d27d,_0xe276('0x2c'));}catch(_0x1bea76){logger[_0xe276('0x11')](_0x1bea76);}return _0x54d27d[_0xe276('0x2d')]('.')[0x0];});};exports[_0xe276('0x5d')]=function(_0x1c2cd4,_0x5da13f,_0x187706,_0x12b366,_0x36eac0,_0x65ff6f){return aws['lex'](_0x1c2cd4,_0x5da13f,_0x187706,_0x12b366,_0x36eac0,_0x65ff6f)[_0xe276('0x2b')](function(_0x2f695b){logger['info'](JSON[_0xe276('0x5e')](_0x2f695b));return _0x2f695b;});};exports['ispeechTTS']=function(_0xf62c2e,_0x21fb58,_0x10d5dd,_0x21c22f){var _0x49baa5=util['format'](_0xe276('0x5f'),ISPEECH_API,_0xf62c2e,encodeURIComponent(_0x21fb58),_0x10d5dd,_0x21c22f);var _0x2a26f9=path[_0xe276('0x25')](__dirname,_0xe276('0x26'),rs[_0xe276('0x27')](0x4)+_0xe276('0x38'));var _0x480856;return downloadFile(_0x49baa5,_0x2a26f9)[_0xe276('0x2b')](function(){_0x480856=path['resolve'](__dirname,_0xe276('0x26'),rs['generate'](0x4)+_0xe276('0x28'));return convertFile(_0x2a26f9,_0x480856);})[_0xe276('0x2b')](function(){try{fs[_0xe276('0x1b')](_0x2a26f9);fs[_0xe276('0x3b')](_0x480856,_0xe276('0x2c'));}catch(_0x45b67f){logger['error'](_0x45b67f);}return _0x480856['split']('.')[0x0];});};exports[_0xe276('0x60')]=function(_0x112159,_0x47275a,_0x203c5b,_0x6ae989){var _0x428d72=util[_0xe276('0x61')](_0xe276('0x62'),ISPEECH_API,_0x47275a,_0x203c5b,base64Encode(_0x112159),_0x6ae989?util['format'](_0xe276('0x63'),encodeURIComponent(_0x6ae989)):_0xe276('0x64'));return uploadFile(_0x428d72)['then'](function(_0x3a8d1d){return querystring['parse'](_0x3a8d1d);});};exports[_0xe276('0x65')]=function(_0x12aad0,_0x57521b){return sestek[_0xe276('0x66')](_0x12aad0,_0x57521b)['then'](function(_0x37b026){logger[_0xe276('0x18')](JSON[_0xe276('0x5e')](_0x37b026));var _0x1d81df={'speech':_0x37b026[_0xe276('0x67')],'action':_0x37b026[_0xe276('0x68')]?_0x37b026[_0xe276('0x68')][_0xe276('0x69')]:undefined,'actiondata':_0x37b026[_0xe276('0x68')]?_0x37b026[_0xe276('0x68')]['CustomActionData']:undefined};if(_0x37b026[_0xe276('0x68')]&&_0x37b026[_0xe276('0x68')]['AudioFromTts']){return base64Decode(_0x37b026[_0xe276('0x68')][_0xe276('0x6a')][_0xe276('0x6b')],path[_0xe276('0x25')](__dirname,_0xe276('0x26'),rs[_0xe276('0x27')](0x4)+_0xe276('0x28')))[_0xe276('0x2b')](function(_0x23406b){_0x1d81df[_0xe276('0x6c')]=_0x23406b;return _0x1d81df;});}return _0x1d81df;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x1854=['request\x20to\x20','finish','info','close','unlink','download\x20error','https:','\x20failed,\x20status\x20code\x20=\x20','data','end','transcode','error\x20convert','start','resolve','tmp','generate','chmodSync','777','readFileSync','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','then','.mp3','audioContent','writeFile','.wav','googleCloudTTS\x20path','split','googleTTS','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','actionIncomplete','speech','score','code','endConversation','isFallbackIntent','tildeASR','awsPolly','lex','stringify','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','path','http','https','url','parse','randomstring','sox','request-promise','util','querystring','google-tts-api','apiai-promise','./google','./aws','./tilde','./sestek','../../../config/logger','agi','protocol','host','WHAT_EVER','get','statusCode','error','statusMessage'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x1854,0x113));var _0x4185=function(_0x42f3a5,_0x3a4470){_0x42f3a5=_0x42f3a5-0x0;var _0x1a7d74=_0x1854[_0x42f3a5];return _0x1a7d74;};'use strict';var fs=require('fs');var path=require(_0x4185('0x0'));var http=require(_0x4185('0x1'));var https=require(_0x4185('0x2'));var urlParse=require(_0x4185('0x3'))[_0x4185('0x4')];var BPromise=require('bluebird');var rs=require(_0x4185('0x5'));var sox=require(_0x4185('0x6'));var rp=require(_0x4185('0x7'));var util=require(_0x4185('0x8'));var querystring=require(_0x4185('0x9'));var tts=require(_0x4185('0xa'));var apiai=require(_0x4185('0xb'));var md5=require('md5');var google=require(_0x4185('0xc'));var aws=require(_0x4185('0xd'));var tilde=require(_0x4185('0xe'));var sestek=require(_0x4185('0xf'));var logger=require(_0x4185('0x10'))(_0x4185('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x548153,_0x471536){return new BPromise(function(_0x3cd83c,_0x1aa259){var _0x3620d0=urlParse(_0x548153);var _0x4565f2=_0x3620d0[_0x4185('0x12')]==='https:'?https:http;var _0x318571={'host':_0x3620d0[_0x4185('0x13')],'path':_0x3620d0[_0x4185('0x0')],'headers':{'user-agent':_0x4185('0x14')}};_0x4565f2[_0x4185('0x15')](_0x318571,function(_0x1b03b5){if(_0x1b03b5[_0x4185('0x16')]!==0xc8){logger[_0x4185('0x17')]('request\x20to\x20'+_0x548153+'\x20failed,\x20status\x20code\x20=\x20'+_0x1b03b5[_0x4185('0x16')]+'\x20('+_0x1b03b5[_0x4185('0x18')]+')');_0x1aa259(new Error(_0x4185('0x19')+_0x548153+'\x20failed,\x20status\x20code\x20=\x20'+_0x1b03b5['statusCode']+'\x20('+_0x1b03b5[_0x4185('0x18')]+')'));return;}var _0x11c8b8=fs['createWriteStream'](_0x471536);_0x11c8b8['on'](_0x4185('0x1a'),function(){logger[_0x4185('0x1b')]('finish\x20download\x20file');_0x11c8b8[_0x4185('0x1c')](_0x3cd83c);});_0x11c8b8['on'](_0x4185('0x17'),function(_0x143f31){fs[_0x4185('0x1d')](_0x471536);logger[_0x4185('0x17')](_0x4185('0x1e'),_0x143f31);_0x1aa259(_0x143f31);});_0x1b03b5['pipe'](_0x11c8b8);})['on']('error',function(_0x1f4a88){logger['error'](_0x1f4a88);_0x1aa259(_0x1f4a88);})['end']();});}function uploadFile(_0x359370){return new BPromise(function(_0x1f2fb9,_0x20e444){var _0x523628=urlParse(_0x359370);var _0x13244e=_0x523628[_0x4185('0x12')]===_0x4185('0x1f')?https:http;var _0x2bd26e={'host':_0x523628[_0x4185('0x13')],'path':_0x523628[_0x4185('0x0')],'headers':{'user-agent':_0x4185('0x14')}};_0x13244e['get'](_0x2bd26e,function(_0x56d6a6){if(_0x56d6a6[_0x4185('0x16')]!==0xc8){_0x20e444(new Error(_0x4185('0x19')+_0x359370+_0x4185('0x20')+_0x56d6a6['statusCode']+'\x20('+_0x56d6a6[_0x4185('0x18')]+')'));return;}var _0x5aece1='';_0x56d6a6['on'](_0x4185('0x21'),function(_0x44f5bb){_0x5aece1+=_0x44f5bb;});_0x56d6a6['on'](_0x4185('0x22'),function(){_0x1f2fb9(_0x5aece1);});})['on'](_0x4185('0x17'),function(_0x5fc268){_0x20e444(_0x5fc268);})[_0x4185('0x22')]();});}function convertFile(_0x148e88,_0x1c4d16){return new BPromise(function(_0xdd7505,_0x11ff1d){var _0x7714c0=sox[_0x4185('0x23')](_0x148e88,_0x1c4d16,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x7714c0['on']('error',function(_0x5a9d0c){logger['error'](_0x4185('0x24'),_0x5a9d0c);_0x11ff1d(_0x5a9d0c);});_0x7714c0['on'](_0x4185('0x22'),function(){logger[_0x4185('0x1b')]('finish\x20to\x20convert');_0xdd7505();});_0x7714c0[_0x4185('0x25')]();});}function base64Decode(_0x370542,_0x443781){var _0x38ad41=path[_0x4185('0x26')](__dirname,_0x4185('0x27'),rs[_0x4185('0x28')](0x4)+'.wav');fs['writeFileSync'](_0x38ad41,_0x370542,'base64');return convertFile(_0x38ad41,_0x443781)['then'](function(){try{fs['unlink'](_0x38ad41);fs[_0x4185('0x29')](_0x443781,_0x4185('0x2a'));}catch(_0xea1c15){logger[_0x4185('0x17')](_0xea1c15);}return _0x443781['split']('.')[0x0];});}function base64Encode(_0x438e3c){var _0x5049cb=fs[_0x4185('0x2b')](_0x438e3c);return new Buffer(_0x5049cb)['toString'](_0x4185('0x2c'));}exports[_0x4185('0x2d')]=function(_0x1fda7d,_0x13ee42,_0x54e4d4,_0x52a9f4,_0x58ea5c,_0x1dd467){var _0x5dd04b,_0x2b3b17;var _0x5046d8=_0x4185('0x2e');var _0x238e53=_0x4185('0x2f')+_0x1fda7d;var _0x39882b={};if(_0x13ee42==='ssml'){_0x39882b[_0x4185('0x30')]={'ssml':_0x54e4d4};}else{_0x39882b[_0x4185('0x30')]={'text':_0x54e4d4};};_0x39882b[_0x4185('0x31')]={'languageCode':_0x52a9f4,'ssmlGender':_0x58ea5c};_0x39882b[_0x4185('0x32')]={'audioEncoding':_0x4185('0x33'),'sampleRateHertz':0x1f40};var _0x581bf8={'url':_0x5046d8+_0x4185('0x34')+_0x238e53,'method':'POST','json':!![],'body':_0x39882b};return rp(_0x581bf8)[_0x4185('0x35')](function(_0x26f45f){return new BPromise(function(_0x45a980,_0x1315e9){_0x5dd04b=path[_0x4185('0x26')](__dirname,'tmp',rs['generate'](0x4)+_0x4185('0x36'));var _0x942acf=Buffer['from'](_0x26f45f[_0x4185('0x37')],_0x4185('0x2c'));return fs[_0x4185('0x38')](_0x5dd04b,_0x942acf,function(_0x3f8094){_0x1315e9(_0x3f8094);},function(_0x5c1b7f){fs['chmodSync'](_0x5dd04b,'777');_0x45a980(_0x5c1b7f);});});})[_0x4185('0x35')](function(_0x1a90b0){_0x2b3b17=path[_0x4185('0x26')](__dirname,_0x4185('0x27'),rs[_0x4185('0x28')](0x4)+_0x4185('0x39'));return convertFile(_0x5dd04b,_0x2b3b17);})['then'](function(){try{fs[_0x4185('0x1d')](_0x5dd04b);fs[_0x4185('0x29')](_0x2b3b17,_0x4185('0x2a'));}catch(_0x4c2a56){logger[_0x4185('0x17')](_0x4c2a56);}logger['info'](_0x4185('0x3a'),_0x2b3b17['split']('.')[0x0]);return _0x2b3b17[_0x4185('0x3b')]('.')[0x0];});};exports[_0x4185('0x3c')]=function(_0x53cc63,_0x951b9c){var _0x1369f3,_0x5a4299;return tts(_0x53cc63,_0x951b9c||'en',0x1)[_0x4185('0x35')](function(_0x584f74){logger[_0x4185('0x1b')](_0x584f74);_0x1369f3=path[_0x4185('0x26')](__dirname,_0x4185('0x27'),rs['generate'](0x4)+_0x4185('0x36'));return downloadFile(_0x584f74,_0x1369f3);})[_0x4185('0x35')](function(){_0x5a4299=path[_0x4185('0x26')](__dirname,_0x4185('0x27'),rs[_0x4185('0x28')](0x4)+_0x4185('0x39'));return convertFile(_0x1369f3,_0x5a4299);})[_0x4185('0x35')](function(){try{fs[_0x4185('0x1d')](_0x1369f3);fs[_0x4185('0x29')](_0x5a4299,_0x4185('0x2a'));}catch(_0xb86956){logger[_0x4185('0x17')](_0xb86956);}logger[_0x4185('0x1b')](_0x4185('0x3d'),_0x5a4299[_0x4185('0x3b')]('.')[0x0]);return _0x5a4299[_0x4185('0x3b')]('.')[0x0];});};exports[_0x4185('0x3e')]=function(_0x283196,_0x5d6a05,_0x24ec87){return google[_0x4185('0x3f')](_0x283196,_0x5d6a05,_0x24ec87)[_0x4185('0x35')](function(_0x3818a6){logger[_0x4185('0x1b')](_0x3818a6[_0x4185('0x40')]);return rp(_0x3818a6);})[_0x4185('0x35')](function(_0x50e25c){var _0x577d52='';var _0x5589c1=0x0;try{fs[_0x4185('0x1d')](_0x283196);}catch(_0x539b4d){logger['error'](_0x539b4d);}if(_0x50e25c&&_0x50e25c[_0x4185('0x41')]){_0x577d52=_0x50e25c['results'][_0x4185('0x42')](function(_0x3ab2bd){return _0x3ab2bd&&_0x3ab2bd['alternatives'][0x0]&&_0x3ab2bd[_0x4185('0x43')][0x0]['transcript']?_0x3ab2bd['alternatives'][0x0][_0x4185('0x44')]:'';})['join']('\x0a');_0x5589c1=_0x50e25c[_0x4185('0x41')][_0x4185('0x42')](function(_0x3a7b7e){return _0x3a7b7e&&_0x3a7b7e[_0x4185('0x43')][0x0]&&_0x3a7b7e[_0x4185('0x43')][0x0][_0x4185('0x45')]?_0x3a7b7e[_0x4185('0x43')][0x0][_0x4185('0x45')]:0x0;})['join']('\x0a');}logger[_0x4185('0x1b')](_0x4185('0x46'),_0x577d52);logger[_0x4185('0x1b')](_0x4185('0x47'),_0x5589c1);return{'transcript':_0x577d52,'confidence':_0x5589c1};})[_0x4185('0x48')](function(_0x316fa1){logger[_0x4185('0x17')](_0x4185('0x49'),_0x316fa1[_0x4185('0x16')],_0x316fa1['name'],_0x316fa1[_0x4185('0x4a')]);});};exports[_0x4185('0x4b')]=function(_0x1ad768,_0x4f6f16,_0xc266b3,_0x173cc3){var _0x473071=apiai(_0x4f6f16,{'language':_0x173cc3||'en'});return _0x473071[_0x4185('0x4c')](_0xc266b3,{'sessionId':md5(_0x1ad768)})[_0x4185('0x35')](function(_0x47fb35){logger[_0x4185('0x1b')](JSON['stringify'](_0x47fb35));return{'source':_0x47fb35[_0x4185('0x4d')][_0x4185('0x4e')],'resolvedQuery':_0x47fb35['result']['resolvedQuery'],'action':_0x47fb35[_0x4185('0x4d')]['action'],'actionIncomplete':_0x47fb35['result'][_0x4185('0x4f')],'speech':_0x47fb35[_0x4185('0x4d')]['fulfillment'][_0x4185('0x50')],'score':_0x47fb35[_0x4185('0x4d')][_0x4185('0x51')],'statusCode':_0x47fb35['status'][_0x4185('0x52')],'endConversation':_0x47fb35[_0x4185('0x4d')]['metadata'][_0x4185('0x53')]||![],'isFallbackIntent':_0x47fb35[_0x4185('0x4d')]['metadata'][_0x4185('0x54')]};});};exports[_0x4185('0x55')]=function(_0x20b650,_0x2640c8,_0x4a355f,_0x52e2d8){return tilde[_0x4185('0x3f')](_0x20b650,_0x2640c8,_0x4a355f,_0x52e2d8)['then'](function(_0x1059a8){try{fs[_0x4185('0x1d')](_0x20b650);}catch(_0x47cddb){logger[_0x4185('0x17')](_0x47cddb);}logger[_0x4185('0x1b')]('Tilde\x20ASR\x20transcription',_0x1059a8[_0x4185('0x44')]);logger['info']('Tilde\x20ASR\x20confidence',_0x1059a8[_0x4185('0x45')]);return _0x1059a8;});};exports[_0x4185('0x56')]=function(_0x4b7200,_0x532331,_0x2387dd,_0x2085c3,_0x5529a6,_0x5c727f){var _0x2273f6=path[_0x4185('0x26')](__dirname,_0x4185('0x27'),rs[_0x4185('0x28')](0x4)+_0x4185('0x36'));var _0xb75762;return aws['polly'](_0x4b7200,_0x532331,_0x2387dd,_0x2085c3,_0x5529a6,_0x5c727f,_0x2273f6)[_0x4185('0x35')](function(){_0xb75762=path['resolve'](__dirname,_0x4185('0x27'),rs['generate'](0x4)+_0x4185('0x39'));return convertFile(_0x2273f6,_0xb75762);})['then'](function(){try{fs[_0x4185('0x1d')](_0x2273f6);fs[_0x4185('0x29')](_0xb75762,'777');}catch(_0x1049af){logger[_0x4185('0x17')](_0x1049af);}return _0xb75762[_0x4185('0x3b')]('.')[0x0];});};exports['awsLex']=function(_0xdf15d5,_0xc00cb2,_0x292ce5,_0x39fe79,_0xd92870,_0x12cd86){return aws[_0x4185('0x57')](_0xdf15d5,_0xc00cb2,_0x292ce5,_0x39fe79,_0xd92870,_0x12cd86)[_0x4185('0x35')](function(_0x1e3a62){logger['info'](JSON[_0x4185('0x58')](_0x1e3a62));return _0x1e3a62;});};exports['ispeechTTS']=function(_0x2609d8,_0x41727b,_0xbb1ee9,_0x5e042e){var _0x253fe2=util[_0x4185('0x59')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x2609d8,encodeURIComponent(_0x41727b),_0xbb1ee9,_0x5e042e);var _0xca0905=path[_0x4185('0x26')](__dirname,'tmp',rs[_0x4185('0x28')](0x4)+_0x4185('0x36'));var _0x5bca2d;return downloadFile(_0x253fe2,_0xca0905)['then'](function(){_0x5bca2d=path[_0x4185('0x26')](__dirname,'tmp',rs[_0x4185('0x28')](0x4)+_0x4185('0x39'));return convertFile(_0xca0905,_0x5bca2d);})['then'](function(){try{fs[_0x4185('0x1d')](_0xca0905);fs[_0x4185('0x29')](_0x5bca2d,_0x4185('0x2a'));}catch(_0x46ee03){logger[_0x4185('0x17')](_0x46ee03);}return _0x5bca2d[_0x4185('0x3b')]('.')[0x0];});};exports[_0x4185('0x5a')]=function(_0x4603e5,_0x5893fd,_0x192957,_0x5d99e6){var _0x3b130e=util[_0x4185('0x59')](_0x4185('0x5b'),ISPEECH_API,_0x5893fd,_0x192957,base64Encode(_0x4603e5),_0x5d99e6?util[_0x4185('0x59')](_0x4185('0x5c'),encodeURIComponent(_0x5d99e6)):'freeform=3');return uploadFile(_0x3b130e)[_0x4185('0x35')](function(_0x11fd43){return querystring[_0x4185('0x4')](_0x11fd43);});};exports[_0x4185('0x5d')]=function(_0x11ac5f,_0x17f210){return sestek[_0x4185('0x5e')](_0x11ac5f,_0x17f210)['then'](function(_0x2a2ba7){logger[_0x4185('0x1b')](JSON[_0x4185('0x58')](_0x2a2ba7));var _0x65f25e={'speech':_0x2a2ba7[_0x4185('0x5f')],'action':_0x2a2ba7[_0x4185('0x60')]?_0x2a2ba7[_0x4185('0x60')][_0x4185('0x61')]:undefined,'actiondata':_0x2a2ba7[_0x4185('0x60')]?_0x2a2ba7['channelData'][_0x4185('0x62')]:undefined};if(_0x2a2ba7['channelData']&&_0x2a2ba7[_0x4185('0x60')][_0x4185('0x63')]){return base64Decode(_0x2a2ba7[_0x4185('0x60')][_0x4185('0x63')]['Data'],path['resolve'](__dirname,_0x4185('0x27'),rs[_0x4185('0x28')](0x4)+_0x4185('0x39')))[_0x4185('0x35')](function(_0x2d2339){_0x65f25e['audiofile']=_0x2d2339;return _0x65f25e;});}return _0x65f25e;});};exports['dirName']=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 7604aef..b069d8d 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 _0x5571=['./nda','exports'];(function(_0x5afc93,_0x45d6f7){var _0x455799=function(_0x33423a){while(--_0x33423a){_0x5afc93['push'](_0x5afc93['shift']());}};_0x455799(++_0x45d6f7);}(_0x5571,0x174));var _0x1557=function(_0x48e921,_0x20cf98){_0x48e921=_0x48e921-0x0;var _0x4986fe=_0x5571[_0x48e921];return _0x4986fe;};var nda=require(_0x1557('0x0'));module[_0x1557('0x1')]={'nda':nda}; \ No newline at end of file +var _0xb78f=['./nda','exports'];(function(_0x470575,_0xdc139b){var _0x1fc4ce=function(_0x394014){while(--_0x394014){_0x470575['push'](_0x470575['shift']());}};_0x1fc4ce(++_0xdc139b);}(_0xb78f,0xb6));var _0xfb78=function(_0x235053,_0x1d4663){_0x235053=_0x235053-0x0;var _0x187854=_0xb78f[_0x235053];return _0x187854;};var nda=require(_0xfb78('0x0'));module[_0xfb78('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 9f0dbd8..64874de 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 _0x3ba4=['message','Nda','uniqueid','calleridname','dnid','extension','Bearer\x20','access_token','channelData','ndagenerate_audio','body','AudioOutputSettings','audio/wav','custom_action','CustomActionData','info','stringify','../../../../../config/logger','agi','exports','POST','resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0x45a17f,_0x238294){var _0x690d47=function(_0x133868){while(--_0x133868){_0x45a17f['push'](_0x45a17f['shift']());}};_0x690d47(++_0x238294);}(_0x3ba4,0xbf));var _0x43ba=function(_0x2ae733,_0x248c24){_0x2ae733=_0x2ae733-0x0;var _0x110695=_0x3ba4[_0x2ae733];return _0x110695;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x43ba('0x0'))(_0x43ba('0x1'));module[_0x43ba('0x2')]=function(_0x452185,_0x290ce8){var _0x545a38={'method':_0x43ba('0x3'),'uri':url[_0x43ba('0x4')](_0x290ce8['ndauth_url'],_0x43ba('0x5')),'form':{'grant_type':_0x43ba('0x6'),'username':_0x290ce8[_0x43ba('0x7')],'password':_0x290ce8[_0x43ba('0x6')]},'json':!![]};return rp(_0x545a38)[_0x43ba('0x8')](function(_0x30ec07){var _0x5bf5dd={'method':_0x43ba('0x3'),'uri':url[_0x43ba('0x4')](_0x290ce8[_0x43ba('0x9')],_0x43ba('0xa')),'body':{'type':_0x290ce8[_0x43ba('0xb')]||_0x43ba('0xc'),'channelId':_0x43ba('0xd'),'conversation':{'id':_0x452185[_0x43ba('0xe')]},'from':{'id':_0x452185['callerid'],'name':_0x452185[_0x43ba('0xf')]},'recipient':{'id':_0x452185[_0x43ba('0x10')],'name':_0x452185[_0x43ba('0x11')]},'text':_0x290ce8['text'],'channelData':{}},'headers':{'Authorization':_0x43ba('0x12')+_0x30ec07[_0x43ba('0x13')]},'json':!![]};if(_0x290ce8['project']){_0x5bf5dd['body'][_0x43ba('0x14')]['ProjectName']=_0x290ce8['project'];}if(_0x290ce8[_0x43ba('0x15')]=='1'){_0x5bf5dd[_0x43ba('0x16')][_0x43ba('0x14')][_0x43ba('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x43ba('0x18')};}if(_0x290ce8[_0x43ba('0x19')]){_0x5bf5dd[_0x43ba('0x16')]['channelData']['CustomAction']=_0x290ce8['custom_action'];if(_0x290ce8['custom_action_data']){_0x5bf5dd['body']['channelData'][_0x43ba('0x1a')]=_0x290ce8['custom_action_data'];}}logger[_0x43ba('0x1b')](JSON[_0x43ba('0x1c')](_0x5bf5dd));return rp(_0x5bf5dd);});}; \ No newline at end of file +var _0x0143=['dnid','extension','text','Bearer\x20','access_token','project','body','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','channelData','CustomActionData','info','stringify','request-promise','url','exports','resolve','ndauth_url','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid'];(function(_0x2ef9ab,_0x34de9a){var _0x28c7a5=function(_0x19105b){while(--_0x19105b){_0x2ef9ab['push'](_0x2ef9ab['shift']());}};_0x28c7a5(++_0x34de9a);}(_0x0143,0x130));var _0x3014=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0143[_0x501510];return _0x1e6ee5;};'use strict';var rp=require(_0x3014('0x0'));var url=require(_0x3014('0x1'));var logger=require('../../../../../config/logger')('agi');module[_0x3014('0x2')]=function(_0x51e6e9,_0x56cf9e){var _0x323041={'method':'POST','uri':url[_0x3014('0x3')](_0x56cf9e[_0x3014('0x4')],_0x3014('0x5')),'form':{'grant_type':_0x3014('0x6'),'username':_0x56cf9e[_0x3014('0x7')],'password':_0x56cf9e[_0x3014('0x6')]},'json':!![]};return rp(_0x323041)[_0x3014('0x8')](function(_0x2356bf){var _0x598331={'method':_0x3014('0x9'),'uri':url[_0x3014('0x3')](_0x56cf9e[_0x3014('0xa')],_0x3014('0xb')),'body':{'type':_0x56cf9e['ndaactivity_type']||_0x3014('0xc'),'channelId':_0x3014('0xd'),'conversation':{'id':_0x51e6e9[_0x3014('0xe')]},'from':{'id':_0x51e6e9[_0x3014('0xf')],'name':_0x51e6e9['calleridname']},'recipient':{'id':_0x51e6e9[_0x3014('0x10')],'name':_0x51e6e9[_0x3014('0x11')]},'text':_0x56cf9e[_0x3014('0x12')],'channelData':{}},'headers':{'Authorization':_0x3014('0x13')+_0x2356bf[_0x3014('0x14')]},'json':!![]};if(_0x56cf9e[_0x3014('0x15')]){_0x598331[_0x3014('0x16')]['channelData']['ProjectName']=_0x56cf9e['project'];}if(_0x56cf9e['ndagenerate_audio']=='1'){_0x598331[_0x3014('0x16')]['channelData'][_0x3014('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3014('0x18')};}if(_0x56cf9e[_0x3014('0x19')]){_0x598331[_0x3014('0x16')]['channelData'][_0x3014('0x1a')]=_0x56cf9e[_0x3014('0x19')];if(_0x56cf9e[_0x3014('0x1b')]){_0x598331[_0x3014('0x16')][_0x3014('0x1c')][_0x3014('0x1d')]=_0x56cf9e['custom_action_data'];}}logger[_0x3014('0x1e')](JSON[_0x3014('0x1f')](_0x598331));return rp(_0x598331);});}; \ 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 25c6e5a..9d6103b 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x45adc0,_0x4c8c99,_0x344f0c,_0x41c288){return asr(_0x45adc0,_0x4c8c99,_0x344f0c,_0x41c288);}; \ No newline at end of file +var _0x56f5=['./lib/api'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x56f5,0x1a6));var _0x556f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x56f5[_0x2dafbe];return _0x58a45a;};'use strict';var asr=require(_0x556f('0x0'));module['exports']=function(_0xff0867,_0x51e7e2,_0xb71766,_0x289976){return asr(_0xff0867,_0x51e7e2,_0xb71766,_0x289976);}; \ 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 e0de132..dcc69ea 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 _0x0b45=['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.','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','moment','crypto','../../../../../../config/logger','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','update','hex','info','send','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','parse','status','result','hypotheses','transcript','likelihood','Success.'];(function(_0xc73b7a,_0x5043d8){var _0x29b837=function(_0x34b8dd){while(--_0x34b8dd){_0xc73b7a['push'](_0xc73b7a['shift']());}};_0x29b837(++_0x5043d8);}(_0x0b45,0xcf));var _0x50b4=function(_0x489c96,_0x5ba6d9){_0x489c96=_0x489c96-0x0;var _0x174214=_0x0b45[_0x489c96];return _0x174214;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x50b4('0x0'));var crypto=require(_0x50b4('0x1'));var logger=require(_0x50b4('0x2'))('agi');module[_0x50b4('0x3')]=function(_0xed8524,_0x4d6fd0,_0x51cef8,_0x2a6e28){return new BPromise(function(_0x389e3d,_0x3d2255){logger['info'](_0x50b4('0x4'),_0x2a6e28||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x42760c=new WebSocket(_0x2a6e28||_0x50b4('0x5'),{'perMessageDeflate':![]});var _0x52d6a8='';var _0x12f89b='0';var _0x4d7504='1';var _0x19412c=_0x50b4('0x6');function _0x8e6eca(_0x263bfc){var _0x4bc33b=crypto['createHash']('sha1');_0x4bc33b[_0x50b4('0x7')](_0x263bfc);return _0x4bc33b['digest'](_0x50b4('0x8'));}function _0x8bc278(){try{logger[_0x50b4('0x9')]('Open\x20Tilde\x20ASR\x20socket');var _0x3d9d9d=moment()['unix']();var _0x37829e=_0x8e6eca(_0x3d9d9d+_0x4d6fd0+_0x51cef8);_0x42760c[_0x50b4('0xa')](JSON['stringify']({'appID':_0x4d6fd0,'timestamp':_0x3d9d9d,'appKey':_0x37829e}));var _0x3795c4=fs[_0x50b4('0xb')](_0xed8524);_0x3795c4['on']('data',function(_0x305ba5){_0x42760c[_0x50b4('0xa')](_0x305ba5);});_0x3795c4['on'](_0x50b4('0xc'),function(){_0x42760c[_0x50b4('0xa')](_0x50b4('0xd'));});}catch(_0x53f356){logger[_0x50b4('0xe')](_0x50b4('0xf'),JSON[_0x50b4('0x10')](_0x53f356));_0x42760c['terminate']();}}function _0x5a74b2(_0x297184){try{if(_0x297184){var _0x40bd2c=JSON[_0x50b4('0x11')](_0x297184);switch(_0x40bd2c[_0x50b4('0x12')]){case 0x0:if(_0x40bd2c['result']){if(_0x40bd2c['result']['final']){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0x50b4('0x10')](_0x40bd2c[_0x50b4('0x13')][_0x50b4('0x14')]));_0x52d6a8=_0x40bd2c[_0x50b4('0x13')][_0x50b4('0x14')][0x0][_0x50b4('0x15')];_0x12f89b=_0x40bd2c[_0x50b4('0x13')][_0x50b4('0x14')][0x0][_0x50b4('0x16')];_0x4d7504='0';_0x19412c=_0x50b4('0x17');_0x42760c['terminate']();}}break;case 0x1:logger[_0x50b4('0x9')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x4d7504='1';_0x19412c='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x50b4('0x9')](_0x50b4('0x18'));_0x4d7504='2';_0x19412c=_0x50b4('0x18');break;case 0x9:logger[_0x50b4('0x9')](_0x50b4('0x19'));_0x4d7504='9';_0x19412c=_0x50b4('0x19');break;case 0xa:logger[_0x50b4('0x9')](_0x50b4('0x1a'));_0x4d7504='10';_0x19412c=_0x50b4('0x1a');break;case 0xb:logger[_0x50b4('0x9')](_0x50b4('0x1b'));_0x4d7504='11';_0x19412c=_0x50b4('0x1b');}}}catch(_0x2c2939){logger[_0x50b4('0xe')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x2c2939));_0x42760c['terminate']();}}function _0x150258(){logger['info'](_0x50b4('0x1c'));_0x389e3d({'transcript':_0x52d6a8,'confidence':_0x12f89b,'status':_0x4d7504,'status_message':_0x19412c});}function _0x5c218d(_0x249311){logger[_0x50b4('0xe')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x50b4('0x1d')](_0x249311)){logger['error'](_[_0x50b4('0x1e')](_0x249311)?JSON[_0x50b4('0x10')](_0x249311):_0x249311);}}_0x42760c['on'](_0x50b4('0x1f'),_0x8bc278);_0x42760c['on'](_0x50b4('0x20'),_0x5a74b2);_0x42760c['on'](_0x50b4('0xc'),_0x150258);_0x42760c['on']('error',_0x5c218d);});}; \ No newline at end of file +var _0xdfa0=['terminate','parse','status','result','final','info','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','moment','crypto','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error'];(function(_0x4877bc,_0x24b542){var _0x296c34=function(_0x45e2b0){while(--_0x45e2b0){_0x4877bc['push'](_0x4877bc['shift']());}};_0x296c34(++_0x24b542);}(_0xdfa0,0x69));var _0x0dfa=function(_0x8c981f,_0x31b4c3){_0x8c981f=_0x8c981f-0x0;var _0x347dec=_0xdfa0[_0x8c981f];return _0x347dec;};'use strict';var BPromise=require(_0x0dfa('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0dfa('0x1'));var crypto=require(_0x0dfa('0x2'));var logger=require('../../../../../../config/logger')(_0x0dfa('0x3'));module[_0x0dfa('0x4')]=function(_0x3691a7,_0x4dbbab,_0x373c4e,_0x50b91e){return new BPromise(function(_0x2f60d7,_0x2efe20){logger['info'](_0x0dfa('0x5'),_0x50b91e||_0x0dfa('0x6'));var _0x32280b=new WebSocket(_0x50b91e||_0x0dfa('0x6'),{'perMessageDeflate':![]});var _0x3b6881='';var _0x4c7be0='0';var _0x2b85ed='1';var _0x2f813e=_0x0dfa('0x7');function _0x5cddf5(_0x438b20){var _0x520ec9=crypto[_0x0dfa('0x8')](_0x0dfa('0x9'));_0x520ec9[_0x0dfa('0xa')](_0x438b20);return _0x520ec9['digest'](_0x0dfa('0xb'));}function _0x40ef9a(){try{logger['info'](_0x0dfa('0xc'));var _0x96198=moment()['unix']();var _0x4162e1=_0x5cddf5(_0x96198+_0x4dbbab+_0x373c4e);_0x32280b[_0x0dfa('0xd')](JSON[_0x0dfa('0xe')]({'appID':_0x4dbbab,'timestamp':_0x96198,'appKey':_0x4162e1}));var _0x3b0f4a=fs[_0x0dfa('0xf')](_0x3691a7);_0x3b0f4a['on'](_0x0dfa('0x10'),function(_0x54f02d){_0x32280b[_0x0dfa('0xd')](_0x54f02d);});_0x3b0f4a['on'](_0x0dfa('0x11'),function(){_0x32280b[_0x0dfa('0xd')](_0x0dfa('0x12'));});}catch(_0x334ae2){logger[_0x0dfa('0x13')](_0x0dfa('0x14'),JSON[_0x0dfa('0xe')](_0x334ae2));_0x32280b[_0x0dfa('0x15')]();}}function _0x445daf(_0xc524fe){try{if(_0xc524fe){var _0x1d3576=JSON[_0x0dfa('0x16')](_0xc524fe);switch(_0x1d3576[_0x0dfa('0x17')]){case 0x0:if(_0x1d3576[_0x0dfa('0x18')]){if(_0x1d3576['result'][_0x0dfa('0x19')]){logger[_0x0dfa('0x1a')](_0x0dfa('0x1b'),JSON[_0x0dfa('0xe')](_0x1d3576[_0x0dfa('0x18')]['hypotheses']));_0x3b6881=_0x1d3576['result'][_0x0dfa('0x1c')][0x0][_0x0dfa('0x1d')];_0x4c7be0=_0x1d3576[_0x0dfa('0x18')]['hypotheses'][0x0][_0x0dfa('0x1e')];_0x2b85ed='0';_0x2f813e='Success.';_0x32280b[_0x0dfa('0x15')]();}}break;case 0x1:logger['info'](_0x0dfa('0x7'));_0x2b85ed='1';_0x2f813e=_0x0dfa('0x7');break;case 0x2:logger[_0x0dfa('0x1a')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2b85ed='2';_0x2f813e=_0x0dfa('0x1f');break;case 0x9:logger[_0x0dfa('0x1a')](_0x0dfa('0x20'));_0x2b85ed='9';_0x2f813e=_0x0dfa('0x20');break;case 0xa:logger[_0x0dfa('0x1a')](_0x0dfa('0x21'));_0x2b85ed='10';_0x2f813e=_0x0dfa('0x21');break;case 0xb:logger[_0x0dfa('0x1a')](_0x0dfa('0x22'));_0x2b85ed='11';_0x2f813e=_0x0dfa('0x22');}}}catch(_0x5b2d38){logger['error'](_0x0dfa('0x23'),JSON[_0x0dfa('0xe')](_0x5b2d38));_0x32280b['terminate']();}}function _0x14ae2f(){logger[_0x0dfa('0x1a')](_0x0dfa('0x24'));_0x2f60d7({'transcript':_0x3b6881,'confidence':_0x4c7be0,'status':_0x2b85ed,'status_message':_0x2f813e});}function _0x4e4172(_0x1f690c){logger[_0x0dfa('0x13')](_0x0dfa('0x25'));if(!_[_0x0dfa('0x26')](_0x1f690c)){logger[_0x0dfa('0x13')](_[_0x0dfa('0x27')](_0x1f690c)?JSON['stringify'](_0x1f690c):_0x1f690c);}}_0x32280b['on'](_0x0dfa('0x28'),_0x40ef9a);_0x32280b['on'](_0x0dfa('0x29'),_0x445daf);_0x32280b['on']('close',_0x14ae2f);_0x32280b['on'](_0x0dfa('0x13'),_0x4e4172);});}; \ 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 b9b23dc..ec2ce72 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 _0x3ce9=['./asr'];(function(_0x4037c7,_0x4b370b){var _0x5e487f=function(_0x514393){while(--_0x514393){_0x4037c7['push'](_0x4037c7['shift']());}};_0x5e487f(++_0x4b370b);}(_0x3ce9,0x85));var _0x93ce=function(_0x555d8c,_0x2424aa){_0x555d8c=_0x555d8c-0x0;var _0x235411=_0x3ce9[_0x555d8c];return _0x235411;};var asr=require(_0x93ce('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xe3cd=['./asr','exports'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0xe3cd,0x1e0));var _0xde3c=function(_0x548aed,_0x2c6844){_0x548aed=_0x548aed-0x0;var _0x136c6a=_0xe3cd[_0x548aed];return _0x136c6a;};var asr=require(_0xde3c('0x0'));module[_0xde3c('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 9ab76a4..bf472ed 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 _0x0e85=['createServer','listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','EventEmitter','./error','call','emit','error','E_AGI_ARGUMENT_PORT'];(function(_0x580e29,_0x1e42b7){var _0xd8e018=function(_0x422bc6){while(--_0x422bc6){_0x580e29['push'](_0x580e29['shift']());}};_0xd8e018(++_0x1e42b7);}(_0x0e85,0x7c));var _0x50e8=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x0e85[_0x31a371];return _0x2a5bd6;};'use strict';var util=require(_0x50e8('0x0'));var net=require(_0x50e8('0x1'));var EventEmitter=require('events')[_0x50e8('0x2')];var AGIError=require(_0x50e8('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x55cba3,_0x4ce6cd,_0x236cf3){var _0x4e90e7=this,_0x55cba3=_0x55cba3||0x11dd,_0x4ce6cd=_0x4ce6cd||'127.0.0.1',_0xe3151e=null,_0xfde42=0x0;EventEmitter[_0x50e8('0x4')](_0x4e90e7);function _0x108edc(){if(!_0x55cba3){_0x4e90e7[_0x50e8('0x5')](_0x50e8('0x6'),new AGIError(_0x50e8('0x7')));return![];}_0xe3151e=net[_0x50e8('0x8')]();_0xe3151e['listen'](_0x55cba3,_0x4ce6cd);_0xe3151e['on'](_0x50e8('0x9'),function(){_0x4e90e7[_0x50e8('0x5')](_0x50e8('0x9'));});_0xe3151e['on'](_0x50e8('0xa'),function(_0x154b9e){_0xe3151e[_0x50e8('0xb')](function(_0x45dc6f,_0x3d25ea){if(_0x45dc6f){_0x4e90e7['emit']('error',new AGIError(_0x50e8('0xc'),_0x45dc6f));}else if(_0x236cf3&&_0x236cf3<0x0){_0x4e90e7[_0x50e8('0x5')]('error',new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x154b9e[_0x50e8('0xd')]();}else if(_0x236cf3&&_0x236cf3>0x0&&_0x236cf3<_0x3d25ea){_0xfde42+=0x1;_0x4e90e7[_0x50e8('0x5')](_0x50e8('0x6'),new AGIError(_0x50e8('0xe'),_0xfde42));_0x154b9e['destroy']();}else{var _0x18596f=new AGIChannel(_0x154b9e);_0x18596f['on'](_0x50e8('0xf'),function(){_0x4e90e7[_0x50e8('0x5')]('connection',_0x18596f);});}});});_0xe3151e['on']('error',function(_0x30a872){_0x4e90e7[_0x50e8('0x5')](_0x50e8('0x6'),new AGIError(_0x50e8('0xc'),_0x30a872[_0x50e8('0x10')]));});_0xe3151e['on'](_0x50e8('0x11'),function(){_0x4e90e7['emit']('close',new AGIError(_0x50e8('0x12')));});}process[_0x50e8('0x13')](function(){_0x108edc();});};util[_0x50e8('0x14')](AGIServer,EventEmitter);module[_0x50e8('0x15')]=function(_0x5dae4e,_0x90c54c,_0x1a451d){return new AGIServer(_0x5dae4e,_0x90c54c,_0x1a451d);}; \ No newline at end of file +var _0x7dc2=['error','E_AGI_ARGUMENT_PORT','createServer','listen','emit','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','code','close','nextTick','inherits','exports','events','EventEmitter','./error','./channel','call'];(function(_0x31bec4,_0x3f7464){var _0x56bc75=function(_0x29db0d){while(--_0x29db0d){_0x31bec4['push'](_0x31bec4['shift']());}};_0x56bc75(++_0x3f7464);}(_0x7dc2,0x19d));var _0x27dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7dc2[_0x321bb2];return _0x9c12ed;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x27dc('0x0'))[_0x27dc('0x1')];var AGIError=require(_0x27dc('0x2'));var AGIChannel=require(_0x27dc('0x3'));var AGIServer=function(_0x57d4b4,_0x15d70c,_0x29ba23){var _0x52337b=this,_0x57d4b4=_0x57d4b4||0x11dd,_0x15d70c=_0x15d70c||'127.0.0.1',_0x5a442a=null,_0x29eaac=0x0;EventEmitter[_0x27dc('0x4')](_0x52337b);function _0x3b3eee(){if(!_0x57d4b4){_0x52337b['emit'](_0x27dc('0x5'),new AGIError(_0x27dc('0x6')));return![];}_0x5a442a=net[_0x27dc('0x7')]();_0x5a442a[_0x27dc('0x8')](_0x57d4b4,_0x15d70c);_0x5a442a['on']('listening',function(){_0x52337b[_0x27dc('0x9')]('listening');});_0x5a442a['on'](_0x27dc('0xa'),function(_0x187853){_0x5a442a[_0x27dc('0xb')](function(_0x54c533,_0x5cd8a5){if(_0x54c533){_0x52337b[_0x27dc('0x9')](_0x27dc('0x5'),new AGIError(_0x27dc('0xc'),_0x54c533));}else if(_0x29ba23&&_0x29ba23<0x0){_0x52337b[_0x27dc('0x9')]('error',new AGIError(_0x27dc('0xd')));_0x187853['destroy']();}else if(_0x29ba23&&_0x29ba23>0x0&&_0x29ba23<_0x5cd8a5){_0x29eaac+=0x1;_0x52337b[_0x27dc('0x9')]('error',new AGIError(_0x27dc('0xe'),_0x29eaac));_0x187853[_0x27dc('0xf')]();}else{var _0x7972d8=new AGIChannel(_0x187853);_0x7972d8['on'](_0x27dc('0x10'),function(){_0x52337b['emit'](_0x27dc('0xa'),_0x7972d8);});}});});_0x5a442a['on'](_0x27dc('0x5'),function(_0x798f50){_0x52337b[_0x27dc('0x9')](_0x27dc('0x5'),new AGIError('E_AGI_SERVER_ERROR',_0x798f50[_0x27dc('0x11')]));});_0x5a442a['on'](_0x27dc('0x12'),function(){_0x52337b[_0x27dc('0x9')](_0x27dc('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x27dc('0x13')](function(){_0x3b3eee();});};util[_0x27dc('0x14')](AGIServer,EventEmitter);module[_0x27dc('0x15')]=function(_0x2c8c68,_0x31fb67,_0x3dcfca){return new AGIServer(_0x2c8c68,_0x31fb67,_0x3dcfca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index bfd4342..5ddb0bd 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 _0x55b5=['map','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','calleridname','context','extension','priority','accountcode','createCmContact','isNil','callback_','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','callerid','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','includes','POST','PUT','method','toUpperCase','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','stringify','body','render','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','key','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isArray','saveRestApiResult','isPlainObject','%s.%s','length','setVariable','split','extra','getAndSetVariable','getVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','add','delay','minutes','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20query\x20configured','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','createSquareMessage','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','bot','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','getTrunk','trunk_name','no\x20trunk\x20selected','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','variable_id','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','wav','%s/recordings/%s','beep','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','ISPEECH_ASR_%s','ispeechtts','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','opts','queue','queue_id','no\x20queue\x20selected','getVoiceQueue','indexOf','toLowerCase','macro','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','Smtp','service','port','secure','authentication','auth','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','replaceAll','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','./scripts','rawHeaders','getdigits','getsecretdigits','channel','mailRpc','prototype','rpc','getVariableById','name','catch','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval'];(function(_0x3813af,_0x4cceea){var _0x39b6fc=function(_0xa603ce){while(--_0xa603ce){_0x3813af['push'](_0x3813af['shift']());}};_0x39b6fc(++_0x4cceea);}(_0x55b5,0x19d));var _0x555b=function(_0x4376fb,_0x399e96){_0x4376fb=_0x4376fb-0x0;var _0x185678=_0x55b5[_0x4376fb];return _0x185678;};'use strict';var fs=require('fs');var path=require(_0x555b('0x0'));var util=require(_0x555b('0x1'));var _=require(_0x555b('0x2'));var sh=require(_0x555b('0x3'));var odbc=require(_0x555b('0x4'))();var rs=require(_0x555b('0x5'));var moment=require(_0x555b('0x6'));var Mustache=require(_0x555b('0x7'));var rp=require(_0x555b('0x8'));var logger=require('../../config/logger')(_0x555b('0x9'));var config=require('../../config/environment');var scripts=require(_0x555b('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x555b('0xb'),'rawBody'];var verticesWithRetry=['menu',_0x555b('0xc'),_0x555b('0xd')];var AGIVertices=function(_0x440a4b,_0x3a7837,_0x4cdca5){this[_0x555b('0xe')]=_0x440a4b;this['rpc']=_0x3a7837;this[_0x555b('0xf')]=_0x4cdca5;};AGIVertices[_0x555b('0x10')]['getVariable']=function(_0x573976,_0x5e37a7){this[_0x555b('0x11')][_0x555b('0x12')](_0x573976)['then'](function(_0x309092){_0x5e37a7(null,_0x309092?_0x309092[_0x555b('0x13')]:![]);})[_0x555b('0x14')](function(_0x517ae5){_0x5e37a7(_0x517ae5);});};AGIVertices[_0x555b('0x10')]['getVoiceQueue']=function(_0x1ff54b,_0x33e4d2){this[_0x555b('0x11')][_0x555b('0x15')](_0x1ff54b)[_0x555b('0x16')](function(_0x307b0b){_0x33e4d2(null,_0x307b0b?_0x307b0b['name']:![]);})[_0x555b('0x14')](function(_0x1ca3ef){_0x33e4d2(_0x1ca3ef);});};AGIVertices[_0x555b('0x10')][_0x555b('0x17')]=function(_0xeee250,_0x75975d){this[_0x555b('0x11')][_0x555b('0x18')](_0xeee250)[_0x555b('0x16')](function(_0x3c3ff8){_0x75975d(null,_0x3c3ff8?_0x3c3ff8[_0x555b('0x13')]:![]);})[_0x555b('0x14')](function(_0x381fe5){_0x75975d(_0x381fe5);});};AGIVertices[_0x555b('0x10')][_0x555b('0x19')]=function(_0x35088d,_0x2df1e4){this['rpc']['getSquareOdbcById'](_0x35088d)['then'](function(_0x489fa9){_0x2df1e4(null,_0x489fa9?_0x489fa9[_0x555b('0x1a')]:![]);})[_0x555b('0x14')](function(_0x1a8e3d){_0x2df1e4(_0x1a8e3d);});};AGIVertices[_0x555b('0x10')][_0x555b('0x1b')]=function(_0x56f0d4,_0x11426e){this[_0x555b('0x11')][_0x555b('0x1c')](_0x56f0d4)[_0x555b('0x16')](function(_0x51723d){_0x11426e(null,_0x51723d?_0x51723d[_0x555b('0x13')]:![]);})[_0x555b('0x14')](function(_0x217cbc){_0x11426e(_0x217cbc);});};AGIVertices[_0x555b('0x10')]['getTrunk']=function(_0x2808e8,_0x3df1b1){this[_0x555b('0x11')]['getTrunkById'](_0x2808e8)[_0x555b('0x16')](function(_0xa493f4){_0x3df1b1(null,_0xa493f4?_0xa493f4['name']:![]);})['catch'](function(_0x3f3f71){_0x3df1b1(_0x3f3f71);});};AGIVertices[_0x555b('0x10')][_0x555b('0x1d')]=function(_0x7fa3a5,_0x34a32e){var _0x2a1d45=this;this['rpc'][_0x555b('0x1e')](_0x7fa3a5)[_0x555b('0x16')](function(_0x4c8cb8){_0x34a32e(null,_0x4c8cb8?_0x2a1d45[_0x555b('0x1f')](_0x4c8cb8[_0x555b('0x20')]):![]);})[_0x555b('0x14')](function(_0x15cbe7){_0x34a32e(_0x15cbe7);});};AGIVertices['prototype'][_0x555b('0x21')]=function(_0x1d18a0,_0x1dfeec){this[_0x555b('0x11')][_0x555b('0x22')](_0x1d18a0)['then'](function(_0x5dae5c){_0x1dfeec(null,_0x5dae5c?_0x5dae5c:![]);})[_0x555b('0x14')](function(_0x675b5d){_0x1dfeec(_0x675b5d);});};AGIVertices[_0x555b('0x10')][_0x555b('0x23')]=function(_0xac9c79,_0x2d3947,_0x223e60){this[_0x555b('0xf')]['sendMailMessage'](_0xac9c79,_0x2d3947)[_0x555b('0x16')](function(){_0x223e60(null);})[_0x555b('0x14')](function(_0x177545){_0x223e60(_0x177545);});};AGIVertices[_0x555b('0x10')][_0x555b('0x24')]=function(_0x253f87,_0x58e4b5){this[_0x555b('0x11')][_0x555b('0x25')](_0x253f87)['then'](function(_0x19f657){if(_0x19f657){if(_0x19f657['IntervalId']){_0x58e4b5(null,[_0x19f657[_0x555b('0x26')]]);}else{_0x58e4b5(null,_[_0x555b('0x27')](_0x19f657['Intervals'],_0x555b('0x26')));}}else{_0x58e4b5(null,![]);}})[_0x555b('0x14')](function(_0x3d60db){_0x58e4b5(_0x3d60db);});};AGIVertices[_0x555b('0x10')]['getSoundPath']=function(_0x47d7aa){return util[_0x555b('0x28')](_0x555b('0x29'),FILES_PATH,_0x47d7aa);};AGIVertices[_0x555b('0x10')]['getQueryOdbc']=function(_0x5e6db8,_0x4ba716,_0x54c0fb){odbc[_0x555b('0x2a')](_0x5e6db8,function(_0x131be2){if(_0x131be2){logger[_0x555b('0x2b')](_0x555b('0x2c'),_0x131be2);_0x54c0fb(_0x131be2);}else{logger[_0x555b('0x2d')](_0x555b('0x2e'));odbc[_0x555b('0x2f')](_0x4ba716,function(_0x3eaeef,_0x356792){if(_0x3eaeef){logger[_0x555b('0x2d')](_0x555b('0x30'),_0x4ba716);_0x54c0fb(_0x3eaeef);}else{logger['info'](_0x555b('0x31'),_0x4ba716);odbc['close'](function(_0x342a58){if(_0x342a58){logger[_0x555b('0x2b')](_0x555b('0x32'),_0x342a58);}_0x54c0fb(null,_0x356792);});}});}});};AGIVertices[_0x555b('0x10')][_0x555b('0x33')]=function(_0x47df4f,_0x14b51d){this['rpc'][_0x555b('0x34')](_0x47df4f)[_0x555b('0x16')](function(_0x14514d){_0x14b51d(null,_0x14514d?_0x14514d:![]);})[_0x555b('0x14')](function(_0x7d727){_0x14b51d(_0x7d727);});};AGIVertices['prototype']['createSmsMessage']=function(_0x17f3f3,_0x19c2db){this[_0x555b('0x11')][_0x555b('0x35')](_0x17f3f3)[_0x555b('0x16')](function(_0x50929a){_0x19c2db(null,_0x50929a);})[_0x555b('0x14')](function(_0xd2630c){_0x19c2db(_0xd2630c);});};AGIVertices['prototype'][_0x555b('0x36')]=function(_0x293afe,_0x4c0dc0,_0x59bd23){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x555b('0xe')][_0x555b('0x37')],'node':_0x293afe[_0x555b('0x38')],'application':_0x293afe['agicommand'],'data':_0x4c0dc0||null,'project_name':this[_0x555b('0xe')][_0x555b('0x39')],'callerid':this[_0x555b('0xe')]['callerid']})[_0x555b('0x16')](function(_0x27837d){if(_0x59bd23){_0x59bd23(null,_0x27837d);}})[_0x555b('0x14')](function(_0x2960ab){if(_0x59bd23){_0x59bd23(_0x2960ab);}});};AGIVertices[_0x555b('0x10')][_0x555b('0x3a')]=function(_0x48bd67,_0x4f4423,_0x15d3fe,_0x2f12f2){this[_0x555b('0x11')][_0x555b('0x3a')]({'uniqueid':this[_0x555b('0xe')]['uniqueid'],'callerid':this[_0x555b('0xe')]['callerid'],'calleridname':this[_0x555b('0xe')][_0x555b('0x3b')],'context':this['channel'][_0x555b('0x3c')],'extension':this[_0x555b('0xe')][_0x555b('0x3d')],'priority':this[_0x555b('0xe')][_0x555b('0x3e')],'accountcode':this[_0x555b('0xe')][_0x555b('0x3f')],'dnid':this[_0x555b('0xe')]['dnid'],'projectName':this[_0x555b('0xe')][_0x555b('0x39')],'saveName':_0x4f4423,'filename':_0x48bd67['file']||_0x4f4423,'savePath':_0x15d3fe})['then'](function(_0x53577b){_0x2f12f2(null,_0x53577b);})[_0x555b('0x14')](function(_0x4123b7){_0x2f12f2(_0x4123b7);});};AGIVertices['prototype']['createSquareMessage']=function(_0x47469a,_0x2f4530,_0x2dbb92){this[_0x555b('0x11')]['createSquareMessage']({'uniqueid':this[_0x555b('0xe')][_0x555b('0x37')],'body':_0x47469a,'direction':_0x2f4530})[_0x555b('0x16')](function(_0x147000){if(_0x2dbb92){_0x2dbb92(null,_0x147000);}})[_0x555b('0x14')](function(_0x237f13){if(_0x2dbb92){_0x2dbb92(_0x237f13);}});};AGIVertices['prototype'][_0x555b('0x40')]=function(_0x59d7ca,_0x282979){this['rpc'][_0x555b('0x40')]({'firstName':_['isEmpty'](_0x59d7ca[_0x555b('0x13')])||_[_0x555b('0x41')](_0x59d7ca[_0x555b('0x13')])?_0x555b('0x42')+Math['random']():_0x59d7ca[_0x555b('0x13')],'lastName':_[_0x555b('0x43')](_0x59d7ca[_0x555b('0x44')])||_[_0x555b('0x41')](_0x59d7ca['lastName'])?null:_0x59d7ca[_0x555b('0x44')],'phone':_0x59d7ca[_0x555b('0x45')],'ListId':_0x59d7ca[_0x555b('0x46')],'scheduledat':_0x59d7ca[_0x555b('0x47')],'callbackUniqueid':this[_0x555b('0xe')][_0x555b('0x37')],'tags':_0x555b('0x48'),'description':_0x555b('0x49')+_0x59d7ca[_0x555b('0x47')][_0x555b('0x4a')](),'priority':_0x59d7ca[_0x555b('0x4b')]})[_0x555b('0x16')](function(_0x151590){_0x282979(null,_0x151590);})[_0x555b('0x14')](function(_0x2b41bd){_0x282979(_0x2b41bd);});};AGIVertices[_0x555b('0x10')]['getPause']=function(_0x2184a3,_0x73aac1){this[_0x555b('0x11')][_0x555b('0x4c')](_0x2184a3)[_0x555b('0x16')](function(_0xd3d5a3){_0x73aac1(null,_0xd3d5a3?_0xd3d5a3[_0x555b('0x13')]:![]);})['catch'](function(_0x4d5fc5){_0x73aac1(_0x4d5fc5);});};AGIVertices['prototype'][_0x555b('0x4d')]=function(_0x45e94b,_0x2e0d27,_0x8aa414){var _0xf9b3ed={'role':_0x555b('0x4e')};_0xf9b3ed[_0x45e94b]=this[_0x555b('0xe')][_0x555b('0x4f')];this['rpc'][_0x555b('0x4d')](_0xf9b3ed,_0x2e0d27,this[_0x555b('0xe')][_0x555b('0x37')])[_0x555b('0x16')](function(_0x44c26f){_0x8aa414(null,_['isNil'](_0x44c26f)?![]:!![]);})[_0x555b('0x14')](function(_0x119013){logger[_0x555b('0x2b')](_0x119013);_0x8aa414(null,![]);});};AGIVertices['prototype'][_0x555b('0x50')]=function(_0x5e274e,_0x440f1f){var _0x58d88c={'role':_0x555b('0x4e')};_0x58d88c[_0x5e274e]=this['channel'][_0x555b('0x4f')];this[_0x555b('0x11')][_0x555b('0x50')](_0x58d88c)[_0x555b('0x16')](function(_0x247eac){_0x440f1f(null,_['isNil'](_0x247eac)?![]:!![]);})['catch'](function(_0x3ae4b5){logger[_0x555b('0x2b')](_0x3ae4b5);_0x440f1f(null,![]);});};AGIVertices[_0x555b('0x10')][_0x555b('0x51')]=function(_0x3d09b7,_0x3e789f){var _0x5c67f9={'role':_0x555b('0x4e')};_0x5c67f9[_0x3d09b7]=this[_0x555b('0xe')]['callerid'];this[_0x555b('0x11')][_0x555b('0x51')](_0x5c67f9)[_0x555b('0x16')](function(_0x3d91ae){_0x3e789f(null,_[_0x555b('0x41')](_0x3d91ae)?![]:!![]);})['catch'](function(_0x14f4dc){logger[_0x555b('0x2b')](_0x14f4dc);_0x3e789f(null,![]);});};AGIVertices[_0x555b('0x10')][_0x555b('0x52')]=function(_0x581f2c,_0x129dcb){var _0x5abf16={'role':_0x555b('0x4e')};_0x5abf16[_0x581f2c]=this[_0x555b('0xe')]['callerid'];var _0x2593dd=_0x581f2c!=_0x555b('0x53')?util[_0x555b('0x28')](_0x555b('0x54'),_0x555b('0x55'),this[_0x555b('0xe')][_0x555b('0x4f')]):undefined;this['rpc'][_0x555b('0x52')](_0x5abf16,_0x2593dd)[_0x555b('0x16')](function(_0x34e735){_0x129dcb(null,_[_0x555b('0x41')](_0x34e735)?![]:!![]);})['catch'](function(_0x3a7719){logger[_0x555b('0x2b')](_0x3a7719);_0x129dcb(null,![]);});};AGIVertices[_0x555b('0x10')][_0x555b('0x56')]=function(_0x205202,_0x5a482c){sh[_0x555b('0x57')](_['trim'](_0x205202),function(_0x1a8ed8,_0x2589c0){var _0x334638=_0x2589c0[_0x555b('0x58')](/(\r\n|\n|\r)/gm,'');_0x5a482c(null,_0x334638);});};AGIVertices[_0x555b('0x10')][_0x555b('0x59')]=function(_0xf60e1f,_0x2bf9de){scripts[_0x555b('0x59')](_0xf60e1f[_0x555b('0x5a')],_0xf60e1f['google_cloud_tts_text_type']||_0x555b('0x5b'),_0xf60e1f['text'],_0xf60e1f[_0x555b('0x5c')]||_0x555b('0x5d'),_0xf60e1f[_0x555b('0x5e')]||_0x555b('0x5f'),_0xf60e1f[_0x555b('0x60')]||_0x555b('0x61'))[_0x555b('0x16')](function(_0xc59418){_0x2bf9de(null,_0xc59418);})[_0x555b('0x14')](function(_0x58226b){_0x2bf9de(_0x58226b);});};AGIVertices[_0x555b('0x10')][_0x555b('0x62')]=function(_0x4eae44,_0x5662e6){scripts[_0x555b('0x62')](_0x4eae44[_0x555b('0x5b')],_0x4eae44[_0x555b('0x63')]||'en',0x1)[_0x555b('0x16')](function(_0x38783d){_0x5662e6(null,_0x38783d);})[_0x555b('0x14')](function(_0x160516){_0x5662e6(_0x160516);});};AGIVertices[_0x555b('0x10')][_0x555b('0x64')]=function(_0x5a6bb6,_0x5446ae){var _0x2d010c={'uri':_0x5a6bb6[_0x555b('0x65')],'method':_0x5a6bb6['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5a6bb6[_0x555b('0x66')])==='number'&&parseInt(_0x5a6bb6[_0x555b('0x66')])>=0x1?parseInt(_0x5a6bb6[_0x555b('0x66')])*0x3e8:0x5*0x3e8};if(_[_0x555b('0x67')]([_0x555b('0x68'),_0x555b('0x69')],_0x2d010c[_0x555b('0x6a')][_0x555b('0x6b')]())){try{_0x2d010c['body']=_0x5a6bb6[_0x555b('0x6c')]?JSON[_0x555b('0x6d')](_0x5a6bb6[_0x555b('0x6c')]):{};}catch(_0x3807ea){logger[_0x555b('0x2b')](_0x555b('0x6e'),_0x3807ea);}}try{_0x2d010c['headers']=_0x5a6bb6[_0x555b('0xb')]?JSON['parse'](_0x5a6bb6[_0x555b('0xb')]):{};}catch(_0x2eb08a){logger['error'](_0x555b('0x6f'),_0x2eb08a);}if(_0x5a6bb6['computedVariables']){try{var _0x43ca09=require(_0x5a6bb6[_0x555b('0x70')])[_0x555b('0x71')](this,_0x2d010c);_0x2d010c[_0x555b('0x72')]=Mustache['render'](_0x5a6bb6['url'],_0x43ca09,{},['$$','$$']);if(_0x2d010c[_0x555b('0x73')]){_0x2d010c[_0x555b('0x73')]=JSON['parse'](Mustache['render'](JSON[_0x555b('0x74')](_0x2d010c['headers']),_0x43ca09,{},['$$','$$']));}if(_0x2d010c[_0x555b('0x75')]){_0x2d010c[_0x555b('0x75')]=JSON[_0x555b('0x6d')](Mustache[_0x555b('0x76')](JSON[_0x555b('0x74')](_0x2d010c['body']),_0x43ca09,{},['$$','$$']));}}catch(_0xeb3c05){logger[_0x555b('0x2b')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0xeb3c05);}}rp(_0x2d010c)[_0x555b('0x16')](function(_0x1ad5f5){var _0x34055e={'statusCode':_0x1ad5f5[_0x555b('0x77')]||0xc8,'statusMessage':_0x1ad5f5[_0x555b('0x78')]||'OK','headers':_0x1ad5f5['headers']||{},'body':_0x1ad5f5[_0x555b('0x75')]||{}};_0x5446ae(null,_0x34055e);})[_0x555b('0x14')](function(_0x303864){var _0x219f40={'statusCode':_0x303864[_0x555b('0x77')]||0x1f4,'statusMessage':_0x303864['message']||_0x555b('0x79'),'headers':_0x303864[_0x555b('0x7a')]['headers']||{},'body':_0x303864['options']['body']||{}};_0x5446ae(null,_0x219f40);});};AGIVertices[_0x555b('0x10')][_0x555b('0x7b')]=function(_0x455ffd,_0x560b03){scripts['googleDialogflow'](this['channel'][_0x555b('0x37')],_0x455ffd['key'],_0x455ffd[_0x555b('0x5b')],_0x455ffd[_0x555b('0x7c')]||'en')[_0x555b('0x16')](function(_0x5efba9){_0x560b03(null,_0x5efba9);})[_0x555b('0x14')](function(_0x35a423){_0x560b03(_0x35a423);});};AGIVertices['prototype'][_0x555b('0x7d')]=function(_0x4ba06d,_0x3e7f8){scripts[_0x555b('0x7d')](this[_0x555b('0xe')],_0x4ba06d)[_0x555b('0x16')](function(_0x214d38){_0x3e7f8(null,_0x214d38);})['catch'](function(_0x4533f6){_0x3e7f8(_0x4533f6);});};AGIVertices['prototype'][_0x555b('0x7e')]=function(_0x362645,_0x4c4bef){scripts[_0x555b('0x7e')](_0x362645['key'],_0x362645[_0x555b('0x5b')],_0x362645[_0x555b('0x7f')]||'en-US',_0x362645[_0x555b('0x80')])[_0x555b('0x16')](function(_0x3b7389){_0x4c4bef(null,_0x3b7389);})[_0x555b('0x14')](function(_0x1df3cf){_0x4c4bef(_0x1df3cf);});};AGIVertices['prototype'][_0x555b('0x81')]=function(_0x3a30f9,_0x44f9b6,_0x19483a){scripts[_0x555b('0x81')](_0x44f9b6,_0x3a30f9[_0x555b('0x82')],_0x3a30f9[_0x555b('0x83')]||_0x555b('0x5d'),this[_0x555b('0x84')](_0x3a30f9[_0x555b('0x85')])?_0x3a30f9[_0x555b('0x85')]:undefined)['then'](function(_0x4b4716){_0x19483a(null,_0x4b4716);})[_0x555b('0x14')](function(_0x498a4c){_0x19483a(_0x498a4c);});};AGIVertices[_0x555b('0x10')][_0x555b('0x86')]=function(_0x1a0462,_0x1eb786){scripts[_0x555b('0x86')](_0x1a0462[_0x555b('0x87')],_0x1a0462[_0x555b('0x88')],_0x1a0462['aws_polly_region'],_0x1a0462[_0x555b('0x89')]||_0x555b('0x8a'),_0x1a0462[_0x555b('0x5b')],_0x1a0462['aws_text_type']||_0x555b('0x5b'))[_0x555b('0x16')](function(_0x3da202){_0x1eb786(null,_0x3da202);})['catch'](function(_0x490356){_0x1eb786(_0x490356);});};AGIVertices[_0x555b('0x10')][_0x555b('0x8b')]=function(_0x54967b,_0x687b76){scripts['awsLex'](this[_0x555b('0xe')][_0x555b('0x37')],_0x54967b[_0x555b('0x87')],_0x54967b['aws_secret_access_key'],_0x54967b[_0x555b('0x8c')],_0x54967b[_0x555b('0x5b')],_0x54967b[_0x555b('0x8d')])[_0x555b('0x16')](function(_0x2d96ef){_0x687b76(null,_0x2d96ef);})['catch'](function(_0x3eddfa){_0x687b76(_0x3eddfa);});};AGIVertices[_0x555b('0x10')][_0x555b('0x8e')]=function(_0x3f6e94,_0x20f826,_0x29fca2){scripts[_0x555b('0x8e')](_0x20f826,_0x3f6e94[_0x555b('0x82')],_0x3f6e94[_0x555b('0x8f')]||_0x555b('0x5d'))[_0x555b('0x16')](function(_0x29a61e){_0x29fca2(null,_0x29a61e);})[_0x555b('0x14')](function(_0x3816ff){_0x29fca2(_0x3816ff);});};AGIVertices[_0x555b('0x10')]['tildeASR']=function(_0x3e9561,_0x25c483,_0x4f39d6){scripts[_0x555b('0x90')](_0x25c483,_0x3e9561[_0x555b('0x91')],_0x3e9561[_0x555b('0x92')],_0x3e9561[_0x555b('0x72')])[_0x555b('0x16')](function(_0x3a3a3d){_0x4f39d6(null,_0x3a3a3d);})[_0x555b('0x14')](function(_0xae982c){_0x4f39d6(_0xae982c);});};AGIVertices[_0x555b('0x10')][_0x555b('0x93')]=function(_0x25873d){var _0x5c2891=_[_0x555b('0x67')](verticesWithRetry,_0x25873d[_0x555b('0x94')])?_0x25873d:_['clone'](_0x25873d);for(var _0x39b0e4 in _0x5c2891){if(_0x5c2891['hasOwnProperty'](_0x39b0e4)){if(_0x5c2891[_0x39b0e4]&&_[_0x555b('0x95')](_0x5c2891[_0x39b0e4])){if(_[_0x555b('0x67')](recursiveMapAttributes,_0x39b0e4)){_0x5c2891[_0x39b0e4]=this[_0x555b('0x96')](_0x5c2891[_0x39b0e4]);}else{_0x5c2891[_0x39b0e4]=this[_0x555b('0x97')](_0x5c2891[_0x39b0e4]);}}}}return _0x5c2891;};AGIVertices[_0x555b('0x10')][_0x555b('0x98')]=function(_0x4c35d0){for(var _0x21891e in _0x4c35d0){if(_0x4c35d0[_0x555b('0x99')](_0x21891e)){if(_['isPlainObject'](_0x4c35d0[_0x21891e])){this[_0x555b('0x98')](_0x4c35d0[_0x21891e]);}else if(_[_0x555b('0x9a')](_0x4c35d0[_0x21891e])){for(var _0x4f7639=0x0;_0x4f7639<_0x4c35d0[_0x21891e]['length'];_0x4f7639++){this['recursiveNodeIndex'](_0x4c35d0[_0x21891e][_0x4f7639]);}}else if(_[_0x555b('0x95')](_0x4c35d0[_0x21891e])){_0x4c35d0[_0x21891e]=this[_0x555b('0x97')](_0x4c35d0[_0x21891e]);}}}};AGIVertices[_0x555b('0x10')][_0x555b('0x9b')]=function(_0x308b62,_0x46ce4c){for(var _0x401715 in _0x308b62){if(_0x308b62['hasOwnProperty'](_0x401715)){if(_[_0x555b('0x9c')](_0x308b62[_0x401715])){if(!_[_0x555b('0x43')](_0x308b62[_0x401715])){this[_0x555b('0x9b')](_0x308b62[_0x401715],util[_0x555b('0x28')](_0x555b('0x9d'),_0x46ce4c,_0x401715));}}else if(_[_0x555b('0x9a')](_0x308b62[_0x401715])){for(var _0x2ffb62=0x0;_0x2ffb62<_0x308b62[_0x401715][_0x555b('0x9e')];_0x2ffb62++){this[_0x555b('0x9b')](_0x308b62[_0x401715][_0x2ffb62],util['format']('%s.%s',_0x46ce4c,_0x401715+'['+_0x2ffb62+']'));}}else{if(!_[_0x555b('0x41')](_0x308b62[_0x401715])){this[_0x555b('0xe')][_0x555b('0x9f')](util['format'](_0x555b('0x9d'),_0x46ce4c,_0x401715),_0x308b62[_0x401715]);}}}}};AGIVertices[_0x555b('0x10')][_0x555b('0x96')]=function(_0x4a6060){try{var _0x800e69=JSON[_0x555b('0x6d')](_0x4a6060);this[_0x555b('0x98')](_0x800e69);return JSON[_0x555b('0x74')](_0x800e69);}catch(_0x21334a){return this['replaceAllVariables'](_0x4a6060);}};AGIVertices['prototype'][_0x555b('0x97')]=function(_0x1fa56a){var _0x29b2db=_0x1fa56a[_0x555b('0xa0')]('{');for(var _0x4c46df=0x1;_0x4c46df<_0x29b2db[_0x555b('0x9e')];_0x4c46df+=0x1){var _0x2855f=_0x29b2db[_0x4c46df][_0x555b('0xa0')]('}');if(_0x2855f[_0x555b('0x9e')]>0x1){_0x1fa56a=_0x1fa56a['replaceAll']('{'+_0x2855f[0x0]+'}',this['channel']['getVariable'](_0x2855f[0x0])[_0x555b('0xa1')]||_0x2855f[0x0]);}}if(_0x29b2db[_0x555b('0x9e')]===0x1){return _0x1fa56a[_0x555b('0x4a')]();}return this[_0x555b('0x97')](_0x1fa56a);};AGIVertices['prototype'][_0x555b('0xa2')]=function(_0x451354,_0xe6e0eb){var _0x312939=this[_0x555b('0xe')][_0x555b('0xa3')](_0x451354);if(_0x312939[_0x555b('0xa4')]===-0x1){return _0x312939;}logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0xa5'),_0xe6e0eb,_0x312939['extra']));return this[_0x555b('0xe')][_0x555b('0x9f')](_0xe6e0eb,_0x312939[_0x555b('0xa1')]);};AGIVertices[_0x555b('0x10')][_0x555b('0x84')]=function(_0x5f357d){return _0x5f357d&&_0x5f357d!=='0'&&_0x5f357d!=='-1'&&_0x5f357d!=='';};AGIVertices[_0x555b('0x10')][_0x555b('0xa6')]=function(_0x4f73a2){this[_0x555b('0x36')]['sync'](this,_0x4f73a2,'-');_0x4f73a2[_0x555b('0xa7')]=_0x4f73a2[_0x555b('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x555b('0x10')][_0x555b('0x9')]=function(_0x59e1a5){logger['info'](util[_0x555b('0x28')](_0x555b('0xa8'),_0x59e1a5[_0x555b('0x38')]));return this['channel'][_0x555b('0x9')]([_0x59e1a5['command'],_0x59e1a5[_0x555b('0xa9')]]);};AGIVertices[_0x555b('0x10')][_0x555b('0xaa')]=function(_0x33c261){logger[_0x555b('0x2d')](util['format'](_0x555b('0xab'),_0x33c261[_0x555b('0x38')]));if(this[_0x555b('0x84')](_0x33c261['timeout'])){logger[_0x555b('0x2d')](util['format'](_0x555b('0xac'),_0x33c261[_0x555b('0x66')]));var _0x486d5a=this[_0x555b('0xe')][_0x555b('0xad')](_0x33c261[_0x555b('0x66')]);if(_0x486d5a[_0x555b('0xa4')]===-0x1){return _0x486d5a;}}return this[_0x555b('0xe')]['answer']();};AGIVertices[_0x555b('0x10')][_0x555b('0x48')]=function(_0xd4e0e1){logger[_0x555b('0x2d')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0xd4e0e1[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0xd4e0e1[_0x555b('0x46')])){return this['channel'][_0x555b('0x2b')](_0xd4e0e1,'no\x20list\x20selected');}_0xd4e0e1[_0x555b('0x47')]=moment();if(this[_0x555b('0x84')](_0xd4e0e1['delay'])){_0xd4e0e1[_0x555b('0x47')]=moment()[_0x555b('0xae')](_0xd4e0e1[_0x555b('0xaf')],_0x555b('0xb0'));}if(!this[_0x555b('0x84')](_0xd4e0e1[_0x555b('0x4b')])){_0xd4e0e1['callback_priority']=0x2;}this['createCmContact'][_0x555b('0x71')](this,_0xd4e0e1);return this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0xb2'),_0xd4e0e1['phone'],_0xd4e0e1[_0x555b('0x46')],_0xd4e0e1[_0x555b('0x47')]));};AGIVertices['prototype'][_0x555b('0xb3')]=function(_0x403088){logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0xb4'),_0x403088[_0x555b('0x38')]));var _0x48e9dd=this[_0x555b('0xe')][_0x555b('0x57')](_0x403088['application'],_0x403088[_0x555b('0x7a')]);if(_0x48e9dd['result']===-0x1){return _0x48e9dd;}return this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0xb5'),_0x403088[_0x555b('0xb6')],_0x403088[_0x555b('0x7a')]));};AGIVertices[_0x555b('0x10')][_0x555b('0xb7')]=function(_0x218762){logger['info'](util[_0x555b('0x28')](_0x555b('0xb8'),_0x218762[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x218762[_0x555b('0x5b')])){return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0xb9'));}var _0x50907d='\x22'+_0x218762[_0x555b('0x5b')]+'\x22';if(this[_0x555b('0x84')](_0x218762[_0x555b('0x7a')])){_0x50907d+=','+_0x218762[_0x555b('0x7a')];}var _0x7b9cc=this[_0x555b('0xe')][_0x555b('0x57')](_0x555b('0xba'),_0x50907d);if(_0x7b9cc['result']===-0x1){return _0x7b9cc;}return this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0xbb'),_0x50907d));};AGIVertices[_0x555b('0x10')]['sestektts']=function(_0x45711b){logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0xbc'),_0x45711b['label']));if(!this[_0x555b('0x84')](_0x45711b[_0x555b('0x5b')])){return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0xb9'));}var _0x1bc46e='\x22'+_0x45711b[_0x555b('0x5b')]+'\x22';if(this[_0x555b('0x84')](_0x45711b[_0x555b('0x7a')])){_0x1bc46e+=','+_0x45711b[_0x555b('0x7a')];}var _0x5b35d4=this[_0x555b('0xe')][_0x555b('0x57')](_0x555b('0xba'),_0x1bc46e);if(_0x5b35d4[_0x555b('0xa4')]===-0x1){return _0x5b35d4;}return this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0xbb'),_0x1bc46e));};AGIVertices[_0x555b('0x10')][_0x555b('0xbd')]=function(_0x4c933a){logger['info'](util[_0x555b('0x28')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x4c933a[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x4c933a[_0x555b('0xbe')])){return this['channel']['noop'](_0x555b('0xbf'));}var _0x117666=_0x4c933a[_0x555b('0xbe')];if(this['isConfigured'](_0x4c933a[_0x555b('0x7a')])){_0x117666+=','+_0x4c933a[_0x555b('0x7a')];}var _0x5ad301=this[_0x555b('0xe')][_0x555b('0x57')](_0x555b('0xc0'),_0x117666);if(_0x5ad301[_0x555b('0xa4')]===-0x1){return _0x5ad301;}var _0x2d6f7d=this[_0x555b('0xa2')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x2d6f7d[_0x555b('0xa4')]===-0x1){return _0x2d6f7d;}var _0x250b20=this[_0x555b('0xa2')](_0x555b('0xc1'),_0x555b('0xc2'));if(_0x250b20['result']===-0x1){return _0x250b20;}var _0x565017=this[_0x555b('0xa2')](_0x555b('0xc3'),_0x555b('0xc4'));if(_0x565017[_0x555b('0xa4')]===-0x1){return _0x565017;}return this[_0x555b('0xe')][_0x555b('0xb1')](util['format'](_0x555b('0xc5'),_0x117666));};AGIVertices[_0x555b('0x10')][_0x555b('0xc6')]=function(_0x37a4a3){logger['info'](util[_0x555b('0x28')](_0x555b('0xc7'),_0x37a4a3[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x37a4a3[_0x555b('0xbe')])){return this[_0x555b('0xe')]['noop'](_0x555b('0xbf'));}var _0x2f4780=_0x37a4a3[_0x555b('0xbe')];if(this[_0x555b('0x84')](_0x37a4a3[_0x555b('0x7a')])){_0x2f4780+=','+_0x37a4a3['options'];}var _0x3e4747=this[_0x555b('0xe')]['exec'](_0x555b('0xc0'),_0x2f4780);if(_0x3e4747[_0x555b('0xa4')]===-0x1){return _0x3e4747;}var _0x6a255a=this[_0x555b('0xa2')](_0x555b('0xc8'),_0x555b('0xc9'));if(_0x6a255a[_0x555b('0xa4')]===-0x1){return _0x6a255a;}var _0x53a189=this[_0x555b('0xa2')](_0x555b('0xc1'),_0x555b('0xca'));if(_0x53a189[_0x555b('0xa4')]===-0x1){return _0x53a189;}var _0x18f3ae=this['getAndSetVariable'](_0x555b('0xc3'),_0x555b('0xcb'));if(_0x18f3ae[_0x555b('0xa4')]===-0x1){return _0x18f3ae;}return this['channel'][_0x555b('0xb1')](util[_0x555b('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2f4780));};AGIVertices['prototype'][_0x555b('0xcc')]=function(_0x2d9a49){logger[_0x555b('0x2d')](util[_0x555b('0x28')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x2d9a49['label']));if(!this[_0x555b('0x84')](_0x2d9a49[_0x555b('0xcd')])){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x2d9a49,'no\x20database\x20selected');}var _0x272002=this[_0x555b('0x19')]['sync'](this,_0x2d9a49[_0x555b('0xcd')]);if(!_0x272002){return this['channel'][_0x555b('0x2b')](_0x2d9a49,'no\x20odbc\x20database\x20found');}if(!this[_0x555b('0x84')](_0x2d9a49['query'])){return this['channel'][_0x555b('0x2b')](_0x2d9a49,_0x555b('0xce'));}var _0x431b9c=_0x2d9a49[_0x555b('0x2f')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x555b('0xb1')](util['format'](_0x555b('0xcf'),_0x431b9c));var _0x279c2b=this[_0x555b('0xd0')][_0x555b('0x71')](this,_0x272002,_0x431b9c);this[_0x555b('0x36')][_0x555b('0x71')](this,_0x2d9a49,_0x431b9c);if(!this[_0x555b('0x84')](_0x2d9a49['variable_id'])){return this[_0x555b('0xe')]['noop'](_0x555b('0xd1'));}var _0x181e35=this['getVariable'][_0x555b('0x71')](this,_0x2d9a49['variable_id']);if(!_0x181e35){return this['channel'][_0x555b('0x2b')](_0x2d9a49,_0x555b('0xd2'));}var _0x1b0691=this;_0x279c2b[_0x555b('0xd3')](function(_0x690fa8,_0x5568a2){Object['keys'](_0x690fa8)[_0x555b('0xd3')](function(_0xc018b8){_0x1b0691[_0x555b('0xe')][_0x555b('0x9f')](util[_0x555b('0x28')](_0x555b('0xd4'),_0x181e35,_0x5568a2,_0xc018b8),_0x690fa8[_0xc018b8]);});});this['channel'][_0x555b('0x9f')](util[_0x555b('0x28')](_0x555b('0xd5'),_0x181e35),_0x279c2b[_0x555b('0x9e')]);return this['channel']['noop'](util[_0x555b('0x28')](_0x555b('0xd6'),_0x181e35));};AGIVertices[_0x555b('0x10')][_0x555b('0xd7')]=function(_0x23f1b5){logger[_0x555b('0xd8')](util[_0x555b('0x28')](_0x555b('0xd9'),_0x23f1b5[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x23f1b5[_0x555b('0xda')])){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x23f1b5,_0x555b('0xdb'));}var _0x15dcdd=this[_0x555b('0x1b')][_0x555b('0x71')](this,_0x23f1b5[_0x555b('0xda')]);if(!_0x15dcdd){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x23f1b5,_0x555b('0xdc'));}var _0x2c592d=this[_0x555b('0xe')][_0x555b('0x57')](_0x555b('0xdd'),[util[_0x555b('0x28')](_0x555b('0xde'),_0x15dcdd),_0x23f1b5[_0x555b('0x66')],_0x23f1b5['opts'],_0x23f1b5['url']]);if(_0x2c592d[_0x555b('0xa4')]===-0x1){return _0x2c592d;}return this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0xdf'),_0x555b('0xdd')));};AGIVertices[_0x555b('0x10')][_0x555b('0xe0')]=function(_0x4cf568){logger['info'](util[_0x555b('0x28')](_0x555b('0xe1'),_0x4cf568[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x4cf568['key'])){return this['channel']['noop'](_0x555b('0xe2'));}if(!this['isConfigured'](_0x4cf568['text'])){return this[_0x555b('0xe')]['noop']('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x555b('0x36')](_0x4cf568);this[_0x555b('0xe3')](_0x4cf568[_0x555b('0x5b')],'in');this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0xe4'),_0x4cf568[_0x555b('0x5b')]));var _0x308dce=this[_0x555b('0x7b')][_0x555b('0x71')](this,_0x4cf568);if(_0x308dce){for(var _0x48b10f in _0x308dce){if(_0x308dce[_0x555b('0x99')](_0x48b10f)){this[_0x555b('0xe')][_0x555b('0x9f')](util['format'](_0x555b('0xe5'),_0x48b10f['toUpperCase']()),_0x308dce[_0x48b10f]);}}this[_0x555b('0xe3')](_0x308dce[_0x555b('0xe6')],_0x555b('0xe7'));return this[_0x555b('0xe')]['noop'](util['format'](_0x555b('0xe8'),_0x308dce['speech']));}return this[_0x555b('0xe')][_0x555b('0x2b')](_0x4cf568,_0x555b('0xe9'));};AGIVertices[_0x555b('0x10')]['sesteknda']=function(_0x436aef){logger['info'](util[_0x555b('0x28')](_0x555b('0xea'),_0x436aef[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x436aef[_0x555b('0xeb')])){return this[_0x555b('0xe')][_0x555b('0xb1')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x555b('0x84')](_0x436aef[_0x555b('0xec')])){return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0xed'));}if(!this[_0x555b('0x84')](_0x436aef[_0x555b('0xee')])){return this['channel'][_0x555b('0xb1')](_0x555b('0xef'));}if(!this[_0x555b('0x84')](_0x436aef['ndassistant_url'])){return this['channel']['noop'](_0x555b('0xb9'));}this[_0x555b('0xe')][_0x555b('0xf0')]=!![];this[_0x555b('0x36')](_0x436aef);this[_0x555b('0xe3')](_0x436aef[_0x555b('0x5b')],'in');this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')]('Trying\x20SestekNDA:\x20%s',_0x436aef[_0x555b('0x5b')]));var _0x44d5ba=this[_0x555b('0x7d')][_0x555b('0x71')](this,_0x436aef);if(_0x44d5ba){for(var _0x28140e in _0x44d5ba){if(_0x44d5ba[_0x555b('0x99')](_0x28140e)){this[_0x555b('0xe')][_0x555b('0x9f')](util[_0x555b('0x28')](_0x555b('0xf1'),_0x28140e[_0x555b('0x6b')]()),_0x44d5ba[_0x28140e]);}}this[_0x555b('0xe3')](_0x44d5ba[_0x555b('0xe6')],_0x555b('0xe7'));if(_0x44d5ba[_0x555b('0xf2')]){this[_0x555b('0xe')]['noop'](util['format'](_0x555b('0xf3'),_0x44d5ba['audiofile']));var _0x13d93c=this[_0x555b('0xe')]['streamFile'](_0x44d5ba[_0x555b('0xf2')]);try{fs[_0x555b('0xf4')](_0x44d5ba[_0x555b('0xf2')]+'.wav');}catch(_0x4ad318){logger[_0x555b('0x2b')](_0x4ad318);}return _0x13d93c;}else{return this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')]('SestekNDA\x20Result\x20%s',_0x44d5ba[_0x555b('0xe6')]));}}return this['channel'][_0x555b('0x2b')](_0x436aef,_0x555b('0xf5'));};AGIVertices[_0x555b('0x10')][_0x555b('0xf6')]=function(_0x4124bd){logger[_0x555b('0x2d')](util['format'](_0x555b('0xf7'),_0x4124bd[_0x555b('0x38')]));return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0xf6'));};AGIVertices['prototype'][_0x555b('0xf8')]=function(_0x585cd3){logger[_0x555b('0x2d')](util[_0x555b('0x28')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x585cd3['label']));var _0x78dd48='';if(_0x585cd3[_0x555b('0xf9')]){if(!this[_0x555b('0x84')](_0x585cd3[_0x555b('0xf9')])){return this[_0x555b('0xe')]['error'](_0x585cd3,'no\x20trunk\x20selected');}else{var _0x40e2f3=parseInt(_0x585cd3['trunk_id'],0xa);if(isNaN(_0x40e2f3)){_0x78dd48=_0x585cd3[_0x555b('0xf9')];}else{_0x78dd48=this[_0x555b('0xfa')][_0x555b('0x71')](this,_0x585cd3[_0x555b('0xf9')]);if(!_0x78dd48){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x585cd3,'no\x20trunk\x20found');}}}}else if(_0x585cd3['trunk_name']){_0x78dd48=_0x585cd3[_0x555b('0xfb')];}else{return this[_0x555b('0xe')][_0x555b('0x2b')](_0x585cd3,_0x555b('0xfc'));}var _0x25f290=this[_0x555b('0xe')][_0x555b('0x57')](_0x555b('0xdd'),[util['format']('SIP/%s/%s',_0x78dd48,_0x585cd3[_0x555b('0x45')]),_0x585cd3['timeout'],_0x585cd3['opts'],_0x585cd3[_0x555b('0x65')]]);if(_0x25f290[_0x555b('0xa4')]===-0x1){return _0x25f290;}return this['channel'][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0xdf'),_0x555b('0xdd')));};AGIVertices[_0x555b('0x10')]['finally']=function(_0xff79d8){logger['info'](util[_0x555b('0x28')](_0x555b('0xfd'),_0xff79d8[_0x555b('0x38')]));return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0xfe'));};AGIVertices[_0x555b('0x10')][_0x555b('0xc')]=function(_0x443581){logger['info'](util[_0x555b('0x28')](_0x555b('0xff'),_0x443581[_0x555b('0x38')]));if(_0x443581[_0x555b('0xa7')]===0x0){return this['maxRetry'](_0x443581);}_0x443581[_0x555b('0xa7')]-=0x1;if(!this[_0x555b('0x84')](_0x443581[_0x555b('0x100')])){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x443581,_0x555b('0x101'));}var _0x4e0778=this[_0x555b('0x1d')][_0x555b('0x71')](this,_0x443581[_0x555b('0x100')]);if(!_0x4e0778){return this[_0x555b('0xe')]['error'](_0x443581,_0x555b('0x102'));}if(!this[_0x555b('0x84')](_0x443581['variable_id'])){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x555b('0xd1'));}var _0x59cc00=this[_0x555b('0xe')][_0x555b('0x103')](_0x4e0778,_0x443581[_0x555b('0x104')],_0x443581[_0x555b('0x105')]);var _0x400349=_0x59cc00[_0x555b('0xa4')]?_0x59cc00['result'][_0x555b('0x4a')]():'';logger[_0x555b('0x2d')](_0x555b('0x106'),JSON[_0x555b('0x74')](_0x59cc00));if(_0x59cc00[_0x555b('0xa4')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x443581,_0x400349);return _0x59cc00;}else if(_0x59cc00[_0x555b('0xa1')]===_0x555b('0x66')){_0x59cc00[_0x555b('0xa4')]=_0x400349[_0x555b('0x9e')]>=parseInt(_0x443581[_0x555b('0x107')])?'x':'i';}else{_0x59cc00[_0x555b('0xa4')]=_0x400349[_0x555b('0x9e')]>=parseInt(_0x443581['mindigit'])&&_0x400349['length']<=parseInt(_0x443581[_0x555b('0x105')])?'x':'i';}var _0x335448=this[_0x555b('0xa3')][_0x555b('0x71')](this,_0x443581[_0x555b('0x108')]);if(!_0x335448){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x443581,_0x555b('0xd2'));}this[_0x555b('0xe')][_0x555b('0x9f')](_0x335448,_0x400349);if(this[_0x555b('0x84')](_0x443581['hiddendigitsnum'])){var _0x13aa73=parseInt(_0x443581[_0x555b('0x109')],0xa);var _0x55699a=rs[_0x555b('0x10a')]({'charset':'*','length':_0x13aa73});var _0x261fe4=_0x400349[_0x555b('0x9e')];if(_0x261fe4>0x0){if(_0x261fe4>_0x13aa73){this[_0x555b('0x36')][_0x555b('0x71')](this,_0x443581,_0x443581[_0x555b('0x10b')]===_0x555b('0x10c')?_0x55699a+_0x400349[_0x555b('0x10d')](_0x13aa73):_0x400349[_0x555b('0x10d')](0x0,_0x261fe4-_0x13aa73)+_0x55699a);}else{this[_0x555b('0x36')][_0x555b('0x71')](this,_0x443581,rs[_0x555b('0x10a')]({'charset':'*','length':_0x261fe4}));}}else{this[_0x555b('0x36')][_0x555b('0x71')](this,_0x443581,'');}}else{this[_0x555b('0x36')][_0x555b('0x71')](this,_0x443581,_0x400349);}return _0x59cc00;};AGIVertices['prototype'][_0x555b('0xd')]=function(_0x19b602){logger['info'](util[_0x555b('0x28')](_0x555b('0x10e'),_0x19b602['label']));return this[_0x555b('0xc')](_0x19b602);};AGIVertices[_0x555b('0x10')][_0x555b('0x10f')]=function(_0x1414ac){logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x110'),_0x1414ac[_0x555b('0x38')]));this[_0x555b('0x36')][_0x555b('0x71')](this,_0x1414ac,_0x1414ac[_0x555b('0x111')]);return this[_0x555b('0xe')][_0x555b('0xb1')](util['format'](_0x555b('0x112'),_0x1414ac[_0x555b('0x111')]));};AGIVertices[_0x555b('0x10')][_0x555b('0x113')]=function(_0x208e72){logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x114'),_0x208e72[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x208e72[_0x555b('0x87')])||!this[_0x555b('0x84')](_0x208e72[_0x555b('0x88')])){return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0x115'));}if(!this[_0x555b('0x84')](_0x208e72[_0x555b('0x5b')])){return this[_0x555b('0xe')]['noop'](_0x555b('0xb9'));}this['channel']['noop'](util[_0x555b('0x28')]('Trying\x20aws\x20Polly\x20%s',_0x208e72[_0x555b('0x5b')]));var _0x4bed53=this[_0x555b('0x86')][_0x555b('0x71')](this,_0x208e72);if(_0x4bed53){this[_0x555b('0xe')][_0x555b('0xb1')](util['format'](_0x555b('0x116'),_0x4bed53));var _0x4225bf=this[_0x555b('0xe')][_0x555b('0x117')](_0x4bed53);try{fs[_0x555b('0xf4')](_0x4bed53+_0x555b('0x118'));}catch(_0x29a3f8){logger[_0x555b('0x2b')](_0x29a3f8);}return _0x4225bf;}return this[_0x555b('0xe')][_0x555b('0x2b')](_0x208e72,_0x555b('0x119'));};AGIVertices[_0x555b('0x10')][_0x555b('0x11a')]=function(_0x3e2b50){logger['info'](util[_0x555b('0x28')](_0x555b('0x11b'),_0x3e2b50[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x3e2b50[_0x555b('0x87')])||!this[_0x555b('0x84')](_0x3e2b50['aws_secret_access_key'])){return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0x115'));}if(!this[_0x555b('0x84')](_0x3e2b50['aws_bot_name'])){return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0x11c'));}if(!this[_0x555b('0x84')](_0x3e2b50[_0x555b('0x5b')])){return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0xb9'));}this[_0x555b('0xe')][_0x555b('0xf0')]=!![];this[_0x555b('0x36')](_0x3e2b50);this[_0x555b('0xe3')](_0x3e2b50[_0x555b('0x5b')],'in');this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0x11d'),_0x3e2b50[_0x555b('0x5b')]));var _0x35cf19=this[_0x555b('0x8b')][_0x555b('0x71')](this,_0x3e2b50);if(_0x35cf19){for(var _0x1d9ddf in _0x35cf19){if(_0x35cf19[_0x555b('0x99')](_0x1d9ddf)&&_[_0x555b('0x95')](_0x35cf19[_0x1d9ddf])){this[_0x555b('0xe')]['setVariable'](util['format'](_0x555b('0x11e'),_0x1d9ddf[_0x555b('0x6b')]()),_0x35cf19[_0x1d9ddf]);}}if(_[_0x555b('0x41')](_0x35cf19[_0x555b('0x11f')])){return this['channel']['noop'](_0x555b('0x120'));}else{this['createSquareMessage'](_0x35cf19[_0x555b('0x11f')],'out');return this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0x121'),_0x35cf19[_0x555b('0x11f')]));}}return this['channel'][_0x555b('0x2b')](_0x3e2b50,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x555b('0x10')][_0x555b('0x122')]=function(_0x2344d2){logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x123'),_0x2344d2[_0x555b('0x38')],_0x2344d2['timeout']));if(!this[_0x555b('0x84')](_0x2344d2[_0x555b('0x82')])){return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0xe2'));}var _0xd64ff9='wav';var _0x59d371=util[_0x555b('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0x555b('0x10a')](0x4));var _0x5e5684=util[_0x555b('0x28')](_0x555b('0x9d'),_0x59d371,_0xd64ff9);var _0x1c060=!![];if(_0x2344d2['beep']===_0x555b('0x124')){_0x1c060=![];}var _0x5f24c1=this[_0x555b('0xe')][_0x555b('0x125')](_0x59d371,_0xd64ff9,_0x2344d2['intKey'],_0x2344d2[_0x555b('0x66')],undefined,_0x1c060);if(_0x5f24c1['result']!==-0x1){this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0x126'),_0x5e5684));var _0x158a72=this[_0x555b('0x8e')][_0x555b('0x71')](this,_0x2344d2,_0x5e5684);if(_0x158a72){for(var _0x53ee4f in _0x158a72){if(_0x158a72[_0x555b('0x99')](_0x53ee4f)){this[_0x555b('0xe')]['setVariable'](util[_0x555b('0x28')]('GOOGLE_ASR_%s',_0x53ee4f['toUpperCase']()),_0x158a72[_0x53ee4f]);}}return this[_0x555b('0xe')]['noop'](util[_0x555b('0x28')](_0x555b('0x127'),JSON['stringify'](_0x158a72)));}}return _0x5f24c1;};AGIVertices[_0x555b('0x10')][_0x555b('0x128')]=function(_0x3c664f){logger[_0x555b('0x2d')](util[_0x555b('0x28')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x3c664f[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x3c664f[_0x555b('0x91')])){return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0x129'));}if(!this[_0x555b('0x84')](_0x3c664f[_0x555b('0x92')])){return this[_0x555b('0xe')][_0x555b('0xb1')]('no\x20appsecret\x20configured');}var _0xb9f8b1=_0x555b('0x12a');var _0x4c8214=util['format'](_0x555b('0x12b'),FILES_PATH,rs[_0x555b('0x10a')](0x4));var _0x5bc2bd=util[_0x555b('0x28')](_0x555b('0x9d'),_0x4c8214,_0xb9f8b1);var _0x4daaf0=!![];if(_0x3c664f[_0x555b('0x12c')]===_0x555b('0x124')){_0x4daaf0=![];}var _0x1e159c=this[_0x555b('0xe')]['recordFile'](_0x4c8214,_0xb9f8b1,_0x3c664f[_0x555b('0x12d')],_0x3c664f[_0x555b('0x66')],undefined,_0x4daaf0);if(_0x1e159c[_0x555b('0xa4')]!==-0x1){this['channel'][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0x12e'),_0x5bc2bd));var _0x483041=this[_0x555b('0x90')][_0x555b('0x71')](this,_0x3c664f,_0x5bc2bd);if(_0x483041){for(var _0x11bb07 in _0x483041){if(_0x483041[_0x555b('0x99')](_0x11bb07)){this[_0x555b('0xe')][_0x555b('0x9f')](util[_0x555b('0x28')](_0x555b('0x12f'),_0x11bb07['toUpperCase']()),_0x483041[_0x11bb07]);}}return this[_0x555b('0xe')]['noop'](util[_0x555b('0x28')]('TildeASR\x20Result\x20%s',JSON[_0x555b('0x74')](_0x483041)));}}return _0x1e159c;};AGIVertices['prototype'][_0x555b('0x130')]=function(_0x461487){logger[_0x555b('0x2d')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x461487['label']));return this['channel'][_0x555b('0x131')](_0x461487[_0x555b('0x3c')],_0x461487['extension'],_0x461487[_0x555b('0x3e')]);};AGIVertices[_0x555b('0x10')][_0x555b('0x132')]=function(_0x4f912c){logger['info'](util[_0x555b('0x28')](_0x555b('0x133'),_0x4f912c[_0x555b('0x38')]));if(!this['isConfigured'](_0x4f912c[_0x555b('0x134')])){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x4f912c,_0x555b('0x135'));}try{var _0x34aad8=eval(_0x4f912c[_0x555b('0x134')])?'true':_0x555b('0x136');this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0x137'),_0x4f912c[_0x555b('0x134')],_0x34aad8));return{'code':0xc8,'result':_0x34aad8};}catch(_0x2c2ee5){return{'code':0xc8,'result':_0x555b('0x136')};}};AGIVertices[_0x555b('0x10')][_0x555b('0x138')]=function(_0x524699){logger[_0x555b('0x2d')](util[_0x555b('0x28')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x524699[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x524699[_0x555b('0x139')])){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x524699,_0x555b('0x13a'));}var _0x5131e9=this[_0x555b('0x24')][_0x555b('0x71')](this,_0x524699['interval_id']);if(!_0x5131e9){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x524699,_0x555b('0x13b'));}for(var _0x441e14=0x0;_0x441e14<_0x5131e9[_0x555b('0x9e')];_0x441e14+=0x1){var _0x5d7316=this[_0x555b('0xe')][_0x555b('0xa3')](util['format'](_0x555b('0x13c'),_0x5131e9[_0x441e14]));if(_0x5d7316[_0x555b('0xa4')]===-0x1){return _0x5d7316;}logger['info'](util[_0x555b('0x28')]('IFTIME\x20%s\x20%s',_0x5131e9[_0x441e14],_0x5d7316[_0x555b('0xa1')]));if(_0x5d7316[_0x555b('0xa1')]==='true'){logger['info'](util[_0x555b('0x28')](_0x555b('0x13d'),_0x5131e9[_0x441e14],_0x555b('0x13e')));this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0x13d'),_0x5131e9[_0x441e14],_0x555b('0x13e')));return{'code':0xc8,'result':_0x555b('0x13e')};}else{logger[_0x555b('0x2d')](util['format'](_0x555b('0x13d'),_0x5131e9[_0x441e14],_0x555b('0x136')));this[_0x555b('0xe')][_0x555b('0xb1')](util['format'](_0x555b('0x13d'),_0x5131e9[_0x441e14],'false'));}}return{'code':0xc8,'result':_0x555b('0x136')};};AGIVertices[_0x555b('0x10')][_0x555b('0x13f')]=function(_0x294307){logger[_0x555b('0x2d')](util[_0x555b('0x28')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x294307['label']));return this[_0x555b('0xe')]['hangup']();};AGIVertices[_0x555b('0x10')][_0x555b('0x140')]=function(_0x19b82d){logger[_0x555b('0x2d')](util[_0x555b('0x28')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x19b82d['label']));if(!this[_0x555b('0x84')](_0x19b82d[_0x555b('0x82')])){return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0xe2'));}var _0x9f257a=_0x555b('0x12a');var _0x568311=util[_0x555b('0x28')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x31c7db=util[_0x555b('0x28')](_0x555b('0x9d'),_0x568311,_0x9f257a);var _0x1d4632=!![];if(_0x19b82d['beep']===_0x555b('0x124')){_0x1d4632=![];}var _0x1d4382=this['channel']['recordFile'](_0x568311,_0x9f257a,_0x19b82d[_0x555b('0x12d')],_0x19b82d[_0x555b('0x66')],undefined,_0x1d4632);if(_0x1d4382[_0x555b('0xa4')]!==-0x1){this['channel'][_0x555b('0xb1')](util['format']('ispeech\x20%s\x20file\x20created',_0x31c7db));var _0x5cd9b1=this[_0x555b('0x81')][_0x555b('0x71')](this,_0x19b82d,_0x31c7db);if(_0x5cd9b1){for(var _0x154074 in _0x5cd9b1){if(_0x5cd9b1['hasOwnProperty'](_0x154074)){this[_0x555b('0xe')][_0x555b('0x9f')](util[_0x555b('0x28')](_0x555b('0x141'),_0x154074[_0x555b('0x6b')]()),_0x5cd9b1[_0x154074]);}}return this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')]('IspeechASR\x20Result\x20%s',JSON[_0x555b('0x74')](_0x5cd9b1)));}}return _0x1d4382;};AGIVertices[_0x555b('0x10')][_0x555b('0x142')]=function(_0x583d3f){logger[_0x555b('0x2d')](util[_0x555b('0x28')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x583d3f[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x583d3f[_0x555b('0x82')])){return this[_0x555b('0xe')]['noop']('no\x20key\x20configured');}if(!this[_0x555b('0x84')](_0x583d3f[_0x555b('0x5b')])){return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0xb9'));}this[_0x555b('0xe')]['noop'](util[_0x555b('0x28')]('Trying\x20ispeech\x20TTS\x20%s',_0x583d3f[_0x555b('0x5b')]));var _0x394d98=this[_0x555b('0x7e')][_0x555b('0x71')](this,_0x583d3f);if(_0x394d98){this[_0x555b('0xe')][_0x555b('0xb1')](util['format'](_0x555b('0x143'),_0x394d98));var _0x3199ef=this[_0x555b('0xe')][_0x555b('0x117')](_0x394d98,_0x583d3f[_0x555b('0x12d')]);try{fs['unlink'](_0x394d98+_0x555b('0x118'));}catch(_0x271cae){logger[_0x555b('0x2b')](_0x271cae);}return _0x3199ef;}return this[_0x555b('0xe')][_0x555b('0x2b')](_0x583d3f,_0x555b('0x144'));};AGIVertices[_0x555b('0x10')][_0x555b('0x145')]=function(_0x50a5af){logger['info'](util[_0x555b('0x28')](_0x555b('0x146'),_0x50a5af[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x50a5af[_0x555b('0x147')])){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x50a5af,'no\x20find\x20by\x20configured');}logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x148'),this['channel'][_0x555b('0x4f')],_0x50a5af[_0x555b('0x147')]));var _0x4682c9=this['agentLogin']['sync'](this,_0x50a5af['findBy']);if(_0x4682c9){logger[_0x555b('0x2d')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x555b('0xe')][_0x555b('0x4f')],_0x50a5af['findBy']));this[_0x555b('0xe')][_0x555b('0xb1')](util['format'](_0x555b('0x149'),this['channel'][_0x555b('0x4f')],_0x50a5af[_0x555b('0x147')]));return{'code':0xc8,'result':_0x555b('0x14a')};}else{logger['info'](util['format'](_0x555b('0x14b'),this[_0x555b('0xe')]['callerid'],_0x50a5af[_0x555b('0x147')]));this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x555b('0xe')][_0x555b('0x4f')],_0x50a5af[_0x555b('0x147')]));return{'code':0xc8,'result':_0x555b('0x14c')};}};AGIVertices[_0x555b('0x10')]['logout']=function(_0x6275e6){logger[_0x555b('0x2d')](util[_0x555b('0x28')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x6275e6['label']));if(!this[_0x555b('0x84')](_0x6275e6['findBy'])){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x6275e6,_0x555b('0x14d'));}logger[_0x555b('0x2d')](util['format'](_0x555b('0x148'),this['channel'][_0x555b('0x4f')],_0x6275e6[_0x555b('0x147')]));var _0x2ea2f1=this[_0x555b('0x51')][_0x555b('0x71')](this,_0x6275e6[_0x555b('0x147')]);if(_0x2ea2f1){logger[_0x555b('0x2d')](util[_0x555b('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x555b('0xe')][_0x555b('0x4f')],_0x6275e6[_0x555b('0x147')]));this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x555b('0xe')][_0x555b('0x4f')],_0x6275e6[_0x555b('0x147')]));return{'code':0xc8,'result':'success'};}else{logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x14b'),this['channel']['callerid'],_0x6275e6[_0x555b('0x147')]));this['channel'][_0x555b('0xb1')](util['format'](_0x555b('0x14b'),this[_0x555b('0xe')]['callerid'],_0x6275e6[_0x555b('0x147')]));return{'code':0xc8,'result':_0x555b('0x14c')};}};AGIVertices[_0x555b('0x10')][_0x555b('0x14e')]=function(_0x4af5ad){logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x14f'),_0x4af5ad[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x4af5ad['operation'])){return this[_0x555b('0xe')]['error'](_0x4af5ad,_0x555b('0x150'));}this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0x151'),_0x4af5ad['operation']));var _0x220c4d=eval(_0x4af5ad[_0x555b('0x152')]);if(!this[_0x555b('0x84')](_0x4af5ad[_0x555b('0x108')])){return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0xd1'));}var _0x1e366b=this[_0x555b('0xa3')]['sync'](this,_0x4af5ad[_0x555b('0x108')]);if(!_0x1e366b){return this['channel']['error'](_0x4af5ad,_0x555b('0xd2'));}if(_[_0x555b('0x9a')](_0x220c4d)){var _0x5e6551=this;_0x220c4d['forEach'](function(_0x5e3f8e,_0x4fdc9b){_0x5e6551[_0x555b('0xe')]['setVariable'](util['format'](_0x555b('0x153'),_0x1e366b,_0x4fdc9b),_0x5e3f8e);});return this[_0x555b('0xe')][_0x555b('0xb1')](util['format'](_0x555b('0x154'),_0x1e366b));}else{return this[_0x555b('0xe')][_0x555b('0x9f')](_0x1e366b,_0x220c4d);}};AGIVertices[_0x555b('0x10')][_0x555b('0x155')]=function(_0x131216){logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x156'),_0x131216[_0x555b('0x38')]));if(_0x131216[_0x555b('0xa7')]===0x0){return this['maxRetry'](_0x131216);}_0x131216[_0x555b('0xa7')]-=0x1;if(!this[_0x555b('0x84')](_0x131216['file_id'])){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x131216,_0x555b('0x101'));}var _0x545754=this['getSound']['sync'](this,_0x131216[_0x555b('0x100')]);if(!_0x545754){return this[_0x555b('0xe')]['error'](_0x131216,_0x555b('0x102'));}var _0x37499b=this[_0x555b('0xe')]['getData'](_0x545754,_0x131216['response'],_0x131216[_0x555b('0x157')]);var _0x12542f=_0x37499b[_0x555b('0xa4')];if(_0x37499b['result']===-0x1){this['createSquareDetailsReport'][_0x555b('0x71')](this,_0x131216,'-1');return _0x37499b;}else if(_0x37499b[_0x555b('0xa1')]===_0x555b('0x66')){_0x37499b[_0x555b('0xa4')]=_0x37499b[_0x555b('0xa4')][_0x555b('0x9e')]>0x0?_0x37499b[_0x555b('0xa4')]:'t';}else if(_[_0x555b('0x43')](_0x37499b['result'])){_0x37499b['result']='#';_0x12542f='#';}if(!this[_0x555b('0x84')](_0x131216[_0x555b('0x108')])){this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0xd1'));}else{var _0x2655e0=this[_0x555b('0xa3')]['sync'](this,_0x131216['variable_id']);if(!_0x2655e0){return this[_0x555b('0xe')]['error'](_0x131216,_0x555b('0xd2'));}this[_0x555b('0xe')][_0x555b('0x9f')](_0x2655e0,_0x12542f);}this['createSquareDetailsReport'][_0x555b('0x71')](this,_0x131216,_0x12542f);return _0x37499b;};AGIVertices[_0x555b('0x10')][_0x555b('0xb1')]=function(_0x41163e){logger[_0x555b('0x2d')](util['format'](_0x555b('0x158'),_0x41163e[_0x555b('0x38')]));return this[_0x555b('0xe')]['noop'](_0x41163e[_0x555b('0x159')]||_0x41163e[_0x555b('0x38')]);};AGIVertices[_0x555b('0x10')]['pause']=function(_0x397117){logger['info'](util['format'](_0x555b('0x15a'),_0x397117[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x397117[_0x555b('0x147')])){return this['channel'][_0x555b('0x2b')](_0x397117,_0x555b('0x14d'));}logger['info'](util[_0x555b('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x555b('0xe')]['callerid'],_0x397117[_0x555b('0x147')]));var _0x5683c9=this[_0x555b('0x15b')]['sync'](this,_0x397117[_0x555b('0x15c')]);var _0x141f2f=this['agentPause'][_0x555b('0x71')](this,_0x397117[_0x555b('0x147')],_0x5683c9);if(_0x141f2f){logger[_0x555b('0x2d')](util['format'](_0x555b('0x149'),this['channel'][_0x555b('0x4f')],_0x397117['findBy']));this[_0x555b('0xe')]['noop'](util[_0x555b('0x28')](_0x555b('0x149'),this['channel'][_0x555b('0x4f')],_0x397117[_0x555b('0x147')]));return{'code':0xc8,'result':_0x555b('0x14a')};}else{logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x14b'),this[_0x555b('0xe')][_0x555b('0x4f')],_0x397117[_0x555b('0x147')]));this[_0x555b('0xe')]['noop'](util[_0x555b('0x28')](_0x555b('0x149'),this[_0x555b('0xe')][_0x555b('0x4f')],_0x397117[_0x555b('0x147')]));return{'code':0xc8,'result':_0x555b('0x14c')};}};AGIVertices['prototype']['playback']=function(_0x10e1ad){logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x15d'),_0x10e1ad[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x10e1ad[_0x555b('0x100')])){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x10e1ad,'no\x20file\x20audio\x20selected');}var _0x1020ad=this[_0x555b('0x1d')]['sync'](this,_0x10e1ad['file_id']);if(!_0x1020ad){return this['channel'][_0x555b('0x2b')](_0x10e1ad,_0x555b('0x102'));}var _0x4ed028=this[_0x555b('0xe')]['exec'](_0x555b('0x15e'),[_0x1020ad,_0x10e1ad[_0x555b('0x15f')]]);if(_0x4ed028[_0x555b('0xa4')]===-0x1){return _0x4ed028;}return this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0xb5'),'PLAYBACK',_0x1020ad));};AGIVertices[_0x555b('0x10')][_0x555b('0x160')]=function(_0x5c7b0d){logger['info'](util[_0x555b('0x28')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x5c7b0d['label']));if(!this[_0x555b('0x84')](_0x5c7b0d[_0x555b('0x161')])){return this[_0x555b('0xe')]['error'](_0x5c7b0d,_0x555b('0x162'));}var _0x2d966b='';var _0x147d88=parseInt(_0x5c7b0d['queue_id'],0xa);if(isNaN(_0x147d88)){_0x2d966b=_0x5c7b0d[_0x555b('0x161')];}else{_0x2d966b=this[_0x555b('0x163')][_0x555b('0x71')](this,_0x5c7b0d[_0x555b('0x161')]);if(!_0x2d966b){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x5c7b0d,'no\x20queue\x20found');}}var _0x11faf9='';if(this[_0x555b('0x84')](_0x5c7b0d[_0x555b('0x100')])){var _0x29a595=this[_0x555b('0x1d')][_0x555b('0x71')](this,_0x5c7b0d[_0x555b('0x100')]);if(_0x29a595){_0x11faf9=_0x29a595;}}this[_0x555b('0x36')][_0x555b('0x71')](this,_0x5c7b0d,_0x2d966b);if(_0x5c7b0d[_0x555b('0x15f')][_0x555b('0x164')]('x')<0x0){_0x5c7b0d[_0x555b('0x15f')]+='x';}if(_0x5c7b0d[_0x555b('0x15f')][_0x555b('0x164')]('X')<0x0){_0x5c7b0d[_0x555b('0x15f')]+='X';}this[_0x555b('0xe')][_0x555b('0x9f')]('XMCS-QUEUE',_0x2d966b?_0x2d966b[_0x555b('0x165')]():'');var _0x6b0a77=this[_0x555b('0xe')]['exec']('QUEUE',[_0x2d966b,_0x5c7b0d['opts'],_0x5c7b0d[_0x555b('0x65')],_0x11faf9,_0x5c7b0d[_0x555b('0x66')],_0x5c7b0d[_0x555b('0x9')],_0x5c7b0d[_0x555b('0x166')],_0x5c7b0d[_0x555b('0x167')],'',_0x5c7b0d[_0x555b('0x168')]]);if(_0x6b0a77[_0x555b('0xa4')]===-0x1){return _0x6b0a77;}return this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0xb5'),_0x555b('0x169'),_0x2d966b));};AGIVertices[_0x555b('0x10')][_0x555b('0x16a')]=function(_0x2ab309){logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x16b'),_0x2ab309[_0x555b('0x38')]));var _0x19209a=_0x2ab309[_0x555b('0x16c')]||_0x555b('0x12a');var _0x593363=util['format'](_0x555b('0x16d'),this[_0x555b('0xe')][_0x555b('0x37')],rs['generate'](0x5));var _0x39f1bd=util[_0x555b('0x28')](_0x555b('0x16e'),FILES_PATH,_0x593363,_0x19209a);var _0x3508ff=util[_0x555b('0x28')](_0x555b('0x12b'),FILES_PATH,_0x593363);this['createSquareRecording'][_0x555b('0x71')](this,_0x2ab309,_0x593363,_0x39f1bd);this['channel'][_0x555b('0x9f')]('RECORDING_SAVENAME',_0x593363);logger[_0x555b('0x2d')](_0x555b('0x16f'),_0x3508ff,_0x19209a,_0x2ab309['escape_digits'],_0x2ab309[_0x555b('0x66')]);return this[_0x555b('0xe')][_0x555b('0x125')](_0x3508ff,_0x19209a,_0x2ab309[_0x555b('0x170')],_0x2ab309[_0x555b('0x66')],undefined,!![]);};AGIVertices[_0x555b('0x10')][_0x555b('0x171')]=function(_0x498649){logger['info'](util['format'](_0x555b('0x172'),_0x498649[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x498649[_0x555b('0x65')])){return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0x173'));}var _0x1945e3=this[_0x555b('0x64')][_0x555b('0x71')](this,_0x498649);logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x174'),util[_0x555b('0x175')](_0x1945e3,{'showHidden':![],'depth':null})));if(!this[_0x555b('0x84')](_0x498649[_0x555b('0x108')])){return this[_0x555b('0xe')][_0x555b('0xb1')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x599777=this[_0x555b('0xa3')]['sync'](this,_0x498649[_0x555b('0x108')]);if(!_0x599777){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x498649,'no\x20variable\x20found');}this['channel']['setVariable'](util['format'](_0x555b('0x176'),_0x599777),_0x1945e3[_0x555b('0x77')]?_0x1945e3[_0x555b('0x77')]:_0x555b('0x177'));this[_0x555b('0xe')][_0x555b('0x9f')](util[_0x555b('0x28')](_0x555b('0x178'),_0x599777),_0x1945e3[_0x555b('0x78')]?_0x1945e3['statusMessage']:'OK');if(_0x1945e3[_0x555b('0x75')]){try{this[_0x555b('0x9b')](_0x1945e3['body'],_0x599777);}catch(_0x316c12){logger[_0x555b('0x2b')](util['format'](_0x555b('0x179'),_0x599777));}}return this['channel'][_0x555b('0xb1')](util['format'](_0x555b('0xd6'),_0x599777));};AGIVertices[_0x555b('0x10')]['saydigits']=function(_0x19cb5a){logger['info'](util[_0x555b('0x28')](_0x555b('0x17a'),_0x19cb5a[_0x555b('0x38')]));return this[_0x555b('0xe')]['sayDigits'](_0x19cb5a[_0x555b('0x17b')][_0x555b('0x58')](/\s+/g,''),_0x19cb5a[_0x555b('0x170')]);};AGIVertices[_0x555b('0x10')][_0x555b('0x17c')]=function(_0x5c91d5){logger[_0x555b('0x2d')](util['format'](_0x555b('0x17d'),_0x5c91d5[_0x555b('0x38')]));return this[_0x555b('0xe')][_0x555b('0x17e')](_0x5c91d5[_0x555b('0x17f')][_0x555b('0x58')](/\s+/g,''),_0x5c91d5[_0x555b('0x170')]);};AGIVertices[_0x555b('0x10')][_0x555b('0x180')]=function(_0x424bd9){logger['info'](util['format'](_0x555b('0x181'),_0x424bd9[_0x555b('0x38')]));return this[_0x555b('0xe')][_0x555b('0x182')](_0x424bd9[_0x555b('0x5b')],_0x424bd9[_0x555b('0x170')]);};AGIVertices[_0x555b('0x10')][_0x555b('0x183')]=function(_0x10b37e){logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x184'),_0x10b37e[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x10b37e[_0x555b('0x185')])){return this[_0x555b('0xe')]['noop'](_0x555b('0x186'));}var _0x584abb=this[_0x555b('0x21')][_0x555b('0x71')](this,_0x10b37e['account_id']);if(!_0x584abb||!_0x584abb['Smtp']){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x10b37e,_0x555b('0x187'));}var _0x19afc2={'from':util['format'](_0x555b('0x188'),_0x584abb[_0x555b('0x13')],_0x584abb[_0x555b('0x189')]||_0x584abb['Smtp'][_0x555b('0x18a')]),'to':_0x10b37e['to']||'','cc':_0x10b37e['cc']||'','bcc':_0x10b37e['bcc']||'','subject':_0x10b37e['subject'],'html':_0x10b37e[_0x555b('0x5b')],'text':_0x10b37e['text']};var _0xa7cd41={'tls':{'rejectUnauthorized':![]}};if(_0x584abb[_0x555b('0x18b')][_0x555b('0x18c')]){_0xa7cd41[_0x555b('0x18c')]=_0x584abb[_0x555b('0x18b')]['service'];}else{_0xa7cd41['host']=_0x584abb['Smtp']['host'];_0xa7cd41[_0x555b('0x18d')]=_0x584abb[_0x555b('0x18b')][_0x555b('0x18d')];_0xa7cd41[_0x555b('0x18e')]=_0x584abb[_0x555b('0x18b')][_0x555b('0x18e')];}if(_0x584abb['Smtp'][_0x555b('0x18f')]){_0xa7cd41[_0x555b('0x190')]={'user':_0x584abb['Smtp'][_0x555b('0x18a')],'pass':_0x584abb[_0x555b('0x18b')][_0x555b('0x191')]};}if(this[_0x555b('0x84')](_0x10b37e[_0x555b('0x192')])){}logger['debug']('sendMail\x20message',JSON[_0x555b('0x74')](_0x19afc2));this[_0x555b('0x36')][_0x555b('0x71')](this,_0x10b37e,_0x10b37e[_0x555b('0x185')]);this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0x193'),_0x584abb[_0x555b('0x13')]));this[_0x555b('0x23')][_0x555b('0x71')](this,_0xa7cd41,_0x19afc2);return this['channel']['noop'](_0x555b('0x194'));};AGIVertices['prototype'][_0x555b('0x195')]=function(_0x32ceda){logger[_0x555b('0x2d')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x32ceda[_0x555b('0x38')]));return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0x196'));};AGIVertices[_0x555b('0x10')][_0x555b('0x197')]=function(_0x100b22){logger[_0x555b('0x2d')](util['format'](_0x555b('0x198'),_0x100b22[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x100b22[_0x555b('0x199')])){return this['channel'][_0x555b('0xb1')](_0x555b('0x19a'));}var _0x967534=this['getSmsAccount']['sync'](this,_0x100b22[_0x555b('0x199')]);if(!_0x967534){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x100b22,'no\x20sms\x20account\x20found');}var _0x71ec75={'body':_0x100b22[_0x555b('0x19b')],'phone':_0x100b22['to']||'','SmsAccountId':_0x967534['id']};logger['debug'](_0x555b('0x19c'),JSON[_0x555b('0x74')](_0x71ec75));this[_0x555b('0x36')]['sync'](this,_0x100b22,_0x100b22['sms_account_id']);this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0x19d'),_0x967534[_0x555b('0x13')]));this['createSmsMessage']['sync'](this,_0x71ec75);return this['channel'][_0x555b('0xb1')](_0x555b('0x19e'));};AGIVertices[_0x555b('0x10')][_0x555b('0x19f')]=function(_0x36772){logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x1a0'),_0x36772['label']));if(!this['isConfigured'](_0x36772[_0x555b('0x108')])){return this[_0x555b('0xe')]['error'](_0x36772,'no\x20variable\x20selected');}var _0xffb95=this['getVariable'][_0x555b('0x71')](this,_0x36772[_0x555b('0x108')]);if(!_0xffb95){return this[_0x555b('0xe')]['error'](_0x36772,_0x555b('0xd2'));}return this['channel'][_0x555b('0x9f')](_0xffb95,_0x36772[_0x555b('0x1a1')]);};AGIVertices['prototype'][_0x555b('0x1a2')]=function(_0x141024){logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x1a3'),_0x141024[_0x555b('0x38')]));this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0x1a4'));if(_0x141024[_0x555b('0xaa')]===_0x555b('0x1a5')){this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0x1a6'));return this[_0x555b('0xe')][_0x555b('0xaa')]();}return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0x1a7'));};AGIVertices['prototype'][_0x555b('0x1a8')]=function(_0x4829d2){logger['info'](util[_0x555b('0x28')](_0x555b('0x1a9'),_0x4829d2[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x4829d2[_0x555b('0x1aa')])){return this['channel'][_0x555b('0x2b')](_0x4829d2,_0x555b('0x1ab'));}var _0xd0a357=this['getSquareProject'][_0x555b('0x71')](this,_0x4829d2[_0x555b('0x1aa')]);if(!this[_0x555b('0x84')](_0xd0a357)){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x4829d2,util[_0x555b('0x28')](_0x555b('0x1ac'),_0x4829d2[_0x555b('0x1aa')]));}if(_0xd0a357===this['channel'][_0x555b('0x39')]){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x4829d2,_0x555b('0x1ad'));}this[_0x555b('0x36')][_0x555b('0x71')](this,_0x4829d2,_0xd0a357);var _0x3e2566=this[_0x555b('0xe')][_0x555b('0x57')](_0x555b('0x1ae'),util[_0x555b('0x28')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x555b('0x9')][_0x555b('0x1af')]||'127.0.0.1',_0xd0a357,this[_0x555b('0xe')][_0x555b('0x39')]));if(_0x3e2566[_0x555b('0xa4')]===-0x1){return _0x3e2566;}return this[_0x555b('0xe')]['noop'](util[_0x555b('0x28')](_0x555b('0xb5'),_0x555b('0x1ae'),_0xd0a357));};AGIVertices['prototype'][_0x555b('0x1b0')]=function(_0x205692){logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x1b1'),_0x205692[_0x555b('0x38')]));var _0x43df2e=this['shellCommand']['sync'](this,_0x205692['command']);this[_0x555b('0x36')][_0x555b('0x71')](this,_0x205692,_0x205692[_0x555b('0x1b2')]);if(this[_0x555b('0x84')](_0x205692['variable_id'])){var _0x4270c1=this[_0x555b('0xa3')]['sync'](this,_0x205692[_0x555b('0x108')]);if(_0x4270c1){this['channel'][_0x555b('0x9f')](_0x4270c1,_0x43df2e);return this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0x1b3'),_0x205692[_0x555b('0x1b2')],_0x4270c1));}}return this['channel']['noop'](util[_0x555b('0x28')](_0x555b('0x1b4'),_0x205692[_0x555b('0x1b2')]));};AGIVertices[_0x555b('0x10')]['google_cloud_tts']=function(_0x1cb693){logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x1b5'),_0x1cb693[_0x555b('0x38')]));if(!this['isConfigured'](_0x1cb693[_0x555b('0x5a')])){return this[_0x555b('0xe')][_0x555b('0xb1')]('no\x20apiKey\x20configured');}if(!this[_0x555b('0x84')](_0x1cb693['text'])){return this[_0x555b('0xe')][_0x555b('0xb1')](_0x555b('0xb9'));}this['channel'][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0x1b6'),_0x1cb693[_0x555b('0x5b')]));var _0x565577=this[_0x555b('0x59')]['sync'](this,_0x1cb693);if(_0x565577){this[_0x555b('0xe')]['noop'](util[_0x555b('0x28')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x565577));var _0x1d2179=this['channel'][_0x555b('0x117')](_0x565577);try{fs[_0x555b('0xf4')](_0x565577+_0x555b('0x118'));}catch(_0x441136){logger[_0x555b('0x2b')](_0x441136);}return _0x1d2179;}return this['channel'][_0x555b('0x2b')](_0x1cb693,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x555b('0x1b7')]=function(_0x179296){logger[_0x555b('0x2d')](util[_0x555b('0x28')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x179296[_0x555b('0x38')]));if(!this['isConfigured'](_0x179296[_0x555b('0x5b')])){return this[_0x555b('0xe')]['noop'](_0x555b('0xb9'));}this[_0x555b('0xe')]['noop'](util[_0x555b('0x28')]('Trying\x20Google\x20TTS\x20%s',_0x179296['text']));var _0x2754df=this['googleTTS'][_0x555b('0x71')](this,_0x179296);if(_0x2754df){this['channel'][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0x1b8'),_0x2754df));var _0xc1febe=this['channel'][_0x555b('0x117')](_0x2754df);try{fs[_0x555b('0xf4')](_0x2754df+'.wav');}catch(_0x351b6b){logger['error'](_0x351b6b);}return _0xc1febe;}return this[_0x555b('0xe')]['error'](_0x179296,_0x555b('0x1b9'));};AGIVertices[_0x555b('0x10')]['unpause']=function(_0x23937f){logger['info'](util[_0x555b('0x28')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x23937f[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x23937f[_0x555b('0x147')])){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x23937f,_0x555b('0x14d'));}logger['info'](util['format'](_0x555b('0x148'),this[_0x555b('0xe')][_0x555b('0x4f')],_0x23937f['findBy']));var _0x3ede67=this[_0x555b('0x50')]['sync'](this,_0x23937f[_0x555b('0x147')]);if(_0x3ede67){logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x149'),this['channel']['callerid'],_0x23937f[_0x555b('0x147')]));this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0x149'),this[_0x555b('0xe')][_0x555b('0x4f')],_0x23937f[_0x555b('0x147')]));return{'code':0xc8,'result':_0x555b('0x14a')};}else{logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x14b'),this[_0x555b('0xe')]['callerid'],_0x23937f[_0x555b('0x147')]));this[_0x555b('0xe')]['noop'](util[_0x555b('0x28')](_0x555b('0x14b'),this[_0x555b('0xe')][_0x555b('0x4f')],_0x23937f[_0x555b('0x147')]));return{'code':0xc8,'result':_0x555b('0x14c')};}};AGIVertices['prototype'][_0x555b('0x1ba')]=function(_0x1d36da){logger['info'](util[_0x555b('0x28')](_0x555b('0x1bb'),_0x1d36da[_0x555b('0x38')]));var _0x17c430=this[_0x555b('0xe')][_0x555b('0x57')](_0x555b('0x1bc'),[_0x1d36da[_0x555b('0x1bd')],_0x1d36da[_0x555b('0x7a')]]);if(_0x17c430[_0x555b('0xa4')]===-0x1){return _0x17c430;}return this[_0x555b('0xe')][_0x555b('0xb1')](util[_0x555b('0x28')](_0x555b('0xb5'),_0x555b('0x1bc'),_0x1d36da[_0x555b('0x1bd')]));};AGIVertices[_0x555b('0x10')][_0x555b('0x1be')]=function(_0x5b2ebf){logger[_0x555b('0x2d')](util[_0x555b('0x28')](_0x555b('0x1bf'),_0x5b2ebf[_0x555b('0x38')]));if(!this[_0x555b('0x84')](_0x5b2ebf[_0x555b('0x108')])){return this['channel'][_0x555b('0x2b')](_0x5b2ebf,_0x555b('0x1c0'));}var _0x4ba446=this[_0x555b('0xa3')][_0x555b('0x71')](this,_0x5b2ebf[_0x555b('0x108')]);if(!_0x4ba446){return this[_0x555b('0xe')][_0x555b('0x2b')](_0x5b2ebf,_0x555b('0xd2'));}var _0x9c3648=this[_0x555b('0xe')][_0x555b('0xa3')](_0x4ba446);return{'code':0xc8,'result':_0x9c3648[_0x555b('0xa1')]?_0x9c3648[_0x555b('0xa1')]:'-'};};String['prototype'][_0x555b('0x1c1')]=function(_0x39f47e,_0x315802){return this[_0x555b('0xa0')](_0x39f47e)[_0x555b('0x1c2')](_0x315802);};module[_0x555b('0x1c3')]=AGIVertices; \ No newline at end of file +var _0x087b=['agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','replace','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','restAPI','url','number','timeout','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','Amy','aws_text_type','awsLex','google_asr_language','tildeASR','appid','appsecret','includes','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','length','saveRestApiResult','isArray','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','maxRetry','sync','retry','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','result','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','exec','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','no\x20database\x20selected','odbc_id','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','googleDialogflow','DIALOGFLOW_%s','Dialogflow\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','speech','out','audiofile','streamFile','.wav','SestekNDA\x20Result\x20%s','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','googleASR','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','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','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','bcc','subject','service','host','port','secure','authentication','user','pass','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','tts','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getSound','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','IntervalId','interval','Intervals','getSoundPath','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','random','lastName','isNil','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout'];(function(_0x2cadaa,_0x510634){var _0x269e49=function(_0x27ff80){while(--_0x27ff80){_0x2cadaa['push'](_0x2cadaa['shift']());}};_0x269e49(++_0x510634);}(_0x087b,0x15e));var _0xb087=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x087b[_0x599f41];return _0x2e4d58;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xb087('0x0'));var _=require(_0xb087('0x1'));var sh=require(_0xb087('0x2'));var odbc=require(_0xb087('0x3'))();var rs=require(_0xb087('0x4'));var moment=require(_0xb087('0x5'));var Mustache=require(_0xb087('0x6'));var rp=require(_0xb087('0x7'));var logger=require('../../config/logger')('agi');var config=require('../../config/environment');var scripts=require(_0xb087('0x8'));var FILES_PATH=_0xb087('0x9');var recursiveMapAttributes=[_0xb087('0xa'),_0xb087('0xb')];var verticesWithRetry=[_0xb087('0xc'),_0xb087('0xd'),_0xb087('0xe')];var AGIVertices=function(_0x1aae2a,_0x53b762,_0x48edcb){this[_0xb087('0xf')]=_0x1aae2a;this[_0xb087('0x10')]=_0x53b762;this['mailRpc']=_0x48edcb;};AGIVertices[_0xb087('0x11')][_0xb087('0x12')]=function(_0x34a352,_0x8e04ed){this[_0xb087('0x10')][_0xb087('0x13')](_0x34a352)['then'](function(_0x5bb209){_0x8e04ed(null,_0x5bb209?_0x5bb209[_0xb087('0x14')]:![]);})[_0xb087('0x15')](function(_0x521a8e){_0x8e04ed(_0x521a8e);});};AGIVertices[_0xb087('0x11')][_0xb087('0x16')]=function(_0x4f0120,_0x25f3cc){this[_0xb087('0x10')][_0xb087('0x17')](_0x4f0120)[_0xb087('0x18')](function(_0x2c9091){_0x25f3cc(null,_0x2c9091?_0x2c9091[_0xb087('0x14')]:![]);})['catch'](function(_0x486924){_0x25f3cc(_0x486924);});};AGIVertices[_0xb087('0x11')][_0xb087('0x19')]=function(_0x5e1f69,_0x2ac595){this['rpc'][_0xb087('0x1a')](_0x5e1f69)[_0xb087('0x18')](function(_0x5aac19){_0x2ac595(null,_0x5aac19?_0x5aac19[_0xb087('0x14')]:![]);})[_0xb087('0x15')](function(_0x493a44){_0x2ac595(_0x493a44);});};AGIVertices[_0xb087('0x11')][_0xb087('0x1b')]=function(_0x2796ae,_0x4839e2){this[_0xb087('0x10')]['getSquareOdbcById'](_0x2796ae)['then'](function(_0x22e9ca){_0x4839e2(null,_0x22e9ca?_0x22e9ca[_0xb087('0x1c')]:![]);})['catch'](function(_0x3d011f){_0x4839e2(_0x3d011f);});};AGIVertices[_0xb087('0x11')][_0xb087('0x1d')]=function(_0x2652f6,_0xfee862){this['rpc'][_0xb087('0x1e')](_0x2652f6)[_0xb087('0x18')](function(_0x132873){_0xfee862(null,_0x132873?_0x132873[_0xb087('0x14')]:![]);})['catch'](function(_0x437f2e){_0xfee862(_0x437f2e);});};AGIVertices[_0xb087('0x11')][_0xb087('0x1f')]=function(_0x2f78da,_0xa49048){this['rpc']['getTrunkById'](_0x2f78da)[_0xb087('0x18')](function(_0x16d094){_0xa49048(null,_0x16d094?_0x16d094['name']:![]);})[_0xb087('0x15')](function(_0x4ff085){_0xa49048(_0x4ff085);});};AGIVertices[_0xb087('0x11')][_0xb087('0x20')]=function(_0x2fa122,_0xa76cb2){var _0x4f9c97=this;this['rpc']['getSoundById'](_0x2fa122)['then'](function(_0x1b5bd8){_0xa76cb2(null,_0x1b5bd8?_0x4f9c97['getSoundPath'](_0x1b5bd8[_0xb087('0x21')]):![]);})[_0xb087('0x15')](function(_0x596a5a){_0xa76cb2(_0x596a5a);});};AGIVertices[_0xb087('0x11')][_0xb087('0x22')]=function(_0x4c671d,_0x281fb8){this['rpc'][_0xb087('0x23')](_0x4c671d)[_0xb087('0x18')](function(_0x5795ec){_0x281fb8(null,_0x5795ec?_0x5795ec:![]);})['catch'](function(_0x374572){_0x281fb8(_0x374572);});};AGIVertices[_0xb087('0x11')][_0xb087('0x24')]=function(_0x117ba6,_0x2442b2,_0xa1bd6d){this[_0xb087('0x25')][_0xb087('0x24')](_0x117ba6,_0x2442b2)[_0xb087('0x18')](function(){_0xa1bd6d(null);})[_0xb087('0x15')](function(_0x2f2756){_0xa1bd6d(_0x2f2756);});};AGIVertices['prototype']['getIntervals']=function(_0x8bcd44,_0x26cca2){this[_0xb087('0x10')]['getIntervalById'](_0x8bcd44)['then'](function(_0x22f8c0){if(_0x22f8c0){if(_0x22f8c0[_0xb087('0x26')]){_0x26cca2(null,[_0x22f8c0[_0xb087('0x27')]]);}else{_0x26cca2(null,_['map'](_0x22f8c0[_0xb087('0x28')],_0xb087('0x27')));}}else{_0x26cca2(null,![]);}})[_0xb087('0x15')](function(_0x1a18fe){_0x26cca2(_0x1a18fe);});};AGIVertices[_0xb087('0x11')][_0xb087('0x29')]=function(_0x583bf4){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x583bf4);};AGIVertices['prototype']['getQueryOdbc']=function(_0x161473,_0x59a6d4,_0x10a5f8){odbc[_0xb087('0x2a')](_0x161473,function(_0x54f2ed){if(_0x54f2ed){logger[_0xb087('0x2b')](_0xb087('0x2c'),_0x54f2ed);_0x10a5f8(_0x54f2ed);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0xb087('0x2d')](_0x59a6d4,function(_0x1d7403,_0x2edb35){if(_0x1d7403){logger[_0xb087('0x2e')](_0xb087('0x2f'),_0x59a6d4);_0x10a5f8(_0x1d7403);}else{logger[_0xb087('0x2e')](_0xb087('0x30'),_0x59a6d4);odbc['close'](function(_0x31f7ab){if(_0x31f7ab){logger['error'](_0xb087('0x31'),_0x31f7ab);}_0x10a5f8(null,_0x2edb35);});}});}});};AGIVertices[_0xb087('0x11')][_0xb087('0x32')]=function(_0x5a037d,_0x283798){this[_0xb087('0x10')][_0xb087('0x33')](_0x5a037d)[_0xb087('0x18')](function(_0x3ee2f0){_0x283798(null,_0x3ee2f0?_0x3ee2f0:![]);})[_0xb087('0x15')](function(_0x467b62){_0x283798(_0x467b62);});};AGIVertices[_0xb087('0x11')][_0xb087('0x34')]=function(_0x9d4a6f,_0x575864){this[_0xb087('0x10')][_0xb087('0x34')](_0x9d4a6f)['then'](function(_0x66c2d){_0x575864(null,_0x66c2d);})[_0xb087('0x15')](function(_0x45c3ab){_0x575864(_0x45c3ab);});};AGIVertices['prototype'][_0xb087('0x35')]=function(_0x3250f9,_0x550dbc,_0x50c108){this[_0xb087('0x10')][_0xb087('0x35')]({'uniqueid':this['channel'][_0xb087('0x36')],'node':_0x3250f9[_0xb087('0x37')],'application':_0x3250f9[_0xb087('0x38')],'data':_0x550dbc||null,'project_name':this['channel'][_0xb087('0x39')],'callerid':this[_0xb087('0xf')][_0xb087('0x3a')]})['then'](function(_0x40167f){if(_0x50c108){_0x50c108(null,_0x40167f);}})['catch'](function(_0x3c9da6){if(_0x50c108){_0x50c108(_0x3c9da6);}});};AGIVertices[_0xb087('0x11')][_0xb087('0x3b')]=function(_0x45e0dc,_0x147074,_0x55e651,_0xcbb15b){this[_0xb087('0x10')][_0xb087('0x3b')]({'uniqueid':this[_0xb087('0xf')]['uniqueid'],'callerid':this[_0xb087('0xf')]['callerid'],'calleridname':this[_0xb087('0xf')][_0xb087('0x3c')],'context':this['channel'][_0xb087('0x3d')],'extension':this[_0xb087('0xf')][_0xb087('0x3e')],'priority':this[_0xb087('0xf')][_0xb087('0x3f')],'accountcode':this[_0xb087('0xf')][_0xb087('0x40')],'dnid':this[_0xb087('0xf')][_0xb087('0x41')],'projectName':this[_0xb087('0xf')][_0xb087('0x39')],'saveName':_0x147074,'filename':_0x45e0dc[_0xb087('0x42')]||_0x147074,'savePath':_0x55e651})[_0xb087('0x18')](function(_0x1e0d2f){_0xcbb15b(null,_0x1e0d2f);})[_0xb087('0x15')](function(_0x5b87d7){_0xcbb15b(_0x5b87d7);});};AGIVertices[_0xb087('0x11')][_0xb087('0x43')]=function(_0x19ff76,_0x32bff1,_0x346423){this['rpc'][_0xb087('0x43')]({'uniqueid':this[_0xb087('0xf')]['uniqueid'],'body':_0x19ff76,'direction':_0x32bff1})[_0xb087('0x18')](function(_0x154c4b){if(_0x346423){_0x346423(null,_0x154c4b);}})['catch'](function(_0x45b4f5){if(_0x346423){_0x346423(_0x45b4f5);}});};AGIVertices[_0xb087('0x11')][_0xb087('0x44')]=function(_0x5c6b61,_0x51ebc9){this['rpc']['createCmContact']({'firstName':_[_0xb087('0x45')](_0x5c6b61['name'])||_['isNil'](_0x5c6b61[_0xb087('0x14')])?'callback_'+Math[_0xb087('0x46')]():_0x5c6b61['name'],'lastName':_['isEmpty'](_0x5c6b61[_0xb087('0x47')])||_[_0xb087('0x48')](_0x5c6b61[_0xb087('0x47')])?null:_0x5c6b61[_0xb087('0x47')],'phone':_0x5c6b61[_0xb087('0x49')],'ListId':_0x5c6b61[_0xb087('0x4a')],'scheduledat':_0x5c6b61[_0xb087('0x4b')],'callbackUniqueid':this[_0xb087('0xf')][_0xb087('0x36')],'tags':_0xb087('0x4c'),'description':'Callback\x20scheduled\x20at\x20'+_0x5c6b61[_0xb087('0x4b')][_0xb087('0x4d')](),'priority':_0x5c6b61[_0xb087('0x4e')]})['then'](function(_0x264a00){_0x51ebc9(null,_0x264a00);})[_0xb087('0x15')](function(_0x4c1102){_0x51ebc9(_0x4c1102);});};AGIVertices[_0xb087('0x11')][_0xb087('0x4f')]=function(_0x591b67,_0x5c103b){this[_0xb087('0x10')][_0xb087('0x50')](_0x591b67)['then'](function(_0x4525fc){_0x5c103b(null,_0x4525fc?_0x4525fc['name']:![]);})[_0xb087('0x15')](function(_0x2f434d){_0x5c103b(_0x2f434d);});};AGIVertices['prototype'][_0xb087('0x51')]=function(_0x4d4ac9,_0x4b3f02,_0x43eff5){var _0x58059e={'role':_0xb087('0x52')};_0x58059e[_0x4d4ac9]=this['channel'][_0xb087('0x3a')];this[_0xb087('0x10')]['agentPause'](_0x58059e,_0x4b3f02,this['channel']['uniqueid'])[_0xb087('0x18')](function(_0x49ce76){_0x43eff5(null,_[_0xb087('0x48')](_0x49ce76)?![]:!![]);})[_0xb087('0x15')](function(_0x3a0821){logger[_0xb087('0x2b')](_0x3a0821);_0x43eff5(null,![]);});};AGIVertices[_0xb087('0x11')][_0xb087('0x53')]=function(_0x479680,_0x587091){var _0x247a94={'role':'agent'};_0x247a94[_0x479680]=this['channel'][_0xb087('0x3a')];this[_0xb087('0x10')][_0xb087('0x53')](_0x247a94)[_0xb087('0x18')](function(_0x163829){_0x587091(null,_[_0xb087('0x48')](_0x163829)?![]:!![]);})[_0xb087('0x15')](function(_0x121287){logger[_0xb087('0x2b')](_0x121287);_0x587091(null,![]);});};AGIVertices[_0xb087('0x11')]['agentLogout']=function(_0x40d5f6,_0x33a9c3){var _0x565eb3={'role':'agent'};_0x565eb3[_0x40d5f6]=this['channel']['callerid'];this[_0xb087('0x10')][_0xb087('0x54')](_0x565eb3)[_0xb087('0x18')](function(_0xf9ead5){_0x33a9c3(null,_[_0xb087('0x48')](_0xf9ead5)?![]:!![]);})[_0xb087('0x15')](function(_0x58958a){logger[_0xb087('0x2b')](_0x58958a);_0x33a9c3(null,![]);});};AGIVertices['prototype'][_0xb087('0x55')]=function(_0x17f87e,_0x52d754){var _0x3f9c73={'role':'agent'};_0x3f9c73[_0x17f87e]=this[_0xb087('0xf')][_0xb087('0x3a')];var _0x5a7ded=_0x17f87e!=_0xb087('0x56')?util[_0xb087('0x57')](_0xb087('0x58'),_0xb087('0x59'),this[_0xb087('0xf')][_0xb087('0x3a')]):undefined;this['rpc'][_0xb087('0x55')](_0x3f9c73,_0x5a7ded)[_0xb087('0x18')](function(_0x2e33f4){_0x52d754(null,_[_0xb087('0x48')](_0x2e33f4)?![]:!![]);})[_0xb087('0x15')](function(_0x3da3e7){logger[_0xb087('0x2b')](_0x3da3e7);_0x52d754(null,![]);});};AGIVertices[_0xb087('0x11')]['shellCommand']=function(_0x503242,_0x159c96){sh['exec'](_['trim'](_0x503242),function(_0x26775f,_0x3f834b){var _0x217d57=_0x3f834b[_0xb087('0x5a')](/(\r\n|\n|\r)/gm,'');_0x159c96(null,_0x217d57);});};AGIVertices[_0xb087('0x11')]['googleCloudTTS']=function(_0x117618,_0x3d82e8){scripts['googleCloudTTS'](_0x117618['apiKey'],_0x117618[_0xb087('0x5b')]||_0xb087('0x5c'),_0x117618[_0xb087('0x5c')],_0x117618[_0xb087('0x5d')]||'en-US',_0x117618[_0xb087('0x5e')]||_0xb087('0x5f'),_0x117618[_0xb087('0x60')]||_0xb087('0x61'))[_0xb087('0x18')](function(_0x150cfb){_0x3d82e8(null,_0x150cfb);})[_0xb087('0x15')](function(_0x48d2de){_0x3d82e8(_0x48d2de);});};AGIVertices[_0xb087('0x11')]['googleTTS']=function(_0x1b0d8,_0xbf22e1){scripts['googleTTS'](_0x1b0d8['text'],_0x1b0d8['google_tts_language']||'en',0x1)[_0xb087('0x18')](function(_0x35f40c){_0xbf22e1(null,_0x35f40c);})['catch'](function(_0x412b33){_0xbf22e1(_0x412b33);});};AGIVertices[_0xb087('0x11')][_0xb087('0x62')]=function(_0xdc10c9,_0x304149){var _0x3e929f={'uri':_0xdc10c9[_0xb087('0x63')],'method':_0xdc10c9['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xdc10c9['timeout'])===_0xb087('0x64')&&parseInt(_0xdc10c9[_0xb087('0x65')])>=0x1?parseInt(_0xdc10c9[_0xb087('0x65')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xb087('0x66'),_0xb087('0x67')],_0x3e929f['method'][_0xb087('0x68')]())){try{_0x3e929f[_0xb087('0x69')]=_0xdc10c9[_0xb087('0xb')]?JSON[_0xb087('0x6a')](_0xdc10c9[_0xb087('0xb')]):{};}catch(_0x315042){logger['error'](_0xb087('0x6b'),_0x315042);}}try{_0x3e929f[_0xb087('0x6c')]=_0xdc10c9[_0xb087('0xa')]?JSON[_0xb087('0x6a')](_0xdc10c9[_0xb087('0xa')]):{};}catch(_0x4957f2){logger['error'](_0xb087('0x6d'),_0x4957f2);}if(_0xdc10c9[_0xb087('0x6e')]){try{var _0x3d615f=require(_0xdc10c9['computedVariables'])['sync'](this,_0x3e929f);_0x3e929f[_0xb087('0x6f')]=Mustache['render'](_0xdc10c9['url'],_0x3d615f,{},['$$','$$']);if(_0x3e929f[_0xb087('0x6c')]){_0x3e929f['headers']=JSON['parse'](Mustache[_0xb087('0x70')](JSON['stringify'](_0x3e929f[_0xb087('0x6c')]),_0x3d615f,{},['$$','$$']));}if(_0x3e929f[_0xb087('0x69')]){_0x3e929f[_0xb087('0x69')]=JSON['parse'](Mustache[_0xb087('0x70')](JSON[_0xb087('0x71')](_0x3e929f['body']),_0x3d615f,{},['$$','$$']));}}catch(_0x3307d2){logger[_0xb087('0x2b')](_0xb087('0x72'),_0x3307d2);}}rp(_0x3e929f)[_0xb087('0x18')](function(_0x3154f2){var _0x531289={'statusCode':_0x3154f2[_0xb087('0x73')]||0xc8,'statusMessage':_0x3154f2[_0xb087('0x74')]||'OK','headers':_0x3154f2['headers']||{},'body':_0x3154f2['body']||{}};_0x304149(null,_0x531289);})['catch'](function(_0x1903ed){var _0x3520df={'statusCode':_0x1903ed[_0xb087('0x73')]||0x1f4,'statusMessage':_0x1903ed[_0xb087('0x75')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x1903ed[_0xb087('0x76')][_0xb087('0x6c')]||{},'body':_0x1903ed[_0xb087('0x76')][_0xb087('0x69')]||{}};_0x304149(null,_0x3520df);});};AGIVertices[_0xb087('0x11')]['googleDialogflow']=function(_0xc28ad1,_0x1b96bd){scripts['googleDialogflow'](this[_0xb087('0xf')]['uniqueid'],_0xc28ad1[_0xb087('0x77')],_0xc28ad1[_0xb087('0x5c')],_0xc28ad1[_0xb087('0x78')]||'en')[_0xb087('0x18')](function(_0x2e06e7){_0x1b96bd(null,_0x2e06e7);})[_0xb087('0x15')](function(_0xf613e8){_0x1b96bd(_0xf613e8);});};AGIVertices[_0xb087('0x11')][_0xb087('0x79')]=function(_0x28ad2a,_0x51ef3a){scripts[_0xb087('0x79')](this['channel'],_0x28ad2a)[_0xb087('0x18')](function(_0x2ec8f4){_0x51ef3a(null,_0x2ec8f4);})[_0xb087('0x15')](function(_0x3b5524){_0x51ef3a(_0x3b5524);});};AGIVertices['prototype'][_0xb087('0x7a')]=function(_0x2e6646,_0x17969f){scripts[_0xb087('0x7a')](_0x2e6646[_0xb087('0x77')],_0x2e6646[_0xb087('0x5c')],_0x2e6646[_0xb087('0x7b')]||_0xb087('0x7c'),_0x2e6646[_0xb087('0x7d')])[_0xb087('0x18')](function(_0x5d4dc9){_0x17969f(null,_0x5d4dc9);})[_0xb087('0x15')](function(_0x555fcb){_0x17969f(_0x555fcb);});};AGIVertices[_0xb087('0x11')][_0xb087('0x7e')]=function(_0x4b99b7,_0x40bf7a,_0x1f2243){scripts[_0xb087('0x7e')](_0x40bf7a,_0x4b99b7['key'],_0x4b99b7[_0xb087('0x7f')]||_0xb087('0x7c'),this[_0xb087('0x80')](_0x4b99b7[_0xb087('0x81')])?_0x4b99b7[_0xb087('0x81')]:undefined)['then'](function(_0x481de4){_0x1f2243(null,_0x481de4);})['catch'](function(_0x468dcb){_0x1f2243(_0x468dcb);});};AGIVertices[_0xb087('0x11')][_0xb087('0x82')]=function(_0xef40c7,_0x166eeb){scripts[_0xb087('0x82')](_0xef40c7[_0xb087('0x83')],_0xef40c7[_0xb087('0x84')],_0xef40c7['aws_polly_region'],_0xef40c7['aws_polly_voice']||_0xb087('0x85'),_0xef40c7[_0xb087('0x5c')],_0xef40c7[_0xb087('0x86')]||_0xb087('0x5c'))[_0xb087('0x18')](function(_0x2c0873){_0x166eeb(null,_0x2c0873);})[_0xb087('0x15')](function(_0x58da89){_0x166eeb(_0x58da89);});};AGIVertices[_0xb087('0x11')][_0xb087('0x87')]=function(_0x178d5e,_0x45c432){scripts[_0xb087('0x87')](this[_0xb087('0xf')][_0xb087('0x36')],_0x178d5e[_0xb087('0x83')],_0x178d5e[_0xb087('0x84')],_0x178d5e['aws_lex_region'],_0x178d5e[_0xb087('0x5c')],_0x178d5e['aws_bot_name'])['then'](function(_0x2f8629){_0x45c432(null,_0x2f8629);})[_0xb087('0x15')](function(_0x1f0cb3){_0x45c432(_0x1f0cb3);});};AGIVertices['prototype']['googleASR']=function(_0xfd6f04,_0x4ca484,_0x307ea0){scripts['googleASR'](_0x4ca484,_0xfd6f04[_0xb087('0x77')],_0xfd6f04[_0xb087('0x88')]||_0xb087('0x7c'))[_0xb087('0x18')](function(_0x947af4){_0x307ea0(null,_0x947af4);})[_0xb087('0x15')](function(_0x182379){_0x307ea0(_0x182379);});};AGIVertices[_0xb087('0x11')][_0xb087('0x89')]=function(_0x1c95a6,_0x112a60,_0x33dd66){scripts[_0xb087('0x89')](_0x112a60,_0x1c95a6[_0xb087('0x8a')],_0x1c95a6[_0xb087('0x8b')],_0x1c95a6[_0xb087('0x6f')])['then'](function(_0x52d393){_0x33dd66(null,_0x52d393);})[_0xb087('0x15')](function(_0x40fc2d){_0x33dd66(_0x40fc2d);});};AGIVertices[_0xb087('0x11')]['clear']=function(_0x37e417){var _0x577041=_[_0xb087('0x8c')](verticesWithRetry,_0x37e417[_0xb087('0x38')])?_0x37e417:_['clone'](_0x37e417);for(var _0x3bf40a in _0x577041){if(_0x577041['hasOwnProperty'](_0x3bf40a)){if(_0x577041[_0x3bf40a]&&_[_0xb087('0x8d')](_0x577041[_0x3bf40a])){if(_[_0xb087('0x8c')](recursiveMapAttributes,_0x3bf40a)){_0x577041[_0x3bf40a]=this[_0xb087('0x8e')](_0x577041[_0x3bf40a]);}else{_0x577041[_0x3bf40a]=this[_0xb087('0x8f')](_0x577041[_0x3bf40a]);}}}}return _0x577041;};AGIVertices['prototype'][_0xb087('0x90')]=function(_0x22cce7){for(var _0x5170f6 in _0x22cce7){if(_0x22cce7[_0xb087('0x91')](_0x5170f6)){if(_[_0xb087('0x92')](_0x22cce7[_0x5170f6])){this[_0xb087('0x90')](_0x22cce7[_0x5170f6]);}else if(_['isArray'](_0x22cce7[_0x5170f6])){for(var _0x3ca825=0x0;_0x3ca825<_0x22cce7[_0x5170f6][_0xb087('0x93')];_0x3ca825++){this[_0xb087('0x90')](_0x22cce7[_0x5170f6][_0x3ca825]);}}else if(_[_0xb087('0x8d')](_0x22cce7[_0x5170f6])){_0x22cce7[_0x5170f6]=this[_0xb087('0x8f')](_0x22cce7[_0x5170f6]);}}}};AGIVertices[_0xb087('0x11')][_0xb087('0x94')]=function(_0x11aefb,_0x929f83){for(var _0x103d0c in _0x11aefb){if(_0x11aefb[_0xb087('0x91')](_0x103d0c)){if(_['isPlainObject'](_0x11aefb[_0x103d0c])){if(!_[_0xb087('0x45')](_0x11aefb[_0x103d0c])){this[_0xb087('0x94')](_0x11aefb[_0x103d0c],util[_0xb087('0x57')]('%s.%s',_0x929f83,_0x103d0c));}}else if(_[_0xb087('0x95')](_0x11aefb[_0x103d0c])){for(var _0x192da6=0x0;_0x192da6<_0x11aefb[_0x103d0c]['length'];_0x192da6++){this['saveRestApiResult'](_0x11aefb[_0x103d0c][_0x192da6],util['format'](_0xb087('0x96'),_0x929f83,_0x103d0c+'['+_0x192da6+']'));}}else{if(!_[_0xb087('0x48')](_0x11aefb[_0x103d0c])){this['channel'][_0xb087('0x97')](util['format'](_0xb087('0x96'),_0x929f83,_0x103d0c),_0x11aefb[_0x103d0c]);}}}}};AGIVertices[_0xb087('0x11')][_0xb087('0x8e')]=function(_0xa54031){try{var _0x43451b=JSON['parse'](_0xa54031);this[_0xb087('0x90')](_0x43451b);return JSON[_0xb087('0x71')](_0x43451b);}catch(_0x3203c4){return this[_0xb087('0x8f')](_0xa54031);}};AGIVertices[_0xb087('0x11')]['replaceAllVariables']=function(_0x1bea96){var _0x56b9ef=_0x1bea96[_0xb087('0x98')]('{');for(var _0x85f651=0x1;_0x85f651<_0x56b9ef[_0xb087('0x93')];_0x85f651+=0x1){var _0x445325=_0x56b9ef[_0x85f651][_0xb087('0x98')]('}');if(_0x445325[_0xb087('0x93')]>0x1){_0x1bea96=_0x1bea96[_0xb087('0x99')]('{'+_0x445325[0x0]+'}',this[_0xb087('0xf')][_0xb087('0x12')](_0x445325[0x0])[_0xb087('0x9a')]||_0x445325[0x0]);}}if(_0x56b9ef[_0xb087('0x93')]===0x1){return _0x1bea96[_0xb087('0x4d')]();}return this[_0xb087('0x8f')](_0x1bea96);};AGIVertices[_0xb087('0x11')][_0xb087('0x9b')]=function(_0xc37f0,_0x6bec70){var _0x1a7f29=this[_0xb087('0xf')][_0xb087('0x12')](_0xc37f0);if(_0x1a7f29['result']===-0x1){return _0x1a7f29;}logger['info'](util[_0xb087('0x57')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x6bec70,_0x1a7f29[_0xb087('0x9a')]));return this[_0xb087('0xf')][_0xb087('0x97')](_0x6bec70,_0x1a7f29['extra']);};AGIVertices[_0xb087('0x11')]['isConfigured']=function(_0x121af4){return _0x121af4&&_0x121af4!=='0'&&_0x121af4!=='-1'&&_0x121af4!=='';};AGIVertices[_0xb087('0x11')][_0xb087('0x9c')]=function(_0x21c1bf){this[_0xb087('0x35')][_0xb087('0x9d')](this,_0x21c1bf,'-');_0x21c1bf[_0xb087('0x9e')]=_0x21c1bf[_0xb087('0x9c')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xb087('0x9f')]=function(_0x2c40cf){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0xa0'),_0x2c40cf['label']));return this[_0xb087('0xf')][_0xb087('0x9f')]([_0x2c40cf[_0xb087('0xa1')],_0x2c40cf[_0xb087('0xa2')]]);};AGIVertices[_0xb087('0x11')][_0xb087('0xa3')]=function(_0x34b8a6){logger['info'](util[_0xb087('0x57')](_0xb087('0xa4'),_0x34b8a6['label']));if(this[_0xb087('0x80')](_0x34b8a6[_0xb087('0x65')])){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0xa5'),_0x34b8a6[_0xb087('0x65')]));var _0x43ee22=this[_0xb087('0xf')][_0xb087('0xa6')](_0x34b8a6[_0xb087('0x65')]);if(_0x43ee22[_0xb087('0xa7')]===-0x1){return _0x43ee22;}}return this[_0xb087('0xf')][_0xb087('0xa3')]();};AGIVertices[_0xb087('0x11')][_0xb087('0x4c')]=function(_0x18032d){logger['info'](util['format'](_0xb087('0xa8'),_0x18032d['label']));if(!this[_0xb087('0x80')](_0x18032d[_0xb087('0x4a')])){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x18032d,_0xb087('0xa9'));}_0x18032d['scheduledAt']=moment();if(this[_0xb087('0x80')](_0x18032d[_0xb087('0xaa')])){_0x18032d[_0xb087('0x4b')]=moment()[_0xb087('0xab')](_0x18032d[_0xb087('0xaa')],_0xb087('0xac'));}if(!this[_0xb087('0x80')](_0x18032d[_0xb087('0x4e')])){_0x18032d[_0xb087('0x4e')]=0x2;}this[_0xb087('0x44')][_0xb087('0x9d')](this,_0x18032d);return this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0xae'),_0x18032d[_0xb087('0x49')],_0x18032d['list_id'],_0x18032d[_0xb087('0x4b')]));};AGIVertices['prototype'][_0xb087('0xaf')]=function(_0x29764b){logger['info'](util[_0xb087('0x57')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x29764b[_0xb087('0x37')]));var _0x18eebd=this[_0xb087('0xf')][_0xb087('0xb0')](_0x29764b[_0xb087('0xb1')],_0x29764b['options']);if(_0x18eebd[_0xb087('0xa7')]===-0x1){return _0x18eebd;}return this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0xb2'),_0x29764b['application'],_0x29764b['options']));};AGIVertices[_0xb087('0x11')]['lumenvoxtts']=function(_0x1c701f){logger['info'](util[_0xb087('0x57')](_0xb087('0xb3'),_0x1c701f['label']));if(!this[_0xb087('0x80')](_0x1c701f[_0xb087('0x5c')])){return this[_0xb087('0xf')]['noop'](_0xb087('0xb4'));}var _0x5ca1a0='\x22'+_0x1c701f[_0xb087('0x5c')]+'\x22';if(this['isConfigured'](_0x1c701f['options'])){_0x5ca1a0+=','+_0x1c701f[_0xb087('0x76')];}var _0x4c9d32=this[_0xb087('0xf')][_0xb087('0xb0')](_0xb087('0xb5'),_0x5ca1a0);if(_0x4c9d32['result']===-0x1){return _0x4c9d32;}return this[_0xb087('0xf')][_0xb087('0xad')](util['format'](_0xb087('0xb6'),_0x5ca1a0));};AGIVertices['prototype'][_0xb087('0xb7')]=function(_0xdcc235){logger['info'](util[_0xb087('0x57')](_0xb087('0xb8'),_0xdcc235[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0xdcc235[_0xb087('0x5c')])){return this[_0xb087('0xf')]['noop'](_0xb087('0xb4'));}var _0x1ec6dc='\x22'+_0xdcc235[_0xb087('0x5c')]+'\x22';if(this[_0xb087('0x80')](_0xdcc235[_0xb087('0x76')])){_0x1ec6dc+=','+_0xdcc235[_0xb087('0x76')];}var _0x239f35=this[_0xb087('0xf')][_0xb087('0xb0')](_0xb087('0xb5'),_0x1ec6dc);if(_0x239f35[_0xb087('0xa7')]===-0x1){return _0x239f35;}return this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1ec6dc));};AGIVertices[_0xb087('0x11')][_0xb087('0xb9')]=function(_0x1e46c2){logger[_0xb087('0x2e')](util[_0xb087('0x57')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x1e46c2[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0x1e46c2[_0xb087('0xba')])){return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0xbb'));}var _0x4fb7da=_0x1e46c2[_0xb087('0xba')];if(this[_0xb087('0x80')](_0x1e46c2[_0xb087('0x76')])){_0x4fb7da+=','+_0x1e46c2[_0xb087('0x76')];}var _0x2dbf30=this[_0xb087('0xf')][_0xb087('0xb0')](_0xb087('0xbc'),_0x4fb7da);if(_0x2dbf30[_0xb087('0xa7')]===-0x1){return _0x2dbf30;}var _0x3fc0a3=this[_0xb087('0x9b')](_0xb087('0xbd'),_0xb087('0xbe'));if(_0x3fc0a3[_0xb087('0xa7')]===-0x1){return _0x3fc0a3;}var _0x23ff68=this[_0xb087('0x9b')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x23ff68[_0xb087('0xa7')]===-0x1){return _0x23ff68;}var _0x50f114=this[_0xb087('0x9b')](_0xb087('0xbf'),_0xb087('0xc0'));if(_0x50f114[_0xb087('0xa7')]===-0x1){return _0x50f114;}return this['channel']['noop'](util[_0xb087('0x57')](_0xb087('0xc1'),_0x4fb7da));};AGIVertices[_0xb087('0x11')][_0xb087('0xc2')]=function(_0x3fef71){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0xc3'),_0x3fef71[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0x3fef71[_0xb087('0xba')])){return this['channel']['noop'](_0xb087('0xbb'));}var _0x4eb195=_0x3fef71[_0xb087('0xba')];if(this[_0xb087('0x80')](_0x3fef71[_0xb087('0x76')])){_0x4eb195+=','+_0x3fef71[_0xb087('0x76')];}var _0x1224d1=this[_0xb087('0xf')][_0xb087('0xb0')](_0xb087('0xbc'),_0x4eb195);if(_0x1224d1[_0xb087('0xa7')]===-0x1){return _0x1224d1;}var _0x5ee24a=this['getAndSetVariable'](_0xb087('0xbd'),_0xb087('0xc4'));if(_0x5ee24a[_0xb087('0xa7')]===-0x1){return _0x5ee24a;}var _0x1f1aad=this[_0xb087('0x9b')](_0xb087('0xc5'),_0xb087('0xc6'));if(_0x1f1aad[_0xb087('0xa7')]===-0x1){return _0x1f1aad;}var _0x5bb6a0=this[_0xb087('0x9b')](_0xb087('0xbf'),_0xb087('0xc7'));if(_0x5bb6a0['result']===-0x1){return _0x5bb6a0;}return this['channel'][_0xb087('0xad')](util['format'](_0xb087('0xc1'),_0x4eb195));};AGIVertices['prototype'][_0xb087('0xc8')]=function(_0x33acc5){logger['info'](util[_0xb087('0x57')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x33acc5[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0x33acc5['odbc_id'])){return this['channel'][_0xb087('0x2b')](_0x33acc5,_0xb087('0xc9'));}var _0x200156=this['getSquareOdbc']['sync'](this,_0x33acc5[_0xb087('0xca')]);if(!_0x200156){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x33acc5,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x33acc5[_0xb087('0x2d')])){return this['channel']['error'](_0x33acc5,_0xb087('0xcb'));}var _0x53d73d=_0x33acc5['query'][_0xb087('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0xcc'),_0x53d73d));var _0x33093b=this[_0xb087('0xcd')]['sync'](this,_0x200156,_0x53d73d);this['createSquareDetailsReport']['sync'](this,_0x33acc5,_0x53d73d);if(!this[_0xb087('0x80')](_0x33acc5[_0xb087('0xce')])){return this['channel'][_0xb087('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1b3615=this[_0xb087('0x12')][_0xb087('0x9d')](this,_0x33acc5[_0xb087('0xce')]);if(!_0x1b3615){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x33acc5,'no\x20variable\x20found');}var _0x290f64=this;_0x33093b[_0xb087('0xcf')](function(_0x5bd6d2,_0x4944c5){Object[_0xb087('0xd0')](_0x5bd6d2)['forEach'](function(_0x54c08d){_0x290f64['channel'][_0xb087('0x97')](util[_0xb087('0x57')]('%s[%s][%s]',_0x1b3615,_0x4944c5,_0x54c08d),_0x5bd6d2[_0x54c08d]);});});this[_0xb087('0xf')]['setVariable'](util[_0xb087('0x57')](_0xb087('0xd1'),_0x1b3615),_0x33093b['length']);return this[_0xb087('0xf')]['noop'](util['format'](_0xb087('0xd2'),_0x1b3615));};AGIVertices[_0xb087('0x11')][_0xb087('0xd3')]=function(_0x4e711c){logger[_0xb087('0xd4')](util['format'](_0xb087('0xd5'),_0x4e711c[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0x4e711c[_0xb087('0xd6')])){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x4e711c,_0xb087('0xd7'));}var _0x246a2d=this[_0xb087('0x1d')][_0xb087('0x9d')](this,_0x4e711c[_0xb087('0xd6')]);if(!_0x246a2d){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x4e711c,_0xb087('0xd8'));}var _0xa82e51=this[_0xb087('0xf')][_0xb087('0xb0')](_0xb087('0xd9'),[util[_0xb087('0x57')](_0xb087('0xda'),_0x246a2d),_0x4e711c[_0xb087('0x65')],_0x4e711c[_0xb087('0xdb')],_0x4e711c[_0xb087('0x63')]]);if(_0xa82e51['result']===-0x1){return _0xa82e51;}return this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0xdc'),'DIAL'));};AGIVertices[_0xb087('0x11')][_0xb087('0xdd')]=function(_0x2363d1){logger['info'](util[_0xb087('0x57')](_0xb087('0xde'),_0x2363d1[_0xb087('0x37')]));if(!this['isConfigured'](_0x2363d1[_0xb087('0x77')])){return this[_0xb087('0xf')][_0xb087('0xad')]('no\x20key\x20configured');}if(!this[_0xb087('0x80')](_0x2363d1[_0xb087('0x5c')])){return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0xb4'));}this[_0xb087('0xf')][_0xb087('0xdf')]=!![];this[_0xb087('0x35')](_0x2363d1);this[_0xb087('0x43')](_0x2363d1[_0xb087('0x5c')],'in');this[_0xb087('0xf')]['noop'](util[_0xb087('0x57')](_0xb087('0xe0'),_0x2363d1[_0xb087('0x5c')]));var _0x5c3e7f=this[_0xb087('0xe1')][_0xb087('0x9d')](this,_0x2363d1);if(_0x5c3e7f){for(var _0x282880 in _0x5c3e7f){if(_0x5c3e7f[_0xb087('0x91')](_0x282880)){this[_0xb087('0xf')][_0xb087('0x97')](util[_0xb087('0x57')](_0xb087('0xe2'),_0x282880[_0xb087('0x68')]()),_0x5c3e7f[_0x282880]);}}this[_0xb087('0x43')](_0x5c3e7f['speech'],'out');return this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0xe3'),_0x5c3e7f['speech']));}return this[_0xb087('0xf')]['error'](_0x2363d1,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xb087('0x11')]['sesteknda']=function(_0x2c917b){logger['info'](util['format'](_0xb087('0xe4'),_0x2c917b[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0x2c917b[_0xb087('0xe5')])){return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0xe6'));}if(!this['isConfigured'](_0x2c917b['username'])){return this['channel'][_0xb087('0xad')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x2c917b['password'])){return this[_0xb087('0xf')][_0xb087('0xad')]('no\x20password\x20configured');}if(!this[_0xb087('0x80')](_0x2c917b['ndassistant_url'])){return this['channel']['noop'](_0xb087('0xb4'));}this[_0xb087('0xf')][_0xb087('0xdf')]=!![];this[_0xb087('0x35')](_0x2c917b);this[_0xb087('0x43')](_0x2c917b['text'],'in');this[_0xb087('0xf')]['noop'](util[_0xb087('0x57')](_0xb087('0xe7'),_0x2c917b[_0xb087('0x5c')]));var _0x121cce=this[_0xb087('0x79')][_0xb087('0x9d')](this,_0x2c917b);if(_0x121cce){for(var _0x17e82b in _0x121cce){if(_0x121cce['hasOwnProperty'](_0x17e82b)){this[_0xb087('0xf')][_0xb087('0x97')](util['format'](_0xb087('0xe8'),_0x17e82b[_0xb087('0x68')]()),_0x121cce[_0x17e82b]);}}this['createSquareMessage'](_0x121cce[_0xb087('0xe9')],_0xb087('0xea'));if(_0x121cce[_0xb087('0xeb')]){this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x121cce[_0xb087('0xeb')]));var _0x4b3a8c=this[_0xb087('0xf')][_0xb087('0xec')](_0x121cce['audiofile']);try{fs['unlink'](_0x121cce[_0xb087('0xeb')]+_0xb087('0xed'));}catch(_0x487459){logger[_0xb087('0x2b')](_0x487459);}return _0x4b3a8c;}else{return this[_0xb087('0xf')]['noop'](util['format'](_0xb087('0xee'),_0x121cce['speech']));}}return this[_0xb087('0xf')][_0xb087('0x2b')](_0x2c917b,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xb087('0x11')][_0xb087('0xef')]=function(_0x12cc6e){logger[_0xb087('0x2e')](util[_0xb087('0x57')]('Enter\x20in\x20END\x20(%s)\x20block',_0x12cc6e['label']));return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0xef'));};AGIVertices[_0xb087('0x11')][_0xb087('0xf0')]=function(_0x3a5f4d){logger[_0xb087('0x2e')](util['format'](_0xb087('0xf1'),_0x3a5f4d[_0xb087('0x37')]));var _0x507354='';if(_0x3a5f4d[_0xb087('0xf2')]){if(!this[_0xb087('0x80')](_0x3a5f4d[_0xb087('0xf2')])){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x3a5f4d,_0xb087('0xf3'));}else{var _0x7fc3f2=parseInt(_0x3a5f4d[_0xb087('0xf2')],0xa);if(isNaN(_0x7fc3f2)){_0x507354=_0x3a5f4d[_0xb087('0xf2')];}else{_0x507354=this[_0xb087('0x1f')][_0xb087('0x9d')](this,_0x3a5f4d['trunk_id']);if(!_0x507354){return this['channel']['error'](_0x3a5f4d,'no\x20trunk\x20found');}}}}else if(_0x3a5f4d[_0xb087('0xf4')]){_0x507354=_0x3a5f4d[_0xb087('0xf4')];}else{return this['channel'][_0xb087('0x2b')](_0x3a5f4d,_0xb087('0xf3'));}var _0x41c89a=this[_0xb087('0xf')][_0xb087('0xb0')](_0xb087('0xd9'),[util[_0xb087('0x57')](_0xb087('0xf5'),_0x507354,_0x3a5f4d[_0xb087('0x49')]),_0x3a5f4d[_0xb087('0x65')],_0x3a5f4d[_0xb087('0xdb')],_0x3a5f4d[_0xb087('0x63')]]);if(_0x41c89a[_0xb087('0xa7')]===-0x1){return _0x41c89a;}return this['channel'][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0xdc'),'DIAL'));};AGIVertices['prototype'][_0xb087('0xf6')]=function(_0xb9d6b8){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0xf7'),_0xb9d6b8['label']));return this['channel']['noop']('finally');};AGIVertices[_0xb087('0x11')][_0xb087('0xd')]=function(_0xd0d9ae){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0xf8'),_0xd0d9ae['label']));if(_0xd0d9ae[_0xb087('0x9e')]===0x0){return this[_0xb087('0x9c')](_0xd0d9ae);}_0xd0d9ae[_0xb087('0x9e')]-=0x1;if(!this[_0xb087('0x80')](_0xd0d9ae[_0xb087('0xf9')])){return this[_0xb087('0xf')]['error'](_0xd0d9ae,_0xb087('0xfa'));}var _0x30e53f=this[_0xb087('0x20')][_0xb087('0x9d')](this,_0xd0d9ae[_0xb087('0xf9')]);if(!_0x30e53f){return this[_0xb087('0xf')]['error'](_0xd0d9ae,_0xb087('0xfb'));}if(!this[_0xb087('0x80')](_0xd0d9ae[_0xb087('0xce')])){return this[_0xb087('0xf')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x549776=this[_0xb087('0xf')][_0xb087('0xfc')](_0x30e53f,_0xd0d9ae[_0xb087('0xfd')],_0xd0d9ae[_0xb087('0xfe')]);var _0x3340ad=_0x549776[_0xb087('0xa7')]?_0x549776[_0xb087('0xa7')][_0xb087('0x4d')]():'';logger['info'](_0xb087('0xff'),JSON[_0xb087('0x71')](_0x549776));if(_0x549776[_0xb087('0xa7')]===-0x1){this[_0xb087('0x35')][_0xb087('0x9d')](this,_0xd0d9ae,_0x3340ad);return _0x549776;}else if(_0x549776[_0xb087('0x9a')]===_0xb087('0x65')){_0x549776[_0xb087('0xa7')]=_0x3340ad[_0xb087('0x93')]>=parseInt(_0xd0d9ae['mindigit'])?'x':'i';}else{_0x549776[_0xb087('0xa7')]=_0x3340ad[_0xb087('0x93')]>=parseInt(_0xd0d9ae[_0xb087('0x100')])&&_0x3340ad[_0xb087('0x93')]<=parseInt(_0xd0d9ae[_0xb087('0xfe')])?'x':'i';}var _0x5c289f=this[_0xb087('0x12')][_0xb087('0x9d')](this,_0xd0d9ae[_0xb087('0xce')]);if(!_0x5c289f){return this[_0xb087('0xf')]['error'](_0xd0d9ae,_0xb087('0x101'));}this[_0xb087('0xf')][_0xb087('0x97')](_0x5c289f,_0x3340ad);if(this[_0xb087('0x80')](_0xd0d9ae[_0xb087('0x102')])){var _0xdffdd9=parseInt(_0xd0d9ae[_0xb087('0x102')],0xa);var _0x2c28bb=rs[_0xb087('0x103')]({'charset':'*','length':_0xdffdd9});var _0x118122=_0x3340ad['length'];if(_0x118122>0x0){if(_0x118122>_0xdffdd9){this['createSquareDetailsReport']['sync'](this,_0xd0d9ae,_0xd0d9ae[_0xb087('0x104')]===_0xb087('0x105')?_0x2c28bb+_0x3340ad[_0xb087('0x106')](_0xdffdd9):_0x3340ad[_0xb087('0x106')](0x0,_0x118122-_0xdffdd9)+_0x2c28bb);}else{this[_0xb087('0x35')]['sync'](this,_0xd0d9ae,rs[_0xb087('0x103')]({'charset':'*','length':_0x118122}));}}else{this[_0xb087('0x35')][_0xb087('0x9d')](this,_0xd0d9ae,'');}}else{this['createSquareDetailsReport'][_0xb087('0x9d')](this,_0xd0d9ae,_0x3340ad);}return _0x549776;};AGIVertices[_0xb087('0x11')]['getsecretdigits']=function(_0x44dbf2){logger['info'](util[_0xb087('0x57')](_0xb087('0x107'),_0x44dbf2[_0xb087('0x37')]));return this['getdigits'](_0x44dbf2);};AGIVertices[_0xb087('0x11')]['goal']=function(_0xc2e215){logger['info'](util[_0xb087('0x57')](_0xb087('0x108'),_0xc2e215[_0xb087('0x37')]));this['createSquareDetailsReport'][_0xb087('0x9d')](this,_0xc2e215,_0xc2e215['goalname']);return this['channel']['noop'](util[_0xb087('0x57')](_0xb087('0x109'),_0xc2e215['goalname']));};AGIVertices[_0xb087('0x11')][_0xb087('0x10a')]=function(_0x5cc1ec){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x10b'),_0x5cc1ec['label']));if(!this['isConfigured'](_0x5cc1ec[_0xb087('0x83')])||!this['isConfigured'](_0x5cc1ec[_0xb087('0x84')])){return this['channel']['noop'](_0xb087('0x10c'));}if(!this[_0xb087('0x80')](_0x5cc1ec['text'])){return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0xb4'));}this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')]('Trying\x20aws\x20Polly\x20%s',_0x5cc1ec[_0xb087('0x5c')]));var _0xecc07f=this['awsPolly']['sync'](this,_0x5cc1ec);if(_0xecc07f){this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x10d'),_0xecc07f));var _0x521adf=this[_0xb087('0xf')][_0xb087('0xec')](_0xecc07f);try{fs[_0xb087('0x10e')](_0xecc07f+_0xb087('0xed'));}catch(_0x182441){logger['error'](_0x182441);}return _0x521adf;}return this['channel'][_0xb087('0x2b')](_0x5cc1ec,_0xb087('0x10f'));};AGIVertices[_0xb087('0x11')]['awslex']=function(_0x21dd13){logger[_0xb087('0x2e')](util[_0xb087('0x57')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x21dd13[_0xb087('0x37')]));if(!this['isConfigured'](_0x21dd13['aws_access_key_id'])||!this[_0xb087('0x80')](_0x21dd13[_0xb087('0x84')])){return this['channel'][_0xb087('0xad')](_0xb087('0x10c'));}if(!this[_0xb087('0x80')](_0x21dd13['aws_bot_name'])){return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0x110'));}if(!this[_0xb087('0x80')](_0x21dd13[_0xb087('0x5c')])){return this[_0xb087('0xf')]['noop']('no\x20text\x20configured');}this[_0xb087('0xf')][_0xb087('0xdf')]=!![];this[_0xb087('0x35')](_0x21dd13);this['createSquareMessage'](_0x21dd13[_0xb087('0x5c')],'in');this[_0xb087('0xf')][_0xb087('0xad')](util['format'](_0xb087('0x111'),_0x21dd13[_0xb087('0x5c')]));var _0x5d0f20=this['awsLex'][_0xb087('0x9d')](this,_0x21dd13);if(_0x5d0f20){for(var _0x5016b8 in _0x5d0f20){if(_0x5d0f20[_0xb087('0x91')](_0x5016b8)&&_[_0xb087('0x8d')](_0x5d0f20[_0x5016b8])){this[_0xb087('0xf')][_0xb087('0x97')](util['format'](_0xb087('0x112'),_0x5016b8[_0xb087('0x68')]()),_0x5d0f20[_0x5016b8]);}}if(_['isNil'](_0x5d0f20[_0xb087('0x75')])){return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0x113'));}else{this[_0xb087('0x43')](_0x5d0f20[_0xb087('0x75')],_0xb087('0xea'));return this[_0xb087('0xf')]['noop'](util['format'](_0xb087('0x114'),_0x5d0f20[_0xb087('0x75')]));}}return this[_0xb087('0xf')][_0xb087('0x2b')](_0x21dd13,_0xb087('0x115'));};AGIVertices[_0xb087('0x11')]['googleasr']=function(_0x6ef1fc){logger['info'](util[_0xb087('0x57')](_0xb087('0x116'),_0x6ef1fc[_0xb087('0x37')],_0x6ef1fc[_0xb087('0x65')]));if(!this[_0xb087('0x80')](_0x6ef1fc[_0xb087('0x77')])){return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0x117'));}var _0x48b4d0=_0xb087('0x118');var _0x263028=util[_0xb087('0x57')](_0xb087('0x119'),FILES_PATH,rs[_0xb087('0x103')](0x4));var _0x226d7f=util['format'](_0xb087('0x96'),_0x263028,_0x48b4d0);var _0x3e6b03=!![];if(_0x6ef1fc[_0xb087('0x11a')]===_0xb087('0x11b')){_0x3e6b03=![];}var _0x248022=this[_0xb087('0xf')][_0xb087('0x11c')](_0x263028,_0x48b4d0,_0x6ef1fc[_0xb087('0x11d')],_0x6ef1fc['timeout'],undefined,_0x3e6b03);if(_0x248022['result']!==-0x1){this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')]('google\x20%s\x20file\x20created',_0x226d7f));var _0x423066=this[_0xb087('0x11e')][_0xb087('0x9d')](this,_0x6ef1fc,_0x226d7f);if(_0x423066){for(var _0x4e574a in _0x423066){if(_0x423066['hasOwnProperty'](_0x4e574a)){this[_0xb087('0xf')]['setVariable'](util[_0xb087('0x57')](_0xb087('0x11f'),_0x4e574a[_0xb087('0x68')]()),_0x423066[_0x4e574a]);}}return this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x120'),JSON[_0xb087('0x71')](_0x423066)));}}return _0x248022;};AGIVertices[_0xb087('0x11')][_0xb087('0x121')]=function(_0xa3f57d){logger['info'](util[_0xb087('0x57')](_0xb087('0x122'),_0xa3f57d[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0xa3f57d['appid'])){return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0x123'));}if(!this[_0xb087('0x80')](_0xa3f57d[_0xb087('0x8b')])){return this[_0xb087('0xf')]['noop'](_0xb087('0x124'));}var _0xd0815b='wav';var _0x27de93=util[_0xb087('0x57')]('%s/recordings/%s',FILES_PATH,rs[_0xb087('0x103')](0x4));var _0x3c3b52=util[_0xb087('0x57')](_0xb087('0x96'),_0x27de93,_0xd0815b);var _0x130181=!![];if(_0xa3f57d['beep']===_0xb087('0x11b')){_0x130181=![];}var _0x3557c0=this[_0xb087('0xf')][_0xb087('0x11c')](_0x27de93,_0xd0815b,_0xa3f57d[_0xb087('0x11d')],_0xa3f57d[_0xb087('0x65')],undefined,_0x130181);if(_0x3557c0['result']!==-0x1){this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')]('tilde\x20%s\x20file\x20created',_0x3c3b52));var _0x525a09=this[_0xb087('0x89')][_0xb087('0x9d')](this,_0xa3f57d,_0x3c3b52);if(_0x525a09){for(var _0x12c789 in _0x525a09){if(_0x525a09[_0xb087('0x91')](_0x12c789)){this[_0xb087('0xf')][_0xb087('0x97')](util['format']('TILDE_ASR_%s',_0x12c789['toUpperCase']()),_0x525a09[_0x12c789]);}}return this[_0xb087('0xf')]['noop'](util[_0xb087('0x57')](_0xb087('0x125'),JSON[_0xb087('0x71')](_0x525a09)));}}return _0x3557c0;};AGIVertices['prototype'][_0xb087('0x126')]=function(_0x12dfd7){logger[_0xb087('0x2e')](util['format'](_0xb087('0x127'),_0x12dfd7[_0xb087('0x37')]));return this[_0xb087('0xf')]['continueAt'](_0x12dfd7[_0xb087('0x3d')],_0x12dfd7[_0xb087('0x3e')],_0x12dfd7[_0xb087('0x3f')]);};AGIVertices[_0xb087('0x11')][_0xb087('0x128')]=function(_0x3f5ecf){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x129'),_0x3f5ecf['label']));if(!this['isConfigured'](_0x3f5ecf[_0xb087('0x12a')])){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x3f5ecf,_0xb087('0x12b'));}try{var _0x3f7b16=eval(_0x3f5ecf[_0xb087('0x12a')])?_0xb087('0x12c'):_0xb087('0x12d');this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x12e'),_0x3f5ecf['condition'],_0x3f7b16));return{'code':0xc8,'result':_0x3f7b16};}catch(_0x56a107){return{'code':0xc8,'result':_0xb087('0x12d')};}};AGIVertices['prototype'][_0xb087('0x12f')]=function(_0x4c024f){logger['info'](util[_0xb087('0x57')](_0xb087('0x130'),_0x4c024f[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0x4c024f[_0xb087('0x131')])){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x4c024f,'no\x20interval\x20configured');}var _0xbd023e=this[_0xb087('0x132')][_0xb087('0x9d')](this,_0x4c024f[_0xb087('0x131')]);if(!_0xbd023e){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x4c024f,_0xb087('0x133'));}for(var _0x561f6c=0x0;_0x561f6c<_0xbd023e[_0xb087('0x93')];_0x561f6c+=0x1){var _0x160500=this[_0xb087('0xf')][_0xb087('0x12')](util['format'](_0xb087('0x134'),_0xbd023e[_0x561f6c]));if(_0x160500[_0xb087('0xa7')]===-0x1){return _0x160500;}logger['info'](util[_0xb087('0x57')](_0xb087('0x135'),_0xbd023e[_0x561f6c],_0x160500[_0xb087('0x9a')]));if(_0x160500[_0xb087('0x9a')]===_0xb087('0x12c')){logger[_0xb087('0x2e')](util[_0xb087('0x57')]('IFTIME\x20%s\x20%s',_0xbd023e[_0x561f6c],'true'));this['channel'][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x135'),_0xbd023e[_0x561f6c],_0xb087('0x12c')));return{'code':0xc8,'result':'true'};}else{logger[_0xb087('0x2e')](util[_0xb087('0x57')]('IFTIME\x20%s\x20%s',_0xbd023e[_0x561f6c],_0xb087('0x12d')));this['channel'][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x135'),_0xbd023e[_0x561f6c],_0xb087('0x12d')));}}return{'code':0xc8,'result':_0xb087('0x12d')};};AGIVertices[_0xb087('0x11')][_0xb087('0x136')]=function(_0x41756f){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x137'),_0x41756f[_0xb087('0x37')]));return this[_0xb087('0xf')][_0xb087('0x136')]();};AGIVertices[_0xb087('0x11')]['ispeechasr']=function(_0x5b0d4a){logger[_0xb087('0x2e')](util['format'](_0xb087('0x138'),_0x5b0d4a['label']));if(!this[_0xb087('0x80')](_0x5b0d4a[_0xb087('0x77')])){return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0x117'));}var _0x480d16=_0xb087('0x118');var _0x2aa41f=util[_0xb087('0x57')](_0xb087('0x119'),FILES_PATH,rs[_0xb087('0x103')](0x4));var _0x4f69b0=util[_0xb087('0x57')]('%s.%s',_0x2aa41f,_0x480d16);var _0xa222f4=!![];if(_0x5b0d4a['beep']===_0xb087('0x11b')){_0xa222f4=![];}var _0xad449d=this[_0xb087('0xf')][_0xb087('0x11c')](_0x2aa41f,_0x480d16,_0x5b0d4a['intKey'],_0x5b0d4a[_0xb087('0x65')],undefined,_0xa222f4);if(_0xad449d[_0xb087('0xa7')]!==-0x1){this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x139'),_0x4f69b0));var _0x4c65e8=this[_0xb087('0x7e')][_0xb087('0x9d')](this,_0x5b0d4a,_0x4f69b0);if(_0x4c65e8){for(var _0x124ba6 in _0x4c65e8){if(_0x4c65e8['hasOwnProperty'](_0x124ba6)){this[_0xb087('0xf')][_0xb087('0x97')](util[_0xb087('0x57')](_0xb087('0x13a'),_0x124ba6[_0xb087('0x68')]()),_0x4c65e8[_0x124ba6]);}}return this[_0xb087('0xf')][_0xb087('0xad')](util['format'](_0xb087('0x13b'),JSON['stringify'](_0x4c65e8)));}}return _0xad449d;};AGIVertices['prototype']['ispeechtts']=function(_0x2bbabe){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x13c'),_0x2bbabe[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0x2bbabe[_0xb087('0x77')])){return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0x117'));}if(!this[_0xb087('0x80')](_0x2bbabe[_0xb087('0x5c')])){return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0xb4'));}this[_0xb087('0xf')]['noop'](util[_0xb087('0x57')](_0xb087('0x13d'),_0x2bbabe['text']));var _0x5a3e2f=this['ispeechTTS'][_0xb087('0x9d')](this,_0x2bbabe);if(_0x5a3e2f){this['channel'][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x139'),_0x5a3e2f));var _0x1a7832=this[_0xb087('0xf')]['streamFile'](_0x5a3e2f,_0x2bbabe[_0xb087('0x11d')]);try{fs[_0xb087('0x10e')](_0x5a3e2f+'.wav');}catch(_0x4ac36c){logger['error'](_0x4ac36c);}return _0x1a7832;}return this[_0xb087('0xf')]['error'](_0x2bbabe,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xb087('0x11')][_0xb087('0x13e')]=function(_0x43efec){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x13f'),_0x43efec[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0x43efec[_0xb087('0x140')])){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x43efec,'no\x20find\x20by\x20configured');}logger[_0xb087('0x2e')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xb087('0xf')][_0xb087('0x3a')],_0x43efec['findBy']));var _0x246f00=this[_0xb087('0x55')]['sync'](this,_0x43efec[_0xb087('0x140')]);if(_0x246f00){logger['info'](util[_0xb087('0x57')](_0xb087('0x141'),this['channel'][_0xb087('0x3a')],_0x43efec[_0xb087('0x140')]));this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x141'),this[_0xb087('0xf')][_0xb087('0x3a')],_0x43efec[_0xb087('0x140')]));return{'code':0xc8,'result':_0xb087('0x142')};}else{logger['info'](util['format'](_0xb087('0x143'),this['channel'][_0xb087('0x3a')],_0x43efec[_0xb087('0x140')]));this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb087('0xf')]['callerid'],_0x43efec[_0xb087('0x140')]));return{'code':0xc8,'result':_0xb087('0x144')};}};AGIVertices[_0xb087('0x11')]['logout']=function(_0x1903a3){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x145'),_0x1903a3['label']));if(!this[_0xb087('0x80')](_0x1903a3[_0xb087('0x140')])){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x1903a3,_0xb087('0x146'));}logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x147'),this['channel'][_0xb087('0x3a')],_0x1903a3[_0xb087('0x140')]));var _0x1f8b62=this['agentLogout']['sync'](this,_0x1903a3[_0xb087('0x140')]);if(_0x1f8b62){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xb087('0xf')][_0xb087('0x3a')],_0x1903a3[_0xb087('0x140')]));this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x141'),this[_0xb087('0xf')][_0xb087('0x3a')],_0x1903a3[_0xb087('0x140')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xb087('0x57')](_0xb087('0x143'),this[_0xb087('0xf')]['callerid'],_0x1903a3[_0xb087('0x140')]));this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x143'),this[_0xb087('0xf')][_0xb087('0x3a')],_0x1903a3[_0xb087('0x140')]));return{'code':0xc8,'result':_0xb087('0x144')};}};AGIVertices['prototype'][_0xb087('0x148')]=function(_0x2f75e9){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x149'),_0x2f75e9[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0x2f75e9[_0xb087('0x14a')])){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x2f75e9,_0xb087('0x14b'));}this[_0xb087('0xf')][_0xb087('0xad')](util['format'](_0xb087('0x14c'),_0x2f75e9[_0xb087('0x14a')]));var _0x382b70=eval(_0x2f75e9[_0xb087('0x14a')]);if(!this[_0xb087('0x80')](_0x2f75e9[_0xb087('0xce')])){return this['channel']['noop'](_0xb087('0x14d'));}var _0x529078=this[_0xb087('0x12')][_0xb087('0x9d')](this,_0x2f75e9[_0xb087('0xce')]);if(!_0x529078){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x2f75e9,_0xb087('0x101'));}if(_[_0xb087('0x95')](_0x382b70)){var _0x53b72c=this;_0x382b70[_0xb087('0xcf')](function(_0xf840f0,_0x30e1d8){_0x53b72c[_0xb087('0xf')][_0xb087('0x97')](util['format']('%s[%s]',_0x529078,_0x30e1d8),_0xf840f0);});return this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x14e'),_0x529078));}else{return this['channel'][_0xb087('0x97')](_0x529078,_0x382b70);}};AGIVertices[_0xb087('0x11')]['menu']=function(_0x40184c){logger['info'](util[_0xb087('0x57')](_0xb087('0x14f'),_0x40184c['label']));if(_0x40184c[_0xb087('0x9e')]===0x0){return this['maxRetry'](_0x40184c);}_0x40184c['retry']-=0x1;if(!this[_0xb087('0x80')](_0x40184c[_0xb087('0xf9')])){return this['channel'][_0xb087('0x2b')](_0x40184c,_0xb087('0xfa'));}var _0x408ed8=this[_0xb087('0x20')][_0xb087('0x9d')](this,_0x40184c['file_id']);if(!_0x408ed8){return this[_0xb087('0xf')]['error'](_0x40184c,_0xb087('0xfb'));}var _0x46a960=this[_0xb087('0xf')][_0xb087('0xfc')](_0x408ed8,_0x40184c[_0xb087('0xfd')],_0x40184c['digit']);var _0x58affe=_0x46a960[_0xb087('0xa7')];if(_0x46a960['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x40184c,'-1');return _0x46a960;}else if(_0x46a960[_0xb087('0x9a')]===_0xb087('0x65')){_0x46a960[_0xb087('0xa7')]=_0x46a960[_0xb087('0xa7')][_0xb087('0x93')]>0x0?_0x46a960[_0xb087('0xa7')]:'t';}else if(_['isEmpty'](_0x46a960[_0xb087('0xa7')])){_0x46a960[_0xb087('0xa7')]='#';_0x58affe='#';}if(!this[_0xb087('0x80')](_0x40184c[_0xb087('0xce')])){this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0x14d'));}else{var _0x5f2f71=this[_0xb087('0x12')][_0xb087('0x9d')](this,_0x40184c[_0xb087('0xce')]);if(!_0x5f2f71){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x40184c,_0xb087('0x101'));}this['channel'][_0xb087('0x97')](_0x5f2f71,_0x58affe);}this['createSquareDetailsReport'][_0xb087('0x9d')](this,_0x40184c,_0x58affe);return _0x46a960;};AGIVertices[_0xb087('0x11')][_0xb087('0xad')]=function(_0x58383d){logger[_0xb087('0x2e')](util['format'](_0xb087('0x150'),_0x58383d[_0xb087('0x37')]));return this[_0xb087('0xf')]['noop'](_0x58383d[_0xb087('0x151')]||_0x58383d[_0xb087('0x37')]);};AGIVertices[_0xb087('0x11')][_0xb087('0x152')]=function(_0x2917a1){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x153'),_0x2917a1[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0x2917a1[_0xb087('0x140')])){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x2917a1,'no\x20find\x20by\x20configured');}logger['info'](util[_0xb087('0x57')](_0xb087('0x147'),this[_0xb087('0xf')][_0xb087('0x3a')],_0x2917a1[_0xb087('0x140')]));var _0x439a3c=this[_0xb087('0x4f')][_0xb087('0x9d')](this,_0x2917a1[_0xb087('0x154')]);var _0xd857c6=this[_0xb087('0x51')][_0xb087('0x9d')](this,_0x2917a1['findBy'],_0x439a3c);if(_0xd857c6){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x141'),this[_0xb087('0xf')]['callerid'],_0x2917a1[_0xb087('0x140')]));this[_0xb087('0xf')]['noop'](util[_0xb087('0x57')](_0xb087('0x141'),this[_0xb087('0xf')][_0xb087('0x3a')],_0x2917a1['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xb087('0x57')](_0xb087('0x143'),this[_0xb087('0xf')][_0xb087('0x3a')],_0x2917a1[_0xb087('0x140')]));this[_0xb087('0xf')][_0xb087('0xad')](util['format'](_0xb087('0x141'),this[_0xb087('0xf')][_0xb087('0x3a')],_0x2917a1[_0xb087('0x140')]));return{'code':0xc8,'result':_0xb087('0x144')};}};AGIVertices['prototype'][_0xb087('0x155')]=function(_0x28b374){logger[_0xb087('0x2e')](util['format'](_0xb087('0x156'),_0x28b374[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0x28b374[_0xb087('0xf9')])){return this[_0xb087('0xf')]['error'](_0x28b374,_0xb087('0xfa'));}var _0x49d8=this[_0xb087('0x20')][_0xb087('0x9d')](this,_0x28b374[_0xb087('0xf9')]);if(!_0x49d8){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x28b374,_0xb087('0xfb'));}var _0x35c644=this[_0xb087('0xf')][_0xb087('0xb0')](_0xb087('0x157'),[_0x49d8,_0x28b374[_0xb087('0xdb')]]);if(_0x35c644[_0xb087('0xa7')]===-0x1){return _0x35c644;}return this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')]('Executed\x20command\x20%s\x20%s',_0xb087('0x157'),_0x49d8));};AGIVertices[_0xb087('0x11')]['queue']=function(_0x2752ff){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x158'),_0x2752ff['label']));if(!this[_0xb087('0x80')](_0x2752ff['queue_id'])){return this['channel'][_0xb087('0x2b')](_0x2752ff,_0xb087('0x159'));}var _0x4f6cdb='';var _0x4ed1fb=parseInt(_0x2752ff[_0xb087('0x15a')],0xa);if(isNaN(_0x4ed1fb)){_0x4f6cdb=_0x2752ff[_0xb087('0x15a')];}else{_0x4f6cdb=this[_0xb087('0x16')][_0xb087('0x9d')](this,_0x2752ff[_0xb087('0x15a')]);if(!_0x4f6cdb){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x2752ff,_0xb087('0x15b'));}}var _0x1a2cdd='';if(this[_0xb087('0x80')](_0x2752ff[_0xb087('0xf9')])){var _0xc41133=this[_0xb087('0x20')][_0xb087('0x9d')](this,_0x2752ff[_0xb087('0xf9')]);if(_0xc41133){_0x1a2cdd=_0xc41133;}}this[_0xb087('0x35')][_0xb087('0x9d')](this,_0x2752ff,_0x4f6cdb);if(_0x2752ff['opts']['indexOf']('x')<0x0){_0x2752ff[_0xb087('0xdb')]+='x';}if(_0x2752ff['opts'][_0xb087('0x15c')]('X')<0x0){_0x2752ff[_0xb087('0xdb')]+='X';}this[_0xb087('0xf')][_0xb087('0x97')](_0xb087('0x15d'),_0x4f6cdb?_0x4f6cdb['toLowerCase']():'');var _0x276d38=this[_0xb087('0xf')][_0xb087('0xb0')](_0xb087('0x15e'),[_0x4f6cdb,_0x2752ff[_0xb087('0xdb')],_0x2752ff[_0xb087('0x63')],_0x1a2cdd,_0x2752ff['timeout'],_0x2752ff[_0xb087('0x9f')],_0x2752ff[_0xb087('0x15f')],_0x2752ff['gosub'],'',_0x2752ff[_0xb087('0x160')]]);if(_0x276d38[_0xb087('0xa7')]===-0x1){return _0x276d38;}return this['channel'][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0xb2'),_0xb087('0x15e'),_0x4f6cdb));};AGIVertices[_0xb087('0x11')]['record']=function(_0x26330d){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x161'),_0x26330d[_0xb087('0x37')]));var _0xd4b944=_0x26330d[_0xb087('0x162')]||_0xb087('0x118');var _0xc50151=util[_0xb087('0x57')]('%s_%s',this[_0xb087('0xf')][_0xb087('0x36')],rs[_0xb087('0x103')](0x5));var _0x176af9=util[_0xb087('0x57')]('%s/recordings/%s.%s',FILES_PATH,_0xc50151,_0xd4b944);var _0x18ef01=util['format'](_0xb087('0x119'),FILES_PATH,_0xc50151);this[_0xb087('0x3b')][_0xb087('0x9d')](this,_0x26330d,_0xc50151,_0x176af9);this[_0xb087('0xf')][_0xb087('0x97')](_0xb087('0x163'),_0xc50151);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x18ef01,_0xd4b944,_0x26330d['escape_digits'],_0x26330d[_0xb087('0x65')]);return this[_0xb087('0xf')][_0xb087('0x11c')](_0x18ef01,_0xd4b944,_0x26330d[_0xb087('0x164')],_0x26330d[_0xb087('0x65')],undefined,!![]);};AGIVertices[_0xb087('0x11')][_0xb087('0x165')]=function(_0xdef11d){logger[_0xb087('0x2e')](util['format'](_0xb087('0x166'),_0xdef11d['label']));if(!this[_0xb087('0x80')](_0xdef11d[_0xb087('0x63')])){return this['channel']['noop'](_0xb087('0x167'));}var _0x1483a9=this[_0xb087('0x62')]['sync'](this,_0xdef11d);logger['info'](util[_0xb087('0x57')](_0xb087('0x168'),util['inspect'](_0x1483a9,{'showHidden':![],'depth':null})));if(!this[_0xb087('0x80')](_0xdef11d['variable_id'])){return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0x169'));}var _0x2214df=this[_0xb087('0x12')]['sync'](this,_0xdef11d[_0xb087('0xce')]);if(!_0x2214df){return this['channel'][_0xb087('0x2b')](_0xdef11d,_0xb087('0x101'));}this[_0xb087('0xf')][_0xb087('0x97')](util[_0xb087('0x57')](_0xb087('0x16a'),_0x2214df),_0x1483a9[_0xb087('0x73')]?_0x1483a9[_0xb087('0x73')]:_0xb087('0x16b'));this[_0xb087('0xf')][_0xb087('0x97')](util[_0xb087('0x57')](_0xb087('0x16c'),_0x2214df),_0x1483a9[_0xb087('0x74')]?_0x1483a9[_0xb087('0x74')]:'OK');if(_0x1483a9['body']){try{this[_0xb087('0x94')](_0x1483a9[_0xb087('0x69')],_0x2214df);}catch(_0x20bef3){logger[_0xb087('0x2b')](util[_0xb087('0x57')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x2214df));}}return this[_0xb087('0xf')]['noop'](util[_0xb087('0x57')](_0xb087('0xd2'),_0x2214df));};AGIVertices[_0xb087('0x11')][_0xb087('0x16d')]=function(_0xdb5070){logger[_0xb087('0x2e')](util['format'](_0xb087('0x16e'),_0xdb5070[_0xb087('0x37')]));return this[_0xb087('0xf')][_0xb087('0x16f')](_0xdb5070['digits'][_0xb087('0x5a')](/\s+/g,''),_0xdb5070[_0xb087('0x164')]);};AGIVertices[_0xb087('0x11')]['saynumber']=function(_0x4c9ce0){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x170'),_0x4c9ce0[_0xb087('0x37')]));return this[_0xb087('0xf')][_0xb087('0x171')](_0x4c9ce0[_0xb087('0x64')][_0xb087('0x5a')](/\s+/g,''),_0x4c9ce0['escape_digits']);};AGIVertices['prototype']['sayphonetic']=function(_0x35f730){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x172'),_0x35f730[_0xb087('0x37')]));return this[_0xb087('0xf')][_0xb087('0x173')](_0x35f730[_0xb087('0x5c')],_0x35f730[_0xb087('0x164')]);};AGIVertices[_0xb087('0x11')][_0xb087('0x174')]=function(_0x145974){logger[_0xb087('0x2e')](util[_0xb087('0x57')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x145974[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0x145974[_0xb087('0x175')])){return this['channel'][_0xb087('0xad')](_0xb087('0x176'));}var _0x5b0947=this[_0xb087('0x22')]['sync'](this,_0x145974[_0xb087('0x175')]);if(!_0x5b0947||!_0x5b0947[_0xb087('0x177')]){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x145974,_0xb087('0x178'));}var _0x56beaf={'from':util[_0xb087('0x57')](_0xb087('0x179'),_0x5b0947[_0xb087('0x14')],_0x5b0947['email']||_0x5b0947[_0xb087('0x177')]['user']),'to':_0x145974['to']||'','cc':_0x145974['cc']||'','bcc':_0x145974[_0xb087('0x17a')]||'','subject':_0x145974[_0xb087('0x17b')],'html':_0x145974[_0xb087('0x5c')],'text':_0x145974[_0xb087('0x5c')]};var _0x2c8cfe={'tls':{'rejectUnauthorized':![]}};if(_0x5b0947[_0xb087('0x177')][_0xb087('0x17c')]){_0x2c8cfe['service']=_0x5b0947[_0xb087('0x177')][_0xb087('0x17c')];}else{_0x2c8cfe['host']=_0x5b0947[_0xb087('0x177')][_0xb087('0x17d')];_0x2c8cfe[_0xb087('0x17e')]=_0x5b0947[_0xb087('0x177')]['port'];_0x2c8cfe[_0xb087('0x17f')]=_0x5b0947[_0xb087('0x177')][_0xb087('0x17f')];}if(_0x5b0947[_0xb087('0x177')][_0xb087('0x180')]){_0x2c8cfe['auth']={'user':_0x5b0947[_0xb087('0x177')][_0xb087('0x181')],'pass':_0x5b0947['Smtp'][_0xb087('0x182')]};}if(this[_0xb087('0x80')](_0x145974['template_id'])){}logger['debug'](_0xb087('0x183'),JSON[_0xb087('0x71')](_0x56beaf));this['createSquareDetailsReport'][_0xb087('0x9d')](this,_0x145974,_0x145974['account_id']);this['channel'][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x184'),_0x5b0947[_0xb087('0x14')]));this[_0xb087('0x24')][_0xb087('0x9d')](this,_0x2c8cfe,_0x56beaf);return this['channel'][_0xb087('0xad')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0xb087('0x185')]=function(_0x36ad3c){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x186'),_0x36ad3c[_0xb087('0x37')]));return this[_0xb087('0xf')][_0xb087('0xad')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype']['sendSMS']=function(_0x1a6bf8){logger[_0xb087('0x2e')](util[_0xb087('0x57')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x1a6bf8[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0x1a6bf8[_0xb087('0x187')])){return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0x188'));}var _0x518586=this[_0xb087('0x32')][_0xb087('0x9d')](this,_0x1a6bf8[_0xb087('0x187')]);if(!_0x518586){return this[_0xb087('0xf')]['error'](_0x1a6bf8,_0xb087('0x189'));}var _0x5bf408={'body':_0x1a6bf8['sms_text'],'phone':_0x1a6bf8['to']||'','SmsAccountId':_0x518586['id']};logger[_0xb087('0xd4')](_0xb087('0x18a'),JSON[_0xb087('0x71')](_0x5bf408));this[_0xb087('0x35')][_0xb087('0x9d')](this,_0x1a6bf8,_0x1a6bf8[_0xb087('0x187')]);this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x18b'),_0x518586[_0xb087('0x14')]));this[_0xb087('0x34')][_0xb087('0x9d')](this,_0x5bf408);return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0x18c'));};AGIVertices['prototype'][_0xb087('0x18d')]=function(_0x531bea){logger['info'](util[_0xb087('0x57')](_0xb087('0x18e'),_0x531bea['label']));if(!this['isConfigured'](_0x531bea['variable_id'])){return this['channel']['error'](_0x531bea,_0xb087('0x18f'));}var _0xb6bbee=this[_0xb087('0x12')][_0xb087('0x9d')](this,_0x531bea['variable_id']);if(!_0xb6bbee){return this[_0xb087('0xf')]['error'](_0x531bea,_0xb087('0x101'));}return this['channel']['setVariable'](_0xb6bbee,_0x531bea[_0xb087('0x190')]);};AGIVertices['prototype']['start']=function(_0x403e49){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x191'),_0x403e49[_0xb087('0x37')]));this[_0xb087('0xf')]['noop'](_0xb087('0x192'));if(_0x403e49[_0xb087('0xa3')]===_0xb087('0x193')){this[_0xb087('0xf')][_0xb087('0xad')]('Answer');return this['channel']['answer']();}return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0x194'));};AGIVertices[_0xb087('0x11')][_0xb087('0x195')]=function(_0x28b847){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x196'),_0x28b847['label']));if(!this[_0xb087('0x80')](_0x28b847['project_id'])){return this[_0xb087('0xf')]['error'](_0x28b847,_0xb087('0x197'));}var _0x50e958=this[_0xb087('0x19')][_0xb087('0x9d')](this,_0x28b847[_0xb087('0x198')]);if(!this[_0xb087('0x80')](_0x50e958)){return this[_0xb087('0xf')]['error'](_0x28b847,util[_0xb087('0x57')](_0xb087('0x199'),_0x28b847[_0xb087('0x198')]));}if(_0x50e958===this[_0xb087('0xf')]['arg_1']){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x28b847,_0xb087('0x19a'));}this[_0xb087('0x35')][_0xb087('0x9d')](this,_0x28b847,_0x50e958);var _0x1ea470=this[_0xb087('0xf')]['exec'](_0xb087('0x19b'),util[_0xb087('0x57')](_0xb087('0x19c'),config[_0xb087('0x9f')][_0xb087('0x17d')]||_0xb087('0x19d'),_0x50e958,this[_0xb087('0xf')][_0xb087('0x39')]));if(_0x1ea470[_0xb087('0xa7')]===-0x1){return _0x1ea470;}return this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0xb2'),_0xb087('0x19b'),_0x50e958));};AGIVertices[_0xb087('0x11')]['system']=function(_0x5c29f7){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x19e'),_0x5c29f7[_0xb087('0x37')]));var _0x4d5e16=this[_0xb087('0x19f')][_0xb087('0x9d')](this,_0x5c29f7[_0xb087('0xa1')]);this[_0xb087('0x35')][_0xb087('0x9d')](this,_0x5c29f7,_0x5c29f7['command']);if(this[_0xb087('0x80')](_0x5c29f7[_0xb087('0xce')])){var _0x39e1ab=this[_0xb087('0x12')][_0xb087('0x9d')](this,_0x5c29f7['variable_id']);if(_0x39e1ab){this[_0xb087('0xf')]['setVariable'](_0x39e1ab,_0x4d5e16);return this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x1a0'),_0x5c29f7[_0xb087('0xa1')],_0x39e1ab));}}return this[_0xb087('0xf')]['noop'](util['format'](_0xb087('0x1a1'),_0x5c29f7[_0xb087('0xa1')]));};AGIVertices[_0xb087('0x11')][_0xb087('0x1a2')]=function(_0x215de8){logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x1a3'),_0x215de8[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0x215de8[_0xb087('0x1a4')])){return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0x1a5'));}if(!this[_0xb087('0x80')](_0x215de8[_0xb087('0x5c')])){return this[_0xb087('0xf')][_0xb087('0xad')](_0xb087('0xb4'));}this[_0xb087('0xf')][_0xb087('0xad')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x215de8[_0xb087('0x5c')]));var _0x2ba067=this['googleCloudTTS'][_0xb087('0x9d')](this,_0x215de8);if(_0x2ba067){this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x2ba067));var _0x18b572=this[_0xb087('0xf')][_0xb087('0xec')](_0x2ba067);try{fs[_0xb087('0x10e')](_0x2ba067+'.wav');}catch(_0x15f186){logger['error'](_0x15f186);}return _0x18b572;}return this[_0xb087('0xf')][_0xb087('0x2b')](_0x215de8,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xb087('0x1a6')]=function(_0x59437a){logger[_0xb087('0x2e')](util[_0xb087('0x57')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x59437a[_0xb087('0x37')]));if(!this['isConfigured'](_0x59437a[_0xb087('0x5c')])){return this['channel'][_0xb087('0xad')](_0xb087('0xb4'));}this['channel'][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x1a7'),_0x59437a[_0xb087('0x5c')]));var _0x164173=this[_0xb087('0x1a8')][_0xb087('0x9d')](this,_0x59437a);if(_0x164173){this['channel'][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x1a9'),_0x164173));var _0x2a5b97=this[_0xb087('0xf')]['streamFile'](_0x164173);try{fs[_0xb087('0x10e')](_0x164173+_0xb087('0xed'));}catch(_0x43c789){logger[_0xb087('0x2b')](_0x43c789);}return _0x2a5b97;}return this[_0xb087('0xf')][_0xb087('0x2b')](_0x59437a,_0xb087('0x1aa'));};AGIVertices[_0xb087('0x11')][_0xb087('0x1ab')]=function(_0x57e857){logger[_0xb087('0x2e')](util[_0xb087('0x57')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x57e857['label']));if(!this[_0xb087('0x80')](_0x57e857[_0xb087('0x140')])){return this['channel'][_0xb087('0x2b')](_0x57e857,_0xb087('0x146'));}logger['info'](util['format'](_0xb087('0x147'),this['channel'][_0xb087('0x3a')],_0x57e857[_0xb087('0x140')]));var _0x1cf7b7=this['agentUnpause']['sync'](this,_0x57e857[_0xb087('0x140')]);if(_0x1cf7b7){logger[_0xb087('0x2e')](util['format'](_0xb087('0x141'),this[_0xb087('0xf')][_0xb087('0x3a')],_0x57e857['findBy']));this[_0xb087('0xf')]['noop'](util[_0xb087('0x57')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb087('0xf')][_0xb087('0x3a')],_0x57e857[_0xb087('0x140')]));return{'code':0xc8,'result':_0xb087('0x142')};}else{logger[_0xb087('0x2e')](util[_0xb087('0x57')](_0xb087('0x143'),this[_0xb087('0xf')][_0xb087('0x3a')],_0x57e857[_0xb087('0x140')]));this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0x143'),this[_0xb087('0xf')][_0xb087('0x3a')],_0x57e857[_0xb087('0x140')]));return{'code':0xc8,'result':_0xb087('0x144')};}};AGIVertices[_0xb087('0x11')][_0xb087('0x1ac')]=function(_0x1aabad){logger[_0xb087('0x2e')](util['format'](_0xb087('0x1ad'),_0x1aabad[_0xb087('0x37')]));var _0x71d0a2=this[_0xb087('0xf')][_0xb087('0xb0')]('VOICEMAIL',[_0x1aabad[_0xb087('0x1ae')],_0x1aabad['options']]);if(_0x71d0a2['result']===-0x1){return _0x71d0a2;}return this[_0xb087('0xf')][_0xb087('0xad')](util[_0xb087('0x57')](_0xb087('0xb2'),_0xb087('0x1af'),_0x1aabad[_0xb087('0x1ae')]));};AGIVertices[_0xb087('0x11')][_0xb087('0x1b0')]=function(_0x244f68){logger['info'](util[_0xb087('0x57')](_0xb087('0x1b1'),_0x244f68[_0xb087('0x37')]));if(!this[_0xb087('0x80')](_0x244f68[_0xb087('0xce')])){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x244f68,_0xb087('0x18f'));}var _0x12c727=this['getVariable'][_0xb087('0x9d')](this,_0x244f68[_0xb087('0xce')]);if(!_0x12c727){return this[_0xb087('0xf')][_0xb087('0x2b')](_0x244f68,'no\x20variable\x20found');}var _0x409a02=this[_0xb087('0xf')]['getVariable'](_0x12c727);return{'code':0xc8,'result':_0x409a02[_0xb087('0x9a')]?_0x409a02[_0xb087('0x9a')]:'-'};};String[_0xb087('0x11')][_0xb087('0x99')]=function(_0x5275cf,_0x52a091){return this['split'](_0x5275cf)[_0xb087('0x1b2')](_0x52a091);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 6a2eee5..7dd61ab 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 _0xbd50=['syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','interface','queue','voiceQueues','ACW','mandatoryDisposition','mandatoryDispositionPause','name','getAgent','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','prototype','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','message','syncAgentConnect','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','agents','timers','channels','agentconnect','hanguprequest','syncHangupRequest','bind','syncHangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xbd50,0x196));var _0x0bd5=function(_0x250f82,_0xca2c51){_0x250f82=_0x250f82-0x0;var _0x3d8e8a=_0xbd50[_0x250f82];return _0x3d8e8a;};'use strict';var util=require(_0x0bd5('0x0'));var _=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var ami=require('../ami');var logger=require(_0x0bd5('0x3'))(_0x0bd5('0x4'));var RpcUser=require(_0x0bd5('0x5'));var RpcVoiceAgentReport=require(_0x0bd5('0x6'));function Acw(_0x15620d){this['voiceQueues']=_0x15620d['voiceQueues'];this['agents']=_0x15620d[_0x0bd5('0x7')];this[_0x0bd5('0x8')]=_0x15620d[_0x0bd5('0x8')];this[_0x0bd5('0x9')]={};ami['on'](_0x0bd5('0xa'),this['syncAgentConnect']['bind'](this));ami['on'](_0x0bd5('0xb'),this[_0x0bd5('0xc')][_0x0bd5('0xd')](this));ami['on']('hangup',this[_0x0bd5('0xe')][_0x0bd5('0xd')](this));ami['on']('agentringnoanswer',this[_0x0bd5('0xf')][_0x0bd5('0xd')](this));ami['on']('attendedtransfer',this[_0x0bd5('0x10')][_0x0bd5('0xd')](this));ami['on'](_0x0bd5('0x11'),this['syncBlindTransfer'][_0x0bd5('0xd')](this));ami['on'](_0x0bd5('0x12'),this[_0x0bd5('0x13')][_0x0bd5('0xd')](this));}function getDiff(_0xfa1eed){var _0x557be0=moment()[_0x0bd5('0x14')](0x0);var _0x1e961d=moment(_0xfa1eed)['milliseconds'](0x0);return _0x557be0[_0x0bd5('0x15')](_0x1e961d,_0x0bd5('0x16'));}Acw['prototype'][_0x0bd5('0x17')]=function(_0x23ef4e){try{var _0x3a34e4=this;var _0xc22553=this['channels'][_0x23ef4e][_0x0bd5('0x18')];var _0x2e4f36=this[_0x0bd5('0x9')][_0x23ef4e][_0x0bd5('0x19')];var _0x833c14=this[_0x0bd5('0x1a')][_0x2e4f36];var _0xc58e12=![];var _0x19fe20=_0x0bd5('0x1b');if(_0x833c14[_0x0bd5('0x1c')]){if(_0x833c14[_0x0bd5('0x1d')][_0x0bd5('0x1e')]){_0xc58e12=!![];_0x19fe20=_0x833c14[_0x0bd5('0x1d')][_0x0bd5('0x1e')];}}ami['Action']({'action':'QueuePause','interface':_0xc22553,'paused':!![],'reason':_0x19fe20})['then'](function(_0x4ed64e){if(_0x3a34e4['agents'][_0xc22553]){return RpcUser[_0x0bd5('0x1f')](_0x3a34e4[_0x0bd5('0x7')][_0xc22553]['id'])[_0x0bd5('0x20')](function(_0x4a6910){if(_0x4a6910&&!_0x4a6910[_0x0bd5('0x21')]){logger['info'](_0x0bd5('0x22'),_0x23ef4e,_0xc22553,_0x2e4f36);var _0x3b235b=_0x3a34e4[_0x0bd5('0x9')][_0x23ef4e]['attended']&&_0x3a34e4[_0x0bd5('0x9')][_0x23ef4e]['destlinkedid']?_0x3a34e4['channels'][_0x23ef4e][_0x0bd5('0x23')]:_0x23ef4e;return RpcUser[_0x0bd5('0x24')](_0x3a34e4[_0x0bd5('0x7')][_0xc22553],_0x19fe20,_0x3b235b)['then'](function(_0x42428c){if(!_0xc58e12){_0x3a34e4['timers'][_0xc22553]={};logger[_0x0bd5('0x25')](_0x0bd5('0x26'),_0x23ef4e,_0x3a34e4[_0x0bd5('0x1a')][_0x2e4f36][_0x0bd5('0x27')],_0xc22553,_0x2e4f36);_0x3a34e4[_0x0bd5('0x8')][_0xc22553][_0x0bd5('0x28')]=setTimeout(_0x3a34e4[_0x0bd5('0x29')][_0x0bd5('0xd')](_0x3a34e4,_0xc22553),_0x3a34e4[_0x0bd5('0x1a')][_0x2e4f36][_0x0bd5('0x27')]*0x3e8);_0x3a34e4[_0x0bd5('0x8')][_0xc22553][_0x0bd5('0x2a')]=moment()[_0x0bd5('0x2b')](_0x0bd5('0x2c'));_0x3a34e4['timers'][_0xc22553][_0x0bd5('0x2d')]=_0x23ef4e;_0x3a34e4[_0x0bd5('0x8')][_0xc22553]['queue']=_0x2e4f36;_0x3a34e4[_0x0bd5('0x8')][_0xc22553][_0x0bd5('0x2e')]=function(){var _0x5d9d20=getDiff(_0x3a34e4[_0x0bd5('0x8')][_0xc22553][_0x0bd5('0x2a')]);clearTimeout(_0x3a34e4[_0x0bd5('0x8')][_0xc22553][_0x0bd5('0x28')]);_0x3a34e4['timers'][_0xc22553][_0x0bd5('0x28')]=![];RpcVoiceAgentReport[_0x0bd5('0x2f')]({'acwtime':_0x5d9d20},_0x3a34e4[_0x0bd5('0x8')][_0xc22553][_0x0bd5('0x2d')],_0xc22553)[_0x0bd5('0x20')](function(_0x386baa){logger['info'](_0x0bd5('0x30'),_0x23ef4e,_0x5d9d20,_0x386baa);})['catch'](function(_0x398362){logger[_0x0bd5('0x31')](_0x0bd5('0x32'),_0x23ef4e,_0x398362);});delete _0x3a34e4[_0x0bd5('0x8')][_0xc22553];};}});}else{logger[_0x0bd5('0x25')](_0x0bd5('0x33'),_0x23ef4e,_0xc22553,_0x2e4f36);}});}})[_0x0bd5('0x34')](function(_0x24f7d5){logger[_0x0bd5('0x31')](_0x0bd5('0x26'),_0x23ef4e,_0x3a34e4[_0x0bd5('0x1a')][_0x2e4f36][_0x0bd5('0x27')],_0xc22553,_0x2e4f36);})[_0x0bd5('0x35')](function(){delete _0x3a34e4['channels'][_0x23ef4e];});}catch(_0x3e153a){logger[_0x0bd5('0x31')]('[ACW][START]\x20%s',_0x3e153a['message']);}};Acw[_0x0bd5('0x36')][_0x0bd5('0x29')]=function(_0x8a6edc){try{var _0x3155c5=this;if(_0x3155c5[_0x0bd5('0x8')][_0x8a6edc]){_0x3155c5[_0x0bd5('0x8')][_0x8a6edc][_0x0bd5('0x28')]=![];var _0x1a0c0c=_0x3155c5[_0x0bd5('0x8')][_0x8a6edc][_0x0bd5('0x2d')];var _0x311bbe=_0x3155c5[_0x0bd5('0x8')][_0x8a6edc][_0x0bd5('0x19')];var _0x4c4fd4=_0x3155c5[_0x0bd5('0x1a')][_0x311bbe]['acwTimeout'];logger[_0x0bd5('0x25')](_0x0bd5('0x37'),_0x8a6edc);RpcUser[_0x0bd5('0x38')](this[_0x0bd5('0x7')][_0x8a6edc]);RpcVoiceAgentReport[_0x0bd5('0x2f')]({'acwtime':_0x4c4fd4,'agentacw':!![]},_0x1a0c0c,_0x8a6edc)[_0x0bd5('0x20')](function(_0x53a682){logger[_0x0bd5('0x25')](_0x0bd5('0x30'),_0x1a0c0c,_0x4c4fd4,_0x53a682);})[_0x0bd5('0x34')](function(_0x1a9dda){logger[_0x0bd5('0x31')](_0x0bd5('0x32'),_0x1a0c0c,_0x1a9dda);});}else{logger[_0x0bd5('0x31')](_0x0bd5('0x39'),_0x8a6edc);if(_0x3155c5[_0x0bd5('0x8')]){logger['info'](_0x0bd5('0x3a'),JSON['stringify'](_0x3155c5[_0x0bd5('0x8')]));}}}catch(_0xc17464){logger['error'](_0x0bd5('0x3b'),_0xc17464[_0x0bd5('0x3c')]);}};Acw[_0x0bd5('0x36')][_0x0bd5('0x3d')]=function(_0x1eff38){try{if(this[_0x0bd5('0x1a')][_0x1eff38[_0x0bd5('0x19')]]&&(this['voiceQueues'][_0x1eff38['queue']][_0x0bd5('0x4')]||this['voiceQueues'][_0x1eff38['queue']][_0x0bd5('0x1c')])){if(this[_0x0bd5('0x7')][_0x1eff38['interface']]){this['channels'][_0x1eff38['uniqueid']]={'queue':_0x1eff38[_0x0bd5('0x19')],'interface':_0x1eff38['interface'],'destlinkedid':_0x1eff38['destlinkedid']};}}}catch(_0x28d252){logger[_0x0bd5('0x31')]('[ACW][syncAgentConnect]\x20%s',_0x28d252['message']);}};Acw[_0x0bd5('0x36')][_0x0bd5('0x13')]=function(_0x238fc7){try{if(this[_0x0bd5('0x1a')][_0x238fc7['queue']]&&(this[_0x0bd5('0x1a')][_0x238fc7[_0x0bd5('0x19')]][_0x0bd5('0x4')]||this[_0x0bd5('0x1a')][_0x238fc7[_0x0bd5('0x19')]][_0x0bd5('0x1c')])){if(this['agents'][_0x238fc7[_0x0bd5('0x18')]]){this[_0x0bd5('0x9')][_0x238fc7[_0x0bd5('0x2d')]]={'queue':_0x238fc7['queue'],'interface':_0x238fc7[_0x0bd5('0x18')]};}}}catch(_0x2628b5){logger[_0x0bd5('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x2628b5[_0x0bd5('0x3c')]);}};Acw[_0x0bd5('0x36')][_0x0bd5('0xc')]=function(_0x18c7c7){try{if(this[_0x0bd5('0x9')][_0x18c7c7['uniqueid']]&&_[_0x0bd5('0x3e')](this[_0x0bd5('0x9')][_0x18c7c7['uniqueid']][_0x0bd5('0x3f')])){logger[_0x0bd5('0x25')](_0x0bd5('0x40'),_0x18c7c7[_0x0bd5('0x2d')]);this[_0x0bd5('0x17')](_0x18c7c7['uniqueid']);}else if(this[_0x0bd5('0x9')][_0x18c7c7[_0x0bd5('0x41')]]&&_['isUndefined'](this[_0x0bd5('0x9')][_0x18c7c7['linkedid']][_0x0bd5('0x3f')])){logger[_0x0bd5('0x25')](_0x0bd5('0x42'),_0x18c7c7[_0x0bd5('0x41')]);this['startAcw'](_0x18c7c7[_0x0bd5('0x41')]);}}catch(_0x4cb674){logger['error'](_0x0bd5('0x43'),_0x4cb674[_0x0bd5('0x3c')]);}};Acw[_0x0bd5('0x36')]['syncHangup']=function(_0x424187){try{if(this['channels'][_0x424187[_0x0bd5('0x2d')]]&&this[_0x0bd5('0x9')][_0x424187[_0x0bd5('0x2d')]]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x424187[_0x0bd5('0x2d')]);this[_0x0bd5('0x17')](_0x424187[_0x0bd5('0x2d')]);}else if(this['channels'][_0x424187[_0x0bd5('0x41')]]&&this[_0x0bd5('0x9')][_0x424187['linkedid']][_0x0bd5('0x3f')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x424187[_0x0bd5('0x41')]);this[_0x0bd5('0x17')](_0x424187[_0x0bd5('0x41')]);}}catch(_0xb09083){logger['error'](_0x0bd5('0x44'),_0xb09083[_0x0bd5('0x3c')]);}};Acw[_0x0bd5('0x36')]['syncAttendedTransfer']=function(_0x504e46){try{if(!_[_0x0bd5('0x45')](this[_0x0bd5('0x9')][_0x504e46['transfereeuniqueid']])){this['startAcw'](_0x504e46[_0x0bd5('0x46')]);if(this['channels'][_0x504e46[_0x0bd5('0x47')]]){this[_0x0bd5('0x9')][_0x504e46[_0x0bd5('0x47')]]['attended']=!![];this[_0x0bd5('0x9')][_0x504e46[_0x0bd5('0x48')]]=this[_0x0bd5('0x9')][_0x504e46[_0x0bd5('0x47')]];delete this['channels'][_0x504e46[_0x0bd5('0x47')]];}}else if(!_[_0x0bd5('0x45')](this[_0x0bd5('0x9')][_0x504e46[_0x0bd5('0x48')]])){this[_0x0bd5('0x17')](_0x504e46['transfertargetuniqueid']);if(this[_0x0bd5('0x9')][_0x504e46['origtransfereruniqueid']]){this[_0x0bd5('0x9')][_0x504e46['origtransfereruniqueid']]['attended']=!![];this[_0x0bd5('0x9')][_0x504e46['transfereeuniqueid']]=this[_0x0bd5('0x9')][_0x504e46[_0x0bd5('0x49')]];delete this[_0x0bd5('0x9')][_0x504e46['origtransfereruniqueid']];}}}catch(_0x4f7e86){logger[_0x0bd5('0x31')]('[ACW][syncAttendedTransfer]\x20%s',_0x4f7e86[_0x0bd5('0x3c')]);}};Acw[_0x0bd5('0x36')]['syncBlindTransfer']=function(_0x460ebb){try{if(this['channels'][_0x460ebb[_0x0bd5('0x4a')]]){logger[_0x0bd5('0x25')](_0x0bd5('0x4b'),JSON[_0x0bd5('0x4c')](_0x460ebb[_0x0bd5('0x4a')]));this[_0x0bd5('0x17')](_0x460ebb[_0x0bd5('0x4a')]);}else if(this['channels'][_0x460ebb[_0x0bd5('0x4d')]]){logger[_0x0bd5('0x25')](_0x0bd5('0x4e'),JSON['stringify'](_0x460ebb['transfererlinkedid']));this[_0x0bd5('0x17')](_0x460ebb[_0x0bd5('0x4d')]);}}catch(_0x2d7d01){logger[_0x0bd5('0x31')](_0x0bd5('0x4f'),_0x2d7d01[_0x0bd5('0x3c')]);}};Acw[_0x0bd5('0x36')][_0x0bd5('0xf')]=function(_0x38687d){try{if(this[_0x0bd5('0x1a')][_0x38687d[_0x0bd5('0x19')]]&&this[_0x0bd5('0x1a')][_0x38687d[_0x0bd5('0x19')]][_0x0bd5('0x50')]===_0x0bd5('0x51')){if(this[_0x0bd5('0x7')][_0x38687d[_0x0bd5('0x18')]]){logger[_0x0bd5('0x25')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x38687d[_0x0bd5('0x2d')],_0x38687d[_0x0bd5('0x18')],_0x38687d['queue']);return RpcUser[_0x0bd5('0x24')](this['agents'][_0x38687d[_0x0bd5('0x18')]],_0x0bd5('0x52'),_0x38687d['uniqueid']);}}}catch(_0x35fc98){logger[_0x0bd5('0x31')](_0x0bd5('0x53'),_0x35fc98[_0x0bd5('0x3c')]);}};module[_0x0bd5('0x54')]=Acw; \ No newline at end of file +var _0xd6d6=['origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','stopAcw','[TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid'];(function(_0x45265a,_0x17c109){var _0x43ebf0=function(_0x472ed1){while(--_0x472ed1){_0x45265a['push'](_0x45265a['shift']());}};_0x43ebf0(++_0x17c109);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x278d60,_0x36164f){_0x278d60=_0x278d60-0x0;var _0x386349=_0xd6d6[_0x278d60];return _0x386349;};'use strict';var util=require(_0x6d6d('0x0'));var _=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var ami=require(_0x6d6d('0x3'));var logger=require('../../../config/logger')(_0x6d6d('0x4'));var RpcUser=require(_0x6d6d('0x5'));var RpcVoiceAgentReport=require(_0x6d6d('0x6'));function Acw(_0x2a838a){this[_0x6d6d('0x7')]=_0x2a838a[_0x6d6d('0x7')];this[_0x6d6d('0x8')]=_0x2a838a['agents'];this[_0x6d6d('0x9')]=_0x2a838a[_0x6d6d('0x9')];this[_0x6d6d('0xa')]={};ami['on'](_0x6d6d('0xb'),this[_0x6d6d('0xc')][_0x6d6d('0xd')](this));ami['on'](_0x6d6d('0xe'),this['syncHangupRequest']['bind'](this));ami['on'](_0x6d6d('0xf'),this[_0x6d6d('0x10')][_0x6d6d('0xd')](this));ami['on'](_0x6d6d('0x11'),this[_0x6d6d('0x12')]['bind'](this));ami['on'](_0x6d6d('0x13'),this[_0x6d6d('0x14')]['bind'](this));ami['on']('blindtransfer',this[_0x6d6d('0x15')][_0x6d6d('0xd')](this));ami['on'](_0x6d6d('0x16'),this[_0x6d6d('0x17')][_0x6d6d('0xd')](this));}function getDiff(_0x41fbdf){var _0x19cf50=moment()[_0x6d6d('0x18')](0x0);var _0x5f4154=moment(_0x41fbdf)[_0x6d6d('0x18')](0x0);return _0x19cf50[_0x6d6d('0x19')](_0x5f4154,_0x6d6d('0x1a'));}Acw[_0x6d6d('0x1b')][_0x6d6d('0x1c')]=function(_0x5d80c0){try{var _0x2e6fdb=this;var _0x587338=this[_0x6d6d('0xa')][_0x5d80c0][_0x6d6d('0x1d')];var _0x1cc02b=this['channels'][_0x5d80c0]['queue'];var _0x9e1e18=this[_0x6d6d('0x7')][_0x1cc02b];var _0x2b59d4=![];var _0x2c5314='ACW';if(_0x9e1e18['mandatoryDisposition']){if(_0x9e1e18[_0x6d6d('0x1e')]['name']){_0x2b59d4=!![];_0x2c5314=_0x9e1e18[_0x6d6d('0x1e')][_0x6d6d('0x1f')];}}ami[_0x6d6d('0x20')]({'action':_0x6d6d('0x21'),'interface':_0x587338,'paused':!![],'reason':_0x2c5314})[_0x6d6d('0x22')](function(_0x3242d8){if(_0x2e6fdb[_0x6d6d('0x8')][_0x587338]){return RpcUser[_0x6d6d('0x23')](_0x2e6fdb[_0x6d6d('0x8')][_0x587338]['id'])[_0x6d6d('0x22')](function(_0x24b10d){if(_0x24b10d&&!_0x24b10d[_0x6d6d('0x24')]){logger[_0x6d6d('0x25')](_0x6d6d('0x26'),_0x5d80c0,_0x587338,_0x1cc02b);var _0x1f7f88=_0x2e6fdb[_0x6d6d('0xa')][_0x5d80c0][_0x6d6d('0x27')]&&_0x2e6fdb['channels'][_0x5d80c0][_0x6d6d('0x28')]?_0x2e6fdb[_0x6d6d('0xa')][_0x5d80c0][_0x6d6d('0x28')]:_0x5d80c0;return RpcUser[_0x6d6d('0x29')](_0x2e6fdb[_0x6d6d('0x8')][_0x587338],_0x2c5314,_0x1f7f88)[_0x6d6d('0x22')](function(_0x554f8e){if(!_0x2b59d4){_0x2e6fdb[_0x6d6d('0x9')][_0x587338]={};logger[_0x6d6d('0x25')](_0x6d6d('0x2a'),_0x5d80c0,_0x2e6fdb[_0x6d6d('0x7')][_0x1cc02b][_0x6d6d('0x2b')],_0x587338,_0x1cc02b);_0x2e6fdb[_0x6d6d('0x9')][_0x587338][_0x6d6d('0x2c')]=setTimeout(_0x2e6fdb['stopAcw'][_0x6d6d('0xd')](_0x2e6fdb,_0x587338),_0x2e6fdb[_0x6d6d('0x7')][_0x1cc02b]['acwTimeout']*0x3e8);_0x2e6fdb['timers'][_0x587338][_0x6d6d('0x2d')]=moment()[_0x6d6d('0x2e')](_0x6d6d('0x2f'));_0x2e6fdb['timers'][_0x587338][_0x6d6d('0x30')]=_0x5d80c0;_0x2e6fdb[_0x6d6d('0x9')][_0x587338][_0x6d6d('0x31')]=_0x1cc02b;_0x2e6fdb[_0x6d6d('0x9')][_0x587338][_0x6d6d('0x32')]=function(){var _0x428c17=getDiff(_0x2e6fdb[_0x6d6d('0x9')][_0x587338][_0x6d6d('0x2d')]);clearTimeout(_0x2e6fdb[_0x6d6d('0x9')][_0x587338][_0x6d6d('0x2c')]);_0x2e6fdb['timers'][_0x587338][_0x6d6d('0x2c')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x428c17},_0x2e6fdb[_0x6d6d('0x9')][_0x587338][_0x6d6d('0x30')],_0x587338)[_0x6d6d('0x22')](function(_0x2814ed){logger['info'](_0x6d6d('0x33'),_0x5d80c0,_0x428c17,_0x2814ed);})['catch'](function(_0x3cc702){logger[_0x6d6d('0x34')]('[%s][UPDATE][ERRORS:%s]',_0x5d80c0,_0x3cc702);});delete _0x2e6fdb[_0x6d6d('0x9')][_0x587338];};}});}else{logger[_0x6d6d('0x25')](_0x6d6d('0x35'),_0x5d80c0,_0x587338,_0x1cc02b);}});}})[_0x6d6d('0x36')](function(_0x34c390){logger[_0x6d6d('0x34')](_0x6d6d('0x2a'),_0x5d80c0,_0x2e6fdb[_0x6d6d('0x7')][_0x1cc02b][_0x6d6d('0x2b')],_0x587338,_0x1cc02b);})[_0x6d6d('0x37')](function(){delete _0x2e6fdb[_0x6d6d('0xa')][_0x5d80c0];});}catch(_0x3693da){logger[_0x6d6d('0x34')](_0x6d6d('0x38'),_0x3693da['message']);}};Acw[_0x6d6d('0x1b')][_0x6d6d('0x39')]=function(_0x3e2415){try{var _0x5e4f38=this;if(_0x5e4f38['timers'][_0x3e2415]){_0x5e4f38['timers'][_0x3e2415][_0x6d6d('0x2c')]=![];var _0x26b2de=_0x5e4f38[_0x6d6d('0x9')][_0x3e2415]['uniqueid'];var _0x2a3f67=_0x5e4f38[_0x6d6d('0x9')][_0x3e2415][_0x6d6d('0x31')];var _0x125d79=_0x5e4f38['voiceQueues'][_0x2a3f67]['acwTimeout'];logger['info'](_0x6d6d('0x3a'),_0x3e2415);RpcUser[_0x6d6d('0x3b')](this[_0x6d6d('0x8')][_0x3e2415]);RpcVoiceAgentReport[_0x6d6d('0x3c')]({'acwtime':_0x125d79,'agentacw':!![]},_0x26b2de,_0x3e2415)['then'](function(_0x253416){logger[_0x6d6d('0x25')](_0x6d6d('0x33'),_0x26b2de,_0x125d79,_0x253416);})[_0x6d6d('0x36')](function(_0x3d632c){logger[_0x6d6d('0x34')]('[%s][UPDATE][ERRORS:%s]',_0x26b2de,_0x3d632c);});}else{logger[_0x6d6d('0x34')](_0x6d6d('0x3d'),_0x3e2415);if(_0x5e4f38[_0x6d6d('0x9')]){logger[_0x6d6d('0x25')](_0x6d6d('0x3e'),JSON[_0x6d6d('0x3f')](_0x5e4f38[_0x6d6d('0x9')]));}}}catch(_0x54bf87){logger[_0x6d6d('0x34')](_0x6d6d('0x40'),_0x54bf87[_0x6d6d('0x41')]);}};Acw[_0x6d6d('0x1b')][_0x6d6d('0xc')]=function(_0x5d9268){try{if(this[_0x6d6d('0x7')][_0x5d9268[_0x6d6d('0x31')]]&&(this['voiceQueues'][_0x5d9268[_0x6d6d('0x31')]]['acw']||this[_0x6d6d('0x7')][_0x5d9268[_0x6d6d('0x31')]]['mandatoryDisposition'])){if(this[_0x6d6d('0x8')][_0x5d9268[_0x6d6d('0x1d')]]){this[_0x6d6d('0xa')][_0x5d9268[_0x6d6d('0x30')]]={'queue':_0x5d9268[_0x6d6d('0x31')],'interface':_0x5d9268['interface'],'destlinkedid':_0x5d9268['destlinkedid']};}}}catch(_0x981dd7){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x981dd7[_0x6d6d('0x41')]);}};Acw[_0x6d6d('0x1b')][_0x6d6d('0x17')]=function(_0x49aa5d){try{if(this[_0x6d6d('0x7')][_0x49aa5d['queue']]&&(this[_0x6d6d('0x7')][_0x49aa5d[_0x6d6d('0x31')]][_0x6d6d('0x4')]||this[_0x6d6d('0x7')][_0x49aa5d[_0x6d6d('0x31')]][_0x6d6d('0x42')])){if(this[_0x6d6d('0x8')][_0x49aa5d['interface']]){this[_0x6d6d('0xa')][_0x49aa5d[_0x6d6d('0x30')]]={'queue':_0x49aa5d[_0x6d6d('0x31')],'interface':_0x49aa5d[_0x6d6d('0x1d')]};}}}catch(_0x320390){logger[_0x6d6d('0x34')](_0x6d6d('0x43'),_0x320390[_0x6d6d('0x41')]);}};Acw[_0x6d6d('0x1b')]['syncHangupRequest']=function(_0x4d78bb){try{if(this[_0x6d6d('0xa')][_0x4d78bb[_0x6d6d('0x30')]]&&_[_0x6d6d('0x44')](this[_0x6d6d('0xa')][_0x4d78bb[_0x6d6d('0x30')]]['attended'])){logger[_0x6d6d('0x25')](_0x6d6d('0x45'),_0x4d78bb[_0x6d6d('0x30')]);this[_0x6d6d('0x1c')](_0x4d78bb[_0x6d6d('0x30')]);}else if(this[_0x6d6d('0xa')][_0x4d78bb[_0x6d6d('0x46')]]&&_[_0x6d6d('0x44')](this[_0x6d6d('0xa')][_0x4d78bb[_0x6d6d('0x46')]][_0x6d6d('0x27')])){logger[_0x6d6d('0x25')]('[%s][HANGUP:LINKEDID]',_0x4d78bb[_0x6d6d('0x46')]);this[_0x6d6d('0x1c')](_0x4d78bb[_0x6d6d('0x46')]);}}catch(_0x972221){logger[_0x6d6d('0x34')]('[ACW][syncHangupRequest]\x20%s',_0x972221[_0x6d6d('0x41')]);}};Acw[_0x6d6d('0x1b')][_0x6d6d('0x10')]=function(_0x4e4c3e){try{if(this['channels'][_0x4e4c3e[_0x6d6d('0x30')]]&&this['channels'][_0x4e4c3e[_0x6d6d('0x30')]][_0x6d6d('0x27')]){logger[_0x6d6d('0x25')](_0x6d6d('0x47'),_0x4e4c3e[_0x6d6d('0x30')]);this[_0x6d6d('0x1c')](_0x4e4c3e[_0x6d6d('0x30')]);}else if(this[_0x6d6d('0xa')][_0x4e4c3e[_0x6d6d('0x46')]]&&this[_0x6d6d('0xa')][_0x4e4c3e['linkedid']][_0x6d6d('0x27')]){logger[_0x6d6d('0x25')](_0x6d6d('0x48'),_0x4e4c3e[_0x6d6d('0x46')]);this[_0x6d6d('0x1c')](_0x4e4c3e[_0x6d6d('0x46')]);}}catch(_0x243be3){logger['error']('[ACW][syncHangup]\x20%s',_0x243be3[_0x6d6d('0x41')]);}};Acw[_0x6d6d('0x1b')]['syncAttendedTransfer']=function(_0x3e98a0){try{if(!_[_0x6d6d('0x49')](this[_0x6d6d('0xa')][_0x3e98a0[_0x6d6d('0x4a')]])){this[_0x6d6d('0x1c')](_0x3e98a0[_0x6d6d('0x4a')]);if(this[_0x6d6d('0xa')][_0x3e98a0[_0x6d6d('0x4b')]]){this[_0x6d6d('0xa')][_0x3e98a0[_0x6d6d('0x4b')]][_0x6d6d('0x27')]=!![];this[_0x6d6d('0xa')][_0x3e98a0[_0x6d6d('0x4c')]]=this[_0x6d6d('0xa')][_0x3e98a0[_0x6d6d('0x4b')]];delete this['channels'][_0x3e98a0[_0x6d6d('0x4b')]];}}else if(!_[_0x6d6d('0x49')](this['channels'][_0x3e98a0[_0x6d6d('0x4c')]])){this[_0x6d6d('0x1c')](_0x3e98a0[_0x6d6d('0x4c')]);if(this[_0x6d6d('0xa')][_0x3e98a0[_0x6d6d('0x4d')]]){this[_0x6d6d('0xa')][_0x3e98a0[_0x6d6d('0x4d')]][_0x6d6d('0x27')]=!![];this[_0x6d6d('0xa')][_0x3e98a0['transfereeuniqueid']]=this['channels'][_0x3e98a0[_0x6d6d('0x4d')]];delete this[_0x6d6d('0xa')][_0x3e98a0[_0x6d6d('0x4d')]];}}}catch(_0x5de33f){logger['error'](_0x6d6d('0x4e'),_0x5de33f['message']);}};Acw[_0x6d6d('0x1b')]['syncBlindTransfer']=function(_0x395fa9){try{if(this[_0x6d6d('0xa')][_0x395fa9[_0x6d6d('0x4f')]]){logger[_0x6d6d('0x25')](_0x6d6d('0x50'),JSON[_0x6d6d('0x3f')](_0x395fa9['transfereruniqueid']));this[_0x6d6d('0x1c')](_0x395fa9['transfereruniqueid']);}else if(this[_0x6d6d('0xa')][_0x395fa9['transfererlinkedid']]){logger[_0x6d6d('0x25')](_0x6d6d('0x51'),JSON[_0x6d6d('0x3f')](_0x395fa9[_0x6d6d('0x52')]));this[_0x6d6d('0x1c')](_0x395fa9[_0x6d6d('0x52')]);}}catch(_0x23d950){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x23d950[_0x6d6d('0x41')]);}};Acw['prototype'][_0x6d6d('0x12')]=function(_0x53b77a){try{if(this[_0x6d6d('0x7')][_0x53b77a[_0x6d6d('0x31')]]&&this[_0x6d6d('0x7')][_0x53b77a[_0x6d6d('0x31')]][_0x6d6d('0x53')]===_0x6d6d('0x54')){if(this['agents'][_0x53b77a[_0x6d6d('0x1d')]]){logger[_0x6d6d('0x25')](_0x6d6d('0x55'),_0x53b77a[_0x6d6d('0x30')],_0x53b77a[_0x6d6d('0x1d')],_0x53b77a[_0x6d6d('0x31')]);return RpcUser[_0x6d6d('0x29')](this['agents'][_0x53b77a[_0x6d6d('0x1d')]],_0x6d6d('0x56'),_0x53b77a[_0x6d6d('0x30')]);}}}catch(_0x3bf8a7){logger[_0x6d6d('0x34')](_0x6d6d('0x57'),_0x3bf8a7[_0x6d6d('0x41')]);}};module[_0x6d6d('0x58')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 07e3556..4965327 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 _0xad79=['actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','port','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionQueueSummary','log','exports','asterisk-manager','bluebird','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x404079,_0x5df589){var _0x2c53af=function(_0x114073){while(--_0x114073){_0x404079['push'](_0x404079['shift']());}};_0x2c53af(++_0x5df589);}(_0xad79,0x1ba));var _0x9ad7=function(_0xfc69eb,_0x51100d){_0xfc69eb=_0xfc69eb-0x0;var _0x2a9d40=_0xad79[_0xfc69eb];return _0x2a9d40;};'use strict';var Manager=require(_0x9ad7('0x0'));var BPromise=require(_0x9ad7('0x1'));var moment=require(_0x9ad7('0x2'));var util=require(_0x9ad7('0x3'));var _=require(_0x9ad7('0x4'));var logger=require(_0x9ad7('0x5'))(_0x9ad7('0x6'));var config=require(_0x9ad7('0x7'));var ami=new Manager(config[_0x9ad7('0x8')]['port'],config[_0x9ad7('0x8')]['ip'],config['asterisk']['username'],config[_0x9ad7('0x8')][_0x9ad7('0x9')],!![]);ami[_0x9ad7('0xa')]();ami[_0x9ad7('0xb')]=BPromise[_0x9ad7('0xc')](ami[_0x9ad7('0xd')]);function error(_0x3fce82){logger[_0x9ad7('0xe')](util[_0x9ad7('0xf')](_0x9ad7('0x10'),config[_0x9ad7('0x8')][_0x9ad7('0x11')],config['asterisk']['ip'],config['asterisk']['port'],util[_0x9ad7('0x12')](_0x3fce82,![],null)));}function close(){logger[_0x9ad7('0xe')](util[_0x9ad7('0xf')](_0x9ad7('0x13'),config[_0x9ad7('0x8')]['username'],config[_0x9ad7('0x8')]['ip'],config['asterisk']['port']));}ami[_0x9ad7('0x14')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x9ad7('0x15')]=function(){return function(){return ami['Action']({'action':_0x9ad7('0x16')});};};ami[_0x9ad7('0x17')]=function(){return function(){return ami[_0x9ad7('0xb')]({'action':_0x9ad7('0x18')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x9ad7('0x19')});};};ami[_0x9ad7('0x1a')]=function(){return function(){return ami[_0x9ad7('0xb')]({'action':_0x9ad7('0x1b')});};};function connect(_0x48fb6b){logger[_0x9ad7('0x1c')](util[_0x9ad7('0xf')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x9ad7('0x8')][_0x9ad7('0x11')],config[_0x9ad7('0x8')]['ip'],config[_0x9ad7('0x8')][_0x9ad7('0x1d')]));ami[_0x9ad7('0x1e')](_0x9ad7('0xe'),error);ami[_0x9ad7('0x1e')](_0x9ad7('0x1f'),close);}ami['on'](_0x9ad7('0x20'),connect);ami['on'](_0x9ad7('0x21'),function(_0x1214e0){logger[_0x9ad7('0x1c')](util[_0x9ad7('0xf')](_0x9ad7('0x22'),config[_0x9ad7('0x8')]['username'],config[_0x9ad7('0x8')]['ip'],config[_0x9ad7('0x8')][_0x9ad7('0x1d')],util['inspect'](_0x1214e0,![],null)));});ami['on'](_0x9ad7('0x23'),function(_0x3e9d85){logger['info'](util[_0x9ad7('0xf')](_0x9ad7('0x24'),config[_0x9ad7('0x8')][_0x9ad7('0x11')],config[_0x9ad7('0x8')]['ip'],config[_0x9ad7('0x8')][_0x9ad7('0x1d')]));return BPromise[_0x9ad7('0x25')]()['then'](ami['actionSipShowRegistry']())[_0x9ad7('0x26')](ami[_0x9ad7('0x15')]())['then'](ami[_0x9ad7('0x17')]())[_0x9ad7('0x26')](ami[_0x9ad7('0x27')]())[_0x9ad7('0x26')](ami[_0x9ad7('0x1a')]())['catch'](function(_0x57dda2){console[_0x9ad7('0x28')](_0x57dda2);});});ami[_0x9ad7('0x1e')](_0x9ad7('0xe'),error);ami[_0x9ad7('0x1e')]('close',close);module[_0x9ad7('0x29')]=ami; \ No newline at end of file +var _0x8b6f=['once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','catch','log','exports','asterisk-manager','bluebird','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x1e9713,_0x115f99){var _0x310d43=function(_0x392890){while(--_0x392890){_0x1e9713['push'](_0x1e9713['shift']());}};_0x310d43(++_0x115f99);}(_0x8b6f,0xac));var _0xf8b6=function(_0x510299,_0xa7d236){_0x510299=_0x510299-0x0;var _0x463422=_0x8b6f[_0x510299];return _0x463422;};'use strict';var Manager=require(_0xf8b6('0x0'));var BPromise=require(_0xf8b6('0x1'));var moment=require('moment');var util=require(_0xf8b6('0x2'));var _=require('lodash');var logger=require(_0xf8b6('0x3'))(_0xf8b6('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0xf8b6('0x5')][_0xf8b6('0x6')],config[_0xf8b6('0x5')]['ip'],config['asterisk'][_0xf8b6('0x7')],config[_0xf8b6('0x5')][_0xf8b6('0x8')],!![]);ami[_0xf8b6('0x9')]();ami[_0xf8b6('0xa')]=BPromise[_0xf8b6('0xb')](ami[_0xf8b6('0xc')]);function error(_0x9dce9e){logger[_0xf8b6('0xd')](util['format'](_0xf8b6('0xe'),config[_0xf8b6('0x5')][_0xf8b6('0x7')],config[_0xf8b6('0x5')]['ip'],config[_0xf8b6('0x5')][_0xf8b6('0x6')],util[_0xf8b6('0xf')](_0x9dce9e,![],null)));}function close(){logger[_0xf8b6('0xd')](util[_0xf8b6('0x10')](_0xf8b6('0x11'),config[_0xf8b6('0x5')][_0xf8b6('0x7')],config['asterisk']['ip'],config['asterisk'][_0xf8b6('0x6')]));}ami[_0xf8b6('0x12')]=function(){return function(){return ami['Action']({'action':_0xf8b6('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xf8b6('0xa')]({'action':_0xf8b6('0x14')});};};ami[_0xf8b6('0x15')]=function(){return function(){return ami['Action']({'action':_0xf8b6('0x16')});};};ami[_0xf8b6('0x17')]=function(){return function(){return ami['Action']({'action':_0xf8b6('0x18')});};};ami[_0xf8b6('0x19')]=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(_0x3f4539){logger[_0xf8b6('0x1a')](util[_0xf8b6('0x10')](_0xf8b6('0x1b'),config[_0xf8b6('0x5')][_0xf8b6('0x7')],config[_0xf8b6('0x5')]['ip'],config[_0xf8b6('0x5')][_0xf8b6('0x6')]));ami[_0xf8b6('0x1c')](_0xf8b6('0xd'),error);ami[_0xf8b6('0x1c')](_0xf8b6('0x1d'),close);}ami['on'](_0xf8b6('0x1e'),connect);ami['on']('shutdown',function(_0x48751a){logger[_0xf8b6('0x1a')](util['format'](_0xf8b6('0x1f'),config[_0xf8b6('0x5')][_0xf8b6('0x7')],config[_0xf8b6('0x5')]['ip'],config['asterisk']['port'],util[_0xf8b6('0xf')](_0x48751a,![],null)));});ami['on'](_0xf8b6('0x20'),function(_0x351ffa){logger['info'](util[_0xf8b6('0x10')](_0xf8b6('0x21'),config[_0xf8b6('0x5')][_0xf8b6('0x7')],config[_0xf8b6('0x5')]['ip'],config[_0xf8b6('0x5')]['port']));return BPromise[_0xf8b6('0x22')]()['then'](ami[_0xf8b6('0x12')]())[_0xf8b6('0x23')](ami[_0xf8b6('0x24')]())[_0xf8b6('0x23')](ami[_0xf8b6('0x15')]())[_0xf8b6('0x23')](ami['actionQueueSummary']())[_0xf8b6('0x23')](ami['actionCoreShowChannels']())[_0xf8b6('0x25')](function(_0x836979){console[_0xf8b6('0x26')](_0x836979);});});ami[_0xf8b6('0x1c')](_0xf8b6('0xd'),error);ami['once'](_0xf8b6('0x1d'),close);module[_0xf8b6('0x27')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 2ac57cb..b24cacb 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 _0x91e9=['catch','jayson/promise','bluebird','ami','client','http','request','debug','rpc','memberReport','error','message','result'];(function(_0x2f9355,_0x4aa223){var _0x37c46a=function(_0x46507b){while(--_0x46507b){_0x2f9355['push'](_0x2f9355['shift']());}};_0x37c46a(++_0x4aa223);}(_0x91e9,0x16d));var _0x991e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x91e9[_0x4565bf];return _0x5610ba;};'use strict';var jayson=require(_0x991e('0x0'));var BPromise=require(_0x991e('0x1'));var logger=require('../../config/logger')(_0x991e('0x2'));var client=jayson[_0x991e('0x3')][_0x991e('0x4')]({'port':0x2329});client['Request']=function(_0x236b67,_0x57f92b){return new BPromise(function(_0x6a3592,_0x2cb036){return client[_0x991e('0x5')](_0x236b67,_0x57f92b)['then'](function(_0x5d30b2){logger[_0x991e('0x6')](_0x991e('0x7'),_0x991e('0x8'),_0x236b67,_0x57f92b,_0x5d30b2);if(_0x5d30b2[_0x991e('0x9')]){logger[_0x991e('0x9')]('rpc',_0x991e('0x8'),_0x236b67,_0x5d30b2['error'][_0x991e('0xa')],_0x57f92b);return _0x2cb036(_0x5d30b2['error'][_0x991e('0xa')]);}else{return _0x6a3592(_0x5d30b2[_0x991e('0xb')]);}})[_0x991e('0xc')](function(_0x23bd65){logger[_0x991e('0x9')]('rpc',_0x991e('0x8'),_0x236b67,_0x23bd65,_0x57f92b);return _0x2cb036(_0x23bd65);});});};module['exports']=client; \ No newline at end of file +var _0xc3c2=['memberReport','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','rpc'];(function(_0x54dad8,_0x5b921b){var _0x2beeb8=function(_0x38961d){while(--_0x38961d){_0x54dad8['push'](_0x54dad8['shift']());}};_0x2beeb8(++_0x5b921b);}(_0xc3c2,0x150));var _0x2c3c=function(_0x5eb8ad,_0x9105a0){_0x5eb8ad=_0x5eb8ad-0x0;var _0x2cb906=_0xc3c2[_0x5eb8ad];return _0x2cb906;};'use strict';var jayson=require(_0x2c3c('0x0'));var BPromise=require(_0x2c3c('0x1'));var logger=require(_0x2c3c('0x2'))('ami');var client=jayson[_0x2c3c('0x3')][_0x2c3c('0x4')]({'port':0x2329});client[_0x2c3c('0x5')]=function(_0x4b1da3,_0x3f17ab){return new BPromise(function(_0x52bc05,_0x31e670){return client[_0x2c3c('0x6')](_0x4b1da3,_0x3f17ab)[_0x2c3c('0x7')](function(_0x533fe7){logger['debug'](_0x2c3c('0x8'),_0x2c3c('0x9'),_0x4b1da3,_0x3f17ab,_0x533fe7);if(_0x533fe7[_0x2c3c('0xa')]){logger[_0x2c3c('0xa')](_0x2c3c('0x8'),_0x2c3c('0x9'),_0x4b1da3,_0x533fe7[_0x2c3c('0xa')][_0x2c3c('0xb')],_0x3f17ab);return _0x31e670(_0x533fe7[_0x2c3c('0xa')][_0x2c3c('0xb')]);}else{return _0x52bc05(_0x533fe7[_0x2c3c('0xc')]);}})[_0x2c3c('0xd')](function(_0x2e70ef){logger[_0x2c3c('0xa')](_0x2c3c('0x8'),_0x2c3c('0x9'),_0x4b1da3,_0x2e70ef,_0x3f17ab);return _0x31e670(_0x2e70ef);});});};module[_0x2c3c('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 04cfcce..977bd4b 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 _0x1d90=['originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','name','dialCutDigit','number','substring','prototype','getQueue','util','moment','isNil','string','voiceQueue','uniqueid','Contact','firstName','lastName','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1d90,0x13e));var _0x01d9=function(_0x5aaf20,_0x38dc01){_0x5aaf20=_0x5aaf20-0x0;var _0x5a8c39=_0x1d90[_0x5aaf20];return _0x5a8c39;};'use strict';var util=require(_0x01d9('0x0'));var _=require('lodash');var moment=require(_0x01d9('0x1'));function checkNameSurname(_0x4bc896,_0x433fc8,_0x5525be){var _0x1d6da0='';if(!_[_0x01d9('0x2')](_0x433fc8)&&'string'===typeof _0x433fc8){_0x1d6da0+=_0x433fc8;}if(!_[_0x01d9('0x2')](_0x5525be)&&_0x01d9('0x3')===typeof _0x5525be){_0x1d6da0+='\x20'+_0x5525be;}if(_0x1d6da0!==''){return _0x1d6da0;}return _0x4bc896;}function Action(_0xc03631,_0x549267,_0x500fb7){this[_0x01d9('0x4')]=_0xc03631;this[_0x01d9('0x5')]=_0x500fb7||undefined;this['name']=checkNameSurname(_0x549267[_0x01d9('0x6')]['phone'],_0x549267['Contact'][_0x01d9('0x7')],_0x549267[_0x01d9('0x6')][_0x01d9('0x8')]);this['number']=_0x549267[_0x01d9('0x6')][_0x01d9('0x9')];this[_0x01d9('0xa')]=_0xc03631['name'];this[_0x01d9('0xb')]=_0x549267[_0x01d9('0xb')]||![];this[_0x01d9('0xc')]=_0xc03631[_0x01d9('0xc')];this[_0x01d9('0xd')]=_0xc03631[_0x01d9('0xd')]||0x3;this[_0x01d9('0xe')]=_0x549267[_0x01d9('0xe')];this[_0x01d9('0xf')]=_0x549267[_0x01d9('0xf')];this[_0x01d9('0x10')]=_0x549267[_0x01d9('0x10')];this['countnoanswerretry']=_0x549267[_0x01d9('0x11')];this[_0x01d9('0x12')]=_0x549267[_0x01d9('0x12')];this[_0x01d9('0x13')]=_0x549267['countdropretry'];this[_0x01d9('0x14')]=_0x549267[_0x01d9('0x14')];this[_0x01d9('0x15')]=_0x549267[_0x01d9('0x15')];this[_0x01d9('0x16')]=_0x549267['countagentrejectretry'];this[_0x01d9('0x17')]=_0x549267[_0x01d9('0x17')];this['ListId']=_0x549267[_0x01d9('0x18')];this[_0x01d9('0x19')]=_0x549267[_0x01d9('0x19')];this['VoiceQueueId']=_0x549267['VoiceQueueId'];this[_0x01d9('0x1a')]=_0x549267['CampaignId'];this['idHopper']=_0x549267['id'];this[_0x01d9('0x1b')]=_0x549267[_0x01d9('0x6')][_0x01d9('0x7')]||'';this[_0x01d9('0x1c')]=moment()['format'](_0x01d9('0x1d'));this[_0x01d9('0x1e')]=_0x549267['callback'];this[_0x01d9('0x1f')]=_0x549267[_0x01d9('0x1f')];this[_0x01d9('0x20')]=_0x549267['callbackat'];this[_0x01d9('0x21')]=_0x549267[_0x01d9('0x21')];this[_0x01d9('0x22')]='';this[_0x01d9('0x23')]='';}Action['prototype'][_0x01d9('0x24')]=function(){return util['format'](_0x01d9('0x25'),this[_0x01d9('0x26')],this[_0x01d9('0x4')][_0x01d9('0x27')]>0x0?this[_0x01d9('0x28')][_0x01d9('0x29')](this[_0x01d9('0x4')][_0x01d9('0x27')]):this[_0x01d9('0x28')]);};Action[_0x01d9('0x2a')][_0x01d9('0x2b')]=function(){return this[_0x01d9('0xa')];};module['exports']=Action; \ No newline at end of file +var _0x6ea9=['getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6ea9,0x89));var _0x96ea=function(_0x437a38,_0x404043){_0x437a38=_0x437a38-0x0;var _0x192613=_0x6ea9[_0x437a38];return _0x192613;};'use strict';var util=require(_0x96ea('0x0'));var _=require(_0x96ea('0x1'));var moment=require(_0x96ea('0x2'));function checkNameSurname(_0x4567b9,_0x119bb1,_0x4cb27d){var _0x1fb6c1='';if(!_[_0x96ea('0x3')](_0x119bb1)&&_0x96ea('0x4')===typeof _0x119bb1){_0x1fb6c1+=_0x119bb1;}if(!_['isNil'](_0x4cb27d)&&_0x96ea('0x4')===typeof _0x4cb27d){_0x1fb6c1+='\x20'+_0x4cb27d;}if(_0x1fb6c1!==''){return _0x1fb6c1;}return _0x4567b9;}function Action(_0x58e57e,_0x32cf31,_0x54e1b1){this[_0x96ea('0x5')]=_0x58e57e;this['uniqueid']=_0x54e1b1||undefined;this[_0x96ea('0x6')]=checkNameSurname(_0x32cf31[_0x96ea('0x7')][_0x96ea('0x8')],_0x32cf31[_0x96ea('0x7')][_0x96ea('0x9')],_0x32cf31[_0x96ea('0x7')]['lastName']);this[_0x96ea('0xa')]=_0x32cf31[_0x96ea('0x7')][_0x96ea('0x8')];this[_0x96ea('0xb')]=_0x58e57e[_0x96ea('0x6')];this[_0x96ea('0xc')]=_0x32cf31[_0x96ea('0xc')]||![];this[_0x96ea('0xd')]=_0x58e57e[_0x96ea('0xd')];this[_0x96ea('0xe')]=_0x58e57e['dialQueueTimeout']||0x3;this[_0x96ea('0xf')]=_0x32cf31['scheduledat'];this[_0x96ea('0x10')]=_0x32cf31[_0x96ea('0x10')];this['countcongestionretry']=_0x32cf31[_0x96ea('0x11')];this[_0x96ea('0x12')]=_0x32cf31[_0x96ea('0x12')];this[_0x96ea('0x13')]=_0x32cf31[_0x96ea('0x13')];this[_0x96ea('0x14')]=_0x32cf31[_0x96ea('0x14')];this[_0x96ea('0x15')]=_0x32cf31['countabandonedretry'];this[_0x96ea('0x16')]=_0x32cf31['countmachineretry'];this['countagentrejectretry']=_0x32cf31[_0x96ea('0x17')];this[_0x96ea('0x18')]=_0x32cf31['ContactId'];this[_0x96ea('0x19')]=_0x32cf31[_0x96ea('0x19')];this[_0x96ea('0x1a')]=_0x32cf31[_0x96ea('0x1a')];this[_0x96ea('0x1b')]=_0x32cf31[_0x96ea('0x1b')];this[_0x96ea('0x1c')]=_0x32cf31['CampaignId'];this['idHopper']=_0x32cf31['id'];this[_0x96ea('0x1d')]=_0x32cf31[_0x96ea('0x7')][_0x96ea('0x9')]||'';this[_0x96ea('0x1e')]=moment()[_0x96ea('0x1f')](_0x96ea('0x20'));this[_0x96ea('0x21')]=_0x32cf31[_0x96ea('0x21')];this[_0x96ea('0x22')]=_0x32cf31[_0x96ea('0x22')];this[_0x96ea('0x23')]=_0x32cf31['callbackat'];this[_0x96ea('0x24')]=_0x32cf31[_0x96ea('0x24')];this[_0x96ea('0x25')]='';this[_0x96ea('0x26')]='';}Action[_0x96ea('0x27')][_0x96ea('0x28')]=function(){return util['format'](_0x96ea('0x29'),this['name'],this[_0x96ea('0x5')][_0x96ea('0x2a')]>0x0?this['number']['substring'](this[_0x96ea('0x5')][_0x96ea('0x2a')]):this[_0x96ea('0xa')]);};Action[_0x96ea('0x27')][_0x96ea('0x2b')]=function(){return this['queue'];};module[_0x96ea('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index c6e61d8..2b6fa2d 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 _0x92b1=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','milliseconds','diff','seconds','state','statedesc','Answer','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x2e1d9b,_0x1e7cd4){var _0x5dc789=function(_0x3df853){while(--_0x3df853){_0x2e1d9b['push'](_0x2e1d9b['shift']());}};_0x5dc789(++_0x1e7cd4);}(_0x92b1,0x143));var _0x192b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x92b1[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x4858d2,_0x5790fb){var _0x56c27b=moment(_0x4858d2)[_0x192b('0x0')](0x0);var _0x434f4d=moment(_0x5790fb)[_0x192b('0x0')](0x0);return _0x56c27b[_0x192b('0x1')](_0x434f4d,_0x192b('0x2'));}function AgentComplete(_0xd69eb,_0x403829){this[_0x192b('0x3')]=0x4;this[_0x192b('0x4')]=_0x192b('0x5');this['scheduledat']=_0xd69eb['scheduledat'];this['type']=_0xd69eb[_0x192b('0x6')];this[_0x192b('0x7')]=_0xd69eb['type']===_0x192b('0x8')?_0x192b('0x9'):_0xd69eb[_0x192b('0x6')];this[_0x192b('0xa')]=_0xd69eb[_0x192b('0xa')];this['countcongestionretry']=_0xd69eb[_0x192b('0xb')];this[_0x192b('0xc')]=_0xd69eb[_0x192b('0xc')];this[_0x192b('0xd')]=_0xd69eb[_0x192b('0xa')]+_0xd69eb[_0x192b('0xb')]+_0xd69eb['countnoanswerretry']+_0xd69eb[_0x192b('0xe')]+_0xd69eb[_0x192b('0xf')]+_0xd69eb[_0x192b('0x10')]+_0xd69eb[_0x192b('0x11')]+_0xd69eb[_0x192b('0x12')];this[_0x192b('0xe')]=_0xd69eb[_0x192b('0xe')];this[_0x192b('0xf')]=_0xd69eb[_0x192b('0xf')];this[_0x192b('0x10')]=_0xd69eb[_0x192b('0x10')];this[_0x192b('0x11')]=_0xd69eb[_0x192b('0x11')];this[_0x192b('0x12')]=_0xd69eb[_0x192b('0x12')];this['uniqueid']=_0x403829[_0x192b('0x13')];this['calleridname']=_0xd69eb[_0x192b('0x14')];this[_0x192b('0x15')]=_0xd69eb[_0x192b('0x16')];this['starttime']=_0xd69eb['starttime'];this[_0x192b('0x17')]=_0xd69eb[_0x192b('0x17')];this[_0x192b('0x18')]=_0xd69eb[_0x192b('0x18')];this[_0x192b('0x19')]=moment()['format'](_0x192b('0x1a'));this['ringtime']=getSeconds(_0xd69eb[_0x192b('0x17')],_0xd69eb['starttime']);this[_0x192b('0x1b')]=getSeconds(_0xd69eb[_0x192b('0x18')],_0xd69eb[_0x192b('0x17')]);this[_0x192b('0x1c')]=getSeconds(this[_0x192b('0x19')],_0xd69eb[_0x192b('0x18')]);this[_0x192b('0x9')]=_0x403829[_0x192b('0x9')];this[_0x192b('0x1d')]=_0x403829['membername'];this['reason']=_0x403829['reason'];this[_0x192b('0x1e')]=_0xd69eb[_0x192b('0x1e')];this[_0x192b('0x1f')]=_0xd69eb['callbackuniqueid'];this[_0x192b('0x20')]=_0xd69eb['callbackat'];this['recallme']=_0xd69eb[_0x192b('0x21')];this[_0x192b('0x22')]=_0xd69eb['ContactId'];this[_0x192b('0x23')]=_0xd69eb[_0x192b('0x23')];this[_0x192b('0x24')]=_0xd69eb[_0x192b('0x24')];this[_0x192b('0x25')]=_0xd69eb[_0x192b('0x25')];this[_0x192b('0x26')]=_0xd69eb['CampaignId'];this[_0x192b('0x27')]=_0xd69eb[_0x192b('0x27')]||'';this['originatecalleridname']=_0xd69eb[_0x192b('0x28')]||'';}module[_0x192b('0x29')]=AgentComplete; \ No newline at end of file +var _0x3795=['calleridname','name','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid'];(function(_0x35ff94,_0x405cfd){var _0x213bb2=function(_0x1c4839){while(--_0x1c4839){_0x35ff94['push'](_0x35ff94['shift']());}};_0x213bb2(++_0x405cfd);}(_0x3795,0x16d));var _0x5379=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3795[_0x3ab51d];return _0x29a04e;};'use strict';var util=require(_0x5379('0x0'));var _=require(_0x5379('0x1'));var moment=require(_0x5379('0x2'));function getSeconds(_0x15cbac,_0x53fc02){var _0x100eaf=moment(_0x15cbac)['milliseconds'](0x0);var _0x315f23=moment(_0x53fc02)[_0x5379('0x3')](0x0);return _0x100eaf['diff'](_0x315f23,_0x5379('0x4'));}function AgentComplete(_0x23ac8b,_0x301af1){this[_0x5379('0x5')]=0x4;this[_0x5379('0x6')]=_0x5379('0x7');this[_0x5379('0x8')]=_0x23ac8b['scheduledat'];this['type']=_0x23ac8b[_0x5379('0x9')];this[_0x5379('0xa')]=_0x23ac8b[_0x5379('0x9')]===_0x5379('0xb')?_0x5379('0xc'):_0x23ac8b['type'];this[_0x5379('0xd')]=_0x23ac8b[_0x5379('0xd')];this[_0x5379('0xe')]=_0x23ac8b[_0x5379('0xe')];this[_0x5379('0xf')]=_0x23ac8b[_0x5379('0xf')];this['countglobal']=_0x23ac8b[_0x5379('0xd')]+_0x23ac8b[_0x5379('0xe')]+_0x23ac8b['countnoanswerretry']+_0x23ac8b[_0x5379('0x10')]+_0x23ac8b[_0x5379('0x11')]+_0x23ac8b[_0x5379('0x12')]+_0x23ac8b[_0x5379('0x13')]+_0x23ac8b[_0x5379('0x14')];this[_0x5379('0x10')]=_0x23ac8b['countnosuchnumberretry'];this[_0x5379('0x11')]=_0x23ac8b['countdropretry'];this['countabandonedretry']=_0x23ac8b[_0x5379('0x12')];this['countmachineretry']=_0x23ac8b[_0x5379('0x13')];this[_0x5379('0x14')]=_0x23ac8b[_0x5379('0x14')];this[_0x5379('0x15')]=_0x301af1[_0x5379('0x15')];this[_0x5379('0x16')]=_0x23ac8b[_0x5379('0x17')];this['calleridnum']=_0x23ac8b[_0x5379('0x18')];this[_0x5379('0x19')]=_0x23ac8b[_0x5379('0x19')];this[_0x5379('0x1a')]=_0x23ac8b['responsetime'];this[_0x5379('0x1b')]=_0x23ac8b[_0x5379('0x1b')];this['endtime']=moment()[_0x5379('0x1c')](_0x5379('0x1d'));this[_0x5379('0x1e')]=getSeconds(_0x23ac8b[_0x5379('0x1a')],_0x23ac8b[_0x5379('0x19')]);this[_0x5379('0x1f')]=getSeconds(_0x23ac8b[_0x5379('0x1b')],_0x23ac8b[_0x5379('0x1a')]);this['talktime']=getSeconds(this[_0x5379('0x20')],_0x23ac8b[_0x5379('0x1b')]);this[_0x5379('0xc')]=_0x301af1[_0x5379('0xc')];this[_0x5379('0x21')]=_0x301af1[_0x5379('0x21')];this[_0x5379('0x22')]=_0x301af1[_0x5379('0x22')];this[_0x5379('0x23')]=_0x23ac8b[_0x5379('0x23')];this[_0x5379('0x24')]=_0x23ac8b[_0x5379('0x24')];this[_0x5379('0x25')]=_0x23ac8b[_0x5379('0x25')];this[_0x5379('0x26')]=_0x23ac8b[_0x5379('0x26')];this['ContactId']=_0x23ac8b['ContactId'];this['ListId']=_0x23ac8b['ListId'];this[_0x5379('0x27')]=_0x23ac8b[_0x5379('0x27')];this['VoiceQueueId']=_0x23ac8b[_0x5379('0x28')];this[_0x5379('0x29')]=_0x23ac8b[_0x5379('0x29')];this['originatecalleridnum']=_0x23ac8b['originatecalleridnum']||'';this[_0x5379('0x2a')]=_0x23ac8b[_0x5379('0x2a')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 5e3acd8..786bcac 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 _0xf5bc=['originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0xf5bc,0x192));var _0xcf5b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf5bc[_0x167cc1];return _0x10bc4b;};'use strict';var util=require(_0xcf5b('0x0'));var _=require(_0xcf5b('0x1'));var moment=require(_0xcf5b('0x2'));function getSeconds(_0x3445da,_0xadc44f){var _0x3747ea=moment(_0x3445da)[_0xcf5b('0x3')](0x0);var _0x206365=moment(_0xadc44f)[_0xcf5b('0x3')](0x0);return _0x3747ea[_0xcf5b('0x4')](_0x206365,_0xcf5b('0x5'));}function Final(_0x2c3051){this[_0xcf5b('0x6')]=_0x2c3051[_0xcf5b('0x6')];this[_0xcf5b('0x7')]=_0x2c3051['scheduledat'];this[_0xcf5b('0x8')]=_0x2c3051[_0xcf5b('0x8')];this[_0xcf5b('0x9')]=_0x2c3051[_0xcf5b('0x8')]==='outbound'?_0xcf5b('0xa'):_0x2c3051[_0xcf5b('0x8')];this[_0xcf5b('0xb')]=_0x2c3051[_0xcf5b('0xb')];this['countcongestionretry']=_0x2c3051[_0xcf5b('0xc')];this[_0xcf5b('0xd')]=_0x2c3051[_0xcf5b('0xd')];this[_0xcf5b('0xe')]=_0x2c3051['countbusyretry']+_0x2c3051[_0xcf5b('0xc')]+_0x2c3051[_0xcf5b('0xd')]+_0x2c3051[_0xcf5b('0xf')]+_0x2c3051[_0xcf5b('0x10')]+_0x2c3051[_0xcf5b('0x11')]+_0x2c3051['countmachineretry']+_0x2c3051[_0xcf5b('0x12')];this[_0xcf5b('0xf')]=_0x2c3051[_0xcf5b('0xf')];this['countdropretry']=_0x2c3051['countdropretry'];this[_0xcf5b('0x11')]=_0x2c3051['countabandonedretry'];this[_0xcf5b('0x13')]=_0x2c3051[_0xcf5b('0x13')];this[_0xcf5b('0x12')]=_0x2c3051['countagentrejectretry'];this['queue']=_0x2c3051[_0xcf5b('0xa')];this[_0xcf5b('0x14')]=_0x2c3051[_0xcf5b('0x14')];this[_0xcf5b('0x15')]=_0x2c3051['calleridnum'];this[_0xcf5b('0x16')]=_0x2c3051['starttime'];this['responsetime']=_0x2c3051[_0xcf5b('0x17')];this[_0xcf5b('0x18')]=_0x2c3051[_0xcf5b('0x17')];this['ringtime']=_0x2c3051[_0xcf5b('0x19')]||0x0;this[_0xcf5b('0x1a')]=_0x2c3051[_0xcf5b('0x1a')]||0x0;this[_0xcf5b('0x1b')]=_0x2c3051[_0xcf5b('0x1b')]||0x0;this['callback']=_0x2c3051[_0xcf5b('0x1c')];this['callbackuniqueid']=_0x2c3051[_0xcf5b('0x1d')];this['callbackat']=_0x2c3051[_0xcf5b('0x1e')];this[_0xcf5b('0x1f')]=_0x2c3051[_0xcf5b('0x1f')];this[_0xcf5b('0x20')]=_0x2c3051['ContactId'];this[_0xcf5b('0x21')]=_0x2c3051['ListId'];this[_0xcf5b('0x22')]=_0x2c3051[_0xcf5b('0x22')];this[_0xcf5b('0x23')]=_0x2c3051['VoiceQueueId'];this['CampaignId']=_0x2c3051[_0xcf5b('0x24')];this[_0xcf5b('0x25')]=_0x2c3051[_0xcf5b('0x25')]||'';this['originatecalleridname']=_0x2c3051[_0xcf5b('0x26')]||'';}module[_0xcf5b('0x27')]=Final; \ No newline at end of file +var _0x825a=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','campaigntype','outbound','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x29c3af,_0x329283){var _0x2f43a6=function(_0x5ae198){while(--_0x5ae198){_0x29c3af['push'](_0x29c3af['shift']());}};_0x2f43a6(++_0x329283);}(_0x825a,0x180));var _0xa825=function(_0x52c4e9,_0x5412d0){_0x52c4e9=_0x52c4e9-0x0;var _0x252a03=_0x825a[_0x52c4e9];return _0x252a03;};'use strict';var util=require('util');var _=require(_0xa825('0x0'));var moment=require(_0xa825('0x1'));function getSeconds(_0x75367c,_0xe1ca3f){var _0x4988c8=moment(_0x75367c)[_0xa825('0x2')](0x0);var _0x597665=moment(_0xe1ca3f)['milliseconds'](0x0);return _0x4988c8[_0xa825('0x3')](_0x597665,_0xa825('0x4'));}function Final(_0x3f9529){this[_0xa825('0x5')]=_0x3f9529[_0xa825('0x5')];this['scheduledat']=_0x3f9529[_0xa825('0x6')];this['type']=_0x3f9529['type'];this[_0xa825('0x7')]=_0x3f9529['type']===_0xa825('0x8')?_0xa825('0x9'):_0x3f9529[_0xa825('0xa')];this['countbusyretry']=_0x3f9529[_0xa825('0xb')];this[_0xa825('0xc')]=_0x3f9529['countcongestionretry'];this[_0xa825('0xd')]=_0x3f9529[_0xa825('0xd')];this[_0xa825('0xe')]=_0x3f9529['countbusyretry']+_0x3f9529['countcongestionretry']+_0x3f9529['countnoanswerretry']+_0x3f9529[_0xa825('0xf')]+_0x3f9529['countdropretry']+_0x3f9529[_0xa825('0x10')]+_0x3f9529[_0xa825('0x11')]+_0x3f9529['countagentrejectretry'];this[_0xa825('0xf')]=_0x3f9529['countnosuchnumberretry'];this[_0xa825('0x12')]=_0x3f9529[_0xa825('0x12')];this[_0xa825('0x10')]=_0x3f9529[_0xa825('0x10')];this[_0xa825('0x11')]=_0x3f9529[_0xa825('0x11')];this[_0xa825('0x13')]=_0x3f9529[_0xa825('0x13')];this[_0xa825('0x9')]=_0x3f9529[_0xa825('0x9')];this[_0xa825('0x14')]=_0x3f9529[_0xa825('0x14')];this[_0xa825('0x15')]=_0x3f9529[_0xa825('0x15')];this[_0xa825('0x16')]=_0x3f9529[_0xa825('0x16')];this['responsetime']=_0x3f9529[_0xa825('0x17')];this['endtime']=_0x3f9529[_0xa825('0x17')];this[_0xa825('0x18')]=_0x3f9529[_0xa825('0x18')]||0x0;this[_0xa825('0x19')]=_0x3f9529[_0xa825('0x19')]||0x0;this[_0xa825('0x1a')]=_0x3f9529[_0xa825('0x1a')]||0x0;this[_0xa825('0x1b')]=_0x3f9529[_0xa825('0x1b')];this['callbackuniqueid']=_0x3f9529[_0xa825('0x1c')];this[_0xa825('0x1d')]=_0x3f9529[_0xa825('0x1d')];this[_0xa825('0x1e')]=_0x3f9529['recallme'];this[_0xa825('0x1f')]=_0x3f9529['ContactId'];this[_0xa825('0x20')]=_0x3f9529[_0xa825('0x20')];this['UserId']=_0x3f9529[_0xa825('0x21')];this['VoiceQueueId']=_0x3f9529[_0xa825('0x22')];this[_0xa825('0x23')]=_0x3f9529[_0xa825('0x23')];this[_0xa825('0x24')]=_0x3f9529[_0xa825('0x24')]||'';this[_0xa825('0x25')]=_0x3f9529[_0xa825('0x25')]||'';}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 ce12636..67d4588 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 _0xcaa0=['CampaignId','exports','util','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xcaa0,0x162));var _0x0caa=function(_0x17d229,_0x265a8f){_0x17d229=_0x17d229-0x0;var _0x2318da=_0xcaa0[_0x17d229];return _0x2318da;};'use strict';var util=require(_0x0caa('0x0'));var _=require('lodash');var moment=require(_0x0caa('0x1'));function getSeconds(_0x33141e,_0x3919b0){var _0x294223=moment(_0x33141e)[_0x0caa('0x2')](0x0);var _0x5b4e67=moment(_0x3919b0)[_0x0caa('0x2')](0x0);return _0x294223[_0x0caa('0x3')](_0x5b4e67,_0x0caa('0x4'));}function Hangup(_0xc40499,_0x3f1c18){this[_0x0caa('0x5')]=0x4;this[_0x0caa('0x6')]='Answer';this[_0x0caa('0x7')]=_0xc40499['scheduledat'];this[_0x0caa('0x8')]=_0xc40499[_0x0caa('0x8')];this[_0x0caa('0x9')]=_0xc40499[_0x0caa('0x8')]===_0x0caa('0xa')?_0x0caa('0xb'):_0xc40499['type'];this[_0x0caa('0xc')]=_0xc40499[_0x0caa('0xc')];this['countcongestionretry']=_0xc40499[_0x0caa('0xd')];this['countnoanswerretry']=_0xc40499['countnoanswerretry'];this['countglobal']=_0xc40499['countbusyretry']+_0xc40499[_0x0caa('0xd')]+_0xc40499[_0x0caa('0xe')]+_0xc40499[_0x0caa('0xf')]+_0xc40499['countdropretry']+_0xc40499['countabandonedretry']+_0xc40499['countmachineretry']+_0xc40499[_0x0caa('0x10')];this[_0x0caa('0xf')]=_0xc40499['countnosuchnumberretry'];this[_0x0caa('0x11')]=_0xc40499[_0x0caa('0x11')];this['countabandonedretry']=_0xc40499[_0x0caa('0x12')];this[_0x0caa('0x13')]=_0xc40499[_0x0caa('0x13')];this[_0x0caa('0x10')]=_0xc40499['countagentrejectretry'];this[_0x0caa('0x14')]=_0x3f1c18[_0x0caa('0x14')];this[_0x0caa('0x15')]=_0xc40499[_0x0caa('0x16')];this[_0x0caa('0x17')]=_0xc40499[_0x0caa('0x18')];this[_0x0caa('0x19')]=_0xc40499[_0x0caa('0x19')];this[_0x0caa('0x1a')]=_0xc40499[_0x0caa('0x1a')];this[_0x0caa('0x1b')]=moment()[_0x0caa('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0caa('0x1d')]=getSeconds(_0xc40499['responsetime'],_0xc40499[_0x0caa('0x19')]);this[_0x0caa('0x1e')]=0x0;this[_0x0caa('0x1f')]=getSeconds(this['endtime'],_0xc40499['responsetime']);this[_0x0caa('0xb')]=_0xc40499[_0x0caa('0xb')];this[_0x0caa('0x20')]='IVR';this[_0x0caa('0x21')]=_0x3f1c18['cause-txt'];this[_0x0caa('0x22')]=_0xc40499[_0x0caa('0x22')];this[_0x0caa('0x23')]=_0xc40499[_0x0caa('0x23')];this['callbackat']=_0xc40499[_0x0caa('0x24')];this['recallme']=_0xc40499[_0x0caa('0x25')];this[_0x0caa('0x26')]=_0xc40499['ContactId'];this[_0x0caa('0x27')]=_0xc40499[_0x0caa('0x27')];this[_0x0caa('0x28')]=_0xc40499[_0x0caa('0x28')];this['VoiceQueueId']=_0xc40499[_0x0caa('0x29')];this[_0x0caa('0x2a')]=_0xc40499['CampaignId'];}module[_0x0caa('0x2b')]=Hangup; \ No newline at end of file +var _0x6b36=['calleridnum','starttime','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','talktime','endtime','queue','membername','IVR','reason','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name'];(function(_0x4929fb,_0x18c941){var _0x2ca68f=function(_0x2a8189){while(--_0x2a8189){_0x4929fb['push'](_0x4929fb['shift']());}};_0x2ca68f(++_0x18c941);}(_0x6b36,0x142));var _0x66b3=function(_0x3d6ed1,_0x5b314e){_0x3d6ed1=_0x3d6ed1-0x0;var _0x5e499a=_0x6b36[_0x3d6ed1];return _0x5e499a;};'use strict';var util=require(_0x66b3('0x0'));var _=require(_0x66b3('0x1'));var moment=require(_0x66b3('0x2'));function getSeconds(_0x46838d,_0x18cb2c){var _0x1f4f6a=moment(_0x46838d)[_0x66b3('0x3')](0x0);var _0x2c0bf2=moment(_0x18cb2c)[_0x66b3('0x3')](0x0);return _0x1f4f6a[_0x66b3('0x4')](_0x2c0bf2,'seconds');}function Hangup(_0xb1b1f9,_0x2f45f7){this['state']=0x4;this[_0x66b3('0x5')]=_0x66b3('0x6');this['scheduledat']=_0xb1b1f9[_0x66b3('0x7')];this[_0x66b3('0x8')]=_0xb1b1f9[_0x66b3('0x8')];this[_0x66b3('0x9')]=_0xb1b1f9['type']===_0x66b3('0xa')?'queue':_0xb1b1f9[_0x66b3('0x8')];this[_0x66b3('0xb')]=_0xb1b1f9[_0x66b3('0xb')];this[_0x66b3('0xc')]=_0xb1b1f9[_0x66b3('0xc')];this[_0x66b3('0xd')]=_0xb1b1f9['countnoanswerretry'];this[_0x66b3('0xe')]=_0xb1b1f9[_0x66b3('0xb')]+_0xb1b1f9[_0x66b3('0xc')]+_0xb1b1f9['countnoanswerretry']+_0xb1b1f9['countnosuchnumberretry']+_0xb1b1f9[_0x66b3('0xf')]+_0xb1b1f9[_0x66b3('0x10')]+_0xb1b1f9[_0x66b3('0x11')]+_0xb1b1f9[_0x66b3('0x12')];this[_0x66b3('0x13')]=_0xb1b1f9[_0x66b3('0x13')];this[_0x66b3('0xf')]=_0xb1b1f9[_0x66b3('0xf')];this[_0x66b3('0x10')]=_0xb1b1f9[_0x66b3('0x10')];this[_0x66b3('0x11')]=_0xb1b1f9['countmachineretry'];this[_0x66b3('0x12')]=_0xb1b1f9[_0x66b3('0x12')];this[_0x66b3('0x14')]=_0x2f45f7[_0x66b3('0x14')];this['calleridname']=_0xb1b1f9[_0x66b3('0x15')];this[_0x66b3('0x16')]=_0xb1b1f9['number'];this[_0x66b3('0x17')]=_0xb1b1f9[_0x66b3('0x17')];this['responsetime']=_0xb1b1f9['responsetime'];this['endtime']=moment()['format'](_0x66b3('0x18'));this[_0x66b3('0x19')]=getSeconds(_0xb1b1f9[_0x66b3('0x1a')],_0xb1b1f9[_0x66b3('0x17')]);this[_0x66b3('0x1b')]=0x0;this[_0x66b3('0x1c')]=getSeconds(this[_0x66b3('0x1d')],_0xb1b1f9[_0x66b3('0x1a')]);this[_0x66b3('0x1e')]=_0xb1b1f9[_0x66b3('0x1e')];this[_0x66b3('0x1f')]=_0x66b3('0x20');this[_0x66b3('0x21')]=_0x2f45f7[_0x66b3('0x22')];this[_0x66b3('0x23')]=_0xb1b1f9[_0x66b3('0x23')];this['callbackuniqueid']=_0xb1b1f9['callbackuniqueid'];this[_0x66b3('0x24')]=_0xb1b1f9[_0x66b3('0x24')];this[_0x66b3('0x25')]=_0xb1b1f9[_0x66b3('0x25')];this[_0x66b3('0x26')]=_0xb1b1f9[_0x66b3('0x26')];this[_0x66b3('0x27')]=_0xb1b1f9[_0x66b3('0x27')];this['UserId']=_0xb1b1f9[_0x66b3('0x28')];this[_0x66b3('0x29')]=_0xb1b1f9['VoiceQueueId'];this['CampaignId']=_0xb1b1f9[_0x66b3('0x2a')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index f53dd6b..337f9c2 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 _0xd280=['CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x2d80a8,_0x572ef2){var _0x39087b=function(_0x1c3796){while(--_0x1c3796){_0x2d80a8['push'](_0x2d80a8['shift']());}};_0x39087b(++_0x572ef2);}(_0xd280,0xc6));var _0x0d28=function(_0x444f9e,_0x2beaab){_0x444f9e=_0x444f9e-0x0;var _0x3733b3=_0xd280[_0x444f9e];return _0x3733b3;};'use strict';var util=require(_0x0d28('0x0'));var _=require(_0x0d28('0x1'));var moment=require('moment');function getSeconds(_0x1a2155,_0x5778d5){var _0x40462b=moment(_0x1a2155)['milliseconds'](0x0);var _0xe17918=moment(_0x5778d5)[_0x0d28('0x2')](0x0);return _0x40462b[_0x0d28('0x3')](_0xe17918,_0x0d28('0x4'));}function History(_0x526bd0){this[_0x0d28('0x5')]=_0x526bd0[_0x0d28('0x5')];this[_0x0d28('0x6')]=_0x526bd0[_0x0d28('0x6')]||undefined;this['type']=_0x526bd0[_0x0d28('0x7')];this[_0x0d28('0x8')]=_0x526bd0[_0x0d28('0x7')]===_0x0d28('0x9')?_0x0d28('0xa'):_0x526bd0[_0x0d28('0x7')];this['countbusyretry']=_0x526bd0[_0x0d28('0xb')];this[_0x0d28('0xc')]=_0x526bd0[_0x0d28('0xc')];this[_0x0d28('0xd')]=_0x526bd0[_0x0d28('0xd')];this[_0x0d28('0xe')]=_0x526bd0[_0x0d28('0xb')]+_0x526bd0[_0x0d28('0xc')]+_0x526bd0['countnoanswerretry']+_0x526bd0[_0x0d28('0xf')]+_0x526bd0[_0x0d28('0x10')]+_0x526bd0[_0x0d28('0x11')]+_0x526bd0[_0x0d28('0x12')]+_0x526bd0[_0x0d28('0x13')];this[_0x0d28('0xf')]=_0x526bd0['countnosuchnumberretry'];this['countdropretry']=_0x526bd0[_0x0d28('0x10')];this[_0x0d28('0x11')]=_0x526bd0['countabandonedretry'];this[_0x0d28('0x12')]=_0x526bd0['countmachineretry'];this[_0x0d28('0x13')]=_0x526bd0[_0x0d28('0x13')];this[_0x0d28('0xa')]=_0x526bd0['queue'];this[_0x0d28('0x14')]=_0x526bd0['name'];this[_0x0d28('0x15')]=_0x526bd0[_0x0d28('0x16')];this[_0x0d28('0x17')]=_0x526bd0[_0x0d28('0x17')];this[_0x0d28('0x18')]=_0x526bd0[_0x0d28('0x18')];this[_0x0d28('0x19')]=_0x526bd0[_0x0d28('0x18')];this[_0x0d28('0x1a')]=getSeconds(_0x526bd0['responsetime'],_0x526bd0[_0x0d28('0x17')]);this[_0x0d28('0x1b')]=0x0;this[_0x0d28('0x1c')]=0x0;this[_0x0d28('0x1d')]=_0x526bd0[_0x0d28('0x1d')];this[_0x0d28('0x1e')]=_0x526bd0['callbackuniqueid'];this[_0x0d28('0x1f')]=_0x526bd0['callbackat'];this[_0x0d28('0x20')]=_0x526bd0[_0x0d28('0x20')];this[_0x0d28('0x21')]=_0x526bd0[_0x0d28('0x21')];this[_0x0d28('0x22')]=_0x526bd0['ListId'];this[_0x0d28('0x23')]=_0x526bd0[_0x0d28('0x23')];this['VoiceQueueId']=_0x526bd0['VoiceQueueId'];this[_0x0d28('0x24')]=_0x526bd0['CampaignId'];this[_0x0d28('0x25')]=_0x526bd0[_0x0d28('0x25')]||'';this[_0x0d28('0x26')]=_0x526bd0[_0x0d28('0x26')]||'';}module['exports']=History; \ No newline at end of file +var _0x4597=['originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','number','responsetime','endtime','ringtime','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','VoiceQueueId','CampaignId'];(function(_0x1110db,_0xc82f49){var _0x5c9357=function(_0x137660){while(--_0x137660){_0x1110db['push'](_0x1110db['shift']());}};_0x5c9357(++_0xc82f49);}(_0x4597,0x1e3));var _0x7459=function(_0x27ee1c,_0x5d93b7){_0x27ee1c=_0x27ee1c-0x0;var _0x226db3=_0x4597[_0x27ee1c];return _0x226db3;};'use strict';var util=require(_0x7459('0x0'));var _=require(_0x7459('0x1'));var moment=require(_0x7459('0x2'));function getSeconds(_0x2f1d28,_0x473716){var _0x1e4801=moment(_0x2f1d28)['milliseconds'](0x0);var _0x41004c=moment(_0x473716)[_0x7459('0x3')](0x0);return _0x1e4801[_0x7459('0x4')](_0x41004c,_0x7459('0x5'));}function History(_0x23000b){this[_0x7459('0x6')]=_0x23000b[_0x7459('0x6')];this[_0x7459('0x7')]=_0x23000b['scheduledat']||undefined;this[_0x7459('0x8')]=_0x23000b[_0x7459('0x8')];this['campaigntype']=_0x23000b[_0x7459('0x8')]===_0x7459('0x9')?_0x7459('0xa'):_0x23000b['type'];this[_0x7459('0xb')]=_0x23000b['countbusyretry'];this[_0x7459('0xc')]=_0x23000b['countcongestionretry'];this[_0x7459('0xd')]=_0x23000b[_0x7459('0xd')];this[_0x7459('0xe')]=_0x23000b[_0x7459('0xb')]+_0x23000b[_0x7459('0xc')]+_0x23000b[_0x7459('0xd')]+_0x23000b[_0x7459('0xf')]+_0x23000b[_0x7459('0x10')]+_0x23000b[_0x7459('0x11')]+_0x23000b['countmachineretry']+_0x23000b['countagentrejectretry'];this[_0x7459('0xf')]=_0x23000b['countnosuchnumberretry'];this[_0x7459('0x10')]=_0x23000b['countdropretry'];this['countabandonedretry']=_0x23000b[_0x7459('0x11')];this[_0x7459('0x12')]=_0x23000b[_0x7459('0x12')];this[_0x7459('0x13')]=_0x23000b['countagentrejectretry'];this[_0x7459('0xa')]=_0x23000b[_0x7459('0xa')];this[_0x7459('0x14')]=_0x23000b['name'];this['calleridnum']=_0x23000b[_0x7459('0x15')];this['starttime']=_0x23000b['starttime'];this[_0x7459('0x16')]=_0x23000b[_0x7459('0x16')];this[_0x7459('0x17')]=_0x23000b[_0x7459('0x16')];this[_0x7459('0x18')]=getSeconds(_0x23000b['responsetime'],_0x23000b[_0x7459('0x19')]);this[_0x7459('0x1a')]=0x0;this[_0x7459('0x1b')]=0x0;this[_0x7459('0x1c')]=_0x23000b['callback'];this[_0x7459('0x1d')]=_0x23000b['callbackuniqueid'];this[_0x7459('0x1e')]=_0x23000b[_0x7459('0x1e')];this[_0x7459('0x1f')]=_0x23000b[_0x7459('0x1f')];this['ContactId']=_0x23000b['ContactId'];this['ListId']=_0x23000b[_0x7459('0x20')];this['UserId']=_0x23000b['UserId'];this[_0x7459('0x21')]=_0x23000b[_0x7459('0x21')];this[_0x7459('0x22')]=_0x23000b[_0x7459('0x22')];this[_0x7459('0x23')]=_0x23000b['originatecalleridnum']||'';this[_0x7459('0x24')]=_0x23000b[_0x7459('0x24')]||'';}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 cbf6de2..489de7e 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 _0xcea7=['entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','countglobal','[syncAgentComplete][createHistory][0]','stateGlobal','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','outboundRejectCallsDay','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[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]','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]','m\x20=\x20','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','md5','ioredis','../../../config/environment/','../../../config/logger','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','hangup','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','Error','stringify','milliseconds','seconds','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startProgressive','Trunk','active','callerid','Interval','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','diff','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','hasOwnProperty','originated','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','clearZombieChannels','[uniqueid]','[actions]','sequence','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','isSuccess','isTrunkReachable','SIP/%s','reachable','uniqueId','uniqueid','variable','amdstatus','exten','dialAMDActive','value','HangupInAMD','membername','[syncHangupInAMD]','MACHINE','amd','[syncMachine][createHistory]','[syncMachine]','HANGUP','AMD','[syncHangupInAMDIvr]','Machine','[syncMachineIvr][createHistory]','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','AnswerAGI','createHistory','[syncHangupIvr]','dialQueueProject','cause-txt','Unknow','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','YYYY-MM-DD\x20HH:mm:ss','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','countdropretry','dialDropMaxRetry','add','dialDropRetryFrequency','minutes','VoiceQueueId','[rescheduleContact][Drop]','[originateError]:\x20%s','starttime','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','finally','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','interval','content','iftime\x20%s,%s','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','outbound','dialQueueOptions','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','countcongestionretry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialMachineMaxRetry','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','object','[callProgressDetecting]'];(function(_0x13ff03,_0x5710b1){var _0x204fca=function(_0x3580d6){while(--_0x3580d6){_0x13ff03['push'](_0x13ff03['shift']());}};_0x204fca(++_0x5710b1);}(_0xcea7,0x78));var _0x7cea=function(_0x180f23,_0x1302e3){_0x180f23=_0x180f23-0x0;var _0x31fbfb=_0xcea7[_0x180f23];return _0x31fbfb;};'use strict';var util=require(_0x7cea('0x0'));var _=require(_0x7cea('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0x7cea('0x2'));var Redis=require(_0x7cea('0x3'));var config=require(_0x7cea('0x4'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0x7cea('0x5'))(_0x7cea('0x6'));var loggerPredictive=require(_0x7cea('0x5'))('predictive');var loggerPredictiveCalls=require(_0x7cea('0x5'))(_0x7cea('0x7'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x7cea('0x8'));var ami=require(_0x7cea('0x9'));config[_0x7cea('0xa')]=_[_0x7cea('0xb')](config['redis'],{'host':_0x7cea('0xc'),'port':0x18eb});var io=require(_0x7cea('0xd'))(new Redis(config[_0x7cea('0xa')]));var cmHopper=require(_0x7cea('0xe'));var cmHopperFinal=require(_0x7cea('0xf'));var cmHopperHistory=require(_0x7cea('0x10'));var cmHopperBlack=require(_0x7cea('0x11'));var voiceQueueRt=require(_0x7cea('0x12'));var Action=require(_0x7cea('0x13'));var History=require(_0x7cea('0x14'));var Final=require(_0x7cea('0x15'));var AgentComplete=require(_0x7cea('0x16'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x7cea('0x17'));var ipAgi=process[_0x7cea('0x18')][_0x7cea('0x19')]||_0x7cea('0x1a');var strategy={'rrmemory':_0x7cea('0x1b'),'roundrobin':_0x7cea('0x1c')};var Sequence=function(){};Sequence[_0x7cea('0x1d')][_0x7cea('0x1e')]=function(_0x3d7590){this[_0x7cea('0x1f')]=this[_0x7cea('0x1f')]?this[_0x7cea('0x1f')]['finally'](_0x3d7590):_0x3d7590();};function Dialer(_0xc9c2fc,_0x3d35e2){this['sequence']=new Sequence();this[_0x7cea('0x20')]=_0x3d35e2;this['voiceQueues']=_0xc9c2fc[_0x7cea('0x21')];this[_0x7cea('0x22')]=_0xc9c2fc[_0x7cea('0x22')];this[_0x7cea('0x23')]=_0xc9c2fc[_0x7cea('0x23')];this[_0x7cea('0x24')]=_0xc9c2fc[_0x7cea('0x24')];this[_0x7cea('0x25')]=config[_0x7cea('0x25')]||0x2;this[_0x7cea('0x26')]={};this[_0x7cea('0x27')]={};this[_0x7cea('0x28')]={};this['uniqueId']={};this[_0x7cea('0x29')]={};this[_0x7cea('0x2a')]={};this['startProgressive']={};this[_0x7cea('0x2b')]={};this[_0x7cea('0x2c')]={};this[_0x7cea('0x2d')]={};ami['on'](_0x7cea('0x2e'),this[_0x7cea('0x2f')][_0x7cea('0x30')](this));ami['on'](_0x7cea('0x31'),this['syncQueueCallerAbandon'][_0x7cea('0x30')](this));ami['on'](_0x7cea('0x32'),this[_0x7cea('0x33')][_0x7cea('0x30')](this));ami['on'](_0x7cea('0x34'),this['syncAgentComplete']['bind'](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x7cea('0x30')](this));ami['on'](_0x7cea('0x35'),this['syncHangup']['bind'](this));ami['on']('newexten',this[_0x7cea('0x36')][_0x7cea('0x30')](this));ami['on'](_0x7cea('0x37'),this[_0x7cea('0x38')][_0x7cea('0x30')](this));ami['on']('queuemember',this[_0x7cea('0x39')]['bind'](this));ami['on'](_0x7cea('0x3a'),this[_0x7cea('0x3b')]['bind'](this));this[_0x7cea('0x3c')]();this['loopClearZombieChannels']();}function isNotNull(_0x2bd1eb){return _0x2bd1eb!==null&&!_[_0x7cea('0x3d')](_0x2bd1eb);}function checkIsLoggedIn(_0x50cec9,_0x2ac818){return function(){if(_0x2ac818<=0x0){_0x50cec9[_0x7cea('0x3e')]=_0x7cea('0x3f');throw _0x50cec9[_0x7cea('0x40')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x4e8d80){return _0x4e8d80;}function checkIsActive(_0x2788fb,_0x1f0108){return function(){if(!isActive(_0x1f0108)){_0x2788fb['message']='NOT_ACTIVE';throw _0x2788fb[_0x7cea('0x40')]+_0x7cea('0x41');}};}function checkInterval(_0xb9364b){return function(){if(!isNotNull(_0xb9364b['Interval'])){_0xb9364b[_0x7cea('0x3e')]=_0x7cea('0x42');throw _0xb9364b[_0x7cea('0x40')]+_0x7cea('0x43');}if(!isNotNull(_0xb9364b['Interval']['Intervals'])){_0xb9364b[_0x7cea('0x3e')]='INTERVAL_IS_NULL';throw _0xb9364b[_0x7cea('0x40')]+_0x7cea('0x43');}if(!isNotNull(_[_0x7cea('0x44')](_0xb9364b['Interval'][_0x7cea('0x45')]))){_0xb9364b[_0x7cea('0x3e')]=_0x7cea('0x42');throw _0xb9364b[_0x7cea('0x40')]+_0x7cea('0x43');}};}function msgResponse(_0x3ca269,_0x367cdf,_0x2018d8){return{'action':_0x3ca269,'response':_0x367cdf,'message':_0x2018d8,'stack':_0x2018d8};}function myreject(_0x3b4826){return function(_0x59deda){return _0x3b4826(msgResponse('[ifTime][Action]',_0x7cea('0x46'),JSON[_0x7cea('0x47')](_0x59deda)));};}function getSeconds(_0x2565ec,_0x2aee70){var _0x57a463=moment(_0x2565ec)[_0x7cea('0x48')](0x0);var _0x17758d=moment(_0x2aee70)[_0x7cea('0x48')](0x0);return _0x57a463['diff'](_0x17758d,_0x7cea('0x49'));}function emit(_0x1911f5,_0x47a45d,_0x3fe371){io['to'](_0x1911f5)['emit'](_0x47a45d,_0x3fe371);}function emitVoiceQueueSummary(_0x2094d1){if(_0x2094d1['type']==='outbound'){var _0x19be34={'id':_0x2094d1['id'],'name':_0x2094d1[_0x7cea('0x40')],'strategy':_0x2094d1[_0x7cea('0x4a')],'answered':_0x2094d1[_0x7cea('0x4b')],'available':_0x2094d1[_0x7cea('0x4c')],'loggedIn':_0x2094d1[_0x7cea('0x4d')],'pTalking':_0x2094d1['pTalking'],'sumBillable':_0x2094d1[_0x7cea('0x4e')],'sumDuration':_0x2094d1[_0x7cea('0x4f')],'sumHoldTime':_0x2094d1[_0x7cea('0x50')]||0x0,'talking':_0x2094d1[_0x7cea('0x51')],'total':_0x2094d1['total'],'type':_0x2094d1[_0x7cea('0x52')],'unmanaged':_0x2094d1[_0x7cea('0x53')],'abandoned':_0x2094d1['abandoned'],'waiting':_0x2094d1[_0x7cea('0x54')],'loggedInDb':_0x2094d1[_0x7cea('0x55')],'dialActive':_0x2094d1[_0x7cea('0x56')],'dialMethod':_0x2094d1[_0x7cea('0x57')],'dialOriginateCallerIdName':_0x2094d1[_0x7cea('0x58')],'dialOriginateCallerIdNumber':_0x2094d1[_0x7cea('0x59')],'dialOriginateTimeout':_0x2094d1[_0x7cea('0x5a')],'dialPrefix':_0x2094d1['dialPrefix'],'outboundAnswerAgiCallsDay':_0x2094d1[_0x7cea('0x5b')],'outboundAnswerCallsDay':_0x2094d1[_0x7cea('0x5c')],'outboundBlacklistCallsDay':_0x2094d1['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x2094d1[_0x7cea('0x5d')],'outboundCongestionCallsDay':_0x2094d1['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x2094d1[_0x7cea('0x5e')],'outboundDropCallsDayCallersExit':_0x2094d1['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x2094d1['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x2094d1[_0x7cea('0x5f')],'outboundNoSuchCallsDay':_0x2094d1[_0x7cea('0x60')],'outboundOriginateFailureCallsDay':_0x2094d1[_0x7cea('0x61')],'outboundReCallsDay':_0x2094d1['outboundReCallsDay'],'outboundRejectCallsDay':_0x2094d1['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2094d1[_0x7cea('0x62')],'predictiveIntervalAnsweredCalls':_0x2094d1[_0x7cea('0x63')],'predictiveIntervalAvgHoldtime':_0x2094d1[_0x7cea('0x64')],'predictiveIntervalAvgTalktime':_0x2094d1[_0x7cea('0x65')],'predictiveIntervalDroppedCallsCallersExit':_0x2094d1[_0x7cea('0x66')],'predictiveIntervalDroppedCallsTimeout':_0x2094d1[_0x7cea('0x67')],'predictiveIntervalErlangCalls':_0x2094d1['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x2094d1[_0x7cea('0x68')],'predictiveIntervalHitRate':_0x2094d1[_0x7cea('0x69')],'predictiveIntervalMultiplicativeFactor':_0x2094d1['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x2094d1[_0x7cea('0x6a')],'predictiveIntervalAvailable':_0x2094d1[_0x7cea('0x6b')],'predictiveIntervalTotalCalls':_0x2094d1['predictiveIntervalTotalCalls'],'message':_0x2094d1[_0x7cea('0x3e')],'originated':_0x2094d1['originated'],'erlangCalls':_0x2094d1[_0x7cea('0x6c')],'erlangCallToSecond':_0x2094d1[_0x7cea('0x6d')],'erlangAbandonmentRate':_0x2094d1[_0x7cea('0x6e')],'erlangBusyFactor':_0x2094d1['erlangBusyFactor'],'startPredictive':_0x2094d1[_0x7cea('0x2a')],'startProgressive':_0x2094d1[_0x7cea('0x6f')]};if(_0x2094d1[_0x7cea('0x70')]){_0x19be34[_0x7cea('0x70')]={'id':_0x2094d1['Trunk']['id'],'name':_0x2094d1['Trunk']['name'],'active':_0x2094d1[_0x7cea('0x70')][_0x7cea('0x71')],'callerid':_0x2094d1[_0x7cea('0x70')][_0x7cea('0x72')]};}if(_0x2094d1[_0x7cea('0x73')]){_0x19be34[_0x7cea('0x73')]={'id':_0x2094d1[_0x7cea('0x73')]['id'],'name':_0x2094d1[_0x7cea('0x73')]['name']};}var _0x464476=md5(JSON[_0x7cea('0x47')](_0x19be34));if(_0x2094d1['md5']!==_0x464476){_0x2094d1[_0x7cea('0x2')]=_0x464476;emit(util['format'](_0x7cea('0x74'),_0x19be34[_0x7cea('0x40')]),_0x7cea('0x75'),_0x19be34);}}}function emitCampaignSummary(_0x3dc408){if(_0x3dc408['type']==='ivr'){emit(util['format'](_0x7cea('0x76'),_0x3dc408[_0x7cea('0x40')]),_0x7cea('0x77'),_0x3dc408);}}function checkGetDataPredictive(_0x1ab515){if(isNotNull(_0x1ab515)){if(!_[_0x7cea('0x44')](_0x1ab515)){loggerPredictive[_0x7cea('0x78')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x7cea('0x78')](_0x7cea('0x79'),_0x1ab515[_0x7cea('0x7a')]);loggerPredictive[_0x7cea('0x78')](_0x7cea('0x7b'),_0x1ab515[_0x7cea('0x63')]);loggerPredictive[_0x7cea('0x78')](_0x7cea('0x7c'),_0x1ab515[_0x7cea('0x67')]);loggerPredictive[_0x7cea('0x78')](_0x7cea('0x7d'),_0x1ab515['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x7cea('0x78')](_0x7cea('0x7e'),_0x1ab515[_0x7cea('0x64')]);loggerPredictive[_0x7cea('0x78')](_0x7cea('0x7f'),_0x1ab515[_0x7cea('0x65')]);loggerPredictive[_0x7cea('0x78')](_0x7cea('0x80'));if(_0x1ab515[_0x7cea('0x7a')]>0x0){if(!_[_0x7cea('0x3d')](_0x1ab515[_0x7cea('0x65')])&&_0x1ab515[_0x7cea('0x65')]>0x0){return!![];}else{loggerPredictive[_0x7cea('0x78')](_0x7cea('0x81'));}if(!_['isUndefined'](_0x1ab515[_0x7cea('0x64')])&&_0x1ab515[_0x7cea('0x64')]>0x0){return!![];}else{loggerPredictive[_0x7cea('0x78')](_0x7cea('0x82'));}}else{loggerPredictive[_0x7cea('0x78')](_0x7cea('0x83'));}}else{loggerPredictive[_0x7cea('0x78')]('History\x20information\x20are\x20empty');}}else{loggerPredictive[_0x7cea('0x78')](_0x7cea('0x84'));}return![];}function mergeDataErlangB(_0x1f1eb1){return function(_0x28c14d){loggerPredictive[_0x7cea('0x78')](_0x7cea('0x85'));loggerPredictive[_0x7cea('0x78')](_0x7cea('0x86'),_0x28c14d[_0x7cea('0x6c')]);loggerPredictive[_0x7cea('0x78')](_0x7cea('0x87'),_0x28c14d['erlangCallToSecond']);loggerPredictive[_0x7cea('0x78')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28c14d[_0x7cea('0x6e')]);loggerPredictive[_0x7cea('0x78')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28c14d[_0x7cea('0x88')]);loggerPredictive[_0x7cea('0x78')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28c14d['erlangAbandonmentRate']);loggerPredictive[_0x7cea('0x78')](_0x7cea('0x80'));_[_0x7cea('0x89')](_0x1f1eb1,_0x28c14d);};}function getDiff(_0x22e98a){var _0x2ffbb6=moment()[_0x7cea('0x48')](0x0);var _0x404915=moment(_0x22e98a)['milliseconds'](0x0);return _0x2ffbb6[_0x7cea('0x8a')](_0x404915,_0x7cea('0x49'));}function ifInterval(_0x37dc0e,_0x174a11){if(_[_0x7cea('0x3d')](_0x174a11)){return![];}if(getDiff(_0x174a11)<_0x37dc0e*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x4caf95){if(isNotNull(_0x4caf95)){if(!_[_0x7cea('0x3d')](_0x4caf95[_0x7cea('0x6f')])){_0x4caf95[_0x7cea('0x6f')]=undefined;loggerPredictive[_0x7cea('0x78')](_0x4caf95[_0x7cea('0x40')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x7cea('0x3d')](_0x4caf95[_0x7cea('0x2a')])){_0x4caf95[_0x7cea('0x2a')]=undefined;loggerPredictive[_0x7cea('0x78')](_0x4caf95['name'],_0x7cea('0x8b'));}if(!_[_0x7cea('0x3d')](_0x4caf95[_0x7cea('0x8c')])){clearInterval(_0x4caf95[_0x7cea('0x8c')]);_0x4caf95[_0x7cea('0x8c')]=undefined;loggerPredictive[_0x7cea('0x78')](_0x4caf95[_0x7cea('0x40')],_0x7cea('0x8d'));}}}function erlangb(_0x739f83,_0x1a99fb){if(_0x1a99fb===0x0){return 0x0;}var _0x1a2afb=0x1;for(var _0x25a789=0x1;_0x25a789<=_0x1a99fb;_0x25a789+=0x1){_0x1a2afb=0x1+_0x1a2afb*_0x25a789/_0x739f83;}return 0x1/_0x1a2afb;}function isVoiceQueueOutbound(_0x176d31){return _0x176d31==='outbound';}function isNotPreview(_0x5dc76f){return _0x5dc76f!=='preview';}function isCampaignIvr(_0xdbdf90){return _0xdbdf90===_0x7cea('0x8e');}function getCallerId(_0x4b5078,_0x2cce74,_0xdf4941){if(!_[_0x7cea('0x3d')](_0xdf4941)&&_0x7cea('0x8f')===typeof _0xdf4941&&!_[_0x7cea('0x44')](_0xdf4941)){if(!_['isUndefined'](_0x2cce74)&&'string'===typeof _0x2cce74&&!_[_0x7cea('0x44')](_0x2cce74)){return util[_0x7cea('0x90')](_0x7cea('0x91'),_0x2cce74,_0xdf4941);}return util[_0x7cea('0x90')](_0x7cea('0x91'),_0xdf4941,_0xdf4941);}if(!_[_0x7cea('0x3d')](_0x4b5078)&&_0x7cea('0x8f')===typeof _0x4b5078&&!_[_0x7cea('0x44')](_0x4b5078)){return _0x4b5078;}return _0x7cea('0x92');}function loggerCatchQueueSummary(_0x5c6253,_0x337e13){return function(_0x518d9d){freeVariablesPredictive(_0x337e13);emitVoiceQueueSummary(_0x337e13);emitCampaignSummary(_0x337e13);loggerSyncQueueSummary[_0x7cea('0x93')](_0x5c6253,util['inspect'](_0x518d9d,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x399175,_0x565ea4){return function(_0x4deb58){loggerPredictive['error'](_0x565ea4['name'],_0x399175);loggerPredictive[_0x7cea('0x93')](_0x4deb58[_0x7cea('0x94')]);freeVariablesPredictive(_0x565ea4);};}function loggerCatch(_0x2cc7fb){return function(_0x17897e){logger['error'](_0x2cc7fb,util[_0x7cea('0x95')](_0x17897e,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x115860){return _0x115860&&!_[_0x7cea('0x3d')](_0x115860)&&_0x115860[_0x7cea('0x96')]>0x0;}function decremetOriginate(_0x58a2a5){if(!_[_0x7cea('0x3d')](_0x58a2a5)&&_0x58a2a5!==null){if(_0x58a2a5[_0x7cea('0x97')](_0x7cea('0x98'))){if(_0x58a2a5[_0x7cea('0x98')]>0x0){_0x58a2a5[_0x7cea('0x98')]-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x7cea('0x93')](_0x7cea('0x99'));}}function checkContactLowerLimitOriginate(_0x2713c6,_0x2b9437,_0x22c07e){if(_0x2b9437>_0x22c07e){for(var _0x30113c=0x0;_0x30113c<_0x2b9437-_0x22c07e;_0x30113c+=0x1){decremetOriginate(_0x2713c6);}}}function loggerGetContactDialer(_0x416b20,_0x5a61aa,_0x43533b){return function(_0x54bca5){checkContactLowerLimitOriginate(_0x5a61aa,_0x43533b,0x0);logger['error'](_0x416b20,util[_0x7cea('0x95')](_0x54bca5,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1542cf){return function(_0x1cca5b){if(isNotNull(_0x1cca5b)&&isNotNull(_0x1cca5b[0x0])){if(_0x1cca5b[0x0]['contactsRescheduled']>0x0){_0x1542cf[_0x7cea('0x3e')]=_0x7cea('0x9a');logger[_0x7cea('0x78')](_0x7cea('0x9b')+_0x1542cf[_0x7cea('0x40')],_0x1cca5b[0x0][_0x7cea('0x9c')],'contacts');}else{_0x1542cf[_0x7cea('0x3e')]=_0x7cea('0x9d');logger[_0x7cea('0x78')](_0x7cea('0x9e')+_0x1542cf[_0x7cea('0x40')]);}}};}function notSendMessagesQueue(_0x58e046){if(_0x58e046['sendMessageOneNotActive']){freeVariablesPredictive(_0x58e046);if(_0x58e046[_0x7cea('0x98')]===0x0&&_0x58e046['talking']===0x0&&_0x58e046['waiting']===0x0&&(_0x58e046['pTalking']||0x0)===0x0){_0x58e046[_0x7cea('0x9f')]=![];_0x58e046[_0x7cea('0x4c')]=0x0;_0x58e046[_0x7cea('0x3e')]=_0x7cea('0xa0');loggerSyncQueueSummary[_0x7cea('0x93')](_0x7cea('0xa1'),_0x58e046[_0x7cea('0x40')],_0x7cea('0xa2'));}else{_0x58e046[_0x7cea('0x3e')]=_0x7cea('0xa3');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x58e046['name'],_0x7cea('0xa4'));}emitVoiceQueueSummary(_0x58e046);}}function notSendMessagesCampaign(_0x2ec531){if(_0x2ec531['sendMessageOneNotActive']){if(_0x2ec531[_0x7cea('0x98')]===0x0){_0x2ec531[_0x7cea('0x9f')]=![];_0x2ec531[_0x7cea('0x3e')]=_0x7cea('0xa0');loggerSyncQueueSummary[_0x7cea('0x93')](_0x7cea('0xa5'),_0x2ec531[_0x7cea('0x40')],_0x7cea('0xa2'));}else{_0x2ec531['message']=_0x7cea('0xa3');loggerSyncQueueSummary[_0x7cea('0x93')](_0x7cea('0xa5'),_0x2ec531['name'],_0x7cea('0xa4'));}emitCampaignSummary(_0x2ec531);}}function createObjHistory(_0x55c630,_0x265e2d,_0x3db8ef,_0x1fd5df,_0x595661){_0x55c630[_0x7cea('0x3e')]=_0x3db8ef;var _0x3cd9c2=new Action(_0x55c630,_0x265e2d);var _0x288c6e=new History(_0x3cd9c2);_0x288c6e[_0x7cea('0xa6')]=_0x1fd5df;_0x288c6e[_0x7cea('0xa7')]=_0x595661;_0x288c6e[_0x7cea('0xa8')]=_0x3cd9c2['starttime'];return _0x288c6e;}Dialer[_0x7cea('0x1d')]['loopClearZombieChannels']=function(){var _0x8b1f45=this;setInterval(function(){_0x8b1f45[_0x7cea('0xa9')](_0x8b1f45['uniqueId'],_0x7cea('0xaa'));_0x8b1f45['clearZombieChannels'](_0x8b1f45[_0x7cea('0x27')],_0x7cea('0xab'));},0x32c8);};Dialer[_0x7cea('0x1d')][_0x7cea('0xa9')]=function(_0x5d4ca2,_0x1adff8){var _0x55fb99=this;for(var _0x37ddc0 in _0x5d4ca2){if(_0x5d4ca2[_0x7cea('0x97')](_0x37ddc0)){this[_0x7cea('0xac')][_0x7cea('0x1e')](function(){if(!_[_0x7cea('0xad')](_0x5d4ca2[_0x37ddc0])){return ami[_0x7cea('0xae')]({'action':_0x7cea('0xaf'),'channel':_0x5d4ca2[_0x37ddc0][_0x7cea('0xb0')]})[_0x7cea('0xb1')](function(_0x3bb9e6){if(_0x3bb9e6[_0x7cea('0x3e')]===_0x7cea('0xb2')){setTimeout(function(){if(_0x5d4ca2[_0x37ddc0]&&_0x5d4ca2[_0x37ddc0]['type']!=='ivr'){_0x55fb99[_0x7cea('0xb3')](_0x55fb99[_0x7cea('0x21')][_0x5d4ca2[_0x37ddc0][_0x7cea('0xb4')]]);logger[_0x7cea('0x93')](_0x7cea('0xb5'),_0x1adff8,_0x37ddc0,_0x5d4ca2[_0x37ddc0][_0x7cea('0xb4')]);delete _0x5d4ca2[_0x37ddc0];}if(_0x5d4ca2[_0x37ddc0]&&_0x5d4ca2[_0x37ddc0][_0x7cea('0x52')]==='ivr'){_0x55fb99[_0x7cea('0xb3')](_0x55fb99[_0x7cea('0x22')][_0x5d4ca2[_0x37ddc0][_0x7cea('0xb4')]]);logger[_0x7cea('0x93')](_0x7cea('0xb6'),_0x1adff8,_0x37ddc0,_0x5d4ca2[_0x37ddc0][_0x7cea('0xb4')]);delete _0x5d4ca2[_0x37ddc0];}},0x2328);}});}});}}};Dialer[_0x7cea('0x1d')][_0x7cea('0xb7')]=function(_0x251dd0){return BPromise[_0x7cea('0xb8')]()[_0x7cea('0xb9')](cmHopper[_0x7cea('0xb7')](_0x251dd0))[_0x7cea('0xb1')](loggerCatch(_0x7cea('0xba')));};Dialer[_0x7cea('0x1d')][_0x7cea('0xbb')]=function(_0x17010b){return BPromise[_0x7cea('0xb8')]()['then'](cmHopperBlack['checkIsBlackList'](_0x17010b))[_0x7cea('0xb1')](loggerCatch(_0x7cea('0xbc')));};Dialer[_0x7cea('0x1d')][_0x7cea('0xbd')]=function(_0x5522cf){return BPromise[_0x7cea('0xb8')]()[_0x7cea('0xb9')](cmHopperBlack['checkIsBlackListIvr'](_0x5522cf))[_0x7cea('0xb1')](loggerCatch(_0x7cea('0xbe')));};Dialer[_0x7cea('0x1d')][_0x7cea('0xbf')]=function(_0x5500ac){return BPromise['resolve']()['then'](cmHopperHistory[_0x7cea('0xc0')](_0x5500ac))[_0x7cea('0xb1')](loggerCatch(_0x7cea('0xc1')));};Dialer[_0x7cea('0x1d')][_0x7cea('0xc2')]=function(_0x5f5786){return BPromise['resolve']()[_0x7cea('0xb9')](cmHopper[_0x7cea('0xc2')](_0x5f5786))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x7cea('0x1d')][_0x7cea('0xc3')]=function(_0x358775,_0x115074,_0x1ae9f2){return BPromise['resolve']()[_0x7cea('0xb9')](cmHopper['unlockContact'](_0x358775,_0x115074,_0x1ae9f2))[_0x7cea('0xb1')](loggerCatch(_0x7cea('0xc4')));};Dialer[_0x7cea('0x1d')][_0x7cea('0xc5')]=function(_0x6c3e10,_0x368dbd,_0x550c1a,_0x523b59){return BPromise[_0x7cea('0xb8')]()[_0x7cea('0xb9')](cmHopper[_0x7cea('0xc5')](_0x6c3e10,_0x368dbd,_0x550c1a,_0x523b59))[_0x7cea('0xb1')](loggerCatch(_0x7cea('0xc6')));};Dialer['prototype'][_0x7cea('0xc7')]=function(_0x17fe30,_0x4252f1,_0x28ecf4){return BPromise['resolve']()['then'](cmHopper[_0x7cea('0xc7')](_0x17fe30,_0x4252f1,_0x28ecf4))[_0x7cea('0xb1')](loggerCatch('[getContactDialer]\x20'));};Dialer['prototype'][_0x7cea('0xc8')]=function(_0x2aa2ea){return BPromise[_0x7cea('0xb8')]()[_0x7cea('0xb9')](voiceQueueRt[_0x7cea('0xc8')](_0x2aa2ea))[_0x7cea('0xb1')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x7cea('0x1d')][_0x7cea('0xc9')]=function(_0x4a1735){return BPromise[_0x7cea('0xb8')]()[_0x7cea('0xb9')](cmHopper[_0x7cea('0xc9')](_0x4a1735))[_0x7cea('0xb1')](loggerCatch(_0x7cea('0xca')));};Dialer['prototype']['createHistory']=function(_0x4151b4){return BPromise[_0x7cea('0xb8')]()[_0x7cea('0xb9')](cmHopperHistory['createHistory'](_0x4151b4))['catch'](loggerCatch(_0x7cea('0xcb')));};Dialer['prototype'][_0x7cea('0xb3')]=function(_0x41fa39){if(!_[_0x7cea('0x3d')](_0x41fa39)&&_0x41fa39!==null){if(_0x41fa39['hasOwnProperty'](_0x7cea('0x98'))){if(_0x41fa39[_0x7cea('0x98')]>0x0){_0x41fa39[_0x7cea('0x98')]-=0x1;}else{logger[_0x7cea('0x93')](_0x7cea('0xcc'));}}}else{logger[_0x7cea('0x93')](_0x7cea('0xcd'));}};Dialer[_0x7cea('0x1d')][_0x7cea('0xce')]=function(_0x585e44,_0x271a35){var _0x4c4b9b=this;return function(_0x54d95c){_0x4c4b9b[_0x7cea('0xb3')](_0x271a35);logger[_0x7cea('0x93')](_0x585e44,util[_0x7cea('0x95')](_0x54d95c,{'showHidden':![],'depth':null}));};};Dialer[_0x7cea('0x1d')][_0x7cea('0xcf')]=function(_0x392d35,_0x3c091b,_0x29e985){var _0x211d30={'state':0x19,'statedesc':_0x7cea('0xd0')};this[_0x7cea('0xb3')](_0x3c091b);this[_0x7cea('0xd1')](_[_0x7cea('0x89')](_0x211d30,_[_0x7cea('0xd2')](_0x29e985,[_0x7cea('0xd3'),_0x7cea('0xd4'),_0x7cea('0xd5'),'VoiceQueueId',_0x7cea('0xd6')])),_0x7cea('0xd7'),'[emptyContact]');logger['error'](_0x392d35);};Dialer[_0x7cea('0x1d')][_0x7cea('0xd8')]=function(_0x18890a){return _0x18890a==='Success';};Dialer[_0x7cea('0x1d')][_0x7cea('0xd9')]=function(_0x950ea){return!_['isUndefined'](_0x950ea)&&_0x950ea&&!_[_0x7cea('0x3d')](_0x950ea[_0x7cea('0x40')])&&!_[_0x7cea('0x3d')](_0x950ea[_0x7cea('0x71')])&&_0x950ea[_0x7cea('0x71')]&&(this[_0x7cea('0x24')][util[_0x7cea('0x90')](_0x7cea('0xda'),_0x950ea[_0x7cea('0x40')])][_0x7cea('0xaf')]===_0x7cea('0xdb')||this[_0x7cea('0x24')][util[_0x7cea('0x90')](_0x7cea('0xda'),_0x950ea[_0x7cea('0x40')])]['status']==='unmonitored');};Dialer[_0x7cea('0x1d')][_0x7cea('0xd1')]=function(_0x7c44b5,_0x52b695,_0x43843a){this['createHistory'](_0x7c44b5)[_0x7cea('0xb1')](loggerCatch(_0x52b695));this[_0x7cea('0xc9')](_0x7c44b5)['catch'](loggerCatch(_0x43843a));};Dialer[_0x7cea('0x1d')]['syncVarSet']=function(_0x5d757f){var _0x515b7e=this[_0x7cea('0xdc')][_0x5d757f[_0x7cea('0xdd')]];var _0x556610;if(!_[_0x7cea('0xad')](_0x5d757f)&&!_[_0x7cea('0xad')](_0x5d757f['variable'])&&!_[_0x7cea('0xad')](_0x5d757f[_0x7cea('0xde')][_0x7cea('0xdf')])&&_0x5d757f[_0x7cea('0xe0')]==='xcally-motion-dialer'&&_0x515b7e){if(_0x515b7e[_0x7cea('0x52')]!==_0x7cea('0x8e')&&this['voiceQueues'][_0x515b7e[_0x7cea('0xb4')]][_0x7cea('0xe1')]&&_0x5d757f[_0x7cea('0xe2')]==='HANGUP'){delete this[_0x7cea('0xdc')][_0x5d757f[_0x7cea('0xdd')]];this['updateOriginated'](this[_0x7cea('0x21')][_0x515b7e[_0x7cea('0xb4')]]);this['voiceQueues'][_0x515b7e[_0x7cea('0xb4')]][_0x7cea('0x5c')]+=0x1;this[_0x7cea('0x21')][_0x515b7e[_0x7cea('0xb4')]][_0x7cea('0x5b')]+=0x1;_0x556610=new Hangup(_0x515b7e,_0x5d757f);_0x556610[_0x7cea('0xa6')]=0x12;_0x556610['statedesc']=_0x7cea('0xe3');_0x556610[_0x7cea('0xe4')]='AMD';this[_0x7cea('0xd1')](_0x556610,'[syncHangupInAMD][createHistory]',_0x7cea('0xe5'));}if(_0x515b7e[_0x7cea('0x52')]!==_0x7cea('0x8e')&&this[_0x7cea('0x21')][_0x515b7e['queue']][_0x7cea('0xe1')]&&_0x5d757f[_0x7cea('0xe2')]===_0x7cea('0xe6')){delete this[_0x7cea('0xdc')][_0x5d757f[_0x7cea('0xdd')]];this[_0x7cea('0xb3')](this[_0x7cea('0x21')][_0x515b7e[_0x7cea('0xb4')]]);this[_0x7cea('0x21')][_0x515b7e['queue']]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x515b7e[_0x7cea('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;_0x556610=new Hangup(_0x515b7e,_0x5d757f);_0x556610[_0x7cea('0xa6')]=0x13;_0x556610[_0x7cea('0xa7')]='Machine';_0x556610[_0x7cea('0xe4')]='AMD';_0x556610[_0x7cea('0xe7')]=!![];this['saveInDb'](_0x556610,_0x7cea('0xe8'),_0x7cea('0xe9'));}if(_0x515b7e[_0x7cea('0x52')]===_0x7cea('0x8e')&&this[_0x7cea('0x22')][_0x515b7e['queue']][_0x7cea('0xe1')]&&_0x5d757f[_0x7cea('0xe2')]===_0x7cea('0xea')){delete this[_0x7cea('0xdc')][_0x5d757f['uniqueid']];this[_0x7cea('0xb3')](this[_0x7cea('0x22')][_0x515b7e[_0x7cea('0xb4')]]);_0x556610=new Hangup(_0x515b7e,_0x5d757f);_0x556610[_0x7cea('0xa6')]=0x12;_0x556610[_0x7cea('0xa7')]=_0x7cea('0xe3');_0x556610[_0x7cea('0xe4')]=_0x7cea('0xeb');this[_0x7cea('0xd1')](_0x556610,'[syncHangupInAMDIvr][createHistory]',_0x7cea('0xec'));}if(_0x515b7e[_0x7cea('0x52')]==='ivr'&&this[_0x7cea('0x22')][_0x515b7e[_0x7cea('0xb4')]][_0x7cea('0xe1')]&&_0x5d757f['value']===_0x7cea('0xe6')){delete this[_0x7cea('0xdc')][_0x5d757f[_0x7cea('0xdd')]];this[_0x7cea('0xb3')](this['campaigns'][_0x515b7e[_0x7cea('0xb4')]]);_0x556610=new Hangup(_0x515b7e,_0x5d757f);_0x556610[_0x7cea('0xa6')]=0x13;_0x556610[_0x7cea('0xa7')]=_0x7cea('0xed');_0x556610[_0x7cea('0xe4')]='AMD';_0x556610[_0x7cea('0xe7')]=!![];this[_0x7cea('0xd1')](_0x556610,_0x7cea('0xee'),_0x7cea('0xef'));}}};Dialer[_0x7cea('0x1d')]['syncHangup']=function(_0x3e7d4c){var _0x2b292b=this['uniqueId'][_0x3e7d4c[_0x7cea('0xdd')]];var _0x5d3ae9=this;var _0x583089;if(_0x2b292b&&_0x2b292b[_0x7cea('0x52')]===_0x7cea('0x8e')){delete this['uniqueId'][_0x3e7d4c[_0x7cea('0xdd')]];this['updateOriginated'](this[_0x7cea('0x22')][_0x2b292b[_0x7cea('0xb4')]]);this[_0x7cea('0x22')][_0x2b292b[_0x7cea('0xb4')]][_0x7cea('0xf0')]+=0x1;_0x583089=new Hangup(_0x2b292b,_0x3e7d4c);this['createHistory'](_0x583089)[_0x7cea('0xb1')](loggerCatch(_0x7cea('0xf1')));this[_0x7cea('0xc9')](_0x583089)[_0x7cea('0xb1')](loggerCatch('[syncHangupIvr]'));}if(_0x2b292b&&_0x2b292b['type']!==_0x7cea('0x8e')&&isNotNull(this[_0x7cea('0x21')][_0x2b292b[_0x7cea('0xb4')]]['dialQueueProject'])){delete this[_0x7cea('0xdc')][_0x3e7d4c['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x2b292b[_0x7cea('0xb4')]]);this['voiceQueues'][_0x2b292b['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x7cea('0x21')][_0x2b292b[_0x7cea('0xb4')]][_0x7cea('0x5b')]+=0x1;_0x583089=new Hangup(_0x2b292b,_0x3e7d4c);_0x583089['state']=0x10;_0x583089[_0x7cea('0xa7')]=_0x7cea('0xf2');_0x583089['membername']='AGI';this[_0x7cea('0xf3')](_0x583089)[_0x7cea('0xb1')](loggerCatch(_0x7cea('0xf1')));this[_0x7cea('0xc9')](_0x583089)[_0x7cea('0xb1')](loggerCatch(_0x7cea('0xf4')));}if(_0x2b292b&&_0x2b292b[_0x7cea('0x52')]!==_0x7cea('0x8e')&&!isNotNull(this[_0x7cea('0x21')][_0x2b292b[_0x7cea('0xb4')]][_0x7cea('0xf5')])){delete this[_0x7cea('0xdc')][_0x3e7d4c[_0x7cea('0xdd')]];this['updateOriginated'](this[_0x7cea('0x21')][_0x2b292b[_0x7cea('0xb4')]]);this['voiceQueues'][_0x2b292b[_0x7cea('0xb4')]][_0x7cea('0x62')]+=0x1;_0x583089=new Hangup(_0x2b292b,_0x3e7d4c);_0x583089[_0x7cea('0xa6')]=0xc;_0x583089[_0x7cea('0xa7')]=_0x3e7d4c[_0x7cea('0xf6')];_0x583089['membername']=_0x7cea('0xf7');this[_0x7cea('0xf3')](_0x583089)['catch'](loggerCatch(_0x7cea('0xf1')));this['moveContactManagedDialer'](_0x583089)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x7cea('0x1d')][_0x7cea('0xf8')]=function(_0x8eb1c){var _0xd2d79=this['uniqueId'][_0x8eb1c[_0x7cea('0xdd')]];var _0x3acf9e=this;if(this[_0x7cea('0x21')][_0x8eb1c['queue']]){if(_0xd2d79&&_0xd2d79['type']!=='ivr'){delete this[_0x7cea('0xdc')][_0x8eb1c[_0x7cea('0xdd')]];this[_0x7cea('0x21')][_0x8eb1c[_0x7cea('0xb4')]]['outboundAnswerCallsDay']+=0x1;var _0xba27f9=new AgentComplete(_0xd2d79,_0x8eb1c);if(_0x8eb1c[_0x7cea('0xf9')]===_0x7cea('0xfa')){_0xba27f9[_0x7cea('0xfb')]=this['voiceQueues'][_0x8eb1c[_0x7cea('0xb4')]][_0x7cea('0xfc')]&&this['voiceQueues'][_0x8eb1c[_0x7cea('0xb4')]]['dialAgiAfterHangupAgent']?moment()[_0x7cea('0x90')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0xba27f9)[_0x7cea('0xb1')](loggerCatch(_0x7cea('0xfd')));this[_0x7cea('0xc9')](_0xba27f9)[_0x7cea('0xb1')](loggerCatch(_0x7cea('0xfe')));}}};Dialer['prototype']['syncAgentConnect']=function(_0x2a22bf){if(this[_0x7cea('0x21')][_0x2a22bf[_0x7cea('0xb4')]]){if(this['uniqueId'][_0x2a22bf['uniqueid']]&&this['uniqueId'][_0x2a22bf[_0x7cea('0xdd')]][_0x7cea('0x52')]!==_0x7cea('0x8e')){this[_0x7cea('0xb3')](this['voiceQueues'][_0x2a22bf['queue']]);this[_0x7cea('0xdc')][_0x2a22bf[_0x7cea('0xdd')]][_0x7cea('0xff')]=moment()[_0x7cea('0x90')](_0x7cea('0x100'));}}};Dialer['prototype'][_0x7cea('0x101')]=function(_0xd22ba2){this[_0x7cea('0xf3')](_0xd22ba2)['catch'](loggerCatch(_0x7cea('0xfd')));this[_0x7cea('0xc9')](_0xd22ba2)[_0x7cea('0xb1')](loggerCatch(_0x7cea('0x102')));};Dialer[_0x7cea('0x1d')][_0x7cea('0x103')]=function(_0x449130){var _0x4ee997=this['uniqueId'][_0x449130['uniqueid']];var _0x84d7f1=this;if(this['voiceQueues'][_0x449130[_0x7cea('0xb4')]]){if(_0x4ee997&&_0x4ee997[_0x7cea('0x52')]!==_0x7cea('0x8e')){delete this[_0x7cea('0xdc')][_0x449130['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x449130['queue']]);_0x4ee997[_0x7cea('0x104')]=moment()[_0x7cea('0x90')]('YYYY-MM-DD\x20HH:mm:ss');var _0x37a616=new QueueCallerAbandon(_0x4ee997,_0x449130);if(getSeconds(_0x4ee997['droptime'],_0x4ee997[_0x7cea('0x105')])>=_0x4ee997[_0x7cea('0x106')]){this[_0x7cea('0x21')][_0x449130[_0x7cea('0xb4')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x7cea('0x21')][_0x449130['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0x7cea('0x21')][_0x449130[_0x7cea('0xb4')]][_0x7cea('0x68')]+=0x1;_0x37a616[_0x7cea('0xa6')]=0xa;_0x37a616[_0x7cea('0xa7')]=_0x7cea('0x107');_0x37a616[_0x7cea('0x108')]=_0x7cea('0x109');_0x37a616[_0x7cea('0xfb')]=this['voiceQueues'][_0x449130[_0x7cea('0xb4')]][_0x7cea('0xfc')]?moment()['format'](_0x7cea('0x100')):undefined;_0x37a616['countdropretry']+=0x1;if(_0x37a616[_0x7cea('0x10a')]>=this[_0x7cea('0x21')][_0x449130['queue']][_0x7cea('0x10b')]-0x1){this['queueCallerAbandonCreateState'](_0x37a616);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x37a616[_0x7cea('0x10a')],'scheduledat':moment()[_0x7cea('0x10c')](this['voiceQueues'][_0x449130[_0x7cea('0xb4')]][_0x7cea('0x10d')],_0x7cea('0x10e'))[_0x7cea('0x90')](_0x7cea('0x100')),'ContactId':_0x4ee997[_0x7cea('0xd3')],'ListId':_0x4ee997[_0x7cea('0xd4')],'VoiceQueueId':_0x4ee997[_0x7cea('0x10f')]||undefined,'CampaignId':_0x4ee997[_0x7cea('0xd6')]||undefined})['catch'](loggerCatch(_0x7cea('0x110')));var _0x4b9e2e=new History(_0x37a616);logger['error'](util[_0x7cea('0x90')](_0x7cea('0x111'),JSON[_0x7cea('0x47')](err)));_0x4b9e2e[_0x7cea('0xa6')]=0xa;_0x4b9e2e[_0x7cea('0xa7')]='Drop';_0x4b9e2e[_0x7cea('0x112')]=moment()['format'](_0x7cea('0x100'));_0x4b9e2e['endtime']=_0x4b9e2e[_0x7cea('0x112')];this['createHistory'](_0x4b9e2e)[_0x7cea('0xb1')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x7cea('0x21')][_0x449130[_0x7cea('0xb4')]][_0x7cea('0x66')]+=0x1;this[_0x7cea('0x21')][_0x449130['queue']][_0x7cea('0x113')]+=0x1;_0x37a616['state']=0xb;_0x37a616[_0x7cea('0xa7')]=_0x7cea('0x114');_0x37a616['dropreason']=_0x7cea('0x115');_0x37a616[_0x7cea('0x116')]+=0x1;if(_0x37a616[_0x7cea('0x116')]>=this[_0x7cea('0x21')][_0x449130[_0x7cea('0xb4')]]['dialAbandonedMaxRetry']-0x1){this['queueCallerAbandonCreateState'](_0x37a616);}else{this[_0x7cea('0xc2')]({'active':![],'countabandonedretry':_0x37a616[_0x7cea('0x116')],'scheduledat':moment()[_0x7cea('0x10c')](this[_0x7cea('0x21')][_0x449130['queue']][_0x7cea('0x117')],'minutes')['format'](_0x7cea('0x100')),'ContactId':_0x4ee997[_0x7cea('0xd3')],'ListId':_0x4ee997[_0x7cea('0xd4')],'VoiceQueueId':_0x4ee997[_0x7cea('0x10f')]||undefined,'CampaignId':_0x4ee997['CampaignId']||undefined})['catch'](loggerCatch(_0x7cea('0x118')));var _0x4b9e2e=new History(_0x37a616);logger[_0x7cea('0x93')](util['format']('[originateError]:\x20%s',JSON[_0x7cea('0x47')](err)));_0x4b9e2e[_0x7cea('0xa6')]=0xb;_0x4b9e2e['statedesc']='Abandoned';_0x4b9e2e[_0x7cea('0x112')]=moment()[_0x7cea('0x90')](_0x7cea('0x100'));_0x4b9e2e[_0x7cea('0xa8')]=_0x4b9e2e[_0x7cea('0x112')];this[_0x7cea('0xf3')](_0x4b9e2e)['catch'](loggerCatch(_0x7cea('0x119')));}}}}};Dialer[_0x7cea('0x1d')][_0x7cea('0x36')]=function(_0x300fc3){if(this['actions'][_0x300fc3[_0x7cea('0xdd')]]){this[_0x7cea('0x27')][_0x300fc3[_0x7cea('0xdd')]]['channel']=_0x300fc3[_0x7cea('0xb0')];}if(this[_0x7cea('0xdc')][_0x300fc3[_0x7cea('0xdd')]]){this['uniqueId'][_0x300fc3[_0x7cea('0xdd')]][_0x7cea('0xb0')]=_0x300fc3[_0x7cea('0xb0')];}};Dialer['prototype']['syncQueueMember']=function(_0x2f02ea){if(strategy[this[_0x7cea('0x21')][this['actions'][_0x2f02ea[_0x7cea('0x11a')]][_0x7cea('0xb4')]][_0x7cea('0x4a')]]===_0x7cea('0x1c')){if(this[_0x7cea('0x27')][_0x2f02ea[_0x7cea('0x11a')]]&&_[_0x7cea('0xad')](this[_0x7cea('0x27')][_0x2f02ea['actionid']][_0x7cea('0x11b')])&&_0x2f02ea['status']==='1'&&_0x2f02ea[_0x7cea('0x11c')]==='0'){if(this[_0x7cea('0x23')][_0x2f02ea[_0x7cea('0x11d')]]){if(!this[_0x7cea('0x23')][_0x2f02ea['stateinterface']][_0x7cea('0x11b')]){this[_0x7cea('0x23')][_0x2f02ea['stateinterface']][_0x7cea('0x11b')]=!![];this[_0x7cea('0x27')][_0x2f02ea[_0x7cea('0x11a')]][_0x7cea('0x11b')]=!![];this[_0x7cea('0x27')][_0x2f02ea['actionid']][_0x7cea('0x11d')]=_0x2f02ea[_0x7cea('0x11d')];}}}}else if((strategy[this[_0x7cea('0x21')][this[_0x7cea('0x27')][_0x2f02ea['actionid']]['queue']][_0x7cea('0x4a')]]||'rrmemory')===_0x7cea('0x1b')){if(this[_0x7cea('0x27')][_0x2f02ea[_0x7cea('0x11a')]]){if(this[_0x7cea('0x23')][_0x2f02ea[_0x7cea('0x11d')]]){this[_0x7cea('0x27')][_0x2f02ea[_0x7cea('0x11a')]][_0x7cea('0x11d')]=_0x2f02ea['stateinterface'];if(_[_0x7cea('0xad')](this[_0x7cea('0x2c')][this['actions'][_0x2f02ea[_0x7cea('0x11a')]][_0x7cea('0xb4')]])){this[_0x7cea('0x2c')][this[_0x7cea('0x27')][_0x2f02ea[_0x7cea('0x11a')]][_0x7cea('0xb4')]]=[];}this[_0x7cea('0x2c')][this[_0x7cea('0x27')][_0x2f02ea[_0x7cea('0x11a')]]['queue']][_0x7cea('0x11e')](_[_0x7cea('0x89')](_[_0x7cea('0xd2')](this[_0x7cea('0x27')][_0x2f02ea[_0x7cea('0x11a')]],[_0x7cea('0x11f'),_0x7cea('0x11d')]),{'status':_0x2f02ea[_0x7cea('0xaf')],'paused':_0x2f02ea[_0x7cea('0x11c')]}));}}}};function unlockQueueStatus(_0x1aeabf,_0x763ffb){setTimeout(function(){if(_['isUndefined'](_0x1aeabf[_0x7cea('0x120')])){loggerBooked[_0x7cea('0x93')]('[unlockQueueStatus][undefined]',_0x763ffb);}_0x1aeabf[_0x7cea('0x120')]=!![];loggerBooked[_0x7cea('0x78')](_0x7cea('0x121'),_0x763ffb,JSON[_0x7cea('0x47')](_[_0x7cea('0xd2')](_0x1aeabf,[_0x7cea('0x40'),_0x7cea('0x120')])));},0x1f3);}Dialer['prototype'][_0x7cea('0x3b')]=function(_0x55c4a8){var _0x5daf70=this;var _0x278b1e=_0x5daf70[_0x7cea('0x21')][_0x5daf70[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]]['queue']];if(strategy[this['voiceQueues'][this['actions'][_0x55c4a8['actionid']][_0x7cea('0xb4')]]['strategy']]===_0x7cea('0x1c')){if(this[_0x7cea('0x27')][_0x55c4a8['actionid']]&&this['actions'][_0x55c4a8[_0x7cea('0x11a')]][_0x7cea('0x11d')]){this['preview']['run'](this['actions'][_0x55c4a8['actionid']][_0x7cea('0x11f')],this[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]][_0x7cea('0x11d')])[_0x7cea('0xb1')](function(_0x109fb9){logger[_0x7cea('0x93')](_0x7cea('0x122'),util[_0x7cea('0x95')](_0x109fb9,{'showHidden':![],'depth':null}));})['finally'](function(){_0x5daf70[_0x7cea('0xb3')](_0x5daf70['voiceQueues'][_0x5daf70[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]][_0x7cea('0xb4')]]);_0x5daf70[_0x7cea('0x23')][_0x5daf70[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]][_0x7cea('0x11d')]][_0x7cea('0x11b')]=![];delete _0x5daf70[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]];unlockQueueStatus(_0x278b1e);});}else{this['updateOriginated'](this[_0x7cea('0x21')][this[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]][_0x7cea('0xb4')]]);this[_0x7cea('0xc2')]({'active':![],'ContactId':this[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]][_0x7cea('0xd3')],'ListId':this['actions'][_0x55c4a8[_0x7cea('0x11a')]][_0x7cea('0xd4')],'VoiceQueueId':this[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]][_0x7cea('0x10f')]||undefined,'CampaignId':this[_0x7cea('0x27')][_0x55c4a8['actionid']]['CampaignId']||undefined})[_0x7cea('0xb1')](loggerCatch(_0x7cea('0x123')));delete this[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]];unlockQueueStatus(_0x278b1e);}}else if((strategy[this[_0x7cea('0x21')][this[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]]['queue']][_0x7cea('0x4a')]]||_0x7cea('0x1b'))===_0x7cea('0x1b')){var _0x1430b1;if(this[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]]&&!_['isEmpty'](this[_0x7cea('0x2c')][this[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]][_0x7cea('0xb4')]])){if(this[_0x7cea('0x2d')][_0x5daf70[_0x7cea('0x27')][_0x55c4a8['actionid']][_0x7cea('0xb4')]]){this[_0x7cea('0x2d')][_0x5daf70[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]][_0x7cea('0xb4')]]=this[_0x7cea('0x2d')][this[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]]['queue']]?this['queueBookedRR'][this[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]]['queue']]:this['queueBooked'][this[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]][_0x7cea('0xb4')]]?this[_0x7cea('0x2c')][this[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]][_0x7cea('0xb4')]][_0x7cea('0x124')]||0x0:0x0;}this['queueBooked'][this[_0x7cea('0x27')][_0x55c4a8[_0x7cea('0x11a')]][_0x7cea('0xb4')]][_0x7cea('0x124')]=this[_0x7cea('0x2d')][this[_0x7cea('0x27')][_0x55c4a8['actionid']][_0x7cea('0xb4')]];for(var _0x10a90c=0x0;_0x10a90c=0x0?!![]:![];})[_0x7cea('0xb1')](myreject(_0x4e2625)));}}else{_0x35ceb8[_0x7cea('0x11e')](ami['Action']({'action':_0x7cea('0x13d'),'command':util[_0x7cea('0x90')](_0x7cea('0x140'),_0x3522f2,!_[_0x7cea('0x3d')](config[_0x7cea('0x139')][_0x1bb8a9])?_0x1bb8a9:'')})[_0x7cea('0xb9')](function(_0x48d979){return _0x48d979['content']['indexOf'](_0x7cea('0x141'))>=0x0?!![]:![];})[_0x7cea('0xb1')](myreject(_0x4e2625)));}BPromise[_0x7cea('0x142')](_0x35ceb8)[_0x7cea('0xb9')](function(_0x4c39a1){var _0x55c5d4=_[_0x7cea('0x143')](_0x4c39a1);if(_0x55c5d4){return _0x947853(_0x55c5d4);}else{_0x436ba7[_0x7cea('0x3e')]=_0x65f8c5?_0x7cea('0x144'):_0x7cea('0x145');return _0x4e2625(msgResponse('[ifTime][promiseAll]',_0x7cea('0x135'),_0x7cea('0x146')+_0x65f8c5+'\x20'+_0x24de38+_0x7cea('0x147')+util[_0x7cea('0x95')](_0x3522f2,{'showHidden':![],'depth':null})+_0x7cea('0x148')+_0x1bb8a9));}})[_0x7cea('0xb1')](function(_0x5af5f3){return _0x4e2625(msgResponse(_0x7cea('0x133'),'Failure',JSON[_0x7cea('0x47')](_0x5af5f3)));});});};Dialer['prototype'][_0x7cea('0x149')]=function(_0x380ea6){var _0x11a71d=this;return function(){switch(_0x380ea6['dialMethod']){case _0x7cea('0x14a'):freeVariablesPredictive(_0x380ea6);_0x11a71d[_0x7cea('0x14b')](_0x380ea6,0x1);break;case _0x7cea('0x14c'):freeVariablesPredictive(_0x380ea6);_0x11a71d[_0x7cea('0x14b')](_0x380ea6,_0x380ea6[_0x7cea('0x14d')]);break;case _0x7cea('0x14e'):_0x11a71d[_0x7cea('0x14e')](_0x380ea6);break;case _0x7cea('0x6'):freeVariablesPredictive(_0x380ea6);_0x11a71d[_0x7cea('0x14b')](_0x380ea6,0x1);break;default:freeVariablesPredictive(_0x380ea6);logger[_0x7cea('0x93')](_0x7cea('0x14f'),_0x380ea6['name'],_0x7cea('0x150'));}};};Dialer[_0x7cea('0x1d')]['launchHandleIvr']=function(_0x1b5868){var _0x369904=this;return function(){_0x369904['handleIvr'](_0x1b5868);};};Dialer[_0x7cea('0x1d')][_0x7cea('0x8')]=function(_0x495e29){var _0x4ce741=this;if(isNotPreview(_0x495e29[_0x7cea('0x57')])){if(isVoiceQueueOutbound(_0x495e29[_0x7cea('0x52')])&&isActive(_0x495e29[_0x7cea('0x56')])){_0x495e29[_0x7cea('0x9f')]=!![];BPromise[_0x7cea('0xb8')]()[_0x7cea('0xb9')](checkIsLoggedIn(_0x495e29,_0x495e29[_0x7cea('0x4d')]))[_0x7cea('0xb9')](checkIsActive(_0x495e29,_0x495e29[_0x7cea('0x56')]))[_0x7cea('0xb9')](checkInterval(_0x495e29))[_0x7cea('0xb9')](_0x4ce741[_0x7cea('0x151')](_0x495e29))['then'](_0x4ce741[_0x7cea('0x132')](_0x495e29[_0x7cea('0x152')],_0x495e29[_0x7cea('0x153')],_0x495e29[_0x7cea('0x40')],_0x495e29))[_0x7cea('0xb9')](_0x4ce741[_0x7cea('0x134')](_0x495e29[_0x7cea('0x73')],_0x495e29['dialTimezone'],_0x495e29['name'],_0x495e29))[_0x7cea('0xb9')](_0x4ce741[_0x7cea('0x149')](_0x495e29))[_0x7cea('0xb1')](loggerCatchQueueSummary(_0x7cea('0x154'),_0x495e29));}else{notSendMessagesQueue(_0x495e29);}}else{freeVariablesPredictive(_0x495e29);}};Dialer[_0x7cea('0x1d')][_0x7cea('0x12f')]=function(){var _0x477222=this;var _0x2289bc;for(var _0x4753a2 in this[_0x7cea('0x22')]){if(this[_0x7cea('0x22')][_0x7cea('0x97')](_0x4753a2)){_0x2289bc=this[_0x7cea('0x22')][_0x4753a2];if(isCampaignIvr(_0x2289bc[_0x7cea('0x52')])&&isActive(_0x2289bc[_0x7cea('0x71')])){_0x2289bc[_0x7cea('0x9f')]=!![];BPromise[_0x7cea('0xb8')]()[_0x7cea('0xb9')](checkIsActive(_0x2289bc,_0x2289bc[_0x7cea('0x71')]))[_0x7cea('0xb9')](checkInterval(_0x2289bc))[_0x7cea('0xb9')](_0x477222[_0x7cea('0x151')](_0x2289bc))[_0x7cea('0xb9')](_0x477222[_0x7cea('0x132')](_0x2289bc[_0x7cea('0x152')],_0x2289bc[_0x7cea('0x153')],_0x2289bc[_0x7cea('0x40')],_0x2289bc))['then'](_0x477222['checkIfTimeIntervals'](_0x2289bc['Interval'],_0x2289bc[_0x7cea('0x153')],_0x2289bc[_0x7cea('0x40')],_0x2289bc))[_0x7cea('0xb9')](_0x477222[_0x7cea('0x155')](_0x2289bc))[_0x7cea('0xb1')](loggerCatchQueueSummary(_0x7cea('0x156'),_0x2289bc));}else{notSendMessagesCampaign(_0x2289bc);}}}};function getCallerIdRandom(_0x142aba,_0x229c8a){var _0x5dd62d,_0x2d0c91,_0x1c55b0;if(_0x229c8a<=0x0){_0x229c8a=0x1;}_0x5dd62d=new RegExp(_0x7cea('0x157')+_0x229c8a+'}$');_0x2d0c91=Math['pow'](0xa,_0x229c8a-0x1);_0x1c55b0=Math[_0x7cea('0x158')](0xa,_0x229c8a)-0x1;return util[_0x7cea('0x90')]('%s',_[_0x7cea('0x159')](_0x142aba,_0x5dd62d,_[_0x7cea('0x15a')](_0x2d0c91,_0x1c55b0)));}function extractCalleridName(_0xa486a8){var _0x2f01bb=_0xa486a8[_0x7cea('0x15b')](/"(.*?)"/);return _0x2f01bb?_0x2f01bb[0x1]:_0xa486a8;}function extractCalleridNumber(_0x373c98){var _0x56a9ca=_0x373c98[_0x7cea('0x15b')](/<(.*?)>/);return _0x56a9ca?_0x56a9ca[0x1]:_0x373c98;}Dialer[_0x7cea('0x1d')][_0x7cea('0x15c')]=function(_0x577495,_0x3dbe2a){var _0x5e5de5=this;var _0x116816=uuid['v4']();this[_0x7cea('0x27')][_0x116816]=new Action(_0x577495,_0x3dbe2a,_0x116816);return new BPromise(function(_0x2b2a0a,_0x484027){if(_[_0x7cea('0x3d')](_0x577495)&&'object'!==typeof _0x577495){return _0x484027(msgResponse('originate',_0x7cea('0x135'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x3dbe2a[_0x7cea('0x15d')][_0x7cea('0x15e')])||_0x3dbe2a[_0x7cea('0x15d')][_0x7cea('0x15e')]===null){return _0x484027(msgResponse(_0x7cea('0x15f'),'Failure',_0x7cea('0x160')));}var _0x51b5dc={'XMD-CALLERID':_0x5e5de5[_0x7cea('0x27')][_0x116816][_0x7cea('0x161')](),'XMD-AGI':_0x577495[_0x7cea('0xf5')]?util['format'](_0x7cea('0x162'),ipAgi,_0x577495[_0x7cea('0xf5')]):_0x7cea('0x163'),'XMD-AGIAFTER':_0x577495[_0x7cea('0xfc')]?util[_0x7cea('0x90')]('\x22agi://%s/square,%s\x22',ipAgi,_0x577495[_0x7cea('0xfc')]):_0x7cea('0x163'),'XMD-QUEUE':_0x577495['type']===_0x7cea('0x164')?util[_0x7cea('0x90')]('\x22%s,%s%s,,,%s\x22',_0x577495['name'],_0x577495[_0x7cea('0x165')]||'',_0x577495['dialAgiAfterHangupAgent']?'c':'',_0x577495[_0x7cea('0x106')]||0x3):'NONE','XMD-CONTACTID':_0x3dbe2a['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5e5de5['actions'][_0x116816]['getCaller'](),'XMD-AMD':_0x577495[_0x7cea('0xe1')]?_0x7cea('0x166'):_0x7cea('0x163'),'XMD-DESTINATION':_0x7cea('0x167')};if(_0x577495[_0x7cea('0xe1')]){_0x51b5dc[_0x7cea('0x168')]=_0x577495[_0x7cea('0x169')]||0x9c4;_0x51b5dc[_0x7cea('0x16a')]=_0x577495[_0x7cea('0x16b')]||0x5dc;_0x51b5dc[_0x7cea('0x16c')]=_0x577495['dialAMDAfterGreetingSilence']||0x320;_0x51b5dc['XMD-AMDTOTALANALYSISTIME']=_0x577495[_0x7cea('0x16d')]||0x1388;_0x51b5dc['XMD-AMDMINWORDLENGTH']=_0x577495[_0x7cea('0x16e')]||0x64;_0x51b5dc[_0x7cea('0x16f')]=_0x577495[_0x7cea('0x170')]||0x32;_0x51b5dc['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x577495[_0x7cea('0x171')]||0x3;_0x51b5dc[_0x7cea('0x172')]=_0x577495[_0x7cea('0x173')]||0x100;_0x51b5dc[_0x7cea('0x174')]=_0x577495[_0x7cea('0x175')]||0x1388;}if(_0x577495['type']===_0x7cea('0x164')){_0x51b5dc['XMD-VOICEQUEUEID']=_0x3dbe2a[_0x7cea('0x10f')];}else{_0x51b5dc[_0x7cea('0x176')]=_0x3dbe2a[_0x7cea('0xd6')];}for(var _0x473fa3 in _0x3dbe2a[_0x7cea('0x15d')]){if(_0x3dbe2a[_0x7cea('0x15d')][_0x7cea('0x97')](_0x473fa3)){if(isNotNull(_0x3dbe2a[_0x7cea('0x15d')][_0x473fa3])&&_0x473fa3!=='id'&&_0x473fa3!==_0x7cea('0x177')&&_0x473fa3!==_0x7cea('0x178')&&_0x473fa3!==_0x7cea('0x179')){_0x51b5dc[util[_0x7cea('0x90')](_0x7cea('0x17a'),_0x7cea('0x17b'),_['toUpper'](_0x473fa3))]=_0x3dbe2a[_0x7cea('0x15d')][_0x473fa3];}}}var _0x55b824=_0x5e5de5['isTrunkReachable'](_0x577495[_0x7cea('0x70')])?getCallerId(_0x577495[_0x7cea('0x70')][_0x7cea('0x72')],_0x577495[_0x7cea('0x58')],_0x577495[_0x7cea('0x17c')]>0x0?getCallerIdRandom(_0x577495[_0x7cea('0x59')],_0x577495[_0x7cea('0x17c')]):_0x577495['dialOriginateCallerIdNumber']):getCallerId(_[_0x7cea('0xad')](_0x577495[_0x7cea('0x130')])?_0x577495[_0x7cea('0x70')][_0x7cea('0x72')]:_0x577495[_0x7cea('0x130')][_0x7cea('0x72')],_0x577495['dialOriginateCallerIdName'],_0x577495[_0x7cea('0x17c')]>0x0?getCallerIdRandom(_0x577495[_0x7cea('0x59')],_0x577495[_0x7cea('0x17c')]):_0x577495[_0x7cea('0x59')]);if(_0x55b824){_0x51b5dc[_0x7cea('0x17d')]=_0x5e5de5[_0x7cea('0x27')][_0x116816][_0x7cea('0x17e')]=extractCalleridName(_0x55b824);_0x51b5dc[_0x7cea('0x17f')]=_0x5e5de5['actions'][_0x116816]['originatecalleridnum']=extractCalleridNumber(_0x55b824);}return ami[_0x7cea('0xae')]({'actionid':_0x116816,'action':_0x7cea('0x15f'),'channel':_0x5e5de5[_0x7cea('0xd9')](_0x577495['Trunk'])?util[_0x7cea('0x90')](_0x7cea('0x180'),_0x577495['Trunk']['name'],isNotNull(_0x577495[_0x7cea('0x181')])?_0x577495[_0x7cea('0x181')][_0x7cea('0x182')]()||'':'',_0x577495['dialCutDigit']>0x0?_0x3dbe2a[_0x7cea('0x15d')][_0x7cea('0x15e')][_0x7cea('0x183')](_0x577495[_0x7cea('0x184')]):_0x3dbe2a[_0x7cea('0x15d')]['phone']):util['format'](_0x7cea('0x180'),_[_0x7cea('0xad')](_0x577495['TrunkBackup'])?_0x577495['Trunk'][_0x7cea('0x40')]:_0x577495[_0x7cea('0x130')][_0x7cea('0x40')],isNotNull(_0x577495['dialPrefix'])?_0x577495['dialPrefix'][_0x7cea('0x182')]()||'':'',_0x577495['dialCutDigit']>0x0?_0x3dbe2a[_0x7cea('0x15d')][_0x7cea('0x15e')][_0x7cea('0x183')](_0x577495['dialCutDigit']):_0x3dbe2a[_0x7cea('0x15d')][_0x7cea('0x15e')]),'callerid':_0x55b824,'Exten':_0x7cea('0x167'),'Context':_0x7cea('0x185'),'Priority':'1','variable':_0x51b5dc,'timeout':(_0x577495[_0x7cea('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x116816})['then'](function(_0x1e95f0){return _0x2b2a0a(_0x1e95f0);})[_0x7cea('0xb1')](function(_0x3b80f1){_0x577495[_0x7cea('0x61')]+=0x1;var _0x3795a4=new History(_0x5e5de5[_0x7cea('0x27')][_0x116816]);logger['error'](util[_0x7cea('0x90')](_0x7cea('0x111'),JSON[_0x7cea('0x47')](_0x3b80f1)));_0x3795a4[_0x7cea('0xa6')]=0xe;_0x3795a4[_0x7cea('0xa7')]=_0x7cea('0x186');_0x3795a4[_0x7cea('0x112')]=moment()[_0x7cea('0x90')]('YYYY-MM-DD\x20HH:mm:ss');_0x3795a4[_0x7cea('0xa8')]=_0x3795a4[_0x7cea('0x112')];_0x5e5de5[_0x7cea('0xf3')](_0x3795a4)[_0x7cea('0xb1')](loggerCatch(_0x7cea('0x187')));_0x5e5de5[_0x7cea('0xc9')](_0x3795a4)[_0x7cea('0xb1')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x5e5de5[_0x7cea('0x27')][_0x116816];return _0x484027(msgResponse('originate',_0x7cea('0x46'),_0x7cea('0x188')));});});});};Dialer[_0x7cea('0x1d')][_0x7cea('0x33')]=function(_0x2f3432){var _0x35ef94=this[_0x7cea('0x27')][_0x2f3432['actionid']];var _0x4797e9=this;if(_0x35ef94){delete this['actions'][_0x2f3432[_0x7cea('0x11a')]];_0x35ef94['responsetime']=moment()['format'](_0x7cea('0x100'));var _0x27be23=_0x35ef94[_0x7cea('0x52')]===_0x7cea('0x8e')?this['campaigns'][_0x35ef94[_0x7cea('0xb4')]]:this[_0x7cea('0x21')][_0x35ef94[_0x7cea('0x189')]()];if(!this[_0x7cea('0xd8')](_0x2f3432[_0x7cea('0x18a')])){this[_0x7cea('0xb3')](_0x27be23);return this[_0x7cea('0x18b')](_0x35ef94,_0x27be23,_0x2f3432)['then'](function(_0x317114){})[_0x7cea('0xb1')](loggerCatch(_0x7cea('0x18c')));}else{this[_0x7cea('0xdc')][_0x2f3432[_0x7cea('0xdd')]]=_0x35ef94;}}};Dialer[_0x7cea('0x1d')][_0x7cea('0x18d')]=function(_0x53899c,_0x31cf95,_0x41b8a9){var _0x5420e7=new History(_0x31cf95);if(_0x5420e7[_0x7cea('0x18e')]+_0x5420e7['countcongestionretry']+_0x5420e7[_0x7cea('0x18f')]+_0x5420e7[_0x7cea('0x190')]+_0x5420e7[_0x7cea('0x10a')]+_0x5420e7[_0x7cea('0x116')]+_0x5420e7[_0x7cea('0x191')]+_0x5420e7[_0x7cea('0x192')]>=_0x41b8a9[_0x7cea('0x193')]-0x1){return!![];}switch(_0x53899c){case 0x3:if(_0x5420e7[_0x7cea('0x18f')]>=_0x41b8a9[_0x7cea('0x194')]-0x1){return!![];}else{this[_0x7cea('0xc2')]({'active':![],'countnoanswerretry':_0x5420e7[_0x7cea('0x18f')]+=0x1,'scheduledat':moment()['add'](_0x41b8a9['dialNoAnswerRetryFrequency'],_0x7cea('0x10e'))[_0x7cea('0x90')](_0x7cea('0x100')),'ContactId':_0x5420e7[_0x7cea('0xd3')],'ListId':_0x5420e7[_0x7cea('0xd4')],'VoiceQueueId':_0x5420e7[_0x7cea('0x10f')]||undefined,'CampaignId':_0x5420e7['CampaignId']||undefined})[_0x7cea('0xb1')](loggerCatch(_0x7cea('0x195')));}break;case 0x5:if(_0x5420e7[_0x7cea('0x18e')]>=_0x41b8a9[_0x7cea('0x196')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x5420e7[_0x7cea('0x18e')]+=0x1,'scheduledat':moment()[_0x7cea('0x10c')](_0x41b8a9[_0x7cea('0x197')],'minutes')[_0x7cea('0x90')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5420e7[_0x7cea('0xd3')],'ListId':_0x5420e7[_0x7cea('0xd4')],'VoiceQueueId':_0x5420e7[_0x7cea('0x10f')]||undefined,'CampaignId':_0x5420e7[_0x7cea('0xd6')]||undefined})[_0x7cea('0xb1')](loggerCatch(_0x7cea('0x198')));}break;case 0x8:if(_0x5420e7['countcongestionretry']>=_0x41b8a9[_0x7cea('0x199')]-0x1){return!![];}else{this[_0x7cea('0xc2')]({'active':![],'countcongestionretry':_0x5420e7[_0x7cea('0x19a')]+=0x1,'scheduledat':moment()[_0x7cea('0x10c')](_0x41b8a9[_0x7cea('0x19b')],_0x7cea('0x10e'))[_0x7cea('0x90')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5420e7[_0x7cea('0xd3')],'ListId':_0x5420e7[_0x7cea('0xd4')],'VoiceQueueId':_0x5420e7[_0x7cea('0x10f')]||undefined,'CampaignId':_0x5420e7['CampaignId']||undefined})[_0x7cea('0xb1')](loggerCatch(_0x7cea('0x19c')));}break;case 0x0:if(_0x5420e7[_0x7cea('0x190')]>=_0x41b8a9[_0x7cea('0x19d')]-0x1){return!![];}else{this[_0x7cea('0xc2')]({'active':![],'countnosuchnumberretry':_0x5420e7[_0x7cea('0x190')]+=0x1,'scheduledat':moment()[_0x7cea('0x10c')](_0x41b8a9[_0x7cea('0x19e')],_0x7cea('0x10e'))[_0x7cea('0x90')](_0x7cea('0x100')),'ContactId':_0x5420e7[_0x7cea('0xd3')],'ListId':_0x5420e7['ListId'],'VoiceQueueId':_0x5420e7[_0x7cea('0x10f')]||undefined,'CampaignId':_0x5420e7[_0x7cea('0xd6')]||undefined})[_0x7cea('0xb1')](loggerCatch(_0x7cea('0x19f')));}break;case 0xa:if(_0x5420e7['countdropretry']>=_0x41b8a9['dialDropMaxRetry']-0x1){return!![];}else{this[_0x7cea('0xc2')]({'active':![],'countdropretry':_0x5420e7[_0x7cea('0x10a')]+=0x1,'scheduledat':moment()['add'](_0x41b8a9[_0x7cea('0x10d')],_0x7cea('0x10e'))[_0x7cea('0x90')](_0x7cea('0x100')),'ContactId':_0x5420e7['ContactId'],'ListId':_0x5420e7[_0x7cea('0xd4')],'VoiceQueueId':_0x5420e7['VoiceQueueId']||undefined,'CampaignId':_0x5420e7['CampaignId']||undefined})[_0x7cea('0xb1')](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x5420e7['countabandonedretry']>=_0x41b8a9['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0x7cea('0xc2')]({'active':![],'countabandonedretry':_0x5420e7[_0x7cea('0x116')]+=0x1,'scheduledat':moment()['add'](_0x41b8a9[_0x7cea('0x117')],_0x7cea('0x10e'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5420e7[_0x7cea('0xd3')],'ListId':_0x5420e7[_0x7cea('0xd4')],'VoiceQueueId':_0x5420e7['VoiceQueueId']||undefined,'CampaignId':_0x5420e7[_0x7cea('0xd6')]||undefined})[_0x7cea('0xb1')](loggerCatch(_0x7cea('0x118')));}break;case 0x13:if(_0x5420e7['countmachineretry']>=_0x41b8a9[_0x7cea('0x1a0')]-0x1){return!![];}else{this[_0x7cea('0xc2')]({'active':![],'countmachineretry':_0x5420e7[_0x7cea('0x191')]+=0x1,'scheduledat':moment()[_0x7cea('0x10c')](_0x41b8a9['dialMachineRetryFrequency'],_0x7cea('0x10e'))[_0x7cea('0x90')](_0x7cea('0x100')),'ContactId':_0x5420e7['ContactId'],'ListId':_0x5420e7['ListId'],'VoiceQueueId':_0x5420e7[_0x7cea('0x10f')]||undefined,'CampaignId':_0x5420e7[_0x7cea('0xd6')]||undefined})[_0x7cea('0xb1')](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x5420e7[_0x7cea('0x192')]>=_0x41b8a9[_0x7cea('0x1a1')]-0x1){return!![];}else{this[_0x7cea('0xc2')]({'active':![],'countagentrejectretry':_0x5420e7[_0x7cea('0x192')]+=0x1,'scheduledat':moment()['add'](_0x41b8a9['dialAgentRejectRetryFrequency'],'minutes')[_0x7cea('0x90')](_0x7cea('0x100')),'ContactId':_0x5420e7[_0x7cea('0xd3')],'ListId':_0x5420e7['ListId'],'VoiceQueueId':_0x5420e7[_0x7cea('0x10f')]||undefined,'CampaignId':_0x5420e7[_0x7cea('0xd6')]||undefined})['catch'](loggerCatch(_0x7cea('0x1a2')));}break;default:return!![];}};Dialer[_0x7cea('0x1d')][_0x7cea('0x18b')]=function(_0x2517fc,_0xd2267c,_0x48ef8b){var _0x2ea766=this;var _0x46136a=new History(_0x2517fc);return new BPromise(function(_0x560565,_0x2c007f){if(_[_0x7cea('0x3d')](_0xd2267c)&&_0x7cea('0x1a3')!==typeof _0xd2267c){return _0x2c007f(msgResponse(_0x7cea('0x1a4'),_0x7cea('0x135'),_0x7cea('0x1a5')));}if(_['isUndefined'](_0x48ef8b)&&_0x7cea('0x1a3')!==typeof _0x48ef8b){return _0x2c007f(msgResponse(_0x7cea('0x1a4'),_0x7cea('0x135'),_0x7cea('0x1a6')));}switch(_0x48ef8b['reason']){case'0':_0xd2267c[_0x7cea('0x60')]+=0x1;_0x46136a[_0x7cea('0xa6')]=0x0;_0x46136a[_0x7cea('0xa7')]=_0x7cea('0x1a7');_0x46136a[_0x7cea('0x190')]+=0x1;_0x46136a[_0x7cea('0x1a8')]+=0x1;_0x2ea766[_0x7cea('0xf3')](_0x46136a)[_0x7cea('0xb1')](loggerCatch(_0x7cea('0x1a9')));if(_0x2ea766['checkRetriveMax'](0x0,_0x2517fc,_0xd2267c)){if(_0x46136a[_0x7cea('0x18e')]+_0x46136a[_0x7cea('0x19a')]+_0x46136a['countnoanswerretry']+_0x46136a['countnosuchnumberretry']+_0x46136a['countdropretry']+_0x46136a[_0x7cea('0x116')]+_0x46136a[_0x7cea('0x191')]+_0x46136a[_0x7cea('0x192')]>=_0xd2267c['dialGlobalMaxRetry']){_0x2ea766[_0x7cea('0x1aa')](_0x46136a,_0x560565,_0x2c007f,_0x7cea('0x1ab'));}else{_0x2ea766[_0x7cea('0x1ac')](_0x46136a,_0x560565,_0x2c007f,_0x7cea('0x1ab'));}}break;case'3':_0xd2267c[_0x7cea('0x5f')]+=0x1;_0x46136a['state']=0x3;_0x46136a[_0x7cea('0xa7')]=_0x7cea('0x1ad');_0x46136a[_0x7cea('0x18f')]+=0x1;_0x46136a[_0x7cea('0x1a8')]+=0x1;_0x2ea766[_0x7cea('0xf3')](_0x46136a)['catch'](loggerCatch(_0x7cea('0x1ae')));if(_0x2ea766[_0x7cea('0x18d')](0x3,_0x2517fc,_0xd2267c)){if(_0x46136a[_0x7cea('0x18f')]>=_0xd2267c[_0x7cea('0x194')]){_0x2ea766['createStateFinal'](_0x46136a,_0x560565,_0x2c007f,'reason\x203\x20ringing\x20no\x20answer');}else{_0x2ea766[_0x7cea('0x1aa')](_0x46136a,_0x560565,_0x2c007f,_0x7cea('0x1af'));}}break;case'5':_0xd2267c[_0x7cea('0x5d')]+=0x1;_0x46136a[_0x7cea('0xa6')]=0x5;_0x46136a['statedesc']=_0x7cea('0x1b0');_0x46136a[_0x7cea('0x18e')]+=0x1;_0x46136a[_0x7cea('0x1a8')]+=0x1;_0x2ea766[_0x7cea('0xf3')](_0x46136a)[_0x7cea('0xb1')](loggerCatch(_0x7cea('0x1b1')));if(_0x2ea766[_0x7cea('0x18d')](0x5,_0x2517fc,_0xd2267c)){if(_0x46136a[_0x7cea('0x18e')]>=_0xd2267c[_0x7cea('0x196')]){_0x2ea766[_0x7cea('0x1ac')](_0x46136a,_0x560565,_0x2c007f,_0x7cea('0x1b2'));}else{_0x2ea766[_0x7cea('0x1aa')](_0x46136a,_0x560565,_0x2c007f,'reason\x205\x20busy');}}break;case'8':_0xd2267c[_0x7cea('0x1b3')]+=0x1;_0x46136a['state']=0x8;_0x46136a[_0x7cea('0xa7')]=_0x7cea('0x1b4');_0x46136a[_0x7cea('0x19a')]+=0x1;_0x46136a[_0x7cea('0x1a8')]+=0x1;_0x2ea766[_0x7cea('0xf3')](_0x46136a)[_0x7cea('0xb1')](loggerCatch(_0x7cea('0x1b5')));if(_0x2ea766[_0x7cea('0x18d')](0x8,_0x2517fc,_0xd2267c)){if(_0x46136a['countcongestionretry']>=_0xd2267c[_0x7cea('0x199')]){_0x2ea766[_0x7cea('0x1ac')](_0x46136a,_0x560565,_0x2c007f,_0x7cea('0x1b6'));}else{_0x2ea766[_0x7cea('0x1aa')](_0x46136a,_0x560565,_0x2c007f,'reason\x208\x20congestion');}}break;case'11':_0xd2267c[_0x7cea('0x1b7')]+=0x1;_0x46136a['state']=0xb;_0x46136a[_0x7cea('0xa7')]=_0x7cea('0x114');_0x46136a[_0x7cea('0x116')]+=0x1;_0x46136a['countglobal']+=0x1;_0x2ea766[_0x7cea('0xf3')](_0x46136a)[_0x7cea('0xb1')](loggerCatch(_0x7cea('0x119')));if(_0x2ea766[_0x7cea('0x18d')](0xb,_0x2517fc,_0xd2267c)){if(_0x46136a['countabandonedretry']>=_0xd2267c[_0x7cea('0x1b8')]){_0x2ea766['createStateFinal'](_0x46136a,_0x560565,_0x2c007f,_0x7cea('0x1b9'));}else{_0x2ea766[_0x7cea('0x1aa')](_0x46136a,_0x560565,_0x2c007f,_0x7cea('0x1b9'));}}break;case'20':_0xd2267c[_0x7cea('0x1ba')]+=0x1;_0x46136a[_0x7cea('0xa6')]=0x14;_0x46136a[_0x7cea('0xa7')]='AgentReject';_0x46136a[_0x7cea('0x192')]+=0x1;_0x46136a['countglobal']+=0x1;_0x2ea766[_0x7cea('0xf3')](_0x46136a)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x2ea766[_0x7cea('0x18d')](0x14,_0x2517fc,_0xd2267c)){if(_0x46136a[_0x7cea('0x192')]>=_0xd2267c[_0x7cea('0x1a1')]){_0x2ea766[_0x7cea('0x1ac')](_0x46136a,_0x560565,_0x2c007f,'reason\x2020\x20agentreject');}else{_0x2ea766[_0x7cea('0x1aa')](_0x46136a,_0x560565,_0x2c007f,'reason\x2020\x20agentreject');}}break;default:_0xd2267c[_0x7cea('0x62')]+=0x1;_0x46136a[_0x7cea('0xa6')]=0xc;_0x46136a[_0x7cea('0xa7')]=_0x48ef8b['reason'];_0x2ea766[_0x7cea('0xf3')](_0x46136a)[_0x7cea('0xb1')](loggerCatch(_0x7cea('0x1bb')));if(_0x2ea766['checkRetriveMax'](_0x48ef8b[_0x7cea('0xf9')],_0x2517fc,_0xd2267c)){if(_0x46136a[_0x7cea('0x18e')]+_0x46136a['countcongestionretry']+_0x46136a[_0x7cea('0x18f')]+_0x46136a[_0x7cea('0x190')]+_0x46136a[_0x7cea('0x10a')]+_0x46136a[_0x7cea('0x116')]+_0x46136a[_0x7cea('0x191')]+_0x46136a[_0x7cea('0x192')]>=_0xd2267c[_0x7cea('0x193')]){_0x2ea766[_0x7cea('0x1aa')](_0x46136a,_0x560565,_0x2c007f,_0x48ef8b[_0x7cea('0xf9')]);}else{_0x2ea766[_0x7cea('0x1ac')](_0x46136a,_0x560565,_0x2c007f,_0x48ef8b['reason']);}}}});};Dialer[_0x7cea('0x1d')][_0x7cea('0x1aa')]=function(_0x1d7d67,_0x46ad04,_0x147914,_0xbcc5d3){var _0xd00ba3=new Final(_0x1d7d67);_0xd00ba3[_0x7cea('0xa6')]=0xf;_0xd00ba3[_0x7cea('0xa7')]=_0x7cea('0x1bc');this[_0x7cea('0x1ac')](_0xd00ba3,_0x46ad04,_0x147914,_0xbcc5d3);};Dialer['prototype'][_0x7cea('0x1ac')]=function(_0x9c38db,_0x258c58,_0x4817c5,_0x21b38e){this[_0x7cea('0xc9')](_0x9c38db)[_0x7cea('0xb9')](function(_0x1f1f70){return _0x258c58(msgResponse(_0x7cea('0x1a4'),_0x7cea('0x1bd'),_0x21b38e));})[_0x7cea('0xb1')](function(_0x5ee2ea){return _0x4817c5(msgResponse(_0x7cea('0x1be'),_0x7cea('0x135'),_0x7cea('0x1bf')));});};Dialer['prototype'][_0x7cea('0x14e')]=function(_0x40910b){var _0x581c39=this;var _0x3cbe80=_0x40910b[_0x7cea('0x1c0')]/0x64;var _0x2f57a7=_0x40910b['outboundDropCallsDayTimeout']/(_0x40910b[_0x7cea('0x1c1')]+_0x40910b['outboundAnswerCallsDay']);var _0x1ca26b=Math[_0x7cea('0x1c2')](_0x40910b['predictiveIntervalAvailable']*(_0x40910b['predictiveIntervalMaxThreshold']/0x64));var _0x5940bc=Math[_0x7cea('0x1c2')](_0x40910b['predictiveIntervalAvailable']*(_0x40910b[_0x7cea('0x1c3')]/0x64));var _0x643fba=_0x40910b[_0x7cea('0x4c')]+_0x40910b[_0x7cea('0x51')];var _0x3fcf9c=Math[_0x7cea('0x1c4')](_0x40910b[_0x7cea('0x6c')]*_0x40910b['erlangAbandonmentRate']*_0x40910b[_0x7cea('0x69')]*_0x40910b[_0x7cea('0x1c5')]);if(_[_0x7cea('0x3d')](_0x40910b[_0x7cea('0x6f')])){if(!_[_0x7cea('0x3d')](_0x40910b[_0x7cea('0x2a')])){_0x40910b[_0x7cea('0x2a')]=undefined;loggerPredictive['error'](_0x7cea('0x1c6'),_0x7cea('0x1c7'));}if(!_[_0x7cea('0x3d')](_0x40910b[_0x7cea('0x8c')])){loggerPredictive[_0x7cea('0x93')]('[startMethodPredictive][StartProgressive]',_0x7cea('0x1c8'));clearInterval(_0x40910b[_0x7cea('0x8c')]);_0x40910b[_0x7cea('0x8c')]=undefined;}_0x40910b[_0x7cea('0x6f')]=moment()[_0x7cea('0x90')](_0x7cea('0x100'));loggerPredictive[_0x7cea('0x78')](_0x40910b[_0x7cea('0x40')],_0x7cea('0x1c9'),_0x40910b[_0x7cea('0x6f')]);this[_0x7cea('0x14b')](_0x40910b,0x1);}else if(ifInterval(_0x40910b[_0x7cea('0x1ca')],_0x40910b[_0x7cea('0x6f')])){this[_0x7cea('0x14b')](_0x40910b,0x1);loggerPredictiveCalls[_0x7cea('0x78')](_0x7cea('0x1cb'),_0x40910b[_0x7cea('0x6f')],_0x40910b['name']);_0x40910b[_0x7cea('0x6c')]=0x0;_0x40910b[_0x7cea('0x68')]=0x0;}else if(_0x3cbe80<_0x2f57a7&&_0x40910b[_0x7cea('0x1cc')]===_0x7cea('0x1cd')){freeVariablesPredictive(_0x40910b);loggerPredictive[_0x7cea('0x78')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x7cea('0x1ce'),_0x2f57a7,_0x7cea('0x6f'),_0x40910b[_0x7cea('0x40')]);}else if(_0x3fcf9c<_0x40910b['predictiveIntervalErlangCallsDroppedCalls']&&_0x40910b[_0x7cea('0x1cc')]===_0x7cea('0x1cd')){freeVariablesPredictive(_0x40910b);loggerPredictive[_0x7cea('0x78')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x7cea('0x1cf'),_0x3fcf9c,_0x7cea('0x1d0'),_0x40910b[_0x7cea('0x68')],_0x7cea('0x6f'),_0x40910b[_0x7cea('0x40')]);}else if(!ifInterval(_0x40910b[_0x7cea('0x1ca')],_0x40910b[_0x7cea('0x6f')])&&_[_0x7cea('0x3d')](_0x40910b[_0x7cea('0x2a')])&&!_['isUndefined'](_0x40910b[_0x7cea('0x6f')])){_0x40910b[_0x7cea('0x2a')]=moment()[_0x7cea('0x90')](_0x7cea('0x100'));loggerPredictive['info'](_0x40910b[_0x7cea('0x40')],_0x7cea('0x1d1'),_0x40910b[_0x7cea('0x2a')]);this[_0x7cea('0xbf')](_0x40910b[_0x7cea('0x1ca')])[_0x7cea('0xb9')](this['getDataPredictive'](_0x40910b))[_0x7cea('0xb9')](mergeDataErlangB(_0x40910b))['then'](this[_0x7cea('0x1d2')](_0x40910b))[_0x7cea('0xb1')](loggerCatchPredictive(_0x7cea('0x1d3'),_0x40910b));}else if(!ifInterval(_0x40910b[_0x7cea('0x1ca')],_0x40910b[_0x7cea('0x2a')])){_0x40910b['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x40910b[_0x7cea('0x2a')]=moment()[_0x7cea('0x90')](_0x7cea('0x100'));loggerPredictive[_0x7cea('0x78')](_0x40910b[_0x7cea('0x40')],'recalculate\x20predictive\x20at',_0x40910b[_0x7cea('0x2a')]);clearInterval(_0x40910b[_0x7cea('0x8c')]);_0x40910b[_0x7cea('0x8c')]=undefined;this[_0x7cea('0xbf')](_0x40910b[_0x7cea('0x1ca')])[_0x7cea('0xb9')](this[_0x7cea('0x1d4')](_0x40910b))[_0x7cea('0xb9')](mergeDataErlangB(_0x40910b))[_0x7cea('0xb9')](this[_0x7cea('0x1d2')](_0x40910b))[_0x7cea('0xb1')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x40910b));}else if(_0x40910b[_0x7cea('0x6b')]&&_0x643fba<_0x40910b[_0x7cea('0x6b')]-_0x5940bc){freeVariablesPredictive(_0x40910b);loggerPredictive[_0x7cea('0x78')](_0x40910b[_0x7cea('0x40')],_0x7cea('0x1d5'),_0x643fba,_0x7cea('0x1d6'),_0x40910b[_0x7cea('0x6b')],'-',_0x5940bc,'=',_0x40910b[_0x7cea('0x6b')]-_0x5940bc,')');}else if(_0x40910b[_0x7cea('0x6b')]&&_0x643fba>_0x40910b[_0x7cea('0x6b')]+_0x1ca26b){freeVariablesPredictive(_0x40910b);loggerPredictive['info'](_0x40910b[_0x7cea('0x40')],_0x7cea('0x1d5'),_0x643fba,_0x7cea('0x1d7'),_0x40910b[_0x7cea('0x6b')],'+',_0x1ca26b,'=',_0x40910b[_0x7cea('0x6b')]+_0x1ca26b,')');}};Dialer[_0x7cea('0x1d')][_0x7cea('0x1d4')]=function(_0x5a3d6c){var _0x4f8e9e=this;return function(_0x5bb6be){return new BPromise(function(_0x8186fc,_0x3d5947){_[_0x7cea('0x89')](_0x5a3d6c,_0x5bb6be[0x0]);if(checkGetDataPredictive(_0x5bb6be[0x0])){var _0x1b72ee=_0x5a3d6c[_0x7cea('0x6b')]=_0x5a3d6c[_0x7cea('0x51')]+_0x5a3d6c[_0x7cea('0x4c')];var _0x36214a=_0x5a3d6c[_0x7cea('0x1ca')]*0x3c;var _0x3ac058=_0x5bb6be[0x0][_0x7cea('0x65')]+_0x5bb6be[0x0][_0x7cea('0x64')];var _0x33b712=(_0x5bb6be[0x0][_0x7cea('0x63')]+_0x5bb6be[0x0][_0x7cea('0x67')]+_0x5bb6be[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5bb6be[0x0][_0x7cea('0x7a')];_0x5a3d6c['predictiveIntervalHitRate']=_0x33b712>0x0?_0x33b712:0x1;switch(_0x5a3d6c[_0x7cea('0x1cc')]){case _0x7cea('0x1cd'):var _0x2b25ba=_0x5a3d6c[_0x7cea('0x1c0')]/0x64;return _0x4f8e9e[_0x7cea('0x1d8')](_0x1b72ee,_0x36214a,_0x3ac058,_0x33b712,_0x2b25ba)[_0x7cea('0xb9')](function(_0x5180b6){return _0x8186fc(_0x5180b6);});case _0x7cea('0x1d9'):var _0x1b5f3d=_0x5a3d6c[_0x7cea('0x1c0')]/0x64;return _0x4f8e9e['busyFactor'](_0x1b72ee,_0x36214a,_0x3ac058,_0x33b712,_0x1b5f3d)[_0x7cea('0xb9')](function(_0x10ec86){return _0x8186fc(_0x10ec86);});default:return _0x3d5947(msgResponse('[getDataPredictive]',_0x7cea('0x135'),_0x7cea('0x1da')));}}else{return _0x3d5947(msgResponse(_0x7cea('0x1db'),_0x7cea('0x135'),_0x7cea('0x1dc')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x423f2d){var _0x36c89f=this;return function(_0x597948){return new BPromise(function(_0x48876a,_0x1ab11d){_[_0x7cea('0x89')](_0x423f2d,_0x597948[0x0]);if(checkGetDataPredictive(_0x597948[0x0])){loggerPredictive[_0x7cea('0x78')](JSON['stringify'](_0x597948[0x0]));if(_0x423f2d[_0x7cea('0x1cc')]==='dropRate'){return _0x36c89f[_0x7cea('0xc8')](_0x423f2d['id'])[_0x7cea('0xb9')](function(_0x170785){var _0x240653=_0x423f2d['loggedIn']-_0x170785[0x0]['outboundQueuePauses'];var _0x411c31=_0x423f2d[_0x7cea('0x1ca')]*0x3c;var _0x522c2a=_0x597948[0x0][_0x7cea('0x65')]+_0x597948[0x0][_0x7cea('0x64')];var _0x51d0bb=(_0x597948[0x0]['predictiveIntervalAnsweredCalls']+_0x597948[0x0][_0x7cea('0x67')]+_0x597948[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x597948[0x0][_0x7cea('0x7a')];var _0x180125=_0x423f2d[_0x7cea('0x1c0')]/0x64;_0x423f2d[_0x7cea('0x6a')]=_0x170785[0x0][_0x7cea('0x1dd')]||0x0;_0x423f2d[_0x7cea('0x69')]=_0x51d0bb>0x0?_0x51d0bb:0x1;return _0x36c89f[_0x7cea('0x1d8')](_0x240653,_0x411c31,_0x522c2a,_0x51d0bb,_0x180125);})[_0x7cea('0xb9')](function(_0x1c229a){return _0x48876a(_0x1c229a);})['catch'](function(_0x5966bd){return _0x1ab11d(msgResponse(_0x7cea('0x1de'),_0x7cea('0x135'),JSON[_0x7cea('0x47')](_0x5966bd)));});}if(_0x423f2d[_0x7cea('0x1cc')]===_0x7cea('0x1d9')){return _0x36c89f[_0x7cea('0xc8')](_0x423f2d['id'])['then'](function(_0x554a65){var _0x21f96d=_0x423f2d[_0x7cea('0x4d')]-_0x554a65[0x0]['outboundQueuePauses'];var _0xdb7643=_0x423f2d[_0x7cea('0x1ca')]*0x3c;var _0x4b3b83=_0x597948[0x0][_0x7cea('0x65')]+_0x597948[0x0][_0x7cea('0x64')];var _0x1d6823=(_0x597948[0x0]['predictiveIntervalAnsweredCalls']+_0x597948[0x0][_0x7cea('0x67')]+_0x597948[0x0][_0x7cea('0x66')])/_0x597948[0x0][_0x7cea('0x7a')];var _0x40bdd8=_0x423f2d[_0x7cea('0x1c0')]/0x64;_0x423f2d['predictiveIntervalPauses']=_0x554a65[0x0][_0x7cea('0x1dd')]||0x0;_0x423f2d['predictiveIntervalHitRate']=_0x1d6823>0x0?_0x1d6823:0x1;return _0x36c89f[_0x7cea('0x1df')](_0x21f96d,_0xdb7643,_0x4b3b83,_0x1d6823,_0x40bdd8);})[_0x7cea('0xb9')](function(_0x3fb268){return _0x48876a(_0x3fb268);})[_0x7cea('0xb1')](function(_0x2b2433){return _0x1ab11d(msgResponse(_0x7cea('0x1de'),_0x7cea('0x135'),JSON[_0x7cea('0x47')](_0x2b2433)));});}}else{return _0x1ab11d(msgResponse('[getDataPredictive]','Failure',_0x7cea('0x1dc')));}});};};Dialer[_0x7cea('0x1d')][_0x7cea('0x1d2')]=function(_0x4e9d4d){var _0x5bcf4b=this;return function(){var _0x3e45ac=0x0;var _0xfce6f=Math[_0x7cea('0x1c4')](_0x4e9d4d['erlangCallToSecond']*0x3e8);if(_0xfce6f>0x0){_0xfce6f=_0xfce6f<0x64?0x64:_0xfce6f;loggerPredictive[_0x7cea('0x78')](_0x4e9d4d['name'],_0x7cea('0x1e0'),_0xfce6f,_0x7cea('0x48'));_0x4e9d4d[_0x7cea('0x8c')]=setInterval(function(){_0x5bcf4b[_0x7cea('0x8c')](_0x4e9d4d);loggerPredictiveCalls['info']('[handlePredictive]',_0x3e45ac+=0x1);},_0xfce6f);}else{loggerPredictive['info'](_0x4e9d4d[_0x7cea('0x40')],_0x7cea('0x1e1'));}};};Dialer[_0x7cea('0x1d')][_0x7cea('0x1e2')]=function(_0x15de31,_0x328a84){var _0xa8d8b9=this;return function(_0x3dec70){if(_[_0x7cea('0x44')](_0x3dec70)){if(_[_0x7cea('0xad')](_0x328a84[_0x7cea('0xd5')])||!_0x328a84[_0x7cea('0x1e3')]){if(_0x15de31['dialMethod']===_0x7cea('0x6')){_0x15de31[_0x7cea('0x120')]=_[_0x7cea('0x3d')](_0x15de31[_0x7cea('0x120')])?!![]:_0x15de31['queueStatusComplete'];var _0x1004a5=uuid['v4']();_0xa8d8b9[_0x7cea('0x27')][_0x1004a5]=new Action(_0x15de31,_0x328a84,_0x1004a5);loggerBooked[_0x7cea('0x78')](_0x7cea('0x1e4'),_0x1004a5,_0x7cea('0x1e5'),JSON[_0x7cea('0x47')](_0x15de31[_0x7cea('0x120')]),_0x7cea('0x1e6'),_0x15de31[_0x7cea('0x40')]);if(_0x15de31['queueStatusComplete']){_0x15de31['queueStatusComplete']=![];_0xa8d8b9[_0x7cea('0x2c')][_0xa8d8b9[_0x7cea('0x27')][_0x1004a5][_0x7cea('0xb4')]]=[];ami[_0x7cea('0xae')]({'actionid':_0x1004a5,'action':_0x7cea('0x1e7'),'queue':_0x15de31[_0x7cea('0x40')]})[_0x7cea('0xb1')](function(_0x1735c4){_0xa8d8b9['updateOriginated'](_0x15de31);_0xa8d8b9[_0x7cea('0xc2')]({'active':![],'ContactId':_0xa8d8b9['actions'][_0x1004a5]['ContactId'],'ListId':_0xa8d8b9[_0x7cea('0x27')][_0x1004a5]['ListId'],'VoiceQueueId':_0xa8d8b9['actions'][_0x1004a5][_0x7cea('0x10f')]||undefined,'CampaignId':_0xa8d8b9[_0x7cea('0x27')][_0x1004a5][_0x7cea('0xd6')]||undefined})[_0x7cea('0xb1')](loggerCatch(_0x7cea('0x1e8')));delete _0xa8d8b9['actions'][_0x1004a5];});}else{loggerBooked['info'](_0x7cea('0x1e9'),JSON['stringify'](_0x15de31[_0x7cea('0x120')]),_0x7cea('0x1e6'),_0x15de31['name']);_0xa8d8b9[_0x7cea('0xb3')](_0x15de31);_0xa8d8b9['rescheduleContact']({'active':![],'ContactId':_0xa8d8b9['actions'][_0x1004a5][_0x7cea('0xd3')],'ListId':_0xa8d8b9['actions'][_0x1004a5][_0x7cea('0xd4')],'VoiceQueueId':_0xa8d8b9[_0x7cea('0x27')][_0x1004a5][_0x7cea('0x10f')]||undefined,'CampaignId':_0xa8d8b9[_0x7cea('0x27')][_0x1004a5][_0x7cea('0xd6')]||undefined})[_0x7cea('0xb1')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0xa8d8b9['actions'][_0x1004a5];}}else{return _0xa8d8b9['actionOriginate'](_0x15de31,_0x328a84);}}else{if(getDiff(_0x328a84['scheduledat'])<_0x15de31[_0x7cea('0x1ea')]*0x3c){if(_0x328a84[_0x7cea('0x1eb')]&&!_0x328a84['Agent'][_0x7cea('0x1ec')]){_0xa8d8b9[_0x7cea('0x20')][_0x7cea('0x129')](_0x328a84['id'])[_0x7cea('0x12a')](function(){_0xa8d8b9[_0x7cea('0xb3')](_0x15de31);});}else{_0xa8d8b9[_0x7cea('0xc3')]({'active':![]},_0x328a84['id'],0x1)['finally'](function(){console[_0x7cea('0x1ed')](_0x7cea('0x1ee'));_0xa8d8b9[_0x7cea('0xb3')](_0x15de31);});}}else{_0x15de31['outboundReCallsDay']+=0x1;_0xa8d8b9[_0x7cea('0xb3')](_0x15de31);if(_0x15de31['dialRecallInQueue']){_0xa8d8b9[_0x7cea('0xc2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x328a84['ContactId'],'ListId':_0x328a84[_0x7cea('0xd4')],'VoiceQueueId':_0x328a84[_0x7cea('0x10f')]||undefined,'CampaignId':_0x328a84[_0x7cea('0xd6')]||undefined})[_0x7cea('0xb1')](loggerCatch(_0x7cea('0x1ef')));_0xa8d8b9[_0x7cea('0xf3')](createObjHistory(_0x15de31,_0x328a84,_0x7cea('0x1f0'),0x17,'RecallInQueue'))['catch'](loggerCatch(_0x7cea('0x1f1')));}else{_0xa8d8b9[_0x7cea('0xd1')](createObjHistory(_0x15de31,_0x328a84,_0x7cea('0x1f2'),0x16,'RecallFailedTimeout'),_0x7cea('0x1f3'),_0x7cea('0x1f4'));}}}}else{_0x15de31['outboundBlacklistCallsDay']+=0x1;_0xa8d8b9['saveInDb'](createObjHistory(_0x15de31,_0x328a84,_0x7cea('0x1f5'),0xd,_0x7cea('0x1f6')),_0x7cea('0x1f7'),_0x7cea('0x1f8'));throw _0x7cea('0x1f9');}};};Dialer[_0x7cea('0x1d')][_0x7cea('0x1fa')]=function(_0x35ca8f){var _0x3196c1=this;var _0xdca16d=[];var _0x44d96d=_0x35ca8f['limitCalls']-_0x35ca8f[_0x7cea('0x98')]-_0x35ca8f[_0x7cea('0x1fb')];emitCampaignSummary(_0x35ca8f);if(_0x44d96d>0x0){if(_0x44d96d>this[_0x7cea('0x25')]){_0x44d96d=this[_0x7cea('0x25')];}_0x35ca8f[_0x7cea('0x1fb')]+=_0x44d96d;this[_0x7cea('0xc7')](_0x35ca8f['id'],_0x44d96d,_0x35ca8f[_0x7cea('0x1fc')])[_0x7cea('0xb9')](function(_0x17a082){_0x35ca8f[_0x7cea('0x1fb')]-=_0x44d96d;_0x35ca8f['temp']=_0x35ca8f[_0x7cea('0x1fb')]>0x0?_0x35ca8f[_0x7cea('0x1fb')]:0x0;if(!checkContactEmpty(_0x17a082)){_0x35ca8f[_0x7cea('0x3e')]=_0x7cea('0x9d');logger[_0x7cea('0x78')](_0x7cea('0x1fd')+_0x35ca8f[_0x7cea('0x40')]);}else{_0x35ca8f[_0x7cea('0x98')]+=_0x17a082[_0x7cea('0x96')];_0x35ca8f['message']=_0x7cea('0x1fe');for(var _0x1f5798=0x0;_0x1f5798<_0x17a082['length'];_0x1f5798+=0x1){_0x35ca8f[_0x7cea('0x1ff')]+=0x1;if(_[_0x7cea('0xad')](_0x17a082[_0x1f5798])||_['isNil'](_0x17a082[_0x1f5798][_0x7cea('0x15d')])||_[_0x7cea('0xad')](_0x17a082[_0x1f5798][_0x7cea('0x15d')][_0x7cea('0x15e')])){_0x3196c1[_0x7cea('0xcf')](_0x7cea('0x200'),_0x35ca8f,_0x17a082[_0x1f5798]);}else{_0x3196c1['checkIsBlackListIvr'](_[_0x7cea('0xd2')](_0x17a082[_0x1f5798],[_0x7cea('0xd6'),_0x7cea('0x201')]))[_0x7cea('0xb9')](_0x3196c1['checkContactBlack'](_0x35ca8f,_0x17a082[_0x1f5798]))[_0x7cea('0xb1')](_0x3196c1['loggerHandler'](_0x7cea('0x202'),_0x35ca8f));}}}})[_0x7cea('0xb1')](loggerGetContactDialer(_0x7cea('0x203'),_0x35ca8f,_0x44d96d));}};Dialer[_0x7cea('0x1d')][_0x7cea('0x14b')]=function(_0x33d6b4,_0x406b10){var _0x2060db=this;var _0x113e85=[];var _0x577e27=_0x406b10>=0x1?_0x406b10:0x1;var _0x30a3e2=[];if(_0x33d6b4[_0x7cea('0x57')]===_0x7cea('0x6')){_0x577e27=0x1;}var _0x31bf3e=Math['floor'](_0x33d6b4[_0x7cea('0x4c')]*_0x577e27)-_0x33d6b4[_0x7cea('0x98')]-_0x33d6b4[_0x7cea('0x1fb')];emitVoiceQueueSummary(_0x33d6b4);if(_0x33d6b4[_0x7cea('0x204')]>0x0){var _0x1752eb=_0x33d6b4[_0x7cea('0x204')]-_0x33d6b4[_0x7cea('0x98')]-_0x33d6b4[_0x7cea('0x51')]-_0x33d6b4[_0x7cea('0x1fb')]-_0x33d6b4[_0x7cea('0x205')];if(_0x31bf3e>_0x1752eb){_0x31bf3e=_0x1752eb;}}if(_0x31bf3e>0x0){if(_0x33d6b4[_0x7cea('0x57')]===_0x7cea('0x6')){_0x31bf3e=0x1;}if(_0x31bf3e>this[_0x7cea('0x25')]){_0x31bf3e=this[_0x7cea('0x25')];}_0x33d6b4[_0x7cea('0x1fb')]+=_0x31bf3e;for(var _0x1717a6 in this[_0x7cea('0x23')]){if(this[_0x7cea('0x23')]['hasOwnProperty'](_0x1717a6)){if(this[_0x7cea('0x23')][_0x1717a6][_0x7cea('0xa6')]===_0x7cea('0x206')&&this['agents'][_0x1717a6][_0x7cea('0xaf')]===_0x7cea('0xdb')){_0x113e85[_0x7cea('0x11e')](this[_0x7cea('0x23')][_0x1717a6]['id']);}}}this[_0x7cea('0xc5')](_0x33d6b4['id'],_0x113e85,_0x31bf3e,_0x33d6b4[_0x7cea('0x1fc')])[_0x7cea('0xb9')](function(_0x222536){_0x33d6b4[_0x7cea('0x1fb')]-=_0x31bf3e;_0x33d6b4[_0x7cea('0x1fb')]=_0x33d6b4[_0x7cea('0x1fb')]>0x0?_0x33d6b4[_0x7cea('0x1fb')]:0x0;if(!checkContactEmpty(_0x222536)){_0x2060db[_0x7cea('0xb7')](_0x33d6b4)['then'](sendMessageReschedule(_0x33d6b4))[_0x7cea('0xb1')](loggerCatch(_0x7cea('0xba')));}else{_0x33d6b4[_0x7cea('0x98')]+=_0x222536[_0x7cea('0x96')];_0x33d6b4[_0x7cea('0x3e')]=_0x33d6b4['dialMethod']===_0x7cea('0x6')?_0x7cea('0x166'):'RUNNING';for(var _0x4aafe8=0x0;_0x4aafe8<_0x222536[_0x7cea('0x96')];_0x4aafe8+=0x1){if(_[_0x7cea('0xad')](_0x222536[_0x4aafe8])||_[_0x7cea('0xad')](_0x222536[_0x4aafe8][_0x7cea('0x15d')])||_['isNil'](_0x222536[_0x4aafe8][_0x7cea('0x15d')]['phone'])){_0x2060db[_0x7cea('0xcf')](_0x7cea('0x200'),_0x33d6b4,_0x222536[_0x4aafe8]);}else{_0x2060db[_0x7cea('0xbb')](_['pick'](_0x222536[_0x4aafe8],[_0x7cea('0x10f'),_0x7cea('0x201')]))['then'](_0x2060db[_0x7cea('0x1e2')](_0x33d6b4,_0x222536[_0x4aafe8]))[_0x7cea('0xb1')](_0x2060db['loggerHandler'](_0x7cea('0x200'),_0x33d6b4));}}}})[_0x7cea('0xb1')](loggerGetContactDialer(_0x7cea('0x207'),_0x33d6b4,_0x31bf3e));}};Dialer[_0x7cea('0x1d')]['handlePredictive']=function(_0x50381d){var _0x452f64=this;if(_0x50381d[_0x7cea('0x204')]>0x0){var _0x2fb20c=_0x50381d[_0x7cea('0x204')]-_0x50381d['originated']-_0x50381d['talking'];if(_0x2fb20c>0x0){this['tryOriginatePredictive'](_0x50381d);}else{loggerPredictiveCalls[_0x7cea('0x78')](_0x7cea('0x208'));}}else{this[_0x7cea('0x209')](_0x50381d);}};Dialer['prototype'][_0x7cea('0x209')]=function(_0x418da8){var _0x4b3ae4=this;var _0x12f7ba=[];_0x418da8[_0x7cea('0x98')]+=0x1;for(var _0x1e80be in this['agents']){if(this['agents'][_0x7cea('0x97')](_0x1e80be)){if(this[_0x7cea('0x23')][_0x1e80be][_0x7cea('0xa6')]==='not_inuse'&&this[_0x7cea('0x23')][_0x1e80be][_0x7cea('0xaf')]==='reachable'){_0x12f7ba[_0x7cea('0x11e')](this[_0x7cea('0x23')][_0x1e80be]['id']);}}}this['getContactDialer'](_0x418da8['id'],_0x12f7ba,0x1,_0x418da8[_0x7cea('0x1fc')])[_0x7cea('0xb9')](function(_0x2b09f2){if(!checkContactEmpty(_0x2b09f2)){checkContactLowerLimitOriginate(_0x418da8,0x1,0x0);_0x4b3ae4[_0x7cea('0xb7')](_0x418da8)['then'](sendMessageReschedule(_0x418da8))[_0x7cea('0xb1')](loggerCatch(_0x7cea('0xba')));}else{_0x418da8[_0x7cea('0x3e')]=_0x7cea('0x1fe');if(_[_0x7cea('0xad')](_0x2b09f2[0x0])||_[_0x7cea('0xad')](_0x2b09f2[0x0][_0x7cea('0x15d')])||_[_0x7cea('0xad')](_0x2b09f2[0x0][_0x7cea('0x15d')][_0x7cea('0x15e')])){_0x4b3ae4[_0x7cea('0xcf')]('[actionOriginate]\x20',_0x418da8,_0x2b09f2[0x0]);}else{_0x4b3ae4[_0x7cea('0xbb')](_[_0x7cea('0xd2')](_0x2b09f2[0x0],[_0x7cea('0x10f'),_0x7cea('0x201')]))[_0x7cea('0xb9')](_0x4b3ae4[_0x7cea('0x1e2')](_0x418da8,_0x2b09f2[0x0]))[_0x7cea('0xb1')](_0x4b3ae4[_0x7cea('0xce')](_0x7cea('0x20a'),_0x418da8));}}})[_0x7cea('0xb1')](loggerGetContactDialer(_0x7cea('0x20b'),_0x418da8,0x1));emitVoiceQueueSummary(_0x418da8);};Dialer[_0x7cea('0x1d')]['abandonmentRate']=function(_0x1853a6,_0x4bbb61,_0x16b1ae,_0x41a5eb,_0x1bc9d8,_0x3ecb4f){loggerPredictive['info'](_0x7cea('0x20c'));loggerPredictive[_0x7cea('0x78')](_0x7cea('0x20d'),_0x1853a6);loggerPredictive['info'](_0x7cea('0x20e'),_0x4bbb61);loggerPredictive['info'](_0x7cea('0x20f'),_0x16b1ae);loggerPredictive[_0x7cea('0x78')](_0x7cea('0x210'),_0x41a5eb);loggerPredictive['info'](_0x7cea('0x211'),_0x1bc9d8);loggerPredictive[_0x7cea('0x78')]('---------------------------');return new BPromise(function(_0x4a81a9,_0x58f78a){if(_0x1853a6<=0x0||isNaN(_0x1853a6)){return _0x58f78a(msgResponse(_0x7cea('0x212'),_0x7cea('0x46'),'m\x20=\x20'+_0x1853a6));}if(_0x16b1ae<=0x0||isNaN(_0x16b1ae)){return _0x58f78a(msgResponse('[abandonmentRate]',_0x7cea('0x46'),'Ts\x20=\x20'+_0x16b1ae));}if(_0x41a5eb<=0x0||isNaN(_0x41a5eb)){return _0x58f78a(msgResponse(_0x7cea('0x212'),_0x7cea('0x46'),_0x7cea('0x213')+_0x41a5eb));}if(_0x4bbb61<=0x0||isNaN(_0x4bbb61)){return _0x58f78a(msgResponse(_0x7cea('0x212'),_0x7cea('0x46'),_0x7cea('0x214')+_0x4bbb61));}if(_0x1bc9d8<=0x0||isNaN(_0x1bc9d8)){return _0x58f78a(msgResponse(_0x7cea('0x212'),_0x7cea('0x46'),_0x7cea('0x215')+_0x1bc9d8));}_0x3ecb4f=_0x3ecb4f||0x0;var _0x523830=0x1/_0x16b1ae;var _0x3f5381=0x0;var _0x206e6f=0x0;var _0x32bd31=0x0;var _0x45c771=0x0;for(var _0x845e1=0x0;_0x32bd31<_0x1bc9d8;_0x845e1+=0x1){_0x206e6f=_0x845e1/_0x4bbb61;_0x3f5381=(_0x41a5eb*_0x206e6f+_0x3ecb4f)/_0x523830;_0x32bd31=erlangb(_0x3f5381,_0x1853a6);_0x45c771=_0x3f5381/_0x1853a6*(0x1-erlangb(_0x3f5381,_0x1853a6));}return _0x4a81a9({'erlangCalls':_0x845e1,'erlangCallToSecond':_0x4bbb61/_0x845e1,'erlangAbandonmentRate':_0x32bd31,'erlangBusyFactor':_0x45c771});});};Dialer['prototype'][_0x7cea('0x1df')]=function(_0x1e2400,_0x570b48,_0x355fba,_0x16bf55,_0x1ecb6c,_0x21030c){loggerPredictive[_0x7cea('0x78')](_0x7cea('0x216'));loggerPredictive[_0x7cea('0x78')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e2400);loggerPredictive[_0x7cea('0x78')](_0x7cea('0x20e'),_0x570b48);loggerPredictive[_0x7cea('0x78')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x355fba);loggerPredictive[_0x7cea('0x78')](_0x7cea('0x210'),_0x16bf55);loggerPredictive[_0x7cea('0x78')](_0x7cea('0x217'),_0x1ecb6c);loggerPredictive[_0x7cea('0x78')](_0x7cea('0x80'));return new BPromise(function(_0x19749c,_0x40c41a){if(_0x1e2400<=0x0||isNaN(_0x1e2400)){return _0x40c41a(msgResponse(_0x7cea('0x218'),_0x7cea('0x46'),_0x7cea('0x219')+_0x1e2400));}if(_0x355fba<=0x0||isNaN(_0x355fba)){return _0x40c41a(msgResponse(_0x7cea('0x218'),_0x7cea('0x46'),_0x7cea('0x21a')+_0x355fba));}if(_0x16bf55<=0x0||isNaN(_0x16bf55)){return _0x40c41a(msgResponse(_0x7cea('0x218'),_0x7cea('0x46'),_0x7cea('0x213')+_0x16bf55));}if(_0x570b48<=0x0||isNaN(_0x570b48)){return _0x40c41a(msgResponse('[busyFactor]',_0x7cea('0x46'),'interval\x20=\x20'+_0x570b48));}if(_0x1ecb6c<=0x0||isNaN(_0x1ecb6c)){return _0x40c41a(msgResponse(_0x7cea('0x218'),_0x7cea('0x46'),_0x7cea('0x21b')+_0x1ecb6c));}_0x21030c=_0x21030c||0x0;var _0x235932=0x1/_0x355fba;var _0x4be693=0x0;var _0xf1b70d=0x0;var _0x4c3a3c=0x0;var _0x115453=0x0;for(var _0x32a2f2=0x0;_0x115453<_0x1ecb6c;_0x32a2f2+=0x1){_0xf1b70d=_0x32a2f2/_0x570b48;_0x4be693=(_0x16bf55*_0xf1b70d+_0x21030c)/_0x235932;_0x4c3a3c=erlangb(_0x4be693,_0x1e2400);_0x115453=_0x4be693/_0x1e2400*(0x1-erlangb(_0x4be693,_0x1e2400));}return _0x19749c({'erlangCalls':_0x32a2f2,'erlangCallToSecond':_0x570b48/_0x32a2f2,'erlangAbandonmentRate':_0x4c3a3c,'erlangBusyFactor':_0x115453});});};module[_0x7cea('0x21c')]=Dialer; \ No newline at end of file +var _0xe739=['dialAbandonedRetryFrequency','CampaignId','[rescheduleContact][Abandoned]','actionid','paused','stateinterface','locked','queueBooked','push','pick','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[unlock][syncQueueStatusComplete]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','timezones','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','content','indexOf','command','all','GLOBAL_INTERVAL_IS_OVERTIME','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','launchHandleIvr','dialActive','dialTimezone','checkDialMethod','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','object','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','getCaller','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originate','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','from-sip','dialOriginateTimeout','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','response','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','NoSuchNumber','countglobal','[syncAgentComplete][createHistory][0]','stateGlobal','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','reason\x205\x20busy','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','outboundDropCallsDayTimeout','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','predictiveIntervalAnsweredCalls','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','handleIvr','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','length','RUNNING','ivrTotalCallsDays','Contact.phone','dialLimitQueue','ACTIVE','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','util','bluebird','uuid','moment','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','ivrOriginated','queueBookedRR','syncAgentConnect','bind','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','newexten','syncNewExten','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','hasOwnProperty','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','is\x20disactive','state','statedesc','endtime','starttime','prototype','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','campaigns','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','merge','ContactId','ListId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','reachable','SIP/%s','unmonitored','saveInDb','uniqueid','variable','amdstatus','exten','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','[syncHangupInAMD][createHistory]','MACHINE','Machine','AMD','amd','[syncMachine][createHistory]','[syncMachine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncMachineIvr][createHistory]','[syncMachineIvr]','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','syncAgentComplete','agiafterat','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','add','dialDropRetryFrequency','minutes','[rescheduleContact][Drop]','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0xe739,0x105));var _0x9e73=function(_0x189dd8,_0x3d442a){_0x189dd8=_0x189dd8-0x0;var _0x5070e5=_0xe739[_0x189dd8];return _0x5070e5;};'use strict';var util=require(_0x9e73('0x0'));var _=require('lodash');var BPromise=require(_0x9e73('0x1'));var uuid=require(_0x9e73('0x2'));var moment=require(_0x9e73('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment/');var logger=require(_0x9e73('0x4'))(_0x9e73('0x5'));var loggerBooked=require(_0x9e73('0x4'))(_0x9e73('0x6'));var loggerPredictive=require('../../../config/logger')(_0x9e73('0x7'));var loggerPredictiveCalls=require(_0x9e73('0x4'))(_0x9e73('0x8'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x9e73('0x9'));var ami=require(_0x9e73('0xa'));config[_0x9e73('0xb')]=_[_0x9e73('0xc')](config[_0x9e73('0xb')],{'host':_0x9e73('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9e73('0xb')]));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x9e73('0xe'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x9e73('0xf'));var Action=require(_0x9e73('0x10'));var History=require(_0x9e73('0x11'));var Final=require('./final');var AgentComplete=require(_0x9e73('0x12'));var QueueCallerAbandon=require(_0x9e73('0x13'));var Hangup=require(_0x9e73('0x14'));var ipAgi=process[_0x9e73('0x15')]['XCALLY_IP_AGI']||_0x9e73('0x16');var strategy={'rrmemory':_0x9e73('0x17'),'roundrobin':_0x9e73('0x18')};var Sequence=function(){};Sequence['prototype'][_0x9e73('0x19')]=function(_0x378603){this['tail']=this[_0x9e73('0x1a')]?this[_0x9e73('0x1a')][_0x9e73('0x1b')](_0x378603):_0x378603();};function Dialer(_0x5633e1,_0x16b2a9){this['sequence']=new Sequence();this[_0x9e73('0x1c')]=_0x16b2a9;this['voiceQueues']=_0x5633e1[_0x9e73('0x1d')];this['campaigns']=_0x5633e1['campaigns'];this[_0x9e73('0x1e')]=_0x5633e1[_0x9e73('0x1e')];this[_0x9e73('0x1f')]=_0x5633e1[_0x9e73('0x1f')];this[_0x9e73('0x20')]=config[_0x9e73('0x20')]||0x2;this[_0x9e73('0x21')]={};this[_0x9e73('0x22')]={};this[_0x9e73('0x23')]={};this[_0x9e73('0x24')]={};this['optionPredictive']={};this[_0x9e73('0x25')]={};this['startProgressive']={};this[_0x9e73('0x26')]={};this['queueBooked']={};this[_0x9e73('0x27')]={};ami['on']('agentconnect',this[_0x9e73('0x28')][_0x9e73('0x29')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x9e73('0x29')](this));ami['on'](_0x9e73('0x2a'),this[_0x9e73('0x2b')][_0x9e73('0x29')](this));ami['on'](_0x9e73('0x2c'),this['syncAgentComplete'][_0x9e73('0x29')](this));ami['on'](_0x9e73('0x2d'),this['syncQueueSummary']['bind'](this));ami['on'](_0x9e73('0x2e'),this['syncHangup']['bind'](this));ami['on'](_0x9e73('0x2f'),this[_0x9e73('0x30')][_0x9e73('0x29')](this));ami['on']('varset',this[_0x9e73('0x31')][_0x9e73('0x29')](this));ami['on']('queuemember',this[_0x9e73('0x32')][_0x9e73('0x29')](this));ami['on'](_0x9e73('0x33'),this[_0x9e73('0x34')][_0x9e73('0x29')](this));this['loopCampaigns']();this[_0x9e73('0x35')]();}function isNotNull(_0x49ec6b){return _0x49ec6b!==null&&!_[_0x9e73('0x36')](_0x49ec6b);}function checkIsLoggedIn(_0x1ba338,_0xb3ef4f){return function(){if(_0xb3ef4f<=0x0){_0x1ba338[_0x9e73('0x37')]=_0x9e73('0x38');throw _0x1ba338['name']+_0x9e73('0x39');}};}function isActive(_0x2a633a){return _0x2a633a;}function checkIsActive(_0x536ff7,_0x4e5ab0){return function(){if(!isActive(_0x4e5ab0)){_0x536ff7[_0x9e73('0x37')]=_0x9e73('0x3a');throw _0x536ff7[_0x9e73('0x3b')]+_0x9e73('0x3c');}};}function checkInterval(_0x38ec16){return function(){if(!isNotNull(_0x38ec16[_0x9e73('0x3d')])){_0x38ec16['message']=_0x9e73('0x3e');throw _0x38ec16[_0x9e73('0x3b')]+_0x9e73('0x3f');}if(!isNotNull(_0x38ec16[_0x9e73('0x3d')][_0x9e73('0x40')])){_0x38ec16[_0x9e73('0x37')]=_0x9e73('0x3e');throw _0x38ec16[_0x9e73('0x3b')]+_0x9e73('0x3f');}if(!isNotNull(_[_0x9e73('0x41')](_0x38ec16['Interval'][_0x9e73('0x40')]))){_0x38ec16[_0x9e73('0x37')]=_0x9e73('0x3e');throw _0x38ec16[_0x9e73('0x3b')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x3d2608,_0x3186b0,_0x4b15c8){return{'action':_0x3d2608,'response':_0x3186b0,'message':_0x4b15c8,'stack':_0x4b15c8};}function myreject(_0x4b581a){return function(_0x2abd9f){return _0x4b581a(msgResponse(_0x9e73('0x42'),_0x9e73('0x43'),JSON[_0x9e73('0x44')](_0x2abd9f)));};}function getSeconds(_0x14fb70,_0x430846){var _0x5e6ffe=moment(_0x14fb70)['milliseconds'](0x0);var _0x5723a5=moment(_0x430846)[_0x9e73('0x45')](0x0);return _0x5e6ffe[_0x9e73('0x46')](_0x5723a5,_0x9e73('0x47'));}function emit(_0x51f341,_0x5f08b0,_0x4b4e1b){io['to'](_0x51f341)[_0x9e73('0x48')](_0x5f08b0,_0x4b4e1b);}function emitVoiceQueueSummary(_0xb5bb10){if(_0xb5bb10[_0x9e73('0x49')]===_0x9e73('0x4a')){var _0x541171={'id':_0xb5bb10['id'],'name':_0xb5bb10[_0x9e73('0x3b')],'strategy':_0xb5bb10[_0x9e73('0x4b')],'answered':_0xb5bb10[_0x9e73('0x4c')],'available':_0xb5bb10[_0x9e73('0x4d')],'loggedIn':_0xb5bb10[_0x9e73('0x4e')],'pTalking':_0xb5bb10[_0x9e73('0x4f')],'sumBillable':_0xb5bb10[_0x9e73('0x50')],'sumDuration':_0xb5bb10[_0x9e73('0x51')],'sumHoldTime':_0xb5bb10[_0x9e73('0x52')]||0x0,'talking':_0xb5bb10[_0x9e73('0x53')],'total':_0xb5bb10['total'],'type':_0xb5bb10['type'],'unmanaged':_0xb5bb10['unmanaged'],'abandoned':_0xb5bb10['abandoned'],'waiting':_0xb5bb10[_0x9e73('0x54')],'loggedInDb':_0xb5bb10[_0x9e73('0x55')],'dialActive':_0xb5bb10['dialActive'],'dialMethod':_0xb5bb10[_0x9e73('0x56')],'dialOriginateCallerIdName':_0xb5bb10[_0x9e73('0x57')],'dialOriginateCallerIdNumber':_0xb5bb10['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0xb5bb10['dialOriginateTimeout'],'dialPrefix':_0xb5bb10['dialPrefix'],'outboundAnswerAgiCallsDay':_0xb5bb10['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0xb5bb10['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0xb5bb10[_0x9e73('0x58')],'outboundBusyCallsDay':_0xb5bb10[_0x9e73('0x59')],'outboundCongestionCallsDay':_0xb5bb10[_0x9e73('0x5a')],'outboundDropCallsDayACS':_0xb5bb10[_0x9e73('0x5b')],'outboundDropCallsDayCallersExit':_0xb5bb10['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0xb5bb10['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0xb5bb10[_0x9e73('0x5c')],'outboundNoSuchCallsDay':_0xb5bb10[_0x9e73('0x5d')],'outboundOriginateFailureCallsDay':_0xb5bb10[_0x9e73('0x5e')],'outboundReCallsDay':_0xb5bb10[_0x9e73('0x5f')],'outboundRejectCallsDay':_0xb5bb10[_0x9e73('0x60')],'outboundUnknownCallsDay':_0xb5bb10[_0x9e73('0x61')],'predictiveIntervalAnsweredCalls':_0xb5bb10['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xb5bb10[_0x9e73('0x62')],'predictiveIntervalAvgTalktime':_0xb5bb10[_0x9e73('0x63')],'predictiveIntervalDroppedCallsCallersExit':_0xb5bb10['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0xb5bb10[_0x9e73('0x64')],'predictiveIntervalErlangCalls':_0xb5bb10[_0x9e73('0x65')],'predictiveIntervalErlangCallsDroppedCalls':_0xb5bb10['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xb5bb10[_0x9e73('0x66')],'predictiveIntervalMultiplicativeFactor':_0xb5bb10[_0x9e73('0x67')],'predictiveIntervalPauses':_0xb5bb10['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xb5bb10[_0x9e73('0x68')],'predictiveIntervalTotalCalls':_0xb5bb10[_0x9e73('0x69')],'message':_0xb5bb10[_0x9e73('0x37')],'originated':_0xb5bb10[_0x9e73('0x6a')],'erlangCalls':_0xb5bb10[_0x9e73('0x6b')],'erlangCallToSecond':_0xb5bb10[_0x9e73('0x6c')],'erlangAbandonmentRate':_0xb5bb10[_0x9e73('0x6d')],'erlangBusyFactor':_0xb5bb10[_0x9e73('0x6e')],'startPredictive':_0xb5bb10[_0x9e73('0x25')],'startProgressive':_0xb5bb10[_0x9e73('0x6f')]};if(_0xb5bb10[_0x9e73('0x70')]){_0x541171[_0x9e73('0x70')]={'id':_0xb5bb10[_0x9e73('0x70')]['id'],'name':_0xb5bb10[_0x9e73('0x70')][_0x9e73('0x3b')],'active':_0xb5bb10[_0x9e73('0x70')]['active'],'callerid':_0xb5bb10[_0x9e73('0x70')]['callerid']};}if(_0xb5bb10['Interval']){_0x541171[_0x9e73('0x3d')]={'id':_0xb5bb10[_0x9e73('0x3d')]['id'],'name':_0xb5bb10['Interval']['name']};}var _0x308e86=md5(JSON[_0x9e73('0x44')](_0x541171));if(_0xb5bb10[_0x9e73('0x71')]!==_0x308e86){_0xb5bb10[_0x9e73('0x71')]=_0x308e86;emit(util[_0x9e73('0x72')](_0x9e73('0x73'),_0x541171[_0x9e73('0x3b')]),_0x9e73('0x74'),_0x541171);}}}function emitCampaignSummary(_0x25ec6d){if(_0x25ec6d[_0x9e73('0x49')]===_0x9e73('0x75')){emit(util[_0x9e73('0x72')](_0x9e73('0x76'),_0x25ec6d[_0x9e73('0x3b')]),'campaign:save',_0x25ec6d);}}function checkGetDataPredictive(_0x7628d){if(isNotNull(_0x7628d)){if(!_[_0x9e73('0x41')](_0x7628d)){loggerPredictive[_0x9e73('0x77')](_0x9e73('0x78'));loggerPredictive[_0x9e73('0x77')](_0x9e73('0x79'),_0x7628d[_0x9e73('0x69')]);loggerPredictive[_0x9e73('0x77')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x7628d['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x9e73('0x7a'),_0x7628d['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x9e73('0x77')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x7628d[_0x9e73('0x7b')]);loggerPredictive['info'](_0x9e73('0x7c'),_0x7628d[_0x9e73('0x62')]);loggerPredictive[_0x9e73('0x77')](_0x9e73('0x7d'),_0x7628d[_0x9e73('0x63')]);loggerPredictive[_0x9e73('0x77')](_0x9e73('0x7e'));if(_0x7628d['predictiveIntervalTotalCalls']>0x0){if(!_[_0x9e73('0x36')](_0x7628d['predictiveIntervalAvgTalktime'])&&_0x7628d[_0x9e73('0x63')]>0x0){return!![];}else{loggerPredictive[_0x9e73('0x77')](_0x9e73('0x7f'));}if(!_['isUndefined'](_0x7628d[_0x9e73('0x62')])&&_0x7628d[_0x9e73('0x62')]>0x0){return!![];}else{loggerPredictive['info'](_0x9e73('0x80'));}}else{loggerPredictive[_0x9e73('0x77')](_0x9e73('0x81'));}}else{loggerPredictive[_0x9e73('0x77')](_0x9e73('0x82'));}}else{loggerPredictive['info'](_0x9e73('0x82'));}return![];}function mergeDataErlangB(_0x301493){return function(_0x5ed176){loggerPredictive[_0x9e73('0x77')](_0x9e73('0x83'));loggerPredictive[_0x9e73('0x77')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5ed176[_0x9e73('0x6b')]);loggerPredictive[_0x9e73('0x77')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5ed176[_0x9e73('0x6c')]);loggerPredictive[_0x9e73('0x77')](_0x9e73('0x84'),_0x5ed176[_0x9e73('0x6d')]);loggerPredictive[_0x9e73('0x77')](_0x9e73('0x85'),_0x5ed176[_0x9e73('0x6e')]);loggerPredictive[_0x9e73('0x77')](_0x9e73('0x84'),_0x5ed176[_0x9e73('0x6d')]);loggerPredictive[_0x9e73('0x77')](_0x9e73('0x7e'));_['merge'](_0x301493,_0x5ed176);};}function getDiff(_0x16d781){var _0x388637=moment()[_0x9e73('0x45')](0x0);var _0x4c6504=moment(_0x16d781)['milliseconds'](0x0);return _0x388637[_0x9e73('0x46')](_0x4c6504,_0x9e73('0x47'));}function ifInterval(_0x2373d2,_0x158b54){if(_[_0x9e73('0x36')](_0x158b54)){return![];}if(getDiff(_0x158b54)<_0x2373d2*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x3f552a){if(isNotNull(_0x3f552a)){if(!_[_0x9e73('0x36')](_0x3f552a[_0x9e73('0x6f')])){_0x3f552a[_0x9e73('0x6f')]=undefined;loggerPredictive[_0x9e73('0x77')](_0x3f552a[_0x9e73('0x3b')],_0x9e73('0x86'));}if(!_['isUndefined'](_0x3f552a[_0x9e73('0x25')])){_0x3f552a[_0x9e73('0x25')]=undefined;loggerPredictive[_0x9e73('0x77')](_0x3f552a[_0x9e73('0x3b')],_0x9e73('0x87'));}if(!_[_0x9e73('0x36')](_0x3f552a[_0x9e73('0x88')])){clearInterval(_0x3f552a[_0x9e73('0x88')]);_0x3f552a['handlePredictive']=undefined;loggerPredictive['info'](_0x3f552a[_0x9e73('0x3b')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x598657,_0x286f5e){if(_0x286f5e===0x0){return 0x0;}var _0x5b8a3e=0x1;for(var _0x337ffc=0x1;_0x337ffc<=_0x286f5e;_0x337ffc+=0x1){_0x5b8a3e=0x1+_0x5b8a3e*_0x337ffc/_0x598657;}return 0x1/_0x5b8a3e;}function isVoiceQueueOutbound(_0x40e34e){return _0x40e34e===_0x9e73('0x4a');}function isNotPreview(_0xbb2b40){return _0xbb2b40!==_0x9e73('0x1c');}function isCampaignIvr(_0x49e508){return _0x49e508==='ivr';}function getCallerId(_0x263340,_0x28e6e2,_0xa5a487){if(!_[_0x9e73('0x36')](_0xa5a487)&&_0x9e73('0x89')===typeof _0xa5a487&&!_[_0x9e73('0x41')](_0xa5a487)){if(!_[_0x9e73('0x36')](_0x28e6e2)&&_0x9e73('0x89')===typeof _0x28e6e2&&!_[_0x9e73('0x41')](_0x28e6e2)){return util[_0x9e73('0x72')](_0x9e73('0x8a'),_0x28e6e2,_0xa5a487);}return util[_0x9e73('0x72')]('\x22%s\x22\x20<%s>',_0xa5a487,_0xa5a487);}if(!_[_0x9e73('0x36')](_0x263340)&&_0x9e73('0x89')===typeof _0x263340&&!_[_0x9e73('0x41')](_0x263340)){return _0x263340;}return _0x9e73('0x8b');}function loggerCatchQueueSummary(_0xc330a3,_0x39a5ae){return function(_0x256487){freeVariablesPredictive(_0x39a5ae);emitVoiceQueueSummary(_0x39a5ae);emitCampaignSummary(_0x39a5ae);loggerSyncQueueSummary[_0x9e73('0x8c')](_0xc330a3,util[_0x9e73('0x8d')](_0x256487,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x333238,_0x192625){return function(_0xdef4ea){loggerPredictive[_0x9e73('0x8c')](_0x192625[_0x9e73('0x3b')],_0x333238);loggerPredictive[_0x9e73('0x8c')](_0xdef4ea[_0x9e73('0x8e')]);freeVariablesPredictive(_0x192625);};}function loggerCatch(_0x4d8fd6){return function(_0x32eedc){logger[_0x9e73('0x8c')](_0x4d8fd6,util[_0x9e73('0x8d')](_0x32eedc,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xdae83d){return _0xdae83d&&!_[_0x9e73('0x36')](_0xdae83d)&&_0xdae83d['length']>0x0;}function decremetOriginate(_0x23868a){if(!_['isUndefined'](_0x23868a)&&_0x23868a!==null){if(_0x23868a[_0x9e73('0x8f')]('originated')){if(_0x23868a['originated']>0x0){_0x23868a[_0x9e73('0x6a')]-=0x1;}else{logger[_0x9e73('0x8c')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x9e73('0x8c')](_0x9e73('0x90'));}}function checkContactLowerLimitOriginate(_0x2aab80,_0x323754,_0x1675da){if(_0x323754>_0x1675da){for(var _0x386926=0x0;_0x386926<_0x323754-_0x1675da;_0x386926+=0x1){decremetOriginate(_0x2aab80);}}}function loggerGetContactDialer(_0x5b63d7,_0x56335d,_0x6060a6){return function(_0x5d0dd7){checkContactLowerLimitOriginate(_0x56335d,_0x6060a6,0x0);logger[_0x9e73('0x8c')](_0x5b63d7,util[_0x9e73('0x8d')](_0x5d0dd7,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x242ca4){return function(_0xf24e8c){if(isNotNull(_0xf24e8c)&&isNotNull(_0xf24e8c[0x0])){if(_0xf24e8c[0x0]['contactsRescheduled']>0x0){_0x242ca4['message']=_0x9e73('0x91');logger[_0x9e73('0x77')]('[getContactDialer2][ReScheduled]'+_0x242ca4['name'],_0xf24e8c[0x0][_0x9e73('0x92')],_0x9e73('0x93'));}else{_0x242ca4[_0x9e73('0x37')]=_0x9e73('0x94');logger[_0x9e73('0x77')](_0x9e73('0x95')+_0x242ca4[_0x9e73('0x3b')]);}}};}function notSendMessagesQueue(_0xc8c864){if(_0xc8c864[_0x9e73('0x96')]){freeVariablesPredictive(_0xc8c864);if(_0xc8c864[_0x9e73('0x6a')]===0x0&&_0xc8c864[_0x9e73('0x53')]===0x0&&_0xc8c864['waiting']===0x0&&(_0xc8c864[_0x9e73('0x4f')]||0x0)===0x0){_0xc8c864[_0x9e73('0x96')]=![];_0xc8c864[_0x9e73('0x4d')]=0x0;_0xc8c864[_0x9e73('0x37')]=_0x9e73('0x3a');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0xc8c864['name'],_0x9e73('0x97'));}else{_0xc8c864[_0x9e73('0x37')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x9e73('0x8c')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0xc8c864[_0x9e73('0x3b')],'is\x20disactive');}emitVoiceQueueSummary(_0xc8c864);}}function notSendMessagesCampaign(_0x4fac8f){if(_0x4fac8f[_0x9e73('0x96')]){if(_0x4fac8f['originated']===0x0){_0x4fac8f['sendMessageOneNotActive']=![];_0x4fac8f['message']=_0x9e73('0x3a');loggerSyncQueueSummary[_0x9e73('0x8c')](_0x9e73('0x98'),_0x4fac8f[_0x9e73('0x3b')],_0x9e73('0x97'));}else{_0x4fac8f[_0x9e73('0x37')]=_0x9e73('0x99');loggerSyncQueueSummary[_0x9e73('0x8c')](_0x9e73('0x98'),_0x4fac8f[_0x9e73('0x3b')],_0x9e73('0x9a'));}emitCampaignSummary(_0x4fac8f);}}function createObjHistory(_0x262d68,_0x2f54ef,_0x5d00b8,_0x383c9b,_0x4da984){_0x262d68[_0x9e73('0x37')]=_0x5d00b8;var _0x2fac60=new Action(_0x262d68,_0x2f54ef);var _0x270cb2=new History(_0x2fac60);_0x270cb2[_0x9e73('0x9b')]=_0x383c9b;_0x270cb2[_0x9e73('0x9c')]=_0x4da984;_0x270cb2[_0x9e73('0x9d')]=_0x2fac60[_0x9e73('0x9e')];return _0x270cb2;}Dialer[_0x9e73('0x9f')][_0x9e73('0x35')]=function(){var _0xa9818=this;setInterval(function(){_0xa9818[_0x9e73('0xa0')](_0xa9818[_0x9e73('0x24')],_0x9e73('0xa1'));_0xa9818[_0x9e73('0xa0')](_0xa9818[_0x9e73('0x22')],_0x9e73('0xa2'));},0x32c8);};Dialer['prototype'][_0x9e73('0xa0')]=function(_0x2bd27d,_0x5c04df){var _0x3d9176=this;for(var _0x441845 in _0x2bd27d){if(_0x2bd27d[_0x9e73('0x8f')](_0x441845)){this['sequence'][_0x9e73('0x19')](function(){if(!_[_0x9e73('0xa3')](_0x2bd27d[_0x441845])){return ami[_0x9e73('0xa4')]({'action':_0x9e73('0xa5'),'channel':_0x2bd27d[_0x441845][_0x9e73('0xa6')]})[_0x9e73('0xa7')](function(_0x5a85d0){if(_0x5a85d0[_0x9e73('0x37')]===_0x9e73('0xa8')){setTimeout(function(){if(_0x2bd27d[_0x441845]&&_0x2bd27d[_0x441845][_0x9e73('0x49')]!==_0x9e73('0x75')){_0x3d9176[_0x9e73('0xa9')](_0x3d9176[_0x9e73('0x1d')][_0x2bd27d[_0x441845][_0x9e73('0xaa')]]);logger[_0x9e73('0x8c')]('[Dialer][checkChannel]',_0x5c04df,_0x441845,_0x2bd27d[_0x441845]['queue']);delete _0x2bd27d[_0x441845];}if(_0x2bd27d[_0x441845]&&_0x2bd27d[_0x441845]['type']===_0x9e73('0x75')){_0x3d9176[_0x9e73('0xa9')](_0x3d9176[_0x9e73('0xab')][_0x2bd27d[_0x441845][_0x9e73('0xaa')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x5c04df,_0x441845,_0x2bd27d[_0x441845][_0x9e73('0xaa')]);delete _0x2bd27d[_0x441845];}},0x2328);}});}});}}};Dialer[_0x9e73('0x9f')][_0x9e73('0xac')]=function(_0x5e70c5){return BPromise[_0x9e73('0xad')]()[_0x9e73('0xae')](cmHopper[_0x9e73('0xac')](_0x5e70c5))[_0x9e73('0xa7')](loggerCatch(_0x9e73('0xaf')));};Dialer['prototype'][_0x9e73('0xb0')]=function(_0x4662ab){return BPromise['resolve']()['then'](cmHopperBlack[_0x9e73('0xb0')](_0x4662ab))[_0x9e73('0xa7')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x9e73('0x9f')][_0x9e73('0xb1')]=function(_0x11f5da){return BPromise['resolve']()['then'](cmHopperBlack['checkIsBlackListIvr'](_0x11f5da))[_0x9e73('0xa7')](loggerCatch(_0x9e73('0xb2')));};Dialer['prototype'][_0x9e73('0xb3')]=function(_0x5e5b25){return BPromise[_0x9e73('0xad')]()[_0x9e73('0xae')](cmHopperHistory['avgHandleTime'](_0x5e5b25))[_0x9e73('0xa7')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x9e73('0x9f')][_0x9e73('0xb4')]=function(_0x191a98){return BPromise[_0x9e73('0xad')]()['then'](cmHopper['rescheduleContact'](_0x191a98))[_0x9e73('0xa7')](loggerCatch(_0x9e73('0xb5')));};Dialer[_0x9e73('0x9f')][_0x9e73('0xb6')]=function(_0x4e3e53,_0x52cec2,_0x4b948e){return BPromise[_0x9e73('0xad')]()[_0x9e73('0xae')](cmHopper[_0x9e73('0xb6')](_0x4e3e53,_0x52cec2,_0x4b948e))['catch'](loggerCatch(_0x9e73('0xb7')));};Dialer[_0x9e73('0x9f')][_0x9e73('0xb8')]=function(_0x36ea34,_0x1aee7f,_0x5a6ad6,_0x384709){return BPromise[_0x9e73('0xad')]()['then'](cmHopper[_0x9e73('0xb8')](_0x36ea34,_0x1aee7f,_0x5a6ad6,_0x384709))[_0x9e73('0xa7')](loggerCatch(_0x9e73('0xb9')));};Dialer[_0x9e73('0x9f')][_0x9e73('0xba')]=function(_0x2b5301,_0x5d318c,_0x2e5017){return BPromise[_0x9e73('0xad')]()[_0x9e73('0xae')](cmHopper[_0x9e73('0xba')](_0x2b5301,_0x5d318c,_0x2e5017))[_0x9e73('0xa7')](loggerCatch(_0x9e73('0xb9')));};Dialer[_0x9e73('0x9f')]['getVoiceQueueRtPauses']=function(_0x16bbb8){return BPromise[_0x9e73('0xad')]()['then'](voiceQueueRt[_0x9e73('0xbb')](_0x16bbb8))[_0x9e73('0xa7')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x9e73('0x9f')][_0x9e73('0xbc')]=function(_0x4a5176){return BPromise[_0x9e73('0xad')]()['then'](cmHopper[_0x9e73('0xbc')](_0x4a5176))[_0x9e73('0xa7')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x9e73('0x9f')][_0x9e73('0xbd')]=function(_0x3517d5){return BPromise[_0x9e73('0xad')]()[_0x9e73('0xae')](cmHopperHistory[_0x9e73('0xbd')](_0x3517d5))[_0x9e73('0xa7')](loggerCatch('[createHistory]\x20'));};Dialer[_0x9e73('0x9f')]['updateOriginated']=function(_0x53ebfe){if(!_[_0x9e73('0x36')](_0x53ebfe)&&_0x53ebfe!==null){if(_0x53ebfe[_0x9e73('0x8f')](_0x9e73('0x6a'))){if(_0x53ebfe[_0x9e73('0x6a')]>0x0){_0x53ebfe[_0x9e73('0x6a')]-=0x1;}else{logger[_0x9e73('0x8c')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x9e73('0x8c')](_0x9e73('0xbe'));}};Dialer[_0x9e73('0x9f')][_0x9e73('0xbf')]=function(_0xd59877,_0x1527c2){var _0x3312c1=this;return function(_0x452bb0){_0x3312c1['updateOriginated'](_0x1527c2);logger[_0x9e73('0x8c')](_0xd59877,util['inspect'](_0x452bb0,{'showHidden':![],'depth':null}));};};Dialer[_0x9e73('0x9f')][_0x9e73('0xc0')]=function(_0x3befe1,_0x527481,_0x4737a6){var _0x138968={'state':0x19,'statedesc':'notFound'};this[_0x9e73('0xa9')](_0x527481);this['saveInDb'](_[_0x9e73('0xc1')](_0x138968,_['pick'](_0x4737a6,[_0x9e73('0xc2'),_0x9e73('0xc3'),'UserId',_0x9e73('0xc4'),'CampaignId'])),_0x9e73('0xc5'),_0x9e73('0xc6'));logger['error'](_0x3befe1);};Dialer[_0x9e73('0x9f')][_0x9e73('0xc7')]=function(_0x44e8a9){return _0x44e8a9===_0x9e73('0xc8');};Dialer[_0x9e73('0x9f')][_0x9e73('0xc9')]=function(_0x14b8e0){return!_[_0x9e73('0x36')](_0x14b8e0)&&_0x14b8e0&&!_['isUndefined'](_0x14b8e0['name'])&&!_[_0x9e73('0x36')](_0x14b8e0['active'])&&_0x14b8e0[_0x9e73('0xca')]&&(this[_0x9e73('0x1f')][util['format']('SIP/%s',_0x14b8e0[_0x9e73('0x3b')])]['status']===_0x9e73('0xcb')||this[_0x9e73('0x1f')][util[_0x9e73('0x72')](_0x9e73('0xcc'),_0x14b8e0[_0x9e73('0x3b')])][_0x9e73('0xa5')]===_0x9e73('0xcd'));};Dialer[_0x9e73('0x9f')][_0x9e73('0xce')]=function(_0x2203c4,_0x119f3e,_0x1e444e){this['createHistory'](_0x2203c4)[_0x9e73('0xa7')](loggerCatch(_0x119f3e));this[_0x9e73('0xbc')](_0x2203c4)[_0x9e73('0xa7')](loggerCatch(_0x1e444e));};Dialer[_0x9e73('0x9f')]['syncVarSet']=function(_0x4f245b){var _0x4eee38=this['uniqueId'][_0x4f245b[_0x9e73('0xcf')]];var _0x3f979b;if(!_['isNil'](_0x4f245b)&&!_[_0x9e73('0xa3')](_0x4f245b[_0x9e73('0xd0')])&&!_[_0x9e73('0xa3')](_0x4f245b[_0x9e73('0xd0')][_0x9e73('0xd1')])&&_0x4f245b[_0x9e73('0xd2')]==='xcally-motion-dialer'&&_0x4eee38){if(_0x4eee38[_0x9e73('0x49')]!==_0x9e73('0x75')&&this[_0x9e73('0x1d')][_0x4eee38[_0x9e73('0xaa')]][_0x9e73('0xd3')]&&_0x4f245b[_0x9e73('0xd4')]===_0x9e73('0xd5')){delete this[_0x9e73('0x24')][_0x4f245b[_0x9e73('0xcf')]];this[_0x9e73('0xa9')](this['voiceQueues'][_0x4eee38[_0x9e73('0xaa')]]);this[_0x9e73('0x1d')][_0x4eee38[_0x9e73('0xaa')]][_0x9e73('0xd6')]+=0x1;this[_0x9e73('0x1d')][_0x4eee38['queue']][_0x9e73('0xd7')]+=0x1;_0x3f979b=new Hangup(_0x4eee38,_0x4f245b);_0x3f979b[_0x9e73('0x9b')]=0x12;_0x3f979b['statedesc']=_0x9e73('0xd8');_0x3f979b[_0x9e73('0xd9')]='AMD';this[_0x9e73('0xce')](_0x3f979b,_0x9e73('0xda'),'[syncHangupInAMD]');}if(_0x4eee38['type']!=='ivr'&&this[_0x9e73('0x1d')][_0x4eee38[_0x9e73('0xaa')]]['dialAMDActive']&&_0x4f245b['value']===_0x9e73('0xdb')){delete this[_0x9e73('0x24')][_0x4f245b[_0x9e73('0xcf')]];this[_0x9e73('0xa9')](this[_0x9e73('0x1d')][_0x4eee38[_0x9e73('0xaa')]]);this[_0x9e73('0x1d')][_0x4eee38[_0x9e73('0xaa')]][_0x9e73('0xd6')]+=0x1;this[_0x9e73('0x1d')][_0x4eee38[_0x9e73('0xaa')]][_0x9e73('0xd7')]+=0x1;_0x3f979b=new Hangup(_0x4eee38,_0x4f245b);_0x3f979b['state']=0x13;_0x3f979b['statedesc']=_0x9e73('0xdc');_0x3f979b['membername']=_0x9e73('0xdd');_0x3f979b[_0x9e73('0xde')]=!![];this[_0x9e73('0xce')](_0x3f979b,_0x9e73('0xdf'),_0x9e73('0xe0'));}if(_0x4eee38[_0x9e73('0x49')]===_0x9e73('0x75')&&this[_0x9e73('0xab')][_0x4eee38[_0x9e73('0xaa')]][_0x9e73('0xd3')]&&_0x4f245b['value']===_0x9e73('0xd5')){delete this[_0x9e73('0x24')][_0x4f245b[_0x9e73('0xcf')]];this[_0x9e73('0xa9')](this[_0x9e73('0xab')][_0x4eee38['queue']]);_0x3f979b=new Hangup(_0x4eee38,_0x4f245b);_0x3f979b[_0x9e73('0x9b')]=0x12;_0x3f979b[_0x9e73('0x9c')]=_0x9e73('0xd8');_0x3f979b[_0x9e73('0xd9')]=_0x9e73('0xdd');this[_0x9e73('0xce')](_0x3f979b,_0x9e73('0xe1'),_0x9e73('0xe2'));}if(_0x4eee38['type']===_0x9e73('0x75')&&this['campaigns'][_0x4eee38[_0x9e73('0xaa')]]['dialAMDActive']&&_0x4f245b[_0x9e73('0xd4')]==='MACHINE'){delete this[_0x9e73('0x24')][_0x4f245b[_0x9e73('0xcf')]];this['updateOriginated'](this[_0x9e73('0xab')][_0x4eee38[_0x9e73('0xaa')]]);_0x3f979b=new Hangup(_0x4eee38,_0x4f245b);_0x3f979b[_0x9e73('0x9b')]=0x13;_0x3f979b['statedesc']='Machine';_0x3f979b[_0x9e73('0xd9')]=_0x9e73('0xdd');_0x3f979b[_0x9e73('0xde')]=!![];this['saveInDb'](_0x3f979b,_0x9e73('0xe3'),_0x9e73('0xe4'));}}};Dialer['prototype'][_0x9e73('0xe5')]=function(_0x1ce3ac){var _0x168dd3=this['uniqueId'][_0x1ce3ac[_0x9e73('0xcf')]];var _0x3b393b=this;var _0x1c99d7;if(_0x168dd3&&_0x168dd3[_0x9e73('0x49')]==='ivr'){delete this[_0x9e73('0x24')][_0x1ce3ac['uniqueid']];this[_0x9e73('0xa9')](this[_0x9e73('0xab')][_0x168dd3[_0x9e73('0xaa')]]);this[_0x9e73('0xab')][_0x168dd3[_0x9e73('0xaa')]][_0x9e73('0xe6')]+=0x1;_0x1c99d7=new Hangup(_0x168dd3,_0x1ce3ac);this[_0x9e73('0xbd')](_0x1c99d7)[_0x9e73('0xa7')](loggerCatch(_0x9e73('0xe7')));this[_0x9e73('0xbc')](_0x1c99d7)[_0x9e73('0xa7')](loggerCatch(_0x9e73('0xe8')));}if(_0x168dd3&&_0x168dd3[_0x9e73('0x49')]!=='ivr'&&isNotNull(this[_0x9e73('0x1d')][_0x168dd3['queue']][_0x9e73('0xe9')])){delete this[_0x9e73('0x24')][_0x1ce3ac[_0x9e73('0xcf')]];this['updateOriginated'](this['voiceQueues'][_0x168dd3['queue']]);this[_0x9e73('0x1d')][_0x168dd3[_0x9e73('0xaa')]][_0x9e73('0xd6')]+=0x1;this[_0x9e73('0x1d')][_0x168dd3[_0x9e73('0xaa')]][_0x9e73('0xd7')]+=0x1;_0x1c99d7=new Hangup(_0x168dd3,_0x1ce3ac);_0x1c99d7[_0x9e73('0x9b')]=0x10;_0x1c99d7[_0x9e73('0x9c')]=_0x9e73('0xea');_0x1c99d7['membername']=_0x9e73('0xeb');this[_0x9e73('0xbd')](_0x1c99d7)[_0x9e73('0xa7')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x9e73('0xbc')](_0x1c99d7)[_0x9e73('0xa7')](loggerCatch(_0x9e73('0xe8')));}if(_0x168dd3&&_0x168dd3[_0x9e73('0x49')]!=='ivr'&&!isNotNull(this[_0x9e73('0x1d')][_0x168dd3['queue']]['dialQueueProject'])){delete this[_0x9e73('0x24')][_0x1ce3ac[_0x9e73('0xcf')]];this[_0x9e73('0xa9')](this[_0x9e73('0x1d')][_0x168dd3[_0x9e73('0xaa')]]);this[_0x9e73('0x1d')][_0x168dd3[_0x9e73('0xaa')]][_0x9e73('0x61')]+=0x1;_0x1c99d7=new Hangup(_0x168dd3,_0x1ce3ac);_0x1c99d7[_0x9e73('0x9b')]=0xc;_0x1c99d7[_0x9e73('0x9c')]=_0x1ce3ac[_0x9e73('0xec')];_0x1c99d7[_0x9e73('0xd9')]='Unknow';this[_0x9e73('0xbd')](_0x1c99d7)[_0x9e73('0xa7')](loggerCatch(_0x9e73('0xe7')));this[_0x9e73('0xbc')](_0x1c99d7)[_0x9e73('0xa7')](loggerCatch(_0x9e73('0xe8')));}};Dialer[_0x9e73('0x9f')][_0x9e73('0xed')]=function(_0x550ce0){var _0x4cc95f=this[_0x9e73('0x24')][_0x550ce0[_0x9e73('0xcf')]];var _0x133877=this;if(this[_0x9e73('0x1d')][_0x550ce0['queue']]){if(_0x4cc95f&&_0x4cc95f['type']!==_0x9e73('0x75')){delete this['uniqueId'][_0x550ce0[_0x9e73('0xcf')]];this[_0x9e73('0x1d')][_0x550ce0['queue']]['outboundAnswerCallsDay']+=0x1;var _0x563925=new AgentComplete(_0x4cc95f,_0x550ce0);if(_0x550ce0['reason']==='agent'){_0x563925[_0x9e73('0xee')]=this[_0x9e73('0x1d')][_0x550ce0['queue']]['dialQueueProject2']&&this['voiceQueues'][_0x550ce0[_0x9e73('0xaa')]][_0x9e73('0xef')]?moment()['format'](_0x9e73('0xf0')):undefined;}this[_0x9e73('0xbd')](_0x563925)[_0x9e73('0xa7')](loggerCatch(_0x9e73('0xf1')));this[_0x9e73('0xbc')](_0x563925)[_0x9e73('0xa7')](loggerCatch(_0x9e73('0xf2')));}}};Dialer[_0x9e73('0x9f')][_0x9e73('0x28')]=function(_0x2b65ea){if(this[_0x9e73('0x1d')][_0x2b65ea[_0x9e73('0xaa')]]){if(this[_0x9e73('0x24')][_0x2b65ea[_0x9e73('0xcf')]]&&this[_0x9e73('0x24')][_0x2b65ea[_0x9e73('0xcf')]][_0x9e73('0x49')]!==_0x9e73('0x75')){this[_0x9e73('0xa9')](this[_0x9e73('0x1d')][_0x2b65ea['queue']]);this[_0x9e73('0x24')][_0x2b65ea[_0x9e73('0xcf')]][_0x9e73('0xf3')]=moment()[_0x9e73('0x72')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x30d2f1){this['createHistory'](_0x30d2f1)[_0x9e73('0xa7')](loggerCatch(_0x9e73('0xf1')));this[_0x9e73('0xbc')](_0x30d2f1)[_0x9e73('0xa7')](loggerCatch(_0x9e73('0xf4')));};Dialer[_0x9e73('0x9f')][_0x9e73('0xf5')]=function(_0x8508d9){var _0x5819f9=this[_0x9e73('0x24')][_0x8508d9[_0x9e73('0xcf')]];var _0x173c1f=this;if(this['voiceQueues'][_0x8508d9['queue']]){if(_0x5819f9&&_0x5819f9[_0x9e73('0x49')]!=='ivr'){delete this[_0x9e73('0x24')][_0x8508d9[_0x9e73('0xcf')]];this[_0x9e73('0xa9')](this[_0x9e73('0x1d')][_0x8508d9[_0x9e73('0xaa')]]);_0x5819f9[_0x9e73('0xf6')]=moment()[_0x9e73('0x72')](_0x9e73('0xf0'));var _0x58f4ed=new QueueCallerAbandon(_0x5819f9,_0x8508d9);if(getSeconds(_0x5819f9['droptime'],_0x5819f9[_0x9e73('0xf7')])>=_0x5819f9['dialQueueTimeout']){this[_0x9e73('0x1d')][_0x8508d9[_0x9e73('0xaa')]][_0x9e73('0x64')]+=0x1;this[_0x9e73('0x1d')][_0x8508d9['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0x9e73('0x1d')][_0x8508d9[_0x9e73('0xaa')]][_0x9e73('0xf8')]+=0x1;_0x58f4ed[_0x9e73('0x9b')]=0xa;_0x58f4ed['statedesc']=_0x9e73('0xf9');_0x58f4ed['dropreason']=_0x9e73('0xfa');_0x58f4ed[_0x9e73('0xee')]=this[_0x9e73('0x1d')][_0x8508d9['queue']]['dialQueueProject2']?moment()['format'](_0x9e73('0xf0')):undefined;_0x58f4ed['countdropretry']+=0x1;if(_0x58f4ed[_0x9e73('0xfb')]>=this[_0x9e73('0x1d')][_0x8508d9['queue']][_0x9e73('0xfc')]-0x1){this[_0x9e73('0xfd')](_0x58f4ed);}else{this[_0x9e73('0xb4')]({'active':![],'countdropretry':_0x58f4ed[_0x9e73('0xfb')],'scheduledat':moment()[_0x9e73('0xfe')](this[_0x9e73('0x1d')][_0x8508d9[_0x9e73('0xaa')]][_0x9e73('0xff')],_0x9e73('0x100'))['format'](_0x9e73('0xf0')),'ContactId':_0x5819f9[_0x9e73('0xc2')],'ListId':_0x5819f9[_0x9e73('0xc3')],'VoiceQueueId':_0x5819f9['VoiceQueueId']||undefined,'CampaignId':_0x5819f9['CampaignId']||undefined})[_0x9e73('0xa7')](loggerCatch(_0x9e73('0x101')));var _0x31bebe=new History(_0x58f4ed);_0x31bebe[_0x9e73('0x9b')]=0xa;_0x31bebe[_0x9e73('0x9c')]=_0x9e73('0xf9');_0x31bebe[_0x9e73('0x9e')]=moment()[_0x9e73('0x72')]('YYYY-MM-DD\x20HH:mm:ss');_0x31bebe['endtime']=_0x31bebe[_0x9e73('0x9e')];this[_0x9e73('0xbd')](_0x31bebe)[_0x9e73('0xa7')](loggerCatch(_0x9e73('0x102')));}}else{this['voiceQueues'][_0x8508d9['queue']][_0x9e73('0x7b')]+=0x1;this['voiceQueues'][_0x8508d9[_0x9e73('0xaa')]][_0x9e73('0x103')]+=0x1;_0x58f4ed[_0x9e73('0x9b')]=0xb;_0x58f4ed[_0x9e73('0x9c')]=_0x9e73('0x104');_0x58f4ed[_0x9e73('0x105')]=_0x9e73('0x106');_0x58f4ed[_0x9e73('0x107')]+=0x1;if(_0x58f4ed['countabandonedretry']>=this[_0x9e73('0x1d')][_0x8508d9[_0x9e73('0xaa')]][_0x9e73('0x108')]-0x1){this[_0x9e73('0xfd')](_0x58f4ed);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x58f4ed[_0x9e73('0x107')],'scheduledat':moment()['add'](this[_0x9e73('0x1d')][_0x8508d9['queue']][_0x9e73('0x109')],_0x9e73('0x100'))[_0x9e73('0x72')](_0x9e73('0xf0')),'ContactId':_0x5819f9[_0x9e73('0xc2')],'ListId':_0x5819f9[_0x9e73('0xc3')],'VoiceQueueId':_0x5819f9[_0x9e73('0xc4')]||undefined,'CampaignId':_0x5819f9[_0x9e73('0x10a')]||undefined})[_0x9e73('0xa7')](loggerCatch(_0x9e73('0x10b')));var _0x31bebe=new History(_0x58f4ed);_0x31bebe[_0x9e73('0x9b')]=0xb;_0x31bebe[_0x9e73('0x9c')]=_0x9e73('0x104');_0x31bebe[_0x9e73('0x9e')]=moment()['format'](_0x9e73('0xf0'));_0x31bebe[_0x9e73('0x9d')]=_0x31bebe[_0x9e73('0x9e')];this[_0x9e73('0xbd')](_0x31bebe)[_0x9e73('0xa7')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype']['syncNewExten']=function(_0x53178e){if(this[_0x9e73('0x22')][_0x53178e[_0x9e73('0xcf')]]){this[_0x9e73('0x22')][_0x53178e[_0x9e73('0xcf')]][_0x9e73('0xa6')]=_0x53178e[_0x9e73('0xa6')];}if(this[_0x9e73('0x24')][_0x53178e['uniqueid']]){this['uniqueId'][_0x53178e[_0x9e73('0xcf')]][_0x9e73('0xa6')]=_0x53178e[_0x9e73('0xa6')];}};Dialer[_0x9e73('0x9f')][_0x9e73('0x32')]=function(_0xc46cb4){if(strategy[this[_0x9e73('0x1d')][this[_0x9e73('0x22')][_0xc46cb4[_0x9e73('0x10c')]][_0x9e73('0xaa')]]['strategy']]===_0x9e73('0x18')){if(this[_0x9e73('0x22')][_0xc46cb4[_0x9e73('0x10c')]]&&_['isNil'](this['actions'][_0xc46cb4[_0x9e73('0x10c')]]['locked'])&&_0xc46cb4[_0x9e73('0xa5')]==='1'&&_0xc46cb4[_0x9e73('0x10d')]==='0'){if(this[_0x9e73('0x1e')][_0xc46cb4['stateinterface']]){if(!this[_0x9e73('0x1e')][_0xc46cb4[_0x9e73('0x10e')]][_0x9e73('0x10f')]){this['agents'][_0xc46cb4[_0x9e73('0x10e')]]['locked']=!![];this[_0x9e73('0x22')][_0xc46cb4[_0x9e73('0x10c')]][_0x9e73('0x10f')]=!![];this[_0x9e73('0x22')][_0xc46cb4[_0x9e73('0x10c')]][_0x9e73('0x10e')]=_0xc46cb4[_0x9e73('0x10e')];}}}}else if((strategy[this[_0x9e73('0x1d')][this[_0x9e73('0x22')][_0xc46cb4['actionid']][_0x9e73('0xaa')]][_0x9e73('0x4b')]]||'rrmemory')===_0x9e73('0x17')){if(this[_0x9e73('0x22')][_0xc46cb4[_0x9e73('0x10c')]]){if(this[_0x9e73('0x1e')][_0xc46cb4[_0x9e73('0x10e')]]){this['actions'][_0xc46cb4[_0x9e73('0x10c')]][_0x9e73('0x10e')]=_0xc46cb4['stateinterface'];if(_[_0x9e73('0xa3')](this[_0x9e73('0x110')][this[_0x9e73('0x22')][_0xc46cb4['actionid']][_0x9e73('0xaa')]])){this[_0x9e73('0x110')][this[_0x9e73('0x22')][_0xc46cb4['actionid']][_0x9e73('0xaa')]]=[];}this[_0x9e73('0x110')][this['actions'][_0xc46cb4[_0x9e73('0x10c')]][_0x9e73('0xaa')]][_0x9e73('0x111')](_[_0x9e73('0xc1')](_[_0x9e73('0x112')](this[_0x9e73('0x22')][_0xc46cb4[_0x9e73('0x10c')]],[_0x9e73('0x113'),'stateinterface']),{'status':_0xc46cb4['status'],'paused':_0xc46cb4['paused']}));}}}};function unlockQueueStatus(_0x5b837e,_0x5a2bac){setTimeout(function(){if(_[_0x9e73('0x36')](_0x5b837e['queueStatusComplete'])){loggerBooked[_0x9e73('0x8c')](_0x9e73('0x114'),_0x5a2bac);}_0x5b837e[_0x9e73('0x115')]=!![];loggerBooked[_0x9e73('0x77')](_0x9e73('0x116'),_0x5a2bac,JSON[_0x9e73('0x44')](_[_0x9e73('0x112')](_0x5b837e,['name',_0x9e73('0x115')])));},0x1f3);}Dialer[_0x9e73('0x9f')][_0x9e73('0x34')]=function(_0x846b5b){var _0xf8109a=this;var _0x133f3e=_0xf8109a['voiceQueues'][_0xf8109a[_0x9e73('0x22')][_0x846b5b['actionid']][_0x9e73('0xaa')]];if(strategy[this[_0x9e73('0x1d')][this[_0x9e73('0x22')][_0x846b5b['actionid']]['queue']][_0x9e73('0x4b')]]===_0x9e73('0x18')){if(this['actions'][_0x846b5b[_0x9e73('0x10c')]]&&this[_0x9e73('0x22')][_0x846b5b[_0x9e73('0x10c')]][_0x9e73('0x10e')]){this[_0x9e73('0x1c')]['run'](this[_0x9e73('0x22')][_0x846b5b[_0x9e73('0x10c')]][_0x9e73('0x113')],this[_0x9e73('0x22')][_0x846b5b[_0x9e73('0x10c')]][_0x9e73('0x10e')])[_0x9e73('0xa7')](function(_0x2eb790){logger[_0x9e73('0x8c')](_0x9e73('0x117'),util[_0x9e73('0x8d')](_0x2eb790,{'showHidden':![],'depth':null}));})[_0x9e73('0x1b')](function(){_0xf8109a[_0x9e73('0xa9')](_0xf8109a[_0x9e73('0x1d')][_0xf8109a[_0x9e73('0x22')][_0x846b5b['actionid']][_0x9e73('0xaa')]]);_0xf8109a['agents'][_0xf8109a[_0x9e73('0x22')][_0x846b5b[_0x9e73('0x10c')]][_0x9e73('0x10e')]][_0x9e73('0x10f')]=![];delete _0xf8109a[_0x9e73('0x22')][_0x846b5b[_0x9e73('0x10c')]];unlockQueueStatus(_0x133f3e);});}else{this[_0x9e73('0xa9')](this[_0x9e73('0x1d')][this[_0x9e73('0x22')][_0x846b5b[_0x9e73('0x10c')]][_0x9e73('0xaa')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x9e73('0x22')][_0x846b5b[_0x9e73('0x10c')]][_0x9e73('0xc2')],'ListId':this[_0x9e73('0x22')][_0x846b5b[_0x9e73('0x10c')]]['ListId'],'VoiceQueueId':this['actions'][_0x846b5b[_0x9e73('0x10c')]][_0x9e73('0xc4')]||undefined,'CampaignId':this[_0x9e73('0x22')][_0x846b5b[_0x9e73('0x10c')]][_0x9e73('0x10a')]||undefined})[_0x9e73('0xa7')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x9e73('0x22')][_0x846b5b[_0x9e73('0x10c')]];unlockQueueStatus(_0x133f3e);}}else if((strategy[this['voiceQueues'][this[_0x9e73('0x22')][_0x846b5b['actionid']][_0x9e73('0xaa')]]['strategy']]||'rrmemory')===_0x9e73('0x17')){var _0x107d0e;if(this[_0x9e73('0x22')][_0x846b5b[_0x9e73('0x10c')]]&&!_[_0x9e73('0x41')](this[_0x9e73('0x110')][this[_0x9e73('0x22')][_0x846b5b[_0x9e73('0x10c')]][_0x9e73('0xaa')]])){if(this[_0x9e73('0x27')][_0xf8109a[_0x9e73('0x22')][_0x846b5b[_0x9e73('0x10c')]][_0x9e73('0xaa')]]){this[_0x9e73('0x27')][_0xf8109a['actions'][_0x846b5b[_0x9e73('0x10c')]]['queue']]=this[_0x9e73('0x27')][this[_0x9e73('0x22')][_0x846b5b['actionid']][_0x9e73('0xaa')]]?this[_0x9e73('0x27')][this[_0x9e73('0x22')][_0x846b5b[_0x9e73('0x10c')]][_0x9e73('0xaa')]]:this['queueBooked'][this['actions'][_0x846b5b[_0x9e73('0x10c')]][_0x9e73('0xaa')]]?this[_0x9e73('0x110')][this[_0x9e73('0x22')][_0x846b5b[_0x9e73('0x10c')]]['queue']][_0x9e73('0x118')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x846b5b['actionid']][_0x9e73('0xaa')]][_0x9e73('0x118')]=this[_0x9e73('0x27')][this[_0x9e73('0x22')][_0x846b5b['actionid']][_0x9e73('0xaa')]];for(var _0x3a17f8=0x0;_0x3a17f8=0x0?!![]:![];})['catch'](myreject(_0x1472c2)));}}else{_0x17ff71[_0x9e73('0x111')](ami['Action']({'action':_0x9e73('0x134'),'command':util[_0x9e73('0x72')](_0x9e73('0x130'),_0x59c094,!_[_0x9e73('0x36')](config['timezones'][_0x5e7a19])?_0x5e7a19:'')})[_0x9e73('0xae')](function(_0x1d12c1){return _0x1d12c1['content']['indexOf']('true')>=0x0?!![]:![];})[_0x9e73('0xa7')](myreject(_0x1472c2)));}BPromise[_0x9e73('0x135')](_0x17ff71)[_0x9e73('0xae')](function(_0x46d6f1){var _0x4bab1b=_['some'](_0x46d6f1);if(_0x4bab1b){return _0x512b39(_0x4bab1b);}else{_0x4e6b23[_0x9e73('0x37')]=_0x34a09e?_0x9e73('0x136'):'INTERVAL_IS_OVERTIME';return _0x1472c2(msgResponse('[ifTime][promiseAll]','Failure','Global:\x20'+_0x34a09e+'\x20'+_0x1d352c+_0x9e73('0x137')+util[_0x9e73('0x8d')](_0x59c094,{'showHidden':![],'depth':null})+_0x9e73('0x138')+_0x5e7a19));}})[_0x9e73('0xa7')](function(_0x12df2f){return _0x1472c2(msgResponse(_0x9e73('0x12a'),_0x9e73('0x12b'),JSON[_0x9e73('0x44')](_0x12df2f)));});});};Dialer['prototype']['checkDialMethod']=function(_0x323d0b){var _0x5224a8=this;return function(){switch(_0x323d0b['dialMethod']){case _0x9e73('0x139'):freeVariablesPredictive(_0x323d0b);_0x5224a8[_0x9e73('0x13a')](_0x323d0b,0x1);break;case _0x9e73('0x13b'):freeVariablesPredictive(_0x323d0b);_0x5224a8[_0x9e73('0x13a')](_0x323d0b,_0x323d0b[_0x9e73('0x13c')]);break;case _0x9e73('0x7'):_0x5224a8[_0x9e73('0x7')](_0x323d0b);break;case'booked':freeVariablesPredictive(_0x323d0b);_0x5224a8[_0x9e73('0x13a')](_0x323d0b,0x1);break;default:freeVariablesPredictive(_0x323d0b);logger[_0x9e73('0x8c')]('Queue',_0x323d0b[_0x9e73('0x3b')],_0x9e73('0x13d'));}};};Dialer[_0x9e73('0x9f')][_0x9e73('0x13e')]=function(_0x774031){var _0x1bd9ea=this;return function(){_0x1bd9ea['handleIvr'](_0x774031);};};Dialer[_0x9e73('0x9f')]['syncQueueSummary']=function(_0x21a073){var _0x21c2a4=this;if(isNotPreview(_0x21a073[_0x9e73('0x56')])){if(isVoiceQueueOutbound(_0x21a073[_0x9e73('0x49')])&&isActive(_0x21a073[_0x9e73('0x13f')])){_0x21a073[_0x9e73('0x96')]=!![];BPromise[_0x9e73('0xad')]()[_0x9e73('0xae')](checkIsLoggedIn(_0x21a073,_0x21a073['loggedIn']))['then'](checkIsActive(_0x21a073,_0x21a073[_0x9e73('0x13f')]))[_0x9e73('0xae')](checkInterval(_0x21a073))[_0x9e73('0xae')](_0x21c2a4['checkIsTrunkReachable'](_0x21a073))[_0x9e73('0xae')](_0x21c2a4[_0x9e73('0x129')](_0x21a073['dialGlobalInterval'],_0x21a073[_0x9e73('0x140')],_0x21a073[_0x9e73('0x3b')],_0x21a073))[_0x9e73('0xae')](_0x21c2a4['checkIfTimeIntervals'](_0x21a073[_0x9e73('0x3d')],_0x21a073[_0x9e73('0x140')],_0x21a073[_0x9e73('0x3b')],_0x21a073))[_0x9e73('0xae')](_0x21c2a4[_0x9e73('0x141')](_0x21a073))[_0x9e73('0xa7')](loggerCatchQueueSummary(_0x9e73('0x142'),_0x21a073));}else{notSendMessagesQueue(_0x21a073);}}else{freeVariablesPredictive(_0x21a073);}};Dialer[_0x9e73('0x9f')][_0x9e73('0x124')]=function(){var _0x4ed799=this;var _0x110484;for(var _0x45229e in this[_0x9e73('0xab')]){if(this[_0x9e73('0xab')][_0x9e73('0x8f')](_0x45229e)){_0x110484=this[_0x9e73('0xab')][_0x45229e];if(isCampaignIvr(_0x110484[_0x9e73('0x49')])&&isActive(_0x110484[_0x9e73('0xca')])){_0x110484[_0x9e73('0x96')]=!![];BPromise[_0x9e73('0xad')]()[_0x9e73('0xae')](checkIsActive(_0x110484,_0x110484[_0x9e73('0xca')]))[_0x9e73('0xae')](checkInterval(_0x110484))[_0x9e73('0xae')](_0x4ed799[_0x9e73('0x125')](_0x110484))[_0x9e73('0xae')](_0x4ed799[_0x9e73('0x129')](_0x110484['dialGlobalInterval'],_0x110484['dialTimezone'],_0x110484['name'],_0x110484))[_0x9e73('0xae')](_0x4ed799['checkIfTimeIntervals'](_0x110484['Interval'],_0x110484[_0x9e73('0x140')],_0x110484['name'],_0x110484))['then'](_0x4ed799[_0x9e73('0x13e')](_0x110484))['catch'](loggerCatchQueueSummary(_0x9e73('0x143'),_0x110484));}else{notSendMessagesCampaign(_0x110484);}}}};function getCallerIdRandom(_0x3d9f1e,_0xdbeb71){var _0x5f3a29,_0x4e2a22,_0x434ad3;if(_0xdbeb71<=0x0){_0xdbeb71=0x1;}_0x5f3a29=new RegExp(_0x9e73('0x144')+_0xdbeb71+'}$');_0x4e2a22=Math[_0x9e73('0x145')](0xa,_0xdbeb71-0x1);_0x434ad3=Math['pow'](0xa,_0xdbeb71)-0x1;return util[_0x9e73('0x72')]('%s',_[_0x9e73('0x146')](_0x3d9f1e,_0x5f3a29,_[_0x9e73('0x147')](_0x4e2a22,_0x434ad3)));}function extractCalleridName(_0x3058b3){var _0xe581b5=_0x3058b3[_0x9e73('0x148')](/"(.*?)"/);return _0xe581b5?_0xe581b5[0x1]:_0x3058b3;}function extractCalleridNumber(_0x552e1e){var _0x33bde3=_0x552e1e[_0x9e73('0x148')](/<(.*?)>/);return _0x33bde3?_0x33bde3[0x1]:_0x552e1e;}Dialer[_0x9e73('0x9f')]['actionOriginate']=function(_0x2d2600,_0x2280d0){var _0x536c26=this;var _0x3f5134=uuid['v4']();this['actions'][_0x3f5134]=new Action(_0x2d2600,_0x2280d0,_0x3f5134);return new BPromise(function(_0x2d8108,_0xdbbd2){if(_['isUndefined'](_0x2d2600)&&_0x9e73('0x149')!==typeof _0x2d2600){return _0xdbbd2(msgResponse('originate',_0x9e73('0x12b'),_0x9e73('0x14a')));}if(_[_0x9e73('0x36')](_0x2280d0['Contact'][_0x9e73('0x14b')])||_0x2280d0[_0x9e73('0x14c')][_0x9e73('0x14b')]===null){return _0xdbbd2(msgResponse('originate','Failure',_0x9e73('0x14d')));}var _0x1ab589={'XMD-CALLERID':_0x536c26[_0x9e73('0x22')][_0x3f5134][_0x9e73('0x14e')](),'XMD-AGI':_0x2d2600['dialQueueProject']?util[_0x9e73('0x72')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2d2600[_0x9e73('0xe9')]):_0x9e73('0x14f'),'XMD-AGIAFTER':_0x2d2600[_0x9e73('0x150')]?util['format'](_0x9e73('0x151'),ipAgi,_0x2d2600['dialQueueProject2']):_0x9e73('0x14f'),'XMD-QUEUE':_0x2d2600[_0x9e73('0x49')]==='outbound'?util[_0x9e73('0x72')](_0x9e73('0x152'),_0x2d2600[_0x9e73('0x3b')],_0x2d2600[_0x9e73('0x153')]||'',_0x2d2600[_0x9e73('0xef')]?'c':'',_0x2d2600['dialQueueTimeout']||0x3):_0x9e73('0x14f'),'XMD-CONTACTID':_0x2280d0[_0x9e73('0xc2')],'XMD-CDRTYPE':_0x9e73('0x5'),'CALLERID(all)':_0x536c26['actions'][_0x3f5134]['getCaller'](),'XMD-AMD':_0x2d2600[_0x9e73('0xd3')]?'ACTIVE':_0x9e73('0x14f'),'XMD-DESTINATION':_0x9e73('0x154')};if(_0x2d2600[_0x9e73('0xd3')]){_0x1ab589[_0x9e73('0x155')]=_0x2d2600[_0x9e73('0x156')]||0x9c4;_0x1ab589[_0x9e73('0x157')]=_0x2d2600[_0x9e73('0x158')]||0x5dc;_0x1ab589[_0x9e73('0x159')]=_0x2d2600['dialAMDAfterGreetingSilence']||0x320;_0x1ab589[_0x9e73('0x15a')]=_0x2d2600[_0x9e73('0x15b')]||0x1388;_0x1ab589[_0x9e73('0x15c')]=_0x2d2600[_0x9e73('0x15d')]||0x64;_0x1ab589[_0x9e73('0x15e')]=_0x2d2600[_0x9e73('0x15f')]||0x32;_0x1ab589['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2d2600[_0x9e73('0x160')]||0x3;_0x1ab589[_0x9e73('0x161')]=_0x2d2600['dialAMDSilenceThreshold']||0x100;_0x1ab589[_0x9e73('0x162')]=_0x2d2600[_0x9e73('0x163')]||0x1388;}if(_0x2d2600[_0x9e73('0x49')]===_0x9e73('0x4a')){_0x1ab589[_0x9e73('0x164')]=_0x2280d0[_0x9e73('0xc4')];}else{_0x1ab589[_0x9e73('0x165')]=_0x2280d0[_0x9e73('0x10a')];}for(var _0x502951 in _0x2280d0[_0x9e73('0x14c')]){if(_0x2280d0[_0x9e73('0x14c')]['hasOwnProperty'](_0x502951)){if(isNotNull(_0x2280d0['Contact'][_0x502951])&&_0x502951!=='id'&&_0x502951!==_0x9e73('0x166')&&_0x502951!==_0x9e73('0x167')&&_0x502951!==_0x9e73('0x168')){_0x1ab589[util['format'](_0x9e73('0x169'),_0x9e73('0x16a'),_[_0x9e73('0x16b')](_0x502951))]=_0x2280d0[_0x9e73('0x14c')][_0x502951];}}}var _0x555245=_0x536c26['isTrunkReachable'](_0x2d2600[_0x9e73('0x70')])?getCallerId(_0x2d2600[_0x9e73('0x70')][_0x9e73('0x16c')],_0x2d2600[_0x9e73('0x57')],_0x2d2600[_0x9e73('0x16d')]>0x0?getCallerIdRandom(_0x2d2600[_0x9e73('0x16e')],_0x2d2600[_0x9e73('0x16d')]):_0x2d2600[_0x9e73('0x16e')]):getCallerId(_[_0x9e73('0xa3')](_0x2d2600['TrunkBackup'])?_0x2d2600[_0x9e73('0x70')]['callerid']:_0x2d2600[_0x9e73('0x126')][_0x9e73('0x16c')],_0x2d2600[_0x9e73('0x57')],_0x2d2600[_0x9e73('0x16d')]>0x0?getCallerIdRandom(_0x2d2600[_0x9e73('0x16e')],_0x2d2600[_0x9e73('0x16d')]):_0x2d2600[_0x9e73('0x16e')]);if(_0x555245){_0x1ab589[_0x9e73('0x16f')]=_0x536c26[_0x9e73('0x22')][_0x3f5134][_0x9e73('0x170')]=extractCalleridName(_0x555245);_0x1ab589[_0x9e73('0x171')]=_0x536c26[_0x9e73('0x22')][_0x3f5134]['originatecalleridnum']=extractCalleridNumber(_0x555245);}return ami[_0x9e73('0xa4')]({'actionid':_0x3f5134,'action':_0x9e73('0x172'),'channel':_0x536c26[_0x9e73('0xc9')](_0x2d2600[_0x9e73('0x70')])?util[_0x9e73('0x72')](_0x9e73('0x173'),_0x2d2600[_0x9e73('0x70')][_0x9e73('0x3b')],isNotNull(_0x2d2600[_0x9e73('0x174')])?_0x2d2600[_0x9e73('0x174')][_0x9e73('0x175')]()||'':'',_0x2d2600[_0x9e73('0x176')]>0x0?_0x2280d0[_0x9e73('0x14c')][_0x9e73('0x14b')]['substring'](_0x2d2600[_0x9e73('0x176')]):_0x2280d0[_0x9e73('0x14c')][_0x9e73('0x14b')]):util[_0x9e73('0x72')](_0x9e73('0x173'),_['isNil'](_0x2d2600[_0x9e73('0x126')])?_0x2d2600[_0x9e73('0x70')]['name']:_0x2d2600[_0x9e73('0x126')]['name'],isNotNull(_0x2d2600[_0x9e73('0x174')])?_0x2d2600[_0x9e73('0x174')][_0x9e73('0x175')]()||'':'',_0x2d2600[_0x9e73('0x176')]>0x0?_0x2280d0['Contact'][_0x9e73('0x14b')]['substring'](_0x2d2600[_0x9e73('0x176')]):_0x2280d0[_0x9e73('0x14c')]['phone']),'callerid':_0x555245,'Exten':_0x9e73('0x154'),'Context':_0x9e73('0x177'),'Priority':'1','variable':_0x1ab589,'timeout':(_0x2d2600[_0x9e73('0x178')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3f5134})[_0x9e73('0xae')](function(_0x3ee32e){return _0x2d8108(_0x3ee32e);})['catch'](function(_0x21ca4a){_0x2d2600[_0x9e73('0x5e')]+=0x1;var _0x35e202=new History(_0x536c26[_0x9e73('0x22')][_0x3f5134]);logger[_0x9e73('0x8c')](util['format'](_0x9e73('0x179'),JSON[_0x9e73('0x44')](_0x21ca4a)));_0x35e202[_0x9e73('0x9b')]=0xe;_0x35e202[_0x9e73('0x9c')]=_0x9e73('0x17a');_0x35e202['starttime']=moment()[_0x9e73('0x72')]('YYYY-MM-DD\x20HH:mm:ss');_0x35e202['endtime']=_0x35e202[_0x9e73('0x9e')];_0x536c26[_0x9e73('0xbd')](_0x35e202)['catch'](loggerCatch(_0x9e73('0x17b')));_0x536c26[_0x9e73('0xbc')](_0x35e202)[_0x9e73('0xa7')](loggerCatch('[originate][error]'))[_0x9e73('0x1b')](function(){delete _0x536c26[_0x9e73('0x22')][_0x3f5134];return _0xdbbd2(msgResponse(_0x9e73('0x172'),'Error',_0x9e73('0x17c')));});});});};Dialer['prototype'][_0x9e73('0x2b')]=function(_0x2cf38d){var _0xcafa62=this[_0x9e73('0x22')][_0x2cf38d[_0x9e73('0x10c')]];var _0xf0dd1=this;if(_0xcafa62){delete this[_0x9e73('0x22')][_0x2cf38d[_0x9e73('0x10c')]];_0xcafa62[_0x9e73('0xf7')]=moment()[_0x9e73('0x72')](_0x9e73('0xf0'));var _0xd896a3=_0xcafa62[_0x9e73('0x49')]===_0x9e73('0x75')?this[_0x9e73('0xab')][_0xcafa62['queue']]:this['voiceQueues'][_0xcafa62['getQueue']()];if(!this['isSuccess'](_0x2cf38d[_0x9e73('0x17d')])){this['updateOriginated'](_0xd896a3);return this['callProgressDetecting'](_0xcafa62,_0xd896a3,_0x2cf38d)[_0x9e73('0xae')](function(_0x2b08ac){})[_0x9e73('0xa7')](loggerCatch(_0x9e73('0x17e')));}else{this['uniqueId'][_0x2cf38d['uniqueid']]=_0xcafa62;}}};Dialer[_0x9e73('0x9f')][_0x9e73('0x17f')]=function(_0x3bc1b7,_0xb3c9af,_0x4cf6f5){var _0x2d5ab7=new History(_0xb3c9af);if(_0x2d5ab7[_0x9e73('0x180')]+_0x2d5ab7[_0x9e73('0x181')]+_0x2d5ab7[_0x9e73('0x182')]+_0x2d5ab7[_0x9e73('0x183')]+_0x2d5ab7[_0x9e73('0xfb')]+_0x2d5ab7[_0x9e73('0x107')]+_0x2d5ab7[_0x9e73('0x184')]+_0x2d5ab7[_0x9e73('0x185')]>=_0x4cf6f5[_0x9e73('0x186')]-0x1){return!![];}switch(_0x3bc1b7){case 0x3:if(_0x2d5ab7['countnoanswerretry']>=_0x4cf6f5[_0x9e73('0x187')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x2d5ab7[_0x9e73('0x182')]+=0x1,'scheduledat':moment()[_0x9e73('0xfe')](_0x4cf6f5[_0x9e73('0x188')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2d5ab7[_0x9e73('0xc2')],'ListId':_0x2d5ab7['ListId'],'VoiceQueueId':_0x2d5ab7[_0x9e73('0xc4')]||undefined,'CampaignId':_0x2d5ab7[_0x9e73('0x10a')]||undefined})[_0x9e73('0xa7')](loggerCatch(_0x9e73('0x189')));}break;case 0x5:if(_0x2d5ab7[_0x9e73('0x180')]>=_0x4cf6f5[_0x9e73('0x18a')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x2d5ab7[_0x9e73('0x180')]+=0x1,'scheduledat':moment()[_0x9e73('0xfe')](_0x4cf6f5[_0x9e73('0x18b')],'minutes')[_0x9e73('0x72')](_0x9e73('0xf0')),'ContactId':_0x2d5ab7[_0x9e73('0xc2')],'ListId':_0x2d5ab7[_0x9e73('0xc3')],'VoiceQueueId':_0x2d5ab7[_0x9e73('0xc4')]||undefined,'CampaignId':_0x2d5ab7[_0x9e73('0x10a')]||undefined})[_0x9e73('0xa7')](loggerCatch(_0x9e73('0x18c')));}break;case 0x8:if(_0x2d5ab7[_0x9e73('0x181')]>=_0x4cf6f5[_0x9e73('0x18d')]-0x1){return!![];}else{this[_0x9e73('0xb4')]({'active':![],'countcongestionretry':_0x2d5ab7[_0x9e73('0x181')]+=0x1,'scheduledat':moment()[_0x9e73('0xfe')](_0x4cf6f5[_0x9e73('0x18e')],_0x9e73('0x100'))['format'](_0x9e73('0xf0')),'ContactId':_0x2d5ab7[_0x9e73('0xc2')],'ListId':_0x2d5ab7[_0x9e73('0xc3')],'VoiceQueueId':_0x2d5ab7[_0x9e73('0xc4')]||undefined,'CampaignId':_0x2d5ab7[_0x9e73('0x10a')]||undefined})[_0x9e73('0xa7')](loggerCatch(_0x9e73('0x18f')));}break;case 0x0:if(_0x2d5ab7['countnosuchnumberretry']>=_0x4cf6f5[_0x9e73('0x190')]-0x1){return!![];}else{this[_0x9e73('0xb4')]({'active':![],'countnosuchnumberretry':_0x2d5ab7['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x9e73('0xfe')](_0x4cf6f5[_0x9e73('0x191')],_0x9e73('0x100'))[_0x9e73('0x72')](_0x9e73('0xf0')),'ContactId':_0x2d5ab7[_0x9e73('0xc2')],'ListId':_0x2d5ab7['ListId'],'VoiceQueueId':_0x2d5ab7[_0x9e73('0xc4')]||undefined,'CampaignId':_0x2d5ab7['CampaignId']||undefined})[_0x9e73('0xa7')](loggerCatch(_0x9e73('0x192')));}break;case 0xa:if(_0x2d5ab7[_0x9e73('0xfb')]>=_0x4cf6f5[_0x9e73('0xfc')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x2d5ab7[_0x9e73('0xfb')]+=0x1,'scheduledat':moment()[_0x9e73('0xfe')](_0x4cf6f5[_0x9e73('0xff')],'minutes')[_0x9e73('0x72')](_0x9e73('0xf0')),'ContactId':_0x2d5ab7[_0x9e73('0xc2')],'ListId':_0x2d5ab7[_0x9e73('0xc3')],'VoiceQueueId':_0x2d5ab7[_0x9e73('0xc4')]||undefined,'CampaignId':_0x2d5ab7['CampaignId']||undefined})['catch'](loggerCatch(_0x9e73('0x101')));}break;case 0xb:if(_0x2d5ab7['countabandonedretry']>=_0x4cf6f5[_0x9e73('0x108')]-0x1){return!![];}else{this[_0x9e73('0xb4')]({'active':![],'countabandonedretry':_0x2d5ab7['countabandonedretry']+=0x1,'scheduledat':moment()[_0x9e73('0xfe')](_0x4cf6f5[_0x9e73('0x109')],'minutes')[_0x9e73('0x72')](_0x9e73('0xf0')),'ContactId':_0x2d5ab7[_0x9e73('0xc2')],'ListId':_0x2d5ab7[_0x9e73('0xc3')],'VoiceQueueId':_0x2d5ab7[_0x9e73('0xc4')]||undefined,'CampaignId':_0x2d5ab7[_0x9e73('0x10a')]||undefined})[_0x9e73('0xa7')](loggerCatch(_0x9e73('0x10b')));}break;case 0x13:if(_0x2d5ab7['countmachineretry']>=_0x4cf6f5[_0x9e73('0x193')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countmachineretry':_0x2d5ab7['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x4cf6f5[_0x9e73('0x194')],_0x9e73('0x100'))[_0x9e73('0x72')](_0x9e73('0xf0')),'ContactId':_0x2d5ab7['ContactId'],'ListId':_0x2d5ab7[_0x9e73('0xc3')],'VoiceQueueId':_0x2d5ab7[_0x9e73('0xc4')]||undefined,'CampaignId':_0x2d5ab7['CampaignId']||undefined})[_0x9e73('0xa7')](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x2d5ab7[_0x9e73('0x185')]>=_0x4cf6f5[_0x9e73('0x195')]-0x1){return!![];}else{this[_0x9e73('0xb4')]({'active':![],'countagentrejectretry':_0x2d5ab7[_0x9e73('0x185')]+=0x1,'scheduledat':moment()[_0x9e73('0xfe')](_0x4cf6f5[_0x9e73('0x196')],'minutes')[_0x9e73('0x72')](_0x9e73('0xf0')),'ContactId':_0x2d5ab7[_0x9e73('0xc2')],'ListId':_0x2d5ab7[_0x9e73('0xc3')],'VoiceQueueId':_0x2d5ab7[_0x9e73('0xc4')]||undefined,'CampaignId':_0x2d5ab7[_0x9e73('0x10a')]||undefined})['catch'](loggerCatch(_0x9e73('0x197')));}break;default:return!![];}};Dialer[_0x9e73('0x9f')][_0x9e73('0x198')]=function(_0x1233c5,_0x300637,_0x35c2b0){var _0x5bae5c=this;var _0xcd7a3a=new History(_0x1233c5);return new BPromise(function(_0xecb339,_0x2ba4c2){if(_[_0x9e73('0x36')](_0x300637)&&_0x9e73('0x149')!==typeof _0x300637){return _0x2ba4c2(msgResponse(_0x9e73('0x199'),'Failure',_0x9e73('0x19a')));}if(_[_0x9e73('0x36')](_0x35c2b0)&&_0x9e73('0x149')!==typeof _0x35c2b0){return _0x2ba4c2(msgResponse(_0x9e73('0x199'),_0x9e73('0x12b'),_0x9e73('0x19b')));}switch(_0x35c2b0[_0x9e73('0x19c')]){case'0':_0x300637[_0x9e73('0x5d')]+=0x1;_0xcd7a3a[_0x9e73('0x9b')]=0x0;_0xcd7a3a['statedesc']=_0x9e73('0x19d');_0xcd7a3a[_0x9e73('0x183')]+=0x1;_0xcd7a3a[_0x9e73('0x19e')]+=0x1;_0x5bae5c[_0x9e73('0xbd')](_0xcd7a3a)[_0x9e73('0xa7')](loggerCatch(_0x9e73('0x19f')));if(_0x5bae5c[_0x9e73('0x17f')](0x0,_0x1233c5,_0x300637)){if(_0xcd7a3a['countbusyretry']+_0xcd7a3a[_0x9e73('0x181')]+_0xcd7a3a[_0x9e73('0x182')]+_0xcd7a3a['countnosuchnumberretry']+_0xcd7a3a[_0x9e73('0xfb')]+_0xcd7a3a[_0x9e73('0x107')]+_0xcd7a3a[_0x9e73('0x184')]+_0xcd7a3a[_0x9e73('0x185')]>=_0x300637[_0x9e73('0x186')]){_0x5bae5c[_0x9e73('0x1a0')](_0xcd7a3a,_0xecb339,_0x2ba4c2,_0x9e73('0x1a1'));}else{_0x5bae5c[_0x9e73('0x1a2')](_0xcd7a3a,_0xecb339,_0x2ba4c2,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x300637[_0x9e73('0x5c')]+=0x1;_0xcd7a3a['state']=0x3;_0xcd7a3a[_0x9e73('0x9c')]=_0x9e73('0x1a3');_0xcd7a3a[_0x9e73('0x182')]+=0x1;_0xcd7a3a['countglobal']+=0x1;_0x5bae5c[_0x9e73('0xbd')](_0xcd7a3a)['catch'](loggerCatch(_0x9e73('0x1a4')));if(_0x5bae5c[_0x9e73('0x17f')](0x3,_0x1233c5,_0x300637)){if(_0xcd7a3a[_0x9e73('0x182')]>=_0x300637[_0x9e73('0x187')]){_0x5bae5c[_0x9e73('0x1a2')](_0xcd7a3a,_0xecb339,_0x2ba4c2,_0x9e73('0x1a5'));}else{_0x5bae5c[_0x9e73('0x1a0')](_0xcd7a3a,_0xecb339,_0x2ba4c2,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x300637[_0x9e73('0x59')]+=0x1;_0xcd7a3a[_0x9e73('0x9b')]=0x5;_0xcd7a3a[_0x9e73('0x9c')]='Busy';_0xcd7a3a[_0x9e73('0x180')]+=0x1;_0xcd7a3a['countglobal']+=0x1;_0x5bae5c[_0x9e73('0xbd')](_0xcd7a3a)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x5bae5c['checkRetriveMax'](0x5,_0x1233c5,_0x300637)){if(_0xcd7a3a[_0x9e73('0x180')]>=_0x300637[_0x9e73('0x18a')]){_0x5bae5c['createStateFinal'](_0xcd7a3a,_0xecb339,_0x2ba4c2,_0x9e73('0x1a6'));}else{_0x5bae5c[_0x9e73('0x1a0')](_0xcd7a3a,_0xecb339,_0x2ba4c2,'reason\x205\x20busy');}}break;case'8':_0x300637[_0x9e73('0x5a')]+=0x1;_0xcd7a3a[_0x9e73('0x9b')]=0x8;_0xcd7a3a[_0x9e73('0x9c')]='Congestion';_0xcd7a3a[_0x9e73('0x181')]+=0x1;_0xcd7a3a['countglobal']+=0x1;_0x5bae5c[_0x9e73('0xbd')](_0xcd7a3a)[_0x9e73('0xa7')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x5bae5c['checkRetriveMax'](0x8,_0x1233c5,_0x300637)){if(_0xcd7a3a['countcongestionretry']>=_0x300637[_0x9e73('0x18d')]){_0x5bae5c[_0x9e73('0x1a2')](_0xcd7a3a,_0xecb339,_0x2ba4c2,_0x9e73('0x1a7'));}else{_0x5bae5c[_0x9e73('0x1a0')](_0xcd7a3a,_0xecb339,_0x2ba4c2,_0x9e73('0x1a7'));}}break;case'11':_0x300637[_0x9e73('0x1a8')]+=0x1;_0xcd7a3a[_0x9e73('0x9b')]=0xb;_0xcd7a3a[_0x9e73('0x9c')]=_0x9e73('0x104');_0xcd7a3a[_0x9e73('0x107')]+=0x1;_0xcd7a3a['countglobal']+=0x1;_0x5bae5c[_0x9e73('0xbd')](_0xcd7a3a)[_0x9e73('0xa7')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x5bae5c[_0x9e73('0x17f')](0xb,_0x1233c5,_0x300637)){if(_0xcd7a3a['countabandonedretry']>=_0x300637['dialAbandonedMaxRetry']){_0x5bae5c[_0x9e73('0x1a2')](_0xcd7a3a,_0xecb339,_0x2ba4c2,'reason\x2011\x20abandoned');}else{_0x5bae5c[_0x9e73('0x1a0')](_0xcd7a3a,_0xecb339,_0x2ba4c2,'reason\x2011\x20abandoned');}}break;case'20':_0x300637['outboundRejectCallsDay']+=0x1;_0xcd7a3a[_0x9e73('0x9b')]=0x14;_0xcd7a3a['statedesc']='AgentReject';_0xcd7a3a[_0x9e73('0x185')]+=0x1;_0xcd7a3a[_0x9e73('0x19e')]+=0x1;_0x5bae5c[_0x9e73('0xbd')](_0xcd7a3a)[_0x9e73('0xa7')](loggerCatch(_0x9e73('0x1a9')));if(_0x5bae5c['checkRetriveMax'](0x14,_0x1233c5,_0x300637)){if(_0xcd7a3a[_0x9e73('0x185')]>=_0x300637['dialAgentRejectMaxRetry']){_0x5bae5c[_0x9e73('0x1a2')](_0xcd7a3a,_0xecb339,_0x2ba4c2,'reason\x2020\x20agentreject');}else{_0x5bae5c[_0x9e73('0x1a0')](_0xcd7a3a,_0xecb339,_0x2ba4c2,_0x9e73('0x1aa'));}}break;default:_0x300637[_0x9e73('0x61')]+=0x1;_0xcd7a3a[_0x9e73('0x9b')]=0xc;_0xcd7a3a[_0x9e73('0x9c')]=_0x35c2b0[_0x9e73('0x19c')];_0x5bae5c['createHistory'](_0xcd7a3a)['catch'](loggerCatch(_0x9e73('0x1ab')));if(_0x5bae5c[_0x9e73('0x17f')](_0x35c2b0['reason'],_0x1233c5,_0x300637)){if(_0xcd7a3a['countbusyretry']+_0xcd7a3a[_0x9e73('0x181')]+_0xcd7a3a[_0x9e73('0x182')]+_0xcd7a3a[_0x9e73('0x183')]+_0xcd7a3a[_0x9e73('0xfb')]+_0xcd7a3a[_0x9e73('0x107')]+_0xcd7a3a[_0x9e73('0x184')]+_0xcd7a3a[_0x9e73('0x185')]>=_0x300637['dialGlobalMaxRetry']){_0x5bae5c['stateGlobal'](_0xcd7a3a,_0xecb339,_0x2ba4c2,_0x35c2b0[_0x9e73('0x19c')]);}else{_0x5bae5c[_0x9e73('0x1a2')](_0xcd7a3a,_0xecb339,_0x2ba4c2,_0x35c2b0[_0x9e73('0x19c')]);}}}});};Dialer[_0x9e73('0x9f')]['stateGlobal']=function(_0x1837cd,_0x43b20e,_0x51ad61,_0x2146ed){var _0x4df739=new Final(_0x1837cd);_0x4df739['state']=0xf;_0x4df739[_0x9e73('0x9c')]=_0x9e73('0x1ac');this[_0x9e73('0x1a2')](_0x4df739,_0x43b20e,_0x51ad61,_0x2146ed);};Dialer[_0x9e73('0x9f')][_0x9e73('0x1a2')]=function(_0x3b5f81,_0x268b96,_0x20f2f8,_0x465e2d){this[_0x9e73('0xbc')](_0x3b5f81)[_0x9e73('0xae')](function(_0x1b800a){return _0x268b96(msgResponse(_0x9e73('0x199'),'Success',_0x465e2d));})[_0x9e73('0xa7')](function(_0x58b639){return _0x20f2f8(msgResponse('[moveContactManagedDialer][0]',_0x9e73('0x12b'),'contact\x20not\x20moved'));});};Dialer[_0x9e73('0x9f')][_0x9e73('0x7')]=function(_0xdd47ca){var _0x21abb6=this;var _0x1975df=_0xdd47ca['dialPredictiveOptimizationPercentage']/0x64;var _0x44b421=_0xdd47ca[_0x9e73('0x1ad')]/(_0xdd47ca[_0x9e73('0x1ad')]+_0xdd47ca[_0x9e73('0xd6')]);var _0x524c9c=Math[_0x9e73('0x1ae')](_0xdd47ca[_0x9e73('0x68')]*(_0xdd47ca[_0x9e73('0x1af')]/0x64));var _0x163c46=Math['round'](_0xdd47ca[_0x9e73('0x68')]*(_0xdd47ca[_0x9e73('0x1b0')]/0x64));var _0x180628=_0xdd47ca[_0x9e73('0x4d')]+_0xdd47ca[_0x9e73('0x53')];var _0x29f241=Math['floor'](_0xdd47ca['erlangCalls']*_0xdd47ca[_0x9e73('0x6d')]*_0xdd47ca[_0x9e73('0x66')]*_0xdd47ca[_0x9e73('0x67')]);if(_[_0x9e73('0x36')](_0xdd47ca[_0x9e73('0x6f')])){if(!_[_0x9e73('0x36')](_0xdd47ca[_0x9e73('0x25')])){_0xdd47ca[_0x9e73('0x25')]=undefined;loggerPredictive[_0x9e73('0x8c')](_0x9e73('0x1b1'),_0x9e73('0x1b2'));}if(!_[_0x9e73('0x36')](_0xdd47ca['handlePredictive'])){loggerPredictive['error'](_0x9e73('0x1b1'),_0x9e73('0x1b3'));clearInterval(_0xdd47ca['handlePredictive']);_0xdd47ca[_0x9e73('0x88')]=undefined;}_0xdd47ca['startProgressive']=moment()[_0x9e73('0x72')](_0x9e73('0xf0'));loggerPredictive[_0x9e73('0x77')](_0xdd47ca[_0x9e73('0x3b')],_0x9e73('0x1b4'),_0xdd47ca[_0x9e73('0x6f')]);this[_0x9e73('0x13a')](_0xdd47ca,0x1);}else if(ifInterval(_0xdd47ca[_0x9e73('0x1b5')],_0xdd47ca[_0x9e73('0x6f')])){this[_0x9e73('0x13a')](_0xdd47ca,0x1);loggerPredictiveCalls[_0x9e73('0x77')](_0x9e73('0x1b6'),_0xdd47ca['startProgressive'],_0xdd47ca[_0x9e73('0x3b')]);_0xdd47ca[_0x9e73('0x6b')]=0x0;_0xdd47ca[_0x9e73('0xf8')]=0x0;}else if(_0x1975df<_0x44b421&&_0xdd47ca[_0x9e73('0x1b7')]==='dropRate'){freeVariablesPredictive(_0xdd47ca);loggerPredictive[_0x9e73('0x77')](_0x9e73('0x1b8'),_0x9e73('0x1b9'),_0x44b421,_0x9e73('0x6f'),_0xdd47ca[_0x9e73('0x3b')]);}else if(_0x29f241<_0xdd47ca[_0x9e73('0xf8')]&&_0xdd47ca['dialPredictiveOptimization']===_0x9e73('0x1ba')){freeVariablesPredictive(_0xdd47ca);loggerPredictive[_0x9e73('0x77')](_0x9e73('0x1bb'),_0x9e73('0x1bc'),_0x29f241,_0x9e73('0x1bd'),_0xdd47ca[_0x9e73('0xf8')],'startProgressive',_0xdd47ca[_0x9e73('0x3b')]);}else if(!ifInterval(_0xdd47ca[_0x9e73('0x1b5')],_0xdd47ca['startProgressive'])&&_[_0x9e73('0x36')](_0xdd47ca[_0x9e73('0x25')])&&!_[_0x9e73('0x36')](_0xdd47ca[_0x9e73('0x6f')])){_0xdd47ca[_0x9e73('0x25')]=moment()['format'](_0x9e73('0xf0'));loggerPredictive[_0x9e73('0x77')](_0xdd47ca[_0x9e73('0x3b')],'started\x20in\x20predictive\x20at',_0xdd47ca['startPredictive']);this[_0x9e73('0xb3')](_0xdd47ca['dialPredictiveInterval'])[_0x9e73('0xae')](this[_0x9e73('0x1be')](_0xdd47ca))[_0x9e73('0xae')](mergeDataErlangB(_0xdd47ca))[_0x9e73('0xae')](this['startMethodPredictive'](_0xdd47ca))[_0x9e73('0xa7')](loggerCatchPredictive(_0x9e73('0x1bf'),_0xdd47ca));}else if(!ifInterval(_0xdd47ca[_0x9e73('0x1b5')],_0xdd47ca[_0x9e73('0x25')])){_0xdd47ca[_0x9e73('0xf8')]=0x0;_0xdd47ca['startPredictive']=moment()[_0x9e73('0x72')](_0x9e73('0xf0'));loggerPredictive[_0x9e73('0x77')](_0xdd47ca[_0x9e73('0x3b')],_0x9e73('0x1c0'),_0xdd47ca[_0x9e73('0x25')]);clearInterval(_0xdd47ca['handlePredictive']);_0xdd47ca[_0x9e73('0x88')]=undefined;this['averageHandleTime'](_0xdd47ca[_0x9e73('0x1b5')])['then'](this[_0x9e73('0x1be')](_0xdd47ca))[_0x9e73('0xae')](mergeDataErlangB(_0xdd47ca))[_0x9e73('0xae')](this[_0x9e73('0x1c1')](_0xdd47ca))[_0x9e73('0xa7')](loggerCatchPredictive(_0x9e73('0x1c2'),_0xdd47ca));}else if(_0xdd47ca['predictiveIntervalAvailable']&&_0x180628<_0xdd47ca[_0x9e73('0x68')]-_0x163c46){freeVariablesPredictive(_0xdd47ca);loggerPredictive['info'](_0xdd47ca[_0x9e73('0x3b')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x180628,_0x9e73('0x1c3'),_0xdd47ca[_0x9e73('0x68')],'-',_0x163c46,'=',_0xdd47ca[_0x9e73('0x68')]-_0x163c46,')');}else if(_0xdd47ca['predictiveIntervalAvailable']&&_0x180628>_0xdd47ca[_0x9e73('0x68')]+_0x524c9c){freeVariablesPredictive(_0xdd47ca);loggerPredictive[_0x9e73('0x77')](_0xdd47ca['name'],_0x9e73('0x1c4'),_0x180628,')\x20are\x20more\x20than\x20threshold\x20(',_0xdd47ca['predictiveIntervalAvailable'],'+',_0x524c9c,'=',_0xdd47ca[_0x9e73('0x68')]+_0x524c9c,')');}};Dialer['prototype'][_0x9e73('0x1be')]=function(_0x48e4eb){var _0x4259df=this;return function(_0x214d6a){return new BPromise(function(_0x5b5c23,_0x165239){_[_0x9e73('0xc1')](_0x48e4eb,_0x214d6a[0x0]);if(checkGetDataPredictive(_0x214d6a[0x0])){var _0x20ebb=_0x48e4eb[_0x9e73('0x68')]=_0x48e4eb[_0x9e73('0x53')]+_0x48e4eb[_0x9e73('0x4d')];var _0x784251=_0x48e4eb[_0x9e73('0x1b5')]*0x3c;var _0x3e85c7=_0x214d6a[0x0][_0x9e73('0x63')]+_0x214d6a[0x0][_0x9e73('0x62')];var _0x350ff2=(_0x214d6a[0x0][_0x9e73('0x1c5')]+_0x214d6a[0x0][_0x9e73('0x64')]+_0x214d6a[0x0][_0x9e73('0x7b')])/_0x214d6a[0x0]['predictiveIntervalTotalCalls'];_0x48e4eb[_0x9e73('0x66')]=_0x350ff2>0x0?_0x350ff2:0x1;switch(_0x48e4eb[_0x9e73('0x1b7')]){case _0x9e73('0x1ba'):var _0x3a13bb=_0x48e4eb[_0x9e73('0x1c6')]/0x64;return _0x4259df[_0x9e73('0x1c7')](_0x20ebb,_0x784251,_0x3e85c7,_0x350ff2,_0x3a13bb)['then'](function(_0x91d895){return _0x5b5c23(_0x91d895);});case _0x9e73('0x1c8'):var _0x42bfb5=_0x48e4eb['dialPredictiveOptimizationPercentage']/0x64;return _0x4259df[_0x9e73('0x1c9')](_0x20ebb,_0x784251,_0x3e85c7,_0x350ff2,_0x42bfb5)[_0x9e73('0xae')](function(_0x17bf3b){return _0x5b5c23(_0x17bf3b);});default:return _0x165239(msgResponse(_0x9e73('0x1ca'),'Failure',_0x9e73('0x1cb')));}}else{return _0x165239(msgResponse(_0x9e73('0x1ca'),_0x9e73('0x12b'),_0x9e73('0x1cc')));}});};};Dialer[_0x9e73('0x9f')][_0x9e73('0x1cd')]=function(_0x20d8a9){var _0x573beb=this;return function(_0x192cb0){return new BPromise(function(_0x540295,_0x5f02c1){_[_0x9e73('0xc1')](_0x20d8a9,_0x192cb0[0x0]);if(checkGetDataPredictive(_0x192cb0[0x0])){loggerPredictive[_0x9e73('0x77')](JSON[_0x9e73('0x44')](_0x192cb0[0x0]));if(_0x20d8a9['dialPredictiveOptimization']==='dropRate'){return _0x573beb[_0x9e73('0xbb')](_0x20d8a9['id'])['then'](function(_0x3e0bbc){var _0x1d9246=_0x20d8a9[_0x9e73('0x4e')]-_0x3e0bbc[0x0][_0x9e73('0x1ce')];var _0x21cf32=_0x20d8a9[_0x9e73('0x1b5')]*0x3c;var _0x11b38b=_0x192cb0[0x0]['predictiveIntervalAvgTalktime']+_0x192cb0[0x0]['predictiveIntervalAvgHoldtime'];var _0x568735=(_0x192cb0[0x0]['predictiveIntervalAnsweredCalls']+_0x192cb0[0x0][_0x9e73('0x64')]+_0x192cb0[0x0][_0x9e73('0x7b')])/_0x192cb0[0x0][_0x9e73('0x69')];var _0x50b913=_0x20d8a9[_0x9e73('0x1c6')]/0x64;_0x20d8a9[_0x9e73('0x1cf')]=_0x3e0bbc[0x0][_0x9e73('0x1ce')]||0x0;_0x20d8a9['predictiveIntervalHitRate']=_0x568735>0x0?_0x568735:0x1;return _0x573beb[_0x9e73('0x1c7')](_0x1d9246,_0x21cf32,_0x11b38b,_0x568735,_0x50b913);})[_0x9e73('0xae')](function(_0x3c65db){return _0x540295(_0x3c65db);})[_0x9e73('0xa7')](function(_0x2a7184){return _0x5f02c1(msgResponse(_0x9e73('0x1d0'),_0x9e73('0x12b'),JSON[_0x9e73('0x44')](_0x2a7184)));});}if(_0x20d8a9[_0x9e73('0x1b7')]===_0x9e73('0x1c8')){return _0x573beb[_0x9e73('0xbb')](_0x20d8a9['id'])['then'](function(_0x5b665e){var _0x189ebf=_0x20d8a9[_0x9e73('0x4e')]-_0x5b665e[0x0][_0x9e73('0x1ce')];var _0x2a9fbb=_0x20d8a9[_0x9e73('0x1b5')]*0x3c;var _0x1b7542=_0x192cb0[0x0][_0x9e73('0x63')]+_0x192cb0[0x0][_0x9e73('0x62')];var _0x1858ff=(_0x192cb0[0x0][_0x9e73('0x1c5')]+_0x192cb0[0x0][_0x9e73('0x64')]+_0x192cb0[0x0][_0x9e73('0x7b')])/_0x192cb0[0x0][_0x9e73('0x69')];var _0x3ee397=_0x20d8a9[_0x9e73('0x1c6')]/0x64;_0x20d8a9['predictiveIntervalPauses']=_0x5b665e[0x0][_0x9e73('0x1ce')]||0x0;_0x20d8a9[_0x9e73('0x66')]=_0x1858ff>0x0?_0x1858ff:0x1;return _0x573beb[_0x9e73('0x1c9')](_0x189ebf,_0x2a9fbb,_0x1b7542,_0x1858ff,_0x3ee397);})[_0x9e73('0xae')](function(_0xfa44e9){return _0x540295(_0xfa44e9);})[_0x9e73('0xa7')](function(_0x35580d){return _0x5f02c1(msgResponse(_0x9e73('0x1d0'),_0x9e73('0x12b'),JSON['stringify'](_0x35580d)));});}}else{return _0x5f02c1(msgResponse(_0x9e73('0x1ca'),_0x9e73('0x12b'),_0x9e73('0x1cc')));}});};};Dialer[_0x9e73('0x9f')][_0x9e73('0x1c1')]=function(_0x2303ea){var _0x2de8ba=this;return function(){var _0x2b6043=0x0;var _0x1c8fd4=Math[_0x9e73('0x1d1')](_0x2303ea[_0x9e73('0x6c')]*0x3e8);if(_0x1c8fd4>0x0){_0x1c8fd4=_0x1c8fd4<0x64?0x64:_0x1c8fd4;loggerPredictive[_0x9e73('0x77')](_0x2303ea[_0x9e73('0x3b')],_0x9e73('0x1d2'),_0x1c8fd4,_0x9e73('0x45'));_0x2303ea[_0x9e73('0x88')]=setInterval(function(){_0x2de8ba['handlePredictive'](_0x2303ea);loggerPredictiveCalls[_0x9e73('0x77')](_0x9e73('0x1d3'),_0x2b6043+=0x1);},_0x1c8fd4);}else{loggerPredictive[_0x9e73('0x77')](_0x2303ea[_0x9e73('0x3b')],_0x9e73('0x1d4'));}};};Dialer['prototype'][_0x9e73('0x1d5')]=function(_0x3dd29c,_0x3bd5bf){var _0x1fc5e5=this;return function(_0xc9ef3){if(_['isEmpty'](_0xc9ef3)){if(_[_0x9e73('0xa3')](_0x3bd5bf[_0x9e73('0x1d6')])||!_0x3bd5bf[_0x9e73('0x1d7')]){if(_0x3dd29c['dialMethod']===_0x9e73('0x6')){_0x3dd29c['queueStatusComplete']=_[_0x9e73('0x36')](_0x3dd29c[_0x9e73('0x115')])?!![]:_0x3dd29c[_0x9e73('0x115')];var _0x21449b=uuid['v4']();_0x1fc5e5['actions'][_0x21449b]=new Action(_0x3dd29c,_0x3bd5bf,_0x21449b);loggerBooked[_0x9e73('0x77')]('[booked][checkContactBlack]',_0x21449b,_0x9e73('0x1d8'),JSON['stringify'](_0x3dd29c['queueStatusComplete']),_0x9e73('0x1d9'),_0x3dd29c[_0x9e73('0x3b')]);if(_0x3dd29c[_0x9e73('0x115')]){_0x3dd29c['queueStatusComplete']=![];_0x1fc5e5['queueBooked'][_0x1fc5e5['actions'][_0x21449b]['queue']]=[];ami[_0x9e73('0xa4')]({'actionid':_0x21449b,'action':_0x9e73('0x1da'),'queue':_0x3dd29c[_0x9e73('0x3b')]})[_0x9e73('0xa7')](function(_0x32fb39){_0x1fc5e5[_0x9e73('0xa9')](_0x3dd29c);_0x1fc5e5[_0x9e73('0xb4')]({'active':![],'ContactId':_0x1fc5e5[_0x9e73('0x22')][_0x21449b][_0x9e73('0xc2')],'ListId':_0x1fc5e5[_0x9e73('0x22')][_0x21449b][_0x9e73('0xc3')],'VoiceQueueId':_0x1fc5e5['actions'][_0x21449b][_0x9e73('0xc4')]||undefined,'CampaignId':_0x1fc5e5[_0x9e73('0x22')][_0x21449b][_0x9e73('0x10a')]||undefined})[_0x9e73('0xa7')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x1fc5e5[_0x9e73('0x22')][_0x21449b];});}else{loggerBooked[_0x9e73('0x77')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x3dd29c['queueStatusComplete']),_0x9e73('0x1d9'),_0x3dd29c[_0x9e73('0x3b')]);_0x1fc5e5['updateOriginated'](_0x3dd29c);_0x1fc5e5[_0x9e73('0xb4')]({'active':![],'ContactId':_0x1fc5e5[_0x9e73('0x22')][_0x21449b][_0x9e73('0xc2')],'ListId':_0x1fc5e5['actions'][_0x21449b][_0x9e73('0xc3')],'VoiceQueueId':_0x1fc5e5['actions'][_0x21449b][_0x9e73('0xc4')]||undefined,'CampaignId':_0x1fc5e5['actions'][_0x21449b][_0x9e73('0x10a')]||undefined})[_0x9e73('0xa7')](loggerCatch(_0x9e73('0x1db')));delete _0x1fc5e5[_0x9e73('0x22')][_0x21449b];}}else{return _0x1fc5e5[_0x9e73('0x1dc')](_0x3dd29c,_0x3bd5bf);}}else{if(getDiff(_0x3bd5bf[_0x9e73('0x1dd')])<_0x3dd29c[_0x9e73('0x1de')]*0x3c){if(_0x3bd5bf[_0x9e73('0x1df')]&&!_0x3bd5bf[_0x9e73('0x1df')][_0x9e73('0x1e0')]){_0x1fc5e5['preview'][_0x9e73('0x11d')](_0x3bd5bf['id'])['finally'](function(){_0x1fc5e5[_0x9e73('0xa9')](_0x3dd29c);});}else{_0x1fc5e5['unlockContact']({'active':![]},_0x3bd5bf['id'],0x1)[_0x9e73('0x1b')](function(){console[_0x9e73('0x1e1')](_0x9e73('0x1e2'));_0x1fc5e5[_0x9e73('0xa9')](_0x3dd29c);});}}else{_0x3dd29c[_0x9e73('0x5f')]+=0x1;_0x1fc5e5[_0x9e73('0xa9')](_0x3dd29c);if(_0x3dd29c[_0x9e73('0x1e3')]){_0x1fc5e5[_0x9e73('0xb4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3bd5bf['ContactId'],'ListId':_0x3bd5bf[_0x9e73('0xc3')],'VoiceQueueId':_0x3bd5bf[_0x9e73('0xc4')]||undefined,'CampaignId':_0x3bd5bf[_0x9e73('0x10a')]||undefined})[_0x9e73('0xa7')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x1fc5e5[_0x9e73('0xbd')](createObjHistory(_0x3dd29c,_0x3bd5bf,_0x9e73('0x1e4'),0x17,_0x9e73('0x1e5')))['catch'](loggerCatch(_0x9e73('0x1e6')));}else{_0x1fc5e5[_0x9e73('0xce')](createObjHistory(_0x3dd29c,_0x3bd5bf,_0x9e73('0x1e7'),0x16,_0x9e73('0x1e8')),_0x9e73('0x1e9'),_0x9e73('0x1ea'));}}}}else{_0x3dd29c['outboundBlacklistCallsDay']+=0x1;_0x1fc5e5[_0x9e73('0xce')](createObjHistory(_0x3dd29c,_0x3bd5bf,_0x9e73('0x1eb'),0xd,_0x9e73('0x1ec')),'[Originate][historyBlacklist]',_0x9e73('0x1ed'));throw _0x9e73('0x1ee');}};};Dialer[_0x9e73('0x9f')][_0x9e73('0x1ef')]=function(_0x5beaf9){var _0x978d66=this;var _0x269d11=[];var _0x22a896=_0x5beaf9['limitCalls']-_0x5beaf9[_0x9e73('0x6a')]-_0x5beaf9['temp'];emitCampaignSummary(_0x5beaf9);if(_0x22a896>0x0){if(_0x22a896>this['maxNumberOriginate']){_0x22a896=this[_0x9e73('0x20')];}_0x5beaf9[_0x9e73('0x1f0')]+=_0x22a896;this[_0x9e73('0xba')](_0x5beaf9['id'],_0x22a896,_0x5beaf9[_0x9e73('0x1f1')])[_0x9e73('0xae')](function(_0x2d2e59){_0x5beaf9[_0x9e73('0x1f0')]-=_0x22a896;_0x5beaf9['temp']=_0x5beaf9[_0x9e73('0x1f0')]>0x0?_0x5beaf9[_0x9e73('0x1f0')]:0x0;if(!checkContactEmpty(_0x2d2e59)){_0x5beaf9[_0x9e73('0x37')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x9e73('0x77')](_0x9e73('0x1f2')+_0x5beaf9[_0x9e73('0x3b')]);}else{_0x5beaf9['originated']+=_0x2d2e59[_0x9e73('0x1f3')];_0x5beaf9[_0x9e73('0x37')]=_0x9e73('0x1f4');for(var _0xee2ebc=0x0;_0xee2ebc<_0x2d2e59['length'];_0xee2ebc+=0x1){_0x5beaf9[_0x9e73('0x1f5')]+=0x1;if(_[_0x9e73('0xa3')](_0x2d2e59[_0xee2ebc])||_[_0x9e73('0xa3')](_0x2d2e59[_0xee2ebc][_0x9e73('0x14c')])||_[_0x9e73('0xa3')](_0x2d2e59[_0xee2ebc][_0x9e73('0x14c')][_0x9e73('0x14b')])){_0x978d66[_0x9e73('0xc0')]('[actionOriginate]\x20',_0x5beaf9,_0x2d2e59[_0xee2ebc]);}else{_0x978d66['checkIsBlackListIvr'](_['pick'](_0x2d2e59[_0xee2ebc],[_0x9e73('0x10a'),_0x9e73('0x1f6')]))['then'](_0x978d66[_0x9e73('0x1d5')](_0x5beaf9,_0x2d2e59[_0xee2ebc]))[_0x9e73('0xa7')](_0x978d66[_0x9e73('0xbf')]('[actionOriginateIvr]\x20',_0x5beaf9));}}}})[_0x9e73('0xa7')](loggerGetContactDialer('[getContactCampaign2]',_0x5beaf9,_0x22a896));}};Dialer['prototype'][_0x9e73('0x13a')]=function(_0x1c0fc2,_0x4ca8a2){var _0x34b2cf=this;var _0x45ab51=[];var _0xeb9ced=_0x4ca8a2>=0x1?_0x4ca8a2:0x1;var _0x18b97a=[];if(_0x1c0fc2[_0x9e73('0x56')]==='booked'){_0xeb9ced=0x1;}var _0x1ae666=Math[_0x9e73('0x1d1')](_0x1c0fc2[_0x9e73('0x4d')]*_0xeb9ced)-_0x1c0fc2['originated']-_0x1c0fc2['temp'];emitVoiceQueueSummary(_0x1c0fc2);if(_0x1c0fc2['dialLimitQueue']>0x0){var _0x1f8b3d=_0x1c0fc2[_0x9e73('0x1f7')]-_0x1c0fc2[_0x9e73('0x6a')]-_0x1c0fc2['talking']-_0x1c0fc2[_0x9e73('0x1f0')]-_0x1c0fc2[_0x9e73('0x4f')];if(_0x1ae666>_0x1f8b3d){_0x1ae666=_0x1f8b3d;}}if(_0x1ae666>0x0){if(_0x1c0fc2[_0x9e73('0x56')]===_0x9e73('0x6')){_0x1ae666=0x1;}if(_0x1ae666>this[_0x9e73('0x20')]){_0x1ae666=this[_0x9e73('0x20')];}_0x1c0fc2[_0x9e73('0x1f0')]+=_0x1ae666;for(var _0x37de5e in this[_0x9e73('0x1e')]){if(this[_0x9e73('0x1e')][_0x9e73('0x8f')](_0x37de5e)){if(this[_0x9e73('0x1e')][_0x37de5e][_0x9e73('0x9b')]==='not_inuse'&&this[_0x9e73('0x1e')][_0x37de5e][_0x9e73('0xa5')]==='reachable'){_0x45ab51[_0x9e73('0x111')](this[_0x9e73('0x1e')][_0x37de5e]['id']);}}}this[_0x9e73('0xb8')](_0x1c0fc2['id'],_0x45ab51,_0x1ae666,_0x1c0fc2[_0x9e73('0x1f1')])['then'](function(_0x22076a){_0x1c0fc2['temp']-=_0x1ae666;_0x1c0fc2[_0x9e73('0x1f0')]=_0x1c0fc2[_0x9e73('0x1f0')]>0x0?_0x1c0fc2[_0x9e73('0x1f0')]:0x0;if(!checkContactEmpty(_0x22076a)){_0x34b2cf[_0x9e73('0xac')](_0x1c0fc2)[_0x9e73('0xae')](sendMessageReschedule(_0x1c0fc2))[_0x9e73('0xa7')](loggerCatch('[countReScheduled]\x20'));}else{_0x1c0fc2['originated']+=_0x22076a[_0x9e73('0x1f3')];_0x1c0fc2[_0x9e73('0x37')]=_0x1c0fc2[_0x9e73('0x56')]==='booked'?_0x9e73('0x1f8'):_0x9e73('0x1f4');for(var _0x684fe4=0x0;_0x684fe4<_0x22076a['length'];_0x684fe4+=0x1){if(_[_0x9e73('0xa3')](_0x22076a[_0x684fe4])||_[_0x9e73('0xa3')](_0x22076a[_0x684fe4]['Contact'])||_[_0x9e73('0xa3')](_0x22076a[_0x684fe4][_0x9e73('0x14c')][_0x9e73('0x14b')])){_0x34b2cf[_0x9e73('0xc0')](_0x9e73('0x1f9'),_0x1c0fc2,_0x22076a[_0x684fe4]);}else{_0x34b2cf[_0x9e73('0xb0')](_[_0x9e73('0x112')](_0x22076a[_0x684fe4],['VoiceQueueId',_0x9e73('0x1f6')]))[_0x9e73('0xae')](_0x34b2cf[_0x9e73('0x1d5')](_0x1c0fc2,_0x22076a[_0x684fe4]))[_0x9e73('0xa7')](_0x34b2cf[_0x9e73('0xbf')](_0x9e73('0x1f9'),_0x1c0fc2));}}}})[_0x9e73('0xa7')](loggerGetContactDialer(_0x9e73('0x1fa'),_0x1c0fc2,_0x1ae666));}};Dialer[_0x9e73('0x9f')][_0x9e73('0x88')]=function(_0xe9984e){var _0x214e64=this;if(_0xe9984e['dialLimitQueue']>0x0){var _0x2434aa=_0xe9984e['dialLimitQueue']-_0xe9984e[_0x9e73('0x6a')]-_0xe9984e['talking'];if(_0x2434aa>0x0){this['tryOriginatePredictive'](_0xe9984e);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x9e73('0x1fb')](_0xe9984e);}};Dialer[_0x9e73('0x9f')]['tryOriginatePredictive']=function(_0x5e70fd){var _0x302530=this;var _0x59ff60=[];_0x5e70fd[_0x9e73('0x6a')]+=0x1;for(var _0x581e13 in this['agents']){if(this[_0x9e73('0x1e')]['hasOwnProperty'](_0x581e13)){if(this[_0x9e73('0x1e')][_0x581e13][_0x9e73('0x9b')]===_0x9e73('0x1fc')&&this['agents'][_0x581e13][_0x9e73('0xa5')]===_0x9e73('0xcb')){_0x59ff60[_0x9e73('0x111')](this[_0x9e73('0x1e')][_0x581e13]['id']);}}}this[_0x9e73('0xb8')](_0x5e70fd['id'],_0x59ff60,0x1,_0x5e70fd['dialOrderByScheduledAt'])[_0x9e73('0xae')](function(_0x26dd7a){if(!checkContactEmpty(_0x26dd7a)){checkContactLowerLimitOriginate(_0x5e70fd,0x1,0x0);_0x302530[_0x9e73('0xac')](_0x5e70fd)['then'](sendMessageReschedule(_0x5e70fd))[_0x9e73('0xa7')](loggerCatch(_0x9e73('0xaf')));}else{_0x5e70fd[_0x9e73('0x37')]='RUNNING';if(_[_0x9e73('0xa3')](_0x26dd7a[0x0])||_['isNil'](_0x26dd7a[0x0]['Contact'])||_[_0x9e73('0xa3')](_0x26dd7a[0x0][_0x9e73('0x14c')][_0x9e73('0x14b')])){_0x302530['emptyContact'](_0x9e73('0x1f9'),_0x5e70fd,_0x26dd7a[0x0]);}else{_0x302530[_0x9e73('0xb0')](_['pick'](_0x26dd7a[0x0],['VoiceQueueId',_0x9e73('0x1f6')]))[_0x9e73('0xae')](_0x302530[_0x9e73('0x1d5')](_0x5e70fd,_0x26dd7a[0x0]))[_0x9e73('0xa7')](_0x302530[_0x9e73('0xbf')](_0x9e73('0x1fd'),_0x5e70fd));}}})[_0x9e73('0xa7')](loggerGetContactDialer(_0x9e73('0x1fe'),_0x5e70fd,0x1));emitVoiceQueueSummary(_0x5e70fd);};Dialer['prototype']['abandonmentRate']=function(_0x3960d3,_0x390810,_0x409f97,_0x3a2d01,_0x361202,_0x544bcb){loggerPredictive[_0x9e73('0x77')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x9e73('0x77')]('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',_0x3960d3);loggerPredictive['info'](_0x9e73('0x1ff'),_0x390810);loggerPredictive[_0x9e73('0x77')](_0x9e73('0x200'),_0x409f97);loggerPredictive[_0x9e73('0x77')](_0x9e73('0x201'),_0x3a2d01);loggerPredictive[_0x9e73('0x77')](_0x9e73('0x202'),_0x361202);loggerPredictive[_0x9e73('0x77')](_0x9e73('0x7e'));return new BPromise(function(_0x31397c,_0x992c44){if(_0x3960d3<=0x0||isNaN(_0x3960d3)){return _0x992c44(msgResponse('[abandonmentRate]',_0x9e73('0x43'),_0x9e73('0x203')+_0x3960d3));}if(_0x409f97<=0x0||isNaN(_0x409f97)){return _0x992c44(msgResponse(_0x9e73('0x204'),_0x9e73('0x43'),_0x9e73('0x205')+_0x409f97));}if(_0x3a2d01<=0x0||isNaN(_0x3a2d01)){return _0x992c44(msgResponse(_0x9e73('0x204'),'Error',_0x9e73('0x206')+_0x3a2d01));}if(_0x390810<=0x0||isNaN(_0x390810)){return _0x992c44(msgResponse(_0x9e73('0x204'),_0x9e73('0x43'),_0x9e73('0x207')+_0x390810));}if(_0x361202<=0x0||isNaN(_0x361202)){return _0x992c44(msgResponse(_0x9e73('0x204'),_0x9e73('0x43'),_0x9e73('0x208')+_0x361202));}_0x544bcb=_0x544bcb||0x0;var _0x2c6c9d=0x1/_0x409f97;var _0x5dafb4=0x0;var _0x270d7f=0x0;var _0x33e4c8=0x0;var _0x53223d=0x0;for(var _0x596eeb=0x0;_0x33e4c8<_0x361202;_0x596eeb+=0x1){_0x270d7f=_0x596eeb/_0x390810;_0x5dafb4=(_0x3a2d01*_0x270d7f+_0x544bcb)/_0x2c6c9d;_0x33e4c8=erlangb(_0x5dafb4,_0x3960d3);_0x53223d=_0x5dafb4/_0x3960d3*(0x1-erlangb(_0x5dafb4,_0x3960d3));}return _0x31397c({'erlangCalls':_0x596eeb,'erlangCallToSecond':_0x390810/_0x596eeb,'erlangAbandonmentRate':_0x33e4c8,'erlangBusyFactor':_0x53223d});});};Dialer[_0x9e73('0x9f')][_0x9e73('0x1c9')]=function(_0x299658,_0x356bd3,_0x421b8b,_0x3558fc,_0x4e102c,_0x1d29df){loggerPredictive['info'](_0x9e73('0x209'));loggerPredictive['info'](_0x9e73('0x20a'),_0x299658);loggerPredictive[_0x9e73('0x77')](_0x9e73('0x1ff'),_0x356bd3);loggerPredictive[_0x9e73('0x77')](_0x9e73('0x200'),_0x421b8b);loggerPredictive[_0x9e73('0x77')]('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',_0x3558fc);loggerPredictive[_0x9e73('0x77')](_0x9e73('0x20b'),_0x4e102c);loggerPredictive['info'](_0x9e73('0x7e'));return new BPromise(function(_0x4ec90a,_0x98d8be){if(_0x299658<=0x0||isNaN(_0x299658)){return _0x98d8be(msgResponse(_0x9e73('0x20c'),_0x9e73('0x43'),_0x9e73('0x203')+_0x299658));}if(_0x421b8b<=0x0||isNaN(_0x421b8b)){return _0x98d8be(msgResponse('[busyFactor]',_0x9e73('0x43'),_0x9e73('0x205')+_0x421b8b));}if(_0x3558fc<=0x0||isNaN(_0x3558fc)){return _0x98d8be(msgResponse('[busyFactor]','Error',_0x9e73('0x206')+_0x3558fc));}if(_0x356bd3<=0x0||isNaN(_0x356bd3)){return _0x98d8be(msgResponse('[busyFactor]',_0x9e73('0x43'),'interval\x20=\x20'+_0x356bd3));}if(_0x4e102c<=0x0||isNaN(_0x4e102c)){return _0x98d8be(msgResponse(_0x9e73('0x20c'),_0x9e73('0x43'),_0x9e73('0x20d')+_0x4e102c));}_0x1d29df=_0x1d29df||0x0;var _0x3aedf8=0x1/_0x421b8b;var _0x1c354f=0x0;var _0x29c29e=0x0;var _0x433a61=0x0;var _0x327924=0x0;for(var _0x9f373b=0x0;_0x327924<_0x4e102c;_0x9f373b+=0x1){_0x29c29e=_0x9f373b/_0x356bd3;_0x1c354f=(_0x3558fc*_0x29c29e+_0x1d29df)/_0x3aedf8;_0x433a61=erlangb(_0x1c354f,_0x299658);_0x327924=_0x1c354f/_0x299658*(0x1-erlangb(_0x1c354f,_0x299658));}return _0x4ec90a({'erlangCalls':_0x9f373b,'erlangCallToSecond':_0x356bd3/_0x9f373b,'erlangAbandonmentRate':_0x433a61,'erlangBusyFactor':_0x327924});});};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 e46aefc..ba45efa 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 _0xbe0d=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound'];(function(_0x4f8f52,_0x3b0d98){var _0x4c9eaf=function(_0x455595){while(--_0x455595){_0x4f8f52['push'](_0x4f8f52['shift']());}};_0x4c9eaf(++_0x3b0d98);}(_0xbe0d,0x14f));var _0xdbe0=function(_0x56dc98,_0x1357fc){_0x56dc98=_0x56dc98-0x0;var _0x2202d4=_0xbe0d[_0x56dc98];return _0x2202d4;};'use strict';var util=require(_0xdbe0('0x0'));var _=require(_0xdbe0('0x1'));var moment=require(_0xdbe0('0x2'));function getSeconds(_0x23cba5,_0xb08f7a){var _0x11ed0c=moment(_0x23cba5)[_0xdbe0('0x3')](0x0);var _0x2afd64=moment(_0xb08f7a)['milliseconds'](0x0);return _0x11ed0c['diff'](_0x2afd64,_0xdbe0('0x4'));}function QueueCallerAbandon(_0x27f7ae,_0x16f02b){this[_0xdbe0('0x5')]=_0x27f7ae['scheduledat'];this[_0xdbe0('0x6')]=_0x27f7ae[_0xdbe0('0x6')];this[_0xdbe0('0x7')]=_0x27f7ae[_0xdbe0('0x6')]===_0xdbe0('0x8')?_0xdbe0('0x9'):_0x27f7ae['type'];this[_0xdbe0('0xa')]=_0x27f7ae[_0xdbe0('0xa')];this[_0xdbe0('0xb')]=_0x27f7ae[_0xdbe0('0xb')];this['countnoanswerretry']=_0x27f7ae[_0xdbe0('0xc')];this[_0xdbe0('0xd')]=_0x27f7ae[_0xdbe0('0xa')]+_0x27f7ae[_0xdbe0('0xb')]+_0x27f7ae[_0xdbe0('0xc')]+_0x27f7ae[_0xdbe0('0xe')]+_0x27f7ae[_0xdbe0('0xf')]+_0x27f7ae[_0xdbe0('0x10')]+_0x27f7ae[_0xdbe0('0x11')]+_0x27f7ae[_0xdbe0('0x12')];this['countnosuchnumberretry']=_0x27f7ae['countnosuchnumberretry'];this[_0xdbe0('0xf')]=_0x27f7ae[_0xdbe0('0xf')];this[_0xdbe0('0x10')]=_0x27f7ae[_0xdbe0('0x10')];this[_0xdbe0('0x11')]=_0x27f7ae[_0xdbe0('0x11')];this[_0xdbe0('0x12')]=_0x27f7ae[_0xdbe0('0x12')];this['uniqueid']=_0x16f02b[_0xdbe0('0x13')];this[_0xdbe0('0x14')]=_0x27f7ae['name'];this[_0xdbe0('0x15')]=_0x27f7ae[_0xdbe0('0x16')];this[_0xdbe0('0x17')]=_0x27f7ae[_0xdbe0('0x17')];this['responsetime']=_0x27f7ae[_0xdbe0('0x18')];this[_0xdbe0('0x19')]=_0x27f7ae[_0xdbe0('0x19')];this['endtime']=this['droptime'];this['ringtime']=getSeconds(_0x27f7ae[_0xdbe0('0x18')],_0x27f7ae[_0xdbe0('0x17')]);this[_0xdbe0('0x1a')]=getSeconds(this[_0xdbe0('0x19')],_0x27f7ae[_0xdbe0('0x18')]);this[_0xdbe0('0x1b')]=0x0;this['queue']=_0x16f02b[_0xdbe0('0x9')];this[_0xdbe0('0x1c')]=_0x16f02b[_0xdbe0('0x1d')];this[_0xdbe0('0x1e')]=_0x16f02b['reason'];this[_0xdbe0('0x1f')]=_0x27f7ae[_0xdbe0('0x1f')];this['callbackuniqueid']=_0x27f7ae[_0xdbe0('0x20')];this[_0xdbe0('0x21')]=_0x27f7ae[_0xdbe0('0x21')];this[_0xdbe0('0x22')]=_0x27f7ae[_0xdbe0('0x22')];this[_0xdbe0('0x23')]=_0x27f7ae[_0xdbe0('0x23')];this[_0xdbe0('0x24')]=_0x27f7ae['ListId'];this[_0xdbe0('0x25')]=_0x27f7ae['UserId'];this['VoiceQueueId']=_0x27f7ae[_0xdbe0('0x26')];this[_0xdbe0('0x27')]=_0x27f7ae['CampaignId'];this[_0xdbe0('0x28')]=_0x27f7ae['originatecalleridnum']||'';this[_0xdbe0('0x29')]=_0x27f7ae['originatecalleridname']||'';}module[_0xdbe0('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0x0dc8=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','starttime','responsetime','endtime','droptime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','lodash','milliseconds','seconds','scheduledat'];(function(_0x34a62c,_0x353cbe){var _0x5c3f14=function(_0x229623){while(--_0x229623){_0x34a62c['push'](_0x34a62c['shift']());}};_0x5c3f14(++_0x353cbe);}(_0x0dc8,0x74));var _0x80dc=function(_0x346dba,_0x4301dd){_0x346dba=_0x346dba-0x0;var _0x3fafe1=_0x0dc8[_0x346dba];return _0x3fafe1;};'use strict';var util=require('util');var _=require(_0x80dc('0x0'));var moment=require('moment');function getSeconds(_0x144d7e,_0x1e9cfc){var _0x28e850=moment(_0x144d7e)[_0x80dc('0x1')](0x0);var _0x206b01=moment(_0x1e9cfc)[_0x80dc('0x1')](0x0);return _0x28e850['diff'](_0x206b01,_0x80dc('0x2'));}function QueueCallerAbandon(_0x29d138,_0x83372b){this[_0x80dc('0x3')]=_0x29d138[_0x80dc('0x3')];this[_0x80dc('0x4')]=_0x29d138[_0x80dc('0x4')];this[_0x80dc('0x5')]=_0x29d138[_0x80dc('0x4')]===_0x80dc('0x6')?_0x80dc('0x7'):_0x29d138[_0x80dc('0x4')];this[_0x80dc('0x8')]=_0x29d138[_0x80dc('0x8')];this[_0x80dc('0x9')]=_0x29d138[_0x80dc('0x9')];this[_0x80dc('0xa')]=_0x29d138[_0x80dc('0xa')];this[_0x80dc('0xb')]=_0x29d138[_0x80dc('0x8')]+_0x29d138[_0x80dc('0x9')]+_0x29d138[_0x80dc('0xa')]+_0x29d138[_0x80dc('0xc')]+_0x29d138['countdropretry']+_0x29d138[_0x80dc('0xd')]+_0x29d138[_0x80dc('0xe')]+_0x29d138[_0x80dc('0xf')];this[_0x80dc('0xc')]=_0x29d138[_0x80dc('0xc')];this[_0x80dc('0x10')]=_0x29d138[_0x80dc('0x10')];this[_0x80dc('0xd')]=_0x29d138[_0x80dc('0xd')];this[_0x80dc('0xe')]=_0x29d138[_0x80dc('0xe')];this[_0x80dc('0xf')]=_0x29d138[_0x80dc('0xf')];this[_0x80dc('0x11')]=_0x83372b[_0x80dc('0x11')];this[_0x80dc('0x12')]=_0x29d138[_0x80dc('0x13')];this['calleridnum']=_0x29d138['number'];this[_0x80dc('0x14')]=_0x29d138[_0x80dc('0x14')];this[_0x80dc('0x15')]=_0x29d138['responsetime'];this['droptime']=_0x29d138['droptime'];this[_0x80dc('0x16')]=this[_0x80dc('0x17')];this['ringtime']=getSeconds(_0x29d138[_0x80dc('0x15')],_0x29d138[_0x80dc('0x14')]);this[_0x80dc('0x18')]=getSeconds(this[_0x80dc('0x17')],_0x29d138[_0x80dc('0x15')]);this[_0x80dc('0x19')]=0x0;this[_0x80dc('0x7')]=_0x83372b[_0x80dc('0x7')];this[_0x80dc('0x1a')]=_0x83372b[_0x80dc('0x1b')];this['reason']=_0x83372b[_0x80dc('0x1c')];this['callback']=_0x29d138[_0x80dc('0x1d')];this['callbackuniqueid']=_0x29d138[_0x80dc('0x1e')];this[_0x80dc('0x1f')]=_0x29d138['callbackat'];this[_0x80dc('0x20')]=_0x29d138['recallme'];this[_0x80dc('0x21')]=_0x29d138[_0x80dc('0x21')];this['ListId']=_0x29d138[_0x80dc('0x22')];this['UserId']=_0x29d138[_0x80dc('0x23')];this[_0x80dc('0x24')]=_0x29d138[_0x80dc('0x24')];this['CampaignId']=_0x29d138[_0x80dc('0x25')];this['originatecalleridnum']=_0x29d138['originatecalleridnum']||'';this[_0x80dc('0x26')]=_0x29d138[_0x80dc('0x26')]||'';}module[_0x80dc('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 24c6f08..6b3ca5a 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 _0xa322=['path','AttachmentId','exports','util','moment','channel','format','tech','Trunk','name','fax','localstationid','headerinfo'];(function(_0x2c02a8,_0x3f3f4d){var _0x2bb341=function(_0x45d010){while(--_0x45d010){_0x2c02a8['push'](_0x2c02a8['shift']());}};_0x2bb341(++_0x3f3f4d);}(_0xa322,0x121));var _0x2a32=function(_0x522253,_0x3b87c7){_0x522253=_0x522253-0x0;var _0x51e302=_0xa322[_0x522253];return _0x51e302;};'use strict';var util=require(_0x2a32('0x0'));var _=require('lodash');var moment=require(_0x2a32('0x1'));function Action(_0x56352d,_0x1b53d3,_0x443807){this['uniqueid']=_0x56352d||undefined;this[_0x2a32('0x2')]=util[_0x2a32('0x3')]('%s/%s/%s',_0x1b53d3[_0x2a32('0x4')],_0x1b53d3[_0x2a32('0x5')][_0x2a32('0x6')],_0x443807[_0x2a32('0x7')]);this[_0x2a32('0x8')]=_0x1b53d3[_0x2a32('0x8')];this[_0x2a32('0x9')]=_0x1b53d3[_0x2a32('0x9')];this[_0x2a32('0xa')]=_0x443807['path'];this[_0x2a32('0xb')]=_0x443807[_0x2a32('0xb')];}module[_0x2a32('0xc')]=Action; \ No newline at end of file +var _0xd221=['AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk','name','fax','localstationid','headerinfo','path'];(function(_0x509943,_0x43dd61){var _0x5d6e25=function(_0x3b7e1c){while(--_0x3b7e1c){_0x509943['push'](_0x509943['shift']());}};_0x5d6e25(++_0x43dd61);}(_0xd221,0x1d3));var _0x1d22=function(_0x34a7e2,_0x221310){_0x34a7e2=_0x34a7e2-0x0;var _0x363cd3=_0xd221[_0x34a7e2];return _0x363cd3;};'use strict';var util=require(_0x1d22('0x0'));var _=require(_0x1d22('0x1'));var moment=require(_0x1d22('0x2'));function Action(_0x21b904,_0x35e721,_0x2e215b){this['uniqueid']=_0x21b904||undefined;this[_0x1d22('0x3')]=util[_0x1d22('0x4')](_0x1d22('0x5'),_0x35e721[_0x1d22('0x6')],_0x35e721[_0x1d22('0x7')][_0x1d22('0x8')],_0x2e215b[_0x1d22('0x9')]);this[_0x1d22('0xa')]=_0x35e721[_0x1d22('0xa')];this[_0x1d22('0xb')]=_0x35e721[_0x1d22('0xb')];this[_0x1d22('0xc')]=_0x2e215b[_0x1d22('0xc')];this[_0x1d22('0xd')]=_0x2e215b[_0x1d22('0xd')];}module[_0x1d22('0xe')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index c862c28..8a8cb9b 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 _0xaa76=['operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','then','.pdf','error','\x20notify\x20','stringify','catch','\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][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','fax','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','path','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','uniqueid','name','info','\x20syncNewchannel\x20','channel','prototype','variable','value','channelstate','channelstatedesc','syncFaxStatus'];(function(_0x270207,_0x39da19){var _0x4eb460=function(_0xc0a566){while(--_0xc0a566){_0x270207['push'](_0x270207['shift']());}};_0x4eb460(++_0x39da19);}(_0xaa76,0xbb));var _0x6aa7=function(_0x55a08d,_0x289a81){_0x55a08d=_0x55a08d-0x0;var _0x488efa=_0xaa76[_0x55a08d];return _0x488efa;};'use strict';var util=require(_0x6aa7('0x0'));var _=require(_0x6aa7('0x1'));var BPromise=require(_0x6aa7('0x2'));var uuid=require('uuid');var moment=require('moment');var path=require(_0x6aa7('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x6aa7('0x4'));var logger=require(_0x6aa7('0x5'))('fax');var ami=require(_0x6aa7('0x6'));var rpcDb=require(_0x6aa7('0x7'));var Channel=require(_0x6aa7('0x8'));var ut=require(_0x6aa7('0x9'));var Action=require(_0x6aa7('0xa'));var faxAccount=require(_0x6aa7('0xb'));var attachment=require(_0x6aa7('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5d774c){this[_0x6aa7('0xd')]={};this['faxAccounts']=_0x5d774c[_0x6aa7('0xe')];this['trunks']=_0x5d774c[_0x6aa7('0xf')];this[_0x6aa7('0x10')]={};ami['on'](_0x6aa7('0x11'),this[_0x6aa7('0x12')][_0x6aa7('0x13')](this));ami['on'](_0x6aa7('0x14'),this[_0x6aa7('0x15')][_0x6aa7('0x13')](this));ami['on'](_0x6aa7('0x16'),this[_0x6aa7('0x17')]['bind'](this));ami['on']('newexten',this[_0x6aa7('0x18')][_0x6aa7('0x13')](this));ami['on'](_0x6aa7('0x19'),this['syncFaxStatus']['bind'](this));ami['on'](_0x6aa7('0x1a'),this[_0x6aa7('0x1b')][_0x6aa7('0x13')](this));ami['on'](_0x6aa7('0x1c'),this[_0x6aa7('0x1d')]['bind'](this));ami['on'](_0x6aa7('0x1e'),this[_0x6aa7('0x1f')][_0x6aa7('0x13')](this));}Fax['prototype'][_0x6aa7('0x12')]=function(_0x4b6e4b){if(_0x4b6e4b[_0x6aa7('0x20')]===_0x6aa7('0x21')){for(var _0x5a9d06 in this['faxAccounts']){if(this[_0x6aa7('0xe')][_0x6aa7('0x22')](_0x5a9d06)){if(_0x4b6e4b[_0x6aa7('0x23')]===this[_0x6aa7('0xe')][_0x5a9d06]['localstationid']){this[_0x6aa7('0xd')][_0x4b6e4b[_0x6aa7('0x24')]]={};this[_0x6aa7('0xd')][_0x4b6e4b[_0x6aa7('0x24')]]['channel']=_0x4b6e4b['channel'];this[_0x6aa7('0xd')][_0x4b6e4b[_0x6aa7('0x24')]]['id']=this[_0x6aa7('0xe')][_0x5a9d06]['id'];this['channels'][_0x4b6e4b[_0x6aa7('0x24')]][_0x6aa7('0x25')]=this['faxAccounts'][_0x5a9d06][_0x6aa7('0x25')];logger[_0x6aa7('0x26')](_0x4b6e4b['uniqueid'],_0x6aa7('0x27'));}}}}if(this[_0x6aa7('0x10')][_0x4b6e4b[_0x6aa7('0x24')]]){this[_0x6aa7('0xd')][_0x4b6e4b[_0x6aa7('0x24')]]={};this['channels'][_0x4b6e4b[_0x6aa7('0x24')]][_0x6aa7('0x28')]=_0x4b6e4b[_0x6aa7('0x28')];logger['info'](_0x4b6e4b[_0x6aa7('0x24')],_0x6aa7('0x27'));}};Fax[_0x6aa7('0x29')]['syncVarSet']=function(_0x8ad2e2){if(this['channels'][_0x8ad2e2[_0x6aa7('0x24')]]){for(var _0x5b0273 in _0x8ad2e2[_0x6aa7('0x2a')]){if(_0x8ad2e2[_0x6aa7('0x2a')][_0x6aa7('0x22')](_0x5b0273)){this[_0x6aa7('0xd')][_0x8ad2e2['uniqueid']][_0x5b0273]=_0x8ad2e2[_0x6aa7('0x2b')];}}}};Fax[_0x6aa7('0x29')][_0x6aa7('0x17')]=function(_0x4b1a8c){if(this[_0x6aa7('0xd')][_0x4b1a8c['uniqueid']]){this['channels'][_0x4b1a8c['uniqueid']][_0x6aa7('0x2c')]=_0x4b1a8c['channelstate'];this[_0x6aa7('0xd')][_0x4b1a8c['uniqueid']][_0x6aa7('0x2d')]=_0x4b1a8c[_0x6aa7('0x2d')];}};Fax[_0x6aa7('0x29')][_0x6aa7('0x18')]=function(_0x5db446){if(this[_0x6aa7('0xd')][_0x5db446[_0x6aa7('0x24')]]){for(var _0x205f5f in _0x5db446[_0x6aa7('0x2a')]){if(_0x5db446[_0x6aa7('0x2a')][_0x6aa7('0x22')](_0x205f5f)){this[_0x6aa7('0xd')][_0x5db446['uniqueid']][_0x205f5f]=_0x5db446[_0x6aa7('0x2b')];}}}};Fax[_0x6aa7('0x29')][_0x6aa7('0x2e')]=function(_0x56ce57){if(this[_0x6aa7('0xd')][_0x56ce57[_0x6aa7('0x24')]]){this[_0x6aa7('0xd')][_0x56ce57[_0x6aa7('0x24')]][_0x6aa7('0x2f')]=_0x56ce57[_0x6aa7('0x2f')];this[_0x6aa7('0xd')][_0x56ce57[_0x6aa7('0x24')]][_0x6aa7('0x30')]=_0x56ce57[_0x6aa7('0x30')];this[_0x6aa7('0xd')][_0x56ce57[_0x6aa7('0x24')]][_0x6aa7('0x31')]=_0x56ce57['localstationid'];this[_0x6aa7('0xd')][_0x56ce57[_0x6aa7('0x24')]][_0x6aa7('0x32')]=_0x56ce57[_0x6aa7('0x32')];logger['info'](_0x56ce57[_0x6aa7('0x24')],_0x6aa7('0x33'));}};Fax[_0x6aa7('0x29')][_0x6aa7('0x1b')]=function(_0x3548db){var _0xb6d3a1=this;if(this[_0x6aa7('0xd')][_0x3548db[_0x6aa7('0x24')]]){var _0x404dbf=this[_0x6aa7('0xd')][_0x3548db[_0x6aa7('0x24')]]['id'];this[_0x6aa7('0xd')][_0x3548db[_0x6aa7('0x24')]][_0x6aa7('0x34')]=_0x3548db[_0x6aa7('0x34')];this[_0x6aa7('0xd')][_0x3548db[_0x6aa7('0x24')]][_0x6aa7('0x35')]=_0x3548db['pagestransferred'];this[_0x6aa7('0xd')][_0x3548db[_0x6aa7('0x24')]][_0x6aa7('0x31')]=_0x3548db[_0x6aa7('0x31')];this[_0x6aa7('0xd')][_0x3548db[_0x6aa7('0x24')]][_0x6aa7('0x36')]=_0x3548db[_0x6aa7('0x36')];this[_0x6aa7('0xd')][_0x3548db[_0x6aa7('0x24')]][_0x6aa7('0x37')]=_0x3548db[_0x6aa7('0x37')];this[_0x6aa7('0xd')][_0x3548db[_0x6aa7('0x24')]][_0x6aa7('0x32')]=_0x3548db['filename'];this[_0x6aa7('0xd')][_0x3548db[_0x6aa7('0x24')]][_0x6aa7('0x38')]=_0x3548db['calleridnum'];if(this[_0x6aa7('0xd')][_0x3548db[_0x6aa7('0x24')]]['pagestransferred']>0x0){tiff2pdf(_0x3548db[_0x6aa7('0x32')],_0x6aa7('0x39'),function(_0x3b73d3){logger[_0x6aa7('0x26')](_0x3548db[_0x6aa7('0x24')],'\x20result\x20conversion\x20file\x20',_0x3b73d3[_0x6aa7('0x3a')]);attachment[_0x6aa7('0x3b')]({'name':path[_0x6aa7('0x3c')](_0x3548db[_0x6aa7('0x32')])[_0x6aa7('0x25')],'basename':path[_0x6aa7('0x3c')](_0x3548db['filename'])['name']+'.pdf','type':'application/pdf'})[_0x6aa7('0x3d')](function(_0x4935b4){faxAccount['notify'](_0x404dbf,{'from':_0x3548db[_0x6aa7('0x38')],'mapKey':'fax','body':path[_0x6aa7('0x3c')](_0x3548db[_0x6aa7('0x32')])[_0x6aa7('0x25')]+_0x6aa7('0x3e'),'AttachmentId':_0x4935b4['id']})['catch'](function(_0x58c676){logger[_0x6aa7('0x3f')](_0x3548db['uniqueid'],_0x6aa7('0x40'),JSON[_0x6aa7('0x41')](_0x58c676));});})[_0x6aa7('0x42')](function(_0x2f4c71){logger[_0x6aa7('0x3f')](_0x3548db[_0x6aa7('0x24')],_0x6aa7('0x43'),JSON[_0x6aa7('0x41')](_0x2f4c71));});});}logger[_0x6aa7('0x26')](_0x3548db['uniqueid'],_0x6aa7('0x43'));}};Fax[_0x6aa7('0x29')]['syncOriginateResponse']=function(_0x4b4e34){if(this[_0x6aa7('0x10')][_0x4b4e34[_0x6aa7('0x24')]]){_[_0x6aa7('0x44')](this[_0x6aa7('0xd')][_0x4b4e34[_0x6aa7('0x24')]],_['pick'](_0x4b4e34,[_0x6aa7('0x45'),_0x6aa7('0x46')]));}};function updateStatus(_0x51ae31){if(_0x51ae31[_0x6aa7('0x47')]){faxMessage[_0x6aa7('0x48')](_0x51ae31[_0x6aa7('0x47')],{'failMessage':_0x6aa7('0x49')})['then'](function(_0x33f91e){ut[_0x6aa7('0x4a')](_0x6aa7('0x4b'),_0x33f91e);})[_0x6aa7('0x42')](function(_0x93ea1){ut[_0x6aa7('0x4a')](_0x6aa7('0x4c'),_0x93ea1);});}else{ut[_0x6aa7('0x4a')](_0x6aa7('0x4d'));}}Fax[_0x6aa7('0x29')][_0x6aa7('0x4e')]=function(_0x176f8d,_0x45a202,_0x5a4035){var _0x12d204=this;var _0x20b608={};if(_0x45a202){_0x20b608={'read':_0x45a202};}else{_0x20b608={'failMessage':_0x5a4035};}if(this['actions'][_0x176f8d]['AttachmentId']){faxMessage[_0x6aa7('0x48')](this[_0x6aa7('0x10')][_0x176f8d][_0x6aa7('0x47')],_0x20b608)[_0x6aa7('0x3d')](function(_0x23b950){ut['logger'](_0x6aa7('0x4f'),_0x23b950);})['catch'](function(_0x2c6610){ut[_0x6aa7('0x4a')](_0x6aa7('0x50'),_0x2c6610);})[_0x6aa7('0x51')](function(){delete _0x12d204[_0x6aa7('0xd')][_0x176f8d];delete _0x12d204[_0x6aa7('0x10')][_0x176f8d];});}else{ut[_0x6aa7('0x4a')](_0x6aa7('0x52'));delete this[_0x6aa7('0xd')][_0x176f8d];delete this[_0x6aa7('0x10')][_0x176f8d];}};Fax[_0x6aa7('0x29')][_0x6aa7('0x1d')]=function(_0x523c9e){var _0x2133d3=this;if(this[_0x6aa7('0xd')][_0x523c9e[_0x6aa7('0x24')]]){if(this['actions'][_0x523c9e[_0x6aa7('0x24')]]){this[_0x6aa7('0xd')][_0x523c9e['uniqueid']]['id']=this[_0x6aa7('0x10')][_0x523c9e[_0x6aa7('0x24')]]['id'];this['channels'][_0x523c9e[_0x6aa7('0x24')]]['name']=this[_0x6aa7('0x10')][_0x523c9e['uniqueid']][_0x6aa7('0x25')];}logger['info'](_0x523c9e[_0x6aa7('0x24')],this[_0x6aa7('0x10')][_0x523c9e[_0x6aa7('0x24')]]?_0x6aa7('0x53'):_0x6aa7('0x54'),JSON[_0x6aa7('0x41')](this['channels'][_0x523c9e['uniqueid']]));if(this[_0x6aa7('0x10')][_0x523c9e[_0x6aa7('0x24')]]){if(this['channels'][_0x523c9e[_0x6aa7('0x24')]][_0x6aa7('0x55')]>0x0&&this[_0x6aa7('0xd')][_0x523c9e[_0x6aa7('0x24')]][_0x6aa7('0x19')]===_0x6aa7('0x56')){this[_0x6aa7('0x4e')](_0x523c9e[_0x6aa7('0x24')],!![]);}else{this[_0x6aa7('0x4e')](_0x523c9e['uniqueid'],![],this[_0x6aa7('0xd')][_0x523c9e[_0x6aa7('0x24')]][_0x6aa7('0x57')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x523c9e['uniqueid']][_0x6aa7('0x57')]:_0x6aa7('0x58'));}}}};Fax[_0x6aa7('0x29')]['send']=function(_0xb8f2a2){var _0x162242=this;return new BPromise(function(_0x213cd7,_0x2e440e){_0x162242['execOriginate'](_0xb8f2a2,_0x162242[_0x6aa7('0xe')][_0xb8f2a2[_0x6aa7('0x59')]])[_0x6aa7('0x3d')](function(_0x1bcce0){ut['logger']('[Fax][execOriginate][success]',_0x1bcce0);_0x213cd7(ut[_0x6aa7('0x3a')](_0x6aa7('0x5a')));})[_0x6aa7('0x42')](function(_0x109ebb){ut[_0x6aa7('0x4a')](_0x6aa7('0x5b'),_0x109ebb);updateStatus(_0xb8f2a2);_0x2e440e(ut['message']('Fax\x20failed'));});});};Fax[_0x6aa7('0x29')]['checkAfterSend']=function(_0x3235fd){var _0x2aa613=this;return new BPromise(function(_0x2c911b,_0x50c122){var _0x237152=_0x2aa613[_0x6aa7('0x5c')](_0x2aa613[_0x6aa7('0xe')][_0x3235fd[_0x6aa7('0x59')]]['Trunk'],_0x3235fd);if(_0x237152[_0x6aa7('0x5d')]){_0x2c911b(ut[_0x6aa7('0x3a')](_0x6aa7('0x5e')));}else{_0x50c122(ut[_0x6aa7('0x3a')](_0x237152[_0x6aa7('0x3a')]));}});};function originate(_0x43ee91,_0x2cbf49,_0x4f75fe){return new BPromise(function(_0x2c6688,_0x3206bd){if(_0x4f75fe){var _0x221052=util[_0x6aa7('0x5f')](_0x6aa7('0x60'),path[_0x6aa7('0x3c')](_0x43ee91[_0x6aa7('0x3')])[_0x6aa7('0x25')],_0x43ee91[_0x6aa7('0x3')]);gs['execute'](_0x221052)[_0x6aa7('0x3d')](function(){_0x43ee91['path']=util[_0x6aa7('0x5f')]('%s/%s.tif',path['parse'](_0x43ee91[_0x6aa7('0x3')])[_0x6aa7('0x61')],path[_0x6aa7('0x3c')](_0x43ee91[_0x6aa7('0x3')])['name']);_0x2cbf49[_0x6aa7('0x62')]=_0x43ee91[_0x6aa7('0x3')];ut[_0x6aa7('0x4a')](_0x6aa7('0x63'),'');ami[_0x6aa7('0x64')](ut[_0x6aa7('0x65')](_0x43ee91,_0x2cbf49))[_0x6aa7('0x3d')](function(_0x1446d6){_0x2c6688(_0x1446d6);})[_0x6aa7('0x42')](function(_0x3552fc){_0x3206bd(_0x3552fc);});})[_0x6aa7('0x42')](function(_0x2717bd){_0x3206bd(_0x2717bd);});}else{ami[_0x6aa7('0x64')](ut[_0x6aa7('0x65')](_0x43ee91,_0x2cbf49))[_0x6aa7('0x3d')](function(_0x355513){_0x2c6688(_0x355513);})[_0x6aa7('0x42')](function(_0x487335){_0x3206bd(_0x487335);});}});}Fax[_0x6aa7('0x29')][_0x6aa7('0x66')]=function(_0x5d751a,_0x174b98){var _0x4b36a7=this;return new BPromise(function(_0x379341,_0x4596ba){var _0x1a1e0d=uuid['v4']();var _0x1de3ce=ut[_0x6aa7('0x67')](_0x5d751a,_0x174b98);_0x4b36a7[_0x6aa7('0x10')][_0x1a1e0d]=new Action(_0x1a1e0d,_0x174b98,_0x5d751a);var _0x3860fe=_0x4b36a7[_0x6aa7('0x10')][_0x1a1e0d];if(path[_0x6aa7('0x3c')](_0x5d751a['path'])['ext']===_0x6aa7('0x3e')){originate(_0x3860fe,_0x1de3ce,!![])['then'](function(_0x51dd93){_0x379341(_0x51dd93);})[_0x6aa7('0x42')](function(_0xcf6a53){_0x4596ba(_0xcf6a53);});}else{originate(_0x3860fe,_0x1de3ce,![])[_0x6aa7('0x3d')](function(_0x573ba8){_0x379341(_0x573ba8);})['catch'](function(_0x481ddc){_0x4596ba(_0x481ddc);});}});};Fax[_0x6aa7('0x29')][_0x6aa7('0x68')]=function(_0x180f7a){return!_[_0x6aa7('0x69')](_0x180f7a)&&!_[_0x6aa7('0x69')](_0x180f7a[_0x6aa7('0x25')])&&!_[_0x6aa7('0x69')](_0x180f7a[_0x6aa7('0x6a')])&&_0x180f7a['active']&&!_[_0x6aa7('0x69')](this[_0x6aa7('0xf')][util[_0x6aa7('0x5f')]('SIP/%s',_0x180f7a[_0x6aa7('0x25')])])&&!_['isNil'](this['trunks'][util[_0x6aa7('0x5f')](_0x6aa7('0x6b'),_0x180f7a[_0x6aa7('0x25')])]['status'])&&(this[_0x6aa7('0xf')][util[_0x6aa7('0x5f')]('SIP/%s',_0x180f7a['name'])]['status']===_0x6aa7('0x6c')||this[_0x6aa7('0xf')][util[_0x6aa7('0x5f')](_0x6aa7('0x6b'),_0x180f7a['name'])][_0x6aa7('0x30')]===_0x6aa7('0x6d'));};Fax[_0x6aa7('0x29')][_0x6aa7('0x5c')]=function(_0x3613b0,_0x229e06){if(!this['isTrunkReachable'](_0x3613b0)){ut[_0x6aa7('0x4a')](_0x6aa7('0x6e'),_['isNil'](_0x3613b0)?'':_0x3613b0['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x6aa7('0x6f')};}if(_['isNil'](_0x229e06[_0x6aa7('0x70')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x6aa7('0x41')](_0x229e06));return{'isValid':![],'message':_0x6aa7('0x71')};}if(_[_0x6aa7('0x69')](_0x229e06['path'])){ut[_0x6aa7('0x4a')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x6aa7('0x41')](_0x229e06));return{'isValid':![],'message':_0x6aa7('0x72')};}return{'isValid':!![],'message':_0x6aa7('0x73')};};module[_0x6aa7('0x74')]=Fax; \ No newline at end of file +var _0x5da3=['merge','pick','response','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','format','execute','%s/%s.tif','dir','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','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','channelstate','channelstatedesc','variable','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20'];(function(_0x335b3d,_0x41be67){var _0x55a966=function(_0x2409c6){while(--_0x2409c6){_0x335b3d['push'](_0x335b3d['shift']());}};_0x55a966(++_0x41be67);}(_0x5da3,0x123));var _0x35da=function(_0x3e6912,_0x2184dc){_0x3e6912=_0x3e6912-0x0;var _0x2837fe=_0x5da3[_0x3e6912];return _0x2837fe;};'use strict';var util=require('util');var _=require(_0x35da('0x0'));var BPromise=require(_0x35da('0x1'));var uuid=require(_0x35da('0x2'));var moment=require(_0x35da('0x3'));var path=require(_0x35da('0x4'));var tiff2pdf=require(_0x35da('0x5'));var gs=require(_0x35da('0x6'));var logger=require(_0x35da('0x7'))('fax');var ami=require(_0x35da('0x8'));var rpcDb=require(_0x35da('0x9'));var Channel=require('./channel');var ut=require(_0x35da('0xa'));var Action=require(_0x35da('0xb'));var faxAccount=require(_0x35da('0xc'));var attachment=require(_0x35da('0xd'));var faxMessage=require(_0x35da('0xe'));function Fax(_0x4f9fd6){this['channels']={};this[_0x35da('0xf')]=_0x4f9fd6[_0x35da('0xf')];this[_0x35da('0x10')]=_0x4f9fd6[_0x35da('0x10')];this['actions']={};ami['on'](_0x35da('0x11'),this[_0x35da('0x12')][_0x35da('0x13')](this));ami['on'](_0x35da('0x14'),this[_0x35da('0x15')][_0x35da('0x13')](this));ami['on']('newstate',this[_0x35da('0x16')]['bind'](this));ami['on']('newexten',this[_0x35da('0x17')][_0x35da('0x13')](this));ami['on'](_0x35da('0x18'),this[_0x35da('0x19')][_0x35da('0x13')](this));ami['on'](_0x35da('0x1a'),this['syncReceiveFax'][_0x35da('0x13')](this));ami['on'](_0x35da('0x1b'),this[_0x35da('0x1c')][_0x35da('0x13')](this));ami['on'](_0x35da('0x1d'),this[_0x35da('0x1e')][_0x35da('0x13')](this));}Fax[_0x35da('0x1f')]['syncNewchannel']=function(_0x10678c){if(_0x10678c[_0x35da('0x20')]===_0x35da('0x21')){for(var _0x2d5b2f in this[_0x35da('0xf')]){if(this[_0x35da('0xf')][_0x35da('0x22')](_0x2d5b2f)){if(_0x10678c[_0x35da('0x23')]===this['faxAccounts'][_0x2d5b2f][_0x35da('0x24')]){this[_0x35da('0x25')][_0x10678c[_0x35da('0x26')]]={};this[_0x35da('0x25')][_0x10678c[_0x35da('0x26')]][_0x35da('0x27')]=_0x10678c[_0x35da('0x27')];this[_0x35da('0x25')][_0x10678c[_0x35da('0x26')]]['id']=this[_0x35da('0xf')][_0x2d5b2f]['id'];this[_0x35da('0x25')][_0x10678c[_0x35da('0x26')]][_0x35da('0x28')]=this[_0x35da('0xf')][_0x2d5b2f][_0x35da('0x28')];logger[_0x35da('0x29')](_0x10678c[_0x35da('0x26')],_0x35da('0x2a'));}}}}if(this[_0x35da('0x2b')][_0x10678c[_0x35da('0x26')]]){this['channels'][_0x10678c[_0x35da('0x26')]]={};this[_0x35da('0x25')][_0x10678c[_0x35da('0x26')]][_0x35da('0x27')]=_0x10678c['channel'];logger[_0x35da('0x29')](_0x10678c[_0x35da('0x26')],_0x35da('0x2a'));}};Fax[_0x35da('0x1f')]['syncVarSet']=function(_0x4da0be){if(this[_0x35da('0x25')][_0x4da0be['uniqueid']]){for(var _0x24cbc1 in _0x4da0be['variable']){if(_0x4da0be['variable'][_0x35da('0x22')](_0x24cbc1)){this[_0x35da('0x25')][_0x4da0be[_0x35da('0x26')]][_0x24cbc1]=_0x4da0be['value'];}}}};Fax[_0x35da('0x1f')][_0x35da('0x16')]=function(_0xeb6cae){if(this[_0x35da('0x25')][_0xeb6cae[_0x35da('0x26')]]){this[_0x35da('0x25')][_0xeb6cae[_0x35da('0x26')]]['channelstate']=_0xeb6cae[_0x35da('0x2c')];this['channels'][_0xeb6cae[_0x35da('0x26')]][_0x35da('0x2d')]=_0xeb6cae[_0x35da('0x2d')];}};Fax['prototype'][_0x35da('0x17')]=function(_0x14b8b7){if(this[_0x35da('0x25')][_0x14b8b7[_0x35da('0x26')]]){for(var _0x42ebb1 in _0x14b8b7[_0x35da('0x2e')]){if(_0x14b8b7[_0x35da('0x2e')][_0x35da('0x22')](_0x42ebb1)){this[_0x35da('0x25')][_0x14b8b7['uniqueid']][_0x42ebb1]=_0x14b8b7['value'];}}}};Fax[_0x35da('0x1f')][_0x35da('0x19')]=function(_0x10dbae){if(this[_0x35da('0x25')][_0x10dbae['uniqueid']]){this[_0x35da('0x25')][_0x10dbae[_0x35da('0x26')]][_0x35da('0x2f')]=_0x10dbae['operation'];this[_0x35da('0x25')][_0x10dbae[_0x35da('0x26')]][_0x35da('0x30')]=_0x10dbae[_0x35da('0x30')];this['channels'][_0x10dbae[_0x35da('0x26')]][_0x35da('0x24')]=_0x10dbae['localstationid'];this[_0x35da('0x25')][_0x10dbae[_0x35da('0x26')]][_0x35da('0x31')]=_0x10dbae[_0x35da('0x31')];logger[_0x35da('0x29')](_0x10dbae[_0x35da('0x26')],'\x20syncFaxStatus\x20');}};Fax[_0x35da('0x1f')]['syncReceiveFax']=function(_0x15f274){var _0x472fa7=this;if(this['channels'][_0x15f274[_0x35da('0x26')]]){var _0x45c1f7=this['channels'][_0x15f274[_0x35da('0x26')]]['id'];this['channels'][_0x15f274['uniqueid']]['remotestationid']=_0x15f274[_0x35da('0x32')];this[_0x35da('0x25')][_0x15f274[_0x35da('0x26')]][_0x35da('0x33')]=_0x15f274['pagestransferred'];this[_0x35da('0x25')][_0x15f274[_0x35da('0x26')]][_0x35da('0x24')]=_0x15f274[_0x35da('0x24')];this[_0x35da('0x25')][_0x15f274[_0x35da('0x26')]][_0x35da('0x34')]=_0x15f274[_0x35da('0x34')];this[_0x35da('0x25')][_0x15f274[_0x35da('0x26')]][_0x35da('0x35')]=_0x15f274[_0x35da('0x35')];this['channels'][_0x15f274[_0x35da('0x26')]][_0x35da('0x31')]=_0x15f274[_0x35da('0x31')];this[_0x35da('0x25')][_0x15f274[_0x35da('0x26')]]['calleridnum']=_0x15f274[_0x35da('0x36')];if(this[_0x35da('0x25')][_0x15f274['uniqueid']][_0x35da('0x33')]>0x0){tiff2pdf(_0x15f274[_0x35da('0x31')],'/var/opt/motion2/server/files/attachments/',function(_0x20af4e){logger[_0x35da('0x29')](_0x15f274[_0x35da('0x26')],_0x35da('0x37'),_0x20af4e[_0x35da('0x38')]);attachment['create']({'name':path['parse'](_0x15f274[_0x35da('0x31')])[_0x35da('0x28')],'basename':path[_0x35da('0x39')](_0x15f274[_0x35da('0x31')])[_0x35da('0x28')]+_0x35da('0x3a'),'type':'application/pdf'})[_0x35da('0x3b')](function(_0x425764){faxAccount[_0x35da('0x3c')](_0x45c1f7,{'from':_0x15f274[_0x35da('0x36')],'mapKey':'fax','body':path[_0x35da('0x39')](_0x15f274[_0x35da('0x31')])[_0x35da('0x28')]+'.pdf','AttachmentId':_0x425764['id']})[_0x35da('0x3d')](function(_0x192664){logger[_0x35da('0x3e')](_0x15f274['uniqueid'],_0x35da('0x3f'),JSON[_0x35da('0x40')](_0x192664));});})[_0x35da('0x3d')](function(_0x804dc2){logger['error'](_0x15f274[_0x35da('0x26')],'\x20receiveFax\x20',JSON[_0x35da('0x40')](_0x804dc2));});});}logger[_0x35da('0x29')](_0x15f274['uniqueid'],_0x35da('0x41'));}};Fax[_0x35da('0x1f')][_0x35da('0x1e')]=function(_0x47d128){if(this[_0x35da('0x2b')][_0x47d128[_0x35da('0x26')]]){_[_0x35da('0x42')](this[_0x35da('0x25')][_0x47d128[_0x35da('0x26')]],_[_0x35da('0x43')](_0x47d128,[_0x35da('0x44'),'reason']));}};function updateStatus(_0x336371){if(_0x336371[_0x35da('0x45')]){faxMessage['update'](_0x336371[_0x35da('0x45')],{'failMessage':_0x35da('0x46')})[_0x35da('0x3b')](function(_0x861e1c){ut[_0x35da('0x47')](_0x35da('0x48'),_0x861e1c);})['catch'](function(_0x16cf5f){ut[_0x35da('0x47')](_0x35da('0x49'),_0x16cf5f);});}else{ut[_0x35da('0x47')](_0x35da('0x4a'));}}Fax[_0x35da('0x1f')][_0x35da('0x4b')]=function(_0x597cf9,_0x575fb8,_0x5329d1){var _0x509f0=this;var _0x1717e1={};if(_0x575fb8){_0x1717e1={'read':_0x575fb8};}else{_0x1717e1={'failMessage':_0x5329d1};}if(this['actions'][_0x597cf9][_0x35da('0x45')]){faxMessage[_0x35da('0x4c')](this[_0x35da('0x2b')][_0x597cf9][_0x35da('0x45')],_0x1717e1)[_0x35da('0x3b')](function(_0x26f2b1){ut['logger'](_0x35da('0x4d'),_0x26f2b1);})['catch'](function(_0x597d2e){ut['logger'](_0x35da('0x4e'),_0x597d2e);})[_0x35da('0x4f')](function(){delete _0x509f0['channels'][_0x597cf9];delete _0x509f0[_0x35da('0x2b')][_0x597cf9];});}else{ut[_0x35da('0x47')](_0x35da('0x50'));delete this['channels'][_0x597cf9];delete this[_0x35da('0x2b')][_0x597cf9];}};Fax[_0x35da('0x1f')][_0x35da('0x1c')]=function(_0x322f3c){var _0x3af5fb=this;if(this[_0x35da('0x25')][_0x322f3c[_0x35da('0x26')]]){if(this['actions'][_0x322f3c['uniqueid']]){this['channels'][_0x322f3c[_0x35da('0x26')]]['id']=this[_0x35da('0x2b')][_0x322f3c[_0x35da('0x26')]]['id'];this['channels'][_0x322f3c[_0x35da('0x26')]][_0x35da('0x28')]=this['actions'][_0x322f3c[_0x35da('0x26')]][_0x35da('0x28')];}logger[_0x35da('0x29')](_0x322f3c['uniqueid'],this[_0x35da('0x2b')][_0x322f3c[_0x35da('0x26')]]?_0x35da('0x51'):'\x20hangup\x20faxRiceive\x20',JSON[_0x35da('0x40')](this[_0x35da('0x25')][_0x322f3c['uniqueid']]));if(this[_0x35da('0x2b')][_0x322f3c[_0x35da('0x26')]]){if(this[_0x35da('0x25')][_0x322f3c[_0x35da('0x26')]][_0x35da('0x52')]>0x0&&this[_0x35da('0x25')][_0x322f3c[_0x35da('0x26')]]['faxstatus']===_0x35da('0x53')){this[_0x35da('0x4b')](_0x322f3c[_0x35da('0x26')],!![]);}else{this[_0x35da('0x4b')](_0x322f3c['uniqueid'],![],this[_0x35da('0x25')][_0x322f3c[_0x35da('0x26')]][_0x35da('0x54')]?_0x35da('0x55')+this['channels'][_0x322f3c[_0x35da('0x26')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x35da('0x1f')][_0x35da('0x56')]=function(_0x51ec82){var _0x38ef83=this;return new BPromise(function(_0x1632c0,_0x434b76){_0x38ef83[_0x35da('0x57')](_0x51ec82,_0x38ef83[_0x35da('0xf')][_0x51ec82[_0x35da('0x58')]])[_0x35da('0x3b')](function(_0x37accf){ut[_0x35da('0x47')](_0x35da('0x59'),_0x37accf);_0x1632c0(ut[_0x35da('0x38')](_0x35da('0x5a')));})[_0x35da('0x3d')](function(_0x1788ea){ut['logger'](_0x35da('0x5b'),_0x1788ea);updateStatus(_0x51ec82);_0x434b76(ut[_0x35da('0x38')](_0x35da('0x5c')));});});};Fax[_0x35da('0x1f')]['checkAfterSend']=function(_0x564504){var _0x328bae=this;return new BPromise(function(_0x5d3a21,_0x1043ad){var _0xd47e67=_0x328bae[_0x35da('0x5d')](_0x328bae[_0x35da('0xf')][_0x564504[_0x35da('0x58')]][_0x35da('0x5e')],_0x564504);if(_0xd47e67['isValid']){_0x5d3a21(ut['message']('Trunk\x20Reachable'));}else{_0x1043ad(ut[_0x35da('0x38')](_0xd47e67[_0x35da('0x38')]));}});};function originate(_0x1d915c,_0x34e1ee,_0x33539c){return new BPromise(function(_0x53550d,_0x4876ab){if(_0x33539c){var _0x224c61=util[_0x35da('0x5f')]('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['parse'](_0x1d915c[_0x35da('0x4')])[_0x35da('0x28')],_0x1d915c[_0x35da('0x4')]);gs[_0x35da('0x60')](_0x224c61)[_0x35da('0x3b')](function(){_0x1d915c['path']=util[_0x35da('0x5f')](_0x35da('0x61'),path['parse'](_0x1d915c[_0x35da('0x4')])[_0x35da('0x62')],path[_0x35da('0x39')](_0x1d915c[_0x35da('0x4')])[_0x35da('0x28')]);_0x34e1ee['XMF-PATH']=_0x1d915c[_0x35da('0x4')];ut[_0x35da('0x47')](_0x35da('0x63'),'');ami['Action'](ut['variablesAction'](_0x1d915c,_0x34e1ee))[_0x35da('0x3b')](function(_0x2ba22f){_0x53550d(_0x2ba22f);})['catch'](function(_0x8dbdac){_0x4876ab(_0x8dbdac);});})['catch'](function(_0x20053b){_0x4876ab(_0x20053b);});}else{ami[_0x35da('0x64')](ut[_0x35da('0x65')](_0x1d915c,_0x34e1ee))[_0x35da('0x3b')](function(_0xa846c9){_0x53550d(_0xa846c9);})[_0x35da('0x3d')](function(_0x41cfd3){_0x4876ab(_0x41cfd3);});}});}Fax[_0x35da('0x1f')]['execOriginate']=function(_0x2efb2e,_0x260713){var _0x5b7017=this;return new BPromise(function(_0xa341af,_0x4e0619){var _0x3ded4f=uuid['v4']();var _0x350b0f=ut[_0x35da('0x66')](_0x2efb2e,_0x260713);_0x5b7017['actions'][_0x3ded4f]=new Action(_0x3ded4f,_0x260713,_0x2efb2e);var _0x2c602f=_0x5b7017[_0x35da('0x2b')][_0x3ded4f];if(path[_0x35da('0x39')](_0x2efb2e[_0x35da('0x4')])[_0x35da('0x67')]===_0x35da('0x3a')){originate(_0x2c602f,_0x350b0f,!![])[_0x35da('0x3b')](function(_0x346dcb){_0xa341af(_0x346dcb);})[_0x35da('0x3d')](function(_0x42c79b){_0x4e0619(_0x42c79b);});}else{originate(_0x2c602f,_0x350b0f,![])[_0x35da('0x3b')](function(_0x1ae992){_0xa341af(_0x1ae992);})[_0x35da('0x3d')](function(_0x6a9f27){_0x4e0619(_0x6a9f27);});}});};Fax[_0x35da('0x1f')][_0x35da('0x68')]=function(_0x175ad0){return!_[_0x35da('0x69')](_0x175ad0)&&!_[_0x35da('0x69')](_0x175ad0['name'])&&!_['isNil'](_0x175ad0[_0x35da('0x6a')])&&_0x175ad0[_0x35da('0x6a')]&&!_['isNil'](this['trunks'][util[_0x35da('0x5f')](_0x35da('0x6b'),_0x175ad0[_0x35da('0x28')])])&&!_[_0x35da('0x69')](this[_0x35da('0x10')][util[_0x35da('0x5f')](_0x35da('0x6b'),_0x175ad0[_0x35da('0x28')])][_0x35da('0x30')])&&(this['trunks'][util[_0x35da('0x5f')](_0x35da('0x6b'),_0x175ad0[_0x35da('0x28')])]['status']===_0x35da('0x6c')||this['trunks'][util['format'](_0x35da('0x6b'),_0x175ad0[_0x35da('0x28')])]['status']===_0x35da('0x6d'));};Fax[_0x35da('0x1f')]['checkTrunk']=function(_0x41270d,_0x4b8f64){if(!this[_0x35da('0x68')](_0x41270d)){ut[_0x35da('0x47')](_0x35da('0x6e'),_['isNil'](_0x41270d)?'':_0x41270d[_0x35da('0x28')]+_0x35da('0x6f'));return{'isValid':![],'message':_0x35da('0x70')};}if(_['isNil'](_0x4b8f64[_0x35da('0x71')])){ut['logger'](_0x35da('0x72'),JSON[_0x35da('0x40')](_0x4b8f64));return{'isValid':![],'message':_0x35da('0x73')};}if(_[_0x35da('0x69')](_0x4b8f64[_0x35da('0x4')])){ut[_0x35da('0x47')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x35da('0x40')](_0x4b8f64));return{'isValid':![],'message':_0x35da('0x74')};}return{'isValid':!![],'message':_0x35da('0x75')};};module[_0x35da('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 0791ee0..43e2272 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 _0x2296=['../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','[Notify]\x20','util'];(function(_0x35e1ed,_0x59dc1c){var _0x3eccbd=function(_0x4df646){while(--_0x4df646){_0x35e1ed['push'](_0x35e1ed['shift']());}};_0x3eccbd(++_0x59dc1c);}(_0x2296,0x10d));var _0x6229=function(_0x1a1af5,_0x1fb621){_0x1a1af5=_0x1a1af5-0x0;var _0x1b3b24=_0x2296[_0x1a1af5];return _0x1b3b24;};'use strict';var util=require(_0x6229('0x0'));var BPromise=require('bluebird');var logger=require(_0x6229('0x1'))(_0x6229('0x2'));var _=require(_0x6229('0x3'));var faxAccount=require(_0x6229('0x4'));function loggerCatch(_0x3d7d2d){return function(_0x42dade){logger[_0x6229('0x5')](_0x3d7d2d,util[_0x6229('0x6')](_0x42dade,{'showHidden':![],'depth':null}));};}exports[_0x6229('0x7')]=function(_0x50998a,_0x309fe3){return BPromise['resolve']()['then'](faxAccount['notify'](_0x50998a,_0x309fe3))['catch'](loggerCatch(_0x6229('0x8')));}; \ No newline at end of file +var _0xe05e=['notify','catch','util','bluebird','../../../config/logger','preview','../rpc/faxAccount','error','inspect'];(function(_0x4b6887,_0x96c4b7){var _0x2bf120=function(_0x9c70c){while(--_0x9c70c){_0x4b6887['push'](_0x4b6887['shift']());}};_0x2bf120(++_0x96c4b7);}(_0xe05e,0x1bb));var _0xee05=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xe05e[_0x82129b];return _0x2ae5dc;};'use strict';var util=require(_0xee05('0x0'));var BPromise=require(_0xee05('0x1'));var logger=require(_0xee05('0x2'))(_0xee05('0x3'));var _=require('lodash');var faxAccount=require(_0xee05('0x4'));function loggerCatch(_0x3da9a0){return function(_0x419b59){logger[_0xee05('0x5')](_0x3da9a0,util[_0xee05('0x6')](_0x419b59,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0xa4682f,_0x427ecd){return BPromise['resolve']()['then'](faxAccount[_0xee05('0x7')](_0xa4682f,_0x427ecd))[_0xee05('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index c4b58f4..663b532 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 _0xb3c1=['execute','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x245eb1,_0x3e783d){var _0xa807ea=function(_0x3111fb){while(--_0x3111fb){_0x245eb1['push'](_0x245eb1['shift']());}};_0xa807ea(++_0x3e783d);}(_0xb3c1,0x1b3));var _0x1b3c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb3c1[_0x321bb2];return _0x9c12ed;};'use strict';var util=require('util');var logger=require(_0x1b3c('0x0'))(_0x1b3c('0x1'));var BPromise=require(_0x1b3c('0x2'));var exec=require(_0x1b3c('0x3'))[_0x1b3c('0x4')];exports[_0x1b3c('0x5')]=function(_0x17e3b8){return new BPromise(function(_0x590808,_0x2ca422){exec(_0x17e3b8,function(_0x1b2993,_0x2c0c25,_0x36c92d){logger[_0x1b3c('0x6')](_0x1b3c('0x7'),_0x2c0c25);if(_0x1b2993){logger[_0x1b3c('0x6')](_0x1b3c('0x7'),_0x1b3c('0x8'),util[_0x1b3c('0x9')](_0x1b2993,{'showHidden':![],'depth':null}),_0x2c0c25,_0x36c92d);_0x2ca422(_0x1b2993);}_0x590808(_0x2c0c25);});});}; \ No newline at end of file +var _0xd550=['inspect','util','../../../../config/logger','bluebird','exec','execute','info','Exec\x20gs'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd550,0x171));var _0x0d55=function(_0x514709,_0x258def){_0x514709=_0x514709-0x0;var _0xc238c2=_0xd550[_0x514709];return _0xc238c2;};'use strict';var util=require(_0x0d55('0x0'));var logger=require(_0x0d55('0x1'))('fax');var BPromise=require(_0x0d55('0x2'));var exec=require('child_process')[_0x0d55('0x3')];exports[_0x0d55('0x4')]=function(_0x463feb){return new BPromise(function(_0x1a3e49,_0x1f72db){exec(_0x463feb,function(_0x2212e8,_0xf11000,_0x380763){logger[_0x0d55('0x5')](_0x0d55('0x6'),_0xf11000);if(_0x2212e8){logger[_0x0d55('0x5')](_0x0d55('0x6'),'\x20Error\x20:',util[_0x0d55('0x7')](_0x2212e8,{'showHidden':![],'depth':null}),_0xf11000,_0x380763);_0x1f72db(_0x2212e8);}_0x1a3e49(_0xf11000);});});}; \ 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 3ca1751..383e47e 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 _0xa37e=['originate','channel','from-sip','localstationid','moment','../../../../config/logger','fax','message','logger','info','inspect','headerinfo','minrate','maxrate','format','modem','gateway','faxdetect','path','variablesAction','uniqueid'];(function(_0x1e0499,_0x2222ed){var _0x527766=function(_0xac41b8){while(--_0xac41b8){_0x1e0499['push'](_0x1e0499['shift']());}};_0x527766(++_0x2222ed);}(_0xa37e,0x97));var _0xea37=function(_0x5d8ae8,_0x29ff36){_0x5d8ae8=_0x5d8ae8-0x0;var _0x3c7829=_0xa37e[_0x5d8ae8];return _0x3c7829;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xea37('0x0'));var logger=require(_0xea37('0x1'))(_0xea37('0x2'));exports[_0xea37('0x3')]=function(_0x5430aa){return{'message':_0x5430aa};};exports[_0xea37('0x4')]=function(_0x537c5a,_0x360ed5){logger[_0xea37('0x5')](_0x537c5a,util[_0xea37('0x6')](_0x360ed5,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x57135b,_0x36c489){var _0x4a9e08={'XMF-ECM':_0x36c489['ecm'],'XMF-HEADERINFO':_0x36c489[_0xea37('0x7')],'XMF-MINRATE':_0x36c489[_0xea37('0x8')],'XMF-MAXRATE':_0x36c489[_0xea37('0x9')],'XMF-MODEM':util[_0xea37('0xa')]('\x22%s\x22',_0x36c489[_0xea37('0xb')]),'XMF-GATEWAY':_0x36c489[_0xea37('0xc')],'XMF-FAXDETECT':_0x36c489[_0xea37('0xd')],'XMF-T38TIMEOUT':_0x36c489['t38timeout'],'XMF-LOCALSTATIONID':_0x36c489['localstationid'],'XMF-PATH':_0x57135b[_0xea37('0xe')]};return _0x4a9e08;};exports[_0xea37('0xf')]=function(_0x3cd18b,_0x5c0da5){return{'actionid':_0x3cd18b[_0xea37('0x10')],'action':_0xea37('0x11'),'channel':_0x3cd18b[_0xea37('0x12')],'Exten':'xcally-motion-fax','Context':_0xea37('0x13'),'Priority':'1','callerid':util[_0xea37('0xa')]('\x22%s\x22\x20<%s>',_0x3cd18b[_0xea37('0x7')]?_0x3cd18b['headerinfo']:'',_0x3cd18b[_0xea37('0x14')]),'variable':_0x5c0da5,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3cd18b['uniqueid']};}; \ No newline at end of file +var _0x222f=['uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','logger','inspect','ecm','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction'];(function(_0x200d92,_0x2b8542){var _0x24147f=function(_0xcb9808){while(--_0xcb9808){_0x200d92['push'](_0x200d92['shift']());}};_0x24147f(++_0x2b8542);}(_0x222f,0x1a4));var _0xf222=function(_0x5c4a87,_0x35cd28){_0x5c4a87=_0x5c4a87-0x0;var _0x1a8c55=_0x222f[_0x5c4a87];return _0x1a8c55;};'use strict';var util=require(_0xf222('0x0'));var _=require(_0xf222('0x1'));var moment=require(_0xf222('0x2'));var logger=require(_0xf222('0x3'))('fax');exports['message']=function(_0x195de1){return{'message':_0x195de1};};exports[_0xf222('0x4')]=function(_0x307791,_0x7b187d){logger['info'](_0x307791,util[_0xf222('0x5')](_0x7b187d,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x112e6d,_0x26f129){var _0x518ebb={'XMF-ECM':_0x26f129[_0xf222('0x6')],'XMF-HEADERINFO':_0x26f129[_0xf222('0x7')],'XMF-MINRATE':_0x26f129['minrate'],'XMF-MAXRATE':_0x26f129[_0xf222('0x8')],'XMF-MODEM':util[_0xf222('0x9')](_0xf222('0xa'),_0x26f129[_0xf222('0xb')]),'XMF-GATEWAY':_0x26f129[_0xf222('0xc')],'XMF-FAXDETECT':_0x26f129[_0xf222('0xd')],'XMF-T38TIMEOUT':_0x26f129['t38timeout'],'XMF-LOCALSTATIONID':_0x26f129[_0xf222('0xe')],'XMF-PATH':_0x112e6d[_0xf222('0xf')]};return _0x518ebb;};exports[_0xf222('0x10')]=function(_0x182bc3,_0x48f740){return{'actionid':_0x182bc3[_0xf222('0x11')],'action':_0xf222('0x12'),'channel':_0x182bc3[_0xf222('0x13')],'Exten':_0xf222('0x14'),'Context':_0xf222('0x15'),'Priority':'1','callerid':util[_0xf222('0x9')](_0xf222('0x16'),_0x182bc3[_0xf222('0x7')]?_0x182bc3['headerinfo']:'',_0x182bc3['localstationid']),'variable':_0x48f740,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x182bc3[_0xf222('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index ae4c6f8..a2eaede 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 _0x8451=['getFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','catch','log','listen','sync','bluebird','util','moment','./realtime','./acw','./dialer','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts'];(function(_0x26a995,_0x2fe771){var _0x4c4992=function(_0x18c9fc){while(--_0x18c9fc){_0x26a995['push'](_0x26a995['shift']());}};_0x4c4992(++_0x2fe771);}(_0x8451,0x100));var _0x1845=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x8451[_0x4ae6ef];return _0x3cbb4e;};'use strict';var BPromise=require(_0x1845('0x0'));var util=require(_0x1845('0x1'));var moment=require(_0x1845('0x2'));var server=require('./server');var Realtime=require(_0x1845('0x3'));var Report=require('./report');var Acw=require(_0x1845('0x4'));var Trigger=require('./trigger');var Dialer=require(_0x1845('0x5'));var Preview=require('./preview');var Fax=require(_0x1845('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0x1845('0x7'));var voiceQueueReport=require(_0x1845('0x8'));var voiceCallReport=require(_0x1845('0x9'));var trunk=require('./rpc/trunk');var trigger=require(_0x1845('0xa'));var template=require(_0x1845('0xb'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x1845('0xc'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x1845('0xd'));var zendesk=require(_0x1845('0xe'));var salesforce=require(_0x1845('0xf'));var sugarcrm=require(_0x1845('0x10'));var freshdesk=require(_0x1845('0x11'));var desk=require(_0x1845('0x12'));var zoho=require(_0x1845('0x13'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x1845('0x14'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x1845('0x15')](_0x1845('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1845('0x15')](_0x1845('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x1845('0x17')]()[_0x1845('0x18')](user[_0x1845('0x19')]())[_0x1845('0x18')](realtime[_0x1845('0x1a')]())[_0x1845('0x18')](user[_0x1845('0x1b')]())[_0x1845('0x18')](realtime['initTelephones']())[_0x1845('0x18')](trunk['getTrunks']())[_0x1845('0x18')](realtime[_0x1845('0x1c')]())['then'](voiceQueue['getVoiceQueues']())[_0x1845('0x18')](realtime['initVoiceQueues']())[_0x1845('0x18')](trigger[_0x1845('0x1d')]())[_0x1845('0x18')](realtime[_0x1845('0x1e')]())[_0x1845('0x18')](template[_0x1845('0x1f')]())['then'](realtime[_0x1845('0x20')]())[_0x1845('0x18')](zendesk[_0x1845('0x21')]())[_0x1845('0x18')](realtime[_0x1845('0x22')]())['then'](salesforce[_0x1845('0x23')]())['then'](realtime[_0x1845('0x24')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0x1845('0x18')](realtime[_0x1845('0x25')]())[_0x1845('0x18')](freshdesk[_0x1845('0x26')]())[_0x1845('0x18')](realtime[_0x1845('0x27')]())[_0x1845('0x18')](desk[_0x1845('0x28')]())[_0x1845('0x18')](realtime[_0x1845('0x29')]())[_0x1845('0x18')](zoho['getZohoAccounts']())['then'](realtime[_0x1845('0x2a')]())[_0x1845('0x18')](vtiger['getVtigerAccounts']())[_0x1845('0x18')](realtime[_0x1845('0x2b')]())[_0x1845('0x18')](freshsales[_0x1845('0x2c')]())[_0x1845('0x18')](realtime['initFreshsalesAccounts']())[_0x1845('0x18')](servicenow[_0x1845('0x2d')]())['then'](realtime['initServicenowAccounts']())[_0x1845('0x18')](dynamics365[_0x1845('0x2e')]())[_0x1845('0x18')](realtime[_0x1845('0x2f')]())[_0x1845('0x18')](campaign[_0x1845('0x30')]())[_0x1845('0x18')](realtime[_0x1845('0x31')]())[_0x1845('0x18')](voiceExtension['getVoiceExtensions']())[_0x1845('0x18')](realtime[_0x1845('0x32')]())['then'](faxAccount[_0x1845('0x33')]())['then'](realtime['initFaxAccounts']())[_0x1845('0x18')](function(){return realtime;});}function initParams(){return BPromise[_0x1845('0x17')]()[_0x1845('0x18')](voiceQueueReport['getVoiceQueueReports']())[_0x1845('0x18')](realtime['initVoiceQueueReports']())[_0x1845('0x18')](cmHopperHistory[_0x1845('0x34')]())[_0x1845('0x18')](realtime[_0x1845('0x35')]())[_0x1845('0x18')](cmHopperHistory[_0x1845('0x36')]())[_0x1845('0x18')](realtime[_0x1845('0x37')]())[_0x1845('0x18')](voiceCallReport['getVoiceCallReports']())[_0x1845('0x18')](realtime['initVoiceCallReports']())[_0x1845('0x18')](function(_0x4e73aa){})[_0x1845('0x38')](function(_0x3befaf){console[_0x1845('0x39')](_0x3befaf);});}function main(){return server[_0x1845('0x3a')](realtime,preview,fax)[_0x1845('0x18')](function(_0x1de1c6){return initRealtime();})[_0x1845('0x18')](function(){return initParams();})[_0x1845('0x18')](function(){report[_0x1845('0x3b')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x3811a0){console[_0x1845('0x39')](_0x3811a0);});}main(); \ No newline at end of file +var _0x1082=['initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','sync','util','moment','./server','./realtime','./report','./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/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','then','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts'];(function(_0x23b562,_0x4ea0f1){var _0x508ce0=function(_0x1677c1){while(--_0x1677c1){_0x23b562['push'](_0x23b562['shift']());}};_0x508ce0(++_0x4ea0f1);}(_0x1082,0xd5));var _0x2108=function(_0x59f655,_0x1c12aa){_0x59f655=_0x59f655-0x0;var _0x1dbb6e=_0x1082[_0x59f655];return _0x1dbb6e;};'use strict';var BPromise=require('bluebird');var util=require(_0x2108('0x0'));var moment=require(_0x2108('0x1'));var server=require(_0x2108('0x2'));var Realtime=require(_0x2108('0x3'));var Report=require(_0x2108('0x4'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0x2108('0x5'));var user=require('./rpc/user');var voiceQueue=require(_0x2108('0x6'));var voiceQueueReport=require(_0x2108('0x7'));var voiceCallReport=require(_0x2108('0x8'));var trunk=require(_0x2108('0x9'));var trigger=require(_0x2108('0xa'));var template=require(_0x2108('0xb'));var cmHopperHistory=require(_0x2108('0xc'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x2108('0xd'));var faxAccount=require(_0x2108('0xe'));var zendesk=require(_0x2108('0xf'));var salesforce=require(_0x2108('0x10'));var sugarcrm=require(_0x2108('0x11'));var freshdesk=require(_0x2108('0x12'));var desk=require(_0x2108('0x13'));var zoho=require(_0x2108('0x14'));var vtiger=require(_0x2108('0x15'));var freshsales=require(_0x2108('0x16'));var servicenow=require(_0x2108('0x17'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x2108('0x18')](_0x2108('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x2108('0x1a')](user['getAgents']())[_0x2108('0x1a')](realtime['initAgents']())[_0x2108('0x1a')](user['getTelephones']())[_0x2108('0x1a')](realtime[_0x2108('0x1b')]())[_0x2108('0x1a')](trunk[_0x2108('0x1c')]())['then'](realtime['initTrunks']())['then'](voiceQueue[_0x2108('0x1d')]())[_0x2108('0x1a')](realtime[_0x2108('0x1e')]())[_0x2108('0x1a')](trigger[_0x2108('0x1f')]())[_0x2108('0x1a')](realtime[_0x2108('0x20')]())['then'](template[_0x2108('0x21')]())[_0x2108('0x1a')](realtime[_0x2108('0x22')]())[_0x2108('0x1a')](zendesk['getZendeskAccounts']())[_0x2108('0x1a')](realtime[_0x2108('0x23')]())[_0x2108('0x1a')](salesforce['getSalesforceAccounts']())[_0x2108('0x1a')](realtime[_0x2108('0x24')]())[_0x2108('0x1a')](sugarcrm[_0x2108('0x25')]())['then'](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x2108('0x26')]())[_0x2108('0x1a')](realtime['initFreshdeskAccounts']())[_0x2108('0x1a')](desk['getDeskAccounts']())[_0x2108('0x1a')](realtime[_0x2108('0x27')]())[_0x2108('0x1a')](zoho[_0x2108('0x28')]())[_0x2108('0x1a')](realtime[_0x2108('0x29')]())[_0x2108('0x1a')](vtiger[_0x2108('0x2a')]())['then'](realtime['initVtigerAccounts']())[_0x2108('0x1a')](freshsales['getFreshsalesAccounts']())[_0x2108('0x1a')](realtime[_0x2108('0x2b')]())[_0x2108('0x1a')](servicenow[_0x2108('0x2c')]())[_0x2108('0x1a')](realtime[_0x2108('0x2d')]())[_0x2108('0x1a')](dynamics365[_0x2108('0x2e')]())[_0x2108('0x1a')](realtime[_0x2108('0x2f')]())[_0x2108('0x1a')](campaign[_0x2108('0x30')]())[_0x2108('0x1a')](realtime[_0x2108('0x31')]())[_0x2108('0x1a')](voiceExtension['getVoiceExtensions']())[_0x2108('0x1a')](realtime[_0x2108('0x32')]())[_0x2108('0x1a')](faxAccount[_0x2108('0x33')]())['then'](realtime[_0x2108('0x34')]())[_0x2108('0x1a')](function(){return realtime;});}function initParams(){return BPromise[_0x2108('0x35')]()[_0x2108('0x1a')](voiceQueueReport['getVoiceQueueReports']())[_0x2108('0x1a')](realtime[_0x2108('0x36')]())[_0x2108('0x1a')](cmHopperHistory[_0x2108('0x37')]())['then'](realtime[_0x2108('0x38')]())[_0x2108('0x1a')](cmHopperHistory[_0x2108('0x39')]())[_0x2108('0x1a')](realtime[_0x2108('0x3a')]())['then'](voiceCallReport[_0x2108('0x3b')]())[_0x2108('0x1a')](realtime[_0x2108('0x3c')]())[_0x2108('0x1a')](function(_0x142478){})[_0x2108('0x3d')](function(_0x4ef0e6){console['log'](_0x4ef0e6);});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x153486){return initRealtime();})[_0x2108('0x1a')](function(){return initParams();})[_0x2108('0x1a')](function(){report[_0x2108('0x3e')]();setInterval(initRealtime,0x1388);})[_0x2108('0x3d')](function(_0x3fe14f){console['log'](_0x3fe14f);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 9d24bea..2e5ca2f 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 _0xbac6=['lodash','util','md5','../../../config/environment','redis','defaults','name','email','accountcode','fullname','state','unknown','stateTime','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','talking','statePause','toNumber','status','stringify','user:%s','emit','user:save','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbac6,0x172));var _0x6bac=function(_0x470287,_0x2f0798){_0x470287=_0x470287-0x0;var _0x503710=_0xbac6[_0x470287];return _0x503710;};'use strict';var _=require(_0x6bac('0x0'));var util=require(_0x6bac('0x1'));var moment=require('moment');var md5=require(_0x6bac('0x2'));var Redis=require('ioredis');var config=require(_0x6bac('0x3'));config[_0x6bac('0x4')]=_[_0x6bac('0x5')](config[_0x6bac('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6bac('0x4')]));function Agent(_0x352565){this['id']=_0x352565['id']||0x0;this[_0x6bac('0x6')]=_0x352565[_0x6bac('0x6')]||'';this[_0x6bac('0x7')]=_0x352565['email']||'';this[_0x6bac('0x8')]=_0x352565['accountcode']||'';this[_0x6bac('0x9')]=_0x352565[_0x6bac('0x9')]||'';this[_0x6bac('0xa')]=_0x6bac('0xb');this[_0x6bac('0xc')]=0x0;this['status']=_0x6bac('0xb');this[_0x6bac('0xd')]='';this['phone']='';this[_0x6bac('0xe')]='';this[_0x6bac('0xf')]='';this['online']=_0x352565[_0x6bac('0x10')]||![];this[_0x6bac('0x11')]=_0x6bac('0xb');this[_0x6bac('0x12')]=0x0;this[_0x6bac('0x13')]='';this[_0x6bac('0x14')]='';this[_0x6bac('0x15')]=![];this[_0x6bac('0x16')]=![];this[_0x6bac('0x2')]='';}Agent[_0x6bac('0x17')][_0x6bac('0x18')]=function(_0x1dd07b){var _0x2e5990;if(_0x1dd07b&&_0x1dd07b[_0x6bac('0xa')]){_0x2e5990=_0x1dd07b[_0x6bac('0xa')][_0x6bac('0x19')]();switch(_0x2e5990){case _0x6bac('0x1a'):_0x2e5990=_0x6bac('0x1b');break;case'inuse':_0x2e5990=_0x6bac('0x1c');break;}}if(_0x2e5990&&this[_0x6bac('0x11')]!==_0x2e5990||_0x1dd07b[_0x6bac('0x1d')]){this[_0x6bac('0x12')]=_[_0x6bac('0x1e')](moment()['format']('x'));}if(_0x2e5990){this[_0x6bac('0x11')]=_0x2e5990;}var _0x40a731={'id':this['id'],'name':this[_0x6bac('0x6')],'email':this['email'],'accountcode':this[_0x6bac('0x8')],'fullname':this[_0x6bac('0x9')],'state':this[_0x6bac('0xa')],'stateTime':this[_0x6bac('0xc')],'status':this[_0x6bac('0x1f')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x6bac('0x11')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x6bac('0x13')],'voiceStatusQueue':this[_0x6bac('0x14')],'interface':this['interface'],'onhold':this[_0x6bac('0x15')]};var _0xf1ed86=md5(JSON[_0x6bac('0x20')](_0x40a731));if(this[_0x6bac('0x2')]!==_0xf1ed86){this[_0x6bac('0x2')]=_0xf1ed86;io['to'](util['format'](_0x6bac('0x21'),_0x40a731[_0x6bac('0x6')]))[_0x6bac('0x22')](_0x6bac('0x23'),_0x40a731);}};module[_0x6bac('0x24')]=Agent; \ No newline at end of file +var _0x43a8=['voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','voiceStatusTime','toNumber','format','voiceStatusCallerIdNumber','interface','stringify','emit','user:save','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','address','phone','mobile','online','voiceStatus'];(function(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0x43a8,0x133));var _0x843a=function(_0x36c1d0,_0xf328bc){_0x36c1d0=_0x36c1d0-0x0;var _0xeb2185=_0x43a8[_0x36c1d0];return _0xeb2185;};'use strict';var _=require('lodash');var util=require(_0x843a('0x0'));var moment=require(_0x843a('0x1'));var md5=require(_0x843a('0x2'));var Redis=require(_0x843a('0x3'));var config=require(_0x843a('0x4'));config[_0x843a('0x5')]=_[_0x843a('0x6')](config['redis'],{'host':_0x843a('0x7'),'port':0x18eb});var io=require(_0x843a('0x8'))(new Redis(config[_0x843a('0x5')]));function Agent(_0x4cbe64){this['id']=_0x4cbe64['id']||0x0;this[_0x843a('0x9')]=_0x4cbe64['name']||'';this[_0x843a('0xa')]=_0x4cbe64[_0x843a('0xa')]||'';this[_0x843a('0xb')]=_0x4cbe64[_0x843a('0xb')]||'';this['fullname']=_0x4cbe64[_0x843a('0xc')]||'';this[_0x843a('0xd')]=_0x843a('0xe');this[_0x843a('0xf')]=0x0;this['status']=_0x843a('0xe');this[_0x843a('0x10')]='';this[_0x843a('0x11')]='';this[_0x843a('0x12')]='';this['interface']='';this[_0x843a('0x13')]=_0x4cbe64[_0x843a('0x13')]||![];this[_0x843a('0x14')]=_0x843a('0xe');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x843a('0x15')]='';this[_0x843a('0x16')]=![];this[_0x843a('0x17')]=![];this[_0x843a('0x2')]='';}Agent[_0x843a('0x18')][_0x843a('0x19')]=function(_0x9e94aa){var _0x265bcc;if(_0x9e94aa&&_0x9e94aa['state']){_0x265bcc=_0x9e94aa[_0x843a('0xd')][_0x843a('0x1a')]();switch(_0x265bcc){case _0x843a('0x1b'):_0x265bcc=_0x843a('0x1c');break;case _0x843a('0x1d'):_0x265bcc=_0x843a('0x1e');break;}}if(_0x265bcc&&this[_0x843a('0x14')]!==_0x265bcc||_0x9e94aa[_0x843a('0x1f')]){this[_0x843a('0x20')]=_[_0x843a('0x21')](moment()[_0x843a('0x22')]('x'));}if(_0x265bcc){this['voiceStatus']=_0x265bcc;}var _0x3976c7={'id':this['id'],'name':this[_0x843a('0x9')],'email':this[_0x843a('0xa')],'accountcode':this[_0x843a('0xb')],'fullname':this[_0x843a('0xc')],'state':this[_0x843a('0xd')],'stateTime':this[_0x843a('0xf')],'status':this['status'],'address':this[_0x843a('0x10')],'online':this[_0x843a('0x13')],'voiceStatus':this[_0x843a('0x14')],'voiceStatusTime':this[_0x843a('0x20')],'voiceStatusCallerIdNumber':this[_0x843a('0x23')],'voiceStatusQueue':this[_0x843a('0x15')],'interface':this[_0x843a('0x24')],'onhold':this[_0x843a('0x16')]};var _0x2ca942=md5(JSON[_0x843a('0x25')](_0x3976c7));if(this[_0x843a('0x2')]!==_0x2ca942){this[_0x843a('0x2')]=_0x2ca942;io['to'](util[_0x843a('0x22')]('user:%s',_0x3976c7['name']))[_0x843a('0x26')](_0x843a('0x27'),_0x3976c7);}};module[_0x843a('0x28')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 2843aaf..40668b5 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 _0xb10b=['dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x399194,_0x57df7b){var _0x8384ee=function(_0x4066cd){while(--_0x4066cd){_0x399194['push'](_0x399194['shift']());}};_0x8384ee(++_0x57df7b);}(_0xb10b,0x12a));var _0xbb10=function(_0x166310,_0x49c9f4){_0x166310=_0x166310-0x0;var _0xd24eb8=_0xb10b[_0x166310];return _0xd24eb8;};'use strict';function Campaign(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'campaign';this[_0xbb10('0x2')]=0x0;this[_0xbb10('0x3')]=0x0;this[_0xbb10('0x4')]=0x0;this[_0xbb10('0x5')]=0x0;this[_0xbb10('0x6')]='';this[_0xbb10('0x7')]=!![];this['active']=_0x13ce8d[_0xbb10('0x8')];this[_0xbb10('0x9')]=_0x13ce8d['limitCalls'];this[_0xbb10('0xa')]=_0x13ce8d[_0xbb10('0xa')]||null;this[_0xbb10('0xb')]=_0x13ce8d[_0xbb10('0xb')]?_0x13ce8d[_0xbb10('0xb')]:null;this[_0xbb10('0xc')]=_0x13ce8d[_0xbb10('0xc')];this[_0xbb10('0xd')]=_0x13ce8d['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x13ce8d[_0xbb10('0xe')]||0x1e;this[_0xbb10('0xf')]=_0x13ce8d[_0xbb10('0xf')];this['dialCongestionRetryFrequency']=_0x13ce8d[_0xbb10('0x10')];this['dialBusyMaxRetry']=_0x13ce8d[_0xbb10('0x11')];this[_0xbb10('0x12')]=_0x13ce8d[_0xbb10('0x12')];this[_0xbb10('0x13')]=_0x13ce8d[_0xbb10('0x13')];this[_0xbb10('0x14')]=_0x13ce8d['dialNoAnswerRetryFrequency'];this[_0xbb10('0x15')]=_0x13ce8d[_0xbb10('0x15')];this[_0xbb10('0x16')]=_0x13ce8d[_0xbb10('0x16')]||_0xbb10('0x17');this[_0xbb10('0x18')]=_0x13ce8d[_0xbb10('0x18')]||undefined;this[_0xbb10('0x19')]=_0x13ce8d[_0xbb10('0x19')]||undefined;this[_0xbb10('0x1a')]=_0x13ce8d['dialCutDigit']||undefined;this[_0xbb10('0x1b')]=_0x13ce8d[_0xbb10('0x1b')]?_0x13ce8d[_0xbb10('0x1b')]:undefined;this[_0xbb10('0x1c')]=_0x13ce8d[_0xbb10('0x1c')]?_0x13ce8d[_0xbb10('0x1c')]:undefined;this[_0xbb10('0x1d')]=_0x13ce8d[_0xbb10('0x1d')]?_0x13ce8d[_0xbb10('0x1d')]:undefined;this[_0xbb10('0x1e')]=_0x13ce8d['SquareProject']?_0x13ce8d[_0xbb10('0x1e')]:undefined;this[_0xbb10('0x1f')]=_0x13ce8d[_0xbb10('0x1e')]?_0x13ce8d[_0xbb10('0x1e')][_0xbb10('0x0')]:undefined;this[_0xbb10('0x20')]=_0x13ce8d['dialAMDActive']||![];this[_0xbb10('0x21')]=_0x13ce8d[_0xbb10('0x21')];this['dialAMDGreeting']=_0x13ce8d['dialAMDGreeting'];this[_0xbb10('0x22')]=_0x13ce8d[_0xbb10('0x22')];this[_0xbb10('0x23')]=_0x13ce8d[_0xbb10('0x23')];this[_0xbb10('0x24')]=_0x13ce8d[_0xbb10('0x24')];this[_0xbb10('0x25')]=_0x13ce8d[_0xbb10('0x25')];this[_0xbb10('0x26')]=_0x13ce8d[_0xbb10('0x26')];this[_0xbb10('0x27')]=_0x13ce8d[_0xbb10('0x27')];this['dialAMDMaximumWordLength']=_0x13ce8d['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0xd8b0=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';function Campaign(_0x5d04de){this['id']=_0x5d04de['id']||0x0;this[_0x0d8b('0x0')]=_0x5d04de['name']||'';this['type']=_0x5d04de['type']||_0x0d8b('0x1');this[_0x0d8b('0x2')]=0x0;this[_0x0d8b('0x3')]=0x0;this[_0x0d8b('0x4')]=0x0;this[_0x0d8b('0x5')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x0d8b('0x6')]=_0x5d04de[_0x0d8b('0x6')];this[_0x0d8b('0x7')]=_0x5d04de['limitCalls'];this[_0x0d8b('0x8')]=_0x5d04de[_0x0d8b('0x8')]||null;this['dialGlobalInterval']=_0x5d04de[_0x0d8b('0x9')]?_0x5d04de[_0x0d8b('0x9')]:null;this[_0x0d8b('0xa')]=_0x5d04de[_0x0d8b('0xa')];this[_0x0d8b('0xb')]=_0x5d04de[_0x0d8b('0xb')];this[_0x0d8b('0xc')]=_0x5d04de[_0x0d8b('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0x5d04de[_0x0d8b('0xd')];this['dialCongestionRetryFrequency']=_0x5d04de[_0x0d8b('0xe')];this[_0x0d8b('0xf')]=_0x5d04de[_0x0d8b('0xf')];this[_0x0d8b('0x10')]=_0x5d04de[_0x0d8b('0x10')];this[_0x0d8b('0x11')]=_0x5d04de[_0x0d8b('0x11')];this[_0x0d8b('0x12')]=_0x5d04de[_0x0d8b('0x12')];this[_0x0d8b('0x13')]=_0x5d04de[_0x0d8b('0x13')];this[_0x0d8b('0x14')]=_0x5d04de[_0x0d8b('0x14')]||_0x0d8b('0x15');this['dialPrefix']=_0x5d04de[_0x0d8b('0x16')]||undefined;this[_0x0d8b('0x17')]=_0x5d04de[_0x0d8b('0x17')]||undefined;this[_0x0d8b('0x18')]=_0x5d04de[_0x0d8b('0x18')]||undefined;this['TrunkBackup']=_0x5d04de[_0x0d8b('0x19')]?_0x5d04de[_0x0d8b('0x19')]:undefined;this[_0x0d8b('0x1a')]=_0x5d04de[_0x0d8b('0x1a')]?_0x5d04de[_0x0d8b('0x1a')]:undefined;this[_0x0d8b('0x1b')]=_0x5d04de[_0x0d8b('0x1b')]?_0x5d04de[_0x0d8b('0x1b')]:undefined;this['SquareProject']=_0x5d04de[_0x0d8b('0x1c')]?_0x5d04de[_0x0d8b('0x1c')]:undefined;this[_0x0d8b('0x1d')]=_0x5d04de[_0x0d8b('0x1c')]?_0x5d04de[_0x0d8b('0x1c')][_0x0d8b('0x0')]:undefined;this[_0x0d8b('0x1e')]=_0x5d04de[_0x0d8b('0x1e')]||![];this['dialAMDInitialSilence']=_0x5d04de['dialAMDInitialSilence'];this[_0x0d8b('0x1f')]=_0x5d04de['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x5d04de['dialAMDAfterGreetingSilence'];this[_0x0d8b('0x20')]=_0x5d04de[_0x0d8b('0x20')];this[_0x0d8b('0x21')]=_0x5d04de[_0x0d8b('0x21')];this[_0x0d8b('0x22')]=_0x5d04de[_0x0d8b('0x22')];this[_0x0d8b('0x23')]=_0x5d04de[_0x0d8b('0x23')];this[_0x0d8b('0x24')]=_0x5d04de['dialAMDSilenceThreshold'];this[_0x0d8b('0x25')]=_0x5d04de[_0x0d8b('0x25')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index c2be5ec..e3cb80c 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 _0x4f98=['lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answertime','abandoned','lastapplication'];(function(_0x2cb2b7,_0x29f457){var _0x1ec700=function(_0x3d663f){while(--_0x3d663f){_0x2cb2b7['push'](_0x2cb2b7['shift']());}};_0x1ec700(++_0x29f457);}(_0x4f98,0x196));var _0x84f9=function(_0x1d5ba8,_0x412a52){_0x1d5ba8=_0x1d5ba8-0x0;var _0x1022a2=_0x4f98[_0x1d5ba8];return _0x1022a2;};'use strict';function Channel(){this[_0x84f9('0x0')]=null;this[_0x84f9('0x1')]='';this[_0x84f9('0x2')]='';this[_0x84f9('0x3')]=0x0;this[_0x84f9('0x4')]='';this[_0x84f9('0x5')]=undefined;this[_0x84f9('0x6')]=undefined;this['accountcode']=0x0;this[_0x84f9('0x7')]='';this[_0x84f9('0x8')]=0x0;this[_0x84f9('0x9')]=0x0;this[_0x84f9('0xa')]=0x0;this['answered']=![];this[_0x84f9('0xb')]=null;this['endtime']=null;this['unmanaged']=![];this[_0x84f9('0xc')]=![];this[_0x84f9('0xd')]='';this[_0x84f9('0xe')]='';this[_0x84f9('0xf')]=0x0;this[_0x84f9('0x10')]=0x0;this[_0x84f9('0x11')]=0x0;this[_0x84f9('0x12')]=null;this[_0x84f9('0x13')]=null;this[_0x84f9('0x14')]=null;this[_0x84f9('0x15')]=![];this[_0x84f9('0x16')]=null;this[_0x84f9('0x17')]=null;this['monitors']=[];this[_0x84f9('0x18')]=undefined;this[_0x84f9('0x19')]=undefined;this[_0x84f9('0x1a')]=0x0;}module[_0x84f9('0x1b')]=Channel; \ No newline at end of file +var _0x4eb8=['mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','queue','monitors','transferconnectedlinenum'];(function(_0x5887d4,_0x52449f){var _0x502a9b=function(_0x337ca1){while(--_0x337ca1){_0x5887d4['push'](_0x5887d4['shift']());}};_0x502a9b(++_0x52449f);}(_0x4eb8,0x1b5));var _0x84eb=function(_0x2cad63,_0x15a505){_0x2cad63=_0x2cad63-0x0;var _0x2ac69e=_0x4eb8[_0x2cad63];return _0x2ac69e;};'use strict';function Channel(){this[_0x84eb('0x0')]=null;this[_0x84eb('0x1')]='';this[_0x84eb('0x2')]='';this[_0x84eb('0x3')]=0x0;this['calleridname']='';this[_0x84eb('0x4')]=undefined;this[_0x84eb('0x5')]=undefined;this[_0x84eb('0x6')]=0x0;this[_0x84eb('0x7')]='';this[_0x84eb('0x8')]=0x0;this[_0x84eb('0x9')]=0x0;this[_0x84eb('0xa')]=0x0;this[_0x84eb('0xb')]=![];this[_0x84eb('0xc')]=null;this['endtime']=null;this[_0x84eb('0xd')]=![];this[_0x84eb('0xe')]=![];this[_0x84eb('0xf')]='';this[_0x84eb('0x10')]='';this[_0x84eb('0x11')]=0x0;this[_0x84eb('0x12')]=0x0;this[_0x84eb('0x13')]=0x0;this[_0x84eb('0x14')]=null;this[_0x84eb('0x15')]=null;this['disposition']=null;this[_0x84eb('0x16')]=![];this[_0x84eb('0x17')]=null;this[_0x84eb('0x18')]=null;this[_0x84eb('0x19')]=[];this['transfercalleridnum']=undefined;this[_0x84eb('0x1a')]=undefined;this[_0x84eb('0x1b')]=0x0;}module[_0x84eb('0x1c')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 109bf97..8cc6e0d 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 _0x42b0=['exports','name','username','remoteUri','authType','password','consumerKey','token','type','serverUrl','Configurations'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x42b0,0xbc));var _0x042b=function(_0x4b1470,_0x34beaf){_0x4b1470=_0x4b1470-0x0;var _0x201f80=_0x42b0[_0x4b1470];return _0x201f80;};'use strict';function DeskAccount(_0x18c419){this['id']=_0x18c419['id']||0x0;this[_0x042b('0x0')]=_0x18c419['name']||'';this[_0x042b('0x1')]=_0x18c419['username']||'';this[_0x042b('0x2')]=_0x18c419['remoteUri']||'';this['authType']=_0x18c419[_0x042b('0x3')]||'';this[_0x042b('0x4')]=_0x18c419[_0x042b('0x4')]||'';this[_0x042b('0x5')]=_0x18c419[_0x042b('0x5')]||'';this['consumerSecret']=_0x18c419['consumerSecret']||'';this[_0x042b('0x6')]=_0x18c419[_0x042b('0x6')]||'';this['tokenSecret']=_0x18c419['tokenSecret']||'';this[_0x042b('0x7')]=_0x18c419['type']||'';this[_0x042b('0x8')]=_0x18c419['serverUrl']||'';this[_0x042b('0x9')]=_0x18c419[_0x042b('0x9')]||{};}module[_0x042b('0xa')]=DeskAccount; \ No newline at end of file +var _0x769c=['password','consumerKey','token','tokenSecret','type','serverUrl','exports','name','username','remoteUri','authType'];(function(_0xdf4058,_0x3d913d){var _0x141888=function(_0x52b935){while(--_0x52b935){_0xdf4058['push'](_0xdf4058['shift']());}};_0x141888(++_0x3d913d);}(_0x769c,0x96));var _0xc769=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x769c[_0x46e363];return _0x3fb059;};'use strict';function DeskAccount(_0x43ea58){this['id']=_0x43ea58['id']||0x0;this['name']=_0x43ea58[_0xc769('0x0')]||'';this[_0xc769('0x1')]=_0x43ea58['username']||'';this['remoteUri']=_0x43ea58[_0xc769('0x2')]||'';this[_0xc769('0x3')]=_0x43ea58[_0xc769('0x3')]||'';this[_0xc769('0x4')]=_0x43ea58['password']||'';this[_0xc769('0x5')]=_0x43ea58[_0xc769('0x5')]||'';this['consumerSecret']=_0x43ea58['consumerSecret']||'';this[_0xc769('0x6')]=_0x43ea58[_0xc769('0x6')]||'';this[_0xc769('0x7')]=_0x43ea58[_0xc769('0x7')]||'';this[_0xc769('0x8')]=_0x43ea58[_0xc769('0x8')]||'';this[_0xc769('0x9')]=_0x43ea58['serverUrl']||'';this['Configurations']=_0x43ea58['Configurations']||{};}module[_0xc769('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 0624f2c..4f132d1 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 _0xfa22=['serverUrl','Configurations','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x556b1d,_0xa0f67e){var _0x346381=function(_0x31a455){while(--_0x31a455){_0x556b1d['push'](_0x556b1d['shift']());}};_0x346381(++_0xa0f67e);}(_0xfa22,0x1f1));var _0x2fa2=function(_0x4bddba,_0xf1dcdd){_0x4bddba=_0x4bddba-0x0;var _0x26eb93=_0xfa22[_0x4bddba];return _0x26eb93;};'use strict';function Dynamics365Account(_0x959bd6){this['id']=_0x959bd6['id']||0x0;this['name']=_0x959bd6[_0x2fa2('0x0')]||'';this['username']=_0x959bd6[_0x2fa2('0x1')]||'';this[_0x2fa2('0x2')]=_0x959bd6[_0x2fa2('0x2')]||'';this[_0x2fa2('0x3')]=_0x959bd6[_0x2fa2('0x3')]||'';this[_0x2fa2('0x4')]=_0x959bd6[_0x2fa2('0x4')]||'';this[_0x2fa2('0x5')]=_0x959bd6[_0x2fa2('0x5')]||'';this[_0x2fa2('0x6')]=_0x959bd6[_0x2fa2('0x6')]||{};this[_0x2fa2('0x7')]=_0x959bd6['serverUrl']||'';this[_0x2fa2('0x8')]=_0x959bd6['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xc647=['clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0x18bea6,_0x4af3f8){var _0x58bcd4=function(_0x901fa9){while(--_0x901fa9){_0x18bea6['push'](_0x18bea6['shift']());}};_0x58bcd4(++_0x4af3f8);}(_0xc647,0x159));var _0x7c64=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xc647[_0x4d8ed9];return _0x1e2140;};'use strict';function Dynamics365Account(_0x559107){this['id']=_0x559107['id']||0x0;this['name']=_0x559107[_0x7c64('0x0')]||'';this[_0x7c64('0x1')]=_0x559107[_0x7c64('0x1')]||'';this[_0x7c64('0x2')]=_0x559107[_0x7c64('0x2')]||'';this['remoteUri']=_0x559107[_0x7c64('0x3')]||'';this[_0x7c64('0x4')]=_0x559107[_0x7c64('0x4')]||'';this[_0x7c64('0x5')]=_0x559107[_0x7c64('0x5')]||'';this['clientSecret']=_0x559107[_0x7c64('0x6')]||{};this[_0x7c64('0x7')]=_0x559107[_0x7c64('0x7')]||'';this[_0x7c64('0x8')]=_0x559107[_0x7c64('0x8')]||{};}module[_0x7c64('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index a7f4214..83b218b 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 _0x515a=['tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x3c2f6d,_0x4a00b3){var _0x5ded4d=function(_0x52c6e3){while(--_0x52c6e3){_0x3c2f6d['push'](_0x3c2f6d['shift']());}};_0x5ded4d(++_0x4a00b3);}(_0x515a,0x14a));var _0xa515=function(_0x266187,_0x44435d){_0x266187=_0x266187-0x0;var _0x4bcdac=_0x515a[_0x266187];return _0x4bcdac;};'use strict';function FaxAccount(_0x17b09c){this['id']=_0x17b09c['id']||0x0;this['name']=_0x17b09c[_0xa515('0x0')]||'';this[_0xa515('0x1')]=_0x17b09c[_0xa515('0x1')];this[_0xa515('0x2')]=_0x17b09c[_0xa515('0x2')];this[_0xa515('0x3')]=_0x17b09c['headerinfo'];this[_0xa515('0x4')]=_0x17b09c[_0xa515('0x4')];this[_0xa515('0x5')]=_0x17b09c['minrate']||0x960;this[_0xa515('0x6')]=_0x17b09c[_0xa515('0x6')]||0x3840;this[_0xa515('0x7')]=_0x17b09c[_0xa515('0x7')]||_0xa515('0x8');this[_0xa515('0x9')]=_0x17b09c[_0xa515('0x9')]||'no';this['faxdetect']=_0x17b09c[_0xa515('0xa')]||'no';this[_0xa515('0xb')]=_0x17b09c[_0xa515('0xb')]||0x1388;this[_0xa515('0xc')]=_0x17b09c[_0xa515('0xc')]||_0xa515('0xd');this[_0xa515('0xe')]=_0x17b09c[_0xa515('0xe')]?_0x17b09c[_0xa515('0xe')]:undefined;this[_0xa515('0xf')]=_0x17b09c[_0xa515('0xf')];this['key']=_0x17b09c[_0xa515('0x10')];}module[_0xa515('0x11')]=FaxAccount; \ No newline at end of file +var _0x87f1=['maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x87f1,0x170));var _0x187f=function(_0x2ac2de,_0x109a1e){_0x2ac2de=_0x2ac2de-0x0;var _0xf453a1=_0x87f1[_0x2ac2de];return _0xf453a1;};'use strict';function FaxAccount(_0x20a6ec){this['id']=_0x20a6ec['id']||0x0;this[_0x187f('0x0')]=_0x20a6ec[_0x187f('0x0')]||'';this[_0x187f('0x1')]=_0x20a6ec[_0x187f('0x1')];this[_0x187f('0x2')]=_0x20a6ec[_0x187f('0x2')];this[_0x187f('0x3')]=_0x20a6ec['headerinfo'];this[_0x187f('0x4')]=_0x20a6ec['localstationid'];this[_0x187f('0x5')]=_0x20a6ec['minrate']||0x960;this[_0x187f('0x6')]=_0x20a6ec['maxrate']||0x3840;this[_0x187f('0x7')]=_0x20a6ec[_0x187f('0x7')]||_0x187f('0x8');this[_0x187f('0x9')]=_0x20a6ec[_0x187f('0x9')]||'no';this[_0x187f('0xa')]=_0x20a6ec['faxdetect']||'no';this[_0x187f('0xb')]=_0x20a6ec[_0x187f('0xb')]||0x1388;this['tech']=_0x20a6ec['tech']||_0x187f('0xc');this[_0x187f('0xd')]=_0x20a6ec[_0x187f('0xd')]?_0x20a6ec[_0x187f('0xd')]:undefined;this[_0x187f('0xe')]=_0x20a6ec[_0x187f('0xe')];this[_0x187f('0xf')]=_0x20a6ec[_0x187f('0xf')];}module[_0x187f('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 68e3310..0946f0c 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 _0xf643=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x5bd8be,_0x1818e5){var _0x36a42a=function(_0x19b9ba){while(--_0x19b9ba){_0x5bd8be['push'](_0x5bd8be['shift']());}};_0x36a42a(++_0x1818e5);}(_0xf643,0x80));var _0x3f64=function(_0x2f7e15,_0x6e0949){_0x2f7e15=_0x2f7e15-0x0;var _0xbf1bf1=_0xf643[_0x2f7e15];return _0xbf1bf1;};'use strict';function FreshdeskAccount(_0x4a59e2){this['id']=_0x4a59e2['id']||0x0;this['name']=_0x4a59e2[_0x3f64('0x0')]||'';this[_0x3f64('0x1')]=_0x4a59e2[_0x3f64('0x1')]||'';this[_0x3f64('0x2')]=_0x4a59e2[_0x3f64('0x3')]||'';this[_0x3f64('0x4')]=_0x4a59e2[_0x3f64('0x4')]||'';this['serverUrl']=_0x4a59e2[_0x3f64('0x5')]||'';this[_0x3f64('0x6')]=_0x4a59e2['Configurations']||{};}module[_0x3f64('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xb661=['serverUrl','Configurations','name','username','apiKey','token','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb661,0x144));var _0x1b66=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xb661[_0xea8947];return _0x2455e9;};'use strict';function FreshdeskAccount(_0x223f67){this['id']=_0x223f67['id']||0x0;this[_0x1b66('0x0')]=_0x223f67[_0x1b66('0x0')]||'';this[_0x1b66('0x1')]=_0x223f67[_0x1b66('0x1')]||'';this[_0x1b66('0x2')]=_0x223f67[_0x1b66('0x3')]||'';this[_0x1b66('0x4')]=_0x223f67[_0x1b66('0x4')]||'';this[_0x1b66('0x5')]=_0x223f67[_0x1b66('0x5')]||'';this[_0x1b66('0x6')]=_0x223f67[_0x1b66('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 5e55113..2a75b59 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 _0xfc3c=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x558097,_0x5a6cc2){var _0xe80464=function(_0x46db4f){while(--_0x46db4f){_0x558097['push'](_0x558097['shift']());}};_0xe80464(++_0x5a6cc2);}(_0xfc3c,0x14d));var _0xcfc3=function(_0x3dc089,_0x5ccb0d){_0x3dc089=_0x3dc089-0x0;var _0x34d9d3=_0xfc3c[_0x3dc089];return _0x34d9d3;};'use strict';function FreshsalesAccount(_0x4801){this['id']=_0x4801['id']||0x0;this[_0xcfc3('0x0')]=_0x4801[_0xcfc3('0x0')]||'';this[_0xcfc3('0x1')]=_0x4801[_0xcfc3('0x1')]||'';this[_0xcfc3('0x2')]=_0x4801[_0xcfc3('0x3')]||'';this[_0xcfc3('0x4')]=_0x4801[_0xcfc3('0x4')]||'';this[_0xcfc3('0x5')]=_0x4801[_0xcfc3('0x5')]||'';this['Configurations']=_0x4801[_0xcfc3('0x6')]||{};}module[_0xcfc3('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x8946=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x8946,0xc6));var _0x6894=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x8946[_0x4b2863];return _0x567d67;};'use strict';function FreshsalesAccount(_0x15ffe0){this['id']=_0x15ffe0['id']||0x0;this[_0x6894('0x0')]=_0x15ffe0[_0x6894('0x0')]||'';this[_0x6894('0x1')]=_0x15ffe0[_0x6894('0x1')]||'';this[_0x6894('0x2')]=_0x15ffe0[_0x6894('0x3')]||'';this['remoteUri']=_0x15ffe0[_0x6894('0x4')]||'';this[_0x6894('0x5')]=_0x15ffe0['serverUrl']||'';this[_0x6894('0x6')]=_0x15ffe0[_0x6894('0x6')]||{};}module[_0x6894('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index e119652..005e4db 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 _0xea77=['context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode'];(function(_0x4b434a,_0x54470d){var _0xa947b7=function(_0x5ebcc1){while(--_0x5ebcc1){_0x4b434a['push'](_0x4b434a['shift']());}};_0xa947b7(++_0x54470d);}(_0xea77,0xd1));var _0x7ea7=function(_0x2c76b4,_0x5b4685){_0x2c76b4=_0x2c76b4-0x0;var _0x5e6d2c=_0xea77[_0x2c76b4];return _0x5e6d2c;};'use strict';function QueueReport(){this[_0x7ea7('0x0')]=_0x7ea7('0x1');this[_0x7ea7('0x2')]='';this[_0x7ea7('0x3')]='';this[_0x7ea7('0x4')]='';this[_0x7ea7('0x5')]='';this['queuecallerjoinAt']=null;this[_0x7ea7('0x6')]=null;this[_0x7ea7('0x7')]=0x1;this[_0x7ea7('0x8')]=0x1;this[_0x7ea7('0x9')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0x7ea7('0xa')]=![];this[_0x7ea7('0xb')]=null;this['originalposition']=0x1;this[_0x7ea7('0xc')]='';this[_0x7ea7('0xd')]='';this[_0x7ea7('0xe')]='';this[_0x7ea7('0xf')]='';this[_0x7ea7('0x10')]='';this[_0x7ea7('0x11')]='';this[_0x7ea7('0x12')]='';this[_0x7ea7('0x13')]=0x0;this[_0x7ea7('0x14')]=![];this[_0x7ea7('0x15')]='';this[_0x7ea7('0x16')]=0x0;this[_0x7ea7('0x17')]={};}module[_0x7ea7('0x18')]=QueueReport; \ No newline at end of file +var _0x04f9=['calleridname','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','exports','type','inbound','uniqueid','calleridnum'];(function(_0x20b9cd,_0x154dbf){var _0x1dd019=function(_0x321918){while(--_0x321918){_0x20b9cd['push'](_0x20b9cd['shift']());}};_0x1dd019(++_0x154dbf);}(_0x04f9,0x1d7));var _0x904f=function(_0x4d0c04,_0x319ae7){_0x4d0c04=_0x4d0c04-0x0;var _0x115f3a=_0x04f9[_0x4d0c04];return _0x115f3a;};'use strict';function QueueReport(){this[_0x904f('0x0')]=_0x904f('0x1');this[_0x904f('0x2')]='';this[_0x904f('0x3')]='';this[_0x904f('0x4')]='';this['queue']='';this[_0x904f('0x5')]=null;this[_0x904f('0x6')]=null;this['position']=0x1;this[_0x904f('0x7')]=0x1;this['queuecallerabandon']=![];this[_0x904f('0x8')]=null;this['queuecallercomplete']=![];this[_0x904f('0x9')]=null;this[_0x904f('0xa')]=![];this[_0x904f('0xb')]=null;this[_0x904f('0xc')]=0x1;this[_0x904f('0xd')]='';this[_0x904f('0xe')]='';this[_0x904f('0xf')]='';this[_0x904f('0x10')]='';this[_0x904f('0x11')]='';this[_0x904f('0x12')]='';this[_0x904f('0x13')]='';this[_0x904f('0x14')]=0x0;this[_0x904f('0x15')]=![];this[_0x904f('0x16')]='';this[_0x904f('0x17')]=0x0;this['variables']={};}module[_0x904f('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index d0dadb8..f97b99e 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 _0xd239=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x488b76,_0x574503){var _0x4ab906=function(_0x26c838){while(--_0x26c838){_0x488b76['push'](_0x488b76['shift']());}};_0x4ab906(++_0x574503);}(_0xd239,0xa2));var _0x9d23=function(_0x5b74ef,_0x351870){_0x5b74ef=_0x5b74ef-0x0;var _0x295416=_0xd239[_0x5b74ef];return _0x295416;};'use strict';function SalesforceAccount(_0x188b31){this['id']=_0x188b31['id']||0x0;this[_0x9d23('0x0')]=_0x188b31[_0x9d23('0x0')]||'';this['username']=_0x188b31[_0x9d23('0x1')]||'';this['remoteUri']=_0x188b31['remoteUri']||'';this[_0x9d23('0x2')]=_0x188b31[_0x9d23('0x2')]||'';this['clientId']=_0x188b31[_0x9d23('0x3')]||'';this['clientSecret']=_0x188b31[_0x9d23('0x4')]||'';this['securityToken']=_0x188b31[_0x9d23('0x5')]||'';this[_0x9d23('0x6')]=_0x188b31[_0x9d23('0x6')]||_0x9d23('0x7');this[_0x9d23('0x8')]=_0x188b31[_0x9d23('0x8')]||'';this[_0x9d23('0x9')]=_0x188b31[_0x9d23('0x9')]||{};}module[_0x9d23('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x7d21=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x3252c0,_0x4d0d25){var _0x18bc83=function(_0x436b4f){while(--_0x436b4f){_0x3252c0['push'](_0x3252c0['shift']());}};_0x18bc83(++_0x4d0d25);}(_0x7d21,0x188));var _0x17d2=function(_0x47bf3b,_0x5d4dc1){_0x47bf3b=_0x47bf3b-0x0;var _0x4d77ce=_0x7d21[_0x47bf3b];return _0x4d77ce;};'use strict';function SalesforceAccount(_0x513f83){this['id']=_0x513f83['id']||0x0;this['name']=_0x513f83[_0x17d2('0x0')]||'';this['username']=_0x513f83[_0x17d2('0x1')]||'';this[_0x17d2('0x2')]=_0x513f83[_0x17d2('0x2')]||'';this[_0x17d2('0x3')]=_0x513f83[_0x17d2('0x3')]||'';this[_0x17d2('0x4')]=_0x513f83[_0x17d2('0x4')]||'';this[_0x17d2('0x5')]=_0x513f83[_0x17d2('0x5')]||'';this[_0x17d2('0x6')]=_0x513f83[_0x17d2('0x6')]||'';this[_0x17d2('0x7')]=_0x513f83[_0x17d2('0x7')]||_0x17d2('0x8');this[_0x17d2('0x9')]=_0x513f83[_0x17d2('0x9')]||'';this[_0x17d2('0xa')]=_0x513f83[_0x17d2('0xa')]||{};}module[_0x17d2('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 aaeb560..b870d45 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 _0x2103=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x4d9d0,_0x191f49){var _0x2874fd=function(_0x22bde9){while(--_0x22bde9){_0x4d9d0['push'](_0x4d9d0['shift']());}};_0x2874fd(++_0x191f49);}(_0x2103,0x12a));var _0x3210=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x2103[_0x1d1779];return _0x2377e9;};'use strict';function ServicenowAccount(_0x2a3519){this['id']=_0x2a3519['id']||0x0;this[_0x3210('0x0')]=_0x2a3519[_0x3210('0x0')]||'';this[_0x3210('0x1')]=_0x2a3519[_0x3210('0x1')]||'';this['password']=_0x2a3519[_0x3210('0x2')]||'';this[_0x3210('0x3')]=_0x2a3519[_0x3210('0x3')]||'';this[_0x3210('0x4')]=_0x2a3519['serverUrl']||'';this[_0x3210('0x5')]=_0x2a3519[_0x3210('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x6a20=['password','serverUrl','Configurations','exports','name','username'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x6a20,0x1a2));var _0x06a2=function(_0x54613d,_0x4b8872){_0x54613d=_0x54613d-0x0;var _0x11c35b=_0x6a20[_0x54613d];return _0x11c35b;};'use strict';function ServicenowAccount(_0xc8c267){this['id']=_0xc8c267['id']||0x0;this['name']=_0xc8c267[_0x06a2('0x0')]||'';this[_0x06a2('0x1')]=_0xc8c267[_0x06a2('0x1')]||'';this[_0x06a2('0x2')]=_0xc8c267['password']||'';this['remoteUri']=_0xc8c267['remoteUri']||'';this['serverUrl']=_0xc8c267[_0x06a2('0x3')]||'';this[_0x06a2('0x4')]=_0xc8c267[_0x06a2('0x4')]||{};}module[_0x06a2('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 2afa63b..c199bc8 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 _0x7a62=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x5d9ceb,_0x1a49f5){var _0x33ce82=function(_0x583915){while(--_0x583915){_0x5d9ceb['push'](_0x5d9ceb['shift']());}};_0x33ce82(++_0x1a49f5);}(_0x7a62,0x11c));var _0x27a6=function(_0x602c36,_0xf3dd60){_0x602c36=_0x602c36-0x0;var _0x508a5c=_0x7a62[_0x602c36];return _0x508a5c;};'use strict';function SugarcrmAccount(_0x5ab4e9){this['id']=_0x5ab4e9['id']||0x0;this[_0x27a6('0x0')]=_0x5ab4e9['name']||'';this['username']=_0x5ab4e9[_0x27a6('0x1')]||'';this['password']=_0x5ab4e9[_0x27a6('0x2')]||'';this[_0x27a6('0x3')]=_0x5ab4e9[_0x27a6('0x3')]||'';this[_0x27a6('0x4')]=_0x5ab4e9[_0x27a6('0x4')]||'';this[_0x27a6('0x5')]=_0x5ab4e9[_0x27a6('0x5')]||{};}module[_0x27a6('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xc644=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x533758,_0x582057){var _0x1bac87=function(_0x1a440d){while(--_0x1a440d){_0x533758['push'](_0x533758['shift']());}};_0x1bac87(++_0x582057);}(_0xc644,0x1eb));var _0x4c64=function(_0xb66f92,_0x301f99){_0xb66f92=_0xb66f92-0x0;var _0x344d2d=_0xc644[_0xb66f92];return _0x344d2d;};'use strict';function SugarcrmAccount(_0x368451){this['id']=_0x368451['id']||0x0;this['name']=_0x368451[_0x4c64('0x0')]||'';this['username']=_0x368451[_0x4c64('0x1')]||'';this[_0x4c64('0x2')]=_0x368451['password']||'';this[_0x4c64('0x3')]=_0x368451[_0x4c64('0x3')]||'';this[_0x4c64('0x4')]=_0x368451[_0x4c64('0x4')]||'';this[_0x4c64('0x5')]=_0x368451[_0x4c64('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 310fb2b..c10060e 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 _0x1555=['name','accountcode','state','stateTime','status','unknown','address','exports'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x1555,0x168));var _0x5155=function(_0x17bf55,_0x252089){_0x17bf55=_0x17bf55-0x0;var _0x22f2e7=_0x1555[_0x17bf55];return _0x22f2e7;};'use strict';function Telephone(_0x3f9f06){this['id']=_0x3f9f06['id']||0x0;this['name']=_0x3f9f06[_0x5155('0x0')]||'';this[_0x5155('0x1')]=_0x3f9f06[_0x5155('0x1')]||'';this[_0x5155('0x2')]='unknown';this[_0x5155('0x3')]=0x0;this[_0x5155('0x4')]=_0x5155('0x5');this[_0x5155('0x6')]='';}module[_0x5155('0x7')]=Telephone; \ No newline at end of file +var _0x7cbb=['exports','accountcode','state','unknown','stateTime','status','address'];(function(_0x54ee9f,_0x5bd511){var _0x51dcc9=function(_0x51158c){while(--_0x51158c){_0x54ee9f['push'](_0x54ee9f['shift']());}};_0x51dcc9(++_0x5bd511);}(_0x7cbb,0x151));var _0xb7cb=function(_0xd41166,_0x475a5c){_0xd41166=_0xd41166-0x0;var _0x3f8c81=_0x7cbb[_0xd41166];return _0x3f8c81;};'use strict';function Telephone(_0x47d4cf){this['id']=_0x47d4cf['id']||0x0;this['name']=_0x47d4cf['name']||'';this[_0xb7cb('0x0')]=_0x47d4cf[_0xb7cb('0x0')]||'';this[_0xb7cb('0x1')]=_0xb7cb('0x2');this[_0xb7cb('0x3')]=0x0;this[_0xb7cb('0x4')]='unknown';this[_0xb7cb('0x5')]='';}module[_0xb7cb('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 2972e13..4d5e07d 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 _0xf13b=['html','exports'];(function(_0x353a75,_0x56d596){var _0x1a17b9=function(_0x2be804){while(--_0x2be804){_0x353a75['push'](_0x353a75['shift']());}};_0x1a17b9(++_0x56d596);}(_0xf13b,0x1f0));var _0xbf13=function(_0x5780c3,_0x109e5f){_0x5780c3=_0x5780c3-0x0;var _0xa8446f=_0xf13b[_0x5780c3];return _0xa8446f;};'use strict';function template(_0x163576){this['id']=_0x163576['id']||0x0;this['name']=_0x163576['name']||'';this['html']=_0x163576[_0xbf13('0x0')]||'';}module[_0xbf13('0x1')]=template; \ No newline at end of file +var _0xbb04=['name','html','exports'];(function(_0x510f5d,_0x4ac744){var _0x1692a7=function(_0x1fb77c){while(--_0x1fb77c){_0x510f5d['push'](_0x510f5d['shift']());}};_0x1692a7(++_0x4ac744);}(_0xbb04,0x18f));var _0x4bb0=function(_0x146484,_0x27a7f0){_0x146484=_0x146484-0x0;var _0x4c7aa3=_0xbb04[_0x146484];return _0x4c7aa3;};'use strict';function template(_0x4e517a){this['id']=_0x4e517a['id']||0x0;this[_0x4bb0('0x0')]=_0x4e517a['name']||'';this[_0x4bb0('0x1')]=_0x4e517a[_0x4bb0('0x1')]||'';}module[_0x4bb0('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 69d01d5..44d01f5 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 _0x9c44=['voice','status','AnyConditions','Actions','exports','name','channel'];(function(_0x4ea98e,_0xd0821a){var _0x1e97cc=function(_0x3ea6ce){while(--_0x3ea6ce){_0x4ea98e['push'](_0x4ea98e['shift']());}};_0x1e97cc(++_0xd0821a);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';function Trigger(_0x2fa01d){this['id']=_0x2fa01d['id']||0x0;this['name']=_0x2fa01d[_0x49c4('0x0')]||'';this[_0x49c4('0x1')]=_0x2fa01d[_0x49c4('0x1')]||_0x49c4('0x2');this[_0x49c4('0x3')]=_0x2fa01d[_0x49c4('0x3')]||![];this['AllConditions']=_0x2fa01d['AllConditions']||[];this[_0x49c4('0x4')]=_0x2fa01d['AnyConditions']||[];this[_0x49c4('0x5')]=_0x2fa01d[_0x49c4('0x5')]||[];}module[_0x49c4('0x6')]=Trigger; \ No newline at end of file +var _0x9c44=['voice','status','AnyConditions','Actions','exports','name','channel'];(function(_0x324016,_0x160d4e){var _0x3eff77=function(_0x4f2287){while(--_0x4f2287){_0x324016['push'](_0x324016['shift']());}};_0x3eff77(++_0x160d4e);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';function Trigger(_0x2fa01d){this['id']=_0x2fa01d['id']||0x0;this['name']=_0x2fa01d[_0x49c4('0x0')]||'';this[_0x49c4('0x1')]=_0x2fa01d[_0x49c4('0x1')]||_0x49c4('0x2');this[_0x49c4('0x3')]=_0x2fa01d[_0x49c4('0x3')]||![];this['AllConditions']=_0x2fa01d['AllConditions']||[];this[_0x49c4('0x4')]=_0x2fa01d['AnyConditions']||[];this[_0x49c4('0x5')]=_0x2fa01d[_0x49c4('0x5')]||[];}module[_0x49c4('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 fe583b9..3fed9c1 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 _0x5cce=['active','name','state','unknown','stateTime','status','registry','indexOf','split','port','domain','domainport','refresh','stateRegistry','registrationtime','address'];(function(_0x399849,_0x3b630d){var _0xfbb04=function(_0x4fea04){while(--_0x4fea04){_0x399849['push'](_0x399849['shift']());}};_0xfbb04(++_0x3b630d);}(_0x5cce,0x160));var _0xe5cc=function(_0x388960,_0x1d096c){_0x388960=_0x388960-0x0;var _0x3a5c4b=_0x5cce[_0x388960];return _0x3a5c4b;};'use strict';function Trunk(_0x5ae88b){this['id']=_0x5ae88b['id']||0x0;this[_0xe5cc('0x0')]=_0x5ae88b[_0xe5cc('0x0')]||![];this[_0xe5cc('0x1')]=_0x5ae88b[_0xe5cc('0x1')]||'';this[_0xe5cc('0x2')]=_0xe5cc('0x3');this[_0xe5cc('0x4')]=0x0;this[_0xe5cc('0x5')]='unknown';this[_0xe5cc('0x6')]=_0x5ae88b[_0xe5cc('0x6')]&&_0x5ae88b[_0xe5cc('0x6')][_0xe5cc('0x7')](':')?_0x5ae88b['registry'][_0xe5cc('0x8')](':')[0x0]:'';this['host']='';this[_0xe5cc('0x9')]='';this[_0xe5cc('0xa')]='';this[_0xe5cc('0xb')]='';this[_0xe5cc('0xc')]='';this[_0xe5cc('0xd')]='unknown';this[_0xe5cc('0xe')]='';this[_0xe5cc('0xf')]='';}module['exports']=Trunk; \ No newline at end of file +var _0x2a77=['name','state','unknown','stateTime','status','registry','split','port','domain','domainport','refresh','stateRegistry','registrationtime','address','exports','active'];(function(_0x1ddabd,_0x3a3c19){var _0x3bf517=function(_0x30044c){while(--_0x30044c){_0x1ddabd['push'](_0x1ddabd['shift']());}};_0x3bf517(++_0x3a3c19);}(_0x2a77,0xcf));var _0x72a7=function(_0x21f4b2,_0x4fffe5){_0x21f4b2=_0x21f4b2-0x0;var _0x1d8b06=_0x2a77[_0x21f4b2];return _0x1d8b06;};'use strict';function Trunk(_0x32e804){this['id']=_0x32e804['id']||0x0;this[_0x72a7('0x0')]=_0x32e804[_0x72a7('0x0')]||![];this['name']=_0x32e804[_0x72a7('0x1')]||'';this[_0x72a7('0x2')]=_0x72a7('0x3');this[_0x72a7('0x4')]=0x0;this[_0x72a7('0x5')]=_0x72a7('0x3');this['registry']=_0x32e804[_0x72a7('0x6')]&&_0x32e804[_0x72a7('0x6')]['indexOf'](':')?_0x32e804['registry'][_0x72a7('0x7')](':')[0x0]:'';this['host']='';this[_0x72a7('0x8')]='';this[_0x72a7('0x9')]='';this[_0x72a7('0xa')]='';this[_0x72a7('0xb')]='';this[_0x72a7('0xc')]=_0x72a7('0x3');this[_0x72a7('0xd')]='';this[_0x72a7('0xe')]='';}module[_0x72a7('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 42b29d4..b1d3df8 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 _0x2413=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x539cd1,_0x5124fd){var _0x2ae401=function(_0x584814){while(--_0x584814){_0x539cd1['push'](_0x539cd1['shift']());}};_0x2ae401(++_0x5124fd);}(_0x2413,0x149));var _0x3241=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2413[_0x42cae2];return _0x5f256f;};'use strict';function voiceExtension(_0x305978){this['id']=_0x305978['id']||0x0;this[_0x3241('0x0')]=_0x305978[_0x3241('0x0')]||'';this[_0x3241('0x1')]=_0x305978[_0x3241('0x1')]||_0x3241('0x2');this['mandatoryDisposition']=_0x305978[_0x3241('0x3')]||![];}module[_0x3241('0x4')]=voiceExtension; \ No newline at end of file +var _0x13ba=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x5defe5,_0x173dc7){var _0x466cc0=function(_0x170d9c){while(--_0x170d9c){_0x5defe5['push'](_0x5defe5['shift']());}};_0x466cc0(++_0x173dc7);}(_0x13ba,0x1cf));var _0xa13b=function(_0x99682f,_0x471920){_0x99682f=_0x99682f-0x0;var _0x58bebd=_0x13ba[_0x99682f];return _0x58bebd;};'use strict';function voiceExtension(_0x56b739){this['id']=_0x56b739['id']||0x0;this[_0xa13b('0x0')]=_0x56b739[_0xa13b('0x0')]||'';this[_0xa13b('0x1')]=_0x56b739[_0xa13b('0x1')]||_0xa13b('0x2');this[_0xa13b('0x3')]=_0x56b739[_0xa13b('0x3')]||![];}module[_0xa13b('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 624a6f3..56fe310 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 _0xc2be=['predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','ringing','ringinuse','onhold','wav49','gsm','rrmemory','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold'];(function(_0x17819d,_0x2c741e){var _0x59813d=function(_0x10f0cf){while(--_0x10f0cf){_0x17819d['push'](_0x17819d['shift']());}};_0x59813d(++_0x2c741e);}(_0xc2be,0x84));var _0xec2b=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0xc2be[_0x40df5f];return _0x1573f1;};'use strict';var statusDesc=['unknown',_0xec2b('0x0'),_0xec2b('0x1'),'busy','invalid','unavailable',_0xec2b('0x2'),_0xec2b('0x3'),_0xec2b('0x4')];var monitorFormat={'wav':'wav','wav49':_0xec2b('0x5'),'gsm':_0xec2b('0x6')};var strategy={'rrmemory':_0xec2b('0x7'),'roundrobin':'roundrobin'};function VoiceQueue(_0x46dcf8){this['id']=_0x46dcf8['id']||0x0;this[_0xec2b('0x8')]=_0x46dcf8[_0xec2b('0x8')]||'';this[_0xec2b('0x9')]=_0x46dcf8[_0xec2b('0x9')]||'';this['type']=_0x46dcf8[_0xec2b('0xa')]||_0xec2b('0xb');this['waiting']=0x0;this['talking']=0x0;this[_0xec2b('0xc')]=0x0;this[_0xec2b('0xd')]=0x0;this[_0xec2b('0xe')]=0x0;this[_0xec2b('0xf')]=0x0;this['sumBillable']=0x0;this[_0xec2b('0x10')]=0x0;this['abandoned']=0x0;this[_0xec2b('0x11')]=0x0;this[_0xec2b('0x12')]=0x0;this[_0xec2b('0x13')]=_0x46dcf8['acw']||![];this[_0xec2b('0x14')]=_0x46dcf8[_0xec2b('0x14')]||0xa;this[_0xec2b('0x15')]=_0x46dcf8[_0xec2b('0x15')]||'no';this[_0xec2b('0x16')]=!![];this[_0xec2b('0x17')]='';this[_0xec2b('0x18')]=0x0;this[_0xec2b('0x19')]=0x0;this[_0xec2b('0x1a')]=_0x46dcf8[_0xec2b('0x1a')]||null;this['dialGlobalInterval']=_0x46dcf8[_0xec2b('0x1b')]?_0x46dcf8['dialGlobalInterval']:null;this[_0xec2b('0x1c')]=_0x46dcf8[_0xec2b('0x1c')];this[_0xec2b('0x1d')]=_0x46dcf8[_0xec2b('0x1d')]||_0xec2b('0x1e');this['dialLimitChannel']=_0x46dcf8[_0xec2b('0x1f')]||0x0;this['dialLimitQueue']=_0x46dcf8[_0xec2b('0x20')]||0x0;this[_0xec2b('0x21')]=_0x46dcf8['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x46dcf8[_0xec2b('0x22')]||_0xec2b('0x23');this[_0xec2b('0x24')]=_0x46dcf8[_0xec2b('0x24')]||0.03;this[_0xec2b('0x25')]=_0x46dcf8[_0xec2b('0x25')]||0x258;this[_0xec2b('0x26')]=_0x46dcf8[_0xec2b('0x26')]||_0xec2b('0x27');this['dialOriginateCallerIdNumber']=_0x46dcf8[_0xec2b('0x28')]||_0xec2b('0x27');this[_0xec2b('0x29')]=_0x46dcf8['dialOriginateTimeout']||0x1e;this[_0xec2b('0x2a')]=_0x46dcf8['dialQueueOptions']||'tTxX';this[_0xec2b('0x2b')]=_0x46dcf8['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x46dcf8[_0xec2b('0x2c')]||undefined;this['dialCongestionMaxRetry']=_0x46dcf8[_0xec2b('0x2d')]||0x3;this[_0xec2b('0x2e')]=_0x46dcf8['dialCongestionRetryFrequency']||0x96;this[_0xec2b('0x2f')]=_0x46dcf8[_0xec2b('0x2f')]||0x3;this['dialBusyRetryFrequency']=_0x46dcf8[_0xec2b('0x30')]||0x96;this[_0xec2b('0x31')]=_0x46dcf8[_0xec2b('0x31')]||0x3;this[_0xec2b('0x32')]=_0x46dcf8[_0xec2b('0x32')]||0x96;this[_0xec2b('0x33')]=_0x46dcf8[_0xec2b('0x33')]||0x3;this[_0xec2b('0x34')]=_0x46dcf8[_0xec2b('0x34')]||0x96;this[_0xec2b('0x35')]=_0x46dcf8[_0xec2b('0x35')]||0x3;this[_0xec2b('0x36')]=_0x46dcf8['dialDropRetryFrequency']||0x96;this[_0xec2b('0x37')]=_0x46dcf8[_0xec2b('0x37')]||0x3;this[_0xec2b('0x38')]=_0x46dcf8[_0xec2b('0x38')]||0x96;this[_0xec2b('0x39')]=_0x46dcf8[_0xec2b('0x39')]||0x3;this[_0xec2b('0x3a')]=_0x46dcf8['dialMachineRetryFrequency']||0x96;this[_0xec2b('0x3b')]=_0x46dcf8['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x46dcf8[_0xec2b('0x3c')]||0x96;this[_0xec2b('0x3d')]=_0x46dcf8[_0xec2b('0x3d')]||0x4;this[_0xec2b('0x3e')]=_0x46dcf8['Trunk']?_0x46dcf8[_0xec2b('0x3e')]:undefined;this[_0xec2b('0x3f')]=_0x46dcf8[_0xec2b('0x3f')]?_0x46dcf8['TrunkBackup']:undefined;this[_0xec2b('0x40')]=_0x46dcf8[_0xec2b('0x40')]||undefined;this[_0xec2b('0x41')]=_0x46dcf8[_0xec2b('0x41')]?_0x46dcf8[_0xec2b('0x41')]:undefined;this['dialOrderByScheduledAt']=_0x46dcf8['dialOrderByScheduledAt']||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x46dcf8[_0xec2b('0x42')]||undefined;this['dialCutDigit']=_0x46dcf8[_0xec2b('0x43')]||undefined;this[_0xec2b('0x44')]=strategy[_0x46dcf8[_0xec2b('0x44')]]||_0xec2b('0x7');this[_0xec2b('0x45')]=!![];this[_0xec2b('0x46')]=_0x46dcf8['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x46dcf8[_0xec2b('0x47')];this[_0xec2b('0x48')]=_0x46dcf8[_0xec2b('0x48')];this['dialAMDAfterGreetingSilence']=_0x46dcf8[_0xec2b('0x49')];this[_0xec2b('0x4a')]=_0x46dcf8['dialAMDTotalAnalysisTime'];this[_0xec2b('0x4b')]=_0x46dcf8[_0xec2b('0x4b')];this[_0xec2b('0x4c')]=_0x46dcf8[_0xec2b('0x4c')];this['dialAMDMaximumNumberOfWords']=_0x46dcf8[_0xec2b('0x4d')];this[_0xec2b('0x4e')]=_0x46dcf8['dialAMDSilenceThreshold'];this[_0xec2b('0x4f')]=_0x46dcf8['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0xec2b('0x50')]=0x0;this['timeout']=_0x46dcf8['timeout'];this[_0xec2b('0x51')]=0x0;this[_0xec2b('0x52')]=0x0;this[_0xec2b('0x53')]=0x0;this[_0xec2b('0x54')]=0x0;this[_0xec2b('0x55')]=0x0;this[_0xec2b('0x56')]=0x0;this[_0xec2b('0x57')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xec2b('0x58')]=0x0;this[_0xec2b('0x59')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xec2b('0x5a')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0xec2b('0x5b')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0xec2b('0x5c')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xec2b('0x5d')]=0x0;this[_0xec2b('0x5e')]=0x0;this[_0xec2b('0x5f')]=0x0;this[_0xec2b('0x60')]=0x0;this[_0xec2b('0x61')]=0x0;this[_0xec2b('0x62')]=0x0;this[_0xec2b('0x63')]=_0x46dcf8[_0xec2b('0x64')]||0x14;this[_0xec2b('0x65')]=_0x46dcf8[_0xec2b('0x64')]||0xa;this[_0xec2b('0x66')]=0x0;this[_0xec2b('0x67')]=0x0;this[_0xec2b('0x68')]=0x1;this[_0xec2b('0x69')]=0x0;this[_0xec2b('0x6a')]=0x0;this[_0xec2b('0x6b')]=0x0;this[_0xec2b('0x6c')]=0x0;this[_0xec2b('0x6d')]=_0x46dcf8[_0xec2b('0x6d')]||0x1e;this['dialRecallInQueue']=_0x46dcf8[_0xec2b('0x6e')]||![];this['dialQueueProject2']=_0x46dcf8[_0xec2b('0x6f')]||undefined;this[_0xec2b('0x70')]=_0x46dcf8[_0xec2b('0x70')]||![];this[_0xec2b('0x71')]=_0x46dcf8[_0xec2b('0x71')]||![];this[_0xec2b('0x9')]=monitorFormat[_0x46dcf8[_0xec2b('0x9')]]?monitorFormat[_0x46dcf8[_0xec2b('0x9')]]:undefined;this[_0xec2b('0x72')]=_0x46dcf8[_0xec2b('0x72')]||![];this[_0xec2b('0x73')]=_0x46dcf8[_0xec2b('0x73')]?_0x46dcf8['mandatoryDispositionPause']:undefined;}module[_0xec2b('0x74')]=VoiceQueue; \ No newline at end of file +var _0xb52a=['dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','invalid','ringing','ringinuse','wav','wav49','gsm','roundrobin','name','monitor_format','inbound','waiting','talking','total','answered','sumHoldTime','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel'];(function(_0x39338d,_0x29e800){var _0x1700b5=function(_0x5478e7){while(--_0x5478e7){_0x39338d['push'](_0x39338d['shift']());}};_0x1700b5(++_0x29e800);}(_0xb52a,0x142));var _0xab52=function(_0x1c156e,_0x3263a6){_0x1c156e=_0x1c156e-0x0;var _0x58fc22=_0xb52a[_0x1c156e];return _0x58fc22;};'use strict';var statusDesc=['unknown',_0xab52('0x0'),_0xab52('0x1'),'busy',_0xab52('0x2'),'unavailable',_0xab52('0x3'),_0xab52('0x4'),'onhold'];var monitorFormat={'wav':_0xab52('0x5'),'wav49':_0xab52('0x6'),'gsm':_0xab52('0x7')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xab52('0x8')};function VoiceQueue(_0x385793){this['id']=_0x385793['id']||0x0;this[_0xab52('0x9')]=_0x385793[_0xab52('0x9')]||'';this[_0xab52('0xa')]=_0x385793[_0xab52('0xa')]||'';this['type']=_0x385793['type']||_0xab52('0xb');this[_0xab52('0xc')]=0x0;this[_0xab52('0xd')]=0x0;this[_0xab52('0xe')]=0x0;this[_0xab52('0xf')]=0x0;this['sumDuration']=0x0;this[_0xab52('0x10')]=0x0;this['sumBillable']=0x0;this[_0xab52('0x11')]=0x0;this[_0xab52('0x12')]=0x0;this[_0xab52('0x13')]=0x0;this[_0xab52('0x14')]=0x0;this[_0xab52('0x15')]=_0x385793[_0xab52('0x15')]||![];this['acwTimeout']=_0x385793[_0xab52('0x16')]||0xa;this[_0xab52('0x17')]=_0x385793['autopause']||'no';this[_0xab52('0x18')]=!![];this[_0xab52('0x19')]='';this[_0xab52('0x1a')]=0x0;this[_0xab52('0x1b')]=0x0;this[_0xab52('0x1c')]=_0x385793[_0xab52('0x1c')]||null;this[_0xab52('0x1d')]=_0x385793[_0xab52('0x1d')]?_0x385793[_0xab52('0x1d')]:null;this[_0xab52('0x1e')]=_0x385793[_0xab52('0x1e')];this['dialMethod']=_0x385793['dialMethod']||_0xab52('0x1f');this[_0xab52('0x20')]=_0x385793['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x385793[_0xab52('0x21')]||0x0;this[_0xab52('0x22')]=_0x385793[_0xab52('0x22')]||0x1;this[_0xab52('0x23')]=_0x385793['dialPredictiveOptimization']||_0xab52('0x24');this[_0xab52('0x25')]=_0x385793[_0xab52('0x25')]||0.03;this['dialPredictiveInterval']=_0x385793[_0xab52('0x26')]||0x258;this[_0xab52('0x27')]=_0x385793[_0xab52('0x27')]||'anonymous';this[_0xab52('0x28')]=_0x385793[_0xab52('0x28')]||'anonymous';this[_0xab52('0x29')]=_0x385793[_0xab52('0x29')]||0x1e;this[_0xab52('0x2a')]=_0x385793[_0xab52('0x2a')]||_0xab52('0x2b');this[_0xab52('0x2c')]=_0x385793[_0xab52('0x2c')]||0x3;this[_0xab52('0x2d')]=_0x385793[_0xab52('0x2d')]||undefined;this['dialCongestionMaxRetry']=_0x385793[_0xab52('0x2e')]||0x3;this[_0xab52('0x2f')]=_0x385793[_0xab52('0x2f')]||0x96;this[_0xab52('0x30')]=_0x385793[_0xab52('0x30')]||0x3;this['dialBusyRetryFrequency']=_0x385793[_0xab52('0x31')]||0x96;this[_0xab52('0x32')]=_0x385793[_0xab52('0x32')]||0x3;this[_0xab52('0x33')]=_0x385793['dialNoAnswerRetryFrequency']||0x96;this[_0xab52('0x34')]=_0x385793[_0xab52('0x34')]||0x3;this[_0xab52('0x35')]=_0x385793[_0xab52('0x35')]||0x96;this[_0xab52('0x36')]=_0x385793[_0xab52('0x36')]||0x3;this[_0xab52('0x37')]=_0x385793[_0xab52('0x37')]||0x96;this[_0xab52('0x38')]=_0x385793[_0xab52('0x38')]||0x3;this['dialAbandonedRetryFrequency']=_0x385793['dialAbandonedRetryFrequency']||0x96;this[_0xab52('0x39')]=_0x385793[_0xab52('0x39')]||0x3;this[_0xab52('0x3a')]=_0x385793[_0xab52('0x3a')]||0x96;this[_0xab52('0x3b')]=_0x385793[_0xab52('0x3b')]||0x3;this[_0xab52('0x3c')]=_0x385793[_0xab52('0x3c')]||0x96;this[_0xab52('0x3d')]=_0x385793[_0xab52('0x3d')]||0x4;this['Trunk']=_0x385793[_0xab52('0x3e')]?_0x385793[_0xab52('0x3e')]:undefined;this[_0xab52('0x3f')]=_0x385793['TrunkBackup']?_0x385793['TrunkBackup']:undefined;this['dialPrefix']=_0x385793[_0xab52('0x40')]||undefined;this[_0xab52('0x41')]=_0x385793[_0xab52('0x41')]?_0x385793[_0xab52('0x41')]:undefined;this['dialOrderByScheduledAt']=_0x385793[_0xab52('0x42')]||_0xab52('0x43');this[_0xab52('0x44')]=_0x385793['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xab52('0x45')]=_0x385793['dialCutDigit']||undefined;this['strategy']=strategy[_0x385793[_0xab52('0x46')]]||_0xab52('0x47');this[_0xab52('0x48')]=!![];this[_0xab52('0x49')]=_0x385793[_0xab52('0x49')]||![];this['dialAMDInitialSilence']=_0x385793['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x385793[_0xab52('0x4a')];this[_0xab52('0x4b')]=_0x385793['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x385793['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x385793['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x385793['dialAMDBetweenWordsSilence'];this[_0xab52('0x4c')]=_0x385793[_0xab52('0x4c')];this[_0xab52('0x4d')]=_0x385793[_0xab52('0x4d')];this[_0xab52('0x4e')]=_0x385793[_0xab52('0x4e')];this[_0xab52('0x4f')]=0x0;this['pTalking']=0x0;this[_0xab52('0x50')]=_0x385793['timeout'];this[_0xab52('0x51')]=0x0;this[_0xab52('0x52')]=0x0;this[_0xab52('0x53')]=0x0;this[_0xab52('0x54')]=0x0;this[_0xab52('0x55')]=0x0;this[_0xab52('0x56')]=0x0;this[_0xab52('0x57')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xab52('0x58')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xab52('0x59')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xab52('0x5a')]=0x0;this[_0xab52('0x5b')]=0x0;this[_0xab52('0x5c')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0xab52('0x5d')]=1.05;this[_0xab52('0x5e')]=0x0;this[_0xab52('0x5f')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xab52('0x60')]=0x0;this[_0xab52('0x61')]=0x0;this[_0xab52('0x62')]=0x0;this[_0xab52('0x63')]=0x0;this[_0xab52('0x64')]=0x0;this[_0xab52('0x65')]=_0x385793[_0xab52('0x66')]||0x14;this[_0xab52('0x67')]=_0x385793['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xab52('0x68')]=0x0;this[_0xab52('0x69')]=0x0;this[_0xab52('0x6a')]=0x1;this[_0xab52('0x6b')]=0x0;this[_0xab52('0x6c')]=0x0;this[_0xab52('0x6d')]=0x0;this[_0xab52('0x6e')]=0x0;this[_0xab52('0x6f')]=_0x385793['dialRecallMeTimeout']||0x1e;this[_0xab52('0x70')]=_0x385793['dialRecallInQueue']||![];this[_0xab52('0x71')]=_0x385793[_0xab52('0x71')]||undefined;this['dialAgiAfterHangupClient']=_0x385793[_0xab52('0x72')]||![];this[_0xab52('0x73')]=_0x385793[_0xab52('0x73')]||![];this['monitor_format']=monitorFormat[_0x385793[_0xab52('0xa')]]?monitorFormat[_0x385793[_0xab52('0xa')]]:undefined;this[_0xab52('0x74')]=_0x385793[_0xab52('0x74')]||![];this[_0xab52('0x75')]=_0x385793[_0xab52('0x75')]?_0x385793[_0xab52('0x75')]:undefined;}module[_0xab52('0x76')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 3459566..ea48d1e 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 _0x75da=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0xc8bde5,_0x488696){var _0x4167a3=function(_0x326873){while(--_0x326873){_0xc8bde5['push'](_0xc8bde5['shift']());}};_0x4167a3(++_0x488696);}(_0x75da,0x7b));var _0xa75d=function(_0x458ed6,_0x504646){_0x458ed6=_0x458ed6-0x0;var _0xa5dfd9=_0x75da[_0x458ed6];return _0xa5dfd9;};'use strict';function VtigerAccount(_0x3b37f2){this['id']=_0x3b37f2['id']||0x0;this[_0xa75d('0x0')]=_0x3b37f2[_0xa75d('0x0')]||'';this[_0xa75d('0x1')]=_0x3b37f2[_0xa75d('0x1')]||'';this[_0xa75d('0x2')]=_0x3b37f2[_0xa75d('0x2')]||'';this[_0xa75d('0x3')]=_0x3b37f2[_0xa75d('0x3')]||'';this['serverUrl']=_0x3b37f2[_0xa75d('0x4')]||'';this[_0xa75d('0x5')]=_0x3b37f2[_0xa75d('0x5')]||{};}module[_0xa75d('0x6')]=VtigerAccount; \ No newline at end of file +var _0x6dd8=['name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x88a254,_0x4bead2){var _0x590f12=function(_0x4198a0){while(--_0x4198a0){_0x88a254['push'](_0x88a254['shift']());}};_0x590f12(++_0x4bead2);}(_0x6dd8,0x1b0));var _0x86dd=function(_0x532b45,_0x4ff588){_0x532b45=_0x532b45-0x0;var _0x3002d0=_0x6dd8[_0x532b45];return _0x3002d0;};'use strict';function VtigerAccount(_0x5d6ebe){this['id']=_0x5d6ebe['id']||0x0;this['name']=_0x5d6ebe[_0x86dd('0x0')]||'';this[_0x86dd('0x1')]=_0x5d6ebe[_0x86dd('0x1')]||'';this[_0x86dd('0x2')]=_0x5d6ebe[_0x86dd('0x2')]||'';this[_0x86dd('0x3')]=_0x5d6ebe['remoteUri']||'';this[_0x86dd('0x4')]=_0x5d6ebe['serverUrl']||'';this[_0x86dd('0x5')]=_0x5d6ebe[_0x86dd('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 3ef390b..b9a20c2 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 _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0x24bef3,_0xb11b26){_0x24bef3=_0x24bef3-0x0;var _0xcf6c17=_0xadb5[_0x24bef3];return _0xcf6c17;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x2ef3=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x1e5d08,_0x82556a){var _0x4f5283=function(_0x355964){while(--_0x355964){_0x1e5d08['push'](_0x1e5d08['shift']());}};_0x4f5283(++_0x82556a);}(_0x2ef3,0xba));var _0x32ef=function(_0x11d41d,_0xe3322f){_0x11d41d=_0x11d41d-0x0;var _0x3f9e72=_0x2ef3[_0x11d41d];return _0x3f9e72;};'use strict';function ZendeskAccount(_0x4d5ac8){this['id']=_0x4d5ac8['id']||0x0;this[_0x32ef('0x0')]=_0x4d5ac8[_0x32ef('0x0')]||'';this[_0x32ef('0x1')]=_0x4d5ac8[_0x32ef('0x1')]||'';this[_0x32ef('0x2')]=_0x4d5ac8['password']||'';this[_0x32ef('0x3')]=_0x4d5ac8[_0x32ef('0x3')]||'';this['remoteUri']=_0x4d5ac8[_0x32ef('0x4')]||'';this[_0x32ef('0x5')]=_0x4d5ac8['authType']||'';this['type']=_0x4d5ac8[_0x32ef('0x6')]||_0x32ef('0x7');this[_0x32ef('0x8')]=_0x4d5ac8[_0x32ef('0x8')]||'';this[_0x32ef('0x9')]=_0x4d5ac8[_0x32ef('0x9')]||{};}module[_0x32ef('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index c0ac795..42f95f4 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 _0x6888=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x13c147,_0x11d839){var _0x2f8619=function(_0x32698f){while(--_0x32698f){_0x13c147['push'](_0x13c147['shift']());}};_0x2f8619(++_0x11d839);}(_0x6888,0xd2));var _0x8688=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x6888[_0x2064e5];return _0x21a233;};'use strict';function ZohoAccount(_0xf4e45c){this['id']=_0xf4e45c['id']||0x0;this['name']=_0xf4e45c[_0x8688('0x0')]||'';this[_0x8688('0x1')]=_0xf4e45c[_0x8688('0x1')]||'';this[_0x8688('0x2')]=_0xf4e45c[_0x8688('0x2')]||'';this[_0x8688('0x3')]=_0xf4e45c['zone']||'';this['clientId']=_0xf4e45c[_0x8688('0x4')]||'';this[_0x8688('0x5')]=_0xf4e45c[_0x8688('0x5')]||'';this[_0x8688('0x6')]=_0xf4e45c[_0x8688('0x6')]||'';this[_0x8688('0x7')]=_0xf4e45c['code']||'';this[_0x8688('0x8')]=_0xf4e45c[_0x8688('0x8')]||'';this[_0x8688('0x9')]=_0xf4e45c[_0x8688('0x9')]||{};}module[_0x8688('0xa')]=ZohoAccount; \ No newline at end of file +var _0x45c2=['serverUrl','code','refreshToken','Configurations','name','description','host','zone','clientId','clientSecret'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x45c2,0x68));var _0x245c=function(_0x2558ee,_0x2a2574){_0x2558ee=_0x2558ee-0x0;var _0x431306=_0x45c2[_0x2558ee];return _0x431306;};'use strict';function ZohoAccount(_0x30d9ff){this['id']=_0x30d9ff['id']||0x0;this[_0x245c('0x0')]=_0x30d9ff[_0x245c('0x0')]||'';this[_0x245c('0x1')]=_0x30d9ff['description']||'';this[_0x245c('0x2')]=_0x30d9ff[_0x245c('0x2')]||'';this[_0x245c('0x3')]=_0x30d9ff['zone']||'';this[_0x245c('0x4')]=_0x30d9ff[_0x245c('0x4')]||'';this[_0x245c('0x5')]=_0x30d9ff[_0x245c('0x5')]||'';this[_0x245c('0x6')]=_0x30d9ff[_0x245c('0x6')]||'';this[_0x245c('0x7')]=_0x30d9ff[_0x245c('0x7')]||'';this[_0x245c('0x8')]=_0x30d9ff[_0x245c('0x8')]||'';this[_0x245c('0x9')]=_0x30d9ff[_0x245c('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 6ab6a71..2bb69c3 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 _0xe372=['number','exports','lodash','moment','isNil','string','uniqueid','idContact','name','type','campaigntype','queue','dialAnswer','membername','Agent','format','SIP/%s','phone','Contact','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname'];(function(_0x11b376,_0x569885){var _0xc9fcbb=function(_0x2df8e4){while(--_0x2df8e4){_0x11b376['push'](_0x11b376['shift']());}};_0xc9fcbb(++_0x569885);}(_0xe372,0x1ba));var _0x2e37=function(_0x22b983,_0x244e2e){_0x22b983=_0x22b983-0x0;var _0x2b28da=_0xe372[_0x22b983];return _0x2b28da;};'use strict';var util=require('util');var _=require(_0x2e37('0x0'));var moment=require(_0x2e37('0x1'));function checkNameSurname(_0x464730,_0x580ccc,_0x591d13){var _0x4b6186='';if(!_[_0x2e37('0x2')](_0x580ccc)&&_0x2e37('0x3')===typeof _0x580ccc){_0x4b6186+=_0x580ccc;}if(!_[_0x2e37('0x2')](_0x591d13)&&'string'===typeof _0x591d13){_0x4b6186+='\x20'+_0x591d13;}if(_0x4b6186!==''){return _0x4b6186;}return _0x464730;}function Action(_0x3f090b,_0x233cab,_0x253d1d,_0x7f1b1e,_0x37e279){this[_0x2e37('0x4')]=_0x253d1d||undefined;this[_0x2e37('0x5')]=_0x3f090b['id'];this['queue']=_0x233cab[_0x2e37('0x6')];this[_0x2e37('0x7')]=_0x233cab['type'];this[_0x2e37('0x8')]=_0x2e37('0x9');this[_0x2e37('0xa')]=![];this[_0x2e37('0xb')]=_[_0x2e37('0x2')](_0x3f090b[_0x2e37('0xc')])?undefined:_0x3f090b[_0x2e37('0xc')][_0x2e37('0x6')];this['channelAgent']=this[_0x2e37('0xb')]?util[_0x2e37('0xd')](_0x2e37('0xe'),this['membername']):_0x7f1b1e||undefined;this['calleridname']=checkNameSurname(_0x3f090b['Contact'][_0x2e37('0xf')],_0x3f090b[_0x2e37('0x10')][_0x2e37('0x11')],_0x3f090b['Contact'][_0x2e37('0x12')]);this[_0x2e37('0x13')]=_0x3f090b[_0x2e37('0x13')]||![];this['calleridnum']=_0x3f090b[_0x2e37('0x10')][_0x2e37('0xf')];this[_0x2e37('0x14')]=_0x3f090b[_0x2e37('0x14')];this[_0x2e37('0x15')]=_0x3f090b[_0x2e37('0x15')]||0x0;this[_0x2e37('0x16')]=_0x3f090b['countcongestionretry']||0x0;this['countnoanswerretry']=_0x3f090b[_0x2e37('0x17')]||0x0;this[_0x2e37('0x18')]=(_0x3f090b[_0x2e37('0x15')]||0x0)+(_0x3f090b[_0x2e37('0x16')]||0x0)+(_0x3f090b[_0x2e37('0x17')]||0x0);this[_0x2e37('0x19')]=_0x3f090b[_0x2e37('0x19')]||0x0;this[_0x2e37('0x1a')]=_0x3f090b['countdropretry']||0x0;this['countabandonedretry']=_0x3f090b[_0x2e37('0x1b')]||0x0;this[_0x2e37('0x1c')]=_0x3f090b[_0x2e37('0x1c')]||0x0;this[_0x2e37('0x1d')]=_0x3f090b[_0x2e37('0x1d')]||0x0;this['callback']=_0x3f090b[_0x2e37('0x1e')];this[_0x2e37('0x1f')]=_0x3f090b['callbackuniqueid'];this[_0x2e37('0x20')]=_0x3f090b[_0x2e37('0x20')];this[_0x2e37('0x21')]=_0x3f090b[_0x2e37('0x21')];this[_0x2e37('0x22')]=_0x3f090b[_0x2e37('0x22')];this[_0x2e37('0x23')]=_0x3f090b[_0x2e37('0x23')];this[_0x2e37('0x24')]=_[_0x2e37('0x2')](_0x3f090b['Agent'])?_0x3f090b[_0x2e37('0x24')]:_0x3f090b[_0x2e37('0xc')]['id'];this[_0x2e37('0x25')]=_0x3f090b[_0x2e37('0x25')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x2e37('0x26')][_0x2e37('0x27')]=function(){return util[_0x2e37('0xd')](_0x2e37('0x28'),this[_0x2e37('0x29')],this[_0x2e37('0x2a')]);};module[_0x2e37('0x2b')]=Action; \ No newline at end of file +var _0xa8ba=['campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','firstName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','\x22%s\x22\x20<%s>','exports','util','isNil','queue','name','type'];(function(_0x56648b,_0x3fbbcf){var _0x1aeac9=function(_0x2247da){while(--_0x2247da){_0x56648b['push'](_0x56648b['shift']());}};_0x1aeac9(++_0x3fbbcf);}(_0xa8ba,0x1c3));var _0xaa8b=function(_0x5d40d6,_0x2539fb){_0x5d40d6=_0x5d40d6-0x0;var _0x1d0fcd=_0xa8ba[_0x5d40d6];return _0x1d0fcd;};'use strict';var util=require(_0xaa8b('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0xf722c1,_0x552226,_0x2cfec9){var _0xffe925='';if(!_[_0xaa8b('0x1')](_0x552226)&&'string'===typeof _0x552226){_0xffe925+=_0x552226;}if(!_[_0xaa8b('0x1')](_0x2cfec9)&&'string'===typeof _0x2cfec9){_0xffe925+='\x20'+_0x2cfec9;}if(_0xffe925!==''){return _0xffe925;}return _0xf722c1;}function Action(_0x57c3fd,_0x27d7e8,_0x3ce9b6,_0x4fe2d1,_0x379bc7){this['uniqueid']=_0x3ce9b6||undefined;this['idContact']=_0x57c3fd['id'];this[_0xaa8b('0x2')]=_0x27d7e8[_0xaa8b('0x3')];this[_0xaa8b('0x4')]=_0x27d7e8[_0xaa8b('0x4')];this[_0xaa8b('0x5')]=_0xaa8b('0x2');this[_0xaa8b('0x6')]=![];this[_0xaa8b('0x7')]=_[_0xaa8b('0x1')](_0x57c3fd['Agent'])?undefined:_0x57c3fd[_0xaa8b('0x8')][_0xaa8b('0x3')];this[_0xaa8b('0x9')]=this[_0xaa8b('0x7')]?util[_0xaa8b('0xa')](_0xaa8b('0xb'),this[_0xaa8b('0x7')]):_0x4fe2d1||undefined;this[_0xaa8b('0xc')]=checkNameSurname(_0x57c3fd[_0xaa8b('0xd')]['phone'],_0x57c3fd[_0xaa8b('0xd')][_0xaa8b('0xe')],_0x57c3fd[_0xaa8b('0xd')]['lastName']);this['active']=_0x57c3fd[_0xaa8b('0xf')]||![];this[_0xaa8b('0x10')]=_0x57c3fd[_0xaa8b('0xd')][_0xaa8b('0x11')];this[_0xaa8b('0x12')]=_0x57c3fd[_0xaa8b('0x12')];this[_0xaa8b('0x13')]=_0x57c3fd[_0xaa8b('0x13')]||0x0;this[_0xaa8b('0x14')]=_0x57c3fd['countcongestionretry']||0x0;this['countnoanswerretry']=_0x57c3fd[_0xaa8b('0x15')]||0x0;this[_0xaa8b('0x16')]=(_0x57c3fd[_0xaa8b('0x13')]||0x0)+(_0x57c3fd['countcongestionretry']||0x0)+(_0x57c3fd[_0xaa8b('0x15')]||0x0);this[_0xaa8b('0x17')]=_0x57c3fd[_0xaa8b('0x17')]||0x0;this['countdropretry']=_0x57c3fd[_0xaa8b('0x18')]||0x0;this['countabandonedretry']=_0x57c3fd[_0xaa8b('0x19')]||0x0;this['countmachineretry']=_0x57c3fd[_0xaa8b('0x1a')]||0x0;this[_0xaa8b('0x1b')]=_0x57c3fd[_0xaa8b('0x1b')]||0x0;this[_0xaa8b('0x1c')]=_0x57c3fd[_0xaa8b('0x1c')];this['callbackuniqueid']=_0x57c3fd[_0xaa8b('0x1d')];this['callbackat']=_0x57c3fd[_0xaa8b('0x1e')];this['recallme']=_0x57c3fd[_0xaa8b('0x1f')];this[_0xaa8b('0x20')]=_0x57c3fd[_0xaa8b('0x20')];this[_0xaa8b('0x21')]=_0x57c3fd[_0xaa8b('0x21')];this['UserId']=_[_0xaa8b('0x1')](_0x57c3fd[_0xaa8b('0x8')])?_0x57c3fd['UserId']:_0x57c3fd['Agent']['id'];this[_0xaa8b('0x22')]=_0x57c3fd[_0xaa8b('0x22')];this[_0xaa8b('0x23')]='';this['originatecalleridname']='';}Action['prototype']['getCaller']=function(){return util[_0xaa8b('0xa')](_0xaa8b('0x24'),this['calleridname'],this['number']);};module[_0xaa8b('0x25')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index b5be6a5..c7442bb 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 _0x24b2=['callerid','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','Action','channel','updateOriginated','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','then','isNil','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]','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','sendMessageOneNotActive','IsNotLoggedIn','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','emit','buildObj','complete','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','dialBusyRetryFrequency','countnoanswerretry','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','cause-txt','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','createAgentHistory','logAgent','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','checkInBlack','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','SIP/%s','status','reachable','unlock','unlockContact','execRun','getContactPreview','validateContact','isValid','checkIsBlackList','Contact.phone','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','Contact','phone','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridNumber','addVariables','merge','[originated][increment]','OriginateError','logLookAgent','clone','response','idContact','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','syncHangup','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','dialstatus','syncHangupRequest','addVariable','variables','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','moment','md5','../../../config/environment','../../../config/logger','preview','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','name','active'];(function(_0x468a77,_0x1382be){var _0x2d1c33=function(_0x2f2e83){while(--_0x2f2e83){_0x468a77['push'](_0x468a77['shift']());}};_0x2d1c33(++_0x1382be);}(_0x24b2,0xea));var _0x224b=function(_0xcafa4b,_0x572040){_0xcafa4b=_0xcafa4b-0x0;var _0x4e3260=_0x24b2[_0xcafa4b];return _0x4e3260;};'use strict';var util=require(_0x224b('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x224b('0x1'));var md5=require(_0x224b('0x2'));var Redis=require('ioredis');var config=require(_0x224b('0x3'));var logger=require(_0x224b('0x4'))(_0x224b('0x5'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0x224b('0x6'));var ut=require(_0x224b('0x7'));config[_0x224b('0x8')]=_[_0x224b('0x9')](config[_0x224b('0x8')],{'host':_0x224b('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x224b('0x8')]));var Sequence=function(){};Sequence[_0x224b('0xb')][_0x224b('0xc')]=function(_0x19ed7f){this[_0x224b('0xd')]=this[_0x224b('0xd')]?this['tail'][_0x224b('0xe')](_0x19ed7f):_0x19ed7f();};function Preview(_0x3f94c5){this[_0x224b('0xf')]=new Sequence();this[_0x224b('0x10')]=_0x3f94c5[_0x224b('0x11')];this[_0x224b('0x12')]=_0x3f94c5['trunks'];this[_0x224b('0x13')]={};this[_0x224b('0x14')]=_0x3f94c5['agents'];this[_0x224b('0x15')]=0x0;ami['on'](_0x224b('0x16'),this[_0x224b('0x17')][_0x224b('0x18')](this));ami['on'](_0x224b('0x19'),this['syncHangup']['bind'](this));ami['on'](_0x224b('0x1a'),this['syncHangupRequest'][_0x224b('0x18')](this));ami['on'](_0x224b('0x1b'),this[_0x224b('0x1c')]['bind'](this));ami['on'](_0x224b('0x1d'),this[_0x224b('0x1e')][_0x224b('0x18')](this));ami['on'](_0x224b('0x1f'),this[_0x224b('0x20')][_0x224b('0x18')](this));ami['on'](_0x224b('0x21'),this[_0x224b('0x22')][_0x224b('0x18')](this));ami['on']('blindtransfer',this[_0x224b('0x23')][_0x224b('0x18')](this));this[_0x224b('0x24')](this[_0x224b('0x10')]);}function emit(_0x5a6665,_0x504bc5,_0x2bf690){io['to'](_0x5a6665)['emit'](_0x504bc5,_0x2bf690);}function emitCampaignPreview(_0x104622){if(_0x104622['type']===_0x224b('0x25')){var _0x1f7226={'id':_0x104622['id'],'name':_0x104622['name'],'strategy':_0x104622[_0x224b('0x26')],'answered':_0x104622[_0x224b('0x27')],'available':_0x104622[_0x224b('0x28')],'loggedIn':_0x104622[_0x224b('0x29')],'pTalking':_0x104622[_0x224b('0x2a')],'sumBillable':_0x104622[_0x224b('0x2b')],'sumDuration':_0x104622[_0x224b('0x2c')],'sumHoldTime':_0x104622[_0x224b('0x2d')]||0x0,'talking':_0x104622[_0x224b('0x2e')],'total':_0x104622[_0x224b('0x2f')],'type':_0x104622[_0x224b('0x30')],'unmanaged':_0x104622[_0x224b('0x31')],'abandoned':_0x104622[_0x224b('0x32')],'waiting':_0x104622[_0x224b('0x33')],'loggedInDb':_0x104622[_0x224b('0x34')],'dialActive':_0x104622[_0x224b('0x35')],'dialMethod':_0x104622[_0x224b('0x36')],'dialOriginateCallerIdName':_0x104622[_0x224b('0x37')],'dialOriginateCallerIdNumber':_0x104622[_0x224b('0x38')],'dialOriginateTimeout':_0x104622[_0x224b('0x39')],'dialPrefix':_0x104622['dialPrefix'],'outboundAnswerAgiCallsDay':_0x104622[_0x224b('0x3a')],'outboundAnswerCallsDay':_0x104622[_0x224b('0x3b')],'outboundBlacklistCallsDay':_0x104622[_0x224b('0x3c')],'outboundBusyCallsDay':_0x104622[_0x224b('0x3d')],'outboundCongestionCallsDay':_0x104622[_0x224b('0x3e')],'outboundDropCallsDayACS':_0x104622['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x104622[_0x224b('0x3f')],'outboundDropCallsDayTimeout':_0x104622['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x104622[_0x224b('0x40')],'outboundNoSuchCallsDay':_0x104622['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x104622[_0x224b('0x41')],'outboundReCallsDay':_0x104622[_0x224b('0x42')],'outboundRejectCallsDay':_0x104622[_0x224b('0x43')],'outboundUnknownCallsDay':_0x104622[_0x224b('0x44')],'outboundAbandonedCallsDay':_0x104622[_0x224b('0x45')],'predictiveIntervalAnsweredCalls':_0x104622[_0x224b('0x46')],'predictiveIntervalAvgHoldtime':_0x104622[_0x224b('0x47')],'predictiveIntervalAvgTalktime':_0x104622['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x104622['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x104622[_0x224b('0x48')],'predictiveIntervalErlangCalls':_0x104622[_0x224b('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0x104622[_0x224b('0x4a')],'predictiveIntervalHitRate':_0x104622['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x104622[_0x224b('0x4b')],'predictiveIntervalPauses':_0x104622[_0x224b('0x4c')],'predictiveIntervalAvailable':_0x104622[_0x224b('0x4d')],'predictiveIntervalTotalCalls':_0x104622['predictiveIntervalTotalCalls'],'message':_0x104622[_0x224b('0x4e')],'originated':_0x104622[_0x224b('0x4f')],'erlangCalls':_0x104622[_0x224b('0x50')],'erlangCallToSecond':_0x104622[_0x224b('0x51')],'erlangAbandonmentRate':_0x104622[_0x224b('0x52')],'erlangBusyFactor':_0x104622[_0x224b('0x53')],'startPredictive':_0x104622[_0x224b('0x54')],'startProgressive':_0x104622['startProgressive']};if(_0x104622[_0x224b('0x55')]){_0x1f7226['Trunk']={'id':_0x104622[_0x224b('0x55')]['id'],'name':_0x104622[_0x224b('0x55')][_0x224b('0x56')],'active':_0x104622[_0x224b('0x55')][_0x224b('0x57')],'callerid':_0x104622[_0x224b('0x55')][_0x224b('0x58')]};}if(_0x104622['Interval']){_0x1f7226[_0x224b('0x59')]={'id':_0x104622[_0x224b('0x59')]['id'],'name':_0x104622['Interval']['name']};}var _0x20c65b=md5(JSON[_0x224b('0x5a')](_0x1f7226));if(_0x104622[_0x224b('0x2')]!==_0x20c65b){_0x104622['md5']=_0x20c65b;emit(util[_0x224b('0x5b')]('voice:queue:%s',_0x1f7226['name']),_0x224b('0x5c'),_0x1f7226);}}}function emitVoiceQueueChannelRemove(_0x7afe4f){logger[_0x224b('0x5d')](_0x224b('0x5e'),JSON[_0x224b('0x5a')](_0x7afe4f));emit(util[_0x224b('0x5b')](_0x224b('0x5f'),_0x7afe4f[_0x224b('0x56')]),_0x224b('0x60'),_0x7afe4f);}function notSendMessagesQueue(_0x132108){if(_0x132108['sendMessageOneNotActive']){if(_0x132108[_0x224b('0x4f')]===0x0&&_0x132108[_0x224b('0x2a')]===0x0){_0x132108['sendMessageOneNotActive']=![];_0x132108[_0x224b('0x28')]=0x0;_0x132108[_0x224b('0x61')]=0x0;_0x132108[_0x224b('0x4e')]=_0x224b('0x62');ut[_0x224b('0x63')](_0x224b('0x64'),_0x132108['name']+_0x224b('0x65'));}else{_0x132108['message']='IS_DISACTIVED';ut[_0x224b('0x63')](_0x224b('0x64'),_0x132108[_0x224b('0x56')]+'\x20is\x20disactive');}emitCampaignPreview(_0x132108);}}Preview[_0x224b('0xb')][_0x224b('0x24')]=function(){var _0x4780b9=this;setInterval(function(){_0x4780b9['syncCampaigns']();},0x7cf);};Preview[_0x224b('0xb')][_0x224b('0x66')]=function(){var _0xcbf5ca=this[_0x224b('0x10')];this['clockClearZombieChannels']+=0x1;for(var _0x546fdc in _0xcbf5ca){if(_0xcbf5ca[_0x224b('0x67')](_0x546fdc)&&(_0xcbf5ca[_0x546fdc]['dialMethod']===_0x224b('0x5')||_0xcbf5ca[_0x546fdc]['dialMethod']===_0x224b('0x68'))&&_0xcbf5ca[_0x546fdc]['type']==='outbound'){if(this[_0x224b('0x15')]>0x7){this[_0x224b('0x15')]=0x0;this[_0x224b('0x69')]();}}if(_0xcbf5ca['hasOwnProperty'](_0x546fdc)&&_0xcbf5ca[_0x546fdc]['dialMethod']===_0x224b('0x5')&&_0xcbf5ca[_0x546fdc][_0x224b('0x30')]===_0x224b('0x25')){if(_0xcbf5ca[_0x546fdc][_0x224b('0x35')]){this[_0x224b('0x6a')](_0xcbf5ca[_0x546fdc]);this[_0x224b('0x6b')](_0xcbf5ca[_0x546fdc]);}else{notSendMessagesQueue(_0xcbf5ca[_0x546fdc]);}}}};Preview[_0x224b('0xb')][_0x224b('0x6c')]=function(_0x4404e5){var _0x1c1f67=this;this[_0x224b('0xf')][_0x224b('0xc')](function(){if(!_['isNil'](_0x1c1f67['actions'][_0x4404e5])){loggerAction[_0x224b('0x5d')](_0x224b('0x6d'),_0x4404e5,_0x224b('0x6e'),_0x1c1f67[_0x224b('0x13')][_0x4404e5][_0x224b('0x6f')],_0x224b('0x70'),JSON['stringify'](_0x1c1f67[_0x224b('0x10')][_0x1c1f67[_0x224b('0x13')][_0x4404e5][_0x224b('0x6f')]][_0x224b('0x4f')]),_0x224b('0x71'),JSON[_0x224b('0x5a')](_0x1c1f67[_0x224b('0x10')][_0x1c1f67[_0x224b('0x13')][_0x4404e5][_0x224b('0x6f')]][_0x224b('0x2a')]),JSON[_0x224b('0x5a')](_0x1c1f67[_0x224b('0x13')][_0x4404e5][_0x224b('0x72')]),JSON['stringify'](_[_0x224b('0x73')](_0x1c1f67[_0x224b('0x13')][_0x4404e5],[_0x224b('0x74'),'UserId',_0x224b('0x75'),_0x224b('0x76')])));return ami[_0x224b('0x77')]({'action':'status','channel':_0x1c1f67[_0x224b('0x13')][_0x4404e5][_0x224b('0x78')]})['catch'](function(_0x342127){if(_0x342127['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x1c1f67[_0x224b('0x13')][_0x4404e5]){ut[_0x224b('0x79')](_0x1c1f67[_0x224b('0x10')][_0x1c1f67['actions'][_0x4404e5]['queue']],'[clearZombieChannel]');if(_0x1c1f67[_0x224b('0x13')][_0x4404e5][_0x224b('0x72')]===!![]){ut['decrementTalkink'](_0x1c1f67[_0x224b('0x10')][_0x1c1f67[_0x224b('0x13')][_0x4404e5][_0x224b('0x6f')]],_0x224b('0x7a'));ut['loggerError'](_0x224b('0x7b')+_0x4404e5,_0x1c1f67[_0x224b('0x13')][_0x4404e5][_0x224b('0x6f')]);}ut[_0x224b('0x7c')](_0x224b('0x7d')+_0x4404e5,_0x1c1f67['actions'][_0x4404e5]['queue']);delete _0x1c1f67[_0x224b('0x13')][_0x4404e5];}},0x2328);}});}});};Preview[_0x224b('0xb')][_0x224b('0x69')]=function(){var _0x2d3b96=this;loggerAction[_0x224b('0x5d')](_0x224b('0x7e'),_[_0x224b('0x7f')](this['actions']));for(var _0x409c39 in this[_0x224b('0x13')]){if(_0x2d3b96[_0x224b('0x13')][_0x224b('0x67')](_0x409c39)){_0x2d3b96[_0x224b('0x6c')](_0x409c39);}}};Preview['prototype']['recallMe']=function(_0xfdd637){var _0x28a74c=this;rpcDb['getContactRecallMe'](_0xfdd637['id'],ut['agentReadyId'](this['agents']))[_0x224b('0x80')](function(_0x49c18f){if(!_[_0x224b('0x81')](_0x49c18f)){for(var _0x56de6f=0x0;_0x56de6f<_0x49c18f['length'];_0x56de6f+=0x1){if(ut[_0x224b('0x82')](_0x49c18f[_0x56de6f][_0x224b('0x83')])<_0xfdd637[_0x224b('0x84')]*0x3c){if(_0x49c18f[_0x56de6f]['Agent']&&!_0x49c18f[_0x56de6f][_0x224b('0x85')][_0x224b('0x86')]){_0x28a74c[_0x224b('0x87')](_0x49c18f[_0x56de6f]['id'])['then'](ut[_0x224b('0x88')](_0x224b('0x89')))[_0x224b('0x8a')](ut[_0x224b('0x88')](_0x224b('0x89')));}else{rpcDb[_0x224b('0x8b')](_0x49c18f[_0x56de6f]['id']);}}else{var _0x5ee04f=new Action(_0x49c18f[_0x56de6f],_0xfdd637);_0x5ee04f[_0x224b('0x8c')]=moment()[_0x224b('0x5b')](_0x224b('0x8d'));_0xfdd637['outboundReCallsDay']+=0x1;ut[_0x224b('0x8e')](_0x5ee04f,0x17,_0x224b('0x8f'));if(_0xfdd637[_0x224b('0x90')]){rpcDb[_0x224b('0x91')](ut[_0x224b('0x92')](_0x49c18f[_0x56de6f]));rpcDb[_0x224b('0x93')](_0x5ee04f,_0x224b('0x94'));}else{ut[_0x224b('0x8e')](_0x5ee04f,0x16,'RecallFailedTimeout');rpcDb[_0x224b('0x93')](_0x5ee04f,'[HistoryRecallClose]');rpcDb[_0x224b('0x95')](_0x5ee04f,_0x224b('0x96'));}}}}})[_0x224b('0x8a')](ut[_0x224b('0x88')](_0x224b('0x97')));};Preview[_0x224b('0xb')][_0x224b('0x6a')]=function(_0x1d43ff){_0x1d43ff[_0x224b('0x98')]=!![];if(ut[_0x224b('0x99')](_0x1d43ff['loggedIn'])){_0x1d43ff[_0x224b('0x4e')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0x1d43ff['dialActive'])){_0x1d43ff[_0x224b('0x4e')]=_0x224b('0x62');}else if(!this[_0x224b('0x9a')](_0x1d43ff[_0x224b('0x55')])){if(!this[_0x224b('0x9a')](_0x1d43ff[_0x224b('0x9b')])){_0x1d43ff[_0x224b('0x4e')]=_0x224b('0x9c');}else{_0x1d43ff[_0x224b('0x4e')]=_0x224b('0x9d');}}else{_0x1d43ff[_0x224b('0x4e')]=_0x224b('0x9d');}emitCampaignPreview(_0x1d43ff);};Preview['prototype'][_0x224b('0x9e')]=function(_0xc56563,_0x56da7e,_0x36bc9a){var _0x594eea=this;var _0x482552=this[_0x224b('0x13')][_0x56da7e];var _0x13481f=this['campaignsPreview'][_0x482552[_0x224b('0x6f')]];var _0x584f63;if(_0x13481f){switch(_0x36bc9a){case'1':_0x13481f[_0x224b('0x9f')]+=0x1;_0x482552[_0x224b('0xa0')]+=0x1;_0x482552[_0x224b('0xa1')]=ut[_0x224b('0xa2')](_0x482552);ut[_0x224b('0x8e')](_0x482552,0x0,_0x224b('0xa3'));rpcDb['createCustomerHistory'](_0x482552,_0x224b('0xa4'));if(ut['totalGlobal'](_0x482552)>=_0x13481f[_0x224b('0xa5')]){_0x584f63=ut[_0x224b('0xa6')](_0x482552,0xf,_0x224b('0xa7'));rpcDb[_0x224b('0x95')](_0x584f63,_0x224b('0xa8'));}else{if(_0x482552['countnosuchnumberretry']>=_0x13481f[_0x224b('0xa9')]){rpcDb[_0x224b('0x95')](_0x482552,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x224b('0xaa')](ut[_0x224b('0xab')](_0x482552,_0x224b('0xa0'),_0x13481f[_0x224b('0xac')]),_0x482552[_0x224b('0xad')],_0x482552[_0x224b('0xae')]);}}delete this[_0x224b('0x13')][_0xc56563[_0x224b('0xaf')]];break;case _0x224b('0xb0'):var _0x751180=moment()[_0x224b('0x5b')](_0x224b('0x8d'));_0x482552[_0x224b('0xb1')]=_0x751180;_0x482552[_0x224b('0xb2')]=_0x751180;_0x482552[_0x224b('0x72')]=!![];_0x13481f[_0x224b('0x2a')]+=0x1;logger['info']('[syncHangup][talking][increment]',_0x482552[_0x224b('0xb3')],_0x224b('0xb4'),_0x13481f['name'],_0x224b('0x71'),_0x13481f[_0x224b('0x2a')]);ami['emit'](_0x224b('0xb5'),ut['buildObj'](_0x482552,_0x224b('0xb6')));if(_0x13481f[_0x224b('0xb7')]){ami['emit'](_0x224b('0xb8'),ut[_0x224b('0xb9')](_0x482552));}break;case'16':ami[_0x224b('0xba')]('custom:agentcomplete',ut[_0x224b('0xbb')](_0x482552,_0x224b('0xbc')));emitVoiceQueueChannelRemove(ut['buildObj'](_0x482552,'complete'));_0x13481f['outboundAnswerCallsDay']+=0x1;_0x13481f[_0x224b('0x2f')]+=0x1;_0x13481f['answered']+=0x1;ut['decrementTalkink'](_0x13481f,_0x224b('0xbd'));_0x482552['countglobal']=ut['totalGlobal'](_0x482552);ut[_0x224b('0x8e')](_0x482552,0x4,'Answer');rpcDb[_0x224b('0x93')](_0x482552,_0x224b('0xbe'));rpcDb[_0x224b('0x95')](_0x482552,_0x224b('0xbf'));rpcDb['crateCustomerReportQueue'](_0x482552);_0x13481f[_0x224b('0x2c')]+=_0x482552[_0x224b('0xc0')];_0x13481f[_0x224b('0x2b')]+=_0x482552['talktime'];logger['info'](_0x224b('0xc1'),_0x482552[_0x224b('0xb3')],_0x224b('0xb4'),_0x13481f['name'],_0x224b('0x71'),_0x13481f[_0x224b('0x2a')]);delete this[_0x224b('0x13')][_0xc56563[_0x224b('0xaf')]];break;case _0x224b('0xc2'):_0x13481f[_0x224b('0x3d')]+=0x1;_0x482552[_0x224b('0xc3')]+=0x1;_0x482552[_0x224b('0xa1')]=ut[_0x224b('0xa2')](_0x482552);ut[_0x224b('0x8e')](_0x482552,0x5,_0x224b('0xc4'));rpcDb[_0x224b('0x93')](_0x482552,_0x224b('0xc5'));if(ut[_0x224b('0xa2')](_0x482552)>=_0x13481f[_0x224b('0xa5')]){_0x584f63=ut[_0x224b('0xa6')](_0x482552,0xf,_0x224b('0xa7'));rpcDb['createCustomerFinal'](_0x584f63,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x482552[_0x224b('0xc3')]>=_0x13481f[_0x224b('0xc6')]){rpcDb['createCustomerFinal'](_0x482552,_0x224b('0xc5'));}else{rpcDb[_0x224b('0xaa')](ut[_0x224b('0xab')](_0x482552,_0x224b('0xc3'),_0x13481f[_0x224b('0xc7')]),_0x482552[_0x224b('0xad')],_0x482552['activeContact']);}}break;case'NOANSWER':_0x13481f['outboundNoAnswerCallsDay']+=0x1;_0x482552[_0x224b('0xc8')]+=0x1;_0x482552[_0x224b('0xa1')]=ut['totalGlobal'](_0x482552);ut[_0x224b('0x8e')](_0x482552,0x3,'NoAnswer');rpcDb[_0x224b('0x93')](_0x482552,_0x224b('0xc9'));if(ut[_0x224b('0xa2')](_0x482552)>=_0x13481f[_0x224b('0xa5')]){_0x584f63=ut['cloneAction'](_0x482552,0xf,_0x224b('0xa7'));rpcDb[_0x224b('0x95')](_0x584f63,_0x224b('0xca'));}else{if(_0x482552[_0x224b('0xc8')]>=_0x13481f['dialNoAnswerMaxRetry']){rpcDb[_0x224b('0x95')](_0x482552,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x224b('0xaa')](ut['scheduledAt'](_0x482552,'countnoanswerretry',_0x13481f[_0x224b('0xcb')]),_0x482552[_0x224b('0xad')],_0x482552[_0x224b('0xae')]);}}break;case _0x224b('0xcc'):_0x13481f[_0x224b('0x3e')]+=0x1;_0x482552[_0x224b('0xcd')]+=0x1;_0x482552['countglobal']=ut[_0x224b('0xa2')](_0x482552);ut['logCustomer'](_0x482552,0x8,'Congestion');rpcDb[_0x224b('0x93')](_0x482552,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x224b('0xa2')](_0x482552)>=_0x13481f[_0x224b('0xa5')]){_0x584f63=ut['cloneAction'](_0x482552,0xf,_0x224b('0xa7'));rpcDb[_0x224b('0x95')](_0x584f63,_0x224b('0xce'));}else{if(_0x482552[_0x224b('0xcd')]>=_0x13481f[_0x224b('0xcf')]){rpcDb[_0x224b('0x95')](_0x482552,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x224b('0xaa')](ut[_0x224b('0xab')](_0x482552,_0x224b('0xcd'),_0x13481f[_0x224b('0xc7')]),_0x482552['unlockAgent'],_0x482552[_0x224b('0xae')]);}}break;case _0x224b('0xd0'):_0x13481f[_0x224b('0x43')]+=0x1;_0x482552[_0x224b('0xd1')]+=0x1;_0x482552[_0x224b('0xa1')]=ut[_0x224b('0xa2')](_0x482552);ut['logCustomer'](_0x482552,0x14,_0x224b('0xd2'));rpcDb[_0x224b('0x93')](_0x482552,_0x224b('0xd3'));if(ut[_0x224b('0xa2')](_0x482552)>=_0x13481f[_0x224b('0xa5')]){_0x584f63=ut[_0x224b('0xa6')](_0x482552,0x14,_0x224b('0xd2'));rpcDb[_0x224b('0x95')](_0x584f63,_0x224b('0xd4'));}else{if(_0x482552['countagentrejectretry']>=_0x13481f[_0x224b('0xd5')]){rpcDb[_0x224b('0x95')](_0x482552,_0x224b('0xd4'));}else{rpcDb[_0x224b('0xaa')](ut[_0x224b('0xab')](_0x482552,_0x224b('0xd1'),_0x13481f[_0x224b('0xd6')]),_0x482552[_0x224b('0xad')],_0x482552['activeContact']);}}break;case _0x224b('0xd7'):_0x13481f[_0x224b('0x45')]+=0x1;_0x482552[_0x224b('0xd8')]+=0x1;_0x482552['countglobal']=ut[_0x224b('0xa2')](_0x482552);ut[_0x224b('0x8e')](_0x482552,0xb,_0x224b('0xd9'));rpcDb[_0x224b('0x93')](_0x482552,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x224b('0xa2')](_0x482552)>=_0x13481f['dialGlobalMaxRetry']){_0x584f63=ut[_0x224b('0xa6')](_0x482552,0xf,_0x224b('0xa7'));rpcDb[_0x224b('0x95')](_0x584f63,_0x224b('0xda'));}else{if(_0x482552[_0x224b('0xdb')]>=_0x13481f[_0x224b('0xdc')]){rpcDb[_0x224b('0x95')](_0x482552,_0x224b('0xda'));}else{rpcDb[_0x224b('0xaa')](ut['scheduledAt'](_0x482552,'countabandonedretry',_0x13481f['dialAbandonedRetryFrequency']),_0x482552[_0x224b('0xad')],_0x482552[_0x224b('0xae')]);}}break;default:if(_0x482552['dialAnswer']){ut['decrementTalkink'](_0x13481f,'[default]');ut[_0x224b('0x7c')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x13481f['name'],_0xc56563);}_0x13481f[_0x224b('0x44')]+=0x1;_0x482552[_0x224b('0xa1')]=ut[_0x224b('0xa2')](_0x482552);ut[_0x224b('0x8e')](_0x482552,0xc,_0xc56563[_0x224b('0xdd')]||_0xc56563['dialstatus']);rpcDb[_0x224b('0x93')](_0x482552,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x224b('0xa2')](_0x482552)>=_0x13481f['dialGlobalMaxRetry']){_0x584f63=ut[_0x224b('0xa6')](_0x482552,0xf,_0x224b('0xa7'));rpcDb['createCustomerFinal'](_0x584f63,_0x224b('0xde'));}else{rpcDb[_0x224b('0x95')](_0x482552,_0x224b('0xde'));}delete this['actions'][_0xc56563[_0x224b('0xaf')]];}if(!(_0x482552[_0x224b('0x72')]&&_0x36bc9a==='16')){ut[_0x224b('0x79')](_0x13481f,_0x224b('0xdf'));logger[_0x224b('0x5d')](_0x224b('0xe0'),_0x482552['uniqueid'],'\x20Queue',_0x13481f[_0x224b('0x56')],_0x224b('0x70'),_0x13481f[_0x224b('0x4f')]);}if(_0x36bc9a!==_0x224b('0xb0')){delete this[_0x224b('0x13')][_0xc56563[_0x224b('0xaf')]];delete this[_0x224b('0x13')][_0xc56563[_0x224b('0xe1')]];}}};Preview[_0x224b('0xb')][_0x224b('0xe2')]=function(_0xb6cc9b,_0x5621bf,_0x42b8b3){if(_['isUndefined'](_0x5621bf)&&_0x224b('0xe3')!==typeof _0x5621bf){return;}if(_[_0x224b('0xe4')](_0x42b8b3)&&_0x224b('0xe3')!==typeof _0x42b8b3){return;}switch(_0x42b8b3['reason']){case'0':ut['logAgent'](_0xb6cc9b,0x0,_0x224b('0xa3'));rpcDb[_0x224b('0xe5')](_0xb6cc9b,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x224b('0xe6')](_0xb6cc9b,0x3,_0x224b('0xe7'));rpcDb[_0x224b('0xe5')](_0xb6cc9b,_0x224b('0xe8'));break;case'5':ut[_0x224b('0xe6')](_0xb6cc9b,0x5,'Busy');rpcDb[_0x224b('0xe5')](_0xb6cc9b,_0x224b('0xe9'));break;case'8':ut[_0x224b('0xe6')](_0xb6cc9b,0x8,'Congestion');rpcDb[_0x224b('0xe5')](_0xb6cc9b,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x224b('0xe6')](_0xb6cc9b,0x16,_0x224b('0xea'));rpcDb[_0x224b('0xe5')](_0xb6cc9b,_0x224b('0xeb'));break;default:ut['logAgent'](_0xb6cc9b,0xc,_0x42b8b3[_0x224b('0xec')]);rpcDb[_0x224b('0xe5')](_0xb6cc9b,_0x224b('0xed'));}ut['updateOriginated'](_0x5621bf,_0x224b('0xee'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0xb6cc9b[_0x224b('0xb3')],_0x224b('0xb4'),_0x5621bf[_0x224b('0x56')],_0x224b('0x70'),_0x5621bf[_0x224b('0x4f')]);delete this[_0x224b('0x13')][_0xb6cc9b[_0x224b('0xb3')]];};Preview['prototype'][_0x224b('0xef')]=function(_0x4139d6,_0x249d20,_0x2e4262,_0x72c425,_0xc520f4){var _0x1da338=this;return new BPromise(function(_0x3c2180,_0xbc4172){if(_[_0x224b('0x81')](_0x249d20)||_[_0x224b('0x81')](_0x249d20['Contact'])||_[_0x224b('0x81')](_0x249d20['Contact']['phone'])||_[_0x224b('0x81')](_0x249d20[_0x224b('0x75')])){_0xbc4172(ut['message'](_0x224b('0xf0'),_0x72c425,_0xc520f4));return;}var _0x7f885c=uuid['v4']();var _0x187bdb=_0x1da338[_0x224b('0x10')][_0x249d20[_0x224b('0x6e')][_0x224b('0x56')]];var _0x29d5e2=_0x2e4262?_0x1da338[_0x224b('0x14')][_0x2e4262]['id']:undefined;_0x1da338['actions'][_0x7f885c]=new Action(_0x249d20,_0x187bdb,_0x7f885c,_0x2e4262,_0x29d5e2);var _0x1af11d=_0x1da338['actions'][_0x7f885c];_0x1af11d[_0x224b('0xad')]=_0x72c425;_0x1af11d[_0x224b('0xae')]=_0xc520f4;_0x1af11d[_0x224b('0xf1')]=_0x2e4262;if(_[_0x224b('0xf2')](_0x4139d6)){_0x1da338[_0x224b('0xf3')](_0x1af11d,_0x187bdb,_0x249d20,_0x2e4262)[_0x224b('0x80')](function(_0xf9ca7c){logger[_0x224b('0x5d')](_0x224b('0xf4'),_0x224b('0xf5')+_0x1af11d[_0x224b('0x6f')]+_0x224b('0xf6')+_0x1af11d['idContact'],JSON[_0x224b('0x5a')](_0xf9ca7c));ami[_0x224b('0xba')]('custom:agentcalled',ut[_0x224b('0xbb')](_0x1af11d,_0x224b('0xf7')));_0x3c2180(ut['message'](_0x224b('0xf8')));})[_0x224b('0x8a')](function(_0x5a6396){ut['logger'](_0x224b('0xf9'),_0x5a6396);_0xbc4172(ut['message'](_0x224b('0xfa'),_0x72c425,_0xc520f4));});}else{_0x187bdb['outboundBlacklistCallsDay']+=0x1;ut[_0x224b('0xfb')](_0x1af11d);rpcDb[_0x224b('0xfc')](_0x1af11d,'[Blacklist][error]');delete _0x1da338[_0x224b('0x13')][_0x7f885c];_0xbc4172(ut[_0x224b('0x4e')]('Contact\x20in\x20black\x20List',_0x72c425,_0xc520f4));}});};Preview['prototype'][_0x224b('0x9a')]=function(_0x1484db){return!_['isNil'](_0x1484db)&&!_[_0x224b('0x81')](_0x1484db[_0x224b('0x56')])&&!_[_0x224b('0x81')](_0x1484db[_0x224b('0x57')])&&_0x1484db[_0x224b('0x57')]&&!_[_0x224b('0x81')](this[_0x224b('0x12')][util[_0x224b('0x5b')](_0x224b('0xfd'),_0x1484db[_0x224b('0x56')])])&&!_[_0x224b('0x81')](this[_0x224b('0x12')][util['format'](_0x224b('0xfd'),_0x1484db[_0x224b('0x56')])][_0x224b('0xfe')])&&(this[_0x224b('0x12')][util['format'](_0x224b('0xfd'),_0x1484db[_0x224b('0x56')])][_0x224b('0xfe')]===_0x224b('0xff')||this[_0x224b('0x12')][util['format'](_0x224b('0xfd'),_0x1484db[_0x224b('0x56')])]['status']==='unmonitored');};Preview[_0x224b('0xb')][_0x224b('0x87')]=function(_0x3d68be,_0xc9d093){var _0x453fe3=this;return new BPromise(function(_0x2f031b,_0x38b1ce){_0x453fe3['execRun'](_0x3d68be,_0xc9d093)[_0x224b('0x80')](function(_0x3b8289){_0x2f031b(_[_0x224b('0x73')](_0x3b8289,[_0x224b('0x4e')]));})[_0x224b('0x8a')](function(_0x1a6aa3){if(_0x1a6aa3[_0x224b('0x100')]){rpcDb[_0x224b('0x101')](_0x3d68be);}if(_0x1a6aa3['active']){rpcDb[_0x224b('0x8b')](_0x3d68be);}_0x38b1ce(_[_0x224b('0x73')](_0x1a6aa3,[_0x224b('0x4e')]));});});};Preview[_0x224b('0xb')][_0x224b('0x102')]=function(_0x4929b6,_0x30f209){var _0x5aab3e=this;return new BPromise(function(_0x642529,_0x15bd4f){var _0x9e038a,_0x38058a;rpcDb[_0x224b('0x103')](_0x4929b6)[_0x224b('0x80')](function(_0x4a9947){if(!_[_0x224b('0x81')](_0x4a9947[0x0])){_0x38058a=_0x4a9947[0x0]['recallme']?![]:!![];_0x9e038a=_0x4a9947[0x0]['recallme']?!![]:![];_0x9e038a=_0x30f209?!![]:_0x9e038a;}var _0x4303e4=_0x5aab3e[_0x224b('0x104')](_0x4a9947);if(_0x4303e4[_0x224b('0x105')]){rpcDb[_0x224b('0x106')](_[_0x224b('0x73')](_0x4a9947[0x0],['VoiceQueueId',_0x224b('0x107')]))['then'](function(_0x4949cf){_0x5aab3e[_0x224b('0xef')](_0x4949cf,_0x4a9947[0x0],_0x30f209,_0x38058a,_0x9e038a)[_0x224b('0x80')](function(_0x31aa01){_0x642529(_0x31aa01);})[_0x224b('0x8a')](function(_0x5c2000){_0x15bd4f(_0x5c2000);});})['catch'](function(_0x16251a){ut[_0x224b('0x63')]('[Preview][checkIsBlackList]',_0x16251a);_0x15bd4f(ut[_0x224b('0x4e')](_0x224b('0x108'),_0x38058a,_0x9e038a));});}else{_0x15bd4f(ut[_0x224b('0x4e')](_0x4303e4[_0x224b('0x4e')],_0x38058a,_0x9e038a));}})[_0x224b('0x8a')](function(_0x1b450b){ut[_0x224b('0x63')](_0x224b('0x109'),_0x1b450b);_0x15bd4f(ut[_0x224b('0x4e')](_0x224b('0x108'),![],!![]));});});};Preview['prototype']['validateContact']=function(_0x4363d5){if(_[_0x224b('0x81')](_0x4363d5)||_[_0x224b('0xf2')](_0x4363d5)||!_['isNil'](_0x4363d5[0x0][_0x224b('0x85')])&&_[_0x224b('0x81')](_0x4363d5[0x0]['Agent'][_0x224b('0x56')])){ut[_0x224b('0x63')](_0x224b('0x10a'),_0x4363d5);return{'isValid':![],'message':_0x224b('0x10b')};}var _0x3b2e25=this['campaignsPreview'][_0x4363d5[0x0][_0x224b('0x6e')][_0x224b('0x56')]];_0x3b2e25[_0x224b('0x4e')]='ACTIVE';if(_[_0x224b('0x81')](_0x3b2e25)){ut[_0x224b('0x63')]('[Preview][validateContact][Empty\x20Campaign]',_0x3b2e25);return{'isValid':![],'message':_0x224b('0x10c')};}if(!this[_0x224b('0x9a')](_0x3b2e25[_0x224b('0x55')])){ut[_0x224b('0x63')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x224b('0x10d')+_0x3b2e25[_0x224b('0x56')]+_0x224b('0x10e'));if(!this['isTrunkReachable'](_0x3b2e25[_0x224b('0x9b')])){ut[_0x224b('0x63')](_0x224b('0x10f'),_0x3b2e25['name']+_0x224b('0x110'));return{'isValid':![],'message':_0x224b('0x111')};}}if(!ut[_0x224b('0x112')](_0x3b2e25[_0x224b('0x35')])){ut[_0x224b('0x63')](_0x224b('0x113'),_0x3b2e25[_0x224b('0x56')]+_0x224b('0x114'));return{'isValid':![],'message':_0x224b('0x10d')+_0x3b2e25[_0x224b('0x56')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x224b('0x115')};};Preview[_0x224b('0xb')][_0x224b('0xf3')]=function(_0x4b0193,_0x552306,_0x32f5a3,_0x3f7805){var _0x4f6746=this;return new BPromise(function(_0x4a656b,_0x27f690){var _0x33252f=_0x4b0193['uniqueid'];var _0x24ad17=_0x4f6746[_0x224b('0x9a')](_0x552306[_0x224b('0x55')])?util['format'](_0x224b('0x116'),_0x552306['Trunk'][_0x224b('0x56')],_[_0x224b('0x81')](_0x552306[_0x224b('0x117')])?'':_0x552306['dialPrefix'][_0x224b('0x118')]()||'',_0x552306[_0x224b('0x119')]>0x0?_0x32f5a3[_0x224b('0x11a')]['phone']['substring'](_0x552306['dialCutDigit']):_0x32f5a3[_0x224b('0x11a')]['phone']):util[_0x224b('0x5b')](_0x224b('0x116'),_[_0x224b('0x81')](_0x552306[_0x224b('0x9b')])?_0x552306[_0x224b('0x55')][_0x224b('0x56')]:_0x552306[_0x224b('0x9b')]['name'],_[_0x224b('0x81')](_0x552306['dialPrefix'])?'':_0x552306[_0x224b('0x117')][_0x224b('0x118')]()||'',_0x552306[_0x224b('0x119')]>0x0?_0x32f5a3[_0x224b('0x11a')][_0x224b('0x11b')][_0x224b('0x11c')](_0x552306['dialCutDigit']):_0x32f5a3[_0x224b('0x11a')][_0x224b('0x11b')]);var _0x136c53=_0x4f6746[_0x224b('0x9a')](_0x552306[_0x224b('0x55')])?ut[_0x224b('0x11d')](_0x552306[_0x224b('0x55')][_0x224b('0x58')],_0x552306['dialOriginateCallerIdName'],_0x552306[_0x224b('0x11e')]>0x0?ut[_0x224b('0x11f')](_0x552306['dialOriginateCallerIdNumber'],_0x552306[_0x224b('0x11e')]):_0x552306[_0x224b('0x38')]):ut[_0x224b('0x11d')](_[_0x224b('0x81')](_0x552306[_0x224b('0x9b')])?_0x552306[_0x224b('0x55')][_0x224b('0x58')]:_0x552306[_0x224b('0x9b')]['callerid'],_0x552306[_0x224b('0x37')],_0x552306[_0x224b('0x11e')]>0x0?ut[_0x224b('0x11f')](_0x552306[_0x224b('0x38')],_0x552306[_0x224b('0x11e')]):_0x552306[_0x224b('0x38')]);if(_0x136c53){_0x4b0193['originatecalleridname']=ut['extractCalleridName'](_0x136c53);_0x4b0193['originatecalleridnum']=ut[_0x224b('0x120')](_0x136c53);}var _0x210c99=ut[_0x224b('0x121')](_0x552306,_0x32f5a3,_0x24ad17,_0x136c53,_0x33252f,_0x4b0193);_[_0x224b('0x122')](_0x4b0193,ut['toLowerVariables'](_0x210c99));_0x4b0193[_0x224b('0x8c')]=moment()[_0x224b('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x224b('0x77')](ut['variablesAction'](_0x4b0193,_0x552306,_0x210c99,_0x4b0193[_0x224b('0xae')],_0x3f7805))[_0x224b('0x80')](function(_0x5e1977){_0x552306[_0x224b('0x4f')]+=0x1;logger[_0x224b('0x5d')](_0x224b('0x123'),_0x33252f,_0x224b('0xb4'),_0x552306[_0x224b('0x56')],_0x224b('0x70'),_0x552306[_0x224b('0x4f')]);_0x4a656b(_0x5e1977);})[_0x224b('0x8a')](function(_0x195110){ut['logAgent'](_0x4b0193,0xe,_0x224b('0x124'));rpcDb['createAgentHistory'](_0x4b0193,'[originateFailure][logOriginateFailure]');_0x27f690(_0x195110);});});};Preview['prototype'][_0x224b('0x1e')]=function(_0x143e29){if(this['actions'][_0x143e29['linkedid']]){this[_0x224b('0x13')][_0x143e29[_0x224b('0xaf')]]['channel']=_0x143e29[_0x224b('0x78')];}};Preview[_0x224b('0xb')]['syncOriginateResponse']=function(_0x1c74b6){var _0x9b6068=this;var _0x2b85f4=this[_0x224b('0x13')][_0x1c74b6['actionid']];if(_0x2b85f4){if(_0x2b85f4[_0x224b('0xf1')]&&this[_0x224b('0x14')][_0x2b85f4['lookAgent']]){ut[_0x224b('0x125')](_0x2b85f4,this[_0x224b('0x14')][_0x2b85f4[_0x224b('0xf1')]][_0x224b('0x56')],this['agents'][_0x2b85f4['lookAgent']]['id']);}var _0x4c12d2=_[_0x224b('0x126')](_0x2b85f4);_0x4c12d2['responsetime']=moment()['format'](_0x224b('0x8d'));var _0x21e485=_0x9b6068['campaignsPreview'][_0x2b85f4[_0x224b('0x6f')]];if(ut['isFailure'](_0x1c74b6[_0x224b('0x127')])){if(_0x2b85f4[_0x224b('0xad')]){rpcDb[_0x224b('0x101')](_0x2b85f4[_0x224b('0x128')]);}if(_0x2b85f4['activeContact']){rpcDb[_0x224b('0x8b')](_0x2b85f4['idContact']);}ami[_0x224b('0xba')](_0x224b('0x129'),ut['buildObj'](_0x2b85f4,_0x224b('0x12a')));this[_0x224b('0xe2')](_0x4c12d2,_0x21e485,_0x1c74b6);}else{_0x2b85f4[_0x224b('0x8c')]=moment()[_0x224b('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x224b('0xe6')](_0x4c12d2,0x4,_0x224b('0x12b'));rpcDb[_0x224b('0xe5')](_0x4c12d2,_0x224b('0x12c'));}}};Preview[_0x224b('0xb')][_0x224b('0x12d')]=function(_0x412f60){var _0x1f5788=this;var _0x3df24b=this[_0x224b('0x13')][_0x412f60[_0x224b('0xaf')]];var _0x27f202;if(_0x3df24b){_0x27f202=this[_0x224b('0x10')][_0x3df24b[_0x224b('0x6f')]];logger[_0x224b('0x5d')]('[syncHangup][talking]',_0x412f60[_0x224b('0xaf')],_0x224b('0xb4'),_0x27f202[_0x224b('0x56')],_0x224b('0x71'),_0x27f202['pTalking']);}if(this[_0x224b('0x13')][_0x412f60[_0x224b('0xaf')]]&&_0x412f60[_0x224b('0xaf')]!==_0x412f60[_0x224b('0xb3')]){if(_0x412f60['cause']==='16'&&this[_0x224b('0x13')][_0x412f60[_0x224b('0xaf')]][_0x224b('0x72')]){this[_0x224b('0x9e')](_0x412f60,_0x412f60[_0x224b('0xaf')],_0x412f60[_0x224b('0x12e')]);}else if(this[_0x224b('0x13')][_0x412f60[_0x224b('0xaf')]]['dialAnswer']){logger[_0x224b('0x5d')](_0x224b('0x12f'),_0x412f60[_0x224b('0xaf')],_0x412f60['cause'],'\x20Queue',_0x27f202[_0x224b('0x56')],_0x224b('0x71'),_0x27f202[_0x224b('0x2a')]);this['callProgressDetectingCustomer'](_0x412f60,_0x412f60[_0x224b('0xaf')],_0x412f60[_0x224b('0x12e')]);}}else if(_0x3df24b&&_[_0x224b('0x81')](_0x3df24b[_0x224b('0x130')])&&_0x27f202[_0x224b('0x131')]&&_0x412f60[_0x224b('0xaf')]===_0x412f60[_0x224b('0xb3')]&&_[_0x224b('0x81')](_0x412f60[_0x224b('0xec')])&&_0x412f60['cause']==='16'&&_0x412f60[_0x224b('0x132')]==='6'&&_[_0x224b('0xe4')](_0x3df24b['transfer'])){if(_0x3df24b[_0x224b('0xad')]){rpcDb[_0x224b('0x101')](_0x3df24b[_0x224b('0x128')]);}if(_0x3df24b['activeContact']){rpcDb[_0x224b('0x8b')](_0x3df24b[_0x224b('0x128')]);}_0x412f60[_0x224b('0xec')]='22';this[_0x224b('0xe2')](_0x3df24b,_0x27f202,_0x412f60);}else if(_0x3df24b&&_0x3df24b[_0x224b('0x133')]){if(_0x412f60['cause']==='16'&&this[_0x224b('0x13')][_0x412f60['linkedid']]['dialAnswer']){logger[_0x224b('0x5d')](_0x224b('0x134'),_0x412f60[_0x224b('0xaf')],_0x412f60[_0x224b('0x12e')],'\x20Queue',_0x27f202[_0x224b('0x56')],_0x224b('0x71'),_0x27f202['pTalking']);this[_0x224b('0x9e')](_0x412f60,_0x412f60[_0x224b('0xaf')],_0x412f60[_0x224b('0x12e')]);}else if(this[_0x224b('0x13')][_0x412f60[_0x224b('0xaf')]]['dialAnswer']){logger['info']('[syncHangup][talking][cause]',_0x412f60[_0x224b('0xaf')],_0x412f60['cause'],_0x224b('0xb4'),_0x27f202['name'],_0x224b('0x71'),_0x27f202[_0x224b('0x2a')]);this[_0x224b('0x9e')](_0x412f60,_0x412f60[_0x224b('0xaf')],_0x412f60[_0x224b('0x12e')]);}}};Preview['prototype'][_0x224b('0x1c')]=function(_0x4ac68a){if(this['actions'][_0x4ac68a['destlinkedid']]&&_0x4ac68a[_0x224b('0xe1')]!==_0x4ac68a[_0x224b('0x135')]){this[_0x224b('0x9e')](_0x4ac68a,_0x4ac68a[_0x224b('0xe1')],_0x4ac68a[_0x224b('0x136')]);}};Preview[_0x224b('0xb')][_0x224b('0x137')]=function(_0x5ba75b){if(this[_0x224b('0x13')][_0x5ba75b[_0x224b('0xaf')]]&&_0x5ba75b[_0x224b('0xaf')]!==_0x5ba75b[_0x224b('0xb3')]&&!this[_0x224b('0x13')][_0x5ba75b[_0x224b('0xaf')]][_0x224b('0x72')]){if(_0x5ba75b[_0x224b('0x12e')]==='1'){this[_0x224b('0x9e')](_0x5ba75b,_0x5ba75b[_0x224b('0xaf')],_0x5ba75b[_0x224b('0x12e')]);}}};Preview[_0x224b('0xb')][_0x224b('0x138')]=function(_0x42197b,_0x379251,_0x81a7b3){if(this[_0x224b('0x13')][_0x42197b]){if(_[_0x224b('0x81')](this[_0x224b('0x13')][_0x42197b][_0x224b('0x139')])){this['actions'][_0x42197b]['variables']={};}this[_0x224b('0x13')][_0x42197b][_0x224b('0x139')][_0x379251]=_0x81a7b3;}};Preview[_0x224b('0xb')]['syncVarSet']=function(_0x5c6c8b){try{if(!_[_0x224b('0x81')](_0x5c6c8b)){if(ut['filterKey'](_[_0x224b('0x13a')](_0x5c6c8b[_0x224b('0x13b')])[0x0])){this[_0x224b('0x138')](_0x5c6c8b[_0x224b('0xb3')],_[_0x224b('0x13a')](_0x5c6c8b[_0x224b('0x13b')])[0x0],_0x5c6c8b[_0x224b('0x13c')]);}}}catch(_0x2f11d0){logger[_0x224b('0x13d')](_0x224b('0x13e'),util['inspect'](_0x2f11d0,{'showHidden':![],'depth':null}));}};Preview[_0x224b('0xb')][_0x224b('0x22')]=function(_0x12d672){if(_0x12d672){if(this[_0x224b('0x13')][_0x12d672[_0x224b('0x13f')]]){this[_0x224b('0x13')][_0x12d672[_0x224b('0x13f')]]['transfer']=!![];}}};Preview['prototype'][_0x224b('0x23')]=function(_0x2dc352){if(_0x2dc352){if(this[_0x224b('0x13')][_0x2dc352[_0x224b('0x140')]]){this[_0x224b('0x13')][_0x2dc352['transfererlinkedid']][_0x224b('0x133')]=!![];}}};module[_0x224b('0x141')]=Preview; \ No newline at end of file +var _0x176b=['unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','outboundCongestionCallsDay','Congestion','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','logAgent','[callProgressDetectingAgent][logBusy]','AnswerAGI','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','checkIsBlackList','VoiceQueueId','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','lookAgent','clone','isFailure','response','idContact','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','callProgressDetectingCustomer','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','addVariable','variables','filterKey','keys','variable','inspect','syncAttendedTransfer','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','bluebird','uuid','md5','../../../config/environment','../../../config/logger','preview','../ami','./action','./util/util','redis','defaults','localhost','socket.io-emitter','tail','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','loopCampaigns','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangBusyFactor','startProgressive','Trunk','name','active','callerid','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','pick','contactId','UserId','ListId','Action','status','channel','updateOriginated','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','size','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','catch','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','activeContact','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','buildObj','complete','[16]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','uniqueid','linkedid','BUSY','countbusyretry','Busy','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency'];(function(_0x43aa13,_0x1a7006){var _0x436522=function(_0x2bc8b5){while(--_0x2bc8b5){_0x43aa13['push'](_0x43aa13['shift']());}};_0x436522(++_0x1a7006);}(_0x176b,0x1c8));var _0xb176=function(_0x4588bd,_0x57222b){_0x4588bd=_0x4588bd-0x0;var _0x1becaa=_0x176b[_0x4588bd];return _0x1becaa;};'use strict';var util=require(_0xb176('0x0'));var _=require(_0xb176('0x1'));var BPromise=require(_0xb176('0x2'));var uuid=require(_0xb176('0x3'));var moment=require('moment');var md5=require(_0xb176('0x4'));var Redis=require('ioredis');var config=require(_0xb176('0x5'));var logger=require(_0xb176('0x6'))(_0xb176('0x7'));var loggerAction=require(_0xb176('0x6'))('actionPreview');var ami=require(_0xb176('0x8'));var rpcDb=require('./rpcDb');var Action=require(_0xb176('0x9'));var ut=require(_0xb176('0xa'));config[_0xb176('0xb')]=_[_0xb176('0xc')](config[_0xb176('0xb')],{'host':_0xb176('0xd'),'port':0x18eb});var io=require(_0xb176('0xe'))(new Redis(config[_0xb176('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x8441d2){this['tail']=this[_0xb176('0xf')]?this['tail']['finally'](_0x8441d2):_0x8441d2();};function Preview(_0x332056){this[_0xb176('0x10')]=new Sequence();this[_0xb176('0x11')]=_0x332056['voiceQueues'];this['trunks']=_0x332056[_0xb176('0x12')];this[_0xb176('0x13')]={};this[_0xb176('0x14')]=_0x332056[_0xb176('0x14')];this[_0xb176('0x15')]=0x0;ami['on'](_0xb176('0x16'),this['syncOriginateResponse'][_0xb176('0x17')](this));ami['on'](_0xb176('0x18'),this[_0xb176('0x19')][_0xb176('0x17')](this));ami['on']('hanguprequest',this[_0xb176('0x1a')][_0xb176('0x17')](this));ami['on'](_0xb176('0x1b'),this['syncDialEnd'][_0xb176('0x17')](this));ami['on']('newexten',this[_0xb176('0x1c')][_0xb176('0x17')](this));ami['on'](_0xb176('0x1d'),this[_0xb176('0x1e')][_0xb176('0x17')](this));ami['on'](_0xb176('0x1f'),this['syncAttendedTransfer'][_0xb176('0x17')](this));ami['on'](_0xb176('0x20'),this['syncBlindTransfer'][_0xb176('0x17')](this));this[_0xb176('0x21')](this[_0xb176('0x11')]);}function emit(_0x5540c5,_0x252256,_0x3f677e){io['to'](_0x5540c5)[_0xb176('0x22')](_0x252256,_0x3f677e);}function emitCampaignPreview(_0x44568c){if(_0x44568c[_0xb176('0x23')]===_0xb176('0x24')){var _0x5a88ad={'id':_0x44568c['id'],'name':_0x44568c['name'],'strategy':_0x44568c[_0xb176('0x25')],'answered':_0x44568c[_0xb176('0x26')],'available':_0x44568c[_0xb176('0x27')],'loggedIn':_0x44568c[_0xb176('0x28')],'pTalking':_0x44568c[_0xb176('0x29')],'sumBillable':_0x44568c['sumBillable'],'sumDuration':_0x44568c[_0xb176('0x2a')],'sumHoldTime':_0x44568c[_0xb176('0x2b')]||0x0,'talking':_0x44568c['talking'],'total':_0x44568c[_0xb176('0x2c')],'type':_0x44568c[_0xb176('0x23')],'unmanaged':_0x44568c[_0xb176('0x2d')],'abandoned':_0x44568c[_0xb176('0x2e')],'waiting':_0x44568c[_0xb176('0x2f')],'loggedInDb':_0x44568c[_0xb176('0x30')],'dialActive':_0x44568c[_0xb176('0x31')],'dialMethod':_0x44568c[_0xb176('0x32')],'dialOriginateCallerIdName':_0x44568c[_0xb176('0x33')],'dialOriginateCallerIdNumber':_0x44568c[_0xb176('0x34')],'dialOriginateTimeout':_0x44568c['dialOriginateTimeout'],'dialPrefix':_0x44568c[_0xb176('0x35')],'outboundAnswerAgiCallsDay':_0x44568c[_0xb176('0x36')],'outboundAnswerCallsDay':_0x44568c[_0xb176('0x37')],'outboundBlacklistCallsDay':_0x44568c[_0xb176('0x38')],'outboundBusyCallsDay':_0x44568c[_0xb176('0x39')],'outboundCongestionCallsDay':_0x44568c['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x44568c[_0xb176('0x3a')],'outboundDropCallsDayCallersExit':_0x44568c[_0xb176('0x3b')],'outboundDropCallsDayTimeout':_0x44568c[_0xb176('0x3c')],'outboundNoAnswerCallsDay':_0x44568c[_0xb176('0x3d')],'outboundNoSuchCallsDay':_0x44568c[_0xb176('0x3e')],'outboundOriginateFailureCallsDay':_0x44568c[_0xb176('0x3f')],'outboundReCallsDay':_0x44568c[_0xb176('0x40')],'outboundRejectCallsDay':_0x44568c[_0xb176('0x41')],'outboundUnknownCallsDay':_0x44568c[_0xb176('0x42')],'outboundAbandonedCallsDay':_0x44568c[_0xb176('0x43')],'predictiveIntervalAnsweredCalls':_0x44568c[_0xb176('0x44')],'predictiveIntervalAvgHoldtime':_0x44568c['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x44568c[_0xb176('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x44568c[_0xb176('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x44568c[_0xb176('0x47')],'predictiveIntervalErlangCalls':_0x44568c[_0xb176('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0x44568c[_0xb176('0x49')],'predictiveIntervalHitRate':_0x44568c[_0xb176('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x44568c['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x44568c[_0xb176('0x4b')],'predictiveIntervalAvailable':_0x44568c['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x44568c[_0xb176('0x4c')],'message':_0x44568c[_0xb176('0x4d')],'originated':_0x44568c[_0xb176('0x4e')],'erlangCalls':_0x44568c[_0xb176('0x4f')],'erlangCallToSecond':_0x44568c['erlangCallToSecond'],'erlangAbandonmentRate':_0x44568c['erlangAbandonmentRate'],'erlangBusyFactor':_0x44568c[_0xb176('0x50')],'startPredictive':_0x44568c['startPredictive'],'startProgressive':_0x44568c[_0xb176('0x51')]};if(_0x44568c[_0xb176('0x52')]){_0x5a88ad['Trunk']={'id':_0x44568c[_0xb176('0x52')]['id'],'name':_0x44568c[_0xb176('0x52')][_0xb176('0x53')],'active':_0x44568c['Trunk'][_0xb176('0x54')],'callerid':_0x44568c[_0xb176('0x52')][_0xb176('0x55')]};}if(_0x44568c['Interval']){_0x5a88ad[_0xb176('0x56')]={'id':_0x44568c['Interval']['id'],'name':_0x44568c[_0xb176('0x56')]['name']};}var _0x7df6af=md5(JSON[_0xb176('0x57')](_0x5a88ad));if(_0x44568c[_0xb176('0x4')]!==_0x7df6af){_0x44568c[_0xb176('0x4')]=_0x7df6af;emit(util[_0xb176('0x58')]('voice:queue:%s',_0x5a88ad[_0xb176('0x53')]),_0xb176('0x59'),_0x5a88ad);}}}function emitVoiceQueueChannelRemove(_0x2e9669){logger[_0xb176('0x5a')](_0xb176('0x5b'),JSON[_0xb176('0x57')](_0x2e9669));emit(util['format'](_0xb176('0x5c'),_0x2e9669[_0xb176('0x53')]),'voice_queue_channel:remove',_0x2e9669);}function notSendMessagesQueue(_0x407169){if(_0x407169[_0xb176('0x5d')]){if(_0x407169[_0xb176('0x4e')]===0x0&&_0x407169[_0xb176('0x29')]===0x0){_0x407169[_0xb176('0x5d')]=![];_0x407169[_0xb176('0x27')]=0x0;_0x407169[_0xb176('0x5e')]=0x0;_0x407169['message']='NOT_ACTIVE';ut[_0xb176('0x5f')](_0xb176('0x60'),_0x407169[_0xb176('0x53')]+_0xb176('0x61'));}else{_0x407169[_0xb176('0x4d')]=_0xb176('0x62');ut[_0xb176('0x5f')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x407169[_0xb176('0x53')]+_0xb176('0x63'));}emitCampaignPreview(_0x407169);}}Preview[_0xb176('0x64')]['loopCampaigns']=function(){var _0x339f30=this;setInterval(function(){_0x339f30[_0xb176('0x65')]();},0x7cf);};Preview['prototype'][_0xb176('0x65')]=function(){var _0x85d0e5=this[_0xb176('0x11')];this[_0xb176('0x15')]+=0x1;for(var _0x69115c in _0x85d0e5){if(_0x85d0e5[_0xb176('0x66')](_0x69115c)&&(_0x85d0e5[_0x69115c]['dialMethod']==='preview'||_0x85d0e5[_0x69115c][_0xb176('0x32')]===_0xb176('0x67'))&&_0x85d0e5[_0x69115c]['type']===_0xb176('0x24')){if(this[_0xb176('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xb176('0x68')]();}}if(_0x85d0e5[_0xb176('0x66')](_0x69115c)&&_0x85d0e5[_0x69115c][_0xb176('0x32')]==='preview'&&_0x85d0e5[_0x69115c]['type']===_0xb176('0x24')){if(_0x85d0e5[_0x69115c][_0xb176('0x31')]){this[_0xb176('0x69')](_0x85d0e5[_0x69115c]);this[_0xb176('0x6a')](_0x85d0e5[_0x69115c]);}else{notSendMessagesQueue(_0x85d0e5[_0x69115c]);}}}};Preview['prototype'][_0xb176('0x6b')]=function(_0x5e4f44){var _0x451ece=this;this[_0xb176('0x10')][_0xb176('0x6c')](function(){if(!_[_0xb176('0x6d')](_0x451ece[_0xb176('0x13')][_0x5e4f44])){loggerAction['info'](_0xb176('0x6e'),_0x5e4f44,_0xb176('0x6f'),_0x451ece[_0xb176('0x13')][_0x5e4f44]['queue'],'originated:\x20',JSON[_0xb176('0x57')](_0x451ece[_0xb176('0x11')][_0x451ece[_0xb176('0x13')][_0x5e4f44][_0xb176('0x70')]]['originated']),_0xb176('0x71'),JSON['stringify'](_0x451ece[_0xb176('0x11')][_0x451ece[_0xb176('0x13')][_0x5e4f44]['queue']][_0xb176('0x29')]),JSON[_0xb176('0x57')](_0x451ece[_0xb176('0x13')][_0x5e4f44]['dialAnswer']),JSON[_0xb176('0x57')](_[_0xb176('0x72')](_0x451ece[_0xb176('0x13')][_0x5e4f44],[_0xb176('0x73'),_0xb176('0x74'),'VoiceQueueId',_0xb176('0x75')])));return ami[_0xb176('0x76')]({'action':_0xb176('0x77'),'channel':_0x451ece['actions'][_0x5e4f44][_0xb176('0x78')]})['catch'](function(_0x1761ff){if(_0x1761ff[_0xb176('0x4d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x451ece[_0xb176('0x13')][_0x5e4f44]){ut[_0xb176('0x79')](_0x451ece[_0xb176('0x11')][_0x451ece[_0xb176('0x13')][_0x5e4f44][_0xb176('0x70')]],'[clearZombieChannel]');if(_0x451ece[_0xb176('0x13')][_0x5e4f44][_0xb176('0x7a')]===!![]){ut[_0xb176('0x7b')](_0x451ece['campaignsPreview'][_0x451ece[_0xb176('0x13')][_0x5e4f44]['queue']],_0xb176('0x7c'));ut[_0xb176('0x7d')]('[Dialer][checkChannel][pTalking][Preview]'+_0x5e4f44,_0x451ece[_0xb176('0x13')][_0x5e4f44][_0xb176('0x70')]);}ut['loggerError'](_0xb176('0x7e')+_0x5e4f44,_0x451ece['actions'][_0x5e4f44][_0xb176('0x70')]);delete _0x451ece[_0xb176('0x13')][_0x5e4f44];}},0x2328);}});}});};Preview[_0xb176('0x64')]['clearZombieChannels']=function(){var _0x1a95b7=this;loggerAction[_0xb176('0x5a')]('[action]',_[_0xb176('0x7f')](this[_0xb176('0x13')]));for(var _0x321136 in this['actions']){if(_0x1a95b7[_0xb176('0x13')][_0xb176('0x66')](_0x321136)){_0x1a95b7[_0xb176('0x6b')](_0x321136);}}};Preview[_0xb176('0x64')][_0xb176('0x6a')]=function(_0x3667cf){var _0x524df2=this;rpcDb[_0xb176('0x80')](_0x3667cf['id'],ut['agentReadyId'](this[_0xb176('0x14')]))[_0xb176('0x81')](function(_0xa661ca){if(!_['isNil'](_0xa661ca)){for(var _0x4b98e4=0x0;_0x4b98e4<_0xa661ca[_0xb176('0x82')];_0x4b98e4+=0x1){if(ut[_0xb176('0x83')](_0xa661ca[_0x4b98e4][_0xb176('0x84')])<_0x3667cf[_0xb176('0x85')]*0x3c){if(_0xa661ca[_0x4b98e4][_0xb176('0x86')]&&!_0xa661ca[_0x4b98e4][_0xb176('0x86')][_0xb176('0x87')]){_0x524df2[_0xb176('0x88')](_0xa661ca[_0x4b98e4]['id'])[_0xb176('0x81')](ut[_0xb176('0x89')]('[RecallMe]'))[_0xb176('0x8a')](ut['logger2'](_0xb176('0x8b')));}else{rpcDb[_0xb176('0x8c')](_0xa661ca[_0x4b98e4]['id']);}}else{var _0x102dd8=new Action(_0xa661ca[_0x4b98e4],_0x3667cf);_0x102dd8[_0xb176('0x8d')]=moment()[_0xb176('0x58')](_0xb176('0x8e'));_0x3667cf[_0xb176('0x40')]+=0x1;ut[_0xb176('0x8f')](_0x102dd8,0x17,'RecallInQueue');if(_0x3667cf[_0xb176('0x90')]){rpcDb['rescheduleContactInQueue'](ut[_0xb176('0x91')](_0xa661ca[_0x4b98e4]));rpcDb[_0xb176('0x92')](_0x102dd8,_0xb176('0x93'));}else{ut[_0xb176('0x8f')](_0x102dd8,0x16,_0xb176('0x94'));rpcDb[_0xb176('0x92')](_0x102dd8,_0xb176('0x95'));rpcDb[_0xb176('0x96')](_0x102dd8,_0xb176('0x95'));}}}}})[_0xb176('0x8a')](ut[_0xb176('0x89')](_0xb176('0x97')));};Preview[_0xb176('0x64')][_0xb176('0x69')]=function(_0x1336c2){_0x1336c2[_0xb176('0x5d')]=!![];if(ut[_0xb176('0x98')](_0x1336c2[_0xb176('0x28')])){_0x1336c2[_0xb176('0x4d')]=_0xb176('0x99');}else if(!ut[_0xb176('0x9a')](_0x1336c2[_0xb176('0x31')])){_0x1336c2[_0xb176('0x4d')]=_0xb176('0x9b');}else if(!this['isTrunkReachable'](_0x1336c2['Trunk'])){if(!this[_0xb176('0x9c')](_0x1336c2['TrunkBackup'])){_0x1336c2['message']=_0xb176('0x9d');}else{_0x1336c2['message']=_0xb176('0x9e');}}else{_0x1336c2[_0xb176('0x4d')]='ACTIVE';}emitCampaignPreview(_0x1336c2);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x4cca2d,_0x3281ce,_0x263160){var _0x4cecb8=this;var _0xfef20c=this[_0xb176('0x13')][_0x3281ce];var _0x1daa94=this[_0xb176('0x11')][_0xfef20c[_0xb176('0x70')]];var _0x5c13a;if(_0x1daa94){switch(_0x263160){case'1':_0x1daa94['outboundNoSuchCallsDay']+=0x1;_0xfef20c[_0xb176('0x9f')]+=0x1;_0xfef20c[_0xb176('0xa0')]=ut[_0xb176('0xa1')](_0xfef20c);ut['logCustomer'](_0xfef20c,0x0,_0xb176('0xa2'));rpcDb[_0xb176('0x92')](_0xfef20c,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0xb176('0xa1')](_0xfef20c)>=_0x1daa94['dialGlobalMaxRetry']){_0x5c13a=ut[_0xb176('0xa3')](_0xfef20c,0xf,'Global');rpcDb[_0xb176('0x96')](_0x5c13a,_0xb176('0xa4'));}else{if(_0xfef20c[_0xb176('0x9f')]>=_0x1daa94[_0xb176('0xa5')]){rpcDb[_0xb176('0x96')](_0xfef20c,_0xb176('0xa4'));}else{rpcDb[_0xb176('0xa6')](ut[_0xb176('0xa7')](_0xfef20c,'countnosuchnumberretry',_0x1daa94['dialNoSuchNumberRetryFrequency']),_0xfef20c['unlockAgent'],_0xfef20c[_0xb176('0xa8')]);}}delete this[_0xb176('0x13')][_0x4cca2d['linkedid']];break;case _0xb176('0xa9'):var _0x1f2dc3=moment()['format'](_0xb176('0x8e'));_0xfef20c[_0xb176('0xaa')]=_0x1f2dc3;_0xfef20c[_0xb176('0xab')]=_0x1f2dc3;_0xfef20c['dialAnswer']=!![];_0x1daa94[_0xb176('0x29')]+=0x1;logger[_0xb176('0x5a')](_0xb176('0xac'),_0xfef20c['uniqueid'],_0xb176('0xad'),_0x1daa94[_0xb176('0x53')],_0xb176('0x71'),_0x1daa94['pTalking']);ami[_0xb176('0x22')]('custom:agentconnect',ut[_0xb176('0xae')](_0xfef20c,'connect'));if(_0x1daa94['acw']){ami[_0xb176('0x22')]('custom:agentConnectPreview',ut['buildAcw'](_0xfef20c));}break;case'16':ami[_0xb176('0x22')]('custom:agentcomplete',ut[_0xb176('0xae')](_0xfef20c,_0xb176('0xaf')));emitVoiceQueueChannelRemove(ut['buildObj'](_0xfef20c,'complete'));_0x1daa94[_0xb176('0x37')]+=0x1;_0x1daa94[_0xb176('0x2c')]+=0x1;_0x1daa94[_0xb176('0x26')]+=0x1;ut[_0xb176('0x7b')](_0x1daa94,_0xb176('0xb0'));_0xfef20c[_0xb176('0xa0')]=ut[_0xb176('0xa1')](_0xfef20c);ut[_0xb176('0x8f')](_0xfef20c,0x4,'Answer');rpcDb[_0xb176('0x92')](_0xfef20c,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0xfef20c,_0xb176('0xb1'));rpcDb[_0xb176('0xb2')](_0xfef20c);_0x1daa94[_0xb176('0x2a')]+=_0xfef20c['talktime'];_0x1daa94['sumBillable']+=_0xfef20c[_0xb176('0xb3')];logger[_0xb176('0x5a')](_0xb176('0xb4'),_0xfef20c[_0xb176('0xb5')],_0xb176('0xad'),_0x1daa94[_0xb176('0x53')],_0xb176('0x71'),_0x1daa94[_0xb176('0x29')]);delete this['actions'][_0x4cca2d[_0xb176('0xb6')]];break;case _0xb176('0xb7'):_0x1daa94[_0xb176('0x39')]+=0x1;_0xfef20c[_0xb176('0xb8')]+=0x1;_0xfef20c[_0xb176('0xa0')]=ut['totalGlobal'](_0xfef20c);ut['logCustomer'](_0xfef20c,0x5,_0xb176('0xb9'));rpcDb[_0xb176('0x92')](_0xfef20c,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xb176('0xa1')](_0xfef20c)>=_0x1daa94[_0xb176('0xba')]){_0x5c13a=ut[_0xb176('0xa3')](_0xfef20c,0xf,_0xb176('0xbb'));rpcDb[_0xb176('0x96')](_0x5c13a,_0xb176('0xbc'));}else{if(_0xfef20c[_0xb176('0xb8')]>=_0x1daa94[_0xb176('0xbd')]){rpcDb[_0xb176('0x96')](_0xfef20c,_0xb176('0xbe'));}else{rpcDb[_0xb176('0xa6')](ut[_0xb176('0xa7')](_0xfef20c,_0xb176('0xb8'),_0x1daa94[_0xb176('0xbf')]),_0xfef20c[_0xb176('0xc0')],_0xfef20c['activeContact']);}}break;case _0xb176('0xc1'):_0x1daa94[_0xb176('0x3d')]+=0x1;_0xfef20c[_0xb176('0xc2')]+=0x1;_0xfef20c[_0xb176('0xa0')]=ut[_0xb176('0xa1')](_0xfef20c);ut[_0xb176('0x8f')](_0xfef20c,0x3,_0xb176('0xc3'));rpcDb[_0xb176('0x92')](_0xfef20c,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0xfef20c)>=_0x1daa94[_0xb176('0xba')]){_0x5c13a=ut['cloneAction'](_0xfef20c,0xf,'Global');rpcDb['createCustomerFinal'](_0x5c13a,_0xb176('0xc4'));}else{if(_0xfef20c['countnoanswerretry']>=_0x1daa94[_0xb176('0xc5')]){rpcDb[_0xb176('0x96')](_0xfef20c,_0xb176('0xc6'));}else{rpcDb['rescheduleContact'](ut[_0xb176('0xa7')](_0xfef20c,_0xb176('0xc2'),_0x1daa94['dialNoAnswerRetryFrequency']),_0xfef20c[_0xb176('0xc0')],_0xfef20c[_0xb176('0xa8')]);}}break;case _0xb176('0xc7'):_0x1daa94[_0xb176('0xc8')]+=0x1;_0xfef20c['countcongestionretry']+=0x1;_0xfef20c['countglobal']=ut[_0xb176('0xa1')](_0xfef20c);ut['logCustomer'](_0xfef20c,0x8,_0xb176('0xc9'));rpcDb['createCustomerHistory'](_0xfef20c,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0xb176('0xa1')](_0xfef20c)>=_0x1daa94[_0xb176('0xba')]){_0x5c13a=ut['cloneAction'](_0xfef20c,0xf,_0xb176('0xbb'));rpcDb[_0xb176('0x96')](_0x5c13a,_0xb176('0xca'));}else{if(_0xfef20c[_0xb176('0xcb')]>=_0x1daa94[_0xb176('0xcc')]){rpcDb[_0xb176('0x96')](_0xfef20c,_0xb176('0xcd'));}else{rpcDb[_0xb176('0xa6')](ut['scheduledAt'](_0xfef20c,'countcongestionretry',_0x1daa94[_0xb176('0xbf')]),_0xfef20c['unlockAgent'],_0xfef20c[_0xb176('0xa8')]);}}break;case'CANCEL':_0x1daa94['outboundRejectCallsDay']+=0x1;_0xfef20c['countagentrejectretry']+=0x1;_0xfef20c[_0xb176('0xa0')]=ut['totalGlobal'](_0xfef20c);ut[_0xb176('0x8f')](_0xfef20c,0x14,'AgentReject');rpcDb['createCustomerHistory'](_0xfef20c,_0xb176('0xce'));if(ut[_0xb176('0xa1')](_0xfef20c)>=_0x1daa94[_0xb176('0xba')]){_0x5c13a=ut[_0xb176('0xa3')](_0xfef20c,0x14,_0xb176('0xcf'));rpcDb['createCustomerFinal'](_0x5c13a,_0xb176('0xd0'));}else{if(_0xfef20c['countagentrejectretry']>=_0x1daa94[_0xb176('0xd1')]){rpcDb[_0xb176('0x96')](_0xfef20c,_0xb176('0xd0'));}else{rpcDb[_0xb176('0xa6')](ut[_0xb176('0xa7')](_0xfef20c,'countagentrejectretry',_0x1daa94['dialAgentRejectRetryFrequency']),_0xfef20c['unlockAgent'],_0xfef20c[_0xb176('0xa8')]);}}break;case'ABANDONED':_0x1daa94['outboundAbandonedCallsDay']+=0x1;_0xfef20c[_0xb176('0xd2')]+=0x1;_0xfef20c[_0xb176('0xa0')]=ut[_0xb176('0xa1')](_0xfef20c);ut['logCustomer'](_0xfef20c,0xb,_0xb176('0xd3'));rpcDb['createCustomerHistory'](_0xfef20c,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0xfef20c)>=_0x1daa94[_0xb176('0xba')]){_0x5c13a=ut[_0xb176('0xa3')](_0xfef20c,0xf,_0xb176('0xbb'));rpcDb[_0xb176('0x96')](_0x5c13a,_0xb176('0xd4'));}else{if(_0xfef20c[_0xb176('0xd5')]>=_0x1daa94['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0xfef20c,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xb176('0xa6')](ut[_0xb176('0xa7')](_0xfef20c,_0xb176('0xd2'),_0x1daa94[_0xb176('0xd6')]),_0xfef20c[_0xb176('0xc0')],_0xfef20c[_0xb176('0xa8')]);}}break;default:if(_0xfef20c[_0xb176('0x7a')]){ut[_0xb176('0x7b')](_0x1daa94,_0xb176('0xd7'));ut['loggerError'](_0xb176('0xd8')+_0x1daa94[_0xb176('0x53')],_0x4cca2d);}_0x1daa94[_0xb176('0x42')]+=0x1;_0xfef20c[_0xb176('0xa0')]=ut['totalGlobal'](_0xfef20c);ut[_0xb176('0x8f')](_0xfef20c,0xc,_0x4cca2d[_0xb176('0xd9')]||_0x4cca2d[_0xb176('0xda')]);rpcDb[_0xb176('0x92')](_0xfef20c,_0xb176('0xdb'));if(ut['totalGlobal'](_0xfef20c)>=_0x1daa94[_0xb176('0xba')]){_0x5c13a=ut['cloneAction'](_0xfef20c,0xf,_0xb176('0xbb'));rpcDb[_0xb176('0x96')](_0x5c13a,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xb176('0x96')](_0xfef20c,_0xb176('0xdc'));}delete this[_0xb176('0x13')][_0x4cca2d[_0xb176('0xb6')]];}if(!(_0xfef20c[_0xb176('0x7a')]&&_0x263160==='16')){ut[_0xb176('0x79')](_0x1daa94,_0xb176('0xdd'));logger['info'](_0xb176('0xde'),_0xfef20c[_0xb176('0xb5')],_0xb176('0xad'),_0x1daa94[_0xb176('0x53')],_0xb176('0xdf'),_0x1daa94['originated']);}if(_0x263160!=='ANSWER'){delete this['actions'][_0x4cca2d[_0xb176('0xb6')]];delete this['actions'][_0x4cca2d[_0xb176('0xe0')]];}}};Preview[_0xb176('0x64')][_0xb176('0xe1')]=function(_0x1849e3,_0x14513e,_0x2b9624){if(_[_0xb176('0xe2')](_0x14513e)&&'object'!==typeof _0x14513e){return;}if(_['isUndefined'](_0x2b9624)&&_0xb176('0xe3')!==typeof _0x2b9624){return;}switch(_0x2b9624['reason']){case'0':ut['logAgent'](_0x1849e3,0x0,_0xb176('0xa2'));rpcDb[_0xb176('0xe4')](_0x1849e3,_0xb176('0xe5'));break;case'3':ut['logAgent'](_0x1849e3,0x3,_0xb176('0xc3'));rpcDb[_0xb176('0xe4')](_0x1849e3,_0xb176('0xe6'));break;case'5':ut[_0xb176('0xe7')](_0x1849e3,0x5,_0xb176('0xb9'));rpcDb[_0xb176('0xe4')](_0x1849e3,_0xb176('0xe8'));break;case'8':ut[_0xb176('0xe7')](_0x1849e3,0x8,_0xb176('0xc9'));rpcDb['createAgentHistory'](_0x1849e3,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xb176('0xe7')](_0x1849e3,0x16,_0xb176('0xe9'));rpcDb[_0xb176('0xe4')](_0x1849e3,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xb176('0xe7')](_0x1849e3,0xc,_0x2b9624[_0xb176('0xea')]);rpcDb[_0xb176('0xe4')](_0x1849e3,_0xb176('0xeb'));}ut[_0xb176('0x79')](_0x14513e,_0xb176('0xec'));logger[_0xb176('0x5a')](_0xb176('0xed'),_0x1849e3[_0xb176('0xb5')],_0xb176('0xad'),_0x14513e['name'],_0xb176('0xdf'),_0x14513e[_0xb176('0x4e')]);delete this[_0xb176('0x13')][_0x1849e3['uniqueid']];};Preview[_0xb176('0x64')]['checkInBlack']=function(_0x3380c4,_0x2cf469,_0x4daf33,_0x1e7893,_0x85983c){var _0x15559f=this;return new BPromise(function(_0x83cbc3,_0x217f96){if(_['isNil'](_0x2cf469)||_[_0xb176('0x6d')](_0x2cf469[_0xb176('0xee')])||_['isNil'](_0x2cf469[_0xb176('0xee')][_0xb176('0xef')])||_['isNil'](_0x2cf469['VoiceQueueId'])){_0x217f96(ut[_0xb176('0x4d')](_0xb176('0xf0'),_0x1e7893,_0x85983c));return;}var _0x3485cb=uuid['v4']();var _0x194bf7=_0x15559f[_0xb176('0x11')][_0x2cf469[_0xb176('0x6f')][_0xb176('0x53')]];var _0x1a65f7=_0x4daf33?_0x15559f[_0xb176('0x14')][_0x4daf33]['id']:undefined;_0x15559f['actions'][_0x3485cb]=new Action(_0x2cf469,_0x194bf7,_0x3485cb,_0x4daf33,_0x1a65f7);var _0x5626f5=_0x15559f[_0xb176('0x13')][_0x3485cb];_0x5626f5[_0xb176('0xc0')]=_0x1e7893;_0x5626f5[_0xb176('0xa8')]=_0x85983c;_0x5626f5['lookAgent']=_0x4daf33;if(_[_0xb176('0xf1')](_0x3380c4)){_0x15559f[_0xb176('0xf2')](_0x5626f5,_0x194bf7,_0x2cf469,_0x4daf33)['then'](function(_0x44e387){logger[_0xb176('0x5a')](_0xb176('0xf3'),_0xb176('0xf4')+_0x5626f5[_0xb176('0x70')]+_0xb176('0xf5')+_0x5626f5['idContact'],JSON['stringify'](_0x44e387));ami[_0xb176('0x22')](_0xb176('0xf6'),ut[_0xb176('0xae')](_0x5626f5,_0xb176('0xf7')));_0x83cbc3(ut[_0xb176('0x4d')](_0xb176('0xf8')));})[_0xb176('0x8a')](function(_0x37e942){ut['logger'](_0xb176('0xf9'),_0x37e942);_0x217f96(ut[_0xb176('0x4d')]('Call\x20failed',_0x1e7893,_0x85983c));});}else{_0x194bf7[_0xb176('0x38')]+=0x1;ut[_0xb176('0xfa')](_0x5626f5);rpcDb['createHistory'](_0x5626f5,_0xb176('0xfb'));delete _0x15559f[_0xb176('0x13')][_0x3485cb];_0x217f96(ut[_0xb176('0x4d')](_0xb176('0xfc'),_0x1e7893,_0x85983c));}});};Preview[_0xb176('0x64')][_0xb176('0x9c')]=function(_0x15ed22){return!_[_0xb176('0x6d')](_0x15ed22)&&!_[_0xb176('0x6d')](_0x15ed22['name'])&&!_[_0xb176('0x6d')](_0x15ed22[_0xb176('0x54')])&&_0x15ed22[_0xb176('0x54')]&&!_[_0xb176('0x6d')](this[_0xb176('0x12')][util[_0xb176('0x58')](_0xb176('0xfd'),_0x15ed22[_0xb176('0x53')])])&&!_[_0xb176('0x6d')](this[_0xb176('0x12')][util['format']('SIP/%s',_0x15ed22[_0xb176('0x53')])][_0xb176('0x77')])&&(this[_0xb176('0x12')][util[_0xb176('0x58')](_0xb176('0xfd'),_0x15ed22[_0xb176('0x53')])][_0xb176('0x77')]===_0xb176('0xfe')||this[_0xb176('0x12')][util[_0xb176('0x58')](_0xb176('0xfd'),_0x15ed22['name'])][_0xb176('0x77')]===_0xb176('0xff'));};Preview[_0xb176('0x64')][_0xb176('0x88')]=function(_0x164191,_0x124fac){var _0x30652f=this;return new BPromise(function(_0x20366d,_0x468220){_0x30652f[_0xb176('0x100')](_0x164191,_0x124fac)[_0xb176('0x81')](function(_0x8290a7){_0x20366d(_[_0xb176('0x72')](_0x8290a7,['message']));})[_0xb176('0x8a')](function(_0xa4ed4e){if(_0xa4ed4e['unlock']){rpcDb[_0xb176('0x101')](_0x164191);}if(_0xa4ed4e[_0xb176('0x54')]){rpcDb[_0xb176('0x8c')](_0x164191);}_0x468220(_[_0xb176('0x72')](_0xa4ed4e,[_0xb176('0x4d')]));});});};Preview[_0xb176('0x64')][_0xb176('0x100')]=function(_0x1037d1,_0x2042a9){var _0x3b5b5e=this;return new BPromise(function(_0x15dcbe,_0x1575e6){var _0x19e27b,_0x1de836;rpcDb[_0xb176('0x102')](_0x1037d1)[_0xb176('0x81')](function(_0x2f3946){if(!_[_0xb176('0x6d')](_0x2f3946[0x0])){_0x1de836=_0x2f3946[0x0]['recallme']?![]:!![];_0x19e27b=_0x2f3946[0x0][_0xb176('0x103')]?!![]:![];_0x19e27b=_0x2042a9?!![]:_0x19e27b;}var _0x3d50ec=_0x3b5b5e['validateContact'](_0x2f3946);if(_0x3d50ec['isValid']){rpcDb[_0xb176('0x104')](_[_0xb176('0x72')](_0x2f3946[0x0],[_0xb176('0x105'),_0xb176('0x106')]))[_0xb176('0x81')](function(_0x35d066){_0x3b5b5e[_0xb176('0x107')](_0x35d066,_0x2f3946[0x0],_0x2042a9,_0x1de836,_0x19e27b)[_0xb176('0x81')](function(_0x32ab69){_0x15dcbe(_0x32ab69);})[_0xb176('0x8a')](function(_0x2eea81){_0x1575e6(_0x2eea81);});})['catch'](function(_0x2e7760){ut['logger'](_0xb176('0x108'),_0x2e7760);_0x1575e6(ut['message'](_0xb176('0x109'),_0x1de836,_0x19e27b));});}else{_0x1575e6(ut[_0xb176('0x4d')](_0x3d50ec['message'],_0x1de836,_0x19e27b));}})['catch'](function(_0x582955){ut[_0xb176('0x5f')](_0xb176('0x10a'),_0x582955);_0x1575e6(ut[_0xb176('0x4d')](_0xb176('0x109'),![],!![]));});});};Preview[_0xb176('0x64')][_0xb176('0x10b')]=function(_0x385b28){if(_[_0xb176('0x6d')](_0x385b28)||_[_0xb176('0xf1')](_0x385b28)||!_[_0xb176('0x6d')](_0x385b28[0x0][_0xb176('0x86')])&&_['isNil'](_0x385b28[0x0][_0xb176('0x86')][_0xb176('0x53')])){ut[_0xb176('0x5f')](_0xb176('0x10c'),_0x385b28);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x5cee15=this[_0xb176('0x11')][_0x385b28[0x0][_0xb176('0x6f')][_0xb176('0x53')]];_0x5cee15[_0xb176('0x4d')]='ACTIVE';if(_['isNil'](_0x5cee15)){ut[_0xb176('0x5f')]('[Preview][validateContact][Empty\x20Campaign]',_0x5cee15);return{'isValid':![],'message':_0xb176('0x10d')};}if(!this[_0xb176('0x9c')](_0x5cee15['Trunk'])){ut[_0xb176('0x5f')](_0xb176('0x10e'),_0xb176('0x10f')+_0x5cee15[_0xb176('0x53')]+_0xb176('0x110'));if(!this[_0xb176('0x9c')](_0x5cee15[_0xb176('0x111')])){ut[_0xb176('0x5f')](_0xb176('0x10e'),_0x5cee15[_0xb176('0x53')]+_0xb176('0x112'));return{'isValid':![],'message':_0xb176('0x113')};}}if(!ut['isActive'](_0x5cee15[_0xb176('0x31')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x5cee15['name']+_0xb176('0x114'));return{'isValid':![],'message':_0xb176('0x10f')+_0x5cee15[_0xb176('0x53')]+_0xb176('0x114')};}return{'isValid':!![],'message':_0xb176('0x115')};};Preview['prototype']['execCall']=function(_0x20c2c8,_0x20441d,_0x5ef2f3,_0x31064c){var _0x2efee3=this;return new BPromise(function(_0x4fd8a2,_0x183b11){var _0x28d17d=_0x20c2c8[_0xb176('0xb5')];var _0x16e7f1=_0x2efee3[_0xb176('0x9c')](_0x20441d[_0xb176('0x52')])?util[_0xb176('0x58')]('SIP/%s/%s%s',_0x20441d['Trunk'][_0xb176('0x53')],_[_0xb176('0x6d')](_0x20441d[_0xb176('0x35')])?'':_0x20441d['dialPrefix'][_0xb176('0x116')]()||'',_0x20441d[_0xb176('0x117')]>0x0?_0x5ef2f3[_0xb176('0xee')][_0xb176('0xef')][_0xb176('0x118')](_0x20441d[_0xb176('0x117')]):_0x5ef2f3[_0xb176('0xee')]['phone']):util['format']('SIP/%s/%s%s',_[_0xb176('0x6d')](_0x20441d[_0xb176('0x111')])?_0x20441d[_0xb176('0x52')]['name']:_0x20441d[_0xb176('0x111')][_0xb176('0x53')],_['isNil'](_0x20441d[_0xb176('0x35')])?'':_0x20441d[_0xb176('0x35')][_0xb176('0x116')]()||'',_0x20441d['dialCutDigit']>0x0?_0x5ef2f3[_0xb176('0xee')][_0xb176('0xef')][_0xb176('0x118')](_0x20441d[_0xb176('0x117')]):_0x5ef2f3[_0xb176('0xee')][_0xb176('0xef')]);var _0x26241c=_0x2efee3[_0xb176('0x9c')](_0x20441d['Trunk'])?ut[_0xb176('0x119')](_0x20441d[_0xb176('0x52')][_0xb176('0x55')],_0x20441d[_0xb176('0x33')],_0x20441d[_0xb176('0x11a')]>0x0?ut[_0xb176('0x11b')](_0x20441d[_0xb176('0x34')],_0x20441d[_0xb176('0x11a')]):_0x20441d['dialOriginateCallerIdNumber']):ut[_0xb176('0x119')](_[_0xb176('0x6d')](_0x20441d[_0xb176('0x111')])?_0x20441d[_0xb176('0x52')][_0xb176('0x55')]:_0x20441d['TrunkBackup'][_0xb176('0x55')],_0x20441d[_0xb176('0x33')],_0x20441d[_0xb176('0x11a')]>0x0?ut['getCallerIdRandom'](_0x20441d[_0xb176('0x34')],_0x20441d['dialRandomLastDigitCallerIdNumber']):_0x20441d[_0xb176('0x34')]);if(_0x26241c){_0x20c2c8[_0xb176('0x11c')]=ut[_0xb176('0x11d')](_0x26241c);_0x20c2c8[_0xb176('0x11e')]=ut['extractCalleridNumber'](_0x26241c);}var _0x519d63=ut[_0xb176('0x11f')](_0x20441d,_0x5ef2f3,_0x16e7f1,_0x26241c,_0x28d17d,_0x20c2c8);_[_0xb176('0x120')](_0x20c2c8,ut[_0xb176('0x121')](_0x519d63));_0x20c2c8[_0xb176('0x8d')]=moment()['format'](_0xb176('0x8e'));ami['Action'](ut[_0xb176('0x122')](_0x20c2c8,_0x20441d,_0x519d63,_0x20c2c8[_0xb176('0xa8')],_0x31064c))['then'](function(_0x235a16){_0x20441d['originated']+=0x1;logger[_0xb176('0x5a')]('[originated][increment]',_0x28d17d,_0xb176('0xad'),_0x20441d[_0xb176('0x53')],_0xb176('0xdf'),_0x20441d[_0xb176('0x4e')]);_0x4fd8a2(_0x235a16);})[_0xb176('0x8a')](function(_0x5ef262){ut['logAgent'](_0x20c2c8,0xe,_0xb176('0x123'));rpcDb['createAgentHistory'](_0x20c2c8,_0xb176('0x124'));_0x183b11(_0x5ef262);});});};Preview[_0xb176('0x64')][_0xb176('0x1c')]=function(_0x8ad605){if(this['actions'][_0x8ad605[_0xb176('0xb6')]]){this[_0xb176('0x13')][_0x8ad605[_0xb176('0xb6')]][_0xb176('0x78')]=_0x8ad605[_0xb176('0x78')];}};Preview[_0xb176('0x64')][_0xb176('0x125')]=function(_0x479b5d){var _0x1b1496=this;var _0xb2b5f8=this['actions'][_0x479b5d[_0xb176('0x126')]];if(_0xb2b5f8){if(_0xb2b5f8[_0xb176('0x127')]&&this[_0xb176('0x14')][_0xb2b5f8[_0xb176('0x127')]]){ut['logLookAgent'](_0xb2b5f8,this[_0xb176('0x14')][_0xb2b5f8[_0xb176('0x127')]][_0xb176('0x53')],this[_0xb176('0x14')][_0xb2b5f8['lookAgent']]['id']);}var _0x5ec761=_[_0xb176('0x128')](_0xb2b5f8);_0x5ec761['responsetime']=moment()['format'](_0xb176('0x8e'));var _0x4abcf4=_0x1b1496[_0xb176('0x11')][_0xb2b5f8[_0xb176('0x70')]];if(ut[_0xb176('0x129')](_0x479b5d[_0xb176('0x12a')])){if(_0xb2b5f8['unlockAgent']){rpcDb[_0xb176('0x101')](_0xb2b5f8[_0xb176('0x12b')]);}if(_0xb2b5f8[_0xb176('0xa8')]){rpcDb[_0xb176('0x8c')](_0xb2b5f8['idContact']);}ami[_0xb176('0x22')](_0xb176('0x12c'),ut['buildObj'](_0xb2b5f8,_0xb176('0x12d')));this[_0xb176('0xe1')](_0x5ec761,_0x4abcf4,_0x479b5d);}else{_0xb2b5f8[_0xb176('0x8d')]=moment()[_0xb176('0x58')](_0xb176('0x8e'));ut[_0xb176('0xe7')](_0x5ec761,0x4,_0xb176('0x12e'));rpcDb[_0xb176('0xe4')](_0x5ec761,_0xb176('0x12f'));}}};Preview['prototype'][_0xb176('0x19')]=function(_0x4e4af9){var _0x499f77=this;var _0x59d2a3=this['actions'][_0x4e4af9[_0xb176('0xb6')]];var _0x2421d8;if(_0x59d2a3){_0x2421d8=this[_0xb176('0x11')][_0x59d2a3[_0xb176('0x70')]];logger[_0xb176('0x5a')]('[syncHangup][talking]',_0x4e4af9['linkedid'],_0xb176('0xad'),_0x2421d8[_0xb176('0x53')],_0xb176('0x71'),_0x2421d8[_0xb176('0x29')]);}if(this[_0xb176('0x13')][_0x4e4af9['linkedid']]&&_0x4e4af9[_0xb176('0xb6')]!==_0x4e4af9['uniqueid']){if(_0x4e4af9[_0xb176('0x130')]==='16'&&this['actions'][_0x4e4af9[_0xb176('0xb6')]][_0xb176('0x7a')]){this['callProgressDetectingCustomer'](_0x4e4af9,_0x4e4af9[_0xb176('0xb6')],_0x4e4af9[_0xb176('0x130')]);}else if(this['actions'][_0x4e4af9[_0xb176('0xb6')]][_0xb176('0x7a')]){logger[_0xb176('0x5a')](_0xb176('0x131'),_0x4e4af9[_0xb176('0xb6')],_0x4e4af9[_0xb176('0x130')],_0xb176('0xad'),_0x2421d8[_0xb176('0x53')],'pTalking:\x20',_0x2421d8['pTalking']);this[_0xb176('0x132')](_0x4e4af9,_0x4e4af9[_0xb176('0xb6')],_0x4e4af9['cause']);}}else if(_0x59d2a3&&_[_0xb176('0x6d')](_0x59d2a3[_0xb176('0x133')])&&_0x2421d8[_0xb176('0x134')]&&_0x4e4af9['linkedid']===_0x4e4af9[_0xb176('0xb5')]&&_[_0xb176('0x6d')](_0x4e4af9['reason'])&&_0x4e4af9[_0xb176('0x130')]==='16'&&_0x4e4af9['channelstate']==='6'&&_[_0xb176('0xe2')](_0x59d2a3[_0xb176('0x135')])){if(_0x59d2a3[_0xb176('0xc0')]){rpcDb['unlockContact'](_0x59d2a3[_0xb176('0x12b')]);}if(_0x59d2a3[_0xb176('0xa8')]){rpcDb['disableContact'](_0x59d2a3[_0xb176('0x12b')]);}_0x4e4af9[_0xb176('0xea')]='22';this[_0xb176('0xe1')](_0x59d2a3,_0x2421d8,_0x4e4af9);}else if(_0x59d2a3&&_0x59d2a3['transfer']){if(_0x4e4af9[_0xb176('0x130')]==='16'&&this[_0xb176('0x13')][_0x4e4af9[_0xb176('0xb6')]][_0xb176('0x7a')]){logger['info'](_0xb176('0x136'),_0x4e4af9[_0xb176('0xb6')],_0x4e4af9[_0xb176('0x130')],'\x20Queue',_0x2421d8[_0xb176('0x53')],_0xb176('0x71'),_0x2421d8[_0xb176('0x29')]);this['callProgressDetectingCustomer'](_0x4e4af9,_0x4e4af9['linkedid'],_0x4e4af9[_0xb176('0x130')]);}else if(this[_0xb176('0x13')][_0x4e4af9['linkedid']][_0xb176('0x7a')]){logger[_0xb176('0x5a')]('[syncHangup][talking][cause]',_0x4e4af9[_0xb176('0xb6')],_0x4e4af9[_0xb176('0x130')],_0xb176('0xad'),_0x2421d8['name'],_0xb176('0x71'),_0x2421d8['pTalking']);this[_0xb176('0x132')](_0x4e4af9,_0x4e4af9['linkedid'],_0x4e4af9['cause']);}}};Preview[_0xb176('0x64')][_0xb176('0x137')]=function(_0x5c60e1){if(this[_0xb176('0x13')][_0x5c60e1['destlinkedid']]&&_0x5c60e1['destlinkedid']!==_0x5c60e1[_0xb176('0x138')]){this[_0xb176('0x132')](_0x5c60e1,_0x5c60e1[_0xb176('0xe0')],_0x5c60e1[_0xb176('0xda')]);}};Preview[_0xb176('0x64')][_0xb176('0x1a')]=function(_0x5b50e3){if(this[_0xb176('0x13')][_0x5b50e3[_0xb176('0xb6')]]&&_0x5b50e3[_0xb176('0xb6')]!==_0x5b50e3[_0xb176('0xb5')]&&!this[_0xb176('0x13')][_0x5b50e3[_0xb176('0xb6')]]['dialAnswer']){if(_0x5b50e3[_0xb176('0x130')]==='1'){this[_0xb176('0x132')](_0x5b50e3,_0x5b50e3[_0xb176('0xb6')],_0x5b50e3[_0xb176('0x130')]);}}};Preview[_0xb176('0x64')][_0xb176('0x139')]=function(_0x28597a,_0x17d0a9,_0x18425e){if(this[_0xb176('0x13')][_0x28597a]){if(_[_0xb176('0x6d')](this[_0xb176('0x13')][_0x28597a][_0xb176('0x13a')])){this['actions'][_0x28597a][_0xb176('0x13a')]={};}this['actions'][_0x28597a]['variables'][_0x17d0a9]=_0x18425e;}};Preview[_0xb176('0x64')][_0xb176('0x1e')]=function(_0x258306){try{if(!_['isNil'](_0x258306)){if(ut[_0xb176('0x13b')](_[_0xb176('0x13c')](_0x258306[_0xb176('0x13d')])[0x0])){this['addVariable'](_0x258306[_0xb176('0xb5')],_[_0xb176('0x13c')](_0x258306[_0xb176('0x13d')])[0x0],_0x258306['value']);}}}catch(_0x4ba676){logger['error']('[syncVarSet][Preview]',util[_0xb176('0x13e')](_0x4ba676,{'showHidden':![],'depth':null}));}};Preview[_0xb176('0x64')][_0xb176('0x13f')]=function(_0x391999){if(_0x391999){if(this['actions'][_0x391999[_0xb176('0x140')]]){this[_0xb176('0x13')][_0x391999['transfertargetlinkedid']][_0xb176('0x135')]=!![];}}};Preview[_0xb176('0x64')][_0xb176('0x141')]=function(_0x4c3971){if(_0x4c3971){if(this[_0xb176('0x13')][_0x4c3971[_0xb176('0x142')]]){this[_0xb176('0x13')][_0x4c3971[_0xb176('0x142')]][_0xb176('0x135')]=!![];}}};module[_0xb176('0x143')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 0f91304..f16d029 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 _0x81bd=['from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime'];(function(_0x51fd25,_0x2fcbb){var _0x4529ae=function(_0x17ed81){while(--_0x17ed81){_0x51fd25['push'](_0x51fd25['shift']());}};_0x4529ae(++_0x2fcbb);}(_0x81bd,0x7c));var _0xd81b=function(_0x5ce2e3,_0x3dc503){_0x5ce2e3=_0x5ce2e3-0x0;var _0x3b53ab=_0x81bd[_0x5ce2e3];return _0x3b53ab;};'use strict';var util=require(_0xd81b('0x0'));var BPromise=require(_0xd81b('0x1'));var logger=require(_0xd81b('0x2'))(_0xd81b('0x3'));var _=require(_0xd81b('0x4'));var cmHopper=require(_0xd81b('0x5'));var cmHopperFinal=require(_0xd81b('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xd81b('0x7'));var voiceQueueRt=require(_0xd81b('0x8'));var agentReportPreview=require(_0xd81b('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x42a0aa){return function(_0x34eb73){logger[_0xd81b('0xa')](_0x42a0aa,util['inspect'](_0x34eb73,{'showHidden':![],'depth':null}));};}function create(_0x5e14e8){return BPromise[_0xd81b('0xb')]()['then'](cmHopperHistory[_0xd81b('0xc')](_0x5e14e8))[_0xd81b('0xd')](loggerCatch(_0xd81b('0xe')));}function createAgent(_0x86dab6){return BPromise[_0xd81b('0xb')]()[_0xd81b('0xf')](agentReportPreview[_0xd81b('0xc')](_0x86dab6))[_0xd81b('0xd')](loggerCatch(_0xd81b('0xe')));}function moveContact(_0x23c789){return BPromise[_0xd81b('0xb')]()[_0xd81b('0xf')](cmHopper[_0xd81b('0x10')](_0x23c789,!![]))['catch'](loggerCatch(_0xd81b('0x11')));}exports['checkIsBlackList']=function(_0x3f2405){return BPromise[_0xd81b('0xb')]()['then'](cmHopperBlack[_0xd81b('0x12')](_0x3f2405))['catch'](loggerCatch(_0xd81b('0x13')));};exports[_0xd81b('0x14')]=function(_0x6c6041){return BPromise[_0xd81b('0xb')]()[_0xd81b('0xf')](cmHopper['getContactPreview'](_0x6c6041))[_0xd81b('0xd')](loggerCatch(_0xd81b('0x15')));};exports['createHistory']=function(_0x2abef4,_0x26df61){create(_0x2abef4)[_0xd81b('0xd')](loggerCatch(_0x26df61));moveContact(_0x2abef4)[_0xd81b('0xd')](loggerCatch(_0x26df61));};exports[_0xd81b('0x16')]=function(_0xc49b8d,_0x6746f0){createAgent(_0xc49b8d)[_0xd81b('0xd')](loggerCatch(_0x6746f0));};exports[_0xd81b('0x17')]=function(_0x285164,_0x1ff3c6){create(_0x285164)[_0xd81b('0xd')](loggerCatch(_0x1ff3c6));};exports[_0xd81b('0x18')]=function(_0x3518f0,_0x156894){moveContact(_0x3518f0)[_0xd81b('0xd')](loggerCatch(_0x156894));};exports['rescheduleContact']=function(_0x4d566e,_0xc16ad0,_0x1b7876){if(_0xc16ad0){_0x4d566e[_0xd81b('0x19')]=null;}if(_0x1b7876){_0x4d566e['active']=![];}return BPromise[_0xd81b('0xb')]()[_0xd81b('0xf')](cmHopper['rescheduleContact'](_0x4d566e))[_0xd81b('0xd')](loggerCatch(_0xd81b('0x1a')));};exports[_0xd81b('0x1b')]=function(_0x1ad65c){return BPromise[_0xd81b('0xb')]()[_0xd81b('0xf')](cmHopper[_0xd81b('0x1b')](_0x1ad65c))[_0xd81b('0xd')](loggerCatch(_0xd81b('0x1c')));};exports[_0xd81b('0x1d')]=function(_0x2ccedf){return BPromise[_0xd81b('0xb')]()['then'](cmHopper[_0xd81b('0x1d')]({'UserId':null},_0x2ccedf,0x1))[_0xd81b('0xd')](loggerCatch(_0xd81b('0x1e')));};exports[_0xd81b('0x1f')]=function(_0x3266c2){return BPromise[_0xd81b('0xb')]()[_0xd81b('0xf')](cmHopper[_0xd81b('0x1d')]({'active':![]},_0x3266c2,0x1))[_0xd81b('0xd')](loggerCatch('[activeContact]\x20'));};exports[_0xd81b('0x20')]=function(_0x4e2eff){var _0x5c8aee={};_0x5c8aee[_0xd81b('0x21')]=_0x4e2eff[_0xd81b('0x21')];_0x5c8aee['uniqueid']=_0x4e2eff['uniqueid'];_0x5c8aee[_0xd81b('0x22')]=_0x4e2eff[_0xd81b('0x22')];_0x5c8aee[_0xd81b('0x23')]=_0x4e2eff[_0xd81b('0x23')];_0x5c8aee[_0xd81b('0x24')]=_0x4e2eff[_0xd81b('0x24')];_0x5c8aee['queuecallerjoinAt']=_0x4e2eff[_0xd81b('0x25')];_0x5c8aee[_0xd81b('0x26')]=_0x4e2eff['answertime'];_0x5c8aee['queuecallercomplete']=0x1;_0x5c8aee[_0xd81b('0x27')]=_0x4e2eff[_0xd81b('0x28')];_0x5c8aee['connectedlinename']=_0x4e2eff['membername'];_0x5c8aee['context']=_0xd81b('0x29');_0x5c8aee[_0xd81b('0x2a')]=_0xd81b('0x2b');_0x5c8aee[_0xd81b('0x2c')]=0x0;_0x5c8aee[_0xd81b('0x2d')]=0x1;_0x5c8aee[_0xd81b('0x2e')]=_0x4e2eff[_0xd81b('0x2f')];_0x5c8aee['queuecallerexitreason']=_0xd81b('0x30');return BPromise['resolve']()[_0xd81b('0xf')](voiceQueueReport[_0xd81b('0x31')](_0x5c8aee))[_0xd81b('0xd')](loggerCatch(_0xd81b('0x32')));};exports[_0xd81b('0x33')]=function(_0x221e1f,_0x1c20d3){return BPromise[_0xd81b('0xb')]()[_0xd81b('0xf')](cmHopper[_0xd81b('0x33')](_0x221e1f,_0x1c20d3))[_0xd81b('0xd')](loggerCatch(_0xd81b('0x34')));};exports[_0xd81b('0x35')]=function(_0x57bc0c){return BPromise['resolve']()[_0xd81b('0xf')](cmHopper[_0xd81b('0x36')](_0x57bc0c,!![],!![]))[_0xd81b('0xd')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xb66c=['countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','createHistory','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','rescheduleContact','[rescheduleContact]\x20'];(function(_0x9ccc82,_0x27a5d1){var _0x56f356=function(_0x5cf3ac){while(--_0x5cf3ac){_0x9ccc82['push'](_0x9ccc82['shift']());}};_0x56f356(++_0x27a5d1);}(_0xb66c,0x175));var _0xcb66=function(_0x2d81e8,_0x5df02c){_0x2d81e8=_0x2d81e8-0x0;var _0x405773=_0xb66c[_0x2d81e8];return _0x405773;};'use strict';var util=require(_0xcb66('0x0'));var BPromise=require('bluebird');var logger=require(_0xcb66('0x1'))('preview');var _=require(_0xcb66('0x2'));var cmHopper=require(_0xcb66('0x3'));var cmHopperFinal=require(_0xcb66('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xcb66('0x5'));var voiceQueueRt=require(_0xcb66('0x6'));var agentReportPreview=require(_0xcb66('0x7'));var voiceQueueReport=require(_0xcb66('0x8'));function loggerCatch(_0x5d766d){return function(_0x518163){logger[_0xcb66('0x9')](_0x5d766d,util[_0xcb66('0xa')](_0x518163,{'showHidden':![],'depth':null}));};}function create(_0xa3993){return BPromise[_0xcb66('0xb')]()[_0xcb66('0xc')](cmHopperHistory['createHistory'](_0xa3993))[_0xcb66('0xd')](loggerCatch(_0xcb66('0xe')));}function createAgent(_0x174969){return BPromise[_0xcb66('0xb')]()[_0xcb66('0xc')](agentReportPreview['createHistory'](_0x174969))[_0xcb66('0xd')](loggerCatch(_0xcb66('0xe')));}function moveContact(_0xf12828){return BPromise[_0xcb66('0xb')]()['then'](cmHopper[_0xcb66('0xf')](_0xf12828,!![]))[_0xcb66('0xd')](loggerCatch(_0xcb66('0x10')));}exports[_0xcb66('0x11')]=function(_0x582523){return BPromise[_0xcb66('0xb')]()[_0xcb66('0xc')](cmHopperBlack[_0xcb66('0x11')](_0x582523))[_0xcb66('0xd')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xcb66('0x12')]=function(_0x540e7e){return BPromise[_0xcb66('0xb')]()['then'](cmHopper[_0xcb66('0x12')](_0x540e7e))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0xcb66('0x13')]=function(_0x13cfea,_0x681ce3){create(_0x13cfea)[_0xcb66('0xd')](loggerCatch(_0x681ce3));moveContact(_0x13cfea)['catch'](loggerCatch(_0x681ce3));};exports[_0xcb66('0x14')]=function(_0x42ad03,_0x8a0f3f){createAgent(_0x42ad03)['catch'](loggerCatch(_0x8a0f3f));};exports[_0xcb66('0x15')]=function(_0x496d12,_0x4165ea){create(_0x496d12)[_0xcb66('0xd')](loggerCatch(_0x4165ea));};exports[_0xcb66('0x16')]=function(_0x1ccb71,_0x540782){moveContact(_0x1ccb71)['catch'](loggerCatch(_0x540782));};exports['rescheduleContact']=function(_0xb39b87,_0x4b13d4,_0x5e07e8){if(_0x4b13d4){_0xb39b87[_0xcb66('0x17')]=null;}if(_0x5e07e8){_0xb39b87['active']=![];}return BPromise[_0xcb66('0xb')]()[_0xcb66('0xc')](cmHopper[_0xcb66('0x18')](_0xb39b87))[_0xcb66('0xd')](loggerCatch(_0xcb66('0x19')));};exports[_0xcb66('0x1a')]=function(_0x3391a0){return BPromise['resolve']()[_0xcb66('0xc')](cmHopper['countReScheduled'](_0x3391a0))['catch'](loggerCatch(_0xcb66('0x1b')));};exports[_0xcb66('0x1c')]=function(_0x19da3b){return BPromise['resolve']()[_0xcb66('0xc')](cmHopper[_0xcb66('0x1c')]({'UserId':null},_0x19da3b,0x1))[_0xcb66('0xd')](loggerCatch(_0xcb66('0x1d')));};exports['disableContact']=function(_0x6661c4){return BPromise[_0xcb66('0xb')]()[_0xcb66('0xc')](cmHopper[_0xcb66('0x1c')]({'active':![]},_0x6661c4,0x1))[_0xcb66('0xd')](loggerCatch(_0xcb66('0x1e')));};exports[_0xcb66('0x1f')]=function(_0x967710){var _0x28fc0b={};_0x28fc0b[_0xcb66('0x20')]=_0x967710['type'];_0x28fc0b[_0xcb66('0x21')]=_0x967710['uniqueid'];_0x28fc0b['calleridnum']=_0x967710['calleridnum'];_0x28fc0b[_0xcb66('0x22')]=_0x967710['calleridname'];_0x28fc0b[_0xcb66('0x23')]=_0x967710[_0xcb66('0x23')];_0x28fc0b[_0xcb66('0x24')]=_0x967710['answertime'];_0x28fc0b[_0xcb66('0x25')]=_0x967710[_0xcb66('0x26')];_0x28fc0b[_0xcb66('0x27')]=0x1;_0x28fc0b[_0xcb66('0x28')]=_0x967710[_0xcb66('0x29')];_0x28fc0b[_0xcb66('0x2a')]=_0x967710[_0xcb66('0x2b')];_0x28fc0b[_0xcb66('0x2c')]=_0xcb66('0x2d');_0x28fc0b[_0xcb66('0x2e')]='xcally-motion-preview';_0x28fc0b[_0xcb66('0x2f')]=0x0;_0x28fc0b[_0xcb66('0x30')]=0x1;_0x28fc0b[_0xcb66('0x31')]=_0x967710[_0xcb66('0x2b')];_0x28fc0b[_0xcb66('0x32')]=_0xcb66('0x33');return BPromise[_0xcb66('0xb')]()['then'](voiceQueueReport[_0xcb66('0x34')](_0x28fc0b))[_0xcb66('0xd')](loggerCatch(_0xcb66('0x35')));};exports[_0xcb66('0x36')]=function(_0x4c97b4,_0x1a9545){return BPromise[_0xcb66('0xb')]()[_0xcb66('0xc')](cmHopper[_0xcb66('0x36')](_0x4c97b4,_0x1a9545))[_0xcb66('0xd')](loggerCatch(_0xcb66('0x37')));};exports[_0xcb66('0x38')]=function(_0x108898){return BPromise[_0xcb66('0xb')]()[_0xcb66('0xc')](cmHopper[_0xcb66('0x18')](_0x108898,!![],!![]))[_0xcb66('0xd')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 24c9046..e6cc1ff 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 _0xe0cf=['xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','util','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','inspect','logger','loggerError','logger2','info','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','dialQueueProject2','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','createdAt','XMD-','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','Blacklist','responsetime','endtime','state','statedesc','ringtime','starttime','logLookAgent','UserId','logCustomer','answertime','isFailure','Failure','BOOKED','originate','channelAgent','from-sip','timeout','countcongestionretry','countnoanswerretry','cloneAction','Global','scheduledAt','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','interface','queue','uniqueid','agentReadyId','not_inuse','status','reachable','push','getDiff','seconds','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','countbusyretry','countglobal','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid'];(function(_0x48dfe6,_0x2fb221){var _0x21ec52=function(_0x46f332){while(--_0x46f332){_0x48dfe6['push'](_0x48dfe6['shift']());}};_0x21ec52(++_0x2fb221);}(_0xe0cf,0x11d));var _0xfe0c=function(_0x451130,_0x595ee2){_0x451130=_0x451130-0x0;var _0x68c08e=_0xe0cf[_0x451130];return _0x68c08e;};'use strict';var util=require(_0xfe0c('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xfe0c('0x1'))(_0xfe0c('0x2'));var ipAgi=process['env'][_0xfe0c('0x3')]||_0xfe0c('0x4');function getSeconds(_0x237b47,_0x5699f4){var _0x32d60c=moment(_0x237b47)['milliseconds'](0x0);var _0x2339a3=moment(_0x5699f4)[_0xfe0c('0x5')](0x0);return _0x32d60c[_0xfe0c('0x6')](_0x2339a3,'seconds');}exports[_0xfe0c('0x7')]=function(_0x265d74){return function(_0x2da156){logger[_0xfe0c('0x8')](_0x265d74,util[_0xfe0c('0x9')](_0x2da156,{'showHidden':![],'depth':null}));};};exports[_0xfe0c('0xa')]=function(_0x24486b,_0x3ec6d6){logger['info'](_0x24486b,util[_0xfe0c('0x9')](_0x3ec6d6,{'showHidden':![],'depth':null}));};exports[_0xfe0c('0xb')]=function(_0x209b96,_0x206f34){logger[_0xfe0c('0x8')](_0x209b96,util[_0xfe0c('0x9')](_0x206f34,{'showHidden':![],'depth':null}));};exports[_0xfe0c('0xc')]=function(_0x3c964e){return function(_0x56c538){logger[_0xfe0c('0xd')](_0x3c964e,util[_0xfe0c('0x9')](_0x56c538,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x5ae91b,_0x435c73,_0x2a1044){return{'message':_0x5ae91b,'unlock':_0x435c73,'active':_0x2a1044};};exports['getCallerId']=function(_0x561f7c,_0x56a43e,_0x39e7f9){if(!_[_0xfe0c('0xe')](_0x39e7f9)&&_0xfe0c('0xf')===typeof _0x39e7f9&&!_['isEmpty'](_0x39e7f9)){if(!_['isUndefined'](_0x56a43e)&&_0xfe0c('0xf')===typeof _0x56a43e&&!_[_0xfe0c('0x10')](_0x56a43e)){return util[_0xfe0c('0x11')](_0xfe0c('0x12'),_0x56a43e,_0x39e7f9);}return util['format'](_0xfe0c('0x12'),_0x39e7f9,_0x39e7f9);}if(!_[_0xfe0c('0xe')](_0x561f7c)&&_0xfe0c('0xf')===typeof _0x561f7c&&!_[_0xfe0c('0x10')](_0x561f7c)){return _0x561f7c;}return _0xfe0c('0x13');};exports[_0xfe0c('0x14')]=function(_0x41e4a1){if(_['isNil'](_0x41e4a1)){return![];}return _0x41e4a1;};exports[_0xfe0c('0x15')]=function(_0x37b15b,_0x2521b1,_0x1c9d0e,_0xd3b237,_0x40db03,_0x4f7e8d){var _0xadd3e7={'XMD-QUEUE':_0x2521b1[_0xfe0c('0x16')]?_0x2521b1[_0xfe0c('0x16')][_0xfe0c('0x17')]:'','XMD-CALLERID':_0xd3b237,'XMD-CALLERID-PREVIEW':_0x4f7e8d?util[_0xfe0c('0x11')](_0xfe0c('0x12'),_0x4f7e8d[_0xfe0c('0x18')],_0x4f7e8d[_0xfe0c('0x19')]):_0xd3b237,'XMD-DIALID':_0x40db03,'XMD-CONTACTID':_0x2521b1[_0xfe0c('0x1a')],'XMD-CDRTYPE':_0xfe0c('0x1b'),'CALLERID(all)':_0xd3b237,'XMD-VOICEQUEUEID':_0x2521b1[_0xfe0c('0x1c')],'XMD-DIALCHANNEL':_0x1c9d0e,'XMD-DIALTIMEOUT':_0x37b15b[_0xfe0c('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xfe0c('0x1e'),_0x37b15b['dialQueueProject2']?'g':'',_[_0xfe0c('0x10')](_0x37b15b[_0xfe0c('0x1f')])?'':_0xfe0c('0x20')),'XMD-DIALURL':_0x37b15b['dialPreviewUrl']||'','XMD-AGI':_0x37b15b['dialQueueProject']?util['format'](_0xfe0c('0x21'),ipAgi,_0x37b15b[_0xfe0c('0x22')]):_0xfe0c('0x23'),'XMD-AGIAFTER':_0x37b15b[_0xfe0c('0x24')]?util[_0xfe0c('0x11')](_0xfe0c('0x21'),ipAgi,_0x37b15b[_0xfe0c('0x24')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x4f7e8d?_0x4f7e8d['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x4f7e8d?_0x4f7e8d[_0xfe0c('0x25')]:'','XMD-DESTINATION':_0xfe0c('0x26')};if(!_['isEmpty'](_0x37b15b[_0xfe0c('0x1f')])){_0xadd3e7[util[_0xfe0c('0x11')]('%s',_0xfe0c('0x27'))]=_0x37b15b['monitor_format'];_0xadd3e7[util[_0xfe0c('0x11')]('%s',_0xfe0c('0x28'))]=_0x40db03;}if(_0x2521b1&&_0x2521b1[_0xfe0c('0x29')]){for(var _0x166bd3 in _0x2521b1[_0xfe0c('0x29')]){if(_0x2521b1['Contact'][_0xfe0c('0x2a')](_0x166bd3)){if(!_[_0xfe0c('0x2b')](_0x2521b1[_0xfe0c('0x29')][_0x166bd3])&&_0x166bd3!=='id'&&_0x166bd3!=='tags'&&_0x166bd3!==_0xfe0c('0x2c')&&_0x166bd3!=='updatedAt'){_0xadd3e7[util['format']('%s%s',_0xfe0c('0x2d'),_['toUpper'](_0x166bd3))]=_0x2521b1[_0xfe0c('0x29')][_0x166bd3];}}}}return _0xadd3e7;};exports['toLowerVariables']=function(_0x4128c4){var _0x5d7fe9={};for(var _0x39d176 in _0x4128c4){if(_0x4128c4[_0xfe0c('0x2a')](_0x39d176)){_0x5d7fe9[util[_0xfe0c('0x11')]('%s',_['toLower'](_0x39d176))]=_0x4128c4[_0x39d176];}}return{'variables':_0x5d7fe9};};exports[_0xfe0c('0x2e')]=function(_0x3131b5,_0x506e79){if(!_['isNil'](_0x3131b5)){if(_0x3131b5['hasOwnProperty'](_0xfe0c('0x2f'))){if(_0x3131b5[_0xfe0c('0x2f')]>0x0){_0x3131b5[_0xfe0c('0x2f')]-=0x1;}else{logger[_0xfe0c('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x506e79);}}}else{logger[_0xfe0c('0x8')](_0xfe0c('0x30'),_0x506e79);}};exports[_0xfe0c('0x31')]=function(_0x347bd4){var _0x2a70b0=moment()[_0xfe0c('0x11')](_0xfe0c('0x32'));_0x347bd4['state']=0xd;_0x347bd4['statedesc']=_0xfe0c('0x33');_0x347bd4['starttime']=_0x2a70b0;_0x347bd4[_0xfe0c('0x34')]=_0x2a70b0;_0x347bd4[_0xfe0c('0x35')]=_0x2a70b0;};exports['logAgent']=function(_0x3302a9,_0x4be6d3,_0x3a36b1){var _0x373d83=moment()[_0xfe0c('0x11')](_0xfe0c('0x32'));_0x3302a9[_0xfe0c('0x36')]=_0x4be6d3;_0x3302a9[_0xfe0c('0x37')]=_0x3a36b1;_0x3302a9[_0xfe0c('0x34')]=_0x373d83;_0x3302a9[_0xfe0c('0x38')]=getSeconds(_0x3302a9[_0xfe0c('0x34')],_0x3302a9[_0xfe0c('0x39')]);};exports[_0xfe0c('0x3a')]=function(_0x574a8c,_0x130f24,_0x5192d2){_0x574a8c['membername']=_0x130f24;_0x574a8c[_0xfe0c('0x3b')]=_0x5192d2;};exports[_0xfe0c('0x3c')]=function(_0x341a29,_0x36abba,_0x4663e4){var _0x196d9d=moment()[_0xfe0c('0x11')](_0xfe0c('0x32'));_0x341a29[_0xfe0c('0x36')]=_0x36abba;_0x341a29['statedesc']=_0x4663e4;_0x341a29[_0xfe0c('0x34')]=_0x341a29[_0xfe0c('0x34')]?_0x341a29[_0xfe0c('0x34')]:_0x196d9d;_0x341a29['endtime']=_0x341a29[_0xfe0c('0x35')]?_0x341a29[_0xfe0c('0x35')]:_0x196d9d;_0x341a29[_0xfe0c('0x38')]=getSeconds(_0x341a29['responsetime']||0x0,_0x341a29[_0xfe0c('0x39')]||0x0);_0x341a29['talktime']=_0x341a29[_0xfe0c('0x3d')]?getSeconds(_0x341a29[_0xfe0c('0x35')],_0x341a29[_0xfe0c('0x3d')]):0x0;};exports[_0xfe0c('0x3e')]=function(_0x1417c7){return _0x1417c7===_0xfe0c('0x3f');};exports['variablesAction']=function(_0xf9ff95,_0x333f77,_0x4934fe,_0x30f418,_0x98c02b){var _0x367df3=_0x30f418?'RECALL':_0xf9ff95[_0xfe0c('0x18')];_0x367df3=_0x98c02b?_0xfe0c('0x40'):_0x367df3;return{'actionid':_0xf9ff95['uniqueid'],'action':_0xfe0c('0x41'),'channel':_0xf9ff95[_0xfe0c('0x42')],'callerid':util[_0xfe0c('0x11')](_0xfe0c('0x12'),_0x367df3,_0xf9ff95[_0xfe0c('0x19')]),'Exten':'xcally-motion-preview','Context':_0xfe0c('0x43'),'Priority':'1','variable':_0x4934fe,'timeout':(_0x333f77[_0xfe0c('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0xf9ff95['uniqueid']};};exports['totalGlobal']=function(_0x16b466){return _0x16b466['countbusyretry']+_0x16b466[_0xfe0c('0x45')]+_0x16b466[_0xfe0c('0x46')];};exports[_0xfe0c('0x47')]=function(_0x287f5d){var _0x502386=_['clone'](_0x287f5d);_0x502386[_0xfe0c('0x36')]=0xf;_0x502386[_0xfe0c('0x37')]=_0xfe0c('0x48');return _0x502386;};exports[_0xfe0c('0x49')]=function(_0x29e219,_0x253afb,_0x54877d){var _0x2e5b06={};_0x2e5b06[_0x253afb]=_0x29e219[_0x253afb];_0x2e5b06[_0xfe0c('0x4a')]=![];_0x2e5b06['scheduledat']=moment()[_0xfe0c('0x4b')](_0x54877d,_0xfe0c('0x4c'))['format'](_0xfe0c('0x32'));_0x2e5b06[_0xfe0c('0x1a')]=_0x29e219[_0xfe0c('0x1a')];_0x2e5b06['ListId']=_0x29e219[_0xfe0c('0x4d')];_0x2e5b06[_0xfe0c('0x1c')]=_0x29e219[_0xfe0c('0x1c')]||undefined;return _0x2e5b06;};exports[_0xfe0c('0x4e')]=function(_0x4dd2de,_0x3f9949){if(!_[_0xfe0c('0x2b')](_0x4dd2de)){if(_0x4dd2de[_0xfe0c('0x4f')]>0x0){_0x4dd2de['pTalking']-=0x1;}else{logger[_0xfe0c('0x8')](_0x3f9949,_0xfe0c('0x50'));}}else{logger[_0xfe0c('0x8')](_0x3f9949,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xfe0c('0x51')]=function(_0x57fc88){if(_0x57fc88<=0x0){return!![];}return![];};exports[_0xfe0c('0x52')]=function(_0x539105,_0x5469a3){_0x539105['lastevent']=_0x5469a3;_0x539105[_0xfe0c('0x17')]=_0x539105['queue'];_0x539105[_0xfe0c('0x53')]=_0x539105[_0xfe0c('0x42')];return _0x539105;};exports['buildAcw']=function(_0x54670e){var _0x2458dd={};_0x2458dd[_0xfe0c('0x54')]=_0x54670e['queue'];_0x2458dd[_0xfe0c('0x53')]=_0x54670e[_0xfe0c('0x42')];_0x2458dd[_0xfe0c('0x55')]=_0x54670e[_0xfe0c('0x55')];return _0x2458dd;};exports[_0xfe0c('0x56')]=function(_0x541d19){var _0xf8e968=[];for(var _0x3f04ad in _0x541d19){if(_0x541d19[_0xfe0c('0x2a')](_0x3f04ad)){if(!_['isNil'](_0x541d19[_0x3f04ad])&&_0x541d19[_0x3f04ad][_0xfe0c('0x36')]===_0xfe0c('0x57')&&_0x541d19[_0x3f04ad][_0xfe0c('0x58')]===_0xfe0c('0x59')){_0xf8e968[_0xfe0c('0x5a')](_0x541d19[_0x3f04ad]['id']);}}}return _0xf8e968;};exports[_0xfe0c('0x5b')]=function(_0x21254a){var _0x3b6c9c=moment()['milliseconds'](0x0);var _0x15c894=moment(_0x21254a)['milliseconds'](0x0);return _0x3b6c9c[_0xfe0c('0x6')](_0x15c894,_0xfe0c('0x5c'));};exports['createBody']=function(_0x4c3e03){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4c3e03[_0xfe0c('0x1a')],'ListId':_0x4c3e03[_0xfe0c('0x4d')],'VoiceQueueId':_0x4c3e03[_0xfe0c('0x1c')]||undefined,'CampaignId':_0x4c3e03[_0xfe0c('0x5d')]||undefined};};exports[_0xfe0c('0x5e')]=function(_0x336508){if(_0x336508===_0xfe0c('0x55')||_0x336508===_0xfe0c('0x5f')||_0x336508===_0xfe0c('0x54')||_0x336508===_0xfe0c('0x60')||_0x336508===_0xfe0c('0x61')||_0x336508===_0xfe0c('0x62')||_0x336508===_0xfe0c('0x63')||_0x336508===_0xfe0c('0x42')||_0x336508===_0xfe0c('0x18')||_0x336508===_0xfe0c('0x4a')||_0x336508===_0xfe0c('0x19')||_0x336508==='scheduledat'||_0x336508===_0xfe0c('0x64')||_0x336508==='countcongestionretry'||_0x336508==='countnoanswerretry'||_0x336508===_0xfe0c('0x65')||_0x336508===_0xfe0c('0x66')||_0x336508==='callbackuniqueid'||_0x336508===_0xfe0c('0x67')||_0x336508===_0xfe0c('0x68')||_0x336508===_0xfe0c('0x1a')||_0x336508===_0xfe0c('0x4d')||_0x336508===_0xfe0c('0x3b')||_0x336508===_0xfe0c('0x1c')||_0x336508===_0xfe0c('0x69')||_0x336508===_0xfe0c('0x6a')||_0x336508===_0xfe0c('0x6b')||_0x336508===_0xfe0c('0x6c')||_0x336508==='xmd-listid'||_0x336508===_0xfe0c('0x6d')||_0x336508===_0xfe0c('0x6e')||_0x336508===_0xfe0c('0x6f')||_0x336508==='xmd-dialid'||_0x336508===_0xfe0c('0x70')||_0x336508===_0xfe0c('0x71')||_0x336508==='xmd-cdrtype'||_0x336508===_0xfe0c('0x72')||_0x336508===_0xfe0c('0x73')||_0x336508===_0xfe0c('0x74')||_0x336508===_0xfe0c('0x75')||_0x336508===_0xfe0c('0x76')||_0x336508===_0xfe0c('0x77')||_0x336508==='rtpaudioqosjitterbridged'||_0x336508===_0xfe0c('0x78')||_0x336508===_0xfe0c('0x79')||_0x336508===_0xfe0c('0x7a')||_0x336508===_0xfe0c('0x7b')||_0x336508===_0xfe0c('0x75')||_0x336508==='rtpaudioqosbridged'||_0x336508===_0xfe0c('0x77')||_0x336508===_0xfe0c('0x7c')||_0x336508===_0xfe0c('0x78')||_0x336508===_0xfe0c('0x79')||_0x336508===_0xfe0c('0x7a')||_0x336508===_0xfe0c('0x7b')||_0x336508===_0xfe0c('0x7d')||_0x336508==='bridgepvtcallid'||_0x336508===_0xfe0c('0x36')||_0x336508==='statedesc'){return![];}return!![];};exports[_0xfe0c('0x7e')]=function(_0x24617d,_0x5974e6){var _0x88fd75,_0x212b9a,_0xab32e1;if(_0x5974e6<=0x0){_0x5974e6=0x1;}_0x88fd75=new RegExp(_0xfe0c('0x7f')+_0x5974e6+'}$');_0x212b9a=Math[_0xfe0c('0x80')](0xa,_0x5974e6-0x1);_0xab32e1=Math[_0xfe0c('0x80')](0xa,_0x5974e6)-0x1;return util['format']('%s',_[_0xfe0c('0x81')](_0x24617d,_0x88fd75,_['random'](_0x212b9a,_0xab32e1)));};exports[_0xfe0c('0x82')]=function(_0x4ace8a){var _0x1ec6fe=_0x4ace8a[_0xfe0c('0x83')](/"(.*?)"/);return _0x1ec6fe?_0x1ec6fe[0x1]:_0x4ace8a;};exports[_0xfe0c('0x84')]=function(_0x147bfd){var _0x10e3fe=_0x147bfd[_0xfe0c('0x83')](/<(.*?)>/);return _0x10e3fe?_0x10e3fe[0x1]:_0x147bfd;}; \ No newline at end of file +var _0x16c1=['dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','starttime','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','variablesAction','calleridname','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','Global','scheduledAt','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','IsNotLoggedIn','buildObj','lastevent','queue','agentReadyId','status','reachable','createBody','CampaignId','type','campaigntype','active','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x16c1,0x66));var _0x116c=function(_0x137aae,_0xd4185a){_0x137aae=_0x137aae-0x0;var _0xc48637=_0x16c1[_0x137aae];return _0xc48637;};'use strict';var util=require(_0x116c('0x0'));var _=require(_0x116c('0x1'));var moment=require(_0x116c('0x2'));var logger=require(_0x116c('0x3'))(_0x116c('0x4'));var ipAgi=process[_0x116c('0x5')][_0x116c('0x6')]||_0x116c('0x7');function getSeconds(_0xa9cb5c,_0x544597){var _0x4587bd=moment(_0xa9cb5c)['milliseconds'](0x0);var _0x380345=moment(_0x544597)[_0x116c('0x8')](0x0);return _0x4587bd[_0x116c('0x9')](_0x380345,_0x116c('0xa'));}exports[_0x116c('0xb')]=function(_0x1500ba){return function(_0x588925){logger[_0x116c('0xc')](_0x1500ba,util[_0x116c('0xd')](_0x588925,{'showHidden':![],'depth':null}));};};exports[_0x116c('0xe')]=function(_0x284d25,_0x1b664c){logger[_0x116c('0xf')](_0x284d25,util['inspect'](_0x1b664c,{'showHidden':![],'depth':null}));};exports[_0x116c('0x10')]=function(_0x129aca,_0x159500){logger[_0x116c('0xc')](_0x129aca,util[_0x116c('0xd')](_0x159500,{'showHidden':![],'depth':null}));};exports[_0x116c('0x11')]=function(_0x14f8ef){return function(_0x728dc2){logger[_0x116c('0xf')](_0x14f8ef,util['inspect'](_0x728dc2,{'showHidden':![],'depth':null}));};};exports[_0x116c('0x12')]=function(_0x330f51,_0x4af1a8,_0x452a94){return{'message':_0x330f51,'unlock':_0x4af1a8,'active':_0x452a94};};exports['getCallerId']=function(_0x2da2d7,_0x1a4646,_0x22c1f9){if(!_[_0x116c('0x13')](_0x22c1f9)&&_0x116c('0x14')===typeof _0x22c1f9&&!_[_0x116c('0x15')](_0x22c1f9)){if(!_['isUndefined'](_0x1a4646)&&'string'===typeof _0x1a4646&&!_[_0x116c('0x15')](_0x1a4646)){return util[_0x116c('0x16')](_0x116c('0x17'),_0x1a4646,_0x22c1f9);}return util[_0x116c('0x16')](_0x116c('0x17'),_0x22c1f9,_0x22c1f9);}if(!_[_0x116c('0x13')](_0x2da2d7)&&'string'===typeof _0x2da2d7&&!_[_0x116c('0x15')](_0x2da2d7)){return _0x2da2d7;}return _0x116c('0x18');};exports[_0x116c('0x19')]=function(_0x4355ad){if(_[_0x116c('0x1a')](_0x4355ad)){return![];}return _0x4355ad;};exports[_0x116c('0x1b')]=function(_0x320bdc,_0x47315b,_0x53110e,_0x1ff2b8,_0x5a35b5,_0x11ea50){var _0x3b7f9e={'XMD-QUEUE':_0x47315b['Queue']?_0x47315b[_0x116c('0x1c')][_0x116c('0x1d')]:'','XMD-CALLERID':_0x1ff2b8,'XMD-CALLERID-PREVIEW':_0x11ea50?util['format'](_0x116c('0x17'),_0x11ea50['calleridname'],_0x11ea50[_0x116c('0x1e')]):_0x1ff2b8,'XMD-DIALID':_0x5a35b5,'XMD-CONTACTID':_0x47315b['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1ff2b8,'XMD-VOICEQUEUEID':_0x47315b[_0x116c('0x1f')],'XMD-DIALCHANNEL':_0x53110e,'XMD-DIALTIMEOUT':_0x320bdc['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x116c('0x16')](_0x116c('0x20'),_0x320bdc[_0x116c('0x21')]?'g':'',_[_0x116c('0x15')](_0x320bdc['monitor_format'])?'':_0x116c('0x22')),'XMD-DIALURL':_0x320bdc[_0x116c('0x23')]||'','XMD-AGI':_0x320bdc[_0x116c('0x24')]?util[_0x116c('0x16')](_0x116c('0x25'),ipAgi,_0x320bdc[_0x116c('0x24')]):'NONE','XMD-AGIAFTER':_0x320bdc['dialQueueProject2']?util[_0x116c('0x16')](_0x116c('0x25'),ipAgi,_0x320bdc[_0x116c('0x21')]):_0x116c('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x11ea50?_0x11ea50[_0x116c('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x11ea50?_0x11ea50[_0x116c('0x28')]:'','XMD-DESTINATION':_0x116c('0x29')};if(!_[_0x116c('0x15')](_0x320bdc[_0x116c('0x2a')])){_0x3b7f9e[util[_0x116c('0x16')]('%s',_0x116c('0x2b'))]=_0x320bdc[_0x116c('0x2a')];_0x3b7f9e[util[_0x116c('0x16')]('%s',_0x116c('0x2c'))]=_0x5a35b5;}if(_0x47315b&&_0x47315b[_0x116c('0x2d')]){for(var _0x2d4621 in _0x47315b[_0x116c('0x2d')]){if(_0x47315b[_0x116c('0x2d')][_0x116c('0x2e')](_0x2d4621)){if(!_[_0x116c('0x1a')](_0x47315b[_0x116c('0x2d')][_0x2d4621])&&_0x2d4621!=='id'&&_0x2d4621!==_0x116c('0x2f')&&_0x2d4621!==_0x116c('0x30')&&_0x2d4621!==_0x116c('0x31')){_0x3b7f9e[util['format'](_0x116c('0x32'),'XMD-',_[_0x116c('0x33')](_0x2d4621))]=_0x47315b[_0x116c('0x2d')][_0x2d4621];}}}}return _0x3b7f9e;};exports['toLowerVariables']=function(_0x21a274){var _0x2854bb={};for(var _0x48268d in _0x21a274){if(_0x21a274['hasOwnProperty'](_0x48268d)){_0x2854bb[util[_0x116c('0x16')]('%s',_[_0x116c('0x34')](_0x48268d))]=_0x21a274[_0x48268d];}}return{'variables':_0x2854bb};};exports[_0x116c('0x35')]=function(_0x33ba1c,_0x368c6e){if(!_[_0x116c('0x1a')](_0x33ba1c)){if(_0x33ba1c[_0x116c('0x2e')]('originated')){if(_0x33ba1c[_0x116c('0x36')]>0x0){_0x33ba1c[_0x116c('0x36')]-=0x1;}else{logger[_0x116c('0xc')](_0x116c('0x37'),_0x368c6e);}}}else{logger[_0x116c('0xc')](_0x116c('0x38'),_0x368c6e);}};exports[_0x116c('0x39')]=function(_0x22c853){var _0x4fb7a5=moment()[_0x116c('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x22c853[_0x116c('0x3a')]=0xd;_0x22c853[_0x116c('0x3b')]=_0x116c('0x3c');_0x22c853['starttime']=_0x4fb7a5;_0x22c853[_0x116c('0x3d')]=_0x4fb7a5;_0x22c853[_0x116c('0x3e')]=_0x4fb7a5;};exports[_0x116c('0x3f')]=function(_0x3aaa5d,_0x4e4e72,_0x5eaadc){var _0x1b6189=moment()[_0x116c('0x16')](_0x116c('0x40'));_0x3aaa5d['state']=_0x4e4e72;_0x3aaa5d[_0x116c('0x3b')]=_0x5eaadc;_0x3aaa5d['responsetime']=_0x1b6189;_0x3aaa5d['ringtime']=getSeconds(_0x3aaa5d['responsetime'],_0x3aaa5d[_0x116c('0x41')]);};exports[_0x116c('0x42')]=function(_0x476f5d,_0x3de0c4,_0x219562){_0x476f5d['membername']=_0x3de0c4;_0x476f5d[_0x116c('0x43')]=_0x219562;};exports[_0x116c('0x44')]=function(_0xb454c5,_0x419bdb,_0x194eb3){var _0x146043=moment()[_0x116c('0x16')](_0x116c('0x40'));_0xb454c5[_0x116c('0x3a')]=_0x419bdb;_0xb454c5[_0x116c('0x3b')]=_0x194eb3;_0xb454c5[_0x116c('0x3d')]=_0xb454c5[_0x116c('0x3d')]?_0xb454c5[_0x116c('0x3d')]:_0x146043;_0xb454c5[_0x116c('0x3e')]=_0xb454c5[_0x116c('0x3e')]?_0xb454c5[_0x116c('0x3e')]:_0x146043;_0xb454c5['ringtime']=getSeconds(_0xb454c5[_0x116c('0x3d')]||0x0,_0xb454c5[_0x116c('0x41')]||0x0);_0xb454c5[_0x116c('0x45')]=_0xb454c5['answertime']?getSeconds(_0xb454c5['endtime'],_0xb454c5[_0x116c('0x46')]):0x0;};exports[_0x116c('0x47')]=function(_0x198fd0){return _0x198fd0==='Failure';};exports[_0x116c('0x48')]=function(_0x297733,_0x58bd88,_0x3ae1a0,_0x4394ea,_0x4e48e6){var _0x1416b7=_0x4394ea?'RECALL':_0x297733[_0x116c('0x49')];_0x1416b7=_0x4e48e6?_0x116c('0x4a'):_0x1416b7;return{'actionid':_0x297733[_0x116c('0x4b')],'action':_0x116c('0x4c'),'channel':_0x297733[_0x116c('0x4d')],'callerid':util['format'](_0x116c('0x17'),_0x1416b7,_0x297733[_0x116c('0x1e')]),'Exten':_0x116c('0x29'),'Context':_0x116c('0x4e'),'Priority':'1','variable':_0x3ae1a0,'timeout':(_0x58bd88['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x297733[_0x116c('0x4b')]};};exports[_0x116c('0x4f')]=function(_0x217997){return _0x217997[_0x116c('0x50')]+_0x217997[_0x116c('0x51')]+_0x217997[_0x116c('0x52')];};exports[_0x116c('0x53')]=function(_0x264b04){var _0x5d3954=_['clone'](_0x264b04);_0x5d3954['state']=0xf;_0x5d3954[_0x116c('0x3b')]=_0x116c('0x54');return _0x5d3954;};exports[_0x116c('0x55')]=function(_0x4071fd,_0x166e5a,_0x229d43){var _0x3c4bbc={};_0x3c4bbc[_0x166e5a]=_0x4071fd[_0x166e5a];_0x3c4bbc['active']=![];_0x3c4bbc[_0x116c('0x56')]=moment()[_0x116c('0x57')](_0x229d43,_0x116c('0x58'))[_0x116c('0x16')](_0x116c('0x40'));_0x3c4bbc[_0x116c('0x59')]=_0x4071fd[_0x116c('0x59')];_0x3c4bbc[_0x116c('0x5a')]=_0x4071fd[_0x116c('0x5a')];_0x3c4bbc[_0x116c('0x1f')]=_0x4071fd['VoiceQueueId']||undefined;return _0x3c4bbc;};exports[_0x116c('0x5b')]=function(_0x105856,_0x551fdc){if(!_[_0x116c('0x1a')](_0x105856)){if(_0x105856['pTalking']>0x0){_0x105856[_0x116c('0x5c')]-=0x1;}else{logger[_0x116c('0xc')](_0x551fdc,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x551fdc,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x116c('0x5d')]=function(_0x448402){if(_0x448402<=0x0){return!![];}return![];};exports[_0x116c('0x5e')]=function(_0x2e187d,_0x5dd6d9){_0x2e187d[_0x116c('0x5f')]=_0x5dd6d9;_0x2e187d[_0x116c('0x1d')]=_0x2e187d[_0x116c('0x60')];_0x2e187d['interface']=_0x2e187d[_0x116c('0x4d')];return _0x2e187d;};exports['buildAcw']=function(_0x3bcd23){var _0x34d12e={};_0x34d12e[_0x116c('0x60')]=_0x3bcd23[_0x116c('0x60')];_0x34d12e['interface']=_0x3bcd23[_0x116c('0x4d')];_0x34d12e[_0x116c('0x4b')]=_0x3bcd23['uniqueid'];return _0x34d12e;};exports[_0x116c('0x61')]=function(_0x29096f){var _0x27276f=[];for(var _0x2a82af in _0x29096f){if(_0x29096f[_0x116c('0x2e')](_0x2a82af)){if(!_[_0x116c('0x1a')](_0x29096f[_0x2a82af])&&_0x29096f[_0x2a82af][_0x116c('0x3a')]==='not_inuse'&&_0x29096f[_0x2a82af][_0x116c('0x62')]===_0x116c('0x63')){_0x27276f['push'](_0x29096f[_0x2a82af]['id']);}}}return _0x27276f;};exports['getDiff']=function(_0x313fd2){var _0x579461=moment()[_0x116c('0x8')](0x0);var _0x24b52a=moment(_0x313fd2)[_0x116c('0x8')](0x0);return _0x579461[_0x116c('0x9')](_0x24b52a,_0x116c('0xa'));};exports[_0x116c('0x64')]=function(_0x220713){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x220713['ContactId'],'ListId':_0x220713[_0x116c('0x5a')],'VoiceQueueId':_0x220713[_0x116c('0x1f')]||undefined,'CampaignId':_0x220713[_0x116c('0x65')]||undefined};};exports['filterKey']=function(_0x20b54d){if(_0x20b54d==='uniqueid'||_0x20b54d==='idContact'||_0x20b54d===_0x116c('0x60')||_0x20b54d===_0x116c('0x66')||_0x20b54d===_0x116c('0x67')||_0x20b54d==='dialAnswer'||_0x20b54d==='membername'||_0x20b54d===_0x116c('0x4d')||_0x20b54d===_0x116c('0x49')||_0x20b54d===_0x116c('0x68')||_0x20b54d===_0x116c('0x1e')||_0x20b54d===_0x116c('0x56')||_0x20b54d===_0x116c('0x50')||_0x20b54d===_0x116c('0x51')||_0x20b54d===_0x116c('0x52')||_0x20b54d===_0x116c('0x69')||_0x20b54d===_0x116c('0x6a')||_0x20b54d===_0x116c('0x6b')||_0x20b54d===_0x116c('0x6c')||_0x20b54d===_0x116c('0x6d')||_0x20b54d===_0x116c('0x59')||_0x20b54d===_0x116c('0x5a')||_0x20b54d==='UserId'||_0x20b54d===_0x116c('0x1f')||_0x20b54d==='sipcallid'||_0x20b54d===_0x116c('0x6e')||_0x20b54d===_0x116c('0x6f')||_0x20b54d===_0x116c('0x70')||_0x20b54d===_0x116c('0x71')||_0x20b54d===_0x116c('0x72')||_0x20b54d==='xmd-dialtimeout'||_0x20b54d===_0x116c('0x73')||_0x20b54d===_0x116c('0x74')||_0x20b54d==='xmd-dialchannel'||_0x20b54d===_0x116c('0x75')||_0x20b54d===_0x116c('0x76')||_0x20b54d===_0x116c('0x77')||_0x20b54d===_0x116c('0x78')||_0x20b54d===_0x116c('0x79')||_0x20b54d===_0x116c('0x7a')||_0x20b54d==='rtpaudioqosbridged'||_0x20b54d==='rtpaudioqosjitter'||_0x20b54d==='rtpaudioqosjitterbridged'||_0x20b54d===_0x116c('0x7b')||_0x20b54d===_0x116c('0x7c')||_0x20b54d==='rtpaudioqosrtt'||_0x20b54d===_0x116c('0x7d')||_0x20b54d===_0x116c('0x7a')||_0x20b54d==='rtpaudioqosbridged'||_0x20b54d===_0x116c('0x7e')||_0x20b54d===_0x116c('0x7f')||_0x20b54d===_0x116c('0x7b')||_0x20b54d===_0x116c('0x7c')||_0x20b54d===_0x116c('0x80')||_0x20b54d===_0x116c('0x7d')||_0x20b54d==='bridgepeer'||_0x20b54d===_0x116c('0x81')||_0x20b54d===_0x116c('0x3a')||_0x20b54d==='statedesc'){return![];}return!![];};exports[_0x116c('0x82')]=function(_0x3b266d,_0x1cf180){var _0x4ca088,_0x50139e,_0x6c38c3;if(_0x1cf180<=0x0){_0x1cf180=0x1;}_0x4ca088=new RegExp('\x5cw{0,'+_0x1cf180+'}$');_0x50139e=Math[_0x116c('0x83')](0xa,_0x1cf180-0x1);_0x6c38c3=Math[_0x116c('0x83')](0xa,_0x1cf180)-0x1;return util[_0x116c('0x16')]('%s',_[_0x116c('0x84')](_0x3b266d,_0x4ca088,_[_0x116c('0x85')](_0x50139e,_0x6c38c3)));};exports[_0x116c('0x86')]=function(_0x4e75e5){var _0x2a6019=_0x4e75e5['match'](/"(.*?)"/);return _0x2a6019?_0x2a6019[0x1]:_0x4e75e5;};exports[_0x116c('0x87')]=function(_0x5941e9){var _0x4ba1b4=_0x5941e9[_0x116c('0x88')](/<(.*?)>/);return _0x4ba1b4?_0x4ba1b4[0x1]:_0x5941e9;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 89bef8c..f7b0f97 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(_0x5ad55a,_0x29f7f2){var _0x3c0c91=function(_0x2fd081){while(--_0x2fd081){_0x5ad55a['push'](_0x5ad55a['shift']());}};_0x3c0c91(++_0x29f7f2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x125bd4,_0x129efa){_0x125bd4=_0x125bd4-0x0;var _0x2ca659=_0x5f2f[_0x125bd4];return _0x2ca659;};'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(_0x4f4772,_0xc87003){var _0x406b2d=function(_0x1c298d){while(--_0x1c298d){_0x4f4772['push'](_0x4f4772['shift']());}};_0x406b2d(++_0xc87003);}(_0xb10b,0x12a));var _0xbb10=function(_0x568b73,_0x403347){_0x568b73=_0x568b73-0x0;var _0x2ff268=_0xb10b[_0x568b73];return _0x2ff268;};'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 45e918f..71a7f0a 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 _0xa54c=['outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','prototype','length','isNil','SIP/%s','mergeFromDatabase','initTelephones','telephones','initTrunks','isUndefined','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','diff','queuecallerjoinAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','queuecallercompleteAt','outbound','disposition','duration','billableseconds','initCampaigns','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','voiceQueues','triggers','campaigns','templates','voiceExtensions','outboundChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','outboundBusyCallsDay'];(function(_0x23766a,_0x418cf0){var _0x5b9ec7=function(_0x4d6c17){while(--_0x4d6c17){_0x23766a['push'](_0x23766a['shift']());}};_0x5b9ec7(++_0x418cf0);}(_0xa54c,0x9e));var _0xca54=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0xa54c[_0x4914e2];return _0x2dcd07;};'use strict';var BPromise=require(_0xca54('0x0'));var util=require(_0xca54('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0xca54('0x2'));var VoiceQueue=require(_0xca54('0x3'));var Trigger=require(_0xca54('0x4'));var Template=require('../model/template');var Campaign=require(_0xca54('0x5'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xca54('0x6'));var SalesforceAccount=require(_0xca54('0x7'));var FreshdeskAccount=require(_0xca54('0x8'));var SugarcrmAccount=require(_0xca54('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xca54('0xa'));var ServicenowAccount=require(_0xca54('0xb'));var Dynamics365Account=require(_0xca54('0xc'));var FreshsalesAccount=require(_0xca54('0xd'));var FaxAccount=require(_0xca54('0xe'));var Realtime=function(){this[_0xca54('0xf')]={};this['telephones']={};this[_0xca54('0x10')]={};this[_0xca54('0x11')]={};this[_0xca54('0x12')]={};this[_0xca54('0x13')]={};this[_0xca54('0x14')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xca54('0x15')]={};this['channels']={};this['queueChannels']={};this[_0xca54('0x16')]={};this['timers']={};this[_0xca54('0x17')]={};this[_0xca54('0x18')]={};this[_0xca54('0x19')]={};this[_0xca54('0x1a')]={};this[_0xca54('0x1b')]={};this[_0xca54('0x1c')]={};this[_0xca54('0x1d')]={};this[_0xca54('0x1e')]={};this['dynamics365Accounts']={};this[_0xca54('0x1f')]={};this[_0xca54('0x20')]={};};function freeIsNotKey(_0x1da536,_0xca069c,_0x477f62){var _0x80fba4=_[_0xca54('0x21')](_0x1da536,function(_0x8015d9,_0x26cb4f){return _0x8015d9[_0x477f62];});for(var _0x2fefaf in _0xca069c){if(_0xca069c[_0xca54('0x22')](_0x2fefaf)){if(!_0x80fba4[_0x2fefaf]){delete _0xca069c[_0x2fefaf];}}}}function freeIsNotKeySip(_0x393a2a,_0x314714){var _0x3bb9c3=_[_0xca54('0x21')](_0x393a2a,function(_0x3f7afd,_0x30e033){return util[_0xca54('0x23')]('SIP/%s',_0x3f7afd[_0xca54('0x24')]);});for(var _0x5f3b51 in _0x314714){if(_0x314714['hasOwnProperty'](_0x5f3b51)){if(!_0x3bb9c3[_0x5f3b51]){delete _0x314714[_0x5f3b51];}}}}function freeIsNotKeyAgent(_0x519fbe,_0x348872){var _0x1a81ae=_[_0xca54('0x21')](_0x519fbe,function(_0x2430ec,_0x4e9e4d){var _0x24f1a=_['isNil'](_0x2430ec[_0xca54('0x25')])?util[_0xca54('0x23')]('SIP/%s',_0x2430ec[_0xca54('0x24')]):_0x2430ec['interface'];return _0x24f1a;});for(var _0x389e6e in _0x348872){if(_0x348872[_0xca54('0x22')](_0x389e6e)){if(!_0x1a81ae[_0x389e6e]){delete _0x348872[_0x389e6e];}}}}function clearVoiceCallReports(_0x454fe2){_0x454fe2[_0xca54('0x26')]=0x0;_0x454fe2[_0xca54('0x27')]=0x0;_0x454fe2[_0xca54('0x28')]=0x0;_0x454fe2[_0xca54('0x29')]=0x0;_0x454fe2[_0xca54('0x2a')]=0x0;}function clearCampaigns(_0x1601fc){if(!_[_0xca54('0x2b')](_0x1601fc)){for(var _0x4e4e6c in _0x1601fc){if(_0x1601fc['hasOwnProperty'](_0x4e4e6c)){_0x1601fc[_0x4e4e6c][_0xca54('0x2c')]=0x0;_0x1601fc[_0x4e4e6c][_0xca54('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x350e47){if(!_[_0xca54('0x2b')](_0x350e47)){for(var _0x40743b in _0x350e47){if(_0x350e47[_0xca54('0x22')](_0x40743b)){_0x350e47[_0x40743b][_0xca54('0x26')]=0x0;_0x350e47[_0x40743b][_0xca54('0x27')]=0x0;_0x350e47[_0x40743b]['unmanaged']=0x0;_0x350e47[_0x40743b][_0xca54('0x2e')]=0x0;_0x350e47[_0x40743b][_0xca54('0x28')]=0x0;_0x350e47[_0x40743b][_0xca54('0x29')]=0x0;_0x350e47[_0x40743b][_0xca54('0x2a')]=0x0;_0x350e47[_0x40743b]['outboundAnswerAgiCallsDay']=0x0;_0x350e47[_0x40743b]['outboundNoAnswerCallsDay']=0x0;_0x350e47[_0x40743b][_0xca54('0x2f')]=0x0;_0x350e47[_0x40743b][_0xca54('0x30')]=0x0;_0x350e47[_0x40743b][_0xca54('0x31')]=0x0;_0x350e47[_0x40743b][_0xca54('0x32')]=0x0;_0x350e47[_0x40743b][_0xca54('0x33')]=0x0;_0x350e47[_0x40743b][_0xca54('0x34')]=0x0;_0x350e47[_0x40743b][_0xca54('0x35')]=0x0;_0x350e47[_0x40743b][_0xca54('0x36')]=0x0;_0x350e47[_0x40743b][_0xca54('0x37')]=0x0;_0x350e47[_0x40743b][_0xca54('0x38')]=0x0;_0x350e47[_0x40743b][_0xca54('0x39')]=0x0;_0x350e47[_0x40743b][_0xca54('0x3a')]=0x0;_0x350e47[_0x40743b]['queueStatusComplete']=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x2cb177,_0x3a7d7e){for(var _0x32bbc8 in _0x3a7d7e){if(_0x2cb177[_0xca54('0x22')](_0x32bbc8)){_0x2cb177[_0x32bbc8]=_0x3a7d7e[_0x32bbc8];}}};Realtime[_0xca54('0x3b')]['initAgents']=function(){var _0x2ca72b=this;return function(_0x13463f){if(_0x13463f){freeIsNotKeyAgent(_0x13463f,_0x2ca72b['agents']);for(var _0x4cb1ca=0x0,_0x22267f={},_0x3dd03e={};_0x4cb1ca<_0x13463f[_0xca54('0x3c')];_0x4cb1ca+=0x1){_0x22267f=_0x13463f[_0x4cb1ca];var _0x3f9b4b=_[_0xca54('0x3d')](_0x22267f['interface'])?util[_0xca54('0x23')](_0xca54('0x3e'),_0x22267f['name']):_0x22267f['interface'];if(_['isUndefined'](_0x2ca72b['agents'][_0x3f9b4b])){_0x2ca72b[_0xca54('0xf')][_0x3f9b4b]=new Agent(_0x22267f);}else{_0x2ca72b[_0xca54('0x3f')](_0x2ca72b[_0xca54('0xf')][_0x3f9b4b],_0x22267f);}}}return _0x2ca72b[_0xca54('0xf')];};};Realtime[_0xca54('0x3b')][_0xca54('0x40')]=function(){var _0x5300ff=this;return function(_0x3af3ed){if(_0x3af3ed){freeIsNotKeySip(_0x3af3ed,_0x5300ff[_0xca54('0x41')]);for(var _0x31b0e7=0x0,_0x542489={},_0x5e49ff={};_0x31b0e7<_0x3af3ed[_0xca54('0x3c')];_0x31b0e7+=0x1){_0x542489=_0x3af3ed[_0x31b0e7];if(_['isUndefined'](_0x5300ff[_0xca54('0x41')][util[_0xca54('0x23')](_0xca54('0x3e'),_0x542489['name'])])){_0x5300ff[_0xca54('0x41')][util[_0xca54('0x23')](_0xca54('0x3e'),_0x542489[_0xca54('0x24')])]=new Telephone(_0x542489);}else{_0x5300ff[_0xca54('0x3f')](_0x5300ff[_0xca54('0x41')][util[_0xca54('0x23')](_0xca54('0x3e'),_0x542489[_0xca54('0x24')])],_0x542489);}}}return _0x5300ff[_0xca54('0x41')];};};Realtime[_0xca54('0x3b')][_0xca54('0x42')]=function(){var _0x434bf7=this;return function(_0x385a44){if(_0x385a44){freeIsNotKeySip(_0x385a44,_0x434bf7['trunks']);for(var _0x1c3b48=0x0,_0x3f7535={},_0x24ca98={};_0x1c3b48<_0x385a44[_0xca54('0x3c')];_0x1c3b48+=0x1){_0x3f7535=_0x385a44[_0x1c3b48];if(_[_0xca54('0x43')](_0x434bf7[_0xca54('0x10')][util[_0xca54('0x23')](_0xca54('0x3e'),_0x3f7535[_0xca54('0x24')])])){_0x434bf7['trunks'][util['format']('SIP/%s',_0x3f7535[_0xca54('0x24')])]=new Trunk(_0x3f7535);}else{_0x434bf7[_0xca54('0x3f')](_0x434bf7['trunks'][util[_0xca54('0x23')]('SIP/%s',_0x3f7535[_0xca54('0x24')])],_0x3f7535);}}}return _0x434bf7[_0xca54('0x10')];};};Realtime['prototype'][_0xca54('0x44')]=function(){var _0x17a717=this;return function(_0xb70326){if(_0xb70326){freeIsNotKey(_0xb70326,_0x17a717[_0xca54('0x11')],_0xca54('0x24'));for(var _0x6dcf1b=0x0,_0x50d171={},_0x1235d9={};_0x6dcf1b<_0xb70326['length'];_0x6dcf1b+=0x1){_0x50d171=_0xb70326[_0x6dcf1b];if(_[_0xca54('0x43')](_0x17a717[_0xca54('0x11')][_0x50d171[_0xca54('0x24')]])){_0x17a717[_0xca54('0x11')][_0x50d171['name']]=new VoiceQueue(_0x50d171);}else{_0x17a717[_0xca54('0x3f')](_0x17a717[_0xca54('0x11')][_0x50d171[_0xca54('0x24')]],_0x50d171);}}}return _0x17a717[_0xca54('0x11')];};};Realtime[_0xca54('0x3b')][_0xca54('0x45')]=function(){var _0x1f3f02=this;return function(_0x4f88df){if(_0x4f88df){freeIsNotKey(_0x4f88df,_0x1f3f02[_0xca54('0x12')],'id');for(var _0x17b6cc=0x0,_0xb1486e={},_0x543e73={};_0x17b6cc<_0x4f88df[_0xca54('0x3c')];_0x17b6cc+=0x1){_0xb1486e=_0x4f88df[_0x17b6cc];if(_[_0xca54('0x43')](_0x1f3f02[_0xca54('0x12')][_0xb1486e['id']])){_0x1f3f02[_0xca54('0x12')][_0xb1486e['id']]=new Trigger(_0xb1486e);}else{_0x1f3f02[_0xca54('0x3f')](_0x1f3f02[_0xca54('0x12')][_0xb1486e['id']],_0xb1486e);}}}return _0x1f3f02[_0xca54('0x12')];};};Realtime[_0xca54('0x3b')][_0xca54('0x46')]=function(){var _0x5e398c=this;return function(_0x297379){if(_0x297379){freeIsNotKey(_0x297379,_0x5e398c[_0xca54('0x14')],'id');for(var _0x218385=0x0,_0x43be0c={},_0x1c99ba={};_0x218385<_0x297379['length'];_0x218385+=0x1){_0x43be0c=_0x297379[_0x218385];if(_['isUndefined'](_0x5e398c['templates'][_0x43be0c['id']])){_0x5e398c['templates'][_0x43be0c['id']]=new Template(_0x43be0c);}else{_0x5e398c[_0xca54('0x3f')](_0x5e398c[_0xca54('0x14')][_0x43be0c['id']],_0x43be0c);}}}return _0x5e398c['templates'];};};Realtime['prototype'][_0xca54('0x47')]=function(){var _0x23d18f=this;return function(_0x23fa14){if(_0x23fa14){freeIsNotKey(_0x23fa14,_0x23d18f[_0xca54('0x17')],'id');for(var _0x4d6813=0x0,_0x3383d1={},_0x26a161={};_0x4d6813<_0x23fa14['length'];_0x4d6813+=0x1){_0x3383d1=_0x23fa14[_0x4d6813];if(_['isUndefined'](_0x23d18f[_0xca54('0x17')][_0x3383d1['id']])){_0x23d18f[_0xca54('0x17')][_0x3383d1['id']]=new ZendeskAccount(_0x3383d1);}else{_0x23d18f[_0xca54('0x3f')](_0x23d18f[_0xca54('0x17')][_0x3383d1['id']],_0x3383d1);}}}return _0x23d18f[_0xca54('0x17')];};};Realtime[_0xca54('0x3b')]['initSalesforceAccounts']=function(){var _0x30d4f8=this;return function(_0x2b5e99){if(_0x2b5e99){freeIsNotKey(_0x2b5e99,_0x30d4f8[_0xca54('0x18')],'id');for(var _0x1540f9=0x0,_0x45b82e={},_0x4a4384={};_0x1540f9<_0x2b5e99[_0xca54('0x3c')];_0x1540f9+=0x1){_0x45b82e=_0x2b5e99[_0x1540f9];if(_[_0xca54('0x43')](_0x30d4f8[_0xca54('0x18')][_0x45b82e['id']])){_0x30d4f8[_0xca54('0x18')][_0x45b82e['id']]=new SalesforceAccount(_0x45b82e);}else{_0x30d4f8[_0xca54('0x3f')](_0x30d4f8[_0xca54('0x18')][_0x45b82e['id']],_0x45b82e);}}}return _0x30d4f8[_0xca54('0x18')];};};Realtime[_0xca54('0x3b')][_0xca54('0x48')]=function(){var _0x3c86b0=this;return function(_0x171831){if(_0x171831){freeIsNotKey(_0x171831,_0x3c86b0[_0xca54('0x1a')],'id');for(var _0x623a3d=0x0,_0x312e03={},_0x3256c4={};_0x623a3d<_0x171831[_0xca54('0x3c')];_0x623a3d+=0x1){_0x312e03=_0x171831[_0x623a3d];if(_[_0xca54('0x43')](_0x3c86b0[_0xca54('0x1a')][_0x312e03['id']])){_0x3c86b0[_0xca54('0x1a')][_0x312e03['id']]=new FreshdeskAccount(_0x312e03);}else{_0x3c86b0[_0xca54('0x3f')](_0x3c86b0[_0xca54('0x1a')][_0x312e03['id']],_0x312e03);}}}return _0x3c86b0['freshdeskAccounts'];};};Realtime[_0xca54('0x3b')][_0xca54('0x49')]=function(){var _0x3d2575=this;return function(_0x3d9f30){if(_0x3d9f30){freeIsNotKey(_0x3d9f30,_0x3d2575['zohoAccounts'],'id');for(var _0x51d49e=0x0,_0x101b64={},_0x292eea={};_0x51d49e<_0x3d9f30[_0xca54('0x3c')];_0x51d49e+=0x1){_0x101b64=_0x3d9f30[_0x51d49e];if(_[_0xca54('0x43')](_0x3d2575[_0xca54('0x1b')][_0x101b64['id']])){_0x3d2575[_0xca54('0x1b')][_0x101b64['id']]=new ZohoAccount(_0x101b64);}else{_0x3d2575[_0xca54('0x3f')](_0x3d2575[_0xca54('0x1b')][_0x101b64['id']],_0x101b64);}}}return _0x3d2575[_0xca54('0x1b')];};};Realtime[_0xca54('0x3b')][_0xca54('0x4a')]=function(){var _0x37f373=this;return function(_0x265f23){if(_0x265f23){freeIsNotKey(_0x265f23,_0x37f373[_0xca54('0x1c')],'id');for(var _0x5db842=0x0,_0x45b34b={},_0x580dfb={};_0x5db842<_0x265f23['length'];_0x5db842+=0x1){_0x45b34b=_0x265f23[_0x5db842];if(_[_0xca54('0x43')](_0x37f373['deskAccounts'][_0x45b34b['id']])){_0x37f373[_0xca54('0x1c')][_0x45b34b['id']]=new DeskAccount(_0x45b34b);}else{_0x37f373[_0xca54('0x3f')](_0x37f373[_0xca54('0x1c')][_0x45b34b['id']],_0x45b34b);}}}return _0x37f373[_0xca54('0x1c')];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x5ddc91=this;return function(_0x14f08e){if(_0x14f08e){freeIsNotKey(_0x14f08e,_0x5ddc91['sugarcrmAccounts'],'id');for(var _0x32ed5a=0x0,_0x46c974={},_0x5ed798={};_0x32ed5a<_0x14f08e[_0xca54('0x3c')];_0x32ed5a+=0x1){_0x46c974=_0x14f08e[_0x32ed5a];if(_['isUndefined'](_0x5ddc91['sugarcrmAccounts'][_0x46c974['id']])){_0x5ddc91[_0xca54('0x19')][_0x46c974['id']]=new SugarcrmAccount(_0x46c974);}else{_0x5ddc91[_0xca54('0x3f')](_0x5ddc91[_0xca54('0x19')][_0x46c974['id']],_0x46c974);}}}return _0x5ddc91[_0xca54('0x19')];};};Realtime[_0xca54('0x3b')][_0xca54('0x4b')]=function(){var _0x16fda2=this;return function(_0x39badc){if(_0x39badc){freeIsNotKey(_0x39badc,_0x16fda2[_0xca54('0x1d')],'id');for(var _0x40cb57=0x0,_0x2f7215={},_0x3a49b7={};_0x40cb57<_0x39badc[_0xca54('0x3c')];_0x40cb57+=0x1){_0x2f7215=_0x39badc[_0x40cb57];if(_[_0xca54('0x43')](_0x16fda2[_0xca54('0x1d')][_0x2f7215['id']])){_0x16fda2[_0xca54('0x1d')][_0x2f7215['id']]=new VtigerAccount(_0x2f7215);}else{_0x16fda2[_0xca54('0x3f')](_0x16fda2[_0xca54('0x1d')][_0x2f7215['id']],_0x2f7215);}}}return _0x16fda2[_0xca54('0x1d')];};};Realtime[_0xca54('0x3b')][_0xca54('0x4c')]=function(){var _0x1eb3fe=this;return function(_0x566d66){if(_0x566d66){freeIsNotKey(_0x566d66,_0x1eb3fe[_0xca54('0x1e')],'id');for(var _0x4bef96=0x0,_0x1ed8b2={},_0x8ac70b={};_0x4bef96<_0x566d66['length'];_0x4bef96+=0x1){_0x1ed8b2=_0x566d66[_0x4bef96];if(_['isUndefined'](_0x1eb3fe[_0xca54('0x1e')][_0x1ed8b2['id']])){_0x1eb3fe[_0xca54('0x1e')][_0x1ed8b2['id']]=new ServicenowAccount(_0x1ed8b2);}else{_0x1eb3fe['mergeFromDatabase'](_0x1eb3fe[_0xca54('0x1e')][_0x1ed8b2['id']],_0x1ed8b2);}}}return _0x1eb3fe[_0xca54('0x1e')];};};Realtime[_0xca54('0x3b')]['initDynamics365Accounts']=function(){var _0x509917=this;return function(_0xdd5a1e){if(_0xdd5a1e){freeIsNotKey(_0xdd5a1e,_0x509917[_0xca54('0x4d')],'id');for(var _0x28dece=0x0,_0x2f3007={},_0x4f2e43={};_0x28dece<_0xdd5a1e[_0xca54('0x3c')];_0x28dece+=0x1){_0x2f3007=_0xdd5a1e[_0x28dece];if(_['isUndefined'](_0x509917['dynamics365Accounts'][_0x2f3007['id']])){_0x509917['dynamics365Accounts'][_0x2f3007['id']]=new Dynamics365Account(_0x2f3007);}else{_0x509917[_0xca54('0x3f')](_0x509917[_0xca54('0x4d')][_0x2f3007['id']],_0x2f3007);}}}return _0x509917[_0xca54('0x4d')];};};Realtime['prototype'][_0xca54('0x4e')]=function(){var _0x64cfb7=this;return function(_0x4c0b6b){if(_0x4c0b6b){freeIsNotKey(_0x4c0b6b,_0x64cfb7[_0xca54('0x1f')],'id');for(var _0x2ac056=0x0,_0xbe3c98={},_0x3d203b={};_0x2ac056<_0x4c0b6b[_0xca54('0x3c')];_0x2ac056+=0x1){_0xbe3c98=_0x4c0b6b[_0x2ac056];if(_[_0xca54('0x43')](_0x64cfb7[_0xca54('0x1f')][_0xbe3c98['id']])){_0x64cfb7[_0xca54('0x1f')][_0xbe3c98['id']]=new FreshsalesAccount(_0xbe3c98);}else{_0x64cfb7[_0xca54('0x3f')](_0x64cfb7[_0xca54('0x1f')][_0xbe3c98['id']],_0xbe3c98);}}}return _0x64cfb7['freshsalesAccounts'];};};Realtime[_0xca54('0x3b')][_0xca54('0x4f')]=function(){var _0x3e10da=this;return function(_0xbae6f4){for(var _0x44962d=0x0;_0x44962d<_0xbae6f4[_0xca54('0x3c')];_0x44962d+=0x1){_[_0xca54('0x50')](_0x3e10da['voiceQueues'][_0xbae6f4[_0x44962d][_0xca54('0x24')]],_0xbae6f4[_0x44962d]);}return _0x3e10da[_0xca54('0x11')];};};Realtime[_0xca54('0x3b')][_0xca54('0x51')]=function(){var _0x1f134f=this;return function(_0x32413f){clearVoiceQueues(_0x1f134f[_0xca54('0x11')]);if(_0x32413f){_0x32413f=_[_0xca54('0x52')](_0x32413f,_0xca54('0x53'));for(var _0x4659a4 in _0x32413f){if(_0x32413f['hasOwnProperty'](_0x4659a4)){var _0x12f93d={};for(var _0x53b53c=0x0;_0x53b53c<_0x32413f[_0x4659a4][_0xca54('0x3c')];_0x53b53c+=0x1){var _0x3dfd3b=_0x32413f[_0x4659a4][_0x53b53c][_0xca54('0x54')];if(_0x1f134f['voiceQueues'][_0x3dfd3b]){if(_0x32413f[_0x4659a4][_0x53b53c][_0xca54('0x55')]){_0x1f134f[_0xca54('0x11')][_0x3dfd3b]['unmanaged']+=0x1;}if(_0x32413f[_0x4659a4][_0x53b53c][_0xca54('0x56')]){_0x1f134f['voiceQueues'][_0x3dfd3b]['abandoned']+=0x1;}_0x1f134f[_0xca54('0x11')][_0x3dfd3b][_0xca54('0x28')]+=moment(_0x32413f[_0x4659a4][_0x53b53c]['queuecallerleaveAt'])[_0xca54('0x57')](moment(_0x32413f[_0x4659a4][_0x53b53c][_0xca54('0x58')]),'seconds')||0x0;if(_0x53b53c===_0x32413f[_0x4659a4][_0xca54('0x3c')]-0x1){_0x1f134f[_0xca54('0x11')][_0x3dfd3b][_0xca54('0x29')]+=moment(_0x32413f[_0x4659a4][_0x53b53c]['queuecallercompleteAt']||_0x32413f[_0x4659a4][_0x53b53c][_0xca54('0x59')]||_0x32413f[_0x4659a4][_0x53b53c][_0xca54('0x5a')])['diff'](moment(_0x32413f[_0x4659a4][_0x53b53c][_0xca54('0x58')]),_0xca54('0x5b'))||0x0;_0x1f134f[_0xca54('0x11')][_0x3dfd3b]['total']+=0x1;if(_0x32413f[_0x4659a4][_0x53b53c][_0xca54('0x5c')]){_0x1f134f[_0xca54('0x11')][_0x3dfd3b][_0xca54('0x27')]+=0x1;_0x1f134f['voiceQueues'][_0x3dfd3b][_0xca54('0x2a')]+=moment(_0x32413f[_0x4659a4][_0x53b53c][_0xca54('0x5d')])[_0xca54('0x57')](moment(_0x32413f[_0x4659a4][_0x53b53c]['queuecallerleaveAt']),_0xca54('0x5b'))||0x0;}}else{_0x1f134f['voiceQueues'][_0x3dfd3b][_0xca54('0x29')]+=_0x1f134f[_0xca54('0x11')][_0x3dfd3b][_0xca54('0x28')]||0x0;}}}}}}return _0x1f134f['voiceQueues'];};};Realtime[_0xca54('0x3b')]['initVoiceCallReports']=function(){var _0x272b07=this;return function(_0x4bedcd){clearVoiceCallReports(_0x272b07[_0xca54('0x5e')]);if(_0x4bedcd){for(var _0xdbcb45=0x0;_0xdbcb45<_0x4bedcd[_0xca54('0x3c')];_0xdbcb45+=0x1){_0x272b07[_0xca54('0x5e')][_0xca54('0x26')]+=0x1;_0x272b07['outbound'][_0xca54('0x29')]+=_0x4bedcd[_0xdbcb45]['duration'];if(_0x4bedcd[_0xdbcb45][_0xca54('0x5f')]==='ANSWERED'){_0x272b07[_0xca54('0x5e')][_0xca54('0x27')]+=0x1;_0x272b07[_0xca54('0x5e')][_0xca54('0x28')]+=_0x4bedcd[_0xdbcb45][_0xca54('0x60')]-_0x4bedcd[_0xdbcb45]['billableseconds']||0x0;_0x272b07[_0xca54('0x5e')]['sumBillable']+=_0x4bedcd[_0xdbcb45][_0xca54('0x61')];}}}return _0x272b07[_0xca54('0x5e')];};};Realtime[_0xca54('0x3b')][_0xca54('0x62')]=function(){var _0x266ccc=this;return function(_0x14c01f){if(_0x14c01f){freeIsNotKey(_0x14c01f,_0x266ccc[_0xca54('0x13')],_0xca54('0x24'));for(var _0x47786d=0x0,_0x4bd1ff={};_0x47786d<_0x14c01f[_0xca54('0x3c')];_0x47786d+=0x1){_0x4bd1ff=_0x14c01f[_0x47786d];if(_[_0xca54('0x43')](_0x266ccc[_0xca54('0x13')][_0x4bd1ff[_0xca54('0x24')]])){_0x266ccc[_0xca54('0x13')][_0x4bd1ff['name']]=new Campaign(_0x4bd1ff);}else{_0x266ccc[_0xca54('0x3f')](_0x266ccc[_0xca54('0x13')][_0x4bd1ff[_0xca54('0x24')]],_0x4bd1ff);}}}return _0x266ccc[_0xca54('0x13')];};};Realtime[_0xca54('0x3b')][_0xca54('0x63')]=function(){var _0x328d18=this;return function(_0x48f019){if(_0x48f019){freeIsNotKey(_0x48f019,_0x328d18[_0xca54('0x15')],'id');for(var _0x3bc820=0x0,_0x256bdc={};_0x3bc820<_0x48f019['length'];_0x3bc820+=0x1){_0x256bdc=_0x48f019[_0x3bc820];if(_[_0xca54('0x43')](_0x328d18[_0xca54('0x15')][_0x256bdc['id']])){_0x328d18[_0xca54('0x15')][_0x256bdc['id']]=new VoiceExtension(_0x256bdc);}else{_0x328d18['mergeFromDatabase'](_0x328d18[_0xca54('0x15')][_0x256bdc['id']],_0x256bdc);}}}return _0x328d18[_0xca54('0x15')];};};Realtime[_0xca54('0x3b')][_0xca54('0x64')]=function(){var _0x4aa49a=this;return function(_0x4ae079){clearCampaigns(_0x4aa49a[_0xca54('0x13')]);for(var _0x26122c=0x0;_0x26122c<_0x4ae079[_0xca54('0x3c')];_0x26122c+=0x1){_[_0xca54('0x50')](_0x4aa49a['campaigns'][_0x4ae079[_0x26122c]['name']],_0x4ae079[_0x26122c]);}return _0x4aa49a['campaigns'];};};Realtime['prototype'][_0xca54('0x65')]=function(){var _0x3cc060=this;return function(_0x5eba95){if(_0x5eba95){freeIsNotKey(_0x5eba95,_0x3cc060['faxAccounts'],'id');for(var _0xfc4c56=0x0,_0x2670a3={},_0x5f1400={};_0xfc4c56<_0x5eba95['length'];_0xfc4c56+=0x1){_0x2670a3=_0x5eba95[_0xfc4c56];if(_[_0xca54('0x43')](_0x3cc060[_0xca54('0x20')][_0x2670a3['id']])){_0x3cc060[_0xca54('0x20')][_0x2670a3['id']]=new FaxAccount(_0x2670a3);}else{_0x3cc060[_0xca54('0x3f')](_0x3cc060['faxAccounts'][_0x2670a3['id']],_0x2670a3);}}}return _0x3cc060['faxAccounts'];};};module[_0xca54('0x66')]=Realtime; \ No newline at end of file +var _0xb726=['duration','billableseconds','campaigns','initVoiceExtensions','voiceExtensions','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','../model/telephone','../model/trigger','../model/template','../model/campaign','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/servicenowAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','format','SIP/%s','name','mapKeys','isNil','interface','hasOwnProperty','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','abandoned','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','prototype','initAgents','length','isUndefined','initTrunks','mergeFromDatabase','initVoiceQueues','initTriggers','triggers','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','initVoiceCallReports','disposition','ANSWERED'];(function(_0x5c92f7,_0x17381f){var _0x452cc1=function(_0x374c83){while(--_0x374c83){_0x5c92f7['push'](_0x5c92f7['shift']());}};_0x452cc1(++_0x17381f);}(_0xb726,0x69));var _0x6b72=function(_0x75b601,_0x3a0007){_0x75b601=_0x75b601-0x0;var _0x28f918=_0xb726[_0x75b601];return _0x28f918;};'use strict';var BPromise=require(_0x6b72('0x0'));var util=require(_0x6b72('0x1'));var _=require(_0x6b72('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0x6b72('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x6b72('0x4'));var Template=require(_0x6b72('0x5'));var Campaign=require(_0x6b72('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x6b72('0x7'));var SugarcrmAccount=require(_0x6b72('0x8'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x6b72('0x9'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x6b72('0xa'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x6b72('0xb'));var Realtime=function(){this[_0x6b72('0xc')]={};this[_0x6b72('0xd')]={};this[_0x6b72('0xe')]={};this[_0x6b72('0xf')]={};this['triggers']={};this['campaigns']={};this[_0x6b72('0x10')]={};this[_0x6b72('0x11')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x6b72('0x12')]={};this[_0x6b72('0x13')]={};this[_0x6b72('0x14')]={};this['timers']={};this[_0x6b72('0x15')]={};this[_0x6b72('0x16')]={};this[_0x6b72('0x17')]={};this[_0x6b72('0x18')]={};this[_0x6b72('0x19')]={};this[_0x6b72('0x1a')]={};this['vtigerAccounts']={};this[_0x6b72('0x1b')]={};this[_0x6b72('0x1c')]={};this[_0x6b72('0x1d')]={};this['faxAccounts']={};};function freeIsNotKey(_0x184c2c,_0x38e5fc,_0x484324){var _0x341c33=_['mapKeys'](_0x184c2c,function(_0x359ee5,_0x2af5d8){return _0x359ee5[_0x484324];});for(var _0x550a91 in _0x38e5fc){if(_0x38e5fc['hasOwnProperty'](_0x550a91)){if(!_0x341c33[_0x550a91]){delete _0x38e5fc[_0x550a91];}}}}function freeIsNotKeySip(_0x1ade18,_0x2b3a97){var _0x5d7a45=_['mapKeys'](_0x1ade18,function(_0x38736c,_0x50bacb){return util[_0x6b72('0x1e')](_0x6b72('0x1f'),_0x38736c[_0x6b72('0x20')]);});for(var _0x37fd32 in _0x2b3a97){if(_0x2b3a97['hasOwnProperty'](_0x37fd32)){if(!_0x5d7a45[_0x37fd32]){delete _0x2b3a97[_0x37fd32];}}}}function freeIsNotKeyAgent(_0x570c42,_0x4a915b){var _0x220e68=_[_0x6b72('0x21')](_0x570c42,function(_0x112a7f,_0x98a6f2){var _0x43f228=_[_0x6b72('0x22')](_0x112a7f[_0x6b72('0x23')])?util[_0x6b72('0x1e')](_0x6b72('0x1f'),_0x112a7f[_0x6b72('0x20')]):_0x112a7f['interface'];return _0x43f228;});for(var _0x46da27 in _0x4a915b){if(_0x4a915b[_0x6b72('0x24')](_0x46da27)){if(!_0x220e68[_0x46da27]){delete _0x4a915b[_0x46da27];}}}}function clearVoiceCallReports(_0x219f4b){_0x219f4b[_0x6b72('0x25')]=0x0;_0x219f4b[_0x6b72('0x26')]=0x0;_0x219f4b[_0x6b72('0x27')]=0x0;_0x219f4b[_0x6b72('0x28')]=0x0;_0x219f4b[_0x6b72('0x29')]=0x0;}function clearCampaigns(_0x42eb13){if(!_[_0x6b72('0x2a')](_0x42eb13)){for(var _0x5b91bc in _0x42eb13){if(_0x42eb13['hasOwnProperty'](_0x5b91bc)){_0x42eb13[_0x5b91bc][_0x6b72('0x2b')]=0x0;_0x42eb13[_0x5b91bc]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x37fc93){if(!_[_0x6b72('0x2a')](_0x37fc93)){for(var _0x1929e8 in _0x37fc93){if(_0x37fc93[_0x6b72('0x24')](_0x1929e8)){_0x37fc93[_0x1929e8][_0x6b72('0x25')]=0x0;_0x37fc93[_0x1929e8][_0x6b72('0x26')]=0x0;_0x37fc93[_0x1929e8][_0x6b72('0x2c')]=0x0;_0x37fc93[_0x1929e8][_0x6b72('0x2d')]=0x0;_0x37fc93[_0x1929e8][_0x6b72('0x27')]=0x0;_0x37fc93[_0x1929e8][_0x6b72('0x28')]=0x0;_0x37fc93[_0x1929e8][_0x6b72('0x29')]=0x0;_0x37fc93[_0x1929e8]['outboundAnswerAgiCallsDay']=0x0;_0x37fc93[_0x1929e8][_0x6b72('0x2e')]=0x0;_0x37fc93[_0x1929e8]['outboundBusyCallsDay']=0x0;_0x37fc93[_0x1929e8][_0x6b72('0x2f')]=0x0;_0x37fc93[_0x1929e8][_0x6b72('0x30')]=0x0;_0x37fc93[_0x1929e8][_0x6b72('0x31')]=0x0;_0x37fc93[_0x1929e8][_0x6b72('0x32')]=0x0;_0x37fc93[_0x1929e8]['outboundDropCallsDayCallersExit']=0x0;_0x37fc93[_0x1929e8][_0x6b72('0x33')]=0x0;_0x37fc93[_0x1929e8]['outboundOriginateFailureCallsDay']=0x0;_0x37fc93[_0x1929e8]['outboundRejectCallsDay']=0x0;_0x37fc93[_0x1929e8][_0x6b72('0x34')]=0x0;_0x37fc93[_0x1929e8][_0x6b72('0x35')]=0x0;_0x37fc93[_0x1929e8][_0x6b72('0x36')]=0x0;_0x37fc93[_0x1929e8]['queueStatusComplete']=!![];}}}}Realtime[_0x6b72('0x37')]['mergeFromDatabase']=function(_0x13ced3,_0x414852){for(var _0x439e33 in _0x414852){if(_0x13ced3[_0x6b72('0x24')](_0x439e33)){_0x13ced3[_0x439e33]=_0x414852[_0x439e33];}}};Realtime['prototype'][_0x6b72('0x38')]=function(){var _0x1e338a=this;return function(_0x44183d){if(_0x44183d){freeIsNotKeyAgent(_0x44183d,_0x1e338a[_0x6b72('0xc')]);for(var _0x398709=0x0,_0x4db7e4={},_0x40c8cf={};_0x398709<_0x44183d[_0x6b72('0x39')];_0x398709+=0x1){_0x4db7e4=_0x44183d[_0x398709];var _0x245d8b=_[_0x6b72('0x22')](_0x4db7e4[_0x6b72('0x23')])?util[_0x6b72('0x1e')](_0x6b72('0x1f'),_0x4db7e4[_0x6b72('0x20')]):_0x4db7e4[_0x6b72('0x23')];if(_[_0x6b72('0x3a')](_0x1e338a[_0x6b72('0xc')][_0x245d8b])){_0x1e338a['agents'][_0x245d8b]=new Agent(_0x4db7e4);}else{_0x1e338a['mergeFromDatabase'](_0x1e338a[_0x6b72('0xc')][_0x245d8b],_0x4db7e4);}}}return _0x1e338a[_0x6b72('0xc')];};};Realtime[_0x6b72('0x37')]['initTelephones']=function(){var _0x2f7810=this;return function(_0x5312ce){if(_0x5312ce){freeIsNotKeySip(_0x5312ce,_0x2f7810[_0x6b72('0xd')]);for(var _0x2fa74a=0x0,_0x1be766={},_0x123da8={};_0x2fa74a<_0x5312ce[_0x6b72('0x39')];_0x2fa74a+=0x1){_0x1be766=_0x5312ce[_0x2fa74a];if(_[_0x6b72('0x3a')](_0x2f7810[_0x6b72('0xd')][util[_0x6b72('0x1e')](_0x6b72('0x1f'),_0x1be766[_0x6b72('0x20')])])){_0x2f7810[_0x6b72('0xd')][util[_0x6b72('0x1e')](_0x6b72('0x1f'),_0x1be766[_0x6b72('0x20')])]=new Telephone(_0x1be766);}else{_0x2f7810['mergeFromDatabase'](_0x2f7810[_0x6b72('0xd')][util['format']('SIP/%s',_0x1be766[_0x6b72('0x20')])],_0x1be766);}}}return _0x2f7810[_0x6b72('0xd')];};};Realtime[_0x6b72('0x37')][_0x6b72('0x3b')]=function(){var _0x5e1fd1=this;return function(_0xf89edf){if(_0xf89edf){freeIsNotKeySip(_0xf89edf,_0x5e1fd1[_0x6b72('0xe')]);for(var _0x521aa0=0x0,_0x1e4ee4={},_0x13eaf4={};_0x521aa0<_0xf89edf[_0x6b72('0x39')];_0x521aa0+=0x1){_0x1e4ee4=_0xf89edf[_0x521aa0];if(_[_0x6b72('0x3a')](_0x5e1fd1[_0x6b72('0xe')][util[_0x6b72('0x1e')]('SIP/%s',_0x1e4ee4[_0x6b72('0x20')])])){_0x5e1fd1['trunks'][util[_0x6b72('0x1e')](_0x6b72('0x1f'),_0x1e4ee4[_0x6b72('0x20')])]=new Trunk(_0x1e4ee4);}else{_0x5e1fd1[_0x6b72('0x3c')](_0x5e1fd1['trunks'][util['format']('SIP/%s',_0x1e4ee4[_0x6b72('0x20')])],_0x1e4ee4);}}}return _0x5e1fd1[_0x6b72('0xe')];};};Realtime[_0x6b72('0x37')][_0x6b72('0x3d')]=function(){var _0x2c7ed2=this;return function(_0x4502d4){if(_0x4502d4){freeIsNotKey(_0x4502d4,_0x2c7ed2['voiceQueues'],_0x6b72('0x20'));for(var _0x319343=0x0,_0x504354={},_0x29b392={};_0x319343<_0x4502d4[_0x6b72('0x39')];_0x319343+=0x1){_0x504354=_0x4502d4[_0x319343];if(_[_0x6b72('0x3a')](_0x2c7ed2[_0x6b72('0xf')][_0x504354[_0x6b72('0x20')]])){_0x2c7ed2[_0x6b72('0xf')][_0x504354[_0x6b72('0x20')]]=new VoiceQueue(_0x504354);}else{_0x2c7ed2['mergeFromDatabase'](_0x2c7ed2[_0x6b72('0xf')][_0x504354[_0x6b72('0x20')]],_0x504354);}}}return _0x2c7ed2[_0x6b72('0xf')];};};Realtime[_0x6b72('0x37')][_0x6b72('0x3e')]=function(){var _0x35f7bf=this;return function(_0x1411cc){if(_0x1411cc){freeIsNotKey(_0x1411cc,_0x35f7bf['triggers'],'id');for(var _0x47c933=0x0,_0x17f9db={},_0x2a2ee1={};_0x47c933<_0x1411cc[_0x6b72('0x39')];_0x47c933+=0x1){_0x17f9db=_0x1411cc[_0x47c933];if(_[_0x6b72('0x3a')](_0x35f7bf[_0x6b72('0x3f')][_0x17f9db['id']])){_0x35f7bf['triggers'][_0x17f9db['id']]=new Trigger(_0x17f9db);}else{_0x35f7bf['mergeFromDatabase'](_0x35f7bf[_0x6b72('0x3f')][_0x17f9db['id']],_0x17f9db);}}}return _0x35f7bf[_0x6b72('0x3f')];};};Realtime[_0x6b72('0x37')][_0x6b72('0x40')]=function(){var _0x43ec4e=this;return function(_0x27d0cc){if(_0x27d0cc){freeIsNotKey(_0x27d0cc,_0x43ec4e[_0x6b72('0x10')],'id');for(var _0x2b5dfc=0x0,_0x2890c7={},_0x5364c4={};_0x2b5dfc<_0x27d0cc['length'];_0x2b5dfc+=0x1){_0x2890c7=_0x27d0cc[_0x2b5dfc];if(_[_0x6b72('0x3a')](_0x43ec4e['templates'][_0x2890c7['id']])){_0x43ec4e[_0x6b72('0x10')][_0x2890c7['id']]=new Template(_0x2890c7);}else{_0x43ec4e['mergeFromDatabase'](_0x43ec4e[_0x6b72('0x10')][_0x2890c7['id']],_0x2890c7);}}}return _0x43ec4e['templates'];};};Realtime[_0x6b72('0x37')]['initZendeskAccounts']=function(){var _0x526339=this;return function(_0x2e5d56){if(_0x2e5d56){freeIsNotKey(_0x2e5d56,_0x526339[_0x6b72('0x15')],'id');for(var _0x35ed2f=0x0,_0x58f32e={},_0x215ec3={};_0x35ed2f<_0x2e5d56['length'];_0x35ed2f+=0x1){_0x58f32e=_0x2e5d56[_0x35ed2f];if(_['isUndefined'](_0x526339[_0x6b72('0x15')][_0x58f32e['id']])){_0x526339['zendeskAccounts'][_0x58f32e['id']]=new ZendeskAccount(_0x58f32e);}else{_0x526339[_0x6b72('0x3c')](_0x526339[_0x6b72('0x15')][_0x58f32e['id']],_0x58f32e);}}}return _0x526339[_0x6b72('0x15')];};};Realtime[_0x6b72('0x37')][_0x6b72('0x41')]=function(){var _0x4d0595=this;return function(_0x3a1dd1){if(_0x3a1dd1){freeIsNotKey(_0x3a1dd1,_0x4d0595[_0x6b72('0x16')],'id');for(var _0x333e31=0x0,_0xa4f00f={},_0x5af62b={};_0x333e31<_0x3a1dd1[_0x6b72('0x39')];_0x333e31+=0x1){_0xa4f00f=_0x3a1dd1[_0x333e31];if(_[_0x6b72('0x3a')](_0x4d0595['salesforceAccounts'][_0xa4f00f['id']])){_0x4d0595['salesforceAccounts'][_0xa4f00f['id']]=new SalesforceAccount(_0xa4f00f);}else{_0x4d0595[_0x6b72('0x3c')](_0x4d0595[_0x6b72('0x16')][_0xa4f00f['id']],_0xa4f00f);}}}return _0x4d0595[_0x6b72('0x16')];};};Realtime[_0x6b72('0x37')][_0x6b72('0x42')]=function(){var _0x3d5469=this;return function(_0x51d8b3){if(_0x51d8b3){freeIsNotKey(_0x51d8b3,_0x3d5469['freshdeskAccounts'],'id');for(var _0x490698=0x0,_0x2ccfef={},_0x4a134a={};_0x490698<_0x51d8b3['length'];_0x490698+=0x1){_0x2ccfef=_0x51d8b3[_0x490698];if(_['isUndefined'](_0x3d5469['freshdeskAccounts'][_0x2ccfef['id']])){_0x3d5469[_0x6b72('0x18')][_0x2ccfef['id']]=new FreshdeskAccount(_0x2ccfef);}else{_0x3d5469[_0x6b72('0x3c')](_0x3d5469['freshdeskAccounts'][_0x2ccfef['id']],_0x2ccfef);}}}return _0x3d5469['freshdeskAccounts'];};};Realtime[_0x6b72('0x37')][_0x6b72('0x43')]=function(){var _0x20b29b=this;return function(_0xfc01b4){if(_0xfc01b4){freeIsNotKey(_0xfc01b4,_0x20b29b[_0x6b72('0x19')],'id');for(var _0x3b3325=0x0,_0x4b8f9d={},_0x34f015={};_0x3b3325<_0xfc01b4[_0x6b72('0x39')];_0x3b3325+=0x1){_0x4b8f9d=_0xfc01b4[_0x3b3325];if(_[_0x6b72('0x3a')](_0x20b29b[_0x6b72('0x19')][_0x4b8f9d['id']])){_0x20b29b[_0x6b72('0x19')][_0x4b8f9d['id']]=new ZohoAccount(_0x4b8f9d);}else{_0x20b29b['mergeFromDatabase'](_0x20b29b[_0x6b72('0x19')][_0x4b8f9d['id']],_0x4b8f9d);}}}return _0x20b29b['zohoAccounts'];};};Realtime[_0x6b72('0x37')][_0x6b72('0x44')]=function(){var _0x1e4aa7=this;return function(_0x36b84c){if(_0x36b84c){freeIsNotKey(_0x36b84c,_0x1e4aa7['deskAccounts'],'id');for(var _0x11c783=0x0,_0x499dc7={},_0x59be0f={};_0x11c783<_0x36b84c['length'];_0x11c783+=0x1){_0x499dc7=_0x36b84c[_0x11c783];if(_['isUndefined'](_0x1e4aa7[_0x6b72('0x1a')][_0x499dc7['id']])){_0x1e4aa7[_0x6b72('0x1a')][_0x499dc7['id']]=new DeskAccount(_0x499dc7);}else{_0x1e4aa7['mergeFromDatabase'](_0x1e4aa7[_0x6b72('0x1a')][_0x499dc7['id']],_0x499dc7);}}}return _0x1e4aa7[_0x6b72('0x1a')];};};Realtime[_0x6b72('0x37')][_0x6b72('0x45')]=function(){var _0x4fb62d=this;return function(_0x49040a){if(_0x49040a){freeIsNotKey(_0x49040a,_0x4fb62d['sugarcrmAccounts'],'id');for(var _0x50c57b=0x0,_0x5c8953={},_0x875709={};_0x50c57b<_0x49040a['length'];_0x50c57b+=0x1){_0x5c8953=_0x49040a[_0x50c57b];if(_[_0x6b72('0x3a')](_0x4fb62d[_0x6b72('0x17')][_0x5c8953['id']])){_0x4fb62d['sugarcrmAccounts'][_0x5c8953['id']]=new SugarcrmAccount(_0x5c8953);}else{_0x4fb62d[_0x6b72('0x3c')](_0x4fb62d[_0x6b72('0x17')][_0x5c8953['id']],_0x5c8953);}}}return _0x4fb62d[_0x6b72('0x17')];};};Realtime[_0x6b72('0x37')]['initVtigerAccounts']=function(){var _0x44babd=this;return function(_0x2f8a8e){if(_0x2f8a8e){freeIsNotKey(_0x2f8a8e,_0x44babd[_0x6b72('0x46')],'id');for(var _0x1d9ed7=0x0,_0x18e494={},_0x200715={};_0x1d9ed7<_0x2f8a8e[_0x6b72('0x39')];_0x1d9ed7+=0x1){_0x18e494=_0x2f8a8e[_0x1d9ed7];if(_['isUndefined'](_0x44babd['vtigerAccounts'][_0x18e494['id']])){_0x44babd[_0x6b72('0x46')][_0x18e494['id']]=new VtigerAccount(_0x18e494);}else{_0x44babd[_0x6b72('0x3c')](_0x44babd[_0x6b72('0x46')][_0x18e494['id']],_0x18e494);}}}return _0x44babd[_0x6b72('0x46')];};};Realtime[_0x6b72('0x37')][_0x6b72('0x47')]=function(){var _0x262b84=this;return function(_0x12121d){if(_0x12121d){freeIsNotKey(_0x12121d,_0x262b84[_0x6b72('0x1b')],'id');for(var _0x265f70=0x0,_0x5ce736={},_0x436bb5={};_0x265f70<_0x12121d[_0x6b72('0x39')];_0x265f70+=0x1){_0x5ce736=_0x12121d[_0x265f70];if(_['isUndefined'](_0x262b84[_0x6b72('0x1b')][_0x5ce736['id']])){_0x262b84['servicenowAccounts'][_0x5ce736['id']]=new ServicenowAccount(_0x5ce736);}else{_0x262b84[_0x6b72('0x3c')](_0x262b84['servicenowAccounts'][_0x5ce736['id']],_0x5ce736);}}}return _0x262b84['servicenowAccounts'];};};Realtime[_0x6b72('0x37')][_0x6b72('0x48')]=function(){var _0x9d534c=this;return function(_0x469d3d){if(_0x469d3d){freeIsNotKey(_0x469d3d,_0x9d534c[_0x6b72('0x1c')],'id');for(var _0x30448b=0x0,_0x2d23f4={},_0x3a6529={};_0x30448b<_0x469d3d[_0x6b72('0x39')];_0x30448b+=0x1){_0x2d23f4=_0x469d3d[_0x30448b];if(_[_0x6b72('0x3a')](_0x9d534c[_0x6b72('0x1c')][_0x2d23f4['id']])){_0x9d534c[_0x6b72('0x1c')][_0x2d23f4['id']]=new Dynamics365Account(_0x2d23f4);}else{_0x9d534c[_0x6b72('0x3c')](_0x9d534c['dynamics365Accounts'][_0x2d23f4['id']],_0x2d23f4);}}}return _0x9d534c[_0x6b72('0x1c')];};};Realtime[_0x6b72('0x37')]['initFreshsalesAccounts']=function(){var _0x3fa8df=this;return function(_0x1f2d7b){if(_0x1f2d7b){freeIsNotKey(_0x1f2d7b,_0x3fa8df[_0x6b72('0x1d')],'id');for(var _0x4bb5f6=0x0,_0x128d83={},_0x12897e={};_0x4bb5f6<_0x1f2d7b[_0x6b72('0x39')];_0x4bb5f6+=0x1){_0x128d83=_0x1f2d7b[_0x4bb5f6];if(_[_0x6b72('0x3a')](_0x3fa8df[_0x6b72('0x1d')][_0x128d83['id']])){_0x3fa8df[_0x6b72('0x1d')][_0x128d83['id']]=new FreshsalesAccount(_0x128d83);}else{_0x3fa8df[_0x6b72('0x3c')](_0x3fa8df[_0x6b72('0x1d')][_0x128d83['id']],_0x128d83);}}}return _0x3fa8df[_0x6b72('0x1d')];};};Realtime[_0x6b72('0x37')][_0x6b72('0x49')]=function(){var _0x4e035a=this;return function(_0x245540){for(var _0x119f46=0x0;_0x119f46<_0x245540[_0x6b72('0x39')];_0x119f46+=0x1){_[_0x6b72('0x4a')](_0x4e035a['voiceQueues'][_0x245540[_0x119f46][_0x6b72('0x20')]],_0x245540[_0x119f46]);}return _0x4e035a[_0x6b72('0xf')];};};Realtime['prototype'][_0x6b72('0x4b')]=function(){var _0x56c3b8=this;return function(_0x89f6cf){clearVoiceQueues(_0x56c3b8['voiceQueues']);if(_0x89f6cf){_0x89f6cf=_[_0x6b72('0x4c')](_0x89f6cf,_0x6b72('0x4d'));for(var _0x3e7229 in _0x89f6cf){if(_0x89f6cf[_0x6b72('0x24')](_0x3e7229)){var _0x3d908a={};for(var _0x3b58dc=0x0;_0x3b58dc<_0x89f6cf[_0x3e7229][_0x6b72('0x39')];_0x3b58dc+=0x1){var _0x5d069d=_0x89f6cf[_0x3e7229][_0x3b58dc]['queue'];if(_0x56c3b8[_0x6b72('0xf')][_0x5d069d]){if(_0x89f6cf[_0x3e7229][_0x3b58dc]['queuecallerexit']){_0x56c3b8[_0x6b72('0xf')][_0x5d069d]['unmanaged']+=0x1;}if(_0x89f6cf[_0x3e7229][_0x3b58dc][_0x6b72('0x4e')]){_0x56c3b8['voiceQueues'][_0x5d069d][_0x6b72('0x2d')]+=0x1;}_0x56c3b8[_0x6b72('0xf')][_0x5d069d][_0x6b72('0x27')]+=moment(_0x89f6cf[_0x3e7229][_0x3b58dc][_0x6b72('0x4f')])[_0x6b72('0x50')](moment(_0x89f6cf[_0x3e7229][_0x3b58dc][_0x6b72('0x51')]),_0x6b72('0x52'))||0x0;if(_0x3b58dc===_0x89f6cf[_0x3e7229][_0x6b72('0x39')]-0x1){_0x56c3b8['voiceQueues'][_0x5d069d]['sumDuration']+=moment(_0x89f6cf[_0x3e7229][_0x3b58dc][_0x6b72('0x53')]||_0x89f6cf[_0x3e7229][_0x3b58dc][_0x6b72('0x54')]||_0x89f6cf[_0x3e7229][_0x3b58dc][_0x6b72('0x55')])[_0x6b72('0x50')](moment(_0x89f6cf[_0x3e7229][_0x3b58dc][_0x6b72('0x51')]),'seconds')||0x0;_0x56c3b8[_0x6b72('0xf')][_0x5d069d]['total']+=0x1;if(_0x89f6cf[_0x3e7229][_0x3b58dc]['queuecallercomplete']){_0x56c3b8[_0x6b72('0xf')][_0x5d069d][_0x6b72('0x26')]+=0x1;_0x56c3b8[_0x6b72('0xf')][_0x5d069d][_0x6b72('0x29')]+=moment(_0x89f6cf[_0x3e7229][_0x3b58dc][_0x6b72('0x53')])[_0x6b72('0x50')](moment(_0x89f6cf[_0x3e7229][_0x3b58dc][_0x6b72('0x4f')]),'seconds')||0x0;}}else{_0x56c3b8[_0x6b72('0xf')][_0x5d069d][_0x6b72('0x28')]+=_0x56c3b8['voiceQueues'][_0x5d069d][_0x6b72('0x27')]||0x0;}}}}}}return _0x56c3b8[_0x6b72('0xf')];};};Realtime[_0x6b72('0x37')][_0x6b72('0x56')]=function(){var _0x25246d=this;return function(_0x25b13b){clearVoiceCallReports(_0x25246d[_0x6b72('0x11')]);if(_0x25b13b){for(var _0x5669a4=0x0;_0x5669a4<_0x25b13b[_0x6b72('0x39')];_0x5669a4+=0x1){_0x25246d[_0x6b72('0x11')][_0x6b72('0x25')]+=0x1;_0x25246d[_0x6b72('0x11')][_0x6b72('0x28')]+=_0x25b13b[_0x5669a4]['duration'];if(_0x25b13b[_0x5669a4][_0x6b72('0x57')]===_0x6b72('0x58')){_0x25246d['outbound'][_0x6b72('0x26')]+=0x1;_0x25246d[_0x6b72('0x11')]['sumHoldTime']+=_0x25b13b[_0x5669a4][_0x6b72('0x59')]-_0x25b13b[_0x5669a4][_0x6b72('0x5a')]||0x0;_0x25246d[_0x6b72('0x11')]['sumBillable']+=_0x25b13b[_0x5669a4]['billableseconds'];}}}return _0x25246d[_0x6b72('0x11')];};};Realtime[_0x6b72('0x37')]['initCampaigns']=function(){var _0x4e9b55=this;return function(_0x505d05){if(_0x505d05){freeIsNotKey(_0x505d05,_0x4e9b55[_0x6b72('0x5b')],'name');for(var _0x12c6f2=0x0,_0x21b909={};_0x12c6f2<_0x505d05[_0x6b72('0x39')];_0x12c6f2+=0x1){_0x21b909=_0x505d05[_0x12c6f2];if(_['isUndefined'](_0x4e9b55[_0x6b72('0x5b')][_0x21b909[_0x6b72('0x20')]])){_0x4e9b55[_0x6b72('0x5b')][_0x21b909['name']]=new Campaign(_0x21b909);}else{_0x4e9b55[_0x6b72('0x3c')](_0x4e9b55[_0x6b72('0x5b')][_0x21b909[_0x6b72('0x20')]],_0x21b909);}}}return _0x4e9b55[_0x6b72('0x5b')];};};Realtime['prototype'][_0x6b72('0x5c')]=function(){var _0x2f330b=this;return function(_0x156e25){if(_0x156e25){freeIsNotKey(_0x156e25,_0x2f330b[_0x6b72('0x5d')],'id');for(var _0x5c2cb9=0x0,_0x5d68f1={};_0x5c2cb9<_0x156e25[_0x6b72('0x39')];_0x5c2cb9+=0x1){_0x5d68f1=_0x156e25[_0x5c2cb9];if(_[_0x6b72('0x3a')](_0x2f330b[_0x6b72('0x5d')][_0x5d68f1['id']])){_0x2f330b[_0x6b72('0x5d')][_0x5d68f1['id']]=new VoiceExtension(_0x5d68f1);}else{_0x2f330b[_0x6b72('0x3c')](_0x2f330b[_0x6b72('0x5d')][_0x5d68f1['id']],_0x5d68f1);}}}return _0x2f330b[_0x6b72('0x5d')];};};Realtime[_0x6b72('0x37')]['initCampaignHopperHistory']=function(){var _0x5d2f84=this;return function(_0x540384){clearCampaigns(_0x5d2f84[_0x6b72('0x5b')]);for(var _0x156fce=0x0;_0x156fce<_0x540384[_0x6b72('0x39')];_0x156fce+=0x1){_[_0x6b72('0x4a')](_0x5d2f84[_0x6b72('0x5b')][_0x540384[_0x156fce][_0x6b72('0x20')]],_0x540384[_0x156fce]);}return _0x5d2f84['campaigns'];};};Realtime['prototype'][_0x6b72('0x5e')]=function(){var _0x5ea481=this;return function(_0x230d52){if(_0x230d52){freeIsNotKey(_0x230d52,_0x5ea481['faxAccounts'],'id');for(var _0x309880=0x0,_0x5568fa={},_0xc99fb0={};_0x309880<_0x230d52[_0x6b72('0x39')];_0x309880+=0x1){_0x5568fa=_0x230d52[_0x309880];if(_[_0x6b72('0x3a')](_0x5ea481['faxAccounts'][_0x5568fa['id']])){_0x5ea481[_0x6b72('0x5f')][_0x5568fa['id']]=new FaxAccount(_0x5568fa);}else{_0x5ea481[_0x6b72('0x3c')](_0x5ea481['faxAccounts'][_0x5568fa['id']],_0x5568fa);}}}return _0x5ea481[_0x6b72('0x5f')];};};module[_0x6b72('0x60')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 564002c..b80228b 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 _0x02a0=['destinationchannel','channel','callerid','disposition','\x22%s\x22\x20<%s>','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','mobile','phone','lastIndexOf','voiceDialReport','blindTransfer','bluebird','lodash','util','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','attendedTransfer','findAgent','find','name','isNil','interface','SIP/%s','prototype','length','connectedlinenum','accountcode','assigned','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','voiceCallReport','destination','exten','type','lastapplication','lastdata','queue','from-voip-provider','context','xcally-motion-preview','calleridnum','originatecalleridnum'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0x02a0,0xb6));var _0x002a=function(_0x539a5d,_0x377bf4){_0x539a5d=_0x539a5d-0x0;var _0x59e6b5=_0x02a0[_0x539a5d];return _0x59e6b5;};'use strict';var BPromise=require(_0x002a('0x0'));var _=require(_0x002a('0x1'));var moment=require('moment');var util=require(_0x002a('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require(_0x002a('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x002a('0x4'));var RpcVoiceDialReport=require(_0x002a('0x5'));var RpcMemberReport=require(_0x002a('0x6'));var RpcVoiceQueueReport=require(_0x002a('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x002a('0x8'));var VoiceQueueReport=require(_0x002a('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x002a('0xa'));var VoiceDialReport=require(_0x002a('0xb'));var UserReport=require('./userReport');function Report(_0x28222c){this[_0x002a('0xc')]=_0x28222c;this['agents']=_0x28222c[_0x002a('0xd')];this[_0x002a('0xe')]=_0x28222c[_0x002a('0xe')];}Report['prototype']['sync']=function(_0x277e12){var _0x59635f=new VoiceQueueReport(this[_0x002a('0xc')]);var _0xdc7ade=new VoiceAgentReport(this[_0x002a('0xc')]);var _0x2ea5ba=new VoiceDialReport(this['realtime']);var _0x287130=new VoiceCallReport(this[_0x002a('0xc')]);var _0x5ba0f3=new UserReport(this[_0x002a('0xc')]);if(config[_0x002a('0xf')]&&config[_0x002a('0xf')]['disabled']){ami['on'](_0x002a('0x10'),this[_0x002a('0x11')][_0x002a('0x12')](this));ami['on'](_0x002a('0x13'),this['voiceCallReport']['bind'](this));ami['on'](_0x002a('0x14'),this[_0x002a('0x15')]['bind'](this));ami['on'](_0x002a('0x16'),this['voiceDialReport'][_0x002a('0x12')](this));ami['on']('blindtransfer',this['blindTransfer'][_0x002a('0x12')](this));ami['on']('attendedtransfer',this[_0x002a('0x17')][_0x002a('0x12')](this));}};Report['prototype'][_0x002a('0x18')]=function(_0x2496e3){var _0x380eea=undefined;_0x380eea=_[_0x002a('0x19')](this[_0x002a('0xd')],function(_0x4cc909){return _0x4cc909['accountcode']==_0x2496e3||_0x4cc909[_0x002a('0x1a')]==_0x2496e3;});if(_[_0x002a('0x1b')](_0x380eea)){var _0x1b92ba=_['find'](this[_0x002a('0xe')],function(_0x41b130){return _0x41b130['accountcode']==_0x2496e3||_0x41b130[_0x002a('0x1a')]==_0x2496e3;});if(_0x1b92ba){_0x380eea=_[_0x002a('0x19')](this[_0x002a('0xd')],function(_0xc3204f){return _0xc3204f[_0x002a('0x1c')]==util['format'](_0x002a('0x1d'),_0x1b92ba[_0x002a('0x1a')]);});}}return _0x380eea;};Report[_0x002a('0x1e')][_0x002a('0x11')]=function(_0x313353){for(var _0x54e710=0x0;_0x54e710<_0x313353[_0x002a('0x1f')];_0x54e710+=0x1){var _0x1101a5=this[_0x002a('0x18')](_0x313353[_0x54e710][_0x002a('0x20')]);if(_0x1101a5){_0x313353[_0x54e710][_0x002a('0x21')]=_0x1101a5[_0x002a('0x21')];_0x313353[_0x54e710][_0x002a('0x22')]=!![];_0x313353[_0x54e710][_0x002a('0x23')]=_0x1101a5['name'];_0x313353[_0x54e710]['interface']=_['isNil'](_0x1101a5['interface'])?util[_0x002a('0x24')](_0x002a('0x1d'),_0x1101a5[_0x002a('0x1a')]):_0x1101a5[_0x002a('0x1c')];if(_0x313353[_0x54e710][_0x002a('0x25')]){_0x313353[_0x54e710][_0x002a('0x26')]=moment()[_0x002a('0x24')](_0x002a('0x27'));}if(_0x313353[_0x54e710][_0x002a('0x28')]){_0x313353[_0x54e710][_0x002a('0x29')]=moment()['format'](_0x002a('0x27'));}RpcMemberReport[_0x002a('0x11')](_0x313353[_0x54e710]);}RpcVoiceQueueReport[_0x002a('0x2a')](_0x313353[_0x54e710]);}};function extractCalleridNumber(_0x33b7ff){var _0x3e1b34=_0x33b7ff['match'](/<(.*?)>/);return _0x3e1b34?_0x3e1b34[0x1]:_0x33b7ff;}Report[_0x002a('0x1e')][_0x002a('0x2b')]=function(_0x4d61b0){_0x4d61b0[_0x002a('0x2c')]=_0x4d61b0[_0x002a('0x2c')]||_0x4d61b0[_0x002a('0x2d')];if(_0x4d61b0[_0x002a('0x2e')]=='dialer'){_0x4d61b0[_0x002a('0x2f')]='queue';_0x4d61b0[_0x002a('0x30')]=_0x4d61b0[_0x002a('0x31')];if(_0x4d61b0['context']==_0x002a('0x32')){_0x4d61b0[_0x002a('0x21')]='';_0x4d61b0[_0x002a('0x2c')]=extractCalleridNumber(_0x4d61b0['callerid']);}else if(_0x4d61b0[_0x002a('0x33')]=='from-sip'){if(_0x4d61b0[_0x002a('0x2c')]==_0x002a('0x34')){_0x4d61b0['destination']=extractCalleridNumber(_0x4d61b0['calleridpreview']);_0x4d61b0[_0x002a('0x35')]=_0x4d61b0[_0x002a('0x36')];_0x4d61b0[_0x002a('0x37')]=[_0x4d61b0[_0x002a('0x38')],_0x4d61b0['channel']=_0x4d61b0['destinationchannel']][0x0];_0x4d61b0[_0x002a('0x39')]=_0x4d61b0['calleridpreview'];}else{_0x4d61b0['destination']=_0x4d61b0[_0x002a('0x35')];_0x4d61b0[_0x002a('0x35')]=_0x4d61b0[_0x002a('0x36')];if(_0x4d61b0[_0x002a('0x3a')]=='ANSWERED'){_0x4d61b0[_0x002a('0x21')]=_0x4d61b0[_0x002a('0x20')];}else{_0x4d61b0[_0x002a('0x21')]='';}}}}else{_0x4d61b0[_0x002a('0x39')]=util[_0x002a('0x24')](_0x002a('0x3b'),_0x4d61b0['calleridname'],_0x4d61b0['calleridnum']);}RpcVoiceCallReport['create'](_0x4d61b0);if(_0x4d61b0[_0x002a('0x3c')]){for(var _0x41a6ac=0x0;_0x41a6ac<_0x4d61b0[_0x002a('0x3d')][_0x002a('0x1f')];_0x41a6ac+=0x1){_0x4d61b0[_0x002a('0x3e')]=_0x4d61b0[_0x002a('0x3d')][_0x41a6ac][_0x002a('0x3f')];_0x4d61b0[_0x002a('0x40')]=_0x4d61b0[_0x002a('0x3d')][_0x41a6ac][_0x002a('0x40')];if(_0x4d61b0[_0x002a('0x2d')]==_0x002a('0x34')){_0x4d61b0[_0x002a('0x35')]=_0x4d61b0[_0x002a('0x20')];_0x4d61b0[_0x002a('0x41')]=_0x4d61b0[_0x002a('0x42')];_0x4d61b0['connectedlinenum']=_0x4d61b0[_0x002a('0x21')];_0x4d61b0['connectedlinename']=_0x4d61b0[_0x002a('0x43')];_0x4d61b0[_0x002a('0x2d')]=_0x4d61b0[_0x002a('0x36')];}else if(_0x4d61b0[_0x002a('0x2d')]==_0x002a('0x44')){_0x4d61b0[_0x002a('0x35')]=_0x4d61b0[_0x002a('0x2c')];_0x4d61b0[_0x002a('0x2d')]=_0x4d61b0[_0x002a('0x36')];}RpcVoiceRecording[_0x002a('0x2a')](_0x4d61b0);}}};Report['prototype'][_0x002a('0x15')]=function(_0x5d6f71){if(_[_0x002a('0x45')](_0x5d6f71)){_0x5d6f71[_0x002a('0x46')](function(_0x3fb1b4){RpcVoiceAgentReport['create'](_0x3fb1b4);});}else{RpcVoiceAgentReport['create'](_0x5d6f71);}};Report[_0x002a('0x1e')]['voiceDialReport']=function(_0x291572){RpcVoiceDialReport['create'](_0x291572);var _0x114e2f=undefined;var _0x514f02=_0x291572['channel'];if(_['startsWith'](_0x514f02,_0x002a('0x47'))){var _0x1e51e9=_0x514f02[_0x002a('0x48')](_0x514f02[_0x002a('0x49')]('/')+0x1,_0x514f02[_0x002a('0x49')]('@'));_0x114e2f=_[_0x002a('0x19')](this[_0x002a('0xd')],function(_0x367054){return _0x367054[_0x002a('0x4a')]==_0x1e51e9||_0x367054[_0x002a('0x4b')]==_0x1e51e9||_0x367054[_0x002a('0x21')]==_0x1e51e9;});}else{var _0x1e51e9=_0x514f02[_0x002a('0x48')](_0x514f02[_0x002a('0x49')]('/')+0x1,_0x514f02[_0x002a('0x4c')]('-'));_0x114e2f=this['findAgent'](_0x1e51e9);}if(_0x114e2f){_0x291572['interface']=_[_0x002a('0x1b')](_0x114e2f[_0x002a('0x1c')])?util[_0x002a('0x24')](_0x002a('0x1d'),_0x114e2f[_0x002a('0x1a')]):_0x114e2f[_0x002a('0x1c')];_0x291572[_0x002a('0x43')]=_0x114e2f[_0x002a('0x1a')];_0x291572[_0x002a('0x21')]=_0x114e2f[_0x002a('0x21')];RpcMemberReport[_0x002a('0x4d')](_0x291572);}};Report['prototype'][_0x002a('0x4e')]=function(_0x49f989){RpcVoiceTransferReport['blindTransfer'](_0x49f989);};Report[_0x002a('0x1e')][_0x002a('0x17')]=function(_0xe7c43f){RpcVoiceTransferReport[_0x002a('0x17')](_0xe7c43f);};module['exports']=Report; \ No newline at end of file +var _0xb182=['queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','dialer','lastapplication','queue','lastdata','from-voip-provider','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','callerid','disposition','calleridname','monitor','monitorFilename','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','forEach','channel','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','membername','blindTransfer','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./userReport','realtime','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceAgentReport','voiceDialReport','attendedtransfer','attendedTransfer','find','accountcode','isNil','agents','format','name','length','findAgent','connectedlinenum','lastAssignedTo','interface','SIP/%s','queuecallercompleteAt'];(function(_0x1e2aa6,_0x3c3306){var _0x2de440=function(_0x5b8e97){while(--_0x5b8e97){_0x1e2aa6['push'](_0x1e2aa6['shift']());}};_0x2de440(++_0x3c3306);}(_0xb182,0x78));var _0x2b18=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0xb182[_0x33554b];return _0x256954;};'use strict';var BPromise=require('bluebird');var _=require(_0x2b18('0x0'));var moment=require('moment');var util=require(_0x2b18('0x1'));var config=require(_0x2b18('0x2'));var logger=require('../../../config/logger')('ami');var ami=require(_0x2b18('0x3'));var RpcVoiceAgentReport=require(_0x2b18('0x4'));var RpcVoiceCallReport=require(_0x2b18('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x2b18('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x2b18('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x2b18('0x8'));var VoiceCallReport=require(_0x2b18('0x9'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x2b18('0xa'));function Report(_0x31fd98){this[_0x2b18('0xb')]=_0x31fd98;this['agents']=_0x31fd98['agents'];this[_0x2b18('0xc')]=_0x31fd98['telephones'];}Report[_0x2b18('0xd')][_0x2b18('0xe')]=function(_0x53307f){var _0x445a5a=new VoiceQueueReport(this[_0x2b18('0xb')]);var _0x4e26c9=new VoiceAgentReport(this['realtime']);var _0xaaf1c2=new VoiceDialReport(this[_0x2b18('0xb')]);var _0x44f5d0=new VoiceCallReport(this[_0x2b18('0xb')]);var _0x3ec9eb=new UserReport(this[_0x2b18('0xb')]);if(config[_0x2b18('0xf')]&&config[_0x2b18('0xf')][_0x2b18('0x10')]){ami['on'](_0x2b18('0x11'),this[_0x2b18('0x12')][_0x2b18('0x13')](this));ami['on'](_0x2b18('0x14'),this['voiceCallReport'][_0x2b18('0x13')](this));ami['on']('custom:voiceAgentReport',this[_0x2b18('0x15')][_0x2b18('0x13')](this));ami['on']('custom:voiceDialReport',this[_0x2b18('0x16')][_0x2b18('0x13')](this));ami['on']('blindtransfer',this['blindTransfer'][_0x2b18('0x13')](this));ami['on'](_0x2b18('0x17'),this[_0x2b18('0x18')][_0x2b18('0x13')](this));}};Report[_0x2b18('0xd')]['findAgent']=function(_0x27fd01){var _0x45c477=undefined;_0x45c477=_[_0x2b18('0x19')](this['agents'],function(_0x3a26d2){return _0x3a26d2[_0x2b18('0x1a')]==_0x27fd01||_0x3a26d2['name']==_0x27fd01;});if(_[_0x2b18('0x1b')](_0x45c477)){var _0x2b4665=_['find'](this[_0x2b18('0xc')],function(_0x52b119){return _0x52b119[_0x2b18('0x1a')]==_0x27fd01||_0x52b119['name']==_0x27fd01;});if(_0x2b4665){_0x45c477=_[_0x2b18('0x19')](this[_0x2b18('0x1c')],function(_0x373d7e){return _0x373d7e['interface']==util[_0x2b18('0x1d')]('SIP/%s',_0x2b4665[_0x2b18('0x1e')]);});}}return _0x45c477;};Report['prototype']['voiceQueueReport']=function(_0x50bb6b){for(var _0x55d0b5=0x0;_0x55d0b5<_0x50bb6b[_0x2b18('0x1f')];_0x55d0b5+=0x1){var _0x46f39d=this[_0x2b18('0x20')](_0x50bb6b[_0x55d0b5][_0x2b18('0x21')]);if(_0x46f39d){_0x50bb6b[_0x55d0b5][_0x2b18('0x1a')]=_0x46f39d['accountcode'];_0x50bb6b[_0x55d0b5]['assigned']=!![];_0x50bb6b[_0x55d0b5][_0x2b18('0x22')]=_0x46f39d[_0x2b18('0x1e')];_0x50bb6b[_0x55d0b5][_0x2b18('0x23')]=_['isNil'](_0x46f39d[_0x2b18('0x23')])?util[_0x2b18('0x1d')](_0x2b18('0x24'),_0x46f39d[_0x2b18('0x1e')]):_0x46f39d[_0x2b18('0x23')];if(_0x50bb6b[_0x55d0b5]['queuecallercomplete']){_0x50bb6b[_0x55d0b5][_0x2b18('0x25')]=moment()[_0x2b18('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x50bb6b[_0x55d0b5][_0x2b18('0x26')]){_0x50bb6b[_0x55d0b5][_0x2b18('0x27')]=moment()[_0x2b18('0x1d')](_0x2b18('0x28'));}RpcMemberReport['voiceQueueReport'](_0x50bb6b[_0x55d0b5]);}RpcVoiceQueueReport[_0x2b18('0x29')](_0x50bb6b[_0x55d0b5]);}};function extractCalleridNumber(_0xe16a61){var _0xa13677=_0xe16a61[_0x2b18('0x2a')](/<(.*?)>/);return _0xa13677?_0xa13677[0x1]:_0xe16a61;}Report['prototype']['voiceCallReport']=function(_0x5b7a83){_0x5b7a83[_0x2b18('0x2b')]=_0x5b7a83['destination']||_0x5b7a83[_0x2b18('0x2c')];if(_0x5b7a83['type']==_0x2b18('0x2d')){_0x5b7a83[_0x2b18('0x2e')]=_0x2b18('0x2f');_0x5b7a83[_0x2b18('0x30')]=_0x5b7a83[_0x2b18('0x2f')];if(_0x5b7a83['context']==_0x2b18('0x31')){_0x5b7a83[_0x2b18('0x1a')]='';_0x5b7a83[_0x2b18('0x2b')]=extractCalleridNumber(_0x5b7a83['callerid']);}else if(_0x5b7a83[_0x2b18('0x32')]==_0x2b18('0x33')){if(_0x5b7a83[_0x2b18('0x2b')]==_0x2b18('0x34')){_0x5b7a83['destination']=extractCalleridNumber(_0x5b7a83[_0x2b18('0x35')]);_0x5b7a83[_0x2b18('0x36')]=_0x5b7a83[_0x2b18('0x37')];_0x5b7a83[_0x2b18('0x38')]=[_0x5b7a83['channel'],_0x5b7a83['channel']=_0x5b7a83[_0x2b18('0x38')]][0x0];_0x5b7a83[_0x2b18('0x39')]=_0x5b7a83['calleridpreview'];}else{_0x5b7a83[_0x2b18('0x2b')]=_0x5b7a83['calleridnum'];_0x5b7a83['calleridnum']=_0x5b7a83['originatecalleridnum'];if(_0x5b7a83[_0x2b18('0x3a')]=='ANSWERED'){_0x5b7a83['accountcode']=_0x5b7a83[_0x2b18('0x21')];}else{_0x5b7a83[_0x2b18('0x1a')]='';}}}}else{_0x5b7a83['callerid']=util['format']('\x22%s\x22\x20<%s>',_0x5b7a83[_0x2b18('0x3b')],_0x5b7a83[_0x2b18('0x36')]);}RpcVoiceCallReport[_0x2b18('0x29')](_0x5b7a83);if(_0x5b7a83[_0x2b18('0x3c')]){for(var _0x12dfdd=0x0;_0x12dfdd<_0x5b7a83['monitors'][_0x2b18('0x1f')];_0x12dfdd+=0x1){_0x5b7a83[_0x2b18('0x3d')]=_0x5b7a83[_0x2b18('0x3e')][_0x12dfdd][_0x2b18('0x3f')];_0x5b7a83[_0x2b18('0x40')]=_0x5b7a83['monitors'][_0x12dfdd][_0x2b18('0x40')];if(_0x5b7a83['exten']==_0x2b18('0x34')){_0x5b7a83[_0x2b18('0x36')]=_0x5b7a83[_0x2b18('0x21')];_0x5b7a83[_0x2b18('0x3b')]=_0x5b7a83[_0x2b18('0x41')];_0x5b7a83[_0x2b18('0x21')]=_0x5b7a83[_0x2b18('0x1a')];_0x5b7a83[_0x2b18('0x41')]=_0x5b7a83['membername'];_0x5b7a83[_0x2b18('0x2c')]=_0x5b7a83['originatecalleridnum'];}else if(_0x5b7a83[_0x2b18('0x2c')]==_0x2b18('0x42')){_0x5b7a83[_0x2b18('0x36')]=_0x5b7a83['destination'];_0x5b7a83[_0x2b18('0x2c')]=_0x5b7a83[_0x2b18('0x37')];}RpcVoiceRecording[_0x2b18('0x29')](_0x5b7a83);}}};Report[_0x2b18('0xd')]['voiceAgentReport']=function(_0x1d0358){if(_['isArray'](_0x1d0358)){_0x1d0358[_0x2b18('0x43')](function(_0x275d02){RpcVoiceAgentReport['create'](_0x275d02);});}else{RpcVoiceAgentReport[_0x2b18('0x29')](_0x1d0358);}};Report[_0x2b18('0xd')][_0x2b18('0x16')]=function(_0x21f9a3){RpcVoiceDialReport[_0x2b18('0x29')](_0x21f9a3);var _0x132662=undefined;var _0x33f414=_0x21f9a3[_0x2b18('0x44')];if(_[_0x2b18('0x45')](_0x33f414,_0x2b18('0x46'))){var _0x4978aa=_0x33f414[_0x2b18('0x47')](_0x33f414[_0x2b18('0x48')]('/')+0x1,_0x33f414[_0x2b18('0x48')]('@'));_0x132662=_[_0x2b18('0x19')](this[_0x2b18('0x1c')],function(_0x118c3a){return _0x118c3a[_0x2b18('0x49')]==_0x4978aa||_0x118c3a[_0x2b18('0x4a')]==_0x4978aa||_0x118c3a[_0x2b18('0x1a')]==_0x4978aa;});}else{var _0x4978aa=_0x33f414[_0x2b18('0x47')](_0x33f414[_0x2b18('0x48')]('/')+0x1,_0x33f414[_0x2b18('0x4b')]('-'));_0x132662=this['findAgent'](_0x4978aa);}if(_0x132662){_0x21f9a3[_0x2b18('0x23')]=_[_0x2b18('0x1b')](_0x132662[_0x2b18('0x23')])?util[_0x2b18('0x1d')]('SIP/%s',_0x132662['name']):_0x132662[_0x2b18('0x23')];_0x21f9a3[_0x2b18('0x4c')]=_0x132662['name'];_0x21f9a3[_0x2b18('0x1a')]=_0x132662[_0x2b18('0x1a')];RpcMemberReport[_0x2b18('0x16')](_0x21f9a3);}};Report['prototype'][_0x2b18('0x4d')]=function(_0x25de95){RpcVoiceTransferReport[_0x2b18('0x4d')](_0x25de95);};Report[_0x2b18('0xd')]['attendedTransfer']=function(_0xfd319d){RpcVoiceTransferReport[_0x2b18('0x18')](_0xfd319d);};module[_0x2b18('0x4e')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 566b111..edf990e 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 _0x5ec0=['agents','telephones','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionDeviceStateList','[loopSyncRealTimeShow]','error','inspect','prototype','actionSipPeerStatus','catch','isNotNull','emit','trunks','state','merge','actionid','username','format','trunk:%s','trunk:save','[syncRegistry][UserReport]','device','local','inuse','toLowerCase','stateTime','toNumber','updateStatusRealtime','name','startsWith','Queue','indexOf','find','mobile','phone','accountcode','peer','registered','address','status','telephone:save','exports','lodash','moment','bluebird','util','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter'];(function(_0x3c6b7d,_0x5f0d90){var _0x1d3ed2=function(_0x1a8f35){while(--_0x1a8f35){_0x3c6b7d['push'](_0x3c6b7d['shift']());}};_0x1d3ed2(++_0x5f0d90);}(_0x5ec0,0x70));var _0x05ec=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5ec0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x05ec('0x0'));var moment=require(_0x05ec('0x1'));var BPromise=require(_0x05ec('0x2'));var util=require(_0x05ec('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x05ec('0x4'))('ami');var ami=require(_0x05ec('0x5'));config[_0x05ec('0x6')]=_[_0x05ec('0x7')](config[_0x05ec('0x6')],{'host':_0x05ec('0x8'),'port':0x18eb});var io=require(_0x05ec('0x9'))(new Redis(config[_0x05ec('0x6')]));function UserReport(_0x5184ef){this['trunks']=_0x5184ef['trunks'];this[_0x05ec('0xa')]=_0x5184ef[_0x05ec('0xa')];this['telephones']=_0x5184ef[_0x05ec('0xb')];ami['on']('registryentry',this[_0x05ec('0xc')]['bind'](this));ami['on']('registry',this[_0x05ec('0xc')][_0x05ec('0xd')](this));ami['on'](_0x05ec('0xe'),this[_0x05ec('0xf')][_0x05ec('0xd')](this));ami['on'](_0x05ec('0x10'),this[_0x05ec('0x11')][_0x05ec('0xd')](this));this[_0x05ec('0x12')]();return BPromise[_0x05ec('0x13')]()[_0x05ec('0x14')](ami[_0x05ec('0x15')]())[_0x05ec('0x14')](ami[_0x05ec('0x16')]())[_0x05ec('0x14')](ami['actionSipPeerStatus']())['catch'](loggerCatch(_0x05ec('0x17')));}function loggerCatch(_0x14d403){return function(_0x2a8e78){logger[_0x05ec('0x18')](_0x14d403,util[_0x05ec('0x19')](_0x2a8e78,{'showHidden':![],'depth':null}));};}UserReport[_0x05ec('0x1a')][_0x05ec('0x12')]=function(){setInterval(function(){BPromise[_0x05ec('0x13')]()['then'](ami[_0x05ec('0x15')]())[_0x05ec('0x14')](ami[_0x05ec('0x16')]())[_0x05ec('0x14')](ami[_0x05ec('0x1b')]())[_0x05ec('0x1c')](loggerCatch(_0x05ec('0x17')));},0x32c8);};UserReport['prototype'][_0x05ec('0x1d')]=function(_0x523dd5){return _0x523dd5!==null&&!_['isUndefined'](_0x523dd5);};UserReport[_0x05ec('0x1a')][_0x05ec('0x1e')]=function(_0xab658d,_0x3a0f05,_0x49152a){io['to'](_0xab658d)[_0x05ec('0x1e')](_0x3a0f05,_0x49152a);};UserReport['prototype'][_0x05ec('0xc')]=function(_0xc410ed){try{if(this[_0x05ec('0x1d')](_0xc410ed)){var _0x230740=_['find'](this[_0x05ec('0x1f')],{'registry':_0xc410ed['username']});if(_0x230740){_0xc410ed['stateRegistry']=_0xc410ed[_0x05ec('0x20')];_[_0x05ec('0x21')](_0x230740,_['omit'](_0xc410ed,['event',_0x05ec('0x22'),_0x05ec('0x23'),'state']));this[_0x05ec('0x1e')](util[_0x05ec('0x24')](_0x05ec('0x25'),_0x230740['name']),_0x05ec('0x26'),_0x230740);}}}catch(_0xd2281a){logger[_0x05ec('0x18')](_0x05ec('0x27'),util[_0x05ec('0x19')](_0xd2281a,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncDeviceState']=function(_0x272bae){try{if(this[_0x05ec('0x1d')](_0x272bae)){if(this[_0x05ec('0xa')][_0x272bae[_0x05ec('0x28')]]){if(!this[_0x05ec('0xa')][_0x272bae['device']][_0x05ec('0x29')]||_0x272bae[_0x05ec('0x20')]['toLowerCase']()==_0x05ec('0x2a')){this['agents'][_0x272bae[_0x05ec('0x28')]][_0x05ec('0x29')]=![];if(this[_0x05ec('0xa')][_0x272bae[_0x05ec('0x28')]][_0x05ec('0x20')]!==_0x272bae[_0x05ec('0x20')][_0x05ec('0x2b')]()){this['agents'][_0x272bae[_0x05ec('0x28')]][_0x05ec('0x2c')]=_[_0x05ec('0x2d')](moment()[_0x05ec('0x24')]('x'));}this[_0x05ec('0xa')][_0x272bae['device']][_0x05ec('0x20')]=_0x272bae[_0x05ec('0x20')][_0x05ec('0x2b')]();this[_0x05ec('0xa')][_0x272bae['device']][_0x05ec('0x2e')](_0x272bae);}}else if(this['telephones'][_0x272bae[_0x05ec('0x28')]]){if(this[_0x05ec('0xb')][_0x272bae[_0x05ec('0x28')]][_0x05ec('0x20')]!==_0x272bae[_0x05ec('0x20')]['toLowerCase']()){this[_0x05ec('0xb')][_0x272bae['device']][_0x05ec('0x2c')]=_[_0x05ec('0x2d')](moment()[_0x05ec('0x24')]('x'));}this[_0x05ec('0xb')][_0x272bae['device']][_0x05ec('0x20')]=_0x272bae[_0x05ec('0x20')][_0x05ec('0x2b')]();this[_0x05ec('0x1e')](util['format']('telephone:%s',this[_0x05ec('0xb')][_0x272bae[_0x05ec('0x28')]][_0x05ec('0x2f')]),'telephone:save',this[_0x05ec('0xb')][_0x272bae[_0x05ec('0x28')]]);}else if(this['trunks'][_0x272bae[_0x05ec('0x28')]]){if(this[_0x05ec('0x1f')][_0x272bae[_0x05ec('0x28')]]['state']!==_0x272bae[_0x05ec('0x20')][_0x05ec('0x2b')]()){this[_0x05ec('0x1f')][_0x272bae['device']][_0x05ec('0x2c')]=_['toNumber'](moment()[_0x05ec('0x24')]('x'));}this[_0x05ec('0x1f')][_0x272bae[_0x05ec('0x28')]][_0x05ec('0x20')]=_0x272bae[_0x05ec('0x20')][_0x05ec('0x2b')]();this['emit'](util[_0x05ec('0x24')](_0x05ec('0x25'),this[_0x05ec('0x1f')][_0x272bae['device']][_0x05ec('0x2f')]),'trunk:save',this[_0x05ec('0x1f')][_0x272bae[_0x05ec('0x28')]]);}else if(_[_0x05ec('0x30')](_0x272bae[_0x05ec('0x28')],_0x05ec('0x31'))){}else if(_[_0x05ec('0x30')](_0x272bae[_0x05ec('0x28')],'Local')){var _0xdd4840=_0x272bae['device'];var _0x39e746=_0xdd4840['substring'](_0xdd4840[_0x05ec('0x32')]('/')+0x1,_0xdd4840[_0x05ec('0x32')]('@'));var _0x30aa72=_[_0x05ec('0x33')](this[_0x05ec('0xa')],function(_0x22cf0a){return _0x22cf0a[_0x05ec('0x34')]==_0x39e746||_0x22cf0a[_0x05ec('0x35')]==_0x39e746||_0x22cf0a[_0x05ec('0x36')]==_0x39e746;});if(_0x30aa72){if(_0x30aa72[_0x05ec('0x20')]!==_0x272bae['state'][_0x05ec('0x2b')]()){_0x30aa72[_0x05ec('0x2c')]=_[_0x05ec('0x2d')](moment()['format']('x'));}_0x30aa72[_0x05ec('0x20')]=_0x272bae[_0x05ec('0x20')][_0x05ec('0x2b')]();_0x30aa72['local']=!![];_0x30aa72[_0x05ec('0x2e')](_0x272bae);}}else{}}}catch(_0x39ecf8){logger['error']('[syncDeviceState][UserReport]',util['inspect'](_0x39ecf8,{'showHidden':![],'depth':null}));}};UserReport[_0x05ec('0x1a')]['syncPeerStatus']=function(_0x5213ff){try{if(this[_0x05ec('0x1d')](_0x5213ff)&&this['isNotNull'](_0x5213ff['peerstatus'])){if(this['agents'][_0x5213ff[_0x05ec('0x37')]]){if(!this['agents'][_0x5213ff[_0x05ec('0x37')]][_0x05ec('0x29')]||_0x5213ff[_0x05ec('0x10')][_0x05ec('0x2b')]()==_0x05ec('0x38')){this[_0x05ec('0xa')][_0x5213ff[_0x05ec('0x37')]]['local']=![];this['agents'][_0x5213ff[_0x05ec('0x37')]]['status']=_0x5213ff[_0x05ec('0x10')][_0x05ec('0x2b')]();this[_0x05ec('0xa')][_0x5213ff[_0x05ec('0x37')]][_0x05ec('0x39')]=_0x5213ff[_0x05ec('0x39')];this['agents'][_0x5213ff['peer']][_0x05ec('0x2e')](_0x5213ff);}}else if(this[_0x05ec('0xb')][_0x5213ff['peer']]){this[_0x05ec('0xb')][_0x5213ff['peer']][_0x05ec('0x3a')]=_0x5213ff[_0x05ec('0x10')][_0x05ec('0x2b')]();this[_0x05ec('0xb')][_0x5213ff[_0x05ec('0x37')]][_0x05ec('0x39')]=_0x5213ff[_0x05ec('0x39')];this[_0x05ec('0x1e')](util[_0x05ec('0x24')]('telephone:%s',this[_0x05ec('0xb')][_0x5213ff[_0x05ec('0x37')]][_0x05ec('0x2f')]),_0x05ec('0x3b'),this[_0x05ec('0xb')][_0x5213ff['peer']]);}else if(this[_0x05ec('0x1f')][_0x5213ff['peer']]){this[_0x05ec('0x1f')][_0x5213ff['peer']][_0x05ec('0x3a')]=_0x5213ff[_0x05ec('0x10')]['toLowerCase']();this[_0x05ec('0x1f')][_0x5213ff[_0x05ec('0x37')]][_0x05ec('0x39')]=_0x5213ff[_0x05ec('0x39')];this[_0x05ec('0x1e')](util['format'](_0x05ec('0x25'),this[_0x05ec('0x1f')][_0x5213ff[_0x05ec('0x37')]][_0x05ec('0x2f')]),_0x05ec('0x26'),this['trunks'][_0x5213ff['peer']]);}else{}}}catch(_0x5c802d){logger['error']('[syncPeerStatus][UserReport]',util[_0x05ec('0x19')](_0x5c802d,{'showHidden':![],'depth':null}));}};module[_0x05ec('0x3c')]=UserReport; \ No newline at end of file +var _0x3d2a=['name','trunk:save','[syncRegistry][UserReport]','syncDeviceState','device','state','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','startsWith','Queue','Local','indexOf','mobile','accountcode','local','peer','status','address','emit','[syncPeerStatus][UserReport]','lodash','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','peerstatus','syncPeerStatus','loopSyncRealTimeShow','then','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','catch','error','inspect','prototype','resolve','isNotNull','isUndefined','find','stateRegistry','omit','actionid','format','trunk:%s'];(function(_0x4fd88d,_0x499f6d){var _0xdf3890=function(_0x46d564){while(--_0x46d564){_0x4fd88d['push'](_0x4fd88d['shift']());}};_0xdf3890(++_0x499f6d);}(_0x3d2a,0xdc));var _0xa3d2=function(_0x36aa05,_0x3117cc){_0x36aa05=_0x36aa05-0x0;var _0x293263=_0x3d2a[_0x36aa05];return _0x293263;};'use strict';var _=require(_0xa3d2('0x0'));var moment=require(_0xa3d2('0x1'));var BPromise=require(_0xa3d2('0x2'));var util=require(_0xa3d2('0x3'));var Redis=require(_0xa3d2('0x4'));var config=require(_0xa3d2('0x5'));var logger=require(_0xa3d2('0x6'))(_0xa3d2('0x7'));var ami=require(_0xa3d2('0x8'));config[_0xa3d2('0x9')]=_[_0xa3d2('0xa')](config[_0xa3d2('0x9')],{'host':_0xa3d2('0xb'),'port':0x18eb});var io=require(_0xa3d2('0xc'))(new Redis(config[_0xa3d2('0x9')]));function UserReport(_0x2faf46){this[_0xa3d2('0xd')]=_0x2faf46[_0xa3d2('0xd')];this[_0xa3d2('0xe')]=_0x2faf46[_0xa3d2('0xe')];this[_0xa3d2('0xf')]=_0x2faf46[_0xa3d2('0xf')];ami['on']('registryentry',this[_0xa3d2('0x10')][_0xa3d2('0x11')](this));ami['on'](_0xa3d2('0x12'),this[_0xa3d2('0x10')][_0xa3d2('0x11')](this));ami['on'](_0xa3d2('0x13'),this['syncDeviceState'][_0xa3d2('0x11')](this));ami['on'](_0xa3d2('0x14'),this[_0xa3d2('0x15')][_0xa3d2('0x11')](this));this[_0xa3d2('0x16')]();return BPromise['resolve']()[_0xa3d2('0x17')](ami[_0xa3d2('0x18')]())[_0xa3d2('0x17')](ami[_0xa3d2('0x19')]())[_0xa3d2('0x17')](ami[_0xa3d2('0x1a')]())[_0xa3d2('0x1b')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x5bb7e4){return function(_0x5227e4){logger[_0xa3d2('0x1c')](_0x5bb7e4,util[_0xa3d2('0x1d')](_0x5227e4,{'showHidden':![],'depth':null}));};}UserReport[_0xa3d2('0x1e')][_0xa3d2('0x16')]=function(){setInterval(function(){BPromise[_0xa3d2('0x1f')]()[_0xa3d2('0x17')](ami[_0xa3d2('0x18')]())[_0xa3d2('0x17')](ami[_0xa3d2('0x19')]())[_0xa3d2('0x17')](ami[_0xa3d2('0x1a')]())['catch'](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport['prototype'][_0xa3d2('0x20')]=function(_0x349d8f){return _0x349d8f!==null&&!_[_0xa3d2('0x21')](_0x349d8f);};UserReport[_0xa3d2('0x1e')]['emit']=function(_0x5f02b1,_0x5e1fa7,_0x4bd84c){io['to'](_0x5f02b1)['emit'](_0x5e1fa7,_0x4bd84c);};UserReport[_0xa3d2('0x1e')][_0xa3d2('0x10')]=function(_0x25fcbe){try{if(this[_0xa3d2('0x20')](_0x25fcbe)){var _0x14eb59=_[_0xa3d2('0x22')](this[_0xa3d2('0xd')],{'registry':_0x25fcbe['username']});if(_0x14eb59){_0x25fcbe[_0xa3d2('0x23')]=_0x25fcbe['state'];_['merge'](_0x14eb59,_[_0xa3d2('0x24')](_0x25fcbe,['event',_0xa3d2('0x25'),'username','state']));this['emit'](util[_0xa3d2('0x26')](_0xa3d2('0x27'),_0x14eb59[_0xa3d2('0x28')]),_0xa3d2('0x29'),_0x14eb59);}}}catch(_0x188595){logger[_0xa3d2('0x1c')](_0xa3d2('0x2a'),util[_0xa3d2('0x1d')](_0x188595,{'showHidden':![],'depth':null}));}};UserReport[_0xa3d2('0x1e')][_0xa3d2('0x2b')]=function(_0xcd6e2f){try{if(this[_0xa3d2('0x20')](_0xcd6e2f)){if(this[_0xa3d2('0xe')][_0xcd6e2f[_0xa3d2('0x2c')]]){if(!this[_0xa3d2('0xe')][_0xcd6e2f[_0xa3d2('0x2c')]]['local']||_0xcd6e2f[_0xa3d2('0x2d')][_0xa3d2('0x2e')]()==_0xa3d2('0x2f')){this[_0xa3d2('0xe')][_0xcd6e2f[_0xa3d2('0x2c')]]['local']=![];if(this[_0xa3d2('0xe')][_0xcd6e2f[_0xa3d2('0x2c')]][_0xa3d2('0x2d')]!==_0xcd6e2f[_0xa3d2('0x2d')]['toLowerCase']()){this['agents'][_0xcd6e2f[_0xa3d2('0x2c')]][_0xa3d2('0x30')]=_[_0xa3d2('0x31')](moment()[_0xa3d2('0x26')]('x'));}this[_0xa3d2('0xe')][_0xcd6e2f[_0xa3d2('0x2c')]][_0xa3d2('0x2d')]=_0xcd6e2f[_0xa3d2('0x2d')][_0xa3d2('0x2e')]();this[_0xa3d2('0xe')][_0xcd6e2f[_0xa3d2('0x2c')]][_0xa3d2('0x32')](_0xcd6e2f);}}else if(this[_0xa3d2('0xf')][_0xcd6e2f['device']]){if(this[_0xa3d2('0xf')][_0xcd6e2f[_0xa3d2('0x2c')]]['state']!==_0xcd6e2f[_0xa3d2('0x2d')]['toLowerCase']()){this['telephones'][_0xcd6e2f[_0xa3d2('0x2c')]][_0xa3d2('0x30')]=_[_0xa3d2('0x31')](moment()[_0xa3d2('0x26')]('x'));}this['telephones'][_0xcd6e2f['device']]['state']=_0xcd6e2f[_0xa3d2('0x2d')][_0xa3d2('0x2e')]();this['emit'](util[_0xa3d2('0x26')](_0xa3d2('0x33'),this[_0xa3d2('0xf')][_0xcd6e2f[_0xa3d2('0x2c')]][_0xa3d2('0x28')]),_0xa3d2('0x34'),this[_0xa3d2('0xf')][_0xcd6e2f[_0xa3d2('0x2c')]]);}else if(this['trunks'][_0xcd6e2f['device']]){if(this['trunks'][_0xcd6e2f[_0xa3d2('0x2c')]][_0xa3d2('0x2d')]!==_0xcd6e2f[_0xa3d2('0x2d')]['toLowerCase']()){this['trunks'][_0xcd6e2f[_0xa3d2('0x2c')]][_0xa3d2('0x30')]=_['toNumber'](moment()['format']('x'));}this[_0xa3d2('0xd')][_0xcd6e2f[_0xa3d2('0x2c')]][_0xa3d2('0x2d')]=_0xcd6e2f[_0xa3d2('0x2d')]['toLowerCase']();this['emit'](util['format'](_0xa3d2('0x27'),this[_0xa3d2('0xd')][_0xcd6e2f[_0xa3d2('0x2c')]][_0xa3d2('0x28')]),'trunk:save',this[_0xa3d2('0xd')][_0xcd6e2f[_0xa3d2('0x2c')]]);}else if(_[_0xa3d2('0x35')](_0xcd6e2f[_0xa3d2('0x2c')],_0xa3d2('0x36'))){}else if(_[_0xa3d2('0x35')](_0xcd6e2f['device'],_0xa3d2('0x37'))){var _0x25ed18=_0xcd6e2f[_0xa3d2('0x2c')];var _0x3444b8=_0x25ed18['substring'](_0x25ed18[_0xa3d2('0x38')]('/')+0x1,_0x25ed18[_0xa3d2('0x38')]('@'));var _0x85adff=_[_0xa3d2('0x22')](this[_0xa3d2('0xe')],function(_0x325a6a){return _0x325a6a[_0xa3d2('0x39')]==_0x3444b8||_0x325a6a['phone']==_0x3444b8||_0x325a6a[_0xa3d2('0x3a')]==_0x3444b8;});if(_0x85adff){if(_0x85adff[_0xa3d2('0x2d')]!==_0xcd6e2f[_0xa3d2('0x2d')]['toLowerCase']()){_0x85adff['stateTime']=_[_0xa3d2('0x31')](moment()[_0xa3d2('0x26')]('x'));}_0x85adff[_0xa3d2('0x2d')]=_0xcd6e2f[_0xa3d2('0x2d')][_0xa3d2('0x2e')]();_0x85adff[_0xa3d2('0x3b')]=!![];_0x85adff[_0xa3d2('0x32')](_0xcd6e2f);}}else{}}}catch(_0x1e4866){logger[_0xa3d2('0x1c')]('[syncDeviceState][UserReport]',util[_0xa3d2('0x1d')](_0x1e4866,{'showHidden':![],'depth':null}));}};UserReport[_0xa3d2('0x1e')][_0xa3d2('0x15')]=function(_0x4b5d53){try{if(this[_0xa3d2('0x20')](_0x4b5d53)&&this[_0xa3d2('0x20')](_0x4b5d53['peerstatus'])){if(this[_0xa3d2('0xe')][_0x4b5d53[_0xa3d2('0x3c')]]){if(!this[_0xa3d2('0xe')][_0x4b5d53[_0xa3d2('0x3c')]]['local']||_0x4b5d53[_0xa3d2('0x14')][_0xa3d2('0x2e')]()=='registered'){this[_0xa3d2('0xe')][_0x4b5d53[_0xa3d2('0x3c')]]['local']=![];this['agents'][_0x4b5d53[_0xa3d2('0x3c')]][_0xa3d2('0x3d')]=_0x4b5d53['peerstatus']['toLowerCase']();this[_0xa3d2('0xe')][_0x4b5d53['peer']]['address']=_0x4b5d53['address'];this[_0xa3d2('0xe')][_0x4b5d53[_0xa3d2('0x3c')]]['updateStatusRealtime'](_0x4b5d53);}}else if(this[_0xa3d2('0xf')][_0x4b5d53['peer']]){this[_0xa3d2('0xf')][_0x4b5d53[_0xa3d2('0x3c')]][_0xa3d2('0x3d')]=_0x4b5d53[_0xa3d2('0x14')][_0xa3d2('0x2e')]();this[_0xa3d2('0xf')][_0x4b5d53[_0xa3d2('0x3c')]][_0xa3d2('0x3e')]=_0x4b5d53['address'];this['emit'](util[_0xa3d2('0x26')](_0xa3d2('0x33'),this['telephones'][_0x4b5d53[_0xa3d2('0x3c')]][_0xa3d2('0x28')]),_0xa3d2('0x34'),this[_0xa3d2('0xf')][_0x4b5d53['peer']]);}else if(this[_0xa3d2('0xd')][_0x4b5d53[_0xa3d2('0x3c')]]){this[_0xa3d2('0xd')][_0x4b5d53[_0xa3d2('0x3c')]][_0xa3d2('0x3d')]=_0x4b5d53[_0xa3d2('0x14')][_0xa3d2('0x2e')]();this[_0xa3d2('0xd')][_0x4b5d53['peer']]['address']=_0x4b5d53[_0xa3d2('0x3e')];this[_0xa3d2('0x3f')](util['format'](_0xa3d2('0x27'),this['trunks'][_0x4b5d53[_0xa3d2('0x3c')]][_0xa3d2('0x28')]),'trunk:save',this['trunks'][_0x4b5d53['peer']]);}else{}}}catch(_0x43329b){logger[_0xa3d2('0x1c')](_0xa3d2('0x40'),util[_0xa3d2('0x1d')](_0x43329b,{'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 7763402..7e38364 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 _0xfbc6=['syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','uniqueid','isUndefined','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','queue','inbound','omit','event','privilege','custom:agentcalled','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','pick','destconnectedlinenum','membername','user:agentconnect','custom:agentconnect','agentringnoanswerAt','answered_elsewhere','answeredelsewheremembername','reason','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','isNotNull','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','syncAgentComplete','agentcompleteAt','complete','talktime','agent','agentacw','acwtime','acwTimeout','interface','user:%s','custom:agentcomplete','addVariable','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','transfer','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','[syncMusicOnHoldStart][VoiceAgentReport]','onhold','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect'];(function(_0x10aa47,_0x2be4fa){var _0x2c0cd1=function(_0x47ad5c){while(--_0x47ad5c){_0x10aa47['push'](_0x10aa47['shift']());}};_0x2c0cd1(++_0x2be4fa);}(_0xfbc6,0xef));var _0x6fbc=function(_0x42d7f4,_0x5e9ae8){_0x42d7f4=_0x42d7f4-0x0;var _0x49e630=_0xfbc6[_0x42d7f4];return _0x49e630;};'use strict';var _=require(_0x6fbc('0x0'));var moment=require(_0x6fbc('0x1'));var util=require(_0x6fbc('0x2'));var Redis=require(_0x6fbc('0x3'));var config=require(_0x6fbc('0x4'));var logger=require(_0x6fbc('0x5'))(_0x6fbc('0x6'));var ami=require(_0x6fbc('0x7'));config['redis']=_[_0x6fbc('0x8')](config[_0x6fbc('0x9')],{'host':_0x6fbc('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6fbc('0x9')]));function VoiceAgentReport(_0x56a61d){this[_0x6fbc('0xb')]={};this[_0x6fbc('0xc')]=_0x56a61d[_0x6fbc('0xc')];this[_0x6fbc('0xd')]=_0x56a61d[_0x6fbc('0xd')];this[_0x6fbc('0xe')]={};ami['on'](_0x6fbc('0xf'),this[_0x6fbc('0x10')][_0x6fbc('0x11')](this));ami['on'](_0x6fbc('0x12'),this[_0x6fbc('0x13')][_0x6fbc('0x11')](this));ami['on'](_0x6fbc('0x14'),this[_0x6fbc('0x15')][_0x6fbc('0x11')](this));ami['on'](_0x6fbc('0x16'),this['syncQueueCallerAbandon'][_0x6fbc('0x11')](this));ami['on'](_0x6fbc('0x17'),this['syncAgentComplete']['bind'](this));ami['on'](_0x6fbc('0x18'),this[_0x6fbc('0x19')][_0x6fbc('0x11')](this));ami['on'](_0x6fbc('0x1a'),this[_0x6fbc('0x1b')][_0x6fbc('0x11')](this));ami['on']('musiconholdstart',this[_0x6fbc('0x1c')][_0x6fbc('0x11')](this));ami['on'](_0x6fbc('0x1d'),this[_0x6fbc('0x1e')][_0x6fbc('0x11')](this));ami['on'](_0x6fbc('0x1f'),this[_0x6fbc('0x20')][_0x6fbc('0x11')](this));ami['on'](_0x6fbc('0x21'),this[_0x6fbc('0x22')][_0x6fbc('0x11')](this));}VoiceAgentReport['prototype'][_0x6fbc('0x23')]=function(_0x50aaf2,_0x5dd39c,_0x281240){io['to'](_0x50aaf2)[_0x6fbc('0x23')](_0x5dd39c,_0x281240);};VoiceAgentReport[_0x6fbc('0x24')]['isNotNull']=function(_0x5c65fe){return _0x5c65fe!==null&&!_['isUndefined'](_0x5c65fe);};VoiceAgentReport[_0x6fbc('0x24')][_0x6fbc('0x10')]=function(_0x4b2f00){try{if(this['isNotNull'](_0x4b2f00)){if(_['isUndefined'](this[_0x6fbc('0xb')][_0x4b2f00[_0x6fbc('0x25')]])){this[_0x6fbc('0xb')][_0x4b2f00[_0x6fbc('0x25')]]={};}if(_[_0x6fbc('0x26')](this[_0x6fbc('0xb')][_0x4b2f00[_0x6fbc('0x25')]][_0x4b2f00[_0x6fbc('0x27')]])){this[_0x6fbc('0xb')][_0x4b2f00['uniqueid']][_0x4b2f00[_0x6fbc('0x27')]]={'agentcalledAt':moment()[_0x6fbc('0x28')](_0x6fbc('0x29')),'lastevent':'called','variables':this[_0x6fbc('0xe')][_0x4b2f00['uniqueid']],'type':this[_0x6fbc('0xc')][_0x4b2f00[_0x6fbc('0x2a')]]?this[_0x6fbc('0xc')][_0x4b2f00['queue']]['type']||_0x6fbc('0x2b'):_0x6fbc('0x2b')};}_['merge'](this['channels'][_0x4b2f00[_0x6fbc('0x25')]][_0x4b2f00[_0x6fbc('0x27')]],_[_0x6fbc('0x2c')](_0x4b2f00,[_0x6fbc('0x2d'),_0x6fbc('0x2e')]));ami[_0x6fbc('0x23')](_0x6fbc('0x2f'),this[_0x6fbc('0xb')][_0x4b2f00[_0x6fbc('0x25')]][_0x4b2f00[_0x6fbc('0x27')]]);this[_0x6fbc('0x23')](util['format']('user:%s',_0x4b2f00['membername']),_0x6fbc('0x30'),this['channels'][_0x4b2f00[_0x6fbc('0x25')]][_0x4b2f00[_0x6fbc('0x27')]]);}}catch(_0x23a0a4){logger[_0x6fbc('0x31')](_0x6fbc('0x32'),util[_0x6fbc('0x33')](_0x23a0a4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6fbc('0x24')]['syncAgentConnect']=function(_0xb96c94){try{if(this['isNotNull'](_0xb96c94)){if(this[_0x6fbc('0xb')][_0xb96c94[_0x6fbc('0x25')]]){for(var _0x6dae27 in this[_0x6fbc('0xb')][_0xb96c94[_0x6fbc('0x25')]]){if(this[_0x6fbc('0xb')][_0xb96c94[_0x6fbc('0x25')]][_0x6fbc('0x34')](_0x6dae27)){if(_0xb96c94[_0x6fbc('0x27')]===_0x6dae27){this[_0x6fbc('0xb')][_0xb96c94[_0x6fbc('0x25')]][_0x6dae27][_0x6fbc('0x35')]=moment()[_0x6fbc('0x28')](_0x6fbc('0x29'));this[_0x6fbc('0xb')][_0xb96c94[_0x6fbc('0x25')]][_0x6dae27][_0x6fbc('0x36')]=_0x6fbc('0x37');this[_0x6fbc('0xb')][_0xb96c94[_0x6fbc('0x25')]][_0x6dae27][_0x6fbc('0x38')]=_0xb96c94[_0x6fbc('0x38')];this[_0x6fbc('0xb')][_0xb96c94[_0x6fbc('0x25')]][_0x6dae27][_0x6fbc('0x39')]=_0xb96c94['connectedlinenum'];this[_0x6fbc('0xb')][_0xb96c94[_0x6fbc('0x25')]][_0x6dae27][_0x6fbc('0x3a')]=_0xb96c94[_0x6fbc('0x3a')];this[_0x6fbc('0xb')][_0xb96c94[_0x6fbc('0x25')]][_0x6dae27]['destchannelstate']=_0xb96c94[_0x6fbc('0x3b')];this[_0x6fbc('0xb')][_0xb96c94[_0x6fbc('0x25')]][_0x6dae27][_0x6fbc('0x3c')]=_0xb96c94[_0x6fbc('0x3c')];_['merge'](this[_0x6fbc('0xd')][_0xb96c94['interface']],_[_0x6fbc('0x3d')](_0xb96c94,[_0x6fbc('0x2a'),_0x6fbc('0x3e')]));this['emit'](util[_0x6fbc('0x28')]('user:%s',_0xb96c94[_0x6fbc('0x3f')]),_0x6fbc('0x40'),this['channels'][_0xb96c94[_0x6fbc('0x25')]][_0xb96c94['destuniqueid']]);ami[_0x6fbc('0x23')](_0x6fbc('0x41'),this[_0x6fbc('0xb')][_0xb96c94['uniqueid']][_0x6dae27]);}else if(!this[_0x6fbc('0xb')][_0xb96c94[_0x6fbc('0x25')]][_0x6dae27][_0x6fbc('0x14')]&&!this[_0x6fbc('0xb')][_0xb96c94[_0x6fbc('0x25')]][_0x6dae27][_0x6fbc('0x17')]){this[_0x6fbc('0xb')][_0xb96c94[_0x6fbc('0x25')]][_0x6dae27][_0x6fbc('0x14')]=!![];this[_0x6fbc('0xb')][_0xb96c94[_0x6fbc('0x25')]][_0x6dae27][_0x6fbc('0x42')]=moment()[_0x6fbc('0x28')](_0x6fbc('0x29'));this[_0x6fbc('0xb')][_0xb96c94[_0x6fbc('0x25')]][_0x6dae27]['reason']=_0x6fbc('0x43');this[_0x6fbc('0xb')][_0xb96c94['uniqueid']][_0x6dae27][_0x6fbc('0x36')]=_0x6fbc('0x43');this['channels'][_0xb96c94[_0x6fbc('0x25')]][_0x6dae27]['answeredelsewheredestinationuniqueid']=_0xb96c94[_0x6fbc('0x27')];this[_0x6fbc('0xb')][_0xb96c94[_0x6fbc('0x25')]][_0x6dae27][_0x6fbc('0x44')]=_0xb96c94[_0x6fbc('0x3f')];ami[_0x6fbc('0x23')]('custom:agentansweredelsewhere',this[_0x6fbc('0xb')][_0xb96c94['uniqueid']][_0x6dae27]);}}}}}}catch(_0x3a1676){logger['error']('[syncAgentConnect][VoiceAgentReport]',util[_0x6fbc('0x33')](_0x3a1676,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6fbc('0x24')][_0x6fbc('0x15')]=function(_0x20354b){try{if(this['isNotNull'](_0x20354b)){if(this[_0x6fbc('0xb')][_0x20354b[_0x6fbc('0x25')]]&&this[_0x6fbc('0xb')][_0x20354b[_0x6fbc('0x25')]][_0x20354b[_0x6fbc('0x27')]]){this[_0x6fbc('0xb')][_0x20354b[_0x6fbc('0x25')]][_0x20354b[_0x6fbc('0x27')]]['agentringnoanswer']=!![];this['channels'][_0x20354b[_0x6fbc('0x25')]][_0x20354b[_0x6fbc('0x27')]][_0x6fbc('0x42')]=moment()[_0x6fbc('0x28')](_0x6fbc('0x29'));this[_0x6fbc('0xb')][_0x20354b[_0x6fbc('0x25')]][_0x20354b['destuniqueid']][_0x6fbc('0x45')]=_0x6fbc('0x46');this[_0x6fbc('0xb')][_0x20354b[_0x6fbc('0x25')]][_0x20354b[_0x6fbc('0x27')]][_0x6fbc('0x36')]=_0x6fbc('0x46');ami[_0x6fbc('0x23')](_0x6fbc('0x47'),this[_0x6fbc('0xb')][_0x20354b[_0x6fbc('0x25')]][_0x20354b[_0x6fbc('0x27')]]);}}}catch(_0x4d8f1a){logger[_0x6fbc('0x31')](_0x6fbc('0x48'),util[_0x6fbc('0x33')](_0x4d8f1a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6fbc('0x24')][_0x6fbc('0x49')]=function(_0x246a3d){try{if(this[_0x6fbc('0x4a')](_0x246a3d)){if(this[_0x6fbc('0xb')][_0x246a3d[_0x6fbc('0x25')]]){for(var _0x14e3d6 in this[_0x6fbc('0xb')][_0x246a3d[_0x6fbc('0x25')]]){if(this[_0x6fbc('0xb')][_0x246a3d[_0x6fbc('0x25')]][_0x6fbc('0x34')](_0x14e3d6)&&!this[_0x6fbc('0xb')][_0x246a3d[_0x6fbc('0x25')]][_0x14e3d6][_0x6fbc('0x14')]&&!this[_0x6fbc('0xb')][_0x246a3d['uniqueid']][_0x14e3d6]['agentcomplete']){this['channels'][_0x246a3d[_0x6fbc('0x25')]][_0x14e3d6][_0x6fbc('0x14')]=!![];this[_0x6fbc('0xb')][_0x246a3d[_0x6fbc('0x25')]][_0x14e3d6][_0x6fbc('0x42')]=moment()[_0x6fbc('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x246a3d[_0x6fbc('0x25')]][_0x14e3d6][_0x6fbc('0x45')]=_0x6fbc('0x4b');this[_0x6fbc('0xb')][_0x246a3d[_0x6fbc('0x25')]][_0x14e3d6][_0x6fbc('0x36')]=_0x6fbc('0x4b');ami[_0x6fbc('0x23')](_0x6fbc('0x4c'),this['channels'][_0x246a3d[_0x6fbc('0x25')]][_0x14e3d6]);}}}}}catch(_0x799c31){logger[_0x6fbc('0x31')](_0x6fbc('0x4d'),util[_0x6fbc('0x33')](_0x799c31,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6fbc('0x24')][_0x6fbc('0x4e')]=function(_0x485d66){try{if(this[_0x6fbc('0x4a')](_0x485d66)){if(this['channels'][_0x485d66[_0x6fbc('0x25')]]){for(var _0x4fbfef in this['channels'][_0x485d66[_0x6fbc('0x25')]]){if(this[_0x6fbc('0xb')][_0x485d66[_0x6fbc('0x25')]][_0x6fbc('0x34')](_0x4fbfef)){if(this[_0x6fbc('0xb')][_0x485d66[_0x6fbc('0x25')]][_0x4fbfef]['agentconnectAt']&&!this[_0x6fbc('0xb')][_0x485d66[_0x6fbc('0x25')]][_0x4fbfef][_0x6fbc('0x17')]){this[_0x6fbc('0xb')][_0x485d66[_0x6fbc('0x25')]][_0x4fbfef][_0x6fbc('0x17')]=!![];this[_0x6fbc('0xb')][_0x485d66[_0x6fbc('0x25')]][_0x4fbfef][_0x6fbc('0x4f')]=moment()[_0x6fbc('0x28')](_0x6fbc('0x29'));this[_0x6fbc('0xb')][_0x485d66[_0x6fbc('0x25')]][_0x4fbfef][_0x6fbc('0x36')]=_0x6fbc('0x50');this[_0x6fbc('0xb')][_0x485d66[_0x6fbc('0x25')]][_0x4fbfef]['talktime']=_0x485d66[_0x6fbc('0x51')];this['channels'][_0x485d66[_0x6fbc('0x25')]][_0x4fbfef][_0x6fbc('0x45')]=_0x485d66[_0x6fbc('0x45')]=='transfer'?_0x6fbc('0x52'):_0x485d66[_0x6fbc('0x45')];if(this[_0x6fbc('0xc')][_0x485d66[_0x6fbc('0x2a')]]&&this[_0x6fbc('0xc')][_0x485d66[_0x6fbc('0x2a')]]['acw']){this[_0x6fbc('0xb')][_0x485d66[_0x6fbc('0x25')]][_0x4fbfef][_0x6fbc('0x53')]=!![];this[_0x6fbc('0xb')][_0x485d66[_0x6fbc('0x25')]][_0x4fbfef][_0x6fbc('0x54')]=this[_0x6fbc('0xc')][_0x485d66[_0x6fbc('0x2a')]][_0x6fbc('0x55')];}this[_0x6fbc('0xd')][_0x485d66[_0x6fbc('0x56')]]=_['omit'](this[_0x6fbc('0xd')][_0x485d66['interface']],[_0x6fbc('0x2a'),_0x6fbc('0x3e')]);this['emit'](util[_0x6fbc('0x28')](_0x6fbc('0x57'),_0x485d66[_0x6fbc('0x3f')]),'user:agentcomplete',this[_0x6fbc('0xb')][_0x485d66[_0x6fbc('0x25')]][_0x4fbfef]);ami[_0x6fbc('0x23')](_0x6fbc('0x58'),this[_0x6fbc('0xb')][_0x485d66[_0x6fbc('0x25')]][_0x4fbfef]);}}}}}}catch(_0x506524){logger['error']('[syncAgentComplete][VoiceAgentReport]',util[_0x6fbc('0x33')](_0x506524,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6fbc('0x24')]['syncVarSet']=function(_0x3b9a65){try{if(this[_0x6fbc('0x4a')](_0x3b9a65)){this[_0x6fbc('0x59')](_0x3b9a65[_0x6fbc('0x25')],_['keys'](_0x3b9a65[_0x6fbc('0x5a')])[0x0],_0x3b9a65[_0x6fbc('0x5b')]);if(this[_0x6fbc('0xb')][_0x3b9a65[_0x6fbc('0x25')]]){for(var _0x46f653 in this['channels'][_0x3b9a65[_0x6fbc('0x25')]]){if(this['channels'][_0x3b9a65[_0x6fbc('0x25')]]['hasOwnProperty'](_0x46f653)){if(_[_0x6fbc('0x26')](this['channels'][_0x3b9a65['uniqueid']][_0x46f653][_0x6fbc('0xe')])){this[_0x6fbc('0xb')][_0x3b9a65[_0x6fbc('0x25')]][_0x46f653][_0x6fbc('0xe')]={};}this['channels'][_0x3b9a65[_0x6fbc('0x25')]][_0x46f653]['variables']=this[_0x6fbc('0xe')][_0x3b9a65[_0x6fbc('0x25')]];}}}}}catch(_0x36b026){logger[_0x6fbc('0x31')](_0x6fbc('0x5c'),util[_0x6fbc('0x33')](_0x36b026,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6fbc('0x24')][_0x6fbc('0x59')]=function(_0x57a06f,_0x245b36,_0x14db05){var _0x3d2f7f=[_0x6fbc('0x5d'),_0x6fbc('0x5e'),_0x6fbc('0x5f'),_0x6fbc('0x60'),'rtpaudioqosloss',_0x6fbc('0x61'),_0x6fbc('0x62'),'rtpaudioqosrttbridged',_0x6fbc('0x63'),_0x6fbc('0x64'),_0x6fbc('0x65'),'bridgepvtcallid',_0x6fbc('0x66'),_0x6fbc('0x67'),_0x6fbc('0x68'),_0x6fbc('0x69'),'membername',_0x6fbc('0x6a'),_0x6fbc('0x6b')];if(!_[_0x6fbc('0x6c')](_0x245b36)&&!_[_0x6fbc('0x6d')](_0x3d2f7f,_0x245b36)){if(_['isUndefined'](this[_0x6fbc('0xe')][_0x57a06f])){this[_0x6fbc('0xe')][_0x57a06f]={};}this[_0x6fbc('0xe')][_0x57a06f][_0x245b36]=_0x14db05;}};VoiceAgentReport[_0x6fbc('0x24')][_0x6fbc('0x1b')]=function(_0x5d0ffa){try{if(this[_0x6fbc('0x4a')](_0x5d0ffa)){if(this[_0x6fbc('0xb')][_0x5d0ffa[_0x6fbc('0x25')]]){for(var _0xcaed21 in this[_0x6fbc('0xb')][_0x5d0ffa[_0x6fbc('0x25')]]){if(this['channels'][_0x5d0ffa['uniqueid']][_0x6fbc('0x34')](_0xcaed21)){if(this[_0x6fbc('0xb')][_0x5d0ffa[_0x6fbc('0x25')]][_0xcaed21][_0x6fbc('0x45')]=='transfer'&&this[_0x6fbc('0xb')][_0x5d0ffa[_0x6fbc('0x25')]][_0xcaed21]['agentcomplete']){this[_0x6fbc('0xb')][_0x5d0ffa[_0x6fbc('0x25')]][_0xcaed21][_0x6fbc('0x4f')]=moment()['format'](_0x6fbc('0x29'));}}}ami[_0x6fbc('0x23')](_0x6fbc('0x6e'),_[_0x6fbc('0x6f')](this[_0x6fbc('0xb')][_0x5d0ffa[_0x6fbc('0x25')]]));delete this['channels'][_0x5d0ffa['uniqueid']];}if(this['variables'][_0x5d0ffa[_0x6fbc('0x25')]]){delete this['variables'][_0x5d0ffa['uniqueid']];}}}catch(_0x27aecc){logger[_0x6fbc('0x31')](_0x6fbc('0x70'),util[_0x6fbc('0x33')](_0x27aecc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6fbc('0x24')][_0x6fbc('0x20')]=function(_0x56e355){try{if(this[_0x6fbc('0x4a')](_0x56e355)){if(this['channels'][_0x56e355['transfereeuniqueid']]){for(var _0x5a0ad3 in this[_0x6fbc('0xb')][_0x56e355[_0x6fbc('0x71')]]){if(this[_0x6fbc('0xb')][_0x56e355['transfereeuniqueid']][_0x6fbc('0x34')](_0x5a0ad3)){if(_0x56e355[_0x6fbc('0x72')]===_0x5a0ad3){var _0x327af6=moment();this[_0x6fbc('0xb')][_0x56e355[_0x6fbc('0x71')]][_0x5a0ad3][_0x6fbc('0x17')]=!![];this[_0x6fbc('0xb')][_0x56e355[_0x6fbc('0x71')]][_0x5a0ad3]['agentcompleteAt']=moment()[_0x6fbc('0x28')](_0x6fbc('0x29'));this['channels'][_0x56e355[_0x6fbc('0x71')]][_0x5a0ad3][_0x6fbc('0x45')]='transfer';this[_0x6fbc('0xb')][_0x56e355[_0x6fbc('0x71')]][_0x5a0ad3][_0x6fbc('0x36')]='complete';this['channels'][_0x56e355['transfereeuniqueid']][_0x5a0ad3]['talktime']=_0x327af6[_0x6fbc('0x73')](this[_0x6fbc('0xb')][_0x56e355[_0x6fbc('0x71')]][_0x5a0ad3][_0x6fbc('0x35')],_0x6fbc('0x74'));}}}}if(this[_0x6fbc('0xb')][_0x56e355[_0x6fbc('0x75')]]){var _0x29920f=this[_0x6fbc('0xb')][_0x56e355['secondtransfereruniqueid']];this[_0x6fbc('0xb')][_0x56e355[_0x6fbc('0x75')]]=this[_0x6fbc('0xb')][_0x56e355[_0x6fbc('0x71')]];this[_0x6fbc('0xb')][_0x56e355[_0x6fbc('0x71')]]=_0x29920f;}}}catch(_0x1912b4){logger[_0x6fbc('0x31')](_0x6fbc('0x76'),util['inspect'](_0x1912b4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x6fbc('0x24')]['syncBlindTransfer']=function(_0x10f27b){try{if(this[_0x6fbc('0x4a')](_0x10f27b)){if(this[_0x6fbc('0xb')][_0x10f27b['transfereeuniqueid']]){for(var _0x244f5e in this[_0x6fbc('0xb')][_0x10f27b[_0x6fbc('0x71')]]){if(this['channels'][_0x10f27b['transfereeuniqueid']]['hasOwnProperty'](_0x244f5e)){if(_0x10f27b[_0x6fbc('0x77')]===_0x244f5e){var _0x199996=moment();this[_0x6fbc('0xb')][_0x10f27b['transfereeuniqueid']][_0x244f5e][_0x6fbc('0x17')]=!![];this[_0x6fbc('0xb')][_0x10f27b[_0x6fbc('0x71')]][_0x244f5e][_0x6fbc('0x4f')]=_0x199996;this[_0x6fbc('0xb')][_0x10f27b['transfereeuniqueid']][_0x244f5e][_0x6fbc('0x45')]=_0x6fbc('0x78');this[_0x6fbc('0xb')][_0x10f27b[_0x6fbc('0x71')]][_0x244f5e][_0x6fbc('0x36')]=_0x6fbc('0x50');this[_0x6fbc('0xb')][_0x10f27b['transfereeuniqueid']][_0x244f5e]['talktime']=_0x199996[_0x6fbc('0x73')](this[_0x6fbc('0xb')][_0x10f27b[_0x6fbc('0x71')]][_0x244f5e][_0x6fbc('0x35')],_0x6fbc('0x74'));}}}}}}catch(_0xb66b4c){logger[_0x6fbc('0x31')](_0x6fbc('0x79'),util['inspect'](_0xb66b4c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6fbc('0x1c')]=function(_0xcf45b){var _0x3eac0d='';try{if(this[_0x6fbc('0x4a')](_0xcf45b)){if(_0xcf45b[_0x6fbc('0x7a')]){_0x3eac0d=_0xcf45b[_0x6fbc('0x7a')][_0x6fbc('0x7b')](0x0,_0xcf45b[_0x6fbc('0x7a')][_0x6fbc('0x7c')]('-'));if(this[_0x6fbc('0xd')][_0x3eac0d]){this[_0x6fbc('0xd')][_0x3eac0d]['onhold']=!![];}}}}catch(_0x4cef91){logger[_0x6fbc('0x31')](_0x6fbc('0x7d'),util[_0x6fbc('0x33')](_0x4cef91,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x6fbc('0x1e')]=function(_0x169672){var _0x5bdd9a='';try{if(this['isNotNull'](_0x169672)){if(_0x169672[_0x6fbc('0x7a')]){_0x5bdd9a=_0x169672[_0x6fbc('0x7a')][_0x6fbc('0x7b')](0x0,_0x169672[_0x6fbc('0x7a')]['lastIndexOf']('-'));if(this[_0x6fbc('0xd')][_0x5bdd9a]){this[_0x6fbc('0xd')][_0x5bdd9a][_0x6fbc('0x7e')]=![];}}}}catch(_0x1bcd9b){logger[_0x6fbc('0x31')](_0x6fbc('0x7f'),util[_0x6fbc('0x33')](_0x1bcd9b,{'showHidden':![],'depth':null}));}};module[_0x6fbc('0x80')]=VoiceAgentReport; \ No newline at end of file +var _0xd63c=['answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','complete','talktime','transfer','acwtime','acwTimeout','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','keys','variable','[syncVarSet][VoiceAgentReport]','addVariable','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','memberrealtime','isNil','includes','values','transfereeuniqueid','origtransfereruniqueid','agentcompleteAt','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','syncMusicOnHoldStart','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/logger','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','omit','event','privilege','membername','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','merge','interface','pick','destconnectedlinenum','user:%s','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere'];(function(_0x133699,_0x42c607){var _0x367665=function(_0x49a4d8){while(--_0x49a4d8){_0x133699['push'](_0x133699['shift']());}};_0x367665(++_0x42c607);}(_0xd63c,0xb0));var _0xcd63=function(_0x7a112,_0x2eb4a0){_0x7a112=_0x7a112-0x0;var _0x136dc5=_0xd63c[_0x7a112];return _0x136dc5;};'use strict';var _=require(_0xcd63('0x0'));var moment=require(_0xcd63('0x1'));var util=require(_0xcd63('0x2'));var Redis=require(_0xcd63('0x3'));var config=require('../../../config/environment');var logger=require(_0xcd63('0x4'))('ami');var ami=require('../ami');config[_0xcd63('0x5')]=_[_0xcd63('0x6')](config[_0xcd63('0x5')],{'host':_0xcd63('0x7'),'port':0x18eb});var io=require(_0xcd63('0x8'))(new Redis(config[_0xcd63('0x5')]));function VoiceAgentReport(_0x362c32){this[_0xcd63('0x9')]={};this[_0xcd63('0xa')]=_0x362c32[_0xcd63('0xa')];this[_0xcd63('0xb')]=_0x362c32[_0xcd63('0xb')];this[_0xcd63('0xc')]={};ami['on'](_0xcd63('0xd'),this[_0xcd63('0xe')][_0xcd63('0xf')](this));ami['on'](_0xcd63('0x10'),this[_0xcd63('0x11')][_0xcd63('0xf')](this));ami['on'](_0xcd63('0x12'),this[_0xcd63('0x13')][_0xcd63('0xf')](this));ami['on'](_0xcd63('0x14'),this[_0xcd63('0x15')][_0xcd63('0xf')](this));ami['on'](_0xcd63('0x16'),this[_0xcd63('0x17')][_0xcd63('0xf')](this));ami['on'](_0xcd63('0x18'),this[_0xcd63('0x19')]['bind'](this));ami['on'](_0xcd63('0x1a'),this[_0xcd63('0x1b')]['bind'](this));ami['on'](_0xcd63('0x1c'),this['syncMusicOnHoldStart'][_0xcd63('0xf')](this));ami['on'](_0xcd63('0x1d'),this[_0xcd63('0x1e')][_0xcd63('0xf')](this));ami['on'](_0xcd63('0x1f'),this[_0xcd63('0x20')][_0xcd63('0xf')](this));ami['on'](_0xcd63('0x21'),this[_0xcd63('0x22')]['bind'](this));}VoiceAgentReport[_0xcd63('0x23')][_0xcd63('0x24')]=function(_0x4fda0e,_0x5441d7,_0x1c479d){io['to'](_0x4fda0e)[_0xcd63('0x24')](_0x5441d7,_0x1c479d);};VoiceAgentReport[_0xcd63('0x23')][_0xcd63('0x25')]=function(_0x17a562){return _0x17a562!==null&&!_[_0xcd63('0x26')](_0x17a562);};VoiceAgentReport[_0xcd63('0x23')][_0xcd63('0xe')]=function(_0x464a2c){try{if(this[_0xcd63('0x25')](_0x464a2c)){if(_[_0xcd63('0x26')](this[_0xcd63('0x9')][_0x464a2c[_0xcd63('0x27')]])){this['channels'][_0x464a2c[_0xcd63('0x27')]]={};}if(_[_0xcd63('0x26')](this[_0xcd63('0x9')][_0x464a2c['uniqueid']][_0x464a2c[_0xcd63('0x28')]])){this[_0xcd63('0x9')][_0x464a2c['uniqueid']][_0x464a2c[_0xcd63('0x28')]]={'agentcalledAt':moment()[_0xcd63('0x29')](_0xcd63('0x2a')),'lastevent':_0xcd63('0x2b'),'variables':this['variables'][_0x464a2c[_0xcd63('0x27')]],'type':this['voiceQueues'][_0x464a2c[_0xcd63('0x2c')]]?this[_0xcd63('0xa')][_0x464a2c['queue']][_0xcd63('0x2d')]||_0xcd63('0x2e'):_0xcd63('0x2e')};}_['merge'](this[_0xcd63('0x9')][_0x464a2c['uniqueid']][_0x464a2c[_0xcd63('0x28')]],_[_0xcd63('0x2f')](_0x464a2c,[_0xcd63('0x30'),_0xcd63('0x31')]));ami[_0xcd63('0x24')]('custom:agentcalled',this[_0xcd63('0x9')][_0x464a2c[_0xcd63('0x27')]][_0x464a2c['destuniqueid']]);this[_0xcd63('0x24')](util['format']('user:%s',_0x464a2c[_0xcd63('0x32')]),'user:called',this[_0xcd63('0x9')][_0x464a2c[_0xcd63('0x27')]][_0x464a2c[_0xcd63('0x28')]]);}}catch(_0xb9e5f6){logger[_0xcd63('0x33')](_0xcd63('0x34'),util[_0xcd63('0x35')](_0xb9e5f6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd63('0x23')]['syncAgentConnect']=function(_0x2aabfc){try{if(this[_0xcd63('0x25')](_0x2aabfc)){if(this[_0xcd63('0x9')][_0x2aabfc['uniqueid']]){for(var _0x3b1a27 in this[_0xcd63('0x9')][_0x2aabfc[_0xcd63('0x27')]]){if(this[_0xcd63('0x9')][_0x2aabfc[_0xcd63('0x27')]][_0xcd63('0x36')](_0x3b1a27)){if(_0x2aabfc[_0xcd63('0x28')]===_0x3b1a27){this[_0xcd63('0x9')][_0x2aabfc['uniqueid']][_0x3b1a27][_0xcd63('0x37')]=moment()[_0xcd63('0x29')](_0xcd63('0x2a'));this[_0xcd63('0x9')][_0x2aabfc[_0xcd63('0x27')]][_0x3b1a27][_0xcd63('0x38')]=_0xcd63('0x39');this[_0xcd63('0x9')][_0x2aabfc[_0xcd63('0x27')]][_0x3b1a27][_0xcd63('0x3a')]=_0x2aabfc['holdtime'];this[_0xcd63('0x9')][_0x2aabfc[_0xcd63('0x27')]][_0x3b1a27][_0xcd63('0x3b')]=_0x2aabfc[_0xcd63('0x3b')];this[_0xcd63('0x9')][_0x2aabfc[_0xcd63('0x27')]][_0x3b1a27][_0xcd63('0x3c')]=_0x2aabfc['connectedlinename'];this[_0xcd63('0x9')][_0x2aabfc['uniqueid']][_0x3b1a27][_0xcd63('0x3d')]=_0x2aabfc[_0xcd63('0x3d')];this[_0xcd63('0x9')][_0x2aabfc[_0xcd63('0x27')]][_0x3b1a27]['destchannelstatedesc']=_0x2aabfc[_0xcd63('0x3e')];_[_0xcd63('0x3f')](this[_0xcd63('0xb')][_0x2aabfc[_0xcd63('0x40')]],_[_0xcd63('0x41')](_0x2aabfc,['queue',_0xcd63('0x42')]));this[_0xcd63('0x24')](util[_0xcd63('0x29')](_0xcd63('0x43'),_0x2aabfc[_0xcd63('0x32')]),_0xcd63('0x44'),this[_0xcd63('0x9')][_0x2aabfc[_0xcd63('0x27')]][_0x2aabfc[_0xcd63('0x28')]]);ami[_0xcd63('0x24')]('custom:agentconnect',this['channels'][_0x2aabfc[_0xcd63('0x27')]][_0x3b1a27]);}else if(!this[_0xcd63('0x9')][_0x2aabfc[_0xcd63('0x27')]][_0x3b1a27][_0xcd63('0x12')]&&!this[_0xcd63('0x9')][_0x2aabfc[_0xcd63('0x27')]][_0x3b1a27]['agentcomplete']){this[_0xcd63('0x9')][_0x2aabfc['uniqueid']][_0x3b1a27][_0xcd63('0x12')]=!![];this[_0xcd63('0x9')][_0x2aabfc['uniqueid']][_0x3b1a27][_0xcd63('0x45')]=moment()[_0xcd63('0x29')](_0xcd63('0x2a'));this[_0xcd63('0x9')][_0x2aabfc[_0xcd63('0x27')]][_0x3b1a27][_0xcd63('0x46')]='answered_elsewhere';this[_0xcd63('0x9')][_0x2aabfc['uniqueid']][_0x3b1a27]['lastevent']=_0xcd63('0x47');this['channels'][_0x2aabfc['uniqueid']][_0x3b1a27][_0xcd63('0x48')]=_0x2aabfc[_0xcd63('0x28')];this[_0xcd63('0x9')][_0x2aabfc[_0xcd63('0x27')]][_0x3b1a27][_0xcd63('0x49')]=_0x2aabfc['membername'];ami[_0xcd63('0x24')](_0xcd63('0x4a'),this[_0xcd63('0x9')][_0x2aabfc['uniqueid']][_0x3b1a27]);}}}}}}catch(_0x506ea3){logger[_0xcd63('0x33')](_0xcd63('0x4b'),util[_0xcd63('0x35')](_0x506ea3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd63('0x23')][_0xcd63('0x13')]=function(_0x32137a){try{if(this[_0xcd63('0x25')](_0x32137a)){if(this[_0xcd63('0x9')][_0x32137a[_0xcd63('0x27')]]&&this[_0xcd63('0x9')][_0x32137a['uniqueid']][_0x32137a[_0xcd63('0x28')]]){this[_0xcd63('0x9')][_0x32137a['uniqueid']][_0x32137a[_0xcd63('0x28')]]['agentringnoanswer']=!![];this['channels'][_0x32137a[_0xcd63('0x27')]][_0x32137a['destuniqueid']]['agentringnoanswerAt']=moment()[_0xcd63('0x29')](_0xcd63('0x2a'));this['channels'][_0x32137a['uniqueid']][_0x32137a['destuniqueid']][_0xcd63('0x46')]='rejected';this['channels'][_0x32137a[_0xcd63('0x27')]][_0x32137a[_0xcd63('0x28')]][_0xcd63('0x38')]=_0xcd63('0x4c');ami[_0xcd63('0x24')](_0xcd63('0x4d'),this[_0xcd63('0x9')][_0x32137a['uniqueid']][_0x32137a[_0xcd63('0x28')]]);}}}catch(_0x3d0818){logger[_0xcd63('0x33')](_0xcd63('0x4e'),util[_0xcd63('0x35')](_0x3d0818,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd63('0x23')][_0xcd63('0x15')]=function(_0x14f735){try{if(this[_0xcd63('0x25')](_0x14f735)){if(this[_0xcd63('0x9')][_0x14f735[_0xcd63('0x27')]]){for(var _0xc9a4d2 in this['channels'][_0x14f735[_0xcd63('0x27')]]){if(this[_0xcd63('0x9')][_0x14f735[_0xcd63('0x27')]][_0xcd63('0x36')](_0xc9a4d2)&&!this['channels'][_0x14f735[_0xcd63('0x27')]][_0xc9a4d2][_0xcd63('0x12')]&&!this['channels'][_0x14f735[_0xcd63('0x27')]][_0xc9a4d2][_0xcd63('0x16')]){this[_0xcd63('0x9')][_0x14f735[_0xcd63('0x27')]][_0xc9a4d2][_0xcd63('0x12')]=!![];this[_0xcd63('0x9')][_0x14f735[_0xcd63('0x27')]][_0xc9a4d2]['agentringnoanswerAt']=moment()['format'](_0xcd63('0x2a'));this[_0xcd63('0x9')][_0x14f735[_0xcd63('0x27')]][_0xc9a4d2][_0xcd63('0x46')]='abandoned';this['channels'][_0x14f735['uniqueid']][_0xc9a4d2][_0xcd63('0x38')]=_0xcd63('0x4f');ami[_0xcd63('0x24')](_0xcd63('0x50'),this[_0xcd63('0x9')][_0x14f735[_0xcd63('0x27')]][_0xc9a4d2]);}}}}}catch(_0x55479d){logger['error'](_0xcd63('0x51'),util[_0xcd63('0x35')](_0x55479d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd63('0x23')][_0xcd63('0x17')]=function(_0x5dcac7){try{if(this[_0xcd63('0x25')](_0x5dcac7)){if(this[_0xcd63('0x9')][_0x5dcac7[_0xcd63('0x27')]]){for(var _0x55b68b in this[_0xcd63('0x9')][_0x5dcac7[_0xcd63('0x27')]]){if(this[_0xcd63('0x9')][_0x5dcac7['uniqueid']][_0xcd63('0x36')](_0x55b68b)){if(this[_0xcd63('0x9')][_0x5dcac7['uniqueid']][_0x55b68b][_0xcd63('0x37')]&&!this[_0xcd63('0x9')][_0x5dcac7[_0xcd63('0x27')]][_0x55b68b][_0xcd63('0x16')]){this[_0xcd63('0x9')][_0x5dcac7[_0xcd63('0x27')]][_0x55b68b]['agentcomplete']=!![];this[_0xcd63('0x9')][_0x5dcac7['uniqueid']][_0x55b68b]['agentcompleteAt']=moment()['format'](_0xcd63('0x2a'));this[_0xcd63('0x9')][_0x5dcac7[_0xcd63('0x27')]][_0x55b68b]['lastevent']=_0xcd63('0x52');this[_0xcd63('0x9')][_0x5dcac7[_0xcd63('0x27')]][_0x55b68b][_0xcd63('0x53')]=_0x5dcac7[_0xcd63('0x53')];this[_0xcd63('0x9')][_0x5dcac7[_0xcd63('0x27')]][_0x55b68b]['reason']=_0x5dcac7[_0xcd63('0x46')]==_0xcd63('0x54')?'agent':_0x5dcac7[_0xcd63('0x46')];if(this[_0xcd63('0xa')][_0x5dcac7[_0xcd63('0x2c')]]&&this[_0xcd63('0xa')][_0x5dcac7['queue']]['acw']){this[_0xcd63('0x9')][_0x5dcac7['uniqueid']][_0x55b68b]['agentacw']=!![];this[_0xcd63('0x9')][_0x5dcac7[_0xcd63('0x27')]][_0x55b68b][_0xcd63('0x55')]=this[_0xcd63('0xa')][_0x5dcac7[_0xcd63('0x2c')]][_0xcd63('0x56')];}this[_0xcd63('0xb')][_0x5dcac7[_0xcd63('0x40')]]=_[_0xcd63('0x2f')](this[_0xcd63('0xb')][_0x5dcac7[_0xcd63('0x40')]],[_0xcd63('0x2c'),_0xcd63('0x42')]);this['emit'](util[_0xcd63('0x29')](_0xcd63('0x43'),_0x5dcac7['membername']),_0xcd63('0x57'),this[_0xcd63('0x9')][_0x5dcac7[_0xcd63('0x27')]][_0x55b68b]);ami[_0xcd63('0x24')]('custom:agentcomplete',this[_0xcd63('0x9')][_0x5dcac7[_0xcd63('0x27')]][_0x55b68b]);}}}}}}catch(_0x1c4847){logger[_0xcd63('0x33')](_0xcd63('0x58'),util['inspect'](_0x1c4847,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd63('0x23')]['syncVarSet']=function(_0x50b528){try{if(this[_0xcd63('0x25')](_0x50b528)){this['addVariable'](_0x50b528[_0xcd63('0x27')],_[_0xcd63('0x59')](_0x50b528[_0xcd63('0x5a')])[0x0],_0x50b528['value']);if(this[_0xcd63('0x9')][_0x50b528[_0xcd63('0x27')]]){for(var _0x1511ba in this[_0xcd63('0x9')][_0x50b528[_0xcd63('0x27')]]){if(this[_0xcd63('0x9')][_0x50b528[_0xcd63('0x27')]]['hasOwnProperty'](_0x1511ba)){if(_[_0xcd63('0x26')](this[_0xcd63('0x9')][_0x50b528[_0xcd63('0x27')]][_0x1511ba][_0xcd63('0xc')])){this[_0xcd63('0x9')][_0x50b528[_0xcd63('0x27')]][_0x1511ba][_0xcd63('0xc')]={};}this[_0xcd63('0x9')][_0x50b528[_0xcd63('0x27')]][_0x1511ba][_0xcd63('0xc')]=this[_0xcd63('0xc')][_0x50b528[_0xcd63('0x27')]];}}}}}catch(_0x3602f7){logger[_0xcd63('0x33')](_0xcd63('0x5b'),util['inspect'](_0x3602f7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd63('0x23')][_0xcd63('0x5c')]=function(_0x236a4c,_0x3a2104,_0x3319d9){var _0x119ca3=[_0xcd63('0x5d'),'rtpaudioqosbridged','rtpaudioqosjitter',_0xcd63('0x5e'),_0xcd63('0x5f'),_0xcd63('0x60'),_0xcd63('0x61'),'rtpaudioqosrttbridged',_0xcd63('0x62'),_0xcd63('0x63'),_0xcd63('0x64'),_0xcd63('0x65'),'membercalls',_0xcd63('0x66'),'memberinterface',_0xcd63('0x67'),_0xcd63('0x32'),'memberpenalty',_0xcd63('0x68')];if(!_[_0xcd63('0x69')](_0x3a2104)&&!_[_0xcd63('0x6a')](_0x119ca3,_0x3a2104)){if(_[_0xcd63('0x26')](this['variables'][_0x236a4c])){this[_0xcd63('0xc')][_0x236a4c]={};}this[_0xcd63('0xc')][_0x236a4c][_0x3a2104]=_0x3319d9;}};VoiceAgentReport[_0xcd63('0x23')][_0xcd63('0x1b')]=function(_0x6dccce){try{if(this[_0xcd63('0x25')](_0x6dccce)){if(this[_0xcd63('0x9')][_0x6dccce['uniqueid']]){for(var _0x36e117 in this[_0xcd63('0x9')][_0x6dccce[_0xcd63('0x27')]]){if(this[_0xcd63('0x9')][_0x6dccce[_0xcd63('0x27')]][_0xcd63('0x36')](_0x36e117)){if(this[_0xcd63('0x9')][_0x6dccce[_0xcd63('0x27')]][_0x36e117][_0xcd63('0x46')]==_0xcd63('0x54')&&this[_0xcd63('0x9')][_0x6dccce['uniqueid']][_0x36e117][_0xcd63('0x16')]){this[_0xcd63('0x9')][_0x6dccce[_0xcd63('0x27')]][_0x36e117]['agentcompleteAt']=moment()[_0xcd63('0x29')](_0xcd63('0x2a'));}}}ami[_0xcd63('0x24')]('custom:voiceAgentReport',_[_0xcd63('0x6b')](this[_0xcd63('0x9')][_0x6dccce['uniqueid']]));delete this['channels'][_0x6dccce[_0xcd63('0x27')]];}if(this[_0xcd63('0xc')][_0x6dccce['uniqueid']]){delete this[_0xcd63('0xc')][_0x6dccce['uniqueid']];}}}catch(_0xa72dda){logger[_0xcd63('0x33')]('[syncHangup][VoiceAgentReport]',util[_0xcd63('0x35')](_0xa72dda,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd63('0x23')]['syncAttendedTransfer']=function(_0x437c82){try{if(this[_0xcd63('0x25')](_0x437c82)){if(this['channels'][_0x437c82['transfereeuniqueid']]){for(var _0x378ed0 in this[_0xcd63('0x9')][_0x437c82[_0xcd63('0x6c')]]){if(this[_0xcd63('0x9')][_0x437c82['transfereeuniqueid']][_0xcd63('0x36')](_0x378ed0)){if(_0x437c82[_0xcd63('0x6d')]===_0x378ed0){var _0x150cad=moment();this[_0xcd63('0x9')][_0x437c82[_0xcd63('0x6c')]][_0x378ed0][_0xcd63('0x16')]=!![];this[_0xcd63('0x9')][_0x437c82[_0xcd63('0x6c')]][_0x378ed0][_0xcd63('0x6e')]=moment()[_0xcd63('0x29')](_0xcd63('0x2a'));this[_0xcd63('0x9')][_0x437c82[_0xcd63('0x6c')]][_0x378ed0][_0xcd63('0x46')]=_0xcd63('0x54');this[_0xcd63('0x9')][_0x437c82[_0xcd63('0x6c')]][_0x378ed0][_0xcd63('0x38')]='complete';this['channels'][_0x437c82[_0xcd63('0x6c')]][_0x378ed0][_0xcd63('0x53')]=_0x150cad[_0xcd63('0x6f')](this[_0xcd63('0x9')][_0x437c82['transfereeuniqueid']][_0x378ed0][_0xcd63('0x37')],_0xcd63('0x70'));}}}}if(this[_0xcd63('0x9')][_0x437c82[_0xcd63('0x71')]]){var _0x10aea3=this[_0xcd63('0x9')][_0x437c82[_0xcd63('0x71')]];this[_0xcd63('0x9')][_0x437c82['secondtransfereruniqueid']]=this[_0xcd63('0x9')][_0x437c82['transfereeuniqueid']];this[_0xcd63('0x9')][_0x437c82[_0xcd63('0x6c')]]=_0x10aea3;}}}catch(_0x3d8fa8){logger['error'](_0xcd63('0x72'),util[_0xcd63('0x35')](_0x3d8fa8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd63('0x23')][_0xcd63('0x22')]=function(_0xe0ac08){try{if(this[_0xcd63('0x25')](_0xe0ac08)){if(this[_0xcd63('0x9')][_0xe0ac08[_0xcd63('0x6c')]]){for(var _0x1fd1bf in this[_0xcd63('0x9')][_0xe0ac08[_0xcd63('0x6c')]]){if(this['channels'][_0xe0ac08[_0xcd63('0x6c')]]['hasOwnProperty'](_0x1fd1bf)){if(_0xe0ac08[_0xcd63('0x73')]===_0x1fd1bf){var _0x148222=moment();this['channels'][_0xe0ac08['transfereeuniqueid']][_0x1fd1bf][_0xcd63('0x16')]=!![];this[_0xcd63('0x9')][_0xe0ac08[_0xcd63('0x6c')]][_0x1fd1bf]['agentcompleteAt']=_0x148222;this['channels'][_0xe0ac08[_0xcd63('0x6c')]][_0x1fd1bf]['reason']='transfer';this[_0xcd63('0x9')][_0xe0ac08[_0xcd63('0x6c')]][_0x1fd1bf][_0xcd63('0x38')]=_0xcd63('0x52');this[_0xcd63('0x9')][_0xe0ac08[_0xcd63('0x6c')]][_0x1fd1bf][_0xcd63('0x53')]=_0x148222[_0xcd63('0x6f')](this['channels'][_0xe0ac08['transfereeuniqueid']][_0x1fd1bf]['agentconnectAt'],_0xcd63('0x70'));}}}}}}catch(_0x41ee34){logger[_0xcd63('0x33')](_0xcd63('0x74'),util[_0xcd63('0x35')](_0x41ee34,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcd63('0x23')][_0xcd63('0x75')]=function(_0x1e3cfd){var _0x4f4919='';try{if(this[_0xcd63('0x25')](_0x1e3cfd)){if(_0x1e3cfd[_0xcd63('0x76')]){_0x4f4919=_0x1e3cfd[_0xcd63('0x76')][_0xcd63('0x77')](0x0,_0x1e3cfd[_0xcd63('0x76')][_0xcd63('0x78')]('-'));if(this[_0xcd63('0xb')][_0x4f4919]){this[_0xcd63('0xb')][_0x4f4919][_0xcd63('0x79')]=!![];}}}}catch(_0x1d178a){logger['error'](_0xcd63('0x7a'),util['inspect'](_0x1d178a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStop']=function(_0x45d93c){var _0x5d11f0='';try{if(this[_0xcd63('0x25')](_0x45d93c)){if(_0x45d93c[_0xcd63('0x76')]){_0x5d11f0=_0x45d93c[_0xcd63('0x76')]['substring'](0x0,_0x45d93c[_0xcd63('0x76')][_0xcd63('0x78')]('-'));if(this['agents'][_0x5d11f0]){this[_0xcd63('0xb')][_0x5d11f0][_0xcd63('0x79')]=![];}}}}catch(_0x5ec7e8){logger[_0xcd63('0x33')]('[syncMusicOnHoldStop][VoiceAgentReport]',util[_0xcd63('0x35')](_0x5ec7e8,{'showHidden':![],'depth':null}));}};module[_0xcd63('0x7b')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 8c9528a..e0b8ffa 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 _0x2157=['origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','BlindTransfer','[syncBlindTransfer][VoiceCallReport]','syncMusicOnHoldStart','[syncMusicOnHoldStart][VoiceCallReport]','syncMusicOnHoldStop','mohstarttime','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','playback','NO\x20ANSWER','FAILED','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','syncNewChannel','syncNewState','varset','syncVarSet','hangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','then','actionCoreShowChannels','log','prototype','isNotNull','isUndefined','emit','uniqueid','pick','keys','inspect','linkedid','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','channel','split','user:%s','name','accountcode','exten','error','[syncNewChannel][VoiceCallReport]','application','toLowerCase','applicationdata','starttime','duration','subtract','seconds','includes','lastapplication','lastdata','startsWith','cdr(','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinename','calleridname','destinationchannel','UserId','membername','syncMixMonitorFilename','monitor','endsWith','.wav49','monitorFilename','find','monitors','isNil','push','rec','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','xmd-cdrtype','type','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','xmcs-queue','sipcallid','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','syncHangup','endtime','billableseconds','from-sip','omit','destconnectedlinenum','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid'];(function(_0x182416,_0x5874bc){var _0x5b4e3d=function(_0x980316){while(--_0x980316){_0x182416['push'](_0x182416['shift']());}};_0x5b4e3d(++_0x5874bc);}(_0x2157,0x13b));var _0x7215=function(_0x3bf263,_0x21f769){_0x3bf263=_0x3bf263-0x0;var _0x218c30=_0x2157[_0x3bf263];return _0x218c30;};'use strict';var BPromise=require(_0x7215('0x0'));var _=require(_0x7215('0x1'));var moment=require(_0x7215('0x2'));var util=require(_0x7215('0x3'));var path=require('path');var Redis=require('ioredis');var config=require(_0x7215('0x4'));var logger=require(_0x7215('0x5'))('ami');var ami=require(_0x7215('0x6'));var Channel=require(_0x7215('0x7'));var statusDesc=[_0x7215('0x8'),_0x7215('0x9'),_0x7215('0xa'),_0x7215('0xb'),_0x7215('0xc'),_0x7215('0xd'),_0x7215('0xe'),_0x7215('0xf'),_0x7215('0x10')];var applications=[_0x7215('0x11'),_0x7215('0x12'),_0x7215('0x13'),_0x7215('0x14'),_0x7215('0x15'),'voicemail'];var dispositions=[_0x7215('0x16'),'FAILED',_0x7215('0x17'),_0x7215('0x16'),_0x7215('0x16'),_0x7215('0x16'),'ANSWERED','BUSY',_0x7215('0x17'),_0x7215('0x17'),'FAILED'];var actions={};config[_0x7215('0x18')]=_[_0x7215('0x19')](config[_0x7215('0x18')],{'host':_0x7215('0x1a'),'port':0x18eb});var io=require(_0x7215('0x1b'))(new Redis(config[_0x7215('0x18')]));function VoiceCallReport(_0x2479ab){this[_0x7215('0x1c')]=_0x2479ab['channels'];this[_0x7215('0x1d')]=_0x2479ab[_0x7215('0x1d')];ami['on'](_0x7215('0x1e'),this[_0x7215('0x1f')][_0x7215('0x20')](this));ami['on']('newexten',this[_0x7215('0x1f')][_0x7215('0x20')](this));ami['on']('newchannel',this[_0x7215('0x21')][_0x7215('0x20')](this));ami['on']('newstate',this[_0x7215('0x22')][_0x7215('0x20')](this));ami['on'](_0x7215('0x23'),this[_0x7215('0x24')][_0x7215('0x20')](this));ami['on'](_0x7215('0x25'),this['syncHangup'][_0x7215('0x20')](this));ami['on']('newcallerid',this[_0x7215('0x26')]['bind'](this));ami['on'](_0x7215('0x27'),this[_0x7215('0x28')]['bind'](this));ami['on']('blindtransfer',this[_0x7215('0x29')][_0x7215('0x20')](this));ami['on'](_0x7215('0x2a'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x7215('0x2b'),this['syncMusicOnHoldStop']['bind'](this));return BPromise['resolve']()[_0x7215('0x2c')](ami[_0x7215('0x2d')]())['catch'](function(_0x51c3e0){console[_0x7215('0x2e')](_0x51c3e0);});}VoiceCallReport[_0x7215('0x2f')][_0x7215('0x30')]=function(_0x1dcef0){return _0x1dcef0!==null&&!_[_0x7215('0x31')](_0x1dcef0);};VoiceCallReport[_0x7215('0x2f')]['emit']=function(_0x3b4dd4,_0x386e89,_0x4a8e5d){io['to'](_0x3b4dd4)[_0x7215('0x32')](_0x386e89,_0x4a8e5d);};VoiceCallReport[_0x7215('0x2f')][_0x7215('0x26')]=function(_0x165e99){try{if(this[_0x7215('0x30')](_0x165e99)){if(_0x165e99[_0x7215('0x33')]===_0x165e99['linkedid']){if(!_[_0x7215('0x31')](this['channels'][_0x165e99['uniqueid']])){_['merge'](this['channels'][_0x165e99['uniqueid']],_[_0x7215('0x34')](_0x165e99,_[_0x7215('0x35')](this[_0x7215('0x1c')][_0x165e99[_0x7215('0x33')]])));}}}}catch(_0x448386){logger['error']('[syncNewCallerId][VoiceCallReport]',util[_0x7215('0x36')](_0x448386,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7215('0x2f')][_0x7215('0x21')]=function(_0x14dfe7){try{if(this['isNotNull'](_0x14dfe7)){if(_0x14dfe7[_0x7215('0x33')]===_0x14dfe7[_0x7215('0x37')]&&_0x14dfe7['channel']!=_0x7215('0x38')){if(_[_0x7215('0x31')](this[_0x7215('0x1c')][_0x14dfe7[_0x7215('0x33')]])){this['channels'][_0x14dfe7[_0x7215('0x33')]]=new Channel();this[_0x7215('0x1c')][_0x14dfe7[_0x7215('0x33')]]['starttime']=moment()[_0x7215('0x39')](_0x7215('0x3a'));this[_0x7215('0x1c')][_0x14dfe7[_0x7215('0x33')]][_0x7215('0x3b')]=dispositions[_[_0x7215('0x3c')](_0x14dfe7[_0x7215('0x3d')])];_['merge'](this[_0x7215('0x1c')][_0x14dfe7[_0x7215('0x33')]],_[_0x7215('0x34')](_0x14dfe7,_['keys'](this[_0x7215('0x1c')][_0x14dfe7[_0x7215('0x33')]])));if(_0x14dfe7[_0x7215('0x3e')]==='from-sip'){if(this[_0x7215('0x1d')][_0x14dfe7[_0x7215('0x3f')][_0x7215('0x40')]('-')[0x0]]){this['agents'][_0x14dfe7[_0x7215('0x3f')]['split']('-')[0x0]]['destconnectedlinenum']=_0x14dfe7['exten'];this['emit'](util['format'](_0x7215('0x41'),this[_0x7215('0x1d')][_0x14dfe7[_0x7215('0x3f')]['split']('-')[0x0]][_0x7215('0x42')]),'user:agentconnect',{'destaccountcode':this[_0x7215('0x1d')][_0x14dfe7[_0x7215('0x3f')][_0x7215('0x40')]('-')[0x0]][_0x7215('0x43')],'destconnectedlinenum':_0x14dfe7[_0x7215('0x44')]});}}}}}}catch(_0x2a0654){logger[_0x7215('0x45')](_0x7215('0x46'),util[_0x7215('0x36')](_0x2a0654,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7215('0x2f')][_0x7215('0x1f')]=function(_0x21aa97){try{if(this[_0x7215('0x30')](_0x21aa97)){if(_0x21aa97['uniqueid']===_0x21aa97['linkedid']&&_0x21aa97[_0x7215('0x44')]!='h'&&_0x21aa97[_0x7215('0x3f')]!=_0x7215('0x38')){_0x21aa97['application']=_0x21aa97[_0x7215('0x47')][_0x7215('0x48')]();_0x21aa97[_0x7215('0x49')]=(_0x21aa97['appdata']||_0x21aa97['applicationdata'])[_0x7215('0x48')]();if(_['isUndefined'](this[_0x7215('0x1c')][_0x21aa97[_0x7215('0x33')]])){this[_0x7215('0x1c')][_0x21aa97['uniqueid']]=new Channel();this[_0x7215('0x1c')][_0x21aa97[_0x7215('0x33')]][_0x7215('0x4a')]=_0x21aa97[_0x7215('0x4b')]?moment()[_0x7215('0x4c')](moment[_0x7215('0x4b')](_0x21aa97[_0x7215('0x4b')])[_0x7215('0x4d')](),_0x7215('0x4d'))[_0x7215('0x39')](_0x7215('0x3a')):moment()['format'](_0x7215('0x3a'));this[_0x7215('0x1c')][_0x21aa97['uniqueid']][_0x7215('0x3b')]=_0x7215('0x16');}_['merge'](this[_0x7215('0x1c')][_0x21aa97['uniqueid']],_[_0x7215('0x34')](_0x21aa97,_['keys'](this[_0x7215('0x1c')][_0x21aa97[_0x7215('0x33')]])));if(_[_0x7215('0x4e')](applications,_0x21aa97[_0x7215('0x47')])){this['channels'][_0x21aa97['uniqueid']][_0x7215('0x4f')]=_0x21aa97['application'];this[_0x7215('0x1c')][_0x21aa97['uniqueid']][_0x7215('0x50')]=_0x21aa97['applicationdata'];if(_0x21aa97[_0x7215('0x47')]===_0x7215('0x11')&&_[_0x7215('0x51')](_0x21aa97[_0x7215('0x49')],_0x7215('0x52'))){var _0x50abf1=_0x21aa97[_0x7215('0x49')][_0x7215('0x40')]('=');var _0x1d5f2f=_0x50abf1[0x0]['match'](/cdr\((.*)\)/);if(_0x1d5f2f){this[_0x7215('0x1c')][_0x21aa97[_0x7215('0x33')]][_0x1d5f2f[0x1]]=_0x50abf1[0x1];}}else if(_0x21aa97[_0x7215('0x47')]===_0x7215('0x12')){this['channels'][_0x21aa97[_0x7215('0x33')]]['queue']=_0x21aa97[_0x7215('0x49')][_0x7215('0x40')](',')[0x0];}}}}}catch(_0x1150c7){logger[_0x7215('0x45')](_0x7215('0x53'),util['inspect'](_0x1150c7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7215('0x2f')][_0x7215('0x22')]=function(_0x1f1b5a){try{if(this['isNotNull'](_0x1f1b5a)){if(_0x1f1b5a[_0x7215('0x33')]!==_0x1f1b5a['linkedid']){if(this[_0x7215('0x1c')][_0x1f1b5a[_0x7215('0x37')]]){if(_0x1f1b5a['channelstate']==='6'){if(!this['channels'][_0x1f1b5a['linkedid']][_0x7215('0x54')]){var _0x309886=moment();this[_0x7215('0x1c')][_0x1f1b5a[_0x7215('0x37')]]['answered']=!![];this[_0x7215('0x1c')][_0x1f1b5a[_0x7215('0x37')]][_0x7215('0x55')]=_0x309886[_0x7215('0x39')](_0x7215('0x3a'));if(this[_0x7215('0x1c')][_0x1f1b5a[_0x7215('0x37')]][_0x7215('0x4a')]){this[_0x7215('0x1c')][_0x1f1b5a[_0x7215('0x37')]][_0x7215('0x56')]=_0x309886[_0x7215('0x57')](this[_0x7215('0x1c')][_0x1f1b5a[_0x7215('0x37')]][_0x7215('0x4a')],_0x7215('0x4d'));}}this['channels'][_0x1f1b5a[_0x7215('0x37')]][_0x7215('0x37')]=_0x1f1b5a[_0x7215('0x33')];if(_0x1f1b5a[_0x7215('0x58')]!==_0x7215('0x59')){this[_0x7215('0x1c')][_0x1f1b5a[_0x7215('0x37')]]['connectedlinenum']=_0x1f1b5a[_0x7215('0x58')];}this[_0x7215('0x1c')][_0x1f1b5a[_0x7215('0x37')]][_0x7215('0x5a')]=_0x1f1b5a[_0x7215('0x5b')];this[_0x7215('0x1c')][_0x1f1b5a[_0x7215('0x37')]][_0x7215('0x5c')]=_0x1f1b5a[_0x7215('0x3f')];this['channels'][_0x1f1b5a[_0x7215('0x37')]][_0x7215('0x3b')]=dispositions[_[_0x7215('0x3c')](_0x1f1b5a[_0x7215('0x3d')])];if(this[_0x7215('0x1d')][_0x1f1b5a[_0x7215('0x3f')]['split']('-')[0x0]]){this[_0x7215('0x1c')][_0x1f1b5a['linkedid']][_0x7215('0x5d')]=this[_0x7215('0x1d')][_0x1f1b5a[_0x7215('0x3f')]['split']('-')[0x0]]['id'];this[_0x7215('0x1c')][_0x1f1b5a[_0x7215('0x37')]][_0x7215('0x5e')]=this[_0x7215('0x1d')][_0x1f1b5a[_0x7215('0x3f')][_0x7215('0x40')]('-')[0x0]][_0x7215('0x42')];}}}}else{if(this['channels'][_0x1f1b5a[_0x7215('0x33')]]){if(_0x1f1b5a['channelstate']==='6'){if(this[_0x7215('0x1d')][_0x1f1b5a[_0x7215('0x3f')][_0x7215('0x40')]('-')[0x0]]){this[_0x7215('0x1c')][_0x1f1b5a['uniqueid']]['UserId']=this[_0x7215('0x1d')][_0x1f1b5a[_0x7215('0x3f')][_0x7215('0x40')]('-')[0x0]]['id'];this['channels'][_0x1f1b5a[_0x7215('0x33')]][_0x7215('0x5e')]=this['agents'][_0x1f1b5a[_0x7215('0x3f')]['split']('-')[0x0]][_0x7215('0x42')];}}}}}}catch(_0x48eebc){logger[_0x7215('0x45')]('[syncNewState][VoiceCallReport]',util[_0x7215('0x36')](_0x48eebc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7215('0x2f')][_0x7215('0x5f')]=function(_0x136505,_0x550123){if(this[_0x7215('0x1c')][_0x136505]){this['channels'][_0x136505][_0x7215('0x60')]=!![];if(_[_0x7215('0x61')](_0x550123,_0x7215('0x62'))){_0x550123=_0x550123['replace'](_0x7215('0x62'),'.WAV');}this[_0x7215('0x1c')][_0x136505][_0x7215('0x63')]=_0x550123;var _0x1d7b1d=_[_0x7215('0x64')](this[_0x7215('0x1c')][_0x136505][_0x7215('0x65')],{'filename':_0x550123});if(_[_0x7215('0x66')](_0x1d7b1d)){this[_0x7215('0x1c')][_0x136505][_0x7215('0x65')][_0x7215('0x67')]({'filename':_0x550123,'createdAt':moment()[_0x7215('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x7215('0x68')});}}};VoiceCallReport['prototype'][_0x7215('0x24')]=function(_0x4a2c30){try{if(this[_0x7215('0x30')](_0x4a2c30)){if(this[_0x7215('0x1c')][_0x4a2c30[_0x7215('0x33')]]&&_0x4a2c30[_0x7215('0x3f')]!=_0x7215('0x38')){if(this['isNotNull'](_0x4a2c30[_0x7215('0x69')])){if(this[_0x7215('0x30')](_0x4a2c30[_0x7215('0x69')][_0x7215('0x6a')])){this[_0x7215('0x5f')](_0x4a2c30[_0x7215('0x33')],_0x4a2c30[_0x7215('0x6b')]);}else if(this['isNotNull'](_0x4a2c30['variable'][_0x7215('0x6c')])){this[_0x7215('0x1c')][_0x4a2c30[_0x7215('0x33')]][_0x7215('0x58')]=_0x4a2c30[_0x7215('0x6b')];}else if(this[_0x7215('0x30')](_0x4a2c30[_0x7215('0x69')][_0x7215('0x6d')])){this[_0x7215('0x1c')][_0x4a2c30[_0x7215('0x33')]]['callerid']=_0x4a2c30[_0x7215('0x6b')];}else if(this[_0x7215('0x30')](_0x4a2c30['variable'][_0x7215('0x6e')])){this[_0x7215('0x1c')][_0x4a2c30[_0x7215('0x33')]][_0x7215('0x6f')]=_0x4a2c30[_0x7215('0x6b')];}else if(this[_0x7215('0x30')](_0x4a2c30[_0x7215('0x69')]['xmd-queue'])){this[_0x7215('0x1c')][_0x4a2c30[_0x7215('0x33')]][_0x7215('0x12')]=_0x4a2c30[_0x7215('0x6b')]['split'](',')[0x0];}else if(this[_0x7215('0x30')](_0x4a2c30[_0x7215('0x69')][_0x7215('0x70')])){this[_0x7215('0x1c')][_0x4a2c30['uniqueid']][_0x7215('0x71')]=_0x4a2c30[_0x7215('0x6b')];}else if(this[_0x7215('0x30')](_0x4a2c30[_0x7215('0x69')][_0x7215('0x72')])){this[_0x7215('0x1c')][_0x4a2c30['uniqueid']][_0x7215('0x73')]=_0x4a2c30[_0x7215('0x6b')];}else if(this[_0x7215('0x30')](_0x4a2c30[_0x7215('0x69')][_0x7215('0x74')])){this[_0x7215('0x1c')][_0x4a2c30['uniqueid']]['calleridpreview']=_0x4a2c30[_0x7215('0x6b')];}else if(this[_0x7215('0x30')](_0x4a2c30[_0x7215('0x69')][_0x7215('0x75')])){this[_0x7215('0x1c')][_0x4a2c30['uniqueid']]['queue']=_0x4a2c30[_0x7215('0x6b')];}else if(this['isNotNull'](_0x4a2c30['variable'][_0x7215('0x76')])){this['channels'][_0x4a2c30[_0x7215('0x33')]]['sipcalluniqueid']=_0x4a2c30[_0x7215('0x6b')];}}}else if(this['isNotNull'](_0x4a2c30[_0x7215('0x69')]['mixmonitor_filename'])){if(_0x4a2c30[_0x7215('0x6b')]){var _0x11d975=path[_0x7215('0x77')](_0x4a2c30[_0x7215('0x6b')])['name'];this[_0x7215('0x5f')](_0x11d975,_0x4a2c30['value']);}}else if(this[_0x7215('0x1c')][_0x4a2c30[_0x7215('0x37')]]){if(this[_0x7215('0x30')](_0x4a2c30[_0x7215('0x69')])){if(this[_0x7215('0x30')](_0x4a2c30[_0x7215('0x69')][_0x7215('0x76')])){this[_0x7215('0x1c')][_0x4a2c30[_0x7215('0x37')]][_0x7215('0x78')]=_0x4a2c30['value'];}}}}}catch(_0x5ce106){logger[_0x7215('0x45')](_0x7215('0x79'),util['inspect'](_0x5ce106,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7215('0x2f')][_0x7215('0x7a')]=function(_0x3cef28){try{if(this['isNotNull'](_0x3cef28)){if(this[_0x7215('0x1c')][_0x3cef28[_0x7215('0x33')]]){var _0x5c6461=moment();this['channels'][_0x3cef28[_0x7215('0x33')]][_0x7215('0x7b')]=_0x5c6461[_0x7215('0x39')](_0x7215('0x3a'));this[_0x7215('0x1c')][_0x3cef28[_0x7215('0x33')]]['duration']=_0x5c6461[_0x7215('0x57')](this[_0x7215('0x1c')][_0x3cef28['uniqueid']][_0x7215('0x4a')],'seconds');if(this[_0x7215('0x1c')][_0x3cef28[_0x7215('0x33')]][_0x7215('0x54')]){this[_0x7215('0x1c')][_0x3cef28[_0x7215('0x33')]]['billableseconds']=_0x5c6461['diff'](this['channels'][_0x3cef28['uniqueid']][_0x7215('0x55')],_0x7215('0x4d'));this[_0x7215('0x1c')][_0x3cef28[_0x7215('0x33')]][_0x7215('0x56')]=this[_0x7215('0x1c')][_0x3cef28[_0x7215('0x33')]][_0x7215('0x4b')]-this['channels'][_0x3cef28[_0x7215('0x33')]][_0x7215('0x7c')];}if(_0x3cef28[_0x7215('0x3e')]===_0x7215('0x7d')){if(this[_0x7215('0x1d')][_0x3cef28['channel']['split']('-')[0x0]]){this[_0x7215('0x1d')][_0x3cef28[_0x7215('0x3f')][_0x7215('0x40')]('-')[0x0]]=_[_0x7215('0x7e')](this['agents'][_0x3cef28[_0x7215('0x3f')][_0x7215('0x40')]('-')[0x0]],[_0x7215('0x7f')]);this[_0x7215('0x32')](util[_0x7215('0x39')](_0x7215('0x41'),this[_0x7215('0x1d')][_0x3cef28[_0x7215('0x3f')]['split']('-')[0x0]][_0x7215('0x42')]),_0x7215('0x80'),{'destaccountcode':this[_0x7215('0x1d')][_0x3cef28['channel'][_0x7215('0x40')]('-')[0x0]][_0x7215('0x43')]});}}ami[_0x7215('0x32')](_0x7215('0x81'),this[_0x7215('0x1c')][_0x3cef28[_0x7215('0x33')]]);delete this['channels'][_0x3cef28[_0x7215('0x33')]];}}}catch(_0xbf8fd8){logger['error'](_0x7215('0x82'),util[_0x7215('0x36')](_0xbf8fd8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7215('0x2f')]['syncAttendedTransfer']=function(_0x582364){try{if(this[_0x7215('0x30')](_0x582364)){if(this['channels'][_0x582364[_0x7215('0x83')]]){this[_0x7215('0x1c')][_0x582364[_0x7215('0x83')]][_0x7215('0x84')]=_0x582364[_0x7215('0x85')];this['channels'][_0x582364[_0x7215('0x83')]][_0x7215('0x86')]=_0x582364[_0x7215('0x87')];if(this[_0x7215('0x1c')][_0x582364[_0x7215('0x88')]]){var _0x42a9b8=this[_0x7215('0x1c')][_0x582364['secondtransfereruniqueid']];this[_0x7215('0x1c')][_0x582364[_0x7215('0x88')]]=this[_0x7215('0x1c')][_0x582364[_0x7215('0x83')]];this[_0x7215('0x1c')][_0x582364[_0x7215('0x83')]]=_0x42a9b8;}}else if(this[_0x7215('0x1c')][_0x582364['transfertargetuniqueid']]){this[_0x7215('0x1c')][_0x582364[_0x7215('0x89')]]['transfercalleridnum']=_0x582364['origtransferercalleridnum'];this[_0x7215('0x1c')][_0x582364[_0x7215('0x89')]][_0x7215('0x86')]=_0x582364['transfertargetcalleridnum'];if(this[_0x7215('0x1c')][_0x582364[_0x7215('0x8a')]]){var _0x42a9b8=this['channels'][_0x582364[_0x7215('0x8a')]];this[_0x7215('0x1c')][_0x582364[_0x7215('0x8a')]]=this[_0x7215('0x1c')][_0x582364[_0x7215('0x89')]];this[_0x7215('0x1c')][_0x582364[_0x7215('0x89')]]=_0x42a9b8;}}}}catch(_0x469690){logger['error'](_0x7215('0x8b'),util['inspect'](_0x469690,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7215('0x2f')][_0x7215('0x29')]=function(_0xf4aabb){try{if(this[_0x7215('0x30')](_0xf4aabb)){if(this[_0x7215('0x1c')][_0xf4aabb[_0x7215('0x83')]]){this['channels'][_0xf4aabb[_0x7215('0x83')]][_0x7215('0x84')]=_0xf4aabb[_0x7215('0x8c')];this[_0x7215('0x1c')][_0xf4aabb[_0x7215('0x83')]]['transferconnectedlinenum']=_0xf4aabb['extension'];this[_0x7215('0x7a')]({'event':_0x7215('0x8d'),'uniqueid':_0xf4aabb['transfereeuniqueid'],'context':_0xf4aabb[_0x7215('0x3e')],'channel':_0xf4aabb['transfererchannel']});}}}catch(_0x4c2ab3){logger[_0x7215('0x45')](_0x7215('0x8e'),util['inspect'](_0x4c2ab3,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x7215('0x8f')]=function(_0x9f945f){try{if(this[_0x7215('0x30')](_0x9f945f)){if(this['channels'][_0x9f945f[_0x7215('0x33')]]){if(!_['isNil'](this[_0x7215('0x1c')][_0x9f945f['uniqueid']][_0x7215('0x55')])){this[_0x7215('0x1c')][_0x9f945f[_0x7215('0x33')]]['mohstarttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x58dbc7){logger[_0x7215('0x45')](_0x7215('0x90'),util['inspect'](_0x58dbc7,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x7215('0x91')]=function(_0x59544a){try{if(this[_0x7215('0x30')](_0x59544a)){if(this['channels'][_0x59544a[_0x7215('0x33')]]){if(!_['isNil'](this['channels'][_0x59544a[_0x7215('0x33')]][_0x7215('0x92')])){this['channels'][_0x59544a[_0x7215('0x33')]][_0x7215('0x93')]+=moment()[_0x7215('0x94')](0x0)[_0x7215('0x57')](this[_0x7215('0x1c')][_0x59544a[_0x7215('0x33')]]['mohstarttime'],_0x7215('0x4d'));delete this[_0x7215('0x1c')][_0x59544a[_0x7215('0x33')]][_0x7215('0x92')];}}}}catch(_0x521184){logger[_0x7215('0x45')](_0x7215('0x95'),util[_0x7215('0x36')](_0x521184,{'showHidden':![],'depth':null}));}};module[_0x7215('0x96')]=VoiceCallReport; \ No newline at end of file +var _0x594d=['isNil','push','rec','variable','mixmonitor_filename','syncMixMonitorFilename','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','destination','xmcs-queue','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','diff','billableseconds','omit','destconnectedlinenum','custom:voiceCallReport','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','[syncBlindTransfer][VoiceCallReport]','syncMusicOnHoldStart','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','syncMusicOnHoldStop','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','lodash','moment','util','path','ioredis','ami','../model/channel','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','set','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','syncNewExten','bind','newexten','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','then','actionCoreShowChannels','log','isUndefined','prototype','emit','isNotNull','uniqueid','linkedid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','context','agents','split','user:%s','name','user:agentconnect','exten','application','toLowerCase','applicationdata','appdata','duration','seconds','disposition','includes','lastapplication','lastdata','startsWith','match','answered','answertime','holdtime','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','channelstate','membername','[syncNewState][VoiceCallReport]','endsWith','.wav49','replace','find','monitors'];(function(_0x42bb6d,_0x412255){var _0x1db89b=function(_0x5da43a){while(--_0x5da43a){_0x42bb6d['push'](_0x42bb6d['shift']());}};_0x1db89b(++_0x412255);}(_0x594d,0x1e6));var _0xd594=function(_0x10cf72,_0xdd7d9f){_0x10cf72=_0x10cf72-0x0;var _0x2da3c7=_0x594d[_0x10cf72];return _0x2da3c7;};'use strict';var BPromise=require('bluebird');var _=require(_0xd594('0x0'));var moment=require(_0xd594('0x1'));var util=require(_0xd594('0x2'));var path=require(_0xd594('0x3'));var Redis=require(_0xd594('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xd594('0x5'));var ami=require('../ami');var Channel=require(_0xd594('0x6'));var statusDesc=[_0xd594('0x7'),_0xd594('0x8'),'inuse',_0xd594('0x9'),_0xd594('0xa'),_0xd594('0xb'),_0xd594('0xc'),_0xd594('0xd'),'onhold'];var applications=[_0xd594('0xe'),_0xd594('0xf'),_0xd594('0x10'),_0xd594('0x11'),_0xd594('0x12'),_0xd594('0x13')];var dispositions=['NO\x20ANSWER',_0xd594('0x14'),_0xd594('0x14'),'NO\x20ANSWER',_0xd594('0x15'),_0xd594('0x15'),_0xd594('0x16'),_0xd594('0x17'),_0xd594('0x14'),_0xd594('0x14'),_0xd594('0x14')];var actions={};config[_0xd594('0x18')]=_[_0xd594('0x19')](config[_0xd594('0x18')],{'host':'localhost','port':0x18eb});var io=require(_0xd594('0x1a'))(new Redis(config[_0xd594('0x18')]));function VoiceCallReport(_0x27daad){this[_0xd594('0x1b')]=_0x27daad[_0xd594('0x1b')];this['agents']=_0x27daad['agents'];ami['on']('coreshowchannel',this[_0xd594('0x1c')][_0xd594('0x1d')](this));ami['on'](_0xd594('0x1e'),this[_0xd594('0x1c')][_0xd594('0x1d')](this));ami['on']('newchannel',this[_0xd594('0x1f')][_0xd594('0x1d')](this));ami['on'](_0xd594('0x20'),this['syncNewState'][_0xd594('0x1d')](this));ami['on'](_0xd594('0x21'),this[_0xd594('0x22')]['bind'](this));ami['on'](_0xd594('0x23'),this[_0xd594('0x24')][_0xd594('0x1d')](this));ami['on'](_0xd594('0x25'),this[_0xd594('0x26')][_0xd594('0x1d')](this));ami['on'](_0xd594('0x27'),this[_0xd594('0x28')][_0xd594('0x1d')](this));ami['on'](_0xd594('0x29'),this[_0xd594('0x2a')][_0xd594('0x1d')](this));ami['on'](_0xd594('0x2b'),this['syncMusicOnHoldStart'][_0xd594('0x1d')](this));ami['on'](_0xd594('0x2c'),this['syncMusicOnHoldStop']['bind'](this));return BPromise['resolve']()[_0xd594('0x2d')](ami[_0xd594('0x2e')]())['catch'](function(_0x40b941){console[_0xd594('0x2f')](_0x40b941);});}VoiceCallReport['prototype']['isNotNull']=function(_0x1ad02d){return _0x1ad02d!==null&&!_[_0xd594('0x30')](_0x1ad02d);};VoiceCallReport[_0xd594('0x31')]['emit']=function(_0x32f99d,_0x346324,_0x24f736){io['to'](_0x32f99d)[_0xd594('0x32')](_0x346324,_0x24f736);};VoiceCallReport[_0xd594('0x31')]['syncNewCallerId']=function(_0x37c943){try{if(this[_0xd594('0x33')](_0x37c943)){if(_0x37c943[_0xd594('0x34')]===_0x37c943[_0xd594('0x35')]){if(!_['isUndefined'](this[_0xd594('0x1b')][_0x37c943[_0xd594('0x34')]])){_[_0xd594('0x36')](this[_0xd594('0x1b')][_0x37c943[_0xd594('0x34')]],_[_0xd594('0x37')](_0x37c943,_[_0xd594('0x38')](this[_0xd594('0x1b')][_0x37c943[_0xd594('0x34')]])));}}}}catch(_0x568a0c){logger[_0xd594('0x39')](_0xd594('0x3a'),util[_0xd594('0x3b')](_0x568a0c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd594('0x31')][_0xd594('0x1f')]=function(_0x1c5a2c){try{if(this['isNotNull'](_0x1c5a2c)){if(_0x1c5a2c[_0xd594('0x34')]===_0x1c5a2c[_0xd594('0x35')]&&_0x1c5a2c[_0xd594('0x3c')]!=_0xd594('0x3d')){if(_['isUndefined'](this[_0xd594('0x1b')][_0x1c5a2c['uniqueid']])){this[_0xd594('0x1b')][_0x1c5a2c[_0xd594('0x34')]]=new Channel();this[_0xd594('0x1b')][_0x1c5a2c[_0xd594('0x34')]][_0xd594('0x3e')]=moment()[_0xd594('0x3f')](_0xd594('0x40'));this[_0xd594('0x1b')][_0x1c5a2c[_0xd594('0x34')]]['disposition']=dispositions[_[_0xd594('0x41')](_0x1c5a2c['channelstate'])];_[_0xd594('0x36')](this[_0xd594('0x1b')][_0x1c5a2c[_0xd594('0x34')]],_[_0xd594('0x37')](_0x1c5a2c,_[_0xd594('0x38')](this[_0xd594('0x1b')][_0x1c5a2c[_0xd594('0x34')]])));if(_0x1c5a2c[_0xd594('0x42')]==='from-sip'){if(this[_0xd594('0x43')][_0x1c5a2c['channel'][_0xd594('0x44')]('-')[0x0]]){this[_0xd594('0x43')][_0x1c5a2c[_0xd594('0x3c')][_0xd594('0x44')]('-')[0x0]]['destconnectedlinenum']=_0x1c5a2c['exten'];this[_0xd594('0x32')](util['format'](_0xd594('0x45'),this[_0xd594('0x43')][_0x1c5a2c['channel']['split']('-')[0x0]][_0xd594('0x46')]),_0xd594('0x47'),{'destaccountcode':this[_0xd594('0x43')][_0x1c5a2c[_0xd594('0x3c')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x1c5a2c[_0xd594('0x48')]});}}}}}}catch(_0x97d1b3){logger[_0xd594('0x39')]('[syncNewChannel][VoiceCallReport]',util[_0xd594('0x3b')](_0x97d1b3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd594('0x31')][_0xd594('0x1c')]=function(_0x2cbb09){try{if(this[_0xd594('0x33')](_0x2cbb09)){if(_0x2cbb09['uniqueid']===_0x2cbb09[_0xd594('0x35')]&&_0x2cbb09['exten']!='h'&&_0x2cbb09['channel']!=_0xd594('0x3d')){_0x2cbb09[_0xd594('0x49')]=_0x2cbb09[_0xd594('0x49')][_0xd594('0x4a')]();_0x2cbb09[_0xd594('0x4b')]=(_0x2cbb09[_0xd594('0x4c')]||_0x2cbb09['applicationdata'])['toLowerCase']();if(_['isUndefined'](this[_0xd594('0x1b')][_0x2cbb09[_0xd594('0x34')]])){this[_0xd594('0x1b')][_0x2cbb09[_0xd594('0x34')]]=new Channel();this['channels'][_0x2cbb09[_0xd594('0x34')]][_0xd594('0x3e')]=_0x2cbb09[_0xd594('0x4d')]?moment()['subtract'](moment[_0xd594('0x4d')](_0x2cbb09['duration'])[_0xd594('0x4e')](),_0xd594('0x4e'))['format'](_0xd594('0x40')):moment()[_0xd594('0x3f')](_0xd594('0x40'));this[_0xd594('0x1b')][_0x2cbb09[_0xd594('0x34')]][_0xd594('0x4f')]=_0xd594('0x15');}_[_0xd594('0x36')](this['channels'][_0x2cbb09[_0xd594('0x34')]],_[_0xd594('0x37')](_0x2cbb09,_[_0xd594('0x38')](this['channels'][_0x2cbb09['uniqueid']])));if(_[_0xd594('0x50')](applications,_0x2cbb09[_0xd594('0x49')])){this[_0xd594('0x1b')][_0x2cbb09[_0xd594('0x34')]][_0xd594('0x51')]=_0x2cbb09[_0xd594('0x49')];this[_0xd594('0x1b')][_0x2cbb09[_0xd594('0x34')]][_0xd594('0x52')]=_0x2cbb09[_0xd594('0x4b')];if(_0x2cbb09[_0xd594('0x49')]===_0xd594('0xe')&&_[_0xd594('0x53')](_0x2cbb09[_0xd594('0x4b')],'cdr(')){var _0x531b0b=_0x2cbb09[_0xd594('0x4b')]['split']('=');var _0x2be401=_0x531b0b[0x0][_0xd594('0x54')](/cdr\((.*)\)/);if(_0x2be401){this[_0xd594('0x1b')][_0x2cbb09['uniqueid']][_0x2be401[0x1]]=_0x531b0b[0x1];}}else if(_0x2cbb09['application']==='queue'){this[_0xd594('0x1b')][_0x2cbb09['uniqueid']][_0xd594('0xf')]=_0x2cbb09[_0xd594('0x4b')][_0xd594('0x44')](',')[0x0];}}}}}catch(_0x200599){logger[_0xd594('0x39')]('[syncNewExten][VoiceCallReport]',util[_0xd594('0x3b')](_0x200599,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd594('0x31')]['syncNewState']=function(_0x2dcebc){try{if(this[_0xd594('0x33')](_0x2dcebc)){if(_0x2dcebc[_0xd594('0x34')]!==_0x2dcebc['linkedid']){if(this['channels'][_0x2dcebc[_0xd594('0x35')]]){if(_0x2dcebc['channelstate']==='6'){if(!this[_0xd594('0x1b')][_0x2dcebc[_0xd594('0x35')]][_0xd594('0x55')]){var _0x10823b=moment();this[_0xd594('0x1b')][_0x2dcebc[_0xd594('0x35')]][_0xd594('0x55')]=!![];this[_0xd594('0x1b')][_0x2dcebc[_0xd594('0x35')]][_0xd594('0x56')]=_0x10823b[_0xd594('0x3f')](_0xd594('0x40'));if(this[_0xd594('0x1b')][_0x2dcebc[_0xd594('0x35')]][_0xd594('0x3e')]){this[_0xd594('0x1b')][_0x2dcebc[_0xd594('0x35')]][_0xd594('0x57')]=_0x10823b['diff'](this[_0xd594('0x1b')][_0x2dcebc[_0xd594('0x35')]][_0xd594('0x3e')],_0xd594('0x4e'));}}this[_0xd594('0x1b')][_0x2dcebc['linkedid']][_0xd594('0x35')]=_0x2dcebc['uniqueid'];if(_0x2dcebc[_0xd594('0x58')]!==_0xd594('0x59')){this[_0xd594('0x1b')][_0x2dcebc[_0xd594('0x35')]][_0xd594('0x5a')]=_0x2dcebc[_0xd594('0x58')];}this[_0xd594('0x1b')][_0x2dcebc['linkedid']][_0xd594('0x5b')]=_0x2dcebc[_0xd594('0x5c')];this[_0xd594('0x1b')][_0x2dcebc[_0xd594('0x35')]][_0xd594('0x5d')]=_0x2dcebc[_0xd594('0x3c')];this['channels'][_0x2dcebc['linkedid']][_0xd594('0x4f')]=dispositions[_[_0xd594('0x41')](_0x2dcebc[_0xd594('0x5e')])];if(this[_0xd594('0x43')][_0x2dcebc[_0xd594('0x3c')]['split']('-')[0x0]]){this[_0xd594('0x1b')][_0x2dcebc['linkedid']]['UserId']=this[_0xd594('0x43')][_0x2dcebc[_0xd594('0x3c')]['split']('-')[0x0]]['id'];this[_0xd594('0x1b')][_0x2dcebc[_0xd594('0x35')]][_0xd594('0x5f')]=this['agents'][_0x2dcebc[_0xd594('0x3c')]['split']('-')[0x0]]['name'];}}}}else{if(this[_0xd594('0x1b')][_0x2dcebc[_0xd594('0x34')]]){if(_0x2dcebc[_0xd594('0x5e')]==='6'){if(this[_0xd594('0x43')][_0x2dcebc[_0xd594('0x3c')][_0xd594('0x44')]('-')[0x0]]){this[_0xd594('0x1b')][_0x2dcebc['uniqueid']]['UserId']=this[_0xd594('0x43')][_0x2dcebc[_0xd594('0x3c')][_0xd594('0x44')]('-')[0x0]]['id'];this[_0xd594('0x1b')][_0x2dcebc['uniqueid']][_0xd594('0x5f')]=this[_0xd594('0x43')][_0x2dcebc[_0xd594('0x3c')][_0xd594('0x44')]('-')[0x0]][_0xd594('0x46')];}}}}}}catch(_0x5661b1){logger['error'](_0xd594('0x60'),util[_0xd594('0x3b')](_0x5661b1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd594('0x31')]['syncMixMonitorFilename']=function(_0x4521ab,_0x48ef09){if(this[_0xd594('0x1b')][_0x4521ab]){this[_0xd594('0x1b')][_0x4521ab]['monitor']=!![];if(_[_0xd594('0x61')](_0x48ef09,_0xd594('0x62'))){_0x48ef09=_0x48ef09[_0xd594('0x63')](_0xd594('0x62'),'.WAV');}this[_0xd594('0x1b')][_0x4521ab]['monitorFilename']=_0x48ef09;var _0x42e78c=_[_0xd594('0x64')](this['channels'][_0x4521ab][_0xd594('0x65')],{'filename':_0x48ef09});if(_[_0xd594('0x66')](_0x42e78c)){this[_0xd594('0x1b')][_0x4521ab][_0xd594('0x65')][_0xd594('0x67')]({'filename':_0x48ef09,'createdAt':moment()[_0xd594('0x3f')](_0xd594('0x40')),'mixmonitorid':'','status':_0xd594('0x68')});}}};VoiceCallReport[_0xd594('0x31')]['syncVarSet']=function(_0x5cd9fc){try{if(this[_0xd594('0x33')](_0x5cd9fc)){if(this[_0xd594('0x1b')][_0x5cd9fc[_0xd594('0x34')]]&&_0x5cd9fc[_0xd594('0x3c')]!=_0xd594('0x3d')){if(this[_0xd594('0x33')](_0x5cd9fc['variable'])){if(this['isNotNull'](_0x5cd9fc[_0xd594('0x69')][_0xd594('0x6a')])){this[_0xd594('0x6b')](_0x5cd9fc[_0xd594('0x34')],_0x5cd9fc[_0xd594('0x6c')]);}else if(this[_0xd594('0x33')](_0x5cd9fc[_0xd594('0x69')][_0xd594('0x6d')])){this[_0xd594('0x1b')][_0x5cd9fc[_0xd594('0x34')]]['calleridnum']=_0x5cd9fc[_0xd594('0x6c')];}else if(this[_0xd594('0x33')](_0x5cd9fc['variable'][_0xd594('0x6e')])){this[_0xd594('0x1b')][_0x5cd9fc[_0xd594('0x34')]][_0xd594('0x6f')]=_0x5cd9fc[_0xd594('0x6c')];}else if(this[_0xd594('0x33')](_0x5cd9fc['variable'][_0xd594('0x70')])){this[_0xd594('0x1b')][_0x5cd9fc['uniqueid']]['type']=_0x5cd9fc[_0xd594('0x6c')];}else if(this[_0xd594('0x33')](_0x5cd9fc['variable'][_0xd594('0x71')])){this[_0xd594('0x1b')][_0x5cd9fc[_0xd594('0x34')]][_0xd594('0xf')]=_0x5cd9fc['value'][_0xd594('0x44')](',')[0x0];}else if(this[_0xd594('0x33')](_0x5cd9fc[_0xd594('0x69')][_0xd594('0x72')])){this[_0xd594('0x1b')][_0x5cd9fc[_0xd594('0x34')]][_0xd594('0x73')]=_0x5cd9fc['value'];}else if(this['isNotNull'](_0x5cd9fc[_0xd594('0x69')]['xmd-destination'])){this[_0xd594('0x1b')][_0x5cd9fc[_0xd594('0x34')]][_0xd594('0x74')]=_0x5cd9fc['value'];}else if(this[_0xd594('0x33')](_0x5cd9fc[_0xd594('0x69')]['xmd-callerid-preview'])){this[_0xd594('0x1b')][_0x5cd9fc[_0xd594('0x34')]]['calleridpreview']=_0x5cd9fc['value'];}else if(this['isNotNull'](_0x5cd9fc[_0xd594('0x69')][_0xd594('0x75')])){this[_0xd594('0x1b')][_0x5cd9fc[_0xd594('0x34')]][_0xd594('0xf')]=_0x5cd9fc[_0xd594('0x6c')];}else if(this['isNotNull'](_0x5cd9fc[_0xd594('0x69')]['sipcallid'])){this[_0xd594('0x1b')][_0x5cd9fc[_0xd594('0x34')]]['sipcalluniqueid']=_0x5cd9fc[_0xd594('0x6c')];}}}else if(this['isNotNull'](_0x5cd9fc['variable'][_0xd594('0x6a')])){if(_0x5cd9fc[_0xd594('0x6c')]){var _0x17cc52=path['parse'](_0x5cd9fc[_0xd594('0x6c')])[_0xd594('0x46')];this['syncMixMonitorFilename'](_0x17cc52,_0x5cd9fc[_0xd594('0x6c')]);}}else if(this[_0xd594('0x1b')][_0x5cd9fc[_0xd594('0x35')]]){if(this['isNotNull'](_0x5cd9fc[_0xd594('0x69')])){if(this[_0xd594('0x33')](_0x5cd9fc[_0xd594('0x69')]['sipcallid'])){this[_0xd594('0x1b')][_0x5cd9fc[_0xd594('0x35')]][_0xd594('0x76')]=_0x5cd9fc['value'];}}}}}catch(_0x24abc6){logger[_0xd594('0x39')](_0xd594('0x77'),util[_0xd594('0x3b')](_0x24abc6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd594('0x24')]=function(_0x4d43c5){try{if(this[_0xd594('0x33')](_0x4d43c5)){if(this[_0xd594('0x1b')][_0x4d43c5[_0xd594('0x34')]]){var _0x4eec91=moment();this[_0xd594('0x1b')][_0x4d43c5[_0xd594('0x34')]][_0xd594('0x78')]=_0x4eec91[_0xd594('0x3f')](_0xd594('0x40'));this[_0xd594('0x1b')][_0x4d43c5[_0xd594('0x34')]][_0xd594('0x4d')]=_0x4eec91[_0xd594('0x79')](this['channels'][_0x4d43c5['uniqueid']]['starttime'],_0xd594('0x4e'));if(this[_0xd594('0x1b')][_0x4d43c5[_0xd594('0x34')]][_0xd594('0x55')]){this[_0xd594('0x1b')][_0x4d43c5['uniqueid']][_0xd594('0x7a')]=_0x4eec91[_0xd594('0x79')](this['channels'][_0x4d43c5[_0xd594('0x34')]][_0xd594('0x56')],'seconds');this[_0xd594('0x1b')][_0x4d43c5[_0xd594('0x34')]][_0xd594('0x57')]=this['channels'][_0x4d43c5[_0xd594('0x34')]][_0xd594('0x4d')]-this[_0xd594('0x1b')][_0x4d43c5['uniqueid']][_0xd594('0x7a')];}if(_0x4d43c5['context']==='from-sip'){if(this[_0xd594('0x43')][_0x4d43c5[_0xd594('0x3c')]['split']('-')[0x0]]){this['agents'][_0x4d43c5[_0xd594('0x3c')][_0xd594('0x44')]('-')[0x0]]=_[_0xd594('0x7b')](this['agents'][_0x4d43c5['channel']['split']('-')[0x0]],[_0xd594('0x7c')]);this[_0xd594('0x32')](util[_0xd594('0x3f')](_0xd594('0x45'),this[_0xd594('0x43')][_0x4d43c5['channel'][_0xd594('0x44')]('-')[0x0]][_0xd594('0x46')]),'user:agentcomplete',{'destaccountcode':this['agents'][_0x4d43c5[_0xd594('0x3c')][_0xd594('0x44')]('-')[0x0]]['accountcode']});}}ami['emit'](_0xd594('0x7d'),this[_0xd594('0x1b')][_0x4d43c5[_0xd594('0x34')]]);delete this[_0xd594('0x1b')][_0x4d43c5['uniqueid']];}}}catch(_0x35e626){logger[_0xd594('0x39')]('[syncHangup][VoiceCallReport]',util[_0xd594('0x3b')](_0x35e626,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd594('0x31')][_0xd594('0x28')]=function(_0xbcec96){try{if(this[_0xd594('0x33')](_0xbcec96)){if(this['channels'][_0xbcec96['transfereeuniqueid']]){this[_0xd594('0x1b')][_0xbcec96[_0xd594('0x7e')]][_0xd594('0x7f')]=_0xbcec96[_0xd594('0x80')];this[_0xd594('0x1b')][_0xbcec96[_0xd594('0x7e')]][_0xd594('0x81')]=_0xbcec96['transfertargetcalleridnum'];if(this[_0xd594('0x1b')][_0xbcec96[_0xd594('0x82')]]){var _0x57116d=this[_0xd594('0x1b')][_0xbcec96[_0xd594('0x82')]];this[_0xd594('0x1b')][_0xbcec96[_0xd594('0x82')]]=this[_0xd594('0x1b')][_0xbcec96['transfereeuniqueid']];this['channels'][_0xbcec96[_0xd594('0x7e')]]=_0x57116d;}}else if(this[_0xd594('0x1b')][_0xbcec96[_0xd594('0x83')]]){this[_0xd594('0x1b')][_0xbcec96['transfertargetuniqueid']][_0xd594('0x7f')]=_0xbcec96[_0xd594('0x80')];this[_0xd594('0x1b')][_0xbcec96['transfertargetuniqueid']]['transferconnectedlinenum']=_0xbcec96[_0xd594('0x84')];if(this['channels'][_0xbcec96['origtransfereruniqueid']]){var _0x57116d=this[_0xd594('0x1b')][_0xbcec96[_0xd594('0x85')]];this[_0xd594('0x1b')][_0xbcec96['origtransfereruniqueid']]=this[_0xd594('0x1b')][_0xbcec96[_0xd594('0x83')]];this['channels'][_0xbcec96[_0xd594('0x83')]]=_0x57116d;}}}}catch(_0x374106){logger[_0xd594('0x39')](_0xd594('0x86'),util[_0xd594('0x3b')](_0x374106,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd594('0x2a')]=function(_0x195092){try{if(this['isNotNull'](_0x195092)){if(this[_0xd594('0x1b')][_0x195092[_0xd594('0x7e')]]){this[_0xd594('0x1b')][_0x195092[_0xd594('0x7e')]]['transfercalleridnum']=_0x195092[_0xd594('0x87')];this[_0xd594('0x1b')][_0x195092['transfereeuniqueid']][_0xd594('0x81')]=_0x195092[_0xd594('0x88')];this[_0xd594('0x24')]({'event':_0xd594('0x89'),'uniqueid':_0x195092[_0xd594('0x7e')],'context':_0x195092[_0xd594('0x42')],'channel':_0x195092['transfererchannel']});}}}catch(_0x321ab4){logger['error'](_0xd594('0x8a'),util[_0xd594('0x3b')](_0x321ab4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd594('0x31')][_0xd594('0x8b')]=function(_0xd3291d){try{if(this[_0xd594('0x33')](_0xd3291d)){if(this[_0xd594('0x1b')][_0xd3291d[_0xd594('0x34')]]){if(!_['isNil'](this['channels'][_0xd3291d['uniqueid']][_0xd594('0x56')])){this[_0xd594('0x1b')][_0xd3291d[_0xd594('0x34')]][_0xd594('0x8c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x891d6a){logger['error'](_0xd594('0x8d'),util[_0xd594('0x3b')](_0x891d6a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd594('0x31')][_0xd594('0x8e')]=function(_0x2da4d2){try{if(this[_0xd594('0x33')](_0x2da4d2)){if(this[_0xd594('0x1b')][_0x2da4d2['uniqueid']]){if(!_[_0xd594('0x66')](this[_0xd594('0x1b')][_0x2da4d2['uniqueid']][_0xd594('0x8c')])){this['channels'][_0x2da4d2['uniqueid']][_0xd594('0x8f')]+=moment()[_0xd594('0x90')](0x0)['diff'](this[_0xd594('0x1b')][_0x2da4d2[_0xd594('0x34')]][_0xd594('0x8c')],_0xd594('0x4e'));delete this[_0xd594('0x1b')][_0x2da4d2[_0xd594('0x34')]][_0xd594('0x8c')];}}}}catch(_0x2cf714){logger[_0xd594('0x39')](_0xd594('0x91'),util[_0xd594('0x3b')](_0x2cf714,{'showHidden':![],'depth':null}));}};module[_0xd594('0x92')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 5a3dcd9..17d29ea 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 _0x4f91=['util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','localhost','socket.io-emitter','redis','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','dialend','syncDialEnd','bind','syncVarSet','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','merge','uniqueid','format','called','substring','channel','lastIndexOf','omit','event','voice:outbound','voice_outbound_channel:save','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','sipuri','bridgepeer','bridgepvtcallid','membercalls','membername','memberpenalty','memberrealtime','includes','endtime','YYYY-MM-DD\x20HH:mm:ss','diff','starttime','seconds','complete','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','duration','custom:voiceDialReport','custom:dialend','voice_outbound:save','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash'];(function(_0x5843d4,_0x2f5730){var _0x185536=function(_0x4bb7b0){while(--_0x4bb7b0){_0x5843d4['push'](_0x5843d4['shift']());}};_0x185536(++_0x2f5730);}(_0x4f91,0x101));var _0x14f9=function(_0x1e7736,_0x505e08){_0x1e7736=_0x1e7736-0x0;var _0xf12a68=_0x4f91[_0x1e7736];return _0xf12a68;};'use strict';var _=require(_0x14f9('0x0'));var moment=require('moment');var util=require(_0x14f9('0x1'));var Redis=require(_0x14f9('0x2'));var config=require(_0x14f9('0x3'));var logger=require(_0x14f9('0x4'))(_0x14f9('0x5'));var ami=require(_0x14f9('0x6'));config['redis']=_[_0x14f9('0x7')](config['redis'],{'host':_0x14f9('0x8'),'port':0x18eb});var io=require(_0x14f9('0x9'))(new Redis(config[_0x14f9('0xa')]));function VoiceDialReport(_0x59d417){this[_0x14f9('0xb')]=_0x59d417[_0x14f9('0xc')];this[_0x14f9('0xd')]=_0x59d417['outbound'];this[_0x14f9('0xe')]={};ami['on'](_0x14f9('0xf'),this[_0x14f9('0x10')]['bind'](this));ami['on'](_0x14f9('0x11'),this[_0x14f9('0x12')][_0x14f9('0x13')](this));ami['on']('varset',this[_0x14f9('0x14')]['bind'](this));ami['on'](_0x14f9('0x15'),this[_0x14f9('0x16')][_0x14f9('0x13')](this));}VoiceDialReport['prototype'][_0x14f9('0x17')]=function(_0x47a24d){return _0x47a24d!==null&&!_[_0x14f9('0x18')](_0x47a24d);};VoiceDialReport[_0x14f9('0x19')]['emit']=function(_0x45c64e,_0x1828d7,_0x363e7f){io['to'](_0x45c64e)[_0x14f9('0x1a')](_0x1828d7,_0x363e7f);};VoiceDialReport[_0x14f9('0x19')][_0x14f9('0x10')]=function(_0x800453){try{if(this[_0x14f9('0x17')](_0x800453)){if(this['channels'][_0x800453['uniqueid']]){_[_0x14f9('0x1b')](this[_0x14f9('0xb')][_0x800453[_0x14f9('0x1c')]],{'starttime':moment()[_0x14f9('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x14f9('0x1e'),'interface':_0x800453['channel'][_0x14f9('0x1f')](0x0,_0x800453[_0x14f9('0x20')]['lastIndexOf']('-')),'membername':_0x800453[_0x14f9('0x20')][_0x14f9('0x1f')](_0x800453[_0x14f9('0x20')][_0x14f9('0x21')]('/')+0x1,_0x800453[_0x14f9('0x20')][_0x14f9('0x21')]('-'))},_[_0x14f9('0x22')](_0x800453,[_0x14f9('0x23'),'privilege']));this[_0x14f9('0x1a')](_0x14f9('0x24'),_0x14f9('0x25'),this[_0x14f9('0xb')][_0x800453[_0x14f9('0x1c')]]);ami[_0x14f9('0x1a')]('custom:dialbegin',this['channels'][_0x800453['uniqueid']]);}}}catch(_0x36ff81){logger[_0x14f9('0x26')](_0x14f9('0x27'),util[_0x14f9('0x28')](_0x36ff81,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x14f9('0x19')]['syncDialEnd']=function(_0x128a64){try{if(this[_0x14f9('0x17')](_0x128a64)){if(this['channels'][_0x128a64[_0x14f9('0x1c')]]){this[_0x14f9('0xb')][_0x128a64[_0x14f9('0x1c')]][_0x14f9('0x29')]=_0x128a64['dialstatus'];if(_0x128a64[_0x14f9('0x29')]===_0x14f9('0x2a')){this[_0x14f9('0xb')][_0x128a64[_0x14f9('0x1c')]][_0x14f9('0x2b')]=_0x128a64['connectedlinenum'];this['channels'][_0x128a64[_0x14f9('0x1c')]][_0x14f9('0x2c')]=_0x128a64[_0x14f9('0x2c')];this[_0x14f9('0xb')][_0x128a64['uniqueid']][_0x14f9('0x2d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x14f9('0xb')][_0x128a64['uniqueid']][_0x14f9('0x2e')]=_0x14f9('0x2f');ami['emit']('custom:dialconnect',this[_0x14f9('0xb')][_0x128a64[_0x14f9('0x1c')]]);}this[_0x14f9('0x1a')](_0x14f9('0x24'),_0x14f9('0x25'),this['channels'][_0x128a64[_0x14f9('0x1c')]]);}}}catch(_0x6cbf08){logger[_0x14f9('0x26')](_0x14f9('0x30'),util[_0x14f9('0x28')](_0x6cbf08,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x14f9('0x14')]=function(_0x3fcc4a){try{if(this[_0x14f9('0x17')](_0x3fcc4a)){this[_0x14f9('0x31')](_0x3fcc4a['uniqueid'],_[_0x14f9('0x32')](_0x3fcc4a[_0x14f9('0x33')])[0x0],_0x3fcc4a['value']);if(this[_0x14f9('0x17')](_0x3fcc4a['variable'])&&this[_0x14f9('0x17')](_0x3fcc4a[_0x14f9('0x33')]['outboundrouteid'])){if(_[_0x14f9('0x18')](this[_0x14f9('0xb')][_0x3fcc4a[_0x14f9('0x1c')]])){this[_0x14f9('0xb')][_0x3fcc4a[_0x14f9('0x1c')]]={'routeId':_0x3fcc4a[_0x14f9('0x34')],'variables':this['variables'][_0x3fcc4a['uniqueid']]};this[_0x14f9('0x1a')]('voice:outbound','voice_outbound_channel:save',this['channels'][_0x3fcc4a[_0x14f9('0x1c')]]);}}}}catch(_0xa5aafc){logger['error'](_0x14f9('0x35'),util['inspect'](_0xa5aafc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x14f9('0x19')][_0x14f9('0x31')]=function(_0x3a4ffb,_0x57166a,_0x2d176b){var _0x429036=['rtpaudioqos',_0x14f9('0x36'),_0x14f9('0x37'),'rtpaudioqosjitterbridged',_0x14f9('0x38'),'rtpaudioqoslossbridged',_0x14f9('0x39'),'rtpaudioqosrttbridged','sipcallid',_0x14f9('0x3a'),_0x14f9('0x3b'),_0x14f9('0x3c'),_0x14f9('0x3d'),'memberdynamic','memberinterface','memberlastcall',_0x14f9('0x3e'),_0x14f9('0x3f'),_0x14f9('0x40')];if(!_['isNil'](_0x57166a)&&!_[_0x14f9('0x41')](_0x429036,_0x57166a)){if(_['isUndefined'](this[_0x14f9('0xe')][_0x3a4ffb])){this[_0x14f9('0xe')][_0x3a4ffb]={};}this[_0x14f9('0xe')][_0x3a4ffb][_0x57166a]=_0x2d176b;}};VoiceDialReport[_0x14f9('0x19')][_0x14f9('0x16')]=function(_0x17a266){try{if(this[_0x14f9('0x17')](_0x17a266)){if(this[_0x14f9('0xb')][_0x17a266[_0x14f9('0x1c')]]){this[_0x14f9('0xb')][_0x17a266['uniqueid']][_0x14f9('0x42')]=moment()[_0x14f9('0x1d')](_0x14f9('0x43'));this[_0x14f9('0xb')][_0x17a266[_0x14f9('0x1c')]]['duration']=moment(this[_0x14f9('0xb')][_0x17a266[_0x14f9('0x1c')]][_0x14f9('0x42')])[_0x14f9('0x44')](this[_0x14f9('0xb')][_0x17a266[_0x14f9('0x1c')]][_0x14f9('0x45')],_0x14f9('0x46'));this[_0x14f9('0xb')][_0x17a266['uniqueid']][_0x14f9('0x2e')]=_0x14f9('0x47');this['outbound']['total']+=0x1;if(this['channels'][_0x17a266['uniqueid']]['answertime']){this[_0x14f9('0xd')][_0x14f9('0x48')]+=0x1;this[_0x14f9('0xb')][_0x17a266[_0x14f9('0x1c')]][_0x14f9('0x49')]=moment(this[_0x14f9('0xb')][_0x17a266[_0x14f9('0x1c')]][_0x14f9('0x2d')])[_0x14f9('0x44')](this['channels'][_0x17a266[_0x14f9('0x1c')]][_0x14f9('0x45')],_0x14f9('0x46'));this['channels'][_0x17a266[_0x14f9('0x1c')]][_0x14f9('0x4a')]=moment(this['channels'][_0x17a266[_0x14f9('0x1c')]][_0x14f9('0x42')])[_0x14f9('0x44')](this[_0x14f9('0xb')][_0x17a266[_0x14f9('0x1c')]]['answertime'],_0x14f9('0x46'));this['outbound'][_0x14f9('0x4b')]+=this['channels'][_0x17a266[_0x14f9('0x1c')]]['holdtime']||0x0;this[_0x14f9('0xd')][_0x14f9('0x4c')]+=this[_0x14f9('0xb')][_0x17a266[_0x14f9('0x1c')]]['billableseconds'];}this['outbound'][_0x14f9('0x4d')]+=this[_0x14f9('0xb')][_0x17a266[_0x14f9('0x1c')]][_0x14f9('0x4e')];ami['emit'](_0x14f9('0x4f'),this[_0x14f9('0xb')][_0x17a266[_0x14f9('0x1c')]]);ami[_0x14f9('0x1a')](_0x14f9('0x50'),this['channels'][_0x17a266['uniqueid']]);this[_0x14f9('0x1a')](_0x14f9('0x24'),_0x14f9('0x51'),this[_0x14f9('0xd')]);logger['info']('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x14f9('0x52')](this[_0x14f9('0xb')][_0x17a266[_0x14f9('0x1c')]]));this[_0x14f9('0x1a')](_0x14f9('0x24'),_0x14f9('0x53'),this[_0x14f9('0xb')][_0x17a266['uniqueid']]);delete this['channels'][_0x17a266['uniqueid']];}if(this[_0x14f9('0xe')][_0x17a266[_0x14f9('0x1c')]]){delete this['variables'][_0x17a266[_0x14f9('0x1c')]];}}}catch(_0x52436e){logger[_0x14f9('0x26')](_0x14f9('0x54'),util[_0x14f9('0x28')](_0x52436e,{'showHidden':![],'depth':null}));}};module[_0x14f9('0x55')]=VoiceDialReport; \ No newline at end of file +var _0x9349=['memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','syncHangup','endtime','duration','seconds','answered','holdtime','diff','starttime','billableseconds','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','moment','util','ioredis','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','varset','syncVarSet','hangup','isUndefined','prototype','emit','isNotNull','channels','merge','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','custom:dialconnect','[syncDialEnd][VoiceDialReport]','keys','value','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9349,0x16b));var _0x9934=function(_0x14c5c8,_0x381471){_0x14c5c8=_0x14c5c8-0x0;var _0x4ccb88=_0x9349[_0x14c5c8];return _0x4ccb88;};'use strict';var _=require('lodash');var moment=require(_0x9934('0x0'));var util=require(_0x9934('0x1'));var Redis=require(_0x9934('0x2'));var config=require('../../../config/environment');var logger=require(_0x9934('0x3'))('ami');var ami=require(_0x9934('0x4'));config[_0x9934('0x5')]=_[_0x9934('0x6')](config[_0x9934('0x5')],{'host':_0x9934('0x7'),'port':0x18eb});var io=require(_0x9934('0x8'))(new Redis(config[_0x9934('0x5')]));function VoiceDialReport(_0x1840bd){this['channels']=_0x1840bd[_0x9934('0x9')];this[_0x9934('0xa')]=_0x1840bd[_0x9934('0xa')];this[_0x9934('0xb')]={};ami['on'](_0x9934('0xc'),this[_0x9934('0xd')][_0x9934('0xe')](this));ami['on'](_0x9934('0xf'),this['syncDialEnd']['bind'](this));ami['on'](_0x9934('0x10'),this[_0x9934('0x11')][_0x9934('0xe')](this));ami['on'](_0x9934('0x12'),this['syncHangup'][_0x9934('0xe')](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x4b34ab){return _0x4b34ab!==null&&!_[_0x9934('0x13')](_0x4b34ab);};VoiceDialReport[_0x9934('0x14')][_0x9934('0x15')]=function(_0x4c566b,_0x1f55df,_0x2feea0){io['to'](_0x4c566b)[_0x9934('0x15')](_0x1f55df,_0x2feea0);};VoiceDialReport[_0x9934('0x14')]['syncDialBegin']=function(_0xd4e145){try{if(this[_0x9934('0x16')](_0xd4e145)){if(this[_0x9934('0x17')][_0xd4e145['uniqueid']]){_[_0x9934('0x18')](this[_0x9934('0x17')][_0xd4e145[_0x9934('0x19')]],{'starttime':moment()[_0x9934('0x1a')](_0x9934('0x1b')),'lastevent':'called','interface':_0xd4e145[_0x9934('0x1c')][_0x9934('0x1d')](0x0,_0xd4e145[_0x9934('0x1c')][_0x9934('0x1e')]('-')),'membername':_0xd4e145[_0x9934('0x1c')][_0x9934('0x1d')](_0xd4e145[_0x9934('0x1c')][_0x9934('0x1e')]('/')+0x1,_0xd4e145[_0x9934('0x1c')][_0x9934('0x1e')]('-'))},_[_0x9934('0x1f')](_0xd4e145,['event','privilege']));this['emit'](_0x9934('0x20'),_0x9934('0x21'),this['channels'][_0xd4e145['uniqueid']]);ami[_0x9934('0x15')](_0x9934('0x22'),this[_0x9934('0x17')][_0xd4e145[_0x9934('0x19')]]);}}}catch(_0x8daf0e){logger[_0x9934('0x23')](_0x9934('0x24'),util[_0x9934('0x25')](_0x8daf0e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9934('0x14')]['syncDialEnd']=function(_0x5bab89){try{if(this['isNotNull'](_0x5bab89)){if(this[_0x9934('0x17')][_0x5bab89[_0x9934('0x19')]]){this[_0x9934('0x17')][_0x5bab89['uniqueid']]['dialstatus']=_0x5bab89['dialstatus'];if(_0x5bab89[_0x9934('0x26')]===_0x9934('0x27')){this[_0x9934('0x17')][_0x5bab89['uniqueid']]['connectedlinenum']=_0x5bab89[_0x9934('0x28')];this[_0x9934('0x17')][_0x5bab89[_0x9934('0x19')]][_0x9934('0x29')]=_0x5bab89[_0x9934('0x29')];this['channels'][_0x5bab89[_0x9934('0x19')]][_0x9934('0x2a')]=moment()['format'](_0x9934('0x1b'));this[_0x9934('0x17')][_0x5bab89[_0x9934('0x19')]][_0x9934('0x2b')]='connect';ami[_0x9934('0x15')](_0x9934('0x2c'),this[_0x9934('0x17')][_0x5bab89['uniqueid']]);}this['emit'](_0x9934('0x20'),_0x9934('0x21'),this[_0x9934('0x17')][_0x5bab89['uniqueid']]);}}}catch(_0x32d2bf){logger['error'](_0x9934('0x2d'),util[_0x9934('0x25')](_0x32d2bf,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x9934('0x11')]=function(_0x48f48f){try{if(this[_0x9934('0x16')](_0x48f48f)){this['addVariable'](_0x48f48f[_0x9934('0x19')],_[_0x9934('0x2e')](_0x48f48f['variable'])[0x0],_0x48f48f[_0x9934('0x2f')]);if(this['isNotNull'](_0x48f48f['variable'])&&this[_0x9934('0x16')](_0x48f48f['variable']['outboundrouteid'])){if(_[_0x9934('0x13')](this[_0x9934('0x17')][_0x48f48f[_0x9934('0x19')]])){this[_0x9934('0x17')][_0x48f48f[_0x9934('0x19')]]={'routeId':_0x48f48f[_0x9934('0x2f')],'variables':this[_0x9934('0xb')][_0x48f48f[_0x9934('0x19')]]};this[_0x9934('0x15')](_0x9934('0x20'),_0x9934('0x21'),this['channels'][_0x48f48f[_0x9934('0x19')]]);}}}}catch(_0x4f743e){logger['error']('[syncVarSet][VoiceDialReport]',util[_0x9934('0x25')](_0x4f743e,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x9934('0x30')]=function(_0x47ecb6,_0xbf441d,_0x2851e8){var _0x3439ab=['rtpaudioqos',_0x9934('0x31'),_0x9934('0x32'),_0x9934('0x33'),_0x9934('0x34'),_0x9934('0x35'),_0x9934('0x36'),_0x9934('0x37'),_0x9934('0x38'),_0x9934('0x39'),_0x9934('0x3a'),_0x9934('0x3b'),_0x9934('0x3c'),_0x9934('0x3d'),_0x9934('0x3e'),_0x9934('0x3f'),'membername',_0x9934('0x40'),_0x9934('0x41')];if(!_[_0x9934('0x42')](_0xbf441d)&&!_['includes'](_0x3439ab,_0xbf441d)){if(_[_0x9934('0x13')](this[_0x9934('0xb')][_0x47ecb6])){this['variables'][_0x47ecb6]={};}this[_0x9934('0xb')][_0x47ecb6][_0xbf441d]=_0x2851e8;}};VoiceDialReport[_0x9934('0x14')][_0x9934('0x43')]=function(_0x5c4f45){try{if(this[_0x9934('0x16')](_0x5c4f45)){if(this[_0x9934('0x17')][_0x5c4f45['uniqueid']]){this[_0x9934('0x17')][_0x5c4f45['uniqueid']][_0x9934('0x44')]=moment()[_0x9934('0x1a')](_0x9934('0x1b'));this[_0x9934('0x17')][_0x5c4f45[_0x9934('0x19')]][_0x9934('0x45')]=moment(this[_0x9934('0x17')][_0x5c4f45[_0x9934('0x19')]][_0x9934('0x44')])['diff'](this[_0x9934('0x17')][_0x5c4f45[_0x9934('0x19')]]['starttime'],_0x9934('0x46'));this[_0x9934('0x17')][_0x5c4f45['uniqueid']]['lastevent']='complete';this[_0x9934('0xa')]['total']+=0x1;if(this['channels'][_0x5c4f45[_0x9934('0x19')]]['answertime']){this[_0x9934('0xa')][_0x9934('0x47')]+=0x1;this[_0x9934('0x17')][_0x5c4f45[_0x9934('0x19')]][_0x9934('0x48')]=moment(this[_0x9934('0x17')][_0x5c4f45['uniqueid']][_0x9934('0x2a')])[_0x9934('0x49')](this[_0x9934('0x17')][_0x5c4f45[_0x9934('0x19')]][_0x9934('0x4a')],_0x9934('0x46'));this[_0x9934('0x17')][_0x5c4f45[_0x9934('0x19')]][_0x9934('0x4b')]=moment(this[_0x9934('0x17')][_0x5c4f45[_0x9934('0x19')]][_0x9934('0x44')])[_0x9934('0x49')](this[_0x9934('0x17')][_0x5c4f45[_0x9934('0x19')]][_0x9934('0x2a')],_0x9934('0x46'));this[_0x9934('0xa')]['sumHoldTime']+=this[_0x9934('0x17')][_0x5c4f45[_0x9934('0x19')]]['holdtime']||0x0;this[_0x9934('0xa')]['sumBillable']+=this[_0x9934('0x17')][_0x5c4f45[_0x9934('0x19')]][_0x9934('0x4b')];}this[_0x9934('0xa')][_0x9934('0x4c')]+=this['channels'][_0x5c4f45[_0x9934('0x19')]][_0x9934('0x45')];ami['emit'](_0x9934('0x4d'),this[_0x9934('0x17')][_0x5c4f45[_0x9934('0x19')]]);ami['emit'](_0x9934('0x4e'),this['channels'][_0x5c4f45[_0x9934('0x19')]]);this['emit'](_0x9934('0x20'),_0x9934('0x4f'),this['outbound']);logger['info'](_0x9934('0x50'),JSON[_0x9934('0x51')](this['channels'][_0x5c4f45['uniqueid']]));this[_0x9934('0x15')](_0x9934('0x20'),_0x9934('0x52'),this[_0x9934('0x17')][_0x5c4f45[_0x9934('0x19')]]);delete this[_0x9934('0x17')][_0x5c4f45[_0x9934('0x19')]];}if(this[_0x9934('0xb')][_0x5c4f45[_0x9934('0x19')]]){delete this['variables'][_0x5c4f45[_0x9934('0x19')]];}}}catch(_0x5d4954){logger[_0x9934('0x23')](_0x9934('0x53'),util[_0x9934('0x25')](_0x5d4954,{'showHidden':![],'depth':null}));}};module[_0x9934('0x54')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 0778c98..761123c 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 _0x08e2=['syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','talking','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','switch','isNil','status','channel','catch','message','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','queueReports','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','format','voice:queue:%s','name','voice_queue_channel:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','emitVoiceQueueSummary','inbound','strategy','loggedIn','sumBillable','sumDuration','sumHoldTime','type','unmanaged','Trunk','active','Interval','isNotNull','isUndefined','Action','queues','[queues]','flagQueueSummary','queuesummary','then','[queuesummary]','countBy','queue','callers','available','toNumber','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','uniqueid','queuecallerjoinAt','position','count','merge','pick','push','emitVoiceQueueChannelSave','[syncQueueCallerJoin][VoiceQueueReport]','last','queuecallercomplete','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitreason','ABANDONED','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','toLowerCase','local/','linkedid','FORWARD','transferexten','destexten','transferuniqueid','COMPLETEDBY','[syncAgentComplete][VoiceQueueReport]','addVariable','keys','variable','value','queuestatus','CONTINUE','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepvtcallid','membercalls','memberinterface','membername','memberpenalty','memberrealtime','includes','syncHangup','length','diff','seconds','milliseconds','total','answered','queuecallercompleteAt','lastevent','custom:queuecallerunmanaged','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertype','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','BLIND','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','bluebird','util','md5','ioredis','../../../config/environment','../../../config/logger','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','tail','sequence','agents','channels','queueChannels','voiceQueues','campaigns','variables','syncQueueSummary','bind','syncQueueSummaryComplete','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','syncVarSet','hangup','fullybooted','syncFullyBooted','musiconholdstart'];(function(_0x432eda,_0x1e33d3){var _0x247a46=function(_0x567074){while(--_0x567074){_0x432eda['push'](_0x432eda['shift']());}};_0x247a46(++_0x1e33d3);}(_0x08e2,0xa6));var _0x208e=function(_0x25f0f5,_0x4eeced){_0x25f0f5=_0x25f0f5-0x0;var _0x181a3d=_0x08e2[_0x25f0f5];return _0x181a3d;};'use strict';var _=require(_0x208e('0x0'));var moment=require('moment');var BPromise=require(_0x208e('0x1'));var util=require(_0x208e('0x2'));var md5=require(_0x208e('0x3'));var Redis=require(_0x208e('0x4'));var config=require(_0x208e('0x5'));var logger=require(_0x208e('0x6'))('ami');var ami=require('../ami');var QueueReport=require(_0x208e('0x7'));config[_0x208e('0x8')]=_[_0x208e('0x9')](config[_0x208e('0x8')],{'host':_0x208e('0xa'),'port':0x18eb});var io=require(_0x208e('0xb'))(new Redis(config[_0x208e('0x8')]));var Sequence=function(){};Sequence[_0x208e('0xc')]['enqueue']=function(_0x4464de){this[_0x208e('0xd')]=this[_0x208e('0xd')]?this['tail']['finally'](_0x4464de):_0x4464de();};function VoiceQueueReport(_0x2bc3e5){this[_0x208e('0xe')]=new Sequence();this['queueReports']={};this[_0x208e('0xf')]=_0x2bc3e5['agents'];this[_0x208e('0x10')]=_0x2bc3e5[_0x208e('0x11')];this[_0x208e('0x12')]=_0x2bc3e5['voiceQueues'];this['flagQueueSummary']=!![];this[_0x208e('0x13')]=_0x2bc3e5[_0x208e('0x13')];this[_0x208e('0x14')]={};ami['on']('queuesummary',this[_0x208e('0x15')][_0x208e('0x16')](this));ami['on']('queuesummarycomplete',this[_0x208e('0x17')][_0x208e('0x16')](this));ami['on']('queuecallerjoin',this[_0x208e('0x18')][_0x208e('0x16')](this));ami['on']('queuecallerabandon',this[_0x208e('0x19')]['bind'](this));ami['on'](_0x208e('0x1a'),this[_0x208e('0x1b')][_0x208e('0x16')](this));ami['on'](_0x208e('0x1c'),this[_0x208e('0x1d')][_0x208e('0x16')](this));ami['on'](_0x208e('0x1e'),this[_0x208e('0x1f')][_0x208e('0x16')](this));ami['on']('varset',this[_0x208e('0x20')]['bind'](this));ami['on'](_0x208e('0x21'),this['syncHangup'][_0x208e('0x16')](this));ami['on'](_0x208e('0x22'),this[_0x208e('0x23')]['bind'](this));ami['on'](_0x208e('0x24'),this[_0x208e('0x25')]['bind'](this));ami['on'](_0x208e('0x26'),this[_0x208e('0x27')][_0x208e('0x16')](this));ami['on'](_0x208e('0x28'),this[_0x208e('0x29')][_0x208e('0x16')](this));ami['on']('blindtransfer',this[_0x208e('0x2a')][_0x208e('0x16')](this));this[_0x208e('0x2b')]();this[_0x208e('0x2c')]();}function isNotNull(_0x448d18){return _0x448d18!==null&&!_['isUndefined'](_0x448d18);}function clearChannels(_0x1507b6){if(!_[_0x208e('0x2d')](_0x1507b6)){for(var _0x1fffb4 in _0x1507b6){if(_0x1507b6[_0x208e('0x2e')](_0x1fffb4)){delete _0x1507b6[_0x1fffb4];}}}}function clearCampaigns(_0x4b472b){if(!_[_0x208e('0x2d')](_0x4b472b)){for(var _0x1abc71 in _0x4b472b){if(_0x4b472b['hasOwnProperty'](_0x1abc71)){_0x4b472b[_0x1abc71]['originated']=0x0;}}}}function clearVoiceQueues(_0x9f012a){if(!_[_0x208e('0x2d')](_0x9f012a)){for(var _0x2f3462 in _0x9f012a){if(_0x9f012a[_0x208e('0x2e')](_0x2f3462)){_0x9f012a[_0x2f3462]['originated']=0x0;_0x9f012a[_0x2f3462][_0x208e('0x2f')]=0x0;_0x9f012a[_0x2f3462][_0x208e('0x30')]=0x0;_0x9f012a[_0x2f3462][_0x208e('0x31')]=0x0;_0x9f012a[_0x2f3462][_0x208e('0x32')]=!![];}}}}function clearAgentBooked(_0x4067aa){if(!_[_0x208e('0x2d')](_0x4067aa)){for(var _0x12dfa9 in _0x4067aa){if(_0x4067aa['hasOwnProperty'](_0x12dfa9)){_0x4067aa[_0x12dfa9][_0x208e('0x33')]=!![];}}}}VoiceQueueReport[_0x208e('0xc')][_0x208e('0x34')]=function(){var _0xca369a=this;for(var _0x46129e in this['channels']){if(this[_0x208e('0x10')][_0x208e('0x2e')](_0x46129e)&&!this[_0x208e('0x10')][_0x46129e][_0x208e('0x35')]){this[_0x208e('0xe')]['enqueue'](function(){if(!_[_0x208e('0x36')](_0xca369a[_0x208e('0x10')][_0x46129e])){return ami['Action']({'action':_0x208e('0x37'),'channel':_0xca369a[_0x208e('0x10')][_0x46129e][_0x208e('0x38')]})[_0x208e('0x39')](function(_0x5c188e){if(_0x5c188e[_0x208e('0x3a')]===_0x208e('0x3b')){setTimeout(function(){if(_0xca369a[_0x208e('0x10')][_0x46129e]){delete _0xca369a[_0x208e('0x10')][_0x46129e];logger[_0x208e('0x3c')](_0x208e('0x3d'),_0x46129e);}if(_0xca369a[_0x208e('0x3e')][_0x46129e]){delete _0xca369a[_0x208e('0x3e')][_0x46129e];logger['error'](_0x208e('0x3f'),_0x46129e);}if(_0xca369a[_0x208e('0x14')][_0x46129e]){delete _0xca369a[_0x208e('0x14')][_0x46129e];logger[_0x208e('0x3c')](_0x208e('0x40'),_0x46129e);}},0x1f40);}});}});}}};VoiceQueueReport[_0x208e('0xc')][_0x208e('0x23')]=function(){logger['error'](_0x208e('0x41'));clearChannels(this[_0x208e('0x10')]);this[_0x208e('0x42')](this[_0x208e('0x3e')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x208e('0x12')]);clearCampaigns(this[_0x208e('0x13')]);};VoiceQueueReport[_0x208e('0xc')]['clearQueueReport']=function(_0x502088){var _0x150894=this;if(!_[_0x208e('0x2d')](_0x502088)){for(var _0x5e5aaf in _0x502088){if(_0x502088[_0x208e('0x2e')](_0x5e5aaf)){_0x150894[_0x208e('0x43')](_0x502088[_0x5e5aaf]);delete _0x502088[_0x5e5aaf];}}}};function loggerCatch(_0x2413e6){return function(_0x3b7656){logger[_0x208e('0x3c')](_0x2413e6,util[_0x208e('0x44')](_0x3b7656,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x208e('0xc')]['emit']=function(_0x11b214,_0x59c414,_0x23c045){io['to'](_0x11b214)[_0x208e('0x45')](_0x59c414,_0x23c045);};VoiceQueueReport[_0x208e('0xc')]['emitVoiceQueueChannelSave']=function(_0x125c2c){this[_0x208e('0x45')](util[_0x208e('0x46')](_0x208e('0x47'),_0x125c2c[_0x208e('0x48')]),_0x208e('0x49'),_0x125c2c);};VoiceQueueReport[_0x208e('0xc')][_0x208e('0x43')]=function(_0xf69eba){logger[_0x208e('0x4a')](_0x208e('0x4b'),JSON[_0x208e('0x4c')](_0xf69eba));this[_0x208e('0x45')](util['format'](_0x208e('0x47'),_0xf69eba[_0x208e('0x48')]),_0x208e('0x4d'),_0xf69eba);};VoiceQueueReport['prototype'][_0x208e('0x4e')]=function(_0x2a26e7){if(_0x2a26e7['type']===_0x208e('0x4f')){var _0x5018f5={'id':_0x2a26e7['id'],'name':_0x2a26e7['name'],'strategy':_0x2a26e7[_0x208e('0x50')],'answered':_0x2a26e7['answered'],'available':_0x2a26e7['available'],'loggedIn':_0x2a26e7[_0x208e('0x51')],'pTalking':_0x2a26e7[_0x208e('0x30')],'sumBillable':_0x2a26e7[_0x208e('0x52')],'sumDuration':_0x2a26e7[_0x208e('0x53')],'sumHoldTime':_0x2a26e7[_0x208e('0x54')]||0x0,'talking':_0x2a26e7['talking'],'total':_0x2a26e7['total'],'type':_0x2a26e7[_0x208e('0x55')],'unmanaged':_0x2a26e7[_0x208e('0x56')],'abandoned':_0x2a26e7['abandoned'],'waiting':_0x2a26e7[_0x208e('0x31')]};if(_0x2a26e7[_0x208e('0x57')]){_0x5018f5[_0x208e('0x57')]={'id':_0x2a26e7['Trunk']['id'],'name':_0x2a26e7[_0x208e('0x57')][_0x208e('0x48')],'active':_0x2a26e7[_0x208e('0x57')][_0x208e('0x58')],'callerid':_0x2a26e7[_0x208e('0x57')]['callerid']};}if(_0x2a26e7[_0x208e('0x59')]){_0x5018f5['Interval']={'id':_0x2a26e7[_0x208e('0x59')]['id'],'name':_0x2a26e7[_0x208e('0x59')][_0x208e('0x48')]};}var _0x3f826a=md5(JSON[_0x208e('0x4c')](_0x5018f5));if(_0x2a26e7['md5']!==_0x3f826a){_0x2a26e7[_0x208e('0x3')]=_0x3f826a;this['emit'](util['format'](_0x208e('0x47'),_0x5018f5[_0x208e('0x48')]),'voice_queue:save',_0x5018f5);}}};VoiceQueueReport[_0x208e('0xc')][_0x208e('0x5a')]=function(_0x5eb5d2){return _0x5eb5d2!==null&&!_[_0x208e('0x5b')](_0x5eb5d2);};VoiceQueueReport[_0x208e('0xc')][_0x208e('0x2c')]=function(){var _0x4b930e=this;setInterval(function(){_0x4b930e['clearZombieChannels']();ami[_0x208e('0x5c')]({'action':_0x208e('0x5d')})[_0x208e('0x39')](loggerCatch(_0x208e('0x5e')));},0x2710);};VoiceQueueReport[_0x208e('0xc')]['loopQueueSummary']=function(){var _0x524bc2=this;setInterval(function(){if(_0x524bc2[_0x208e('0x5f')]){return ami[_0x208e('0x5c')]({'action':_0x208e('0x60')})[_0x208e('0x61')](function(_0x48315a){_0x524bc2['flagQueueSummary']=![];})[_0x208e('0x39')](loggerCatch(_0x208e('0x62')));}},0x3e8);};VoiceQueueReport[_0x208e('0xc')][_0x208e('0x15')]=function(_0x439a83){try{if(this[_0x208e('0x5a')](_0x439a83)&&this[_0x208e('0x5a')](_0x439a83['queue'])){if(this['voiceQueues'][_0x439a83['queue']]){var _0x487810=_[_0x208e('0x63')](this['channels'],_0x208e('0x64'))[_0x439a83[_0x208e('0x64')]]||0x0;var _0x5beb8a=_0x487810-_0x439a83[_0x208e('0x65')];if(this['voiceQueues'][_0x439a83[_0x208e('0x64')]][_0x208e('0x31')]!==_['toNumber'](_0x439a83['callers'])||this[_0x208e('0x12')][_0x439a83[_0x208e('0x64')]][_0x208e('0x51')]!==_['toNumber'](_0x439a83['loggedin'])||this['voiceQueues'][_0x439a83[_0x208e('0x64')]][_0x208e('0x66')]!==_[_0x208e('0x67')](_0x439a83['available'])||this[_0x208e('0x12')][_0x439a83[_0x208e('0x64')]][_0x208e('0x2f')]!==_0x5beb8a){this[_0x208e('0x12')][_0x439a83[_0x208e('0x64')]][_0x208e('0x31')]=_[_0x208e('0x67')](_0x439a83['callers']);this[_0x208e('0x12')][_0x439a83[_0x208e('0x64')]][_0x208e('0x51')]=_[_0x208e('0x67')](_0x439a83['loggedin']);this['voiceQueues'][_0x439a83[_0x208e('0x64')]][_0x208e('0x66')]=_[_0x208e('0x67')](_0x439a83[_0x208e('0x66')]);this[_0x208e('0x12')][_0x439a83[_0x208e('0x64')]][_0x208e('0x2f')]=_0x5beb8a>0x0?_0x5beb8a:0x0;this[_0x208e('0x12')][_0x439a83[_0x208e('0x64')]][_0x208e('0x2f')]=this['voiceQueues'][_0x439a83[_0x208e('0x64')]][_0x208e('0x2f')]>_[_0x208e('0x67')](_0x439a83[_0x208e('0x68')])?_[_0x208e('0x67')](_0x439a83['loggedin']):this[_0x208e('0x12')][_0x439a83['queue']]['talking'];this[_0x208e('0x4e')](this[_0x208e('0x12')][_0x439a83['queue']]);}ami[_0x208e('0x45')](_0x208e('0x69'),this[_0x208e('0x12')][_0x439a83['queue']]);}}}catch(_0x1e06a8){logger['error'](_0x208e('0x6a'),util[_0x208e('0x44')](_0x1e06a8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x208e('0xc')][_0x208e('0x17')]=function(_0x29faaf){this['flagQueueSummary']=!![];};VoiceQueueReport[_0x208e('0xc')]['syncNewExten']=function(_0x314d50){};VoiceQueueReport[_0x208e('0xc')][_0x208e('0x18')]=function(_0x32dc6c){try{if(this[_0x208e('0x5a')](_0x32dc6c)){if(_[_0x208e('0x5b')](this[_0x208e('0x3e')][_0x32dc6c['uniqueid']])){this[_0x208e('0x3e')][_0x32dc6c['uniqueid']]=[];this[_0x208e('0x10')][_0x32dc6c[_0x208e('0x6b')]]={};}var _0x471783=new QueueReport();_0x471783['name']=_0x32dc6c[_0x208e('0x64')];_0x471783[_0x208e('0x55')]=this['voiceQueues'][_0x471783['name']]&&this[_0x208e('0x12')][_0x471783['name']][_0x208e('0x55')]?this[_0x208e('0x12')][_0x471783['name']][_0x208e('0x55')]||'inbound':_0x208e('0x4f');_0x471783[_0x208e('0x64')]=_0x32dc6c['queue'];_0x471783[_0x208e('0x6c')]=moment()[_0x208e('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x471783['position']=_0x32dc6c[_0x208e('0x6d')];_0x471783[_0x208e('0x6e')]=_0x32dc6c[_0x208e('0x6e')];_[_0x208e('0x6f')](_0x471783,_[_0x208e('0x70')](_0x32dc6c,_['keys'](_0x471783)));this[_0x208e('0x3e')][_0x32dc6c[_0x208e('0x6b')]][_0x208e('0x71')](_0x471783);this['channels'][_0x32dc6c[_0x208e('0x6b')]]=_0x471783;this[_0x208e('0x72')](_0x471783);}}catch(_0x2b0207){logger[_0x208e('0x3c')](_0x208e('0x73'),util['inspect'](_0x2b0207,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x208e('0x19')]=function(_0x36c503){try{if(this[_0x208e('0x5a')](_0x36c503)){if(this[_0x208e('0x3e')][_0x36c503[_0x208e('0x6b')]]){var _0xd65ffb=_[_0x208e('0x74')](this[_0x208e('0x3e')][_0x36c503[_0x208e('0x6b')]]);_0xd65ffb[_0x208e('0x75')]=![];_0xd65ffb['queuecallercompleteAt']=null;_0xd65ffb[_0x208e('0x76')]=_0x36c503[_0x208e('0x76')];_0xd65ffb['originalposition']=_0x36c503[_0x208e('0x77')];_0xd65ffb[_0x208e('0x78')]=!![];_0xd65ffb[_0x208e('0x79')]=moment()[_0x208e('0x46')](_0x208e('0x7a'));_0xd65ffb[_0x208e('0x7b')]=_0x208e('0x7c');_0xd65ffb[_0x208e('0x7d')]=null;this[_0x208e('0x10')][_0x36c503[_0x208e('0x6b')]]=_0xd65ffb;this['emitVoiceQueueChannelRemove'](_0xd65ffb);}}}catch(_0x3fd9ac){logger[_0x208e('0x3c')](_0x208e('0x7e'),util[_0x208e('0x44')](_0x3fd9ac,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x208e('0xc')][_0x208e('0x1b')]=function(_0x2a8298){try{if(this[_0x208e('0x5a')](_0x2a8298)){if(this['queueReports'][_0x2a8298['uniqueid']]){var _0x15a0af=_[_0x208e('0x74')](this[_0x208e('0x3e')][_0x2a8298[_0x208e('0x6b')]]);_0x15a0af[_0x208e('0x7f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x15a0af['connectedlinenum']=_0x2a8298[_0x208e('0x80')];_0x15a0af['connectedlinename']=_0x2a8298[_0x208e('0x81')];this[_0x208e('0x10')][_0x2a8298[_0x208e('0x6b')]]=_0x15a0af;this[_0x208e('0x72')](_0x15a0af);}}}catch(_0x47dd49){logger['error'](_0x208e('0x82'),util[_0x208e('0x44')](_0x47dd49,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x208e('0xc')]['syncAgentConnect']=function(_0x2b39ad){try{if(this['isNotNull'](_0x2b39ad)){if(this[_0x208e('0x3e')][_0x2b39ad[_0x208e('0x6b')]]){var _0x31bda4=_[_0x208e('0x74')](this[_0x208e('0x3e')][_0x2b39ad[_0x208e('0x6b')]]);_0x31bda4['queuecallercomplete']=!![];_0x31bda4[_0x208e('0x7b')]=_0x208e('0x83');}}}catch(_0x34d95b){logger[_0x208e('0x3c')](_0x208e('0x84'),util['inspect'](_0x34d95b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x208e('0xc')][_0x208e('0x1d')]=function(_0x2181d2){try{if(this['isNotNull'](_0x2181d2)){if(this['queueReports'][_0x2181d2[_0x208e('0x6b')]]){var _0x5588de=_[_0x208e('0x74')](this['queueReports'][_0x2181d2[_0x208e('0x6b')]]);_0x5588de[_0x208e('0x78')]=![];_0x5588de[_0x208e('0x79')]=null;_0x5588de['assigned']=!![];_0x5588de[_0x208e('0x7d')]=_0x2181d2['membername'];_0x5588de[_0x208e('0x76')]=_0x2181d2[_0x208e('0x76')];_0x5588de[_0x208e('0x75')]=!![];_0x5588de[_0x208e('0x85')]=![];_0x5588de[_0x208e('0x86')]=null;if(!_0x5588de[_0x208e('0x87')]){if(_0x2181d2[_0x208e('0x88')]=='transfer'){_0x5588de[_0x208e('0x7b')]=_0x208e('0x89');}else{if(_['startsWith'](_0x2181d2[_0x208e('0x38')][_0x208e('0x8a')](),_0x208e('0x8b'))){if(this[_0x208e('0x3e')][_0x2181d2['linkedid']]){var _0x3aea01=_[_0x208e('0x74')](this[_0x208e('0x3e')][_0x2181d2[_0x208e('0x8c')]]);_0x3aea01[_0x208e('0x75')]=![];_0x3aea01[_0x208e('0x85')]=!![];_0x3aea01[_0x208e('0x86')]=moment(_0x5588de[_0x208e('0x6c')])['add'](_0x2181d2['holdtime'],'seconds')['format'](_0x208e('0x7a'));_0x3aea01[_0x208e('0x7b')]='FORWARDTRANSFER';_0x3aea01[_0x208e('0x87')]=!![];_0x3aea01['transfertype']=_0x208e('0x8d');_0x3aea01[_0x208e('0x8e')]=_0x2181d2[_0x208e('0x8f')];_0x3aea01[_0x208e('0x90')]=_0x2181d2[_0x208e('0x6b')];var _0x190a14=this[_0x208e('0x3e')][_0x2181d2[_0x208e('0x8c')]];this[_0x208e('0x3e')][_0x2181d2[_0x208e('0x8c')]]=this[_0x208e('0x3e')][_0x2181d2[_0x208e('0x6b')]];this[_0x208e('0x3e')][_0x2181d2[_0x208e('0x6b')]]=_0x190a14;}}else{_0x5588de[_0x208e('0x7b')]=_0x208e('0x91')+_0x2181d2[_0x208e('0x88')]['toUpperCase']();}}}this[_0x208e('0x10')][_0x2181d2[_0x208e('0x6b')]]=_0x5588de;this[_0x208e('0x43')](_0x5588de);}}}catch(_0x3b9a3b){logger['error'](_0x208e('0x92'),util[_0x208e('0x44')](_0x3b9a3b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x208e('0xc')][_0x208e('0x20')]=function(_0x39a0f0){try{if(this[_0x208e('0x5a')](_0x39a0f0)){this[_0x208e('0x93')](_0x39a0f0[_0x208e('0x6b')],_[_0x208e('0x94')](_0x39a0f0[_0x208e('0x95')])[0x0],_0x39a0f0[_0x208e('0x96')]);if(this['queueReports'][_0x39a0f0[_0x208e('0x6b')]]){var _0x4f02ed=_['last'](this[_0x208e('0x3e')][_0x39a0f0[_0x208e('0x6b')]]);if(_0x4f02ed){if(this['isNotNull'](_0x39a0f0[_0x208e('0x95')])&&this[_0x208e('0x5a')](_0x39a0f0['variable'][_0x208e('0x97')])){switch(_0x39a0f0[_0x208e('0x96')]){case _0x208e('0x98'):_0x4f02ed[_0x208e('0x85')]=![];_0x4f02ed[_0x208e('0x86')]=null;break;default:_0x4f02ed[_0x208e('0x85')]=!![];_0x4f02ed['queuecallerexitAt']=moment()[_0x208e('0x46')](_0x208e('0x7a'));_0x4f02ed[_0x208e('0x7f')]=moment()['format'](_0x208e('0x7a'));}_0x4f02ed[_0x208e('0x78')]=![];_0x4f02ed[_0x208e('0x79')]=null;_0x4f02ed['queuecallerexitreason']=_0x39a0f0[_0x208e('0x96')];this[_0x208e('0x10')][_0x39a0f0[_0x208e('0x6b')]]=_0x4f02ed;this['emitVoiceQueueChannelRemove'](_0x4f02ed);}else if(this[_0x208e('0x5a')](_0x39a0f0['variable'])&&this['isNotNull'](_0x39a0f0[_0x208e('0x95')][_0x208e('0x99')])){if(!_0x4f02ed[_0x208e('0x78')]){_0x4f02ed[_0x208e('0x85')]=!![];_0x4f02ed[_0x208e('0x86')]=moment()['format'](_0x208e('0x7a'));_0x4f02ed[_0x208e('0x7b')]=_0x208e('0x9a');_0x4f02ed[_0x208e('0x7f')]=moment()[_0x208e('0x46')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x208e('0x10')][_0x39a0f0[_0x208e('0x6b')]]=_0x4f02ed;}}_0x4f02ed[_0x208e('0x14')]=this[_0x208e('0x14')][_0x39a0f0[_0x208e('0x6b')]];}}}}catch(_0x435609){logger[_0x208e('0x3c')](_0x208e('0x9b'),util['inspect'](_0x435609,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x208e('0x93')]=function(_0x353b86,_0x2d596d,_0x17e96b){var _0x1476c1=[_0x208e('0x9c'),_0x208e('0x9d'),_0x208e('0x9e'),_0x208e('0x9f'),_0x208e('0xa0'),_0x208e('0xa1'),_0x208e('0xa2'),'rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer',_0x208e('0xa3'),_0x208e('0xa4'),'memberdynamic',_0x208e('0xa5'),'memberlastcall',_0x208e('0xa6'),_0x208e('0xa7'),_0x208e('0xa8')];if(!_[_0x208e('0x36')](_0x2d596d)&&!_[_0x208e('0xa9')](_0x1476c1,_0x2d596d)){if(_['isUndefined'](this[_0x208e('0x14')][_0x353b86])){this[_0x208e('0x14')][_0x353b86]={};}this[_0x208e('0x14')][_0x353b86][_0x2d596d]=_0x17e96b;}};VoiceQueueReport[_0x208e('0xc')][_0x208e('0xaa')]=function(_0x3b572a){try{if(this[_0x208e('0x5a')](_0x3b572a)){if(this['queueReports'][_0x3b572a['uniqueid']]){for(var _0x4a9659=0x0,_0x9ba672={};_0x4a96590x0?_0x46a2bf:0x0;this[_0x81f2('0x15')][_0x50e789[_0x81f2('0x64')]]['talking']=this['voiceQueues'][_0x50e789[_0x81f2('0x64')]][_0x81f2('0x33')]>_['toNumber'](_0x50e789['loggedin'])?_[_0x81f2('0x66')](_0x50e789[_0x81f2('0x68')]):this[_0x81f2('0x15')][_0x50e789[_0x81f2('0x64')]]['talking'];this['emitVoiceQueueSummary'](this[_0x81f2('0x15')][_0x50e789[_0x81f2('0x64')]]);}ami[_0x81f2('0x49')](_0x81f2('0x69'),this[_0x81f2('0x15')][_0x50e789[_0x81f2('0x64')]]);}}}catch(_0x5ef02f){logger[_0x81f2('0x41')](_0x81f2('0x6a'),util[_0x81f2('0x48')](_0x5ef02f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x81f2('0xe')][_0x81f2('0x1c')]=function(_0x471144){this[_0x81f2('0x16')]=!![];};VoiceQueueReport['prototype'][_0x81f2('0x6b')]=function(_0x58deb8){};VoiceQueueReport[_0x81f2('0xe')][_0x81f2('0x6c')]=function(_0x2637de){try{if(this[_0x81f2('0x63')](_0x2637de)){if(_[_0x81f2('0x2f')](this['queueReports'][_0x2637de[_0x81f2('0x6d')]])){this[_0x81f2('0x12')][_0x2637de[_0x81f2('0x6d')]]=[];this[_0x81f2('0x37')][_0x2637de['uniqueid']]={};}var _0x14362e=new QueueReport();_0x14362e['name']=_0x2637de[_0x81f2('0x64')];_0x14362e[_0x81f2('0x52')]=this[_0x81f2('0x15')][_0x14362e['name']]&&this[_0x81f2('0x15')][_0x14362e[_0x81f2('0x4d')]][_0x81f2('0x52')]?this[_0x81f2('0x15')][_0x14362e[_0x81f2('0x4d')]][_0x81f2('0x52')]||_0x81f2('0x6e'):'inbound';_0x14362e[_0x81f2('0x64')]=_0x2637de['queue'];_0x14362e[_0x81f2('0x6f')]=moment()[_0x81f2('0x4b')](_0x81f2('0x70'));_0x14362e[_0x81f2('0x71')]=_0x2637de['position'];_0x14362e['count']=_0x2637de['count'];_['merge'](_0x14362e,_[_0x81f2('0x72')](_0x2637de,_['keys'](_0x14362e)));this['queueReports'][_0x2637de[_0x81f2('0x6d')]][_0x81f2('0x73')](_0x14362e);this['channels'][_0x2637de['uniqueid']]=_0x14362e;this['emitVoiceQueueChannelSave'](_0x14362e);}}catch(_0x276cba){logger[_0x81f2('0x41')](_0x81f2('0x74'),util[_0x81f2('0x48')](_0x276cba,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x81f2('0x1f')]=function(_0x33d079){try{if(this[_0x81f2('0x63')](_0x33d079)){if(this[_0x81f2('0x12')][_0x33d079[_0x81f2('0x6d')]]){var _0x5f1f80=_[_0x81f2('0x75')](this['queueReports'][_0x33d079['uniqueid']]);_0x5f1f80[_0x81f2('0x76')]=![];_0x5f1f80[_0x81f2('0x77')]=null;_0x5f1f80['holdtime']=_0x33d079[_0x81f2('0x78')];_0x5f1f80[_0x81f2('0x79')]=_0x33d079[_0x81f2('0x79')];_0x5f1f80[_0x81f2('0x1e')]=!![];_0x5f1f80[_0x81f2('0x7a')]=moment()['format'](_0x81f2('0x70'));_0x5f1f80[_0x81f2('0x7b')]=_0x81f2('0x7c');_0x5f1f80['lastAssignedTo']=null;this[_0x81f2('0x37')][_0x33d079['uniqueid']]=_0x5f1f80;this[_0x81f2('0x47')](_0x5f1f80);}}}catch(_0x4df98c){logger[_0x81f2('0x41')]('[syncQueueCallerAbandon][VoiceQueueReport]',util['inspect'](_0x4df98c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x81f2('0xe')]['syncQueueCallerLeave']=function(_0x181c1d){try{if(this[_0x81f2('0x63')](_0x181c1d)){if(this[_0x81f2('0x12')][_0x181c1d['uniqueid']]){var _0xaafffa=_[_0x81f2('0x75')](this[_0x81f2('0x12')][_0x181c1d[_0x81f2('0x6d')]]);_0xaafffa[_0x81f2('0x7d')]=moment()[_0x81f2('0x4b')](_0x81f2('0x70'));_0xaafffa[_0x81f2('0x7e')]=_0x181c1d['connectedlinenum'];_0xaafffa[_0x81f2('0x7f')]=_0x181c1d[_0x81f2('0x7f')];this[_0x81f2('0x37')][_0x181c1d[_0x81f2('0x6d')]]=_0xaafffa;this['emitVoiceQueueChannelSave'](_0xaafffa);}}}catch(_0x5c6160){logger[_0x81f2('0x41')]('[syncQueueCallerLeave][VoiceQueueReport]',util['inspect'](_0x5c6160,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x81f2('0xe')][_0x81f2('0x80')]=function(_0xfadc4a){try{if(this['isNotNull'](_0xfadc4a)){if(this['queueReports'][_0xfadc4a[_0x81f2('0x6d')]]){var _0x465c48=_[_0x81f2('0x75')](this[_0x81f2('0x12')][_0xfadc4a['uniqueid']]);_0x465c48['queuecallercomplete']=!![];_0x465c48[_0x81f2('0x7b')]='COMPLETEDBYAGENT';}}}catch(_0x1824c8){logger[_0x81f2('0x41')](_0x81f2('0x81'),util[_0x81f2('0x48')](_0x1824c8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x2d7400){try{if(this[_0x81f2('0x63')](_0x2d7400)){if(this[_0x81f2('0x12')][_0x2d7400['uniqueid']]){var _0x589647=_['last'](this[_0x81f2('0x12')][_0x2d7400[_0x81f2('0x6d')]]);_0x589647['queuecallerabandon']=![];_0x589647['queuecallerabandonAt']=null;_0x589647[_0x81f2('0x82')]=!![];_0x589647[_0x81f2('0x83')]=_0x2d7400[_0x81f2('0x84')];_0x589647['holdtime']=_0x2d7400[_0x81f2('0x78')];_0x589647[_0x81f2('0x76')]=!![];_0x589647[_0x81f2('0x85')]=![];_0x589647['queuecallerexitAt']=null;if(!_0x589647['transfer']){if(_0x2d7400['reason']=='transfer'){_0x589647[_0x81f2('0x7b')]='COMPLETED';}else{if(_[_0x81f2('0x86')](_0x2d7400[_0x81f2('0x3d')]['toLowerCase'](),_0x81f2('0x87'))){if(this[_0x81f2('0x12')][_0x2d7400[_0x81f2('0x88')]]){var _0x18ea23=_[_0x81f2('0x75')](this[_0x81f2('0x12')][_0x2d7400[_0x81f2('0x88')]]);_0x18ea23[_0x81f2('0x76')]=![];_0x18ea23['queuecallerexit']=!![];_0x18ea23[_0x81f2('0x89')]=moment(_0x589647[_0x81f2('0x6f')])[_0x81f2('0x8a')](_0x2d7400[_0x81f2('0x78')],'seconds')[_0x81f2('0x4b')](_0x81f2('0x70'));_0x18ea23[_0x81f2('0x7b')]=_0x81f2('0x8b');_0x18ea23[_0x81f2('0x8c')]=!![];_0x18ea23[_0x81f2('0x8d')]=_0x81f2('0x8e');_0x18ea23['transferexten']=_0x2d7400[_0x81f2('0x8f')];_0x18ea23[_0x81f2('0x90')]=_0x2d7400[_0x81f2('0x6d')];var _0x4b73e4=this[_0x81f2('0x12')][_0x2d7400[_0x81f2('0x88')]];this['queueReports'][_0x2d7400[_0x81f2('0x88')]]=this[_0x81f2('0x12')][_0x2d7400[_0x81f2('0x6d')]];this['queueReports'][_0x2d7400['uniqueid']]=_0x4b73e4;}}else{_0x589647[_0x81f2('0x7b')]='COMPLETEDBY'+_0x2d7400[_0x81f2('0x91')][_0x81f2('0x92')]();}}}this[_0x81f2('0x37')][_0x2d7400['uniqueid']]=_0x589647;this['emitVoiceQueueChannelRemove'](_0x589647);}}}catch(_0x24cffe){logger[_0x81f2('0x41')](_0x81f2('0x93'),util[_0x81f2('0x48')](_0x24cffe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x81f2('0xe')][_0x81f2('0x94')]=function(_0x5af52d){try{if(this[_0x81f2('0x63')](_0x5af52d)){this[_0x81f2('0x95')](_0x5af52d[_0x81f2('0x6d')],_[_0x81f2('0x96')](_0x5af52d[_0x81f2('0x97')])[0x0],_0x5af52d[_0x81f2('0x98')]);if(this[_0x81f2('0x12')][_0x5af52d[_0x81f2('0x6d')]]){var _0x5a0be5=_[_0x81f2('0x75')](this[_0x81f2('0x12')][_0x5af52d[_0x81f2('0x6d')]]);if(_0x5a0be5){if(this[_0x81f2('0x63')](_0x5af52d[_0x81f2('0x97')])&&this['isNotNull'](_0x5af52d[_0x81f2('0x97')][_0x81f2('0x99')])){switch(_0x5af52d['value']){case _0x81f2('0x9a'):_0x5a0be5[_0x81f2('0x85')]=![];_0x5a0be5[_0x81f2('0x89')]=null;break;default:_0x5a0be5[_0x81f2('0x85')]=!![];_0x5a0be5[_0x81f2('0x89')]=moment()[_0x81f2('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x5a0be5['queuecallerleaveAt']=moment()[_0x81f2('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5a0be5[_0x81f2('0x1e')]=![];_0x5a0be5[_0x81f2('0x7a')]=null;_0x5a0be5[_0x81f2('0x7b')]=_0x5af52d['value'];this['channels'][_0x5af52d['uniqueid']]=_0x5a0be5;this[_0x81f2('0x47')](_0x5a0be5);}else if(this['isNotNull'](_0x5af52d[_0x81f2('0x97')])&&this[_0x81f2('0x63')](_0x5af52d[_0x81f2('0x97')][_0x81f2('0x9b')])){if(!_0x5a0be5[_0x81f2('0x1e')]){_0x5a0be5[_0x81f2('0x85')]=!![];_0x5a0be5['queuecallerexitAt']=moment()[_0x81f2('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x5a0be5[_0x81f2('0x7b')]='EXITWITHKEY';_0x5a0be5['queuecallerleaveAt']=moment()[_0x81f2('0x4b')](_0x81f2('0x70'));this[_0x81f2('0x37')][_0x5af52d[_0x81f2('0x6d')]]=_0x5a0be5;}}_0x5a0be5[_0x81f2('0x18')]=this[_0x81f2('0x18')][_0x5af52d['uniqueid']];}}}}catch(_0x476d13){logger[_0x81f2('0x41')](_0x81f2('0x9c'),util[_0x81f2('0x48')](_0x476d13,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x81f2('0x95')]=function(_0x16a2e2,_0x511f62,_0x34adbe){var _0x49546a=[_0x81f2('0x9d'),_0x81f2('0x9e'),'rtpaudioqosjitter',_0x81f2('0x9f'),_0x81f2('0xa0'),_0x81f2('0xa1'),_0x81f2('0xa2'),_0x81f2('0xa3'),'sipcallid',_0x81f2('0xa4'),'bridgepeer',_0x81f2('0xa5'),_0x81f2('0xa6'),'memberdynamic',_0x81f2('0xa7'),_0x81f2('0xa8'),_0x81f2('0x84'),'memberpenalty',_0x81f2('0xa9')];if(!_[_0x81f2('0x3a')](_0x511f62)&&!_['includes'](_0x49546a,_0x511f62)){if(_[_0x81f2('0x2f')](this['variables'][_0x16a2e2])){this[_0x81f2('0x18')][_0x16a2e2]={};}this[_0x81f2('0x18')][_0x16a2e2][_0x511f62]=_0x34adbe;}};VoiceQueueReport[_0x81f2('0xe')][_0x81f2('0x26')]=function(_0x349307){try{if(this[_0x81f2('0x63')](_0x349307)){if(this[_0x81f2('0x12')][_0x349307[_0x81f2('0x6d')]]){for(var _0x5b0cf7=0x0,_0xaf711={};_0x5b0cf7=0x0?moment(_0xacd8b1[_0x147b('0x1b')])[_0x147b('0xf')](_0xacd8b1[_0x147b('0x1a')],_0x147b('0x10')):null,'data1':'outbound','data2':_0xacd8b1['accountcode'],'data3':_0xacd8b1['exten'],'data4':_0xacd8b1[_0x147b('0x1c')]||null,'role':_0x147b('0x14'),'internal':_0xacd8b1[_0x147b('0x16')]?_[_0x147b('0x15')](_0xacd8b1[_0x147b('0x16')]):undefined,'uniqueid':_0xacd8b1['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xa5f7=['accountcode','uniqueid','voiceDialReport','starttime','endtime','seconds','outbound','dialstring','CreateMemberReport','moment','lodash','util','voiceQueueReport','queuecallercompleteAt','Request','voice','lastAssignedTo','isNil','format','SIP/%s','interface','TALKING','diff','queuecallerleaveAt','inbound','calleridnum','exten','toNumber'];(function(_0x32a81f,_0x4eee66){var _0x5b67a2=function(_0x35d368){while(--_0x35d368){_0x32a81f['push'](_0x32a81f['shift']());}};_0x5b67a2(++_0x4eee66);}(_0xa5f7,0x13d));var _0x7a5f=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0xa5f7[_0x376db5];return _0x304c17;};'use strict';var moment=require(_0x7a5f('0x0'));var _=require(_0x7a5f('0x1'));var util=require(_0x7a5f('0x2'));var client=require('../client');exports[_0x7a5f('0x3')]=function(_0x487bb5){var _0x21c254=_0x487bb5[_0x7a5f('0x4')]||_0x487bb5['queuecallerexitAt'];return client[_0x7a5f('0x5')]('CreateMemberReport',{'body':{'channel':_0x7a5f('0x6'),'membername':_0x487bb5[_0x7a5f('0x7')],'interface':_[_0x7a5f('0x8')](_0x487bb5['interface'])?util[_0x7a5f('0x9')](_0x7a5f('0xa'),_0x487bb5[_0x7a5f('0x7')]):_0x487bb5[_0x7a5f('0xb')],'type':_0x7a5f('0xc'),'enterAt':_0x487bb5['queuecallerleaveAt'],'exitAt':_0x21c254,'duration':moment(_0x21c254)[_0x7a5f('0xd')](_0x487bb5[_0x7a5f('0xe')],'seconds'),'data1':_0x7a5f('0xf'),'data2':_0x487bb5[_0x7a5f('0x10')],'data3':_0x487bb5[_0x7a5f('0x11')],'data4':null,'data5':_0x487bb5['queue'],'role':'agent','internal':_0x487bb5['accountcode']?_[_0x7a5f('0x12')](_0x487bb5[_0x7a5f('0x13')]):undefined,'uniqueid':_0x487bb5[_0x7a5f('0x14')]},'log':'CreateMemberReport'});};exports[_0x7a5f('0x15')]=function(_0x9e2513){return client['Request']('CreateMemberReport',{'body':{'channel':_0x7a5f('0x6'),'membername':_0x9e2513['membername'],'interface':_0x9e2513['interface'],'type':'TALKING','enterAt':_0x9e2513[_0x7a5f('0x16')],'exitAt':_0x9e2513[_0x7a5f('0x17')],'duration':moment(_0x9e2513['endtime'])[_0x7a5f('0xd')](_0x9e2513[_0x7a5f('0x16')],'seconds')>=0x0?moment(_0x9e2513[_0x7a5f('0x17')])[_0x7a5f('0xd')](_0x9e2513[_0x7a5f('0x16')],_0x7a5f('0x18')):null,'data1':_0x7a5f('0x19'),'data2':_0x9e2513[_0x7a5f('0x13')],'data3':_0x9e2513[_0x7a5f('0x11')],'data4':_0x9e2513[_0x7a5f('0x1a')]||null,'role':'agent','internal':_0x9e2513[_0x7a5f('0x13')]?_[_0x7a5f('0x12')](_0x9e2513['accountcode']):undefined,'uniqueid':_0x9e2513[_0x7a5f('0x14')]},'log':_0x7a5f('0x1b')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index cea7ab6..6e2866e 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 _0x536f=['../client','GetTemplate','name','html'];(function(_0x594ff5,_0x47aa57){var _0x5042d6=function(_0x58074f){while(--_0x58074f){_0x594ff5['push'](_0x594ff5['shift']());}};_0x5042d6(++_0x47aa57);}(_0x536f,0x70));var _0xf536=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x536f[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xf536('0x0'));exports['getTemplates']=function(_0x4e4212){return function(_0x4c2e7e){return client['Request'](_0xf536('0x1'),{'options':{'raw':!![],'attributes':['id',_0xf536('0x2'),_0xf536('0x3')]},'log':_0xf536('0x1')});};}; \ No newline at end of file +var _0xf109=['GetTemplate','../client','getTemplates','name','html'];(function(_0x2223be,_0x4e4034){var _0x453496=function(_0x18f9ee){while(--_0x18f9ee){_0x2223be['push'](_0x2223be['shift']());}};_0x453496(++_0x4e4034);}(_0xf109,0xce));var _0x9f10=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xf109[_0x12fc8d];return _0x3f9d04;};'use strict';var client=require(_0x9f10('0x0'));exports[_0x9f10('0x1')]=function(_0x44c4f2){return function(_0x5d2950){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x9f10('0x2'),_0x9f10('0x3')]},'log':_0x9f10('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index caf0e94..3847a12 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 _0x12e3=['GetTrigger','getTriggers','Request','name','channel','status','Condition','AllConditions','field','AnyConditions','operator','value','Actions','data2','data3','data5','data7'];(function(_0x1dfc98,_0x3264e9){var _0x57430f=function(_0x47404d){while(--_0x47404d){_0x1dfc98['push'](_0x1dfc98['shift']());}};_0x57430f(++_0x3264e9);}(_0x12e3,0xef));var _0x312e=function(_0xfd5479,_0xfd74ca){_0xfd5479=_0xfd5479-0x0;var _0x3b9548=_0x12e3[_0xfd5479];return _0x3b9548;};'use strict';var client=require('../client');exports[_0x312e('0x0')]=function(_0x43e7ba){return function(_0x25ed6f){return client[_0x312e('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x312e('0x2'),_0x312e('0x3'),_0x312e('0x4')],'include':[{'model':_0x312e('0x5'),'as':_0x312e('0x6'),'attributes':['id',_0x312e('0x7'),'operator','value']},{'model':'Condition','as':_0x312e('0x8'),'attributes':['id',_0x312e('0x7'),_0x312e('0x9'),_0x312e('0xa')]},{'model':'Action','as':_0x312e('0xb'),'attributes':['id','action','data1',_0x312e('0xc'),_0x312e('0xd'),'data4',_0x312e('0xe'),'data6',_0x312e('0xf')]}]},'log':_0x312e('0x10')});};}; \ No newline at end of file +var _0x8387=['name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data4','data5','data7','GetTrigger','../client','getTriggers','Request'];(function(_0x164e5d,_0x1da231){var _0x476cfe=function(_0x1d77d2){while(--_0x1d77d2){_0x164e5d['push'](_0x164e5d['shift']());}};_0x476cfe(++_0x1da231);}(_0x8387,0x18c));var _0x7838=function(_0x4232a2,_0x23b4da){_0x4232a2=_0x4232a2-0x0;var _0xa8772f=_0x8387[_0x4232a2];return _0xa8772f;};'use strict';var client=require(_0x7838('0x0'));exports[_0x7838('0x1')]=function(_0x551e7c){return function(_0x5a3f19){return client[_0x7838('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x7838('0x3'),_0x7838('0x4'),_0x7838('0x5')],'include':[{'model':_0x7838('0x6'),'as':_0x7838('0x7'),'attributes':['id',_0x7838('0x8'),_0x7838('0x9'),_0x7838('0xa')]},{'model':_0x7838('0x6'),'as':_0x7838('0xb'),'attributes':['id',_0x7838('0x8'),_0x7838('0x9'),_0x7838('0xa')]},{'model':_0x7838('0xc'),'as':_0x7838('0xd'),'attributes':['id',_0x7838('0xe'),'data1','data2','data3',_0x7838('0xf'),_0x7838('0x10'),'data6',_0x7838('0x11')]}]},'log':_0x7838('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 4c8448d..8b7975d 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 _0xa646=['GetTrunk','registry','../client','getTrunks','Request'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xa646,0x101));var _0x6a64=function(_0x19ac94,_0x124eee){_0x19ac94=_0x19ac94-0x0;var _0x680fde=_0xa646[_0x19ac94];return _0x680fde;};'use strict';var client=require(_0x6a64('0x0'));exports[_0x6a64('0x1')]=function(_0x3923cb){return function(_0x474d46){return client[_0x6a64('0x2')](_0x6a64('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x6a64('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xa103=['getTrunks','Request','GetTrunk','name','registry','../client'];(function(_0x3957dc,_0x525687){var _0x107bc4=function(_0x59ab60){while(--_0x59ab60){_0x3957dc['push'](_0x3957dc['shift']());}};_0x107bc4(++_0x525687);}(_0xa103,0x1a9));var _0x3a10=function(_0x590058,_0x19b38f){_0x590058=_0x590058-0x0;var _0x2b6d81=_0xa103[_0x590058];return _0x2b6d81;};'use strict';var client=require(_0x3a10('0x0'));exports[_0x3a10('0x1')]=function(_0x5297af){return function(_0x514fec){return client[_0x3a10('0x2')](_0x3a10('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3a10('0x4'),_0x3a10('0x5')]},'log':_0x3a10('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index cf04e4c..7384d78 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 _0xed9b=['interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','email','online','getAgent','../client','getAgents','Request','GetUser','agent','name','accountcode','fullname','pauseType','lastPauseAt','voicePause','phone','mobile'];(function(_0x263f76,_0x2ee49f){var _0x4112de=function(_0x590ef1){while(--_0x590ef1){_0x263f76['push'](_0x263f76['shift']());}};_0x4112de(++_0x2ee49f);}(_0xed9b,0x9b));var _0xbed9=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0xed9b[_0x18cac4];return _0x2227c6;};'use strict';var client=require(_0xbed9('0x0'));exports[_0xbed9('0x1')]=function(){return function(){return client[_0xbed9('0x2')](_0xbed9('0x3'),{'options':{'raw':![],'where':{'role':_0xbed9('0x4')},'attributes':['id',_0xbed9('0x5'),'email',_0xbed9('0x6'),_0xbed9('0x7'),'online','lastLoginAt',_0xbed9('0x8'),_0xbed9('0x9'),_0xbed9('0xa'),_0xbed9('0xb'),_0xbed9('0xc'),_0xbed9('0xd')]},'log':_0xbed9('0x1')});};};exports[_0xbed9('0xe')]=function(){return function(){return client[_0xbed9('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0xbed9('0xf')},'attributes':['id','name',_0xbed9('0x6'),_0xbed9('0x10')]},'log':_0xbed9('0xe')});};};exports[_0xbed9('0x11')]=function(_0x3f88ec,_0x40674d,_0x2534af){return client[_0xbed9('0x2')](_0xbed9('0x12'),{'body':{'type':_0x40674d,'uniqueid':_0x2534af},'options':{'where':{'id':_0x3f88ec['id']}},'log':_0xbed9('0x11')});};exports[_0xbed9('0x13')]=function(_0x397349){return client[_0xbed9('0x2')](_0xbed9('0x14'),{'body':{},'options':{'where':{'id':_0x397349['id']}},'log':'savePause'});};exports['getAgent']=function(_0xba36cb){return client[_0xbed9('0x2')]('ShowUser',{'options':{'raw':![],'where':{'role':'agent','id':_0xba36cb},'attributes':['id',_0xbed9('0x5'),_0xbed9('0x15'),'accountcode',_0xbed9('0x7'),_0xbed9('0x16'),'lastLoginAt',_0xbed9('0x8'),_0xbed9('0x9'),_0xbed9('0xa'),_0xbed9('0xd')]},'log':_0xbed9('0x17')});}; \ No newline at end of file +var _0x398a=['name','email','accountcode','online','voicePause','phone','mobile','interface','internal','getTelephones','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','fullname','lastLoginAt','pauseType','lastPauseAt','getAgents','Request','GetUser','agent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x398a,0x86));var _0xa398=function(_0x5b1399,_0x12ef4){_0x5b1399=_0x5b1399-0x0;var _0x3cada0=_0x398a[_0x5b1399];return _0x3cada0;};'use strict';var client=require('../client');exports[_0xa398('0x0')]=function(){return function(){return client[_0xa398('0x1')](_0xa398('0x2'),{'options':{'raw':![],'where':{'role':_0xa398('0x3')},'attributes':['id',_0xa398('0x4'),_0xa398('0x5'),_0xa398('0x6'),'fullname',_0xa398('0x7'),'lastLoginAt','pauseType','lastPauseAt',_0xa398('0x8'),_0xa398('0x9'),_0xa398('0xa'),_0xa398('0xb')]},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client[_0xa398('0x1')](_0xa398('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0xa398('0x4'),_0xa398('0x6'),_0xa398('0xc')]},'log':_0xa398('0xd')});};};exports[_0xa398('0xe')]=function(_0x13240b,_0xbc7824,_0x502781){return client[_0xa398('0x1')]('PauseUser',{'body':{'type':_0xbc7824,'uniqueid':_0x502781},'options':{'where':{'id':_0x13240b['id']}},'log':_0xa398('0xe')});};exports[_0xa398('0xf')]=function(_0x264116){return client['Request'](_0xa398('0x10'),{'body':{},'options':{'where':{'id':_0x264116['id']}},'log':_0xa398('0xe')});};exports[_0xa398('0x11')]=function(_0xfe62c8){return client[_0xa398('0x1')](_0xa398('0x12'),{'options':{'raw':![],'where':{'role':_0xa398('0x3'),'id':_0xfe62c8},'attributes':['id','name',_0xa398('0x5'),_0xa398('0x6'),_0xa398('0x13'),'online',_0xa398('0x14'),_0xa398('0x15'),_0xa398('0x16'),_0xa398('0x8'),_0xa398('0xb')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 86eab6e..49aa729 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 _0x4fef=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x5b820d,_0x2c497c){var _0x401253=function(_0x140fa9){while(--_0x140fa9){_0x5b820d['push'](_0x5b820d['shift']());}};_0x401253(++_0x2c497c);}(_0x4fef,0x10f));var _0xf4fe=function(_0x730abd,_0x53905a){_0x730abd=_0x730abd-0x0;var _0x3f6ccd=_0x4fef[_0x730abd];return _0x3f6ccd;};'use strict';var client=require(_0xf4fe('0x0'));exports[_0xf4fe('0x1')]=function(_0x54ad56){return client[_0xf4fe('0x2')]('CreateVoiceAgentReport',{'body':_0x54ad56,'log':_0xf4fe('0x3')});};exports[_0xf4fe('0x4')]=function(_0x3c78db,_0x1e5ec2,_0x5c5dbb){return client[_0xf4fe('0x2')](_0xf4fe('0x5'),{'body':_0x3c78db,'options':{'where':{'uniqueid':_0x1e5ec2,'interface':_0x5c5dbb,'agentcomplete':!![]}},'log':_0xf4fe('0x5')});}; \ No newline at end of file +var _0x0286=['update','UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport'];(function(_0x5054da,_0x217daf){var _0x76c47b=function(_0x2fedc8){while(--_0x2fedc8){_0x5054da['push'](_0x5054da['shift']());}};_0x76c47b(++_0x217daf);}(_0x0286,0x7f));var _0x6028=function(_0xf57fca,_0x1f3ed1){_0xf57fca=_0xf57fca-0x0;var _0x3c336c=_0x0286[_0xf57fca];return _0x3c336c;};'use strict';var client=require('../client');exports[_0x6028('0x0')]=function(_0x68cce0){return client[_0x6028('0x1')](_0x6028('0x2'),{'body':_0x68cce0,'log':'CreateVoiceAgentReport'});};exports[_0x6028('0x3')]=function(_0x254dc0,_0x13469c,_0x18aedc){return client['Request'](_0x6028('0x4'),{'body':_0x254dc0,'options':{'where':{'uniqueid':_0x13469c,'interface':_0x18aedc,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 12e8835..0583790 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 _0x0d96=['outbound','format','endOf','day','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport'];(function(_0x36453b,_0x104046){var _0x1173aa=function(_0x132779){while(--_0x132779){_0x36453b['push'](_0x36453b['shift']());}};_0x1173aa(++_0x104046);}(_0x0d96,0xc5));var _0x60d9=function(_0x551667,_0x12b4f){_0x551667=_0x551667-0x0;var _0x17df3b=_0x0d96[_0x551667];return _0x17df3b;};'use strict';var moment=require(_0x60d9('0x0'));var util=require(_0x60d9('0x1'));var _=require(_0x60d9('0x2'));var client=require(_0x60d9('0x3'));exports[_0x60d9('0x4')]=function(_0x34d9ef){return client[_0x60d9('0x5')](_0x60d9('0x6'),{'body':_[_0x60d9('0x7')](_0x34d9ef,{'source':_0x34d9ef['calleridnum'],'destinationcontext':_0x34d9ef[_0x60d9('0x8')],'callerid':_0x34d9ef['callerid'],'amaflags':_0x60d9('0x9')}),'log':_0x60d9('0x6')});};exports[_0x60d9('0xa')]=function(){return function(){return client[_0x60d9('0x5')](_0x60d9('0xb'),{'options':{'where':{'type':[_0x60d9('0xc')],'createdAt':{'$between':[moment()['startOf']('day')[_0x60d9('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x60d9('0xe')](_0x60d9('0xf'))[_0x60d9('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type','disposition',_0x60d9('0x10'),_0x60d9('0x11')]},'log':_0x60d9('0x12')});};}; \ No newline at end of file +var _0xe47b=['calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','outbound','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','create','CreateVoiceCallReport','merge'];(function(_0x157bd6,_0x450e73){var _0x40ad89=function(_0x3841a3){while(--_0x3841a3){_0x157bd6['push'](_0x157bd6['shift']());}};_0x40ad89(++_0x450e73);}(_0xe47b,0x1f3));var _0xbe47=function(_0x25ef88,_0x4bd7dd){_0x25ef88=_0x25ef88-0x0;var _0x15b589=_0xe47b[_0x25ef88];return _0x15b589;};'use strict';var moment=require(_0xbe47('0x0'));var util=require(_0xbe47('0x1'));var _=require('lodash');var client=require('../client');exports[_0xbe47('0x2')]=function(_0x188049){return client['Request'](_0xbe47('0x3'),{'body':_[_0xbe47('0x4')](_0x188049,{'source':_0x188049[_0xbe47('0x5')],'destinationcontext':_0x188049[_0xbe47('0x6')],'callerid':_0x188049[_0xbe47('0x7')],'amaflags':_0xbe47('0x8')}),'log':_0xbe47('0x3')});};exports[_0xbe47('0x9')]=function(){return function(){return client[_0xbe47('0xa')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xbe47('0xb')],'createdAt':{'$between':[moment()['startOf'](_0xbe47('0xc'))['format'](_0xbe47('0xd')),moment()[_0xbe47('0xe')](_0xbe47('0xc'))[_0xbe47('0xf')](_0xbe47('0xd'))]}},'attributes':[_0xbe47('0x10'),_0xbe47('0x11'),_0xbe47('0x12'),_0xbe47('0x13')]},'log':_0xbe47('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 9030db1..9c6e8e7 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 _0x4947=['../client','create','Request','CreateVoiceDialReport'];(function(_0xff659d,_0x2283a1){var _0x19c170=function(_0x15358e){while(--_0x15358e){_0xff659d['push'](_0xff659d['shift']());}};_0x19c170(++_0x2283a1);}(_0x4947,0x170));var _0x7494=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0x4947[_0x414655];return _0x237884;};'use strict';var client=require(_0x7494('0x0'));exports[_0x7494('0x1')]=function(_0x20e5e3){return client[_0x7494('0x2')](_0x7494('0x3'),{'body':_0x20e5e3,'log':_0x7494('0x3')});}; \ No newline at end of file +var _0x8d72=['Request','CreateVoiceDialReport','../client','create'];(function(_0x5357ca,_0x801fac){var _0x24a125=function(_0x29ff8c){while(--_0x29ff8c){_0x5357ca['push'](_0x5357ca['shift']());}};_0x24a125(++_0x801fac);}(_0x8d72,0x15a));var _0x28d7=function(_0x158b7b,_0x59eaa4){_0x158b7b=_0x158b7b-0x0;var _0x10e595=_0x8d72[_0x158b7b];return _0x10e595;};'use strict';var client=require(_0x28d7('0x0'));exports[_0x28d7('0x1')]=function(_0x405148){return client[_0x28d7('0x2')](_0x28d7('0x3'),{'body':_0x405148,'log':_0x28d7('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index f9511e6..b913c19 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 _0x1a21=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x52b844,_0x434e67){var _0x14432f=function(_0x6b692a){while(--_0x6b692a){_0x52b844['push'](_0x52b844['shift']());}};_0x14432f(++_0x434e67);}(_0x1a21,0x1d9));var _0x11a2=function(_0x1e381c,_0x47b5b9){_0x1e381c=_0x1e381c-0x0;var _0x9b5ea9=_0x1a21[_0x1e381c];return _0x9b5ea9;};'use strict';var client=require(_0x11a2('0x0'));exports[_0x11a2('0x1')]=function(){return function(){return client[_0x11a2('0x2')](_0x11a2('0x3'),{'options':{'raw':!![],'attributes':['id',_0x11a2('0x4'),_0x11a2('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x11a2('0x1')});};}; \ No newline at end of file +var _0x7b10=['Request','GetVoiceExtension','exten','../client','getVoiceExtensions'];(function(_0x51e79c,_0x51485e){var _0x2467be=function(_0xbf70f0){while(--_0xbf70f0){_0x51e79c['push'](_0x51e79c['shift']());}};_0x2467be(++_0x51485e);}(_0x7b10,0x1ac));var _0x07b1=function(_0x4330fa,_0x5ce67b){_0x4330fa=_0x4330fa-0x0;var _0x127d5d=_0x7b10[_0x4330fa];return _0x127d5d;};'use strict';var client=require(_0x07b1('0x0'));exports[_0x07b1('0x1')]=function(){return function(){return client[_0x07b1('0x2')](_0x07b1('0x3'),{'options':{'raw':!![],'attributes':['id',_0x07b1('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x07b1('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 2f22f0a..173cd7c 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 _0xb9a0=['../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval'];(function(_0x2a3b3e,_0x415238){var _0x3bb5f6=function(_0x26a88a){while(--_0x26a88a){_0x2a3b3e['push'](_0x2a3b3e['shift']());}};_0x3bb5f6(++_0x415238);}(_0xb9a0,0x162));var _0x0b9a=function(_0x482acd,_0x2306a6){_0x482acd=_0x482acd-0x0;var _0x36e890=_0xb9a0[_0x482acd];return _0x36e890;};'use strict';var client=require(_0x0b9a('0x0'));exports[_0x0b9a('0x1')]=function(){return function(){return client[_0x0b9a('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x0b9a('0x3'),_0x0b9a('0x4'),_0x0b9a('0x5'),_0x0b9a('0x6'),_0x0b9a('0x7'),_0x0b9a('0x8'),_0x0b9a('0x9'),_0x0b9a('0xa'),'dialLimitChannel','dialLimitQueue',_0x0b9a('0xb'),'dialPredictiveOptimization',_0x0b9a('0xc'),'dialPredictiveInterval','dialOriginateCallerIdName',_0x0b9a('0xd'),'dialOriginateTimeout',_0x0b9a('0xe'),_0x0b9a('0xf'),'dialQueueProject',_0x0b9a('0x10'),'dialCongestionRetryFrequency',_0x0b9a('0x11'),_0x0b9a('0x12'),_0x0b9a('0x13'),_0x0b9a('0x14'),_0x0b9a('0x15'),_0x0b9a('0x16'),_0x0b9a('0x17'),_0x0b9a('0x18'),_0x0b9a('0x19'),_0x0b9a('0x1a'),_0x0b9a('0x1b'),_0x0b9a('0x1c'),_0x0b9a('0x1d'),_0x0b9a('0x1e'),_0x0b9a('0x1f'),_0x0b9a('0x20'),_0x0b9a('0x21'),_0x0b9a('0x22'),_0x0b9a('0x23'),_0x0b9a('0x24'),'dialRecallMeTimeout',_0x0b9a('0x25'),_0x0b9a('0x26'),'dialAgiAfterHangupAgent',_0x0b9a('0x27'),'dialQueueProject2','monitor_format',_0x0b9a('0x28'),_0x0b9a('0x29'),'dialCutDigit',_0x0b9a('0x2a'),'dialNoSuchNumberRetryFrequency',_0x0b9a('0x2b'),_0x0b9a('0x2c'),'dialAbandonedMaxRetry',_0x0b9a('0x2d'),'dialMachineMaxRetry',_0x0b9a('0x2e'),_0x0b9a('0x2f'),_0x0b9a('0x30'),'mandatoryDisposition',_0x0b9a('0x31'),_0x0b9a('0x32')],'include':[{'model':_0x0b9a('0x33'),'as':_0x0b9a('0x33'),'attributes':['id',_0x0b9a('0x3'),_0x0b9a('0x34'),_0x0b9a('0x35')]},{'model':'Pause','as':_0x0b9a('0x36'),'attributes':['id',_0x0b9a('0x3')]},{'model':'Trunk','as':_0x0b9a('0x37'),'attributes':['id',_0x0b9a('0x3'),_0x0b9a('0x34'),_0x0b9a('0x35')]},{'model':'Interval','as':_0x0b9a('0x38'),'attributes':['id',_0x0b9a('0x3')],'include':[{'model':_0x0b9a('0x38'),'as':_0x0b9a('0x39'),'attributes':['id',_0x0b9a('0x3'),_0x0b9a('0x3a')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xfc68=['../client','getVoiceQueues','name','acw','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','TrunkBackup','active','Interval','interval'];(function(_0x1ba43c,_0x5bd2e8){var _0x2f60eb=function(_0x349dff){while(--_0x349dff){_0x1ba43c['push'](_0x1ba43c['shift']());}};_0x2f60eb(++_0x5bd2e8);}(_0xfc68,0x1e0));var _0x8fc6=function(_0x5746e9,_0x26f02c){_0x5746e9=_0x5746e9-0x0;var _0x33ef22=_0xfc68[_0x5746e9];return _0x33ef22;};'use strict';var client=require(_0x8fc6('0x0'));exports[_0x8fc6('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x8fc6('0x2'),_0x8fc6('0x3'),_0x8fc6('0x4'),_0x8fc6('0x5'),'monitor_format',_0x8fc6('0x6'),_0x8fc6('0x7'),_0x8fc6('0x8'),_0x8fc6('0x9'),'dialLimitQueue',_0x8fc6('0xa'),_0x8fc6('0xb'),_0x8fc6('0xc'),'dialPredictiveInterval',_0x8fc6('0xd'),_0x8fc6('0xe'),_0x8fc6('0xf'),_0x8fc6('0x10'),_0x8fc6('0x11'),_0x8fc6('0x12'),_0x8fc6('0x13'),'dialCongestionRetryFrequency',_0x8fc6('0x14'),_0x8fc6('0x15'),_0x8fc6('0x16'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x8fc6('0x17'),_0x8fc6('0x18'),'dialPrefix',_0x8fc6('0x19'),_0x8fc6('0x1a'),_0x8fc6('0x1b'),_0x8fc6('0x1c'),_0x8fc6('0x1d'),_0x8fc6('0x1e'),_0x8fc6('0x1f'),_0x8fc6('0x20'),_0x8fc6('0x21'),_0x8fc6('0x22'),_0x8fc6('0x23'),_0x8fc6('0x24'),_0x8fc6('0x25'),'dialRecallInQueue',_0x8fc6('0x26'),_0x8fc6('0x27'),_0x8fc6('0x28'),_0x8fc6('0x29'),_0x8fc6('0x2a'),_0x8fc6('0x2b'),_0x8fc6('0x2c'),_0x8fc6('0x2d'),_0x8fc6('0x2e'),_0x8fc6('0x2f'),'dialDropMaxRetry',_0x8fc6('0x30'),'dialAbandonedMaxRetry',_0x8fc6('0x31'),'dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x8fc6('0x32'),_0x8fc6('0x33'),_0x8fc6('0x34'),_0x8fc6('0x35')],'include':[{'model':_0x8fc6('0x36'),'as':'Trunk','attributes':['id',_0x8fc6('0x2'),_0x8fc6('0x37'),'active']},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id',_0x8fc6('0x2')]},{'model':_0x8fc6('0x36'),'as':_0x8fc6('0x38'),'attributes':['id',_0x8fc6('0x2'),_0x8fc6('0x37'),_0x8fc6('0x39')]},{'model':_0x8fc6('0x3a'),'as':'Interval','attributes':['id','name'],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x8fc6('0x2'),_0x8fc6('0x3b')]}]}]},'log':_0x8fc6('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index ff53d62..ba07b12 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 _0xd7c1=['YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format'];(function(_0x4a1f01,_0x45e5c4){var _0x135de8=function(_0x39a489){while(--_0x39a489){_0x4a1f01['push'](_0x4a1f01['shift']());}};_0x135de8(++_0x45e5c4);}(_0xd7c1,0xa5));var _0x1d7c=function(_0x46efce,_0x337bfc){_0x46efce=_0x46efce-0x0;var _0x173537=_0xd7c1[_0x46efce];return _0x173537;};'use strict';var moment=require(_0x1d7c('0x0'));var _=require(_0x1d7c('0x1'));var client=require(_0x1d7c('0x2'));exports[_0x1d7c('0x3')]=function(_0x25ac9d){return client[_0x1d7c('0x4')](_0x1d7c('0x5'),{'body':_0x25ac9d,'log':_0x1d7c('0x5')});};exports[_0x1d7c('0x6')]=function(){return function(){return client[_0x1d7c('0x4')](_0x1d7c('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x1d7c('0x8')](_0x1d7c('0x9'))[_0x1d7c('0xa')](_0x1d7c('0xb')),moment()[_0x1d7c('0xc')](_0x1d7c('0x9'))[_0x1d7c('0xa')](_0x1d7c('0xb'))]}},'attributes':[_0x1d7c('0xd'),_0x1d7c('0xe'),_0x1d7c('0xf'),'queuecallerleaveAt',_0x1d7c('0x10'),_0x1d7c('0x11'),_0x1d7c('0x12'),_0x1d7c('0x13'),'queuecallerabandon',_0x1d7c('0x14')]},'log':_0x1d7c('0x15')});};}; \ No newline at end of file +var _0xd751=['GetVoiceQueueReports','moment','../client','create','Request','CreateVoiceQueueReport','GetVoiceQueueReport','day','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt'];(function(_0x40d8d7,_0x30dd5e){var _0x3454cc=function(_0x512c1b){while(--_0x512c1b){_0x40d8d7['push'](_0x40d8d7['shift']());}};_0x3454cc(++_0x30dd5e);}(_0xd751,0x79));var _0x1d75=function(_0x3fd318,_0x59f0c6){_0x3fd318=_0x3fd318-0x0;var _0x2c51d5=_0xd751[_0x3fd318];return _0x2c51d5;};'use strict';var moment=require(_0x1d75('0x0'));var _=require('lodash');var client=require(_0x1d75('0x1'));exports[_0x1d75('0x2')]=function(_0x196409){return client[_0x1d75('0x3')]('CreateVoiceQueueReport',{'body':_0x196409,'log':_0x1d75('0x4')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x1d75('0x3')](_0x1d75('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x1d75('0x6'))[_0x1d75('0x7')](_0x1d75('0x8')),moment()['endOf']('day')[_0x1d75('0x7')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x1d75('0x9'),_0x1d75('0xa'),_0x1d75('0xb'),_0x1d75('0xc'),_0x1d75('0xd'),_0x1d75('0xe'),_0x1d75('0xf'),_0x1d75('0x10'),_0x1d75('0x11'),_0x1d75('0x12')]},'log':_0x1d75('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 1bee035..e53de3e 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 _0x9755=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x23e374,_0x137e6a){var _0x2fd7b1=function(_0x52e1cf){while(--_0x52e1cf){_0x23e374['push'](_0x23e374['shift']());}};_0x2fd7b1(++_0x137e6a);}(_0x9755,0x12c));var _0x5975=function(_0x14ea32,_0x262909){_0x14ea32=_0x14ea32-0x0;var _0x137bbb=_0x9755[_0x14ea32];return _0x137bbb;};'use strict';var client=require(_0x5975('0x0'));exports[_0x5975('0x1')]=function(_0x381979){return function(){return client[_0x5975('0x2')](_0x5975('0x3'),{'options':{'where':{'VoiceQueueId':_0x381979,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x889a=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x3bd804,_0x4304ee){var _0x378bdf=function(_0x5b5da4){while(--_0x5b5da4){_0x3bd804['push'](_0x3bd804['shift']());}};_0x378bdf(++_0x4304ee);}(_0x889a,0x8f));var _0xa889=function(_0x4ce278,_0x5e1f85){_0x4ce278=_0x4ce278-0x0;var _0x2395df=_0x889a[_0x4ce278];return _0x2395df;};'use strict';var client=require(_0xa889('0x0'));exports[_0xa889('0x1')]=function(_0x30a219){return function(){return client[_0xa889('0x2')](_0xa889('0x3'),{'options':{'where':{'VoiceQueueId':_0x30a219,'paused':!![]},'raw':!![]},'log':_0xa889('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 3ba8d7b..26b8901 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 _0xc15e=['create','Request','CreateVoiceRecording','merge','monitorFilename','lodash'];(function(_0x250af5,_0x364125){var _0x432fe6=function(_0x1d7b12){while(--_0x1d7b12){_0x250af5['push'](_0x250af5['shift']());}};_0x432fe6(++_0x364125);}(_0xc15e,0x161));var _0xec15=function(_0x4fbefa,_0x1c9793){_0x4fbefa=_0x4fbefa-0x0;var _0x41daf1=_0xc15e[_0x4fbefa];return _0x41daf1;};'use strict';var _=require(_0xec15('0x0'));var client=require('../client');exports[_0xec15('0x1')]=function(_0x4591af){return client[_0xec15('0x2')](_0xec15('0x3'),{'body':_[_0xec15('0x4')](_0x4591af,{'value':_0x4591af[_0xec15('0x5')]}),'log':_0xec15('0x3')});}; \ No newline at end of file +var _0x9e7d=['Request','CreateVoiceRecording','merge','monitorFilename','lodash','create'];(function(_0x541095,_0x582b30){var _0x5a2c40=function(_0xb7650f){while(--_0xb7650f){_0x541095['push'](_0x541095['shift']());}};_0x5a2c40(++_0x582b30);}(_0x9e7d,0xfa));var _0xd9e7=function(_0x4b87ef,_0x1aa1ab){_0x4b87ef=_0x4b87ef-0x0;var _0x287e5e=_0x9e7d[_0x4b87ef];return _0x287e5e;};'use strict';var _=require(_0xd9e7('0x0'));var client=require('../client');exports[_0xd9e7('0x1')]=function(_0x3484e4){return client[_0xd9e7('0x2')](_0xd9e7('0x3'),{'body':_[_0xd9e7('0x4')](_0x3484e4,{'value':_0x3484e4[_0xd9e7('0x5')]}),'log':_0xd9e7('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 600868c..d8b8118 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 _0x53a7=['origtransferercontext','origtransfererexten','attended','blindTransfer','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','Request','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid'];(function(_0x424438,_0x5a7a76){var _0xfcaa45=function(_0x5268ae){while(--_0x5268ae){_0x424438['push'](_0x424438['shift']());}};_0xfcaa45(++_0x5a7a76);}(_0x53a7,0x9f));var _0x753a=function(_0x55b561,_0x3197b2){_0x55b561=_0x55b561-0x0;var _0x3b7a81=_0x53a7[_0x55b561];return _0x3b7a81;};'use strict';var client=require('../client');exports[_0x753a('0x0')]=function(_0xb3a806){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0xb3a806[_0x753a('0x1')],'transfererchannel':_0xb3a806[_0x753a('0x2')],'transferercalleridnum':_0xb3a806[_0x753a('0x3')],'transferercalleridname':_0xb3a806[_0x753a('0x4')],'transfererconnectedlinenum':_0xb3a806[_0x753a('0x5')],'transfererconnectedlinename':_0xb3a806[_0x753a('0x6')],'transfereraccountcode':_0xb3a806[_0x753a('0x7')],'transferercontext':_0xb3a806[_0x753a('0x8')],'transfererexten':_0xb3a806[_0x753a('0x9')],'transfererlinkedid':_0xb3a806['transfererlinkedid'],'transfereechannel':_0xb3a806[_0x753a('0xa')],'transfereecalleridnum':_0xb3a806[_0x753a('0xb')],'transfereecalleridname':_0xb3a806['transfereecalleridname'],'transfereeconnectedlinenum':_0xb3a806[_0x753a('0xc')],'transfereeconnectedlinename':_0xb3a806[_0x753a('0xd')],'transfereeaccountcode':_0xb3a806['transfereeaccountcode'],'transfereecontext':_0xb3a806['transfereecontext'],'transfereeexten':_0xb3a806[_0x753a('0xe')],'transfereelinkedid':_0xb3a806[_0x753a('0xf')],'isexternal':_0xb3a806[_0x753a('0x10')],'context':_0xb3a806[_0x753a('0x11')],'extension':_0xb3a806[_0x753a('0x12')],'type':_0x753a('0x13')},'log':_0x753a('0x14')});};exports[_0x753a('0x15')]=function(_0x2a9eda){return client[_0x753a('0x16')](_0x753a('0x14'),{'body':{'result':_0x2a9eda[_0x753a('0x1')],'transfererchannel':_0x2a9eda['origtransfererchannel'],'transferercalleridnum':_0x2a9eda[_0x753a('0x17')],'transferercalleridname':_0x2a9eda[_0x753a('0x18')],'transfererconnectedlinenum':_0x2a9eda[_0x753a('0x19')],'transfererconnectedlinename':_0x2a9eda['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2a9eda['origtransfereraccountcode'],'transferercontext':_0x2a9eda[_0x753a('0x1a')],'transfererexten':_0x2a9eda[_0x753a('0x1b')],'transfererlinkedid':_0x2a9eda[_0x753a('0x1c')],'transfereechannel':_0x2a9eda[_0x753a('0x1d')],'transfereecalleridnum':_0x2a9eda[_0x753a('0x1e')],'transfereecalleridname':_0x2a9eda['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2a9eda[_0x753a('0x1f')],'transfereeconnectedlinename':_0x2a9eda[_0x753a('0x20')],'transfereeaccountcode':_0x2a9eda['transfertargetaccountcode'],'transfereecontext':_0x2a9eda[_0x753a('0x21')],'transfereeexten':_0x2a9eda[_0x753a('0x22')],'transfereelinkedid':_0x2a9eda[_0x753a('0x23')],'isexternal':_0x2a9eda[_0x753a('0x10')],'context':_0x2a9eda[_0x753a('0x24')],'extension':_0x2a9eda[_0x753a('0x25')],'type':_0x753a('0x26')},'log':_0x753a('0x14')});}; \ No newline at end of file +var _0xa905=['transfererconnectedlinenum','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','../client','Request','CreateVoiceTransferReport','result','transfererchannel'];(function(_0x3f0231,_0x3ad919){var _0x14a4fc=function(_0x4cd057){while(--_0x4cd057){_0x3f0231['push'](_0x3f0231['shift']());}};_0x14a4fc(++_0x3ad919);}(_0xa905,0x1cf));var _0x5a90=function(_0x19f31b,_0x2273e1){_0x19f31b=_0x19f31b-0x0;var _0x523169=_0xa905[_0x19f31b];return _0x523169;};'use strict';var client=require(_0x5a90('0x0'));exports['blindTransfer']=function(_0x1879c0){return client[_0x5a90('0x1')](_0x5a90('0x2'),{'body':{'result':_0x1879c0[_0x5a90('0x3')],'transfererchannel':_0x1879c0[_0x5a90('0x4')],'transferercalleridnum':_0x1879c0['transferercalleridnum'],'transferercalleridname':_0x1879c0['transferercalleridname'],'transfererconnectedlinenum':_0x1879c0[_0x5a90('0x5')],'transfererconnectedlinename':_0x1879c0['transfererconnectedlinename'],'transfereraccountcode':_0x1879c0[_0x5a90('0x6')],'transferercontext':_0x1879c0['transferercontext'],'transfererexten':_0x1879c0[_0x5a90('0x7')],'transfererlinkedid':_0x1879c0[_0x5a90('0x8')],'transfereechannel':_0x1879c0[_0x5a90('0x9')],'transfereecalleridnum':_0x1879c0['transfereecalleridnum'],'transfereecalleridname':_0x1879c0[_0x5a90('0xa')],'transfereeconnectedlinenum':_0x1879c0[_0x5a90('0xb')],'transfereeconnectedlinename':_0x1879c0[_0x5a90('0xc')],'transfereeaccountcode':_0x1879c0['transfereeaccountcode'],'transfereecontext':_0x1879c0[_0x5a90('0xd')],'transfereeexten':_0x1879c0[_0x5a90('0xe')],'transfereelinkedid':_0x1879c0[_0x5a90('0xf')],'isexternal':_0x1879c0[_0x5a90('0x10')],'context':_0x1879c0[_0x5a90('0x11')],'extension':_0x1879c0['extension'],'type':_0x5a90('0x12')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x2dee72){return client[_0x5a90('0x1')](_0x5a90('0x2'),{'body':{'result':_0x2dee72[_0x5a90('0x3')],'transfererchannel':_0x2dee72['origtransfererchannel'],'transferercalleridnum':_0x2dee72[_0x5a90('0x13')],'transferercalleridname':_0x2dee72[_0x5a90('0x14')],'transfererconnectedlinenum':_0x2dee72[_0x5a90('0x15')],'transfererconnectedlinename':_0x2dee72['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2dee72[_0x5a90('0x16')],'transferercontext':_0x2dee72[_0x5a90('0x17')],'transfererexten':_0x2dee72[_0x5a90('0x18')],'transfererlinkedid':_0x2dee72[_0x5a90('0x19')],'transfereechannel':_0x2dee72[_0x5a90('0x1a')],'transfereecalleridnum':_0x2dee72[_0x5a90('0x1b')],'transfereecalleridname':_0x2dee72[_0x5a90('0x1c')],'transfereeconnectedlinenum':_0x2dee72[_0x5a90('0x1d')],'transfereeconnectedlinename':_0x2dee72[_0x5a90('0x1e')],'transfereeaccountcode':_0x2dee72[_0x5a90('0x1f')],'transfereecontext':_0x2dee72[_0x5a90('0x20')],'transfereeexten':_0x2dee72[_0x5a90('0x21')],'transfereelinkedid':_0x2dee72[_0x5a90('0x22')],'isexternal':_0x2dee72['isexternal'],'context':_0x2dee72['origtransferercontext'],'extension':_0x2dee72[_0x5a90('0x23')],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 2d592b0..6013cb7 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 _0x2219=['outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','channels','voicechannel','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','status','stop','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','action','Action','then','message','username','command','Command','content','catch','voiceQueues','hasOwnProperty','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay'];(function(_0xd0e677,_0x42939d){var _0x18aeb9=function(_0x40dd57){while(--_0x40dd57){_0xd0e677['push'](_0xd0e677['shift']());}};_0x18aeb9(++_0x42939d);}(_0x2219,0x14e));var _0x9221=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0x2219[_0x58fc2f];return _0x3a1312;};'use strict';var _=require(_0x9221('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require(_0x9221('0x1'));var BPromise=require(_0x9221('0x2'));var moment=require(_0x9221('0x3'));var config=require(_0x9221('0x4'));var properties=require(_0x9221('0x5'));var ami=require(_0x9221('0x6'));exports[_0x9221('0x7')]=function(_0x4cebb0,_0x14ea17,_0x2f376e){return new BPromise(function(_0x17768e,_0x3e26e3){var _0x508fd3={'QueuePause':function(_0x4e9e62){return new Promise(function(_0x515486,_0xfa3a75){var _0x2a8b13=util[_0x9221('0x8')]('%s/%s','SIP',_0x4e9e62[_0x9221('0x9')]);if(_0x4cebb0[_0x9221('0xa')]&&_0x4cebb0[_0x9221('0xa')][_0x2a8b13]&&_0x4cebb0['timers'][_0x2a8b13][_0x9221('0xb')]){_0x4cebb0[_0x9221('0xa')][_0x2a8b13][_0x9221('0xc')]();}if(_0x4cebb0[_0x9221('0xd')][_0x2a8b13]){_0x4cebb0['agents'][_0x2a8b13][_0x9221('0xe')]({'statePause':_0x4e9e62[_0x9221('0xf')]?!![]:![]});}_0x515486({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x43fc60){var _0x37e474=this;return new Promise(function(_0x309e88,_0x2fec3e){if(ami[_0x9221('0x10')]()==![]){return _0x2fec3e(_0x37e474[_0x9221('0x11')](0x1f4,[config[_0x9221('0x12')]['ip'],config[_0x9221('0x12')]['username'],_0x9221('0x13')][_0x9221('0x14')]('\x20')));}_0x43fc60=_[_0x9221('0x15')](_0x43fc60,_[_0x9221('0x16')](properties['module']));_0x43fc60[_0x9221('0x17')]='Reload';return ami[_0x9221('0x18')](_0x43fc60)[_0x9221('0x19')](function(_0x2ede87){_0x309e88({'code':0xc8,'message':_0x2ede87[_0x9221('0x1a')]});})['catch'](function(_0x9121e){_0x2fec3e(_0x37e474[_0x9221('0x11')](0x1f5,_0x9121e[_0x9221('0x1a')]));});});},'Command':function(_0xd5912){var _0x4f7b9c=this;return new Promise(function(_0x48f9be,_0x4e16f4){if(ami[_0x9221('0x10')]()==![]){return _0x4e16f4(_0x4f7b9c['error'](0x1f4,[config[_0x9221('0x12')]['ip'],config[_0x9221('0x12')][_0x9221('0x1b')],'ami\x20disconnected'][_0x9221('0x14')]('\x20')));}_0xd5912=_['pick'](_0xd5912,_0x9221('0x1c'));_0xd5912[_0x9221('0x17')]=_0x9221('0x1d');return ami[_0x9221('0x18')](_0xd5912)[_0x9221('0x19')](function(_0x399917){_0x48f9be({'code':0xc8,'message':_0x399917[_0x9221('0x1e')]});})[_0x9221('0x1f')](function(_0x505af0){_0x4e16f4(_0x4f7b9c[_0x9221('0x11')](0x1f5,_0x505af0[_0x9221('0x1a')]));});});},'VoiceQueues':function(_0x14f461){return new Promise(function(_0x358c59,_0x3ae5e9){var _0x59be4e=[];for(var _0x1affaf in _0x4cebb0[_0x9221('0x20')]){if(_0x4cebb0[_0x9221('0x20')][_0x9221('0x21')](_0x1affaf)){var _0x479e9d=_0x4cebb0[_0x9221('0x20')][_0x1affaf];var _0x57d7b5={'id':_0x479e9d['id'],'name':_0x479e9d['name'],'strategy':_0x479e9d[_0x9221('0x22')],'answered':_0x479e9d['answered'],'available':_0x479e9d['available'],'loggedIn':_0x479e9d[_0x9221('0x23')],'pTalking':_0x479e9d[_0x9221('0x24')],'sumBillable':_0x479e9d[_0x9221('0x25')],'sumDuration':_0x479e9d[_0x9221('0x26')],'sumHoldTime':_0x479e9d[_0x9221('0x27')]||0x0,'talking':_0x479e9d[_0x9221('0x28')],'total':_0x479e9d['total'],'type':_0x479e9d[_0x9221('0x29')],'unmanaged':_0x479e9d[_0x9221('0x2a')],'abandoned':_0x479e9d[_0x9221('0x2b')],'waiting':_0x479e9d[_0x9221('0x2c')],'loggedInDb':_0x479e9d[_0x9221('0x2d')]};if(_0x479e9d['type']===_0x9221('0x2e')){_0x57d7b5[_0x9221('0x2f')]=_0x479e9d[_0x9221('0x2f')];_0x57d7b5[_0x9221('0x30')]=_0x479e9d[_0x9221('0x30')];_0x57d7b5[_0x9221('0x31')]=_0x479e9d[_0x9221('0x31')];_0x57d7b5[_0x9221('0x32')]=_0x479e9d['dialOriginateCallerIdNumber'];_0x57d7b5[_0x9221('0x33')]=_0x479e9d[_0x9221('0x33')];_0x57d7b5[_0x9221('0x34')]=_0x479e9d[_0x9221('0x34')];_0x57d7b5[_0x9221('0x35')]=_0x479e9d[_0x9221('0x35')];_0x57d7b5[_0x9221('0x36')]=_0x479e9d[_0x9221('0x36')];_0x57d7b5[_0x9221('0x37')]=_0x479e9d[_0x9221('0x37')];_0x57d7b5[_0x9221('0x38')]=_0x479e9d['outboundBusyCallsDay'];_0x57d7b5[_0x9221('0x39')]=_0x479e9d[_0x9221('0x39')];_0x57d7b5['outboundDropCallsDayACS']=_0x479e9d[_0x9221('0x3a')];_0x57d7b5[_0x9221('0x3b')]=_0x479e9d[_0x9221('0x3b')];_0x57d7b5['outboundDropCallsDayTimeout']=_0x479e9d['outboundDropCallsDayTimeout'];_0x57d7b5['outboundNoAnswerCallsDay']=_0x479e9d[_0x9221('0x3c')];_0x57d7b5[_0x9221('0x3d')]=_0x479e9d['outboundNoSuchCallsDay'];_0x57d7b5[_0x9221('0x3e')]=_0x479e9d[_0x9221('0x3e')];_0x57d7b5[_0x9221('0x3f')]=_0x479e9d[_0x9221('0x3f')];_0x57d7b5['outboundRejectCallsDay']=_0x479e9d[_0x9221('0x40')];_0x57d7b5[_0x9221('0x41')]=_0x479e9d['outboundUnknownCallsDay'];_0x57d7b5[_0x9221('0x42')]=_0x479e9d[_0x9221('0x42')];_0x57d7b5['predictiveIntervalAvgHoldtime']=_0x479e9d[_0x9221('0x43')];_0x57d7b5[_0x9221('0x44')]=_0x479e9d['predictiveIntervalAvgTalktime'];_0x57d7b5[_0x9221('0x45')]=_0x479e9d[_0x9221('0x45')];_0x57d7b5[_0x9221('0x46')]=_0x479e9d[_0x9221('0x46')];_0x57d7b5[_0x9221('0x47')]=_0x479e9d[_0x9221('0x47')];_0x57d7b5['predictiveIntervalErlangCallsDroppedCalls']=_0x479e9d[_0x9221('0x48')];_0x57d7b5[_0x9221('0x49')]=_0x479e9d[_0x9221('0x49')];_0x57d7b5['predictiveIntervalMultiplicativeFactor']=_0x479e9d[_0x9221('0x4a')];_0x57d7b5['predictiveIntervalPauses']=_0x479e9d['predictiveIntervalPauses'];_0x57d7b5[_0x9221('0x4b')]=_0x479e9d[_0x9221('0x4b')];_0x57d7b5[_0x9221('0x4c')]=_0x479e9d[_0x9221('0x4c')];_0x57d7b5[_0x9221('0x1a')]=_0x479e9d[_0x9221('0x1a')];_0x57d7b5[_0x9221('0x4d')]=_0x479e9d['originated'];_0x57d7b5[_0x9221('0x4e')]=_0x479e9d[_0x9221('0x4e')];_0x57d7b5[_0x9221('0x4f')]=_0x479e9d[_0x9221('0x4f')];_0x57d7b5[_0x9221('0x50')]=_0x479e9d['erlangAbandonmentRate'];_0x57d7b5[_0x9221('0x51')]=_0x479e9d['erlangBusyFactor'];_0x57d7b5['startPredictive']=_0x479e9d[_0x9221('0x52')];_0x57d7b5['startProgressive']=_0x479e9d[_0x9221('0x53')];}if(_0x479e9d[_0x9221('0x54')]){_0x57d7b5[_0x9221('0x54')]={'id':_0x479e9d['Trunk']['id'],'name':_0x479e9d[_0x9221('0x54')][_0x9221('0x9')],'active':_0x479e9d['Trunk'][_0x9221('0x55')],'callerid':_0x479e9d['Trunk']['callerid']};}if(_0x479e9d[_0x9221('0x56')]){_0x57d7b5[_0x9221('0x56')]={'id':_0x479e9d['Interval']['id'],'name':_0x479e9d[_0x9221('0x56')][_0x9221('0x9')]};}_0x59be4e[_0x9221('0x57')](_0x57d7b5);}}_0x358c59({'count':_0x59be4e[_0x9221('0x58')],'rows':_0x59be4e});});},'VoiceChannels':function(_0x57d187){return new Promise(function(_0x5bc61d,_0x50fbcf){var _0x5a78ac=_['values'](_0x4cebb0[_0x9221('0x59')]);_0x5bc61d({'count':_0x5a78ac[_0x9221('0x58')],'rows':_0x5a78ac});});},'VoiceChannelMixMonitor':function(_0x46a387){var _0x5d7c30=this;return new Promise(function(_0x44525a,_0x420f23){if(ami[_0x9221('0x10')]()==![]){return _0x420f23(_0x5d7c30[_0x9221('0x11')](0x1f4,[config[_0x9221('0x12')]['ip'],config[_0x9221('0x12')][_0x9221('0x1b')],_0x9221('0x13')][_0x9221('0x14')]('\x20')));}var _0x783e7c=schema(properties[_0x9221('0x5a')])[_0x9221('0x1')](_0x46a387);if(_0x783e7c[_0x9221('0x58')]>0x0){return _0x420f23(_0x5d7c30['error'](0x1f4,_['map'](_0x783e7c,_0x9221('0x1a'))['join'](',\x20')));}var _0x2ffae7=_[_0x9221('0x5b')](_0x4cebb0[_0x9221('0x59')],{'uniqueid':_0x46a387[_0x9221('0x5c')]});if(_0x2ffae7&&_0x2ffae7[_0x9221('0x5d')]){var _0x49a152=util['format'](_0x9221('0x5e'),_0x46a387[_0x9221('0x5f')]||_0x46a387['uniqueid'],_0x46a387[_0x9221('0x8')]||_0x9221('0x60'));return ami[_0x9221('0x18')]({'action':_0x9221('0x61'),'channel':_0x2ffae7['channel'],'file':_0x49a152,'options':_0x9221('0x62')})[_0x9221('0x19')](function(_0x28e76a){var _0x490c9d=_['find'](_0x2ffae7[_0x9221('0x63')],{'filename':'/var/spool/asterisk/monitor/'+_0x49a152['toLowerCase']()});if(_['isNil'](_0x490c9d)){_0x2ffae7['monitors'][_0x9221('0x57')]({'filename':_0x9221('0x64')+_0x49a152[_0x9221('0x65')](),'createdAt':moment()['format'](_0x9221('0x66')),'mixmonitorid':_0x28e76a['mixmonitorid'],'status':_0x9221('0x67')});}else{_0x490c9d[_0x9221('0x68')]=_0x28e76a[_0x9221('0x68')];_0x490c9d['status']='rec';}_0x44525a({'code':0xc8,'message':[_0x46a387[_0x9221('0x5c')],_0x9221('0x69'),_0x28e76a[_0x9221('0x68')]][_0x9221('0x14')]('\x20'),'mixmonitorid':_0x28e76a[_0x9221('0x68')]});})['catch'](function(_0x3a0244){_0x420f23(_0x5d7c30[_0x9221('0x11')](0x1f5,[_0x46a387['uniqueid'],_0x3a0244[_0x9221('0x1a')][_0x9221('0x65')]()][_0x9221('0x14')]('\x20')));});}else{return _0x420f23(_0x5d7c30[_0x9221('0x11')](0x1f5,_0x9221('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0x42a957){var _0x8cc6a9=this;return new Promise(function(_0x484097,_0x461ff2){if(ami[_0x9221('0x10')]()==![]){return _0x461ff2(_0x8cc6a9[_0x9221('0x11')](0x1f4,[config[_0x9221('0x12')]['ip'],config['asterisk'][_0x9221('0x1b')],'ami\x20disconnected'][_0x9221('0x14')]('\x20')));}var _0x1da5bd=schema(properties[_0x9221('0x5a')])[_0x9221('0x1')](_0x42a957);if(_0x1da5bd[_0x9221('0x58')]>0x0){return _0x461ff2(_0x8cc6a9['error'](0x1f4,_[_0x9221('0x6b')](_0x1da5bd,_0x9221('0x1a'))[_0x9221('0x14')](',\x20')));}var _0xcb026c=_[_0x9221('0x5b')](_0x4cebb0['channels'],{'uniqueid':_0x42a957['uniqueid']});if(_0xcb026c){return BPromise[_0x9221('0x6c')]()[_0x9221('0x19')](function(){if(_0xcb026c[_0x9221('0x5d')]){return ami[_0x9221('0x18')]({'action':_0x9221('0x6d'),'channel':_0xcb026c[_0x9221('0x5d')],'mixmonitorid':_0x42a957[_0x9221('0x68')]})[_0x9221('0x1f')](function(_0x129ee0){});}})[_0x9221('0x19')](function(){if(_0xcb026c[_0x9221('0x6e')]){return ami['Action']({'action':_0x9221('0x6d'),'channel':_0xcb026c[_0x9221('0x6e')],'mixmonitorid':_0x42a957[_0x9221('0x68')]})[_0x9221('0x1f')](function(_0x35b2af){});}})['then'](function(_0x5d2e2c){var _0x26f970=_['find'](_0xcb026c['monitors'],{'mixmonitorid':_0x42a957['mixmonitorid']});if(_0x26f970){_0x26f970[_0x9221('0x6f')]=_0x9221('0x70');}})[_0x9221('0x19')](function(){var _0x4513d0=util[_0x9221('0x8')](_0x9221('0x5e'),_0x42a957[_0x9221('0x5f')]||_0x42a957['uniqueid'],_0x42a957[_0x9221('0x8')]||'wav');var _0xeb22ec=_[_0x9221('0x5b')](_0xcb026c[_0x9221('0x63')],{'filename':_0x9221('0x64')+_0x4513d0[_0x9221('0x65')]()});if(_0xeb22ec){_0xeb22ec[_0x9221('0x6f')]=_0x9221('0x70');}})[_0x9221('0x19')](function(){_0x484097({'code':0xc8,'message':[_0x42a957[_0x9221('0x5c')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x9221('0x1f')](function(_0x17c3ac){_0x461ff2(_0x8cc6a9[_0x9221('0x11')](0x1f5,[_0x42a957[_0x9221('0x5c')],_0x17c3ac['message'][_0x9221('0x65')]()][_0x9221('0x14')]('\x20')));});}else{return _0x461ff2(_0x8cc6a9[_0x9221('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0xfc2edb){return new Promise(function(_0x4bc9ce,_0x2d370a){var _0x2cb32f=_[_0x9221('0x71')](_0x4cebb0[_0x9221('0x72')]);_0x4bc9ce({'count':_0x2cb32f['length'],'rows':_0x2cb32f});});},'VoiceQueuesChannel':function(_0x44a420){var _0x5a8c1c=this;return new Promise(function(_0x44baa8,_0x9b8c16){var _0x9dccd8=schema(properties[_0x9221('0x73')])[_0x9221('0x1')](_0x44a420);if(_0x9dccd8['length']>0x0){return _0x9b8c16(_0x5a8c1c[_0x9221('0x11')](0x1f4,_[_0x9221('0x6b')](_0x9dccd8,'message')[_0x9221('0x14')](',\x20')));}var _0x46fdd9=_[_0x9221('0x5b')](_0x4cebb0[_0x9221('0x72')],{'uniqueid':_0x44a420[_0x9221('0x5c')]});if(_0x46fdd9){_0x44baa8(_0x46fdd9);}else{return _0x9b8c16(_0x5a8c1c[_0x9221('0x11')](0x1f5,_0x9221('0x6a')));}});},'VoiceQueuesChannelHangup':function(_0x3c0a79){var _0x5a7d5e=this;return new Promise(function(_0x7c1939,_0x37e2d6){if(ami['isConnected']()==![]){return _0x37e2d6(_0x5a7d5e[_0x9221('0x11')](0x1f4,[config[_0x9221('0x12')]['ip'],config[_0x9221('0x12')][_0x9221('0x1b')],_0x9221('0x13')][_0x9221('0x14')]('\x20')));}var _0x167893=schema(properties[_0x9221('0x74')])[_0x9221('0x1')](_0x3c0a79);if(_0x167893[_0x9221('0x58')]>0x0){return _0x37e2d6(_0x5a7d5e[_0x9221('0x11')](0x1f4,_[_0x9221('0x6b')](_0x167893,_0x9221('0x1a'))[_0x9221('0x14')](',\x20')));}var _0x1935c=_[_0x9221('0x5b')](_0x4cebb0[_0x9221('0x72')],{'uniqueid':_0x3c0a79['uniqueid']});if(_0x1935c&&_0x1935c[_0x9221('0x5d')]){return ami['Action']({'action':_0x9221('0x75'),'channel':_0x1935c[_0x9221('0x5d')]})[_0x9221('0x19')](function(_0x385b8e){_0x7c1939({'code':0xc8,'message':[_0x3c0a79[_0x9221('0x5c')],_0x385b8e[_0x9221('0x1a')][_0x9221('0x65')]()][_0x9221('0x14')]('\x20')});})[_0x9221('0x1f')](function(_0x2f8973){_0x37e2d6(_0x5a7d5e[_0x9221('0x11')](0x1f5,[_0x3c0a79[_0x9221('0x5c')],_0x2f8973[_0x9221('0x1a')][_0x9221('0x65')]()][_0x9221('0x14')]('\x20')));});}else{return _0x37e2d6(_0x5a7d5e['error'](0x1f5,_0x9221('0x6a')));}});},'VoiceQueuesChannelRedirect':function(_0x242dd0){var _0x23d918=this;return new Promise(function(_0x227309,_0x407f7e){if(ami[_0x9221('0x10')]()==![]){return _0x407f7e(_0x23d918[_0x9221('0x11')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x9221('0x13')]['join']('\x20')));}var _0x5ec1f7=schema(properties[_0x9221('0x76')])[_0x9221('0x1')](_0x242dd0);if(_0x5ec1f7[_0x9221('0x58')]>0x0){return _0x407f7e(_0x23d918[_0x9221('0x11')](0x1f4,_[_0x9221('0x6b')](_0x5ec1f7,'message')[_0x9221('0x14')](',\x20')));}var _0x34cf34=_[_0x9221('0x5b')](_0x4cebb0[_0x9221('0x72')],{'uniqueid':_0x242dd0[_0x9221('0x5c')]});if(_0x34cf34&&_0x34cf34[_0x9221('0x5d')]){return ami['Action']({'action':'Redirect','channel':_0x34cf34[_0x9221('0x5d')],'exten':_0x242dd0['exten'],'context':_0x242dd0[_0x9221('0x77')]||_0x34cf34['context'],'priority':0x1})['then'](function(_0x331e06){_0x227309({'code':0xc8,'message':[_0x242dd0[_0x9221('0x5c')],_0x331e06[_0x9221('0x1a')][_0x9221('0x65')]()][_0x9221('0x14')]('\x20')});})[_0x9221('0x1f')](function(_0x55f8cc){_0x407f7e(_0x23d918['error'](0x1f5,[_0x242dd0['uniqueid'],_0x55f8cc['message'][_0x9221('0x65')]()][_0x9221('0x14')]('\x20')));});}else{return _0x407f7e(_0x23d918[_0x9221('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x6aea42){return new Promise(function(_0x3bbcf1,_0x95ebf3){var _0x594fe7=_[_0x9221('0x71')](_0x4cebb0[_0x9221('0xd')]);_0x3bbcf1({'count':_0x594fe7['length'],'rows':_0x594fe7});});},'Telephones':function(_0x5a809f){return new Promise(function(_0xa894dc,_0x4f7360){var _0x5bd787=_[_0x9221('0x71')](_0x4cebb0[_0x9221('0x78')]);_0xa894dc({'count':_0x5bd787[_0x9221('0x58')],'rows':_0x5bd787});});},'Trunks':function(_0x1e58f3){return new Promise(function(_0x374fa4,_0x488e1d){var _0x350a35=_[_0x9221('0x71')](_0x4cebb0[_0x9221('0x79')]);_0x374fa4({'count':_0x350a35['length'],'rows':_0x350a35});});},'OutboundChannels':function(_0x2a6f75){return new Promise(function(_0x211e71,_0x11067e){var _0x270656=_['values'](_0x4cebb0[_0x9221('0x7a')]);_0x211e71({'count':_0x270656[_0x9221('0x58')],'rows':_0x270656});});},'Outbound':function(_0x24429c){return new Promise(function(_0x41a2ef,_0x36067a){_0x41a2ef(_0x4cebb0['outbound']);});},'Campaigns':function(_0x479176){return new Promise(function(_0x4d1b14,_0x58c4bd){var _0x1341f6=_['values'](_0x4cebb0[_0x9221('0x7b')]);_0x4d1b14({'count':_0x1341f6['length'],'rows':_0x1341f6});});},'VoiceQueuesPreview':function(_0x4cd358){var _0x47af3c=this;return new Promise(function(_0x4a0510,_0x1cbff6){_0x14ea17['run'](_0x4cd358['id'])[_0x9221('0x19')](function(_0x4134dd){_0x4a0510({'code':0xc8,'message':_0x4134dd[_0x9221('0x1a')]});})[_0x9221('0x1f')](function(_0x591efb){_0x1cbff6(_0x47af3c[_0x9221('0x11')](0x1f4,_0x591efb['message']));});});},'EventManager':function(_0x5eb396){var _0x582056=this;return new Promise(function(_0x3bfe57,_0x4900bf){if(!_0x5eb396[_0x9221('0x7c')]){return _0x4900bf(_0x582056['error'](0x1f4,_0x9221('0x7d')));}ami['emit']('custom:'+_0x5eb396['event'],_0x5eb396['message']);_0x3bfe57({'code':0xc8,'message':_0x5eb396});});},'FaxAccounts':function(_0x50ba07){return new Promise(function(_0x382413,_0xd4559d){var _0x12cdb9=_[_0x9221('0x71')](_0x4cebb0[_0x9221('0x7e')]);_0x382413({'count':_0x12cdb9[_0x9221('0x58')],'rows':_0x12cdb9});});},'SendFax':function(_0x44e496){var _0x4b77cb=this;return new Promise(function(_0x3acf83,_0x366492){_0x2f376e[_0x9221('0x7f')](_0x44e496)[_0x9221('0x19')](function(_0x40e04c){_0x3acf83({'code':0xc8,'message':_0x40e04c[_0x9221('0x1a')]});})[_0x9221('0x1f')](function(_0x183202){_0x366492(_0x4b77cb[_0x9221('0x11')](0x1f4,_0x183202['message']));});});},'CheckAfterSend':function(_0x1f4865){var _0x49b0f4=this;return new Promise(function(_0x3c1d6b,_0x238df4){_0x2f376e[_0x9221('0x80')](_0x1f4865)[_0x9221('0x19')](function(_0x2fedf8){_0x3c1d6b({'code':0xc8,'message':_0x2fedf8[_0x9221('0x1a')]});})['catch'](function(_0x3e8b5f){_0x238df4(_0x49b0f4['error'](0x1f4,_0x3e8b5f[_0x9221('0x1a')]));});});}};var _0x2998e3=jayson[_0x9221('0x81')](_0x508fd3)[_0x9221('0x82')]();_0x2998e3['on'](_0x9221('0x11'),function(_0x5b95c5){return _0x3e26e3(_0x5b95c5);});_0x2998e3[_0x9221('0x7')](0x232a,'127.0.0.1',function(){console['log'](_0x9221('0x83'),0x232a);return _0x17768e(_0x9221('0x84')+0x232a);});});}; \ No newline at end of file +var _0xdf68=['outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','channels','voicechannel','map','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','find','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','context','telephones','trunks','outboundChannels','event','Event\x20name\x20mandatory','custom:','send','checkAfterSend','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','module','Action','then','message','command','action','Command','content','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','type'];(function(_0x5d67b0,_0x2e1f60){var _0x44f3e2=function(_0x4b11c1){while(--_0x4b11c1){_0x5d67b0['push'](_0x5d67b0['shift']());}};_0x44f3e2(++_0x2e1f60);}(_0xdf68,0x1e7));var _0x8df6=function(_0x26bcec,_0xe13f50){_0x26bcec=_0x26bcec-0x0;var _0x1049dc=_0xdf68[_0x26bcec];return _0x1049dc;};'use strict';var _=require(_0x8df6('0x0'));var util=require(_0x8df6('0x1'));var jayson=require('jayson/promise');var schema=require(_0x8df6('0x2'));var BPromise=require(_0x8df6('0x3'));var moment=require(_0x8df6('0x4'));var config=require(_0x8df6('0x5'));var properties=require(_0x8df6('0x6'));var ami=require(_0x8df6('0x7'));exports[_0x8df6('0x8')]=function(_0xb51cb6,_0x342ac1,_0x5ebb04){return new BPromise(function(_0x14b4b2,_0x51a7ab){var _0xadf577={'QueuePause':function(_0x57e7c7){return new Promise(function(_0x44c3c2,_0x1313e8){var _0xf7aa3e=util[_0x8df6('0x9')]('%s/%s','SIP',_0x57e7c7[_0x8df6('0xa')]);if(_0xb51cb6[_0x8df6('0xb')]&&_0xb51cb6[_0x8df6('0xb')][_0xf7aa3e]&&_0xb51cb6[_0x8df6('0xb')][_0xf7aa3e][_0x8df6('0xc')]){_0xb51cb6[_0x8df6('0xb')][_0xf7aa3e][_0x8df6('0xd')]();}if(_0xb51cb6[_0x8df6('0xe')][_0xf7aa3e]){_0xb51cb6['agents'][_0xf7aa3e][_0x8df6('0xf')]({'statePause':_0x57e7c7[_0x8df6('0x10')]?!![]:![]});}_0x44c3c2({'code':0xc8,'message':_0x8df6('0x11')});});},'Reload':function(_0x41ddf7){var _0x10ab47=this;return new Promise(function(_0x19fd52,_0x219ec7){if(ami[_0x8df6('0x12')]()==![]){return _0x219ec7(_0x10ab47[_0x8df6('0x13')](0x1f4,[config[_0x8df6('0x14')]['ip'],config[_0x8df6('0x14')][_0x8df6('0x15')],_0x8df6('0x16')][_0x8df6('0x17')]('\x20')));}_0x41ddf7=_['pick'](_0x41ddf7,_[_0x8df6('0x18')](properties[_0x8df6('0x19')]));_0x41ddf7['action']='Reload';return ami[_0x8df6('0x1a')](_0x41ddf7)[_0x8df6('0x1b')](function(_0x1937e2){_0x19fd52({'code':0xc8,'message':_0x1937e2['message']});})['catch'](function(_0x1c6d60){_0x219ec7(_0x10ab47[_0x8df6('0x13')](0x1f5,_0x1c6d60[_0x8df6('0x1c')]));});});},'Command':function(_0x186097){var _0x3ab414=this;return new Promise(function(_0x14db14,_0xf92a56){if(ami['isConnected']()==![]){return _0xf92a56(_0x3ab414[_0x8df6('0x13')](0x1f4,[config[_0x8df6('0x14')]['ip'],config['asterisk'][_0x8df6('0x15')],_0x8df6('0x16')][_0x8df6('0x17')]('\x20')));}_0x186097=_['pick'](_0x186097,_0x8df6('0x1d'));_0x186097[_0x8df6('0x1e')]=_0x8df6('0x1f');return ami[_0x8df6('0x1a')](_0x186097)[_0x8df6('0x1b')](function(_0x36e5d0){_0x14db14({'code':0xc8,'message':_0x36e5d0[_0x8df6('0x20')]});})[_0x8df6('0x21')](function(_0x2951bc){_0xf92a56(_0x3ab414['error'](0x1f5,_0x2951bc[_0x8df6('0x1c')]));});});},'VoiceQueues':function(_0x58245d){return new Promise(function(_0xcf46cc,_0x42d531){var _0x3a977c=[];for(var _0x1e2932 in _0xb51cb6['voiceQueues']){if(_0xb51cb6[_0x8df6('0x22')][_0x8df6('0x23')](_0x1e2932)){var _0x3c830f=_0xb51cb6[_0x8df6('0x22')][_0x1e2932];var _0x52cad3={'id':_0x3c830f['id'],'name':_0x3c830f[_0x8df6('0xa')],'strategy':_0x3c830f[_0x8df6('0x24')],'answered':_0x3c830f[_0x8df6('0x25')],'available':_0x3c830f[_0x8df6('0x26')],'loggedIn':_0x3c830f[_0x8df6('0x27')],'pTalking':_0x3c830f[_0x8df6('0x28')],'sumBillable':_0x3c830f[_0x8df6('0x29')],'sumDuration':_0x3c830f['sumDuration'],'sumHoldTime':_0x3c830f[_0x8df6('0x2a')]||0x0,'talking':_0x3c830f[_0x8df6('0x2b')],'total':_0x3c830f[_0x8df6('0x2c')],'type':_0x3c830f['type'],'unmanaged':_0x3c830f[_0x8df6('0x2d')],'abandoned':_0x3c830f[_0x8df6('0x2e')],'waiting':_0x3c830f['waiting'],'loggedInDb':_0x3c830f[_0x8df6('0x2f')]};if(_0x3c830f[_0x8df6('0x30')]===_0x8df6('0x31')){_0x52cad3['dialActive']=_0x3c830f[_0x8df6('0x32')];_0x52cad3[_0x8df6('0x33')]=_0x3c830f[_0x8df6('0x33')];_0x52cad3[_0x8df6('0x34')]=_0x3c830f['dialOriginateCallerIdName'];_0x52cad3[_0x8df6('0x35')]=_0x3c830f[_0x8df6('0x35')];_0x52cad3[_0x8df6('0x36')]=_0x3c830f[_0x8df6('0x36')];_0x52cad3[_0x8df6('0x37')]=_0x3c830f[_0x8df6('0x37')];_0x52cad3['outboundAnswerAgiCallsDay']=_0x3c830f['outboundAnswerAgiCallsDay'];_0x52cad3[_0x8df6('0x38')]=_0x3c830f[_0x8df6('0x38')];_0x52cad3[_0x8df6('0x39')]=_0x3c830f['outboundBlacklistCallsDay'];_0x52cad3[_0x8df6('0x3a')]=_0x3c830f[_0x8df6('0x3a')];_0x52cad3[_0x8df6('0x3b')]=_0x3c830f[_0x8df6('0x3b')];_0x52cad3[_0x8df6('0x3c')]=_0x3c830f[_0x8df6('0x3c')];_0x52cad3[_0x8df6('0x3d')]=_0x3c830f[_0x8df6('0x3d')];_0x52cad3[_0x8df6('0x3e')]=_0x3c830f[_0x8df6('0x3e')];_0x52cad3['outboundNoAnswerCallsDay']=_0x3c830f[_0x8df6('0x3f')];_0x52cad3[_0x8df6('0x40')]=_0x3c830f[_0x8df6('0x40')];_0x52cad3[_0x8df6('0x41')]=_0x3c830f[_0x8df6('0x41')];_0x52cad3[_0x8df6('0x42')]=_0x3c830f[_0x8df6('0x42')];_0x52cad3[_0x8df6('0x43')]=_0x3c830f[_0x8df6('0x43')];_0x52cad3['outboundUnknownCallsDay']=_0x3c830f['outboundUnknownCallsDay'];_0x52cad3['predictiveIntervalAnsweredCalls']=_0x3c830f[_0x8df6('0x44')];_0x52cad3[_0x8df6('0x45')]=_0x3c830f['predictiveIntervalAvgHoldtime'];_0x52cad3[_0x8df6('0x46')]=_0x3c830f[_0x8df6('0x46')];_0x52cad3[_0x8df6('0x47')]=_0x3c830f[_0x8df6('0x47')];_0x52cad3[_0x8df6('0x48')]=_0x3c830f[_0x8df6('0x48')];_0x52cad3['predictiveIntervalErlangCalls']=_0x3c830f[_0x8df6('0x49')];_0x52cad3[_0x8df6('0x4a')]=_0x3c830f[_0x8df6('0x4a')];_0x52cad3[_0x8df6('0x4b')]=_0x3c830f[_0x8df6('0x4b')];_0x52cad3[_0x8df6('0x4c')]=_0x3c830f[_0x8df6('0x4c')];_0x52cad3[_0x8df6('0x4d')]=_0x3c830f[_0x8df6('0x4d')];_0x52cad3[_0x8df6('0x4e')]=_0x3c830f[_0x8df6('0x4e')];_0x52cad3[_0x8df6('0x4f')]=_0x3c830f['predictiveIntervalTotalCalls'];_0x52cad3[_0x8df6('0x1c')]=_0x3c830f[_0x8df6('0x1c')];_0x52cad3[_0x8df6('0x50')]=_0x3c830f[_0x8df6('0x50')];_0x52cad3[_0x8df6('0x51')]=_0x3c830f[_0x8df6('0x51')];_0x52cad3[_0x8df6('0x52')]=_0x3c830f[_0x8df6('0x52')];_0x52cad3[_0x8df6('0x53')]=_0x3c830f['erlangAbandonmentRate'];_0x52cad3[_0x8df6('0x54')]=_0x3c830f[_0x8df6('0x54')];_0x52cad3[_0x8df6('0x55')]=_0x3c830f['startPredictive'];_0x52cad3[_0x8df6('0x56')]=_0x3c830f['startProgressive'];}if(_0x3c830f[_0x8df6('0x57')]){_0x52cad3[_0x8df6('0x57')]={'id':_0x3c830f['Trunk']['id'],'name':_0x3c830f['Trunk'][_0x8df6('0xa')],'active':_0x3c830f[_0x8df6('0x57')][_0x8df6('0x58')],'callerid':_0x3c830f[_0x8df6('0x57')][_0x8df6('0x59')]};}if(_0x3c830f['Interval']){_0x52cad3[_0x8df6('0x5a')]={'id':_0x3c830f[_0x8df6('0x5a')]['id'],'name':_0x3c830f[_0x8df6('0x5a')][_0x8df6('0xa')]};}_0x3a977c[_0x8df6('0x5b')](_0x52cad3);}}_0xcf46cc({'count':_0x3a977c[_0x8df6('0x5c')],'rows':_0x3a977c});});},'VoiceChannels':function(_0x52d7a7){return new Promise(function(_0x40c270,_0x50d7bc){var _0x3a3832=_[_0x8df6('0x5d')](_0xb51cb6[_0x8df6('0x5e')]);_0x40c270({'count':_0x3a3832[_0x8df6('0x5c')],'rows':_0x3a3832});});},'VoiceChannelMixMonitor':function(_0x24d52c){var _0x2aadea=this;return new Promise(function(_0x43b221,_0xed5433){if(ami[_0x8df6('0x12')]()==![]){return _0xed5433(_0x2aadea[_0x8df6('0x13')](0x1f4,[config[_0x8df6('0x14')]['ip'],config[_0x8df6('0x14')][_0x8df6('0x15')],_0x8df6('0x16')]['join']('\x20')));}var _0x478a63=schema(properties[_0x8df6('0x5f')])['validate'](_0x24d52c);if(_0x478a63[_0x8df6('0x5c')]>0x0){return _0xed5433(_0x2aadea[_0x8df6('0x13')](0x1f4,_[_0x8df6('0x60')](_0x478a63,_0x8df6('0x1c'))[_0x8df6('0x17')](',\x20')));}var _0x439dcb=_['find'](_0xb51cb6[_0x8df6('0x5e')],{'uniqueid':_0x24d52c[_0x8df6('0x61')]});if(_0x439dcb&&_0x439dcb[_0x8df6('0x62')]){var _0x15ac6e=util[_0x8df6('0x9')]('%s.%s',_0x24d52c[_0x8df6('0x63')]||_0x24d52c[_0x8df6('0x61')],_0x24d52c['format']||_0x8df6('0x64'));return ami[_0x8df6('0x1a')]({'action':_0x8df6('0x65'),'channel':_0x439dcb[_0x8df6('0x62')],'file':_0x15ac6e,'options':_0x8df6('0x66')})[_0x8df6('0x1b')](function(_0x2f6951){var _0x2b5cb1=_['find'](_0x439dcb[_0x8df6('0x67')],{'filename':_0x8df6('0x68')+_0x15ac6e[_0x8df6('0x69')]()});if(_['isNil'](_0x2b5cb1)){_0x439dcb[_0x8df6('0x67')][_0x8df6('0x5b')]({'filename':_0x8df6('0x68')+_0x15ac6e[_0x8df6('0x69')](),'createdAt':moment()[_0x8df6('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x2f6951['mixmonitorid'],'status':_0x8df6('0x6a')});}else{_0x2b5cb1[_0x8df6('0x6b')]=_0x2f6951[_0x8df6('0x6b')];_0x2b5cb1[_0x8df6('0x6c')]=_0x8df6('0x6a');}_0x43b221({'code':0xc8,'message':[_0x24d52c[_0x8df6('0x61')],_0x8df6('0x6d'),_0x2f6951[_0x8df6('0x6b')]][_0x8df6('0x17')]('\x20'),'mixmonitorid':_0x2f6951[_0x8df6('0x6b')]});})['catch'](function(_0xf45d30){_0xed5433(_0x2aadea[_0x8df6('0x13')](0x1f5,[_0x24d52c['uniqueid'],_0xf45d30['message'][_0x8df6('0x69')]()]['join']('\x20')));});}else{return _0xed5433(_0x2aadea['error'](0x1f5,_0x8df6('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x506b32){var _0x3c7c85=this;return new Promise(function(_0x4b195e,_0x318c04){if(ami[_0x8df6('0x12')]()==![]){return _0x318c04(_0x3c7c85[_0x8df6('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x8df6('0x14')]['username'],_0x8df6('0x16')][_0x8df6('0x17')]('\x20')));}var _0x5d01e0=schema(properties[_0x8df6('0x5f')])['validate'](_0x506b32);if(_0x5d01e0[_0x8df6('0x5c')]>0x0){return _0x318c04(_0x3c7c85[_0x8df6('0x13')](0x1f4,_['map'](_0x5d01e0,_0x8df6('0x1c'))[_0x8df6('0x17')](',\x20')));}var _0x572f44=_[_0x8df6('0x6f')](_0xb51cb6[_0x8df6('0x5e')],{'uniqueid':_0x506b32[_0x8df6('0x61')]});if(_0x572f44){return BPromise['resolve']()['then'](function(){if(_0x572f44[_0x8df6('0x62')]){return ami[_0x8df6('0x1a')]({'action':_0x8df6('0x70'),'channel':_0x572f44[_0x8df6('0x62')],'mixmonitorid':_0x506b32['mixmonitorid']})[_0x8df6('0x21')](function(_0x4b583e){});}})[_0x8df6('0x1b')](function(){if(_0x572f44['destinationchannel']){return ami[_0x8df6('0x1a')]({'action':_0x8df6('0x70'),'channel':_0x572f44[_0x8df6('0x71')],'mixmonitorid':_0x506b32['mixmonitorid']})[_0x8df6('0x21')](function(_0x440a9c){});}})[_0x8df6('0x1b')](function(_0x9dae77){var _0x114514=_[_0x8df6('0x6f')](_0x572f44[_0x8df6('0x67')],{'mixmonitorid':_0x506b32[_0x8df6('0x6b')]});if(_0x114514){_0x114514[_0x8df6('0x6c')]=_0x8df6('0x72');}})[_0x8df6('0x1b')](function(){var _0x3dd0cb=util['format'](_0x8df6('0x73'),_0x506b32[_0x8df6('0x63')]||_0x506b32[_0x8df6('0x61')],_0x506b32[_0x8df6('0x9')]||'wav');var _0x3a6108=_[_0x8df6('0x6f')](_0x572f44[_0x8df6('0x67')],{'filename':'/var/spool/asterisk/monitor/'+_0x3dd0cb[_0x8df6('0x69')]()});if(_0x3a6108){_0x3a6108[_0x8df6('0x6c')]=_0x8df6('0x72');}})[_0x8df6('0x1b')](function(){_0x4b195e({'code':0xc8,'message':[_0x506b32[_0x8df6('0x61')],_0x8df6('0x74')]['join']('\x20')});})[_0x8df6('0x21')](function(_0x594bd6){_0x318c04(_0x3c7c85[_0x8df6('0x13')](0x1f5,[_0x506b32[_0x8df6('0x61')],_0x594bd6[_0x8df6('0x1c')][_0x8df6('0x69')]()]['join']('\x20')));});}else{return _0x318c04(_0x3c7c85['error'](0x1f5,_0x8df6('0x6e')));}});},'VoiceQueuesChannels':function(_0x1fbf5b){return new Promise(function(_0x28bb09,_0x885e86){var _0x12382e=_[_0x8df6('0x5d')](_0xb51cb6[_0x8df6('0x75')]);_0x28bb09({'count':_0x12382e[_0x8df6('0x5c')],'rows':_0x12382e});});},'VoiceQueuesChannel':function(_0x1223dc){var _0x5a5610=this;return new Promise(function(_0x543cf0,_0x10093c){var _0x3e20ae=schema(properties[_0x8df6('0x76')])[_0x8df6('0x2')](_0x1223dc);if(_0x3e20ae[_0x8df6('0x5c')]>0x0){return _0x10093c(_0x5a5610[_0x8df6('0x13')](0x1f4,_[_0x8df6('0x60')](_0x3e20ae,_0x8df6('0x1c'))['join'](',\x20')));}var _0xce7880=_[_0x8df6('0x6f')](_0xb51cb6['queueChannels'],{'uniqueid':_0x1223dc['uniqueid']});if(_0xce7880){_0x543cf0(_0xce7880);}else{return _0x10093c(_0x5a5610['error'](0x1f5,_0x8df6('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x4bab1c){var _0x50ac9e=this;return new Promise(function(_0x479aa0,_0x6f4c74){if(ami['isConnected']()==![]){return _0x6f4c74(_0x50ac9e[_0x8df6('0x13')](0x1f4,[config[_0x8df6('0x14')]['ip'],config[_0x8df6('0x14')][_0x8df6('0x15')],_0x8df6('0x16')]['join']('\x20')));}var _0x4980be=schema(properties[_0x8df6('0x77')])[_0x8df6('0x2')](_0x4bab1c);if(_0x4980be[_0x8df6('0x5c')]>0x0){return _0x6f4c74(_0x50ac9e['error'](0x1f4,_['map'](_0x4980be,'message')[_0x8df6('0x17')](',\x20')));}var _0x9ade81=_[_0x8df6('0x6f')](_0xb51cb6['queueChannels'],{'uniqueid':_0x4bab1c['uniqueid']});if(_0x9ade81&&_0x9ade81[_0x8df6('0x62')]){return ami[_0x8df6('0x1a')]({'action':_0x8df6('0x78'),'channel':_0x9ade81[_0x8df6('0x62')]})[_0x8df6('0x1b')](function(_0x2a464e){_0x479aa0({'code':0xc8,'message':[_0x4bab1c[_0x8df6('0x61')],_0x2a464e[_0x8df6('0x1c')][_0x8df6('0x69')]()][_0x8df6('0x17')]('\x20')});})[_0x8df6('0x21')](function(_0x57c7e5){_0x6f4c74(_0x50ac9e[_0x8df6('0x13')](0x1f5,[_0x4bab1c[_0x8df6('0x61')],_0x57c7e5[_0x8df6('0x1c')]['toLowerCase']()][_0x8df6('0x17')]('\x20')));});}else{return _0x6f4c74(_0x50ac9e[_0x8df6('0x13')](0x1f5,_0x8df6('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x1e1220){var _0x5b1197=this;return new Promise(function(_0x8183a5,_0x54c9fe){if(ami[_0x8df6('0x12')]()==![]){return _0x54c9fe(_0x5b1197[_0x8df6('0x13')](0x1f4,[config[_0x8df6('0x14')]['ip'],config[_0x8df6('0x14')][_0x8df6('0x15')],'ami\x20disconnected'][_0x8df6('0x17')]('\x20')));}var _0x1a9349=schema(properties[_0x8df6('0x79')])[_0x8df6('0x2')](_0x1e1220);if(_0x1a9349['length']>0x0){return _0x54c9fe(_0x5b1197[_0x8df6('0x13')](0x1f4,_[_0x8df6('0x60')](_0x1a9349,'message')[_0x8df6('0x17')](',\x20')));}var _0x42def7=_[_0x8df6('0x6f')](_0xb51cb6[_0x8df6('0x75')],{'uniqueid':_0x1e1220[_0x8df6('0x61')]});if(_0x42def7&&_0x42def7[_0x8df6('0x62')]){return ami[_0x8df6('0x1a')]({'action':'Redirect','channel':_0x42def7[_0x8df6('0x62')],'exten':_0x1e1220['exten'],'context':_0x1e1220[_0x8df6('0x7a')]||_0x42def7['context'],'priority':0x1})[_0x8df6('0x1b')](function(_0x7bc00){_0x8183a5({'code':0xc8,'message':[_0x1e1220[_0x8df6('0x61')],_0x7bc00[_0x8df6('0x1c')][_0x8df6('0x69')]()]['join']('\x20')});})[_0x8df6('0x21')](function(_0x30ce49){_0x54c9fe(_0x5b1197[_0x8df6('0x13')](0x1f5,[_0x1e1220[_0x8df6('0x61')],_0x30ce49[_0x8df6('0x1c')]['toLowerCase']()][_0x8df6('0x17')]('\x20')));});}else{return _0x54c9fe(_0x5b1197[_0x8df6('0x13')](0x1f5,_0x8df6('0x6e')));}});},'Agents':function(_0x5a5ec4){return new Promise(function(_0x557db3,_0x4e7a89){var _0xe466ad=_['values'](_0xb51cb6[_0x8df6('0xe')]);_0x557db3({'count':_0xe466ad[_0x8df6('0x5c')],'rows':_0xe466ad});});},'Telephones':function(_0x9962bf){return new Promise(function(_0x227249,_0x25ba52){var _0x5b53e1=_['values'](_0xb51cb6[_0x8df6('0x7b')]);_0x227249({'count':_0x5b53e1[_0x8df6('0x5c')],'rows':_0x5b53e1});});},'Trunks':function(_0x251e46){return new Promise(function(_0x35554a,_0x4edcf6){var _0x138984=_['values'](_0xb51cb6[_0x8df6('0x7c')]);_0x35554a({'count':_0x138984[_0x8df6('0x5c')],'rows':_0x138984});});},'OutboundChannels':function(_0x455366){return new Promise(function(_0x176a04,_0x2f2b64){var _0x27c96f=_['values'](_0xb51cb6[_0x8df6('0x7d')]);_0x176a04({'count':_0x27c96f['length'],'rows':_0x27c96f});});},'Outbound':function(_0x25c68d){return new Promise(function(_0x1d2de6,_0x532ac5){_0x1d2de6(_0xb51cb6[_0x8df6('0x31')]);});},'Campaigns':function(_0x597b9d){return new Promise(function(_0x34cccf,_0x79b6c1){var _0x1912fb=_[_0x8df6('0x5d')](_0xb51cb6['campaigns']);_0x34cccf({'count':_0x1912fb['length'],'rows':_0x1912fb});});},'VoiceQueuesPreview':function(_0xa1a2e2){var _0x26bd20=this;return new Promise(function(_0x5a8afa,_0x40be35){_0x342ac1['run'](_0xa1a2e2['id'])[_0x8df6('0x1b')](function(_0x2b851a){_0x5a8afa({'code':0xc8,'message':_0x2b851a['message']});})[_0x8df6('0x21')](function(_0x345fc9){_0x40be35(_0x26bd20['error'](0x1f4,_0x345fc9[_0x8df6('0x1c')]));});});},'EventManager':function(_0x514d27){var _0x4037f5=this;return new Promise(function(_0x4c167d,_0x4f5ea6){if(!_0x514d27[_0x8df6('0x7e')]){return _0x4f5ea6(_0x4037f5[_0x8df6('0x13')](0x1f4,_0x8df6('0x7f')));}ami['emit'](_0x8df6('0x80')+_0x514d27[_0x8df6('0x7e')],_0x514d27[_0x8df6('0x1c')]);_0x4c167d({'code':0xc8,'message':_0x514d27});});},'FaxAccounts':function(_0x5a1db4){return new Promise(function(_0x32b4af,_0x1caf2e){var _0x4f2fb5=_[_0x8df6('0x5d')](_0xb51cb6['faxAccounts']);_0x32b4af({'count':_0x4f2fb5[_0x8df6('0x5c')],'rows':_0x4f2fb5});});},'SendFax':function(_0x1e6725){var _0x15a155=this;return new Promise(function(_0xedda60,_0x588e0d){_0x5ebb04[_0x8df6('0x81')](_0x1e6725)[_0x8df6('0x1b')](function(_0x265a44){_0xedda60({'code':0xc8,'message':_0x265a44['message']});})['catch'](function(_0x399920){_0x588e0d(_0x15a155['error'](0x1f4,_0x399920[_0x8df6('0x1c')]));});});},'CheckAfterSend':function(_0x44fd88){var _0x20f092=this;return new Promise(function(_0x2244d6,_0x7bcd7e){_0x5ebb04[_0x8df6('0x82')](_0x44fd88)[_0x8df6('0x1b')](function(_0x421ddb){_0x2244d6({'code':0xc8,'message':_0x421ddb[_0x8df6('0x1c')]});})[_0x8df6('0x21')](function(_0x4476b8){_0x7bcd7e(_0x20f092[_0x8df6('0x13')](0x1f4,_0x4476b8['message']));});});}};var _0x4b0d8c=jayson['server'](_0xadf577)['http']();_0x4b0d8c['on'](_0x8df6('0x13'),function(_0x4d4b25){return _0x51a7ab(_0x4d4b25);});_0x4b0d8c['listen'](0x232a,_0x8df6('0x83'),function(){console[_0x8df6('0x84')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x14b4b2(_0x8df6('0x85')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index cc55639..602564d 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 _0xd448=['format','name','trigger:%s','action','merge','createContact','catch','error','Error\x20creating\x20contact','toLowerCase','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','stringify','exec','autoCreate','data2','data1','calleridnum','isNil','routeId','calleridname','','firstName','destcalleridname','uniqueid','phone','destcalleridnum','resolve','then','omit','xmd-contactid2'];(function(_0x5e579b,_0x12823c){var _0x5abdef=function(_0x45b2c5){while(--_0x45b2c5){_0x5e579b['push'](_0x5e579b['shift']());}};_0x5abdef(++_0x12823c);}(_0xd448,0x172));var _0x8d44=function(_0x99dea6,_0x5a6e55){_0x99dea6=_0x99dea6-0x0;var _0x5cd47a=_0xd448[_0x99dea6];return _0x5cd47a;};'use strict';var BPromise=require('bluebird');var util=require(_0x8d44('0x0'));var _=require(_0x8d44('0x1'));var Redis=require(_0x8d44('0x2'));var config=require(_0x8d44('0x3'));var logger=require(_0x8d44('0x4'))(_0x8d44('0x5'));var cmContactRpc=require(_0x8d44('0x6'));config[_0x8d44('0x7')]=_[_0x8d44('0x8')](config[_0x8d44('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x8d44('0x9'))(new Redis(config['redis']));function emit(_0x56539b,_0x3b352e,_0x2cdb53){logger[_0x8d44('0xa')](_0x56539b,_0x3b352e,JSON[_0x8d44('0xb')](_0x2cdb53));io['to'](_0x56539b)['emit'](_0x3b352e,_0x2cdb53);}exports[_0x8d44('0xc')]=function(_0x2a5da6,_0x52f047,_0x506c89){_0x506c89[_0x8d44('0xd')]=0x0;if(_0x52f047[_0x8d44('0xe')]&&parseInt(_0x52f047[_0x8d44('0xe')],0xa)){var _0x58d501={'ListId':parseInt(_0x52f047[_0x8d44('0xf')],0xa),'phone':_0x506c89[_0x8d44('0x10')]};if(_[_0x8d44('0x11')](_0x506c89[_0x8d44('0x12')])){_0x58d501['firstName']=_0x506c89[_0x8d44('0x13')]&&_0x506c89[_0x8d44('0x13')]!==_0x8d44('0x14')?_0x506c89[_0x8d44('0x13')]:_0x506c89[_0x8d44('0x10')]||_0x506c89['uniqueid'];}else{_0x58d501[_0x8d44('0x15')]=_0x506c89[_0x8d44('0x16')]&&_0x506c89[_0x8d44('0x16')]!==_0x8d44('0x14')?_0x506c89[_0x8d44('0x16')]:_0x506c89['destcalleridnum']||_0x506c89[_0x8d44('0x17')];_0x58d501[_0x8d44('0x18')]=_0x506c89[_0x8d44('0x16')]&&_0x506c89[_0x8d44('0x16')]!==_0x8d44('0x14')?_0x506c89[_0x8d44('0x16')]:_0x506c89[_0x8d44('0x19')]||_0x506c89[_0x8d44('0x17')];}BPromise[_0x8d44('0x1a')]()[_0x8d44('0x1b')](cmContactRpc['showContact']({'where':_[_0x8d44('0x1c')](_0x58d501,[_0x8d44('0x15')])}))['then'](function(_0x4499f6){if(_0x4499f6){_0x506c89[_0x8d44('0x1d')]=_0x4499f6['id'];emit(util[_0x8d44('0x1e')]('user:%s',_0x2a5da6[_0x8d44('0x1f')]),util[_0x8d44('0x1e')](_0x8d44('0x20'),_0x52f047[_0x8d44('0x21')]['toLowerCase']()),_[_0x8d44('0x22')](_0x506c89,{'ListId':parseInt(_0x52f047[_0x8d44('0xf')],0xa)}));return;}else{return BPromise[_0x8d44('0x1a')]()['then'](cmContactRpc[_0x8d44('0x23')](_0x58d501));}})[_0x8d44('0x1b')](function(_0x3d5215){if(_0x3d5215){_0x506c89[_0x8d44('0x1d')]=_0x3d5215['id'];emit(util[_0x8d44('0x1e')]('user:%s',_0x2a5da6[_0x8d44('0x1f')]),util[_0x8d44('0x1e')](_0x8d44('0x20'),_0x52f047['action']['toLowerCase']()),_[_0x8d44('0x22')](_0x506c89,{'ListId':parseInt(_0x52f047[_0x8d44('0xf')],0xa)}));}})[_0x8d44('0x24')](function(_0x22a9a7){logger[_0x8d44('0x25')](_0x8d44('0x26'),JSON[_0x8d44('0xb')](_0x22a9a7));});}else{if(_0x2a5da6){emit(util['format']('user:%s',_0x2a5da6[_0x8d44('0x1f')]),util[_0x8d44('0x1e')](_0x8d44('0x20'),_0x52f047[_0x8d44('0x21')][_0x8d44('0x27')]()),_[_0x8d44('0x22')]({'ListId':parseInt(_0x52f047[_0x8d44('0xf')],0xa)},_0x506c89));}}}; \ No newline at end of file +var _0xf8f2=['then','toLowerCase','error','Error\x20creating\x20contact','bluebird','util','lodash','ioredis','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','exec','data2','data1','calleridnum','isNil','routeId','calleridname','uniqueid','destcalleridname','','destcalleridnum','resolve','omit','xmd-contactid2','format','user:%s','name','trigger:%s','action','merge','createContact'];(function(_0x62f3a9,_0x32bd85){var _0x20f67a=function(_0x6fe251){while(--_0x6fe251){_0x62f3a9['push'](_0x62f3a9['shift']());}};_0x20f67a(++_0x32bd85);}(_0xf8f2,0xc2));var _0x2f8f=function(_0x38184d,_0x1e184b){_0x38184d=_0x38184d-0x0;var _0x218841=_0xf8f2[_0x38184d];return _0x218841;};'use strict';var BPromise=require(_0x2f8f('0x0'));var util=require(_0x2f8f('0x1'));var _=require(_0x2f8f('0x2'));var Redis=require(_0x2f8f('0x3'));var config=require('../../../../config/environment');var logger=require(_0x2f8f('0x4'))(_0x2f8f('0x5'));var cmContactRpc=require(_0x2f8f('0x6'));config[_0x2f8f('0x7')]=_[_0x2f8f('0x8')](config['redis'],{'host':_0x2f8f('0x9'),'port':0x18eb});var io=require(_0x2f8f('0xa'))(new Redis(config[_0x2f8f('0x7')]));function emit(_0x107748,_0x590ff4,_0xb4473){logger[_0x2f8f('0xb')](_0x107748,_0x590ff4,JSON[_0x2f8f('0xc')](_0xb4473));io['to'](_0x107748)['emit'](_0x590ff4,_0xb4473);}exports[_0x2f8f('0xd')]=function(_0x1ce821,_0xcac931,_0x3d7e3d){_0x3d7e3d['autoCreate']=0x0;if(_0xcac931[_0x2f8f('0xe')]&&parseInt(_0xcac931[_0x2f8f('0xe')],0xa)){var _0x5931ec={'ListId':parseInt(_0xcac931[_0x2f8f('0xf')],0xa),'phone':_0x3d7e3d[_0x2f8f('0x10')]};if(_[_0x2f8f('0x11')](_0x3d7e3d[_0x2f8f('0x12')])){_0x5931ec['firstName']=_0x3d7e3d[_0x2f8f('0x13')]&&_0x3d7e3d[_0x2f8f('0x13')]!==''?_0x3d7e3d['calleridname']:_0x3d7e3d[_0x2f8f('0x10')]||_0x3d7e3d[_0x2f8f('0x14')];}else{_0x5931ec['firstName']=_0x3d7e3d[_0x2f8f('0x15')]&&_0x3d7e3d[_0x2f8f('0x15')]!==_0x2f8f('0x16')?_0x3d7e3d[_0x2f8f('0x15')]:_0x3d7e3d[_0x2f8f('0x17')]||_0x3d7e3d['uniqueid'];_0x5931ec['phone']=_0x3d7e3d['destcalleridname']&&_0x3d7e3d['destcalleridname']!==_0x2f8f('0x16')?_0x3d7e3d[_0x2f8f('0x15')]:_0x3d7e3d[_0x2f8f('0x17')]||_0x3d7e3d[_0x2f8f('0x14')];}BPromise[_0x2f8f('0x18')]()['then'](cmContactRpc['showContact']({'where':_[_0x2f8f('0x19')](_0x5931ec,['firstName'])}))['then'](function(_0x114eb1){if(_0x114eb1){_0x3d7e3d[_0x2f8f('0x1a')]=_0x114eb1['id'];emit(util[_0x2f8f('0x1b')](_0x2f8f('0x1c'),_0x1ce821[_0x2f8f('0x1d')]),util[_0x2f8f('0x1b')](_0x2f8f('0x1e'),_0xcac931[_0x2f8f('0x1f')]['toLowerCase']()),_[_0x2f8f('0x20')](_0x3d7e3d,{'ListId':parseInt(_0xcac931[_0x2f8f('0xf')],0xa)}));return;}else{return BPromise['resolve']()['then'](cmContactRpc[_0x2f8f('0x21')](_0x5931ec));}})[_0x2f8f('0x22')](function(_0x17c862){if(_0x17c862){_0x3d7e3d[_0x2f8f('0x1a')]=_0x17c862['id'];emit(util[_0x2f8f('0x1b')](_0x2f8f('0x1c'),_0x1ce821[_0x2f8f('0x1d')]),util[_0x2f8f('0x1b')](_0x2f8f('0x1e'),_0xcac931[_0x2f8f('0x1f')][_0x2f8f('0x23')]()),_[_0x2f8f('0x20')](_0x3d7e3d,{'ListId':parseInt(_0xcac931[_0x2f8f('0xf')],0xa)}));}})['catch'](function(_0x38a16a){logger[_0x2f8f('0x24')](_0x2f8f('0x25'),JSON[_0x2f8f('0xc')](_0x38a16a));});}else{if(_0x1ce821){emit(util[_0x2f8f('0x1b')]('user:%s',_0x1ce821[_0x2f8f('0x1d')]),util[_0x2f8f('0x1b')]('trigger:%s',_0xcac931['action']['toLowerCase']()),_[_0x2f8f('0x20')]({'ListId':parseInt(_0xcac931['data1'],0xa)},_0x3d7e3d));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index e5c61a3..0be22f1 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 _0x1020=['sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentcomplete','custom:queuecallerabandon','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage','emit','info','stringify','checkTriggers','prototype','agents','interface','status','checkTrigger','merge','Actions','action','browser','data1','popup','html','data2','uri','buildUri','data3','data4','location','uriLocation','windowWidth','isNil','data5','800','windowHeight','data6','600','winApplication','render','winArguments','format','user:%s','name','toLowerCase','trigger:%s','contactmanager','exec','integration','routeId','urlforward','query','search','replace','AllConditions','length','every','checkConditions','channel','AnyConditions','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','queue','agent','membername','lastevent','lodash','url','ioredis','./urlforward','./integration','./cmContact','./script','../rpc/cmContact','../../../config/environment','../../../config/logger','trigger','redis','defaults','winapp','triggers','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts'];(function(_0x49155d,_0x2bb881){var _0x4c5f0f=function(_0x290321){while(--_0x290321){_0x49155d['push'](_0x49155d['shift']());}};_0x4c5f0f(++_0x2bb881);}(_0x1020,0x129));var _0x0102=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0x1020[_0x49d19d];return _0x4ebef1;};'use strict';var util=require('util');var _=require(_0x0102('0x0'));var url=require(_0x0102('0x1'));var Mustache=require('mustache');var Redis=require(_0x0102('0x2'));var urlforward=require(_0x0102('0x3'));var integration=require(_0x0102('0x4'));var cmContact=require(_0x0102('0x5'));var script=require(_0x0102('0x6'));var cmContactRpc=require(_0x0102('0x7'));var config=require(_0x0102('0x8'));var logger=require(_0x0102('0x9'))(_0x0102('0xa'));var ami=require('../ami');config[_0x0102('0xb')]=_[_0x0102('0xc')](config[_0x0102('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0102('0xb')]));var operators={'equals':function(_0x3d5f0a,_0xa84c23){return _0x3d5f0a==_0xa84c23;},'not_equals':function(_0xee13c1,_0x4cfb96){return _0xee13c1!=_0x4cfb96;}};var barAndWebActions=['popup','url',_0x0102('0xd')];function Trigger(_0x4edea2){this[_0x0102('0xe')]=_0x4edea2[_0x0102('0xe')];this['agents']=_0x4edea2['agents'];this[_0x0102('0xf')]=_0x4edea2['voiceQueues'];this[_0x0102('0x10')]=_0x4edea2['templates'];this[_0x0102('0x11')]=_0x4edea2['voiceExtensions'];this[_0x0102('0x12')]=_0x4edea2[_0x0102('0x12')];this[_0x0102('0x13')]=_0x4edea2['freshdeskAccounts'];this['salesforceAccounts']=_0x4edea2[_0x0102('0x14')];this[_0x0102('0x15')]=_0x4edea2['sugarcrmAccounts'];this[_0x0102('0x16')]=_0x4edea2['zohoAccounts'];this[_0x0102('0x17')]=_0x4edea2[_0x0102('0x17')];this[_0x0102('0x18')]=_0x4edea2[_0x0102('0x18')];this['servicenowAccounts']=_0x4edea2['servicenowAccounts'];this[_0x0102('0x19')]=_0x4edea2[_0x0102('0x19')];this[_0x0102('0x1a')]=_0x4edea2['freshsalesAccounts'];this[_0x0102('0x1b')]={'zendesk':this[_0x0102('0x12')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x0102('0x13')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x0102('0x16')],'desk':this[_0x0102('0x17')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x0102('0x19')],'freshsales':this['freshsalesAccounts'],'servicenow':this['servicenowAccounts']};ami['on'](_0x0102('0x1c'),this[_0x0102('0x1d')]['bind'](this));ami['on']('custom:agentconnect',this['syncCustomEvent'][_0x0102('0x1e')](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent'][_0x0102('0x1e')](this));ami['on'](_0x0102('0x1f'),this['syncCustomEvent'][_0x0102('0x1e')](this));ami['on'](_0x0102('0x20'),this[_0x0102('0x1d')]['bind'](this));ami['on'](_0x0102('0x21'),this['syncAgentDial'][_0x0102('0x1e')](this));ami['on'](_0x0102('0x22'),this[_0x0102('0x23')][_0x0102('0x1e')](this));ami['on']('custom:dialend',this[_0x0102('0x23')][_0x0102('0x1e')](this));ami['on'](_0x0102('0x24'),this[_0x0102('0x1d')][_0x0102('0x1e')](this));ami['on']('custom:closedinteraction',this[_0x0102('0x1d')][_0x0102('0x1e')](this));ami['on'](_0x0102('0x25'),this[_0x0102('0x1d')][_0x0102('0x1e')](this));ami['on'](_0x0102('0x26'),this['syncCustomEvent']['bind'](this));ami['on']('custom:acceptmessage',this['syncCustomEvent'][_0x0102('0x1e')](this));ami['on']('custom:rejectmessage',this['syncCustomEvent'][_0x0102('0x1e')](this));}Trigger['prototype'][_0x0102('0x27')]=function(_0x447f6b,_0x14ca51,_0x36b9be){logger[_0x0102('0x28')](_0x447f6b,_0x14ca51,JSON[_0x0102('0x29')](_0x36b9be));io['to'](_0x447f6b)[_0x0102('0x27')](_0x14ca51,_0x36b9be);};Trigger['prototype'][_0x0102('0x1d')]=function(_0x2c2f96){var _0x4df39f=_['clone'](_0x2c2f96);this[_0x0102('0x2a')](_0x4df39f);};Trigger[_0x0102('0x2b')][_0x0102('0x23')]=function(_0x1cfcbe){if(this[_0x0102('0x2c')][_0x1cfcbe[_0x0102('0x2d')]]){this[_0x0102('0x1d')](_0x1cfcbe);}};Trigger[_0x0102('0x2b')]['checkTriggers']=function(_0x33f765){var _0x3411c5;for(var _0x2d5486 in this[_0x0102('0xe')]){if(this[_0x0102('0xe')]['hasOwnProperty'](_0x2d5486)){if(this[_0x0102('0xe')][_0x2d5486][_0x0102('0x2e')]){_0x3411c5=this[_0x0102('0x2f')](this[_0x0102('0xe')][_0x2d5486],_0x33f765);if(_0x3411c5){_[_0x0102('0x30')](_0x33f765,_0x33f765['variables']);for(var _0x38dc94=0x0,_0xfdb6c2,_0x4b2ad7,_0xff5dd2;_0x38dc940x0){_0x3ab339=_[_0x228f('0x2e')](_0x160f68,_0x2a7842);}return _0x3ab339;}function getCustomFields(_0x2eaf4f,_0x2511e5){var _0xe67c83=[];var _0x2f13d9={'custom_fields':{}};if(_0x2eaf4f[_0x228f('0x2d')]>0x0){_[_0x228f('0x2f')](_0x2eaf4f,function(_0xc25917){if(_0xc25917[_0x228f('0x30')]===_0x228f('0x31')&&_0xc25917['nameField']&&!_0xc25917[_0x228f('0x32')]){_0x2f13d9[_0xc25917[_0x228f('0x33')][_0x228f('0x34')]()]=_0xc25917['content'][_0x228f('0x26')]();}else if(_0xc25917[_0x228f('0x30')]==='string'&&_0xc25917[_0x228f('0x35')]&&_0xc25917[_0x228f('0x32')]){_0x2f13d9[_0x228f('0x36')][_0xc25917[_0x228f('0x35')]]=_0xc25917['content'][_0x228f('0x26')]();}else if(_0xc25917['type']===_0x228f('0x37')&&_0xc25917[_0x228f('0x38')]&&_0xc25917[_0x228f('0x35')]&&_0xc25917[_0x228f('0x32')]){_0x2511e5[_0xc25917['variableName']]&&(_0x2f13d9[_0x228f('0x36')][_0xc25917[_0x228f('0x35')]]=_0x2511e5[_0xc25917['variableName']]['toString']());}else if(_0xc25917['type']===_0x228f('0x39')&&_0xc25917[_0x228f('0x3a')]&&_0xc25917[_0x228f('0x3a')][_0x228f('0x3b')]&&_0xc25917[_0x228f('0x35')]&&_0xc25917[_0x228f('0x32')]){_0x2511e5[_0xc25917[_0x228f('0x3a')][_0x228f('0x3b')][_0x228f('0x34')]()]&&(_0x2f13d9['custom_fields'][_0xc25917['idField']]=_0x2511e5[_0xc25917[_0x228f('0x3a')][_0x228f('0x3b')][_0x228f('0x34')]()][_0x228f('0x26')]());}});}if(_0x2f13d9[_0x228f('0x3c')]){_0x2f13d9[_0x228f('0x3c')]=Number(_0x2f13d9[_0x228f('0x3c')]);}return _0x2f13d9;}function getTicket(_0x40968b,_0x1a74cf,_0x4015da,_0x5505f3,_0x5800d3){logger[_0x228f('0x17')](_0x228f('0x3d'));var _0x161ea7=_[_0x228f('0x3e')]({'subject':intUtil['getString'](_0x5505f3[_0x228f('0x3f')],_0x5800d3,'\x20'),'type':_0x228f('0x40'),'status':'new','labels':['xCALLY',_0x228f('0x41'),_0x228f('0x42')]['concat'](getTags(_0x5505f3[_0x228f('0x43')],_0x228f('0x3b'))),'description':intUtil['getString'](_0x5505f3['Descriptions'],_0x5800d3,'\x0a'),'_links':{'assigned_user':{'href':util[_0x228f('0xf')]('/api/v2/users/%d',_0x1a74cf['id']),'class':_0x228f('0x44')}},'message':{'direction':'in','body':intUtil[_0x228f('0x45')](_0x5505f3[_0x228f('0x46')],_0x5800d3,'\x0a')}},getCustomFields(_0x5505f3[_0x228f('0x47')],_0x5800d3));return request({'uri':util[_0x228f('0xf')](_0x228f('0x48'),_0x40968b['remoteUri'],_0x4015da['id']),'method':_0x228f('0x49'),'body':_0x161ea7});}exports['queue']=function(_0x8355be,_0xc59d9b,_0x285af1,_0x96126c,_0x41cba5,_0x37ed2d){var _0x24eba4,_0x332694;_0x37ed2d[_0x228f('0x11')]=intUtil[_0x228f('0x4a')](_0x37ed2d[_0x228f('0x11')]);_0x37ed2d[_0x228f('0x4b')]=intUtil[_0x228f('0x4a')](_0x37ed2d['serverUrl']);if(_0x41cba5&&_0x41cba5['monitor_format']){logger[_0x228f('0x17')](_0x228f('0x4c'),_0x228f('0x4d'));_0xc59d9b[_0x228f('0x4e')]=util[_0x228f('0xf')](_0x228f('0x4f'),_0x37ed2d[_0x228f('0x4b')],_0xc59d9b[_0x228f('0x50')],md5(_0xc59d9b[_0x228f('0x50')]));}else{_0xc59d9b[_0x228f('0x4e')]='';}headers['Authorization']=getAuth(_0x37ed2d);return getUser(_0x37ed2d,_0x96126c[_0x228f('0x51')])[_0x228f('0x12')](function(_0x482e57){_0x24eba4=_0x482e57;logger[_0x228f('0x17')]('The\x20User\x20ID\x20is:',_0x24eba4['id']);return getEndUser(_0x37ed2d,_0xc59d9b[_0x228f('0x52')],_0xc59d9b['calleridnum']);})[_0x228f('0x12')](function(_0x4aff0f){_0x332694=_0x4aff0f;logger[_0x228f('0x17')](_0x228f('0x53'),_0x332694['id']);return getTicket(_0x37ed2d,_0x24eba4,_0x332694,_0x285af1,_0xc59d9b);})[_0x228f('0x12')](function(_0xd6804){if(_0xd6804){logger[_0x228f('0x17')](_0x228f('0x54'));logger[_0x228f('0x17')](_0x228f('0x55'),_0xd6804['id']);switch(_0x37ed2d[_0x228f('0x30')]){case _0x228f('0x56'):logger[_0x228f('0x17')](_0x228f('0x4c'),_0x228f('0x57'));emit(util[_0x228f('0xf')](_0x228f('0x58'),_0x96126c[_0x228f('0x3b')]),_0x228f('0x59'),{'recordId':_0xd6804['id']});break;case _0x228f('0x5a'):logger[_0x228f('0x17')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x228f('0xf')](_0x228f('0x58'),_0x96126c[_0x228f('0x3b')]),'trigger:browser:url',{'uri':util[_0x228f('0xf')](_0x228f('0x5b'),_0xd6804['id'])});break;default:logger[_0x228f('0x5c')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x20660a){console[_0x228f('0x5c')](_0x20660a);logger[_0x228f('0x5c')](_0x228f('0x4c'),JSON[_0x228f('0x1e')](_0x20660a));});};exports[_0x228f('0x5d')]=function(_0xafd0e4,_0x30ff69,_0x1dc2ec,_0x339f2d,_0x43bbd2,_0x250993,_0x561152){var _0x176ec9,_0x140ed3;_0x250993[_0x228f('0x11')]=intUtil[_0x228f('0x4a')](_0x250993[_0x228f('0x11')]);_0x250993[_0x228f('0x4b')]=intUtil[_0x228f('0x4a')](_0x250993[_0x228f('0x4b')]);if(_0x561152&&_0x561152['recordingFormat']&&_0x561152[_0x228f('0x5e')]!==_0x228f('0x5f')){logger[_0x228f('0x17')](_0x228f('0x60'),'Recording\x20is\x20enabled!');_0x30ff69[_0x228f('0x4e')]=util[_0x228f('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x250993[_0x228f('0x4b')],_0x30ff69[_0x228f('0x50')],md5(_0x30ff69[_0x228f('0x50')]));}headers[_0x228f('0x61')]=getAuth(_0x250993);return getUser(_0x250993,_0x339f2d[_0x228f('0x51')])[_0x228f('0x12')](function(_0x435a00){_0x176ec9=_0x435a00;logger[_0x228f('0x17')](_0x228f('0x62'),_0x176ec9['id']);return getEndUser(_0x250993,_0x30ff69[_0x228f('0x63')],_0x30ff69['destcalleridnum']);})[_0x228f('0x12')](function(_0x4e2308){_0x140ed3=_0x4e2308;logger[_0x228f('0x17')](_0x228f('0x53'),_0x140ed3['id']);return getTicket(_0x250993,_0x176ec9,_0x140ed3,_0x1dc2ec,_0x30ff69);})[_0x228f('0x12')](function(_0x18e97b){if(_0x18e97b){logger[_0x228f('0x17')](_0x228f('0x54'));logger[_0x228f('0x17')](_0x228f('0x55'),_0x18e97b['id']);switch(_0x250993['type']){case _0x228f('0x56'):logger[_0x228f('0x17')](_0x228f('0x4c'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x228f('0xf')]('user:%s',_0x339f2d[_0x228f('0x3b')]),_0x228f('0x59'),{'recordId':_0x18e97b['id']});break;case'newTab':logger[_0x228f('0x17')](_0x228f('0x4c'),_0x228f('0x64'));emit(util[_0x228f('0xf')](_0x228f('0x58'),_0x339f2d[_0x228f('0x3b')]),_0x228f('0x65'),{'uri':util[_0x228f('0xf')](_0x228f('0x66'),_0x250993[_0x228f('0x11')],_0x18e97b['id'])});break;default:logger[_0x228f('0x5c')]('[OUTBOUND]',_0x228f('0x67'));}}})[_0x228f('0x68')](function(_0x1d4203){logger[_0x228f('0x5c')](_0x228f('0x60'),JSON['stringify'](_0x1d4203));});};exports['abandoned']=function(_0x14a732,_0x50287b,_0x297f00,_0x5a7ff9,_0x425ccf,_0x903a47){var _0x53a6a5,_0x1575c1;_0x903a47[_0x228f('0x11')]=intUtil[_0x228f('0x4a')](_0x903a47[_0x228f('0x11')]);_0x903a47['serverUrl']=intUtil[_0x228f('0x4a')](_0x903a47[_0x228f('0x4b')]);if(_0x425ccf&&_0x425ccf[_0x228f('0x69')]){logger[_0x228f('0x17')](_0x228f('0x6a'),_0x228f('0x4d'));_0x50287b[_0x228f('0x4e')]=util[_0x228f('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x903a47[_0x228f('0x4b')],_0x50287b[_0x228f('0x50')],md5(_0x50287b[_0x228f('0x50')]));}else{_0x50287b[_0x228f('0x4e')]='';}headers[_0x228f('0x61')]=getAuth(_0x903a47);return getUser(_0x903a47)['then'](function(_0x1dbd3c){_0x53a6a5=_0x1dbd3c;logger['info'](_0x228f('0x62'),_0x53a6a5['id']);return getEndUser(_0x903a47,_0x50287b[_0x228f('0x52')],_0x50287b['calleridnum']);})[_0x228f('0x12')](function(_0x11a657){_0x1575c1=_0x11a657;logger[_0x228f('0x17')]('The\x20Enduser\x20ID\x20is:',_0x1575c1['id']);return getTicket(_0x903a47,_0x53a6a5,_0x1575c1,_0x297f00,_0x50287b);})[_0x228f('0x12')](function(_0x2d5d67){if(_0x2d5d67){logger[_0x228f('0x17')](_0x228f('0x54'));logger[_0x228f('0x17')]('The\x20Ticket\x20ID\x20is:',_0x2d5d67['id']);}})[_0x228f('0x68')](function(_0x187f84){logger['error']('[ABANDONED]',JSON[_0x228f('0x1e')](_0x187f84));});}; \ No newline at end of file +var _0x1775=['concat','Descriptions','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','newTab','user:%s','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','abandoned','[ABANDONED]','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','authType','basic','%s:%s','password','token','%s/token:%s','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','POST','work','length','forEach','type','string','customField','nameField','content','idField','variable','variableName','custom_fields','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','xCALLY','Motion'];(function(_0x42044d,_0x94e4ea){var _0x58839c=function(_0x4636cd){while(--_0x4636cd){_0x42044d['push'](_0x42044d['shift']());}};_0x58839c(++_0x94e4ea);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var rp=require(_0x5177('0x0'));var md5=require(_0x5177('0x1'));var util=require(_0x5177('0x2'));var Redis=require(_0x5177('0x3'));var intUtil=require(_0x5177('0x4'));var config=require(_0x5177('0x5'));var logger=require(_0x5177('0x6'))(_0x5177('0x7'));config[_0x5177('0x8')]=_[_0x5177('0x9')](config[_0x5177('0x8')],{'host':_0x5177('0xa'),'port':0x18eb});var io=require(_0x5177('0xb'))(new Redis(config[_0x5177('0x8')]));function emit(_0x300b43,_0x245c12,_0x363611){io['to'](_0x300b43)[_0x5177('0xc')](_0x245c12,_0x363611);}var headers={'Content-Type':_0x5177('0xd'),'Accept':_0x5177('0xd')};function getUser(_0x2c23d8,_0x206035){if(intUtil['validateEmail'](_0x206035)===!![]){logger['info'](_0x5177('0xe'),_0x206035);return request({'uri':util[_0x5177('0xf')](_0x5177('0x10'),_0x2c23d8[_0x5177('0x11')])})[_0x5177('0x12')](function(_0x49704c){if(_0x49704c[_0x5177('0x13')]){return _[_0x5177('0x14')](_0x49704c[_0x5177('0x15')][_0x5177('0x16')],{'email':_0x206035});}})[_0x5177('0x12')](function(_0x299eba){if(_0x299eba){logger[_0x5177('0x17')](_0x5177('0x18'));return _0x299eba;}else{logger[_0x5177('0x17')](_0x5177('0x19'));return request({'uri':util[_0x5177('0xf')](_0x5177('0x1a'),_0x2c23d8[_0x5177('0x11')])});}});}else{logger[_0x5177('0x17')](_0x5177('0x1b'));return request({'uri':util[_0x5177('0xf')](_0x5177('0x1a'),_0x2c23d8[_0x5177('0x11')])});}}function request(_0xe6dcf6){logger['debug'](_0x5177('0x1c'),JSON[_0x5177('0x1d')](_0xe6dcf6));return rp(_[_0x5177('0x9')](_0xe6dcf6,{'method':_0x5177('0x1e'),'headers':headers,'json':!![]}));}function getAuth(_0x5f5bd4){var _0x3e6944;if(_0x5f5bd4[_0x5177('0x1f')]===_0x5177('0x20')){_0x3e6944=util['format'](_0x5177('0x21'),_0x5f5bd4['username'],_0x5f5bd4[_0x5177('0x22')]);}else if(_0x5f5bd4[_0x5177('0x1f')]===_0x5177('0x23')){_0x3e6944=util[_0x5177('0xf')](_0x5177('0x24'),_0x5f5bd4[_0x5177('0x25')],_0x5f5bd4[_0x5177('0x23')]);}return util[_0x5177('0xf')](_0x5177('0x26'),new Buffer(_0x3e6944)[_0x5177('0x27')](_0x5177('0x28')));}function getEndUser(_0x3b0c37,_0x5d9a9c,_0x3dcea1){logger['info'](_0x5177('0x29'),_0x3dcea1);return request({'uri':util[_0x5177('0xf')](_0x5177('0x2a'),_0x3b0c37[_0x5177('0x11')]),'qs':{'phone':_0x3dcea1}})['then'](function(_0x2503ef){if(_0x2503ef['total_entries']){logger['info'](_0x5177('0x2b'));return _0x2503ef[_0x5177('0x15')]['entries'][0x0];}else{logger[_0x5177('0x17')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x5177('0xf')](_0x5177('0x2c'),_0x3b0c37['remoteUri']),'method':_0x5177('0x2d'),'body':{'first_name':_0x5d9a9c,'title':_0x5d9a9c,'phone_numbers':[{'type':_0x5177('0x2e'),'value':_0x3dcea1}]}});}});}function getTags(_0x3c4248,_0x7f86e){var _0xe98ff1=[];if(_0x3c4248&&_0x3c4248[_0x5177('0x2f')]>0x0){_0xe98ff1=_['map'](_0x3c4248,_0x7f86e);}return _0xe98ff1;}function getCustomFields(_0x498fcd,_0x45cf20){var _0x1c660e=[];var _0x7dae59={'custom_fields':{}};if(_0x498fcd[_0x5177('0x2f')]>0x0){_[_0x5177('0x30')](_0x498fcd,function(_0x8134f9){if(_0x8134f9[_0x5177('0x31')]===_0x5177('0x32')&&_0x8134f9['nameField']&&!_0x8134f9[_0x5177('0x33')]){_0x7dae59[_0x8134f9[_0x5177('0x34')]['toLowerCase']()]=_0x8134f9[_0x5177('0x35')]['toString']();}else if(_0x8134f9[_0x5177('0x31')]===_0x5177('0x32')&&_0x8134f9[_0x5177('0x36')]&&_0x8134f9['customField']){_0x7dae59['custom_fields'][_0x8134f9[_0x5177('0x36')]]=_0x8134f9[_0x5177('0x35')][_0x5177('0x27')]();}else if(_0x8134f9[_0x5177('0x31')]===_0x5177('0x37')&&_0x8134f9[_0x5177('0x38')]&&_0x8134f9[_0x5177('0x36')]&&_0x8134f9[_0x5177('0x33')]){_0x45cf20[_0x8134f9['variableName']]&&(_0x7dae59[_0x5177('0x39')][_0x8134f9[_0x5177('0x36')]]=_0x45cf20[_0x8134f9['variableName']][_0x5177('0x27')]());}else if(_0x8134f9[_0x5177('0x31')]===_0x5177('0x3a')&&_0x8134f9[_0x5177('0x3b')]&&_0x8134f9[_0x5177('0x3b')][_0x5177('0x3c')]&&_0x8134f9['idField']&&_0x8134f9[_0x5177('0x33')]){_0x45cf20[_0x8134f9[_0x5177('0x3b')][_0x5177('0x3c')][_0x5177('0x3d')]()]&&(_0x7dae59[_0x5177('0x39')][_0x8134f9[_0x5177('0x36')]]=_0x45cf20[_0x8134f9[_0x5177('0x3b')]['name'][_0x5177('0x3d')]()][_0x5177('0x27')]());}});}if(_0x7dae59['priority']){_0x7dae59['priority']=Number(_0x7dae59[_0x5177('0x3e')]);}return _0x7dae59;}function getTicket(_0x188cec,_0x22365a,_0x182c78,_0x3285c3,_0x1ea3be){logger[_0x5177('0x17')](_0x5177('0x3f'));var _0xa2ed49=_[_0x5177('0x40')]({'subject':intUtil[_0x5177('0x41')](_0x3285c3[_0x5177('0x42')],_0x1ea3be,'\x20'),'type':_0x5177('0x43'),'status':'new','labels':[_0x5177('0x44'),_0x5177('0x45'),'CTI'][_0x5177('0x46')](getTags(_0x3285c3['Tags'],_0x5177('0x3c'))),'description':intUtil[_0x5177('0x41')](_0x3285c3[_0x5177('0x47')],_0x1ea3be,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x22365a['id']),'class':_0x5177('0x48')}},'message':{'direction':'in','body':intUtil[_0x5177('0x41')](_0x3285c3[_0x5177('0x47')],_0x1ea3be,'\x0a')}},getCustomFields(_0x3285c3[_0x5177('0x49')],_0x1ea3be));return request({'uri':util[_0x5177('0xf')](_0x5177('0x4a'),_0x188cec[_0x5177('0x11')],_0x182c78['id']),'method':_0x5177('0x2d'),'body':_0xa2ed49});}exports['queue']=function(_0xe1c75c,_0x51ecc0,_0x5e3d30,_0x30e4f3,_0x17dc98,_0x5172f8){var _0x448fa1,_0x508178;_0x5172f8['remoteUri']=intUtil[_0x5177('0x4b')](_0x5172f8[_0x5177('0x11')]);_0x5172f8[_0x5177('0x4c')]=intUtil[_0x5177('0x4b')](_0x5172f8[_0x5177('0x4c')]);if(_0x17dc98&&_0x17dc98[_0x5177('0x4d')]){logger[_0x5177('0x17')]('[QUEUE]','Recording\x20is\x20enabled!');_0x51ecc0[_0x5177('0x4e')]=util['format'](_0x5177('0x4f'),_0x5172f8[_0x5177('0x4c')],_0x51ecc0[_0x5177('0x50')],md5(_0x51ecc0[_0x5177('0x50')]));}else{_0x51ecc0['recordingURL']='';}headers[_0x5177('0x51')]=getAuth(_0x5172f8);return getUser(_0x5172f8,_0x30e4f3[_0x5177('0x52')])[_0x5177('0x12')](function(_0x18b045){_0x448fa1=_0x18b045;logger[_0x5177('0x17')](_0x5177('0x53'),_0x448fa1['id']);return getEndUser(_0x5172f8,_0x51ecc0[_0x5177('0x54')],_0x51ecc0[_0x5177('0x55')]);})[_0x5177('0x12')](function(_0x296a98){_0x508178=_0x296a98;logger[_0x5177('0x17')]('The\x20Enduser\x20ID\x20is:',_0x508178['id']);return getTicket(_0x5172f8,_0x448fa1,_0x508178,_0x5e3d30,_0x51ecc0);})[_0x5177('0x12')](function(_0x481bda){if(_0x481bda){logger['info']('Ticket\x20created!');logger[_0x5177('0x17')](_0x5177('0x56'),_0x481bda['id']);switch(_0x5172f8['type']){case _0x5177('0x57'):logger[_0x5177('0x17')](_0x5177('0x58'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x5177('0xf')]('user:%s',_0x30e4f3['name']),'trigger:desk:display',{'recordId':_0x481bda['id']});break;case _0x5177('0x59'):logger[_0x5177('0x17')](_0x5177('0x58'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x5177('0x5a'),_0x30e4f3['name']),_0x5177('0x5b'),{'uri':util[_0x5177('0xf')](_0x5177('0x5c'),_0x481bda['id'])});break;default:logger[_0x5177('0x5d')](_0x5177('0x58'),_0x5177('0x5e'));}}})[_0x5177('0x5f')](function(_0x12dd42){console[_0x5177('0x5d')](_0x12dd42);logger[_0x5177('0x5d')](_0x5177('0x58'),JSON[_0x5177('0x1d')](_0x12dd42));});};exports[_0x5177('0x60')]=function(_0x4c2068,_0x59376b,_0x29ff0f,_0x5d5016,_0x649c6f,_0x49aba9,_0x1414b5){var _0x24cb5e,_0x1e838a;_0x49aba9['remoteUri']=intUtil['stripTrailingSlash'](_0x49aba9[_0x5177('0x11')]);_0x49aba9[_0x5177('0x4c')]=intUtil[_0x5177('0x4b')](_0x49aba9[_0x5177('0x4c')]);if(_0x1414b5&&_0x1414b5['recordingFormat']&&_0x1414b5['recordingFormat']!==_0x5177('0x61')){logger[_0x5177('0x17')](_0x5177('0x62'),_0x5177('0x63'));_0x59376b['recordingURL']=util[_0x5177('0xf')](_0x5177('0x4f'),_0x49aba9[_0x5177('0x4c')],_0x59376b['uniqueid'],md5(_0x59376b[_0x5177('0x50')]));}headers[_0x5177('0x51')]=getAuth(_0x49aba9);return getUser(_0x49aba9,_0x5d5016[_0x5177('0x52')])['then'](function(_0x975408){_0x24cb5e=_0x975408;logger['info'](_0x5177('0x53'),_0x24cb5e['id']);return getEndUser(_0x49aba9,_0x59376b[_0x5177('0x64')],_0x59376b[_0x5177('0x65')]);})['then'](function(_0x169a04){_0x1e838a=_0x169a04;logger[_0x5177('0x17')](_0x5177('0x66'),_0x1e838a['id']);return getTicket(_0x49aba9,_0x24cb5e,_0x1e838a,_0x29ff0f,_0x59376b);})[_0x5177('0x12')](function(_0xc7a59e){if(_0xc7a59e){logger[_0x5177('0x17')](_0x5177('0x67'));logger[_0x5177('0x17')]('The\x20Ticket\x20ID\x20is:',_0xc7a59e['id']);switch(_0x49aba9['type']){case'integrationTab':logger[_0x5177('0x17')](_0x5177('0x58'),_0x5177('0x68'));emit(util[_0x5177('0xf')](_0x5177('0x5a'),_0x5d5016[_0x5177('0x3c')]),'trigger:desk:display',{'recordId':_0xc7a59e['id']});break;case'newTab':logger[_0x5177('0x17')](_0x5177('0x58'),_0x5177('0x69'));emit(util[_0x5177('0xf')](_0x5177('0x5a'),_0x5d5016[_0x5177('0x3c')]),_0x5177('0x5b'),{'uri':util[_0x5177('0xf')](_0x5177('0x6a'),_0x49aba9['remoteUri'],_0xc7a59e['id'])});break;default:logger[_0x5177('0x5d')](_0x5177('0x62'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x5177('0x5f')](function(_0x4481b6){logger['error'](_0x5177('0x62'),JSON[_0x5177('0x1d')](_0x4481b6));});};exports[_0x5177('0x6b')]=function(_0x4be4b2,_0x23b246,_0x400e27,_0x5f5bd5,_0x52a6c2,_0x102c27){var _0x4f76d7,_0x460bdb;_0x102c27['remoteUri']=intUtil[_0x5177('0x4b')](_0x102c27[_0x5177('0x11')]);_0x102c27['serverUrl']=intUtil[_0x5177('0x4b')](_0x102c27[_0x5177('0x4c')]);if(_0x52a6c2&&_0x52a6c2[_0x5177('0x4d')]){logger[_0x5177('0x17')](_0x5177('0x6c'),_0x5177('0x63'));_0x23b246[_0x5177('0x4e')]=util['format'](_0x5177('0x4f'),_0x102c27['serverUrl'],_0x23b246['uniqueid'],md5(_0x23b246[_0x5177('0x50')]));}else{_0x23b246[_0x5177('0x4e')]='';}headers['Authorization']=getAuth(_0x102c27);return getUser(_0x102c27)[_0x5177('0x12')](function(_0xa889bd){_0x4f76d7=_0xa889bd;logger[_0x5177('0x17')](_0x5177('0x53'),_0x4f76d7['id']);return getEndUser(_0x102c27,_0x23b246[_0x5177('0x54')],_0x23b246[_0x5177('0x55')]);})[_0x5177('0x12')](function(_0x3b26f4){_0x460bdb=_0x3b26f4;logger['info']('The\x20Enduser\x20ID\x20is:',_0x460bdb['id']);return getTicket(_0x102c27,_0x4f76d7,_0x460bdb,_0x400e27,_0x23b246);})[_0x5177('0x12')](function(_0x3a7ac3){if(_0x3a7ac3){logger[_0x5177('0x17')](_0x5177('0x67'));logger[_0x5177('0x17')](_0x5177('0x56'),_0x3a7ac3['id']);}})['catch'](function(_0x3692b2){logger[_0x5177('0x5d')](_0x5177('0x6c'),JSON[_0x5177('0x1d')](_0x3692b2));});}; \ 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 e83788e..3cfc9f1 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 _0x0e88=['internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','/systemusers(','Bearer\x20','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1','contactid',']\x20Enduser\x20created!','forEach','type','string','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','Fields','phonecall','phonecalls','/contacts(','callDirection','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','queue','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','socket.io-emitter','clientId','username','password','then','catch','error',']\x20Wrong\x20credentials!','GET','4.0','value','email','userEmail','length'];(function(_0xe8ffe3,_0x196a3d){var _0x19828c=function(_0x639be2){while(--_0x639be2){_0xe8ffe3['push'](_0xe8ffe3['shift']());}};_0x19828c(++_0x196a3d);}(_0x0e88,0x104));var _0x80e8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0e88[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x80e8('0x0'));var BPromise=require(_0x80e8('0x1'));var rp=require('request-promise');var util=require('util');var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x80e8('0x2'));var logger=require(_0x80e8('0x3'))(_0x80e8('0x4'));var config=require(_0x80e8('0x5'));config['redis']=_[_0x80e8('0x6')](config[_0x80e8('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x80e8('0x8'))(new Redis(config[_0x80e8('0x7')]));function getAuthToken(_0x389775,_0x4a8ffa,_0x4f7f3e){var _0x20e490={'method':'POST','uri':_0x4a8ffa,'form':{'client_id':_0x389775[_0x80e8('0x9')],'resource':_0x389775['remoteUri'],'username':_0x389775[_0x80e8('0xa')],'password':_0x389775[_0x80e8('0xb')],'grant_type':'password','client_secret':_0x389775['clientSecret']},'json':!![]};return rp(_0x20e490)[_0x80e8('0xc')](function(_0x48dece){return _0x48dece['access_token'];})[_0x80e8('0xd')](function(_0x3e5035){logger[_0x80e8('0xe')]('['+[_0x4f7f3e['toUpperCase']()]+_0x80e8('0xf'));return _0x3e5035['message'];});}function getUser(_0x5b22dc,_0x4a33c9,_0x1346bc,_0x3d2b70,_0x4c433d,_0x17b0b6){return new BPromise(function(_0x578001,_0x66b3f2){return getAuthToken(_0x4a33c9,_0x3d2b70,_0x17b0b6)[_0x80e8('0xc')](function(_0x200de6){var _0x59d9e0={'method':_0x80e8('0x10'),'uri':_0x4c433d+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x200de6,'OData-Version':_0x80e8('0x11')},'json':!![]};return rp(_0x59d9e0);})['then'](function(_0xaf22f6){var _0x253d22=_0xaf22f6[_0x80e8('0x12')];var _0x1ba80b=![];var _0x163538=null;if(!_['isNil'](_0x1346bc)){if(intUtil['validateEmail'](_0x1346bc[_0x80e8('0x13')])){_0x5b22dc[_0x80e8('0x14')]=_0x1346bc['email'];for(_0x163538=0x0;_0x163538<_0x253d22[_0x80e8('0x15')];_0x163538++){if(_0x253d22[_0x163538][_0x80e8('0x16')]===_0x1346bc[_0x80e8('0x13')]&&!_0x253d22[_0x163538][_0x80e8('0x17')]){_0x1ba80b=!![];logger[_0x80e8('0x18')]('['+[_0x17b0b6[_0x80e8('0x19')]()]+_0x80e8('0x1a')+_0x253d22[_0x163538][_0x80e8('0x1b')]+'!');_0x5b22dc[_0x80e8('0x1c')]=_0x253d22[_0x163538][_0x80e8('0x1b')];}}}}if(!_0x1ba80b){logger[_0x80e8('0x18')]('['+[_0x17b0b6[_0x80e8('0x19')]()]+_0x80e8('0x1d'));_0x5b22dc['userEmail']=_0x4a33c9[_0x80e8('0xa')];for(_0x163538=0x0;_0x163538<_0x253d22[_0x80e8('0x15')];_0x163538++){if(_0x253d22[_0x163538][_0x80e8('0x16')]===_0x4a33c9[_0x80e8('0xa')]){_0x5b22dc['userId']=_0x253d22[_0x163538]['systemuserid'];}}}_0x578001(_0x5b22dc);})[_0x80e8('0xd')](function(_0x1ba6c8){_0x66b3f2(_0x1ba6c8[_0x80e8('0x1e')]);});});}function createEndUser(_0x8b6944,_0x19da86,_0x188d5f,_0x531d3a,_0xe4af02,_0x5c1797){return new BPromise(function(_0x29d8d0,_0x4273bf){return getAuthToken(_0x19da86,_0x188d5f,_0x5c1797)['then'](function(_0xb1cea1){var _0x302c30=_0x5c1797[_0x80e8('0x1f')]()===_0x80e8('0x20')?_0xe4af02[_0x80e8('0x21')]:_0xe4af02[_0x80e8('0x22')];var _0x3ab664={'method':_0x80e8('0x23'),'uri':_0x531d3a+_0x80e8('0x24'),'body':{'telephone1':_0x302c30,'fullname':_0x302c30,'firstname':_0x302c30,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x80e8('0x25')+_0x8b6944[_0x80e8('0x1c')]+')'},'headers':{'Authorization':_0x80e8('0x26')+_0xb1cea1,'OData-Version':_0x80e8('0x11')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3ab664);})[_0x80e8('0xc')](function(_0x513925){var _0x34cb95=_0x513925['headers'][_0x80e8('0x27')];var _0x13f772=_0x34cb95[_0x80e8('0x28')](_0x34cb95[_0x80e8('0x29')]('(')+0x1,_0x34cb95[_0x80e8('0x29')](')'));_0x8b6944[_0x80e8('0x2a')]=_0x13f772;_0x29d8d0(_0x8b6944);})['catch'](function(_0x57f7cf){_0x4273bf(_0x57f7cf['message']);});});}function getEndUser(_0x5528eb,_0x4c2ab3,_0x1ff1c3,_0x9f83c7,_0x57483f,_0x210075){return new BPromise(function(_0x2e467a,_0x5c3646){return getAuthToken(_0x4c2ab3,_0x1ff1c3,_0x210075)[_0x80e8('0xc')](function(_0x46fbd8){var _0x4490ad={'method':'GET','uri':_0x9f83c7+_0x80e8('0x2b'),'headers':{'Authorization':'Bearer\x20'+_0x46fbd8,'If-None-Match':null,'OData-Version':_0x80e8('0x11')},'json':!![]};return rp(_0x4490ad);})[_0x80e8('0xc')](function(_0x17bbf3){var _0x39185b=null;if(_0x17bbf3){var _0x5adbb4=_0x17bbf3[_0x80e8('0x12')];var _0x941d2a=![];for(_0x39185b=0x0;_0x39185b<_0x5adbb4[_0x80e8('0x15')];_0x39185b++){var _0x41cfd8=_0x210075[_0x80e8('0x1f')]()===_0x80e8('0x20')?_0x57483f[_0x80e8('0x21')]:_0x57483f[_0x80e8('0x22')];if(_0x5adbb4[_0x39185b][_0x80e8('0x2c')]===_0x41cfd8){_0x941d2a=!![];_0x5528eb[_0x80e8('0x2a')]=_0x5adbb4[_0x39185b][_0x80e8('0x2d')];}}if(_0x941d2a){_0x2e467a(_0x5528eb);}else{return createEndUser(_0x5528eb,_0x4c2ab3,_0x1ff1c3,_0x9f83c7,_0x57483f,_0x210075)[_0x80e8('0xc')](function(_0x36501c){logger['info']('['+[_0x210075[_0x80e8('0x19')]()]+_0x80e8('0x2e'),_0x36501c['enduserId']);_0x2e467a(_0x36501c);});}}else{return createEndUser(_0x5528eb,_0x4c2ab3,_0x1ff1c3,_0x9f83c7,_0x57483f,_0x210075)[_0x80e8('0xc')](function(_0xb2bc9f){logger[_0x80e8('0x18')]('['+[_0x210075[_0x80e8('0x19')]()]+']\x20Enduser\x20Created!',_0xb2bc9f['enduserId']);_0x2e467a(_0xb2bc9f);});}});});}function getCustomFields(_0x3fecd0,_0x372e31,_0xc87183){var _0x35d96c={};if(_0x3fecd0['length']>0x0){_[_0x80e8('0x2f')](_0x3fecd0,function(_0x223588){if(_0x223588[_0x80e8('0x30')]===_0x80e8('0x31')&&_0x223588[_0x80e8('0x32')]&&!_0x223588[_0x80e8('0x33')]){var _0x1a5680=_0x223588[_0x80e8('0x34')][_0x80e8('0x1f')]();var _0x4b9aa1=_0x1a5680[_0x80e8('0x28')](0x0,_0x1a5680[_0x80e8('0x35')]('_'));var _0x575e4e=_0x1a5680[_0x80e8('0x28')](_0x1a5680['indexOf']('_')+0x1);if(_0x4b9aa1===_0xc87183){_0x35d96c[_0x575e4e]=_0x223588[_0x80e8('0x36')];}}});}return _0x35d96c;}function getTicket(_0x4f5c33,_0x4e5f0d,_0x1bc06a,_0x384cb1,_0x1fcf0b,_0x3e34a1,_0x98312e){return new BPromise(function(_0x323913,_0x164084){var _0x2e69d5;return getAuthToken(_0x4e5f0d,_0x1bc06a,_0x98312e)['then'](function(_0x38cc2a){if(_0x3e34a1[_0x80e8('0x37')]===_0x80e8('0x38')){_0x2e69d5={'method':_0x80e8('0x23'),'uri':_0x384cb1+_0x80e8('0x39'),'body':Object[_0x80e8('0x3a')]({},{'title':intUtil[_0x80e8('0x3b')](_0x3e34a1[_0x80e8('0x3c')],_0x1fcf0b,'\x20'),'description':intUtil[_0x80e8('0x3b')](_0x3e34a1[_0x80e8('0x3d')],_0x1fcf0b,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x4f5c33[_0x80e8('0x2a')]+')','ownerid@odata.bind':'/systemusers('+_0x4f5c33['userId']+')','caseorigincode':'1'},getCustomFields(_0x3e34a1[_0x80e8('0x3e')],_0x1fcf0b,_0x3e34a1[_0x80e8('0x37')])),'headers':{'Authorization':'Bearer\x20'+_0x38cc2a,'OData-Version':_0x80e8('0x11')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3e34a1[_0x80e8('0x37')]===_0x80e8('0x3f')){_0x2e69d5={'method':_0x80e8('0x23'),'uri':_0x384cb1+_0x80e8('0x40'),'body':Object[_0x80e8('0x3a')]({},{'subject':intUtil[_0x80e8('0x3b')](_0x3e34a1[_0x80e8('0x3c')],_0x1fcf0b,'\x20'),'phonenumber':String(_0x1fcf0b[_0x80e8('0x22')]),'description':intUtil[_0x80e8('0x3b')](_0x3e34a1[_0x80e8('0x3d')],_0x1fcf0b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x80e8('0x41')+_0x4f5c33[_0x80e8('0x2a')]+')','ownerid@odata.bind':_0x80e8('0x25')+_0x4f5c33[_0x80e8('0x1c')]+')','directioncode':_0x4f5c33[_0x80e8('0x42')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x80e8('0x25')+_0x4f5c33['userId']+')','participationtypemask':_0x4f5c33[_0x80e8('0x42')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x4f5c33[_0x80e8('0x2a')]+')','participationtypemask':_0x4f5c33[_0x80e8('0x42')]==='queue'?0x1:0x2}]},getCustomFields(_0x3e34a1[_0x80e8('0x3e')],_0x1fcf0b,_0x3e34a1['ticketType'])),'headers':{'Authorization':_0x80e8('0x26')+_0x38cc2a,'OData-Version':_0x80e8('0x11')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2e69d5);})[_0x80e8('0xc')](function(_0x58ba80){var _0x93d97a=_0x58ba80['headers'][_0x80e8('0x27')];var _0x7c0350=_0x93d97a[_0x80e8('0x28')](_0x93d97a[_0x80e8('0x29')]('(')+0x1,_0x93d97a['lastIndexOf'](')'));_0x4f5c33[_0x80e8('0x43')]=_0x7c0350;_0x323913(_0x4f5c33);})[_0x80e8('0xd')](function(_0x47e9d9){_0x164084(_0x47e9d9[_0x80e8('0x1e')]);});});}function emit(_0x3016a5,_0x2f6e43,_0x49b4da,_0x5d1984){var _0x46d0aa={'uri':util[_0x80e8('0x44')](_0x80e8('0x45'),_0x3016a5,_0x49b4da,_0x5d1984)};io['to'](util[_0x80e8('0x44')]('user:%s',_0x2f6e43))[_0x80e8('0x46')](_0x80e8('0x47'),_0x46d0aa);}exports['cs']=function(_0x50cf1a,_0x5c260b,_0x3bfe64,_0x1468ad,_0x47c516,_0x44aea2,_0x2ff871,_0x3d0de6){var _0x198a7b={};_0x44aea2[_0x80e8('0x48')]=intUtil[_0x80e8('0x49')](_0x44aea2['remoteUri']);_0x44aea2[_0x80e8('0x4a')]=intUtil[_0x80e8('0x49')](_0x44aea2[_0x80e8('0x4a')]);_0x198a7b[_0x80e8('0x42')]=_0x3d0de6===_0x80e8('0x4b')||_0x3d0de6==='abandoned'?_0x80e8('0x4b'):_0x80e8('0x20');var _0x554bae=util['format']('%s/api/data/v9.0/',_0x44aea2[_0x80e8('0x48')]);var _0x2d4cf6=util['format'](_0x80e8('0x4c'),_0x44aea2[_0x80e8('0x4d')]);var _0x5a33b5=util[_0x80e8('0x44')](_0x80e8('0x4e'),_0x44aea2[_0x80e8('0x4a')],_0x5c260b[_0x80e8('0x4f')],md5(_0x5c260b[_0x80e8('0x4f')]));if(_0x47c516&&_0x47c516[_0x80e8('0x50')]){logger[_0x80e8('0x18')](_0x80e8('0x51'),_0x80e8('0x52'));_0x5c260b[_0x80e8('0x53')]=_0x5a33b5;}else if(_0x2ff871&&_0x2ff871[_0x80e8('0x54')]&&_0x2ff871[_0x80e8('0x54')]!=='none'){logger[_0x80e8('0x18')](_0x80e8('0x55'),'Recording\x20is\x20enabled!');_0x5c260b[_0x80e8('0x53')]=_0x5a33b5;}else{_0x5c260b[_0x80e8('0x53')]='';}return getUser(_0x198a7b,_0x44aea2,_0x1468ad,_0x2d4cf6,_0x554bae,_0x3d0de6)[_0x80e8('0xc')](function(_0x36c51b){logger['info']('['+_0x3d0de6[_0x80e8('0x19')]()+_0x80e8('0x56'),_0x36c51b[_0x80e8('0x1c')]);logger[_0x80e8('0x18')]('['+_0x3d0de6[_0x80e8('0x19')]()+_0x80e8('0x57'),_0x36c51b[_0x80e8('0x14')]);return getEndUser(_0x36c51b,_0x44aea2,_0x2d4cf6,_0x554bae,_0x5c260b,_0x3d0de6);})[_0x80e8('0xc')](function(_0x8a41f0){logger[_0x80e8('0x18')]('['+_0x3d0de6['toUpperCase']()+_0x80e8('0x58'),_0x8a41f0['enduserId']);logger['info']('['+_0x3d0de6[_0x80e8('0x19')]()+_0x80e8('0x59'),_0x5c260b[_0x80e8('0x22')]);return getTicket(_0x8a41f0,_0x44aea2,_0x2d4cf6,_0x554bae,_0x5c260b,_0x3bfe64,_0x3d0de6);})[_0x80e8('0xc')](function(_0x533d32){logger[_0x80e8('0x18')](util[_0x80e8('0x44')]('['+_0x3d0de6[_0x80e8('0x19')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x3bfe64[_0x80e8('0x37')],_0x533d32[_0x80e8('0x43')]));logger[_0x80e8('0x18')](util['format']('['+_0x3d0de6[_0x80e8('0x19')]()+_0x80e8('0x5a'),_0x3d0de6));if(_0x3d0de6!=='abandoned'){logger[_0x80e8('0x18')]('['+_0x3d0de6[_0x80e8('0x19')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x44aea2[_0x80e8('0x48')],_0x1468ad[_0x80e8('0x5b')],_0x3bfe64[_0x80e8('0x37')],_0x533d32['ticketId']);}})[_0x80e8('0xd')](function(_0x5a974a){logger[_0x80e8('0xe')]('['+_0x3d0de6['toUpperCase']()+_0x80e8('0x5c'),util[_0x80e8('0x5d')](_0x5a974a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb375=['%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','username','password','access_token','error',']\x20Wrong\x20credentials!','message','then','GET','Bearer\x20','value','isNil','validateEmail','userEmail','email','internalemailaddress','isdisabled','info','toUpperCase','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','lastIndexOf','enduserId','catch','4.0','telephone1',']\x20Enduser\x20created!','forEach','type','string','nameField','customField','substring','content','ticketType','incident','incidents','getString','Subjects','Descriptions','Fields','phonecall','phonecalls','/contacts(','callDirection','queue','headers','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','remoteUri','serverUrl','abandoned'];(function(_0x188041,_0x432162){var _0x5f13aa=function(_0x2043c4){while(--_0x2043c4){_0x188041['push'](_0x188041['shift']());}};_0x5f13aa(++_0x432162);}(_0xb375,0xd4));var _0x5b37=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb375[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5b37('0x0'));var BPromise=require(_0x5b37('0x1'));var rp=require(_0x5b37('0x2'));var util=require('util');var intUtil=require('./util');var md5=require(_0x5b37('0x3'));var Redis=require(_0x5b37('0x4'));var logger=require(_0x5b37('0x5'))('dynamics365');var config=require(_0x5b37('0x6'));config[_0x5b37('0x7')]=_[_0x5b37('0x8')](config[_0x5b37('0x7')],{'host':_0x5b37('0x9'),'port':0x18eb});var io=require(_0x5b37('0xa'))(new Redis(config[_0x5b37('0x7')]));function getAuthToken(_0xca5511,_0x53e167,_0x1d37ab){var _0x37ab3a={'method':_0x5b37('0xb'),'uri':_0x53e167,'form':{'client_id':_0xca5511['clientId'],'resource':_0xca5511['remoteUri'],'username':_0xca5511[_0x5b37('0xc')],'password':_0xca5511[_0x5b37('0xd')],'grant_type':_0x5b37('0xd'),'client_secret':_0xca5511['clientSecret']},'json':!![]};return rp(_0x37ab3a)['then'](function(_0x42b4f0){return _0x42b4f0[_0x5b37('0xe')];})['catch'](function(_0x436f6f){logger[_0x5b37('0xf')]('['+[_0x1d37ab['toUpperCase']()]+_0x5b37('0x10'));return _0x436f6f[_0x5b37('0x11')];});}function getUser(_0x2f7fa4,_0x214da9,_0x25eb7d,_0x51d153,_0x1292ef,_0x414cd5){return new BPromise(function(_0xf032aa,_0x598db8){return getAuthToken(_0x214da9,_0x51d153,_0x414cd5)[_0x5b37('0x12')](function(_0x57d82e){var _0x4e0646={'method':_0x5b37('0x13'),'uri':_0x1292ef+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x5b37('0x14')+_0x57d82e,'OData-Version':'4.0'},'json':!![]};return rp(_0x4e0646);})[_0x5b37('0x12')](function(_0x5513bd){var _0x34e46e=_0x5513bd[_0x5b37('0x15')];var _0x343276=![];var _0x1ede47=null;if(!_[_0x5b37('0x16')](_0x25eb7d)){if(intUtil[_0x5b37('0x17')](_0x25eb7d['email'])){_0x2f7fa4[_0x5b37('0x18')]=_0x25eb7d[_0x5b37('0x19')];for(_0x1ede47=0x0;_0x1ede47<_0x34e46e['length'];_0x1ede47++){if(_0x34e46e[_0x1ede47][_0x5b37('0x1a')]===_0x25eb7d['email']&&!_0x34e46e[_0x1ede47][_0x5b37('0x1b')]){_0x343276=!![];logger[_0x5b37('0x1c')]('['+[_0x414cd5[_0x5b37('0x1d')]()]+']\x20Agent\x20found\x20'+_0x34e46e[_0x1ede47][_0x5b37('0x1e')]+'!');_0x2f7fa4['userId']=_0x34e46e[_0x1ede47]['systemuserid'];}}}}if(!_0x343276){logger['info']('['+[_0x414cd5[_0x5b37('0x1d')]()]+_0x5b37('0x1f'));_0x2f7fa4[_0x5b37('0x18')]=_0x214da9[_0x5b37('0xc')];for(_0x1ede47=0x0;_0x1ede47<_0x34e46e[_0x5b37('0x20')];_0x1ede47++){if(_0x34e46e[_0x1ede47][_0x5b37('0x1a')]===_0x214da9[_0x5b37('0xc')]){_0x2f7fa4[_0x5b37('0x21')]=_0x34e46e[_0x1ede47][_0x5b37('0x1e')];}}}_0xf032aa(_0x2f7fa4);})['catch'](function(_0x219baa){_0x598db8(_0x219baa[_0x5b37('0x11')]);});});}function createEndUser(_0x19db88,_0x3b68da,_0x585e3b,_0x422e3c,_0x2fc392,_0x325705){return new BPromise(function(_0x4effdd,_0x44cea6){return getAuthToken(_0x3b68da,_0x585e3b,_0x325705)[_0x5b37('0x12')](function(_0x5126e0){var _0x43b527=_0x325705[_0x5b37('0x22')]()===_0x5b37('0x23')?_0x2fc392[_0x5b37('0x24')]:_0x2fc392[_0x5b37('0x25')];var _0x480393={'method':_0x5b37('0xb'),'uri':_0x422e3c+_0x5b37('0x26'),'body':{'telephone1':_0x43b527,'fullname':_0x43b527,'firstname':_0x43b527,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5b37('0x27')+_0x19db88['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x5126e0,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x480393);})['then'](function(_0x43e19e){var _0x1342a1=_0x43e19e['headers']['odata-entityid'];var _0x51bd40=_0x1342a1['substring'](_0x1342a1[_0x5b37('0x28')]('(')+0x1,_0x1342a1[_0x5b37('0x28')](')'));_0x19db88[_0x5b37('0x29')]=_0x51bd40;_0x4effdd(_0x19db88);})[_0x5b37('0x2a')](function(_0x24b318){_0x44cea6(_0x24b318[_0x5b37('0x11')]);});});}function getEndUser(_0x39c2ec,_0x5a6dd0,_0x5a7d4a,_0x4356b5,_0x240103,_0x398b5a){return new BPromise(function(_0x1adaf5,_0x31d668){return getAuthToken(_0x5a6dd0,_0x5a7d4a,_0x398b5a)[_0x5b37('0x12')](function(_0xdbc503){var _0x2667af={'method':_0x5b37('0x13'),'uri':_0x4356b5+'contacts?$select=telephone1','headers':{'Authorization':'Bearer\x20'+_0xdbc503,'If-None-Match':null,'OData-Version':_0x5b37('0x2b')},'json':!![]};return rp(_0x2667af);})[_0x5b37('0x12')](function(_0x2546fc){var _0x1f31ba=null;if(_0x2546fc){var _0x4b7407=_0x2546fc[_0x5b37('0x15')];var _0x46935c=![];for(_0x1f31ba=0x0;_0x1f31ba<_0x4b7407[_0x5b37('0x20')];_0x1f31ba++){var _0x5b2c1f=_0x398b5a['toLowerCase']()===_0x5b37('0x23')?_0x240103[_0x5b37('0x24')]:_0x240103['calleridnum'];if(_0x4b7407[_0x1f31ba][_0x5b37('0x2c')]===_0x5b2c1f){_0x46935c=!![];_0x39c2ec[_0x5b37('0x29')]=_0x4b7407[_0x1f31ba]['contactid'];}}if(_0x46935c){_0x1adaf5(_0x39c2ec);}else{return createEndUser(_0x39c2ec,_0x5a6dd0,_0x5a7d4a,_0x4356b5,_0x240103,_0x398b5a)[_0x5b37('0x12')](function(_0x1f60a5){logger[_0x5b37('0x1c')]('['+[_0x398b5a[_0x5b37('0x1d')]()]+_0x5b37('0x2d'),_0x1f60a5['enduserId']);_0x1adaf5(_0x1f60a5);});}}else{return createEndUser(_0x39c2ec,_0x5a6dd0,_0x5a7d4a,_0x4356b5,_0x240103,_0x398b5a)['then'](function(_0x3a46c1){logger['info']('['+[_0x398b5a[_0x5b37('0x1d')]()]+']\x20Enduser\x20Created!',_0x3a46c1['enduserId']);_0x1adaf5(_0x3a46c1);});}});});}function getCustomFields(_0x54b66c,_0x48b3e9,_0x566d9f){var _0x33a48c={};if(_0x54b66c[_0x5b37('0x20')]>0x0){_[_0x5b37('0x2e')](_0x54b66c,function(_0x305420){if(_0x305420[_0x5b37('0x2f')]===_0x5b37('0x30')&&_0x305420[_0x5b37('0x31')]&&!_0x305420[_0x5b37('0x32')]){var _0xc221eb=_0x305420['idField'][_0x5b37('0x22')]();var _0x5a1d43=_0xc221eb[_0x5b37('0x33')](0x0,_0xc221eb['indexOf']('_'));var _0x257ce1=_0xc221eb[_0x5b37('0x33')](_0xc221eb['indexOf']('_')+0x1);if(_0x5a1d43===_0x566d9f){_0x33a48c[_0x257ce1]=_0x305420[_0x5b37('0x34')];}}});}return _0x33a48c;}function getTicket(_0x1822d9,_0x4f5223,_0x37a4ac,_0x2839d0,_0x154aba,_0x1840c0,_0x4e1530){return new BPromise(function(_0x3a388b,_0x3e70db){var _0x390bb1;return getAuthToken(_0x4f5223,_0x37a4ac,_0x4e1530)['then'](function(_0x977fcb){if(_0x1840c0[_0x5b37('0x35')]===_0x5b37('0x36')){_0x390bb1={'method':_0x5b37('0xb'),'uri':_0x2839d0+_0x5b37('0x37'),'body':Object['assign']({},{'title':intUtil[_0x5b37('0x38')](_0x1840c0[_0x5b37('0x39')],_0x154aba,'\x20'),'description':intUtil[_0x5b37('0x38')](_0x1840c0[_0x5b37('0x3a')],_0x154aba,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x1822d9['enduserId']+')','ownerid@odata.bind':_0x5b37('0x27')+_0x1822d9[_0x5b37('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x1840c0[_0x5b37('0x3b')],_0x154aba,_0x1840c0[_0x5b37('0x35')])),'headers':{'Authorization':_0x5b37('0x14')+_0x977fcb,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1840c0[_0x5b37('0x35')]===_0x5b37('0x3c')){_0x390bb1={'method':_0x5b37('0xb'),'uri':_0x2839d0+_0x5b37('0x3d'),'body':Object['assign']({},{'subject':intUtil[_0x5b37('0x38')](_0x1840c0[_0x5b37('0x39')],_0x154aba,'\x20'),'phonenumber':String(_0x154aba[_0x5b37('0x25')]),'description':intUtil[_0x5b37('0x38')](_0x1840c0[_0x5b37('0x3a')],_0x154aba,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5b37('0x3e')+_0x1822d9['enduserId']+')','ownerid@odata.bind':_0x5b37('0x27')+_0x1822d9[_0x5b37('0x21')]+')','directioncode':_0x1822d9[_0x5b37('0x3f')]===_0x5b37('0x40')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1822d9[_0x5b37('0x21')]+')','participationtypemask':_0x1822d9[_0x5b37('0x3f')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x5b37('0x3e')+_0x1822d9[_0x5b37('0x29')]+')','participationtypemask':_0x1822d9['callDirection']===_0x5b37('0x40')?0x1:0x2}]},getCustomFields(_0x1840c0[_0x5b37('0x3b')],_0x154aba,_0x1840c0[_0x5b37('0x35')])),'headers':{'Authorization':_0x5b37('0x14')+_0x977fcb,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x390bb1);})[_0x5b37('0x12')](function(_0x393264){var _0x4856e7=_0x393264[_0x5b37('0x41')][_0x5b37('0x42')];var _0x5840f8=_0x4856e7[_0x5b37('0x33')](_0x4856e7[_0x5b37('0x28')]('(')+0x1,_0x4856e7[_0x5b37('0x28')](')'));_0x1822d9[_0x5b37('0x43')]=_0x5840f8;_0x3a388b(_0x1822d9);})[_0x5b37('0x2a')](function(_0x47fd87){_0x3e70db(_0x47fd87['message']);});});}function emit(_0x1977c0,_0xdd649a,_0x4176df,_0x4e83e1){var _0x5e22fd={'uri':util[_0x5b37('0x44')](_0x5b37('0x45'),_0x1977c0,_0x4176df,_0x4e83e1)};io['to'](util[_0x5b37('0x44')](_0x5b37('0x46'),_0xdd649a))[_0x5b37('0x47')](_0x5b37('0x48'),_0x5e22fd);}exports['cs']=function(_0x25f6f3,_0x169331,_0x1c22d2,_0x45120d,_0x3e0414,_0xc6a872,_0x5f27f8,_0x45eebf){var _0x5379ee={};_0xc6a872[_0x5b37('0x49')]=intUtil['stripTrailingSlash'](_0xc6a872[_0x5b37('0x49')]);_0xc6a872['serverUrl']=intUtil['stripTrailingSlash'](_0xc6a872[_0x5b37('0x4a')]);_0x5379ee['callDirection']=_0x45eebf===_0x5b37('0x40')||_0x45eebf===_0x5b37('0x4b')?'queue':_0x5b37('0x23');var _0x36bb49=util[_0x5b37('0x44')](_0x5b37('0x4c'),_0xc6a872[_0x5b37('0x49')]);var _0x4dcdea=util[_0x5b37('0x44')](_0x5b37('0x4d'),_0xc6a872[_0x5b37('0x4e')]);var _0x1b43d8=util[_0x5b37('0x44')](_0x5b37('0x4f'),_0xc6a872['serverUrl'],_0x169331[_0x5b37('0x50')],md5(_0x169331[_0x5b37('0x50')]));if(_0x3e0414&&_0x3e0414[_0x5b37('0x51')]){logger[_0x5b37('0x1c')](_0x5b37('0x52'),'Recording\x20is\x20enabled!');_0x169331['recordingURL']=_0x1b43d8;}else if(_0x5f27f8&&_0x5f27f8[_0x5b37('0x53')]&&_0x5f27f8[_0x5b37('0x53')]!==_0x5b37('0x54')){logger[_0x5b37('0x1c')](_0x5b37('0x55'),_0x5b37('0x56'));_0x169331[_0x5b37('0x57')]=_0x1b43d8;}else{_0x169331[_0x5b37('0x57')]='';}return getUser(_0x5379ee,_0xc6a872,_0x45120d,_0x4dcdea,_0x36bb49,_0x45eebf)[_0x5b37('0x12')](function(_0x2c2ae8){logger[_0x5b37('0x1c')]('['+_0x45eebf['toUpperCase']()+_0x5b37('0x58'),_0x2c2ae8[_0x5b37('0x21')]);logger[_0x5b37('0x1c')]('['+_0x45eebf[_0x5b37('0x1d')]()+_0x5b37('0x59'),_0x2c2ae8['userEmail']);return getEndUser(_0x2c2ae8,_0xc6a872,_0x4dcdea,_0x36bb49,_0x169331,_0x45eebf);})[_0x5b37('0x12')](function(_0x3044e4){logger[_0x5b37('0x1c')]('['+_0x45eebf[_0x5b37('0x1d')]()+_0x5b37('0x5a'),_0x3044e4['enduserId']);logger[_0x5b37('0x1c')]('['+_0x45eebf[_0x5b37('0x1d')]()+_0x5b37('0x5b'),_0x169331[_0x5b37('0x25')]);return getTicket(_0x3044e4,_0xc6a872,_0x4dcdea,_0x36bb49,_0x169331,_0x1c22d2,_0x45eebf);})[_0x5b37('0x12')](function(_0x3853eb){logger[_0x5b37('0x1c')](util['format']('['+_0x45eebf[_0x5b37('0x1d')]()+_0x5b37('0x5c'),_0x1c22d2[_0x5b37('0x35')],_0x3853eb[_0x5b37('0x43')]));logger[_0x5b37('0x1c')](util[_0x5b37('0x44')]('['+_0x45eebf[_0x5b37('0x1d')]()+']\x20Call\x20direction:\x20%s',_0x45eebf));if(_0x45eebf!==_0x5b37('0x4b')){logger[_0x5b37('0x1c')]('['+_0x45eebf['toUpperCase']()+']',_0x5b37('0x5d'));emit(_0xc6a872[_0x5b37('0x49')],_0x45120d['name'],_0x1c22d2[_0x5b37('0x35')],_0x3853eb['ticketId']);}})[_0x5b37('0x2a')](function(_0xc65d3b){logger['error']('['+_0x45eebf[_0x5b37('0x1d')]()+_0x5b37('0x5e'),util[_0x5b37('0x5f')](_0xc65d3b,{'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 b2dda61..57d1ff7 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 _0x1ea4=['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:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','trigger:browser:url','%s/helpdesk/tickets/%d','[ABANDONED]','calleridname','The\x20Ticket\x20ID\x20is:','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','contact','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','type','content','string','idField','customField','push','variable','variableName','customVariable','Variable','toLowerCase','stripTrailingSlash'];(function(_0x3fd8bc,_0x162498){var _0xf01afd=function(_0x5d2e68){while(--_0x5d2e68){_0x3fd8bc['push'](_0x3fd8bc['shift']());}};_0xf01afd(++_0x162498);}(_0x1ea4,0x12e));var _0x41ea=function(_0x174799,_0x56977e){_0x174799=_0x174799-0x0;var _0x24efba=_0x1ea4[_0x174799];return _0x24efba;};'use strict';var _=require('lodash');var rp=require(_0x41ea('0x0'));var md5=require('md5');var util=require(_0x41ea('0x1'));var Redis=require(_0x41ea('0x2'));var intUtil=require(_0x41ea('0x3'));var config=require(_0x41ea('0x4'));var logger=require(_0x41ea('0x5'))(_0x41ea('0x6'));config[_0x41ea('0x7')]=_['defaults'](config[_0x41ea('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x41ea('0x7')]));var headers={'Content-Type':'application/json','Accept':_0x41ea('0x8')};function emit(_0x47ad9f,_0x5bfcab,_0x28cbc6){io['to'](_0x47ad9f)[_0x41ea('0x9')](_0x5bfcab,_0x28cbc6);}function getTicket(_0x358c52,_0x491823,_0x1a2aa6,_0x1f7338,_0x1a170e){logger[_0x41ea('0xa')](_0x41ea('0xb'));var _0x25ed13=_[_0x41ea('0xc')]({'responder_id':_0x491823['id'],'requester_id':_0x1a2aa6['id'],'name':util[_0x41ea('0xd')](_0x41ea('0xe'),_0x1a170e['calleridname']),'phone':_0x1a170e['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x41ea('0xf')](_0x1f7338[_0x41ea('0x10')],_0x1a170e,'\x20'),'description':intUtil[_0x41ea('0xf')](_0x1f7338[_0x41ea('0x11')],_0x1a170e,_0x41ea('0x12')),'tags':getTags(_0x1f7338[_0x41ea('0x13')],_0x41ea('0x14'))},getCustomFields(_0x1f7338[_0x41ea('0x15')],_0x1a170e));_0x25ed13[_0x41ea('0x16')]=_[_0x41ea('0x17')](_[_0x41ea('0x18')](_0x25ed13[_0x41ea('0x16')],'id'),_0x41ea('0x19'));return request({'uri':util[_0x41ea('0xd')](_0x41ea('0x1a'),_0x358c52[_0x41ea('0x1b')]),'method':_0x41ea('0x1c'),'body':_0x25ed13})[_0x41ea('0x1d')](function(_0xc1e52d){logger['info'](_0x41ea('0x1e'));return _0xc1e52d;});}function getUser(_0x15eeff,_0x2d5af0){if(intUtil[_0x41ea('0x1f')](_0x2d5af0)){return request({'uri':util[_0x41ea('0xd')]('%s/api/v2/agents',_0x15eeff[_0x41ea('0x1b')]),'qs':{'email':_0x2d5af0}})['then'](function(_0x1004ad){if(_0x1004ad[_0x41ea('0x20')]){logger[_0x41ea('0xa')](_0x41ea('0x21'));return _[_0x41ea('0x22')](_0x1004ad,function(_0x250f4c){return _0x250f4c[_0x41ea('0x23')]['email']===_0x2d5af0;});}else{logger[_0x41ea('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x41ea('0xd')]('%s/api/v2/agents/me',_0x15eeff[_0x41ea('0x1b')])})['then'](function(_0x3840cb){logger[_0x41ea('0xa')](_0x41ea('0x24'));return _0x3840cb;});}});}else{logger[_0x41ea('0xa')](_0x41ea('0x25'));return request({'uri':util['format'](_0x41ea('0x26'),_0x15eeff['remoteUri'])})[_0x41ea('0x1d')](function(_0x1fa119){logger['info'](_0x41ea('0x24'));return _0x1fa119;});}}function getEndUser(_0x1b8fa5,_0x4b3c18,_0x14e151){logger[_0x41ea('0xa')](_0x41ea('0x27'),_0x14e151);return request({'uri':util[_0x41ea('0xd')]('%s/api/v2/contacts',_0x1b8fa5[_0x41ea('0x1b')]),'qs':{'phone':_0x14e151}})[_0x41ea('0x1d')](function(_0xcdadcf){if(_0xcdadcf[_0x41ea('0x20')]){logger[_0x41ea('0xa')](_0x41ea('0x28'));return _[_0x41ea('0x22')](_0xcdadcf,{'phone':_0x14e151});}else{logger[_0x41ea('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x41ea('0xd')](_0x41ea('0x29'),_0x1b8fa5[_0x41ea('0x1b')]),'method':_0x41ea('0x1c'),'body':{'name':_0x4b3c18,'phone':_0x14e151}})[_0x41ea('0x1d')](function(_0x307e3b){logger['info'](_0x41ea('0x2a'));return _0x307e3b;});}});}function getAuth(_0x51e59b){return util[_0x41ea('0xd')](_0x41ea('0x2b'),new Buffer(_0x51e59b[_0x41ea('0x2c')]+':X')[_0x41ea('0x2d')](_0x41ea('0x2e')));}function request(_0x2b4bff){logger[_0x41ea('0x2f')](_0x41ea('0x30'),JSON[_0x41ea('0x31')](_0x2b4bff));return rp(_[_0x41ea('0x32')](_0x2b4bff,{'method':_0x41ea('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x149813,_0x452de4){var _0x5db715=[];if(_0x149813&&_0x149813[_0x41ea('0x20')]>0x0){_0x5db715=_[_0x41ea('0x34')](_0x149813,_0x452de4);}return _0x5db715;}function getCustomFields(_0x1505a3,_0x35bbf6){var _0x5bf20f=[];var _0x300c07={'custom_fields':[]};if(_0x1505a3[_0x41ea('0x20')]>0x0){_[_0x41ea('0x35')](_0x1505a3,function(_0x496dc7){if(_0x496dc7[_0x41ea('0x36')]==='string'&&_0x496dc7['nameField']&&!_0x496dc7['customField']){_0x300c07[_0x496dc7['nameField']['toLowerCase']()]=_0x496dc7[_0x41ea('0x37')][_0x41ea('0x2d')]();}else if(_0x496dc7['type']===_0x41ea('0x38')&&_0x496dc7[_0x41ea('0x39')]&&_0x496dc7[_0x41ea('0x3a')]){_0x300c07[_0x41ea('0x16')][_0x41ea('0x3b')]({'id':_0x496dc7[_0x41ea('0x39')],'value':_0x496dc7[_0x41ea('0x37')][_0x41ea('0x2d')]()});}else if(_0x496dc7[_0x41ea('0x36')]===_0x41ea('0x3c')&&_0x496dc7['variableName']&&_0x496dc7[_0x41ea('0x39')]&&_0x496dc7[_0x41ea('0x3a')]){_0x35bbf6[_0x496dc7[_0x41ea('0x3d')]]&&_0x300c07[_0x41ea('0x16')]['push']({'id':_0x496dc7[_0x41ea('0x39')],'value':_0x35bbf6[_0x496dc7['variableName']][_0x41ea('0x2d')]()});}else if(_0x496dc7[_0x41ea('0x36')]===_0x41ea('0x3e')&&_0x496dc7[_0x41ea('0x3f')]&&_0x496dc7[_0x41ea('0x3f')][_0x41ea('0x14')]&&_0x496dc7[_0x41ea('0x39')]&&_0x496dc7['customField']){_0x35bbf6[_0x496dc7[_0x41ea('0x3f')][_0x41ea('0x14')][_0x41ea('0x40')]()]&&_0x300c07[_0x41ea('0x16')]['push']({'id':_0x496dc7[_0x41ea('0x39')],'value':_0x35bbf6[_0x496dc7[_0x41ea('0x3f')][_0x41ea('0x14')][_0x41ea('0x40')]()][_0x41ea('0x2d')]()});}});}return _0x300c07;}exports['queue']=function(_0x4752dc,_0x5704f4,_0x492f96,_0x2b7995,_0x1c62b9,_0x506892){var _0x31ed3f,_0x2850d5;_0x506892[_0x41ea('0x1b')]=intUtil[_0x41ea('0x41')](_0x506892[_0x41ea('0x1b')]);_0x506892[_0x41ea('0x42')]=intUtil[_0x41ea('0x41')](_0x506892[_0x41ea('0x42')]);if(_0x1c62b9&&_0x1c62b9[_0x41ea('0x43')]){logger[_0x41ea('0xa')](_0x41ea('0x44'),_0x41ea('0x45'));_0x5704f4[_0x41ea('0x46')]=util['format'](_0x41ea('0x47'),_0x506892['serverUrl'],_0x5704f4[_0x41ea('0x48')],md5(_0x5704f4['uniqueid']));}else{_0x5704f4[_0x41ea('0x46')]='';}headers[_0x41ea('0x49')]=getAuth(_0x506892);return getUser(_0x506892,_0x2b7995[_0x41ea('0x4a')])[_0x41ea('0x1d')](function(_0x15e0cc){_0x31ed3f=_0x15e0cc;logger[_0x41ea('0xa')](_0x41ea('0x4b'),_0x31ed3f['id']);return getEndUser(_0x506892,_0x5704f4['calleridname'],_0x5704f4[_0x41ea('0x4c')]);})['then'](function(_0x52a939){_0x2850d5=_0x52a939;logger[_0x41ea('0xa')](_0x41ea('0x4d'),_0x2850d5['id']);return getTicket(_0x506892,_0x31ed3f,_0x2850d5,_0x492f96,_0x5704f4);})[_0x41ea('0x1d')](function(_0x574cd9){if(_0x574cd9&&_0x574cd9['id']){logger['info'](_0x41ea('0x1e'));logger[_0x41ea('0xa')]('The\x20Ticket\x20ID\x20is:',_0x574cd9['id']);logger[_0x41ea('0xa')](_0x41ea('0x44'),_0x41ea('0x4e'));emit(util[_0x41ea('0xd')](_0x41ea('0x4f'),_0x2b7995[_0x41ea('0x14')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x506892['remoteUri'],_0x574cd9['id'])});}})[_0x41ea('0x50')](function(_0x28f2c3){logger[_0x41ea('0x51')](_0x41ea('0x44'),JSON[_0x41ea('0x31')](_0x28f2c3));});};exports[_0x41ea('0x52')]=function(_0x13cd51,_0x3b20c3,_0x33b087,_0x810101,_0x433aaf,_0x3bf3a7,_0x58db01){var _0x4a00f6,_0x5e87cf;_0x3bf3a7[_0x41ea('0x1b')]=intUtil[_0x41ea('0x41')](_0x3bf3a7[_0x41ea('0x1b')]);_0x3bf3a7[_0x41ea('0x42')]=intUtil[_0x41ea('0x41')](_0x3bf3a7[_0x41ea('0x42')]);if(_0x58db01&&_0x58db01[_0x41ea('0x53')]&&_0x58db01[_0x41ea('0x53')]!=='none'){logger[_0x41ea('0xa')](_0x41ea('0x54'),_0x41ea('0x45'));_0x3b20c3[_0x41ea('0x46')]=util[_0x41ea('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3bf3a7[_0x41ea('0x42')],_0x3b20c3[_0x41ea('0x48')],md5(_0x3b20c3[_0x41ea('0x48')]));}headers[_0x41ea('0x49')]=getAuth(_0x3bf3a7);return getUser(_0x3bf3a7,_0x810101[_0x41ea('0x4a')])[_0x41ea('0x1d')](function(_0x3552da){_0x4a00f6=_0x3552da;logger[_0x41ea('0xa')](_0x41ea('0x4b'),_0x4a00f6['id']);return getEndUser(_0x3bf3a7,_0x3b20c3[_0x41ea('0x55')],_0x3b20c3[_0x41ea('0x56')]);})[_0x41ea('0x1d')](function(_0x47544d){_0x5e87cf=_0x47544d;logger[_0x41ea('0xa')]('The\x20Enduser\x20ID\x20is:',_0x5e87cf['id']);return getTicket(_0x3bf3a7,_0x4a00f6,_0x5e87cf,_0x33b087,_0x3b20c3);})[_0x41ea('0x1d')](function(_0x5f0144){if(_0x5f0144&&_0x5f0144['id']){logger['info'](_0x41ea('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f0144['id']);logger[_0x41ea('0xa')](_0x41ea('0x54'),_0x41ea('0x4e'));emit(util[_0x41ea('0xd')](_0x41ea('0x4f'),_0x810101[_0x41ea('0x14')]),_0x41ea('0x57'),{'uri':util['format'](_0x41ea('0x58'),_0x3bf3a7[_0x41ea('0x1b')],_0x5f0144['id'])});}})[_0x41ea('0x50')](function(_0x15a8cb){logger[_0x41ea('0x51')](_0x41ea('0x54'),JSON[_0x41ea('0x31')](_0x15a8cb));});};exports['abandoned']=function(_0xe66322,_0x302e1f,_0x15f4b5,_0x52d226,_0x485823,_0x50aaec){var _0x28529a,_0x5e705f;_0x50aaec[_0x41ea('0x1b')]=intUtil[_0x41ea('0x41')](_0x50aaec[_0x41ea('0x1b')]);_0x50aaec[_0x41ea('0x42')]=intUtil[_0x41ea('0x41')](_0x50aaec[_0x41ea('0x42')]);if(_0x485823&&_0x485823['monitor_format']){logger[_0x41ea('0xa')](_0x41ea('0x59'),_0x41ea('0x45'));_0x302e1f[_0x41ea('0x46')]=util[_0x41ea('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x50aaec['serverUrl'],_0x302e1f[_0x41ea('0x48')],md5(_0x302e1f['uniqueid']));}else{_0x302e1f['recordingURL']='';}headers[_0x41ea('0x49')]=getAuth(_0x50aaec);return getUser(_0x50aaec,'')[_0x41ea('0x1d')](function(_0x130749){_0x28529a=_0x130749;logger[_0x41ea('0xa')]('The\x20User\x20ID\x20is:',_0x28529a['id']);return getEndUser(_0x50aaec,_0x302e1f[_0x41ea('0x5a')],_0x302e1f[_0x41ea('0x4c')]);})['then'](function(_0x230e08){_0x5e705f=_0x230e08;logger[_0x41ea('0xa')]('The\x20Enduser\x20ID\x20is:',_0x5e705f['id']);return getTicket(_0x50aaec,_0x28529a,_0x5e705f,_0x15f4b5,_0x302e1f);})[_0x41ea('0x1d')](function(_0x346733){if(_0x346733){logger[_0x41ea('0xa')]('Ticket\x20created!');logger[_0x41ea('0xa')](_0x41ea('0x5b'),_0x346733['id']);}})[_0x41ea('0x50')](function(_0x21ece5){logger[_0x41ea('0x51')](_0x41ea('0x59'),JSON[_0x41ea('0x31')](_0x21ece5));});}; \ No newline at end of file +var _0xf125=['apiKey','toString','debug','stringify','defaults','GET','map','customField','toLowerCase','type','string','idField','push','content','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','abandoned','[ABANDONED]','request-promise','md5','util','ioredis','./util','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts'];(function(_0x2665a3,_0x1cd85e){var _0x40a871=function(_0x4ce900){while(--_0x4ce900){_0x2665a3['push'](_0x2665a3['shift']());}};_0x40a871(++_0x1cd85e);}(_0xf125,0x134));var _0x5f12=function(_0x52924a,_0x59fd07){_0x52924a=_0x52924a-0x0;var _0x1f8036=_0xf125[_0x52924a];return _0x1f8036;};'use strict';var _=require('lodash');var rp=require(_0x5f12('0x0'));var md5=require(_0x5f12('0x1'));var util=require(_0x5f12('0x2'));var Redis=require(_0x5f12('0x3'));var intUtil=require(_0x5f12('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x5f12('0x5'));config[_0x5f12('0x6')]=_['defaults'](config['redis'],{'host':_0x5f12('0x7'),'port':0x18eb});var io=require(_0x5f12('0x8'))(new Redis(config[_0x5f12('0x6')]));var headers={'Content-Type':'application/json','Accept':_0x5f12('0x9')};function emit(_0x292ea2,_0x265cf8,_0x2021d1){io['to'](_0x292ea2)[_0x5f12('0xa')](_0x265cf8,_0x2021d1);}function getTicket(_0x39dd21,_0x54ef50,_0x309b50,_0x1f0d51,_0x224ce4){logger[_0x5f12('0xb')](_0x5f12('0xc'));var _0x565b81=_[_0x5f12('0xd')]({'responder_id':_0x54ef50['id'],'requester_id':_0x309b50['id'],'name':util[_0x5f12('0xe')](_0x5f12('0xf'),_0x224ce4[_0x5f12('0x10')]),'phone':_0x224ce4[_0x5f12('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x1f0d51['Subjects'],_0x224ce4,'\x20'),'description':intUtil['getString'](_0x1f0d51[_0x5f12('0x12')],_0x224ce4,_0x5f12('0x13')),'tags':getTags(_0x1f0d51['Tags'],_0x5f12('0x14'))},getCustomFields(_0x1f0d51[_0x5f12('0x15')],_0x224ce4));_0x565b81[_0x5f12('0x16')]=_[_0x5f12('0x17')](_[_0x5f12('0x18')](_0x565b81[_0x5f12('0x16')],'id'),_0x5f12('0x19'));return request({'uri':util[_0x5f12('0xe')](_0x5f12('0x1a'),_0x39dd21[_0x5f12('0x1b')]),'method':_0x5f12('0x1c'),'body':_0x565b81})['then'](function(_0x193fc9){logger['info'](_0x5f12('0x1d'));return _0x193fc9;});}function getUser(_0x5a5920,_0x3767c7){if(intUtil['validateEmail'](_0x3767c7)){return request({'uri':util[_0x5f12('0xe')](_0x5f12('0x1e'),_0x5a5920[_0x5f12('0x1b')]),'qs':{'email':_0x3767c7}})['then'](function(_0x447013){if(_0x447013[_0x5f12('0x1f')]){logger[_0x5f12('0xb')](_0x5f12('0x20'));return _[_0x5f12('0x21')](_0x447013,function(_0x51464e){return _0x51464e[_0x5f12('0x22')][_0x5f12('0x23')]===_0x3767c7;});}else{logger[_0x5f12('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5f12('0xe')](_0x5f12('0x24'),_0x5a5920[_0x5f12('0x1b')])})[_0x5f12('0x25')](function(_0x4d8c26){logger[_0x5f12('0xb')](_0x5f12('0x26'));return _0x4d8c26;});}});}else{logger[_0x5f12('0xb')](_0x5f12('0x27'));return request({'uri':util[_0x5f12('0xe')](_0x5f12('0x24'),_0x5a5920[_0x5f12('0x1b')])})[_0x5f12('0x25')](function(_0x528dce){logger[_0x5f12('0xb')](_0x5f12('0x26'));return _0x528dce;});}}function getEndUser(_0x40b1af,_0x15d70c,_0x43347d){logger['info'](_0x5f12('0x28'),_0x43347d);return request({'uri':util[_0x5f12('0xe')]('%s/api/v2/contacts',_0x40b1af[_0x5f12('0x1b')]),'qs':{'phone':_0x43347d}})[_0x5f12('0x25')](function(_0x4660b0){if(_0x4660b0[_0x5f12('0x1f')]){logger['info'](_0x5f12('0x29'));return _[_0x5f12('0x21')](_0x4660b0,{'phone':_0x43347d});}else{logger[_0x5f12('0xb')](_0x5f12('0x2a'));return request({'uri':util[_0x5f12('0xe')](_0x5f12('0x2b'),_0x40b1af['remoteUri']),'method':'POST','body':{'name':_0x15d70c,'phone':_0x43347d}})[_0x5f12('0x25')](function(_0x102c23){logger[_0x5f12('0xb')]('Enduser\x20created.');return _0x102c23;});}});}function getAuth(_0x33b9bc){return util[_0x5f12('0xe')]('Basic\x20%s',new Buffer(_0x33b9bc[_0x5f12('0x2c')]+':X')[_0x5f12('0x2d')]('base64'));}function request(_0x1ed69f){logger[_0x5f12('0x2e')]('[HTTP]',JSON[_0x5f12('0x2f')](_0x1ed69f));return rp(_[_0x5f12('0x30')](_0x1ed69f,{'method':_0x5f12('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x6b7b4,_0xf035d6){var _0x13ee26=[];if(_0x6b7b4&&_0x6b7b4[_0x5f12('0x1f')]>0x0){_0x13ee26=_[_0x5f12('0x32')](_0x6b7b4,_0xf035d6);}return _0x13ee26;}function getCustomFields(_0x585fe6,_0x15b14f){var _0x48f3f3=[];var _0x4a522c={'custom_fields':[]};if(_0x585fe6[_0x5f12('0x1f')]>0x0){_['forEach'](_0x585fe6,function(_0x1fa402){if(_0x1fa402['type']==='string'&&_0x1fa402['nameField']&&!_0x1fa402[_0x5f12('0x33')]){_0x4a522c[_0x1fa402['nameField'][_0x5f12('0x34')]()]=_0x1fa402['content']['toString']();}else if(_0x1fa402[_0x5f12('0x35')]===_0x5f12('0x36')&&_0x1fa402[_0x5f12('0x37')]&&_0x1fa402[_0x5f12('0x33')]){_0x4a522c['custom_fields'][_0x5f12('0x38')]({'id':_0x1fa402[_0x5f12('0x37')],'value':_0x1fa402[_0x5f12('0x39')][_0x5f12('0x2d')]()});}else if(_0x1fa402['type']===_0x5f12('0x3a')&&_0x1fa402['variableName']&&_0x1fa402[_0x5f12('0x37')]&&_0x1fa402['customField']){_0x15b14f[_0x1fa402[_0x5f12('0x3b')]]&&_0x4a522c['custom_fields'][_0x5f12('0x38')]({'id':_0x1fa402[_0x5f12('0x37')],'value':_0x15b14f[_0x1fa402[_0x5f12('0x3b')]][_0x5f12('0x2d')]()});}else if(_0x1fa402[_0x5f12('0x35')]===_0x5f12('0x3c')&&_0x1fa402[_0x5f12('0x3d')]&&_0x1fa402[_0x5f12('0x3d')][_0x5f12('0x14')]&&_0x1fa402[_0x5f12('0x37')]&&_0x1fa402['customField']){_0x15b14f[_0x1fa402[_0x5f12('0x3d')][_0x5f12('0x14')][_0x5f12('0x34')]()]&&_0x4a522c[_0x5f12('0x16')][_0x5f12('0x38')]({'id':_0x1fa402[_0x5f12('0x37')],'value':_0x15b14f[_0x1fa402[_0x5f12('0x3d')][_0x5f12('0x14')][_0x5f12('0x34')]()][_0x5f12('0x2d')]()});}});}return _0x4a522c;}exports[_0x5f12('0x3e')]=function(_0x7a441f,_0xd67939,_0x59602b,_0x57712d,_0x3d47fb,_0xc48f23){var _0x40d6b2,_0x39e41e;_0xc48f23[_0x5f12('0x1b')]=intUtil['stripTrailingSlash'](_0xc48f23['remoteUri']);_0xc48f23[_0x5f12('0x3f')]=intUtil[_0x5f12('0x40')](_0xc48f23[_0x5f12('0x3f')]);if(_0x3d47fb&&_0x3d47fb[_0x5f12('0x41')]){logger[_0x5f12('0xb')](_0x5f12('0x42'),_0x5f12('0x43'));_0xd67939[_0x5f12('0x44')]=util['format'](_0x5f12('0x45'),_0xc48f23[_0x5f12('0x3f')],_0xd67939[_0x5f12('0x46')],md5(_0xd67939['uniqueid']));}else{_0xd67939[_0x5f12('0x44')]='';}headers[_0x5f12('0x47')]=getAuth(_0xc48f23);return getUser(_0xc48f23,_0x57712d[_0x5f12('0x23')])[_0x5f12('0x25')](function(_0x40575f){_0x40d6b2=_0x40575f;logger['info'](_0x5f12('0x48'),_0x40d6b2['id']);return getEndUser(_0xc48f23,_0xd67939[_0x5f12('0x10')],_0xd67939[_0x5f12('0x11')]);})[_0x5f12('0x25')](function(_0x1abf36){_0x39e41e=_0x1abf36;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39e41e['id']);return getTicket(_0xc48f23,_0x40d6b2,_0x39e41e,_0x59602b,_0xd67939);})['then'](function(_0x2cbd6b){if(_0x2cbd6b&&_0x2cbd6b['id']){logger[_0x5f12('0xb')](_0x5f12('0x1d'));logger[_0x5f12('0xb')](_0x5f12('0x49'),_0x2cbd6b['id']);logger[_0x5f12('0xb')]('[QUEUE]',_0x5f12('0x4a'));emit(util[_0x5f12('0xe')](_0x5f12('0x4b'),_0x57712d['name']),_0x5f12('0x4c'),{'uri':util[_0x5f12('0xe')]('%s/helpdesk/tickets/%d',_0xc48f23[_0x5f12('0x1b')],_0x2cbd6b['id'])});}})[_0x5f12('0x4d')](function(_0x575d2d){logger[_0x5f12('0x4e')]('[QUEUE]',JSON[_0x5f12('0x2f')](_0x575d2d));});};exports[_0x5f12('0x4f')]=function(_0x43eba8,_0x3cc1b0,_0x2e18cf,_0x2fecda,_0x20c372,_0x57b137,_0x278fa2){var _0x277f8d,_0x5cd49d;_0x57b137[_0x5f12('0x1b')]=intUtil[_0x5f12('0x40')](_0x57b137[_0x5f12('0x1b')]);_0x57b137[_0x5f12('0x3f')]=intUtil['stripTrailingSlash'](_0x57b137['serverUrl']);if(_0x278fa2&&_0x278fa2[_0x5f12('0x50')]&&_0x278fa2[_0x5f12('0x50')]!==_0x5f12('0x51')){logger[_0x5f12('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3cc1b0[_0x5f12('0x44')]=util[_0x5f12('0xe')](_0x5f12('0x45'),_0x57b137[_0x5f12('0x3f')],_0x3cc1b0[_0x5f12('0x46')],md5(_0x3cc1b0['uniqueid']));}headers[_0x5f12('0x47')]=getAuth(_0x57b137);return getUser(_0x57b137,_0x2fecda['email'])['then'](function(_0xb51949){_0x277f8d=_0xb51949;logger[_0x5f12('0xb')](_0x5f12('0x48'),_0x277f8d['id']);return getEndUser(_0x57b137,_0x3cc1b0[_0x5f12('0x52')],_0x3cc1b0[_0x5f12('0x53')]);})[_0x5f12('0x25')](function(_0x4bfce9){_0x5cd49d=_0x4bfce9;logger[_0x5f12('0xb')](_0x5f12('0x54'),_0x5cd49d['id']);return getTicket(_0x57b137,_0x277f8d,_0x5cd49d,_0x2e18cf,_0x3cc1b0);})[_0x5f12('0x25')](function(_0x3e04b2){if(_0x3e04b2&&_0x3e04b2['id']){logger[_0x5f12('0xb')](_0x5f12('0x1d'));logger[_0x5f12('0xb')](_0x5f12('0x49'),_0x3e04b2['id']);logger[_0x5f12('0xb')](_0x5f12('0x55'),_0x5f12('0x4a'));emit(util[_0x5f12('0xe')](_0x5f12('0x4b'),_0x2fecda[_0x5f12('0x14')]),'trigger:browser:url',{'uri':util[_0x5f12('0xe')]('%s/helpdesk/tickets/%d',_0x57b137['remoteUri'],_0x3e04b2['id'])});}})[_0x5f12('0x4d')](function(_0x29dbcc){logger[_0x5f12('0x4e')]('[OUTBOUND]',JSON[_0x5f12('0x2f')](_0x29dbcc));});};exports[_0x5f12('0x56')]=function(_0x3af842,_0x540e71,_0x300868,_0x42777b,_0x31c944,_0x39908c){var _0x77321a,_0x438ad;_0x39908c[_0x5f12('0x1b')]=intUtil[_0x5f12('0x40')](_0x39908c['remoteUri']);_0x39908c[_0x5f12('0x3f')]=intUtil[_0x5f12('0x40')](_0x39908c[_0x5f12('0x3f')]);if(_0x31c944&&_0x31c944[_0x5f12('0x41')]){logger[_0x5f12('0xb')](_0x5f12('0x57'),_0x5f12('0x43'));_0x540e71[_0x5f12('0x44')]=util[_0x5f12('0xe')](_0x5f12('0x45'),_0x39908c['serverUrl'],_0x540e71[_0x5f12('0x46')],md5(_0x540e71['uniqueid']));}else{_0x540e71[_0x5f12('0x44')]='';}headers[_0x5f12('0x47')]=getAuth(_0x39908c);return getUser(_0x39908c,'')[_0x5f12('0x25')](function(_0x539ac5){_0x77321a=_0x539ac5;logger[_0x5f12('0xb')](_0x5f12('0x48'),_0x77321a['id']);return getEndUser(_0x39908c,_0x540e71['calleridname'],_0x540e71['calleridnum']);})[_0x5f12('0x25')](function(_0x379edb){_0x438ad=_0x379edb;logger[_0x5f12('0xb')](_0x5f12('0x54'),_0x438ad['id']);return getTicket(_0x39908c,_0x77321a,_0x438ad,_0x300868,_0x540e71);})[_0x5f12('0x25')](function(_0x370b18){if(_0x370b18){logger[_0x5f12('0xb')](_0x5f12('0x1d'));logger['info'](_0x5f12('0x49'),_0x370b18['id']);}})[_0x5f12('0x4d')](function(_0x2e90d6){logger[_0x5f12('0x4e')](_0x5f12('0x57'),JSON['stringify'](_0x2e90d6));});}; \ 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 31f9dbc..4430998 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 _0x3445=['Token\x20token=','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','destcalleridnum','callDirection','abandoned','outbound','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','util','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','/api/contacts/filters','Getting\x20contacts\x20filter','filters','forEach','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contacts','contactNumber','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','contact','getString','Subjects','Contact','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url'];(function(_0x2c1224,_0x4c6dbf){var _0x3cf4ef=function(_0x101ea0){while(--_0x101ea0){_0x2c1224['push'](_0x2c1224['shift']());}};_0x3cf4ef(++_0x4c6dbf);}(_0x3445,0xbf));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var rp=require(_0x5344('0x1'));var md5=require(_0x5344('0x2'));var util=require(_0x5344('0x3'));var moment=require('moment');var Promise=require(_0x5344('0x4'));var Redis=require(_0x5344('0x5'));var intUtil=require('./util');var config=require(_0x5344('0x6'));var logger=require(_0x5344('0x7'))(_0x5344('0x8'));config[_0x5344('0x9')]=_[_0x5344('0xa')](config[_0x5344('0x9')],{'host':_0x5344('0xb'),'port':0x18eb});var io=require(_0x5344('0xc'))(new Redis(config[_0x5344('0x9')]));function getAdminId(_0xffbb37,_0x55ca79,_0x973cc1,_0x1e4ea2){return new Promise(function(_0x590922,_0x45ef13){var _0x423be2=![];var _0x37e0d0={'method':_0x5344('0xd'),'uri':_0x1e4ea2+'/api/selector/owners','json':!![]};_0x37e0d0[_0x5344('0xe')]=_0x973cc1;logger[_0x5344('0xf')](_0x5344('0x10'));return rp(_0x37e0d0)[_0x5344('0x11')](function(_0x268fcf){if(_0x268fcf){var _0x4dcb62=_0x268fcf[_0x5344('0x12')];var _0x140044=null;for(_0x140044=0x0;_0x140044<_0x4dcb62[_0x5344('0x13')];_0x140044++){if(_0x4dcb62[_0x140044][_0x5344('0x14')]===_0xffbb37[_0x5344('0x15')]){_0xffbb37['adminId']=_0x4dcb62[_0x140044]['id'];_0x423be2=!![];}}if(_0x423be2){logger[_0x5344('0xf')]('Admin\x20found:',_0xffbb37[_0x5344('0x16')]);_0x590922(_0xffbb37);}else{_0x45ef13({'statusCode':0x194,'message':_0x5344('0x17')});}}else{_0x45ef13({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x5344('0x18')](function(_0x2c668a){logger[_0x5344('0x19')]('['+[_0x55ca79[_0x5344('0x1a')]()]+']',_0x2c668a[_0x5344('0x1b')]);_0x45ef13(_0x2c668a);});});}function getUser(_0xd77540,_0x8c0bc0,_0x42209a){return function(_0x356a5c){return new Promise(function(_0x547f24,_0x4599f8){var _0x46fd1a={'method':'GET','uri':_0x42209a+_0x5344('0x1c'),'json':!![]};_0x46fd1a['headers']=_0x8c0bc0;logger[_0x5344('0xf')]('Getting\x20user\x20list');return rp(_0x46fd1a)['then'](function(_0x4c7354){if(_0x4c7354){var _0x9daf9=_0x4c7354['users'];var _0x57b154=![];var _0x45f077=null;if(_0x356a5c[_0x5344('0x1d')]!==null){logger[_0x5344('0xf')](_0x5344('0x1e'),_0x356a5c[_0x5344('0x1d')]);_0x356a5c[_0x5344('0x1f')]=_0x356a5c[_0x5344('0x1d')];for(_0x45f077=0x0;_0x45f077<_0x9daf9[_0x5344('0x13')];_0x45f077++){if(_0x9daf9[_0x45f077]['email']===_0x356a5c[_0x5344('0x1d')]){_0x57b154=!![];_0x356a5c[_0x5344('0x20')]=_0x9daf9[_0x45f077]['id'];logger[_0x5344('0xf')](_0x5344('0x21'),_0x356a5c[_0x5344('0x20')]);}}}if(!_0x57b154){logger[_0x5344('0xf')](_0x5344('0x22'));_0x356a5c[_0x5344('0x1f')]=_0x356a5c[_0x5344('0x15')];_0x356a5c[_0x5344('0x20')]=_0x356a5c[_0x5344('0x16')];_0x57b154=!![];}if(_0x57b154){_0x547f24(_0x356a5c);}else{_0x4599f8({'statusCode':0x194,'message':_0x5344('0x17')});}}else{_0x4599f8({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x2ef267){logger['error']('['+[_0xd77540[_0x5344('0x1a')]()]+']',_0x2ef267[_0x5344('0x1b')]);_0x4599f8(_0x2ef267);});});};}function getEndUser(_0x2072f8,_0x4468d9,_0x48a14f){return function(_0x5f0e78){return new Promise(function(_0x564dff,_0x41b70d){var _0x32d88f=0x0;var _0xcea2cc={'method':_0x5344('0xd'),'uri':_0x48a14f+_0x5344('0x23'),'json':!![]};_0xcea2cc[_0x5344('0xe')]=_0x4468d9;logger[_0x5344('0xf')](_0x5344('0x24'));return rp(_0xcea2cc)[_0x5344('0x11')](function(_0x3993c7){_0x3993c7[_0x5344('0x25')][_0x5344('0x26')](function(_0x4627b9){if(_0x4627b9['name']===_0x5344('0x27')){_0x32d88f=_0x4627b9['id'];}});})[_0x5344('0x11')](function(){logger[_0x5344('0xf')](_0x5344('0x28'));var _0x3feb5d={'method':_0x5344('0xd'),'uri':_0x48a14f+_0x5344('0x29')+_0x32d88f,'json':!![]};_0x3feb5d['headers']=_0x4468d9;return rp(_0x3feb5d);})['then'](function(_0x313328){logger['info'](_0x5344('0x2a'),_0x5f0e78['contactNumber']);if(_0x313328[_0x5344('0x2b')][_0x5344('0x13')]>0x0){var _0x4d7032=_['find'](_0x313328[_0x5344('0x2b')],function(_0x55f212){if(_0x55f212['work_number']===_0x5f0e78[_0x5344('0x2c')]||_0x55f212[_0x5344('0x2d')]===_0x5f0e78[_0x5344('0x2c')]){return _0x55f212;}});if(_0x4d7032){_0x5f0e78[_0x5344('0x2e')]=_0x4d7032['id'];logger['info'](_0x5344('0x2f'),_0x5f0e78[_0x5344('0x2e')]);_0x564dff(_0x5f0e78);}else{return createEndUser(_0x5f0e78,_0x2072f8,_0x4468d9,_0x48a14f)[_0x5344('0x11')](function(_0x4d3948){logger[_0x5344('0xf')](_0x5344('0x30'),_0x5f0e78['endUserId']);_0x564dff(_0x4d3948);});}}else{return createEndUser(_0x5f0e78,_0x2072f8,_0x4468d9,_0x48a14f)[_0x5344('0x11')](function(_0x372750){logger[_0x5344('0xf')](_0x5344('0x30'),_0x5f0e78[_0x5344('0x2e')]);_0x564dff(_0x372750);});}})['catch'](function(_0x4da9e9){throw new Error(_0x4da9e9['message']);});});};}function createEndUser(_0x8c249a,_0x57b891,_0x311c5c,_0x2969e1){return new Promise(function(_0x423c24,_0x3c584c){var _0x5703fc=moment();var _0x568231={'method':_0x5344('0x31'),'uri':_0x2969e1+_0x5344('0x32'),'body':{'contact':{'last_name':_0x8c249a[_0x5344('0x2c')],'work_number':_0x8c249a[_0x5344('0x2c')],'mobile_number':_0x8c249a['contactNumber'],'owner_id':_0x8c249a['userId'],'created_at':_0x5703fc[_0x5344('0x33')](_0x5344('0x34'))}},'json':!![]};_0x568231['headers']=_0x311c5c;logger[_0x5344('0xf')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x568231)[_0x5344('0x11')](function(_0x36cbcf){_0x8c249a[_0x5344('0x2e')]=_0x36cbcf[_0x5344('0x35')]['id'];_0x423c24(_0x8c249a);})[_0x5344('0x18')](function(_0x592e45){logger[_0x5344('0x19')]('['+[_0x57b891[_0x5344('0x1a')]()]+']',_0x592e45[_0x5344('0x1b')]);_0x3c584c(_0x592e45[_0x5344('0x1b')]);});});}function getTicket(_0x30fa46,_0x40b6eb,_0x359096,_0x5ed8d7,_0x3bc1ab){return function(_0x3b4f0b){logger[_0x5344('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x3efe8a,_0x347548){var _0x56df86=moment();var _0x129b76={'method':_0x5344('0x31'),'uri':_0x359096+'/api/tasks','body':{'title':intUtil[_0x5344('0x36')](_0x5ed8d7[_0x5344('0x37')],_0x3bc1ab,'\x20'),'description':intUtil[_0x5344('0x36')](_0x5ed8d7['Descriptions'],_0x3bc1ab,'\x0a'),'owner_id':_0x3b4f0b['userId'],'creater_id':_0x3b4f0b[_0x5344('0x16')],'targetable_id':_0x3b4f0b['endUserId'],'targetable_type':_0x5344('0x38'),'created_at':_0x56df86[_0x5344('0x33')](_0x5344('0x34')),'due_date':_0x56df86['add'](0x1e,'m')['format'](_0x5344('0x34'))},'json':!![]};_0x129b76[_0x5344('0xe')]=_0x40b6eb;return rp(_0x129b76)[_0x5344('0x11')](function(_0x5253ff){_0x3b4f0b['ticketId']=_0x5253ff[_0x5344('0x39')]['id'];logger[_0x5344('0xf')](_0x5344('0x3a'),_0x3b4f0b[_0x5344('0x3b')]);_0x3efe8a(_0x3b4f0b);})[_0x5344('0x18')](function(_0x594918){logger[_0x5344('0x19')]('['+[_0x30fa46[_0x5344('0x1a')]()]+']',_0x594918['message']);_0x347548(_0x594918['message']);});});};}function emit(_0x415581,_0x4b1f85,_0x3e743b){var _0x1aeed0={'uri':_0x415581+_0x5344('0x3c')+_0x3e743b};io['to'](util[_0x5344('0x33')](_0x5344('0x3d'),_0x4b1f85))[_0x5344('0x3e')](_0x5344('0x3f'),_0x1aeed0);}exports['cs']=function(_0x293677,_0x5c3757,_0x3e2dc8,_0x374954,_0x158d21,_0x5b261c,_0x327973,_0x3ffee5){var _0x1b08f5={};var _0x4bb549={'Authorization':_0x5344('0x40')+_0x5b261c['apiKey']};_0x5b261c['remoteUri']=intUtil[_0x5344('0x41')](_0x5b261c[_0x5344('0x42')]);_0x5b261c['serverUrl']=intUtil[_0x5344('0x41')](_0x5b261c[_0x5344('0x43')]);var _0x23caa9=_0x5b261c['remoteUri'];_0x1b08f5[_0x5344('0x15')]=_0x5b261c[_0x5344('0x44')];_0x1b08f5[_0x5344('0x2c')]=_0x3ffee5[_0x5344('0x45')]()==='outbound'?_0x5c3757[_0x5344('0x46')]:_0x5c3757['calleridnum'];_0x1b08f5[_0x5344('0x47')]=_0x3ffee5==='queue'||_0x3ffee5===_0x5344('0x48')?'queue':_0x5344('0x49');if(_0x374954){_0x1b08f5[_0x5344('0x1d')]=_0x374954[_0x5344('0x14')];}var _0x50255a=util[_0x5344('0x33')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b261c['serverUrl'],_0x5c3757[_0x5344('0x4a')],md5(_0x5c3757[_0x5344('0x4a')]));if(_0x158d21&&_0x158d21[_0x5344('0x4b')]){logger[_0x5344('0xf')]('[QUEUE]',_0x5344('0x4c'));_0x5c3757[_0x5344('0x4d')]=_0x50255a;}else if(_0x327973&&_0x327973[_0x5344('0x4e')]&&_0x327973['recordingFormat']!==_0x5344('0x4f')){logger['info'](_0x5344('0x50'),_0x5344('0x4c'));_0x5c3757['recordingURL']=_0x50255a;}else{_0x5c3757[_0x5344('0x4d')]='';}return getAdminId(_0x1b08f5,_0x3ffee5,_0x4bb549,_0x23caa9)['then'](getUser(_0x3ffee5,_0x4bb549,_0x23caa9))['then'](getEndUser(_0x3ffee5,_0x4bb549,_0x23caa9))[_0x5344('0x11')](getTicket(_0x3ffee5,_0x4bb549,_0x23caa9,_0x3e2dc8,_0x5c3757))['then'](function(_0x733466){logger['info'](util[_0x5344('0x33')](_0x5344('0x51'),_0x733466['ticketId']));if(_0x3ffee5!==_0x5344('0x48')){logger[_0x5344('0xf')]('['+[_0x3ffee5['toUpperCase']()]+']',_0x5344('0x52'));emit(_0x23caa9,_0x374954[_0x5344('0x53')],_0x733466[_0x5344('0x2e')]);}})[_0x5344('0x18')](function(_0x3f910e){logger[_0x5344('0x19')]('['+[_0x3ffee5[_0x5344('0x1a')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x5344('0x54')](_0x3f910e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2bfb=['/api/selector/owners','headers','info','then','users','length','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','message','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','error','toUpperCase','/api/contacts/filters','filters','forEach','name','Getting\x20contact\x20list','GET','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','work_number','mobile_number','Contact\x20found:','endUserId','Contact\x20created:','catch','format','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','add','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','user:%s','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','abandoned','outbound','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','recordingFormat','none','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','./util','../../../../config/environment','freshsales','redis','socket.io-emitter'];(function(_0x1890a8,_0x42a2b2){var _0x420c6d=function(_0x2baa82){while(--_0x2baa82){_0x1890a8['push'](_0x1890a8['shift']());}};_0x420c6d(++_0x42a2b2);}(_0x2bfb,0x13a));var _0xb2bf=function(_0xe2275a,_0x33e4b3){_0xe2275a=_0xe2275a-0x0;var _0x299b0a=_0x2bfb[_0xe2275a];return _0x299b0a;};'use strict';var _=require(_0xb2bf('0x0'));var rp=require(_0xb2bf('0x1'));var md5=require(_0xb2bf('0x2'));var util=require(_0xb2bf('0x3'));var moment=require('moment');var Promise=require(_0xb2bf('0x4'));var Redis=require('ioredis');var intUtil=require(_0xb2bf('0x5'));var config=require(_0xb2bf('0x6'));var logger=require('../../../../config/logger')(_0xb2bf('0x7'));config[_0xb2bf('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb2bf('0x9'))(new Redis(config['redis']));function getAdminId(_0x1eae2a,_0xe46c49,_0x156fa2,_0x3c3de8){return new Promise(function(_0x307836,_0x180db1){var _0x379ea9=![];var _0x4523bc={'method':'GET','uri':_0x3c3de8+_0xb2bf('0xa'),'json':!![]};_0x4523bc[_0xb2bf('0xb')]=_0x156fa2;logger[_0xb2bf('0xc')]('Getting\x20admin\x20information');return rp(_0x4523bc)[_0xb2bf('0xd')](function(_0x31e385){if(_0x31e385){var _0x5bc0b0=_0x31e385[_0xb2bf('0xe')];var _0x215413=null;for(_0x215413=0x0;_0x215413<_0x5bc0b0[_0xb2bf('0xf')];_0x215413++){if(_0x5bc0b0[_0x215413]['email']===_0x1eae2a[_0xb2bf('0x10')]){_0x1eae2a[_0xb2bf('0x11')]=_0x5bc0b0[_0x215413]['id'];_0x379ea9=!![];}}if(_0x379ea9){logger['info']('Admin\x20found:',_0x1eae2a[_0xb2bf('0x11')]);_0x307836(_0x1eae2a);}else{_0x180db1({'statusCode':0x194,'message':_0xb2bf('0x12')});}}else{_0x180db1({'statusCode':0x194,'message':_0xb2bf('0x12')});}})['catch'](function(_0x5beffc){logger['error']('['+[_0xe46c49['toUpperCase']()]+']',_0x5beffc[_0xb2bf('0x13')]);_0x180db1(_0x5beffc);});});}function getUser(_0x560139,_0x18d4be,_0x5a5f17){return function(_0xce08c5){return new Promise(function(_0x12a3ea,_0x104f14){var _0x30d07d={'method':'GET','uri':_0x5a5f17+_0xb2bf('0xa'),'json':!![]};_0x30d07d[_0xb2bf('0xb')]=_0x18d4be;logger['info']('Getting\x20user\x20list');return rp(_0x30d07d)[_0xb2bf('0xd')](function(_0x6830e2){if(_0x6830e2){var _0x288cea=_0x6830e2['users'];var _0xe6892b=![];var _0x985a37=null;if(_0xce08c5[_0xb2bf('0x14')]!==null){logger[_0xb2bf('0xc')](_0xb2bf('0x15'),_0xce08c5['agentEmail']);_0xce08c5['userEmail']=_0xce08c5[_0xb2bf('0x14')];for(_0x985a37=0x0;_0x985a37<_0x288cea[_0xb2bf('0xf')];_0x985a37++){if(_0x288cea[_0x985a37]['email']===_0xce08c5[_0xb2bf('0x14')]){_0xe6892b=!![];_0xce08c5[_0xb2bf('0x16')]=_0x288cea[_0x985a37]['id'];logger['info'](_0xb2bf('0x17'),_0xce08c5['userId']);}}}if(!_0xe6892b){logger[_0xb2bf('0xc')]('Admin\x20selected');_0xce08c5['userEmail']=_0xce08c5[_0xb2bf('0x10')];_0xce08c5[_0xb2bf('0x16')]=_0xce08c5[_0xb2bf('0x11')];_0xe6892b=!![];}if(_0xe6892b){_0x12a3ea(_0xce08c5);}else{_0x104f14({'statusCode':0x194,'message':_0xb2bf('0x12')});}}else{_0x104f14({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x8d4495){logger[_0xb2bf('0x18')]('['+[_0x560139[_0xb2bf('0x19')]()]+']',_0x8d4495[_0xb2bf('0x13')]);_0x104f14(_0x8d4495);});});};}function getEndUser(_0xf2ed0c,_0x3f579a,_0x9851c4){return function(_0x142194){return new Promise(function(_0x15d5e0,_0x4f0235){var _0x3e157a=0x0;var _0x4f284e={'method':'GET','uri':_0x9851c4+_0xb2bf('0x1a'),'json':!![]};_0x4f284e[_0xb2bf('0xb')]=_0x3f579a;logger[_0xb2bf('0xc')]('Getting\x20contacts\x20filter');return rp(_0x4f284e)['then'](function(_0x3c69d3){_0x3c69d3[_0xb2bf('0x1b')][_0xb2bf('0x1c')](function(_0x49fe75){if(_0x49fe75[_0xb2bf('0x1d')]==='All\x20Contacts'){_0x3e157a=_0x49fe75['id'];}});})[_0xb2bf('0xd')](function(){logger[_0xb2bf('0xc')](_0xb2bf('0x1e'));var _0x192dd1={'method':_0xb2bf('0x1f'),'uri':_0x9851c4+_0xb2bf('0x20')+_0x3e157a,'json':!![]};_0x192dd1['headers']=_0x3f579a;return rp(_0x192dd1);})[_0xb2bf('0xd')](function(_0x59f342){logger['info'](_0xb2bf('0x21'),_0x142194[_0xb2bf('0x22')]);if(_0x59f342[_0xb2bf('0x23')][_0xb2bf('0xf')]>0x0){var _0x2cd6cc=_['find'](_0x59f342[_0xb2bf('0x23')],function(_0x5303c1){if(_0x5303c1[_0xb2bf('0x24')]===_0x142194[_0xb2bf('0x22')]||_0x5303c1[_0xb2bf('0x25')]===_0x142194['contactNumber']){return _0x5303c1;}});if(_0x2cd6cc){_0x142194['endUserId']=_0x2cd6cc['id'];logger[_0xb2bf('0xc')](_0xb2bf('0x26'),_0x142194[_0xb2bf('0x27')]);_0x15d5e0(_0x142194);}else{return createEndUser(_0x142194,_0xf2ed0c,_0x3f579a,_0x9851c4)['then'](function(_0x353d18){logger[_0xb2bf('0xc')](_0xb2bf('0x28'),_0x142194['endUserId']);_0x15d5e0(_0x353d18);});}}else{return createEndUser(_0x142194,_0xf2ed0c,_0x3f579a,_0x9851c4)['then'](function(_0x2966b6){logger['info'](_0xb2bf('0x28'),_0x142194[_0xb2bf('0x27')]);_0x15d5e0(_0x2966b6);});}})[_0xb2bf('0x29')](function(_0xa0542f){throw new Error(_0xa0542f[_0xb2bf('0x13')]);});});};}function createEndUser(_0x4a8bf3,_0x2ecdf6,_0x53b7ee,_0x59c87d){return new Promise(function(_0x239cfe,_0x4b8631){var _0x5be5f5=moment();var _0x451e32={'method':'POST','uri':_0x59c87d+'/api/contacts','body':{'contact':{'last_name':_0x4a8bf3['contactNumber'],'work_number':_0x4a8bf3['contactNumber'],'mobile_number':_0x4a8bf3[_0xb2bf('0x22')],'owner_id':_0x4a8bf3[_0xb2bf('0x16')],'created_at':_0x5be5f5[_0xb2bf('0x2a')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x451e32[_0xb2bf('0xb')]=_0x53b7ee;logger[_0xb2bf('0xc')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x451e32)[_0xb2bf('0xd')](function(_0x3feef5){_0x4a8bf3[_0xb2bf('0x27')]=_0x3feef5[_0xb2bf('0x2b')]['id'];_0x239cfe(_0x4a8bf3);})['catch'](function(_0x2f935f){logger[_0xb2bf('0x18')]('['+[_0x2ecdf6['toUpperCase']()]+']',_0x2f935f[_0xb2bf('0x13')]);_0x4b8631(_0x2f935f[_0xb2bf('0x13')]);});});}function getTicket(_0x23eddd,_0xd7875b,_0x163ac6,_0x5e8ef7,_0x17d3f5){return function(_0x2c39cc){logger[_0xb2bf('0xc')](_0xb2bf('0x2c'));return new Promise(function(_0x2e7ae4,_0x47bc69){var _0x50a604=moment();var _0x439004={'method':_0xb2bf('0x2d'),'uri':_0x163ac6+_0xb2bf('0x2e'),'body':{'title':intUtil[_0xb2bf('0x2f')](_0x5e8ef7[_0xb2bf('0x30')],_0x17d3f5,'\x20'),'description':intUtil['getString'](_0x5e8ef7[_0xb2bf('0x31')],_0x17d3f5,'\x0a'),'owner_id':_0x2c39cc[_0xb2bf('0x16')],'creater_id':_0x2c39cc[_0xb2bf('0x11')],'targetable_id':_0x2c39cc[_0xb2bf('0x27')],'targetable_type':_0xb2bf('0x32'),'created_at':_0x50a604[_0xb2bf('0x2a')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x50a604[_0xb2bf('0x33')](0x1e,'m')[_0xb2bf('0x2a')](_0xb2bf('0x34'))},'json':!![]};_0x439004[_0xb2bf('0xb')]=_0xd7875b;return rp(_0x439004)[_0xb2bf('0xd')](function(_0x1980db){_0x2c39cc[_0xb2bf('0x35')]=_0x1980db[_0xb2bf('0x36')]['id'];logger[_0xb2bf('0xc')](_0xb2bf('0x37'),_0x2c39cc[_0xb2bf('0x35')]);_0x2e7ae4(_0x2c39cc);})[_0xb2bf('0x29')](function(_0x5a557d){logger[_0xb2bf('0x18')]('['+[_0x23eddd[_0xb2bf('0x19')]()]+']',_0x5a557d[_0xb2bf('0x13')]);_0x47bc69(_0x5a557d[_0xb2bf('0x13')]);});});};}function emit(_0x38ee3c,_0x254c3c,_0x102c65){var _0x415de2={'uri':_0x38ee3c+'/contacts/'+_0x102c65};io['to'](util[_0xb2bf('0x2a')](_0xb2bf('0x38'),_0x254c3c))['emit'](_0xb2bf('0x39'),_0x415de2);}exports['cs']=function(_0x467206,_0x270877,_0x5b00f2,_0x328435,_0x39af77,_0x50aed8,_0x5fae2a,_0x48406b){var _0x3c033b={};var _0x1eab28={'Authorization':_0xb2bf('0x3a')+_0x50aed8['apiKey']};_0x50aed8[_0xb2bf('0x3b')]=intUtil[_0xb2bf('0x3c')](_0x50aed8[_0xb2bf('0x3b')]);_0x50aed8['serverUrl']=intUtil['stripTrailingSlash'](_0x50aed8[_0xb2bf('0x3d')]);var _0x2e9b96=_0x50aed8[_0xb2bf('0x3b')];_0x3c033b['adminEmail']=_0x50aed8[_0xb2bf('0x3e')];_0x3c033b[_0xb2bf('0x22')]=_0x48406b[_0xb2bf('0x3f')]()==='outbound'?_0x270877[_0xb2bf('0x40')]:_0x270877[_0xb2bf('0x41')];_0x3c033b[_0xb2bf('0x42')]=_0x48406b===_0xb2bf('0x43')||_0x48406b===_0xb2bf('0x44')?_0xb2bf('0x43'):_0xb2bf('0x45');if(_0x328435){_0x3c033b[_0xb2bf('0x14')]=_0x328435[_0xb2bf('0x46')];}var _0x4d93c3=util[_0xb2bf('0x2a')](_0xb2bf('0x47'),_0x50aed8['serverUrl'],_0x270877['uniqueid'],md5(_0x270877['uniqueid']));if(_0x39af77&&_0x39af77[_0xb2bf('0x48')]){logger[_0xb2bf('0xc')](_0xb2bf('0x49'),'Recording\x20is\x20enabled!');_0x270877['recordingURL']=_0x4d93c3;}else if(_0x5fae2a&&_0x5fae2a['recordingFormat']&&_0x5fae2a[_0xb2bf('0x4a')]!==_0xb2bf('0x4b')){logger[_0xb2bf('0xc')]('[OUTBOUND]',_0xb2bf('0x4c'));_0x270877[_0xb2bf('0x4d')]=_0x4d93c3;}else{_0x270877[_0xb2bf('0x4d')]='';}return getAdminId(_0x3c033b,_0x48406b,_0x1eab28,_0x2e9b96)[_0xb2bf('0xd')](getUser(_0x48406b,_0x1eab28,_0x2e9b96))[_0xb2bf('0xd')](getEndUser(_0x48406b,_0x1eab28,_0x2e9b96))[_0xb2bf('0xd')](getTicket(_0x48406b,_0x1eab28,_0x2e9b96,_0x5b00f2,_0x270877))[_0xb2bf('0xd')](function(_0x39aed5){logger[_0xb2bf('0xc')](util['format'](_0xb2bf('0x4e'),_0x39aed5['ticketId']));if(_0x48406b!==_0xb2bf('0x44')){logger[_0xb2bf('0xc')]('['+[_0x48406b[_0xb2bf('0x19')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x2e9b96,_0x328435['name'],_0x39aed5[_0xb2bf('0x27')]);}})['catch'](function(_0x670c64){logger[_0xb2bf('0x18')]('['+[_0x48406b['toUpperCase']()]+_0xb2bf('0x4f'),util[_0xb2bf('0x50')](_0x670c64,{'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 a5807d5..76c5587 100644 --- a/server/services/ami/trigger/integration/index.js +++ b/server/services/ami/trigger/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','vtiger','servicenow','exec','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','log','abandoned','zendesk','zoho','desk','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./freshdesk','./desk'];(function(_0x32596d,_0xa23533){var _0x161144=function(_0x5d38d1){while(--_0x5d38d1){_0x32596d['push'](_0x32596d['shift']());}};_0x161144(++_0xa23533);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var zendesk=require(_0x0a9e('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x0a9e('0x3'));var zoho=require('./zoho');var desk=require(_0x0a9e('0x4'));var vtiger=require(_0x0a9e('0x5'));var servicenow=require(_0x0a9e('0x6'));var dynamics365=require(_0x0a9e('0x7'));var freshsales=require(_0x0a9e('0x8'));var integrations=['zendesk',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'zoho','desk',_0x0a9e('0xc'),'dynamics365','freshsales',_0x0a9e('0xd')];exports[_0x0a9e('0xe')]=function(_0x307b3e,_0x3ab53f,_0xfeb75b,_0xbd1168,_0x4a4c56,_0x50dfb2){if(_0xfeb75b){if(_['includes'](integrations,_0x307b3e['data1'][_0x0a9e('0xf')]())){try{var _0x36471c=null;var _0xd5b662='';var _0x26d672=_0xfeb75b[_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]()];if(_0x26d672){var _0x5db4b0=_0x26d672[_0x307b3e[_0x0a9e('0x11')]];if(_0x5db4b0){var _0x239b12=_[_0x0a9e('0x12')](_0x5db4b0[_0x0a9e('0x13')],{'id':parseInt(_0x307b3e[_0x0a9e('0x14')],0xa)});if(_0x239b12){if(_0xbd1168){if(_0x4a4c56&&_0x3ab53f[_0x0a9e('0x15')]){_0xd5b662='queue';}else if(_0x3ab53f[_0x0a9e('0x16')]){_0xd5b662='outbound';}else{console[_0x0a9e('0x17')]('EVENT\x20UNKNOWN',_0x3ab53f);}}else{_0xd5b662=_0x0a9e('0x18');}switch(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']()){case _0x0a9e('0x19'):zendesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case'salesforce':salesforce[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xa'):sugarcrm[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xb'):freshdesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1a'):zoho[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1b'):desk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xc'):vtiger[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1c'):freshsales['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);case _0x0a9e('0xd'):servicenow['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;case _0x0a9e('0x1d'):dynamics365['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;default:console[_0x0a9e('0x17')](_0x0a9e('0x1e'));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']());_0x36471c[_0x0a9e('0x20')](_0x0a9e('0x21'),util['format'](_0x0a9e('0x22'),_0x307b3e['data1']['toLowerCase'](),_0x307b3e[_0x0a9e('0x14')]));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]());_0x36471c['error'](_0x0a9e('0x21'),util[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')](),_0x307b3e[_0x0a9e('0x11')]));}}else{}}catch(_0x16b1ca){console['error'](_0x16b1ca);}}}}; \ No newline at end of file +var _0xa9e0=['./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','vtiger','servicenow','exec','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','log','abandoned','zendesk','zoho','desk','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./freshdesk','./desk'];(function(_0x4587e0,_0x5202c2){var _0x5138d8=function(_0x2b6b7e){while(--_0x2b6b7e){_0x4587e0['push'](_0x4587e0['shift']());}};_0x5138d8(++_0x5202c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var zendesk=require(_0x0a9e('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x0a9e('0x3'));var zoho=require('./zoho');var desk=require(_0x0a9e('0x4'));var vtiger=require(_0x0a9e('0x5'));var servicenow=require(_0x0a9e('0x6'));var dynamics365=require(_0x0a9e('0x7'));var freshsales=require(_0x0a9e('0x8'));var integrations=['zendesk',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'zoho','desk',_0x0a9e('0xc'),'dynamics365','freshsales',_0x0a9e('0xd')];exports[_0x0a9e('0xe')]=function(_0x307b3e,_0x3ab53f,_0xfeb75b,_0xbd1168,_0x4a4c56,_0x50dfb2){if(_0xfeb75b){if(_['includes'](integrations,_0x307b3e['data1'][_0x0a9e('0xf')]())){try{var _0x36471c=null;var _0xd5b662='';var _0x26d672=_0xfeb75b[_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]()];if(_0x26d672){var _0x5db4b0=_0x26d672[_0x307b3e[_0x0a9e('0x11')]];if(_0x5db4b0){var _0x239b12=_[_0x0a9e('0x12')](_0x5db4b0[_0x0a9e('0x13')],{'id':parseInt(_0x307b3e[_0x0a9e('0x14')],0xa)});if(_0x239b12){if(_0xbd1168){if(_0x4a4c56&&_0x3ab53f[_0x0a9e('0x15')]){_0xd5b662='queue';}else if(_0x3ab53f[_0x0a9e('0x16')]){_0xd5b662='outbound';}else{console[_0x0a9e('0x17')]('EVENT\x20UNKNOWN',_0x3ab53f);}}else{_0xd5b662=_0x0a9e('0x18');}switch(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']()){case _0x0a9e('0x19'):zendesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case'salesforce':salesforce[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xa'):sugarcrm[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xb'):freshdesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1a'):zoho[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1b'):desk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xc'):vtiger[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1c'):freshsales['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);case _0x0a9e('0xd'):servicenow['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;case _0x0a9e('0x1d'):dynamics365['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;default:console[_0x0a9e('0x17')](_0x0a9e('0x1e'));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']());_0x36471c[_0x0a9e('0x20')](_0x0a9e('0x21'),util['format'](_0x0a9e('0x22'),_0x307b3e['data1']['toLowerCase'](),_0x307b3e[_0x0a9e('0x14')]));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]());_0x36471c['error'](_0x0a9e('0x21'),util[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')](),_0x307b3e[_0x0a9e('0x11')]));}}else{}}catch(_0x16b1ca){console['error'](_0x16b1ca);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index a020d7d..2a59757 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 _0x3a59=['Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','execute','Lead','contact','lead','Case','Enduser\x20with\x20phone\x20%s\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','create','length','string','idField','content','toString','variableName','type','Variable','name','toLowerCase','password','Connection','remoteUri','https://login.salesforce.com','clientId','login','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','stringify','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','abandoned','[ABANDONED]','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','catch','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','ticketType','Task','assign','utc','Subjects','getString','WhoId','Descriptions','ContactId','sobject','isNil','validateEmail','User','find','Email','Agent\x20%s\x20found.','resolve'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x3a59,0x128));var _0x93a5=function(_0x418549,_0x11b13d){_0x418549=_0x418549-0x0;var _0x288826=_0x3a59[_0x418549];return _0x288826;};'use strict';var _=require(_0x93a5('0x0'));var rp=require(_0x93a5('0x1'));var moment=require(_0x93a5('0x2'));var BPromise=require(_0x93a5('0x3'));var md5=require(_0x93a5('0x4'));var jsforce=require(_0x93a5('0x5'));var util=require(_0x93a5('0x6'));var Redis=require(_0x93a5('0x7'));var intUtil=require(_0x93a5('0x8'));var config=require(_0x93a5('0x9'));var logger=require('../../../../config/logger')(_0x93a5('0xa'));config[_0x93a5('0xb')]=_[_0x93a5('0xc')](config[_0x93a5('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x93a5('0xd'))(new Redis(config[_0x93a5('0xb')]));function emit(_0x181b69,_0x5489ac,_0x2947a0){io['to'](_0x181b69)['emit'](_0x5489ac,_0x2947a0);}function getTicket(_0x4ee8eb,_0x1bc2d8,_0x3ca712,_0x54a7d1,_0x272d76,_0x4dbc4d,_0x24ad98,_0x3dc100){var _0x3220f6={};if(_0x54a7d1[_0x93a5('0xe')]===_0x93a5('0xf')){_0x3220f6=Object[_0x93a5('0x10')]({},{'OwnerId':_0x1bc2d8['id'],'ActivityDate':moment[_0x93a5('0x11')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x54a7d1[_0x93a5('0x12')],_0x272d76,'\x20'),'Description':intUtil[_0x93a5('0x13')](_0x54a7d1['Descriptions'],_0x272d76,'\x0a')},getCustomFields(_0x4dbc4d,_0x272d76));if(_0x3ca712){_0x3220f6[_0x93a5('0x14')]=_0x3ca712['id'];}}else if(_0x54a7d1['ticketType']==='Case'){_0x3220f6=Object[_0x93a5('0x10')]({},{'OwnerId':_0x1bc2d8['id'],'Subject':intUtil['getString'](_0x54a7d1[_0x93a5('0x12')],_0x272d76,'\x20'),'Description':intUtil['getString'](_0x54a7d1[_0x93a5('0x15')],_0x272d76,'\x0a')},getCustomFields(_0x4dbc4d,_0x272d76));if(_0x3ca712){_0x3220f6[_0x93a5('0x16')]=_0x3ca712['id'];}}return _0x24ad98[_0x93a5('0x17')](_0x54a7d1[_0x93a5('0xe')])['create'](_0x3220f6);}function getUser(_0x1f6f5b,_0x4e69be,_0x4608df){if(!_[_0x93a5('0x18')](_0x4e69be)&&intUtil[_0x93a5('0x19')](_0x4e69be)){var _0x410101={'Email':_0x4e69be};var _0x37d785={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4608df[_0x93a5('0x17')](_0x93a5('0x1a'))[_0x93a5('0x1b')](_0x410101,_0x37d785)['execute']()['then'](function(_0x105737){if(_0x105737['length']){var _0x1616c5=_[_0x93a5('0x1b')](_0x105737,function(_0x3cf61f){return _0x3cf61f[_0x93a5('0x1c')]===_0x4e69be;});if(_0x1616c5){logger['info'](_0x93a5('0x1d'),_0x4e69be);return BPromise[_0x93a5('0x1e')]({'id':_0x1616c5['Id'],'name':_0x1616c5[_0x93a5('0x1f')]});}}else{logger[_0x93a5('0x20')](_0x93a5('0x21'),_0x4e69be);return _0x4608df[_0x93a5('0x22')]()[_0x93a5('0x23')](function(_0x32978c){return BPromise['resolve']({'id':_0x32978c[_0x93a5('0x24')],'name':_0x32978c[_0x93a5('0x25')]});});}});}else{logger[_0x93a5('0x20')](_0x93a5('0x21'),_0x4e69be);return _0x4608df[_0x93a5('0x22')]()[_0x93a5('0x23')](function(_0x49a0d1){return BPromise[_0x93a5('0x1e')]({'id':_0x49a0d1[_0x93a5('0x24')],'name':_0x49a0d1[_0x93a5('0x25')]});});}}function getEndUser(_0xc6eab3,_0x5a311d,_0x16eff2,_0x570deb,_0x70a0ec){var _0x42d8c1={'Phone':_0x570deb};var _0x5c9f0c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x93a5('0x1e')]()[_0x93a5('0x23')](function(){if(_0x5a311d['ticketType']===_0x93a5('0xf')){logger[_0x93a5('0x20')](_0x93a5('0x26'),_0x570deb,_0x5a311d[_0x93a5('0x27')]);switch(_0x5a311d['moduleSearch']){case _0x93a5('0x28'):return _0x70a0ec['sobject'](_0x93a5('0x29'))[_0x93a5('0x1b')](_0x42d8c1,_0x5c9f0c)[_0x93a5('0x2a')]()[_0x93a5('0x23')](function(_0x22b32b){if(_0x22b32b&&_0x22b32b['length']){return _0x22b32b;}else{return _0x70a0ec['sobject'](_0x93a5('0x2b'))[_0x93a5('0x1b')](_0x42d8c1,_0x5c9f0c);}});case _0x93a5('0x2c'):return _0x70a0ec[_0x93a5('0x17')](_0x93a5('0x29'))['find'](_0x42d8c1,_0x5c9f0c)[_0x93a5('0x2a')]();case _0x93a5('0x2d'):return _0x70a0ec['sobject']('Lead')[_0x93a5('0x1b')](_0x42d8c1,_0x5c9f0c);default:return null;}}else if(_0x5a311d[_0x93a5('0xe')]===_0x93a5('0x2e')){logger[_0x93a5('0x20')](_0x93a5('0x26'),_0x570deb,_0x93a5('0x2c'));return _0x70a0ec[_0x93a5('0x17')](_0x93a5('0x29'))[_0x93a5('0x1b')](_0x42d8c1,_0x5c9f0c)['execute']();}})[_0x93a5('0x23')](function(_0x19a4ad){if(_0x19a4ad&&_0x19a4ad['length']){var _0x5e7d5b=_['find'](_0x19a4ad,function(_0x4174bd){return _0x4174bd['Phone']===_0x570deb;});if(_0x5e7d5b){return BPromise[_0x93a5('0x1e')]({'id':_0x5e7d5b['Id'],'name':_0x5e7d5b['Name'],'phone':_0x5e7d5b['Phone']});}}})[_0x93a5('0x23')](function(_0x131c56){if(_0x131c56){logger[_0x93a5('0x20')](_0x93a5('0x2f'),_0x570deb);return BPromise[_0x93a5('0x1e')](_0x131c56);}else{logger[_0x93a5('0x20')]('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x570deb);var _0x28d823={'LastName':_0x16eff2!==_0x93a5('0x30')?_0x16eff2:util[_0x93a5('0x31')](_0x93a5('0x32'),_0x570deb),'Phone':_0x570deb};if(_0x5a311d[_0x93a5('0x33')]){if(_0x5a311d[_0x93a5('0x33')]===_0x93a5('0x2c')){logger[_0x93a5('0x20')](_0x93a5('0x34'),_0x570deb,_0x5a311d[_0x93a5('0x33')]);}else if(_0x5a311d['moduleCreate']===_0x93a5('0x2d')&&_0x5a311d[_0x93a5('0xe')]===_0x93a5('0xf')){logger[_0x93a5('0x20')](_0x93a5('0x34'),_0x570deb,_0x5a311d[_0x93a5('0x33')]);_0x28d823['Company']=_0x93a5('0x35');}else{return null;}}return _0x70a0ec['sobject'](_['upperFirst'](_0x5a311d[_0x93a5('0x33')]))[_0x93a5('0x36')](_0x28d823);}});}function getCustomFields(_0x1ba308,_0x1c9a0a){var _0x3f6f12={};if(_0x1ba308[_0x93a5('0x37')]>0x0){_['forEach'](_0x1ba308,function(_0x1a3c98){if(_0x1a3c98['type']===_0x93a5('0x38')&&_0x1a3c98['idField']){_0x3f6f12[_0x1a3c98[_0x93a5('0x39')]]=_0x1a3c98[_0x93a5('0x3a')][_0x93a5('0x3b')]();}else if(_0x1a3c98['type']==='variable'&&_0x1a3c98[_0x93a5('0x3c')]&&_0x1a3c98[_0x93a5('0x39')]){_0x1c9a0a[_0x1a3c98['variableName']]&&(_0x3f6f12[_0x1a3c98[_0x93a5('0x39')]]=_0x1c9a0a[_0x1a3c98['variableName']][_0x93a5('0x3b')]());}else if(_0x1a3c98[_0x93a5('0x3d')]==='customVariable'&&_0x1a3c98['Variable']&&_0x1a3c98[_0x93a5('0x3e')]['name']&&_0x1a3c98['idField']){_0x1c9a0a[_0x1a3c98['Variable'][_0x93a5('0x3f')][_0x93a5('0x40')]()]&&(_0x3f6f12[_0x1a3c98['idField']]=_0x1c9a0a[_0x1a3c98[_0x93a5('0x3e')][_0x93a5('0x3f')]['toLowerCase']()][_0x93a5('0x3b')]());}});}return _0x3f6f12;}function getConnection(_0x22130){var _0x5bcf45=_0x22130[_0x93a5('0x41')]['concat'](_0x22130['securityToken']);var _0x4af472=new jsforce[(_0x93a5('0x42'))]({'oauth2':{'loginUrl':_0x22130[_0x93a5('0x43')]||_0x93a5('0x44'),'clientId':_0x22130[_0x93a5('0x45')],'clientSecret':_0x22130['clientSecret']}});return _0x4af472[_0x93a5('0x46')](_0x22130['username'],_0x5bcf45)['then'](function(){logger['info'](_0x93a5('0x47'));return _0x4af472;});}exports[_0x93a5('0x48')]=function(_0x3fde17,_0x53f6d2,_0x5eefbf,_0xc7a46,_0x157044,_0x2cbbb8){var _0x2e49bb,_0x48d97c,_0x1b87bc,_0x142e23;_0x2cbbb8['serverUrl']=intUtil[_0x93a5('0x49')](_0x2cbbb8[_0x93a5('0x4a')]);_0x2cbbb8['remoteUri']=intUtil[_0x93a5('0x49')](_0x2cbbb8['remoteUri']);if(_0x157044&&_0x157044[_0x93a5('0x4b')]){logger['info'](_0x93a5('0x4c'),_0x93a5('0x4d'));_0x53f6d2['recordingURL']=util[_0x93a5('0x31')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2cbbb8[_0x93a5('0x4a')],_0x53f6d2[_0x93a5('0x4e')],md5(_0x53f6d2[_0x93a5('0x4e')]));}else{_0x53f6d2[_0x93a5('0x4f')]='';}return getConnection(_0x2cbbb8)[_0x93a5('0x23')](function(_0x539546){_0x142e23=_0x539546;return getUser(_0x2cbbb8,_0xc7a46[_0x93a5('0x50')],_0x142e23);})[_0x93a5('0x23')](function(_0x27532a){_0x2e49bb=_0x27532a;return getEndUser(_0x2cbbb8,_0x5eefbf,_0x53f6d2[_0x93a5('0x51')],_0x53f6d2[_0x93a5('0x52')],_0x142e23);})[_0x93a5('0x23')](function(_0x3bcf5c){_0x48d97c=_0x3bcf5c;return getTicket(_0x2cbbb8,_0x2e49bb,_0x48d97c,_0x5eefbf,_0x53f6d2,_0x5eefbf[_0x93a5('0x53')],_0x142e23,_0x93a5('0x48'));})[_0x93a5('0x23')](function(_0x58191b){_0x1b87bc=_0x58191b;logger[_0x93a5('0x20')](_0x93a5('0x54'),_0x1b87bc['id']);logger['info'](_0x93a5('0x55'),_0x1b87bc['id'],_0xc7a46['name'],_0x2cbbb8[_0x93a5('0x3d')]);switch(_0x2cbbb8[_0x93a5('0x3d')]){case _0x93a5('0x56'):emit(util[_0x93a5('0x31')]('user:%s',_0xc7a46[_0x93a5('0x3f')]),_0x93a5('0x57'),{'recordId':_0x1b87bc['id']});break;case _0x93a5('0x58'):emit(util[_0x93a5('0x31')](_0x93a5('0x59'),_0xc7a46[_0x93a5('0x3f')]),_0x93a5('0x5a'),{'uri':util[_0x93a5('0x31')](_0x93a5('0x5b'),_0x142e23[_0x93a5('0x5c')],_0x1b87bc['id'])});break;default:logger[_0x93a5('0x5d')](_0x93a5('0x5e'));}})['catch'](function(_0x797fb2){logger[_0x93a5('0x5d')](_0x93a5('0x4c'),JSON[_0x93a5('0x5f')](_0x797fb2));});};exports[_0x93a5('0x60')]=function(_0x4684be,_0x402d80,_0x510789,_0x1139c9,_0x2d16c0,_0xffaeb9,_0x3b5de6){var _0x42f646,_0x516b9a,_0x1b7a20,_0x23978e;_0xffaeb9['serverUrl']=intUtil['stripTrailingSlash'](_0xffaeb9['serverUrl']);_0xffaeb9[_0x93a5('0x43')]=intUtil[_0x93a5('0x49')](_0xffaeb9['remoteUri']);if(_0x3b5de6&&_0x3b5de6[_0x93a5('0x61')]&&_0x3b5de6[_0x93a5('0x61')]!==_0x93a5('0x62')){logger[_0x93a5('0x20')](_0x93a5('0x63'),_0x93a5('0x4d'));_0x402d80['recordingURL']=util['format'](_0x93a5('0x64'),_0xffaeb9['serverUrl'],_0x402d80[_0x93a5('0x4e')],md5(_0x402d80[_0x93a5('0x4e')]));}return getConnection(_0xffaeb9)[_0x93a5('0x23')](function(_0x4d58f1){_0x23978e=_0x4d58f1;return getUser(_0xffaeb9,_0x1139c9[_0x93a5('0x50')],_0x23978e);})['then'](function(_0x1a3813){_0x42f646=_0x1a3813;return getEndUser(_0xffaeb9,_0x510789,_0x402d80[_0x93a5('0x65')],_0x402d80[_0x93a5('0x66')],_0x23978e);})[_0x93a5('0x23')](function(_0x460f59){_0x516b9a=_0x460f59;return getTicket(_0xffaeb9,_0x42f646,_0x516b9a,_0x510789,_0x402d80,_0x510789[_0x93a5('0x53')],_0x23978e,_0x93a5('0x60'));})[_0x93a5('0x23')](function(_0x446500){_0x1b7a20=_0x446500;logger[_0x93a5('0x20')](_0x93a5('0x67'),_0x1b7a20['id']);logger[_0x93a5('0x20')](_0x93a5('0x68'),_0x1b7a20['id'],_0x1139c9[_0x93a5('0x3f')],_0xffaeb9[_0x93a5('0x3d')]);switch(_0xffaeb9[_0x93a5('0x3d')]){case _0x93a5('0x56'):emit(util[_0x93a5('0x31')](_0x93a5('0x59'),_0x1139c9['name']),_0x93a5('0x57'),{'recordId':_0x1b7a20['id']});break;case'newTab':emit(util['format'](_0x93a5('0x59'),_0x1139c9['name']),_0x93a5('0x5a'),{'uri':util[_0x93a5('0x31')](_0x93a5('0x5b'),_0x23978e[_0x93a5('0x5c')],_0x1b7a20['id'])});break;default:logger['error']('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x84c891){logger[_0x93a5('0x5d')]('[OUTBOUND]',JSON[_0x93a5('0x5f')](_0x84c891));});};exports[_0x93a5('0x69')]=function(_0x2655cd,_0x1b6005,_0x25a355,_0x37eb95,_0x20dcb1,_0x721715){var _0x144fc9,_0x106985,_0x3b2f24,_0x5b30b1;_0x721715['serverUrl']=intUtil['stripTrailingSlash'](_0x721715[_0x93a5('0x4a')]);_0x721715[_0x93a5('0x43')]=intUtil[_0x93a5('0x49')](_0x721715[_0x93a5('0x43')]);if(_0x20dcb1&&_0x20dcb1[_0x93a5('0x4b')]){logger[_0x93a5('0x20')](_0x93a5('0x6a'),_0x93a5('0x4d'));_0x1b6005[_0x93a5('0x4f')]=util['format'](_0x93a5('0x64'),_0x721715[_0x93a5('0x4a')],_0x1b6005[_0x93a5('0x4e')],md5(_0x1b6005[_0x93a5('0x4e')]));}else{_0x1b6005[_0x93a5('0x4f')]='';}return getConnection(_0x721715)[_0x93a5('0x23')](function(_0x4b6614){_0x5b30b1=_0x4b6614;if(!_[_0x93a5('0x18')](_0x37eb95)){return getUser(_0x721715,_0x37eb95['name'],_0x5b30b1);}else{return getUser(_0x721715,null,_0x5b30b1);}})[_0x93a5('0x23')](function(_0x304118){_0x144fc9=_0x304118;return getEndUser(_0x721715,_0x25a355,_0x1b6005[_0x93a5('0x51')],_0x1b6005[_0x93a5('0x52')],_0x5b30b1);})[_0x93a5('0x23')](function(_0xd84ca4){_0x106985=_0xd84ca4;return getTicket(_0x721715,_0x144fc9,_0x106985,_0x25a355,_0x1b6005,_0x25a355[_0x93a5('0x53')],_0x5b30b1);})[_0x93a5('0x23')](function(_0x5937c4){_0x3b2f24=_0x5937c4;logger[_0x93a5('0x20')]('[ABANDONED]\x20Ticket\x20%s\x20created.',_0x3b2f24['id']);logger['info'](_0x93a5('0x6b'),_0x721715['type']);})[_0x93a5('0x6c')](function(_0x483ccb){logger['error']('[ABANDONED]',JSON[_0x93a5('0x5f')](_0x483ccb));});}; \ No newline at end of file +var _0x3017=['destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','abandoned','[ABANDONED]','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','catch','lodash','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','ticketType','Task','assign','utc','getString','Subjects','Descriptions','WhoId','Case','ContactId','sobject','create','isNil','validateEmail','User','find','execute','then','length','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','moduleSearch','contact_lead','Lead','Contact','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','lead','Company','No\x20Company','upperFirst','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','stringify','outbound','recordingFormat','none','destcalleridname'];(function(_0x2006b9,_0x39bebc){var _0x537a8f=function(_0x2f7242){while(--_0x2f7242){_0x2006b9['push'](_0x2006b9['shift']());}};_0x537a8f(++_0x39bebc);}(_0x3017,0x1be));var _0x7301=function(_0x499ba1,_0x4d11a9){_0x499ba1=_0x499ba1-0x0;var _0xbf1cd7=_0x3017[_0x499ba1];return _0xbf1cd7;};'use strict';var _=require(_0x7301('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7301('0x1'));var md5=require(_0x7301('0x2'));var jsforce=require(_0x7301('0x3'));var util=require(_0x7301('0x4'));var Redis=require(_0x7301('0x5'));var intUtil=require(_0x7301('0x6'));var config=require(_0x7301('0x7'));var logger=require(_0x7301('0x8'))('salesforce');config[_0x7301('0x9')]=_[_0x7301('0xa')](config[_0x7301('0x9')],{'host':_0x7301('0xb'),'port':0x18eb});var io=require(_0x7301('0xc'))(new Redis(config[_0x7301('0x9')]));function emit(_0x3249cb,_0x1bc172,_0x11c45e){io['to'](_0x3249cb)['emit'](_0x1bc172,_0x11c45e);}function getTicket(_0x26ee38,_0x300db7,_0x4c4e15,_0x4d2f10,_0x4490d8,_0x583a68,_0x3e16d7,_0x428e2d){var _0x47bca6={};if(_0x4d2f10[_0x7301('0xd')]===_0x7301('0xe')){_0x47bca6=Object[_0x7301('0xf')]({},{'OwnerId':_0x300db7['id'],'ActivityDate':moment[_0x7301('0x10')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x7301('0x11')](_0x4d2f10[_0x7301('0x12')],_0x4490d8,'\x20'),'Description':intUtil['getString'](_0x4d2f10[_0x7301('0x13')],_0x4490d8,'\x0a')},getCustomFields(_0x583a68,_0x4490d8));if(_0x4c4e15){_0x47bca6[_0x7301('0x14')]=_0x4c4e15['id'];}}else if(_0x4d2f10[_0x7301('0xd')]===_0x7301('0x15')){_0x47bca6=Object[_0x7301('0xf')]({},{'OwnerId':_0x300db7['id'],'Subject':intUtil['getString'](_0x4d2f10['Subjects'],_0x4490d8,'\x20'),'Description':intUtil[_0x7301('0x11')](_0x4d2f10[_0x7301('0x13')],_0x4490d8,'\x0a')},getCustomFields(_0x583a68,_0x4490d8));if(_0x4c4e15){_0x47bca6[_0x7301('0x16')]=_0x4c4e15['id'];}}return _0x3e16d7[_0x7301('0x17')](_0x4d2f10[_0x7301('0xd')])[_0x7301('0x18')](_0x47bca6);}function getUser(_0x2ca4ff,_0x5a6f12,_0x3be2c4){if(!_[_0x7301('0x19')](_0x5a6f12)&&intUtil[_0x7301('0x1a')](_0x5a6f12)){var _0x2ce2ae={'Email':_0x5a6f12};var _0x2128f6={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3be2c4[_0x7301('0x17')](_0x7301('0x1b'))[_0x7301('0x1c')](_0x2ce2ae,_0x2128f6)[_0x7301('0x1d')]()[_0x7301('0x1e')](function(_0x2b4da6){if(_0x2b4da6[_0x7301('0x1f')]){var _0xb53066=_[_0x7301('0x1c')](_0x2b4da6,function(_0x6c10af){return _0x6c10af['Email']===_0x5a6f12;});if(_0xb53066){logger[_0x7301('0x20')](_0x7301('0x21'),_0x5a6f12);return BPromise[_0x7301('0x22')]({'id':_0xb53066['Id'],'name':_0xb53066[_0x7301('0x23')]});}}else{logger['info'](_0x7301('0x24'),_0x5a6f12);return _0x3be2c4[_0x7301('0x25')]()[_0x7301('0x1e')](function(_0x13c5c9){return BPromise['resolve']({'id':_0x13c5c9['user_id'],'name':_0x13c5c9[_0x7301('0x26')]});});}});}else{logger[_0x7301('0x20')](_0x7301('0x24'),_0x5a6f12);return _0x3be2c4[_0x7301('0x25')]()[_0x7301('0x1e')](function(_0x118007){return BPromise['resolve']({'id':_0x118007[_0x7301('0x27')],'name':_0x118007['display_name']});});}}function getEndUser(_0xdb9cac,_0x3fcada,_0x5bd5de,_0x3ffbde,_0x1af805){var _0x2a89e5={'Phone':_0x3ffbde};var _0xfbff50={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x7301('0x22')]()[_0x7301('0x1e')](function(){if(_0x3fcada['ticketType']===_0x7301('0xe')){logger[_0x7301('0x20')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x3ffbde,_0x3fcada[_0x7301('0x28')]);switch(_0x3fcada[_0x7301('0x28')]){case _0x7301('0x29'):return _0x1af805[_0x7301('0x17')]('Contact')['find'](_0x2a89e5,_0xfbff50)[_0x7301('0x1d')]()['then'](function(_0x296418){if(_0x296418&&_0x296418[_0x7301('0x1f')]){return _0x296418;}else{return _0x1af805[_0x7301('0x17')](_0x7301('0x2a'))[_0x7301('0x1c')](_0x2a89e5,_0xfbff50);}});case'contact':return _0x1af805[_0x7301('0x17')](_0x7301('0x2b'))['find'](_0x2a89e5,_0xfbff50)[_0x7301('0x1d')]();case'lead':return _0x1af805[_0x7301('0x17')]('Lead')[_0x7301('0x1c')](_0x2a89e5,_0xfbff50);default:return null;}}else if(_0x3fcada[_0x7301('0xd')]===_0x7301('0x15')){logger[_0x7301('0x20')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x3ffbde,_0x7301('0x2c'));return _0x1af805[_0x7301('0x17')](_0x7301('0x2b'))[_0x7301('0x1c')](_0x2a89e5,_0xfbff50)[_0x7301('0x1d')]();}})[_0x7301('0x1e')](function(_0x344c74){if(_0x344c74&&_0x344c74[_0x7301('0x1f')]){var _0x5f28ae=_['find'](_0x344c74,function(_0x5adb4f){return _0x5adb4f['Phone']===_0x3ffbde;});if(_0x5f28ae){return BPromise['resolve']({'id':_0x5f28ae['Id'],'name':_0x5f28ae['Name'],'phone':_0x5f28ae[_0x7301('0x2d')]});}}})['then'](function(_0xcd97ac){if(_0xcd97ac){logger[_0x7301('0x20')](_0x7301('0x2e'),_0x3ffbde);return BPromise[_0x7301('0x22')](_0xcd97ac);}else{logger[_0x7301('0x20')]('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x3ffbde);var _0xfbef38={'LastName':_0x5bd5de!==_0x7301('0x2f')?_0x5bd5de:util['format'](_0x7301('0x30'),_0x3ffbde),'Phone':_0x3ffbde};if(_0x3fcada['moduleCreate']){if(_0x3fcada['moduleCreate']===_0x7301('0x2c')){logger[_0x7301('0x20')](_0x7301('0x31'),_0x3ffbde,_0x3fcada['moduleCreate']);}else if(_0x3fcada[_0x7301('0x32')]===_0x7301('0x33')&&_0x3fcada['ticketType']==='Task'){logger[_0x7301('0x20')](_0x7301('0x31'),_0x3ffbde,_0x3fcada['moduleCreate']);_0xfbef38[_0x7301('0x34')]=_0x7301('0x35');}else{return null;}}return _0x1af805[_0x7301('0x17')](_[_0x7301('0x36')](_0x3fcada[_0x7301('0x32')]))[_0x7301('0x18')](_0xfbef38);}});}function getCustomFields(_0x49355a,_0x281d37){var _0x4a8d08={};if(_0x49355a[_0x7301('0x1f')]>0x0){_[_0x7301('0x37')](_0x49355a,function(_0x4ced24){if(_0x4ced24[_0x7301('0x38')]===_0x7301('0x39')&&_0x4ced24[_0x7301('0x3a')]){_0x4a8d08[_0x4ced24[_0x7301('0x3a')]]=_0x4ced24[_0x7301('0x3b')][_0x7301('0x3c')]();}else if(_0x4ced24[_0x7301('0x38')]==='variable'&&_0x4ced24[_0x7301('0x3d')]&&_0x4ced24[_0x7301('0x3a')]){_0x281d37[_0x4ced24['variableName']]&&(_0x4a8d08[_0x4ced24['idField']]=_0x281d37[_0x4ced24['variableName']][_0x7301('0x3c')]());}else if(_0x4ced24[_0x7301('0x38')]===_0x7301('0x3e')&&_0x4ced24[_0x7301('0x3f')]&&_0x4ced24[_0x7301('0x3f')][_0x7301('0x40')]&&_0x4ced24['idField']){_0x281d37[_0x4ced24[_0x7301('0x3f')][_0x7301('0x40')][_0x7301('0x41')]()]&&(_0x4a8d08[_0x4ced24[_0x7301('0x3a')]]=_0x281d37[_0x4ced24[_0x7301('0x3f')][_0x7301('0x40')]['toLowerCase']()][_0x7301('0x3c')]());}});}return _0x4a8d08;}function getConnection(_0x2070d4){var _0xc6e363=_0x2070d4[_0x7301('0x42')]['concat'](_0x2070d4[_0x7301('0x43')]);var _0x53e4c8=new jsforce[(_0x7301('0x44'))]({'oauth2':{'loginUrl':_0x2070d4[_0x7301('0x45')]||_0x7301('0x46'),'clientId':_0x2070d4[_0x7301('0x47')],'clientSecret':_0x2070d4[_0x7301('0x48')]}});return _0x53e4c8['login'](_0x2070d4['username'],_0xc6e363)['then'](function(){logger[_0x7301('0x20')](_0x7301('0x49'));return _0x53e4c8;});}exports[_0x7301('0x4a')]=function(_0x2fc39b,_0x3db8a8,_0x2d07a5,_0x5dae6f,_0x186e27,_0xccad64){var _0x22c259,_0x5f1c77,_0x1065c1,_0x2ddff1;_0xccad64[_0x7301('0x4b')]=intUtil[_0x7301('0x4c')](_0xccad64[_0x7301('0x4b')]);_0xccad64[_0x7301('0x45')]=intUtil[_0x7301('0x4c')](_0xccad64['remoteUri']);if(_0x186e27&&_0x186e27[_0x7301('0x4d')]){logger[_0x7301('0x20')]('[QUEUE]',_0x7301('0x4e'));_0x3db8a8[_0x7301('0x4f')]=util[_0x7301('0x50')](_0x7301('0x51'),_0xccad64[_0x7301('0x4b')],_0x3db8a8[_0x7301('0x52')],md5(_0x3db8a8[_0x7301('0x52')]));}else{_0x3db8a8[_0x7301('0x4f')]='';}return getConnection(_0xccad64)[_0x7301('0x1e')](function(_0x62213){_0x2ddff1=_0x62213;return getUser(_0xccad64,_0x5dae6f[_0x7301('0x53')],_0x2ddff1);})[_0x7301('0x1e')](function(_0x3033c4){_0x22c259=_0x3033c4;return getEndUser(_0xccad64,_0x2d07a5,_0x3db8a8['calleridname'],_0x3db8a8[_0x7301('0x54')],_0x2ddff1);})[_0x7301('0x1e')](function(_0x6cd86c){_0x5f1c77=_0x6cd86c;return getTicket(_0xccad64,_0x22c259,_0x5f1c77,_0x2d07a5,_0x3db8a8,_0x2d07a5[_0x7301('0x55')],_0x2ddff1,'queue');})[_0x7301('0x1e')](function(_0x32d1eb){_0x1065c1=_0x32d1eb;logger[_0x7301('0x20')](_0x7301('0x56'),_0x1065c1['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1065c1['id'],_0x5dae6f[_0x7301('0x40')],_0xccad64[_0x7301('0x38')]);switch(_0xccad64[_0x7301('0x38')]){case _0x7301('0x57'):emit(util['format'](_0x7301('0x58'),_0x5dae6f[_0x7301('0x40')]),'trigger:salesforce:display',{'recordId':_0x1065c1['id']});break;case _0x7301('0x59'):emit(util[_0x7301('0x50')](_0x7301('0x58'),_0x5dae6f[_0x7301('0x40')]),_0x7301('0x5a'),{'uri':util[_0x7301('0x50')](_0x7301('0x5b'),_0x2ddff1[_0x7301('0x5c')],_0x1065c1['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x303852){logger[_0x7301('0x5d')]('[QUEUE]',JSON[_0x7301('0x5e')](_0x303852));});};exports[_0x7301('0x5f')]=function(_0x5873c5,_0x2a2fd0,_0x51ca03,_0x250b63,_0x110fa7,_0x96ad6c,_0x34475c){var _0x361596,_0x4b303e,_0x2e7561,_0x398110;_0x96ad6c[_0x7301('0x4b')]=intUtil[_0x7301('0x4c')](_0x96ad6c['serverUrl']);_0x96ad6c['remoteUri']=intUtil[_0x7301('0x4c')](_0x96ad6c['remoteUri']);if(_0x34475c&&_0x34475c[_0x7301('0x60')]&&_0x34475c[_0x7301('0x60')]!==_0x7301('0x61')){logger[_0x7301('0x20')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2a2fd0[_0x7301('0x4f')]=util[_0x7301('0x50')](_0x7301('0x51'),_0x96ad6c[_0x7301('0x4b')],_0x2a2fd0[_0x7301('0x52')],md5(_0x2a2fd0[_0x7301('0x52')]));}return getConnection(_0x96ad6c)[_0x7301('0x1e')](function(_0x3163cd){_0x398110=_0x3163cd;return getUser(_0x96ad6c,_0x250b63[_0x7301('0x53')],_0x398110);})['then'](function(_0x3c13d8){_0x361596=_0x3c13d8;return getEndUser(_0x96ad6c,_0x51ca03,_0x2a2fd0[_0x7301('0x62')],_0x2a2fd0[_0x7301('0x63')],_0x398110);})[_0x7301('0x1e')](function(_0x4e08f2){_0x4b303e=_0x4e08f2;return getTicket(_0x96ad6c,_0x361596,_0x4b303e,_0x51ca03,_0x2a2fd0,_0x51ca03['Fields'],_0x398110,'outbound');})[_0x7301('0x1e')](function(_0x14f9e3){_0x2e7561=_0x14f9e3;logger[_0x7301('0x20')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2e7561['id']);logger['info'](_0x7301('0x64'),_0x2e7561['id'],_0x250b63[_0x7301('0x40')],_0x96ad6c[_0x7301('0x38')]);switch(_0x96ad6c['type']){case _0x7301('0x57'):emit(util[_0x7301('0x50')](_0x7301('0x58'),_0x250b63['name']),_0x7301('0x65'),{'recordId':_0x2e7561['id']});break;case'newTab':emit(util[_0x7301('0x50')]('user:%s',_0x250b63[_0x7301('0x40')]),'trigger:browser:url',{'uri':util['format'](_0x7301('0x5b'),_0x398110['instanceUrl'],_0x2e7561['id'])});break;default:logger[_0x7301('0x5d')](_0x7301('0x66'),_0x7301('0x67'));}})['catch'](function(_0x4ba320){logger['error'](_0x7301('0x66'),JSON['stringify'](_0x4ba320));});};exports[_0x7301('0x68')]=function(_0x5ebf3c,_0x1b49cf,_0x3dcd32,_0x1ef631,_0x53bf5c,_0x3ca1b0){var _0x3772f7,_0x5bdfbe,_0x3fc71b,_0x226df6;_0x3ca1b0[_0x7301('0x4b')]=intUtil[_0x7301('0x4c')](_0x3ca1b0['serverUrl']);_0x3ca1b0[_0x7301('0x45')]=intUtil['stripTrailingSlash'](_0x3ca1b0[_0x7301('0x45')]);if(_0x53bf5c&&_0x53bf5c[_0x7301('0x4d')]){logger[_0x7301('0x20')](_0x7301('0x69'),_0x7301('0x4e'));_0x1b49cf[_0x7301('0x4f')]=util[_0x7301('0x50')](_0x7301('0x51'),_0x3ca1b0[_0x7301('0x4b')],_0x1b49cf[_0x7301('0x52')],md5(_0x1b49cf['uniqueid']));}else{_0x1b49cf['recordingURL']='';}return getConnection(_0x3ca1b0)[_0x7301('0x1e')](function(_0x59ae7f){_0x226df6=_0x59ae7f;if(!_[_0x7301('0x19')](_0x1ef631)){return getUser(_0x3ca1b0,_0x1ef631[_0x7301('0x40')],_0x226df6);}else{return getUser(_0x3ca1b0,null,_0x226df6);}})[_0x7301('0x1e')](function(_0xe81b34){_0x3772f7=_0xe81b34;return getEndUser(_0x3ca1b0,_0x3dcd32,_0x1b49cf['calleridname'],_0x1b49cf[_0x7301('0x54')],_0x226df6);})[_0x7301('0x1e')](function(_0x21ce9b){_0x5bdfbe=_0x21ce9b;return getTicket(_0x3ca1b0,_0x3772f7,_0x5bdfbe,_0x3dcd32,_0x1b49cf,_0x3dcd32[_0x7301('0x55')],_0x226df6);})[_0x7301('0x1e')](function(_0x2755b7){_0x3fc71b=_0x2755b7;logger['info'](_0x7301('0x6a'),_0x3fc71b['id']);logger[_0x7301('0x20')](_0x7301('0x6b'),_0x3ca1b0[_0x7301('0x38')]);})[_0x7301('0x6c')](function(_0x441679){logger[_0x7301('0x5d')](_0x7301('0x69'),JSON[_0x7301('0x5e')](_0x441679));});}; \ 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 4b5f5ec..0b00c5d 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','type','customField','idField','content','toString','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','%s/api/now/table/','remoteUri','email','destcalleridnum','calleridnum','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x0a9e('0x0'));var Promise=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function getAdminUser(_0x5f41ea,_0x503809,_0xe42b77,_0x56465b,_0x52cace,_0x39753a){return new Promise(function(_0xf81284,_0x307b3e){var _0x3ab53f={'method':_0x0a9e('0xb'),'uri':_0x56465b+_0x0a9e('0xc')+'&'+_0x52cace+'&'+_0x39753a,'auth':_0x503809,'json':!![]};return rp(_0x3ab53f)['then'](function(_0x50dfb2){if(_0x50dfb2['result']['length']>0x0){_0xe42b77[_0x0a9e('0xd')]=_0x50dfb2[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}logger[_0x0a9e('0x10')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+_0x0a9e('0x12'),_0xe42b77);_0xf81284(_0xe42b77);})['catch'](function(_0x4283ce){logger[_0x0a9e('0x13')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+']',_0x4283ce[_0x0a9e('0x14')]);_0x307b3e(_0x4283ce[_0x0a9e('0x14')]);});});}function getUser(_0x4d5611,_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return function(_0x519dfd){logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x519dfd);return new Promise(function(_0x225616,_0x5a0a06){if(intUtil[_0x0a9e('0x15')](_0x519dfd[_0x0a9e('0x16')])){var _0x106033={'method':_0x0a9e('0xb'),'uri':_0x22dccb+_0x0a9e('0x17')+_0x519dfd[_0x0a9e('0x16')]+'&'+_0x5d0880+'&'+_0x1985b6,'auth':_0x52a03d,'json':!![]};logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x18'),_0x106033);return rp(_0x106033)[_0x0a9e('0x19')](function(_0x1c696a){logger[_0x0a9e('0x10')]('['+[_0x4d5611['toUpperCase']()]+_0x0a9e('0x1a'),_0x1c696a);if(_0x1c696a[_0x0a9e('0xe')]['length']>0x0&&String(_0x1c696a[_0x0a9e('0xe')][0x0]['active'])==='true'){_0x519dfd[_0x0a9e('0x1b')]=_0x1c696a[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}else{_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd[_0x0a9e('0x1c')];}logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x1d'),_0x519dfd);_0x225616(_0x519dfd);})[_0x0a9e('0x1e')](function(_0x16b1ca){logger['error']('['+[_0x4d5611['toUpperCase']()]+']',_0x16b1ca[_0x0a9e('0x14')]);_0x5a0a06(_0x16b1ca[_0x0a9e('0x14')]);});}else{logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+']\x20using\x20admin\x20profile');_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd['adminEmail'];_0x225616(_0x519dfd);}});};}function createEndUser(_0x1dc186,_0x34dc65,_0x25fba9,_0x14433c,_0x140511){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+_0x0a9e('0x1f'),_0x25fba9);return new Promise(function(_0x5a101a,_0x3652a7){var _0x468813={'method':_0x0a9e('0x20'),'uri':_0x14433c+_0x0a9e('0x21')+_0x140511,'body':{'user_name':_0x25fba9['endUserNumber'],'roles':_0x0a9e('0x22'),'first_name':_0x25fba9[_0x0a9e('0x23')],'active':_0x0a9e('0x24'),'date_format':_0x0a9e('0x25'),'phone':_0x25fba9[_0x0a9e('0x23')]},'auth':_0x34dc65,'json':!![]};return rp(_0x468813)[_0x0a9e('0x19')](function(_0x296f41){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+'],\x20EndUser\x20schema',_0x296f41[_0x0a9e('0xe')]);_0x25fba9['endUserId']=_0x296f41[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x5a101a(_0x25fba9);})[_0x0a9e('0x1e')](function(_0x33bdb7){logger[_0x0a9e('0x13')]('['+[_0x1dc186['toUpperCase']()]+']',_0x33bdb7[_0x0a9e('0x14')]);_0x3652a7(_0x33bdb7[_0x0a9e('0x14')]);});});}function getEndUser(_0x40cb85,_0x2da5c0,_0x2b45ea,_0x409319,_0x332d35){return function(_0x39e565){logger['info']('['+[_0x40cb85[_0x0a9e('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x39e565);return new Promise(function(_0x2cc7a0,_0x14b13f){var _0x2b7e7f={'method':_0x0a9e('0xb'),'uri':_0x2b45ea+'sys_user?sysparm_query=phone%3D'+_0x39e565[_0x0a9e('0x23')]+'&'+_0x409319+'&'+_0x332d35,'auth':_0x2da5c0,'json':!![]};return rp(_0x2b7e7f)[_0x0a9e('0x19')](function(_0x1fa90d){if(_0x1fa90d[_0x0a9e('0xe')]['length']>0x0){_0x39e565['endUserId']=_0x1fa90d[_0x0a9e('0xe')][0x0]['sys_id'];logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x26'),_0x39e565);_0x2cc7a0(_0x39e565);}else{return createEndUser(_0x40cb85,_0x2da5c0,_0x39e565,_0x2b45ea,_0x409319)[_0x0a9e('0x19')](function(_0x4f41ae){logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x27'),_0x4f41ae);_0x2cc7a0(_0x4f41ae);});}})['catch'](function(_0x1dbf74){logger[_0x0a9e('0x13')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+']',_0x1dbf74['message']);_0x14b13f(_0x1dbf74['message']);});});};}function getCustomFields(_0x11b61d,_0x40d766){var _0x5adda1={};if(_0x11b61d[_0x0a9e('0x28')]>0x0){_[_0x0a9e('0x29')](_0x11b61d,function(_0x2e1b3a){if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a['nameField']&&!_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')]['toLowerCase']()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]===_0x0a9e('0x30')&&_0x2e1b3a[_0x0a9e('0x31')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x31')]][_0x0a9e('0x2e')]();}else if(_0x2e1b3a['type']==='customVariable'&&_0x2e1b3a[_0x0a9e('0x32')]&&_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')][_0x0a9e('0x2f')]()][_0x0a9e('0x2e')]();}});}return _0x5adda1;}function getTicket(_0x35ed4a,_0x5026aa,_0x117c99,_0x138b8b,_0xdd268f,_0xfbd5ad){return function(_0x2e8caf){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x34'),_0x2e8caf);return new Promise(function(_0x59afe8,_0x2e9d90){var _0x48fd45=_0x35ed4a[_0x0a9e('0x2f')]()===_0x0a9e('0x35')?_0x2e8caf[_0x0a9e('0x1b')]:_0x2e8caf['endUserId'];var _0x14bec2={'method':_0x0a9e('0x20'),'uri':_0x117c99+_0x0a9e('0x36')+'?'+_0xfbd5ad,'body':Object[_0x0a9e('0x37')]({},{'active':_0x0a9e('0x24'),'caller_id':_0x48fd45,'assigned_to':_0x2e8caf[_0x0a9e('0x1b')],'short_description':intUtil[_0x0a9e('0x38')](_0x138b8b['Subjects'],_0xdd268f,'\x20'),'description':intUtil[_0x0a9e('0x38')](_0x138b8b[_0x0a9e('0x39')],_0xdd268f,'\x0a')},getCustomFields(_0x138b8b[_0x0a9e('0x3a')],_0xdd268f)),'auth':_0x5026aa,'json':!![]};return rp(_0x14bec2)[_0x0a9e('0x19')](function(_0x409789){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3b'),_0x409789[_0x0a9e('0xe')]);_0x2e8caf['ticketId']=_0x409789[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x2e8caf['ticketNumber']=_0x409789['result']['number'];logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3c'),_0x2e8caf);_0x59afe8(_0x2e8caf);})[_0x0a9e('0x1e')](function(_0x61bb17){logger[_0x0a9e('0x13')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+']',_0x61bb17[_0x0a9e('0x14')]);_0x2e9d90(_0x61bb17['message']);});});};}function createRemoteTag(_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){return new Promise(function(_0x14d602,_0x5bb3ed){var _0x2b69d9={'method':_0x0a9e('0x20'),'uri':_0x39d77d+'label'+'?'+_0x204173,'body':{'short_description':_0x4b1b9f,'global':!![],'active':!![],'name':_0x4b1b9f},'auth':_0x53975a,'json':!![]};return rp(_0x2b69d9)['then'](function(_0x2ef381){var _0x59c6ff=_0x2ef381[_0x0a9e('0xe')]['sys_id'];_0x14d602(_0x59c6ff);});});}function getRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return new Promise(function(_0x1bf38a,_0x508b47){var _0x50f687={'method':_0x0a9e('0xb'),'uri':_0x439340+_0x0a9e('0x3d')+'?sysparm_query=name%3D'+_0x2e5e62+'&'+_0x53613a,'auth':_0x3c20b2,'json':!![]};return rp(_0x50f687)[_0x0a9e('0x19')](function(_0x5ce9ac){if(_0x5ce9ac[_0x0a9e('0xe')]['length']>0x0){var _0xe22ccc=_0x5ce9ac['result'][0x0]['sys_id'];_0x1bf38a(_0xe22ccc);}else{return createRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a)['then'](function(_0x2da03c){_0x1bf38a(_0x2da03c);});}});});}function assignTagToIncident(_0x47de4c,_0x2f7092,_0x65432,_0x3cfd00,_0x19b4df){return new Promise(function(_0x232830,_0x272738){var _0xd10662={'method':_0x0a9e('0x20'),'uri':_0x65432+'label_entry'+'?'+_0x19b4df,'body':{'label':_0x47de4c,'table':_0x0a9e('0x36'),'id_type':_0x0a9e('0x3e'),'table_key':_0x3cfd00[_0x0a9e('0x3f')],'title':_0x0a9e('0x40')+_0x3cfd00[_0x0a9e('0x41')],'id_display':_0x3cfd00[_0x0a9e('0x41')]},'auth':_0x2f7092,'json':!![]};return rp(_0xd10662)['then'](function(_0x956fbe){_0x232830();})[_0x0a9e('0x1e')](function(){_0x232830();});});}function manageTags(_0x5239ef,_0x3649cc,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a,_0x5674ee){return new Promise(function(_0x273cb5,_0x49d231){var _0x2244d6=[];_0x3649cc[_0x0a9e('0x29')](function(_0x261adb){_0x2244d6[_0x0a9e('0x42')](getRemoteTag(_0x261adb,_0x5cc8fb,_0x20c668,_0x4b3c1a,_0x5674ee));});return Promise[_0x0a9e('0x43')](_0x2244d6)[_0x0a9e('0x19')](function(_0x49eed0){if(_0x49eed0[_0x0a9e('0x28')]){logger['info']('['+[_0x5239ef[_0x0a9e('0x11')]()]+_0x0a9e('0x44'),_0x49eed0);var _0x51aaf7=[];_0x49eed0['forEach'](function(_0x453360){_0x51aaf7[_0x0a9e('0x42')](assignTagToIncident(_0x453360,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a));});return Promise[_0x0a9e('0x43')](_0x51aaf7)[_0x0a9e('0x19')](function(){_0x273cb5();})['catch'](function(){_0x273cb5();});}else{_0x273cb5();}});});}function getTags(_0x1d0dc8,_0xe05a5a,_0x54327c,_0x797b45,_0x17e88c,_0x88dcbf){return function(_0x409b29){return new Promise(function(_0x401837,_0x4d4a35){var _0x176840=[];var _0x2937e0=_0x797b45[_0x0a9e('0x45')];if(_0x2937e0&&_0x2937e0['length']>0x0){_0x176840=_[_0x0a9e('0x46')](_0x2937e0,'name');}if(_0x176840['length']>0x0){return manageTags(_0x1d0dc8,_0x176840,_0xe05a5a,_0x54327c,_0x409b29,_0x17e88c,_0x88dcbf)[_0x0a9e('0x19')](function(){_0x401837(_0x409b29);});}else{_0x401837(_0x409b29);}});};}function emit(_0x4556c5,_0x9375fb,_0x19c995){var _0x186f39=_0x0a9e('0x47')+_0x0a9e('0x48')+_0x0a9e('0x49')+_0x0a9e('0x4a');var _0x1cc4f3={'uri':_0x4556c5+_0x0a9e('0x4b')+_0x19c995+_0x186f39};io['to'](util[_0x0a9e('0x4c')](_0x0a9e('0x4d'),_0x9375fb))[_0x0a9e('0x4e')](_0x0a9e('0x4f'),_0x1cc4f3);}exports['cs']=function(_0x412a72,_0x2a28c0,_0x4257c9,_0x5150a4,_0x1b0b98,_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={'user':_0x295763['username'],'pass':_0x295763[_0x0a9e('0x50')]};var _0x56e31e=_0x0a9e('0x51');var _0x427946=_0x0a9e('0x52');_0x295763['remoteUri']=intUtil['stripTrailingSlash'](_0x295763['remoteUri']);_0x295763[_0x0a9e('0x53')]=intUtil[_0x0a9e('0x54')](_0x295763[_0x0a9e('0x53')]);var _0x23a7d3=util[_0x0a9e('0x4c')](_0x0a9e('0x55'),_0x295763[_0x0a9e('0x56')]);_0x1148a1[_0x0a9e('0x16')]=!_['isNil'](_0x5150a4)?_0x5150a4[_0x0a9e('0x57')]:null;_0x1148a1[_0x0a9e('0x1c')]=_0x295763[_0x0a9e('0x57')];_0x1148a1['endUserNumber']=_0x4edbb0[_0x0a9e('0x2f')]()==='outbound'?_0x2a28c0[_0x0a9e('0x58')]:_0x2a28c0[_0x0a9e('0x59')];_0x1148a1['callDirection']=_0x4edbb0===_0x0a9e('0x5a')||_0x4edbb0===_0x0a9e('0x5b')?_0x0a9e('0x5a'):_0x0a9e('0x35');var _0x542ece=util[_0x0a9e('0x4c')](_0x0a9e('0x5c'),_0x295763[_0x0a9e('0x53')],_0x2a28c0[_0x0a9e('0x5d')],md5(_0x2a28c0['uniqueid']));if(_0x1b0b98&&_0x1b0b98[_0x0a9e('0x5e')]){logger[_0x0a9e('0x10')](_0x0a9e('0x5f'),_0x0a9e('0x60'));_0x2a28c0['recordingURL']=_0x542ece;}else if(_0x243d12&&_0x243d12[_0x0a9e('0x61')]&&_0x243d12[_0x0a9e('0x61')]!==_0x0a9e('0x62')){logger[_0x0a9e('0x10')](_0x0a9e('0x63'),_0x0a9e('0x60'));_0x2a28c0[_0x0a9e('0x64')]=_0x542ece;}else{_0x2a28c0[_0x0a9e('0x64')]='';}return getAdminUser(_0x4edbb0,_0x30944e,_0x1148a1,_0x23a7d3,_0x427946,_0x56e31e)[_0x0a9e('0x19')](getUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getEndUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getTicket(_0x4edbb0,_0x30944e,_0x23a7d3,_0x4257c9,_0x2a28c0,_0x427946))[_0x0a9e('0x19')](function(_0x25744a){logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x65'),_0x25744a[_0x0a9e('0x3f')]));logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x66'),_0x4edbb0));if(_0x4edbb0!==_0x0a9e('0x5b')){logger[_0x0a9e('0x10')]('['+[_0x4edbb0[_0x0a9e('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x295763['remoteUri'],_0x5150a4[_0x0a9e('0x33')],_0x25744a[_0x0a9e('0x3f')]);}})['catch'](function(_0x45108c){logger['error']('['+[_0x4edbb0[_0x0a9e('0x11')]()]+_0x0a9e('0x67'),util['inspect'](_0x45108c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa9e0=['validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','type','customField','idField','content','toString','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','%s/api/now/table/','remoteUri','email','destcalleridnum','calleridnum','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0a9e('0x0'));var Promise=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function getAdminUser(_0x5f41ea,_0x503809,_0xe42b77,_0x56465b,_0x52cace,_0x39753a){return new Promise(function(_0xf81284,_0x307b3e){var _0x3ab53f={'method':_0x0a9e('0xb'),'uri':_0x56465b+_0x0a9e('0xc')+'&'+_0x52cace+'&'+_0x39753a,'auth':_0x503809,'json':!![]};return rp(_0x3ab53f)['then'](function(_0x50dfb2){if(_0x50dfb2['result']['length']>0x0){_0xe42b77[_0x0a9e('0xd')]=_0x50dfb2[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}logger[_0x0a9e('0x10')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+_0x0a9e('0x12'),_0xe42b77);_0xf81284(_0xe42b77);})['catch'](function(_0x4283ce){logger[_0x0a9e('0x13')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+']',_0x4283ce[_0x0a9e('0x14')]);_0x307b3e(_0x4283ce[_0x0a9e('0x14')]);});});}function getUser(_0x4d5611,_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return function(_0x519dfd){logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x519dfd);return new Promise(function(_0x225616,_0x5a0a06){if(intUtil[_0x0a9e('0x15')](_0x519dfd[_0x0a9e('0x16')])){var _0x106033={'method':_0x0a9e('0xb'),'uri':_0x22dccb+_0x0a9e('0x17')+_0x519dfd[_0x0a9e('0x16')]+'&'+_0x5d0880+'&'+_0x1985b6,'auth':_0x52a03d,'json':!![]};logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x18'),_0x106033);return rp(_0x106033)[_0x0a9e('0x19')](function(_0x1c696a){logger[_0x0a9e('0x10')]('['+[_0x4d5611['toUpperCase']()]+_0x0a9e('0x1a'),_0x1c696a);if(_0x1c696a[_0x0a9e('0xe')]['length']>0x0&&String(_0x1c696a[_0x0a9e('0xe')][0x0]['active'])==='true'){_0x519dfd[_0x0a9e('0x1b')]=_0x1c696a[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}else{_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd[_0x0a9e('0x1c')];}logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x1d'),_0x519dfd);_0x225616(_0x519dfd);})[_0x0a9e('0x1e')](function(_0x16b1ca){logger['error']('['+[_0x4d5611['toUpperCase']()]+']',_0x16b1ca[_0x0a9e('0x14')]);_0x5a0a06(_0x16b1ca[_0x0a9e('0x14')]);});}else{logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+']\x20using\x20admin\x20profile');_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd['adminEmail'];_0x225616(_0x519dfd);}});};}function createEndUser(_0x1dc186,_0x34dc65,_0x25fba9,_0x14433c,_0x140511){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+_0x0a9e('0x1f'),_0x25fba9);return new Promise(function(_0x5a101a,_0x3652a7){var _0x468813={'method':_0x0a9e('0x20'),'uri':_0x14433c+_0x0a9e('0x21')+_0x140511,'body':{'user_name':_0x25fba9['endUserNumber'],'roles':_0x0a9e('0x22'),'first_name':_0x25fba9[_0x0a9e('0x23')],'active':_0x0a9e('0x24'),'date_format':_0x0a9e('0x25'),'phone':_0x25fba9[_0x0a9e('0x23')]},'auth':_0x34dc65,'json':!![]};return rp(_0x468813)[_0x0a9e('0x19')](function(_0x296f41){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+'],\x20EndUser\x20schema',_0x296f41[_0x0a9e('0xe')]);_0x25fba9['endUserId']=_0x296f41[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x5a101a(_0x25fba9);})[_0x0a9e('0x1e')](function(_0x33bdb7){logger[_0x0a9e('0x13')]('['+[_0x1dc186['toUpperCase']()]+']',_0x33bdb7[_0x0a9e('0x14')]);_0x3652a7(_0x33bdb7[_0x0a9e('0x14')]);});});}function getEndUser(_0x40cb85,_0x2da5c0,_0x2b45ea,_0x409319,_0x332d35){return function(_0x39e565){logger['info']('['+[_0x40cb85[_0x0a9e('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x39e565);return new Promise(function(_0x2cc7a0,_0x14b13f){var _0x2b7e7f={'method':_0x0a9e('0xb'),'uri':_0x2b45ea+'sys_user?sysparm_query=phone%3D'+_0x39e565[_0x0a9e('0x23')]+'&'+_0x409319+'&'+_0x332d35,'auth':_0x2da5c0,'json':!![]};return rp(_0x2b7e7f)[_0x0a9e('0x19')](function(_0x1fa90d){if(_0x1fa90d[_0x0a9e('0xe')]['length']>0x0){_0x39e565['endUserId']=_0x1fa90d[_0x0a9e('0xe')][0x0]['sys_id'];logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x26'),_0x39e565);_0x2cc7a0(_0x39e565);}else{return createEndUser(_0x40cb85,_0x2da5c0,_0x39e565,_0x2b45ea,_0x409319)[_0x0a9e('0x19')](function(_0x4f41ae){logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x27'),_0x4f41ae);_0x2cc7a0(_0x4f41ae);});}})['catch'](function(_0x1dbf74){logger[_0x0a9e('0x13')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+']',_0x1dbf74['message']);_0x14b13f(_0x1dbf74['message']);});});};}function getCustomFields(_0x11b61d,_0x40d766){var _0x5adda1={};if(_0x11b61d[_0x0a9e('0x28')]>0x0){_[_0x0a9e('0x29')](_0x11b61d,function(_0x2e1b3a){if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a['nameField']&&!_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')]['toLowerCase']()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]===_0x0a9e('0x30')&&_0x2e1b3a[_0x0a9e('0x31')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x31')]][_0x0a9e('0x2e')]();}else if(_0x2e1b3a['type']==='customVariable'&&_0x2e1b3a[_0x0a9e('0x32')]&&_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')][_0x0a9e('0x2f')]()][_0x0a9e('0x2e')]();}});}return _0x5adda1;}function getTicket(_0x35ed4a,_0x5026aa,_0x117c99,_0x138b8b,_0xdd268f,_0xfbd5ad){return function(_0x2e8caf){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x34'),_0x2e8caf);return new Promise(function(_0x59afe8,_0x2e9d90){var _0x48fd45=_0x35ed4a[_0x0a9e('0x2f')]()===_0x0a9e('0x35')?_0x2e8caf[_0x0a9e('0x1b')]:_0x2e8caf['endUserId'];var _0x14bec2={'method':_0x0a9e('0x20'),'uri':_0x117c99+_0x0a9e('0x36')+'?'+_0xfbd5ad,'body':Object[_0x0a9e('0x37')]({},{'active':_0x0a9e('0x24'),'caller_id':_0x48fd45,'assigned_to':_0x2e8caf[_0x0a9e('0x1b')],'short_description':intUtil[_0x0a9e('0x38')](_0x138b8b['Subjects'],_0xdd268f,'\x20'),'description':intUtil[_0x0a9e('0x38')](_0x138b8b[_0x0a9e('0x39')],_0xdd268f,'\x0a')},getCustomFields(_0x138b8b[_0x0a9e('0x3a')],_0xdd268f)),'auth':_0x5026aa,'json':!![]};return rp(_0x14bec2)[_0x0a9e('0x19')](function(_0x409789){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3b'),_0x409789[_0x0a9e('0xe')]);_0x2e8caf['ticketId']=_0x409789[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x2e8caf['ticketNumber']=_0x409789['result']['number'];logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3c'),_0x2e8caf);_0x59afe8(_0x2e8caf);})[_0x0a9e('0x1e')](function(_0x61bb17){logger[_0x0a9e('0x13')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+']',_0x61bb17[_0x0a9e('0x14')]);_0x2e9d90(_0x61bb17['message']);});});};}function createRemoteTag(_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){return new Promise(function(_0x14d602,_0x5bb3ed){var _0x2b69d9={'method':_0x0a9e('0x20'),'uri':_0x39d77d+'label'+'?'+_0x204173,'body':{'short_description':_0x4b1b9f,'global':!![],'active':!![],'name':_0x4b1b9f},'auth':_0x53975a,'json':!![]};return rp(_0x2b69d9)['then'](function(_0x2ef381){var _0x59c6ff=_0x2ef381[_0x0a9e('0xe')]['sys_id'];_0x14d602(_0x59c6ff);});});}function getRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return new Promise(function(_0x1bf38a,_0x508b47){var _0x50f687={'method':_0x0a9e('0xb'),'uri':_0x439340+_0x0a9e('0x3d')+'?sysparm_query=name%3D'+_0x2e5e62+'&'+_0x53613a,'auth':_0x3c20b2,'json':!![]};return rp(_0x50f687)[_0x0a9e('0x19')](function(_0x5ce9ac){if(_0x5ce9ac[_0x0a9e('0xe')]['length']>0x0){var _0xe22ccc=_0x5ce9ac['result'][0x0]['sys_id'];_0x1bf38a(_0xe22ccc);}else{return createRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a)['then'](function(_0x2da03c){_0x1bf38a(_0x2da03c);});}});});}function assignTagToIncident(_0x47de4c,_0x2f7092,_0x65432,_0x3cfd00,_0x19b4df){return new Promise(function(_0x232830,_0x272738){var _0xd10662={'method':_0x0a9e('0x20'),'uri':_0x65432+'label_entry'+'?'+_0x19b4df,'body':{'label':_0x47de4c,'table':_0x0a9e('0x36'),'id_type':_0x0a9e('0x3e'),'table_key':_0x3cfd00[_0x0a9e('0x3f')],'title':_0x0a9e('0x40')+_0x3cfd00[_0x0a9e('0x41')],'id_display':_0x3cfd00[_0x0a9e('0x41')]},'auth':_0x2f7092,'json':!![]};return rp(_0xd10662)['then'](function(_0x956fbe){_0x232830();})[_0x0a9e('0x1e')](function(){_0x232830();});});}function manageTags(_0x5239ef,_0x3649cc,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a,_0x5674ee){return new Promise(function(_0x273cb5,_0x49d231){var _0x2244d6=[];_0x3649cc[_0x0a9e('0x29')](function(_0x261adb){_0x2244d6[_0x0a9e('0x42')](getRemoteTag(_0x261adb,_0x5cc8fb,_0x20c668,_0x4b3c1a,_0x5674ee));});return Promise[_0x0a9e('0x43')](_0x2244d6)[_0x0a9e('0x19')](function(_0x49eed0){if(_0x49eed0[_0x0a9e('0x28')]){logger['info']('['+[_0x5239ef[_0x0a9e('0x11')]()]+_0x0a9e('0x44'),_0x49eed0);var _0x51aaf7=[];_0x49eed0['forEach'](function(_0x453360){_0x51aaf7[_0x0a9e('0x42')](assignTagToIncident(_0x453360,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a));});return Promise[_0x0a9e('0x43')](_0x51aaf7)[_0x0a9e('0x19')](function(){_0x273cb5();})['catch'](function(){_0x273cb5();});}else{_0x273cb5();}});});}function getTags(_0x1d0dc8,_0xe05a5a,_0x54327c,_0x797b45,_0x17e88c,_0x88dcbf){return function(_0x409b29){return new Promise(function(_0x401837,_0x4d4a35){var _0x176840=[];var _0x2937e0=_0x797b45[_0x0a9e('0x45')];if(_0x2937e0&&_0x2937e0['length']>0x0){_0x176840=_[_0x0a9e('0x46')](_0x2937e0,'name');}if(_0x176840['length']>0x0){return manageTags(_0x1d0dc8,_0x176840,_0xe05a5a,_0x54327c,_0x409b29,_0x17e88c,_0x88dcbf)[_0x0a9e('0x19')](function(){_0x401837(_0x409b29);});}else{_0x401837(_0x409b29);}});};}function emit(_0x4556c5,_0x9375fb,_0x19c995){var _0x186f39=_0x0a9e('0x47')+_0x0a9e('0x48')+_0x0a9e('0x49')+_0x0a9e('0x4a');var _0x1cc4f3={'uri':_0x4556c5+_0x0a9e('0x4b')+_0x19c995+_0x186f39};io['to'](util[_0x0a9e('0x4c')](_0x0a9e('0x4d'),_0x9375fb))[_0x0a9e('0x4e')](_0x0a9e('0x4f'),_0x1cc4f3);}exports['cs']=function(_0x412a72,_0x2a28c0,_0x4257c9,_0x5150a4,_0x1b0b98,_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={'user':_0x295763['username'],'pass':_0x295763[_0x0a9e('0x50')]};var _0x56e31e=_0x0a9e('0x51');var _0x427946=_0x0a9e('0x52');_0x295763['remoteUri']=intUtil['stripTrailingSlash'](_0x295763['remoteUri']);_0x295763[_0x0a9e('0x53')]=intUtil[_0x0a9e('0x54')](_0x295763[_0x0a9e('0x53')]);var _0x23a7d3=util[_0x0a9e('0x4c')](_0x0a9e('0x55'),_0x295763[_0x0a9e('0x56')]);_0x1148a1[_0x0a9e('0x16')]=!_['isNil'](_0x5150a4)?_0x5150a4[_0x0a9e('0x57')]:null;_0x1148a1[_0x0a9e('0x1c')]=_0x295763[_0x0a9e('0x57')];_0x1148a1['endUserNumber']=_0x4edbb0[_0x0a9e('0x2f')]()==='outbound'?_0x2a28c0[_0x0a9e('0x58')]:_0x2a28c0[_0x0a9e('0x59')];_0x1148a1['callDirection']=_0x4edbb0===_0x0a9e('0x5a')||_0x4edbb0===_0x0a9e('0x5b')?_0x0a9e('0x5a'):_0x0a9e('0x35');var _0x542ece=util[_0x0a9e('0x4c')](_0x0a9e('0x5c'),_0x295763[_0x0a9e('0x53')],_0x2a28c0[_0x0a9e('0x5d')],md5(_0x2a28c0['uniqueid']));if(_0x1b0b98&&_0x1b0b98[_0x0a9e('0x5e')]){logger[_0x0a9e('0x10')](_0x0a9e('0x5f'),_0x0a9e('0x60'));_0x2a28c0['recordingURL']=_0x542ece;}else if(_0x243d12&&_0x243d12[_0x0a9e('0x61')]&&_0x243d12[_0x0a9e('0x61')]!==_0x0a9e('0x62')){logger[_0x0a9e('0x10')](_0x0a9e('0x63'),_0x0a9e('0x60'));_0x2a28c0[_0x0a9e('0x64')]=_0x542ece;}else{_0x2a28c0[_0x0a9e('0x64')]='';}return getAdminUser(_0x4edbb0,_0x30944e,_0x1148a1,_0x23a7d3,_0x427946,_0x56e31e)[_0x0a9e('0x19')](getUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getEndUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getTicket(_0x4edbb0,_0x30944e,_0x23a7d3,_0x4257c9,_0x2a28c0,_0x427946))[_0x0a9e('0x19')](function(_0x25744a){logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x65'),_0x25744a[_0x0a9e('0x3f')]));logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x66'),_0x4edbb0));if(_0x4edbb0!==_0x0a9e('0x5b')){logger[_0x0a9e('0x10')]('['+[_0x4edbb0[_0x0a9e('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x295763['remoteUri'],_0x5150a4[_0x0a9e('0x33')],_0x25744a[_0x0a9e('0x3f')]);}})['catch'](function(_0x45108c){logger['error']('['+[_0x4edbb0[_0x0a9e('0x11')]()]+_0x0a9e('0x67'),util['inspect'](_0x45108c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 5a3cb80..36d6fb3 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 _0x86de=['trigger:browser:url','abandoned','monitor_format','calleridname','Inbound','[ABANDONED]','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','created_by','description','getString','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','Calls','format','apiKey','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','user_name','then','entry_list','find','name_value_list','value','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','content','toString','variable','custom_fields','customVariable','Variable','toLowerCase','login','username','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','%s/service/v4_1/rest.php','recordingFormat','Recording\x20is\x20enabled!','destcalleridnum','version','charAt','[OUTBOUND]'];(function(_0x404ca7,_0x5f3cf2){var _0x527193=function(_0x17fcb7){while(--_0x17fcb7){_0x404ca7['push'](_0x404ca7['shift']());}};_0x527193(++_0x5f3cf2);}(_0x86de,0x174));var _0xe86d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x86de[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe86d('0x0'));var rp=require(_0xe86d('0x1'));var BPromise=require(_0xe86d('0x2'));var md5=require(_0xe86d('0x3'));var util=require(_0xe86d('0x4'));var Redis=require(_0xe86d('0x5'));var intUtil=require(_0xe86d('0x6'));var config=require('../../../../config/environment');var logger=require(_0xe86d('0x7'))('sugarcrm');config[_0xe86d('0x8')]=_[_0xe86d('0x9')](config[_0xe86d('0x8')],{'host':_0xe86d('0xa'),'port':0x18eb});var io=require(_0xe86d('0xb'))(new Redis(config['redis']));var def={'method':_0xe86d('0xc'),'json':!![]};function emit(_0x496806,_0x176221,_0x2d74ae){io['to'](_0x496806)[_0xe86d('0xd')](_0x176221,_0x2d74ae);}function getTicket(_0x4d7c32,_0x5c88bf,_0x2b2c83,_0xa9e7e4,_0x3856f8,_0x1a82ec,_0x1c6d93,_0xec635){logger[_0xe86d('0xe')](_0xe86d('0xf'));var _0x52fb84=new Date();var _0x37643f=[{'name':_0xe86d('0x10'),'value':intUtil['getString'](_0xa9e7e4[_0xe86d('0x11')],_0x3856f8,'\x20')},{'name':'assigned_user_id','value':_0x5c88bf['id']},{'name':_0xe86d('0x12'),'value':_0x5c88bf['id']},{'name':_0xe86d('0x13'),'value':intUtil[_0xe86d('0x14')](_0xa9e7e4[_0xe86d('0x15')],_0x3856f8,'\x0a')},{'name':_0xe86d('0x16'),'value':_0x52fb84[_0xe86d('0x17')]()['slice'](0x0,0x13)[_0xe86d('0x18')]('T','\x20')},{'name':_0xe86d('0x19'),'value':'0'},{'name':_0xe86d('0x1a'),'value':'15'},{'name':_0xe86d('0x1b'),'value':_0x2b2c83['id']},{'name':_0xe86d('0x1c'),'value':_0xe86d('0x1d')},{'name':_0xe86d('0x1e'),'value':_0x2b2c83[_0xe86d('0x10')]},{'name':_0xe86d('0x1f'),'value':_0xec635}];if(_0x1a82ec[_0xe86d('0x20')]){_[_0xe86d('0x21')](_0x1a82ec,function(_0x36d0ed){if(_0x3856f8[_0x36d0ed[_0xe86d('0x22')]]){_0x37643f[_0xe86d('0x23')]({'name':_0x36d0ed[_0xe86d('0x24')],'value':_0x3856f8[_0x36d0ed['variableName']]});}});}return request({'form':{'method':_0xe86d('0x25'),'input_type':'JSON','response_type':_0xe86d('0x26'),'rest_data':JSON['stringify']({'session':_0x1c6d93['id'],'module_name':_0xe86d('0x27'),'name_value_list':_0x37643f})}});}function getAuth(_0x55ec5c){return util[_0xe86d('0x28')]('Basic\x20%s',new Buffer(_0x55ec5c[_0xe86d('0x29')]+':X')['toString'](_0xe86d('0x2a')));}function getServerInfo(_0x5d473d){return request({'form':{'method':_0xe86d('0x2b'),'input_type':_0xe86d('0x26'),'response_type':_0xe86d('0x26'),'rest_data':JSON[_0xe86d('0x2c')]({'session':_0x5d473d['id']})}});}function getUser(_0x8fea1,_0x38eae9,_0x991e97){if(!_[_0xe86d('0x2d')](_0x38eae9)){logger[_0xe86d('0xe')](_0xe86d('0x2e'),_0x38eae9);return request({'form':{'method':_0xe86d('0x2f'),'input_type':_0xe86d('0x26'),'response_type':_0xe86d('0x26'),'rest_data':JSON[_0xe86d('0x2c')]({'session':_0x991e97['id'],'module_name':'Employees','query':util[_0xe86d('0x28')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x38eae9),'order_by':'','offset':'0','select_fields':['id',_0xe86d('0x10'),_0xe86d('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe86d('0x31')](function(_0x39e620){if(_0x39e620[_0xe86d('0x32')]['length']){var _0xaef9c8=_[_0xe86d('0x33')](_0x39e620[_0xe86d('0x32')],function(_0x42124d){return _0x42124d[_0xe86d('0x34')][_0xe86d('0x30')][_0xe86d('0x35')]===_0x38eae9;});if(_0xaef9c8){logger['info']('Agent\x20found!');return BPromise[_0xe86d('0x36')]({'id':_0xaef9c8[_0xe86d('0x34')]['id']['value'],'name':_0xaef9c8[_0xe86d('0x34')][_0xe86d('0x10')][_0xe86d('0x35')]});}}logger[_0xe86d('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xe86d('0x36')]({'id':_0x991e97['name_value_list'][_0xe86d('0x37')][_0xe86d('0x35')],'name':_0x991e97[_0xe86d('0x34')][_0xe86d('0x30')][_0xe86d('0x35')]});});}else{logger[_0xe86d('0xe')](_0xe86d('0x38'));return BPromise[_0xe86d('0x36')]({'id':_0x991e97['name_value_list'][_0xe86d('0x37')][_0xe86d('0x35')],'name':_0x991e97[_0xe86d('0x34')]['user_name'][_0xe86d('0x35')]});}}function getEndUser(_0x3a4783,_0x3f94c6,_0x3511d5,_0x416751){logger[_0xe86d('0xe')](_0xe86d('0x39'),_0x3511d5);return request({'form':{'method':'get_entry_list','input_type':_0xe86d('0x26'),'response_type':_0xe86d('0x26'),'rest_data':JSON['stringify']({'session':_0x416751['id'],'module_name':_0xe86d('0x1d'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x3511d5),'order_by':'','offset':'0','select_fields':['id',_0xe86d('0x10'),_0xe86d('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2f827c){if(_0x2f827c[_0xe86d('0x32')]['length']){var _0xf4366=_[_0xe86d('0x33')](_0x2f827c[_0xe86d('0x32')],function(_0x45c7f4){return _0x45c7f4['name_value_list'][_0xe86d('0x3a')][_0xe86d('0x35')]===_0x3511d5;});if(_0xf4366){logger[_0xe86d('0xe')](_0xe86d('0x3b'));return BPromise[_0xe86d('0x36')]({'id':_0xf4366[_0xe86d('0x34')]['id'][_0xe86d('0x35')],'name':_0xf4366['name_value_list']['name'][_0xe86d('0x35')],'phone':_0xf4366['name_value_list'][_0xe86d('0x3a')]['value']});}}else{logger[_0xe86d('0xe')](_0xe86d('0x3c'));return request({'form':{'method':_0xe86d('0x25'),'input_type':_0xe86d('0x26'),'response_type':_0xe86d('0x26'),'rest_data':JSON[_0xe86d('0x2c')]({'session':_0x416751['id'],'module_name':_0xe86d('0x1d'),'name_value_list':[{'name':_0xe86d('0x3d'),'value':_0x3f94c6!==_0xe86d('0x3e')?_0x3f94c6:util[_0xe86d('0x28')](_0xe86d('0x3f'),_0x3511d5)},{'name':'phone_home','value':_0x3511d5}]})}})[_0xe86d('0x31')](function(_0x2d2a37){logger[_0xe86d('0xe')](_0xe86d('0x40'));return BPromise[_0xe86d('0x36')]({'id':_0x2d2a37['id'],'name':_0x2d2a37[_0xe86d('0x32')][_0xe86d('0x3d')]['value'],'phone':_0x2d2a37[_0xe86d('0x32')][_0xe86d('0x3a')][_0xe86d('0x35')]});});}});}function request(_0x463caa){logger[_0xe86d('0x41')](_0xe86d('0x42'),JSON[_0xe86d('0x2c')](_0x463caa));return rp(_[_0xe86d('0x43')](def,_0x463caa));}function getTags(_0x399c09,_0x23061f){var _0x18636b=[];if(_0x399c09&&_0x399c09[_0xe86d('0x20')]>0x0){_0x18636b=_[_0xe86d('0x44')](_0x399c09,_0x23061f);}return _0x18636b;}function getCustomFields(_0x54b0c4,_0x449beb){var _0x62b0=[];var _0x1dfb1f={'custom_fields':[]};if(_0x54b0c4['length']>0x0){_[_0xe86d('0x21')](_0x54b0c4,function(_0x40af18){if(_0x40af18[_0xe86d('0x45')]===_0xe86d('0x46')&&_0x40af18[_0xe86d('0x47')]&&!_0x40af18[_0xe86d('0x48')]){_0x1dfb1f[_0x40af18[_0xe86d('0x47')]['toLowerCase']()]=_0x40af18[_0xe86d('0x49')][_0xe86d('0x4a')]();}else if(_0x40af18[_0xe86d('0x45')]===_0xe86d('0x46')&&_0x40af18[_0xe86d('0x24')]&&_0x40af18[_0xe86d('0x48')]){_0x1dfb1f['custom_fields'][_0xe86d('0x23')]({'id':_0x40af18['idField'],'value':_0x40af18[_0xe86d('0x49')][_0xe86d('0x4a')]()});}else if(_0x40af18[_0xe86d('0x45')]===_0xe86d('0x4b')&&_0x40af18[_0xe86d('0x22')]&&_0x40af18[_0xe86d('0x24')]&&_0x40af18[_0xe86d('0x48')]){_0x449beb[_0x40af18[_0xe86d('0x22')]]&&_0x1dfb1f[_0xe86d('0x4c')][_0xe86d('0x23')]({'id':_0x40af18[_0xe86d('0x24')],'value':_0x449beb[_0x40af18[_0xe86d('0x22')]]['toString']()});}else if(_0x40af18[_0xe86d('0x45')]===_0xe86d('0x4d')&&_0x40af18['Variable']&&_0x40af18['Variable'][_0xe86d('0x10')]&&_0x40af18[_0xe86d('0x24')]&&_0x40af18['customField']){_0x449beb[_0x40af18[_0xe86d('0x4e')][_0xe86d('0x10')][_0xe86d('0x4f')]()]&&_0x1dfb1f['custom_fields'][_0xe86d('0x23')]({'id':_0x40af18[_0xe86d('0x24')],'value':_0x449beb[_0x40af18['Variable']['name']['toLowerCase']()]['toString']()});}});}return _0x1dfb1f;}function getConnection(_0x2d2e7a){return request({'method':_0xe86d('0xc'),'form':{'method':_0xe86d('0x50'),'input_type':_0xe86d('0x26'),'response_type':'JSON','rest_data':JSON[_0xe86d('0x2c')]({'user_auth':{'user_name':_0x2d2e7a[_0xe86d('0x51')],'password':_0x2d2e7a['password'],'encryption':_0xe86d('0x52')},'application':_0xe86d('0x53')})}})[_0xe86d('0x31')](function(_0x1457aa){var _0x576ddc=_0x1457aa;if(_0x576ddc['id']){def['sessionID']=_0x576ddc['id'];return BPromise[_0xe86d('0x36')](_0x576ddc);}else{throw new Error(util[_0xe86d('0x28')](_0xe86d('0x54'),_0x2d2e7a['id']));}});}function setRelationship(_0x1a1d67,_0x301dd2,_0x554bf6,_0x525e8a){return request({'form':{'method':_0xe86d('0x55'),'input_type':_0xe86d('0x26'),'response_type':_0xe86d('0x26'),'rest_data':JSON[_0xe86d('0x2c')]({'session':_0x1a1d67['id'],'module_name':'Calls','module_id':_0x554bf6['id'],'link_field_name':_0x525e8a,'related_ids':[_0x301dd2['id']]})}});}exports[_0xe86d('0x56')]=function(_0x4f764d,_0x55450a,_0x562024,_0x33ee93,_0x404f52,_0x3f88a1){var _0xc134d7,_0x29d43d,_0x2f0756,_0x543cfa;_0x3f88a1[_0xe86d('0x57')]=intUtil[_0xe86d('0x58')](_0x3f88a1[_0xe86d('0x57')]);_0x3f88a1[_0xe86d('0x59')]=intUtil[_0xe86d('0x58')](_0x3f88a1[_0xe86d('0x59')]);def[_0xe86d('0x5a')]=util[_0xe86d('0x28')]('%s/service/v4_1/rest.php',_0x3f88a1['remoteUri']);if(_0x404f52&&_0x404f52['monitor_format']){logger['info'](_0xe86d('0x5b'),'Recording\x20is\x20enabled!');_0x55450a[_0xe86d('0x5c')]=util[_0xe86d('0x28')](_0xe86d('0x5d'),_0x3f88a1[_0xe86d('0x59')],_0x55450a[_0xe86d('0x5e')],md5(_0x55450a[_0xe86d('0x5e')]));}else{_0x55450a[_0xe86d('0x5c')]='';}return getConnection(_0x3f88a1)[_0xe86d('0x31')](function(_0x353667){_0x543cfa=_0x353667;return getUser(_0x3f88a1,_0x33ee93[_0xe86d('0x10')],_0x543cfa);})[_0xe86d('0x31')](function(_0x99183d){_0xc134d7=_0x99183d;logger['info'](_0xe86d('0x5f'),_0xc134d7['id']);return getEndUser(_0x3f88a1,_0x55450a['calleridname'],_0x55450a[_0xe86d('0x60')],_0x543cfa);})[_0xe86d('0x31')](function(_0x5a6266){_0x29d43d=_0x5a6266;logger[_0xe86d('0xe')](_0xe86d('0x61'),_0x29d43d['id']);return getTicket(_0x3f88a1,_0xc134d7,_0x29d43d,_0x562024,_0x55450a,_0x562024[_0xe86d('0x62')],_0x543cfa,'Inbound');})[_0xe86d('0x31')](function(_0x1b2311){_0x2f0756=_0x1b2311;logger['info'](_0xe86d('0x63'));logger[_0xe86d('0xe')](_0xe86d('0x64'),_0x2f0756['id']);return setRelationship(_0x543cfa,_0xc134d7,_0x2f0756,_0xe86d('0x65'));})[_0xe86d('0x31')](function(){return setRelationship(_0x543cfa,_0x29d43d,_0x2f0756,_0xe86d('0x66'));})[_0xe86d('0x31')](function(){return getServerInfo(_0x543cfa);})['then'](function(_0x3bfc04){var _0x4523ae=parseInt(_0x3bfc04['version']['charAt'](0x0));var _0x5c6a2a=util['format'](_0xe86d('0x67'),_0x3f88a1[_0xe86d('0x57')],_0x2f0756['id']);if(_0x4523ae>0x6){_0x5c6a2a=util[_0xe86d('0x28')](_0xe86d('0x68'),_0x3f88a1[_0xe86d('0x57')],_0x2f0756['id']);}logger[_0xe86d('0xe')](_0xe86d('0x5b'),_0xe86d('0x69'));emit(util[_0xe86d('0x28')](_0xe86d('0x6a'),_0x33ee93[_0xe86d('0x10')]),'trigger:browser:url',{'uri':_0x5c6a2a});})[_0xe86d('0x6b')](function(_0x4d2de8){logger[_0xe86d('0x6c')]('[QUEUE]',JSON['stringify'](_0x4d2de8));});};exports['outbound']=function(_0x5e74bd,_0x4c01f9,_0x30b2dc,_0x416771,_0x54f8c5,_0x301931,_0x78483f){var _0xa28d3f,_0xf87cf1,_0x31c9c6,_0x6d7eb;_0x301931[_0xe86d('0x57')]=intUtil[_0xe86d('0x58')](_0x301931[_0xe86d('0x57')]);_0x301931[_0xe86d('0x59')]=intUtil[_0xe86d('0x58')](_0x301931[_0xe86d('0x59')]);def[_0xe86d('0x5a')]=util[_0xe86d('0x28')](_0xe86d('0x6d'),_0x301931[_0xe86d('0x57')]);if(_0x78483f&&_0x78483f[_0xe86d('0x6e')]&&_0x78483f['recordingFormat']!=='none'){logger[_0xe86d('0xe')]('[OUTBOUND]',_0xe86d('0x6f'));_0x4c01f9['recordingURL']=util[_0xe86d('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x301931[_0xe86d('0x59')],_0x4c01f9[_0xe86d('0x5e')],md5(_0x4c01f9[_0xe86d('0x5e')]));}return getConnection(_0x301931)[_0xe86d('0x31')](function(_0x3b2839){_0x6d7eb=_0x3b2839;return getUser(_0x301931,_0x416771[_0xe86d('0x10')],_0x6d7eb);})[_0xe86d('0x31')](function(_0x32bf81){_0xa28d3f=_0x32bf81;logger[_0xe86d('0xe')](_0xe86d('0x5f'),_0xa28d3f['id']);return getEndUser(_0x301931,_0x4c01f9['destcalleridname'],_0x4c01f9[_0xe86d('0x70')],_0x6d7eb);})[_0xe86d('0x31')](function(_0x42bd75){_0xf87cf1=_0x42bd75;logger['info'](_0xe86d('0x61'),_0xf87cf1['id']);return getTicket(_0x301931,_0xa28d3f,_0xf87cf1,_0x30b2dc,_0x4c01f9,_0x30b2dc[_0xe86d('0x62')],_0x6d7eb,'Outbound');})[_0xe86d('0x31')](function(_0x56d90f){_0x31c9c6=_0x56d90f;logger['info'](_0xe86d('0x63'));logger[_0xe86d('0xe')](_0xe86d('0x64'),_0x31c9c6['id']);return setRelationship(_0x6d7eb,_0xa28d3f,_0x31c9c6,_0xe86d('0x65'));})[_0xe86d('0x31')](function(){return setRelationship(_0x6d7eb,_0xf87cf1,_0x31c9c6,_0xe86d('0x66'));})[_0xe86d('0x31')](function(){return getServerInfo(_0x6d7eb);})['then'](function(_0x3d0921){var _0xb79979=parseInt(_0x3d0921[_0xe86d('0x71')][_0xe86d('0x72')](0x0));var _0x43cf57=util[_0xe86d('0x28')](_0xe86d('0x67'),_0x301931['remoteUri'],_0x31c9c6['id']);if(_0xb79979>0x6){_0x43cf57=util[_0xe86d('0x28')](_0xe86d('0x68'),_0x301931[_0xe86d('0x57')],_0x31c9c6['id']);}logger[_0xe86d('0xe')](_0xe86d('0x73'),_0xe86d('0x69'));emit(util[_0xe86d('0x28')](_0xe86d('0x6a'),_0x416771[_0xe86d('0x10')]),_0xe86d('0x74'),{'uri':_0x43cf57});})[_0xe86d('0x6b')](function(_0x295458){logger[_0xe86d('0x6c')]('[OUTBOUND]',JSON[_0xe86d('0x2c')](_0x295458));});};exports[_0xe86d('0x75')]=function(_0x47a6e7,_0x754ec0,_0x24d780,_0x550e0c,_0x5ec21c,_0xb2c0c5){var _0x6a6b22,_0x1fada6,_0x268ab7,_0x36dda7;_0xb2c0c5[_0xe86d('0x57')]=intUtil[_0xe86d('0x58')](_0xb2c0c5[_0xe86d('0x57')]);_0xb2c0c5[_0xe86d('0x59')]=intUtil[_0xe86d('0x58')](_0xb2c0c5['serverUrl']);def[_0xe86d('0x5a')]=util[_0xe86d('0x28')]('%s/service/v4_1/rest.php',_0xb2c0c5[_0xe86d('0x57')]);if(_0x5ec21c&&_0x5ec21c[_0xe86d('0x76')]){logger[_0xe86d('0xe')]('[ABANDONED]','Recording\x20is\x20enabled!');_0x754ec0['recordingURL']=util[_0xe86d('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xb2c0c5[_0xe86d('0x59')],_0x754ec0[_0xe86d('0x5e')],md5(_0x754ec0['uniqueid']));}else{_0x754ec0['recordingURL']='';}return getConnection(_0xb2c0c5)[_0xe86d('0x31')](function(_0x2e5d83){_0x36dda7=_0x2e5d83;if(!_[_0xe86d('0x2d')](_0x550e0c)){return getUser(_0xb2c0c5,_0x550e0c['name'],_0x36dda7);}else{return getUser(_0xb2c0c5,null,_0x36dda7);}})[_0xe86d('0x31')](function(_0x2cf6f6){_0x6a6b22=_0x2cf6f6;logger[_0xe86d('0xe')](_0xe86d('0x5f'),_0x6a6b22['id']);return getEndUser(_0xb2c0c5,_0x754ec0[_0xe86d('0x77')],_0x754ec0[_0xe86d('0x60')],_0x36dda7);})[_0xe86d('0x31')](function(_0x5e2876){_0x1fada6=_0x5e2876;logger[_0xe86d('0xe')]('The\x20Enduser\x20ID\x20is:',_0x1fada6['id']);return getTicket(_0xb2c0c5,_0x6a6b22,_0x1fada6,_0x24d780,_0x754ec0,_0x24d780[_0xe86d('0x62')],_0x36dda7,_0xe86d('0x78'));})[_0xe86d('0x31')](function(_0x50c0e3){_0x268ab7=_0x50c0e3;logger[_0xe86d('0xe')](_0xe86d('0x63'));logger[_0xe86d('0xe')](_0xe86d('0x64'),_0x268ab7['id']);return setRelationship(_0x36dda7,_0x6a6b22,_0x268ab7,_0xe86d('0x65'));})['then'](function(){return setRelationship(_0x36dda7,_0x1fada6,_0x268ab7,_0xe86d('0x66'));})[_0xe86d('0x31')](function(){return getServerInfo(_0x36dda7);})[_0xe86d('0x6b')](function(_0x15cac8){logger[_0xe86d('0x6c')](_0xe86d('0x79'),JSON[_0xe86d('0x2c')](_0x15cac8));});}; \ No newline at end of file +var _0xe57f=['redis','defaults','localhost','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','slice','replace','duration_minutes','parent_id','Contacts','parent_name','length','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','find','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','string','nameField','customField','toLowerCase','content','type','custom_fields','variable','push','Variable','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','error','[ABANDONED]','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','sugarcrm'];(function(_0x615912,_0x139522){var _0x2d13d8=function(_0x21f800){while(--_0x21f800){_0x615912['push'](_0x615912['shift']());}};_0x2d13d8(++_0x139522);}(_0xe57f,0x1c8));var _0xfe57=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe57f[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var rp=require(_0xfe57('0x0'));var BPromise=require(_0xfe57('0x1'));var md5=require(_0xfe57('0x2'));var util=require(_0xfe57('0x3'));var Redis=require(_0xfe57('0x4'));var intUtil=require(_0xfe57('0x5'));var config=require('../../../../config/environment');var logger=require(_0xfe57('0x6'))(_0xfe57('0x7'));config[_0xfe57('0x8')]=_[_0xfe57('0x9')](config[_0xfe57('0x8')],{'host':_0xfe57('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfe57('0x8')]));var def={'method':_0xfe57('0xb'),'json':!![]};function emit(_0x1a7c13,_0x42cd9a,_0x2f7954){io['to'](_0x1a7c13)[_0xfe57('0xc')](_0x42cd9a,_0x2f7954);}function getTicket(_0x85456a,_0xa439f3,_0x212c73,_0x5705af,_0x4bf024,_0x4cc334,_0x28a283,_0x27656d){logger['info'](_0xfe57('0xd'));var _0x1b3bb1=new Date();var _0x4765ac=[{'name':_0xfe57('0xe'),'value':intUtil[_0xfe57('0xf')](_0x5705af[_0xfe57('0x10')],_0x4bf024,'\x20')},{'name':_0xfe57('0x11'),'value':_0xa439f3['id']},{'name':_0xfe57('0x12'),'value':_0xa439f3['id']},{'name':_0xfe57('0x13'),'value':intUtil['getString'](_0x5705af[_0xfe57('0x14')],_0x4bf024,'\x0a')},{'name':'date_start','value':_0x1b3bb1['toISOString']()[_0xfe57('0x15')](0x0,0x13)[_0xfe57('0x16')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xfe57('0x17'),'value':'15'},{'name':_0xfe57('0x18'),'value':_0x212c73['id']},{'name':'parent_type','value':_0xfe57('0x19')},{'name':_0xfe57('0x1a'),'value':_0x212c73['name']},{'name':'direction','value':_0x27656d}];if(_0x4cc334[_0xfe57('0x1b')]){_[_0xfe57('0x1c')](_0x4cc334,function(_0x1cfed4){if(_0x4bf024[_0x1cfed4[_0xfe57('0x1d')]]){_0x4765ac['push']({'name':_0x1cfed4[_0xfe57('0x1e')],'value':_0x4bf024[_0x1cfed4[_0xfe57('0x1d')]]});}});}return request({'form':{'method':_0xfe57('0x1f'),'input_type':_0xfe57('0x20'),'response_type':'JSON','rest_data':JSON[_0xfe57('0x21')]({'session':_0x28a283['id'],'module_name':_0xfe57('0x22'),'name_value_list':_0x4765ac})}});}function getAuth(_0x525b18){return util[_0xfe57('0x23')]('Basic\x20%s',new Buffer(_0x525b18[_0xfe57('0x24')]+':X')[_0xfe57('0x25')](_0xfe57('0x26')));}function getServerInfo(_0x2da4a3){return request({'form':{'method':_0xfe57('0x27'),'input_type':_0xfe57('0x20'),'response_type':_0xfe57('0x20'),'rest_data':JSON['stringify']({'session':_0x2da4a3['id']})}});}function getUser(_0x86155e,_0x3d1e58,_0x36731f){if(!_[_0xfe57('0x28')](_0x3d1e58)){logger[_0xfe57('0x29')](_0xfe57('0x2a'),_0x3d1e58);return request({'form':{'method':_0xfe57('0x2b'),'input_type':_0xfe57('0x20'),'response_type':_0xfe57('0x20'),'rest_data':JSON['stringify']({'session':_0x36731f['id'],'module_name':_0xfe57('0x2c'),'query':util['format'](_0xfe57('0x2d'),_0x3d1e58),'order_by':'','offset':'0','select_fields':['id',_0xfe57('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xfe57('0x2e')](function(_0x48e22f){if(_0x48e22f[_0xfe57('0x2f')]['length']){var _0x34b8d3=_['find'](_0x48e22f['entry_list'],function(_0x48fef6){return _0x48fef6[_0xfe57('0x30')][_0xfe57('0x31')][_0xfe57('0x32')]===_0x3d1e58;});if(_0x34b8d3){logger[_0xfe57('0x29')](_0xfe57('0x33'));return BPromise[_0xfe57('0x34')]({'id':_0x34b8d3[_0xfe57('0x30')]['id'][_0xfe57('0x32')],'name':_0x34b8d3[_0xfe57('0x30')][_0xfe57('0xe')][_0xfe57('0x32')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xfe57('0x34')]({'id':_0x36731f[_0xfe57('0x30')]['user_id'][_0xfe57('0x32')],'name':_0x36731f[_0xfe57('0x30')][_0xfe57('0x31')]['value']});});}else{logger['info'](_0xfe57('0x35'));return BPromise['resolve']({'id':_0x36731f[_0xfe57('0x30')][_0xfe57('0x36')][_0xfe57('0x32')],'name':_0x36731f[_0xfe57('0x30')][_0xfe57('0x31')]['value']});}}function getEndUser(_0x1fb812,_0xd20778,_0x3274aa,_0x394bb2){logger[_0xfe57('0x29')](_0xfe57('0x37'),_0x3274aa);return request({'form':{'method':_0xfe57('0x2b'),'input_type':_0xfe57('0x20'),'response_type':_0xfe57('0x20'),'rest_data':JSON['stringify']({'session':_0x394bb2['id'],'module_name':_0xfe57('0x19'),'query':util['format'](_0xfe57('0x38'),_0x3274aa),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xfe57('0x2e')](function(_0x79543d){if(_0x79543d[_0xfe57('0x2f')][_0xfe57('0x1b')]){var _0x47c271=_[_0xfe57('0x39')](_0x79543d[_0xfe57('0x2f')],function(_0x2c4536){return _0x2c4536[_0xfe57('0x30')][_0xfe57('0x3a')]['value']===_0x3274aa;});if(_0x47c271){logger[_0xfe57('0x29')](_0xfe57('0x3b'));return BPromise[_0xfe57('0x34')]({'id':_0x47c271['name_value_list']['id'][_0xfe57('0x32')],'name':_0x47c271['name_value_list'][_0xfe57('0xe')][_0xfe57('0x32')],'phone':_0x47c271['name_value_list'][_0xfe57('0x3a')][_0xfe57('0x32')]});}}else{logger[_0xfe57('0x29')](_0xfe57('0x3c'));return request({'form':{'method':'set_entry','input_type':_0xfe57('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x394bb2['id'],'module_name':'Contacts','name_value_list':[{'name':_0xfe57('0x3d'),'value':_0xd20778!==''?_0xd20778:util[_0xfe57('0x23')](_0xfe57('0x3e'),_0x3274aa)},{'name':_0xfe57('0x3a'),'value':_0x3274aa}]})}})[_0xfe57('0x2e')](function(_0x7ad5ba){logger[_0xfe57('0x29')](_0xfe57('0x3f'));return BPromise[_0xfe57('0x34')]({'id':_0x7ad5ba['id'],'name':_0x7ad5ba[_0xfe57('0x2f')][_0xfe57('0x3d')][_0xfe57('0x32')],'phone':_0x7ad5ba[_0xfe57('0x2f')][_0xfe57('0x3a')][_0xfe57('0x32')]});});}});}function request(_0x488507){logger[_0xfe57('0x40')]('[HTTP]',JSON[_0xfe57('0x21')](_0x488507));return rp(_[_0xfe57('0x41')](def,_0x488507));}function getTags(_0x396df6,_0x18f0c0){var _0x369c2e=[];if(_0x396df6&&_0x396df6[_0xfe57('0x1b')]>0x0){_0x369c2e=_['map'](_0x396df6,_0x18f0c0);}return _0x369c2e;}function getCustomFields(_0x58b336,_0x33d6c4){var _0xfa80e0=[];var _0x5daf06={'custom_fields':[]};if(_0x58b336['length']>0x0){_[_0xfe57('0x1c')](_0x58b336,function(_0x1a566d){if(_0x1a566d['type']===_0xfe57('0x42')&&_0x1a566d[_0xfe57('0x43')]&&!_0x1a566d[_0xfe57('0x44')]){_0x5daf06[_0x1a566d[_0xfe57('0x43')][_0xfe57('0x45')]()]=_0x1a566d[_0xfe57('0x46')]['toString']();}else if(_0x1a566d[_0xfe57('0x47')]===_0xfe57('0x42')&&_0x1a566d[_0xfe57('0x1e')]&&_0x1a566d[_0xfe57('0x44')]){_0x5daf06[_0xfe57('0x48')]['push']({'id':_0x1a566d[_0xfe57('0x1e')],'value':_0x1a566d[_0xfe57('0x46')][_0xfe57('0x25')]()});}else if(_0x1a566d['type']===_0xfe57('0x49')&&_0x1a566d[_0xfe57('0x1d')]&&_0x1a566d[_0xfe57('0x1e')]&&_0x1a566d[_0xfe57('0x44')]){_0x33d6c4[_0x1a566d[_0xfe57('0x1d')]]&&_0x5daf06['custom_fields'][_0xfe57('0x4a')]({'id':_0x1a566d['idField'],'value':_0x33d6c4[_0x1a566d['variableName']]['toString']()});}else if(_0x1a566d[_0xfe57('0x47')]==='customVariable'&&_0x1a566d[_0xfe57('0x4b')]&&_0x1a566d[_0xfe57('0x4b')][_0xfe57('0xe')]&&_0x1a566d[_0xfe57('0x1e')]&&_0x1a566d[_0xfe57('0x44')]){_0x33d6c4[_0x1a566d[_0xfe57('0x4b')][_0xfe57('0xe')][_0xfe57('0x45')]()]&&_0x5daf06[_0xfe57('0x48')][_0xfe57('0x4a')]({'id':_0x1a566d[_0xfe57('0x1e')],'value':_0x33d6c4[_0x1a566d[_0xfe57('0x4b')][_0xfe57('0xe')][_0xfe57('0x45')]()][_0xfe57('0x25')]()});}});}return _0x5daf06;}function getConnection(_0x43ca39){return request({'method':'POST','form':{'method':'login','input_type':_0xfe57('0x20'),'response_type':'JSON','rest_data':JSON[_0xfe57('0x21')]({'user_auth':{'user_name':_0x43ca39['username'],'password':_0x43ca39[_0xfe57('0x4c')],'encryption':_0xfe57('0x4d')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xfe57('0x2e')](function(_0x1238fe){var _0x54b103=_0x1238fe;if(_0x54b103['id']){def[_0xfe57('0x4e')]=_0x54b103['id'];return BPromise[_0xfe57('0x34')](_0x54b103);}else{throw new Error(util['format'](_0xfe57('0x4f'),_0x43ca39['id']));}});}function setRelationship(_0x315b62,_0x3f9059,_0x416ef0,_0x53d938){return request({'form':{'method':_0xfe57('0x50'),'input_type':_0xfe57('0x20'),'response_type':_0xfe57('0x20'),'rest_data':JSON[_0xfe57('0x21')]({'session':_0x315b62['id'],'module_name':_0xfe57('0x22'),'module_id':_0x416ef0['id'],'link_field_name':_0x53d938,'related_ids':[_0x3f9059['id']]})}});}exports['queue']=function(_0x51abb9,_0x269b49,_0x251da5,_0x549b79,_0x1953d7,_0x286166){var _0x456b84,_0xcdf901,_0xc6c07,_0xafaed0;_0x286166[_0xfe57('0x51')]=intUtil[_0xfe57('0x52')](_0x286166[_0xfe57('0x51')]);_0x286166[_0xfe57('0x53')]=intUtil[_0xfe57('0x52')](_0x286166['serverUrl']);def[_0xfe57('0x54')]=util['format'](_0xfe57('0x55'),_0x286166[_0xfe57('0x51')]);if(_0x1953d7&&_0x1953d7[_0xfe57('0x56')]){logger[_0xfe57('0x29')](_0xfe57('0x57'),_0xfe57('0x58'));_0x269b49[_0xfe57('0x59')]=util[_0xfe57('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x286166[_0xfe57('0x53')],_0x269b49[_0xfe57('0x5a')],md5(_0x269b49[_0xfe57('0x5a')]));}else{_0x269b49['recordingURL']='';}return getConnection(_0x286166)[_0xfe57('0x2e')](function(_0x299bab){_0xafaed0=_0x299bab;return getUser(_0x286166,_0x549b79[_0xfe57('0xe')],_0xafaed0);})[_0xfe57('0x2e')](function(_0x16e38f){_0x456b84=_0x16e38f;logger['info'](_0xfe57('0x5b'),_0x456b84['id']);return getEndUser(_0x286166,_0x269b49[_0xfe57('0x5c')],_0x269b49[_0xfe57('0x5d')],_0xafaed0);})[_0xfe57('0x2e')](function(_0x25faa5){_0xcdf901=_0x25faa5;logger[_0xfe57('0x29')]('The\x20Enduser\x20ID\x20is:',_0xcdf901['id']);return getTicket(_0x286166,_0x456b84,_0xcdf901,_0x251da5,_0x269b49,_0x251da5[_0xfe57('0x5e')],_0xafaed0,_0xfe57('0x5f'));})[_0xfe57('0x2e')](function(_0x1b87c6){_0xc6c07=_0x1b87c6;logger[_0xfe57('0x29')](_0xfe57('0x60'));logger[_0xfe57('0x29')](_0xfe57('0x61'),_0xc6c07['id']);return setRelationship(_0xafaed0,_0x456b84,_0xc6c07,_0xfe57('0x62'));})[_0xfe57('0x2e')](function(){return setRelationship(_0xafaed0,_0xcdf901,_0xc6c07,_0xfe57('0x63'));})['then'](function(){return getServerInfo(_0xafaed0);})['then'](function(_0x5170be){var _0x4013f9=parseInt(_0x5170be['version'][_0xfe57('0x64')](0x0));var _0x326c6b=util[_0xfe57('0x23')](_0xfe57('0x65'),_0x286166[_0xfe57('0x51')],_0xc6c07['id']);if(_0x4013f9>0x6){_0x326c6b=util[_0xfe57('0x23')](_0xfe57('0x66'),_0x286166[_0xfe57('0x51')],_0xc6c07['id']);}logger[_0xfe57('0x29')](_0xfe57('0x57'),_0xfe57('0x67'));emit(util[_0xfe57('0x23')]('user:%s',_0x549b79[_0xfe57('0xe')]),_0xfe57('0x68'),{'uri':_0x326c6b});})[_0xfe57('0x69')](function(_0x4a69fd){logger['error'](_0xfe57('0x57'),JSON[_0xfe57('0x21')](_0x4a69fd));});};exports[_0xfe57('0x6a')]=function(_0x187bbd,_0x270a5b,_0x1e3274,_0x27f682,_0x3b8c2f,_0x27a93e,_0x50da81){var _0x1937fa,_0x4eafcd,_0xd82a4e,_0x42f77a;_0x27a93e[_0xfe57('0x51')]=intUtil[_0xfe57('0x52')](_0x27a93e[_0xfe57('0x51')]);_0x27a93e['serverUrl']=intUtil['stripTrailingSlash'](_0x27a93e[_0xfe57('0x53')]);def[_0xfe57('0x54')]=util[_0xfe57('0x23')](_0xfe57('0x55'),_0x27a93e['remoteUri']);if(_0x50da81&&_0x50da81[_0xfe57('0x6b')]&&_0x50da81[_0xfe57('0x6b')]!=='none'){logger[_0xfe57('0x29')](_0xfe57('0x6c'),_0xfe57('0x58'));_0x270a5b[_0xfe57('0x59')]=util[_0xfe57('0x23')](_0xfe57('0x6d'),_0x27a93e[_0xfe57('0x53')],_0x270a5b[_0xfe57('0x5a')],md5(_0x270a5b['uniqueid']));}return getConnection(_0x27a93e)[_0xfe57('0x2e')](function(_0x455c99){_0x42f77a=_0x455c99;return getUser(_0x27a93e,_0x27f682[_0xfe57('0xe')],_0x42f77a);})[_0xfe57('0x2e')](function(_0x580b37){_0x1937fa=_0x580b37;logger['info'](_0xfe57('0x5b'),_0x1937fa['id']);return getEndUser(_0x27a93e,_0x270a5b[_0xfe57('0x6e')],_0x270a5b[_0xfe57('0x6f')],_0x42f77a);})[_0xfe57('0x2e')](function(_0x2d54a1){_0x4eafcd=_0x2d54a1;logger[_0xfe57('0x29')](_0xfe57('0x70'),_0x4eafcd['id']);return getTicket(_0x27a93e,_0x1937fa,_0x4eafcd,_0x1e3274,_0x270a5b,_0x1e3274[_0xfe57('0x5e')],_0x42f77a,_0xfe57('0x71'));})[_0xfe57('0x2e')](function(_0x11bb99){_0xd82a4e=_0x11bb99;logger[_0xfe57('0x29')](_0xfe57('0x60'));logger[_0xfe57('0x29')](_0xfe57('0x61'),_0xd82a4e['id']);return setRelationship(_0x42f77a,_0x1937fa,_0xd82a4e,'users');})[_0xfe57('0x2e')](function(){return setRelationship(_0x42f77a,_0x4eafcd,_0xd82a4e,_0xfe57('0x63'));})[_0xfe57('0x2e')](function(){return getServerInfo(_0x42f77a);})[_0xfe57('0x2e')](function(_0x19f573){var _0x3deb2a=parseInt(_0x19f573['version']['charAt'](0x0));var _0x12fca9=util['format'](_0xfe57('0x65'),_0x27a93e[_0xfe57('0x51')],_0xd82a4e['id']);if(_0x3deb2a>0x6){_0x12fca9=util[_0xfe57('0x23')](_0xfe57('0x66'),_0x27a93e['remoteUri'],_0xd82a4e['id']);}logger[_0xfe57('0x29')]('[OUTBOUND]',_0xfe57('0x67'));emit(util[_0xfe57('0x23')]('user:%s',_0x27f682[_0xfe57('0xe')]),_0xfe57('0x68'),{'uri':_0x12fca9});})['catch'](function(_0x1cad9b){logger[_0xfe57('0x72')](_0xfe57('0x6c'),JSON[_0xfe57('0x21')](_0x1cad9b));});};exports['abandoned']=function(_0x385d69,_0x5035bc,_0x41daf9,_0x3a8675,_0x25020e,_0x3f7735){var _0x5aaf6f,_0x1d62d9,_0x5e99ab,_0x2de666;_0x3f7735[_0xfe57('0x51')]=intUtil['stripTrailingSlash'](_0x3f7735[_0xfe57('0x51')]);_0x3f7735[_0xfe57('0x53')]=intUtil[_0xfe57('0x52')](_0x3f7735[_0xfe57('0x53')]);def['uri']=util[_0xfe57('0x23')]('%s/service/v4_1/rest.php',_0x3f7735['remoteUri']);if(_0x25020e&&_0x25020e[_0xfe57('0x56')]){logger['info']('[ABANDONED]',_0xfe57('0x58'));_0x5035bc[_0xfe57('0x59')]=util[_0xfe57('0x23')](_0xfe57('0x6d'),_0x3f7735[_0xfe57('0x53')],_0x5035bc[_0xfe57('0x5a')],md5(_0x5035bc['uniqueid']));}else{_0x5035bc[_0xfe57('0x59')]='';}return getConnection(_0x3f7735)[_0xfe57('0x2e')](function(_0x3d816e){_0x2de666=_0x3d816e;if(!_['isNil'](_0x3a8675)){return getUser(_0x3f7735,_0x3a8675[_0xfe57('0xe')],_0x2de666);}else{return getUser(_0x3f7735,null,_0x2de666);}})[_0xfe57('0x2e')](function(_0x3a18f8){_0x5aaf6f=_0x3a18f8;logger[_0xfe57('0x29')](_0xfe57('0x5b'),_0x5aaf6f['id']);return getEndUser(_0x3f7735,_0x5035bc[_0xfe57('0x5c')],_0x5035bc[_0xfe57('0x5d')],_0x2de666);})[_0xfe57('0x2e')](function(_0xb70512){_0x1d62d9=_0xb70512;logger[_0xfe57('0x29')](_0xfe57('0x70'),_0x1d62d9['id']);return getTicket(_0x3f7735,_0x5aaf6f,_0x1d62d9,_0x41daf9,_0x5035bc,_0x41daf9[_0xfe57('0x5e')],_0x2de666,_0xfe57('0x5f'));})[_0xfe57('0x2e')](function(_0x54a699){_0x5e99ab=_0x54a699;logger[_0xfe57('0x29')](_0xfe57('0x60'));logger[_0xfe57('0x29')](_0xfe57('0x61'),_0x5e99ab['id']);return setRelationship(_0x2de666,_0x5aaf6f,_0x5e99ab,_0xfe57('0x62'));})['then'](function(){return setRelationship(_0x2de666,_0x1d62d9,_0x5e99ab,_0xfe57('0x63'));})[_0xfe57('0x2e')](function(){return getServerInfo(_0x2de666);})[_0xfe57('0x69')](function(_0x3c84be){logger[_0xfe57('0x72')](_0xfe57('0x73'),JSON['stringify'](_0x3c84be));});}; \ 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 98351f3..ee0a368 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 _0x0604=['test','lodash','util','getString','length','sortBy','type','string','variable','variableName','push','toString','Variable','name','toLowerCase','keyValue','key','keyContent','format','keyType','customVariable','%s:\x20%s','join','stripTrailingSlash','slice','lastIndexOf','validateEmail'];(function(_0x3dabf8,_0x57205e){var _0x365b00=function(_0x940175){while(--_0x940175){_0x3dabf8['push'](_0x3dabf8['shift']());}};_0x365b00(++_0x57205e);}(_0x0604,0x17b));var _0x4060=function(_0x2413ab,_0x1163d8){_0x2413ab=_0x2413ab-0x0;var _0x150274=_0x0604[_0x2413ab];return _0x150274;};'use strict';var _=require(_0x4060('0x0'));var util=require(_0x4060('0x1'));exports[_0x4060('0x2')]=function(_0x44d593,_0xcf1f75,_0xd11b78){var _0x5685d9=[];if(_0x44d593[_0x4060('0x3')]>0x0){var _0x1d9c89=_[_0x4060('0x4')](_0x44d593,['id']);for(var _0x11ef92=0x0;_0x11ef92<_0x1d9c89['length'];_0x11ef92++){var _0xd5ece6=_0x1d9c89[_0x11ef92];if(_0xd5ece6[_0x4060('0x5')]===_0x4060('0x6')){_0x5685d9['push'](_0xd5ece6['content']);}else if(_0xd5ece6[_0x4060('0x5')]===_0x4060('0x7')&&_0xd5ece6[_0x4060('0x8')]){_0xcf1f75[_0xd5ece6[_0x4060('0x8')]]&&_0x5685d9[_0x4060('0x9')](_0xcf1f75[_0xd5ece6['variableName']][_0x4060('0xa')]());}else if(_0xd5ece6[_0x4060('0x5')]==='customVariable'&&_0xd5ece6[_0x4060('0xb')]&&_0xd5ece6[_0x4060('0xb')][_0x4060('0xc')]){_0xcf1f75[_0xd5ece6[_0x4060('0xb')][_0x4060('0xc')][_0x4060('0xd')]()]&&_0x5685d9[_0x4060('0x9')](_0xcf1f75[_0xd5ece6[_0x4060('0xb')][_0x4060('0xc')][_0x4060('0xd')]()]['toString']());}else if(_0xd5ece6[_0x4060('0x5')]===_0x4060('0xe')){if(_0xd5ece6['keyType']==='string'&&_0xd5ece6[_0x4060('0xf')]){_0x5685d9[_0x4060('0x9')](util['format']('%s:\x20%s',_0xd5ece6[_0x4060('0xf')],_0xd5ece6[_0x4060('0x10')]));}else if(_0xd5ece6['keyType']===_0x4060('0x7')&&_0xd5ece6[_0x4060('0x8')]&&_0xd5ece6[_0x4060('0xf')]){_0xcf1f75[_0xd5ece6['variableName']]&&_0x5685d9['push'](util[_0x4060('0x11')]('%s:\x20%s',_0xd5ece6[_0x4060('0xf')],_0xcf1f75[_0xd5ece6[_0x4060('0x8')]]));}else if(_0xd5ece6[_0x4060('0x12')]===_0x4060('0x13')&&_0xd5ece6[_0x4060('0xb')]&&_0xd5ece6[_0x4060('0xb')][_0x4060('0xc')]&&_0xd5ece6[_0x4060('0xf')]){_0xcf1f75[_0xd5ece6['Variable'][_0x4060('0xc')]['toLowerCase']()]&&_0x5685d9[_0x4060('0x9')](util['format'](_0x4060('0x14'),_0xd5ece6[_0x4060('0xf')],_0xcf1f75[_0xd5ece6[_0x4060('0xb')][_0x4060('0xc')][_0x4060('0xd')]()]));}}}}return _0x5685d9[_0x4060('0x15')](_0xd11b78);};exports[_0x4060('0x16')]=function(_0x36643e){var _0x5d606c=_0x36643e[_0x4060('0x17')](-0x1);if(_0x5d606c==='/'){_0x36643e=_0x36643e['substring'](0x0,_0x36643e[_0x4060('0x18')](_0x5d606c));}return _0x36643e;};exports[_0x4060('0x19')]=function(_0x41ed6e){if(!_['isNil'](_0x41ed6e)&&_0x41ed6e!==''){var _0x4f261e=/^(([^<>()\[\]\\.,;:\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 _0x4f261e[_0x4060('0x1a')](String(_0x41ed6e)[_0x4060('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x5959=['%s:\x20%s','keyType','join','test','util','length','type','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','string','key','format'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x5959,0x180));var _0x9595=function(_0x2a84d6,_0x538497){_0x2a84d6=_0x2a84d6-0x0;var _0x55c2ea=_0x5959[_0x2a84d6];return _0x55c2ea;};'use strict';var _=require('lodash');var util=require(_0x9595('0x0'));exports['getString']=function(_0x245269,_0x570014,_0x33adb4){var _0xbd192=[];if(_0x245269[_0x9595('0x1')]>0x0){var _0x1dc588=_['sortBy'](_0x245269,['id']);for(var _0x44c0ba=0x0;_0x44c0ba<_0x1dc588[_0x9595('0x1')];_0x44c0ba++){var _0x361383=_0x1dc588[_0x44c0ba];if(_0x361383[_0x9595('0x2')]==='string'){_0xbd192[_0x9595('0x3')](_0x361383[_0x9595('0x4')]);}else if(_0x361383[_0x9595('0x2')]===_0x9595('0x5')&&_0x361383['variableName']){_0x570014[_0x361383[_0x9595('0x6')]]&&_0xbd192[_0x9595('0x3')](_0x570014[_0x361383[_0x9595('0x6')]][_0x9595('0x7')]());}else if(_0x361383[_0x9595('0x2')]===_0x9595('0x8')&&_0x361383['Variable']&&_0x361383[_0x9595('0x9')][_0x9595('0xa')]){_0x570014[_0x361383[_0x9595('0x9')][_0x9595('0xa')][_0x9595('0xb')]()]&&_0xbd192['push'](_0x570014[_0x361383[_0x9595('0x9')][_0x9595('0xa')]['toLowerCase']()]['toString']());}else if(_0x361383[_0x9595('0x2')]===_0x9595('0xc')){if(_0x361383['keyType']===_0x9595('0xd')&&_0x361383[_0x9595('0xe')]){_0xbd192[_0x9595('0x3')](util[_0x9595('0xf')](_0x9595('0x10'),_0x361383[_0x9595('0xe')],_0x361383['keyContent']));}else if(_0x361383[_0x9595('0x11')]==='variable'&&_0x361383[_0x9595('0x6')]&&_0x361383[_0x9595('0xe')]){_0x570014[_0x361383[_0x9595('0x6')]]&&_0xbd192['push'](util[_0x9595('0xf')]('%s:\x20%s',_0x361383['key'],_0x570014[_0x361383[_0x9595('0x6')]]));}else if(_0x361383['keyType']==='customVariable'&&_0x361383['Variable']&&_0x361383[_0x9595('0x9')][_0x9595('0xa')]&&_0x361383[_0x9595('0xe')]){_0x570014[_0x361383[_0x9595('0x9')][_0x9595('0xa')]['toLowerCase']()]&&_0xbd192[_0x9595('0x3')](util[_0x9595('0xf')](_0x9595('0x10'),_0x361383['key'],_0x570014[_0x361383[_0x9595('0x9')]['name'][_0x9595('0xb')]()]));}}}}return _0xbd192[_0x9595('0x12')](_0x33adb4);};exports['stripTrailingSlash']=function(_0x9ff5b3){var _0x38cc77=_0x9ff5b3['slice'](-0x1);if(_0x38cc77==='/'){_0x9ff5b3=_0x9ff5b3['substring'](0x0,_0x9ff5b3['lastIndexOf'](_0x38cc77));}return _0x9ff5b3;};exports['validateEmail']=function(_0x479e7c){if(!_['isNil'](_0x479e7c)&&_0x479e7c!==''){var _0x931df9=/^(([^<>()\[\]\\.,;:\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 _0x931df9[_0x9595('0x13')](String(_0x479e7c)[_0x9595('0xb')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index ebe4903..a260a1d 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 _0x9957=['query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','Agent\x20found!','email1','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','catch','GET','%s/webservice.php','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','lastname','getEndUser','accessKey','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','The\x20Enduser\x20ID\x20is:','user:%s','abandoned','[ABANDONED]','Ticket\x20created!','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','length','forEach','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','Creating\x20new\x20ticket...','Normal','Subjects','getString','Descriptions','POST','format','remoteUri','create','username','sessionName','HelpDesk','stringify','then','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','info','Getting\x20agent\x20with\x20email'];(function(_0xa28740,_0x56facc){var _0x561194=function(_0xbb1a34){while(--_0xbb1a34){_0xa28740['push'](_0xa28740['shift']());}};_0x561194(++_0x56facc);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var BPromise=require(_0x7995('0x2'));var md5=require(_0x7995('0x3'));var util=require('util');var Redis=require(_0x7995('0x4'));var intUtil=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('vTiger');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));function emit(_0x4996ca,_0x465276,_0x1cad37){io['to'](_0x4996ca)['emit'](_0x465276,_0x1cad37);}function getCustomFields(_0xa2e5f0,_0x3116fb){var _0x18c8a3={};if(_0xa2e5f0[_0x7995('0xc')]>0x0){_[_0x7995('0xd')](_0xa2e5f0,function(_0x1e400a){if(_0x1e400a[_0x7995('0xe')]==='string'&&_0x1e400a[_0x7995('0xf')]){_0x18c8a3[_0x1e400a[_0x7995('0xf')]]=_0x1e400a['content'][_0x7995('0x10')]();}else if(_0x1e400a[_0x7995('0xe')]===_0x7995('0x11')&&_0x1e400a[_0x7995('0x12')]&&_0x1e400a[_0x7995('0xf')]&&_0x3116fb[_0x1e400a[_0x7995('0x12')]]){_0x18c8a3[_0x1e400a[_0x7995('0xf')]]=_0x3116fb[_0x1e400a['variableName']]['toString']();}else if(_0x1e400a[_0x7995('0xe')]===_0x7995('0x13')&&_0x1e400a[_0x7995('0x14')]&&_0x1e400a[_0x7995('0x14')][_0x7995('0x15')]&&_0x1e400a[_0x7995('0xf')]&&_0x3116fb[_0x1e400a[_0x7995('0x14')][_0x7995('0x15')]['toLowerCase']()]){_0x18c8a3[_0x1e400a[_0x7995('0xf')]]=_0x3116fb[_0x1e400a['Variable'][_0x7995('0x15')][_0x7995('0x16')]()][_0x7995('0x10')]();}});}return _0x18c8a3;}function createTicket(_0x291317,_0x1e1415,_0x37a7d4,_0x4faa60,_0x54c9ae,_0x2536c8,_0x5e6f90){logger['info'](_0x7995('0x17'));var _0x3d463e=_['merge']({'parent_id':'','assigned_user_id':_0x1e1415['id'],'ticketpriorities':_0x7995('0x18'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4faa60[_0x7995('0x19')],_0x54c9ae,'\x20'),'description':intUtil[_0x7995('0x1a')](_0x4faa60[_0x7995('0x1b')],_0x54c9ae,'\x0a'),'contact_id':_0x37a7d4['id']},getCustomFields(_0x2536c8,_0x54c9ae));var _0x1a8568={'method':_0x7995('0x1c'),'uri':util[_0x7995('0x1d')]('%s/webservice.php',_0x291317[_0x7995('0x1e')]),'form':{'operation':_0x7995('0x1f'),'username':_0x291317[_0x7995('0x20')],'sessionName':_0x5e6f90[_0x7995('0x21')],'elementType':_0x7995('0x22'),'element':JSON[_0x7995('0x23')](_0x3d463e)},'json':!![]};return request(_0x1a8568)[_0x7995('0x24')](function(_0x472195){if(_0x472195['success']){return BPromise[_0x7995('0x25')]({'id':_0x472195[_0x7995('0x26')]['id']});}else{throw new Error(util[_0x7995('0x1d')](_0x7995('0x27'),JSON[_0x7995('0x23')](_0x472195[_0x7995('0x28')])));}})['catch'](function(_0x47625f){var _0x5911c3=_0x47625f[_0x7995('0x29')]||0x1f4;logger[_0x7995('0x28')](_0x7995('0x2a'),_0x7995('0x2b'),_0x5911c3,JSON[_0x7995('0x23')](_0x47625f));});}function getUser(_0x4b6f99,_0x9b2a15,_0x514445){if(intUtil[_0x7995('0x2c')](_0x9b2a15)){logger[_0x7995('0x2d')](_0x7995('0x2e'),_0x9b2a15);return request({'method':'GET','uri':util['format']('%s/webservice.php',_0x4b6f99[_0x7995('0x1e')]),'qs':{'operation':_0x7995('0x2f'),'username':_0x4b6f99[_0x7995('0x20')],'sessionName':_0x514445[_0x7995('0x21')],'query':util[_0x7995('0x1d')](_0x7995('0x30'),_0x9b2a15)},'json':!![]})['then'](function(_0x481c74){if(_0x481c74[_0x7995('0x31')]&&_0x481c74['result'][_0x7995('0xc')]){logger[_0x7995('0x2d')](_0x7995('0x32'));return BPromise[_0x7995('0x25')]({'id':_0x481c74[_0x7995('0x26')][0x0]['id'],'email':_0x481c74['result'][0x0][_0x7995('0x33')],'name':_0x481c74[_0x7995('0x26')][0x0]['first_name']+'\x20'+_0x481c74['result']['last_name']});}else{logger[_0x7995('0x2d')](_0x7995('0x34'));return BPromise['resolve']({'id':_0x514445[_0x7995('0x35')],'email':_0x4b6f99['username'],'name':_0x7995('0x36')});}})[_0x7995('0x37')](function(_0x177cb4){var _0x5014d2=_0x177cb4['statusCode']||0x1f4;logger[_0x7995('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x5014d2,JSON[_0x7995('0x23')](_0x177cb4));});}else{logger[_0x7995('0x2d')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x7995('0x25')]({'id':_0x514445[_0x7995('0x35')],'email':_0x4b6f99[_0x7995('0x20')],'name':_0x7995('0x36')})[_0x7995('0x37')](function(_0x53002a){var _0x2d4285=_0x53002a[_0x7995('0x29')]||0x1f4;logger[_0x7995('0x28')](_0x7995('0x2a'),'getUser',_0x2d4285,JSON[_0x7995('0x23')](_0x53002a));});}}function getEndUser(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee){logger[_0x7995('0x2d')]('Searching\x20end\x20user\x20with\x20phone',_0xe5ea43);return request({'method':_0x7995('0x38'),'uri':util[_0x7995('0x1d')](_0x7995('0x39'),_0x235df7[_0x7995('0x1e')]),'qs':{'operation':_0x7995('0x2f'),'username':_0x235df7[_0x7995('0x20')],'sessionName':_0x1f5bee[_0x7995('0x21')],'query':util[_0x7995('0x1d')](_0x7995('0x3a'),_0xe5ea43,_0xe5ea43,_0xe5ea43,_0xe5ea43,_0xe5ea43)},'json':!![]})[_0x7995('0x24')](function(_0x6fe77b){if(_0x6fe77b[_0x7995('0x31')]&&_0x6fe77b[_0x7995('0x26')]['length']){logger['info'](_0x7995('0x3b'));return BPromise[_0x7995('0x25')]({'id':_0x6fe77b['result'][0x0]['id'],'name':_0x6fe77b['result'][0x0][_0x7995('0x3c')]+'\x20'+_0x6fe77b['result'][0x0]['lastname'],'phone':_0xe5ea43});}else{logger[_0x7995('0x2d')](_0x7995('0x3d'));return request({'method':_0x7995('0x1c'),'uri':util['format'](_0x7995('0x39'),_0x235df7['remoteUri']),'form':{'operation':_0x7995('0x1f'),'sessionName':_0x1f5bee['sessionName'],'elementType':'Contacts','element':JSON[_0x7995('0x23')]({'lastname':_0x3eb04f,'phone':_0xe5ea43,'assigned_user_id':'\x20'})},'json':!![]})[_0x7995('0x24')](function(_0xc04e5){logger[_0x7995('0x2d')]('Enduser\x20created.');return BPromise[_0x7995('0x25')]({'id':_0xc04e5[_0x7995('0x26')]['id'],'name':_0xc04e5[_0x7995('0x26')][_0x7995('0x3e')],'phone':_0xc04e5['result']['phone']});})[_0x7995('0x37')](function(_0x55791b){var _0x23c41d=_0x55791b['statusCode']||0x1f4;logger[_0x7995('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x7995('0x3f'),_0x23c41d,JSON[_0x7995('0x23')](_0x55791b));});}});}function getConnection(_0x4d9245){var _0x3e9e62=_0x4d9245[_0x7995('0x20')];var _0x314145=_0x4d9245[_0x7995('0x40')];return request({'method':'GET','uri':util[_0x7995('0x1d')](_0x7995('0x39'),_0x4d9245[_0x7995('0x1e')]),'qs':{'operation':'getchallenge','username':_0x3e9e62},'json':!![]})[_0x7995('0x24')](function(_0x44f516){if(_0x44f516[_0x7995('0x31')]){return request({'method':_0x7995('0x1c'),'uri':util[_0x7995('0x1d')]('%s/webservice.php',_0x4d9245[_0x7995('0x1e')]),'form':{'operation':_0x7995('0x41'),'username':_0x3e9e62,'accessKey':md5(_0x44f516['result'][_0x7995('0x42')]+_0x314145)},'json':!![]});}})['then'](function(_0x1d87f9){if(_0x1d87f9[_0x7995('0x31')]){return BPromise[_0x7995('0x25')](_0x1d87f9[_0x7995('0x26')]);}else{throw new Error(util[_0x7995('0x1d')](_0x7995('0x43'),_0x4d9245['id']));}})[_0x7995('0x37')](function(_0x4d46bc){var _0x427dcf=_0x4d46bc[_0x7995('0x29')]||0x1f4;logger[_0x7995('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x7995('0x44'),_0x427dcf,JSON[_0x7995('0x23')](_0x4d46bc));});}function request(_0x12d4b8){logger['info']('[HTTP]',JSON['stringify'](_0x12d4b8));return rp(_0x12d4b8);}exports[_0x7995('0x45')]=function(_0x1fd1ca,_0x4cf5db,_0x1cd85,_0x29f300,_0x31f27c,_0x1a9bd7){var _0xc04004,_0x528c8e,_0x29ee32,_0x4ab09f;_0x1a9bd7[_0x7995('0x1e')]=intUtil[_0x7995('0x46')](_0x1a9bd7[_0x7995('0x1e')]);if(_0x31f27c&&_0x31f27c['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x4cf5db[_0x7995('0x47')]=util[_0x7995('0x1d')](_0x7995('0x48'),_0x1a9bd7[_0x7995('0x49')],_0x4cf5db[_0x7995('0x4a')],md5(_0x4cf5db[_0x7995('0x4a')]));}else{_0x4cf5db[_0x7995('0x47')]='';}return getConnection(_0x1a9bd7)[_0x7995('0x24')](function(_0x328671){_0x4ab09f=_0x328671;return getUser(_0x1a9bd7,_0x29f300[_0x7995('0x4b')],_0x4ab09f);})[_0x7995('0x24')](function(_0x133c63){_0xc04004=_0x133c63;logger[_0x7995('0x2d')](_0x7995('0x4c'),_0xc04004['id']);return getEndUser(_0x1a9bd7,_0x4cf5db[_0x7995('0x4d')],_0x4cf5db[_0x7995('0x4e')],_0x4ab09f);})[_0x7995('0x24')](function(_0x223e08){_0x528c8e=_0x223e08;logger[_0x7995('0x2d')]('The\x20Enduser\x20ID\x20is:',_0x528c8e['id']);return createTicket(_0x1a9bd7,_0xc04004,_0x528c8e,_0x1cd85,_0x4cf5db,_0x1cd85[_0x7995('0x4f')],_0x4ab09f);})[_0x7995('0x24')](function(_0x3b8a54){_0x29ee32=_0x3b8a54;logger[_0x7995('0x2d')]('Ticket\x20created!');logger['info'](_0x7995('0x50'),_0x29ee32['id']);var _0x197b52=util[_0x7995('0x1d')](_0x7995('0x51'),_0x1a9bd7['remoteUri'],_[_0x7995('0x52')](_0x29ee32['id'],'x')[0x1]);logger[_0x7995('0x2d')](_0x7995('0x53'),_0x7995('0x54'));emit(util['format']('user:%s',_0x29f300[_0x7995('0x15')]),_0x7995('0x55'),{'uri':_0x197b52});})[_0x7995('0x37')](function(_0x1d69ce){logger[_0x7995('0x28')](_0x7995('0x53'),JSON[_0x7995('0x23')](_0x1d69ce));});};exports[_0x7995('0x56')]=function(_0x984c23,_0x50caf5,_0x18f230,_0x3ec5a8,_0xdf9e38,_0x1ecfdb,_0x59c5aa){var _0x51bf6a,_0x3053fd,_0xebb5c8,_0x47d5d7;_0x1ecfdb[_0x7995('0x1e')]=intUtil[_0x7995('0x46')](_0x1ecfdb[_0x7995('0x1e')]);_0x1ecfdb[_0x7995('0x49')]=intUtil[_0x7995('0x46')](_0x1ecfdb['serverUrl']);if(_0x59c5aa&&_0x59c5aa[_0x7995('0x57')]&&_0x59c5aa['recordingFormat']!==_0x7995('0x58')){logger[_0x7995('0x2d')](_0x7995('0x59'),_0x7995('0x5a'));_0x50caf5[_0x7995('0x47')]=util[_0x7995('0x1d')](_0x7995('0x48'),_0x1ecfdb[_0x7995('0x49')],_0x50caf5[_0x7995('0x4a')],md5(_0x50caf5[_0x7995('0x4a')]));}return getConnection(_0x1ecfdb)[_0x7995('0x24')](function(_0x234d8d){_0x47d5d7=_0x234d8d;return getUser(_0x1ecfdb,_0x3ec5a8['email'],_0x47d5d7);})[_0x7995('0x24')](function(_0x23bbc1){_0x51bf6a=_0x23bbc1;logger[_0x7995('0x2d')](_0x7995('0x4c'),_0x51bf6a['id']);return getEndUser(_0x1ecfdb,_0x50caf5[_0x7995('0x5b')],_0x50caf5['destcalleridnum'],_0x47d5d7);})['then'](function(_0x268fde){_0x3053fd=_0x268fde;logger[_0x7995('0x2d')](_0x7995('0x5c'),_0x3053fd['id']);return createTicket(_0x1ecfdb,_0x51bf6a,_0x3053fd,_0x18f230,_0x50caf5,_0x18f230[_0x7995('0x4f')],_0x47d5d7);})['then'](function(_0x22d317){_0xebb5c8=_0x22d317;logger['info']('Ticket\x20created!');logger[_0x7995('0x2d')](_0x7995('0x50'),_0xebb5c8['id']);var _0x3f0a71=util[_0x7995('0x1d')](_0x7995('0x51'),_0x1ecfdb[_0x7995('0x1e')],_[_0x7995('0x52')](_0xebb5c8['id'],'x')[0x1]);logger[_0x7995('0x2d')](_0x7995('0x59'),_0x7995('0x54'));emit(util['format'](_0x7995('0x5d'),_0x3ec5a8[_0x7995('0x15')]),_0x7995('0x55'),{'uri':_0x3f0a71});})['catch'](function(_0x1fe1cb){logger[_0x7995('0x28')](_0x7995('0x59'),JSON[_0x7995('0x23')](_0x1fe1cb));});};exports[_0x7995('0x5e')]=function(_0x51ab1e,_0x550a10,_0x3adfd2,_0x2f94c4,_0x1fdff6,_0x435a1b){var _0x535131,_0x5e8b4c,_0xd07c1c,_0xfe1105;_0x435a1b[_0x7995('0x1e')]=intUtil[_0x7995('0x46')](_0x435a1b['remoteUri']);_0x435a1b[_0x7995('0x49')]=intUtil[_0x7995('0x46')](_0x435a1b['serverUrl']);if(_0x1fdff6&&_0x1fdff6['monitor_format']){logger[_0x7995('0x2d')](_0x7995('0x5f'),'Recording\x20is\x20enabled!');_0x550a10[_0x7995('0x47')]=util['format'](_0x7995('0x48'),_0x435a1b[_0x7995('0x49')],_0x550a10['uniqueid'],md5(_0x550a10['uniqueid']));}else{_0x550a10[_0x7995('0x47')]='';}return getConnection(_0x435a1b)['then'](function(_0x31b9e6){_0xfe1105=_0x31b9e6;return getUser(_0x435a1b,'',_0xfe1105);})[_0x7995('0x24')](function(_0x3dd197){_0x535131=_0x3dd197;logger[_0x7995('0x2d')](_0x7995('0x4c'),_0x535131['id']);return getEndUser(_0x435a1b,_0x550a10[_0x7995('0x4d')],_0x550a10[_0x7995('0x4e')],_0xfe1105);})[_0x7995('0x24')](function(_0x29e0ee){_0x5e8b4c=_0x29e0ee;logger[_0x7995('0x2d')](_0x7995('0x5c'),_0x5e8b4c['id']);return createTicket(_0x435a1b,_0x535131,_0x5e8b4c,_0x3adfd2,_0x550a10,_0x3adfd2[_0x7995('0x4f')],_0xfe1105);})[_0x7995('0x24')](function(_0x1ff436){_0xd07c1c=_0x1ff436;logger[_0x7995('0x2d')](_0x7995('0x60'));logger[_0x7995('0x2d')](_0x7995('0x50'),_0xd07c1c['id']);})[_0x7995('0x37')](function(_0xa2fc8e){logger[_0x7995('0x28')](_0x7995('0x5f'),JSON[_0x7995('0x23')](_0xa2fc8e));});}; \ No newline at end of file +var _0x55ca=['email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','abandoned','[ABANDONED]','lodash','request-promise','ioredis','./util','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','content','toString','customVariable','Variable','name','toLowerCase','info','merge','Normal','Open','Subjects','getString','POST','format','%s/webservice.php','remoteUri','username','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','last_name','userId','admin','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','lastname','phone','getEndUser','accessKey','getConnection','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','[QUEUE]','outbound','serverUrl','recordingFormat','none','[OUTBOUND]'];(function(_0x4a348b,_0x5da2bc){var _0x2f952c=function(_0x57c791){while(--_0x57c791){_0x4a348b['push'](_0x4a348b['shift']());}};_0x2f952c(++_0x5da2bc);}(_0x55ca,0x126));var _0xa55c=function(_0x455afa,_0x235bfc){_0x455afa=_0x455afa-0x0;var _0x46ee43=_0x55ca[_0x455afa];return _0x46ee43;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0xa55c('0x2'));var intUtil=require(_0xa55c('0x3'));var config=require('../../../../config/environment');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));config[_0xa55c('0x6')]=_[_0xa55c('0x7')](config[_0xa55c('0x6')],{'host':_0xa55c('0x8'),'port':0x18eb});var io=require(_0xa55c('0x9'))(new Redis(config['redis']));function emit(_0x2121fd,_0x2537f0,_0x57e069){io['to'](_0x2121fd)[_0xa55c('0xa')](_0x2537f0,_0x57e069);}function getCustomFields(_0x290d28,_0x52a3bc){var _0x5849ad={};if(_0x290d28[_0xa55c('0xb')]>0x0){_[_0xa55c('0xc')](_0x290d28,function(_0x381d07){if(_0x381d07[_0xa55c('0xd')]===_0xa55c('0xe')&&_0x381d07[_0xa55c('0xf')]){_0x5849ad[_0x381d07[_0xa55c('0xf')]]=_0x381d07[_0xa55c('0x10')][_0xa55c('0x11')]();}else if(_0x381d07[_0xa55c('0xd')]==='variable'&&_0x381d07['variableName']&&_0x381d07[_0xa55c('0xf')]&&_0x52a3bc[_0x381d07['variableName']]){_0x5849ad[_0x381d07['idField']]=_0x52a3bc[_0x381d07['variableName']][_0xa55c('0x11')]();}else if(_0x381d07[_0xa55c('0xd')]===_0xa55c('0x12')&&_0x381d07[_0xa55c('0x13')]&&_0x381d07[_0xa55c('0x13')][_0xa55c('0x14')]&&_0x381d07['idField']&&_0x52a3bc[_0x381d07[_0xa55c('0x13')][_0xa55c('0x14')][_0xa55c('0x15')]()]){_0x5849ad[_0x381d07[_0xa55c('0xf')]]=_0x52a3bc[_0x381d07[_0xa55c('0x13')][_0xa55c('0x14')][_0xa55c('0x15')]()][_0xa55c('0x11')]();}});}return _0x5849ad;}function createTicket(_0x24783b,_0x4cee3c,_0x3d4c9e,_0x104a99,_0x461284,_0x358b61,_0x23a1ae){logger[_0xa55c('0x16')]('Creating\x20new\x20ticket...');var _0x5f5158=_[_0xa55c('0x17')]({'parent_id':'','assigned_user_id':_0x4cee3c['id'],'ticketpriorities':_0xa55c('0x18'),'ticketstatus':_0xa55c('0x19'),'ticket_title':intUtil['getString'](_0x104a99[_0xa55c('0x1a')],_0x461284,'\x20'),'description':intUtil[_0xa55c('0x1b')](_0x104a99['Descriptions'],_0x461284,'\x0a'),'contact_id':_0x3d4c9e['id']},getCustomFields(_0x358b61,_0x461284));var _0x187a87={'method':_0xa55c('0x1c'),'uri':util[_0xa55c('0x1d')](_0xa55c('0x1e'),_0x24783b[_0xa55c('0x1f')]),'form':{'operation':'create','username':_0x24783b[_0xa55c('0x20')],'sessionName':_0x23a1ae['sessionName'],'elementType':'HelpDesk','element':JSON['stringify'](_0x5f5158)},'json':!![]};return request(_0x187a87)[_0xa55c('0x21')](function(_0x54b038){if(_0x54b038[_0xa55c('0x22')]){return BPromise[_0xa55c('0x23')]({'id':_0x54b038[_0xa55c('0x24')]['id']});}else{throw new Error(util[_0xa55c('0x1d')](_0xa55c('0x25'),JSON[_0xa55c('0x26')](_0x54b038[_0xa55c('0x27')])));}})[_0xa55c('0x28')](function(_0x192df2){var _0x3cd152=_0x192df2[_0xa55c('0x29')]||0x1f4;logger['error'](_0xa55c('0x2a'),_0xa55c('0x2b'),_0x3cd152,JSON[_0xa55c('0x26')](_0x192df2));});}function getUser(_0x906caa,_0x5d940d,_0x1377b0){if(intUtil[_0xa55c('0x2c')](_0x5d940d)){logger[_0xa55c('0x16')](_0xa55c('0x2d'),_0x5d940d);return request({'method':_0xa55c('0x2e'),'uri':util[_0xa55c('0x1d')]('%s/webservice.php',_0x906caa[_0xa55c('0x1f')]),'qs':{'operation':'query','username':_0x906caa[_0xa55c('0x20')],'sessionName':_0x1377b0[_0xa55c('0x2f')],'query':util[_0xa55c('0x1d')](_0xa55c('0x30'),_0x5d940d)},'json':!![]})['then'](function(_0x3d28fb){if(_0x3d28fb[_0xa55c('0x22')]&&_0x3d28fb[_0xa55c('0x24')][_0xa55c('0xb')]){logger[_0xa55c('0x16')](_0xa55c('0x31'));return BPromise[_0xa55c('0x23')]({'id':_0x3d28fb[_0xa55c('0x24')][0x0]['id'],'email':_0x3d28fb[_0xa55c('0x24')][0x0][_0xa55c('0x32')],'name':_0x3d28fb[_0xa55c('0x24')][0x0]['first_name']+'\x20'+_0x3d28fb['result'][_0xa55c('0x33')]});}else{logger[_0xa55c('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xa55c('0x23')]({'id':_0x1377b0[_0xa55c('0x34')],'email':_0x906caa[_0xa55c('0x20')],'name':_0xa55c('0x35')});}})[_0xa55c('0x28')](function(_0x38ff96){var _0x3ce1b3=_0x38ff96[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x3ce1b3,JSON['stringify'](_0x38ff96));});}else{logger[_0xa55c('0x16')](_0xa55c('0x36'));return BPromise[_0xa55c('0x23')]({'id':_0x1377b0['userId'],'email':_0x906caa[_0xa55c('0x20')],'name':'admin'})[_0xa55c('0x28')](function(_0x4ad813){var _0x18c6f1=_0x4ad813[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa55c('0x37'),_0x18c6f1,JSON[_0xa55c('0x26')](_0x4ad813));});}}function getEndUser(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083){logger['info'](_0xa55c('0x38'),_0x194e78);return request({'method':'GET','uri':util[_0xa55c('0x1d')](_0xa55c('0x1e'),_0x47e93c['remoteUri']),'qs':{'operation':'query','username':_0x47e93c['username'],'sessionName':_0x4d9083['sessionName'],'query':util[_0xa55c('0x1d')](_0xa55c('0x39'),_0x194e78,_0x194e78,_0x194e78,_0x194e78,_0x194e78)},'json':!![]})[_0xa55c('0x21')](function(_0x99c4f8){if(_0x99c4f8[_0xa55c('0x22')]&&_0x99c4f8['result'][_0xa55c('0xb')]){logger[_0xa55c('0x16')](_0xa55c('0x3a'));return BPromise[_0xa55c('0x23')]({'id':_0x99c4f8[_0xa55c('0x24')][0x0]['id'],'name':_0x99c4f8[_0xa55c('0x24')][0x0]['firstname']+'\x20'+_0x99c4f8[_0xa55c('0x24')][0x0]['lastname'],'phone':_0x194e78});}else{logger['info'](_0xa55c('0x3b'));return request({'method':_0xa55c('0x1c'),'uri':util['format'](_0xa55c('0x1e'),_0x47e93c['remoteUri']),'form':{'operation':'create','sessionName':_0x4d9083[_0xa55c('0x2f')],'elementType':_0xa55c('0x3c'),'element':JSON[_0xa55c('0x26')]({'lastname':_0x6f9c4c,'phone':_0x194e78,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x1b2708){logger[_0xa55c('0x16')]('Enduser\x20created.');return BPromise[_0xa55c('0x23')]({'id':_0x1b2708['result']['id'],'name':_0x1b2708[_0xa55c('0x24')][_0xa55c('0x3d')],'phone':_0x1b2708['result'][_0xa55c('0x3e')]});})[_0xa55c('0x28')](function(_0x5d834d){var _0x40c352=_0x5d834d[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa55c('0x3f'),_0x40c352,JSON['stringify'](_0x5d834d));});}});}function getConnection(_0x2f9717){var _0x3a8af4=_0x2f9717[_0xa55c('0x20')];var _0x51d663=_0x2f9717[_0xa55c('0x40')];return request({'method':_0xa55c('0x2e'),'uri':util['format'](_0xa55c('0x1e'),_0x2f9717[_0xa55c('0x1f')]),'qs':{'operation':'getchallenge','username':_0x3a8af4},'json':!![]})[_0xa55c('0x21')](function(_0xd3fe78){if(_0xd3fe78['success']){return request({'method':_0xa55c('0x1c'),'uri':util[_0xa55c('0x1d')](_0xa55c('0x1e'),_0x2f9717[_0xa55c('0x1f')]),'form':{'operation':'login','username':_0x3a8af4,'accessKey':md5(_0xd3fe78[_0xa55c('0x24')]['token']+_0x51d663)},'json':!![]});}})[_0xa55c('0x21')](function(_0x213100){if(_0x213100[_0xa55c('0x22')]){return BPromise['resolve'](_0x213100[_0xa55c('0x24')]);}else{throw new Error(util[_0xa55c('0x1d')]('Account\x20%d\x20is\x20not\x20valid',_0x2f9717['id']));}})[_0xa55c('0x28')](function(_0x34de95){var _0x3822b7=_0x34de95[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')](_0xa55c('0x2a'),_0xa55c('0x41'),_0x3822b7,JSON[_0xa55c('0x26')](_0x34de95));});}function request(_0x3c147b){logger[_0xa55c('0x16')]('[HTTP]',JSON[_0xa55c('0x26')](_0x3c147b));return rp(_0x3c147b);}exports[_0xa55c('0x42')]=function(_0x216de8,_0x4f73b6,_0x4c3095,_0x35bf0a,_0x4f5ecd,_0x21b760){var _0x4fa412,_0x2b6a0e,_0x228df4,_0x181802;_0x21b760[_0xa55c('0x1f')]=intUtil[_0xa55c('0x43')](_0x21b760['remoteUri']);if(_0x4f5ecd&&_0x4f5ecd[_0xa55c('0x44')]){logger[_0xa55c('0x16')]('[QUEUE]',_0xa55c('0x45'));_0x4f73b6[_0xa55c('0x46')]=util[_0xa55c('0x1d')](_0xa55c('0x47'),_0x21b760['serverUrl'],_0x4f73b6['uniqueid'],md5(_0x4f73b6[_0xa55c('0x48')]));}else{_0x4f73b6[_0xa55c('0x46')]='';}return getConnection(_0x21b760)[_0xa55c('0x21')](function(_0x44ac57){_0x181802=_0x44ac57;return getUser(_0x21b760,_0x35bf0a['email'],_0x181802);})[_0xa55c('0x21')](function(_0x5ce463){_0x4fa412=_0x5ce463;logger[_0xa55c('0x16')](_0xa55c('0x49'),_0x4fa412['id']);return getEndUser(_0x21b760,_0x4f73b6[_0xa55c('0x4a')],_0x4f73b6[_0xa55c('0x4b')],_0x181802);})[_0xa55c('0x21')](function(_0x53b2f7){_0x2b6a0e=_0x53b2f7;logger[_0xa55c('0x16')]('The\x20Enduser\x20ID\x20is:',_0x2b6a0e['id']);return createTicket(_0x21b760,_0x4fa412,_0x2b6a0e,_0x4c3095,_0x4f73b6,_0x4c3095[_0xa55c('0x4c')],_0x181802);})[_0xa55c('0x21')](function(_0x2cfe08){_0x228df4=_0x2cfe08;logger[_0xa55c('0x16')](_0xa55c('0x4d'));logger[_0xa55c('0x16')](_0xa55c('0x4e'),_0x228df4['id']);var _0x53e2be=util[_0xa55c('0x1d')](_0xa55c('0x4f'),_0x21b760[_0xa55c('0x1f')],_[_0xa55c('0x50')](_0x228df4['id'],'x')[0x1]);logger[_0xa55c('0x16')]('[QUEUE]',_0xa55c('0x51'));emit(util[_0xa55c('0x1d')](_0xa55c('0x52'),_0x35bf0a[_0xa55c('0x14')]),_0xa55c('0x53'),{'uri':_0x53e2be});})['catch'](function(_0xdd92c1){logger[_0xa55c('0x27')](_0xa55c('0x54'),JSON[_0xa55c('0x26')](_0xdd92c1));});};exports[_0xa55c('0x55')]=function(_0x480dfc,_0x419fc3,_0x4d94fc,_0x2e482a,_0x5e3a28,_0x3495a7,_0x5a8897){var _0x34edc5,_0x1333da,_0x21d6b4,_0x2f811e;_0x3495a7[_0xa55c('0x1f')]=intUtil[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x1f')]);_0x3495a7[_0xa55c('0x56')]=intUtil[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x56')]);if(_0x5a8897&&_0x5a8897['recordingFormat']&&_0x5a8897[_0xa55c('0x57')]!==_0xa55c('0x58')){logger['info'](_0xa55c('0x59'),_0xa55c('0x45'));_0x419fc3[_0xa55c('0x46')]=util[_0xa55c('0x1d')](_0xa55c('0x47'),_0x3495a7[_0xa55c('0x56')],_0x419fc3[_0xa55c('0x48')],md5(_0x419fc3[_0xa55c('0x48')]));}return getConnection(_0x3495a7)['then'](function(_0x1dfaf7){_0x2f811e=_0x1dfaf7;return getUser(_0x3495a7,_0x2e482a[_0xa55c('0x5a')],_0x2f811e);})[_0xa55c('0x21')](function(_0xd309a9){_0x34edc5=_0xd309a9;logger[_0xa55c('0x16')](_0xa55c('0x49'),_0x34edc5['id']);return getEndUser(_0x3495a7,_0x419fc3[_0xa55c('0x5b')],_0x419fc3[_0xa55c('0x5c')],_0x2f811e);})[_0xa55c('0x21')](function(_0x4a08ca){_0x1333da=_0x4a08ca;logger[_0xa55c('0x16')](_0xa55c('0x5d'),_0x1333da['id']);return createTicket(_0x3495a7,_0x34edc5,_0x1333da,_0x4d94fc,_0x419fc3,_0x4d94fc[_0xa55c('0x4c')],_0x2f811e);})[_0xa55c('0x21')](function(_0x3a269d){_0x21d6b4=_0x3a269d;logger[_0xa55c('0x16')](_0xa55c('0x4d'));logger[_0xa55c('0x16')](_0xa55c('0x4e'),_0x21d6b4['id']);var _0x3178a6=util[_0xa55c('0x1d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3495a7[_0xa55c('0x1f')],_['split'](_0x21d6b4['id'],'x')[0x1]);logger[_0xa55c('0x16')](_0xa55c('0x59'),_0xa55c('0x51'));emit(util['format']('user:%s',_0x2e482a[_0xa55c('0x14')]),_0xa55c('0x53'),{'uri':_0x3178a6});})[_0xa55c('0x28')](function(_0x42529f){logger['error'](_0xa55c('0x59'),JSON[_0xa55c('0x26')](_0x42529f));});};exports[_0xa55c('0x5e')]=function(_0x3a9910,_0x21fc9b,_0x500968,_0x4b090c,_0x3f7fca,_0x38689e){var _0x3f9d0a,_0x36ee32,_0x1af9d5,_0x4b2032;_0x38689e[_0xa55c('0x1f')]=intUtil[_0xa55c('0x43')](_0x38689e['remoteUri']);_0x38689e[_0xa55c('0x56')]=intUtil[_0xa55c('0x43')](_0x38689e[_0xa55c('0x56')]);if(_0x3f7fca&&_0x3f7fca['monitor_format']){logger[_0xa55c('0x16')](_0xa55c('0x5f'),_0xa55c('0x45'));_0x21fc9b[_0xa55c('0x46')]=util[_0xa55c('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38689e[_0xa55c('0x56')],_0x21fc9b[_0xa55c('0x48')],md5(_0x21fc9b['uniqueid']));}else{_0x21fc9b['recordingURL']='';}return getConnection(_0x38689e)[_0xa55c('0x21')](function(_0x4e1cbd){_0x4b2032=_0x4e1cbd;return getUser(_0x38689e,'',_0x4b2032);})[_0xa55c('0x21')](function(_0x5ca0bc){_0x3f9d0a=_0x5ca0bc;logger[_0xa55c('0x16')](_0xa55c('0x49'),_0x3f9d0a['id']);return getEndUser(_0x38689e,_0x21fc9b[_0xa55c('0x4a')],_0x21fc9b[_0xa55c('0x4b')],_0x4b2032);})[_0xa55c('0x21')](function(_0xff7b1c){_0x36ee32=_0xff7b1c;logger[_0xa55c('0x16')]('The\x20Enduser\x20ID\x20is:',_0x36ee32['id']);return createTicket(_0x38689e,_0x3f9d0a,_0x36ee32,_0x500968,_0x21fc9b,_0x500968[_0xa55c('0x4c')],_0x4b2032);})[_0xa55c('0x21')](function(_0x21de68){_0x1af9d5=_0x21de68;logger[_0xa55c('0x16')]('Ticket\x20created!');logger[_0xa55c('0x16')](_0xa55c('0x4e'),_0x1af9d5['id']);})[_0xa55c('0x28')](function(_0x2298ac){logger['error']('[ABANDONED]',JSON[_0xa55c('0x26')](_0x2298ac));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 4e99569..9752c4b 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 _0x99c9=['./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','username','token','%s/token:%s','toString','base64','stringify','GET','forEach','type','string','nameField','toLowerCase','content','idField','customField','custom_fields','variableName','push','Variable','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:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','abandoned','[ABANDONED]','The\x20Enduser\x20ID\x20is:','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis'];(function(_0x4702c4,_0x57e821){var _0x558d8f=function(_0x43c29a){while(--_0x43c29a){_0x4702c4['push'](_0x4702c4['shift']());}};_0x558d8f(++_0x57e821);}(_0x99c9,0x13c));var _0x999c=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x99c9[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x999c('0x0'));var rp=require(_0x999c('0x1'));var md5=require(_0x999c('0x2'));var util=require(_0x999c('0x3'));var Redis=require(_0x999c('0x4'));var intUtil=require(_0x999c('0x5'));var config=require(_0x999c('0x6'));var logger=require('../../../../config/logger')(_0x999c('0x7'));config[_0x999c('0x8')]=_[_0x999c('0x9')](config[_0x999c('0x8')],{'host':_0x999c('0xa'),'port':0x18eb});var io=require(_0x999c('0xb'))(new Redis(config[_0x999c('0x8')]));function emit(_0x651b7e,_0xc8a6b5,_0xb88ec1){io['to'](_0x651b7e)[_0x999c('0xc')](_0xc8a6b5,_0xb88ec1);}var headers={'Content-Type':_0x999c('0xd'),'Accept':_0x999c('0xd')};function getTicket(_0x395321,_0x4dd585,_0x1f3f8f,_0x2bf133,_0x574ba0){logger[_0x999c('0xe')](_0x999c('0xf'));return request({'uri':util[_0x999c('0x10')](_0x999c('0x11'),_0x395321[_0x999c('0x12')]),'method':_0x999c('0x13'),'body':{'ticket':_[_0x999c('0x14')]({'requester_id':_0x1f3f8f['id'],'submitter_id':_0x4dd585?_0x4dd585['id']:undefined,'assignee_id':_0x4dd585?_0x4dd585['id']:undefined,'tags':getTags(_0x2bf133[_0x999c('0x15')],_0x999c('0x16')),'subject':intUtil[_0x999c('0x17')](_0x2bf133[_0x999c('0x18')],_0x574ba0,'\x20'),'description':intUtil[_0x999c('0x17')](_0x2bf133['Descriptions'],_0x574ba0,'\x0a'),'comment':{'public':![],'body':intUtil[_0x999c('0x17')](_0x2bf133[_0x999c('0x19')],_0x574ba0,'\x0a')}},getCustomFields(_0x2bf133['Fields'],_0x574ba0))}})['then'](function(_0x5f5a20){logger[_0x999c('0xe')](_0x999c('0x1a'));return _0x5f5a20[_0x999c('0x1b')];});}function getUser(_0x116f08,_0x2a6667){if(intUtil['validateEmail'](_0x2a6667)){logger[_0x999c('0xe')](_0x999c('0x1c'),_0x2a6667);return request({'uri':util[_0x999c('0x10')](_0x999c('0x1d'),_0x116f08[_0x999c('0x12')]),'qs':{'query':util['format'](_0x999c('0x1e'),_0x2a6667)}})[_0x999c('0x1f')](function(_0x3a8a99){if(_0x3a8a99[_0x999c('0x20')]){logger[_0x999c('0xe')]('Agent\x20found!');return _[_0x999c('0x21')](_0x3a8a99[_0x999c('0x22')],{'email':_0x2a6667,'role':_0x999c('0x23')});}else{logger[_0x999c('0xe')](_0x999c('0x24'));return request({'uri':util[_0x999c('0x10')]('%s/users/me.json',_0x116f08[_0x999c('0x12')])})[_0x999c('0x1f')](function(_0x24f637){logger[_0x999c('0xe')](_0x999c('0x25'));return _0x24f637[_0x999c('0x26')];});}});}else{logger[_0x999c('0xe')](_0x999c('0x24'));return request({'uri':util[_0x999c('0x10')](_0x999c('0x27'),_0x116f08[_0x999c('0x12')])})['then'](function(_0x448682){logger[_0x999c('0xe')](_0x999c('0x25'));return _0x448682[_0x999c('0x26')];});}}function getEndUser(_0x2256fd,_0x15d102,_0x575897){logger[_0x999c('0xe')](_0x999c('0x28'),_0x575897);return request({'uri':util[_0x999c('0x10')]('%s/search.json',_0x2256fd[_0x999c('0x12')]),'qs':{'query':util[_0x999c('0x10')]('type:user\x20role:end-user\x20phone:%s',_0x575897)}})[_0x999c('0x1f')](function(_0x4c41ab){var _0x555c7a;if(_0x4c41ab[_0x999c('0x22')][_0x999c('0x29')]){_0x4c41ab[_0x999c('0x22')]=_[_0x999c('0x2a')](_0x4c41ab[_0x999c('0x22')],{'suspended':![],'role':_0x999c('0x2b')});if(_0x4c41ab[_0x999c('0x22')][_0x999c('0x29')]){_0x555c7a=_[_0x999c('0x2c')](_0x4c41ab[_0x999c('0x22')]);}}if(_0x555c7a){logger['info'](_0x999c('0x2d'));return _0x555c7a;}else{logger[_0x999c('0xe')](_0x999c('0x2e'));return request({'uri':util[_0x999c('0x10')](_0x999c('0x2f'),_0x2256fd[_0x999c('0x12')]),'method':_0x999c('0x13'),'body':{'user':{'role':_0x999c('0x2b'),'name':util['format']('Caller\x20-\x20%s',_0x15d102||_0x575897),'phone':_0x575897}}})[_0x999c('0x1f')](function(_0x98537f){logger[_0x999c('0xe')](_0x999c('0x30'));return _0x98537f['user'];});}});}function getAuth(_0x12e207){var _0xe28e45;if(_0x12e207[_0x999c('0x31')]===_0x999c('0x32')){_0xe28e45=util['format']('%s:%s',_0x12e207[_0x999c('0x33')],_0x12e207[_0x999c('0x32')]);}else if(_0x12e207[_0x999c('0x31')]===_0x999c('0x34')){_0xe28e45=util[_0x999c('0x10')](_0x999c('0x35'),_0x12e207[_0x999c('0x33')],_0x12e207['token']);}return util['format']('Basic\x20%s',new Buffer(_0xe28e45)[_0x999c('0x36')](_0x999c('0x37')));}function request(_0x480845){logger['debug']('[HTTP]',JSON[_0x999c('0x38')](_0x480845));return rp(_[_0x999c('0x9')](_0x480845,{'method':_0x999c('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x3a112d,_0x5b5b2a){var _0x105c33=[];if(_0x3a112d&&_0x3a112d[_0x999c('0x29')]>0x0){_0x105c33=_['map'](_0x3a112d,_0x5b5b2a);}return _0x105c33;}function getCustomFields(_0x510f74,_0x751fe){var _0x5ac869=[];var _0x2878f5={'custom_fields':[]};if(_0x510f74['length']>0x0){_[_0x999c('0x3a')](_0x510f74,function(_0x21850d){if(_0x21850d[_0x999c('0x3b')]===_0x999c('0x3c')&&_0x21850d['nameField']&&!_0x21850d['customField']){_0x2878f5[_0x21850d[_0x999c('0x3d')][_0x999c('0x3e')]()]=_0x21850d[_0x999c('0x3f')][_0x999c('0x36')]();}else if(_0x21850d['type']===_0x999c('0x3c')&&_0x21850d[_0x999c('0x40')]&&_0x21850d[_0x999c('0x41')]){_0x2878f5[_0x999c('0x42')]['push']({'id':_0x21850d[_0x999c('0x40')],'value':_0x21850d['content'][_0x999c('0x36')]()});}else if(_0x21850d[_0x999c('0x3b')]==='variable'&&_0x21850d[_0x999c('0x43')]&&_0x21850d[_0x999c('0x40')]&&_0x21850d[_0x999c('0x41')]){_0x751fe[_0x21850d[_0x999c('0x43')]]&&_0x2878f5[_0x999c('0x42')][_0x999c('0x44')]({'id':_0x21850d[_0x999c('0x40')],'value':_0x751fe[_0x21850d[_0x999c('0x43')]]['toString']()});}else if(_0x21850d['type']==='customVariable'&&_0x21850d['Variable']&&_0x21850d[_0x999c('0x45')][_0x999c('0x16')]&&_0x21850d[_0x999c('0x40')]&&_0x21850d[_0x999c('0x41')]){_0x751fe[_0x21850d[_0x999c('0x45')]['name'][_0x999c('0x3e')]()]&&_0x2878f5[_0x999c('0x42')][_0x999c('0x44')]({'id':_0x21850d[_0x999c('0x40')],'value':_0x751fe[_0x21850d[_0x999c('0x45')]['name'][_0x999c('0x3e')]()][_0x999c('0x36')]()});}});}return _0x2878f5;}exports[_0x999c('0x46')]=function(_0x30e226,_0x28b9de,_0x3edb17,_0x3bfffb,_0x2fadc7,_0x41d2b2){var _0x4e82a9,_0x5f53c2;_0x41d2b2[_0x999c('0x12')]=intUtil[_0x999c('0x47')](_0x41d2b2[_0x999c('0x12')]);_0x41d2b2[_0x999c('0x48')]=intUtil[_0x999c('0x47')](_0x41d2b2[_0x999c('0x48')]);if(_0x2fadc7&&_0x2fadc7[_0x999c('0x49')]){logger[_0x999c('0xe')](_0x999c('0x4a'),_0x999c('0x4b'));_0x28b9de[_0x999c('0x4c')]=util['format'](_0x999c('0x4d'),_0x41d2b2[_0x999c('0x48')],_0x28b9de[_0x999c('0x4e')],md5(_0x28b9de[_0x999c('0x4e')]));}else{_0x28b9de[_0x999c('0x4c')]='';}headers[_0x999c('0x4f')]=getAuth(_0x41d2b2);return getUser(_0x41d2b2,_0x3bfffb[_0x999c('0x50')])[_0x999c('0x1f')](function(_0x55eb16){_0x4e82a9=_0x55eb16;logger[_0x999c('0xe')](_0x999c('0x51'),_0x4e82a9['id']);return getEndUser(_0x41d2b2,_0x28b9de[_0x999c('0x52')],_0x28b9de[_0x999c('0x53')]);})[_0x999c('0x1f')](function(_0x2db35a){_0x5f53c2=_0x2db35a;logger[_0x999c('0xe')]('The\x20Enduser\x20ID\x20is:',_0x5f53c2['id']);return getTicket(_0x41d2b2,_0x4e82a9,_0x5f53c2,_0x3edb17,_0x28b9de);})['then'](function(_0x1139f6){if(_0x1139f6){logger[_0x999c('0xe')](_0x999c('0x54'),_0x1139f6['id']);switch(_0x41d2b2[_0x999c('0x3b')]){case _0x999c('0x55'):logger['info'](_0x999c('0x4a'),_0x999c('0x56'));return request({'uri':util[_0x999c('0x10')](_0x999c('0x57'),_0x41d2b2['remoteUri'],_0x4e82a9['id'],_0x1139f6['id']),'method':_0x999c('0x13')});case'newTab':logger[_0x999c('0xe')](_0x999c('0x4a'),_0x999c('0x58'));emit(util[_0x999c('0x10')](_0x999c('0x59'),_0x3bfffb[_0x999c('0x16')]),_0x999c('0x5a'),{'uri':util['format'](_0x999c('0x5b'),_0x41d2b2[_0x999c('0x12')],_0x1139f6['id'])});break;default:logger[_0x999c('0x5c')]('[QUEUE]',_0x999c('0x5d'));}}})[_0x999c('0x5e')](function(_0x1dc58c){logger['error'](_0x999c('0x5f'),util['inspect'](_0x1dc58c,{'showHidden':!![],'depth':null}));});};exports[_0x999c('0x60')]=function(_0x172ccb,_0x2dcbc0,_0x203f16,_0x565fdb,_0x3fb9b4,_0x5420bd,_0x4c29b1){var _0x3461eb,_0x117502;_0x5420bd['remoteUri']=intUtil[_0x999c('0x47')](_0x5420bd['remoteUri']);_0x5420bd[_0x999c('0x48')]=intUtil[_0x999c('0x47')](_0x5420bd['serverUrl']);if(_0x4c29b1&&_0x4c29b1[_0x999c('0x61')]&&_0x4c29b1[_0x999c('0x61')]!==_0x999c('0x62')){logger[_0x999c('0xe')](_0x999c('0x63'),_0x999c('0x4b'));_0x2dcbc0[_0x999c('0x4c')]=util[_0x999c('0x10')](_0x999c('0x4d'),_0x5420bd['serverUrl'],_0x2dcbc0[_0x999c('0x4e')],md5(_0x2dcbc0[_0x999c('0x4e')]));}headers[_0x999c('0x4f')]=getAuth(_0x5420bd);return getUser(_0x5420bd,_0x565fdb[_0x999c('0x50')])[_0x999c('0x1f')](function(_0x3c652b){_0x3461eb=_0x3c652b;logger['info']('The\x20User\x20ID\x20is:',_0x3461eb['id']);return getEndUser(_0x5420bd,_0x2dcbc0['destcalleridname'],_0x2dcbc0['destcalleridnum']);})[_0x999c('0x1f')](function(_0x141b7e){_0x117502=_0x141b7e;logger[_0x999c('0xe')]('The\x20Enduser\x20ID\x20is:',_0x117502['id']);return getTicket(_0x5420bd,_0x3461eb,_0x117502,_0x203f16,_0x2dcbc0);})[_0x999c('0x1f')](function(_0x5a2033){if(_0x5a2033){logger[_0x999c('0xe')]('The\x20Ticket\x20ID\x20is:',_0x5a2033['id']);switch(_0x5420bd[_0x999c('0x3b')]){case _0x999c('0x55'):logger[_0x999c('0xe')](_0x999c('0x63'),_0x999c('0x56'));return request({'uri':util['format'](_0x999c('0x57'),_0x5420bd[_0x999c('0x12')],_0x3461eb['id'],_0x5a2033['id']),'method':_0x999c('0x13')});case _0x999c('0x64'):logger[_0x999c('0xe')](_0x999c('0x63'),_0x999c('0x58'));emit(util['format'](_0x999c('0x59'),_0x565fdb[_0x999c('0x16')]),_0x999c('0x5a'),{'uri':util[_0x999c('0x10')](_0x999c('0x5b'),_0x5420bd[_0x999c('0x12')],_0x5a2033['id'])});break;default:logger[_0x999c('0x5c')]('[OUTBOUND]',_0x999c('0x5d'));}}})[_0x999c('0x5e')](function(_0x531379){logger['error'](_0x999c('0x65'),util[_0x999c('0x66')](_0x531379,{'showHidden':!![],'depth':null}));});};exports[_0x999c('0x67')]=function(_0x5e57d0,_0x40aea7,_0x23c61c,_0x1ae9c0,_0x251b3f,_0x3fb931){var _0xbbd627,_0x50b65c;_0x3fb931[_0x999c('0x12')]=intUtil['stripTrailingSlash'](_0x3fb931[_0x999c('0x12')]);_0x3fb931[_0x999c('0x48')]=intUtil[_0x999c('0x47')](_0x3fb931[_0x999c('0x48')]);if(_0x251b3f&&_0x251b3f[_0x999c('0x49')]){logger[_0x999c('0xe')](_0x999c('0x68'),_0x999c('0x4b'));_0x40aea7[_0x999c('0x4c')]=util[_0x999c('0x10')](_0x999c('0x4d'),_0x3fb931[_0x999c('0x48')],_0x40aea7[_0x999c('0x4e')],md5(_0x40aea7['uniqueid']));}else{_0x40aea7[_0x999c('0x4c')]='';}headers[_0x999c('0x4f')]=getAuth(_0x3fb931);return getUser(_0x3fb931)['then'](function(_0x1066c8){_0xbbd627=_0x1066c8;logger[_0x999c('0xe')](_0x999c('0x51'),_0xbbd627['id']);return getEndUser(_0x3fb931,_0x40aea7['calleridname'],_0x40aea7[_0x999c('0x53')]);})[_0x999c('0x1f')](function(_0x2275e1){_0x50b65c=_0x2275e1;logger[_0x999c('0xe')](_0x999c('0x69'),_0x50b65c['id']);return getTicket(_0x3fb931,_0xbbd627,_0x50b65c,_0x23c61c,_0x40aea7);})['then'](function(_0x42e688){if(_0x42e688){logger[_0x999c('0xe')](_0x999c('0x54'),_0x42e688['id']);}})[_0x999c('0x5e')](function(_0x163121){logger[_0x999c('0x5c')](_0x999c('0x6a'),util[_0x999c('0x66')](_0x163121,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xff3c=['type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','password','%s:%s','username','authType','token','%s/token:%s','base64','stringify','GET','map','forEach','type','string','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','trigger:browser:url','Zendesk\x20account\x20type\x20not\x20recognized','[ABANDONED]','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','../../../../config/logger','zendesk','redis','defaults','localhost','application/json','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','info','Admin\x20account\x20selected.','user','%s/search.json'];(function(_0x357e2d,_0x96ec53){var _0x421e81=function(_0x3a633d){while(--_0x3a633d){_0x357e2d['push'](_0x357e2d['shift']());}};_0x421e81(++_0x96ec53);}(_0xff3c,0x179));var _0xcff3=function(_0x3443ba,_0x40ea04){_0x3443ba=_0x3443ba-0x0;var _0x57b3fe=_0xff3c[_0x3443ba];return _0x57b3fe;};'use strict';var _=require(_0xcff3('0x0'));var rp=require(_0xcff3('0x1'));var md5=require('md5');var util=require(_0xcff3('0x2'));var Redis=require(_0xcff3('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xcff3('0x4'))(_0xcff3('0x5'));config[_0xcff3('0x6')]=_[_0xcff3('0x7')](config[_0xcff3('0x6')],{'host':_0xcff3('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x465f67,_0x5f1b99,_0x6a338e){io['to'](_0x465f67)['emit'](_0x5f1b99,_0x6a338e);}var headers={'Content-Type':_0xcff3('0x9'),'Accept':_0xcff3('0x9')};function getTicket(_0x32db64,_0x3de9db,_0x4473d7,_0x1e2fa3,_0x42e9da){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0xcff3('0xa')](_0xcff3('0xb'),_0x32db64[_0xcff3('0xc')]),'method':_0xcff3('0xd'),'body':{'ticket':_[_0xcff3('0xe')]({'requester_id':_0x4473d7['id'],'submitter_id':_0x3de9db?_0x3de9db['id']:undefined,'assignee_id':_0x3de9db?_0x3de9db['id']:undefined,'tags':getTags(_0x1e2fa3[_0xcff3('0xf')],_0xcff3('0x10')),'subject':intUtil[_0xcff3('0x11')](_0x1e2fa3[_0xcff3('0x12')],_0x42e9da,'\x20'),'description':intUtil[_0xcff3('0x11')](_0x1e2fa3[_0xcff3('0x13')],_0x42e9da,'\x0a'),'comment':{'public':![],'body':intUtil[_0xcff3('0x11')](_0x1e2fa3[_0xcff3('0x13')],_0x42e9da,'\x0a')}},getCustomFields(_0x1e2fa3[_0xcff3('0x14')],_0x42e9da))}})[_0xcff3('0x15')](function(_0x1334aa){logger['info'](_0xcff3('0x16'));return _0x1334aa['ticket'];});}function getUser(_0x2e6e55,_0xe66610){if(intUtil[_0xcff3('0x17')](_0xe66610)){logger['info'](_0xcff3('0x18'),_0xe66610);return request({'uri':util[_0xcff3('0xa')]('%s/search.json',_0x2e6e55[_0xcff3('0xc')]),'qs':{'query':util['format'](_0xcff3('0x19'),_0xe66610)}})[_0xcff3('0x15')](function(_0x3991c3){if(_0x3991c3['count']){logger['info'](_0xcff3('0x1a'));return _[_0xcff3('0x1b')](_0x3991c3['results'],{'email':_0xe66610,'role':_0xcff3('0x1c')});}else{logger['info'](_0xcff3('0x1d'));return request({'uri':util['format'](_0xcff3('0x1e'),_0x2e6e55['remoteUri'])})[_0xcff3('0x15')](function(_0x4912b1){logger[_0xcff3('0x1f')](_0xcff3('0x20'));return _0x4912b1['user'];});}});}else{logger[_0xcff3('0x1f')](_0xcff3('0x1d'));return request({'uri':util[_0xcff3('0xa')](_0xcff3('0x1e'),_0x2e6e55['remoteUri'])})[_0xcff3('0x15')](function(_0x596051){logger['info'](_0xcff3('0x20'));return _0x596051[_0xcff3('0x21')];});}}function getEndUser(_0x22b877,_0xbd0114,_0x4d829e){logger[_0xcff3('0x1f')]('Searching\x20enduser\x20with\x20phone',_0x4d829e);return request({'uri':util[_0xcff3('0xa')](_0xcff3('0x22'),_0x22b877[_0xcff3('0xc')]),'qs':{'query':util[_0xcff3('0xa')](_0xcff3('0x23'),_0x4d829e)}})[_0xcff3('0x15')](function(_0x4557d0){var _0xb9c78b;if(_0x4557d0[_0xcff3('0x24')][_0xcff3('0x25')]){_0x4557d0[_0xcff3('0x24')]=_[_0xcff3('0x26')](_0x4557d0[_0xcff3('0x24')],{'suspended':![],'role':_0xcff3('0x27')});if(_0x4557d0[_0xcff3('0x24')][_0xcff3('0x25')]){_0xb9c78b=_[_0xcff3('0x28')](_0x4557d0['results']);}}if(_0xb9c78b){logger[_0xcff3('0x1f')](_0xcff3('0x29'));return _0xb9c78b;}else{logger['info'](_0xcff3('0x2a'));return request({'uri':util['format'](_0xcff3('0x2b'),_0x22b877[_0xcff3('0xc')]),'method':_0xcff3('0xd'),'body':{'user':{'role':_0xcff3('0x27'),'name':util[_0xcff3('0xa')](_0xcff3('0x2c'),_0xbd0114||_0x4d829e),'phone':_0x4d829e}}})[_0xcff3('0x15')](function(_0x2b9b34){logger[_0xcff3('0x1f')]('Enduser\x20created.');return _0x2b9b34[_0xcff3('0x21')];});}});}function getAuth(_0x57d809){var _0x1314ba;if(_0x57d809['authType']===_0xcff3('0x2d')){_0x1314ba=util[_0xcff3('0xa')](_0xcff3('0x2e'),_0x57d809[_0xcff3('0x2f')],_0x57d809[_0xcff3('0x2d')]);}else if(_0x57d809[_0xcff3('0x30')]===_0xcff3('0x31')){_0x1314ba=util[_0xcff3('0xa')](_0xcff3('0x32'),_0x57d809[_0xcff3('0x2f')],_0x57d809[_0xcff3('0x31')]);}return util[_0xcff3('0xa')]('Basic\x20%s',new Buffer(_0x1314ba)['toString'](_0xcff3('0x33')));}function request(_0x27f18d){logger['debug']('[HTTP]',JSON[_0xcff3('0x34')](_0x27f18d));return rp(_[_0xcff3('0x7')](_0x27f18d,{'method':_0xcff3('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x246657,_0xee37db){var _0x530873=[];if(_0x246657&&_0x246657['length']>0x0){_0x530873=_[_0xcff3('0x36')](_0x246657,_0xee37db);}return _0x530873;}function getCustomFields(_0x12044e,_0x350ced){var _0x4f7e48=[];var _0x3a648a={'custom_fields':[]};if(_0x12044e[_0xcff3('0x25')]>0x0){_[_0xcff3('0x37')](_0x12044e,function(_0x7c32b7){if(_0x7c32b7[_0xcff3('0x38')]===_0xcff3('0x39')&&_0x7c32b7[_0xcff3('0x3a')]&&!_0x7c32b7[_0xcff3('0x3b')]){_0x3a648a[_0x7c32b7['nameField'][_0xcff3('0x3c')]()]=_0x7c32b7[_0xcff3('0x3d')][_0xcff3('0x3e')]();}else if(_0x7c32b7[_0xcff3('0x38')]==='string'&&_0x7c32b7[_0xcff3('0x3f')]&&_0x7c32b7[_0xcff3('0x3b')]){_0x3a648a['custom_fields']['push']({'id':_0x7c32b7[_0xcff3('0x3f')],'value':_0x7c32b7[_0xcff3('0x3d')]['toString']()});}else if(_0x7c32b7[_0xcff3('0x38')]==='variable'&&_0x7c32b7[_0xcff3('0x40')]&&_0x7c32b7['idField']&&_0x7c32b7['customField']){_0x350ced[_0x7c32b7[_0xcff3('0x40')]]&&_0x3a648a[_0xcff3('0x41')]['push']({'id':_0x7c32b7[_0xcff3('0x3f')],'value':_0x350ced[_0x7c32b7['variableName']][_0xcff3('0x3e')]()});}else if(_0x7c32b7[_0xcff3('0x38')]===_0xcff3('0x42')&&_0x7c32b7[_0xcff3('0x43')]&&_0x7c32b7['Variable'][_0xcff3('0x10')]&&_0x7c32b7['idField']&&_0x7c32b7[_0xcff3('0x3b')]){_0x350ced[_0x7c32b7[_0xcff3('0x43')][_0xcff3('0x10')][_0xcff3('0x3c')]()]&&_0x3a648a[_0xcff3('0x41')]['push']({'id':_0x7c32b7[_0xcff3('0x3f')],'value':_0x350ced[_0x7c32b7['Variable'][_0xcff3('0x10')]['toLowerCase']()][_0xcff3('0x3e')]()});}});}return _0x3a648a;}exports['queue']=function(_0x14c49e,_0x4afe50,_0x2bf643,_0xe7a011,_0x2f5a6d,_0x49a061){var _0x18135b,_0x44dffd;_0x49a061['remoteUri']=intUtil[_0xcff3('0x44')](_0x49a061[_0xcff3('0xc')]);_0x49a061['serverUrl']=intUtil[_0xcff3('0x44')](_0x49a061[_0xcff3('0x45')]);if(_0x2f5a6d&&_0x2f5a6d[_0xcff3('0x46')]){logger[_0xcff3('0x1f')](_0xcff3('0x47'),'Recording\x20is\x20enabled!');_0x4afe50[_0xcff3('0x48')]=util[_0xcff3('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49a061[_0xcff3('0x45')],_0x4afe50[_0xcff3('0x49')],md5(_0x4afe50[_0xcff3('0x49')]));}else{_0x4afe50[_0xcff3('0x48')]='';}headers['Authorization']=getAuth(_0x49a061);return getUser(_0x49a061,_0xe7a011[_0xcff3('0x4a')])[_0xcff3('0x15')](function(_0xe65192){_0x18135b=_0xe65192;logger[_0xcff3('0x1f')](_0xcff3('0x4b'),_0x18135b['id']);return getEndUser(_0x49a061,_0x4afe50[_0xcff3('0x4c')],_0x4afe50[_0xcff3('0x4d')]);})[_0xcff3('0x15')](function(_0x52e3ad){_0x44dffd=_0x52e3ad;logger[_0xcff3('0x1f')](_0xcff3('0x4e'),_0x44dffd['id']);return getTicket(_0x49a061,_0x18135b,_0x44dffd,_0x2bf643,_0x4afe50);})[_0xcff3('0x15')](function(_0x38ebb3){if(_0x38ebb3){logger[_0xcff3('0x1f')](_0xcff3('0x4f'),_0x38ebb3['id']);switch(_0x49a061[_0xcff3('0x38')]){case _0xcff3('0x50'):logger[_0xcff3('0x1f')](_0xcff3('0x47'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xcff3('0xa')](_0xcff3('0x51'),_0x49a061[_0xcff3('0xc')],_0x18135b['id'],_0x38ebb3['id']),'method':'POST'});case _0xcff3('0x52'):logger[_0xcff3('0x1f')](_0xcff3('0x47'),_0xcff3('0x53'));emit(util[_0xcff3('0xa')](_0xcff3('0x54'),_0xe7a011[_0xcff3('0x10')]),'trigger:browser:url',{'uri':util['format'](_0xcff3('0x55'),_0x49a061['remoteUri'],_0x38ebb3['id'])});break;default:logger[_0xcff3('0x56')](_0xcff3('0x47'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xcff3('0x57')](function(_0x4112a9){logger[_0xcff3('0x56')](_0xcff3('0x58'),util[_0xcff3('0x59')](_0x4112a9,{'showHidden':!![],'depth':null}));});};exports[_0xcff3('0x5a')]=function(_0x301768,_0x4e6e5e,_0x167f5c,_0x3d5ee4,_0x3fe0f8,_0x110fdd,_0x1821da){var _0x4133cf,_0x5d8f5f;_0x110fdd['remoteUri']=intUtil[_0xcff3('0x44')](_0x110fdd[_0xcff3('0xc')]);_0x110fdd[_0xcff3('0x45')]=intUtil[_0xcff3('0x44')](_0x110fdd['serverUrl']);if(_0x1821da&&_0x1821da['recordingFormat']&&_0x1821da['recordingFormat']!==_0xcff3('0x5b')){logger[_0xcff3('0x1f')](_0xcff3('0x5c'),_0xcff3('0x5d'));_0x4e6e5e[_0xcff3('0x48')]=util[_0xcff3('0xa')](_0xcff3('0x5e'),_0x110fdd[_0xcff3('0x45')],_0x4e6e5e[_0xcff3('0x49')],md5(_0x4e6e5e[_0xcff3('0x49')]));}headers[_0xcff3('0x5f')]=getAuth(_0x110fdd);return getUser(_0x110fdd,_0x3d5ee4['email'])[_0xcff3('0x15')](function(_0x2bd15b){_0x4133cf=_0x2bd15b;logger[_0xcff3('0x1f')](_0xcff3('0x4b'),_0x4133cf['id']);return getEndUser(_0x110fdd,_0x4e6e5e[_0xcff3('0x60')],_0x4e6e5e[_0xcff3('0x61')]);})[_0xcff3('0x15')](function(_0x4c9065){_0x5d8f5f=_0x4c9065;logger[_0xcff3('0x1f')](_0xcff3('0x4e'),_0x5d8f5f['id']);return getTicket(_0x110fdd,_0x4133cf,_0x5d8f5f,_0x167f5c,_0x4e6e5e);})[_0xcff3('0x15')](function(_0x554909){if(_0x554909){logger[_0xcff3('0x1f')](_0xcff3('0x4f'),_0x554909['id']);switch(_0x110fdd['type']){case _0xcff3('0x50'):logger[_0xcff3('0x1f')]('[OUTBOUND]',_0xcff3('0x62'));return request({'uri':util[_0xcff3('0xa')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x110fdd[_0xcff3('0xc')],_0x4133cf['id'],_0x554909['id']),'method':_0xcff3('0xd')});case _0xcff3('0x52'):logger[_0xcff3('0x1f')](_0xcff3('0x5c'),_0xcff3('0x53'));emit(util[_0xcff3('0xa')](_0xcff3('0x54'),_0x3d5ee4['name']),_0xcff3('0x63'),{'uri':util['format'](_0xcff3('0x55'),_0x110fdd[_0xcff3('0xc')],_0x554909['id'])});break;default:logger[_0xcff3('0x56')](_0xcff3('0x5c'),_0xcff3('0x64'));}}})[_0xcff3('0x57')](function(_0x19e1f1){logger[_0xcff3('0x56')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xcff3('0x59')](_0x19e1f1,{'showHidden':!![],'depth':null}));});};exports['abandoned']=function(_0x5918da,_0x164c6b,_0x598f59,_0xeb128e,_0x6f2737,_0x6efee8){var _0x3448eb,_0x9e4b17;_0x6efee8[_0xcff3('0xc')]=intUtil[_0xcff3('0x44')](_0x6efee8['remoteUri']);_0x6efee8['serverUrl']=intUtil['stripTrailingSlash'](_0x6efee8[_0xcff3('0x45')]);if(_0x6f2737&&_0x6f2737[_0xcff3('0x46')]){logger[_0xcff3('0x1f')](_0xcff3('0x65'),_0xcff3('0x5d'));_0x164c6b[_0xcff3('0x48')]=util[_0xcff3('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x6efee8[_0xcff3('0x45')],_0x164c6b['uniqueid'],md5(_0x164c6b['uniqueid']));}else{_0x164c6b[_0xcff3('0x48')]='';}headers[_0xcff3('0x5f')]=getAuth(_0x6efee8);return getUser(_0x6efee8)[_0xcff3('0x15')](function(_0x3fb649){_0x3448eb=_0x3fb649;logger[_0xcff3('0x1f')](_0xcff3('0x4b'),_0x3448eb['id']);return getEndUser(_0x6efee8,_0x164c6b['calleridname'],_0x164c6b['calleridnum']);})[_0xcff3('0x15')](function(_0xa2aac8){_0x9e4b17=_0xa2aac8;logger['info'](_0xcff3('0x4e'),_0x9e4b17['id']);return getTicket(_0x6efee8,_0x3448eb,_0x9e4b17,_0x598f59,_0x164c6b);})[_0xcff3('0x15')](function(_0x47b904){if(_0x47b904){logger['info']('The\x20Ticket\x20ID\x20is:',_0x47b904['id']);}})['catch'](function(_0x26ac2a){logger[_0xcff3('0x56')](_0xcff3('0x66'),util[_0xcff3('0x59')](_0x26ac2a,{'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 e3807a1..8577f68 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 _0xcba9=['log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Owner','administrator','Subject','getString','Subjects','Who_Id','Full_Name','Last_Name','What_Id','First_Name','$se_module','talktime','Call_Duration','answertime','endtime','utc','diff','starttime','YYYY-MM-DDTHH:mm:ss','mm:ss','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','outbound','format','agentcalledAt','Call_Type','Fields','/crm/v2/Calls','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','none','/downloads?type=uniqueid&token=','zoho.eu','destcalleridname','destcalleridnum','[OUTBOUND]','[ABANDONED]','request-promise','md5','util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','debug','[HTTP]','stringify','length','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','clientId','refresh_token','then','add','expires_in','seconds','catch','stack','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','Agent\x20found!','findIndex','profile','Administrator','user','Using\x20the\x20admin\x20account!','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','details','moduleCreate'];(function(_0x26bafe,_0x13e506){var _0x307879=function(_0x5a1548){while(--_0x5a1548){_0x26bafe['push'](_0x26bafe['shift']());}};_0x307879(++_0x13e506);}(_0xcba9,0x172));var _0x9cba=function(_0x1a9624,_0x5a17e9){_0x1a9624=_0x1a9624-0x0;var _0x1d0a38=_0xcba9[_0x1a9624];return _0x1d0a38;};'use strict';var _=require('lodash');var rp=require(_0x9cba('0x0'));var md5=require(_0x9cba('0x1'));var util=require(_0x9cba('0x2'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x9cba('0x3'));var BPromise=require(_0x9cba('0x4'));var config=require(_0x9cba('0x5'));var logger=require(_0x9cba('0x6'))(_0x9cba('0x7'));config['redis']=_[_0x9cba('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9cba('0x9')]));function emit(_0x41a098,_0x3303e9,_0x552001){io['to'](_0x41a098)['emit'](_0x3303e9,_0x552001);}function request(_0x2a914e){logger[_0x9cba('0xa')](_0x9cba('0xb'),JSON[_0x9cba('0xc')](_0x2a914e));return rp(_0x2a914e);}function getCustomFields(_0x6d6a92,_0x5bbc21){var _0x2768c9={};if(_0x6d6a92[_0x9cba('0xd')]>0x0){_['forEach'](_0x6d6a92,function(_0x21fde5){if(_0x21fde5[_0x9cba('0xe')]==='string'&&_0x21fde5[_0x9cba('0xf')]){_0x2768c9[_0x21fde5[_0x9cba('0xf')]]=_0x21fde5[_0x9cba('0x10')][_0x9cba('0x11')]();}else if(_0x21fde5[_0x9cba('0xe')]==='variable'&&_0x21fde5['variableName']&&_0x21fde5[_0x9cba('0xf')]&&_0x5bbc21[_0x21fde5['variableName']]){_0x2768c9[_0x21fde5[_0x9cba('0xf')]]=_0x5bbc21[_0x21fde5[_0x9cba('0x12')]]['toString']();}else if(_0x21fde5[_0x9cba('0xe')]===_0x9cba('0x13')&&_0x21fde5[_0x9cba('0x14')]&&_0x21fde5['Variable'][_0x9cba('0x15')]&&_0x21fde5['idField']&&_0x5bbc21[_0x21fde5[_0x9cba('0x14')][_0x9cba('0x15')][_0x9cba('0x16')]()]){_0x2768c9[_0x21fde5[_0x9cba('0xf')]]=_0x5bbc21[_0x21fde5['Variable'][_0x9cba('0x15')][_0x9cba('0x16')]()]['toString']();}});}return _0x2768c9;}function getName(_0x5d0f00){if(_0x5d0f00['indexOf']('\x20')>0x0){var _0x3838dd=_0x5d0f00[_0x9cba('0x17')](/ (.+)/);if(_0x3838dd[0x1]){return _0x3838dd;}}return[_0x5d0f00,_0x5d0f00];}var accountsTokens={};function getAccessToken(_0x1e30ea){return new Promise(function(_0x3bcec3,_0x587325){if(!_['isNil'](accountsTokens[_0x1e30ea['id']])&&!_[_0x9cba('0x18')](accountsTokens[_0x1e30ea['id']][_0x9cba('0x19')])){if(moment()['isBefore'](accountsTokens[_0x1e30ea['id']]['expires_in'])){_0x3bcec3(accountsTokens[_0x1e30ea['id']][_0x9cba('0x19')]);}}var _0x51c90e;switch(_0x1e30ea['zone']){case'US':_0x51c90e=_0x9cba('0x1a');break;case'AU':_0x51c90e=_0x9cba('0x1b');break;case'EU':_0x51c90e='https://accounts.zoho.eu';break;case'IN':_0x51c90e='https://accounts.zoho.in';break;case'CN':_0x51c90e='https://accounts.zoho.com.cn';break;default:_0x51c90e=_0x9cba('0x1c');break;}var _0x387ddd={'method':_0x9cba('0x1d'),'uri':_0x51c90e+'/oauth/v2/token','qs':{'refresh_token':_0x1e30ea['refreshToken'],'client_id':_0x1e30ea[_0x9cba('0x1e')],'client_secret':_0x1e30ea['clientSecret'],'grant_type':_0x9cba('0x1f')},'json':!![]};return rp(_0x387ddd)[_0x9cba('0x20')](function(_0x3877dd){accountsTokens[_0x1e30ea['id']]={'access_token':_0x3877dd['access_token'],'expires_in':moment()[_0x9cba('0x21')](_0x3877dd[_0x9cba('0x22')],_0x9cba('0x23'))};_0x3bcec3(_0x3877dd[_0x9cba('0x19')]);})[_0x9cba('0x24')](function(_0x2fb892){logger['error']('Failing\x20creating\x20the\x20access_token',_0x2fb892[_0x9cba('0x25')]);_0x587325(_0x2fb892);});});}function getUser(_0x7cef3e,_0x573a10,_0x579933,_0x51951c){logger[_0x9cba('0x26')](_0x9cba('0x27'));return request({'method':'GET','uri':util['format'](_0x9cba('0x28'),_0x573a10),'qs':{'type':_0x9cba('0x29')},'headers':{'Authorization':_0x9cba('0x2a')+_0x7cef3e},'json':!![]})[_0x9cba('0x20')](function(_0x1b9e79){if(_0x1b9e79[_0x9cba('0x2b')]){var _0x2fde57=-0x1;if(_[_0x9cba('0x2c')](_0x1b9e79[_0x9cba('0x2b')])){if(!_[_0x9cba('0x18')](_0x51951c)){_0x2fde57=_['findIndex'](_0x1b9e79[_0x9cba('0x2b')],function(_0x29646a){return _0x29646a['email']===_0x51951c;});}if(_0x2fde57>=0x0){logger[_0x9cba('0x26')](_0x9cba('0x2d'));}else{logger[_0x9cba('0x26')]('Using\x20the\x20admin\x20account!');_0x2fde57=_[_0x9cba('0x2e')](_0x1b9e79['users'],function(_0x192fd4){return _0x192fd4[_0x9cba('0x2f')]['name']===_0x9cba('0x30');});}return _0x1b9e79['users'][_0x2fde57];}else{if(_0x1b9e79[_0x9cba('0x31')][_0x9cba('0x2f')][_0x9cba('0x15')]===_0x9cba('0x30')){logger[_0x9cba('0x26')](_0x9cba('0x32'));user=_0x1b9e79[_0x9cba('0x31')];return user;}else{logger[_0x9cba('0x33')](_0x9cba('0x34'),JSON[_0x9cba('0xc')](_0x1b9e79));throw new Error(_0x9cba('0x35')+JSON[_0x9cba('0xc')](_0x1b9e79));}}}else{logger[_0x9cba('0x33')]('The\x20failing\x20result\x20is',JSON[_0x9cba('0xc')](_0x1b9e79));throw new Error(_0x9cba('0x35')+JSON['stringify'](_0x1b9e79));}})[_0x9cba('0x24')](function(_0x2d0fc1){console[_0x9cba('0x33')](_0x2d0fc1);});}function getZohoUser(_0x51dc05,_0x318868){return new BPromise(function(_0x3025c5,_0x21e5b8){request(_0x51dc05)['then'](function(_0x2b2798){var _0xba54b5=null;if(_0x2b2798){_0xba54b5=_0x2b2798[_0x9cba('0x36')][0x0];_0xba54b5[_0x9cba('0x37')]=_0x318868;}_0x3025c5(_0xba54b5);})[_0x9cba('0x24')](function(_0x19dd84){_0x21e5b8(_0x19dd84);});});}function createEndUser(_0x23d10f,_0x2614fe,_0x1f25fa,_0x173d2f,_0x481770,_0xc717fb){var _0x1f25fa=getName(_0x1f25fa);return request({'method':_0x9cba('0x1d'),'uri':'https://www.zohoapis.'+_0x2614fe+_0x9cba('0x38')+_[_0x9cba('0x39')](_0xc717fb['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x1f25fa[0x1],'First_Name':_0x1f25fa[0x0],'Phone':_0x173d2f,'Owner':{'name':!_[_0x9cba('0x18')](_0x481770['role'][_0x9cba('0x15')])?_0x481770[_0x9cba('0x3a')]['name']:!_[_0x9cba('0x18')](_0x481770[_0x9cba('0x3b')])?_0x481770[_0x9cba('0x3b')]+'\x20'+_0x481770[_0x9cba('0x3c')]:_0x481770['last_name'],'id':_0x481770['id']}}]},'headers':{'Authorization':_0x9cba('0x2a')+_0x23d10f},'json':!![]})['then'](function(_0x15b1c6){if(_0x15b1c6&&_0x15b1c6[_0x9cba('0x36')][0x0][_0x9cba('0x3d')]===_0x9cba('0x3e')){var _0xc8af91=_0x15b1c6[_0x9cba('0x36')][0x0][_0x9cba('0x3f')];_0xc8af91[_0x9cba('0x37')]=_['startCase'](_0xc717fb[_0x9cba('0x40')])+'s';return _0xc8af91;}logger[_0x9cba('0x33')]('The\x20failing\x20result\x20is',JSON[_0x9cba('0xc')](data));throw new Error('Error:\x20'+JSON[_0x9cba('0xc')](data));})[_0x9cba('0x24')](function(_0x4a1324){console[_0x9cba('0x41')](_0x9cba('0x42'),_0x4a1324);});}function getEndUser(_0x57f48d,_0x15bcc4,_0x51f241,_0x3a6912,_0x320730,_0x266060,_0x579c6f){var _0x14d8c8={'method':_0x9cba('0x43'),'uri':'','headers':{'Authorization':_0x9cba('0x2a')+_0x57f48d},'json':!![]};switch(_0x579c6f[_0x9cba('0x44')]){case _0x9cba('0x45'):_0x14d8c8[_0x9cba('0x46')]=_0x9cba('0x47')+_0x15bcc4+_0x9cba('0x48')+_0x320730+'))';return getZohoUser(_0x14d8c8,_0x9cba('0x49'))[_0x9cba('0x20')](function(_0xf8792){if(_0xf8792)return _0xf8792;_0x14d8c8[_0x9cba('0x46')]=_0x9cba('0x47')+_0x15bcc4+_0x9cba('0x4a')+_0x320730+'))';return getZohoUser(_0x14d8c8,_0x9cba('0x4b'))[_0x9cba('0x20')](function(_0x5d2e8f){if(_0x5d2e8f)return _0x5d2e8f;if(_0x579c6f[_0x9cba('0x40')]!=_0x9cba('0x4c')){return createEndUser(_0x57f48d,_0x15bcc4,_0x3a6912,_0x320730,_0x266060,_0x579c6f);}else{return{};}});});break;case _0x9cba('0x4d'):_0x14d8c8['uri']='https://www.zohoapis.'+_0x15bcc4+_0x9cba('0x48')+_0x320730+'))';return getZohoUser(_0x14d8c8,_0x9cba('0x49'))[_0x9cba('0x20')](function(_0x12a922){if(_0x12a922)return _0x12a922;if(_0x579c6f[_0x9cba('0x40')]!=_0x9cba('0x4c')){return createEndUser(_0x57f48d,_0x15bcc4,_0x3a6912,_0x320730,_0x266060,_0x579c6f);}else{return{};}});break;case _0x9cba('0x4e'):_0x14d8c8['uri']=_0x9cba('0x47')+_0x15bcc4+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x320730+'))';return getZohoUser(_0x14d8c8,'Leads')[_0x9cba('0x20')](function(_0x193892){if(_0x193892)return _0x193892;if(_0x579c6f[_0x9cba('0x40')]!=_0x9cba('0x4c')){return createEndUser(_0x57f48d,_0x15bcc4,_0x3a6912,_0x320730,_0x266060,_0x579c6f);}else{return{};}});break;}}function getCall(_0x4d91f2,_0x5a7492,_0x4bd0d1,_0x5ee732,_0x34b2c8,_0x53a1fb,_0x394a17,_0xc1e0cd){logger['info']('Creating\x20new\x20call...');var _0x3cc8c0={};_0x3cc8c0[_0x9cba('0x4f')]={'name':!_[_0x9cba('0x18')](_0x5ee732[_0x9cba('0x3a')]['name'])&&!_[_0x9cba('0x18')](_0x5ee732['profile']['name'])&&_0x5ee732[_0x9cba('0x2f')]['name']===_0x9cba('0x50')?_0x5ee732[_0x9cba('0x3a')][_0x9cba('0x15')]:!_[_0x9cba('0x18')](_0x5ee732[_0x9cba('0x3b')])?_0x5ee732[_0x9cba('0x3b')]+'\x20'+_0x5ee732[_0x9cba('0x3c')]:_0x5ee732[_0x9cba('0x3c')],'id':_0x5ee732['id']};_0x3cc8c0[_0x9cba('0x51')]=intUtil[_0x9cba('0x52')](_0x53a1fb[_0x9cba('0x53')],_0x394a17,'\x20');_0x3cc8c0['Description']=intUtil[_0x9cba('0x52')](_0x53a1fb['Descriptions'],_0x394a17,'\x0a');if(_0x34b2c8[_0x9cba('0x37')]==='Contacts'){_0x3cc8c0[_0x9cba('0x54')]={'name':!_[_0x9cba('0x18')](_0x34b2c8[_0x9cba('0x55')])?_0x34b2c8[_0x9cba('0x55')]:!_[_0x9cba('0x18')](_0x34b2c8['First_Name'])?_0x34b2c8['First_Name']+'\x20'+_0x34b2c8[_0x9cba('0x56')]:_0x34b2c8[_0x9cba('0x56')],'id':_0x34b2c8['id']};}if(_0x34b2c8[_0x9cba('0x37')]===_0x9cba('0x4b')){_0x3cc8c0[_0x9cba('0x57')]={'name':!_['isNil'](_0x34b2c8[_0x9cba('0x55')])?_0x34b2c8['Full_Name']:!_[_0x9cba('0x18')](_0x34b2c8['First_Name'])?_0x34b2c8[_0x9cba('0x58')]+'\x20'+_0x34b2c8['Last_Name']:_0x34b2c8[_0x9cba('0x56')],'id':_0x34b2c8['id']};_0x3cc8c0[_0x9cba('0x59')]=_[_0x9cba('0x39')](_0x34b2c8[_0x9cba('0x37')]);}if(_0x394a17[_0x9cba('0x5a')]){_0x3cc8c0[_0x9cba('0x5b')]=moment['utc'](parseInt(_0x394a17[_0x9cba('0x5a')])*0x3e8)['format']('mm:ss');}else if(_0x394a17[_0x9cba('0x5c')]&&_0x394a17[_0x9cba('0x5d')]){_0x3cc8c0[_0x9cba('0x5b')]=moment[_0x9cba('0x5e')](moment(_0x394a17[_0x9cba('0x5d')],'YYYY-MM-DDTHH:mm:ss')[_0x9cba('0x5f')](moment(_0x394a17[_0x9cba('0x60')],_0x9cba('0x61'))))['format'](_0x9cba('0x62'));}switch(_0x394a17['lastevent']){case'called':_0x3cc8c0[_0x9cba('0x63')]=_0x9cba('0x64');break;case _0x9cba('0x65'):case _0x9cba('0x66'):_0x3cc8c0['Call_Result']=_0x9cba('0x67');break;case _0x9cba('0x68'):_0x3cc8c0[_0x9cba('0x63')]=_0x9cba('0x69');break;case _0x9cba('0x6a'):_0x3cc8c0['Call_Result']=_0x9cba('0x6b');break;default:}_0x3cc8c0['Call_Start_Time']=(_0xc1e0cd===_0x9cba('0x6c')?moment(_0x394a17[_0x9cba('0x60')])[_0x9cba('0x6d')](_0x9cba('0x61')):moment(_0x394a17[_0x9cba('0x6e')])[_0x9cba('0x6d')](_0x9cba('0x61')))||moment()['format'](_0x9cba('0x61'));_0x3cc8c0[_0x9cba('0x6f')]=_0xc1e0cd||'Inbound';_0x3cc8c0=_['merge'](_0x3cc8c0,getCustomFields(_0x53a1fb[_0x9cba('0x70')],_0x394a17));return request({'method':_0x9cba('0x1d'),'uri':_0x9cba('0x47')+_0x5a7492+_0x9cba('0x71'),'headers':{'Authorization':_0x9cba('0x2a')+_0x4d91f2},'body':{'data':[_0x3cc8c0]},'json':!![]})[_0x9cba('0x20')](function(_0x8a5f71){if(_0x8a5f71&&_0x8a5f71[_0x9cba('0x36')][0x0][_0x9cba('0x3d')]===_0x9cba('0x3e')){logger[_0x9cba('0x26')](_0x9cba('0x72'));return{'id':_0x8a5f71[_0x9cba('0x36')][0x0][_0x9cba('0x3f')]['id']};}})[_0x9cba('0x24')](function(_0x2222a3){logger['info'](_0x9cba('0x73'),_0x2222a3['stack']);console['log'](_0x9cba('0x73'),_0x2222a3);});}exports[_0x9cba('0x74')]=function(_0x2edade,_0x2b542e,_0xc2ff67,_0xa0068a,_0x49ed64,_0x1f814f){var _0x137eba,_0x12b35c,_0x3699cf;_0x1f814f['host']=intUtil[_0x9cba('0x75')](_0x1f814f[_0x9cba('0x76')]);_0x1f814f['serverUrl']=intUtil[_0x9cba('0x75')](_0x1f814f[_0x9cba('0x77')]);if(_0x49ed64&&_0x49ed64[_0x9cba('0x78')]){logger['info'](_0x9cba('0x79'),_0x9cba('0x7a'));_0x2b542e[_0x9cba('0x7b')]=_0x1f814f[_0x9cba('0x77')]+_0x9cba('0x7c')+_0x2b542e[_0x9cba('0x7d')]+'/downloads?type=uniqueid&token='+md5(_0x2b542e[_0x9cba('0x7d')]);}else{_0x2b542e[_0x9cba('0x7b')]='';}var _0x27ca4e=_0x1f814f[_0x9cba('0x76')]==='zoho.eu'?'eu':_0x9cba('0x7e');return getAccessToken(_0x1f814f)['then'](function(_0x3cc321){_0x3699cf=_0x3cc321;return getUser(_0x3699cf,_0x27ca4e,_0x1f814f,_0xa0068a[_0x9cba('0x7f')]);})['then'](function(_0x2b3045){_0x137eba=_0x2b3045;logger[_0x9cba('0x26')](_0x9cba('0x80'),_0x137eba['id']);return getEndUser(_0x3699cf,_0x27ca4e,_0x1f814f,_0x2b542e[_0x9cba('0x81')],_0x2b542e[_0x9cba('0x82')],_0x137eba,_0xc2ff67);})[_0x9cba('0x20')](function(_0x1686ac){_0x12b35c=_0x1686ac;return getCall(_0x3699cf,_0x27ca4e,_0x1f814f,_0x137eba,_0x12b35c,_0xc2ff67,_0x2b542e,_0x9cba('0x83'));})['then'](function(_0x14d6cc){if(_0x14d6cc){logger['info'](_0x9cba('0x84'),_0x14d6cc['id']);logger[_0x9cba('0x26')]('[QUEUE]',_0x9cba('0x85'));emit(util[_0x9cba('0x6d')](_0x9cba('0x86'),_0xa0068a['name']),_0x9cba('0x87'),{'uri':_0x9cba('0x88')+_0x1f814f[_0x9cba('0x76')]+_0x9cba('0x89')+_0x14d6cc['id']});}})[_0x9cba('0x24')](function(_0x29aadb){logger[_0x9cba('0x33')](_0x9cba('0x79'),JSON[_0x9cba('0xc')](_0x29aadb));});};exports['outbound']=function(_0x58e894,_0xc22dff,_0x4a8932,_0x4812e8,_0x1d1bd7,_0x24b7e5,_0x384db2){var _0x49189e,_0x2ee6cc,_0x4948e3;_0x24b7e5[_0x9cba('0x76')]=intUtil[_0x9cba('0x75')](_0x24b7e5[_0x9cba('0x76')]);_0x24b7e5[_0x9cba('0x77')]=intUtil[_0x9cba('0x75')](_0x24b7e5[_0x9cba('0x77')]);if(_0x384db2&&_0x384db2['recordingFormat']&&_0x384db2['recordingFormat']!==_0x9cba('0x8a')){logger[_0x9cba('0x26')]('[OUTBOUND]',_0x9cba('0x7a'));_0xc22dff['recordingURL']=_0x24b7e5['serverUrl']+'/api/voice/recordings/'+_0xc22dff[_0x9cba('0x7d')]+_0x9cba('0x8b')+md5(_0xc22dff['uniqueid']);}var _0x1d164d=_0x24b7e5[_0x9cba('0x76')]===_0x9cba('0x8c')?'eu':_0x9cba('0x7e');return getAccessToken(_0x24b7e5)['then'](function(_0x46e07e){_0x4948e3=_0x46e07e;return getUser(_0x4948e3,_0x1d164d,_0x24b7e5,_0x4812e8[_0x9cba('0x7f')]);})[_0x9cba('0x20')](function(_0x54525a){_0x49189e=_0x54525a;logger[_0x9cba('0x26')]('The\x20User\x20ID\x20is:',_0x49189e['id']);return getEndUser(_0x4948e3,_0x1d164d,_0x24b7e5,_0xc22dff[_0x9cba('0x8d')],_0xc22dff[_0x9cba('0x8e')],_0x49189e,_0x4a8932);})[_0x9cba('0x20')](function(_0x32a3bb){_0x2ee6cc=_0x32a3bb;return getCall(_0x4948e3,_0x1d164d,_0x24b7e5,_0x49189e,_0x2ee6cc,_0x4a8932,_0xc22dff,'Outbound');})['then'](function(_0x59cc41){if(_0x59cc41){logger['info']('The\x20Call\x20ID\x20is:',_0x59cc41['id']);logger[_0x9cba('0x26')]('[OUTBOUND]',_0x9cba('0x85'));emit(util[_0x9cba('0x6d')](_0x9cba('0x86'),_0x4812e8['name']),_0x9cba('0x87'),{'uri':_0x9cba('0x88')+_0x24b7e5[_0x9cba('0x76')]+_0x9cba('0x89')+_0x59cc41['id']});}})['catch'](function(_0x5caddc){logger[_0x9cba('0x33')](_0x9cba('0x8f'),JSON[_0x9cba('0xc')](_0x5caddc));});};exports['abandoned']=function(_0x27679c,_0x294916,_0x7c6153,_0x44cd35,_0x4c4367,_0x40bc3c){var _0x2d866e,_0x4cd320,_0x3721b8;_0x40bc3c['host']=intUtil['stripTrailingSlash'](_0x40bc3c[_0x9cba('0x76')]);_0x40bc3c[_0x9cba('0x77')]=intUtil['stripTrailingSlash'](_0x40bc3c[_0x9cba('0x77')]);if(_0x4c4367&&_0x4c4367[_0x9cba('0x78')]){logger['info']('[ABANDONED]',_0x9cba('0x7a'));_0x294916[_0x9cba('0x7b')]=_0x40bc3c[_0x9cba('0x77')]+'/api/voice/recordings/'+_0x294916[_0x9cba('0x7d')]+'/downloads?type=uniqueid&token='+md5(_0x294916['uniqueid']);}else{_0x294916[_0x9cba('0x7b')]='';}var _0x287918=_0x40bc3c[_0x9cba('0x76')]===_0x9cba('0x8c')?'eu':_0x9cba('0x7e');return getAccessToken(_0x40bc3c)[_0x9cba('0x20')](function(_0x5a157a){_0x3721b8=_0x5a157a;return getUser(_0x3721b8,_0x287918,_0x40bc3c);})[_0x9cba('0x20')](function(_0xd9d8e6){_0x2d866e=_0xd9d8e6;logger[_0x9cba('0x26')](_0x9cba('0x80'),_0x2d866e['id']);return getEndUser(_0x3721b8,_0x287918,_0x40bc3c,_0x294916[_0x9cba('0x81')],_0x294916[_0x9cba('0x82')],_0x2d866e,_0x7c6153);})[_0x9cba('0x20')](function(_0xa7f990){_0x4cd320=_0xa7f990;return getCall(_0x3721b8,_0x287918,_0x40bc3c,_0x2d866e,_0x4cd320,_0x7c6153,_0x294916,_0x9cba('0x83'));})[_0x9cba('0x20')](function(_0x5b89cc){if(_0x5b89cc){logger[_0x9cba('0x26')]('The\x20Call\x20ID\x20is:',_0x5b89cc['id']);}})[_0x9cba('0x24')](function(_0x43bc53){logger[_0x9cba('0x33')](_0x9cba('0x90'),JSON['stringify'](_0x43bc53));});}; \ No newline at end of file +var _0xa2a0=['lodash','request-promise','md5','util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','localhost','socket.io-emitter','redis','emit','debug','[HTTP]','stringify','length','forEach','string','idField','type','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','then','Failing\x20creating\x20the\x20access_token','stack','info','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','catch','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','startCase','Error:\x20','GET','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','administrator','Subject','getString','Subjects','Who_Id','Full_Name','First_Name','Last_Name','$se_module','Call_Duration','utc','talktime','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Call_Start_Time','outbound','agentcalledAt','merge','Fields','/crm/v2/Calls','Zoho-oauthtoken\x20','Call\x20created!','log','err','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','recordingURL','zoho.eu','destcalleridnum','[OUTBOUND]','[ABANDONED]'];(function(_0x1bde71,_0x274968){var _0x8a1b20=function(_0x1f5f37){while(--_0x1f5f37){_0x1bde71['push'](_0x1bde71['shift']());}};_0x8a1b20(++_0x274968);}(_0xa2a0,0x8d));var _0x0a2a=function(_0x4cab5d,_0x6b981e){_0x4cab5d=_0x4cab5d-0x0;var _0x2a7dc8=_0xa2a0[_0x4cab5d];return _0x2a7dc8;};'use strict';var _=require(_0x0a2a('0x0'));var rp=require(_0x0a2a('0x1'));var md5=require(_0x0a2a('0x2'));var util=require(_0x0a2a('0x3'));var intUtil=require('./util');var moment=require(_0x0a2a('0x4'));var Redis=require('ioredis');var BPromise=require(_0x0a2a('0x5'));var config=require(_0x0a2a('0x6'));var logger=require(_0x0a2a('0x7'))(_0x0a2a('0x8'));config['redis']=_[_0x0a2a('0x9')](config['redis'],{'host':_0x0a2a('0xa'),'port':0x18eb});var io=require(_0x0a2a('0xb'))(new Redis(config[_0x0a2a('0xc')]));function emit(_0x55707f,_0x193486,_0x320abf){io['to'](_0x55707f)[_0x0a2a('0xd')](_0x193486,_0x320abf);}function request(_0x4628e3){logger[_0x0a2a('0xe')](_0x0a2a('0xf'),JSON[_0x0a2a('0x10')](_0x4628e3));return rp(_0x4628e3);}function getCustomFields(_0x39487e,_0x188fae){var _0x564887={};if(_0x39487e[_0x0a2a('0x11')]>0x0){_[_0x0a2a('0x12')](_0x39487e,function(_0x3a3ac0){if(_0x3a3ac0['type']===_0x0a2a('0x13')&&_0x3a3ac0[_0x0a2a('0x14')]){_0x564887[_0x3a3ac0[_0x0a2a('0x14')]]=_0x3a3ac0['content']['toString']();}else if(_0x3a3ac0[_0x0a2a('0x15')]==='variable'&&_0x3a3ac0['variableName']&&_0x3a3ac0[_0x0a2a('0x14')]&&_0x188fae[_0x3a3ac0['variableName']]){_0x564887[_0x3a3ac0[_0x0a2a('0x14')]]=_0x188fae[_0x3a3ac0[_0x0a2a('0x16')]]['toString']();}else if(_0x3a3ac0[_0x0a2a('0x15')]===_0x0a2a('0x17')&&_0x3a3ac0[_0x0a2a('0x18')]&&_0x3a3ac0['Variable']['name']&&_0x3a3ac0[_0x0a2a('0x14')]&&_0x188fae[_0x3a3ac0['Variable'][_0x0a2a('0x19')][_0x0a2a('0x1a')]()]){_0x564887[_0x3a3ac0[_0x0a2a('0x14')]]=_0x188fae[_0x3a3ac0['Variable'][_0x0a2a('0x19')][_0x0a2a('0x1a')]()]['toString']();}});}return _0x564887;}function getName(_0x36b61a){if(_0x36b61a[_0x0a2a('0x1b')]('\x20')>0x0){var _0xa437ad=_0x36b61a[_0x0a2a('0x1c')](/ (.+)/);if(_0xa437ad[0x1]){return _0xa437ad;}}return[_0x36b61a,_0x36b61a];}var accountsTokens={};function getAccessToken(_0x59e047){return new Promise(function(_0x22ca53,_0x3ec76a){if(!_[_0x0a2a('0x1d')](accountsTokens[_0x59e047['id']])&&!_[_0x0a2a('0x1d')](accountsTokens[_0x59e047['id']]['access_token'])){if(moment()[_0x0a2a('0x1e')](accountsTokens[_0x59e047['id']][_0x0a2a('0x1f')])){_0x22ca53(accountsTokens[_0x59e047['id']][_0x0a2a('0x20')]);}}var _0x1c4864;switch(_0x59e047['zone']){case'US':_0x1c4864=_0x0a2a('0x21');break;case'AU':_0x1c4864='https://accounts.zoho.com.au';break;case'EU':_0x1c4864=_0x0a2a('0x22');break;case'IN':_0x1c4864='https://accounts.zoho.in';break;case'CN':_0x1c4864=_0x0a2a('0x23');break;default:_0x1c4864=_0x0a2a('0x22');break;}var _0x409f88={'method':_0x0a2a('0x24'),'uri':_0x1c4864+_0x0a2a('0x25'),'qs':{'refresh_token':_0x59e047[_0x0a2a('0x26')],'client_id':_0x59e047['clientId'],'client_secret':_0x59e047[_0x0a2a('0x27')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x409f88)[_0x0a2a('0x28')](function(_0x2208a2){accountsTokens[_0x59e047['id']]={'access_token':_0x2208a2[_0x0a2a('0x20')],'expires_in':moment()['add'](_0x2208a2['expires_in'],'seconds')};_0x22ca53(_0x2208a2[_0x0a2a('0x20')]);})['catch'](function(_0x4cb332){logger['error'](_0x0a2a('0x29'),_0x4cb332[_0x0a2a('0x2a')]);_0x3ec76a(_0x4cb332);});});}function getUser(_0x494804,_0x47b06c,_0x3715f9,_0x1202b6){logger[_0x0a2a('0x2b')]('Search\x20user');return request({'method':'GET','uri':util[_0x0a2a('0x2c')](_0x0a2a('0x2d'),_0x47b06c),'qs':{'type':_0x0a2a('0x2e')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x494804},'json':!![]})[_0x0a2a('0x28')](function(_0x325ebd){if(_0x325ebd[_0x0a2a('0x2f')]){var _0x9e0003=-0x1;if(_[_0x0a2a('0x30')](_0x325ebd['users'])){if(!_['isNil'](_0x1202b6)){_0x9e0003=_[_0x0a2a('0x31')](_0x325ebd[_0x0a2a('0x2f')],function(_0x483be8){return _0x483be8['email']===_0x1202b6;});}if(_0x9e0003>=0x0){logger[_0x0a2a('0x2b')](_0x0a2a('0x32'));}else{logger[_0x0a2a('0x2b')](_0x0a2a('0x33'));_0x9e0003=_[_0x0a2a('0x31')](_0x325ebd[_0x0a2a('0x2f')],function(_0x4ee528){return _0x4ee528[_0x0a2a('0x34')][_0x0a2a('0x19')]===_0x0a2a('0x35');});}return _0x325ebd[_0x0a2a('0x2f')][_0x9e0003];}else{if(_0x325ebd['user'][_0x0a2a('0x34')][_0x0a2a('0x19')]===_0x0a2a('0x35')){logger[_0x0a2a('0x2b')](_0x0a2a('0x33'));user=_0x325ebd[_0x0a2a('0x36')];return user;}else{logger[_0x0a2a('0x37')](_0x0a2a('0x38'),JSON[_0x0a2a('0x10')](_0x325ebd));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x0a2a('0x10')](_0x325ebd));}}}else{logger['error'](_0x0a2a('0x38'),JSON[_0x0a2a('0x10')](_0x325ebd));throw new Error(_0x0a2a('0x39')+JSON[_0x0a2a('0x10')](_0x325ebd));}})['catch'](function(_0x4274c6){console['error'](_0x4274c6);});}function getZohoUser(_0xd5db16,_0x213117){return new BPromise(function(_0x952e52,_0x4d42cd){request(_0xd5db16)[_0x0a2a('0x28')](function(_0x4f187d){var _0x59084e=null;if(_0x4f187d){_0x59084e=_0x4f187d[_0x0a2a('0x3a')][0x0];_0x59084e[_0x0a2a('0x3b')]=_0x213117;}_0x952e52(_0x59084e);})[_0x0a2a('0x3c')](function(_0x3eb157){_0x4d42cd(_0x3eb157);});});}function createEndUser(_0x1ab462,_0x54c0e5,_0x411ab7,_0x2d9ffc,_0x5f35bc,_0x482c42){var _0x411ab7=getName(_0x411ab7);return request({'method':_0x0a2a('0x24'),'uri':_0x0a2a('0x3d')+_0x54c0e5+_0x0a2a('0x3e')+_['startCase'](_0x482c42[_0x0a2a('0x3f')])+'s','body':{'data':[{'Last_Name':_0x411ab7[0x1],'First_Name':_0x411ab7[0x0],'Phone':_0x2d9ffc,'Owner':{'name':!_[_0x0a2a('0x1d')](_0x5f35bc[_0x0a2a('0x40')]['name'])?_0x5f35bc['role'][_0x0a2a('0x19')]:!_['isNil'](_0x5f35bc[_0x0a2a('0x41')])?_0x5f35bc['first_name']+'\x20'+_0x5f35bc['last_name']:_0x5f35bc[_0x0a2a('0x42')],'id':_0x5f35bc['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1ab462},'json':!![]})['then'](function(_0x336aec){if(_0x336aec&&_0x336aec[_0x0a2a('0x3a')][0x0][_0x0a2a('0x43')]===_0x0a2a('0x44')){var _0x4912fa=_0x336aec[_0x0a2a('0x3a')][0x0][_0x0a2a('0x45')];_0x4912fa[_0x0a2a('0x3b')]=_[_0x0a2a('0x46')](_0x482c42[_0x0a2a('0x3f')])+'s';return _0x4912fa;}logger[_0x0a2a('0x37')](_0x0a2a('0x38'),JSON[_0x0a2a('0x10')](data));throw new Error(_0x0a2a('0x47')+JSON[_0x0a2a('0x10')](data));})[_0x0a2a('0x3c')](function(_0x397f4a){console['log']('CREATE\x20ERROR',_0x397f4a);});}function getEndUser(_0x108497,_0x2e37a1,_0xec0d7e,_0x1d7f8d,_0x5aab34,_0x1b07c0,_0x49a89b){var _0x160378={'method':_0x0a2a('0x48'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x108497},'json':!![]};switch(_0x49a89b[_0x0a2a('0x49')]){case'contact_lead':_0x160378[_0x0a2a('0x4a')]=_0x0a2a('0x3d')+_0x2e37a1+_0x0a2a('0x4b')+_0x5aab34+'))';return getZohoUser(_0x160378,_0x0a2a('0x4c'))[_0x0a2a('0x28')](function(_0x23d660){if(_0x23d660)return _0x23d660;_0x160378['uri']=_0x0a2a('0x3d')+_0x2e37a1+_0x0a2a('0x4d')+_0x5aab34+'))';return getZohoUser(_0x160378,_0x0a2a('0x4e'))['then'](function(_0x25541d){if(_0x25541d)return _0x25541d;if(_0x49a89b[_0x0a2a('0x3f')]!=_0x0a2a('0x4f')){return createEndUser(_0x108497,_0x2e37a1,_0x1d7f8d,_0x5aab34,_0x1b07c0,_0x49a89b);}else{return{};}});});break;case'contact':_0x160378[_0x0a2a('0x4a')]=_0x0a2a('0x3d')+_0x2e37a1+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x5aab34+'))';return getZohoUser(_0x160378,_0x0a2a('0x4c'))[_0x0a2a('0x28')](function(_0xd769dc){if(_0xd769dc)return _0xd769dc;if(_0x49a89b[_0x0a2a('0x3f')]!=_0x0a2a('0x4f')){return createEndUser(_0x108497,_0x2e37a1,_0x1d7f8d,_0x5aab34,_0x1b07c0,_0x49a89b);}else{return{};}});break;case _0x0a2a('0x50'):_0x160378[_0x0a2a('0x4a')]=_0x0a2a('0x3d')+_0x2e37a1+_0x0a2a('0x4d')+_0x5aab34+'))';return getZohoUser(_0x160378,'Leads')[_0x0a2a('0x28')](function(_0x4b4c0b){if(_0x4b4c0b)return _0x4b4c0b;if(_0x49a89b[_0x0a2a('0x3f')]!='nothing'){return createEndUser(_0x108497,_0x2e37a1,_0x1d7f8d,_0x5aab34,_0x1b07c0,_0x49a89b);}else{return{};}});break;}}function getCall(_0x345255,_0x36813e,_0x58c3ee,_0x9043e3,_0x251623,_0x51a858,_0x86185d,_0x241707){logger[_0x0a2a('0x2b')]('Creating\x20new\x20call...');var _0x484365={};_0x484365['Owner']={'name':!_[_0x0a2a('0x1d')](_0x9043e3[_0x0a2a('0x40')]['name'])&&!_[_0x0a2a('0x1d')](_0x9043e3[_0x0a2a('0x34')]['name'])&&_0x9043e3[_0x0a2a('0x34')][_0x0a2a('0x19')]===_0x0a2a('0x51')?_0x9043e3[_0x0a2a('0x40')][_0x0a2a('0x19')]:!_[_0x0a2a('0x1d')](_0x9043e3[_0x0a2a('0x41')])?_0x9043e3[_0x0a2a('0x41')]+'\x20'+_0x9043e3[_0x0a2a('0x42')]:_0x9043e3[_0x0a2a('0x42')],'id':_0x9043e3['id']};_0x484365[_0x0a2a('0x52')]=intUtil[_0x0a2a('0x53')](_0x51a858[_0x0a2a('0x54')],_0x86185d,'\x20');_0x484365['Description']=intUtil[_0x0a2a('0x53')](_0x51a858['Descriptions'],_0x86185d,'\x0a');if(_0x251623[_0x0a2a('0x3b')]==='Contacts'){_0x484365[_0x0a2a('0x55')]={'name':!_[_0x0a2a('0x1d')](_0x251623[_0x0a2a('0x56')])?_0x251623[_0x0a2a('0x56')]:!_['isNil'](_0x251623[_0x0a2a('0x57')])?_0x251623[_0x0a2a('0x57')]+'\x20'+_0x251623[_0x0a2a('0x58')]:_0x251623['Last_Name'],'id':_0x251623['id']};}if(_0x251623['enduserType']==='Leads'){_0x484365['What_Id']={'name':!_[_0x0a2a('0x1d')](_0x251623[_0x0a2a('0x56')])?_0x251623[_0x0a2a('0x56')]:!_['isNil'](_0x251623[_0x0a2a('0x57')])?_0x251623['First_Name']+'\x20'+_0x251623[_0x0a2a('0x58')]:_0x251623[_0x0a2a('0x58')],'id':_0x251623['id']};_0x484365[_0x0a2a('0x59')]=_['startCase'](_0x251623['enduserType']);}if(_0x86185d['talktime']){_0x484365[_0x0a2a('0x5a')]=moment[_0x0a2a('0x5b')](parseInt(_0x86185d[_0x0a2a('0x5c')])*0x3e8)[_0x0a2a('0x2c')](_0x0a2a('0x5d'));}else if(_0x86185d['answertime']&&_0x86185d[_0x0a2a('0x5e')]){_0x484365[_0x0a2a('0x5a')]=moment[_0x0a2a('0x5b')](moment(_0x86185d[_0x0a2a('0x5e')],_0x0a2a('0x5f'))[_0x0a2a('0x60')](moment(_0x86185d[_0x0a2a('0x61')],_0x0a2a('0x5f'))))['format'](_0x0a2a('0x5d'));}switch(_0x86185d[_0x0a2a('0x62')]){case _0x0a2a('0x63'):_0x484365[_0x0a2a('0x64')]='Called';break;case _0x0a2a('0x65'):case _0x0a2a('0x66'):_0x484365[_0x0a2a('0x64')]=_0x0a2a('0x67');break;case _0x0a2a('0x68'):_0x484365[_0x0a2a('0x64')]=_0x0a2a('0x69');break;case _0x0a2a('0x6a'):_0x484365['Call_Result']='Abandoned';break;default:}_0x484365[_0x0a2a('0x6b')]=(_0x241707===_0x0a2a('0x6c')?moment(_0x86185d[_0x0a2a('0x61')])[_0x0a2a('0x2c')](_0x0a2a('0x5f')):moment(_0x86185d[_0x0a2a('0x6d')])[_0x0a2a('0x2c')](_0x0a2a('0x5f')))||moment()[_0x0a2a('0x2c')](_0x0a2a('0x5f'));_0x484365['Call_Type']=_0x241707||'Inbound';_0x484365=_[_0x0a2a('0x6e')](_0x484365,getCustomFields(_0x51a858[_0x0a2a('0x6f')],_0x86185d));return request({'method':_0x0a2a('0x24'),'uri':'https://www.zohoapis.'+_0x36813e+_0x0a2a('0x70'),'headers':{'Authorization':_0x0a2a('0x71')+_0x345255},'body':{'data':[_0x484365]},'json':!![]})['then'](function(_0x39524d){if(_0x39524d&&_0x39524d['data'][0x0][_0x0a2a('0x43')]===_0x0a2a('0x44')){logger[_0x0a2a('0x2b')](_0x0a2a('0x72'));return{'id':_0x39524d[_0x0a2a('0x3a')][0x0][_0x0a2a('0x45')]['id']};}})[_0x0a2a('0x3c')](function(_0x494121){logger[_0x0a2a('0x2b')]('err',_0x494121[_0x0a2a('0x2a')]);console[_0x0a2a('0x73')](_0x0a2a('0x74'),_0x494121);});}exports['queue']=function(_0x58dd00,_0x242837,_0xa82289,_0x9873cd,_0x402552,_0x32684a){var _0x2f0d8a,_0x472e27,_0x13db9a;_0x32684a[_0x0a2a('0x75')]=intUtil['stripTrailingSlash'](_0x32684a[_0x0a2a('0x75')]);_0x32684a[_0x0a2a('0x76')]=intUtil['stripTrailingSlash'](_0x32684a[_0x0a2a('0x76')]);if(_0x402552&&_0x402552['monitor_format']){logger[_0x0a2a('0x2b')](_0x0a2a('0x77'),_0x0a2a('0x78'));_0x242837['recordingURL']=_0x32684a['serverUrl']+_0x0a2a('0x79')+_0x242837[_0x0a2a('0x7a')]+_0x0a2a('0x7b')+md5(_0x242837[_0x0a2a('0x7a')]);}else{_0x242837['recordingURL']='';}var _0x56736e=_0x32684a[_0x0a2a('0x75')]==='zoho.eu'?'eu':_0x0a2a('0x7c');return getAccessToken(_0x32684a)[_0x0a2a('0x28')](function(_0x172257){_0x13db9a=_0x172257;return getUser(_0x13db9a,_0x56736e,_0x32684a,_0x9873cd[_0x0a2a('0x7d')]);})[_0x0a2a('0x28')](function(_0x4e2550){_0x2f0d8a=_0x4e2550;logger[_0x0a2a('0x2b')](_0x0a2a('0x7e'),_0x2f0d8a['id']);return getEndUser(_0x13db9a,_0x56736e,_0x32684a,_0x242837[_0x0a2a('0x7f')],_0x242837[_0x0a2a('0x80')],_0x2f0d8a,_0xa82289);})[_0x0a2a('0x28')](function(_0x20dbbe){_0x472e27=_0x20dbbe;return getCall(_0x13db9a,_0x56736e,_0x32684a,_0x2f0d8a,_0x472e27,_0xa82289,_0x242837,_0x0a2a('0x81'));})['then'](function(_0x1f0cf0){if(_0x1f0cf0){logger[_0x0a2a('0x2b')](_0x0a2a('0x82'),_0x1f0cf0['id']);logger['info']('[QUEUE]',_0x0a2a('0x83'));emit(util[_0x0a2a('0x2c')]('user:%s',_0x9873cd['name']),_0x0a2a('0x84'),{'uri':'https://crm.'+_0x32684a['host']+_0x0a2a('0x85')+_0x1f0cf0['id']});}})[_0x0a2a('0x3c')](function(_0x2f933e){logger[_0x0a2a('0x37')](_0x0a2a('0x77'),JSON['stringify'](_0x2f933e));});};exports[_0x0a2a('0x6c')]=function(_0x26add0,_0x5f1492,_0x297605,_0x134495,_0x79981a,_0x3f8a72,_0xc25a42){var _0x30ea7b,_0x3b3c5a,_0x2d7e37;_0x3f8a72[_0x0a2a('0x75')]=intUtil[_0x0a2a('0x86')](_0x3f8a72['host']);_0x3f8a72['serverUrl']=intUtil[_0x0a2a('0x86')](_0x3f8a72['serverUrl']);if(_0xc25a42&&_0xc25a42[_0x0a2a('0x87')]&&_0xc25a42[_0x0a2a('0x87')]!=='none'){logger['info']('[OUTBOUND]',_0x0a2a('0x78'));_0x5f1492[_0x0a2a('0x88')]=_0x3f8a72[_0x0a2a('0x76')]+_0x0a2a('0x79')+_0x5f1492[_0x0a2a('0x7a')]+_0x0a2a('0x7b')+md5(_0x5f1492['uniqueid']);}var _0x45de49=_0x3f8a72[_0x0a2a('0x75')]===_0x0a2a('0x89')?'eu':_0x0a2a('0x7c');return getAccessToken(_0x3f8a72)[_0x0a2a('0x28')](function(_0x33da2d){_0x2d7e37=_0x33da2d;return getUser(_0x2d7e37,_0x45de49,_0x3f8a72,_0x134495[_0x0a2a('0x7d')]);})[_0x0a2a('0x28')](function(_0xb6fee){_0x30ea7b=_0xb6fee;logger['info']('The\x20User\x20ID\x20is:',_0x30ea7b['id']);return getEndUser(_0x2d7e37,_0x45de49,_0x3f8a72,_0x5f1492['destcalleridname'],_0x5f1492[_0x0a2a('0x8a')],_0x30ea7b,_0x297605);})[_0x0a2a('0x28')](function(_0x1f51a5){_0x3b3c5a=_0x1f51a5;return getCall(_0x2d7e37,_0x45de49,_0x3f8a72,_0x30ea7b,_0x3b3c5a,_0x297605,_0x5f1492,'Outbound');})[_0x0a2a('0x28')](function(_0x784d64){if(_0x784d64){logger[_0x0a2a('0x2b')](_0x0a2a('0x82'),_0x784d64['id']);logger[_0x0a2a('0x2b')](_0x0a2a('0x8b'),_0x0a2a('0x83'));emit(util[_0x0a2a('0x2c')]('user:%s',_0x134495['name']),_0x0a2a('0x84'),{'uri':'https://crm.'+_0x3f8a72[_0x0a2a('0x75')]+_0x0a2a('0x85')+_0x784d64['id']});}})[_0x0a2a('0x3c')](function(_0x47953a){logger[_0x0a2a('0x37')](_0x0a2a('0x8b'),JSON[_0x0a2a('0x10')](_0x47953a));});};exports[_0x0a2a('0x6a')]=function(_0x12c7d2,_0x5de4ab,_0x301bac,_0x136789,_0x1144d5,_0x4f6812){var _0x5bda93,_0x53b491,_0xef2709;_0x4f6812[_0x0a2a('0x75')]=intUtil[_0x0a2a('0x86')](_0x4f6812[_0x0a2a('0x75')]);_0x4f6812[_0x0a2a('0x76')]=intUtil[_0x0a2a('0x86')](_0x4f6812[_0x0a2a('0x76')]);if(_0x1144d5&&_0x1144d5['monitor_format']){logger[_0x0a2a('0x2b')](_0x0a2a('0x8c'),_0x0a2a('0x78'));_0x5de4ab[_0x0a2a('0x88')]=_0x4f6812[_0x0a2a('0x76')]+'/api/voice/recordings/'+_0x5de4ab[_0x0a2a('0x7a')]+'/downloads?type=uniqueid&token='+md5(_0x5de4ab[_0x0a2a('0x7a')]);}else{_0x5de4ab[_0x0a2a('0x88')]='';}var _0x1fd7fa=_0x4f6812['host']===_0x0a2a('0x89')?'eu':_0x0a2a('0x7c');return getAccessToken(_0x4f6812)[_0x0a2a('0x28')](function(_0x1d44e8){_0xef2709=_0x1d44e8;return getUser(_0xef2709,_0x1fd7fa,_0x4f6812);})[_0x0a2a('0x28')](function(_0x5d6f45){_0x5bda93=_0x5d6f45;logger[_0x0a2a('0x2b')](_0x0a2a('0x7e'),_0x5bda93['id']);return getEndUser(_0xef2709,_0x1fd7fa,_0x4f6812,_0x5de4ab[_0x0a2a('0x7f')],_0x5de4ab['calleridnum'],_0x5bda93,_0x301bac);})[_0x0a2a('0x28')](function(_0x1c509a){_0x53b491=_0x1c509a;return getCall(_0xef2709,_0x1fd7fa,_0x4f6812,_0x5bda93,_0x53b491,_0x301bac,_0x5de4ab,_0x0a2a('0x81'));})[_0x0a2a('0x28')](function(_0x1accdf){if(_0x1accdf){logger[_0x0a2a('0x2b')]('The\x20Call\x20ID\x20is:',_0x1accdf['id']);}})[_0x0a2a('0x3c')](function(_0xfdf9be){logger[_0x0a2a('0x37')]('[ABANDONED]',JSON['stringify'](_0xfdf9be));});}; \ 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 1183f46..3060681 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(_0x5e2d0b,_0x45a05c){var _0x51ea95=function(_0x986aae){while(--_0x986aae){_0x5e2d0b['push'](_0x5e2d0b['shift']());}};_0x51ea95(++_0x45a05c);}(_0x7a54,0x106));var _0x47a5=function(_0x5f29f0,_0x4143e0){_0x5f29f0=_0x5f29f0-0x0;var _0x2fb678=_0x7a54[_0x5f29f0];return _0x2fb678;};'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(_0x1cf25e,_0x27a307){var _0x3e7d2a=function(_0x4f7a9f){while(--_0x4f7a9f){_0x1cf25e['push'](_0x1cf25e['shift']());}};_0x3e7d2a(++_0x27a307);}(_0x7a54,0x106));var _0x47a5=function(_0x469029,_0x23fd02){_0x469029=_0x469029-0x0;var _0x8070b7=_0x7a54[_0x469029];return _0x8070b7;};'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 22279ee..0bda3fd 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x50c20b,_0x51d72a){var _0x280ea3=function(_0x20fa5d){while(--_0x20fa5d){_0x50c20b['push'](_0x50c20b['shift']());}};_0x280ea3(++_0x51d72a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x22f9b3,_0x321301){_0x22f9b3=_0x22f9b3-0x0;var _0x244936=_0x5f2f[_0x22f9b3];return _0x244936;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x5c42e4,_0xa2c5e9){var _0x1cdfc5=function(_0x295111){while(--_0x295111){_0x5c42e4['push'](_0x5c42e4['shift']());}};_0x1cdfc5(++_0xa2c5e9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x35282c,_0x7eba5e){_0x35282c=_0x35282c-0x0;var _0x267b6d=_0x5f2f[_0x35282c];return _0x267b6d;};'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 a540f5f..bbbec53 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 _0x7f90=['error','message','result','rpc','jayson/promise','bluebird','../../config/logger','routing','client','request','then','debug'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7f90,0xf4));var _0x07f9=function(_0x19c883,_0x2098c7){_0x19c883=_0x19c883-0x0;var _0x202144=_0x7f90[_0x19c883];return _0x202144;};'use strict';var jayson=require(_0x07f9('0x0'));var BPromise=require(_0x07f9('0x1'));var logger=require(_0x07f9('0x2'))(_0x07f9('0x3'));var client=jayson[_0x07f9('0x4')]['http']({'port':0x2329});client['Request']=function(_0x15b548,_0x132ae4){return new BPromise(function(_0x574e7d,_0x36a0f1){return client[_0x07f9('0x5')](_0x15b548,_0x132ae4)[_0x07f9('0x6')](function(_0x449544){logger[_0x07f9('0x7')]('rpc','routing',_0x15b548,_0x132ae4,_0x449544);if(_0x449544[_0x07f9('0x8')]){logger[_0x07f9('0x8')]('rpc',_0x07f9('0x3'),_0x15b548,_0x449544['error'][_0x07f9('0x9')],_0x132ae4);return _0x36a0f1(_0x449544[_0x07f9('0x8')][_0x07f9('0x9')]);}else{return _0x574e7d(_0x449544[_0x07f9('0xa')]);}})['catch'](function(_0x45e27){logger[_0x07f9('0x8')](_0x07f9('0xb'),_0x07f9('0x3'),_0x15b548,_0x45e27,_0x132ae4);return _0x36a0f1(_0x45e27);});});};module['exports']=client; \ No newline at end of file +var _0x432b=['rpc','error','message','result','catch','jayson/promise','../../config/logger','routing','client','http','then','debug'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0xb432('0x0'));var BPromise=require('bluebird');var logger=require(_0xb432('0x1'))(_0xb432('0x2'));var client=jayson[_0xb432('0x3')][_0xb432('0x4')]({'port':0x2329});client['Request']=function(_0x525deb,_0x93e722){return new BPromise(function(_0x4cefc4,_0x4541d3){return client['request'](_0x525deb,_0x93e722)[_0xb432('0x5')](function(_0x3f1a78){logger[_0xb432('0x6')](_0xb432('0x7'),_0xb432('0x2'),_0x525deb,_0x93e722,_0x3f1a78);if(_0x3f1a78[_0xb432('0x8')]){logger[_0xb432('0x8')](_0xb432('0x7'),'routing',_0x525deb,_0x3f1a78[_0xb432('0x8')][_0xb432('0x9')],_0x93e722);return _0x4541d3(_0x3f1a78[_0xb432('0x8')][_0xb432('0x9')]);}else{return _0x4cefc4(_0x3f1a78[_0xb432('0xa')]);}})[_0xb432('0xb')](function(_0x5d0d3b){logger['error'](_0xb432('0x7'),_0xb432('0x2'),_0x525deb,_0x5d0d3b,_0x93e722);return _0x4541d3(_0x5d0d3b);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 31d0195..da59355 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 _0x510e=['mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh'];(function(_0x54a573,_0x49c04d){var _0x2c45a9=function(_0x3c51c5){while(--_0x3c51c5){_0x54a573['push'](_0x54a573['shift']());}};_0x2c45a9(++_0x49c04d);}(_0x510e,0x1ed));var _0xe510=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x510e[_0xc8a931];return _0x28bd27;};'use strict';var BPromise=require(_0xe510('0x0'));var server=require(_0xe510('0x1'));var Realtime=require(_0xe510('0x2'));var EmailChannel=require(_0xe510('0x3'));var mailAccount=require(_0xe510('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xe510('0x5'))['db'];function initRealtime(){return BPromise[_0xe510('0x6')]()[_0xe510('0x7')](mailAccount[_0xe510('0x8')]())['then'](realtime[_0xe510('0x9')]())[_0xe510('0x7')](function(){email[_0xe510('0xa')](realtime[_0xe510('0xb')]);return realtime;});}function main(){return server[_0xe510('0xc')](realtime,email)[_0xe510('0x7')](function(_0x27ca15){return initRealtime();})[_0xe510('0x7')](function(_0x2f5db7){return db[_0xe510('0xd')][_0xe510('0xe')]({'attributes':['id',_0xe510('0xf')],'raw':!![]});})[_0xe510('0x7')](function(_0x149f35){return setInterval(initRealtime,_0x149f35['loginMailFrequency']*0x3e8);})[_0xe510('0x10')](function(_0x34ee7d){console[_0xe510('0x11')](_0x34ee7d);});}main(); \ No newline at end of file +var _0x37c5=['loginMailFrequency','catch','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x37c5,0xa7));var _0x537c=function(_0x2ef055,_0x59b6e9){_0x2ef055=_0x2ef055-0x0;var _0x1b54cd=_0x37c5[_0x2ef055];return _0x1b54cd;};'use strict';var BPromise=require('bluebird');var server=require(_0x537c('0x0'));var Realtime=require(_0x537c('0x1'));var EmailChannel=require(_0x537c('0x2'));var mailAccount=require(_0x537c('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x537c('0x4'))['db'];function initRealtime(){return BPromise[_0x537c('0x5')]()[_0x537c('0x6')](mailAccount[_0x537c('0x7')]())[_0x537c('0x6')](realtime[_0x537c('0x8')]())['then'](function(){email[_0x537c('0x9')](realtime[_0x537c('0xa')]);return realtime;});}function main(){return server[_0x537c('0xb')](realtime,email)['then'](function(_0x36bf4a){return initRealtime();})[_0x537c('0x6')](function(_0x32b9c7){return db[_0x537c('0xc')]['findOne']({'attributes':['id',_0x537c('0xd')],'raw':!![]});})[_0x537c('0x6')](function(_0x29c294){return setInterval(initRealtime,_0x29c294['loginMailFrequency']*0x3e8);})[_0x537c('0xe')](function(_0x48fdeb){console['log'](_0x48fdeb);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 06bf4b5..ce5f54e 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 _0x3c71=['Imap','status','messageStatus','total','isNil','md5','mailAccount:update','refresh','hasOwnProperty','handleImapBox','bind','end','error','handleImapError','disabled','connected','messages','prototype','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','lastSync','send','verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','ioredis','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','active'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x3c71,0x195));var _0x13c7=function(_0x275256,_0x5c5597){_0x275256=_0x275256-0x0;var _0x571ba8=_0x3c71[_0x275256];return _0x571ba8;};'use strict';var _=require(_0x13c7('0x0'));var moment=require(_0x13c7('0x1'));var BPromise=require(_0x13c7('0x2'));var md5=require('md5');var Redis=require(_0x13c7('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x13c7('0x4'));config[_0x13c7('0x5')]=_[_0x13c7('0x6')](config[_0x13c7('0x5')],{'host':_0x13c7('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x13c7('0x5')]));var EmailImap=require(_0x13c7('0x8'));var EmailSmtp=require(_0x13c7('0x9'));var mailAccount=require(_0x13c7('0xa'));var md5Accounts={};function EmailChannel(_0x357f7a){logger[_0x13c7('0xb')](_0x13c7('0xc'));this['mailAccounts']=_0x357f7a[_0x13c7('0xd')];this[_0x13c7('0xe')]={};this[_0x13c7('0xf')]=new EmailSmtp();}EmailChannel['prototype'][_0x13c7('0x10')]=function(_0x100edc){var _0x17af2b=this['mailAccounts'][_0x100edc];var _0x39debe={'id':_0x17af2b['id'],'name':_0x17af2b[_0x13c7('0x11')],'key':_0x17af2b['key'],'active':_0x17af2b[_0x13c7('0x12')],'Imap':{'status':_0x17af2b[_0x13c7('0x13')][_0x13c7('0x14')],'messageStatus':_0x17af2b[_0x13c7('0x13')][_0x13c7('0x15')],'total':_0x17af2b[_0x13c7('0x13')][_0x13c7('0x16')]}};if(_[_0x13c7('0x17')](md5Accounts[_0x100edc])){md5Accounts[_0x100edc]={};}var _0x1259ff=md5(JSON['stringify'](_0x39debe));if(md5Accounts[_0x100edc]['md5']!==_0x1259ff){md5Accounts[_0x100edc][_0x13c7('0x18')]=_0x1259ff;io[_0x13c7('0x10')](_0x13c7('0x19'),_0x39debe);}};EmailChannel['prototype'][_0x13c7('0x1a')]=function(_0x352fe9){for(var _0x4dbc2f in _0x352fe9){if(_0x352fe9['hasOwnProperty'](_0x4dbc2f)){if(_0x352fe9[_0x4dbc2f][_0x13c7('0x13')]&&_0x352fe9[_0x4dbc2f][_0x13c7('0x12')]){var _0x1ca8c8=_0x352fe9[_0x4dbc2f][_0x13c7('0x13')];if(!this[_0x13c7('0xe')][_0x13c7('0x1b')](_0x1ca8c8['id'])){this[_0x13c7('0xe')][_0x1ca8c8['id']]=new EmailImap(_0x1ca8c8,_0x352fe9[_0x4dbc2f][_0x13c7('0x4')]);this['imapAccounts'][_0x1ca8c8['id']]['on']('box',this[_0x13c7('0x1c')][_0x13c7('0x1d')](this,_0x4dbc2f));this[_0x13c7('0xe')][_0x1ca8c8['id']]['on']('email',this['handleImapEmail'][_0x13c7('0x1d')](this,_0x4dbc2f));this[_0x13c7('0xe')][_0x1ca8c8['id']]['on'](_0x13c7('0x1e'),this['handleImapEnd']['bind'](this,_0x4dbc2f));this[_0x13c7('0xe')][_0x1ca8c8['id']]['on'](_0x13c7('0x1f'),this[_0x13c7('0x20')][_0x13c7('0x1d')](this,_0x4dbc2f));}}else{if(_[_0x13c7('0x17')](this[_0x13c7('0xd')][_0x4dbc2f]['Imap'])){this[_0x13c7('0xd')][_0x4dbc2f][_0x13c7('0x13')]={};}this['mailAccounts'][_0x4dbc2f][_0x13c7('0x13')][_0x13c7('0x14')]=_0x13c7('0x21');this[_0x13c7('0xd')][_0x4dbc2f][_0x13c7('0x13')]['messageStatus']='';this[_0x13c7('0x10')](_0x4dbc2f);}}}};EmailChannel['prototype'][_0x13c7('0x1c')]=function(_0x1087a9,_0x20a392){if(this[_0x13c7('0xd')][_0x1087a9]){this['mailAccounts'][_0x1087a9][_0x13c7('0x13')]['status']=_0x13c7('0x22');this['mailAccounts'][_0x1087a9][_0x13c7('0x13')][_0x13c7('0x15')]=_0x20a392[_0x13c7('0x11')];if(_0x20a392[_0x13c7('0x23')]){this[_0x13c7('0xd')][_0x1087a9]['Imap'][_0x13c7('0x16')]=_0x20a392[_0x13c7('0x23')][_0x13c7('0x16')];}return this['emit'](_0x1087a9);}};EmailChannel[_0x13c7('0x24')][_0x13c7('0x25')]=function(_0x5e68fa,_0x52a40e){logger['info'](_0x13c7('0x26'),_0x52a40e[_0x13c7('0x27')],_0x52a40e['lastName'],_0x52a40e[_0x13c7('0x28')],_0x5e68fa);if(this[_0x13c7('0xd')][_0x5e68fa]){return mailAccount[_0x13c7('0x29')](_0x5e68fa,_0x52a40e)[_0x13c7('0x2a')](function(_0x4f3ee7){if(_0x4f3ee7){logger['info'](_0x13c7('0x2b'));}})['catch'](function(_0x2864bd){logger[_0x13c7('0x1f')](_0x13c7('0x2c'),JSON[_0x13c7('0x2d')](_0x2864bd));});}};EmailChannel[_0x13c7('0x24')][_0x13c7('0x2e')]=function(_0x3075d2){if(this[_0x13c7('0xd')][_0x3075d2]&&this['mailAccounts'][_0x3075d2][_0x13c7('0x13')]){if(this['imapAccounts'][this[_0x13c7('0xd')][_0x3075d2][_0x13c7('0x13')]['id']]){delete this[_0x13c7('0xe')][this[_0x13c7('0xd')][_0x3075d2][_0x13c7('0x13')]['id']];}this[_0x13c7('0xd')][_0x3075d2][_0x13c7('0x13')][_0x13c7('0x2f')]=moment();this[_0x13c7('0x10')](_0x3075d2);}};EmailChannel[_0x13c7('0x24')]['handleImapError']=function(_0x510382,_0x36cf9e){if(this['mailAccounts'][_0x510382]){this['mailAccounts'][_0x510382]['Imap'][_0x13c7('0x14')]=_0x13c7('0x1f');this[_0x13c7('0xd')][_0x510382][_0x13c7('0x13')][_0x13c7('0x15')]=_0x36cf9e;return this[_0x13c7('0x10')](_0x510382);}};EmailChannel[_0x13c7('0x24')]['sendMail']=function(_0x1094b2,_0x41f8e0){return this[_0x13c7('0xf')][_0x13c7('0x30')](_0x1094b2,_0x41f8e0);};EmailChannel[_0x13c7('0x24')][_0x13c7('0x31')]=function(_0x3b08d8){var _0x48fb98=this;if(this[_0x13c7('0xd')][_0x3b08d8['id']]){if(_['isNil'](this['mailAccounts'][_0x3b08d8['id']][_0x13c7('0x32')])){this[_0x13c7('0xd')][_0x3b08d8['id']][_0x13c7('0x32')]={};}this['mailAccounts'][_0x3b08d8['id']][_0x13c7('0x32')][_0x13c7('0x2f')]=moment();return new BPromise(function(_0x48d8c9,_0x43a94d){return _0x48fb98[_0x13c7('0xf')][_0x13c7('0x33')](_0x3b08d8)[_0x13c7('0x2a')](function(_0x36a785){_0x48fb98[_0x13c7('0xd')][_0x3b08d8['id']]['Smtp']['status']='verified';_0x48fb98['mailAccounts'][_0x3b08d8['id']][_0x13c7('0x32')][_0x13c7('0x15')]='';_0x48fb98[_0x13c7('0x10')](_0x3b08d8['id']);_0x48d8c9(_0x36a785);})['catch'](function(_0x247faa){_0x48fb98['mailAccounts'][_0x3b08d8['id']][_0x13c7('0x32')][_0x13c7('0x14')]=_0x13c7('0x1f');_0x48fb98['mailAccounts'][_0x3b08d8['id']][_0x13c7('0x32')][_0x13c7('0x15')]=_0x247faa;_0x48fb98[_0x13c7('0x10')](_0x3b08d8['id']);_0x43a94d(_0x247faa);});});}return this[_0x13c7('0xf')][_0x13c7('0x33')](_0x3b08d8);};module[_0x13c7('0x34')]=EmailChannel; \ No newline at end of file +var _0x4bf1=['prototype','emit','name','key','active','Imap','status','total','stringify','md5','mailAccount:update','hasOwnProperty','box','end','handleImapEnd','bind','error','handleImapError','isNil','disabled','messageStatus','handleImapBox','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','send','Smtp','lastSync','smtp','verify','verified','moment','ioredis','../../../config/environment','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x4bf1,0x1e7));var _0x14bf=function(_0x37d80d,_0x3209c3){_0x37d80d=_0x37d80d-0x0;var _0x2d508c=_0x4bf1[_0x37d80d];return _0x2d508c;};'use strict';var _=require('lodash');var moment=require(_0x14bf('0x0'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0x14bf('0x1'));var config=require(_0x14bf('0x2'));var logger=require('../../../config/logger')(_0x14bf('0x3'));config[_0x14bf('0x4')]=_[_0x14bf('0x5')](config[_0x14bf('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x14bf('0x6'))(new Redis(config[_0x14bf('0x4')]));var EmailImap=require(_0x14bf('0x7'));var EmailSmtp=require(_0x14bf('0x8'));var mailAccount=require(_0x14bf('0x9'));var md5Accounts={};function EmailChannel(_0x44f01c){logger[_0x14bf('0xa')]('start\x20email\x20channel');this[_0x14bf('0xb')]=_0x44f01c['mailAccounts'];this[_0x14bf('0xc')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x14bf('0xd')][_0x14bf('0xe')]=function(_0x454396){var _0x26028a=this[_0x14bf('0xb')][_0x454396];var _0x4f0d99={'id':_0x26028a['id'],'name':_0x26028a[_0x14bf('0xf')],'key':_0x26028a[_0x14bf('0x10')],'active':_0x26028a[_0x14bf('0x11')],'Imap':{'status':_0x26028a[_0x14bf('0x12')][_0x14bf('0x13')],'messageStatus':_0x26028a[_0x14bf('0x12')]['messageStatus'],'total':_0x26028a['Imap'][_0x14bf('0x14')]}};if(_['isNil'](md5Accounts[_0x454396])){md5Accounts[_0x454396]={};}var _0x493eb1=md5(JSON[_0x14bf('0x15')](_0x4f0d99));if(md5Accounts[_0x454396][_0x14bf('0x16')]!==_0x493eb1){md5Accounts[_0x454396][_0x14bf('0x16')]=_0x493eb1;io['emit'](_0x14bf('0x17'),_0x4f0d99);}};EmailChannel[_0x14bf('0xd')]['refresh']=function(_0x2482eb){for(var _0x35f356 in _0x2482eb){if(_0x2482eb['hasOwnProperty'](_0x35f356)){if(_0x2482eb[_0x35f356][_0x14bf('0x12')]&&_0x2482eb[_0x35f356][_0x14bf('0x11')]){var _0x4fdf6c=_0x2482eb[_0x35f356][_0x14bf('0x12')];if(!this['imapAccounts'][_0x14bf('0x18')](_0x4fdf6c['id'])){this['imapAccounts'][_0x4fdf6c['id']]=new EmailImap(_0x4fdf6c,_0x2482eb[_0x35f356][_0x14bf('0x3')]);this['imapAccounts'][_0x4fdf6c['id']]['on'](_0x14bf('0x19'),this['handleImapBox']['bind'](this,_0x35f356));this['imapAccounts'][_0x4fdf6c['id']]['on'](_0x14bf('0x3'),this['handleImapEmail']['bind'](this,_0x35f356));this['imapAccounts'][_0x4fdf6c['id']]['on'](_0x14bf('0x1a'),this[_0x14bf('0x1b')][_0x14bf('0x1c')](this,_0x35f356));this[_0x14bf('0xc')][_0x4fdf6c['id']]['on'](_0x14bf('0x1d'),this[_0x14bf('0x1e')][_0x14bf('0x1c')](this,_0x35f356));}}else{if(_[_0x14bf('0x1f')](this[_0x14bf('0xb')][_0x35f356][_0x14bf('0x12')])){this['mailAccounts'][_0x35f356][_0x14bf('0x12')]={};}this[_0x14bf('0xb')][_0x35f356][_0x14bf('0x12')][_0x14bf('0x13')]=_0x14bf('0x20');this[_0x14bf('0xb')][_0x35f356][_0x14bf('0x12')][_0x14bf('0x21')]='';this['emit'](_0x35f356);}}}};EmailChannel[_0x14bf('0xd')][_0x14bf('0x22')]=function(_0x5b8540,_0x26a0ed){if(this[_0x14bf('0xb')][_0x5b8540]){this[_0x14bf('0xb')][_0x5b8540][_0x14bf('0x12')][_0x14bf('0x13')]=_0x14bf('0x23');this[_0x14bf('0xb')][_0x5b8540][_0x14bf('0x12')][_0x14bf('0x21')]=_0x26a0ed['name'];if(_0x26a0ed[_0x14bf('0x24')]){this['mailAccounts'][_0x5b8540][_0x14bf('0x12')]['total']=_0x26a0ed[_0x14bf('0x24')][_0x14bf('0x14')];}return this[_0x14bf('0xe')](_0x5b8540);}};EmailChannel[_0x14bf('0xd')][_0x14bf('0x25')]=function(_0x4d0808,_0x9570a6){logger[_0x14bf('0xa')](_0x14bf('0x26'),_0x9570a6['firstName'],_0x9570a6[_0x14bf('0x27')],_0x9570a6[_0x14bf('0x28')],_0x4d0808);if(this['mailAccounts'][_0x4d0808]){return mailAccount['notify'](_0x4d0808,_0x9570a6)[_0x14bf('0x29')](function(_0x4e9b8c){if(_0x4e9b8c){logger[_0x14bf('0xa')](_0x14bf('0x2a'));}})[_0x14bf('0x2b')](function(_0xca2dcd){logger[_0x14bf('0x1d')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x14bf('0x15')](_0xca2dcd));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x78eaf2){if(this[_0x14bf('0xb')][_0x78eaf2]&&this[_0x14bf('0xb')][_0x78eaf2][_0x14bf('0x12')]){if(this['imapAccounts'][this[_0x14bf('0xb')][_0x78eaf2][_0x14bf('0x12')]['id']]){delete this[_0x14bf('0xc')][this[_0x14bf('0xb')][_0x78eaf2][_0x14bf('0x12')]['id']];}this[_0x14bf('0xb')][_0x78eaf2][_0x14bf('0x12')]['lastSync']=moment();this[_0x14bf('0xe')](_0x78eaf2);}};EmailChannel[_0x14bf('0xd')][_0x14bf('0x1e')]=function(_0x44a75f,_0xc15c88){if(this[_0x14bf('0xb')][_0x44a75f]){this['mailAccounts'][_0x44a75f]['Imap']['status']=_0x14bf('0x1d');this[_0x14bf('0xb')][_0x44a75f][_0x14bf('0x12')]['messageStatus']=_0xc15c88;return this[_0x14bf('0xe')](_0x44a75f);}};EmailChannel['prototype']['sendMail']=function(_0x490f69,_0x27e900){return this['smtp'][_0x14bf('0x2c')](_0x490f69,_0x27e900);};EmailChannel[_0x14bf('0xd')]['verifySmtp']=function(_0x43c3bc){var _0x3ff640=this;if(this['mailAccounts'][_0x43c3bc['id']]){if(_['isNil'](this[_0x14bf('0xb')][_0x43c3bc['id']][_0x14bf('0x2d')])){this['mailAccounts'][_0x43c3bc['id']][_0x14bf('0x2d')]={};}this['mailAccounts'][_0x43c3bc['id']][_0x14bf('0x2d')][_0x14bf('0x2e')]=moment();return new BPromise(function(_0x200c2d,_0x2209d9){return _0x3ff640[_0x14bf('0x2f')][_0x14bf('0x30')](_0x43c3bc)[_0x14bf('0x29')](function(_0x3c9b9c){_0x3ff640['mailAccounts'][_0x43c3bc['id']][_0x14bf('0x2d')][_0x14bf('0x13')]=_0x14bf('0x31');_0x3ff640[_0x14bf('0xb')][_0x43c3bc['id']][_0x14bf('0x2d')][_0x14bf('0x21')]='';_0x3ff640[_0x14bf('0xe')](_0x43c3bc['id']);_0x200c2d(_0x3c9b9c);})['catch'](function(_0x1b3918){_0x3ff640['mailAccounts'][_0x43c3bc['id']][_0x14bf('0x2d')][_0x14bf('0x13')]='error';_0x3ff640[_0x14bf('0xb')][_0x43c3bc['id']]['Smtp'][_0x14bf('0x21')]=_0x1b3918;_0x3ff640[_0x14bf('0xe')](_0x43c3bc['id']);_0x2209d9(_0x1b3918);});});}return this[_0x14bf('0x2f')]['verify'](_0x43c3bc);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 567cf05..ab8ee9e 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 _0xf1d7=['handleEnd','bind','error','connect','connTimeout','authTimeout','service','user','password','host','port','tls','required','getHost','anonymous@xcally.com','prototype','openBox','handleOpenBox','handleError','handleCloseBox','search','UNSEEN','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageEnd','handleSimpleParser','handleMessageAttributes','emit','stringify','textCode','upperFirst','exports','util','imap','randomstring','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','end'];(function(_0xe1441d,_0x36fb8e){var _0x2ef242=function(_0x52bf2d){while(--_0x52bf2d){_0xe1441d['push'](_0xe1441d['shift']());}};_0x2ef242(++_0x36fb8e);}(_0xf1d7,0x101));var _0x7f1d=function(_0x3f32d5,_0x40e5d8){_0x3f32d5=_0x3f32d5-0x0;var _0x4f5fff=_0xf1d7[_0x3f32d5];return _0x4f5fff;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x7f1d('0x0'));var Imap=require(_0x7f1d('0x1'));var _=require('lodash');var rs=require(_0x7f1d('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x7f1d('0x3'))[_0x7f1d('0x4')];var EventEmitter=require(_0x7f1d('0x5'))[_0x7f1d('0x6')];var utils=require(_0x7f1d('0x7'));var logger=require(_0x7f1d('0x8'))(_0x7f1d('0x9'));function EmailImap(_0x251d54,_0x166048){this[_0x7f1d('0xa')]=_0x7f1d('0xb');this[_0x7f1d('0xc')]=this[_0x7f1d('0xd')](_0x251d54,_0x166048);this['imap']=new Imap(this[_0x7f1d('0xc')]);this[_0x7f1d('0x1')][_0x7f1d('0xe')](_0x7f1d('0xf'),this[_0x7f1d('0x10')]['bind'](this));this[_0x7f1d('0x1')][_0x7f1d('0xe')](_0x7f1d('0x11'),this[_0x7f1d('0x12')][_0x7f1d('0x13')](this));this[_0x7f1d('0x1')]['on'](_0x7f1d('0x14'),this['handleError']['bind'](this));this['imap'][_0x7f1d('0x15')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x4302bd,_0x4f9b62){var _0x494a47={'connTimeout':_0x4302bd[_0x7f1d('0x16')]?_0x4302bd[_0x7f1d('0x16')]*0x3e8:0x2710,'authTimeout':_0x4302bd[_0x7f1d('0x17')]?_0x4302bd[_0x7f1d('0x17')]*0x3e8:0x1388};if(_['isNil'](_0x4302bd[_0x7f1d('0x18')])){if(_0x4302bd['authentication']){_0x494a47[_0x7f1d('0x19')]=_0x4302bd[_0x7f1d('0x19')];_0x494a47[_0x7f1d('0x1a')]=_0x4302bd[_0x7f1d('0x1a')];}_0x494a47[_0x7f1d('0x1b')]=_0x4302bd[_0x7f1d('0x1b')];_0x494a47[_0x7f1d('0x1c')]=_0x4302bd[_0x7f1d('0x1c')]||0x3e1;if(_0x4302bd[_0x7f1d('0x1d')]){_0x494a47[_0x7f1d('0x1d')]=!![];}else{_0x494a47[_0x7f1d('0x1d')]=![];_0x494a47['autotls']=_0x7f1d('0x1e');}}else{_0x494a47[_0x7f1d('0x19')]=_0x4302bd[_0x7f1d('0x19')];_0x494a47[_0x7f1d('0x1a')]=_0x4302bd[_0x7f1d('0x1a')];_0x494a47['host']=utils[_0x7f1d('0x1f')](_0x4302bd[_0x7f1d('0x18')]);_0x494a47['port']=0x3e1;_0x494a47[_0x7f1d('0x1d')]=!![];}_0x494a47['email']=_0x4f9b62||_0x4302bd[_0x7f1d('0x19')]||_0x7f1d('0x20');return _0x494a47;};EmailImap[_0x7f1d('0x21')][_0x7f1d('0x10')]=function(){this[_0x7f1d('0x1')][_0x7f1d('0x22')](this[_0x7f1d('0xa')],![],this['handleOpenBox'][_0x7f1d('0x13')](this));};EmailImap[_0x7f1d('0x21')][_0x7f1d('0x23')]=function(_0x2428e1,_0xadf978){if(_0x2428e1){this[_0x7f1d('0x24')](_0x2428e1,!![]);}else{this['emit']('box',_0xadf978);this['readUnseen']();}};EmailImap[_0x7f1d('0x21')][_0x7f1d('0x25')]=function(_0x459224){if(_0x459224){this[_0x7f1d('0x24')](_0x459224,!![]);}else{this[_0x7f1d('0x1')][_0x7f1d('0x11')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0x7f1d('0x1')][_0x7f1d('0x26')]([_0x7f1d('0x27')],this['handleReadUnseen'][_0x7f1d('0x13')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x56fdf7,_0x1bd345){if(_0x56fdf7){this[_0x7f1d('0x24')](_0x56fdf7,!![]);}else{if(_0x1bd345['length']){try{var _0x353102=this['imap']['fetch'](_0x1bd345,{'bodies':'','markSeen':!![]});_0x353102['on'](_0x7f1d('0x28'),this[_0x7f1d('0x29')][_0x7f1d('0x13')](this));_0x353102[_0x7f1d('0xe')](_0x7f1d('0x14'),this[_0x7f1d('0x2a')][_0x7f1d('0x13')](this));_0x353102[_0x7f1d('0xe')](_0x7f1d('0x11'),this[_0x7f1d('0x2b')][_0x7f1d('0x13')](this));}catch(_0x3ea73d){logger[_0x7f1d('0x14')](_0x3ea73d);}}else{this[_0x7f1d('0x1')][_0x7f1d('0x2c')](!![],this[_0x7f1d('0x25')][_0x7f1d('0x13')](this));}}};EmailImap['prototype'][_0x7f1d('0x29')]=function(_0x13be70,_0x43c7cd){_0x13be70['on'](_0x7f1d('0x2d'),this[_0x7f1d('0x2e')][_0x7f1d('0x13')](this));_0x13be70['once']('attributes',this['handleMessageAttributes'][_0x7f1d('0x13')](this));_0x13be70['once'](_0x7f1d('0x11'),this[_0x7f1d('0x2f')][_0x7f1d('0x13')](this));};EmailImap[_0x7f1d('0x21')][_0x7f1d('0x2e')]=function(_0x2f7e20,_0x47571b){simpleParser(_0x2f7e20,{'Iconv':Iconv},this[_0x7f1d('0x30')][_0x7f1d('0x13')](this));};EmailImap[_0x7f1d('0x21')][_0x7f1d('0x31')]=function(_0x1f4893){};EmailImap[_0x7f1d('0x21')][_0x7f1d('0x2f')]=function(){};EmailImap[_0x7f1d('0x21')][_0x7f1d('0x30')]=function(_0x1ebbeb,_0x4f4b3a){if(_0x1ebbeb){logger['error'](_0x1ebbeb);}else{var _0x4c70ee=this;utils['parser'](this[_0x7f1d('0xc')],_0x4f4b3a,function(_0x243329){_0x4c70ee[_0x7f1d('0x32')](_0x7f1d('0x9'),_0x243329);});}};EmailImap['prototype'][_0x7f1d('0x2b')]=function(){this[_0x7f1d('0x1')][_0x7f1d('0x2c')](!![],this['handleCloseBox'][_0x7f1d('0x13')](this));};EmailImap[_0x7f1d('0x21')]['handleFetchError']=function(_0x4cc950){this[_0x7f1d('0x24')](_0x4cc950);this[_0x7f1d('0x1')][_0x7f1d('0x2c')](!![],this[_0x7f1d('0x25')][_0x7f1d('0x13')](this));};EmailImap[_0x7f1d('0x21')][_0x7f1d('0x12')]=function(){this[_0x7f1d('0x32')](_0x7f1d('0x11'));};EmailImap[_0x7f1d('0x21')][_0x7f1d('0x24')]=function(_0x523024,_0x57eec8){logger['error'](_0x7f1d('0x24'),this['account'][_0x7f1d('0x9')],JSON[_0x7f1d('0x33')](_0x523024));var _0x44a242='';if(_0x523024){if(_0x523024[_0x7f1d('0x34')]){_0x44a242=_0x523024[_0x7f1d('0x34')];}else{for(var _0x33d227 in _0x523024){if(_0x523024['hasOwnProperty'](_0x33d227)){_0x44a242+=_[_0x7f1d('0x35')](_0x33d227)+':\x20'+_0x523024[_0x33d227]+'\x0a';}}}}if(_0x57eec8){this[_0x7f1d('0x1')][_0x7f1d('0x11')]();}else{this[_0x7f1d('0x32')](_0x7f1d('0x14'),_0x44a242);this[_0x7f1d('0x32')]('end');}};module[_0x7f1d('0x36')]=EmailImap; \ No newline at end of file +var _0x2f56=['handleOpenBox','emit','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','message','handleFetchError','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','account','handleFetchEnd','stringify','textCode','exports','path','util','imap','randomstring','mailparser','simpleParser','iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','once','handleReady','bind','end','handleEnd','error','handleError','connect','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','required','getHost','anonymous@xcally.com','openBox','prototype'];(function(_0x31bfee,_0x5e7b65){var _0x4fe58e=function(_0x52f282){while(--_0x52f282){_0x31bfee['push'](_0x31bfee['shift']());}};_0x4fe58e(++_0x5e7b65);}(_0x2f56,0x148));var _0x62f5=function(_0x400a23,_0x47185d){_0x400a23=_0x400a23-0x0;var _0x690390=_0x2f56[_0x400a23];return _0x690390;};'use strict';var fs=require('fs');var path=require(_0x62f5('0x0'));var util=require(_0x62f5('0x1'));var Imap=require(_0x62f5('0x2'));var _=require('lodash');var rs=require(_0x62f5('0x3'));var simpleParser=require(_0x62f5('0x4'))[_0x62f5('0x5')];var Iconv=require(_0x62f5('0x6'))['Iconv'];var EventEmitter=require(_0x62f5('0x7'))[_0x62f5('0x8')];var utils=require(_0x62f5('0x9'));var logger=require(_0x62f5('0xa'))(_0x62f5('0xb'));function EmailImap(_0x3df0d3,_0x47e020){this[_0x62f5('0xc')]=_0x62f5('0xd');this['account']=this[_0x62f5('0xe')](_0x3df0d3,_0x47e020);this['imap']=new Imap(this['account']);this[_0x62f5('0x2')][_0x62f5('0xf')]('ready',this[_0x62f5('0x10')][_0x62f5('0x11')](this));this[_0x62f5('0x2')][_0x62f5('0xf')](_0x62f5('0x12'),this[_0x62f5('0x13')][_0x62f5('0x11')](this));this['imap']['on'](_0x62f5('0x14'),this[_0x62f5('0x15')][_0x62f5('0x11')](this));this['imap'][_0x62f5('0x16')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x62f5('0xe')]=function(_0x5085df,_0x5c0551){var _0x32444d={'connTimeout':_0x5085df['connTimeout']?_0x5085df[_0x62f5('0x17')]*0x3e8:0x2710,'authTimeout':_0x5085df[_0x62f5('0x18')]?_0x5085df[_0x62f5('0x18')]*0x3e8:0x1388};if(_[_0x62f5('0x19')](_0x5085df[_0x62f5('0x1a')])){if(_0x5085df[_0x62f5('0x1b')]){_0x32444d[_0x62f5('0x1c')]=_0x5085df['user'];_0x32444d[_0x62f5('0x1d')]=_0x5085df[_0x62f5('0x1d')];}_0x32444d['host']=_0x5085df[_0x62f5('0x1e')];_0x32444d[_0x62f5('0x1f')]=_0x5085df['port']||0x3e1;if(_0x5085df[_0x62f5('0x20')]){_0x32444d[_0x62f5('0x20')]=!![];}else{_0x32444d[_0x62f5('0x20')]=![];_0x32444d['autotls']=_0x62f5('0x21');}}else{_0x32444d['user']=_0x5085df[_0x62f5('0x1c')];_0x32444d['password']=_0x5085df[_0x62f5('0x1d')];_0x32444d[_0x62f5('0x1e')]=utils[_0x62f5('0x22')](_0x5085df[_0x62f5('0x1a')]);_0x32444d[_0x62f5('0x1f')]=0x3e1;_0x32444d[_0x62f5('0x20')]=!![];}_0x32444d[_0x62f5('0xb')]=_0x5c0551||_0x5085df[_0x62f5('0x1c')]||_0x62f5('0x23');return _0x32444d;};EmailImap['prototype'][_0x62f5('0x10')]=function(){this[_0x62f5('0x2')][_0x62f5('0x24')](this[_0x62f5('0xc')],![],this['handleOpenBox'][_0x62f5('0x11')](this));};EmailImap[_0x62f5('0x25')][_0x62f5('0x26')]=function(_0x417866,_0x10b61d){if(_0x417866){this[_0x62f5('0x15')](_0x417866,!![]);}else{this[_0x62f5('0x27')]('box',_0x10b61d);this[_0x62f5('0x28')]();}};EmailImap['prototype'][_0x62f5('0x29')]=function(_0x390c12){if(_0x390c12){this[_0x62f5('0x15')](_0x390c12,!![]);}else{this[_0x62f5('0x2')][_0x62f5('0x12')]();}};EmailImap['prototype'][_0x62f5('0x28')]=function(){this[_0x62f5('0x2')]['search']([_0x62f5('0x2a')],this[_0x62f5('0x2b')]['bind'](this));};EmailImap[_0x62f5('0x25')][_0x62f5('0x2b')]=function(_0x5cf31a,_0x465cd2){if(_0x5cf31a){this['handleError'](_0x5cf31a,!![]);}else{if(_0x465cd2[_0x62f5('0x2c')]){try{var _0x169a61=this['imap']['fetch'](_0x465cd2,{'bodies':'','markSeen':!![]});_0x169a61['on'](_0x62f5('0x2d'),this['handleFetchMessage']['bind'](this));_0x169a61[_0x62f5('0xf')]('error',this[_0x62f5('0x2e')][_0x62f5('0x11')](this));_0x169a61[_0x62f5('0xf')]('end',this['handleFetchEnd'][_0x62f5('0x11')](this));}catch(_0xaf7618){logger[_0x62f5('0x14')](_0xaf7618);}}else{this[_0x62f5('0x2')][_0x62f5('0x2f')](!![],this[_0x62f5('0x29')][_0x62f5('0x11')](this));}}};EmailImap[_0x62f5('0x25')][_0x62f5('0x30')]=function(_0xc769e8,_0xa0c70b){_0xc769e8['on'](_0x62f5('0x31'),this[_0x62f5('0x32')][_0x62f5('0x11')](this));_0xc769e8[_0x62f5('0xf')](_0x62f5('0x33'),this[_0x62f5('0x34')][_0x62f5('0x11')](this));_0xc769e8[_0x62f5('0xf')](_0x62f5('0x12'),this['handleMessageEnd'][_0x62f5('0x11')](this));};EmailImap[_0x62f5('0x25')][_0x62f5('0x32')]=function(_0x45a1ed,_0x416a2d){simpleParser(_0x45a1ed,{'Iconv':Iconv},this[_0x62f5('0x35')][_0x62f5('0x11')](this));};EmailImap['prototype'][_0x62f5('0x34')]=function(_0x22772c){};EmailImap['prototype'][_0x62f5('0x36')]=function(){};EmailImap[_0x62f5('0x25')][_0x62f5('0x35')]=function(_0x3f8c7e,_0x3219ec){if(_0x3f8c7e){logger[_0x62f5('0x14')](_0x3f8c7e);}else{var _0x34f9d7=this;utils[_0x62f5('0x37')](this[_0x62f5('0x38')],_0x3219ec,function(_0x1c65d3){_0x34f9d7['emit']('email',_0x1c65d3);});}};EmailImap[_0x62f5('0x25')][_0x62f5('0x39')]=function(){this[_0x62f5('0x2')][_0x62f5('0x2f')](!![],this[_0x62f5('0x29')][_0x62f5('0x11')](this));};EmailImap[_0x62f5('0x25')][_0x62f5('0x2e')]=function(_0x3dbb40){this[_0x62f5('0x15')](_0x3dbb40);this[_0x62f5('0x2')][_0x62f5('0x2f')](!![],this[_0x62f5('0x29')][_0x62f5('0x11')](this));};EmailImap[_0x62f5('0x25')]['handleEnd']=function(){this[_0x62f5('0x27')](_0x62f5('0x12'));};EmailImap[_0x62f5('0x25')]['handleError']=function(_0x27a1df,_0x11fa39){logger[_0x62f5('0x14')](_0x62f5('0x15'),this['account'][_0x62f5('0xb')],JSON[_0x62f5('0x3a')](_0x27a1df));var _0x4140eb='';if(_0x27a1df){if(_0x27a1df[_0x62f5('0x3b')]){_0x4140eb=_0x27a1df[_0x62f5('0x3b')];}else{for(var _0x578f06 in _0x27a1df){if(_0x27a1df['hasOwnProperty'](_0x578f06)){_0x4140eb+=_['upperFirst'](_0x578f06)+':\x20'+_0x27a1df[_0x578f06]+'\x0a';}}}}if(_0x11fa39){this[_0x62f5('0x2')][_0x62f5('0x12')]();}else{this[_0x62f5('0x27')](_0x62f5('0x14'),_0x4140eb);this[_0x62f5('0x27')]('end');}};module[_0x62f5('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 e3a59d5..d9aa207 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 _0x9f0a=['verify','Not\x20verifired','nodemailer','bluebird','prototype','createTransport','use','sendMail','toString'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x9f0a,0x77));var _0xa9f0=function(_0x8e280d,_0x565c08){_0x8e280d=_0x8e280d-0x0;var _0xad7db8=_0x9f0a[_0x8e280d];return _0xad7db8;};'use strict';var nodemailer=require(_0xa9f0('0x0'));var BPromise=require(_0xa9f0('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xa9f0('0x2')]['send']=function(_0x4e0ddd,_0x418c8c){return new BPromise(function(_0xbc2dd1,_0x20929e){var _0x294a85=nodemailer[_0xa9f0('0x3')](_0x4e0ddd);_0x294a85[_0xa9f0('0x4')]('compile',inlineBase64());_0x294a85[_0xa9f0('0x5')](_0x418c8c,function(_0x3c4d18,_0x5467fb){if(_0x3c4d18){_0x20929e(_0x3c4d18[_0xa9f0('0x6')]());}else{_0xbc2dd1(_0x5467fb);}});});};EmailSmtp[_0xa9f0('0x2')][_0xa9f0('0x7')]=function(_0x2d0041){return new BPromise(function(_0x53be45,_0xd2e79c){var _0x3e4f6e=nodemailer[_0xa9f0('0x3')](_0x2d0041);_0x3e4f6e[_0xa9f0('0x7')](function(_0x1dcc85,_0x1306ee){if(_0x1dcc85){_0xd2e79c(_0x1dcc85['toString']());}else{if(_0x1306ee){_0x53be45(_0x1306ee);}else{_0xd2e79c(_0xa9f0('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xd985=['nodemailer-plugin-inline-base64','send','createTransport','compile','sendMail','toString','prototype','nodemailer','bluebird'];(function(_0x3626dd,_0x2115b8){var _0x4585f9=function(_0x497210){while(--_0x497210){_0x3626dd['push'](_0x3626dd['shift']());}};_0x4585f9(++_0x2115b8);}(_0xd985,0x154));var _0x5d98=function(_0x45f4e9,_0x5246fd){_0x45f4e9=_0x45f4e9-0x0;var _0x559d8f=_0xd985[_0x45f4e9];return _0x559d8f;};'use strict';var nodemailer=require(_0x5d98('0x0'));var BPromise=require(_0x5d98('0x1'));var inlineBase64=require(_0x5d98('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0x5d98('0x3')]=function(_0x33948e,_0x59418f){return new BPromise(function(_0x2533e5,_0x3d7823){var _0x235b20=nodemailer[_0x5d98('0x4')](_0x33948e);_0x235b20['use'](_0x5d98('0x5'),inlineBase64());_0x235b20[_0x5d98('0x6')](_0x59418f,function(_0x1a4748,_0x2686f6){if(_0x1a4748){_0x3d7823(_0x1a4748[_0x5d98('0x7')]());}else{_0x2533e5(_0x2686f6);}});});};EmailSmtp[_0x5d98('0x8')]['verify']=function(_0x13ccfb){return new BPromise(function(_0x37e672,_0x444c85){var _0x35519d=nodemailer[_0x5d98('0x4')](_0x13ccfb);_0x35519d['verify'](function(_0x59b225,_0x4e1b76){if(_0x59b225){_0x444c85(_0x59b225['toString']());}else{if(_0x4e1b76){_0x37e672(_0x4e1b76);}else{_0x444c85('Not\x20verifired');}}});});};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 dd84849..ba28bbf 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 _0xf8ab=['127.0.0.1','lodash','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','name','split','slice','Anonymous','length','pop','html','replace','body','Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365'];(function(_0x4b5b0a,_0x55cc8b){var _0x27940f=function(_0x6c0c41){while(--_0x6c0c41){_0x4b5b0a['push'](_0x4b5b0a['shift']());}};_0x27940f(++_0x55cc8b);}(_0xf8ab,0x7f));var _0xbf8a=function(_0x3050f1,_0x304c22){_0x3050f1=_0x3050f1-0x0;var _0x5aa4f0=_0xf8ab[_0x3050f1];return _0x5aa4f0;};'use strict';var _=require(_0xbf8a('0x0'));var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0xbf8a('0x1'));var tnef=require(_0xbf8a('0x2'));var logger=require(_0xbf8a('0x3'))('email');var config=require(_0xbf8a('0x4'));function getAddress(_0x59e36c){var _0x30a63e=_[_0xbf8a('0x5')](_0x59e36c[_0xbf8a('0x6')]);return _0x30a63e&&_0x30a63e[_0xbf8a('0x7')]?_0x30a63e[_0xbf8a('0x7')]:_0xbf8a('0x8')+random[_0xbf8a('0x9')](0x6)+'@xcally.com';}function getFirstName(_0xb945a6){var _0x1098db=_[_0xbf8a('0x5')](_0xb945a6['value']);if(_0x1098db&&_0x1098db[_0xbf8a('0xa')]){var _0x328af5=_0x1098db['name'][_0xbf8a('0xb')](/\s+/);return _0x328af5['length']?_0x328af5[_0xbf8a('0xc')](0x0,-0x1)['join']('\x20'):_0x1098db['name'];}return _0xbf8a('0xd');}function getLastName(_0x2ccb37){var _0x580f6a=_[_0xbf8a('0x5')](_0x2ccb37[_0xbf8a('0x6')]);if(_0x580f6a&&_0x580f6a[_0xbf8a('0xa')]){var _0x21a66c=_0x580f6a['name'][_0xbf8a('0xb')](/\s+/);return _0x21a66c[_0xbf8a('0xe')]>0x1?_0x21a66c[_0xbf8a('0xf')]():'';}return'';}function getMails(_0x38310f,_0x3f1032){var _0x54a520='';for(var _0x9413d0=0x0;_0x9413d0<_0x3f1032[_0xbf8a('0x6')]['length'];_0x9413d0+=0x1){if(_0x3f1032['value'][_0x9413d0]['address']!==_0x38310f){if(!_['isEmpty'](_0x54a520)){_0x54a520+=',';}_0x54a520+=_0x3f1032[_0xbf8a('0x6')][_0x9413d0][_0xbf8a('0xa')]||_0x3f1032['value'][_0x9413d0][_0xbf8a('0x7')]||'';_0x54a520+='\x20<';_0x54a520+=_0x3f1032[_0xbf8a('0x6')][_0x9413d0][_0xbf8a('0x7')]?_0x3f1032[_0xbf8a('0x6')][_0x9413d0]['address']:_0xbf8a('0x8')+random[_0xbf8a('0x9')](0x6)+'@xcally.com';_0x54a520+='>';}}return _0x54a520;}function parseEmail(_0x400f72,_0x56e59c,_0x3f6ce0){if(_0x56e59c[_0xbf8a('0x10')]){var _0x5ec421=/)<[^<]*)*<\/script>/gi;while(_0x5ec421['test'](_0x56e59c[_0xbf8a('0x10')])){_0x56e59c['html']=_0x56e59c[_0xbf8a('0x10')][_0xbf8a('0x11')](_0x5ec421,'');}_0x3f6ce0[_0xbf8a('0x12')]=_0x56e59c['html'];}else{_0x3f6ce0[_0xbf8a('0x12')]=_0x56e59c['textAsHtml'];}if(_0x3f6ce0[_0xbf8a('0x12')]){_0x3f6ce0['body']=_0x3f6ce0['body'][_0xbf8a('0x11')](/Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','email','../../../config/environment','head','value','address','generate','@xcally.com','name','length','slice','join','Anonymous','split','isEmpty','anonymous','html','test','replace','body','textAsHtml','0x1?_0x1ab0ba['pop']():'';}return'';}function getMails(_0x3455d4,_0x5d9319){var _0x1657ee='';for(var _0x43c957=0x0;_0x43c957<_0x5d9319[_0x52fd('0x8')][_0x52fd('0xd')];_0x43c957+=0x1){if(_0x5d9319['value'][_0x43c957][_0x52fd('0x9')]!==_0x3455d4){if(!_[_0x52fd('0x12')](_0x1657ee)){_0x1657ee+=',';}_0x1657ee+=_0x5d9319[_0x52fd('0x8')][_0x43c957][_0x52fd('0xc')]||_0x5d9319[_0x52fd('0x8')][_0x43c957][_0x52fd('0x9')]||'';_0x1657ee+='\x20<';_0x1657ee+=_0x5d9319[_0x52fd('0x8')][_0x43c957][_0x52fd('0x9')]?_0x5d9319['value'][_0x43c957][_0x52fd('0x9')]:_0x52fd('0x13')+random[_0x52fd('0xa')](0x6)+_0x52fd('0xb');_0x1657ee+='>';}}return _0x1657ee;}function parseEmail(_0x250654,_0x1f8d08,_0x2294d3){if(_0x1f8d08[_0x52fd('0x14')]){var _0x38c926=/)<[^<]*)*<\/script>/gi;while(_0x38c926[_0x52fd('0x15')](_0x1f8d08[_0x52fd('0x14')])){_0x1f8d08[_0x52fd('0x14')]=_0x1f8d08[_0x52fd('0x14')][_0x52fd('0x16')](_0x38c926,'');}_0x2294d3[_0x52fd('0x17')]=_0x1f8d08[_0x52fd('0x14')];}else{_0x2294d3[_0x52fd('0x17')]=_0x1f8d08[_0x52fd('0x18')];}if(_0x2294d3[_0x52fd('0x17')]){_0x2294d3['body']=_0x2294d3['body'][_0x52fd('0x16')](/0x0){if(this[_0xde347f+'Capacity']>0x0&&this[_0xde347f+_0xef45('0x20')]>=this[_0xde347f+_0xef45('0x21')]){return _0xef45('0x22');}else{return _0xef45('0x23');}}else{return _0xef45('0x24');}};Agent['prototype'][_0xef45('0x1d')]=function(){var _0x54a75d=['mail',_0xef45('0x25'),_0xef45('0x26'),_0xef45('0x27'),_0xef45('0x28')];for(var _0x839eff=0x0;_0x839eff<_0x54a75d[_0xef45('0x29')];_0x839eff+=0x1){var _0x315777=this['getChannelStatus'](_0x54a75d[_0x839eff]);if(this[_0x54a75d[_0x839eff]+_0xef45('0x2a')]!==_0x315777){this[_0x54a75d[_0x839eff]+'StatusTime']=_[_0xef45('0x2b')](moment()[_0xef45('0x2c')]('x'));}this[_0x54a75d[_0x839eff]+'Status']=_0x315777;}var _0x46e423={'id':this['id'],'name':this[_0xef45('0x7')],'online':this['online'],'voicePause':this[_0xef45('0x9')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0xef45('0xe')],'chatStatus':this[_0xef45('0xf')],'chatStatusTime':this[_0xef45('0x2d')],'chatCapacity':this[_0xef45('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xef45('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xef45('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xef45('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xef45('0x17')],'smsStatus':this[_0xef45('0x2e')],'smsStatusTime':this[_0xef45('0x18')],'smsCapacity':this[_0xef45('0x19')],'smsCurrentCapacity':this[_0xef45('0x2f')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xef45('0x30')],'busy':this[_0xef45('0x31')],'busyQueue':this[_0xef45('0x1c')]};var _0x3039b0=md5(JSON[_0xef45('0x32')](_0x46e423));if(this[_0xef45('0x1')]!==_0x3039b0){this[_0xef45('0x1')]=_0x3039b0;io['emit']('user:save',_0x46e423);}};module[_0xef45('0x33')]=Agent; \ No newline at end of file +var _0x4fdb=['defaults','localhost','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','prototype','getChannelStatus','CurrentCapacity','Capacity','idle','updateRealtime','mail','openchannel','sms','length','Status','StatusTime','toNumber','mailStatus','busy','busyQueue','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis'];(function(_0x442602,_0x472182){var _0x18dc67=function(_0x1b9a78){while(--_0x1b9a78){_0x442602['push'](_0x442602['shift']());}};_0x18dc67(++_0x472182);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x1e10fb,_0x209077){_0x1e10fb=_0x1e10fb-0x0;var _0x5d88bf=_0x4fdb[_0x1e10fb];return _0x5d88bf;};'use strict';var _=require(_0xb4fd('0x0'));var moment=require(_0xb4fd('0x1'));var md5=require(_0xb4fd('0x2'));var Redis=require(_0xb4fd('0x3'));var config=require(_0xb4fd('0x4'));config[_0xb4fd('0x5')]=_[_0xb4fd('0x6')](config[_0xb4fd('0x5')],{'host':_0xb4fd('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb4fd('0x5')]));function Agent(_0x5c07c5){this['id']=_0x5c07c5['id']||0x0;this[_0xb4fd('0x8')]=_0x5c07c5['name']||'';this['online']=_0x5c07c5[_0xb4fd('0x9')]||!![];this[_0xb4fd('0xa')]=_0x5c07c5[_0xb4fd('0xa')]||![];this['chatPause']=_0x5c07c5['chatPause']||![];this[_0xb4fd('0xb')]=_0x5c07c5[_0xb4fd('0xb')]||![];this[_0xb4fd('0xc')]=_0x5c07c5['faxPause']||![];this[_0xb4fd('0xd')]=_0x5c07c5[_0xb4fd('0xd')]||![];this[_0xb4fd('0xe')]=_0x5c07c5[_0xb4fd('0xe')]||![];this[_0xb4fd('0xf')]='unknown';this[_0xb4fd('0x10')]=0x0;this[_0xb4fd('0x11')]=_0x5c07c5[_0xb4fd('0x11')]||0x0;this[_0xb4fd('0x12')]=0x0;this['mailStatus']=_0xb4fd('0x13');this[_0xb4fd('0x14')]=0x0;this[_0xb4fd('0x15')]=_0x5c07c5['mailCapacity']||0x0;this[_0xb4fd('0x16')]=0x0;this[_0xb4fd('0x17')]=_0xb4fd('0x13');this[_0xb4fd('0x18')]=0x0;this[_0xb4fd('0x19')]=_0x5c07c5[_0xb4fd('0x19')]||0x0;this[_0xb4fd('0x1a')]=0x0;this['smsStatus']=_0xb4fd('0x13');this[_0xb4fd('0x1b')]=0x0;this[_0xb4fd('0x1c')]=_0x5c07c5[_0xb4fd('0x1c')]||0x0;this[_0xb4fd('0x1d')]=0x0;this[_0xb4fd('0x1e')]=_0xb4fd('0x13');this[_0xb4fd('0x1f')]=0x0;this[_0xb4fd('0x20')]=_0x5c07c5[_0xb4fd('0x20')]||0x0;this[_0xb4fd('0x21')]=0x0;this['busy']=![];this['busyQueue']=undefined;this['md5']='';this['updateRealtime']();}Agent[_0xb4fd('0x22')][_0xb4fd('0x23')]=function(_0x299764){if(this[_0x299764+_0xb4fd('0x24')]>0x0){if(this[_0x299764+_0xb4fd('0x25')]>0x0&&this[_0x299764+_0xb4fd('0x24')]>=this[_0x299764+_0xb4fd('0x25')]){return'maxcapacity';}else{return'working';}}else{return _0xb4fd('0x26');}};Agent[_0xb4fd('0x22')][_0xb4fd('0x27')]=function(){var _0x4a1d88=[_0xb4fd('0x28'),'chat',_0xb4fd('0x29'),'fax',_0xb4fd('0x2a')];for(var _0x2c2d8d=0x0;_0x2c2d8d<_0x4a1d88[_0xb4fd('0x2b')];_0x2c2d8d+=0x1){var _0x261eda=this[_0xb4fd('0x23')](_0x4a1d88[_0x2c2d8d]);if(this[_0x4a1d88[_0x2c2d8d]+_0xb4fd('0x2c')]!==_0x261eda){this[_0x4a1d88[_0x2c2d8d]+_0xb4fd('0x2d')]=_[_0xb4fd('0x2e')](moment()['format']('x'));}this[_0x4a1d88[_0x2c2d8d]+'Status']=_0x261eda;}var _0x4baf02={'id':this['id'],'name':this[_0xb4fd('0x8')],'online':this['online'],'voicePause':this[_0xb4fd('0xa')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0xb4fd('0xd')],'faxPause':this[_0xb4fd('0xc')],'openchannelPause':this[_0xb4fd('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xb4fd('0x10')],'chatCapacity':this[_0xb4fd('0x11')],'chatCurrentCapacity':this[_0xb4fd('0x12')],'mailStatus':this[_0xb4fd('0x2f')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xb4fd('0x15')],'mailCurrentCapacity':this[_0xb4fd('0x16')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xb4fd('0x18')],'faxCapacity':this[_0xb4fd('0x19')],'faxCurrentCapacity':this[_0xb4fd('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xb4fd('0x1b')],'smsCapacity':this[_0xb4fd('0x1c')],'smsCurrentCapacity':this[_0xb4fd('0x1d')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xb4fd('0x30')],'busyQueue':this[_0xb4fd('0x31')]};var _0x294e49=md5(JSON[_0xb4fd('0x32')](_0x4baf02));if(this[_0xb4fd('0x2')]!==_0x294e49){this[_0xb4fd('0x2')]=_0x294e49;io[_0xb4fd('0x33')](_0xb4fd('0x34'),_0x4baf02);}};module[_0xb4fd('0x35')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index fe799e5..14c4dd2 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 _0xaf67=['timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name'];(function(_0x410acc,_0x5d542a){var _0x59f15f=function(_0x11988e){while(--_0x11988e){_0x410acc['push'](_0x410acc['shift']());}};_0x59f15f(++_0x5d542a);}(_0xaf67,0xb1));var _0x7af6=function(_0x4a682d,_0x1d4036){_0x4a682d=_0x4a682d-0x0;var _0x12225a=_0xaf67[_0x4a682d];return _0x12225a;};'use strict';var _=require(_0x7af6('0x0'));var md5=require(_0x7af6('0x1'));var util=require(_0x7af6('0x2'));var Redis=require(_0x7af6('0x3'));var config=require(_0x7af6('0x4'));config[_0x7af6('0x5')]=_['defaults'](config[_0x7af6('0x5')],{'host':_0x7af6('0x6'),'port':0x18eb});var io=require(_0x7af6('0x7'))(new Redis(config[_0x7af6('0x5')]));function ChatQueue(_0x6b239b){this['id']=_0x6b239b['id']||0x0;this[_0x7af6('0x8')]=_0x6b239b[_0x7af6('0x8')]||'';this[_0x7af6('0x9')]=_0x6b239b[_0x7af6('0x9')]||0xa;this[_0x7af6('0xa')]=_0x6b239b[_0x7af6('0xa')]||_0x7af6('0xb');this['Agents']=_0x6b239b[_0x7af6('0xc')];this['mapAgentsId']={};this[_0x7af6('0xd')]=0x0;this[_0x7af6('0x1')]='';this[_0x7af6('0xe')]();this[_0x7af6('0xf')]();}ChatQueue[_0x7af6('0x10')][_0x7af6('0xe')]=function(){var _0x35c9ac=this[_0x7af6('0x11')][_0x7af6('0x12')];this[_0x7af6('0x11')]=_[_0x7af6('0x13')](this[_0x7af6('0xc')],'id');this[_0x7af6('0x11')][_0x7af6('0x12')]=_0x35c9ac;};ChatQueue['prototype'][_0x7af6('0xf')]=function(){this[_0x7af6('0x14')]=0x0;this[_0x7af6('0x15')]=0x0;for(var _0x1026a3=0x0;_0x1026a3=0x0?this[_0x7af6('0x18')]:0x0;var _0x476261={'id':this['id'],'available':this[_0x7af6('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x7af6('0xd')]};var _0x5a1f9a=md5(JSON[_0x7af6('0x19')](_0x476261));if(this['md5']!==_0x5a1f9a){this['md5']=_0x5a1f9a;io['to'](util[_0x7af6('0x1a')](_0x7af6('0x1b'),_0x476261[_0x7af6('0x8')]))[_0x7af6('0x1c')](_0x7af6('0x1d'),_0x476261);}};module[_0x7af6('0x1e')]=ChatQueue; \ No newline at end of file +var _0x561e=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','chatPause','available','waiting','stringify','md5','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x561e,0x16f));var _0xe561=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x561e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe561('0x0'));var md5=require('md5');var util=require(_0xe561('0x1'));var Redis=require(_0xe561('0x2'));var config=require(_0xe561('0x3'));config[_0xe561('0x4')]=_[_0xe561('0x5')](config[_0xe561('0x4')],{'host':_0xe561('0x6'),'port':0x18eb});var io=require(_0xe561('0x7'))(new Redis(config[_0xe561('0x4')]));function ChatQueue(_0x49e4dd){this['id']=_0x49e4dd['id']||0x0;this['name']=_0x49e4dd[_0xe561('0x8')]||'';this[_0xe561('0x9')]=_0x49e4dd['timeout']||0xa;this[_0xe561('0xa')]=_0x49e4dd[_0xe561('0xa')]||_0xe561('0xb');this[_0xe561('0xc')]=_0x49e4dd[_0xe561('0xc')];this[_0xe561('0xd')]={};this['waiting']=0x0;this['md5']='';this[_0xe561('0xe')]();this[_0xe561('0xf')]();}ChatQueue['prototype'][_0xe561('0xe')]=function(){var _0x50af0b=this[_0xe561('0xd')][_0xe561('0x10')];this[_0xe561('0xd')]=_[_0xe561('0x11')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x50af0b;};ChatQueue[_0xe561('0x12')][_0xe561('0xf')]=function(){this[_0xe561('0x13')]=0x0;this[_0xe561('0x14')]=0x0;for(var _0x5f5698=0x0;_0x5f5698=0x0?this['available']:0x0;var _0x2733de={'id':this['id'],'available':this[_0xe561('0x16')],'loggedIn':this[_0xe561('0x13')],'name':this['name'],'paused':this[_0xe561('0x14')],'waiting':this[_0xe561('0x17')]};var _0x52a9b8=md5(JSON[_0xe561('0x18')](_0x2733de));if(this[_0xe561('0x19')]!==_0x52a9b8){this['md5']=_0x52a9b8;io['to'](util[_0xe561('0x1a')](_0xe561('0x1b'),_0x2733de[_0xe561('0x8')]))[_0xe561('0x1c')](_0xe561('0x1d'),_0x2733de);}};module[_0xe561('0x1e')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index c8de9ad..40474eb 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(_0xeb6510,_0x4cc99b){var _0x4988e5=function(_0x50bcbe){while(--_0x50bcbe){_0xeb6510['push'](_0xeb6510['shift']());}};_0x4988e5(++_0x4cc99b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x4567cd,_0x165c6c){var _0x25450a=function(_0x976d5){while(--_0x976d5){_0x4567cd['push'](_0x4567cd['shift']());}};_0x25450a(++_0x165c6c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 7b17b39..597b224 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 _0x93c6=['exports','name','Intervals'];(function(_0x4c6bd7,_0x1575e3){var _0x2c0392=function(_0xedf4d6){while(--_0xedf4d6){_0x4c6bd7['push'](_0x4c6bd7['shift']());}};_0x2c0392(++_0x1575e3);}(_0x93c6,0x109));var _0x693c=function(_0x477c1c,_0x286304){_0x477c1c=_0x477c1c-0x0;var _0x2da9d5=_0x93c6[_0x477c1c];return _0x2da9d5;};'use strict';function Interval(_0x151256){this['id']=_0x151256['id']||0x0;this[_0x693c('0x0')]=_0x151256[_0x693c('0x0')]||'';this[_0x693c('0x1')]=_0x151256[_0x693c('0x1')]||{};}module[_0x693c('0x2')]=Interval; \ No newline at end of file +var _0x4c7e=['name','Intervals','exports'];(function(_0x3e123d,_0x33050d){var _0x7634f0=function(_0x156901){while(--_0x156901){_0x3e123d['push'](_0x3e123d['shift']());}};_0x7634f0(++_0x33050d);}(_0x4c7e,0x141));var _0xe4c7=function(_0x59fbe4,_0x3904b4){_0x59fbe4=_0x59fbe4-0x0;var _0x31a4aa=_0x4c7e[_0x59fbe4];return _0x31a4aa;};'use strict';function Interval(_0x1b56d8){this['id']=_0x1b56d8['id']||0x0;this['name']=_0x1b56d8[_0xe4c7('0x0')]||'';this[_0xe4c7('0x1')]=_0x1b56d8[_0xe4c7('0x1')]||{};}module[_0xe4c7('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index e0c7819..81605b1 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 _0xf9a8=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','updateRealtime','loggedIn','length','online','mailPause','available','paused','stringify','md5','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','ioredis','redis','defaults','localhost'];(function(_0x37049b,_0x36eadf){var _0x2e6847=function(_0x5826a8){while(--_0x5826a8){_0x37049b['push'](_0x37049b['shift']());}};_0x2e6847(++_0x36eadf);}(_0xf9a8,0x1bd));var _0x8f9a=function(_0x1f8240,_0x3b38a0){_0x1f8240=_0x1f8240-0x0;var _0x130185=_0xf9a8[_0x1f8240];return _0x130185;};'use strict';var _=require(_0x8f9a('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x8f9a('0x1'));var config=require('../../../config/environment');config[_0x8f9a('0x2')]=_[_0x8f9a('0x3')](config['redis'],{'host':_0x8f9a('0x4'),'port':0x18eb});var io=require(_0x8f9a('0x5'))(new Redis(config[_0x8f9a('0x2')]));function MailQueue(_0x4e9e7c){this['id']=_0x4e9e7c['id']||0x0;this['name']=_0x4e9e7c[_0x8f9a('0x6')]||'';this[_0x8f9a('0x7')]=_0x4e9e7c['timeout']||0xa;this['strategy']=_0x4e9e7c[_0x8f9a('0x8')]||'beepall';this[_0x8f9a('0x9')]=_0x4e9e7c[_0x8f9a('0x9')];this[_0x8f9a('0xa')]={};this[_0x8f9a('0xb')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}MailQueue['prototype'][_0x8f9a('0xc')]=function(){var _0x1e3e85=this[_0x8f9a('0xa')][_0x8f9a('0xd')];this[_0x8f9a('0xa')]=_[_0x8f9a('0xe')](this[_0x8f9a('0x9')],'id');this['mapAgentsId'][_0x8f9a('0xd')]=_0x1e3e85;};MailQueue[_0x8f9a('0xf')][_0x8f9a('0x10')]=function(){this[_0x8f9a('0x11')]=0x0;this['paused']=0x0;for(var _0x2fd2a7=0x0;_0x2fd2a7=0x0?this[_0x8f9a('0x15')]:0x0;var _0x3d9d52={'id':this['id'],'available':this[_0x8f9a('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x8f9a('0x6')],'paused':this[_0x8f9a('0x16')],'waiting':this[_0x8f9a('0xb')]};var _0x1d1750=md5(JSON[_0x8f9a('0x17')](_0x3d9d52));if(this[_0x8f9a('0x18')]!==_0x1d1750){this[_0x8f9a('0x18')]=_0x1d1750;io['to'](util[_0x8f9a('0x19')](_0x8f9a('0x1a'),_0x3d9d52['name']))[_0x8f9a('0x1b')](_0x8f9a('0x1c'),_0x3d9d52);}};module[_0x8f9a('0x1d')]=MailQueue; \ No newline at end of file +var _0x8561=['waiting','prototype','mapAgentsId','_rr','map','Agents','updateRealtime','paused','online','loggedIn','mailPause','available','stringify','mail:queue:%s','name','emit','mail_queue:save','exports','md5','util','../../../config/environment','defaults','localhost','redis','timeout','strategy'];(function(_0x5a6653,_0x4f1ac6){var _0x2c5389=function(_0x2f2d4f){while(--_0x2f2d4f){_0x5a6653['push'](_0x5a6653['shift']());}};_0x2c5389(++_0x4f1ac6);}(_0x8561,0x1b2));var _0x1856=function(_0x260e4b,_0x54668d){_0x260e4b=_0x260e4b-0x0;var _0x18dfba=_0x8561[_0x260e4b];return _0x18dfba;};'use strict';var _=require('lodash');var md5=require(_0x1856('0x0'));var util=require(_0x1856('0x1'));var Redis=require('ioredis');var config=require(_0x1856('0x2'));config['redis']=_[_0x1856('0x3')](config['redis'],{'host':_0x1856('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1856('0x5')]));function MailQueue(_0xfb916c){this['id']=_0xfb916c['id']||0x0;this['name']=_0xfb916c['name']||'';this[_0x1856('0x6')]=_0xfb916c['timeout']||0xa;this['strategy']=_0xfb916c[_0x1856('0x7')]||'beepall';this['Agents']=_0xfb916c['Agents'];this['mapAgentsId']={};this[_0x1856('0x8')]=0x0;this[_0x1856('0x0')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x1856('0x9')]['updateRouting']=function(){var _0x342f95=this[_0x1856('0xa')][_0x1856('0xb')];this['mapAgentsId']=_[_0x1856('0xc')](this[_0x1856('0xd')],'id');this['mapAgentsId'][_0x1856('0xb')]=_0x342f95;};MailQueue[_0x1856('0x9')][_0x1856('0xe')]=function(){this['loggedIn']=0x0;this[_0x1856('0xf')]=0x0;for(var _0xc02b25=0x0;_0xc02b25=0x0?this['available']:0x0;var _0x1de74a={'id':this['id'],'available':this[_0x1856('0x13')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x1856('0xf')],'waiting':this[_0x1856('0x8')]};var _0xd19f62=md5(JSON[_0x1856('0x14')](_0x1de74a));if(this[_0x1856('0x0')]!==_0xd19f62){this[_0x1856('0x0')]=_0xd19f62;io['to'](util['format'](_0x1856('0x15'),_0x1de74a[_0x1856('0x16')]))[_0x1856('0x17')](_0x1856('0x18'),_0x1de74a);}};module[_0x1856('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 98a36b8..b2841ff 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 _0xd46a=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','exports','lodash','md5','ioredis','redis','defaults'];(function(_0x20e6c4,_0x573880){var _0x61fc99=function(_0x1a7f9c){while(--_0x1a7f9c){_0x20e6c4['push'](_0x20e6c4['shift']());}};_0x61fc99(++_0x573880);}(_0xd46a,0x73));var _0xad46=function(_0x4ada11,_0x5d5a2e){_0x4ada11=_0x4ada11-0x0;var _0x1d2958=_0xd46a[_0x4ada11];return _0x1d2958;};'use strict';var _=require(_0xad46('0x0'));var md5=require(_0xad46('0x1'));var util=require('util');var Redis=require(_0xad46('0x2'));var config=require('../../../config/environment');config[_0xad46('0x3')]=_[_0xad46('0x4')](config[_0xad46('0x3')],{'host':_0xad46('0x5'),'port':0x18eb});var io=require(_0xad46('0x6'))(new Redis(config['redis']));function OpenchannelQueue(_0x6dfe3e){this['id']=_0x6dfe3e['id']||0x0;this[_0xad46('0x7')]=_0x6dfe3e[_0xad46('0x7')]||'';this[_0xad46('0x8')]=_0x6dfe3e['timeout']||0xa;this[_0xad46('0x9')]=_0x6dfe3e[_0xad46('0x9')]||_0xad46('0xa');this['Agents']=_0x6dfe3e[_0xad46('0xb')];this['mapAgentsId']={};this[_0xad46('0xc')]=0x0;this[_0xad46('0x1')]='';this[_0xad46('0xd')]();this[_0xad46('0xe')]();}OpenchannelQueue[_0xad46('0xf')][_0xad46('0xd')]=function(){var _0x413ce9=this[_0xad46('0x10')][_0xad46('0x11')];this[_0xad46('0x10')]=_[_0xad46('0x12')](this[_0xad46('0xb')],'id');this[_0xad46('0x10')][_0xad46('0x11')]=_0x413ce9;};OpenchannelQueue['prototype'][_0xad46('0xe')]=function(){this[_0xad46('0x13')]=0x0;this[_0xad46('0x14')]=0x0;for(var _0x4d64c0=0x0;_0x4d64c0=0x0?this[_0xad46('0x18')]:0x0;var _0xc7f90b={'id':this['id'],'available':this[_0xad46('0x18')],'loggedIn':this[_0xad46('0x13')],'name':this[_0xad46('0x7')],'paused':this[_0xad46('0x14')],'waiting':this[_0xad46('0xc')]};var _0x8cfb41=md5(JSON[_0xad46('0x19')](_0xc7f90b));if(this[_0xad46('0x1')]!==_0x8cfb41){this[_0xad46('0x1')]=_0x8cfb41;io['to'](util[_0xad46('0x1a')](_0xad46('0x1b'),_0xc7f90b['name']))[_0xad46('0x1c')]('openchannel_queue:save',_0xc7f90b);}};module[_0xad46('0x1d')]=OpenchannelQueue; \ No newline at end of file +var _0x7dec=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','openchannelPause','available','emit','openchannel_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost'];(function(_0x12f194,_0x44d2de){var _0x4034c0=function(_0x3e5bee){while(--_0x3e5bee){_0x12f194['push'](_0x12f194['shift']());}};_0x4034c0(++_0x44d2de);}(_0x7dec,0x112));var _0xc7de=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0x7dec[_0xcfd89f];return _0x59acd4;};'use strict';var _=require(_0xc7de('0x0'));var md5=require('md5');var util=require(_0xc7de('0x1'));var Redis=require('ioredis');var config=require(_0xc7de('0x2'));config[_0xc7de('0x3')]=_[_0xc7de('0x4')](config[_0xc7de('0x3')],{'host':_0xc7de('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function OpenchannelQueue(_0x433823){this['id']=_0x433823['id']||0x0;this[_0xc7de('0x6')]=_0x433823[_0xc7de('0x6')]||'';this[_0xc7de('0x7')]=_0x433823['timeout']||0xa;this[_0xc7de('0x8')]=_0x433823[_0xc7de('0x8')]||_0xc7de('0x9');this[_0xc7de('0xa')]=_0x433823[_0xc7de('0xa')];this[_0xc7de('0xb')]={};this[_0xc7de('0xc')]=0x0;this[_0xc7de('0xd')]='';this[_0xc7de('0xe')]();this[_0xc7de('0xf')]();}OpenchannelQueue[_0xc7de('0x10')]['updateRouting']=function(){var _0x3deaf1=this[_0xc7de('0xb')][_0xc7de('0x11')];this[_0xc7de('0xb')]=_[_0xc7de('0x12')](this['Agents'],'id');this['mapAgentsId'][_0xc7de('0x11')]=_0x3deaf1;};OpenchannelQueue['prototype'][_0xc7de('0xf')]=function(){this[_0xc7de('0x13')]=0x0;this[_0xc7de('0x14')]=0x0;for(var _0x4d069e=0x0;_0x4d069e=0x0?this[_0xc7de('0x18')]:0x0;var _0x39af86={'id':this['id'],'available':this[_0xc7de('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xc7de('0x6')],'paused':this[_0xc7de('0x14')],'waiting':this['waiting']};var _0x20e19d=md5(JSON['stringify'](_0x39af86));if(this[_0xc7de('0xd')]!==_0x20e19d){this[_0xc7de('0xd')]=_0x20e19d;io['to'](util['format']('openchannel:queue:%s',_0x39af86[_0xc7de('0x6')]))[_0xc7de('0x19')](_0xc7de('0x1a'),_0x39af86);}};module[_0xc7de('0x1b')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 45d8489..658c783 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(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a58db,_0x2d7f41){_0x5a58db=_0x5a58db-0x0;var _0x42dd9a=_0xb10b[_0x5a58db];return _0x42dd9a;};'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(_0x436fa3,_0x17a81f){var _0x594b86=function(_0x39ee72){while(--_0x39ee72){_0x436fa3['push'](_0x436fa3['shift']());}};_0x594b86(++_0x17a81f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb7e7[_0x13d07a];return _0x5ee0ee;};'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 030832c..e7194b0 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 _0x3f02=['whatsapp_queue:save','exports','lodash','md5','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','whatsappPause','available','whatsapp:queue:%s'];(function(_0x2cc884,_0x4bc24b){var _0x4a3b52=function(_0x55e4ef){while(--_0x55e4ef){_0x2cc884['push'](_0x2cc884['shift']());}};_0x4a3b52(++_0x4bc24b);}(_0x3f02,0x154));var _0x23f0=function(_0x4de9e8,_0x565ffa){_0x4de9e8=_0x4de9e8-0x0;var _0x4db0de=_0x3f02[_0x4de9e8];return _0x4db0de;};'use strict';var _=require(_0x23f0('0x0'));var md5=require(_0x23f0('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x23f0('0x2'));config['redis']=_[_0x23f0('0x3')](config[_0x23f0('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x23f0('0x5'))(new Redis(config[_0x23f0('0x4')]));function WhatsappQueue(_0x23818a){this['id']=_0x23818a['id']||0x0;this[_0x23f0('0x6')]=_0x23818a[_0x23f0('0x6')]||'';this[_0x23f0('0x7')]=_0x23818a['timeout']||0xa;this[_0x23f0('0x8')]=_0x23818a[_0x23f0('0x8')]||_0x23f0('0x9');this['Agents']=_0x23818a[_0x23f0('0xa')];this[_0x23f0('0xb')]={};this[_0x23f0('0xc')]=0x0;this[_0x23f0('0x1')]='';this[_0x23f0('0xd')]();this[_0x23f0('0xe')]();}WhatsappQueue[_0x23f0('0xf')][_0x23f0('0xd')]=function(){var _0x30bbb7=this[_0x23f0('0xb')]['_rr'];this[_0x23f0('0xb')]=_[_0x23f0('0x10')](this[_0x23f0('0xa')],'id');this[_0x23f0('0xb')][_0x23f0('0x11')]=_0x30bbb7;};WhatsappQueue[_0x23f0('0xf')]['updateRealtime']=function(){this[_0x23f0('0x12')]=0x0;this[_0x23f0('0x13')]=0x0;for(var _0x394eff=0x0;_0x394eff=0x0?this[_0x23f0('0x16')]:0x0;var _0xb64f4d={'id':this['id'],'available':this[_0x23f0('0x16')],'loggedIn':this[_0x23f0('0x12')],'name':this[_0x23f0('0x6')],'paused':this[_0x23f0('0x13')],'waiting':this['waiting']};var _0x4e9a7a=md5(JSON['stringify'](_0xb64f4d));if(this[_0x23f0('0x1')]!==_0x4e9a7a){this[_0x23f0('0x1')]=_0x4e9a7a;io['to'](util['format'](_0x23f0('0x17'),_0xb64f4d[_0x23f0('0x6')]))['emit'](_0x23f0('0x18'),_0xb64f4d);}};module[_0x23f0('0x19')]=WhatsappQueue; \ No newline at end of file +var _0xa157=['loggedIn','paused','length','online','available','waiting','stringify','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','prototype','updateRouting','_rr','map','updateRealtime'];(function(_0x193595,_0x45f6d9){var _0x2e05aa=function(_0x4bf01f){while(--_0x4bf01f){_0x193595['push'](_0x193595['shift']());}};_0x2e05aa(++_0x45f6d9);}(_0xa157,0x149));var _0x7a15=function(_0xb3d870,_0x4ffa19){_0xb3d870=_0xb3d870-0x0;var _0x264608=_0xa157[_0xb3d870];return _0x264608;};'use strict';var _=require(_0x7a15('0x0'));var md5=require(_0x7a15('0x1'));var util=require(_0x7a15('0x2'));var Redis=require(_0x7a15('0x3'));var config=require(_0x7a15('0x4'));config[_0x7a15('0x5')]=_['defaults'](config[_0x7a15('0x5')],{'host':_0x7a15('0x6'),'port':0x18eb});var io=require(_0x7a15('0x7'))(new Redis(config[_0x7a15('0x5')]));function WhatsappQueue(_0x184294){this['id']=_0x184294['id']||0x0;this[_0x7a15('0x8')]=_0x184294[_0x7a15('0x8')]||'';this[_0x7a15('0x9')]=_0x184294[_0x7a15('0x9')]||0xa;this[_0x7a15('0xa')]=_0x184294[_0x7a15('0xa')]||_0x7a15('0xb');this[_0x7a15('0xc')]=_0x184294[_0x7a15('0xc')];this[_0x7a15('0xd')]={};this['waiting']=0x0;this[_0x7a15('0x1')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0x7a15('0xe')][_0x7a15('0xf')]=function(){var _0x286455=this[_0x7a15('0xd')][_0x7a15('0x10')];this['mapAgentsId']=_[_0x7a15('0x11')](this[_0x7a15('0xc')],'id');this[_0x7a15('0xd')][_0x7a15('0x10')]=_0x286455;};WhatsappQueue[_0x7a15('0xe')][_0x7a15('0x12')]=function(){this[_0x7a15('0x13')]=0x0;this[_0x7a15('0x14')]=0x0;for(var _0xaba99=0x0;_0xaba99=0x0?this[_0x7a15('0x17')]:0x0;var _0x2681fe={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7a15('0x13')],'name':this[_0x7a15('0x8')],'paused':this[_0x7a15('0x14')],'waiting':this[_0x7a15('0x18')]};var _0x51ab3a=md5(JSON[_0x7a15('0x19')](_0x2681fe));if(this[_0x7a15('0x1')]!==_0x51ab3a){this['md5']=_0x51ab3a;io['to'](util['format'](_0x7a15('0x1a'),_0x2681fe[_0x7a15('0x8')]))['emit'](_0x7a15('0x1b'),_0x2681fe);}};module[_0x7a15('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index f92c726..7a8d5a4 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 _0x3d7b=['chatQueues','initSmsQueues','initMailQueues','initFaxQueues','exports','util','lodash','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','intervals','openchannelQueues','smsQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initAgents','isUndefined','length','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues'];(function(_0x59c51c,_0x1472ac){var _0xd79a84=function(_0x4fc6ed){while(--_0x4fc6ed){_0x59c51c['push'](_0x59c51c['shift']());}};_0xd79a84(++_0x1472ac);}(_0x3d7b,0x1bf));var _0xb3d7=function(_0x263b0d,_0x2f1250){_0x263b0d=_0x263b0d-0x0;var _0x453d7f=_0x3d7b[_0x263b0d];return _0x453d7f;};'use strict';var BPromise=require('bluebird');var util=require(_0xb3d7('0x0'));var _=require(_0xb3d7('0x1'));var moment=require('moment');var Agent=require(_0xb3d7('0x2'));var Interval=require(_0xb3d7('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0xb3d7('0x4'));var SmsQueue=require(_0xb3d7('0x5'));var MailQueue=require(_0xb3d7('0x6'));var FaxQueue=require(_0xb3d7('0x7'));var Realtime=function(){this[_0xb3d7('0x8')]={};this[_0xb3d7('0x9')]={};this[_0xb3d7('0xa')]={};this['chatQueues']={};this[_0xb3d7('0xb')]={};this[_0xb3d7('0xc')]={};this[_0xb3d7('0xd')]={};this[_0xb3d7('0xe')]={};this[_0xb3d7('0xf')]={};this[_0xb3d7('0x10')]={};this[_0xb3d7('0x11')]={};this['faxQueuesWaitingInteractions']={};};function freeIsNotKey(_0x32d143,_0x3f8e22,_0x478ed8){var _0x330209=_[_0xb3d7('0x12')](_0x32d143,function(_0x4a34ec,_0x2a6fc4){return _0x4a34ec[_0x478ed8];});for(var _0x225d52 in _0x3f8e22){if(_0x3f8e22[_0xb3d7('0x13')](_0x225d52)){if(!_0x330209[_0x225d52]){delete _0x3f8e22[_0x225d52];}}}}Realtime['prototype'][_0xb3d7('0x14')]=function(_0x334430,_0x117460){for(var _0x2cb2ad in _0x117460){if(_0x334430[_0xb3d7('0x13')](_0x2cb2ad)){_0x334430[_0x2cb2ad]=_0x117460[_0x2cb2ad];}}};Realtime[_0xb3d7('0x15')][_0xb3d7('0x16')]=function(){var _0x3aa21c=this;return function(_0x30b3b0){if(_0x30b3b0){freeIsNotKey(_0x30b3b0,_0x3aa21c['agents'],'id');for(var _0x45bd45=0x0,_0x5b31b8={},_0x53402a={};_0x45bd45<_0x30b3b0['length'];_0x45bd45+=0x1){_0x5b31b8=_0x30b3b0[_0x45bd45];if(_[_0xb3d7('0x17')](_0x3aa21c[_0xb3d7('0x8')][_0x5b31b8['id']])){_0x3aa21c[_0xb3d7('0x8')][_0x5b31b8['id']]=new Agent(_0x5b31b8);}else{_0x3aa21c[_0xb3d7('0x14')](_0x3aa21c[_0xb3d7('0x8')][_0x5b31b8['id']],_0x5b31b8);}}}return _0x3aa21c[_0xb3d7('0x8')];};};Realtime[_0xb3d7('0x15')]['initIntervals']=function(){var _0x3bb840=this;return function(_0x2592c2){if(_0x2592c2){freeIsNotKey(_0x2592c2,_0x3bb840['intervals'],'id');for(var _0xdc43fa=0x0,_0x3e87db={},_0xf26b25={};_0xdc43fa<_0x2592c2[_0xb3d7('0x18')];_0xdc43fa+=0x1){_0x3e87db=_0x2592c2[_0xdc43fa];if(_[_0xb3d7('0x17')](_0x3bb840[_0xb3d7('0x9')][_0x3e87db['id']])){_0x3bb840['intervals'][_0x3e87db['id']]=new Interval(_0x3e87db);}else{_0x3bb840['mergeFromDatabase'](_0x3bb840[_0xb3d7('0x9')][_0x3e87db['id']],_0x3e87db);}}}return _0x3bb840[_0xb3d7('0x9')];};};Realtime['prototype'][_0xb3d7('0x19')]=function(){var _0x18ea90=this;return function(_0x2c2379){if(_0x2c2379){freeIsNotKey(_0x2c2379,_0x18ea90['openchannelQueues'],'id');for(var _0x28f8cd=0x0,_0x706e80={},_0x13ba02={};_0x28f8cd<_0x2c2379['length'];_0x28f8cd+=0x1){_0x706e80=_0x2c2379[_0x28f8cd];if(_['isUndefined'](_0x18ea90['openchannelQueues'][_0x706e80['id']])){_0x18ea90[_0xb3d7('0xa')][_0x706e80['id']]=new OpenchannelQueue(_0x706e80);}else{_0x18ea90['mergeFromDatabase'](_0x18ea90[_0xb3d7('0xa')][_0x706e80['id']],_0x706e80);}_0x18ea90[_0xb3d7('0xa')][_0x706e80['id']][_0xb3d7('0x1a')]();_0x18ea90['openchannelQueues'][_0x706e80['id']][_0xb3d7('0x1b')]();}}return _0x18ea90[_0xb3d7('0xa')];};};Realtime[_0xb3d7('0x15')][_0xb3d7('0x1c')]=function(){var _0x4e3003=this;return function(_0xee2da1){if(_0xee2da1){freeIsNotKey(_0xee2da1,_0x4e3003['chatQueues'],'id');for(var _0x3f214b=0x0,_0x5550bc={},_0x217eb9={};_0x3f214b<_0xee2da1['length'];_0x3f214b+=0x1){_0x5550bc=_0xee2da1[_0x3f214b];if(_[_0xb3d7('0x17')](_0x4e3003['chatQueues'][_0x5550bc['id']])){_0x4e3003[_0xb3d7('0x1d')][_0x5550bc['id']]=new ChatQueue(_0x5550bc);}else{_0x4e3003[_0xb3d7('0x14')](_0x4e3003[_0xb3d7('0x1d')][_0x5550bc['id']],_0x5550bc);}_0x4e3003[_0xb3d7('0x1d')][_0x5550bc['id']]['updateRouting']();_0x4e3003[_0xb3d7('0x1d')][_0x5550bc['id']][_0xb3d7('0x1b')]();}}return _0x4e3003[_0xb3d7('0x1d')];};};Realtime[_0xb3d7('0x15')][_0xb3d7('0x1e')]=function(){var _0x59d455=this;return function(_0x142e47){if(_0x142e47){freeIsNotKey(_0x142e47,_0x59d455['smsQueues'],'id');for(var _0x53a18c=0x0,_0x2388b3={},_0x48b093={};_0x53a18c<_0x142e47[_0xb3d7('0x18')];_0x53a18c+=0x1){_0x2388b3=_0x142e47[_0x53a18c];if(_['isUndefined'](_0x59d455['smsQueues'][_0x2388b3['id']])){_0x59d455[_0xb3d7('0xb')][_0x2388b3['id']]=new SmsQueue(_0x2388b3);}else{_0x59d455[_0xb3d7('0x14')](_0x59d455[_0xb3d7('0xb')][_0x2388b3['id']],_0x2388b3);}_0x59d455['smsQueues'][_0x2388b3['id']]['updateRouting']();_0x59d455[_0xb3d7('0xb')][_0x2388b3['id']][_0xb3d7('0x1b')]();}}return _0x59d455[_0xb3d7('0xb')];};};Realtime[_0xb3d7('0x15')][_0xb3d7('0x1f')]=function(){var _0x1505c6=this;return function(_0x410f62){if(_0x410f62){freeIsNotKey(_0x410f62,_0x1505c6['mailQueues'],'id');for(var _0x1cc499=0x0,_0x19cbf9={},_0x254f82={};_0x1cc499<_0x410f62[_0xb3d7('0x18')];_0x1cc499+=0x1){_0x19cbf9=_0x410f62[_0x1cc499];if(_['isUndefined'](_0x1505c6[_0xb3d7('0xc')][_0x19cbf9['id']])){_0x1505c6[_0xb3d7('0xc')][_0x19cbf9['id']]=new MailQueue(_0x19cbf9);}else{_0x1505c6[_0xb3d7('0x14')](_0x1505c6[_0xb3d7('0xc')][_0x19cbf9['id']],_0x19cbf9);}_0x1505c6['mailQueues'][_0x19cbf9['id']][_0xb3d7('0x1a')]();_0x1505c6[_0xb3d7('0xc')][_0x19cbf9['id']]['updateRealtime']();}}return _0x1505c6['mailQueues'];};};Realtime[_0xb3d7('0x15')][_0xb3d7('0x20')]=function(){var _0x17e1dc=this;return function(_0x2dbb3a){if(_0x2dbb3a){freeIsNotKey(_0x2dbb3a,_0x17e1dc[_0xb3d7('0xd')],'id');for(var _0x22ca1f=0x0,_0x562673={},_0x30333f={};_0x22ca1f<_0x2dbb3a[_0xb3d7('0x18')];_0x22ca1f+=0x1){_0x562673=_0x2dbb3a[_0x22ca1f];if(_[_0xb3d7('0x17')](_0x17e1dc[_0xb3d7('0xd')][_0x562673['id']])){_0x17e1dc[_0xb3d7('0xd')][_0x562673['id']]=new FaxQueue(_0x562673);}else{_0x17e1dc[_0xb3d7('0x14')](_0x17e1dc[_0xb3d7('0xd')][_0x562673['id']],_0x562673);}_0x17e1dc[_0xb3d7('0xd')][_0x562673['id']]['updateRouting']();_0x17e1dc[_0xb3d7('0xd')][_0x562673['id']][_0xb3d7('0x1b')]();}}return _0x17e1dc['faxQueues'];};};module[_0xb3d7('0x21')]=Realtime; \ No newline at end of file +var _0x05a8=['initAgents','length','isUndefined','intervals','initOpenchannelQueues','updateRouting','initChatQueues','updateRealtime','initMailQueues','initFaxQueues','bluebird','util','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/faxQueue','agents','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','hasOwnProperty'];(function(_0x2f04a6,_0x2c7333){var _0x4f1e77=function(_0xc2e6d0){while(--_0xc2e6d0){_0x2f04a6['push'](_0x2f04a6['shift']());}};_0x4f1e77(++_0x2c7333);}(_0x05a8,0xd0));var _0x805a=function(_0x1a74a5,_0x56c0fd){_0x1a74a5=_0x1a74a5-0x0;var _0x47e7bf=_0x05a8[_0x1a74a5];return _0x47e7bf;};'use strict';var BPromise=require(_0x805a('0x0'));var util=require(_0x805a('0x1'));var _=require(_0x805a('0x2'));var moment=require(_0x805a('0x3'));var Agent=require(_0x805a('0x4'));var Interval=require(_0x805a('0x5'));var OpenchannelQueue=require(_0x805a('0x6'));var ChatQueue=require(_0x805a('0x7'));var SmsQueue=require('../model/smsQueue');var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x805a('0x8'));var Realtime=function(){this[_0x805a('0x9')]={};this['intervals']={};this[_0x805a('0xa')]={};this[_0x805a('0xb')]={};this[_0x805a('0xc')]={};this[_0x805a('0xd')]={};this[_0x805a('0xe')]={};this['chatQueuesWaitingInteractions']={};this[_0x805a('0xf')]={};this[_0x805a('0x10')]={};this[_0x805a('0x11')]={};this[_0x805a('0x12')]={};};function freeIsNotKey(_0x96d53b,_0x150034,_0x1918c8){var _0x2bc0f0=_[_0x805a('0x13')](_0x96d53b,function(_0x38f954,_0x1b2e2d){return _0x38f954[_0x1918c8];});for(var _0x52a6c7 in _0x150034){if(_0x150034['hasOwnProperty'](_0x52a6c7)){if(!_0x2bc0f0[_0x52a6c7]){delete _0x150034[_0x52a6c7];}}}}Realtime[_0x805a('0x14')][_0x805a('0x15')]=function(_0x3362a8,_0x69b756){for(var _0x55e8b2 in _0x69b756){if(_0x3362a8[_0x805a('0x16')](_0x55e8b2)){_0x3362a8[_0x55e8b2]=_0x69b756[_0x55e8b2];}}};Realtime[_0x805a('0x14')][_0x805a('0x17')]=function(){var _0x3ba15e=this;return function(_0x34aec4){if(_0x34aec4){freeIsNotKey(_0x34aec4,_0x3ba15e[_0x805a('0x9')],'id');for(var _0x6c0a2e=0x0,_0x35ecf0={},_0x1922a4={};_0x6c0a2e<_0x34aec4[_0x805a('0x18')];_0x6c0a2e+=0x1){_0x35ecf0=_0x34aec4[_0x6c0a2e];if(_[_0x805a('0x19')](_0x3ba15e[_0x805a('0x9')][_0x35ecf0['id']])){_0x3ba15e[_0x805a('0x9')][_0x35ecf0['id']]=new Agent(_0x35ecf0);}else{_0x3ba15e[_0x805a('0x15')](_0x3ba15e['agents'][_0x35ecf0['id']],_0x35ecf0);}}}return _0x3ba15e['agents'];};};Realtime[_0x805a('0x14')]['initIntervals']=function(){var _0x22a323=this;return function(_0x12911d){if(_0x12911d){freeIsNotKey(_0x12911d,_0x22a323[_0x805a('0x1a')],'id');for(var _0x43df5e=0x0,_0x244526={},_0x458a38={};_0x43df5e<_0x12911d[_0x805a('0x18')];_0x43df5e+=0x1){_0x244526=_0x12911d[_0x43df5e];if(_['isUndefined'](_0x22a323[_0x805a('0x1a')][_0x244526['id']])){_0x22a323[_0x805a('0x1a')][_0x244526['id']]=new Interval(_0x244526);}else{_0x22a323[_0x805a('0x15')](_0x22a323[_0x805a('0x1a')][_0x244526['id']],_0x244526);}}}return _0x22a323['intervals'];};};Realtime['prototype'][_0x805a('0x1b')]=function(){var _0x3a91fe=this;return function(_0x2651c2){if(_0x2651c2){freeIsNotKey(_0x2651c2,_0x3a91fe[_0x805a('0xa')],'id');for(var _0x422b16=0x0,_0x4fb1a9={},_0x37df52={};_0x422b16<_0x2651c2[_0x805a('0x18')];_0x422b16+=0x1){_0x4fb1a9=_0x2651c2[_0x422b16];if(_['isUndefined'](_0x3a91fe[_0x805a('0xa')][_0x4fb1a9['id']])){_0x3a91fe[_0x805a('0xa')][_0x4fb1a9['id']]=new OpenchannelQueue(_0x4fb1a9);}else{_0x3a91fe[_0x805a('0x15')](_0x3a91fe['openchannelQueues'][_0x4fb1a9['id']],_0x4fb1a9);}_0x3a91fe['openchannelQueues'][_0x4fb1a9['id']][_0x805a('0x1c')]();_0x3a91fe[_0x805a('0xa')][_0x4fb1a9['id']]['updateRealtime']();}}return _0x3a91fe['openchannelQueues'];};};Realtime[_0x805a('0x14')][_0x805a('0x1d')]=function(){var _0x3ddb8c=this;return function(_0x496f65){if(_0x496f65){freeIsNotKey(_0x496f65,_0x3ddb8c[_0x805a('0xb')],'id');for(var _0x597e62=0x0,_0x37dbc3={},_0x114de0={};_0x597e62<_0x496f65['length'];_0x597e62+=0x1){_0x37dbc3=_0x496f65[_0x597e62];if(_[_0x805a('0x19')](_0x3ddb8c[_0x805a('0xb')][_0x37dbc3['id']])){_0x3ddb8c[_0x805a('0xb')][_0x37dbc3['id']]=new ChatQueue(_0x37dbc3);}else{_0x3ddb8c[_0x805a('0x15')](_0x3ddb8c[_0x805a('0xb')][_0x37dbc3['id']],_0x37dbc3);}_0x3ddb8c[_0x805a('0xb')][_0x37dbc3['id']]['updateRouting']();_0x3ddb8c['chatQueues'][_0x37dbc3['id']][_0x805a('0x1e')]();}}return _0x3ddb8c['chatQueues'];};};Realtime[_0x805a('0x14')]['initSmsQueues']=function(){var _0x2ba5d1=this;return function(_0x6a4c70){if(_0x6a4c70){freeIsNotKey(_0x6a4c70,_0x2ba5d1[_0x805a('0xc')],'id');for(var _0x4a9482=0x0,_0x600e76={},_0x533cd7={};_0x4a9482<_0x6a4c70[_0x805a('0x18')];_0x4a9482+=0x1){_0x600e76=_0x6a4c70[_0x4a9482];if(_[_0x805a('0x19')](_0x2ba5d1[_0x805a('0xc')][_0x600e76['id']])){_0x2ba5d1[_0x805a('0xc')][_0x600e76['id']]=new SmsQueue(_0x600e76);}else{_0x2ba5d1[_0x805a('0x15')](_0x2ba5d1[_0x805a('0xc')][_0x600e76['id']],_0x600e76);}_0x2ba5d1[_0x805a('0xc')][_0x600e76['id']][_0x805a('0x1c')]();_0x2ba5d1[_0x805a('0xc')][_0x600e76['id']]['updateRealtime']();}}return _0x2ba5d1['smsQueues'];};};Realtime[_0x805a('0x14')][_0x805a('0x1f')]=function(){var _0x1c1384=this;return function(_0x4808dd){if(_0x4808dd){freeIsNotKey(_0x4808dd,_0x1c1384[_0x805a('0xd')],'id');for(var _0x18a7e=0x0,_0x244dae={},_0x2e02c7={};_0x18a7e<_0x4808dd[_0x805a('0x18')];_0x18a7e+=0x1){_0x244dae=_0x4808dd[_0x18a7e];if(_[_0x805a('0x19')](_0x1c1384[_0x805a('0xd')][_0x244dae['id']])){_0x1c1384[_0x805a('0xd')][_0x244dae['id']]=new MailQueue(_0x244dae);}else{_0x1c1384['mergeFromDatabase'](_0x1c1384[_0x805a('0xd')][_0x244dae['id']],_0x244dae);}_0x1c1384[_0x805a('0xd')][_0x244dae['id']][_0x805a('0x1c')]();_0x1c1384['mailQueues'][_0x244dae['id']][_0x805a('0x1e')]();}}return _0x1c1384[_0x805a('0xd')];};};Realtime[_0x805a('0x14')][_0x805a('0x20')]=function(){var _0x440727=this;return function(_0x47aad4){if(_0x47aad4){freeIsNotKey(_0x47aad4,_0x440727['faxQueues'],'id');for(var _0x1c091c=0x0,_0x4ac64f={},_0x5e2b80={};_0x1c091c<_0x47aad4[_0x805a('0x18')];_0x1c091c+=0x1){_0x4ac64f=_0x47aad4[_0x1c091c];if(_[_0x805a('0x19')](_0x440727[_0x805a('0xe')][_0x4ac64f['id']])){_0x440727[_0x805a('0xe')][_0x4ac64f['id']]=new FaxQueue(_0x4ac64f);}else{_0x440727[_0x805a('0x15')](_0x440727[_0x805a('0xe')][_0x4ac64f['id']],_0x4ac64f);}_0x440727[_0x805a('0xe')][_0x4ac64f['id']][_0x805a('0x1c')]();_0x440727[_0x805a('0xe')][_0x4ac64f['id']][_0x805a('0x1e')]();}}return _0x440727[_0x805a('0xe')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 7f22d27..5eda22e 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 _0x42d5=['../client','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x39135d,_0x482dbd){var _0x2cfe5c=function(_0x2cb6bb){while(--_0x2cb6bb){_0x39135d['push'](_0x39135d['shift']());}};_0x2cfe5c(++_0x482dbd);}(_0x42d5,0x16d));var _0x542d=function(_0x1c53c1,_0x4d8664){_0x1c53c1=_0x1c53c1-0x0;var _0x50fe03=_0x42d5[_0x1c53c1];return _0x50fe03;};'use strict';var client=require(_0x542d('0x0'));exports['update']=function(_0x2000f6,_0x36b623){return client['Request'](_0x542d('0x1'),{'body':_0x36b623,'options':{'where':{'id':_0x2000f6}},'log':_0x542d('0x2')});};exports[_0x542d('0x3')]=function(_0x5e6193,_0x14a07c){return client['Request'](_0x542d('0x4'),{'body':_0x14a07c,'options':{'where':{'id':_0x5e6193}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x76ce=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','addTags'];(function(_0x32b396,_0x1375dc){var _0x5b5c46=function(_0x983796){while(--_0x983796){_0x32b396['push'](_0x32b396['shift']());}};_0x5b5c46(++_0x1375dc);}(_0x76ce,0x7f));var _0xe76c=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x76ce[_0x4ea69d];return _0x5318e0;};'use strict';var client=require(_0xe76c('0x0'));exports[_0xe76c('0x1')]=function(_0x322bc9,_0x5d3da8){return client[_0xe76c('0x2')](_0xe76c('0x3'),{'body':_0x5d3da8,'options':{'where':{'id':_0x322bc9}},'log':'updateChatInteraction'});};exports[_0xe76c('0x4')]=function(_0x258f8b,_0x4e37c5){return client[_0xe76c('0x2')]('AddTagsToChatInteraction',{'body':_0x4e37c5,'options':{'where':{'id':_0x258f8b}},'log':_0xe76c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index e9729ba..fa54bed 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 _0x6788=['createChatMessage','../client','Request','CreateChatMessage'];(function(_0x4156a5,_0x2db142){var _0x299821=function(_0x5f0b86){while(--_0x5f0b86){_0x4156a5['push'](_0x4156a5['shift']());}};_0x299821(++_0x2db142);}(_0x6788,0x1c1));var _0x8678=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x6788[_0x5f309e];return _0x487b5e;};'use strict';var client=require(_0x8678('0x0'));exports['create']=function(_0x47fafc){return client[_0x8678('0x1')](_0x8678('0x2'),{'body':_0x47fafc,'log':_0x8678('0x3')});}; \ No newline at end of file +var _0x47dd=['Request','CreateChatMessage','../client','create'];(function(_0x54d45b,_0x29eb31){var _0x1c59fb=function(_0x44b452){while(--_0x44b452){_0x54d45b['push'](_0x54d45b['shift']());}};_0x1c59fb(++_0x29eb31);}(_0x47dd,0x12a));var _0xd47d=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x47dd[_0x4e9628];return _0x27bc8c;};'use strict';var client=require(_0xd47d('0x0'));exports[_0xd47d('0x1')]=function(_0x2b2a95){return client[_0xd47d('0x2')](_0xd47d('0x3'),{'body':_0x2b2a95,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index fd1380d..5c6bfed 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 _0x3ab7=['timeout','strategy','User','online','chatPause','../client','getChatQueues','Request','name'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0x3ab7,0x68));var _0x73ab=function(_0x38fb0d,_0x52b5db){_0x38fb0d=_0x38fb0d-0x0;var _0x30a5d6=_0x3ab7[_0x38fb0d];return _0x30a5d6;};'use strict';var client=require(_0x73ab('0x0'));exports[_0x73ab('0x1')]=function(){return function(){return client[_0x73ab('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x73ab('0x3'),_0x73ab('0x4'),_0x73ab('0x5')],'include':[{'model':_0x73ab('0x6'),'as':'Agents','attributes':['id',_0x73ab('0x3'),_0x73ab('0x7'),_0x73ab('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xeedf=['timeout','strategy','User','Agents','online','chatPause','../client','GetChatQueue','name'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0xeedf,0x1b6));var _0xfeed=function(_0x5ddcdd,_0x298a98){_0x5ddcdd=_0x5ddcdd-0x0;var _0x2293ee=_0xeedf[_0x5ddcdd];return _0x2293ee;};'use strict';var client=require(_0xfeed('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0xfeed('0x1'),{'options':{'raw':![],'attributes':['id',_0xfeed('0x2'),_0xfeed('0x3'),_0xfeed('0x4')],'include':[{'model':_0xfeed('0x5'),'as':_0xfeed('0x6'),'attributes':['id','name',_0xfeed('0x7'),_0xfeed('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 29b1072..4c0fa90 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 _0x1b73=['UpdateChatQueueReport','create','Request','CreateChatQueueReport','update','DESC'];(function(_0x336211,_0x1ef1d){var _0x926ca4=function(_0x9fa801){while(--_0x9fa801){_0x336211['push'](_0x336211['shift']());}};_0x926ca4(++_0x1ef1d);}(_0x1b73,0x1d5));var _0x31b7=function(_0x2a7c07,_0x4be407){_0x2a7c07=_0x2a7c07-0x0;var _0x43c592=_0x1b73[_0x2a7c07];return _0x43c592;};'use strict';var client=require('../client');exports[_0x31b7('0x0')]=function(_0x25ee36){return client[_0x31b7('0x1')](_0x31b7('0x2'),{'body':_0x25ee36,'log':'CreateChatQueueReport'});};exports[_0x31b7('0x3')]=function(_0x59e606,_0x40fef2){return client[_0x31b7('0x1')]('UpdateChatQueueReport',{'body':_0x40fef2,'options':{'where':{'uniqueid':_0x59e606},'order':[['id',_0x31b7('0x4')]],'limit':0x1},'log':_0x31b7('0x5')});}; \ No newline at end of file +var _0x833b=['create','Request','CreateChatQueueReport','UpdateChatQueueReport','DESC'];(function(_0x138666,_0x16bc5a){var _0x483faa=function(_0x3093e7){while(--_0x3093e7){_0x138666['push'](_0x138666['shift']());}};_0x483faa(++_0x16bc5a);}(_0x833b,0x131));var _0xb833=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x833b[_0x31a371];return _0x2a5bd6;};'use strict';var client=require('../client');exports[_0xb833('0x0')]=function(_0x5ba71d){return client[_0xb833('0x1')]('CreateChatQueueReport',{'body':_0x5ba71d,'log':_0xb833('0x2')});};exports['update']=function(_0x66e74c,_0x37ea87){return client[_0xb833('0x1')](_0xb833('0x3'),{'body':_0x37ea87,'options':{'where':{'uniqueid':_0x66e74c},'order':[['id',_0xb833('0x4')]],'limit':0x1},'log':_0xb833('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 0009ee3..7adbf32 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 _0x40c1=['addTagsToFaxInteraction','Request','UpdateFaxInteraction','addTags'];(function(_0xa0be6a,_0x261bb2){var _0x2650bd=function(_0x555a48){while(--_0x555a48){_0xa0be6a['push'](_0xa0be6a['shift']());}};_0x2650bd(++_0x261bb2);}(_0x40c1,0x151));var _0x140c=function(_0x51f34d,_0x2a917a){_0x51f34d=_0x51f34d-0x0;var _0x1b95a6=_0x40c1[_0x51f34d];return _0x1b95a6;};'use strict';var client=require('../client');exports['update']=function(_0x265143,_0x47ba8f){return client[_0x140c('0x0')](_0x140c('0x1'),{'body':_0x47ba8f,'options':{'where':{'id':_0x265143}},'log':'updateFaxInteraction'});};exports[_0x140c('0x2')]=function(_0x104705,_0x37aa0f){return client[_0x140c('0x0')]('AddTagsToFaxInteraction',{'body':_0x37aa0f,'options':{'where':{'id':_0x104705}},'log':_0x140c('0x3')});}; \ No newline at end of file +var _0xe314=['Request','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client'];(function(_0x52a23f,_0x467b97){var _0x14c953=function(_0x53eba4){while(--_0x53eba4){_0x52a23f['push'](_0x52a23f['shift']());}};_0x14c953(++_0x467b97);}(_0xe314,0x99));var _0x4e31=function(_0x41ff1d,_0x3cfac8){_0x41ff1d=_0x41ff1d-0x0;var _0x53d6e7=_0xe314[_0x41ff1d];return _0x53d6e7;};'use strict';var client=require(_0x4e31('0x0'));exports['update']=function(_0x448be7,_0x35c314){return client[_0x4e31('0x1')](_0x4e31('0x2'),{'body':_0x35c314,'options':{'where':{'id':_0x448be7}},'log':_0x4e31('0x3')});};exports[_0x4e31('0x4')]=function(_0x3fc991,_0x542dcf){return client[_0x4e31('0x1')](_0x4e31('0x5'),{'body':_0x542dcf,'options':{'where':{'id':_0x3fc991}},'log':_0x4e31('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 30951ed..2926663 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 _0xd51d=['../client','Request','CreateFaxMessage'];(function(_0x30853f,_0x4aa320){var _0x3c416d=function(_0x15d3d2){while(--_0x15d3d2){_0x30853f['push'](_0x30853f['shift']());}};_0x3c416d(++_0x4aa320);}(_0xd51d,0xb7));var _0xdd51=function(_0x20a746,_0x5c788c){_0x20a746=_0x20a746-0x0;var _0x5c260f=_0xd51d[_0x20a746];return _0x5c260f;};'use strict';var client=require(_0xdd51('0x0'));exports['create']=function(_0x3f699c){return client[_0xdd51('0x1')](_0xdd51('0x2'),{'body':_0x3f699c,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xa999=['CreateFaxMessage','createFaxMessage','../client','Request'];(function(_0x18c9ab,_0x6ba7e7){var _0x17fc37=function(_0x57783c){while(--_0x57783c){_0x18c9ab['push'](_0x18c9ab['shift']());}};_0x17fc37(++_0x6ba7e7);}(_0xa999,0xf6));var _0x9a99=function(_0x353aeb,_0x2e90e1){_0x353aeb=_0x353aeb-0x0;var _0xbbefe2=_0xa999[_0x353aeb];return _0xbbefe2;};'use strict';var client=require(_0x9a99('0x0'));exports['create']=function(_0x320cb9){return client[_0x9a99('0x1')](_0x9a99('0x2'),{'body':_0x320cb9,'log':_0x9a99('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 844135a..a803012 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 _0x061c=['Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name'];(function(_0x1d0a8f,_0x59f9cd){var _0x895b1c=function(_0x4b1180){while(--_0x4b1180){_0x1d0a8f['push'](_0x1d0a8f['shift']());}};_0x895b1c(++_0x59f9cd);}(_0x061c,0x11b));var _0xc061=function(_0x5554ff,_0x51f42d){_0x5554ff=_0x5554ff-0x0;var _0x384c68=_0x061c[_0x5554ff];return _0x384c68;};'use strict';var client=require(_0xc061('0x0'));exports[_0xc061('0x1')]=function(){return function(){return client[_0xc061('0x2')](_0xc061('0x3'),{'options':{'raw':![],'attributes':['id',_0xc061('0x4'),'timeout','strategy'],'include':[{'model':'User','as':_0xc061('0x5'),'attributes':['id','name',_0xc061('0x6'),_0xc061('0x7')]}]},'log':_0xc061('0x1')});};}; \ No newline at end of file +var _0x0b5d=['GetFaxQueue','name','timeout','User','Agents','online','getFaxQueues'];(function(_0x445101,_0x2414bf){var _0x3c3d04=function(_0x249067){while(--_0x249067){_0x445101['push'](_0x445101['shift']());}};_0x3c3d04(++_0x2414bf);}(_0x0b5d,0xbc));var _0xd0b5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b5d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xd0b5('0x0')]=function(){return function(){return client['Request'](_0xd0b5('0x1'),{'options':{'raw':![],'attributes':['id',_0xd0b5('0x2'),_0xd0b5('0x3'),'strategy'],'include':[{'model':_0xd0b5('0x4'),'as':_0xd0b5('0x5'),'attributes':['id','name',_0xd0b5('0x6'),'faxPause']}]},'log':_0xd0b5('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 2c43110..2c90e26 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 _0x1352=['../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x5b34f6,_0x359486){var _0x3aedfb=function(_0x1a9fe8){while(--_0x1a9fe8){_0x5b34f6['push'](_0x5b34f6['shift']());}};_0x3aedfb(++_0x359486);}(_0x1352,0x17a));var _0x2135=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x1352[_0x34021d];return _0x16597b;};'use strict';var client=require(_0x2135('0x0'));exports[_0x2135('0x1')]=function(_0x166194){return client[_0x2135('0x2')](_0x2135('0x3'),{'body':_0x166194,'log':_0x2135('0x3')});};exports[_0x2135('0x4')]=function(_0x324ed4,_0x1bc7a7){return client[_0x2135('0x2')](_0x2135('0x5'),{'body':_0x1bc7a7,'options':{'where':{'uniqueid':_0x324ed4},'order':[['id',_0x2135('0x6')]],'limit':0x1},'log':_0x2135('0x5')});}; \ No newline at end of file +var _0x7103=['UpdateFaxQueueReport','../client','create','Request','update','DESC'];(function(_0x334bfc,_0x8cceb0){var _0x4248dc=function(_0x1b041e){while(--_0x1b041e){_0x334bfc['push'](_0x334bfc['shift']());}};_0x4248dc(++_0x8cceb0);}(_0x7103,0x1db));var _0x3710=function(_0x4956bb,_0xa0def6){_0x4956bb=_0x4956bb-0x0;var _0x361a65=_0x7103[_0x4956bb];return _0x361a65;};'use strict';var client=require(_0x3710('0x0'));exports[_0x3710('0x1')]=function(_0x33e3e8){return client[_0x3710('0x2')]('CreateFaxQueueReport',{'body':_0x33e3e8,'log':'CreateFaxQueueReport'});};exports[_0x3710('0x3')]=function(_0x28e8b0,_0x176c83){return client['Request']('UpdateFaxQueueReport',{'body':_0x176c83,'options':{'where':{'uniqueid':_0x28e8b0},'order':[['id',_0x3710('0x4')]],'limit':0x1},'log':_0x3710('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 6f35bc8..ccd029a 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 _0xb78e=['Intervals','interval','../client','getIntervals','GetInterval','name','Interval'];(function(_0x5b3c61,_0x3eb2aa){var _0x153389=function(_0x2a1a99){while(--_0x2a1a99){_0x5b3c61['push'](_0x5b3c61['shift']());}};_0x153389(++_0x3eb2aa);}(_0xb78e,0x1c9));var _0xeb78=function(_0x23456b,_0x4ba795){_0x23456b=_0x23456b-0x0;var _0x26d8f4=_0xb78e[_0x23456b];return _0x26d8f4;};'use strict';var client=require(_0xeb78('0x0'));exports[_0xeb78('0x1')]=function(){return function(){return client['Request'](_0xeb78('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xeb78('0x3')],'include':[{'model':_0xeb78('0x4'),'as':_0xeb78('0x5'),'attributes':['id',_0xeb78('0x3'),_0xeb78('0x6')]}]},'log':_0xeb78('0x1')});};}; \ No newline at end of file +var _0x2f3a=['GetInterval','name','Interval','Intervals','interval','../client'];(function(_0xb8337f,_0xd3bf9e){var _0x182274=function(_0x3392c7){while(--_0x3392c7){_0xb8337f['push'](_0xb8337f['shift']());}};_0x182274(++_0xd3bf9e);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x3c167b,_0x3f0be8){_0x3c167b=_0x3c167b-0x0;var _0x30cd18=_0x2f3a[_0x3c167b];return _0x30cd18;};'use strict';var client=require(_0xa2f3('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0xa2f3('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa2f3('0x2')],'include':[{'model':_0xa2f3('0x3'),'as':_0xa2f3('0x4'),'attributes':['id',_0xa2f3('0x2'),_0xa2f3('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 c88e2fb..3aacee2 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 _0xee17=['Request','addTagsToChatInteraction','../client','UpdateMailInteraction','updateMailInteraction'];(function(_0x4173e1,_0xeabb57){var _0x2cda01=function(_0x19cbbd){while(--_0x19cbbd){_0x4173e1['push'](_0x4173e1['shift']());}};_0x2cda01(++_0xeabb57);}(_0xee17,0xf2));var _0x7ee1=function(_0x3d75b1,_0x16ce20){_0x3d75b1=_0x3d75b1-0x0;var _0xa24de7=_0xee17[_0x3d75b1];return _0xa24de7;};'use strict';var client=require(_0x7ee1('0x0'));exports['update']=function(_0x174374,_0x42d1ec){return client['Request'](_0x7ee1('0x1'),{'body':_0x42d1ec,'options':{'where':{'id':_0x174374}},'log':_0x7ee1('0x2')});};exports['addTags']=function(_0x252cbf,_0x29af44){return client[_0x7ee1('0x3')]('AddTagsToMailInteraction',{'body':_0x29af44,'options':{'where':{'id':_0x252cbf}},'log':_0x7ee1('0x4')});}; \ No newline at end of file +var _0xd398=['../client','update','updateMailInteraction'];(function(_0x8215b5,_0x5b6e69){var _0xcb515=function(_0x6177f4){while(--_0x6177f4){_0x8215b5['push'](_0x8215b5['shift']());}};_0xcb515(++_0x5b6e69);}(_0xd398,0x11a));var _0x8d39=function(_0x2e726e,_0x3faf87){_0x2e726e=_0x2e726e-0x0;var _0x273748=_0xd398[_0x2e726e];return _0x273748;};'use strict';var client=require(_0x8d39('0x0'));exports[_0x8d39('0x1')]=function(_0x4546c8,_0x41b120){return client['Request']('UpdateMailInteraction',{'body':_0x41b120,'options':{'where':{'id':_0x4546c8}},'log':_0x8d39('0x2')});};exports['addTags']=function(_0x3ad03a,_0x78f820){return client['Request']('AddTagsToMailInteraction',{'body':_0x78f820,'options':{'where':{'id':_0x3ad03a}},'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 a6801b1..e104c26 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 _0x5c81=['../client','CreateMailMessage','createMailMessage'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x5c81,0x108));var _0x15c8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c81[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x15c8('0x0'));exports['create']=function(_0x442ade){return client['Request'](_0x15c8('0x1'),{'body':_0x442ade,'log':_0x15c8('0x2')});}; \ No newline at end of file +var _0xbebe=['Request','createMailMessage','../client','create'];(function(_0x23b60a,_0x2c6ca0){var _0x4604bf=function(_0x34454c){while(--_0x34454c){_0x23b60a['push'](_0x23b60a['shift']());}};_0x4604bf(++_0x2c6ca0);}(_0xbebe,0xc6));var _0xebeb=function(_0x43d7fe,_0x59afdd){_0x43d7fe=_0x43d7fe-0x0;var _0x4f29b1=_0xbebe[_0x43d7fe];return _0x4f29b1;};'use strict';var client=require(_0xebeb('0x0'));exports[_0xebeb('0x1')]=function(_0x130ee3){return client[_0xebeb('0x2')]('CreateMailMessage',{'body':_0x130ee3,'log':_0xebeb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 2c4341d..7531271 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 _0x2421=['User','Agents','online','mailPause','../client','Request','GetMailQueue','name','timeout','strategy'];(function(_0x2679b0,_0x2a1a6f){var _0x192302=function(_0x258202){while(--_0x258202){_0x2679b0['push'](_0x2679b0['shift']());}};_0x192302(++_0x2a1a6f);}(_0x2421,0x16c));var _0x1242=function(_0x1af577,_0x1bd440){_0x1af577=_0x1af577-0x0;var _0x18ec4f=_0x2421[_0x1af577];return _0x18ec4f;};'use strict';var client=require(_0x1242('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x1242('0x1')](_0x1242('0x2'),{'options':{'raw':![],'attributes':['id',_0x1242('0x3'),_0x1242('0x4'),_0x1242('0x5')],'include':[{'model':_0x1242('0x6'),'as':_0x1242('0x7'),'attributes':['id',_0x1242('0x3'),_0x1242('0x8'),_0x1242('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x74c7=['GetMailQueue','name','timeout','strategy','Agents','getMailQueues','../client'];(function(_0x4ec963,_0x1d7da){var _0x369a4b=function(_0x323286){while(--_0x323286){_0x4ec963['push'](_0x4ec963['shift']());}};_0x369a4b(++_0x1d7da);}(_0x74c7,0x109));var _0x774c=function(_0x523ee0,_0x242237){_0x523ee0=_0x523ee0-0x0;var _0x5ed871=_0x74c7[_0x523ee0];return _0x5ed871;};'use strict';var client=require(_0x774c('0x0'));exports['getMailQueues']=function(){return function(){return client['Request'](_0x774c('0x1'),{'options':{'raw':![],'attributes':['id',_0x774c('0x2'),_0x774c('0x3'),_0x774c('0x4')],'include':[{'model':'User','as':_0x774c('0x5'),'attributes':['id',_0x774c('0x2'),'online','mailPause']}]},'log':_0x774c('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 79f4359..b7885cc 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 _0xd8f2=['update','UpdateMailQueueReport','../client','create','Request','CreateMailQueueReport'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0xd8f2,0x140));var _0x2d8f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd8f2[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x2d8f('0x0'));exports[_0x2d8f('0x1')]=function(_0x4fc7a6){return client[_0x2d8f('0x2')](_0x2d8f('0x3'),{'body':_0x4fc7a6,'log':_0x2d8f('0x3')});};exports[_0x2d8f('0x4')]=function(_0x4abc40,_0x191f88){return client[_0x2d8f('0x2')]('UpdateMailQueueReport',{'body':_0x191f88,'options':{'where':{'uniqueid':_0x4abc40},'order':[['id','DESC']],'limit':0x1},'log':_0x2d8f('0x5')});}; \ No newline at end of file +var _0x640d=['create','Request','CreateMailQueueReport','UpdateMailQueueReport','../client'];(function(_0x4f004f,_0x3ec1ca){var _0x3cd3bf=function(_0x3e7ad8){while(--_0x3e7ad8){_0x4f004f['push'](_0x4f004f['shift']());}};_0x3cd3bf(++_0x3ec1ca);}(_0x640d,0x1ee));var _0xd640=function(_0x3e6c85,_0xf9c7c2){_0x3e6c85=_0x3e6c85-0x0;var _0x20bfa5=_0x640d[_0x3e6c85];return _0x20bfa5;};'use strict';var client=require(_0xd640('0x0'));exports[_0xd640('0x1')]=function(_0x46241e){return client[_0xd640('0x2')]('CreateMailQueueReport',{'body':_0x46241e,'log':_0xd640('0x3')});};exports['update']=function(_0x519fe5,_0x1cb1bc){return client[_0xd640('0x2')](_0xd640('0x4'),{'body':_0x1cb1bc,'options':{'where':{'uniqueid':_0x519fe5},'order':[['id','DESC']],'limit':0x1},'log':_0xd640('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 815fd0f..5e301f8 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 _0xa991=['updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x461115,_0x45aad6){var _0x35d2aa=function(_0x2b7355){while(--_0x2b7355){_0x461115['push'](_0x461115['shift']());}};_0x35d2aa(++_0x45aad6);}(_0xa991,0xd5));var _0x1a99=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xa991[_0x4d613c];return _0x301fe3;};'use strict';var client=require(_0x1a99('0x0'));exports[_0x1a99('0x1')]=function(_0x1d8c5b,_0x3a9186){return client[_0x1a99('0x2')](_0x1a99('0x3'),{'body':_0x3a9186,'options':{'where':{'id':_0x1d8c5b}},'log':_0x1a99('0x4')});};exports[_0x1a99('0x5')]=function(_0x5b0c31,_0x3791a3){return client[_0x1a99('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x3791a3,'options':{'where':{'id':_0x5b0c31}},'log':_0x1a99('0x6')});}; \ No newline at end of file +var _0xb9c7=['Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x1976b4,_0x38a1c7){var _0x698bfc=function(_0x1b0421){while(--_0x1b0421){_0x1976b4['push'](_0x1976b4['shift']());}};_0x698bfc(++_0x38a1c7);}(_0xb9c7,0x1b3));var _0x7b9c=function(_0x15cd0e,_0x126459){_0x15cd0e=_0x15cd0e-0x0;var _0x40c6d7=_0xb9c7[_0x15cd0e];return _0x40c6d7;};'use strict';var client=require(_0x7b9c('0x0'));exports[_0x7b9c('0x1')]=function(_0xdc59fa,_0x1d0105){return client['Request'](_0x7b9c('0x2'),{'body':_0x1d0105,'options':{'where':{'id':_0xdc59fa}},'log':_0x7b9c('0x3')});};exports[_0x7b9c('0x4')]=function(_0x537dc6,_0x4f0414){return client[_0x7b9c('0x5')](_0x7b9c('0x6'),{'body':_0x4f0414,'options':{'where':{'id':_0x537dc6}},'log':_0x7b9c('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 3374b61..60f81cf 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 _0x9c44=['createOpenchannelMessage','Request','CreateOpenchannelMessage'];(function(_0x50d6b3,_0x5091b3){var _0x340807=function(_0x2e99be){while(--_0x2e99be){_0x50d6b3['push'](_0x50d6b3['shift']());}};_0x340807(++_0x5091b3);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x2')});}; \ No newline at end of file +var _0x00bb=['CreateOpenchannelMessage','../client','create'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0x00bb,0x1d8));var _0xb00b=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x00bb[_0x55e08b];return _0xd1a7ff;};'use strict';var client=require(_0xb00b('0x0'));exports[_0xb00b('0x1')]=function(_0x468a51){return client['Request'](_0xb00b('0x2'),{'body':_0x468a51,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 5541f53..3690eda 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 _0x5dc3=['timeout','strategy','User','name','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0xdd3f14,_0x262dbb){var _0x46e9a4=function(_0x400894){while(--_0x400894){_0xdd3f14['push'](_0xdd3f14['shift']());}};_0x46e9a4(++_0x262dbb);}(_0x5dc3,0x10a));var _0x35dc=function(_0x488163,_0x51204f){_0x488163=_0x488163-0x0;var _0x1ba13b=_0x5dc3[_0x488163];return _0x1ba13b;};'use strict';var client=require(_0x35dc('0x0'));exports[_0x35dc('0x1')]=function(){return function(){return client[_0x35dc('0x2')](_0x35dc('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x35dc('0x4'),_0x35dc('0x5')],'include':[{'model':_0x35dc('0x6'),'as':'Agents','attributes':['id',_0x35dc('0x7'),_0x35dc('0x8'),_0x35dc('0x9')]}]},'log':_0x35dc('0x1')});};}; \ No newline at end of file +var _0xe608=['GetOpenchannelQueue','timeout','User','Agents','name','online','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0x31756f,_0x4356c6){var _0x5b1331=function(_0x33f069){while(--_0x33f069){_0x31756f['push'](_0x31756f['shift']());}};_0x5b1331(++_0x4356c6);}(_0xe608,0xe3));var _0x8e60=function(_0x57b3df,_0x445081){_0x57b3df=_0x57b3df-0x0;var _0x206656=_0xe608[_0x57b3df];return _0x206656;};'use strict';var client=require(_0x8e60('0x0'));exports[_0x8e60('0x1')]=function(){return function(){return client[_0x8e60('0x2')](_0x8e60('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8e60('0x4'),'strategy'],'include':[{'model':_0x8e60('0x5'),'as':_0x8e60('0x6'),'attributes':['id',_0x8e60('0x7'),_0x8e60('0x8'),_0x8e60('0x9')]}]},'log':_0x8e60('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index ba69cd5..9b6b16a 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 _0x6e40=['../client','create','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport'];(function(_0x1d051e,_0xd6eb3d){var _0x46b8f2=function(_0x276912){while(--_0x276912){_0x1d051e['push'](_0x1d051e['shift']());}};_0x46b8f2(++_0xd6eb3d);}(_0x6e40,0xeb));var _0x06e4=function(_0x18f8ce,_0x433ab4){_0x18f8ce=_0x18f8ce-0x0;var _0x4756e1=_0x6e40[_0x18f8ce];return _0x4756e1;};'use strict';var client=require(_0x06e4('0x0'));exports[_0x06e4('0x1')]=function(_0x83cf76){return client[_0x06e4('0x2')]('CreateOpenchannelQueueReport',{'body':_0x83cf76,'log':_0x06e4('0x3')});};exports['update']=function(_0x24e18d,_0x2b5c10){return client[_0x06e4('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x2b5c10,'options':{'where':{'uniqueid':_0x24e18d},'order':[['id','DESC']],'limit':0x1},'log':_0x06e4('0x4')});}; \ No newline at end of file +var _0xa0fa=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x20707e,_0x5f14bc){var _0xfe6c7f=function(_0x480a34){while(--_0x480a34){_0x20707e['push'](_0x20707e['shift']());}};_0xfe6c7f(++_0x5f14bc);}(_0xa0fa,0x1c4));var _0xaa0f=function(_0x28ac8f,_0x1f3c70){_0x28ac8f=_0x28ac8f-0x0;var _0x3e086e=_0xa0fa[_0x28ac8f];return _0x3e086e;};'use strict';var client=require(_0xaa0f('0x0'));exports[_0xaa0f('0x1')]=function(_0x21870a){return client[_0xaa0f('0x2')]('CreateOpenchannelQueueReport',{'body':_0x21870a,'log':_0xaa0f('0x3')});};exports[_0xaa0f('0x4')]=function(_0x2e9122,_0x359d41){return client[_0xaa0f('0x2')](_0xaa0f('0x5'),{'body':_0x359d41,'options':{'where':{'uniqueid':_0x2e9122},'order':[['id',_0xaa0f('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index b9b3d27..1b0a934 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 _0x9dd7=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x2c786e,_0x30fffa){var _0x484a60=function(_0x3ffcd1){while(--_0x3ffcd1){_0x2c786e['push'](_0x2c786e['shift']());}};_0x484a60(++_0x30fffa);}(_0x9dd7,0x195));var _0x79dd=function(_0x2b1c37,_0x7d244){_0x2b1c37=_0x2b1c37-0x0;var _0x5caa21=_0x9dd7[_0x2b1c37];return _0x5caa21;};'use strict';var client=require(_0x79dd('0x0'));exports['update']=function(_0x274868,_0x146763){return client[_0x79dd('0x1')](_0x79dd('0x2'),{'body':_0x146763,'options':{'where':{'id':_0x274868}},'log':_0x79dd('0x3')});};exports[_0x79dd('0x4')]=function(_0x28cc97,_0x1e7b40){return client[_0x79dd('0x1')](_0x79dd('0x5'),{'body':_0x1e7b40,'options':{'where':{'id':_0x28cc97}},'log':_0x79dd('0x6')});}; \ No newline at end of file +var _0x0cbd=['../client','update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x136782,_0x2b9a90){var _0x2931d5=function(_0x37e545){while(--_0x37e545){_0x136782['push'](_0x136782['shift']());}};_0x2931d5(++_0x2b9a90);}(_0x0cbd,0x138));var _0xd0cb=function(_0x9c3e90,_0x3a006b){_0x9c3e90=_0x9c3e90-0x0;var _0xb2ffff=_0x0cbd[_0x9c3e90];return _0xb2ffff;};'use strict';var client=require(_0xd0cb('0x0'));exports[_0xd0cb('0x1')]=function(_0x83f043,_0xb23a80){return client[_0xd0cb('0x2')]('UpdateSmsInteraction',{'body':_0xb23a80,'options':{'where':{'id':_0x83f043}},'log':_0xd0cb('0x3')});};exports[_0xd0cb('0x4')]=function(_0x342f66,_0x2dc954){return client[_0xd0cb('0x2')](_0xd0cb('0x5'),{'body':_0x2dc954,'options':{'where':{'id':_0x342f66}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 41062f8..a3c96a3 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 _0xfea3=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x1e53e0,_0x17c2b0){var _0x293cdf=function(_0x3bf7ce){while(--_0x3bf7ce){_0x1e53e0['push'](_0x1e53e0['shift']());}};_0x293cdf(++_0x17c2b0);}(_0xfea3,0x69));var _0x3fea=function(_0x22fa2d,_0x1eb0ab){_0x22fa2d=_0x22fa2d-0x0;var _0x275a88=_0xfea3[_0x22fa2d];return _0x275a88;};'use strict';var client=require(_0x3fea('0x0'));exports[_0x3fea('0x1')]=function(_0x65bbe5){return client[_0x3fea('0x2')](_0x3fea('0x3'),{'body':_0x65bbe5,'log':_0x3fea('0x4')});}; \ No newline at end of file +var _0xd5cd=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x16672f,_0x1555a6){var _0x3c9856=function(_0x4eac80){while(--_0x4eac80){_0x16672f['push'](_0x16672f['shift']());}};_0x3c9856(++_0x1555a6);}(_0xd5cd,0x7e));var _0xdd5c=function(_0x16d8c5,_0x3e97f0){_0x16d8c5=_0x16d8c5-0x0;var _0x447362=_0xd5cd[_0x16d8c5];return _0x447362;};'use strict';var client=require(_0xdd5c('0x0'));exports[_0xdd5c('0x1')]=function(_0x66b732){return client[_0xdd5c('0x2')](_0xdd5c('0x3'),{'body':_0x66b732,'log':_0xdd5c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 9611bc0..7e5f549 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 _0x8b0e=['Request','GetSmsQueue','name','timeout','User','online','smsPause','../client','getSmsQueues'];(function(_0x31a938,_0x4daec6){var _0x1bf341=function(_0x514261){while(--_0x514261){_0x31a938['push'](_0x31a938['shift']());}};_0x1bf341(++_0x4daec6);}(_0x8b0e,0x166));var _0xe8b0=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0x8b0e[_0x3f2a90];return _0xb46279;};'use strict';var client=require(_0xe8b0('0x0'));exports[_0xe8b0('0x1')]=function(){return function(){return client[_0xe8b0('0x2')](_0xe8b0('0x3'),{'options':{'raw':![],'attributes':['id',_0xe8b0('0x4'),_0xe8b0('0x5'),'strategy'],'include':[{'model':_0xe8b0('0x6'),'as':'Agents','attributes':['id',_0xe8b0('0x4'),_0xe8b0('0x7'),_0xe8b0('0x8')]}]},'log':_0xe8b0('0x1')});};}; \ No newline at end of file +var _0x867e=['name','strategy','Agents','online','smsPause','../client','getSmsQueues','Request'];(function(_0x48382d,_0x3cdb87){var _0x2ddf03=function(_0x441002){while(--_0x441002){_0x48382d['push'](_0x48382d['shift']());}};_0x2ddf03(++_0x3cdb87);}(_0x867e,0x1c5));var _0xe867=function(_0x5b6e36,_0x1c208e){_0x5b6e36=_0x5b6e36-0x0;var _0x339d08=_0x867e[_0x5b6e36];return _0x339d08;};'use strict';var client=require(_0xe867('0x0'));exports[_0xe867('0x1')]=function(){return function(){return client[_0xe867('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0xe867('0x3'),'timeout',_0xe867('0x4')],'include':[{'model':'User','as':_0xe867('0x5'),'attributes':['id',_0xe867('0x3'),_0xe867('0x6'),_0xe867('0x7')]}]},'log':_0xe867('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index a3f9dc5..9db5fa5 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 _0x7e83=['Request','CreateSmsQueueReport','DESC','UpdateSmsQueueReport','../client','create'];(function(_0x206aa7,_0x5b96b4){var _0xaf2afd=function(_0x2fa04d){while(--_0x2fa04d){_0x206aa7['push'](_0x206aa7['shift']());}};_0xaf2afd(++_0x5b96b4);}(_0x7e83,0x7c));var _0x37e8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e83[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x37e8('0x0'));exports[_0x37e8('0x1')]=function(_0x3f9ac8){return client[_0x37e8('0x2')](_0x37e8('0x3'),{'body':_0x3f9ac8,'log':'CreateSmsQueueReport'});};exports['update']=function(_0x46b401,_0x40aec2){return client[_0x37e8('0x2')]('UpdateSmsQueueReport',{'body':_0x40aec2,'options':{'where':{'uniqueid':_0x46b401},'order':[['id',_0x37e8('0x4')]],'limit':0x1},'log':_0x37e8('0x5')});}; \ No newline at end of file +var _0xd943=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x28d77b,_0x5751e2){var _0x51907a=function(_0x2499c9){while(--_0x2499c9){_0x28d77b['push'](_0x28d77b['shift']());}};_0x51907a(++_0x5751e2);}(_0xd943,0xa8));var _0x3d94=function(_0x375a47,_0x95549c){_0x375a47=_0x375a47-0x0;var _0x3d504c=_0xd943[_0x375a47];return _0x3d504c;};'use strict';var client=require('../client');exports[_0x3d94('0x0')]=function(_0x30f33d){return client[_0x3d94('0x1')](_0x3d94('0x2'),{'body':_0x30f33d,'log':'CreateSmsQueueReport'});};exports[_0x3d94('0x3')]=function(_0x384bb3,_0x322199){return client[_0x3d94('0x1')](_0x3d94('0x4'),{'body':_0x322199,'options':{'where':{'uniqueid':_0x384bb3},'order':[['id',_0x3d94('0x5')]],'limit':0x1},'log':_0x3d94('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 195256d..2f6647c 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 _0xc64a=['online','lastPauseAt','chatPause','faxPause','smsPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','agent','name'];(function(_0x4c9393,_0x20e6de){var _0x580eda=function(_0x5dfce1){while(--_0x5dfce1){_0x4c9393['push'](_0x4c9393['shift']());}};_0x580eda(++_0x20e6de);}(_0xc64a,0xf8));var _0xac64=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc64a[_0x3511d3];return _0x5d6321;};'use strict';var client=require(_0xac64('0x0'));exports[_0xac64('0x1')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0xac64('0x2')},'attributes':['id',_0xac64('0x3'),_0xac64('0x4'),'pauseType',_0xac64('0x5'),'voicePause',_0xac64('0x6'),'mailPause',_0xac64('0x7'),_0xac64('0x8'),'openchannelPause',_0xac64('0x9'),_0xac64('0xa'),_0xac64('0xb'),_0xac64('0xc'),_0xac64('0xd')]},'log':_0xac64('0x1')});};}; \ No newline at end of file +var _0x5106=['GetUser','agent','name','online','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','chatCapacity','mailCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x4e685b,_0x165100){var _0x53cb40=function(_0x33054d){while(--_0x33054d){_0x4e685b['push'](_0x4e685b['shift']());}};_0x53cb40(++_0x165100);}(_0x5106,0x1b7));var _0x6510=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5106[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x6510('0x0'));exports[_0x6510('0x1')]=function(){return function(){return client[_0x6510('0x2')](_0x6510('0x3'),{'options':{'raw':!![],'where':{'role':_0x6510('0x4')},'attributes':['id',_0x6510('0x5'),_0x6510('0x6'),_0x6510('0x7'),_0x6510('0x8'),_0x6510('0x9'),_0x6510('0xa'),_0x6510('0xb'),'faxPause',_0x6510('0xc'),'openchannelPause',_0x6510('0xd'),_0x6510('0xe'),'faxCapacity',_0x6510('0xf'),_0x6510('0x10')]},'log':_0x6510('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 24db022..00964f1 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 _0xf9f7=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction'];(function(_0x1053bf,_0x2812a4){var _0x4bebc8=function(_0x11d9a1){while(--_0x11d9a1){_0x1053bf['push'](_0x1053bf['shift']());}};_0x4bebc8(++_0x2812a4);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x53b071,_0x1e4fcf){_0x53b071=_0x53b071-0x0;var _0xf1c6c1=_0xf9f7[_0x53b071];return _0xf1c6c1;};'use strict';var client=require(_0x7f9f('0x0'));exports[_0x7f9f('0x1')]=function(_0x184c01,_0x182c25){return client[_0x7f9f('0x2')](_0x7f9f('0x3'),{'body':_0x182c25,'options':{'where':{'id':_0x184c01}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x440672,_0x439585){return client[_0x7f9f('0x2')](_0x7f9f('0x4'),{'body':_0x439585,'options':{'where':{'id':_0x440672}},'log':_0x7f9f('0x5')});}; \ No newline at end of file +var _0x8f1f=['updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction'];(function(_0x319b0e,_0x3de987){var _0x30d3ec=function(_0x2ac50a){while(--_0x2ac50a){_0x319b0e['push'](_0x319b0e['shift']());}};_0x30d3ec(++_0x3de987);}(_0x8f1f,0xe1));var _0xf8f1=function(_0x218adb,_0x144ffc){_0x218adb=_0x218adb-0x0;var _0x15e8eb=_0x8f1f[_0x218adb];return _0x15e8eb;};'use strict';var client=require(_0xf8f1('0x0'));exports['update']=function(_0x5e7760,_0x283cd7){return client[_0xf8f1('0x1')](_0xf8f1('0x2'),{'body':_0x283cd7,'options':{'where':{'id':_0x5e7760}},'log':_0xf8f1('0x3')});};exports[_0xf8f1('0x4')]=function(_0x1d2233,_0x2c6a47){return client[_0xf8f1('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x2c6a47,'options':{'where':{'id':_0x1d2233}},'log':_0xf8f1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index b242597..7480359 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 _0x7113=['../client','Request','createWhatsappMessage'];(function(_0x1394f9,_0x2ffe85){var _0x6b44b8=function(_0x374d83){while(--_0x374d83){_0x1394f9['push'](_0x1394f9['shift']());}};_0x6b44b8(++_0x2ffe85);}(_0x7113,0x183));var _0x3711=function(_0x5bed81,_0x2c4bb1){_0x5bed81=_0x5bed81-0x0;var _0x312292=_0x7113[_0x5bed81];return _0x312292;};'use strict';var client=require(_0x3711('0x0'));exports['create']=function(_0x2079f3){return client[_0x3711('0x1')]('CreateWhatsappMessage',{'body':_0x2079f3,'log':_0x3711('0x2')});}; \ No newline at end of file +var _0x7a6a=['../client','create','createWhatsappMessage'];(function(_0x1b3154,_0x3fd549){var _0x3f1bc8=function(_0x1e9997){while(--_0x1e9997){_0x1b3154['push'](_0x1b3154['shift']());}};_0x3f1bc8(++_0x3fd549);}(_0x7a6a,0x1e3));var _0xa7a6=function(_0x5c0328,_0x4abab9){_0x5c0328=_0x5c0328-0x0;var _0x54a34c=_0x7a6a[_0x5c0328];return _0x54a34c;};'use strict';var client=require(_0xa7a6('0x0'));exports[_0xa7a6('0x1')]=function(_0x2bd561){return client['Request']('CreateWhatsappMessage',{'body':_0x2bd561,'log':_0xa7a6('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 71878cf..4536865 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 _0xcae2=['Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy'];(function(_0x30ba6c,_0x234a17){var _0x9c7617=function(_0x166660){while(--_0x166660){_0x30ba6c['push'](_0x30ba6c['shift']());}};_0x9c7617(++_0x234a17);}(_0xcae2,0x143));var _0x2cae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcae2[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x2cae('0x0'));exports[_0x2cae('0x1')]=function(){return function(){return client[_0x2cae('0x2')](_0x2cae('0x3'),{'options':{'raw':![],'attributes':['id',_0x2cae('0x4'),_0x2cae('0x5'),_0x2cae('0x6')],'include':[{'model':'User','as':_0x2cae('0x7'),'attributes':['id',_0x2cae('0x4'),_0x2cae('0x8'),_0x2cae('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xbfcc=['getWhatsappQueues','../client','GetWhatsappQueue','name','timeout','strategy','whatsappPause'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0xbfcc[_0x421eeb];return _0x2c7371;};'use strict';var client=require(_0xcbfc('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xcbfc('0x1'),{'options':{'raw':![],'attributes':['id',_0xcbfc('0x2'),_0xcbfc('0x3'),_0xcbfc('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id','name','online',_0xcbfc('0x5')]}]},'log':_0xcbfc('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 590ff76..77d8f45 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 _0x69c9=['../client','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x369595,_0x278f65){var _0x43cf06=function(_0x12c2e3){while(--_0x12c2e3){_0x369595['push'](_0x369595['shift']());}};_0x43cf06(++_0x278f65);}(_0x69c9,0x114));var _0x969c=function(_0x4af1d7,_0x40fb2e){_0x4af1d7=_0x4af1d7-0x0;var _0x4bf535=_0x69c9[_0x4af1d7];return _0x4bf535;};'use strict';var client=require(_0x969c('0x0'));exports['create']=function(_0x1320be){return client[_0x969c('0x1')](_0x969c('0x2'),{'body':_0x1320be,'log':_0x969c('0x2')});};exports[_0x969c('0x3')]=function(_0x1ecd71,_0x37f92d){return client[_0x969c('0x1')](_0x969c('0x4'),{'body':_0x37f92d,'options':{'where':{'uniqueid':_0x1ecd71},'order':[['id',_0x969c('0x5')]],'limit':0x1},'log':_0x969c('0x4')});}; \ No newline at end of file +var _0x5336=['DESC','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x76f0e7,_0x409263){var _0x381c4d=function(_0x49b60b){while(--_0x49b60b){_0x76f0e7['push'](_0x76f0e7['shift']());}};_0x381c4d(++_0x409263);}(_0x5336,0x67));var _0x6533=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5336[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0x6533('0x0')]=function(_0x3b8490){return client[_0x6533('0x1')]('CreateWhatsappQueueReport',{'body':_0x3b8490,'log':_0x6533('0x2')});};exports[_0x6533('0x3')]=function(_0x244b58,_0x53648a){return client[_0x6533('0x1')](_0x6533('0x4'),{'body':_0x53648a,'options':{'where':{'uniqueid':_0x244b58},'order':[['id',_0x6533('0x5')]],'limit':0x1},'log':_0x6533('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index c46bf98..1358e15 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 _0xfce2=['error','map','message','join','stop','find','agents','timeout','atimeout','channel','format','START:%s','rules','end','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length'];(function(_0x12c189,_0x26a2f8){var _0x379cfe=function(_0x5195b7){while(--_0x5195b7){_0x12c189['push'](_0x12c189['shift']());}};_0x379cfe(++_0x26a2f8);}(_0xfce2,0x120));var _0x2fce=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfce2[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x2fce('0x0'));var _=require(_0x2fce('0x1'));var util=require(_0x2fce('0x2'));var seqqueue=require(_0x2fce('0x3'));var logger=require(_0x2fce('0x4'))(_0x2fce('0x5'));var strategy=require(_0x2fce('0x6'));var queue=schema({'name':{'type':_0x2fce('0x7'),'required':!![],'message':_0x2fce('0x8')},'timeout':{'type':_0x2fce('0x9'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x5cc321,_0x42fa0e,_0x247cfd){return logger[_0x2fce('0xa')](util['format'](_0x2fce('0xb'),_0x5cc321,_0x42fa0e[_0x2fce('0xc')],_0x247cfd));}function handleFindAgent(_0x2dc9b1){return function(_0x3dbdec){return _0x3dbdec[_0x2fce('0xc')]['toLowerCase']()===_0x2dc9b1[_0x2fce('0xd')]();};}exports[_0x2fce('0xe')]=function(_0x413e3c,_0x1d699b,_0x214da4,_0x5a9af1){return function(_0x2cb0af){try{var _0x5cd65f={'name':_0x1d699b[0x0],'timeout':_0x1d699b[0x1]};var _0x4b6a64=queue[_0x2fce('0x0')](_0x5cd65f,{'typecast':!![]});if(_0x4b6a64[_0x2fce('0xf')]){logger[_0x2fce('0x10')]('[%s][AGENT]\x20%s',_0x413e3c,_[_0x2fce('0x11')](_0x4b6a64,_0x2fce('0x12'))[_0x2fce('0x13')](',\x20'));_0x2cb0af[_0x2fce('0x14')]();}else{var _0x351657=_[_0x2fce('0x15')](_0x214da4[_0x2fce('0x16')],handleFindAgent(_0x5cd65f[_0x2fce('0xc')]));if(_0x351657){var _0x14a6b7=(_0x5cd65f[_0x2fce('0x17')]||0xa)*0x3e8;var _0x146ded,_0x186a39;var _0x258445=seqqueue['createQueue'](_0x14a6b7);_0x258445['id']=_0x413e3c;_0x258445[_0x2fce('0x18')]=_0x14a6b7;_0x258445[_0x2fce('0x19')]=_0x5a9af1[_0x2fce('0x19')];writeLog(_0x413e3c,_0x351657,util[_0x2fce('0x1a')](_0x2fce('0x1b'),_0x14a6b7));_0x214da4[_0x2fce('0x1c')][_0x413e3c]['on'](_0x2fce('0x1d'),function(){logger[_0x2fce('0xa')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x413e3c);clearTimeout(_0x186a39);_0x186a39=undefined;_0x258445[_0x2fce('0x1e')]();if(_0x214da4[_0x2fce('0x1c')][_0x413e3c]){delete _0x214da4[_0x2fce('0x1c')][_0x413e3c];}_0x2cb0af[_0x2fce('0x14')]();});_0x214da4[_0x2fce('0x1c')][_0x413e3c]['on']('complete',function(){if(_0x214da4[_0x2fce('0x1c')][_0x413e3c]){delete _0x214da4[_0x2fce('0x1c')][_0x413e3c];}});_0x186a39=setTimeout(function(){logger[_0x2fce('0xa')](_0x2fce('0x1f'),_0x413e3c);clearTimeout(_0x186a39);_0x258445[_0x2fce('0x1e')]();_0x2cb0af[_0x2fce('0x20')]();},_0x14a6b7);strategy[_0x2fce('0x21')](_0x258445,_0x351657,_0x214da4,_0x5a9af1);}else{logger[_0x2fce('0x10')](_0x2fce('0x22'),_0x413e3c,_0x5cd65f['name']);_0x2cb0af[_0x2fce('0x14')]();}}}catch(_0x4c8172){console[_0x2fce('0x23')](_0x4c8172);logger['error'](_0x2fce('0x24'),_0x413e3c,_0x4c8172[_0x2fce('0x25')]);_0x2cb0af[_0x2fce('0x14')]();}};}; \ No newline at end of file +var _0x61e7=['channel','START:%s','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','error','map','message','stop','find','agents','timeout','createQueue','atimeout'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x61e7,0xaa));var _0x761e=function(_0x30a981,_0x44d68a){_0x30a981=_0x30a981-0x0;var _0x3cb057=_0x61e7[_0x30a981];return _0x3cb057;};'use strict';var schema=require(_0x761e('0x0'));var _=require(_0x761e('0x1'));var util=require(_0x761e('0x2'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x761e('0x3'));var strategy=require(_0x761e('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x761e('0x5')},'timeout':{'type':_0x761e('0x6'),'message':_0x761e('0x7')}});function writeLog(_0x18a2dc,_0x4c39ac,_0x93c93){return logger[_0x761e('0x8')](util[_0x761e('0x9')](_0x761e('0xa'),_0x18a2dc,_0x4c39ac[_0x761e('0xb')],_0x93c93));}function handleFindAgent(_0x538a1a){return function(_0xb0c3fa){return _0xb0c3fa[_0x761e('0xb')][_0x761e('0xc')]()===_0x538a1a[_0x761e('0xc')]();};}exports['consequence']=function(_0x1355b2,_0x4e35b0,_0x25885a,_0xaf604){return function(_0x51b292){try{var _0x534e18={'name':_0x4e35b0[0x0],'timeout':_0x4e35b0[0x1]};var _0x5889e8=queue['validate'](_0x534e18,{'typecast':!![]});if(_0x5889e8['length']){logger[_0x761e('0xd')]('[%s][AGENT]\x20%s',_0x1355b2,_[_0x761e('0xe')](_0x5889e8,_0x761e('0xf'))['join'](',\x20'));_0x51b292[_0x761e('0x10')]();}else{var _0x22c15b=_[_0x761e('0x11')](_0x25885a[_0x761e('0x12')],handleFindAgent(_0x534e18['name']));if(_0x22c15b){var _0x2c60a7=(_0x534e18[_0x761e('0x13')]||0xa)*0x3e8;var _0x395a6c,_0x55d80a;var _0x4bbb65=seqqueue[_0x761e('0x14')](_0x2c60a7);_0x4bbb65['id']=_0x1355b2;_0x4bbb65[_0x761e('0x15')]=_0x2c60a7;_0x4bbb65[_0x761e('0x16')]=_0xaf604[_0x761e('0x16')];writeLog(_0x1355b2,_0x22c15b,util[_0x761e('0x9')](_0x761e('0x17'),_0x2c60a7));_0x25885a['rules'][_0x1355b2]['on']('end',function(){logger[_0x761e('0x8')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x1355b2);clearTimeout(_0x55d80a);_0x55d80a=undefined;_0x4bbb65[_0x761e('0x18')]();if(_0x25885a[_0x761e('0x19')][_0x1355b2]){delete _0x25885a[_0x761e('0x19')][_0x1355b2];}_0x51b292[_0x761e('0x10')]();});_0x25885a[_0x761e('0x19')][_0x1355b2]['on'](_0x761e('0x1a'),function(){if(_0x25885a[_0x761e('0x19')][_0x1355b2]){delete _0x25885a[_0x761e('0x19')][_0x1355b2];}});_0x55d80a=setTimeout(function(){logger[_0x761e('0x8')](_0x761e('0x1b'),_0x1355b2);clearTimeout(_0x55d80a);_0x4bbb65[_0x761e('0x18')]();_0x51b292[_0x761e('0x1c')]();},_0x2c60a7);strategy['agent'](_0x4bbb65,_0x22c15b,_0x25885a,_0xaf604);}else{logger[_0x761e('0xd')](_0x761e('0x1d'),_0x1355b2,_0x534e18['name']);_0x51b292[_0x761e('0x10')]();}}}catch(_0x4a1f64){console['log'](_0x4a1f64);logger['error'](_0x761e('0x1e'),_0x1355b2,_0x4a1f64[_0x761e('0x1f')]);_0x51b292[_0x761e('0x10')]();}};}; \ 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 ea03da9..9b1b163 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 _0x9ee7=['../../rpc/faxMessage','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','body','getMustacheRender','Message','create','then','error','stringify','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','dialogState','Failed','catch','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x37586e,_0x37b2cb){var _0x13b75a=function(_0x11ad78){while(--_0x11ad78){_0x37586e['push'](_0x37586e['shift']());}};_0x13b75a(++_0x37b2cb);}(_0x9ee7,0x7f));var _0x79ee=function(_0x15ee41,_0x9275d8){_0x15ee41=_0x15ee41-0x0;var _0x2b2846=_0x9ee7[_0x15ee41];return _0x2b2846;};'use strict';var _=require(_0x79ee('0x0'));var moment=require(_0x79ee('0x1'));var AWS=require('aws-sdk');var utils=require(_0x79ee('0x2'));var logger=require(_0x79ee('0x3'))('routing');var rpc={'chatMessage':require(_0x79ee('0x4')),'openchannelMessage':require(_0x79ee('0x5')),'mailMessage':require(_0x79ee('0x6')),'smsMessage':require(_0x79ee('0x7')),'faxMessage':require(_0x79ee('0x8'))};exports['consequence']=function(_0x2072a8,_0x1a1d86){return function(_0x1d3389){try{if(!_[_0x79ee('0x9')](this['interaction'][_0x79ee('0xa')])){logger[_0x79ee('0xb')](_0x79ee('0xc'),_0x2072a8,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1d3389[_0x79ee('0xd')]();}var _0x1e6047={'ContactId':this[_0x79ee('0xe')]['id'],'sentAt':moment()[_0x79ee('0xf')](_0x79ee('0x10')),'direction':_0x79ee('0x11')};var _0x170db3=this[_0x79ee('0x12')];if(_0x170db3===_0x79ee('0x13')){_0x1e6047['ChatWebsiteId']=this[_0x79ee('0x14')]['id'];}else{_0x1e6047[_[_0x79ee('0x15')](_0x170db3)+_0x79ee('0x16')]=this[_0x79ee('0x14')]['id'];}_0x1e6047[_[_0x79ee('0x15')](_0x170db3)+_0x79ee('0x17')]=this[_0x79ee('0x18')]['id'];if(this[_0x79ee('0x18')][_0x79ee('0x19')]){var _0x4cf084=_0x1a1d86[0x4];if(!_[_0x79ee('0x1a')](_0x4cf084)){_0x1e6047[_0x79ee('0x1b')]=utils[_0x79ee('0x1c')](_0x4cf084,this);return rpc[_0x170db3+_0x79ee('0x1d')][_0x79ee('0x1e')](_0x1e6047)[_0x79ee('0x1f')](function(_0x341a6c){logger[_0x79ee('0xb')](_0x79ee('0xc'),_0x2072a8,_0x1e6047['body']);})['catch'](function(_0x37ead5){logger[_0x79ee('0x20')](_0x79ee('0xc'),_0x2072a8,JSON[_0x79ee('0x21')](_0x37ead5));})['finally'](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2072a8);_0x1d3389[_0x79ee('0x22')]();});}else{logger[_0x79ee('0xb')](_0x79ee('0x23'),_0x2072a8);_0x1d3389['stop']();}}else{var _0x268ffc=this;var _0x4ac24e=new AWS[(_0x79ee('0x24'))]({'accessKeyId':_0x1a1d86[0x0],'secretAccessKey':_0x1a1d86[0x1],'region':_0x1a1d86[0x2]});var _0x22c653={'botAlias':_0x79ee('0x25'),'botName':_0x1a1d86[0x3],'inputText':this[_0x79ee('0x26')][_0x79ee('0x1b')],'userId':this['interaction']['id'][_0x79ee('0x27')]()};_0x4ac24e[_0x79ee('0x28')](_0x22c653,function(_0x48737d,_0x20b523){if(_0x48737d){logger[_0x79ee('0x20')](_0x79ee('0xc'),_0x2072a8,_0x48737d['message']);_0x1d3389[_0x79ee('0xd')]();}else if(_0x20b523&&_0x20b523['message']){_0x268ffc[_0x79ee('0x1b')][_0x79ee('0x29')]=_0x20b523;_0x1e6047[_0x79ee('0x1b')]=_0x20b523[_0x79ee('0x26')];return rpc[_0x170db3+_0x79ee('0x1d')]['create'](_0x1e6047)[_0x79ee('0x1f')](function(_0x6c0206){logger[_0x79ee('0xb')](_0x79ee('0xc'),_0x2072a8,_0x1e6047[_0x79ee('0x1b')]);if(_0x20b523[_0x79ee('0x2a')]==_0x79ee('0x2b')){_0x1d3389[_0x79ee('0xd')]();}else{_0x1d3389['stop']();}})[_0x79ee('0x2c')](function(_0x1000de){logger[_0x79ee('0x20')](_0x79ee('0xc'),_0x2072a8,JSON[_0x79ee('0x21')](_0x1000de));_0x1d3389['next']();});}else{_0x1d3389[_0x79ee('0xd')]();}});}}catch(_0x3d4411){logger['error'](_0x79ee('0xc'),_0x2072a8,JSON['stringify'](_0x3d4411));_0x1d3389[_0x79ee('0x22')]();}};}; \ No newline at end of file +var _0x9261=['info','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','Message','[%s][AMAZONLEX]\x20%s','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','then','Failed','stop','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9261,0x1aa));var _0x1926=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0x9261[_0x3aeb36];return _0xa2ef21;};'use strict';var _=require(_0x1926('0x0'));var moment=require(_0x1926('0x1'));var AWS=require(_0x1926('0x2'));var utils=require(_0x1926('0x3'));var logger=require(_0x1926('0x4'))(_0x1926('0x5'));var rpc={'chatMessage':require(_0x1926('0x6')),'openchannelMessage':require(_0x1926('0x7')),'mailMessage':require(_0x1926('0x8')),'smsMessage':require(_0x1926('0x9')),'faxMessage':require(_0x1926('0xa'))};exports[_0x1926('0xb')]=function(_0x102a82,_0x26e76a){return function(_0x5e04f3){try{if(!_['isNil'](this[_0x1926('0xc')][_0x1926('0xd')])){logger[_0x1926('0xe')]('[%s][AMAZONLEX]\x20%s',_0x102a82,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5e04f3[_0x1926('0xf')]();}var _0x9e41ad={'ContactId':this[_0x1926('0x10')]['id'],'sentAt':moment()[_0x1926('0x11')](_0x1926('0x12')),'direction':'out'};var _0x2f93cc=this[_0x1926('0x13')];if(_0x2f93cc===_0x1926('0x14')){_0x9e41ad['ChatWebsiteId']=this[_0x1926('0x15')]['id'];}else{_0x9e41ad[_[_0x1926('0x16')](_0x2f93cc)+_0x1926('0x17')]=this['account']['id'];}_0x9e41ad[_['upperFirst'](_0x2f93cc)+_0x1926('0x18')]=this['interaction']['id'];if(this['interaction'][_0x1926('0x19')]){var _0x3ff7dc=_0x26e76a[0x4];if(!_[_0x1926('0x1a')](_0x3ff7dc)){_0x9e41ad[_0x1926('0x1b')]=utils['getMustacheRender'](_0x3ff7dc,this);return rpc[_0x2f93cc+_0x1926('0x1c')]['create'](_0x9e41ad)['then'](function(_0x3955d3){logger['info'](_0x1926('0x1d'),_0x102a82,_0x9e41ad['body']);})[_0x1926('0x1e')](function(_0x267d24){logger[_0x1926('0x1f')](_0x1926('0x1d'),_0x102a82,JSON[_0x1926('0x20')](_0x267d24));})[_0x1926('0x21')](function(){logger[_0x1926('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x102a82);_0x5e04f3['stop']();});}else{logger[_0x1926('0xe')](_0x1926('0x22'),_0x102a82);_0x5e04f3['stop']();}}else{var _0x4c2264=this;var _0x2390da=new AWS[(_0x1926('0x23'))]({'accessKeyId':_0x26e76a[0x0],'secretAccessKey':_0x26e76a[0x1],'region':_0x26e76a[0x2]});var _0xb94c2d={'botAlias':_0x1926('0x24'),'botName':_0x26e76a[0x3],'inputText':this[_0x1926('0x25')]['body'],'userId':this[_0x1926('0xc')]['id'][_0x1926('0x26')]()};_0x2390da[_0x1926('0x27')](_0xb94c2d,function(_0x1015a6,_0x4e315b){if(_0x1015a6){logger[_0x1926('0x1f')](_0x1926('0x1d'),_0x102a82,_0x1015a6[_0x1926('0x25')]);_0x5e04f3['next']();}else if(_0x4e315b&&_0x4e315b[_0x1926('0x25')]){_0x4c2264[_0x1926('0x1b')][_0x1926('0x28')]=_0x4e315b;_0x9e41ad[_0x1926('0x1b')]=_0x4e315b[_0x1926('0x25')];return rpc[_0x2f93cc+_0x1926('0x1c')]['create'](_0x9e41ad)[_0x1926('0x29')](function(_0xda82e5){logger[_0x1926('0xe')](_0x1926('0x1d'),_0x102a82,_0x9e41ad['body']);if(_0x4e315b['dialogState']==_0x1926('0x2a')){_0x5e04f3[_0x1926('0xf')]();}else{_0x5e04f3['stop']();}})['catch'](function(_0x25e70a){logger['error']('[%s][AMAZONLEX]\x20%s',_0x102a82,JSON['stringify'](_0x25e70a));_0x5e04f3[_0x1926('0xf')]();});}else{_0x5e04f3[_0x1926('0xf')]();}});}}catch(_0x52dff9){logger[_0x1926('0x1f')](_0x1926('0x1d'),_0x102a82,JSON[_0x1926('0x20')](_0x52dff9));_0x5e04f3[_0x1926('0x2b')]();}};}; \ 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 3b47bde..4859c95 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 _0x0713=['authentication','auth','user','pass','inReplyTo','messageId','replace','body','','sendMailMessage','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Message','[%s][AUTOREPLY]\x20%s','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../mailRpc','consequence','isNil','interaction','created','info','Autoreply\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','mail','Smtp','service','host','port','secure'];(function(_0x1e2350,_0x595dec){var _0x5355b7=function(_0x4159ea){while(--_0x4159ea){_0x1e2350['push'](_0x1e2350['shift']());}};_0x5355b7(++_0x595dec);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0x3071('0x0'));var logger=require(_0x3071('0x1'))(_0x3071('0x2'));var rpc={'chatMessage':require(_0x3071('0x3')),'openchannelMessage':require(_0x3071('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x3071('0x5')),'faxMessage':require(_0x3071('0x6'))};var mailRpc=require(_0x3071('0x7'));exports[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return function(_0x1d3dd6){try{if(_0x41cf76[0x0]==='1'&&(_[_0x3071('0x9')](this[_0x3071('0xa')][_0x3071('0xb')])||!this[_0x3071('0xa')][_0x3071('0xb')])){logger[_0x3071('0xc')]('[%s][AUTOREPLY]\x20%s',_0xabd7b6,_0x3071('0xd'));return _0x1d3dd6[_0x3071('0xe')]();}var _0x937259=this[_0x3071('0xf')];var _0x1ce844={'body':utils['getMustacheRender'](_0x41cf76[0x1],this),'ContactId':this[_0x3071('0x10')]['id'],'sentAt':moment()[_0x3071('0x11')](_0x3071('0x12')),'direction':_0x3071('0x13')};if(this[_0x3071('0x14')]){_0x1ce844['to']=this['message']['from']||'';_0x1ce844['cc']=this[_0x3071('0x14')]['cc']||'';_0x1ce844['from']=this[_0x3071('0x14')]['to']||'';_0x1ce844[_0x3071('0x15')]=this['message'][_0x3071('0x15')]||'';_0x1ce844['read']=!![];if(this[_0x3071('0x14')][_0x3071('0x16')]){_0x1ce844[_0x3071('0x16')]='';_0x1ce844[_0x3071('0x16')]+=_[_0x3071('0x17')](this[_0x3071('0x14')][_0x3071('0x16')],_0x3071('0x18'))?'':_0x3071('0x19');_0x1ce844[_0x3071('0x16')]+=this['message'][_0x3071('0x16')];}}if(this[_0x3071('0xf')]===_0x3071('0x1a')){_0x1ce844[_0x3071('0x1b')]=this[_0x3071('0x1c')]['id'];}else{_0x1ce844[_[_0x3071('0x1d')](this[_0x3071('0xf')])+_0x3071('0x1e')]=this['account']['id'];}_0x1ce844[_[_0x3071('0x1d')](this[_0x3071('0xf')])+_0x3071('0x1f')]=this['interaction']['id'];if(rpc[this[_0x3071('0xf')]+'Message']){if(this[_0x3071('0xf')]===_0x3071('0x20')){var _0x3762d8={'tls':{'rejectUnauthorized':![]}};if(this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x22')]){_0x3762d8[_0x3071('0x22')]=this[_0x3071('0x1c')]['Smtp']['service'];}else{_0x3762d8[_0x3071('0x23')]=this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x23')];_0x3762d8[_0x3071('0x24')]=this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x24')];_0x3762d8[_0x3071('0x25')]=this['account'][_0x3071('0x21')][_0x3071('0x25')];}if(this[_0x3071('0x1c')]['Smtp'][_0x3071('0x26')]){_0x3762d8[_0x3071('0x27')]={'user':this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x28')],'pass':this[_0x3071('0x1c')][_0x3071('0x21')][_0x3071('0x29')]};}_0x1ce844[_0x3071('0x2a')]=this[_0x3071('0x14')][_0x3071('0x2b')];_0x1ce844['html']=''+_[_0x3071('0x2c')](_0x1ce844[_0x3071('0x2d')],_0x3071('0x2e'),_0x3071('0x2f'))+_0x3071('0x30');return mailRpc[_0x3071('0x31')](_0x3762d8,_0x1ce844)[_0x3071('0x32')](function(_0x1ccc41){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0xabd7b6);_0x1ce844['messageId']=_0x1ccc41[_0x3071('0x14')][_0x3071('0x2b')];return rpc[_0x937259+'Message'][_0x3071('0x33')](_0x1ce844);})[_0x3071('0x32')](function(_0x25250e){logger[_0x3071('0xc')]('[%s][AUTOREPLY]\x20%s',_0xabd7b6,JSON[_0x3071('0x34')](_0x25250e));})[_0x3071('0x35')](function(_0x602719){logger[_0x3071('0x36')](_0x3071('0x37'),_0xabd7b6,JSON[_0x3071('0x34')](_0x602719));})[_0x3071('0x38')](function(){_0x1d3dd6[_0x3071('0xe')]();});}else{return rpc[this['channel']+_0x3071('0x39')]['create'](_0x1ce844)['then'](function(_0x1a1a64){logger[_0x3071('0xc')]('[%s][AUTOREPLY]\x20%s',_0xabd7b6,_0x1ce844[_0x3071('0x2d')]);})[_0x3071('0x35')](function(_0x265d76){logger[_0x3071('0x36')](_0x3071('0x3a'),_0xabd7b6,JSON[_0x3071('0x34')](_0x265d76));})['finally'](function(){_0x1d3dd6[_0x3071('0xe')]();});}}}catch(_0xd7971f){logger['error'](_0x3071('0x3a'),_0xabd7b6,JSON['stringify'](_0xd7971f));_0x1d3dd6[_0x3071('0x3b')]();}};}; \ No newline at end of file +var _0x70e0=['from','phone','subject','startsWith','Re:','chat','ChatWebsiteId','upperFirst','AccountId','account','Message','Smtp','service','host','port','secure','authentication','user','pass','inReplyTo','html','','replace','','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','then','error','finally','next','create','body','catch','stringify','stop','lodash','moment','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../mailRpc','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message'];(function(_0x3432db,_0x15bded){var _0x48acd3=function(_0x1be657){while(--_0x1be657){_0x3432db['push'](_0x3432db['shift']());}};_0x48acd3(++_0x15bded);}(_0x70e0,0x17b));var _0x070e=function(_0xe4d1fa,_0x1188eb){_0xe4d1fa=_0xe4d1fa-0x0;var _0x317b8e=_0x70e0[_0xe4d1fa];return _0x317b8e;};'use strict';var _=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var utils=require(_0x070e('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x070e('0x3')),'openchannelMessage':require(_0x070e('0x4')),'mailMessage':require(_0x070e('0x5')),'smsMessage':require(_0x070e('0x6')),'faxMessage':require('../../rpc/faxMessage')};var mailRpc=require(_0x070e('0x7'));exports['consequence']=function(_0x46fe68,_0x4b041d){return function(_0x56e420){try{if(_0x4b041d[0x0]==='1'&&(_['isNil'](this[_0x070e('0x8')][_0x070e('0x9')])||!this[_0x070e('0x8')][_0x070e('0x9')])){logger[_0x070e('0xa')](_0x070e('0xb'),_0x46fe68,_0x070e('0xc'));return _0x56e420['next']();}var _0x49b2fb=this[_0x070e('0xd')];var _0x2e3e5e={'body':utils[_0x070e('0xe')](_0x4b041d[0x1],this),'ContactId':this[_0x070e('0xf')]['id'],'sentAt':moment()[_0x070e('0x10')](_0x070e('0x11')),'direction':_0x070e('0x12')};if(this[_0x070e('0x13')]){_0x2e3e5e['to']=this[_0x070e('0x13')][_0x070e('0x14')]||'';_0x2e3e5e['cc']=this[_0x070e('0x13')]['cc']||'';_0x2e3e5e['from']=this['message']['to']||'';_0x2e3e5e[_0x070e('0x15')]=this['message']['phone']||'';_0x2e3e5e['read']=!![];if(this[_0x070e('0x13')][_0x070e('0x16')]){_0x2e3e5e['subject']='';_0x2e3e5e['subject']+=_[_0x070e('0x17')](this[_0x070e('0x13')][_0x070e('0x16')],_0x070e('0x18'))?'':'Re:\x20';_0x2e3e5e['subject']+=this[_0x070e('0x13')][_0x070e('0x16')];}}if(this[_0x070e('0xd')]===_0x070e('0x19')){_0x2e3e5e[_0x070e('0x1a')]=this['account']['id'];}else{_0x2e3e5e[_[_0x070e('0x1b')](this[_0x070e('0xd')])+_0x070e('0x1c')]=this[_0x070e('0x1d')]['id'];}_0x2e3e5e[_[_0x070e('0x1b')](this['channel'])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x070e('0xd')]+_0x070e('0x1e')]){if(this[_0x070e('0xd')]==='mail'){var _0x5b184={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x070e('0x1f')][_0x070e('0x20')]){_0x5b184[_0x070e('0x20')]=this[_0x070e('0x1d')][_0x070e('0x1f')][_0x070e('0x20')];}else{_0x5b184[_0x070e('0x21')]=this[_0x070e('0x1d')]['Smtp'][_0x070e('0x21')];_0x5b184[_0x070e('0x22')]=this[_0x070e('0x1d')]['Smtp'][_0x070e('0x22')];_0x5b184['secure']=this['account'][_0x070e('0x1f')][_0x070e('0x23')];}if(this[_0x070e('0x1d')][_0x070e('0x1f')][_0x070e('0x24')]){_0x5b184['auth']={'user':this[_0x070e('0x1d')][_0x070e('0x1f')][_0x070e('0x25')],'pass':this[_0x070e('0x1d')][_0x070e('0x1f')][_0x070e('0x26')]};}_0x2e3e5e[_0x070e('0x27')]=this[_0x070e('0x13')]['messageId'];_0x2e3e5e[_0x070e('0x28')]=_0x070e('0x29')+_[_0x070e('0x2a')](_0x2e3e5e['body'],']+(>|$)/g,''),'priorityTrue':_0x18e053[0x1],'priorityFalse':_0x18e053[0x2]};var _0x213c65=gotoif[_0xe346('0x0')](_0x229f98,{'typecast':!![]});if(_0x213c65['length']){logger[_0xe346('0x9')]('[%s][GOTOIF]\x20%s',_0x248c75,_[_0xe346('0xa')](_0x213c65,_0xe346('0xb'))[_0xe346('0xc')](',\x20'));_0x4c9b8c[_0xe346('0xd')]();}else{try{var _0x4086a9=eval('('+_0x229f98[_0xe346('0xe')]+')');var _0x498dcd=_0x4086a9?_0x229f98[_0xe346('0xf')]:_0x229f98['priorityFalse'];logger['info'](_0xe346('0x10'),_0x248c75,_0x229f98[_0xe346('0xe')],_0x4086a9,_0x498dcd||_0xe346('0x11'));if(_0x498dcd){var _0x55978e=_[_0xe346('0x12')](_0x4c9b8c[_0xe346('0x13')](),{'p':_0x498dcd});if(_0x55978e>=0x0){logger[_0xe346('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x248c75,_0x498dcd||_0xe346('0x11'),_0x55978e);_0x4c9b8c[_0xe346('0x11')](_0x55978e);}else{logger[_0xe346('0x14')](_0xe346('0x15'),_0x248c75,_0x498dcd||_0xe346('0x11'));_0x4c9b8c[_0xe346('0xd')]();}}else{_0x4c9b8c[_0xe346('0x11')]();}}catch(_0x23b728){logger[_0xe346('0x9')](_0xe346('0x16'),_0x248c75,_0x23b728['message']);_0x4c9b8c[_0xe346('0xd')]();}}}catch(_0x267d4f){logger['error'](_0xe346('0x17'),_0x248c75,JSON[_0xe346('0x18')](_0x267d4f));_0x4c9b8c[_0xe346('0xd')]();}};}; \ No newline at end of file +var _0x98d8=['[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','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'];(function(_0x148754,_0x5c5996){var _0x111774=function(_0x35cf9f){while(--_0x35cf9f){_0x148754['push'](_0x148754['shift']());}};_0x111774(++_0x5c5996);}(_0x98d8,0xce));var _0x898d=function(_0x91ed5c,_0xdb6b34){_0x91ed5c=_0x91ed5c-0x0;var _0x2387d8=_0x98d8[_0x91ed5c];return _0x2387d8;};'use strict';var schema=require(_0x898d('0x0'));var _=require(_0x898d('0x1'));var htmlToText=require(_0x898d('0x2'));var utils=require(_0x898d('0x3'));var logger=require(_0x898d('0x4'))(_0x898d('0x5'));var gotoif=schema({'condition':{'type':_0x898d('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x898d('0x7')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x898d('0x8')]=function(_0x5215bf,_0x16b99a){return function(_0x4e8c68){try{var _0x1de5df={'condition':htmlToText['fromString'](utils[_0x898d('0x9')](_0x16b99a[0x0],this),{'wordwrap':![]})[_0x898d('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x16b99a[0x1],'priorityFalse':_0x16b99a[0x2]};var _0x2fedc8=gotoif[_0x898d('0x0')](_0x1de5df,{'typecast':!![]});if(_0x2fedc8[_0x898d('0xb')]){logger[_0x898d('0xc')](_0x898d('0xd'),_0x5215bf,_[_0x898d('0xe')](_0x2fedc8,_0x898d('0xf'))[_0x898d('0x10')](',\x20'));_0x4e8c68[_0x898d('0x11')]();}else{try{var _0x424a43=eval('('+_0x1de5df[_0x898d('0x12')]+')');var _0x27b9df=_0x424a43?_0x1de5df[_0x898d('0x13')]:_0x1de5df['priorityFalse'];logger[_0x898d('0x14')](_0x898d('0x15'),_0x5215bf,_0x1de5df['condition'],_0x424a43,_0x27b9df||_0x898d('0x16'));if(_0x27b9df){var _0x28c612=_[_0x898d('0x17')](_0x4e8c68[_0x898d('0x18')](),{'p':_0x27b9df});if(_0x28c612>=0x0){logger[_0x898d('0x14')](_0x898d('0x19'),_0x5215bf,_0x27b9df||_0x898d('0x16'),_0x28c612);_0x4e8c68['next'](_0x28c612);}else{logger[_0x898d('0x14')](_0x898d('0x1a'),_0x5215bf,_0x27b9df||'next');_0x4e8c68['stop']();}}else{_0x4e8c68[_0x898d('0x16')]();}}catch(_0x42a098){logger[_0x898d('0xc')](_0x898d('0x1b'),_0x5215bf,_0x42a098[_0x898d('0xf')]);_0x4e8c68[_0x898d('0x11')]();}}}catch(_0x514c47){logger['error'](_0x898d('0xd'),_0x5215bf,JSON[_0x898d('0x1c')](_0x514c47));_0x4e8c68[_0x898d('0x11')]();}};}; \ 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 238745c..ac9d3b5 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 _0xebde=['stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][GOTOP]\x20%s','map','join'];(function(_0x318973,_0x525968){var _0x1a70f3=function(_0x3672b1){while(--_0x3672b1){_0x318973['push'](_0x318973['shift']());}};_0x1a70f3(++_0x525968);}(_0xebde,0x113));var _0xeebd=function(_0x272d90,_0x5e70ff){_0x272d90=_0x272d90-0x0;var _0x2bf4a2=_0xebde[_0x272d90];return _0x2bf4a2;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0xeebd('0x0'))(_0xeebd('0x1'));var gotop=schema({'priority':{'type':_0xeebd('0x2'),'required':!![],'message':_0xeebd('0x3')}});exports[_0xeebd('0x4')]=function(_0xdce8a0,_0x26fcbd){return function(_0x3bb822){try{var _0x1d0879={'priority':_0x26fcbd[0x0]};var _0x27db7d=gotop[_0xeebd('0x5')](_0x1d0879,{'typecast':!![]});if(_0x27db7d['length']){logger[_0xeebd('0x6')](_0xeebd('0x7'),_0xdce8a0,_[_0xeebd('0x8')](_0x27db7d,'message')[_0xeebd('0x9')](',\x20'));_0x3bb822[_0xeebd('0xa')]();}else{logger[_0xeebd('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0xdce8a0,_0x1d0879['priority']);if(_0x1d0879[_0xeebd('0xc')]){var _0x436900=_[_0xeebd('0xd')](_0x3bb822[_0xeebd('0xe')](),{'p':_0x1d0879[_0xeebd('0xc')]});if(_0x436900>=0x0){logger[_0xeebd('0xb')](_0xeebd('0xf'),_0xdce8a0,_0x1d0879[_0xeebd('0xc')]||_0xeebd('0x10'),_0x436900);_0x3bb822[_0xeebd('0x10')](_0x436900);}else{logger[_0xeebd('0xb')](_0xeebd('0x11'),_0xdce8a0,_0x1d0879[_0xeebd('0xc')]||_0xeebd('0x10'));_0x3bb822['stop']();}}else{_0x3bb822[_0xeebd('0x10')]();}}}catch(_0x1d3713){logger[_0xeebd('0x6')](_0xeebd('0x7'),_0xdce8a0,JSON[_0xeebd('0x12')](_0x1d3713));_0x3bb822['stop']();}};}; \ No newline at end of file +var _0x8a84=['length','[%s][GOTOP]\x20%s','map','join','stop','info','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence'];(function(_0x22aa61,_0x45e107){var _0x51500a=function(_0x16a73b){while(--_0x16a73b){_0x22aa61['push'](_0x22aa61['shift']());}};_0x51500a(++_0x45e107);}(_0x8a84,0xae));var _0x48a8=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x8a84[_0x40bffc];return _0x3007e9;};'use strict';var schema=require(_0x48a8('0x0'));var _=require(_0x48a8('0x1'));var logger=require(_0x48a8('0x2'))(_0x48a8('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x48a8('0x4')}});exports[_0x48a8('0x5')]=function(_0x526a5b,_0x4657ed){return function(_0x2eea9f){try{var _0x369fcf={'priority':_0x4657ed[0x0]};var _0x471da3=gotop[_0x48a8('0x0')](_0x369fcf,{'typecast':!![]});if(_0x471da3[_0x48a8('0x6')]){logger['error'](_0x48a8('0x7'),_0x526a5b,_[_0x48a8('0x8')](_0x471da3,'message')[_0x48a8('0x9')](',\x20'));_0x2eea9f[_0x48a8('0xa')]();}else{logger[_0x48a8('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x526a5b,_0x369fcf['priority']);if(_0x369fcf[_0x48a8('0xc')]){var _0xf94ad8=_[_0x48a8('0xd')](_0x2eea9f[_0x48a8('0xe')](),{'p':_0x369fcf[_0x48a8('0xc')]});if(_0xf94ad8>=0x0){logger[_0x48a8('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x526a5b,_0x369fcf[_0x48a8('0xc')]||_0x48a8('0xf'),_0xf94ad8);_0x2eea9f[_0x48a8('0xf')](_0xf94ad8);}else{logger[_0x48a8('0xb')](_0x48a8('0x10'),_0x526a5b,_0x369fcf[_0x48a8('0xc')]||_0x48a8('0xf'));_0x2eea9f[_0x48a8('0xa')]();}}else{_0x2eea9f[_0x48a8('0xf')]();}}}catch(_0x2880c5){logger['error'](_0x48a8('0x7'),_0x526a5b,JSON[_0x48a8('0x11')](_0x2880c5));_0x2eea9f[_0x48a8('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 4a2ad6c..0ee0d3e 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 _0x9c96=['info','[%s][MESSAGE]\x20%s','body','stringify','error','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','interaction','Message','create','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c96,0x9c));var _0x69c9=function(_0x47e595,_0x3335d6){_0x47e595=_0x47e595-0x0;var _0x44781b=_0x9c96[_0x47e595];return _0x44781b;};'use strict';var _=require(_0x69c9('0x0'));var utils=require(_0x69c9('0x1'));var logger=require('../../../../config/logger')(_0x69c9('0x2'));var rpc={'chatMessage':require(_0x69c9('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x69c9('0x4')),'smsMessage':require(_0x69c9('0x5')),'faxMessage':require(_0x69c9('0x6'))};exports[_0x69c9('0x7')]=function(_0x55181e,_0x5dfc6b){return function(_0xa5c2e){try{var _0x4b60d4={'body':utils[_0x69c9('0x8')](_0x5dfc6b[0x0],this),'ContactId':this[_0x69c9('0x9')]['id']};if(this[_0x69c9('0xa')]===_0x69c9('0xb')){_0x4b60d4[_0x69c9('0xc')]=this['account']['id'];}else{_0x4b60d4[_[_0x69c9('0xd')](this[_0x69c9('0xa')])+_0x69c9('0xe')]=this['account']['id'];}_0x4b60d4[_[_0x69c9('0xd')](this['channel'])+'InteractionId']=this[_0x69c9('0xf')]['id'];if(rpc[this[_0x69c9('0xa')]+_0x69c9('0x10')]){return rpc[this[_0x69c9('0xa')]+_0x69c9('0x10')][_0x69c9('0x11')](_0x4b60d4)[_0x69c9('0x12')](function(_0x14eb9a){logger[_0x69c9('0x13')](_0x69c9('0x14'),_0x55181e,_0x4b60d4[_0x69c9('0x15')]);_0xa5c2e['next']();})['catch'](function(_0x9fac24){logger['error'](_0x69c9('0x14'),_0x55181e,JSON[_0x69c9('0x16')](_0x9fac24));_0xa5c2e['stop']();});}}catch(_0x5bcb63){logger[_0x69c9('0x17')](_0x69c9('0x14'),_0x55181e,JSON[_0x69c9('0x16')](_0x5bcb63));_0xa5c2e[_0x69c9('0x18')]();}};}; \ No newline at end of file +var _0x8b40=['ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','catch','error','stop','[%s][MESSAGE]\x20%s','stringify','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','channel','chat'];(function(_0x44e633,_0x2b5790){var _0x2b2890=function(_0x1e5e0d){while(--_0x1e5e0d){_0x44e633['push'](_0x44e633['shift']());}};_0x2b2890(++_0x2b5790);}(_0x8b40,0x1ab));var _0x08b4=function(_0x181dfe,_0xf84557){_0x181dfe=_0x181dfe-0x0;var _0x40c38f=_0x8b40[_0x181dfe];return _0x40c38f;};'use strict';var _=require('lodash');var utils=require(_0x08b4('0x0'));var logger=require('../../../../config/logger')(_0x08b4('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x08b4('0x2')),'mailMessage':require(_0x08b4('0x3')),'smsMessage':require(_0x08b4('0x4')),'faxMessage':require(_0x08b4('0x5'))};exports[_0x08b4('0x6')]=function(_0x176afa,_0x10d616){return function(_0xd8a8c6){try{var _0x44657c={'body':utils[_0x08b4('0x7')](_0x10d616[0x0],this),'ContactId':this['contact']['id']};if(this[_0x08b4('0x8')]===_0x08b4('0x9')){_0x44657c[_0x08b4('0xa')]=this[_0x08b4('0xb')]['id'];}else{_0x44657c[_[_0x08b4('0xc')](this[_0x08b4('0x8')])+_0x08b4('0xd')]=this['account']['id'];}_0x44657c[_[_0x08b4('0xc')](this[_0x08b4('0x8')])+_0x08b4('0xe')]=this[_0x08b4('0xf')]['id'];if(rpc[this['channel']+_0x08b4('0x10')]){return rpc[this[_0x08b4('0x8')]+_0x08b4('0x10')][_0x08b4('0x11')](_0x44657c)['then'](function(_0x5987d0){logger['info']('[%s][MESSAGE]\x20%s',_0x176afa,_0x44657c['body']);_0xd8a8c6['next']();})[_0x08b4('0x12')](function(_0x306a14){logger[_0x08b4('0x13')]('[%s][MESSAGE]\x20%s',_0x176afa,JSON['stringify'](_0x306a14));_0xd8a8c6[_0x08b4('0x14')]();});}}catch(_0x4f4026){logger['error'](_0x08b4('0x15'),_0x176afa,JSON[_0x08b4('0x16')](_0x4f4026));_0xd8a8c6[_0x08b4('0x14')]();}};}; \ 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 bb1a3ac..3048ffa 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 _0x5eea=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','error','stringify'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x5eea,0xb8));var _0xa5ee=function(_0x468dd5,_0xa8cf75){_0x468dd5=_0x468dd5-0x0;var _0x52dd33=_0x5eea[_0x468dd5];return _0x52dd33;};'use strict';var utils=require('./utils');var logger=require(_0xa5ee('0x0'))(_0xa5ee('0x1'));exports[_0xa5ee('0x2')]=function(_0x1ba50e,_0x3eba72){return function(_0x1bd51d){try{logger[_0xa5ee('0x3')](_0xa5ee('0x4'),_0x1ba50e,utils[_0xa5ee('0x5')](_0x3eba72[0x0],this));_0x1bd51d['next']();}catch(_0x17fcd7){logger[_0xa5ee('0x6')](_0xa5ee('0x4'),_0x1ba50e,JSON[_0xa5ee('0x7')](_0x17fcd7));_0x1bd51d['stop']();}};}; \ No newline at end of file +var _0x44f9=['error','stringify','stop','./utils','../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s','next'];(function(_0x1c9b23,_0x3143ae){var _0x23fe71=function(_0x8378b2){while(--_0x8378b2){_0x1c9b23['push'](_0x1c9b23['shift']());}};_0x23fe71(++_0x3143ae);}(_0x44f9,0xdb));var _0x944f=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x44f9[_0x110c3d];return _0x226d67;};'use strict';var utils=require(_0x944f('0x0'));var logger=require(_0x944f('0x1'))(_0x944f('0x2'));exports[_0x944f('0x3')]=function(_0x16ead4,_0x2c5886){return function(_0x5807b4){try{logger['info'](_0x944f('0x4'),_0x16ead4,utils['getMustacheRender'](_0x2c5886[0x0],this));_0x5807b4[_0x944f('0x5')]();}catch(_0x311b0b){logger[_0x944f('0x6')]('[%s][NOOP]\x20%s',_0x16ead4,JSON[_0x944f('0x7')](_0x311b0b));_0x5807b4[_0x944f('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 081d62f..634b9cf 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 _0x41bb=['redis','defaults','queue_id','account','from','joinAt','emit','queue','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','accepted','update','update\x20queue\x20report','timeout','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','Queues','atimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing'];(function(_0x362603,_0x1190d4){var _0x2f7a2a=function(_0x1d37a1){while(--_0x1d37a1){_0x362603['push'](_0x362603['shift']());}};_0x2f7a2a(++_0x1190d4);}(_0x41bb,0xc5));var _0xb41b=function(_0x40ba7b,_0x4aa904){_0x40ba7b=_0x40ba7b-0x0;var _0x56fcef=_0x41bb[_0x40ba7b];return _0x56fcef;};'use strict';var schema=require(_0xb41b('0x0'));var _=require(_0xb41b('0x1'));var util=require('util');var seqqueue=require(_0xb41b('0x2'));var moment=require('moment');var Redis=require(_0xb41b('0x3'));var config=require(_0xb41b('0x4'));var logger=require(_0xb41b('0x5'))(_0xb41b('0x6'));var strategy=require('./strategy');config[_0xb41b('0x7')]=_[_0xb41b('0x8')](config[_0xb41b('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0xb41b('0x9'),_0xb41b('0xa'),'queue',_0xb41b('0xb'),_0xb41b('0xc')];function emit(_0x11b8b2,_0xa2aa66,_0x26d531){io['to'](_0x11b8b2)[_0xb41b('0xd')](_0xa2aa66,_0x26d531);}function emitChannelQueueInteraction(_0x5e5c5b,_0x4baa03,_0x1a9e2c,_0x5931cf,_0x2e906c,_0xb02d60,_0x1e1c82,_0x25ff69){var _0x2066d5=_['clone'](_0x1a9e2c);_0x2066d5[_0xb41b('0x9')]=_0x25ff69;_0x2066d5[_0xb41b('0xe')]=_0x4baa03;_0x2066d5[_0xb41b('0xa')]=_0x5931cf;_0x2066d5['id']=_0x2e906c;if(_0xb02d60){_0x1e1c82[util[_0xb41b('0xf')](_0xb41b('0x10'),_0x5e5c5b)][_0x2e906c]=_['pick'](_0x2066d5,attributes);}else{delete _0x1e1c82[util['format']('%sQueuesWaitingInteractions',_0x5e5c5b)][_0x2e906c];}emit(util[_0xb41b('0xf')](_0xb41b('0x11'),_0x5e5c5b,_0x4baa03),util[_0xb41b('0xf')](_0xb41b('0x12'),_0x5e5c5b,_0xb02d60?_0xb41b('0x13'):'remove'),_[_0xb41b('0x14')](_0x2066d5,attributes));}var rpc={'openchannelQueueReport':require(_0xb41b('0x15')),'mailQueueReport':require(_0xb41b('0x16')),'chatQueueReport':require(_0xb41b('0x17')),'smsQueueReport':require(_0xb41b('0x18')),'faxQueueReport':require(_0xb41b('0x19'))};var queue=schema({'name':{'type':_0xb41b('0x1a'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0xf109f8,_0x503e86,_0x307633,_0x1de9ea){if(_0xf109f8&&_0x503e86&&_0x307633){_0x503e86[_0xb41b('0x1b')]+=0x1;var _0x5b7332={'uniqueid':_0xf109f8,'from':_0x307633['body']?_0x307633[_0xb41b('0x1c')][_0xb41b('0xb')]:'','joinAt':moment()[_0xb41b('0xf')](_0xb41b('0x1d')),'ContactId':_0x307633[_0xb41b('0x1e')]?_0x307633[_0xb41b('0x1e')]['id']:null,'ListId':_0x307633['list']?_0x307633['list']['id']:null};_0x5b7332[_[_0xb41b('0x1f')](_0x307633[_0xb41b('0x20')])+_0xb41b('0x21')]=_0x503e86['id']||null;_0x5b7332[_['upperFirst'](_0x307633[_0xb41b('0x20')])+_0xb41b('0x22')]=_0x307633['interaction']?_0x307633[_0xb41b('0x23')]['id']:null;_0x5b7332[_[_0xb41b('0x1f')](_0x307633['channel'])+_0xb41b('0x24')]=_0x307633['message']?_0x307633[_0xb41b('0x25')]['id']:null;_0x5b7332[_[_0xb41b('0x1f')](_0x307633['channel'])+(_0x307633[_0xb41b('0x20')]!==_0xb41b('0x26')?'AccountId':'WebsiteId')]=_0x307633[_0xb41b('0xa')]?_0x307633[_0xb41b('0xa')]['id']:null;logger[_0xb41b('0x27')](util[_0xb41b('0xf')](_0xb41b('0x28'),_0xf109f8,_0x503e86[_0xb41b('0x29')]));emitChannelQueueInteraction(_0x307633[_0xb41b('0x20')],_0x503e86['name'],_0x5b7332,_0x307633[_0xb41b('0xa')][_0xb41b('0x29')],_0x307633['message']['id'],!![],_0x1de9ea,_0x503e86['id']);if(rpc[_0x307633[_0xb41b('0x20')]+'QueueReport']){return rpc[_0x307633[_0xb41b('0x20')]+_0xb41b('0x2a')]['create'](_0x5b7332)[_0xb41b('0x2b')](function(_0x4a95e7){logger[_0xb41b('0x2c')](_0xb41b('0x2d'));});}}}function stopRouting(_0x5aae1d,_0x2c0a8d,_0x41b326,_0x14c2e7){if(_0x5aae1d&&_0x2c0a8d){_0x2c0a8d[_0xb41b('0x1b')]-=0x1;var _0x260170={'leaveAt':moment()[_0xb41b('0xf')](_0xb41b('0x1d')),'acceptAt':moment()[_0xb41b('0xf')](_0xb41b('0x1d')),'reason':_0xb41b('0x2e')};logger['info'](util[_0xb41b('0xf')]('[%s][STOP:QUEUE][NAME:%s]',_0x5aae1d,_0x2c0a8d['name']));emitChannelQueueInteraction(_0x41b326[_0xb41b('0x20')],_0x2c0a8d[_0xb41b('0x29')],_0x41b326[_0xb41b('0x1c')],_0x41b326[_0xb41b('0xa')][_0xb41b('0x29')],_0x41b326[_0xb41b('0x25')]['id'],![],_0x14c2e7,_0x2c0a8d['id']);if(rpc[_0x41b326[_0xb41b('0x20')]+_0xb41b('0x2a')]){return rpc[_0x41b326[_0xb41b('0x20')]+_0xb41b('0x2a')][_0xb41b('0x2f')](_0x5aae1d,_0x260170)['catch'](function(_0x13e717){logger[_0xb41b('0x2c')](_0xb41b('0x30'));});}}}function endRouting(_0x23ac00,_0x45a071,_0x10b3f6,_0x54f782){if(_0x23ac00&&_0x45a071){_0x45a071['waiting']-=0x1;var _0x376e4f={'leaveAt':moment()[_0xb41b('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xb41b('0xf')](_0xb41b('0x1d')),'reason':_0xb41b('0x31')};logger[_0xb41b('0x27')](util[_0xb41b('0xf')]('[%s][END:QUEUE][NAME:%s]',_0x23ac00,_0x45a071[_0xb41b('0x29')]));emitChannelQueueInteraction(_0x10b3f6['channel'],_0x45a071[_0xb41b('0x29')],_0x10b3f6[_0xb41b('0x1c')],_0x10b3f6[_0xb41b('0xa')][_0xb41b('0x29')],_0x10b3f6[_0xb41b('0x25')]['id'],![],_0x54f782);if(rpc[_0x10b3f6[_0xb41b('0x20')]+_0xb41b('0x2a')]){return rpc[_0x10b3f6[_0xb41b('0x20')]+_0xb41b('0x2a')]['update'](_0x23ac00,_0x376e4f)['catch'](function(_0x4e0a61){logger[_0xb41b('0x2c')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x56a415){return function(_0x781302){return _0x781302['name'][_0xb41b('0x32')]()===_0x56a415[_0xb41b('0x32')]();};}exports[_0xb41b('0x33')]=function(_0x249ffc,_0x4fa390,_0x25c5b7,_0xddb59c){return function(_0x57e043){try{var _0x259361={'name':_0x4fa390[0x0],'timeout':_0x4fa390[0x1]};var _0xa70324=queue[_0xb41b('0x0')](_0x259361,{'typecast':!![]});if(_0xa70324[_0xb41b('0x34')]){logger['error'](_0xb41b('0x35'),_0x249ffc,_['map'](_0xa70324,_0xb41b('0x25'))[_0xb41b('0x36')](',\x20'));_0x57e043[_0xb41b('0x37')]();}else{var _0x497732=_['find'](_0x25c5b7[_0xddb59c[_0xb41b('0x20')]+_0xb41b('0x38')],handleFindQueue(_0x259361[_0xb41b('0x29')]));if(_0x497732){startRouting(_0x249ffc,_0x497732,_0xddb59c,_0x25c5b7);var _0x35ec51=(_0x497732[_0xb41b('0x31')]||0xa)*0x3e8;var _0x1602ee=(_0x259361[_0xb41b('0x31')]||0x14)*0x3e8;var _0x5df81c,_0x4aefe3;if(_0x35ec51>_0x1602ee){_0x1602ee=_0x35ec51;}var _0x9f88c3=seqqueue['createQueue'](_0x35ec51);_0x9f88c3['id']=_0x249ffc;_0x9f88c3[_0xb41b('0x39')]=_0x35ec51;_0x9f88c3['qtimeout']=_0x1602ee;_0x9f88c3[_0xb41b('0x20')]=_0xddb59c['channel'];_0x25c5b7[_0xb41b('0x3a')][_0x249ffc]['on']('end',function(){logger[_0xb41b('0x27')](_0xb41b('0x3b'),_0x249ffc);stopRouting(_0x249ffc,_0x497732,_0xddb59c,_0x25c5b7);clearTimeout(_0x5df81c);_0x5df81c=undefined;_0x9f88c3[_0xb41b('0x3c')](!![]);if(_0x25c5b7[_0xb41b('0x3a')][_0x249ffc]){delete _0x25c5b7['rules'][_0x249ffc];}_0x57e043[_0xb41b('0x37')]();});_0x25c5b7[_0xb41b('0x3a')][_0x249ffc]['on']('complete',function(){if(_0x25c5b7[_0xb41b('0x3a')][_0x249ffc]){delete _0x25c5b7['rules'][_0x249ffc];}});_0x5df81c=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x249ffc);endRouting(_0x249ffc,_0x497732,_0xddb59c,_0x25c5b7);clearTimeout(_0x5df81c);_0x9f88c3['close'](!![]);_0x57e043[_0xb41b('0x3d')]();},_0x1602ee);switch(_0x497732[_0xb41b('0x3e')]){case _0xb41b('0x3f'):strategy[_0xb41b('0x3f')](_0x9f88c3,_0x497732,_0x25c5b7,_0xddb59c);break;default:strategy[_0xb41b('0x40')](_0x9f88c3,_0x497732,_0x25c5b7,_0xddb59c);}}else{logger[_0xb41b('0x2c')](_0xb41b('0x41'),_0x249ffc,_0x259361[_0xb41b('0x29')]);_0x57e043[_0xb41b('0x37')]();}}}catch(_0x226031){console[_0xb41b('0x42')](_0x226031);logger[_0xb41b('0x2c')](_0xb41b('0x35'),_0x249ffc,_0x226031[_0xb41b('0x43')]);_0x57e043[_0xb41b('0x37')]();}};}; \ No newline at end of file +var _0x1be1=['upperFirst','QueueId','channel','interaction','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list'];(function(_0x1cf486,_0x20f666){var _0x4eaeaa=function(_0x529b25){while(--_0x529b25){_0x1cf486['push'](_0x1cf486['shift']());}};_0x4eaeaa(++_0x20f666);}(_0x1be1,0x192));var _0x11be=function(_0x1a37f0,_0xa0eb23){_0x1a37f0=_0x1a37f0-0x0;var _0x2ce156=_0x1be1[_0x1a37f0];return _0x2ce156;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x11be('0x0'));var seqqueue=require(_0x11be('0x1'));var moment=require('moment');var Redis=require(_0x11be('0x2'));var config=require(_0x11be('0x3'));var logger=require(_0x11be('0x4'))(_0x11be('0x5'));var strategy=require('./strategy');config[_0x11be('0x6')]=_[_0x11be('0x7')](config[_0x11be('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x11be('0x8'))(new Redis(config['redis']));var attributes=['id',_0x11be('0x9'),_0x11be('0xa'),_0x11be('0xb'),_0x11be('0xc'),_0x11be('0xd')];function emit(_0x5f3d04,_0x2bf6db,_0x2754b8){io['to'](_0x5f3d04)['emit'](_0x2bf6db,_0x2754b8);}function emitChannelQueueInteraction(_0x2e4114,_0x2cd786,_0x40f0d1,_0x3fd587,_0x4e013c,_0x447e88,_0xcb8120,_0x26736d){var _0x4b36c8=_[_0x11be('0xe')](_0x40f0d1);_0x4b36c8[_0x11be('0x9')]=_0x26736d;_0x4b36c8['queue']=_0x2cd786;_0x4b36c8[_0x11be('0xa')]=_0x3fd587;_0x4b36c8['id']=_0x4e013c;if(_0x447e88){_0xcb8120[util['format']('%sQueuesWaitingInteractions',_0x2e4114)][_0x4e013c]=_['pick'](_0x4b36c8,attributes);}else{delete _0xcb8120[util['format']('%sQueuesWaitingInteractions',_0x2e4114)][_0x4e013c];}emit(util['format']('%s:queue:%s',_0x2e4114,_0x2cd786),util[_0x11be('0xf')]('%s_queue_waiting_interaction:%s',_0x2e4114,_0x447e88?_0x11be('0x10'):_0x11be('0x11')),_[_0x11be('0x12')](_0x4b36c8,attributes));}var rpc={'openchannelQueueReport':require(_0x11be('0x13')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x11be('0x14')),'smsQueueReport':require(_0x11be('0x15')),'faxQueueReport':require('../../rpc/faxQueueReport')};var queue=schema({'name':{'type':_0x11be('0x16'),'required':!![],'message':_0x11be('0x17')},'timeout':{'type':_0x11be('0x18'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x51ba82,_0x141391,_0x976e51,_0x791bd){if(_0x51ba82&&_0x141391&&_0x976e51){_0x141391[_0x11be('0x19')]+=0x1;var _0x5dd988={'uniqueid':_0x51ba82,'from':_0x976e51[_0x11be('0x1a')]?_0x976e51[_0x11be('0x1a')][_0x11be('0xc')]:'','joinAt':moment()[_0x11be('0xf')](_0x11be('0x1b')),'ContactId':_0x976e51[_0x11be('0x1c')]?_0x976e51[_0x11be('0x1c')]['id']:null,'ListId':_0x976e51[_0x11be('0x1d')]?_0x976e51[_0x11be('0x1d')]['id']:null};_0x5dd988[_[_0x11be('0x1e')](_0x976e51['channel'])+_0x11be('0x1f')]=_0x141391['id']||null;_0x5dd988[_[_0x11be('0x1e')](_0x976e51[_0x11be('0x20')])+'InteractionId']=_0x976e51['interaction']?_0x976e51[_0x11be('0x21')]['id']:null;_0x5dd988[_[_0x11be('0x1e')](_0x976e51[_0x11be('0x20')])+'MessageId']=_0x976e51[_0x11be('0x22')]?_0x976e51['message']['id']:null;_0x5dd988[_[_0x11be('0x1e')](_0x976e51['channel'])+(_0x976e51[_0x11be('0x20')]!==_0x11be('0x23')?'AccountId':_0x11be('0x24'))]=_0x976e51[_0x11be('0xa')]?_0x976e51[_0x11be('0xa')]['id']:null;logger[_0x11be('0x25')](util[_0x11be('0xf')](_0x11be('0x26'),_0x51ba82,_0x141391[_0x11be('0x27')]));emitChannelQueueInteraction(_0x976e51[_0x11be('0x20')],_0x141391[_0x11be('0x27')],_0x5dd988,_0x976e51['account'][_0x11be('0x27')],_0x976e51['message']['id'],!![],_0x791bd,_0x141391['id']);if(rpc[_0x976e51[_0x11be('0x20')]+_0x11be('0x28')]){return rpc[_0x976e51['channel']+'QueueReport'][_0x11be('0x29')](_0x5dd988)[_0x11be('0x2a')](function(_0x5e8f9a){logger[_0x11be('0x2b')](_0x11be('0x2c'));});}}}function stopRouting(_0x300e0a,_0xc97ade,_0x25e214,_0x27e25c){if(_0x300e0a&&_0xc97ade){_0xc97ade['waiting']-=0x1;var _0x71236f={'leaveAt':moment()[_0x11be('0xf')](_0x11be('0x1b')),'acceptAt':moment()[_0x11be('0xf')](_0x11be('0x1b')),'reason':_0x11be('0x2d')};logger['info'](util[_0x11be('0xf')](_0x11be('0x2e'),_0x300e0a,_0xc97ade[_0x11be('0x27')]));emitChannelQueueInteraction(_0x25e214[_0x11be('0x20')],_0xc97ade[_0x11be('0x27')],_0x25e214['body'],_0x25e214[_0x11be('0xa')][_0x11be('0x27')],_0x25e214[_0x11be('0x22')]['id'],![],_0x27e25c,_0xc97ade['id']);if(rpc[_0x25e214['channel']+_0x11be('0x28')]){return rpc[_0x25e214['channel']+'QueueReport']['update'](_0x300e0a,_0x71236f)['catch'](function(_0x398927){logger[_0x11be('0x2b')](_0x11be('0x2f'));});}}}function endRouting(_0x54714c,_0x8a0a97,_0x1866d8,_0x56ecd2){if(_0x54714c&&_0x8a0a97){_0x8a0a97[_0x11be('0x19')]-=0x1;var _0x556989={'leaveAt':moment()[_0x11be('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x11be('0xf')](_0x11be('0x1b')),'reason':_0x11be('0x30')};logger[_0x11be('0x25')](util['format'](_0x11be('0x31'),_0x54714c,_0x8a0a97[_0x11be('0x27')]));emitChannelQueueInteraction(_0x1866d8[_0x11be('0x20')],_0x8a0a97[_0x11be('0x27')],_0x1866d8['body'],_0x1866d8[_0x11be('0xa')][_0x11be('0x27')],_0x1866d8[_0x11be('0x22')]['id'],![],_0x56ecd2);if(rpc[_0x1866d8[_0x11be('0x20')]+_0x11be('0x28')]){return rpc[_0x1866d8[_0x11be('0x20')]+_0x11be('0x28')]['update'](_0x54714c,_0x556989)[_0x11be('0x2a')](function(_0x399d39){logger['error'](_0x11be('0x2f'));});}}}function handleFindQueue(_0x28df0f){return function(_0x49fcb4){return _0x49fcb4[_0x11be('0x27')]['toLowerCase']()===_0x28df0f[_0x11be('0x32')]();};}exports['consequence']=function(_0x354876,_0x30be21,_0x5db494,_0x368d38){return function(_0x47f467){try{var _0x3e041d={'name':_0x30be21[0x0],'timeout':_0x30be21[0x1]};var _0x51a40b=queue[_0x11be('0x33')](_0x3e041d,{'typecast':!![]});if(_0x51a40b[_0x11be('0x34')]){logger[_0x11be('0x2b')](_0x11be('0x35'),_0x354876,_[_0x11be('0x36')](_0x51a40b,'message')[_0x11be('0x37')](',\x20'));_0x47f467[_0x11be('0x38')]();}else{var _0x9610a1=_[_0x11be('0x39')](_0x5db494[_0x368d38['channel']+'Queues'],handleFindQueue(_0x3e041d['name']));if(_0x9610a1){startRouting(_0x354876,_0x9610a1,_0x368d38,_0x5db494);var _0x360475=(_0x9610a1['timeout']||0xa)*0x3e8;var _0x3da37f=(_0x3e041d['timeout']||0x14)*0x3e8;var _0x1856bb,_0x19b7e3;if(_0x360475>_0x3da37f){_0x3da37f=_0x360475;}var _0x283c89=seqqueue[_0x11be('0x3a')](_0x360475);_0x283c89['id']=_0x354876;_0x283c89[_0x11be('0x3b')]=_0x360475;_0x283c89[_0x11be('0x3c')]=_0x3da37f;_0x283c89[_0x11be('0x20')]=_0x368d38['channel'];_0x5db494[_0x11be('0x3d')][_0x354876]['on']('end',function(){logger[_0x11be('0x25')](_0x11be('0x3e'),_0x354876);stopRouting(_0x354876,_0x9610a1,_0x368d38,_0x5db494);clearTimeout(_0x1856bb);_0x1856bb=undefined;_0x283c89[_0x11be('0x3f')](!![]);if(_0x5db494['rules'][_0x354876]){delete _0x5db494['rules'][_0x354876];}_0x47f467['stop']();});_0x5db494[_0x11be('0x3d')][_0x354876]['on'](_0x11be('0x40'),function(){if(_0x5db494['rules'][_0x354876]){delete _0x5db494['rules'][_0x354876];}});_0x1856bb=setTimeout(function(){logger['info'](_0x11be('0x41'),_0x354876);endRouting(_0x354876,_0x9610a1,_0x368d38,_0x5db494);clearTimeout(_0x1856bb);_0x283c89[_0x11be('0x3f')](!![]);_0x47f467[_0x11be('0x42')]();},_0x3da37f);switch(_0x9610a1[_0x11be('0x43')]){case _0x11be('0x44'):strategy[_0x11be('0x44')](_0x283c89,_0x9610a1,_0x5db494,_0x368d38);break;default:strategy[_0x11be('0x45')](_0x283c89,_0x9610a1,_0x5db494,_0x368d38);}}else{logger[_0x11be('0x2b')](_0x11be('0x46'),_0x354876,_0x3e041d[_0x11be('0x27')]);_0x47f467[_0x11be('0x38')]();}}}catch(_0x493799){console[_0x11be('0x47')](_0x493799);logger[_0x11be('0x2b')]('[%s][QUEUE]\x20%s',_0x354876,_0x493799['stack']);_0x47f467['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 5352d35..e29279b 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 _0x6b64=['hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','routing','forcedOwnership','isAgentAvailable','agents','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0x521176,_0x5d0fb4){var _0x5b9d95=function(_0xd90357){while(--_0xd90357){_0x521176['push'](_0x521176['shift']());}};_0x5b9d95(++_0x5d0fb4);}(_0x6b64,0x6a));var _0x46b6=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0x6b64[_0x5f0501];return _0x3c2c45;};'use strict';var _=require(_0x46b6('0x0'));var uuid=require(_0x46b6('0x1'));var util=require(_0x46b6('0x2'));var logger=require(_0x46b6('0x3'))('routing');var Agent=function(_0x54405e,_0x561d66,_0xf5c015,_0x55e890){this[_0x46b6('0x4')]=uuid['v4']();this[_0x46b6('0x5')]=_0x54405e;this['agent']=_0x561d66;this[_0x46b6('0x6')]=_0xf5c015;this['routing']=_0x55e890;this[_0x46b6('0x5')][_0x46b6('0x7')](this[_0x46b6('0x8')][_0x46b6('0x9')](this),this['handleTimeout'][_0x46b6('0x9')](this));this[_0x46b6('0x5')]['on']('timeout',this[_0x46b6('0xa')]['bind'](this));this['squeue']['on'](_0x46b6('0xb'),this[_0x46b6('0xc')][_0x46b6('0x9')](this));};Agent[_0x46b6('0xd')]['push']=function(){this[_0x46b6('0x5')]['push'](this[_0x46b6('0x8')][_0x46b6('0x9')](this),this['handleTimeout']['bind'](this));};Agent[_0x46b6('0xd')]['handleDrained']=function(){this[_0x46b6('0xa')](!![]);};Agent['prototype']['handleRun']=function(_0x54559b){logger['info'](_0x46b6('0xe'),this[_0x46b6('0x5')]['id'],this[_0x46b6('0xf')]['id']);if(_[_0x46b6('0x10')](this['realtime']['agents'][this[_0x46b6('0xf')]['id']])){logger[_0x46b6('0x11')](_0x46b6('0x12'),this['squeue']['id'],this[_0x46b6('0xf')]['id']);setTimeout(this[_0x46b6('0x7')][_0x46b6('0x9')](this),0x3e8);}else{if(this[_0x46b6('0x13')][_0x46b6('0x14')]||util[_0x46b6('0x15')](this['squeue']['id'],this[_0x46b6('0x6')][_0x46b6('0x16')][this[_0x46b6('0xf')]['id']],this[_0x46b6('0x5')]['channel'],![])){this[_0x46b6('0x6')][_0x46b6('0x16')][this[_0x46b6('0xf')]['id']][_0x46b6('0x17')]=!![];this[_0x46b6('0x6')]['agents'][this[_0x46b6('0xf')]['id']][_0x46b6('0x18')]=undefined;util[_0x46b6('0x19')](this[_0x46b6('0x4')],this[_0x46b6('0x5')]['id'],this[_0x46b6('0x6')][_0x46b6('0x16')][this[_0x46b6('0xf')]['id']],null,this['routing']);util[_0x46b6('0x1a')](this[_0x46b6('0x5')]['id'],this[_0x46b6('0x6')]['agents'][this['agent']['id']],_0x46b6('0x1b')+(this[_0x46b6('0x13')]['forcedOwnership']?_0x46b6('0x1c'):''));}else{logger[_0x46b6('0x11')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x46b6('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x46b6('0x7')][_0x46b6('0x9')](this),0x3e8);}}};Agent[_0x46b6('0xd')][_0x46b6('0xa')]=function(_0x3e086e){if(_[_0x46b6('0x10')](this[_0x46b6('0x6')][_0x46b6('0x16')][this[_0x46b6('0xf')]['id']])){return logger[_0x46b6('0x11')](_0x46b6('0x12'),this[_0x46b6('0x5')]['id'],this[_0x46b6('0xf')]['id']);}else{logger[_0x46b6('0x11')](_0x46b6('0x1d'),this[_0x46b6('0x5')]['id'],this[_0x46b6('0xf')]['id']);util[_0x46b6('0x1e')](this[_0x46b6('0x4')],this['squeue']['id'],this[_0x46b6('0x6')][_0x46b6('0x16')][this[_0x46b6('0xf')]['id']],null,this[_0x46b6('0x13')]);this[_0x46b6('0x6')][_0x46b6('0x16')][this[_0x46b6('0xf')]['id']]['busy']=![];this[_0x46b6('0x6')][_0x46b6('0x16')][this['agent']['id']]['busyQueue']=undefined;util[_0x46b6('0x1a')](this[_0x46b6('0x5')]['id'],this[_0x46b6('0x6')]['agents'][this[_0x46b6('0xf')]['id']],_0x3e086e?_0x46b6('0x1f'):_0x46b6('0x20'));}if(!_0x3e086e){setTimeout(this[_0x46b6('0x7')][_0x46b6('0x9')](this),0x3e8);}};function agent(_0x369cae,_0x43036e,_0x2822b4,_0x152889){return new Agent(_0x369cae,_0x43036e,_0x2822b4,_0x152889);}module[_0x46b6('0x21')]=agent; \ No newline at end of file +var _0x5356=['[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','busy','busyQueue','showNotification','routing','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','realtime','squeue','push','handleRun','bind','handleTimeout','drained','prototype','handleDrained'];(function(_0x5bbffb,_0x3eaa49){var _0x430869=function(_0x4d8314){while(--_0x4d8314){_0x5bbffb['push'](_0x5bbffb['shift']());}};_0x430869(++_0x3eaa49);}(_0x5356,0x17e));var _0x6535=function(_0x3130d7,_0x316eeb){_0x3130d7=_0x3130d7-0x0;var _0x27af6c=_0x5356[_0x3130d7];return _0x27af6c;};'use strict';var _=require(_0x6535('0x0'));var uuid=require(_0x6535('0x1'));var util=require(_0x6535('0x2'));var logger=require(_0x6535('0x3'))('routing');var Agent=function(_0x4efbc6,_0x180f24,_0x395c60,_0x475c8b){this[_0x6535('0x4')]=uuid['v4']();this['squeue']=_0x4efbc6;this['agent']=_0x180f24;this[_0x6535('0x5')]=_0x395c60;this['routing']=_0x475c8b;this[_0x6535('0x6')][_0x6535('0x7')](this[_0x6535('0x8')][_0x6535('0x9')](this),this['handleTimeout']['bind'](this));this[_0x6535('0x6')]['on']('timeout',this[_0x6535('0xa')][_0x6535('0x9')](this));this['squeue']['on'](_0x6535('0xb'),this['handleDrained'][_0x6535('0x9')](this));};Agent[_0x6535('0xc')][_0x6535('0x7')]=function(){this[_0x6535('0x6')]['push'](this['handleRun']['bind'](this),this[_0x6535('0xa')][_0x6535('0x9')](this));};Agent[_0x6535('0xc')][_0x6535('0xd')]=function(){this[_0x6535('0xa')](!![]);};Agent[_0x6535('0xc')][_0x6535('0x8')]=function(_0x5939af){logger['info'](_0x6535('0xe'),this['squeue']['id'],this[_0x6535('0xf')]['id']);if(_[_0x6535('0x10')](this['realtime'][_0x6535('0x11')][this[_0x6535('0xf')]['id']])){logger[_0x6535('0x12')](_0x6535('0x13'),this[_0x6535('0x6')]['id'],this[_0x6535('0xf')]['id']);setTimeout(this[_0x6535('0x7')][_0x6535('0x9')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x6535('0x14')](this[_0x6535('0x6')]['id'],this[_0x6535('0x5')]['agents'][this[_0x6535('0xf')]['id']],this[_0x6535('0x6')]['channel'],![])){this['realtime'][_0x6535('0x11')][this[_0x6535('0xf')]['id']][_0x6535('0x15')]=!![];this[_0x6535('0x5')][_0x6535('0x11')][this[_0x6535('0xf')]['id']][_0x6535('0x16')]=undefined;util[_0x6535('0x17')](this[_0x6535('0x4')],this[_0x6535('0x6')]['id'],this[_0x6535('0x5')][_0x6535('0x11')][this[_0x6535('0xf')]['id']],null,this[_0x6535('0x18')]);util[_0x6535('0x19')](this['squeue']['id'],this[_0x6535('0x5')]['agents'][this[_0x6535('0xf')]['id']],_0x6535('0x1a')+(this[_0x6535('0x18')][_0x6535('0x1b')]?_0x6535('0x1c'):''));}else{logger[_0x6535('0x12')](_0x6535('0x1d'),this[_0x6535('0x6')]['id'],this[_0x6535('0xf')]['id']);setTimeout(this[_0x6535('0x7')][_0x6535('0x9')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x39b61b){if(_[_0x6535('0x10')](this[_0x6535('0x5')][_0x6535('0x11')][this[_0x6535('0xf')]['id']])){return logger[_0x6535('0x12')](_0x6535('0x13'),this['squeue']['id'],this[_0x6535('0xf')]['id']);}else{logger[_0x6535('0x12')](_0x6535('0x1e'),this[_0x6535('0x6')]['id'],this['agent']['id']);util['hideNotification'](this['notificationId'],this[_0x6535('0x6')]['id'],this[_0x6535('0x5')]['agents'][this[_0x6535('0xf')]['id']],null,this[_0x6535('0x18')]);this['realtime']['agents'][this[_0x6535('0xf')]['id']][_0x6535('0x15')]=![];this[_0x6535('0x5')][_0x6535('0x11')][this[_0x6535('0xf')]['id']][_0x6535('0x16')]=undefined;util['writeLog'](this['squeue']['id'],this[_0x6535('0x5')]['agents'][this[_0x6535('0xf')]['id']],_0x39b61b?'STOP':_0x6535('0x1f'));}if(!_0x39b61b){setTimeout(this[_0x6535('0x7')][_0x6535('0x9')](this),0x3e8);}};function agent(_0x5ca8cf,_0x404f93,_0x54d8b9,_0x2dec56){return new Agent(_0x5ca8cf,_0x404f93,_0x54d8b9,_0x2dec56);}module[_0x6535('0x20')]=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 91d2c76..c4ad2d5 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 _0x1992=['notificationId','queue','realtime','squeue','handleRun','handleTimeout','bind','handleDrained','prototype','push','Agents','length','agents','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','info','[%s][QUEUE]\x20EMPTY','isNil','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x331085,_0x46ef3b){var _0x1547f4=function(_0x549b5d){while(--_0x549b5d){_0x331085['push'](_0x331085['shift']());}};_0x1547f4(++_0x46ef3b);}(_0x1992,0x131));var _0x2199=function(_0x1a49e9,_0x1a5e3f){_0x1a49e9=_0x1a49e9-0x0;var _0x4cf0db=_0x1992[_0x1a49e9];return _0x4cf0db;};'use strict';var _=require(_0x2199('0x0'));var uuid=require(_0x2199('0x1'));var util=require(_0x2199('0x2'));var logger=require(_0x2199('0x3'))(_0x2199('0x4'));var Beepall=function(_0x1bd3ab,_0x1eea40,_0x1f2069,_0x473229){this[_0x2199('0x5')]=uuid['v4']();this['squeue']=_0x1bd3ab;this[_0x2199('0x6')]=_0x1eea40;this[_0x2199('0x7')]=_0x1f2069;this[_0x2199('0x4')]=_0x473229;this[_0x2199('0x8')]['push'](this[_0x2199('0x9')]['bind'](this),this['handleTimeout']['bind'](this));this[_0x2199('0x8')]['on']('timeout',this[_0x2199('0xa')][_0x2199('0xb')](this));this[_0x2199('0x8')]['on']('drained',this[_0x2199('0xc')][_0x2199('0xb')](this));};Beepall[_0x2199('0xd')][_0x2199('0xe')]=function(){this[_0x2199('0x8')][_0x2199('0xe')](this['handleRun'][_0x2199('0xb')](this),this[_0x2199('0xa')][_0x2199('0xb')](this));};Beepall[_0x2199('0xd')][_0x2199('0xc')]=function(_0x317728){this[_0x2199('0xa')](!![]);};Beepall['prototype'][_0x2199('0x9')]=function(_0x439736){var _0x34242e=!![];if(!_['isNil'](this[_0x2199('0x6')])&&!_['isNil'](this[_0x2199('0x6')]['Agents'])&&this[_0x2199('0x6')][_0x2199('0xf')]['length']>0x0){for(var _0x3d4166=0x0,_0x286312;_0x3d41660x0){for(var _0x1dd8f2=0x0,_0x2b8763;_0x1dd8f20x0&&_0x3255cf[_0x17a9bc+_0xf31f('0x25')]>=_0x3255cf[_0x17a9bc+_0xf31f('0x23')]){writeLog(_0x3c6316,_0x3255cf,_0x17a9bc['toUpperCase']()+_0xf31f('0x26'));return![];}}return!![];};exports[_0xf31f('0x27')]=function(_0x11e305,_0x57e28c,_0x3783b1,_0xd847dd,_0x17b39f){return sendNotification(!![],_0x11e305,_0x57e28c,_0x3783b1,_0xd847dd,_0x17b39f);};exports[_0xf31f('0x28')]=function(_0x3d0ac7,_0x15a2d6,_0x205ed1,_0x4e117e,_0x499938){return sendNotification(![],_0x3d0ac7,_0x15a2d6,_0x205ed1,_0x4e117e,_0x499938);};exports[_0xf31f('0x29')]=writeLog; \ No newline at end of file +var _0x6eaf=['hideNotification','lodash','util','../utils','../../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','notification:%s','save','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','Pause','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification'];(function(_0x481604,_0x276ff8){var _0x1ca4ed=function(_0x136e9d){while(--_0x136e9d){_0x481604['push'](_0x481604['shift']());}};_0x1ca4ed(++_0x276ff8);}(_0x6eaf,0xe5));var _0xf6ea=function(_0x58c70c,_0xbf6011){_0x58c70c=_0x58c70c-0x0;var _0x1cc63f=_0x6eaf[_0x58c70c];return _0x1cc63f;};'use strict';var _=require(_0xf6ea('0x0'));var util=require(_0xf6ea('0x1'));var utils=require(_0xf6ea('0x2'));var Mustache=require('mustache');var Redis=require('ioredis');var config=require('../../../../../config/environment');var logger=require(_0xf6ea('0x3'))('routing');config[_0xf6ea('0x4')]=_[_0xf6ea('0x5')](config[_0xf6ea('0x4')],{'host':_0xf6ea('0x6'),'port':0x18eb});var io=require(_0xf6ea('0x7'))(new Redis(config[_0xf6ea('0x4')]));function emit(_0x26aba6,_0x142f30,_0x86aaac){io['to'](_0x26aba6)[_0xf6ea('0x8')](_0x142f30,_0x86aaac);}function sendNotification(_0x312f69,_0x3567e6,_0x368e36,_0x5df9e1,_0x5f5723,_0x4086b2){io['to'](util[_0xf6ea('0x9')](_0xf6ea('0xa'),_0x5df9e1[_0xf6ea('0xb')]))[_0xf6ea('0x8')](_0xf6ea('0xc'),_0x5df9e1);var _0x15d6d3=_0x4086b2||{};var _0x49535a=_0x368e36[_0xf6ea('0xd')]('.');var _0xe0abe4={'uniqueid':_0x3567e6,'channel':_0x49535a[0x0],'id':_0x49535a[0x1],'title':_0x49535a[0x0]+_0xf6ea('0xe'),'interactionId':_0x49535a[0x2],'queue':_0x5f5723?_0x5f5723['name']:null,'sound':_0x15d6d3[_0xf6ea('0xf')][_0xf6ea('0x10')],'shake':_0x15d6d3['account']['notificationShake']};try{if(!_0x15d6d3['body']){_0x15d6d3[_0xf6ea('0x11')]={};}if(_0x5f5723){_0x15d6d3[_0xf6ea('0x11')][_0xf6ea('0x12')]=_0x5f5723;}else if(_0x15d6d3['body'][_0xf6ea('0x12')]){delete _0x15d6d3[_0xf6ea('0x11')]['queue'];}_0xe0abe4[_0xf6ea('0x13')]=utils[_0xf6ea('0x14')](_0x15d6d3[_0xf6ea('0xf')][_0xf6ea('0x15')],_0x15d6d3);}catch(_0x34edaa){_0xe0abe4[_0xf6ea('0x13')]=_0xf6ea('0x16');logger[_0xf6ea('0x17')](util[_0xf6ea('0x9')](_0xf6ea('0x18'),_0x3567e6,_0x34edaa['message']));}io['to'](util[_0xf6ea('0x9')]('user:%s',_0x5df9e1[_0xf6ea('0xb')]))[_0xf6ea('0x8')](util[_0xf6ea('0x9')](_0xf6ea('0x19'),_0x312f69?_0xf6ea('0x1a'):'remove'),_0xe0abe4);}function writeLog(_0x628d05,_0x37d75a,_0x22296c){return logger['info'](util[_0xf6ea('0x9')](_0xf6ea('0x1b'),_0x628d05,_0x37d75a[_0xf6ea('0xb')],_0x22296c));}exports[_0xf6ea('0x1c')]=function(_0x281eca,_0x67f875,_0x44875b,_0x55a79a){if(_0x67f875[_0xf6ea('0x1d')]){writeLog(_0x281eca,_0x67f875,_0xf6ea('0x1e'));return![];}if(!_0x67f875['online']){writeLog(_0x281eca,_0x67f875,_0xf6ea('0x1f'));return![];}if(_0x67f875[_0x44875b+_0xf6ea('0x20')]){writeLog(_0x281eca,_0x67f875,'PAUSE');return![];}if(_0x55a79a&&_0x67f875['hasOwnProperty'](_0x44875b+_0xf6ea('0x21'))&&_0x67f875['hasOwnProperty'](_0x44875b+_0xf6ea('0x22'))){if(_0x67f875[_0x44875b+_0xf6ea('0x21')]>0x0&&_0x67f875[_0x44875b+_0xf6ea('0x22')]>=_0x67f875[_0x44875b+_0xf6ea('0x21')]){writeLog(_0x281eca,_0x67f875,_0x44875b['toUpperCase']()+_0xf6ea('0x23'));return![];}}return!![];};exports[_0xf6ea('0x24')]=function(_0x17f46c,_0x1a5a92,_0x48804d,_0xc6a0d4,_0x681c95){return sendNotification(!![],_0x17f46c,_0x1a5a92,_0x48804d,_0xc6a0d4,_0x681c95);};exports[_0xf6ea('0x25')]=function(_0x402f79,_0x3124ed,_0xebd4ea,_0x1d23ad,_0x2f2083){return sendNotification(![],_0x402f79,_0x3124ed,_0xebd4ea,_0x1d23ad,_0x2f2083);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index aa7d56d..c1ce7fb 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 _0x4843=['consequence','error','[%s][SYSTEM]\x20%s','map','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','./utils','../../../../config/logger','routing','string'];(function(_0x2f1039,_0x4d314e){var _0x1fd2d9=function(_0x5ee575){while(--_0x5ee575){_0x2f1039['push'](_0x2f1039['shift']());}};_0x1fd2d9(++_0x4d314e);}(_0x4843,0x171));var _0x3484=function(_0x578a22,_0x24bab0){_0x578a22=_0x578a22-0x0;var _0x19d876=_0x4843[_0x578a22];return _0x19d876;};'use strict';var schema=require(_0x3484('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x3484('0x1'));var logger=require(_0x3484('0x2'))(_0x3484('0x3'));var system=schema({'command':{'type':_0x3484('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x3484('0x5')]=function(_0x3baa8b,_0x496b21){return function(_0x1e1ae4){try{var _0x546ed3={'command':_0x496b21[0x0]};var _0x1f3e5c=system[_0x3484('0x0')](_0x546ed3,{'typecast':!![]});if(_0x1f3e5c['length']){logger[_0x3484('0x6')](_0x3484('0x7'),_0x3baa8b,_[_0x3484('0x8')](_0x1f3e5c,'message')[_0x3484('0x9')](',\x20'));logger['info'](_0x3484('0xa'),_0x3baa8b);_0x1e1ae4[_0x3484('0xb')]();}else{var _0x2498a7=this;var _0x5e63d5=utils[_0x3484('0xc')](_0x496b21[0x0],this);logger[_0x3484('0xd')](_0x3484('0xe'),_0x3baa8b,_0x5e63d5);sh['exec'](_['trim'](_0x5e63d5),function(_0x2e2f43,_0x3e6b9d){logger[_0x3484('0xd')](_0x3484('0xf'),_0x3baa8b,_0x2e2f43);if(_0x2e2f43==0x0){var _0xb0670c=_0x3e6b9d[_0x3484('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x3484('0x11')](_0x496b21[0x1])||_[_0x3484('0x12')](_0x496b21[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x3baa8b);_0x2498a7[_0x3484('0x13')][_0x496b21[0x1]]=_0xb0670c;}else{logger[_0x3484('0xd')](_0x3484('0x14'),_0x3baa8b,_0x496b21[0x1],_0xb0670c);_0x2498a7[_0x3484('0x13')][_0x496b21[0x1]]=_0xb0670c;}}_0x1e1ae4[_0x3484('0xb')]();});}}catch(_0x46c6b1){logger['error'](_0x3484('0x7'),_0x3baa8b,_[_0x3484('0x15')](_0x46c6b1)?JSON['stringify'](_0x46c6b1):_0x46c6b1);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3baa8b);_0x1e1ae4[_0x3484('0xb')]();}};}; \ No newline at end of file +var _0x90f8=['[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','[%s][SYSTEM]\x20%s','validate','shelljs','lodash','routing','string','length','error','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','info','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body'];(function(_0x41b149,_0x185afd){var _0x18db1f=function(_0xdbdf83){while(--_0xdbdf83){_0x41b149['push'](_0x41b149['shift']());}};_0x18db1f(++_0x185afd);}(_0x90f8,0x1a7));var _0x890f=function(_0x343cd2,_0x440f7a){_0x343cd2=_0x343cd2-0x0;var _0x4bdfd9=_0x90f8[_0x343cd2];return _0x4bdfd9;};'use strict';var schema=require(_0x890f('0x0'));var sh=require(_0x890f('0x1'));var _=require(_0x890f('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x890f('0x3'));var system=schema({'command':{'type':_0x890f('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0xdfb357,_0x5c5804){return function(_0x2afd56){try{var _0x43d458={'command':_0x5c5804[0x0]};var _0x57683f=system[_0x890f('0x0')](_0x43d458,{'typecast':!![]});if(_0x57683f[_0x890f('0x5')]){logger[_0x890f('0x6')]('[%s][SYSTEM]\x20%s',_0xdfb357,_['map'](_0x57683f,_0x890f('0x7'))[_0x890f('0x8')](',\x20'));logger['info'](_0x890f('0x9'),_0xdfb357);_0x2afd56['next']();}else{var _0x513c66=this;var _0x349274=utils['getMustacheRender'](_0x5c5804[0x0],this);logger[_0x890f('0xa')]('[%s][SYSTEM]\x20commnad:\x20%s',_0xdfb357,_0x349274);sh['exec'](_['trim'](_0x349274),function(_0x3c3013,_0x102418){logger['info'](_0x890f('0xb'),_0xdfb357,_0x3c3013);if(_0x3c3013==0x0){var _0x1aa073=_0x102418[_0x890f('0xc')](/(\r\n|\n|\r)/gm,'');if(_[_0x890f('0xd')](_0x5c5804[0x1])||_[_0x890f('0xe')](_0x5c5804[0x1])){logger[_0x890f('0xa')](_0x890f('0xf'),_0xdfb357);_0x513c66[_0x890f('0x10')][_0x5c5804[0x1]]=_0x1aa073;}else{logger[_0x890f('0xa')](_0x890f('0x11'),_0xdfb357,_0x5c5804[0x1],_0x1aa073);_0x513c66[_0x890f('0x10')][_0x5c5804[0x1]]=_0x1aa073;}}_0x2afd56[_0x890f('0x12')]();});}}catch(_0x3ab333){logger['error'](_0x890f('0x13'),_0xdfb357,_['isObject'](_0x3ab333)?JSON['stringify'](_0x3ab333):_0x3ab333);logger[_0x890f('0xa')](_0x890f('0x9'),_0xdfb357);_0x2afd56[_0x890f('0x12')]();}};}; \ 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 2c311f9..7da7eca 100644 --- a/server/services/routing/server/applications/tag.js +++ b/server/services/routing/server/applications/tag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x3d9bb6,_0x39f7c1){var _0x4209b5=function(_0x9ec1dd){while(--_0x9ec1dd){_0x3d9bb6['push'](_0x3d9bb6['shift']());}};_0x4209b5(++_0x39f7c1);}(_0x7a54,0x106));var _0x47a5=function(_0x38629a,_0x17d254){_0x38629a=_0x38629a-0x0;var _0x45832d=_0x7a54[_0x38629a];return _0x45832d;};'use strict';var schema=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var rpc={'chatInteraction':require(_0x47a5('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x47a5('0x3')),'mailInteraction':require(_0x47a5('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var tag=schema({'tag':{'type':_0x47a5('0x7'),'required':!![],'message':_0x47a5('0x8')}});exports[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629,_0x59199c,_0x343372){return function(_0x30e405){try{var _0x506eda={'tag':_0x3d5629[0x0]};var _0x194fb0=tag['validate'](_0x506eda,{'typecast':!![]});if(_0x194fb0['length']){logger['error'](_0x47a5('0xa'),_0x545a97,_[_0x47a5('0xb')](_0x194fb0,'message')[_0x47a5('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x545a97);_0x30e405[_0x47a5('0xd')]();}else{var _0x69e4d4={'ids':[_0x3d5629[0x0]]};if(rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')]){rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')][_0x47a5('0x10')](_0x343372['interaction']['id'],_0x69e4d4)[_0x47a5('0x11')](function(_0x221b54){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x545a97,_0x3d5629[0x1],_0x343372[_0x47a5('0xe')],_0x343372[_0x47a5('0x14')]['id']);})[_0x47a5('0x15')](function(_0x190faa){logger['error'](_0x47a5('0xa'),_0x545a97,JSON[_0x47a5('0x16')](_0x190faa));logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);})[_0x47a5('0x18')](function(){_0x30e405['next']();});}}}catch(_0x549de3){logger[_0x47a5('0x19')]('[%s][TAG]\x20%s',_0x545a97,_['isObject'](_0x549de3)?JSON[_0x47a5('0x16')](_0x549de3):_0x549de3);logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);_0x30e405[_0x47a5('0xd')]();}};}; \ No newline at end of file +var _0x7a54=['finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x15fe7c,_0x5aaf16){var _0x75e865=function(_0x2fb966){while(--_0x2fb966){_0x15fe7c['push'](_0x15fe7c['shift']());}};_0x75e865(++_0x5aaf16);}(_0x7a54,0x106));var _0x47a5=function(_0x3bc79b,_0x58b4b7){_0x3bc79b=_0x3bc79b-0x0;var _0x557248=_0x7a54[_0x3bc79b];return _0x557248;};'use strict';var schema=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var rpc={'chatInteraction':require(_0x47a5('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x47a5('0x3')),'mailInteraction':require(_0x47a5('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var tag=schema({'tag':{'type':_0x47a5('0x7'),'required':!![],'message':_0x47a5('0x8')}});exports[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629,_0x59199c,_0x343372){return function(_0x30e405){try{var _0x506eda={'tag':_0x3d5629[0x0]};var _0x194fb0=tag['validate'](_0x506eda,{'typecast':!![]});if(_0x194fb0['length']){logger['error'](_0x47a5('0xa'),_0x545a97,_[_0x47a5('0xb')](_0x194fb0,'message')[_0x47a5('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x545a97);_0x30e405[_0x47a5('0xd')]();}else{var _0x69e4d4={'ids':[_0x3d5629[0x0]]};if(rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')]){rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')][_0x47a5('0x10')](_0x343372['interaction']['id'],_0x69e4d4)[_0x47a5('0x11')](function(_0x221b54){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x545a97,_0x3d5629[0x1],_0x343372[_0x47a5('0xe')],_0x343372[_0x47a5('0x14')]['id']);})[_0x47a5('0x15')](function(_0x190faa){logger['error'](_0x47a5('0xa'),_0x545a97,JSON[_0x47a5('0x16')](_0x190faa));logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);})[_0x47a5('0x18')](function(){_0x30e405['next']();});}}}catch(_0x549de3){logger[_0x47a5('0x19')]('[%s][TAG]\x20%s',_0x545a97,_['isObject'](_0x549de3)?JSON[_0x47a5('0x16')](_0x549de3):_0x549de3);logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);_0x30e405[_0x47a5('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index ec925d3..7089107 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 _0x00bb=['body','message','account','mustache','lodash','exports','merge'];(function(_0x2254a0,_0x41f33e){var _0x35cd31=function(_0x5242d5){while(--_0x5242d5){_0x2254a0['push'](_0x2254a0['shift']());}};_0x35cd31(++_0x41f33e);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x00bb[_0x2bf141];return _0x48277b;};'use strict';var Mustache=require(_0xb00b('0x0'));var _=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'getMustacheRender':function(_0x54f40d,_0x170f94){return Mustache['render'](_0x54f40d,_[_0xb00b('0x3')](_0x170f94[_0xb00b('0x4')],{'contact':_0x170f94['contact'],'message':_0x170f94[_0xb00b('0x5')],'account':_0x170f94[_0xb00b('0x6')],'interaction':_0x170f94['interaction'],'list':_0x170f94['list']}))||'';}}; \ No newline at end of file +var _0x702d=['lodash','exports','merge','body','contact','message','interaction','mustache'];(function(_0x4faeab,_0x30c52e){var _0x3871ec=function(_0x386180){while(--_0x386180){_0x4faeab['push'](_0x4faeab['shift']());}};_0x3871ec(++_0x30c52e);}(_0x702d,0x147));var _0xd702=function(_0x44766d,_0x191a95){_0x44766d=_0x44766d-0x0;var _0xbdbeff=_0x702d[_0x44766d];return _0xbdbeff;};'use strict';var Mustache=require(_0xd702('0x0'));var _=require(_0xd702('0x1'));module[_0xd702('0x2')]={'getMustacheRender':function(_0x33e7c5,_0x37ed5c){return Mustache['render'](_0x33e7c5,_[_0xd702('0x3')](_0x37ed5c[_0xd702('0x4')],{'contact':_0x37ed5c[_0xd702('0x5')],'message':_0x37ed5c[_0xd702('0x6')],'account':_0x37ed5c['account'],'interaction':_0x37ed5c[_0xd702('0x7')],'list':_0x37ed5c['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 1a8f4f1..c3bdcfc 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 _0xcb15=['capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','waiting','mailQueues','openchannelQueues','paused','smsQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','applications','length','join','app','toLowerCase','autoreply','appdata','split','slice','dialogflow','push','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','matchPath','emit','complete','stack','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agents','agent','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcb15,0xbe));var _0x5cb1=function(_0xfd0618,_0x8ab319){_0xfd0618=_0xfd0618-0x0;var _0x277a3b=_0xcb15[_0xfd0618];return _0x277a3b;};'use strict';var _=require(_0x5cb1('0x0'));var util=require('util');var path=require(_0x5cb1('0x1'));var fs=require('fs');var jayson=require(_0x5cb1('0x2'));var BPromise=require(_0x5cb1('0x3'));var uuid=require(_0x5cb1('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x5cb1('0x5'));var rpc={'openchannelQueueReport':require(_0x5cb1('0x6'))};var rpc={'openchannelQueueReport':require(_0x5cb1('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x5cb1('0x7')),'smsQueueReport':require(_0x5cb1('0x8')),'faxQueueReport':require(_0x5cb1('0x9'))};var RuleEngine=require(_0x5cb1('0xa'));function getId(_0x535f59,_0x376825,_0x343f94){return util[_0x5cb1('0xb')](_0x5cb1('0xc'),_0x535f59,_0x376825||0x0,_0x343f94||0x0);}function getIntervals(_0x2d7f9b,_0x4f1f51){var _0x407337=[];if(!_['isNil'](_0x4f1f51[_0x5cb1('0xd')])&&!_[_0x5cb1('0xe')](_0x2d7f9b[_0x4f1f51[_0x5cb1('0xd')]])&&!_[_0x5cb1('0xe')](_0x2d7f9b[_0x4f1f51['IntervalId']][_0x5cb1('0xf')])){_0x407337=_[_0x5cb1('0x10')](_0x2d7f9b[_0x4f1f51[_0x5cb1('0xd')]]['Intervals'],_0x5cb1('0x11'));}else if(!_[_0x5cb1('0xe')](_0x4f1f51[_0x5cb1('0x11')])){_0x407337=[_0x4f1f51[_0x5cb1('0x11')]];}return _0x407337;}exports[_0x5cb1('0x12')]=function(_0x405b56){_0x405b56[_0x5cb1('0x13')]={};return new BPromise(function(_0x27367d,_0x4f64e9){var _0x4e8d9f={'Start':function(_0x133ab0){var _0x363457=this;return new Promise(function(_0x14f19c,_0x3dfaf2){if(_0x133ab0){try{var _0x26b173=[];var _0x1b37b9=getId(_0x133ab0[_0x5cb1('0x14')],_0x133ab0[_0x5cb1('0x15')]?_0x133ab0[_0x5cb1('0x15')]['id']:0x0,_0x133ab0['interaction']?_0x133ab0[_0x5cb1('0x16')]['id']:0x0);if(_0x133ab0[_0x5cb1('0x17')]&&_['isArray'](_0x133ab0[_0x5cb1('0x17')])&&_0x133ab0[_0x5cb1('0x17')][_0x5cb1('0x18')]){for(var _0x2ea17c=0x0;_0x2ea17c<_0x133ab0[_0x5cb1('0x17')][_0x5cb1('0x18')];_0x2ea17c+=0x1){var _0x134773=_0x133ab0[_0x5cb1('0x17')][_0x2ea17c];if(fs['existsSync'](path[_0x5cb1('0x19')](__dirname,_0x5cb1('0x17'),_0x134773[_0x5cb1('0x1a')]+'.js'))){var _0x671179=[];switch(_0x134773['app'][_0x5cb1('0x1b')]()){case _0x5cb1('0x1c'):var _0x48b2a8=_0x134773[_0x5cb1('0x1d')][_0x5cb1('0x1e')](',');_0x671179['push'](_0x48b2a8[0x0]);_0x671179['push'](_0x48b2a8[_0x5cb1('0x1f')](0x1,_0x48b2a8[_0x5cb1('0x18')])[_0x5cb1('0x19')](','));break;case _0x5cb1('0x20'):var _0x2feacd=_0x134773[_0x5cb1('0x1d')][_0x5cb1('0x1e')](',');_0x671179[_0x5cb1('0x21')](_0x2feacd[0x0]);_0x671179[_0x5cb1('0x21')](_0x2feacd[0x1]);_0x671179[_0x5cb1('0x21')](_0x2feacd[_0x5cb1('0x1f')](0x2,_0x2feacd[_0x5cb1('0x18')])[_0x5cb1('0x19')](','));break;case _0x5cb1('0x22'):var _0x4387a2=_0x134773['appdata']['split'](',');_0x671179[_0x5cb1('0x21')](_0x4387a2[0x0]);_0x671179[_0x5cb1('0x21')](_0x4387a2[0x1]);_0x671179[_0x5cb1('0x21')](_0x4387a2[0x2]);_0x671179[_0x5cb1('0x21')](_0x4387a2[0x3]);_0x671179['push'](_0x4387a2[_0x5cb1('0x1f')](0x4,_0x4387a2[_0x5cb1('0x18')])[_0x5cb1('0x19')](','));break;case'message':_0x671179[_0x5cb1('0x21')](_0x134773[_0x5cb1('0x1d')]);break;case _0x5cb1('0x23'):_0x671179[_0x5cb1('0x21')](_0x134773[_0x5cb1('0x24')]);_0x671179[_0x5cb1('0x21')](_0x134773[_0x5cb1('0x1d')]);break;default:_0x671179=_[_0x5cb1('0xe')](_0x134773[_0x5cb1('0x1d')])?[]:_0x134773['appdata'][_0x5cb1('0x1e')](',');}var _0x57841a={'id':util[_0x5cb1('0xb')](_0x5cb1('0x25'),_0x1b37b9,_0x134773['id'],_0x134773['app']),'condition':require(_0x5cb1('0x26'))[_0x5cb1('0x27')](_0x1b37b9,getIntervals(_0x405b56['intervals'],_0x134773),_0x405b56),'consequence':require('./applications/'+_0x134773['app'])[_0x5cb1('0x28')](_0x1b37b9,_0x671179,_0x405b56,_0x133ab0),'p':_0x134773['priority']||0x0};logger[_0x5cb1('0x29')](_0x5cb1('0x2a'),_0x57841a['id'],_0x5cb1('0x2b'),getIntervals(_0x405b56['intervals'],_0x134773)[_0x5cb1('0x19')](_0x5cb1('0x2c')));_0x26b173[_0x5cb1('0x21')](_0x57841a);}else{logger[_0x5cb1('0x2d')](_0x5cb1('0x2e'),path[_0x5cb1('0x19')](__dirname,_0x5cb1('0x17'),_0x134773[_0x5cb1('0x1a')]+'.js'));}}_0x405b56[_0x5cb1('0x13')][_0x1b37b9]=new RuleEngine(_0x26b173);_0x405b56[_0x5cb1('0x13')][_0x1b37b9][_0x5cb1('0x2f')](_0x133ab0,function(_0x51870c){logger[_0x5cb1('0x29')]('Applications\x20executed',JSON['stringify'](_0x51870c[_0x5cb1('0x30')]));if(_0x405b56[_0x5cb1('0x13')][_0x1b37b9]){_0x405b56['rules'][_0x1b37b9][_0x5cb1('0x31')](_0x5cb1('0x32'));}});return _0x14f19c({'code':0xc8,'message':_0x133ab0});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x14f19c({'code':0xc8,'message':_0x133ab0});}}catch(_0x40f656){logger[_0x5cb1('0x2d')](_0x40f656[_0x5cb1('0x33')]);return _0x3dfaf2(_0x363457[_0x5cb1('0x2d')](0x1f4,_0x40f656));}}return _0x3dfaf2('routing\x20is\x20empty');});},'AcceptMessage':function(_0x282504){var _0x3a03af=this;return new Promise(function(_0x21b25b,_0xf1fb36){if(_0x282504[_0x5cb1('0x15')]&&_0x282504['message']['id']){try{var _0x2f89a3=getId(_0x282504['channel'],_0x282504[_0x5cb1('0x15')]?_0x282504[_0x5cb1('0x15')]['id']:0x0,_0x282504[_0x5cb1('0x16')]?_0x282504[_0x5cb1('0x16')]['id']:0x0);if(_0x405b56[_0x5cb1('0x13')][_0x2f89a3]){_0x405b56[_0x5cb1('0x13')][_0x2f89a3][_0x5cb1('0x31')](_0x5cb1('0x34'));if(rpc[_0x282504[_0x5cb1('0x14')]+_0x5cb1('0x35')]){rpc[_0x282504['channel']+_0x5cb1('0x35')][_0x5cb1('0x36')](_0x2f89a3,{'UserId':_0x282504['message'][_0x5cb1('0x37')]})[_0x5cb1('0x38')](function(_0x4e2aae){logger[_0x5cb1('0x2d')](_0x5cb1('0x39'));});}}return _0x21b25b({'code':0xc8,'message':_0x282504});}catch(_0x282ec6){logger['error'](_0x282ec6['stack']);return _0xf1fb36(_0x3a03af[_0x5cb1('0x2d')](0x1f4,_0x282ec6));}}logger[_0x5cb1('0x2d')](_0x5cb1('0x3a'));return _0xf1fb36(_0x3a03af['error'](0x1f4,_0x5cb1('0x3a')));});},'RejectMessage':function(_0x2dcd8b){var _0x6e012a=this;return new Promise(function(_0x4ec7c3,_0x189f63){if(_0x2dcd8b['agent']&&_0x2dcd8b['agent']['id']){try{if(_0x405b56[_0x5cb1('0x3b')][_0x2dcd8b[_0x5cb1('0x3c')]['id']]){_0x405b56[_0x5cb1('0x3b')][_0x2dcd8b[_0x5cb1('0x3c')]['id']]['busy']=![];_0x405b56[_0x5cb1('0x3b')][_0x2dcd8b[_0x5cb1('0x3c')]['id']]['busyQueue']=undefined;}return _0x4ec7c3({'code':0xc8,'message':_0x2dcd8b});}catch(_0x149324){logger['error'](_0x149324[_0x5cb1('0x33')]);return _0x189f63(_0x6e012a[_0x5cb1('0x2d')](0x1f4,_0x149324));}}logger[_0x5cb1('0x2d')](_0x5cb1('0x3a'));return _0x189f63(_0x6e012a['error'](0x1f4,_0x5cb1('0x3a')));});},'AbandonInteraction':function(_0xdddb94){var _0x17059d=this;return new Promise(function(_0x349266,_0x4a2e68){if(_0xdddb94['channel']&&_0xdddb94[_0x5cb1('0x16')]&&_0xdddb94[_0x5cb1('0x16')]['id']){try{var _0x3629ff=getId(_0xdddb94[_0x5cb1('0x14')],_0xdddb94[_0x5cb1('0x15')]?_0xdddb94[_0x5cb1('0x15')]['id']:0x0,_0xdddb94[_0x5cb1('0x16')]?_0xdddb94[_0x5cb1('0x16')]['id']:0x0);if(_0x405b56[_0x5cb1('0x13')][_0x3629ff]){_0x405b56[_0x5cb1('0x13')][_0x3629ff][_0x5cb1('0x31')](_0x5cb1('0x34'));}return _0x349266({'code':0xc8,'message':_0xdddb94});}catch(_0x2c23b9){logger[_0x5cb1('0x2d')](_0x2c23b9['stack']);return _0x4a2e68(_0x17059d[_0x5cb1('0x2d')](0x1f4,_0x2c23b9));}}logger[_0x5cb1('0x2d')]('message\x20is\x20empty');return _0x4a2e68(_0x17059d[_0x5cb1('0x2d')](0x1f4,_0x5cb1('0x3a')));});},'AgentCapacity':function(_0x591244){var _0x45554b=this;return new Promise(function(_0x17480e,_0x828951){if(_0x405b56[_0x5cb1('0x3b')][_0x5cb1('0x3d')](_0x591244['id'])){for(var _0x260c80 in _0x591244[_0x5cb1('0x3e')]){if(_0x591244[_0x5cb1('0x3e')][_0x5cb1('0x3d')](_0x260c80)){if(_0x405b56['agents'][_0x591244['id']][_0x5cb1('0x3d')](_0x260c80+_0x5cb1('0x3f'))){_0x405b56[_0x5cb1('0x3b')][_0x591244['id']][_0x260c80+_0x5cb1('0x3f')]=parseInt(_0x591244['capacity'][_0x260c80],0xa);}}}_0x405b56[_0x5cb1('0x3b')][_0x591244['id']][_0x5cb1('0x40')]();return _0x17480e({'code':0xc8,'message':_0x405b56['agents'][_0x591244['id']]});}else{return _0x828951(_0x45554b[_0x5cb1('0x2d')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x45843d){return new Promise(function(_0x954b4d,_0x529b4a){var _0xf3c204=_[_0x5cb1('0x41')](_0x405b56[_0x5cb1('0x3b')]);_0x954b4d({'count':_0xf3c204[_0x5cb1('0x18')],'rows':_0xf3c204});});},'ChatQueues':function(_0x129b75){return new Promise(function(_0x4eba76,_0x588937){var _0x5b6884=[];for(var _0x2cd4a4 in _0x405b56[_0x5cb1('0x42')]){if(_0x405b56[_0x5cb1('0x42')]['hasOwnProperty'](_0x2cd4a4)){var _0x31dd71=_0x405b56['chatQueues'][_0x2cd4a4];var _0x100d58={'id':_0x31dd71['id'],'available':_0x31dd71[_0x5cb1('0x43')],'loggedIn':_0x31dd71[_0x5cb1('0x44')],'name':_0x31dd71[_0x5cb1('0x45')],'paused':_0x31dd71['paused'],'waiting':_0x31dd71[_0x5cb1('0x46')]};_0x5b6884[_0x5cb1('0x21')](_0x100d58);}}_0x4eba76({'count':_0x5b6884['length'],'rows':_0x5b6884});});},'MailQueues':function(_0x5c8e7a){return new Promise(function(_0x20d295,_0x2db9dd){var _0x251e92=[];for(var _0x1a414a in _0x405b56[_0x5cb1('0x47')]){if(_0x405b56[_0x5cb1('0x47')][_0x5cb1('0x3d')](_0x1a414a)){var _0x2d8a56=_0x405b56[_0x5cb1('0x47')][_0x1a414a];var _0x3d25b3={'id':_0x2d8a56['id'],'available':_0x2d8a56[_0x5cb1('0x43')],'loggedIn':_0x2d8a56['loggedIn'],'name':_0x2d8a56[_0x5cb1('0x45')],'paused':_0x2d8a56['paused'],'waiting':_0x2d8a56['waiting']};_0x251e92[_0x5cb1('0x21')](_0x3d25b3);}}_0x20d295({'count':_0x251e92[_0x5cb1('0x18')],'rows':_0x251e92});});},'OpenchannelQueues':function(_0x284181){return new Promise(function(_0x159b87,_0x5190a4){var _0x4fd084=[];for(var _0x57868c in _0x405b56[_0x5cb1('0x48')]){if(_0x405b56[_0x5cb1('0x48')][_0x5cb1('0x3d')](_0x57868c)){var _0xb40816=_0x405b56[_0x5cb1('0x48')][_0x57868c];var _0x49553f={'id':_0xb40816['id'],'available':_0xb40816['available'],'loggedIn':_0xb40816[_0x5cb1('0x44')],'name':_0xb40816[_0x5cb1('0x45')],'paused':_0xb40816[_0x5cb1('0x49')],'waiting':_0xb40816[_0x5cb1('0x46')]};_0x4fd084['push'](_0x49553f);}}_0x159b87({'count':_0x4fd084[_0x5cb1('0x18')],'rows':_0x4fd084});});},'SmsQueues':function(_0x543618){return new Promise(function(_0x10280e,_0x37aa46){var _0x41ca18=[];for(var _0x430e3c in _0x405b56[_0x5cb1('0x4a')]){if(_0x405b56[_0x5cb1('0x4a')]['hasOwnProperty'](_0x430e3c)){var _0x4adae3=_0x405b56['smsQueues'][_0x430e3c];var _0x5f5338={'id':_0x4adae3['id'],'available':_0x4adae3['available'],'loggedIn':_0x4adae3[_0x5cb1('0x44')],'name':_0x4adae3[_0x5cb1('0x45')],'paused':_0x4adae3[_0x5cb1('0x49')],'waiting':_0x4adae3[_0x5cb1('0x46')]};_0x41ca18[_0x5cb1('0x21')](_0x5f5338);}}_0x10280e({'count':_0x41ca18[_0x5cb1('0x18')],'rows':_0x41ca18});});},'FaxQueues':function(_0x6a75d3){return new Promise(function(_0x3ba402,_0x116c72){var _0x1a02c2=[];for(var _0x34946c in _0x405b56['faxQueues']){if(_0x405b56['faxQueues']['hasOwnProperty'](_0x34946c)){var _0x60f7df=_0x405b56['faxQueues'][_0x34946c];var _0x5d6495={'id':_0x60f7df['id'],'available':_0x60f7df[_0x5cb1('0x43')],'loggedIn':_0x60f7df['loggedIn'],'name':_0x60f7df[_0x5cb1('0x45')],'paused':_0x60f7df[_0x5cb1('0x49')],'waiting':_0x60f7df[_0x5cb1('0x46')]};_0x1a02c2[_0x5cb1('0x21')](_0x5d6495);}}_0x3ba402({'count':_0x1a02c2[_0x5cb1('0x18')],'rows':_0x1a02c2});});},'ChatQueuesWaitingInteractions':function(_0x3548fa){return new Promise(function(_0x50fd95,_0x17e509){var _0xeb1948=_['values'](_0x405b56[_0x5cb1('0x4b')]);_0x50fd95({'count':_0xeb1948[_0x5cb1('0x18')],'rows':_0xeb1948});});},'MailQueuesWaitingInteractions':function(_0x4d58a4){return new Promise(function(_0x4dabff,_0x291f62){var _0x325353=_[_0x5cb1('0x41')](_0x405b56[_0x5cb1('0x4c')]);_0x4dabff({'count':_0x325353[_0x5cb1('0x18')],'rows':_0x325353});});},'OpenchannelQueuesWaitingInteractions':function(_0x73dbbe){return new Promise(function(_0x81401b,_0x56f3df){var _0x57fa4e=_[_0x5cb1('0x41')](_0x405b56['openchannelQueuesWaitingInteractions']);_0x81401b({'count':_0x57fa4e['length'],'rows':_0x57fa4e});});},'SmsQueuesWaitingInteractions':function(_0x4b1bdd){return new Promise(function(_0x258107,_0x2fdb67){var _0x54576f=_['values'](_0x405b56[_0x5cb1('0x4d')]);_0x258107({'count':_0x54576f[_0x5cb1('0x18')],'rows':_0x54576f});});},'FaxQueuesWaitingInteractions':function(_0x2cb2f4){return new Promise(function(_0x5c68d1,_0x3bbb19){var _0x2804e0=_[_0x5cb1('0x41')](_0x405b56[_0x5cb1('0x4e')]);_0x5c68d1({'count':_0x2804e0[_0x5cb1('0x18')],'rows':_0x2804e0});});}};var _0x11c3d7=jayson[_0x5cb1('0x4f')](_0x4e8d9f)[_0x5cb1('0x50')]();_0x11c3d7['on'](_0x5cb1('0x2d'),function(_0x263350){logger[_0x5cb1('0x2d')](JSON['stringify'](_0x263350));return _0x4f64e9(_0x263350);});_0x11c3d7['listen'](0x232c,'127.0.0.1',function(){console[_0x5cb1('0x51')](_0x5cb1('0x52'),0x232c);return _0x27367d(_0x5cb1('0x53')+0x232c);});});}; \ No newline at end of file +var _0xc64a=['./applications/','consequence','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','matchPath','complete','routing\x20is\x20empty','emit','end','QueueReport','update','catch','error\x20update\x20queue\x20report','agent','agents','busy','stack','message\x20is\x20empty','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','values','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','listen','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','isArray','applications','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','tag','TagId','%s:%s:%s','intervals'];(function(_0x1f6d9f,_0x3b55b1){var _0x4f7356=function(_0x210ab6){while(--_0x210ab6){_0x1f6d9f['push'](_0x1f6d9f['shift']());}};_0x4f7356(++_0x3b55b1);}(_0xc64a,0xd3));var _0xac64=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc64a[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xac64('0x0'));var util=require(_0xac64('0x1'));var path=require(_0xac64('0x2'));var fs=require('fs');var jayson=require(_0xac64('0x3'));var BPromise=require('bluebird');var uuid=require(_0xac64('0x4'));var config=require(_0xac64('0x5'));var logger=require(_0xac64('0x6'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport')};var rpc={'openchannelQueueReport':require(_0xac64('0x7')),'mailQueueReport':require(_0xac64('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x3e0d47,_0x293be5,_0x24dbbe){return util[_0xac64('0x9')](_0xac64('0xa'),_0x3e0d47,_0x293be5||0x0,_0x24dbbe||0x0);}function getIntervals(_0xd014e7,_0x917edc){var _0x6d8daa=[];if(!_[_0xac64('0xb')](_0x917edc[_0xac64('0xc')])&&!_[_0xac64('0xb')](_0xd014e7[_0x917edc[_0xac64('0xc')]])&&!_[_0xac64('0xb')](_0xd014e7[_0x917edc[_0xac64('0xc')]][_0xac64('0xd')])){_0x6d8daa=_[_0xac64('0xe')](_0xd014e7[_0x917edc[_0xac64('0xc')]][_0xac64('0xd')],_0xac64('0xf'));}else if(!_[_0xac64('0xb')](_0x917edc[_0xac64('0xf')])){_0x6d8daa=[_0x917edc[_0xac64('0xf')]];}return _0x6d8daa;}exports['listen']=function(_0x2ecd69){_0x2ecd69[_0xac64('0x10')]={};return new BPromise(function(_0x482bcd,_0x164fac){var _0x1868f8={'Start':function(_0x576d97){var _0xcacb12=this;return new Promise(function(_0x3d1141,_0x3bb2c1){if(_0x576d97){try{var _0x567f93=[];var _0xf2cdd8=getId(_0x576d97[_0xac64('0x11')],_0x576d97[_0xac64('0x12')]?_0x576d97['message']['id']:0x0,_0x576d97[_0xac64('0x13')]?_0x576d97[_0xac64('0x13')]['id']:0x0);if(_0x576d97['applications']&&_[_0xac64('0x14')](_0x576d97[_0xac64('0x15')])&&_0x576d97['applications'][_0xac64('0x16')]){for(var _0x3a1ff3=0x0;_0x3a1ff3<_0x576d97[_0xac64('0x15')][_0xac64('0x16')];_0x3a1ff3+=0x1){var _0x5bd705=_0x576d97[_0xac64('0x15')][_0x3a1ff3];if(fs[_0xac64('0x17')](path[_0xac64('0x18')](__dirname,'applications',_0x5bd705[_0xac64('0x19')]+'.js'))){var _0xa20426=[];switch(_0x5bd705['app'][_0xac64('0x1a')]()){case _0xac64('0x1b'):var _0x362013=_0x5bd705[_0xac64('0x1c')][_0xac64('0x1d')](',');_0xa20426[_0xac64('0x1e')](_0x362013[0x0]);_0xa20426[_0xac64('0x1e')](_0x362013[_0xac64('0x1f')](0x1,_0x362013[_0xac64('0x16')])['join'](','));break;case _0xac64('0x20'):var _0x370da5=_0x5bd705[_0xac64('0x1c')]['split'](',');_0xa20426[_0xac64('0x1e')](_0x370da5[0x0]);_0xa20426['push'](_0x370da5[0x1]);_0xa20426[_0xac64('0x1e')](_0x370da5[_0xac64('0x1f')](0x2,_0x370da5['length'])[_0xac64('0x18')](','));break;case _0xac64('0x21'):var _0xfec6=_0x5bd705[_0xac64('0x1c')]['split'](',');_0xa20426[_0xac64('0x1e')](_0xfec6[0x0]);_0xa20426[_0xac64('0x1e')](_0xfec6[0x1]);_0xa20426[_0xac64('0x1e')](_0xfec6[0x2]);_0xa20426[_0xac64('0x1e')](_0xfec6[0x3]);_0xa20426['push'](_0xfec6[_0xac64('0x1f')](0x4,_0xfec6['length'])[_0xac64('0x18')](','));break;case'message':_0xa20426[_0xac64('0x1e')](_0x5bd705[_0xac64('0x1c')]);break;case _0xac64('0x22'):_0xa20426['push'](_0x5bd705[_0xac64('0x23')]);_0xa20426[_0xac64('0x1e')](_0x5bd705[_0xac64('0x1c')]);break;default:_0xa20426=_[_0xac64('0xb')](_0x5bd705['appdata'])?[]:_0x5bd705[_0xac64('0x1c')][_0xac64('0x1d')](',');}var _0x514028={'id':util[_0xac64('0x9')](_0xac64('0x24'),_0xf2cdd8,_0x5bd705['id'],_0x5bd705[_0xac64('0x19')]),'condition':require('./interval')['condition'](_0xf2cdd8,getIntervals(_0x2ecd69[_0xac64('0x25')],_0x5bd705),_0x2ecd69),'consequence':require(_0xac64('0x26')+_0x5bd705[_0xac64('0x19')])[_0xac64('0x27')](_0xf2cdd8,_0xa20426,_0x2ecd69,_0x576d97),'p':_0x5bd705['priority']||0x0};logger[_0xac64('0x28')]('Push\x20new\x20rule',_0x514028['id'],_0xac64('0x29'),getIntervals(_0x2ecd69[_0xac64('0x25')],_0x5bd705)[_0xac64('0x18')](_0xac64('0x2a')));_0x567f93[_0xac64('0x1e')](_0x514028);}else{logger[_0xac64('0x2b')](_0xac64('0x2c'),path[_0xac64('0x18')](__dirname,'applications',_0x5bd705['app']+'.js'));}}_0x2ecd69['rules'][_0xf2cdd8]=new RuleEngine(_0x567f93);_0x2ecd69[_0xac64('0x10')][_0xf2cdd8][_0xac64('0x2d')](_0x576d97,function(_0x4712a){logger[_0xac64('0x28')]('Applications\x20executed',JSON['stringify'](_0x4712a[_0xac64('0x2e')]));if(_0x2ecd69['rules'][_0xf2cdd8]){_0x2ecd69[_0xac64('0x10')][_0xf2cdd8]['emit'](_0xac64('0x2f'));}});return _0x3d1141({'code':0xc8,'message':_0x576d97});}else{logger[_0xac64('0x28')]('No\x20applications\x20to\x20execute');return _0x3d1141({'code':0xc8,'message':_0x576d97});}}catch(_0x47bfdb){logger[_0xac64('0x2b')](_0x47bfdb['stack']);return _0x3bb2c1(_0xcacb12[_0xac64('0x2b')](0x1f4,_0x47bfdb));}}return _0x3bb2c1(_0xac64('0x30'));});},'AcceptMessage':function(_0x26b335){var _0x428b5b=this;return new Promise(function(_0x1db42f,_0xa200db){if(_0x26b335[_0xac64('0x12')]&&_0x26b335[_0xac64('0x12')]['id']){try{var _0x3febe3=getId(_0x26b335[_0xac64('0x11')],_0x26b335[_0xac64('0x12')]?_0x26b335[_0xac64('0x12')]['id']:0x0,_0x26b335[_0xac64('0x13')]?_0x26b335['interaction']['id']:0x0);if(_0x2ecd69[_0xac64('0x10')][_0x3febe3]){_0x2ecd69[_0xac64('0x10')][_0x3febe3][_0xac64('0x31')](_0xac64('0x32'));if(rpc[_0x26b335['channel']+_0xac64('0x33')]){rpc[_0x26b335[_0xac64('0x11')]+_0xac64('0x33')][_0xac64('0x34')](_0x3febe3,{'UserId':_0x26b335[_0xac64('0x12')]['UserId']})[_0xac64('0x35')](function(_0x1ddff2){logger['error'](_0xac64('0x36'));});}}return _0x1db42f({'code':0xc8,'message':_0x26b335});}catch(_0x5e79ff){logger[_0xac64('0x2b')](_0x5e79ff['stack']);return _0xa200db(_0x428b5b[_0xac64('0x2b')](0x1f4,_0x5e79ff));}}logger[_0xac64('0x2b')]('message\x20is\x20empty');return _0xa200db(_0x428b5b[_0xac64('0x2b')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0xd964ee){var _0x21f53c=this;return new Promise(function(_0x667f00,_0x28fc0b){if(_0xd964ee['agent']&&_0xd964ee[_0xac64('0x37')]['id']){try{if(_0x2ecd69[_0xac64('0x38')][_0xd964ee[_0xac64('0x37')]['id']]){_0x2ecd69['agents'][_0xd964ee[_0xac64('0x37')]['id']][_0xac64('0x39')]=![];_0x2ecd69[_0xac64('0x38')][_0xd964ee[_0xac64('0x37')]['id']]['busyQueue']=undefined;}return _0x667f00({'code':0xc8,'message':_0xd964ee});}catch(_0x15a7b4){logger[_0xac64('0x2b')](_0x15a7b4[_0xac64('0x3a')]);return _0x28fc0b(_0x21f53c[_0xac64('0x2b')](0x1f4,_0x15a7b4));}}logger['error'](_0xac64('0x3b'));return _0x28fc0b(_0x21f53c[_0xac64('0x2b')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x151a63){var _0xf9d0d4=this;return new Promise(function(_0x5750fa,_0x2fb190){if(_0x151a63['channel']&&_0x151a63[_0xac64('0x13')]&&_0x151a63[_0xac64('0x13')]['id']){try{var _0x531965=getId(_0x151a63['channel'],_0x151a63[_0xac64('0x12')]?_0x151a63[_0xac64('0x12')]['id']:0x0,_0x151a63['interaction']?_0x151a63[_0xac64('0x13')]['id']:0x0);if(_0x2ecd69['rules'][_0x531965]){_0x2ecd69[_0xac64('0x10')][_0x531965]['emit'](_0xac64('0x32'));}return _0x5750fa({'code':0xc8,'message':_0x151a63});}catch(_0x25f005){logger[_0xac64('0x2b')](_0x25f005[_0xac64('0x3a')]);return _0x2fb190(_0xf9d0d4[_0xac64('0x2b')](0x1f4,_0x25f005));}}logger['error'](_0xac64('0x3b'));return _0x2fb190(_0xf9d0d4[_0xac64('0x2b')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x250b08){var _0x519aa3=this;return new Promise(function(_0x2407db,_0x1f786b){if(_0x2ecd69['agents']['hasOwnProperty'](_0x250b08['id'])){for(var _0x268b97 in _0x250b08['capacity']){if(_0x250b08['capacity'][_0xac64('0x3c')](_0x268b97)){if(_0x2ecd69[_0xac64('0x38')][_0x250b08['id']][_0xac64('0x3c')](_0x268b97+_0xac64('0x3d'))){_0x2ecd69['agents'][_0x250b08['id']][_0x268b97+'CurrentCapacity']=parseInt(_0x250b08[_0xac64('0x3e')][_0x268b97],0xa);}}}_0x2ecd69['agents'][_0x250b08['id']][_0xac64('0x3f')]();return _0x2407db({'code':0xc8,'message':_0x2ecd69[_0xac64('0x38')][_0x250b08['id']]});}else{return _0x1f786b(_0x519aa3[_0xac64('0x2b')](0x1f4,_0xac64('0x40')));}});},'Agents':function(_0x27c7d2){return new Promise(function(_0x5d680d,_0x5732cd){var _0x337fb6=_['values'](_0x2ecd69['agents']);_0x5d680d({'count':_0x337fb6[_0xac64('0x16')],'rows':_0x337fb6});});},'ChatQueues':function(_0x71eff0){return new Promise(function(_0xc8f459,_0x463555){var _0x4a1acf=[];for(var _0x2af243 in _0x2ecd69['chatQueues']){if(_0x2ecd69[_0xac64('0x41')][_0xac64('0x3c')](_0x2af243)){var _0xd997d7=_0x2ecd69[_0xac64('0x41')][_0x2af243];var _0x5ccbbe={'id':_0xd997d7['id'],'available':_0xd997d7[_0xac64('0x42')],'loggedIn':_0xd997d7[_0xac64('0x43')],'name':_0xd997d7[_0xac64('0x44')],'paused':_0xd997d7['paused'],'waiting':_0xd997d7[_0xac64('0x45')]};_0x4a1acf[_0xac64('0x1e')](_0x5ccbbe);}}_0xc8f459({'count':_0x4a1acf['length'],'rows':_0x4a1acf});});},'MailQueues':function(_0x558c0e){return new Promise(function(_0x35b49e,_0x23e0f8){var _0x11f305=[];for(var _0x184bf3 in _0x2ecd69[_0xac64('0x46')]){if(_0x2ecd69['mailQueues'][_0xac64('0x3c')](_0x184bf3)){var _0x59fab8=_0x2ecd69[_0xac64('0x46')][_0x184bf3];var _0x36e6a1={'id':_0x59fab8['id'],'available':_0x59fab8[_0xac64('0x42')],'loggedIn':_0x59fab8['loggedIn'],'name':_0x59fab8[_0xac64('0x44')],'paused':_0x59fab8[_0xac64('0x47')],'waiting':_0x59fab8['waiting']};_0x11f305[_0xac64('0x1e')](_0x36e6a1);}}_0x35b49e({'count':_0x11f305[_0xac64('0x16')],'rows':_0x11f305});});},'OpenchannelQueues':function(_0x2f7fa2){return new Promise(function(_0x1b88fc,_0x8162a9){var _0x83690c=[];for(var _0x2a1cb4 in _0x2ecd69[_0xac64('0x48')]){if(_0x2ecd69['openchannelQueues'][_0xac64('0x3c')](_0x2a1cb4)){var _0x4172cb=_0x2ecd69['openchannelQueues'][_0x2a1cb4];var _0x199be3={'id':_0x4172cb['id'],'available':_0x4172cb['available'],'loggedIn':_0x4172cb[_0xac64('0x43')],'name':_0x4172cb['name'],'paused':_0x4172cb[_0xac64('0x47')],'waiting':_0x4172cb[_0xac64('0x45')]};_0x83690c[_0xac64('0x1e')](_0x199be3);}}_0x1b88fc({'count':_0x83690c['length'],'rows':_0x83690c});});},'SmsQueues':function(_0x15c6c3){return new Promise(function(_0xeb097f,_0xe31e2d){var _0x57f45c=[];for(var _0x485cd6 in _0x2ecd69[_0xac64('0x49')]){if(_0x2ecd69['smsQueues'][_0xac64('0x3c')](_0x485cd6)){var _0xc108ff=_0x2ecd69[_0xac64('0x49')][_0x485cd6];var _0x530b13={'id':_0xc108ff['id'],'available':_0xc108ff[_0xac64('0x42')],'loggedIn':_0xc108ff[_0xac64('0x43')],'name':_0xc108ff[_0xac64('0x44')],'paused':_0xc108ff[_0xac64('0x47')],'waiting':_0xc108ff[_0xac64('0x45')]};_0x57f45c[_0xac64('0x1e')](_0x530b13);}}_0xeb097f({'count':_0x57f45c[_0xac64('0x16')],'rows':_0x57f45c});});},'FaxQueues':function(_0x4171dd){return new Promise(function(_0x333b43,_0x5e0a49){var _0x59a907=[];for(var _0x327c33 in _0x2ecd69['faxQueues']){if(_0x2ecd69[_0xac64('0x4a')][_0xac64('0x3c')](_0x327c33)){var _0x4f8991=_0x2ecd69[_0xac64('0x4a')][_0x327c33];var _0x270ee2={'id':_0x4f8991['id'],'available':_0x4f8991[_0xac64('0x42')],'loggedIn':_0x4f8991[_0xac64('0x43')],'name':_0x4f8991[_0xac64('0x44')],'paused':_0x4f8991[_0xac64('0x47')],'waiting':_0x4f8991['waiting']};_0x59a907[_0xac64('0x1e')](_0x270ee2);}}_0x333b43({'count':_0x59a907[_0xac64('0x16')],'rows':_0x59a907});});},'ChatQueuesWaitingInteractions':function(_0xc532b2){return new Promise(function(_0x317b61,_0x45a81c){var _0x5e9bb6=_['values'](_0x2ecd69['chatQueuesWaitingInteractions']);_0x317b61({'count':_0x5e9bb6['length'],'rows':_0x5e9bb6});});},'MailQueuesWaitingInteractions':function(_0x4e6d52){return new Promise(function(_0x5ae86e,_0x8a581a){var _0x1f682c=_[_0xac64('0x4b')](_0x2ecd69['mailQueuesWaitingInteractions']);_0x5ae86e({'count':_0x1f682c['length'],'rows':_0x1f682c});});},'OpenchannelQueuesWaitingInteractions':function(_0x2b5758){return new Promise(function(_0x255366,_0x6b59db){var _0x3215ab=_[_0xac64('0x4b')](_0x2ecd69['openchannelQueuesWaitingInteractions']);_0x255366({'count':_0x3215ab['length'],'rows':_0x3215ab});});},'SmsQueuesWaitingInteractions':function(_0x7c8f93){return new Promise(function(_0x20cc50,_0x433409){var _0x1d449c=_['values'](_0x2ecd69[_0xac64('0x4c')]);_0x20cc50({'count':_0x1d449c['length'],'rows':_0x1d449c});});},'FaxQueuesWaitingInteractions':function(_0x29013f){return new Promise(function(_0x5d42ee,_0x3e6d09){var _0x7c2ac1=_[_0xac64('0x4b')](_0x2ecd69[_0xac64('0x4d')]);_0x5d42ee({'count':_0x7c2ac1[_0xac64('0x16')],'rows':_0x7c2ac1});});}};var _0x19358d=jayson[_0xac64('0x4e')](_0x1868f8)[_0xac64('0x4f')]();_0x19358d['on']('error',function(_0x1ab812){logger['error'](JSON['stringify'](_0x1ab812));return _0x164fac(_0x1ab812);});_0x19358d[_0xac64('0x50')](0x232c,'127.0.0.1',function(){console[_0xac64('0x51')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x482bcd(_0xac64('0x52')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index e2d1a0e..212a877 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 _0x7a8e=['stack','util','jayson/promise','lodash','../../../config/logger','client','http','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','message','indexOf','true','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log'];(function(_0x4cb776,_0x203c56){var _0x3085ab=function(_0x57110e){while(--_0x57110e){_0x4cb776['push'](_0x4cb776['shift']());}};_0x3085ab(++_0x203c56);}(_0x7a8e,0x79));var _0xe7a8=function(_0x2b737c,_0x274adf){_0x2b737c=_0x2b737c-0x0;var _0x466ed5=_0x7a8e[_0x2b737c];return _0x466ed5;};'use strict';var util=require(_0xe7a8('0x0'));var BPromise=require('bluebird');var jayson=require(_0xe7a8('0x1'));var _=require(_0xe7a8('0x2'));var logger=require(_0xe7a8('0x3'))('routing');var client=jayson[_0xe7a8('0x4')][_0xe7a8('0x5')]({'port':0x232a});function request(_0x427b57,_0x6bda4){return new BPromise(function(_0x2db336,_0xff4170){return client['request'](_0x427b57,_0x6bda4)[_0xe7a8('0x6')](function(_0x39ec41){if(_0x39ec41['error']){return _0xff4170(_0x39ec41[_0xe7a8('0x7')]['message']);}else{return _0x2db336(_0x39ec41[_0xe7a8('0x8')]);}})[_0xe7a8('0x9')](function(_0x3c8341){return _0xff4170(_0x3c8341);});});}exports[_0xe7a8('0xa')]=function(_0x421a83,_0x1ec6c2,_0x207bbe){return function(_0x48873a){if(_0x207bbe[_0xe7a8('0xb')]&&!_0x207bbe[_0xe7a8('0xb')][_0x421a83]){logger[_0xe7a8('0xc')](_0xe7a8('0xd'),_0x421a83);return _0x48873a[_0xe7a8('0xe')]();}var _0x3e8a33=[];for(var _0xe2348=0x0;_0xe2348<_0x1ec6c2['length'];_0xe2348+=0x1){_0x3e8a33[_0xe7a8('0xf')](request(_0xe7a8('0x10'),{'command':util[_0xe7a8('0x11')](_0xe7a8('0x12'),_0x1ec6c2[_0xe2348])})[_0xe7a8('0x6')](function(_0x12ab6d){return _0x12ab6d&&_0x12ab6d[_0xe7a8('0x13')]&&_0x12ab6d[_0xe7a8('0x13')][_0xe7a8('0x14')](_0xe7a8('0x15'))>=0x0?!![]:![];})[_0xe7a8('0x9')](function(_0x1051ac){logger[_0xe7a8('0x7')]('[%s][INTERVAL]\x20%s',_0x421a83,_0x1ec6c2[_0xe2348]);}));}BPromise[_0xe7a8('0x16')](_0x3e8a33)[_0xe7a8('0x6')](function(_0x12a2c2){var _0x58c345=_[_0xe7a8('0x17')](_0x12a2c2);logger[_0xe7a8('0xc')](_0xe7a8('0x18'),_0x421a83,_0x1ec6c2[_0xe7a8('0x19')](_0xe7a8('0x1a')),_0x58c345);_0x48873a[_0xe7a8('0x1b')](_0x58c345);})[_0xe7a8('0x9')](function(_0x15024b){console[_0xe7a8('0x1c')](_0x15024b);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x421a83,_0x1ec6c2[_0xe7a8('0x19')](_0xe7a8('0x1a')),_0x15024b[_0xe7a8('0x1d')]);_0x48873a[_0xe7a8('0xe')]();});};}; \ No newline at end of file +var _0xa729=['condition','rules','info','stop','length','push','iftime\x20%s','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','join','stack','util','lodash','../../../config/logger','routing','http','then','error','message'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa729,0x198));var _0x9a72=function(_0x188edb,_0x19fed6){_0x188edb=_0x188edb-0x0;var _0x669a3d=_0xa729[_0x188edb];return _0x669a3d;};'use strict';var util=require(_0x9a72('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x9a72('0x1'));var logger=require(_0x9a72('0x2'))(_0x9a72('0x3'));var client=jayson['client'][_0x9a72('0x4')]({'port':0x232a});function request(_0x4951dd,_0x5a5b83){return new BPromise(function(_0x2cd19a,_0x1ada86){return client['request'](_0x4951dd,_0x5a5b83)[_0x9a72('0x5')](function(_0x21da8b){if(_0x21da8b['error']){return _0x1ada86(_0x21da8b[_0x9a72('0x6')][_0x9a72('0x7')]);}else{return _0x2cd19a(_0x21da8b['result']);}})['catch'](function(_0x44e10c){return _0x1ada86(_0x44e10c);});});}exports[_0x9a72('0x8')]=function(_0x3c531,_0x3c5521,_0x30af91){return function(_0x4005db){if(_0x30af91[_0x9a72('0x9')]&&!_0x30af91[_0x9a72('0x9')][_0x3c531]){logger[_0x9a72('0xa')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x3c531);return _0x4005db[_0x9a72('0xb')]();}var _0x35e82a=[];for(var _0x4a9599=0x0;_0x4a9599<_0x3c5521[_0x9a72('0xc')];_0x4a9599+=0x1){_0x35e82a[_0x9a72('0xd')](request('Command',{'command':util['format'](_0x9a72('0xe'),_0x3c5521[_0x4a9599])})[_0x9a72('0x5')](function(_0x552b6e){return _0x552b6e&&_0x552b6e[_0x9a72('0x7')]&&_0x552b6e[_0x9a72('0x7')][_0x9a72('0xf')](_0x9a72('0x10'))>=0x0?!![]:![];})[_0x9a72('0x11')](function(_0x16ab9e){logger[_0x9a72('0x6')](_0x9a72('0x12'),_0x3c531,_0x3c5521[_0x4a9599]);}));}BPromise[_0x9a72('0x13')](_0x35e82a)[_0x9a72('0x5')](function(_0x4a5628){var _0x1c7c47=_[_0x9a72('0x14')](_0x4a5628);logger[_0x9a72('0xa')](_0x9a72('0x15'),_0x3c531,_0x3c5521['join'](_0x9a72('0x16')),_0x1c7c47);_0x4005db[_0x9a72('0x17')](_0x1c7c47);})['catch'](function(_0x213bc7){console['log'](_0x213bc7);logger[_0x9a72('0x6')](_0x9a72('0x15'),_0x3c531,_0x3c5521[_0x9a72('0x18')]('\x20|\x20'),_0x213bc7[_0x9a72('0x19')]);_0x4005db[_0x9a72('0xb')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 3924911..eaf6bf3 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 _0x7732=['uniqueid','channel','queue','interface','calleridnum','lastevent','getVoiceQueueByName','then','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalledAt','now','called','connectedlinenum','connectedlinename','error','isNil','agentringnoanswer','agentringnoanswerAt','reason','timeout','holdtime','ringtime','talktime','stack','abandoned','agentconnect','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','membername','diffTime','agentcompleteAt','agentconnectAt','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','transfertargetuniqueid','complete','lodash','util','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7732,0x7d));var _0x2773=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x7732[_0x342700];return _0x53406f;};'use strict';var _=require(_0x2773('0x0'));var util=require(_0x2773('0x1'));var utils=require('./utils');var agents={};var transfers={};function writeDB(_0x863421,_0x221e75){utils[_0x2773('0x2')](util[_0x2773('0x3')](_0x2773('0x4'),_0x863421[_0x2773('0x5')],_0x863421[_0x2773('0x6')],_0x863421[_0x2773('0x7')],_0x863421['membername'],_0x863421[_0x2773('0x8')],_0x863421[_0x2773('0x9')],_0x863421['connectedlinenum'],_0x863421[_0x2773('0xa')]));if(_0x863421[_0x2773('0x7')]){utils[_0x2773('0xb')](_0x863421['queue'])[_0x2773('0xc')](function(_0x5c7f1d){if(_0x5c7f1d){_0x863421['type']=_0x5c7f1d['type'];_0x863421[_0x2773('0xd')]=_0x863421[_0x2773('0xe')]?_0x5c7f1d[_0x2773('0xf')]:![];_0x863421[_0x2773('0x10')]=_0x863421['agentacw']?_0x5c7f1d['acwTimeout']:0x0;}utils[_0x2773('0x11')](_0x2773('0x12'),_0x863421);});}else{utils[_0x2773('0x11')](_0x2773('0x12'),_0x863421);}if(_0x221e75){delete transfers[_0x863421['uniqueid']];}else{delete agents[_0x863421[_0x2773('0x13')]];}}exports['agentcalled']=function(_0x5df6af){try{agents[_0x5df6af[_0x2773('0x13')]]=_0x5df6af;agents[_0x5df6af[_0x2773('0x13')]][_0x2773('0x14')]=utils[_0x2773('0x15')]();agents[_0x5df6af[_0x2773('0x13')]][_0x2773('0xa')]=_0x2773('0x16');agents[_0x5df6af[_0x2773('0x13')]][_0x2773('0x17')]=null;agents[_0x5df6af[_0x2773('0x13')]][_0x2773('0x18')]=null;}catch(_0x25d884){utils[_0x2773('0x19')](_0x25d884['stack']);}};exports['agentringnoanswer']=function(_0xa44f8d){try{if(!_[_0x2773('0x1a')](agents[_0xa44f8d['destuniqueid']])){agents[_0xa44f8d[_0x2773('0x13')]][_0x2773('0x1b')]=!![];agents[_0xa44f8d[_0x2773('0x13')]][_0x2773('0x1c')]=utils[_0x2773('0x15')]();agents[_0xa44f8d[_0x2773('0x13')]][_0x2773('0xa')]='timeout';agents[_0xa44f8d[_0x2773('0x13')]][_0x2773('0x1d')]=_0x2773('0x1e');agents[_0xa44f8d[_0x2773('0x13')]][_0x2773('0x1f')]=_0xa44f8d['ringtime']?parseInt(_0xa44f8d[_0x2773('0x20')])/0x3e8:0x0;agents[_0xa44f8d[_0x2773('0x13')]][_0x2773('0x21')]=0x0;writeDB(agents[_0xa44f8d['destuniqueid']]);}}catch(_0xbf45a8){utils[_0x2773('0x19')](_0xbf45a8[_0x2773('0x22')]);}};exports['queuecallerabandon']=function(_0x1e3a80){try{_['forIn'](agents,function(_0xab42c2,_0xbae5a2){if(_0xab42c2[_0x2773('0x5')]==_0x1e3a80['uniqueid']){_0xab42c2[_0x2773('0x1b')]=!![];_0xab42c2['agentringnoanswerAt']=utils[_0x2773('0x15')]();_0xab42c2[_0x2773('0xa')]=_0x2773('0x23');_0xab42c2['reason']=_0x2773('0x23');_0xab42c2['holdtime']=_0x1e3a80[_0x2773('0x1f')];_0xab42c2['talktime']=0x0;writeDB(_0xab42c2);}});}catch(_0x3aa282){utils[_0x2773('0x19')](_0x3aa282[_0x2773('0x22')]);}};exports[_0x2773('0x24')]=function(_0x21ad6b){try{if(agents[_0x21ad6b[_0x2773('0x13')]]){agents[_0x21ad6b['destuniqueid']]['agentconnectAt']=utils['now']();agents[_0x21ad6b[_0x2773('0x13')]][_0x2773('0x17')]=_0x21ad6b[_0x2773('0x17')];agents[_0x21ad6b['destuniqueid']][_0x2773('0x18')]=_0x21ad6b[_0x2773('0x18')];agents[_0x21ad6b[_0x2773('0x13')]]['holdtime']=_0x21ad6b[_0x2773('0x20')];agents[_0x21ad6b['destuniqueid']][_0x2773('0xa')]=_0x2773('0x25');_['forIn'](agents,function(_0x21ea54,_0x27e36d){if(_0x21ea54[_0x2773('0x13')]!=_0x21ad6b[_0x2773('0x13')]&&_0x21ea54[_0x2773('0x5')]==_0x21ad6b[_0x2773('0x5')]){_0x21ea54[_0x2773('0x21')]=0x0;_0x21ea54['holdtime']=_0x21ad6b['ringtime'];_0x21ea54[_0x2773('0x1b')]=!![];_0x21ea54[_0x2773('0x1c')]=utils[_0x2773('0x15')]();_0x21ea54['lastevent']=_0x2773('0x26');_0x21ea54[_0x2773('0x1d')]=_0x2773('0x26');_0x21ea54[_0x2773('0x27')]=_0x21ad6b[_0x2773('0x13')];_0x21ea54[_0x2773('0x28')]=_0x21ad6b[_0x2773('0x29')];writeDB(_0x21ea54);}});}}catch(_0x5f0be4){utils[_0x2773('0x19')](_0x5f0be4[_0x2773('0x22')]);}};exports['agentcomplete']=function(_0x37e52d){try{if(!_['isNil'](agents[_0x37e52d[_0x2773('0x13')]])){agents[_0x37e52d[_0x2773('0x13')]][_0x2773('0xe')]=!![];agents[_0x37e52d[_0x2773('0x13')]]['agentcompleteAt']=utils[_0x2773('0x15')]();agents[_0x37e52d[_0x2773('0x13')]][_0x2773('0x21')]=utils[_0x2773('0x2a')](agents[_0x37e52d[_0x2773('0x13')]][_0x2773('0x2b')],agents[_0x37e52d[_0x2773('0x13')]][_0x2773('0x2c')]);agents[_0x37e52d[_0x2773('0x13')]][_0x2773('0x1d')]=_0x37e52d[_0x2773('0x1d')];agents[_0x37e52d['destuniqueid']]['lastevent']='complete';writeDB(agents[_0x37e52d[_0x2773('0x13')]]);}}catch(_0x2a00f6){utils[_0x2773('0x19')](_0x2a00f6['stack']);}};exports[_0x2773('0x2d')]=function(_0x2b79e4){try{if(!_[_0x2773('0x1a')](agents[_0x2b79e4[_0x2773('0x2e')]])){agents[_0x2b79e4[_0x2773('0x2e')]][_0x2773('0x2f')]=!![];agents[_0x2b79e4[_0x2773('0x2e')]][_0x2773('0x30')]=_0x2773('0x31');agents[_0x2b79e4[_0x2773('0x2e')]][_0x2773('0x32')]=_0x2b79e4['extension'];agents[_0x2b79e4[_0x2773('0x2e')]][_0x2773('0x33')]=agents[_0x2b79e4[_0x2773('0x2e')]]['uniqueid'];}}catch(_0x1bd090){utils['error'](_0x1bd090[_0x2773('0x22')]);}};exports[_0x2773('0x34')]=function(_0x2350ac){try{if(_0x2350ac[_0x2773('0x35')]==_0x2350ac[_0x2773('0x36')]){if(!_[_0x2773('0x1a')](agents[_0x2350ac[_0x2773('0x37')]])){agents[_0x2350ac[_0x2773('0x37')]][_0x2773('0x2f')]=!![];agents[_0x2350ac[_0x2773('0x37')]][_0x2773('0x30')]='ATTENDED';agents[_0x2350ac[_0x2773('0x37')]][_0x2773('0x32')]=_0x2350ac[_0x2773('0x38')];agents[_0x2350ac[_0x2773('0x37')]][_0x2773('0x33')]=_0x2350ac[_0x2773('0x35')];}if(_0x2350ac['transfereeuniqueid']&&agents[_0x2350ac[_0x2773('0x39')]]){agents[_0x2350ac[_0x2773('0x39')]][_0x2773('0x3a')]=0x1;transfers[_0x2350ac[_0x2773('0x39')]]=_[_0x2773('0x3b')](agents[_0x2350ac['transfereeuniqueid']]);transfers[_0x2350ac[_0x2773('0x39')]][_0x2773('0x9')]=agents[_0x2350ac[_0x2773('0x37')]][_0x2773('0x9')];transfers[_0x2350ac[_0x2773('0x39')]][_0x2773('0x3c')]=agents[_0x2350ac[_0x2773('0x37')]][_0x2773('0x3c')];transfers[_0x2350ac['transfereeuniqueid']][_0x2773('0x14')]=utils['now']();transfers[_0x2350ac[_0x2773('0x39')]][_0x2773('0x2c')]=utils[_0x2773('0x15')]();transfers[_0x2350ac[_0x2773('0x39')]]['holdtime']=0x0;transfers[_0x2350ac[_0x2773('0x39')]]['agententerreason']=0x2;}}else if(_0x2350ac[_0x2773('0x37')]==_0x2350ac[_0x2773('0x3d')]){if(!_['isNil'](agents[_0x2350ac[_0x2773('0x35')]])){agents[_0x2350ac[_0x2773('0x35')]]['transfer']=!![];agents[_0x2350ac[_0x2773('0x35')]][_0x2773('0x30')]=_0x2773('0x3e');agents[_0x2350ac[_0x2773('0x35')]][_0x2773('0x32')]=_0x2350ac['secondtransfererexten'];agents[_0x2350ac[_0x2773('0x35')]][_0x2773('0x33')]=_0x2350ac[_0x2773('0x37')];}if(_0x2350ac[_0x2773('0x3f')]&&agents[_0x2350ac[_0x2773('0x3f')]]){agents[_0x2350ac[_0x2773('0x3f')]][_0x2773('0x3a')]=0x1;transfers[_0x2350ac[_0x2773('0x3f')]]=_[_0x2773('0x3b')](agents[_0x2350ac[_0x2773('0x3f')]]);transfers[_0x2350ac[_0x2773('0x3f')]][_0x2773('0x9')]=agents[_0x2350ac['origtransfereruniqueid']][_0x2773('0x9')];transfers[_0x2350ac[_0x2773('0x3f')]][_0x2773('0x3c')]=agents[_0x2350ac[_0x2773('0x35')]][_0x2773('0x3c')];transfers[_0x2350ac[_0x2773('0x3f')]][_0x2773('0x14')]=utils[_0x2773('0x15')]();transfers[_0x2350ac[_0x2773('0x3f')]][_0x2773('0x2c')]=utils[_0x2773('0x15')]();transfers[_0x2350ac[_0x2773('0x3f')]][_0x2773('0x1f')]=0x0;transfers[_0x2350ac[_0x2773('0x3f')]]['agententerreason']=0x2;}}}catch(_0x2d1605){utils['error'](_0x2d1605[_0x2773('0x22')]);}};exports['hangup']=function(_0x1e1e59){try{if(transfers[_0x1e1e59['uniqueid']]){transfers[_0x1e1e59[_0x2773('0x5')]][_0x2773('0xe')]=!![];transfers[_0x1e1e59['uniqueid']][_0x2773('0x2b')]=utils[_0x2773('0x15')]();transfers[_0x1e1e59['uniqueid']][_0x2773('0x21')]=utils['diffTime'](transfers[_0x1e1e59[_0x2773('0x5')]]['agentcompleteAt'],transfers[_0x1e1e59[_0x2773('0x5')]][_0x2773('0x2c')]);transfers[_0x1e1e59[_0x2773('0x5')]][_0x2773('0x1d')]='agent';transfers[_0x1e1e59[_0x2773('0x5')]][_0x2773('0xa')]=_0x2773('0x40');writeDB(transfers[_0x1e1e59[_0x2773('0x5')]],!![]);}if(agents[_0x1e1e59[_0x2773('0x5')]]&&agents[_0x1e1e59[_0x2773('0x5')]]['agentconnectAt']){agents[_0x1e1e59[_0x2773('0x5')]][_0x2773('0xe')]=!![];agents[_0x1e1e59[_0x2773('0x5')]]['agentcompleteAt']=utils[_0x2773('0x15')]();agents[_0x1e1e59[_0x2773('0x5')]]['talktime']=utils[_0x2773('0x2a')](agents[_0x1e1e59['uniqueid']][_0x2773('0x2b')],agents[_0x1e1e59[_0x2773('0x5')]]['agentconnectAt']);agents[_0x1e1e59[_0x2773('0x5')]][_0x2773('0x1d')]=agents[_0x1e1e59[_0x2773('0x5')]][_0x2773('0x2f')]?_0x2773('0x2f'):'agent';agents[_0x1e1e59[_0x2773('0x5')]][_0x2773('0xa')]='complete';writeDB(agents[_0x1e1e59[_0x2773('0x5')]]);}}catch(_0xa2648c){utils[_0x2773('0x19')](_0xa2648c['stack']);}}; \ No newline at end of file +var _0xd1f8=['queue','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','CreateVoiceAgentReport','uniqueid','agentcalled','destuniqueid','agentcalledAt','now','called','connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','queuecallerabandon','forIn','abandoned','agentconnect','agentconnectAt','connect','answered_elsewhere','reason','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcompleteAt','complete','blindtransfer','transfereruniqueid','transfertype','blind','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','transfer','ATTENDED','secondtransfererexten','transfertargetuniqueid','diffTime','agent','lodash','util','./utils','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','channel','membername','interface','connectedlinenum','lastevent'];(function(_0x1b59a7,_0x236002){var _0x19df7d=function(_0xf1f48b){while(--_0xf1f48b){_0x1b59a7['push'](_0x1b59a7['shift']());}};_0x19df7d(++_0x236002);}(_0xd1f8,0x18e));var _0x8d1f=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xd1f8[_0x562f3b];return _0x1edd55;};'use strict';var _=require(_0x8d1f('0x0'));var util=require(_0x8d1f('0x1'));var utils=require(_0x8d1f('0x2'));var agents={};var transfers={};function writeDB(_0x1464bb,_0x5c3979){utils[_0x8d1f('0x3')](util['format'](_0x8d1f('0x4'),_0x1464bb['uniqueid'],_0x1464bb[_0x8d1f('0x5')],_0x1464bb['queue'],_0x1464bb[_0x8d1f('0x6')],_0x1464bb[_0x8d1f('0x7')],_0x1464bb['calleridnum'],_0x1464bb[_0x8d1f('0x8')],_0x1464bb[_0x8d1f('0x9')]));if(_0x1464bb[_0x8d1f('0xa')]){utils[_0x8d1f('0xb')](_0x1464bb[_0x8d1f('0xa')])['then'](function(_0x3c58c4){if(_0x3c58c4){_0x1464bb[_0x8d1f('0xc')]=_0x3c58c4['type'];_0x1464bb[_0x8d1f('0xd')]=_0x1464bb[_0x8d1f('0xe')]?_0x3c58c4[_0x8d1f('0xf')]:![];_0x1464bb[_0x8d1f('0x10')]=_0x1464bb[_0x8d1f('0xd')]?_0x3c58c4['acwTimeout']:0x0;}utils['request'](_0x8d1f('0x11'),_0x1464bb);});}else{utils['request'](_0x8d1f('0x11'),_0x1464bb);}if(_0x5c3979){delete transfers[_0x1464bb[_0x8d1f('0x12')]];}else{delete agents[_0x1464bb['destuniqueid']];}}exports[_0x8d1f('0x13')]=function(_0x2052f6){try{agents[_0x2052f6[_0x8d1f('0x14')]]=_0x2052f6;agents[_0x2052f6['destuniqueid']][_0x8d1f('0x15')]=utils[_0x8d1f('0x16')]();agents[_0x2052f6[_0x8d1f('0x14')]][_0x8d1f('0x9')]=_0x8d1f('0x17');agents[_0x2052f6[_0x8d1f('0x14')]][_0x8d1f('0x8')]=null;agents[_0x2052f6[_0x8d1f('0x14')]][_0x8d1f('0x18')]=null;}catch(_0x2422d0){utils[_0x8d1f('0x19')](_0x2422d0[_0x8d1f('0x1a')]);}};exports[_0x8d1f('0x1b')]=function(_0x2036ee){try{if(!_[_0x8d1f('0x1c')](agents[_0x2036ee[_0x8d1f('0x14')]])){agents[_0x2036ee[_0x8d1f('0x14')]]['agentringnoanswer']=!![];agents[_0x2036ee['destuniqueid']][_0x8d1f('0x1d')]=utils[_0x8d1f('0x16')]();agents[_0x2036ee[_0x8d1f('0x14')]][_0x8d1f('0x9')]=_0x8d1f('0x1e');agents[_0x2036ee[_0x8d1f('0x14')]]['reason']=_0x8d1f('0x1e');agents[_0x2036ee[_0x8d1f('0x14')]][_0x8d1f('0x1f')]=_0x2036ee[_0x8d1f('0x20')]?parseInt(_0x2036ee['ringtime'])/0x3e8:0x0;agents[_0x2036ee['destuniqueid']][_0x8d1f('0x21')]=0x0;writeDB(agents[_0x2036ee[_0x8d1f('0x14')]]);}}catch(_0x5175a5){utils[_0x8d1f('0x19')](_0x5175a5['stack']);}};exports[_0x8d1f('0x22')]=function(_0x3d2016){try{_[_0x8d1f('0x23')](agents,function(_0x2279b9,_0x396636){if(_0x2279b9[_0x8d1f('0x12')]==_0x3d2016[_0x8d1f('0x12')]){_0x2279b9[_0x8d1f('0x1b')]=!![];_0x2279b9[_0x8d1f('0x1d')]=utils['now']();_0x2279b9[_0x8d1f('0x9')]=_0x8d1f('0x24');_0x2279b9['reason']=_0x8d1f('0x24');_0x2279b9[_0x8d1f('0x1f')]=_0x3d2016['holdtime'];_0x2279b9[_0x8d1f('0x21')]=0x0;writeDB(_0x2279b9);}});}catch(_0x2dbc3d){utils[_0x8d1f('0x19')](_0x2dbc3d['stack']);}};exports[_0x8d1f('0x25')]=function(_0x225fd7){try{if(agents[_0x225fd7[_0x8d1f('0x14')]]){agents[_0x225fd7['destuniqueid']][_0x8d1f('0x26')]=utils['now']();agents[_0x225fd7['destuniqueid']][_0x8d1f('0x8')]=_0x225fd7[_0x8d1f('0x8')];agents[_0x225fd7[_0x8d1f('0x14')]][_0x8d1f('0x18')]=_0x225fd7[_0x8d1f('0x18')];agents[_0x225fd7[_0x8d1f('0x14')]][_0x8d1f('0x1f')]=_0x225fd7[_0x8d1f('0x20')];agents[_0x225fd7['destuniqueid']][_0x8d1f('0x9')]=_0x8d1f('0x27');_[_0x8d1f('0x23')](agents,function(_0x381547,_0x1b8af6){if(_0x381547[_0x8d1f('0x14')]!=_0x225fd7['destuniqueid']&&_0x381547[_0x8d1f('0x12')]==_0x225fd7[_0x8d1f('0x12')]){_0x381547['talktime']=0x0;_0x381547[_0x8d1f('0x1f')]=_0x225fd7[_0x8d1f('0x20')];_0x381547['agentringnoanswer']=!![];_0x381547['agentringnoanswerAt']=utils['now']();_0x381547[_0x8d1f('0x9')]=_0x8d1f('0x28');_0x381547[_0x8d1f('0x29')]=_0x8d1f('0x28');_0x381547[_0x8d1f('0x2a')]=_0x225fd7[_0x8d1f('0x14')];_0x381547[_0x8d1f('0x2b')]=_0x225fd7[_0x8d1f('0x6')];writeDB(_0x381547);}});}}catch(_0x560daf){utils['error'](_0x560daf['stack']);}};exports[_0x8d1f('0xe')]=function(_0xdbe040){try{if(!_[_0x8d1f('0x1c')](agents[_0xdbe040[_0x8d1f('0x14')]])){agents[_0xdbe040[_0x8d1f('0x14')]][_0x8d1f('0xe')]=!![];agents[_0xdbe040['destuniqueid']][_0x8d1f('0x2c')]=utils['now']();agents[_0xdbe040[_0x8d1f('0x14')]][_0x8d1f('0x21')]=utils['diffTime'](agents[_0xdbe040['destuniqueid']][_0x8d1f('0x2c')],agents[_0xdbe040[_0x8d1f('0x14')]][_0x8d1f('0x26')]);agents[_0xdbe040[_0x8d1f('0x14')]][_0x8d1f('0x29')]=_0xdbe040[_0x8d1f('0x29')];agents[_0xdbe040['destuniqueid']][_0x8d1f('0x9')]=_0x8d1f('0x2d');writeDB(agents[_0xdbe040[_0x8d1f('0x14')]]);}}catch(_0x19273f){utils[_0x8d1f('0x19')](_0x19273f[_0x8d1f('0x1a')]);}};exports[_0x8d1f('0x2e')]=function(_0xc7a88c){try{if(!_[_0x8d1f('0x1c')](agents[_0xc7a88c[_0x8d1f('0x2f')]])){agents[_0xc7a88c[_0x8d1f('0x2f')]]['transfer']=!![];agents[_0xc7a88c[_0x8d1f('0x2f')]][_0x8d1f('0x30')]=_0x8d1f('0x31');agents[_0xc7a88c['transfereruniqueid']]['transferexten']=_0xc7a88c['extension'];agents[_0xc7a88c[_0x8d1f('0x2f')]][_0x8d1f('0x32')]=agents[_0xc7a88c['transfereruniqueid']][_0x8d1f('0x12')];}}catch(_0x1dfd62){utils[_0x8d1f('0x19')](_0x1dfd62[_0x8d1f('0x1a')]);}};exports[_0x8d1f('0x33')]=function(_0x144bc7){try{if(_0x144bc7[_0x8d1f('0x34')]==_0x144bc7[_0x8d1f('0x35')]){if(!_[_0x8d1f('0x1c')](agents[_0x144bc7[_0x8d1f('0x36')]])){agents[_0x144bc7[_0x8d1f('0x36')]]['transfer']=!![];agents[_0x144bc7[_0x8d1f('0x36')]][_0x8d1f('0x30')]='ATTENDED';agents[_0x144bc7[_0x8d1f('0x36')]][_0x8d1f('0x37')]=_0x144bc7[_0x8d1f('0x38')];agents[_0x144bc7[_0x8d1f('0x36')]]['transferuniqueid']=_0x144bc7['origtransfereruniqueid'];}if(_0x144bc7['transfereeuniqueid']&&agents[_0x144bc7['transfereeuniqueid']]){agents[_0x144bc7[_0x8d1f('0x39')]][_0x8d1f('0x3a')]=0x1;transfers[_0x144bc7['transfereeuniqueid']]=_[_0x8d1f('0x3b')](agents[_0x144bc7['transfereeuniqueid']]);transfers[_0x144bc7['transfereeuniqueid']]['calleridnum']=agents[_0x144bc7[_0x8d1f('0x36')]][_0x8d1f('0x3c')];transfers[_0x144bc7[_0x8d1f('0x39')]][_0x8d1f('0x3d')]=agents[_0x144bc7['secondtransfereruniqueid']][_0x8d1f('0x3d')];transfers[_0x144bc7['transfereeuniqueid']]['agentcalledAt']=utils[_0x8d1f('0x16')]();transfers[_0x144bc7[_0x8d1f('0x39')]][_0x8d1f('0x26')]=utils[_0x8d1f('0x16')]();transfers[_0x144bc7[_0x8d1f('0x39')]][_0x8d1f('0x1f')]=0x0;transfers[_0x144bc7[_0x8d1f('0x39')]][_0x8d1f('0x3a')]=0x2;}}else if(_0x144bc7[_0x8d1f('0x36')]==_0x144bc7['secondtransfererlinkedid']){if(!_[_0x8d1f('0x1c')](agents[_0x144bc7[_0x8d1f('0x34')]])){agents[_0x144bc7[_0x8d1f('0x34')]][_0x8d1f('0x3e')]=!![];agents[_0x144bc7[_0x8d1f('0x34')]][_0x8d1f('0x30')]=_0x8d1f('0x3f');agents[_0x144bc7[_0x8d1f('0x34')]][_0x8d1f('0x37')]=_0x144bc7[_0x8d1f('0x40')];agents[_0x144bc7[_0x8d1f('0x34')]][_0x8d1f('0x32')]=_0x144bc7[_0x8d1f('0x36')];}if(_0x144bc7[_0x8d1f('0x41')]&&agents[_0x144bc7[_0x8d1f('0x41')]]){agents[_0x144bc7[_0x8d1f('0x41')]]['agententerreason']=0x1;transfers[_0x144bc7[_0x8d1f('0x41')]]=_[_0x8d1f('0x3b')](agents[_0x144bc7[_0x8d1f('0x41')]]);transfers[_0x144bc7[_0x8d1f('0x41')]][_0x8d1f('0x3c')]=agents[_0x144bc7[_0x8d1f('0x34')]][_0x8d1f('0x3c')];transfers[_0x144bc7[_0x8d1f('0x41')]][_0x8d1f('0x3d')]=agents[_0x144bc7[_0x8d1f('0x34')]][_0x8d1f('0x3d')];transfers[_0x144bc7[_0x8d1f('0x41')]][_0x8d1f('0x15')]=utils['now']();transfers[_0x144bc7[_0x8d1f('0x41')]][_0x8d1f('0x26')]=utils[_0x8d1f('0x16')]();transfers[_0x144bc7[_0x8d1f('0x41')]][_0x8d1f('0x1f')]=0x0;transfers[_0x144bc7['transfertargetuniqueid']][_0x8d1f('0x3a')]=0x2;}}}catch(_0x829952){utils[_0x8d1f('0x19')](_0x829952[_0x8d1f('0x1a')]);}};exports['hangup']=function(_0x98ecac){try{if(transfers[_0x98ecac[_0x8d1f('0x12')]]){transfers[_0x98ecac[_0x8d1f('0x12')]]['agentcomplete']=!![];transfers[_0x98ecac['uniqueid']][_0x8d1f('0x2c')]=utils[_0x8d1f('0x16')]();transfers[_0x98ecac[_0x8d1f('0x12')]][_0x8d1f('0x21')]=utils[_0x8d1f('0x42')](transfers[_0x98ecac['uniqueid']][_0x8d1f('0x2c')],transfers[_0x98ecac[_0x8d1f('0x12')]]['agentconnectAt']);transfers[_0x98ecac[_0x8d1f('0x12')]][_0x8d1f('0x29')]=_0x8d1f('0x43');transfers[_0x98ecac[_0x8d1f('0x12')]][_0x8d1f('0x9')]='complete';writeDB(transfers[_0x98ecac[_0x8d1f('0x12')]],!![]);}if(agents[_0x98ecac[_0x8d1f('0x12')]]&&agents[_0x98ecac[_0x8d1f('0x12')]][_0x8d1f('0x26')]){agents[_0x98ecac[_0x8d1f('0x12')]][_0x8d1f('0xe')]=!![];agents[_0x98ecac[_0x8d1f('0x12')]][_0x8d1f('0x2c')]=utils['now']();agents[_0x98ecac[_0x8d1f('0x12')]][_0x8d1f('0x21')]=utils[_0x8d1f('0x42')](agents[_0x98ecac[_0x8d1f('0x12')]][_0x8d1f('0x2c')],agents[_0x98ecac[_0x8d1f('0x12')]]['agentconnectAt']);agents[_0x98ecac['uniqueid']][_0x8d1f('0x29')]=agents[_0x98ecac[_0x8d1f('0x12')]][_0x8d1f('0x3e')]?_0x8d1f('0x3e'):_0x8d1f('0x43');agents[_0x98ecac[_0x8d1f('0x12')]][_0x8d1f('0x9')]=_0x8d1f('0x2d');writeDB(agents[_0x98ecac[_0x8d1f('0x12')]]);}}catch(_0x22d254){utils['error'](_0x22d254[_0x8d1f('0x1a')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 22e3fe1..c67a4b2 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 _0x5bdd=['isNil','channelstate','systemanswertime','transfer','destinationchannel','toNumber','hangup','callerid','diffTime','endtime','starttime','billableseconds','answertime','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstop','musiconholdstartAt','mohtime','varset','xmd-originatecalleridnum','source','value','xmd-phone','\x22\x20<','variable','xmd-callerid-preview','xmd-callerid','xmd-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','routeid','sipcallid','application','toLowerCase','startsWith','appdata','cdr','substring','lastIndexOf','includes','noop','execif','set','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','accountcode','destination','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','linkedid','OutgoingSpoolFailed','exten','context','now','DOCUMENTATION','error','stack','newstate'];(function(_0x4471ff,_0x4bb7de){var _0xe723ca=function(_0xf3cc76){while(--_0xf3cc76){_0x4471ff['push'](_0x4471ff['shift']());}};_0xe723ca(++_0x4bb7de);}(_0x5bdd,0xdf));var _0xd5bd=function(_0x5844aa,_0x5e2935){_0x5844aa=_0x5844aa-0x0;var _0x128c3b=_0x5bdd[_0x5844aa];return _0x128c3b;};'use strict';var _=require(_0xd5bd('0x0'));var util=require(_0xd5bd('0x1'));var utils=require(_0xd5bd('0x2'));var dispositions=[_0xd5bd('0x3'),_0xd5bd('0x4'),_0xd5bd('0x4'),'NO\x20ANSWER',_0xd5bd('0x3'),_0xd5bd('0x3'),_0xd5bd('0x5'),_0xd5bd('0x6'),_0xd5bd('0x4'),_0xd5bd('0x4'),'FAILED'];var channels={};function writeDB(_0x3f8a49){utils[_0xd5bd('0x7')](util[_0xd5bd('0x8')](_0xd5bd('0x9'),_0x3f8a49[_0xd5bd('0xa')],_0x3f8a49[_0xd5bd('0xb')],_0x3f8a49['type'],_0x3f8a49[_0xd5bd('0xc')],_0x3f8a49['source'],_0x3f8a49[_0xd5bd('0xd')],_0x3f8a49['callerid'],_0x3f8a49[_0xd5bd('0xe')]));if(_0x3f8a49[_0xd5bd('0xc')]){utils[_0xd5bd('0xf')](_0x3f8a49[_0xd5bd('0xc')])[_0xd5bd('0x10')](function(_0x17bc88){if(_0x17bc88){_0x3f8a49[_0xd5bd('0x11')]=_0x17bc88['id'];}utils[_0xd5bd('0x12')](_0xd5bd('0x13'),_0x3f8a49);});}else{utils['request']('CreateVoiceCallReport',_0x3f8a49);}if(channels[_0x3f8a49[_0xd5bd('0xa')]]){delete channels[_0x3f8a49['uniqueid']];}}exports['newchannel']=function(_0x2bde7b){try{if(_0x2bde7b['uniqueid']==_0x2bde7b[_0xd5bd('0x14')]&&_0x2bde7b[_0xd5bd('0xb')]!=_0xd5bd('0x15')){channels[_0x2bde7b[_0xd5bd('0xa')]]={'uniqueid':_0x2bde7b[_0xd5bd('0xa')],'accountcode':_0x2bde7b[_0xd5bd('0xc')],'source':_0x2bde7b['calleridnum'],'destination':_0x2bde7b[_0xd5bd('0x16')],'destinationcontext':_0x2bde7b[_0xd5bd('0x17')],'channel':_0x2bde7b[_0xd5bd('0xb')],'starttime':utils[_0xd5bd('0x18')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xd5bd('0x19')};}}catch(_0x170314){utils[_0xd5bd('0x1a')](_0x170314[_0xd5bd('0x1b')]);}};exports[_0xd5bd('0x1c')]=function(_0x14dcbf){try{if(!_[_0xd5bd('0x1d')](channels[_0x14dcbf[_0xd5bd('0xa')]])&&_0x14dcbf[_0xd5bd('0x1e')]==0x6){if(_[_0xd5bd('0x1d')](channels[_0x14dcbf[_0xd5bd('0xa')]]['systemanswertime'])){channels[_0x14dcbf['uniqueid']][_0xd5bd('0x1f')]=utils['now']();}}else if(!_['isNil'](channels[_0x14dcbf[_0xd5bd('0x14')]])&&_0x14dcbf[_0xd5bd('0x1e')]==0x6&&_0x14dcbf[_0xd5bd('0x17')]!=_0xd5bd('0x20')){channels[_0x14dcbf[_0xd5bd('0x14')]][_0xd5bd('0xc')]=_0x14dcbf[_0xd5bd('0xc')];channels[_0x14dcbf[_0xd5bd('0x14')]][_0xd5bd('0x21')]=_0x14dcbf[_0xd5bd('0xb')];if(_[_0xd5bd('0x1d')](channels[_0x14dcbf[_0xd5bd('0x14')]]['answertime'])){channels[_0x14dcbf[_0xd5bd('0x14')]]['answertime']=utils[_0xd5bd('0x18')]();}channels[_0x14dcbf[_0xd5bd('0x14')]][_0xd5bd('0xe')]=dispositions[_[_0xd5bd('0x22')](_0x14dcbf[_0xd5bd('0x1e')])]||_0xd5bd('0x5');}}catch(_0x38e145){utils['error'](_0x38e145[_0xd5bd('0x1b')]);}};exports[_0xd5bd('0x23')]=function(_0xbc6020){try{if(!_['isNil'](channels[_0xbc6020[_0xd5bd('0xa')]])){if(_[_0xd5bd('0x1d')](channels[_0xbc6020[_0xd5bd('0xa')]][_0xd5bd('0x24')])){channels[_0xbc6020['uniqueid']][_0xd5bd('0x24')]=_0xbc6020['calleridname']+'\x20<'+_0xbc6020['calleridnum']+'>';}channels[_0xbc6020['uniqueid']]['endtime']=utils[_0xd5bd('0x18')]();channels[_0xbc6020[_0xd5bd('0xa')]]['duration']=utils[_0xd5bd('0x25')](channels[_0xbc6020[_0xd5bd('0xa')]][_0xd5bd('0x26')],channels[_0xbc6020['uniqueid']][_0xd5bd('0x27')]);channels[_0xbc6020[_0xd5bd('0xa')]][_0xd5bd('0x28')]=channels[_0xbc6020[_0xd5bd('0xa')]]['answertime']?utils['diffTime'](channels[_0xbc6020[_0xd5bd('0xa')]][_0xd5bd('0x26')],channels[_0xbc6020[_0xd5bd('0xa')]][_0xd5bd('0x29')]):0x0;writeDB(channels[_0xbc6020['uniqueid']]);}}catch(_0x4ac019){utils[_0xd5bd('0x1a')](_0x4ac019[_0xd5bd('0x1b')]);}};exports[_0xd5bd('0x2a')]=function(_0x4876f1){try{if(!_['isNil'](channels[_0x4876f1[_0xd5bd('0x2b')]])){if(channels[_0x4876f1[_0xd5bd('0x2b')]][_0xd5bd('0xb')]==_0x4876f1[_0xd5bd('0x2c')]){channels[_0x4876f1[_0xd5bd('0x2b')]]['destinationchannel']=_0x4876f1[_0xd5bd('0x2d')];channels[_0x4876f1[_0xd5bd('0x2b')]][_0xd5bd('0x2e')]=_0xd5bd('0x2f');}else if(channels[_0x4876f1[_0xd5bd('0x2b')]][_0xd5bd('0xb')]=_0x4876f1[_0xd5bd('0x30')]){channels[_0x4876f1[_0xd5bd('0x2b')]][_0xd5bd('0x21')]=_0x4876f1[_0xd5bd('0x31')];channels[_0x4876f1['localtwolinkedid']][_0xd5bd('0x2e')]=_0xd5bd('0x2f');}}}catch(_0x452d9e){utils[_0xd5bd('0x1a')](_0x452d9e[_0xd5bd('0x1b')]);}};exports['musiconholdstart']=function(_0x1bd8c3){try{if(!_[_0xd5bd('0x1d')](channels[_0x1bd8c3[_0xd5bd('0xa')]])){channels[_0x1bd8c3['uniqueid']]['musiconholdstartAt']=utils[_0xd5bd('0x18')]();}}catch(_0x29b689){utils[_0xd5bd('0x1a')](_0x29b689[_0xd5bd('0x1b')]);}};exports[_0xd5bd('0x32')]=function(_0x5c646c){try{if(!_[_0xd5bd('0x1d')](channels[_0x5c646c[_0xd5bd('0xa')]])){if(!_[_0xd5bd('0x1d')](channels[_0x5c646c[_0xd5bd('0xa')]][_0xd5bd('0x33')])){channels[_0x5c646c['uniqueid']][_0xd5bd('0x34')]+=utils[_0xd5bd('0x25')](utils['now'](),channels[_0x5c646c[_0xd5bd('0xa')]][_0xd5bd('0x33')]);delete channels[_0x5c646c[_0xd5bd('0xa')]]['musiconholdstartAt'];}}}catch(_0x254c2d){utils[_0xd5bd('0x1a')](_0x254c2d[_0xd5bd('0x1b')]);}};exports[_0xd5bd('0x35')]=function(_0x44946f){try{if(!_[_0xd5bd('0x1d')](channels[_0x44946f[_0xd5bd('0xa')]])){if(!_[_0xd5bd('0x1d')](_0x44946f['variable'][_0xd5bd('0x36')])){channels[_0x44946f[_0xd5bd('0xa')]][_0xd5bd('0x37')]=_0x44946f[_0xd5bd('0x38')];}if(!_[_0xd5bd('0x1d')](_0x44946f['variable'][_0xd5bd('0x39')])){channels[_0x44946f[_0xd5bd('0xa')]][_0xd5bd('0xd')]=_0x44946f[_0xd5bd('0x38')];channels[_0x44946f[_0xd5bd('0xa')]][_0xd5bd('0x24')]='\x22'+_0x44946f[_0xd5bd('0x38')]+_0xd5bd('0x3a')+_0x44946f[_0xd5bd('0x38')]+'>';}if(!_[_0xd5bd('0x1d')](_0x44946f[_0xd5bd('0x3b')][_0xd5bd('0x3c')])||!_['isNil'](_0x44946f[_0xd5bd('0x3b')][_0xd5bd('0x3d')])){channels[_0x44946f[_0xd5bd('0xa')]]['callerid']=_0x44946f[_0xd5bd('0x38')];}if(!_[_0xd5bd('0x1d')](_0x44946f['variable'][_0xd5bd('0x3e')])||!_[_0xd5bd('0x1d')](_0x44946f[_0xd5bd('0x3b')]['xmcs-queue'])){channels[_0x44946f[_0xd5bd('0xa')]][_0xd5bd('0x3f')]=_0xd5bd('0x40');channels[_0x44946f[_0xd5bd('0xa')]][_0xd5bd('0x41')]=_0x44946f['value'];channels[_0x44946f[_0xd5bd('0xa')]][_0xd5bd('0x42')]=!![];}if(!_[_0xd5bd('0x1d')](_0x44946f[_0xd5bd('0x3b')][_0xd5bd('0x43')])){channels[_0x44946f[_0xd5bd('0xa')]][_0xd5bd('0x44')]=_0x44946f[_0xd5bd('0x38')];}if(!_['isNil'](_0x44946f[_0xd5bd('0x3b')][_0xd5bd('0x45')])){channels[_0x44946f[_0xd5bd('0xa')]]['type']=_0x44946f[_0xd5bd('0x38')];}if(!_['isNil'](_0x44946f[_0xd5bd('0x3b')]['outboundrouteid'])){channels[_0x44946f[_0xd5bd('0xa')]][_0xd5bd('0x46')]=_0x44946f[_0xd5bd('0x38')];}if(!_['isNil'](_0x44946f[_0xd5bd('0x3b')][_0xd5bd('0x47')])){channels[_0x44946f[_0xd5bd('0xa')]]['sipcallid']=_0x44946f['value'];}}}catch(_0x1dde18){utils[_0xd5bd('0x1a')](_0x1dde18['stack']);}};exports['newexten']=function(_0x2b3868){try{if(!_[_0xd5bd('0x1d')](channels[_0x2b3868[_0xd5bd('0xa')]])){if(_0x2b3868[_0xd5bd('0x48')][_0xd5bd('0x49')]()=='set'&&_[_0xd5bd('0x4a')](_0x2b3868[_0xd5bd('0x4b')][_0xd5bd('0x49')](),_0xd5bd('0x4c'))){var _0x3c2ea3=_0x2b3868[_0xd5bd('0x4b')]['split']('=');var _0x5000a4=_0x3c2ea3[0x0][_0xd5bd('0x4d')](_0x3c2ea3[0x0][_0xd5bd('0x4e')]('(')+0x1,_0x3c2ea3[0x0]['lastIndexOf'](')'));var _0x148843=_0x3c2ea3[0x1];channels[_0x2b3868[_0xd5bd('0xa')]][_0x5000a4]=_0x148843;}if(!_[_0xd5bd('0x4f')]([_0xd5bd('0x23'),_0xd5bd('0x50'),_0xd5bd('0x51'),_0xd5bd('0x52'),_0xd5bd('0x53')],_0x2b3868[_0xd5bd('0x48')]['toLowerCase']())){channels[_0x2b3868[_0xd5bd('0xa')]][_0xd5bd('0x3f')]=_0x2b3868[_0xd5bd('0x48')];channels[_0x2b3868[_0xd5bd('0xa')]][_0xd5bd('0x41')]=_0x2b3868['appdata'];}}}catch(_0x43cb49){utils[_0xd5bd('0x1a')](_0x43cb49['stack']);}}; \ No newline at end of file +var _0x3e5e=['mohtime','xmd-originatecalleridnum','variable','value','\x22\x20<','xmd-callerid-preview','xmd-queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','type','outboundrouteid','routeid','sipcallid','newexten','application','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','includes','execif','gotoif','lodash','util','./utils','FAILED','ANSWERED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','accountcode','source','destination','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','exten','context','now','error','newstate','isNil','systemanswertime','transfer','destinationchannel','answertime','disposition','channelstate','stack','hangup','callerid','calleridnum','endtime','duration','diffTime','starttime','localtwolinkedid','transfereechannel','userfield','_attended','transfertargetchannel','musiconholdstart','musiconholdstop','musiconholdstartAt'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0x3e5e,0x69));var _0xe3e5=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x3e5e[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xe3e5('0x0'));var util=require(_0xe3e5('0x1'));var utils=require(_0xe3e5('0x2'));var dispositions=['NO\x20ANSWER',_0xe3e5('0x3'),_0xe3e5('0x3'),'NO\x20ANSWER','NO\x20ANSWER','NO\x20ANSWER',_0xe3e5('0x4'),_0xe3e5('0x5'),_0xe3e5('0x3'),_0xe3e5('0x3'),_0xe3e5('0x3')];var channels={};function writeDB(_0x4f6f){utils[_0xe3e5('0x6')](util[_0xe3e5('0x7')](_0xe3e5('0x8'),_0x4f6f[_0xe3e5('0x9')],_0x4f6f[_0xe3e5('0xa')],_0x4f6f['type'],_0x4f6f[_0xe3e5('0xb')],_0x4f6f[_0xe3e5('0xc')],_0x4f6f[_0xe3e5('0xd')],_0x4f6f['callerid'],_0x4f6f['disposition']));if(_0x4f6f['accountcode']){utils[_0xe3e5('0xe')](_0x4f6f[_0xe3e5('0xb')])['then'](function(_0xa02c55){if(_0xa02c55){_0x4f6f[_0xe3e5('0xf')]=_0xa02c55['id'];}utils[_0xe3e5('0x10')](_0xe3e5('0x11'),_0x4f6f);});}else{utils[_0xe3e5('0x10')](_0xe3e5('0x11'),_0x4f6f);}if(channels[_0x4f6f[_0xe3e5('0x9')]]){delete channels[_0x4f6f['uniqueid']];}}exports[_0xe3e5('0x12')]=function(_0x1897f3){try{if(_0x1897f3[_0xe3e5('0x9')]==_0x1897f3[_0xe3e5('0x13')]&&_0x1897f3[_0xe3e5('0xa')]!=_0xe3e5('0x14')){channels[_0x1897f3[_0xe3e5('0x9')]]={'uniqueid':_0x1897f3[_0xe3e5('0x9')],'accountcode':_0x1897f3[_0xe3e5('0xb')],'source':_0x1897f3['calleridnum'],'destination':_0x1897f3[_0xe3e5('0x15')],'destinationcontext':_0x1897f3[_0xe3e5('0x16')],'channel':_0x1897f3[_0xe3e5('0xa')],'starttime':utils[_0xe3e5('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x53b460){utils[_0xe3e5('0x18')](_0x53b460['stack']);}};exports[_0xe3e5('0x19')]=function(_0x741a47){try{if(!_[_0xe3e5('0x1a')](channels[_0x741a47[_0xe3e5('0x9')]])&&_0x741a47['channelstate']==0x6){if(_[_0xe3e5('0x1a')](channels[_0x741a47[_0xe3e5('0x9')]][_0xe3e5('0x1b')])){channels[_0x741a47[_0xe3e5('0x9')]][_0xe3e5('0x1b')]=utils[_0xe3e5('0x17')]();}}else if(!_[_0xe3e5('0x1a')](channels[_0x741a47[_0xe3e5('0x13')]])&&_0x741a47['channelstate']==0x6&&_0x741a47[_0xe3e5('0x16')]!=_0xe3e5('0x1c')){channels[_0x741a47[_0xe3e5('0x13')]]['accountcode']=_0x741a47[_0xe3e5('0xb')];channels[_0x741a47[_0xe3e5('0x13')]][_0xe3e5('0x1d')]=_0x741a47[_0xe3e5('0xa')];if(_[_0xe3e5('0x1a')](channels[_0x741a47[_0xe3e5('0x13')]]['answertime'])){channels[_0x741a47[_0xe3e5('0x13')]][_0xe3e5('0x1e')]=utils[_0xe3e5('0x17')]();}channels[_0x741a47[_0xe3e5('0x13')]][_0xe3e5('0x1f')]=dispositions[_['toNumber'](_0x741a47[_0xe3e5('0x20')])]||'ANSWERED';}}catch(_0x541e37){utils[_0xe3e5('0x18')](_0x541e37[_0xe3e5('0x21')]);}};exports[_0xe3e5('0x22')]=function(_0x56c7d0){try{if(!_[_0xe3e5('0x1a')](channels[_0x56c7d0[_0xe3e5('0x9')]])){if(_['isNil'](channels[_0x56c7d0[_0xe3e5('0x9')]][_0xe3e5('0x23')])){channels[_0x56c7d0[_0xe3e5('0x9')]]['callerid']=_0x56c7d0['calleridname']+'\x20<'+_0x56c7d0[_0xe3e5('0x24')]+'>';}channels[_0x56c7d0[_0xe3e5('0x9')]][_0xe3e5('0x25')]=utils[_0xe3e5('0x17')]();channels[_0x56c7d0[_0xe3e5('0x9')]][_0xe3e5('0x26')]=utils[_0xe3e5('0x27')](channels[_0x56c7d0[_0xe3e5('0x9')]][_0xe3e5('0x25')],channels[_0x56c7d0[_0xe3e5('0x9')]][_0xe3e5('0x28')]);channels[_0x56c7d0['uniqueid']]['billableseconds']=channels[_0x56c7d0[_0xe3e5('0x9')]]['answertime']?utils['diffTime'](channels[_0x56c7d0['uniqueid']]['endtime'],channels[_0x56c7d0[_0xe3e5('0x9')]][_0xe3e5('0x1e')]):0x0;writeDB(channels[_0x56c7d0[_0xe3e5('0x9')]]);}}catch(_0x285ede){utils[_0xe3e5('0x18')](_0x285ede[_0xe3e5('0x21')]);}};exports['attendedtransfer']=function(_0x129935){try{if(!_['isNil'](channels[_0x129935[_0xe3e5('0x29')]])){if(channels[_0x129935[_0xe3e5('0x29')]][_0xe3e5('0xa')]==_0x129935[_0xe3e5('0x2a')]){channels[_0x129935[_0xe3e5('0x29')]][_0xe3e5('0x1d')]=_0x129935['secondtransfererchannel'];channels[_0x129935[_0xe3e5('0x29')]][_0xe3e5('0x2b')]=_0xe3e5('0x2c');}else if(channels[_0x129935[_0xe3e5('0x29')]][_0xe3e5('0xa')]=_0x129935[_0xe3e5('0x2d')]){channels[_0x129935[_0xe3e5('0x29')]][_0xe3e5('0x1d')]=_0x129935['origtransfererchannel'];channels[_0x129935[_0xe3e5('0x29')]]['userfield']=_0xe3e5('0x2c');}}}catch(_0x2a9d8f){utils[_0xe3e5('0x18')](_0x2a9d8f[_0xe3e5('0x21')]);}};exports[_0xe3e5('0x2e')]=function(_0x1ad209){try{if(!_[_0xe3e5('0x1a')](channels[_0x1ad209['uniqueid']])){channels[_0x1ad209[_0xe3e5('0x9')]]['musiconholdstartAt']=utils[_0xe3e5('0x17')]();}}catch(_0x4904e0){utils[_0xe3e5('0x18')](_0x4904e0[_0xe3e5('0x21')]);}};exports[_0xe3e5('0x2f')]=function(_0xb52ab0){try{if(!_[_0xe3e5('0x1a')](channels[_0xb52ab0['uniqueid']])){if(!_[_0xe3e5('0x1a')](channels[_0xb52ab0[_0xe3e5('0x9')]][_0xe3e5('0x30')])){channels[_0xb52ab0[_0xe3e5('0x9')]][_0xe3e5('0x31')]+=utils[_0xe3e5('0x27')](utils[_0xe3e5('0x17')](),channels[_0xb52ab0['uniqueid']][_0xe3e5('0x30')]);delete channels[_0xb52ab0[_0xe3e5('0x9')]][_0xe3e5('0x30')];}}}catch(_0x5ceead){utils[_0xe3e5('0x18')](_0x5ceead[_0xe3e5('0x21')]);}};exports['varset']=function(_0x383ad6){try{if(!_[_0xe3e5('0x1a')](channels[_0x383ad6[_0xe3e5('0x9')]])){if(!_[_0xe3e5('0x1a')](_0x383ad6['variable'][_0xe3e5('0x32')])){channels[_0x383ad6[_0xe3e5('0x9')]][_0xe3e5('0xc')]=_0x383ad6['value'];}if(!_[_0xe3e5('0x1a')](_0x383ad6[_0xe3e5('0x33')]['xmd-phone'])){channels[_0x383ad6[_0xe3e5('0x9')]][_0xe3e5('0xd')]=_0x383ad6[_0xe3e5('0x34')];channels[_0x383ad6[_0xe3e5('0x9')]][_0xe3e5('0x23')]='\x22'+_0x383ad6[_0xe3e5('0x34')]+_0xe3e5('0x35')+_0x383ad6['value']+'>';}if(!_[_0xe3e5('0x1a')](_0x383ad6[_0xe3e5('0x33')][_0xe3e5('0x36')])||!_[_0xe3e5('0x1a')](_0x383ad6[_0xe3e5('0x33')]['xmd-callerid'])){channels[_0x383ad6[_0xe3e5('0x9')]][_0xe3e5('0x23')]=_0x383ad6['value'];}if(!_[_0xe3e5('0x1a')](_0x383ad6['variable'][_0xe3e5('0x37')])||!_[_0xe3e5('0x1a')](_0x383ad6[_0xe3e5('0x33')]['xmcs-queue'])){channels[_0x383ad6[_0xe3e5('0x9')]]['lastapplication']='Queue';channels[_0x383ad6[_0xe3e5('0x9')]][_0xe3e5('0x38')]=_0x383ad6[_0xe3e5('0x34')];channels[_0x383ad6['uniqueid']][_0xe3e5('0x39')]=!![];}if(!_[_0xe3e5('0x1a')](_0x383ad6[_0xe3e5('0x33')][_0xe3e5('0x3a')])){channels[_0x383ad6['uniqueid']][_0xe3e5('0x3b')]=_0x383ad6['value'];}if(!_[_0xe3e5('0x1a')](_0x383ad6[_0xe3e5('0x33')][_0xe3e5('0x3c')])){channels[_0x383ad6['uniqueid']][_0xe3e5('0x3d')]=_0x383ad6[_0xe3e5('0x34')];}if(!_['isNil'](_0x383ad6[_0xe3e5('0x33')][_0xe3e5('0x3e')])){channels[_0x383ad6[_0xe3e5('0x9')]][_0xe3e5('0x3f')]=_0x383ad6[_0xe3e5('0x34')];}if(!_[_0xe3e5('0x1a')](_0x383ad6[_0xe3e5('0x33')][_0xe3e5('0x40')])){channels[_0x383ad6[_0xe3e5('0x9')]][_0xe3e5('0x40')]=_0x383ad6['value'];}}}catch(_0x4c4be5){utils[_0xe3e5('0x18')](_0x4c4be5[_0xe3e5('0x21')]);}};exports[_0xe3e5('0x41')]=function(_0x2db44e){try{if(!_[_0xe3e5('0x1a')](channels[_0x2db44e[_0xe3e5('0x9')]])){if(_0x2db44e[_0xe3e5('0x42')][_0xe3e5('0x43')]()==_0xe3e5('0x44')&&_[_0xe3e5('0x45')](_0x2db44e['appdata']['toLowerCase'](),'cdr')){var _0x27ed8f=_0x2db44e[_0xe3e5('0x46')][_0xe3e5('0x47')]('=');var _0x102dc2=_0x27ed8f[0x0][_0xe3e5('0x48')](_0x27ed8f[0x0]['lastIndexOf']('(')+0x1,_0x27ed8f[0x0][_0xe3e5('0x49')](')'));var _0x2af523=_0x27ed8f[0x1];channels[_0x2db44e['uniqueid']][_0x102dc2]=_0x2af523;}if(!_[_0xe3e5('0x4a')](['hangup','noop',_0xe3e5('0x4b'),_0xe3e5('0x44'),_0xe3e5('0x4c')],_0x2db44e['application'][_0xe3e5('0x43')]())){channels[_0x2db44e[_0xe3e5('0x9')]]['lastapplication']=_0x2db44e[_0xe3e5('0x42')];channels[_0x2db44e['uniqueid']]['lastdata']=_0x2db44e[_0xe3e5('0x46')];}}}catch(_0x1afb49){utils[_0xe3e5('0x18')](_0x1afb49[_0xe3e5('0x21')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index dcf3935..cecc289 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 _0xfb65=['CONNECTED','info','SHUTDOWN','fullybooted','FULLYBOOTED','error','close','CLOSE','managerevent','lodash','connect'];(function(_0x2c6991,_0x4b5775){var _0x4de9fa=function(_0x4ad213){while(--_0x4ad213){_0x2c6991['push'](_0x2c6991['shift']());}};_0x4de9fa(++_0x4b5775);}(_0xfb65,0x82));var _0x5fb6=function(_0x30a831,_0x3db3dc){_0x30a831=_0x30a831-0x0;var _0x4f4171=_0xfb65[_0x30a831];return _0x4f4171;};'use strict';var utils=require('./utils');var _=require(_0x5fb6('0x0'));exports[_0x5fb6('0x1')]=function(){utils['info'](_0x5fb6('0x2'));};exports['shutdown']=function(){utils[_0x5fb6('0x3')](_0x5fb6('0x4'));};exports[_0x5fb6('0x5')]=function(){utils[_0x5fb6('0x3')](_0x5fb6('0x6'));};exports[_0x5fb6('0x7')]=function(_0x4dec8f){utils['error'](_0x4dec8f);};exports[_0x5fb6('0x8')]=function(){utils[_0x5fb6('0x3')](_0x5fb6('0x9'));};exports[_0x5fb6('0xa')]=function(_0x56d6e1){}; \ No newline at end of file +var _0x9c5a=['managerevent','./utils','lodash','info','CONNECTED','shutdown','fullybooted','error','close'];(function(_0x106ee2,_0x1efd6a){var _0x189126=function(_0x569d73){while(--_0x569d73){_0x106ee2['push'](_0x106ee2['shift']());}};_0x189126(++_0x1efd6a);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x38800c,_0x54679e){_0x38800c=_0x38800c-0x0;var _0x1ecbe7=_0x9c5a[_0x38800c];return _0x1ecbe7;};'use strict';var utils=require(_0xa9c5('0x0'));var _=require(_0xa9c5('0x1'));exports['connect']=function(){utils[_0xa9c5('0x2')](_0xa9c5('0x3'));};exports[_0xa9c5('0x4')]=function(){utils[_0xa9c5('0x2')]('SHUTDOWN');};exports[_0xa9c5('0x5')]=function(){utils[_0xa9c5('0x2')]('FULLYBOOTED');};exports[_0xa9c5('0x6')]=function(_0x4d9c7a){utils[_0xa9c5('0x6')](_0x4d9c7a);};exports[_0xa9c5('0x7')]=function(){utils['info']('CLOSE');};exports[_0xa9c5('0x8')]=function(_0x16f331){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index cda09a0..f8b4e39 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 _0x03f5=['info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','calleridnum','connectedlinenum','CreateVoiceDialReport','newexten','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','error','stack','isNil','outboundrouteid','value','dialbegin','assign','starttime','now','lastevent','dialend','dialstatus','ANSWER','connect','complete','diffTime','holdtime','answertime','billableseconds','endtime','lodash','util','./utils'];(function(_0x1be67f,_0x2de2f3){var _0x2abef4=function(_0x57dd81){while(--_0x57dd81){_0x1be67f['push'](_0x1be67f['shift']());}};_0x2abef4(++_0x2de2f3);}(_0x03f5,0x6c));var _0x503f=function(_0x41561c,_0x5ad051){_0x41561c=_0x41561c-0x0;var _0x1f327b=_0x03f5[_0x41561c];return _0x1f327b;};'use strict';var _=require(_0x503f('0x0'));var util=require(_0x503f('0x1'));var utils=require(_0x503f('0x2'));var dials={};function writeDB(_0x1ebedf){utils[_0x503f('0x3')](util[_0x503f('0x4')](_0x503f('0x5'),_0x1ebedf[_0x503f('0x6')],_0x1ebedf['channel'],_0x1ebedf['dialstring'],_0x1ebedf[_0x503f('0x7')],_0x1ebedf[_0x503f('0x8')],_0x1ebedf['dialstatus']));utils['request'](_0x503f('0x9'),_0x1ebedf);delete dials[_0x1ebedf[_0x503f('0x6')]];}exports[_0x503f('0xa')]=function(_0x284993){try{if(_0x284993[_0x503f('0xb')][_0x503f('0xc')]()==_0x503f('0xd')&&_[_0x503f('0xe')](_0x284993[_0x503f('0xf')][_0x503f('0xc')](),_0x503f('0x10'))){var _0x5b2e2a=_0x284993[_0x503f('0xf')]['split']('=');dials[_0x284993[_0x503f('0x6')]]={'routeId':_0x5b2e2a[0x1]};}}catch(_0x2c5730){utils[_0x503f('0x11')](_0x2c5730[_0x503f('0x12')]);}};exports['varset']=function(_0x18678b){try{if(!_[_0x503f('0x13')](_0x18678b['variable'][_0x503f('0x14')])){dials[_0x18678b['uniqueid']]={'routeId':_0x18678b[_0x503f('0x15')]};}}catch(_0x13b753){utils[_0x503f('0x11')](_0x13b753[_0x503f('0x12')]);}};exports[_0x503f('0x16')]=function(_0x32cec6){try{if(!_[_0x503f('0x13')](dials[_0x32cec6[_0x503f('0x6')]])){dials[_0x32cec6[_0x503f('0x6')]]=_[_0x503f('0x17')](dials[_0x32cec6['uniqueid']],_0x32cec6);dials[_0x32cec6['uniqueid']][_0x503f('0x18')]=utils[_0x503f('0x19')]();dials[_0x32cec6[_0x503f('0x6')]][_0x503f('0x1a')]='called';}}catch(_0x19acf3){utils[_0x503f('0x11')](_0x19acf3[_0x503f('0x12')]);}};exports[_0x503f('0x1b')]=function(_0x2e8c53){try{if(!_[_0x503f('0x13')](dials[_0x2e8c53[_0x503f('0x6')]])){dials[_0x2e8c53[_0x503f('0x6')]][_0x503f('0x1c')]=_0x2e8c53[_0x503f('0x1c')];if(_0x2e8c53[_0x503f('0x1c')]==_0x503f('0x1d')){dials[_0x2e8c53[_0x503f('0x6')]]=_[_0x503f('0x17')](dials[_0x2e8c53[_0x503f('0x6')]],_0x2e8c53);dials[_0x2e8c53[_0x503f('0x6')]]['answertime']=utils[_0x503f('0x19')]();dials[_0x2e8c53[_0x503f('0x6')]][_0x503f('0x1a')]=_0x503f('0x1e');}}}catch(_0x477245){utils[_0x503f('0x11')](_0x477245[_0x503f('0x12')]);}};exports['hangup']=function(_0x4564a0){try{if(!_[_0x503f('0x13')](dials[_0x4564a0[_0x503f('0x6')]])){dials[_0x4564a0['uniqueid']]=_[_0x503f('0x17')](dials[_0x4564a0[_0x503f('0x6')]],{'endtime':utils['now'](),'lastevent':_0x503f('0x1f')});dials[_0x4564a0[_0x503f('0x6')]]['duration']=utils[_0x503f('0x20')](dials[_0x4564a0[_0x503f('0x6')]]['endtime'],dials[_0x4564a0[_0x503f('0x6')]]['starttime']);dials[_0x4564a0[_0x503f('0x6')]][_0x503f('0x21')]=utils[_0x503f('0x20')](dials[_0x4564a0[_0x503f('0x6')]][_0x503f('0x22')]||dials[_0x4564a0['uniqueid']]['endtime'],dials[_0x4564a0[_0x503f('0x6')]][_0x503f('0x18')]);dials[_0x4564a0[_0x503f('0x6')]][_0x503f('0x23')]=dials[_0x4564a0[_0x503f('0x6')]][_0x503f('0x22')]?utils[_0x503f('0x20')](dials[_0x4564a0[_0x503f('0x6')]][_0x503f('0x24')],dials[_0x4564a0['uniqueid']][_0x503f('0x22')]):0x0;writeDB(dials[_0x4564a0[_0x503f('0x6')]]);}}catch(_0x4a92e8){utils[_0x503f('0x11')](_0x4a92e8[_0x503f('0x12')]);}}; \ No newline at end of file +var _0x5e2b=['util','./utils','info','format','DIAL|%s|%s|%s|%s|%s|%s','calleridnum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','application','toLowerCase','startsWith','appdata','cdr(routeid)','error','varset','isNil','variable','stack','assign','starttime','now','called','ANSWER','answertime','lastevent','connect','hangup','complete','diffTime','holdtime','endtime','billableseconds'];(function(_0x1630e5,_0x237ef4){var _0x5128ee=function(_0x53c331){while(--_0x53c331){_0x1630e5['push'](_0x1630e5['shift']());}};_0x5128ee(++_0x237ef4);}(_0x5e2b,0xd2));var _0xb5e2=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0x5e2b[_0x1fd675];return _0x16b554;};'use strict';var _=require('lodash');var util=require(_0xb5e2('0x0'));var utils=require(_0xb5e2('0x1'));var dials={};function writeDB(_0x22f7e4){utils[_0xb5e2('0x2')](util[_0xb5e2('0x3')](_0xb5e2('0x4'),_0x22f7e4['uniqueid'],_0x22f7e4['channel'],_0x22f7e4['dialstring'],_0x22f7e4[_0xb5e2('0x5')],_0x22f7e4['connectedlinenum'],_0x22f7e4[_0xb5e2('0x6')]));utils[_0xb5e2('0x7')](_0xb5e2('0x8'),_0x22f7e4);delete dials[_0x22f7e4[_0xb5e2('0x9')]];}exports[_0xb5e2('0xa')]=function(_0x3d1df1){try{if(_0x3d1df1[_0xb5e2('0xb')][_0xb5e2('0xc')]()=='set'&&_[_0xb5e2('0xd')](_0x3d1df1[_0xb5e2('0xe')][_0xb5e2('0xc')](),_0xb5e2('0xf'))){var _0xceac4f=_0x3d1df1['appdata']['split']('=');dials[_0x3d1df1['uniqueid']]={'routeId':_0xceac4f[0x1]};}}catch(_0x54a8ab){utils[_0xb5e2('0x10')](_0x54a8ab['stack']);}};exports[_0xb5e2('0x11')]=function(_0x88ffd5){try{if(!_[_0xb5e2('0x12')](_0x88ffd5[_0xb5e2('0x13')]['outboundrouteid'])){dials[_0x88ffd5[_0xb5e2('0x9')]]={'routeId':_0x88ffd5['value']};}}catch(_0x58622b){utils['error'](_0x58622b[_0xb5e2('0x14')]);}};exports['dialbegin']=function(_0x32c612){try{if(!_[_0xb5e2('0x12')](dials[_0x32c612[_0xb5e2('0x9')]])){dials[_0x32c612[_0xb5e2('0x9')]]=_[_0xb5e2('0x15')](dials[_0x32c612['uniqueid']],_0x32c612);dials[_0x32c612[_0xb5e2('0x9')]][_0xb5e2('0x16')]=utils[_0xb5e2('0x17')]();dials[_0x32c612['uniqueid']]['lastevent']=_0xb5e2('0x18');}}catch(_0x3dc537){utils[_0xb5e2('0x10')](_0x3dc537[_0xb5e2('0x14')]);}};exports['dialend']=function(_0x219624){try{if(!_['isNil'](dials[_0x219624['uniqueid']])){dials[_0x219624['uniqueid']][_0xb5e2('0x6')]=_0x219624[_0xb5e2('0x6')];if(_0x219624['dialstatus']==_0xb5e2('0x19')){dials[_0x219624[_0xb5e2('0x9')]]=_['assign'](dials[_0x219624[_0xb5e2('0x9')]],_0x219624);dials[_0x219624['uniqueid']][_0xb5e2('0x1a')]=utils[_0xb5e2('0x17')]();dials[_0x219624[_0xb5e2('0x9')]][_0xb5e2('0x1b')]=_0xb5e2('0x1c');}}}catch(_0x1283bd){utils[_0xb5e2('0x10')](_0x1283bd[_0xb5e2('0x14')]);}};exports[_0xb5e2('0x1d')]=function(_0x7d8f64){try{if(!_[_0xb5e2('0x12')](dials[_0x7d8f64[_0xb5e2('0x9')]])){dials[_0x7d8f64[_0xb5e2('0x9')]]=_[_0xb5e2('0x15')](dials[_0x7d8f64[_0xb5e2('0x9')]],{'endtime':utils[_0xb5e2('0x17')](),'lastevent':_0xb5e2('0x1e')});dials[_0x7d8f64[_0xb5e2('0x9')]]['duration']=utils[_0xb5e2('0x1f')](dials[_0x7d8f64[_0xb5e2('0x9')]]['endtime'],dials[_0x7d8f64['uniqueid']][_0xb5e2('0x16')]);dials[_0x7d8f64[_0xb5e2('0x9')]][_0xb5e2('0x20')]=utils[_0xb5e2('0x1f')](dials[_0x7d8f64[_0xb5e2('0x9')]][_0xb5e2('0x1a')]||dials[_0x7d8f64[_0xb5e2('0x9')]][_0xb5e2('0x21')],dials[_0x7d8f64[_0xb5e2('0x9')]][_0xb5e2('0x16')]);dials[_0x7d8f64[_0xb5e2('0x9')]][_0xb5e2('0x22')]=dials[_0x7d8f64[_0xb5e2('0x9')]][_0xb5e2('0x1a')]?utils[_0xb5e2('0x1f')](dials[_0x7d8f64['uniqueid']]['endtime'],dials[_0x7d8f64['uniqueid']][_0xb5e2('0x1a')]):0x0;writeDB(dials[_0x7d8f64[_0xb5e2('0x9')]]);}}catch(_0x1d9f03){utils[_0xb5e2('0x10')](_0x1d9f03[_0xb5e2('0x14')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 0348215..0fff4d8 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 _0x4713=['agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','port','asterisk','username','password','keepConnected','xdr','disabled','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer'];(function(_0x23598e,_0x5d897b){var _0x2f4f7a=function(_0x41d8e7){while(--_0x41d8e7){_0x23598e['push'](_0x23598e['shift']());}};_0x2f4f7a(++_0x5d897b);}(_0x4713,0x69));var _0x3471=function(_0x3038be,_0x425d69){_0x3038be=_0x3038be-0x0;var _0x581d4e=_0x4713[_0x3038be];return _0x581d4e;};var AsteriskManager=require(_0x3471('0x0'));var config=require(_0x3471('0x1'));var utils=require(_0x3471('0x2'));var ami=new AsteriskManager(config['asterisk'][_0x3471('0x3')],config[_0x3471('0x4')]['ip'],config[_0x3471('0x4')][_0x3471('0x5')],config['asterisk'][_0x3471('0x6')],!![]);ami[_0x3471('0x7')]();if(config['xdr']&&config[_0x3471('0x8')][_0x3471('0x9')]){utils[_0x3471('0xa')]('XDR\x20DISABLED');}else{var agents=require(_0x3471('0xb'));var calls=require(_0x3471('0xc'));var queues=require(_0x3471('0xd'));var recordings=require(_0x3471('0xe'));var members=require(_0x3471('0xf'));var dials=require(_0x3471('0x10'));var transfers=require('./transfers.controller');var core=require(_0x3471('0x11'));ami['on'](_0x3471('0x12'),core[_0x3471('0x12')]);ami['on'](_0x3471('0x13'),core[_0x3471('0x13')]);ami['on'](_0x3471('0x14'),core[_0x3471('0x14')]);ami['on'](_0x3471('0x15'),core[_0x3471('0x15')]);ami['on'](_0x3471('0x16'),core[_0x3471('0x16')]);ami['on'](_0x3471('0x17'),core['managerevent']);ami['on']('devicestatechange',function(_0x17f5b4){try{members[_0x3471('0x18')](_0x17f5b4);}catch(_0x22be14){utils['error'](_0x22be14);}});ami['on'](_0x3471('0x19'),function(_0x43ebac){try{agents['agentcalled'](_0x43ebac);}catch(_0x525ae0){utils[_0x3471('0x15')](_0x525ae0);}});ami['on']('agentringnoanswer',function(_0x133cd0){try{agents[_0x3471('0x1a')](_0x133cd0);}catch(_0x5b9dcb){utils['error'](_0x5b9dcb);}});ami['on'](_0x3471('0x1b'),function(_0xfd8250){try{agents[_0x3471('0x1b')](_0xfd8250);queues['agentconnect'](_0xfd8250);}catch(_0x28dd33){utils[_0x3471('0x15')](_0x28dd33);}});ami['on'](_0x3471('0x1c'),function(_0x1b85a4){try{agents['agentcomplete'](_0x1b85a4);queues[_0x3471('0x1c')](_0x1b85a4);members[_0x3471('0x1c')](_0x1b85a4);}catch(_0x3a470b){utils['error'](_0x3a470b);}});ami['on'](_0x3471('0x1d'),function(_0x40352d){try{agents[_0x3471('0x1d')](_0x40352d);queues['queuecallerabandon'](_0x40352d);}catch(_0x52da81){utils[_0x3471('0x15')](_0x52da81);}});ami['on']('queuecallerjoin',function(_0x29f48c){try{queues[_0x3471('0x1e')](_0x29f48c);recordings[_0x3471('0x1e')](_0x29f48c);}catch(_0x2dfad1){utils[_0x3471('0x15')](_0x2dfad1);}});ami['on']('queuecallerleave',function(_0x599dce){try{queues[_0x3471('0x1f')](_0x599dce);}catch(_0x55db19){utils[_0x3471('0x15')](_0x55db19);}});ami['on'](_0x3471('0x20'),function(_0x20fec9){try{queues[_0x3471('0x20')](_0x20fec9);calls[_0x3471('0x20')](_0x20fec9);}catch(_0x304029){utils['error'](_0x304029);}});ami['on']('musiconholdstop',function(_0x46543d){try{queues[_0x3471('0x21')](_0x46543d);calls[_0x3471('0x21')](_0x46543d);}catch(_0x16597){utils['error'](_0x16597);}});ami['on']('newstate',function(_0x1f7ec4){try{calls[_0x3471('0x22')](_0x1f7ec4);recordings['newstate'](_0x1f7ec4);}catch(_0x2016e2){utils[_0x3471('0x15')](_0x2016e2);}});ami['on'](_0x3471('0x23'),function(_0x1ae534){try{calls[_0x3471('0x23')](_0x1ae534);recordings['hangup'](_0x1ae534);dials[_0x3471('0x23')](_0x1ae534);agents[_0x3471('0x23')](_0x1ae534);queues[_0x3471('0x23')](_0x1ae534);}catch(_0x4818a6){utils[_0x3471('0x15')](_0x4818a6);}});ami['on'](_0x3471('0x24'),function(_0x46f99a){try{members[_0x3471('0x24')](_0x46f99a);}catch(_0x2e346d){utils[_0x3471('0x15')](_0x2e346d);}});ami['on']('blindtransfer',function(_0xf11616){try{queues['blindtransfer'](_0xf11616);agents['blindtransfer'](_0xf11616);transfers[_0x3471('0x25')](_0xf11616);}catch(_0x1599ef){utils[_0x3471('0x15')](_0x1599ef);}});ami['on'](_0x3471('0x26'),function(_0x555555){try{queues['attendedtransfer'](_0x555555);transfers[_0x3471('0x26')](_0x555555);agents[_0x3471('0x26')](_0x555555);calls['attendedtransfer'](_0x555555);}catch(_0x92a461){utils['error'](_0x92a461);}});ami['on'](_0x3471('0x27'),function(_0x3c5e18){try{queues[_0x3471('0x27')](_0x3c5e18);recordings[_0x3471('0x27')](_0x3c5e18);calls[_0x3471('0x27')](_0x3c5e18);dials[_0x3471('0x27')](_0x3c5e18);}catch(_0x4de9fb){utils[_0x3471('0x15')](_0x4de9fb);}});ami['on'](_0x3471('0x28'),function(_0x521886){try{calls['newexten'](_0x521886);recordings['newexten'](_0x521886);dials[_0x3471('0x28')](_0x521886);}catch(_0x302796){utils[_0x3471('0x15')](_0x302796);}});ami['on']('newchannel',function(_0x305544){try{calls[_0x3471('0x29')](_0x305544);recordings['newchannel'](_0x305544);}catch(_0x19abc1){utils[_0x3471('0x15')](_0x19abc1);}});ami['on'](_0x3471('0x2a'),function(_0x5bfe89){try{dials['dialbegin'](_0x5bfe89);}catch(_0x59303c){utils[_0x3471('0x15')](_0x59303c);}});ami['on'](_0x3471('0x2b'),function(_0x5d50cc){try{dials[_0x3471('0x2b')](_0x5d50cc);}catch(_0x599884){utils[_0x3471('0x15')](_0x599884);}});} \ No newline at end of file +var _0x8f3d=['../../config/environment','asterisk','port','username','password','keepConnected','xdr','disabled','./agents.controller','./calls.controller','./queues.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager'];(function(_0x34baf0,_0x3367fa){var _0x52a5f4=function(_0x382182){while(--_0x382182){_0x34baf0['push'](_0x34baf0['shift']());}};_0x52a5f4(++_0x3367fa);}(_0x8f3d,0x1eb));var _0xd8f3=function(_0x1d439c,_0x14b4b2){_0x1d439c=_0x1d439c-0x0;var _0xb0136e=_0x8f3d[_0x1d439c];return _0xb0136e;};var AsteriskManager=require(_0xd8f3('0x0'));var config=require(_0xd8f3('0x1'));var utils=require('./utils');var ami=new AsteriskManager(config[_0xd8f3('0x2')][_0xd8f3('0x3')],config[_0xd8f3('0x2')]['ip'],config['asterisk'][_0xd8f3('0x4')],config[_0xd8f3('0x2')][_0xd8f3('0x5')],!![]);ami[_0xd8f3('0x6')]();if(config['xdr']&&config[_0xd8f3('0x7')][_0xd8f3('0x8')]){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0xd8f3('0x9'));var calls=require(_0xd8f3('0xa'));var queues=require(_0xd8f3('0xb'));var recordings=require('./recordings.controller');var members=require(_0xd8f3('0xc'));var dials=require('./dials.controller');var transfers=require(_0xd8f3('0xd'));var core=require(_0xd8f3('0xe'));ami['on'](_0xd8f3('0xf'),core[_0xd8f3('0xf')]);ami['on'](_0xd8f3('0x10'),core[_0xd8f3('0x10')]);ami['on'](_0xd8f3('0x11'),core[_0xd8f3('0x11')]);ami['on'](_0xd8f3('0x12'),core[_0xd8f3('0x12')]);ami['on'](_0xd8f3('0x13'),core[_0xd8f3('0x13')]);ami['on']('managerevent',core[_0xd8f3('0x14')]);ami['on'](_0xd8f3('0x15'),function(_0x51d559){try{members[_0xd8f3('0x15')](_0x51d559);}catch(_0x3baffd){utils[_0xd8f3('0x12')](_0x3baffd);}});ami['on'](_0xd8f3('0x16'),function(_0x15f60d){try{agents['agentcalled'](_0x15f60d);}catch(_0x9d907){utils['error'](_0x9d907);}});ami['on'](_0xd8f3('0x17'),function(_0x6fd22b){try{agents['agentringnoanswer'](_0x6fd22b);}catch(_0x5d988a){utils[_0xd8f3('0x12')](_0x5d988a);}});ami['on']('agentconnect',function(_0x378a01){try{agents[_0xd8f3('0x18')](_0x378a01);queues[_0xd8f3('0x18')](_0x378a01);}catch(_0x860cc0){utils[_0xd8f3('0x12')](_0x860cc0);}});ami['on'](_0xd8f3('0x19'),function(_0x561947){try{agents[_0xd8f3('0x19')](_0x561947);queues[_0xd8f3('0x19')](_0x561947);members[_0xd8f3('0x19')](_0x561947);}catch(_0x3bf318){utils[_0xd8f3('0x12')](_0x3bf318);}});ami['on']('queuecallerabandon',function(_0x34bfdb){try{agents[_0xd8f3('0x1a')](_0x34bfdb);queues[_0xd8f3('0x1a')](_0x34bfdb);}catch(_0x4a662c){utils[_0xd8f3('0x12')](_0x4a662c);}});ami['on'](_0xd8f3('0x1b'),function(_0x4b16fe){try{queues[_0xd8f3('0x1b')](_0x4b16fe);recordings[_0xd8f3('0x1b')](_0x4b16fe);}catch(_0x233274){utils[_0xd8f3('0x12')](_0x233274);}});ami['on'](_0xd8f3('0x1c'),function(_0x420776){try{queues['queuecallerleave'](_0x420776);}catch(_0x39a13d){utils['error'](_0x39a13d);}});ami['on'](_0xd8f3('0x1d'),function(_0x2afee5){try{queues[_0xd8f3('0x1d')](_0x2afee5);calls['musiconholdstart'](_0x2afee5);}catch(_0x4488c5){utils[_0xd8f3('0x12')](_0x4488c5);}});ami['on'](_0xd8f3('0x1e'),function(_0x508d2a){try{queues[_0xd8f3('0x1e')](_0x508d2a);calls[_0xd8f3('0x1e')](_0x508d2a);}catch(_0x26d328){utils[_0xd8f3('0x12')](_0x26d328);}});ami['on']('newstate',function(_0x52a79c){try{calls[_0xd8f3('0x1f')](_0x52a79c);recordings[_0xd8f3('0x1f')](_0x52a79c);}catch(_0x46c5c4){utils[_0xd8f3('0x12')](_0x46c5c4);}});ami['on'](_0xd8f3('0x20'),function(_0x39800c){try{calls[_0xd8f3('0x20')](_0x39800c);recordings[_0xd8f3('0x20')](_0x39800c);dials[_0xd8f3('0x20')](_0x39800c);agents[_0xd8f3('0x20')](_0x39800c);queues[_0xd8f3('0x20')](_0x39800c);}catch(_0xd5addf){utils[_0xd8f3('0x12')](_0xd5addf);}});ami['on'](_0xd8f3('0x21'),function(_0x4e835d){try{members[_0xd8f3('0x21')](_0x4e835d);}catch(_0x3ec302){utils['error'](_0x3ec302);}});ami['on']('blindtransfer',function(_0x5db2b){try{queues[_0xd8f3('0x22')](_0x5db2b);agents[_0xd8f3('0x22')](_0x5db2b);transfers['blindtransfer'](_0x5db2b);}catch(_0x1e4768){utils[_0xd8f3('0x12')](_0x1e4768);}});ami['on'](_0xd8f3('0x23'),function(_0x4a5142){try{queues[_0xd8f3('0x23')](_0x4a5142);transfers[_0xd8f3('0x23')](_0x4a5142);agents[_0xd8f3('0x23')](_0x4a5142);calls[_0xd8f3('0x23')](_0x4a5142);}catch(_0x167dd3){utils[_0xd8f3('0x12')](_0x167dd3);}});ami['on'](_0xd8f3('0x24'),function(_0x683552){try{queues[_0xd8f3('0x24')](_0x683552);recordings['varset'](_0x683552);calls[_0xd8f3('0x24')](_0x683552);dials[_0xd8f3('0x24')](_0x683552);}catch(_0x2ae3b0){utils[_0xd8f3('0x12')](_0x2ae3b0);}});ami['on']('newexten',function(_0x10491e){try{calls[_0xd8f3('0x25')](_0x10491e);recordings['newexten'](_0x10491e);dials['newexten'](_0x10491e);}catch(_0x45b7fb){utils[_0xd8f3('0x12')](_0x45b7fb);}});ami['on'](_0xd8f3('0x26'),function(_0x39af53){try{calls[_0xd8f3('0x26')](_0x39af53);recordings[_0xd8f3('0x26')](_0x39af53);}catch(_0x5bc475){utils['error'](_0x5bc475);}});ami['on'](_0xd8f3('0x27'),function(_0x7fdf31){try{dials[_0xd8f3('0x27')](_0x7fdf31);}catch(_0x1acd99){utils[_0xd8f3('0x12')](_0x1acd99);}});ami['on']('dialend',function(_0x454054){try{dials[_0xd8f3('0x28')](_0x454054);}catch(_0x5ebcf6){utils[_0xd8f3('0x12')](_0x5ebcf6);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 14f149a..5c9dab7 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 _0x51c3=['some','startsWith','devicestatechange','state','BUSY','device','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime','enterAt','assign','queue','cdr','isNil','data1','type','source','destination','destinationchannel','data3','./utils','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','channel','data2','membername','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','error'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0x51c3,0x75));var _0x351c=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x51c3[_0xc6be3a];return _0x56a310;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x351c('0x0'));var members={};var exclude=[_0x351c('0x1'),_0x351c('0x2')];function writeDB(_0x536828){utils[_0x351c('0x3')](util[_0x351c('0x4')](_0x351c('0x5'),_0x536828[_0x351c('0x6')],_0x536828[_0x351c('0x7')],_0x536828[_0x351c('0x8')],_0x536828[_0x351c('0x9')],_0x536828[_0x351c('0xa')],_0x536828['type']));if(_0x536828['interface']){utils[_0x351c('0xb')](_0x536828[_0x351c('0x7')])['then'](function(_0x8de933){if(_0x8de933){_0x536828[_0x351c('0xa')]=_0x8de933[_0x351c('0xc')];_0x536828['internal']=_0x8de933[_0x351c('0xd')];utils[_0x351c('0xe')](_0x351c('0xf'),_0x536828);}else{utils[_0x351c('0x10')](_0x536828[_0x351c('0x7')][_0x351c('0x11')]('/')[0x1])[_0x351c('0x12')](function(_0x50960b){if(_0x50960b){_0x536828['membername']=_0x50960b[_0x351c('0xc')];_0x536828['internal']=_0x50960b['internal'];utils[_0x351c('0xe')](_0x351c('0xf'),_0x536828);}});}})[_0x351c('0x13')](function(_0x474d2c){utils[_0x351c('0x14')](_0x474d2c);});}delete members[_0x536828[_0x351c('0x7')]];}function startsWith(_0x27302f,_0x40b705){return _[_0x351c('0x15')](_0x27302f,function(_0x555d92){return _[_0x351c('0x16')](_0x40b705,_0x555d92);});}exports[_0x351c('0x17')]=function(_0x4a60b7){switch(_0x4a60b7[_0x351c('0x18')]){case'INUSE':case _0x351c('0x19'):if(!startsWith(exclude,_0x4a60b7[_0x351c('0x1a')])){members[_0x4a60b7[_0x351c('0x1a')]]={'channel':_0x351c('0x1b'),'interface':_0x4a60b7[_0x351c('0x1a')],'type':_0x351c('0x1c'),'enterAt':utils[_0x351c('0x1d')](),'role':_0x351c('0x1e')};}break;case _0x351c('0x1f'):if(!_['isNil'](members[_0x4a60b7[_0x351c('0x1a')]])){members[_0x4a60b7[_0x351c('0x1a')]][_0x351c('0x20')]=utils[_0x351c('0x1d')]();members[_0x4a60b7['device']][_0x351c('0x21')]=utils[_0x351c('0x22')](members[_0x4a60b7[_0x351c('0x1a')]][_0x351c('0x20')],members[_0x4a60b7['device']][_0x351c('0x23')]);if(members[_0x4a60b7['device']][_0x351c('0x6')]){writeDB(members[_0x4a60b7[_0x351c('0x1a')]]);}}default:break;}};exports['agentcomplete']=function(_0x3a5121){if(!_['isNil'](members[_0x3a5121['interface']])){members[_0x3a5121[_0x351c('0x7')]]=_[_0x351c('0x24')](members[_0x3a5121['interface']],{'data4':_0x3a5121[_0x351c('0x25')],'uniqueid':_0x3a5121['uniqueid']});}};exports[_0x351c('0x26')]=function(_0x4eff4b){if(_0x4eff4b['channel']){var _0x2ac860=_0x4eff4b[_0x351c('0x8')]['split']('-')[0x0];if(!_[_0x351c('0x27')](members[_0x2ac860])){members[_0x2ac860]=_['assign'](members[_0x2ac860],{'data1':members[_0x2ac860][_0x351c('0x28')]||_0x4eff4b[_0x351c('0x29')],'data2':members[_0x2ac860][_0x351c('0x9')]||_0x4eff4b[_0x351c('0x2a')],'data3':members[_0x2ac860]['data3']||_0x4eff4b[_0x351c('0x2b')],'uniqueid':members[_0x2ac860][_0x351c('0x6')]||_0x4eff4b['uniqueid']});if(members[_0x2ac860][_0x351c('0x20')]){writeDB(members[_0x2ac860]);}}}if(_0x4eff4b['destinationchannel']){var _0x46ba20=_0x4eff4b[_0x351c('0x2c')][_0x351c('0x11')]('-')[0x0];if(!_[_0x351c('0x27')](members[_0x46ba20])){members[_0x46ba20]=_[_0x351c('0x24')](members[_0x46ba20],{'data1':members[_0x46ba20][_0x351c('0x28')]||_0x4eff4b[_0x351c('0x29')],'data2':members[_0x46ba20][_0x351c('0x9')]||_0x4eff4b[_0x351c('0x2a')],'data3':members[_0x46ba20][_0x351c('0x2d')]||_0x4eff4b[_0x351c('0x2b')],'uniqueid':members[_0x46ba20][_0x351c('0x6')]||_0x4eff4b[_0x351c('0x6')]});if(members[_0x46ba20][_0x351c('0x20')]){writeDB(members[_0x46ba20]);}}}}; \ No newline at end of file +var _0x96c3=['MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','data2','type','then','membername','internal','request','CreateMemberReport','getUserByName','interface','split','name','catch','some','devicestatechange','INUSE','BUSY','device','TALKING','now','NOT_INUSE','exitAt','duration','enterAt','agentcomplete','isNil','assign','queue','channel','data1','source','data3','destination','destinationchannel','lodash','./utils','Local/_attended@transfer','Queue:','format'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x96c3,0x73));var _0x396c=function(_0x590a5f,_0x16d6aa){_0x590a5f=_0x590a5f-0x0;var _0x28d0b0=_0x96c3[_0x590a5f];return _0x28d0b0;};'use strict';var _=require(_0x396c('0x0'));var util=require('util');var utils=require(_0x396c('0x1'));var members={};var exclude=[_0x396c('0x2'),_0x396c('0x3')];function writeDB(_0x4eeed2){utils['info'](util[_0x396c('0x4')](_0x396c('0x5'),_0x4eeed2[_0x396c('0x6')],_0x4eeed2['interface'],_0x4eeed2['channel'],_0x4eeed2[_0x396c('0x7')],_0x4eeed2['membername'],_0x4eeed2[_0x396c('0x8')]));if(_0x4eeed2['interface']){utils['getUserByInterface'](_0x4eeed2['interface'])[_0x396c('0x9')](function(_0x11db88){if(_0x11db88){_0x4eeed2[_0x396c('0xa')]=_0x11db88['name'];_0x4eeed2[_0x396c('0xb')]=_0x11db88[_0x396c('0xb')];utils[_0x396c('0xc')](_0x396c('0xd'),_0x4eeed2);}else{utils[_0x396c('0xe')](_0x4eeed2[_0x396c('0xf')][_0x396c('0x10')]('/')[0x1])[_0x396c('0x9')](function(_0x17d6bb){if(_0x17d6bb){_0x4eeed2[_0x396c('0xa')]=_0x17d6bb[_0x396c('0x11')];_0x4eeed2[_0x396c('0xb')]=_0x17d6bb[_0x396c('0xb')];utils[_0x396c('0xc')](_0x396c('0xd'),_0x4eeed2);}});}})[_0x396c('0x12')](function(_0xeba3d1){utils['error'](_0xeba3d1);});}delete members[_0x4eeed2[_0x396c('0xf')]];}function startsWith(_0x71e5e9,_0x2eae5d){return _[_0x396c('0x13')](_0x71e5e9,function(_0x24bdba){return _['startsWith'](_0x2eae5d,_0x24bdba);});}exports[_0x396c('0x14')]=function(_0x56b47e){switch(_0x56b47e['state']){case _0x396c('0x15'):case _0x396c('0x16'):if(!startsWith(exclude,_0x56b47e[_0x396c('0x17')])){members[_0x56b47e[_0x396c('0x17')]]={'channel':'voice','interface':_0x56b47e[_0x396c('0x17')],'type':_0x396c('0x18'),'enterAt':utils[_0x396c('0x19')](),'role':'agent'};}break;case _0x396c('0x1a'):if(!_['isNil'](members[_0x56b47e[_0x396c('0x17')]])){members[_0x56b47e[_0x396c('0x17')]][_0x396c('0x1b')]=utils['now']();members[_0x56b47e['device']][_0x396c('0x1c')]=utils['diffTime'](members[_0x56b47e[_0x396c('0x17')]][_0x396c('0x1b')],members[_0x56b47e[_0x396c('0x17')]][_0x396c('0x1d')]);if(members[_0x56b47e[_0x396c('0x17')]][_0x396c('0x6')]){writeDB(members[_0x56b47e['device']]);}}default:break;}};exports[_0x396c('0x1e')]=function(_0x4f75b7){if(!_[_0x396c('0x1f')](members[_0x4f75b7[_0x396c('0xf')]])){members[_0x4f75b7[_0x396c('0xf')]]=_[_0x396c('0x20')](members[_0x4f75b7['interface']],{'data4':_0x4f75b7[_0x396c('0x21')],'uniqueid':_0x4f75b7[_0x396c('0x6')]});}};exports['cdr']=function(_0x408ded){if(_0x408ded[_0x396c('0x22')]){var _0xec7127=_0x408ded[_0x396c('0x22')][_0x396c('0x10')]('-')[0x0];if(!_['isNil'](members[_0xec7127])){members[_0xec7127]=_[_0x396c('0x20')](members[_0xec7127],{'data1':members[_0xec7127][_0x396c('0x23')]||_0x408ded['type'],'data2':members[_0xec7127][_0x396c('0x7')]||_0x408ded[_0x396c('0x24')],'data3':members[_0xec7127][_0x396c('0x25')]||_0x408ded[_0x396c('0x26')],'uniqueid':members[_0xec7127]['uniqueid']||_0x408ded[_0x396c('0x6')]});if(members[_0xec7127]['exitAt']){writeDB(members[_0xec7127]);}}}if(_0x408ded[_0x396c('0x27')]){var _0x2df00a=_0x408ded[_0x396c('0x27')][_0x396c('0x10')]('-')[0x0];if(!_['isNil'](members[_0x2df00a])){members[_0x2df00a]=_[_0x396c('0x20')](members[_0x2df00a],{'data1':members[_0x2df00a]['data1']||_0x408ded[_0x396c('0x8')],'data2':members[_0x2df00a][_0x396c('0x7')]||_0x408ded[_0x396c('0x24')],'data3':members[_0x2df00a][_0x396c('0x25')]||_0x408ded['destination'],'uniqueid':members[_0x2df00a][_0x396c('0x6')]||_0x408ded[_0x396c('0x6')]});if(members[_0x2df00a][_0x396c('0x1b')]){writeDB(members[_0x2df00a]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 0606d84..70592b6 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 _0x4e4a=['queueposition','queuecallerexit','EXITWITHKEY','holdtime','diffTime','queuecallerjoinAt','connectedlinenum','connectedlinename','agentconnect','assigned','accountcode','destaccountcode','membername','agentcomplete','reason','transfer','TRANSFER','blindtransfer','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','origtransfererlinkedid','secondtransfererlinkedid','transfertype','ATTENDED','origtransfererexten','origtransfereruniqueid','transfereelinkedid','queuecallerenterreason','calleridname','mohtime','transfertargetlinkedid','transfertargetuniqueid','clone','stack','musiconholdstart','musiconholdstop','musiconholdstartAt','lodash','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','queue','lastAssignedTo','calleridnum','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','position','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','varset','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexitAt'];(function(_0x5e8c8f,_0x66c561){var _0x272215=function(_0x3dc98c){while(--_0x3dc98c){_0x5e8c8f['push'](_0x5e8c8f['shift']());}};_0x272215(++_0x66c561);}(_0x4e4a,0x196));var _0xa4e4=function(_0x479383,_0xb6d18f){_0x479383=_0x479383-0x0;var _0x317fe4=_0x4e4a[_0x479383];return _0x317fe4;};'use strict';var _=require(_0xa4e4('0x0'));var util=require(_0xa4e4('0x1'));var utils=require(_0xa4e4('0x2'));var queues={};function writeDB(_0xe70a87){utils[_0xa4e4('0x3')](util[_0xa4e4('0x4')](_0xa4e4('0x5'),_0xe70a87[_0xa4e4('0x6')],_0xe70a87['channel'],_0xe70a87[_0xa4e4('0x7')],_0xe70a87[_0xa4e4('0x8')],_0xe70a87[_0xa4e4('0x9')],_0xe70a87['accountcode'],_0xe70a87['queuecallerexitreason']));if(_0xe70a87[_0xa4e4('0x7')]){utils['getVoiceQueueByName'](_0xe70a87[_0xa4e4('0x7')])[_0xa4e4('0xa')](function(_0x5d8b1e){if(_0x5d8b1e){_0xe70a87[_0xa4e4('0xb')]=_0x5d8b1e[_0xa4e4('0xb')];}utils[_0xa4e4('0xc')]('CreateVoiceQueueReport',_0xe70a87);});}else{utils[_0xa4e4('0xc')](_0xa4e4('0xd'),_0xe70a87);}if(_0xe70a87[_0xa4e4('0xe')]){delete queues[_0xe70a87[_0xa4e4('0xe')]];}else{delete queues[_0xe70a87['uniqueid']];}}exports[_0xa4e4('0xf')]=function(_0x990e0d){queues[_0x990e0d[_0xa4e4('0x6')]]=_['assign'](_0x990e0d,{'originalposition':_0x990e0d[_0xa4e4('0x10')],'queuecallerjoinAt':utils[_0xa4e4('0x11')](),'mohtime':0x0});};exports[_0xa4e4('0x12')]=function(_0x1d667c){if(!_[_0xa4e4('0x13')](queues[_0x1d667c[_0xa4e4('0x6')]])){if(queues[_0x1d667c[_0xa4e4('0x6')]][_0xa4e4('0x14')]){if(!queues[_0x1d667c[_0xa4e4('0x6')]][_0xa4e4('0x15')]&&!queues[_0x1d667c[_0xa4e4('0x6')]]['queuecallerexit']){queues[_0x1d667c[_0xa4e4('0x6')]][_0xa4e4('0x16')]=!![];queues[_0x1d667c[_0xa4e4('0x6')]][_0xa4e4('0x17')]=utils[_0xa4e4('0x11')]();queues[_0x1d667c[_0xa4e4('0x6')]][_0xa4e4('0x18')]='COMPLETEDBYAGENT';}writeDB(queues[_0x1d667c[_0xa4e4('0x6')]]);}else{if(queues[_0x1d667c['uniqueid']][_0xa4e4('0xe')]){queues[queues[_0x1d667c[_0xa4e4('0x6')]][_0xa4e4('0xe')]]=queues[_0x1d667c[_0xa4e4('0x6')]];queues[queues[_0x1d667c[_0xa4e4('0x6')]][_0xa4e4('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0x1d667c[_0xa4e4('0x6')]];}}}};exports[_0xa4e4('0x19')]=function(_0x41e212){if(!_[_0xa4e4('0x13')](_0x41e212[_0xa4e4('0x1a')][_0xa4e4('0x1b')])&&_0x41e212[_0xa4e4('0x1c')][_0xa4e4('0x1d')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x41e212['uniqueid']])){queues[_0x41e212[_0xa4e4('0x6')]]['queuecallerabandon']=![];queues[_0x41e212[_0xa4e4('0x6')]][_0xa4e4('0x1e')]=null;queues[_0x41e212[_0xa4e4('0x6')]]['queuecallerexit']=!![];queues[_0x41e212[_0xa4e4('0x6')]][_0xa4e4('0x1f')]=utils[_0xa4e4('0x11')]();queues[_0x41e212[_0xa4e4('0x6')]][_0xa4e4('0x18')]=_0x41e212[_0xa4e4('0x1c')][_0xa4e4('0x1d')]();writeDB(queues[_0x41e212['uniqueid']]);}}else if(!_[_0xa4e4('0x13')](_0x41e212[_0xa4e4('0x1a')][_0xa4e4('0x20')])){if(!_[_0xa4e4('0x13')](queues[_0x41e212[_0xa4e4('0x6')]])&&!queues[_0x41e212[_0xa4e4('0x6')]][_0xa4e4('0x15')]){queues[_0x41e212[_0xa4e4('0x6')]][_0xa4e4('0x15')]=![];queues[_0x41e212[_0xa4e4('0x6')]][_0xa4e4('0x1e')]=null;queues[_0x41e212[_0xa4e4('0x6')]][_0xa4e4('0x21')]=!![];queues[_0x41e212['uniqueid']][_0xa4e4('0x1f')]=utils[_0xa4e4('0x11')]();queues[_0x41e212['uniqueid']]['queuecallerexitreason']=_0xa4e4('0x22');}}};exports['queuecallerabandon']=function(_0x1817f6){if(!_[_0xa4e4('0x13')](queues[_0x1817f6['uniqueid']])){queues[_0x1817f6['uniqueid']]['queuecallerexit']=![];queues[_0x1817f6['uniqueid']][_0xa4e4('0x1f')]=null;queues[_0x1817f6[_0xa4e4('0x6')]][_0xa4e4('0x15')]=!![];queues[_0x1817f6[_0xa4e4('0x6')]][_0xa4e4('0x1e')]=utils[_0xa4e4('0x11')]();queues[_0x1817f6[_0xa4e4('0x6')]][_0xa4e4('0x18')]='ABANDONED';}};exports['queuecallerleave']=function(_0xbfc317){if(!_[_0xa4e4('0x13')](queues[_0xbfc317['uniqueid']])){queues[_0xbfc317['uniqueid']]['queuecallerleave']=!![];queues[_0xbfc317[_0xa4e4('0x6')]][_0xa4e4('0x14')]=utils[_0xa4e4('0x11')]();queues[_0xbfc317[_0xa4e4('0x6')]][_0xa4e4('0x23')]=utils[_0xa4e4('0x24')](queues[_0xbfc317['uniqueid']][_0xa4e4('0x14')],queues[_0xbfc317[_0xa4e4('0x6')]][_0xa4e4('0x25')]);queues[_0xbfc317['uniqueid']][_0xa4e4('0x10')]=_0xbfc317[_0xa4e4('0x10')];queues[_0xbfc317[_0xa4e4('0x6')]]['count']=_0xbfc317['count'];queues[_0xbfc317[_0xa4e4('0x6')]][_0xa4e4('0x26')]=_0xbfc317[_0xa4e4('0x26')];queues[_0xbfc317[_0xa4e4('0x6')]]['connectedlinename']=_0xbfc317[_0xa4e4('0x27')];}};exports[_0xa4e4('0x28')]=function(_0x55fe59){if(!_['isNil'](queues[_0x55fe59[_0xa4e4('0x6')]])){queues[_0x55fe59[_0xa4e4('0x6')]][_0xa4e4('0x15')]=![];queues[_0x55fe59[_0xa4e4('0x6')]][_0xa4e4('0x15')]=![];queues[_0x55fe59[_0xa4e4('0x6')]]['queuecallerabandonAt']=null;queues[_0x55fe59[_0xa4e4('0x6')]][_0xa4e4('0x21')]=![];queues[_0x55fe59['uniqueid']]['queuecallerexitreason']=null;queues[_0x55fe59[_0xa4e4('0x6')]]['queuecallerexitAt']=null;queues[_0x55fe59['uniqueid']][_0xa4e4('0x29')]=!![];queues[_0x55fe59[_0xa4e4('0x6')]][_0xa4e4('0x2a')]=_0x55fe59[_0xa4e4('0x2b')];queues[_0x55fe59[_0xa4e4('0x6')]][_0xa4e4('0x8')]=_0x55fe59[_0xa4e4('0x2c')];}};exports[_0xa4e4('0x2d')]=function(_0x434371){if(!_[_0xa4e4('0x13')](queues[_0x434371[_0xa4e4('0x6')]])){if(queues[_0x434371['uniqueid']][_0xa4e4('0x14')]){queues[_0x434371[_0xa4e4('0x6')]][_0xa4e4('0x15')]=![];queues[_0x434371[_0xa4e4('0x6')]][_0xa4e4('0x15')]=![];queues[_0x434371[_0xa4e4('0x6')]]['queuecallerabandonAt']=null;queues[_0x434371[_0xa4e4('0x6')]]['queuecallerexit']=![];queues[_0x434371['uniqueid']][_0xa4e4('0x1f')]=null;queues[_0x434371[_0xa4e4('0x6')]][_0xa4e4('0x29')]=!![];queues[_0x434371[_0xa4e4('0x6')]]['lastAssignedTo']=_0x434371['membername'];queues[_0x434371[_0xa4e4('0x6')]][_0xa4e4('0x16')]=!![];queues[_0x434371[_0xa4e4('0x6')]]['queuecallercompleteAt']=utils[_0xa4e4('0x11')]();if(_0x434371[_0xa4e4('0x2e')]==_0xa4e4('0x2f')){if(!queues[_0x434371[_0xa4e4('0x6')]]['transfer']){queues[_0x434371['uniqueid']][_0xa4e4('0x18')]=_0xa4e4('0x30');}}else{queues[_0x434371['uniqueid']]['queuecallerexitreason']='COMPLETEDBY'+_0x434371[_0xa4e4('0x2e')]['toUpperCase']();}writeDB(queues[_0x434371[_0xa4e4('0x6')]]);}}};exports[_0xa4e4('0x31')]=function(_0xbd4b7e){if(!_[_0xa4e4('0x13')](queues[_0xbd4b7e['transfereeuniqueid']])){queues[_0xbd4b7e[_0xa4e4('0x32')]]['transfer']=!![];queues[_0xbd4b7e['transfereeuniqueid']]['transfertype']=_0xa4e4('0x33');queues[_0xbd4b7e[_0xa4e4('0x32')]][_0xa4e4('0x34')]=_0xbd4b7e[_0xa4e4('0x35')];queues[_0xbd4b7e[_0xa4e4('0x32')]][_0xa4e4('0x36')]=_0xbd4b7e[_0xa4e4('0x32')];queues[_0xbd4b7e['transfereeuniqueid']][_0xa4e4('0x18')]=_0xa4e4('0x37');}};exports['attendedtransfer']=function(_0x3e3cc8){try{if(_0x3e3cc8['origtransfereruniqueid']==_0x3e3cc8[_0xa4e4('0x38')]){if(!_[_0xa4e4('0x13')](queues[_0x3e3cc8[_0xa4e4('0x39')]])){queues[_0x3e3cc8[_0xa4e4('0x39')]][_0xa4e4('0x2f')]=!![];queues[_0x3e3cc8[_0xa4e4('0x39')]][_0xa4e4('0x3a')]=_0xa4e4('0x3b');queues[_0x3e3cc8[_0xa4e4('0x39')]][_0xa4e4('0x34')]=_0x3e3cc8[_0xa4e4('0x3c')];queues[_0x3e3cc8[_0xa4e4('0x39')]][_0xa4e4('0x36')]=_0x3e3cc8[_0xa4e4('0x3d')];queues[_0x3e3cc8['secondtransfererlinkedid']][_0xa4e4('0x18')]='ATTENDEDTRANSFER';}if(!_[_0xa4e4('0x13')](queues[_0x3e3cc8[_0xa4e4('0x38')]])){if(_0x3e3cc8[_0xa4e4('0x3e')]&&queues[_0x3e3cc8[_0xa4e4('0x3e')]]){queues[_0x3e3cc8[_0xa4e4('0x3e')]][_0xa4e4('0x3f')]=0x1;queues[_0x3e3cc8[_0xa4e4('0x32')]]=_['clone'](queues[_0x3e3cc8[_0xa4e4('0x3e')]]);queues[_0x3e3cc8[_0xa4e4('0x32')]]['transfereduniqueid']=_0x3e3cc8['transfertargetuniqueid'];queues[_0x3e3cc8[_0xa4e4('0x32')]][_0xa4e4('0x3f')]=0x2;queues[_0x3e3cc8[_0xa4e4('0x32')]][_0xa4e4('0x9')]=queues[_0x3e3cc8[_0xa4e4('0x39')]][_0xa4e4('0x9')];queues[_0x3e3cc8[_0xa4e4('0x32')]][_0xa4e4('0x40')]=queues[_0x3e3cc8[_0xa4e4('0x39')]][_0xa4e4('0x40')];queues[_0x3e3cc8[_0xa4e4('0x32')]][_0xa4e4('0x25')]=utils['now']();queues[_0x3e3cc8[_0xa4e4('0x32')]][_0xa4e4('0x14')]=utils['now']();queues[_0x3e3cc8['transfereeuniqueid']]['holdtime']=0x0;queues[_0x3e3cc8[_0xa4e4('0x32')]][_0xa4e4('0x41')]=0x0;}else{queues[_0x3e3cc8[_0xa4e4('0x38')]][_0xa4e4('0xe')]=_0x3e3cc8['secondtransfererlinkedid'];}}}else if(_0x3e3cc8['secondtransfereruniqueid']==_0x3e3cc8[_0xa4e4('0x39')]){if(!_[_0xa4e4('0x13')](queues[_0x3e3cc8[_0xa4e4('0x38')]])){queues[_0x3e3cc8['origtransfererlinkedid']][_0xa4e4('0x2f')]=!![];queues[_0x3e3cc8[_0xa4e4('0x38')]][_0xa4e4('0x3a')]='ATTENDED';queues[_0x3e3cc8[_0xa4e4('0x38')]][_0xa4e4('0x34')]=_0x3e3cc8['secondtransfererexten'];queues[_0x3e3cc8[_0xa4e4('0x38')]][_0xa4e4('0x36')]=_0x3e3cc8['secondtransfereruniqueid'];queues[_0x3e3cc8[_0xa4e4('0x38')]][_0xa4e4('0x18')]='ATTENDEDTRANSFER';}if(!_[_0xa4e4('0x13')](queues[_0x3e3cc8[_0xa4e4('0x39')]])){if(_0x3e3cc8[_0xa4e4('0x42')]&&queues[_0x3e3cc8[_0xa4e4('0x42')]]){queues[_0x3e3cc8[_0xa4e4('0x42')]][_0xa4e4('0x3f')]=0x1;queues[_0x3e3cc8[_0xa4e4('0x43')]]=_[_0xa4e4('0x44')](queues[_0x3e3cc8[_0xa4e4('0x42')]]);queues[_0x3e3cc8[_0xa4e4('0x43')]][_0xa4e4('0xe')]=_0x3e3cc8[_0xa4e4('0x43')];queues[_0x3e3cc8['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x3e3cc8[_0xa4e4('0x43')]]['calleridnum']=queues[_0x3e3cc8['origtransfererlinkedid']]['calleridnum'];queues[_0x3e3cc8['transfertargetuniqueid']][_0xa4e4('0x40')]=queues[_0x3e3cc8['origtransfererlinkedid']]['calleridname'];queues[_0x3e3cc8[_0xa4e4('0x43')]][_0xa4e4('0x25')]=utils[_0xa4e4('0x11')]();queues[_0x3e3cc8[_0xa4e4('0x43')]][_0xa4e4('0x14')]=utils[_0xa4e4('0x11')]();queues[_0x3e3cc8[_0xa4e4('0x43')]][_0xa4e4('0x23')]=0x0;queues[_0x3e3cc8['transfertargetuniqueid']][_0xa4e4('0x41')]=0x0;}else{queues[_0x3e3cc8[_0xa4e4('0x39')]][_0xa4e4('0xe')]=_0x3e3cc8[_0xa4e4('0x38')];}}}}catch(_0x5f5004){utils['error'](_0x5f5004[_0xa4e4('0x45')]);}};exports[_0xa4e4('0x46')]=function(_0x1892a7){if(!_[_0xa4e4('0x13')](queues[_0x1892a7['uniqueid']])){queues[_0x1892a7['uniqueid']]['musiconholdstartAt']=utils[_0xa4e4('0x11')]();}};exports[_0xa4e4('0x47')]=function(_0x3ca966){if(!_['isNil'](queues[_0x3ca966['uniqueid']])){if(!_[_0xa4e4('0x13')](queues[_0x3ca966[_0xa4e4('0x6')]][_0xa4e4('0x48')])){queues[_0x3ca966[_0xa4e4('0x6')]]['mohtime']+=utils[_0xa4e4('0x24')](utils[_0xa4e4('0x11')](),queues[_0x3ca966[_0xa4e4('0x6')]]['musiconholdstartAt']);delete queues[_0x3ca966[_0xa4e4('0x6')]][_0xa4e4('0x48')];}}}; \ No newline at end of file +var _0x7a7c=['queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','queuecallerenterreason','varset','variable','value','toUpperCase','CONTINUE','queuecallerexitAt','queueposition','queuecallerabandonAt','EXITWITHKEY','ABANDONED','queuecallerleave','diffTime','position','connectedlinenum','connectedlinename','assigned','destaccountcode','membername','agentcomplete','transfer','TRANSFER','COMPLETEDBY','reason','blindtransfer','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','origtransfereruniqueid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','transferexten','secondtransfererexten','secondtransfereruniqueid','transfertargetlinkedid','holdtime','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','lodash','./utils','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit'];(function(_0x544c84,_0x471b73){var _0xe7ce33=function(_0xa6da30){while(--_0xa6da30){_0x544c84['push'](_0x544c84['shift']());}};_0xe7ce33(++_0x471b73);}(_0x7a7c,0x1c8));var _0xc7a7=function(_0x5ca710,_0x45a4d1){_0x5ca710=_0x5ca710-0x0;var _0x4e7b31=_0x7a7c[_0x5ca710];return _0x4e7b31;};'use strict';var _=require(_0xc7a7('0x0'));var util=require('util');var utils=require(_0xc7a7('0x1'));var queues={};function writeDB(_0x2bd452){utils['info'](util[_0xc7a7('0x2')](_0xc7a7('0x3'),_0x2bd452[_0xc7a7('0x4')],_0x2bd452[_0xc7a7('0x5')],_0x2bd452['queue'],_0x2bd452[_0xc7a7('0x6')],_0x2bd452[_0xc7a7('0x7')],_0x2bd452[_0xc7a7('0x8')],_0x2bd452[_0xc7a7('0x9')]));if(_0x2bd452[_0xc7a7('0xa')]){utils[_0xc7a7('0xb')](_0x2bd452[_0xc7a7('0xa')])[_0xc7a7('0xc')](function(_0x30bfc9){if(_0x30bfc9){_0x2bd452[_0xc7a7('0xd')]=_0x30bfc9['type'];}utils[_0xc7a7('0xe')](_0xc7a7('0xf'),_0x2bd452);});}else{utils['request'](_0xc7a7('0xf'),_0x2bd452);}if(_0x2bd452['transfereduniqueid']){delete queues[_0x2bd452[_0xc7a7('0x10')]];}else{delete queues[_0x2bd452[_0xc7a7('0x4')]];}}exports[_0xc7a7('0x11')]=function(_0x342f1e){queues[_0x342f1e[_0xc7a7('0x4')]]=_['assign'](_0x342f1e,{'originalposition':_0x342f1e['position'],'queuecallerjoinAt':utils[_0xc7a7('0x12')](),'mohtime':0x0});};exports[_0xc7a7('0x13')]=function(_0x519e66){if(!_[_0xc7a7('0x14')](queues[_0x519e66[_0xc7a7('0x4')]])){if(queues[_0x519e66[_0xc7a7('0x4')]][_0xc7a7('0x15')]){if(!queues[_0x519e66[_0xc7a7('0x4')]][_0xc7a7('0x16')]&&!queues[_0x519e66['uniqueid']][_0xc7a7('0x17')]){queues[_0x519e66['uniqueid']][_0xc7a7('0x18')]=!![];queues[_0x519e66[_0xc7a7('0x4')]][_0xc7a7('0x19')]=utils[_0xc7a7('0x12')]();queues[_0x519e66[_0xc7a7('0x4')]][_0xc7a7('0x9')]=_0xc7a7('0x1a');}writeDB(queues[_0x519e66[_0xc7a7('0x4')]]);}else{if(queues[_0x519e66[_0xc7a7('0x4')]][_0xc7a7('0x10')]){queues[queues[_0x519e66[_0xc7a7('0x4')]]['transfereduniqueid']]=queues[_0x519e66[_0xc7a7('0x4')]];queues[queues[_0x519e66['uniqueid']][_0xc7a7('0x10')]][_0xc7a7('0x1b')]=0x2;delete queues[_0x519e66[_0xc7a7('0x4')]];}}}};exports[_0xc7a7('0x1c')]=function(_0x105a8a){if(!_[_0xc7a7('0x14')](_0x105a8a[_0xc7a7('0x1d')]['queuestatus'])&&_0x105a8a[_0xc7a7('0x1e')][_0xc7a7('0x1f')]()!==_0xc7a7('0x20')){if(!_[_0xc7a7('0x14')](queues[_0x105a8a[_0xc7a7('0x4')]])){queues[_0x105a8a[_0xc7a7('0x4')]]['queuecallerabandon']=![];queues[_0x105a8a[_0xc7a7('0x4')]]['queuecallerabandonAt']=null;queues[_0x105a8a[_0xc7a7('0x4')]][_0xc7a7('0x17')]=!![];queues[_0x105a8a['uniqueid']][_0xc7a7('0x21')]=utils[_0xc7a7('0x12')]();queues[_0x105a8a[_0xc7a7('0x4')]][_0xc7a7('0x9')]=_0x105a8a[_0xc7a7('0x1e')][_0xc7a7('0x1f')]();writeDB(queues[_0x105a8a[_0xc7a7('0x4')]]);}}else if(!_[_0xc7a7('0x14')](_0x105a8a[_0xc7a7('0x1d')][_0xc7a7('0x22')])){if(!_['isNil'](queues[_0x105a8a[_0xc7a7('0x4')]])&&!queues[_0x105a8a[_0xc7a7('0x4')]][_0xc7a7('0x16')]){queues[_0x105a8a['uniqueid']][_0xc7a7('0x16')]=![];queues[_0x105a8a['uniqueid']][_0xc7a7('0x23')]=null;queues[_0x105a8a['uniqueid']][_0xc7a7('0x17')]=!![];queues[_0x105a8a[_0xc7a7('0x4')]][_0xc7a7('0x21')]=utils[_0xc7a7('0x12')]();queues[_0x105a8a[_0xc7a7('0x4')]][_0xc7a7('0x9')]=_0xc7a7('0x24');}}};exports[_0xc7a7('0x16')]=function(_0x465890){if(!_[_0xc7a7('0x14')](queues[_0x465890[_0xc7a7('0x4')]])){queues[_0x465890['uniqueid']][_0xc7a7('0x17')]=![];queues[_0x465890['uniqueid']][_0xc7a7('0x21')]=null;queues[_0x465890[_0xc7a7('0x4')]][_0xc7a7('0x16')]=!![];queues[_0x465890[_0xc7a7('0x4')]][_0xc7a7('0x23')]=utils[_0xc7a7('0x12')]();queues[_0x465890[_0xc7a7('0x4')]][_0xc7a7('0x9')]=_0xc7a7('0x25');}};exports[_0xc7a7('0x26')]=function(_0x350efd){if(!_['isNil'](queues[_0x350efd[_0xc7a7('0x4')]])){queues[_0x350efd[_0xc7a7('0x4')]][_0xc7a7('0x26')]=!![];queues[_0x350efd['uniqueid']][_0xc7a7('0x15')]=utils[_0xc7a7('0x12')]();queues[_0x350efd[_0xc7a7('0x4')]]['holdtime']=utils[_0xc7a7('0x27')](queues[_0x350efd['uniqueid']]['queuecallerleaveAt'],queues[_0x350efd[_0xc7a7('0x4')]]['queuecallerjoinAt']);queues[_0x350efd['uniqueid']]['position']=_0x350efd[_0xc7a7('0x28')];queues[_0x350efd['uniqueid']]['count']=_0x350efd['count'];queues[_0x350efd[_0xc7a7('0x4')]]['connectedlinenum']=_0x350efd[_0xc7a7('0x29')];queues[_0x350efd['uniqueid']][_0xc7a7('0x2a')]=_0x350efd[_0xc7a7('0x2a')];}};exports['agentconnect']=function(_0x46e8ab){if(!_['isNil'](queues[_0x46e8ab[_0xc7a7('0x4')]])){queues[_0x46e8ab['uniqueid']][_0xc7a7('0x16')]=![];queues[_0x46e8ab[_0xc7a7('0x4')]]['queuecallerabandon']=![];queues[_0x46e8ab[_0xc7a7('0x4')]]['queuecallerabandonAt']=null;queues[_0x46e8ab[_0xc7a7('0x4')]][_0xc7a7('0x17')]=![];queues[_0x46e8ab[_0xc7a7('0x4')]]['queuecallerexitreason']=null;queues[_0x46e8ab[_0xc7a7('0x4')]][_0xc7a7('0x21')]=null;queues[_0x46e8ab['uniqueid']][_0xc7a7('0x2b')]=!![];queues[_0x46e8ab['uniqueid']][_0xc7a7('0x8')]=_0x46e8ab[_0xc7a7('0x2c')];queues[_0x46e8ab[_0xc7a7('0x4')]]['lastAssignedTo']=_0x46e8ab[_0xc7a7('0x2d')];}};exports[_0xc7a7('0x2e')]=function(_0x2e035e){if(!_[_0xc7a7('0x14')](queues[_0x2e035e[_0xc7a7('0x4')]])){if(queues[_0x2e035e['uniqueid']][_0xc7a7('0x15')]){queues[_0x2e035e[_0xc7a7('0x4')]][_0xc7a7('0x16')]=![];queues[_0x2e035e[_0xc7a7('0x4')]][_0xc7a7('0x16')]=![];queues[_0x2e035e['uniqueid']][_0xc7a7('0x23')]=null;queues[_0x2e035e[_0xc7a7('0x4')]][_0xc7a7('0x17')]=![];queues[_0x2e035e[_0xc7a7('0x4')]][_0xc7a7('0x21')]=null;queues[_0x2e035e[_0xc7a7('0x4')]][_0xc7a7('0x2b')]=!![];queues[_0x2e035e[_0xc7a7('0x4')]][_0xc7a7('0x6')]=_0x2e035e['membername'];queues[_0x2e035e['uniqueid']]['queuecallercomplete']=!![];queues[_0x2e035e[_0xc7a7('0x4')]][_0xc7a7('0x19')]=utils[_0xc7a7('0x12')]();if(_0x2e035e['reason']==_0xc7a7('0x2f')){if(!queues[_0x2e035e[_0xc7a7('0x4')]][_0xc7a7('0x2f')]){queues[_0x2e035e[_0xc7a7('0x4')]][_0xc7a7('0x9')]=_0xc7a7('0x30');}}else{queues[_0x2e035e[_0xc7a7('0x4')]]['queuecallerexitreason']=_0xc7a7('0x31')+_0x2e035e[_0xc7a7('0x32')][_0xc7a7('0x1f')]();}writeDB(queues[_0x2e035e['uniqueid']]);}}};exports[_0xc7a7('0x33')]=function(_0x3497dd){if(!_[_0xc7a7('0x14')](queues[_0x3497dd[_0xc7a7('0x34')]])){queues[_0x3497dd[_0xc7a7('0x34')]]['transfer']=!![];queues[_0x3497dd['transfereeuniqueid']][_0xc7a7('0x35')]=_0xc7a7('0x36');queues[_0x3497dd['transfereeuniqueid']]['transferexten']=_0x3497dd[_0xc7a7('0x37')];queues[_0x3497dd[_0xc7a7('0x34')]][_0xc7a7('0x38')]=_0x3497dd['transfereeuniqueid'];queues[_0x3497dd[_0xc7a7('0x34')]][_0xc7a7('0x9')]=_0xc7a7('0x39');}};exports['attendedtransfer']=function(_0x55601f){try{if(_0x55601f[_0xc7a7('0x3a')]==_0x55601f['origtransfererlinkedid']){if(!_[_0xc7a7('0x14')](queues[_0x55601f['secondtransfererlinkedid']])){queues[_0x55601f[_0xc7a7('0x3b')]][_0xc7a7('0x2f')]=!![];queues[_0x55601f[_0xc7a7('0x3b')]][_0xc7a7('0x35')]=_0xc7a7('0x3c');queues[_0x55601f[_0xc7a7('0x3b')]]['transferexten']=_0x55601f[_0xc7a7('0x3d')];queues[_0x55601f[_0xc7a7('0x3b')]][_0xc7a7('0x38')]=_0x55601f[_0xc7a7('0x3a')];queues[_0x55601f[_0xc7a7('0x3b')]][_0xc7a7('0x9')]=_0xc7a7('0x3e');}if(!_[_0xc7a7('0x14')](queues[_0x55601f[_0xc7a7('0x3f')]])){if(_0x55601f['transfereelinkedid']&&queues[_0x55601f[_0xc7a7('0x40')]]){queues[_0x55601f['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x55601f[_0xc7a7('0x34')]]=_[_0xc7a7('0x41')](queues[_0x55601f['transfereelinkedid']]);queues[_0x55601f[_0xc7a7('0x34')]][_0xc7a7('0x10')]=_0x55601f[_0xc7a7('0x42')];queues[_0x55601f[_0xc7a7('0x34')]]['queuecallerenterreason']=0x2;queues[_0x55601f[_0xc7a7('0x34')]][_0xc7a7('0x7')]=queues[_0x55601f['secondtransfererlinkedid']][_0xc7a7('0x7')];queues[_0x55601f['transfereeuniqueid']][_0xc7a7('0x43')]=queues[_0x55601f[_0xc7a7('0x3b')]][_0xc7a7('0x43')];queues[_0x55601f[_0xc7a7('0x34')]][_0xc7a7('0x44')]=utils[_0xc7a7('0x12')]();queues[_0x55601f[_0xc7a7('0x34')]][_0xc7a7('0x15')]=utils[_0xc7a7('0x12')]();queues[_0x55601f[_0xc7a7('0x34')]]['holdtime']=0x0;queues[_0x55601f[_0xc7a7('0x34')]]['mohtime']=0x0;}else{queues[_0x55601f[_0xc7a7('0x3f')]][_0xc7a7('0x10')]=_0x55601f[_0xc7a7('0x3b')];}}}else if(_0x55601f['secondtransfereruniqueid']==_0x55601f['secondtransfererlinkedid']){if(!_[_0xc7a7('0x14')](queues[_0x55601f['origtransfererlinkedid']])){queues[_0x55601f['origtransfererlinkedid']][_0xc7a7('0x2f')]=!![];queues[_0x55601f[_0xc7a7('0x3f')]][_0xc7a7('0x35')]=_0xc7a7('0x3c');queues[_0x55601f[_0xc7a7('0x3f')]][_0xc7a7('0x45')]=_0x55601f[_0xc7a7('0x46')];queues[_0x55601f[_0xc7a7('0x3f')]][_0xc7a7('0x38')]=_0x55601f[_0xc7a7('0x47')];queues[_0x55601f[_0xc7a7('0x3f')]][_0xc7a7('0x9')]=_0xc7a7('0x3e');}if(!_[_0xc7a7('0x14')](queues[_0x55601f[_0xc7a7('0x3b')]])){if(_0x55601f[_0xc7a7('0x48')]&&queues[_0x55601f[_0xc7a7('0x48')]]){queues[_0x55601f[_0xc7a7('0x48')]]['queuecallerenterreason']=0x1;queues[_0x55601f['transfertargetuniqueid']]=_[_0xc7a7('0x41')](queues[_0x55601f[_0xc7a7('0x48')]]);queues[_0x55601f[_0xc7a7('0x42')]]['transfereduniqueid']=_0x55601f['transfertargetuniqueid'];queues[_0x55601f['transfertargetuniqueid']][_0xc7a7('0x1b')]=0x2;queues[_0x55601f[_0xc7a7('0x42')]][_0xc7a7('0x7')]=queues[_0x55601f['origtransfererlinkedid']][_0xc7a7('0x7')];queues[_0x55601f[_0xc7a7('0x42')]]['calleridname']=queues[_0x55601f[_0xc7a7('0x3f')]]['calleridname'];queues[_0x55601f[_0xc7a7('0x42')]][_0xc7a7('0x44')]=utils['now']();queues[_0x55601f[_0xc7a7('0x42')]][_0xc7a7('0x15')]=utils[_0xc7a7('0x12')]();queues[_0x55601f['transfertargetuniqueid']][_0xc7a7('0x49')]=0x0;queues[_0x55601f[_0xc7a7('0x42')]]['mohtime']=0x0;}else{queues[_0x55601f[_0xc7a7('0x3b')]][_0xc7a7('0x10')]=_0x55601f['origtransfererlinkedid'];}}}}catch(_0xc8b01e){utils[_0xc7a7('0x4a')](_0xc8b01e[_0xc7a7('0x4b')]);}};exports[_0xc7a7('0x4c')]=function(_0x250f9c){if(!_['isNil'](queues[_0x250f9c['uniqueid']])){queues[_0x250f9c[_0xc7a7('0x4')]][_0xc7a7('0x4d')]=utils['now']();}};exports[_0xc7a7('0x4e')]=function(_0x4a9154){if(!_[_0xc7a7('0x14')](queues[_0x4a9154[_0xc7a7('0x4')]])){if(!_[_0xc7a7('0x14')](queues[_0x4a9154['uniqueid']][_0xc7a7('0x4d')])){queues[_0x4a9154[_0xc7a7('0x4')]][_0xc7a7('0x4f')]+=utils['diffTime'](utils[_0xc7a7('0x12')](),queues[_0x4a9154[_0xc7a7('0x4')]]['musiconholdstartAt']);delete queues[_0x4a9154[_0xc7a7('0x4')]]['musiconholdstartAt'];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index b7528b9..763c3f7 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['membername','name','UserId','CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','stack','newstate','isNil','channelstate','transfer','variable','mixmonitor_filename','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','debug','getUserByInternal','accountcode','then'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x34e8,0x12c));var _0x834e=function(_0x3d4cac,_0x3b8bd5){_0x3d4cac=_0x3d4cac-0x0;var _0x2eef94=_0x34e8[_0x3d4cac];return _0x2eef94;};'use strict';var _=require(_0x834e('0x0'));var utils=require(_0x834e('0x1'));var recordings={};function writeDB(_0x8b339){utils[_0x834e('0x2')](_0x8b339);if(_0x8b339['accountcode']){utils[_0x834e('0x3')](_0x8b339[_0x834e('0x4')])[_0x834e('0x5')](function(_0x31bf20){if(_0x31bf20){_0x8b339[_0x834e('0x6')]=_0x31bf20[_0x834e('0x7')];_0x8b339[_0x834e('0x8')]=_0x31bf20['id'];}utils['request'](_0x834e('0x9'),_0x8b339);});}else{utils['request'](_0x834e('0x9'),_0x8b339);}}exports[_0x834e('0xa')]=function(_0x3a3ef6){try{if(_0x3a3ef6[_0x834e('0xb')]==_0x3a3ef6[_0x834e('0xc')]){recordings[_0x3a3ef6[_0x834e('0xb')]]={'uniqueid':_0x3a3ef6[_0x834e('0xb')],'accountcode':_0x3a3ef6[_0x834e('0x4')],'exten':_0x3a3ef6[_0x834e('0xd')],'context':_0x3a3ef6[_0x834e('0xe')],'channel':_0x3a3ef6[_0x834e('0xf')],'monitors':[]};}}catch(_0x36e124){utils[_0x834e('0x10')](_0x36e124[_0x834e('0x11')]);}};exports[_0x834e('0x12')]=function(_0x1e00de){try{if(!_[_0x834e('0x13')](recordings[_0x1e00de['uniqueid']])&&_0x1e00de[_0x834e('0x14')]==0x6){}else if(!_[_0x834e('0x13')](recordings[_0x1e00de['linkedid']])&&_0x1e00de[_0x834e('0x14')]==0x6&&_0x1e00de[_0x834e('0xe')]!=_0x834e('0x15')){recordings[_0x1e00de[_0x834e('0xc')]]['accountcode']=_0x1e00de[_0x834e('0x4')];}}catch(_0x302cbd){utils['error'](_0x302cbd[_0x834e('0x11')]);}};exports['varset']=function(_0x38a8cd){try{if(!_[_0x834e('0x13')](_0x38a8cd['variable'])&&!_[_0x834e('0x13')](_0x38a8cd[_0x834e('0x16')][_0x834e('0x17')])){if(_['endsWith'](_0x38a8cd[_0x834e('0x18')],_0x834e('0x19'))){_0x38a8cd[_0x834e('0x18')]=_0x38a8cd[_0x834e('0x18')][_0x834e('0x1a')](_0x834e('0x19'),_0x834e('0x1b'));}if(recordings[_0x38a8cd['linkedid']]){var _0x2545b4=_[_0x834e('0x1c')](recordings[_0x38a8cd[_0x834e('0xc')]][_0x834e('0x1d')],{'value':_0x38a8cd['value']});if(_[_0x834e('0x13')](_0x2545b4)){recordings[_0x38a8cd[_0x834e('0xc')]]['monitors'][_0x834e('0x1e')]({'value':_0x38a8cd[_0x834e('0x18')]});}}}}catch(_0x8d406e){utils['error'](_0x8d406e['stack']);}};exports[_0x834e('0x1f')]=function(_0x34563b){try{if(!_['isNil'](recordings[_0x34563b[_0x834e('0xb')]])){recordings[_0x34563b[_0x834e('0xb')]]['calleridnum']=_0x34563b[_0x834e('0x20')];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x21')]=_0x34563b['calleridname'];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x22')]=_0x34563b['connectedlinenum'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]=_0x34563b['connectedlinename'];if(recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x24')]==_0x834e('0x25')&&recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x4')]){recordings[_0x34563b[_0x834e('0xb')]]['connectedlinenum']=recordings[_0x34563b['uniqueid']]['accountcode'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]='';}recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x1d')]['forEach'](_0xb5bc06=>{var _0x11f1ce=_[_0x834e('0x26')](recordings[_0x34563b[_0x834e('0xb')]]);_0x11f1ce[_0x834e('0x18')]=_0xb5bc06[_0x834e('0x18')];writeDB(_0x11f1ce);});delete recordings[_0x34563b[_0x834e('0xb')]];}}catch(_0xfaf716){utils[_0x834e('0x10')](_0xfaf716['stack']);}};exports[_0x834e('0x27')]=function(_0x5cad11){try{if(!_[_0x834e('0x13')](recordings[_0x5cad11[_0x834e('0xb')]])){if(_0x5cad11[_0x834e('0x28')][_0x834e('0x29')]()==_0x834e('0x2a')&&_[_0x834e('0x2b')](_0x5cad11[_0x834e('0x2c')][_0x834e('0x29')](),_0x834e('0x2d'))){var _0x12b2bc=_0x5cad11['appdata'][_0x834e('0x2e')]('=');var _0x2f408a=_0x12b2bc[0x0][_0x834e('0x2f')](_0x12b2bc[0x0][_0x834e('0x30')]('(')+0x1,_0x12b2bc[0x0]['lastIndexOf'](')'));var _0x3f88ad=_0x12b2bc[0x1];recordings[_0x5cad11[_0x834e('0xb')]][_0x2f408a]=_0x3f88ad;}}}catch(_0x4b12f5){utils['error'](_0x4b12f5['stack']);}};exports[_0x834e('0x31')]=function(_0x41bf4d){try{if(!_[_0x834e('0x13')](recordings[_0x41bf4d[_0x834e('0xb')]])){recordings[_0x41bf4d[_0x834e('0xb')]][_0x834e('0x32')]=_0x41bf4d['queue'];}}catch(_0x2c2d94){utils['error'](_0x2c2d94[_0x834e('0x11')]);}}; \ No newline at end of file +var _0x34e8=['membername','name','UserId','CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','stack','newstate','isNil','channelstate','transfer','variable','mixmonitor_filename','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','debug','getUserByInternal','accountcode','then'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x34e8,0x12c));var _0x834e=function(_0x3f0ddb,_0x234f07){_0x3f0ddb=_0x3f0ddb-0x0;var _0x1abd9a=_0x34e8[_0x3f0ddb];return _0x1abd9a;};'use strict';var _=require(_0x834e('0x0'));var utils=require(_0x834e('0x1'));var recordings={};function writeDB(_0x8b339){utils[_0x834e('0x2')](_0x8b339);if(_0x8b339['accountcode']){utils[_0x834e('0x3')](_0x8b339[_0x834e('0x4')])[_0x834e('0x5')](function(_0x31bf20){if(_0x31bf20){_0x8b339[_0x834e('0x6')]=_0x31bf20[_0x834e('0x7')];_0x8b339[_0x834e('0x8')]=_0x31bf20['id'];}utils['request'](_0x834e('0x9'),_0x8b339);});}else{utils['request'](_0x834e('0x9'),_0x8b339);}}exports[_0x834e('0xa')]=function(_0x3a3ef6){try{if(_0x3a3ef6[_0x834e('0xb')]==_0x3a3ef6[_0x834e('0xc')]){recordings[_0x3a3ef6[_0x834e('0xb')]]={'uniqueid':_0x3a3ef6[_0x834e('0xb')],'accountcode':_0x3a3ef6[_0x834e('0x4')],'exten':_0x3a3ef6[_0x834e('0xd')],'context':_0x3a3ef6[_0x834e('0xe')],'channel':_0x3a3ef6[_0x834e('0xf')],'monitors':[]};}}catch(_0x36e124){utils[_0x834e('0x10')](_0x36e124[_0x834e('0x11')]);}};exports[_0x834e('0x12')]=function(_0x1e00de){try{if(!_[_0x834e('0x13')](recordings[_0x1e00de['uniqueid']])&&_0x1e00de[_0x834e('0x14')]==0x6){}else if(!_[_0x834e('0x13')](recordings[_0x1e00de['linkedid']])&&_0x1e00de[_0x834e('0x14')]==0x6&&_0x1e00de[_0x834e('0xe')]!=_0x834e('0x15')){recordings[_0x1e00de[_0x834e('0xc')]]['accountcode']=_0x1e00de[_0x834e('0x4')];}}catch(_0x302cbd){utils['error'](_0x302cbd[_0x834e('0x11')]);}};exports['varset']=function(_0x38a8cd){try{if(!_[_0x834e('0x13')](_0x38a8cd['variable'])&&!_[_0x834e('0x13')](_0x38a8cd[_0x834e('0x16')][_0x834e('0x17')])){if(_['endsWith'](_0x38a8cd[_0x834e('0x18')],_0x834e('0x19'))){_0x38a8cd[_0x834e('0x18')]=_0x38a8cd[_0x834e('0x18')][_0x834e('0x1a')](_0x834e('0x19'),_0x834e('0x1b'));}if(recordings[_0x38a8cd['linkedid']]){var _0x2545b4=_[_0x834e('0x1c')](recordings[_0x38a8cd[_0x834e('0xc')]][_0x834e('0x1d')],{'value':_0x38a8cd['value']});if(_[_0x834e('0x13')](_0x2545b4)){recordings[_0x38a8cd[_0x834e('0xc')]]['monitors'][_0x834e('0x1e')]({'value':_0x38a8cd[_0x834e('0x18')]});}}}}catch(_0x8d406e){utils['error'](_0x8d406e['stack']);}};exports[_0x834e('0x1f')]=function(_0x34563b){try{if(!_['isNil'](recordings[_0x34563b[_0x834e('0xb')]])){recordings[_0x34563b[_0x834e('0xb')]]['calleridnum']=_0x34563b[_0x834e('0x20')];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x21')]=_0x34563b['calleridname'];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x22')]=_0x34563b['connectedlinenum'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]=_0x34563b['connectedlinename'];if(recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x24')]==_0x834e('0x25')&&recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x4')]){recordings[_0x34563b[_0x834e('0xb')]]['connectedlinenum']=recordings[_0x34563b['uniqueid']]['accountcode'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]='';}recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x1d')]['forEach'](_0xb5bc06=>{var _0x11f1ce=_[_0x834e('0x26')](recordings[_0x34563b[_0x834e('0xb')]]);_0x11f1ce[_0x834e('0x18')]=_0xb5bc06[_0x834e('0x18')];writeDB(_0x11f1ce);});delete recordings[_0x34563b[_0x834e('0xb')]];}}catch(_0xfaf716){utils[_0x834e('0x10')](_0xfaf716['stack']);}};exports[_0x834e('0x27')]=function(_0x5cad11){try{if(!_[_0x834e('0x13')](recordings[_0x5cad11[_0x834e('0xb')]])){if(_0x5cad11[_0x834e('0x28')][_0x834e('0x29')]()==_0x834e('0x2a')&&_[_0x834e('0x2b')](_0x5cad11[_0x834e('0x2c')][_0x834e('0x29')](),_0x834e('0x2d'))){var _0x12b2bc=_0x5cad11['appdata'][_0x834e('0x2e')]('=');var _0x2f408a=_0x12b2bc[0x0][_0x834e('0x2f')](_0x12b2bc[0x0][_0x834e('0x30')]('(')+0x1,_0x12b2bc[0x0]['lastIndexOf'](')'));var _0x3f88ad=_0x12b2bc[0x1];recordings[_0x5cad11[_0x834e('0xb')]][_0x2f408a]=_0x3f88ad;}}}catch(_0x4b12f5){utils['error'](_0x4b12f5['stack']);}};exports[_0x834e('0x31')]=function(_0x41bf4d){try{if(!_[_0x834e('0x13')](recordings[_0x41bf4d[_0x834e('0xb')]])){recordings[_0x41bf4d[_0x834e('0xb')]][_0x834e('0x32')]=_0x41bf4d['queue'];}}catch(_0x2c2d94){utils['error'](_0x2c2d94[_0x834e('0x11')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index fc96298..50b4e26 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 _0xf15e=['TRANSFER|%s','type','CreateVoiceTransferReport','blindtransfer','error','stack','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','./utils','info','format'];(function(_0x43f5d3,_0x476e93){var _0xfc69ff=function(_0x42bb11){while(--_0x42bb11){_0x43f5d3['push'](_0x43f5d3['shift']());}};_0xfc69ff(++_0x476e93);}(_0xf15e,0xb9));var _0xef15=function(_0x472880,_0x211f91){_0x472880=_0x472880-0x0;var _0x4b5af6=_0xf15e[_0x472880];return _0x4b5af6;};'use strict';var _=require(_0xef15('0x0'));var util=require('util');var utils=require(_0xef15('0x1'));function writeDB(_0x43f9b0){utils[_0xef15('0x2')](util[_0xef15('0x3')](_0xef15('0x4'),_0x43f9b0[_0xef15('0x5')]));utils['request'](_0xef15('0x6'),_0x43f9b0);}exports[_0xef15('0x7')]=function(_0x258cb7){try{_0x258cb7[_0xef15('0x5')]='blind';writeDB(_0x258cb7);}catch(_0x2ad584){utils[_0xef15('0x8')](_0x2ad584[_0xef15('0x9')]);}};exports['attendedtransfer']=function(_0x37385f){try{_0x37385f=_[_0xef15('0xa')](_0x37385f,{'transfererchannel':_0x37385f[_0xef15('0xb')],'transferercalleridnum':_0x37385f[_0xef15('0xc')],'transferercalleridname':_0x37385f['origtransferercalleridname'],'transfererconnectedlinenum':_0x37385f[_0xef15('0xd')],'transfererconnectedlinename':_0x37385f[_0xef15('0xe')],'transfereraccountcode':_0x37385f[_0xef15('0xf')],'transferercontext':_0x37385f['secondtransferercontext'],'transfererexten':_0x37385f[_0xef15('0x10')],'transfererlinkedid':_0x37385f[_0xef15('0x11')],'context':_0x37385f[_0xef15('0x12')],'extension':_0x37385f[_0xef15('0x13')],'type':_0xef15('0x14')});if(_['isNil'](_0x37385f['transfereechannel'])){_0x37385f=_[_0xef15('0xa')](_0x37385f,{'transfereechannel':_0x37385f[_0xef15('0x15')],'transfereecalleridnum':_0x37385f[_0xef15('0x16')],'transfereecalleridname':_0x37385f['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x37385f[_0xef15('0x17')],'transfereeconnectedlinename':_0x37385f['transfertargetconnectedlinename'],'transfereeaccountcode':_0x37385f[_0xef15('0x18')],'transfereecontext':_0x37385f[_0xef15('0x19')],'transfereeexten':_0x37385f[_0xef15('0x1a')],'transfereelinkedid':_0x37385f['transfertargetlinkedid']});}writeDB(_0x37385f);}catch(_0xc8d2b2){utils['error'](_0xc8d2b2['stack']);}}; \ No newline at end of file +var _0x8ebc=['attendedtransfer','assign','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','./utils','format','TRANSFER|%s','type','request','blindtransfer','blind','error','stack'];(function(_0x7d708a,_0x45bc53){var _0x133fff=function(_0x296009){while(--_0x296009){_0x7d708a['push'](_0x7d708a['shift']());}};_0x133fff(++_0x45bc53);}(_0x8ebc,0x18c));var _0xc8eb=function(_0xae1364,_0x44863f){_0xae1364=_0xae1364-0x0;var _0x55104f=_0x8ebc[_0xae1364];return _0x55104f;};'use strict';var _=require(_0xc8eb('0x0'));var util=require('util');var utils=require(_0xc8eb('0x1'));function writeDB(_0x13ca7b){utils['info'](util[_0xc8eb('0x2')](_0xc8eb('0x3'),_0x13ca7b[_0xc8eb('0x4')]));utils[_0xc8eb('0x5')]('CreateVoiceTransferReport',_0x13ca7b);}exports[_0xc8eb('0x6')]=function(_0x4aeca2){try{_0x4aeca2[_0xc8eb('0x4')]=_0xc8eb('0x7');writeDB(_0x4aeca2);}catch(_0x5c42ad){utils[_0xc8eb('0x8')](_0x5c42ad[_0xc8eb('0x9')]);}};exports[_0xc8eb('0xa')]=function(_0x395ee4){try{_0x395ee4=_[_0xc8eb('0xb')](_0x395ee4,{'transfererchannel':_0x395ee4['origtransfererchannel'],'transferercalleridnum':_0x395ee4[_0xc8eb('0xc')],'transferercalleridname':_0x395ee4[_0xc8eb('0xd')],'transfererconnectedlinenum':_0x395ee4[_0xc8eb('0xe')],'transfererconnectedlinename':_0x395ee4[_0xc8eb('0xf')],'transfereraccountcode':_0x395ee4[_0xc8eb('0x10')],'transferercontext':_0x395ee4['secondtransferercontext'],'transfererexten':_0x395ee4[_0xc8eb('0x11')],'transfererlinkedid':_0x395ee4['origtransfererlinkedid'],'context':_0x395ee4[_0xc8eb('0x12')],'extension':_0x395ee4['origtransfererexten'],'type':_0xc8eb('0x13')});if(_[_0xc8eb('0x14')](_0x395ee4[_0xc8eb('0x15')])){_0x395ee4=_[_0xc8eb('0xb')](_0x395ee4,{'transfereechannel':_0x395ee4[_0xc8eb('0x16')],'transfereecalleridnum':_0x395ee4[_0xc8eb('0x17')],'transfereecalleridname':_0x395ee4[_0xc8eb('0x18')],'transfereeconnectedlinenum':_0x395ee4[_0xc8eb('0x19')],'transfereeconnectedlinename':_0x395ee4['transfertargetconnectedlinename'],'transfereeaccountcode':_0x395ee4['transfertargetaccountcode'],'transfereecontext':_0x395ee4[_0xc8eb('0x1a')],'transfereeexten':_0x395ee4[_0xc8eb('0x1b')],'transfereelinkedid':_0x395ee4[_0xc8eb('0x1c')]});}writeDB(_0x395ee4);}catch(_0x82c9ac){utils[_0xc8eb('0x8')](_0x82c9ac['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 4b94dd6..861ab74 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 _0xeff5=['jayson/promise','moment','bluebird','client','http','../../config/logger','xdr','info','debug','stringify','error','request','then','catch','GetUser','internal','name','result','FOUND','length','getUserByInternal','stack','getVoiceQueueByName','type','acw','GETVOICEQUEUEBYNAME|','addTime','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','format','diffTime','diff','sumTime','now','isBefore'];(function(_0x344df6,_0x20ec8b){var _0x56eca3=function(_0x6fb263){while(--_0x6fb263){_0x344df6['push'](_0x344df6['shift']());}};_0x56eca3(++_0x20ec8b);}(_0xeff5,0x1e1));var _0x5eff=function(_0x5076b7,_0x46e055){_0x5076b7=_0x5076b7-0x0;var _0x575bc9=_0xeff5[_0x5076b7];return _0x575bc9;};'use strict';var jayson=require(_0x5eff('0x0'));var moment=require(_0x5eff('0x1'));var BPromise=require(_0x5eff('0x2'));var client=jayson[_0x5eff('0x3')][_0x5eff('0x4')]({'port':0x2329});var logger=require(_0x5eff('0x5'))(_0x5eff('0x6'));exports[_0x5eff('0x7')]=function(_0xf91284){logger[_0x5eff('0x7')](_0xf91284);};exports['debug']=function(_0x4e6f66){logger[_0x5eff('0x8')](JSON[_0x5eff('0x9')](_0x4e6f66));};exports[_0x5eff('0xa')]=function(_0x32915a){logger['error'](_0x32915a['stack']);};exports[_0x5eff('0xb')]=function(_0x4879a7,_0x10ea3d){return client[_0x5eff('0xb')](_0x4879a7,{'body':_0x10ea3d})[_0x5eff('0xc')](function(_0x143c5a){logger[_0x5eff('0x8')](JSON['stringify'](_0x143c5a));})[_0x5eff('0xd')](function(_0x26a3c4){logger[_0x5eff('0xa')](_0x26a3c4['stack']);});};function getUser(_0x47fb86){return client['request'](_0x5eff('0xe'),{'options':{'raw':!![],'attributes':['id',_0x5eff('0xf'),_0x5eff('0x10'),'interface'],'where':_0x47fb86,'limit':0x1}})[_0x5eff('0xc')](function(_0x604647){logger[_0x5eff('0x7')]('GETUSER|'+JSON[_0x5eff('0x9')](_0x47fb86)+'|'+(_0x604647[_0x5eff('0x11')]['length']?_0x5eff('0x12'):'NOTFOUND'));return _0x604647[_0x5eff('0x11')][_0x5eff('0x13')]?_0x604647['result'][0x0]:null;});}exports[_0x5eff('0x14')]=function(_0x3562dd){return new BPromise(function(_0x479b51,_0x45c416){if(_0x3562dd){return getUser({'internal':_0x3562dd})[_0x5eff('0xc')](function(_0x3cbde1){return _0x479b51(_0x3cbde1);})['catch'](function(_0x10f675){logger[_0x5eff('0xa')](_0x10f675['stack']);return _0x479b51(null);});}else{return _0x479b51(null);}});};exports['getUserByInterface']=function(_0x39c570){return new BPromise(function(_0x33dcf3,_0x1ce496){if(_0x39c570){return getUser({'interface':_0x39c570})['then'](function(_0xd1b1ab){return _0x33dcf3(_0xd1b1ab);})[_0x5eff('0xd')](function(_0x23ab7a){logger[_0x5eff('0xa')](_0x23ab7a[_0x5eff('0x15')]);return _0x33dcf3(null);});}else{return _0x33dcf3(null);}});};exports['getUserByName']=function(_0x5df100){return new BPromise(function(_0x41d502,_0x2f0032){if(_0x5df100){return getUser({'name':_0x5df100})[_0x5eff('0xc')](function(_0x94312a){return _0x41d502(_0x94312a);})[_0x5eff('0xd')](function(_0xe5a620){logger[_0x5eff('0xa')](_0xe5a620[_0x5eff('0x15')]);return _0x41d502(null);});}else{return _0x41d502(null);}});};exports[_0x5eff('0x16')]=function(_0x454306){return new BPromise(function(_0x499594,_0x3527f9){if(_0x454306){return client[_0x5eff('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x5eff('0x10'),_0x5eff('0x17'),_0x5eff('0x18'),'acwTimeout'],'where':{'name':_0x454306},'limit':0x1}})['then'](function(_0x50c37b){logger['info'](_0x5eff('0x19')+_0x454306+'|'+(_0x50c37b['result'][_0x5eff('0x13')]?_0x5eff('0x12'):'NOTFOUND'));return _0x499594(_0x50c37b[_0x5eff('0x11')][_0x5eff('0x13')]?_0x50c37b[_0x5eff('0x11')][0x0]:null);})[_0x5eff('0xd')](function(_0x274f1c){logger[_0x5eff('0xa')](_0x274f1c[_0x5eff('0x15')]);return _0x499594(null);});}else{return _0x499594(null);}});};exports[_0x5eff('0x1a')]=function(_0x332b64,_0x1417bc){return moment(_0x332b64)['add'](_0x1417bc,'seconds')['format'](_0x5eff('0x1b'));};exports[_0x5eff('0x1c')]=function(_0x2aafb3,_0x18ff3f){return moment(_0x2aafb3)[_0x5eff('0x1d')](_0x18ff3f,_0x5eff('0x1e'))[_0x5eff('0x1f')](_0x5eff('0x1b'));};exports[_0x5eff('0x20')]=function(_0x7ad7bb,_0xda9d05){return moment(_0x7ad7bb)[_0x5eff('0x21')](moment(_0xda9d05),_0x5eff('0x1e'));};exports[_0x5eff('0x22')]=function(_0x135bb5,_0x87b4ba){return parseInt(_0x135bb5,0xa)+parseInt(_0x87b4ba,0xa);};exports[_0x5eff('0x23')]=function(){return moment()[_0x5eff('0x1f')](_0x5eff('0x1b'));};exports['isAfter']=function(_0x258b9b,_0x14acc2){if(_0x14acc2){return moment(_0x258b9b)['isAfter'](_0x14acc2);}else{return!![];}};exports['isBefore']=function(_0x3a8c93,_0x1bc82f){if(_0x1bc82f){return moment(_0x3a8c93)[_0x5eff('0x24')](_0x1bc82f);}else if(_0x3a8c93){return!![];}else{return![];}}; \ No newline at end of file +var _0x09f3=['FOUND','NOTFOUND','length','getUserByInternal','catch','stack','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','acwTimeout','GETVOICEQUEUEBYNAME|','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','format','diff','isAfter','isBefore','moment','bluebird','client','http','../../config/logger','xdr','info','debug','stringify','error','request','then','internal','interface','GETUSER|','result'];(function(_0x528fd9,_0x4de3c4){var _0x59b2aa=function(_0x958bda){while(--_0x958bda){_0x528fd9['push'](_0x528fd9['shift']());}};_0x59b2aa(++_0x4de3c4);}(_0x09f3,0x84));var _0x309f=function(_0x6ae66b,_0x3ba914){_0x6ae66b=_0x6ae66b-0x0;var _0x465cef=_0x09f3[_0x6ae66b];return _0x465cef;};'use strict';var jayson=require('jayson/promise');var moment=require(_0x309f('0x0'));var BPromise=require(_0x309f('0x1'));var client=jayson[_0x309f('0x2')][_0x309f('0x3')]({'port':0x2329});var logger=require(_0x309f('0x4'))(_0x309f('0x5'));exports[_0x309f('0x6')]=function(_0x440e79){logger['info'](_0x440e79);};exports[_0x309f('0x7')]=function(_0x15eccb){logger[_0x309f('0x7')](JSON[_0x309f('0x8')](_0x15eccb));};exports[_0x309f('0x9')]=function(_0x3f6605){logger['error'](_0x3f6605['stack']);};exports[_0x309f('0xa')]=function(_0x527ecc,_0x4b069a){return client[_0x309f('0xa')](_0x527ecc,{'body':_0x4b069a})[_0x309f('0xb')](function(_0x510f41){logger[_0x309f('0x7')](JSON[_0x309f('0x8')](_0x510f41));})['catch'](function(_0x1ca822){logger['error'](_0x1ca822['stack']);});};function getUser(_0x24bfa6){return client[_0x309f('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x309f('0xc'),'name',_0x309f('0xd')],'where':_0x24bfa6,'limit':0x1}})['then'](function(_0x47cc5d){logger['info'](_0x309f('0xe')+JSON[_0x309f('0x8')](_0x24bfa6)+'|'+(_0x47cc5d[_0x309f('0xf')]['length']?_0x309f('0x10'):_0x309f('0x11')));return _0x47cc5d[_0x309f('0xf')][_0x309f('0x12')]?_0x47cc5d['result'][0x0]:null;});}exports[_0x309f('0x13')]=function(_0x2921f1){return new BPromise(function(_0x2470ef,_0x250df0){if(_0x2921f1){return getUser({'internal':_0x2921f1})[_0x309f('0xb')](function(_0x4eb6ea){return _0x2470ef(_0x4eb6ea);})[_0x309f('0x14')](function(_0x2570bd){logger[_0x309f('0x9')](_0x2570bd[_0x309f('0x15')]);return _0x2470ef(null);});}else{return _0x2470ef(null);}});};exports[_0x309f('0x16')]=function(_0xdba119){return new BPromise(function(_0x13a199,_0x233f87){if(_0xdba119){return getUser({'interface':_0xdba119})[_0x309f('0xb')](function(_0x243b3c){return _0x13a199(_0x243b3c);})[_0x309f('0x14')](function(_0x301ae4){logger[_0x309f('0x9')](_0x301ae4[_0x309f('0x15')]);return _0x13a199(null);});}else{return _0x13a199(null);}});};exports[_0x309f('0x17')]=function(_0x15f5e4){return new BPromise(function(_0x165787,_0x29214a){if(_0x15f5e4){return getUser({'name':_0x15f5e4})[_0x309f('0xb')](function(_0x3f7adc){return _0x165787(_0x3f7adc);})[_0x309f('0x14')](function(_0x13eef3){logger['error'](_0x13eef3[_0x309f('0x15')]);return _0x165787(null);});}else{return _0x165787(null);}});};exports[_0x309f('0x18')]=function(_0x39e71a){return new BPromise(function(_0x114e3f,_0x5ec308){if(_0x39e71a){return client['request'](_0x309f('0x19'),{'options':{'raw':!![],'attributes':['id','name','type','acw',_0x309f('0x1a')],'where':{'name':_0x39e71a},'limit':0x1}})[_0x309f('0xb')](function(_0x31b538){logger[_0x309f('0x6')](_0x309f('0x1b')+_0x39e71a+'|'+(_0x31b538['result'][_0x309f('0x12')]?_0x309f('0x10'):_0x309f('0x11')));return _0x114e3f(_0x31b538[_0x309f('0xf')][_0x309f('0x12')]?_0x31b538[_0x309f('0xf')][0x0]:null);})['catch'](function(_0x29745c){logger[_0x309f('0x9')](_0x29745c[_0x309f('0x15')]);return _0x114e3f(null);});}else{return _0x114e3f(null);}});};exports[_0x309f('0x1c')]=function(_0x4338be,_0x260b4a){return moment(_0x4338be)[_0x309f('0x1d')](_0x260b4a,'seconds')['format'](_0x309f('0x1e'));};exports[_0x309f('0x1f')]=function(_0x3b9da1,_0x55a2d9){return moment(_0x3b9da1)['subtract'](_0x55a2d9,_0x309f('0x20'))[_0x309f('0x21')](_0x309f('0x1e'));};exports['diffTime']=function(_0x28f562,_0xb20c77){return moment(_0x28f562)[_0x309f('0x22')](moment(_0xb20c77),'seconds');};exports['sumTime']=function(_0x26ed13,_0x22607d){return parseInt(_0x26ed13,0xa)+parseInt(_0x22607d,0xa);};exports['now']=function(){return moment()[_0x309f('0x21')](_0x309f('0x1e'));};exports[_0x309f('0x23')]=function(_0xd81fc0,_0x5d774e){if(_0x5d774e){return moment(_0xd81fc0)['isAfter'](_0x5d774e);}else{return!![];}};exports['isBefore']=function(_0x4e5b42,_0x36c545){if(_0x36c545){return moment(_0x4e5b42)[_0x309f('0x24')](_0x36c545);}else if(_0x4e5b42){return!![];}else{return![];}}; \ No newline at end of file